Merge branch 'daily' into dev
This commit is contained in:
@@ -145,11 +145,12 @@ CREATE TABLE daily_income (
|
|||||||
is_credit boolean, -- 외상판매 여부
|
is_credit boolean, -- 외상판매 여부
|
||||||
expense_mark_code varchar(10), -- 지출부호
|
expense_mark_code varchar(10), -- 지출부호
|
||||||
crop_code varchar(255), -- 재배형태 코드 (매핑코드)
|
crop_code varchar(255), -- 재배형태 코드 (매핑코드)
|
||||||
category_code varchar(255), -- 수입 종류(매핑코드)
|
category_code varchar(255), -- 수입 종류(매핑코드) TODO : 미사용 삭제하기
|
||||||
category_self varchar(30), -- 수입 종류(직접입력)
|
category_self varchar(30), -- 수입 종류(직접입력)
|
||||||
source_purpose varchar(10), -- 수입원(용도)
|
source_purpose varchar(10), -- 수입원(용도)
|
||||||
quantity decimal(6,2), -- 수량
|
quantity decimal(6,2), -- 수량
|
||||||
unit_code varchar(255), -- 단위 (매핑코드)
|
unit_code varchar(255), -- 단위(매핑코드)
|
||||||
|
unit_self varchar(30), -- 단위(직접입력)
|
||||||
price integer, -- 현금(원)
|
price integer, -- 현금(원)
|
||||||
estimated_value integer, -- 현물(평가액)
|
estimated_value integer, -- 현물(평가액)
|
||||||
created_at timestamp(6), -- 생성일
|
created_at timestamp(6), -- 생성일
|
||||||
@@ -172,11 +173,12 @@ COMMENT ON COLUMN daily_income.input_type IS '입력 구분(SELF, OCR)';
|
|||||||
COMMENT ON COLUMN daily_income.is_credit IS '외상판매 여부';
|
COMMENT ON COLUMN daily_income.is_credit IS '외상판매 여부';
|
||||||
COMMENT ON COLUMN daily_income.expense_mark_code IS '지출부호';
|
COMMENT ON COLUMN daily_income.expense_mark_code IS '지출부호';
|
||||||
COMMENT ON COLUMN daily_income.crop_code IS '재배형태 코드 (매핑코드)';
|
COMMENT ON COLUMN daily_income.crop_code IS '재배형태 코드 (매핑코드)';
|
||||||
COMMENT ON COLUMN daily_income.category_code IS '수입 종류(매핑코드)';
|
COMMENT ON COLUMN daily_income.category_code IS '수입 종류(매핑코드)'; -- TODO : 미사용 삭제하기
|
||||||
COMMENT ON COLUMN daily_income.category_self IS '수입 종류(직접입력)';
|
COMMENT ON COLUMN daily_income.category_self IS '수입 종류(직접입력)';
|
||||||
COMMENT ON COLUMN daily_income.source_purpose IS '수입원(용도)';
|
COMMENT ON COLUMN daily_income.source_purpose IS '수입원(용도)';
|
||||||
COMMENT ON COLUMN daily_income.quantity IS '수량';
|
COMMENT ON COLUMN daily_income.quantity IS '수량';
|
||||||
COMMENT ON COLUMN daily_income.unit_code IS '단위 (매핑코드)';
|
COMMENT ON COLUMN daily_income.unit_code IS '단위(매핑코드)';
|
||||||
|
COMMENT ON COLUMN daily_income.unit_self IS '단위(직접입력)';
|
||||||
COMMENT ON COLUMN daily_income.price IS '현금(원)';
|
COMMENT ON COLUMN daily_income.price IS '현금(원)';
|
||||||
COMMENT ON COLUMN daily_income.estimated_value IS '현물(평가액)';
|
COMMENT ON COLUMN daily_income.estimated_value IS '현물(평가액)';
|
||||||
COMMENT ON COLUMN daily_income.created_at IS '생성일';
|
COMMENT ON COLUMN daily_income.created_at IS '생성일';
|
||||||
@@ -200,11 +202,12 @@ CREATE TABLE daily_expense (
|
|||||||
input_type varchar(5), -- 입력 구분(SELF, OCR)
|
input_type varchar(5), -- 입력 구분(SELF, OCR)
|
||||||
is_credit boolean, -- 외상판매 여부
|
is_credit boolean, -- 외상판매 여부
|
||||||
income_mark_code varchar(10), -- 수입부호 TODO : 수입종류와 다른것인지 판단 필요. 일단 다르다는 전제조건으로 생성
|
income_mark_code varchar(10), -- 수입부호 TODO : 수입종류와 다른것인지 판단 필요. 일단 다르다는 전제조건으로 생성
|
||||||
category_code varchar(255), -- 수입 종류(매핑코드)
|
category_code varchar(255), -- 수입 종류(매핑코드) TODO : 미사용 삭제하기
|
||||||
category_self varchar(30), -- 수입 종류(직접입력)
|
category_self varchar(30), -- 수입 종류(직접입력)
|
||||||
source_purpose varchar(10), -- 수입원(용도)
|
source_purpose varchar(10), -- 수입원(용도)
|
||||||
quantity decimal(6,2), -- 수량
|
quantity decimal(6,2), -- 수량
|
||||||
unit_code varchar(255), -- 단위 (매핑코드)
|
unit_code varchar(255), -- 단위 (매핑코드)
|
||||||
|
unit_self varchar(30), -- 단위(직접입력)
|
||||||
price integer, -- 현금(원)
|
price integer, -- 현금(원)
|
||||||
estimated_value integer, -- 현물(평가액)
|
estimated_value integer, -- 현물(평가액)
|
||||||
created_at timestamp(6), -- 생성일
|
created_at timestamp(6), -- 생성일
|
||||||
@@ -226,11 +229,12 @@ COMMENT ON COLUMN daily_expense.daily_record_seq IS '일계부 작성상태 일
|
|||||||
COMMENT ON COLUMN daily_expense.input_type IS '입력 구분(SELF, OCR)';
|
COMMENT ON COLUMN daily_expense.input_type IS '입력 구분(SELF, OCR)';
|
||||||
COMMENT ON COLUMN daily_expense.is_credit IS '외상판매 여부';
|
COMMENT ON COLUMN daily_expense.is_credit IS '외상판매 여부';
|
||||||
COMMENT ON COLUMN daily_expense.income_mark_code IS '수입부호';
|
COMMENT ON COLUMN daily_expense.income_mark_code IS '수입부호';
|
||||||
COMMENT ON COLUMN daily_expense.category_code IS '지출 종류(매핑코드)';
|
COMMENT ON COLUMN daily_expense.category_code IS '지출 종류(매핑코드)'; -- TODO : 미사용 삭제하기
|
||||||
COMMENT ON COLUMN daily_expense.category_self IS '지출 종류(직접입력)';
|
COMMENT ON COLUMN daily_expense.category_self IS '지출 종류(직접입력)';
|
||||||
COMMENT ON COLUMN daily_expense.source_purpose IS '지출원(용도)';
|
COMMENT ON COLUMN daily_expense.source_purpose IS '지출원(용도)';
|
||||||
COMMENT ON COLUMN daily_expense.quantity IS '수량';
|
COMMENT ON COLUMN daily_expense.quantity IS '수량';
|
||||||
COMMENT ON COLUMN daily_expense.unit_code IS '단위 (매핑코드)';
|
COMMENT ON COLUMN daily_expense.unit_code IS '단위(매핑코드)';
|
||||||
|
COMMENT ON COLUMN daily_expense.unit_self IS '단위(직접입력)';
|
||||||
COMMENT ON COLUMN daily_expense.price IS '현금(원)';
|
COMMENT ON COLUMN daily_expense.price IS '현금(원)';
|
||||||
COMMENT ON COLUMN daily_expense.estimated_value IS '현물(평가액)';
|
COMMENT ON COLUMN daily_expense.estimated_value IS '현물(평가액)';
|
||||||
COMMENT ON COLUMN daily_expense.created_at IS '생성일';
|
COMMENT ON COLUMN daily_expense.created_at IS '생성일';
|
||||||
|
|||||||
@@ -0,0 +1,12 @@
|
|||||||
|
package app.module.front.config.constants;
|
||||||
|
|
||||||
|
public class CommonConstants {
|
||||||
|
private CommonConstants() {
|
||||||
|
throw new IllegalAccessError("어플리케이션에서 공통으로 사용되는 상수 클래스로 생성자를 사용할 수 없습니다.");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 단위의 직접입력 코드
|
||||||
|
*/
|
||||||
|
public static final String UNIT_CODE_SELF = "code.record.unit.self";
|
||||||
|
}
|
||||||
@@ -6,7 +6,7 @@ import app.module.front.usecase.daily.calendar.ports.RecordCalendarPortOut;
|
|||||||
import app.module.front.usecase.daily.calendar.ports.application.domain.RecordCalendar;
|
import app.module.front.usecase.daily.calendar.ports.application.domain.RecordCalendar;
|
||||||
import app.module.front.usecase.daily.calendar.ports.application.domain.CalendarChildren;
|
import app.module.front.usecase.daily.calendar.ports.application.domain.CalendarChildren;
|
||||||
import app.module.front.usecase.daily.calendar.ports.application.domain.RecordCalendarCmd;
|
import app.module.front.usecase.daily.calendar.ports.application.domain.RecordCalendarCmd;
|
||||||
import app.module.front.usecase.daily.record.web.model.DailyTargetStatus;
|
import app.module.front.usecase.daily.record.adapters.web.model.DailyTargetStatus;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.springframework.stereotype.Repository;
|
import org.springframework.stereotype.Repository;
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
package app.module.front.usecase.daily.calendar.adapters.persistence.model;
|
package app.module.front.usecase.daily.calendar.adapters.persistence.model;
|
||||||
|
|
||||||
import app.module.front.usecase.daily.record.web.model.DailyStatus;
|
import app.module.front.usecase.daily.record.adapters.web.model.DailyStatus;
|
||||||
import app.module.front.usecase.daily.record.web.model.DailyTargetStatus;
|
import app.module.front.usecase.daily.record.adapters.web.model.DailyTargetStatus;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.ToString;
|
import lombok.ToString;
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
package app.module.front.usecase.daily.calendar.adapters.web.model;
|
package app.module.front.usecase.daily.calendar.adapters.web.model;
|
||||||
|
|
||||||
import app.module.front.usecase.daily.record.web.model.DailyUIReqVO;
|
import app.module.front.usecase.daily.record.adapters.web.model.DailyUIReqVO;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.ToString;
|
import lombok.ToString;
|
||||||
import org.apache.tika.utils.StringUtils;
|
import org.apache.tika.utils.StringUtils;
|
||||||
|
|||||||
@@ -1,17 +1,6 @@
|
|||||||
package app.module.front.usecase.daily.calendar.ports.application.domain;
|
package app.module.front.usecase.daily.calendar.ports.application.domain;
|
||||||
|
|
||||||
import app.module.front.usecase.daily.record.web.model.DailyCmd;
|
|
||||||
import app.module.front.usecase.daily.record.web.model.DailyUIReqVO;
|
|
||||||
import lombok.*;
|
import lombok.*;
|
||||||
import org.apache.tika.utils.StringUtils;
|
|
||||||
import org.slf4j.Logger;
|
|
||||||
import org.slf4j.LoggerFactory;
|
|
||||||
|
|
||||||
import java.text.SimpleDateFormat;
|
|
||||||
import java.time.LocalDate;
|
|
||||||
import java.time.format.DateTimeFormatter;
|
|
||||||
import java.util.Date;
|
|
||||||
import java.util.Locale;
|
|
||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
@Setter
|
@Setter
|
||||||
|
|||||||
@@ -0,0 +1,48 @@
|
|||||||
|
package app.module.front.usecase.daily.expense.adapters.persistence;
|
||||||
|
|
||||||
|
import app.module.front.usecase.daily.expense.adapters.persistence.model.DailyExpenseDto;
|
||||||
|
import app.module.front.usecase.daily.expense.ports.DailyExpensePortOut;
|
||||||
|
import app.module.front.usecase.daily.expense.ports.application.domain.CreateDailyExpenseCmd;
|
||||||
|
import app.module.front.usecase.daily.expense.ports.application.domain.GetDailyExpenseCmd;
|
||||||
|
import app.module.front.usecase.daily.expense.ports.application.domain.RemoveDailyExpenseCmd;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.stereotype.Repository;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Slf4j
|
||||||
|
@Repository
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
public class DailyExpenseDao implements DailyExpensePortOut {
|
||||||
|
private final DailyExpenseMapper dailyExpenseMapper;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<DailyExpenseDto> list(GetDailyExpenseCmd command) {
|
||||||
|
return dailyExpenseMapper.getDailyExpenseList(command);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void create(GetDailyExpenseCmd findCmd, CreateDailyExpenseCmd command) {
|
||||||
|
Integer existCount = dailyExpenseMapper.getRecordExistCount(findCmd);
|
||||||
|
if (existCount == 0) {
|
||||||
|
dailyExpenseMapper.createDailyExpense(command);
|
||||||
|
|
||||||
|
log.debug("[CreateDailyExpense] record={}", command);
|
||||||
|
} else {
|
||||||
|
dailyExpenseMapper.updateDailyExpense(command);
|
||||||
|
|
||||||
|
log.debug("[UpdateDailyExpense] record={}", command);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void remove(GetDailyExpenseCmd findCmd, RemoveDailyExpenseCmd command) {
|
||||||
|
Integer existCount = dailyExpenseMapper.getRecordExistCount(findCmd);
|
||||||
|
if (existCount != 0) {
|
||||||
|
dailyExpenseMapper.removeDailyExpense(command);
|
||||||
|
|
||||||
|
log.debug("[RemoveDailyExpense] record={}", command);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,9 +1,10 @@
|
|||||||
package app.module.front.usecase.daily.expense.persistence;
|
package app.module.front.usecase.daily.expense.adapters.persistence;
|
||||||
|
|
||||||
import app.module.front.usecase.daily.expense.persistence.model.CreateDailyExpenseCmd;
|
import app.module.front.usecase.daily.expense.ports.application.domain.CreateDailyExpenseCmd;
|
||||||
import app.module.front.usecase.daily.expense.persistence.model.DailyExpenseDto;
|
import app.module.front.usecase.daily.expense.adapters.persistence.model.DailyExpenseDto;
|
||||||
import app.module.front.usecase.daily.expense.persistence.model.RemoveDailyExpenseCmd;
|
import app.module.front.usecase.daily.expense.ports.application.domain.GetDailyExpenseCmd;
|
||||||
import app.module.front.usecase.daily.expense.web.model.DailyExpenseUIReqVO;
|
import app.module.front.usecase.daily.expense.ports.application.domain.RemoveDailyExpenseCmd;
|
||||||
|
import app.module.front.usecase.daily.expense.adapters.web.model.DailyExpenseUIReqVO;
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -13,18 +14,18 @@ public interface DailyExpenseMapper {
|
|||||||
/**
|
/**
|
||||||
* 일계부 지출 목록 조회
|
* 일계부 지출 목록 조회
|
||||||
*
|
*
|
||||||
* @param reqVO 검색 조건
|
* @param command 검색 조건
|
||||||
* @return 수입 목록
|
* @return 수입 목록
|
||||||
*/
|
*/
|
||||||
List<DailyExpenseDto> getDailyExpenseList(DailyExpenseUIReqVO reqVO);
|
List<DailyExpenseDto> getDailyExpenseList(GetDailyExpenseCmd command);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 일계부 지출 데이터 존재 여부
|
* 일계부 지출 데이터 존재 여부
|
||||||
*
|
*
|
||||||
* @param reqVO 검색 조건
|
* @param command 검색 조건
|
||||||
* @return 중복 개수
|
* @return 중복 개수
|
||||||
*/
|
*/
|
||||||
Integer getRecordExistCount(DailyExpenseUIReqVO reqVO);
|
Integer getRecordExistCount(GetDailyExpenseCmd command);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 일계부 지출 등록
|
* 일계부 지출 등록
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package app.module.front.usecase.daily.expense.persistence.model;
|
package app.module.front.usecase.daily.expense.adapters.persistence.model;
|
||||||
|
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import lombok.Setter;
|
import lombok.Setter;
|
||||||
@@ -16,6 +16,7 @@ public class DailyExpenseDto {
|
|||||||
private Integer quantity;
|
private Integer quantity;
|
||||||
private String unitCode;
|
private String unitCode;
|
||||||
private String unitLabel;
|
private String unitLabel;
|
||||||
|
private String unitSelf;
|
||||||
private Integer price;
|
private Integer price;
|
||||||
private Integer estimatedValue;
|
private Integer estimatedValue;
|
||||||
|
|
||||||
@@ -1,14 +1,14 @@
|
|||||||
package app.module.front.usecase.daily.expense.web;
|
package app.module.front.usecase.daily.expense.adapters.web;
|
||||||
|
|
||||||
import app.module.core.config.application.exception.NoRecordDataException;
|
import app.module.core.config.application.exception.NoRecordDataException;
|
||||||
import app.module.core.config.application.util.CoreUtil;
|
import app.module.core.config.application.util.CoreUtil;
|
||||||
import app.module.front.usecase.daily.expense.service.DailyExpenseService;
|
import app.module.front.usecase.daily.expense.adapters.web.model.CreateDailyExpenseReqVO;
|
||||||
import app.module.front.usecase.daily.expense.web.model.CreateDailyExpenseReqVO;
|
import app.module.front.usecase.daily.expense.adapters.web.model.RemoveDailyExpenseReqVO;
|
||||||
import app.module.front.usecase.daily.expense.web.model.RemoveDailyExpenseReqVO;
|
import app.module.front.usecase.daily.expense.adapters.web.validator.CreateDailyExpenseValidator;
|
||||||
import app.module.front.usecase.daily.expense.web.validator.CreateDailyExpenseValidator;
|
import app.module.front.usecase.daily.expense.ports.DailyExpensePortIn;
|
||||||
import app.module.front.usecase.daily.record.persistence.model.DailyRecordDto;
|
import app.module.front.usecase.daily.record.adapters.persistence.model.DailyRecordDto;
|
||||||
import app.module.front.usecase.daily.record.service.DailyRecordService;
|
import app.module.front.usecase.daily.record.adapters.web.model.DailyUIReqVO;
|
||||||
import app.module.front.usecase.daily.record.web.model.DailyRecordUIReqVO;
|
import app.module.front.usecase.daily.record.ports.DailyRecordPortIn;
|
||||||
import jakarta.validation.Valid;
|
import jakarta.validation.Valid;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
@@ -23,8 +23,8 @@ import org.springframework.web.bind.annotation.*;
|
|||||||
@RequestMapping(path = "/api/record/expense")
|
@RequestMapping(path = "/api/record/expense")
|
||||||
public class DailyExpenseController {
|
public class DailyExpenseController {
|
||||||
private final CoreUtil coreUtil;
|
private final CoreUtil coreUtil;
|
||||||
private final DailyRecordService dailyRecordService;
|
private final DailyRecordPortIn dailyRecordService;
|
||||||
private final DailyExpenseService DailyExpenseService;
|
private final DailyExpensePortIn dailyExpensePortIn;
|
||||||
private final CreateDailyExpenseValidator createDailyExpenseValidator;
|
private final CreateDailyExpenseValidator createDailyExpenseValidator;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -55,7 +55,7 @@ public class DailyExpenseController {
|
|||||||
formVO.setDailyRecordSeq(dailyRecord.getId());
|
formVO.setDailyRecordSeq(dailyRecord.getId());
|
||||||
log.debug("formVO: {}", formVO);
|
log.debug("formVO: {}", formVO);
|
||||||
|
|
||||||
DailyExpenseService.create(formVO);
|
dailyExpensePortIn.create(formVO);
|
||||||
|
|
||||||
return ResponseEntity.status(HttpStatus.OK).body(formVO);
|
return ResponseEntity.status(HttpStatus.OK).body(formVO);
|
||||||
}
|
}
|
||||||
@@ -86,7 +86,7 @@ public class DailyExpenseController {
|
|||||||
formVO.setDailyRecordSeq(dailyRecord.getId());
|
formVO.setDailyRecordSeq(dailyRecord.getId());
|
||||||
log.debug("formVO: {}", formVO);
|
log.debug("formVO: {}", formVO);
|
||||||
|
|
||||||
DailyExpenseService.remove(formVO);
|
dailyExpensePortIn.remove(formVO);
|
||||||
|
|
||||||
return ResponseEntity.status(HttpStatus.OK).body(formVO);
|
return ResponseEntity.status(HttpStatus.OK).body(formVO);
|
||||||
}
|
}
|
||||||
@@ -109,7 +109,7 @@ public class DailyExpenseController {
|
|||||||
formVO.setDailyRecordSeq(dailyRecord.getId());
|
formVO.setDailyRecordSeq(dailyRecord.getId());
|
||||||
log.debug("formVO: {}", formVO);
|
log.debug("formVO: {}", formVO);
|
||||||
|
|
||||||
DailyExpenseService.remove(formVO);
|
dailyExpensePortIn.remove(formVO);
|
||||||
|
|
||||||
return ResponseEntity.status(HttpStatus.OK).body(formVO);
|
return ResponseEntity.status(HttpStatus.OK).body(formVO);
|
||||||
}
|
}
|
||||||
@@ -122,10 +122,10 @@ public class DailyExpenseController {
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
private DailyRecordDto vaildGetDailyRecord(String searchMonth, String groupNo) {
|
private DailyRecordDto vaildGetDailyRecord(String searchMonth, String groupNo) {
|
||||||
DailyRecordUIReqVO reqVO = new DailyRecordUIReqVO(searchMonth, groupNo);
|
DailyUIReqVO reqVO = new DailyUIReqVO(searchMonth, groupNo);
|
||||||
log.debug("getRecordUIReq: {}", reqVO);
|
log.debug("getRecordUIReq: {}", reqVO);
|
||||||
|
|
||||||
DailyRecordDto dailyRecord = dailyRecordService.getDailyRecord(reqVO);
|
DailyRecordDto dailyRecord = dailyRecordService.detail(reqVO);
|
||||||
if (dailyRecord == null || dailyRecord.getId() == null) {
|
if (dailyRecord == null || dailyRecord.getId() == null) {
|
||||||
throw new NoRecordDataException();
|
throw new NoRecordDataException();
|
||||||
}
|
}
|
||||||
@@ -1,13 +1,13 @@
|
|||||||
package app.module.front.usecase.daily.expense.web;
|
package app.module.front.usecase.daily.expense.adapters.web;
|
||||||
|
|
||||||
import app.module.core.config.application.exception.NoRecordDataException;
|
import app.module.core.config.application.exception.NoRecordDataException;
|
||||||
import app.module.core.usecase.uicode.list.ports.UICodeListPortIn;
|
import app.module.core.usecase.uicode.list.ports.UICodeListPortIn;
|
||||||
import app.module.front.usecase.daily.expense.persistence.model.DailyExpenseDto;
|
import app.module.front.usecase.daily.expense.adapters.persistence.model.DailyExpenseDto;
|
||||||
import app.module.front.usecase.daily.expense.service.DailyExpenseService;
|
import app.module.front.usecase.daily.expense.adapters.web.model.DailyExpenseUIReqVO;
|
||||||
import app.module.front.usecase.daily.expense.web.model.DailyExpenseUIReqVO;
|
import app.module.front.usecase.daily.expense.ports.DailyExpensePortIn;
|
||||||
import app.module.front.usecase.daily.record.persistence.model.DailyRecordDto;
|
import app.module.front.usecase.daily.record.adapters.persistence.model.DailyRecordDto;
|
||||||
import app.module.front.usecase.daily.record.service.DailyRecordService;
|
import app.module.front.usecase.daily.record.adapters.web.model.DailyUIReqVO;
|
||||||
import app.module.front.usecase.daily.record.web.model.DailyRecordUIReqVO;
|
import app.module.front.usecase.daily.record.ports.DailyRecordPortIn;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.stereotype.Controller;
|
import org.springframework.stereotype.Controller;
|
||||||
@@ -25,8 +25,8 @@ import java.util.List;
|
|||||||
@RequestMapping(path = "/record/expense")
|
@RequestMapping(path = "/record/expense")
|
||||||
public class DailyExpenseUIController {
|
public class DailyExpenseUIController {
|
||||||
private final UICodeListPortIn uiCodeListPortIn;
|
private final UICodeListPortIn uiCodeListPortIn;
|
||||||
private final DailyRecordService dailyRecordService;
|
private final DailyRecordPortIn dailyRecordService;
|
||||||
private final DailyExpenseService DailyExpenseService;
|
private final DailyExpensePortIn dailyExpensePortIn;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 일계부 지출 목록 화면
|
* 일계부 지출 목록 화면
|
||||||
@@ -44,7 +44,7 @@ public class DailyExpenseUIController {
|
|||||||
DailyExpenseUIReqVO reqVO = new DailyExpenseUIReqVO(searchMonth, groupNo);
|
DailyExpenseUIReqVO reqVO = new DailyExpenseUIReqVO(searchMonth, groupNo);
|
||||||
log.debug("reqVO: {}", reqVO);
|
log.debug("reqVO: {}", reqVO);
|
||||||
|
|
||||||
List<DailyExpenseDto> expenseList = DailyExpenseService.getDailyExpenseList(reqVO);
|
List<DailyExpenseDto> expenseList = dailyExpensePortIn.list(reqVO);
|
||||||
|
|
||||||
model.addAttribute("reqVO", reqVO);
|
model.addAttribute("reqVO", reqVO);
|
||||||
model.addAttribute("dailyRecord", dailyRecord);
|
model.addAttribute("dailyRecord", dailyRecord);
|
||||||
@@ -76,7 +76,7 @@ public class DailyExpenseUIController {
|
|||||||
|
|
||||||
DailyExpenseDto detail = new DailyExpenseDto();
|
DailyExpenseDto detail = new DailyExpenseDto();
|
||||||
if (reqVO.getId() != 0L) {
|
if (reqVO.getId() != 0L) {
|
||||||
detail = DailyExpenseService.getDailyExpense(reqVO);
|
detail = dailyExpensePortIn.detail(reqVO);
|
||||||
if (detail == null || !detail.isUpdated()) {
|
if (detail == null || !detail.isUpdated()) {
|
||||||
throw new NoRecordDataException();
|
throw new NoRecordDataException();
|
||||||
}
|
}
|
||||||
@@ -99,10 +99,10 @@ public class DailyExpenseUIController {
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
private DailyRecordDto vaildGetDailyRecord(String searchMonth, String groupNo) {
|
private DailyRecordDto vaildGetDailyRecord(String searchMonth, String groupNo) {
|
||||||
DailyRecordUIReqVO reqVO = new DailyRecordUIReqVO(searchMonth, groupNo);
|
DailyUIReqVO reqVO = new DailyUIReqVO(searchMonth, groupNo);
|
||||||
log.debug("getRecordUIReq: {}", reqVO);
|
log.debug("getRecordUIReq: {}", reqVO);
|
||||||
|
|
||||||
DailyRecordDto dailyRecord = dailyRecordService.getDailyRecord(reqVO);
|
DailyRecordDto dailyRecord = dailyRecordService.detail(reqVO);
|
||||||
if (dailyRecord == null || dailyRecord.getId() == null) {
|
if (dailyRecord == null || dailyRecord.getId() == null) {
|
||||||
throw new NoRecordDataException();
|
throw new NoRecordDataException();
|
||||||
}
|
}
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
package app.module.front.usecase.daily.expense.web.model;
|
package app.module.front.usecase.daily.expense.adapters.web.model;
|
||||||
|
|
||||||
import app.module.front.usecase.daily.record.web.model.DailyUIReqVO;
|
import app.module.front.usecase.daily.record.adapters.web.model.DailyUIReqVO;
|
||||||
import jakarta.validation.constraints.NotBlank;
|
import jakarta.validation.constraints.NotBlank;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import lombok.Setter;
|
import lombok.Setter;
|
||||||
@@ -44,6 +44,10 @@ public class CreateDailyExpenseReqVO extends DailyUIReqVO {
|
|||||||
* 단위 코드
|
* 단위 코드
|
||||||
*/
|
*/
|
||||||
private String unitCode;
|
private String unitCode;
|
||||||
|
/**
|
||||||
|
* 단위 직접입력
|
||||||
|
*/
|
||||||
|
private String unitSelf;
|
||||||
/**
|
/**
|
||||||
* 현금
|
* 현금
|
||||||
*/
|
*/
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
package app.module.front.usecase.daily.expense.web.model;
|
package app.module.front.usecase.daily.expense.adapters.web.model;
|
||||||
|
|
||||||
import app.module.front.usecase.daily.record.web.model.DailyUIReqVO;
|
import app.module.front.usecase.daily.record.adapters.web.model.DailyUIReqVO;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import lombok.Setter;
|
import lombok.Setter;
|
||||||
import lombok.ToString;
|
import lombok.ToString;
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
package app.module.front.usecase.daily.expense.web.model;
|
package app.module.front.usecase.daily.expense.adapters.web.model;
|
||||||
|
|
||||||
import app.module.front.usecase.daily.record.web.model.DailyUIReqVO;
|
import app.module.front.usecase.daily.record.adapters.web.model.DailyUIReqVO;
|
||||||
import jakarta.validation.constraints.NotBlank;
|
import jakarta.validation.constraints.NotBlank;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import lombok.Setter;
|
import lombok.Setter;
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
package app.module.front.usecase.daily.expense.web.validator;
|
package app.module.front.usecase.daily.expense.adapters.web.validator;
|
||||||
|
|
||||||
import app.module.front.usecase.daily.expense.web.model.CreateDailyExpenseReqVO;
|
import app.module.front.usecase.daily.expense.adapters.web.model.CreateDailyExpenseReqVO;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.apache.tika.utils.StringUtils;
|
import org.apache.tika.utils.StringUtils;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
@@ -23,10 +23,16 @@ public class CreateDailyExpenseValidator implements Validator {
|
|||||||
if (vo.getPrice() == null && vo.getEstimatedValue() == null) {
|
if (vo.getPrice() == null && vo.getEstimatedValue() == null) {
|
||||||
errors.rejectValue(
|
errors.rejectValue(
|
||||||
"price", "valid.common.required",
|
"price", "valid.common.required",
|
||||||
"현금 또는 현물평가액을 입력 해주세요.");
|
"현금 또는 현물평가액을 입력해 주세요.");
|
||||||
errors.rejectValue(
|
errors.rejectValue(
|
||||||
"estimatedValue", "valid.common.required",
|
"estimatedValue", "valid.common.required",
|
||||||
"현금 또는 현물평가액을 입력 해주세요.");
|
"현금 또는 현물평가액을 입력해 주세요.");
|
||||||
|
}
|
||||||
|
|
||||||
|
if ("code.record.unit.self".equals(vo.getUnitCode()) && StringUtils.isBlank(vo.getUnitSelf())) {
|
||||||
|
errors.rejectValue(
|
||||||
|
"unitSelf", "valid.common.required",
|
||||||
|
"단위를 입력해 주세요.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,40 @@
|
|||||||
|
package app.module.front.usecase.daily.expense.ports;
|
||||||
|
|
||||||
|
import app.module.front.usecase.daily.expense.adapters.persistence.model.DailyExpenseDto;
|
||||||
|
import app.module.front.usecase.daily.expense.adapters.web.model.CreateDailyExpenseReqVO;
|
||||||
|
import app.module.front.usecase.daily.expense.adapters.web.model.DailyExpenseUIReqVO;
|
||||||
|
import app.module.front.usecase.daily.expense.adapters.web.model.RemoveDailyExpenseReqVO;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public interface DailyExpensePortIn {
|
||||||
|
/**
|
||||||
|
* 일계부 지출 조회
|
||||||
|
*
|
||||||
|
* @param reqVO 검색 조건
|
||||||
|
* @return 지출 목록
|
||||||
|
*/
|
||||||
|
List<DailyExpenseDto> list(DailyExpenseUIReqVO reqVO);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 일계부 지출 조회
|
||||||
|
*
|
||||||
|
* @param reqVO 검색 조건
|
||||||
|
* @return 지출 상세
|
||||||
|
*/
|
||||||
|
DailyExpenseDto detail(DailyExpenseUIReqVO reqVO);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 일계부 지출 등록
|
||||||
|
*
|
||||||
|
* @param formVO 입력 데이터
|
||||||
|
*/
|
||||||
|
void create(CreateDailyExpenseReqVO formVO);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 일계부 지출 삭제
|
||||||
|
*
|
||||||
|
* @param formVO 삭제 검색 조건
|
||||||
|
*/
|
||||||
|
void remove(RemoveDailyExpenseReqVO formVO);
|
||||||
|
}
|
||||||
@@ -0,0 +1,34 @@
|
|||||||
|
package app.module.front.usecase.daily.expense.ports;
|
||||||
|
|
||||||
|
import app.module.front.usecase.daily.expense.adapters.persistence.model.DailyExpenseDto;
|
||||||
|
import app.module.front.usecase.daily.expense.ports.application.domain.CreateDailyExpenseCmd;
|
||||||
|
import app.module.front.usecase.daily.expense.ports.application.domain.GetDailyExpenseCmd;
|
||||||
|
import app.module.front.usecase.daily.expense.ports.application.domain.RemoveDailyExpenseCmd;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public interface DailyExpensePortOut {
|
||||||
|
/**
|
||||||
|
* 일계부 지출 조회
|
||||||
|
*
|
||||||
|
* @param command 검색 조건
|
||||||
|
* @return 지출 목록
|
||||||
|
*/
|
||||||
|
List<DailyExpenseDto> list(GetDailyExpenseCmd command);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 일계부 지출 등록
|
||||||
|
*
|
||||||
|
* @param findCmd 검색 조건
|
||||||
|
* @param command 입력 데이터
|
||||||
|
*/
|
||||||
|
void create(GetDailyExpenseCmd findCmd, CreateDailyExpenseCmd command);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 일계부 지출 삭제
|
||||||
|
*
|
||||||
|
* @param findCmd 검색 조건
|
||||||
|
* @param command 삭제 검색 조건
|
||||||
|
*/
|
||||||
|
void remove(GetDailyExpenseCmd findCmd, RemoveDailyExpenseCmd command);
|
||||||
|
}
|
||||||
@@ -0,0 +1,130 @@
|
|||||||
|
package app.module.front.usecase.daily.expense.ports.application;
|
||||||
|
|
||||||
|
import app.module.core.usecase.uicode.list.ports.UICodeListPortIn;
|
||||||
|
import app.module.core.usecase.uicode.list.ports.application.domain.UICodeElement;
|
||||||
|
import app.module.front.config.application.util.AuditUtil;
|
||||||
|
import app.module.front.config.constants.CommonConstants;
|
||||||
|
import app.module.front.usecase.daily.expense.adapters.persistence.model.DailyExpenseDto;
|
||||||
|
import app.module.front.usecase.daily.expense.adapters.web.model.CreateDailyExpenseReqVO;
|
||||||
|
import app.module.front.usecase.daily.expense.adapters.web.model.DailyExpenseUIReqVO;
|
||||||
|
import app.module.front.usecase.daily.expense.adapters.web.model.RemoveDailyExpenseReqVO;
|
||||||
|
import app.module.front.usecase.daily.expense.ports.DailyExpensePortIn;
|
||||||
|
import app.module.front.usecase.daily.expense.ports.DailyExpensePortOut;
|
||||||
|
import app.module.front.usecase.daily.expense.ports.application.domain.CreateDailyExpenseCmd;
|
||||||
|
import app.module.front.usecase.daily.expense.ports.application.domain.GetDailyExpenseCmd;
|
||||||
|
import app.module.front.usecase.daily.expense.ports.application.domain.RemoveDailyExpenseCmd;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
public class DailyExpenseService implements DailyExpensePortIn {
|
||||||
|
private final DailyExpensePortOut portOut;
|
||||||
|
private final UICodeListPortIn uiCodeListPortIn;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<DailyExpenseDto> list(DailyExpenseUIReqVO reqVO) {
|
||||||
|
return this.getRefineList(reqVO);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public DailyExpenseDto detail(DailyExpenseUIReqVO reqVO) {
|
||||||
|
List<DailyExpenseDto> list = this.getRefineList(reqVO);
|
||||||
|
if (list.isEmpty()) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return list.get(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 목록 데이터 조회
|
||||||
|
*
|
||||||
|
* @param reqVO 검색 조건
|
||||||
|
* @return 공통 처리된 목록
|
||||||
|
*/
|
||||||
|
private List<DailyExpenseDto> getRefineList(DailyExpenseUIReqVO reqVO) {
|
||||||
|
List<DailyExpenseDto> list = portOut.list(new GetDailyExpenseCmd(reqVO.getSearchMonth(),
|
||||||
|
reqVO.getGroupNo(),
|
||||||
|
reqVO.getHouseholdSeq(),
|
||||||
|
reqVO.getId()));
|
||||||
|
|
||||||
|
List<UICodeElement> recordUnit = uiCodeListPortIn.connect("code.record.unit");
|
||||||
|
|
||||||
|
for (DailyExpenseDto dto : list) {
|
||||||
|
if (CommonConstants.UNIT_CODE_SELF.equals(dto.getUnitCode())) {
|
||||||
|
dto.setUnitLabel(dto.getUnitSelf());
|
||||||
|
} else {
|
||||||
|
dto.setUnitLabel(this.getCodeLabel(dto.getUnitCode(), recordUnit));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 코드명 조회
|
||||||
|
*
|
||||||
|
* @param codeId 코드
|
||||||
|
* @param codeList 공통 코드 목록
|
||||||
|
* @return 코드명
|
||||||
|
*/
|
||||||
|
private String getCodeLabel(String codeId, List<UICodeElement> codeList) {
|
||||||
|
String returnValue = null;
|
||||||
|
for (UICodeElement codeSetup : codeList) {
|
||||||
|
if (codeSetup.getId().equalsIgnoreCase(codeId)) {
|
||||||
|
returnValue = codeSetup.getCodeText();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return returnValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void create(CreateDailyExpenseReqVO formVO) {
|
||||||
|
GetDailyExpenseCmd findCmd = new GetDailyExpenseCmd(
|
||||||
|
formVO.getSearchMonth(),
|
||||||
|
formVO.getGroupNo(),
|
||||||
|
formVO.getHouseholdSeq(),
|
||||||
|
formVO.getId());
|
||||||
|
|
||||||
|
CreateDailyExpenseCmd command = AuditUtil.create(
|
||||||
|
new CreateDailyExpenseCmd(
|
||||||
|
formVO.getId(),
|
||||||
|
formVO.getDailyRecordSeq(),
|
||||||
|
formVO.getInputType(),
|
||||||
|
formVO.getCredit(),
|
||||||
|
(formVO.getCredit() ? "52210" : null), // [정책] 외상판매 Y 일 경우 수입부호 52210 적재
|
||||||
|
formVO.getCategorySelf(),
|
||||||
|
formVO.getSourcePurpose(),
|
||||||
|
formVO.getQuantity(),
|
||||||
|
formVO.getUnitCode(),
|
||||||
|
formVO.getUnitSelf(),
|
||||||
|
formVO.getPrice(),
|
||||||
|
formVO.getEstimatedValue()));
|
||||||
|
|
||||||
|
portOut.create(findCmd, command);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void remove(RemoveDailyExpenseReqVO formVO) {
|
||||||
|
Long id = formVO.getId() != null ? Long.parseLong(formVO.getId()) : null;
|
||||||
|
|
||||||
|
GetDailyExpenseCmd findCmd = new GetDailyExpenseCmd(
|
||||||
|
formVO.getSearchMonth(),
|
||||||
|
formVO.getGroupNo(),
|
||||||
|
formVO.getHouseholdSeq(),
|
||||||
|
id);
|
||||||
|
|
||||||
|
RemoveDailyExpenseCmd command = AuditUtil.delete(
|
||||||
|
new RemoveDailyExpenseCmd(
|
||||||
|
formVO.getSearchMonth(),
|
||||||
|
formVO.getGroupNo(),
|
||||||
|
id,
|
||||||
|
formVO.getDailyRecordSeq()));
|
||||||
|
|
||||||
|
portOut.remove(findCmd, command);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package app.module.front.usecase.daily.expense.persistence.model;
|
package app.module.front.usecase.daily.expense.ports.application.domain;
|
||||||
|
|
||||||
import app.module.front.config.adapters.persistence.component.FrontAuditCommand;
|
import app.module.front.config.adapters.persistence.component.FrontAuditCommand;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
@@ -20,6 +20,7 @@ public class CreateDailyExpenseCmd extends FrontAuditCommand {
|
|||||||
private String sourcePurpose;
|
private String sourcePurpose;
|
||||||
private Integer quantity;
|
private Integer quantity;
|
||||||
private String unitCode;
|
private String unitCode;
|
||||||
|
private String unitSelf;
|
||||||
private Integer price;
|
private Integer price;
|
||||||
private Integer estimatedValue;
|
private Integer estimatedValue;
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,27 @@
|
|||||||
|
package app.module.front.usecase.daily.expense.ports.application.domain;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.Setter;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
@AllArgsConstructor
|
||||||
|
public class GetDailyExpenseCmd {
|
||||||
|
/**
|
||||||
|
* 검색 월(yyyyMM)
|
||||||
|
*/
|
||||||
|
private String searchMonth;
|
||||||
|
/**
|
||||||
|
* 검색 그룸번호
|
||||||
|
*/
|
||||||
|
private Integer groupNo;
|
||||||
|
/**
|
||||||
|
* 임가 일련번호
|
||||||
|
*/
|
||||||
|
private Long householdSeq;
|
||||||
|
/**
|
||||||
|
* 수입 일련번호
|
||||||
|
*/
|
||||||
|
private Long id;
|
||||||
|
}
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package app.module.front.usecase.daily.expense.persistence.model;
|
package app.module.front.usecase.daily.expense.ports.application.domain;
|
||||||
|
|
||||||
import app.module.front.config.adapters.persistence.component.FrontAuditCommand;
|
import app.module.front.config.adapters.persistence.component.FrontAuditCommand;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
@@ -1,40 +0,0 @@
|
|||||||
package app.module.front.usecase.daily.expense.service;
|
|
||||||
|
|
||||||
import app.module.front.usecase.daily.expense.persistence.model.DailyExpenseDto;
|
|
||||||
import app.module.front.usecase.daily.expense.web.model.CreateDailyExpenseReqVO;
|
|
||||||
import app.module.front.usecase.daily.expense.web.model.DailyExpenseUIReqVO;
|
|
||||||
import app.module.front.usecase.daily.expense.web.model.RemoveDailyExpenseReqVO;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
public interface DailyExpenseService {
|
|
||||||
/**
|
|
||||||
* 일계부 수입 목록 조회
|
|
||||||
*
|
|
||||||
* @param reqVO 검색 조건
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
List<DailyExpenseDto> getDailyExpenseList(DailyExpenseUIReqVO reqVO);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 일계부 수입 조회
|
|
||||||
*
|
|
||||||
* @param reqVO 검색 조건
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
DailyExpenseDto getDailyExpense(DailyExpenseUIReqVO reqVO);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 일계부 수입 등록
|
|
||||||
*
|
|
||||||
* @param formVO 입력 데이터
|
|
||||||
*/
|
|
||||||
void create(CreateDailyExpenseReqVO formVO);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 일계부 수입 삭제
|
|
||||||
*
|
|
||||||
* @param formVO 삭제 검색 조건
|
|
||||||
*/
|
|
||||||
void remove(RemoveDailyExpenseReqVO formVO);
|
|
||||||
}
|
|
||||||
@@ -1,122 +0,0 @@
|
|||||||
package app.module.front.usecase.daily.expense.service;
|
|
||||||
|
|
||||||
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.expense.persistence.DailyExpenseMapper;
|
|
||||||
import app.module.front.usecase.daily.expense.persistence.model.CreateDailyExpenseCmd;
|
|
||||||
import app.module.front.usecase.daily.expense.persistence.model.DailyExpenseDto;
|
|
||||||
import app.module.front.usecase.daily.expense.persistence.model.RemoveDailyExpenseCmd;
|
|
||||||
import app.module.front.usecase.daily.expense.web.model.CreateDailyExpenseReqVO;
|
|
||||||
import app.module.front.usecase.daily.expense.web.model.DailyExpenseUIReqVO;
|
|
||||||
import app.module.front.usecase.daily.expense.web.model.RemoveDailyExpenseReqVO;
|
|
||||||
import lombok.RequiredArgsConstructor;
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
|
||||||
import org.springframework.stereotype.Service;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
@Slf4j
|
|
||||||
@Service
|
|
||||||
@RequiredArgsConstructor
|
|
||||||
public class DailyExpenseServiceImpl implements DailyExpenseService {
|
|
||||||
private final UICodeListPortIn uiCodeListPortIn;
|
|
||||||
private final DailyExpenseMapper DailyExpenseMapper;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<DailyExpenseDto> getDailyExpenseList(DailyExpenseUIReqVO reqVO) {
|
|
||||||
return this.getRefineIncomeList(reqVO);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public DailyExpenseDto getDailyExpense(DailyExpenseUIReqVO reqVO) {
|
|
||||||
List<DailyExpenseDto> list = this.getRefineIncomeList(reqVO);
|
|
||||||
if (list.isEmpty()) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
return list.get(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
private List<DailyExpenseDto> getRefineIncomeList(DailyExpenseUIReqVO reqVO) {
|
|
||||||
List<DailyExpenseDto> list = DailyExpenseMapper.getDailyExpenseList(reqVO);
|
|
||||||
|
|
||||||
List<UICodeElement> recordUnit = uiCodeListPortIn.connect("code.record.unit");
|
|
||||||
|
|
||||||
for (DailyExpenseDto dto : list) {
|
|
||||||
dto.setUnitLabel(this.getCodeLabel(dto.getUnitCode(), recordUnit));
|
|
||||||
}
|
|
||||||
|
|
||||||
return list;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 코드명 조회
|
|
||||||
*
|
|
||||||
* @param codeId 코드
|
|
||||||
* @param codeList 공통 코드 목록
|
|
||||||
* @return 코드명
|
|
||||||
*/
|
|
||||||
private String getCodeLabel(String codeId, List<UICodeElement> codeList) {
|
|
||||||
String returnValue = null;
|
|
||||||
for (UICodeElement codeSetup : codeList) {
|
|
||||||
if (codeSetup.getId().equalsIgnoreCase(codeId)) {
|
|
||||||
returnValue = codeSetup.getCodeText();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return returnValue;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void create(CreateDailyExpenseReqVO formVO) {
|
|
||||||
CreateDailyExpenseCmd command = AuditUtil.create(
|
|
||||||
new CreateDailyExpenseCmd(
|
|
||||||
formVO.getId(),
|
|
||||||
formVO.getDailyRecordSeq(),
|
|
||||||
formVO.getInputType(),
|
|
||||||
formVO.getCredit(),
|
|
||||||
(formVO.getCredit() ? "52210" : null), // [정책] 외상판매 Y 일 경우 수입부호 52210 적재
|
|
||||||
formVO.getCategorySelf(),
|
|
||||||
formVO.getSourcePurpose(),
|
|
||||||
formVO.getQuantity(),
|
|
||||||
formVO.getUnitCode(),
|
|
||||||
formVO.getPrice(),
|
|
||||||
formVO.getEstimatedValue()));
|
|
||||||
|
|
||||||
DailyExpenseUIReqVO existReqVO = new DailyExpenseUIReqVO(formVO.getSearchMonth(), formVO.getGroupNo());
|
|
||||||
existReqVO.setId(formVO.getId());
|
|
||||||
|
|
||||||
Integer existCount = DailyExpenseMapper.getRecordExistCount(existReqVO);
|
|
||||||
if (existCount == 0) {
|
|
||||||
DailyExpenseMapper.createDailyExpense(command);
|
|
||||||
|
|
||||||
log.debug("[CreateDailyExpense] record={}", command);
|
|
||||||
} else {
|
|
||||||
DailyExpenseMapper.updateDailyExpense(command);
|
|
||||||
|
|
||||||
log.debug("[UpdateDailyExpense] record={}", command);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void remove(RemoveDailyExpenseReqVO formVO) {
|
|
||||||
Long id = formVO.getId() != null ? Long.parseLong(formVO.getId()) : null;
|
|
||||||
RemoveDailyExpenseCmd command = AuditUtil.delete(
|
|
||||||
new RemoveDailyExpenseCmd(
|
|
||||||
formVO.getSearchMonth(),
|
|
||||||
formVO.getGroupNo(),
|
|
||||||
id,
|
|
||||||
formVO.getDailyRecordSeq()));
|
|
||||||
|
|
||||||
DailyExpenseUIReqVO existReqVO = new DailyExpenseUIReqVO(formVO.getSearchMonth(), formVO.getGroupNo());
|
|
||||||
existReqVO.setId(id);
|
|
||||||
|
|
||||||
Integer existCount = DailyExpenseMapper.getRecordExistCount(existReqVO);
|
|
||||||
if (existCount != 0) {
|
|
||||||
DailyExpenseMapper.removeDailyExpense(command);
|
|
||||||
|
|
||||||
log.debug("[RemoveDailyExpense] record={}", command);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,48 @@
|
|||||||
|
package app.module.front.usecase.daily.income.adapters.persistence;
|
||||||
|
|
||||||
|
import app.module.front.usecase.daily.income.adapters.persistence.model.DailyIncomeDto;
|
||||||
|
import app.module.front.usecase.daily.income.ports.DailyIncomePortOut;
|
||||||
|
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 lombok.RequiredArgsConstructor;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Slf4j
|
||||||
|
@Service
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
public class DailyIncomeDao implements DailyIncomePortOut {
|
||||||
|
private final DailyIncomeMapper dailyIncomeMapper;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<DailyIncomeDto> list(GetDailyIncomeCmd command) {
|
||||||
|
return dailyIncomeMapper.getDailyIncomeList(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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void remove(GetDailyIncomeCmd findCmd, RemoveDailyIncomeCmd command) {
|
||||||
|
Integer existCount = dailyIncomeMapper.getRecordExistCount(findCmd);
|
||||||
|
if (existCount != 0) {
|
||||||
|
dailyIncomeMapper.removeDailyIncome(command);
|
||||||
|
|
||||||
|
log.debug("[RemoveDailyIncome] record={}", command);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,9 +1,9 @@
|
|||||||
package app.module.front.usecase.daily.income.persistence;
|
package app.module.front.usecase.daily.income.adapters.persistence;
|
||||||
|
|
||||||
import app.module.front.usecase.daily.income.persistence.model.CreateDailyIncomeCmd;
|
import app.module.front.usecase.daily.income.ports.application.domain.CreateDailyIncomeCmd;
|
||||||
import app.module.front.usecase.daily.income.persistence.model.DailyIncomeDto;
|
import app.module.front.usecase.daily.income.adapters.persistence.model.DailyIncomeDto;
|
||||||
import app.module.front.usecase.daily.income.persistence.model.RemoveDailyIncomeCmd;
|
import app.module.front.usecase.daily.income.ports.application.domain.GetDailyIncomeCmd;
|
||||||
import app.module.front.usecase.daily.income.web.model.DailyIncomeUIReqVO;
|
import app.module.front.usecase.daily.income.ports.application.domain.RemoveDailyIncomeCmd;
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -13,18 +13,18 @@ public interface DailyIncomeMapper {
|
|||||||
/**
|
/**
|
||||||
* 일계부 수입 목록 조회
|
* 일계부 수입 목록 조회
|
||||||
*
|
*
|
||||||
* @param reqVO 검색 조건
|
* @param command 검색 조건
|
||||||
* @return 수입 목록
|
* @return 수입 목록
|
||||||
*/
|
*/
|
||||||
List<DailyIncomeDto> getDailyIncomeList(DailyIncomeUIReqVO reqVO);
|
List<DailyIncomeDto> getDailyIncomeList(GetDailyIncomeCmd command);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 일계부 수입 데이터 존재 여부
|
* 일계부 수입 데이터 존재 여부
|
||||||
*
|
*
|
||||||
* @param reqVO 검색 조건
|
* @param command 검색 조건
|
||||||
* @return 중복 개수
|
* @return 중복 개수
|
||||||
*/
|
*/
|
||||||
Integer getRecordExistCount(DailyIncomeUIReqVO reqVO);
|
Integer getRecordExistCount(GetDailyIncomeCmd command);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 일계부 수입 등록
|
* 일계부 수입 등록
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package app.module.front.usecase.daily.income.persistence.model;
|
package app.module.front.usecase.daily.income.adapters.persistence.model;
|
||||||
|
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import lombok.Setter;
|
import lombok.Setter;
|
||||||
@@ -20,6 +20,7 @@ public class DailyIncomeDto {
|
|||||||
private Integer quantity;
|
private Integer quantity;
|
||||||
private String unitCode;
|
private String unitCode;
|
||||||
private String unitLabel;
|
private String unitLabel;
|
||||||
|
private String unitSelf;
|
||||||
private Integer price;
|
private Integer price;
|
||||||
private Integer estimatedValue;
|
private Integer estimatedValue;
|
||||||
|
|
||||||
@@ -1,15 +1,14 @@
|
|||||||
package app.module.front.usecase.daily.income.web;
|
package app.module.front.usecase.daily.income.adapters.web;
|
||||||
|
|
||||||
import app.module.core.config.application.exception.NoRecordDataException;
|
import app.module.core.config.application.exception.NoRecordDataException;
|
||||||
import app.module.core.config.application.util.CoreUtil;
|
import app.module.core.config.application.util.CoreUtil;
|
||||||
import app.module.front.usecase.daily.income.service.DailyIncomeService;
|
import app.module.front.usecase.daily.income.adapters.web.model.CreateDailyIncomeReqVO;
|
||||||
import app.module.front.usecase.daily.income.web.model.CreateDailyIncomeReqVO;
|
import app.module.front.usecase.daily.income.adapters.web.model.RemoveDailyIncomeReqVO;
|
||||||
import app.module.front.usecase.daily.income.web.model.RemoveDailyIncomeReqVO;
|
import app.module.front.usecase.daily.income.adapters.web.validator.CreateDailyIncomeValidator;
|
||||||
import app.module.front.usecase.daily.income.web.validator.CreateDailyIncomeValidator;
|
import app.module.front.usecase.daily.income.ports.DailyIncomePortIn;
|
||||||
import app.module.front.usecase.daily.record.persistence.model.DailyRecordDto;
|
import app.module.front.usecase.daily.record.adapters.persistence.model.DailyRecordDto;
|
||||||
import app.module.front.usecase.daily.record.service.DailyRecordService;
|
import app.module.front.usecase.daily.record.adapters.web.model.DailyUIReqVO;
|
||||||
import app.module.front.usecase.daily.record.web.model.DailyRecordUIReqVO;
|
import app.module.front.usecase.daily.record.ports.DailyRecordPortIn;
|
||||||
import app.module.front.usecase.daily.record.web.model.DailyTargetStatus;
|
|
||||||
import jakarta.validation.Valid;
|
import jakarta.validation.Valid;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
@@ -24,8 +23,8 @@ import org.springframework.web.bind.annotation.*;
|
|||||||
@RequestMapping(path = "/api/record/income")
|
@RequestMapping(path = "/api/record/income")
|
||||||
public class DailyIncomeController {
|
public class DailyIncomeController {
|
||||||
private final CoreUtil coreUtil;
|
private final CoreUtil coreUtil;
|
||||||
private final DailyRecordService dailyRecordService;
|
private final DailyRecordPortIn dailyRecordPortIn;
|
||||||
private final DailyIncomeService dailyIncomeService;
|
private final DailyIncomePortIn dailyIncomePortIn;
|
||||||
private final CreateDailyIncomeValidator createDailyIncomeValidator;
|
private final CreateDailyIncomeValidator createDailyIncomeValidator;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -56,7 +55,7 @@ public class DailyIncomeController {
|
|||||||
formVO.setDailyRecordSeq(dailyRecord.getId());
|
formVO.setDailyRecordSeq(dailyRecord.getId());
|
||||||
log.debug("formVO: {}", formVO);
|
log.debug("formVO: {}", formVO);
|
||||||
|
|
||||||
dailyIncomeService.create(formVO);
|
dailyIncomePortIn.create(formVO);
|
||||||
|
|
||||||
return ResponseEntity.status(HttpStatus.OK).body(formVO);
|
return ResponseEntity.status(HttpStatus.OK).body(formVO);
|
||||||
}
|
}
|
||||||
@@ -87,7 +86,7 @@ public class DailyIncomeController {
|
|||||||
formVO.setDailyRecordSeq(dailyRecord.getId());
|
formVO.setDailyRecordSeq(dailyRecord.getId());
|
||||||
log.debug("formVO: {}", formVO);
|
log.debug("formVO: {}", formVO);
|
||||||
|
|
||||||
dailyIncomeService.remove(formVO);
|
dailyIncomePortIn.remove(formVO);
|
||||||
|
|
||||||
return ResponseEntity.status(HttpStatus.OK).body(formVO);
|
return ResponseEntity.status(HttpStatus.OK).body(formVO);
|
||||||
}
|
}
|
||||||
@@ -110,7 +109,7 @@ public class DailyIncomeController {
|
|||||||
formVO.setDailyRecordSeq(dailyRecord.getId());
|
formVO.setDailyRecordSeq(dailyRecord.getId());
|
||||||
log.debug("formVO: {}", formVO);
|
log.debug("formVO: {}", formVO);
|
||||||
|
|
||||||
dailyIncomeService.remove(formVO);
|
dailyIncomePortIn.remove(formVO);
|
||||||
|
|
||||||
return ResponseEntity.status(HttpStatus.OK).body(formVO);
|
return ResponseEntity.status(HttpStatus.OK).body(formVO);
|
||||||
}
|
}
|
||||||
@@ -123,10 +122,10 @@ public class DailyIncomeController {
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
private DailyRecordDto vaildGetDailyRecord(String searchMonth, String groupNo) {
|
private DailyRecordDto vaildGetDailyRecord(String searchMonth, String groupNo) {
|
||||||
DailyRecordUIReqVO reqVO = new DailyRecordUIReqVO(searchMonth, groupNo);
|
DailyUIReqVO reqVO = new DailyUIReqVO(searchMonth, groupNo);
|
||||||
log.debug("getRecordUIReq: {}", reqVO);
|
log.debug("getRecordUIReq: {}", reqVO);
|
||||||
|
|
||||||
DailyRecordDto dailyRecord = dailyRecordService.getDailyRecord(reqVO);
|
DailyRecordDto dailyRecord = dailyRecordPortIn.detail(reqVO);
|
||||||
if (dailyRecord == null || dailyRecord.getId() == null) {
|
if (dailyRecord == null || dailyRecord.getId() == null) {
|
||||||
throw new NoRecordDataException();
|
throw new NoRecordDataException();
|
||||||
}
|
}
|
||||||
@@ -1,18 +1,20 @@
|
|||||||
package app.module.front.usecase.daily.income.web;
|
package app.module.front.usecase.daily.income.adapters.web;
|
||||||
|
|
||||||
import app.module.core.config.application.exception.NoRecordDataException;
|
import app.module.core.config.application.exception.NoRecordDataException;
|
||||||
import app.module.core.usecase.uicode.list.ports.UICodeListPortIn;
|
import app.module.core.usecase.uicode.list.ports.UICodeListPortIn;
|
||||||
import app.module.front.usecase.daily.income.persistence.model.DailyIncomeDto;
|
import app.module.front.usecase.daily.income.adapters.persistence.model.DailyIncomeDto;
|
||||||
import app.module.front.usecase.daily.income.service.DailyIncomeService;
|
import app.module.front.usecase.daily.income.adapters.web.model.DailyIncomeUIReqVO;
|
||||||
import app.module.front.usecase.daily.income.web.model.DailyIncomeUIReqVO;
|
import app.module.front.usecase.daily.income.ports.DailyIncomePortIn;
|
||||||
import app.module.front.usecase.daily.record.persistence.model.DailyRecordDto;
|
import app.module.front.usecase.daily.record.adapters.persistence.model.DailyRecordDto;
|
||||||
import app.module.front.usecase.daily.record.service.DailyRecordService;
|
import app.module.front.usecase.daily.record.adapters.web.model.DailyUIReqVO;
|
||||||
import app.module.front.usecase.daily.record.web.model.DailyRecordUIReqVO;
|
import app.module.front.usecase.daily.record.ports.DailyRecordPortIn;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.stereotype.Controller;
|
import org.springframework.stereotype.Controller;
|
||||||
import org.springframework.ui.Model;
|
import org.springframework.ui.Model;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PathVariable;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import org.thymeleaf.util.StringUtils;
|
import org.thymeleaf.util.StringUtils;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -23,8 +25,8 @@ import java.util.List;
|
|||||||
@RequestMapping(path = "/record/income")
|
@RequestMapping(path = "/record/income")
|
||||||
public class DailyIncomeUIController {
|
public class DailyIncomeUIController {
|
||||||
private final UICodeListPortIn uiCodeListPortIn;
|
private final UICodeListPortIn uiCodeListPortIn;
|
||||||
private final DailyRecordService dailyRecordService;
|
private final DailyRecordPortIn dailyRecordService;
|
||||||
private final DailyIncomeService dailyIncomeService;
|
private final DailyIncomePortIn dailyIncomePortIn;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 일계부 수입 목록 화면
|
* 일계부 수입 목록 화면
|
||||||
@@ -42,7 +44,7 @@ public class DailyIncomeUIController {
|
|||||||
DailyIncomeUIReqVO reqVO = new DailyIncomeUIReqVO(searchMonth, groupNo);
|
DailyIncomeUIReqVO reqVO = new DailyIncomeUIReqVO(searchMonth, groupNo);
|
||||||
log.debug("reqVO: {}", reqVO);
|
log.debug("reqVO: {}", reqVO);
|
||||||
|
|
||||||
List<DailyIncomeDto> incomeList = dailyIncomeService.getDailyIncomeList(reqVO);
|
List<DailyIncomeDto> incomeList = dailyIncomePortIn.list(reqVO);
|
||||||
|
|
||||||
model.addAttribute("reqVO", reqVO);
|
model.addAttribute("reqVO", reqVO);
|
||||||
model.addAttribute("dailyRecord", dailyRecord);
|
model.addAttribute("dailyRecord", dailyRecord);
|
||||||
@@ -74,7 +76,7 @@ public class DailyIncomeUIController {
|
|||||||
|
|
||||||
DailyIncomeDto detail = new DailyIncomeDto();
|
DailyIncomeDto detail = new DailyIncomeDto();
|
||||||
if (reqVO.getId() != 0L) {
|
if (reqVO.getId() != 0L) {
|
||||||
detail = dailyIncomeService.getDailyIncome(reqVO);
|
detail = dailyIncomePortIn.detail(reqVO);
|
||||||
if (detail == null || !detail.isUpdated()) {
|
if (detail == null || !detail.isUpdated()) {
|
||||||
throw new NoRecordDataException();
|
throw new NoRecordDataException();
|
||||||
}
|
}
|
||||||
@@ -97,10 +99,10 @@ public class DailyIncomeUIController {
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
private DailyRecordDto vaildGetDailyRecord(String searchMonth, String groupNo) {
|
private DailyRecordDto vaildGetDailyRecord(String searchMonth, String groupNo) {
|
||||||
DailyRecordUIReqVO reqVO = new DailyRecordUIReqVO(searchMonth, groupNo);
|
DailyUIReqVO reqVO = new DailyUIReqVO(searchMonth, groupNo);
|
||||||
log.debug("getRecordUIReq: {}", reqVO);
|
log.debug("getRecordUIReq: {}", reqVO);
|
||||||
|
|
||||||
DailyRecordDto dailyRecord = dailyRecordService.getDailyRecord(reqVO);
|
DailyRecordDto dailyRecord = dailyRecordService.detail(reqVO);
|
||||||
if (dailyRecord == null || dailyRecord.getId() == null) {
|
if (dailyRecord == null || dailyRecord.getId() == null) {
|
||||||
throw new NoRecordDataException();
|
throw new NoRecordDataException();
|
||||||
}
|
}
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
package app.module.front.usecase.daily.income.web.model;
|
package app.module.front.usecase.daily.income.adapters.web.model;
|
||||||
|
|
||||||
import app.module.front.usecase.daily.record.web.model.DailyUIReqVO;
|
import app.module.front.usecase.daily.record.adapters.web.model.DailyUIReqVO;
|
||||||
import jakarta.validation.constraints.NotBlank;
|
import jakarta.validation.constraints.NotBlank;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import lombok.Setter;
|
import lombok.Setter;
|
||||||
@@ -48,6 +48,10 @@ public class CreateDailyIncomeReqVO extends DailyUIReqVO {
|
|||||||
* 단위 코드
|
* 단위 코드
|
||||||
*/
|
*/
|
||||||
private String unitCode;
|
private String unitCode;
|
||||||
|
/**
|
||||||
|
* 단위 직접입력
|
||||||
|
*/
|
||||||
|
private String unitSelf;
|
||||||
/**
|
/**
|
||||||
* 현금
|
* 현금
|
||||||
*/
|
*/
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
package app.module.front.usecase.daily.income.web.model;
|
package app.module.front.usecase.daily.income.adapters.web.model;
|
||||||
|
|
||||||
import app.module.front.usecase.daily.record.web.model.DailyUIReqVO;
|
import app.module.front.usecase.daily.record.adapters.web.model.DailyUIReqVO;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import lombok.Setter;
|
import lombok.Setter;
|
||||||
import lombok.ToString;
|
import lombok.ToString;
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
package app.module.front.usecase.daily.income.web.model;
|
package app.module.front.usecase.daily.income.adapters.web.model;
|
||||||
|
|
||||||
import app.module.front.usecase.daily.record.web.model.DailyUIReqVO;
|
import app.module.front.usecase.daily.record.adapters.web.model.DailyUIReqVO;
|
||||||
import jakarta.validation.constraints.NotBlank;
|
import jakarta.validation.constraints.NotBlank;
|
||||||
import lombok.*;
|
import lombok.*;
|
||||||
|
|
||||||
@@ -1,9 +1,7 @@
|
|||||||
package app.module.front.usecase.daily.income.web.validator;
|
package app.module.front.usecase.daily.income.adapters.web.validator;
|
||||||
|
|
||||||
import app.module.core.config.application.util.MessageUtil;
|
import app.module.front.config.constants.CommonConstants;
|
||||||
import app.module.front.usecase.daily.income.web.model.CreateDailyIncomeReqVO;
|
import app.module.front.usecase.daily.income.adapters.web.model.CreateDailyIncomeReqVO;
|
||||||
import app.module.front.usecase.daily.record.web.model.CreateDailyRecordReqVO;
|
|
||||||
import app.module.front.usecase.daily.record.web.model.DailyStatus;
|
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.apache.tika.utils.StringUtils;
|
import org.apache.tika.utils.StringUtils;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
@@ -26,10 +24,16 @@ public class CreateDailyIncomeValidator implements Validator {
|
|||||||
if (vo.getPrice() == null && vo.getEstimatedValue() == null) {
|
if (vo.getPrice() == null && vo.getEstimatedValue() == null) {
|
||||||
errors.rejectValue(
|
errors.rejectValue(
|
||||||
"price", "valid.common.required",
|
"price", "valid.common.required",
|
||||||
"현금 또는 현물평가액을 입력 해주세요.");
|
"현금 또는 현물평가액을 입력해 주세요.");
|
||||||
errors.rejectValue(
|
errors.rejectValue(
|
||||||
"estimatedValue", "valid.common.required",
|
"estimatedValue", "valid.common.required",
|
||||||
"현금 또는 현물평가액을 입력 해주세요.");
|
"현금 또는 현물평가액을 입력해 주세요.");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (CommonConstants.UNIT_CODE_SELF.equals(vo.getUnitCode()) && StringUtils.isBlank(vo.getUnitSelf())) {
|
||||||
|
errors.rejectValue(
|
||||||
|
"unitSelf", "valid.common.required",
|
||||||
|
"단위를 입력해 주세요.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,40 @@
|
|||||||
|
package app.module.front.usecase.daily.income.ports;
|
||||||
|
|
||||||
|
import app.module.front.usecase.daily.income.adapters.persistence.model.DailyIncomeDto;
|
||||||
|
import app.module.front.usecase.daily.income.adapters.web.model.CreateDailyIncomeReqVO;
|
||||||
|
import app.module.front.usecase.daily.income.adapters.web.model.DailyIncomeUIReqVO;
|
||||||
|
import app.module.front.usecase.daily.income.adapters.web.model.RemoveDailyIncomeReqVO;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public interface DailyIncomePortIn {
|
||||||
|
/**
|
||||||
|
* 일계부 수입 조회
|
||||||
|
*
|
||||||
|
* @param reqVO 검색 조건
|
||||||
|
* @return 수입 목록
|
||||||
|
*/
|
||||||
|
List<DailyIncomeDto> list(DailyIncomeUIReqVO reqVO);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 일계부 수입 조회
|
||||||
|
*
|
||||||
|
* @param reqVO 검색 조건
|
||||||
|
* @return 수입 상세
|
||||||
|
*/
|
||||||
|
DailyIncomeDto detail(DailyIncomeUIReqVO reqVO);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 일계부 수입 등록
|
||||||
|
*
|
||||||
|
* @param formVO 입력 데이터
|
||||||
|
*/
|
||||||
|
void create(CreateDailyIncomeReqVO formVO);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 일계부 수입 삭제
|
||||||
|
*
|
||||||
|
* @param formVO 삭제 검색 조건
|
||||||
|
*/
|
||||||
|
void remove(RemoveDailyIncomeReqVO formVO);
|
||||||
|
}
|
||||||
@@ -0,0 +1,34 @@
|
|||||||
|
package app.module.front.usecase.daily.income.ports;
|
||||||
|
|
||||||
|
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 java.util.List;
|
||||||
|
|
||||||
|
public interface DailyIncomePortOut {
|
||||||
|
/**
|
||||||
|
* 일계부 수입 조회
|
||||||
|
*
|
||||||
|
* @param command 검색 조건
|
||||||
|
* @return 수입 목록
|
||||||
|
*/
|
||||||
|
List<DailyIncomeDto> list(GetDailyIncomeCmd command);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 일계부 수입 등록
|
||||||
|
*
|
||||||
|
* @param findCmd 검색 조건
|
||||||
|
* @param command 입력 데이터
|
||||||
|
*/
|
||||||
|
void create(GetDailyIncomeCmd findCmd, CreateDailyIncomeCmd command);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 일계부 수입 삭제
|
||||||
|
*
|
||||||
|
* @param findCmd 검색 조건
|
||||||
|
* @param command 삭제 검색 조건
|
||||||
|
*/
|
||||||
|
void remove(GetDailyIncomeCmd findCmd, RemoveDailyIncomeCmd command);
|
||||||
|
}
|
||||||
@@ -1,52 +1,67 @@
|
|||||||
package app.module.front.usecase.daily.income.service;
|
package app.module.front.usecase.daily.income.ports.application;
|
||||||
|
|
||||||
import app.module.core.usecase.uicode.list.ports.UICodeListPortIn;
|
import app.module.core.usecase.uicode.list.ports.UICodeListPortIn;
|
||||||
import app.module.core.usecase.uicode.list.ports.application.domain.UICodeElement;
|
import app.module.core.usecase.uicode.list.ports.application.domain.UICodeElement;
|
||||||
import app.module.front.config.application.util.AuditUtil;
|
import app.module.front.config.application.util.AuditUtil;
|
||||||
import app.module.front.usecase.daily.income.persistence.DailyIncomeMapper;
|
import app.module.front.config.constants.CommonConstants;
|
||||||
import app.module.front.usecase.daily.income.persistence.model.CreateDailyIncomeCmd;
|
import app.module.front.usecase.daily.income.adapters.persistence.model.DailyIncomeDto;
|
||||||
import app.module.front.usecase.daily.income.persistence.model.DailyIncomeDto;
|
import app.module.front.usecase.daily.income.adapters.web.model.CreateDailyIncomeReqVO;
|
||||||
import app.module.front.usecase.daily.income.persistence.model.RemoveDailyIncomeCmd;
|
import app.module.front.usecase.daily.income.adapters.web.model.DailyIncomeUIReqVO;
|
||||||
import app.module.front.usecase.daily.income.web.model.CreateDailyIncomeReqVO;
|
import app.module.front.usecase.daily.income.adapters.web.model.RemoveDailyIncomeReqVO;
|
||||||
import app.module.front.usecase.daily.income.web.model.DailyIncomeUIReqVO;
|
import app.module.front.usecase.daily.income.ports.DailyIncomePortIn;
|
||||||
import app.module.front.usecase.daily.income.web.model.RemoveDailyIncomeReqVO;
|
import app.module.front.usecase.daily.income.ports.DailyIncomePortOut;
|
||||||
|
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 lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@Slf4j
|
|
||||||
@Service
|
@Service
|
||||||
@RequiredArgsConstructor
|
@RequiredArgsConstructor
|
||||||
public class DailyIncomeServiceImpl implements DailyIncomeService {
|
public class DailyIncomeService implements DailyIncomePortIn {
|
||||||
|
private final DailyIncomePortOut portOut;
|
||||||
private final UICodeListPortIn uiCodeListPortIn;
|
private final UICodeListPortIn uiCodeListPortIn;
|
||||||
private final DailyIncomeMapper dailyIncomeMapper;
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<DailyIncomeDto> getDailyIncomeList(DailyIncomeUIReqVO reqVO) {
|
public List<DailyIncomeDto> list(DailyIncomeUIReqVO reqVO) {
|
||||||
return this.getRefineIncomeList(reqVO);
|
return this.getRefineList(reqVO);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public DailyIncomeDto getDailyIncome(DailyIncomeUIReqVO reqVO) {
|
public DailyIncomeDto detail(DailyIncomeUIReqVO reqVO) {
|
||||||
List<DailyIncomeDto> list = this.getRefineIncomeList(reqVO);
|
List<DailyIncomeDto> list = this.getRefineList(reqVO);
|
||||||
if (list.isEmpty()) {
|
if (list.isEmpty()) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
return list.get(0);
|
return list.get(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<DailyIncomeDto> getRefineIncomeList(DailyIncomeUIReqVO reqVO) {
|
/**
|
||||||
List<DailyIncomeDto> list = dailyIncomeMapper.getDailyIncomeList(reqVO);
|
* 목록 데이터 조회
|
||||||
|
*
|
||||||
|
* @param reqVO 검색 조건
|
||||||
|
* @return 공통 처리된 목록
|
||||||
|
*/
|
||||||
|
private List<DailyIncomeDto> getRefineList(DailyIncomeUIReqVO reqVO) {
|
||||||
|
List<DailyIncomeDto> list = portOut.list(new GetDailyIncomeCmd(reqVO.getSearchMonth(),
|
||||||
|
reqVO.getGroupNo(),
|
||||||
|
reqVO.getHouseholdSeq(),
|
||||||
|
reqVO.getId()));
|
||||||
|
|
||||||
List<UICodeElement> recordCrop = uiCodeListPortIn.connect("code.record.crop");
|
List<UICodeElement> recordCrop = uiCodeListPortIn.connect("code.record.crop");
|
||||||
List<UICodeElement> recordUnit = uiCodeListPortIn.connect("code.record.unit");
|
List<UICodeElement> recordUnit = uiCodeListPortIn.connect("code.record.unit");
|
||||||
|
|
||||||
for (DailyIncomeDto dto : list) {
|
for (DailyIncomeDto dto : list) {
|
||||||
dto.setCropLabel(this.getCodeLabel(dto.getCropCode(), recordCrop));
|
dto.setCropLabel(this.getCodeLabel(dto.getCropCode(), recordCrop));
|
||||||
dto.setUnitLabel(this.getCodeLabel(dto.getUnitCode(), recordUnit));
|
|
||||||
|
if (CommonConstants.UNIT_CODE_SELF.equals(dto.getUnitCode())) {
|
||||||
|
dto.setUnitLabel(dto.getUnitSelf());
|
||||||
|
} else {
|
||||||
|
dto.setUnitLabel(this.getCodeLabel(dto.getUnitCode(), recordUnit));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return list;
|
return list;
|
||||||
@@ -72,6 +87,12 @@ public class DailyIncomeServiceImpl implements DailyIncomeService {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void create(CreateDailyIncomeReqVO formVO) {
|
public void create(CreateDailyIncomeReqVO formVO) {
|
||||||
|
GetDailyIncomeCmd findCmd = new GetDailyIncomeCmd(
|
||||||
|
formVO.getSearchMonth(),
|
||||||
|
formVO.getGroupNo(),
|
||||||
|
formVO.getHouseholdSeq(),
|
||||||
|
formVO.getId());
|
||||||
|
|
||||||
CreateDailyIncomeCmd command = AuditUtil.create(
|
CreateDailyIncomeCmd command = AuditUtil.create(
|
||||||
new CreateDailyIncomeCmd(
|
new CreateDailyIncomeCmd(
|
||||||
formVO.getId(),
|
formVO.getId(),
|
||||||
@@ -84,27 +105,23 @@ public class DailyIncomeServiceImpl implements DailyIncomeService {
|
|||||||
formVO.getSourcePurpose(),
|
formVO.getSourcePurpose(),
|
||||||
formVO.getQuantity(),
|
formVO.getQuantity(),
|
||||||
formVO.getUnitCode(),
|
formVO.getUnitCode(),
|
||||||
|
formVO.getUnitSelf(),
|
||||||
formVO.getPrice(),
|
formVO.getPrice(),
|
||||||
formVO.getEstimatedValue()));
|
formVO.getEstimatedValue()));
|
||||||
|
|
||||||
DailyIncomeUIReqVO existReqVO = new DailyIncomeUIReqVO(formVO.getSearchMonth(), formVO.getGroupNo());
|
portOut.create(findCmd, command);
|
||||||
existReqVO.setId(formVO.getId());
|
|
||||||
|
|
||||||
Integer existCount = dailyIncomeMapper.getRecordExistCount(existReqVO);
|
|
||||||
if (existCount == 0) {
|
|
||||||
dailyIncomeMapper.createDailyIncome(command);
|
|
||||||
|
|
||||||
log.debug("[CreateDailyIncome] record={}", command);
|
|
||||||
} else {
|
|
||||||
dailyIncomeMapper.updateDailyIncome(command);
|
|
||||||
|
|
||||||
log.debug("[UpdateDailyIncome] record={}", command);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void remove(RemoveDailyIncomeReqVO formVO) {
|
public void remove(RemoveDailyIncomeReqVO formVO) {
|
||||||
Long id = formVO.getId() != null ? Long.parseLong(formVO.getId()) : null;
|
Long id = formVO.getId() != null ? Long.parseLong(formVO.getId()) : null;
|
||||||
|
|
||||||
|
GetDailyIncomeCmd findCmd = new GetDailyIncomeCmd(
|
||||||
|
formVO.getSearchMonth(),
|
||||||
|
formVO.getGroupNo(),
|
||||||
|
formVO.getHouseholdSeq(),
|
||||||
|
id);
|
||||||
|
|
||||||
RemoveDailyIncomeCmd command = AuditUtil.delete(
|
RemoveDailyIncomeCmd command = AuditUtil.delete(
|
||||||
new RemoveDailyIncomeCmd(
|
new RemoveDailyIncomeCmd(
|
||||||
formVO.getSearchMonth(),
|
formVO.getSearchMonth(),
|
||||||
@@ -112,14 +129,6 @@ public class DailyIncomeServiceImpl implements DailyIncomeService {
|
|||||||
id,
|
id,
|
||||||
formVO.getDailyRecordSeq()));
|
formVO.getDailyRecordSeq()));
|
||||||
|
|
||||||
DailyIncomeUIReqVO existReqVO = new DailyIncomeUIReqVO(formVO.getSearchMonth(), formVO.getGroupNo());
|
portOut.remove(findCmd, command);
|
||||||
existReqVO.setId(id);
|
|
||||||
|
|
||||||
Integer existCount = dailyIncomeMapper.getRecordExistCount(existReqVO);
|
|
||||||
if (existCount != 0) {
|
|
||||||
dailyIncomeMapper.removeDailyIncome(command);
|
|
||||||
|
|
||||||
log.debug("[RemoveDailyIncome] record={}", command);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,7 +1,6 @@
|
|||||||
package app.module.front.usecase.daily.income.persistence.model;
|
package app.module.front.usecase.daily.income.ports.application.domain;
|
||||||
|
|
||||||
import app.module.front.config.adapters.persistence.component.FrontAuditCommand;
|
import app.module.front.config.adapters.persistence.component.FrontAuditCommand;
|
||||||
import app.module.front.usecase.daily.income.web.model.CreateDailyIncomeReqVO;
|
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import lombok.Setter;
|
import lombok.Setter;
|
||||||
@@ -22,6 +21,7 @@ public class CreateDailyIncomeCmd extends FrontAuditCommand {
|
|||||||
private String sourcePurpose;
|
private String sourcePurpose;
|
||||||
private Integer quantity;
|
private Integer quantity;
|
||||||
private String unitCode;
|
private String unitCode;
|
||||||
|
private String unitSelf;
|
||||||
private Integer price;
|
private Integer price;
|
||||||
private Integer estimatedValue;
|
private Integer estimatedValue;
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,27 @@
|
|||||||
|
package app.module.front.usecase.daily.income.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;
|
||||||
|
}
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package app.module.front.usecase.daily.income.persistence.model;
|
package app.module.front.usecase.daily.income.ports.application.domain;
|
||||||
|
|
||||||
import app.module.front.config.adapters.persistence.component.FrontAuditCommand;
|
import app.module.front.config.adapters.persistence.component.FrontAuditCommand;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
@@ -1,40 +0,0 @@
|
|||||||
package app.module.front.usecase.daily.income.service;
|
|
||||||
|
|
||||||
import app.module.front.usecase.daily.income.persistence.model.DailyIncomeDto;
|
|
||||||
import app.module.front.usecase.daily.income.web.model.CreateDailyIncomeReqVO;
|
|
||||||
import app.module.front.usecase.daily.income.web.model.DailyIncomeUIReqVO;
|
|
||||||
import app.module.front.usecase.daily.income.web.model.RemoveDailyIncomeReqVO;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
public interface DailyIncomeService {
|
|
||||||
/**
|
|
||||||
* 일계부 수입 목록 조회
|
|
||||||
*
|
|
||||||
* @param reqVO 검색 조건
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
List<DailyIncomeDto> getDailyIncomeList(DailyIncomeUIReqVO reqVO);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 일계부 수입 조회
|
|
||||||
*
|
|
||||||
* @param reqVO 검색 조건
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
DailyIncomeDto getDailyIncome(DailyIncomeUIReqVO reqVO);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 일계부 수입 등록
|
|
||||||
*
|
|
||||||
* @param formVO 입력 데이터
|
|
||||||
*/
|
|
||||||
void create(CreateDailyIncomeReqVO formVO);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 일계부 수입 삭제
|
|
||||||
*
|
|
||||||
* @param formVO 삭제 검색 조건
|
|
||||||
*/
|
|
||||||
void remove(RemoveDailyIncomeReqVO formVO);
|
|
||||||
}
|
|
||||||
@@ -1,15 +1,15 @@
|
|||||||
package app.module.front.usecase.daily.record.service;
|
package app.module.front.usecase.daily.record.adapters.persistence;
|
||||||
|
|
||||||
import app.module.front.config.application.util.AuditUtil;
|
import app.module.front.config.application.util.AuditUtil;
|
||||||
import app.module.front.usecase.daily.record.persistence.DailyRecordMapper;
|
import app.module.front.usecase.daily.record.adapters.persistence.model.DailyRecordDto;
|
||||||
import app.module.front.usecase.daily.record.persistence.model.CreateDailyRecordCmd;
|
import app.module.front.usecase.daily.record.adapters.web.model.CreateDailyRecordReqVO;
|
||||||
import app.module.front.usecase.daily.record.persistence.model.DailyRecordDto;
|
import app.module.front.usecase.daily.record.ports.DailyRecordPortOut;
|
||||||
import app.module.front.usecase.daily.record.persistence.model.UpdateDailyRecordStatusCmd;
|
import app.module.front.usecase.daily.record.ports.application.domain.CreateDailyRecordCmd;
|
||||||
import app.module.front.usecase.daily.record.web.model.CreateDailyRecordReqVO;
|
import app.module.front.usecase.daily.record.ports.application.domain.GetDailyRecordCmd;
|
||||||
import app.module.front.usecase.daily.record.web.model.DailyRecordUIReqVO;
|
import app.module.front.usecase.daily.record.ports.application.domain.UpdateDailyRecordStatusCmd;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Repository;
|
||||||
|
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
import java.time.LocalDate;
|
import java.time.LocalDate;
|
||||||
@@ -17,23 +17,23 @@ import java.util.Date;
|
|||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
|
|
||||||
@Slf4j
|
@Slf4j
|
||||||
@Service
|
@Repository
|
||||||
@RequiredArgsConstructor
|
@RequiredArgsConstructor
|
||||||
public class DailyRecordServiceImpl implements DailyRecordService {
|
public class DailyRecordDao implements DailyRecordPortOut {
|
||||||
private final DailyRecordMapper dailyRecordMapper;
|
private final DailyRecordMapper dailyRecordMapper;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public DailyRecordDto getDailyRecord(DailyRecordUIReqVO reqVO) {
|
public DailyRecordDto detail(GetDailyRecordCmd command) {
|
||||||
DailyRecordDto detail = dailyRecordMapper.getDailyRecord(reqVO);
|
DailyRecordDto detail = dailyRecordMapper.getDailyRecord(command);
|
||||||
if (detail != null && !detail.isUpdated()) {
|
if (detail != null && !detail.isUpdated()) {
|
||||||
try {
|
try {
|
||||||
SimpleDateFormat beforeSdf = new SimpleDateFormat("yyyyMMdd", Locale.KOREAN);
|
SimpleDateFormat beforeSdf = new SimpleDateFormat("yyyyMMdd", Locale.KOREAN);
|
||||||
SimpleDateFormat afterSdf = new SimpleDateFormat("yyyy-MM-dd", Locale.KOREAN);
|
SimpleDateFormat afterSdf = new SimpleDateFormat("yyyy-MM-dd", Locale.KOREAN);
|
||||||
|
|
||||||
Date formatDate = beforeSdf.parse(reqVO.getSearchMonth() + String.format("%02d", detail.getStartDay()));
|
Date formatDate = beforeSdf.parse(command.getSearchMonth() + String.format("%02d", detail.getStartDay()));
|
||||||
detail.setStartDate(LocalDate.parse(afterSdf.format(formatDate)));
|
detail.setStartDate(LocalDate.parse(afterSdf.format(formatDate)));
|
||||||
|
|
||||||
formatDate = beforeSdf.parse(reqVO.getSearchMonth() + String.format("%02d", detail.getEndDay()));
|
formatDate = beforeSdf.parse(command.getSearchMonth() + String.format("%02d", detail.getEndDay()));
|
||||||
detail.setEndDate(LocalDate.parse(afterSdf.format(formatDate)));
|
detail.setEndDate(LocalDate.parse(afterSdf.format(formatDate)));
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
@@ -44,23 +44,8 @@ public class DailyRecordServiceImpl implements DailyRecordService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void createDailyRecord(CreateDailyRecordReqVO reqVO) {
|
public void create(GetDailyRecordCmd findCmd, CreateDailyRecordCmd command) {
|
||||||
CreateDailyRecordCmd command = AuditUtil.create(
|
Integer existCount = dailyRecordMapper.getDailyRecordExistCount(findCmd);
|
||||||
new CreateDailyRecordCmd(
|
|
||||||
null,
|
|
||||||
reqVO.getRecordMonth(),
|
|
||||||
reqVO.getDayGroupNo(),
|
|
||||||
reqVO.getStartDate(),
|
|
||||||
reqVO.getEndDate(),
|
|
||||||
reqVO.getAllStatus(),
|
|
||||||
reqVO.getIncomeStatus(),
|
|
||||||
reqVO.getWorkStatus(),
|
|
||||||
reqVO.getExpenseStatus(),
|
|
||||||
reqVO.getPowerStatus(),
|
|
||||||
reqVO.getForestryStatus(),
|
|
||||||
reqVO.getFarmingStatus()));
|
|
||||||
|
|
||||||
Integer existCount = dailyRecordMapper.getDailyRecordExistCount(new DailyRecordUIReqVO(reqVO.getRecordMonth(), reqVO.getDayGroupNo()));
|
|
||||||
if (existCount == 0) {
|
if (existCount == 0) {
|
||||||
dailyRecordMapper.createDailyRecord(command);
|
dailyRecordMapper.createDailyRecord(command);
|
||||||
|
|
||||||
@@ -69,12 +54,12 @@ public class DailyRecordServiceImpl implements DailyRecordService {
|
|||||||
// TODO : NONE 으로 변경시 연관 테이블 데이터 삭제할 것인가?
|
// TODO : NONE 으로 변경시 연관 테이블 데이터 삭제할 것인가?
|
||||||
dailyRecordMapper.updateDailyRecord(command);
|
dailyRecordMapper.updateDailyRecord(command);
|
||||||
|
|
||||||
log.warn("[DailyRecordCreate] existCount={}, recordMonth={}, dayGroupNo={}", existCount, reqVO.getRecordMonth(), reqVO.getDayGroupNo());
|
log.warn("[DailyRecordCreate] existCount={}, recordMonth={}, dayGroupNo={}", existCount, findCmd.getSearchMonth(), findCmd.getGroupNo());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void updateDailyRecordStatus(String recordMonth, Integer dayGroupNo, String targetType, String targetStatus) {
|
public void updateByStatus(String recordMonth, Integer dayGroupNo, String targetType, String targetStatus) {
|
||||||
UpdateDailyRecordStatusCmd command = AuditUtil.update(
|
UpdateDailyRecordStatusCmd command = AuditUtil.update(
|
||||||
new UpdateDailyRecordStatusCmd(
|
new UpdateDailyRecordStatusCmd(
|
||||||
recordMonth,
|
recordMonth,
|
||||||
@@ -0,0 +1,47 @@
|
|||||||
|
package app.module.front.usecase.daily.record.adapters.persistence;
|
||||||
|
|
||||||
|
import app.module.front.usecase.daily.record.adapters.persistence.model.DailyRecordDto;
|
||||||
|
import app.module.front.usecase.daily.record.ports.application.domain.CreateDailyRecordCmd;
|
||||||
|
import app.module.front.usecase.daily.record.ports.application.domain.GetDailyRecordCmd;
|
||||||
|
import app.module.front.usecase.daily.record.ports.application.domain.UpdateDailyRecordStatusCmd;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
|
@Mapper
|
||||||
|
public interface DailyRecordMapper {
|
||||||
|
/**
|
||||||
|
* 일계부 항목 조회
|
||||||
|
*
|
||||||
|
* @param command 검색 조건
|
||||||
|
* @return 항목 상세
|
||||||
|
*/
|
||||||
|
DailyRecordDto getDailyRecord(GetDailyRecordCmd command);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 일계부 항목 등록 여부
|
||||||
|
*
|
||||||
|
* @param command 검색 조건
|
||||||
|
* @return 등록 여부
|
||||||
|
*/
|
||||||
|
Integer getDailyRecordExistCount(GetDailyRecordCmd command);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 일계부 항목 등록(생성)
|
||||||
|
*
|
||||||
|
* @param command 등록 데이터
|
||||||
|
*/
|
||||||
|
void createDailyRecord(CreateDailyRecordCmd command);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 일계부 항목 수정
|
||||||
|
*
|
||||||
|
* @param command 수정 데이터
|
||||||
|
*/
|
||||||
|
void updateDailyRecord(CreateDailyRecordCmd command);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 일계부 항목의 상태 수정
|
||||||
|
*
|
||||||
|
* @param command 수정 데이터
|
||||||
|
*/
|
||||||
|
void updateDailyRecordStatus(UpdateDailyRecordStatusCmd command);
|
||||||
|
}
|
||||||
@@ -1,9 +1,8 @@
|
|||||||
package app.module.front.usecase.daily.record.persistence.model;
|
package app.module.front.usecase.daily.record.adapters.persistence.model;
|
||||||
|
|
||||||
import app.module.front.usecase.daily.record.web.model.DailyStatus;
|
import app.module.front.usecase.daily.record.adapters.web.model.DailyStatus;
|
||||||
import app.module.front.usecase.daily.record.web.model.DailyTargetStatus;
|
import app.module.front.usecase.daily.record.adapters.web.model.DailyTargetStatus;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.Setter;
|
|
||||||
|
|
||||||
import java.time.LocalDate;
|
import java.time.LocalDate;
|
||||||
|
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package app.module.front.usecase.daily.record.persistence.model;
|
package app.module.front.usecase.daily.record.adapters.persistence.model;
|
||||||
|
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import lombok.Setter;
|
import lombok.Setter;
|
||||||
@@ -1,19 +1,17 @@
|
|||||||
package app.module.front.usecase.daily.record.web;
|
package app.module.front.usecase.daily.record.adapters.web;
|
||||||
|
|
||||||
import app.module.core.config.application.exception.NoMatchingURIException;
|
import app.module.front.usecase.daily.record.adapters.persistence.model.DailyRecordDto;
|
||||||
import app.module.front.usecase.daily.record.persistence.model.DailyRecordDto;
|
import app.module.front.usecase.daily.record.adapters.web.model.CreateDailyRecordReqVO;
|
||||||
import app.module.front.usecase.daily.record.service.DailyRecordService;
|
import app.module.front.usecase.daily.record.adapters.web.model.DailyTargetStatus;
|
||||||
import app.module.front.usecase.daily.record.web.model.CreateDailyRecordReqVO;
|
import app.module.front.usecase.daily.record.adapters.web.model.DailyUIReqVO;
|
||||||
import app.module.front.usecase.daily.record.web.model.DailyRecordUIReqVO;
|
import app.module.front.usecase.daily.record.adapters.web.validator.CreateDailyRecordValidator;
|
||||||
import app.module.front.usecase.daily.record.web.model.DailyTargetStatus;
|
import app.module.front.usecase.daily.record.ports.DailyRecordPortIn;
|
||||||
import app.module.front.usecase.daily.record.web.validator.CreateDailyRecordValidator;
|
import app.module.front.usecase.daily.record.ports.application.domain.GetDailyRecordCmd;
|
||||||
import jakarta.validation.Valid;
|
import jakarta.validation.Valid;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.http.HttpStatus;
|
import org.springframework.http.HttpStatus;
|
||||||
import org.springframework.http.ResponseEntity;
|
import org.springframework.http.ResponseEntity;
|
||||||
import org.springframework.stereotype.Controller;
|
|
||||||
import org.springframework.ui.Model;
|
|
||||||
import org.springframework.validation.BindingResult;
|
import org.springframework.validation.BindingResult;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
@@ -22,7 +20,7 @@ import org.springframework.web.bind.annotation.*;
|
|||||||
@RequiredArgsConstructor
|
@RequiredArgsConstructor
|
||||||
@RequestMapping(path = "/api/record/daily")
|
@RequestMapping(path = "/api/record/daily")
|
||||||
public class DailyRecordController {
|
public class DailyRecordController {
|
||||||
private final DailyRecordService dailyRecordService;
|
private final DailyRecordPortIn dailyRecordPortIn;
|
||||||
private final CreateDailyRecordValidator createDailyRecordValidator;
|
private final CreateDailyRecordValidator createDailyRecordValidator;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -44,17 +42,17 @@ public class DailyRecordController {
|
|||||||
.body(bindingResult.getFieldErrors());
|
.body(bindingResult.getFieldErrors());
|
||||||
}
|
}
|
||||||
|
|
||||||
DailyRecordUIReqVO reqVO = new DailyRecordUIReqVO(searchMonth, groupNo);
|
DailyUIReqVO reqVO = new DailyUIReqVO(searchMonth, groupNo);
|
||||||
log.debug("reqVO: {}", reqVO);
|
log.debug("reqVO: {}", reqVO);
|
||||||
|
|
||||||
DailyRecordDto detail = dailyRecordService.getDailyRecord(reqVO);
|
DailyRecordDto detail = dailyRecordPortIn.detail(reqVO);
|
||||||
formVO.setRecordMonth(reqVO.getSearchMonth());
|
formVO.setRecordMonth(reqVO.getSearchMonth());
|
||||||
formVO.setDayGroupNo(reqVO.getGroupNo());
|
formVO.setDayGroupNo(reqVO.getGroupNo());
|
||||||
formVO.setStartDate(detail.getStartDate());
|
formVO.setStartDate(detail.getStartDate());
|
||||||
formVO.setEndDate(detail.getEndDate());
|
formVO.setEndDate(detail.getEndDate());
|
||||||
log.debug("formVO: {}", formVO);
|
log.debug("formVO: {}", formVO);
|
||||||
|
|
||||||
dailyRecordService.createDailyRecord(formVO);
|
dailyRecordPortIn.create(formVO);
|
||||||
|
|
||||||
return ResponseEntity.status(HttpStatus.OK).body(reqVO);
|
return ResponseEntity.status(HttpStatus.OK).body(reqVO);
|
||||||
}
|
}
|
||||||
@@ -64,15 +62,15 @@ public class DailyRecordController {
|
|||||||
, @RequestParam(name = "target", required = true, defaultValue = "") String targetType
|
, @RequestParam(name = "target", required = true, defaultValue = "") String targetType
|
||||||
, @RequestParam(name = "status", required = false, defaultValue = "N") String targetStatus) {
|
, @RequestParam(name = "status", required = false, defaultValue = "N") String targetStatus) {
|
||||||
|
|
||||||
DailyRecordUIReqVO reqVO = new DailyRecordUIReqVO(searchMonth, groupNo);
|
DailyUIReqVO reqVO = new DailyUIReqVO(searchMonth, groupNo);
|
||||||
log.debug("reqVO: {}", reqVO);
|
log.debug("reqVO: {}", reqVO);
|
||||||
log.debug("target: {}", targetType);
|
log.debug("target: {}", targetType);
|
||||||
log.debug("status: {}", targetStatus);
|
log.debug("status: {}", targetStatus);
|
||||||
|
|
||||||
DailyRecordDto detail = dailyRecordService.getDailyRecord(reqVO);
|
DailyRecordDto detail = dailyRecordPortIn.detail(reqVO);
|
||||||
|
|
||||||
// TODO : true / false 를 업데이트하는 것은 대상 타켓이 되는 것이라 판단하여 그냥 강제 업데이트할 것인가? valid 체크
|
// TODO : true / false 를 업데이트하는 것은 대상 타켓이 되는 것이라 판단하여 그냥 강제 업데이트할 것인가? valid 체크
|
||||||
dailyRecordService.updateDailyRecordStatus(detail.getRecordMonth(), detail.getGroupNo(), targetType, "Y".equals(targetStatus) ? DailyTargetStatus.TODAY_NONE.name() : DailyTargetStatus.TARGET.name());
|
dailyRecordPortIn.updateByStatus(detail.getRecordMonth(), detail.getGroupNo(), targetType, "Y".equals(targetStatus) ? DailyTargetStatus.TODAY_NONE.name() : DailyTargetStatus.TARGET.name());
|
||||||
|
|
||||||
return ResponseEntity.status(HttpStatus.OK).body(reqVO);
|
return ResponseEntity.status(HttpStatus.OK).body(reqVO);
|
||||||
}
|
}
|
||||||
@@ -1,27 +1,24 @@
|
|||||||
package app.module.front.usecase.daily.record.web;
|
package app.module.front.usecase.daily.record.adapters.web;
|
||||||
|
|
||||||
import app.module.core.config.application.exception.NoMatchingURIException;
|
import app.module.core.config.application.exception.NoMatchingURIException;
|
||||||
import app.module.front.usecase.daily.record.persistence.model.DailyRecordDto;
|
import app.module.front.usecase.daily.record.adapters.persistence.model.DailyRecordDto;
|
||||||
import app.module.front.usecase.daily.record.service.DailyRecordService;
|
import app.module.front.usecase.daily.record.adapters.web.model.DailyUIReqVO;
|
||||||
import app.module.front.usecase.daily.record.web.model.CreateDailyRecordReqVO;
|
import app.module.front.usecase.daily.record.adapters.web.validator.CreateDailyRecordValidator;
|
||||||
import app.module.front.usecase.daily.record.web.model.DailyRecordUIReqVO;
|
import app.module.front.usecase.daily.record.ports.DailyRecordPortIn;
|
||||||
import app.module.front.usecase.daily.record.web.validator.CreateDailyRecordValidator;
|
|
||||||
import jakarta.validation.Valid;
|
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.http.HttpStatus;
|
|
||||||
import org.springframework.http.ResponseEntity;
|
|
||||||
import org.springframework.stereotype.Controller;
|
import org.springframework.stereotype.Controller;
|
||||||
import org.springframework.ui.Model;
|
import org.springframework.ui.Model;
|
||||||
import org.springframework.validation.BindingResult;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.PathVariable;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
|
||||||
@Slf4j
|
@Slf4j
|
||||||
@Controller
|
@Controller
|
||||||
@RequiredArgsConstructor
|
@RequiredArgsConstructor
|
||||||
@RequestMapping(path = "/record/daily")
|
@RequestMapping(path = "/record/daily")
|
||||||
public class DailyRecordUIController {
|
public class DailyRecordUIController {
|
||||||
private final DailyRecordService dailyRecordService;
|
private final DailyRecordPortIn dailyRecordPortIn;
|
||||||
private final CreateDailyRecordValidator createDailyRecordValidator;
|
private final CreateDailyRecordValidator createDailyRecordValidator;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -35,10 +32,10 @@ public class DailyRecordUIController {
|
|||||||
@GetMapping(path = "/{searchMonth}/{groupNo}")
|
@GetMapping(path = "/{searchMonth}/{groupNo}")
|
||||||
public String createForm(Model model, @PathVariable("searchMonth") String searchMonth, @PathVariable("groupNo") String groupNo) {
|
public String createForm(Model model, @PathVariable("searchMonth") String searchMonth, @PathVariable("groupNo") String groupNo) {
|
||||||
|
|
||||||
DailyRecordUIReqVO reqVO = new DailyRecordUIReqVO(searchMonth, groupNo);
|
DailyUIReqVO reqVO = new DailyUIReqVO(searchMonth, groupNo);
|
||||||
log.debug("reqVO: {}", reqVO);
|
log.debug("reqVO: {}", reqVO);
|
||||||
|
|
||||||
DailyRecordDto dailyRecord = dailyRecordService.getDailyRecord(reqVO);
|
DailyRecordDto dailyRecord = dailyRecordPortIn.detail(reqVO);
|
||||||
if (dailyRecord == null) {
|
if (dailyRecord == null) {
|
||||||
throw new NoMatchingURIException("[Record] 잘못된 접근");
|
throw new NoMatchingURIException("[Record] 잘못된 접근");
|
||||||
}
|
}
|
||||||
@@ -1,6 +1,5 @@
|
|||||||
package app.module.front.usecase.daily.record.web.model;
|
package app.module.front.usecase.daily.record.adapters.web.model;
|
||||||
|
|
||||||
import app.module.front.config.adapters.persistence.component.FrontAuditCommand;
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.ToString;
|
import lombok.ToString;
|
||||||
|
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package app.module.front.usecase.daily.record.web.model;
|
package app.module.front.usecase.daily.record.adapters.web.model;
|
||||||
|
|
||||||
import app.module.front.config.application.util.AuthUtil;
|
import app.module.front.config.application.util.AuthUtil;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package app.module.front.usecase.daily.record.web.model;
|
package app.module.front.usecase.daily.record.adapters.web.model;
|
||||||
|
|
||||||
public enum DailyStatus {
|
public enum DailyStatus {
|
||||||
/**
|
/**
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package app.module.front.usecase.daily.record.web.model;
|
package app.module.front.usecase.daily.record.adapters.web.model;
|
||||||
|
|
||||||
public enum DailyTargetStatus {
|
public enum DailyTargetStatus {
|
||||||
/**
|
/**
|
||||||
@@ -0,0 +1,41 @@
|
|||||||
|
package app.module.front.usecase.daily.record.adapters.web.model;
|
||||||
|
|
||||||
|
import app.module.front.config.application.util.AuthUtil;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.ToString;
|
||||||
|
import org.apache.tika.utils.StringUtils;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@ToString
|
||||||
|
public class DailyUIReqVO {
|
||||||
|
public DailyUIReqVO() {
|
||||||
|
this.householdSeq = AuthUtil.getUserSeq();
|
||||||
|
}
|
||||||
|
|
||||||
|
public DailyUIReqVO(String searchMonth, Integer groupNo) {
|
||||||
|
this.householdSeq = AuthUtil.getUserSeq();
|
||||||
|
this.searchMonth = searchMonth;
|
||||||
|
this.groupNo = groupNo;
|
||||||
|
}
|
||||||
|
|
||||||
|
public DailyUIReqVO(String searchMonth, String groupNo) {
|
||||||
|
this.householdSeq = AuthUtil.getUserSeq();
|
||||||
|
this.searchMonth = searchMonth;
|
||||||
|
if (!StringUtils.isBlank(groupNo)) {
|
||||||
|
this.groupNo = Integer.parseInt(groupNo);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 검색 월(yyyyMM)
|
||||||
|
*/
|
||||||
|
private String searchMonth;
|
||||||
|
/**
|
||||||
|
* 검색 그룸번호
|
||||||
|
*/
|
||||||
|
private Integer groupNo;
|
||||||
|
/**
|
||||||
|
* 임가 일련번호
|
||||||
|
*/
|
||||||
|
private Long householdSeq;
|
||||||
|
}
|
||||||
@@ -1,10 +1,9 @@
|
|||||||
package app.module.front.usecase.daily.record.web.validator;
|
package app.module.front.usecase.daily.record.adapters.web.validator;
|
||||||
|
|
||||||
import app.module.core.config.application.util.MessageUtil;
|
import app.module.core.config.application.util.MessageUtil;
|
||||||
import app.module.front.usecase.daily.record.web.model.CreateDailyRecordReqVO;
|
import app.module.front.usecase.daily.record.adapters.web.model.CreateDailyRecordReqVO;
|
||||||
import app.module.front.usecase.daily.record.web.model.DailyStatus;
|
import app.module.front.usecase.daily.record.adapters.web.model.DailyStatus;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.apache.tika.utils.StringUtils;
|
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
import org.springframework.validation.Errors;
|
import org.springframework.validation.Errors;
|
||||||
import org.springframework.validation.Validator;
|
import org.springframework.validation.Validator;
|
||||||
@@ -1,43 +0,0 @@
|
|||||||
package app.module.front.usecase.daily.record.persistence;
|
|
||||||
|
|
||||||
import app.module.front.usecase.daily.record.persistence.model.CreateDailyRecordCmd;
|
|
||||||
import app.module.front.usecase.daily.record.persistence.model.DailyRecordDto;
|
|
||||||
import app.module.front.usecase.daily.record.web.model.DailyRecordUIReqVO;
|
|
||||||
import app.module.front.usecase.daily.record.persistence.model.UpdateDailyRecordStatusCmd;
|
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
|
||||||
|
|
||||||
@Mapper
|
|
||||||
public interface DailyRecordMapper {
|
|
||||||
|
|
||||||
DailyRecordDto getDailyRecord(DailyRecordUIReqVO reqVO);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 일계부 항목 등록 여부
|
|
||||||
*
|
|
||||||
* @param reqVO
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
Integer getDailyRecordExistCount(DailyRecordUIReqVO reqVO);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 일계부 항목 등록(생성)
|
|
||||||
*
|
|
||||||
* @param command
|
|
||||||
*/
|
|
||||||
void createDailyRecord(CreateDailyRecordCmd command);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 일계부 항목 수정
|
|
||||||
*
|
|
||||||
* @param command
|
|
||||||
*/
|
|
||||||
void updateDailyRecord(CreateDailyRecordCmd command);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 일계부 항목의 상태 수정
|
|
||||||
*
|
|
||||||
* @param command
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
int updateDailyRecordStatus(UpdateDailyRecordStatusCmd command);
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,24 @@
|
|||||||
|
package app.module.front.usecase.daily.record.ports;
|
||||||
|
|
||||||
|
import app.module.front.usecase.daily.record.adapters.persistence.model.DailyRecordDto;
|
||||||
|
import app.module.front.usecase.daily.record.adapters.web.model.CreateDailyRecordReqVO;
|
||||||
|
import app.module.front.usecase.daily.record.adapters.web.model.DailyUIReqVO;
|
||||||
|
|
||||||
|
public interface DailyRecordPortIn {
|
||||||
|
/**
|
||||||
|
* 일계부 항목 조회
|
||||||
|
*
|
||||||
|
* @param reqVO 검색 조건
|
||||||
|
* @return 항목 상세
|
||||||
|
*/
|
||||||
|
DailyRecordDto detail(DailyUIReqVO reqVO);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 일계부 항목 등록
|
||||||
|
*
|
||||||
|
* @param formVO 입력 데이터
|
||||||
|
*/
|
||||||
|
void create(CreateDailyRecordReqVO formVO);
|
||||||
|
|
||||||
|
void updateByStatus(String recordMonth, Integer dayGroupNo, String targetType, String targetStatus);
|
||||||
|
}
|
||||||
@@ -0,0 +1,24 @@
|
|||||||
|
package app.module.front.usecase.daily.record.ports;
|
||||||
|
|
||||||
|
import app.module.front.usecase.daily.record.adapters.persistence.model.DailyRecordDto;
|
||||||
|
import app.module.front.usecase.daily.record.ports.application.domain.CreateDailyRecordCmd;
|
||||||
|
import app.module.front.usecase.daily.record.ports.application.domain.GetDailyRecordCmd;
|
||||||
|
|
||||||
|
public interface DailyRecordPortOut {
|
||||||
|
/**
|
||||||
|
* 일계부 항목 조회
|
||||||
|
* @param command 검색 조건
|
||||||
|
* @return 항목 상세
|
||||||
|
*/
|
||||||
|
DailyRecordDto detail(GetDailyRecordCmd command);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 일계부 항목 등록
|
||||||
|
*
|
||||||
|
* @param findCmd 검색 조건
|
||||||
|
* @param command 입력 데이터
|
||||||
|
*/
|
||||||
|
void create(GetDailyRecordCmd findCmd, CreateDailyRecordCmd command);
|
||||||
|
|
||||||
|
void updateByStatus(String recordMonth, Integer dayGroupNo, String targetType, String targetStatus);
|
||||||
|
}
|
||||||
@@ -0,0 +1,56 @@
|
|||||||
|
package app.module.front.usecase.daily.record.ports.application;
|
||||||
|
|
||||||
|
import app.module.front.config.application.util.AuditUtil;
|
||||||
|
import app.module.front.config.application.util.AuthUtil;
|
||||||
|
import app.module.front.usecase.daily.record.adapters.persistence.model.DailyRecordDto;
|
||||||
|
import app.module.front.usecase.daily.record.adapters.web.model.CreateDailyRecordReqVO;
|
||||||
|
import app.module.front.usecase.daily.record.adapters.web.model.DailyUIReqVO;
|
||||||
|
import app.module.front.usecase.daily.record.ports.DailyRecordPortIn;
|
||||||
|
import app.module.front.usecase.daily.record.ports.DailyRecordPortOut;
|
||||||
|
import app.module.front.usecase.daily.record.ports.application.domain.CreateDailyRecordCmd;
|
||||||
|
import app.module.front.usecase.daily.record.ports.application.domain.GetDailyRecordCmd;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
public class DailyRecordService implements DailyRecordPortIn {
|
||||||
|
private final DailyRecordPortOut portOut;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public DailyRecordDto detail(DailyUIReqVO reqVO) {
|
||||||
|
return portOut.detail(new GetDailyRecordCmd(reqVO.getSearchMonth(),
|
||||||
|
reqVO.getGroupNo(),
|
||||||
|
reqVO.getHouseholdSeq()));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void create(CreateDailyRecordReqVO formVO) {
|
||||||
|
GetDailyRecordCmd findCmd = new GetDailyRecordCmd(
|
||||||
|
formVO.getRecordMonth(),
|
||||||
|
formVO.getDayGroupNo(),
|
||||||
|
AuthUtil.getUserSeq());
|
||||||
|
|
||||||
|
CreateDailyRecordCmd command = AuditUtil.create(
|
||||||
|
new CreateDailyRecordCmd(
|
||||||
|
null,
|
||||||
|
formVO.getRecordMonth(),
|
||||||
|
formVO.getDayGroupNo(),
|
||||||
|
formVO.getStartDate(),
|
||||||
|
formVO.getEndDate(),
|
||||||
|
formVO.getAllStatus(),
|
||||||
|
formVO.getIncomeStatus(),
|
||||||
|
formVO.getWorkStatus(),
|
||||||
|
formVO.getExpenseStatus(),
|
||||||
|
formVO.getPowerStatus(),
|
||||||
|
formVO.getForestryStatus(),
|
||||||
|
formVO.getFarmingStatus()));
|
||||||
|
|
||||||
|
portOut.create(findCmd, command);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void updateByStatus(String recordMonth, Integer dayGroupNo, String targetType, String targetStatus) {
|
||||||
|
portOut.updateByStatus(recordMonth, dayGroupNo, targetType, targetStatus);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,8 +1,8 @@
|
|||||||
package app.module.front.usecase.daily.record.persistence.model;
|
package app.module.front.usecase.daily.record.ports.application.domain;
|
||||||
|
|
||||||
import app.module.front.config.adapters.persistence.component.FrontAuditCommand;
|
import app.module.front.config.adapters.persistence.component.FrontAuditCommand;
|
||||||
import app.module.front.usecase.daily.record.web.model.DailyStatus;
|
import app.module.front.usecase.daily.record.adapters.web.model.DailyStatus;
|
||||||
import app.module.front.usecase.daily.record.web.model.DailyTargetStatus;
|
import app.module.front.usecase.daily.record.adapters.web.model.DailyTargetStatus;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import lombok.Setter;
|
import lombok.Setter;
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
package app.module.front.usecase.daily.record.ports.application.domain;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.Setter;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
@AllArgsConstructor
|
||||||
|
public class GetDailyRecordCmd {
|
||||||
|
/**
|
||||||
|
* 검색 월(yyyyMM)
|
||||||
|
*/
|
||||||
|
private String searchMonth;
|
||||||
|
/**
|
||||||
|
* 검색 그룸번호
|
||||||
|
*/
|
||||||
|
private Integer groupNo;
|
||||||
|
/**
|
||||||
|
* 임가 일련번호
|
||||||
|
*/
|
||||||
|
private Long householdSeq;
|
||||||
|
}
|
||||||
@@ -1,8 +1,6 @@
|
|||||||
package app.module.front.usecase.daily.record.persistence.model;
|
package app.module.front.usecase.daily.record.ports.application.domain;
|
||||||
|
|
||||||
import app.module.front.config.adapters.persistence.component.FrontAuditCommand;
|
import app.module.front.config.adapters.persistence.component.FrontAuditCommand;
|
||||||
import app.module.front.usecase.daily.record.web.model.DailyStatus;
|
|
||||||
import app.module.front.usecase.daily.record.web.model.DailyTargetStatus;
|
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import lombok.Setter;
|
import lombok.Setter;
|
||||||
@@ -1,13 +0,0 @@
|
|||||||
package app.module.front.usecase.daily.record.service;
|
|
||||||
|
|
||||||
import app.module.front.usecase.daily.record.persistence.model.DailyRecordDto;
|
|
||||||
import app.module.front.usecase.daily.record.web.model.CreateDailyRecordReqVO;
|
|
||||||
import app.module.front.usecase.daily.record.web.model.DailyRecordUIReqVO;
|
|
||||||
|
|
||||||
public interface DailyRecordService {
|
|
||||||
DailyRecordDto getDailyRecord(DailyRecordUIReqVO reqVO);
|
|
||||||
|
|
||||||
void createDailyRecord(CreateDailyRecordReqVO reqVO);
|
|
||||||
|
|
||||||
void updateDailyRecordStatus(String recordMonth, Integer dayGroupNo, String targetType, String targetStatus);
|
|
||||||
}
|
|
||||||
@@ -1,21 +0,0 @@
|
|||||||
package app.module.front.usecase.daily.record.web.model;
|
|
||||||
|
|
||||||
import lombok.Data;
|
|
||||||
import lombok.Getter;
|
|
||||||
import lombok.Setter;
|
|
||||||
import lombok.ToString;
|
|
||||||
|
|
||||||
@Getter
|
|
||||||
@Setter
|
|
||||||
@ToString(callSuper = true)
|
|
||||||
public class DailyRecordUIReqVO extends DailyUIReqVO {
|
|
||||||
public DailyRecordUIReqVO(String month, String no) {
|
|
||||||
setSearchMonth(month);
|
|
||||||
setGroupNo(Integer.parseInt(no));
|
|
||||||
}
|
|
||||||
|
|
||||||
public DailyRecordUIReqVO(String month, Integer no) {
|
|
||||||
setSearchMonth(month);
|
|
||||||
setGroupNo(no);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,26 +0,0 @@
|
|||||||
package app.module.front.usecase.daily.record.web.model;
|
|
||||||
|
|
||||||
import app.module.front.config.application.util.AuthUtil;
|
|
||||||
import lombok.Data;
|
|
||||||
import lombok.ToString;
|
|
||||||
|
|
||||||
@Data
|
|
||||||
@ToString
|
|
||||||
public class DailyUIReqVO {
|
|
||||||
public DailyUIReqVO() {
|
|
||||||
this.householdSeq = AuthUtil.getUserSeq();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 검색 월(yyyyMM)
|
|
||||||
*/
|
|
||||||
private String searchMonth;
|
|
||||||
/**
|
|
||||||
* 검색 그룸번호
|
|
||||||
*/
|
|
||||||
private Integer groupNo;
|
|
||||||
/**
|
|
||||||
* 임가 일련번호
|
|
||||||
*/
|
|
||||||
private Long householdSeq;
|
|
||||||
}
|
|
||||||
@@ -1,14 +1,14 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?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" >
|
<!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.expense.persistence.DailyExpenseMapper">
|
<mapper namespace="app.module.front.usecase.daily.expense.adapters.persistence.DailyExpenseMapper">
|
||||||
|
|
||||||
<select id="getDailyExpenseList"
|
<select id="getDailyExpenseList"
|
||||||
resultType="app.module.front.usecase.daily.expense.persistence.model.DailyExpenseDto">
|
resultType="app.module.front.usecase.daily.expense.adapters.persistence.model.DailyExpenseDto">
|
||||||
select ds.id, ds.daily_record_seq, ds.input_type, ds.is_credit as credit
|
select ds.id, ds.daily_record_seq, ds.input_type, ds.is_credit as credit
|
||||||
, ds.category_self, ds.source_purpose
|
, ds.category_self, ds.source_purpose
|
||||||
, ds.quantity, ds.unit_code, ds.price, ds.estimated_value
|
, ds.quantity, ds.unit_code, ds.unit_self, ds.price, ds.estimated_value
|
||||||
from daily_expense ds
|
from daily_expense ds
|
||||||
<include refid="app.module.front.usecase.daily.record.persistence.DailyRecordMapper.InnerJoinByDailyRecord"/>
|
<include refid="app.module.front.usecase.daily.record.adapters.persistence.DailyRecordMapper.InnerJoinByDailyRecord"/>
|
||||||
where ds.is_deleted = false
|
where ds.is_deleted = false
|
||||||
<if test="id != null and id != '0'">
|
<if test="id != null and id != '0'">
|
||||||
and ds.id = ${id}
|
and ds.id = ${id}
|
||||||
@@ -20,7 +20,7 @@
|
|||||||
<select id="getRecordExistCount" resultType="int">
|
<select id="getRecordExistCount" resultType="int">
|
||||||
select count(1)
|
select count(1)
|
||||||
from daily_expense ds
|
from daily_expense ds
|
||||||
<include refid="app.module.front.usecase.daily.record.persistence.DailyRecordMapper.InnerJoinByDailyRecord"/>
|
<include refid="app.module.front.usecase.daily.record.adapters.persistence.DailyRecordMapper.InnerJoinByDailyRecord"/>
|
||||||
where ds.is_deleted = false
|
where ds.is_deleted = false
|
||||||
<if test="id != null and id != '0'">
|
<if test="id != null and id != '0'">
|
||||||
and ds.id = ${id}
|
and ds.id = ${id}
|
||||||
@@ -30,13 +30,13 @@
|
|||||||
<insert id="createDailyExpense" useGeneratedKeys="true" keyProperty="id">
|
<insert id="createDailyExpense" useGeneratedKeys="true" keyProperty="id">
|
||||||
insert into daily_expense (
|
insert into daily_expense (
|
||||||
daily_record_seq, input_type, is_credit, income_mark_code, category_self, source_purpose
|
daily_record_seq, input_type, is_credit, income_mark_code, category_self, source_purpose
|
||||||
, quantity, unit_code, price, estimated_value
|
, quantity, unit_code, unit_self, price, estimated_value
|
||||||
, is_deleted
|
, is_deleted
|
||||||
, <include refid="common.fields.CreateUpdateBaseColumns"/>
|
, <include refid="common.fields.CreateUpdateBaseColumns"/>
|
||||||
) values (
|
) values (
|
||||||
#{dailyRecordSeq}
|
#{dailyRecordSeq}
|
||||||
, #{inputType}, #{credit}, #{incomeMarkCode}, #{categorySelf}, #{sourcePurpose}
|
, #{inputType}, #{credit}, #{incomeMarkCode}, #{categorySelf}, #{sourcePurpose}
|
||||||
, #{quantity}, #{unitCode}, #{price}, #{estimatedValue}
|
, #{quantity}, #{unitCode}, #{unitSelf}, #{price}, #{estimatedValue}
|
||||||
, false
|
, false
|
||||||
, <include refid="common.fields.CreateUpdateBaseValues"/>
|
, <include refid="common.fields.CreateUpdateBaseValues"/>
|
||||||
)
|
)
|
||||||
@@ -50,6 +50,7 @@
|
|||||||
, source_purpose = #{sourcePurpose}
|
, source_purpose = #{sourcePurpose}
|
||||||
, quantity = #{quantity}
|
, quantity = #{quantity}
|
||||||
, unit_code = #{unitCode}
|
, unit_code = #{unitCode}
|
||||||
|
, unit_self = #{unitSelf}
|
||||||
, price = #{price}
|
, price = #{price}
|
||||||
, estimated_value = #{estimatedValue}
|
, estimated_value = #{estimatedValue}
|
||||||
where is_deleted = false
|
where is_deleted = false
|
||||||
|
|||||||
@@ -1,14 +1,14 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?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" >
|
<!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.income.persistence.DailyIncomeMapper">
|
<mapper namespace="app.module.front.usecase.daily.income.adapters.persistence.DailyIncomeMapper">
|
||||||
|
|
||||||
<select id="getDailyIncomeList"
|
<select id="getDailyIncomeList"
|
||||||
resultType="app.module.front.usecase.daily.income.persistence.model.DailyIncomeDto">
|
resultType="app.module.front.usecase.daily.income.adapters.persistence.model.DailyIncomeDto">
|
||||||
select ds.id, ds.daily_record_seq, ds.input_type, ds.is_credit as credit
|
select ds.id, ds.daily_record_seq, ds.input_type, ds.is_credit as credit
|
||||||
, ds.crop_code, ds.category_self, ds.source_purpose
|
, ds.crop_code, ds.category_self, ds.source_purpose
|
||||||
, ds.quantity, ds.unit_code, ds.price, ds.estimated_value
|
, ds.quantity, ds.unit_code, ds.unit_self, ds.price, ds.estimated_value
|
||||||
from daily_income ds
|
from daily_income ds
|
||||||
<include refid="app.module.front.usecase.daily.record.persistence.DailyRecordMapper.InnerJoinByDailyRecord"/>
|
<include refid="app.module.front.usecase.daily.record.adapters.persistence.DailyRecordMapper.InnerJoinByDailyRecord"/>
|
||||||
where ds.is_deleted = false
|
where ds.is_deleted = false
|
||||||
<if test="id != null and id != '0'">
|
<if test="id != null and id != '0'">
|
||||||
and ds.id = ${id}
|
and ds.id = ${id}
|
||||||
@@ -20,7 +20,7 @@
|
|||||||
<select id="getRecordExistCount" resultType="int">
|
<select id="getRecordExistCount" resultType="int">
|
||||||
select count(1)
|
select count(1)
|
||||||
from daily_income ds
|
from daily_income ds
|
||||||
<include refid="app.module.front.usecase.daily.record.persistence.DailyRecordMapper.InnerJoinByDailyRecord"/>
|
<include refid="app.module.front.usecase.daily.record.adapters.persistence.DailyRecordMapper.InnerJoinByDailyRecord"/>
|
||||||
where ds.is_deleted = false
|
where ds.is_deleted = false
|
||||||
<if test="id != null and id != '0'">
|
<if test="id != null and id != '0'">
|
||||||
and ds.id = ${id}
|
and ds.id = ${id}
|
||||||
@@ -30,13 +30,13 @@
|
|||||||
<insert id="createDailyIncome" useGeneratedKeys="true" keyProperty="id">
|
<insert id="createDailyIncome" useGeneratedKeys="true" keyProperty="id">
|
||||||
insert into daily_income (
|
insert into daily_income (
|
||||||
daily_record_seq, input_type, is_credit, expense_mark_code, crop_code, category_self, source_purpose
|
daily_record_seq, input_type, is_credit, expense_mark_code, crop_code, category_self, source_purpose
|
||||||
, quantity, unit_code, price, estimated_value
|
, quantity, unit_code, unit_self, price, estimated_value
|
||||||
, is_deleted
|
, is_deleted
|
||||||
, <include refid="common.fields.CreateUpdateBaseColumns"/>
|
, <include refid="common.fields.CreateUpdateBaseColumns"/>
|
||||||
) values (
|
) values (
|
||||||
#{dailyRecordSeq}
|
#{dailyRecordSeq}
|
||||||
, #{inputType}, #{credit}, #{expenseMarkCode}, #{cropCode}, #{categorySelf}, #{sourcePurpose}
|
, #{inputType}, #{credit}, #{expenseMarkCode}, #{cropCode}, #{categorySelf}, #{sourcePurpose}
|
||||||
, #{quantity}, #{unitCode}, #{price}, #{estimatedValue}
|
, #{quantity}, #{unitCode}, #{unitSelf}, #{price}, #{estimatedValue}
|
||||||
, false
|
, false
|
||||||
, <include refid="common.fields.CreateUpdateBaseValues"/>
|
, <include refid="common.fields.CreateUpdateBaseValues"/>
|
||||||
)
|
)
|
||||||
@@ -51,6 +51,7 @@
|
|||||||
, source_purpose = #{sourcePurpose}
|
, source_purpose = #{sourcePurpose}
|
||||||
, quantity = #{quantity}
|
, quantity = #{quantity}
|
||||||
, unit_code = #{unitCode}
|
, unit_code = #{unitCode}
|
||||||
|
, unit_self = #{unitSelf}
|
||||||
, price = #{price}
|
, price = #{price}
|
||||||
, estimated_value = #{estimatedValue}
|
, estimated_value = #{estimatedValue}
|
||||||
where is_deleted = false
|
where is_deleted = false
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?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" >
|
<!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.record.persistence.DailyRecordMapper">
|
<mapper namespace="app.module.front.usecase.daily.record.adapters.persistence.DailyRecordMapper">
|
||||||
|
|
||||||
<select id="getDailyRecord"
|
<select id="getDailyRecord"
|
||||||
resultType="app.module.front.usecase.daily.record.persistence.model.DailyRecordDto">
|
resultType="app.module.front.usecase.daily.record.adapters.persistence.model.DailyRecordDto">
|
||||||
select ddg.group_no, ddg.start_day, ddg.end_day
|
select ddg.group_no, ddg.start_day, ddg.end_day
|
||||||
, dr.id, dr.record_month, dr.day_group_no, dr.start_date, dr.end_date
|
, dr.id, dr.record_month, dr.day_group_no, dr.start_date, dr.end_date
|
||||||
, dr.all_status, dr.income_status, dr.work_status, dr.expense_status, dr.power_status, dr.forestry_status
|
, dr.all_status, dr.income_status, dr.work_status, dr.expense_status, dr.power_status, dr.forestry_status
|
||||||
|
|||||||
@@ -8321,6 +8321,9 @@ button.swiper-pagination-bullet {
|
|||||||
}
|
}
|
||||||
.form-group .input-flex-group .d-flex .component-input {
|
.form-group .input-flex-group .d-flex .component-input {
|
||||||
margin-top: 0;
|
margin-top: 0;
|
||||||
|
-webkit-box-flex: 1;
|
||||||
|
-webkit-flex: 1;
|
||||||
|
flex: 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
.form-desc {
|
.form-desc {
|
||||||
|
|||||||
@@ -23,12 +23,12 @@ krip.daily.goToPrev = function(target, searchMonth, groupNo) {
|
|||||||
url = url.replace('{target}', target);
|
url = url.replace('{target}', target);
|
||||||
|
|
||||||
console.log(url);
|
console.log(url);
|
||||||
}
|
};
|
||||||
|
|
||||||
krip.daily.goToPrev = function() {
|
krip.daily.goToPrev = function() {
|
||||||
// TODO : history.back 으로 해결 되는가?
|
// TODO : history.back 으로 해결 되는가?
|
||||||
history.back();
|
history.back();
|
||||||
}
|
};
|
||||||
|
|
||||||
krip.daily.goToNext = function(target, searchMonth, groupNo) {
|
krip.daily.goToNext = function(target, searchMonth, groupNo) {
|
||||||
let url = krip.daily.httpUrl.target;
|
let url = krip.daily.httpUrl.target;
|
||||||
@@ -61,3 +61,121 @@ krip.daily.todayNone = function(month, groupNo, target, checked) {
|
|||||||
},
|
},
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
krip.daily.baseBindUI = function() {
|
||||||
|
etUI.locales.ko = {
|
||||||
|
dialog: {
|
||||||
|
positive: '예',
|
||||||
|
negative: '아니오',
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
const $noneWrap = $('input[name="todayNone"]');
|
||||||
|
$noneWrap.on('click', function () {
|
||||||
|
let checked = $(this).is(':checked');
|
||||||
|
let $btn = $(ENV.modal.selectorId);
|
||||||
|
$btn.attr('disabled', checked);
|
||||||
|
if (checked) {
|
||||||
|
$btn.find('i').addClass('ico-add-disabled');
|
||||||
|
$btn.find('i').removeClass('ico-add');
|
||||||
|
$noneWrap.val('Y');
|
||||||
|
} else {
|
||||||
|
$btn.find('i').addClass('ico-add');
|
||||||
|
$btn.find('i').removeClass('ico-add-disabled');
|
||||||
|
//document.reqForm.todayNone.value = 'N';
|
||||||
|
$noneWrap.val('N');
|
||||||
|
}
|
||||||
|
// TODO 2번 이벤트 발생하는 원인 찾기
|
||||||
|
console.log(1111)
|
||||||
|
|
||||||
|
krip.daily.todayNone(ENV.month, ENV.groupNo, $noneWrap.data('type'), checked);
|
||||||
|
});
|
||||||
|
|
||||||
|
const $formWrap = $(ENV.modal.selectorId);
|
||||||
|
$formWrap.on('click', function() {
|
||||||
|
krip.daily.createModal();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
krip.daily.createModal = function(id) {
|
||||||
|
if (ENV.httpUrl.form === undefined) {
|
||||||
|
kri.logger.warn('[daily] form url is none.');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (id === undefined) {
|
||||||
|
id = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
ajaxUtil._ajaxAsyncMethod(
|
||||||
|
ENV.httpUrl.form.replace('{id}', id),
|
||||||
|
{},
|
||||||
|
function(rstHtml, status) {
|
||||||
|
$(ENV.modal.selector).find('.modal-content').html(rstHtml);
|
||||||
|
|
||||||
|
const modal01 = document.querySelector(ENV.modal.selector).ui;
|
||||||
|
modal01.open();
|
||||||
|
|
||||||
|
modalControl._bindModelUI();
|
||||||
|
},
|
||||||
|
function(code, rstData) {
|
||||||
|
kri.logger.error('Do nothing. code: '+ code, rstData);
|
||||||
|
},
|
||||||
|
'get',
|
||||||
|
'html'
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
krip.daily.removeConfirm = function(id) {
|
||||||
|
etUI.dialog.alert({
|
||||||
|
title: '삭제 안내',
|
||||||
|
message: '등록하신 내용을 삭제하시겠어요?<br>삭제된 내용은 복구할 수 없습니다.',
|
||||||
|
type: 'confirm',
|
||||||
|
dialogType: 'confirm',
|
||||||
|
callback: function () {
|
||||||
|
krip.daily.remove(id);
|
||||||
|
},
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
krip.daily.remove = function(id) {
|
||||||
|
if (ENV.httpUrl.remove === undefined) {
|
||||||
|
kri.logger.warn('[daily] remove url is none.');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
ajaxUtil._ajaxAsync(
|
||||||
|
ENV.httpUrl.remove,
|
||||||
|
{ 'id': id },
|
||||||
|
function (rstData, status) {
|
||||||
|
location.reload();
|
||||||
|
},
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
krip.daily.resetConfirm = function() {
|
||||||
|
etUI.dialog.alert({
|
||||||
|
title: '초기화 안내',
|
||||||
|
message: '등록하신 모든 내용을 삭제하시겠어요?<br>삭제된 내용은 복구할 수 없습니다.',
|
||||||
|
type: 'confirm',
|
||||||
|
dialogType: 'confirm',
|
||||||
|
callback: function () {
|
||||||
|
krip.daily.reset();
|
||||||
|
},
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
krip.daily.reset = function() {
|
||||||
|
if (ENV.httpUrl.reset === undefined) {
|
||||||
|
kri.logger.warn('[daily] reset url is none.');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
ajaxUtil._ajaxAsync(
|
||||||
|
ENV.httpUrl.reset,
|
||||||
|
{},
|
||||||
|
function (rstData, status) {
|
||||||
|
location.reload();
|
||||||
|
},
|
||||||
|
);
|
||||||
|
};
|
||||||
@@ -3,14 +3,6 @@
|
|||||||
xmlns:th="http://www.thymeleaf.org" lang="ko">
|
xmlns:th="http://www.thymeleaf.org" lang="ko">
|
||||||
|
|
||||||
<th:block>
|
<th:block>
|
||||||
<th:block th:if="${@systemProperties['spring.profiles.active'] eq 'local'}">
|
|
||||||
<div>
|
|
||||||
reqVO: [[${reqVO}]]
|
|
||||||
</div>
|
|
||||||
<div>
|
|
||||||
detail: [[${dailyRecord}]]
|
|
||||||
</div>
|
|
||||||
</th:block>
|
|
||||||
<div class="modal-content-inner">
|
<div class="modal-content-inner">
|
||||||
<div class="component-btns type-tab"
|
<div class="component-btns type-tab"
|
||||||
th:if="${not detail.updated}">
|
th:if="${not detail.updated}">
|
||||||
@@ -100,7 +92,7 @@
|
|||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
<div id="unitCode" class="component-select bottom-sheet" data-props-default="단위를 선택해 주세요" data-props-type="bottomSheet">
|
<div id="unitCode" class="component-select bottom-sheet" data-props-default="단위를 선택해 주세요" data-props-type="bottomSheet">
|
||||||
<input type="hidden1" name="unitCode" th:value="${detail.unitCode}">
|
<input type="hidden" name="unitCode" th:value="${detail.unitCode}">
|
||||||
<button type="button" class="select-box">
|
<button type="button" class="select-box">
|
||||||
<span class="select-txt"></span>
|
<span class="select-txt"></span>
|
||||||
</button>
|
</button>
|
||||||
@@ -122,6 +114,11 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="component-input" data-option="직접 입력">
|
||||||
|
<div class="input-field">
|
||||||
|
<input type="text" name="unitSelf" th:value="${detail.unitSelf}" maxlength="30" placeholder="단위를 입력해 주세요">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
@@ -164,7 +161,7 @@
|
|||||||
|
|
||||||
<div class="component-btns">
|
<div class="component-btns">
|
||||||
<div class="btns-row">
|
<div class="btns-row">
|
||||||
<button type="button" class="btn btn-full btn-l btn-primary" onclick="formControl.createVaild();">
|
<button type="button" class="btn btn-full btn-l btn-primary" onclick="modalControl.createVaild();">
|
||||||
<span class="btn-txt">등록</span>
|
<span class="btn-txt">등록</span>
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -3,14 +3,6 @@
|
|||||||
xmlns:th="http://www.thymeleaf.org" lang="ko">
|
xmlns:th="http://www.thymeleaf.org" lang="ko">
|
||||||
|
|
||||||
<div layout:fragment="content" th:classappend="acco-wrap">
|
<div layout:fragment="content" th:classappend="acco-wrap">
|
||||||
<th:block th:if="${@systemProperties['spring.profiles.active'] eq 'local'}">
|
|
||||||
<div>
|
|
||||||
reqVO: [[${reqVO}]]
|
|
||||||
</div>
|
|
||||||
<div>
|
|
||||||
dailyRecord: [[${dailyRecord}]]
|
|
||||||
</div>
|
|
||||||
</th:block>
|
|
||||||
<main id="content" role="main">
|
<main id="content" role="main">
|
||||||
<div class="inner">
|
<div class="inner">
|
||||||
<hgroup class="tit-group">
|
<hgroup class="tit-group">
|
||||||
@@ -27,9 +19,6 @@
|
|||||||
<p>지출 내역을 등록해 주세요.</p>
|
<p>지출 내역을 등록해 주세요.</p>
|
||||||
</hgroup>
|
</hgroup>
|
||||||
|
|
||||||
<form name="reqForm">
|
|
||||||
<input type="hidden" name="todayNone" value="N">
|
|
||||||
</form>
|
|
||||||
<!--/* 신규 등록 */-->
|
<!--/* 신규 등록 */-->
|
||||||
<th:block th:if="${#lists.isEmpty(expenseList)}">
|
<th:block th:if="${#lists.isEmpty(expenseList)}">
|
||||||
<button type="button" class="btn btn-m btn-secondary btn-full button-modal01" data-testid="button-modal01"
|
<button type="button" class="btn btn-m btn-secondary btn-full button-modal01" data-testid="button-modal01"
|
||||||
@@ -38,10 +27,10 @@
|
|||||||
th:classappend="${#strings.equals(dailyRecord.expenseStatus, 'TODAY_NONE') ? 'ico-add-disabled' : 'ico-add'}"></i>
|
th:classappend="${#strings.equals(dailyRecord.expenseStatus, 'TODAY_NONE') ? 'ico-add-disabled' : 'ico-add'}"></i>
|
||||||
<span class="btn-txt">추가 등록</span>
|
<span class="btn-txt">추가 등록</span>
|
||||||
</button>
|
</button>
|
||||||
|
|
||||||
<div class="component-input align-center">
|
<div class="component-input align-center">
|
||||||
<label class="checkbox-inner" id="todayNone">
|
<label class="checkbox-inner" id="todayNone">
|
||||||
<input type="checkbox" name="todayNone"
|
<input type="checkbox" name="todayNone"
|
||||||
|
data-type="EXPENSE"
|
||||||
th:checked="${#strings.equals(dailyRecord.expenseStatus, 'TODAY_NONE')}">
|
th:checked="${#strings.equals(dailyRecord.expenseStatus, 'TODAY_NONE')}">
|
||||||
<span class="checkbox-item">
|
<span class="checkbox-item">
|
||||||
<span class="checkbox-txt">금일 등록내용 없음</span>
|
<span class="checkbox-txt">금일 등록내용 없음</span>
|
||||||
@@ -54,7 +43,7 @@
|
|||||||
<section class="regist-item-area">
|
<section class="regist-item-area">
|
||||||
<p class="total">
|
<p class="total">
|
||||||
<span>총 <strong>[[${#lists.size(expenseList)}]]</strong>건</span>
|
<span>총 <strong>[[${#lists.size(expenseList)}]]</strong>건</span>
|
||||||
<button type="button" class="btn-reset" onclick="formControl.resetConfirm()">
|
<button type="button" class="btn-reset" onclick="krip.daily.resetConfirm()">
|
||||||
<i class="ico-reset ico-small" aria-hidden="true"></i>
|
<i class="ico-reset ico-small" aria-hidden="true"></i>
|
||||||
<span>초기화</span>
|
<span>초기화</span>
|
||||||
</button>
|
</button>
|
||||||
@@ -65,8 +54,8 @@
|
|||||||
<div class="item-tit-group">
|
<div class="item-tit-group">
|
||||||
<p class="item-name">[[${item.categorySelf}]]</p>
|
<p class="item-name">[[${item.categorySelf}]]</p>
|
||||||
<div class="btn-group">
|
<div class="btn-group">
|
||||||
<button type="button" class="delete" th:onclick="formControl.removeConfirm([[${item.id}]])"><span class="hide-txt">삭제</span></button>
|
<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="formControl.createModal([[${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>
|
||||||
</div>
|
</div>
|
||||||
<ul class="detail-list">
|
<ul class="detail-list">
|
||||||
@@ -150,120 +139,76 @@
|
|||||||
remove: /*[[|/api/record/expense/${reqVO.searchMonth}/${reqVO.groupNo}/remove|]]*/'removeUrl',
|
remove: /*[[|/api/record/expense/${reqVO.searchMonth}/${reqVO.groupNo}/remove|]]*/'removeUrl',
|
||||||
reset: /*[[|/api/record/expense/${reqVO.searchMonth}/${reqVO.groupNo}/reset|]]*/'resetUrl',
|
reset: /*[[|/api/record/expense/${reqVO.searchMonth}/${reqVO.groupNo}/reset|]]*/'resetUrl',
|
||||||
},
|
},
|
||||||
|
modal: {
|
||||||
|
// 등록 버튼
|
||||||
|
selectorId: '.button-modal01',
|
||||||
|
// 등록 영역
|
||||||
|
selector: '.modal01',
|
||||||
|
},
|
||||||
month: /*[[${reqVO.searchMonth}]]*/'month',
|
month: /*[[${reqVO.searchMonth}]]*/'month',
|
||||||
groupNo: /*[[${reqVO.groupNo}]]*/'groupNo',
|
groupNo: /*[[${reqVO.groupNo}]]*/'groupNo',
|
||||||
submitted: false,
|
submitted: false,
|
||||||
};
|
};
|
||||||
|
|
||||||
let bind = {
|
|
||||||
form: {
|
|
||||||
selectorId: '.button-modal01',
|
|
||||||
selector: '.modal01',
|
|
||||||
},
|
|
||||||
selectbox: null,
|
|
||||||
}
|
|
||||||
|
|
||||||
let formControl = {
|
let formControl = {
|
||||||
init() {
|
init() {
|
||||||
formControl._bindUI();
|
krip.daily.baseBindUI();
|
||||||
//formControl.createModal();
|
|
||||||
|
|
||||||
// TODO 등록된 건수가 0일 경우 버튼 비활성화
|
|
||||||
|
|
||||||
},
|
},
|
||||||
_bindUI() {
|
};
|
||||||
etUI.locales.ko = {
|
|
||||||
dialog: {
|
|
||||||
positive: '예',
|
|
||||||
negative: '아니오',
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
let $noneWrap = $('#todayNone');
|
let modalControl = {
|
||||||
$noneWrap.on('click', 'input[name="todayNone"]', function() {
|
|
||||||
let checked = $(this).is(':checked');
|
|
||||||
let $btn = $('.button-modal01');
|
|
||||||
$btn.attr('disabled', checked);
|
|
||||||
if (checked) {
|
|
||||||
$btn.find('i').addClass('ico-add-disabled');
|
|
||||||
$btn.find('i').removeClass('ico-add');
|
|
||||||
document.reqForm.todayNone.value = 'Y';
|
|
||||||
} else {
|
|
||||||
$btn.find('i').addClass('ico-add');
|
|
||||||
$btn.find('i').removeClass('ico-add-disabled');
|
|
||||||
document.reqForm.todayNone.value = 'N';
|
|
||||||
}
|
|
||||||
|
|
||||||
krip.daily.todayNone(ENV.month, ENV.groupNo, 'EXPENSE', checked);
|
|
||||||
});
|
|
||||||
|
|
||||||
let $formWrap = $(bind.form.selectorId);
|
|
||||||
$formWrap.on('click', function() {
|
|
||||||
formControl.createModal();
|
|
||||||
});
|
|
||||||
|
|
||||||
// const $btnModal01 = document.querySelector(".button-modal01");
|
|
||||||
// $btnModal01.addEventListener("click", function() {
|
|
||||||
// const modal01 = document.querySelector(".modal01").ui;
|
|
||||||
// modal01.open();
|
|
||||||
// });
|
|
||||||
},
|
|
||||||
_bindModelUI() {
|
_bindModelUI() {
|
||||||
etUI.initUI();
|
|
||||||
|
|
||||||
const $select2 = document.querySelector('#unitCode');
|
const $select2 = document.querySelector('#unitCode');
|
||||||
const selectboxInstance2 = new etUI.components.SelectBox();
|
const selectboxInstance2 = new etUI.components.SelectBox();
|
||||||
selectboxInstance2.core.init($select2, {
|
selectboxInstance2.core.init($select2, {
|
||||||
selectItemCallback({selectValue, dataValue}){
|
selectItemCallback({selectValue, dataValue}){
|
||||||
console.log('selectItemCallback', selectValue, dataValue)
|
console.log('selectItemCallback', selectValue, dataValue)
|
||||||
$('input[name="unitCode"]').val(dataValue)
|
$('input[name="unitCode"]').val(dataValue)
|
||||||
|
|
||||||
|
// TODO : ui js 에서 show 적용유무 파악하기
|
||||||
|
if (dataValue === 'code.record.unit.self') {
|
||||||
|
$('#unitCode').parent().find('.component-input').addClass('show');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
let $formWrap = $(bind.form.selector).find('form');
|
const $formWrap = $(ENV.modal.selector).find('form');
|
||||||
$formWrap.on('keyup', 'input[name="price"]', function() {
|
const $price = $(ENV.modal.selector).find('form input[name="price"]');
|
||||||
// TODO : UI disabled
|
const $estimatedValue = $(ENV.modal.selector).find('form input[name="estimatedValue"]');
|
||||||
|
$price.on('keyup', function() {
|
||||||
if ($(this).val() === '') {
|
if ($(this).val() === '') {
|
||||||
$formWrap.find('input[name="estimatedValue"]').attr('disabled', false);
|
modalControl._priceActive($estimatedValue);
|
||||||
} else {
|
} else {
|
||||||
$formWrap.find('input[name="estimatedValue"]').val('').attr('disabled', true);
|
modalControl._priceDisabled($estimatedValue);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
$formWrap.on('keyup', 'input[name="estimatedValue"]', function() {
|
$estimatedValue.on('keyup', function() {
|
||||||
// TODO : UI disabled
|
|
||||||
if ($(this).val() === '') {
|
if ($(this).val() === '') {
|
||||||
$formWrap.find('input[name="price"]').attr('disabled', false);
|
modalControl._priceActive($price);
|
||||||
} else {
|
} else {
|
||||||
$formWrap.find('input[name="price"]').val('').attr('disabled', true);
|
modalControl._priceDisabled($price);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
|
||||||
createModal(id) {
|
// data set
|
||||||
if (id === undefined) {
|
selectboxInstance2.setValue($formWrap.find('input[name="unitCode"]').val());
|
||||||
id = 0;
|
if ($price.val() === '' && $estimatedValue.val() !== '') {
|
||||||
|
modalControl._priceDisabled($price);
|
||||||
|
} else if ($price.val() !== '' && $estimatedValue.val() === '') {
|
||||||
|
modalControl._priceDisabled($estimatedValue);
|
||||||
}
|
}
|
||||||
|
},
|
||||||
ajaxUtil._ajaxAsyncMethod(
|
_priceActive($input) {
|
||||||
ENV.httpUrl.form.replace('{id}', id),
|
$input.val('').attr('disabled', false);
|
||||||
{},
|
$input.parent().parent().closest('.component-input').removeClass('input-disabled');
|
||||||
function(rstHtml, status) {
|
},
|
||||||
$('.modal01').find('.modal-content').html(rstHtml);
|
_priceDisabled($input) {
|
||||||
|
$input.val('').attr('disabled', true);
|
||||||
const modal01 = document.querySelector(".modal01").ui;
|
$input.parent().parent().closest('.component-input').addClass('input-disabled');
|
||||||
modal01.open();
|
|
||||||
|
|
||||||
formControl._bindModelUI();
|
|
||||||
},
|
|
||||||
function(code, rstData) {
|
|
||||||
kri.logger.error('Do nothing. code: '+ code, rstData);
|
|
||||||
},
|
|
||||||
'get',
|
|
||||||
'html'
|
|
||||||
);
|
|
||||||
},
|
},
|
||||||
createVaild() {
|
createVaild() {
|
||||||
formControl.create();
|
modalControl.create();
|
||||||
},
|
},
|
||||||
create() {
|
create() {
|
||||||
const f = document.reqModalForm;
|
const f = document.reqModalForm;
|
||||||
@@ -277,6 +222,7 @@
|
|||||||
function (rstData, status) {
|
function (rstData, status) {
|
||||||
console.log('rstData', rstData)
|
console.log('rstData', rstData)
|
||||||
location.reload();
|
location.reload();
|
||||||
|
// TODO : next
|
||||||
/*
|
/*
|
||||||
if (f.todayNone.value === 'Y') {
|
if (f.todayNone.value === 'Y') {
|
||||||
krip.daily.goToMain();
|
krip.daily.goToMain();
|
||||||
@@ -287,47 +233,6 @@
|
|||||||
},
|
},
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
removeConfirm(id) {
|
|
||||||
etUI.dialog.alert({
|
|
||||||
title: "삭제 안내",
|
|
||||||
message: "등록하신 내용을 삭제하시겠어요?<br>삭제된 내용은 복구할 수 없습니다.",
|
|
||||||
type: "confirm",
|
|
||||||
dialogType: "confirm",
|
|
||||||
callback: function () {
|
|
||||||
formControl.remove(id);
|
|
||||||
},
|
|
||||||
});
|
|
||||||
},
|
|
||||||
remove(id) {
|
|
||||||
console.log('remove', id)
|
|
||||||
ajaxUtil._ajaxAsync(
|
|
||||||
ENV.httpUrl.remove,
|
|
||||||
{ 'id': id },
|
|
||||||
function (rstData, status) {
|
|
||||||
location.reload();
|
|
||||||
},
|
|
||||||
);
|
|
||||||
},
|
|
||||||
resetConfirm() {
|
|
||||||
etUI.dialog.alert({
|
|
||||||
title: "초기화 안내",
|
|
||||||
message: "등록하신 모든 내용을 삭제하시겠어요?<br>삭제된 내용은 복구할 수 없습니다.",
|
|
||||||
type: "confirm",
|
|
||||||
dialogType: "confirm",
|
|
||||||
callback: function () {
|
|
||||||
formControl.reset();
|
|
||||||
},
|
|
||||||
});
|
|
||||||
},
|
|
||||||
reset() {
|
|
||||||
ajaxUtil._ajaxAsync(
|
|
||||||
ENV.httpUrl.reset,
|
|
||||||
{},
|
|
||||||
function (rstData, status) {
|
|
||||||
location.reload();
|
|
||||||
},
|
|
||||||
);
|
|
||||||
},
|
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
</section>
|
</section>
|
||||||
|
|||||||
@@ -3,14 +3,6 @@
|
|||||||
xmlns:th="http://www.thymeleaf.org" lang="ko">
|
xmlns:th="http://www.thymeleaf.org" lang="ko">
|
||||||
|
|
||||||
<th:block>
|
<th:block>
|
||||||
<th:block th:if="${@systemProperties['spring.profiles.active'] eq 'local'}">
|
|
||||||
<div>
|
|
||||||
reqVO: [[${reqVO}]]
|
|
||||||
</div>
|
|
||||||
<div>
|
|
||||||
detail: [[${dailyRecord}]]
|
|
||||||
</div>
|
|
||||||
</th:block>
|
|
||||||
<div class="modal-content-inner">
|
<div class="modal-content-inner">
|
||||||
<div class="component-btns type-tab"
|
<div class="component-btns type-tab"
|
||||||
th:if="${not detail.updated}">
|
th:if="${not detail.updated}">
|
||||||
@@ -57,7 +49,7 @@
|
|||||||
<span class="select-sub-txt">임산물 수입이 있는 경우, 등록해 주세요.</span>
|
<span class="select-sub-txt">임산물 수입이 있는 경우, 등록해 주세요.</span>
|
||||||
</div>
|
</div>
|
||||||
<div id="cropCode" class="component-select bottom-sheet" data-props-default="재배형태를 선택해 주세요" data-props-type="bottomSheet">
|
<div id="cropCode" class="component-select bottom-sheet" data-props-default="재배형태를 선택해 주세요" data-props-type="bottomSheet">
|
||||||
<input type="hidden1" name="cropCode" th:value="${detail.cropCode}" data-type="select">
|
<input type="hidden" name="cropCode" th:value="${detail.cropCode}" data-type="select">
|
||||||
<button type="button" class="select-box">
|
<button type="button" class="select-box">
|
||||||
<span class="select-txt"></span>
|
<span class="select-txt"></span>
|
||||||
</button>
|
</button>
|
||||||
@@ -130,7 +122,7 @@
|
|||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
<div id="unitCode" class="component-select bottom-sheet" data-props-default="단위를 선택해 주세요" data-props-type="bottomSheet">
|
<div id="unitCode" class="component-select bottom-sheet" data-props-default="단위를 선택해 주세요" data-props-type="bottomSheet">
|
||||||
<input type="hidden1" name="unitCode" th:value="${detail.unitCode}">
|
<input type="hidden" name="unitCode" th:value="${detail.unitCode}">
|
||||||
<button type="button" class="select-box">
|
<button type="button" class="select-box">
|
||||||
<span class="select-txt"></span>
|
<span class="select-txt"></span>
|
||||||
</button>
|
</button>
|
||||||
@@ -152,6 +144,11 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="component-input" data-option="직접 입력">
|
||||||
|
<div class="input-field">
|
||||||
|
<input type="text" name="unitSelf" th:value="${detail.unitSelf}" maxlength="30" placeholder="단위를 입력해 주세요">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
@@ -194,13 +191,12 @@
|
|||||||
|
|
||||||
<div class="component-btns">
|
<div class="component-btns">
|
||||||
<div class="btns-row">
|
<div class="btns-row">
|
||||||
<button type="button" class="btn btn-full btn-l btn-primary" onclick="formControl.createVaild();">
|
<button type="button" class="btn btn-full btn-l btn-primary" onclick="modalControl.createVaild();">
|
||||||
<span class="btn-txt">등록</span>
|
<span class="btn-txt">등록</span>
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</th:block>
|
</th:block>
|
||||||
|
|
||||||
</html>
|
</html>
|
||||||
@@ -3,14 +3,6 @@
|
|||||||
xmlns:th="http://www.thymeleaf.org" lang="ko">
|
xmlns:th="http://www.thymeleaf.org" lang="ko">
|
||||||
|
|
||||||
<div layout:fragment="content" th:classappend="acco-wrap">
|
<div layout:fragment="content" th:classappend="acco-wrap">
|
||||||
<th:block th:if="${@systemProperties['spring.profiles.active'] eq 'local'}">
|
|
||||||
<div>
|
|
||||||
reqVO: [[${reqVO}]]
|
|
||||||
</div>
|
|
||||||
<div>
|
|
||||||
dailyRecord: [[${dailyRecord}]]
|
|
||||||
</div>
|
|
||||||
</th:block>
|
|
||||||
<main id="content" role="main">
|
<main id="content" role="main">
|
||||||
<div class="inner">
|
<div class="inner">
|
||||||
<hgroup class="tit-group">
|
<hgroup class="tit-group">
|
||||||
@@ -27,9 +19,6 @@
|
|||||||
<p>수입 내역을 등록해 주세요.</p>
|
<p>수입 내역을 등록해 주세요.</p>
|
||||||
</hgroup>
|
</hgroup>
|
||||||
|
|
||||||
<form name="reqForm">
|
|
||||||
<input type="hidden" name="todayNone" value="N">
|
|
||||||
</form>
|
|
||||||
<!--/* 신규 등록 */-->
|
<!--/* 신규 등록 */-->
|
||||||
<th:block th:if="${#lists.isEmpty(incomeList)}">
|
<th:block th:if="${#lists.isEmpty(incomeList)}">
|
||||||
<button type="button" class="btn btn-m btn-secondary btn-full button-modal01" data-testid="button-modal01"
|
<button type="button" class="btn btn-m btn-secondary btn-full button-modal01" data-testid="button-modal01"
|
||||||
@@ -41,6 +30,7 @@
|
|||||||
<div class="component-input align-center">
|
<div class="component-input align-center">
|
||||||
<label class="checkbox-inner" id="todayNone">
|
<label class="checkbox-inner" id="todayNone">
|
||||||
<input type="checkbox" name="todayNone"
|
<input type="checkbox" name="todayNone"
|
||||||
|
data-type="INCOME"
|
||||||
th:checked="${#strings.equals(dailyRecord.incomeStatus, 'TODAY_NONE')}">
|
th:checked="${#strings.equals(dailyRecord.incomeStatus, 'TODAY_NONE')}">
|
||||||
<span class="checkbox-item">
|
<span class="checkbox-item">
|
||||||
<span class="checkbox-txt">금일 등록내용 없음</span>
|
<span class="checkbox-txt">금일 등록내용 없음</span>
|
||||||
@@ -53,7 +43,7 @@
|
|||||||
<section class="regist-item-area">
|
<section class="regist-item-area">
|
||||||
<p class="total">
|
<p class="total">
|
||||||
<span>총 <strong>[[${#lists.size(incomeList)}]]</strong>건</span>
|
<span>총 <strong>[[${#lists.size(incomeList)}]]</strong>건</span>
|
||||||
<button type="button" class="btn-reset" onclick="formControl.resetConfirm()">
|
<button type="button" class="btn-reset" onclick="krip.daily.resetConfirm()">
|
||||||
<i class="ico-reset ico-small" aria-hidden="true"></i>
|
<i class="ico-reset ico-small" aria-hidden="true"></i>
|
||||||
<span>초기화</span>
|
<span>초기화</span>
|
||||||
</button>
|
</button>
|
||||||
@@ -64,8 +54,8 @@
|
|||||||
<div class="item-tit-group">
|
<div class="item-tit-group">
|
||||||
<p class="item-name">[[${item.categorySelf}]]</p>
|
<p class="item-name">[[${item.categorySelf}]]</p>
|
||||||
<div class="btn-group">
|
<div class="btn-group">
|
||||||
<button type="button" class="delete" th:onclick="formControl.removeConfirm([[${item.id}]])"><span class="hide-txt">삭제</span></button>
|
<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="formControl.createModal([[${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>
|
||||||
</div>
|
</div>
|
||||||
<ul class="detail-list">
|
<ul class="detail-list">
|
||||||
@@ -153,64 +143,25 @@
|
|||||||
remove: /*[[|/api/record/income/${reqVO.searchMonth}/${reqVO.groupNo}/remove|]]*/'removeUrl',
|
remove: /*[[|/api/record/income/${reqVO.searchMonth}/${reqVO.groupNo}/remove|]]*/'removeUrl',
|
||||||
reset: /*[[|/api/record/income/${reqVO.searchMonth}/${reqVO.groupNo}/reset|]]*/'resetUrl',
|
reset: /*[[|/api/record/income/${reqVO.searchMonth}/${reqVO.groupNo}/reset|]]*/'resetUrl',
|
||||||
},
|
},
|
||||||
|
modal: {
|
||||||
|
// 등록 버튼
|
||||||
|
selectorId: '.button-modal01',
|
||||||
|
// 등록 영역
|
||||||
|
selector: '.modal01',
|
||||||
|
},
|
||||||
month: /*[[${reqVO.searchMonth}]]*/'month',
|
month: /*[[${reqVO.searchMonth}]]*/'month',
|
||||||
groupNo: /*[[${reqVO.groupNo}]]*/'groupNo',
|
groupNo: /*[[${reqVO.groupNo}]]*/'groupNo',
|
||||||
submitted: false,
|
submitted: false,
|
||||||
};
|
};
|
||||||
|
|
||||||
let bind = {
|
|
||||||
form: {
|
|
||||||
selectorId: '.button-modal01',
|
|
||||||
selector: '.modal01',
|
|
||||||
},
|
|
||||||
selectbox: null,
|
|
||||||
}
|
|
||||||
|
|
||||||
let formControl = {
|
let formControl = {
|
||||||
init() {
|
init() {
|
||||||
formControl._bindUI();
|
krip.daily.baseBindUI();
|
||||||
//formControl.createModal();
|
|
||||||
},
|
},
|
||||||
_bindUI() {
|
};
|
||||||
etUI.locales.ko = {
|
|
||||||
dialog: {
|
|
||||||
positive: '예',
|
|
||||||
negative: '아니오',
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
let $noneWrap = $('#todayNone');
|
let modalControl = {
|
||||||
$noneWrap.on('click', 'input[name="todayNone"]', function () {
|
|
||||||
let checked = $(this).is(':checked');
|
|
||||||
let $btn = $('.button-modal01');
|
|
||||||
$btn.attr('disabled', checked);
|
|
||||||
if (checked) {
|
|
||||||
$btn.find('i').addClass('ico-add-disabled');
|
|
||||||
$btn.find('i').removeClass('ico-add');
|
|
||||||
document.reqForm.todayNone.value = 'Y';
|
|
||||||
} else {
|
|
||||||
$btn.find('i').addClass('ico-add');
|
|
||||||
$btn.find('i').removeClass('ico-add-disabled');
|
|
||||||
document.reqForm.todayNone.value = 'N';
|
|
||||||
}
|
|
||||||
|
|
||||||
krip.daily.todayNone(ENV.month, ENV.groupNo, 'INCOME', checked);
|
|
||||||
});
|
|
||||||
|
|
||||||
let $formWrap = $(bind.form.selectorId);
|
|
||||||
$formWrap.on('click', function() {
|
|
||||||
formControl.createModal();
|
|
||||||
});
|
|
||||||
|
|
||||||
// const $btnModal01 = document.querySelector(".button-modal01");
|
|
||||||
// $btnModal01.addEventListener("click", function() {
|
|
||||||
// const modal01 = document.querySelector(".modal01").ui;
|
|
||||||
// modal01.open();
|
|
||||||
// });
|
|
||||||
},
|
|
||||||
_bindModelUI() {
|
_bindModelUI() {
|
||||||
etUI.initUI();
|
|
||||||
|
|
||||||
const $select1 = document.querySelector('#cropCode');
|
const $select1 = document.querySelector('#cropCode');
|
||||||
const selectboxInstance1 = new etUI.components.SelectBox();
|
const selectboxInstance1 = new etUI.components.SelectBox();
|
||||||
selectboxInstance1.core.init($select1, {
|
selectboxInstance1.core.init($select1, {
|
||||||
@@ -226,53 +177,56 @@
|
|||||||
selectItemCallback({selectValue, dataValue}){
|
selectItemCallback({selectValue, dataValue}){
|
||||||
console.log('selectItemCallback', selectValue, dataValue)
|
console.log('selectItemCallback', selectValue, dataValue)
|
||||||
$('input[name="unitCode"]').val(dataValue)
|
$('input[name="unitCode"]').val(dataValue)
|
||||||
|
|
||||||
|
// TODO : ui js 에서 show 적용유무 파악하기
|
||||||
|
if (dataValue === 'code.record.unit.self') {
|
||||||
|
$('#unitCode').parent().find('.component-input').addClass('show');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
const $formWrap = $(bind.form.selector).find('form');
|
const $formWrap = $(ENV.modal.selector).find('form');
|
||||||
$formWrap.on('keyup', 'input[name="price"]', function() {
|
const $price = $(ENV.modal.selector).find('form input[name="price"]');
|
||||||
// TODO : UI disabled
|
const $estimatedValue = $(ENV.modal.selector).find('form input[name="estimatedValue"]');
|
||||||
|
$price.on('keyup', function() {
|
||||||
if ($(this).val() === '') {
|
if ($(this).val() === '') {
|
||||||
$formWrap.find('input[name="estimatedValue"]').attr('disabled', false);
|
modalControl._priceActive($estimatedValue);
|
||||||
} else {
|
} else {
|
||||||
$formWrap.find('input[name="estimatedValue"]').val('').attr('disabled', true);
|
modalControl._priceDisabled($estimatedValue);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
$formWrap.on('keyup', 'input[name="estimatedValue"]', function() {
|
$estimatedValue.on('keyup', function() {
|
||||||
// TODO : UI disabled
|
|
||||||
if ($(this).val() === '') {
|
if ($(this).val() === '') {
|
||||||
$formWrap.find('input[name="price"]').attr('disabled', false);
|
modalControl._priceActive($price);
|
||||||
} else {
|
} else {
|
||||||
$formWrap.find('input[name="price"]').val('').attr('disabled', true);
|
modalControl._priceDisabled($price);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
|
||||||
createModal(id) {
|
// data set
|
||||||
if (id === undefined) {
|
selectboxInstance1.setValue($formWrap.find('input[name="cropCode"]').val());
|
||||||
id = 0;
|
//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);
|
||||||
}
|
}
|
||||||
|
},
|
||||||
ajaxUtil._ajaxAsyncMethod(
|
_priceActive($input) {
|
||||||
ENV.httpUrl.form.replace('{id}', id),
|
$input.val('').attr('disabled', false);
|
||||||
{},
|
$input.parent().parent().closest('.component-input').removeClass('input-disabled');
|
||||||
function(rstHtml, status) {
|
},
|
||||||
$('.modal01').find('.modal-content').html(rstHtml);
|
_priceDisabled($input) {
|
||||||
|
$input.val('').attr('disabled', true);
|
||||||
const modal01 = document.querySelector(".modal01").ui;
|
$input.parent().parent().closest('.component-input').addClass('input-disabled');
|
||||||
modal01.open();
|
|
||||||
|
|
||||||
formControl._bindModelUI();
|
|
||||||
},
|
|
||||||
function(code, rstData) {
|
|
||||||
kri.logger.error('Do nothing. code: '+ code, rstData);
|
|
||||||
},
|
|
||||||
'get',
|
|
||||||
'html'
|
|
||||||
);
|
|
||||||
},
|
},
|
||||||
createVaild() {
|
createVaild() {
|
||||||
formControl.create();
|
modalControl.create();
|
||||||
},
|
},
|
||||||
create() {
|
create() {
|
||||||
const f = document.reqModalForm;
|
const f = document.reqModalForm;
|
||||||
@@ -286,6 +240,7 @@
|
|||||||
function (rstData, status) {
|
function (rstData, status) {
|
||||||
console.log('rstData', rstData)
|
console.log('rstData', rstData)
|
||||||
location.reload();
|
location.reload();
|
||||||
|
// TODO : next
|
||||||
/*
|
/*
|
||||||
if (f.todayNone.value === 'Y') {
|
if (f.todayNone.value === 'Y') {
|
||||||
krip.daily.goToMain();
|
krip.daily.goToMain();
|
||||||
@@ -296,47 +251,6 @@
|
|||||||
},
|
},
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
removeConfirm(id) {
|
|
||||||
etUI.dialog.alert({
|
|
||||||
title: "삭제 안내",
|
|
||||||
message: "등록하신 내용을 삭제하시겠어요?<br>삭제된 내용은 복구할 수 없습니다.",
|
|
||||||
type: "confirm",
|
|
||||||
dialogType: "confirm",
|
|
||||||
callback: function () {
|
|
||||||
formControl.remove(id);
|
|
||||||
},
|
|
||||||
});
|
|
||||||
},
|
|
||||||
remove(id) {
|
|
||||||
console.log('remove', id)
|
|
||||||
ajaxUtil._ajaxAsync(
|
|
||||||
ENV.httpUrl.remove,
|
|
||||||
{ 'id': id },
|
|
||||||
function (rstData, status) {
|
|
||||||
location.reload();
|
|
||||||
},
|
|
||||||
);
|
|
||||||
},
|
|
||||||
resetConfirm() {
|
|
||||||
etUI.dialog.alert({
|
|
||||||
title: "초기화 안내",
|
|
||||||
message: "등록하신 모든 내용을 삭제하시겠어요?<br>삭제된 내용은 복구할 수 없습니다.",
|
|
||||||
type: "confirm",
|
|
||||||
dialogType: "confirm",
|
|
||||||
callback: function () {
|
|
||||||
formControl.reset();
|
|
||||||
},
|
|
||||||
});
|
|
||||||
},
|
|
||||||
reset() {
|
|
||||||
ajaxUtil._ajaxAsync(
|
|
||||||
ENV.httpUrl.reset,
|
|
||||||
{},
|
|
||||||
function (rstData, status) {
|
|
||||||
location.reload();
|
|
||||||
},
|
|
||||||
);
|
|
||||||
},
|
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
</section>
|
</section>
|
||||||
|
|||||||
Reference in New Issue
Block a user