From 15dd6a47981df92b562289987405713059ced173 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EA=B9=80=ED=98=84=EC=A3=BC?= Date: Tue, 1 Jul 2025 13:59:53 +0900 Subject: [PATCH] =?UTF-8?q?[BO]=20=EC=9D=BC=EA=B3=84=EB=B6=80=20=EB=8F=99?= =?UTF-8?q?=EB=A0=A5=20=EC=82=AC=EC=9A=A9=EC=8B=9C=EA=B0=84=EB=93=B1?= =?UTF-8?q?=EB=A1=9D,=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../persistence/SaveDailyPowerDao.java | 39 ++++ .../persistence/SaveDailyPowerMapper.java | 39 ++++ .../persistence/modal/GetDailyPowerDto.java | 14 ++ .../web/SaveDailyPowerController.java | 87 +++++++++ .../adapters/web/model/DailyPowerUIReqVO.java | 30 +++ .../web/model/SaveDailyPowerReqVO.java | 26 +++ .../validator/SaveDailyPowerValidator.java | 32 ++++ .../ports/SaveDailyPowerPortIn.java | 22 +++ .../ports/SaveDailyPowerPortOut.java | 23 +++ .../application/SaveDailyPowerService.java | 51 +++++ .../application/domain/GetDailyPowerCmd.java | 27 +++ .../application/domain/SaveDailyPowerCmd.java | 19 ++ .../household/daily/SaveDailyPowerMapper.xml | 49 +++++ .../households/modal/modal-daily-power.html | 177 ++++++++++++++++++ .../households/tab/daily-record.html | 4 +- .../resources/templates/households/{seq}.html | 1 + 16 files changed, 639 insertions(+), 1 deletion(-) create mode 100644 admin/src/main/java/app/module/admin/usecase/household/tab/dailyRecord/saveDailyPower/adapters/persistence/SaveDailyPowerDao.java create mode 100644 admin/src/main/java/app/module/admin/usecase/household/tab/dailyRecord/saveDailyPower/adapters/persistence/SaveDailyPowerMapper.java create mode 100644 admin/src/main/java/app/module/admin/usecase/household/tab/dailyRecord/saveDailyPower/adapters/persistence/modal/GetDailyPowerDto.java create mode 100644 admin/src/main/java/app/module/admin/usecase/household/tab/dailyRecord/saveDailyPower/adapters/web/SaveDailyPowerController.java create mode 100644 admin/src/main/java/app/module/admin/usecase/household/tab/dailyRecord/saveDailyPower/adapters/web/model/DailyPowerUIReqVO.java create mode 100644 admin/src/main/java/app/module/admin/usecase/household/tab/dailyRecord/saveDailyPower/adapters/web/model/SaveDailyPowerReqVO.java create mode 100644 admin/src/main/java/app/module/admin/usecase/household/tab/dailyRecord/saveDailyPower/adapters/web/validator/SaveDailyPowerValidator.java create mode 100644 admin/src/main/java/app/module/admin/usecase/household/tab/dailyRecord/saveDailyPower/ports/SaveDailyPowerPortIn.java create mode 100644 admin/src/main/java/app/module/admin/usecase/household/tab/dailyRecord/saveDailyPower/ports/SaveDailyPowerPortOut.java create mode 100644 admin/src/main/java/app/module/admin/usecase/household/tab/dailyRecord/saveDailyPower/ports/application/SaveDailyPowerService.java create mode 100644 admin/src/main/java/app/module/admin/usecase/household/tab/dailyRecord/saveDailyPower/ports/application/domain/GetDailyPowerCmd.java create mode 100644 admin/src/main/java/app/module/admin/usecase/household/tab/dailyRecord/saveDailyPower/ports/application/domain/SaveDailyPowerCmd.java create mode 100644 admin/src/main/resources/mappers/household/daily/SaveDailyPowerMapper.xml create mode 100644 admin/src/main/resources/templates/households/modal/modal-daily-power.html diff --git a/admin/src/main/java/app/module/admin/usecase/household/tab/dailyRecord/saveDailyPower/adapters/persistence/SaveDailyPowerDao.java b/admin/src/main/java/app/module/admin/usecase/household/tab/dailyRecord/saveDailyPower/adapters/persistence/SaveDailyPowerDao.java new file mode 100644 index 00000000..615bc870 --- /dev/null +++ b/admin/src/main/java/app/module/admin/usecase/household/tab/dailyRecord/saveDailyPower/adapters/persistence/SaveDailyPowerDao.java @@ -0,0 +1,39 @@ +package app.module.admin.usecase.household.tab.dailyRecord.saveDailyPower.adapters.persistence; + +import app.module.admin.usecase.household.tab.dailyRecord.saveDailyPower.adapters.persistence.modal.GetDailyPowerDto; +import app.module.admin.usecase.household.tab.dailyRecord.saveDailyPower.ports.SaveDailyPowerPortOut; +import app.module.admin.usecase.household.tab.dailyRecord.saveDailyPower.ports.application.domain.GetDailyPowerCmd; +import app.module.admin.usecase.household.tab.dailyRecord.saveDailyPower.ports.application.domain.SaveDailyPowerCmd; +import app.module.core.config.application.annotation.CreateCommand; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Service; + +@Slf4j +@Service +@RequiredArgsConstructor +public class SaveDailyPowerDao implements SaveDailyPowerPortOut { + private final SaveDailyPowerMapper dailyPowerMapper; + + @Override + public GetDailyPowerDto detail(GetDailyPowerCmd command) { + + return dailyPowerMapper.getDailyPower(command); + } + + @CreateCommand + @Override + public void create(GetDailyPowerCmd findCmd, SaveDailyPowerCmd command) { + Integer existCount = dailyPowerMapper.getRecordExistCount(findCmd); + if (existCount == 0) { + dailyPowerMapper.createDailyPower(command); + + log.debug("[CreateDailyPower] command={}", command); + } else { + dailyPowerMapper.updateDailyPower(command); + + log.debug("[UpdateDailyPower] command={}", command); + } + } + +} diff --git a/admin/src/main/java/app/module/admin/usecase/household/tab/dailyRecord/saveDailyPower/adapters/persistence/SaveDailyPowerMapper.java b/admin/src/main/java/app/module/admin/usecase/household/tab/dailyRecord/saveDailyPower/adapters/persistence/SaveDailyPowerMapper.java new file mode 100644 index 00000000..31187f99 --- /dev/null +++ b/admin/src/main/java/app/module/admin/usecase/household/tab/dailyRecord/saveDailyPower/adapters/persistence/SaveDailyPowerMapper.java @@ -0,0 +1,39 @@ +package app.module.admin.usecase.household.tab.dailyRecord.saveDailyPower.adapters.persistence; + +import app.module.admin.usecase.household.tab.dailyRecord.saveDailyPower.adapters.persistence.modal.GetDailyPowerDto; +import app.module.admin.usecase.household.tab.dailyRecord.saveDailyPower.ports.application.domain.GetDailyPowerCmd; +import app.module.admin.usecase.household.tab.dailyRecord.saveDailyPower.ports.application.domain.SaveDailyPowerCmd; +import org.apache.ibatis.annotations.Mapper; + +@Mapper +public interface SaveDailyPowerMapper { + /** + * 일계부 동력 사용시간 데이터 조회 + * + * @param command 검색 조건 + * @return 동력 사용시간 데이터 + */ + GetDailyPowerDto getDailyPower(GetDailyPowerCmd command); + + /** + * 일계부 동력 사용시간 데이터 존재 여부 + * + * @param command 검색 조건 + * @return 중복 개수 + */ + Integer getRecordExistCount(GetDailyPowerCmd command); + + /** + * 일계부 동력 사용시간 등록 + * + * @param command 등록 데이터 + */ + void createDailyPower(SaveDailyPowerCmd command); + + /** + * 일계부 동력 사용시간 수정 + * + * @param command 수정 데이터 + */ + void updateDailyPower(SaveDailyPowerCmd command); +} diff --git a/admin/src/main/java/app/module/admin/usecase/household/tab/dailyRecord/saveDailyPower/adapters/persistence/modal/GetDailyPowerDto.java b/admin/src/main/java/app/module/admin/usecase/household/tab/dailyRecord/saveDailyPower/adapters/persistence/modal/GetDailyPowerDto.java new file mode 100644 index 00000000..620e9d12 --- /dev/null +++ b/admin/src/main/java/app/module/admin/usecase/household/tab/dailyRecord/saveDailyPower/adapters/persistence/modal/GetDailyPowerDto.java @@ -0,0 +1,14 @@ +package app.module.admin.usecase.household.tab.dailyRecord.saveDailyPower.adapters.persistence.modal; + +import lombok.Getter; +import lombok.Setter; + +@Getter +@Setter +public class GetDailyPowerDto { + private Long id; + private Long dailyRecordSeq; + private String equipmentName; + private String ownedHours; + private String leasedHours; +} diff --git a/admin/src/main/java/app/module/admin/usecase/household/tab/dailyRecord/saveDailyPower/adapters/web/SaveDailyPowerController.java b/admin/src/main/java/app/module/admin/usecase/household/tab/dailyRecord/saveDailyPower/adapters/web/SaveDailyPowerController.java new file mode 100644 index 00000000..280f0311 --- /dev/null +++ b/admin/src/main/java/app/module/admin/usecase/household/tab/dailyRecord/saveDailyPower/adapters/web/SaveDailyPowerController.java @@ -0,0 +1,87 @@ +package app.module.admin.usecase.household.tab.dailyRecord.saveDailyPower.adapters.web; + +import app.module.admin.usecase.household.tab.dailyRecord.saveDailyPower.adapters.persistence.modal.GetDailyPowerDto; +import app.module.admin.usecase.household.tab.dailyRecord.saveDailyPower.adapters.web.model.DailyPowerUIReqVO; +import app.module.admin.usecase.household.tab.dailyRecord.saveDailyPower.adapters.web.model.SaveDailyPowerReqVO; +import app.module.admin.usecase.household.tab.dailyRecord.saveDailyPower.adapters.web.validator.SaveDailyPowerValidator; +import app.module.admin.usecase.household.tab.dailyRecord.saveDailyPower.ports.SaveDailyPowerPortIn; +import app.module.core.config.application.exception.NoRecordDataException; +import app.module.core.usecase.daily.record.adapters.persistence.model.DailyRecordDto; +import app.module.core.usecase.daily.record.ports.DailyRecordPortIn; +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.validation.BindingResult; +import org.springframework.web.bind.annotation.*; + +@Slf4j +@RestController +@RequiredArgsConstructor +@RequestMapping(path = "/api/household/daily/power") +public class SaveDailyPowerController { + private final DailyRecordPortIn dailyRecordPortIn; + private final SaveDailyPowerPortIn dailyPowerPortIn; + private final SaveDailyPowerValidator dailyPowerValidator; + + /** + * 일계부 동력 사용시간 조회 + * + * @param id 동력 사용시간 일련번호 + * @param reqVO 검색 조건 + */ + @GetMapping(path = "/{id}") + ResponseEntity detail(@PathVariable("id") String id, @ModelAttribute DailyPowerUIReqVO reqVO) { + + reqVO.setId(Long.parseLong(id)); + + GetDailyPowerDto detail = dailyPowerPortIn.detail(reqVO); + if (detail == null) { + return ResponseEntity.status(HttpStatus.BAD_REQUEST).body(null); + } + + return ResponseEntity.status(HttpStatus.OK).body(detail); + } + + /** + * 일계부 동력 사용시간 등록 처리 + * + * @param formVO 입력 데이터 + * @param bindingResult BindingResult + */ + @PostMapping(path = "/save") + ResponseEntity create(@Valid @RequestBody SaveDailyPowerReqVO formVO, BindingResult bindingResult) { + + dailyPowerValidator.validate(formVO, bindingResult); + if (bindingResult.hasErrors()) { + return ResponseEntity.status(HttpStatus.UNPROCESSABLE_ENTITY) + .body(bindingResult.getFieldErrors()); + } + + DailyRecordDto dailyRecord = this.vaildGetDailyRecord(formVO.getDailyId()); + + formVO.setSearchMonth(dailyRecord.getRecordMonth()); + formVO.setGroupNo(dailyRecord.getGroupNo()); + formVO.setDailyId(dailyRecord.getId()); + log.debug("formVO: {}", formVO); + + dailyPowerPortIn.create(formVO); + + return ResponseEntity.status(HttpStatus.OK).body(formVO); + } + + /** + * 일계부 유효성 체크 및 데이터 조회 + * + * @param dailyRecordSeq 항목 일련번호 + */ + private DailyRecordDto vaildGetDailyRecord(Long dailyRecordSeq) { + DailyRecordDto dailyRecord = dailyRecordPortIn.detail(dailyRecordSeq); + if (dailyRecord == null || dailyRecord.getId() == null) { + throw new NoRecordDataException(); + } + + return dailyRecord; + } +} diff --git a/admin/src/main/java/app/module/admin/usecase/household/tab/dailyRecord/saveDailyPower/adapters/web/model/DailyPowerUIReqVO.java b/admin/src/main/java/app/module/admin/usecase/household/tab/dailyRecord/saveDailyPower/adapters/web/model/DailyPowerUIReqVO.java new file mode 100644 index 00000000..60994999 --- /dev/null +++ b/admin/src/main/java/app/module/admin/usecase/household/tab/dailyRecord/saveDailyPower/adapters/web/model/DailyPowerUIReqVO.java @@ -0,0 +1,30 @@ +package app.module.admin.usecase.household.tab.dailyRecord.saveDailyPower.adapters.web.model; + +import lombok.Getter; +import lombok.Setter; + +@Getter +@Setter +public class DailyPowerUIReqVO { + /** + * 검색 월(yyyyMM) + */ + private String searchMonth; + /** + * 검색 그룸번호 + */ + private Integer groupNo; + /** + * 임가 일련번호 + */ + private Long householdSeq; + + /** + * 일계부 항목 일련번호 + */ + private Long dailyId; + /** + * 동력 사용시간 일련번호 + */ + private Long id; +} diff --git a/admin/src/main/java/app/module/admin/usecase/household/tab/dailyRecord/saveDailyPower/adapters/web/model/SaveDailyPowerReqVO.java b/admin/src/main/java/app/module/admin/usecase/household/tab/dailyRecord/saveDailyPower/adapters/web/model/SaveDailyPowerReqVO.java new file mode 100644 index 00000000..56c4c43b --- /dev/null +++ b/admin/src/main/java/app/module/admin/usecase/household/tab/dailyRecord/saveDailyPower/adapters/web/model/SaveDailyPowerReqVO.java @@ -0,0 +1,26 @@ +package app.module.admin.usecase.household.tab.dailyRecord.saveDailyPower.adapters.web.model; + +import app.module.admin.usecase.household.tab.dailyRecord.saveDailyPower.adapters.web.model.DailyPowerUIReqVO; +import jakarta.validation.constraints.NotBlank; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@Getter +@Setter +@ToString(callSuper = true) +public class SaveDailyPowerReqVO extends DailyPowerUIReqVO { + /** + * 명칭 + */ + @NotBlank(message = "명칭을 입력해 주세요.") + private String equipmentName; + /** + * 자가 사용시간 + */ + private Double ownedHours; + /** + * 임차 사용시간 + */ + private Double leasedHours; +} diff --git a/admin/src/main/java/app/module/admin/usecase/household/tab/dailyRecord/saveDailyPower/adapters/web/validator/SaveDailyPowerValidator.java b/admin/src/main/java/app/module/admin/usecase/household/tab/dailyRecord/saveDailyPower/adapters/web/validator/SaveDailyPowerValidator.java new file mode 100644 index 00000000..5a1d9f67 --- /dev/null +++ b/admin/src/main/java/app/module/admin/usecase/household/tab/dailyRecord/saveDailyPower/adapters/web/validator/SaveDailyPowerValidator.java @@ -0,0 +1,32 @@ +package app.module.admin.usecase.household.tab.dailyRecord.saveDailyPower.adapters.web.validator; + +import app.module.admin.usecase.household.tab.dailyRecord.saveDailyPower.adapters.web.model.SaveDailyPowerReqVO; +import app.module.core.config.constants.CommonConstants; +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 SaveDailyPowerValidator implements Validator { + @Override + public boolean supports(Class clazz) { + return SaveDailyPowerReqVO.class.equals(clazz); + } + + @Override + public void validate(Object target, Errors errors) { + SaveDailyPowerReqVO vo = (SaveDailyPowerReqVO) target; + + if (vo.getOwnedHours() == null && vo.getLeasedHours() == null) { + errors.rejectValue( + "ownedHours", "valid.common.required", + "자가 사용시간 또는 임차 사용시간을 입력해 주세요."); + errors.rejectValue( + "leasedHours", "valid.common.required", + "자가 사용시간 또는 임차 사용시간을 입력해 주세요."); + } + } +} diff --git a/admin/src/main/java/app/module/admin/usecase/household/tab/dailyRecord/saveDailyPower/ports/SaveDailyPowerPortIn.java b/admin/src/main/java/app/module/admin/usecase/household/tab/dailyRecord/saveDailyPower/ports/SaveDailyPowerPortIn.java new file mode 100644 index 00000000..2594a733 --- /dev/null +++ b/admin/src/main/java/app/module/admin/usecase/household/tab/dailyRecord/saveDailyPower/ports/SaveDailyPowerPortIn.java @@ -0,0 +1,22 @@ +package app.module.admin.usecase.household.tab.dailyRecord.saveDailyPower.ports; + +import app.module.admin.usecase.household.tab.dailyRecord.saveDailyPower.adapters.persistence.modal.GetDailyPowerDto; +import app.module.admin.usecase.household.tab.dailyRecord.saveDailyPower.adapters.web.model.DailyPowerUIReqVO; +import app.module.admin.usecase.household.tab.dailyRecord.saveDailyPower.adapters.web.model.SaveDailyPowerReqVO; + +public interface SaveDailyPowerPortIn { + /** + * 일계부 동력 사용시간 조회 + * + * @param reqVO 검색 조건 + * @return 동력 사용시간 상세 + */ + GetDailyPowerDto detail(DailyPowerUIReqVO reqVO); + + /** + * 일계부 동력 사용시간 등록 + * + * @param formVO 입력 데이터 + */ + void create(SaveDailyPowerReqVO formVO); +} diff --git a/admin/src/main/java/app/module/admin/usecase/household/tab/dailyRecord/saveDailyPower/ports/SaveDailyPowerPortOut.java b/admin/src/main/java/app/module/admin/usecase/household/tab/dailyRecord/saveDailyPower/ports/SaveDailyPowerPortOut.java new file mode 100644 index 00000000..3e1e0528 --- /dev/null +++ b/admin/src/main/java/app/module/admin/usecase/household/tab/dailyRecord/saveDailyPower/ports/SaveDailyPowerPortOut.java @@ -0,0 +1,23 @@ +package app.module.admin.usecase.household.tab.dailyRecord.saveDailyPower.ports; + +import app.module.admin.usecase.household.tab.dailyRecord.saveDailyPower.adapters.persistence.modal.GetDailyPowerDto; +import app.module.admin.usecase.household.tab.dailyRecord.saveDailyPower.ports.application.domain.GetDailyPowerCmd; +import app.module.admin.usecase.household.tab.dailyRecord.saveDailyPower.ports.application.domain.SaveDailyPowerCmd; + +public interface SaveDailyPowerPortOut { + /** + * 일계부 동력 사용시간 조회 + * + * @param command 검색 조건 + * @return 동력 사용시간 상세 + */ + GetDailyPowerDto detail(GetDailyPowerCmd command); + + /** + * 일계부 동력 사용시간 등록 + * + * @param findCmd 검색 조건 + * @param command 입력 데이터 + */ + void create(GetDailyPowerCmd findCmd, SaveDailyPowerCmd command); +} diff --git a/admin/src/main/java/app/module/admin/usecase/household/tab/dailyRecord/saveDailyPower/ports/application/SaveDailyPowerService.java b/admin/src/main/java/app/module/admin/usecase/household/tab/dailyRecord/saveDailyPower/ports/application/SaveDailyPowerService.java new file mode 100644 index 00000000..cdbcb7ec --- /dev/null +++ b/admin/src/main/java/app/module/admin/usecase/household/tab/dailyRecord/saveDailyPower/ports/application/SaveDailyPowerService.java @@ -0,0 +1,51 @@ +package app.module.admin.usecase.household.tab.dailyRecord.saveDailyPower.ports.application; + +import app.module.admin.usecase.household.tab.dailyRecord.saveDailyPower.adapters.persistence.modal.GetDailyPowerDto; +import app.module.admin.usecase.household.tab.dailyRecord.saveDailyPower.adapters.web.model.DailyPowerUIReqVO; +import app.module.admin.usecase.household.tab.dailyRecord.saveDailyPower.adapters.web.model.SaveDailyPowerReqVO; +import app.module.admin.usecase.household.tab.dailyRecord.saveDailyPower.ports.SaveDailyPowerPortIn; +import app.module.admin.usecase.household.tab.dailyRecord.saveDailyPower.ports.SaveDailyPowerPortOut; +import app.module.admin.usecase.household.tab.dailyRecord.saveDailyPower.ports.application.domain.GetDailyPowerCmd; +import app.module.admin.usecase.household.tab.dailyRecord.saveDailyPower.ports.application.domain.SaveDailyPowerCmd; +import app.module.core.usecase.daily.record.ports.DailyRecordPortIn; +import lombok.RequiredArgsConstructor; +import org.springframework.stereotype.Service; + +@Service +@RequiredArgsConstructor +public class SaveDailyPowerService implements SaveDailyPowerPortIn { + private final SaveDailyPowerPortOut portOut; + private final DailyRecordPortIn dailyRecordPortIn; + + @Override + public GetDailyPowerDto detail(DailyPowerUIReqVO reqVO) { + GetDailyPowerCmd findCmd = new GetDailyPowerCmd( + reqVO.getSearchMonth(), + reqVO.getGroupNo(), + reqVO.getHouseholdSeq(), + reqVO.getId()); + + return portOut.detail(findCmd); + } + + @Override + public void create(SaveDailyPowerReqVO formVO) { + GetDailyPowerCmd findCmd = new GetDailyPowerCmd( + formVO.getSearchMonth(), + formVO.getGroupNo(), + formVO.getHouseholdSeq(), + formVO.getId()); + + SaveDailyPowerCmd command = + new SaveDailyPowerCmd( + formVO.getId(), + formVO.getDailyId(), + formVO.getEquipmentName(), + formVO.getOwnedHours(), + formVO.getLeasedHours()); + + portOut.create(findCmd, command); + + dailyRecordPortIn.updateByAllStatus(findCmd.getSearchMonth(), findCmd.getGroupNo(), findCmd.getHouseholdSeq()); + } +} diff --git a/admin/src/main/java/app/module/admin/usecase/household/tab/dailyRecord/saveDailyPower/ports/application/domain/GetDailyPowerCmd.java b/admin/src/main/java/app/module/admin/usecase/household/tab/dailyRecord/saveDailyPower/ports/application/domain/GetDailyPowerCmd.java new file mode 100644 index 00000000..caa7611f --- /dev/null +++ b/admin/src/main/java/app/module/admin/usecase/household/tab/dailyRecord/saveDailyPower/ports/application/domain/GetDailyPowerCmd.java @@ -0,0 +1,27 @@ +package app.module.admin.usecase.household.tab.dailyRecord.saveDailyPower.ports.application.domain; + +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.Setter; + +@Getter +@Setter +@AllArgsConstructor +public class GetDailyPowerCmd { + /** + * 검색 월(yyyyMM) + */ + private String searchMonth; + /** + * 검색 그룸번호 + */ + private Integer groupNo; + /** + * 임가 일련번호 + */ + private Long householdSeq; + /** + * 동력 사용시간 일련번호 + */ + private Long id; +} diff --git a/admin/src/main/java/app/module/admin/usecase/household/tab/dailyRecord/saveDailyPower/ports/application/domain/SaveDailyPowerCmd.java b/admin/src/main/java/app/module/admin/usecase/household/tab/dailyRecord/saveDailyPower/ports/application/domain/SaveDailyPowerCmd.java new file mode 100644 index 00000000..36ca2f46 --- /dev/null +++ b/admin/src/main/java/app/module/admin/usecase/household/tab/dailyRecord/saveDailyPower/ports/application/domain/SaveDailyPowerCmd.java @@ -0,0 +1,19 @@ +package app.module.admin.usecase.household.tab.dailyRecord.saveDailyPower.ports.application.domain; + +import app.module.core.config.adapters.persistence.component.AuditCommand; +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@Getter +@Setter +@AllArgsConstructor +@ToString +public class SaveDailyPowerCmd extends AuditCommand { + private Long id; + private Long dailyRecordSeq; + private String equipmentName; + private Double ownedHours; + private Double leasedHours; +} diff --git a/admin/src/main/resources/mappers/household/daily/SaveDailyPowerMapper.xml b/admin/src/main/resources/mappers/household/daily/SaveDailyPowerMapper.xml new file mode 100644 index 00000000..edd89058 --- /dev/null +++ b/admin/src/main/resources/mappers/household/daily/SaveDailyPowerMapper.xml @@ -0,0 +1,49 @@ + + + + + + + + + + insert into daily_power ( + daily_record_seq + , equipment_name, owned_hours, leased_hours + , is_deleted + , + ) values ( + #{dailyRecordSeq} + , #{equipmentName}, #{ownedHours}, #{leasedHours} + , false + , + ) + + + + update daily_power set + , equipment_name = #{equipmentName} + , owned_hours = #{ownedHours} + , leased_hours = #{leasedHours} + where is_deleted = false + and daily_record_seq = #{dailyRecordSeq} + and id = #{id} + + + diff --git a/admin/src/main/resources/templates/households/modal/modal-daily-power.html b/admin/src/main/resources/templates/households/modal/modal-daily-power.html new file mode 100644 index 00000000..7fefeb03 --- /dev/null +++ b/admin/src/main/resources/templates/households/modal/modal-daily-power.html @@ -0,0 +1,177 @@ + + + +
+
+ + + + + + + +
+ + + + +
+ \ No newline at end of file diff --git a/admin/src/main/resources/templates/households/tab/daily-record.html b/admin/src/main/resources/templates/households/tab/daily-record.html index bed9acb9..d40a6534 100644 --- a/admin/src/main/resources/templates/households/tab/daily-record.html +++ b/admin/src/main/resources/templates/households/tab/daily-record.html @@ -639,7 +639,7 @@ - ${ifNullHyphen(item.equipmentName)} + ${ifNullHyphen(item.equipmentName)} ${ifNullHyphen(item.ownedHours)} ${ifNullHyphen(item.leasedHours)} @@ -814,6 +814,8 @@ showDailyWorkModal(); } else if (currentStep === 'EXPENSE') { showDailyExpenseModal(); + } else if (currentStep === 'POWER') { + showDailyPowerModal(); } else { alert('TODO : 추가'); } diff --git a/admin/src/main/resources/templates/households/{seq}.html b/admin/src/main/resources/templates/households/{seq}.html index b65ca452..2b2abc75 100644 --- a/admin/src/main/resources/templates/households/{seq}.html +++ b/admin/src/main/resources/templates/households/{seq}.html @@ -179,6 +179,7 @@ +