Merge branch 'dev' into 0623_fetch

This commit is contained in:
주수현
2025-06-27 08:05:32 +09:00
164 changed files with 2837 additions and 408 deletions

View File

@@ -113,7 +113,7 @@ recycle 의 demo 가 궁금하다면 아래 URL 에서 확인 해주세요.
-Dspring.datasource.username=ko_research
-Dspring.datasource.password=koresearch1@#4
-Daes.secret-key=092HW829O0A0AVR0
-Dpath.upload.storage=SFTP
-Dpath.upload.storage=LOCAL
-Dpath.upload.sftp.public=/home/etribe/data/upload
-Dpath.upload.sftp.tmpdir=${user.home}/upload/tmpdir
-Dfile.upload.sftp.ip=115.68.193.117
@@ -121,6 +121,9 @@ recycle 의 demo 가 궁금하다면 아래 URL 에서 확인 해주세요.
-Dfile.upload.sftp.password=Etribe@3415
-Dfile.upload.sftp.port=22
```
** 주의 : 운영서버일 경우 -Dpath.upload.storage=SFTP로 설정
## JDBC 및 데이터 핸들링 구성 옵션

View File

@@ -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;
}

View File

@@ -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;

View File

@@ -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<ExcelSheetDto> 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<String> headers = sheetDto.getHeaders();
List<List<String>> 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<String> 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<String> 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);
}
}

View File

@@ -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<String> headers;
/**
* 데이터 리스트 (해더와 같아야 한다. 값이 없다면 null이라도 넣어줘야해요.)
*/
private List<List<String>> data;
/**
* 입력한 데이터 중 comma가 필요한 라인 선택 0 부터
*/
private Set<Integer> commaColumns;
/**
* 해더의 배경색 지정 : 0부터 시작
*/
private Map<Integer, IndexedColors> headerBgColors; // 💡 추가: 컬럼별 배경색
public ExcelSheetDto(String sheetName, List<String> headers, List<List<String>> data,
Set<Integer> commaColumns, Map<Integer, IndexedColors> headerBgColors) {
this.sheetName = sheetName;
this.headers = headers;
this.data = data;
this.commaColumns = commaColumns;
this.headerBgColors = headerBgColors;
}
public String getSheetName() { return sheetName; }
public List<String> getHeaders() { return headers; }
public List<List<String>> getData() { return data; }
public Set<Integer> getCommaColumns() { return commaColumns; }
public Map<Integer, IndexedColors> getHeaderBgColors() { return headerBgColors; }
}

View File

@@ -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) {

View File

@@ -40,7 +40,7 @@ class CreateNoticeDao implements CreateNoticePortOut {
mapper.createNotice(dto);
if (dto.getFileMappingId() != null && !dto.getFileMappingId().isEmpty()) {
mapper.createNoticeHasUploadFile(new CreateNoticeHasUploadFilesParam(
mapper.createNoticeUploadFile(new CreateNoticeHasUploadFilesParam(
dto.getId(),
dto.getFileMappingId().stream()
.map(Long::parseLong)

View File

@@ -7,5 +7,5 @@ import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface CreateNoticeMapper {
void createNotice(CreateNoticeDto dto);
void createNoticeHasUploadFile(CreateNoticeHasUploadFilesParam param);
void createNoticeUploadFile(CreateNoticeHasUploadFilesParam param);
}

View File

@@ -4,8 +4,10 @@ import app.module.admin.usecase.communication.notice.getNotice.ports.GetNoticePo
import app.module.admin.usecase.communication.notice.getNotice.ports.application.domain.GetNotice;
import app.module.admin.usecase.communication.notice.getNotice.ports.application.domain.GetNoticeCmd;
import app.module.admin.usecase.communication.notice.getNotice.ports.application.domain.GetNoticeUploadFile;
import app.module.core.config.application.enums.FileStorageType;
import app.module.core.usecase.file.url.application.port.in.FileUrlPortIn;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;
@@ -19,6 +21,8 @@ class GetNoticeDao implements GetNoticePortOut {
private final GetNoticeMapper mapper;
private final FileUrlPortIn fileUrlPortIn;
@Value("${path.upload.storage}")
private String uploadStorageType;
@Override
@Transactional
@@ -35,13 +39,13 @@ class GetNoticeDao implements GetNoticePortOut {
// 참조 URL 전달
uploadFile.setReferURL(
fileUrlPortIn.getInline(
uploadFile.getType().getFileStorageType(),
FileStorageType.valueOf(uploadStorageType),
uploadFile.getPath(),
uploadFile.getName()));
// attachment URL 전달
uploadFile.setAttachmentURL(
fileUrlPortIn.getAttachment(
uploadFile.getType().getFileStorageType(), uploadFile.getId()));
FileStorageType.valueOf(uploadStorageType), uploadFile.getId()));
return uploadFile;
})

View File

@@ -20,7 +20,7 @@ class RemoveNoticesDao implements RemoveNoticesPortOut {
String loginUser = CommonUtil.getLoginUsername();;
LocalDateTime now = LocalDateTime.now();
mapper.deleteNoticeHasFiles(
mapper.deleteNoticeUploadFiles(
new RemoveNoticesParam(command.getRemoveIds(), now, loginUser, now, loginUser));
mapper.deleteNotices(
new RemoveNoticesParam(command.getRemoveIds(), now, loginUser, now, loginUser));

View File

@@ -6,5 +6,5 @@ import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface RemoveNoticesMapper {
void deleteNotices(RemoveNoticesParam param);
void deleteNoticeHasFiles(RemoveNoticesParam param);
void deleteNoticeUploadFiles(RemoveNoticesParam param);
}

View File

@@ -1,27 +1,27 @@
package app.module.admin.usecase.communication.notice.updateNotice.adapters.persistence;
import app.module.admin.usecase.communication.notice.updateNotice.adapters.persistence.model.CreateUploadFileParam;
import app.module.admin.usecase.communication.notice.updateNotice.adapters.persistence.model.UpdateNoticeDto;
import app.module.admin.usecase.communication.notice.updateNotice.ports.UpdateNoticePortOut;
import app.module.admin.usecase.communication.notice.updateNotice.ports.application.domain.UpdateNoticeCmd;
import app.module.core.config.adapters.persistence.entity.NoticeHasUploadFile;
import app.module.core.config.application.annotation.UpdateCommand;
import app.module.core.config.application.util.CommonUtil;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Repository;
import java.time.LocalDateTime;
@Slf4j
@Repository
@RequiredArgsConstructor
class UpdateNoticeDao implements UpdateNoticePortOut {
private final UpdateNoticeMapper mapper;
@Override
@UpdateCommand
public void operate(UpdateNoticeCmd command) {
mapper.updateNotice(
new UpdateNoticeDto(
command.getId(),
command.getTitle(),
@@ -34,21 +34,5 @@ class UpdateNoticeDao implements UpdateNoticePortOut {
CommonUtil.getLoginUsername()
));
// 첨부파일 초기화
mapper.deleteFileUploads(new NoticeHasUploadFile(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,14 +1,9 @@
package app.module.admin.usecase.communication.notice.updateNotice.adapters.persistence;
import app.module.admin.usecase.communication.notice.updateNotice.adapters.persistence.model.CreateUploadFileParam;
import app.module.admin.usecase.communication.notice.updateNotice.adapters.persistence.model.UpdateNoticeDto;
import app.module.core.config.adapters.persistence.entity.ArticleHasUploadFile;
import app.module.core.config.adapters.persistence.entity.NoticeHasUploadFile;
import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface UpdateNoticeMapper {
void updateNotice(UpdateNoticeDto dto);
void deleteFileUploads(NoticeHasUploadFile noticeHasUploadFile);
void createFileUploads(CreateUploadFileParam param);
}

View File

@@ -1,18 +0,0 @@
package app.module.admin.usecase.communication.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

@@ -3,6 +3,9 @@ package app.module.admin.usecase.communication.notice.updateNotice.adapters.web;
import app.module.admin.usecase.communication.notice.updateNotice.adapters.web.model.UpdateNoticeReqVO;
import app.module.admin.usecase.communication.notice.updateNotice.ports.UpdateNoticePortIn;
import app.module.admin.usecase.communication.notice.updateNotice.ports.application.domain.UpdateNoticeCmd;
import app.module.core.config.application.enums.FileUploadType;
import app.module.core.usecase.file.updateFile.ports.UpdateFilePortIn;
import app.module.core.usecase.file.updateFile.ports.application.domain.UpdateFileCmd;
import jakarta.validation.Valid;
import lombok.RequiredArgsConstructor;
import org.springframework.http.HttpStatus;
@@ -16,6 +19,7 @@ import org.springframework.web.bind.annotation.RestController;
@RequiredArgsConstructor
class UpdateNoticeController {
private final UpdateNoticePortIn updateNoticePortIn;
private final UpdateFilePortIn updateFilePortIn;
@PutMapping(path = "/api/communication/notices/update")
ResponseEntity<?> operate(@RequestBody @Valid UpdateNoticeReqVO reqVO, BindingResult bindingResult) {
@@ -26,6 +30,13 @@ class UpdateNoticeController {
.body(bindingResult.getFieldErrors());
}
updateFilePortIn.operate(
new UpdateFileCmd(
reqVO.getId(),
reqVO.getFileMappingId().stream().map(Long::parseLong).toList(),
FileUploadType.NOTICE)
);
updateNoticePortIn.operate(
new UpdateNoticeCmd(
reqVO.getId(),
@@ -34,8 +45,8 @@ class UpdateNoticeController {
reqVO.getVisible(),
reqVO.getStartDate(),
reqVO.getEndDate(),
reqVO.getFileMappingId()
));
reqVO.getFileMappingId())
);
return ResponseEntity.status(HttpStatus.OK).body(reqVO);
}

View File

@@ -1,11 +1,13 @@
package app.module.admin.usecase.editor.adapters.web;
import app.module.core.config.application.enums.FileStorageType;
import app.module.core.config.application.enums.FileUploadType;
import app.module.core.usecase.file.saveToStorage.ports.SaveToStoragePortIn;
import app.module.core.usecase.file.saveToStorage.ports.application.domain.SaveToStorage;
import app.module.core.usecase.file.url.application.port.in.FileUrlPortIn;
import java.io.IOException;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Controller;
@@ -18,6 +20,8 @@ public class EditorImageUploadController {
private final SaveToStoragePortIn saveToStoragePortIn;
private final FileUrlPortIn fileUrlPortIn;
@Value("${path.upload.storage}")
private String uploadStorageType;
@PostMapping(path = "/api/editorImage/upload")
ResponseEntity<?> editorImageUpload(MultipartFile editorImage) throws IOException {
@@ -27,7 +31,7 @@ public class EditorImageUploadController {
return ResponseEntity.status(HttpStatus.OK)
.body(
fileUrlPortIn.getInline(
saveToStorage.getType().getFileStorageType(),
FileStorageType.valueOf(uploadStorageType),
saveToStorage.getPath(),
saveToStorage.getName()));
}

View File

@@ -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<byte[]> 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<Household> rawList = ... // List<Object>를 캐스팅 or 변환
List<List<String>> 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<ExcelSheetDto> 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);
}
}

View File

@@ -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

View File

@@ -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;

View File

@@ -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;

View File

@@ -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;

View File

@@ -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);
}
}

View File

@@ -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);
}

View File

@@ -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);
}

View File

@@ -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);
}

View File

@@ -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);
}
}

View File

@@ -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;
}

View File

@@ -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;

View File

@@ -0,0 +1,39 @@
package app.module.admin.usecase.household.tab.dailyRecord.removeDaily.adapters.persistence;
import app.module.admin.usecase.household.tab.dailyRecord.removeDaily.ports.RemoveDailyPortOut;
import app.module.admin.usecase.household.tab.dailyRecord.removeDaily.ports.application.domain.RemoveDailyCmd;
import app.module.core.config.application.enums.DailySort;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Repository;
@Slf4j
@Repository
@RequiredArgsConstructor
public class RemoveDailyDao implements RemoveDailyPortOut {
private final RemoveDailyMapper mapper;
@Override
public void operate(RemoveDailyCmd command) {
if (command.getCurrentStep() != null) {
log.error("[RemoveDaily] cmd: {}", command);
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);
}
} else {
log.error("[RemoveDaily] Current step is null. cmd: {}", command);
}
}
}

View File

@@ -0,0 +1,43 @@
package app.module.admin.usecase.household.tab.dailyRecord.removeDaily.adapters.persistence;
import app.module.admin.usecase.household.tab.dailyRecord.removeDaily.ports.application.domain.RemoveDailyCmd;
import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface RemoveDailyMapper {
/**
* 특정일의 수입 전체 삭제
* @param command 검색 조건
*/
void removeDailyIncome(RemoveDailyCmd command);
/**
* 특정일의 임업노동 투입 전체 삭제
* @param command 검색 조건
*/
void removeDailyWork(RemoveDailyCmd command);
/**
* 특정일의 지출 전체 삭제
* @param command 검색 조건
*/
void removeDailyExpense(RemoveDailyCmd command);
/**
* 동력 사용시간 전체 삭제
* @param command 검색 조건
*/
void removeDailyPower(RemoveDailyCmd command);
/**
* 자가임업 생산물 중 자가소비량 전체 삭제
* @param command 검색 조건
*/
void removeDailyForestry(RemoveDailyCmd command);
/**
* 자가농업 생산물 중 자가소비량 전체 삭제
* @param command 검색 조건
*/
void removeDailyFarming(RemoveDailyCmd command);
}

View File

@@ -0,0 +1,28 @@
package app.module.admin.usecase.household.tab.dailyRecord.removeDaily.adapters.web;
import app.module.admin.usecase.household.tab.dailyRecord.removeDaily.adapters.web.modal.RemoveDailyReqVO;
import app.module.admin.usecase.household.tab.dailyRecord.removeDaily.ports.RemoveDailyPortIn;
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 RemoveDailyController {
private final RemoveDailyPortIn removeDailyNonePortIn;
@PostMapping(path = "/api/household/daily/remove")
ResponseEntity<?> remove(@RequestBody RemoveDailyReqVO reqVO) {
log.debug("reqVO: {}", reqVO);
if (!reqVO.getSelectedIds().isEmpty()) {
removeDailyNonePortIn.operate(reqVO);
}
return ResponseEntity.status(HttpStatus.OK).body(reqVO);
}
}

View File

@@ -0,0 +1,22 @@
package app.module.admin.usecase.household.tab.dailyRecord.removeDaily.adapters.web.modal;
import app.module.core.config.application.enums.DailySort;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
import java.util.Set;
@Getter
@Setter
@ToString
public class RemoveDailyReqVO {
/**
* 항목 일련번호
*/
private Set<Long> selectedIds;
/**
* 현재 단계
*/
private DailySort currentStep;
}

View File

@@ -0,0 +1,7 @@
package app.module.admin.usecase.household.tab.dailyRecord.removeDaily.ports;
import app.module.admin.usecase.household.tab.dailyRecord.removeDaily.adapters.web.modal.RemoveDailyReqVO;
public interface RemoveDailyPortIn {
void operate(RemoveDailyReqVO reqVO);
}

View File

@@ -0,0 +1,7 @@
package app.module.admin.usecase.household.tab.dailyRecord.removeDaily.ports;
import app.module.admin.usecase.household.tab.dailyRecord.removeDaily.ports.application.domain.RemoveDailyCmd;
public interface RemoveDailyPortOut {
void operate(RemoveDailyCmd command);
}

View File

@@ -0,0 +1,26 @@
package app.module.admin.usecase.household.tab.dailyRecord.removeDaily.ports.application;
import app.module.admin.usecase.household.tab.dailyRecord.removeDaily.adapters.web.modal.RemoveDailyReqVO;
import app.module.admin.usecase.household.tab.dailyRecord.removeDaily.ports.RemoveDailyPortIn;
import app.module.admin.usecase.household.tab.dailyRecord.removeDaily.ports.RemoveDailyPortOut;
import app.module.admin.usecase.household.tab.dailyRecord.removeDaily.ports.application.domain.RemoveDailyCmd;
import app.module.core.config.application.util.AuditUtil;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
@Service
@RequiredArgsConstructor
public class RemoveDailyService implements RemoveDailyPortIn {
private final RemoveDailyPortOut portOut;
@Override
public void operate(RemoveDailyReqVO reqVO) {
RemoveDailyCmd command = AuditUtil.update(
new RemoveDailyCmd(
reqVO.getSelectedIds(),
reqVO.getCurrentStep())
);
portOut.operate(command);
}
}

View File

@@ -0,0 +1,26 @@
package app.module.admin.usecase.household.tab.dailyRecord.removeDaily.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;
import lombok.ToString;
import java.util.Set;
@Getter
@Setter
@ToString
@AllArgsConstructor
public class RemoveDailyCmd extends AuditCommand {
/**
* 항목 일련번호
*/
private Set<Long> removeIds;
/**
* 현재 단계
*/
private DailySort currentStep;
}

View File

@@ -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("[UpdateDailyNone] Current step is null. cmd: {}", command);
}
}
}

View File

@@ -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);
}

View File

@@ -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);
}
}

View File

@@ -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;
}

View File

@@ -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);
}

View File

@@ -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);
}

View File

@@ -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);
}
}

View File

@@ -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;
}

View File

@@ -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<GetForestProductsStatus> forestProducts = mapper.getForestProductsStatus(cmd);

View File

@@ -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> getForestProductsStatus(GetForestProductsStatusCmd cmd);
}

View File

@@ -11,6 +11,6 @@ import lombok.Setter;
@AllArgsConstructor
@EqualsAndHashCode
public class GetForestProductsStatusResult {
private String monthlyStatus;
private GetMonthlyForestProductsStatus monthlyStatus;
private List<GetForestProductsStatus> forestProducts;
}

View File

@@ -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;
}

View File

@@ -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()));
}
}
}

View File

@@ -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);
}

View File

@@ -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")));
}
}

View File

@@ -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<Long> forestRemoveIds;
}

View File

@@ -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;
}

View File

@@ -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);
}

View File

@@ -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);
}

View File

@@ -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);
}
}

View File

@@ -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<Long> removeIds;
}

View File

@@ -0,0 +1,40 @@
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;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;
@Repository
@RequiredArgsConstructor
class SaveForestProductDao implements SaveForestProductPortOut {
private final SaveForestProductMapper saveForestProductMapper;
private final UpdateMonthlyInputStatusMapper updateMonthlyInputStatusMapper;
@Override
@Transactional
public void operate(SaveForestProductCmd inCmd) {
if (inCmd.getForestProductId() == null) {
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 {
// 임산물 현황 update
saveForestProductMapper.updateForestProduct(AuditUtil.update(inCmd));
}
}
}

View File

@@ -0,0 +1,11 @@
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 {
String getForestProductStatus(Long monthlyInputStatusId);
void createForestProduct(SaveForestProductCmd cmd);
void updateForestProduct(SaveForestProductCmd cmd);
}

View File

@@ -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")));
}
}

View File

@@ -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;
}

View File

@@ -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;
}

View File

@@ -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", "재배 작물명을 입력해주세요.");
}
}
}

View File

@@ -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);
}

View File

@@ -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);
}

View File

@@ -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);
}
}

View File

@@ -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;
}

View File

@@ -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())));
}
}

View File

@@ -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);
}

View File

@@ -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")));
}
}

View File

@@ -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;
}

View File

@@ -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;
}

View File

@@ -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);
}

View File

@@ -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);
}

View File

@@ -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"
));
}
}

View File

@@ -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;
}

View File

@@ -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;
}

View File

@@ -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;
}

View File

@@ -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(

View File

@@ -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);
}

View File

@@ -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);
}

View File

@@ -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;

View File

@@ -34,6 +34,7 @@
)
SELECT
dr.id AS id,
ddg.group_no AS day_group_no,
/* 해당 월의 말일을 기준으로 종료일을 제한하여 일자 그룹 표시 */
ddg.start_day ||
CASE

View File

@@ -4,9 +4,10 @@
<mapper
namespace="app.module.admin.usecase.household.tab.forestProduct.getForestProductsStatus.adapters.persistence.GetForestProductsStatusMapper">
<select id="getMonthlyStatus" resultType="java.lang.String">
<select id="getMonthlyStatus" resultType="app.module.admin.usecase.household.tab.forestProduct.getForestProductsStatus.ports.application.domain.GetMonthlyForestProductsStatus">
/* getMonthlyStatus : 임산물 현황 등록 상태 조회 */
SELECT forest_product_status
SELECT id,
forest_product_status
FROM monthly_input_status mis
WHERE household_seq = #{householdSeq}
AND month = #{recordMonth}

View File

@@ -83,9 +83,15 @@
<where>
1=1
<if test="cmd.ownerField != null and cmd.ownerField != '' and cmd.ownerValue != ''">
<if test="cmd.ownerValue != null and cmd.ownerValue != ''">
/* 경영주 검색 */
<choose>
<when test="cmd.ownerField == ''">
AND (
hvr.householdName ILIKE '%' || #{cmd.ownerValue} || '%'
OR hvr.householdPhone ILIKE '%' || #{cmd.ownerValue} || '%'
)
</when>
<when test="cmd.ownerField eq 'name'">
AND hvr.householdName ILIKE '%' || #{cmd.ownerValue} || '%'
</when>
@@ -95,9 +101,15 @@
</choose>
</if>
<if test="cmd.researcherField != null and cmd.researcherField != '' and cmd.researcherValue != ''">
<if test="cmd.researcherValue != null and cmd.researcherValue != ''">
/* 조사원 검색 */
<choose>
<when test="cmd.researcherField == ''">
AND (
hvr.researcherName ILIKE '%' || #{cmd.researcherValue} || '%'
OR hvr.researcherPhone ILIKE '%' || #{cmd.researcherValue} || '%'
)
</when>
<when test="cmd.researcherField eq 'name'">
AND hvr.researcherName ILIKE '%' || #{cmd.researcherValue} || '%'
</when>

View File

@@ -0,0 +1,62 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="app.module.admin.usecase.household.tab.dailyRecord.removeDaily.adapters.persistence.RemoveDailyMapper">
<select id="removeDailyIncome">
<if test="removeIds != null and removeIds != ''">
update daily_income set
<include refid="common.fields.DeleteBaseSet"/>
where is_deleted = false
and id IN
<foreach collection="removeIds" item="id" open="(" separator="," close=")">
#{id}
</foreach>
</if>
</select>
<select id="removeDailyWork">
<if test="removeIds != null and removeIds != ''">
update daily_work set
<include refid="common.fields.DeleteBaseSet"/>
where is_deleted = false
and daily_record_seq = #{dailyRecordSeq}
</if>
</select>
<select id="removeDailyExpense">
<if test="removeIds != null and removeIds != ''">
update daily_expense set
<include refid="common.fields.DeleteBaseSet"/>
where is_deleted = false
and daily_record_seq = #{dailyRecordSeq}
</if>
</select>
<select id="removeDailyPower">
<if test="removeIds != null and removeIds != ''">
update daily_power set
<include refid="common.fields.DeleteBaseSet"/>
where is_deleted = false
and daily_record_seq = #{dailyRecordSeq}
</if>
</select>
<select id="removeDailyForestry">
<if test="removeIds != null and removeIds != ''">
update daily_forestry set
<include refid="common.fields.DeleteBaseSet"/>
where is_deleted = false
and daily_record_seq = #{dailyRecordSeq}
</if>
</select>
<select id="removeDailyFarming">
<if test="removeIds != null and removeIds != ''">
update daily_farming set
<include refid="common.fields.DeleteBaseSet"/>
where is_deleted = false
and daily_record_seq = #{dailyRecordSeq}
</if>
</select>
</mapper>

View File

@@ -0,0 +1,25 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper
namespace="app.module.admin.usecase.household.tab.forestProduct.removeForestProducts.adapters.persistence.RemoveForestProductsMapper">
<update id="removeForestProducts">
/* removeForestProducts : 임산물현황 삭제*/
UPDATE forest_product
SET <include refid="common.fields.DeleteBaseSet"/>
WHERE id IN
<foreach collection="removeIds" item="id" open="(" separator="," close=")">
#{id}
</foreach>
</update>
<select id="existsForestProduct" resultType="boolean">
/* existsForestProduct : 임산물현황 존재 여부 */
SELECT EXISTS (
SELECT 1
FROM forest_product
WHERE is_deleted = false
AND monthly_input_status_id = #{monthlyInputStatusId}
)
</select>
</mapper>

View File

@@ -3,13 +3,13 @@
"http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper
namespace="app.module.admin.usecase.household.tab.householdVisit.removeHouseholdVisitInfos.adapters.persistence.RemoveHouseholdVisitInfosMapper">
<update id="removeHouseholdVisitInfos">
/* removeHouseholdVisitInfos : 임가방문정보 삭제 */
UPDATE household_visit
SET <include refid="common.fields.DeleteBaseSet"/>
WHERE id IN
<foreach collection="removeIds" item="id" open="(" separator="," close=")">
#{id}
</foreach>
</update>
<update id="removeHouseholdVisitInfos">
/* removeHouseholdVisitInfos : 임가방문정보 삭제 */
UPDATE household_visit
SET <include refid="common.fields.DeleteBaseSet"/>
WHERE id IN
<foreach collection="removeIds" item="id" open="(" separator="," close=")">
#{id}
</foreach>
</update>
</mapper>

View File

@@ -0,0 +1,95 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper
namespace="app.module.admin.usecase.household.tab.forestProduct.saveForestProduct.adapters.persistence.SaveForestProductMapper">
<select id="getForestProductStatus" resultType="java.lang.String">
/* getForestProductStatus : 임산물 현황 입력상태 조회 */
SELECT forest_product_status
FROM monthly_input_status
WHERE id = #{monthlyInputStatusId}
</select>
<insert id="createForestProduct">
/* 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,
<include refid="common.fields.CreateUpdateBaseColumns"/>
)
VALUES
(
#{householdSeq},
#{recordMonth},
#{streetNum},
#{landType},
#{town},
#{cropName},
#{landArea},
#{availableArea},
#{mainYield},
#{mainYieldUnitCode},
#{mainYieldUnit},
#{mainSaleAmount},
#{mainSaleUnitCode},
#{mainSaleUnit},
#{subYield},
#{subYieldUnitCode},
#{subYieldUnit},
#{subSaleAmount},
#{subSaleUnitCode},
#{subSaleUnit},
#{monthlyInputStatusId},
<include refid="common.fields.CreateUpdateBaseValues"/>
)
</insert>
<update id="updateForestProduct">
/* 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},
<include refid="common.fields.UpdateBaseSet"/>
WHERE id = #{forestProductId}
</update>
</mapper>

View File

@@ -0,0 +1,68 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="app.module.admin.usecase.household.tab.dailyRecord.updateDailyNone.adapters.persistence.UpdateDailyNoneMapper">
<select id="getDailyRecordSeq">
select id
from daily_record
where is_deleted = false
and record_month = #{searchMonth}
and day_group_no = #{groupNo}
and household_seq = #{householdSeq}
</select>
<select id="removeDailyIncome">
<if test="dailyRecordSeq != null and dailyRecordSeq != ''">
update daily_income set
<include refid="common.fields.DeleteBaseSet"/>
where is_deleted = false
and daily_record_seq = #{dailyRecordSeq}
</if>
</select>
<select id="removeDailyWork">
<if test="dailyRecordSeq != null and dailyRecordSeq != ''">
update daily_work set
<include refid="common.fields.DeleteBaseSet"/>
where is_deleted = false
and daily_record_seq = #{dailyRecordSeq}
</if>
</select>
<select id="removeDailyExpense">
<if test="dailyRecordSeq != null and dailyRecordSeq != ''">
update daily_expense set
<include refid="common.fields.DeleteBaseSet"/>
where is_deleted = false
and daily_record_seq = #{dailyRecordSeq}
</if>
</select>
<select id="removeDailyPower">
<if test="dailyRecordSeq != null and dailyRecordSeq != ''">
update daily_power set
<include refid="common.fields.DeleteBaseSet"/>
where is_deleted = false
and daily_record_seq = #{dailyRecordSeq}
</if>
</select>
<select id="removeDailyForestry">
<if test="dailyRecordSeq != null and dailyRecordSeq != ''">
update daily_forestry set
<include refid="common.fields.DeleteBaseSet"/>
where is_deleted = false
and daily_record_seq = #{dailyRecordSeq}
</if>
</select>
<select id="removeDailyFarming">
<if test="dailyRecordSeq != null and dailyRecordSeq != ''">
update daily_farming set
<include refid="common.fields.DeleteBaseSet"/>
where is_deleted = false
and daily_record_seq = #{dailyRecordSeq}
</if>
</select>
</mapper>

View File

@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper
namespace="app.module.admin.usecase.household.tab.forestProduct.updateForestProductNone.adapters.persistence.UpdateForestProductNoneMapper">
<update id="removeForestProduct">
/* removeForestProduct : 임산물 현황 삭제 */
UPDATE forest_product
SET <include refid="common.fields.DeleteBaseSet" />
WHERE is_deleted = false
AND monthly_input_status_id = #{monthlyInputStatusId}
</update>
</mapper>

View File

@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper
namespace="app.module.admin.usecase.household.monthlyInputStatus.updateMonthlyInputStatus.adapters.persistence.UpdateMonthlyInputStatusMapper">
<update id="updateForestProductStatus">
/* updateForestProductStatus : 임산물현황 입력상태 수정 */
UPDATE monthly_input_status
SET forest_product_status = #{status},
<include refid="common.fields.UpdateBaseSet"/>
WHERE is_deleted = false
AND id = #{id}
</update>
</mapper>

View File

@@ -37,23 +37,16 @@
)
</insert>
<insert id="createNoticeHasUploadFile">
<!-- createNoticeHasUploadFile 게시글 등록 시, 첨부파일 join 데이터 등록 -->
INSERT INTO notice_has_upload_file
(
notice_id,
upload_files_id,
<include refid="common.fields.CreateUpdateBaseColumns"/>
)
VALUES
<update id="createNoticeUploadFile">
update upload_file
set mapping_id = #{id},
<include refid="common.fields.UpdateBaseSet"/>
where id IN (
<foreach collection="fileMappingIds" item="fileId" separator=",">
(
#{id},
#{fileId},
<include refid="common.fields.CreateUpdateBaseValues"/>
)
#{fileId}
</foreach>
</insert>
)
</update>
</mapper>

View File

@@ -29,8 +29,7 @@
resultType="app.module.admin.usecase.communication.notice.getNotice.ports.application.domain.GetNoticeUploadFile">
/* getUploadFiles 상세 게시글 조회 시, 첨부파일 조회 */
SELECT
awuf.notice_id AS noticeId,
awuf.upload_files_id AS uploadfileId,
uf.mapping_id,
uf.id AS id,
uf.created_at AS createdAt,
uf.created_by AS createdBy,
@@ -41,9 +40,7 @@
uf.origin_name AS originName,
uf.path AS path,
uf.type AS type
FROM notice_has_upload_file awuf
INNER JOIN upload_file uf
ON awuf.upload_files_id = uf.id
WHERE awuf.notice_id = #{id} AND awuf.is_deleted = false
FROM upload_file uf
WHERE uf.mapping_id = #{id} AND uf.is_deleted = false AND uf.type ='NOTICE'
</select>
</mapper>

View File

@@ -78,16 +78,15 @@
resultType="app.module.admin.usecase.communication.notice.getNoticesUI.ports.application.domain.GetNoticeFiles">
/* getUploadFiles : 게시물 리스트의 대표 이미지 */
SELECT
awuf.notice_id,
uf.mapping_id as notice_id,
uf.id,
uf.type,
uf.path,
uf.name,
uf.origin_name,
uf.file_length
FROM notice_has_upload_file awuf
INNER JOIN upload_file uf ON awuf.upload_files_id = uf.id
WHERE awuf.notice_id IN
FROM upload_file uf
WHERE uf.mapping_id IN
<foreach collection="ids" item="id" open="(" separator="," close=")">
#{id}
</foreach>

View File

@@ -13,11 +13,11 @@
</foreach>
</update>
<update id="deleteNoticeHasFiles">
/* deleteNoticeHasFiles : 게시물-파일 매핑 논리 삭제 */
UPDATE notice_has_upload_file
<update id="deleteNoticeUploadFiles">
/* deleteNoticeUploadFiles : 게시물-파일 매핑 논리 삭제 */
UPDATE upload_file
SET <include refid="common.fields.DeleteBaseSet" />
WHERE notice_id IN
WHERE type='NOTICE' and mapping_id IN
<foreach collection="removeIds" item="id" open="(" separator="," close=")">
#{id}
</foreach>

View File

@@ -4,32 +4,6 @@
<mapper
namespace="app.module.admin.usecase.communication.notice.updateNotice.adapters.persistence.UpdateNoticeMapper">
<update id="deleteFileUploads">
/* deleteFileUploads 게시글 수정 시, 첨부파일 join 데이터 삭제 */
UPDATE notice_has_upload_file
SET
<include refid="common.fields.DeleteBaseSet"/>
WHERE notice_id = #{noticeId}
</update>
<insert id="createFileUploads">
/* createFileUploads 게시글 수정 시, 첨부파일 join 데이터 등록 */
INSERT INTO notice_has_upload_file
(
notice_id,
upload_files_id,
<include refid="common.fields.CreateUpdateBaseColumns"/>
)
VALUES
<foreach collection="fileMappingId" item="fileId" separator=",">
(
#{id},
#{fileId},
<include refid="common.fields.CreateUpdateBaseValues"/>
)
</foreach>
</insert>
<update id="updateNotice">
/* updateNotice 게시글 수정 */
UPDATE notice
@@ -42,4 +16,5 @@
<include refid="common.fields.UpdateBaseSet"/>
WHERE id = #{id}
</update>
</mapper>

View File

@@ -225,8 +225,15 @@
set visit_date = #{visitDate},
content = #{content},
management_type = #{managementType},
is_gift_sent = #{isGiftSent},
<include refid="common.fields.UpdateBaseSet" />
<choose>
<when test="isGiftSent">
is_gift_sent = true,
</when>
<when test="!isGiftSent">
is_gift_sent = false,
</when>
</choose>
<include refid="common.fields.UpdateBaseSet" />
where id = #{id}
</update>

View File

@@ -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.

View File

@@ -25,6 +25,7 @@
<meta property="og:description" th:content="${currentURI.ogDesc}" th:if="${currentURI != null}"/>
<meta property="og:keywords" th:content="${currentURI.ogKeywords}" th:if="${currentURI != null}"/>
<meta property="og:image" th:content="${currentURI.ogImage}" th:if="${currentURI != null}"/>
<meta name="robots" content="noindex, nofollow" th:if="${@environment.getProperty('spring.profiles.active') != 'prod'}">
<!-- 부트스트랩 css 숨김 처리 -->
<!-- <link rel="stylesheet" th:href="@{/static/library/bootstrap/bootstrap.min.css}"/>-->

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