From 4d144db227d3c90262fbada3d862a03fd5304346 Mon Sep 17 00:00:00 2001 From: minuk926 Date: Fri, 15 Apr 2022 18:31:31 +0900 Subject: [PATCH] =?UTF-8?q?fix:=20=EC=8B=AC=EC=82=AC=EA=B2=B0=EA=B3=BC=20?= =?UTF-8?q?=EB=B0=98=EC=98=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../xit/biz/ctgy/mapper/IParkingMapper.java | 1 + .../mapper/IResidentAndDisabledMapper.java | 1 + .../biz/ctgy/service/impl/ParkingService.java | 38 ++++---- .../impl/ResidentAndDisabledService.java | 40 +++++---- .../biz/ctgy/parking-mapper.xml | 86 ++++++++++++++----- .../biz/ctgy/residentanddisabled-mapper.xml | 74 ++++++++++++---- 6 files changed, 172 insertions(+), 68 deletions(-) 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 479e0b8..f4c7321 100644 --- a/src/main/java/com/xit/biz/ctgy/mapper/IParkingMapper.java +++ b/src/main/java/com/xit/biz/ctgy/mapper/IParkingMapper.java @@ -46,4 +46,5 @@ public interface IParkingMapper { * @return List */ List> selectParkingJudgeResultList(Map map); + List> selectParkingJudgeResultList2(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 19a5494..ec19118 100644 --- a/src/main/java/com/xit/biz/ctgy/mapper/IResidentAndDisabledMapper.java +++ b/src/main/java/com/xit/biz/ctgy/mapper/IResidentAndDisabledMapper.java @@ -46,4 +46,5 @@ public interface IResidentAndDisabledMapper { * @return List */ List> selectJudgeResultList(Map map); + List> selectJudgeResultList2(Map map); } 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 38fcb2f..6acffaa 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 @@ -65,33 +65,39 @@ public class ParkingService implements IParkingService { 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.selectParkingJurgeResultGroupByCarnum(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.selectParkingJudgeResultList(paramMap)); -// Map usersMap = mapper.selectJudgeResultByCarnum(paramMap) -// .stream() -// .reduce((preMap, curMap) -> { -// preMap.putAll(curMap); -// return preMap; -// }).orElse(null); -// m.putAll(usersMap); - }).collect(Collectors.toList()); - - resultMap.put("totData", totJudgeUserList); - resultMap.put("judgeData", resultList); + paramMap.put("seqList", judgeCarList.stream().map(m -> m.get("msSeq")).collect(Collectors.toList())); + paramMap.put("carnumList", judgeCarList.stream().map(m -> m.get("msCarnum")).collect(Collectors.toList())); + + List> jurgeUserList = mapper.selectParkingJudgeResultList(paramMap); +// List> resultList = judgeCarList.stream().peek((m) -> { +// paramMap.put("msSeq", m.get("msSeq")); +// paramMap.put("msCarnum", m.get("msCarnum")); +// m.put("simsa", mapper.selectParkingJudgeResultList(paramMap)); +// }).collect(Collectors.toList()); + + resultMap.put("teamList", teamList); + // 차수별 심사자별 심사결과 합산 + resultMap.put("totJudgeUserData", totJudgeUserList); + // 심사대상 차량 목록 + resultMap.put("judgeCarData", judgeCarList); + // 차량별 심사자 심사결과 목록 + resultMap.put("judgeUserData", jurgeUserList); return resultMap; } 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 269dcf8..373d9b6 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 @@ -30,6 +30,7 @@ import org.springframework.transaction.annotation.Transactional; import org.springframework.util.StringUtils; import org.springframework.web.multipart.MultipartFile; +import javax.persistence.EntityManager; import javax.validation.constraints.NotNull; import java.io.File; import java.lang.reflect.InvocationTargetException; @@ -62,6 +63,8 @@ public class ResidentAndDisabledService implements IResidentAndDisabledService { private final IResidentAndDisabledMapper residentAndDisabledMapper; + private final EntityManager entityManager; + @Override @Transactional(readOnly = true) public Page findJudgeDatas(@NotNull final String scDatagb, Pageable pageable) { @@ -191,11 +194,16 @@ public class ResidentAndDisabledService implements IResidentAndDisabledService { 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 = residentAndDisabledMapper.selectJudgeResultGroupByCarnum(dto); + + // 차량별 심사자 심사결과 목록 Map paramMap = new HashMap<>(); paramMap.put("msDatagb", dto.getMsDatagb()); paramMap.put("msChasu", dto.getMsChasu()); @@ -203,22 +211,24 @@ public class ResidentAndDisabledService implements IResidentAndDisabledService { 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", residentAndDisabledMapper.selectJudgeResultList(paramMap)); -// Map usersMap = mapper.selectJudgeResultByCarnum(paramMap) -// .stream() -// .reduce((preMap, curMap) -> { -// preMap.putAll(curMap); -// return preMap; -// }).orElse(null); -// m.putAll(usersMap); - }).collect(Collectors.toList()); - - resultMap.put("totData", totJudgeUserList); - resultMap.put("judgeData", resultList); + paramMap.put("seqList", judgeCarList.stream().map(m -> m.get("msSeq")).collect(Collectors.toList())); + paramMap.put("carnumList", judgeCarList.stream().map(m -> m.get("msCarnum")).collect(Collectors.toList())); + List> jurgeUserList = residentAndDisabledMapper.selectJudgeResultList(paramMap); + +// List> resultList = judgeCarList.stream().peek((m) -> { +// paramMap.put("msSeq", m.get("msSeq")); +// paramMap.put("msCarnum", m.get("msCarnum")); +// m.put("simsa", residentAndDisabledMapper.selectJudgeResultList(paramMap)); +// }).collect(Collectors.toList()); + + resultMap.put("teamList", teamList); + // 차수별 심사자별 심사결과 합산 + resultMap.put("totJudgeUserData", totJudgeUserList); + // 심사대상 차량 목록 + resultMap.put("judgeCarData", judgeCarList); + // 차량별 심사자 심사결과 목록 + resultMap.put("judgeUserData", jurgeUserList); return resultMap; } } 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 f5f6f09..8c30e7e 100644 --- a/src/main/resources/mybatis-mapper/biz/ctgy/parking-mapper.xml +++ b/src/main/resources/mybatis-mapper/biz/ctgy/parking-mapper.xml @@ -49,8 +49,8 @@ , 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 + FROM min_simsa680 MS + , msu680_view MV WHERE MS.ms_maincode = MV.msu_maincode AND MV.msu_team = #{msuTeam} @@ -69,8 +69,8 @@ , 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 + FROM min_simsa680 MS + , msu680_view MV WHERE MS.ms_maincode = MV.msu_maincode AND MV.msu_team = #{msuTeam} @@ -89,19 +89,19 @@ , SUM(DECODE(MSU_RESULT, '1', 1, 0)) mibu , SUM(DECODE(MSU_RESULT, '1', 1, '2', 1, 0)) tot , MU.name - FROM min_simsa680 MS, - min_simsa_user680 MSU, - min_userinfo MU - WHERE MS.ms_maincode = MSU.msu_maincode - AND MS.ms_chasu = #{msChasu} - AND MS.ms_sdate >= #{msSdate} - AND MS.ms_edate <= #{msEdate} - 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 + FROM min_simsa680 MS + , min_simsa_user680 MSU + , min_userinfo MU + WHERE MS.ms_maincode = MSU.msu_maincode + AND MS.ms_chasu = #{msChasu} + AND MS.ms_sdate >= #{msSdate} + AND MS.ms_edate <= #{msEdate} + 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 + + + + - /* residentanddisabled-mapper|selectJudgeResultList|julim */ SELECT MSS.ms_maincode , MSS.ms_seq @@ -146,9 +190,9 @@ AND code_lcd = 'GANGNAM_SIMSA' AND code_mcd = 'RESULT' AND code_cd = MSU.msu_result) as msu_result - FROM min_simsa680_sc MSS, - min_simsa_user680_sc MSU, - min_userinfo MU + FROM min_simsa680_sc MSS + , min_simsa_user680_sc MSU + , min_userinfo MU WHERE MSS.ms_maincode = MSU.msu_maincode AND MSS.ms_datagb = #{msDatagb} AND MSS.ms_chasu = #{msChasu} @@ -160,6 +204,6 @@ AND MSU.msu_team = #{msuTeam} AND MSU.msu_userid = MU.userid - ORDER BY MSU.msu_userid, MU.name + ORDER BY MSU.msu_userid, MU.name, MSS.ms_maincode, MSS.ms_seq, MSS.ms_carnum \ No newline at end of file