From 9b4ec3377b21073bb90c1f360c5628f0afc05f5a Mon Sep 17 00:00:00 2001 From: minuk926 Date: Mon, 11 Apr 2022 20:15:38 +0900 Subject: [PATCH] =?UTF-8?q?fix:=20=EA=B1=B0=EC=A3=BC=EC=9E=90/=EC=9E=A5?= =?UTF-8?q?=EC=95=A0=EC=9D=B8=20=EC=8B=AC=EC=9D=98=EB=8C=80=EC=83=81=20?= =?UTF-8?q?=EC=83=81=EC=84=B8=20=EB=AA=A9=EB=A1=9D=20fix?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ResidentAndDisabledController.java | 8 +- .../com/xit/biz/ctgy/dto/JudgeDetailDto.java | 68 ++++++++++++++ .../mapper/IResidentAndDisabledMapper.java | 34 +++++++ .../IResidentAndDisabledRepositoryCustom.java | 4 +- .../IResidentAndDisabledRepositoryImpl.java | 37 ++++---- .../service/IResidentAndDisabledService.java | 6 +- .../impl/ResidentAndDisabledService.java | 34 ++++++- .../xit/core/support/CamelCaseLinkedMap.java | 1 + .../com/xit/core/support/CamelCaseMap.java | 3 +- .../resources/data/sql/거주자심의상세.sql | 61 +++++++------ .../biz/ctgy/residentanddisabled-mapper.xml | 90 ++++++++++++++++++- 11 files changed, 291 insertions(+), 55 deletions(-) create mode 100644 src/main/java/com/xit/biz/ctgy/dto/JudgeDetailDto.java 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 70e5406..63a2ec2 100644 --- a/src/main/java/com/xit/biz/ctgy/controller/ResidentAndDisabledController.java +++ b/src/main/java/com/xit/biz/ctgy/controller/ResidentAndDisabledController.java @@ -131,10 +131,10 @@ public class ResidentAndDisabledController { @Operation(summary = "거주자/장애인 의견진술 심의등록 상세 목록" , description = "거주자/장애인 의견진술 심의등록 상세 목록") @Parameters({ @Parameter(in = ParameterIn.QUERY, name = "msDatagb", description = "데이타구분(1-거주자, 2-장애인)", required = true, example = "1"), - @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") + @Parameter(in = ParameterIn.QUERY, name = "msSdate", description = "심사시작일", required = true, example = "2021-09-10"), + @Parameter(in = ParameterIn.QUERY, name = "msEdate", description = "심사종료일", required = true, example = "2021-09-11"), + @Parameter(in = ParameterIn.QUERY, name = "msChasu", description = "차수", required = true, example = "12"), + @Parameter(in = ParameterIn.QUERY, name = "msuTeam", description = "팀코드", required = false, example = "003") }) @GetMapping(value="/detail", produces = MediaType.APPLICATION_JSON_VALUE) public ResponseEntity findJudgeDetails( diff --git a/src/main/java/com/xit/biz/ctgy/dto/JudgeDetailDto.java b/src/main/java/com/xit/biz/ctgy/dto/JudgeDetailDto.java new file mode 100644 index 0000000..e05ff92 --- /dev/null +++ b/src/main/java/com/xit/biz/ctgy/dto/JudgeDetailDto.java @@ -0,0 +1,68 @@ +package com.xit.biz.ctgy.dto; + +import com.fasterxml.jackson.annotation.JsonFormat; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; + +import java.time.LocalDate; + +@Schema(name = "JudgeDetailDto", description = "심사등록상세") +@Getter +@Setter +@AllArgsConstructor +@NoArgsConstructor +public class JudgeDetailDto { + + @Schema(required = true, title = "민원코드", example = " ", description = "민원코드") + private Long msMaincode; + + @Schema(required = true, title = "접수번호", example = " ", description = "Input Description...") + private String msSeq; + + @Schema(required = true, title = "차량번호", example = " ", description = "Input Description...") + private String msCarnum; + + @Schema(required = true, title = "년도", example = " ", description = "Input Description...") + private String msYear; + + @Schema(required = true, title = "차수", example = " ", description = "Input Description...") + private Long msChasu; + + @Schema(required = true, title = "심사시작일", example = " ", description = "Input Description...") + @JsonFormat(pattern="yyyy-MM-dd") + private LocalDate msSdate; + + @Schema(required = true, title = "심사시작시간", example = " ", description = "Input Description...") + private String msStartsi; + + @Schema(required = true, title = "심사종료일", example = " ", description = "Input Description...") + @JsonFormat(pattern="yyyy-MM-dd") + private LocalDate msEdate; + + @Schema(required = true, title = "심사마감일", example = " ", description = "Input Description...") + @JsonFormat(pattern="yyyy-MM-dd") + private LocalDate msCdate; + + @Schema(required = true, title = "심사마감시간", example = " ", description = "Input Description...") + private String msClosesi; + + @Schema(required = false, title = "단속일자", example = " ", description = "Input Description...") + @JsonFormat(pattern="yyyy-MM-dd") + private LocalDate msWdate; + + @Schema(required = false, title = "단속장소", example = " ", description = "Input Description...") + private String msPos; + + @Schema(required = false, title = "결과코드", example = " ", description = "Input Description...") + private String msResult; + + @Schema(required = false, title = "단속시간", example = " ", description = "Input Description...") + private String msJbtime; + + @Schema(title = "데이타구분", example = "1", description = "데이타구분: 1-거주자,2-장애인") + private String msDatagb; + +} diff --git a/src/main/java/com/xit/biz/ctgy/mapper/IResidentAndDisabledMapper.java b/src/main/java/com/xit/biz/ctgy/mapper/IResidentAndDisabledMapper.java index 2b57d4d..7c633c6 100644 --- a/src/main/java/com/xit/biz/ctgy/mapper/IResidentAndDisabledMapper.java +++ b/src/main/java/com/xit/biz/ctgy/mapper/IResidentAndDisabledMapper.java @@ -1,11 +1,45 @@ package com.xit.biz.ctgy.mapper; +import com.xit.biz.ctgy.dto.JudgeListDto; import com.xit.biz.ctgy.dto.JudgeTargetDto; +import com.xit.core.support.CamelCaseMap; +import org.apache.commons.collections4.map.LinkedMap; import org.apache.ibatis.annotations.Mapper; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; + @Mapper public interface IResidentAndDisabledMapper { void insertJudgeTargetIntoSelect(JudgeTargetDto dto); + /** + * 팀 && 차수 별 total + * @param dto JudgeListDto + * @return Map + */ + Map selectTotByJudgeTeamAndChasu(JudgeListDto dto); + + /** + * 팀 && 차수 별 심사위원 심사 결과 + * @param dto JudgeListDto + * @return List + */ + List> selectTotJudgeUsersByJudgeTeamAndChasu(JudgeListDto dto); + + /** + * 심사대상 차량 정보 목록 + * @param dto JudgeListDto + * @return List + */ + List> selectJudgeTargetByCarnum(JudgeListDto dto); + + /** + * 차량별 심사위원 심사결과 목록 + * @param map Map + * @return List + */ + List> selectJudgeResultByCarnum(Map map); } diff --git a/src/main/java/com/xit/biz/ctgy/repository/IResidentAndDisabledRepositoryCustom.java b/src/main/java/com/xit/biz/ctgy/repository/IResidentAndDisabledRepositoryCustom.java index 7ea6f35..c358bc4 100644 --- a/src/main/java/com/xit/biz/ctgy/repository/IResidentAndDisabledRepositoryCustom.java +++ b/src/main/java/com/xit/biz/ctgy/repository/IResidentAndDisabledRepositoryCustom.java @@ -1,9 +1,9 @@ package com.xit.biz.ctgy.repository; import com.xit.biz.ctgy.dto.GnRecallScDto; +import com.xit.biz.ctgy.dto.JudgeDetailDto; import com.xit.biz.ctgy.dto.JudgeListDto; import com.xit.biz.ctgy.dto.JudgeTargetDto; -import com.xit.biz.ctgy.entity.MinSimsa680; import org.springframework.data.domain.Page; import org.springframework.data.domain.Pageable; @@ -44,7 +44,7 @@ public interface IResidentAndDisabledRepositoryCustom { * @param dto JudgeListDto * @return List */ - List findJudgeDetails(final JudgeListDto dto); + List findJudgeDetails(final JudgeListDto dto); /** * 거주자 / 장애인 심의 대상 목록 조회 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 2df26f6..c6b58bf 100644 --- a/src/main/java/com/xit/biz/ctgy/repository/IResidentAndDisabledRepositoryImpl.java +++ b/src/main/java/com/xit/biz/ctgy/repository/IResidentAndDisabledRepositoryImpl.java @@ -9,9 +9,11 @@ import com.querydsl.jpa.JPAExpressions; import com.querydsl.jpa.impl.JPAQueryFactory; import com.xit.biz.ctgy.CtgyConstants; import com.xit.biz.ctgy.dto.GnRecallScDto; +import com.xit.biz.ctgy.dto.JudgeDetailDto; import com.xit.biz.ctgy.dto.JudgeListDto; import com.xit.biz.ctgy.dto.JudgeTargetDto; import com.xit.biz.ctgy.entity.MinSimsa680; +import com.xit.biz.ctgy.entity.MinSimsa680Sc; import com.xit.core.util.Checks; import lombok.RequiredArgsConstructor; import org.springframework.data.domain.Page; @@ -27,6 +29,7 @@ import static com.xit.biz.ctgy.entity.QGnRecallSc.gnRecallSc; import static com.xit.biz.ctgy.entity.QMinSimsa680.minSimsa680; import static com.xit.biz.ctgy.entity.QMinSimsa680Sc.minSimsa680Sc; import static com.xit.biz.ctgy.entity.QMinSimsaUser680.minSimsaUser680; +import static com.xit.biz.ctgy.entity.QMinSimsaUser680Sc.minSimsaUser680Sc; import static com.xit.biz.ctgy.entity.QMinUserinfo.minUserinfo; /** @@ -208,32 +211,32 @@ public class IResidentAndDisabledRepositoryImpl implements IResidentAndDisabledR } @Override - public List findJudgeDetails(final JudgeListDto dto) { + public List findJudgeDetails(final JudgeListDto dto) { BooleanBuilder builder = new BooleanBuilder(); - builder.and(minSimsa680.msSdate.gt(dto.getMsSdate()).or(minSimsa680.msSdate.eq(dto.getMsSdate()))); - builder.and(minSimsa680.msEdate.lt(dto.getMsEdate()).or(minSimsa680.msEdate.eq(dto.getMsEdate()))); + builder.and(minSimsa680Sc.msSdate.gt(dto.getMsSdate()).or(minSimsa680Sc.msSdate.eq(dto.getMsSdate()))); + builder.and(minSimsa680Sc.msEdate.lt(dto.getMsEdate()).or(minSimsa680Sc.msEdate.eq(dto.getMsEdate()))); if (!Checks.isEmpty(dto.getMsuTeam())) { - builder.and(minSimsaUser680.msuTeam.eq(dto.getMsuTeam())); + builder.and(minSimsaUser680Sc.msuTeam.eq(dto.getMsuTeam())); } - List rslt = + List rslt = queryFactory - .select(Projections.fields(MinSimsa680.class, - minSimsa680.msSeq, - minSimsa680.msCarnum, - minSimsa680.msMaincode)) - .from(minSimsaUser680) - .join(minSimsa680) - .on(minSimsa680.msMaincode.eq(minSimsaUser680.msuMaincode)) + .select(Projections.fields(JudgeDetailDto.class, + minSimsa680Sc.msSeq, + minSimsa680Sc.msCarnum, + minSimsa680Sc.msMaincode)) + .from(minSimsaUser680Sc) + .join(minSimsa680Sc) + .on(minSimsa680Sc.msMaincode.eq(minSimsaUser680Sc.msuMaincode)) .join(minUserinfo) - .on(minSimsaUser680.msuUserid.eq(minUserinfo.userid)) + .on(minSimsaUser680Sc.msuUserid.eq(minUserinfo.userid)) .where(builder) - .groupBy(minSimsa680.msCarnum, - minSimsa680.msSeq, - minSimsa680.msMaincode) - .orderBy(minSimsa680.msSeq.asc()) + .groupBy(minSimsa680Sc.msCarnum, + minSimsa680Sc.msSeq, + minSimsa680Sc.msMaincode) + .orderBy(minSimsa680Sc.msSeq.asc()) .fetch(); return rslt; 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 7463d44..2f80fd8 100644 --- a/src/main/java/com/xit/biz/ctgy/service/IResidentAndDisabledService.java +++ b/src/main/java/com/xit/biz/ctgy/service/IResidentAndDisabledService.java @@ -1,6 +1,7 @@ package com.xit.biz.ctgy.service; import com.xit.biz.ctgy.dto.GnRecallScDto; +import com.xit.biz.ctgy.dto.JudgeDetailDto; import com.xit.biz.ctgy.dto.JudgeListDto; import com.xit.biz.ctgy.dto.JudgeTargetDto; import com.xit.biz.ctgy.entity.MinSimsa680; @@ -10,6 +11,7 @@ import org.springframework.transaction.annotation.Transactional; import javax.validation.constraints.NotNull; import java.util.List; +import java.util.Map; /** * 거주자 / 장애인 의견 진술 @@ -54,9 +56,9 @@ public interface IResidentAndDisabledService { /** * 거주자 / 장애인 의견진술 심의등록 상세 목록 * @param dto JudgeListDto - * @return List + * @return Map */ - List findJudgeDetails(final JudgeListDto dto); + Map findJudgeDetails(final 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 95d777f..aa46ddf 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 @@ -15,6 +15,7 @@ import com.xit.biz.ctgy.service.IResidentAndDisabledService; import com.xit.core.constant.ErrorCode; import com.xit.core.exception.CustomBaseException; import com.xit.core.support.jpa.JpaUtil; +import com.xit.core.util.Checks; import com.xit.core.util.DateUtil; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; @@ -33,7 +34,9 @@ import javax.validation.constraints.NotNull; import java.io.File; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; +import java.util.HashMap; import java.util.List; +import java.util.Map; import java.util.stream.Collectors; @Service @@ -175,7 +178,34 @@ public class ResidentAndDisabledService implements IResidentAndDisabledService { } @Override - public List findJudgeDetails(JudgeListDto dto) { - return repository.findJudgeDetails(dto); + public Map findJudgeDetails(JudgeListDto dto) { + Map resultMap = new HashMap<>(); + + // team && 팀별 부과현황 조회 + Map teamMap = mapper.selectTotByJudgeTeamAndChasu(dto); + if(Checks.isEmpty(teamMap)) throw new CustomBaseException(ErrorCode.DATA_NOT_FOUND); + dto.setMsuTeam(String.valueOf(teamMap.get("msuTeam"))); + + List> totJudgeUserList = mapper.selectTotJudgeUsersByJudgeTeamAndChasu(dto); + totJudgeUserList.add(teamMap); + + List> judgeCarList = mapper.selectJudgeTargetByCarnum(dto); + Map paramMap = new HashMap<>(); + paramMap.put("msDatagb", dto.getMsDatagb()); + paramMap.put("msChasu", dto.getMsChasu()); + paramMap.put("msSdate", dto.getMsSdate()); + paramMap.put("msEdate", dto.getMsEdate()); + paramMap.put("msuTeam", dto.getMsuTeam()); + + List> resultList = judgeCarList.stream().peek((m) -> { + paramMap.put("msSeq", m.get("msSeq")); + paramMap.put("msCarnum", m.get("msCarnum")); + m.put("simsa", mapper.selectJudgeResultByCarnum(paramMap)); + }).collect(Collectors.toList()); + + resultMap.put("totUserList", totJudgeUserList); + resultMap.put("resultList", resultList); + + return resultMap; } } diff --git a/src/main/java/com/xit/core/support/CamelCaseLinkedMap.java b/src/main/java/com/xit/core/support/CamelCaseLinkedMap.java index 614b9c1..dbb8a6d 100644 --- a/src/main/java/com/xit/core/support/CamelCaseLinkedMap.java +++ b/src/main/java/com/xit/core/support/CamelCaseLinkedMap.java @@ -5,6 +5,7 @@ import org.springframework.jdbc.support.JdbcUtils; import java.util.LinkedHashMap; import java.util.Map; +@SuppressWarnings("rawtypes") public class CamelCaseLinkedMap extends LinkedHashMap { @Override diff --git a/src/main/java/com/xit/core/support/CamelCaseMap.java b/src/main/java/com/xit/core/support/CamelCaseMap.java index a6ce266..e13c5f5 100644 --- a/src/main/java/com/xit/core/support/CamelCaseMap.java +++ b/src/main/java/com/xit/core/support/CamelCaseMap.java @@ -4,7 +4,8 @@ import org.springframework.jdbc.support.JdbcUtils; import java.util.HashMap; -public class CamelCaseMap extends HashMap { +@SuppressWarnings("ALL") +public class CamelCaseMap extends HashMap { @Override public Object put(Object key, Object value){ diff --git a/src/main/resources/data/sql/거주자심의상세.sql b/src/main/resources/data/sql/거주자심의상세.sql index 59a78f2..ee88d7e 100644 --- a/src/main/resources/data/sql/거주자심의상세.sql +++ b/src/main/resources/data/sql/거주자심의상세.sql @@ -22,44 +22,53 @@ WHERE USERID = MSU_USERID AND MS_DATAGB = '1' AND MSU_TEAM = '003' AND MS_CHASU = 12 - AND MS_SDATE = '2021-09-10' - AND MS_EDATE = '2021-09-11' + AND MS_SDATE >= '2021-09-10' + AND MS_EDATE <= '2021-09-11' GROUP BY USERID, NAME ORDER BY USERID, NAME; SELECT MS_SEQ, MS_CARNUM, MS_MAINCODE -FROM MIN_USERINFO, +FROM -- MIN_USERINFO, MIN_SIMSA_USER680_SC, MIN_SIMSA680_SC -WHERE USERID = MSU_USERID - AND MS_MAINCODE = MSU_MAINCODE +WHERE MS_MAINCODE = MSU_MAINCODE AND MS_DATAGB = '1' AND MSU_TEAM = '003' AND MS_CHASU = 12 - AND MS_SDATE = '2021-09-10' - AND MS_EDATE = '2021-09-11' + AND MS_SDATE >= '2021-09-10' + AND MS_EDATE <= '2021-09-11' GROUP BY MS_CARNUM, MS_SEQ, MS_MAINCODE ORDER BY MS_SEQ; --- 부과여부 -SELECT MSU_MAINCODE, - USERID, - NAME, - (SELECT CDNAME FROM MIN_MAINCODE WHERE C2 = '5' AND C3 = MSU_RESULT) MSURESULT, - (SELECT CDNAME FROM MIN_MAINCODE WHERE C2 = '5' AND C3 = MS_RESULT) MSRESULT -FROM MIN_USERINFO, - MIN_SIMSA_USER680_SC, - MIN_SIMSA680_SC -WHERE USERID = MSU_USERID - AND MS_MAINCODE = MSU_MAINCODE - AND MS_DATAGB = '1' - AND MSU_TEAM = '003' - --AND MS_SEQ = - --AND MS_CARNUM = - AND MS_CHASU = 12 - AND MS_SDATE = '2021-09-10' - AND MS_EDATE = '2021-09-11' -ORDER BY USERID, NAME; +-- 심사자별 부과여부 +SELECT MSS.MS_MAINCODE, + MSU.MSU_USERID, + MU.NAME, + (SELECT CDNAME FROM MIN_MAINCODE WHERE C2 = '5' AND C3 = MSU.MSU_RESULT) MSURESULT, + (SELECT CDNAME FROM MIN_MAINCODE WHERE C2 = '5' AND C3 = MSS.MS_RESULT) MSRESULT +FROM MIN_SIMSA680_SC MSS, + MIN_SIMSA_USER680_SC MSU, + MIN_USERINFO MU, + ( + SELECT CODE_CD, CODE_NM + FROM TB_CMM_CODE_S + WHERE CODE_GRP_ID = 'TRAFFIC' + AND CODE_LCD = 'GANGNAM_SIMSA' + AND CODE_MCD = 'RESULT' + ) CC +WHERE MSS.MS_MAINCODE = MSU.MSU_MAINCODE + AND MSU.MSU_USERID = MU.USERID + AND MSS.MS_DATAGB = '1' + AND MSS.MS_CHASU = 12 + AND MSS.MS_SDATE >= '2021-09-10' + AND MSS.MS_EDATE <= '2021-09-11' + AND MSU.MSU_TEAM = '003' + AND MS_SEQ = 2021000018 + AND MS_CARNUM = '85조4947' + AND MS_MAINCODE = 3856 + AND MSS.MS_RESULT = CC.CODE_CD + AND MSU.MSU_RESULT = CC.CODE_CD +ORDER BY MU.USERID, MU.NAME; -- excel SELECT MS_SEQ, DECODE(MSU_RESULT, '2', 'O', '') BU, DECODE(MSU_RESULT, '1', 'O', '') MIBU, MSU_REASON diff --git a/src/main/resources/mybatis-mapper/biz/ctgy/residentanddisabled-mapper.xml b/src/main/resources/mybatis-mapper/biz/ctgy/residentanddisabled-mapper.xml index 246c2cb..58dc6d5 100644 --- a/src/main/resources/mybatis-mapper/biz/ctgy/residentanddisabled-mapper.xml +++ b/src/main/resources/mybatis-mapper/biz/ctgy/residentanddisabled-mapper.xml @@ -38,6 +38,94 @@ sc_datagb from gn_recall_sc where sc_code = #{scCode} - + + + + + + + + \ No newline at end of file