From 40db7ba002a81245d9644e5b45c92813ae4f11be Mon Sep 17 00:00:00 2001 From: kangsunlee Date: Wed, 25 Jun 2025 16:05:27 +0900 Subject: [PATCH 01/19] =?UTF-8?q?[FO]=20=EA=B0=9C=EC=9D=B8=EC=A0=95?= =?UTF-8?q?=EB=B3=B4=EB=B3=80=EA=B2=BD=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/resources/templates/info/user/user.html | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/front/src/main/resources/templates/info/user/user.html b/front/src/main/resources/templates/info/user/user.html index f4a151cb..f8ed1474 100644 --- a/front/src/main/resources/templates/info/user/user.html +++ b/front/src/main/resources/templates/info/user/user.html @@ -85,14 +85,14 @@
- +
- +
@@ -113,14 +113,14 @@
- +
- +
From 5818316e658dcbd6f4e9b99528f56e7ee46d183f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=A3=BC=EC=88=98=ED=98=84?= Date: Thu, 26 Jun 2025 09:31:26 +0900 Subject: [PATCH 02/19] =?UTF-8?q?=EC=A1=B0=EC=82=AC=EC=9B=90=20=ED=98=84?= =?UTF-8?q?=ED=99=A9=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../adapters/web/AdminUpdatePostController.java | 3 --- .../web/model/ResearchersVisitDetailReqVO.java | 7 ++++--- .../resources/mappers/researcher/ResearcherMapper.xml | 11 +++++++++-- .../main/resources/templates/researcher/detail.html | 8 ++++++++ 4 files changed, 21 insertions(+), 8 deletions(-) diff --git a/admin/src/main/java/app/module/admin/usecase/admin/saveAdmin/adapters/web/AdminUpdatePostController.java b/admin/src/main/java/app/module/admin/usecase/admin/saveAdmin/adapters/web/AdminUpdatePostController.java index b2d154af..b3289ea4 100644 --- a/admin/src/main/java/app/module/admin/usecase/admin/saveAdmin/adapters/web/AdminUpdatePostController.java +++ b/admin/src/main/java/app/module/admin/usecase/admin/saveAdmin/adapters/web/AdminUpdatePostController.java @@ -27,10 +27,7 @@ import java.util.stream.Collectors; class AdminUpdatePostController { private final AdminUpdateValidator adminUpdateValidator; - private final RoleListPortIn roleListPortIn; - private final UICodeListPortIn uiCodeListPortIn; private final SaveAdminPortIn saveAdminPortIn; - private final MessageUtil messageUtil; @PostMapping(path = "/api/settings/admin/update") ResponseEntity operate( @RequestBody AdminUpdateBindingVO bindingVO, BindingResult bindingResult) { diff --git a/admin/src/main/java/app/module/admin/usecase/researcher/adpaters/web/model/ResearchersVisitDetailReqVO.java b/admin/src/main/java/app/module/admin/usecase/researcher/adpaters/web/model/ResearchersVisitDetailReqVO.java index 0c411ee9..0aef8900 100644 --- a/admin/src/main/java/app/module/admin/usecase/researcher/adpaters/web/model/ResearchersVisitDetailReqVO.java +++ b/admin/src/main/java/app/module/admin/usecase/researcher/adpaters/web/model/ResearchersVisitDetailReqVO.java @@ -5,13 +5,14 @@ import app.module.core.config.adapters.persistence.component.AuditCommand; import lombok.Getter; import lombok.Setter; +import java.time.LocalDate; import java.time.LocalDateTime; @Getter @Setter -public class ResearchersVisitDetailReqVO { - private String id; - private String visitDate; +public class ResearchersVisitDetailReqVO extends AuditCommand { + private Integer id; + private LocalDate visitDate; private ManagementType managementType; private String content; private String isGiftSent; diff --git a/admin/src/main/resources/mappers/researcher/ResearcherMapper.xml b/admin/src/main/resources/mappers/researcher/ResearcherMapper.xml index 15751c66..38a44745 100644 --- a/admin/src/main/resources/mappers/researcher/ResearcherMapper.xml +++ b/admin/src/main/resources/mappers/researcher/ResearcherMapper.xml @@ -225,8 +225,15 @@ set visit_date = #{visitDate}, content = #{content}, management_type = #{managementType}, - is_gift_sent = #{isGiftSent}, - + + + is_gift_sent = true, + + + is_gift_sent = false, + + + where id = #{id} diff --git a/admin/src/main/resources/templates/researcher/detail.html b/admin/src/main/resources/templates/researcher/detail.html index c920931a..74a065ff 100644 --- a/admin/src/main/resources/templates/researcher/detail.html +++ b/admin/src/main/resources/templates/researcher/detail.html @@ -5,6 +5,14 @@
+ + + + + + + + From fcc1b868b710fb6534d594256d55f08a47a50e5a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=A3=BC=EC=88=98=ED=98=84?= Date: Thu, 26 Jun 2025 10:31:11 +0900 Subject: [PATCH 03/19] =?UTF-8?q?=EC=A1=B0=EC=82=AC=EC=9B=90=20=ED=98=84?= =?UTF-8?q?=ED=99=A9=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../application/security/AdminAuthSuccessEvent.java | 6 +++--- .../adapters/persistence/UpdateNoticeDao.java | 1 - .../loggedinuser/save/ports/LoggedInUserSavePortIn.java | 8 -------- .../loggedinuser/save/ports/LoggedInUserSavePortOut.java | 8 -------- .../main/resources/mappers/notice/UpdateNoticeMapper.xml | 1 + .../save/adapter/persistence/LoggedInUserSaveDao.java | 6 +++--- .../save/adapter/persistence/LoggedInUserSaveMapper.java | 2 +- .../loggedinuser/save/ports/LoggedInUserSavePortIn.java | 8 ++++++++ .../loggedinuser/save/ports/LoggedInUserSavePortOut.java | 8 ++++++++ .../save/ports/application/LoggedInUserSaveService.java | 8 ++++---- .../ports/application/domain/LoggedInUserIdSaveCmd.java | 8 ++------ .../ports/application/domain/LoggedInUserSaveCmd.java | 9 +++------ .../uicode/view/adapters/persistence/UICodeViewDao.java | 1 - .../mappers/loggedinuser/LoggedInUserSaveMapper.xml | 2 +- 14 files changed, 34 insertions(+), 42 deletions(-) delete mode 100644 admin/src/main/java/app/module/admin/usecase/loggedinuser/save/ports/LoggedInUserSavePortIn.java delete mode 100644 admin/src/main/java/app/module/admin/usecase/loggedinuser/save/ports/LoggedInUserSavePortOut.java rename {admin/src/main/java/app/module/admin => core/src/main/java/app/module/core}/usecase/loggedinuser/save/adapter/persistence/LoggedInUserSaveDao.java (73%) rename {admin/src/main/java/app/module/admin => core/src/main/java/app/module/core}/usecase/loggedinuser/save/adapter/persistence/LoggedInUserSaveMapper.java (78%) create mode 100644 core/src/main/java/app/module/core/usecase/loggedinuser/save/ports/LoggedInUserSavePortIn.java create mode 100644 core/src/main/java/app/module/core/usecase/loggedinuser/save/ports/LoggedInUserSavePortOut.java rename {admin/src/main/java/app/module/admin => core/src/main/java/app/module/core}/usecase/loggedinuser/save/ports/application/LoggedInUserSaveService.java (53%) rename {admin/src/main/java/app/module/admin => core/src/main/java/app/module/core}/usecase/loggedinuser/save/ports/application/domain/LoggedInUserIdSaveCmd.java (50%) rename {admin/src/main/java/app/module/admin => core/src/main/java/app/module/core}/usecase/loggedinuser/save/ports/application/domain/LoggedInUserSaveCmd.java (54%) rename {admin => core}/src/main/resources/mappers/loggedinuser/LoggedInUserSaveMapper.xml (89%) diff --git a/admin/src/main/java/app/module/admin/config/application/security/AdminAuthSuccessEvent.java b/admin/src/main/java/app/module/admin/config/application/security/AdminAuthSuccessEvent.java index c308fcdb..61c61a2b 100644 --- a/admin/src/main/java/app/module/admin/config/application/security/AdminAuthSuccessEvent.java +++ b/admin/src/main/java/app/module/admin/config/application/security/AdminAuthSuccessEvent.java @@ -1,8 +1,8 @@ package app.module.admin.config.application.security; -import app.module.admin.usecase.loggedinuser.save.ports.LoggedInUserSavePortIn; -import app.module.admin.usecase.loggedinuser.save.ports.application.domain.LoggedInUserIdSaveCmd; -import app.module.admin.usecase.loggedinuser.save.ports.application.domain.LoggedInUserSaveCmd; +import app.module.core.usecase.loggedinuser.save.ports.LoggedInUserSavePortIn; +import app.module.core.usecase.loggedinuser.save.ports.application.domain.LoggedInUserIdSaveCmd; +import app.module.core.usecase.loggedinuser.save.ports.application.domain.LoggedInUserSaveCmd; import app.module.core.config.application.enums.AppType; import app.module.core.config.application.util.CommonUtil; import app.module.core.config.application.util.MessageUtil; diff --git a/admin/src/main/java/app/module/admin/usecase/communication/notice/updateNotice/adapters/persistence/UpdateNoticeDao.java b/admin/src/main/java/app/module/admin/usecase/communication/notice/updateNotice/adapters/persistence/UpdateNoticeDao.java index f5276435..e4ed8ee0 100644 --- a/admin/src/main/java/app/module/admin/usecase/communication/notice/updateNotice/adapters/persistence/UpdateNoticeDao.java +++ b/admin/src/main/java/app/module/admin/usecase/communication/notice/updateNotice/adapters/persistence/UpdateNoticeDao.java @@ -21,7 +21,6 @@ class UpdateNoticeDao implements UpdateNoticePortOut { @Override public void operate(UpdateNoticeCmd command) { mapper.updateNotice( - new UpdateNoticeDto( command.getId(), command.getTitle(), diff --git a/admin/src/main/java/app/module/admin/usecase/loggedinuser/save/ports/LoggedInUserSavePortIn.java b/admin/src/main/java/app/module/admin/usecase/loggedinuser/save/ports/LoggedInUserSavePortIn.java deleted file mode 100644 index d410403c..00000000 --- a/admin/src/main/java/app/module/admin/usecase/loggedinuser/save/ports/LoggedInUserSavePortIn.java +++ /dev/null @@ -1,8 +0,0 @@ -package app.module.admin.usecase.loggedinuser.save.ports; - -import app.module.admin.usecase.loggedinuser.save.ports.application.domain.LoggedInUserSaveCmd; - -public interface LoggedInUserSavePortIn { - - void connect(LoggedInUserSaveCmd loggedInUserSaveCmd); -} diff --git a/admin/src/main/java/app/module/admin/usecase/loggedinuser/save/ports/LoggedInUserSavePortOut.java b/admin/src/main/java/app/module/admin/usecase/loggedinuser/save/ports/LoggedInUserSavePortOut.java deleted file mode 100644 index 8da77957..00000000 --- a/admin/src/main/java/app/module/admin/usecase/loggedinuser/save/ports/LoggedInUserSavePortOut.java +++ /dev/null @@ -1,8 +0,0 @@ -package app.module.admin.usecase.loggedinuser.save.ports; - -import app.module.admin.usecase.loggedinuser.save.ports.application.domain.LoggedInUserSaveCmd; - -public interface LoggedInUserSavePortOut { - - void connect(LoggedInUserSaveCmd loggedInUser); -} diff --git a/admin/src/main/resources/mappers/notice/UpdateNoticeMapper.xml b/admin/src/main/resources/mappers/notice/UpdateNoticeMapper.xml index fa705ec4..974a53f3 100644 --- a/admin/src/main/resources/mappers/notice/UpdateNoticeMapper.xml +++ b/admin/src/main/resources/mappers/notice/UpdateNoticeMapper.xml @@ -42,4 +42,5 @@ WHERE id = #{id} + \ No newline at end of file diff --git a/admin/src/main/java/app/module/admin/usecase/loggedinuser/save/adapter/persistence/LoggedInUserSaveDao.java b/core/src/main/java/app/module/core/usecase/loggedinuser/save/adapter/persistence/LoggedInUserSaveDao.java similarity index 73% rename from admin/src/main/java/app/module/admin/usecase/loggedinuser/save/adapter/persistence/LoggedInUserSaveDao.java rename to core/src/main/java/app/module/core/usecase/loggedinuser/save/adapter/persistence/LoggedInUserSaveDao.java index 116fa136..9239302a 100644 --- a/admin/src/main/java/app/module/admin/usecase/loggedinuser/save/adapter/persistence/LoggedInUserSaveDao.java +++ b/core/src/main/java/app/module/core/usecase/loggedinuser/save/adapter/persistence/LoggedInUserSaveDao.java @@ -1,7 +1,7 @@ -package app.module.admin.usecase.loggedinuser.save.adapter.persistence; +package app.module.core.usecase.loggedinuser.save.adapter.persistence; -import app.module.admin.usecase.loggedinuser.save.ports.LoggedInUserSavePortOut; -import app.module.admin.usecase.loggedinuser.save.ports.application.domain.LoggedInUserSaveCmd; +import app.module.core.usecase.loggedinuser.save.ports.LoggedInUserSavePortOut; +import app.module.core.usecase.loggedinuser.save.ports.application.domain.LoggedInUserSaveCmd; import app.module.core.config.adapters.persistence.entity.LoggedInUser; import lombok.RequiredArgsConstructor; import org.springframework.stereotype.Repository; diff --git a/admin/src/main/java/app/module/admin/usecase/loggedinuser/save/adapter/persistence/LoggedInUserSaveMapper.java b/core/src/main/java/app/module/core/usecase/loggedinuser/save/adapter/persistence/LoggedInUserSaveMapper.java similarity index 78% rename from admin/src/main/java/app/module/admin/usecase/loggedinuser/save/adapter/persistence/LoggedInUserSaveMapper.java rename to core/src/main/java/app/module/core/usecase/loggedinuser/save/adapter/persistence/LoggedInUserSaveMapper.java index fc3cc9e8..2a8732a4 100644 --- a/admin/src/main/java/app/module/admin/usecase/loggedinuser/save/adapter/persistence/LoggedInUserSaveMapper.java +++ b/core/src/main/java/app/module/core/usecase/loggedinuser/save/adapter/persistence/LoggedInUserSaveMapper.java @@ -1,4 +1,4 @@ -package app.module.admin.usecase.loggedinuser.save.adapter.persistence; +package app.module.core.usecase.loggedinuser.save.adapter.persistence; import app.module.core.config.adapters.persistence.entity.LoggedInUser; import org.apache.ibatis.annotations.Mapper; diff --git a/core/src/main/java/app/module/core/usecase/loggedinuser/save/ports/LoggedInUserSavePortIn.java b/core/src/main/java/app/module/core/usecase/loggedinuser/save/ports/LoggedInUserSavePortIn.java new file mode 100644 index 00000000..8cc8192a --- /dev/null +++ b/core/src/main/java/app/module/core/usecase/loggedinuser/save/ports/LoggedInUserSavePortIn.java @@ -0,0 +1,8 @@ +package app.module.core.usecase.loggedinuser.save.ports; + +import app.module.core.usecase.loggedinuser.save.ports.application.domain.LoggedInUserSaveCmd; + +public interface LoggedInUserSavePortIn { + + void connect(LoggedInUserSaveCmd loggedInUserSaveCmd); +} diff --git a/core/src/main/java/app/module/core/usecase/loggedinuser/save/ports/LoggedInUserSavePortOut.java b/core/src/main/java/app/module/core/usecase/loggedinuser/save/ports/LoggedInUserSavePortOut.java new file mode 100644 index 00000000..0fbd2387 --- /dev/null +++ b/core/src/main/java/app/module/core/usecase/loggedinuser/save/ports/LoggedInUserSavePortOut.java @@ -0,0 +1,8 @@ +package app.module.core.usecase.loggedinuser.save.ports; + +import app.module.core.usecase.loggedinuser.save.ports.application.domain.LoggedInUserSaveCmd; + +public interface LoggedInUserSavePortOut { + + void connect(LoggedInUserSaveCmd loggedInUser); +} diff --git a/admin/src/main/java/app/module/admin/usecase/loggedinuser/save/ports/application/LoggedInUserSaveService.java b/core/src/main/java/app/module/core/usecase/loggedinuser/save/ports/application/LoggedInUserSaveService.java similarity index 53% rename from admin/src/main/java/app/module/admin/usecase/loggedinuser/save/ports/application/LoggedInUserSaveService.java rename to core/src/main/java/app/module/core/usecase/loggedinuser/save/ports/application/LoggedInUserSaveService.java index 0dc5b3ec..fbae28c6 100644 --- a/admin/src/main/java/app/module/admin/usecase/loggedinuser/save/ports/application/LoggedInUserSaveService.java +++ b/core/src/main/java/app/module/core/usecase/loggedinuser/save/ports/application/LoggedInUserSaveService.java @@ -1,8 +1,8 @@ -package app.module.admin.usecase.loggedinuser.save.ports.application; +package app.module.core.usecase.loggedinuser.save.ports.application; -import app.module.admin.usecase.loggedinuser.save.ports.LoggedInUserSavePortIn; -import app.module.admin.usecase.loggedinuser.save.ports.LoggedInUserSavePortOut; -import app.module.admin.usecase.loggedinuser.save.ports.application.domain.LoggedInUserSaveCmd; +import app.module.core.usecase.loggedinuser.save.ports.LoggedInUserSavePortIn; +import app.module.core.usecase.loggedinuser.save.ports.LoggedInUserSavePortOut; +import app.module.core.usecase.loggedinuser.save.ports.application.domain.LoggedInUserSaveCmd; import lombok.RequiredArgsConstructor; import org.springframework.stereotype.Service; diff --git a/admin/src/main/java/app/module/admin/usecase/loggedinuser/save/ports/application/domain/LoggedInUserIdSaveCmd.java b/core/src/main/java/app/module/core/usecase/loggedinuser/save/ports/application/domain/LoggedInUserIdSaveCmd.java similarity index 50% rename from admin/src/main/java/app/module/admin/usecase/loggedinuser/save/ports/application/domain/LoggedInUserIdSaveCmd.java rename to core/src/main/java/app/module/core/usecase/loggedinuser/save/ports/application/domain/LoggedInUserIdSaveCmd.java index 37b2318b..f8427c5b 100644 --- a/admin/src/main/java/app/module/admin/usecase/loggedinuser/save/ports/application/domain/LoggedInUserIdSaveCmd.java +++ b/core/src/main/java/app/module/core/usecase/loggedinuser/save/ports/application/domain/LoggedInUserIdSaveCmd.java @@ -1,11 +1,7 @@ -package app.module.admin.usecase.loggedinuser.save.ports.application.domain; +package app.module.core.usecase.loggedinuser.save.ports.application.domain; import app.module.core.config.application.enums.AppType; -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; +import lombok.*; @Getter @Setter diff --git a/admin/src/main/java/app/module/admin/usecase/loggedinuser/save/ports/application/domain/LoggedInUserSaveCmd.java b/core/src/main/java/app/module/core/usecase/loggedinuser/save/ports/application/domain/LoggedInUserSaveCmd.java similarity index 54% rename from admin/src/main/java/app/module/admin/usecase/loggedinuser/save/ports/application/domain/LoggedInUserSaveCmd.java rename to core/src/main/java/app/module/core/usecase/loggedinuser/save/ports/application/domain/LoggedInUserSaveCmd.java index b18198bd..56e473fd 100644 --- a/admin/src/main/java/app/module/admin/usecase/loggedinuser/save/ports/application/domain/LoggedInUserSaveCmd.java +++ b/core/src/main/java/app/module/core/usecase/loggedinuser/save/ports/application/domain/LoggedInUserSaveCmd.java @@ -1,11 +1,8 @@ -package app.module.admin.usecase.loggedinuser.save.ports.application.domain; +package app.module.core.usecase.loggedinuser.save.ports.application.domain; + +import lombok.*; import java.time.LocalDateTime; -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; @Builder @Getter diff --git a/core/src/main/java/app/module/core/usecase/uicode/view/adapters/persistence/UICodeViewDao.java b/core/src/main/java/app/module/core/usecase/uicode/view/adapters/persistence/UICodeViewDao.java index 526af2eb..41523801 100644 --- a/core/src/main/java/app/module/core/usecase/uicode/view/adapters/persistence/UICodeViewDao.java +++ b/core/src/main/java/app/module/core/usecase/uicode/view/adapters/persistence/UICodeViewDao.java @@ -1,6 +1,5 @@ package app.module.core.usecase.uicode.view.adapters.persistence; -import app.module.core.config.adapters.persistence.repository.UICodeRepo; import app.module.core.usecase.uicode.view.ports.UICodeViewPortOut; import app.module.core.usecase.uicode.view.ports.application.domain.UICodeView; import lombok.RequiredArgsConstructor; diff --git a/admin/src/main/resources/mappers/loggedinuser/LoggedInUserSaveMapper.xml b/core/src/main/resources/mappers/loggedinuser/LoggedInUserSaveMapper.xml similarity index 89% rename from admin/src/main/resources/mappers/loggedinuser/LoggedInUserSaveMapper.xml rename to core/src/main/resources/mappers/loggedinuser/LoggedInUserSaveMapper.xml index a21fd09b..655bafe3 100644 --- a/admin/src/main/resources/mappers/loggedinuser/LoggedInUserSaveMapper.xml +++ b/core/src/main/resources/mappers/loggedinuser/LoggedInUserSaveMapper.xml @@ -2,7 +2,7 @@ + namespace="app.module.core.usecase.loggedinuser.save.adapter.persistence.LoggedInUserSaveMapper"> INSERT INTO logged_in_user From 063c9018e421f4ae8726f527b6568318f6533436 Mon Sep 17 00:00:00 2001 From: kangsunlee Date: Thu, 26 Jun 2025 11:19:36 +0900 Subject: [PATCH 04/19] =?UTF-8?q?[BO]=20=EC=9E=84=EA=B0=80=ED=98=84?= =?UTF-8?q?=ED=99=A9=20-=20=EA=B2=80=EC=83=89=20=EC=88=98=EC=A0=95,=20?= =?UTF-8?q?=EC=A1=B0=EC=82=AC=EC=9B=90=ED=98=84=ED=99=A9=20-=20=EC=9E=84?= =?UTF-8?q?=EA=B0=80=EC=83=81=EC=84=B8=EB=A1=9C=20=EC=9D=B4=EB=8F=99=20?= =?UTF-8?q?=EC=B2=98=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../household/GetHouseholdsStatusMapper.xml | 16 ++++++++++++++-- .../resources/templates/researcher/detail.html | 7 ++++--- 2 files changed, 18 insertions(+), 5 deletions(-) diff --git a/admin/src/main/resources/mappers/household/GetHouseholdsStatusMapper.xml b/admin/src/main/resources/mappers/household/GetHouseholdsStatusMapper.xml index 7c7dff51..270c1f79 100644 --- a/admin/src/main/resources/mappers/household/GetHouseholdsStatusMapper.xml +++ b/admin/src/main/resources/mappers/household/GetHouseholdsStatusMapper.xml @@ -83,9 +83,15 @@ 1=1 - + /* 경영주 검색 */ + + AND ( + hvr.householdName ILIKE '%' || #{cmd.ownerValue} || '%' + OR hvr.householdPhone ILIKE '%' || #{cmd.ownerValue} || '%' + ) + AND hvr.householdName ILIKE '%' || #{cmd.ownerValue} || '%' @@ -95,9 +101,15 @@ - + /* 조사원 검색 */ + + AND ( + hvr.researcherName ILIKE '%' || #{cmd.researcherValue} || '%' + OR hvr.researcherPhone ILIKE '%' || #{cmd.researcherValue} || '%' + ) + AND hvr.researcherName ILIKE '%' || #{cmd.researcherValue} || '%' diff --git a/admin/src/main/resources/templates/researcher/detail.html b/admin/src/main/resources/templates/researcher/detail.html index c920931a..6c7a201f 100644 --- a/admin/src/main/resources/templates/researcher/detail.html +++ b/admin/src/main/resources/templates/researcher/detail.html @@ -42,6 +42,8 @@
+ +
@@ -218,8 +220,8 @@ tbody.append( `
- - + + @@ -231,7 +233,6 @@ ` ); }); - // TODO 임가번호 OR 경영주명 선택시 임가현황 상세화면으로 이동 if (!$(response.content).length) { tbody.append(` From 34f97cee240b09febcb548ba299b5a5ce9f4d6e0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=A3=BC=EC=88=98=ED=98=84?= Date: Thu, 26 Jun 2025 12:03:08 +0900 Subject: [PATCH 05/19] =?UTF-8?q?=ED=94=84=EB=A1=A0=ED=8A=B8=20=EB=A1=9C?= =?UTF-8?q?=EA=B7=B8=EC=9D=B8=20=EC=9D=B4=EB=A0=A5=20=EC=8C=93=EA=B8=B0=20?= =?UTF-8?q?=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../security/FrontAuthSuccessEvent.java | 56 +++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 front/src/main/java/app/module/front/config/application/security/FrontAuthSuccessEvent.java diff --git a/front/src/main/java/app/module/front/config/application/security/FrontAuthSuccessEvent.java b/front/src/main/java/app/module/front/config/application/security/FrontAuthSuccessEvent.java new file mode 100644 index 00000000..721c451c --- /dev/null +++ b/front/src/main/java/app/module/front/config/application/security/FrontAuthSuccessEvent.java @@ -0,0 +1,56 @@ +package app.module.front.config.application.security; + +import app.module.core.config.application.enums.AppType; +import app.module.core.config.application.util.CommonUtil; +import app.module.core.usecase.loggedinuser.save.ports.LoggedInUserSavePortIn; +import app.module.core.usecase.loggedinuser.save.ports.application.domain.LoggedInUserIdSaveCmd; +import app.module.core.usecase.loggedinuser.save.ports.application.domain.LoggedInUserSaveCmd; +import jakarta.servlet.http.HttpServletRequest; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.context.event.EventListener; +import org.springframework.security.authentication.event.AbstractAuthenticationFailureEvent; +import org.springframework.security.authentication.event.AuthenticationSuccessEvent; +import org.springframework.security.core.Authentication; +import org.springframework.stereotype.Component; +import org.springframework.web.context.request.RequestContextHolder; +import org.springframework.web.context.request.ServletRequestAttributes; + +import java.time.LocalDateTime; + +@Component +@RequiredArgsConstructor +@Slf4j +public class FrontAuthSuccessEvent { + + private final LoggedInUserSavePortIn loggedInUserSavePortIn; + + + @EventListener + public void handleAuthenticationSuccessEvent(AuthenticationSuccessEvent event) { + Authentication authentication = event.getAuthentication(); + FrontHouseholdUser householdUser = (FrontHouseholdUser) authentication.getPrincipal(); + + HttpServletRequest request = + ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest(); + // 로그인 이력 쌓기 + loggedInUserSavePortIn.connect( + LoggedInUserSaveCmd.builder() + .loggedInUserId( + LoggedInUserIdSaveCmd.builder() + .appType(AppType.FRONT) + .id(authentication.getName()) + .build()) + .clientIP(CommonUtil.getClientIP(request)) + .lastLoggedInAt(LocalDateTime.now()) + .build()); + + } + + @EventListener + public void handleAuthenticationFailureEvent(AbstractAuthenticationFailureEvent event) { + Exception e = event.getException(); + Authentication authentication = event.getAuthentication(); + log.warn("Unsuccessful authentication result: {}", authentication, e); + } +} From 6b54f605c8ed5d5605ee5a763e5ec7928d539cec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=A3=BC=EC=88=98=ED=98=84?= Date: Thu, 26 Jun 2025 13:33:57 +0900 Subject: [PATCH 06/19] =?UTF-8?q?=EA=B3=B5=EC=8B=9D=EA=B0=80=EC=9E=85?= =?UTF-8?q?=EC=84=BC=ED=84=B0=20=EB=B0=94=EB=A1=9C=EA=B0=80=EA=B8=B0=20?= =?UTF-8?q?=EC=82=AD=EC=A0=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- admin/src/main/resources/templates/security/login.html | 3 --- 1 file changed, 3 deletions(-) diff --git a/admin/src/main/resources/templates/security/login.html b/admin/src/main/resources/templates/security/login.html index 6cde9987..0c6104a7 100644 --- a/admin/src/main/resources/templates/security/login.html +++ b/admin/src/main/resources/templates/security/login.html @@ -40,9 +40,6 @@ 로그인 -
    From 1f689376de48470a37a914544de185347254fe10 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EA=B9=80=ED=98=84=EC=A3=BC?= Date: Thu, 26 Jun 2025 13:49:24 +0900 Subject: [PATCH 07/19] =?UTF-8?q?[BO]=20=EC=9D=BC=EA=B3=84=EB=B6=80=20?= =?UTF-8?q?=EB=93=B1=EB=A1=9D=20=ED=98=84=ED=99=A9=EC=9D=98=20=EA=B8=88?= =?UTF-8?q?=EC=9D=BC=20=EB=8D=B0=EC=9D=B4=ED=84=B0=20=EC=97=86=EC=9D=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../domain/GetDailyRecordsStatus.java | 1 + .../persistence/UpdateDailyNoneDao.java | 47 ++++ .../persistence/UpdateDailyNoneMapper.java | 51 ++++ .../web/UpdateDailyNoneController.java | 27 ++ .../web/modal/UpdateDailyNoneReqVO.java | 24 ++ .../ports/UpdateDailyNonePortIn.java | 12 + .../ports/UpdateDailyNonePortOut.java | 12 + .../application/UpdateDailyNoneService.java | 33 +++ .../domain/UpdateDailyNoneCmd.java | 30 +++ .../household/GetDailyRecordsStatusMapper.xml | 1 + .../household/UpdateDailyNoneMapper.xml | 68 +++++ .../households/tab/daily-record.html | 240 +++++++++++++++--- .../persistence/component/AuditCommand.java | 2 + .../adapters/persistence/DailyRecordDao.java | 5 + .../daily/record/ports/DailyRecordPortIn.java | 6 +- .../domain/UpdateDailyRecordStatusCmd.java | 9 + .../mappers/daily/DailyRecordMapper.xml | 1 - .../adapters/web/DailyRecordController.java | 1 - 18 files changed, 537 insertions(+), 33 deletions(-) create mode 100644 admin/src/main/java/app/module/admin/usecase/household/tab/dailyRecord/updateDailyNone/adapters/persistence/UpdateDailyNoneDao.java create mode 100644 admin/src/main/java/app/module/admin/usecase/household/tab/dailyRecord/updateDailyNone/adapters/persistence/UpdateDailyNoneMapper.java create mode 100644 admin/src/main/java/app/module/admin/usecase/household/tab/dailyRecord/updateDailyNone/adapters/web/UpdateDailyNoneController.java create mode 100644 admin/src/main/java/app/module/admin/usecase/household/tab/dailyRecord/updateDailyNone/adapters/web/modal/UpdateDailyNoneReqVO.java create mode 100644 admin/src/main/java/app/module/admin/usecase/household/tab/dailyRecord/updateDailyNone/ports/UpdateDailyNonePortIn.java create mode 100644 admin/src/main/java/app/module/admin/usecase/household/tab/dailyRecord/updateDailyNone/ports/UpdateDailyNonePortOut.java create mode 100644 admin/src/main/java/app/module/admin/usecase/household/tab/dailyRecord/updateDailyNone/ports/application/UpdateDailyNoneService.java create mode 100644 admin/src/main/java/app/module/admin/usecase/household/tab/dailyRecord/updateDailyNone/ports/application/domain/UpdateDailyNoneCmd.java create mode 100644 admin/src/main/resources/mappers/household/UpdateDailyNoneMapper.xml diff --git a/admin/src/main/java/app/module/admin/usecase/household/tab/dailyRecord/getDailyRecordsStatus/ports/application/domain/GetDailyRecordsStatus.java b/admin/src/main/java/app/module/admin/usecase/household/tab/dailyRecord/getDailyRecordsStatus/ports/application/domain/GetDailyRecordsStatus.java index 4ca9f925..1b6f419a 100644 --- a/admin/src/main/java/app/module/admin/usecase/household/tab/dailyRecord/getDailyRecordsStatus/ports/application/domain/GetDailyRecordsStatus.java +++ b/admin/src/main/java/app/module/admin/usecase/household/tab/dailyRecord/getDailyRecordsStatus/ports/application/domain/GetDailyRecordsStatus.java @@ -11,6 +11,7 @@ import lombok.Setter; @EqualsAndHashCode public class GetDailyRecordsStatus { private Long id; + private Integer dayGroupNo; private String dayGroup; private RecordStatusType allStatusType; private String incomeStatus; diff --git a/admin/src/main/java/app/module/admin/usecase/household/tab/dailyRecord/updateDailyNone/adapters/persistence/UpdateDailyNoneDao.java b/admin/src/main/java/app/module/admin/usecase/household/tab/dailyRecord/updateDailyNone/adapters/persistence/UpdateDailyNoneDao.java new file mode 100644 index 00000000..3a3fc5c5 --- /dev/null +++ b/admin/src/main/java/app/module/admin/usecase/household/tab/dailyRecord/updateDailyNone/adapters/persistence/UpdateDailyNoneDao.java @@ -0,0 +1,47 @@ +package app.module.admin.usecase.household.tab.dailyRecord.updateDailyNone.adapters.persistence; + +import app.module.admin.usecase.household.tab.dailyRecord.updateDailyNone.ports.UpdateDailyNonePortOut; +import app.module.admin.usecase.household.tab.dailyRecord.updateDailyNone.ports.application.domain.UpdateDailyNoneCmd; +import app.module.core.config.application.enums.DailySort; +import app.module.core.config.application.enums.DailyTargetStatus; +import app.module.core.usecase.daily.record.ports.DailyRecordPortIn; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Repository; + +@Slf4j +@Repository +@RequiredArgsConstructor +class UpdateDailyNoneDao implements UpdateDailyNonePortOut { + private final UpdateDailyNoneMapper mapper; + private final DailyRecordPortIn dailyRecordPortIn; + + @Override + public void create(UpdateDailyNoneCmd command) { + command.setDailyRecordSeq(mapper.getDailyRecordSeq(command)); + + if (command.getCurrentStep() != null) { + if (DailyTargetStatus.TODAY_NONE.equals(command.getCurrentStatus())) { + // 등록된 데이터 일괄 삭제 + if (DailySort.INCOME.equals(command.getCurrentStep())) { + mapper.removeDailyIncome(command); + } else if (DailySort.WORK.equals(command.getCurrentStep())) { + mapper.removeDailyWork(command); + } else if (DailySort.EXPENSE.equals(command.getCurrentStep())) { + mapper.removeDailyExpense(command); + } else if (DailySort.POWER.equals(command.getCurrentStep())) { + mapper.removeDailyPower(command); + } else if (DailySort.FORESTRY.equals(command.getCurrentStep())) { + mapper.removeDailyForestry(command); + } else if (DailySort.FARMING.equals(command.getCurrentStep())) { + mapper.removeDailyFarming(command); + } + } + + dailyRecordPortIn.updateByStatus(command.getSearchMonth(), command.getGroupNo(), command.getHouseholdSeq(), command.getCurrentStep().name(), command.getCurrentStatus().name()); + + } else { + log.error("[CreateDailyNone] Current step is null. cmd:{}", command); + } + } +} \ No newline at end of file diff --git a/admin/src/main/java/app/module/admin/usecase/household/tab/dailyRecord/updateDailyNone/adapters/persistence/UpdateDailyNoneMapper.java b/admin/src/main/java/app/module/admin/usecase/household/tab/dailyRecord/updateDailyNone/adapters/persistence/UpdateDailyNoneMapper.java new file mode 100644 index 00000000..54d4bd4e --- /dev/null +++ b/admin/src/main/java/app/module/admin/usecase/household/tab/dailyRecord/updateDailyNone/adapters/persistence/UpdateDailyNoneMapper.java @@ -0,0 +1,51 @@ +package app.module.admin.usecase.household.tab.dailyRecord.updateDailyNone.adapters.persistence; + +import app.module.admin.usecase.household.tab.dailyRecord.updateDailyNone.ports.application.domain.UpdateDailyNoneCmd; +import org.apache.ibatis.annotations.Mapper; + +@Mapper +public interface UpdateDailyNoneMapper { + /** + * 일계부 항목 일련번호 조회 + * + * @param command 검색 조건 + * @return 일계부 항목 일련번호 + */ + Long getDailyRecordSeq(UpdateDailyNoneCmd command); + + /** + * 특정일의 수입 전체 삭제 + * @param command 검색 조건 + */ + void removeDailyIncome(UpdateDailyNoneCmd command); + + /** + * 특정일의 임업노동 투입 전체 삭제 + * @param command 검색 조건 + */ + void removeDailyWork(UpdateDailyNoneCmd command); + + /** + * 특정일의 지출 전체 삭제 + * @param command 검색 조건 + */ + void removeDailyExpense(UpdateDailyNoneCmd command); + + /** + * 동력 사용시간 전체 삭제 + * @param command 검색 조건 + */ + void removeDailyPower(UpdateDailyNoneCmd command); + + /** + * 자가임업 생산물 중 자가소비량 전체 삭제 + * @param command 검색 조건 + */ + void removeDailyForestry(UpdateDailyNoneCmd command); + + /** + * 자가농업 생산물 중 자가소비량 전체 삭제 + * @param command 검색 조건 + */ + void removeDailyFarming(UpdateDailyNoneCmd command); +} diff --git a/admin/src/main/java/app/module/admin/usecase/household/tab/dailyRecord/updateDailyNone/adapters/web/UpdateDailyNoneController.java b/admin/src/main/java/app/module/admin/usecase/household/tab/dailyRecord/updateDailyNone/adapters/web/UpdateDailyNoneController.java new file mode 100644 index 00000000..1ca788d5 --- /dev/null +++ b/admin/src/main/java/app/module/admin/usecase/household/tab/dailyRecord/updateDailyNone/adapters/web/UpdateDailyNoneController.java @@ -0,0 +1,27 @@ +package app.module.admin.usecase.household.tab.dailyRecord.updateDailyNone.adapters.web; + +import app.module.admin.usecase.household.tab.dailyRecord.updateDailyNone.adapters.web.modal.UpdateDailyNoneReqVO; +import app.module.admin.usecase.household.tab.dailyRecord.updateDailyNone.ports.UpdateDailyNonePortIn; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RestController; + +@Slf4j +@RestController +@RequiredArgsConstructor +class UpdateDailyNoneController { + private final UpdateDailyNonePortIn updateDailyNonePortIn; + + @PostMapping(path = "/api/household/daily/today-none") + ResponseEntity create(@RequestBody UpdateDailyNoneReqVO formVO) { + log.debug("formVO: {}", formVO); + + updateDailyNonePortIn.create(formVO); + + return ResponseEntity.status(HttpStatus.OK).body(formVO); + } +} \ No newline at end of file diff --git a/admin/src/main/java/app/module/admin/usecase/household/tab/dailyRecord/updateDailyNone/adapters/web/modal/UpdateDailyNoneReqVO.java b/admin/src/main/java/app/module/admin/usecase/household/tab/dailyRecord/updateDailyNone/adapters/web/modal/UpdateDailyNoneReqVO.java new file mode 100644 index 00000000..2d66431c --- /dev/null +++ b/admin/src/main/java/app/module/admin/usecase/household/tab/dailyRecord/updateDailyNone/adapters/web/modal/UpdateDailyNoneReqVO.java @@ -0,0 +1,24 @@ +package app.module.admin.usecase.household.tab.dailyRecord.updateDailyNone.adapters.web.modal; + +import app.module.core.config.application.enums.DailySort; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@Getter +@Setter +@ToString +public class UpdateDailyNoneReqVO { + private String recordMonth; + private Integer groupNo; + private Long householdSeq; + + /** + * 현재 단계 + */ + private DailySort currentStep; + /** + * 금일 데이터 없음 여부 (Y/N) + */ + private String todayNone; +} diff --git a/admin/src/main/java/app/module/admin/usecase/household/tab/dailyRecord/updateDailyNone/ports/UpdateDailyNonePortIn.java b/admin/src/main/java/app/module/admin/usecase/household/tab/dailyRecord/updateDailyNone/ports/UpdateDailyNonePortIn.java new file mode 100644 index 00000000..9576ded4 --- /dev/null +++ b/admin/src/main/java/app/module/admin/usecase/household/tab/dailyRecord/updateDailyNone/ports/UpdateDailyNonePortIn.java @@ -0,0 +1,12 @@ +package app.module.admin.usecase.household.tab.dailyRecord.updateDailyNone.ports; + +import app.module.admin.usecase.household.tab.dailyRecord.updateDailyNone.adapters.web.modal.UpdateDailyNoneReqVO; + +public interface UpdateDailyNonePortIn { + /** + * 일계부 금일 데이터 없음 등록 + * + * @param formVO 입력 데이터 + */ + void create(UpdateDailyNoneReqVO formVO); +} diff --git a/admin/src/main/java/app/module/admin/usecase/household/tab/dailyRecord/updateDailyNone/ports/UpdateDailyNonePortOut.java b/admin/src/main/java/app/module/admin/usecase/household/tab/dailyRecord/updateDailyNone/ports/UpdateDailyNonePortOut.java new file mode 100644 index 00000000..79a21f7b --- /dev/null +++ b/admin/src/main/java/app/module/admin/usecase/household/tab/dailyRecord/updateDailyNone/ports/UpdateDailyNonePortOut.java @@ -0,0 +1,12 @@ +package app.module.admin.usecase.household.tab.dailyRecord.updateDailyNone.ports; + +import app.module.admin.usecase.household.tab.dailyRecord.updateDailyNone.ports.application.domain.UpdateDailyNoneCmd; + +public interface UpdateDailyNonePortOut { + /** + * 일계부 금일 데이터 없음 등록 + * + * @param command 입력 데이터 + */ + void create(UpdateDailyNoneCmd command); +} diff --git a/admin/src/main/java/app/module/admin/usecase/household/tab/dailyRecord/updateDailyNone/ports/application/UpdateDailyNoneService.java b/admin/src/main/java/app/module/admin/usecase/household/tab/dailyRecord/updateDailyNone/ports/application/UpdateDailyNoneService.java new file mode 100644 index 00000000..f8a953fa --- /dev/null +++ b/admin/src/main/java/app/module/admin/usecase/household/tab/dailyRecord/updateDailyNone/ports/application/UpdateDailyNoneService.java @@ -0,0 +1,33 @@ +package app.module.admin.usecase.household.tab.dailyRecord.updateDailyNone.ports.application; + +import app.module.admin.usecase.household.tab.dailyRecord.updateDailyNone.adapters.web.modal.UpdateDailyNoneReqVO; +import app.module.admin.usecase.household.tab.dailyRecord.updateDailyNone.ports.UpdateDailyNonePortIn; +import app.module.admin.usecase.household.tab.dailyRecord.updateDailyNone.ports.UpdateDailyNonePortOut; +import app.module.admin.usecase.household.tab.dailyRecord.updateDailyNone.ports.application.domain.UpdateDailyNoneCmd; +import app.module.core.config.application.enums.DailyTargetStatus; +import app.module.core.config.application.util.AuditUtil; +import lombok.RequiredArgsConstructor; +import org.springframework.stereotype.Service; + +@Service +@RequiredArgsConstructor +public class UpdateDailyNoneService implements UpdateDailyNonePortIn { + private final UpdateDailyNonePortOut portOut; + + @Override + public void create(UpdateDailyNoneReqVO formVO) { + DailyTargetStatus currentStatus = "Y".equals(formVO.getTodayNone()) ? DailyTargetStatus.TODAY_NONE : DailyTargetStatus.TARGET; + + UpdateDailyNoneCmd command = AuditUtil.update( + new UpdateDailyNoneCmd( + formVO.getRecordMonth(), + formVO.getGroupNo(), + formVO.getHouseholdSeq(), + formVO.getCurrentStep(), + currentStatus, + null) + ); + + portOut.create(command); + } +} diff --git a/admin/src/main/java/app/module/admin/usecase/household/tab/dailyRecord/updateDailyNone/ports/application/domain/UpdateDailyNoneCmd.java b/admin/src/main/java/app/module/admin/usecase/household/tab/dailyRecord/updateDailyNone/ports/application/domain/UpdateDailyNoneCmd.java new file mode 100644 index 00000000..2f509722 --- /dev/null +++ b/admin/src/main/java/app/module/admin/usecase/household/tab/dailyRecord/updateDailyNone/ports/application/domain/UpdateDailyNoneCmd.java @@ -0,0 +1,30 @@ +package app.module.admin.usecase.household.tab.dailyRecord.updateDailyNone.ports.application.domain; + +import app.module.core.config.adapters.persistence.component.AuditCommand; +import app.module.core.config.application.enums.DailySort; +import app.module.core.config.application.enums.DailyTargetStatus; +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.Setter; + +@Getter +@Setter +@AllArgsConstructor +public class UpdateDailyNoneCmd extends AuditCommand { + private String searchMonth; + private Integer groupNo; + private Long householdSeq; + + /** + * 현재 단계 + */ + private DailySort currentStep; + /** + * 현재 입력상태 + */ + private DailyTargetStatus currentStatus; + /** + * 일계부 항목 일련번호 + */ + private Long dailyRecordSeq; +} diff --git a/admin/src/main/resources/mappers/household/GetDailyRecordsStatusMapper.xml b/admin/src/main/resources/mappers/household/GetDailyRecordsStatusMapper.xml index 67e8b6a4..d5aa2325 100644 --- a/admin/src/main/resources/mappers/household/GetDailyRecordsStatusMapper.xml +++ b/admin/src/main/resources/mappers/household/GetDailyRecordsStatusMapper.xml @@ -34,6 +34,7 @@ ) SELECT dr.id AS id, + ddg.group_no AS day_group_no, /* 해당 월의 말일을 기준으로 종료일을 제한하여 일자 그룹 표시 */ ddg.start_day || CASE diff --git a/admin/src/main/resources/mappers/household/UpdateDailyNoneMapper.xml b/admin/src/main/resources/mappers/household/UpdateDailyNoneMapper.xml new file mode 100644 index 00000000..c6257320 --- /dev/null +++ b/admin/src/main/resources/mappers/household/UpdateDailyNoneMapper.xml @@ -0,0 +1,68 @@ + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/admin/src/main/resources/templates/households/tab/daily-record.html b/admin/src/main/resources/templates/households/tab/daily-record.html index ef1dfb18..faf8afe0 100644 --- a/admin/src/main/resources/templates/households/tab/daily-record.html +++ b/admin/src/main/resources/templates/households/tab/daily-record.html @@ -4,6 +4,10 @@
    + + + +
    @@ -11,23 +15,23 @@
    • 작성완료

      - 6건 + 0건
    • 미작성

      - 6건 + 0건
    • 미완료

      - 6건 + 0건
    • 대기

      - 6건 + 0건
    • 완료율

      - 56.12% + 0%
    @@ -53,8 +57,21 @@
    -
      @@ -145,7 +145,7 @@
    - 원 diff --git a/front/src/main/resources/templates/info/monthly/form.html b/front/src/main/resources/templates/info/monthly/form.html index 9fa49dfe..201d76f4 100644 --- a/front/src/main/resources/templates/info/monthly/form.html +++ b/front/src/main/resources/templates/info/monthly/form.html @@ -62,7 +62,7 @@
    @@ -96,7 +96,7 @@
      @@ -117,7 +117,7 @@
    @@ -176,7 +176,7 @@
    @@ -235,7 +235,7 @@
    @@ -294,7 +294,7 @@
    diff --git a/front/src/main/resources/templates/info/user/user.html b/front/src/main/resources/templates/info/user/user.html index f8ed1474..61f3b182 100644 --- a/front/src/main/resources/templates/info/user/user.html +++ b/front/src/main/resources/templates/info/user/user.html @@ -85,13 +85,13 @@
    -
    -
    @@ -113,13 +113,13 @@
    -
    -
    diff --git a/front/src/main/resources/templates/record/expense/form.html b/front/src/main/resources/templates/record/expense/form.html index a17be087..a357fb6b 100644 --- a/front/src/main/resources/templates/record/expense/form.html +++ b/front/src/main/resources/templates/record/expense/form.html @@ -79,7 +79,7 @@
    -
      @@ -134,7 +134,7 @@
      - 원
      @@ -151,7 +151,7 @@
      - 원
      diff --git a/front/src/main/resources/templates/record/farming/form.html b/front/src/main/resources/templates/record/farming/form.html index c14ba8ab..cddd721a 100644 --- a/front/src/main/resources/templates/record/farming/form.html +++ b/front/src/main/resources/templates/record/farming/form.html @@ -66,7 +66,7 @@
      -
        @@ -121,7 +121,7 @@
        - 원
        diff --git a/front/src/main/resources/templates/record/forestry/form.html b/front/src/main/resources/templates/record/forestry/form.html index 0596d1a4..132578f4 100644 --- a/front/src/main/resources/templates/record/forestry/form.html +++ b/front/src/main/resources/templates/record/forestry/form.html @@ -41,7 +41,7 @@
        -
          @@ -96,7 +96,7 @@
          - 원
          diff --git a/front/src/main/resources/templates/record/income/form.html b/front/src/main/resources/templates/record/income/form.html index a04258ff..2a0959f9 100644 --- a/front/src/main/resources/templates/record/income/form.html +++ b/front/src/main/resources/templates/record/income/form.html @@ -109,7 +109,7 @@
          -
            @@ -164,7 +164,7 @@
            - 원
            @@ -181,7 +181,7 @@
            - 원
            diff --git a/front/src/main/resources/templates/record/power/form.html b/front/src/main/resources/templates/record/power/form.html index 5adb16cd..c81c81ad 100644 --- a/front/src/main/resources/templates/record/power/form.html +++ b/front/src/main/resources/templates/record/power/form.html @@ -45,7 +45,7 @@
            - 시간
            @@ -58,7 +58,7 @@
            - 시간
            diff --git a/front/src/main/resources/templates/record/work/form.html b/front/src/main/resources/templates/record/work/form.html index d83cbc1e..2822b89f 100644 --- a/front/src/main/resources/templates/record/work/form.html +++ b/front/src/main/resources/templates/record/work/form.html @@ -51,7 +51,7 @@
            -
              @@ -108,7 +108,7 @@
              -
              @@ -173,7 +173,7 @@
              - 시간
              @@ -186,7 +186,7 @@
              - 시간
              @@ -201,7 +201,7 @@
              남 - 시간
              @@ -209,7 +209,7 @@
              여 - 시간
              @@ -226,7 +226,7 @@
              남 - 시간
              @@ -234,7 +234,7 @@
              여 - 시간
              @@ -251,7 +251,7 @@
              남 - 시간
              @@ -259,7 +259,7 @@
              여 - 시간
              @@ -276,7 +276,7 @@
              남 - 시간
              @@ -284,7 +284,7 @@
              여 - 시간
              From f1aad02b70abd9b0ce582a673a79cc4e5df582bb Mon Sep 17 00:00:00 2001 From: kangsunlee Date: Thu, 26 Jun 2025 14:24:12 +0900 Subject: [PATCH 09/19] =?UTF-8?q?[BO]=20=EC=9E=84=EC=82=B0=EB=AC=BC?= =?UTF-8?q?=ED=98=84=ED=99=A9=20=EB=93=B1=EB=A1=9D=20=EC=9E=91=EC=97=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../GetForestProductsStatusDao.java | 3 +- .../GetForestProductsStatusMapper.java | 3 +- .../domain/GetForestProductsStatusResult.java | 2 +- .../GetMonthlyForestProductsStatus.java | 15 ++++ .../persistence/SaveForestProductDao.java | 24 +++++ .../persistence/SaveForestProductMapper.java | 10 +++ .../web/SaveForestProductController.java | 61 +++++++++++++ .../web/model/SaveForestProductReqVO.java | 37 ++++++++ .../web/model/SaveForestProductResVO.java | 14 +++ .../validator/SaveForestProductValidator.java | 25 ++++++ .../ports/SaveForestProductPortIn.java | 7 ++ .../ports/SaveForestProductPortOut.java | 7 ++ .../application/SaveForestProductService.java | 18 ++++ .../domain/SaveForestProductCmd.java | 35 ++++++++ .../web/SaveHouseholdVisitInfoController.java | 2 +- .../GetForestProductsStatusMapper.xml | 5 +- .../household/SaveForestProductMapper.xml | 88 +++++++++++++++++++ .../modal/modal-forest-product.html | 58 +++++++++--- .../households/modal/modal-visit-info.html | 2 +- .../households/tab/forest-product.html | 7 +- .../resources/templates/households/{seq}.html | 3 - 21 files changed, 401 insertions(+), 25 deletions(-) create mode 100644 admin/src/main/java/app/module/admin/usecase/household/tab/forestProduct/getForestProductsStatus/ports/application/domain/GetMonthlyForestProductsStatus.java create mode 100644 admin/src/main/java/app/module/admin/usecase/household/tab/forestProduct/saveForestProduct/adapters/persistence/SaveForestProductDao.java create mode 100644 admin/src/main/java/app/module/admin/usecase/household/tab/forestProduct/saveForestProduct/adapters/persistence/SaveForestProductMapper.java create mode 100644 admin/src/main/java/app/module/admin/usecase/household/tab/forestProduct/saveForestProduct/adapters/web/SaveForestProductController.java create mode 100644 admin/src/main/java/app/module/admin/usecase/household/tab/forestProduct/saveForestProduct/adapters/web/model/SaveForestProductReqVO.java create mode 100644 admin/src/main/java/app/module/admin/usecase/household/tab/forestProduct/saveForestProduct/adapters/web/model/SaveForestProductResVO.java create mode 100644 admin/src/main/java/app/module/admin/usecase/household/tab/forestProduct/saveForestProduct/adapters/web/validator/SaveForestProductValidator.java create mode 100644 admin/src/main/java/app/module/admin/usecase/household/tab/forestProduct/saveForestProduct/ports/SaveForestProductPortIn.java create mode 100644 admin/src/main/java/app/module/admin/usecase/household/tab/forestProduct/saveForestProduct/ports/SaveForestProductPortOut.java create mode 100644 admin/src/main/java/app/module/admin/usecase/household/tab/forestProduct/saveForestProduct/ports/application/SaveForestProductService.java create mode 100644 admin/src/main/java/app/module/admin/usecase/household/tab/forestProduct/saveForestProduct/ports/application/domain/SaveForestProductCmd.java create mode 100644 admin/src/main/resources/mappers/household/SaveForestProductMapper.xml diff --git a/admin/src/main/java/app/module/admin/usecase/household/tab/forestProduct/getForestProductsStatus/adapters/persistence/GetForestProductsStatusDao.java b/admin/src/main/java/app/module/admin/usecase/household/tab/forestProduct/getForestProductsStatus/adapters/persistence/GetForestProductsStatusDao.java index 5f327c74..e3951a04 100644 --- a/admin/src/main/java/app/module/admin/usecase/household/tab/forestProduct/getForestProductsStatus/adapters/persistence/GetForestProductsStatusDao.java +++ b/admin/src/main/java/app/module/admin/usecase/household/tab/forestProduct/getForestProductsStatus/adapters/persistence/GetForestProductsStatusDao.java @@ -4,6 +4,7 @@ import app.module.admin.usecase.household.tab.forestProduct.getForestProductsSta import app.module.admin.usecase.household.tab.forestProduct.getForestProductsStatus.ports.application.domain.GetForestProductsStatus; import app.module.admin.usecase.household.tab.forestProduct.getForestProductsStatus.ports.application.domain.GetForestProductsStatusCmd; import app.module.admin.usecase.household.tab.forestProduct.getForestProductsStatus.ports.application.domain.GetForestProductsStatusResult; +import app.module.admin.usecase.household.tab.forestProduct.getForestProductsStatus.ports.application.domain.GetMonthlyForestProductsStatus; import java.util.List; import lombok.RequiredArgsConstructor; import org.springframework.stereotype.Repository; @@ -17,7 +18,7 @@ class GetForestProductsStatusDao implements GetForestProductsStatusPortOut { public GetForestProductsStatusResult operate(GetForestProductsStatusCmd cmd) { // 임산물 등록 상태 조회 - String monthlyStatus = mapper.getMonthlyStatus(cmd); + GetMonthlyForestProductsStatus monthlyStatus = mapper.getMonthlyStatus(cmd); // 임산물 목록 조회 List forestProducts = mapper.getForestProductsStatus(cmd); diff --git a/admin/src/main/java/app/module/admin/usecase/household/tab/forestProduct/getForestProductsStatus/adapters/persistence/GetForestProductsStatusMapper.java b/admin/src/main/java/app/module/admin/usecase/household/tab/forestProduct/getForestProductsStatus/adapters/persistence/GetForestProductsStatusMapper.java index 87fb4f25..aeec235d 100644 --- a/admin/src/main/java/app/module/admin/usecase/household/tab/forestProduct/getForestProductsStatus/adapters/persistence/GetForestProductsStatusMapper.java +++ b/admin/src/main/java/app/module/admin/usecase/household/tab/forestProduct/getForestProductsStatus/adapters/persistence/GetForestProductsStatusMapper.java @@ -2,11 +2,12 @@ package app.module.admin.usecase.household.tab.forestProduct.getForestProductsSt import app.module.admin.usecase.household.tab.forestProduct.getForestProductsStatus.ports.application.domain.GetForestProductsStatus; import app.module.admin.usecase.household.tab.forestProduct.getForestProductsStatus.ports.application.domain.GetForestProductsStatusCmd; +import app.module.admin.usecase.household.tab.forestProduct.getForestProductsStatus.ports.application.domain.GetMonthlyForestProductsStatus; import java.util.List; import org.apache.ibatis.annotations.Mapper; @Mapper public interface GetForestProductsStatusMapper { - String getMonthlyStatus(GetForestProductsStatusCmd cmd); + GetMonthlyForestProductsStatus getMonthlyStatus(GetForestProductsStatusCmd cmd); List getForestProductsStatus(GetForestProductsStatusCmd cmd); } diff --git a/admin/src/main/java/app/module/admin/usecase/household/tab/forestProduct/getForestProductsStatus/ports/application/domain/GetForestProductsStatusResult.java b/admin/src/main/java/app/module/admin/usecase/household/tab/forestProduct/getForestProductsStatus/ports/application/domain/GetForestProductsStatusResult.java index 873bc0ff..54c89130 100644 --- a/admin/src/main/java/app/module/admin/usecase/household/tab/forestProduct/getForestProductsStatus/ports/application/domain/GetForestProductsStatusResult.java +++ b/admin/src/main/java/app/module/admin/usecase/household/tab/forestProduct/getForestProductsStatus/ports/application/domain/GetForestProductsStatusResult.java @@ -11,6 +11,6 @@ import lombok.Setter; @AllArgsConstructor @EqualsAndHashCode public class GetForestProductsStatusResult { - private String monthlyStatus; + private GetMonthlyForestProductsStatus monthlyStatus; private List forestProducts; } diff --git a/admin/src/main/java/app/module/admin/usecase/household/tab/forestProduct/getForestProductsStatus/ports/application/domain/GetMonthlyForestProductsStatus.java b/admin/src/main/java/app/module/admin/usecase/household/tab/forestProduct/getForestProductsStatus/ports/application/domain/GetMonthlyForestProductsStatus.java new file mode 100644 index 00000000..1174e369 --- /dev/null +++ b/admin/src/main/java/app/module/admin/usecase/household/tab/forestProduct/getForestProductsStatus/ports/application/domain/GetMonthlyForestProductsStatus.java @@ -0,0 +1,15 @@ +package app.module.admin.usecase.household.tab.forestProduct.getForestProductsStatus.ports.application.domain; + +import lombok.AllArgsConstructor; +import lombok.EqualsAndHashCode; +import lombok.Getter; +import lombok.Setter; + +@Getter +@Setter +@AllArgsConstructor +@EqualsAndHashCode +public class GetMonthlyForestProductsStatus { + private Long id; + private String forestStatus; +} diff --git a/admin/src/main/java/app/module/admin/usecase/household/tab/forestProduct/saveForestProduct/adapters/persistence/SaveForestProductDao.java b/admin/src/main/java/app/module/admin/usecase/household/tab/forestProduct/saveForestProduct/adapters/persistence/SaveForestProductDao.java new file mode 100644 index 00000000..28b77e34 --- /dev/null +++ b/admin/src/main/java/app/module/admin/usecase/household/tab/forestProduct/saveForestProduct/adapters/persistence/SaveForestProductDao.java @@ -0,0 +1,24 @@ +package app.module.admin.usecase.household.tab.forestProduct.saveForestProduct.adapters.persistence; + +import app.module.admin.usecase.household.tab.forestProduct.saveForestProduct.ports.SaveForestProductPortOut; +import app.module.admin.usecase.household.tab.forestProduct.saveForestProduct.ports.application.domain.SaveForestProductCmd; +import app.module.core.config.application.util.AuditUtil; +import lombok.RequiredArgsConstructor; +import org.springframework.stereotype.Repository; +import org.springframework.transaction.annotation.Transactional; + +@Repository +@RequiredArgsConstructor +class SaveForestProductDao implements SaveForestProductPortOut { + private final SaveForestProductMapper mapper; + + @Override + @Transactional + public void operate(SaveForestProductCmd inCmd) { + if (inCmd.getForestProductId() == null) { + mapper.createForestProduct(AuditUtil.create(inCmd)); + } else { + mapper.updateForestProduct(AuditUtil.update(inCmd)); + } + } +} \ No newline at end of file diff --git a/admin/src/main/java/app/module/admin/usecase/household/tab/forestProduct/saveForestProduct/adapters/persistence/SaveForestProductMapper.java b/admin/src/main/java/app/module/admin/usecase/household/tab/forestProduct/saveForestProduct/adapters/persistence/SaveForestProductMapper.java new file mode 100644 index 00000000..95eb3adf --- /dev/null +++ b/admin/src/main/java/app/module/admin/usecase/household/tab/forestProduct/saveForestProduct/adapters/persistence/SaveForestProductMapper.java @@ -0,0 +1,10 @@ +package app.module.admin.usecase.household.tab.forestProduct.saveForestProduct.adapters.persistence; + +import app.module.admin.usecase.household.tab.forestProduct.saveForestProduct.ports.application.domain.SaveForestProductCmd; +import org.apache.ibatis.annotations.Mapper; + +@Mapper +public interface SaveForestProductMapper { + void createForestProduct(SaveForestProductCmd cmd); + void updateForestProduct(SaveForestProductCmd cmd); +} diff --git a/admin/src/main/java/app/module/admin/usecase/household/tab/forestProduct/saveForestProduct/adapters/web/SaveForestProductController.java b/admin/src/main/java/app/module/admin/usecase/household/tab/forestProduct/saveForestProduct/adapters/web/SaveForestProductController.java new file mode 100644 index 00000000..6076b034 --- /dev/null +++ b/admin/src/main/java/app/module/admin/usecase/household/tab/forestProduct/saveForestProduct/adapters/web/SaveForestProductController.java @@ -0,0 +1,61 @@ +package app.module.admin.usecase.household.tab.forestProduct.saveForestProduct.adapters.web; + +import app.module.admin.usecase.household.tab.forestProduct.saveForestProduct.ports.SaveForestProductPortIn; +import app.module.admin.usecase.household.tab.forestProduct.saveForestProduct.ports.application.domain.SaveForestProductCmd; +import app.module.core.config.application.util.MessageUtil; +import jakarta.validation.Valid; +import lombok.RequiredArgsConstructor; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RestController; +import org.springframework.validation.BindingResult; +import app.module.admin.usecase.household.tab.forestProduct.saveForestProduct.adapters.web.model.SaveForestProductReqVO; +import app.module.admin.usecase.household.tab.forestProduct.saveForestProduct.adapters.web.model.SaveForestProductResVO; +import app.module.admin.usecase.household.tab.forestProduct.saveForestProduct.adapters.web.validator.SaveForestProductValidator; + +@RestController +@RequiredArgsConstructor +class SaveForestProductController { + private final SaveForestProductValidator validator; + private final SaveForestProductPortIn portIn; + private final MessageUtil messageUtil; + + @PostMapping(path = "/api/forestProduct/save") + ResponseEntity operate(@Valid @RequestBody SaveForestProductReqVO reqVO, + BindingResult bindingResult) { + validator.validate(reqVO, bindingResult); + if (bindingResult.hasErrors()) { + return ResponseEntity.status(HttpStatus.UNPROCESSABLE_ENTITY) + .body(bindingResult.getFieldErrors()); + } + + portIn.operate(new SaveForestProductCmd( + reqVO.getForestProductId(), + reqVO.getHouseholdSeq(), + reqVO.getMonthlyInputStatusId(), + reqVO.getRecordMonth(), + reqVO.getStreetNum(), + reqVO.getLandType(), + reqVO.getTown(), + reqVO.getCropName(), + reqVO.getLandArea(), + reqVO.getAvailableArea(), + reqVO.getMainYield(), + reqVO.getMainYieldUnitCode(), + reqVO.getMainYieldUnit(), + reqVO.getMainSaleAmount(), + reqVO.getMainSaleUnitCode(), + reqVO.getMainSaleUnit(), + reqVO.getSubYield(), + reqVO.getSubYieldUnitCode(), + reqVO.getSubYieldUnit(), + reqVO.getSubSaleAmount(), + reqVO.getSubSaleUnitCode(), + reqVO.getSubSaleUnit())); + + return ResponseEntity.status(HttpStatus.OK).body( + new SaveForestProductResVO(messageUtil.getMessage("operation.common.save.done"))); + } +} \ No newline at end of file diff --git a/admin/src/main/java/app/module/admin/usecase/household/tab/forestProduct/saveForestProduct/adapters/web/model/SaveForestProductReqVO.java b/admin/src/main/java/app/module/admin/usecase/household/tab/forestProduct/saveForestProduct/adapters/web/model/SaveForestProductReqVO.java new file mode 100644 index 00000000..673d718e --- /dev/null +++ b/admin/src/main/java/app/module/admin/usecase/household/tab/forestProduct/saveForestProduct/adapters/web/model/SaveForestProductReqVO.java @@ -0,0 +1,37 @@ +package app.module.admin.usecase.household.tab.forestProduct.saveForestProduct.adapters.web.model; + +import jakarta.validation.constraints.NotBlank; +import lombok.AllArgsConstructor; +import lombok.EqualsAndHashCode; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; + +@Getter +@Setter +@NoArgsConstructor +@EqualsAndHashCode +public class SaveForestProductReqVO { + private Long forestProductId; + private Long householdSeq; + private Long monthlyInputStatusId; + private String recordMonth; + private String streetNum; + private String landType; + private String town; + private String cropName; + private String landArea; + private String availableArea; + private String mainYield; + private String mainYieldUnitCode; + private String mainYieldUnit; + private String mainSaleAmount; + private String mainSaleUnitCode; + private String mainSaleUnit; + private String subYield; + private String subYieldUnitCode; + private String subYieldUnit; + private String subSaleAmount; + private String subSaleUnitCode; + private String subSaleUnit; +} diff --git a/admin/src/main/java/app/module/admin/usecase/household/tab/forestProduct/saveForestProduct/adapters/web/model/SaveForestProductResVO.java b/admin/src/main/java/app/module/admin/usecase/household/tab/forestProduct/saveForestProduct/adapters/web/model/SaveForestProductResVO.java new file mode 100644 index 00000000..decd5dc5 --- /dev/null +++ b/admin/src/main/java/app/module/admin/usecase/household/tab/forestProduct/saveForestProduct/adapters/web/model/SaveForestProductResVO.java @@ -0,0 +1,14 @@ +package app.module.admin.usecase.household.tab.forestProduct.saveForestProduct.adapters.web.model; + +import lombok.AllArgsConstructor; +import lombok.EqualsAndHashCode; +import lombok.Getter; +import lombok.Setter; + +@Getter +@Setter +@AllArgsConstructor +@EqualsAndHashCode +public class SaveForestProductResVO { + private String message; +} diff --git a/admin/src/main/java/app/module/admin/usecase/household/tab/forestProduct/saveForestProduct/adapters/web/validator/SaveForestProductValidator.java b/admin/src/main/java/app/module/admin/usecase/household/tab/forestProduct/saveForestProduct/adapters/web/validator/SaveForestProductValidator.java new file mode 100644 index 00000000..fb55563a --- /dev/null +++ b/admin/src/main/java/app/module/admin/usecase/household/tab/forestProduct/saveForestProduct/adapters/web/validator/SaveForestProductValidator.java @@ -0,0 +1,25 @@ +package app.module.admin.usecase.household.tab.forestProduct.saveForestProduct.adapters.web.validator; + +import app.module.admin.usecase.household.tab.forestProduct.saveForestProduct.adapters.web.model.SaveForestProductReqVO; +import org.springframework.stereotype.Component; +import org.springframework.util.StringUtils; +import org.springframework.validation.Errors; +import org.springframework.validation.Validator; + +@Component +public class SaveForestProductValidator implements Validator { + + @Override + public boolean supports(Class clazz) { + return SaveForestProductReqVO.class.equals(clazz); + } + + @Override + public void validate(Object target, Errors errors) { + SaveForestProductReqVO vo = (SaveForestProductReqVO) target; + + if (!StringUtils.hasText(vo.getCropName())) { + errors.rejectValue("cropName", "error.cropName", "재배 작물명을 입력해주세요."); + } + } +} \ No newline at end of file diff --git a/admin/src/main/java/app/module/admin/usecase/household/tab/forestProduct/saveForestProduct/ports/SaveForestProductPortIn.java b/admin/src/main/java/app/module/admin/usecase/household/tab/forestProduct/saveForestProduct/ports/SaveForestProductPortIn.java new file mode 100644 index 00000000..8bbe77ed --- /dev/null +++ b/admin/src/main/java/app/module/admin/usecase/household/tab/forestProduct/saveForestProduct/ports/SaveForestProductPortIn.java @@ -0,0 +1,7 @@ +package app.module.admin.usecase.household.tab.forestProduct.saveForestProduct.ports; + +import app.module.admin.usecase.household.tab.forestProduct.saveForestProduct.ports.application.domain.SaveForestProductCmd; + +public interface SaveForestProductPortIn { + void operate(SaveForestProductCmd inCmd); +} \ No newline at end of file diff --git a/admin/src/main/java/app/module/admin/usecase/household/tab/forestProduct/saveForestProduct/ports/SaveForestProductPortOut.java b/admin/src/main/java/app/module/admin/usecase/household/tab/forestProduct/saveForestProduct/ports/SaveForestProductPortOut.java new file mode 100644 index 00000000..220db4aa --- /dev/null +++ b/admin/src/main/java/app/module/admin/usecase/household/tab/forestProduct/saveForestProduct/ports/SaveForestProductPortOut.java @@ -0,0 +1,7 @@ +package app.module.admin.usecase.household.tab.forestProduct.saveForestProduct.ports; + +import app.module.admin.usecase.household.tab.forestProduct.saveForestProduct.ports.application.domain.SaveForestProductCmd; + +public interface SaveForestProductPortOut { + void operate(SaveForestProductCmd inCmd); +} \ No newline at end of file diff --git a/admin/src/main/java/app/module/admin/usecase/household/tab/forestProduct/saveForestProduct/ports/application/SaveForestProductService.java b/admin/src/main/java/app/module/admin/usecase/household/tab/forestProduct/saveForestProduct/ports/application/SaveForestProductService.java new file mode 100644 index 00000000..0d9c4d41 --- /dev/null +++ b/admin/src/main/java/app/module/admin/usecase/household/tab/forestProduct/saveForestProduct/ports/application/SaveForestProductService.java @@ -0,0 +1,18 @@ +package app.module.admin.usecase.household.tab.forestProduct.saveForestProduct.ports.application; + +import app.module.admin.usecase.household.tab.forestProduct.saveForestProduct.ports.SaveForestProductPortIn; +import app.module.admin.usecase.household.tab.forestProduct.saveForestProduct.ports.SaveForestProductPortOut; +import app.module.admin.usecase.household.tab.forestProduct.saveForestProduct.ports.application.domain.SaveForestProductCmd; +import lombok.RequiredArgsConstructor; +import org.springframework.stereotype.Service; + +@Service +@RequiredArgsConstructor +class SaveForestProductService implements SaveForestProductPortIn { + private final SaveForestProductPortOut portOut; + + @Override + public void operate(SaveForestProductCmd cmd) { + portOut.operate(cmd); + } +} \ No newline at end of file diff --git a/admin/src/main/java/app/module/admin/usecase/household/tab/forestProduct/saveForestProduct/ports/application/domain/SaveForestProductCmd.java b/admin/src/main/java/app/module/admin/usecase/household/tab/forestProduct/saveForestProduct/ports/application/domain/SaveForestProductCmd.java new file mode 100644 index 00000000..208ada31 --- /dev/null +++ b/admin/src/main/java/app/module/admin/usecase/household/tab/forestProduct/saveForestProduct/ports/application/domain/SaveForestProductCmd.java @@ -0,0 +1,35 @@ +package app.module.admin.usecase.household.tab.forestProduct.saveForestProduct.ports.application.domain; + +import app.module.core.config.adapters.persistence.component.AuditCommand; +import lombok.AllArgsConstructor; +import lombok.EqualsAndHashCode; +import lombok.Getter; +import lombok.Setter; + +@Getter +@Setter +@AllArgsConstructor +public class SaveForestProductCmd extends AuditCommand { + private Long forestProductId; + private Long householdSeq; + private Long monthlyInputStatusId; + private String recordMonth; + private String streetNum; + private String landType; + private String town; + private String cropName; + private String landArea; + private String availableArea; + private String mainYield; + private String mainYieldUnitCode; + private String mainYieldUnit; + private String mainSaleAmount; + private String mainSaleUnitCode; + private String mainSaleUnit; + private String subYield; + private String subYieldUnitCode; + private String subYieldUnit; + private String subSaleAmount; + private String subSaleUnitCode; + private String subSaleUnit; +} diff --git a/admin/src/main/java/app/module/admin/usecase/household/tab/householdVisit/saveHouseholdVisitInfo/adapters/web/SaveHouseholdVisitInfoController.java b/admin/src/main/java/app/module/admin/usecase/household/tab/householdVisit/saveHouseholdVisitInfo/adapters/web/SaveHouseholdVisitInfoController.java index c3284314..e46cefe4 100644 --- a/admin/src/main/java/app/module/admin/usecase/household/tab/householdVisit/saveHouseholdVisitInfo/adapters/web/SaveHouseholdVisitInfoController.java +++ b/admin/src/main/java/app/module/admin/usecase/household/tab/householdVisit/saveHouseholdVisitInfo/adapters/web/SaveHouseholdVisitInfoController.java @@ -30,7 +30,7 @@ class SaveHouseholdVisitInfoController { if (bindingResult.hasErrors()) { return ResponseEntity.status(HttpStatus.UNPROCESSABLE_ENTITY) - .body(bindingResult.getAllErrors().get(0).getDefaultMessage()); + .body(bindingResult.getFieldErrors()); } portIn.operate(new SaveHouseholdVisitInfoCmd( diff --git a/admin/src/main/resources/mappers/household/GetForestProductsStatusMapper.xml b/admin/src/main/resources/mappers/household/GetForestProductsStatusMapper.xml index 98d5c62b..6af17c80 100644 --- a/admin/src/main/resources/mappers/household/GetForestProductsStatusMapper.xml +++ b/admin/src/main/resources/mappers/household/GetForestProductsStatusMapper.xml @@ -4,9 +4,10 @@ - /* getMonthlyStatus : 임산물 현황 등록 상태 조회 */ - SELECT forest_product_status + SELECT id, + forest_product_status FROM monthly_input_status mis WHERE household_seq = #{householdSeq} AND month = #{recordMonth} diff --git a/admin/src/main/resources/mappers/household/SaveForestProductMapper.xml b/admin/src/main/resources/mappers/household/SaveForestProductMapper.xml new file mode 100644 index 00000000..477198a2 --- /dev/null +++ b/admin/src/main/resources/mappers/household/SaveForestProductMapper.xml @@ -0,0 +1,88 @@ + + + + + /* createForestProduct : 임산물 현황 등록 */ + INSERT INTO forest_product + ( + household_seq, + month, + street_num, + land_type, + town, + crop_name, + land_area, + available_area, + main_yield, + main_yield_unit_code, + main_yield_unit, + main_sale_amount, + main_sale_unit_code, + main_sale_unit, + sub_yield, + sub_yield_unit_code, + sub_yield_unit, + sub_sale_amount, + sub_sale_unit_code, + sub_sale_unit, + monthly_input_status_id, + + ) + VALUES + ( + #{householdSeq}, + #{recordMonth}, + #{streetNum}, + #{landType}, + #{town}, + #{cropName}, + #{landArea}, + #{availableArea}, + #{mainYield}, + #{mainYieldUnitCode}, + #{mainYieldUnit}, + #{mainSaleAmount}, + #{mainSaleUnitCode}, + #{mainSaleUnit}, + #{subYield}, + #{subYieldUnitCode}, + #{subYieldUnit}, + #{subSaleAmount}, + #{subSaleUnitCode}, + #{subSaleUnit}, + #{monthlyInputStatusId}, + + ) + + + + /* updateForestProduct : 임산물 현황 수정 */ + UPDATE forest_product + SET + household_seq = #{householdSeq}, + street_num = #{streetNum}, + land_type = #{landType}, + town = #{town}, + available_area = #{availableArea}, + crop_name = #{cropName}, + land_area = #{landArea}, + month = #{recordMonth}, + main_yield = #{mainYield}, + main_yield_unit_code = #{mainYieldUnitCode}, + main_yield_unit = #{mainYieldUnit}, + main_sale_amount = #{mainSaleAmount}, + main_sale_unit_code = #{mainSaleUnitCode}, + main_sale_unit = #{mainSaleUnit}, + sub_yield = #{subYield}, + sub_yield_unit_code = #{subYieldUnitCode}, + sub_yield_unit = #{subYieldUnit}, + sub_sale_amount = #{subSaleAmount}, + sub_sale_unit_code = #{subSaleUnitCode}, + sub_sale_unit = #{subSaleUnit}, + monthly_input_status_id = #{monthlyInputStatusId}, + + WHERE id = #{forestProductId} + + \ No newline at end of file diff --git a/admin/src/main/resources/templates/households/modal/modal-forest-product.html b/admin/src/main/resources/templates/households/modal/modal-forest-product.html index 70447288..6393ddb7 100644 --- a/admin/src/main/resources/templates/households/modal/modal-forest-product.html +++ b/admin/src/main/resources/templates/households/modal/modal-forest-product.html @@ -8,6 +8,7 @@ +
            diff --git a/front/src/main/resources/templates/record/expense/index.html b/front/src/main/resources/templates/record/expense/index.html index f7f43d49..a339c6d6 100644 --- a/front/src/main/resources/templates/record/expense/index.html +++ b/front/src/main/resources/templates/record/expense/index.html @@ -76,7 +76,7 @@
          • 수량

            - 500g + 500g
          • 현금

            diff --git a/front/src/main/resources/templates/record/farming/index.html b/front/src/main/resources/templates/record/farming/index.html index 3fc11289..3e272f2e 100644 --- a/front/src/main/resources/templates/record/farming/index.html +++ b/front/src/main/resources/templates/record/farming/index.html @@ -86,7 +86,7 @@
          • 수량

            - 500g + 500g
          • 현물평가액

            diff --git a/front/src/main/resources/templates/record/forestry/index.html b/front/src/main/resources/templates/record/forestry/index.html index bcbfca63..494b0b5d 100644 --- a/front/src/main/resources/templates/record/forestry/index.html +++ b/front/src/main/resources/templates/record/forestry/index.html @@ -78,7 +78,7 @@
          • 수량

            - 500g + 500g
          • 현물평가액

            diff --git a/front/src/main/resources/templates/record/income/index.html b/front/src/main/resources/templates/record/income/index.html index 6eb848bd..b1b76628 100644 --- a/front/src/main/resources/templates/record/income/index.html +++ b/front/src/main/resources/templates/record/income/index.html @@ -96,7 +96,7 @@
          • 수량

            - 500g + 500g
          • 현금

            diff --git a/front/src/main/resources/templates/record/power/index.html b/front/src/main/resources/templates/record/power/index.html index ad89449b..102e80c8 100644 --- a/front/src/main/resources/templates/record/power/index.html +++ b/front/src/main/resources/templates/record/power/index.html @@ -68,11 +68,11 @@
            • 자가 사용시간

              - 0시간 + 0시간
            • 임차 사용시간

              - 0시간 + 0시간
            diff --git a/front/src/main/resources/templates/record/work/index.html b/front/src/main/resources/templates/record/work/index.html index 5ac0e88b..b821d725 100644 --- a/front/src/main/resources/templates/record/work/index.html +++ b/front/src/main/resources/templates/record/work/index.html @@ -80,51 +80,51 @@
          • 작업 면적

            - +
          • 수확량

            - +
          • 경영주 노동투입시간

            - +
          • 배우자 노동투입시간

            - +
          • 가족노동(남)

            - +
          • 가족노동(여)

            - +
          • 고용노동(남)

            - +
          • 고용노동(여)

            - +
          • 품앗이(남)

            - +
          • 품앗이(여)

            - +
          • 일손돕기(남)

            - +
          • 일손돕기(여)

            - +
          From e90505d1901f8d4c13706ba45d1aa212b751e7ff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=A3=BC=EC=9A=B0=EC=84=B1?= Date: Thu, 26 Jun 2025 15:22:37 +0900 Subject: [PATCH 11/19] =?UTF-8?q?Excel=EB=8B=A4=EC=9A=B4=EB=A1=9C=EB=93=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../application/util/ExcelWriterUtil.java | 134 ++++++++++++++++++ .../application/util/model/ExcelSheetDto.java | 45 ++++++ .../web/GetExcelMultiSheetController.java | 124 ++++++++++++++++ 3 files changed, 303 insertions(+) create mode 100644 admin/src/main/java/app/module/admin/config/application/util/ExcelWriterUtil.java create mode 100644 admin/src/main/java/app/module/admin/config/application/util/model/ExcelSheetDto.java create mode 100644 admin/src/main/java/app/module/admin/usecase/excel/getExcelMultilSheet/adapters/web/GetExcelMultiSheetController.java diff --git a/admin/src/main/java/app/module/admin/config/application/util/ExcelWriterUtil.java b/admin/src/main/java/app/module/admin/config/application/util/ExcelWriterUtil.java new file mode 100644 index 00000000..032070d4 --- /dev/null +++ b/admin/src/main/java/app/module/admin/config/application/util/ExcelWriterUtil.java @@ -0,0 +1,134 @@ +package app.module.admin.config.application.util; + +import app.module.admin.config.application.util.model.ExcelSheetDto; +import org.apache.poi.ss.usermodel.*; +import org.apache.poi.xssf.usermodel.XSSFWorkbook; +import org.springframework.stereotype.Component; + +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.util.List; + + +@Component +public class ExcelWriterUtil { + public static byte[] writeExcel(List sheets) { + try (Workbook workbook = new XSSFWorkbook()) { + CellStyle bodyStyle = createBodyStyle(workbook); + CellStyle commaStyle = createCommaStyle(workbook); + + for (ExcelSheetDto sheetDto : sheets) { + Sheet sheet = workbook.createSheet(sheetDto.getSheetName()); + List headers = sheetDto.getHeaders(); + List> dataRows = sheetDto.getData(); + + // 헤더 작성 + Row headerRow = sheet.createRow(0); + for (int col = 0; col < headers.size(); col++) { + String headerText = headers.get(col); + + IndexedColors bgColor = sheetDto.getHeaderBgColors() != null + ? sheetDto.getHeaderBgColors().getOrDefault(col, IndexedColors.GREY_25_PERCENT) + : IndexedColors.GREY_25_PERCENT; + + CellStyle headerStyle = createHeaderStyle(workbook, bgColor); + + Cell cell = headerRow.createCell(col); + cell.setCellValue(headerText); + cell.setCellStyle(headerStyle); + } + + // 데이터 작성 + for (int r = 0; r < dataRows.size(); r++) { + Row row = sheet.createRow(r + 1); + List rowData = dataRows.get(r); + for (int c = 0; c < rowData.size(); c++) { + Cell cell = row.createCell(c); + String value = rowData.get(c); + if (sheetDto.getCommaColumns() != null && + sheetDto.getCommaColumns().contains(c) && + isNumeric(value)) { + cell.setCellValue(Double.parseDouble(value)); + cell.setCellStyle(commaStyle); + } else { + cell.setCellValue(value); + cell.setCellStyle(bodyStyle); + } + } + } + + // 컬럼 너비 수동 계산 + for (int col = 0; col < headers.size(); col++) { + int maxLength = getByteLength(headers.get(col)); + for (List rowData : dataRows) { + if (col < rowData.size()) { + int length = getByteLength(rowData.get(col)); + if (length > maxLength) { + maxLength = length; + } + } + } + sheet.setColumnWidth(col, (maxLength + 2) * 256); + } + } + + ByteArrayOutputStream out = new ByteArrayOutputStream(); + workbook.write(out); + return out.toByteArray(); + + } catch (IOException e) { + throw new RuntimeException("엑셀 생성 실패", e); + } + } + + private static boolean isNumeric(String value) { + if (value == null) return false; + try { + Double.parseDouble(value); + return true; + } catch (NumberFormatException e) { + return false; + } + } + + private static int getByteLength(String value) { + return value == null ? 0 : value.getBytes().length; + } + + private static CellStyle createHeaderStyle(Workbook workbook, IndexedColors bgColor) { + CellStyle style = workbook.createCellStyle(); + Font font = workbook.createFont(); + font.setBold(true); + style.setFont(font); + style.setAlignment(HorizontalAlignment.CENTER); + style.setVerticalAlignment(VerticalAlignment.CENTER); + style.setFillForegroundColor(bgColor.getIndex()); + style.setFillPattern(FillPatternType.SOLID_FOREGROUND); + setBorder(style); + return style; + } + + private static CellStyle createBodyStyle(Workbook workbook) { + CellStyle style = workbook.createCellStyle(); + style.setAlignment(HorizontalAlignment.LEFT); + style.setVerticalAlignment(VerticalAlignment.CENTER); + setBorder(style); + return style; + } + + private static CellStyle createCommaStyle(Workbook workbook) { + CellStyle style = workbook.createCellStyle(); + style.setAlignment(HorizontalAlignment.RIGHT); + style.setVerticalAlignment(VerticalAlignment.CENTER); + style.setDataFormat(workbook.createDataFormat().getFormat("#,##0")); + setBorder(style); + return style; + } + + private static void setBorder(CellStyle style) { + style.setBorderTop(BorderStyle.THIN); + style.setBorderBottom(BorderStyle.THIN); + style.setBorderLeft(BorderStyle.THIN); + style.setBorderRight(BorderStyle.THIN); + } +} diff --git a/admin/src/main/java/app/module/admin/config/application/util/model/ExcelSheetDto.java b/admin/src/main/java/app/module/admin/config/application/util/model/ExcelSheetDto.java new file mode 100644 index 00000000..176d6ba7 --- /dev/null +++ b/admin/src/main/java/app/module/admin/config/application/util/model/ExcelSheetDto.java @@ -0,0 +1,45 @@ +package app.module.admin.config.application.util.model; + +import org.apache.poi.ss.usermodel.IndexedColors; +import java.util.List; +import java.util.Set; + +import java.util.Map; + +public class ExcelSheetDto { + /** + * 시트명 + */ + private String sheetName; + /** + * 테이블 해더 리스트 + */ + private List headers; + /** + * 데이터 리스트 (해더와 같아야 한다. 값이 없다면 null이라도 넣어줘야해요.) + */ + private List> data; + /** + * 입력한 데이터 중 comma가 필요한 라인 선택 0 부터 + */ + private Set commaColumns; + /** + * 해더의 배경색 지정 : 0부터 시작 + */ + private Map headerBgColors; // 💡 추가: 컬럼별 배경색 + + public ExcelSheetDto(String sheetName, List headers, List> data, + Set commaColumns, Map headerBgColors) { + this.sheetName = sheetName; + this.headers = headers; + this.data = data; + this.commaColumns = commaColumns; + this.headerBgColors = headerBgColors; + } + + public String getSheetName() { return sheetName; } + public List getHeaders() { return headers; } + public List> getData() { return data; } + public Set getCommaColumns() { return commaColumns; } + public Map getHeaderBgColors() { return headerBgColors; } +} diff --git a/admin/src/main/java/app/module/admin/usecase/excel/getExcelMultilSheet/adapters/web/GetExcelMultiSheetController.java b/admin/src/main/java/app/module/admin/usecase/excel/getExcelMultilSheet/adapters/web/GetExcelMultiSheetController.java new file mode 100644 index 00000000..9f909e84 --- /dev/null +++ b/admin/src/main/java/app/module/admin/usecase/excel/getExcelMultilSheet/adapters/web/GetExcelMultiSheetController.java @@ -0,0 +1,124 @@ +package app.module.admin.usecase.excel.getExcelMultilSheet.adapters.web; + +import app.module.admin.config.application.util.model.ExcelSheetDto; +import lombok.RequiredArgsConstructor; +import org.springframework.http.HttpHeaders; +import org.springframework.http.HttpStatus; +import org.springframework.http.MediaType; +import org.springframework.http.ResponseEntity; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RestController; + +import app.module.admin.config.application.util.ExcelWriterUtil; +import java.util.List; +import java.util.Set; +import org.apache.poi.ss.usermodel.IndexedColors; +import java.util.Map; +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.time.LocalDate; +import java.time.format.DateTimeFormatter; + +@RestController +@RequiredArgsConstructor +class GetExcelMultiSheetController { + + @GetMapping("/api/admin/excel/multisheet") + public ResponseEntity exportHouseholdExcel() { + + // 시트 1: 조사 대상 목록 (타이틀 10개) + ExcelSheetDto sheet1 = new ExcelSheetDto( + "조사 대상", + List.of("ID", "이름", "성별", "나이", "주소", "전화번호", "이메일", "등록일", "상태", "비고"), + List.of( + List.of("1", "홍길동", "남", "30", "서울", "010-1234-5678", "hong@example.com", "2024-01-01", "완료", ""), + List.of("2", "김영희", "여", "28", "부산", "010-2222-3333", "kim@example.com", "2024-01-02", "미완료", "응답 거부") + ), + Set.of(3), // 나이 컬럼에 콤마 포맷 적용 (예시용) + Map.of( + 0, IndexedColors.LIGHT_CORNFLOWER_BLUE, + 3, IndexedColors.LIGHT_YELLOW, + 7, IndexedColors.LIGHT_ORANGE + ) + ); + + /* + + 취득 데이터는 변환해서 넣어줘도 됩니다. + List rawList = ... // List를 캐스팅 or 변환 + List> excelData = rawList.stream() + .map(dto -> List.of( + String.valueOf(dto.getId()), + dto.getName(), + dto.getGender(), + String.valueOf(dto.getAge()), + dto.getAddress(), + dto.getPhone(), + dto.getEmail(), + dto.getRegDate().toString(), + dto.getStatus(), + dto.getNote() + )) + .toList(); + + + ExcelSheetDto sheet = new ExcelSheetDto( + "조사 대상", + List.of("ID", "이름", "성별", "나이", "주소", "전화번호", "이메일", "등록일", "상태", "비고"), + excelData, // <----------------------------------@@@@@@@@@@@@@@@@ + Set.of(3), + Map.of( + 0, IndexedColors.LIGHT_CORNFLOWER_BLUE, + 3, IndexedColors.LIGHT_YELLOW, + 7, IndexedColors.LIGHT_ORANGE + ) + ); + */ + + // 시트 2: 응답 통계 (타이틀 7개) + ExcelSheetDto sheet2 = new ExcelSheetDto( + "응답 통계", + List.of("구분", "총건수", "응답수", "미응답", "응답률", "평균시간", "비고"), + List.of( + List.of("전체", "1000", "850", "150", "85%", "5분", ""), + List.of("서울", "400", "360", "40", "90%", "4분", "") + ), + Set.of(1, 2, 3), // 숫자열에 콤마 포맷 적용 + Map.of( + 1, IndexedColors.LIGHT_GREEN, + 2, IndexedColors.LIGHT_GREEN, + 3, IndexedColors.LIGHT_YELLOW + ) + ); + + // 시트 3: 조사자별 실적 (타이틀 5개) + ExcelSheetDto sheet3 = new ExcelSheetDto( + "조사자 실적", + List.of("조사자명", "조사건수", "완료건수", "진행률", "비고"), + List.of( + List.of("박조사", "200", "180", "90%", ""), + List.of("이조사", "150", "100", "66.6%", "") + ), + Set.of(1, 2), // 조사건수, 완료건수에 콤마 포맷 + Map.of( + 0, IndexedColors.LIGHT_TURQUOISE, + 1, IndexedColors.LIGHT_ORANGE, + 2, IndexedColors.LIGHT_ORANGE + ) + ); + + // 시트 모음 + List sheets = List.of(sheet1, sheet2, sheet3); + + byte[] excel = ExcelWriterUtil.writeExcel(sheets); + + + String rawFileName = "조사결과_" + LocalDate.now().format(DateTimeFormatter.ofPattern("yyyyMMdd")) + ".xlsx"; + String encodedFileName = URLEncoder.encode(rawFileName, StandardCharsets.UTF_8).replaceAll("\\+", "%20"); + + return ResponseEntity.ok() + .contentType(MediaType.APPLICATION_OCTET_STREAM) + .header(HttpHeaders.CONTENT_DISPOSITION, "attachment; filename*=UTF-8''" + encodedFileName) + .body(excel); + } +} \ No newline at end of file From dea45f467f87edaabdd70989a1b7a78132616823 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EA=B9=80=ED=98=84=EC=A3=BC?= Date: Thu, 26 Jun 2025 15:53:30 +0900 Subject: [PATCH 12/19] =?UTF-8?q?[FO]=20kri.form.maxlength=20=EB=B0=A9?= =?UTF-8?q?=EC=8B=9D=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/resources/static/ui/commonUtil.js | 17 ++++++++----- .../templates/info/bank/inputForm.html | 4 ++-- .../templates/info/bank/outputForm.html | 4 ++-- .../templates/info/monthly/form.html | 12 +++++----- .../resources/templates/info/user/user.html | 8 +++---- .../templates/record/expense/form.html | 6 ++--- .../templates/record/farming/form.html | 4 ++-- .../templates/record/forestry/form.html | 4 ++-- .../templates/record/income/form.html | 10 ++++---- .../templates/record/power/form.html | 4 ++-- .../resources/templates/record/work/form.html | 24 +++++++++---------- 11 files changed, 51 insertions(+), 46 deletions(-) diff --git a/front/src/main/resources/static/ui/commonUtil.js b/front/src/main/resources/static/ui/commonUtil.js index 7e60c2b7..6506dcfe 100644 --- a/front/src/main/resources/static/ui/commonUtil.js +++ b/front/src/main/resources/static/ui/commonUtil.js @@ -246,10 +246,15 @@ kri.form.error = function(errorList){ } } -kri.form.maxlength = function(object){ - if (object.value.length > object.maxLength) { - object.value = object.value.slice(0, object.maxLength); - } -} - +$(function() { + $('body').on('input', 'input[type="number"]', function() { + let $el = $(this); + if ($el.val().length > $el.attr('maxlength')) { + $el.val($el.val().slice(0, $el.attr('maxlength'))); + } + if ($el.attr('inputmode') === 'numeric') { + $el.val($el.val().replace('.', '')); + } + }) +}) \ No newline at end of file diff --git a/front/src/main/resources/templates/info/bank/inputForm.html b/front/src/main/resources/templates/info/bank/inputForm.html index 525cde1a..ae59b020 100644 --- a/front/src/main/resources/templates/info/bank/inputForm.html +++ b/front/src/main/resources/templates/info/bank/inputForm.html @@ -121,7 +121,7 @@
          + inputmode="decimal" pattern="[0-9]*" maxlength="10" >
          • 예 : 2, 2.5
          • @@ -182,7 +182,7 @@
            + maxlength="10" inputmode="numeric" pattern="[0-9]*" > 원
@@ -510,7 +510,7 @@ - + @@ -817,7 +817,39 @@ const currentListId = $(el).data('listId'); console.log('removeDaily', currentStep, currentListId); - alert('TODO : 삭제') + if ($('#'+currentListId).find('input[type="checkbox"]:checked').length === 0) { + alert('삭제내용은 최소 1건은 선택해야 합니다.'); + return; + } else if ($('#'+currentListId).find('input[type="checkbox"]').length === $('#'+currentListId).find('input[type="checkbox"]:checked').length) { + alert('등록내용은 최소 1건이 남아 있어야 합니다.'); + return; + } + + const selectedValues = []; + $('#'+currentListId).find('input[type="checkbox"]:checked').each((idx, item) => { + selectedValues.push($(item).val()); + }); + + const obj = {}; + obj.selectedIds = selectedValues; + obj.currentStep = currentStep; + console.log(obj) + + etUI.dialog.confirm({ + title: '삭제 안내', + message: '선택하신 항목을 삭제하시겠습니까?
삭제한 항목은 복구할 수 없습니다.', + positiveCallback: function () { + ajaxUtil._ajaxAsyncNoWaiting( + '/api/household/daily/remove', + obj, + function () { + alert('데이터 삭제가 완료되었습니다.'); + + getDailyRecordsView(f.dailyId.value, f.groupNo.value, f.dayGroupText.value); + }, + ); + }, + }); } diff --git a/front/src/main/resources/templates/common/components.html b/front/src/main/resources/templates/common/components.html index 63072c51..3198b6d7 100644 --- a/front/src/main/resources/templates/common/components.html +++ b/front/src/main/resources/templates/common/components.html @@ -34,7 +34,7 @@ - + From d923c3352f667001a615a58b8af7fd919e323110 Mon Sep 17 00:00:00 2001 From: kangsunlee Date: Thu, 26 Jun 2025 19:02:09 +0900 Subject: [PATCH 19/19] =?UTF-8?q?[BO]=20=EC=9E=84=EA=B0=80=ED=98=84?= =?UTF-8?q?=ED=99=A9=20-=20=EC=9E=84=EC=82=B0=EB=AC=BC=ED=98=84=ED=99=A9?= =?UTF-8?q?=20=EC=9E=91=EC=97=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../enums/MonthlyInputStatusType.java | 13 ++ .../web}/GetHouseholdStatusUIController.java | 4 +- .../web}/model/GetHouseholdStatusUIReqVO.java | 2 +- .../web}/GetHouseholdsStatusUIController.java | 4 +- .../web}/model/GetHouseholdsUIReqVO.java | 2 +- .../UpdateMonthlyInputStatusDao.java | 19 +++ .../UpdateMonthlyInputStatusMapper.java | 9 ++ .../ports/UpdateMonthlyInputStatusPortIn.java | 7 + .../UpdateMonthlyInputStatusPortOut.java | 7 + .../UpdateMonthlyInputStatusService.java | 18 +++ .../domain/UpdateForestProductStatusCmd.java | 15 ++ .../persistence/RemoveForestProductsDao.java | 33 ++++ .../RemoveForestProductsMapper.java | 10 ++ .../web/RemoveForestProductsController.java | 36 +++++ .../web/model/RemoveForestProductsReqVO.java | 17 +++ .../web/model/RemoveForestProductsResVO.java | 14 ++ .../ports/RemoveForestProductsPortIn.java | 7 + .../ports/RemoveForestProductsPortOut.java | 7 + .../RemoveForestProductsService.java | 18 +++ .../domain/RemoveForestProductsCmd.java | 17 +++ .../persistence/SaveForestProductDao.java | 22 ++- .../persistence/SaveForestProductMapper.java | 1 + .../UpdateForestProductNoneDao.java | 34 +++++ .../UpdateForestProductNoneMapper.java | 9 ++ .../UpdateForestProductNoneController.java | 31 ++++ .../model/UpdateForestProductNoneReqVO.java | 16 ++ .../model/UpdateForestProductNoneResVO.java | 14 ++ .../ports/UpdateForestProductNonePortIn.java | 7 + .../ports/UpdateForestProductNonePortOut.java | 8 + .../UpdateForestProductNoneService.java | 22 +++ .../domain/UpdateForestProductNoneInCmd.java | 13 ++ .../domain/UpdateForestProductNoneOutCmd.java | 14 ++ .../UpdateMonthlyForestProductStatusCmd.java | 15 ++ .../household/RemoveForestProductsMapper.xml | 25 ++++ .../RemoveHouseholdVisitInfosMapper.xml | 18 +-- .../household/SaveForestProductMapper.xml | 7 + .../UpdateForestProductNoneMapper.xml | 13 ++ .../UpdateMonthlyInputStatusMapper.xml | 14 ++ .../resources/messages/operation.properties | 1 + .../templates/common/components.html | 1 + .../modal/modal-forest-product.html | 2 +- .../households/tab/forest-product.html | 141 +++++++++++++++++- 42 files changed, 663 insertions(+), 24 deletions(-) create mode 100644 admin/src/main/java/app/module/admin/config/application/enums/MonthlyInputStatusType.java rename admin/src/main/java/app/module/admin/usecase/household/getHouseholdStatusUI/{ => adapters/web}/GetHouseholdStatusUIController.java (89%) rename admin/src/main/java/app/module/admin/usecase/household/getHouseholdStatusUI/{ => adapters/web}/model/GetHouseholdStatusUIReqVO.java (93%) rename admin/src/main/java/app/module/admin/usecase/household/getHouseholdsStatusUI/{ => adapters/web}/GetHouseholdsStatusUIController.java (97%) rename admin/src/main/java/app/module/admin/usecase/household/getHouseholdsStatusUI/{ => adapters/web}/model/GetHouseholdsUIReqVO.java (98%) create mode 100644 admin/src/main/java/app/module/admin/usecase/household/monthlyInputStatus/updateMonthlyInputStatus/adapters/persistence/UpdateMonthlyInputStatusDao.java create mode 100644 admin/src/main/java/app/module/admin/usecase/household/monthlyInputStatus/updateMonthlyInputStatus/adapters/persistence/UpdateMonthlyInputStatusMapper.java create mode 100644 admin/src/main/java/app/module/admin/usecase/household/monthlyInputStatus/updateMonthlyInputStatus/ports/UpdateMonthlyInputStatusPortIn.java create mode 100644 admin/src/main/java/app/module/admin/usecase/household/monthlyInputStatus/updateMonthlyInputStatus/ports/UpdateMonthlyInputStatusPortOut.java create mode 100644 admin/src/main/java/app/module/admin/usecase/household/monthlyInputStatus/updateMonthlyInputStatus/ports/application/UpdateMonthlyInputStatusService.java create mode 100644 admin/src/main/java/app/module/admin/usecase/household/monthlyInputStatus/updateMonthlyInputStatus/ports/application/domain/UpdateForestProductStatusCmd.java create mode 100644 admin/src/main/java/app/module/admin/usecase/household/tab/forestProduct/removeForestProducts/adapters/persistence/RemoveForestProductsDao.java create mode 100644 admin/src/main/java/app/module/admin/usecase/household/tab/forestProduct/removeForestProducts/adapters/persistence/RemoveForestProductsMapper.java create mode 100644 admin/src/main/java/app/module/admin/usecase/household/tab/forestProduct/removeForestProducts/adapters/web/RemoveForestProductsController.java create mode 100644 admin/src/main/java/app/module/admin/usecase/household/tab/forestProduct/removeForestProducts/adapters/web/model/RemoveForestProductsReqVO.java create mode 100644 admin/src/main/java/app/module/admin/usecase/household/tab/forestProduct/removeForestProducts/adapters/web/model/RemoveForestProductsResVO.java create mode 100644 admin/src/main/java/app/module/admin/usecase/household/tab/forestProduct/removeForestProducts/ports/RemoveForestProductsPortIn.java create mode 100644 admin/src/main/java/app/module/admin/usecase/household/tab/forestProduct/removeForestProducts/ports/RemoveForestProductsPortOut.java create mode 100644 admin/src/main/java/app/module/admin/usecase/household/tab/forestProduct/removeForestProducts/ports/application/RemoveForestProductsService.java create mode 100644 admin/src/main/java/app/module/admin/usecase/household/tab/forestProduct/removeForestProducts/ports/application/domain/RemoveForestProductsCmd.java create mode 100644 admin/src/main/java/app/module/admin/usecase/household/tab/forestProduct/updateForestProductNone/adapters/persistence/UpdateForestProductNoneDao.java create mode 100644 admin/src/main/java/app/module/admin/usecase/household/tab/forestProduct/updateForestProductNone/adapters/persistence/UpdateForestProductNoneMapper.java create mode 100644 admin/src/main/java/app/module/admin/usecase/household/tab/forestProduct/updateForestProductNone/adapters/web/UpdateForestProductNoneController.java create mode 100644 admin/src/main/java/app/module/admin/usecase/household/tab/forestProduct/updateForestProductNone/adapters/web/model/UpdateForestProductNoneReqVO.java create mode 100644 admin/src/main/java/app/module/admin/usecase/household/tab/forestProduct/updateForestProductNone/adapters/web/model/UpdateForestProductNoneResVO.java create mode 100644 admin/src/main/java/app/module/admin/usecase/household/tab/forestProduct/updateForestProductNone/ports/UpdateForestProductNonePortIn.java create mode 100644 admin/src/main/java/app/module/admin/usecase/household/tab/forestProduct/updateForestProductNone/ports/UpdateForestProductNonePortOut.java create mode 100644 admin/src/main/java/app/module/admin/usecase/household/tab/forestProduct/updateForestProductNone/ports/application/UpdateForestProductNoneService.java create mode 100644 admin/src/main/java/app/module/admin/usecase/household/tab/forestProduct/updateForestProductNone/ports/application/domain/UpdateForestProductNoneInCmd.java create mode 100644 admin/src/main/java/app/module/admin/usecase/household/tab/forestProduct/updateForestProductNone/ports/application/domain/UpdateForestProductNoneOutCmd.java create mode 100644 admin/src/main/java/app/module/admin/usecase/household/tab/forestProduct/updateForestProductNone/ports/application/domain/UpdateMonthlyForestProductStatusCmd.java create mode 100644 admin/src/main/resources/mappers/household/RemoveForestProductsMapper.xml create mode 100644 admin/src/main/resources/mappers/household/UpdateForestProductNoneMapper.xml create mode 100644 admin/src/main/resources/mappers/household/UpdateMonthlyInputStatusMapper.xml diff --git a/admin/src/main/java/app/module/admin/config/application/enums/MonthlyInputStatusType.java b/admin/src/main/java/app/module/admin/config/application/enums/MonthlyInputStatusType.java new file mode 100644 index 00000000..a178d27a --- /dev/null +++ b/admin/src/main/java/app/module/admin/config/application/enums/MonthlyInputStatusType.java @@ -0,0 +1,13 @@ +package app.module.admin.config.application.enums; + +import lombok.Getter; +import lombok.RequiredArgsConstructor; + +@Getter +@RequiredArgsConstructor +public enum MonthlyInputStatusType { + NONE("미등록"), + NOTHING("등록 내용없음"), + REGISTERED("등록완료"); + private final String desc; +} diff --git a/admin/src/main/java/app/module/admin/usecase/household/getHouseholdStatusUI/GetHouseholdStatusUIController.java b/admin/src/main/java/app/module/admin/usecase/household/getHouseholdStatusUI/adapters/web/GetHouseholdStatusUIController.java similarity index 89% rename from admin/src/main/java/app/module/admin/usecase/household/getHouseholdStatusUI/GetHouseholdStatusUIController.java rename to admin/src/main/java/app/module/admin/usecase/household/getHouseholdStatusUI/adapters/web/GetHouseholdStatusUIController.java index 19dd87b5..b003eb9b 100644 --- a/admin/src/main/java/app/module/admin/usecase/household/getHouseholdStatusUI/GetHouseholdStatusUIController.java +++ b/admin/src/main/java/app/module/admin/usecase/household/getHouseholdStatusUI/adapters/web/GetHouseholdStatusUIController.java @@ -1,4 +1,4 @@ -package app.module.admin.usecase.household.getHouseholdStatusUI; +package app.module.admin.usecase.household.getHouseholdStatusUI.adapters.web; import app.module.admin.config.application.util.AdminUtil; import app.module.admin.config.application.util.DateUiUtil; @@ -11,7 +11,7 @@ import org.springframework.ui.Model; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.ModelAttribute; import org.springframework.web.bind.annotation.PathVariable; -import app.module.admin.usecase.household.getHouseholdStatusUI.model.GetHouseholdStatusUIReqVO; +import app.module.admin.usecase.household.getHouseholdStatusUI.adapters.web.model.GetHouseholdStatusUIReqVO; import org.springframework.web.bind.annotation.RequestParam; @Controller diff --git a/admin/src/main/java/app/module/admin/usecase/household/getHouseholdStatusUI/model/GetHouseholdStatusUIReqVO.java b/admin/src/main/java/app/module/admin/usecase/household/getHouseholdStatusUI/adapters/web/model/GetHouseholdStatusUIReqVO.java similarity index 93% rename from admin/src/main/java/app/module/admin/usecase/household/getHouseholdStatusUI/model/GetHouseholdStatusUIReqVO.java rename to admin/src/main/java/app/module/admin/usecase/household/getHouseholdStatusUI/adapters/web/model/GetHouseholdStatusUIReqVO.java index a49de0a2..bbc62d52 100644 --- a/admin/src/main/java/app/module/admin/usecase/household/getHouseholdStatusUI/model/GetHouseholdStatusUIReqVO.java +++ b/admin/src/main/java/app/module/admin/usecase/household/getHouseholdStatusUI/adapters/web/model/GetHouseholdStatusUIReqVO.java @@ -1,4 +1,4 @@ -package app.module.admin.usecase.household.getHouseholdStatusUI.model; +package app.module.admin.usecase.household.getHouseholdStatusUI.adapters.web.model; import lombok.AllArgsConstructor; import lombok.EqualsAndHashCode; diff --git a/admin/src/main/java/app/module/admin/usecase/household/getHouseholdsStatusUI/GetHouseholdsStatusUIController.java b/admin/src/main/java/app/module/admin/usecase/household/getHouseholdsStatusUI/adapters/web/GetHouseholdsStatusUIController.java similarity index 97% rename from admin/src/main/java/app/module/admin/usecase/household/getHouseholdsStatusUI/GetHouseholdsStatusUIController.java rename to admin/src/main/java/app/module/admin/usecase/household/getHouseholdsStatusUI/adapters/web/GetHouseholdsStatusUIController.java index c7449fb4..0d269c18 100644 --- a/admin/src/main/java/app/module/admin/usecase/household/getHouseholdsStatusUI/GetHouseholdsStatusUIController.java +++ b/admin/src/main/java/app/module/admin/usecase/household/getHouseholdsStatusUI/adapters/web/GetHouseholdsStatusUIController.java @@ -1,8 +1,8 @@ -package app.module.admin.usecase.household.getHouseholdsStatusUI; +package app.module.admin.usecase.household.getHouseholdsStatusUI.adapters.web; import app.module.admin.config.application.util.AdminUtil; import app.module.admin.config.application.util.DateUiUtil; -import app.module.admin.usecase.household.getHouseholdsStatusUI.model.GetHouseholdsUIReqVO; +import app.module.admin.usecase.household.getHouseholdsStatusUI.adapters.web.model.GetHouseholdsUIReqVO; import app.module.core.config.application.util.CommonUtil; import app.module.core.usecase.admin.view.ports.AdminViewPortIn; import app.module.core.usecase.admin.view.ports.application.domain.AdminView; diff --git a/admin/src/main/java/app/module/admin/usecase/household/getHouseholdsStatusUI/model/GetHouseholdsUIReqVO.java b/admin/src/main/java/app/module/admin/usecase/household/getHouseholdsStatusUI/adapters/web/model/GetHouseholdsUIReqVO.java similarity index 98% rename from admin/src/main/java/app/module/admin/usecase/household/getHouseholdsStatusUI/model/GetHouseholdsUIReqVO.java rename to admin/src/main/java/app/module/admin/usecase/household/getHouseholdsStatusUI/adapters/web/model/GetHouseholdsUIReqVO.java index ee34a95e..8e6124b1 100644 --- a/admin/src/main/java/app/module/admin/usecase/household/getHouseholdsStatusUI/model/GetHouseholdsUIReqVO.java +++ b/admin/src/main/java/app/module/admin/usecase/household/getHouseholdsStatusUI/adapters/web/model/GetHouseholdsUIReqVO.java @@ -1,4 +1,4 @@ -package app.module.admin.usecase.household.getHouseholdsStatusUI.model; +package app.module.admin.usecase.household.getHouseholdsStatusUI.adapters.web.model; import app.module.admin.usecase.household.getHouseholdsStatus.ports.application.domain.ProgressType; import lombok.AllArgsConstructor; diff --git a/admin/src/main/java/app/module/admin/usecase/household/monthlyInputStatus/updateMonthlyInputStatus/adapters/persistence/UpdateMonthlyInputStatusDao.java b/admin/src/main/java/app/module/admin/usecase/household/monthlyInputStatus/updateMonthlyInputStatus/adapters/persistence/UpdateMonthlyInputStatusDao.java new file mode 100644 index 00000000..2e332a4e --- /dev/null +++ b/admin/src/main/java/app/module/admin/usecase/household/monthlyInputStatus/updateMonthlyInputStatus/adapters/persistence/UpdateMonthlyInputStatusDao.java @@ -0,0 +1,19 @@ +package app.module.admin.usecase.household.monthlyInputStatus.updateMonthlyInputStatus.adapters.persistence; + +import app.module.core.config.application.annotation.UpdateCommand; +import lombok.RequiredArgsConstructor; +import app.module.admin.usecase.household.monthlyInputStatus.updateMonthlyInputStatus.ports.application.domain.UpdateForestProductStatusCmd; +import app.module.admin.usecase.household.monthlyInputStatus.updateMonthlyInputStatus.ports.UpdateMonthlyInputStatusPortOut; +import org.springframework.stereotype.Repository; + +@Repository +@RequiredArgsConstructor +class UpdateMonthlyInputStatusDao implements UpdateMonthlyInputStatusPortOut { + private final UpdateMonthlyInputStatusMapper mapper; + + @Override + @UpdateCommand + public void updateForestProductStatus(UpdateForestProductStatusCmd cmd) { + mapper.updateForestProductStatus(cmd); + } +} \ No newline at end of file diff --git a/admin/src/main/java/app/module/admin/usecase/household/monthlyInputStatus/updateMonthlyInputStatus/adapters/persistence/UpdateMonthlyInputStatusMapper.java b/admin/src/main/java/app/module/admin/usecase/household/monthlyInputStatus/updateMonthlyInputStatus/adapters/persistence/UpdateMonthlyInputStatusMapper.java new file mode 100644 index 00000000..cdfc03d9 --- /dev/null +++ b/admin/src/main/java/app/module/admin/usecase/household/monthlyInputStatus/updateMonthlyInputStatus/adapters/persistence/UpdateMonthlyInputStatusMapper.java @@ -0,0 +1,9 @@ +package app.module.admin.usecase.household.monthlyInputStatus.updateMonthlyInputStatus.adapters.persistence; + +import app.module.admin.usecase.household.monthlyInputStatus.updateMonthlyInputStatus.ports.application.domain.UpdateForestProductStatusCmd; +import org.apache.ibatis.annotations.Mapper; + +@Mapper +public interface UpdateMonthlyInputStatusMapper { + void updateForestProductStatus(UpdateForestProductStatusCmd cmd); +} diff --git a/admin/src/main/java/app/module/admin/usecase/household/monthlyInputStatus/updateMonthlyInputStatus/ports/UpdateMonthlyInputStatusPortIn.java b/admin/src/main/java/app/module/admin/usecase/household/monthlyInputStatus/updateMonthlyInputStatus/ports/UpdateMonthlyInputStatusPortIn.java new file mode 100644 index 00000000..b92d3e34 --- /dev/null +++ b/admin/src/main/java/app/module/admin/usecase/household/monthlyInputStatus/updateMonthlyInputStatus/ports/UpdateMonthlyInputStatusPortIn.java @@ -0,0 +1,7 @@ +package app.module.admin.usecase.household.monthlyInputStatus.updateMonthlyInputStatus.ports; + +import app.module.admin.usecase.household.monthlyInputStatus.updateMonthlyInputStatus.ports.application.domain.UpdateForestProductStatusCmd; + +public interface UpdateMonthlyInputStatusPortIn { + void updateForestProductStatus(UpdateForestProductStatusCmd cmd); +} \ No newline at end of file diff --git a/admin/src/main/java/app/module/admin/usecase/household/monthlyInputStatus/updateMonthlyInputStatus/ports/UpdateMonthlyInputStatusPortOut.java b/admin/src/main/java/app/module/admin/usecase/household/monthlyInputStatus/updateMonthlyInputStatus/ports/UpdateMonthlyInputStatusPortOut.java new file mode 100644 index 00000000..cca72d63 --- /dev/null +++ b/admin/src/main/java/app/module/admin/usecase/household/monthlyInputStatus/updateMonthlyInputStatus/ports/UpdateMonthlyInputStatusPortOut.java @@ -0,0 +1,7 @@ +package app.module.admin.usecase.household.monthlyInputStatus.updateMonthlyInputStatus.ports; + +import app.module.admin.usecase.household.monthlyInputStatus.updateMonthlyInputStatus.ports.application.domain.UpdateForestProductStatusCmd; + +public interface UpdateMonthlyInputStatusPortOut { + void updateForestProductStatus(UpdateForestProductStatusCmd cmd); +} \ No newline at end of file diff --git a/admin/src/main/java/app/module/admin/usecase/household/monthlyInputStatus/updateMonthlyInputStatus/ports/application/UpdateMonthlyInputStatusService.java b/admin/src/main/java/app/module/admin/usecase/household/monthlyInputStatus/updateMonthlyInputStatus/ports/application/UpdateMonthlyInputStatusService.java new file mode 100644 index 00000000..d4357e49 --- /dev/null +++ b/admin/src/main/java/app/module/admin/usecase/household/monthlyInputStatus/updateMonthlyInputStatus/ports/application/UpdateMonthlyInputStatusService.java @@ -0,0 +1,18 @@ +package app.module.admin.usecase.household.monthlyInputStatus.updateMonthlyInputStatus.ports.application; + +import lombok.RequiredArgsConstructor; +import app.module.admin.usecase.household.monthlyInputStatus.updateMonthlyInputStatus.ports.application.domain.UpdateForestProductStatusCmd; +import app.module.admin.usecase.household.monthlyInputStatus.updateMonthlyInputStatus.ports.UpdateMonthlyInputStatusPortIn; +import app.module.admin.usecase.household.monthlyInputStatus.updateMonthlyInputStatus.ports.UpdateMonthlyInputStatusPortOut; +import org.springframework.stereotype.Service; + +@Service +@RequiredArgsConstructor +class UpdateMonthlyInputStatusService implements UpdateMonthlyInputStatusPortIn { + private final UpdateMonthlyInputStatusPortOut portOut; + + @Override + public void updateForestProductStatus(UpdateForestProductStatusCmd cmd) { + portOut.updateForestProductStatus(cmd); + } +} \ No newline at end of file diff --git a/admin/src/main/java/app/module/admin/usecase/household/monthlyInputStatus/updateMonthlyInputStatus/ports/application/domain/UpdateForestProductStatusCmd.java b/admin/src/main/java/app/module/admin/usecase/household/monthlyInputStatus/updateMonthlyInputStatus/ports/application/domain/UpdateForestProductStatusCmd.java new file mode 100644 index 00000000..858b5104 --- /dev/null +++ b/admin/src/main/java/app/module/admin/usecase/household/monthlyInputStatus/updateMonthlyInputStatus/ports/application/domain/UpdateForestProductStatusCmd.java @@ -0,0 +1,15 @@ +package app.module.admin.usecase.household.monthlyInputStatus.updateMonthlyInputStatus.ports.application.domain; + +import app.module.core.config.adapters.persistence.component.AuditCommand; +import lombok.AllArgsConstructor; +import lombok.EqualsAndHashCode; +import lombok.Getter; +import lombok.Setter; + +@Getter +@Setter +@AllArgsConstructor +public class UpdateForestProductStatusCmd extends AuditCommand { + private Long id; + private String status; +} diff --git a/admin/src/main/java/app/module/admin/usecase/household/tab/forestProduct/removeForestProducts/adapters/persistence/RemoveForestProductsDao.java b/admin/src/main/java/app/module/admin/usecase/household/tab/forestProduct/removeForestProducts/adapters/persistence/RemoveForestProductsDao.java new file mode 100644 index 00000000..b7bb6694 --- /dev/null +++ b/admin/src/main/java/app/module/admin/usecase/household/tab/forestProduct/removeForestProducts/adapters/persistence/RemoveForestProductsDao.java @@ -0,0 +1,33 @@ +package app.module.admin.usecase.household.tab.forestProduct.removeForestProducts.adapters.persistence; + +import app.module.admin.config.application.enums.MonthlyInputStatusType; +import app.module.admin.usecase.household.monthlyInputStatus.updateMonthlyInputStatus.adapters.persistence.UpdateMonthlyInputStatusMapper; +import app.module.admin.usecase.household.monthlyInputStatus.updateMonthlyInputStatus.ports.application.domain.UpdateForestProductStatusCmd; +import app.module.core.config.application.annotation.DeleteCommand; +import lombok.RequiredArgsConstructor; +import app.module.admin.usecase.household.tab.forestProduct.removeForestProducts.ports.application.domain.RemoveForestProductsCmd; +import app.module.admin.usecase.household.tab.forestProduct.removeForestProducts.ports.RemoveForestProductsPortOut; +import org.springframework.stereotype.Repository; +import org.springframework.transaction.annotation.Transactional; + +@Repository +@RequiredArgsConstructor +class RemoveForestProductsDao implements RemoveForestProductsPortOut { + private final RemoveForestProductsMapper removeForestProductsMapper; + private final UpdateMonthlyInputStatusMapper updateMonthlyInputStatusMapper; + + @Override + @DeleteCommand + @Transactional + public void operate(RemoveForestProductsCmd cmd) { + // 임산물 현황 삭제 + removeForestProductsMapper.removeForestProducts(cmd); + + // 임산물 모두 삭제됐을 경우 입력상태 미등록으로 update + if (!removeForestProductsMapper.existsForestProduct(cmd.getMonthlyInputStatusId())) { + updateMonthlyInputStatusMapper.updateForestProductStatus( + new UpdateForestProductStatusCmd(cmd.getMonthlyInputStatusId(), + MonthlyInputStatusType.NONE.name())); + } + } +} \ No newline at end of file diff --git a/admin/src/main/java/app/module/admin/usecase/household/tab/forestProduct/removeForestProducts/adapters/persistence/RemoveForestProductsMapper.java b/admin/src/main/java/app/module/admin/usecase/household/tab/forestProduct/removeForestProducts/adapters/persistence/RemoveForestProductsMapper.java new file mode 100644 index 00000000..1117241a --- /dev/null +++ b/admin/src/main/java/app/module/admin/usecase/household/tab/forestProduct/removeForestProducts/adapters/persistence/RemoveForestProductsMapper.java @@ -0,0 +1,10 @@ +package app.module.admin.usecase.household.tab.forestProduct.removeForestProducts.adapters.persistence; + +import app.module.admin.usecase.household.tab.forestProduct.removeForestProducts.ports.application.domain.RemoveForestProductsCmd; +import org.apache.ibatis.annotations.Mapper; + +@Mapper +public interface RemoveForestProductsMapper { + void removeForestProducts(RemoveForestProductsCmd cmd); + boolean existsForestProduct(Long monthlyInputStatusId); +} diff --git a/admin/src/main/java/app/module/admin/usecase/household/tab/forestProduct/removeForestProducts/adapters/web/RemoveForestProductsController.java b/admin/src/main/java/app/module/admin/usecase/household/tab/forestProduct/removeForestProducts/adapters/web/RemoveForestProductsController.java new file mode 100644 index 00000000..5fe5f500 --- /dev/null +++ b/admin/src/main/java/app/module/admin/usecase/household/tab/forestProduct/removeForestProducts/adapters/web/RemoveForestProductsController.java @@ -0,0 +1,36 @@ +package app.module.admin.usecase.household.tab.forestProduct.removeForestProducts.adapters.web; + +import app.module.admin.usecase.household.tab.forestProduct.removeForestProducts.ports.RemoveForestProductsPortIn; +import app.module.admin.usecase.household.tab.forestProduct.removeForestProducts.ports.application.domain.RemoveForestProductsCmd; +import app.module.core.config.application.util.MessageUtil; +import jakarta.validation.Valid; +import lombok.RequiredArgsConstructor; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RestController; +import org.springframework.validation.BindingResult; +import app.module.admin.usecase.household.tab.forestProduct.removeForestProducts.adapters.web.model.RemoveForestProductsReqVO; +import app.module.admin.usecase.household.tab.forestProduct.removeForestProducts.adapters.web.model.RemoveForestProductsResVO; + +@RestController +@RequiredArgsConstructor +class RemoveForestProductsController { + private final RemoveForestProductsPortIn portIn; + private final MessageUtil messageUtil; + + @DeleteMapping(path = "/api/household/forestProducts/delete") + ResponseEntity operate(@Valid @RequestBody RemoveForestProductsReqVO reqVO, + BindingResult bindingResult) { + if (bindingResult.hasErrors()) { + return ResponseEntity.status(HttpStatus.UNPROCESSABLE_ENTITY).body(bindingResult); + } + + portIn.operate( + new RemoveForestProductsCmd(reqVO.getMonthlyInputStatusId(), reqVO.getForestRemoveIds())); + + return ResponseEntity.status(HttpStatus.OK).body( + new RemoveForestProductsResVO(messageUtil.getMessage("operation.common.remove.done"))); + } +} \ No newline at end of file diff --git a/admin/src/main/java/app/module/admin/usecase/household/tab/forestProduct/removeForestProducts/adapters/web/model/RemoveForestProductsReqVO.java b/admin/src/main/java/app/module/admin/usecase/household/tab/forestProduct/removeForestProducts/adapters/web/model/RemoveForestProductsReqVO.java new file mode 100644 index 00000000..9af219a6 --- /dev/null +++ b/admin/src/main/java/app/module/admin/usecase/household/tab/forestProduct/removeForestProducts/adapters/web/model/RemoveForestProductsReqVO.java @@ -0,0 +1,17 @@ +package app.module.admin.usecase.household.tab.forestProduct.removeForestProducts.adapters.web.model; + +import java.util.List; +import lombok.AllArgsConstructor; +import lombok.EqualsAndHashCode; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; + +@Getter +@Setter +@NoArgsConstructor +@EqualsAndHashCode +public class RemoveForestProductsReqVO { + private Long monthlyInputStatusId; + private List forestRemoveIds; +} diff --git a/admin/src/main/java/app/module/admin/usecase/household/tab/forestProduct/removeForestProducts/adapters/web/model/RemoveForestProductsResVO.java b/admin/src/main/java/app/module/admin/usecase/household/tab/forestProduct/removeForestProducts/adapters/web/model/RemoveForestProductsResVO.java new file mode 100644 index 00000000..7d169cf3 --- /dev/null +++ b/admin/src/main/java/app/module/admin/usecase/household/tab/forestProduct/removeForestProducts/adapters/web/model/RemoveForestProductsResVO.java @@ -0,0 +1,14 @@ +package app.module.admin.usecase.household.tab.forestProduct.removeForestProducts.adapters.web.model; + +import lombok.AllArgsConstructor; +import lombok.EqualsAndHashCode; +import lombok.Getter; +import lombok.Setter; + +@Getter +@Setter +@AllArgsConstructor +@EqualsAndHashCode +public class RemoveForestProductsResVO { + private String message; +} diff --git a/admin/src/main/java/app/module/admin/usecase/household/tab/forestProduct/removeForestProducts/ports/RemoveForestProductsPortIn.java b/admin/src/main/java/app/module/admin/usecase/household/tab/forestProduct/removeForestProducts/ports/RemoveForestProductsPortIn.java new file mode 100644 index 00000000..91e4899e --- /dev/null +++ b/admin/src/main/java/app/module/admin/usecase/household/tab/forestProduct/removeForestProducts/ports/RemoveForestProductsPortIn.java @@ -0,0 +1,7 @@ +package app.module.admin.usecase.household.tab.forestProduct.removeForestProducts.ports; + +import app.module.admin.usecase.household.tab.forestProduct.removeForestProducts.ports.application.domain.RemoveForestProductsCmd; + +public interface RemoveForestProductsPortIn { + void operate(RemoveForestProductsCmd cmd); +} \ No newline at end of file diff --git a/admin/src/main/java/app/module/admin/usecase/household/tab/forestProduct/removeForestProducts/ports/RemoveForestProductsPortOut.java b/admin/src/main/java/app/module/admin/usecase/household/tab/forestProduct/removeForestProducts/ports/RemoveForestProductsPortOut.java new file mode 100644 index 00000000..d2d1b66b --- /dev/null +++ b/admin/src/main/java/app/module/admin/usecase/household/tab/forestProduct/removeForestProducts/ports/RemoveForestProductsPortOut.java @@ -0,0 +1,7 @@ +package app.module.admin.usecase.household.tab.forestProduct.removeForestProducts.ports; + +import app.module.admin.usecase.household.tab.forestProduct.removeForestProducts.ports.application.domain.RemoveForestProductsCmd; + +public interface RemoveForestProductsPortOut { + void operate(RemoveForestProductsCmd cmd); +} \ No newline at end of file diff --git a/admin/src/main/java/app/module/admin/usecase/household/tab/forestProduct/removeForestProducts/ports/application/RemoveForestProductsService.java b/admin/src/main/java/app/module/admin/usecase/household/tab/forestProduct/removeForestProducts/ports/application/RemoveForestProductsService.java new file mode 100644 index 00000000..d06fae44 --- /dev/null +++ b/admin/src/main/java/app/module/admin/usecase/household/tab/forestProduct/removeForestProducts/ports/application/RemoveForestProductsService.java @@ -0,0 +1,18 @@ +package app.module.admin.usecase.household.tab.forestProduct.removeForestProducts.ports.application; + +import lombok.RequiredArgsConstructor; +import app.module.admin.usecase.household.tab.forestProduct.removeForestProducts.ports.application.domain.RemoveForestProductsCmd; +import app.module.admin.usecase.household.tab.forestProduct.removeForestProducts.ports.RemoveForestProductsPortIn; +import app.module.admin.usecase.household.tab.forestProduct.removeForestProducts.ports.RemoveForestProductsPortOut; +import org.springframework.stereotype.Service; + +@Service +@RequiredArgsConstructor +class RemoveForestProductsService implements RemoveForestProductsPortIn { + private final RemoveForestProductsPortOut portOut; + + @Override + public void operate(RemoveForestProductsCmd cmd) { + portOut.operate(cmd); + } +} \ No newline at end of file diff --git a/admin/src/main/java/app/module/admin/usecase/household/tab/forestProduct/removeForestProducts/ports/application/domain/RemoveForestProductsCmd.java b/admin/src/main/java/app/module/admin/usecase/household/tab/forestProduct/removeForestProducts/ports/application/domain/RemoveForestProductsCmd.java new file mode 100644 index 00000000..672e6872 --- /dev/null +++ b/admin/src/main/java/app/module/admin/usecase/household/tab/forestProduct/removeForestProducts/ports/application/domain/RemoveForestProductsCmd.java @@ -0,0 +1,17 @@ +package app.module.admin.usecase.household.tab.forestProduct.removeForestProducts.ports.application.domain; + +import app.module.core.config.adapters.persistence.component.AuditCommand; +import java.util.List; +import lombok.AllArgsConstructor; +import lombok.EqualsAndHashCode; +import lombok.Getter; +import lombok.Setter; + +@Getter +@Setter +@AllArgsConstructor +@EqualsAndHashCode +public class RemoveForestProductsCmd extends AuditCommand { + private Long monthlyInputStatusId; + private List removeIds; +} diff --git a/admin/src/main/java/app/module/admin/usecase/household/tab/forestProduct/saveForestProduct/adapters/persistence/SaveForestProductDao.java b/admin/src/main/java/app/module/admin/usecase/household/tab/forestProduct/saveForestProduct/adapters/persistence/SaveForestProductDao.java index 28b77e34..60b61971 100644 --- a/admin/src/main/java/app/module/admin/usecase/household/tab/forestProduct/saveForestProduct/adapters/persistence/SaveForestProductDao.java +++ b/admin/src/main/java/app/module/admin/usecase/household/tab/forestProduct/saveForestProduct/adapters/persistence/SaveForestProductDao.java @@ -1,5 +1,8 @@ package app.module.admin.usecase.household.tab.forestProduct.saveForestProduct.adapters.persistence; +import app.module.admin.config.application.enums.MonthlyInputStatusType; +import app.module.admin.usecase.household.monthlyInputStatus.updateMonthlyInputStatus.adapters.persistence.UpdateMonthlyInputStatusMapper; +import app.module.admin.usecase.household.monthlyInputStatus.updateMonthlyInputStatus.ports.application.domain.UpdateForestProductStatusCmd; import app.module.admin.usecase.household.tab.forestProduct.saveForestProduct.ports.SaveForestProductPortOut; import app.module.admin.usecase.household.tab.forestProduct.saveForestProduct.ports.application.domain.SaveForestProductCmd; import app.module.core.config.application.util.AuditUtil; @@ -10,15 +13,28 @@ import org.springframework.transaction.annotation.Transactional; @Repository @RequiredArgsConstructor class SaveForestProductDao implements SaveForestProductPortOut { - private final SaveForestProductMapper mapper; + private final SaveForestProductMapper saveForestProductMapper; + private final UpdateMonthlyInputStatusMapper updateMonthlyInputStatusMapper; @Override @Transactional public void operate(SaveForestProductCmd inCmd) { if (inCmd.getForestProductId() == null) { - mapper.createForestProduct(AuditUtil.create(inCmd)); + String status = saveForestProductMapper.getForestProductStatus(inCmd.getMonthlyInputStatusId()); + + // 등록 상태가 "REGISTERED"가 아닐 경우 "REGISTERED"로 update + if(!MonthlyInputStatusType.REGISTERED.name().equals(status)) { + updateMonthlyInputStatusMapper.updateForestProductStatus( + new UpdateForestProductStatusCmd( + inCmd.getMonthlyInputStatusId(), + MonthlyInputStatusType.REGISTERED.name())); + } + + // 임산물 현황 등록 + saveForestProductMapper.createForestProduct(AuditUtil.create(inCmd)); } else { - mapper.updateForestProduct(AuditUtil.update(inCmd)); + // 임산물 현황 update + saveForestProductMapper.updateForestProduct(AuditUtil.update(inCmd)); } } } \ No newline at end of file diff --git a/admin/src/main/java/app/module/admin/usecase/household/tab/forestProduct/saveForestProduct/adapters/persistence/SaveForestProductMapper.java b/admin/src/main/java/app/module/admin/usecase/household/tab/forestProduct/saveForestProduct/adapters/persistence/SaveForestProductMapper.java index 95eb3adf..f754e7ed 100644 --- a/admin/src/main/java/app/module/admin/usecase/household/tab/forestProduct/saveForestProduct/adapters/persistence/SaveForestProductMapper.java +++ b/admin/src/main/java/app/module/admin/usecase/household/tab/forestProduct/saveForestProduct/adapters/persistence/SaveForestProductMapper.java @@ -5,6 +5,7 @@ import org.apache.ibatis.annotations.Mapper; @Mapper public interface SaveForestProductMapper { + String getForestProductStatus(Long monthlyInputStatusId); void createForestProduct(SaveForestProductCmd cmd); void updateForestProduct(SaveForestProductCmd cmd); } diff --git a/admin/src/main/java/app/module/admin/usecase/household/tab/forestProduct/updateForestProductNone/adapters/persistence/UpdateForestProductNoneDao.java b/admin/src/main/java/app/module/admin/usecase/household/tab/forestProduct/updateForestProductNone/adapters/persistence/UpdateForestProductNoneDao.java new file mode 100644 index 00000000..426f8f9a --- /dev/null +++ b/admin/src/main/java/app/module/admin/usecase/household/tab/forestProduct/updateForestProductNone/adapters/persistence/UpdateForestProductNoneDao.java @@ -0,0 +1,34 @@ +package app.module.admin.usecase.household.tab.forestProduct.updateForestProductNone.adapters.persistence; + +import app.module.admin.usecase.household.monthlyInputStatus.updateMonthlyInputStatus.adapters.persistence.UpdateMonthlyInputStatusMapper; +import app.module.admin.usecase.household.monthlyInputStatus.updateMonthlyInputStatus.ports.application.domain.UpdateForestProductStatusCmd; +import app.module.admin.usecase.household.tab.forestProduct.updateForestProductNone.ports.application.domain.UpdateForestProductNoneOutCmd; +import app.module.admin.usecase.household.tab.forestProduct.updateForestProductNone.ports.application.domain.UpdateMonthlyForestProductStatusCmd; +import app.module.core.config.application.util.AuditUtil; +import lombok.RequiredArgsConstructor; +import app.module.admin.usecase.household.tab.forestProduct.updateForestProductNone.ports.application.domain.UpdateForestProductNoneInCmd; +import app.module.admin.usecase.household.tab.forestProduct.updateForestProductNone.ports.UpdateForestProductNonePortOut; +import org.springframework.stereotype.Repository; +import org.springframework.transaction.annotation.Transactional; + +@Repository +@RequiredArgsConstructor +class UpdateForestProductNoneDao implements UpdateForestProductNonePortOut { + private final UpdateForestProductNoneMapper updateForestProductNoneMapper; + private final UpdateMonthlyInputStatusMapper updateMonthlyInputStatusMapper; + + @Override + @Transactional + public void operate(UpdateForestProductNoneOutCmd outCmd) { + // 금일 데이터 없음 체크시 데이터 일괄 삭제 + if ("NOTHING".equals(outCmd.getCurrentStatus())) { + updateForestProductNoneMapper.removeForestProduct(AuditUtil.delete(outCmd)); + } + + // 임산물 현황 상태값 변경 + updateMonthlyInputStatusMapper.updateForestProductStatus( + AuditUtil.update(new UpdateForestProductStatusCmd( + outCmd.getMonthlyInputStatusId(), + outCmd.getCurrentStatus()))); + } +} \ No newline at end of file diff --git a/admin/src/main/java/app/module/admin/usecase/household/tab/forestProduct/updateForestProductNone/adapters/persistence/UpdateForestProductNoneMapper.java b/admin/src/main/java/app/module/admin/usecase/household/tab/forestProduct/updateForestProductNone/adapters/persistence/UpdateForestProductNoneMapper.java new file mode 100644 index 00000000..53cf5d27 --- /dev/null +++ b/admin/src/main/java/app/module/admin/usecase/household/tab/forestProduct/updateForestProductNone/adapters/persistence/UpdateForestProductNoneMapper.java @@ -0,0 +1,9 @@ +package app.module.admin.usecase.household.tab.forestProduct.updateForestProductNone.adapters.persistence; + +import app.module.admin.usecase.household.tab.forestProduct.updateForestProductNone.ports.application.domain.UpdateForestProductNoneOutCmd; +import org.apache.ibatis.annotations.Mapper; + +@Mapper +public interface UpdateForestProductNoneMapper { + void removeForestProduct(UpdateForestProductNoneOutCmd cmd); +} diff --git a/admin/src/main/java/app/module/admin/usecase/household/tab/forestProduct/updateForestProductNone/adapters/web/UpdateForestProductNoneController.java b/admin/src/main/java/app/module/admin/usecase/household/tab/forestProduct/updateForestProductNone/adapters/web/UpdateForestProductNoneController.java new file mode 100644 index 00000000..8cd74f22 --- /dev/null +++ b/admin/src/main/java/app/module/admin/usecase/household/tab/forestProduct/updateForestProductNone/adapters/web/UpdateForestProductNoneController.java @@ -0,0 +1,31 @@ +package app.module.admin.usecase.household.tab.forestProduct.updateForestProductNone.adapters.web; + +import app.module.admin.usecase.household.tab.forestProduct.updateForestProductNone.ports.UpdateForestProductNonePortIn; +import app.module.admin.usecase.household.tab.forestProduct.updateForestProductNone.ports.application.domain.UpdateForestProductNoneInCmd; +import app.module.core.config.application.util.MessageUtil; +import lombok.RequiredArgsConstructor; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.web.bind.annotation.PatchMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.bind.annotation.GetMapping; +import app.module.admin.usecase.household.tab.forestProduct.updateForestProductNone.adapters.web.model.UpdateForestProductNoneReqVO; +import app.module.admin.usecase.household.tab.forestProduct.updateForestProductNone.adapters.web.model.UpdateForestProductNoneResVO; + +@RestController +@RequiredArgsConstructor +class UpdateForestProductNoneController { + private final UpdateForestProductNonePortIn portIn; + private final MessageUtil messageUtil; + + @PatchMapping(path = "/api/household/forestProduct/nothing") + ResponseEntity operate(@RequestBody UpdateForestProductNoneReqVO reqVO) { + + portIn.operate(new UpdateForestProductNoneInCmd(reqVO.getMonthlyInputStatusId(), + reqVO.getTodayNone())); + + return ResponseEntity.status(HttpStatus.OK).body(new UpdateForestProductNoneResVO( + messageUtil.getMessage("operation.common.update.done"))); + } +} \ No newline at end of file diff --git a/admin/src/main/java/app/module/admin/usecase/household/tab/forestProduct/updateForestProductNone/adapters/web/model/UpdateForestProductNoneReqVO.java b/admin/src/main/java/app/module/admin/usecase/household/tab/forestProduct/updateForestProductNone/adapters/web/model/UpdateForestProductNoneReqVO.java new file mode 100644 index 00000000..b38f655e --- /dev/null +++ b/admin/src/main/java/app/module/admin/usecase/household/tab/forestProduct/updateForestProductNone/adapters/web/model/UpdateForestProductNoneReqVO.java @@ -0,0 +1,16 @@ +package app.module.admin.usecase.household.tab.forestProduct.updateForestProductNone.adapters.web.model; + +import lombok.AllArgsConstructor; +import lombok.EqualsAndHashCode; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; + +@Getter +@Setter +@NoArgsConstructor +@EqualsAndHashCode +public class UpdateForestProductNoneReqVO { + private Long monthlyInputStatusId; + private String todayNone; +} diff --git a/admin/src/main/java/app/module/admin/usecase/household/tab/forestProduct/updateForestProductNone/adapters/web/model/UpdateForestProductNoneResVO.java b/admin/src/main/java/app/module/admin/usecase/household/tab/forestProduct/updateForestProductNone/adapters/web/model/UpdateForestProductNoneResVO.java new file mode 100644 index 00000000..9971e271 --- /dev/null +++ b/admin/src/main/java/app/module/admin/usecase/household/tab/forestProduct/updateForestProductNone/adapters/web/model/UpdateForestProductNoneResVO.java @@ -0,0 +1,14 @@ +package app.module.admin.usecase.household.tab.forestProduct.updateForestProductNone.adapters.web.model; + +import lombok.AllArgsConstructor; +import lombok.EqualsAndHashCode; +import lombok.Getter; +import lombok.Setter; + +@Getter +@Setter +@AllArgsConstructor +@EqualsAndHashCode +public class UpdateForestProductNoneResVO { + private String message; +} diff --git a/admin/src/main/java/app/module/admin/usecase/household/tab/forestProduct/updateForestProductNone/ports/UpdateForestProductNonePortIn.java b/admin/src/main/java/app/module/admin/usecase/household/tab/forestProduct/updateForestProductNone/ports/UpdateForestProductNonePortIn.java new file mode 100644 index 00000000..c4c973c2 --- /dev/null +++ b/admin/src/main/java/app/module/admin/usecase/household/tab/forestProduct/updateForestProductNone/ports/UpdateForestProductNonePortIn.java @@ -0,0 +1,7 @@ +package app.module.admin.usecase.household.tab.forestProduct.updateForestProductNone.ports; + +import app.module.admin.usecase.household.tab.forestProduct.updateForestProductNone.ports.application.domain.UpdateForestProductNoneInCmd; + +public interface UpdateForestProductNonePortIn { + void operate(UpdateForestProductNoneInCmd inCmd); +} \ No newline at end of file diff --git a/admin/src/main/java/app/module/admin/usecase/household/tab/forestProduct/updateForestProductNone/ports/UpdateForestProductNonePortOut.java b/admin/src/main/java/app/module/admin/usecase/household/tab/forestProduct/updateForestProductNone/ports/UpdateForestProductNonePortOut.java new file mode 100644 index 00000000..a181922b --- /dev/null +++ b/admin/src/main/java/app/module/admin/usecase/household/tab/forestProduct/updateForestProductNone/ports/UpdateForestProductNonePortOut.java @@ -0,0 +1,8 @@ +package app.module.admin.usecase.household.tab.forestProduct.updateForestProductNone.ports; + +import app.module.admin.usecase.household.tab.forestProduct.updateForestProductNone.ports.application.domain.UpdateForestProductNoneInCmd; +import app.module.admin.usecase.household.tab.forestProduct.updateForestProductNone.ports.application.domain.UpdateForestProductNoneOutCmd; + +public interface UpdateForestProductNonePortOut { + void operate(UpdateForestProductNoneOutCmd outCmd); +} \ No newline at end of file diff --git a/admin/src/main/java/app/module/admin/usecase/household/tab/forestProduct/updateForestProductNone/ports/application/UpdateForestProductNoneService.java b/admin/src/main/java/app/module/admin/usecase/household/tab/forestProduct/updateForestProductNone/ports/application/UpdateForestProductNoneService.java new file mode 100644 index 00000000..d998f168 --- /dev/null +++ b/admin/src/main/java/app/module/admin/usecase/household/tab/forestProduct/updateForestProductNone/ports/application/UpdateForestProductNoneService.java @@ -0,0 +1,22 @@ +package app.module.admin.usecase.household.tab.forestProduct.updateForestProductNone.ports.application; + +import app.module.admin.usecase.household.tab.forestProduct.updateForestProductNone.ports.application.domain.UpdateForestProductNoneOutCmd; +import lombok.RequiredArgsConstructor; +import app.module.admin.usecase.household.tab.forestProduct.updateForestProductNone.ports.application.domain.UpdateForestProductNoneInCmd; +import app.module.admin.usecase.household.tab.forestProduct.updateForestProductNone.ports.UpdateForestProductNonePortIn; +import app.module.admin.usecase.household.tab.forestProduct.updateForestProductNone.ports.UpdateForestProductNonePortOut; +import org.springframework.stereotype.Service; + +@Service +@RequiredArgsConstructor +class UpdateForestProductNoneService implements UpdateForestProductNonePortIn { + private final UpdateForestProductNonePortOut portOut; + + @Override + public void operate(UpdateForestProductNoneInCmd inCmd) { + portOut.operate(new UpdateForestProductNoneOutCmd( + inCmd.getMonthlyInputStatusId(), + "Y".equals(inCmd.getTodayNone()) ? "NOTHING" : "NONE" + )); + } +} \ No newline at end of file diff --git a/admin/src/main/java/app/module/admin/usecase/household/tab/forestProduct/updateForestProductNone/ports/application/domain/UpdateForestProductNoneInCmd.java b/admin/src/main/java/app/module/admin/usecase/household/tab/forestProduct/updateForestProductNone/ports/application/domain/UpdateForestProductNoneInCmd.java new file mode 100644 index 00000000..0abe0a27 --- /dev/null +++ b/admin/src/main/java/app/module/admin/usecase/household/tab/forestProduct/updateForestProductNone/ports/application/domain/UpdateForestProductNoneInCmd.java @@ -0,0 +1,13 @@ +package app.module.admin.usecase.household.tab.forestProduct.updateForestProductNone.ports.application.domain; + +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.Setter; + +@Getter +@Setter +@AllArgsConstructor +public class UpdateForestProductNoneInCmd { + private Long monthlyInputStatusId; + private String todayNone; +} diff --git a/admin/src/main/java/app/module/admin/usecase/household/tab/forestProduct/updateForestProductNone/ports/application/domain/UpdateForestProductNoneOutCmd.java b/admin/src/main/java/app/module/admin/usecase/household/tab/forestProduct/updateForestProductNone/ports/application/domain/UpdateForestProductNoneOutCmd.java new file mode 100644 index 00000000..1e7444dd --- /dev/null +++ b/admin/src/main/java/app/module/admin/usecase/household/tab/forestProduct/updateForestProductNone/ports/application/domain/UpdateForestProductNoneOutCmd.java @@ -0,0 +1,14 @@ +package app.module.admin.usecase.household.tab.forestProduct.updateForestProductNone.ports.application.domain; + +import app.module.core.config.adapters.persistence.component.AuditCommand; +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.Setter; + +@Getter +@Setter +@AllArgsConstructor +public class UpdateForestProductNoneOutCmd extends AuditCommand { + private Long monthlyInputStatusId; + private String currentStatus; +} diff --git a/admin/src/main/java/app/module/admin/usecase/household/tab/forestProduct/updateForestProductNone/ports/application/domain/UpdateMonthlyForestProductStatusCmd.java b/admin/src/main/java/app/module/admin/usecase/household/tab/forestProduct/updateForestProductNone/ports/application/domain/UpdateMonthlyForestProductStatusCmd.java new file mode 100644 index 00000000..6ebac2cb --- /dev/null +++ b/admin/src/main/java/app/module/admin/usecase/household/tab/forestProduct/updateForestProductNone/ports/application/domain/UpdateMonthlyForestProductStatusCmd.java @@ -0,0 +1,15 @@ +package app.module.admin.usecase.household.tab.forestProduct.updateForestProductNone.ports.application.domain; + +import app.module.core.config.adapters.persistence.component.AuditCommand; +import lombok.AllArgsConstructor; +import lombok.EqualsAndHashCode; +import lombok.Getter; +import lombok.Setter; + +@Getter +@Setter +@AllArgsConstructor +public class UpdateMonthlyForestProductStatusCmd extends AuditCommand { + private Long monthlyInputStatusId; + private String forestProductStatus; +} diff --git a/admin/src/main/resources/mappers/household/RemoveForestProductsMapper.xml b/admin/src/main/resources/mappers/household/RemoveForestProductsMapper.xml new file mode 100644 index 00000000..83329571 --- /dev/null +++ b/admin/src/main/resources/mappers/household/RemoveForestProductsMapper.xml @@ -0,0 +1,25 @@ + + + + + /* removeForestProducts : 임산물현황 삭제*/ + UPDATE forest_product + SET + WHERE id IN + + #{id} + + + + + \ No newline at end of file diff --git a/admin/src/main/resources/mappers/household/RemoveHouseholdVisitInfosMapper.xml b/admin/src/main/resources/mappers/household/RemoveHouseholdVisitInfosMapper.xml index d4a0516a..6a4ae1c6 100644 --- a/admin/src/main/resources/mappers/household/RemoveHouseholdVisitInfosMapper.xml +++ b/admin/src/main/resources/mappers/household/RemoveHouseholdVisitInfosMapper.xml @@ -3,13 +3,13 @@ "http://mybatis.org/dtd/mybatis-3-mapper.dtd" > - - /* removeHouseholdVisitInfos : 임가방문정보 삭제 */ - UPDATE household_visit - SET - WHERE id IN - - #{id} - - + + /* removeHouseholdVisitInfos : 임가방문정보 삭제 */ + UPDATE household_visit + SET + WHERE id IN + + #{id} + + \ No newline at end of file diff --git a/admin/src/main/resources/mappers/household/SaveForestProductMapper.xml b/admin/src/main/resources/mappers/household/SaveForestProductMapper.xml index 477198a2..0f9b4dd7 100644 --- a/admin/src/main/resources/mappers/household/SaveForestProductMapper.xml +++ b/admin/src/main/resources/mappers/household/SaveForestProductMapper.xml @@ -3,6 +3,13 @@ "http://mybatis.org/dtd/mybatis-3-mapper.dtd" > + + /* createForestProduct : 임산물 현황 등록 */ INSERT INTO forest_product diff --git a/admin/src/main/resources/mappers/household/UpdateForestProductNoneMapper.xml b/admin/src/main/resources/mappers/household/UpdateForestProductNoneMapper.xml new file mode 100644 index 00000000..2e95b510 --- /dev/null +++ b/admin/src/main/resources/mappers/household/UpdateForestProductNoneMapper.xml @@ -0,0 +1,13 @@ + + + + + /* removeForestProduct : 임산물 현황 삭제 */ + UPDATE forest_product + SET + WHERE is_deleted = false + AND monthly_input_status_id = #{monthlyInputStatusId} + + \ No newline at end of file diff --git a/admin/src/main/resources/mappers/household/UpdateMonthlyInputStatusMapper.xml b/admin/src/main/resources/mappers/household/UpdateMonthlyInputStatusMapper.xml new file mode 100644 index 00000000..be531bf9 --- /dev/null +++ b/admin/src/main/resources/mappers/household/UpdateMonthlyInputStatusMapper.xml @@ -0,0 +1,14 @@ + + + + + /* updateForestProductStatus : 임산물현황 입력상태 수정 */ + UPDATE monthly_input_status + SET forest_product_status = #{status}, + + WHERE is_deleted = false + AND id = #{id} + + \ No newline at end of file diff --git a/admin/src/main/resources/messages/operation.properties b/admin/src/main/resources/messages/operation.properties index a8608005..6ffc55b0 100644 --- a/admin/src/main/resources/messages/operation.properties +++ b/admin/src/main/resources/messages/operation.properties @@ -19,3 +19,4 @@ operation.uri.move.cannot.before=\uB354\uC774\uC0C1 \uC774\uC804\uC73C\uB85C \uC operation.uri.move.cannot.after=\uB354\uC774\uC0C1 \uB2E4\uC74C\uC73C\uB85C \uC774\uB3D9\uD560 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4. operation.role.save.choose.first=\uC800\uC7A5\uD560 '\uAD00\uB9AC\uC790 \uAD8C\uD55C' \uC744 \uBA3C\uC800 \uC120\uD0DD\uD558\uC138\uC694. operation.orderNo.updated=\uC815\uB82C\uC21C\uC11C\uAC00 \uBCC0\uACBD\uB418\uC5C8\uC2B5\uB2C8\uB2E4. +operation.common.update.done=\uC218\uC815\uB418\uC5C8\uC2B5\uB2C8\uB2E4. diff --git a/admin/src/main/resources/templates/common/components.html b/admin/src/main/resources/templates/common/components.html index 842c3d97..c1286df0 100644 --- a/admin/src/main/resources/templates/common/components.html +++ b/admin/src/main/resources/templates/common/components.html @@ -25,6 +25,7 @@ + diff --git a/admin/src/main/resources/templates/households/modal/modal-forest-product.html b/admin/src/main/resources/templates/households/modal/modal-forest-product.html index 6393ddb7..a8f63ae9 100644 --- a/admin/src/main/resources/templates/households/modal/modal-forest-product.html +++ b/admin/src/main/resources/templates/households/modal/modal-forest-product.html @@ -364,7 +364,7 @@ ajaxUtil._ajaxMethod( '/api/forestProduct/save', JSON.stringify(dataOj), - (response) => { // 성공 + () => { // 성공 alert("등록이 완료되었습니다."); document.querySelector(".modal-forest-product").ui.close(); diff --git a/admin/src/main/resources/templates/households/tab/forest-product.html b/admin/src/main/resources/templates/households/tab/forest-product.html index 3fd9cb03..0e8bc902 100644 --- a/admin/src/main/resources/templates/households/tab/forest-product.html +++ b/admin/src/main/resources/templates/households/tab/forest-product.html @@ -13,12 +13,19 @@
- -
@@ -73,8 +80,14 @@ // 임산물 현황 등록 상태 id set f.monthlyInputStatusId.value = response.monthlyStatus.id; - const tbody = $('.tab-content.forest-product tbody'); + // 이번달 등록내용 없음 체크 - NONE : 미등록, NOTHING : 이번달 등록내용 없음 , REGISTERED : 등록완료 + $('#forestProductStatus').attr('checked', response.monthlyStatus.forestStatus === 'NOTHING'); + + // 이번달 등록내용 없음 에 따라 버튼 hide 처리 + showForestProductNoneBtn(); + + const tbody = $('.tab-content.forest-product tbody'); tbody.empty(); if(response.forestProducts.length === 0) { @@ -90,7 +103,7 @@
@@ -123,6 +136,124 @@ 'json' ); } + + // 금일 데이터 없음에 따라 버튼 hide/show 처리 + const showForestProductNoneBtn = () => { + $('.table-tit-group').each(function(index, item) { + let checkedIndex = false; + $(item).find('[type="button"]').each(function(indexBtn, itemBtn) { + let $chkBox = $(itemBtn).find('input[type="checkbox"]'); + if (($chkBox.length !== 0 && $chkBox.is(':disabled'))) { + checkedIndex = true; + } + + if (checkedIndex) { + $(itemBtn).hide(); + } else { + $(itemBtn).show(); + } + + if ($chkBox.length !== 0) { + checkedIndex = $chkBox.is(':checked') || $chkBox.is(':disabled'); + } + }); + }); + } + + // 데이터 초기화 Confirm + const showForestProductNoneConfirm = (el) => { + const todayNone = $(el).is(':checked') ? 'Y' : 'N'; + + const obj = $(f).serializeObject(); + obj.todayNone = todayNone; + + if (todayNone === 'Y') { + etUI.dialog.confirm({ + title: '초기화 안내', + message: '등록하신 모든 내용을 삭제하시겠어요?
삭제된 내용은 복구할 수 없습니다.', + negativeCallback: function () { + $(el).prop('checked', todayNone !== 'Y'); + }, + positiveCallback: function () { + updateForestProductNone(obj); + }, + }); + + } else { + updateForestProductNone(obj); + } + } + + // 이번달 등록내용 없음 수정 처리 + const updateForestProductNone = (obj) => { + console.log(obj); + ajaxUtil._ajaxMethod( + '/api/household/forestProduct/nothing', + JSON.stringify(obj), + () => { + if (obj.todayNone === 'Y') { + alert('데이터 초기화가 완료되었습니다.'); + } else { + alert('등록 상태가 변경되었습니다.'); + } + + getForestProductsStatus(); + }, + function (code, rstData) { + + }, + 'patch', + 'json', + { handle422Type: 'alert' } + ); + } + + // 임산물현황 삭제 Confirm + const showDeleteForestProductConfirm = () => { + const checkedIds = Array.from( + document.querySelectorAll('input[name="forestRemoveIds"]:checked') + ).map(el => Number(el.value)); + + if(checkedIds.length <= 0) { + alert("임산물을 선택해주세요."); + return + } + + etUI.dialog.confirm({ + title: '삭제 안내', + message: '선택하신 내용을 삭제하시겠습니까?
삭제한 항목은 복구할 수 없습니다.', + negativeCallback: function () { + + }, + positiveCallback: function () { + goDeleteForestProduct(checkedIds); + }, + }); + } + + // 임산물현황 삭제 + const goDeleteForestProduct = (checkedIds) => { + const f = document.reqForm; + console.log("f.monthlyInputStatusId.value", f.monthlyInputStatusId.value); + + ajaxUtil._ajaxMethod( + '/api/household/forestProducts/delete', + JSON.stringify({ + monthlyInputStatusId: f.monthlyInputStatusId.value, + forestRemoveIds: checkedIds + }), + () => { // 성공 + alert("임산물현황이 삭제되었습니다."); + getForestProductsStatus(); + }, + function (code, rstData) { + if(code == 422) alert(rstData.responseText); + }, + 'delete', + 'json', + { handle422Type: 'alert' } + ); + } \ No newline at end of file
아이디
${ct.householdNum}${ct.ownerName || '-'}${ct.householdNum}${ct.ownerName || '-'} ${ct.phone || '-'} ${ct.regionMainCodeName || '-'} ${ct.regionSubCodeName || '-'}
${ifNullHyphen(item.cropText)} ${ifNullHyphen(item.incomeKind)} ${ifNullHyphen(item.sourcePurpose)}${ifNullHyphen(item.quantity)}${formatNumberWithComma(item.quantity)} ${ifNullHyphen(item.unitText)} ${formatNumberWithComma(item.price)} ${formatNumberWithComma(item.estimatedValue)}