[FO] 일계부 동력 사용시간 CRUD, 일계부 공통 수정
This commit is contained in:
@@ -27,7 +27,7 @@ import java.util.List;
|
||||
@RequestMapping(path = "/record/income")
|
||||
public class DailyIncomeUIController {
|
||||
private final UICodeListPortIn uiCodeListPortIn;
|
||||
private final DailyRecordPortIn dailyRecordService;
|
||||
private final DailyRecordPortIn dailyRecordPortIn;
|
||||
private final DailyIncomePortIn dailyIncomePortIn;
|
||||
|
||||
/**
|
||||
@@ -37,7 +37,6 @@ public class DailyIncomeUIController {
|
||||
* @param searchMonth 검색 월(yyyyMM)
|
||||
* @param groupNo 검색 그룹
|
||||
* @param searchType 수정여부
|
||||
* @return
|
||||
*/
|
||||
@GetMapping(path = "/{searchMonth}/{groupNo}")
|
||||
public String index(Model model, @PathVariable("searchMonth") String searchMonth, @PathVariable("groupNo") String groupNo
|
||||
@@ -66,7 +65,6 @@ public class DailyIncomeUIController {
|
||||
* @param searchMonth 검색 월(yyyyMM)
|
||||
* @param groupNo 검색 그룹
|
||||
* @param id 수입 일련번호
|
||||
* @return
|
||||
*/
|
||||
@GetMapping(path = "/{searchMonth}/{groupNo}/form/{id}")
|
||||
public String formBySelf(Model model, @PathVariable("searchMonth") String searchMonth, @PathVariable("groupNo") String groupNo
|
||||
@@ -102,13 +100,12 @@ public class DailyIncomeUIController {
|
||||
*
|
||||
* @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 = dailyRecordService.detail(reqVO);
|
||||
DailyRecordDto dailyRecord = dailyRecordPortIn.detail(reqVO);
|
||||
if (dailyRecord == null || dailyRecord.getId() == null) {
|
||||
throw new NoRecordDataException();
|
||||
}
|
||||
|
||||
@@ -0,0 +1,50 @@
|
||||
package app.module.front.usecase.daily.power.adapters.persistence;
|
||||
|
||||
import app.module.core.usecase.uicode.list.ports.UICodeListPortIn;
|
||||
import app.module.front.usecase.daily.power.adapters.persistence.model.DailyPowerDto;
|
||||
import app.module.front.usecase.daily.power.ports.DailyPowerPortOut;
|
||||
import app.module.front.usecase.daily.power.ports.application.domain.CreateDailyPowerCmd;
|
||||
import app.module.front.usecase.daily.power.ports.application.domain.GetDailyPowerCmd;
|
||||
import app.module.front.usecase.daily.power.ports.application.domain.RemoveDailyPowerCmd;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Slf4j
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class DailyPowerDao implements DailyPowerPortOut {
|
||||
private final UICodeListPortIn uiCodeListPortIn;
|
||||
private final DailyPowerMapper dailyPowerMapper;
|
||||
|
||||
@Override
|
||||
public List<DailyPowerDto> list(GetDailyPowerCmd command) {
|
||||
return dailyPowerMapper.getDailyPowerList(command);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void create(GetDailyPowerCmd findCmd, CreateDailyPowerCmd command) {
|
||||
Integer existCount = dailyPowerMapper.getRecordExistCount(findCmd);
|
||||
if (existCount == 0) {
|
||||
dailyPowerMapper.createDailyPower(command);
|
||||
|
||||
log.debug("[CreateDailyPower] record={}", command);
|
||||
} else {
|
||||
dailyPowerMapper.updateDailyPower(command);
|
||||
|
||||
log.debug("[UpdateDailyPower] record={}", command);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void remove(GetDailyPowerCmd findCmd, RemoveDailyPowerCmd command) {
|
||||
Integer existCount = dailyPowerMapper.getRecordExistCount(findCmd);
|
||||
if (existCount != 0) {
|
||||
dailyPowerMapper.removeDailyPower(command);
|
||||
|
||||
log.debug("[RemoveDailyPower] record={}", command);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
package app.module.front.usecase.daily.power.adapters.persistence;
|
||||
|
||||
import app.module.front.usecase.daily.power.ports.application.domain.CreateDailyPowerCmd;
|
||||
import app.module.front.usecase.daily.power.adapters.persistence.model.DailyPowerDto;
|
||||
import app.module.front.usecase.daily.power.ports.application.domain.GetDailyPowerCmd;
|
||||
import app.module.front.usecase.daily.power.ports.application.domain.RemoveDailyPowerCmd;
|
||||
import app.module.front.usecase.daily.power.adapters.web.model.DailyPowerUIReqVO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Mapper
|
||||
public interface DailyPowerMapper {
|
||||
/**
|
||||
* 일계부 동력 사용시간 목록 조회
|
||||
*
|
||||
* @param command 검색 조건
|
||||
* @return 동력 사용시간 목록
|
||||
*/
|
||||
List<DailyPowerDto> getDailyPowerList(GetDailyPowerCmd command);
|
||||
|
||||
/**
|
||||
* 일계부 동력 사용시간 데이터 존재 여부
|
||||
*
|
||||
* @param command 검색 조건
|
||||
* @return 중복 개수
|
||||
*/
|
||||
Integer getRecordExistCount(GetDailyPowerCmd command);
|
||||
|
||||
/**
|
||||
* 일계부 동력 사용시간 등록
|
||||
*
|
||||
* @param command 등록 데이터
|
||||
*/
|
||||
void createDailyPower(CreateDailyPowerCmd command);
|
||||
|
||||
/**
|
||||
* 일계부 동력 사용시간 수정
|
||||
*
|
||||
* @param command 수정 데이터
|
||||
*/
|
||||
void updateDailyPower(CreateDailyPowerCmd command);
|
||||
|
||||
/**
|
||||
* 일계부 동력 사용시간 삭제
|
||||
*
|
||||
* @param command 삭제 데이터
|
||||
*/
|
||||
void removeDailyPower(RemoveDailyPowerCmd command);
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
package app.module.front.usecase.daily.power.adapters.persistence.model;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
public class DailyPowerDto {
|
||||
private Long id;
|
||||
private Long dailyRecordSeq;
|
||||
private String equipmentName;
|
||||
private Integer ownedHours;
|
||||
private Integer leasedHours;
|
||||
|
||||
/**
|
||||
* 수정 가능 여부
|
||||
* @return true=가능, false=불가능(등록 상태)
|
||||
*/
|
||||
public boolean isUpdated() {
|
||||
return this.id != null && this.id != 0L;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,131 @@
|
||||
package app.module.front.usecase.daily.power.adapters.web;
|
||||
|
||||
import app.module.core.config.application.exception.NoRecordDataException;
|
||||
import app.module.core.config.application.util.CoreUtil;
|
||||
import app.module.front.usecase.daily.power.adapters.web.model.CreateDailyPowerReqVO;
|
||||
import app.module.front.usecase.daily.power.adapters.web.model.RemoveDailyPowerReqVO;
|
||||
import app.module.front.usecase.daily.power.adapters.web.validator.CreateDailyPowerValidator;
|
||||
import app.module.front.usecase.daily.power.ports.DailyPowerPortIn;
|
||||
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 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/power")
|
||||
public class DailyPowerController {
|
||||
private final CoreUtil coreUtil;
|
||||
private final DailyRecordPortIn dailyRecordService;
|
||||
private final DailyPowerPortIn dailyPowerService;
|
||||
private final CreateDailyPowerValidator createDailyPowerValidator;
|
||||
|
||||
/**
|
||||
* 일계부 동력 사용시간 등록 처리
|
||||
*
|
||||
* @param searchMonth 검색 월(yyyyMM)
|
||||
* @param groupNo 검색 그룹
|
||||
* @param id 수입 일련번호
|
||||
* @param formVO 입력 데이터
|
||||
* @param bindingResult BindingResult
|
||||
*/
|
||||
@PostMapping(path = "/{searchMonth}/{groupNo}/form/{id}")
|
||||
ResponseEntity<?> create(@PathVariable("searchMonth") String searchMonth, @PathVariable("groupNo") String groupNo
|
||||
, @PathVariable("id") String id
|
||||
, @Valid @RequestBody CreateDailyPowerReqVO formVO, BindingResult bindingResult) {
|
||||
|
||||
createDailyPowerValidator.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);
|
||||
|
||||
dailyPowerService.create(formVO);
|
||||
|
||||
return ResponseEntity.status(HttpStatus.OK).body(formVO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 일계부 동력 사용시간 삭제 처리
|
||||
*
|
||||
* @param searchMonth 검색 월(yyyyMM)
|
||||
* @param groupNo 검색 그룹
|
||||
* @param formVO 입력 데이터
|
||||
* @param bindingResult BindingResult
|
||||
*/
|
||||
@PostMapping(path = "/{searchMonth}/{groupNo}/remove")
|
||||
ResponseEntity<?> remove(@PathVariable("searchMonth") String searchMonth, @PathVariable("groupNo") String groupNo
|
||||
, @Valid @RequestBody RemoveDailyPowerReqVO 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);
|
||||
|
||||
dailyPowerService.remove(formVO);
|
||||
|
||||
return ResponseEntity.status(HttpStatus.OK).body(formVO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 일계부 동력 사용시간 전체 삭제 처리
|
||||
*
|
||||
* @param searchMonth 검색 월(yyyyMM)
|
||||
* @param groupNo 검색 그룹
|
||||
*/
|
||||
@PostMapping(path = "/{searchMonth}/{groupNo}/reset")
|
||||
ResponseEntity<?> removeAll(@PathVariable("searchMonth") String searchMonth, @PathVariable("groupNo") String groupNo) {
|
||||
|
||||
DailyRecordDto dailyRecord = this.vaildGetDailyRecord(searchMonth, groupNo);
|
||||
|
||||
RemoveDailyPowerReqVO formVO = new RemoveDailyPowerReqVO();
|
||||
formVO.setSearchMonth(dailyRecord.getRecordMonth());
|
||||
formVO.setGroupNo(dailyRecord.getGroupNo());
|
||||
formVO.setDailyRecordSeq(dailyRecord.getId());
|
||||
log.debug("formVO: {}", formVO);
|
||||
|
||||
dailyPowerService.remove(formVO);
|
||||
|
||||
return ResponseEntity.status(HttpStatus.OK).body(formVO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 일계부 유효성 체크 및 데이터 조회
|
||||
*
|
||||
* @param searchMonth 검색 월(yyyyMM)
|
||||
* @param groupNo 검색 그룹
|
||||
*/
|
||||
private DailyRecordDto vaildGetDailyRecord(String searchMonth, String groupNo) {
|
||||
DailyUIReqVO reqVO = new DailyUIReqVO(searchMonth, groupNo);
|
||||
log.debug("getRecordUIReq: {}", reqVO);
|
||||
|
||||
DailyRecordDto dailyRecord = dailyRecordService.detail(reqVO);
|
||||
if (dailyRecord == null || dailyRecord.getId() == null) {
|
||||
throw new NoRecordDataException();
|
||||
}
|
||||
|
||||
return dailyRecord;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,110 @@
|
||||
package app.module.front.usecase.daily.power.adapters.web;
|
||||
|
||||
import app.module.core.config.application.exception.NoRecordDataException;
|
||||
import app.module.front.usecase.daily.power.adapters.persistence.model.DailyPowerDto;
|
||||
import app.module.front.usecase.daily.power.adapters.web.model.DailyPowerUIReqVO;
|
||||
import app.module.front.usecase.daily.power.ports.DailyPowerPortIn;
|
||||
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 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/power")
|
||||
public class DailyPowerUIController {
|
||||
private final DailyRecordPortIn dailyRecordPortIn;
|
||||
private final DailyPowerPortIn dailyPowerPortIn;
|
||||
|
||||
/**
|
||||
* 일계부 동력 사용시간 목록 화면
|
||||
*
|
||||
* @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);
|
||||
|
||||
DailyPowerUIReqVO reqVO = new DailyPowerUIReqVO(searchMonth, groupNo);
|
||||
log.debug("reqVO: {}", reqVO);
|
||||
|
||||
List<DailyPowerDto> powerList = dailyPowerPortIn.list(reqVO);
|
||||
|
||||
model.addAttribute("reqVO", reqVO);
|
||||
model.addAttribute("dailyRecord", dailyRecord);
|
||||
model.addAttribute("powerList", powerList);
|
||||
model.addAttribute("moveStep", !"update".equals(searchType));
|
||||
model.addAttribute("nextStep", dailyRecord.getNextStep(DailySort.POWER));
|
||||
|
||||
return "record/power/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) {
|
||||
|
||||
DailyPowerUIReqVO reqVO = new DailyPowerUIReqVO(searchMonth, groupNo);
|
||||
if (StringUtils.isEmpty(id)) {
|
||||
reqVO.setId(0L);
|
||||
} else {
|
||||
reqVO.setId(Long.parseLong(id));
|
||||
}
|
||||
log.debug("reqVO: {}", reqVO);
|
||||
|
||||
DailyPowerDto detail = new DailyPowerDto();
|
||||
if (reqVO.getId() != 0L) {
|
||||
detail = dailyPowerPortIn.detail(reqVO);
|
||||
if (detail == null || !detail.isUpdated()) {
|
||||
throw new NoRecordDataException();
|
||||
}
|
||||
}
|
||||
|
||||
model.addAttribute("reqVO", reqVO);
|
||||
model.addAttribute("detail", detail);
|
||||
|
||||
return "record/power/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;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
package app.module.front.usecase.daily.power.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 CreateDailyPowerReqVO extends DailyUIReqVO {
|
||||
/**
|
||||
* 동력 사용시간 일련번호
|
||||
*/
|
||||
private Long id;
|
||||
/**
|
||||
* 일계부 일련번호
|
||||
*/
|
||||
private Long dailyRecordSeq;
|
||||
|
||||
/**
|
||||
* 명칭
|
||||
*/
|
||||
@NotBlank(message = "사용 기계 이름을 입력해 주세요.")
|
||||
private String equipmentName;
|
||||
/**
|
||||
* 자가 사용시간
|
||||
*/
|
||||
private Integer ownedHours;
|
||||
/**
|
||||
* 임차 사용시간
|
||||
*/
|
||||
private Integer leasedHours;
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
package app.module.front.usecase.daily.power.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 DailyPowerUIReqVO extends DailyUIReqVO {
|
||||
public DailyPowerUIReqVO(String month, String no) {
|
||||
setSearchMonth(month);
|
||||
if (!StringUtils.isBlank(no)) {
|
||||
setGroupNo(Integer.parseInt(no));
|
||||
}
|
||||
}
|
||||
|
||||
public DailyPowerUIReqVO(String month, Integer no) {
|
||||
setSearchMonth(month);
|
||||
setGroupNo(no);
|
||||
}
|
||||
|
||||
/**
|
||||
* 수입 일련번호
|
||||
*/
|
||||
private Long id;
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
package app.module.front.usecase.daily.power.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 RemoveDailyPowerReqVO extends DailyUIReqVO {
|
||||
/**
|
||||
* 수입 일련번호
|
||||
*/
|
||||
@NotBlank(message = "{valid.common.required}")
|
||||
private String id;
|
||||
/**
|
||||
* 일계부 일련번호
|
||||
*/
|
||||
private Long dailyRecordSeq;
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
package app.module.front.usecase.daily.power.adapters.web.validator;
|
||||
|
||||
import app.module.front.usecase.daily.power.adapters.web.model.CreateDailyPowerReqVO;
|
||||
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 CreateDailyPowerValidator implements Validator {
|
||||
|
||||
@Override
|
||||
public boolean supports(Class<?> clazz) {
|
||||
return CreateDailyPowerReqVO.class.equals(clazz);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void validate(Object target, Errors errors) {
|
||||
CreateDailyPowerReqVO vo = (CreateDailyPowerReqVO) target;
|
||||
|
||||
if (vo.getOwnedHours() == null && vo.getLeasedHours() == null) {
|
||||
errors.rejectValue(
|
||||
"ownedHours", "valid.common.required",
|
||||
"자가 또는 임차 사용시간을 입력 해주세요.");
|
||||
errors.rejectValue(
|
||||
"leasedHours", "valid.common.required",
|
||||
"자가 또는 임차 사용시간을 입력 해주세요.");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
package app.module.front.usecase.daily.power.ports;
|
||||
|
||||
|
||||
import app.module.front.usecase.daily.power.adapters.persistence.model.DailyPowerDto;
|
||||
import app.module.front.usecase.daily.power.adapters.web.model.CreateDailyPowerReqVO;
|
||||
import app.module.front.usecase.daily.power.adapters.web.model.DailyPowerUIReqVO;
|
||||
import app.module.front.usecase.daily.power.adapters.web.model.RemoveDailyPowerReqVO;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface DailyPowerPortIn {
|
||||
/**
|
||||
* 일계부 동력 사용시간 조회
|
||||
*
|
||||
* @param reqVO 검색 조건
|
||||
* @return 동력 사용시간 목록
|
||||
*/
|
||||
List<DailyPowerDto> list(DailyPowerUIReqVO reqVO);
|
||||
|
||||
/**
|
||||
* 일계부 동력 사용시간 조회
|
||||
*
|
||||
* @param reqVO 검색 조건
|
||||
* @return 동력 사용시간 상세
|
||||
*/
|
||||
DailyPowerDto detail(DailyPowerUIReqVO reqVO);
|
||||
|
||||
/**
|
||||
* 일계부 동력 사용시간 등록
|
||||
*
|
||||
* @param formVO 입력 데이터
|
||||
*/
|
||||
void create(CreateDailyPowerReqVO formVO);
|
||||
|
||||
/**
|
||||
* 일계부 동력 사용시간 삭제
|
||||
*
|
||||
* @param formVO 삭제 검색 조건
|
||||
*/
|
||||
void remove(RemoveDailyPowerReqVO formVO);
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
package app.module.front.usecase.daily.power.ports;
|
||||
|
||||
|
||||
import app.module.front.usecase.daily.power.adapters.persistence.model.DailyPowerDto;
|
||||
import app.module.front.usecase.daily.power.ports.application.domain.CreateDailyPowerCmd;
|
||||
import app.module.front.usecase.daily.power.ports.application.domain.GetDailyPowerCmd;
|
||||
import app.module.front.usecase.daily.power.ports.application.domain.RemoveDailyPowerCmd;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface DailyPowerPortOut {
|
||||
/**
|
||||
* 일계부 동력 사용시간 조회
|
||||
*
|
||||
* @param command 검색 조건
|
||||
* @return 동력 사용시간 목록
|
||||
*/
|
||||
List<DailyPowerDto> list(GetDailyPowerCmd command);
|
||||
|
||||
/**
|
||||
* 일계부 동력 사용시간 등록
|
||||
*
|
||||
* @param findCmd 검색 조건
|
||||
* @param command 입력 데이터
|
||||
*/
|
||||
void create(GetDailyPowerCmd findCmd, CreateDailyPowerCmd command);
|
||||
|
||||
/**
|
||||
* 일계부 동력 사용시간 삭제
|
||||
*
|
||||
* @param findCmd 검색 조건
|
||||
* @param command 삭제 검색 조건
|
||||
*/
|
||||
void remove(GetDailyPowerCmd findCmd, RemoveDailyPowerCmd command);
|
||||
}
|
||||
@@ -0,0 +1,98 @@
|
||||
package app.module.front.usecase.daily.power.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.usecase.daily.income.adapters.persistence.model.DailyIncomeDto;
|
||||
import app.module.front.usecase.daily.income.ports.application.domain.CreateDailyIncomeCmd;
|
||||
import app.module.front.usecase.daily.income.ports.application.domain.GetDailyIncomeCmd;
|
||||
import app.module.front.usecase.daily.income.ports.application.domain.RemoveDailyIncomeCmd;
|
||||
import app.module.front.usecase.daily.power.adapters.persistence.model.DailyPowerDto;
|
||||
import app.module.front.usecase.daily.power.adapters.web.model.CreateDailyPowerReqVO;
|
||||
import app.module.front.usecase.daily.power.adapters.web.model.DailyPowerUIReqVO;
|
||||
import app.module.front.usecase.daily.power.adapters.web.model.RemoveDailyPowerReqVO;
|
||||
import app.module.front.usecase.daily.power.ports.DailyPowerPortIn;
|
||||
import app.module.front.usecase.daily.power.ports.DailyPowerPortOut;
|
||||
import app.module.front.usecase.daily.power.ports.application.domain.CreateDailyPowerCmd;
|
||||
import app.module.front.usecase.daily.power.ports.application.domain.GetDailyPowerCmd;
|
||||
import app.module.front.usecase.daily.power.ports.application.domain.RemoveDailyPowerCmd;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class DailyPowerService implements DailyPowerPortIn {
|
||||
private final DailyPowerPortOut portOut;
|
||||
private final UICodeListPortIn uiCodeListPortIn;
|
||||
|
||||
@Override
|
||||
public List<DailyPowerDto> list(DailyPowerUIReqVO reqVO) {
|
||||
return this.getRefineList(reqVO);
|
||||
}
|
||||
|
||||
@Override
|
||||
public DailyPowerDto detail(DailyPowerUIReqVO reqVO) {
|
||||
List<DailyPowerDto> list = this.getRefineList(reqVO);
|
||||
if (list.isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return list.get(0);
|
||||
}
|
||||
|
||||
/**
|
||||
* 목록 데이터 조회
|
||||
*
|
||||
* @param reqVO 검색 조건
|
||||
* @return 공통 처리된 목록
|
||||
*/
|
||||
private List<DailyPowerDto> getRefineList(DailyPowerUIReqVO reqVO) {
|
||||
return portOut.list(new GetDailyPowerCmd(reqVO.getSearchMonth(),
|
||||
reqVO.getGroupNo(),
|
||||
reqVO.getHouseholdSeq(),
|
||||
reqVO.getId()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void create(CreateDailyPowerReqVO formVO) {
|
||||
GetDailyPowerCmd findCmd = new GetDailyPowerCmd(
|
||||
formVO.getSearchMonth(),
|
||||
formVO.getGroupNo(),
|
||||
formVO.getHouseholdSeq(),
|
||||
formVO.getId());
|
||||
|
||||
CreateDailyPowerCmd command = AuditUtil.create(
|
||||
new CreateDailyPowerCmd(
|
||||
formVO.getId(),
|
||||
formVO.getDailyRecordSeq(),
|
||||
null,
|
||||
null,
|
||||
formVO.getEquipmentName(),
|
||||
formVO.getOwnedHours(),
|
||||
formVO.getLeasedHours()));
|
||||
|
||||
portOut.create(findCmd, command);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void remove(RemoveDailyPowerReqVO formVO) {
|
||||
Long id = formVO.getId() != null ? Long.parseLong(formVO.getId()) : null;
|
||||
|
||||
GetDailyPowerCmd findCmd = new GetDailyPowerCmd(
|
||||
formVO.getSearchMonth(),
|
||||
formVO.getGroupNo(),
|
||||
formVO.getHouseholdSeq(),
|
||||
id);
|
||||
|
||||
RemoveDailyPowerCmd command = AuditUtil.delete(
|
||||
new RemoveDailyPowerCmd(
|
||||
formVO.getSearchMonth(),
|
||||
formVO.getGroupNo(),
|
||||
id,
|
||||
formVO.getDailyRecordSeq()));
|
||||
|
||||
portOut.remove(findCmd, command);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
package app.module.front.usecase.daily.power.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 CreateDailyPowerCmd extends FrontAuditCommand {
|
||||
private Long id;
|
||||
private Long dailyRecordSeq;
|
||||
private String incomeMark;
|
||||
private String expenseMark;
|
||||
private String equipmentName;
|
||||
private Integer ownedHours;
|
||||
private Integer leasedHours;
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
package app.module.front.usecase.daily.power.ports.application.domain;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@AllArgsConstructor
|
||||
public class GetDailyPowerCmd {
|
||||
/**
|
||||
* 검색 월(yyyyMM)
|
||||
*/
|
||||
private String searchMonth;
|
||||
/**
|
||||
* 검색 그룸번호
|
||||
*/
|
||||
private Integer groupNo;
|
||||
/**
|
||||
* 임가 일련번호
|
||||
*/
|
||||
private Long householdSeq;
|
||||
/**
|
||||
* 동력 사용시간 일련번호
|
||||
*/
|
||||
private Long id;
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
package app.module.front.usecase.daily.power.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 RemoveDailyPowerCmd extends FrontAuditCommand {
|
||||
private String searchMonth;
|
||||
private Integer groupNo;
|
||||
private Long id;
|
||||
private Long dailyRecordSeq;
|
||||
}
|
||||
@@ -52,10 +52,6 @@ public class DailyRecordDto {
|
||||
}
|
||||
}
|
||||
|
||||
if (returnValue == null) {
|
||||
returnValue = "LAST";
|
||||
}
|
||||
|
||||
return returnValue;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,13 @@
|
||||
package app.module.front.usecase.daily.record.adapters.web;
|
||||
|
||||
import app.module.core.config.application.exception.NoMatchingURIException;
|
||||
import app.module.front.usecase.daily.expense.adapters.web.model.DailyExpenseUIReqVO;
|
||||
import app.module.front.usecase.daily.expense.ports.DailyExpensePortIn;
|
||||
import app.module.front.usecase.daily.income.adapters.persistence.model.DailyIncomeDto;
|
||||
import app.module.front.usecase.daily.income.adapters.web.model.DailyIncomeUIReqVO;
|
||||
import app.module.front.usecase.daily.income.ports.DailyIncomePortIn;
|
||||
import app.module.front.usecase.daily.power.adapters.web.model.DailyPowerUIReqVO;
|
||||
import app.module.front.usecase.daily.power.ports.DailyPowerPortIn;
|
||||
import app.module.front.usecase.daily.record.adapters.persistence.model.DailyRecordDto;
|
||||
import app.module.front.usecase.daily.record.adapters.web.model.DailyStatus;
|
||||
import app.module.front.usecase.daily.record.adapters.web.model.DailyUIReqVO;
|
||||
@@ -14,13 +21,17 @@ import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Slf4j
|
||||
@Controller
|
||||
@RequiredArgsConstructor
|
||||
@RequestMapping(path = "/record/daily")
|
||||
public class DailyRecordUIController {
|
||||
private final DailyRecordPortIn dailyRecordPortIn;
|
||||
private final CreateDailyRecordValidator createDailyRecordValidator;
|
||||
private final DailyIncomePortIn dailyIncomePortIn;
|
||||
private final DailyExpensePortIn dailyExpensePortIn;
|
||||
private final DailyPowerPortIn dailyPowerPortIn;
|
||||
|
||||
/**
|
||||
* 일계부 항목 등록 화면
|
||||
@@ -69,6 +80,13 @@ public class DailyRecordUIController {
|
||||
String modelAndView = "record/daily/done";
|
||||
if (DailyStatus.TODAY_NONE.equals(dailyRecord.getAllStatus())) {
|
||||
modelAndView = "record/daily/finish";
|
||||
} else {
|
||||
model.addAttribute("incomeList", dailyIncomePortIn.list(new DailyIncomeUIReqVO(searchMonth, groupNo)));
|
||||
model.addAttribute("expenseList", dailyExpensePortIn.list(new DailyExpenseUIReqVO(searchMonth, groupNo)));
|
||||
model.addAttribute("workList", null); // TODO
|
||||
model.addAttribute("powerList", dailyPowerPortIn.list(new DailyPowerUIReqVO(searchMonth, groupNo)));
|
||||
model.addAttribute("forestryList", null); // TODO
|
||||
model.addAttribute("farmingList", null); // TODO
|
||||
}
|
||||
|
||||
model.addAttribute("reqVO", reqVO);
|
||||
|
||||
63
front/src/main/resources/mappers/daily/DailyPowerMapper.xml
Normal file
63
front/src/main/resources/mappers/daily/DailyPowerMapper.xml
Normal file
@@ -0,0 +1,63 @@
|
||||
<?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.power.adapters.persistence.DailyPowerMapper">
|
||||
|
||||
<select id="getDailyPowerList"
|
||||
resultType="app.module.front.usecase.daily.power.adapters.persistence.model.DailyPowerDto">
|
||||
select ds.id, ds.daily_record_seq
|
||||
, ds.equipment_name, ds.owned_hours, ds.leased_hours
|
||||
from daily_power 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_power 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="createDailyPower" useGeneratedKeys="true" keyProperty="id">
|
||||
insert into daily_power (
|
||||
daily_record_seq
|
||||
, equipment_name, owned_hours, leased_hours
|
||||
, is_deleted
|
||||
, <include refid="common.fields.CreateUpdateBaseColumns"/>
|
||||
) values (
|
||||
#{dailyRecordSeq}
|
||||
, #{equipmentName}, #{ownedHours}, #{leasedHours}
|
||||
, false
|
||||
, <include refid="common.fields.CreateUpdateBaseValues"/>
|
||||
)
|
||||
</insert>
|
||||
|
||||
<update id="updateDailyPower">
|
||||
update daily_power set <include refid="common.fields.UpdateBaseSet"/>
|
||||
, equipment_name = #{equipmentName}
|
||||
, owned_hours = #{ownedHours}
|
||||
, leased_hours = #{leasedHours}
|
||||
where is_deleted = false
|
||||
and daily_record_seq = #{dailyRecordSeq}
|
||||
and id = #{id}
|
||||
</update>
|
||||
|
||||
<update id="removeDailyPower">
|
||||
update daily_power 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>
|
||||
@@ -28,6 +28,15 @@ krip.daily.goToPrev = function() {
|
||||
* @param groupNo
|
||||
*/
|
||||
krip.daily.goToNext = function(target, searchMonth, groupNo) {
|
||||
if (target == null) {
|
||||
if ($('._nextStep').data('last')) {
|
||||
target = 'LAST';
|
||||
} else {
|
||||
krip.daily.goToDone(searchMonth, groupNo);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (target === 'LAST') {
|
||||
// 임가 건의사항 팝업
|
||||
const commentModal = document.querySelector('.commentModal').ui;
|
||||
@@ -231,7 +240,7 @@ krip.daily.createComment = function(month, groupNo) {
|
||||
const f = document.commentReqForm;
|
||||
|
||||
const obj = $(f).serializeObject();
|
||||
console.log(obj)
|
||||
console.log(obj, month, groupNo)
|
||||
if (f.content.value === '') {
|
||||
krip.daily.goToDone(month, groupNo);
|
||||
return;
|
||||
|
||||
@@ -12,26 +12,140 @@
|
||||
</div>
|
||||
</th:block>
|
||||
<main id="content" role="main">
|
||||
일계부 등록이
|
||||
모두 완료 되었습니다.
|
||||
<div class="inner">
|
||||
<hgroup class="tit-group">
|
||||
<i class="ico-alert-lightgreen ico-xlarge" aria-hidden="true"></i>
|
||||
<h3>
|
||||
일계부 등록이 <br>
|
||||
모두 완료 되었습니다.
|
||||
</h3>
|
||||
<p>
|
||||
입력하신 내용은 자동으로 등록되었습니다. <br>
|
||||
항목에 대한 '추가/수정/삭제'는 일계부에서 가능합니다.
|
||||
</p>
|
||||
</hgroup>
|
||||
|
||||
<section class="regist-item-area complete">
|
||||
<div class="item-list">
|
||||
<div class="list-item"
|
||||
th:each="item, itemStatus : ${dailyRecord.targetList}"
|
||||
th:classappend="${(item.name eq 'INCOME' && #lists.isEmpty(incomeList))
|
||||
|| (item.name eq 'EXPENSE' && #lists.isEmpty(expenseList))
|
||||
|| (item.name eq 'POWER' && #lists.isEmpty(powerList))} ? 'no-data'"
|
||||
>
|
||||
<div class="item-tit-group">
|
||||
<p class="item-name">[[${item.desc}]]</p>
|
||||
</div>
|
||||
<!--/* 수입 */-->
|
||||
<ul class="detail-list"
|
||||
th:if="${item.name eq 'INCOME'}"
|
||||
>
|
||||
<th:block th:if="${#lists.isEmpty(incomeList)}">
|
||||
<li>
|
||||
<p>없음</p>
|
||||
</li>
|
||||
</th:block>
|
||||
<th:block th:each="child, childStatus : ${incomeList}">
|
||||
<li>
|
||||
<p>[[${child.categorySelf}]]</p>
|
||||
<span th:if="${not #strings.isEmpty(child.price)}"
|
||||
th:text="|${#numbers.formatInteger(child.price, 1, 'COMMA')}원|">302,000원</span>
|
||||
<span th:if="${not #strings.isEmpty(child.estimatedValue)}"
|
||||
th:text="|${#numbers.formatInteger(child.estimatedValue, 1, 'COMMA')}원|">302,000원</span>
|
||||
</li>
|
||||
</th:block>
|
||||
</ul>
|
||||
<!--/* 지출 */-->
|
||||
<ul class="detail-list"
|
||||
th:if="${item.name eq 'EXPENSE'}"
|
||||
>
|
||||
<th:block th:if="${#strings.isEmpty(expenseList)}">
|
||||
<li>
|
||||
<p>없음</p>
|
||||
</li>
|
||||
</th:block>
|
||||
<th:block th:each="child, childStatus : ${expenseList}">
|
||||
<li>
|
||||
<p>[[${child.categorySelf}]]</p>
|
||||
<span th:if="${not #strings.isEmpty(child.price)}"
|
||||
th:text="|${#numbers.formatInteger(child.price, 1, 'COMMA')}원|">302,000원</span>
|
||||
<span th:if="${not #strings.isEmpty(child.estimatedValue)}"
|
||||
th:text="|${#numbers.formatInteger(child.estimatedValue, 1, 'COMMA')}원|">302,000원</span>
|
||||
</li>
|
||||
</th:block>
|
||||
</ul>
|
||||
<!--/* TODO 임업노동 투입 */-->
|
||||
<!--/*<ul class="detail-list"
|
||||
th:if="${item.name eq 'WORK'}"
|
||||
>
|
||||
<th:block th:if="${#strings.isEmpty(workList)}">
|
||||
<li>
|
||||
<p>없음</p>
|
||||
</li>
|
||||
</th:block>
|
||||
<th:block th:each="child, childStatus : ${workList}">
|
||||
<li>
|
||||
<p>호두</p>
|
||||
<span>
|
||||
<span>수확</span>
|
||||
<span>총 23시간</span>
|
||||
</span>
|
||||
</li>
|
||||
<li>
|
||||
<p>밤</p>
|
||||
<span>
|
||||
<span>줍기</span>
|
||||
<span>총 12시간</span>
|
||||
</span>
|
||||
</li>
|
||||
<li>
|
||||
<p>밤</p>
|
||||
<span>
|
||||
<span>선별</span>
|
||||
<span>총 2시간</span>
|
||||
</span>
|
||||
</li>
|
||||
</th:block>
|
||||
</ul>*/-->
|
||||
<!--/* 동력 사용시간 */-->
|
||||
<ul class="detail-list"
|
||||
th:if="${item.name eq 'POWER'}"
|
||||
>
|
||||
<th:block th:if="${#strings.isEmpty(powerList)}">
|
||||
<li>
|
||||
<p>없음</p>
|
||||
</li>
|
||||
</th:block>
|
||||
<th:block th:each="child, childStatus : ${powerList}">
|
||||
<li>
|
||||
<p>[[${child.equipmentName}]]</p>
|
||||
<span th:if="${not #strings.isEmpty(child.ownedHours)}"
|
||||
th:text="|총${#numbers.formatInteger(child.ownedHours, 1, 'COMMA')}시간|">총8시간</span>
|
||||
<span th:if="${not #strings.isEmpty(child.leasedHours)}"
|
||||
th:text="|총${#numbers.formatInteger(child.leasedHours, 1, 'COMMA')}시간|">총8시간</span>
|
||||
</li>
|
||||
</th:block>
|
||||
</ul>
|
||||
<!--/* TODO 임업생산물 중 자가소비량 */-->
|
||||
<!--/* TODO 농업생산물 중 자가소비량 */-->
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
</div>
|
||||
</main>
|
||||
|
||||
<div class="component-btns fixed">
|
||||
<div class="btns-row">
|
||||
<button type="button" class="btn btn-l btn-primary" onclick="krip.daily.goToMain();">
|
||||
<span class="btn-txt">확인</span>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<section layout:fragment="script">
|
||||
<script th:src="@{/static/ui/page/daily-record.js}"></script>
|
||||
<script th:inline="javascript">
|
||||
let ENV = {
|
||||
httpUrl: {
|
||||
create: /*[[|/api/record/daily/${reqVO.searchMonth}/${reqVO.groupNo}|]]*/'createUrl',
|
||||
},
|
||||
month: [[${reqVO.searchMonth}]],
|
||||
groupNo: [[${reqVO.groupNo}]],
|
||||
submitted: false,
|
||||
};
|
||||
|
||||
let formControl = {
|
||||
};
|
||||
</script>
|
||||
</section>
|
||||
|
||||
</html>
|
||||
@@ -30,56 +30,6 @@
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="list-item no-data">
|
||||
<div class="item-tit-group">
|
||||
<p class="item-name">임업노동 투입</p>
|
||||
</div>
|
||||
<ul class="detail-list">
|
||||
<li>
|
||||
<p>없음</p>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="list-item no-data">
|
||||
<div class="item-tit-group">
|
||||
<p class="item-name">지출</p>
|
||||
</div>
|
||||
<ul class="detail-list">
|
||||
<li>
|
||||
<p>없음</p>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="list-item no-data">
|
||||
<div class="item-tit-group">
|
||||
<p class="item-name">동력 사용시간</p>
|
||||
</div>
|
||||
<ul class="detail-list">
|
||||
<li>
|
||||
<p>없음</p>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="list-item no-data">
|
||||
<div class="item-tit-group">
|
||||
<p class="item-name">임업생산물 중 자가소비량</p>
|
||||
</div>
|
||||
<ul class="detail-list">
|
||||
<li>
|
||||
<p>없음</p>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="list-item no-data">
|
||||
<div class="item-tit-group">
|
||||
<p class="item-name">농업생산물 중 자가소비량</p>
|
||||
</div>
|
||||
<ul class="detail-list">
|
||||
<li>
|
||||
<p>없음</p>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
|
||||
@@ -60,7 +60,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="powerStatus" value="TARGET" data-target="power"
|
||||
@@ -70,7 +70,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="forestryStatus" value="TARGET" data-target="forestry"
|
||||
@@ -114,7 +114,7 @@
|
||||
</div>
|
||||
|
||||
<section layout:fragment="script">
|
||||
<script th:src="@{/ui/page/daily-record.js}"></script>
|
||||
<script th:src="@{/static/ui/page/daily-record.js}"></script>
|
||||
<script th:inline="javascript">
|
||||
let ENV = {
|
||||
httpUrl: {
|
||||
@@ -164,7 +164,8 @@
|
||||
create() {
|
||||
const f = document.reqForm;
|
||||
|
||||
if ($(f).find('input:checked').length === 0) {
|
||||
const $checked = $(f).find('input:checked');
|
||||
if ($checked.length === 0) {
|
||||
f.todayNone.value = 'Y';
|
||||
}
|
||||
|
||||
@@ -179,6 +180,8 @@
|
||||
} else {
|
||||
krip.daily.goToDone(ENV.month, ENV.groupNo);
|
||||
}
|
||||
} else if ($checked.data('target') !== undefined) {
|
||||
krip.daily.goToNext($checked.data('target'), ENV.month, ENV.groupNo);
|
||||
} else {
|
||||
krip.daily.goToMain();
|
||||
}
|
||||
|
||||
@@ -108,7 +108,7 @@
|
||||
|
||||
<!-- 모달 팝업 -->
|
||||
<div class="layer-wrap">
|
||||
<div class="component-modal acco-wrap modal01" data-props-dimm-click="true">
|
||||
<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">
|
||||
@@ -148,7 +148,7 @@
|
||||
// 등록 버튼
|
||||
selectorId: '.button-modal01',
|
||||
// 등록 영역
|
||||
selector: '.modal01',
|
||||
selector: '.formModal',
|
||||
},
|
||||
month: /*[[${reqVO.searchMonth}]]*/'month',
|
||||
groupNo: /*[[${reqVO.groupNo}]]*/'groupNo',
|
||||
|
||||
@@ -112,7 +112,7 @@
|
||||
|
||||
<!-- 모달 팝업 -->
|
||||
<div class="layer-wrap">
|
||||
<div class="component-modal acco-wrap modal01" data-props-dimm-click="true">
|
||||
<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">
|
||||
@@ -152,7 +152,7 @@
|
||||
// 등록 버튼
|
||||
selectorId: '.button-modal01',
|
||||
// 등록 영역
|
||||
selector: '.modal01',
|
||||
selector: '.formModal',
|
||||
},
|
||||
month: /*[[${reqVO.searchMonth}]]*/'month',
|
||||
groupNo: /*[[${reqVO.groupNo}]]*/'groupNo',
|
||||
|
||||
77
front/src/main/resources/templates/record/power/form.html
Normal file
77
front/src/main/resources/templates/record/power/form.html
Normal file
@@ -0,0 +1,77 @@
|
||||
<!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">
|
||||
<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="equipmentName" class="label-txt">
|
||||
명칭
|
||||
<i class="ico-required-mark" role="img" aria-label="필수">*</i>
|
||||
</label>
|
||||
</div>
|
||||
<div class="input-field">
|
||||
<input type="text" id="equipmentName" name="equipmentName" th:value="${detail.equipmentName}" maxlength="30" placeholder="사용 기계 이름을 입력해 주세요">
|
||||
</div>
|
||||
<ul class="guide-info">
|
||||
<li>예 : 예초기</li>
|
||||
</ul>
|
||||
</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>
|
||||
<span class="label-sub-txt">
|
||||
동력 사용시간은 자가와 임차로 구분해 입력해 주세요.
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="component-input type-sub">
|
||||
<div class="input-label">
|
||||
<label for="ownedHours" 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="numeric" pattern="[0-9]*" id="ownedHours" name="ownedHours" th:value="${detail.ownedHours}" maxlength="10" placeholder="자가에서 사용한 동력 사용시간을 입력해 주세요">
|
||||
<span class="input-field-txt">시간</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="component-input type-sub">
|
||||
<div class="input-label">
|
||||
<label for="leasedHours" 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="numeric" pattern="[0-9]*" id="leasedHours" name="ownedHours" th:value="${detail.ownedHours}" maxlength="10" placeholder="임차해서 사용한 동력 사용시간을 입력해 주세요">
|
||||
<span class="input-field-txt">시간</span>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</form>
|
||||
|
||||
<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>
|
||||
</div>
|
||||
</th:block>
|
||||
|
||||
</html>
|
||||
251
front/src/main/resources/templates/record/power/index.html
Normal file
251
front/src/main/resources/templates/record/power/index.html
Normal file
@@ -0,0 +1,251 @@
|
||||
<!DOCTYPE html>
|
||||
<html layout:decorate="~{layout/layout-none}" xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout"
|
||||
xmlns:th="http://www.thymeleaf.org" lang="ko">
|
||||
|
||||
<div layout:fragment="content" th:classappend="acco-wrap">
|
||||
<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(incomeList) ? 0 : #lists.size(incomeList)}]]건 등록</strong> <br>
|
||||
되었습니다.
|
||||
</h3>
|
||||
<p>동력 사용내역을 등록해 주세요.</p>
|
||||
</hgroup>
|
||||
|
||||
<!--/* 신규 등록 */-->
|
||||
<th:block th:if="${#lists.isEmpty(incomeList)}">
|
||||
<button type="button" class="btn btn-m btn-secondary btn-full button-modal01" data-testid="button-modal01"
|
||||
th:disabled="${#strings.equals(dailyRecord.incomeStatus, 'TODAY_NONE')}">
|
||||
<i class="ico-small" aria-hidden="true"
|
||||
th:classappend="${#strings.equals(dailyRecord.incomeStatus, '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="INCOME"
|
||||
th:checked="${#strings.equals(dailyRecord.incomeStatus, 'TODAY_NONE')}">
|
||||
<span class="checkbox-item">
|
||||
<span class="checkbox-txt">금일 등록내용 없음</span>
|
||||
</span>
|
||||
</label>
|
||||
</div>
|
||||
</th:block>
|
||||
<!--/* 목록 */-->
|
||||
<th:block th:unless="${#lists.isEmpty(incomeList)}">
|
||||
<section class="regist-item-area">
|
||||
<p class="total">
|
||||
<span>총 <strong>[[${#lists.size(incomeList)}]]</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 : ${incomeList}">
|
||||
<div class="item-tit-group">
|
||||
<p class="item-name">[[${item.categorySelf}]]</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="${item.credit != null}">
|
||||
<p>외상판매</p>
|
||||
<span th:text="${item.credit ? '예' : '아니오'}">아니오</span>
|
||||
</li>
|
||||
<li th:if="${not #strings.isEmpty(item.cropLabel)}">
|
||||
<p>재배형태</p>
|
||||
<span th:text="${item.cropLabel}">재배형태</span>
|
||||
</li>
|
||||
<li th:if="${not #strings.isEmpty(item.sourcePurpose)}">
|
||||
<p>수입원</p>
|
||||
<span th:text="${item.sourcePurpose}">소비자</span>
|
||||
</li>
|
||||
<li th:if="${not #strings.isEmpty(item.quantity)}">
|
||||
<p>수량</p>
|
||||
<span th:text="|${item.quantity}${#strings.defaultString(item.unitLabel,'')}|">500g</span>
|
||||
</li>
|
||||
<li th:if="${not #strings.isEmpty(item.price)}">
|
||||
<p>현금 </p>
|
||||
<span th:text="|${#numbers.formatInteger(item.price, 1, 'COMMA')}원|">302,000원</span>
|
||||
</li>
|
||||
<li th:if="${not #strings.isEmpty(item.estimatedValue)}">
|
||||
<p>현물평가액</p>
|
||||
<span th:text="|${#numbers.formatInteger(item.estimatedValue, 1, 'COMMA')}원|">302,000원</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>
|
||||
</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.incomeStatus, 'TODAY_NONE') and #lists.isEmpty(incomeList)}"
|
||||
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/power/${reqVO.searchMonth}/${reqVO.groupNo}|]]*/'rootUrl',
|
||||
form: /*[[|/record/power/${reqVO.searchMonth}/${reqVO.groupNo}/form/{id}|]]*/'formUrl',
|
||||
create: /*[[|/api/record/power/${reqVO.searchMonth}/${reqVO.groupNo}/form/{id}|]]*/'createUrl',
|
||||
remove: /*[[|/api/record/power/${reqVO.searchMonth}/${reqVO.groupNo}/remove|]]*/'removeUrl',
|
||||
reset: /*[[|/api/record/power/${reqVO.searchMonth}/${reqVO.groupNo}/reset|]]*/'resetUrl',
|
||||
},
|
||||
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('#cropCode');
|
||||
const selectboxInstance1 = new etUI.components.SelectBox();
|
||||
selectboxInstance1.core.init($select1, {
|
||||
selectItemCallback({selectValue, dataValue}){
|
||||
console.log('selectItemCallback', selectValue, dataValue)
|
||||
$('input[name="cropCode"]').val(dataValue)
|
||||
}
|
||||
});
|
||||
|
||||
const $select2 = document.querySelector('#unitCode');
|
||||
const selectboxInstance2 = new etUI.components.SelectBox();
|
||||
selectboxInstance2.core.init($select2, {
|
||||
selectItemCallback({selectValue, dataValue}){
|
||||
console.log('selectItemCallback', selectValue, dataValue)
|
||||
$('input[name="unitCode"]').val(dataValue)
|
||||
|
||||
etUI.pages.initDirectInputToggle();
|
||||
}
|
||||
});
|
||||
|
||||
const $formWrap = $(ENV.modal.selector).find('form');
|
||||
const $price = $(ENV.modal.selector).find('form input[name="price"]');
|
||||
const $estimatedValue = $(ENV.modal.selector).find('form input[name="estimatedValue"]');
|
||||
$price.on('keyup', function() {
|
||||
if ($(this).val() === '') {
|
||||
modalControl._priceActive($estimatedValue);
|
||||
} else {
|
||||
modalControl._priceDisabled($estimatedValue);
|
||||
}
|
||||
});
|
||||
|
||||
$estimatedValue.on('keyup', function() {
|
||||
if ($(this).val() === '') {
|
||||
modalControl._priceActive($price);
|
||||
} else {
|
||||
modalControl._priceDisabled($price);
|
||||
}
|
||||
});
|
||||
|
||||
// data set
|
||||
selectboxInstance1.setValue($formWrap.find('input[name="cropCode"]').val());
|
||||
//selectboxInstance1.update();
|
||||
|
||||
selectboxInstance2.setValue($formWrap.find('input[name="unitCode"]').val());
|
||||
//selectboxInstance2.update();
|
||||
|
||||
if ($price.val() === '' && $estimatedValue.val() !== '') {
|
||||
modalControl._priceDisabled($price);
|
||||
} else if ($price.val() !== '' && $estimatedValue.val() === '') {
|
||||
modalControl._priceDisabled($estimatedValue);
|
||||
}
|
||||
},
|
||||
_priceActive($input) {
|
||||
$input.val('').attr('disabled', false);
|
||||
$input.parent().parent().closest('.component-input').removeClass('input-disabled');
|
||||
},
|
||||
_priceDisabled($input) {
|
||||
$input.val('').attr('disabled', true);
|
||||
$input.parent().parent().closest('.component-input').addClass('input-disabled');
|
||||
},
|
||||
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>
|
||||
|
||||
</html>
|
||||
Reference in New Issue
Block a user