diff --git a/core/src/main/java/app/module/core/usecase/notice/getNotice/adapters/persistence/GetNoticeDao.java b/core/src/main/java/app/module/core/usecase/notice/getNotice/adapters/persistence/GetNoticeDao.java index 9250c722..262ee1ea 100644 --- a/core/src/main/java/app/module/core/usecase/notice/getNotice/adapters/persistence/GetNoticeDao.java +++ b/core/src/main/java/app/module/core/usecase/notice/getNotice/adapters/persistence/GetNoticeDao.java @@ -23,7 +23,7 @@ class GetNoticeDao implements GetNoticePortOut { @Override @Transactional public Optional operate(GetNoticeCmd command) { - GetNotice secArticle = mapper.getNotice(command.getId()); + GetNotice secArticle = mapper.getNotice(command); List setArticleUploadFile = mapper.getUploadFiles(command.getId()); diff --git a/core/src/main/java/app/module/core/usecase/notice/getNotice/adapters/persistence/GetNoticeMapper.java b/core/src/main/java/app/module/core/usecase/notice/getNotice/adapters/persistence/GetNoticeMapper.java index 60903e84..16b81ce2 100644 --- a/core/src/main/java/app/module/core/usecase/notice/getNotice/adapters/persistence/GetNoticeMapper.java +++ b/core/src/main/java/app/module/core/usecase/notice/getNotice/adapters/persistence/GetNoticeMapper.java @@ -1,6 +1,7 @@ package app.module.core.usecase.notice.getNotice.adapters.persistence; import app.module.core.usecase.notice.getNotice.ports.application.domain.GetNotice; +import app.module.core.usecase.notice.getNotice.ports.application.domain.GetNoticeCmd; import app.module.core.usecase.notice.getNotice.ports.application.domain.GetNoticeUploadFile; import org.apache.ibatis.annotations.Mapper; @@ -8,6 +9,8 @@ import java.util.List; @Mapper public interface GetNoticeMapper { - GetNotice getNotice(Long id); + + GetNotice getNotice(GetNoticeCmd command); + List getUploadFiles(Long id); } diff --git a/core/src/main/java/app/module/core/usecase/notice/getNotice/ports/application/domain/GetNotice.java b/core/src/main/java/app/module/core/usecase/notice/getNotice/ports/application/domain/GetNotice.java index db753526..06ba4d05 100644 --- a/core/src/main/java/app/module/core/usecase/notice/getNotice/ports/application/domain/GetNotice.java +++ b/core/src/main/java/app/module/core/usecase/notice/getNotice/ports/application/domain/GetNotice.java @@ -24,4 +24,8 @@ public class GetNotice { private LocalDateTime updatedAt; private String updatedBy; private List uploadFiles; + public boolean getNewDate() { + LocalDateTime now = LocalDateTime.now(); + return now.toLocalDate().isEqual(createdAt.toLocalDate()); + } } diff --git a/core/src/main/java/app/module/core/usecase/notice/getNotice/ports/application/domain/GetNoticeCmd.java b/core/src/main/java/app/module/core/usecase/notice/getNotice/ports/application/domain/GetNoticeCmd.java index 5aec6e79..be3d38c7 100644 --- a/core/src/main/java/app/module/core/usecase/notice/getNotice/ports/application/domain/GetNoticeCmd.java +++ b/core/src/main/java/app/module/core/usecase/notice/getNotice/ports/application/domain/GetNoticeCmd.java @@ -10,6 +10,6 @@ import lombok.Setter; @AllArgsConstructor @EqualsAndHashCode public class GetNoticeCmd { - private Long id; + private String searchOpen; } diff --git a/core/src/main/java/app/module/core/usecase/notice/getNotices/adapters/persistence/GetNoticesDao.java b/core/src/main/java/app/module/core/usecase/notice/getNotices/adapters/persistence/GetNoticesDao.java index 05ba5a12..a141a984 100644 --- a/core/src/main/java/app/module/core/usecase/notice/getNotices/adapters/persistence/GetNoticesDao.java +++ b/core/src/main/java/app/module/core/usecase/notice/getNotices/adapters/persistence/GetNoticesDao.java @@ -39,7 +39,7 @@ class GetNoticesDao implements GetNoticesPortOut { mapper.getUploadFiles( contents.stream().map(GetNoticesDto::getId) .collect(Collectors.toList()), - FileUploadType.EXAMPLE_REP)); + FileUploadType.NOTICE)); return new PageImpl<>( contents.stream() @@ -49,6 +49,8 @@ class GetNoticesDao implements GetNoticesPortOut { article.getId(), article.getUpdatedBy(), article.getUpdatedAt(), + article.getCreatedBy(), + article.getCreatedAt(), article.getTitle(), article.getContent(), article.getVisible(), diff --git a/core/src/main/java/app/module/core/usecase/notice/getNotices/adapters/persistence/model/GetNoticesDto.java b/core/src/main/java/app/module/core/usecase/notice/getNotices/adapters/persistence/model/GetNoticesDto.java index 7943ecb3..1ab142cb 100644 --- a/core/src/main/java/app/module/core/usecase/notice/getNotices/adapters/persistence/model/GetNoticesDto.java +++ b/core/src/main/java/app/module/core/usecase/notice/getNotices/adapters/persistence/model/GetNoticesDto.java @@ -13,6 +13,8 @@ public class GetNoticesDto { private Long id; private String updatedBy; private LocalDateTime updatedAt; + private String createdBy; + private LocalDateTime createdAt; private String title; private String content; private Boolean visible; diff --git a/core/src/main/java/app/module/core/usecase/notice/getNotices/ports/application/domain/GetNotices.java b/core/src/main/java/app/module/core/usecase/notice/getNotices/ports/application/domain/GetNotices.java index 37d7c22f..e1cbd56c 100644 --- a/core/src/main/java/app/module/core/usecase/notice/getNotices/ports/application/domain/GetNotices.java +++ b/core/src/main/java/app/module/core/usecase/notice/getNotices/ports/application/domain/GetNotices.java @@ -15,10 +15,17 @@ public class GetNotices { private Long id; private String updatedBy; private LocalDateTime updatedAt; + private String createdBy; + private LocalDateTime createdAt; private String title; private String content; private Boolean visible; private LocalDateTime startDate; private LocalDateTime endDate; private GetNoticeFiles uploadFile; + + public boolean getNewDate() { + LocalDateTime now = LocalDateTime.now(); + return now.toLocalDate().isEqual(createdAt.toLocalDate()); + } } diff --git a/core/src/main/resources/mappers/notice/GetNoticeMapper.xml b/core/src/main/resources/mappers/notice/GetNoticeMapper.xml index 01b5272c..555e7cdf 100644 --- a/core/src/main/resources/mappers/notice/GetNoticeMapper.xml +++ b/core/src/main/resources/mappers/notice/GetNoticeMapper.xml @@ -21,6 +21,17 @@ FROM notice a WHERE a.id = #{id} AND a.is_deleted = false + + + + + AND a.visible = true + + + AND a.visible = false + + + diff --git a/core/src/main/resources/mappers/notice/GetNoticesMapper.xml b/core/src/main/resources/mappers/notice/GetNoticesMapper.xml index 9dfda4ff..1751bd37 100644 --- a/core/src/main/resources/mappers/notice/GetNoticesMapper.xml +++ b/core/src/main/resources/mappers/notice/GetNoticesMapper.xml @@ -11,6 +11,8 @@ a.id, a.updated_by, a.updated_at, + a.created_by, + a.created_at, a.title, a.content, a.visible, @@ -52,6 +54,9 @@ a.end_date a.updated_by a.updated_at + a.created_by + a.created_at + a.id DESC diff --git a/front/src/main/java/app/module/front/usecase/info/GetInfoUIController.java b/front/src/main/java/app/module/front/usecase/info/GetInfoUIController.java index 105e945a..34ac1719 100644 --- a/front/src/main/java/app/module/front/usecase/info/GetInfoUIController.java +++ b/front/src/main/java/app/module/front/usecase/info/GetInfoUIController.java @@ -3,7 +3,14 @@ package app.module.front.usecase.info; import app.module.core.config.application.util.CommonUtil; import app.module.core.usecase.household.getHousehold.ports.GetHouseholdPortIn; import app.module.core.usecase.household.getHousehold.ports.application.domain.GetHouseholdCmd; +import app.module.core.usecase.notice.getNotices.ports.GetNoticesPortIn; +import app.module.core.usecase.notice.getNotices.ports.application.domain.GetNotices; +import app.module.core.usecase.notice.getNotices.ports.application.domain.GetNoticesCmd; import lombok.RequiredArgsConstructor; +import org.springframework.data.domain.Page; +import org.springframework.data.domain.Pageable; +import org.springframework.data.domain.Sort; +import org.springframework.data.web.PageableDefault; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.GetMapping; @@ -14,8 +21,24 @@ class GetInfoUIController { private final GetHouseholdPortIn getHouseholdPortIn; + private final GetNoticesPortIn getNoticesPortIn; + + @GetMapping(path = "/info") - String operate(Model model) { + String operate(Model model + ,@PageableDefault(sort = "createdAt", direction = Sort.Direction.DESC, page = 0, size = 5) Pageable pageable) { + + + //공지사항 + Page notices = + getNoticesPortIn.operate( + pageable, + new GetNoticesCmd(null, null, "true")); + model.addAttribute("notice", notices.hasContent() + ? notices.getContent().get(0) + : null); + + //TODO 일계부를 등록하지 않은 날짜 처리 필요 boolean isUnregisteredDate = false; diff --git a/front/src/main/java/app/module/front/usecase/info/notice/getNoticeUI/adapters/web/GetNoticeUIController.java b/front/src/main/java/app/module/front/usecase/info/notice/getNoticeUI/adapters/web/GetNoticeUIController.java new file mode 100644 index 00000000..c05151e5 --- /dev/null +++ b/front/src/main/java/app/module/front/usecase/info/notice/getNoticeUI/adapters/web/GetNoticeUIController.java @@ -0,0 +1,36 @@ +package app.module.front.usecase.info.notice.getNoticeUI.adapters.web; + +import app.module.core.usecase.notice.getNotice.ports.GetNoticePortIn; +import app.module.core.usecase.notice.getNotice.ports.application.domain.GetNoticeCmd; +import app.module.core.usecase.notice.getNotices.ports.GetNoticesPortIn; +import app.module.core.usecase.notice.getNotices.ports.application.domain.GetNotices; +import app.module.core.usecase.notice.getNotices.ports.application.domain.GetNoticesCmd; +import app.module.front.usecase.article.getArticles.adapters.web.model.GetArticlesReqVO; +import app.module.front.usecase.info.notice.getNoticeUI.adapters.web.model.GetNoticeUIReqVO; +import lombok.RequiredArgsConstructor; +import org.springframework.data.domain.Page; +import org.springframework.data.domain.Pageable; +import org.springframework.data.domain.Sort; +import org.springframework.data.web.PageableDefault; +import org.springframework.stereotype.Controller; +import org.springframework.ui.Model; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; + +@Controller +@RequiredArgsConstructor +class GetNoticeUIController { + + private final GetNoticePortIn getNoticePortIn; + + @GetMapping(path = "/info/notice/{id}") + String operate(@PathVariable Long id, Model model, GetNoticeUIReqVO reqVO) { + + reqVO.setId(id); + + model.addAttribute("notice", getNoticePortIn.operate( + new GetNoticeCmd( + reqVO.getId(),"true")).orElse(null)); + return "info/notice/{id}"; + } +} \ No newline at end of file diff --git a/front/src/main/java/app/module/front/usecase/info/notice/getNoticeUI/adapters/web/model/GetNoticeUIReqVO.java b/front/src/main/java/app/module/front/usecase/info/notice/getNoticeUI/adapters/web/model/GetNoticeUIReqVO.java new file mode 100644 index 00000000..76fda977 --- /dev/null +++ b/front/src/main/java/app/module/front/usecase/info/notice/getNoticeUI/adapters/web/model/GetNoticeUIReqVO.java @@ -0,0 +1,14 @@ +package app.module.front.usecase.info.notice.getNoticeUI.adapters.web.model; + +import lombok.AllArgsConstructor; +import lombok.EqualsAndHashCode; +import lombok.Getter; +import lombok.Setter; + +@Getter +@Setter +@AllArgsConstructor +@EqualsAndHashCode +public class GetNoticeUIReqVO { + private long id; +} diff --git a/front/src/main/java/app/module/front/usecase/info/notice/getNoticesUI/adapters/web/GetNoticesUIController.java b/front/src/main/java/app/module/front/usecase/info/notice/getNoticesUI/adapters/web/GetNoticesUIController.java index bea012b4..c9afa974 100644 --- a/front/src/main/java/app/module/front/usecase/info/notice/getNoticesUI/adapters/web/GetNoticesUIController.java +++ b/front/src/main/java/app/module/front/usecase/info/notice/getNoticesUI/adapters/web/GetNoticesUIController.java @@ -1,9 +1,20 @@ package app.module.front.usecase.info.notice.getNoticesUI.adapters.web; import app.module.core.config.application.util.CommonUtil; +import app.module.core.usecase.article.getArticles.ports.application.domain.GetArticles; +import app.module.core.usecase.article.getArticles.ports.application.domain.GetArticlesCmd; import app.module.core.usecase.household.getHousehold.ports.GetHouseholdPortIn; import app.module.core.usecase.household.getHousehold.ports.application.domain.GetHouseholdCmd; +import app.module.core.usecase.notice.getNotices.ports.GetNoticesPortIn; +import app.module.core.usecase.notice.getNotices.ports.application.domain.GetNotices; +import app.module.core.usecase.notice.getNotices.ports.application.domain.GetNoticesCmd; +import app.module.front.usecase.article.getArticles.adapters.web.model.GetArticlesReqVO; +import app.module.front.usecase.info.notice.getNoticesUI.adapters.web.model.GetNoticesReqVO; import lombok.RequiredArgsConstructor; +import org.springframework.data.domain.Page; +import org.springframework.data.domain.Pageable; +import org.springframework.data.domain.Sort; +import org.springframework.data.web.PageableDefault; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.GetMapping; @@ -12,13 +23,21 @@ import org.springframework.web.bind.annotation.GetMapping; @RequiredArgsConstructor class GetNoticesUIController { - private final GetHouseholdPortIn getHouseholdPortIn; + private final GetNoticesPortIn getNoticesPortIn; @GetMapping(path = "/info/notice") - String operate(Model model) { + String operate(Model model, @PageableDefault(sort = "createdAt", direction = Sort.Direction.DESC, page = 0, size = 5) Pageable pageable, GetNoticesReqVO reqVO) { + reqVO.setSearchOpen("true"); + + Page notices = + getNoticesPortIn.operate( + pageable, + new GetNoticesCmd( + reqVO.getSearchField(), reqVO.getSearchValue(), reqVO.getSearchOpen())); + + model.addAttribute("notices", notices); + - model.addAttribute("userInfo", - getHouseholdPortIn.operate(new GetHouseholdCmd(CommonUtil.getLoginUsername())).orElseThrow()); return "info/notice/notices"; } diff --git a/front/src/main/java/app/module/front/usecase/info/notice/getNoticesUI/adapters/web/model/GetNoticesReqVO.java b/front/src/main/java/app/module/front/usecase/info/notice/getNoticesUI/adapters/web/model/GetNoticesReqVO.java new file mode 100644 index 00000000..454005d4 --- /dev/null +++ b/front/src/main/java/app/module/front/usecase/info/notice/getNoticesUI/adapters/web/model/GetNoticesReqVO.java @@ -0,0 +1,17 @@ +package app.module.front.usecase.info.notice.getNoticesUI.adapters.web.model; + +import lombok.AllArgsConstructor; +import lombok.EqualsAndHashCode; +import lombok.Getter; +import lombok.Setter; + +@Getter +@Setter +@AllArgsConstructor +@EqualsAndHashCode +public class GetNoticesReqVO { + + private String searchField; + private String searchValue; + private String searchOpen; +} diff --git a/front/src/main/resources/messages/uri.properties b/front/src/main/resources/messages/uri.properties index d336efca..8d6e5f27 100644 --- a/front/src/main/resources/messages/uri.properties +++ b/front/src/main/resources/messages/uri.properties @@ -18,6 +18,7 @@ uri.front.info.user=\uAC1C\uC778\uC815\uBCF4 uri.front.info.user.path=/info/user uri.front.info.user.password=\uBE44\uBC00\uBC88\uD638 \uD655\uC778 uri.front.info.notice=\uACF5\uC9C0\uC0AC\uD56D +uri.front.info.notice.{{pathVar}}=\uACF5\uC9C0\uC0AC\uD56D uri.front.info.notice.path=/info/notice uri.front.info.monthly=\uC6D4\uBCC4 \uC784\uC0B0\uBB3C \uD604\uD669 uri.front.info.monthly.path=/info/monthly diff --git a/front/src/main/resources/templates/common/list-components.html b/front/src/main/resources/templates/common/list-components.html index 984fe525..6bd49e4d 100644 --- a/front/src/main/resources/templates/common/list-components.html +++ b/front/src/main/resources/templates/common/list-components.html @@ -35,6 +35,29 @@ + + + + diff --git a/front/src/main/resources/templates/info/main.html b/front/src/main/resources/templates/info/main.html index 4162d3e9..a13562d8 100644 --- a/front/src/main/resources/templates/info/main.html +++ b/front/src/main/resources/templates/info/main.html @@ -26,11 +26,13 @@
+ + +

공지사항

+

+
+
- -

공지사항

-

2025 임가경제조사 실시 안내

-
diff --git a/front/src/main/resources/templates/info/notice/notices.html b/front/src/main/resources/templates/info/notice/notices.html index 59e58ddd..1ae9a627 100644 --- a/front/src/main/resources/templates/info/notice/notices.html +++ b/front/src/main/resources/templates/info/notice/notices.html @@ -2,127 +2,88 @@ -
-
+
+
+
+
+
+ +
+
+

검색 분류 선택

+ +
+
+
    +
  • 제목 + 내용
  • +
  • 제목
  • +
  • 내용
  • +
+
+
+
+
+
+ + +
+
+
+
- -
-
- +
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
- - - - - - - - - - -
- - -
-
-
- -
-
+ + + + +
+
-
diff --git a/front/src/main/resources/templates/info/notice/{id}.html b/front/src/main/resources/templates/info/notice/{id}.html new file mode 100644 index 00000000..771f6cb3 --- /dev/null +++ b/front/src/main/resources/templates/info/notice/{id}.html @@ -0,0 +1,72 @@ + + + +
+
+
+
+
+
+
[[${#temporals.format(notice.createdAt, 'yyyy.MM.dd')}]] new
+
+
+

+
+ + + + +
+

첨부파일

+
    +
  • +
+
+ + + +
+
+
+
+root: /*[[|#{uri.front.info.user.path}/password|]]*/'rootUrl', +
+ + +
+ + \ No newline at end of file diff --git a/front/src/main/resources/templates/info/user/password.html b/front/src/main/resources/templates/info/user/password.html index 5a6ff1c4..459e2100 100644 --- a/front/src/main/resources/templates/info/user/password.html +++ b/front/src/main/resources/templates/info/user/password.html @@ -47,6 +47,10 @@ user: /*[[#{uri.front.info.user.path}]]*/'userUrl', }, + + + + submitted: false, };