[BO] 일계부 노동투입 등록, 수정
This commit is contained in:
@@ -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,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;
|
||||||
|
}
|
||||||
@@ -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>
|
||||||
@@ -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;
|
||||||
|
|
||||||
@@ -176,7 +176,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 일계부 상세 값 set
|
// 일계부 상세 값 set
|
||||||
const setIncomeFormData = (data) => {
|
const setDailyIncomeFormData = (data) => {
|
||||||
const form = document.reqIncomeForm;
|
const form = document.reqIncomeForm;
|
||||||
if (!form) return;
|
if (!form) return;
|
||||||
|
|
||||||
@@ -213,7 +213,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 +224,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,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>
|
||||||
@@ -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><!-- 작업면적 단위 -->
|
||||||
@@ -810,6 +810,8 @@
|
|||||||
|
|
||||||
if (currentStep === 'INCOME') {
|
if (currentStep === 'INCOME') {
|
||||||
showDailyIncomeModal();
|
showDailyIncomeModal();
|
||||||
|
} else if (currentStep === 'WORK') {
|
||||||
|
showDailyWorkModal();
|
||||||
} else {
|
} else {
|
||||||
alert('TODO : 추가');
|
alert('TODO : 추가');
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -177,6 +177,7 @@
|
|||||||
|
|
||||||
<!-- 일계부 모달 -->
|
<!-- 일계부 모달 -->
|
||||||
<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="common/modal-researcher-mapping :: modalFragment"/>
|
<th:block th:replace="common/modal-researcher-mapping :: modalFragment"/>
|
||||||
@@ -315,7 +316,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 {
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
Reference in New Issue
Block a user