From 0afc804e2ce9441c7ea4fd174ee90fe0336bd587 Mon Sep 17 00:00:00 2001 From: minuk926 Date: Wed, 20 Apr 2022 20:24:20 +0900 Subject: [PATCH] =?UTF-8?q?feat:=20=EA=B2=8C=EC=8B=9C=ED=8C=90=20=EA=B4=80?= =?UTF-8?q?=EB=A6=AC=20=EB=B0=98=EC=98=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../cmm/repository/ICmmCodeLRepostory.java | 2 +- .../cmm/repository/ICmmCodeMRepository.java | 2 +- .../cmm/repository/ICmmCodeSRepository.java | 4 +- .../ctgy/controller/ParkingController.java | 40 ++++------------ .../ResidentAndDisabledController.java | 9 ++++ .../xit/biz/ctgy/entity/MinSimsaUser680.java | 24 ++++------ .../biz/ctgy/repository/IBoardRepository.java | 5 +- .../biz/ctgy/repository/IJudgeRepository.java | 17 +++++++ .../ctgy/repository/IJudgeUserRepository.java | 4 ++ .../IParkingJudgeUserRepository.java | 5 ++ .../ctgy/repository/IParkingRepository.java | 9 ++++ .../ctgy/repository/IRecallRepository.java | 7 +++ .../IResidentAndDisabledRepository.java | 7 +++ .../xit/biz/ctgy/service/IParkingService.java | 2 + .../service/IResidentAndDisabledService.java | 2 + .../biz/ctgy/service/impl/ParkingService.java | 32 ++++++++----- .../impl/ResidentAndDisabledService.java | 46 ++++++++++++++----- src/main/resources/config/application-dev.yml | 14 +++--- 18 files changed, 147 insertions(+), 84 deletions(-) create mode 100644 src/main/java/com/xit/biz/ctgy/repository/IJudgeRepository.java diff --git a/src/main/java/com/xit/biz/cmm/repository/ICmmCodeLRepostory.java b/src/main/java/com/xit/biz/cmm/repository/ICmmCodeLRepostory.java index 5cde4eb..3b512bc 100644 --- a/src/main/java/com/xit/biz/cmm/repository/ICmmCodeLRepostory.java +++ b/src/main/java/com/xit/biz/cmm/repository/ICmmCodeLRepostory.java @@ -13,6 +13,6 @@ import org.springframework.data.repository.query.Param; import java.util.List; public interface ICmmCodeLRepostory extends JpaRepository, JpaSpecificationExecutor { - @Query(value = "select new com.xit.biz.cmm.dto.ComboCodeDto(c.codeCd, c.codeNm) from #{#entityName} c where c.codeGrpId = :codeGrpId and c.useYn = 'Y' order by c.codeOrdr asc") + @Query(value = "SELECT new com.xit.biz.cmm.dto.ComboCodeDto(c.codeCd, c.codeNm) FROM #{#entityName} c WHERE c.codeGrpId = :codeGrpId AND c.useYn = 'Y' ORDER BY c.codeOrdr ASC") List queryComboCode(@Param("codeGrpId") String codeGrpId); } diff --git a/src/main/java/com/xit/biz/cmm/repository/ICmmCodeMRepository.java b/src/main/java/com/xit/biz/cmm/repository/ICmmCodeMRepository.java index 456d959..e3eda13 100644 --- a/src/main/java/com/xit/biz/cmm/repository/ICmmCodeMRepository.java +++ b/src/main/java/com/xit/biz/cmm/repository/ICmmCodeMRepository.java @@ -12,6 +12,6 @@ import org.springframework.data.repository.query.Param; import java.util.List; public interface ICmmCodeMRepository extends JpaRepository, JpaSpecificationExecutor { - @Query(value = "select new com.xit.biz.cmm.dto.ComboCodeDto(c.codeCd, c.codeNm) from #{#entityName} c where c.codeGrpId = :codeGrpId and c.codeLcd = :codeLcd and c.useYn = 'Y' order by c.codeOrdr asc") + @Query(value = "SELECT new com.xit.biz.cmm.dto.ComboCodeDto(c.codeCd, c.codeNm) FROM #{#entityName} c WHERE c.codeGrpId = :codeGrpId AND c.codeLcd = :codeLcd AND c.useYn = 'Y' ORDER BY c.codeOrdr ASC") List queryComboCode(@Param("codeGrpId")String codeGrpId, @Param("codeLcd")String codeLcd); } diff --git a/src/main/java/com/xit/biz/cmm/repository/ICmmCodeSRepository.java b/src/main/java/com/xit/biz/cmm/repository/ICmmCodeSRepository.java index f3291ed..24f78a3 100644 --- a/src/main/java/com/xit/biz/cmm/repository/ICmmCodeSRepository.java +++ b/src/main/java/com/xit/biz/cmm/repository/ICmmCodeSRepository.java @@ -13,9 +13,9 @@ import org.springframework.data.repository.query.Param; import java.util.List; public interface ICmmCodeSRepository extends JpaRepository, JpaSpecificationExecutor { - @Query(value = "select c.codeCd as code, c.codeNm as value from #{#entityName} c where c.codeGrpId = :codeGrpId and c.codeLcd = :codeLcd and c.codeMcd = :codeMcd and c.useYn = 'Y' order by c.codeOrdr asc") + @Query(value = "SELECT c.codeCd AS code, c.codeNm AS value FROM #{#entityName} c WHERE c.codeGrpId = :codeGrpId AND c.codeLcd = :codeLcd AND c.codeMcd = :codeMcd AND c.useYn = 'Y' ORDER BY c.codeOrdr ASC") List queryComboCodeInterface(@Param("codeGrpId")String codeGrpId, @Param("codeLcd")String codeLcd, @Param("codeMcd")String codeMcd); - @Query(value = "select new com.xit.biz.cmm.dto.ComboCodeDto(c.codeCd, c.codeNm) from #{#entityName} c where c.codeGrpId = :codeGrpId and c.codeLcd = :codeLcd and c.codeMcd = :codeMcd and c.useYn = 'Y' order by c.codeOrdr asc") + @Query(value = "SELECT new com.xit.biz.cmm.dto.ComboCodeDto(c.codeCd, c.codeNm) FROM #{#entityName} c WHERE c.codeGrpId = :codeGrpId AND c.codeLcd = :codeLcd AND c.codeMcd = :codeMcd AND c.useYn = 'Y' ORDER BY c.codeOrdr ASC") List queryComboCodeClass(@Param("codeGrpId")String codeGrpId, @Param("codeLcd")String codeLcd, @Param("codeMcd")String codeMcd); } diff --git a/src/main/java/com/xit/biz/ctgy/controller/ParkingController.java b/src/main/java/com/xit/biz/ctgy/controller/ParkingController.java index 057d7c0..7f62fca 100644 --- a/src/main/java/com/xit/biz/ctgy/controller/ParkingController.java +++ b/src/main/java/com/xit/biz/ctgy/controller/ParkingController.java @@ -86,40 +86,18 @@ public class ParkingController { @RequestBody final ParkingTargetDto dto) { service.saveParkingJudgeTargets(dto); - //service.saveParkingSimsaJudgeTargets(dto); return RestResponse.of(HttpStatus.OK); } -// @Operation(summary = "주정차 의견진술 심의등록" , description = "주정차 의견진술 심의등록") -// @Parameters({ -// @Parameter(in = ParameterIn.QUERY, name = "msSdate", description = "심사시작일", required = true, example = "2021-01-04"), -// @Parameter(in = ParameterIn.QUERY, name = "msEdate", description = "심사종료일", required = true, example = "2021-01-05"), -// @Parameter(in = ParameterIn.QUERY, name = "msChasu", description = "차수", required = false, example = "3"), -// @Parameter(in = ParameterIn.QUERY, name = "msuTeam", description = "팀코드", required = true, example = "002") -// }) -// @PostMapping(produces = MediaType.APPLICATION_JSON_VALUE) -// public ResponseEntity saveParking( -// @Valid -// @Parameter(hidden = true) -// final MinSimsa680Dto dto) { -// return RestResponse.of(service.saveParking(mapstruct.toEntity(dto))); -// } - - // TODO :: 파라메터 정의 필요 -// @Operation(summary = "심사(대상)자 조회" , description = "심사(대상)자 조회") -// @Parameters({ -// @Parameter(in = ParameterIn.QUERY, name = "page", description = "페이지", required = true, example = "0"), -// @Parameter(in = ParameterIn.QUERY, name = "size", description = "페이지당갯수", required = true, example = "10") -// }) -// @GetMapping(produces = MediaType.APPLICATION_JSON_VALUE) -//// @Transactional(readOnly = true) -// public ResponseEntity findMinSimsa680s( -// @Parameter(hidden = true) -// final MinSimsa680Dto minSimsa680Dto, -// @Parameter(hidden = true) -// final Pageable pageable) { -// return RestResponse.of(service.findMinSimsa680s2(mapstruct.toEntity(minSimsa680Dto), pageable)); -// } + @Operation(summary = "주정차 의견진술 심의 자료 삭제" , description = "주정차 의견진술 심의 자료 삭제") + @PostMapping(value="/remove", produces = MediaType.APPLICATION_JSON_VALUE) + public ResponseEntity removeParkinJudge( + @Valid + @RequestBody + final ParkingTargetDto dto) { + service.removeParkingJudge(dto); + return RestResponse.of(HttpStatus.OK); + } } 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 193d6c4..7118971 100644 --- a/src/main/java/com/xit/biz/ctgy/controller/ResidentAndDisabledController.java +++ b/src/main/java/com/xit/biz/ctgy/controller/ResidentAndDisabledController.java @@ -145,4 +145,13 @@ public class ResidentAndDisabledController { return RestResponse.of(service.findJudgeResults(dto)); } + @Operation(summary = "거주자/장애인 의견진술 심의 자료 삭제" , description = "거주자/장애인 의견진술 심의 자료 삭제") + @PostMapping(value="/remove", produces = MediaType.APPLICATION_JSON_VALUE) + public ResponseEntity removeParkinJudge( + @Valid + @RequestBody + final JudgeListDto dto) { + service.removeJudge(dto); + return RestResponse.of(HttpStatus.OK); + } } diff --git a/src/main/java/com/xit/biz/ctgy/entity/MinSimsaUser680.java b/src/main/java/com/xit/biz/ctgy/entity/MinSimsaUser680.java index 57b5dd0..097e42b 100644 --- a/src/main/java/com/xit/biz/ctgy/entity/MinSimsaUser680.java +++ b/src/main/java/com/xit/biz/ctgy/entity/MinSimsaUser680.java @@ -8,6 +8,8 @@ import org.hibernate.annotations.DynamicUpdate; import javax.persistence.*; import java.io.Serializable; import java.time.LocalDate; +import java.time.LocalDateTime; +import java.time.format.DateTimeFormatter; @Schema(name = "MinSimsaUser680", description = "민원심사사용자매핑") @Table(name = "min_simsa_user680", schema = "", catalog = "") @@ -56,19 +58,11 @@ public class MinSimsaUser680 implements Serializable { @Column(name = "msu_indate", nullable = true) private LocalDate msuIndate; - - - - - - //@JsonIgnore -// @Setter -// @ManyToOne(fetch = FetchType.LAZY) -// @JoinColumn(name = "msu_userid") -// private MinUserinfo minUserinfo; -// -// @Setter -// @ManyToOne(fetch = FetchType.LAZY) -// @JoinColumn(name = "msu_maincode") -// private MinSimsa680 minSimsa680; +/* + @PrePersist + public void onPrePersist(){ + LocalDateTime localDateTime = LocalDateTime.now(); + this.msuIndate = LocalDate.parse(localDateTime.format(DateTimeFormatter.ofPattern("yyyy-MM-dd"))); + } +*/ } diff --git a/src/main/java/com/xit/biz/ctgy/repository/IBoardRepository.java b/src/main/java/com/xit/biz/ctgy/repository/IBoardRepository.java index 1aa63b9..8b36488 100644 --- a/src/main/java/com/xit/biz/ctgy/repository/IBoardRepository.java +++ b/src/main/java/com/xit/biz/ctgy/repository/IBoardRepository.java @@ -1,10 +1,6 @@ package com.xit.biz.ctgy.repository; -import com.xit.biz.cmm.entity.CmmUser; import com.xit.biz.ctgy.entity.MinCivBoard680; -import org.springframework.data.domain.Example; -import org.springframework.data.domain.Page; -import org.springframework.data.domain.Pageable; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.jpa.repository.Modifying; import org.springframework.data.jpa.repository.Query; @@ -13,6 +9,7 @@ public interface IBoardRepository extends JpaRepository, I @Query(value = "SELECT max(e.ci_code) + 1 FROM min_civ_board680 e", nativeQuery = true) Long getCiCode(); + @Modifying(clearAutomatically = true) @Query("UPDATE MinCivBoard680 m SET m.ciHit = m.ciHit + 1 WHERE m.ciCode = :ciCode") int updateInHitForMinCivBoard680(Long ciCode); diff --git a/src/main/java/com/xit/biz/ctgy/repository/IJudgeRepository.java b/src/main/java/com/xit/biz/ctgy/repository/IJudgeRepository.java new file mode 100644 index 0000000..0de4b8e --- /dev/null +++ b/src/main/java/com/xit/biz/ctgy/repository/IJudgeRepository.java @@ -0,0 +1,17 @@ +package com.xit.biz.ctgy.repository; + +import com.xit.biz.ctgy.entity.MinSimsa680Sc; +import com.xit.biz.ctgy.entity.Tf680Recall; +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; +import java.util.List; + +public interface IJudgeRepository extends JpaRepository { + + @Query(value = "SELECT e.msMaincode FROM #{#entityName} e WHERE e.msDatagb = :msDatagb AND e.msChasu = :msChasu AND e.msSdate >= :msSdate AND e.msEdate <= :msEdate") + List findAllMsMaincode(@Param("msDatagb") String msDatagb, @Param("msChasu") Long msChasu, @Param("msSdate") LocalDate msSdate, @Param("msEdate")LocalDate msEdate); +} 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 317806e..72cd965 100644 --- a/src/main/java/com/xit/biz/ctgy/repository/IJudgeUserRepository.java +++ b/src/main/java/com/xit/biz/ctgy/repository/IJudgeUserRepository.java @@ -2,6 +2,10 @@ 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; public interface IJudgeUserRepository extends JpaRepository { + + @Modifying + int deleteByMsuMaincode(Long msMaincode); } diff --git a/src/main/java/com/xit/biz/ctgy/repository/IParkingJudgeUserRepository.java b/src/main/java/com/xit/biz/ctgy/repository/IParkingJudgeUserRepository.java index cb48879..77ac3b3 100644 --- a/src/main/java/com/xit/biz/ctgy/repository/IParkingJudgeUserRepository.java +++ b/src/main/java/com/xit/biz/ctgy/repository/IParkingJudgeUserRepository.java @@ -2,6 +2,11 @@ package com.xit.biz.ctgy.repository; import com.xit.biz.ctgy.entity.MinSimsaUser680; import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.jpa.repository.Modifying; +import org.springframework.transaction.annotation.Transactional; public interface IParkingJudgeUserRepository extends JpaRepository { + + @Modifying + int deleteByMsuMaincode(Long maincode); } diff --git a/src/main/java/com/xit/biz/ctgy/repository/IParkingRepository.java b/src/main/java/com/xit/biz/ctgy/repository/IParkingRepository.java index aab5aa7..4d75a02 100644 --- a/src/main/java/com/xit/biz/ctgy/repository/IParkingRepository.java +++ b/src/main/java/com/xit/biz/ctgy/repository/IParkingRepository.java @@ -2,6 +2,15 @@ package com.xit.biz.ctgy.repository; import com.xit.biz.ctgy.entity.MinSimsa680; import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.jpa.repository.Query; +import org.springframework.data.repository.query.Param; + +import java.time.LocalDate; +import java.util.List; public interface IParkingRepository extends JpaRepository, IParkingRepositoryCustom { + + @Query(value = "SELECT e.msMaincode FROM #{#entityName} e WHERE e.msChasu = :msChasu AND e.msSdate >= :msSdate AND e.msEdate <= :msEdate") + List findAllMsMaincode(@Param("msChasu") Long msChasu, @Param("msSdate")LocalDate msSdate, @Param("msEdate")LocalDate msEdate); + } diff --git a/src/main/java/com/xit/biz/ctgy/repository/IRecallRepository.java b/src/main/java/com/xit/biz/ctgy/repository/IRecallRepository.java index 6fa81b4..76f83d6 100644 --- a/src/main/java/com/xit/biz/ctgy/repository/IRecallRepository.java +++ b/src/main/java/com/xit/biz/ctgy/repository/IRecallRepository.java @@ -2,6 +2,13 @@ package com.xit.biz.ctgy.repository; import com.xit.biz.ctgy.entity.Tf680Recall; 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; public interface IRecallRepository extends JpaRepository { + + @Modifying + @Query(value = "UPDATE #{#entityName} m SET m.rcIrTransfer = '1' WHERE m.rcCode = :msMaincode") + int updateRcIrTransfer(@Param("msMaincode")Long msMaincode); } diff --git a/src/main/java/com/xit/biz/ctgy/repository/IResidentAndDisabledRepository.java b/src/main/java/com/xit/biz/ctgy/repository/IResidentAndDisabledRepository.java index de1ee54..439314e 100644 --- a/src/main/java/com/xit/biz/ctgy/repository/IResidentAndDisabledRepository.java +++ b/src/main/java/com/xit/biz/ctgy/repository/IResidentAndDisabledRepository.java @@ -2,8 +2,10 @@ package com.xit.biz.ctgy.repository; import com.xit.biz.ctgy.entity.GnRecallSc; 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 org.springframework.transaction.annotation.Transactional; /** * 거주자 / 장애인 의견 진술 @@ -30,4 +32,9 @@ public interface IResidentAndDisabledRepository extends JpaRepository findMinSimsa680s2(final MinSimsa680 minSimsa680, Pageable pageable); // MinSimsa680 saveParking(final MinSimsa680 toEntity); 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 faf677c..c56611c 100644 --- a/src/main/java/com/xit/biz/ctgy/service/IResidentAndDisabledService.java +++ b/src/main/java/com/xit/biz/ctgy/service/IResidentAndDisabledService.java @@ -69,4 +69,6 @@ public interface IResidentAndDisabledService { * @param dto JudgeTargetDto */ void saveJudgeTargets(JudgeTargetDto dto); + + void removeJudge(final JudgeListDto dto); } diff --git a/src/main/java/com/xit/biz/ctgy/service/impl/ParkingService.java b/src/main/java/com/xit/biz/ctgy/service/impl/ParkingService.java index 6acffaa..6386de9 100644 --- a/src/main/java/com/xit/biz/ctgy/service/impl/ParkingService.java +++ b/src/main/java/com/xit/biz/ctgy/service/impl/ParkingService.java @@ -158,15 +158,25 @@ public class ParkingService implements IParkingService { } -// @Override -// @Transactional(readOnly = true) -// public Page findMinSimsa680s2(MinSimsa680 minSimsa680, Pageable pageable) { -// return simsaRepository.findMinSimsa680s2(pageable); -// } -// -// @Override -// @Transactional -// public MinSimsa680 saveParking(MinSimsa680 entity) { -// return simsaRepository.saveAndFlush(entity); -// } + /** + * 심사자료 삭제 + * 1. 삭제 대상 조회 : min_simsa680 테이블 : ms_chasu, ms_sdate, ms_edate 조건으로 ms_maincode 삭제 대상 조회 + * 2. 심사자 삭제 : min_simsa_user680 테이블 : msu_maincode = ms_maincode + * 3. 단속데이타 정보 변경 : tf680_recall 테이블 : rc_ir_transfer = '1', rc_code = ms_maincode + * 4. 심사자료 삭제 : min_simsa680 테이블 ms_maincode = ms_maincode + * @param dto ParkingTargetDto + */ + @Override + @Transactional + public void removeParkingJudge(final ParkingTargetDto dto) { + + List msMaincodes = repository.findAllMsMaincode(dto.getMsChasu(), dto.getMsSdate(), dto.getMsEdate()); + + msMaincodes.forEach(msMaincode -> { + parkingJudgeUserRepository.deleteByMsuMaincode(msMaincode); + recallRepository.updateRcIrTransfer(msMaincode); + repository.deleteById(msMaincode); + }); + } + } 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 d8983bb..61fbe44 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 @@ -8,6 +8,7 @@ import com.xit.biz.ctgy.dto.JudgeTargetDto; import com.xit.biz.ctgy.dto.struct.GnRecallScMapstruct; import com.xit.biz.ctgy.entity.*; import com.xit.biz.ctgy.mapper.IResidentAndDisabledMapper; +import com.xit.biz.ctgy.repository.IJudgeRepository; import com.xit.biz.ctgy.repository.IJudgeUserRepository; import com.xit.biz.ctgy.repository.IMinUserRepository; import com.xit.biz.ctgy.repository.IResidentAndDisabledRepository; @@ -53,16 +54,15 @@ public class ResidentAndDisabledService implements IResidentAndDisabledService { @Value("${file.cmm.upload.simsaPath:[simUpFile_sc1]}") private String[] uploadPath; - private final IResidentAndDisabledRepository repository; private final GnRecallScMapstruct mapstruct = Mappers.getMapper(GnRecallScMapstruct.class); - - private final ICmmFileService fileService; - + private final IResidentAndDisabledRepository gnReacallRepository; private final IMinUserRepository userRepository; private final IJudgeUserRepository judgeUserRepository; + private final IJudgeRepository judgeRepository; private final IResidentAndDisabledMapper residentAndDisabledMapper; + private final ICmmFileService fileService; private final EntityManager entityManager; @Override @@ -70,7 +70,7 @@ public class ResidentAndDisabledService implements IResidentAndDisabledService { public Page findJudgeDatas(@NotNull final String scDatagb, Pageable pageable) { // Sort sort = Sort.by(Sort.Direction.DESC, "inCode"); pageable = JpaUtil.getPagingInfo(pageable); - return repository.findJudgeDatas( + return gnReacallRepository.findJudgeDatas( scDatagb, PageRequest.of(pageable.getPageNumber(), pageable.getPageSize(), Sort.by("scCode").descending())); // List userList = page.getContent(); @@ -79,7 +79,7 @@ public class ResidentAndDisabledService implements IResidentAndDisabledService { @Override @Transactional(readOnly = true) public GnRecallScDto findJudgeData(final Long scCode) { - return repository.findJudgeData(scCode); + return gnReacallRepository.findJudgeData(scCode); } @Override @@ -99,9 +99,9 @@ public class ResidentAndDisabledService implements IResidentAndDisabledService { } // 접수번호 채번 : 년도 + seq 10자리 - dto.setScSeq(repository.getGnRecallScMaxScSeq(String.valueOf(DateUtil.getCurrentYear()), CtgyConstants.Judge.DATAGB_RESIDENT.getCode())); + dto.setScSeq(gnReacallRepository.getGnRecallScMaxScSeq(String.valueOf(DateUtil.getCurrentYear()), CtgyConstants.Judge.DATAGB_RESIDENT.getCode())); GnRecallSc entity = mapstruct.toEntity(dto); - repository.save(entity); + gnReacallRepository.save(entity); } @@ -123,7 +123,7 @@ public class ResidentAndDisabledService implements IResidentAndDisabledService { @Override @Transactional(readOnly = true) public List findJudgeTargets(JudgeTargetDto dto) { - return repository.findJudgeTargets(dto); + return gnReacallRepository.findJudgeTargets(dto); } @Override @@ -148,11 +148,11 @@ public class ResidentAndDisabledService implements IResidentAndDisabledService { //--------------------------------------------------------- // 등록한 심사대상 데이타 등록 상태 변경 : 미접수 -> 접수 //--------------------------------------------------------- - GnRecallSc entity = repository.findById(dto.getScCode()).orElseThrow(() -> new CustomBaseException(ErrorCode.DATA_NOT_FOUND)); + GnRecallSc entity = gnReacallRepository.findById(dto.getScCode()).orElseThrow(() -> new CustomBaseException(ErrorCode.DATA_NOT_FOUND)); entity.setScTransfer(CtgyConstants.Judge.TRANSFER_ACCEPT.getCode()); //entity.setScState(CtgyConstants.Judge.DATA_STATE_JUDGE.getCode()); //JpaUtil.saveIfNullId(dto.getScCode(), repository, entity); - repository.save(entity); + gnReacallRepository.save(entity); //--------------------------------------------------------- // 심사자 등록 @@ -180,7 +180,7 @@ public class ResidentAndDisabledService implements IResidentAndDisabledService { public Page findJudges(JudgeListDto dto, Pageable pageable) { pageable = JpaUtil.getPagingInfo(pageable); - return repository.findJudges(dto, pageable); + return gnReacallRepository.findJudges(dto, pageable); } @Override @@ -232,4 +232,26 @@ public class ResidentAndDisabledService implements IResidentAndDisabledService { resultMap.put("judgeUserData", jurgeUserList); return resultMap; } + + /** + * 심사자료 삭제 + * 1. 삭제 대상 조회 : min_simsa680_sc 테이블 : ms_datagb, ms_chasu, ms_sdate, ms_edate 조건으로 ms_maincode 삭제 대상 조회 + * 2. 심사자 삭제 : min_simsa_user680_sc 테이블 : msu_maincode = ms_maincode + * 3. 단속데이타 정보 변경 : gn_recall_sc 테이블 : sc_transfer = '1', sc_state = '1', sc_code = ms_maincode + * 4. 심사자료 삭제 : min_simsa680_sc 테이블 ms_maincode = ms_maincode + * @param dto ParkingTargetDto + */ + @Override + @Transactional + public void removeJudge(final JudgeListDto dto) { + + List msMaincodes = judgeRepository.findAllMsMaincode(dto.getMsDatagb(), dto.getMsChasu(), dto.getMsSdate(), dto.getMsEdate()); + + msMaincodes.forEach(msMaincode -> { + //List judgeUsers = judgeUserRepository.findByMsuMaincode() + judgeUserRepository.deleteByMsuMaincode(msMaincode); + gnReacallRepository.updateScTransferAndScState(dto.getMsDatagb(), msMaincode); + judgeRepository.deleteById(msMaincode); + }); + } } diff --git a/src/main/resources/config/application-dev.yml b/src/main/resources/config/application-dev.yml index c027bdf..15e695f 100644 --- a/src/main/resources/config/application-dev.yml +++ b/src/main/resources/config/application-dev.yml @@ -59,13 +59,13 @@ logging: orm: jpa: TRACE # hibernate sql log 출력시 변수 바인딩 - hibernate: - SQL: - debug - type: - descriptor: - sql: - BasicBinder: debug + #hibernate: + # SQL: + # debug + # type: + # descriptor: + # sql: + # BasicBinder: debug # ==================================================================================================================