Merge branch 'dev' into kangsun
This commit is contained in:
@@ -13,6 +13,24 @@ DROP TABLE IF EXISTS researcher_has_household;
|
||||
DROP TABLE IF EXISTS researcher_has_area;
|
||||
DROP TABLE IF EXISTS research_area;
|
||||
|
||||
-- NEW 일계부 연관 테이블(hj)
|
||||
DROP TABLE IF EXISTS daily_income;
|
||||
DROP TABLE IF EXISTS daily_expense;
|
||||
DROP TABLE IF EXISTS daily_work;
|
||||
DROP TABLE IF EXISTS daily_power;
|
||||
DROP TABLE IF EXISTS daily_forestry;
|
||||
DROP TABLE IF EXISTS daily_farming;
|
||||
DROP TABLE IF EXISTS daily_record;
|
||||
DROP TABLE IF EXISTS daily_day_group;
|
||||
|
||||
DROP SEQUENCE IF EXISTS daily_income_seq;
|
||||
DROP SEQUENCE IF EXISTS daily_expense_seq;
|
||||
DROP SEQUENCE IF EXISTS daily_work_seq;
|
||||
DROP SEQUENCE IF EXISTS daily_power_seq;
|
||||
DROP SEQUENCE IF EXISTS daily_forestry_seq;
|
||||
DROP SEQUENCE IF EXISTS daily_farming_seq;
|
||||
DROP SEQUENCE IF EXISTS daily_record_seq;
|
||||
|
||||
-- household 연관 테이블
|
||||
DROP TABLE IF EXISTS suggestion;
|
||||
DROP TABLE IF EXISTS upload_receipt_files;
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
-- ============================================
|
||||
-- 임가 일계부 입력 관련 테이블 S
|
||||
-- ============================================
|
||||
|
||||
/*
|
||||
DROP TABLE IF EXISTS daily_income;
|
||||
DROP TABLE IF EXISTS daily_expense;
|
||||
DROP TABLE IF EXISTS daily_work;
|
||||
@@ -19,6 +19,7 @@ DROP SEQUENCE IF EXISTS daily_power_seq;
|
||||
DROP SEQUENCE IF EXISTS daily_forestry_seq;
|
||||
DROP SEQUENCE IF EXISTS daily_farming_seq;
|
||||
DROP SEQUENCE IF EXISTS daily_record_seq;
|
||||
*/
|
||||
|
||||
|
||||
-- ============================================
|
||||
@@ -84,7 +85,7 @@ CREATE SEQUENCE daily_record_seq START WITH 1 INCREMENT BY 1 CACHE 1 NO CYCLE;
|
||||
CREATE TABLE daily_record (
|
||||
id bigint DEFAULT nextval('daily_record_seq') NOT NULL, -- 일계부 작성상태 ID
|
||||
household_seq bigint NOT NULL, -- 임가 일련번호 (FK)
|
||||
month varchar(7) NOT NULL, -- 조사시행 월 (yyyy-mm)
|
||||
record_month varchar(7) NOT NULL, -- 조사시행 월 (yyyy-mm)
|
||||
day_group_no smallint, -- 일계부 작성일자 그룹 번호
|
||||
start_date date, -- 작성시작일(yyyy-mm-dd)
|
||||
end_date date, -- 작성종료일(yyyy-mm-dd)
|
||||
@@ -111,7 +112,7 @@ COMMENT ON TABLE daily_record IS '일계부 일별 작성상태';
|
||||
|
||||
COMMENT ON COLUMN daily_record.id IS '일계부 작성상태 ID';
|
||||
COMMENT ON COLUMN daily_record.household_seq IS '임가 일련번호';
|
||||
COMMENT ON COLUMN daily_record.month IS '조사시행 월 (yyyy-mm)';
|
||||
COMMENT ON COLUMN daily_record.record_month IS '조사시행 월 (yyyy-mm)';
|
||||
COMMENT ON COLUMN daily_record.start_date IS '작성시작일(yyyy-mm-dd)';
|
||||
COMMENT ON COLUMN daily_record.end_date IS '작성종료일(yyyy-mm-dd)';
|
||||
COMMENT ON COLUMN daily_record.day_group_no IS '일계부 작성일자 그룹 번호';
|
||||
@@ -140,15 +141,16 @@ CREATE SEQUENCE daily_income_seq START WITH 1 INCREMENT BY 1 CACHE 1 NO CYCLE;
|
||||
CREATE TABLE daily_income (
|
||||
id bigint DEFAULT nextval('daily_income_seq') NOT NULL, -- 일계부 수입 ID
|
||||
daily_record_seq bigint NOT NULL, -- 일계부 작성상태 일련번호 (FK)
|
||||
input_type varchar(5), -- 입력 구분(SELF, OCR)
|
||||
is_credit boolean, -- 외상판매 여부
|
||||
crop_code varchar(255), -- 재배형태 코드 (매핑코드)
|
||||
category_code varchar(255) NOT NULL, -- 수입 종류(매핑코드)
|
||||
category_name varchar(30) NOT NULL, -- 수입 종류(직접입력)
|
||||
category_code varchar(255), -- 수입 종류(매핑코드)
|
||||
category_self varchar(30), -- 수입 종류(직접입력)
|
||||
source_purpose varchar(10), -- 수입원(용도)
|
||||
quantity decimal(6,2) NOT NULL, -- 수량
|
||||
unit_code varchar(10) NOT NULL, -- 단위 (매핑코드)
|
||||
price integer NOT NULL, -- 현금(원)
|
||||
estimated_value integer NOT NULL, -- 현물(평가액)
|
||||
quantity decimal(6,2), -- 수량
|
||||
unit_code varchar(255), -- 단위 (매핑코드)
|
||||
price integer, -- 현금(원)
|
||||
estimated_value integer, -- 현물(평가액)
|
||||
created_at timestamp(6), -- 생성일
|
||||
created_by varchar(255), -- 생성자
|
||||
updated_at timestamp(6), -- 수정일
|
||||
@@ -165,10 +167,11 @@ COMMENT ON TABLE daily_income IS '수입내역 - 일계부';
|
||||
|
||||
COMMENT ON COLUMN daily_income.id IS '일계부 수입 ID';
|
||||
COMMENT ON COLUMN daily_income.daily_record_seq IS '일계부 작성상태 일련번호';
|
||||
COMMENT ON COLUMN daily_income.input_type IS '입력 구분(SELF, OCR)';
|
||||
COMMENT ON COLUMN daily_income.is_credit IS '외상판매 여부';
|
||||
COMMENT ON COLUMN daily_income.crop_code IS '재배형태 코드 (매핑코드)';
|
||||
COMMENT ON COLUMN daily_income.category_code IS '수입 종류(매핑코드)';
|
||||
COMMENT ON COLUMN daily_income.category_name IS '수입 종류(직접입력)';
|
||||
COMMENT ON COLUMN daily_income.category_self IS '수입 종류(직접입력)';
|
||||
COMMENT ON COLUMN daily_income.source_purpose IS '수입원(용도)';
|
||||
COMMENT ON COLUMN daily_income.quantity IS '수량';
|
||||
COMMENT ON COLUMN daily_income.unit_code IS '단위 (매핑코드)';
|
||||
@@ -192,15 +195,16 @@ CREATE SEQUENCE daily_expense_seq START WITH 1 INCREMENT BY 1 CACHE 1 NO CYCLE;
|
||||
CREATE TABLE daily_expense (
|
||||
id bigint DEFAULT nextval('daily_expense_seq') NOT NULL, -- 일계부 지출 ID
|
||||
daily_record_seq bigint NOT NULL, -- 일계부 작성상태 일련번호 (FK)
|
||||
input_type varchar(5), -- 입력 구분(SELF, OCR)
|
||||
is_credit boolean, -- 외상판매 여부
|
||||
crop_code varchar(255), -- 재배형태 코드 (매핑코드)
|
||||
category_code varchar(255) NOT NULL, -- 지출 종류(매핑코드)
|
||||
category_name varchar(30) NOT NULL, -- 지출 종류(직접입력)
|
||||
source_purpose varchar(10), -- 지출원(용도)
|
||||
quantity decimal(6,2) NOT NULL, -- 수량
|
||||
unit_code varchar(10) NOT NULL, -- 단위 (매핑코드)
|
||||
price integer NOT NULL, -- 현금(원)
|
||||
estimated_value integer NOT NULL, -- 현물(평가액)
|
||||
category_code varchar(255), -- 수입 종류(매핑코드)
|
||||
category_self varchar(30), -- 수입 종류(직접입력)
|
||||
source_purpose varchar(10), -- 수입원(용도)
|
||||
quantity decimal(6,2), -- 수량
|
||||
unit_code varchar(255), -- 단위 (매핑코드)
|
||||
price integer, -- 현금(원)
|
||||
estimated_value integer, -- 현물(평가액)
|
||||
created_at timestamp(6), -- 생성일
|
||||
created_by varchar(255), -- 생성자
|
||||
updated_at timestamp(6), -- 수정일
|
||||
@@ -217,10 +221,11 @@ COMMENT ON TABLE daily_expense IS '지출내역 - 일계부';
|
||||
|
||||
COMMENT ON COLUMN daily_expense.id IS '일계부 지출 ID';
|
||||
COMMENT ON COLUMN daily_expense.daily_record_seq IS '일계부 작성상태 일련번호';
|
||||
COMMENT ON COLUMN daily_expense.input_type IS '입력 구분(SELF, OCR)';
|
||||
COMMENT ON COLUMN daily_expense.is_credit IS '외상판매 여부';
|
||||
COMMENT ON COLUMN daily_expense.crop_code IS '재배형태 코드 (매핑코드)';
|
||||
COMMENT ON COLUMN daily_expense.category_code IS '지출 종류(매핑코드)';
|
||||
COMMENT ON COLUMN daily_expense.category_name IS '지출 종류(직접입력)';
|
||||
COMMENT ON COLUMN daily_expense.category_self IS '지출 종류(직접입력)';
|
||||
COMMENT ON COLUMN daily_expense.source_purpose IS '지출원(용도)';
|
||||
COMMENT ON COLUMN daily_expense.quantity IS '수량';
|
||||
COMMENT ON COLUMN daily_expense.unit_code IS '단위 (매핑코드)';
|
||||
|
||||
3
front/.gitignore
vendored
3
front/.gitignore
vendored
@@ -31,3 +31,6 @@ build/
|
||||
|
||||
### VS Code ###
|
||||
.vscode/
|
||||
|
||||
### Project
|
||||
**/resources/static/pages/**
|
||||
@@ -0,0 +1,63 @@
|
||||
package app.module.front.config.adapters.persistence.component;
|
||||
|
||||
import app.module.core.config.application.util.CommonUtil;
|
||||
import app.module.front.config.application.security.FrontHouseholdUser;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import org.springframework.security.core.Authentication;
|
||||
import org.springframework.security.core.context.SecurityContextHolder;
|
||||
import org.springframework.security.core.userdetails.UserDetails;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
public class FrontAuditCommand {
|
||||
private Long householdSeq;
|
||||
private LocalDateTime createdAt;
|
||||
private String createdBy;
|
||||
private LocalDateTime updatedAt;
|
||||
private String updatedBy;
|
||||
private LocalDateTime deletedAt;
|
||||
private String deletedBy;
|
||||
|
||||
public void create() {
|
||||
this.householdSeq = getCurrentUserSeq();
|
||||
this.createdAt = LocalDateTime.now();
|
||||
this.createdBy = getCurrentUsername();
|
||||
this.updatedAt = LocalDateTime.now();
|
||||
this.updatedBy = getCurrentUsername();
|
||||
}
|
||||
|
||||
public void update() {
|
||||
this.householdSeq = getCurrentUserSeq();
|
||||
this.updatedAt = LocalDateTime.now();
|
||||
this.updatedBy = getCurrentUsername();
|
||||
}
|
||||
|
||||
public void delete() {
|
||||
this.householdSeq = getCurrentUserSeq();
|
||||
this.deletedAt = LocalDateTime.now();
|
||||
this.deletedBy = getCurrentUsername();
|
||||
}
|
||||
|
||||
private Long getCurrentUserSeq() {
|
||||
Authentication authentication = SecurityContextHolder.getContext().getAuthentication();
|
||||
|
||||
Object principal = authentication.getPrincipal();
|
||||
Long userseq = null;
|
||||
|
||||
if (principal instanceof UserDetails) {
|
||||
userseq = ((FrontHouseholdUser) principal).getHouseholdSeq();
|
||||
}
|
||||
|
||||
return userseq;
|
||||
}
|
||||
|
||||
private String getCurrentUsername() {
|
||||
Authentication authentication = SecurityContextHolder.getContext().getAuthentication();
|
||||
|
||||
return authentication != null && authentication.isAuthenticated()
|
||||
? CommonUtil.getLoginUsername() : "INIT_DATA";
|
||||
}
|
||||
}
|
||||
@@ -40,6 +40,7 @@ public class FrontDetailService implements UserDetailsService {
|
||||
.orElseThrow(() -> new UsernameNotFoundException("Invalid username or password."));
|
||||
|
||||
return new FrontHouseholdUser(
|
||||
getHousehold.getSeq(),
|
||||
getHousehold.getHouseholdNum(),
|
||||
getHousehold.getPassword(),
|
||||
true,
|
||||
|
||||
@@ -8,9 +8,11 @@ import org.springframework.security.core.userdetails.User;
|
||||
@Getter
|
||||
public class FrontHouseholdUser extends User {
|
||||
|
||||
private Long householdSeq;
|
||||
private String ownerName;
|
||||
|
||||
public FrontHouseholdUser(
|
||||
Long householdSeq,
|
||||
String householdNum,
|
||||
String password,
|
||||
boolean enabled,
|
||||
@@ -27,6 +29,7 @@ public class FrontHouseholdUser extends User {
|
||||
credentialsNonExpired,
|
||||
accountNonLocked,
|
||||
authorities);
|
||||
this.householdSeq = householdSeq;
|
||||
this.ownerName = ownerName;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
package app.module.front.config.application.util;
|
||||
|
||||
import app.module.front.config.adapters.persistence.component.FrontAuditCommand;
|
||||
|
||||
public class AuditUtil {
|
||||
private AuditUtil() {}
|
||||
|
||||
public static <T extends FrontAuditCommand> T create(T cmd) {
|
||||
cmd.create();
|
||||
return cmd;
|
||||
}
|
||||
|
||||
public static <T extends FrontAuditCommand> T update(T cmd) {
|
||||
cmd.update();
|
||||
return cmd;
|
||||
}
|
||||
|
||||
public static <T extends FrontAuditCommand> T delete(T cmd) {
|
||||
cmd.delete();
|
||||
return cmd;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
package app.module.front.config.application.util;
|
||||
|
||||
import app.module.core.config.adapters.web.security.domain.SocialUser;
|
||||
import app.module.front.config.application.security.FrontHouseholdUser;
|
||||
import org.springframework.security.core.Authentication;
|
||||
import org.springframework.security.core.context.SecurityContextHolder;
|
||||
import org.springframework.security.core.userdetails.UserDetails;
|
||||
import org.springframework.security.oauth2.core.user.DefaultOAuth2User;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Component
|
||||
public class AuthUtil {
|
||||
public static Long getUserSeq() {
|
||||
Authentication authentication = SecurityContextHolder.getContext().getAuthentication();
|
||||
if (authentication == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
Object principal = authentication.getPrincipal();
|
||||
Long userseq = null;
|
||||
|
||||
if (principal instanceof UserDetails) {
|
||||
userseq = ((FrontHouseholdUser) principal).getHouseholdSeq();
|
||||
}
|
||||
|
||||
return userseq;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
package app.module.front.usecase.daily.calendar.persistence;
|
||||
|
||||
import app.module.front.usecase.daily.calendar.persistence.model.DailyRecordCalendarDto;
|
||||
import app.module.front.usecase.daily.calendar.persistence.model.DailyRecordStatusDto;
|
||||
import app.module.front.usecase.daily.calendar.web.model.RecordCalendarUIReqVO;
|
||||
import app.module.front.usecase.daily.record.web.model.CreateDailyRecordReqVO;
|
||||
import app.module.front.usecase.daily.record.web.model.UpdateDailyRecordStatusCmd;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Mapper
|
||||
public interface RecordCalendarMapper {
|
||||
|
||||
List<DailyRecordCalendarDto> getCalendarByDailyRecord(RecordCalendarUIReqVO reqVO);
|
||||
|
||||
DailyRecordStatusDto getDailyRecordStatus(RecordCalendarUIReqVO reqVO);
|
||||
|
||||
int getStartDayByDailyGroupNo(@Param("groupNo") Integer groupNo);
|
||||
|
||||
/**
|
||||
* 일계부 등록 여부
|
||||
* @param householdSeq
|
||||
* @param recordMonth
|
||||
* @param dayGroupNo
|
||||
* @return
|
||||
*/
|
||||
Long getDailyRecordExistCount(@Param("householdSeq") Long householdSeq, @Param("recordMonth") String recordMonth, @Param("dayGroupNo") Integer dayGroupNo);
|
||||
|
||||
/**
|
||||
* 일계부 등록(생성)
|
||||
* @param command
|
||||
* @return
|
||||
*/
|
||||
Long createDailyRecord(CreateDailyRecordReqVO command);
|
||||
|
||||
/**
|
||||
* 일계부 상태 수정
|
||||
* @param command
|
||||
* @return
|
||||
*/
|
||||
int updateDailyRecordStatus(UpdateDailyRecordStatusCmd command);
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
package app.module.front.usecase.daily.calendar.persistence.model;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
public class DailyRecordCalendarDto {
|
||||
private String groupNo;
|
||||
private Integer startDay;
|
||||
private Integer endDay;
|
||||
private String startDate;
|
||||
private String dailyId;
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
package app.module.front.usecase.daily.calendar.persistence.model;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.ToString;
|
||||
|
||||
import java.time.LocalDate;
|
||||
|
||||
@Data
|
||||
@ToString
|
||||
public class DailyRecordStatusDto {
|
||||
/**
|
||||
* 일계부 일련번호
|
||||
*/
|
||||
private Long dailyId;
|
||||
private LocalDate startDate;
|
||||
private LocalDate endDate;
|
||||
/**
|
||||
* 특정일 입력 상태 TODO enum
|
||||
*/
|
||||
private String allStatus;
|
||||
/**
|
||||
* 수입 입력 상태 TODO enum
|
||||
*/
|
||||
private String incomeStatus;
|
||||
/**
|
||||
* 수입 입력 개수
|
||||
*/
|
||||
private Integer incomeCount;
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package app.module.front.usecase.daily.calendar.service;
|
||||
|
||||
|
||||
import app.module.front.usecase.daily.calendar.persistence.model.DailyRecordCalendarDto;
|
||||
import app.module.front.usecase.daily.calendar.persistence.model.DailyRecordStatusDto;
|
||||
import app.module.front.usecase.daily.calendar.web.model.RecordCalendarUIReqVO;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface RecordCalendarService {
|
||||
List<DailyRecordCalendarDto> getCalendarByDailyRecord(RecordCalendarUIReqVO reqVO);
|
||||
|
||||
DailyRecordStatusDto getDailyRecordStatus(RecordCalendarUIReqVO reqVO);
|
||||
|
||||
int getStartDayByDailyGroupNo(RecordCalendarUIReqVO reqVO);
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
package app.module.front.usecase.daily.calendar.service;
|
||||
|
||||
import app.module.front.usecase.daily.calendar.persistence.RecordCalendarMapper;
|
||||
import app.module.front.usecase.daily.calendar.persistence.model.DailyRecordCalendarDto;
|
||||
import app.module.front.usecase.daily.calendar.persistence.model.DailyRecordStatusDto;
|
||||
import app.module.front.usecase.daily.calendar.web.model.RecordCalendarUIReqVO;
|
||||
import app.module.front.usecase.daily.record.persistence.DailyRecordMapper;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.time.LocalDate;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class RecordCalendarServiceImpl implements RecordCalendarService {
|
||||
private final RecordCalendarMapper recordCalendarMapper;
|
||||
|
||||
@Override
|
||||
public List<DailyRecordCalendarDto> getCalendarByDailyRecord(RecordCalendarUIReqVO reqVO) {
|
||||
int lastDay = reqVO.getSearchDate().withDayOfMonth(reqVO.getSearchDate().lengthOfMonth()).getDayOfMonth();
|
||||
|
||||
List<DailyRecordCalendarDto> list = recordCalendarMapper.getCalendarByDailyRecord(reqVO);
|
||||
|
||||
List<DailyRecordCalendarDto> refineList = new ArrayList<DailyRecordCalendarDto>();
|
||||
for (DailyRecordCalendarDto record : list) {
|
||||
record.setStartDate(reqVO.getSearchMonth() + String.format("%02d", record.getStartDay()));
|
||||
|
||||
if ((lastDay == 28 || lastDay == 30) && record.getStartDay() == lastDay) {
|
||||
record.setEndDay(lastDay);
|
||||
refineList.add(record);
|
||||
} else if (record.getStartDay() <= lastDay && record.getEndDay() <= lastDay) {
|
||||
refineList.add(record);
|
||||
}
|
||||
}
|
||||
|
||||
return refineList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public DailyRecordStatusDto getDailyRecordStatus(RecordCalendarUIReqVO reqVO) {
|
||||
return recordCalendarMapper.getDailyRecordStatus(reqVO);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getStartDayByDailyGroupNo(RecordCalendarUIReqVO reqVO) {
|
||||
return recordCalendarMapper.getStartDayByDailyGroupNo(reqVO.getGroupNo());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,66 @@
|
||||
package app.module.front.usecase.daily.calendar.web;
|
||||
|
||||
import app.module.front.usecase.daily.calendar.persistence.model.DailyRecordCalendarDto;
|
||||
import app.module.front.usecase.daily.calendar.persistence.model.DailyRecordStatusDto;
|
||||
import app.module.front.usecase.daily.calendar.service.RecordCalendarService;
|
||||
import app.module.front.usecase.daily.calendar.web.model.RecordCalendarUIReqVO;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.Model;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.time.YearMonth;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.List;
|
||||
|
||||
@Slf4j
|
||||
@Controller
|
||||
@RequiredArgsConstructor
|
||||
@RequestMapping(path = "/record/calendar")
|
||||
public class RecordCalendarController {
|
||||
private final RecordCalendarService recordCalendarService;
|
||||
|
||||
@GetMapping(path = "")
|
||||
public String index(Model model, @RequestParam(value = "searchDay", required = false) String searchDay) {
|
||||
RecordCalendarUIReqVO reqVO = new RecordCalendarUIReqVO(searchDay, getAccessId());
|
||||
log.debug("reqVO: {}", reqVO);
|
||||
|
||||
model.addAttribute("reqVO", reqVO);
|
||||
model.addAttribute("calendarList", recordCalendarService.getCalendarByDailyRecord(reqVO));
|
||||
|
||||
return "record/calendar";
|
||||
}
|
||||
|
||||
@PostMapping(path = "/{searchMonth}/{groupNo}")
|
||||
public String detail(Model model
|
||||
, @PathVariable(required = true) String searchMonth
|
||||
, @PathVariable(required = true) String groupNo) {
|
||||
|
||||
RecordCalendarUIReqVO reqVO = new RecordCalendarUIReqVO();
|
||||
reqVO.setSearchMonth(searchMonth);
|
||||
reqVO.setGroupNo(Integer.parseInt(groupNo));
|
||||
reqVO.setHouseholdSeq(getAccessId());
|
||||
log.debug("reqVO: {}", reqVO);
|
||||
|
||||
DailyRecordStatusDto detail = recordCalendarService.getDailyRecordStatus(reqVO);
|
||||
if (detail == null) {
|
||||
int startDay = recordCalendarService.getStartDayByDailyGroupNo(reqVO);
|
||||
reqVO.setSearchDay(reqVO.getSearchMonth() + String.format("%02d", startDay));
|
||||
}
|
||||
|
||||
//uiCodeListPortIn.connect("code.pageable.rows");
|
||||
|
||||
model.addAttribute("reqVO", reqVO);
|
||||
model.addAttribute("detail", detail);
|
||||
|
||||
return "record/calendar-wrap";
|
||||
}
|
||||
|
||||
// TODO : 로그인 SEQ
|
||||
private Long getAccessId() {
|
||||
return 2L;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,73 @@
|
||||
package app.module.front.usecase.daily.calendar.web.model;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import lombok.ToString;
|
||||
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.LocalDateTime;
|
||||
import java.time.YearMonth;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.time.format.DateTimeParseException;
|
||||
import java.util.Date;
|
||||
import java.util.Locale;
|
||||
|
||||
@Data
|
||||
@ToString
|
||||
public class RecordCalendarUIReqVO {
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(RecordCalendarUIReqVO.class);
|
||||
|
||||
public RecordCalendarUIReqVO() {
|
||||
}
|
||||
|
||||
public RecordCalendarUIReqVO(String searchDay, Long accessId) {
|
||||
if (StringUtils.isBlank(searchDay) || searchDay.length() != 8) {
|
||||
searchDay = LocalDate.now().format(DateTimeFormatter.ofPattern("yyyyMMdd"));
|
||||
}
|
||||
|
||||
try {
|
||||
SimpleDateFormat beforeSdf = new SimpleDateFormat("yyyyMMdd", Locale.KOREAN);
|
||||
SimpleDateFormat afterSdf = new SimpleDateFormat("yyyy-MM-dd", Locale.KOREAN);
|
||||
SimpleDateFormat monthSdf = new SimpleDateFormat("yyyyMM", Locale.KOREAN);
|
||||
|
||||
Date formatDate = beforeSdf.parse(searchDay);
|
||||
|
||||
setSearchDate(LocalDate.parse(afterSdf.format(formatDate)));
|
||||
setSearchMonth(monthSdf.format(formatDate));
|
||||
setSearchDay(beforeSdf.format(formatDate));
|
||||
|
||||
} catch (Exception e) {
|
||||
LOGGER.warn("[DateParse] target={}", searchDay, e);
|
||||
}
|
||||
|
||||
setHouseholdSeq(accessId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 검색 일(yyyyMMdd)
|
||||
*/
|
||||
private String searchDay;
|
||||
|
||||
/**
|
||||
* 검색 월(yyyyMM)
|
||||
*/
|
||||
private String searchMonth;
|
||||
private Integer groupNo;
|
||||
|
||||
/**
|
||||
* 검색 일(yyyy-MM-dd)
|
||||
*/
|
||||
private LocalDate searchDate;
|
||||
|
||||
/**
|
||||
* 임가회원 일련번호
|
||||
*/
|
||||
private Long householdSeq;
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
package app.module.front.usecase.daily.income.application.model;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
public class DailyIncomeCmd {
|
||||
private Long id;
|
||||
private Long householdSeq;
|
||||
private Boolean isCredit;
|
||||
private String cropCode;
|
||||
// TODO : 수입종류의 코드맵핑 여부 판단
|
||||
private String categoryCode;
|
||||
private String categoryName;
|
||||
private String sourcePurpose;
|
||||
// TODO : 타입
|
||||
private String quantity;
|
||||
private String unitCode;
|
||||
private Integer price;
|
||||
private Integer estimatedValue;
|
||||
// TODO : 무슨 데이터 넣을 것인가?
|
||||
private String createdBy;
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
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.DailyIncomeDto;
|
||||
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 householdSeq
|
||||
* @param recordMonth
|
||||
* @param dayGroupNo
|
||||
* @return
|
||||
*/
|
||||
List<DailyIncomeDto> getDailyIncomeList(@Param("householdSeq") Long householdSeq, @Param("recordMonth") String recordMonth, @Param("dayGroupNo") Integer dayGroupNo);
|
||||
|
||||
/**
|
||||
* 수입내역 단건 조회
|
||||
* @param householdSeq
|
||||
* @param recordMonth
|
||||
* @param dayGroupNo
|
||||
* @return
|
||||
*/
|
||||
DailyIncomeDto getDailyIncome(@Param("householdSeq") Long householdSeq, @Param("recordMonth") String recordMonth, @Param("dayGroupNo") Integer dayGroupNo);
|
||||
|
||||
/**
|
||||
* 수입내역 등록
|
||||
* @param command
|
||||
* @return
|
||||
*/
|
||||
Long createDailyIncome(DailyIncomeCmd command);
|
||||
|
||||
/**
|
||||
* 수입내역 수정
|
||||
* @param command
|
||||
* @return
|
||||
*/
|
||||
int updateDailyIncome(DailyIncomeCmd command);
|
||||
|
||||
/**
|
||||
* 수입내역 삭제
|
||||
* @return
|
||||
*/
|
||||
int removeDailyIncome();
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
package app.module.front.usecase.daily.income.persistence.model;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
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;
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
package app.module.front.usecase.daily.income.web;
|
||||
|
||||
import app.module.front.config.application.util.AuthUtil;
|
||||
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.web.model.DailyRecordUIReqVO;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.Model;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
|
||||
@Slf4j
|
||||
@Controller
|
||||
@RequiredArgsConstructor
|
||||
@RequestMapping(path = "/record/income")
|
||||
public class DailyIncomeController {
|
||||
|
||||
@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);
|
||||
|
||||
model.addAttribute("reqVO", reqVO);
|
||||
model.addAttribute("detail", null);
|
||||
|
||||
return "record/income/index";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
package app.module.front.usecase.daily.income.web.model;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.ToString;
|
||||
|
||||
@Data
|
||||
@ToString
|
||||
public class DailyIncomeUIReqVO {
|
||||
private String searchMonth;
|
||||
private Integer groupNo;
|
||||
private Long householdSeq;
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
package app.module.front.usecase.daily.record.persistence;
|
||||
|
||||
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;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
@Mapper
|
||||
public interface DailyRecordMapper {
|
||||
|
||||
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 command
|
||||
* @return
|
||||
*/
|
||||
Long createDailyRecord(CreateDailyRecordReqVO command);
|
||||
|
||||
/**
|
||||
* 일계부 상태 수정
|
||||
* @param command
|
||||
* @return
|
||||
*/
|
||||
int updateDailyRecordStatus(UpdateDailyRecordStatusCmd command);
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
package app.module.front.usecase.daily.record.persistence.model;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.Setter;
|
||||
|
||||
import java.time.LocalDate;
|
||||
|
||||
@Data
|
||||
public class DailyRecordDto {
|
||||
// household_seq, record_month, day_group_no, start_date, end_date
|
||||
// , 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 Long id;
|
||||
// TODO enum
|
||||
private LocalDate startDate;
|
||||
private LocalDate endDate;
|
||||
private String allStatus;
|
||||
private String incomeStatus;
|
||||
|
||||
public boolean isUpdated() {
|
||||
boolean returnValue = false;
|
||||
if (id != null) {
|
||||
returnValue = true;
|
||||
}
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
package app.module.front.usecase.daily.record.persistence.model;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
public class UpdateDailyRecordDto {
|
||||
private String monthly;
|
||||
private String updatedBy;
|
||||
private String statusType;
|
||||
private String statusCode;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
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 command);
|
||||
}
|
||||
@@ -0,0 +1,73 @@
|
||||
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.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;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.time.LocalDate;
|
||||
import java.util.Date;
|
||||
import java.util.Locale;
|
||||
|
||||
@Slf4j
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class DailyRecordServiceImpl implements DailyRecordService {
|
||||
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);
|
||||
|
||||
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)));
|
||||
|
||||
} 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);
|
||||
}
|
||||
}
|
||||
|
||||
dailyRecordMapper.createDailyRecord(AuditUtil.create(command));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,83 @@
|
||||
package app.module.front.usecase.daily.record.web;
|
||||
|
||||
import app.module.front.config.application.util.AuthUtil;
|
||||
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;
|
||||
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.validator.CreateDailyRecordValidator;
|
||||
import jakarta.validation.Valid;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.Model;
|
||||
import org.springframework.validation.BindingResult;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
@Slf4j
|
||||
@Controller
|
||||
@RequiredArgsConstructor
|
||||
@RequestMapping(path = "/record/daily")
|
||||
public class DailyRecordController {
|
||||
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) {
|
||||
|
||||
DailyRecordUIReqVO reqVO = new DailyRecordUIReqVO();
|
||||
reqVO.setSearchMonth(searchMonth);
|
||||
reqVO.setGroupNo(Integer.parseInt(groupNo));
|
||||
reqVO.setHouseholdSeq(AuthUtil.getUserSeq());
|
||||
log.debug("reqVO: {}", reqVO);
|
||||
|
||||
//uiCodeListPortIn.connect("code.pageable.rows");
|
||||
|
||||
DailyRecordDto detail = dailyRecordService.getDailyRecord(reqVO);
|
||||
|
||||
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());
|
||||
}
|
||||
|
||||
DailyRecordUIReqVO reqVO = new DailyRecordUIReqVO();
|
||||
reqVO.setSearchMonth(searchMonth);
|
||||
reqVO.setGroupNo(Integer.parseInt(groupNo));
|
||||
// reqVO.setHouseholdSeq(AuthUtil.getUserSeq());
|
||||
log.debug("reqVO: {}", reqVO);
|
||||
|
||||
//uiCodeListPortIn.connect("code.pageable.rows");
|
||||
|
||||
DailyRecordDto detail = dailyRecordService.getDailyRecord(reqVO);
|
||||
|
||||
formVO.setHouseholdSeq(reqVO.getHouseholdSeq());
|
||||
formVO.setRecordMonth(reqVO.getSearchMonth());
|
||||
formVO.setDayGroupNo(reqVO.getGroupNo());
|
||||
formVO.setStartDate(detail.getStartDate());
|
||||
formVO.setEndDate(detail.getEndDate());
|
||||
|
||||
log.debug("formVO: {}", formVO);
|
||||
dailyRecordService.createDailyRecord(formVO);
|
||||
log.debug("createDailyRecord: id-{}", formVO.getId());
|
||||
|
||||
return ResponseEntity.status(HttpStatus.OK).body(reqVO);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
package app.module.front.usecase.daily.record.web.model;
|
||||
|
||||
import app.module.front.config.adapters.persistence.component.FrontAuditCommand;
|
||||
import lombok.Data;
|
||||
|
||||
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;
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
package app.module.front.usecase.daily.record.web.model;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.ToString;
|
||||
|
||||
@Data
|
||||
@ToString
|
||||
public class DailyRecordUIReqVO {
|
||||
private String searchMonth;
|
||||
private Integer groupNo;
|
||||
private Long householdSeq;
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
package app.module.front.usecase.daily.record.web.model;
|
||||
|
||||
public enum DailyStatus {
|
||||
WAITING, TODAY_NONE, DONE;
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
package app.module.front.usecase.daily.record.web.model;
|
||||
|
||||
public enum DailyTargetStatus {
|
||||
WAITING, TODAY_NONE, NONE, DONE;
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package app.module.front.usecase.daily.record.web.model;
|
||||
|
||||
import lombok.Getter;
|
||||
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;
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
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 lombok.RequiredArgsConstructor;
|
||||
import org.apache.tika.utils.StringUtils;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.validation.Errors;
|
||||
import org.springframework.validation.Validator;
|
||||
|
||||
@Component
|
||||
@RequiredArgsConstructor
|
||||
public class 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"));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,15 +0,0 @@
|
||||
package app.module.front.usecase.home.index.adapter.web;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
|
||||
@Controller
|
||||
@RequiredArgsConstructor
|
||||
public class HomeController {
|
||||
|
||||
@GetMapping(path = "/")
|
||||
public String home() {
|
||||
return "home";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
package app.module.front.usecase.home.web;
|
||||
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
|
||||
@Controller
|
||||
public class HomeController {
|
||||
|
||||
/**
|
||||
* FRONT 메인 페이지
|
||||
* @return
|
||||
*/
|
||||
@GetMapping(path = "/")
|
||||
public String home() {
|
||||
return "forward:/record/calendar";
|
||||
}
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
package app.module.front.usecase.security.login.adapter.web;
|
||||
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
|
||||
@Controller
|
||||
public class LoginController {
|
||||
|
||||
@GetMapping("/login")
|
||||
public String login() {
|
||||
return "security/login";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
package app.module.front.usecase.security.login.web;
|
||||
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
|
||||
@Controller
|
||||
public class LoginController {
|
||||
|
||||
/**
|
||||
* FRONT 로그인 페이지
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/login")
|
||||
public String login() {
|
||||
return "security/login";
|
||||
}
|
||||
}
|
||||
73
front/src/main/resources/mappers/daily/DailyIncomeMapper.xml
Normal file
73
front/src/main/resources/mappers/daily/DailyIncomeMapper.xml
Normal file
@@ -0,0 +1,73 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
|
||||
<mapper namespace="app.module.front.usecase.daily.income.persistence.DailyIncomeMapper">
|
||||
|
||||
<select id="getDailyIncomeExistCount" resultType="int">
|
||||
select count(ds.*)
|
||||
from daily_income ds
|
||||
<include refid="app.module.front.usecase.daily.record.persistence.DailyRecordMapper.InnerJoinByDailyRecord"/>
|
||||
where ds.is_deleted = false
|
||||
</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>
|
||||
|
||||
<insert id="createDailyIncome" useGeneratedKeys="true" keyProperty="id">
|
||||
insert into daily_income (
|
||||
daily_record_seq, is_credit, crop_code, category_code, category_name, source_purpose
|
||||
, quantity, unit_code, price, estimated_value
|
||||
, created_at, created_by, is_deleted
|
||||
) values (
|
||||
#{householdSeq}
|
||||
, #{isCredit}, #{cropCode}, #{categoryCode}, #{categoryName}, #{sourcePurpose}
|
||||
, #{quantity}, #{unitCode}, #{price}, #{estimatedValue}
|
||||
, now(), #{createdBy}, false
|
||||
)
|
||||
</insert>
|
||||
|
||||
<update id="updateDailyIncome">
|
||||
update daily_income set
|
||||
updated_at = now()
|
||||
, updated_by = #{updatedBy}
|
||||
, is_credit = #{isCredit}
|
||||
, crop_code = #{cropCode}
|
||||
, category_code = #{categoryCode}
|
||||
, category_name = #{categoryName}
|
||||
, source_purpose = #{sourcePurpose}
|
||||
, quantity = #{quantity}
|
||||
, unit_code = #{unitCode}
|
||||
, price = #{price}
|
||||
, estimated_value = #{estimatedValue}
|
||||
where is_deleted = false
|
||||
and daily_record_seq = 1
|
||||
and id = 1
|
||||
</update>
|
||||
|
||||
<update id="removeDailyIncome">
|
||||
update daily_income set
|
||||
deleted_at = now(),
|
||||
deleted_by = '_system',
|
||||
is_deleted = true
|
||||
where is_deleted = false
|
||||
and daily_record_seq = 1
|
||||
and id = 1
|
||||
</update>
|
||||
|
||||
</mapper>
|
||||
73
front/src/main/resources/mappers/daily/DailyRecordMapper.xml
Normal file
73
front/src/main/resources/mappers/daily/DailyRecordMapper.xml
Normal file
@@ -0,0 +1,73 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
|
||||
<mapper namespace="app.module.front.usecase.daily.record.persistence.DailyRecordMapper">
|
||||
|
||||
<select id="getDailyRecord"
|
||||
resultType="app.module.front.usecase.daily.record.persistence.model.DailyRecordDto">
|
||||
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.all_status, dr.income_status, dr.work_status, dr.expense_status, dr.power_status, dr.forestry_status
|
||||
from daily_day_group ddg
|
||||
left join
|
||||
daily_record dr on dr.day_group_no = ddg.group_no and dr.is_deleted = false
|
||||
and dr.record_month = #{searchMonth}
|
||||
and dr.household_seq = #{householdSeq}
|
||||
where ddg.is_deleted = false
|
||||
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>
|
||||
|
||||
<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
|
||||
, is_deleted
|
||||
, <include refid="common.fields.CreateUpdateBaseColumns"/>
|
||||
) values (
|
||||
#{householdSeq}
|
||||
, #{recordMonth}, #{dayGroupNo}, #{startDate}, #{endDate}
|
||||
, #{allStatus}, #{incomeStatus}, #{workStatus}, #{expenseStatus}, #{powerStatus}, #{forestryStatus}
|
||||
, false
|
||||
, <include refid="common.fields.CreateUpdateBaseValues"/>
|
||||
)
|
||||
</insert>
|
||||
|
||||
<update id="updateDailyRecordStatus">
|
||||
update daily_record set <include refid="common.fields.UpdateBaseSet"/>
|
||||
<if test="allStatus != null and allStatus != ''">
|
||||
, all_status = #{allStatus}
|
||||
</if>
|
||||
<if test="targetType != null and targetType != ''">
|
||||
/* TODO 개별 상태값 변경 */
|
||||
<choose>
|
||||
<when test="targetType eq 'INCOME'">
|
||||
, income_status = #{targetStatus}
|
||||
</when>
|
||||
</choose>
|
||||
</if>
|
||||
where is_deleted = false
|
||||
and household_seq = #{householdSeq}
|
||||
and record_month = #{recordMonth}
|
||||
and day_group_no = #{dayGroupNo}
|
||||
</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.household_seq = #{householdSeq}
|
||||
</sql>
|
||||
|
||||
</mapper>
|
||||
@@ -0,0 +1,61 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
|
||||
<mapper namespace="app.module.front.usecase.daily.calendar.persistence.RecordCalendarMapper">
|
||||
|
||||
<select id="getCalendarByDailyRecord"
|
||||
resultType="app.module.front.usecase.daily.calendar.persistence.model.DailyRecordCalendarDto">
|
||||
select ddg.group_no, ddg.start_day, ddg.end_day
|
||||
, dr.id as daily_id
|
||||
from daily_day_group ddg
|
||||
left join
|
||||
daily_record dr on dr.day_group_no = ddg.group_no and dr.is_deleted = false
|
||||
and dr.record_month = #{searchMonth}
|
||||
and dr.household_seq = #{householdSeq}
|
||||
where ddg.is_deleted = false
|
||||
order by
|
||||
ddg.group_no asc
|
||||
</select>
|
||||
|
||||
<select id="getDailyRecordStatus"
|
||||
resultType="app.module.front.usecase.daily.calendar.persistence.model.DailyRecordStatusDto">
|
||||
select dr.id as daily_id
|
||||
, dr.start_date, dr.end_date
|
||||
, dr.all_status
|
||||
, dr.income_status
|
||||
, (select count(*) from daily_income di where di.daily_record_seq = dr.id and di.is_deleted = false) as income_count
|
||||
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>
|
||||
|
||||
<select id="getStartDayByDailyGroupNo"
|
||||
resultType="int">
|
||||
select ddg.start_day
|
||||
from daily_day_group ddg
|
||||
where ddg.is_deleted = false
|
||||
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>
|
||||
|
||||
<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.household_seq = #{householdSeq}
|
||||
</sql>
|
||||
|
||||
</mapper>
|
||||
@@ -1,5 +1,5 @@
|
||||
uri=\uD648 \uD654\uBA74
|
||||
uri.front=\uBA54\uC778 \uD398\uC774\uC9C0
|
||||
uri.front=\uC784\uAC00\uACBD\uC81C\uC870\uC0AC
|
||||
#uri.front.board.exampleBoard=\uC608\uC81C \uAC8C\uC2DC\uD310
|
||||
uri.front.board.articles=\uC608\uC81C \uAC8C\uC2DC\uD310
|
||||
uri.front.board.exampleBoard.{{pathVar}}=\uC608\uC81C \uAC8C\uC2DC\uD310 \uC0C1\uC138\uBCF4\uAE30
|
||||
@@ -8,4 +8,15 @@ uri.front.user.register=\uD68C\uC6D0\uAC00\uC785
|
||||
uri.front.user.info=\uC815\uBCF4\uC218\uC815
|
||||
uri.front.board.article.create=\uC608\uC81C \uAC8C\uC2DC\uD310 \uB4F1\uB85D
|
||||
uri.front.board.article.{{pathVar}}=\uC608\uC81C \uAC8C\uC2DC\uD310 \uC0C1\uC138\uBCF4\uAE30
|
||||
uri.front.board.article.update.{{pathVar}}=\uC608\uC81C \uAC8C\uC2DC\uD310 \uC218\uC815
|
||||
uri.front.board.article.update.{{pathVar}}=\uC608\uC81C \uAC8C\uC2DC\uD310 \uC218\uC815
|
||||
|
||||
# \uC77C\uACC4\uBD80
|
||||
uri.front.record.calendar=\uC784\uAC00\uACBD\uC81C\uC870\uC0AC \uC77C\uACC4\uBD80
|
||||
uri.front.record.calendar.{{pathVar}}.{{pathVar}}=\uC77C\uACC4\uBD80 \uC6D4\uBCC4 \uD604\uD669
|
||||
uri.front.record.daily=\uC77C\uACC4\uBD80 \uB4F1\uB85D
|
||||
uri.front.record.daily.{{pathVar}}=\uC77C\uACC4\uBD80 \uB4F1\uB85D
|
||||
uri.front.record.income.{{pathVar}}=\uC218\uC785\uB0B4\uC5ED \uB4F1\uB85D
|
||||
uri.front.record.expense.{{pathVar}}=\uC9C0\uCD9C\uB0B4\uC5ED \uB4F1\uB85D
|
||||
uri.front.record.work.{{pathVar}}=\uB178\uB3D9\uC2DC\uAC04 \uB4F1\uB85D
|
||||
uri.front.record.power.{{pathVar}}=\uB3D9\uB825 \uC0AC\uC6A9\uC2DC\uAC04 \uB4F1\uB85D
|
||||
uri.front.record.forestry.{{pathVar}}=\uC790\uAC00\uC784\uC5C5 \uC0DD\uC0B0\uBB3C \uC911 \uC790\uAC00\uC18C\uBE44\uB7C9 \uB4F1\uB85D
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user