Merge branch 'daily' into dev
This commit is contained in:
@@ -17,8 +17,8 @@ public class DailyExpenseDto {
|
||||
private String unitCode;
|
||||
private String unitLabel;
|
||||
private String unitSelf;
|
||||
private Integer price;
|
||||
private Integer estimatedValue;
|
||||
private Long price;
|
||||
private Long estimatedValue;
|
||||
|
||||
/**
|
||||
* 수정 가능 여부
|
||||
|
||||
@@ -52,9 +52,9 @@ public class CreateDailyExpenseReqVO extends DailyUIReqVO {
|
||||
/**
|
||||
* 현금
|
||||
*/
|
||||
private Integer price;
|
||||
private Long price;
|
||||
/**
|
||||
* 현물평가액
|
||||
*/
|
||||
private Integer estimatedValue;
|
||||
private Long estimatedValue;
|
||||
}
|
||||
|
||||
@@ -13,6 +13,7 @@ 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 app.module.front.usecase.daily.record.ports.application.DailyRecordService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@@ -23,6 +24,7 @@ import java.util.List;
|
||||
public class DailyExpenseService implements DailyExpensePortIn {
|
||||
private final DailyExpensePortOut portOut;
|
||||
private final UICodeListPortIn uiCodeListPortIn;
|
||||
private final DailyRecordService dailyRecordService;
|
||||
|
||||
@Override
|
||||
public List<DailyExpenseDto> list(DailyExpenseUIReqVO reqVO) {
|
||||
@@ -107,6 +109,8 @@ public class DailyExpenseService implements DailyExpensePortIn {
|
||||
formVO.getEstimatedValue()));
|
||||
|
||||
portOut.create(findCmd, command);
|
||||
|
||||
dailyRecordService.updateByAllStatus(findCmd.getSearchMonth(), findCmd.getGroupNo());
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -127,5 +131,7 @@ public class DailyExpenseService implements DailyExpensePortIn {
|
||||
formVO.getDailyRecordSeq()));
|
||||
|
||||
portOut.remove(findCmd, command);
|
||||
|
||||
dailyRecordService.updateByAllStatus(findCmd.getSearchMonth(), findCmd.getGroupNo());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,6 +29,6 @@ public class CreateDailyExpenseCmd extends FrontAuditCommand {
|
||||
private Double quantity;
|
||||
private String unitCode;
|
||||
private String unitSelf;
|
||||
private Integer price;
|
||||
private Integer estimatedValue;
|
||||
private Long price;
|
||||
private Long estimatedValue;
|
||||
}
|
||||
|
||||
@@ -16,7 +16,7 @@ public class DailyFarmingDto {
|
||||
private String unitCode;
|
||||
private String unitLabel;
|
||||
private String unitSelf;
|
||||
private Integer estimatedValue;
|
||||
private Long estimatedValue;
|
||||
|
||||
/**
|
||||
* 수정 가능 여부
|
||||
|
||||
@@ -46,5 +46,5 @@ public class CreateDailyFarmingReqVO extends DailyUIReqVO {
|
||||
/**
|
||||
* 현물평가액
|
||||
*/
|
||||
private Integer estimatedValue;
|
||||
private Long estimatedValue;
|
||||
}
|
||||
|
||||
@@ -13,6 +13,7 @@ import app.module.front.usecase.daily.farming.ports.DailyFarmingPortOut;
|
||||
import app.module.front.usecase.daily.farming.ports.application.domain.CreateDailyFarmingCmd;
|
||||
import app.module.front.usecase.daily.farming.ports.application.domain.GetDailyFarmingCmd;
|
||||
import app.module.front.usecase.daily.farming.ports.application.domain.RemoveDailyFarmingCmd;
|
||||
import app.module.front.usecase.daily.record.ports.application.DailyRecordService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
@@ -25,6 +26,7 @@ import java.util.List;
|
||||
public class DailyFarmingService implements DailyFarmingPortIn {
|
||||
private final DailyFarmingPortOut portOut;
|
||||
private final UICodeListPortIn uiCodeListPortIn;
|
||||
private final DailyRecordService dailyRecordService;
|
||||
|
||||
@Override
|
||||
public List<DailyFarmingDto> list(DailyFarmingUIReqVO reqVO) {
|
||||
@@ -132,6 +134,8 @@ public class DailyFarmingService implements DailyFarmingPortIn {
|
||||
formVO.getEstimatedValue()));
|
||||
|
||||
portOut.create(findCmd, command);
|
||||
|
||||
dailyRecordService.updateByAllStatus(findCmd.getSearchMonth(), findCmd.getGroupNo());
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -152,5 +156,7 @@ public class DailyFarmingService implements DailyFarmingPortIn {
|
||||
formVO.getDailyRecordSeq()));
|
||||
|
||||
portOut.remove(findCmd, command);
|
||||
|
||||
dailyRecordService.updateByAllStatus(findCmd.getSearchMonth(), findCmd.getGroupNo());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,5 +21,5 @@ public class CreateDailyFarmingCmd extends FrontAuditCommand {
|
||||
private Double quantity;
|
||||
private String unitCode;
|
||||
private String unitSelf;
|
||||
private Integer estimatedValue;
|
||||
private Long estimatedValue;
|
||||
}
|
||||
|
||||
@@ -14,7 +14,7 @@ public class DailyForestryDto {
|
||||
private String unitCode;
|
||||
private String unitLabel;
|
||||
private String unitSelf;
|
||||
private Integer estimatedValue;
|
||||
private Long estimatedValue;
|
||||
|
||||
/**
|
||||
* 수정 가능 여부
|
||||
|
||||
@@ -42,5 +42,5 @@ public class CreateDailyForestryReqVO extends DailyUIReqVO {
|
||||
/**
|
||||
* 현물평가액
|
||||
*/
|
||||
private Integer estimatedValue;
|
||||
private Long estimatedValue;
|
||||
}
|
||||
|
||||
@@ -13,6 +13,7 @@ import app.module.front.usecase.daily.forestry.ports.DailyForestryPortOut;
|
||||
import app.module.front.usecase.daily.forestry.ports.application.domain.CreateDailyForestryCmd;
|
||||
import app.module.front.usecase.daily.forestry.ports.application.domain.GetDailyForestryCmd;
|
||||
import app.module.front.usecase.daily.forestry.ports.application.domain.RemoveDailyForestryCmd;
|
||||
import app.module.front.usecase.daily.record.ports.application.DailyRecordService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
@@ -25,6 +26,7 @@ import java.util.List;
|
||||
public class DailyForestryService implements DailyForestryPortIn {
|
||||
private final DailyForestryPortOut portOut;
|
||||
private final UICodeListPortIn uiCodeListPortIn;
|
||||
private final DailyRecordService dailyRecordService;
|
||||
|
||||
@Override
|
||||
public List<DailyForestryDto> list(DailyForestryUIReqVO reqVO) {
|
||||
@@ -105,6 +107,8 @@ public class DailyForestryService implements DailyForestryPortIn {
|
||||
formVO.getEstimatedValue()));
|
||||
|
||||
portOut.create(findCmd, command);
|
||||
|
||||
dailyRecordService.updateByAllStatus(findCmd.getSearchMonth(), findCmd.getGroupNo());
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -125,5 +129,7 @@ public class DailyForestryService implements DailyForestryPortIn {
|
||||
formVO.getDailyRecordSeq()));
|
||||
|
||||
portOut.remove(findCmd, command);
|
||||
|
||||
dailyRecordService.updateByAllStatus(findCmd.getSearchMonth(), findCmd.getGroupNo());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,5 +19,5 @@ public class CreateDailyForestryCmd extends FrontAuditCommand {
|
||||
private Double quantity;
|
||||
private String unitCode;
|
||||
private String unitSelf;
|
||||
private Integer estimatedValue;
|
||||
private Long estimatedValue;
|
||||
}
|
||||
|
||||
@@ -19,8 +19,8 @@ public class DailyIncomeDto {
|
||||
private String unitCode;
|
||||
private String unitLabel;
|
||||
private String unitSelf;
|
||||
private Integer price;
|
||||
private Integer estimatedValue;
|
||||
private Long price;
|
||||
private Long estimatedValue;
|
||||
|
||||
/**
|
||||
* 수정 가능 여부
|
||||
|
||||
@@ -55,9 +55,9 @@ public class CreateDailyIncomeReqVO extends DailyUIReqVO {
|
||||
/**
|
||||
* 현금
|
||||
*/
|
||||
private Integer price;
|
||||
private Long price;
|
||||
/**
|
||||
* 현물평가액
|
||||
*/
|
||||
private Integer estimatedValue;
|
||||
private Long estimatedValue;
|
||||
}
|
||||
|
||||
@@ -13,6 +13,7 @@ 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 app.module.front.usecase.daily.record.ports.application.DailyRecordService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@@ -23,6 +24,7 @@ import java.util.List;
|
||||
public class DailyIncomeService implements DailyIncomePortIn {
|
||||
private final DailyIncomePortOut portOut;
|
||||
private final UICodeListPortIn uiCodeListPortIn;
|
||||
private final DailyRecordService dailyRecordService;
|
||||
|
||||
@Override
|
||||
public List<DailyIncomeDto> list(DailyIncomeUIReqVO reqVO) {
|
||||
@@ -111,6 +113,8 @@ public class DailyIncomeService implements DailyIncomePortIn {
|
||||
formVO.getEstimatedValue()));
|
||||
|
||||
portOut.create(findCmd, command);
|
||||
|
||||
dailyRecordService.updateByAllStatus(findCmd.getSearchMonth(), findCmd.getGroupNo());
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -131,5 +135,7 @@ public class DailyIncomeService implements DailyIncomePortIn {
|
||||
formVO.getDailyRecordSeq()));
|
||||
|
||||
portOut.remove(findCmd, command);
|
||||
|
||||
dailyRecordService.updateByAllStatus(findCmd.getSearchMonth(), findCmd.getGroupNo());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -30,6 +30,6 @@ public class CreateDailyIncomeCmd extends FrontAuditCommand {
|
||||
private Double quantity;
|
||||
private String unitCode;
|
||||
private String unitSelf;
|
||||
private Integer price;
|
||||
private Integer estimatedValue;
|
||||
private Long price;
|
||||
private Long estimatedValue;
|
||||
}
|
||||
|
||||
@@ -16,6 +16,7 @@ import app.module.front.usecase.daily.power.ports.DailyPowerPortOut;
|
||||
import app.module.front.usecase.daily.power.ports.application.domain.CreateDailyPowerCmd;
|
||||
import app.module.front.usecase.daily.power.ports.application.domain.GetDailyPowerCmd;
|
||||
import app.module.front.usecase.daily.power.ports.application.domain.RemoveDailyPowerCmd;
|
||||
import app.module.front.usecase.daily.record.ports.application.DailyRecordService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@@ -25,6 +26,7 @@ import java.util.List;
|
||||
@RequiredArgsConstructor
|
||||
public class DailyPowerService implements DailyPowerPortIn {
|
||||
private final DailyPowerPortOut portOut;
|
||||
private final DailyRecordService dailyRecordService;
|
||||
|
||||
@Override
|
||||
public List<DailyPowerDto> list(DailyPowerUIReqVO reqVO) {
|
||||
@@ -71,6 +73,8 @@ public class DailyPowerService implements DailyPowerPortIn {
|
||||
formVO.getLeasedHours()));
|
||||
|
||||
portOut.create(findCmd, command);
|
||||
|
||||
dailyRecordService.updateByAllStatus(findCmd.getSearchMonth(), findCmd.getGroupNo());
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -91,5 +95,7 @@ public class DailyPowerService implements DailyPowerPortIn {
|
||||
formVO.getDailyRecordSeq()));
|
||||
|
||||
portOut.remove(findCmd, command);
|
||||
|
||||
dailyRecordService.updateByAllStatus(findCmd.getSearchMonth(), findCmd.getGroupNo());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@ package app.module.front.usecase.daily.record.adapters.persistence;
|
||||
import app.module.front.config.application.util.AuditUtil;
|
||||
import app.module.front.usecase.daily.record.adapters.persistence.model.DailyRecordDto;
|
||||
import app.module.front.usecase.daily.record.adapters.persistence.model.DailyRecordStatusDto;
|
||||
import app.module.front.usecase.daily.record.adapters.web.model.CreateDailyRecordReqVO;
|
||||
import app.module.front.usecase.daily.record.adapters.web.model.DailyStatus;
|
||||
import app.module.front.usecase.daily.record.adapters.web.model.DailyTargetStatus;
|
||||
import app.module.front.usecase.daily.record.ports.DailyRecordPortOut;
|
||||
import app.module.front.usecase.daily.record.ports.application.domain.CreateDailyRecordCmd;
|
||||
@@ -15,7 +15,6 @@ import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.time.LocalDate;
|
||||
import java.util.Collections;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
@@ -64,7 +63,7 @@ public class DailyRecordDao implements DailyRecordPortOut {
|
||||
log.warn("[DailyRecordCreate] existCount={}, recordMonth={}, dayGroupNo={}", existCount, findCmd.getSearchMonth(), findCmd.getGroupNo());
|
||||
}
|
||||
|
||||
this.updateByAllStatus(findCmd);
|
||||
this.updateByAllStatus(findCmd.getSearchMonth(), findCmd.getGroupNo(), findCmd.getHouseholdSeq());
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -79,24 +78,128 @@ public class DailyRecordDao implements DailyRecordPortOut {
|
||||
)
|
||||
);
|
||||
|
||||
dailyRecordMapper.updateDailyRecordStatus(command);
|
||||
if ("ALL".equals(targetType)) {
|
||||
String allStatus = this.getUpdateAllStatus(recordMonth, dayGroupNo, command.getHouseholdSeq());
|
||||
if (allStatus != null) {
|
||||
command.setAllStatus(allStatus);
|
||||
|
||||
this.updateByAllStatus(new GetDailyRecordCmd(recordMonth, dayGroupNo, command.getHouseholdSeq()));
|
||||
dailyRecordMapper.updateDailyRecordStatus(command);
|
||||
|
||||
} else {
|
||||
log.debug("[updateByAllStatus] do nothing. findCmd: {}", command);
|
||||
}
|
||||
|
||||
} else {
|
||||
dailyRecordMapper.updateDailyRecordStatus(command);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* TODO : target 업데이트 후 데이터 등록이 완료된 건은 allStatus 값 변경해주기
|
||||
* @param findCmd
|
||||
* 일계부 전체 입력상태 변경
|
||||
*
|
||||
* @param searchMonth
|
||||
* @param dayGroupNo
|
||||
* @param householdSeq
|
||||
*/
|
||||
private void updateByAllStatus(GetDailyRecordCmd findCmd) {
|
||||
private void updateByAllStatus(String searchMonth, Integer dayGroupNo, Long householdSeq) {
|
||||
String allStatus = this.getUpdateAllStatus(searchMonth, dayGroupNo, householdSeq);
|
||||
if (allStatus != null) {
|
||||
UpdateDailyRecordStatusCmd command = AuditUtil.update(
|
||||
new UpdateDailyRecordStatusCmd(
|
||||
searchMonth,
|
||||
dayGroupNo,
|
||||
allStatus,
|
||||
null,
|
||||
null
|
||||
)
|
||||
);
|
||||
|
||||
dailyRecordMapper.updateDailyRecordStatus(command);
|
||||
|
||||
} else {
|
||||
log.debug("[updateByAllStatus] do nothing. findCmd: {}");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* TODO 변경할 전체 입력상태 조회
|
||||
*
|
||||
* @param searchMonth
|
||||
* @param dayGroupNo
|
||||
* @param householdSeq
|
||||
* @return 변경할 전체 입력상태
|
||||
*/
|
||||
private String getUpdateAllStatus(String searchMonth, Integer dayGroupNo, Long householdSeq) {
|
||||
GetDailyRecordCmd findCmd = new GetDailyRecordCmd(searchMonth, dayGroupNo, householdSeq);
|
||||
|
||||
DailyRecordStatusDto statusDetail = null;
|
||||
List<DailyRecordStatusDto> statusList = dailyRecordMapper.getDailyRecordStatus(findCmd);
|
||||
if (statusList != null && !statusList.isEmpty()) {
|
||||
DailyRecordStatusDto statusDetail = statusList.get(0);
|
||||
statusDetail = statusList.get(0);
|
||||
}
|
||||
|
||||
if (DailyTargetStatus.TARGET.equals(statusDetail.getIncomeStatus()) && statusDetail.getIncomeCount() != 0) {
|
||||
String allStatus = null;
|
||||
|
||||
if (statusDetail != null) {
|
||||
if (DailyStatus.TODAY_NONE.equals(statusDetail.getAllStatus())) {
|
||||
// 전체상태=금일없음, 항목=입력대상이 있는지 여부
|
||||
if (this.checkTarget(statusDetail.getIncomeStatus()) || this.checkTarget(statusDetail.getExpenseStatus())
|
||||
|| this.checkTarget(statusDetail.getWorkStatus()) || this.checkTarget(statusDetail.getPowerStatus())
|
||||
|| this.checkTarget(statusDetail.getForestryStatus()) || this.checkTarget(statusDetail.getFarmingStatus())) {
|
||||
allStatus = DailyStatus.WAITING.name();
|
||||
}
|
||||
} else if (DailyStatus.WAITING.equals(statusDetail.getAllStatus())) {
|
||||
// 전체상태=입력중, 항목 COUNT!=0 이 있는지 여부
|
||||
|
||||
int noneCheck = 0;
|
||||
noneCheck = noneCheck + (this.checkTargetDataNone(statusDetail.getIncomeStatus(), statusDetail.getIncomeCount()) ? 1 : 0);
|
||||
noneCheck = noneCheck + (this.checkTargetDataNone(statusDetail.getExpenseStatus(), statusDetail.getExpenseCount()) ? 1 : 0);
|
||||
noneCheck = noneCheck + (this.checkTargetDataNone(statusDetail.getWorkStatus(), statusDetail.getWorkCount()) ? 1 : 0);
|
||||
noneCheck = noneCheck + (this.checkTargetDataNone(statusDetail.getPowerStatus(), statusDetail.getPowerCount()) ? 1 : 0);
|
||||
noneCheck = noneCheck + (this.checkTargetDataNone(statusDetail.getForestryStatus(), statusDetail.getForestryCount()) ? 1 : 0);
|
||||
noneCheck = noneCheck + (this.checkTargetDataNone(statusDetail.getFarmingStatus(), statusDetail.getFarmingCount()) ? 1 : 0);
|
||||
|
||||
if (noneCheck == 0) {
|
||||
allStatus = DailyStatus.DONE.name();
|
||||
}
|
||||
} else if (DailyStatus.DONE.equals(statusDetail.getAllStatus())) {
|
||||
// 전체상태=완료, 항목 COUNT=0 체크
|
||||
int noneCheck = 0;
|
||||
noneCheck = noneCheck + (this.checkTargetDataNone(statusDetail.getIncomeStatus(), statusDetail.getIncomeCount()) ? 1 : 0);
|
||||
noneCheck = noneCheck + (this.checkTargetDataNone(statusDetail.getExpenseStatus(), statusDetail.getExpenseCount()) ? 1 : 0);
|
||||
noneCheck = noneCheck + (this.checkTargetDataNone(statusDetail.getWorkStatus(), statusDetail.getWorkCount()) ? 1 : 0);
|
||||
noneCheck = noneCheck + (this.checkTargetDataNone(statusDetail.getPowerStatus(), statusDetail.getPowerCount()) ? 1 : 0);
|
||||
noneCheck = noneCheck + (this.checkTargetDataNone(statusDetail.getForestryStatus(), statusDetail.getForestryCount()) ? 1 : 0);
|
||||
noneCheck = noneCheck + (this.checkTargetDataNone(statusDetail.getFarmingStatus(), statusDetail.getFarmingCount()) ? 1 : 0);
|
||||
|
||||
if (noneCheck != 0) {
|
||||
allStatus = DailyStatus.WAITING.name();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return allStatus;
|
||||
}
|
||||
|
||||
/**
|
||||
* 입력 대상 상태 조회
|
||||
*
|
||||
* @param status 조회 상태
|
||||
* @return true=입력 대상, false=금일 데이터 없음 또는 대상 아님
|
||||
*/
|
||||
private boolean checkTarget(DailyTargetStatus status) {
|
||||
// NONE 은 대상이 아니기 때문에 체크에서 제외
|
||||
return DailyTargetStatus.TARGET.equals(status);
|
||||
}
|
||||
|
||||
/**
|
||||
* 등록 대상인데 데이터가 없는 경우 조회
|
||||
*
|
||||
* @param status 조회 상태
|
||||
* @param count 조회 건수
|
||||
* @return true=입력대상인데 데이터가 없는 경우, false=입력대상 아니거나, 데이터가 있는 경우
|
||||
*/
|
||||
private boolean checkTargetDataNone(DailyTargetStatus status, Integer count) {
|
||||
return DailyTargetStatus.TARGET.equals(status) && count == 0;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -48,6 +48,7 @@ public class DailyRecordController {
|
||||
formVO.setDayGroupNo(reqVO.getGroupNo());
|
||||
formVO.setStartDate(detail.getStartDate());
|
||||
formVO.setEndDate(detail.getEndDate());
|
||||
formVO.setFarmingStatus(detail.isFarmingOpen());
|
||||
log.debug("formVO: {}", formVO);
|
||||
|
||||
dailyRecordPortIn.create(formVO);
|
||||
|
||||
@@ -23,6 +23,7 @@ public class CreateDailyRecordReqVO {
|
||||
private DailyTargetStatus farmingStatus;
|
||||
|
||||
public void setTodayNone(String todayNone) {
|
||||
this.todayNone = todayNone;
|
||||
if ("Y".equals(todayNone)) {
|
||||
this.allStatus = DailyStatus.TODAY_NONE;
|
||||
this.incomeStatus = DailyTargetStatus.TODAY_NONE;
|
||||
@@ -30,13 +31,6 @@ public class CreateDailyRecordReqVO {
|
||||
this.expenseStatus = DailyTargetStatus.TODAY_NONE;
|
||||
this.powerStatus = DailyTargetStatus.TODAY_NONE;
|
||||
this.forestryStatus = DailyTargetStatus.TODAY_NONE;
|
||||
|
||||
// TODO : 7의 배수와 마지막날의 기준
|
||||
if (dayGroupNo == 4 || dayGroupNo == 8 || dayGroupNo == 12 || dayGroupNo == 16 || dayGroupNo == 17) {
|
||||
this.farmingStatus = DailyTargetStatus.TODAY_NONE;
|
||||
} else {
|
||||
this.farmingStatus = DailyTargetStatus.NONE;
|
||||
}
|
||||
} else {
|
||||
this.allStatus = DailyStatus.WAITING;
|
||||
|
||||
@@ -55,9 +49,18 @@ public class CreateDailyRecordReqVO {
|
||||
if (forestryStatus == null) {
|
||||
this.forestryStatus = DailyTargetStatus.NONE;
|
||||
}
|
||||
if (farmingStatus == null) {
|
||||
}
|
||||
}
|
||||
|
||||
public void setFarmingStatus(boolean isOpen) {
|
||||
if ("Y".equals(todayNone)) {
|
||||
if (isOpen) {
|
||||
this.farmingStatus = DailyTargetStatus.TODAY_NONE;
|
||||
} else {
|
||||
this.farmingStatus = DailyTargetStatus.NONE;
|
||||
}
|
||||
} else if (farmingStatus == null) {
|
||||
this.farmingStatus = DailyTargetStatus.NONE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,4 +21,6 @@ public interface DailyRecordPortIn {
|
||||
void create(CreateDailyRecordReqVO formVO);
|
||||
|
||||
void updateByStatus(String recordMonth, Integer dayGroupNo, String targetType, String targetStatus);
|
||||
|
||||
void updateByAllStatus(String recordMonth, Integer dayGroupNo);
|
||||
}
|
||||
|
||||
@@ -95,5 +95,11 @@ public class DailyRecordService implements DailyRecordPortIn {
|
||||
@Override
|
||||
public void updateByStatus(String recordMonth, Integer dayGroupNo, String targetType, String targetStatus) {
|
||||
portOut.updateByStatus(recordMonth, dayGroupNo, targetType, targetStatus);
|
||||
portOut.updateByStatus(recordMonth, dayGroupNo, "ALL", null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateByAllStatus(String recordMonth, Integer dayGroupNo) {
|
||||
portOut.updateByStatus(recordMonth, dayGroupNo, "ALL", null);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package app.module.front.usecase.daily.work.adapters.persistence;
|
||||
|
||||
import app.module.front.usecase.daily.record.adapters.persistence.DailyRecordDao;
|
||||
import app.module.front.usecase.daily.record.ports.application.DailyRecordService;
|
||||
import app.module.front.usecase.daily.work.adapters.persistence.model.DailyWorkDto;
|
||||
import app.module.front.usecase.daily.work.ports.DailyWorkPortOut;
|
||||
import app.module.front.usecase.daily.work.ports.application.domain.CreateDailyWorkCmd;
|
||||
|
||||
@@ -85,6 +85,8 @@ public class DailyWorkUIController {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
model.addAttribute("recordArea", uiCodeListPortIn.connect("code.record.area"));
|
||||
model.addAttribute("recordUnit", uiCodeListPortIn.connect("code.record.unit"));
|
||||
|
||||
model.addAttribute("reqVO", reqVO);
|
||||
|
||||
@@ -43,9 +43,16 @@ public class CreateDailyWorkValidator implements Validator {
|
||||
&& vo.getHiredMHours() == null && vo.getHiredFHours() == null
|
||||
&& vo.getSharedMHours() == null && vo.getSharedFHours() == null
|
||||
&& vo.getVolunteerMHours() == null && vo.getVolunteerFHours() == null) {
|
||||
errors.rejectValue(
|
||||
"ownerTime", "valid.common.required",
|
||||
"최소 1개의 항목을 입력해주세요.");
|
||||
errors.rejectValue("ownerTime", "valid.common.required");
|
||||
errors.rejectValue("spouseTime", "valid.common.required");
|
||||
errors.rejectValue("familyMHours", "valid.common.required");
|
||||
errors.rejectValue("familyFHours", "valid.common.required");
|
||||
errors.rejectValue("hiredMHours", "valid.common.required");
|
||||
errors.rejectValue("hiredFHours", "valid.common.required");
|
||||
errors.rejectValue("sharedMHours", "valid.common.required");
|
||||
errors.rejectValue("sharedFHours", "valid.common.required");
|
||||
errors.rejectValue("volunteerMHours", "valid.common.required");
|
||||
errors.rejectValue("volunteerFHours", "valid.common.required");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@ 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.record.ports.application.DailyRecordService;
|
||||
import app.module.front.usecase.daily.work.adapters.persistence.model.DailyWorkDto;
|
||||
import app.module.front.usecase.daily.work.adapters.web.model.CreateDailyWorkReqVO;
|
||||
import app.module.front.usecase.daily.work.adapters.web.model.DailyWorkUIReqVO;
|
||||
@@ -23,6 +24,7 @@ import java.util.List;
|
||||
public class DailyWorkService implements DailyWorkPortIn {
|
||||
private final DailyWorkPortOut portOut;
|
||||
private final UICodeListPortIn uiCodeListPortIn;
|
||||
private final DailyRecordService dailyRecordService;
|
||||
|
||||
@Override
|
||||
public List<DailyWorkDto> list(DailyWorkUIReqVO reqVO) {
|
||||
@@ -51,13 +53,14 @@ public class DailyWorkService implements DailyWorkPortIn {
|
||||
reqVO.getHouseholdSeq(),
|
||||
reqVO.getId()));
|
||||
|
||||
List<UICodeElement> recordArea = uiCodeListPortIn.connect("code.record.area");
|
||||
List<UICodeElement> recordUnit = uiCodeListPortIn.connect("code.record.unit");
|
||||
|
||||
for (DailyWorkDto dto : list) {
|
||||
if (CommonConstants.UNIT_CODE_SELF.equals(dto.getAreaUnitCode())) {
|
||||
dto.setAreaUnitLabel(dto.getAreaUnitSelf());
|
||||
} else {
|
||||
dto.setAreaUnitLabel(this.getCodeLabel(dto.getAreaUnitCode(), recordUnit));
|
||||
dto.setAreaUnitLabel(this.getCodeLabel(dto.getAreaUnitCode(), recordArea));
|
||||
}
|
||||
|
||||
if (CommonConstants.UNIT_CODE_SELF.equals(dto.getHarvestUnitCode())) {
|
||||
@@ -120,6 +123,8 @@ public class DailyWorkService implements DailyWorkPortIn {
|
||||
formVO.getVolunteerFHours()));
|
||||
|
||||
portOut.create(findCmd, command);
|
||||
|
||||
dailyRecordService.updateByAllStatus(findCmd.getSearchMonth(), findCmd.getGroupNo());
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -140,5 +145,7 @@ public class DailyWorkService implements DailyWorkPortIn {
|
||||
formVO.getDailyRecordSeq()));
|
||||
|
||||
portOut.remove(findCmd, command);
|
||||
|
||||
dailyRecordService.updateByAllStatus(findCmd.getSearchMonth(), findCmd.getGroupNo());
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user