일단 front 내정보쪽 core->front로 이관,, 하나로 합칠지는 조금 생각해보고 정리하겠음

This commit is contained in:
주우성
2025-06-16 16:24:47 +09:00
parent f31de2ba00
commit 049afa82d7
229 changed files with 1309 additions and 1098 deletions

View File

@@ -1,19 +0,0 @@
package app.module.core.usecase.household.updateFrontHousehold.adapters.persistence;
import app.module.core.config.application.annotation.UpdateCommand;
import lombok.RequiredArgsConstructor;
import app.module.core.usecase.household.updateFrontHousehold.ports.application.domain.UpdateFrontHouseholdCmd;
import app.module.core.usecase.household.updateFrontHousehold.ports.UpdateFrontHouseholdPortOut;
import org.springframework.stereotype.Repository;
@Repository
@RequiredArgsConstructor
class UpdateFrontHouseholdDao implements UpdateFrontHouseholdPortOut {
private final UpdateFrontHouseholdMapper mapper;
@Override
@UpdateCommand
public void operate(UpdateFrontHouseholdCmd cmd) {
mapper.update(cmd);
}
}

View File

@@ -1,9 +0,0 @@
package app.module.core.usecase.household.updateFrontHousehold.adapters.persistence;
import app.module.core.usecase.household.updateFrontHousehold.ports.application.domain.UpdateFrontHouseholdCmd;
import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface UpdateFrontHouseholdMapper {
void update(UpdateFrontHouseholdCmd cmd);
}

View File

@@ -1,7 +0,0 @@
package app.module.core.usecase.household.updateFrontHousehold.ports;
import app.module.core.usecase.household.updateFrontHousehold.ports.application.domain.UpdateFrontHouseholdCmd;
public interface UpdateFrontHouseholdPortIn {
void operate(UpdateFrontHouseholdCmd cmd);
}

View File

@@ -1,7 +0,0 @@
package app.module.core.usecase.household.updateFrontHousehold.ports;
import app.module.core.usecase.household.updateFrontHousehold.ports.application.domain.UpdateFrontHouseholdCmd;
public interface UpdateFrontHouseholdPortOut {
void operate(UpdateFrontHouseholdCmd cmd);
}

View File

@@ -1,16 +0,0 @@
package app.module.core.usecase.household.updateFrontHousehold.ports.application;
import app.module.core.usecase.household.updateFrontHousehold.ports.UpdateFrontHouseholdPortIn;
import app.module.core.usecase.household.updateFrontHousehold.ports.UpdateFrontHouseholdPortOut;
import app.module.core.usecase.household.updateFrontHousehold.ports.application.domain.UpdateFrontHouseholdCmd;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
@Service
@RequiredArgsConstructor
class UpdateFrontHouseholdService implements UpdateFrontHouseholdPortIn {
private final UpdateFrontHouseholdPortOut portOut;
@Override
public void operate(UpdateFrontHouseholdCmd cmd) { portOut.operate(cmd); }
}

View File

@@ -1,23 +0,0 @@
package app.module.core.usecase.household.updateFrontHousehold.ports.application.domain;
import app.module.core.config.adapters.persistence.component.AuditCommand;
import app.module.core.config.application.util.CommonUtil;
import java.time.LocalDateTime;
import lombok.AllArgsConstructor;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.Setter;
@Getter
@Setter
@AllArgsConstructor
public class UpdateFrontHouseholdCmd extends AuditCommand {
private Long seq;
private String ownerName;
private Integer ownerAge;
private String tel;
private String phone;
private String regionMainCode;
private String regionSubCode;
private String address;
}

View File

@@ -1,29 +0,0 @@
package app.module.core.usecase.monthly.getMonthlyInputStatus.adapters.persistence;
import app.module.core.usecase.monthly.getMonthlyInputStatus.ports.GetMonthlyInputStatusPortOut;
import app.module.core.usecase.monthly.getMonthlyInputStatus.ports.application.domain.GetMonthlyInputStatus;
import app.module.core.usecase.monthly.getMonthlyInputStatus.ports.application.domain.GetMonthlyInputStatusCmd;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;
import java.util.Optional;
@Repository
@RequiredArgsConstructor
class GetMonthlyInputStatusDao implements GetMonthlyInputStatusPortOut {
private final GetMonthlyInputStatusMapper mapper;
@Override
public Optional<GetMonthlyInputStatus> operate(GetMonthlyInputStatusCmd command) {
GetMonthlyInputStatus secArticle = mapper.getMonthlyInputStatus(command);
return Optional.of(secArticle);
}
}

View File

@@ -1,13 +0,0 @@
package app.module.core.usecase.monthly.getMonthlyInputStatus.adapters.persistence;
import app.module.core.usecase.monthly.getMonthlyInputStatus.ports.application.domain.GetMonthlyInputStatus;
import app.module.core.usecase.monthly.getMonthlyInputStatus.ports.application.domain.GetMonthlyInputStatusCmd;
import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface GetMonthlyInputStatusMapper {
GetMonthlyInputStatus getMonthlyInputStatus(GetMonthlyInputStatusCmd command);
}

View File

@@ -1,12 +0,0 @@
package app.module.core.usecase.monthly.getMonthlyInputStatus.ports;
import app.module.core.usecase.monthly.getMonthlyInputStatus.ports.application.domain.GetMonthlyInputStatus;
import app.module.core.usecase.monthly.getMonthlyInputStatus.ports.application.domain.GetMonthlyInputStatusCmd;
import java.util.Optional;
public interface GetMonthlyInputStatusPortIn {
Optional<GetMonthlyInputStatus> operate(GetMonthlyInputStatusCmd command);
}

View File

@@ -1,12 +0,0 @@
package app.module.core.usecase.monthly.getMonthlyInputStatus.ports;
import app.module.core.usecase.monthly.getMonthlyInputStatus.ports.application.domain.GetMonthlyInputStatus;
import app.module.core.usecase.monthly.getMonthlyInputStatus.ports.application.domain.GetMonthlyInputStatusCmd;
import java.util.Optional;
public interface GetMonthlyInputStatusPortOut {
Optional<GetMonthlyInputStatus> operate(GetMonthlyInputStatusCmd command);
}

View File

@@ -1,22 +0,0 @@
package app.module.core.usecase.monthly.getMonthlyInputStatus.ports.application;
import app.module.core.usecase.monthly.getMonthlyInputStatus.ports.GetMonthlyInputStatusPortIn;
import app.module.core.usecase.monthly.getMonthlyInputStatus.ports.GetMonthlyInputStatusPortOut;
import app.module.core.usecase.monthly.getMonthlyInputStatus.ports.application.domain.GetMonthlyInputStatus;
import app.module.core.usecase.monthly.getMonthlyInputStatus.ports.application.domain.GetMonthlyInputStatusCmd;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
import java.util.Optional;
@Service
@RequiredArgsConstructor
class GetMonthlyInputStatusService implements GetMonthlyInputStatusPortIn {
private final GetMonthlyInputStatusPortOut portOut;
@Override
public Optional<GetMonthlyInputStatus> operate(GetMonthlyInputStatusCmd command) {
return portOut.operate(command);
}
}

View File

@@ -1,35 +0,0 @@
package app.module.core.usecase.monthly.getMonthlyInputStatus.ports.application.domain;
import app.module.core.config.application.enums.MonthStatus;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import java.time.LocalDateTime;
@Getter
@Setter
@NoArgsConstructor
@EqualsAndHashCode
public class GetMonthlyInputStatus {
private Long id;
private Long householdSeq;
private String month;
private MonthStatus forestProductStatus;
private MonthStatus bankAutoTransferInputStatus;
private MonthStatus bankAutoTransferOutputStatus;
private LocalDateTime createdAt;
private String createdBy;
private LocalDateTime updatedAt;
private String updatedBy;
public String getKoreanMonth() {
if (month != null && month.contains("-")) {
String[] parts = month.split("-");
return parts[0] + "년 " + Integer.parseInt(parts[1]) + "월";
}
return "";
}
}

View File

@@ -1,15 +0,0 @@
package app.module.core.usecase.monthly.getMonthlyInputStatus.ports.application.domain;
import lombok.AllArgsConstructor;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.Setter;
@Getter
@Setter
@AllArgsConstructor
@EqualsAndHashCode
public class GetMonthlyInputStatusCmd {
private Long id;
private Long householdSeq;
}

View File

@@ -1,111 +0,0 @@
package app.module.core.usecase.monthly.getMonthlyInputStatuss.adapters.persistence;
import app.module.core.usecase.monthly.getMonthlyInputStatuss.adapters.persistence.model.GetMonthlyInputStatussDto;
import app.module.core.usecase.monthly.getMonthlyInputStatuss.ports.GetMonthlyInputStatussPortOut;
import app.module.core.usecase.monthly.getMonthlyInputStatuss.ports.application.domain.GetMonthlyInputStatuss;
import app.module.core.usecase.monthly.getMonthlyInputStatuss.ports.application.domain.GetMonthlyInputStatussCmd;
import lombok.RequiredArgsConstructor;
import org.apache.commons.collections4.ListUtils;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageImpl;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
import java.util.stream.Collectors;
@Repository
@RequiredArgsConstructor
class GetMonthlyInputStatussDao implements GetMonthlyInputStatussPortOut {
private final GetMonthlyInputStatussMapper mapper;
@Override
@Transactional
public Page<GetMonthlyInputStatuss> operate(Pageable pageable, GetMonthlyInputStatussCmd command) {
// 게시물 목록 얻기
List<GetMonthlyInputStatussDto> contents =
ListUtils.emptyIfNull(mapper.getMonthlyInputStatuss(pageable, command));
return new PageImpl<>(
contents.stream()
.map(
article ->
new GetMonthlyInputStatuss(
article.getId(),
article.getHouseholdSeq(),
article.getMonth(),
article.getForestProductStatus(),
article.getBankAutoTransferInputStatus(),
article.getBankAutoTransferOutputStatus(),
article.getCreatedAt(),
article.getCreatedBy(),
article.getUpdatedAt(),
article.getUpdatedBy()
))
.collect(Collectors.toList()),
pageable,
contents.isEmpty() ? 0 : contents.get(0).getTotal());
}
@Override
@Transactional
public List<GetMonthlyInputStatuss> operateList(GetMonthlyInputStatussCmd command) {
/*// 검색조건 초기화
Specification<Article> spec = (root, query, criteriaBuilder) -> null;
// 검색어 - like 검색
if (!StringUtils.isEmpty(command.getSearchField())) {
spec =
spec.and(
(root, query, builder) ->
builder.like(
root.get(command.getSearchField()),
"%" + command.getSearchValue() + "%"));
}
// 공개여부 검색
if (!StringUtils.isEmpty(command.getSearchOpen())) {
spec =
spec.and(
((root, query, criteriaBuilder) ->
criteriaBuilder.equal(
root.get("visible"), Boolean.valueOf(command.getSearchOpen()))));
}
List<Article> result = getArticlesRepo.findAll(spec);
return result.stream()
.map(
article ->
new GetArticles(
article.getId(),
article.getUpdatedBy(),
article.getUpdatedAt(),
article.getTitle(),
article.getContent(),
article.getVisible(),
article.getStartDate(),
article.getEndDate(),
article.getOrderNo(),
article.getUploadFiles().stream()
// 목록에 보여줄 대표이미지만 담는다
.filter(
uploadFile -> uploadFile.getType()
.equals(FileUploadType.EXAMPLE_REP))
.map(
uploadFile ->
new GetArticleFiles(
uploadFile.getId(),
uploadFile.getType(),
uploadFile.getPath(),
uploadFile.getName(),
uploadFile.getOriginName(),
uploadFile.getFileLength()))
.findFirst()
.orElse(null)))
.collect(Collectors.toList());*/
return null;
}
}

View File

@@ -1,16 +0,0 @@
package app.module.core.usecase.monthly.getMonthlyInputStatuss.adapters.persistence;
import app.module.core.usecase.monthly.getMonthlyInputStatuss.adapters.persistence.model.GetMonthlyInputStatussDto;
import app.module.core.usecase.monthly.getMonthlyInputStatuss.ports.application.domain.GetMonthlyInputStatussCmd;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.data.domain.Pageable;
import java.util.List;
@Mapper
public interface GetMonthlyInputStatussMapper {
List<GetMonthlyInputStatussDto> getMonthlyInputStatuss(
@Param("pageable") Pageable pageable, @Param("cmd") GetMonthlyInputStatussCmd cmd);
}

View File

@@ -1,28 +0,0 @@
package app.module.core.usecase.monthly.getMonthlyInputStatuss.adapters.persistence.model;
import app.module.core.config.application.enums.MonthStatus;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.Setter;
import java.time.LocalDateTime;
@Getter
@Setter
@AllArgsConstructor
public class GetMonthlyInputStatussDto {
private Long id;
private Long householdSeq;
private String month;
private MonthStatus forestProductStatus;
private MonthStatus bankAutoTransferInputStatus;
private MonthStatus bankAutoTransferOutputStatus;
private LocalDateTime createdAt;
private String createdBy;
private LocalDateTime updatedAt;
private String updatedBy;
private Long total;
}

View File

@@ -1,15 +0,0 @@
package app.module.core.usecase.monthly.getMonthlyInputStatuss.ports;
import app.module.core.usecase.monthly.getMonthlyInputStatuss.ports.application.domain.GetMonthlyInputStatuss;
import app.module.core.usecase.monthly.getMonthlyInputStatuss.ports.application.domain.GetMonthlyInputStatussCmd;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import java.util.List;
public interface GetMonthlyInputStatussPortIn {
Page<GetMonthlyInputStatuss> operate(Pageable pageable, GetMonthlyInputStatussCmd command);
List<GetMonthlyInputStatuss> operateList(GetMonthlyInputStatussCmd command);
}

View File

@@ -1,15 +0,0 @@
package app.module.core.usecase.monthly.getMonthlyInputStatuss.ports;
import app.module.core.usecase.monthly.getMonthlyInputStatuss.ports.application.domain.GetMonthlyInputStatuss;
import app.module.core.usecase.monthly.getMonthlyInputStatuss.ports.application.domain.GetMonthlyInputStatussCmd;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import java.util.List;
public interface GetMonthlyInputStatussPortOut {
Page<GetMonthlyInputStatuss> operate(Pageable pageable, GetMonthlyInputStatussCmd command);
List<GetMonthlyInputStatuss> operateList(GetMonthlyInputStatussCmd command);
}

View File

@@ -1,29 +0,0 @@
package app.module.core.usecase.monthly.getMonthlyInputStatuss.ports.application;
import app.module.core.usecase.monthly.getMonthlyInputStatuss.ports.GetMonthlyInputStatussPortIn;
import app.module.core.usecase.monthly.getMonthlyInputStatuss.ports.GetMonthlyInputStatussPortOut;
import app.module.core.usecase.monthly.getMonthlyInputStatuss.ports.application.domain.GetMonthlyInputStatuss;
import app.module.core.usecase.monthly.getMonthlyInputStatuss.ports.application.domain.GetMonthlyInputStatussCmd;
import lombok.RequiredArgsConstructor;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;
import java.util.List;
@Service
@RequiredArgsConstructor
class GetMonthlyInputStatussService implements GetMonthlyInputStatussPortIn {
private final GetMonthlyInputStatussPortOut portOut;
@Override
public Page<GetMonthlyInputStatuss> operate(Pageable pageable, GetMonthlyInputStatussCmd command) {
return portOut.operate(pageable, command);
}
@Override
public List<GetMonthlyInputStatuss> operateList(GetMonthlyInputStatussCmd command) {
return portOut.operateList(command);
}
}

View File

@@ -1,37 +0,0 @@
package app.module.core.usecase.monthly.getMonthlyInputStatuss.ports.application.domain;
import app.module.core.config.application.enums.MonthStatus;
import lombok.AllArgsConstructor;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.Setter;
import java.time.LocalDateTime;
@Getter
@Setter
@AllArgsConstructor
@EqualsAndHashCode
public class GetMonthlyInputStatuss {
private Long id;
private Long householdSeq;
private String month;
private MonthStatus forestProductStatus;
private MonthStatus bankAutoTransferInputStatus;
private MonthStatus bankAutoTransferOutputStatus;
private LocalDateTime createdAt;
private String createdBy;
private LocalDateTime updatedAt;
private String updatedBy;
public String getKoreanMonth() {
if (month != null && month.contains("-")) {
String[] parts = month.split("-");
return parts[0] + "년 " + Integer.parseInt(parts[1]) + "월";
}
return "";
}
}

View File

@@ -1,17 +0,0 @@
package app.module.core.usecase.monthly.getMonthlyInputStatuss.ports.application.domain;
import lombok.AllArgsConstructor;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.Setter;
@Getter
@Setter
@AllArgsConstructor
@EqualsAndHashCode
public class GetMonthlyInputStatussCmd {
private String searchField;
private String searchValue;
private Long householdSeq;
}

View File

@@ -1,28 +0,0 @@
package app.module.core.usecase.monthly.getPrevMonthlyInputStatus.adapters.persistence;
import app.module.core.usecase.monthly.getPrevMonthlyInputStatus.ports.GetPrevMonthlyInputStatusPortOut;
import app.module.core.usecase.monthly.getPrevMonthlyInputStatus.ports.application.domain.GetPrevMonthlyInputStatus;
import app.module.core.usecase.monthly.getPrevMonthlyInputStatus.ports.application.domain.GetPrevMonthlyInputStatusCmd;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Repository;
import java.util.Optional;
@Repository
@RequiredArgsConstructor
class GetPrevMonthlyInputStatusDao implements GetPrevMonthlyInputStatusPortOut {
private final GetPrevMonthlyInputStatusMapper mapper;
@Override
public Optional<GetPrevMonthlyInputStatus> operate(GetPrevMonthlyInputStatusCmd command) {
GetPrevMonthlyInputStatus secArticle = mapper.getPrevMonthlyInputStatus(command);
return Optional.ofNullable(secArticle);
}
}

View File

@@ -1,13 +0,0 @@
package app.module.core.usecase.monthly.getPrevMonthlyInputStatus.adapters.persistence;
import app.module.core.usecase.monthly.getPrevMonthlyInputStatus.ports.application.domain.GetPrevMonthlyInputStatus;
import app.module.core.usecase.monthly.getPrevMonthlyInputStatus.ports.application.domain.GetPrevMonthlyInputStatusCmd;
import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface GetPrevMonthlyInputStatusMapper {
GetPrevMonthlyInputStatus getPrevMonthlyInputStatus(GetPrevMonthlyInputStatusCmd command);
}

View File

@@ -1,12 +0,0 @@
package app.module.core.usecase.monthly.getPrevMonthlyInputStatus.ports;
import app.module.core.usecase.monthly.getPrevMonthlyInputStatus.ports.application.domain.GetPrevMonthlyInputStatus;
import app.module.core.usecase.monthly.getPrevMonthlyInputStatus.ports.application.domain.GetPrevMonthlyInputStatusCmd;
import java.util.Optional;
public interface GetPrevMonthlyInputStatusPortIn {
Optional<GetPrevMonthlyInputStatus> operate(GetPrevMonthlyInputStatusCmd command);
}

View File

@@ -1,12 +0,0 @@
package app.module.core.usecase.monthly.getPrevMonthlyInputStatus.ports;
import app.module.core.usecase.monthly.getPrevMonthlyInputStatus.ports.application.domain.GetPrevMonthlyInputStatus;
import app.module.core.usecase.monthly.getPrevMonthlyInputStatus.ports.application.domain.GetPrevMonthlyInputStatusCmd;
import java.util.Optional;
public interface GetPrevMonthlyInputStatusPortOut {
Optional<GetPrevMonthlyInputStatus> operate(GetPrevMonthlyInputStatusCmd command);
}

View File

@@ -1,22 +0,0 @@
package app.module.core.usecase.monthly.getPrevMonthlyInputStatus.ports.application;
import app.module.core.usecase.monthly.getPrevMonthlyInputStatus.ports.GetPrevMonthlyInputStatusPortIn;
import app.module.core.usecase.monthly.getPrevMonthlyInputStatus.ports.GetPrevMonthlyInputStatusPortOut;
import app.module.core.usecase.monthly.getPrevMonthlyInputStatus.ports.application.domain.GetPrevMonthlyInputStatus;
import app.module.core.usecase.monthly.getPrevMonthlyInputStatus.ports.application.domain.GetPrevMonthlyInputStatusCmd;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
import java.util.Optional;
@Service
@RequiredArgsConstructor
class GetPrevMonthlyInputStatusService implements GetPrevMonthlyInputStatusPortIn {
private final GetPrevMonthlyInputStatusPortOut portOut;
@Override
public Optional<GetPrevMonthlyInputStatus> operate(GetPrevMonthlyInputStatusCmd command) {
return portOut.operate(command);
}
}

View File

@@ -1,27 +0,0 @@
package app.module.core.usecase.monthly.getPrevMonthlyInputStatus.ports.application.domain;
import app.module.core.config.application.enums.MonthStatus;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import java.time.LocalDateTime;
@Getter
@Setter
@NoArgsConstructor
@EqualsAndHashCode
public class GetPrevMonthlyInputStatus {
private Long id;
private Long householdSeq;
private String month;
private MonthStatus forestProductStatus;
private MonthStatus bankAutoTransferInputStatus;
private MonthStatus bankAutoTransferOutputStatus;
private LocalDateTime createdAt;
private String createdBy;
private LocalDateTime updatedAt;
private String updatedBy;
}

View File

@@ -1,15 +0,0 @@
package app.module.core.usecase.monthly.getPrevMonthlyInputStatus.ports.application.domain;
import lombok.AllArgsConstructor;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.Setter;
@Getter
@Setter
@AllArgsConstructor
@EqualsAndHashCode
public class GetPrevMonthlyInputStatusCmd {
private Long id;
private Long householdSeq;
}

View File

@@ -1,33 +0,0 @@
package app.module.core.usecase.monthly.updateMonthlyInputStatus.adapters.persistence;
import app.module.core.config.application.util.CommonUtil;
import app.module.core.usecase.monthly.updateMonthlyInputStatus.adapters.persistence.model.UpdateMonthlyInputStatusDto;
import app.module.core.usecase.monthly.updateMonthlyInputStatus.ports.UpdateMonthlyInputStatusPortOut;
import app.module.core.usecase.monthly.updateMonthlyInputStatus.ports.application.domain.UpdateMonthlyInputStatusCmd;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Repository;
import java.time.LocalDateTime;
@Repository
@RequiredArgsConstructor
class UpdateMonthlyInputStatusDao implements UpdateMonthlyInputStatusPortOut {
private final UpdateMonthlyInputStatusMapper mapper;
@Override
public void operate(UpdateMonthlyInputStatusCmd command) {
mapper.updateMonthlyInputStatus(
new UpdateMonthlyInputStatusDto(
command.getId(),
command.getHouseholdSeq(),
command.getMonth(),
command.getForestProductStatus(),
command.getBankAutoTransferInputStatus(),
command.getBankAutoTransferOutputStatus(),
LocalDateTime.now(),
CommonUtil.getLoginUsername()
));
}
}

View File

@@ -1,9 +0,0 @@
package app.module.core.usecase.monthly.updateMonthlyInputStatus.adapters.persistence;
import app.module.core.usecase.monthly.updateMonthlyInputStatus.adapters.persistence.model.UpdateMonthlyInputStatusDto;
import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface UpdateMonthlyInputStatusMapper {
void updateMonthlyInputStatus(UpdateMonthlyInputStatusDto dto);
}

View File

@@ -1,26 +0,0 @@
package app.module.core.usecase.monthly.updateMonthlyInputStatus.adapters.persistence.model;
import app.module.core.config.application.enums.MonthStatus;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import java.time.LocalDateTime;
@Getter
@Setter
@NoArgsConstructor
@AllArgsConstructor
public class UpdateMonthlyInputStatusDto {
private Long id;
private Long householdSeq;
private String month;
private MonthStatus forestProductStatus;
private MonthStatus bankAutoTransferInputStatus;
private MonthStatus bankAutoTransferOutputStatus;
private LocalDateTime updatedAt;
private String updatedBy;
}

View File

@@ -1,8 +0,0 @@
package app.module.core.usecase.monthly.updateMonthlyInputStatus.ports;
import app.module.core.usecase.monthly.updateMonthlyInputStatus.ports.application.domain.UpdateMonthlyInputStatusCmd;
public interface UpdateMonthlyInputStatusPortIn {
void operate(UpdateMonthlyInputStatusCmd command);
}

View File

@@ -1,8 +0,0 @@
package app.module.core.usecase.monthly.updateMonthlyInputStatus.ports;
import app.module.core.usecase.monthly.updateMonthlyInputStatus.ports.application.domain.UpdateMonthlyInputStatusCmd;
public interface UpdateMonthlyInputStatusPortOut {
void operate(UpdateMonthlyInputStatusCmd command);
}

View File

@@ -1,19 +0,0 @@
package app.module.core.usecase.monthly.updateMonthlyInputStatus.ports.application;
import app.module.core.usecase.monthly.updateMonthlyInputStatus.ports.UpdateMonthlyInputStatusPortIn;
import app.module.core.usecase.monthly.updateMonthlyInputStatus.ports.UpdateMonthlyInputStatusPortOut;
import app.module.core.usecase.monthly.updateMonthlyInputStatus.ports.application.domain.UpdateMonthlyInputStatusCmd;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
@Service
@RequiredArgsConstructor
class UpdateMonthlyInputStatusService implements UpdateMonthlyInputStatusPortIn {
private final UpdateMonthlyInputStatusPortOut portOut;
@Override
public void operate(UpdateMonthlyInputStatusCmd command) {
portOut.operate(command);
}
}

View File

@@ -1,23 +0,0 @@
package app.module.core.usecase.monthly.updateMonthlyInputStatus.ports.application.domain;
import app.module.core.config.application.enums.MonthStatus;
import lombok.AllArgsConstructor;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.Setter;
@Getter
@Setter
@AllArgsConstructor
@EqualsAndHashCode
public class UpdateMonthlyInputStatusCmd {
private Long id;
private Long householdSeq;
private String month;
private MonthStatus forestProductStatus;
private MonthStatus bankAutoTransferInputStatus;
private MonthStatus bankAutoTransferOutputStatus;
}

View File

@@ -1,57 +0,0 @@
package app.module.core.usecase.notice.createNotice.adapters.persistence;
import app.module.core.usecase.notice.createNotice.adapters.persistence.model.CreateNoticeDto;
import app.module.core.usecase.notice.createNotice.adapters.persistence.model.CreateNoticeHasUploadFilesParam;
import app.module.core.usecase.notice.createNotice.ports.CreateNoticePortOut;
import app.module.core.usecase.notice.createNotice.ports.application.domain.CreateNotice;
import app.module.core.usecase.notice.createNotice.ports.application.domain.CreateNoticeCmd;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;
import java.util.Optional;
import java.util.stream.Collectors;
@Repository
@RequiredArgsConstructor
class CreateNoticeDao implements CreateNoticePortOut {
private final CreateNoticeMapper mapper;
@Override
@Transactional
public Optional<CreateNotice> operate(CreateNoticeCmd command) {
CreateNoticeDto dto =
new CreateNoticeDto(
null,
command.getTitle(),
command.getContent(),
command.getVisible(),
command.getStartDate(),
command.getEndDate(),
command.getFileMappingId(),
command.getCreatedAt(),
command.getCreatedBy(),
command.getUpdatedAt(),
command.getUpdatedBy());
mapper.createNotice(dto);
if (dto.getFileMappingId() != null && !dto.getFileMappingId().isEmpty()) {
mapper.createNoticeHasUploadFile(new CreateNoticeHasUploadFilesParam(
dto.getId(),
dto.getFileMappingId().stream()
.map(Long::parseLong)
.collect(Collectors.toList()),
dto.getCreatedAt(),
dto.getCreatedBy(),
dto.getUpdatedAt(),
dto.getUpdatedBy()
));
}
return Optional.of(new CreateNotice(dto.getId()));
}
}

View File

@@ -1,11 +0,0 @@
package app.module.core.usecase.notice.createNotice.adapters.persistence;
import app.module.core.usecase.notice.createNotice.adapters.persistence.model.CreateNoticeDto;
import app.module.core.usecase.notice.createNotice.adapters.persistence.model.CreateNoticeHasUploadFilesParam;
import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface CreateNoticeMapper {
void createNotice(CreateNoticeDto dto);
void createNoticeHasUploadFile(CreateNoticeHasUploadFilesParam param);
}

View File

@@ -1,27 +0,0 @@
package app.module.core.usecase.notice.createNotice.adapters.persistence.model;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import java.time.LocalDateTime;
import java.util.List;
@Getter
@Setter
@NoArgsConstructor
@AllArgsConstructor
public class CreateNoticeDto {
private Long id;
private String title;
private String content;
private Boolean visible;
private LocalDateTime startDate;
private LocalDateTime endDate;
private List<String> fileMappingId;
private LocalDateTime createdAt;
private String createdBy;
private LocalDateTime updatedAt;
private String updatedBy;
}

View File

@@ -1,22 +0,0 @@
package app.module.core.usecase.notice.createNotice.adapters.persistence.model;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import java.time.LocalDateTime;
import java.util.List;
@Getter
@Setter
@NoArgsConstructor
@AllArgsConstructor
public class CreateNoticeHasUploadFilesParam {
private Long id;
private List<Long> fileMappingIds;
private LocalDateTime createdAt;
private String createdBy;
private LocalDateTime updatedAt;
private String updatedBy;
}

View File

@@ -1,11 +0,0 @@
package app.module.core.usecase.notice.createNotice.ports;
import app.module.core.usecase.notice.createNotice.ports.application.domain.CreateNotice;
import app.module.core.usecase.notice.createNotice.ports.application.domain.CreateNoticeCmd;
import java.util.Optional;
public interface CreateNoticePortIn {
Optional<CreateNotice> operate(CreateNoticeCmd command);
}

View File

@@ -1,11 +0,0 @@
package app.module.core.usecase.notice.createNotice.ports;
import app.module.core.usecase.notice.createNotice.ports.application.domain.CreateNotice;
import app.module.core.usecase.notice.createNotice.ports.application.domain.CreateNoticeCmd;
import java.util.Optional;
public interface CreateNoticePortOut {
Optional<CreateNotice> operate(CreateNoticeCmd command);
}

View File

@@ -1,24 +0,0 @@
package app.module.core.usecase.notice.createNotice.ports.application;
import app.module.core.config.application.annotation.CreateCommand;
import app.module.core.usecase.notice.createNotice.ports.CreateNoticePortIn;
import app.module.core.usecase.notice.createNotice.ports.CreateNoticePortOut;
import app.module.core.usecase.notice.createNotice.ports.application.domain.CreateNotice;
import app.module.core.usecase.notice.createNotice.ports.application.domain.CreateNoticeCmd;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
import java.util.Optional;
@Service
@RequiredArgsConstructor
class CreateNoticeService implements CreateNoticePortIn {
private final CreateNoticePortOut portOut;
@Override
@CreateCommand
public Optional<CreateNotice> operate(CreateNoticeCmd command) {
return portOut.operate(command);
}
}

View File

@@ -1,14 +0,0 @@
package app.module.core.usecase.notice.createNotice.ports.application.domain;
import lombok.AllArgsConstructor;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.Setter;
@Getter
@Setter
@AllArgsConstructor
@EqualsAndHashCode
public class CreateNotice {
private Long id;
}

View File

@@ -1,23 +0,0 @@
package app.module.core.usecase.notice.createNotice.ports.application.domain;
import app.module.core.config.adapters.persistence.component.AuditCommand;
import lombok.AllArgsConstructor;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.Setter;
import java.time.LocalDateTime;
import java.util.List;
@Getter
@Setter
@AllArgsConstructor
@EqualsAndHashCode
public class CreateNoticeCmd extends AuditCommand {
private String title;
private String content;
private Boolean visible;
private LocalDateTime startDate;
private LocalDateTime endDate;
private List<String> fileMappingId;
}

View File

@@ -1,52 +0,0 @@
package app.module.core.usecase.notice.getNotice.adapters.persistence;
import app.module.core.usecase.file.url.application.port.in.FileUrlPortIn;
import app.module.core.usecase.notice.getNotice.ports.GetNoticePortOut;
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 lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
import java.util.Optional;
import java.util.stream.Collectors;
@Repository
@RequiredArgsConstructor
class GetNoticeDao implements GetNoticePortOut {
private final GetNoticeMapper mapper;
private final FileUrlPortIn fileUrlPortIn;
@Override
@Transactional
public Optional<GetNotice> operate(GetNoticeCmd command) {
GetNotice secArticle = mapper.getNotice(command);
List<GetNoticeUploadFile> setArticleUploadFile =
mapper.getUploadFiles(command.getId());
secArticle.setUploadFiles(
setArticleUploadFile.stream()
.map(
uploadFile -> {
// 참조 URL 전달
uploadFile.setReferURL(
fileUrlPortIn.getInline(
uploadFile.getType().getFileStorageType(),
uploadFile.getPath(),
uploadFile.getName()));
// attachment URL 전달
uploadFile.setAttachmentURL(
fileUrlPortIn.getAttachment(
uploadFile.getType().getFileStorageType(), uploadFile.getId()));
return uploadFile;
})
.collect(Collectors.toList()));
return Optional.of(secArticle);
}
}

View File

@@ -1,16 +0,0 @@
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;
import java.util.List;
@Mapper
public interface GetNoticeMapper {
GetNotice getNotice(GetNoticeCmd command);
List<GetNoticeUploadFile> getUploadFiles(Long id);
}

View File

@@ -1,11 +0,0 @@
package app.module.core.usecase.notice.getNotice.ports;
import app.module.core.usecase.notice.getNotice.ports.application.domain.GetNotice;
import app.module.core.usecase.notice.getNotice.ports.application.domain.GetNoticeCmd;
import java.util.Optional;
public interface GetNoticePortIn {
Optional<GetNotice> operate(GetNoticeCmd command);
}

View File

@@ -1,11 +0,0 @@
package app.module.core.usecase.notice.getNotice.ports;
import app.module.core.usecase.notice.getNotice.ports.application.domain.GetNotice;
import app.module.core.usecase.notice.getNotice.ports.application.domain.GetNoticeCmd;
import java.util.Optional;
public interface GetNoticePortOut {
Optional<GetNotice> operate(GetNoticeCmd command);
}

View File

@@ -1,22 +0,0 @@
package app.module.core.usecase.notice.getNotice.ports.application;
import app.module.core.usecase.notice.getNotice.ports.GetNoticePortIn;
import app.module.core.usecase.notice.getNotice.ports.GetNoticePortOut;
import app.module.core.usecase.notice.getNotice.ports.application.domain.GetNotice;
import app.module.core.usecase.notice.getNotice.ports.application.domain.GetNoticeCmd;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
import java.util.Optional;
@Service
@RequiredArgsConstructor
class GetNoticeService implements GetNoticePortIn {
private final GetNoticePortOut portOut;
@Override
public Optional<GetNotice> operate(GetNoticeCmd command) {
return portOut.operate(command);
}
}

View File

@@ -1,31 +0,0 @@
package app.module.core.usecase.notice.getNotice.ports.application.domain;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import java.time.LocalDateTime;
import java.util.List;
@Getter
@Setter
@NoArgsConstructor
@EqualsAndHashCode
public class GetNotice {
private Long id;
private String title;
private String content;
private Boolean visible;
private LocalDateTime startDate;
private LocalDateTime endDate;
private LocalDateTime createdAt;
private String createdBy;
private LocalDateTime updatedAt;
private String updatedBy;
private List<GetNoticeUploadFile> uploadFiles;
public boolean getNewDate() {
LocalDateTime now = LocalDateTime.now();
return now.toLocalDate().isEqual(createdAt.toLocalDate());
}
}

View File

@@ -1,15 +0,0 @@
package app.module.core.usecase.notice.getNotice.ports.application.domain;
import lombok.AllArgsConstructor;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.Setter;
@Getter
@Setter
@AllArgsConstructor
@EqualsAndHashCode
public class GetNoticeCmd {
private Long id;
private String searchOpen;
}

View File

@@ -1,31 +0,0 @@
package app.module.core.usecase.notice.getNotice.ports.application.domain;
import app.module.core.config.application.enums.FileUploadType;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serializable;
import java.time.LocalDateTime;
/**
* DTO for {@link app.module.core.config.adapters.persistence.entity.UploadFile}
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
public class GetNoticeUploadFile implements Serializable {
private LocalDateTime createdAt;
private String createdBy;
private LocalDateTime updatedAt;
private String updatedBy;
private Long id;
private FileUploadType type;
private String path;
private String name;
private String originName;
private Long fileLength;
private String referURL;
private String attachmentURL;
}

View File

@@ -1,127 +0,0 @@
package app.module.core.usecase.notice.getNotices.adapters.persistence;
import app.module.core.config.application.enums.FileUploadType;
import app.module.core.usecase.notice.getNotices.adapters.persistence.model.GetNoticesDto;
import app.module.core.usecase.notice.getNotices.ports.GetNoticesPortOut;
import app.module.core.usecase.notice.getNotices.ports.application.domain.GetNoticeFiles;
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.apache.commons.collections4.ListUtils;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageImpl;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;
import java.util.Collections;
import java.util.List;
import java.util.stream.Collectors;
@Repository
@RequiredArgsConstructor
class GetNoticesDao implements GetNoticesPortOut {
private final GetNoticesMapper mapper;
@Override
@Transactional
public Page<GetNotices> operate(Pageable pageable, GetNoticesCmd command) {
// 게시물 목록 얻기
List<GetNoticesDto> contents =
ListUtils.emptyIfNull(mapper.getNotices(pageable, command));
// 대표 이미지 목록 얻기
List<GetNoticeFiles> uploadFiles =
contents.isEmpty()
? Collections.emptyList()
: ListUtils.emptyIfNull(
mapper.getUploadFiles(
contents.stream().map(GetNoticesDto::getId)
.collect(Collectors.toList()),
FileUploadType.NOTICE));
return new PageImpl<>(
contents.stream()
.map(
article ->
new GetNotices(
article.getId(),
article.getUpdatedBy(),
article.getUpdatedAt(),
article.getCreatedBy(),
article.getCreatedAt(),
article.getTitle(),
article.getContent(),
article.getVisible(),
article.getStartDate(),
article.getEndDate(),
uploadFiles.stream()
.filter(file -> file.getNoticeId().equals(article.getId()))
.findFirst()
.orElse(null)))
.collect(Collectors.toList()),
pageable,
contents.isEmpty() ? 0 : contents.get(0).getTotal());
}
@Override
@Transactional
public List<GetNotices> operateList(GetNoticesCmd command) {
/*// 검색조건 초기화
Specification<Article> spec = (root, query, criteriaBuilder) -> null;
// 검색어 - like 검색
if (!StringUtils.isEmpty(command.getSearchField())) {
spec =
spec.and(
(root, query, builder) ->
builder.like(
root.get(command.getSearchField()),
"%" + command.getSearchValue() + "%"));
}
// 공개여부 검색
if (!StringUtils.isEmpty(command.getSearchOpen())) {
spec =
spec.and(
((root, query, criteriaBuilder) ->
criteriaBuilder.equal(
root.get("visible"), Boolean.valueOf(command.getSearchOpen()))));
}
List<Article> result = getArticlesRepo.findAll(spec);
return result.stream()
.map(
article ->
new GetArticles(
article.getId(),
article.getUpdatedBy(),
article.getUpdatedAt(),
article.getTitle(),
article.getContent(),
article.getVisible(),
article.getStartDate(),
article.getEndDate(),
article.getOrderNo(),
article.getUploadFiles().stream()
// 목록에 보여줄 대표이미지만 담는다
.filter(
uploadFile -> uploadFile.getType()
.equals(FileUploadType.EXAMPLE_REP))
.map(
uploadFile ->
new GetArticleFiles(
uploadFile.getId(),
uploadFile.getType(),
uploadFile.getPath(),
uploadFile.getName(),
uploadFile.getOriginName(),
uploadFile.getFileLength()))
.findFirst()
.orElse(null)))
.collect(Collectors.toList());*/
return null;
}
}

View File

@@ -1,19 +0,0 @@
package app.module.core.usecase.notice.getNotices.adapters.persistence;
import app.module.core.config.application.enums.FileUploadType;
import app.module.core.usecase.notice.getNotices.adapters.persistence.model.GetNoticesDto;
import app.module.core.usecase.notice.getNotices.ports.application.domain.GetNoticeFiles;
import app.module.core.usecase.notice.getNotices.ports.application.domain.GetNoticesCmd;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.data.domain.Pageable;
import java.util.List;
@Mapper
public interface GetNoticesMapper {
List<GetNoticesDto> getNotices(
@Param("pageable") Pageable pageable, @Param("cmd") GetNoticesCmd cmd);
List<GetNoticeFiles> getUploadFiles(
@Param("ids") List<Long> ids, @Param("fileUploadType") FileUploadType fileUploadType);
}

View File

@@ -1,24 +0,0 @@
package app.module.core.usecase.notice.getNotices.adapters.persistence.model;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.Setter;
import java.time.LocalDateTime;
@Getter
@Setter
@AllArgsConstructor
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;
private LocalDateTime startDate;
private LocalDateTime endDate;
private Long total;
}

View File

@@ -1,15 +0,0 @@
package app.module.core.usecase.notice.getNotices.ports;
import app.module.core.usecase.notice.getNotices.ports.application.domain.GetNotices;
import app.module.core.usecase.notice.getNotices.ports.application.domain.GetNoticesCmd;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import java.util.List;
public interface GetNoticesPortIn {
Page<GetNotices> operate(Pageable pageable, GetNoticesCmd command);
List<GetNotices> operateList(GetNoticesCmd command);
}

View File

@@ -1,15 +0,0 @@
package app.module.core.usecase.notice.getNotices.ports;
import app.module.core.usecase.notice.getNotices.ports.application.domain.GetNotices;
import app.module.core.usecase.notice.getNotices.ports.application.domain.GetNoticesCmd;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import java.util.List;
public interface GetNoticesPortOut {
Page<GetNotices> operate(Pageable pageable, GetNoticesCmd command);
List<GetNotices> operateList(GetNoticesCmd command);
}

View File

@@ -1,29 +0,0 @@
package app.module.core.usecase.notice.getNotices.ports.application;
import app.module.core.usecase.notice.getNotices.ports.GetNoticesPortIn;
import app.module.core.usecase.notice.getNotices.ports.GetNoticesPortOut;
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.stereotype.Service;
import java.util.List;
@Service
@RequiredArgsConstructor
class GetNoticesService implements GetNoticesPortIn {
private final GetNoticesPortOut portOut;
@Override
public Page<GetNotices> operate(Pageable pageable, GetNoticesCmd command) {
return portOut.operate(pageable, command);
}
@Override
public List<GetNotices> operateList(GetNoticesCmd command) {
return portOut.operateList(command);
}
}

View File

@@ -1,21 +0,0 @@
package app.module.core.usecase.notice.getNotices.ports.application.domain;
import app.module.core.config.application.enums.FileUploadType;
import lombok.AllArgsConstructor;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.Setter;
@Getter
@Setter
@AllArgsConstructor
@EqualsAndHashCode
public class GetNoticeFiles {
private Long noticeId;
private Long id;
private FileUploadType type;
private String path;
private String name;
private String originName;
private Long fileLength;
}

View File

@@ -1,31 +0,0 @@
package app.module.core.usecase.notice.getNotices.ports.application.domain;
import lombok.AllArgsConstructor;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.Setter;
import java.time.LocalDateTime;
@Getter
@Setter
@AllArgsConstructor
@EqualsAndHashCode
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());
}
}

View File

@@ -1,17 +0,0 @@
package app.module.core.usecase.notice.getNotices.ports.application.domain;
import lombok.AllArgsConstructor;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.Setter;
@Getter
@Setter
@AllArgsConstructor
@EqualsAndHashCode
public class GetNoticesCmd {
private String searchField;
private String searchValue;
private String searchOpen;
}

View File

@@ -1,28 +0,0 @@
package app.module.core.usecase.notice.removeNotices.adapters.persistence;
import app.module.core.config.application.util.CommonUtil;
import app.module.core.usecase.notice.removeNotices.adapters.persistence.model.RemoveNoticesParam;
import app.module.core.usecase.notice.removeNotices.ports.RemoveNoticesPortOut;
import app.module.core.usecase.notice.removeNotices.ports.application.domain.RemoveNoticesCmd;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Repository;
import java.time.LocalDateTime;
@Repository
@RequiredArgsConstructor
class RemoveNoticesDao implements RemoveNoticesPortOut {
private final RemoveNoticesMapper mapper;
@Override
public void operate(RemoveNoticesCmd command) {
String loginUser = CommonUtil.getLoginUsername();;
LocalDateTime now = LocalDateTime.now();
mapper.deleteNoticeHasFiles(
new RemoveNoticesParam(command.getRemoveIds(), now, loginUser, now, loginUser));
mapper.deleteNotices(
new RemoveNoticesParam(command.getRemoveIds(), now, loginUser, now, loginUser));
}
}

View File

@@ -1,10 +0,0 @@
package app.module.core.usecase.notice.removeNotices.adapters.persistence;
import app.module.core.usecase.notice.removeNotices.adapters.persistence.model.RemoveNoticesParam;
import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface RemoveNoticesMapper {
void deleteNotices(RemoveNoticesParam param);
void deleteNoticeHasFiles(RemoveNoticesParam param);
}

View File

@@ -1,19 +0,0 @@
package app.module.core.usecase.notice.removeNotices.adapters.persistence.model;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.Setter;
import java.time.LocalDateTime;
import java.util.Set;
@Getter
@Setter
@AllArgsConstructor
public class RemoveNoticesParam {
private Set<Long> removeIds;
private LocalDateTime updatedAt;
private String updatedBy;
private LocalDateTime deletedAt;
private String deletedBy;
}

View File

@@ -1,7 +0,0 @@
package app.module.core.usecase.notice.removeNotices.ports;
import app.module.core.usecase.notice.removeNotices.ports.application.domain.RemoveNoticesCmd;
public interface RemoveNoticesPortIn {
void operate(RemoveNoticesCmd command);
}

View File

@@ -1,7 +0,0 @@
package app.module.core.usecase.notice.removeNotices.ports;
import app.module.core.usecase.notice.removeNotices.ports.application.domain.RemoveNoticesCmd;
public interface RemoveNoticesPortOut {
void operate(RemoveNoticesCmd command);
}

View File

@@ -1,19 +0,0 @@
package app.module.core.usecase.notice.removeNotices.ports.application;
import app.module.core.usecase.notice.removeNotices.ports.RemoveNoticesPortIn;
import app.module.core.usecase.notice.removeNotices.ports.RemoveNoticesPortOut;
import app.module.core.usecase.notice.removeNotices.ports.application.domain.RemoveNoticesCmd;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
@Service
@RequiredArgsConstructor
class RemoveNoticesService implements RemoveNoticesPortIn {
private final RemoveNoticesPortOut portOut;
@Override
public void operate(RemoveNoticesCmd command) {
portOut.operate(command);
}
}

View File

@@ -1,16 +0,0 @@
package app.module.core.usecase.notice.removeNotices.ports.application.domain;
import lombok.AllArgsConstructor;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.Setter;
import java.util.Set;
@Getter
@Setter
@AllArgsConstructor
@EqualsAndHashCode
public class RemoveNoticesCmd {
private Set<Long> removeIds;
}

View File

@@ -1,52 +0,0 @@
package app.module.core.usecase.notice.updateNotice.adapters.persistence;
import app.module.core.config.adapters.persistence.entity.ArticleHasUploadFile;
import app.module.core.config.application.util.CommonUtil;
import app.module.core.usecase.notice.updateNotice.adapters.persistence.model.CreateUploadFileParam;
import app.module.core.usecase.notice.updateNotice.adapters.persistence.model.UpdateNoticeDto;
import app.module.core.usecase.notice.updateNotice.ports.UpdateNoticePortOut;
import app.module.core.usecase.notice.updateNotice.ports.application.domain.UpdateNoticeCmd;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Repository;
import java.time.LocalDateTime;
@Repository
@RequiredArgsConstructor
class UpdateNoticeDao implements UpdateNoticePortOut {
private final UpdateNoticeMapper mapper;
@Override
public void operate(UpdateNoticeCmd command) {
mapper.updateNotice(
new UpdateNoticeDto(
command.getId(),
command.getTitle(),
command.getContent(),
command.getVisible(),
command.getStartDate(),
command.getEndDate(),
command.getFileMappingId(),
LocalDateTime.now(),
CommonUtil.getLoginUsername()
));
// 첨부파일 초기화
mapper.deleteFileUploads(new ArticleHasUploadFile(command.getId()));
// 첨부파일 있을 시, 등록
if (command.getFileMappingId() != null && !command.getFileMappingId().isEmpty()) {
mapper.createFileUploads(new CreateUploadFileParam(
command.getId(),
command.getFileMappingId().stream()
.map(Long::parseLong)
.toList(),
LocalDateTime.now(),
CommonUtil.getLoginUsername(),
LocalDateTime.now(),
CommonUtil.getLoginUsername()
));
}
}
}

View File

@@ -1,13 +0,0 @@
package app.module.core.usecase.notice.updateNotice.adapters.persistence;
import app.module.core.config.adapters.persistence.entity.ArticleHasUploadFile;
import app.module.core.usecase.notice.updateNotice.adapters.persistence.model.CreateUploadFileParam;
import app.module.core.usecase.notice.updateNotice.adapters.persistence.model.UpdateNoticeDto;
import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface UpdateNoticeMapper {
void updateNotice(UpdateNoticeDto dto);
void deleteFileUploads(ArticleHasUploadFile articleHasUploadFile);
void createFileUploads(CreateUploadFileParam param);
}

View File

@@ -1,18 +0,0 @@
package app.module.core.usecase.notice.updateNotice.adapters.persistence.model;
import lombok.AllArgsConstructor;
import lombok.Getter;
import java.time.LocalDateTime;
import java.util.List;
@Getter
@AllArgsConstructor
public class CreateUploadFileParam {
private Long id;
private List<Long> fileMappingId;
private LocalDateTime createdAt;
private String createdBy;
private LocalDateTime updatedAt;
private String updatedBy;
}

View File

@@ -1,25 +0,0 @@
package app.module.core.usecase.notice.updateNotice.adapters.persistence.model;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import java.time.LocalDateTime;
import java.util.List;
@Getter
@Setter
@NoArgsConstructor
@AllArgsConstructor
public class UpdateNoticeDto {
private Long id;
private String title;
private String content;
private Boolean visible;
private LocalDateTime startDate;
private LocalDateTime endDate;
private List<String> fileMappingId;
private LocalDateTime updatedAt;
private String updatedBy;
}

View File

@@ -1,8 +0,0 @@
package app.module.core.usecase.notice.updateNotice.ports;
import app.module.core.usecase.notice.updateNotice.ports.application.domain.UpdateNoticeCmd;
public interface UpdateNoticePortIn {
void operate(UpdateNoticeCmd command);
}

View File

@@ -1,8 +0,0 @@
package app.module.core.usecase.notice.updateNotice.ports;
import app.module.core.usecase.notice.updateNotice.ports.application.domain.UpdateNoticeCmd;
public interface UpdateNoticePortOut {
void operate(UpdateNoticeCmd command);
}

View File

@@ -1,19 +0,0 @@
package app.module.core.usecase.notice.updateNotice.ports.application;
import app.module.core.usecase.notice.updateNotice.ports.UpdateNoticePortIn;
import app.module.core.usecase.notice.updateNotice.ports.UpdateNoticePortOut;
import app.module.core.usecase.notice.updateNotice.ports.application.domain.UpdateNoticeCmd;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
@Service
@RequiredArgsConstructor
class UpdateNoticeService implements UpdateNoticePortIn {
private final UpdateNoticePortOut portOut;
@Override
public void operate(UpdateNoticeCmd command) {
portOut.operate(command);
}
}

View File

@@ -1,23 +0,0 @@
package app.module.core.usecase.notice.updateNotice.ports.application.domain;
import lombok.AllArgsConstructor;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.Setter;
import java.time.LocalDateTime;
import java.util.List;
@Getter
@Setter
@AllArgsConstructor
@EqualsAndHashCode
public class UpdateNoticeCmd {
private Long id;
private String title;
private String content;
private Boolean visible;
private LocalDateTime startDate;
private LocalDateTime endDate;
private List<String> fileMappingId;
}

View File

@@ -1,56 +0,0 @@
package app.module.core.usecase.product.createForestProduct.adapters.persistence;
import app.module.core.usecase.product.createForestProduct.adapters.persistence.model.CreateForestProductDto;
import app.module.core.usecase.product.createForestProduct.ports.CreateForestProductPortOut;
import app.module.core.usecase.product.createForestProduct.ports.application.domain.CreateForestProduct;
import app.module.core.usecase.product.createForestProduct.ports.application.domain.CreateForestProductCmd;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;
import java.util.Optional;
@Repository
@RequiredArgsConstructor
class CreateForestProductDao implements CreateForestProductPortOut {
private final CreateForestProductMapper mapper;
@Override
@Transactional
public Optional<CreateForestProduct> operate(CreateForestProductCmd cmd) {
CreateForestProductDto dto =
new CreateForestProductDto(
null,
cmd.getHouseholdSeq(),
cmd.getStreetNum(),
cmd.getLandType(),
cmd.getTown(),
cmd.getAvailableArea(),
cmd.getCropName(),
cmd.getCropCode(),
cmd.getLandArea(),
cmd.getMonth(),
cmd.getMainYield(),
cmd.getMainYieldUnitCode(),
cmd.getMainSaleAmount(),
cmd.getMainSaleUnitCode(),
cmd.getSubYield(),
cmd.getSubYieldUnitCode(),
cmd.getSubSaleAmount(),
cmd.getSubSaleUnitCode(),
cmd.getMonthlyInputStatusId(),
cmd.getCreatedAt(),
cmd.getCreatedBy(),
cmd.getUpdatedAt(),
cmd.getUpdatedBy()
);
mapper.createForestProduct(dto);
return Optional.of(new CreateForestProduct(dto.getId()));
}
}

View File

@@ -1,9 +0,0 @@
package app.module.core.usecase.product.createForestProduct.adapters.persistence;
import app.module.core.usecase.product.createForestProduct.adapters.persistence.model.CreateForestProductDto;
import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface CreateForestProductMapper {
void createForestProduct(CreateForestProductDto dto);
}

View File

@@ -1,47 +0,0 @@
package app.module.core.usecase.product.createForestProduct.adapters.persistence.model;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import java.math.BigDecimal;
import java.time.LocalDateTime;
@Getter
@Setter
@NoArgsConstructor
@AllArgsConstructor
public class CreateForestProductDto {
private Long id;
private Long householdSeq;
private String streetNum;
private String landType;
private String town;
private Integer availableArea;
private String cropName;
private String cropCode;
private Integer landArea;
private String month;
private BigDecimal mainYield;
private String mainYieldUnitCode;
private BigDecimal mainSaleAmount;
private String mainSaleUnitCode;
private BigDecimal subYield;
private String subYieldUnitCode;
private BigDecimal subSaleAmount;
private String subSaleUnitCode;
private Long monthlyInputStatusId;
private LocalDateTime createdAt;
private String createdBy;
private LocalDateTime updatedAt;
private String updatedBy;
}

View File

@@ -1,11 +0,0 @@
package app.module.core.usecase.product.createForestProduct.ports;
import app.module.core.usecase.product.createForestProduct.ports.application.domain.CreateForestProduct;
import app.module.core.usecase.product.createForestProduct.ports.application.domain.CreateForestProductCmd;
import java.util.Optional;
public interface CreateForestProductPortIn {
Optional<CreateForestProduct> operate(CreateForestProductCmd command);
}

View File

@@ -1,11 +0,0 @@
package app.module.core.usecase.product.createForestProduct.ports;
import app.module.core.usecase.product.createForestProduct.ports.application.domain.CreateForestProduct;
import app.module.core.usecase.product.createForestProduct.ports.application.domain.CreateForestProductCmd;
import java.util.Optional;
public interface CreateForestProductPortOut {
Optional<CreateForestProduct> operate(CreateForestProductCmd command);
}

View File

@@ -1,24 +0,0 @@
package app.module.core.usecase.product.createForestProduct.ports.application;
import app.module.core.config.application.annotation.CreateCommand;
import app.module.core.usecase.product.createForestProduct.ports.CreateForestProductPortIn;
import app.module.core.usecase.product.createForestProduct.ports.CreateForestProductPortOut;
import app.module.core.usecase.product.createForestProduct.ports.application.domain.CreateForestProduct;
import app.module.core.usecase.product.createForestProduct.ports.application.domain.CreateForestProductCmd;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
import java.util.Optional;
@Service
@RequiredArgsConstructor
class CreateForestProductService implements CreateForestProductPortIn {
private final CreateForestProductPortOut portOut;
@Override
@CreateCommand
public Optional<CreateForestProduct> operate(CreateForestProductCmd command) {
return portOut.operate(command);
}
}

View File

@@ -1,14 +0,0 @@
package app.module.core.usecase.product.createForestProduct.ports.application.domain;
import lombok.AllArgsConstructor;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.Setter;
@Getter
@Setter
@AllArgsConstructor
@EqualsAndHashCode
public class CreateForestProduct {
private Long id;
}

View File

@@ -1,41 +0,0 @@
package app.module.core.usecase.product.createForestProduct.ports.application.domain;
import app.module.core.config.adapters.persistence.component.AuditCommand;
import lombok.AllArgsConstructor;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.Setter;
import java.math.BigDecimal;
@Getter
@Setter
@AllArgsConstructor
@EqualsAndHashCode
public class CreateForestProductCmd extends AuditCommand {
private Long householdSeq;
private String streetNum;
private String landType;
private String town;
private Integer availableArea;
private String cropName;
private String cropCode;
private Integer landArea;
private String month;
private BigDecimal mainYield;
private String mainYieldUnitCode;
private BigDecimal mainSaleAmount;
private String mainSaleUnitCode;
private BigDecimal subYield;
private String subYieldUnitCode;
private BigDecimal subSaleAmount;
private String subSaleUnitCode;
private Long monthlyInputStatusId;
}

View File

@@ -1,27 +0,0 @@
package app.module.core.usecase.product.getForestProduct.adapters.persistence;
import app.module.core.usecase.product.getForestProduct.ports.GetForestProductPortOut;
import app.module.core.usecase.product.getForestProduct.ports.application.domain.GetForestProduct;
import app.module.core.usecase.product.getForestProduct.ports.application.domain.GetForestProductCmd;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;
import java.util.Optional;
@Repository
@RequiredArgsConstructor
class GetForestProductDao implements GetForestProductPortOut {
private final GetForestProductMapper mapper;
@Override
@Transactional
public Optional<GetForestProduct> operate(GetForestProductCmd command) {
GetForestProduct secArticle = mapper.getForestProduct(command);
return Optional.of(secArticle);
}
}

View File

@@ -1,12 +0,0 @@
package app.module.core.usecase.product.getForestProduct.adapters.persistence;
import app.module.core.usecase.product.getForestProduct.ports.application.domain.GetForestProduct;
import app.module.core.usecase.product.getForestProduct.ports.application.domain.GetForestProductCmd;
import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface GetForestProductMapper {
GetForestProduct getForestProduct(GetForestProductCmd command);
}

View File

@@ -1,11 +0,0 @@
package app.module.core.usecase.product.getForestProduct.ports;
import app.module.core.usecase.product.getForestProduct.ports.application.domain.GetForestProduct;
import app.module.core.usecase.product.getForestProduct.ports.application.domain.GetForestProductCmd;
import java.util.Optional;
public interface GetForestProductPortIn {
Optional<GetForestProduct> operate(GetForestProductCmd command);
}

View File

@@ -1,11 +0,0 @@
package app.module.core.usecase.product.getForestProduct.ports;
import app.module.core.usecase.product.getForestProduct.ports.application.domain.GetForestProduct;
import app.module.core.usecase.product.getForestProduct.ports.application.domain.GetForestProductCmd;
import java.util.Optional;
public interface GetForestProductPortOut {
Optional<GetForestProduct> operate(GetForestProductCmd command);
}

View File

@@ -1,22 +0,0 @@
package app.module.core.usecase.product.getForestProduct.ports.application;
import app.module.core.usecase.product.getForestProduct.ports.GetForestProductPortIn;
import app.module.core.usecase.product.getForestProduct.ports.GetForestProductPortOut;
import app.module.core.usecase.product.getForestProduct.ports.application.domain.GetForestProduct;
import app.module.core.usecase.product.getForestProduct.ports.application.domain.GetForestProductCmd;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
import java.util.Optional;
@Service
@RequiredArgsConstructor
class GetForestProductService implements GetForestProductPortIn {
private final GetForestProductPortOut portOut;
@Override
public Optional<GetForestProduct> operate(GetForestProductCmd command) {
return portOut.operate(command);
}
}

View File

@@ -1,46 +0,0 @@
package app.module.core.usecase.product.getForestProduct.ports.application.domain;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import java.math.BigDecimal;
import java.time.LocalDateTime;
@Getter
@Setter
@NoArgsConstructor
@EqualsAndHashCode
public class GetForestProduct {
private Long id;
private Long householdSeq;
private String streetNum;
private String landType;
private String town;
private Integer availableArea;
private String cropName;
private String cropCode;
private Integer landArea;
private String month;
private BigDecimal mainYield;
private String mainYieldUnitCode;
private BigDecimal mainSaleAmount;
private String mainSaleUnitCode;
private BigDecimal subYield;
private String subYieldUnitCode;
private BigDecimal subSaleAmount;
private String subSaleUnitCode;
private Long monthlyInputStatusId;
private LocalDateTime createdAt;
private String createdBy;
private LocalDateTime updatedAt;
private String updatedBy;
}

View File

@@ -1,14 +0,0 @@
package app.module.core.usecase.product.getForestProduct.ports.application.domain;
import lombok.AllArgsConstructor;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.Setter;
@Getter
@Setter
@AllArgsConstructor
@EqualsAndHashCode
public class GetForestProductCmd {
private Long id;
}

View File

@@ -1,65 +0,0 @@
package app.module.core.usecase.product.getForestProducts.adapters.persistence;
import app.module.core.config.application.enums.FileUploadType;
import app.module.core.usecase.product.getForestProducts.adapters.persistence.model.GetForestProductsDto;
import app.module.core.usecase.product.getForestProducts.ports.GetForestProductsPortOut;
import app.module.core.usecase.product.getForestProducts.ports.application.domain.GetForestProducts;
import app.module.core.usecase.product.getForestProducts.ports.application.domain.GetForestProductsCmd;
import lombok.RequiredArgsConstructor;
import org.apache.commons.collections4.ListUtils;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageImpl;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;
import java.util.Collections;
import java.util.List;
import java.util.stream.Collectors;
@Repository
@RequiredArgsConstructor
class GetForestProductsDao implements GetForestProductsPortOut {
private final GetForestProductsMapper mapper;
@Override
public Page<GetForestProducts> operate(Pageable pageable, GetForestProductsCmd command) {
// 게시물 목록 얻기
List<GetForestProductsDto> contents =
ListUtils.emptyIfNull(mapper.getForestProducts(pageable, command));
return new PageImpl<>(
contents.stream()
.map(
article ->
new GetForestProducts(
article.getId(),
article.getHouseholdSeq(),
article.getStreetNum(),
article.getLandType(),
article.getTown(),
article.getAvailableArea(),
article.getCropName(),
article.getCropCode(),
article.getLandArea(),
article.getMonth(),
article.getMainYield(),
article.getMainYieldUnitCode(),
article.getMainSaleAmount(),
article.getMainSaleUnitCode(),
article.getSubYield(),
article.getSubYieldUnitCode(),
article.getSubSaleAmount(),
article.getSubSaleUnitCode(),
article.getMonthlyInputStatusId(),
article.getCreatedAt(),
article.getCreatedBy(),
article.getUpdatedAt(),
article.getUpdatedBy()))
.collect(Collectors.toList()),
pageable,
contents.isEmpty() ? 0 : contents.get(0).getTotal());
}
}

View File

@@ -1,17 +0,0 @@
package app.module.core.usecase.product.getForestProducts.adapters.persistence;
import app.module.core.usecase.product.getForestProducts.adapters.persistence.model.GetForestProductsDto;
import app.module.core.usecase.product.getForestProducts.ports.application.domain.GetForestProductsCmd;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.data.domain.Pageable;
import java.util.List;
@Mapper
public interface GetForestProductsMapper {
List<GetForestProductsDto> getForestProducts(
@Param("pageable") Pageable pageable, @Param("cmd") GetForestProductsCmd cmd);
}

View File

@@ -1,47 +0,0 @@
package app.module.core.usecase.product.getForestProducts.adapters.persistence.model;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.Setter;
import java.math.BigDecimal;
import java.time.LocalDateTime;
@Getter
@Setter
@AllArgsConstructor
public class GetForestProductsDto {
private Long id;
private Long householdSeq;
private String streetNum;
private String landType;
private String town;
private Integer availableArea;
private String cropName;
private String cropCode;
private Integer landArea;
private String month;
private BigDecimal mainYield;
private String mainYieldUnitCode;
private BigDecimal mainSaleAmount;
private String mainSaleUnitCode;
private BigDecimal subYield;
private String subYieldUnitCode;
private BigDecimal subSaleAmount;
private String subSaleUnitCode;
private Long monthlyInputStatusId;
private LocalDateTime createdAt;
private String createdBy;
private LocalDateTime updatedAt;
private String updatedBy;
private Long total;
}

View File

@@ -1,14 +0,0 @@
package app.module.core.usecase.product.getForestProducts.ports;
import app.module.core.usecase.product.getForestProducts.ports.application.domain.GetForestProducts;
import app.module.core.usecase.product.getForestProducts.ports.application.domain.GetForestProductsCmd;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import java.util.List;
public interface GetForestProductsPortIn {
Page<GetForestProducts> operate(Pageable pageable, GetForestProductsCmd command);
}

View File

@@ -1,14 +0,0 @@
package app.module.core.usecase.product.getForestProducts.ports;
import app.module.core.usecase.product.getForestProducts.ports.application.domain.GetForestProducts;
import app.module.core.usecase.product.getForestProducts.ports.application.domain.GetForestProductsCmd;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import java.util.List;
public interface GetForestProductsPortOut {
Page<GetForestProducts> operate(Pageable pageable, GetForestProductsCmd command);
}

View File

@@ -1,25 +0,0 @@
package app.module.core.usecase.product.getForestProducts.ports.application;
import app.module.core.usecase.product.getForestProducts.ports.GetForestProductsPortIn;
import app.module.core.usecase.product.getForestProducts.ports.GetForestProductsPortOut;
import app.module.core.usecase.product.getForestProducts.ports.application.domain.GetForestProducts;
import app.module.core.usecase.product.getForestProducts.ports.application.domain.GetForestProductsCmd;
import lombok.RequiredArgsConstructor;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;
import java.util.List;
@Service
@RequiredArgsConstructor
class GetForestProductsService implements GetForestProductsPortIn {
private final GetForestProductsPortOut portOut;
@Override
public Page<GetForestProducts> operate(Pageable pageable, GetForestProductsCmd command) {
return portOut.operate(pageable, command);
}
}

View File

@@ -1,47 +0,0 @@
package app.module.core.usecase.product.getForestProducts.ports.application.domain;
import lombok.AllArgsConstructor;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.Setter;
import java.math.BigDecimal;
import java.time.LocalDateTime;
@Getter
@Setter
@AllArgsConstructor
@EqualsAndHashCode
public class GetForestProducts {
private Long id;
private Long householdSeq;
private String streetNum;
private String landType;
private String town;
private Integer availableArea;
private String cropName;
private String cropCode;
private Integer landArea;
private String month;
private BigDecimal mainYield;
private String mainYieldUnitCode;
private BigDecimal mainSaleAmount;
private String mainSaleUnitCode;
private BigDecimal subYield;
private String subYieldUnitCode;
private BigDecimal subSaleAmount;
private String subSaleUnitCode;
private Long monthlyInputStatusId;
private LocalDateTime createdAt;
private String createdBy;
private LocalDateTime updatedAt;
private String updatedBy;
}

View File

@@ -1,16 +0,0 @@
package app.module.core.usecase.product.getForestProducts.ports.application.domain;
import lombok.AllArgsConstructor;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.Setter;
@Getter
@Setter
@AllArgsConstructor
@EqualsAndHashCode
public class GetForestProductsCmd {
private String searchField;
private String searchValue;
}

View File

@@ -1,62 +0,0 @@
package app.module.core.usecase.product.getMonthlyForestProducts.adapters.persistence;
import app.module.core.usecase.product.getMonthlyForestProducts.adapters.persistence.model.GetMonthlyForestProductsDto;
import app.module.core.usecase.product.getMonthlyForestProducts.ports.GetMonthlyForestProductsPortOut;
import app.module.core.usecase.product.getMonthlyForestProducts.ports.application.domain.GetMonthlyForestProducts;
import app.module.core.usecase.product.getMonthlyForestProducts.ports.application.domain.GetMonthlyForestProductsCmd;
import lombok.RequiredArgsConstructor;
import org.apache.commons.collections4.ListUtils;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageImpl;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Repository;
import java.util.List;
import java.util.stream.Collectors;
@Repository
@RequiredArgsConstructor
class GetMonthlyForestProductsDao implements GetMonthlyForestProductsPortOut {
private final GetMonthlyForestProductsMapper mapper;
@Override
public Page<GetMonthlyForestProducts> operate(Pageable pageable, GetMonthlyForestProductsCmd command) {
// 게시물 목록 얻기
List<GetMonthlyForestProductsDto> contents =
ListUtils.emptyIfNull(mapper.getMonthlyForestProducts(pageable, command));
return new PageImpl<>(
contents.stream()
.map(
article ->
new GetMonthlyForestProducts(
article.getId(),
article.getHouseholdSeq(),
article.getStreetNum(),
article.getLandType(),
article.getTown(),
article.getAvailableArea(),
article.getCropName(),
article.getCropCode(),
article.getLandArea(),
article.getMonth(),
article.getMainYield(),
article.getMainYieldUnitCode(),
article.getMainSaleAmount(),
article.getMainSaleUnitCode(),
article.getSubYield(),
article.getSubYieldUnitCode(),
article.getSubSaleAmount(),
article.getSubSaleUnitCode(),
article.getMonthlyInputStatusId(),
article.getCreatedAt(),
article.getCreatedBy(),
article.getUpdatedAt(),
article.getUpdatedBy()))
.collect(Collectors.toList()),
pageable,
contents.isEmpty() ? 0 : contents.get(0).getTotal());
}
}

Some files were not shown because too many files have changed in this diff Show More