[FO] 일계부 임업노동 CRUD

This commit is contained in:
김현주
2025-06-19 15:06:47 +09:00
parent 1284a0d03d
commit cbead51277
27 changed files with 1575 additions and 53 deletions

View File

@@ -16,7 +16,6 @@ import java.util.List;
@Service
@RequiredArgsConstructor
public class DailyPowerDao implements DailyPowerPortOut {
private final UICodeListPortIn uiCodeListPortIn;
private final DailyPowerMapper dailyPowerMapper;
@Override

View File

@@ -23,9 +23,9 @@ import org.springframework.web.bind.annotation.*;
@RequestMapping(path = "/api/record/power")
public class DailyPowerController {
private final CoreUtil coreUtil;
private final DailyRecordPortIn dailyRecordService;
private final DailyPowerPortIn dailyPowerService;
private final CreateDailyPowerValidator createDailyPowerValidator;
private final DailyRecordPortIn dailyRecordPortIn;
private final DailyPowerPortIn dailyPowerPortIn;
private final CreateDailyPowerValidator createValidator;
/**
* 일계부 동력 사용시간 등록 처리
@@ -41,7 +41,7 @@ public class DailyPowerController {
, @PathVariable("id") String id
, @Valid @RequestBody CreateDailyPowerReqVO formVO, BindingResult bindingResult) {
createDailyPowerValidator.validate(formVO, bindingResult);
createValidator.validate(formVO, bindingResult);
if (bindingResult.hasErrors()) {
return coreUtil.getErrorInfo(bindingResult);
}
@@ -54,7 +54,7 @@ public class DailyPowerController {
formVO.setDailyRecordSeq(dailyRecord.getId());
log.debug("formVO: {}", formVO);
dailyPowerService.create(formVO);
dailyPowerPortIn.create(formVO);
return ResponseEntity.status(HttpStatus.OK).body(formVO);
}
@@ -84,7 +84,7 @@ public class DailyPowerController {
formVO.setDailyRecordSeq(dailyRecord.getId());
log.debug("formVO: {}", formVO);
dailyPowerService.remove(formVO);
dailyPowerPortIn.remove(formVO);
return ResponseEntity.status(HttpStatus.OK).body(formVO);
}
@@ -106,7 +106,7 @@ public class DailyPowerController {
formVO.setDailyRecordSeq(dailyRecord.getId());
log.debug("formVO: {}", formVO);
dailyPowerService.remove(formVO);
dailyPowerPortIn.remove(formVO);
return ResponseEntity.status(HttpStatus.OK).body(formVO);
}
@@ -121,7 +121,7 @@ public class DailyPowerController {
DailyUIReqVO reqVO = new DailyUIReqVO(searchMonth, groupNo);
log.debug("getRecordUIReq: {}", reqVO);
DailyRecordDto dailyRecord = dailyRecordService.detail(reqVO);
DailyRecordDto dailyRecord = dailyRecordPortIn.detail(reqVO);
if (dailyRecord == null || dailyRecord.getId() == null) {
throw new NoRecordDataException();
}

View File

@@ -62,7 +62,7 @@ public class DailyPowerUIController {
* @param model Model
* @param searchMonth 검색 월(yyyyMM)
* @param groupNo 검색 그룹
* @param id 수입 일련번호
* @param id 동력 사용시간 일련번호
*/
@GetMapping(path = "/{searchMonth}/{groupNo}/form/{id}")
public String formBySelf(Model model, @PathVariable("searchMonth") String searchMonth, @PathVariable("groupNo") String groupNo

View File

@@ -25,7 +25,6 @@ import java.util.List;
@RequiredArgsConstructor
public class DailyPowerService implements DailyPowerPortIn {
private final DailyPowerPortOut portOut;
private final UICodeListPortIn uiCodeListPortIn;
@Override
public List<DailyPowerDto> list(DailyPowerUIReqVO reqVO) {

View File

@@ -0,0 +1,48 @@
package app.module.front.usecase.daily.work.adapters.persistence;
import app.module.front.usecase.daily.work.adapters.persistence.model.DailyWorkDto;
import app.module.front.usecase.daily.work.ports.DailyWorkPortOut;
import app.module.front.usecase.daily.work.ports.application.domain.CreateDailyWorkCmd;
import app.module.front.usecase.daily.work.ports.application.domain.GetDailyWorkCmd;
import app.module.front.usecase.daily.work.ports.application.domain.RemoveDailyWorkCmd;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import java.util.List;
@Slf4j
@Service
@RequiredArgsConstructor
public class DailyWorkDao implements DailyWorkPortOut {
private final DailyWorkMapper dailyWorkMapper;
@Override
public List<DailyWorkDto> list(GetDailyWorkCmd command) {
return dailyWorkMapper.getDailyWorkList(command);
}
@Override
public void create(GetDailyWorkCmd findCmd, CreateDailyWorkCmd command) {
Integer existCount = dailyWorkMapper.getRecordExistCount(findCmd);
if (existCount == 0) {
dailyWorkMapper.createDailyWork(command);
log.debug("[CreateDailyWork] record={}", command);
} else {
dailyWorkMapper.updateDailyWork(command);
log.debug("[UpdateDailyWork] record={}", command);
}
}
@Override
public void remove(GetDailyWorkCmd findCmd, RemoveDailyWorkCmd command) {
Integer existCount = dailyWorkMapper.getRecordExistCount(findCmd);
if (existCount != 0) {
dailyWorkMapper.removeDailyWork(command);
log.debug("[RemoveDailyWork] record={}", command);
}
}
}

View File

@@ -0,0 +1,50 @@
package app.module.front.usecase.daily.work.adapters.persistence;
import app.module.front.usecase.daily.work.ports.application.domain.CreateDailyWorkCmd;
import app.module.front.usecase.daily.work.adapters.persistence.model.DailyWorkDto;
import app.module.front.usecase.daily.work.ports.application.domain.GetDailyWorkCmd;
import app.module.front.usecase.daily.work.ports.application.domain.RemoveDailyWorkCmd;
import app.module.front.usecase.daily.work.adapters.web.model.DailyWorkUIReqVO;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
@Mapper
public interface DailyWorkMapper {
/**
* 일계부 임업노동 목록 조회
*
* @param command 검색 조건
* @return 임업노동 목록
*/
List<DailyWorkDto> getDailyWorkList(GetDailyWorkCmd command);
/**
* 일계부 임업노동 데이터 존재 여부
*
* @param command 검색 조건
* @return 중복 개수
*/
Integer getRecordExistCount(GetDailyWorkCmd command);
/**
* 일계부 임업노동 등록
*
* @param command 등록 데이터
*/
void createDailyWork(CreateDailyWorkCmd command);
/**
* 일계부 임업노동 수정
*
* @param command 수정 데이터
*/
void updateDailyWork(CreateDailyWorkCmd command);
/**
* 일계부 임업노동 삭제
*
* @param command 삭제 데이터
*/
void removeDailyWork(RemoveDailyWorkCmd command);
}

View File

@@ -0,0 +1,41 @@
package app.module.front.usecase.daily.work.adapters.persistence.model;
import lombok.Getter;
import lombok.Setter;
@Getter
@Setter
public class DailyWorkDto {
private Long id;
private Long dailyRecordSeq;
private String itemName;
private String itemMark;
private String workName;
private String workMark;
private Double workLandArea;
private String areaUnitCode;
private String areaUnitLabel;
private String areaUnitSelf;
private String harvestQuantity;
private String harvestUnitCode;
private String harvestUnitLabel;
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;
/**
* 수정 가능 여부
* @return true=가능, false=불가능(등록 상태)
*/
public boolean isUpdated() {
return this.id != null && this.id != 0L;
}
}

View File

@@ -0,0 +1,135 @@
package app.module.front.usecase.daily.work.adapters.web;
import app.module.core.config.application.exception.NoRecordDataException;
import app.module.core.config.application.util.CoreUtil;
import app.module.front.usecase.daily.record.adapters.persistence.model.DailyRecordDto;
import app.module.front.usecase.daily.record.adapters.web.model.DailyUIReqVO;
import app.module.front.usecase.daily.record.ports.DailyRecordPortIn;
import app.module.front.usecase.daily.work.adapters.web.model.CreateDailyWorkReqVO;
import app.module.front.usecase.daily.work.adapters.web.model.RemoveDailyWorkReqVO;
import app.module.front.usecase.daily.work.adapters.web.validator.CreateDailyWorkValidator;
import app.module.front.usecase.daily.work.ports.DailyWorkPortIn;
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/record/work")
public class DailyWorkController {
private final CoreUtil coreUtil;
private final DailyRecordPortIn dailyRecordPortIn;
private final DailyWorkPortIn dailyWorkPortIn;
private final CreateDailyWorkValidator createValidator;
/**
* 일계부 임업노동 등록 처리
*
* @param searchMonth 검색 월(yyyyMM)
* @param groupNo 검색 그룹
* @param id 수입 일련번호
* @param formVO 입력 데이터
* @param bindingResult BindingResult
* @return
*/
@PostMapping(path = "/{searchMonth}/{groupNo}/form/{id}")
ResponseEntity<?> create(@PathVariable("searchMonth") String searchMonth, @PathVariable("groupNo") String groupNo
, @PathVariable("id") String id
, @Valid @RequestBody CreateDailyWorkReqVO formVO, BindingResult bindingResult) {
createValidator.validate(formVO, bindingResult);
if (bindingResult.hasErrors()) {
return coreUtil.getErrorInfo(bindingResult);
}
DailyRecordDto dailyRecord = this.vaildGetDailyRecord(searchMonth, groupNo);
formVO.setSearchMonth(searchMonth);
formVO.setGroupNo(Integer.parseInt(groupNo));
formVO.setId(Long.parseLong(id));
formVO.setDailyRecordSeq(dailyRecord.getId());
log.debug("formVO: {}", formVO);
dailyWorkPortIn.create(formVO);
return ResponseEntity.status(HttpStatus.OK).body(formVO);
}
/**
* 일계부 임업노동 삭제 처리
*
* @param searchMonth 검색 월(yyyyMM)
* @param groupNo 검색 그룹
* @param formVO 입력 데이터
* @param bindingResult BindingResult
* @return
*/
@PostMapping(path = "/{searchMonth}/{groupNo}/remove")
ResponseEntity<?> remove(@PathVariable("searchMonth") String searchMonth, @PathVariable("groupNo") String groupNo
, @Valid @RequestBody RemoveDailyWorkReqVO formVO, BindingResult bindingResult) {
log.debug("before formVO: {}", formVO);
if (bindingResult.hasErrors()) {
return ResponseEntity.status(HttpStatus.UNPROCESSABLE_ENTITY)
.body(bindingResult.getFieldErrors());
}
DailyRecordDto dailyRecord = this.vaildGetDailyRecord(searchMonth, groupNo);
formVO.setSearchMonth(dailyRecord.getRecordMonth());
formVO.setGroupNo(dailyRecord.getGroupNo());
formVO.setDailyRecordSeq(dailyRecord.getId());
log.debug("formVO: {}", formVO);
dailyWorkPortIn.remove(formVO);
return ResponseEntity.status(HttpStatus.OK).body(formVO);
}
/**
* 일계부 임업노동 전체 삭제 처리
*
* @param searchMonth 검색 월(yyyyMM)
* @param groupNo 검색 그룹
* @return
*/
@PostMapping(path = "/{searchMonth}/{groupNo}/reset")
ResponseEntity<?> removeAll(@PathVariable("searchMonth") String searchMonth, @PathVariable("groupNo") String groupNo) {
DailyRecordDto dailyRecord = this.vaildGetDailyRecord(searchMonth, groupNo);
RemoveDailyWorkReqVO formVO = new RemoveDailyWorkReqVO();
formVO.setSearchMonth(dailyRecord.getRecordMonth());
formVO.setGroupNo(dailyRecord.getGroupNo());
formVO.setDailyRecordSeq(dailyRecord.getId());
log.debug("formVO: {}", formVO);
dailyWorkPortIn.remove(formVO);
return ResponseEntity.status(HttpStatus.OK).body(formVO);
}
/**
* 일계부 유효성 체크 및 데이터 조회
*
* @param searchMonth 검색 월(yyyyMM)
* @param groupNo 검색 그룹
* @return
*/
private DailyRecordDto vaildGetDailyRecord(String searchMonth, String groupNo) {
DailyUIReqVO reqVO = new DailyUIReqVO(searchMonth, groupNo);
log.debug("getRecordUIReq: {}", reqVO);
DailyRecordDto dailyRecord = dailyRecordPortIn.detail(reqVO);
if (dailyRecord == null || dailyRecord.getId() == null) {
throw new NoRecordDataException();
}
return dailyRecord;
}
}

View File

@@ -0,0 +1,113 @@
package app.module.front.usecase.daily.work.adapters.web;
import app.module.core.config.application.exception.NoRecordDataException;
import app.module.core.usecase.uicode.list.ports.UICodeListPortIn;
import app.module.front.usecase.daily.record.adapters.persistence.model.DailyRecordDto;
import app.module.front.usecase.daily.record.adapters.web.model.DailySort;
import app.module.front.usecase.daily.record.adapters.web.model.DailyUIReqVO;
import app.module.front.usecase.daily.record.ports.DailyRecordPortIn;
import app.module.front.usecase.daily.work.adapters.persistence.model.DailyWorkDto;
import app.module.front.usecase.daily.work.adapters.web.model.DailyWorkUIReqVO;
import app.module.front.usecase.daily.work.ports.DailyWorkPortIn;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.thymeleaf.util.StringUtils;
import java.util.List;
@Slf4j
@Controller
@RequiredArgsConstructor
@RequestMapping(path = "/record/work")
public class DailyWorkUIController {
private final UICodeListPortIn uiCodeListPortIn;
private final DailyRecordPortIn dailyRecordPortIn;
private final DailyWorkPortIn dailyWorkPortIn;
/**
* 일계부 임업노동 목록 화면
*
* @param model Model
* @param searchMonth 검색 월(yyyyMM)
* @param groupNo 검색 그룹
* @param searchType 수정여부
*/
@GetMapping(path = "/{searchMonth}/{groupNo}")
public String index(Model model, @PathVariable("searchMonth") String searchMonth, @PathVariable("groupNo") String groupNo
, @RequestParam(name = "type", required = false) String searchType) {
DailyRecordDto dailyRecord = this.vaildGetDailyRecord(searchMonth, groupNo);
DailyWorkUIReqVO reqVO = new DailyWorkUIReqVO(searchMonth, groupNo);
log.debug("reqVO: {}", reqVO);
List<DailyWorkDto> workList = dailyWorkPortIn.list(reqVO);
model.addAttribute("reqVO", reqVO);
model.addAttribute("dailyRecord", dailyRecord);
model.addAttribute("workList", workList);
model.addAttribute("nextStep", dailyRecord.getNextStep(DailySort.WORK));
return "record/work/index";
}
/**
* 일계부 임업노동 등록 화면
*
* @param model Model
* @param searchMonth 검색 월(yyyyMM)
* @param groupNo 검색 그룹
* @param id 임업노동 일련번호
*/
@GetMapping(path = "/{searchMonth}/{groupNo}/form/{id}")
public String formBySelf(Model model, @PathVariable("searchMonth") String searchMonth, @PathVariable("groupNo") String groupNo
, @PathVariable("id") String id) {
DailyWorkUIReqVO reqVO = new DailyWorkUIReqVO(searchMonth, groupNo);
if (StringUtils.isEmpty(id)) {
reqVO.setId(0L);
} else {
reqVO.setId(Long.parseLong(id));
}
log.debug("reqVO: {}", reqVO);
DailyWorkDto detail = new DailyWorkDto();
if (reqVO.getId() != 0L) {
detail = dailyWorkPortIn.detail(reqVO);
if (detail == null || !detail.isUpdated()) {
throw new NoRecordDataException();
}
}
model.addAttribute("recordUnit", uiCodeListPortIn.connect("code.record.unit"));
model.addAttribute("reqVO", reqVO);
model.addAttribute("detail", detail);
return "record/work/form";
}
/**
* 일계부 유효성 체크 및 데이터 조회
*
* @param searchMonth 검색 월(yyyyMM)
* @param groupNo 검색 그룹
*/
private DailyRecordDto vaildGetDailyRecord(String searchMonth, String groupNo) {
DailyUIReqVO reqVO = new DailyUIReqVO(searchMonth, groupNo);
log.debug("getRecordUIReq: {}", reqVO);
DailyRecordDto dailyRecord = dailyRecordPortIn.detail(reqVO);
if (dailyRecord == null || dailyRecord.getId() == null) {
throw new NoRecordDataException();
}
return dailyRecord;
}
}

View File

@@ -0,0 +1,105 @@
package app.module.front.usecase.daily.work.adapters.web.model;
import app.module.front.usecase.daily.record.adapters.web.model.DailyUIReqVO;
import jakarta.validation.constraints.NotBlank;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
@Getter
@Setter
@ToString(callSuper = true)
public class CreateDailyWorkReqVO extends DailyUIReqVO {
/**
* 수입 일련번호
*/
private Long id;
/**
* 일계부 일련번호
*/
private Long dailyRecordSeq;
/**
* 품목명
*/
@NotBlank(message = "품목명을 입력해 주세요.")
private String itemName;
/**
* 품목부호
*/
private Boolean itemMark;
/**
* 작업명
*/
@NotBlank(message = "작업명을 입력해 주세요.")
private String workName;
/**
* 작업 부호
*/
private String workMark;
/**
* 작업 면적
*/
private Double workLandArea;
/**
* 작업 면적 단위 코드
*/
private String areaUnitCode;
/**
* 작업 면적 단위 직업입력
*/
private String areaUnitSelf;
/**
* 수확량
*/
@NotBlank(message = "수확량을 입력해 주세요.")
private String 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;
}

View File

@@ -0,0 +1,29 @@
package app.module.front.usecase.daily.work.adapters.web.model;
import app.module.front.usecase.daily.record.adapters.web.model.DailyUIReqVO;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
import org.apache.tika.utils.StringUtils;
@Getter
@Setter
@ToString(callSuper = true)
public class DailyWorkUIReqVO extends DailyUIReqVO {
public DailyWorkUIReqVO(String month, String no) {
setSearchMonth(month);
if (!StringUtils.isBlank(no)) {
setGroupNo(Integer.parseInt(no));
}
}
public DailyWorkUIReqVO(String month, Integer no) {
setSearchMonth(month);
setGroupNo(no);
}
/**
* 임업노동 일련번호
*/
private Long id;
}

View File

@@ -0,0 +1,22 @@
package app.module.front.usecase.daily.work.adapters.web.model;
import app.module.front.usecase.daily.record.adapters.web.model.DailyUIReqVO;
import jakarta.validation.constraints.NotBlank;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
@Getter
@Setter
@ToString(callSuper = true)
public class RemoveDailyWorkReqVO extends DailyUIReqVO {
/**
* 임업노동 일련번호
*/
@NotBlank(message = "{valid.common.required}")
private String id;
/**
* 일계부 일련번호
*/
private Long dailyRecordSeq;
}

View File

@@ -0,0 +1,45 @@
package app.module.front.usecase.daily.work.adapters.web.validator;
import app.module.front.usecase.daily.work.adapters.web.model.CreateDailyWorkReqVO;
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 CreateDailyWorkValidator implements Validator {
@Override
public boolean supports(Class<?> clazz) {
return CreateDailyWorkReqVO.class.equals(clazz);
}
@Override
public void validate(Object target, Errors errors) {
CreateDailyWorkReqVO vo = (CreateDailyWorkReqVO) target;
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개의 항목을 입력해주세요.");
}
if ("SELF".equals(vo.getAreaUnitCode()) && StringUtils.isBlank(vo.getAreaUnitSelf())) {
errors.rejectValue(
"areaUnitSelf", "valid.common.required",
"단위를 입력해 주세요.");
}
if ("SELF".equals(vo.getHarvestUnitCode()) && StringUtils.isBlank(vo.getHarvestUnitSelf())) {
errors.rejectValue(
"harvestUnitSelf", "valid.common.required",
"단위를 입력해 주세요.");
}
}
}

View File

@@ -0,0 +1,41 @@
package app.module.front.usecase.daily.work.ports;
import app.module.front.usecase.daily.work.adapters.persistence.model.DailyWorkDto;
import app.module.front.usecase.daily.work.adapters.web.model.CreateDailyWorkReqVO;
import app.module.front.usecase.daily.work.adapters.web.model.DailyWorkUIReqVO;
import app.module.front.usecase.daily.work.adapters.web.model.RemoveDailyWorkReqVO;
import java.util.List;
public interface DailyWorkPortIn {
/**
* 일계부 임업노동 조회
*
* @param reqVO 검색 조건
* @return 임업노동 목록
*/
List<DailyWorkDto> list(DailyWorkUIReqVO reqVO);
/**
* 일계부 임업노동 조회
*
* @param reqVO 검색 조건
* @return 임업노동 상세
*/
DailyWorkDto detail(DailyWorkUIReqVO reqVO);
/**
* 일계부 임업노동 등록
*
* @param formVO 입력 데이터
*/
void create(CreateDailyWorkReqVO formVO);
/**
* 일계부 임업노동 삭제
*
* @param formVO 삭제 검색 조건
*/
void remove(RemoveDailyWorkReqVO formVO);
}

View File

@@ -0,0 +1,36 @@
package app.module.front.usecase.daily.work.ports;
import app.module.front.usecase.daily.work.adapters.persistence.model.DailyWorkDto;
import app.module.front.usecase.daily.work.ports.application.domain.CreateDailyWorkCmd;
import app.module.front.usecase.daily.work.ports.application.domain.GetDailyWorkCmd;
import app.module.front.usecase.daily.work.ports.application.domain.RemoveDailyWorkCmd;
import java.util.List;
public interface DailyWorkPortOut {
/**
* 일계부 임업노동 조회
*
* @param command 검색 조건
* @return 임업노동 목록
*/
List<DailyWorkDto> list(GetDailyWorkCmd command);
/**
* 일계부 임업노동 등록
*
* @param findCmd 검색 조건
* @param command 입력 데이터
*/
void create(GetDailyWorkCmd findCmd, CreateDailyWorkCmd command);
/**
* 일계부 임업노동 삭제
*
* @param findCmd 검색 조건
* @param command 삭제 검색 조건
*/
void remove(GetDailyWorkCmd findCmd, RemoveDailyWorkCmd command);
}

View File

@@ -0,0 +1,146 @@
package app.module.front.usecase.daily.work.ports.application;
import app.module.core.usecase.uicode.list.ports.UICodeListPortIn;
import app.module.core.usecase.uicode.list.ports.application.domain.UICodeElement;
import app.module.front.config.application.util.AuditUtil;
import app.module.front.config.constants.CommonConstants;
import app.module.front.usecase.daily.work.adapters.persistence.model.DailyWorkDto;
import app.module.front.usecase.daily.work.adapters.web.model.CreateDailyWorkReqVO;
import app.module.front.usecase.daily.work.adapters.web.model.DailyWorkUIReqVO;
import app.module.front.usecase.daily.work.adapters.web.model.RemoveDailyWorkReqVO;
import app.module.front.usecase.daily.work.ports.DailyWorkPortIn;
import app.module.front.usecase.daily.work.ports.DailyWorkPortOut;
import app.module.front.usecase.daily.work.ports.application.domain.CreateDailyWorkCmd;
import app.module.front.usecase.daily.work.ports.application.domain.GetDailyWorkCmd;
import app.module.front.usecase.daily.work.ports.application.domain.RemoveDailyWorkCmd;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
import java.util.List;
@Service
@RequiredArgsConstructor
public class DailyWorkService implements DailyWorkPortIn {
private final DailyWorkPortOut portOut;
private final UICodeListPortIn uiCodeListPortIn;
@Override
public List<DailyWorkDto> list(DailyWorkUIReqVO reqVO) {
return this.getRefineList(reqVO);
}
@Override
public DailyWorkDto detail(DailyWorkUIReqVO reqVO) {
List<DailyWorkDto> list = this.getRefineList(reqVO);
if (list.isEmpty()) {
return null;
}
return list.get(0);
}
/**
* 목록 데이터 조회
*
* @param reqVO 검색 조건
* @return 공통 처리된 목록
*/
private List<DailyWorkDto> getRefineList(DailyWorkUIReqVO reqVO) {
List<DailyWorkDto> list = portOut.list(new GetDailyWorkCmd(reqVO.getSearchMonth(),
reqVO.getGroupNo(),
reqVO.getHouseholdSeq(),
reqVO.getId()));
List<UICodeElement> recordUnit = uiCodeListPortIn.connect("code.record.unit");
for (DailyWorkDto dto : list) {
if (CommonConstants.UNIT_CODE_SELF.equals(dto.getAreaUnitCode())) {
dto.setAreaUnitLabel(dto.getAreaUnitSelf());
} else {
dto.setAreaUnitLabel(this.getCodeLabel(dto.getAreaUnitCode(), recordUnit));
}
if (CommonConstants.UNIT_CODE_SELF.equals(dto.getHarvestUnitCode())) {
dto.setHarvestUnitLabel(dto.getHarvestUnitSelf());
} else {
dto.setHarvestUnitLabel(this.getCodeLabel(dto.getHarvestUnitCode(), recordUnit));
}
}
return list;
}
/**
* 코드명 조회
*
* @param codeId 코드
* @param codeList 공통 코드 목록
* @return 코드명
*/
private String getCodeLabel(String codeId, List<UICodeElement> codeList) {
String returnValue = null;
for (UICodeElement codeSetup : codeList) {
if (codeSetup.getId().equalsIgnoreCase(codeId)) {
returnValue = codeSetup.getCodeText();
break;
}
}
return returnValue;
}
@Override
public void create(CreateDailyWorkReqVO formVO) {
GetDailyWorkCmd findCmd = new GetDailyWorkCmd(
formVO.getSearchMonth(),
formVO.getGroupNo(),
formVO.getHouseholdSeq(),
formVO.getId());
CreateDailyWorkCmd command = AuditUtil.create(
new CreateDailyWorkCmd(
formVO.getId(),
formVO.getDailyRecordSeq(),
formVO.getItemName(),
null,
formVO.getWorkName(),
null,
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);
}
@Override
public void remove(RemoveDailyWorkReqVO formVO) {
Long id = formVO.getId() != null ? Long.parseLong(formVO.getId()) : null;
GetDailyWorkCmd findCmd = new GetDailyWorkCmd(
formVO.getSearchMonth(),
formVO.getGroupNo(),
formVO.getHouseholdSeq(),
id);
RemoveDailyWorkCmd command = AuditUtil.delete(
new RemoveDailyWorkCmd(
formVO.getSearchMonth(),
formVO.getGroupNo(),
id,
formVO.getDailyRecordSeq()));
portOut.remove(findCmd, command);
}
}

View File

@@ -0,0 +1,36 @@
package app.module.front.usecase.daily.work.ports.application.domain;
import app.module.front.config.adapters.persistence.component.FrontAuditCommand;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
@Getter
@Setter
@AllArgsConstructor
@ToString
public class CreateDailyWorkCmd extends FrontAuditCommand {
private Long id;
private Long dailyRecordSeq;
private String itemName;
private String itemMark;
private String workName;
private String workMark;
private Double workLandArea;
private String areaUnitCode;
private String areaUnitSelf;
private String 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;
}

View File

@@ -0,0 +1,27 @@
package app.module.front.usecase.daily.work.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;
}

View File

@@ -0,0 +1,18 @@
package app.module.front.usecase.daily.work.ports.application.domain;
import app.module.front.config.adapters.persistence.component.FrontAuditCommand;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
@Getter
@Setter
@AllArgsConstructor
@ToString
public class RemoveDailyWorkCmd extends FrontAuditCommand {
private String searchMonth;
private Integer groupNo;
private Long id;
private Long dailyRecordSeq;
}

View File

@@ -0,0 +1,88 @@
<?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.front.usecase.daily.work.adapters.persistence.DailyWorkMapper">
<select id="getDailyWorkList"
resultType="app.module.front.usecase.daily.work.adapters.persistence.model.DailyWorkDto">
select ds.id, ds.daily_record_seq
, ds.item_name, ds.item_mark, ds.work_name, ds.work_mark
, 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
, ds.is_deleted
from daily_work ds
<include refid="app.module.front.usecase.daily.record.adapters.persistence.DailyRecordMapper.InnerJoinByDailyRecord"/>
where ds.is_deleted = false
<if test="id != null and id != '0'">
and ds.id = ${id}
</if>
order by
ds.id desc
</select>
<select id="getRecordExistCount" resultType="int">
select count(1)
from daily_work ds
<include refid="app.module.front.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, item_mark, work_name, work_mark
, 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}, #{itemMark}, #{workName}, #{workMark}
, #{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}
, item_mark = #{itemMark}
, work_name = #{workName}
, work_mark = #{workMark}
, 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>
<update id="removeDailyWork">
update daily_work set
<include refid="common.fields.DeleteBaseSet"/>
where is_deleted = false
and daily_record_seq = #{dailyRecordSeq}
<if test="id != null and id != ''">
and id = #{id}
</if>
</update>
</mapper>

View File

@@ -0,0 +1 @@
.idea

View File

@@ -40,7 +40,7 @@
</span>
</label>
</div>
<!--/*<div class="component-input">
<div class="component-input">
<label class="switch-inner type-txt">
<span class="switch-label">임업노동 투입 내역</span>
<input type="checkbox" name="workStatus" value="TARGET" data-target="work"
@@ -49,7 +49,7 @@
<span class="switch-handle"></span>
</span>
</label>
</div>*/-->
</div>
<div class="component-input">
<label class="switch-inner type-txt">
<span class="switch-label">지출</span>

View File

@@ -109,7 +109,8 @@
</label>
</div>
<div class="input-field">
<input type="number" inputmode="decimal" pattern="[0-9]*" id="quantity" name="quantity" th:value="${detail.quantity}" maxlength="10" placeholder="수량을 입력해 주세요">
<input type="number" inputmode="decimal" pattern="[0-9]*" id="quantity" name="quantity"
th:value="${detail.quantity}" maxlength="10" placeholder="수량을 입력해 주세요">
</div>
<ul class="guide-info">
<li>예 : 2, 2.5</li>
@@ -163,7 +164,8 @@
</label>
</div>
<div class="input-field type-price">
<input type="number" inputmode="numeric" pattern="[0-9]*" id="price" name="price" th:value="${detail.price}" maxlength="10" placeholder="금액을 입력해 주세요">
<input type="number" inputmode="numeric" pattern="[0-9]*" id="price" name="price"
th:value="${detail.price}" maxlength="10" placeholder="금액을 입력해 주세요">
<span class="input-field-txt">원</span>
</div>
<ul class="guide-info">
@@ -179,7 +181,8 @@
</label>
</div>
<div class="input-field type-price">
<input type="number" inputmode="numeric" pattern="[0-9]*" id="estimatedValue" name="estimatedValue" th:value="${detail.estimatedValue}" maxlength="10" placeholder="금액을 입력해 주세요">
<input type="number" inputmode="numeric" pattern="[0-9]*" id="estimatedValue" name="estimatedValue"
th:value="${detail.estimatedValue}" maxlength="10" placeholder="금액을 입력해 주세요">
<span class="input-field-txt">원</span>
</div>
<ul class="guide-info">

View File

@@ -45,7 +45,7 @@
</label>
</div>
<div class="input-field type-hour">
<input type="number" inputmode="decimal" pattern="[0-9]*" id="ownedHours" name="ownedHours" th:value="${detail.ownedHours}" maxlength="10" placeholder="자가에서 사용한 동력 사용시간을 입력해 주세요">
<input type="number" inputmode="decimal" pattern="[0-9]*" id="ownedHours" name="ownedHours" th:value="${detail.ownedHours}" maxlength="10" placeholder="00">
<span class="input-field-txt">시간</span>
</div>
</div>
@@ -57,7 +57,7 @@
</label>
</div>
<div class="input-field type-hour">
<input type="number" inputmode="decimal" pattern="[0-9]*" id="leasedHours" name="leasedHours" th:value="${detail.leasedHours}" maxlength="10" placeholder="임차해서 사용한 동력 사용시간을 입력해 주세요">
<input type="number" inputmode="decimal" pattern="[0-9]*" id="leasedHours" name="leasedHours" th:value="${detail.leasedHours}" maxlength="10" placeholder="00">
<span class="input-field-txt">시간</span>
</div>
</div>

View File

@@ -0,0 +1,306 @@
<!DOCTYPE html>
<html xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout"
xmlns:th="http://www.thymeleaf.org" lang="ko">
<th:block>
<div class="modal-content-inner">
<article class="alert-box full green">
<ul>
<li>자가소비용 임산물 및 채취 임산물의 노동 작업도 임업노동 투입내역에 기입해 주세요.</li>
<li>임산물의 출하준비, 구입, 판매, 기획관리 등의 간접노동도 기입해 주세요.</li>
</ul>
</article>
<p class="form-desc">필수입력</p>
<form name="reqModalForm">
<input type="hidden" name="id" th:value="${detail.id}">
<section class="form-group">
<div class="component-input">
<div class="input-label">
<label for="itemName" class="label-txt">
품목명<i class="ico-required-mark" role="img" aria-label="필수">*</i>
</label>
</div>
<div class="input-field">
<input type="text" id="itemName" name="itemName" th:value="${detail.itemName}" maxlength="30" placeholder="품목을 입력해 주세요">
</div>
</div>
</section>
<hr>
<section class="form-group">
<div class="component-input">
<div class="input-label">
<label for="workName" class="label-txt">
작업명
<i class="ico-required-mark" role="img" aria-label="필수">*</i>
</label>
</div>
<div class="input-field">
<input type="text" id="workName" name="workName" th:value="${detail.workName}" maxlength="30" placeholder="어떤 작업을 했는지 입력해 주세요">
</div>
<ul class="guide-info">
<li>예 : 수확</li>
</ul>
</div>
<div class="component-input">
<div class="input-label">
<label for="workLandArea" class="label-txt">
작업 면적
</label>
</div>
<div class="input-field">
<input type="number" inputmode="decimal" pattern="[0-9]*" id="workLandArea" name="workLandArea"
th:value="${detail.workLandArea}" maxlength="10" placeholder="작업 면적을 입력해 주세요">
</div>
<ul class="guide-info">
<li>예 : 180, 6</li>
</ul>
</div>
<div class="select-group">
<div class="select-label">
<p class="label-txt">
단위
</p>
</div>
<div id="areaUnitCode" class="component-select bottom-sheet" data-props-default="단위를 선택해 주세요"
data-props-type="bottomSheet">
<input type="hidden" name="areaUnitCode" th:value="${detail.areaUnitCode}">
<button type="button" class="select-box">
<span class="select-txt"></span>
</button>
<div class="select-options">
<div class="select-header">
<p>단위</p>
<button type="button" class="select-close">
<span class="hide-txt">닫기</span>
</button>
</div>
<div class="select-scroll">
<ul class="">
<li class="option" th:each="uiCode : ${recordUnit}"
th:data-value="${uiCode.id}"
th:text="${uiCode.codeText}"
th:selected="${uiCode.id eq detail.areaUnitCode ? 'current' : ''}"
></li>
</ul>
</div>
</div>
</div>
<div class="component-input" data-option="직접 입력">
<div class="input-field">
<input type="text" id="areaUnitSelf" name="areaUnitSelf" th:value="${detail.areaUnitSelf}" maxlength="30" placeholder="단위를 입력해 주세요">
</div>
</div>
</div>
</section>
<hr>
<section class="form-group">
<div class="component-input">
<div class="input-label">
<label for="harvestQuantity" class="label-txt">
수확량
<i class="ico-required-mark" role="img" aria-label="필수">*</i>
</label>
</div>
<div class="input-field">
<input type="text" id="harvestQuantity" name="harvestQuantity" th:value="${detail.harvestQuantity}" maxlength="10" placeholder="수확량을 입력해 주세요">
</div>
</div>
<div class="select-group">
<div class="select-label">
<p class="label-txt">
단위
</p>
</div>
<div id="harvestUnitCode" class="component-select bottom-sheet" data-props-default="단위를 선택해 주세요"
data-props-type="bottomSheet">
<input type="hidden" name="harvestUnitCode" th:value="${detail.harvestUnitCode}">
<button type="button" class="select-box">
<span class="select-txt"></span>
</button>
<div class="select-options">
<div class="select-header">
<p>단위</p>
<button type="button" class="select-close">
<span class="hide-txt">닫기</span>
</button>
</div>
<div class="select-scroll">
<ul class="">
<li class="option" th:each="uiCode : ${recordUnit}"
th:data-value="${uiCode.id}"
th:text="${uiCode.codeText}"
th:selected="${uiCode.id eq detail.harvestUnitCode ? 'current' : ''}"
></li>
</ul>
</div>
</div>
</div>
<div class="component-input" data-option="직접 입력">
<div class="input-field">
<input type="text" id="harvestUnitSelf" name="harvestUnitSelf" th:value="${detail.harvestUnitSelf}" maxlength="30" placeholder="단위를 입력해 주세요">
</div>
</div>
</div>
</section>
<hr>
<section class="form-group">
<div class="component-segment">
<div class="segment-label">
<p class="label-txt">
노동투입시간 <i class="ico-required-mark" role="img" aria-label="필수">*</i>
</p>
<ul class="guide-info">
<li>'총 시간'을 기입해 주세요. </li>
<li>최소 1개의 항목을 입력해 주세요.</li>
<li>최소 1개의 노동투입시간을 입력해 주세요.</li>
</ul>
</div>
</div>
<div class="component-input type-sub">
<div class="input-label">
<label for="ownerTime" class="label-txt">
경영주
<i class="ico-required-mark" role="img" aria-label="필수">*</i>
</label>
</div>
<div class="input-field type-hour">
<input type="number" inputmode="decimal" pattern="[0-9]*" id="ownerTime" name="ownerTime"
th:value="${detail.ownerTime}" maxlength="10" placeholder="00">
<span class="input-field-txt">시간</span>
</div>
</div>
<div class="component-input type-sub">
<div class="input-label">
<label for="spouseTime" class="label-txt">
배우자
<i class="ico-required-mark" role="img" aria-label="필수">*</i>
</label>
</div>
<div class="input-field type-hour">
<input type="number" inputmode="decimal" pattern="[0-9]*" id="spouseTime" name="spouseTime"
th:value="${detail.spouseTime}" maxlength="10" placeholder="00">
<span class="input-field-txt">시간</span>
</div>
</div>
<div class="input-flex-group">
<div class="input-label">
<label for="familyMHours" class="label-txt">
가족노동
</label>
</div>
<div class="d-flex">
<div class="component-input">
<div class="input-field type-hour">
<span class="input-front-txt">남</span>
<input type="number" inputmode="decimal" pattern="[0-9]*" id="familyMHours" name="familyMHours"
th:value="${detail.familyMHours}" maxlength="10" placeholder="00">
<span class="input-field-txt">시간</span>
</div>
</div>
<div class="component-input">
<div class="input-field type-hour">
<span class="input-front-txt">여</span>
<input type="number" inputmode="decimal" pattern="[0-9]*" id="familyFHours" name="familyFHours"
th:value="${detail.familyFHours}" maxlength="10" placeholder="00">
<span class="input-field-txt">시간</span>
</div>
</div>
</div>
</div>
<div class="input-flex-group">
<div class="input-label">
<label for="hiredMHours" class="label-txt">
고용노동
</label>
</div>
<div class="d-flex">
<div class="component-input">
<div class="input-field type-hour">
<span class="input-front-txt">남</span>
<input type="number" inputmode="decimal" pattern="[0-9]*" id="hiredMHours" name="hiredMHours"
th:value="${detail.hiredMHours}" maxlength="10" placeholder="00">
<span class="input-field-txt">시간</span>
</div>
</div>
<div class="component-input">
<div class="input-field type-hour">
<span class="input-front-txt">여</span>
<input type="number" inputmode="decimal" pattern="[0-9]*" id="hiredFHours" name="hiredFHours"
th:value="${detail.hiredFHours}" maxlength="10" placeholder="00">
<span class="input-field-txt">시간</span>
</div>
</div>
</div>
</div>
<div class="input-flex-group">
<div class="input-label">
<label for="sharedMHours" class="label-txt">
품앗이
</label>
</div>
<div class="d-flex">
<div class="component-input">
<div class="input-field type-hour">
<span class="input-front-txt">남</span>
<input type="number" inputmode="decimal" pattern="[0-9]*" id="sharedMHours" name="sharedMHours"
th:value="${detail.sharedMHours}" maxlength="10" placeholder="00">
<span class="input-field-txt">시간</span>
</div>
</div>
<div class="component-input">
<div class="input-field type-hour">
<span class="input-front-txt">여</span>
<input type="number" inputmode="decimal" pattern="[0-9]*" id="sharedFHours" name="sharedFHours"
th:value="${detail.sharedFHours}" maxlength="10" placeholder="00">
<span class="input-field-txt">시간</span>
</div>
</div>
</div>
</div>
<div class="input-flex-group">
<div class="input-label">
<label for="volunteerMHours" class="label-txt">
일손돕기
</label>
</div>
<div class="d-flex">
<div class="component-input">
<div class="input-field type-hour">
<span class="input-front-txt">남</span>
<input type="number" inputmode="decimal" pattern="[0-9]*" id="volunteerMHours" name="volunteerMHours"
th:value="${detail.volunteerMHours}" maxlength="10" placeholder="00">
<span class="input-field-txt">시간</span>
</div>
</div>
<div class="component-input">
<div class="input-field type-hour">
<span class="input-front-txt">여</span>
<input type="number" inputmode="decimal" pattern="[0-9]*" id="volunteerFHours" name="volunteerFHours"
th:value="${detail.volunteerFHours}" maxlength="10" placeholder="00">
<span class="input-field-txt">시간</span>
</div>
</div>
</div>
</div>
</section>
<div class="component-btns">
<div class="btns-row">
<button type="button" class="btn btn-full btn-l btn-primary" onclick="modalControl.createVaild();">
<span class="btn-txt">등록</span>
</button>
</div>
</div>
</form>
</div>
</th:block>
</html>

View File

@@ -3,30 +3,258 @@
xmlns:th="http://www.thymeleaf.org" lang="ko">
<div layout:fragment="content" th:classappend="acco-wrap">
<th:block th:if="${@systemProperties['spring.profiles.active'] eq 'local'}">
<div>
reqVO: [[${reqVO}]]
</div>
<div>
detail: [[${detail}]]
</div>
</th:block>
<main id="content" role="main">
<div class="inner">
<hgroup class="tit-group">
<h3>
<th:block th:if="${dailyRecord.startDay eq dailyRecord.endDay}">
[[${#temporals.format(dailyRecord.startDate, 'M월 d일')}]], <br>
</th:block>
<th:block th:if="not ${dailyRecord.startDay eq dailyRecord.endDay}">
[[${#temporals.format(dailyRecord.startDate, 'M월 d일')}]]~[[${#temporals.format(dailyRecord.endDate, 'd일')}]], <br>
</th:block>
<strong>임업노동 투입 내역 [[${#lists.isEmpty(workList) ? 0 : #lists.size(workList)}]]건 등록</strong> <br>
되었습니다.
</h3>
<p>임업노동 투입 내역을 등록해 주세요.</p>
</hgroup>
<!--/* 신규 등록 */-->
<th:block th:if="${#lists.isEmpty(workList)}">
<button type="button" class="btn btn-m btn-secondary btn-full button-modal01" data-testid="button-modal01"
th:disabled="${#strings.equals(dailyRecord.workStatus, 'TODAY_NONE')}">
<i class="ico-small" aria-hidden="true"
th:classappend="${#strings.equals(dailyRecord.workStatus, 'TODAY_NONE') ? 'ico-add-disabled' : 'ico-add'}"></i>
<span class="btn-txt">추가 등록</span>
</button>
<div class="component-input align-center">
<label class="checkbox-inner" id="todayNone">
<input type="checkbox" name="todayNone"
data-type="WORK"
th:checked="${#strings.equals(dailyRecord.workStatus, 'TODAY_NONE')}">
<span class="checkbox-item">
<span class="checkbox-txt">금일 등록내용 없음</span>
</span>
</label>
</div>
<ul class="info-bullet-list">
<li>
자가소비용 임산물 및 채취 임산물의 노동 작업도 임업노동 투입내역에 기입해주세요.
</li>
<li>
임산물의 출하준비, 구입, 판매, 기획관리 등의 간접노동도 기입해주세요.
</li>
</ul>
</th:block>
<!--/* 목록 */-->
<th:block th:unless="${#lists.isEmpty(workList)}">
<section class="regist-item-area">
<p class="total">
<span>총 <strong>[[${#lists.size(workList)}]]</strong>건</span>
<button type="button" class="btn-reset" onclick="krip.daily.resetConfirm()">
<i class="ico-reset ico-small" aria-hidden="true"></i>
<span>초기화</span>
</button>
</p>
<div class="item-list">
<div class="list-item"
th:each="item, itemStatus : ${workList}">
<div class="item-tit-group">
<p class="item-name">[[${item.itemName}]]</p>
<div class="btn-group">
<button type="button" class="delete" th:onclick="krip.daily.removeConfirm([[${item.id}]])"><span class="hide-txt">삭제</span></button>
<button type="button" class="edit" th:onclick="krip.daily.createModal([[${item.id}]])"><span class="hide-txt">수정</span></button>
</div>
</div>
<ul class="detail-list">
<li th:if="${not #strings.isEmpty(item.workName)}">
<p>작업명</p>
<span th:text="${item.workName}">수확</span>
</li>
<li th:if="${not #strings.isEmpty(item.workLandArea)}">
<p>작업 면적</p>
<span th:text="|${item.workLandArea}${#strings.defaultString(item.areaUnitLabel,'')}|"></span>
</li>
<li th:if="${not #strings.isEmpty(item.harvestQuantity)}">
<p>수확량</p>
<span th:text="|${item.harvestQuantity}${#strings.defaultString(item.harvestUnitLabel,'')}|"></span>
</li>
<li th:if="${not #strings.isEmpty(item.ownerTime)}">
<p>경영주 노동투입시간</p>
<span th:text="|${item.ownerTime}시간|"></span>
</li>
<li th:if="${not #strings.isEmpty(item.spouseTime)}">
<p>배우자 노동투입시간</p>
<span th:text="|${item.spouseTime}시간|"></span>
</li>
<li th:if="${not #strings.isEmpty(item.familyMHours)}">
<p>가족노동(남)</p>
<span th:text="|${item.familyMHours}시간|"></span>
</li>
<li th:if="${not #strings.isEmpty(item.familyFHours)}">
<p>가족노동(여)</p>
<span th:text="|${item.familyFHours}시간|"></span>
</li>
<li th:if="${not #strings.isEmpty(item.hiredMHours)}">
<p>고용노동(남)</p>
<span th:text="|${item.hiredMHours}시간|"></span>
</li>
<li th:if="${not #strings.isEmpty(item.hiredFHours)}">
<p>고용노동(여)</p>
<span th:text="|${item.hiredFHours}시간|"></span>
</li>
<li th:if="${not #strings.isEmpty(item.sharedMHours)}">
<p>품앗이(남)</p>
<span th:text="|${item.sharedMHours}시간|"></span>
</li>
<li th:if="${not #strings.isEmpty(item.sharedFHours)}">
<p>품앗이(여)</p>
<span th:text="|${item.sharedFHours}시간|"></span>
</li>
<li th:if="${not #strings.isEmpty(item.volunteerMHours)}">
<p>일손돕기(남)</p>
<span th:text="|${item.volunteerMHours}시간|"></span>
</li>
<li th:if="${not #strings.isEmpty(item.volunteerFHours)}">
<p>일손돕기(여)</p>
<span th:text="|${item.volunteerFHours}시간|"></span>
</li>
</ul>
</div>
</div>
<button type="button" class="btn btn-m btn-secondary btn-full button-modal01" data-testid="button-modal01">
<i class="ico-add ico-small" aria-hidden="true"></i>
<span class="btn-txt">추가 등록</span>
</button>
<ul class="info-bullet-list">
<li>
자가소비용 임산물 및 채취 임산물의 노동 작업도 임업노동 투입내역에 기입해주세요.
</li>
<li>
임산물의 출하준비, 구입, 판매, 기획관리 등의 간접노동도 기입해주세요.
</li>
</ul>
</section>
</th:block>
</div>
</main>
<!-- 하단 고정 버튼 -->
<div class="component-btns fixed"
th:if="${moveStep}">
<div class="btns-row">
<button type="button" class="btn btn-l btn-secondary" onclick="krip.daily.goToPrev();">
<span class="btn-txt">이전 단계로 이동</span>
</button>
<button type="button" class="btn btn-l btn-primary"
th:disabled="${not #strings.equals(dailyRecord.workStatus, 'TODAY_NONE') and #lists.isEmpty(workList)}"
th:onclick="krip.daily.goToNext([[${nextStep}]], [[${reqVO.searchMonth}]], [[${reqVO.groupNo}]])">
<span class="btn-txt">다음 단계로 이동</span>
</button>
</div>
</div>
<!-- 모달 팝업 -->
<div class="layer-wrap">
<div class="component-modal acco-wrap formModal" data-props-dimm-click="true">
<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">
<!--/* form */-->
</div>
<button type="button" class="modal-close"></button>
</div>
</div>
</div>
</div>
<!-- //모달 팝업 -->
<!-- /* 건의사항 모달 팝업 */ -->
<th:block th:replace="~{/record/comment-modal}"></th:block>
<!-- /* //건의사항 모달 팝업 */ -->
</div>
<section layout:fragment="script">
<script th:src="@{/static/ui/page/daily-record.js}"></script>
<script th:inline="javascript">
$(function() {
formControl.init();
});
let ENV = {
httpUrl: {
root: /*[[|/record/daily/${reqVO.searchMonth}/${reqVO.groupNo}|]]*/'rootUrl',
root: /*[[|/record/work/${reqVO.searchMonth}/${reqVO.groupNo}|]]*/'rootUrl',
form: /*[[|/record/work/${reqVO.searchMonth}/${reqVO.groupNo}/form/{id}|]]*/'formUrl',
create: /*[[|/api/record/work/${reqVO.searchMonth}/${reqVO.groupNo}/form/{id}|]]*/'createUrl',
remove: /*[[|/api/record/work/${reqVO.searchMonth}/${reqVO.groupNo}/remove|]]*/'removeUrl',
reset: /*[[|/api/record/work/${reqVO.searchMonth}/${reqVO.groupNo}/reset|]]*/'resetUrl',
},
month: [[${reqVO.searchMonth}]],
groupNo: [[${reqVO.groupNo}]],
modal: {
// 등록 버튼
selectorId: '.button-modal01',
// 등록 영역
selector: '.formModal',
},
month: /*[[${reqVO.searchMonth}]]*/'month',
groupNo: /*[[${reqVO.groupNo}]]*/'groupNo',
submitted: false,
};
let formControl = {
init() {
krip.daily.baseBindUI();
},
};
let modalControl = {
_bindModelUI() {
const $select1 = document.querySelector('#areaUnitCode');
const selectboxInstance1 = new etUI.components.SelectBox();
selectboxInstance1.core.init($select1, {
selectItemCallback({selectValue, dataValue}){
console.log('selectItemCallback', selectValue, dataValue)
$('input[name="areaUnitCode"]').val(dataValue)
etUI.pages.initDirectInputToggle();
}
});
const $select2 = document.querySelector('#harvestUnitCode');
const selectboxInstance2 = new etUI.components.SelectBox();
selectboxInstance2.core.init($select2, {
selectItemCallback({selectValue, dataValue}){
console.log('selectItemCallback', selectValue, dataValue)
$('input[name="harvestUnitCode"]').val(dataValue)
etUI.pages.initDirectInputToggle();
}
});
const $formWrap = $(ENV.modal.selector).find('form');
// data set
selectboxInstance1.setValue($formWrap.find('input[name="areaUnitCode"]').val());
selectboxInstance2.setValue($formWrap.find('input[name="harvestUnitCode"]').val());
},
createVaild() {
modalControl.create();
},
create() {
const f = document.reqModalForm;
const obj = $(f).serializeObject();
console.log(obj)
ajaxUtil._ajaxAsync(
ENV.httpUrl.create.replace('{id}', f.id.value ? f.id.value : '0'),
obj,
function (rstData, status) {
location.reload();
},
);
},
};
</script>
</section>