diff --git a/src/main/java/com/xit/biz/ctgy/controller/ResidentAndDisabledController.java b/src/main/java/com/xit/biz/ctgy/controller/ResidentAndDisabledController.java index 62bec2f..77d5950 100644 --- a/src/main/java/com/xit/biz/ctgy/controller/ResidentAndDisabledController.java +++ b/src/main/java/com/xit/biz/ctgy/controller/ResidentAndDisabledController.java @@ -193,4 +193,25 @@ public class ResidentAndDisabledController { AssertUtils.isTrue(!Checks.isEmpty(dto.getMsDatagb()), "데이타구분 값은 필수입니다(1-거주자,2-장애인)"); return RestResponse.of(service.findByUserJudges(dto)); } + + @Secured(policy = SecurityPolicy.TOKEN) + @Operation(summary = "거주자/장애인 의견진술 심의 결과 저장" , description = "거주자/장애인 의견진술 심의 결과 저장") + @Parameters({ + @Parameter(in = ParameterIn.QUERY, name = "msuCode", description = "심사코드", required = true, example = " "), + @Parameter(in = ParameterIn.QUERY, name = "msuResult", description = "심사결과코드", required = true, example = "1"), + @Parameter(in = ParameterIn.QUERY, name = "msuReason", description = "심사사유", required = true, example = " ") + }) + @PostMapping(value="/judge", produces = MediaType.APPLICATION_JSON_VALUE) + public ResponseEntity saveJudgeResult( + @Valid + @RequestBody + @Parameter(hidden = true) + final JudgeListDto dto) { + AssertUtils.isTrue(!Checks.isEmpty(dto), "필수 조건이 입력되지 않았습니다."); + AssertUtils.isTrue(!Checks.isEmpty(dto.getMsuCode()), "심사코드 값은 필수입니다(PK)"); + AssertUtils.isTrue(!Checks.isEmpty(dto.getMsuResult()), "심사결과는 필수입니다(1-수용,2-미수용)"); + AssertUtils.isTrue(!Checks.isEmpty(dto.getMsuReason()), "심의사유는 필수입니다"); + service.saveJudgeResult(dto); + return RestResponse.of(HttpStatus.OK); + } } diff --git a/src/main/java/com/xit/biz/ctgy/dto/JudgeListDto.java b/src/main/java/com/xit/biz/ctgy/dto/JudgeListDto.java index 8580ac2..e7359ea 100644 --- a/src/main/java/com/xit/biz/ctgy/dto/JudgeListDto.java +++ b/src/main/java/com/xit/biz/ctgy/dto/JudgeListDto.java @@ -53,4 +53,12 @@ public class JudgeListDto { private String msResult; @Schema(title = "심사자별 심사결과", example = " ", description = "심사자별 심사결과") private String msuResult; + @Schema(title = "심사자코드", example = " ", description = "심사자코드") + private Long msuCode; + @Schema(title = "심사자별 사유", example = " ", description = "심사자별 사유") + private String msuReason; + @Schema(title = "심사일", example = " ", description = "심사일") + private LocalDate msuIndate; + + } diff --git a/src/main/java/com/xit/biz/ctgy/repository/IJudgeUserRepository.java b/src/main/java/com/xit/biz/ctgy/repository/IJudgeUserRepository.java index 72cd965..88bd871 100644 --- a/src/main/java/com/xit/biz/ctgy/repository/IJudgeUserRepository.java +++ b/src/main/java/com/xit/biz/ctgy/repository/IJudgeUserRepository.java @@ -3,9 +3,20 @@ package com.xit.biz.ctgy.repository; import com.xit.biz.ctgy.entity.MinSimsaUser680Sc; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.jpa.repository.Modifying; +import org.springframework.data.jpa.repository.Query; +import org.springframework.data.repository.query.Param; + +import java.time.LocalDate; public interface IJudgeUserRepository extends JpaRepository { @Modifying int deleteByMsuMaincode(Long msMaincode); + + @Modifying + @Query(value = "UPDATE #{#entityName} m SET m.msuReason = :msuReason, m.msuResult = :msuResult, m.msuIndate = :msuIndate WHERE m.msuCode = :msuCode") + int updateMsuResonAndMsuResultByMsuCode(@Param("msuCode")Long msuCode, + @Param("msuResult")String msuResult, + @Param("msuReason")String msuReason, + @Param("msuIndate")LocalDate msuIndate); } diff --git a/src/main/java/com/xit/biz/ctgy/repository/IResidentAndDisabledRepositoryImpl.java b/src/main/java/com/xit/biz/ctgy/repository/IResidentAndDisabledRepositoryImpl.java index c3967d1..90bf13d 100644 --- a/src/main/java/com/xit/biz/ctgy/repository/IResidentAndDisabledRepositoryImpl.java +++ b/src/main/java/com/xit/biz/ctgy/repository/IResidentAndDisabledRepositoryImpl.java @@ -343,7 +343,8 @@ public class IResidentAndDisabledRepositoryImpl implements IResidentAndDisabledR minSimsa680Sc.msEdate, minSimsa680Sc.msCdate, minSimsa680Sc.msClosesi, - minSimsa680Sc.msDatagb + minSimsa680Sc.msDatagb, + minSimsaUser680Sc.msuCode )) .from(minSimsa680Sc) .join(minSimsaUser680Sc) diff --git a/src/main/java/com/xit/biz/ctgy/service/IResidentAndDisabledService.java b/src/main/java/com/xit/biz/ctgy/service/IResidentAndDisabledService.java index 8f05875..bff4dcb 100644 --- a/src/main/java/com/xit/biz/ctgy/service/IResidentAndDisabledService.java +++ b/src/main/java/com/xit/biz/ctgy/service/IResidentAndDisabledService.java @@ -82,4 +82,6 @@ public interface IResidentAndDisabledService { //--------------------------------------------------------------------------------- List findByUserJudges(JudgeListDto dto); + void saveJudgeResult(JudgeListDto dto); + } diff --git a/src/main/java/com/xit/biz/ctgy/service/impl/ResidentAndDisabledService.java b/src/main/java/com/xit/biz/ctgy/service/impl/ResidentAndDisabledService.java index 83e5cf8..39e812a 100644 --- a/src/main/java/com/xit/biz/ctgy/service/impl/ResidentAndDisabledService.java +++ b/src/main/java/com/xit/biz/ctgy/service/impl/ResidentAndDisabledService.java @@ -35,6 +35,9 @@ import javax.persistence.EntityManager; import javax.validation.constraints.NotNull; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; +import java.time.LocalDate; +import java.time.LocalDateTime; +import java.time.format.DateTimeFormatter; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -289,4 +292,13 @@ public class ResidentAndDisabledService implements IResidentAndDisabledService { public List findByUserJudges(JudgeListDto dto) { return gnReacallRepository.findByUserJudges(dto); } + + @Override + @Transactional + public void saveJudgeResult(JudgeListDto dto){ + judgeUserRepository.updateMsuResonAndMsuResultByMsuCode(dto.getMsuCode(), + dto.getMsuResult(), + dto.getMsuReason(), + LocalDate.parse(LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd")))); + } }