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 22d37e0..057d7c0 100644 --- a/src/main/java/com/xit/biz/ctgy/controller/ParkingController.java +++ b/src/main/java/com/xit/biz/ctgy/controller/ParkingController.java @@ -53,19 +53,19 @@ public class ParkingController { return RestResponse.of(service.findParkings(dto, pageable)); } - @Operation(summary = "주정차 의견진술 심의 목록-상세" , description = "주정차 의견진술 심의 목록-상세") + @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") }) - @GetMapping(value="/detail", produces = MediaType.APPLICATION_JSON_VALUE) - public ResponseEntity findParkingDetails( + @GetMapping(value="/result", produces = MediaType.APPLICATION_JSON_VALUE) + public ResponseEntity findParkingResults( @Valid @Parameter(hidden = true) final JudgeListDto dto) { - return RestResponse.of(service.findParkingDetails(dto)); + return RestResponse.of(service.findParkingResults(dto)); } @Operation(summary = "주정차 의견진술 심의대상 조회" , description = "주정차 의견진술 심의대상 조회") 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 63a2ec2..193d6c4 100644 --- a/src/main/java/com/xit/biz/ctgy/controller/ResidentAndDisabledController.java +++ b/src/main/java/com/xit/biz/ctgy/controller/ResidentAndDisabledController.java @@ -128,7 +128,7 @@ public class ResidentAndDisabledController { return RestResponse.of(service.findJudges(dto, pageable)); } - @Operation(summary = "거주자/장애인 의견진술 심의등록 상세 목록" , description = "거주자/장애인 의견진술 심의등록 상세 목록") + @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-09-10"), @@ -136,13 +136,13 @@ public class ResidentAndDisabledController { @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( + @GetMapping(value="/result", produces = MediaType.APPLICATION_JSON_VALUE) + public ResponseEntity findJudgeResults( @Valid @Parameter(hidden = true) final JudgeListDto dto) { AssertUtils.isTrue(!Checks.isEmpty(dto), "필수 검색 조건이 입력되지 않았습니다."); - return RestResponse.of(service.findJudgeDetails(dto)); + return RestResponse.of(service.findJudgeResults(dto)); } } 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 ee25546..29960e4 100644 --- a/src/main/java/com/xit/biz/ctgy/dto/JudgeListDto.java +++ b/src/main/java/com/xit/biz/ctgy/dto/JudgeListDto.java @@ -5,7 +5,6 @@ import io.swagger.v3.oas.annotations.media.Schema; import lombok.*; import javax.validation.constraints.Size; -import java.sql.Date; import java.time.LocalDate; @Schema(name = "JudgeListDto", description = "심의목록 조회: 주정차/거주자/장애인") @@ -40,5 +39,6 @@ public class JudgeListDto { @Schema(title = "데이타구분", example = "1", description = "데이타구분: 1-거주자,2-장애인") private String msDatagb; + @Schema(title = "심사팀코드", example = " ", description = "심사팀코드") private String msuTeam; } diff --git a/src/main/java/com/xit/biz/ctgy/mapper/IParkingMapper.java b/src/main/java/com/xit/biz/ctgy/mapper/IParkingMapper.java index 956801b..479e0b8 100644 --- a/src/main/java/com/xit/biz/ctgy/mapper/IParkingMapper.java +++ b/src/main/java/com/xit/biz/ctgy/mapper/IParkingMapper.java @@ -17,26 +17,33 @@ public interface IParkingMapper { * @param dto JudgeListDto * @return Map */ - Map selectTotByParkingJurgeTeamAndChasu(JudgeListDto dto); + Map selectTotParkingJudgeResultGroupByTeamAndChasu(JudgeListDto dto); + + /** + * 차수별 팀 조회 + * @param dto JudgeListDto + * @return List + */ + List> selectParkingJudgeTeamGroupByChasuAndTeamList(JudgeListDto dto); /** * 팀 && 차수 별 심사위원 심사 결과 * @param dto JudgeListDto * @return List */ - List> selectTotParkingUsersByJudgeTeamAndChasu(JudgeListDto dto); + List> selectTotParkingJudgeResultGroupByUser(JudgeListDto dto); /** * 심사대상 차량 정보 목록 * @param dto JudgeListDto * @return List */ - List> selectParkingJurgeTargetByCarnum(JudgeListDto dto); + List> selectParkingJurgeResultGroupByCarnum(JudgeListDto dto); /** * 차량별 심사위원 심사결과 목록 * @param map Map * @return List */ - List> selectParkingJudgeResultByCarnum(Map map); + List> selectParkingJudgeResultList(Map map); } 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 7c633c6..19a5494 100644 --- a/src/main/java/com/xit/biz/ctgy/mapper/IResidentAndDisabledMapper.java +++ b/src/main/java/com/xit/biz/ctgy/mapper/IResidentAndDisabledMapper.java @@ -2,11 +2,8 @@ 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; @@ -20,26 +17,33 @@ public interface IResidentAndDisabledMapper { * @param dto JudgeListDto * @return Map */ - Map selectTotByJudgeTeamAndChasu(JudgeListDto dto); + Map selectTotJudgeResultGroupByTeamAndChasu(JudgeListDto dto); + + /** + * 차수별 팀 조회 + * @param dto JudgeListDto + * @return List + */ + List> selectJudgeTeamGroupByChasuAndTeamList(JudgeListDto dto); /** * 팀 && 차수 별 심사위원 심사 결과 * @param dto JudgeListDto * @return List */ - List> selectTotJudgeUsersByJudgeTeamAndChasu(JudgeListDto dto); + List> selectTotJudgeResultGroupByUser(JudgeListDto dto); /** * 심사대상 차량 정보 목록 * @param dto JudgeListDto * @return List */ - List> selectJudgeTargetByCarnum(JudgeListDto dto); + List> selectJudgeResultGroupByCarnum(JudgeListDto dto); /** * 차량별 심사위원 심사결과 목록 * @param map Map * @return List */ - List> selectJudgeResultByCarnum(Map map); + List> selectJudgeResultList(Map map); } 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 01e31f6..327e6d5 100644 --- a/src/main/java/com/xit/biz/ctgy/repository/IResidentAndDisabledRepositoryImpl.java +++ b/src/main/java/com/xit/biz/ctgy/repository/IResidentAndDisabledRepositoryImpl.java @@ -68,6 +68,7 @@ public class IResidentAndDisabledRepositoryImpl implements IResidentAndDisabledR gnRecallSc.scIngb, gnRecallSc.scDatagb, gnRecallSc.scCdate, + gnRecallSc.scState, ExpressionUtils.as( JPAExpressions.select(cmmCodeS.codeNm) .from(cmmCodeS) diff --git a/src/main/java/com/xit/biz/ctgy/service/IParkingService.java b/src/main/java/com/xit/biz/ctgy/service/IParkingService.java index 8c31a8e..3791c25 100644 --- a/src/main/java/com/xit/biz/ctgy/service/IParkingService.java +++ b/src/main/java/com/xit/biz/ctgy/service/IParkingService.java @@ -13,11 +13,11 @@ public interface IParkingService { Page findParkings(final JudgeListDto dto, Pageable pageable); /** - * 주정차 의견진술 심의등록 상세 목록 + * 주정차 의견진술 심의 결과 목록 * @param dto JudgeListDto * @return Map */ - Map findParkingDetails(final JudgeListDto dto); + Map findParkingResults(final JudgeListDto dto); List findParkingJudgeTargets(final ParkingTargetDto 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 index 2f80fd8..faf677c 100644 --- a/src/main/java/com/xit/biz/ctgy/service/IResidentAndDisabledService.java +++ b/src/main/java/com/xit/biz/ctgy/service/IResidentAndDisabledService.java @@ -1,13 +1,10 @@ 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; import org.springframework.data.domain.Page; import org.springframework.data.domain.Pageable; -import org.springframework.transaction.annotation.Transactional; import javax.validation.constraints.NotNull; import java.util.List; @@ -54,11 +51,11 @@ public interface IResidentAndDisabledService { Page findJudges(JudgeListDto dto, Pageable pageable); /** - * 거주자 / 장애인 의견진술 심의등록 상세 목록 + * 거주자 / 장애인 의견진술 심의 결과 목록 * @param dto JudgeListDto * @return Map */ - Map findJudgeDetails(final JudgeListDto dto); + Map findJudgeResults(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 89d979f..38fcb2f 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 @@ -54,18 +54,22 @@ public class ParkingService implements IParkingService { } @Override - public Map findParkingDetails(JudgeListDto dto) { + public Map findParkingResults(JudgeListDto dto) { Map resultMap = new HashMap<>(); - // team && 팀별 부과현황 조회 - Map teamMap = mapper.selectTotByParkingJurgeTeamAndChasu(dto); - if(Checks.isEmpty(teamMap)) throw new CustomBaseException(ErrorCode.DATA_NOT_FOUND); - dto.setMsuTeam(String.valueOf(teamMap.get("msuTeam"))); + // team && 팀별 부과현황 조회 : 팀이 선택되지 않은 경우 모두 +// Map teamMap = mapper.selectTotParkingJudgeResultGroupByTeamAndChasu(dto); +// if (Checks.isEmpty(teamMap)) throw new CustomBaseException(ErrorCode.DATA_NOT_FOUND); +// List> totJudgeUserList = mapper.selectTotParkingJudgeResultGroupByUser(dto); +// totJudgeUserList.add(teamMap); - List> totJudgeUserList = mapper.selectTotParkingUsersByJudgeTeamAndChasu(dto); - totJudgeUserList.add(teamMap); + List> teamList = mapper.selectParkingJudgeTeamGroupByChasuAndTeamList(dto); + if (Checks.isEmpty(teamList) || teamList.size() == 0) throw new CustomBaseException(ErrorCode.DATA_NOT_FOUND); + dto.setMsuTeam(String.valueOf(teamList.get(0).get("msuTeam"))); + List> totJudgeUserList = mapper.selectTotParkingJudgeResultGroupByUser(dto); + totJudgeUserList.add(teamList.get(0)); - List> judgeCarList = mapper.selectParkingJurgeTargetByCarnum(dto); + List> judgeCarList = mapper.selectParkingJurgeResultGroupByCarnum(dto); Map paramMap = new HashMap<>(); paramMap.put("msDatagb", dto.getMsDatagb()); paramMap.put("msChasu", dto.getMsChasu()); @@ -76,7 +80,7 @@ public class ParkingService implements IParkingService { List> resultList = judgeCarList.stream().peek((m) -> { paramMap.put("msSeq", m.get("msSeq")); paramMap.put("msCarnum", m.get("msCarnum")); - m.put("simsa", mapper.selectParkingJudgeResultByCarnum(paramMap)); + m.put("simsa", mapper.selectParkingJudgeResultList(paramMap)); // Map usersMap = mapper.selectJudgeResultByCarnum(paramMap) // .stream() // .reduce((preMap, curMap) -> { 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 f917f8d..269dcf8 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 @@ -60,7 +60,7 @@ public class ResidentAndDisabledService implements IResidentAndDisabledService { private final IMinUserRepository userRepository; private final IJudgeUserRepository judgeUserRepository; - private final IResidentAndDisabledMapper mapper; + private final IResidentAndDisabledMapper residentAndDisabledMapper; @Override @Transactional(readOnly = true) @@ -140,7 +140,7 @@ public class ResidentAndDisabledService implements IResidentAndDisabledService { dto.setMsResult("0"); isFirst = false; } - mapper.insertJudgeTargetIntoSelect(dto); + residentAndDisabledMapper.insertJudgeTargetIntoSelect(dto); //--------------------------------------------------------- // 등록한 심사대상 데이타 등록 상태 변경 : 미접수 -> 접수 @@ -180,18 +180,22 @@ public class ResidentAndDisabledService implements IResidentAndDisabledService { } @Override - public Map findJudgeDetails(JudgeListDto dto) { + public Map findJudgeResults(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"))); + // team && 팀별 부과현황 조회 : 팀이 선택되지 않은 경우 모두 +// Map teamMap = residentAndDisabledMapper.selectTotJudgeResultGroupByTeamAndChasu(dto); +// if (Checks.isEmpty(teamMap)) throw new CustomBaseException(ErrorCode.DATA_NOT_FOUND); +// List> totJudgeUserList = residentAndDisabledMapper.selectTotJudgeResultGroupByUser(dto); +// totJudgeUserList.add(teamMap); - List> totJudgeUserList = mapper.selectTotJudgeUsersByJudgeTeamAndChasu(dto); - totJudgeUserList.add(teamMap); + List> teamList = residentAndDisabledMapper.selectJudgeTeamGroupByChasuAndTeamList(dto); + if (Checks.isEmpty(teamList) || teamList.size() == 0) throw new CustomBaseException(ErrorCode.DATA_NOT_FOUND); + dto.setMsuTeam(String.valueOf(teamList.get(0).get("msuTeam"))); + List> totJudgeUserList = residentAndDisabledMapper.selectTotJudgeResultGroupByUser(dto); + totJudgeUserList.add(teamList.get(0)); - List> judgeCarList = mapper.selectJudgeTargetByCarnum(dto); + List> judgeCarList = residentAndDisabledMapper.selectJudgeResultGroupByCarnum(dto); Map paramMap = new HashMap<>(); paramMap.put("msDatagb", dto.getMsDatagb()); paramMap.put("msChasu", dto.getMsChasu()); @@ -202,7 +206,7 @@ public class ResidentAndDisabledService implements IResidentAndDisabledService { List> resultList = judgeCarList.stream().peek((m) -> { paramMap.put("msSeq", m.get("msSeq")); paramMap.put("msCarnum", m.get("msCarnum")); - m.put("simsa", mapper.selectJudgeResultByCarnum(paramMap)); + m.put("simsa", residentAndDisabledMapper.selectJudgeResultList(paramMap)); // Map usersMap = mapper.selectJudgeResultByCarnum(paramMap) // .stream() // .reduce((preMap, curMap) -> { diff --git a/src/main/resources/mybatis-mapper/biz/ctgy/parking-mapper.xml b/src/main/resources/mybatis-mapper/biz/ctgy/parking-mapper.xml index b0bb77a..f5f6f09 100644 --- a/src/main/resources/mybatis-mapper/biz/ctgy/parking-mapper.xml +++ b/src/main/resources/mybatis-mapper/biz/ctgy/parking-mapper.xml @@ -42,8 +42,27 @@ on TJ.mj_dong = TD.do_code - + /* parking-mapper|selectTotParkingJudgeResultGroupByTeamAndChasu|julim */ + SELECT NVL(SUM(DECODE(MS.ms_result, '2', 1, 0)), 0) bu + , 0 as seo + , NVL(SUM(DECODE(MS.ms_result, '1', 1, 0)), 0) mibu + , NVL(SUM(DECODE(MS.ms_result, '1', 1, '2', 1, 0)), 0) tot + , '결과' as name + FROM min_simsa680 MS, + msu680_view MV + WHERE MS.ms_maincode = MV.msu_maincode + + AND MV.msu_team = #{msuTeam} + + AND MS.ms_chasu = #{msChasu} + AND MS.ms_sdate >= #{msSdate} + AND MS.ms_edate <= #{msEdate} + GROUP BY MS.ms_chasu + + + - + /* parking-mapper|selectTotParkingJudgeResultByUser|julim */ SELECT SUM(DECODE(MSU_RESULT, '2', 1, 0)) bu , 0 as seo , SUM(DECODE(MSU_RESULT, '1', 1, 0)) mibu @@ -76,14 +96,16 @@ AND MS.ms_chasu = #{msChasu} AND MS.ms_sdate >= #{msSdate} AND MS.ms_edate <= #{msEdate} - AND MSU.msu_team = #{msuTeam} AND MSU.msu_userid = MU.userid + + AND MSU.msu_team = #{msuTeam} + GROUP BY MSU.msu_userid, MU.name ORDER BY MSU.msu_userid, MU.name - + /* parking-mapper|selectParkingJurgeResultGroupByCarnum|julim */ SELECT MS.ms_maincode , MS.ms_seq , MS.ms_carnum @@ -93,12 +115,14 @@ AND MS.ms_chasu = #{msChasu} AND MS.ms_sdate >= #{msSdate} AND MS.ms_edate <= #{msEdate} + AND MSU.msu_team = #{msuTeam} + GROUP BY MS.ms_maincode, MS.ms_seq, MS.ms_carnum - + /* parking-mapper|selectParkingJudgeResultList|julim */ SELECT MS.ms_maincode , MS.ms_seq , MS.ms_carnum @@ -124,7 +148,9 @@ AND MS.ms_edate <= #{msEdate} AND MS.ms_seq = #{msSeq} AND MS.ms_carnum = #{msCarnum} + AND MSU.msu_team = #{msuTeam} + AND MSU.msu_userid = MU.userid ORDER BY MSU.msu_userid, MU.name 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 f889f49..c0c8352 100644 --- a/src/main/resources/mybatis-mapper/biz/ctgy/residentanddisabled-mapper.xml +++ b/src/main/resources/mybatis-mapper/biz/ctgy/residentanddisabled-mapper.xml @@ -40,9 +40,14 @@ where sc_code = #{scCode} - + /* residentanddisabled-mapper|selectTotJudgeResultGroupByTeamAndChasu|julim */ + SELECT + MSV.msu_team + + + '' + , NVL(SUM(DECODE(MSS.ms_result, '2', 1, 0)), 0) bu , 0 as seo , NVL(SUM(DECODE(MSS.ms_result, '1', 1, 0)), 0) mibu @@ -61,8 +66,29 @@ GROUP BY MSV.msu_team, MSS.ms_chasu - + /* residentanddisabled-mapper|selectJudgeTeamGroupByChasuAndTeamList|julim */ + SELECT MSV.msu_team + , NVL(SUM(DECODE(MSS.ms_result, '2', 1, 0)), 0) bu + , 0 as seo + , NVL(SUM(DECODE(MSS.ms_result, '1', 1, 0)), 0) mibu + , NVL(SUM(DECODE(MSS.ms_result, '1', 1, '2', 1, 0)), 0) tot + , '결과' as name + FROM min_simsa680_sc MSS, + msu680_sc_view MSV + WHERE MSS.ms_maincode = MSV.msu_maincode + + AND MSV.msu_team = #{msuTeam} + + AND MSS.ms_chasu = #{msChasu} + AND MSS.ms_sdate >= #{msSdate} + AND MSS.ms_edate <= #{msEdate} + GROUP BY MSS.ms_chasu, MSV.msu_team + ORDER BY MSS.ms_chasu, MSV.msu_team + + + - + /* residentanddisabled-mapper|selectJudgeResultGroupByCarnum|julim */ SELECT MSS.ms_maincode , MSS.ms_seq , MSS.ms_carnum @@ -94,12 +122,14 @@ AND MSS.ms_chasu = #{msChasu} AND MSS.ms_sdate >= #{msSdate} AND MSS.ms_edate <= #{msEdate} + AND MSU.msu_team = #{msuTeam} + GROUP BY MSS.ms_maincode, MSS.ms_seq, MSS.ms_carnum - + /* residentanddisabled-mapper|selectJudgeResultList|julim */ SELECT MSS.ms_maincode , MSS.ms_seq , MSS.ms_carnum @@ -126,7 +156,9 @@ AND MSS.ms_edate <= #{msEdate} AND MSS.ms_seq = #{msSeq} AND MSS.ms_carnum = #{msCarnum} + AND MSU.msu_team = #{msuTeam} + AND MSU.msu_userid = MU.userid ORDER BY MSU.msu_userid, MU.name