[BO] 일계부 수입 등록 WIP
This commit is contained in:
@@ -17,27 +17,31 @@ import org.springframework.web.bind.annotation.RequestParam;
|
|||||||
@Controller
|
@Controller
|
||||||
@RequiredArgsConstructor
|
@RequiredArgsConstructor
|
||||||
class GetHouseholdStatusUIController {
|
class GetHouseholdStatusUIController {
|
||||||
private final GetHouseholdStatusPortIn getHouseholdStatusPortIn;
|
private final GetHouseholdStatusPortIn getHouseholdStatusPortIn;
|
||||||
private final UICodeListPortIn uiCodeListPortIn;
|
private final UICodeListPortIn uiCodeListPortIn;
|
||||||
|
|
||||||
@GetMapping(path = "/households/{seq}")
|
@GetMapping(path = "/households/{seq}")
|
||||||
String operate(
|
String operate(
|
||||||
@PathVariable Long seq,
|
@PathVariable Long seq,
|
||||||
@RequestParam(required = false) String recordMonth,
|
@RequestParam(required = false) String recordMonth,
|
||||||
Model model,
|
Model model,
|
||||||
@ModelAttribute("reqVO") GetHouseholdStatusUIReqVO reqVO) {
|
@ModelAttribute("reqVO") GetHouseholdStatusUIReqVO reqVO) {
|
||||||
|
|
||||||
model.addAttribute("seq", seq);
|
model.addAttribute("seq", seq);
|
||||||
model.addAttribute("monthList", DateUiUtil.getRecentMonths(13));
|
model.addAttribute("monthList", DateUiUtil.getRecentMonths(13));
|
||||||
model.addAttribute("recordMonth", recordMonth);
|
model.addAttribute("recordMonth", recordMonth);
|
||||||
model.addAttribute("userRole", AdminUtil.getLoginUserRole());
|
model.addAttribute("userRole", AdminUtil.getLoginUserRole());
|
||||||
|
|
||||||
model.addAttribute("unitCodes", uiCodeListPortIn.connect("code.record.unit"));
|
model.addAttribute("unitCodes", uiCodeListPortIn.connect("code.record.unit"));
|
||||||
|
model.addAttribute("recordCrop", uiCodeListPortIn.connect("code.record.crop"));
|
||||||
|
model.addAttribute("recordUnit", uiCodeListPortIn.connect("code.record.unit"));
|
||||||
|
model.addAttribute("recordArea", uiCodeListPortIn.connect("code.record.area"));
|
||||||
|
model.addAttribute("recordFarming", uiCodeListPortIn.connect("code.record.farming"));
|
||||||
|
|
||||||
// 임가 상세 정보
|
// 임가 상세 정보
|
||||||
model.addAttribute("householdInfo",
|
model.addAttribute("householdInfo",
|
||||||
getHouseholdStatusPortIn.operate(new GetHouseholdStatusCmd(seq)).orElse(null));
|
getHouseholdStatusPortIn.operate(new GetHouseholdStatusCmd(seq)).orElse(null));
|
||||||
|
|
||||||
return "households/{seq}";
|
return "households/{seq}";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,40 @@
|
|||||||
|
package app.module.admin.usecase.household.tab.dailyRecord.createDailyIncome.adapters.persistence;
|
||||||
|
|
||||||
|
import app.module.admin.usecase.household.tab.dailyRecord.createDailyIncome.adapters.persistence.modal.GetDailyIncomeDto;
|
||||||
|
import app.module.admin.usecase.household.tab.dailyRecord.createDailyIncome.ports.CreateDailyIncomePortOut;
|
||||||
|
import app.module.admin.usecase.household.tab.dailyRecord.createDailyIncome.ports.application.domain.CreateDailyIncomeCmd;
|
||||||
|
import app.module.admin.usecase.household.tab.dailyRecord.createDailyIncome.ports.application.domain.GetDailyIncomeCmd;
|
||||||
|
import app.module.admin.usecase.household.tab.dailyRecord.createDailyIncome.ports.application.domain.RemoveDailyIncomeCmd;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Slf4j
|
||||||
|
@Service
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
public class CreateDailyIncomeDao implements CreateDailyIncomePortOut {
|
||||||
|
private final CreateDailyIncomeMapper dailyIncomeMapper;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public GetDailyIncomeDto detail(GetDailyIncomeCmd command) {
|
||||||
|
|
||||||
|
return dailyIncomeMapper.getDailyIncome(command);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void create(GetDailyIncomeCmd findCmd, CreateDailyIncomeCmd command) {
|
||||||
|
Integer existCount = dailyIncomeMapper.getRecordExistCount(findCmd);
|
||||||
|
if (existCount == 0) {
|
||||||
|
dailyIncomeMapper.createDailyIncome(command);
|
||||||
|
|
||||||
|
log.debug("[CreateDailyIncome] record={}", command);
|
||||||
|
} else {
|
||||||
|
dailyIncomeMapper.updateDailyIncome(command);
|
||||||
|
|
||||||
|
log.debug("[UpdateDailyIncome] record={}", command);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,39 @@
|
|||||||
|
package app.module.admin.usecase.household.tab.dailyRecord.createDailyIncome.adapters.persistence;
|
||||||
|
|
||||||
|
import app.module.admin.usecase.household.tab.dailyRecord.createDailyIncome.adapters.persistence.modal.GetDailyIncomeDto;
|
||||||
|
import app.module.admin.usecase.household.tab.dailyRecord.createDailyIncome.ports.application.domain.CreateDailyIncomeCmd;
|
||||||
|
import app.module.admin.usecase.household.tab.dailyRecord.createDailyIncome.ports.application.domain.GetDailyIncomeCmd;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
|
@Mapper
|
||||||
|
public interface CreateDailyIncomeMapper {
|
||||||
|
/**
|
||||||
|
* 일계부 수입 데이터 조회
|
||||||
|
*
|
||||||
|
* @param command 검색 조건
|
||||||
|
* @return 수입 데이터
|
||||||
|
*/
|
||||||
|
GetDailyIncomeDto getDailyIncome(GetDailyIncomeCmd command);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 일계부 수입 데이터 존재 여부
|
||||||
|
*
|
||||||
|
* @param command 검색 조건
|
||||||
|
* @return 중복 개수
|
||||||
|
*/
|
||||||
|
Integer getRecordExistCount(GetDailyIncomeCmd command);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 일계부 수입 등록
|
||||||
|
*
|
||||||
|
* @param command 등록 데이터
|
||||||
|
*/
|
||||||
|
void createDailyIncome(CreateDailyIncomeCmd command);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 일계부 수입 수정
|
||||||
|
*
|
||||||
|
* @param command 수정 데이터
|
||||||
|
*/
|
||||||
|
void updateDailyIncome(CreateDailyIncomeCmd command);
|
||||||
|
}
|
||||||
@@ -0,0 +1,31 @@
|
|||||||
|
package app.module.admin.usecase.household.tab.dailyRecord.createDailyIncome.adapters.persistence.modal;
|
||||||
|
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.Setter;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
public class GetDailyIncomeDto {
|
||||||
|
private Long id;
|
||||||
|
private Long dailyRecordSeq;
|
||||||
|
private String inputType; // TODO DailyInputType
|
||||||
|
private Boolean credit;
|
||||||
|
private String cropCode;
|
||||||
|
private String cropLabel;
|
||||||
|
private String incomeKind;
|
||||||
|
private String sourcePurpose;
|
||||||
|
private String quantity;
|
||||||
|
private String unitCode;
|
||||||
|
private String unitLabel;
|
||||||
|
private String unitSelf;
|
||||||
|
private Long price;
|
||||||
|
private Long estimatedValue;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 수정 가능 여부
|
||||||
|
* @return true=가능, false=불가능(등록 상태)
|
||||||
|
*/
|
||||||
|
public boolean isUpdated() {
|
||||||
|
return this.id != null && this.id != 0L;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,94 @@
|
|||||||
|
package app.module.admin.usecase.household.tab.dailyRecord.createDailyIncome.adapters.web;
|
||||||
|
|
||||||
|
import app.module.admin.usecase.household.tab.dailyRecord.createDailyIncome.adapters.persistence.modal.GetDailyIncomeDto;
|
||||||
|
import app.module.admin.usecase.household.tab.dailyRecord.createDailyIncome.adapters.web.model.CreateDailyIncomeReqVO;
|
||||||
|
import app.module.admin.usecase.household.tab.dailyRecord.createDailyIncome.adapters.web.model.DailyIncomeUIReqVO;
|
||||||
|
import app.module.admin.usecase.household.tab.dailyRecord.createDailyIncome.adapters.web.model.RemoveDailyIncomeReqVO;
|
||||||
|
import app.module.admin.usecase.household.tab.dailyRecord.createDailyIncome.adapters.web.validator.CreateDailyIncomeValidator;
|
||||||
|
import app.module.admin.usecase.household.tab.dailyRecord.createDailyIncome.ports.CreateDailyIncomePortIn;
|
||||||
|
import app.module.core.config.application.exception.NoRecordDataException;
|
||||||
|
import app.module.core.config.application.util.CoreUtil;
|
||||||
|
import app.module.core.usecase.daily.record.adapters.persistence.model.DailyRecordDto;
|
||||||
|
import app.module.core.usecase.daily.record.adapters.web.model.DailyUIReqVO;
|
||||||
|
import app.module.core.usecase.daily.record.ports.DailyRecordPortIn;
|
||||||
|
import jakarta.validation.Valid;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.http.HttpStatus;
|
||||||
|
import org.springframework.http.ResponseEntity;
|
||||||
|
import org.springframework.validation.BindingResult;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
@Slf4j
|
||||||
|
@RestController
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
@RequestMapping(path = "/api/household/daily/income")
|
||||||
|
public class CreateDailyIncomeController {
|
||||||
|
private final CoreUtil coreUtil;
|
||||||
|
private final DailyRecordPortIn dailyRecordPortIn;
|
||||||
|
private final CreateDailyIncomePortIn dailyIncomePortIn;
|
||||||
|
private final CreateDailyIncomeValidator createValidator;
|
||||||
|
|
||||||
|
@GetMapping(path = "/{id}")
|
||||||
|
ResponseEntity<?> detail(@PathVariable("id") String id, @ModelAttribute DailyIncomeUIReqVO reqVO) {
|
||||||
|
|
||||||
|
reqVO.setId(Long.parseLong(id));
|
||||||
|
|
||||||
|
//DailyRecordDto dailyRecord = this.vaildGetDailyRecord(reqVO.getSearchMonth(), reqVO.getGroupNo());
|
||||||
|
|
||||||
|
GetDailyIncomeDto detail = dailyIncomePortIn.detail(reqVO);
|
||||||
|
|
||||||
|
return ResponseEntity.status(HttpStatus.OK).body(detail);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 일계부 수입 등록 처리
|
||||||
|
*
|
||||||
|
* @param searchMonth 검색 월(yyyyMM)
|
||||||
|
* @param groupNo 검색 그룹
|
||||||
|
* @param id 수입 일련번호
|
||||||
|
* @param formVO 입력 데이터
|
||||||
|
* @param bindingResult BindingResult
|
||||||
|
*/
|
||||||
|
@PostMapping(path = "/{id}")
|
||||||
|
ResponseEntity<?> create(@PathVariable("searchMonth") String searchMonth, @PathVariable("groupNo") String groupNo
|
||||||
|
, @PathVariable("id") String id
|
||||||
|
, @Valid @RequestBody CreateDailyIncomeReqVO formVO, BindingResult bindingResult) {
|
||||||
|
|
||||||
|
createValidator.validate(formVO, bindingResult);
|
||||||
|
if (bindingResult.hasErrors()) {
|
||||||
|
return coreUtil.getErrorInfo(bindingResult);
|
||||||
|
}
|
||||||
|
|
||||||
|
DailyRecordDto dailyRecord = this.vaildGetDailyRecord(searchMonth, null);
|
||||||
|
|
||||||
|
formVO.setSearchMonth(searchMonth);
|
||||||
|
formVO.setGroupNo(Integer.parseInt(groupNo));
|
||||||
|
formVO.setId(Long.parseLong(id));
|
||||||
|
formVO.setDailyRecordSeq(dailyRecord.getId());
|
||||||
|
log.debug("formVO: {}", formVO);
|
||||||
|
|
||||||
|
dailyIncomePortIn.create(formVO);
|
||||||
|
|
||||||
|
return ResponseEntity.status(HttpStatus.OK).body(formVO);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 일계부 유효성 체크 및 데이터 조회
|
||||||
|
*
|
||||||
|
* @param searchMonth 검색 월(yyyyMM)
|
||||||
|
* @param groupNo 검색 그룹
|
||||||
|
*/
|
||||||
|
private DailyRecordDto vaildGetDailyRecord(String searchMonth, Integer groupNo) {
|
||||||
|
DailyUIReqVO reqVO = new DailyUIReqVO(searchMonth, groupNo);
|
||||||
|
log.debug("getRecordUIReq: {}", reqVO);
|
||||||
|
|
||||||
|
DailyRecordDto dailyRecord = dailyRecordPortIn.detail(reqVO.getSearchMonth(), reqVO.getGroupNo(), reqVO.getHouseholdSeq());
|
||||||
|
if (dailyRecord == null || dailyRecord.getId() == null) {
|
||||||
|
throw new NoRecordDataException();
|
||||||
|
}
|
||||||
|
|
||||||
|
return dailyRecord;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,63 @@
|
|||||||
|
package app.module.admin.usecase.household.tab.dailyRecord.createDailyIncome.adapters.web.model;
|
||||||
|
|
||||||
|
import app.module.core.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 CreateDailyIncomeReqVO extends DailyUIReqVO {
|
||||||
|
/**
|
||||||
|
* 수입 일련번호
|
||||||
|
*/
|
||||||
|
private Long id;
|
||||||
|
/**
|
||||||
|
* 일계부 일련번호
|
||||||
|
*/
|
||||||
|
private Long dailyRecordSeq;
|
||||||
|
/**
|
||||||
|
* 등록 유형
|
||||||
|
*/
|
||||||
|
private DailyInputType inputType;
|
||||||
|
/**
|
||||||
|
* 외상판매 여부
|
||||||
|
*/
|
||||||
|
private Boolean credit;
|
||||||
|
/**
|
||||||
|
* 재배형태 코드
|
||||||
|
*/
|
||||||
|
private String cropCode;
|
||||||
|
/**
|
||||||
|
* 수입의 종류 직접입력
|
||||||
|
*/
|
||||||
|
@NotBlank(message = "수입 종류를 입력해 주세요.")
|
||||||
|
private String incomeKind;
|
||||||
|
/**
|
||||||
|
* 수입원
|
||||||
|
*/
|
||||||
|
@NotBlank(message = "수입원을 입력해 주세요.")
|
||||||
|
private String sourcePurpose;
|
||||||
|
/**
|
||||||
|
* 수량
|
||||||
|
*/
|
||||||
|
private Double quantity;
|
||||||
|
/**
|
||||||
|
* 단위 코드
|
||||||
|
*/
|
||||||
|
private String unitCode;
|
||||||
|
/**
|
||||||
|
* 단위 직접 입력
|
||||||
|
*/
|
||||||
|
private String unitSelf;
|
||||||
|
/**
|
||||||
|
* 현금
|
||||||
|
*/
|
||||||
|
private Long price;
|
||||||
|
/**
|
||||||
|
* 현물평가액
|
||||||
|
*/
|
||||||
|
private Long estimatedValue;
|
||||||
|
}
|
||||||
@@ -0,0 +1,33 @@
|
|||||||
|
package app.module.admin.usecase.household.tab.dailyRecord.createDailyIncome.adapters.web.model;
|
||||||
|
|
||||||
|
import app.module.core.usecase.daily.record.adapters.web.model.DailyUIReqVO;
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.Setter;
|
||||||
|
import lombok.ToString;
|
||||||
|
import org.apache.tika.utils.StringUtils;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
public class DailyIncomeUIReqVO {
|
||||||
|
/**
|
||||||
|
* 검색 월(yyyyMM)
|
||||||
|
*/
|
||||||
|
private String recordMonth;
|
||||||
|
/**
|
||||||
|
* 검색 그룸번호
|
||||||
|
*/
|
||||||
|
private Integer groupNo;
|
||||||
|
/**
|
||||||
|
* 임가 일련번호
|
||||||
|
*/
|
||||||
|
private Long householdSeq;
|
||||||
|
/**
|
||||||
|
* 일계부 항목 일련번호
|
||||||
|
*/
|
||||||
|
private Long dailyId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 수입 일련번호
|
||||||
|
*/
|
||||||
|
private Long id;
|
||||||
|
}
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
package app.module.admin.usecase.household.tab.dailyRecord.createDailyIncome.adapters.web.model;
|
||||||
|
|
||||||
|
public enum DailyInputType {
|
||||||
|
/**
|
||||||
|
* 직접 입력
|
||||||
|
*/
|
||||||
|
SELF,
|
||||||
|
/**
|
||||||
|
* 영수증 입력
|
||||||
|
*/
|
||||||
|
OCR,
|
||||||
|
;
|
||||||
|
}
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
package app.module.admin.usecase.household.tab.dailyRecord.createDailyIncome.adapters.web.model;
|
||||||
|
|
||||||
|
import app.module.core.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 RemoveDailyIncomeReqVO extends DailyUIReqVO {
|
||||||
|
/**
|
||||||
|
* 수입 일련번호
|
||||||
|
*/
|
||||||
|
@NotBlank(message = "{valid.common.required}")
|
||||||
|
private String id;
|
||||||
|
/**
|
||||||
|
* 일계부 일련번호
|
||||||
|
*/
|
||||||
|
private Long dailyRecordSeq;
|
||||||
|
}
|
||||||
@@ -0,0 +1,50 @@
|
|||||||
|
package app.module.admin.usecase.household.tab.dailyRecord.createDailyIncome.adapters.web.validator;
|
||||||
|
|
||||||
|
import app.module.admin.usecase.household.tab.dailyRecord.createDailyIncome.adapters.web.model.CreateDailyIncomeReqVO;
|
||||||
|
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 CreateDailyIncomeValidator implements Validator {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean supports(Class<?> clazz) {
|
||||||
|
return CreateDailyIncomeReqVO.class.equals(clazz);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void validate(Object target, Errors errors) {
|
||||||
|
CreateDailyIncomeReqVO vo = (CreateDailyIncomeReqVO) target;
|
||||||
|
|
||||||
|
if (vo.getQuantity() == null && !StringUtils.isBlank(vo.getUnitCode())) {
|
||||||
|
errors.rejectValue(
|
||||||
|
"quantity", "valid.common.required",
|
||||||
|
"수량을 입력해 주세요.");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (vo.getQuantity() != null && StringUtils.isBlank(vo.getUnitCode())) {
|
||||||
|
errors.rejectValue(
|
||||||
|
"unitCode", "valid.common.required",
|
||||||
|
"단위를 선택해 주세요.");
|
||||||
|
}
|
||||||
|
|
||||||
|
if ("code.record.unit.self".equals(vo.getUnitCode()) && StringUtils.isBlank(vo.getUnitSelf())) {
|
||||||
|
errors.rejectValue(
|
||||||
|
"unitSelf", "valid.common.required",
|
||||||
|
"단위를 입력해 주세요.");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (vo.getPrice() == null && vo.getEstimatedValue() == null) {
|
||||||
|
errors.rejectValue(
|
||||||
|
"price", "valid.common.required",
|
||||||
|
"현금 또는 현물평가액을 입력해 주세요.");
|
||||||
|
errors.rejectValue(
|
||||||
|
"estimatedValue", "valid.common.required",
|
||||||
|
"현금 또는 현물평가액을 입력해 주세요.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,26 @@
|
|||||||
|
package app.module.admin.usecase.household.tab.dailyRecord.createDailyIncome.ports;
|
||||||
|
|
||||||
|
|
||||||
|
import app.module.admin.usecase.household.tab.dailyRecord.createDailyIncome.adapters.persistence.modal.GetDailyIncomeDto;
|
||||||
|
import app.module.admin.usecase.household.tab.dailyRecord.createDailyIncome.adapters.web.model.CreateDailyIncomeReqVO;
|
||||||
|
import app.module.admin.usecase.household.tab.dailyRecord.createDailyIncome.adapters.web.model.DailyIncomeUIReqVO;
|
||||||
|
import app.module.admin.usecase.household.tab.dailyRecord.createDailyIncome.adapters.web.model.RemoveDailyIncomeReqVO;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public interface CreateDailyIncomePortIn {
|
||||||
|
/**
|
||||||
|
* 일계부 수입 조회
|
||||||
|
*
|
||||||
|
* @param reqVO 검색 조건
|
||||||
|
* @return 수입 상세
|
||||||
|
*/
|
||||||
|
GetDailyIncomeDto detail(DailyIncomeUIReqVO reqVO);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 일계부 수입 등록
|
||||||
|
*
|
||||||
|
* @param formVO 입력 데이터
|
||||||
|
*/
|
||||||
|
void create(CreateDailyIncomeReqVO formVO);
|
||||||
|
}
|
||||||
@@ -0,0 +1,27 @@
|
|||||||
|
package app.module.admin.usecase.household.tab.dailyRecord.createDailyIncome.ports;
|
||||||
|
|
||||||
|
|
||||||
|
import app.module.admin.usecase.household.tab.dailyRecord.createDailyIncome.adapters.persistence.modal.GetDailyIncomeDto;
|
||||||
|
import app.module.admin.usecase.household.tab.dailyRecord.createDailyIncome.ports.application.domain.CreateDailyIncomeCmd;
|
||||||
|
import app.module.admin.usecase.household.tab.dailyRecord.createDailyIncome.ports.application.domain.GetDailyIncomeCmd;
|
||||||
|
import app.module.admin.usecase.household.tab.dailyRecord.createDailyIncome.ports.application.domain.RemoveDailyIncomeCmd;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public interface CreateDailyIncomePortOut {
|
||||||
|
/**
|
||||||
|
* 일계부 수입 조회
|
||||||
|
*
|
||||||
|
* @param command 검색 조건
|
||||||
|
* @return 수입 목록
|
||||||
|
*/
|
||||||
|
GetDailyIncomeDto detail(GetDailyIncomeCmd command);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 일계부 수입 등록
|
||||||
|
*
|
||||||
|
* @param findCmd 검색 조건
|
||||||
|
* @param command 입력 데이터
|
||||||
|
*/
|
||||||
|
void create(GetDailyIncomeCmd findCmd, CreateDailyIncomeCmd command);
|
||||||
|
}
|
||||||
@@ -0,0 +1,86 @@
|
|||||||
|
package app.module.admin.usecase.household.tab.dailyRecord.createDailyIncome.ports.application;
|
||||||
|
|
||||||
|
import app.module.admin.usecase.household.tab.dailyRecord.createDailyIncome.adapters.persistence.modal.GetDailyIncomeDto;
|
||||||
|
import app.module.admin.usecase.household.tab.dailyRecord.createDailyIncome.adapters.web.model.CreateDailyIncomeReqVO;
|
||||||
|
import app.module.admin.usecase.household.tab.dailyRecord.createDailyIncome.adapters.web.model.DailyIncomeUIReqVO;
|
||||||
|
import app.module.admin.usecase.household.tab.dailyRecord.createDailyIncome.adapters.web.model.RemoveDailyIncomeReqVO;
|
||||||
|
import app.module.admin.usecase.household.tab.dailyRecord.createDailyIncome.ports.CreateDailyIncomePortIn;
|
||||||
|
import app.module.admin.usecase.household.tab.dailyRecord.createDailyIncome.ports.CreateDailyIncomePortOut;
|
||||||
|
import app.module.admin.usecase.household.tab.dailyRecord.createDailyIncome.ports.application.domain.CreateDailyIncomeCmd;
|
||||||
|
import app.module.admin.usecase.household.tab.dailyRecord.createDailyIncome.ports.application.domain.GetDailyIncomeCmd;
|
||||||
|
import app.module.admin.usecase.household.tab.dailyRecord.createDailyIncome.ports.application.domain.RemoveDailyIncomeCmd;
|
||||||
|
import app.module.core.config.application.util.AuditUtil;
|
||||||
|
import app.module.core.usecase.daily.record.ports.DailyRecordPortIn;
|
||||||
|
import app.module.core.usecase.uicode.list.ports.UICodeListPortIn;
|
||||||
|
import app.module.core.usecase.uicode.list.ports.application.domain.UICodeElement;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
public class CreateDailyIncomeService implements CreateDailyIncomePortIn {
|
||||||
|
private final CreateDailyIncomePortOut portOut;
|
||||||
|
private final UICodeListPortIn uiCodeListPortIn;
|
||||||
|
private final DailyRecordPortIn dailyRecordPortIn;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public GetDailyIncomeDto detail(DailyIncomeUIReqVO reqVO) {
|
||||||
|
GetDailyIncomeCmd findCmd = new GetDailyIncomeCmd(
|
||||||
|
reqVO.getRecordMonth(),
|
||||||
|
reqVO.getGroupNo(),
|
||||||
|
reqVO.getHouseholdSeq(),
|
||||||
|
reqVO.getId());
|
||||||
|
|
||||||
|
return portOut.detail(findCmd);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 코드명 조회
|
||||||
|
*
|
||||||
|
* @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(CreateDailyIncomeReqVO formVO) {
|
||||||
|
GetDailyIncomeCmd findCmd = new GetDailyIncomeCmd(
|
||||||
|
formVO.getSearchMonth(),
|
||||||
|
formVO.getGroupNo(),
|
||||||
|
formVO.getHouseholdSeq(),
|
||||||
|
formVO.getId());
|
||||||
|
|
||||||
|
CreateDailyIncomeCmd command = AuditUtil.create(
|
||||||
|
new CreateDailyIncomeCmd(
|
||||||
|
formVO.getId(),
|
||||||
|
formVO.getDailyRecordSeq(),
|
||||||
|
formVO.getInputType(),
|
||||||
|
"1", // [정책] 1 고정
|
||||||
|
(formVO.getCredit() ? "91206" : null), // [정책] 외상판매 Y 일 경우 지출부호 91206 적재
|
||||||
|
formVO.getCredit(),
|
||||||
|
formVO.getCropCode(),
|
||||||
|
formVO.getIncomeKind(),
|
||||||
|
formVO.getSourcePurpose(),
|
||||||
|
formVO.getQuantity(),
|
||||||
|
formVO.getUnitCode(),
|
||||||
|
formVO.getUnitSelf(),
|
||||||
|
formVO.getPrice(),
|
||||||
|
formVO.getEstimatedValue()));
|
||||||
|
|
||||||
|
portOut.create(findCmd, command);
|
||||||
|
|
||||||
|
dailyRecordPortIn.updateByAllStatus(findCmd.getSearchMonth(), findCmd.getGroupNo(), findCmd.getHouseholdSeq());
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,35 @@
|
|||||||
|
package app.module.admin.usecase.household.tab.dailyRecord.createDailyIncome.ports.application.domain;
|
||||||
|
|
||||||
|
import app.module.admin.usecase.household.tab.dailyRecord.createDailyIncome.adapters.web.model.DailyInputType;
|
||||||
|
import app.module.core.config.adapters.persistence.component.AuditCommand;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.Setter;
|
||||||
|
import lombok.ToString;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
@AllArgsConstructor
|
||||||
|
@ToString
|
||||||
|
public class CreateDailyIncomeCmd extends AuditCommand {
|
||||||
|
private Long id;
|
||||||
|
private Long dailyRecordSeq;
|
||||||
|
private DailyInputType inputType;
|
||||||
|
/**
|
||||||
|
* 유형
|
||||||
|
*/
|
||||||
|
private String category;
|
||||||
|
/**
|
||||||
|
* 지출 부호
|
||||||
|
*/
|
||||||
|
private String expenseMark;
|
||||||
|
private Boolean credit;
|
||||||
|
private String cropCode;
|
||||||
|
private String incomeKind;
|
||||||
|
private String sourcePurpose;
|
||||||
|
private Double quantity;
|
||||||
|
private String unitCode;
|
||||||
|
private String unitSelf;
|
||||||
|
private Long price;
|
||||||
|
private Long estimatedValue;
|
||||||
|
}
|
||||||
@@ -0,0 +1,27 @@
|
|||||||
|
package app.module.admin.usecase.household.tab.dailyRecord.createDailyIncome.ports.application.domain;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.Setter;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
@AllArgsConstructor
|
||||||
|
public class GetDailyIncomeCmd {
|
||||||
|
/**
|
||||||
|
* 검색 월(yyyyMM)
|
||||||
|
*/
|
||||||
|
private String searchMonth;
|
||||||
|
/**
|
||||||
|
* 검색 그룸번호
|
||||||
|
*/
|
||||||
|
private Integer groupNo;
|
||||||
|
/**
|
||||||
|
* 임가 일련번호
|
||||||
|
*/
|
||||||
|
private Long householdSeq;
|
||||||
|
/**
|
||||||
|
* 수입 일련번호
|
||||||
|
*/
|
||||||
|
private Long id;
|
||||||
|
}
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
package app.module.admin.usecase.household.tab.dailyRecord.createDailyIncome.ports.application.domain;
|
||||||
|
|
||||||
|
import app.module.core.config.adapters.persistence.component.AuditCommand;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.Setter;
|
||||||
|
import lombok.ToString;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
@AllArgsConstructor
|
||||||
|
@ToString
|
||||||
|
public class RemoveDailyIncomeCmd extends AuditCommand {
|
||||||
|
private String searchMonth;
|
||||||
|
private Integer groupNo;
|
||||||
|
private Long id;
|
||||||
|
private Long dailyRecordSeq;
|
||||||
|
}
|
||||||
@@ -0,0 +1,59 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
|
||||||
|
<mapper namespace="app.module.admin.usecase.household.tab.dailyRecord.createDailyIncome.adapters.persistence.CreateDailyIncomeMapper">
|
||||||
|
|
||||||
|
<select id="getDailyIncome"
|
||||||
|
resultType="app.module.admin.usecase.household.tab.dailyRecord.createDailyIncome.adapters.persistence.modal.GetDailyIncomeDto">
|
||||||
|
select ds.id, ds.daily_record_seq, ds.input_type, ds.is_credit as credit
|
||||||
|
, ds.crop_code, ds.income_kind, ds.source_purpose
|
||||||
|
, ds.quantity, ds.unit_code, ds.unit_self, ds.price, ds.estimated_value
|
||||||
|
from daily_income ds
|
||||||
|
<include refid="app.module.core.usecase.daily.record.adapters.persistence.DailyRecordMapper.InnerJoinByDailyRecord"/>
|
||||||
|
where ds.is_deleted = false
|
||||||
|
and ds.id = ${id}
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="getRecordExistCount" resultType="int">
|
||||||
|
select count(1)
|
||||||
|
from daily_income ds
|
||||||
|
<include refid="app.module.core.usecase.daily.record.adapters.persistence.DailyRecordMapper.InnerJoinByDailyRecord"/>
|
||||||
|
where ds.is_deleted = false
|
||||||
|
<if test="id != null and id != '0'">
|
||||||
|
and ds.id = ${id}
|
||||||
|
</if>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<insert id="createDailyIncome" useGeneratedKeys="true" keyProperty="id">
|
||||||
|
insert into daily_income (
|
||||||
|
daily_record_seq, input_type, category, expense_mark
|
||||||
|
, is_credit, crop_code, income_kind, source_purpose
|
||||||
|
, quantity, unit_code, unit_self, price, estimated_value
|
||||||
|
, is_deleted
|
||||||
|
, <include refid="common.fields.CreateUpdateBaseColumns"/>
|
||||||
|
) values (
|
||||||
|
#{dailyRecordSeq}, #{inputType}, #{category}, #{expenseMark}
|
||||||
|
, #{credit}, #{cropCode}, #{incomeKind}, #{sourcePurpose}
|
||||||
|
, #{quantity}, #{unitCode}, #{unitSelf}, #{price}, #{estimatedValue}
|
||||||
|
, false
|
||||||
|
, <include refid="common.fields.CreateUpdateBaseValues"/>
|
||||||
|
)
|
||||||
|
</insert>
|
||||||
|
|
||||||
|
<update id="updateDailyIncome">
|
||||||
|
update daily_income set <include refid="common.fields.UpdateBaseSet"/>
|
||||||
|
, is_credit = #{credit}
|
||||||
|
, expense_mark = #{expenseMark}
|
||||||
|
, crop_code = #{cropCode}
|
||||||
|
, income_kind = #{incomeKind}
|
||||||
|
, source_purpose = #{sourcePurpose}
|
||||||
|
, quantity = #{quantity}
|
||||||
|
, unit_code = #{unitCode}
|
||||||
|
, unit_self = #{unitSelf}
|
||||||
|
, price = #{price}
|
||||||
|
, estimated_value = #{estimatedValue}
|
||||||
|
where is_deleted = false
|
||||||
|
and daily_record_seq = #{dailyRecordSeq}
|
||||||
|
and id = #{id}
|
||||||
|
</update>
|
||||||
|
|
||||||
|
</mapper>
|
||||||
@@ -0,0 +1,264 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout" xmlns:th="http://www.thymeleaf.org"
|
||||||
|
layout:decorate="~{layout/layout}">
|
||||||
|
|
||||||
|
<div class="layer-wrap" th:fragment="modalFragment">
|
||||||
|
<form autocomplete="off" method="get" name="reqIncomeForm">
|
||||||
|
<input type="hidden" name="visitInfoId">
|
||||||
|
<input type="hidden" name="householdSeq" th:value="${seq}">
|
||||||
|
|
||||||
|
<div class="component-modal mypage-wrap modal01 modal-daily-income" data-props-dimm-click="true" data-state="close">
|
||||||
|
<div class="modal-dimm"></div>
|
||||||
|
<div class="modal-frame">
|
||||||
|
<div class="modal-container">
|
||||||
|
<div class="modal-header">
|
||||||
|
<h3 class="modal-tit">
|
||||||
|
일계부 수입
|
||||||
|
</h3>
|
||||||
|
</div>
|
||||||
|
<div class="modal-content">
|
||||||
|
<div class="modal-content-inner">
|
||||||
|
<table class="type-form confirm">
|
||||||
|
<colgroup>
|
||||||
|
<col width="8%" />
|
||||||
|
<col width="25.3%" />
|
||||||
|
<col width="8%" />
|
||||||
|
<col width="25.3%" />
|
||||||
|
<col width="8%" />
|
||||||
|
<col width="25.3%" />
|
||||||
|
</colgroup>
|
||||||
|
<tbody>
|
||||||
|
|
||||||
|
<tr>
|
||||||
|
<th>외상판매 여부</th>
|
||||||
|
<td class="radio-group">
|
||||||
|
<div class="component-input">
|
||||||
|
<label class="radio-inner">
|
||||||
|
<input type="radio" id="isCredit_N" name="credit" value="false" checked>
|
||||||
|
<span class="radio-item">
|
||||||
|
<span class="radio-txt">N</span>
|
||||||
|
</span>
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
<div class="component-input">
|
||||||
|
<label class="radio-inner">
|
||||||
|
<input type="radio" id="isCredit_Y" name="credit" value="true">
|
||||||
|
<span class="radio-item">
|
||||||
|
<span class="radio-txt">Y</span>
|
||||||
|
</span>
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
|
||||||
|
<th>재배형태</th>
|
||||||
|
<td>
|
||||||
|
<div class="component-select">
|
||||||
|
<select class="select-list" name="cropCode" required>
|
||||||
|
<option value="">선택</option>
|
||||||
|
<option th:each="item : ${recordCrop}"
|
||||||
|
th:value="${item.id}"
|
||||||
|
th:text="${item.codeText}">
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
<tr>
|
||||||
|
<th>수입의 종류<i class="ico-required-mark" role="img" aria-label="필수">*</i></th>
|
||||||
|
<td>
|
||||||
|
<div class="component-input">
|
||||||
|
<div class="input-field">
|
||||||
|
<input type="text" id="incomeKind" name="incomeKind" maxlength="30">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
<th>수입원<i class="ico-required-mark" role="img" aria-label="필수">*</i></th>
|
||||||
|
<td>
|
||||||
|
<div class="component-input">
|
||||||
|
<div class="input-field">
|
||||||
|
<input type="text" id="sourcePurpose" name="sourcePurpose" maxlength="30">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
<tr>
|
||||||
|
<th>수량</th>
|
||||||
|
<td>
|
||||||
|
<div class="component-input">
|
||||||
|
<div class="input-field">
|
||||||
|
<input type="number" inputmode="decimal" pattern="[0-9]*" id="quantity" name="quantity" min="1" max="9999999999"
|
||||||
|
maxlength="10" oninput="limitMaxLength(this);">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
|
||||||
|
<th>단위</th>
|
||||||
|
<td colspan="2">
|
||||||
|
<div class="d-flex">
|
||||||
|
<div class="component-select">
|
||||||
|
<select class="select-list" name="unitCode" onchange="selectedUnit(this);" required>
|
||||||
|
<option value="">선택</option>
|
||||||
|
<option th:each="item : ${recordUnit}"
|
||||||
|
th:value="${item.id}"
|
||||||
|
th:text="${item.codeText}">
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
<div class="component-input unit-self-input">
|
||||||
|
<div class="input-field">
|
||||||
|
<input type="text" id="unitSelf" name="unitSelf" disabled>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
<tr>
|
||||||
|
<th>현금(원)</th>
|
||||||
|
<td>
|
||||||
|
<div class="component-input">
|
||||||
|
<div class="input-field">
|
||||||
|
<input type="number" inputmode="numeric" pattern="[0-9]*" id="price" name="price" step="0" min="1" max="9999999999"
|
||||||
|
maxlength="10" oninput="limitMaxLength(this); priceDisabled(this, this.form.estimatedValue)">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
<th>현물평가액</th>
|
||||||
|
<td>
|
||||||
|
<div class="component-input">
|
||||||
|
<div class="input-field">
|
||||||
|
<input type="number" inputmode="numeric" pattern="[0-9]*" id="estimatedValue" name="estimatedValue" step="0" min="1" max="9999999999"
|
||||||
|
maxlength="10" oninput="limitMaxLength(this); priceDisabled(this, this.form.price)">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
<div class="component-btns bottom-btn-group">
|
||||||
|
<div class="btns-row align-right">
|
||||||
|
<button type="button" class="btn btn-primary" onclick="saveDailyIncome();">
|
||||||
|
<span class="btn-txt">등록</span>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<button type="button" class="modal-close"></button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
|
||||||
|
<script th:inline="javascript">
|
||||||
|
const modalId = '.modal-daily-income';
|
||||||
|
// form 초기화
|
||||||
|
const resetIncomeForm = () => {
|
||||||
|
const form = document.reqIncomeForm;
|
||||||
|
if (!form) return;
|
||||||
|
|
||||||
|
form.cropCode.value = '';
|
||||||
|
form.incomeKind.value = '';
|
||||||
|
form.sourcePurpose.value = '';
|
||||||
|
form.quantity.value = '';
|
||||||
|
form.unitCode.value = '';
|
||||||
|
form.unitSelf.value = '';
|
||||||
|
form.price.value = '';
|
||||||
|
form.estimatedValue.value = '';
|
||||||
|
document.getElementById('isCredit_N').checked = true;
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<script th:inline="javascript">
|
||||||
|
// 일계부 등록 모달창 띄우기
|
||||||
|
const showDailyIncomeModal = (id) => {
|
||||||
|
const mf = document.reqIncomeForm;
|
||||||
|
|
||||||
|
const obj = $(f).serializeObject();
|
||||||
|
console.log(obj)
|
||||||
|
|
||||||
|
resetIncomeForm();
|
||||||
|
|
||||||
|
if(id != null) {
|
||||||
|
mf.visitInfoId.value = id;
|
||||||
|
|
||||||
|
ajaxUtil._ajaxAsyncMethod(
|
||||||
|
`/api/household/daily/income/${id}`,
|
||||||
|
obj,
|
||||||
|
function (rstData) {
|
||||||
|
console.log("일계부 상세 응답값 : ", rstData);
|
||||||
|
setIncomeFormData(rstData);
|
||||||
|
|
||||||
|
document.querySelector(modalId).ui.open();
|
||||||
|
},
|
||||||
|
function () {
|
||||||
|
|
||||||
|
},
|
||||||
|
'get'
|
||||||
|
);
|
||||||
|
|
||||||
|
} else {
|
||||||
|
document.querySelector(modalId).ui.open();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 일계부 상세 값 set
|
||||||
|
const setIncomeFormData = (data) => {
|
||||||
|
const form = document.reqIncomeForm;
|
||||||
|
if (!form) return;
|
||||||
|
|
||||||
|
// 폼에 값 세팅
|
||||||
|
form.cropCode.value = data.cropCode || '';
|
||||||
|
form.incomeKind.value = data.incomeKind || '';
|
||||||
|
form.sourcePurpose.value = data.sourcePurpose || '';
|
||||||
|
form.quantity.value = data.quantity || '';
|
||||||
|
form.unitCode.value = data.unitCode || '';
|
||||||
|
form.unitSelf.value = data.unitSelf || '';
|
||||||
|
form.price.value = data.price || '';
|
||||||
|
form.estimatedValue.value = data.estimatedValue || '';
|
||||||
|
|
||||||
|
if (form.price.value !== '') {
|
||||||
|
priceDisabled(form.price, form.estimatedValue)
|
||||||
|
} else {
|
||||||
|
priceDisabled(form.estimatedValue, form.price)
|
||||||
|
}
|
||||||
|
|
||||||
|
// 라디오 버튼 처리
|
||||||
|
document.getElementById('isCredit_Y').checked = data.credit === true;
|
||||||
|
document.getElementById('isCredit_N').checked = data.credit === false;
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<script th:inline="javascript">
|
||||||
|
// TODO : 임가방문정보 등록
|
||||||
|
const saveDailyIncome = () => {
|
||||||
|
const f = document.reqIncomeForm;
|
||||||
|
let dataOj = $(f).serializeObject();
|
||||||
|
|
||||||
|
console.log("dataOj", dataOj);
|
||||||
|
return;
|
||||||
|
|
||||||
|
ajaxUtil._ajaxMethod(
|
||||||
|
'/api/household/daily/income/save',
|
||||||
|
JSON.stringify(dataOj),
|
||||||
|
(response) => { // 성공
|
||||||
|
alert("등록이 완료되었습니다.");
|
||||||
|
document.querySelector(modalId).ui.close();
|
||||||
|
getVisitInfo();
|
||||||
|
},
|
||||||
|
function (code, rstData) {
|
||||||
|
if(code == 422) alert(rstData.responseJSON[0].defaultMessage);
|
||||||
|
if(code == 400) alert(rstData.responseJSON.message); //임가번호 중복체크
|
||||||
|
},
|
||||||
|
'post',
|
||||||
|
'json',
|
||||||
|
{ handle422Type: 'alert' }
|
||||||
|
);
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
</div>
|
||||||
|
</html>
|
||||||
@@ -508,7 +508,7 @@
|
|||||||
</td>
|
</td>
|
||||||
<td>${item.isCredit ? "Y" : "N"}</td> <!-- 외상판매 -->
|
<td>${item.isCredit ? "Y" : "N"}</td> <!-- 외상판매 -->
|
||||||
<td>${ifNullHyphen(item.cropText)}</td><!-- 재배형태 -->
|
<td>${ifNullHyphen(item.cropText)}</td><!-- 재배형태 -->
|
||||||
<td class="underline">${ifNullHyphen(item.incomeKind)}</td><!-- 수입의 종류 -->
|
<td class="underline"><a href="javascript:void(0);" onclick="showDailyIncomeModal(${item.id});">${ifNullHyphen(item.incomeKind)}</a></td> <!-- 수입의 종류 -->
|
||||||
<td>${ifNullHyphen(item.sourcePurpose)}</td><!-- 수입원 -->
|
<td>${ifNullHyphen(item.sourcePurpose)}</td><!-- 수입원 -->
|
||||||
<td class="align-right">${formatNumberWithComma(item.quantity)}</td><!-- 수량 -->
|
<td class="align-right">${formatNumberWithComma(item.quantity)}</td><!-- 수량 -->
|
||||||
<td>${ifNullHyphen(item.unitText)}</td><!-- 단위 -->
|
<td>${ifNullHyphen(item.unitText)}</td><!-- 단위 -->
|
||||||
@@ -806,9 +806,13 @@
|
|||||||
const saveDaily = (el) => {
|
const saveDaily = (el) => {
|
||||||
const currentStep = $(el).data('step');
|
const currentStep = $(el).data('step');
|
||||||
const currentModalId = $(el).data('modalId');
|
const currentModalId = $(el).data('modalId');
|
||||||
console.log('removeDaily', currentStep, currentModalId);
|
console.log('saveDaily', currentStep, currentModalId);
|
||||||
|
|
||||||
alert('TODO : 추가')
|
if (currentStep === 'INCOME') {
|
||||||
|
showDailyIncomeModal();
|
||||||
|
} else {
|
||||||
|
alert('TODO : 추가');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 일계부 삭제 처리
|
// 일계부 삭제 처리
|
||||||
|
|||||||
@@ -175,6 +175,9 @@
|
|||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
|
<!-- 일계부 모달 -->
|
||||||
|
<th:block th:replace="households/modal/modal-daily-income :: modalFragment"/>
|
||||||
|
|
||||||
<!-- 조사원 매핑 모달 -->
|
<!-- 조사원 매핑 모달 -->
|
||||||
<th:block th:replace="common/modal-researcher-mapping :: modalFragment"/>
|
<th:block th:replace="common/modal-researcher-mapping :: modalFragment"/>
|
||||||
|
|
||||||
@@ -321,6 +324,22 @@
|
|||||||
unitArea.classList.add('input-disabled');
|
unitArea.classList.add('input-disabled');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 금액 1개 입력시 다른 금액 input disable
|
||||||
|
const priceDisabled = (el, disableEl) => {
|
||||||
|
const wrap = disableEl.closest('td');
|
||||||
|
const disableArea = wrap.querySelector('.component-input');
|
||||||
|
const disableInput = wrap.querySelector('input');
|
||||||
|
|
||||||
|
if (el.value === '') {
|
||||||
|
disableInput.disabled = false;
|
||||||
|
disableArea.classList.remove('input-disabled');
|
||||||
|
} else {
|
||||||
|
disableInput.disabled = true;
|
||||||
|
disableInput.value = '';
|
||||||
|
disableArea.classList.add('input-disabled');
|
||||||
|
}
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
|
|||||||
@@ -24,6 +24,11 @@ public class DailyUIReqVO {
|
|||||||
this.householdSeq = householdSeq;
|
this.householdSeq = householdSeq;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public DailyUIReqVO(String searchMonth, Integer groupNo) {
|
||||||
|
this.searchMonth = searchMonth;
|
||||||
|
this.groupNo = groupNo;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 검색 월(yyyyMM)
|
* 검색 월(yyyyMM)
|
||||||
*/
|
*/
|
||||||
|
|||||||
Reference in New Issue
Block a user