[FO] 일계부 등록 wip
This commit is contained in:
@@ -2,7 +2,7 @@
|
|||||||
-- ============================================
|
-- ============================================
|
||||||
-- 임가 일계부 입력 관련 테이블 S
|
-- 임가 일계부 입력 관련 테이블 S
|
||||||
-- ============================================
|
-- ============================================
|
||||||
|
/*
|
||||||
DROP TABLE IF EXISTS daily_income;
|
DROP TABLE IF EXISTS daily_income;
|
||||||
DROP TABLE IF EXISTS daily_expense;
|
DROP TABLE IF EXISTS daily_expense;
|
||||||
DROP TABLE IF EXISTS daily_work;
|
DROP TABLE IF EXISTS daily_work;
|
||||||
@@ -19,6 +19,8 @@ DROP SEQUENCE IF EXISTS daily_power_seq;
|
|||||||
DROP SEQUENCE IF EXISTS daily_forestry_seq;
|
DROP SEQUENCE IF EXISTS daily_forestry_seq;
|
||||||
DROP SEQUENCE IF EXISTS daily_farming_seq;
|
DROP SEQUENCE IF EXISTS daily_farming_seq;
|
||||||
DROP SEQUENCE IF EXISTS daily_record_seq;
|
DROP SEQUENCE IF EXISTS daily_record_seq;
|
||||||
|
DROP SEQUENCE IF EXISTS daily_day_group_pkey;
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
-- ============================================
|
-- ============================================
|
||||||
@@ -84,7 +86,7 @@ CREATE SEQUENCE daily_record_seq START WITH 1 INCREMENT BY 1 CACHE 1 NO CYCLE;
|
|||||||
CREATE TABLE daily_record (
|
CREATE TABLE daily_record (
|
||||||
id bigint DEFAULT nextval('daily_record_seq') NOT NULL, -- 일계부 작성상태 ID
|
id bigint DEFAULT nextval('daily_record_seq') NOT NULL, -- 일계부 작성상태 ID
|
||||||
household_seq bigint NOT NULL, -- 임가 일련번호 (FK)
|
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, -- 일계부 작성일자 그룹 번호
|
day_group_no smallint, -- 일계부 작성일자 그룹 번호
|
||||||
start_date date, -- 작성시작일(yyyy-mm-dd)
|
start_date date, -- 작성시작일(yyyy-mm-dd)
|
||||||
end_date date, -- 작성종료일(yyyy-mm-dd)
|
end_date date, -- 작성종료일(yyyy-mm-dd)
|
||||||
@@ -111,7 +113,7 @@ COMMENT ON TABLE daily_record IS '일계부 일별 작성상태';
|
|||||||
|
|
||||||
COMMENT ON COLUMN daily_record.id IS '일계부 작성상태 ID';
|
COMMENT ON COLUMN daily_record.id IS '일계부 작성상태 ID';
|
||||||
COMMENT ON COLUMN daily_record.household_seq IS '임가 일련번호';
|
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.start_date IS '작성시작일(yyyy-mm-dd)';
|
||||||
COMMENT ON COLUMN daily_record.end_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 '일계부 작성일자 그룹 번호';
|
COMMENT ON COLUMN daily_record.day_group_no IS '일계부 작성일자 그룹 번호';
|
||||||
@@ -142,13 +144,13 @@ CREATE TABLE daily_income (
|
|||||||
daily_record_seq bigint NOT NULL, -- 일계부 작성상태 일련번호 (FK)
|
daily_record_seq bigint NOT NULL, -- 일계부 작성상태 일련번호 (FK)
|
||||||
is_credit boolean, -- 외상판매 여부
|
is_credit boolean, -- 외상판매 여부
|
||||||
crop_code varchar(255), -- 재배형태 코드 (매핑코드)
|
crop_code varchar(255), -- 재배형태 코드 (매핑코드)
|
||||||
category_code varchar(255) NOT NULL, -- 수입 종류(매핑코드)
|
category_code varchar(255) NULL, -- 수입 종류(매핑코드)
|
||||||
category_name varchar(30) NOT NULL, -- 수입 종류(직접입력)
|
category_name varchar(30) NULL, -- 수입 종류(직접입력)
|
||||||
source_purpose varchar(10), -- 수입원(용도)
|
source_purpose varchar(10), -- 수입원(용도)
|
||||||
quantity decimal(6,2) NOT NULL, -- 수량
|
quantity decimal(6,2) NOT NULL, -- 수량
|
||||||
unit_code varchar(10) NOT NULL, -- 단위 (매핑코드)
|
unit_code varchar(255) NOT NULL, -- 단위 (매핑코드)
|
||||||
price integer NOT NULL, -- 현금(원)
|
price integer NULL, -- 현금(원)
|
||||||
estimated_value integer NOT NULL, -- 현물(평가액)
|
estimated_value integer NULL, -- 현물(평가액)
|
||||||
created_at timestamp(6), -- 생성일
|
created_at timestamp(6), -- 생성일
|
||||||
created_by varchar(255), -- 생성자
|
created_by varchar(255), -- 생성자
|
||||||
updated_at timestamp(6), -- 수정일
|
updated_at timestamp(6), -- 수정일
|
||||||
|
|||||||
@@ -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,41 @@
|
|||||||
|
package app.module.front.usecase.daily.income.web;
|
||||||
|
|
||||||
|
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(getAccessId());
|
||||||
|
log.debug("reqVO: {}", reqVO);
|
||||||
|
|
||||||
|
model.addAttribute("reqVO", reqVO);
|
||||||
|
model.addAttribute("detail", null);
|
||||||
|
|
||||||
|
return "record/income/index";
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO : 로그인 SEQ
|
||||||
|
private Long getAccessId() {
|
||||||
|
return 2L;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -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,72 @@
|
|||||||
|
package app.module.front.usecase.daily.record.service;
|
||||||
|
|
||||||
|
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(command);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,87 @@
|
|||||||
|
package app.module.front.usecase.daily.record.web;
|
||||||
|
|
||||||
|
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(getAccessId());
|
||||||
|
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(getAccessId());
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO : 로그인 SEQ
|
||||||
|
private Long getAccessId() {
|
||||||
|
return 2L;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
package app.module.front.usecase.daily.record.web.model;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.Setter;
|
||||||
|
|
||||||
|
import java.time.LocalDate;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class CreateDailyRecordReqVO {
|
||||||
|
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"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
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
|
||||||
|
, created_at, created_by, is_deleted
|
||||||
|
) values (
|
||||||
|
#{householdSeq}
|
||||||
|
, #{recordMonth}, #{dayGroupNo}, #{startDate}, #{endDate}
|
||||||
|
, #{allStatus}, #{incomeStatus}, #{workStatus}, #{expenseStatus}, #{powerStatus}, #{forestryStatus}
|
||||||
|
, now(), #{createdBy}, false
|
||||||
|
)
|
||||||
|
</insert>
|
||||||
|
|
||||||
|
<update id="updateDailyRecordStatus">
|
||||||
|
update daily_record set
|
||||||
|
updated_at = now()
|
||||||
|
, updated_by = #{updatedBy}
|
||||||
|
<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>
|
||||||
2
front/src/main/resources/static/library/jquery/jquery-3.7.1.min.js
vendored
Normal file
2
front/src/main/resources/static/library/jquery/jquery-3.7.1.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
238
front/src/main/resources/static/ui/ajaxUtil.js
Normal file
238
front/src/main/resources/static/ui/ajaxUtil.js
Normal file
@@ -0,0 +1,238 @@
|
|||||||
|
var ajaxUtil = {
|
||||||
|
_msg400 : '잘못된 요청입니다.',
|
||||||
|
_msg404 : '',
|
||||||
|
_msg401 : '로그인에 실패했습니다.',
|
||||||
|
_msg403 : '로그인에 실패했습니다.',
|
||||||
|
_msg500 : '오류가 발생하여\n정상 처리되지 않았습니다.',
|
||||||
|
|
||||||
|
$400 : '400',
|
||||||
|
$401 : '401',
|
||||||
|
$403 : '403',
|
||||||
|
$404 : '404',
|
||||||
|
$500 : '500',
|
||||||
|
|
||||||
|
_csrfHeader : $('meta[name="_csrf_header"]').attr('content'),
|
||||||
|
_csrfToken : $('meta[name="_csrf"]').attr('content'),
|
||||||
|
loading : null,
|
||||||
|
loadingStatus:false,
|
||||||
|
|
||||||
|
_init : function(obj){ //에러메시지를 정의 해주어야 한다.
|
||||||
|
ajaxUtil._msg400 = obj._msg400;
|
||||||
|
ajaxUtil._msg404 = obj._msg404;
|
||||||
|
ajaxUtil._msg401 = obj._msg401;
|
||||||
|
ajaxUtil._msg403 = obj._msg403;
|
||||||
|
ajaxUtil._msg500 = obj._msg500;
|
||||||
|
},
|
||||||
|
|
||||||
|
_alertError : function (code) {
|
||||||
|
var message = ajaxUtil._msg500;
|
||||||
|
if (code == '400') {
|
||||||
|
message = ajaxUtil._msg400;
|
||||||
|
}
|
||||||
|
ajaxUtil._alert(message, '오류 안내');
|
||||||
|
},
|
||||||
|
_alert : function (alertMessage, alertTitle, afterEvent) {
|
||||||
|
ajaxUtil._alertMethod({
|
||||||
|
id: null,
|
||||||
|
title: alertTitle !== undefined ? alertTitle : null,
|
||||||
|
message: alertMessage,
|
||||||
|
after: afterEvent !== undefined ? (afterEvent ? 'Y' : 'N') : 'N',
|
||||||
|
});
|
||||||
|
},
|
||||||
|
_alertId : function (alertId, afterEvent) {
|
||||||
|
ajaxUtil._alertMethod({
|
||||||
|
id: alertId,
|
||||||
|
title: null,
|
||||||
|
message: null,
|
||||||
|
after: afterEvent !== undefined ? (afterEvent ? 'Y' : 'N') : 'N',
|
||||||
|
});
|
||||||
|
},
|
||||||
|
_alertMethod : function (jsonObj) {
|
||||||
|
ajaxUtil._ajaxSyncNoWaiting(
|
||||||
|
'/m/common/alert',
|
||||||
|
jsonObj,
|
||||||
|
function(rstData) {
|
||||||
|
var $wrap = $('#bindWrap');
|
||||||
|
if ($wrap.find('.ui-popup-common-alert').length != 0) {
|
||||||
|
$wrap.find('.ui-popup-common-alert').remove();
|
||||||
|
}
|
||||||
|
|
||||||
|
$wrap.append(rstData);
|
||||||
|
uxgFn.popup.bind('.ui-popup-common-alert').open();
|
||||||
|
},
|
||||||
|
function(code, rstData) {
|
||||||
|
research.logger.error('Do nothing. code: '+ code, rstData);
|
||||||
|
},
|
||||||
|
'html');
|
||||||
|
},
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 로딩바가 있는 동기식 방식 처리
|
||||||
|
*/
|
||||||
|
_ajaxSync : function(url, jsonObj, successCallback, errorCallback, dataType) {
|
||||||
|
ajaxUtil._showWaiting();
|
||||||
|
ajaxUtil._ajaxSyncMethod(url, ajaxUtil._jsonStringify(jsonObj), successCallback, errorCallback, 'post', dataType);
|
||||||
|
},
|
||||||
|
/**
|
||||||
|
* 로딩바가 없는 동기식 방식 처리
|
||||||
|
*/
|
||||||
|
_ajaxSyncNoWaiting : function(url, jsonObj, successCallback, errorCallback, dataType) {
|
||||||
|
ajaxUtil._ajaxSyncMethod(url, ajaxUtil._jsonStringify(jsonObj), successCallback, errorCallback, 'post', dataType);
|
||||||
|
},
|
||||||
|
/**
|
||||||
|
* 로딩바가 없는 동기식 방식 처리(MethodType를 지정할 수 있는)
|
||||||
|
*/
|
||||||
|
_ajaxSyncMethod : function(url, jsonObj, successCallback, errorCallback, method, dataType) {
|
||||||
|
ajaxUtil._ajaxMethod(url, jsonObj, successCallback, errorCallback, method, dataType, false);
|
||||||
|
},
|
||||||
|
/**
|
||||||
|
* 로딩바가 있는 비동기식 방식 처리
|
||||||
|
*/
|
||||||
|
_ajaxAsync : function (url, jsonObj, successCallback, errorCallback, dataType) {
|
||||||
|
ajaxUtil._showWaiting();
|
||||||
|
ajaxUtil._ajaxAsyncMethod(url, ajaxUtil._jsonStringify(jsonObj), successCallback, errorCallback, 'post', dataType);
|
||||||
|
},
|
||||||
|
/**
|
||||||
|
* 로딩바가 없는 비동기식 방식 처리
|
||||||
|
*/
|
||||||
|
_ajaxAsyncNoWaiting : function (url, jsonObj, successCallback, errorCallback, dataType) {
|
||||||
|
ajaxUtil._ajaxAsyncMethod(url, ajaxUtil._jsonStringify(jsonObj), successCallback, errorCallback, 'post', dataType);
|
||||||
|
},
|
||||||
|
/**
|
||||||
|
* 로딩바가 없는 비동기식 방식 처리(MethodType를 지정할 수 있는)
|
||||||
|
*/
|
||||||
|
_ajaxAsyncMethod : function (url, jsonObj, successCallback, errorCallback, method, dataType) {
|
||||||
|
ajaxUtil._ajaxMethod(url, jsonObj, successCallback, errorCallback, method, dataType, true);
|
||||||
|
},
|
||||||
|
/**
|
||||||
|
* ajax 공통 처리
|
||||||
|
*/
|
||||||
|
_ajaxMethod : function (url, jsonObj, successCallback, errorCallback, method, dataType, async) {
|
||||||
|
if (typeof ENV != 'undefined' && typeof ENV.submitted == 'boolean') {
|
||||||
|
ENV.submitted = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
$.ajax(
|
||||||
|
{
|
||||||
|
beforeSend : function(xhr) {
|
||||||
|
if (ajaxUtil._csrfHeader != undefined) {
|
||||||
|
xhr.setRequestHeader(ajaxUtil._csrfHeader, ajaxUtil._csrfToken);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
beforeSubmit : '',
|
||||||
|
url : url,
|
||||||
|
type : method != undefined ? method : 'post', // get, post
|
||||||
|
dataType : dataType != undefined ? dataType : 'json', // xml, html, script, json
|
||||||
|
data : jsonObj,
|
||||||
|
contentType : 'application/json; charset=UTF-8',
|
||||||
|
async: async,
|
||||||
|
statusCode : {
|
||||||
|
404:function(rstData){
|
||||||
|
ajaxUtil._hideWaiting();
|
||||||
|
if (typeof errorCallback !== 'undefined') {
|
||||||
|
errorCallback(ajaxUtil.$404, rstData);
|
||||||
|
} else {
|
||||||
|
ajaxUtil._goToMain();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
401:function(){
|
||||||
|
ajaxUtil._goToMain();
|
||||||
|
},
|
||||||
|
403:function(rstData){
|
||||||
|
ajaxUtil._goToMain();
|
||||||
|
},
|
||||||
|
422:function(rstData, status) {
|
||||||
|
alert(422)
|
||||||
|
console.log(rstData)
|
||||||
|
$(rstData.responseJSON).each((idx, oj) => {
|
||||||
|
// TODO : form id? or body
|
||||||
|
let target = $('body').find('[name=' + oj.field + ']');
|
||||||
|
target.addClass('is-invalid');
|
||||||
|
|
||||||
|
target.parent().find('.invalid-feedback').text(oj.defaultMessage);
|
||||||
|
});
|
||||||
|
},
|
||||||
|
500:function(rstData){
|
||||||
|
ajaxUtil._hideWaiting();
|
||||||
|
if (rstData.responseText != '') {
|
||||||
|
let resultJSON = ajaxUtil._jsonParse(rstData.responseText);
|
||||||
|
if (rstData.responseJSON != undefined) {
|
||||||
|
resultJSON = rstData.responseJSON;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (resultJSON.code == 1064) {
|
||||||
|
ajaxUtil._alert(resultJSON.message, '확인');
|
||||||
|
} else if (typeof errorCallback !== 'undefined') {
|
||||||
|
errorCallback(ajaxUtil.$500, rstData);
|
||||||
|
}
|
||||||
|
} else if (typeof errorCallback !== 'undefined') {
|
||||||
|
errorCallback(ajaxUtil.$500, rstData);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
success : function(rstData, status) {
|
||||||
|
ajaxUtil._hideWaiting();
|
||||||
|
if (typeof successCallback !== 'undefined') {
|
||||||
|
successCallback(rstData, status);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
error : function(rstData) {
|
||||||
|
ajaxUtil._hideWaiting();
|
||||||
|
if (!(rstData.status == 500 || rstData.status == 422)) {
|
||||||
|
if (typeof errorCallback !== 'undefined') {
|
||||||
|
errorCallback(rstData.status, rstData);
|
||||||
|
} else {
|
||||||
|
ajaxUtil._alertError(ajaxUtil._msg500);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
complete : function(xhr, status, err) {
|
||||||
|
ajaxUtil._hideWaiting();
|
||||||
|
if (typeof ENV != 'undefined' && typeof ENV.submitted == 'boolean') {
|
||||||
|
ENV.submitted = false;
|
||||||
|
}
|
||||||
|
if (typeof commentENV != 'undefined' && typeof commentENV.submitted == 'boolean') {
|
||||||
|
commentENV.submitted = false;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
|
|
||||||
|
_jsonParse : function parse(jsonStr) {
|
||||||
|
try {
|
||||||
|
var jsonObj = JSON.parse(jsonStr);
|
||||||
|
// chamobile.logger.debug(jsonObj);
|
||||||
|
return jsonObj;
|
||||||
|
} catch (error) {
|
||||||
|
console.error("Invalid JSON string:", error);
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
},
|
||||||
|
_jsonStringify : function stringify(obj) {
|
||||||
|
try {
|
||||||
|
var jsonStr = JSON.stringify(obj);
|
||||||
|
// chamobile.logger.debug(jsonStr);
|
||||||
|
return jsonStr;
|
||||||
|
} catch (error) {
|
||||||
|
console.error("Error stringifying object:", error);
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
},
|
||||||
|
|
||||||
|
|
||||||
|
_goToMain:function() {
|
||||||
|
location.href = '/';
|
||||||
|
},
|
||||||
|
_hideWaiting:function(){
|
||||||
|
if (ajaxUtil.loadingStatus) {
|
||||||
|
ajaxUtil.loadingStatus = false;
|
||||||
|
// TODO : 로딩바 숨김
|
||||||
|
}
|
||||||
|
},
|
||||||
|
_showWaiting:function(){
|
||||||
|
ajaxUtil.loadingStatus = true;
|
||||||
|
// TODO : 로딩바 활성화
|
||||||
|
},
|
||||||
|
};
|
||||||
33
front/src/main/resources/static/ui/commonUtil.js
Normal file
33
front/src/main/resources/static/ui/commonUtil.js
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
|
||||||
|
|
||||||
|
var research = {};
|
||||||
|
research.json = new Object();
|
||||||
|
research.logger = new Object();
|
||||||
|
|
||||||
|
/* research.logger */
|
||||||
|
/**
|
||||||
|
* client 오류성 로그 기록용 로거, 로그 레벨에 따라 표시
|
||||||
|
* @param message
|
||||||
|
* @param el
|
||||||
|
*/
|
||||||
|
research.logger.debug = function(message, el){
|
||||||
|
var callee = arguments.callee.caller == '' ? arguments.callee.caller.arguments.callee.name : (arguments.callee.caller ? arguments.callee.caller.name : '');
|
||||||
|
console.log("[DEBUG] caller : " + callee + " / message : " + message, el);
|
||||||
|
};
|
||||||
|
|
||||||
|
research.logger.error = function(message, el){
|
||||||
|
var callee = arguments.callee.caller == '' ? arguments.callee.caller.arguments.callee.name : (arguments.callee.caller ? arguments.callee.caller.name : '');
|
||||||
|
console.error("[ERROR] caller : " + callee + " / message : " + message, el);
|
||||||
|
};
|
||||||
|
|
||||||
|
research.logger.info = function(message){
|
||||||
|
var callee = arguments.callee.caller == '' ? arguments.callee.caller.arguments.callee.name : (arguments.callee.caller ? arguments.callee.caller.name : '');
|
||||||
|
console.info("[INFO] caller : " + callee + " / message : " + message);
|
||||||
|
};
|
||||||
|
|
||||||
|
research.logger.warn = function(message){
|
||||||
|
var callee = arguments.callee.caller == '' ? arguments.callee.caller.arguments.callee.name : (arguments.callee.caller ? arguments.callee.caller.name : '');
|
||||||
|
console.warn("[WARN] caller : " + callee + " / message : " + message);
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
30
front/src/main/resources/static/ui/page/daily-record.js
Normal file
30
front/src/main/resources/static/ui/page/daily-record.js
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
var page = {};
|
||||||
|
page.daily = new Object();
|
||||||
|
|
||||||
|
page.daily.httpUrl = {
|
||||||
|
root: '/record/calendar',
|
||||||
|
daily: '/record/daily/{searchMonth}/{groupNo}',
|
||||||
|
income: '/record/income/{searchMonth}/{groupNo}',
|
||||||
|
work: '/record/work/{searchMonth}/{groupNo}',
|
||||||
|
expense: '/record/expense/{searchMonth}/{groupNo}',
|
||||||
|
power: '/record/power/{searchMonth}/{groupNo}',
|
||||||
|
forestry: '/record/forestry/{searchMonth}/{groupNo}',
|
||||||
|
}
|
||||||
|
|
||||||
|
page.daily.goToMain = function() {
|
||||||
|
location.href = page.daily.httpUrl.root;
|
||||||
|
}
|
||||||
|
|
||||||
|
page.daily.goToNext = function(target, searchMonth, groupNo) {
|
||||||
|
let url = page.daily.httpUrl.root;
|
||||||
|
|
||||||
|
// TODO URL
|
||||||
|
if (target == 'income') {
|
||||||
|
url = page.daily.httpUrl.income;
|
||||||
|
} else if (target == 'work') {
|
||||||
|
url = page.daily.httpUrl.work;
|
||||||
|
}
|
||||||
|
|
||||||
|
console.log(url.replace('{searchMonth}', searchMonth).replace('{groupNo}', groupNo));
|
||||||
|
//location.href = url.replace('{searchMonth}', searchMonth).replace('{groupNo}', groupNo);
|
||||||
|
}
|
||||||
@@ -25,10 +25,12 @@
|
|||||||
<meta property="og:keywords" th:content="${currentURI.ogKeywords}"/>
|
<meta property="og:keywords" th:content="${currentURI.ogKeywords}"/>
|
||||||
<meta property="og:image" th:content="${currentURI.ogImage}"/>
|
<meta property="og:image" th:content="${currentURI.ogImage}"/>
|
||||||
|
|
||||||
<script th:src="@{/static/library/jquery/jquery-3.6.0.min.js}"></script>
|
<script th:src="@{/static/library/jquery/jquery-3.7.1.min.js}"></script>
|
||||||
<script th:src="@{/static/library/jsUri/Uri.js}"></script>
|
<script th:src="@{/static/library/jsUri/Uri.js}"></script>
|
||||||
<script th:src="@{/static/library/jsRender/jsrender.min.js}"></script>
|
<script th:src="@{/static/library/jsRender/jsrender.min.js}"></script>
|
||||||
<script th:src="@{/static/ui/uiUtil.js}"></script>
|
<script th:src="@{/static/ui/uiUtil.js}"></script>
|
||||||
|
<script th:src="@{/static/ui/ajaxUtil.js}"></script>
|
||||||
|
<script th:src="@{/static/ui/commonUtil.js}"></script>
|
||||||
<script th:src="@{/static/library/jquery/jquery-serializeObject.min.js}"></script>
|
<script th:src="@{/static/library/jquery/jquery-serializeObject.min.js}"></script>
|
||||||
|
|
||||||
<link rel="stylesheet" th:href="@{/static/library/flatpickr/flatpickr.min.css}">
|
<link rel="stylesheet" th:href="@{/static/library/flatpickr/flatpickr.min.css}">
|
||||||
|
|||||||
@@ -16,6 +16,8 @@
|
|||||||
</section>
|
</section>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<hr/>
|
||||||
|
|
||||||
<div th:replace="~{common/components :: footer}"></div>
|
<div th:replace="~{common/components :: footer}"></div>
|
||||||
<section layout:fragment="script"></section>
|
<section layout:fragment="script"></section>
|
||||||
|
|
||||||
|
|||||||
33
front/src/main/resources/templates/record/calendar-wrap.html
Normal file
33
front/src/main/resources/templates/record/calendar-wrap.html
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout"
|
||||||
|
xmlns:th="http://www.thymeleaf.org">
|
||||||
|
|
||||||
|
<div>
|
||||||
|
<div>
|
||||||
|
reqVO: [[${reqVO}]]
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<th:block th:if="${not #strings.isEmpty(detail)}">
|
||||||
|
[[${#temporals.format(detail.startDate, 'yyyy년 MM월 dd일')}]] ~ [[${#temporals.format(detail.endDate, 'yyyy년 MM월 dd일')}]]<br/>
|
||||||
|
|
||||||
|
수입 : [[${detail.incomeStatus}]], [[${detail.incomeCount}]]
|
||||||
|
<span th:onclick="formControl.incomeDetail([[${reqVO.searchDay}]])">수정</span>
|
||||||
|
<br/>
|
||||||
|
|
||||||
|
<br/><br/>
|
||||||
|
detail: [[${detail}]]
|
||||||
|
</th:block>
|
||||||
|
|
||||||
|
<th:block th:if="${#strings.isEmpty(detail)}">
|
||||||
|
<th:block th:with="searchDate=${#temporals.createDate(reqVO.searchDay, 'yyyyMMdd')}">
|
||||||
|
[[${#temporals.format(searchDate, 'yyyy년 MM월 dd일')}]]
|
||||||
|
</th:block>
|
||||||
|
<br/>
|
||||||
|
|
||||||
|
<input type="button" value="등록" th:onclick="formControl.recordCreate([[${reqVO.searchMonth}]], [[${reqVO.groupNo}]])">
|
||||||
|
</th:block>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</html>
|
||||||
74
front/src/main/resources/templates/record/calendar.html
Normal file
74
front/src/main/resources/templates/record/calendar.html
Normal file
@@ -0,0 +1,74 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html layout:decorate="~{layout/layout}" xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout"
|
||||||
|
xmlns:th="http://www.thymeleaf.org">
|
||||||
|
|
||||||
|
<section layout:fragment="content">
|
||||||
|
<h2>calendar</h2>
|
||||||
|
<div>
|
||||||
|
reqVO: [[${reqVO}]]
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<th:block th:each="calendar, calendarStatus : ${calendarList}">
|
||||||
|
<th:block th:if="${not #strings.isEmpty(calendar.dailyId)}">
|
||||||
|
<span th:onclick="formControl.getDetail([[${reqVO.searchMonth}]], [[${calendar.groupNo}]])">
|
||||||
|
No=[[${calendar.groupNo}]], Start=[[${calendar.startDay}]], End=[[${calendar.endDay}]], StartDate=[[${calendar.startDate}]], Id=[[${calendar.dailyId}]]<br/>
|
||||||
|
</span>
|
||||||
|
</th:block>
|
||||||
|
<th:block th:if="${#strings.isEmpty(calendar.dailyId)}">
|
||||||
|
<span th:onclick="formControl.getDetail([[${reqVO.searchMonth}]], [[${calendar.groupNo}]])">
|
||||||
|
No=[[${calendar.groupNo}]], Start=[[${calendar.startDay}]], End=[[${calendar.endDay}]], StartDate=[[${calendar.startDate}]]<br/>
|
||||||
|
</span>
|
||||||
|
</th:block>
|
||||||
|
</th:block>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<hr/>
|
||||||
|
|
||||||
|
<div id="selectedDay">
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</section>
|
||||||
|
|
||||||
|
<section layout:fragment="script">
|
||||||
|
<script th:src="@{/static/ui/page/daily-record.js}"></script>
|
||||||
|
<script th:inline="javascript">
|
||||||
|
let ENV = {
|
||||||
|
httpUrl: {
|
||||||
|
root: '',
|
||||||
|
list: '/record/calendar/{searchMonth}/{groupNo}',
|
||||||
|
create: '/record/daily/{searchMonth}/{groupNo}',
|
||||||
|
},
|
||||||
|
submitted: false,
|
||||||
|
};
|
||||||
|
|
||||||
|
let formControl = {
|
||||||
|
getDetail(searchMonth, groupNo) {
|
||||||
|
console.log('searchMonth=', searchMonth, 'groupNo=', groupNo);
|
||||||
|
|
||||||
|
ajaxUtil._ajaxAsync(
|
||||||
|
ENV.httpUrl.list.replace('{searchMonth}', searchMonth).replace('{groupNo}', groupNo),
|
||||||
|
null,
|
||||||
|
function(rstHtml, status) {
|
||||||
|
$('#selectedDay').html(rstHtml);
|
||||||
|
},
|
||||||
|
function(code, rstData) {
|
||||||
|
research.logger.error('Do nothing. code: '+ code, rstData);
|
||||||
|
},
|
||||||
|
'html'
|
||||||
|
);
|
||||||
|
|
||||||
|
},
|
||||||
|
incomeDetail(selectedDay) {
|
||||||
|
// TODO
|
||||||
|
alert('TODO : ' + selectedDay);
|
||||||
|
},
|
||||||
|
|
||||||
|
recordCreate(searchMonth, groupNo) {
|
||||||
|
location.href = ENV.httpUrl.create.replace('{searchMonth}', searchMonth).replace('{groupNo}', groupNo);
|
||||||
|
},
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
</html>
|
||||||
94
front/src/main/resources/templates/record/daily.html
Normal file
94
front/src/main/resources/templates/record/daily.html
Normal file
@@ -0,0 +1,94 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html layout:decorate="~{layout/layout}" xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout"
|
||||||
|
xmlns:th="http://www.thymeleaf.org">
|
||||||
|
|
||||||
|
<section layout:fragment="content">
|
||||||
|
<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>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<br/>
|
||||||
|
<div>
|
||||||
|
<input type="checkbox" name="workStatus" value="WAITING" data-target="work" /> 노동 내역
|
||||||
|
<div class="invalid-feedback">
|
||||||
|
에러 메세지
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</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>
|
||||||
|
|
||||||
|
<hr/>
|
||||||
|
|
||||||
|
</section>
|
||||||
|
|
||||||
|
<section layout:fragment="script">
|
||||||
|
<script th:src="@{/static/ui/page/daily-record.js}"></script>
|
||||||
|
<script th:inline="javascript">
|
||||||
|
let ENV = {
|
||||||
|
httpUrl: {
|
||||||
|
root: '',
|
||||||
|
create: '',
|
||||||
|
},
|
||||||
|
submitted: false,
|
||||||
|
};
|
||||||
|
|
||||||
|
let formControl = {
|
||||||
|
create(searchMonth, groupNo) {
|
||||||
|
const f = document.reqForm;
|
||||||
|
|
||||||
|
if ($(f).find('input:checked').length == 0) {
|
||||||
|
if (confirm('등록할 내용이 없음?')) {
|
||||||
|
f.todayNone.value = 'Y';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const obj = $(f).serializeObject();
|
||||||
|
ajaxUtil._ajaxAsync(
|
||||||
|
ENV.httpUrl.create.replace('{searchMonth}', searchMonth).replace('{groupNo}', groupNo),
|
||||||
|
obj,
|
||||||
|
function(rstData, status) {
|
||||||
|
console.log(rstData);
|
||||||
|
|
||||||
|
if (f.todayNone.value == 'Y') {
|
||||||
|
page.daily.goToMain();
|
||||||
|
} else {
|
||||||
|
page.daily.goToNext($('input:checked').eq(0).data('target'), searchMonth, groupNo);
|
||||||
|
}
|
||||||
|
|
||||||
|
},
|
||||||
|
);
|
||||||
|
},
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
</html>
|
||||||
35
front/src/main/resources/templates/record/income/index.html
Normal file
35
front/src/main/resources/templates/record/income/index.html
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html layout:decorate="~{layout/layout}" xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout"
|
||||||
|
xmlns:th="http://www.thymeleaf.org">
|
||||||
|
|
||||||
|
<section layout:fragment="content">
|
||||||
|
<h2>daily Form</h2>
|
||||||
|
<div>
|
||||||
|
reqVO: [[${reqVO}]]
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<br/><br/>
|
||||||
|
detail: [[${detail}]]
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<hr/>
|
||||||
|
|
||||||
|
</section>
|
||||||
|
|
||||||
|
<section layout:fragment="script">
|
||||||
|
<script th:src="@{/static/ui/page/daily-record.js}"></script>
|
||||||
|
<script th:inline="javascript">
|
||||||
|
let ENV = {
|
||||||
|
httpUrl: {
|
||||||
|
root: '',
|
||||||
|
create: '/record/daily/{searchMonth}/{groupNo}',
|
||||||
|
},
|
||||||
|
submitted: false,
|
||||||
|
};
|
||||||
|
|
||||||
|
let formControl = {
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
</html>
|
||||||
Reference in New Issue
Block a user