[FO] 일계부 항목 등록, 수입내역 등록 wip
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
package app.module.core.config.application.exception;
|
||||
|
||||
public class NoRecordDataException extends RuntimeException {
|
||||
/**
|
||||
* 생성자
|
||||
*/
|
||||
public NoRecordDataException() {
|
||||
super("데이터 없음");
|
||||
}
|
||||
|
||||
/**
|
||||
* 생성자
|
||||
*
|
||||
* @param message 예외 메시지
|
||||
*/
|
||||
public NoRecordDataException(String message, Throwable cause) {
|
||||
super(message, cause);
|
||||
}
|
||||
}
|
||||
3
front/.gitignore
vendored
3
front/.gitignore
vendored
@@ -33,4 +33,5 @@ build/
|
||||
.vscode/
|
||||
|
||||
### Project
|
||||
**/resources/static/pages/**
|
||||
**/resources/static/pages/**
|
||||
**/resources/static/guide/**
|
||||
|
||||
@@ -1,58 +1,50 @@
|
||||
package app.module.front.usecase.daily.income.persistence;
|
||||
|
||||
import app.module.front.usecase.daily.income.application.model.DailyIncomeCmd;
|
||||
import app.module.front.usecase.daily.income.persistence.model.CreateDailyIncomeCmd;
|
||||
import app.module.front.usecase.daily.income.persistence.model.DailyIncomeDto;
|
||||
import app.module.front.usecase.daily.income.web.model.DailyIncomeUIReqVO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Mapper
|
||||
public interface DailyIncomeMapper {
|
||||
/**
|
||||
* 수입내역 데이터 존재 여부
|
||||
* @param householdSeq
|
||||
* @param recordMonth
|
||||
* @param dayGroupNo
|
||||
* @return
|
||||
*/
|
||||
Long getDailyIncomeExistCount(@Param("householdSeq") Long householdSeq, @Param("recordMonth") String recordMonth, @Param("dayGroupNo") Integer dayGroupNo);
|
||||
/**
|
||||
* 수입내역 목록 조회
|
||||
*
|
||||
* @param reqVO
|
||||
* @return
|
||||
*/
|
||||
List<DailyIncomeDto> getDailyIncomeList(DailyIncomeUIReqVO reqVO);
|
||||
|
||||
/**
|
||||
* 수입내역 목록 조회
|
||||
* @param householdSeq
|
||||
* @param recordMonth
|
||||
* @param dayGroupNo
|
||||
* @return
|
||||
*/
|
||||
List<DailyIncomeDto> getDailyIncomeList(@Param("householdSeq") Long householdSeq, @Param("recordMonth") String recordMonth, @Param("dayGroupNo") Integer dayGroupNo);
|
||||
/**
|
||||
* 수입내역 데이터 존재 여부
|
||||
*
|
||||
* @param reqVO
|
||||
* @return
|
||||
*/
|
||||
Integer getDailyIncomeExistCount(DailyIncomeUIReqVO reqVO);
|
||||
|
||||
/**
|
||||
* 수입내역 단건 조회
|
||||
* @param householdSeq
|
||||
* @param recordMonth
|
||||
* @param dayGroupNo
|
||||
* @return
|
||||
*/
|
||||
DailyIncomeDto getDailyIncome(@Param("householdSeq") Long householdSeq, @Param("recordMonth") String recordMonth, @Param("dayGroupNo") Integer dayGroupNo);
|
||||
/**
|
||||
* 수입내역 등록
|
||||
*
|
||||
* @param command
|
||||
* @return
|
||||
*/
|
||||
void createDailyIncome(CreateDailyIncomeCmd command);
|
||||
|
||||
/**
|
||||
* 수입내역 등록
|
||||
* @param command
|
||||
* @return
|
||||
*/
|
||||
Long createDailyIncome(DailyIncomeCmd command);
|
||||
/**
|
||||
* 수입내역 수정
|
||||
*
|
||||
* @param command
|
||||
* @return
|
||||
*/
|
||||
int updateDailyIncome(CreateDailyIncomeCmd command);
|
||||
|
||||
/**
|
||||
* 수입내역 수정
|
||||
* @param command
|
||||
* @return
|
||||
*/
|
||||
int updateDailyIncome(DailyIncomeCmd command);
|
||||
|
||||
/**
|
||||
* 수입내역 삭제
|
||||
* @return
|
||||
*/
|
||||
int removeDailyIncome();
|
||||
/**
|
||||
* 수입내역 삭제
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
int removeDailyIncome();
|
||||
}
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
package app.module.front.usecase.daily.income.application.model;
|
||||
package app.module.front.usecase.daily.income.persistence.model;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
public class DailyIncomeCmd {
|
||||
public class CreateDailyIncomeCmd {
|
||||
private Long id;
|
||||
private Long householdSeq;
|
||||
private Boolean isCredit;
|
||||
@@ -8,14 +8,17 @@ import java.time.LocalDateTime;
|
||||
@Getter
|
||||
@Setter
|
||||
public class DailyIncomeDto {
|
||||
private Long id;
|
||||
private Long householdSeq;
|
||||
private Boolean isCredit;
|
||||
// TODO
|
||||
private String createdBy;
|
||||
private LocalDateTime createdAt;
|
||||
private Integer price;
|
||||
private Integer estimatedValue;
|
||||
private String updatedBy;
|
||||
private LocalDateTime updatedAt;
|
||||
private Long id;
|
||||
private Long dailyRecordSeq;
|
||||
// SELF, OCR
|
||||
private String inputType;
|
||||
private Boolean isCredit;
|
||||
private String cropCode;
|
||||
private String categoryCode;
|
||||
private String categorySelf;
|
||||
private String sourcePurpose;
|
||||
private String quantity;
|
||||
private String unitCode;
|
||||
private String price;
|
||||
private String estimated_value;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
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 {
|
||||
List<DailyIncomeDto> getDailyIncomeList(DailyIncomeUIReqVO reqVO);
|
||||
|
||||
DailyIncomeDto getDailyIncome(DailyIncomeUIReqVO reqVO);
|
||||
|
||||
void createDailyIncome(CreateDailyIncomeReqVO command);
|
||||
|
||||
void removeDailyIncome(RemoveDailyIncomeReqVO command);
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
package app.module.front.usecase.daily.income.service;
|
||||
|
||||
import app.module.front.usecase.daily.income.persistence.DailyIncomeMapper;
|
||||
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 lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Slf4j
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class DailyIncomeServiceImpl implements DailyIncomeService {
|
||||
private final DailyIncomeMapper dailyIncomeMapper;
|
||||
|
||||
@Override
|
||||
public List<DailyIncomeDto> getDailyIncomeList(DailyIncomeUIReqVO reqVO) {
|
||||
return this.getRefineIncomeList(reqVO);
|
||||
}
|
||||
|
||||
@Override
|
||||
public DailyIncomeDto getDailyIncome(DailyIncomeUIReqVO reqVO) {
|
||||
List<DailyIncomeDto> list = this.getRefineIncomeList(reqVO);
|
||||
if (list.isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return list.get(0);
|
||||
}
|
||||
|
||||
private List<DailyIncomeDto> getRefineIncomeList(DailyIncomeUIReqVO reqVO) {
|
||||
List<DailyIncomeDto> list = dailyIncomeMapper.getDailyIncomeList(reqVO);
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void createDailyIncome(CreateDailyIncomeReqVO command) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeDailyIncome(RemoveDailyIncomeReqVO command) {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,8 +1,13 @@
|
||||
package app.module.front.usecase.daily.income.web;
|
||||
|
||||
import app.module.core.config.application.exception.NoMatchingURIException;
|
||||
import app.module.core.config.application.exception.NoRecordDataException;
|
||||
import app.module.front.config.application.util.AuthUtil;
|
||||
import app.module.front.usecase.daily.income.persistence.model.DailyIncomeDto;
|
||||
import app.module.front.usecase.daily.income.service.DailyIncomeService;
|
||||
import app.module.front.usecase.daily.income.web.model.DailyIncomeUIReqVO;
|
||||
import app.module.front.usecase.daily.record.persistence.model.DailyRecordDto;
|
||||
import app.module.front.usecase.daily.record.service.DailyRecordService;
|
||||
import app.module.front.usecase.daily.record.web.model.DailyRecordUIReqVO;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
@@ -12,26 +17,47 @@ import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Slf4j
|
||||
@Controller
|
||||
@RequiredArgsConstructor
|
||||
@RequestMapping(path = "/record/income")
|
||||
public class DailyIncomeController {
|
||||
private final DailyRecordService dailyRecordService;
|
||||
private final DailyIncomeService dailyIncomeService;
|
||||
|
||||
@GetMapping(path = "/{searchMonth}/{groupNo}")
|
||||
public String index(Model model,
|
||||
@PathVariable(required = true) String searchMonth,
|
||||
@PathVariable(required = true) String groupNo) {
|
||||
/**
|
||||
* 일계부 수입내역 등록 화면
|
||||
*
|
||||
* @param model
|
||||
* @param searchMonth 검색 월(yyyyMM)
|
||||
* @param groupNo 검색 그룹
|
||||
* @return
|
||||
*/
|
||||
@GetMapping(path = "/{searchMonth}/{groupNo}")
|
||||
public String index(Model model, @PathVariable(required = true) String searchMonth, @PathVariable(required = true) String groupNo) {
|
||||
|
||||
DailyIncomeUIReqVO reqVO = new DailyIncomeUIReqVO();
|
||||
reqVO.setSearchMonth(searchMonth);
|
||||
reqVO.setGroupNo(Integer.parseInt(groupNo));
|
||||
reqVO.setHouseholdSeq(AuthUtil.getUserSeq());
|
||||
log.debug("reqVO: {}", reqVO);
|
||||
DailyRecordUIReqVO recordReqVO = new DailyRecordUIReqVO(searchMonth, groupNo);
|
||||
log.debug("recordReqVO: {}", recordReqVO);
|
||||
|
||||
model.addAttribute("reqVO", reqVO);
|
||||
model.addAttribute("detail", null);
|
||||
DailyRecordDto dailyRecord = dailyRecordService.getDailyRecord(recordReqVO);
|
||||
if (dailyRecord == null || dailyRecord.getId() == null) {
|
||||
throw new NoRecordDataException();
|
||||
}
|
||||
|
||||
return "record/income/index";
|
||||
}
|
||||
DailyIncomeUIReqVO reqVOs = new DailyIncomeUIReqVO();
|
||||
reqVOs.setSearchMonth(searchMonth);
|
||||
reqVOs.setGroupNo(Integer.parseInt(groupNo));
|
||||
reqVOs.setHouseholdSeq(AuthUtil.getUserSeq());
|
||||
log.debug("reqVO: {}", reqVOs);
|
||||
|
||||
List<DailyIncomeDto> incomeList = dailyIncomeService.getDailyIncomeList(reqVOs);
|
||||
|
||||
model.addAttribute("reqVO", reqVOs);
|
||||
model.addAttribute("dailyRecord", dailyRecord);
|
||||
model.addAttribute("incomeList", incomeList);
|
||||
|
||||
return "record/income/index";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
package app.module.front.usecase.daily.income.web.model;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.ToString;
|
||||
|
||||
@Data
|
||||
@ToString
|
||||
public class CreateDailyIncomeReqVO {
|
||||
private Long id;
|
||||
private Long dailyRecordSeq;
|
||||
// SELF, OCR
|
||||
private String inputType;
|
||||
private Boolean isCredit;
|
||||
private String cropCode;
|
||||
private String categoryCode;
|
||||
private String categorySelf;
|
||||
private String sourcePurpose;
|
||||
private String quantity;
|
||||
private String unitCode;
|
||||
private String price;
|
||||
private String estimated_value;
|
||||
}
|
||||
@@ -9,4 +9,5 @@ public class DailyIncomeUIReqVO {
|
||||
private String searchMonth;
|
||||
private Integer groupNo;
|
||||
private Long householdSeq;
|
||||
private Long incomeId;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
package app.module.front.usecase.daily.income.web.model;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.ToString;
|
||||
|
||||
@Data
|
||||
@ToString
|
||||
public class RemoveDailyIncomeReqVO {
|
||||
private Long id;
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
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.CreateDailyRecordReqVO;
|
||||
import app.module.front.usecase.daily.record.web.model.DailyRecordUIReqVO;
|
||||
import app.module.front.usecase.daily.record.web.model.UpdateDailyRecordStatusCmd;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
@@ -10,28 +10,28 @@ import org.apache.ibatis.annotations.Param;
|
||||
@Mapper
|
||||
public interface DailyRecordMapper {
|
||||
|
||||
DailyRecordDto getDailyRecord(DailyRecordUIReqVO reqVO);
|
||||
DailyRecordDto getDailyRecord(DailyRecordUIReqVO reqVO);
|
||||
|
||||
/**
|
||||
* 일계부 등록 여부
|
||||
* @param householdSeq
|
||||
* @param recordMonth
|
||||
* @param dayGroupNo
|
||||
* @return
|
||||
*/
|
||||
Long getDailyRecordExistCount(@Param("householdSeq") Long householdSeq, @Param("recordMonth") String recordMonth, @Param("dayGroupNo") Integer dayGroupNo);
|
||||
/**
|
||||
* 일계부 등록 여부
|
||||
*
|
||||
* @param reqVO
|
||||
* @return
|
||||
*/
|
||||
Integer getDailyRecordExistCount(DailyRecordUIReqVO reqVO);
|
||||
|
||||
/**
|
||||
* 일계부 등록(생성)
|
||||
* @param command
|
||||
* @return
|
||||
*/
|
||||
Long createDailyRecord(CreateDailyRecordReqVO command);
|
||||
/**
|
||||
* 일계부 등록(생성)
|
||||
*
|
||||
* @param command
|
||||
*/
|
||||
void createDailyRecord(CreateDailyRecordCmd command);
|
||||
|
||||
/**
|
||||
* 일계부 상태 수정
|
||||
* @param command
|
||||
* @return
|
||||
*/
|
||||
int updateDailyRecordStatus(UpdateDailyRecordStatusCmd command);
|
||||
/**
|
||||
* 일계부 상태 수정
|
||||
*
|
||||
* @param command
|
||||
* @return
|
||||
*/
|
||||
int updateDailyRecordStatus(UpdateDailyRecordStatusCmd command);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
package app.module.front.usecase.daily.record.persistence.model;
|
||||
|
||||
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.Getter;
|
||||
import lombok.Setter;
|
||||
import lombok.ToString;
|
||||
|
||||
import java.time.LocalDate;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@AllArgsConstructor
|
||||
@ToString
|
||||
public class CreateDailyRecordCmd extends FrontAuditCommand {
|
||||
private Long id;
|
||||
private String recordMonth;
|
||||
private int dayGroupNo;
|
||||
private LocalDate startDate;
|
||||
private LocalDate endDate;
|
||||
private DailyStatus allStatus;
|
||||
private DailyTargetStatus incomeStatus;
|
||||
private DailyTargetStatus workStatus;
|
||||
private DailyTargetStatus expenseStatus;
|
||||
private DailyTargetStatus powerStatus;
|
||||
private DailyTargetStatus forestryStatus;
|
||||
private DailyTargetStatus farmingStatus;
|
||||
}
|
||||
@@ -1,5 +1,7 @@
|
||||
package app.module.front.usecase.daily.record.persistence.model;
|
||||
|
||||
import app.module.front.usecase.daily.record.web.model.DailyStatus;
|
||||
import app.module.front.usecase.daily.record.web.model.DailyTargetStatus;
|
||||
import lombok.Data;
|
||||
import lombok.Setter;
|
||||
|
||||
@@ -11,23 +13,22 @@ public class DailyRecordDto {
|
||||
// , all_status, income_status, work_status, expense_status, power_status, forestry_status
|
||||
// , created_at, created_by, is_deleted
|
||||
|
||||
private Integer groupNo;
|
||||
private Integer startDay;
|
||||
private Integer endDay;
|
||||
private Integer groupNo;
|
||||
private Integer startDay;
|
||||
private Integer endDay;
|
||||
|
||||
private Long id;
|
||||
// TODO enum
|
||||
private LocalDate startDate;
|
||||
private LocalDate endDate;
|
||||
private String allStatus;
|
||||
private String incomeStatus;
|
||||
private Long id;
|
||||
private LocalDate startDate;
|
||||
private LocalDate endDate;
|
||||
private DailyStatus allStatus;
|
||||
private DailyTargetStatus incomeStatus;
|
||||
private DailyTargetStatus workStatus;
|
||||
private DailyTargetStatus expenseStatus;
|
||||
private DailyTargetStatus powerStatus;
|
||||
private DailyTargetStatus forestryStatus;
|
||||
private DailyTargetStatus farmingStatus;
|
||||
|
||||
public boolean isUpdated() {
|
||||
boolean returnValue = false;
|
||||
if (id != null) {
|
||||
returnValue = true;
|
||||
public boolean isUpdated() {
|
||||
return this.id != null;
|
||||
}
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -6,9 +6,9 @@ import lombok.Setter;
|
||||
@Getter
|
||||
@Setter
|
||||
public class UpdateDailyRecordDto {
|
||||
private String monthly;
|
||||
private String updatedBy;
|
||||
private String statusType;
|
||||
private String statusCode;
|
||||
private String monthly;
|
||||
private String updatedBy;
|
||||
private String statusType;
|
||||
private String statusCode;
|
||||
|
||||
}
|
||||
|
||||
@@ -5,7 +5,7 @@ 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);
|
||||
DailyRecordDto getDailyRecord(DailyRecordUIReqVO reqVO);
|
||||
|
||||
void createDailyRecord(CreateDailyRecordReqVO command);
|
||||
void createDailyRecord(CreateDailyRecordReqVO reqVO);
|
||||
}
|
||||
|
||||
@@ -2,11 +2,10 @@ package app.module.front.usecase.daily.record.service;
|
||||
|
||||
import app.module.front.config.application.util.AuditUtil;
|
||||
import app.module.front.usecase.daily.record.persistence.DailyRecordMapper;
|
||||
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.CreateDailyRecordReqVO;
|
||||
import app.module.front.usecase.daily.record.web.model.DailyRecordUIReqVO;
|
||||
import app.module.front.usecase.daily.record.web.model.DailyStatus;
|
||||
import app.module.front.usecase.daily.record.web.model.DailyTargetStatus;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
@@ -20,54 +19,53 @@ import java.util.Locale;
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class DailyRecordServiceImpl implements DailyRecordService {
|
||||
private final DailyRecordMapper dailyRecordMapper;
|
||||
private final DailyRecordMapper dailyRecordMapper;
|
||||
|
||||
@Override
|
||||
public DailyRecordDto getDailyRecord(DailyRecordUIReqVO reqVO) {
|
||||
DailyRecordDto detail = dailyRecordMapper.getDailyRecord(reqVO);
|
||||
if (detail != null && !detail.isUpdated()) {
|
||||
try {
|
||||
SimpleDateFormat beforeSdf = new SimpleDateFormat("yyyyMMdd", Locale.KOREAN);
|
||||
SimpleDateFormat afterSdf = new SimpleDateFormat("yyyy-MM-dd", Locale.KOREAN);
|
||||
@Override
|
||||
public DailyRecordDto getDailyRecord(DailyRecordUIReqVO reqVO) {
|
||||
DailyRecordDto detail = dailyRecordMapper.getDailyRecord(reqVO);
|
||||
if (detail != null && !detail.isUpdated()) {
|
||||
try {
|
||||
SimpleDateFormat beforeSdf = new SimpleDateFormat("yyyyMMdd", Locale.KOREAN);
|
||||
SimpleDateFormat afterSdf = new SimpleDateFormat("yyyy-MM-dd", Locale.KOREAN);
|
||||
|
||||
Date formatDate = beforeSdf.parse(reqVO.getSearchMonth() + String.format("%02d", detail.getStartDay()));
|
||||
detail.setStartDate(LocalDate.parse(afterSdf.format(formatDate)));
|
||||
Date formatDate = beforeSdf.parse(reqVO.getSearchMonth() + String.format("%02d", detail.getStartDay()));
|
||||
detail.setStartDate(LocalDate.parse(afterSdf.format(formatDate)));
|
||||
|
||||
formatDate = beforeSdf.parse(reqVO.getSearchMonth() + String.format("%02d", detail.getEndDay()));
|
||||
detail.setEndDate(LocalDate.parse(afterSdf.format(formatDate)));
|
||||
formatDate = beforeSdf.parse(reqVO.getSearchMonth() + String.format("%02d", detail.getEndDay()));
|
||||
detail.setEndDate(LocalDate.parse(afterSdf.format(formatDate)));
|
||||
|
||||
} catch (Exception e) {
|
||||
log.warn("[DateParse] target={}", detail.getStartDay(), e);
|
||||
}
|
||||
}
|
||||
return detail;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void createDailyRecord(CreateDailyRecordReqVO command) {
|
||||
|
||||
if ("Y".equals(command.getTodayNone())) {
|
||||
command.setAllStatus(DailyStatus.TODAY_NONE);
|
||||
} else {
|
||||
command.setAllStatus(DailyStatus.WAITING);
|
||||
|
||||
if (command.getIncomeStatus() == null) {
|
||||
command.setIncomeStatus(DailyTargetStatus.NONE);
|
||||
}
|
||||
if (command.getWorkStatus() == null) {
|
||||
command.setWorkStatus(DailyTargetStatus.NONE);
|
||||
}
|
||||
if (command.getExpenseStatus() == null) {
|
||||
command.setExpenseStatus(DailyTargetStatus.NONE);
|
||||
}
|
||||
if (command.getPowerStatus() == null) {
|
||||
command.setPowerStatus(DailyTargetStatus.NONE);
|
||||
}
|
||||
if (command.getForestryStatus() == null) {
|
||||
command.setForestryStatus(DailyTargetStatus.NONE);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.warn("[DateParse] target={}", detail.getStartDay(), e);
|
||||
}
|
||||
}
|
||||
return detail;
|
||||
}
|
||||
|
||||
dailyRecordMapper.createDailyRecord(AuditUtil.create(command));
|
||||
}
|
||||
@Override
|
||||
public void createDailyRecord(CreateDailyRecordReqVO reqVO) {
|
||||
CreateDailyRecordCmd command = AuditUtil.create(
|
||||
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) {
|
||||
dailyRecordMapper.createDailyRecord(command);
|
||||
|
||||
log.debug("[CreateDailyRecord] record={}", command);
|
||||
} else {
|
||||
log.warn("[DailyRecordCreate] existCount={}, recordMonth={}, dayGroupNo={}", existCount, reqVO.getRecordMonth(), reqVO.getDayGroupNo());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package app.module.front.usecase.daily.record.web;
|
||||
|
||||
import app.module.front.config.application.util.AuthUtil;
|
||||
import app.module.core.config.application.exception.NoMatchingURIException;
|
||||
import app.module.front.usecase.daily.calendar.service.RecordCalendarService;
|
||||
import app.module.front.usecase.daily.record.persistence.model.DailyRecordDto;
|
||||
import app.module.front.usecase.daily.record.service.DailyRecordService;
|
||||
@@ -22,62 +22,66 @@ import org.springframework.web.bind.annotation.*;
|
||||
@RequiredArgsConstructor
|
||||
@RequestMapping(path = "/record/daily")
|
||||
public class DailyRecordController {
|
||||
private final RecordCalendarService recordCalendarService;
|
||||
private final DailyRecordService dailyRecordService;
|
||||
private final CreateDailyRecordValidator createDailyRecordValidator;;
|
||||
private final RecordCalendarService recordCalendarService;
|
||||
private final DailyRecordService dailyRecordService;
|
||||
private final CreateDailyRecordValidator createDailyRecordValidator;
|
||||
|
||||
@GetMapping(path = "/{searchMonth}/{groupNo}")
|
||||
public String createForm(Model model
|
||||
, @PathVariable(required = true) String searchMonth
|
||||
, @PathVariable(required = true) String groupNo) {
|
||||
/**
|
||||
* 일계부 등록 화면
|
||||
*
|
||||
* @param model
|
||||
* @param searchMonth 검색 월(yyyyMM)
|
||||
* @param groupNo 검색 그룹
|
||||
* @return
|
||||
*/
|
||||
@GetMapping(path = "/{searchMonth}/{groupNo}")
|
||||
public String createForm(Model model, @PathVariable(required = true) String searchMonth, @PathVariable(required = true) String groupNo) {
|
||||
|
||||
DailyRecordUIReqVO reqVO = new DailyRecordUIReqVO();
|
||||
reqVO.setSearchMonth(searchMonth);
|
||||
reqVO.setGroupNo(Integer.parseInt(groupNo));
|
||||
reqVO.setHouseholdSeq(AuthUtil.getUserSeq());
|
||||
log.debug("reqVO: {}", reqVO);
|
||||
DailyRecordUIReqVO reqVO = new DailyRecordUIReqVO(searchMonth, groupNo);
|
||||
log.debug("reqVO: {}", reqVO);
|
||||
|
||||
//uiCodeListPortIn.connect("code.pageable.rows");
|
||||
DailyRecordDto dailyRecord = dailyRecordService.getDailyRecord(reqVO);
|
||||
if (dailyRecord == null) {
|
||||
throw new NoMatchingURIException("[Record] 잘못된 접근");
|
||||
}
|
||||
|
||||
DailyRecordDto detail = dailyRecordService.getDailyRecord(reqVO);
|
||||
model.addAttribute("reqVO", reqVO);
|
||||
model.addAttribute("dailyRecord", dailyRecord);
|
||||
|
||||
model.addAttribute("reqVO", reqVO);
|
||||
model.addAttribute("detail", detail);
|
||||
|
||||
return "record/daily";
|
||||
}
|
||||
|
||||
@PostMapping(path = "/{searchMonth}/{groupNo}")
|
||||
ResponseEntity<?> create(@PathVariable(required = true) String searchMonth
|
||||
, @PathVariable(required = true) String groupNo
|
||||
, @Valid @RequestBody CreateDailyRecordReqVO formVO, BindingResult bindingResult) {
|
||||
|
||||
createDailyRecordValidator.validate(formVO, bindingResult);
|
||||
if (bindingResult.hasErrors()) {
|
||||
return ResponseEntity.status(HttpStatus.UNPROCESSABLE_ENTITY)
|
||||
.body(bindingResult.getFieldErrors());
|
||||
return "record/daily";
|
||||
}
|
||||
|
||||
DailyRecordUIReqVO reqVO = new DailyRecordUIReqVO();
|
||||
reqVO.setSearchMonth(searchMonth);
|
||||
reqVO.setGroupNo(Integer.parseInt(groupNo));
|
||||
// reqVO.setHouseholdSeq(AuthUtil.getUserSeq());
|
||||
log.debug("reqVO: {}", reqVO);
|
||||
/**
|
||||
* 일계부 등록 처리
|
||||
*
|
||||
* @param searchMonth
|
||||
* @param groupNo
|
||||
* @param formVO
|
||||
* @param bindingResult
|
||||
* @return
|
||||
*/
|
||||
@PostMapping(path = "/{searchMonth}/{groupNo}")
|
||||
ResponseEntity<?> create(@PathVariable(required = true) String searchMonth, @PathVariable(required = true) String groupNo
|
||||
, @Valid @RequestBody CreateDailyRecordReqVO formVO, BindingResult bindingResult) {
|
||||
|
||||
//uiCodeListPortIn.connect("code.pageable.rows");
|
||||
createDailyRecordValidator.validate(formVO, bindingResult);
|
||||
if (bindingResult.hasErrors()) {
|
||||
return ResponseEntity.status(HttpStatus.UNPROCESSABLE_ENTITY)
|
||||
.body(bindingResult.getFieldErrors());
|
||||
}
|
||||
|
||||
DailyRecordDto detail = dailyRecordService.getDailyRecord(reqVO);
|
||||
DailyRecordUIReqVO reqVO = new DailyRecordUIReqVO(searchMonth, groupNo);
|
||||
log.debug("reqVO: {}", reqVO);
|
||||
|
||||
formVO.setHouseholdSeq(reqVO.getHouseholdSeq());
|
||||
formVO.setRecordMonth(reqVO.getSearchMonth());
|
||||
formVO.setDayGroupNo(reqVO.getGroupNo());
|
||||
formVO.setStartDate(detail.getStartDate());
|
||||
formVO.setEndDate(detail.getEndDate());
|
||||
DailyRecordDto detail = dailyRecordService.getDailyRecord(reqVO);
|
||||
formVO.setRecordMonth(reqVO.getSearchMonth());
|
||||
formVO.setDayGroupNo(reqVO.getGroupNo());
|
||||
formVO.setStartDate(detail.getStartDate());
|
||||
formVO.setEndDate(detail.getEndDate());
|
||||
log.debug("formVO: {}", formVO);
|
||||
|
||||
log.debug("formVO: {}", formVO);
|
||||
dailyRecordService.createDailyRecord(formVO);
|
||||
log.debug("createDailyRecord: id-{}", formVO.getId());
|
||||
dailyRecordService.createDailyRecord(formVO);
|
||||
|
||||
return ResponseEntity.status(HttpStatus.OK).body(reqVO);
|
||||
}
|
||||
return ResponseEntity.status(HttpStatus.OK).body(reqVO);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,26 +2,51 @@ package app.module.front.usecase.daily.record.web.model;
|
||||
|
||||
import app.module.front.config.adapters.persistence.component.FrontAuditCommand;
|
||||
import lombok.Data;
|
||||
import lombok.ToString;
|
||||
|
||||
import java.time.LocalDate;
|
||||
|
||||
@Data
|
||||
public class CreateDailyRecordReqVO extends FrontAuditCommand {
|
||||
private Long id;
|
||||
// private Long householdSeq;
|
||||
private String recordMonth;
|
||||
private int dayGroupNo;
|
||||
private LocalDate startDate;
|
||||
private LocalDate endDate;
|
||||
// TODO : 전체 상태값 정의 ING, DONE
|
||||
private String todayNone;
|
||||
private DailyStatus allStatus;
|
||||
// TODO : 개별 상태값 정의 WAITING, TYPING, TODAY_NONE, NONE, DONE
|
||||
private DailyTargetStatus incomeStatus;
|
||||
private DailyTargetStatus workStatus;
|
||||
private DailyTargetStatus expenseStatus;
|
||||
private DailyTargetStatus powerStatus;
|
||||
private DailyTargetStatus forestryStatus;
|
||||
// TODO : 무슨 데이터 넣을 것인가?
|
||||
// private String createdBy;
|
||||
@ToString
|
||||
public class CreateDailyRecordReqVO {
|
||||
private Long id;
|
||||
private String recordMonth;
|
||||
private int dayGroupNo;
|
||||
private LocalDate startDate;
|
||||
private LocalDate endDate;
|
||||
private String todayNone;
|
||||
private DailyStatus allStatus;
|
||||
private DailyTargetStatus incomeStatus;
|
||||
private DailyTargetStatus workStatus;
|
||||
private DailyTargetStatus expenseStatus;
|
||||
private DailyTargetStatus powerStatus;
|
||||
private DailyTargetStatus forestryStatus;
|
||||
private DailyTargetStatus farmingStatus;
|
||||
|
||||
public void setTodayNone(String todayNone) {
|
||||
if ("Y".equals(todayNone)) {
|
||||
this.allStatus = DailyStatus.TODAY_NONE;
|
||||
} else {
|
||||
this.allStatus = DailyStatus.WAITING;
|
||||
|
||||
if (incomeStatus == null) {
|
||||
this.incomeStatus = DailyTargetStatus.NONE;
|
||||
}
|
||||
if (workStatus == null) {
|
||||
this.workStatus = DailyTargetStatus.NONE;
|
||||
}
|
||||
if (expenseStatus == null) {
|
||||
this.expenseStatus = DailyTargetStatus.NONE;
|
||||
}
|
||||
if (powerStatus == null) {
|
||||
this.powerStatus = DailyTargetStatus.NONE;
|
||||
}
|
||||
if (forestryStatus == null) {
|
||||
this.forestryStatus = DailyTargetStatus.NONE;
|
||||
}
|
||||
if (farmingStatus == null) {
|
||||
this.farmingStatus = DailyTargetStatus.NONE;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,12 +1,21 @@
|
||||
package app.module.front.usecase.daily.record.web.model;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import lombok.ToString;
|
||||
|
||||
@Data
|
||||
@ToString
|
||||
public class DailyRecordUIReqVO {
|
||||
private String searchMonth;
|
||||
private Integer groupNo;
|
||||
private Long householdSeq;
|
||||
@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,5 +1,17 @@
|
||||
package app.module.front.usecase.daily.record.web.model;
|
||||
|
||||
public enum DailyStatus {
|
||||
WAITING, TODAY_NONE, DONE;
|
||||
/**
|
||||
* 입력중
|
||||
*/
|
||||
WAITING,
|
||||
/**
|
||||
* 등록 없음
|
||||
*/
|
||||
TODAY_NONE,
|
||||
/**
|
||||
* 등록 완료
|
||||
*/
|
||||
DONE,
|
||||
;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,21 @@
|
||||
package app.module.front.usecase.daily.record.web.model;
|
||||
|
||||
public enum DailyTargetStatus {
|
||||
WAITING, TODAY_NONE, NONE, DONE;
|
||||
/**
|
||||
* 입력 중
|
||||
*/
|
||||
WAITING,
|
||||
/**
|
||||
* 금일 없음
|
||||
*/
|
||||
TODAY_NONE,
|
||||
/**
|
||||
* 등록 없음
|
||||
*/
|
||||
NONE,
|
||||
/**
|
||||
* 등록 완료
|
||||
*/
|
||||
DONE,
|
||||
;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
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;
|
||||
}
|
||||
@@ -6,15 +6,15 @@ import lombok.Setter;
|
||||
@Getter
|
||||
@Setter
|
||||
public class UpdateDailyRecordStatusCmd {
|
||||
private Long id;
|
||||
private Long householdSeq;
|
||||
private String recordMonth;
|
||||
private int dayGroupNo;
|
||||
// TODO : 전체 상태값 정의 ING, DONE
|
||||
private String allStatus;
|
||||
// TODO : 개별 상태값 정의 WAITING, TYPING, TODAY_NONE, NONE, DONE
|
||||
private String targetType;
|
||||
private String targetStatus;
|
||||
// TODO : 무슨 데이터 넣을 것인가?
|
||||
private String updatedBy;
|
||||
private Long id;
|
||||
private Long householdSeq;
|
||||
private String recordMonth;
|
||||
private int dayGroupNo;
|
||||
// TODO : 전체 상태값 정의 ING, DONE
|
||||
private String allStatus;
|
||||
// TODO : 개별 상태값 정의 WAITING, TYPING, TODAY_NONE, NONE, DONE
|
||||
private String targetType;
|
||||
private String targetStatus;
|
||||
// TODO : 무슨 데이터 넣을 것인가?
|
||||
private String updatedBy;
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ package app.module.front.usecase.daily.record.web.validator;
|
||||
|
||||
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.web.model.DailyStatus;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.apache.tika.utils.StringUtils;
|
||||
import org.springframework.stereotype.Component;
|
||||
@@ -10,41 +11,41 @@ import org.springframework.validation.Validator;
|
||||
|
||||
@Component
|
||||
@RequiredArgsConstructor
|
||||
public class CreateDailyRecordValidator implements Validator {
|
||||
private final MessageUtil messageUtil;
|
||||
public class CreateDailyRecordValidator implements Validator {
|
||||
private final MessageUtil messageUtil;
|
||||
|
||||
@Override
|
||||
public boolean supports(Class<?> clazz) {
|
||||
return CreateDailyRecordReqVO.class.equals(clazz);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void validate(Object target, Errors errors) {
|
||||
CreateDailyRecordReqVO vo = (CreateDailyRecordReqVO) target;
|
||||
|
||||
if (StringUtils.isBlank(vo.getTodayNone())) {
|
||||
int noneCount = 0;
|
||||
if (vo.getIncomeStatus() != null) {
|
||||
noneCount++;
|
||||
}
|
||||
if (vo.getWorkStatus() != null) {
|
||||
noneCount++;
|
||||
}
|
||||
if (vo.getExpenseStatus() != null) {
|
||||
noneCount++;
|
||||
}
|
||||
if (vo.getPowerStatus() != null) {
|
||||
noneCount++;
|
||||
}
|
||||
if (vo.getForestryStatus() != null) {
|
||||
noneCount++;
|
||||
}
|
||||
|
||||
if (noneCount == 0) {
|
||||
errors.rejectValue(
|
||||
"incomeStatus", "valid.common.required",
|
||||
messageUtil.getMessage("valid.common.required"));
|
||||
}
|
||||
@Override
|
||||
public boolean supports(Class<?> clazz) {
|
||||
return CreateDailyRecordReqVO.class.equals(clazz);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void validate(Object target, Errors errors) {
|
||||
CreateDailyRecordReqVO vo = (CreateDailyRecordReqVO) target;
|
||||
|
||||
if (DailyStatus.WAITING.equals(vo.getAllStatus())) {
|
||||
int noneCount = 0;
|
||||
if (vo.getIncomeStatus() != null) {
|
||||
noneCount++;
|
||||
}
|
||||
if (vo.getWorkStatus() != null) {
|
||||
noneCount++;
|
||||
}
|
||||
if (vo.getExpenseStatus() != null) {
|
||||
noneCount++;
|
||||
}
|
||||
if (vo.getPowerStatus() != null) {
|
||||
noneCount++;
|
||||
}
|
||||
if (vo.getForestryStatus() != null) {
|
||||
noneCount++;
|
||||
}
|
||||
|
||||
if (noneCount == 0) {
|
||||
errors.rejectValue(
|
||||
"incomeStatus", "valid.common.required",
|
||||
"등록하실 항목을 선택해 주세요.");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,12 +6,12 @@ import org.springframework.web.bind.annotation.GetMapping;
|
||||
@Controller
|
||||
public class HomeController {
|
||||
|
||||
/**
|
||||
* FRONT 메인 페이지
|
||||
* @return
|
||||
*/
|
||||
@GetMapping(path = "/")
|
||||
public String home() {
|
||||
return "forward:/record/calendar";
|
||||
}
|
||||
/**
|
||||
* FRONT 메인 페이지
|
||||
* @return
|
||||
*/
|
||||
@GetMapping(path = "/")
|
||||
public String home() {
|
||||
return "forward:/record/calendar";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,12 +6,12 @@ import org.springframework.web.bind.annotation.GetMapping;
|
||||
@Controller
|
||||
public class LoginController {
|
||||
|
||||
/**
|
||||
* FRONT 로그인 페이지
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/login")
|
||||
public String login() {
|
||||
return "security/login";
|
||||
}
|
||||
/**
|
||||
* FRONT 로그인 페이지
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/login")
|
||||
public String login() {
|
||||
return "security/login";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,36 +2,29 @@
|
||||
<!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">
|
||||
|
||||
<select id="getDailyIncomeExistCount" resultType="int">
|
||||
select count(ds.*)
|
||||
from daily_income ds
|
||||
<select id="getDailyIncomeList"
|
||||
resultType="app.module.front.usecase.daily.income.persistence.model.DailyIncomeDto">
|
||||
select ds.id, ds.daily_record_seq, ds.input_type, ds.is_credit
|
||||
, ds.crop_code, ds.category_code, ds.category_self, ds.source_purpose
|
||||
, ds.quantity, ds.unit_code, ds.price, ds.estimated_value
|
||||
from daily_income ds
|
||||
<include refid="app.module.front.usecase.daily.record.persistence.DailyRecordMapper.InnerJoinByDailyRecord"/>
|
||||
where ds.is_deleted = false
|
||||
where ds.is_deleted = false
|
||||
<if test="incomeId != null and incomeId != ''">
|
||||
and ds.id = ${incomeId}
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<select id="getDailyIncomeList">
|
||||
select id, daily_record_seq, is_credit, crop_code, category_code, category_name, source_purpose
|
||||
, quantity, unit_code, price, estimated_value
|
||||
, created_at, created_by
|
||||
from daily_income
|
||||
where is_deleted = false
|
||||
and daily_record_seq = 1
|
||||
and id = 1
|
||||
</select>
|
||||
|
||||
<select id="getDailyIncome">
|
||||
select id, daily_record_seq, is_credit, crop_code, category_code, category_name, source_purpose
|
||||
, quantity, unit_code, price, estimated_value
|
||||
, created_at, created_by
|
||||
from daily_income
|
||||
where is_deleted = false
|
||||
and daily_record_seq = 1
|
||||
and id = 1
|
||||
<select id="getDailyIncomeExistCount" resultType="int">
|
||||
select count(1)
|
||||
from daily_income ds
|
||||
<include refid="app.module.front.usecase.daily.record.persistence.DailyRecordMapper.InnerJoinByDailyRecord"/>
|
||||
where ds.is_deleted = false
|
||||
</select>
|
||||
|
||||
<insert id="createDailyIncome" useGeneratedKeys="true" keyProperty="id">
|
||||
insert into daily_income (
|
||||
daily_record_seq, is_credit, crop_code, category_code, category_name, source_purpose
|
||||
daily_record_seq, is_credit, crop_code, category_code, category_self, source_purpose
|
||||
, quantity, unit_code, price, estimated_value
|
||||
, created_at, created_by, is_deleted
|
||||
) values (
|
||||
@@ -49,7 +42,7 @@
|
||||
, is_credit = #{isCredit}
|
||||
, crop_code = #{cropCode}
|
||||
, category_code = #{categoryCode}
|
||||
, category_name = #{categoryName}
|
||||
, category_self = #{categorySelf}
|
||||
, source_purpose = #{sourcePurpose}
|
||||
, quantity = #{quantity}
|
||||
, unit_code = #{unitCode}
|
||||
|
||||
@@ -16,27 +16,25 @@
|
||||
and ddg.group_no = #{groupNo}
|
||||
</select>
|
||||
|
||||
<select id="getDailyRecordExistCount"
|
||||
resultType="int">
|
||||
/* 일계부 데이터 존재 여부 getDailyRecordExistCount */
|
||||
select count(*) as exist
|
||||
from daily_record dr
|
||||
where dr.household_seq = 2
|
||||
and dr.is_deleted = false
|
||||
and dr.record_month = '2025-06'
|
||||
and dr.day_group_no = 3
|
||||
<select id="getDailyRecordExistCount" resultType="int">
|
||||
select count(1) as exist
|
||||
from daily_record dr
|
||||
where dr.is_deleted = false
|
||||
and dr.household_seq = #{householdSeq}
|
||||
and dr.record_month = #{searchMonth}
|
||||
and dr.day_group_no = #{groupNo}
|
||||
</select>
|
||||
|
||||
<insert id="createDailyRecord" useGeneratedKeys="true" keyProperty="id">
|
||||
insert into daily_record (
|
||||
household_seq, record_month, day_group_no, start_date, end_date
|
||||
, all_status, income_status, work_status, expense_status, power_status, forestry_status
|
||||
, all_status, income_status, work_status, expense_status, power_status, forestry_status, farming_status
|
||||
, is_deleted
|
||||
, <include refid="common.fields.CreateUpdateBaseColumns"/>
|
||||
) values (
|
||||
#{householdSeq}
|
||||
, #{recordMonth}, #{dayGroupNo}, #{startDate}, #{endDate}
|
||||
, #{allStatus}, #{incomeStatus}, #{workStatus}, #{expenseStatus}, #{powerStatus}, #{forestryStatus}
|
||||
, #{allStatus}, #{incomeStatus}, #{workStatus}, #{expenseStatus}, #{powerStatus}, #{forestryStatus}, #{farmingStatus}
|
||||
, false
|
||||
, <include refid="common.fields.CreateUpdateBaseValues"/>
|
||||
)
|
||||
@@ -62,11 +60,10 @@
|
||||
</update>
|
||||
|
||||
<sql id="InnerJoinByDailyRecord">
|
||||
/* TODO */
|
||||
inner join daily_record dr on
|
||||
dr.id = ds.daily_record_seq
|
||||
and dr.is_deleted = false
|
||||
and dr.recordMonth = #{recordMonth} and dr.day_group_no = #{dayGroupNo}
|
||||
and dr.record_month = #{searchMonth} and dr.day_group_no = #{groupNo}
|
||||
and dr.household_seq = #{householdSeq}
|
||||
</sql>
|
||||
|
||||
|
||||
@@ -32,11 +32,13 @@ var ajaxUtil = {
|
||||
ajaxUtil._alert(message, '오류 안내');
|
||||
},
|
||||
_alert : function (alertMessage, alertTitle, afterEvent) {
|
||||
ajaxUtil._alertMethod({
|
||||
id: null,
|
||||
title: alertTitle !== undefined ? alertTitle : null,
|
||||
etUI.dialog.alert({
|
||||
title: alertTitle,
|
||||
message: alertMessage,
|
||||
after: afterEvent !== undefined ? (afterEvent ? 'Y' : 'N') : 'N',
|
||||
type: "alert",
|
||||
callback: function() {
|
||||
console.log("alert callback");
|
||||
},
|
||||
});
|
||||
},
|
||||
_alertId : function (alertId, afterEvent) {
|
||||
@@ -133,14 +135,17 @@ var ajaxUtil = {
|
||||
if (typeof errorCallback !== 'undefined') {
|
||||
errorCallback(ajaxUtil.$404, rstData);
|
||||
} else {
|
||||
kri.menu.main();
|
||||
// kri.menu.main();
|
||||
kri.logger.error('statusCode: 404');
|
||||
}
|
||||
},
|
||||
401:function(){
|
||||
kri.menu.main();
|
||||
// kri.menu.main();
|
||||
kri.logger.error('statusCode: 401');
|
||||
},
|
||||
403:function(rstData){
|
||||
kri.menu.main();
|
||||
// kri.menu.main();
|
||||
kri.logger.error('statusCode: 403');
|
||||
},
|
||||
422:function(rstData, status) {
|
||||
console.log(rstData)
|
||||
@@ -151,6 +156,14 @@ var ajaxUtil = {
|
||||
|
||||
target.parent().find('.invalid-feedback').text(oj.defaultMessage);
|
||||
});
|
||||
|
||||
if ($('.invalid-feedback').length === 0) {
|
||||
let fieldErrors = rstData.responseJSON != null ? rstData.responseJSON : null;
|
||||
if (fieldErrors != null && fieldErrors.length > 0) {
|
||||
ajaxUtil._alert(fieldErrors[0].defaultMessage, '유효성 체크');
|
||||
}
|
||||
|
||||
}
|
||||
},
|
||||
500:function(rstData){
|
||||
ajaxUtil._hideWaiting();
|
||||
|
||||
@@ -2,9 +2,9 @@ let krip= {};
|
||||
krip.daily = new Object();
|
||||
|
||||
krip.daily.httpUrl = {
|
||||
base: '/record/calendar',
|
||||
root: '/record/calendar',
|
||||
daily: '/record/daily/{month}/{groupNo}',
|
||||
target: '/record/daily/{month}/{groupNo}/{target}',
|
||||
target: '/record/{target}/{month}/{groupNo}',
|
||||
// income: '/record/daily/{month}/{groupNo}/income',
|
||||
// work: '/record/daily/{month}/{groupNo}/work',
|
||||
// expense: '/record/daily/{month}/{groupNo}/expense',
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
<div id="wrap">
|
||||
<section th:replace="~{common/components :: header}"></section>
|
||||
|
||||
<div class="acco-wrap" id="container" layout:fragment="content">
|
||||
<div id="container" layout:fragment="content">
|
||||
page content
|
||||
</div>
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
<div id="wrap">
|
||||
<section th:replace="~{common/components :: header}"></section>
|
||||
|
||||
<div class="acco-wrap btm-footer" id="container" layout:fragment="content">
|
||||
<div class="btm-footer" id="container" layout:fragment="content">
|
||||
page content
|
||||
</div>
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
<html layout:decorate="~{layout/layout}" xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout"
|
||||
xmlns:th="http://www.thymeleaf.org" lang="ko">
|
||||
|
||||
<div layout:fragment="content">
|
||||
<div layout:fragment="content" th:classappend="acco-wrap">
|
||||
<main id="content" role="main">
|
||||
<h2>calendar</h2>
|
||||
<div>
|
||||
|
||||
@@ -2,85 +2,100 @@
|
||||
<html layout:decorate="~{layout/layout-none}" xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout"
|
||||
xmlns:th="http://www.thymeleaf.org" lang="ko">
|
||||
|
||||
<div layout:fragment="content">
|
||||
<main id="content" role="main">
|
||||
<h2>daily Form</h2>
|
||||
<div>
|
||||
reqVO: [[${reqVO}]]
|
||||
</div>
|
||||
<div>
|
||||
[[${#temporals.format(detail.startDate, 'yyyy년 MM월 dd일')}]] ~ [[${#temporals.format(detail.endDate, 'yyyy년 MM월 dd일')}]]<br/>
|
||||
|
||||
|
||||
|
||||
<form name="reqForm">
|
||||
<input type="hidden1" name="todayNone" value="" />
|
||||
|
||||
<br/>
|
||||
<div>
|
||||
<input type="checkbox" name="incomeStatus" value="WAITING" data-target="income" /> 수입 내역
|
||||
<div class="invalid-feedback">
|
||||
에러 메세지
|
||||
<div layout:fragment="content" th:classappend="acco-wrap">
|
||||
<th:block th:if="${@systemProperties['spring.profiles.active'] eq 'local'}">
|
||||
<div>
|
||||
reqVO: [[${reqVO}]]
|
||||
</div>
|
||||
<div>
|
||||
detail: [[${dailyRecord}]]
|
||||
</div>
|
||||
</th:block>
|
||||
<main id="content" role="main">
|
||||
<div class="inner">
|
||||
<hgroup class="tit-group">
|
||||
<h3 th:data-start="${#temporals.format(dailyRecord.startDate, 'M월 d일')}"
|
||||
th:data-end="${#temporals.format(dailyRecord.endDate, 'd일')}">
|
||||
<th:block th:if="${dailyRecord.startDay eq dailyRecord.endDay}">
|
||||
[[${#temporals.format(dailyRecord.startDate, 'M월 d일')}]], <br>
|
||||
</th:block>
|
||||
<th:block th:if="not ${dailyRecord.startDay eq dailyRecord.endDay}">
|
||||
[[${#temporals.format(dailyRecord.startDate, 'M월 d')}]]~[[${#temporals.format(dailyRecord.endDate, 'd일')}]], <br>
|
||||
</th:block>
|
||||
<strong>등록하실 내용</strong>이 있나요?
|
||||
</h3>
|
||||
<p>등록하실 항목을 선택해 주세요.</p>
|
||||
</hgroup>
|
||||
<form name="reqForm">
|
||||
<input type="hidden" name="todayNone" value="">
|
||||
<section class="switch-group">
|
||||
<div class="component-input">
|
||||
<label class="switch-inner type-txt">
|
||||
<span class="switch-label">수입</span>
|
||||
<input type="checkbox" name="incomeStatus" value="WAITING" data-target="income">
|
||||
<span class="switch-item">
|
||||
<span class="switch-handle"></span>
|
||||
</span>
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<br/>
|
||||
<div>
|
||||
<input type="checkbox" name="workStatus" value="WAITING" data-target="work" /> 노동 내역
|
||||
<div class="invalid-feedback">
|
||||
에러 메세지
|
||||
<div class="component-input">
|
||||
<label class="switch-inner type-txt">
|
||||
<span class="switch-label">임업노동 투입 내역</span>
|
||||
<input type="checkbox" name="workStatus" value="WAITING" data-target="work">
|
||||
<span class="switch-item">
|
||||
<span class="switch-handle"></span>
|
||||
</span>
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="component-input">
|
||||
<label class="switch-inner type-txt">
|
||||
<span class="switch-label">지출</span>
|
||||
<input type="checkbox" name="expenseStatus" value="WAITING" data-target="expense">
|
||||
<span class="switch-item">
|
||||
<span class="switch-handle"></span>
|
||||
</span>
|
||||
</label>
|
||||
</div>
|
||||
<div class="component-input">
|
||||
<label class="switch-inner type-txt">
|
||||
<span class="switch-label">동력 사용시간</span>
|
||||
<input type="checkbox" name="powerStatus" value="WAITING" data-target="power">
|
||||
<span class="switch-item">
|
||||
<span class="switch-handle"></span>
|
||||
</span>
|
||||
</label>
|
||||
</div>
|
||||
<div class="component-input">
|
||||
<label class="switch-inner type-txt">
|
||||
<span class="switch-label">자가임업 생산물 중 자가소비량</span>
|
||||
<input type="checkbox" name="forestryStatus" value="WAITING" data-target="forestry">
|
||||
<span class="switch-item">
|
||||
<span class="switch-handle"></span>
|
||||
</span>
|
||||
</label>
|
||||
</div>
|
||||
<!-- TODO : 자가농업 생산물 중 자가소비량은 7일차 등록일에만 노출 및 선택 -->
|
||||
<div class="component-input">
|
||||
<label class="switch-inner type-txt">
|
||||
<span class="switch-label">자가농업 생산물 중 자가소비량</span>
|
||||
<input type="checkbox" name="farmingStatus" value="WAITING" data-target="farming">
|
||||
<span class="switch-item">
|
||||
<span class="switch-handle"></span>
|
||||
</span>
|
||||
</label>
|
||||
</div>
|
||||
</section>
|
||||
</form>
|
||||
</div>
|
||||
</main>
|
||||
|
||||
</form>
|
||||
|
||||
|
||||
<th:block th:if="${detail.updated}">
|
||||
수정
|
||||
</th:block>
|
||||
<th:block th:if="${!detail.updated}">
|
||||
<input type="button" value="등록" th:onclick="formControl.create([[${reqVO.searchMonth}]], [[${reqVO.groupNo}]])" />
|
||||
</th:block>
|
||||
|
||||
<br/><br/>
|
||||
detail: [[${detail}]]
|
||||
<div class="component-btns fixed">
|
||||
<div class="btns-row" th:if="${!dailyRecord.updated}">
|
||||
<button type="button" class="btn btn-l btn-primary" th:onclick="formControl.createValid([[${reqVO.searchMonth}]], [[${reqVO.groupNo}]])">
|
||||
<span class="btn-txt">다음 단계로 이동</span>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</main>
|
||||
|
||||
<style>
|
||||
.content {
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
.content label {
|
||||
font-weight: bold;
|
||||
display: block;
|
||||
margin-bottom: 5px;
|
||||
}
|
||||
|
||||
.content div {
|
||||
padding: 8px 0;
|
||||
}
|
||||
|
||||
.tox-tinymce {
|
||||
border: none;
|
||||
}
|
||||
|
||||
.invalid-feedback {
|
||||
display: none;
|
||||
font-size: 12px;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.is-invalid + .invalid-feedback {
|
||||
display: block;
|
||||
}
|
||||
|
||||
textarea.is-invalid ~ .invalid-feedback {
|
||||
display: block;
|
||||
}
|
||||
</style>
|
||||
|
||||
</div>
|
||||
|
||||
@@ -89,35 +104,66 @@
|
||||
<script th:inline="javascript">
|
||||
let ENV = {
|
||||
httpUrl: {
|
||||
root: '',
|
||||
create: '',
|
||||
root: /*[[|/record/daily/${reqVO.searchMonth}/${reqVO.groupNo}|]]*/'rootUrl',
|
||||
},
|
||||
month: [[${reqVO.searchMonth}]],
|
||||
groupNo: [[${reqVO.groupNo}]],
|
||||
submitted: false,
|
||||
};
|
||||
|
||||
let formControl = {
|
||||
create(searchMonth, groupNo) {
|
||||
createValid() {
|
||||
const f = document.reqForm;
|
||||
|
||||
if ($(f).find('input:checked').length == 0) {
|
||||
if (confirm('등록할 내용이 없음?')) {
|
||||
f.todayNone.value = 'Y';
|
||||
}
|
||||
if ($(f).find('input:checked').length === 0) {
|
||||
this.createConfirm();
|
||||
} else {
|
||||
this.create();
|
||||
}
|
||||
},
|
||||
createConfirm() {
|
||||
etUI.locales.ko = {
|
||||
dialog: {
|
||||
positive: '예',
|
||||
negative: '아니오',
|
||||
},
|
||||
};
|
||||
|
||||
let message = ', 등록하실 항목이 없나요?';
|
||||
let $messageWrap = $('#content .tit-group h3');
|
||||
if ($messageWrap.data('start').indexOf($messageWrap.data('end')) !== -1) {
|
||||
message = $messageWrap.data('start') + '~' + $messageWrap.data('end') + message;
|
||||
} else {
|
||||
message = $messageWrap.data('start') + message;
|
||||
}
|
||||
|
||||
etUI.dialog.alert({
|
||||
title: "등록 항목 확인",
|
||||
message: message,
|
||||
type: "confirm",
|
||||
dialogType: "confirm",
|
||||
callback: function () {
|
||||
formControl.create();
|
||||
},
|
||||
});
|
||||
},
|
||||
create() {
|
||||
const f = document.reqForm;
|
||||
|
||||
if ($(f).find('input:checked').length === 0) {
|
||||
f.todayNone.value = 'Y';
|
||||
}
|
||||
|
||||
const obj = $(f).serializeObject();
|
||||
ajaxUtil._ajaxAsync(
|
||||
ENV.httpUrl.create.replace('{searchMonth}', searchMonth).replace('{groupNo}', groupNo),
|
||||
ENV.httpUrl.root,
|
||||
obj,
|
||||
function(rstData, status) {
|
||||
console.log(rstData);
|
||||
|
||||
if (f.todayNone.value == 'Y') {
|
||||
function (rstData, status) {
|
||||
if (f.todayNone.value === 'Y') {
|
||||
krip.daily.goToMain();
|
||||
} else {
|
||||
krip.daily.goToNext($('input:checked').eq(0).data('target'), searchMonth, groupNo);
|
||||
krip.daily.goToNext($('input:checked').eq(0).data('target'), ENV.month, ENV.groupNo);
|
||||
}
|
||||
|
||||
},
|
||||
);
|
||||
},
|
||||
|
||||
34
front/src/main/resources/templates/record/work/index.html
Normal file
34
front/src/main/resources/templates/record/work/index.html
Normal file
@@ -0,0 +1,34 @@
|
||||
<!DOCTYPE html>
|
||||
<html layout:decorate="~{layout/layout-none}" xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout"
|
||||
xmlns:th="http://www.thymeleaf.org" lang="ko">
|
||||
|
||||
<div layout:fragment="content" th:classappend="acco-wrap">
|
||||
<th:block th:if="${@systemProperties['spring.profiles.active'] eq 'local'}">
|
||||
<div>
|
||||
reqVO: [[${reqVO}]]
|
||||
</div>
|
||||
<div>
|
||||
detail: [[${detail}]]
|
||||
</div>
|
||||
</th:block>
|
||||
|
||||
</div>
|
||||
|
||||
<section layout:fragment="script">
|
||||
<script th:src="@{/static/ui/page/daily-record.js}"></script>
|
||||
<script th:inline="javascript">
|
||||
let ENV = {
|
||||
httpUrl: {
|
||||
root: /*[[|/record/daily/${reqVO.searchMonth}/${reqVO.groupNo}|]]*/'rootUrl',
|
||||
},
|
||||
month: [[${reqVO.searchMonth}]],
|
||||
groupNo: [[${reqVO.groupNo}]],
|
||||
submitted: false,
|
||||
};
|
||||
|
||||
let formControl = {
|
||||
};
|
||||
</script>
|
||||
</section>
|
||||
|
||||
</html>
|
||||
Reference in New Issue
Block a user