Merge branch 'bo_daily' into dev
This commit is contained in:
@@ -0,0 +1,45 @@
|
|||||||
|
package app.module.admin.usecase.household.tab.dailyRecord.createDailyRecord.adapters.web;
|
||||||
|
|
||||||
|
import app.module.core.usecase.daily.record.adapters.persistence.model.DailyRecordDto;
|
||||||
|
import app.module.core.usecase.daily.record.adapters.web.model.CreateDailyRecordReqVO;
|
||||||
|
import app.module.core.usecase.daily.record.adapters.web.model.DailyUIReqVO;
|
||||||
|
import app.module.core.usecase.daily.record.ports.DailyRecordPortIn;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.http.HttpStatus;
|
||||||
|
import org.springframework.http.ResponseEntity;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
@Slf4j
|
||||||
|
@RestController
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
public class CreateDailyRecordController {
|
||||||
|
private final DailyRecordPortIn dailyRecordPortIn;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 일계부 항목 등록 처리
|
||||||
|
*
|
||||||
|
* @param formVO 입력 데이터
|
||||||
|
*/
|
||||||
|
@PostMapping(path = "/api/household/daily/create")
|
||||||
|
ResponseEntity<?> create(@RequestBody CreateDailyRecordReqVO formVO) {
|
||||||
|
|
||||||
|
formVO.setTodayNone("Y");
|
||||||
|
|
||||||
|
DailyUIReqVO reqVO = new DailyUIReqVO(formVO.getRecordMonth(), formVO.getDayGroupNo(), formVO.getHouseholdSeq());
|
||||||
|
log.debug("reqVO: {}", reqVO);
|
||||||
|
|
||||||
|
DailyRecordDto detail = dailyRecordPortIn.detail(reqVO.getSearchMonth(), reqVO.getGroupNo(), reqVO.getHouseholdSeq());
|
||||||
|
formVO.setRecordMonth(reqVO.getSearchMonth());
|
||||||
|
formVO.setDayGroupNo(reqVO.getGroupNo());
|
||||||
|
formVO.setStartDate(detail.getStartDate());
|
||||||
|
formVO.setEndDate(detail.getEndDate());
|
||||||
|
formVO.setFarming(detail.isFarmingOpen());
|
||||||
|
formVO.setHouseholdSeq(reqVO.getHouseholdSeq());
|
||||||
|
log.debug("formVO: {}", formVO);
|
||||||
|
|
||||||
|
dailyRecordPortIn.create(formVO);
|
||||||
|
|
||||||
|
return ResponseEntity.status(HttpStatus.OK).body(reqVO);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,27 +1,344 @@
|
|||||||
package app.module.admin.usecase.household.tab.dailyRecord.getDailyRecordStatusDetail.adapters.web;
|
package app.module.admin.usecase.household.tab.dailyRecord.getDailyRecordStatusDetail.adapters.web;
|
||||||
|
|
||||||
|
import app.module.admin.config.application.util.ExcelWriterUtil;
|
||||||
|
import app.module.admin.config.application.util.model.ExcelSheetDto;
|
||||||
|
import app.module.admin.usecase.household.getHouseholdStatus.ports.GetHouseholdStatusPortIn;
|
||||||
|
import app.module.admin.usecase.household.getHouseholdStatus.ports.application.domain.GetHouseholdStatus;
|
||||||
|
import app.module.admin.usecase.household.getHouseholdStatus.ports.application.domain.GetHouseholdStatusCmd;
|
||||||
import app.module.admin.usecase.household.tab.dailyRecord.getDailyRecordStatusDetail.adapters.web.model.GetDailyRecordStatusDetailReqVO;
|
import app.module.admin.usecase.household.tab.dailyRecord.getDailyRecordStatusDetail.adapters.web.model.GetDailyRecordStatusDetailReqVO;
|
||||||
import app.module.admin.usecase.household.tab.dailyRecord.getDailyRecordStatusDetail.ports.GetDailyRecordStatusDetailPortIn;
|
import app.module.admin.usecase.household.tab.dailyRecord.getDailyRecordStatusDetail.ports.GetDailyRecordStatusDetailPortIn;
|
||||||
import app.module.admin.usecase.household.tab.dailyRecord.getDailyRecordStatusDetail.ports.application.domain.GetDailyRecordStatusDetail;
|
import app.module.admin.usecase.household.tab.dailyRecord.getDailyRecordStatusDetail.ports.application.domain.*;
|
||||||
import app.module.admin.usecase.household.tab.dailyRecord.getDailyRecordStatusDetail.ports.application.domain.GetDailyRecordStatusCmd;
|
import app.module.admin.usecase.household.tab.dailyRecord.getDailyRecordsStatus.adapters.web.model.GetDailyRecordsStatusReqVO;
|
||||||
|
import app.module.admin.usecase.household.tab.dailyRecord.getDailyRecordsStatus.ports.application.domain.GetDailyRecordsStatus;
|
||||||
|
import app.module.admin.usecase.household.tab.dailyRecord.getDailyRecordsStatus.ports.application.domain.GetDailyRecordsStatusCmd;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
import org.apache.poi.ss.usermodel.IndexedColors;
|
||||||
|
import org.springframework.http.HttpHeaders;
|
||||||
import org.springframework.http.HttpStatus;
|
import org.springframework.http.HttpStatus;
|
||||||
|
import org.springframework.http.MediaType;
|
||||||
import org.springframework.http.ResponseEntity;
|
import org.springframework.http.ResponseEntity;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.net.URLEncoder;
|
||||||
|
import java.nio.charset.StandardCharsets;
|
||||||
|
import java.time.LocalDate;
|
||||||
|
import java.time.format.DateTimeFormatter;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
@RestController
|
@RestController
|
||||||
@RequiredArgsConstructor
|
@RequiredArgsConstructor
|
||||||
class GetDailyRecordStatusDetailController {
|
class GetDailyRecordStatusDetailController {
|
||||||
private final GetDailyRecordStatusDetailPortIn portIn;
|
private final GetDailyRecordStatusDetailPortIn portIn;
|
||||||
|
private final GetHouseholdStatusPortIn getHouseholdStatusPortIn;
|
||||||
|
|
||||||
@GetMapping(path = "/api/household/dailyRecordStatus")
|
@GetMapping(path = "/api/household/dailyRecordStatus")
|
||||||
ResponseEntity<GetDailyRecordStatusDetail> operate(
|
ResponseEntity<GetDailyRecordStatusDetail> operate(
|
||||||
GetDailyRecordStatusDetailReqVO reqVO) {
|
GetDailyRecordStatusDetailReqVO reqVO) {
|
||||||
|
|
||||||
GetDailyRecordStatusDetail recordView =
|
GetDailyRecordStatusDetail recordView =
|
||||||
portIn.operate(new GetDailyRecordStatusCmd(reqVO.getRecordSeq())).orElse(null);
|
portIn.operate(new GetDailyRecordStatusCmd(reqVO.getRecordSeq())).orElse(null);
|
||||||
|
|
||||||
return ResponseEntity.status(HttpStatus.OK).body(recordView);
|
return ResponseEntity.status(HttpStatus.OK).body(recordView);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 일계부 상세 현황 엑셀 다운로드
|
||||||
|
*
|
||||||
|
* @param reqVO 검색 조건
|
||||||
|
* @return 엑셀 파일 다운로드
|
||||||
|
*/
|
||||||
|
@GetMapping("/api/household/dailyRecordStatus/excel")
|
||||||
|
public ResponseEntity<byte[]> exportHouseholdExcel(GetDailyRecordStatusDetailReqVO reqVO) {
|
||||||
|
|
||||||
|
String householdNum = "-";
|
||||||
|
String ownerName = "-";
|
||||||
|
GetHouseholdStatus householdInfo = getHouseholdStatusPortIn.operate(new GetHouseholdStatusCmd(reqVO.getHouseholdSeq())).orElse(null);
|
||||||
|
if (householdInfo != null) {
|
||||||
|
householdNum = householdInfo.getHouseholdNum();
|
||||||
|
ownerName = householdInfo.getHouseholdName();
|
||||||
|
}
|
||||||
|
|
||||||
|
GetDailyRecordStatusDetail recordView = portIn.operate(
|
||||||
|
new GetDailyRecordStatusCmd(reqVO.getRecordMonth(), reqVO.getHouseholdSeq())).orElse(null);
|
||||||
|
|
||||||
|
// 시트 : 등록 현황 목록
|
||||||
|
ExcelSheetDto sheet1 = this.getIncomeSheet(recordView, householdNum, ownerName);
|
||||||
|
ExcelSheetDto sheet2 = this.getWorkSheet(recordView, householdNum, ownerName);
|
||||||
|
ExcelSheetDto sheet3 = this.getExpenseSheet(recordView, householdNum, ownerName);
|
||||||
|
ExcelSheetDto sheet4 = this.getPowerSheet(recordView, householdNum, ownerName);
|
||||||
|
ExcelSheetDto sheet5 = this.getForestrySheet(recordView, householdNum, ownerName);
|
||||||
|
ExcelSheetDto sheet6 = this.getFarmingSheet(recordView, householdNum, ownerName);
|
||||||
|
|
||||||
|
// 시트 모음
|
||||||
|
List<ExcelSheetDto> sheets = List.of(sheet1, sheet2, sheet3, sheet4, sheet5, sheet6);
|
||||||
|
|
||||||
|
byte[] excel = ExcelWriterUtil.writeExcel(sheets);
|
||||||
|
|
||||||
|
String rawFileName = "03. 일계부 등록 내용[" + reqVO.getRecordMonth() + "][" + householdNum + "]_" + 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);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 수입 엑셀 시트 생성
|
||||||
|
*
|
||||||
|
* @param recordView 조회 데이터
|
||||||
|
* @param householdNum 임가번호
|
||||||
|
* @param ownerName 경영주 이름
|
||||||
|
* @return 엑셀 시트
|
||||||
|
*/
|
||||||
|
private ExcelSheetDto getIncomeSheet(GetDailyRecordStatusDetail recordView, String householdNum, String ownerName) {
|
||||||
|
List<List<String>> rows = new ArrayList<>();
|
||||||
|
if (recordView != null && !recordView.getIncomes().isEmpty()) {
|
||||||
|
for (GetDailyIncomeRecords record : recordView.getIncomes()) {
|
||||||
|
List<String> row = new ArrayList<>(List.of(householdNum, ownerName,
|
||||||
|
record.getStartDay(),
|
||||||
|
record.getEndDay(),
|
||||||
|
StringUtils.defaultString(record.getCategory()),
|
||||||
|
StringUtils.defaultString(record.getIncomeMark()),
|
||||||
|
StringUtils.defaultString(record.getExpenseMark())));
|
||||||
|
|
||||||
|
row.add(StringUtils.defaultString(record.getCropValue()));
|
||||||
|
row.add(StringUtils.defaultString(record.getIncomeKind()));
|
||||||
|
row.add(StringUtils.defaultString(record.getIncomeKindMark()));
|
||||||
|
row.add(StringUtils.defaultString(record.getSourcePurpose()));
|
||||||
|
row.add(StringUtils.defaultString(record.getQuantity()));
|
||||||
|
row.add(StringUtils.defaultString(record.getUnitText()));
|
||||||
|
row.add(StringUtils.defaultString(record.getPrice()));
|
||||||
|
row.add(StringUtils.defaultString(record.getEstimatedValue()));
|
||||||
|
|
||||||
|
rows.add(row);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return new ExcelSheetDto(
|
||||||
|
"수입",
|
||||||
|
List.of("임가번호", "경영주 성명", "날", "짜", "유형", "수입 부호", "지출 부호", "재배형태 코드", "수입의 종류", "종류 부호", "수입원", "수량", "단위", "현금(원)", "현물(평가액)"),
|
||||||
|
rows,
|
||||||
|
Set.of(13, 14),
|
||||||
|
Map.of(
|
||||||
|
0, IndexedColors.LIGHT_YELLOW,
|
||||||
|
2, IndexedColors.LIGHT_TURQUOISE,
|
||||||
|
3, IndexedColors.LIGHT_TURQUOISE
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 임업노동 엑셀 시트 생성
|
||||||
|
*
|
||||||
|
* @param recordView 조회 데이터
|
||||||
|
* @param householdNum 임가번호
|
||||||
|
* @param ownerName 경영주 이름
|
||||||
|
* @return 엑셀 시트
|
||||||
|
*/
|
||||||
|
private ExcelSheetDto getWorkSheet(GetDailyRecordStatusDetail recordView, String householdNum, String ownerName) {
|
||||||
|
List<List<String>> rows = new ArrayList<>();
|
||||||
|
if (recordView != null && !recordView.getWorks().isEmpty()) {
|
||||||
|
for (GetDailyWorkRecords record : recordView.getWorks()) {
|
||||||
|
List<String> row = new ArrayList<>(List.of(householdNum, ownerName,
|
||||||
|
record.getStartDay(),
|
||||||
|
record.getEndDay(),
|
||||||
|
StringUtils.defaultString(record.getItemName()),
|
||||||
|
StringUtils.defaultString(record.getItemMark()),
|
||||||
|
StringUtils.defaultString(record.getWorkName()),
|
||||||
|
StringUtils.defaultString(record.getWorkMark())));
|
||||||
|
|
||||||
|
row.add(StringUtils.defaultString(record.getWorkLandArea()));
|
||||||
|
row.add(StringUtils.defaultString(record.getAreaUnitText()));
|
||||||
|
row.add(StringUtils.defaultString(record.getHarvestQuantity()));
|
||||||
|
row.add(StringUtils.defaultString(record.getHarvestUnitText()));
|
||||||
|
row.add(StringUtils.defaultString(record.getOwnerTime()));
|
||||||
|
row.add(StringUtils.defaultString(record.getSpouseTime()));
|
||||||
|
row.add(StringUtils.defaultString(record.getFamilyMHours()));
|
||||||
|
row.add(StringUtils.defaultString(record.getFamilyFHours()));
|
||||||
|
row.add(StringUtils.defaultString(record.getHiredMHours()));
|
||||||
|
row.add(StringUtils.defaultString(record.getHiredFHours()));
|
||||||
|
row.add(StringUtils.defaultString(record.getSharedMHours()));
|
||||||
|
row.add(StringUtils.defaultString(record.getSharedFHours()));
|
||||||
|
row.add(StringUtils.defaultString(record.getVolunteerMHours()));
|
||||||
|
row.add(StringUtils.defaultString(record.getVolunteerFHours()));
|
||||||
|
|
||||||
|
rows.add(row);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return new ExcelSheetDto(
|
||||||
|
"임업노동 투입",
|
||||||
|
List.of("임가번호", "경영주 성명", "날", "짜", "품목명", "품목부호", "작업명", "작업 부호", "작업면적", "단위", "수확량", "단위",
|
||||||
|
"경영주", "배우자", "가족노동-남", "가족노동-여", "고용노동-남", "고용노동-여", "품앗이-남", "품앗이-여", "일손돕기-남", "일손돕기-여"),
|
||||||
|
rows,
|
||||||
|
null,
|
||||||
|
Map.of(
|
||||||
|
0, IndexedColors.LIGHT_YELLOW,
|
||||||
|
2, IndexedColors.LIGHT_TURQUOISE,
|
||||||
|
3, IndexedColors.LIGHT_TURQUOISE
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 지출 엑셀 시트 생성
|
||||||
|
*
|
||||||
|
* @param recordView 조회 데이터
|
||||||
|
* @param householdNum 임가번호
|
||||||
|
* @param ownerName 경영주 이름
|
||||||
|
* @return 엑셀 시트
|
||||||
|
*/
|
||||||
|
private ExcelSheetDto getExpenseSheet(GetDailyRecordStatusDetail recordView, String householdNum, String ownerName) {
|
||||||
|
List<List<String>> rows = new ArrayList<>();
|
||||||
|
if (recordView != null && !recordView.getExpenses().isEmpty()) {
|
||||||
|
for (GetDailyExpenseRecords record : recordView.getExpenses()) {
|
||||||
|
List<String> row = new ArrayList<>(List.of(householdNum, ownerName,
|
||||||
|
record.getStartDay(),
|
||||||
|
record.getEndDay(),
|
||||||
|
StringUtils.defaultString(record.getCategory()),
|
||||||
|
StringUtils.defaultString(record.getIncomeMark()),
|
||||||
|
StringUtils.defaultString(record.getExpenseMark())));
|
||||||
|
|
||||||
|
row.add(StringUtils.defaultString(record.getExpenseKind()));
|
||||||
|
row.add(StringUtils.defaultString(record.getExpenseKindMark()));
|
||||||
|
row.add(StringUtils.defaultString(record.getSourcePurpose()));
|
||||||
|
row.add(StringUtils.defaultString(record.getQuantity()));
|
||||||
|
row.add(StringUtils.defaultString(record.getUnitText()));
|
||||||
|
row.add(StringUtils.defaultString(record.getPrice()));
|
||||||
|
row.add(StringUtils.defaultString(record.getEstimatedValue()));
|
||||||
|
|
||||||
|
rows.add(row);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return new ExcelSheetDto(
|
||||||
|
"지출",
|
||||||
|
List.of("임가번호", "경영주 성명", "날", "짜", "유형", "수입 부호", "지출 부호", "지출의 종류", "종류 부호", "용도", "수량", "단위", "현금(원)", "현물(평가액)"),
|
||||||
|
rows,
|
||||||
|
Set.of(12, 13),
|
||||||
|
Map.of(
|
||||||
|
0, IndexedColors.LIGHT_YELLOW,
|
||||||
|
2, IndexedColors.LIGHT_TURQUOISE,
|
||||||
|
3, IndexedColors.LIGHT_TURQUOISE
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 동력 사용시간 엑셀 시트 생성
|
||||||
|
*
|
||||||
|
* @param recordView 조회 데이터
|
||||||
|
* @param householdNum 임가번호
|
||||||
|
* @param ownerName 경영주 이름
|
||||||
|
* @return 엑셀 시트
|
||||||
|
*/
|
||||||
|
private ExcelSheetDto getPowerSheet(GetDailyRecordStatusDetail recordView, String householdNum, String ownerName) {
|
||||||
|
List<List<String>> rows = new ArrayList<>();
|
||||||
|
if (recordView != null && !recordView.getPowers().isEmpty()) {
|
||||||
|
for (GetDailyPowerRecords record : recordView.getPowers()) {
|
||||||
|
rows.add(List.of(householdNum, ownerName,
|
||||||
|
record.getStartDay(),
|
||||||
|
record.getEndDay(),
|
||||||
|
StringUtils.defaultString(record.getEquipmentName()),
|
||||||
|
StringUtils.defaultString(record.getEquipmentMark()),
|
||||||
|
StringUtils.defaultString(record.getOwnedHours()),
|
||||||
|
StringUtils.defaultString(record.getLeasedHours())));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return new ExcelSheetDto(
|
||||||
|
"동력사용시간",
|
||||||
|
List.of("임가번호", "경영주 성명", "날", "짜", "명칭", "명칭 부호", "자가 사용시간", "임차 사용시간"),
|
||||||
|
rows,
|
||||||
|
null,
|
||||||
|
Map.of(
|
||||||
|
0, IndexedColors.LIGHT_YELLOW,
|
||||||
|
2, IndexedColors.LIGHT_TURQUOISE,
|
||||||
|
3, IndexedColors.LIGHT_TURQUOISE
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 임업 자가소비량 엑셀 시트 생성
|
||||||
|
*
|
||||||
|
* @param recordView 조회 데이터
|
||||||
|
* @param householdNum 임가번호
|
||||||
|
* @param ownerName 경영주 이름
|
||||||
|
* @return 엑셀 시트
|
||||||
|
*/
|
||||||
|
private ExcelSheetDto getForestrySheet(GetDailyRecordStatusDetail recordView, String householdNum, String ownerName) {
|
||||||
|
List<List<String>> rows = new ArrayList<>();
|
||||||
|
if (recordView != null && !recordView.getForestries().isEmpty()) {
|
||||||
|
for (GetDailyForestryRecords record : recordView.getForestries()) {
|
||||||
|
rows.add(List.of(householdNum, ownerName,
|
||||||
|
record.getStartDay(),
|
||||||
|
record.getEndDay(),
|
||||||
|
StringUtils.defaultString(record.getIncomeMark()),
|
||||||
|
StringUtils.defaultString(record.getExpenseMark()),
|
||||||
|
StringUtils.defaultString(record.getProductName()),
|
||||||
|
StringUtils.defaultString(record.getUsage()),
|
||||||
|
StringUtils.defaultString(record.getQuantity()),
|
||||||
|
StringUtils.defaultString(record.getUnitText()),
|
||||||
|
StringUtils.defaultString(record.getEstimatedValue())));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return new ExcelSheetDto(
|
||||||
|
"임업_자가소비량",
|
||||||
|
List.of("임가번호", "경영주 성명", "날", "짜", "수입 부호", "지출 부호", "생산물", "용도", "수량", "단위", "현물(평가액)"),
|
||||||
|
rows,
|
||||||
|
Set.of(10),
|
||||||
|
Map.of(
|
||||||
|
0, IndexedColors.LIGHT_YELLOW,
|
||||||
|
2, IndexedColors.LIGHT_TURQUOISE,
|
||||||
|
3, IndexedColors.LIGHT_TURQUOISE
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 농업 자가소비량 엑셀 시트 생성
|
||||||
|
*
|
||||||
|
* @param recordView 조회 데이터
|
||||||
|
* @param householdNum 임가번호
|
||||||
|
* @param ownerName 경영주 이름
|
||||||
|
* @return 엑셀 시트
|
||||||
|
*/
|
||||||
|
private ExcelSheetDto getFarmingSheet(GetDailyRecordStatusDetail recordView, String householdNum, String ownerName) {
|
||||||
|
List<List<String>> rows = new ArrayList<>();
|
||||||
|
if (recordView != null && !recordView.getFarmings().isEmpty()) {
|
||||||
|
for (GetDailyFarmingRecords record : recordView.getFarmings()) {
|
||||||
|
rows.add(List.of(householdNum, ownerName,
|
||||||
|
record.getStartDay(),
|
||||||
|
record.getEndDay(),
|
||||||
|
StringUtils.defaultString(record.getIncomeMark()),
|
||||||
|
StringUtils.defaultString(record.getExpenseMark()),
|
||||||
|
StringUtils.defaultString(record.getProductName()),
|
||||||
|
StringUtils.defaultString(record.getUsage()),
|
||||||
|
StringUtils.defaultString(record.getQuantity()),
|
||||||
|
StringUtils.defaultString(record.getUnitText()),
|
||||||
|
StringUtils.defaultString(record.getEstimatedValue())));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return new ExcelSheetDto(
|
||||||
|
"농업_자가소비량",
|
||||||
|
List.of("임가번호", "경영주 성명", "날", "짜", "수입 부호", "지출 부호", "생산물", "용도", "수량", "단위", "현물(평가액)"),
|
||||||
|
rows,
|
||||||
|
Set.of(10),
|
||||||
|
Map.of(
|
||||||
|
0, IndexedColors.LIGHT_YELLOW,
|
||||||
|
2, IndexedColors.LIGHT_TURQUOISE,
|
||||||
|
3, IndexedColors.LIGHT_TURQUOISE
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -11,4 +11,7 @@ import lombok.Setter;
|
|||||||
@EqualsAndHashCode
|
@EqualsAndHashCode
|
||||||
public class GetDailyRecordStatusDetailReqVO {
|
public class GetDailyRecordStatusDetailReqVO {
|
||||||
private Long recordSeq;
|
private Long recordSeq;
|
||||||
|
|
||||||
|
private String recordMonth;
|
||||||
|
private Long householdSeq;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,13 +7,15 @@ import lombok.Setter;
|
|||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
@Setter
|
@Setter
|
||||||
@AllArgsConstructor
|
|
||||||
@EqualsAndHashCode
|
|
||||||
public class GetDailyExpenseRecords {
|
public class GetDailyExpenseRecords {
|
||||||
private Long id;
|
private Long id;
|
||||||
private String inputType;
|
private String inputType;
|
||||||
|
private String category;
|
||||||
|
private String incomeMark;
|
||||||
|
private String expenseMark;
|
||||||
private Boolean isCredit;
|
private Boolean isCredit;
|
||||||
private String expenseKind;
|
private String expenseKind;
|
||||||
|
private String expenseKindMark;
|
||||||
private String sourcePurpose;
|
private String sourcePurpose;
|
||||||
private String quantity;
|
private String quantity;
|
||||||
private String unitCode;
|
private String unitCode;
|
||||||
@@ -22,4 +24,6 @@ public class GetDailyExpenseRecords {
|
|||||||
private String estimatedValue;
|
private String estimatedValue;
|
||||||
private String updatedBy;
|
private String updatedBy;
|
||||||
private String updatedAt;
|
private String updatedAt;
|
||||||
|
private String startDay;
|
||||||
|
private String endDay;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,15 +8,17 @@ import lombok.Setter;
|
|||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
@Setter
|
@Setter
|
||||||
@AllArgsConstructor
|
|
||||||
@EqualsAndHashCode
|
|
||||||
public class GetDailyFarmingRecords {
|
public class GetDailyFarmingRecords {
|
||||||
private Long id;
|
private Long id;
|
||||||
|
private String incomeMark;
|
||||||
|
private String expenseMark;
|
||||||
private String productName;
|
private String productName;
|
||||||
private String usage;
|
private String usage;
|
||||||
private BigDecimal quantity;
|
private String quantity;
|
||||||
private String unitText;
|
private String unitText;
|
||||||
private String estimatedValue;
|
private String estimatedValue;
|
||||||
private String updatedBy;
|
private String updatedBy;
|
||||||
private String updatedAt;
|
private String updatedAt;
|
||||||
|
private String startDay;
|
||||||
|
private String endDay;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,16 +8,18 @@ import lombok.Setter;
|
|||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
@Setter
|
@Setter
|
||||||
@AllArgsConstructor
|
|
||||||
@EqualsAndHashCode
|
|
||||||
public class GetDailyForestryRecords {
|
public class GetDailyForestryRecords {
|
||||||
private Long id;
|
private Long id;
|
||||||
|
private String incomeMark;
|
||||||
|
private String expenseMark;
|
||||||
private String productName;
|
private String productName;
|
||||||
private String usage;
|
private String usage;
|
||||||
private BigDecimal quantity;
|
private String quantity;
|
||||||
private String unitCode;
|
private String unitCode;
|
||||||
private String unitText;
|
private String unitText;
|
||||||
private String estimatedValue;
|
private String estimatedValue;
|
||||||
private String updatedBy;
|
private String updatedBy;
|
||||||
private String updatedAt;
|
private String updatedAt;
|
||||||
|
private String startDay;
|
||||||
|
private String endDay;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,21 +8,26 @@ import lombok.Setter;
|
|||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
@Setter
|
@Setter
|
||||||
@AllArgsConstructor
|
|
||||||
@EqualsAndHashCode
|
|
||||||
public class GetDailyIncomeRecords {
|
public class GetDailyIncomeRecords {
|
||||||
private Long id;
|
private Long id;
|
||||||
private String inputType;
|
private String inputType;
|
||||||
|
private String category;
|
||||||
|
private String incomeMark;
|
||||||
|
private String expenseMark;
|
||||||
private Boolean isCredit;
|
private Boolean isCredit;
|
||||||
private String cropCode;
|
private String cropCode;
|
||||||
|
private String cropValue;
|
||||||
private String cropText;
|
private String cropText;
|
||||||
private String incomeKind;
|
private String incomeKind;
|
||||||
|
private String incomeKindMark;
|
||||||
private String sourcePurpose;
|
private String sourcePurpose;
|
||||||
private BigDecimal quantity;
|
private String quantity;
|
||||||
private String unitCode;
|
private String unitCode;
|
||||||
private String unitText;
|
private String unitText;
|
||||||
private String price;
|
private String price;
|
||||||
private String estimatedValue;
|
private String estimatedValue;
|
||||||
private String updatedBy;
|
private String updatedBy;
|
||||||
private String updatedAt;
|
private String updatedAt;
|
||||||
|
private String startDay;
|
||||||
|
private String endDay;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,13 +8,14 @@ import lombok.Setter;
|
|||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
@Setter
|
@Setter
|
||||||
@AllArgsConstructor
|
|
||||||
@EqualsAndHashCode
|
|
||||||
public class GetDailyPowerRecords {
|
public class GetDailyPowerRecords {
|
||||||
private Long id;
|
private Long id;
|
||||||
private String equipmentName;
|
private String equipmentName;
|
||||||
private BigDecimal ownedHours;
|
private String equipmentMark;
|
||||||
private BigDecimal leasedHours;
|
private String ownedHours;
|
||||||
|
private String leasedHours;
|
||||||
private String updatedBy;
|
private String updatedBy;
|
||||||
private String updatedAt;
|
private String updatedAt;
|
||||||
|
private String startDay;
|
||||||
|
private String endDay;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,5 +10,24 @@ import lombok.Setter;
|
|||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
@EqualsAndHashCode
|
@EqualsAndHashCode
|
||||||
public class GetDailyRecordStatusCmd {
|
public class GetDailyRecordStatusCmd {
|
||||||
|
public GetDailyRecordStatusCmd(Long recordSeq) {
|
||||||
|
this.recordSeq = recordSeq;
|
||||||
|
}
|
||||||
|
|
||||||
|
public GetDailyRecordStatusCmd(String recordMonth, Long householdSeq) {
|
||||||
|
this.recordMonth = recordMonth;
|
||||||
|
this.householdSeq = householdSeq;
|
||||||
|
}
|
||||||
|
|
||||||
private Long recordSeq;
|
private Long recordSeq;
|
||||||
|
private Long householdSeq;
|
||||||
|
private String recordMonth;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 월 검색 여부
|
||||||
|
* @return true=월 검색, false=단일 검색
|
||||||
|
*/
|
||||||
|
public boolean isSearchMonth() {
|
||||||
|
return recordMonth != null && householdSeq != null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,12 +7,12 @@ import lombok.Setter;
|
|||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
@Setter
|
@Setter
|
||||||
@AllArgsConstructor
|
|
||||||
@EqualsAndHashCode
|
|
||||||
public class GetDailyWorkRecords {
|
public class GetDailyWorkRecords {
|
||||||
private Long id;
|
private Long id;
|
||||||
private String itemName;
|
private String itemName;
|
||||||
|
private String itemMark;
|
||||||
private String workName;
|
private String workName;
|
||||||
|
private String workMark;
|
||||||
private String workLandArea;
|
private String workLandArea;
|
||||||
private String areaUnitText;
|
private String areaUnitText;
|
||||||
private String harvestQuantity;
|
private String harvestQuantity;
|
||||||
@@ -29,4 +29,6 @@ public class GetDailyWorkRecords {
|
|||||||
private String volunteerFHours;
|
private String volunteerFHours;
|
||||||
private String updatedBy;
|
private String updatedBy;
|
||||||
private String updatedAt;
|
private String updatedAt;
|
||||||
|
private String startDay;
|
||||||
|
private String endDay;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,39 @@
|
|||||||
|
package app.module.admin.usecase.household.tab.dailyRecord.saveDailyExpense.adapters.persistence;
|
||||||
|
|
||||||
|
import app.module.admin.usecase.household.tab.dailyRecord.saveDailyExpense.adapters.persistence.modal.GetDailyExpenseDto;
|
||||||
|
import app.module.admin.usecase.household.tab.dailyRecord.saveDailyExpense.ports.SaveDailyExpensePortOut;
|
||||||
|
import app.module.admin.usecase.household.tab.dailyRecord.saveDailyExpense.ports.application.domain.GetDailyExpenseCmd;
|
||||||
|
import app.module.admin.usecase.household.tab.dailyRecord.saveDailyExpense.ports.application.domain.SaveDailyExpenseCmd;
|
||||||
|
import app.module.core.config.application.annotation.CreateCommand;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
@Slf4j
|
||||||
|
@Service
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
public class SaveDailyExpenseDao implements SaveDailyExpensePortOut {
|
||||||
|
private final SaveDailyExpenseMapper dailyExpenseMapper;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public GetDailyExpenseDto detail(GetDailyExpenseCmd command) {
|
||||||
|
|
||||||
|
return dailyExpenseMapper.getDailyExpense(command);
|
||||||
|
}
|
||||||
|
|
||||||
|
@CreateCommand
|
||||||
|
@Override
|
||||||
|
public void create(GetDailyExpenseCmd findCmd, SaveDailyExpenseCmd command) {
|
||||||
|
Integer existCount = dailyExpenseMapper.getRecordExistCount(findCmd);
|
||||||
|
if (existCount == 0) {
|
||||||
|
dailyExpenseMapper.createDailyExpense(command);
|
||||||
|
|
||||||
|
log.debug("[CreateDailyExpense] command={}", command);
|
||||||
|
} else {
|
||||||
|
dailyExpenseMapper.updateDailyExpense(command);
|
||||||
|
|
||||||
|
log.debug("[UpdateDailyExpense] command={}", command);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,39 @@
|
|||||||
|
package app.module.admin.usecase.household.tab.dailyRecord.saveDailyExpense.adapters.persistence;
|
||||||
|
|
||||||
|
import app.module.admin.usecase.household.tab.dailyRecord.saveDailyExpense.adapters.persistence.modal.GetDailyExpenseDto;
|
||||||
|
import app.module.admin.usecase.household.tab.dailyRecord.saveDailyExpense.ports.application.domain.GetDailyExpenseCmd;
|
||||||
|
import app.module.admin.usecase.household.tab.dailyRecord.saveDailyExpense.ports.application.domain.SaveDailyExpenseCmd;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
|
@Mapper
|
||||||
|
public interface SaveDailyExpenseMapper {
|
||||||
|
/**
|
||||||
|
* 일계부 지출 데이터 조회
|
||||||
|
*
|
||||||
|
* @param command 검색 조건
|
||||||
|
* @return 지출 데이터
|
||||||
|
*/
|
||||||
|
GetDailyExpenseDto getDailyExpense(GetDailyExpenseCmd command);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 일계부 지출 데이터 존재 여부
|
||||||
|
*
|
||||||
|
* @param command 검색 조건
|
||||||
|
* @return 중복 개수
|
||||||
|
*/
|
||||||
|
Integer getRecordExistCount(GetDailyExpenseCmd command);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 일계부 지출 등록
|
||||||
|
*
|
||||||
|
* @param command 등록 데이터
|
||||||
|
*/
|
||||||
|
void createDailyExpense(SaveDailyExpenseCmd command);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 일계부 지출 수정
|
||||||
|
*
|
||||||
|
* @param command 수정 데이터
|
||||||
|
*/
|
||||||
|
void updateDailyExpense(SaveDailyExpenseCmd command);
|
||||||
|
}
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
package app.module.admin.usecase.household.tab.dailyRecord.saveDailyExpense.adapters.persistence.modal;
|
||||||
|
|
||||||
|
import app.module.core.config.application.enums.DailyInputType;
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.Setter;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
public class GetDailyExpenseDto {
|
||||||
|
private Long id;
|
||||||
|
private Long dailyRecordSeq;
|
||||||
|
private DailyInputType inputType;
|
||||||
|
private Boolean credit;
|
||||||
|
private String expenseKind;
|
||||||
|
private String sourcePurpose;
|
||||||
|
private String quantity;
|
||||||
|
private String unitCode;
|
||||||
|
private String unitLabel;
|
||||||
|
private String unitSelf;
|
||||||
|
private Long price;
|
||||||
|
private Long estimatedValue;
|
||||||
|
}
|
||||||
@@ -0,0 +1,87 @@
|
|||||||
|
package app.module.admin.usecase.household.tab.dailyRecord.saveDailyExpense.adapters.web;
|
||||||
|
|
||||||
|
import app.module.admin.usecase.household.tab.dailyRecord.saveDailyExpense.adapters.persistence.modal.GetDailyExpenseDto;
|
||||||
|
import app.module.admin.usecase.household.tab.dailyRecord.saveDailyExpense.adapters.web.model.DailyExpenseUIReqVO;
|
||||||
|
import app.module.admin.usecase.household.tab.dailyRecord.saveDailyExpense.adapters.web.model.SaveDailyExpenseReqVO;
|
||||||
|
import app.module.admin.usecase.household.tab.dailyRecord.saveDailyExpense.adapters.web.validator.SaveDailyExpenseValidator;
|
||||||
|
import app.module.admin.usecase.household.tab.dailyRecord.saveDailyExpense.ports.SaveDailyExpensePortIn;
|
||||||
|
import app.module.core.config.application.exception.NoRecordDataException;
|
||||||
|
import app.module.core.usecase.daily.record.adapters.persistence.model.DailyRecordDto;
|
||||||
|
import app.module.core.usecase.daily.record.ports.DailyRecordPortIn;
|
||||||
|
import jakarta.validation.Valid;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.http.HttpStatus;
|
||||||
|
import org.springframework.http.ResponseEntity;
|
||||||
|
import org.springframework.validation.BindingResult;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
@Slf4j
|
||||||
|
@RestController
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
@RequestMapping(path = "/api/household/daily/expense")
|
||||||
|
public class SaveDailyExpenseController {
|
||||||
|
private final DailyRecordPortIn dailyRecordPortIn;
|
||||||
|
private final SaveDailyExpensePortIn dailyExpensePortIn;
|
||||||
|
private final SaveDailyExpenseValidator dailyExpenseValidator;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 일계부 지출 조회
|
||||||
|
*
|
||||||
|
* @param id 지출 일련번호
|
||||||
|
* @param reqVO 검색 조건
|
||||||
|
*/
|
||||||
|
@GetMapping(path = "/{id}")
|
||||||
|
ResponseEntity<?> detail(@PathVariable("id") String id, @ModelAttribute DailyExpenseUIReqVO reqVO) {
|
||||||
|
|
||||||
|
reqVO.setId(Long.parseLong(id));
|
||||||
|
|
||||||
|
GetDailyExpenseDto detail = dailyExpensePortIn.detail(reqVO);
|
||||||
|
if (detail == null) {
|
||||||
|
return ResponseEntity.status(HttpStatus.BAD_REQUEST).body(null);
|
||||||
|
}
|
||||||
|
|
||||||
|
return ResponseEntity.status(HttpStatus.OK).body(detail);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 일계부 지출 등록 처리
|
||||||
|
*
|
||||||
|
* @param formVO 입력 데이터
|
||||||
|
* @param bindingResult BindingResult
|
||||||
|
*/
|
||||||
|
@PostMapping(path = "/save")
|
||||||
|
ResponseEntity<?> create(@Valid @RequestBody SaveDailyExpenseReqVO formVO, BindingResult bindingResult) {
|
||||||
|
|
||||||
|
dailyExpenseValidator.validate(formVO, bindingResult);
|
||||||
|
if (bindingResult.hasErrors()) {
|
||||||
|
return ResponseEntity.status(HttpStatus.UNPROCESSABLE_ENTITY)
|
||||||
|
.body(bindingResult.getFieldErrors());
|
||||||
|
}
|
||||||
|
|
||||||
|
DailyRecordDto dailyRecord = this.vaildGetDailyRecord(formVO.getDailyId());
|
||||||
|
|
||||||
|
formVO.setSearchMonth(dailyRecord.getRecordMonth());
|
||||||
|
formVO.setGroupNo(dailyRecord.getGroupNo());
|
||||||
|
formVO.setDailyId(dailyRecord.getId());
|
||||||
|
log.debug("formVO: {}", formVO);
|
||||||
|
|
||||||
|
dailyExpensePortIn.create(formVO);
|
||||||
|
|
||||||
|
return ResponseEntity.status(HttpStatus.OK).body(formVO);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 일계부 유효성 체크 및 데이터 조회
|
||||||
|
*
|
||||||
|
* @param dailyRecordSeq 항목 일련번호
|
||||||
|
*/
|
||||||
|
private DailyRecordDto vaildGetDailyRecord(Long dailyRecordSeq) {
|
||||||
|
DailyRecordDto dailyRecord = dailyRecordPortIn.detail(dailyRecordSeq);
|
||||||
|
if (dailyRecord == null || dailyRecord.getId() == null) {
|
||||||
|
throw new NoRecordDataException();
|
||||||
|
}
|
||||||
|
|
||||||
|
return dailyRecord;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,30 @@
|
|||||||
|
package app.module.admin.usecase.household.tab.dailyRecord.saveDailyExpense.adapters.web.model;
|
||||||
|
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.Setter;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
public class DailyExpenseUIReqVO {
|
||||||
|
/**
|
||||||
|
* 검색 월(yyyyMM)
|
||||||
|
*/
|
||||||
|
private String searchMonth;
|
||||||
|
/**
|
||||||
|
* 검색 그룸번호
|
||||||
|
*/
|
||||||
|
private Integer groupNo;
|
||||||
|
/**
|
||||||
|
* 임가 일련번호
|
||||||
|
*/
|
||||||
|
private Long householdSeq;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 일계부 항목 일련번호
|
||||||
|
*/
|
||||||
|
private Long dailyId;
|
||||||
|
/**
|
||||||
|
* 지출 일련번호
|
||||||
|
*/
|
||||||
|
private Long id;
|
||||||
|
}
|
||||||
@@ -0,0 +1,51 @@
|
|||||||
|
package app.module.admin.usecase.household.tab.dailyRecord.saveDailyExpense.adapters.web.model;
|
||||||
|
|
||||||
|
import app.module.core.config.application.enums.DailyInputType;
|
||||||
|
import jakarta.validation.constraints.NotBlank;
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.Setter;
|
||||||
|
import lombok.ToString;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
@ToString(callSuper = true)
|
||||||
|
public class SaveDailyExpenseReqVO extends DailyExpenseUIReqVO {
|
||||||
|
/**
|
||||||
|
* 등록 유형
|
||||||
|
*/
|
||||||
|
private DailyInputType inputType;
|
||||||
|
/**
|
||||||
|
* 외상판매 여부
|
||||||
|
*/
|
||||||
|
private Boolean credit;
|
||||||
|
/**
|
||||||
|
* 지출의 종류 직접입력
|
||||||
|
*/
|
||||||
|
@NotBlank(message = "지출 종류를 입력해 주세요.")
|
||||||
|
private String expenseKind;
|
||||||
|
/**
|
||||||
|
* 용도
|
||||||
|
*/
|
||||||
|
@NotBlank(message = "용도를 입력해 주세요.")
|
||||||
|
private String sourcePurpose;
|
||||||
|
/**
|
||||||
|
* 수량
|
||||||
|
*/
|
||||||
|
private Double quantity;
|
||||||
|
/**
|
||||||
|
* 단위 코드
|
||||||
|
*/
|
||||||
|
private String unitCode;
|
||||||
|
/**
|
||||||
|
* 단위 직접 입력
|
||||||
|
*/
|
||||||
|
private String unitSelf;
|
||||||
|
/**
|
||||||
|
* 현금
|
||||||
|
*/
|
||||||
|
private Long price;
|
||||||
|
/**
|
||||||
|
* 현물평가액
|
||||||
|
*/
|
||||||
|
private Long estimatedValue;
|
||||||
|
}
|
||||||
@@ -0,0 +1,51 @@
|
|||||||
|
package app.module.admin.usecase.household.tab.dailyRecord.saveDailyExpense.adapters.web.validator;
|
||||||
|
|
||||||
|
import app.module.admin.usecase.household.tab.dailyRecord.saveDailyExpense.adapters.web.model.SaveDailyExpenseReqVO;
|
||||||
|
import app.module.core.config.constants.CommonConstants;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import org.apache.tika.utils.StringUtils;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
import org.springframework.validation.Errors;
|
||||||
|
import org.springframework.validation.Validator;
|
||||||
|
|
||||||
|
@Component
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
public class SaveDailyExpenseValidator implements Validator {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean supports(Class<?> clazz) {
|
||||||
|
return SaveDailyExpenseReqVO.class.equals(clazz);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void validate(Object target, Errors errors) {
|
||||||
|
SaveDailyExpenseReqVO vo = (SaveDailyExpenseReqVO) target;
|
||||||
|
|
||||||
|
if (vo.getQuantity() == null && !StringUtils.isBlank(vo.getUnitCode())) {
|
||||||
|
errors.rejectValue(
|
||||||
|
"quantity", "valid.common.required",
|
||||||
|
"수량을 입력해 주세요.");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (vo.getQuantity() != null && StringUtils.isBlank(vo.getUnitCode())) {
|
||||||
|
errors.rejectValue(
|
||||||
|
"unitCode", "valid.common.required",
|
||||||
|
"단위를 선택해 주세요.");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (CommonConstants.UNIT_CODE_SELF.equals(vo.getUnitCode()) && StringUtils.isBlank(vo.getUnitSelf())) {
|
||||||
|
errors.rejectValue(
|
||||||
|
"unitSelf", "valid.common.required",
|
||||||
|
"단위를 입력해 주세요.");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (vo.getPrice() == null && vo.getEstimatedValue() == null) {
|
||||||
|
errors.rejectValue(
|
||||||
|
"price", "valid.common.required",
|
||||||
|
"현금 또는 현물평가액을 입력해 주세요.");
|
||||||
|
errors.rejectValue(
|
||||||
|
"estimatedValue", "valid.common.required",
|
||||||
|
"현금 또는 현물평가액을 입력해 주세요.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
package app.module.admin.usecase.household.tab.dailyRecord.saveDailyExpense.ports;
|
||||||
|
|
||||||
|
|
||||||
|
import app.module.admin.usecase.household.tab.dailyRecord.saveDailyExpense.adapters.persistence.modal.GetDailyExpenseDto;
|
||||||
|
import app.module.admin.usecase.household.tab.dailyRecord.saveDailyExpense.adapters.web.model.DailyExpenseUIReqVO;
|
||||||
|
import app.module.admin.usecase.household.tab.dailyRecord.saveDailyExpense.adapters.web.model.SaveDailyExpenseReqVO;
|
||||||
|
|
||||||
|
public interface SaveDailyExpensePortIn {
|
||||||
|
/**
|
||||||
|
* 일계부 지출 조회
|
||||||
|
*
|
||||||
|
* @param reqVO 검색 조건
|
||||||
|
* @return 지출 상세
|
||||||
|
*/
|
||||||
|
GetDailyExpenseDto detail(DailyExpenseUIReqVO reqVO);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 일계부 지출 등록
|
||||||
|
*
|
||||||
|
* @param formVO 입력 데이터
|
||||||
|
*/
|
||||||
|
void create(SaveDailyExpenseReqVO formVO);
|
||||||
|
}
|
||||||
@@ -0,0 +1,24 @@
|
|||||||
|
package app.module.admin.usecase.household.tab.dailyRecord.saveDailyExpense.ports;
|
||||||
|
|
||||||
|
|
||||||
|
import app.module.admin.usecase.household.tab.dailyRecord.saveDailyExpense.adapters.persistence.modal.GetDailyExpenseDto;
|
||||||
|
import app.module.admin.usecase.household.tab.dailyRecord.saveDailyExpense.ports.application.domain.GetDailyExpenseCmd;
|
||||||
|
import app.module.admin.usecase.household.tab.dailyRecord.saveDailyExpense.ports.application.domain.SaveDailyExpenseCmd;
|
||||||
|
|
||||||
|
public interface SaveDailyExpensePortOut {
|
||||||
|
/**
|
||||||
|
* 일계부 지출 조회
|
||||||
|
*
|
||||||
|
* @param command 검색 조건
|
||||||
|
* @return 지출 상세
|
||||||
|
*/
|
||||||
|
GetDailyExpenseDto detail(GetDailyExpenseCmd command);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 일계부 지출 등록
|
||||||
|
*
|
||||||
|
* @param findCmd 검색 조건
|
||||||
|
* @param command 입력 데이터
|
||||||
|
*/
|
||||||
|
void create(GetDailyExpenseCmd findCmd, SaveDailyExpenseCmd command);
|
||||||
|
}
|
||||||
@@ -0,0 +1,60 @@
|
|||||||
|
package app.module.admin.usecase.household.tab.dailyRecord.saveDailyExpense.ports.application;
|
||||||
|
|
||||||
|
import app.module.admin.usecase.household.tab.dailyRecord.saveDailyExpense.adapters.persistence.modal.GetDailyExpenseDto;
|
||||||
|
import app.module.admin.usecase.household.tab.dailyRecord.saveDailyExpense.adapters.web.model.DailyExpenseUIReqVO;
|
||||||
|
import app.module.admin.usecase.household.tab.dailyRecord.saveDailyExpense.adapters.web.model.SaveDailyExpenseReqVO;
|
||||||
|
import app.module.admin.usecase.household.tab.dailyRecord.saveDailyExpense.ports.SaveDailyExpensePortIn;
|
||||||
|
import app.module.admin.usecase.household.tab.dailyRecord.saveDailyExpense.ports.SaveDailyExpensePortOut;
|
||||||
|
import app.module.admin.usecase.household.tab.dailyRecord.saveDailyExpense.ports.application.domain.GetDailyExpenseCmd;
|
||||||
|
import app.module.admin.usecase.household.tab.dailyRecord.saveDailyExpense.ports.application.domain.SaveDailyExpenseCmd;
|
||||||
|
import app.module.core.config.constants.DailyRecordConstants;
|
||||||
|
import app.module.core.usecase.daily.record.ports.DailyRecordPortIn;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
public class SaveDailyExpenseService implements SaveDailyExpensePortIn {
|
||||||
|
private final SaveDailyExpensePortOut portOut;
|
||||||
|
private final DailyRecordPortIn dailyRecordPortIn;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public GetDailyExpenseDto detail(DailyExpenseUIReqVO reqVO) {
|
||||||
|
GetDailyExpenseCmd findCmd = new GetDailyExpenseCmd(
|
||||||
|
reqVO.getSearchMonth(),
|
||||||
|
reqVO.getGroupNo(),
|
||||||
|
reqVO.getHouseholdSeq(),
|
||||||
|
reqVO.getId());
|
||||||
|
|
||||||
|
return portOut.detail(findCmd);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void create(SaveDailyExpenseReqVO formVO) {
|
||||||
|
GetDailyExpenseCmd findCmd = new GetDailyExpenseCmd(
|
||||||
|
formVO.getSearchMonth(),
|
||||||
|
formVO.getGroupNo(),
|
||||||
|
formVO.getHouseholdSeq(),
|
||||||
|
formVO.getId());
|
||||||
|
|
||||||
|
SaveDailyExpenseCmd command =
|
||||||
|
new SaveDailyExpenseCmd(
|
||||||
|
formVO.getId(),
|
||||||
|
formVO.getDailyId(),
|
||||||
|
formVO.getInputType(),
|
||||||
|
DailyRecordConstants.EXPENSE_CATEGORY,
|
||||||
|
(formVO.getCredit() ? DailyRecordConstants.EXPENSE_INCOME_MARK : null),
|
||||||
|
formVO.getCredit(),
|
||||||
|
formVO.getExpenseKind(),
|
||||||
|
formVO.getSourcePurpose(),
|
||||||
|
formVO.getQuantity(),
|
||||||
|
formVO.getUnitCode(),
|
||||||
|
formVO.getUnitSelf(),
|
||||||
|
formVO.getPrice(),
|
||||||
|
formVO.getEstimatedValue());
|
||||||
|
|
||||||
|
portOut.create(findCmd, command);
|
||||||
|
|
||||||
|
dailyRecordPortIn.updateByAllStatus(findCmd.getSearchMonth(), findCmd.getGroupNo(), findCmd.getHouseholdSeq());
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,27 @@
|
|||||||
|
package app.module.admin.usecase.household.tab.dailyRecord.saveDailyExpense.ports.application.domain;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.Setter;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
@AllArgsConstructor
|
||||||
|
public class GetDailyExpenseCmd {
|
||||||
|
/**
|
||||||
|
* 검색 월(yyyyMM)
|
||||||
|
*/
|
||||||
|
private String searchMonth;
|
||||||
|
/**
|
||||||
|
* 검색 그룸번호
|
||||||
|
*/
|
||||||
|
private Integer groupNo;
|
||||||
|
/**
|
||||||
|
* 임가 일련번호
|
||||||
|
*/
|
||||||
|
private Long householdSeq;
|
||||||
|
/**
|
||||||
|
* 지출 일련번호
|
||||||
|
*/
|
||||||
|
private Long id;
|
||||||
|
}
|
||||||
@@ -0,0 +1,34 @@
|
|||||||
|
package app.module.admin.usecase.household.tab.dailyRecord.saveDailyExpense.ports.application.domain;
|
||||||
|
|
||||||
|
import app.module.core.config.adapters.persistence.component.AuditCommand;
|
||||||
|
import app.module.core.config.application.enums.DailyInputType;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.Setter;
|
||||||
|
import lombok.ToString;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
@AllArgsConstructor
|
||||||
|
@ToString
|
||||||
|
public class SaveDailyExpenseCmd extends AuditCommand {
|
||||||
|
private Long id;
|
||||||
|
private Long dailyRecordSeq;
|
||||||
|
private DailyInputType inputType;
|
||||||
|
/**
|
||||||
|
* 유형
|
||||||
|
*/
|
||||||
|
private String category;
|
||||||
|
/**
|
||||||
|
* 수입 부호
|
||||||
|
*/
|
||||||
|
private String incomeMark;
|
||||||
|
private Boolean credit;
|
||||||
|
private String expenseKind;
|
||||||
|
private String sourcePurpose;
|
||||||
|
private Double quantity;
|
||||||
|
private String unitCode;
|
||||||
|
private String unitSelf;
|
||||||
|
private Long price;
|
||||||
|
private Long estimatedValue;
|
||||||
|
}
|
||||||
@@ -0,0 +1,40 @@
|
|||||||
|
package app.module.admin.usecase.household.tab.dailyRecord.saveDailyFarming.adapters.persistence;
|
||||||
|
|
||||||
|
import app.module.admin.usecase.household.tab.dailyRecord.saveDailyFarming.adapters.persistence.SaveDailyFarmingMapper;
|
||||||
|
import app.module.admin.usecase.household.tab.dailyRecord.saveDailyFarming.adapters.persistence.modal.GetDailyFarmingDto;
|
||||||
|
import app.module.admin.usecase.household.tab.dailyRecord.saveDailyFarming.ports.SaveDailyFarmingPortOut;
|
||||||
|
import app.module.admin.usecase.household.tab.dailyRecord.saveDailyFarming.ports.application.domain.GetDailyFarmingCmd;
|
||||||
|
import app.module.admin.usecase.household.tab.dailyRecord.saveDailyFarming.ports.application.domain.SaveDailyFarmingCmd;
|
||||||
|
import app.module.core.config.application.annotation.CreateCommand;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
@Slf4j
|
||||||
|
@Service
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
public class SaveDailyFarmingDao implements SaveDailyFarmingPortOut {
|
||||||
|
private final SaveDailyFarmingMapper DailyFarmingMapper;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public GetDailyFarmingDto detail(GetDailyFarmingCmd command) {
|
||||||
|
|
||||||
|
return DailyFarmingMapper.getDailyFarming(command);
|
||||||
|
}
|
||||||
|
|
||||||
|
@CreateCommand
|
||||||
|
@Override
|
||||||
|
public void create(GetDailyFarmingCmd findCmd, SaveDailyFarmingCmd command) {
|
||||||
|
Integer existCount = DailyFarmingMapper.getRecordExistCount(findCmd);
|
||||||
|
if (existCount == 0) {
|
||||||
|
DailyFarmingMapper.createDailyFarming(command);
|
||||||
|
|
||||||
|
log.debug("[CreateDailyFarming] command={}", command);
|
||||||
|
} else {
|
||||||
|
DailyFarmingMapper.updateDailyFarming(command);
|
||||||
|
|
||||||
|
log.debug("[UpdateDailyFarming] command={}", command);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,39 @@
|
|||||||
|
package app.module.admin.usecase.household.tab.dailyRecord.saveDailyFarming.adapters.persistence;
|
||||||
|
|
||||||
|
import app.module.admin.usecase.household.tab.dailyRecord.saveDailyFarming.adapters.persistence.modal.GetDailyFarmingDto;
|
||||||
|
import app.module.admin.usecase.household.tab.dailyRecord.saveDailyFarming.ports.application.domain.GetDailyFarmingCmd;
|
||||||
|
import app.module.admin.usecase.household.tab.dailyRecord.saveDailyFarming.ports.application.domain.SaveDailyFarmingCmd;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
|
@Mapper
|
||||||
|
public interface SaveDailyFarmingMapper {
|
||||||
|
/**
|
||||||
|
* 일계부 농업생산 데이터 조회
|
||||||
|
*
|
||||||
|
* @param command 검색 조건
|
||||||
|
* @return 농업생산 데이터
|
||||||
|
*/
|
||||||
|
GetDailyFarmingDto getDailyFarming(GetDailyFarmingCmd command);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 일계부 농업생산 데이터 존재 여부
|
||||||
|
*
|
||||||
|
* @param command 검색 조건
|
||||||
|
* @return 중복 개수
|
||||||
|
*/
|
||||||
|
Integer getRecordExistCount(GetDailyFarmingCmd command);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 일계부 농업생산 등록
|
||||||
|
*
|
||||||
|
* @param command 등록 데이터
|
||||||
|
*/
|
||||||
|
void createDailyFarming(SaveDailyFarmingCmd command);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 일계부 농업생산 수정
|
||||||
|
*
|
||||||
|
* @param command 수정 데이터
|
||||||
|
*/
|
||||||
|
void updateDailyFarming(SaveDailyFarmingCmd command);
|
||||||
|
}
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
package app.module.admin.usecase.household.tab.dailyRecord.saveDailyFarming.adapters.persistence.modal;
|
||||||
|
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.Setter;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
public class GetDailyFarmingDto {
|
||||||
|
private Long id;
|
||||||
|
private Long dailyRecordSeq;
|
||||||
|
private String productCode;
|
||||||
|
private String productLabel;
|
||||||
|
private String productSelf;
|
||||||
|
private String usage;
|
||||||
|
private String quantity;
|
||||||
|
private String unitCode;
|
||||||
|
private String unitLabel;
|
||||||
|
private String unitSelf;
|
||||||
|
private Long estimatedValue;
|
||||||
|
}
|
||||||
@@ -0,0 +1,87 @@
|
|||||||
|
package app.module.admin.usecase.household.tab.dailyRecord.saveDailyFarming.adapters.web;
|
||||||
|
|
||||||
|
import app.module.admin.usecase.household.tab.dailyRecord.saveDailyFarming.adapters.persistence.modal.GetDailyFarmingDto;
|
||||||
|
import app.module.admin.usecase.household.tab.dailyRecord.saveDailyFarming.adapters.web.model.DailyFarmingUIReqVO;
|
||||||
|
import app.module.admin.usecase.household.tab.dailyRecord.saveDailyFarming.adapters.web.model.SaveDailyFarmingReqVO;
|
||||||
|
import app.module.admin.usecase.household.tab.dailyRecord.saveDailyFarming.adapters.web.validator.SaveDailyFarmingValidator;
|
||||||
|
import app.module.admin.usecase.household.tab.dailyRecord.saveDailyFarming.ports.SaveDailyFarmingPortIn;
|
||||||
|
import app.module.core.config.application.exception.NoRecordDataException;
|
||||||
|
import app.module.core.usecase.daily.record.adapters.persistence.model.DailyRecordDto;
|
||||||
|
import app.module.core.usecase.daily.record.ports.DailyRecordPortIn;
|
||||||
|
import jakarta.validation.Valid;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.http.HttpStatus;
|
||||||
|
import org.springframework.http.ResponseEntity;
|
||||||
|
import org.springframework.validation.BindingResult;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
@Slf4j
|
||||||
|
@RestController
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
@RequestMapping(path = "/api/household/daily/farming")
|
||||||
|
public class SaveDailyFarmingController {
|
||||||
|
private final DailyRecordPortIn dailyRecordPortIn;
|
||||||
|
private final SaveDailyFarmingPortIn DailyFarmingPortIn;
|
||||||
|
private final SaveDailyFarmingValidator DailyFarmingValidator;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 일계부 농업생산 조회
|
||||||
|
*
|
||||||
|
* @param id 농업생산 일련번호
|
||||||
|
* @param reqVO 검색 조건
|
||||||
|
*/
|
||||||
|
@GetMapping(path = "/{id}")
|
||||||
|
ResponseEntity<?> detail(@PathVariable("id") String id, @ModelAttribute DailyFarmingUIReqVO reqVO) {
|
||||||
|
|
||||||
|
reqVO.setId(Long.parseLong(id));
|
||||||
|
|
||||||
|
GetDailyFarmingDto detail = DailyFarmingPortIn.detail(reqVO);
|
||||||
|
if (detail == null) {
|
||||||
|
return ResponseEntity.status(HttpStatus.BAD_REQUEST).body(null);
|
||||||
|
}
|
||||||
|
|
||||||
|
return ResponseEntity.status(HttpStatus.OK).body(detail);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 일계부 농업생산 등록 처리
|
||||||
|
*
|
||||||
|
* @param formVO 입력 데이터
|
||||||
|
* @param bindingResult BindingResult
|
||||||
|
*/
|
||||||
|
@PostMapping(path = "/save")
|
||||||
|
ResponseEntity<?> create(@Valid @RequestBody SaveDailyFarmingReqVO formVO, BindingResult bindingResult) {
|
||||||
|
|
||||||
|
DailyFarmingValidator.validate(formVO, bindingResult);
|
||||||
|
if (bindingResult.hasErrors()) {
|
||||||
|
return ResponseEntity.status(HttpStatus.UNPROCESSABLE_ENTITY)
|
||||||
|
.body(bindingResult.getFieldErrors());
|
||||||
|
}
|
||||||
|
|
||||||
|
DailyRecordDto dailyRecord = this.vaildGetDailyRecord(formVO.getDailyId());
|
||||||
|
|
||||||
|
formVO.setSearchMonth(dailyRecord.getRecordMonth());
|
||||||
|
formVO.setGroupNo(dailyRecord.getGroupNo());
|
||||||
|
formVO.setDailyId(dailyRecord.getId());
|
||||||
|
log.debug("formVO: {}", formVO);
|
||||||
|
|
||||||
|
DailyFarmingPortIn.create(formVO);
|
||||||
|
|
||||||
|
return ResponseEntity.status(HttpStatus.OK).body(formVO);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 일계부 유효성 체크 및 데이터 조회
|
||||||
|
*
|
||||||
|
* @param dailyRecordSeq 항목 일련번호
|
||||||
|
*/
|
||||||
|
private DailyRecordDto vaildGetDailyRecord(Long dailyRecordSeq) {
|
||||||
|
DailyRecordDto dailyRecord = dailyRecordPortIn.detail(dailyRecordSeq);
|
||||||
|
if (dailyRecord == null || dailyRecord.getId() == null) {
|
||||||
|
throw new NoRecordDataException();
|
||||||
|
}
|
||||||
|
|
||||||
|
return dailyRecord;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,30 @@
|
|||||||
|
package app.module.admin.usecase.household.tab.dailyRecord.saveDailyFarming.adapters.web.model;
|
||||||
|
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.Setter;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
public class DailyFarmingUIReqVO {
|
||||||
|
/**
|
||||||
|
* 검색 월(yyyyMM)
|
||||||
|
*/
|
||||||
|
private String searchMonth;
|
||||||
|
/**
|
||||||
|
* 검색 그룸번호
|
||||||
|
*/
|
||||||
|
private Integer groupNo;
|
||||||
|
/**
|
||||||
|
* 임가 일련번호
|
||||||
|
*/
|
||||||
|
private Long householdSeq;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 일계부 항목 일련번호
|
||||||
|
*/
|
||||||
|
private Long dailyId;
|
||||||
|
/**
|
||||||
|
* 농업생산 일련번호
|
||||||
|
*/
|
||||||
|
private Long id;
|
||||||
|
}
|
||||||
@@ -0,0 +1,42 @@
|
|||||||
|
package app.module.admin.usecase.household.tab.dailyRecord.saveDailyFarming.adapters.web.model;
|
||||||
|
|
||||||
|
import app.module.admin.usecase.household.tab.dailyRecord.saveDailyFarming.adapters.web.model.DailyFarmingUIReqVO;
|
||||||
|
import jakarta.validation.constraints.NotBlank;
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.Setter;
|
||||||
|
import lombok.ToString;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
@ToString(callSuper = true)
|
||||||
|
public class SaveDailyFarmingReqVO extends DailyFarmingUIReqVO {
|
||||||
|
/**
|
||||||
|
* 생산물
|
||||||
|
*/
|
||||||
|
@NotBlank(message = "생산물을 선택해 주세요.")
|
||||||
|
private String productCode;
|
||||||
|
/**
|
||||||
|
* 생산물 직접 입력
|
||||||
|
*/
|
||||||
|
private String productSelf;
|
||||||
|
/**
|
||||||
|
* 용도
|
||||||
|
*/
|
||||||
|
private String usage;
|
||||||
|
/**
|
||||||
|
* 수량
|
||||||
|
*/
|
||||||
|
private Double quantity;
|
||||||
|
/**
|
||||||
|
* 단위 코드
|
||||||
|
*/
|
||||||
|
private String unitCode;
|
||||||
|
/**
|
||||||
|
* 단위 직접 입력
|
||||||
|
*/
|
||||||
|
private String unitSelf;
|
||||||
|
/**
|
||||||
|
* 현물평가액
|
||||||
|
*/
|
||||||
|
private Long estimatedValue;
|
||||||
|
}
|
||||||
@@ -0,0 +1,53 @@
|
|||||||
|
package app.module.admin.usecase.household.tab.dailyRecord.saveDailyFarming.adapters.web.validator;
|
||||||
|
|
||||||
|
import app.module.admin.usecase.household.tab.dailyRecord.saveDailyFarming.adapters.web.model.SaveDailyFarmingReqVO;
|
||||||
|
import app.module.core.config.constants.CommonConstants;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import org.apache.tika.utils.StringUtils;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
import org.springframework.validation.Errors;
|
||||||
|
import org.springframework.validation.Validator;
|
||||||
|
|
||||||
|
@Component
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
public class SaveDailyFarmingValidator implements Validator {
|
||||||
|
@Override
|
||||||
|
public boolean supports(Class<?> clazz) {
|
||||||
|
return SaveDailyFarmingReqVO.class.equals(clazz);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void validate(Object target, Errors errors) {
|
||||||
|
SaveDailyFarmingReqVO vo = (SaveDailyFarmingReqVO) target;
|
||||||
|
|
||||||
|
if ("code.record.farming.self".equals(vo.getProductCode()) && StringUtils.isBlank(vo.getProductSelf())) {
|
||||||
|
errors.rejectValue(
|
||||||
|
"productSelf", "valid.common.required",
|
||||||
|
"생산물을 입력해 주세요.");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (vo.getQuantity() == null && !StringUtils.isBlank(vo.getUnitCode())) {
|
||||||
|
errors.rejectValue(
|
||||||
|
"quantity", "valid.common.required",
|
||||||
|
"수량을 입력해 주세요.");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (vo.getQuantity() != null && StringUtils.isBlank(vo.getUnitCode())) {
|
||||||
|
errors.rejectValue(
|
||||||
|
"unitCode", "valid.common.required",
|
||||||
|
"단위를 선택해 주세요.");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (CommonConstants.UNIT_CODE_SELF.equals(vo.getUnitCode()) && StringUtils.isBlank(vo.getUnitSelf())) {
|
||||||
|
errors.rejectValue(
|
||||||
|
"unitSelf", "valid.common.required",
|
||||||
|
"단위를 입력해 주세요.");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (vo.getEstimatedValue() == null) {
|
||||||
|
errors.rejectValue(
|
||||||
|
"estimatedValue", "valid.common.required",
|
||||||
|
"현물평가액을 입력해 주세요.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
package app.module.admin.usecase.household.tab.dailyRecord.saveDailyFarming.ports;
|
||||||
|
|
||||||
|
import app.module.admin.usecase.household.tab.dailyRecord.saveDailyFarming.adapters.persistence.modal.GetDailyFarmingDto;
|
||||||
|
import app.module.admin.usecase.household.tab.dailyRecord.saveDailyFarming.adapters.web.model.DailyFarmingUIReqVO;
|
||||||
|
import app.module.admin.usecase.household.tab.dailyRecord.saveDailyFarming.adapters.web.model.SaveDailyFarmingReqVO;
|
||||||
|
|
||||||
|
public interface SaveDailyFarmingPortIn {
|
||||||
|
/**
|
||||||
|
* 일계부 농업생산 조회
|
||||||
|
*
|
||||||
|
* @param reqVO 검색 조건
|
||||||
|
* @return 농업생산 상세
|
||||||
|
*/
|
||||||
|
GetDailyFarmingDto detail(DailyFarmingUIReqVO reqVO);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 일계부 농업생산 등록
|
||||||
|
*
|
||||||
|
* @param formVO 입력 데이터
|
||||||
|
*/
|
||||||
|
void create(SaveDailyFarmingReqVO formVO);
|
||||||
|
}
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
package app.module.admin.usecase.household.tab.dailyRecord.saveDailyFarming.ports;
|
||||||
|
|
||||||
|
import app.module.admin.usecase.household.tab.dailyRecord.saveDailyFarming.adapters.persistence.modal.GetDailyFarmingDto;
|
||||||
|
import app.module.admin.usecase.household.tab.dailyRecord.saveDailyFarming.ports.application.domain.GetDailyFarmingCmd;
|
||||||
|
import app.module.admin.usecase.household.tab.dailyRecord.saveDailyFarming.ports.application.domain.SaveDailyFarmingCmd;
|
||||||
|
|
||||||
|
public interface SaveDailyFarmingPortOut {
|
||||||
|
/**
|
||||||
|
* 일계부 농업생산 조회
|
||||||
|
*
|
||||||
|
* @param command 검색 조건
|
||||||
|
* @return 농업생산 상세
|
||||||
|
*/
|
||||||
|
GetDailyFarmingDto detail(GetDailyFarmingCmd command);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 일계부 농업생산 등록
|
||||||
|
*
|
||||||
|
* @param findCmd 검색 조건
|
||||||
|
* @param command 입력 데이터
|
||||||
|
*/
|
||||||
|
void create(GetDailyFarmingCmd findCmd, SaveDailyFarmingCmd command);
|
||||||
|
}
|
||||||
@@ -0,0 +1,68 @@
|
|||||||
|
package app.module.admin.usecase.household.tab.dailyRecord.saveDailyFarming.ports.application;
|
||||||
|
|
||||||
|
import app.module.admin.usecase.household.tab.dailyRecord.saveDailyFarming.adapters.persistence.modal.GetDailyFarmingDto;
|
||||||
|
import app.module.admin.usecase.household.tab.dailyRecord.saveDailyFarming.adapters.web.model.DailyFarmingUIReqVO;
|
||||||
|
import app.module.admin.usecase.household.tab.dailyRecord.saveDailyFarming.adapters.web.model.SaveDailyFarmingReqVO;
|
||||||
|
import app.module.admin.usecase.household.tab.dailyRecord.saveDailyFarming.ports.SaveDailyFarmingPortIn;
|
||||||
|
import app.module.admin.usecase.household.tab.dailyRecord.saveDailyFarming.ports.SaveDailyFarmingPortOut;
|
||||||
|
import app.module.admin.usecase.household.tab.dailyRecord.saveDailyFarming.ports.application.domain.GetDailyFarmingCmd;
|
||||||
|
import app.module.admin.usecase.household.tab.dailyRecord.saveDailyFarming.ports.application.domain.SaveDailyFarmingCmd;
|
||||||
|
import app.module.core.config.application.util.DailyUtil;
|
||||||
|
import app.module.core.config.constants.DailyRecordConstants;
|
||||||
|
import app.module.core.usecase.daily.record.ports.DailyRecordPortIn;
|
||||||
|
import app.module.core.usecase.uicode.list.ports.UICodeListPortIn;
|
||||||
|
import app.module.core.usecase.uicode.list.ports.application.domain.UICodeElement;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
public class SaveDailyFarmingService implements SaveDailyFarmingPortIn {
|
||||||
|
private final SaveDailyFarmingPortOut portOut;
|
||||||
|
private final DailyRecordPortIn dailyRecordPortIn;
|
||||||
|
private final UICodeListPortIn uiCodeListPortIn;
|
||||||
|
private final DailyUtil dailyUtil;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public GetDailyFarmingDto detail(DailyFarmingUIReqVO reqVO) {
|
||||||
|
GetDailyFarmingCmd findCmd = new GetDailyFarmingCmd(
|
||||||
|
reqVO.getSearchMonth(),
|
||||||
|
reqVO.getGroupNo(),
|
||||||
|
reqVO.getHouseholdSeq(),
|
||||||
|
reqVO.getId());
|
||||||
|
|
||||||
|
return portOut.detail(findCmd);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void create(SaveDailyFarmingReqVO formVO) {
|
||||||
|
GetDailyFarmingCmd findCmd = new GetDailyFarmingCmd(
|
||||||
|
formVO.getSearchMonth(),
|
||||||
|
formVO.getGroupNo(),
|
||||||
|
formVO.getHouseholdSeq(),
|
||||||
|
formVO.getId());
|
||||||
|
|
||||||
|
HashMap<String, String> markMap = dailyUtil.getMarkByFarming(uiCodeListPortIn.connect("code.record.farming"), formVO.getProductCode());
|
||||||
|
|
||||||
|
SaveDailyFarmingCmd command =
|
||||||
|
new SaveDailyFarmingCmd(
|
||||||
|
formVO.getId(),
|
||||||
|
formVO.getDailyId(),
|
||||||
|
markMap.get("incomeMark"),
|
||||||
|
markMap.get("expenseMark"),
|
||||||
|
formVO.getProductCode(),
|
||||||
|
formVO.getProductSelf(),
|
||||||
|
formVO.getUsage(),
|
||||||
|
formVO.getQuantity(),
|
||||||
|
formVO.getUnitCode(),
|
||||||
|
formVO.getUnitSelf(),
|
||||||
|
formVO.getEstimatedValue());
|
||||||
|
|
||||||
|
portOut.create(findCmd, command);
|
||||||
|
|
||||||
|
dailyRecordPortIn.updateByAllStatus(findCmd.getSearchMonth(), findCmd.getGroupNo(), findCmd.getHouseholdSeq());
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,27 @@
|
|||||||
|
package app.module.admin.usecase.household.tab.dailyRecord.saveDailyFarming.ports.application.domain;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.Setter;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
@AllArgsConstructor
|
||||||
|
public class GetDailyFarmingCmd {
|
||||||
|
/**
|
||||||
|
* 검색 월(yyyyMM)
|
||||||
|
*/
|
||||||
|
private String searchMonth;
|
||||||
|
/**
|
||||||
|
* 검색 그룸번호
|
||||||
|
*/
|
||||||
|
private Integer groupNo;
|
||||||
|
/**
|
||||||
|
* 임가 일련번호
|
||||||
|
*/
|
||||||
|
private Long householdSeq;
|
||||||
|
/**
|
||||||
|
* 농업생산 일련번호
|
||||||
|
*/
|
||||||
|
private Long id;
|
||||||
|
}
|
||||||
@@ -0,0 +1,25 @@
|
|||||||
|
package app.module.admin.usecase.household.tab.dailyRecord.saveDailyFarming.ports.application.domain;
|
||||||
|
|
||||||
|
import app.module.core.config.adapters.persistence.component.AuditCommand;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.Setter;
|
||||||
|
import lombok.ToString;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
@AllArgsConstructor
|
||||||
|
@ToString
|
||||||
|
public class SaveDailyFarmingCmd extends AuditCommand {
|
||||||
|
private Long id;
|
||||||
|
private Long dailyRecordSeq;
|
||||||
|
private String incomeMark;
|
||||||
|
private String expenseMark;
|
||||||
|
private String productCode;
|
||||||
|
private String productSelf;
|
||||||
|
private String usage;
|
||||||
|
private Double quantity;
|
||||||
|
private String unitCode;
|
||||||
|
private String unitSelf;
|
||||||
|
private Long estimatedValue;
|
||||||
|
}
|
||||||
@@ -0,0 +1,39 @@
|
|||||||
|
package app.module.admin.usecase.household.tab.dailyRecord.saveDailyForestry.adapters.persistence;
|
||||||
|
|
||||||
|
import app.module.admin.usecase.household.tab.dailyRecord.saveDailyForestry.adapters.persistence.modal.GetDailyForestryDto;
|
||||||
|
import app.module.admin.usecase.household.tab.dailyRecord.saveDailyForestry.ports.SaveDailyForestryPortOut;
|
||||||
|
import app.module.admin.usecase.household.tab.dailyRecord.saveDailyForestry.ports.application.domain.GetDailyForestryCmd;
|
||||||
|
import app.module.admin.usecase.household.tab.dailyRecord.saveDailyForestry.ports.application.domain.SaveDailyForestryCmd;
|
||||||
|
import app.module.core.config.application.annotation.CreateCommand;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
@Slf4j
|
||||||
|
@Service
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
public class SaveDailyForestryDao implements SaveDailyForestryPortOut {
|
||||||
|
private final SaveDailyForestryMapper dailyForestryMapper;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public GetDailyForestryDto detail(GetDailyForestryCmd command) {
|
||||||
|
|
||||||
|
return dailyForestryMapper.getDailyForestry(command);
|
||||||
|
}
|
||||||
|
|
||||||
|
@CreateCommand
|
||||||
|
@Override
|
||||||
|
public void create(GetDailyForestryCmd findCmd, SaveDailyForestryCmd command) {
|
||||||
|
Integer existCount = dailyForestryMapper.getRecordExistCount(findCmd);
|
||||||
|
if (existCount == 0) {
|
||||||
|
dailyForestryMapper.createDailyForestry(command);
|
||||||
|
|
||||||
|
log.debug("[CreateDailyForestry] command={}", command);
|
||||||
|
} else {
|
||||||
|
dailyForestryMapper.updateDailyForestry(command);
|
||||||
|
|
||||||
|
log.debug("[UpdateDailyForestry] command={}", command);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,39 @@
|
|||||||
|
package app.module.admin.usecase.household.tab.dailyRecord.saveDailyForestry.adapters.persistence;
|
||||||
|
|
||||||
|
import app.module.admin.usecase.household.tab.dailyRecord.saveDailyForestry.adapters.persistence.modal.GetDailyForestryDto;
|
||||||
|
import app.module.admin.usecase.household.tab.dailyRecord.saveDailyForestry.ports.application.domain.GetDailyForestryCmd;
|
||||||
|
import app.module.admin.usecase.household.tab.dailyRecord.saveDailyForestry.ports.application.domain.SaveDailyForestryCmd;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
|
@Mapper
|
||||||
|
public interface SaveDailyForestryMapper {
|
||||||
|
/**
|
||||||
|
* 일계부 임업생산 데이터 조회
|
||||||
|
*
|
||||||
|
* @param command 검색 조건
|
||||||
|
* @return 임업생산 데이터
|
||||||
|
*/
|
||||||
|
GetDailyForestryDto getDailyForestry(GetDailyForestryCmd command);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 일계부 임업생산 데이터 존재 여부
|
||||||
|
*
|
||||||
|
* @param command 검색 조건
|
||||||
|
* @return 중복 개수
|
||||||
|
*/
|
||||||
|
Integer getRecordExistCount(GetDailyForestryCmd command);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 일계부 임업생산 등록
|
||||||
|
*
|
||||||
|
* @param command 등록 데이터
|
||||||
|
*/
|
||||||
|
void createDailyForestry(SaveDailyForestryCmd command);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 일계부 임업생산 수정
|
||||||
|
*
|
||||||
|
* @param command 수정 데이터
|
||||||
|
*/
|
||||||
|
void updateDailyForestry(SaveDailyForestryCmd command);
|
||||||
|
}
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
package app.module.admin.usecase.household.tab.dailyRecord.saveDailyForestry.adapters.persistence.modal;
|
||||||
|
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.Setter;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
public class GetDailyForestryDto {
|
||||||
|
private Long id;
|
||||||
|
private Long dailyRecordSeq;
|
||||||
|
private String productName;
|
||||||
|
private String usage;
|
||||||
|
private String quantity;
|
||||||
|
private String unitCode;
|
||||||
|
private String unitLabel;
|
||||||
|
private String unitSelf;
|
||||||
|
private Long estimatedValue;
|
||||||
|
}
|
||||||
@@ -0,0 +1,87 @@
|
|||||||
|
package app.module.admin.usecase.household.tab.dailyRecord.saveDailyForestry.adapters.web;
|
||||||
|
|
||||||
|
import app.module.admin.usecase.household.tab.dailyRecord.saveDailyForestry.adapters.persistence.modal.GetDailyForestryDto;
|
||||||
|
import app.module.admin.usecase.household.tab.dailyRecord.saveDailyForestry.adapters.web.model.DailyForestryUIReqVO;
|
||||||
|
import app.module.admin.usecase.household.tab.dailyRecord.saveDailyForestry.adapters.web.model.SaveDailyForestryReqVO;
|
||||||
|
import app.module.admin.usecase.household.tab.dailyRecord.saveDailyForestry.adapters.web.validator.SaveDailyForestryValidator;
|
||||||
|
import app.module.admin.usecase.household.tab.dailyRecord.saveDailyForestry.ports.SaveDailyForestryPortIn;
|
||||||
|
import app.module.core.config.application.exception.NoRecordDataException;
|
||||||
|
import app.module.core.usecase.daily.record.adapters.persistence.model.DailyRecordDto;
|
||||||
|
import app.module.core.usecase.daily.record.ports.DailyRecordPortIn;
|
||||||
|
import jakarta.validation.Valid;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.http.HttpStatus;
|
||||||
|
import org.springframework.http.ResponseEntity;
|
||||||
|
import org.springframework.validation.BindingResult;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
@Slf4j
|
||||||
|
@RestController
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
@RequestMapping(path = "/api/household/daily/forestry")
|
||||||
|
public class SaveDailyForestryController {
|
||||||
|
private final DailyRecordPortIn dailyRecordPortIn;
|
||||||
|
private final SaveDailyForestryPortIn dailyForestryPortIn;
|
||||||
|
private final SaveDailyForestryValidator dailyForestryValidator;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 일계부 임업생산 조회
|
||||||
|
*
|
||||||
|
* @param id 임업생산 일련번호
|
||||||
|
* @param reqVO 검색 조건
|
||||||
|
*/
|
||||||
|
@GetMapping(path = "/{id}")
|
||||||
|
ResponseEntity<?> detail(@PathVariable("id") String id, @ModelAttribute DailyForestryUIReqVO reqVO) {
|
||||||
|
|
||||||
|
reqVO.setId(Long.parseLong(id));
|
||||||
|
|
||||||
|
GetDailyForestryDto detail = dailyForestryPortIn.detail(reqVO);
|
||||||
|
if (detail == null) {
|
||||||
|
return ResponseEntity.status(HttpStatus.BAD_REQUEST).body(null);
|
||||||
|
}
|
||||||
|
|
||||||
|
return ResponseEntity.status(HttpStatus.OK).body(detail);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 일계부 임업생산 등록 처리
|
||||||
|
*
|
||||||
|
* @param formVO 입력 데이터
|
||||||
|
* @param bindingResult BindingResult
|
||||||
|
*/
|
||||||
|
@PostMapping(path = "/save")
|
||||||
|
ResponseEntity<?> create(@Valid @RequestBody SaveDailyForestryReqVO formVO, BindingResult bindingResult) {
|
||||||
|
|
||||||
|
dailyForestryValidator.validate(formVO, bindingResult);
|
||||||
|
if (bindingResult.hasErrors()) {
|
||||||
|
return ResponseEntity.status(HttpStatus.UNPROCESSABLE_ENTITY)
|
||||||
|
.body(bindingResult.getFieldErrors());
|
||||||
|
}
|
||||||
|
|
||||||
|
DailyRecordDto dailyRecord = this.vaildGetDailyRecord(formVO.getDailyId());
|
||||||
|
|
||||||
|
formVO.setSearchMonth(dailyRecord.getRecordMonth());
|
||||||
|
formVO.setGroupNo(dailyRecord.getGroupNo());
|
||||||
|
formVO.setDailyId(dailyRecord.getId());
|
||||||
|
log.debug("formVO: {}", formVO);
|
||||||
|
|
||||||
|
dailyForestryPortIn.create(formVO);
|
||||||
|
|
||||||
|
return ResponseEntity.status(HttpStatus.OK).body(formVO);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 일계부 유효성 체크 및 데이터 조회
|
||||||
|
*
|
||||||
|
* @param dailyRecordSeq 항목 일련번호
|
||||||
|
*/
|
||||||
|
private DailyRecordDto vaildGetDailyRecord(Long dailyRecordSeq) {
|
||||||
|
DailyRecordDto dailyRecord = dailyRecordPortIn.detail(dailyRecordSeq);
|
||||||
|
if (dailyRecord == null || dailyRecord.getId() == null) {
|
||||||
|
throw new NoRecordDataException();
|
||||||
|
}
|
||||||
|
|
||||||
|
return dailyRecord;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,30 @@
|
|||||||
|
package app.module.admin.usecase.household.tab.dailyRecord.saveDailyForestry.adapters.web.model;
|
||||||
|
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.Setter;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
public class DailyForestryUIReqVO {
|
||||||
|
/**
|
||||||
|
* 검색 월(yyyyMM)
|
||||||
|
*/
|
||||||
|
private String searchMonth;
|
||||||
|
/**
|
||||||
|
* 검색 그룸번호
|
||||||
|
*/
|
||||||
|
private Integer groupNo;
|
||||||
|
/**
|
||||||
|
* 임가 일련번호
|
||||||
|
*/
|
||||||
|
private Long householdSeq;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 일계부 항목 일련번호
|
||||||
|
*/
|
||||||
|
private Long dailyId;
|
||||||
|
/**
|
||||||
|
* 임업생산 일련번호
|
||||||
|
*/
|
||||||
|
private Long id;
|
||||||
|
}
|
||||||
@@ -0,0 +1,38 @@
|
|||||||
|
package app.module.admin.usecase.household.tab.dailyRecord.saveDailyForestry.adapters.web.model;
|
||||||
|
|
||||||
|
import app.module.admin.usecase.household.tab.dailyRecord.saveDailyPower.adapters.web.model.DailyPowerUIReqVO;
|
||||||
|
import jakarta.validation.constraints.NotBlank;
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.Setter;
|
||||||
|
import lombok.ToString;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
@ToString(callSuper = true)
|
||||||
|
public class SaveDailyForestryReqVO extends DailyForestryUIReqVO {
|
||||||
|
/**
|
||||||
|
* 생산물
|
||||||
|
*/
|
||||||
|
@NotBlank(message = "생산물을 입력해 주세요.")
|
||||||
|
private String productName;
|
||||||
|
/**
|
||||||
|
* 용도
|
||||||
|
*/
|
||||||
|
private String usage;
|
||||||
|
/**
|
||||||
|
* 수량
|
||||||
|
*/
|
||||||
|
private Double quantity;
|
||||||
|
/**
|
||||||
|
* 단위 코드
|
||||||
|
*/
|
||||||
|
private String unitCode;
|
||||||
|
/**
|
||||||
|
* 단위 직접 입력
|
||||||
|
*/
|
||||||
|
private String unitSelf;
|
||||||
|
/**
|
||||||
|
* 현물평가액
|
||||||
|
*/
|
||||||
|
private Long estimatedValue;
|
||||||
|
}
|
||||||
@@ -0,0 +1,47 @@
|
|||||||
|
package app.module.admin.usecase.household.tab.dailyRecord.saveDailyForestry.adapters.web.validator;
|
||||||
|
|
||||||
|
import app.module.admin.usecase.household.tab.dailyRecord.saveDailyForestry.adapters.web.model.SaveDailyForestryReqVO;
|
||||||
|
import app.module.core.config.constants.CommonConstants;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import org.apache.tika.utils.StringUtils;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
import org.springframework.validation.Errors;
|
||||||
|
import org.springframework.validation.Validator;
|
||||||
|
|
||||||
|
@Component
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
public class SaveDailyForestryValidator implements Validator {
|
||||||
|
@Override
|
||||||
|
public boolean supports(Class<?> clazz) {
|
||||||
|
return SaveDailyForestryReqVO.class.equals(clazz);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void validate(Object target, Errors errors) {
|
||||||
|
SaveDailyForestryReqVO vo = (SaveDailyForestryReqVO) target;
|
||||||
|
|
||||||
|
if (vo.getQuantity() == null && !StringUtils.isBlank(vo.getUnitCode())) {
|
||||||
|
errors.rejectValue(
|
||||||
|
"quantity", "valid.common.required",
|
||||||
|
"수량을 입력해 주세요.");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (vo.getQuantity() != null && StringUtils.isBlank(vo.getUnitCode())) {
|
||||||
|
errors.rejectValue(
|
||||||
|
"unitCode", "valid.common.required",
|
||||||
|
"단위를 선택해 주세요.");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (CommonConstants.UNIT_CODE_SELF.equals(vo.getUnitCode()) && StringUtils.isBlank(vo.getUnitSelf())) {
|
||||||
|
errors.rejectValue(
|
||||||
|
"unitSelf", "valid.common.required",
|
||||||
|
"단위를 입력해 주세요.");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (vo.getEstimatedValue() == null) {
|
||||||
|
errors.rejectValue(
|
||||||
|
"estimatedValue", "valid.common.required",
|
||||||
|
"현물평가액을 입력해 주세요.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
package app.module.admin.usecase.household.tab.dailyRecord.saveDailyForestry.ports;
|
||||||
|
|
||||||
|
import app.module.admin.usecase.household.tab.dailyRecord.saveDailyForestry.adapters.persistence.modal.GetDailyForestryDto;
|
||||||
|
import app.module.admin.usecase.household.tab.dailyRecord.saveDailyForestry.adapters.web.model.DailyForestryUIReqVO;
|
||||||
|
import app.module.admin.usecase.household.tab.dailyRecord.saveDailyForestry.adapters.web.model.SaveDailyForestryReqVO;
|
||||||
|
|
||||||
|
public interface SaveDailyForestryPortIn {
|
||||||
|
/**
|
||||||
|
* 일계부 임업생산 조회
|
||||||
|
*
|
||||||
|
* @param reqVO 검색 조건
|
||||||
|
* @return 임업생산 상세
|
||||||
|
*/
|
||||||
|
GetDailyForestryDto detail(DailyForestryUIReqVO reqVO);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 일계부 임업생산 등록
|
||||||
|
*
|
||||||
|
* @param formVO 입력 데이터
|
||||||
|
*/
|
||||||
|
void create(SaveDailyForestryReqVO formVO);
|
||||||
|
}
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
package app.module.admin.usecase.household.tab.dailyRecord.saveDailyForestry.ports;
|
||||||
|
|
||||||
|
import app.module.admin.usecase.household.tab.dailyRecord.saveDailyForestry.adapters.persistence.modal.GetDailyForestryDto;
|
||||||
|
import app.module.admin.usecase.household.tab.dailyRecord.saveDailyForestry.ports.application.domain.GetDailyForestryCmd;
|
||||||
|
import app.module.admin.usecase.household.tab.dailyRecord.saveDailyForestry.ports.application.domain.SaveDailyForestryCmd;
|
||||||
|
|
||||||
|
public interface SaveDailyForestryPortOut {
|
||||||
|
/**
|
||||||
|
* 일계부 임업생산 조회
|
||||||
|
*
|
||||||
|
* @param command 검색 조건
|
||||||
|
* @return 임업생산 상세
|
||||||
|
*/
|
||||||
|
GetDailyForestryDto detail(GetDailyForestryCmd command);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 일계부 임업생산 등록
|
||||||
|
*
|
||||||
|
* @param findCmd 검색 조건
|
||||||
|
* @param command 입력 데이터
|
||||||
|
*/
|
||||||
|
void create(GetDailyForestryCmd findCmd, SaveDailyForestryCmd command);
|
||||||
|
}
|
||||||
@@ -0,0 +1,56 @@
|
|||||||
|
package app.module.admin.usecase.household.tab.dailyRecord.saveDailyForestry.ports.application;
|
||||||
|
|
||||||
|
import app.module.admin.usecase.household.tab.dailyRecord.saveDailyForestry.adapters.persistence.modal.GetDailyForestryDto;
|
||||||
|
import app.module.admin.usecase.household.tab.dailyRecord.saveDailyForestry.adapters.web.model.DailyForestryUIReqVO;
|
||||||
|
import app.module.admin.usecase.household.tab.dailyRecord.saveDailyForestry.adapters.web.model.SaveDailyForestryReqVO;
|
||||||
|
import app.module.admin.usecase.household.tab.dailyRecord.saveDailyForestry.ports.SaveDailyForestryPortIn;
|
||||||
|
import app.module.admin.usecase.household.tab.dailyRecord.saveDailyForestry.ports.SaveDailyForestryPortOut;
|
||||||
|
import app.module.admin.usecase.household.tab.dailyRecord.saveDailyForestry.ports.application.domain.GetDailyForestryCmd;
|
||||||
|
import app.module.admin.usecase.household.tab.dailyRecord.saveDailyForestry.ports.application.domain.SaveDailyForestryCmd;
|
||||||
|
import app.module.core.config.constants.DailyRecordConstants;
|
||||||
|
import app.module.core.usecase.daily.record.ports.DailyRecordPortIn;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
public class SaveDailyForestryService implements SaveDailyForestryPortIn {
|
||||||
|
private final SaveDailyForestryPortOut portOut;
|
||||||
|
private final DailyRecordPortIn dailyRecordPortIn;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public GetDailyForestryDto detail(DailyForestryUIReqVO reqVO) {
|
||||||
|
GetDailyForestryCmd findCmd = new GetDailyForestryCmd(
|
||||||
|
reqVO.getSearchMonth(),
|
||||||
|
reqVO.getGroupNo(),
|
||||||
|
reqVO.getHouseholdSeq(),
|
||||||
|
reqVO.getId());
|
||||||
|
|
||||||
|
return portOut.detail(findCmd);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void create(SaveDailyForestryReqVO formVO) {
|
||||||
|
GetDailyForestryCmd findCmd = new GetDailyForestryCmd(
|
||||||
|
formVO.getSearchMonth(),
|
||||||
|
formVO.getGroupNo(),
|
||||||
|
formVO.getHouseholdSeq(),
|
||||||
|
formVO.getId());
|
||||||
|
|
||||||
|
SaveDailyForestryCmd command =
|
||||||
|
new SaveDailyForestryCmd(
|
||||||
|
formVO.getId(),
|
||||||
|
formVO.getDailyId(),
|
||||||
|
DailyRecordConstants.FORESTRY_EXPENSE_MARK,
|
||||||
|
formVO.getProductName(),
|
||||||
|
formVO.getUsage(),
|
||||||
|
formVO.getQuantity(),
|
||||||
|
formVO.getUnitCode(),
|
||||||
|
formVO.getUnitSelf(),
|
||||||
|
formVO.getEstimatedValue());
|
||||||
|
|
||||||
|
portOut.create(findCmd, command);
|
||||||
|
|
||||||
|
dailyRecordPortIn.updateByAllStatus(findCmd.getSearchMonth(), findCmd.getGroupNo(), findCmd.getHouseholdSeq());
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,27 @@
|
|||||||
|
package app.module.admin.usecase.household.tab.dailyRecord.saveDailyForestry.ports.application.domain;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.Setter;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
@AllArgsConstructor
|
||||||
|
public class GetDailyForestryCmd {
|
||||||
|
/**
|
||||||
|
* 검색 월(yyyyMM)
|
||||||
|
*/
|
||||||
|
private String searchMonth;
|
||||||
|
/**
|
||||||
|
* 검색 그룸번호
|
||||||
|
*/
|
||||||
|
private Integer groupNo;
|
||||||
|
/**
|
||||||
|
* 임가 일련번호
|
||||||
|
*/
|
||||||
|
private Long householdSeq;
|
||||||
|
/**
|
||||||
|
* 임업생산 일련번호
|
||||||
|
*/
|
||||||
|
private Long id;
|
||||||
|
}
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
package app.module.admin.usecase.household.tab.dailyRecord.saveDailyForestry.ports.application.domain;
|
||||||
|
|
||||||
|
import app.module.core.config.adapters.persistence.component.AuditCommand;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.Setter;
|
||||||
|
import lombok.ToString;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
@AllArgsConstructor
|
||||||
|
@ToString
|
||||||
|
public class SaveDailyForestryCmd extends AuditCommand {
|
||||||
|
private Long id;
|
||||||
|
private Long dailyRecordSeq;
|
||||||
|
private String expenseMark;
|
||||||
|
private String productName;
|
||||||
|
private String usage;
|
||||||
|
private Double quantity;
|
||||||
|
private String unitCode;
|
||||||
|
private String unitSelf;
|
||||||
|
private Long estimatedValue;
|
||||||
|
}
|
||||||
@@ -4,6 +4,8 @@ import app.module.admin.usecase.household.tab.dailyRecord.saveDailyIncome.adapte
|
|||||||
import app.module.admin.usecase.household.tab.dailyRecord.saveDailyIncome.ports.SaveDailyIncomePortOut;
|
import app.module.admin.usecase.household.tab.dailyRecord.saveDailyIncome.ports.SaveDailyIncomePortOut;
|
||||||
import app.module.admin.usecase.household.tab.dailyRecord.saveDailyIncome.ports.application.domain.SaveDailyIncomeCmd;
|
import app.module.admin.usecase.household.tab.dailyRecord.saveDailyIncome.ports.application.domain.SaveDailyIncomeCmd;
|
||||||
import app.module.admin.usecase.household.tab.dailyRecord.saveDailyIncome.ports.application.domain.GetDailyIncomeCmd;
|
import app.module.admin.usecase.household.tab.dailyRecord.saveDailyIncome.ports.application.domain.GetDailyIncomeCmd;
|
||||||
|
import app.module.core.config.application.annotation.CreateCommand;
|
||||||
|
import app.module.core.config.application.annotation.UpdateCommand;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
@@ -20,6 +22,7 @@ public class SaveDailyIncomeDao implements SaveDailyIncomePortOut {
|
|||||||
return dailyIncomeMapper.getDailyIncome(command);
|
return dailyIncomeMapper.getDailyIncome(command);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@CreateCommand
|
||||||
@Override
|
@Override
|
||||||
public void create(GetDailyIncomeCmd findCmd, SaveDailyIncomeCmd command) {
|
public void create(GetDailyIncomeCmd findCmd, SaveDailyIncomeCmd command) {
|
||||||
Integer existCount = dailyIncomeMapper.getRecordExistCount(findCmd);
|
Integer existCount = dailyIncomeMapper.getRecordExistCount(findCmd);
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ import org.springframework.web.bind.annotation.*;
|
|||||||
public class SaveDailyIncomeController {
|
public class SaveDailyIncomeController {
|
||||||
private final DailyRecordPortIn dailyRecordPortIn;
|
private final DailyRecordPortIn dailyRecordPortIn;
|
||||||
private final SaveDailyIncomePortIn dailyIncomePortIn;
|
private final SaveDailyIncomePortIn dailyIncomePortIn;
|
||||||
private final SaveDailyIncomeValidator sailyIncomeValidator;
|
private final SaveDailyIncomeValidator dailyIncomeValidator;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 일계부 수입 조회
|
* 일계부 수입 조회
|
||||||
@@ -53,7 +53,7 @@ public class SaveDailyIncomeController {
|
|||||||
@PostMapping(path = "/save")
|
@PostMapping(path = "/save")
|
||||||
ResponseEntity<?> create(@Valid @RequestBody SaveDailyIncomeReqVO formVO, BindingResult bindingResult) {
|
ResponseEntity<?> create(@Valid @RequestBody SaveDailyIncomeReqVO formVO, BindingResult bindingResult) {
|
||||||
|
|
||||||
sailyIncomeValidator.validate(formVO, bindingResult);
|
dailyIncomeValidator.validate(formVO, bindingResult);
|
||||||
if (bindingResult.hasErrors()) {
|
if (bindingResult.hasErrors()) {
|
||||||
return ResponseEntity.status(HttpStatus.UNPROCESSABLE_ENTITY)
|
return ResponseEntity.status(HttpStatus.UNPROCESSABLE_ENTITY)
|
||||||
.body(bindingResult.getFieldErrors());
|
.body(bindingResult.getFieldErrors());
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ public class SaveDailyIncomeService implements SaveDailyIncomePortIn {
|
|||||||
formVO.getHouseholdSeq(),
|
formVO.getHouseholdSeq(),
|
||||||
formVO.getId());
|
formVO.getId());
|
||||||
|
|
||||||
SaveDailyIncomeCmd command = AuditUtil.create(
|
SaveDailyIncomeCmd command =
|
||||||
new SaveDailyIncomeCmd(
|
new SaveDailyIncomeCmd(
|
||||||
formVO.getId(),
|
formVO.getId(),
|
||||||
formVO.getDailyId(),
|
formVO.getDailyId(),
|
||||||
@@ -53,7 +53,7 @@ public class SaveDailyIncomeService implements SaveDailyIncomePortIn {
|
|||||||
formVO.getUnitCode(),
|
formVO.getUnitCode(),
|
||||||
formVO.getUnitSelf(),
|
formVO.getUnitSelf(),
|
||||||
formVO.getPrice(),
|
formVO.getPrice(),
|
||||||
formVO.getEstimatedValue()));
|
formVO.getEstimatedValue());
|
||||||
|
|
||||||
portOut.create(findCmd, command);
|
portOut.create(findCmd, command);
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,39 @@
|
|||||||
|
package app.module.admin.usecase.household.tab.dailyRecord.saveDailyPower.adapters.persistence;
|
||||||
|
|
||||||
|
import app.module.admin.usecase.household.tab.dailyRecord.saveDailyPower.adapters.persistence.modal.GetDailyPowerDto;
|
||||||
|
import app.module.admin.usecase.household.tab.dailyRecord.saveDailyPower.ports.SaveDailyPowerPortOut;
|
||||||
|
import app.module.admin.usecase.household.tab.dailyRecord.saveDailyPower.ports.application.domain.GetDailyPowerCmd;
|
||||||
|
import app.module.admin.usecase.household.tab.dailyRecord.saveDailyPower.ports.application.domain.SaveDailyPowerCmd;
|
||||||
|
import app.module.core.config.application.annotation.CreateCommand;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
@Slf4j
|
||||||
|
@Service
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
public class SaveDailyPowerDao implements SaveDailyPowerPortOut {
|
||||||
|
private final SaveDailyPowerMapper dailyPowerMapper;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public GetDailyPowerDto detail(GetDailyPowerCmd command) {
|
||||||
|
|
||||||
|
return dailyPowerMapper.getDailyPower(command);
|
||||||
|
}
|
||||||
|
|
||||||
|
@CreateCommand
|
||||||
|
@Override
|
||||||
|
public void create(GetDailyPowerCmd findCmd, SaveDailyPowerCmd command) {
|
||||||
|
Integer existCount = dailyPowerMapper.getRecordExistCount(findCmd);
|
||||||
|
if (existCount == 0) {
|
||||||
|
dailyPowerMapper.createDailyPower(command);
|
||||||
|
|
||||||
|
log.debug("[CreateDailyPower] command={}", command);
|
||||||
|
} else {
|
||||||
|
dailyPowerMapper.updateDailyPower(command);
|
||||||
|
|
||||||
|
log.debug("[UpdateDailyPower] command={}", command);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,39 @@
|
|||||||
|
package app.module.admin.usecase.household.tab.dailyRecord.saveDailyPower.adapters.persistence;
|
||||||
|
|
||||||
|
import app.module.admin.usecase.household.tab.dailyRecord.saveDailyPower.adapters.persistence.modal.GetDailyPowerDto;
|
||||||
|
import app.module.admin.usecase.household.tab.dailyRecord.saveDailyPower.ports.application.domain.GetDailyPowerCmd;
|
||||||
|
import app.module.admin.usecase.household.tab.dailyRecord.saveDailyPower.ports.application.domain.SaveDailyPowerCmd;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
|
@Mapper
|
||||||
|
public interface SaveDailyPowerMapper {
|
||||||
|
/**
|
||||||
|
* 일계부 동력 사용시간 데이터 조회
|
||||||
|
*
|
||||||
|
* @param command 검색 조건
|
||||||
|
* @return 동력 사용시간 데이터
|
||||||
|
*/
|
||||||
|
GetDailyPowerDto getDailyPower(GetDailyPowerCmd command);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 일계부 동력 사용시간 데이터 존재 여부
|
||||||
|
*
|
||||||
|
* @param command 검색 조건
|
||||||
|
* @return 중복 개수
|
||||||
|
*/
|
||||||
|
Integer getRecordExistCount(GetDailyPowerCmd command);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 일계부 동력 사용시간 등록
|
||||||
|
*
|
||||||
|
* @param command 등록 데이터
|
||||||
|
*/
|
||||||
|
void createDailyPower(SaveDailyPowerCmd command);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 일계부 동력 사용시간 수정
|
||||||
|
*
|
||||||
|
* @param command 수정 데이터
|
||||||
|
*/
|
||||||
|
void updateDailyPower(SaveDailyPowerCmd command);
|
||||||
|
}
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
package app.module.admin.usecase.household.tab.dailyRecord.saveDailyPower.adapters.persistence.modal;
|
||||||
|
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.Setter;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
public class GetDailyPowerDto {
|
||||||
|
private Long id;
|
||||||
|
private Long dailyRecordSeq;
|
||||||
|
private String equipmentName;
|
||||||
|
private String ownedHours;
|
||||||
|
private String leasedHours;
|
||||||
|
}
|
||||||
@@ -0,0 +1,87 @@
|
|||||||
|
package app.module.admin.usecase.household.tab.dailyRecord.saveDailyPower.adapters.web;
|
||||||
|
|
||||||
|
import app.module.admin.usecase.household.tab.dailyRecord.saveDailyPower.adapters.persistence.modal.GetDailyPowerDto;
|
||||||
|
import app.module.admin.usecase.household.tab.dailyRecord.saveDailyPower.adapters.web.model.DailyPowerUIReqVO;
|
||||||
|
import app.module.admin.usecase.household.tab.dailyRecord.saveDailyPower.adapters.web.model.SaveDailyPowerReqVO;
|
||||||
|
import app.module.admin.usecase.household.tab.dailyRecord.saveDailyPower.adapters.web.validator.SaveDailyPowerValidator;
|
||||||
|
import app.module.admin.usecase.household.tab.dailyRecord.saveDailyPower.ports.SaveDailyPowerPortIn;
|
||||||
|
import app.module.core.config.application.exception.NoRecordDataException;
|
||||||
|
import app.module.core.usecase.daily.record.adapters.persistence.model.DailyRecordDto;
|
||||||
|
import app.module.core.usecase.daily.record.ports.DailyRecordPortIn;
|
||||||
|
import jakarta.validation.Valid;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.http.HttpStatus;
|
||||||
|
import org.springframework.http.ResponseEntity;
|
||||||
|
import org.springframework.validation.BindingResult;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
@Slf4j
|
||||||
|
@RestController
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
@RequestMapping(path = "/api/household/daily/power")
|
||||||
|
public class SaveDailyPowerController {
|
||||||
|
private final DailyRecordPortIn dailyRecordPortIn;
|
||||||
|
private final SaveDailyPowerPortIn dailyPowerPortIn;
|
||||||
|
private final SaveDailyPowerValidator dailyPowerValidator;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 일계부 동력 사용시간 조회
|
||||||
|
*
|
||||||
|
* @param id 동력 사용시간 일련번호
|
||||||
|
* @param reqVO 검색 조건
|
||||||
|
*/
|
||||||
|
@GetMapping(path = "/{id}")
|
||||||
|
ResponseEntity<?> detail(@PathVariable("id") String id, @ModelAttribute DailyPowerUIReqVO reqVO) {
|
||||||
|
|
||||||
|
reqVO.setId(Long.parseLong(id));
|
||||||
|
|
||||||
|
GetDailyPowerDto detail = dailyPowerPortIn.detail(reqVO);
|
||||||
|
if (detail == null) {
|
||||||
|
return ResponseEntity.status(HttpStatus.BAD_REQUEST).body(null);
|
||||||
|
}
|
||||||
|
|
||||||
|
return ResponseEntity.status(HttpStatus.OK).body(detail);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 일계부 동력 사용시간 등록 처리
|
||||||
|
*
|
||||||
|
* @param formVO 입력 데이터
|
||||||
|
* @param bindingResult BindingResult
|
||||||
|
*/
|
||||||
|
@PostMapping(path = "/save")
|
||||||
|
ResponseEntity<?> create(@Valid @RequestBody SaveDailyPowerReqVO formVO, BindingResult bindingResult) {
|
||||||
|
|
||||||
|
dailyPowerValidator.validate(formVO, bindingResult);
|
||||||
|
if (bindingResult.hasErrors()) {
|
||||||
|
return ResponseEntity.status(HttpStatus.UNPROCESSABLE_ENTITY)
|
||||||
|
.body(bindingResult.getFieldErrors());
|
||||||
|
}
|
||||||
|
|
||||||
|
DailyRecordDto dailyRecord = this.vaildGetDailyRecord(formVO.getDailyId());
|
||||||
|
|
||||||
|
formVO.setSearchMonth(dailyRecord.getRecordMonth());
|
||||||
|
formVO.setGroupNo(dailyRecord.getGroupNo());
|
||||||
|
formVO.setDailyId(dailyRecord.getId());
|
||||||
|
log.debug("formVO: {}", formVO);
|
||||||
|
|
||||||
|
dailyPowerPortIn.create(formVO);
|
||||||
|
|
||||||
|
return ResponseEntity.status(HttpStatus.OK).body(formVO);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 일계부 유효성 체크 및 데이터 조회
|
||||||
|
*
|
||||||
|
* @param dailyRecordSeq 항목 일련번호
|
||||||
|
*/
|
||||||
|
private DailyRecordDto vaildGetDailyRecord(Long dailyRecordSeq) {
|
||||||
|
DailyRecordDto dailyRecord = dailyRecordPortIn.detail(dailyRecordSeq);
|
||||||
|
if (dailyRecord == null || dailyRecord.getId() == null) {
|
||||||
|
throw new NoRecordDataException();
|
||||||
|
}
|
||||||
|
|
||||||
|
return dailyRecord;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,30 @@
|
|||||||
|
package app.module.admin.usecase.household.tab.dailyRecord.saveDailyPower.adapters.web.model;
|
||||||
|
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.Setter;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
public class DailyPowerUIReqVO {
|
||||||
|
/**
|
||||||
|
* 검색 월(yyyyMM)
|
||||||
|
*/
|
||||||
|
private String searchMonth;
|
||||||
|
/**
|
||||||
|
* 검색 그룸번호
|
||||||
|
*/
|
||||||
|
private Integer groupNo;
|
||||||
|
/**
|
||||||
|
* 임가 일련번호
|
||||||
|
*/
|
||||||
|
private Long householdSeq;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 일계부 항목 일련번호
|
||||||
|
*/
|
||||||
|
private Long dailyId;
|
||||||
|
/**
|
||||||
|
* 동력 사용시간 일련번호
|
||||||
|
*/
|
||||||
|
private Long id;
|
||||||
|
}
|
||||||
@@ -0,0 +1,26 @@
|
|||||||
|
package app.module.admin.usecase.household.tab.dailyRecord.saveDailyPower.adapters.web.model;
|
||||||
|
|
||||||
|
import app.module.admin.usecase.household.tab.dailyRecord.saveDailyPower.adapters.web.model.DailyPowerUIReqVO;
|
||||||
|
import jakarta.validation.constraints.NotBlank;
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.Setter;
|
||||||
|
import lombok.ToString;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
@ToString(callSuper = true)
|
||||||
|
public class SaveDailyPowerReqVO extends DailyPowerUIReqVO {
|
||||||
|
/**
|
||||||
|
* 명칭
|
||||||
|
*/
|
||||||
|
@NotBlank(message = "명칭을 입력해 주세요.")
|
||||||
|
private String equipmentName;
|
||||||
|
/**
|
||||||
|
* 자가 사용시간
|
||||||
|
*/
|
||||||
|
private Double ownedHours;
|
||||||
|
/**
|
||||||
|
* 임차 사용시간
|
||||||
|
*/
|
||||||
|
private Double leasedHours;
|
||||||
|
}
|
||||||
@@ -0,0 +1,32 @@
|
|||||||
|
package app.module.admin.usecase.household.tab.dailyRecord.saveDailyPower.adapters.web.validator;
|
||||||
|
|
||||||
|
import app.module.admin.usecase.household.tab.dailyRecord.saveDailyPower.adapters.web.model.SaveDailyPowerReqVO;
|
||||||
|
import app.module.core.config.constants.CommonConstants;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import org.apache.tika.utils.StringUtils;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
import org.springframework.validation.Errors;
|
||||||
|
import org.springframework.validation.Validator;
|
||||||
|
|
||||||
|
@Component
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
public class SaveDailyPowerValidator implements Validator {
|
||||||
|
@Override
|
||||||
|
public boolean supports(Class<?> clazz) {
|
||||||
|
return SaveDailyPowerReqVO.class.equals(clazz);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void validate(Object target, Errors errors) {
|
||||||
|
SaveDailyPowerReqVO vo = (SaveDailyPowerReqVO) target;
|
||||||
|
|
||||||
|
if (vo.getOwnedHours() == null && vo.getLeasedHours() == null) {
|
||||||
|
errors.rejectValue(
|
||||||
|
"ownedHours", "valid.common.required",
|
||||||
|
"자가 사용시간 또는 임차 사용시간을 입력해 주세요.");
|
||||||
|
errors.rejectValue(
|
||||||
|
"leasedHours", "valid.common.required",
|
||||||
|
"자가 사용시간 또는 임차 사용시간을 입력해 주세요.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
package app.module.admin.usecase.household.tab.dailyRecord.saveDailyPower.ports;
|
||||||
|
|
||||||
|
import app.module.admin.usecase.household.tab.dailyRecord.saveDailyPower.adapters.persistence.modal.GetDailyPowerDto;
|
||||||
|
import app.module.admin.usecase.household.tab.dailyRecord.saveDailyPower.adapters.web.model.DailyPowerUIReqVO;
|
||||||
|
import app.module.admin.usecase.household.tab.dailyRecord.saveDailyPower.adapters.web.model.SaveDailyPowerReqVO;
|
||||||
|
|
||||||
|
public interface SaveDailyPowerPortIn {
|
||||||
|
/**
|
||||||
|
* 일계부 동력 사용시간 조회
|
||||||
|
*
|
||||||
|
* @param reqVO 검색 조건
|
||||||
|
* @return 동력 사용시간 상세
|
||||||
|
*/
|
||||||
|
GetDailyPowerDto detail(DailyPowerUIReqVO reqVO);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 일계부 동력 사용시간 등록
|
||||||
|
*
|
||||||
|
* @param formVO 입력 데이터
|
||||||
|
*/
|
||||||
|
void create(SaveDailyPowerReqVO formVO);
|
||||||
|
}
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
package app.module.admin.usecase.household.tab.dailyRecord.saveDailyPower.ports;
|
||||||
|
|
||||||
|
import app.module.admin.usecase.household.tab.dailyRecord.saveDailyPower.adapters.persistence.modal.GetDailyPowerDto;
|
||||||
|
import app.module.admin.usecase.household.tab.dailyRecord.saveDailyPower.ports.application.domain.GetDailyPowerCmd;
|
||||||
|
import app.module.admin.usecase.household.tab.dailyRecord.saveDailyPower.ports.application.domain.SaveDailyPowerCmd;
|
||||||
|
|
||||||
|
public interface SaveDailyPowerPortOut {
|
||||||
|
/**
|
||||||
|
* 일계부 동력 사용시간 조회
|
||||||
|
*
|
||||||
|
* @param command 검색 조건
|
||||||
|
* @return 동력 사용시간 상세
|
||||||
|
*/
|
||||||
|
GetDailyPowerDto detail(GetDailyPowerCmd command);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 일계부 동력 사용시간 등록
|
||||||
|
*
|
||||||
|
* @param findCmd 검색 조건
|
||||||
|
* @param command 입력 데이터
|
||||||
|
*/
|
||||||
|
void create(GetDailyPowerCmd findCmd, SaveDailyPowerCmd command);
|
||||||
|
}
|
||||||
@@ -0,0 +1,51 @@
|
|||||||
|
package app.module.admin.usecase.household.tab.dailyRecord.saveDailyPower.ports.application;
|
||||||
|
|
||||||
|
import app.module.admin.usecase.household.tab.dailyRecord.saveDailyPower.adapters.persistence.modal.GetDailyPowerDto;
|
||||||
|
import app.module.admin.usecase.household.tab.dailyRecord.saveDailyPower.adapters.web.model.DailyPowerUIReqVO;
|
||||||
|
import app.module.admin.usecase.household.tab.dailyRecord.saveDailyPower.adapters.web.model.SaveDailyPowerReqVO;
|
||||||
|
import app.module.admin.usecase.household.tab.dailyRecord.saveDailyPower.ports.SaveDailyPowerPortIn;
|
||||||
|
import app.module.admin.usecase.household.tab.dailyRecord.saveDailyPower.ports.SaveDailyPowerPortOut;
|
||||||
|
import app.module.admin.usecase.household.tab.dailyRecord.saveDailyPower.ports.application.domain.GetDailyPowerCmd;
|
||||||
|
import app.module.admin.usecase.household.tab.dailyRecord.saveDailyPower.ports.application.domain.SaveDailyPowerCmd;
|
||||||
|
import app.module.core.usecase.daily.record.ports.DailyRecordPortIn;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
public class SaveDailyPowerService implements SaveDailyPowerPortIn {
|
||||||
|
private final SaveDailyPowerPortOut portOut;
|
||||||
|
private final DailyRecordPortIn dailyRecordPortIn;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public GetDailyPowerDto detail(DailyPowerUIReqVO reqVO) {
|
||||||
|
GetDailyPowerCmd findCmd = new GetDailyPowerCmd(
|
||||||
|
reqVO.getSearchMonth(),
|
||||||
|
reqVO.getGroupNo(),
|
||||||
|
reqVO.getHouseholdSeq(),
|
||||||
|
reqVO.getId());
|
||||||
|
|
||||||
|
return portOut.detail(findCmd);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void create(SaveDailyPowerReqVO formVO) {
|
||||||
|
GetDailyPowerCmd findCmd = new GetDailyPowerCmd(
|
||||||
|
formVO.getSearchMonth(),
|
||||||
|
formVO.getGroupNo(),
|
||||||
|
formVO.getHouseholdSeq(),
|
||||||
|
formVO.getId());
|
||||||
|
|
||||||
|
SaveDailyPowerCmd command =
|
||||||
|
new SaveDailyPowerCmd(
|
||||||
|
formVO.getId(),
|
||||||
|
formVO.getDailyId(),
|
||||||
|
formVO.getEquipmentName(),
|
||||||
|
formVO.getOwnedHours(),
|
||||||
|
formVO.getLeasedHours());
|
||||||
|
|
||||||
|
portOut.create(findCmd, command);
|
||||||
|
|
||||||
|
dailyRecordPortIn.updateByAllStatus(findCmd.getSearchMonth(), findCmd.getGroupNo(), findCmd.getHouseholdSeq());
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,27 @@
|
|||||||
|
package app.module.admin.usecase.household.tab.dailyRecord.saveDailyPower.ports.application.domain;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.Setter;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
@AllArgsConstructor
|
||||||
|
public class GetDailyPowerCmd {
|
||||||
|
/**
|
||||||
|
* 검색 월(yyyyMM)
|
||||||
|
*/
|
||||||
|
private String searchMonth;
|
||||||
|
/**
|
||||||
|
* 검색 그룸번호
|
||||||
|
*/
|
||||||
|
private Integer groupNo;
|
||||||
|
/**
|
||||||
|
* 임가 일련번호
|
||||||
|
*/
|
||||||
|
private Long householdSeq;
|
||||||
|
/**
|
||||||
|
* 동력 사용시간 일련번호
|
||||||
|
*/
|
||||||
|
private Long id;
|
||||||
|
}
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
package app.module.admin.usecase.household.tab.dailyRecord.saveDailyPower.ports.application.domain;
|
||||||
|
|
||||||
|
import app.module.core.config.adapters.persistence.component.AuditCommand;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.Setter;
|
||||||
|
import lombok.ToString;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
@AllArgsConstructor
|
||||||
|
@ToString
|
||||||
|
public class SaveDailyPowerCmd extends AuditCommand {
|
||||||
|
private Long id;
|
||||||
|
private Long dailyRecordSeq;
|
||||||
|
private String equipmentName;
|
||||||
|
private Double ownedHours;
|
||||||
|
private Double leasedHours;
|
||||||
|
}
|
||||||
@@ -0,0 +1,40 @@
|
|||||||
|
package app.module.admin.usecase.household.tab.dailyRecord.saveDailyWork.adapters.persistence;
|
||||||
|
|
||||||
|
import app.module.admin.usecase.household.tab.dailyRecord.saveDailyWork.adapters.persistence.modal.GetDailyWorkDto;
|
||||||
|
import app.module.admin.usecase.household.tab.dailyRecord.saveDailyWork.ports.application.domain.GetDailyWorkCmd;
|
||||||
|
import app.module.admin.usecase.household.tab.dailyRecord.saveDailyWork.ports.application.domain.SaveDailyWorkCmd;
|
||||||
|
import app.module.admin.usecase.household.tab.dailyRecord.saveDailyWork.ports.SaveDailyWorkPortOut;
|
||||||
|
import app.module.core.config.application.annotation.CreateCommand;
|
||||||
|
import app.module.core.config.application.annotation.UpdateCommand;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
@Slf4j
|
||||||
|
@Service
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
public class SaveDailyWorkDao implements SaveDailyWorkPortOut {
|
||||||
|
private final SaveDailyWorkMapper dailyWorkMapper;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public GetDailyWorkDto detail(GetDailyWorkCmd command) {
|
||||||
|
|
||||||
|
return dailyWorkMapper.getDailyWork(command);
|
||||||
|
}
|
||||||
|
|
||||||
|
@CreateCommand
|
||||||
|
@Override
|
||||||
|
public void create(GetDailyWorkCmd findCmd, SaveDailyWorkCmd command) {
|
||||||
|
Integer existCount = dailyWorkMapper.getRecordExistCount(findCmd);
|
||||||
|
if (existCount == 0) {
|
||||||
|
dailyWorkMapper.createDailyWork(command);
|
||||||
|
|
||||||
|
log.debug("[CreateDailyWork] command={}", command);
|
||||||
|
} else {
|
||||||
|
dailyWorkMapper.updateDailyWork(command);
|
||||||
|
|
||||||
|
log.debug("[UpdateDailyWork] command={}", command);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,39 @@
|
|||||||
|
package app.module.admin.usecase.household.tab.dailyRecord.saveDailyWork.adapters.persistence;
|
||||||
|
|
||||||
|
import app.module.admin.usecase.household.tab.dailyRecord.saveDailyWork.adapters.persistence.modal.GetDailyWorkDto;
|
||||||
|
import app.module.admin.usecase.household.tab.dailyRecord.saveDailyWork.ports.application.domain.GetDailyWorkCmd;
|
||||||
|
import app.module.admin.usecase.household.tab.dailyRecord.saveDailyWork.ports.application.domain.SaveDailyWorkCmd;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
|
@Mapper
|
||||||
|
public interface SaveDailyWorkMapper {
|
||||||
|
/**
|
||||||
|
* 일계부 노동투입 데이터 조회
|
||||||
|
*
|
||||||
|
* @param command 검색 조건
|
||||||
|
* @return 노동투입 데이터
|
||||||
|
*/
|
||||||
|
GetDailyWorkDto getDailyWork(GetDailyWorkCmd command);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 일계부 노동투입 데이터 존재 여부
|
||||||
|
*
|
||||||
|
* @param command 검색 조건
|
||||||
|
* @return 중복 개수
|
||||||
|
*/
|
||||||
|
Integer getRecordExistCount(GetDailyWorkCmd command);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 일계부 노동투입 등록
|
||||||
|
*
|
||||||
|
* @param command 등록 데이터
|
||||||
|
*/
|
||||||
|
void createDailyWork(SaveDailyWorkCmd command);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 일계부 노동투입 수정
|
||||||
|
*
|
||||||
|
* @param command 수정 데이터
|
||||||
|
*/
|
||||||
|
void updateDailyWork(SaveDailyWorkCmd command);
|
||||||
|
}
|
||||||
@@ -0,0 +1,34 @@
|
|||||||
|
package app.module.admin.usecase.household.tab.dailyRecord.saveDailyWork.adapters.persistence.modal;
|
||||||
|
|
||||||
|
import app.module.core.config.application.enums.DailyInputType;
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.Setter;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
public class GetDailyWorkDto {
|
||||||
|
private Long id;
|
||||||
|
private Long dailyRecordSeq;
|
||||||
|
private String itemName;
|
||||||
|
private String itemMark;
|
||||||
|
private String workName;
|
||||||
|
private String workMark;
|
||||||
|
private String workLandArea;
|
||||||
|
private String areaUnitCode;
|
||||||
|
private String areaUnitLabel;
|
||||||
|
private String areaUnitSelf;
|
||||||
|
private String harvestQuantity;
|
||||||
|
private String harvestUnitCode;
|
||||||
|
private String harvestUnitLabel;
|
||||||
|
private String harvestUnitSelf;
|
||||||
|
private String ownerTime;
|
||||||
|
private String spouseTime;
|
||||||
|
private String familyMHours;
|
||||||
|
private String familyFHours;
|
||||||
|
private String hiredMHours;
|
||||||
|
private String hiredFHours;
|
||||||
|
private String sharedMHours;
|
||||||
|
private String sharedFHours;
|
||||||
|
private String volunteerMHours;
|
||||||
|
private String volunteerFHours;
|
||||||
|
}
|
||||||
@@ -0,0 +1,87 @@
|
|||||||
|
package app.module.admin.usecase.household.tab.dailyRecord.saveDailyWork.adapters.web;
|
||||||
|
|
||||||
|
import app.module.admin.usecase.household.tab.dailyRecord.saveDailyWork.adapters.persistence.modal.GetDailyWorkDto;
|
||||||
|
import app.module.admin.usecase.household.tab.dailyRecord.saveDailyWork.adapters.web.model.DailyWorkUIReqVO;
|
||||||
|
import app.module.admin.usecase.household.tab.dailyRecord.saveDailyWork.adapters.web.model.SaveDailyWorkReqVO;
|
||||||
|
import app.module.admin.usecase.household.tab.dailyRecord.saveDailyWork.adapters.web.validator.SaveDailyWorkValidator;
|
||||||
|
import app.module.admin.usecase.household.tab.dailyRecord.saveDailyWork.ports.SaveDailyWorkPortIn;
|
||||||
|
import app.module.core.config.application.exception.NoRecordDataException;
|
||||||
|
import app.module.core.usecase.daily.record.adapters.persistence.model.DailyRecordDto;
|
||||||
|
import app.module.core.usecase.daily.record.ports.DailyRecordPortIn;
|
||||||
|
import jakarta.validation.Valid;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.http.HttpStatus;
|
||||||
|
import org.springframework.http.ResponseEntity;
|
||||||
|
import org.springframework.validation.BindingResult;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
@Slf4j
|
||||||
|
@RestController
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
@RequestMapping(path = "/api/household/daily/work")
|
||||||
|
public class SaveDailyWorkController {
|
||||||
|
private final DailyRecordPortIn dailyRecordPortIn;
|
||||||
|
private final SaveDailyWorkPortIn dailyWorkPortIn;
|
||||||
|
private final SaveDailyWorkValidator dailyWorkValidator;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 일계부 노동투입 조회
|
||||||
|
*
|
||||||
|
* @param id 노동투입 일련번호
|
||||||
|
* @param reqVO 검색 조건
|
||||||
|
*/
|
||||||
|
@GetMapping(path = "/{id}")
|
||||||
|
ResponseEntity<?> detail(@PathVariable("id") String id, @ModelAttribute DailyWorkUIReqVO reqVO) {
|
||||||
|
|
||||||
|
reqVO.setId(Long.parseLong(id));
|
||||||
|
|
||||||
|
GetDailyWorkDto detail = dailyWorkPortIn.detail(reqVO);
|
||||||
|
if (detail == null) {
|
||||||
|
return ResponseEntity.status(HttpStatus.BAD_REQUEST).body(null);
|
||||||
|
}
|
||||||
|
|
||||||
|
return ResponseEntity.status(HttpStatus.OK).body(detail);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 일계부 노동투입 등록 처리
|
||||||
|
*
|
||||||
|
* @param formVO 입력 데이터
|
||||||
|
* @param bindingResult BindingResult
|
||||||
|
*/
|
||||||
|
@PostMapping(path = "/save")
|
||||||
|
ResponseEntity<?> create(@Valid @RequestBody SaveDailyWorkReqVO formVO, BindingResult bindingResult) {
|
||||||
|
|
||||||
|
dailyWorkValidator.validate(formVO, bindingResult);
|
||||||
|
if (bindingResult.hasErrors()) {
|
||||||
|
return ResponseEntity.status(HttpStatus.UNPROCESSABLE_ENTITY)
|
||||||
|
.body(bindingResult.getFieldErrors());
|
||||||
|
}
|
||||||
|
|
||||||
|
DailyRecordDto dailyRecord = this.vaildGetDailyRecord(formVO.getDailyId());
|
||||||
|
|
||||||
|
formVO.setSearchMonth(dailyRecord.getRecordMonth());
|
||||||
|
formVO.setGroupNo(dailyRecord.getGroupNo());
|
||||||
|
formVO.setDailyId(dailyRecord.getId());
|
||||||
|
log.debug("formVO: {}", formVO);
|
||||||
|
|
||||||
|
dailyWorkPortIn.create(formVO);
|
||||||
|
|
||||||
|
return ResponseEntity.status(HttpStatus.OK).body(formVO);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 일계부 유효성 체크 및 데이터 조회
|
||||||
|
*
|
||||||
|
* @param dailyRecordSeq 항목 일련번호
|
||||||
|
*/
|
||||||
|
private DailyRecordDto vaildGetDailyRecord(Long dailyRecordSeq) {
|
||||||
|
DailyRecordDto dailyRecord = dailyRecordPortIn.detail(dailyRecordSeq);
|
||||||
|
if (dailyRecord == null || dailyRecord.getId() == null) {
|
||||||
|
throw new NoRecordDataException();
|
||||||
|
}
|
||||||
|
|
||||||
|
return dailyRecord;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,30 @@
|
|||||||
|
package app.module.admin.usecase.household.tab.dailyRecord.saveDailyWork.adapters.web.model;
|
||||||
|
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.Setter;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
public class DailyWorkUIReqVO {
|
||||||
|
/**
|
||||||
|
* 검색 월(yyyyMM)
|
||||||
|
*/
|
||||||
|
private String searchMonth;
|
||||||
|
/**
|
||||||
|
* 검색 그룸번호
|
||||||
|
*/
|
||||||
|
private Integer groupNo;
|
||||||
|
/**
|
||||||
|
* 임가 일련번호
|
||||||
|
*/
|
||||||
|
private Long householdSeq;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 일계부 항목 일련번호
|
||||||
|
*/
|
||||||
|
private Long dailyId;
|
||||||
|
/**
|
||||||
|
* 노동투입 일련번호
|
||||||
|
*/
|
||||||
|
private Long id;
|
||||||
|
}
|
||||||
@@ -0,0 +1,86 @@
|
|||||||
|
package app.module.admin.usecase.household.tab.dailyRecord.saveDailyWork.adapters.web.model;
|
||||||
|
|
||||||
|
import jakarta.validation.constraints.NotBlank;
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.Setter;
|
||||||
|
import lombok.ToString;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
@ToString(callSuper = true)
|
||||||
|
public class SaveDailyWorkReqVO extends DailyWorkUIReqVO {
|
||||||
|
/**
|
||||||
|
* 품목명
|
||||||
|
*/
|
||||||
|
@NotBlank(message = "품목명을 입력해 주세요.")
|
||||||
|
private String itemName;
|
||||||
|
/**
|
||||||
|
* 작업명
|
||||||
|
*/
|
||||||
|
@NotBlank(message = "작업명을 입력해 주세요.")
|
||||||
|
private String workName;
|
||||||
|
/**
|
||||||
|
* 작업 면적
|
||||||
|
*/
|
||||||
|
private Double workLandArea;
|
||||||
|
/**
|
||||||
|
* 작업 면적 단위 코드
|
||||||
|
*/
|
||||||
|
private String areaUnitCode;
|
||||||
|
/**
|
||||||
|
* 작업 면적 단위 직업입력
|
||||||
|
*/
|
||||||
|
private String areaUnitSelf;
|
||||||
|
/**
|
||||||
|
* 수확량
|
||||||
|
*/
|
||||||
|
private Double harvestQuantity;
|
||||||
|
/**
|
||||||
|
* 수확량 단위 코드
|
||||||
|
*/
|
||||||
|
private String harvestUnitCode;
|
||||||
|
/**
|
||||||
|
* 수확량 단위 직접입력
|
||||||
|
*/
|
||||||
|
private String harvestUnitSelf;
|
||||||
|
/**
|
||||||
|
* 경영주 시간
|
||||||
|
*/
|
||||||
|
private Double ownerTime;
|
||||||
|
/**
|
||||||
|
* 배우자 시간
|
||||||
|
*/
|
||||||
|
private Double spouseTime;
|
||||||
|
/**
|
||||||
|
* 가족노동 남 시간
|
||||||
|
*/
|
||||||
|
private Double familyMHours;
|
||||||
|
/**
|
||||||
|
* 가족노동 여 시간
|
||||||
|
*/
|
||||||
|
private Double familyFHours;
|
||||||
|
/**
|
||||||
|
* 고용노동 남 시간
|
||||||
|
*/
|
||||||
|
private Double hiredMHours;
|
||||||
|
/**
|
||||||
|
* 고용돈 여 시간
|
||||||
|
*/
|
||||||
|
private Double hiredFHours;
|
||||||
|
/**
|
||||||
|
* 품앗이 남 시간
|
||||||
|
*/
|
||||||
|
private Double sharedMHours;
|
||||||
|
/**
|
||||||
|
* 품앗이 여 시간
|
||||||
|
*/
|
||||||
|
private Double sharedFHours;
|
||||||
|
/**
|
||||||
|
* 일손돕기 남 시간
|
||||||
|
*/
|
||||||
|
private Double volunteerMHours;
|
||||||
|
/**
|
||||||
|
* 일손돕기 여 시간
|
||||||
|
*/
|
||||||
|
private Double volunteerFHours;
|
||||||
|
}
|
||||||
@@ -0,0 +1,76 @@
|
|||||||
|
package app.module.admin.usecase.household.tab.dailyRecord.saveDailyWork.adapters.web.validator;
|
||||||
|
|
||||||
|
import app.module.admin.usecase.household.tab.dailyRecord.saveDailyWork.adapters.web.model.SaveDailyWorkReqVO;
|
||||||
|
import app.module.core.config.constants.CommonConstants;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import org.apache.tika.utils.StringUtils;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
import org.springframework.validation.Errors;
|
||||||
|
import org.springframework.validation.Validator;
|
||||||
|
|
||||||
|
@Component
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
public class SaveDailyWorkValidator implements Validator {
|
||||||
|
@Override
|
||||||
|
public boolean supports(Class<?> clazz) {
|
||||||
|
return SaveDailyWorkReqVO.class.equals(clazz);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void validate(Object target, Errors errors) {
|
||||||
|
SaveDailyWorkReqVO vo = (SaveDailyWorkReqVO) target;
|
||||||
|
|
||||||
|
if (vo.getWorkLandArea() == null && !StringUtils.isBlank(vo.getAreaUnitCode())) {
|
||||||
|
errors.rejectValue(
|
||||||
|
"workLandArea", "valid.common.required",
|
||||||
|
"작업 면적을 입력해 주세요.");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (vo.getWorkLandArea() != null && StringUtils.isBlank(vo.getAreaUnitCode())) {
|
||||||
|
errors.rejectValue(
|
||||||
|
"areaUnitCode", "valid.common.required",
|
||||||
|
"단위를 선택해 주세요.");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (CommonConstants.AREA_CODE_OTHER.equals(vo.getAreaUnitCode()) && StringUtils.isBlank(vo.getAreaUnitSelf())) {
|
||||||
|
errors.rejectValue(
|
||||||
|
"areaUnitSelf", "valid.common.required",
|
||||||
|
"단위를 입력해 주세요.");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (vo.getHarvestQuantity() == null && !StringUtils.isBlank(vo.getHarvestUnitCode())) {
|
||||||
|
errors.rejectValue(
|
||||||
|
"harvestQuantity", "valid.common.required",
|
||||||
|
"수확량을 입력해 주세요.");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (vo.getHarvestQuantity() != null && StringUtils.isBlank(vo.getHarvestUnitCode())) {
|
||||||
|
errors.rejectValue(
|
||||||
|
"harvestUnitCode", "valid.common.required",
|
||||||
|
"단위를 선택해 주세요.");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (CommonConstants.UNIT_CODE_SELF.equals(vo.getHarvestUnitCode()) && StringUtils.isBlank(vo.getHarvestUnitSelf())) {
|
||||||
|
errors.rejectValue(
|
||||||
|
"harvestUnitSelf", "valid.common.required",
|
||||||
|
"단위를 입력해 주세요.");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (vo.getOwnerTime() == null && vo.getSpouseTime() == null
|
||||||
|
&& vo.getFamilyMHours() == null && vo.getFamilyFHours() == null
|
||||||
|
&& vo.getHiredMHours() == null && vo.getHiredFHours() == null
|
||||||
|
&& vo.getSharedMHours() == null && vo.getSharedFHours() == null
|
||||||
|
&& vo.getVolunteerMHours() == null && vo.getVolunteerFHours() == null) {
|
||||||
|
errors.rejectValue("ownerTime", "valid.common.required", "최소 1개의 노동투입시간을 입력해 주세요.");
|
||||||
|
errors.rejectValue("spouseTime", "valid.common.required");
|
||||||
|
errors.rejectValue("familyMHours", "valid.common.required");
|
||||||
|
errors.rejectValue("familyFHours", "valid.common.required");
|
||||||
|
errors.rejectValue("hiredMHours", "valid.common.required");
|
||||||
|
errors.rejectValue("hiredFHours", "valid.common.required");
|
||||||
|
errors.rejectValue("sharedMHours", "valid.common.required");
|
||||||
|
errors.rejectValue("sharedFHours", "valid.common.required");
|
||||||
|
errors.rejectValue("volunteerMHours", "valid.common.required");
|
||||||
|
errors.rejectValue("volunteerFHours", "valid.common.required");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
package app.module.admin.usecase.household.tab.dailyRecord.saveDailyWork.ports;
|
||||||
|
|
||||||
|
import app.module.admin.usecase.household.tab.dailyRecord.saveDailyWork.adapters.persistence.modal.GetDailyWorkDto;
|
||||||
|
import app.module.admin.usecase.household.tab.dailyRecord.saveDailyWork.adapters.web.model.DailyWorkUIReqVO;
|
||||||
|
import app.module.admin.usecase.household.tab.dailyRecord.saveDailyWork.adapters.web.model.SaveDailyWorkReqVO;
|
||||||
|
|
||||||
|
public interface SaveDailyWorkPortIn {
|
||||||
|
/**
|
||||||
|
* 일계부 노동투입 조회
|
||||||
|
*
|
||||||
|
* @param reqVO 검색 조건
|
||||||
|
* @return 노동투입 상세
|
||||||
|
*/
|
||||||
|
GetDailyWorkDto detail(DailyWorkUIReqVO reqVO);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 일계부 노동투입 등록
|
||||||
|
*
|
||||||
|
* @param formVO 입력 데이터
|
||||||
|
*/
|
||||||
|
void create(SaveDailyWorkReqVO formVO);
|
||||||
|
}
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
package app.module.admin.usecase.household.tab.dailyRecord.saveDailyWork.ports;
|
||||||
|
|
||||||
|
import app.module.admin.usecase.household.tab.dailyRecord.saveDailyWork.adapters.persistence.modal.GetDailyWorkDto;
|
||||||
|
import app.module.admin.usecase.household.tab.dailyRecord.saveDailyWork.ports.application.domain.GetDailyWorkCmd;
|
||||||
|
import app.module.admin.usecase.household.tab.dailyRecord.saveDailyWork.ports.application.domain.SaveDailyWorkCmd;
|
||||||
|
|
||||||
|
public interface SaveDailyWorkPortOut {
|
||||||
|
/**
|
||||||
|
* 일계부 노동투입 조회
|
||||||
|
*
|
||||||
|
* @param command 검색 조건
|
||||||
|
* @return 노동투입 상세
|
||||||
|
*/
|
||||||
|
GetDailyWorkDto detail(GetDailyWorkCmd command);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 일계부 노동투입 등록
|
||||||
|
*
|
||||||
|
* @param findCmd 검색 조건
|
||||||
|
* @param command 입력 데이터
|
||||||
|
*/
|
||||||
|
void create(GetDailyWorkCmd findCmd, SaveDailyWorkCmd command);
|
||||||
|
}
|
||||||
@@ -0,0 +1,66 @@
|
|||||||
|
package app.module.admin.usecase.household.tab.dailyRecord.saveDailyWork.ports.application;
|
||||||
|
|
||||||
|
import app.module.admin.usecase.household.tab.dailyRecord.saveDailyWork.adapters.persistence.modal.GetDailyWorkDto;
|
||||||
|
import app.module.admin.usecase.household.tab.dailyRecord.saveDailyWork.adapters.web.model.DailyWorkUIReqVO;
|
||||||
|
import app.module.admin.usecase.household.tab.dailyRecord.saveDailyWork.adapters.web.model.SaveDailyWorkReqVO;
|
||||||
|
import app.module.admin.usecase.household.tab.dailyRecord.saveDailyWork.ports.SaveDailyWorkPortIn;
|
||||||
|
import app.module.admin.usecase.household.tab.dailyRecord.saveDailyWork.ports.SaveDailyWorkPortOut;
|
||||||
|
import app.module.admin.usecase.household.tab.dailyRecord.saveDailyWork.ports.application.domain.GetDailyWorkCmd;
|
||||||
|
import app.module.admin.usecase.household.tab.dailyRecord.saveDailyWork.ports.application.domain.SaveDailyWorkCmd;
|
||||||
|
import app.module.core.usecase.daily.record.ports.DailyRecordPortIn;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
public class SaveDailyWorkService implements SaveDailyWorkPortIn {
|
||||||
|
private final SaveDailyWorkPortOut portOut;
|
||||||
|
private final DailyRecordPortIn dailyRecordPortIn;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public GetDailyWorkDto detail(DailyWorkUIReqVO reqVO) {
|
||||||
|
GetDailyWorkCmd findCmd = new GetDailyWorkCmd(
|
||||||
|
reqVO.getSearchMonth(),
|
||||||
|
reqVO.getGroupNo(),
|
||||||
|
reqVO.getHouseholdSeq(),
|
||||||
|
reqVO.getId());
|
||||||
|
|
||||||
|
return portOut.detail(findCmd);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void create(SaveDailyWorkReqVO formVO) {
|
||||||
|
GetDailyWorkCmd findCmd = new GetDailyWorkCmd(
|
||||||
|
formVO.getSearchMonth(),
|
||||||
|
formVO.getGroupNo(),
|
||||||
|
formVO.getHouseholdSeq(),
|
||||||
|
formVO.getId());
|
||||||
|
|
||||||
|
SaveDailyWorkCmd command =
|
||||||
|
new SaveDailyWorkCmd(
|
||||||
|
formVO.getId(),
|
||||||
|
formVO.getDailyId(),
|
||||||
|
formVO.getItemName(),
|
||||||
|
formVO.getWorkName(),
|
||||||
|
formVO.getWorkLandArea(),
|
||||||
|
formVO.getAreaUnitCode(),
|
||||||
|
formVO.getAreaUnitSelf(),
|
||||||
|
formVO.getHarvestQuantity(),
|
||||||
|
formVO.getHarvestUnitCode(),
|
||||||
|
formVO.getHarvestUnitSelf(),
|
||||||
|
formVO.getOwnerTime(),
|
||||||
|
formVO.getSpouseTime(),
|
||||||
|
formVO.getFamilyMHours(),
|
||||||
|
formVO.getFamilyFHours(),
|
||||||
|
formVO.getHiredMHours(),
|
||||||
|
formVO.getHiredFHours(),
|
||||||
|
formVO.getSharedMHours(),
|
||||||
|
formVO.getSharedFHours(),
|
||||||
|
formVO.getVolunteerMHours(),
|
||||||
|
formVO.getVolunteerFHours());
|
||||||
|
|
||||||
|
portOut.create(findCmd, command);
|
||||||
|
|
||||||
|
dailyRecordPortIn.updateByAllStatus(findCmd.getSearchMonth(), findCmd.getGroupNo(), findCmd.getHouseholdSeq());
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,27 @@
|
|||||||
|
package app.module.admin.usecase.household.tab.dailyRecord.saveDailyWork.ports.application.domain;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.Setter;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
@AllArgsConstructor
|
||||||
|
public class GetDailyWorkCmd {
|
||||||
|
/**
|
||||||
|
* 검색 월(yyyyMM)
|
||||||
|
*/
|
||||||
|
private String searchMonth;
|
||||||
|
/**
|
||||||
|
* 검색 그룸번호
|
||||||
|
*/
|
||||||
|
private Integer groupNo;
|
||||||
|
/**
|
||||||
|
* 임가 일련번호
|
||||||
|
*/
|
||||||
|
private Long householdSeq;
|
||||||
|
/**
|
||||||
|
* 노동투입 일련번호
|
||||||
|
*/
|
||||||
|
private Long id;
|
||||||
|
}
|
||||||
@@ -0,0 +1,34 @@
|
|||||||
|
package app.module.admin.usecase.household.tab.dailyRecord.saveDailyWork.ports.application.domain;
|
||||||
|
|
||||||
|
import app.module.core.config.adapters.persistence.component.AuditCommand;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.Setter;
|
||||||
|
import lombok.ToString;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
@AllArgsConstructor
|
||||||
|
@ToString
|
||||||
|
public class SaveDailyWorkCmd extends AuditCommand {
|
||||||
|
private Long id;
|
||||||
|
private Long dailyRecordSeq;
|
||||||
|
private String itemName;
|
||||||
|
private String workName;
|
||||||
|
private Double workLandArea;
|
||||||
|
private String areaUnitCode;
|
||||||
|
private String areaUnitSelf;
|
||||||
|
private Double harvestQuantity;
|
||||||
|
private String harvestUnitCode;
|
||||||
|
private String harvestUnitSelf;
|
||||||
|
private Double ownerTime;
|
||||||
|
private Double spouseTime;
|
||||||
|
private Double familyMHours;
|
||||||
|
private Double familyFHours;
|
||||||
|
private Double hiredMHours;
|
||||||
|
private Double hiredFHours;
|
||||||
|
private Double sharedMHours;
|
||||||
|
private Double sharedFHours;
|
||||||
|
private Double volunteerMHours;
|
||||||
|
private Double volunteerFHours;
|
||||||
|
}
|
||||||
@@ -23,10 +23,15 @@
|
|||||||
/* getDailyIncomeRecords : 일계부 등록 현황 상세 수입 조회 */
|
/* getDailyIncomeRecords : 일계부 등록 현황 상세 수입 조회 */
|
||||||
SELECT di.id, /* 수입 id */
|
SELECT di.id, /* 수입 id */
|
||||||
di.input_type, /* 입력구분 */
|
di.input_type, /* 입력구분 */
|
||||||
|
di.category, /* 유형 */
|
||||||
|
di.income_mark, /* 수입 부호 */
|
||||||
|
di.expense_mark, /* 지출 부호 */
|
||||||
di.is_credit, /* 외상판매여부 */
|
di.is_credit, /* 외상판매여부 */
|
||||||
di.crop_code, /* 재배형태 코드 */
|
di.crop_code, /* 재배형태 코드 */
|
||||||
|
ui_crop.code_value AS crop_value, /* 재배형태 코드 값 */
|
||||||
ui_crop.code_text AS crop_text, /* 재배형태 코드 텍스트 */
|
ui_crop.code_text AS crop_text, /* 재배형태 코드 텍스트 */
|
||||||
di.income_kind, /* 수입의 종류 */
|
di.income_kind, /* 수입의 종류 */
|
||||||
|
di.income_kind_mark, /* 종류 부호 */
|
||||||
di.source_purpose, /* 수입원(용도) */
|
di.source_purpose, /* 수입원(용도) */
|
||||||
di.quantity, /* 수량 */
|
di.quantity, /* 수량 */
|
||||||
di.unit_code, /* 단위 코드 */
|
di.unit_code, /* 단위 코드 */
|
||||||
@@ -39,6 +44,10 @@
|
|||||||
di.estimated_value, /* 현물평가액 */
|
di.estimated_value, /* 현물평가액 */
|
||||||
di.updated_by, /* 최종수정자 */
|
di.updated_by, /* 최종수정자 */
|
||||||
TO_CHAR(di.updated_at, 'YYYY-MM-DD HH24:MI') AS updated_at /* 최종수정날짜 */
|
TO_CHAR(di.updated_at, 'YYYY-MM-DD HH24:MI') AS updated_at /* 최종수정날짜 */
|
||||||
|
<if test="searchMonth == true">
|
||||||
|
, EXTRACT(DAY FROM CAST(dr.start_date as date)) as start_day
|
||||||
|
, EXTRACT(DAY FROM CAST(dr.end_date as date)) as end_day
|
||||||
|
</if>
|
||||||
FROM daily_income di
|
FROM daily_income di
|
||||||
LEFT JOIN uicode ui_crop
|
LEFT JOIN uicode ui_crop
|
||||||
ON ui_crop.parent_id = 'code.record.crop'
|
ON ui_crop.parent_id = 'code.record.crop'
|
||||||
@@ -46,9 +55,19 @@
|
|||||||
LEFT JOIN uicode ui_unit
|
LEFT JOIN uicode ui_unit
|
||||||
ON ui_unit.parent_id = 'code.record.unit'
|
ON ui_unit.parent_id = 'code.record.unit'
|
||||||
AND ui_unit.id = di.unit_code
|
AND ui_unit.id = di.unit_code
|
||||||
WHERE di.daily_record_seq = #{recordSeq}
|
<if test="searchMonth == true">
|
||||||
AND di.is_deleted = false
|
INNER JOIN daily_record dr
|
||||||
|
ON dr.id = di.daily_record_seq
|
||||||
|
AND dr.is_deleted = false AND dr.household_seq = #{householdSeq} AND dr.record_month = #{recordMonth}
|
||||||
|
</if>
|
||||||
|
WHERE di.is_deleted = false
|
||||||
|
<if test="searchMonth == false">
|
||||||
|
AND di.daily_record_seq = #{recordSeq}
|
||||||
ORDER BY di.created_at
|
ORDER BY di.created_at
|
||||||
|
</if>
|
||||||
|
<if test="searchMonth == true">
|
||||||
|
ORDER BY dr.start_date asc, di.created_at asc
|
||||||
|
</if>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="getDailyWorkRecords"
|
<select id="getDailyWorkRecords"
|
||||||
@@ -56,10 +75,12 @@
|
|||||||
/* getDailyWorkRecords : 일계부 등록 현황 상세 임업노동 투입 내역 조회 */
|
/* getDailyWorkRecords : 일계부 등록 현황 상세 임업노동 투입 내역 조회 */
|
||||||
SELECT dw.id,
|
SELECT dw.id,
|
||||||
dw.item_name, /* 품목명 */
|
dw.item_name, /* 품목명 */
|
||||||
dw.work_name, /* 작업명*/
|
dw.item_mark, /* 품목 부호 */
|
||||||
|
dw.work_name, /* 작업명*/
|
||||||
|
dw.work_mark, /* 작업 부호 */
|
||||||
dw.work_land_area, /* 작업 면적 */
|
dw.work_land_area, /* 작업 면적 */
|
||||||
CASE
|
CASE
|
||||||
WHEN dw.area_unit_code = 'code.record.unit.self'
|
WHEN dw.area_unit_code = 'code.record.area.self'
|
||||||
THEN dw.area_unit_self
|
THEN dw.area_unit_self
|
||||||
ELSE ui_area.code_text
|
ELSE ui_area.code_text
|
||||||
END AS areaUnitText, /* 작업면적 단위 텍스트 */
|
END AS areaUnitText, /* 작업면적 단위 텍스트 */
|
||||||
@@ -81,16 +102,30 @@
|
|||||||
dw.volunteer_f_hours, /* 일손돕기(여) */
|
dw.volunteer_f_hours, /* 일손돕기(여) */
|
||||||
dw.updated_by, /* 최종수정자 */
|
dw.updated_by, /* 최종수정자 */
|
||||||
dw.updated_at /* 최종수정날짜 */
|
dw.updated_at /* 최종수정날짜 */
|
||||||
|
<if test="searchMonth == true">
|
||||||
|
, EXTRACT(DAY FROM CAST(dr.start_date as date)) as start_day
|
||||||
|
, EXTRACT(DAY FROM CAST(dr.end_date as date)) as end_day
|
||||||
|
</if>
|
||||||
FROM daily_work dw
|
FROM daily_work dw
|
||||||
LEFT JOIN uicode ui_area
|
LEFT JOIN uicode ui_area
|
||||||
ON ui_area.parent_id = 'code.record.unit'
|
ON ui_area.parent_id = 'code.record.area'
|
||||||
AND ui_area.id = dw.area_unit_code
|
AND ui_area.id = dw.area_unit_code
|
||||||
LEFT JOIN uicode ui_harvest
|
LEFT JOIN uicode ui_harvest
|
||||||
ON ui_harvest.parent_id = 'code.record.unit'
|
ON ui_harvest.parent_id = 'code.record.unit'
|
||||||
AND ui_harvest.id = dw.harvest_unit_code
|
AND ui_harvest.id = dw.harvest_unit_code
|
||||||
WHERE dw.daily_record_seq = #{recordSeq}
|
<if test="searchMonth == true">
|
||||||
AND dw.is_deleted = false
|
INNER JOIN daily_record dr
|
||||||
ORDER BY dw.created_at
|
ON dr.id = dw.daily_record_seq
|
||||||
|
AND dr.is_deleted = false AND dr.household_seq = #{householdSeq} AND dr.record_month = #{recordMonth}
|
||||||
|
</if>
|
||||||
|
WHERE dw.is_deleted = false
|
||||||
|
<if test="searchMonth == false">
|
||||||
|
AND dw.daily_record_seq = #{recordSeq}
|
||||||
|
ORDER BY dw.created_at
|
||||||
|
</if>
|
||||||
|
<if test="searchMonth == true">
|
||||||
|
ORDER BY dr.start_date asc, dw.created_at asc
|
||||||
|
</if>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="getDailyExpenseRecords"
|
<select id="getDailyExpenseRecords"
|
||||||
@@ -98,8 +133,12 @@
|
|||||||
/* getDailyExpenseRecords : 일계부 등록 현황 상세 지출 조회 */
|
/* getDailyExpenseRecords : 일계부 등록 현황 상세 지출 조회 */
|
||||||
SELECT de.id, /* 지출 id */
|
SELECT de.id, /* 지출 id */
|
||||||
de.input_type, /* 입력구분 */
|
de.input_type, /* 입력구분 */
|
||||||
|
de.category, /* 유형 */
|
||||||
|
de.income_mark, /* 수입 부호 */
|
||||||
|
de.expense_mark, /* 지출 부호 */
|
||||||
de.is_credit, /* 외상판매여부 */
|
de.is_credit, /* 외상판매여부 */
|
||||||
de.expense_kind, /* 지출 종류 */
|
de.expense_kind, /* 지출 종류 */
|
||||||
|
de.expense_kind_mark, /* 종류 부호 */
|
||||||
de.source_purpose, /* 지출원(용도) */
|
de.source_purpose, /* 지출원(용도) */
|
||||||
de.quantity, /* 수량 */
|
de.quantity, /* 수량 */
|
||||||
de.unit_code, /* 단위 */
|
de.unit_code, /* 단위 */
|
||||||
@@ -112,13 +151,27 @@
|
|||||||
de.estimated_value, /* 현물평가액 */
|
de.estimated_value, /* 현물평가액 */
|
||||||
de.updated_by, /* 최종수정자 */
|
de.updated_by, /* 최종수정자 */
|
||||||
TO_CHAR(de.updated_at, 'YYYY-MM-DD HH24:MI') AS updated_at /* 최종수정날짜 */
|
TO_CHAR(de.updated_at, 'YYYY-MM-DD HH24:MI') AS updated_at /* 최종수정날짜 */
|
||||||
|
<if test="searchMonth == true">
|
||||||
|
, EXTRACT(DAY FROM CAST(dr.start_date as date)) as start_day
|
||||||
|
, EXTRACT(DAY FROM CAST(dr.end_date as date)) as end_day
|
||||||
|
</if>
|
||||||
FROM daily_expense de
|
FROM daily_expense de
|
||||||
LEFT JOIN uicode ui_unit
|
LEFT JOIN uicode ui_unit
|
||||||
ON ui_unit.parent_id = 'code.record.unit'
|
ON ui_unit.parent_id = 'code.record.unit'
|
||||||
AND ui_unit.id = de.unit_code
|
AND ui_unit.id = de.unit_code
|
||||||
WHERE de.daily_record_seq = #{recordSeq}
|
<if test="searchMonth == true">
|
||||||
AND de.is_deleted = false
|
INNER JOIN daily_record dr
|
||||||
|
ON dr.id = de.daily_record_seq
|
||||||
|
AND dr.is_deleted = false AND dr.household_seq = #{householdSeq} AND dr.record_month = #{recordMonth}
|
||||||
|
</if>
|
||||||
|
WHERE de.is_deleted = false
|
||||||
|
<if test="searchMonth == false">
|
||||||
|
AND de.daily_record_seq = #{recordSeq}
|
||||||
ORDER BY de.created_at
|
ORDER BY de.created_at
|
||||||
|
</if>
|
||||||
|
<if test="searchMonth == true">
|
||||||
|
ORDER BY dr.start_date, de.created_at asc
|
||||||
|
</if>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="getDailyPowerRecords"
|
<select id="getDailyPowerRecords"
|
||||||
@@ -126,20 +179,37 @@
|
|||||||
/* getDailyPowerRecords : 일계부 등록 현황 상세 동력사용시간 조회 */
|
/* getDailyPowerRecords : 일계부 등록 현황 상세 동력사용시간 조회 */
|
||||||
SELECT dp.id, /* 동력사용시간 id */
|
SELECT dp.id, /* 동력사용시간 id */
|
||||||
dp.equipment_name, /* 명칭 */
|
dp.equipment_name, /* 명칭 */
|
||||||
|
dp.equipment_mark, /* 명칭 부호 */
|
||||||
dp.owned_hours, /* 자가 사용시간 */
|
dp.owned_hours, /* 자가 사용시간 */
|
||||||
dp.leased_hours, /* 임가 사용시간 */
|
dp.leased_hours, /* 임가 사용시간 */
|
||||||
dp.updated_by, /* 최종수정자 */
|
dp.updated_by, /* 최종수정자 */
|
||||||
TO_CHAR(dp.updated_at, 'YYYY-MM-DD HH24:MI') AS updated_at /* 최종수정날짜 */
|
TO_CHAR(dp.updated_at, 'YYYY-MM-DD HH24:MI') AS updated_at /* 최종수정날짜 */
|
||||||
|
<if test="searchMonth == true">
|
||||||
|
, EXTRACT(DAY FROM CAST(dr.start_date as date)) as start_day
|
||||||
|
, EXTRACT(DAY FROM CAST(dr.end_date as date)) as end_day
|
||||||
|
</if>
|
||||||
FROM daily_power dp
|
FROM daily_power dp
|
||||||
WHERE dp.daily_record_seq = #{recordSeq}
|
<if test="searchMonth == true">
|
||||||
AND dp.is_deleted = false
|
INNER JOIN daily_record dr
|
||||||
ORDER BY dp.created_at
|
ON dr.id = dp.daily_record_seq
|
||||||
|
AND dr.is_deleted = false AND dr.household_seq = #{householdSeq} AND dr.record_month = #{recordMonth}
|
||||||
|
</if>
|
||||||
|
WHERE dp.is_deleted = false
|
||||||
|
<if test="searchMonth == false">
|
||||||
|
AND dp.daily_record_seq = #{recordSeq}
|
||||||
|
ORDER BY dp.created_at
|
||||||
|
</if>
|
||||||
|
<if test="searchMonth == true">
|
||||||
|
ORDER BY dr.start_date asc, dp.created_at asc
|
||||||
|
</if>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="getDailyForestryRecords"
|
<select id="getDailyForestryRecords"
|
||||||
resultType="app.module.admin.usecase.household.tab.dailyRecord.getDailyRecordStatusDetail.ports.application.domain.GetDailyForestryRecords">
|
resultType="app.module.admin.usecase.household.tab.dailyRecord.getDailyRecordStatusDetail.ports.application.domain.GetDailyForestryRecords">
|
||||||
/* getDailyForestryRecords : 일계부 등록 현황 상세 자가임업 생산물 중 자가소비량 조회 */
|
/* getDailyForestryRecords : 일계부 등록 현황 상세 자가임업 생산물 중 자가소비량 조회 */
|
||||||
SELECT df.id, /* 자가임업 id */
|
SELECT df.id, /* 자가임업 id */
|
||||||
|
df.income_mark, /* 수입 부호 */
|
||||||
|
df.expense_mark, /* 지출 부호 */
|
||||||
df.product_name, /* 생산물 */
|
df.product_name, /* 생산물 */
|
||||||
df.usage, /* 용도 */
|
df.usage, /* 용도 */
|
||||||
df.quantity, /* 수량 */
|
df.quantity, /* 수량 */
|
||||||
@@ -152,19 +222,35 @@
|
|||||||
df.estimated_value, /* 현물평가액 */
|
df.estimated_value, /* 현물평가액 */
|
||||||
df.updated_by, /* 최종수정자 */
|
df.updated_by, /* 최종수정자 */
|
||||||
TO_CHAR(df.updated_at, 'YYYY-MM-DD HH24:MI') AS updated_at /* 최종수정날짜 */
|
TO_CHAR(df.updated_at, 'YYYY-MM-DD HH24:MI') AS updated_at /* 최종수정날짜 */
|
||||||
|
<if test="searchMonth == true">
|
||||||
|
, EXTRACT(DAY FROM CAST(dr.start_date as date)) as start_day
|
||||||
|
, EXTRACT(DAY FROM CAST(dr.end_date as date)) as end_day
|
||||||
|
</if>
|
||||||
FROM daily_forestry df
|
FROM daily_forestry df
|
||||||
LEFT JOIN uicode ui_unit
|
LEFT JOIN uicode ui_unit
|
||||||
ON ui_unit.parent_id = 'code.record.unit'
|
ON ui_unit.parent_id = 'code.record.unit'
|
||||||
AND ui_unit.id = df.unit_code
|
AND ui_unit.id = df.unit_code
|
||||||
WHERE df.daily_record_seq = #{recordSeq}
|
<if test="searchMonth == true">
|
||||||
AND df.is_deleted = false
|
INNER JOIN daily_record dr
|
||||||
ORDER BY df.created_at
|
ON dr.id = df.daily_record_seq
|
||||||
|
AND dr.is_deleted = false AND dr.household_seq = #{householdSeq} AND dr.record_month = #{recordMonth}
|
||||||
|
</if>
|
||||||
|
WHERE df.is_deleted = false
|
||||||
|
<if test="searchMonth == false">
|
||||||
|
AND df.daily_record_seq = #{recordSeq}
|
||||||
|
ORDER BY df.created_at
|
||||||
|
</if>
|
||||||
|
<if test="searchMonth == true">
|
||||||
|
ORDER BY dr.start_date asc, df.created_at asc
|
||||||
|
</if>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="getDailyFarmingRecords"
|
<select id="getDailyFarmingRecords"
|
||||||
resultType="app.module.admin.usecase.household.tab.dailyRecord.getDailyRecordStatusDetail.ports.application.domain.GetDailyFarmingRecords">
|
resultType="app.module.admin.usecase.household.tab.dailyRecord.getDailyRecordStatusDetail.ports.application.domain.GetDailyFarmingRecords">
|
||||||
/* getDailyFarmingRecords : 일계부 등록 현황 상세 자가농업 생산물 중 자가소비량 조회 */
|
/* getDailyFarmingRecords : 일계부 등록 현황 상세 자가농업 생산물 중 자가소비량 조회 */
|
||||||
SELECT df.id, /* 자가농업 id */
|
SELECT df.id, /* 자가농업 id */
|
||||||
|
df.income_mark, /* 수입 부호 */
|
||||||
|
df.expense_mark, /* 종류 부호 */
|
||||||
CASE
|
CASE
|
||||||
WHEN df.product_code = 'code.record.farming.self'
|
WHEN df.product_code = 'code.record.farming.self'
|
||||||
THEN df.product_self
|
THEN df.product_self
|
||||||
@@ -180,6 +266,10 @@
|
|||||||
df.estimated_value, /* 현물평가액 */
|
df.estimated_value, /* 현물평가액 */
|
||||||
df.updated_by, /* 최종수정자 */
|
df.updated_by, /* 최종수정자 */
|
||||||
TO_CHAR(df.updated_at, 'YYYY-MM-DD HH24:MI') AS updated_at /* 최종수정날짜 */
|
TO_CHAR(df.updated_at, 'YYYY-MM-DD HH24:MI') AS updated_at /* 최종수정날짜 */
|
||||||
|
<if test="searchMonth == true">
|
||||||
|
, EXTRACT(DAY FROM CAST(dr.start_date as date)) as start_day
|
||||||
|
, EXTRACT(DAY FROM CAST(dr.end_date as date)) as end_day
|
||||||
|
</if>
|
||||||
FROM daily_farming df
|
FROM daily_farming df
|
||||||
LEFT JOIN uicode ui_product
|
LEFT JOIN uicode ui_product
|
||||||
ON ui_product.parent_id = 'code.record.farming'
|
ON ui_product.parent_id = 'code.record.farming'
|
||||||
@@ -187,9 +277,19 @@
|
|||||||
LEFT JOIN uicode ui_unit
|
LEFT JOIN uicode ui_unit
|
||||||
ON ui_unit.parent_id = 'code.record.unit'
|
ON ui_unit.parent_id = 'code.record.unit'
|
||||||
AND ui_unit.id = df.unit_code
|
AND ui_unit.id = df.unit_code
|
||||||
WHERE df.daily_record_seq = #{recordSeq}
|
<if test="searchMonth == true">
|
||||||
AND df.is_deleted = false
|
INNER JOIN daily_record dr
|
||||||
ORDER BY df.created_at
|
ON dr.id = df.daily_record_seq
|
||||||
|
AND dr.is_deleted = false AND dr.household_seq = #{householdSeq} AND dr.record_month = #{recordMonth}
|
||||||
|
</if>
|
||||||
|
WHERE df.is_deleted = false
|
||||||
|
<if test="searchMonth == false">
|
||||||
|
AND df.daily_record_seq = #{recordSeq}
|
||||||
|
ORDER BY df.created_at
|
||||||
|
</if>
|
||||||
|
<if test="searchMonth == true">
|
||||||
|
ORDER BY dr.start_date asc, df.created_at asc
|
||||||
|
</if>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
||||||
@@ -19,7 +19,10 @@
|
|||||||
update daily_work set
|
update daily_work set
|
||||||
<include refid="common.fields.DeleteBaseSet"/>
|
<include refid="common.fields.DeleteBaseSet"/>
|
||||||
where is_deleted = false
|
where is_deleted = false
|
||||||
and daily_record_seq = #{dailyRecordSeq}
|
and id IN
|
||||||
|
<foreach collection="removeIds" item="id" open="(" separator="," close=")">
|
||||||
|
#{id}
|
||||||
|
</foreach>
|
||||||
</if>
|
</if>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
@@ -28,7 +31,10 @@
|
|||||||
update daily_expense set
|
update daily_expense set
|
||||||
<include refid="common.fields.DeleteBaseSet"/>
|
<include refid="common.fields.DeleteBaseSet"/>
|
||||||
where is_deleted = false
|
where is_deleted = false
|
||||||
and daily_record_seq = #{dailyRecordSeq}
|
and id IN
|
||||||
|
<foreach collection="removeIds" item="id" open="(" separator="," close=")">
|
||||||
|
#{id}
|
||||||
|
</foreach>
|
||||||
</if>
|
</if>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
@@ -37,7 +43,10 @@
|
|||||||
update daily_power set
|
update daily_power set
|
||||||
<include refid="common.fields.DeleteBaseSet"/>
|
<include refid="common.fields.DeleteBaseSet"/>
|
||||||
where is_deleted = false
|
where is_deleted = false
|
||||||
and daily_record_seq = #{dailyRecordSeq}
|
and id IN
|
||||||
|
<foreach collection="removeIds" item="id" open="(" separator="," close=")">
|
||||||
|
#{id}
|
||||||
|
</foreach>
|
||||||
</if>
|
</if>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
@@ -46,7 +55,10 @@
|
|||||||
update daily_forestry set
|
update daily_forestry set
|
||||||
<include refid="common.fields.DeleteBaseSet"/>
|
<include refid="common.fields.DeleteBaseSet"/>
|
||||||
where is_deleted = false
|
where is_deleted = false
|
||||||
and daily_record_seq = #{dailyRecordSeq}
|
and id IN
|
||||||
|
<foreach collection="removeIds" item="id" open="(" separator="," close=")">
|
||||||
|
#{id}
|
||||||
|
</foreach>
|
||||||
</if>
|
</if>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
@@ -55,7 +67,10 @@
|
|||||||
update daily_farming set
|
update daily_farming set
|
||||||
<include refid="common.fields.DeleteBaseSet"/>
|
<include refid="common.fields.DeleteBaseSet"/>
|
||||||
where is_deleted = false
|
where is_deleted = false
|
||||||
and daily_record_seq = #{dailyRecordSeq}
|
and id IN
|
||||||
|
<foreach collection="removeIds" item="id" open="(" separator="," close=")">
|
||||||
|
#{id}
|
||||||
|
</foreach>
|
||||||
</if>
|
</if>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,58 @@
|
|||||||
|
<?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.saveDailyExpense.adapters.persistence.SaveDailyExpenseMapper">
|
||||||
|
|
||||||
|
<select id="getDailyExpense"
|
||||||
|
resultType="app.module.admin.usecase.household.tab.dailyRecord.saveDailyExpense.adapters.persistence.modal.GetDailyExpenseDto">
|
||||||
|
select ds.id, ds.daily_record_seq, ds.input_type, ds.is_credit as credit
|
||||||
|
, ds.expense_kind, ds.source_purpose
|
||||||
|
, ds.quantity, ds.unit_code, ds.unit_self, ds.price, ds.estimated_value
|
||||||
|
from daily_expense ds
|
||||||
|
<include refid="app.module.core.usecase.daily.record.adapters.persistence.DailyRecordMapper.InnerJoinByDailyRecord"/>
|
||||||
|
where ds.is_deleted = false
|
||||||
|
and ds.id = #{id}
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="getRecordExistCount" resultType="int">
|
||||||
|
select count(1)
|
||||||
|
from daily_expense ds
|
||||||
|
<include refid="app.module.core.usecase.daily.record.adapters.persistence.DailyRecordMapper.InnerJoinByDailyRecord"/>
|
||||||
|
where ds.is_deleted = false
|
||||||
|
<if test="id != null and id != '0'">
|
||||||
|
and ds.id = #{id}
|
||||||
|
</if>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<insert id="createDailyExpense" useGeneratedKeys="true" keyProperty="id">
|
||||||
|
insert into daily_expense (
|
||||||
|
daily_record_seq, input_type, category, income_mark
|
||||||
|
, is_credit, expense_kind, source_purpose
|
||||||
|
, quantity, unit_code, unit_self, price, estimated_value
|
||||||
|
, is_deleted
|
||||||
|
, <include refid="common.fields.CreateUpdateBaseColumns"/>
|
||||||
|
) values (
|
||||||
|
#{dailyRecordSeq}, #{inputType}, #{category}, #{incomeMark}
|
||||||
|
, #{credit}, #{expenseKind}, #{sourcePurpose}
|
||||||
|
, #{quantity}, #{unitCode}, #{unitSelf}, #{price}, #{estimatedValue}
|
||||||
|
, false
|
||||||
|
, <include refid="common.fields.CreateUpdateBaseValues"/>
|
||||||
|
)
|
||||||
|
</insert>
|
||||||
|
|
||||||
|
<update id="updateDailyExpense">
|
||||||
|
update daily_expense set <include refid="common.fields.UpdateBaseSet"/>
|
||||||
|
, is_credit = #{credit}
|
||||||
|
, income_mark = #{incomeMark}
|
||||||
|
, expense_kind = #{expenseKind}
|
||||||
|
, source_purpose = #{sourcePurpose}
|
||||||
|
, quantity = #{quantity}
|
||||||
|
, unit_code = #{unitCode}
|
||||||
|
, unit_self = #{unitSelf}
|
||||||
|
, price = #{price}
|
||||||
|
, estimated_value = #{estimatedValue}
|
||||||
|
where is_deleted = false
|
||||||
|
and daily_record_seq = #{dailyRecordSeq}
|
||||||
|
and id = #{id}
|
||||||
|
</update>
|
||||||
|
|
||||||
|
</mapper>
|
||||||
@@ -0,0 +1,58 @@
|
|||||||
|
<?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.saveDailyFarming.adapters.persistence.SaveDailyFarmingMapper">
|
||||||
|
|
||||||
|
<select id="getDailyFarming"
|
||||||
|
resultType="app.module.admin.usecase.household.tab.dailyRecord.saveDailyFarming.adapters.persistence.modal.GetDailyFarmingDto">
|
||||||
|
select ds.id, ds.daily_record_seq
|
||||||
|
, ds.product_code, ds.product_self, ds.usage
|
||||||
|
, ds.quantity, ds.unit_code, ds.unit_self, ds.estimated_value
|
||||||
|
from daily_farming ds
|
||||||
|
<include refid="app.module.core.usecase.daily.record.adapters.persistence.DailyRecordMapper.InnerJoinByDailyRecord"/>
|
||||||
|
where ds.is_deleted = false
|
||||||
|
and ds.id = #{id}
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="getRecordExistCount" resultType="int">
|
||||||
|
select count(1)
|
||||||
|
from daily_farming ds
|
||||||
|
<include refid="app.module.core.usecase.daily.record.adapters.persistence.DailyRecordMapper.InnerJoinByDailyRecord"/>
|
||||||
|
where ds.is_deleted = false
|
||||||
|
<if test="id != null and id != '0'">
|
||||||
|
and ds.id = #{id}
|
||||||
|
</if>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<insert id="createDailyFarming" useGeneratedKeys="true" keyProperty="id">
|
||||||
|
insert into daily_farming (
|
||||||
|
daily_record_seq, income_mark, expense_mark
|
||||||
|
, product_code, product_self, usage
|
||||||
|
, quantity, unit_code, unit_self, estimated_value
|
||||||
|
, is_deleted
|
||||||
|
, <include refid="common.fields.CreateUpdateBaseColumns"/>
|
||||||
|
) values (
|
||||||
|
#{dailyRecordSeq}, #{incomeMark}, #{expenseMark}
|
||||||
|
, #{productCode}, #{productSelf}, #{usage}
|
||||||
|
, #{quantity}, #{unitCode}, #{unitSelf}, #{estimatedValue}
|
||||||
|
, false
|
||||||
|
, <include refid="common.fields.CreateUpdateBaseValues"/>
|
||||||
|
)
|
||||||
|
</insert>
|
||||||
|
|
||||||
|
<update id="updateDailyFarming">
|
||||||
|
update daily_farming set <include refid="common.fields.UpdateBaseSet"/>
|
||||||
|
, income_mark = #{incomeMark}
|
||||||
|
, expense_mark = #{expenseMark}
|
||||||
|
, product_code = #{productCode}
|
||||||
|
, product_self = #{productSelf}
|
||||||
|
, usage = #{usage}
|
||||||
|
, quantity = #{quantity}
|
||||||
|
, unit_code = #{unitCode}
|
||||||
|
, unit_self = #{unitSelf}
|
||||||
|
, estimated_value = #{estimatedValue}
|
||||||
|
where is_deleted = false
|
||||||
|
and daily_record_seq = #{dailyRecordSeq}
|
||||||
|
and id = #{id}
|
||||||
|
</update>
|
||||||
|
|
||||||
|
</mapper>
|
||||||
@@ -0,0 +1,56 @@
|
|||||||
|
<?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.saveDailyForestry.adapters.persistence.SaveDailyForestryMapper">
|
||||||
|
|
||||||
|
<select id="getDailyForestry"
|
||||||
|
resultType="app.module.admin.usecase.household.tab.dailyRecord.saveDailyForestry.adapters.persistence.modal.GetDailyForestryDto">
|
||||||
|
select ds.id, ds.daily_record_seq
|
||||||
|
, ds.product_name, ds.usage
|
||||||
|
, ds.quantity, ds.unit_code, ds.unit_self, ds.estimated_value
|
||||||
|
from daily_forestry ds
|
||||||
|
<include refid="app.module.core.usecase.daily.record.adapters.persistence.DailyRecordMapper.InnerJoinByDailyRecord"/>
|
||||||
|
where ds.is_deleted = false
|
||||||
|
and ds.id = #{id}
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="getRecordExistCount" resultType="int">
|
||||||
|
select count(1)
|
||||||
|
from daily_forestry ds
|
||||||
|
<include refid="app.module.core.usecase.daily.record.adapters.persistence.DailyRecordMapper.InnerJoinByDailyRecord"/>
|
||||||
|
where ds.is_deleted = false
|
||||||
|
<if test="id != null and id != '0'">
|
||||||
|
and ds.id = #{id}
|
||||||
|
</if>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<insert id="createDailyForestry" useGeneratedKeys="true" keyProperty="id">
|
||||||
|
insert into daily_forestry (
|
||||||
|
daily_record_seq, expense_mark
|
||||||
|
, product_name, usage
|
||||||
|
, quantity, unit_code, unit_self, estimated_value
|
||||||
|
, is_deleted
|
||||||
|
, <include refid="common.fields.CreateUpdateBaseColumns"/>
|
||||||
|
) values (
|
||||||
|
#{dailyRecordSeq}, #{expenseMark}
|
||||||
|
, #{productName}, #{usage}
|
||||||
|
, #{quantity}, #{unitCode}, #{unitSelf}, #{estimatedValue}
|
||||||
|
, false
|
||||||
|
, <include refid="common.fields.CreateUpdateBaseValues"/>
|
||||||
|
)
|
||||||
|
</insert>
|
||||||
|
|
||||||
|
<update id="updateDailyForestry">
|
||||||
|
update daily_forestry set <include refid="common.fields.UpdateBaseSet"/>
|
||||||
|
, expense_mark = #{expenseMark}
|
||||||
|
, product_name = #{productName}
|
||||||
|
, usage = #{usage}
|
||||||
|
, quantity = #{quantity}
|
||||||
|
, unit_code = #{unitCode}
|
||||||
|
, unit_self = #{unitSelf}
|
||||||
|
, estimated_value = #{estimatedValue}
|
||||||
|
where is_deleted = false
|
||||||
|
and daily_record_seq = #{dailyRecordSeq}
|
||||||
|
and id = #{id}
|
||||||
|
</update>
|
||||||
|
|
||||||
|
</mapper>
|
||||||
@@ -0,0 +1,49 @@
|
|||||||
|
<?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.saveDailyPower.adapters.persistence.SaveDailyPowerMapper">
|
||||||
|
|
||||||
|
<select id="getDailyPower"
|
||||||
|
resultType="app.module.admin.usecase.household.tab.dailyRecord.saveDailyPower.adapters.persistence.modal.GetDailyPowerDto">
|
||||||
|
select ds.id, ds.daily_record_seq
|
||||||
|
, ds.equipment_name, ds.owned_hours, ds.leased_hours
|
||||||
|
from daily_power ds
|
||||||
|
<include refid="app.module.core.usecase.daily.record.adapters.persistence.DailyRecordMapper.InnerJoinByDailyRecord"/>
|
||||||
|
where ds.is_deleted = false
|
||||||
|
and ds.id = #{id}
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="getRecordExistCount" resultType="int">
|
||||||
|
select count(1)
|
||||||
|
from daily_power ds
|
||||||
|
<include refid="app.module.core.usecase.daily.record.adapters.persistence.DailyRecordMapper.InnerJoinByDailyRecord"/>
|
||||||
|
where ds.is_deleted = false
|
||||||
|
<if test="id != null and id != '0'">
|
||||||
|
and ds.id = #{id}
|
||||||
|
</if>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<insert id="createDailyPower" useGeneratedKeys="true" keyProperty="id">
|
||||||
|
insert into daily_power (
|
||||||
|
daily_record_seq
|
||||||
|
, equipment_name, owned_hours, leased_hours
|
||||||
|
, is_deleted
|
||||||
|
, <include refid="common.fields.CreateUpdateBaseColumns"/>
|
||||||
|
) values (
|
||||||
|
#{dailyRecordSeq}
|
||||||
|
, #{equipmentName}, #{ownedHours}, #{leasedHours}
|
||||||
|
, false
|
||||||
|
, <include refid="common.fields.CreateUpdateBaseValues"/>
|
||||||
|
)
|
||||||
|
</insert>
|
||||||
|
|
||||||
|
<update id="updateDailyPower">
|
||||||
|
update daily_power set <include refid="common.fields.UpdateBaseSet"/>
|
||||||
|
, equipment_name = #{equipmentName}
|
||||||
|
, owned_hours = #{ownedHours}
|
||||||
|
, leased_hours = #{leasedHours}
|
||||||
|
where is_deleted = false
|
||||||
|
and daily_record_seq = #{dailyRecordSeq}
|
||||||
|
and id = #{id}
|
||||||
|
</update>
|
||||||
|
|
||||||
|
</mapper>
|
||||||
@@ -0,0 +1,71 @@
|
|||||||
|
<?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.saveDailyWork.adapters.persistence.SaveDailyWorkMapper">
|
||||||
|
|
||||||
|
<select id="getDailyWork"
|
||||||
|
resultType="app.module.admin.usecase.household.tab.dailyRecord.saveDailyWork.adapters.persistence.modal.GetDailyWorkDto">
|
||||||
|
select ds.id, ds.daily_record_seq
|
||||||
|
, ds.item_name, ds.work_name
|
||||||
|
, ds.work_land_area, ds.area_unit_code, ds.area_unit_self, ds.harvest_quantity, ds.harvest_unit_code, ds.harvest_unit_self
|
||||||
|
, ds.owner_time, ds.spouse_time, ds.family_m_hours, ds.family_f_hours, ds.hired_m_hours
|
||||||
|
, ds.hired_f_hours, ds.shared_m_hours, ds.shared_f_hours, ds.volunteer_m_hours, ds.volunteer_f_hours
|
||||||
|
from daily_work ds
|
||||||
|
<include refid="app.module.core.usecase.daily.record.adapters.persistence.DailyRecordMapper.InnerJoinByDailyRecord"/>
|
||||||
|
where ds.is_deleted = false
|
||||||
|
and ds.id = #{id}
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="getRecordExistCount" resultType="int">
|
||||||
|
select count(1)
|
||||||
|
from daily_work ds
|
||||||
|
<include refid="app.module.core.usecase.daily.record.adapters.persistence.DailyRecordMapper.InnerJoinByDailyRecord"/>
|
||||||
|
where ds.is_deleted = false
|
||||||
|
<if test="id != null and id != '0'">
|
||||||
|
and ds.id = #{id}
|
||||||
|
</if>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<insert id="createDailyWork" useGeneratedKeys="true" keyProperty="id">
|
||||||
|
insert into daily_work (
|
||||||
|
daily_record_seq
|
||||||
|
, item_name, work_name
|
||||||
|
, work_land_area, area_unit_code, area_unit_self, harvest_quantity, harvest_unit_code, harvest_unit_self
|
||||||
|
, owner_time, spouse_time, family_m_hours, family_f_hours, hired_m_hours, hired_f_hours, shared_m_hours, shared_f_hours, volunteer_m_hours, volunteer_f_hours
|
||||||
|
, is_deleted
|
||||||
|
, <include refid="common.fields.CreateUpdateBaseColumns"/>
|
||||||
|
) values (
|
||||||
|
#{dailyRecordSeq}
|
||||||
|
, #{itemName}, #{workName}
|
||||||
|
, #{workLandArea}, #{areaUnitCode}, #{areaUnitSelf}, #{harvestQuantity}, #{harvestUnitCode}, #{harvestUnitSelf}
|
||||||
|
, #{ownerTime}, #{spouseTime}, #{familyMHours}, #{familyFHours}, #{hiredMHours}, #{hiredFHours}, #{sharedMHours}, #{sharedFHours}, #{volunteerMHours}, #{volunteerFHours}
|
||||||
|
, false
|
||||||
|
, <include refid="common.fields.CreateUpdateBaseValues"/>
|
||||||
|
)
|
||||||
|
</insert>
|
||||||
|
|
||||||
|
<update id="updateDailyWork">
|
||||||
|
update daily_work set <include refid="common.fields.UpdateBaseSet"/>
|
||||||
|
, item_name = #{itemName}
|
||||||
|
, work_name = #{workName}
|
||||||
|
, work_land_area = #{workLandArea}
|
||||||
|
, area_unit_code = #{areaUnitCode}
|
||||||
|
, area_unit_self = #{areaUnitSelf}
|
||||||
|
, harvest_quantity = #{harvestQuantity}
|
||||||
|
, harvest_unit_code = #{harvestUnitCode}
|
||||||
|
, harvest_unit_self = #{harvestUnitSelf}
|
||||||
|
, owner_time = #{ownerTime}
|
||||||
|
, spouse_time = #{spouseTime}
|
||||||
|
, family_m_hours = #{familyMHours}
|
||||||
|
, family_f_hours = #{familyFHours}
|
||||||
|
, hired_m_hours = #{hiredMHours}
|
||||||
|
, hired_f_hours = #{hiredFHours}
|
||||||
|
, shared_m_hours = #{sharedMHours}
|
||||||
|
, shared_f_hours = #{sharedFHours}
|
||||||
|
, volunteer_m_hours = #{volunteerMHours}
|
||||||
|
, volunteer_f_hours = #{volunteerFHours}
|
||||||
|
where is_deleted = false
|
||||||
|
and daily_record_seq = #{dailyRecordSeq}
|
||||||
|
and id = #{id}
|
||||||
|
</update>
|
||||||
|
|
||||||
|
</mapper>
|
||||||
@@ -0,0 +1,252 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout" xmlns:th="http://www.thymeleaf.org"
|
||||||
|
layout:decorate="~{layout/layout}">
|
||||||
|
|
||||||
|
<div class="layer-wrap" th:fragment="modalFragment">
|
||||||
|
<form autocomplete="off" method="get" name="reqExpenseForm" data-modal-id=".modal-daily-expense">
|
||||||
|
<input type="hidden" name="householdSeq" th:value="${seq}">
|
||||||
|
<input type="hidden" name="searchMonth">
|
||||||
|
<input type="hidden" name="groupNo">
|
||||||
|
<input type="hidden" name="id">
|
||||||
|
<input type="hidden" name="dailyId">
|
||||||
|
|
||||||
|
<div class="component-modal mypage-wrap modal01 modal-daily-expense" data-props-dimm-click="true" data-state="close">
|
||||||
|
<div class="modal-dimm"></div>
|
||||||
|
<div class="modal-frame">
|
||||||
|
<div class="modal-container">
|
||||||
|
<div class="modal-header">
|
||||||
|
<h3 class="modal-tit">
|
||||||
|
일계부 수입
|
||||||
|
</h3>
|
||||||
|
</div>
|
||||||
|
<div class="modal-content">
|
||||||
|
<div class="modal-content-inner">
|
||||||
|
<table class="type-form confirm">
|
||||||
|
<colgroup>
|
||||||
|
<col width="8%" />
|
||||||
|
<col width="25.3%" />
|
||||||
|
<col width="8%" />
|
||||||
|
<col width="25.3%" />
|
||||||
|
<col width="8%" />
|
||||||
|
<col width="25.3%" />
|
||||||
|
</colgroup>
|
||||||
|
<tbody>
|
||||||
|
|
||||||
|
<tr>
|
||||||
|
<th>외상 또는 카드 구입 여부</th>
|
||||||
|
<td class="radio-group" colspan="4">
|
||||||
|
<div class="component-input">
|
||||||
|
<label class="radio-inner">
|
||||||
|
<input type="radio" id="isCredit_N" name="credit" value="false" checked>
|
||||||
|
<span class="radio-item">
|
||||||
|
<span class="radio-txt">N</span>
|
||||||
|
</span>
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
<div class="component-input">
|
||||||
|
<label class="radio-inner">
|
||||||
|
<input type="radio" id="isCredit_Y" name="credit" value="true">
|
||||||
|
<span class="radio-item">
|
||||||
|
<span class="radio-txt">Y</span>
|
||||||
|
</span>
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
<tr>
|
||||||
|
<th>지출의 종류<i class="ico-required-mark" role="img" aria-label="필수">*</i></th>
|
||||||
|
<td>
|
||||||
|
<div class="component-input">
|
||||||
|
<div class="input-field">
|
||||||
|
<input type="text" id="expenseKind" name="expenseKind" maxlength="30">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
<th>용도<i class="ico-required-mark" role="img" aria-label="필수">*</i></th>
|
||||||
|
<td>
|
||||||
|
<div class="component-input">
|
||||||
|
<div class="input-field">
|
||||||
|
<input type="text" id="sourcePurpose" name="sourcePurpose" maxlength="30">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
<tr>
|
||||||
|
<th>수량</th>
|
||||||
|
<td>
|
||||||
|
<div class="component-input">
|
||||||
|
<div class="input-field">
|
||||||
|
<input type="number" inputmode="decimal" pattern="[0-9]*" id="quantity" name="quantity" min="1" max="9999999999"
|
||||||
|
maxlength="10" oninput="limitMaxLength(this);">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
|
||||||
|
<th>단위</th>
|
||||||
|
<td colspan="2">
|
||||||
|
<div class="d-flex">
|
||||||
|
<div class="component-select">
|
||||||
|
<select class="select-list" name="unitCode" onchange="selectedUnit(this);" required>
|
||||||
|
<option value="">선택</option>
|
||||||
|
<option th:each="item : ${recordUnit}"
|
||||||
|
th:value="${item.id}"
|
||||||
|
th:text="${item.codeText}">
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
<div class="component-input unit-self-input">
|
||||||
|
<div class="input-field">
|
||||||
|
<input type="text" id="unitSelf" name="unitSelf" maxlength="30" disabled>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
<tr>
|
||||||
|
<th>현금(원)<i class="ico-required-mark" role="img" aria-label="필수">*</i></th>
|
||||||
|
<td>
|
||||||
|
<div class="component-input">
|
||||||
|
<div class="input-field">
|
||||||
|
<input type="number" inputmode="numeric" pattern="[0-9]*" id="price" name="price" step="0" min="1" max="9999999999"
|
||||||
|
maxlength="10" oninput="limitMaxLength(this); priceDisabled(this, this.form.estimatedValue)">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
<th>현물(평가액)<i class="ico-required-mark" role="img" aria-label="필수">*</i></th>
|
||||||
|
<td>
|
||||||
|
<div class="component-input">
|
||||||
|
<div class="input-field">
|
||||||
|
<input type="number" inputmode="numeric" pattern="[0-9]*" id="estimatedValue" name="estimatedValue" step="0" min="1" max="9999999999"
|
||||||
|
maxlength="10" oninput="limitMaxLength(this); priceDisabled(this, this.form.price)">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
<div class="component-btns bottom-btn-group">
|
||||||
|
<div class="btns-row align-right">
|
||||||
|
<button type="button" class="btn btn-primary" onclick="saveDailyExpense();">
|
||||||
|
<span class="btn-txt">등록</span>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<button type="button" class="modal-close"></button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
|
||||||
|
<script th:inline="javascript">
|
||||||
|
// form 초기화
|
||||||
|
const resetDailyExpenseForm = () => {
|
||||||
|
const form = document.reqExpenseForm;
|
||||||
|
if (!form) return;
|
||||||
|
|
||||||
|
form.expenseKind.value = '';
|
||||||
|
form.sourcePurpose.value = '';
|
||||||
|
form.quantity.value = '';
|
||||||
|
form.unitCode.value = '';
|
||||||
|
form.unitSelf.value = '';
|
||||||
|
form.price.value = '';
|
||||||
|
form.estimatedValue.value = '';
|
||||||
|
|
||||||
|
document.getElementById('isCredit_N').checked = true;
|
||||||
|
priceDisabledReset(form.price, form.estimatedValue);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 일계부 상세 값 set
|
||||||
|
const setDailyExpenseFormData = (data) => {
|
||||||
|
const form = document.reqExpenseForm;
|
||||||
|
if (!form) return;
|
||||||
|
|
||||||
|
// 폼에 값 세팅
|
||||||
|
form.expenseKind.value = data.expenseKind || '';
|
||||||
|
form.sourcePurpose.value = data.sourcePurpose || '';
|
||||||
|
form.quantity.value = data.quantity || '';
|
||||||
|
form.unitCode.value = data.unitCode || '';
|
||||||
|
form.unitSelf.value = data.unitSelf || '';
|
||||||
|
form.price.value = data.price || '';
|
||||||
|
form.estimatedValue.value = data.estimatedValue || '';
|
||||||
|
|
||||||
|
// 기타 UI 처리
|
||||||
|
selectedUnit(form.unitCode);
|
||||||
|
if (form.price.value !== '') {
|
||||||
|
priceDisabled(form.price, form.estimatedValue);
|
||||||
|
} else {
|
||||||
|
priceDisabled(form.estimatedValue, form.price);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 라디오 버튼 처리
|
||||||
|
document.getElementById('isCredit_Y').checked = data.credit === true;
|
||||||
|
document.getElementById('isCredit_N').checked = data.credit === false;
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<script th:inline="javascript">
|
||||||
|
// 일계부 등록 모달창 띄우기
|
||||||
|
const showDailyExpenseModal = (id) => {
|
||||||
|
const mf = document.reqExpenseForm;
|
||||||
|
mf.searchMonth.value = document.reqForm.recordMonth.value;
|
||||||
|
mf.groupNo.value = document.reqForm.groupNo.value;
|
||||||
|
mf.dailyId.value = document.reqForm.dailyId.value;
|
||||||
|
mf.id.value = (id === undefined) ? '' : id;
|
||||||
|
|
||||||
|
resetDailyExpenseForm();
|
||||||
|
|
||||||
|
if (id !== null && id !== undefined) {
|
||||||
|
const obj = $(f).serializeObject();
|
||||||
|
obj.id = mf.id.value;
|
||||||
|
obj.searchMonth = obj.recordMonth;
|
||||||
|
|
||||||
|
ajaxUtil._ajaxAsyncMethod(
|
||||||
|
`/api/household/daily/expense/${id}`,
|
||||||
|
obj,
|
||||||
|
function (rstData, status) {
|
||||||
|
setDailyExpenseFormData(rstData);
|
||||||
|
|
||||||
|
document.querySelector($(mf).data('modalId')).ui.open();
|
||||||
|
},
|
||||||
|
function () {
|
||||||
|
console.error('Do nothing error.')
|
||||||
|
},
|
||||||
|
'get'
|
||||||
|
);
|
||||||
|
|
||||||
|
} else {
|
||||||
|
document.querySelector($(mf).data('modalId')).ui.open();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const saveDailyExpense = () => {
|
||||||
|
const mf = document.reqExpenseForm;
|
||||||
|
let obj = $(mf).serializeObject();
|
||||||
|
obj.inputType = 'SELF';
|
||||||
|
obj.id = (obj.id === '' ? '0' : obj.id);
|
||||||
|
|
||||||
|
ajaxUtil._ajaxAsyncNoWaiting(
|
||||||
|
'/api/household/daily/expense/save',
|
||||||
|
obj,
|
||||||
|
function () {
|
||||||
|
alert('등록이 완료되었습니다.');
|
||||||
|
|
||||||
|
document.querySelector($(mf).data('modalId')).ui.close();
|
||||||
|
|
||||||
|
getDailyRecordsView(f.dailyId.value, f.groupNo.value, f.dayGroupText.value);
|
||||||
|
},
|
||||||
|
function (code, rstData) {
|
||||||
|
console.error('Do nothing. code: '+ code, rstData);
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
</div>
|
||||||
|
</html>
|
||||||
@@ -0,0 +1,219 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout" xmlns:th="http://www.thymeleaf.org"
|
||||||
|
layout:decorate="~{layout/layout}">
|
||||||
|
|
||||||
|
<div class="layer-wrap" th:fragment="modalFragment">
|
||||||
|
<form autocomplete="off" method="get" name="reqFarmingForm" data-modal-id=".modal-daily-farming">
|
||||||
|
<input type="hidden" name="householdSeq" th:value="${seq}">
|
||||||
|
<input type="hidden" name="searchMonth">
|
||||||
|
<input type="hidden" name="groupNo">
|
||||||
|
<input type="hidden" name="id">
|
||||||
|
<input type="hidden" name="dailyId">
|
||||||
|
|
||||||
|
<div class="component-modal mypage-wrap modal01 modal-daily-farming" data-props-dimm-click="true" data-state="close">
|
||||||
|
<div class="modal-dimm"></div>
|
||||||
|
<div class="modal-frame">
|
||||||
|
<div class="modal-container">
|
||||||
|
<div class="modal-header">
|
||||||
|
<h3 class="modal-tit">
|
||||||
|
일계부 자가농업 생산물 중 자가소비량 등록
|
||||||
|
</h3>
|
||||||
|
</div>
|
||||||
|
<div class="modal-content">
|
||||||
|
<div class="modal-content-inner">
|
||||||
|
<table class="type-form confirm">
|
||||||
|
<colgroup>
|
||||||
|
<col width="8%" />
|
||||||
|
<col width="25.3%" />
|
||||||
|
<col width="8%" />
|
||||||
|
<col width="25.3%" />
|
||||||
|
<col width="8%" />
|
||||||
|
<col width="25.3%" />
|
||||||
|
</colgroup>
|
||||||
|
<tbody>
|
||||||
|
|
||||||
|
<tr>
|
||||||
|
<th>생산물<i class="ico-required-mark" role="img" aria-label="필수">*</i></th>
|
||||||
|
<td>
|
||||||
|
<div class="d-flex">
|
||||||
|
<div class="component-select">
|
||||||
|
<select class="select-list" name="productCode" onchange="selectedUnit(this);" required>
|
||||||
|
<option value="">선택</option>
|
||||||
|
<option th:each="item : ${recordFarming}"
|
||||||
|
th:value="${item.id}"
|
||||||
|
th:text="${item.codeText}">
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
<div class="component-input unit-self-input">
|
||||||
|
<div class="input-field">
|
||||||
|
<input type="text" id="productSelf" name="productSelf" maxlength="30" disabled>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
<th>용도</th>
|
||||||
|
<td>
|
||||||
|
<div class="component-input">
|
||||||
|
<div class="input-field">
|
||||||
|
<input type="text" id="usage" name="usage" maxlength="30">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
<tr>
|
||||||
|
<th>수량</th>
|
||||||
|
<td>
|
||||||
|
<div class="component-input">
|
||||||
|
<div class="input-field">
|
||||||
|
<input type="number" inputmode="decimal" pattern="[0-9]*" id="quantity" name="quantity" min="1" max="9999999999"
|
||||||
|
maxlength="10" oninput="limitMaxLength(this);">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
|
||||||
|
<th>단위</th>
|
||||||
|
<td colspan="2">
|
||||||
|
<div class="d-flex">
|
||||||
|
<div class="component-select">
|
||||||
|
<select class="select-list" name="unitCode" onchange="selectedUnit(this);" required>
|
||||||
|
<option value="">선택</option>
|
||||||
|
<option th:each="item : ${recordUnit}"
|
||||||
|
th:value="${item.id}"
|
||||||
|
th:text="${item.codeText}">
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
<div class="component-input unit-self-input">
|
||||||
|
<div class="input-field">
|
||||||
|
<input type="text" id="unitSelf" name="unitSelf" maxlength="30" disabled>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
<tr>
|
||||||
|
<th>현물(평가액)<i class="ico-required-mark" role="img" aria-label="필수">*</i></th>
|
||||||
|
<td>
|
||||||
|
<div class="component-input">
|
||||||
|
<div class="input-field">
|
||||||
|
<input type="number" inputmode="numeric" pattern="[0-9]*" id="estimatedValue" name="estimatedValue" min="1" max="9999999999"
|
||||||
|
maxlength="10" oninput="limitMaxLength(this);">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
<div class="component-btns bottom-btn-group">
|
||||||
|
<div class="btns-row align-right">
|
||||||
|
<button type="button" class="btn btn-primary" onclick="saveDailyFarming();">
|
||||||
|
<span class="btn-txt">등록</span>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<button type="button" class="modal-close"></button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
|
||||||
|
<script th:inline="javascript">
|
||||||
|
// form 초기화
|
||||||
|
const resetDailyFarmingForm = () => {
|
||||||
|
const form = document.reqFarmingForm;
|
||||||
|
if (!form) return;
|
||||||
|
|
||||||
|
form.productCode.value = '';
|
||||||
|
form.productSelf.value = '';
|
||||||
|
form.usage.value = '';
|
||||||
|
form.quantity.value = '';
|
||||||
|
form.unitCode.value = '';
|
||||||
|
form.unitSelf.value = '';
|
||||||
|
form.estimatedValue.value = '';
|
||||||
|
}
|
||||||
|
|
||||||
|
// 일계부 상세 값 set
|
||||||
|
const setDailyFarmingFormData = (data) => {
|
||||||
|
const form = document.reqFarmingForm;
|
||||||
|
if (!form) return;
|
||||||
|
|
||||||
|
// 폼에 값 세팅
|
||||||
|
form.productCode.value = data.productCode || '';
|
||||||
|
form.productSelf.value = data.productSelf || '';
|
||||||
|
form.usage.value = data.usage || '';
|
||||||
|
form.quantity.value = data.quantity || '';
|
||||||
|
form.unitCode.value = data.unitCode || '';
|
||||||
|
form.unitSelf.value = data.unitSelf || '';
|
||||||
|
form.estimatedValue.value = data.estimatedValue || '';
|
||||||
|
|
||||||
|
// 기타 UI 처리
|
||||||
|
selectedUnit(form.productCode);
|
||||||
|
selectedUnit(form.unitCode);
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<script th:inline="javascript">
|
||||||
|
// 일계부 등록 모달창 띄우기
|
||||||
|
const showDailyFarmingModal = (id) => {
|
||||||
|
const mf = document.reqFarmingForm;
|
||||||
|
mf.searchMonth.value = document.reqForm.recordMonth.value;
|
||||||
|
mf.groupNo.value = document.reqForm.groupNo.value;
|
||||||
|
mf.dailyId.value = document.reqForm.dailyId.value;
|
||||||
|
mf.id.value = (id === undefined) ? '' : id;
|
||||||
|
|
||||||
|
resetDailyFarmingForm();
|
||||||
|
|
||||||
|
if (id !== null && id !== undefined) {
|
||||||
|
const obj = $(f).serializeObject();
|
||||||
|
obj.id = mf.id.value;
|
||||||
|
obj.searchMonth = obj.recordMonth;
|
||||||
|
|
||||||
|
ajaxUtil._ajaxAsyncMethod(
|
||||||
|
`/api/household/daily/farming/${id}`,
|
||||||
|
obj,
|
||||||
|
function (rstData, status) {
|
||||||
|
setDailyFarmingFormData(rstData);
|
||||||
|
|
||||||
|
document.querySelector($(mf).data('modalId')).ui.open();
|
||||||
|
},
|
||||||
|
function () {
|
||||||
|
console.error('Do nothing error.')
|
||||||
|
},
|
||||||
|
'get'
|
||||||
|
);
|
||||||
|
|
||||||
|
} else {
|
||||||
|
document.querySelector($(mf).data('modalId')).ui.open();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const saveDailyFarming = () => {
|
||||||
|
const mf = document.reqFarmingForm;
|
||||||
|
let obj = $(mf).serializeObject();
|
||||||
|
obj.inputType = 'SELF';
|
||||||
|
obj.id = (obj.id === '' ? '0' : obj.id);
|
||||||
|
|
||||||
|
ajaxUtil._ajaxAsyncNoWaiting(
|
||||||
|
'/api/household/daily/farming/save',
|
||||||
|
obj,
|
||||||
|
function () {
|
||||||
|
alert('등록이 완료되었습니다.');
|
||||||
|
|
||||||
|
document.querySelector($(mf).data('modalId')).ui.close();
|
||||||
|
|
||||||
|
getDailyRecordsView(f.dailyId.value, f.groupNo.value, f.dayGroupText.value);
|
||||||
|
},
|
||||||
|
function (code, rstData) {
|
||||||
|
console.error('Do nothing. code: '+ code, rstData);
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
</div>
|
||||||
|
</html>
|
||||||
@@ -0,0 +1,207 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout" xmlns:th="http://www.thymeleaf.org"
|
||||||
|
layout:decorate="~{layout/layout}">
|
||||||
|
|
||||||
|
<div class="layer-wrap" th:fragment="modalFragment">
|
||||||
|
<form autocomplete="off" method="get" name="reqForestryForm" data-modal-id=".modal-daily-forestry">
|
||||||
|
<input type="hidden" name="householdSeq" th:value="${seq}">
|
||||||
|
<input type="hidden" name="searchMonth">
|
||||||
|
<input type="hidden" name="groupNo">
|
||||||
|
<input type="hidden" name="id">
|
||||||
|
<input type="hidden" name="dailyId">
|
||||||
|
|
||||||
|
<div class="component-modal mypage-wrap modal01 modal-daily-forestry" data-props-dimm-click="true" data-state="close">
|
||||||
|
<div class="modal-dimm"></div>
|
||||||
|
<div class="modal-frame">
|
||||||
|
<div class="modal-container">
|
||||||
|
<div class="modal-header">
|
||||||
|
<h3 class="modal-tit">
|
||||||
|
일계부 자가임업 생산물 중 자가소비량 등록
|
||||||
|
</h3>
|
||||||
|
</div>
|
||||||
|
<div class="modal-content">
|
||||||
|
<div class="modal-content-inner">
|
||||||
|
<table class="type-form confirm">
|
||||||
|
<colgroup>
|
||||||
|
<col width="8%" />
|
||||||
|
<col width="25.3%" />
|
||||||
|
<col width="8%" />
|
||||||
|
<col width="25.3%" />
|
||||||
|
<col width="8%" />
|
||||||
|
<col width="25.3%" />
|
||||||
|
</colgroup>
|
||||||
|
<tbody>
|
||||||
|
|
||||||
|
<tr>
|
||||||
|
<th>생산물<i class="ico-required-mark" role="img" aria-label="필수">*</i></th>
|
||||||
|
<td>
|
||||||
|
<div class="component-input">
|
||||||
|
<div class="input-field">
|
||||||
|
<input type="text" id="productName" name="productName" maxlength="30">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
<th>용도</th>
|
||||||
|
<td>
|
||||||
|
<div class="component-input">
|
||||||
|
<div class="input-field">
|
||||||
|
<input type="text" id="usage" name="usage" maxlength="30">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
<tr>
|
||||||
|
<th>수량</th>
|
||||||
|
<td>
|
||||||
|
<div class="component-input">
|
||||||
|
<div class="input-field">
|
||||||
|
<input type="number" inputmode="decimal" pattern="[0-9]*" id="quantity" name="quantity" min="1" max="9999999999"
|
||||||
|
maxlength="10" oninput="limitMaxLength(this);">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
|
||||||
|
<th>단위</th>
|
||||||
|
<td colspan="2">
|
||||||
|
<div class="d-flex">
|
||||||
|
<div class="component-select">
|
||||||
|
<select class="select-list" name="unitCode" onchange="selectedUnit(this);" required>
|
||||||
|
<option value="">선택</option>
|
||||||
|
<option th:each="item : ${recordUnit}"
|
||||||
|
th:value="${item.id}"
|
||||||
|
th:text="${item.codeText}">
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
<div class="component-input unit-self-input">
|
||||||
|
<div class="input-field">
|
||||||
|
<input type="text" id="unitSelf" name="unitSelf" maxlength="30" disabled>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
<tr>
|
||||||
|
<th>현물(평가액)<i class="ico-required-mark" role="img" aria-label="필수">*</i></th>
|
||||||
|
<td>
|
||||||
|
<div class="component-input">
|
||||||
|
<div class="input-field">
|
||||||
|
<input type="number" inputmode="numeric" pattern="[0-9]*" id="estimatedValue" name="estimatedValue" min="1" max="9999999999"
|
||||||
|
maxlength="10" oninput="limitMaxLength(this);">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
<div class="component-btns bottom-btn-group">
|
||||||
|
<div class="btns-row align-right">
|
||||||
|
<button type="button" class="btn btn-primary" onclick="saveDailyForestry();">
|
||||||
|
<span class="btn-txt">등록</span>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<button type="button" class="modal-close"></button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
|
||||||
|
<script th:inline="javascript">
|
||||||
|
// form 초기화
|
||||||
|
const resetDailyForestryForm = () => {
|
||||||
|
const form = document.reqForestryForm;
|
||||||
|
if (!form) return;
|
||||||
|
|
||||||
|
form.productName.value = '';
|
||||||
|
form.usage.value = '';
|
||||||
|
form.quantity.value = '';
|
||||||
|
form.unitCode.value = '';
|
||||||
|
form.unitSelf.value = '';
|
||||||
|
form.estimatedValue.value = '';
|
||||||
|
}
|
||||||
|
|
||||||
|
// 일계부 상세 값 set
|
||||||
|
const setDailyForestryFormData = (data) => {
|
||||||
|
const form = document.reqForestryForm;
|
||||||
|
if (!form) return;
|
||||||
|
|
||||||
|
// 폼에 값 세팅
|
||||||
|
form.productName.value = data.productName || '';
|
||||||
|
form.usage.value = data.usage || '';
|
||||||
|
form.quantity.value = data.quantity || '';
|
||||||
|
form.unitCode.value = data.unitCode || '';
|
||||||
|
form.unitSelf.value = data.unitSelf || '';
|
||||||
|
form.estimatedValue.value = data.estimatedValue || '';
|
||||||
|
|
||||||
|
// 기타 UI 처리
|
||||||
|
selectedUnit(form.unitCode);
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<script th:inline="javascript">
|
||||||
|
// 일계부 등록 모달창 띄우기
|
||||||
|
const showDailyForestryModal = (id) => {
|
||||||
|
const mf = document.reqForestryForm;
|
||||||
|
mf.searchMonth.value = document.reqForm.recordMonth.value;
|
||||||
|
mf.groupNo.value = document.reqForm.groupNo.value;
|
||||||
|
mf.dailyId.value = document.reqForm.dailyId.value;
|
||||||
|
mf.id.value = (id === undefined) ? '' : id;
|
||||||
|
|
||||||
|
resetDailyForestryForm();
|
||||||
|
|
||||||
|
if (id !== null && id !== undefined) {
|
||||||
|
const obj = $(f).serializeObject();
|
||||||
|
obj.id = mf.id.value;
|
||||||
|
obj.searchMonth = obj.recordMonth;
|
||||||
|
|
||||||
|
ajaxUtil._ajaxAsyncMethod(
|
||||||
|
`/api/household/daily/forestry/${id}`,
|
||||||
|
obj,
|
||||||
|
function (rstData, status) {
|
||||||
|
setDailyForestryFormData(rstData);
|
||||||
|
|
||||||
|
document.querySelector($(mf).data('modalId')).ui.open();
|
||||||
|
},
|
||||||
|
function () {
|
||||||
|
console.error('Do nothing error.')
|
||||||
|
},
|
||||||
|
'get'
|
||||||
|
);
|
||||||
|
|
||||||
|
} else {
|
||||||
|
document.querySelector($(mf).data('modalId')).ui.open();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const saveDailyForestry = () => {
|
||||||
|
const mf = document.reqForestryForm;
|
||||||
|
let obj = $(mf).serializeObject();
|
||||||
|
obj.inputType = 'SELF';
|
||||||
|
obj.id = (obj.id === '' ? '0' : obj.id);
|
||||||
|
|
||||||
|
ajaxUtil._ajaxAsyncNoWaiting(
|
||||||
|
'/api/household/daily/forestry/save',
|
||||||
|
obj,
|
||||||
|
function () {
|
||||||
|
alert('등록이 완료되었습니다.');
|
||||||
|
|
||||||
|
document.querySelector($(mf).data('modalId')).ui.close();
|
||||||
|
|
||||||
|
getDailyRecordsView(f.dailyId.value, f.groupNo.value, f.dayGroupText.value);
|
||||||
|
},
|
||||||
|
function (code, rstData) {
|
||||||
|
console.error('Do nothing. code: '+ code, rstData);
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
</div>
|
||||||
|
</html>
|
||||||
@@ -126,7 +126,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
<th>현물평가액(원)<i class="ico-required-mark" role="img" aria-label="필수">*</i></th>
|
<th>현물(평가액)<i class="ico-required-mark" role="img" aria-label="필수">*</i></th>
|
||||||
<td>
|
<td>
|
||||||
<div class="component-input">
|
<div class="component-input">
|
||||||
<div class="input-field">
|
<div class="input-field">
|
||||||
@@ -159,7 +159,7 @@
|
|||||||
|
|
||||||
<script th:inline="javascript">
|
<script th:inline="javascript">
|
||||||
// form 초기화
|
// form 초기화
|
||||||
const resetIncomeForm = () => {
|
const resetDailyIncomeForm = () => {
|
||||||
const form = document.reqIncomeForm;
|
const form = document.reqIncomeForm;
|
||||||
if (!form) return;
|
if (!form) return;
|
||||||
|
|
||||||
@@ -173,10 +173,11 @@
|
|||||||
form.estimatedValue.value = '';
|
form.estimatedValue.value = '';
|
||||||
|
|
||||||
document.getElementById('isCredit_N').checked = true;
|
document.getElementById('isCredit_N').checked = true;
|
||||||
|
priceDisabledReset(form.price, form.estimatedValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 일계부 상세 값 set
|
// 일계부 상세 값 set
|
||||||
const setIncomeFormData = (data) => {
|
const setDailyIncomeFormData = (data) => {
|
||||||
const form = document.reqIncomeForm;
|
const form = document.reqIncomeForm;
|
||||||
if (!form) return;
|
if (!form) return;
|
||||||
|
|
||||||
@@ -213,7 +214,7 @@
|
|||||||
mf.dailyId.value = document.reqForm.dailyId.value;
|
mf.dailyId.value = document.reqForm.dailyId.value;
|
||||||
mf.id.value = (id === undefined) ? '' : id;
|
mf.id.value = (id === undefined) ? '' : id;
|
||||||
|
|
||||||
resetIncomeForm();
|
resetDailyIncomeForm();
|
||||||
|
|
||||||
if (id !== null && id !== undefined) {
|
if (id !== null && id !== undefined) {
|
||||||
const obj = $(f).serializeObject();
|
const obj = $(f).serializeObject();
|
||||||
@@ -224,7 +225,7 @@
|
|||||||
`/api/household/daily/income/${id}`,
|
`/api/household/daily/income/${id}`,
|
||||||
obj,
|
obj,
|
||||||
function (rstData, status) {
|
function (rstData, status) {
|
||||||
setIncomeFormData(rstData);
|
setDailyIncomeFormData(rstData);
|
||||||
|
|
||||||
document.querySelector($(mf).data('modalId')).ui.open();
|
document.querySelector($(mf).data('modalId')).ui.open();
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -0,0 +1,177 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout" xmlns:th="http://www.thymeleaf.org"
|
||||||
|
layout:decorate="~{layout/layout}">
|
||||||
|
|
||||||
|
<div class="layer-wrap" th:fragment="modalFragment">
|
||||||
|
<form autocomplete="off" method="get" name="reqPowerForm" data-modal-id=".modal-daily-power">
|
||||||
|
<input type="hidden" name="householdSeq" th:value="${seq}">
|
||||||
|
<input type="hidden" name="searchMonth">
|
||||||
|
<input type="hidden" name="groupNo">
|
||||||
|
<input type="hidden" name="id">
|
||||||
|
<input type="hidden" name="dailyId">
|
||||||
|
|
||||||
|
<div class="component-modal mypage-wrap modal01 modal-daily-power" data-props-dimm-click="true" data-state="close">
|
||||||
|
<div class="modal-dimm"></div>
|
||||||
|
<div class="modal-frame">
|
||||||
|
<div class="modal-container">
|
||||||
|
<div class="modal-header">
|
||||||
|
<h3 class="modal-tit">
|
||||||
|
일계부 동력 사용시간 등록
|
||||||
|
</h3>
|
||||||
|
</div>
|
||||||
|
<div class="modal-content">
|
||||||
|
<div class="modal-content-inner">
|
||||||
|
<table class="type-form confirm">
|
||||||
|
<colgroup>
|
||||||
|
<col width="8%" />
|
||||||
|
<col width="25.3%" />
|
||||||
|
<col width="8%" />
|
||||||
|
<col width="25.3%" />
|
||||||
|
<col width="8%" />
|
||||||
|
<col width="25.3%" />
|
||||||
|
</colgroup>
|
||||||
|
<tbody>
|
||||||
|
|
||||||
|
<tr>
|
||||||
|
<th>명칭<i class="ico-required-mark" role="img" aria-label="필수">*</i></th>
|
||||||
|
<td colspan="4">
|
||||||
|
<div class="component-input">
|
||||||
|
<div class="input-field">
|
||||||
|
<input type="text" id="equipmentName" name="equipmentName" maxlength="30">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
<tr>
|
||||||
|
<th>자가 사용시간<i class="ico-required-mark" role="img" aria-label="필수">*</i></th>
|
||||||
|
<td>
|
||||||
|
<div class="component-input">
|
||||||
|
<div class="input-field">
|
||||||
|
<input type="number" inputmode="decimal" pattern="[0-9]*" id="ownedHours" name="ownedHours" min="1" max="9999999999"
|
||||||
|
maxlength="10" oninput="limitMaxLength(this); priceDisabled(this, this.form.leasedHours)">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
<th>임차 사용시간<i class="ico-required-mark" role="img" aria-label="필수">*</i></th>
|
||||||
|
<td>
|
||||||
|
<div class="component-input">
|
||||||
|
<div class="input-field">
|
||||||
|
<input type="number" inputmode="decimal" pattern="[0-9]*" id="leasedHours" name="leasedHours" min="1" max="9999999999"
|
||||||
|
maxlength="10" oninput="limitMaxLength(this); priceDisabled(this, this.form.ownedHours)">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
<div class="component-btns bottom-btn-group">
|
||||||
|
<div class="btns-row align-right">
|
||||||
|
<button type="button" class="btn btn-primary" onclick="saveDailyPower();">
|
||||||
|
<span class="btn-txt">등록</span>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<button type="button" class="modal-close"></button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
|
||||||
|
<script th:inline="javascript">
|
||||||
|
// form 초기화
|
||||||
|
const resetDailyPowerForm = () => {
|
||||||
|
const form = document.reqPowerForm;
|
||||||
|
if (!form) return;
|
||||||
|
|
||||||
|
form.equipmentName.value = '';
|
||||||
|
form.ownedHours.value = '';
|
||||||
|
form.leasedHours.value = '';
|
||||||
|
|
||||||
|
priceDisabledReset(form.ownedHours, form.leasedHours);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 일계부 상세 값 set
|
||||||
|
const setDailyPowerFormData = (data) => {
|
||||||
|
const form = document.reqPowerForm;
|
||||||
|
if (!form) return;
|
||||||
|
|
||||||
|
// 폼에 값 세팅
|
||||||
|
form.equipmentName.value = data.equipmentName || '';
|
||||||
|
form.ownedHours.value = data.ownedHours || '';
|
||||||
|
form.leasedHours.value = data.leasedHours || '';
|
||||||
|
|
||||||
|
// 기타 UI 처리
|
||||||
|
if (form.ownedHours.value !== '') {
|
||||||
|
priceDisabled(form.ownedHours, form.leasedHours)
|
||||||
|
} else {
|
||||||
|
priceDisabled(form.leasedHours, form.ownedHours)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<script th:inline="javascript">
|
||||||
|
// 일계부 등록 모달창 띄우기
|
||||||
|
const showDailyPowerModal = (id) => {
|
||||||
|
const mf = document.reqPowerForm;
|
||||||
|
mf.searchMonth.value = document.reqForm.recordMonth.value;
|
||||||
|
mf.groupNo.value = document.reqForm.groupNo.value;
|
||||||
|
mf.dailyId.value = document.reqForm.dailyId.value;
|
||||||
|
mf.id.value = (id === undefined) ? '' : id;
|
||||||
|
|
||||||
|
resetDailyPowerForm();
|
||||||
|
|
||||||
|
if (id !== null && id !== undefined) {
|
||||||
|
const obj = $(f).serializeObject();
|
||||||
|
obj.id = mf.id.value;
|
||||||
|
obj.searchMonth = obj.recordMonth;
|
||||||
|
|
||||||
|
ajaxUtil._ajaxAsyncMethod(
|
||||||
|
`/api/household/daily/power/${id}`,
|
||||||
|
obj,
|
||||||
|
function (rstData, status) {
|
||||||
|
setDailyPowerFormData(rstData);
|
||||||
|
|
||||||
|
document.querySelector($(mf).data('modalId')).ui.open();
|
||||||
|
},
|
||||||
|
function () {
|
||||||
|
console.error('Do nothing error.')
|
||||||
|
},
|
||||||
|
'get'
|
||||||
|
);
|
||||||
|
|
||||||
|
} else {
|
||||||
|
document.querySelector($(mf).data('modalId')).ui.open();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const saveDailyPower = () => {
|
||||||
|
const mf = document.reqPowerForm;
|
||||||
|
let obj = $(mf).serializeObject();
|
||||||
|
obj.inputType = 'SELF';
|
||||||
|
obj.id = (obj.id === '' ? '0' : obj.id);
|
||||||
|
|
||||||
|
ajaxUtil._ajaxAsyncNoWaiting(
|
||||||
|
'/api/household/daily/power/save',
|
||||||
|
obj,
|
||||||
|
function () {
|
||||||
|
alert('등록이 완료되었습니다.');
|
||||||
|
|
||||||
|
document.querySelector($(mf).data('modalId')).ui.close();
|
||||||
|
|
||||||
|
getDailyRecordsView(f.dailyId.value, f.groupNo.value, f.dayGroupText.value);
|
||||||
|
},
|
||||||
|
function (code, rstData) {
|
||||||
|
console.error('Do nothing. code: '+ code, rstData);
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
</div>
|
||||||
|
</html>
|
||||||
@@ -0,0 +1,362 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout" xmlns:th="http://www.thymeleaf.org"
|
||||||
|
layout:decorate="~{layout/layout}">
|
||||||
|
|
||||||
|
<div class="layer-wrap" th:fragment="modalFragment">
|
||||||
|
<form autocomplete="off" method="get" name="reqWorkForm" data-modal-id=".modal-daily-work">
|
||||||
|
<input type="hidden" name="householdSeq" th:value="${seq}">
|
||||||
|
<input type="hidden" name="searchMonth">
|
||||||
|
<input type="hidden" name="groupNo">
|
||||||
|
<input type="hidden" name="id">
|
||||||
|
<input type="hidden" name="dailyId">
|
||||||
|
|
||||||
|
<div class="component-modal mypage-wrap modal01 modal-daily-work" data-props-dimm-click="true" data-state="close">
|
||||||
|
<div class="modal-dimm"></div>
|
||||||
|
<div class="modal-frame">
|
||||||
|
<div class="modal-container">
|
||||||
|
<div class="modal-header">
|
||||||
|
<h3 class="modal-tit">
|
||||||
|
일계부 노동
|
||||||
|
</h3>
|
||||||
|
</div>
|
||||||
|
<div class="modal-content">
|
||||||
|
<div class="modal-content-inner">
|
||||||
|
<table class="type-form confirm">
|
||||||
|
<colgroup>
|
||||||
|
<col width="8%" />
|
||||||
|
<col width="25.3%" />
|
||||||
|
<col width="8%" />
|
||||||
|
<col width="25.3%" />
|
||||||
|
<col width="8%" />
|
||||||
|
<col width="25.3%" />
|
||||||
|
</colgroup>
|
||||||
|
<tbody>
|
||||||
|
|
||||||
|
<tr>
|
||||||
|
<th>품목명<i class="ico-required-mark" role="img" aria-label="필수">*</i></th>
|
||||||
|
<td>
|
||||||
|
<div class="component-input">
|
||||||
|
<div class="input-field">
|
||||||
|
<input type="text" id="itemName" name="itemName" maxlength="30">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
<th>작업명<i class="ico-required-mark" role="img" aria-label="필수">*</i></th>
|
||||||
|
<td>
|
||||||
|
<div class="component-input">
|
||||||
|
<div class="input-field">
|
||||||
|
<input type="text" id="workName" name="workName" maxlength="30">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
<tr>
|
||||||
|
<th>작업 면적</th>
|
||||||
|
<td>
|
||||||
|
<div class="component-input">
|
||||||
|
<div class="input-field">
|
||||||
|
<input type="number" inputmode="decimal" pattern="[0-9]*" id="workLandArea" name="workLandArea" min="1" max="9999999999"
|
||||||
|
maxlength="10" oninput="limitMaxLength(this);">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
|
||||||
|
<th>단위</th>
|
||||||
|
<td colspan="2">
|
||||||
|
<div class="d-flex">
|
||||||
|
<div class="component-select">
|
||||||
|
<select class="select-list" name="areaUnitCode" onchange="selectedUnit(this);" required>
|
||||||
|
<option value="">선택</option>
|
||||||
|
<option th:each="item : ${recordArea}"
|
||||||
|
th:value="${item.id}"
|
||||||
|
th:text="${item.codeText}">
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
<div class="component-input unit-self-input">
|
||||||
|
<div class="input-field">
|
||||||
|
<input type="text" id="areaUnitSelf" name="areaUnitSelf" maxlength="30" disabled>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
<tr>
|
||||||
|
<th>수확량</th>
|
||||||
|
<td>
|
||||||
|
<div class="component-input">
|
||||||
|
<div class="input-field">
|
||||||
|
<input type="number" inputmode="decimal" pattern="[0-9]*" id="harvestQuantity" name="harvestQuantity" min="1" max="9999999999"
|
||||||
|
maxlength="10" oninput="limitMaxLength(this);">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
|
||||||
|
<th>단위</th>
|
||||||
|
<td colspan="2">
|
||||||
|
<div class="d-flex">
|
||||||
|
<div class="component-select">
|
||||||
|
<select class="select-list" name="harvestUnitCode" onchange="selectedUnit(this);" required>
|
||||||
|
<option value="">선택</option>
|
||||||
|
<option th:each="item : ${recordUnit}"
|
||||||
|
th:value="${item.id}"
|
||||||
|
th:text="${item.codeText}">
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
<div class="component-input unit-self-input">
|
||||||
|
<div class="input-field">
|
||||||
|
<input type="text" id="harvestUnitSelf" name="harvestUnitSelf" maxlength="30" disabled>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
<tr>
|
||||||
|
<th colspan="6">노동투입시간<i class="ico-required-mark" role="img" aria-label="필수">*</i></th>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
<tr>
|
||||||
|
<th>경영주</th>
|
||||||
|
<td>
|
||||||
|
<div class="component-input">
|
||||||
|
<div class="input-field">
|
||||||
|
<input type="number" inputmode="decimal" pattern="[0-9]*" id="ownerTime" name="ownerTime" min="1" max="9999999999"
|
||||||
|
maxlength="10" oninput="limitMaxLength(this);">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
<th>배우자</th>
|
||||||
|
<td>
|
||||||
|
<div class="component-input">
|
||||||
|
<div class="input-field">
|
||||||
|
<input type="number" inputmode="decimal" pattern="[0-9]*" id="spouseTime" name="spouseTime" min="1" max="9999999999"
|
||||||
|
maxlength="10" oninput="limitMaxLength(this);">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
<tr>
|
||||||
|
<th>가족노동(남)</th>
|
||||||
|
<td>
|
||||||
|
<div class="component-input">
|
||||||
|
<div class="input-field">
|
||||||
|
<input type="number" inputmode="decimal" pattern="[0-9]*" id="familyMHours" name="familyMHours" min="1" max="9999999999"
|
||||||
|
maxlength="10" oninput="limitMaxLength(this);">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
<th>가족노동(남)</th>
|
||||||
|
<td>
|
||||||
|
<div class="component-input">
|
||||||
|
<div class="input-field">
|
||||||
|
<input type="number" inputmode="decimal" pattern="[0-9]*" id="familyFHours" name="familyFHours" min="1" max="9999999999"
|
||||||
|
maxlength="10" oninput="limitMaxLength(this);">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
<tr>
|
||||||
|
<th>고용노동(남)</th>
|
||||||
|
<td>
|
||||||
|
<div class="component-input">
|
||||||
|
<div class="input-field">
|
||||||
|
<input type="number" inputmode="decimal" pattern="[0-9]*" id="hiredMHours" name="hiredMHours" min="1" max="9999999999"
|
||||||
|
maxlength="10" oninput="limitMaxLength(this);">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
<th>고용노동(남)</th>
|
||||||
|
<td>
|
||||||
|
<div class="component-input">
|
||||||
|
<div class="input-field">
|
||||||
|
<input type="number" inputmode="decimal" pattern="[0-9]*" id="hiredFHours" name="hiredFHours" min="1" max="9999999999"
|
||||||
|
maxlength="10" oninput="limitMaxLength(this);">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
<tr>
|
||||||
|
<th>품앗이(남)</th>
|
||||||
|
<td>
|
||||||
|
<div class="component-input">
|
||||||
|
<div class="input-field">
|
||||||
|
<input type="number" inputmode="decimal" pattern="[0-9]*" id="sharedMHours" name="sharedMHours" min="1" max="9999999999"
|
||||||
|
maxlength="10" oninput="limitMaxLength(this);">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
<th>품앗이(남)</th>
|
||||||
|
<td>
|
||||||
|
<div class="component-input">
|
||||||
|
<div class="input-field">
|
||||||
|
<input type="number" inputmode="decimal" pattern="[0-9]*" id="sharedFHours" name="sharedFHours" min="1" max="9999999999"
|
||||||
|
maxlength="10" oninput="limitMaxLength(this);">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
<tr>
|
||||||
|
<th>일손돕기(남)</th>
|
||||||
|
<td>
|
||||||
|
<div class="component-input">
|
||||||
|
<div class="input-field">
|
||||||
|
<input type="number" inputmode="decimal" pattern="[0-9]*" id="volunteerMHours" name="volunteerMHours" min="1" max="9999999999"
|
||||||
|
maxlength="10" oninput="limitMaxLength(this);">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
<th>일손돕기(남)</th>
|
||||||
|
<td>
|
||||||
|
<div class="component-input">
|
||||||
|
<div class="input-field">
|
||||||
|
<input type="number" inputmode="decimal" pattern="[0-9]*" id="volunteerFHours" name="volunteerFHours" min="1" max="9999999999"
|
||||||
|
maxlength="10" oninput="limitMaxLength(this);">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
<div class="component-btns bottom-btn-group">
|
||||||
|
<div class="btns-row align-right">
|
||||||
|
<button type="button" class="btn btn-primary" onclick="saveDailyWork();">
|
||||||
|
<span class="btn-txt">등록</span>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<button type="button" class="modal-close"></button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
|
||||||
|
<script th:inline="javascript">
|
||||||
|
// form 초기화
|
||||||
|
const resetDailyWorkForm = () => {
|
||||||
|
const form = document.reqWorkForm;
|
||||||
|
if (!form) return;
|
||||||
|
|
||||||
|
form.itemName.value = '';
|
||||||
|
form.workName.value = '';
|
||||||
|
form.workLandArea.value = '';
|
||||||
|
form.areaUnitCode.value = '';
|
||||||
|
form.areaUnitSelf.value = '';
|
||||||
|
form.harvestQuantity.value = '';
|
||||||
|
form.harvestUnitCode.value = '';
|
||||||
|
form.harvestUnitSelf.value = '';
|
||||||
|
form.ownerTime.value = '';
|
||||||
|
form.spouseTime.value = '';
|
||||||
|
form.familyMHours.value = '';
|
||||||
|
form.familyFHours.value = '';
|
||||||
|
form.hiredMHours.value = '';
|
||||||
|
form.hiredFHours.value = '';
|
||||||
|
form.sharedMHours.value = '';
|
||||||
|
form.sharedFHours.value = '';
|
||||||
|
form.volunteerMHours.value = '';
|
||||||
|
form.volunteerFHours.value = '';
|
||||||
|
|
||||||
|
document.getElementById('isCredit_N').checked = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 일계부 상세 값 set
|
||||||
|
const setDailyWorkFormData = (data) => {
|
||||||
|
const form = document.reqWorkForm;
|
||||||
|
if (!form) return;
|
||||||
|
|
||||||
|
// 폼에 값 세팅
|
||||||
|
form.itemName.value = data.itemName || '';
|
||||||
|
form.workName.value = data.workName || '';
|
||||||
|
form.workLandArea.value = data.workLandArea || '';
|
||||||
|
form.areaUnitCode.value = data.areaUnitCode || '';
|
||||||
|
form.areaUnitSelf.value = data.areaUnitSelf || '';
|
||||||
|
form.harvestQuantity.value = data.harvestQuantity || '';
|
||||||
|
form.harvestUnitCode.value = data.harvestUnitCode || '';
|
||||||
|
form.harvestUnitSelf.value = data.harvestUnitSelf || '';
|
||||||
|
form.ownerTime.value = data.ownerTime || '';
|
||||||
|
form.spouseTime.value = data.spouseTime || '';
|
||||||
|
form.familyMHours.value = data.familyMHours || '';
|
||||||
|
form.familyFHours.value = data.familyFHours || '';
|
||||||
|
form.hiredMHours.value = data.hiredMHours || '';
|
||||||
|
form.hiredFHours.value = data.hiredFHours || '';
|
||||||
|
form.sharedMHours.value = data.sharedMHours || '';
|
||||||
|
form.sharedFHours.value = data.sharedFHours || '';
|
||||||
|
form.volunteerMHours.value = data.volunteerMHours || '';
|
||||||
|
form.volunteerFHours.value = data.volunteerFHours || '';
|
||||||
|
|
||||||
|
// 기타 UI 처리
|
||||||
|
selectedUnit(form.areaUnitCode);
|
||||||
|
selectedUnit(form.harvestUnitCode);
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<script th:inline="javascript">
|
||||||
|
// 일계부 등록 모달창 띄우기
|
||||||
|
const showDailyWorkModal = (id) => {
|
||||||
|
const mf = document.reqWorkForm;
|
||||||
|
mf.searchMonth.value = document.reqForm.recordMonth.value;
|
||||||
|
mf.groupNo.value = document.reqForm.groupNo.value;
|
||||||
|
mf.dailyId.value = document.reqForm.dailyId.value;
|
||||||
|
mf.id.value = (id === undefined) ? '' : id;
|
||||||
|
|
||||||
|
resetDailyWorkForm();
|
||||||
|
|
||||||
|
if (id !== null && id !== undefined) {
|
||||||
|
const obj = $(f).serializeObject();
|
||||||
|
obj.id = mf.id.value;
|
||||||
|
obj.searchMonth = obj.recordMonth;
|
||||||
|
|
||||||
|
ajaxUtil._ajaxAsyncMethod(
|
||||||
|
`/api/household/daily/work/${id}`,
|
||||||
|
obj,
|
||||||
|
function (rstData, status) {
|
||||||
|
setDailyWorkFormData(rstData);
|
||||||
|
|
||||||
|
document.querySelector($(mf).data('modalId')).ui.open();
|
||||||
|
},
|
||||||
|
function () {
|
||||||
|
console.error('Do nothing error.')
|
||||||
|
},
|
||||||
|
'get'
|
||||||
|
);
|
||||||
|
|
||||||
|
} else {
|
||||||
|
document.querySelector($(mf).data('modalId')).ui.open();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const saveDailyWork = () => {
|
||||||
|
const mf = document.reqWorkForm;
|
||||||
|
let obj = $(mf).serializeObject();
|
||||||
|
obj.inputType = 'SELF';
|
||||||
|
obj.id = (obj.id === '' ? '0' : obj.id);
|
||||||
|
|
||||||
|
ajaxUtil._ajaxAsyncNoWaiting(
|
||||||
|
'/api/household/daily/work/save',
|
||||||
|
obj,
|
||||||
|
function () {
|
||||||
|
alert('등록이 완료되었습니다.');
|
||||||
|
|
||||||
|
document.querySelector($(mf).data('modalId')).ui.close();
|
||||||
|
|
||||||
|
getDailyRecordsView(f.dailyId.value, f.groupNo.value, f.dayGroupText.value);
|
||||||
|
},
|
||||||
|
function (code, rstData) {
|
||||||
|
console.error('Do nothing. code: '+ code, rstData);
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
</div>
|
||||||
|
</html>
|
||||||
@@ -418,8 +418,8 @@
|
|||||||
|
|
||||||
// 일계부 등록 현황 상세
|
// 일계부 등록 현황 상세
|
||||||
const getDailyRecordsView = (id, groupNo, dayGroupText) => {
|
const getDailyRecordsView = (id, groupNo, dayGroupText) => {
|
||||||
if(id == null) {
|
if (id == null) {
|
||||||
alert('등록 내역이 없습니다.');
|
showDailyCreateConfirm(groupNo);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -548,7 +548,7 @@
|
|||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
<td class="underline">${ifNullHyphen(item.itemName)}</td><!-- 품목명 -->
|
<td class="underline"><a href="javascript:void(0);" onclick="showDailyWorkModal(${item.id});">${ifNullHyphen(item.itemName)}</a></td> <!-- 품목명 -->
|
||||||
<td>${ifNullHyphen(item.workName)}</td><!-- 작업명 -->
|
<td>${ifNullHyphen(item.workName)}</td><!-- 작업명 -->
|
||||||
<td class="align-right">${ifNullHyphen(item.workLandArea)}</td><!-- 작업면적 -->
|
<td class="align-right">${ifNullHyphen(item.workLandArea)}</td><!-- 작업면적 -->
|
||||||
<td>${ifNullHyphen(item.areaUnitText)}</td><!-- 작업면적 단위 -->
|
<td>${ifNullHyphen(item.areaUnitText)}</td><!-- 작업면적 단위 -->
|
||||||
@@ -599,7 +599,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
<td>${item.isCredit ? "Y" : "N"}</td> <!-- 외상 또는 카드구입 -->
|
<td>${item.isCredit ? "Y" : "N"}</td> <!-- 외상 또는 카드구입 -->
|
||||||
<td class="underline">${ifNullHyphen(item.expenseKind)}</td><!-- 지출의 종류 -->
|
<td class="underline"><a href="javascript:void(0);" onclick="showDailyExpenseModal(${item.id});">${ifNullHyphen(item.expenseKind)}</a></td> <!-- 지출의 종류 -->
|
||||||
<td>${ifNullHyphen(item.sourcePurpose)}</td><!-- 용도 -->
|
<td>${ifNullHyphen(item.sourcePurpose)}</td><!-- 용도 -->
|
||||||
<td class="align-right">${ifNullHyphen(item.quantity)}</td><!-- 수량 -->
|
<td class="align-right">${ifNullHyphen(item.quantity)}</td><!-- 수량 -->
|
||||||
<td>${ifNullHyphen(item.unitText)}</td><!-- 단위 -->
|
<td>${ifNullHyphen(item.unitText)}</td><!-- 단위 -->
|
||||||
@@ -639,7 +639,7 @@
|
|||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
<td class="underline">${ifNullHyphen(item.equipmentName)}</td> <!-- 명칭 -->
|
<td class="underline"><a href="javascript:void(0);" onclick="showDailyPowerModal(${item.id});">${ifNullHyphen(item.equipmentName)}</a></td> <!-- 명칭 -->
|
||||||
<td>${ifNullHyphen(item.ownedHours)}</td><!-- 자가 사용시간 -->
|
<td>${ifNullHyphen(item.ownedHours)}</td><!-- 자가 사용시간 -->
|
||||||
<td>${ifNullHyphen(item.leasedHours)}</td><!-- 임가 사용시간 -->
|
<td>${ifNullHyphen(item.leasedHours)}</td><!-- 임가 사용시간 -->
|
||||||
<td>
|
<td>
|
||||||
@@ -676,7 +676,7 @@
|
|||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
<td class="underline">${ifNullHyphen(item.productName)}</td> <!-- 생산물 -->
|
<td class="underline"><a href="javascript:void(0);" onclick="showDailyForestryModal(${item.id});">${ifNullHyphen(item.productName)}</a></td> <!-- 생산물 -->
|
||||||
<td>${ifNullHyphen(item.usage)}</td><!-- 용도 -->
|
<td>${ifNullHyphen(item.usage)}</td><!-- 용도 -->
|
||||||
<td class="align-right">${ifNullHyphen(item.quantity)}</td><!-- 수량 -->
|
<td class="align-right">${ifNullHyphen(item.quantity)}</td><!-- 수량 -->
|
||||||
<td>${ifNullHyphen(item.unitText)}</td><!-- 단위 -->
|
<td>${ifNullHyphen(item.unitText)}</td><!-- 단위 -->
|
||||||
@@ -715,7 +715,7 @@
|
|||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
<td class="underline">${ifNullHyphen(item.productName)}</td> <!-- 생산물 -->
|
<td class="underline"><a href="javascript:void(0);" onclick="showDailyFarmingModal(${item.id});">${ifNullHyphen(item.productName)}</a></td> <!-- 생산물 -->
|
||||||
<td>${ifNullHyphen(item.usage)}</td><!-- 용도 -->
|
<td>${ifNullHyphen(item.usage)}</td><!-- 용도 -->
|
||||||
<td class="align-right">${ifNullHyphen(item.quantity)}</td><!-- 수량 -->
|
<td class="align-right">${ifNullHyphen(item.quantity)}</td><!-- 수량 -->
|
||||||
<td>${ifNullHyphen(item.unitText)}</td><!-- 단위 -->
|
<td>${ifNullHyphen(item.unitText)}</td><!-- 단위 -->
|
||||||
@@ -754,6 +754,28 @@
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 데이터 등록 Confirm
|
||||||
|
const showDailyCreateConfirm = (groupNo) => {
|
||||||
|
etUI.dialog.confirm({
|
||||||
|
title: '등록 안내',
|
||||||
|
message: '등록된 내역이 없습니다.<br>등록하시겠습니까?',
|
||||||
|
positiveCallback: function () {
|
||||||
|
let obj = $(document.reqForm).serializeObject();
|
||||||
|
obj.dayGroupNo = groupNo;
|
||||||
|
|
||||||
|
ajaxUtil._ajaxAsyncNoWaiting(
|
||||||
|
'/api/household/daily/create',
|
||||||
|
obj,
|
||||||
|
function () {
|
||||||
|
alert('등록 상태가 변경되었습니다.');
|
||||||
|
|
||||||
|
getDailyRecordsList();
|
||||||
|
},
|
||||||
|
);
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
// 데이터 초기화 Confirm
|
// 데이터 초기화 Confirm
|
||||||
const showDailyNoneConfirm = (el) => {
|
const showDailyNoneConfirm = (el) => {
|
||||||
const currentStep = $(el).data('step');
|
const currentStep = $(el).data('step');
|
||||||
@@ -810,8 +832,16 @@
|
|||||||
|
|
||||||
if (currentStep === 'INCOME') {
|
if (currentStep === 'INCOME') {
|
||||||
showDailyIncomeModal();
|
showDailyIncomeModal();
|
||||||
} else {
|
} else if (currentStep === 'WORK') {
|
||||||
alert('TODO : 추가');
|
showDailyWorkModal();
|
||||||
|
} else if (currentStep === 'EXPENSE') {
|
||||||
|
showDailyExpenseModal();
|
||||||
|
} else if (currentStep === 'POWER') {
|
||||||
|
showDailyPowerModal();
|
||||||
|
} else if (currentStep === 'FORESTRY') {
|
||||||
|
showDailyForestryModal();
|
||||||
|
} else if (currentStep === 'FARMING') {
|
||||||
|
showDailyFarmingModal();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -186,6 +186,11 @@
|
|||||||
|
|
||||||
<!-- 일계부 모달 -->
|
<!-- 일계부 모달 -->
|
||||||
<th:block th:replace="households/modal/modal-daily-income :: modalFragment"/>
|
<th:block th:replace="households/modal/modal-daily-income :: modalFragment"/>
|
||||||
|
<th:block th:replace="households/modal/modal-daily-work :: modalFragment"/>
|
||||||
|
<th:block th:replace="households/modal/modal-daily-expense :: modalFragment"/>
|
||||||
|
<th:block th:replace="households/modal/modal-daily-power :: modalFragment"/>
|
||||||
|
<th:block th:replace="households/modal/modal-daily-forestry :: modalFragment"/>
|
||||||
|
<th:block th:replace="households/modal/modal-daily-farming :: modalFragment"/>
|
||||||
|
|
||||||
<!-- 조사원 매핑 모달 -->
|
<!-- 조사원 매핑 모달 -->
|
||||||
<th:block th:replace="common/modal-researcher-mapping :: modalFragment"/>
|
<th:block th:replace="common/modal-researcher-mapping :: modalFragment"/>
|
||||||
@@ -365,7 +370,7 @@
|
|||||||
const unitArea = tr.querySelector('.unit-self-input');
|
const unitArea = tr.querySelector('.unit-self-input');
|
||||||
const unitInput = tr.querySelector('.unit-self-input input');
|
const unitInput = tr.querySelector('.unit-self-input input');
|
||||||
|
|
||||||
if (el.value === 'code.record.unit.self') {
|
if (el.value.indexOf('.self') !== -1) {
|
||||||
unitInput.disabled = false;
|
unitInput.disabled = false;
|
||||||
unitArea.classList.remove('input-disabled');
|
unitArea.classList.remove('input-disabled');
|
||||||
} else {
|
} else {
|
||||||
@@ -391,6 +396,22 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const priceDisabledReset = (el, disableEl) => {
|
||||||
|
let wrap = null;
|
||||||
|
|
||||||
|
if (el.value === '') {
|
||||||
|
wrap = el.closest('td');
|
||||||
|
wrap.querySelector('input').disabled = false;
|
||||||
|
wrap.querySelector('.component-input').classList.remove('input-disabled');
|
||||||
|
}
|
||||||
|
|
||||||
|
if (disableEl.value === '') {
|
||||||
|
wrap = disableEl.closest('td');
|
||||||
|
wrap.querySelector('input').disabled = false;
|
||||||
|
wrap.querySelector('.component-input').classList.remove('input-disabled');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// 직접입력 선택시 input 활성화
|
// 직접입력 선택시 input 활성화
|
||||||
const selectedSelf = (el) => {
|
const selectedSelf = (el) => {
|
||||||
const tr = el.closest('tr');
|
const tr = el.closest('tr');
|
||||||
@@ -413,7 +434,7 @@
|
|||||||
const goExcel = (el) => {
|
const goExcel = (el) => {
|
||||||
let url = '';
|
let url = '';
|
||||||
if (el.dataset.tabValue === 'tab1') {
|
if (el.dataset.tabValue === 'tab1') {
|
||||||
url = $('.tab-content .daily-record-list').is(':hidden') ? '' : '/api/household/dailyRecordsStatus/excel';
|
url = $('.tab-content .daily-record-list').is(':hidden') ? '/api/household/dailyRecordStatus/excel' : '/api/household/dailyRecordsStatus/excel';
|
||||||
} else if (el.dataset.tabValue === 'tab2') {
|
} else if (el.dataset.tabValue === 'tab2') {
|
||||||
url = '';
|
url = '';
|
||||||
} else if (el.dataset.tabValue === 'tab3') {
|
} else if (el.dataset.tabValue === 'tab3') {
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package app.module.core.config.application.util;
|
package app.module.core.config.application.util;
|
||||||
|
|
||||||
|
import app.module.core.usecase.uicode.list.ports.application.domain.UICodeElement;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
@@ -9,6 +10,8 @@ import java.text.DecimalFormat;
|
|||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
import java.time.LocalDate;
|
import java.time.LocalDate;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
|
|
||||||
@Slf4j
|
@Slf4j
|
||||||
@@ -87,8 +90,7 @@ public class DailyUtil {
|
|||||||
* @return true=수정 가능, false=수정 불가
|
* @return true=수정 가능, false=수정 불가
|
||||||
*/
|
*/
|
||||||
public boolean isModifiable(LocalDate startDate, LocalDate endDate) {
|
public boolean isModifiable(LocalDate startDate, LocalDate endDate) {
|
||||||
// TODO : 15일로 변경, 테스트를 위해 30일로 진행중
|
LocalDate limitStart = LocalDate.now().minusDays(15);
|
||||||
LocalDate limitStart = LocalDate.now().minusDays(30);
|
|
||||||
log.debug("isModifiable @@limitStart: {}, startDate: {}, endDate: {}", limitStart, startDate, endDate);
|
log.debug("isModifiable @@limitStart: {}, startDate: {}, endDate: {}", limitStart, startDate, endDate);
|
||||||
|
|
||||||
return (limitStart.isBefore(startDate) || limitStart.isEqual(startDate) || limitStart.isEqual(endDate));
|
return (limitStart.isBefore(startDate) || limitStart.isEqual(startDate) || limitStart.isEqual(endDate));
|
||||||
@@ -101,8 +103,7 @@ public class DailyUtil {
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public boolean isRegisterPossible(LocalDate startDate, LocalDate endDate) {
|
public boolean isRegisterPossible(LocalDate startDate, LocalDate endDate) {
|
||||||
// TODO : 15일로 변경, 테스트를 위해 60일로 진행중
|
LocalDate limitStart = LocalDate.now().minusDays(15);
|
||||||
LocalDate limitStart = LocalDate.now().minusDays(60);
|
|
||||||
log.debug("isRegisterPossible @@limitStart: {}, startDate: {}, endDate: {}", limitStart, startDate, endDate);
|
log.debug("isRegisterPossible @@limitStart: {}, startDate: {}, endDate: {}", limitStart, startDate, endDate);
|
||||||
|
|
||||||
return (limitStart.isBefore(startDate) || limitStart.isEqual(startDate));
|
return (limitStart.isBefore(startDate) || limitStart.isEqual(startDate));
|
||||||
@@ -128,4 +129,35 @@ public class DailyUtil {
|
|||||||
|
|
||||||
return new DecimalFormat("###,###").format(Double.parseDouble(value));
|
return new DecimalFormat("###,###").format(Double.parseDouble(value));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 농업 생산물의 UI Code 데이터의 수입부호, 지출부호 조회
|
||||||
|
*
|
||||||
|
* @param uiCodeList UI Code 목록
|
||||||
|
* @param targetCode 조회 코드
|
||||||
|
* @return 수입부호, 지출부호 Map
|
||||||
|
*/
|
||||||
|
public HashMap<String, String> getMarkByFarming(List<UICodeElement> uiCodeList, String targetCode) {
|
||||||
|
String incomeMark = null;
|
||||||
|
String expenseMark = null;
|
||||||
|
if (!"code.record.farming.self".equals(targetCode)) {
|
||||||
|
String returnValue = null;
|
||||||
|
for (UICodeElement codeSetup : uiCodeList) {
|
||||||
|
if (codeSetup.getId().equalsIgnoreCase(targetCode)) {
|
||||||
|
returnValue = codeSetup.getCodeValue();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (returnValue != null) {
|
||||||
|
incomeMark = returnValue.split(",")[0];
|
||||||
|
expenseMark = returnValue.split(",")[1];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
HashMap<String, String> returnValue = new HashMap<>();
|
||||||
|
returnValue.put("incomeMark", incomeMark);
|
||||||
|
returnValue.put("expenseMark", expenseMark);
|
||||||
|
return returnValue;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,4 +16,22 @@ public class DailyRecordConstants {
|
|||||||
* [정책] 외상판매 Y 일 경우 지출부호 91206 적재
|
* [정책] 외상판매 Y 일 경우 지출부호 91206 적재
|
||||||
*/
|
*/
|
||||||
public static final String INCOME_EXPENSE_MARK = "91206";
|
public static final String INCOME_EXPENSE_MARK = "91206";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 지출의 유형
|
||||||
|
* [정책] 2 고정
|
||||||
|
*/
|
||||||
|
public static final String EXPENSE_CATEGORY = "2";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 지출의 수입부호
|
||||||
|
* [정책] 외상판매 Y 일 경우 수입부호 52210 적재
|
||||||
|
*/
|
||||||
|
public static final String EXPENSE_INCOME_MARK = "52210";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 임업생산물의 지출부호
|
||||||
|
* [정책] 81011 고정
|
||||||
|
*/
|
||||||
|
public static final String FORESTRY_EXPENSE_MARK = "81011";
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -152,7 +152,7 @@ VALUES
|
|||||||
('code.record.farming', 'code.record', '자가농업 생산물 중 자가소비량', NULL, NULL, true, 3, NOW(), 'khj', NOW(), 'khj', NULL, NULL, false),
|
('code.record.farming', 'code.record', '자가농업 생산물 중 자가소비량', NULL, NULL, true, 3, NOW(), 'khj', NOW(), 'khj', NULL, NULL, false),
|
||||||
('code.record.farming.11', 'code.record.farming', '쌀', '12111,81012', NULL, true, 0, NOW(), 'khj', NOW(), 'khj', NULL, NULL, false),
|
('code.record.farming.11', 'code.record.farming', '쌀', '12111,81012', NULL, true, 0, NOW(), 'khj', NOW(), 'khj', NULL, NULL, false),
|
||||||
('code.record.farming.12', 'code.record.farming', '찹쌀', '12111,81012', NULL, true, 1, NOW(), 'khj', NOW(), 'khj', NULL, NULL, false),
|
('code.record.farming.12', 'code.record.farming', '찹쌀', '12111,81012', NULL, true, 1, NOW(), 'khj', NOW(), 'khj', NULL, NULL, false),
|
||||||
('code.record.farming.13', 'code.record.farming', '보리', '12111,81012', NULL, true, 2, NOW(), 'khj', NOW(), 'khj', NULL, NULL, false),
|
('code.record.farming.13', 'code.record.farming', '보리', '12112,81012', NULL, true, 2, NOW(), 'khj', NOW(), 'khj', NULL, NULL, false),
|
||||||
('code.record.farming.14', 'code.record.farming', '콩', '12114,81012', NULL, true, 3, NOW(), 'khj', NOW(), 'khj', NULL, NULL, false),
|
('code.record.farming.14', 'code.record.farming', '콩', '12114,81012', NULL, true, 3, NOW(), 'khj', NOW(), 'khj', NULL, NULL, false),
|
||||||
('code.record.farming.15', 'code.record.farming', '팥', '12114,81012', NULL, true, 4, NOW(), 'khj', NOW(), 'khj', NULL, NULL, false),
|
('code.record.farming.15', 'code.record.farming', '팥', '12114,81012', NULL, true, 4, NOW(), 'khj', NOW(), 'khj', NULL, NULL, false),
|
||||||
('code.record.farming.16', 'code.record.farming', '고구마', '12114,81012', NULL, true, 5, NOW(), 'khj', NOW(), 'khj', NULL, NULL, false),
|
('code.record.farming.16', 'code.record.farming', '고구마', '12114,81012', NULL, true, 5, NOW(), 'khj', NOW(), 'khj', NULL, NULL, false),
|
||||||
|
|||||||
@@ -45,9 +45,9 @@ DROP TABLE IF EXISTS power_equipment_usage;
|
|||||||
DROP TABLE IF EXISTS work_input_time;
|
DROP TABLE IF EXISTS work_input_time;
|
||||||
DROP TABLE IF EXISTS work_input;
|
DROP TABLE IF EXISTS work_input;
|
||||||
DROP TABLE IF EXISTS monthly_carryover;
|
DROP TABLE IF EXISTS monthly_carryover;
|
||||||
DROP TABLE IF EXISTS bank_auto_transfer;
|
|
||||||
DROP TABLE IF EXISTS income_expense_record;
|
DROP TABLE IF EXISTS income_expense_record;
|
||||||
--DROP TABLE IF EXISTS daily_input_status;
|
--DROP TABLE IF EXISTS daily_input_status;
|
||||||
|
DROP TABLE IF EXISTS bank_auto_transfer;
|
||||||
DROP TABLE IF EXISTS monthly_input_status;
|
DROP TABLE IF EXISTS monthly_input_status;
|
||||||
|
|
||||||
-- admin
|
-- admin
|
||||||
@@ -103,9 +103,11 @@ DROP SEQUENCE IF EXISTS power_equipment_usage_seq;
|
|||||||
DROP SEQUENCE IF EXISTS work_input_time_seq;
|
DROP SEQUENCE IF EXISTS work_input_time_seq;
|
||||||
DROP SEQUENCE IF EXISTS work_input_seq;
|
DROP SEQUENCE IF EXISTS work_input_seq;
|
||||||
DROP SEQUENCE IF EXISTS monthly_carryover_seq;
|
DROP SEQUENCE IF EXISTS monthly_carryover_seq;
|
||||||
DROP SEQUENCE IF EXISTS bank_auto_transfer_seq;
|
|
||||||
DROP SEQUENCE IF EXISTS income_expense_record_seq;
|
DROP SEQUENCE IF EXISTS income_expense_record_seq;
|
||||||
DROP SEQUENCE IF EXISTS daily_input_status_seq;
|
DROP SEQUENCE IF EXISTS daily_input_status_seq;
|
||||||
|
|
||||||
|
DROP SEQUENCE IF EXISTS bank_auto_transfer_seq;
|
||||||
DROP SEQUENCE IF EXISTS monthly_input_status_seq;
|
DROP SEQUENCE IF EXISTS monthly_input_status_seq;
|
||||||
|
|
||||||
DROP SEQUENCE IF EXISTS admin_seq;
|
DROP SEQUENCE IF EXISTS admin_seq;
|
||||||
|
|||||||
@@ -1108,7 +1108,9 @@ CREATE TABLE monthly_input_status (
|
|||||||
household_seq bigint NOT NULL, -- 임가 일련번호 (FK)
|
household_seq bigint NOT NULL, -- 임가 일련번호 (FK)
|
||||||
month varchar(7) NOT NULL, -- 조사시행 월 (yyyy-mm)
|
month varchar(7) NOT NULL, -- 조사시행 월 (yyyy-mm)
|
||||||
forest_product_status varchar(15), -- 임산물 현황 입력상태 (enum)
|
forest_product_status varchar(15), -- 임산물 현황 입력상태 (enum)
|
||||||
bank_auto_transfer_status varchar(15), -- 은행 자동이체 내역 입력상태 (enum)
|
bank_auto_transfer_input_status varchar(15),
|
||||||
|
bank_auto_transfer_output_status varchar(15),
|
||||||
|
-- 은행 자동이체 내역 입력상태 (enum)
|
||||||
created_at timestamp(6), -- 생성일
|
created_at timestamp(6), -- 생성일
|
||||||
created_by varchar(255), -- 생성자
|
created_by varchar(255), -- 생성자
|
||||||
updated_at timestamp(6), -- 수정일
|
updated_at timestamp(6), -- 수정일
|
||||||
@@ -1119,8 +1121,8 @@ CREATE TABLE monthly_input_status (
|
|||||||
|
|
||||||
CONSTRAINT monthly_input_status_pkey PRIMARY KEY (id),
|
CONSTRAINT monthly_input_status_pkey PRIMARY KEY (id),
|
||||||
CONSTRAINT fk_monthly_input_status__household FOREIGN KEY (household_seq) REFERENCES household(seq),
|
CONSTRAINT fk_monthly_input_status__household FOREIGN KEY (household_seq) REFERENCES household(seq),
|
||||||
CONSTRAINT mis_forest_product_status CHECK (forest_product_status::text = ANY (ARRAY['NONE'::text, 'NOTHING'::text, 'REGISTERED'::text])),
|
--CONSTRAINT mis_forest_product_status CHECK (forest_product_status::text = ANY (ARRAY['NONE'::text, 'NOTHING'::text, 'REGISTERED'::text])),
|
||||||
CONSTRAINT mis_bank_auto_transfer_status CHECK (bank_auto_transfer_status::text = ANY (ARRAY['NONE'::text, 'NOTHING'::text, 'REGISTERED'::text]))
|
--CONSTRAINT mis_bank_auto_transfer_status CHECK (bank_auto_transfer_status::text = ANY (ARRAY['NONE'::text, 'NOTHING'::text, 'REGISTERED'::text]))
|
||||||
|
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -1130,7 +1132,8 @@ COMMENT ON COLUMN monthly_input_status.id IS '일계부 작성상태 ID';
|
|||||||
COMMENT ON COLUMN monthly_input_status.household_seq IS '임가 일련번호';
|
COMMENT ON COLUMN monthly_input_status.household_seq IS '임가 일련번호';
|
||||||
COMMENT ON COLUMN monthly_input_status.month IS '조사시행 월 (yyyy-mm)';
|
COMMENT ON COLUMN monthly_input_status.month IS '조사시행 월 (yyyy-mm)';
|
||||||
COMMENT ON COLUMN monthly_input_status.forest_product_status IS '임산물 현황 입력상태';
|
COMMENT ON COLUMN monthly_input_status.forest_product_status IS '임산물 현황 입력상태';
|
||||||
COMMENT ON COLUMN monthly_input_status.bank_auto_transfer_status IS '은행 자동이체 내역 입력상태';
|
COMMENT ON COLUMN monthly_input_status.bank_auto_transfer_input_status IS '은행 자동이체 내역 입력상태';
|
||||||
|
COMMENT ON COLUMN monthly_input_status.bank_auto_transfer_output_status IS '은행 자동이체 내역 입력상태';
|
||||||
COMMENT ON COLUMN monthly_input_status.created_at IS '생성일';
|
COMMENT ON COLUMN monthly_input_status.created_at IS '생성일';
|
||||||
COMMENT ON COLUMN monthly_input_status.created_by IS '생성자';
|
COMMENT ON COLUMN monthly_input_status.created_by IS '생성자';
|
||||||
COMMENT ON COLUMN monthly_input_status.updated_at IS '수정일';
|
COMMENT ON COLUMN monthly_input_status.updated_at IS '수정일';
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package app.module.front.usecase.daily.expense.ports.application;
|
package app.module.front.usecase.daily.expense.ports.application;
|
||||||
|
|
||||||
|
import app.module.core.config.constants.DailyRecordConstants;
|
||||||
import app.module.core.usecase.daily.record.ports.DailyRecordPortIn;
|
import app.module.core.usecase.daily.record.ports.DailyRecordPortIn;
|
||||||
import app.module.core.usecase.uicode.list.ports.UICodeListPortIn;
|
import app.module.core.usecase.uicode.list.ports.UICodeListPortIn;
|
||||||
import app.module.core.usecase.uicode.list.ports.application.domain.UICodeElement;
|
import app.module.core.usecase.uicode.list.ports.application.domain.UICodeElement;
|
||||||
@@ -98,8 +99,8 @@ public class DailyExpenseService implements DailyExpensePortIn {
|
|||||||
formVO.getId(),
|
formVO.getId(),
|
||||||
formVO.getDailyRecordSeq(),
|
formVO.getDailyRecordSeq(),
|
||||||
formVO.getInputType(),
|
formVO.getInputType(),
|
||||||
"2", // [정책] 2 고정
|
DailyRecordConstants.EXPENSE_CATEGORY,
|
||||||
(formVO.getCredit() ? "52210" : null), // [정책] 외상판매 Y 일 경우 수입부호 52210 적재
|
(formVO.getCredit() ? DailyRecordConstants.EXPENSE_INCOME_MARK : null),
|
||||||
formVO.getCredit(),
|
formVO.getCredit(),
|
||||||
formVO.getExpenseKind(),
|
formVO.getExpenseKind(),
|
||||||
formVO.getSourcePurpose(),
|
formVO.getSourcePurpose(),
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package app.module.front.usecase.daily.farming.ports.application;
|
package app.module.front.usecase.daily.farming.ports.application;
|
||||||
|
|
||||||
|
import app.module.core.config.application.util.DailyUtil;
|
||||||
import app.module.core.usecase.daily.record.ports.DailyRecordPortIn;
|
import app.module.core.usecase.daily.record.ports.DailyRecordPortIn;
|
||||||
import app.module.core.usecase.uicode.list.ports.UICodeListPortIn;
|
import app.module.core.usecase.uicode.list.ports.UICodeListPortIn;
|
||||||
import app.module.core.usecase.uicode.list.ports.application.domain.UICodeElement;
|
import app.module.core.usecase.uicode.list.ports.application.domain.UICodeElement;
|
||||||
@@ -18,6 +19,7 @@ import lombok.RequiredArgsConstructor;
|
|||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@Slf4j
|
@Slf4j
|
||||||
@@ -25,8 +27,9 @@ import java.util.List;
|
|||||||
@RequiredArgsConstructor
|
@RequiredArgsConstructor
|
||||||
public class DailyFarmingService implements DailyFarmingPortIn {
|
public class DailyFarmingService implements DailyFarmingPortIn {
|
||||||
private final DailyFarmingPortOut portOut;
|
private final DailyFarmingPortOut portOut;
|
||||||
private final UICodeListPortIn uiCodeListPortIn;
|
|
||||||
private final DailyRecordPortIn dailyRecordPortIn;
|
private final DailyRecordPortIn dailyRecordPortIn;
|
||||||
|
private final UICodeListPortIn uiCodeListPortIn;
|
||||||
|
private final DailyUtil dailyUtil;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<DailyFarmingDto> list(DailyFarmingUIReqVO reqVO) {
|
public List<DailyFarmingDto> list(DailyFarmingUIReqVO reqVO) {
|
||||||
@@ -101,30 +104,14 @@ public class DailyFarmingService implements DailyFarmingPortIn {
|
|||||||
formVO.getHouseholdSeq(),
|
formVO.getHouseholdSeq(),
|
||||||
formVO.getId());
|
formVO.getId());
|
||||||
|
|
||||||
String incomeMark = null;
|
HashMap<String, String> markMap = dailyUtil.getMarkByFarming(uiCodeListPortIn.connect("code.record.farming"), formVO.getProductCode());
|
||||||
String expenseMark = null;
|
|
||||||
if (!"code.record.farming.self".equals(formVO.getProductCode())) {
|
|
||||||
List<UICodeElement> recordFarming = uiCodeListPortIn.connect("code.record.farming");
|
|
||||||
String returnValue = null;
|
|
||||||
for (UICodeElement codeSetup : recordFarming) {
|
|
||||||
if (codeSetup.getId().equalsIgnoreCase(formVO.getProductCode())) {
|
|
||||||
returnValue = codeSetup.getCodeValue();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (returnValue != null) {
|
|
||||||
incomeMark = returnValue.split(",")[0];
|
|
||||||
expenseMark = returnValue.split(",")[1];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
CreateDailyFarmingCmd command = AuditUtil.create(
|
CreateDailyFarmingCmd command = AuditUtil.create(
|
||||||
new CreateDailyFarmingCmd(
|
new CreateDailyFarmingCmd(
|
||||||
formVO.getId(),
|
formVO.getId(),
|
||||||
formVO.getDailyRecordSeq(),
|
formVO.getDailyRecordSeq(),
|
||||||
incomeMark,
|
markMap.get("incomeMark"),
|
||||||
expenseMark,
|
markMap.get("expenseMark"),
|
||||||
formVO.getProductCode(),
|
formVO.getProductCode(),
|
||||||
formVO.getProductSelf(),
|
formVO.getProductSelf(),
|
||||||
formVO.getUsage(),
|
formVO.getUsage(),
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package app.module.front.usecase.daily.forestry.ports.application;
|
package app.module.front.usecase.daily.forestry.ports.application;
|
||||||
|
|
||||||
|
import app.module.core.config.constants.DailyRecordConstants;
|
||||||
import app.module.core.usecase.daily.record.ports.DailyRecordPortIn;
|
import app.module.core.usecase.daily.record.ports.DailyRecordPortIn;
|
||||||
import app.module.core.usecase.uicode.list.ports.UICodeListPortIn;
|
import app.module.core.usecase.uicode.list.ports.UICodeListPortIn;
|
||||||
import app.module.core.usecase.uicode.list.ports.application.domain.UICodeElement;
|
import app.module.core.usecase.uicode.list.ports.application.domain.UICodeElement;
|
||||||
@@ -99,7 +100,7 @@ public class DailyForestryService implements DailyForestryPortIn {
|
|||||||
new CreateDailyForestryCmd(
|
new CreateDailyForestryCmd(
|
||||||
formVO.getId(),
|
formVO.getId(),
|
||||||
formVO.getDailyRecordSeq(),
|
formVO.getDailyRecordSeq(),
|
||||||
"81011", // [정책] 81011 고정
|
DailyRecordConstants.FORESTRY_EXPENSE_MARK,
|
||||||
formVO.getProductName(),
|
formVO.getProductName(),
|
||||||
formVO.getUsage(),
|
formVO.getUsage(),
|
||||||
formVO.getQuantity(),
|
formVO.getQuantity(),
|
||||||
|
|||||||
@@ -5,7 +5,6 @@ spring:
|
|||||||
messages:
|
messages:
|
||||||
basename: messages/exception,messages/validation,messages/uri,messages/operation
|
basename: messages/exception,messages/validation,messages/uri,messages/operation
|
||||||
encoding: UTF-8
|
encoding: UTF-8
|
||||||
|
|
||||||
# gzip compression 설정
|
# gzip compression 설정
|
||||||
compression:
|
compression:
|
||||||
enabled: true
|
enabled: true
|
||||||
|
|||||||
@@ -9,7 +9,6 @@
|
|||||||
, ds.work_land_area, ds.area_unit_code, ds.area_unit_self, ds.harvest_quantity, ds.harvest_unit_code, ds.harvest_unit_self
|
, ds.work_land_area, ds.area_unit_code, ds.area_unit_self, ds.harvest_quantity, ds.harvest_unit_code, ds.harvest_unit_self
|
||||||
, ds.owner_time, ds.spouse_time, ds.family_m_hours, ds.family_f_hours, ds.hired_m_hours
|
, ds.owner_time, ds.spouse_time, ds.family_m_hours, ds.family_f_hours, ds.hired_m_hours
|
||||||
, ds.hired_f_hours, ds.shared_m_hours, ds.shared_f_hours, ds.volunteer_m_hours, ds.volunteer_f_hours
|
, ds.hired_f_hours, ds.shared_m_hours, ds.shared_f_hours, ds.volunteer_m_hours, ds.volunteer_f_hours
|
||||||
, ds.is_deleted
|
|
||||||
from daily_work ds
|
from daily_work ds
|
||||||
<include refid="app.module.core.usecase.daily.record.adapters.persistence.DailyRecordMapper.InnerJoinByDailyRecord"/>
|
<include refid="app.module.core.usecase.daily.record.adapters.persistence.DailyRecordMapper.InnerJoinByDailyRecord"/>
|
||||||
where ds.is_deleted = false
|
where ds.is_deleted = false
|
||||||
|
|||||||
@@ -89,7 +89,8 @@
|
|||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<button type="button" class="btn btn-m btn-secondary btn-full button-modal01" data-testid="button-modal01">
|
<button type="button" class="btn btn-m btn-secondary btn-full button-modal01" data-testid="button-modal01"
|
||||||
|
th:if="${btnActive}">
|
||||||
<i class="ico-add ico-small" aria-hidden="true"></i>
|
<i class="ico-add ico-small" aria-hidden="true"></i>
|
||||||
<span class="btn-txt">추가 등록</span>
|
<span class="btn-txt">추가 등록</span>
|
||||||
</button>
|
</button>
|
||||||
|
|||||||
@@ -87,7 +87,8 @@
|
|||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<button type="button" class="btn btn-m btn-secondary btn-full button-modal01" data-testid="button-modal01">
|
<button type="button" class="btn btn-m btn-secondary btn-full button-modal01" data-testid="button-modal01"
|
||||||
|
th:if="${btnActive}">
|
||||||
<i class="ico-add ico-small" aria-hidden="true"></i>
|
<i class="ico-add ico-small" aria-hidden="true"></i>
|
||||||
<span class="btn-txt">추가 등록</span>
|
<span class="btn-txt">추가 등록</span>
|
||||||
</button>
|
</button>
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user