From 571811aa41527b283729d1a7b63a41ceb0ba6df7 Mon Sep 17 00:00:00 2001 From: Lim Jonguk Date: Sat, 9 Apr 2022 04:35:55 +0900 Subject: [PATCH] =?UTF-8?q?refactor:=20=EA=B1=B0=EC=A3=BC=EC=9E=90/?= =?UTF-8?q?=EC=9E=A5=EC=95=A0=EC=9D=B8=20=EC=9D=98=EA=B2=AC=EC=A7=84?= =?UTF-8?q?=EC=88=A0=20=EC=8B=AC=EC=9D=98=20=EB=AA=A8=EB=91=98=20=EA=B3=B5?= =?UTF-8?q?=ED=86=B5=ED=99=94=20=EC=A7=84=ED=96=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...ava => ResidentAndDisabledController.java} | 56 ++++---- .../com/xit/biz/ctgy/dto/GnRecallScDto.java | 26 ++-- ...dentTargetDto.java => JudgeTargetDto.java} | 5 +- .../com/xit/biz/ctgy/dto/ResidentDto.java | 126 ------------------ .../mapper/IResidentAndDisabledMapper.java | 11 ++ .../xit/biz/ctgy/mapper/IResidentMapper.java | 11 -- ...va => IResidentAndDisabledRepository.java} | 19 ++- .../IResidentAndDisabledRepositoryCustom.java | 47 +++++++ ...> IResidentAndDisabledRepositoryImpl.java} | 26 ++-- .../repository/IResidentRepositoryCustom.java | 20 --- .../service/IResidentAndDisabledService.java | 58 ++++++++ .../biz/ctgy/service/IResidentService.java | 25 ---- ...e.java => ResidentAndDisabledService.java} | 68 ++++------ ...per.xml => residentanddisabled-mapper.xml} | 6 +- 14 files changed, 225 insertions(+), 279 deletions(-) rename src/main/java/com/xit/biz/ctgy/controller/{ResidentController.java => ResidentAndDisabledController.java} (64%) rename src/main/java/com/xit/biz/ctgy/dto/{ResidentTargetDto.java => JudgeTargetDto.java} (96%) delete mode 100644 src/main/java/com/xit/biz/ctgy/dto/ResidentDto.java create mode 100644 src/main/java/com/xit/biz/ctgy/mapper/IResidentAndDisabledMapper.java delete mode 100644 src/main/java/com/xit/biz/ctgy/mapper/IResidentMapper.java rename src/main/java/com/xit/biz/ctgy/repository/{IResidentRepository.java => IResidentAndDisabledRepository.java} (62%) create mode 100644 src/main/java/com/xit/biz/ctgy/repository/IResidentAndDisabledRepositoryCustom.java rename src/main/java/com/xit/biz/ctgy/repository/{IResidentRepositoryImpl.java => IResidentAndDisabledRepositoryImpl.java} (93%) delete mode 100644 src/main/java/com/xit/biz/ctgy/repository/IResidentRepositoryCustom.java create mode 100644 src/main/java/com/xit/biz/ctgy/service/IResidentAndDisabledService.java delete mode 100644 src/main/java/com/xit/biz/ctgy/service/IResidentService.java rename src/main/java/com/xit/biz/ctgy/service/impl/{ResidentService.java => ResidentAndDisabledService.java} (70%) rename src/main/resources/mybatis-mapper/biz/ctgy/{resident-mapper.xml => residentanddisabled-mapper.xml} (80%) diff --git a/src/main/java/com/xit/biz/ctgy/controller/ResidentController.java b/src/main/java/com/xit/biz/ctgy/controller/ResidentAndDisabledController.java similarity index 64% rename from src/main/java/com/xit/biz/ctgy/controller/ResidentController.java rename to src/main/java/com/xit/biz/ctgy/controller/ResidentAndDisabledController.java index 7d61fd0..49bb9de 100644 --- a/src/main/java/com/xit/biz/ctgy/controller/ResidentController.java +++ b/src/main/java/com/xit/biz/ctgy/controller/ResidentAndDisabledController.java @@ -1,10 +1,10 @@ package com.xit.biz.ctgy.controller; import com.xit.biz.ctgy.dto.GnRecallScDto; -import com.xit.biz.ctgy.dto.ResidentTargetDto; import com.xit.biz.ctgy.dto.JudgeListDto; +import com.xit.biz.ctgy.dto.JudgeTargetDto; import com.xit.biz.ctgy.dto.struct.GnRecallScMapstruct; -import com.xit.biz.ctgy.service.IResidentService; +import com.xit.biz.ctgy.service.IResidentAndDisabledService; import com.xit.core.api.IRestResponse; import com.xit.core.api.RestResponse; import com.xit.core.util.AssertUtils; @@ -26,51 +26,55 @@ import org.springframework.web.bind.annotation.*; import javax.annotation.Nonnull; import javax.validation.Valid; -@Tag(name = "ResidentController", description = "거주자의견진술 관리") +/** + * 거주자 / 장애인 의견 진술 + * 거주자 : scDatagb = "1" + * 장애인 : scDatagb = "2" + */ +@Tag(name = "ResidentAndDisabledController", description = "거주자/장애인 의견진술 관리") @RestController -@RequestMapping("/api/v1/ctgy/resident") +@RequestMapping("/api/v1/ctgy/judge") @Validated @RequiredArgsConstructor -public class ResidentController { +public class ResidentAndDisabledController { - private final IResidentService service; + private final IResidentAndDisabledService service; private final GnRecallScMapstruct mapstruct = Mappers.getMapper(GnRecallScMapstruct.class); // TODO :: 파라메터 정의 필요 - @Operation(summary = "거주자의견지술자료 목록 조회" , description = "거주자의견진술자료 목록 조회") + @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(value="/data", produces = MediaType.APPLICATION_JSON_VALUE) - public ResponseEntity findResidentDatas( + public ResponseEntity findJudgeDatas( @Parameter(hidden = true) final Pageable pageable) { - return RestResponse.of(service.findResidentDatas(pageable)); - } + return RestResponse.of(service.findJudgeDatas(pageable)); } - @Operation(summary = "거주자 의견진술 자료 등록", description = "거주자 의견진술 자료 등록") + @Operation(summary = "거주자/장애인 의견진술 자료 등록", description = "거주자/장애인 의견진술 자료 등록") @PostMapping(value = "/data", consumes = MediaType.MULTIPART_FORM_DATA_VALUE) - public ResponseEntity saveResidentData(@Nonnull GnRecallScDto dto) { + public ResponseEntity saveJudgeData(@Nonnull GnRecallScDto dto) { AssertUtils.isTrue(!Checks.isEmpty(dto), "등록할 거주자 의견진술 자료가 존재하지 않습니다."); - service.saveResidentData(dto); + service.saveJudgeData(dto); //service.saveResidentData(mapstruct.toEntity(dto), dto.getPicadFiles(), dto.getFrecadFiles(), dto.getContadFiles()); return RestResponse.of(HttpStatus.OK); // return RestResponse.of(HttpStatus.OK); } - @Operation(summary = "거주자의견진술 상세" , description = "거주자의견진술 상세") + @Operation(summary = "거주자/장애인 의견진술 자료 상세" , description = "거주자/장애인 의견진술 자료 상세") @Parameters({ @Parameter(in = ParameterIn.PATH, name = "scCode", description = "의견진술번호", required = true, example = "3778"), }) - @GetMapping(value = "/{scCode}", produces = MediaType.APPLICATION_JSON_VALUE) - public ResponseEntity findResident(@PathVariable final Long scCode) { - return RestResponse.of(service.findResidentData(scCode)); + @GetMapping(value = "/data/{scCode}", produces = MediaType.APPLICATION_JSON_VALUE) + public ResponseEntity findJudgeData(@PathVariable final Long scCode) { + return RestResponse.of(service.findJudgeData(scCode)); } - @Operation(summary = "거주자 의견진술 심의대상 조회" , description = "거주자 의견진술 심의대상 조회") + @Operation(summary = "거주자/장애인 의견진술 심의대상 조회" , description = "거주자/장애인 의견진술 심의대상 조회") @GetMapping(value="/target", produces = MediaType.APPLICATION_JSON_VALUE) @Parameters({ @Parameter(in = ParameterIn.QUERY, name = "scDatagb", description = "데이타구분(1-거주자, 2-장애인)", required = true, example = "1"), @@ -78,22 +82,22 @@ public class ResidentController { @Parameter(in = ParameterIn.QUERY, name = "scSeq1", description = "접수번호-시작", required = true, example = "2022200801"), @Parameter(in = ParameterIn.QUERY, name = "scSeq2", description = "접수번호-종료", required = true, example = "2022200899"), }) - public ResponseEntity findResidentJudgeTargets(@Parameter(hidden = true) final ResidentTargetDto dto){ - return RestResponse.of(service.findResidentJudgeTargets(dto)); + public ResponseEntity findResidentJudgeTargets(@Parameter(hidden = true) final JudgeTargetDto dto){ + return RestResponse.of(service.findJudgeTargets(dto)); } - @Operation(summary = "거주자 의견진술 심의대상 등록" , description = "거주자 의견진술 심의대상 등록") + @Operation(summary = "거주자/징애인 의견진술 심의대상 등록" , description = "거주자/장애인 의견진술 심의대상 등록") @PostMapping(value="/target", produces = MediaType.APPLICATION_JSON_VALUE) - public ResponseEntity saveResidentJudgeTargets( + public ResponseEntity saveJudgeTargets( @Valid @RequestBody - final ResidentTargetDto dto) { - service.saveResidentJudgeTargets(dto); + final JudgeTargetDto dto) { + service.saveJudgeTargets(dto); //service.saveParkingSimsaJudgeTargets(dto); return RestResponse.of(HttpStatus.OK); } - @Operation(summary = "거주자 의견진술 심의 목록" , description = "거주자 의견진술 심의 목록") + @Operation(summary = "거주자/장애인 의견진술 심의목록 조회" , description = "거주자/장애인 의견진술 심의목록 조회") @Parameters({ @Parameter(in = ParameterIn.QUERY, name = "scYear", description = "심사년도", required = true, example = "2021"), @Parameter(in = ParameterIn.QUERY, name = "scChasu", description = "차수", required = false, example = " "), @@ -108,7 +112,7 @@ public class ResidentController { final JudgeListDto dto, @Parameter(hidden = true) final Pageable pageable) { - return RestResponse.of(service.findResidents(dto, pageable)); + return RestResponse.of(service.findJudges(dto, pageable)); } } diff --git a/src/main/java/com/xit/biz/ctgy/dto/GnRecallScDto.java b/src/main/java/com/xit/biz/ctgy/dto/GnRecallScDto.java index 3b3ca9b..b8223fc 100644 --- a/src/main/java/com/xit/biz/ctgy/dto/GnRecallScDto.java +++ b/src/main/java/com/xit/biz/ctgy/dto/GnRecallScDto.java @@ -16,25 +16,25 @@ public class GnRecallScDto { @Schema(required = true, title = " ", example = " ", description = " ") private Long scCode; - @Schema(required = true, title = " ", example = " ", description = " ") + @Schema(required = true, title = "접수번호", example = " ", description = " ") private Long scSeq; - @Schema(required = true, title = " ", example = " ", description = " ") + @Schema(required = true, title = "차량번호", example = " ", description = " ") private String scCarnum; - @Schema(required = true, title = " ", example = " ", description = " ") + @Schema(required = true, title = "이름", example = " ", description = " ") private String scName; @Schema(required = true, title = " ", example = " ", description = " ") private String scDong; - @Schema(required = true, title = " ", example = " ", description = " ") + @Schema(required = true, title = "진술유형코드", example = " ", description = "진술유형코드") private String scContDoc; - @Schema(required = true, title = " ", example = " ", description = " ") + @Schema(required = true, title = "접수일자", example = " ", description = "접수일자") private String scCdate; - @Schema(required = true, title = " ", example = " ", description = " ") + @Schema(required = true, title = "접수방법코드", example = " ", description = "접수방법코드") private String scIngb; @Schema(required = true, title = " ", example = " ", description = " ") @@ -46,7 +46,7 @@ public class GnRecallScDto { @Schema(required = true, title = " ", example = " ", description = " ") private String scPos; - @Schema(title = " ", example = " ", description = " ") + @Schema(title = "진술서파일1", example = " ", description = " ") private String scFrecad1; @Schema(title = " ", example = " ", description = " ") @@ -58,7 +58,7 @@ public class GnRecallScDto { @Schema(title = " ", example = " ", description = " ") private String scFrecad4; - @Schema(title = " ", example = " ", description = " ") + @Schema(title = "첨부자료1", example = " ", description = " ") private String scContad1; @Schema(title = " ", example = " ", description = " ") @@ -82,7 +82,7 @@ public class GnRecallScDto { @Schema(title = " ", example = " ", description = " ") private String scContad8; - @Schema(title = " ", example = " ", description = " ") + @Schema(title = "단속사진1", example = " ", description = " ") private String scPicad1; @Schema(title = " ", example = " ", description = " ") @@ -118,13 +118,13 @@ public class GnRecallScDto { @Schema(title = " ", example = " ", description = " ") private String scBunji; - @Schema(required = true, title = " ", example = " ", description = " ") + @Schema(required = true, title = "진술유형코드명", example = " ", description = "진술유형코드명") private String scContDocNm; - @Schema(required = true, title = " ", example = " ", description = " ") + @Schema(required = true, title = "접수방법코드명", example = " ", description = "접수방법코드명") private String scIngbNm; - @Schema(required = true, title = " ", example = " ", description = " ") + @Schema(required = true, title = "전송여부", example = " ", description = "전송여부") private String scTransferNm; @Schema(required = true, title = " ", example = " ", description = " ") @@ -138,6 +138,4 @@ public class GnRecallScDto { @Schema(required = false, title = "첨부자료파일", example = " ", description = "첨부자료파일") private MultipartFile[] contadFiles; - - } diff --git a/src/main/java/com/xit/biz/ctgy/dto/ResidentTargetDto.java b/src/main/java/com/xit/biz/ctgy/dto/JudgeTargetDto.java similarity index 96% rename from src/main/java/com/xit/biz/ctgy/dto/ResidentTargetDto.java rename to src/main/java/com/xit/biz/ctgy/dto/JudgeTargetDto.java index 526ebdb..ab51901 100644 --- a/src/main/java/com/xit/biz/ctgy/dto/ResidentTargetDto.java +++ b/src/main/java/com/xit/biz/ctgy/dto/JudgeTargetDto.java @@ -6,7 +6,6 @@ import lombok.AllArgsConstructor; import lombok.Getter; import lombok.NoArgsConstructor; import lombok.Setter; -import org.springframework.web.multipart.MultipartFile; import java.time.LocalDate; import java.util.List; @@ -16,7 +15,7 @@ import java.util.List; @Setter @AllArgsConstructor @NoArgsConstructor -public class ResidentTargetDto { +public class JudgeTargetDto { @Schema(title = "메인코드", example = " ", description = "메인코드") private Long scCode; @@ -48,7 +47,7 @@ public class ResidentTargetDto { private String scTransfer; @Schema(title = "데이타구분", example = "1", description = "데이타구분: 1-거주자,2-장애인") - private String scDatagb = "1"; + private String scDatagb; //------------------------------------------------------------------ // 심사대상 저장을 위한 속성 diff --git a/src/main/java/com/xit/biz/ctgy/dto/ResidentDto.java b/src/main/java/com/xit/biz/ctgy/dto/ResidentDto.java deleted file mode 100644 index f2079f6..0000000 --- a/src/main/java/com/xit/biz/ctgy/dto/ResidentDto.java +++ /dev/null @@ -1,126 +0,0 @@ -package com.xit.biz.ctgy.dto; - -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.AllArgsConstructor; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; - -@Schema(name = "GnRecallScDto", description = "") -@Getter -@Setter -@AllArgsConstructor -@NoArgsConstructor -public class ResidentDto { - @Schema(required = true, title = " ", example = " ", description = " ") - private Long scCode; - - @Schema(required = true, title = "접수번호", example = " ", description = " ") - private Long scSeq; - - @Schema(required = true, title = "차량번호", example = " ", description = " ") - private String scCarnum; - - @Schema(required = true, title = "이름", example = " ", description = " ") - private String scName; - - @Schema(required = true, title = " ", example = " ", description = " ") - private String scDong; - - @Schema(required = true, title = "진술유형코드", example = " ", description = "진술유형코드") - private String scContDoc; - - @Schema(required = true, title = "진술유형코드명", example = " ", description = "진술유형코드명") - private String scContDocNm; - - @Schema(required = true, title = "접수일자", example = " ", description = "접수일자") - private String scCdate; - - @Schema(required = true, title = "접수방법코드", example = " ", description = "접수방법코드") - private String scIngb; - - @Schema(required = true, title = "접수방법코드명", example = " ", description = "접수방법코드명") - private String scIngbNm; - - @Schema(required = true, title = " ", example = " ", description = " ") - private String scWdate; - - @Schema(required = true, title = " ", example = " ", description = " ") - private String scJbtime; - - @Schema(required = true, title = " ", example = " ", description = " ") - private String scPos; - - @Schema(title = " ", example = " ", description = " ") - private String scFrecad1; - - @Schema(title = " ", example = " ", description = " ") - private String scFrecad2; - - @Schema(title = " ", example = " ", description = " ") - private String scFrecad3; - - @Schema(title = " ", example = " ", description = " ") - private String scFrecad4; - - @Schema(title = " ", example = " ", description = " ") - private String scContad1; - - @Schema(title = " ", example = " ", description = " ") - private String scContad2; - - @Schema(title = " ", example = " ", description = " ") - private String scContad3; - - @Schema(title = " ", example = " ", description = " ") - private String scContad4; - - @Schema(title = " ", example = " ", description = " ") - private String scContad5; - - @Schema(title = " ", example = " ", description = " ") - private String scContad6; - - @Schema(title = " ", example = " ", description = " ") - private String scContad7; - - @Schema(title = " ", example = " ", description = " ") - private String scContad8; - - @Schema(title = " ", example = " ", description = " ") - private String scPicad1; - - @Schema(title = " ", example = " ", description = " ") - private String scPicad2; - - @Schema(title = " ", example = " ", description = " ") - private String scPicad3; - - @Schema(title = " ", example = " ", description = " ") - private String scPicad4; - - @Schema(required = true, title = " ", example = " ", description = " ") - private String scTransfer; - - @Schema(required = true, title = " ", example = " ", description = " ") - private String scDatagb; - - @Schema(title = " ", example = " ", description = " ") - private String scAnswer; - - @Schema(required = true, title = " ", example = " ", description = " ") - private String scState; - - @Schema(title = " ", example = " ", description = " ") - private String zipcode1; - - @Schema(title = " ", example = " ", description = " ") - private String zipcode2; - - @Schema(title = " ", example = " ", description = " ") - private String scJuso; - - @Schema(title = " ", example = " ", description = " ") - private String scBunji; - -} diff --git a/src/main/java/com/xit/biz/ctgy/mapper/IResidentAndDisabledMapper.java b/src/main/java/com/xit/biz/ctgy/mapper/IResidentAndDisabledMapper.java new file mode 100644 index 0000000..2b57d4d --- /dev/null +++ b/src/main/java/com/xit/biz/ctgy/mapper/IResidentAndDisabledMapper.java @@ -0,0 +1,11 @@ +package com.xit.biz.ctgy.mapper; + +import com.xit.biz.ctgy.dto.JudgeTargetDto; +import org.apache.ibatis.annotations.Mapper; + +@Mapper +public interface IResidentAndDisabledMapper { + + void insertJudgeTargetIntoSelect(JudgeTargetDto dto); + +} diff --git a/src/main/java/com/xit/biz/ctgy/mapper/IResidentMapper.java b/src/main/java/com/xit/biz/ctgy/mapper/IResidentMapper.java deleted file mode 100644 index 9496918..0000000 --- a/src/main/java/com/xit/biz/ctgy/mapper/IResidentMapper.java +++ /dev/null @@ -1,11 +0,0 @@ -package com.xit.biz.ctgy.mapper; - -import com.xit.biz.ctgy.dto.ResidentTargetDto; -import org.apache.ibatis.annotations.Mapper; - -@Mapper -public interface IResidentMapper { - - void insertResidentJudgeTargetIntoSelect(ResidentTargetDto dto); - -} diff --git a/src/main/java/com/xit/biz/ctgy/repository/IResidentRepository.java b/src/main/java/com/xit/biz/ctgy/repository/IResidentAndDisabledRepository.java similarity index 62% rename from src/main/java/com/xit/biz/ctgy/repository/IResidentRepository.java rename to src/main/java/com/xit/biz/ctgy/repository/IResidentAndDisabledRepository.java index ecf3765..de1ee54 100644 --- a/src/main/java/com/xit/biz/ctgy/repository/IResidentRepository.java +++ b/src/main/java/com/xit/biz/ctgy/repository/IResidentAndDisabledRepository.java @@ -5,12 +5,29 @@ import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.jpa.repository.Query; import org.springframework.data.repository.query.Param; -public interface IResidentRepository extends JpaRepository, IResidentRepositoryCustom { +/** + * 거주자 / 장애인 의견 진술 + * 거주자 : scDatagb = "1" + * 장애인 : scDatagb = "2" + */ +public interface IResidentAndDisabledRepository extends JpaRepository, IResidentAndDisabledRepositoryCustom { // TODO : Ansi - sql 미사용, 채번테이블 사용하도록 변경 필요 //@Query(value = "SELECT max(e.sc_code) + 1 FROM gn_recall_sc e, nativeQuery = true) + + /** + * 거주자 / 장애인 심의자료 심의번호 채번 + * @param year String + * @param scDatagb String + * @return Long + */ @Query(value = "SELECT rpad(nvl(max(e.sc_seq), :year), 10, '0') + 1 FROM gn_recall_sc e WHERE e.sc_datagb = :scDatagb AND e.sc_seq LIKE :year||'%' ", nativeQuery = true) Long getGnRecallScMaxScSeq(@Param("year") String year, @Param("scDatagb") String scDatagb); + /** + * + * @param scCode + * @return + */ GnRecallSc findByScCode(final Long scCode); } diff --git a/src/main/java/com/xit/biz/ctgy/repository/IResidentAndDisabledRepositoryCustom.java b/src/main/java/com/xit/biz/ctgy/repository/IResidentAndDisabledRepositoryCustom.java new file mode 100644 index 0000000..b067240 --- /dev/null +++ b/src/main/java/com/xit/biz/ctgy/repository/IResidentAndDisabledRepositoryCustom.java @@ -0,0 +1,47 @@ +package com.xit.biz.ctgy.repository; + +import com.xit.biz.ctgy.dto.GnRecallScDto; +import com.xit.biz.ctgy.dto.JudgeListDto; +import com.xit.biz.ctgy.dto.JudgeTargetDto; +import org.springframework.data.domain.Page; +import org.springframework.data.domain.Pageable; + +import java.util.List; + +/** + * 거주자 / 장애인 의견 진술 + * 거주자 : scDatagb = "1" + * 장애인 : scDatagb = "2" + */ +public interface IResidentAndDisabledRepositoryCustom { + + /** + * 거주자 / 장애인 의견진술 자료 목록 조회 + * @param pageable Pageable + * @return Page + */ + Page findJudgeDatas(Pageable pageable); + + /** + * 거주자 / 장애인 의견진술 자료 정보 조회 + * @param scCode Long + * @return GnRecallScDto + */ + GnRecallScDto findJudgeData(final Long scCode); + + /** + * 거주자 / 장애인 의견진술 목로 조회 + * @param dto JudgeListDto + * @param pageable Pageable + * @return Page + */ + Page findJudges(JudgeListDto dto, Pageable pageable); + + /** + * 거주자 / 장애인 심의 대상 목록 조회 + * @param dto JudgeTargetDto + * @return List + */ + List findJudgeTargets(final JudgeTargetDto dto); + +} diff --git a/src/main/java/com/xit/biz/ctgy/repository/IResidentRepositoryImpl.java b/src/main/java/com/xit/biz/ctgy/repository/IResidentAndDisabledRepositoryImpl.java similarity index 93% rename from src/main/java/com/xit/biz/ctgy/repository/IResidentRepositoryImpl.java rename to src/main/java/com/xit/biz/ctgy/repository/IResidentAndDisabledRepositoryImpl.java index 758593e..34fc358 100644 --- a/src/main/java/com/xit/biz/ctgy/repository/IResidentRepositoryImpl.java +++ b/src/main/java/com/xit/biz/ctgy/repository/IResidentAndDisabledRepositoryImpl.java @@ -8,8 +8,9 @@ import com.querydsl.core.types.dsl.BooleanExpression; import com.querydsl.jpa.JPAExpressions; import com.querydsl.jpa.impl.JPAQueryFactory; import com.xit.biz.ctgy.CtgyConstants; -import com.xit.biz.ctgy.dto.*; -import com.xit.biz.ctgy.entity.GnRecallSc; +import com.xit.biz.ctgy.dto.GnRecallScDto; +import com.xit.biz.ctgy.dto.JudgeListDto; +import com.xit.biz.ctgy.dto.JudgeTargetDto; import com.xit.core.util.Checks; import lombok.RequiredArgsConstructor; import org.springframework.data.domain.Page; @@ -22,16 +23,19 @@ import java.util.List; import static com.xit.biz.cmm.entity.QCmmCodeS.cmmCodeS; import static com.xit.biz.ctgy.entity.QGnRecallSc.gnRecallSc; import static com.xit.biz.ctgy.entity.QMinSimsa680Sc.minSimsa680Sc; -import static com.xit.biz.ctgy.entity.QTf680Main.tf680Main; -import static com.xit.biz.ctgy.entity.QTf680Recall.tf680Recall; +/** + * 거주자 / 장애인 의견 진술 + * 거주자 : scDatagb = "1" + * 장애인 : scDatagb = "2" + */ @RequiredArgsConstructor -public class IResidentRepositoryImpl implements IResidentRepositoryCustom { +public class IResidentAndDisabledRepositoryImpl implements IResidentAndDisabledRepositoryCustom { private final JPAQueryFactory queryFactory; @Override - public Page findResidentDatas(Pageable pageable) { + public Page findJudgeDatas(Pageable pageable) { // 커버링 인덱스로 대상 조회 QueryResults scCodeList = queryFactory @@ -84,7 +88,7 @@ public class IResidentRepositoryImpl implements IResidentRepositoryCustom { } @Override - public GnRecallScDto findResident(final Long scCode) { + public GnRecallScDto findJudgeData(final Long scCode) { BooleanBuilder builder = new BooleanBuilder(); builder.and(gnRecallSc.scDatagb.eq(CtgyConstants.Judge.DATAGB_RESIDENT.getCode())); builder.and(gnRecallSc.scCode.eq(scCode)); @@ -173,7 +177,7 @@ AND SC_CODE = } @Override - public Page findResidents(final JudgeListDto dto, Pageable pageable) { + public Page findJudges(final JudgeListDto dto, Pageable pageable) { BooleanBuilder builder = new BooleanBuilder(); if (!Checks.isEmpty(dto.getMsYear())) { @@ -212,7 +216,7 @@ AND SC_CODE = } @Override - public List findResidentJudgeTargets(final ResidentTargetDto dto) { + public List findJudgeTargets(final JudgeTargetDto dto) { // 자료상태 : 1-접수 String stateCond = CtgyConstants.Judge.DATA_STATE_RECEIPT.getCode(); @@ -220,9 +224,9 @@ AND SC_CODE = return queryReultResidentJudgeTargets(dto.getScDatagb(), stateCond, dto.getScTransfer(), dto.getScSeq1(), dto.getScSeq2()); } - private List queryReultResidentJudgeTargets(String dataGb, String state, String transfer, Long seq1, Long seq2){ + private List queryReultResidentJudgeTargets(String dataGb, String state, String transfer, Long seq1, Long seq2){ return queryFactory - .select(Projections.fields(ResidentTargetDto.class, + .select(Projections.fields(JudgeTargetDto.class, gnRecallSc.scCode, gnRecallSc.scSeq, gnRecallSc.scCarnum, diff --git a/src/main/java/com/xit/biz/ctgy/repository/IResidentRepositoryCustom.java b/src/main/java/com/xit/biz/ctgy/repository/IResidentRepositoryCustom.java deleted file mode 100644 index 9e4020e..0000000 --- a/src/main/java/com/xit/biz/ctgy/repository/IResidentRepositoryCustom.java +++ /dev/null @@ -1,20 +0,0 @@ -package com.xit.biz.ctgy.repository; - -import com.xit.biz.ctgy.dto.GnRecallScDto; -import com.xit.biz.ctgy.dto.JudgeListDto; -import com.xit.biz.ctgy.dto.ResidentTargetDto; -import org.springframework.data.domain.Page; -import org.springframework.data.domain.Pageable; - -import java.util.List; - -public interface IResidentRepositoryCustom { - Page findResidentDatas(Pageable pageable); - - GnRecallScDto findResident(final Long scCode); - - Page findResidents(JudgeListDto dto, Pageable pageable); - - List findResidentJudgeTargets(final ResidentTargetDto dto); - -} diff --git a/src/main/java/com/xit/biz/ctgy/service/IResidentAndDisabledService.java b/src/main/java/com/xit/biz/ctgy/service/IResidentAndDisabledService.java new file mode 100644 index 0000000..8588339 --- /dev/null +++ b/src/main/java/com/xit/biz/ctgy/service/IResidentAndDisabledService.java @@ -0,0 +1,58 @@ +package com.xit.biz.ctgy.service; + +import com.xit.biz.ctgy.dto.GnRecallScDto; +import com.xit.biz.ctgy.dto.JudgeListDto; +import com.xit.biz.ctgy.dto.JudgeTargetDto; +import org.springframework.data.domain.Page; +import org.springframework.data.domain.Pageable; + +import java.util.List; + +/** + * 거주자 / 장애인 의견 진술 + * 거주자 : scDatagb = "1" + * 장애인 : scDatagb = "2" + */ +public interface IResidentAndDisabledService { + + + /** + * 거주자 / 장애인 심의자료 목록 조회 + * @param pageable Pageable + * @return Page + */ + Page findJudgeDatas(Pageable pageable); + + /** + * 거주자 / 장애인 심의자료 정보 조회 + * @param scCode Long + * @return GnRecallScDto + */ + GnRecallScDto findJudgeData(final Long scCode); + + //Page findAll(final GnRecallSc entity, Pageable pageable); + + // 심의자료 저장 + + /** + * 거주자 / 장애인 심의자료 저장 + * @param entity GnRecallScDto + */ + void saveJudgeData(GnRecallScDto entity); + + /** + * 거주자 / 장애인 심의대상 목록 조회 + * @param dto JufgeTargetDto + * @return List + */ + List findJudgeTargets(final JudgeTargetDto dto) ; + void saveJudgeTargets(JudgeTargetDto dto); + + /** + * 거주자 / 장애인 의견진술 심의 목록 조회 + * @param dto JudgeListDto + * @param pageable Pageable + * @return Page + */ + Page findJudges(JudgeListDto dto, Pageable pageable); +} diff --git a/src/main/java/com/xit/biz/ctgy/service/IResidentService.java b/src/main/java/com/xit/biz/ctgy/service/IResidentService.java deleted file mode 100644 index 34a75ee..0000000 --- a/src/main/java/com/xit/biz/ctgy/service/IResidentService.java +++ /dev/null @@ -1,25 +0,0 @@ -package com.xit.biz.ctgy.service; - -import com.xit.biz.ctgy.dto.GnRecallScDto; -import com.xit.biz.ctgy.dto.ResidentTargetDto; -import com.xit.biz.ctgy.dto.JudgeListDto; -import org.springframework.data.domain.Page; -import org.springframework.data.domain.Pageable; - -import java.util.List; - -public interface IResidentService { - - Page findResidentDatas(Pageable pageable); - - GnRecallScDto findResidentData(final Long scCode); - - //Page findAll(final GnRecallSc entity, Pageable pageable); - - void saveResidentData(GnRecallScDto entity); - - List findResidentJudgeTargets(final ResidentTargetDto dto) ; - void saveResidentJudgeTargets(ResidentTargetDto dto); - - Page findResidents(JudgeListDto dto, Pageable pageable); -} diff --git a/src/main/java/com/xit/biz/ctgy/service/impl/ResidentService.java b/src/main/java/com/xit/biz/ctgy/service/impl/ResidentAndDisabledService.java similarity index 70% rename from src/main/java/com/xit/biz/ctgy/service/impl/ResidentService.java rename to src/main/java/com/xit/biz/ctgy/service/impl/ResidentAndDisabledService.java index 34b1919..cad9a44 100644 --- a/src/main/java/com/xit/biz/ctgy/service/impl/ResidentService.java +++ b/src/main/java/com/xit/biz/ctgy/service/impl/ResidentAndDisabledService.java @@ -3,20 +3,27 @@ package com.xit.biz.ctgy.service.impl; import com.xit.biz.cmm.service.ICmmFileService; import com.xit.biz.ctgy.CtgyConstants; import com.xit.biz.ctgy.dto.GnRecallScDto; -import com.xit.biz.ctgy.dto.ResidentTargetDto; import com.xit.biz.ctgy.dto.JudgeListDto; +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.IResidentMapper; -import com.xit.biz.ctgy.repository.*; -import com.xit.biz.ctgy.service.IResidentService; +import com.xit.biz.ctgy.entity.GnRecallSc; +import com.xit.biz.ctgy.entity.MinSimsaUser680; +import com.xit.biz.ctgy.entity.MinUserinfo; +import com.xit.biz.ctgy.mapper.IResidentAndDisabledMapper; +import com.xit.biz.ctgy.repository.IJudgeUserRepository; +import com.xit.biz.ctgy.repository.IMinUserRepository; +import com.xit.biz.ctgy.repository.IResidentAndDisabledRepository; +import com.xit.biz.ctgy.service.IResidentAndDisabledService; import com.xit.core.support.jpa.JpaUtil; import com.xit.core.util.DateUtil; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.mapstruct.factory.Mappers; import org.springframework.beans.factory.annotation.Value; -import org.springframework.data.domain.*; +import org.springframework.data.domain.Page; +import org.springframework.data.domain.PageRequest; +import org.springframework.data.domain.Pageable; +import org.springframework.data.domain.Sort; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import org.springframework.util.StringUtils; @@ -31,7 +38,7 @@ import java.util.stream.Collectors; @Service @RequiredArgsConstructor @Slf4j -public class ResidentService implements IResidentService { +public class ResidentAndDisabledService implements IResidentAndDisabledService { @Value("${file.cmm.upload.root:c:/data/file/upload}") private String rootPath; @@ -39,7 +46,7 @@ public class ResidentService implements IResidentService { @Value("${file.cmm.upload.simsaPath:[simUpFile_sc1]}") private String[] uploadPath; - private final IResidentRepository repository; + private final IResidentAndDisabledRepository repository; private final GnRecallScMapstruct mapstruct = Mappers.getMapper(GnRecallScMapstruct.class); private final ICmmFileService fileService; @@ -47,45 +54,27 @@ public class ResidentService implements IResidentService { private final IMinUserRepository userRepository; private final IJudgeUserRepository judgeUserRepository; - private final IResidentMapper mapper; + private final IResidentAndDisabledMapper mapper; @Override @Transactional(readOnly = true) - public Page findResidentDatas(Pageable pageable) { + public Page findJudgeDatas(Pageable pageable) { // Sort sort = Sort.by(Sort.Direction.DESC, "inCode"); pageable = JpaUtil.getPagingInfo(pageable); - Page page = repository.findResidentDatas( + return repository.findJudgeDatas( PageRequest.of(pageable.getPageNumber(), pageable.getPageSize(), Sort.by("scCode").descending())); // List userList = page.getContent(); - return page; } @Override @Transactional(readOnly = true) - public GnRecallScDto findResidentData(final Long scCode) { - GnRecallScDto dto = repository.findResident(scCode); - return repository.findResident(scCode); + public GnRecallScDto findJudgeData(final Long scCode) { + return repository.findJudgeData(scCode); } -// @Override -// @Transactional(readOnly = true) -// public Page findAll(final GnRecallSc entity, Pageable pageable) { -// // Sort sort = Sort.by(Sort.Direction.DESC, "inCode"); -// pageable = JpaUtil.getPagingInfo(pageable); -// // pageable = PageRequest.of(pageable.getPageNumber(), pageable.getPageSize(), Sort.by("inCode").descending()) -// ExampleMatcher exampleMatcher = ExampleMatcher.matchingAll(); -// //.withMatcher("inTitle", contains()) -// //.withMatcher("inName", contains()); -// Example example = Example.of(entity, exampleMatcher); -// Page page = repository.findAll( -// example, -// PageRequest.of(pageable.getPageNumber(), pageable.getPageSize(), Sort.by("scCode").descending())); -// // List userList = page.getContent(); -// return page; -// } - @Override - public void saveResidentData(GnRecallScDto dto) { + @Transactional + public void saveJudgeData(GnRecallScDto dto) { if(dto.getPicadFiles() != null) { setFileInfoAndFileUpload(dto, dto.getPicadFiles(), "setScPicad"); @@ -123,20 +112,21 @@ public class ResidentService implements IResidentService { @Override - public Page findResidents(JudgeListDto dto, Pageable pageable) { + public Page findJudges(JudgeListDto dto, Pageable pageable) { + pageable = JpaUtil.getPagingInfo(pageable); - return repository.findResidents(dto, pageable); + return repository.findJudges(dto, pageable); } @Override @Transactional(readOnly = true) - public List findResidentJudgeTargets(ResidentTargetDto dto) { - return repository.findResidentJudgeTargets(dto); + public List findJudgeTargets(JudgeTargetDto dto) { + return repository.findJudgeTargets(dto); } @Override @Transactional - public void saveResidentJudgeTargets(ResidentTargetDto dto) { + public void saveJudgeTargets(JudgeTargetDto dto) { boolean isFirst = true; for(Long scCode : dto.getScCodes()) { @@ -149,7 +139,7 @@ public class ResidentService implements IResidentService { } // 심사대상 등록 - mapper.insertResidentJudgeTargetIntoSelect(dto); + mapper.insertJudgeTargetIntoSelect(dto); // // 등록된 심사대상 데이타 등록 상태 변경 : 미접수 -> 접수 // Tf680Recall recallEntity = recallRepository.findById(dto.getRcCode()).orElseGet(Tf680Recall::new); diff --git a/src/main/resources/mybatis-mapper/biz/ctgy/resident-mapper.xml b/src/main/resources/mybatis-mapper/biz/ctgy/residentanddisabled-mapper.xml similarity index 80% rename from src/main/resources/mybatis-mapper/biz/ctgy/resident-mapper.xml rename to src/main/resources/mybatis-mapper/biz/ctgy/residentanddisabled-mapper.xml index 704da68..246c2cb 100644 --- a/src/main/resources/mybatis-mapper/biz/ctgy/resident-mapper.xml +++ b/src/main/resources/mybatis-mapper/biz/ctgy/residentanddisabled-mapper.xml @@ -1,9 +1,9 @@ - - - /* resident-mapper|insertResidentJudgeTargetIntoSelect|julim */ + + + /* residentanddisabled-mapper|insertJudgeTargetIntoSelect|julim */ insert into min_simsa680_sc( ms_maincode,