From 8371c2dd4d46fcb7e251370e1b6b474162fee700 Mon Sep 17 00:00:00 2001 From: "Jonguk. Lim" Date: Sun, 3 Jul 2022 03:21:07 +0900 Subject: [PATCH] =?UTF-8?q?feat:=20mpower=20=EC=A0=81=EC=9A=A9=20-=20?= =?UTF-8?q?=EA=B1=B0=EC=A3=BC=EC=9E=90=20/=20=EC=9E=A5=EC=95=A0=EC=9D=B8?= =?UTF-8?q?=20-=20=EC=8B=AC=EC=9D=98=EB=AA=A9=EB=A1=9D=20=EC=82=AD?= =?UTF-8?q?=EC=A0=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/com/xit/Application.java | 2 +- .../ResidentAndDisabledController.java | 9 ++ .../biz/ctgy/v2/repository/ParkingDao.java | 41 ++++-- .../v2/repository/ResidentAndDisabledDao.java | 110 ++++++++++++++++ .../service/IResidentAndDisabledService.java | 2 +- .../ctgy/v2/service/impl/ParkingService.java | 11 +- .../impl/ResidentAndDisabledService.java | 122 +++++++++--------- .../config/database/BaseMpowerDaoSupport.java | 32 +++++ .../config/database/DataSourceConfig.java | 2 +- .../support/CustomBeanNameGenerator.java | 44 +++++++ src/main/resources/sql/parking-mapper.xml | 46 +++++-- .../sql/residentAndDisabled-mapper.xml | 120 ++++++++++------- 12 files changed, 395 insertions(+), 146 deletions(-) diff --git a/src/main/java/com/xit/Application.java b/src/main/java/com/xit/Application.java index 64f75af..03a28b6 100644 --- a/src/main/java/com/xit/Application.java +++ b/src/main/java/com/xit/Application.java @@ -35,7 +35,7 @@ import java.io.IOException; AppProperties.class }) @ComponentScan( - //nameGenerator = CustomBeanNameGenerator.class, + nameGenerator = CustomBeanNameGenerator.class, basePackages = {"com.xit.biz", "com.xit.core"}, excludeFilters = @ComponentScan.Filter( type = FilterType.ASPECTJ, diff --git a/src/main/java/com/xit/biz/ctgy/v2/controller/ResidentAndDisabledController.java b/src/main/java/com/xit/biz/ctgy/v2/controller/ResidentAndDisabledController.java index 776a9e2..60c5bb2 100644 --- a/src/main/java/com/xit/biz/ctgy/v2/controller/ResidentAndDisabledController.java +++ b/src/main/java/com/xit/biz/ctgy/v2/controller/ResidentAndDisabledController.java @@ -1,5 +1,6 @@ package com.xit.biz.ctgy.v2.controller; +import com.xit.biz.ctgy.CtgyConstants; import com.xit.biz.ctgy.dto.GnRecallScDto; import com.xit.biz.ctgy.dto.JudgeListDto; import com.xit.biz.ctgy.dto.JudgeStdDto; @@ -175,6 +176,14 @@ public class ResidentAndDisabledController { return RestResponse.of(HttpStatus.OK); } + @Secured(policy = SecurityPolicy.TOKEN) + @Operation(summary = "거주자/장애인 의견진술 심의목록 삭제" , description = "거주자/장애인 의견진술 심의목록 삭제") + @PostMapping(value="/admin/remove", produces = MediaType.APPLICATION_JSON_VALUE) + public ResponseEntity removeJudge(final JudgeListDto dto) { + service.removeJudge(dto); + return RestResponse.of(HttpStatus.OK); + } + @Secured(policy = SecurityPolicy.TOKEN) @Operation(summary = "dashboard" , description = "dashboard") @GetMapping(value="/dashboard", produces = MediaType.APPLICATION_JSON_VALUE) diff --git a/src/main/java/com/xit/biz/ctgy/v2/repository/ParkingDao.java b/src/main/java/com/xit/biz/ctgy/v2/repository/ParkingDao.java index f70c2c8..97b59e6 100644 --- a/src/main/java/com/xit/biz/ctgy/v2/repository/ParkingDao.java +++ b/src/main/java/com/xit/biz/ctgy/v2/repository/ParkingDao.java @@ -159,15 +159,34 @@ public class ParkingDao extends BaseMpowerDaoSupport { ); } } -// -// public List findAllMsMaincode(Long msChasu, LocalDate msSdate, LocalDate msEdate) { -// return null; -// } -// -// public void deleteById(Long msMaincode) { -// } -// -// public List findByUserJudges() { -// return null; -// } + + public List findAllMsMaincode(@NotNull final ParkingTargetDto dto) { + final String sql = QueryGenerator.createNamedQuery(NAME_SPACE, "selectRemoveJudgeTgtList") + .setParameter("msChasu", dto.getMsChasu()) + .setParameter("msSdate", dto.getMsSdate()) + .setParameter("msEdate", dto.getMsEdate()) + .getQueryString(); + return selectOneColumnLongList(sql); + } + + public void deleteJudgeUser(@NotNull final Long msMaincode) { + final String sql = QueryGenerator.createNamedQuery(NAME_SPACE, "deleteJudgeUser") + .setParameter("msMaincode", msMaincode) + .getQueryString(); + delete(sql); + } + + public void updateRcIrTransferAndRcState(@NotNull final Long msMaincode) { + final String sql = QueryGenerator.createNamedQuery(NAME_SPACE, "updateJudgeTgtReset") + .setParameter("msMaincode", msMaincode) + .getQueryString(); + update(sql); + } + + public void deleteJudgeTgt(@NotNull final Long msMaincode) { + final String sql = QueryGenerator.createNamedQuery(NAME_SPACE, "deleteJudgeTgt") + .setParameter("msMaincode", msMaincode) + .getQueryString(); + delete(sql); + } } diff --git a/src/main/java/com/xit/biz/ctgy/v2/repository/ResidentAndDisabledDao.java b/src/main/java/com/xit/biz/ctgy/v2/repository/ResidentAndDisabledDao.java index 854d4c0..280f122 100644 --- a/src/main/java/com/xit/biz/ctgy/v2/repository/ResidentAndDisabledDao.java +++ b/src/main/java/com/xit/biz/ctgy/v2/repository/ResidentAndDisabledDao.java @@ -1,18 +1,95 @@ package com.xit.biz.ctgy.v2.repository; +import com.xit.biz.ctgy.dto.JudgeListDto; import com.xit.biz.ctgy.dto.JudgeTargetDto; import com.xit.biz.ctgy.entity.MinSimsaUser680Sc; import com.xit.core.config.database.BaseMpowerDaoSupport; import com.xit.core.support.sql.parser.QueryGenerator; +import org.springframework.data.domain.Page; +import org.springframework.data.domain.Pageable; import org.springframework.stereotype.Repository; import javax.validation.constraints.NotNull; +import java.time.LocalDate; import java.util.List; +import java.util.Map; @Repository public class ResidentAndDisabledDao extends BaseMpowerDaoSupport { private static final String NAME_SPACE = "residentAndDisabled"; + public Page findJudges(JudgeListDto dto, Pageable pageable) { + final String cntSql = QueryGenerator.createNamedQuery(NAME_SPACE, "selectJudgeListCnt") + .setParameter("msYear", dto.getMsYear()) + .setParameter("msChasu", dto.getMsChasu()) + .getQueryString(); + + final String listSql = QueryGenerator.createNamedQuery(NAME_SPACE, "selectJudgeList") + .setParameter("msYear", dto.getMsYear()) + .setParameter("msChasu", dto.getMsChasu()) + .setParameter("page", pageable.getPageNumber()) + .setParameter("size", pageable.getPageSize()) + .getQueryString(); + final String fieldStrs = "msYear, msChasu, msSdate, msStartsi, msEdate, msCdate, msClosesi, cnt"; + + return selectList(JudgeListDto.class, listSql, cntSql, fieldStrs, pageable); + } + + public List> selectJudgeTeamGroupByChasuAndTeamList(@NotNull final JudgeListDto dto) { + final String listSql = QueryGenerator.createNamedQuery(NAME_SPACE, "selectTotJudgeResultGroupByTeamAndChasu") + .setParameter("msuTeam", dto.getMsuTeam()) + .setParameter("msDatagb", dto.getMsDatagb()) + .setParameter("msChasu", dto.getMsChasu()) + .setParameter("msSdate", dto.getMsSdate()) + .setParameter("msEdate", dto.getMsEdate()) + .getQueryString(); + final String fieldStrs = "msuTeam, BU, SEO, MIBU, TOT, NAME"; + + return selectMapList(listSql, fieldStrs); + } + + public List> selectJudgeResultGroupByCarnum(@NotNull final JudgeListDto dto) { + final String listSql = QueryGenerator.createNamedQuery(NAME_SPACE, "selectParkingJurgeResultGroupByCarnum") + .setParameter("msuTeam", dto.getMsuTeam()) + .setParameter("msDatagb", dto.getMsDatagb()) + .setParameter("msChasu", dto.getMsChasu()) + .setParameter("msSdate", dto.getMsSdate()) + .setParameter("msEdate", dto.getMsEdate()) + .getQueryString(); + final String fieldsStrs = "msMaincode, msSeq, msCarnum"; + + return selectMapList(listSql, fieldsStrs); + } + + public List> selectTotJudgeResultGroupByUser(@NotNull final JudgeListDto dto) { + final String listSql = QueryGenerator.createNamedQuery(NAME_SPACE, "selectTotParkingJudgeResultGroupByUser") + .setParameter("msuTeam", dto.getMsuTeam()) + .setParameter("msDatagb", dto.getMsDatagb()) + .setParameter("msChasu", dto.getMsChasu()) + .setParameter("msSdate", dto.getMsSdate()) + .setParameter("msEdate", dto.getMsEdate()) + .getQueryString(); + final String fieldStrs = "BU, SEO, MIBU, TOT, NAME"; + + return selectMapList(listSql, fieldStrs); + } + + public List> selectJudgeResultList(@NotNull final Map paramMap) { + final String listSql = QueryGenerator.createNamedQuery(NAME_SPACE, "selectParkingJudgeResultList") + .setParameter("msDatagb", (String)paramMap.get("msDatagb")) + .setParameter("msuTeam", (String)paramMap.get("msuTeam")) + .setParameter("msChasu", (Long)paramMap.get("msChasu")) + .setParameter("msSdate", (LocalDate)paramMap.get("msSdate")) + .setParameter("msEdate", (LocalDate) paramMap.get("msEdate")) + .setParameter("seqList", (List)paramMap.get("seqList")) + .setParameter("carnumList", (List)paramMap.get("carnumList")) + .getQueryString(); + final String fieldsStrs = "msMaincode, msSeq, msCarnum, NAME, msResult, msResultNm, msuResult"; + + return selectMapList(listSql, fieldsStrs); + } + + public int getJudgeStdCnt(@NotNull final Long msMaincode) { final String sql = QueryGenerator.createNamedQuery(NAME_SPACE, "selectJudegStdCount") .setParameter("msMaincode", msMaincode) @@ -79,4 +156,37 @@ public class ResidentAndDisabledDao extends BaseMpowerDaoSupport { ); } } + + + public List findAllMsMaincode(@NotNull final JudgeListDto dto) { + final String sql = QueryGenerator.createNamedQuery(NAME_SPACE, "selectRemoveJudgeTgtList") + .setParameter("msDatagb", dto.getMsDatagb()) + .setParameter("msChasu", dto.getMsChasu()) + .setParameter("msSdate", dto.getMsSdate()) + .setParameter("msEdate", dto.getMsEdate()) + .getQueryString(); + return selectOneColumnLongList(sql); + } + + public void deleteJudgeUser(@NotNull final Long msMaincode) { + final String sql = QueryGenerator.createNamedQuery(NAME_SPACE, "deleteJudgeUser") + .setParameter("msMaincode", msMaincode) + .getQueryString(); + delete(sql); + } + + public void updateScTransferAndScState(@NotNull final String msDatagb, @NotNull final Long msMaincode) { + final String sql = QueryGenerator.createNamedQuery(NAME_SPACE, "updateJudgeTgtReset") + .setParameter("scDatagb", msDatagb) + .setParameter("msMaincode", msMaincode) + .getQueryString(); + update(sql); + } + + public void deleteJudgeTgt(@NotNull final Long msMaincode) { + final String sql = QueryGenerator.createNamedQuery(NAME_SPACE, "deleteJudgeTgt") + .setParameter("msMaincode", msMaincode) + .getQueryString(); + delete(sql); + } } diff --git a/src/main/java/com/xit/biz/ctgy/v2/service/IResidentAndDisabledService.java b/src/main/java/com/xit/biz/ctgy/v2/service/IResidentAndDisabledService.java index 4301615..bed1e04 100644 --- a/src/main/java/com/xit/biz/ctgy/v2/service/IResidentAndDisabledService.java +++ b/src/main/java/com/xit/biz/ctgy/v2/service/IResidentAndDisabledService.java @@ -61,7 +61,7 @@ public interface IResidentAndDisabledService { * @return Map */ Map findJudgeResults(final JudgeListDto dto); - Map findJudgeResults2(final JudgeListDto dto); + //Map findJudgeResults2(final JudgeListDto dto); /** * 거주자 / 장애인 심의대상 목록 조회 diff --git a/src/main/java/com/xit/biz/ctgy/v2/service/impl/ParkingService.java b/src/main/java/com/xit/biz/ctgy/v2/service/impl/ParkingService.java index c72315c..6799252 100644 --- a/src/main/java/com/xit/biz/ctgy/v2/service/impl/ParkingService.java +++ b/src/main/java/com/xit/biz/ctgy/v2/service/impl/ParkingService.java @@ -39,11 +39,8 @@ public class ParkingService implements IParkingService { private final IParkingRepository repository; private final ParkingDao parkingDao; - private final IRecallRepository recallRepository; - private final IMinUserRepository userRepository; private final UserDao userDao; private final IParkingJudgeUserRepository parkingJudgeUserRepository; - private final IParkingMapper mapper; @Override @Transactional(readOnly = true) @@ -169,13 +166,13 @@ public class ParkingService implements IParkingService { @Transactional public void removeParkingJudge(final ParkingTargetDto dto) { - List msMaincodes = repository.findAllMsMaincode(dto.getMsChasu(), dto.getMsSdate(), dto.getMsEdate()); + List msMaincodes = parkingDao.findAllMsMaincode(dto); msMaincodes.forEach(msMaincode -> { - parkingJudgeUserRepository.deleteByMsuMaincode(msMaincode); + parkingDao.deleteJudgeUser(msMaincode); // 전송상태 -> 미접수(1), 심의결과 -> 심의전(0) - recallRepository.updateRcIrTransferAndRcState(msMaincode); - repository.deleteById(msMaincode); + parkingDao.updateRcIrTransferAndRcState(msMaincode); + parkingDao.deleteJudgeTgt(msMaincode); }); } diff --git a/src/main/java/com/xit/biz/ctgy/v2/service/impl/ResidentAndDisabledService.java b/src/main/java/com/xit/biz/ctgy/v2/service/impl/ResidentAndDisabledService.java index 0a70a2d..0a1cfdf 100644 --- a/src/main/java/com/xit/biz/ctgy/v2/service/impl/ResidentAndDisabledService.java +++ b/src/main/java/com/xit/biz/ctgy/v2/service/impl/ResidentAndDisabledService.java @@ -60,21 +60,17 @@ public class ResidentAndDisabledService implements IResidentAndDisabledService { private final GnRecallScMapstruct mapstruct = Mappers.getMapper(GnRecallScMapstruct.class); private final IResidentAndDisabledRepository gnReacallRepository; private final ResidentAndDisabledDao residentAndDisabledDao; - private final IMinUserRepository userRepository; private final UserDao userDao; private final IJudgeUserRepository judgeUserRepository; - private final IJudgeRepository judgeRepository; private final IResidentAndDisabledMapper residentAndDisabledMapper; - private final IParkingRepository parkingRepository; private final ParkingDao parkingDao; private final ICmmFileService fileService; private final IPublicBoardService pBoardService; private final IParkingMapper parkingMapper; - private final EntityManager entityManager; //--------------------------------------------------------------------------------- // 관리자 @@ -198,7 +194,7 @@ public class ResidentAndDisabledService implements IResidentAndDisabledService { public Page findJudges(JudgeListDto dto, Pageable pageable) { pageable = JpaUtil.getPagingInfo(pageable); - return gnReacallRepository.findJudges(dto, pageable); + return residentAndDisabledDao.findJudges(dto, pageable); } @Override @@ -212,16 +208,16 @@ public class ResidentAndDisabledService implements IResidentAndDisabledService { // List> totJudgeUserList = residentAndDisabledMapper.selectTotJudgeResultGroupByUser(dto); // totJudgeUserList.add(teamMap); - List> teamList = residentAndDisabledMapper.selectJudgeTeamGroupByChasuAndTeamList(dto); + List> teamList = residentAndDisabledDao.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); + List> totJudgeUserList = residentAndDisabledDao.selectTotJudgeResultGroupByUser(dto); totJudgeUserList.add(teamList.get(0)); // 심사대상 차량 목록 - List> judgeCarList = residentAndDisabledMapper.selectJudgeResultGroupByCarnum(dto); + List> judgeCarList = residentAndDisabledDao.selectJudgeResultGroupByCarnum(dto); // 차량별 심사자 심사결과 목록 Map paramMap = new HashMap<>(); @@ -233,7 +229,7 @@ public class ResidentAndDisabledService implements IResidentAndDisabledService { 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> jurgeUserList = residentAndDisabledDao.selectJudgeResultList(paramMap); // List> resultList = judgeCarList.stream().peek((m) -> { // paramMap.put("msSeq", m.get("msSeq")); @@ -252,56 +248,56 @@ public class ResidentAndDisabledService implements IResidentAndDisabledService { return resultMap; } - @Override - @Transactional(readOnly = true) - public Map findJudgeResults2(JudgeListDto dto) { - Map resultMap = new HashMap<>(); - - // team && 팀별 부과현황 조회 : 팀이 선택되지 않은 경우 모두 -// Map teamMap = residentAndDisabledMapper.selectTotJudgeResultGroupByTeamAndChasu(dto); -// if (Checks.isEmpty(teamMap)) throw new CustomBaseException(ErrorCode.DATA_NOT_FOUND); +// @Override +// @Transactional(readOnly = true) +// public Map findJudgeResults2(JudgeListDto dto) { +// Map resultMap = new HashMap<>(); +// +// // 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> 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(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 = residentAndDisabledMapper.selectJudgeResultGroupByCarnum(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()); - - 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; - } +// totJudgeUserList.add(teamList.get(0)); +// +// // 심사대상 차량 목록 +// List> judgeCarList = residentAndDisabledMapper.selectJudgeResultGroupByCarnum(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()); +// +// 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; +// } /** * 심사자료 삭제 @@ -313,16 +309,16 @@ public class ResidentAndDisabledService implements IResidentAndDisabledService { */ @Override @Transactional - public void removeJudge(final JudgeListDto dto) { + public void removeJudge(@NotNull final JudgeListDto dto) { - List msMaincodes = judgeRepository.findAllMsMaincode(dto.getMsDatagb(), dto.getMsChasu(), dto.getMsSdate(), dto.getMsEdate()); + List msMaincodes = residentAndDisabledDao.findAllMsMaincode(dto); msMaincodes.forEach(msMaincode -> { //List judgeUsers = judgeUserRepository.findByMsuMaincode() - judgeUserRepository.deleteByMsuMaincode(msMaincode); + residentAndDisabledDao.deleteJudgeUser(msMaincode); // 전송상태 -> 미접수(1), 심의결과 -> 접수(1) - gnReacallRepository.updateScTransferAndScState(dto.getMsDatagb(), msMaincode); - judgeRepository.deleteById(msMaincode); + residentAndDisabledDao.updateScTransferAndScState(dto.getMsDatagb(), msMaincode); + residentAndDisabledDao.deleteJudgeTgt(msMaincode); }); } diff --git a/src/main/java/com/xit/core/config/database/BaseMpowerDaoSupport.java b/src/main/java/com/xit/core/config/database/BaseMpowerDaoSupport.java index 962fc45..3cf67b4 100644 --- a/src/main/java/com/xit/core/config/database/BaseMpowerDaoSupport.java +++ b/src/main/java/com/xit/core/config/database/BaseMpowerDaoSupport.java @@ -91,6 +91,38 @@ public abstract class BaseMpowerDaoSupport { } } + public List selectOneColumnLongList(String sql){ + Objects.requireNonNull(sql, "SQL cannot be null"); + List list = new ArrayList<>(); + + Client client = getConnection(); + client.setInput("SQLXML", getQueryXml("select", sql)); + try { + client.Request(); + + String result = client.getString("result", 0, 0); + + int row; + if (result.equals("true")){ + row = client.getMaxRow("list1"); + + if(row>0) { + String value = null; + + for (int i = 0; i < row; i++) { + list.add(Long.valueOf(client.getString("list1", i, 0))); + } + } + } + return list; + + }catch (Exception e){ + throw new MpowerException(ErrorCode.MPOWER_ERROR); + } finally { + disConnection(client); + } + } + public List selectList(Class type, String sql, String fieldStrs){ Objects.requireNonNull(type, "Class cannot be null"); Objects.requireNonNull(sql, "SQL cannot be null"); diff --git a/src/main/java/com/xit/core/config/database/DataSourceConfig.java b/src/main/java/com/xit/core/config/database/DataSourceConfig.java index eb18f26..4fe852b 100644 --- a/src/main/java/com/xit/core/config/database/DataSourceConfig.java +++ b/src/main/java/com/xit/core/config/database/DataSourceConfig.java @@ -55,7 +55,7 @@ import java.util.Map; ) // Mybatis @MapperScan( - //nameGenerator = CustomBeanNameGenerator.class, + nameGenerator = CustomBeanNameGenerator.class, basePackages = DataSourceConfig.PACKAGE, sqlSessionFactoryRef = "sqlSessionFactory" ) diff --git a/src/main/java/com/xit/core/config/support/CustomBeanNameGenerator.java b/src/main/java/com/xit/core/config/support/CustomBeanNameGenerator.java index 1e3dc75..2c1d895 100644 --- a/src/main/java/com/xit/core/config/support/CustomBeanNameGenerator.java +++ b/src/main/java/com/xit/core/config/support/CustomBeanNameGenerator.java @@ -6,6 +6,50 @@ import org.springframework.beans.factory.support.BeanDefinitionRegistry; import org.springframework.beans.factory.support.BeanNameGenerator; import org.springframework.lang.NonNull; +/** + * + *
+ *  API v1, v2 등으로 분류하는 경우
+ *  Bean 이름 식별시 풀패키지 명으로 식별 하도록 함
+ *  Use : 아래 두번째 방식 권장 - 첫 번째 방식은 재확인 필요
+ *
+ *
+ *     -------------------------
+ *     Application.java
+ *
+ *     SpringApplicationBuilder applicationBuilder = new SpringApplicationBuilder(Application.class);
+ *     CustomBeanNameGenerator beanNameGenerator = new CustomBeanNameGenerator();
+ *     applicationBuilder.beanNameGenerator(beanNameGenerator);
+ *     applicationBuilder.build().run(args);
+ *     -------------------------
+ *
+ *     OR
+ *
+ *     -------------------------
+ *     @ComponentScan(
+ *         nameGenerator = CustomBeanNameGenerator.class,
+ *         basePackages = {"com.xit.biz", "com.xit.core"},
+ *         excludeFilters = @ComponentScan.Filter(
+ *                 type = FilterType.ASPECTJ,
+ *                 pattern = {
+ *                         "com.xit"
+ *                         //"com..support.auth.jwt..*"
+ *                 }
+ *         )
+ *     )
+ *
+ *     DatabaseConfig.java
+ *     @MapperScan(
+ *         nameGenerator = CustomBeanNameGenerator.class,
+ *         basePackages = DataSourceConfig.PACKAGE,
+ *         sqlSessionFactoryRef = "sqlSessionFactory"
+ *     )
+ *     static final String PACKAGE = "com.xit.**.mapper";
+ *     --------------------------
+ *
+ * 
+ * + */ public class CustomBeanNameGenerator implements BeanNameGenerator { @Override public @NonNull String generateBeanName(@NonNull BeanDefinition definition, @NonNull BeanDefinitionRegistry registry) { diff --git a/src/main/resources/sql/parking-mapper.xml b/src/main/resources/sql/parking-mapper.xml index 6dc5566..cb269b0 100644 --- a/src/main/resources/sql/parking-mapper.xml +++ b/src/main/resources/sql/parking-mapper.xml @@ -50,6 +50,38 @@ ) + /* -------------------- 심의목록 삭제 ------------------------- */ + + /* parking-mapper|selectRemoveJudgeTgtList|julim */ + SELECT ms_maincode + FROM min_simsa680 + WHERE ms_chasu = #{msChasu} + AND ms_Sdate = #{msSdate} + AND ms_Edate = #{msEdate} + + + + /* parking-mapper|deleteJudgeUser|julim */ + DELETE + FROM min_simsa_user680 + WHERE msu_maincode = #{msMaincode} + + + + /* parking-mapper|deleteJudgeTgt|julim */ + DELETE + FROM min_simsa680 + WHERE ms_maincode = #{msMaincode} + + + + /* parking-mapper|updateJudgeTgtReset|julim */ + UPDATE tf680_recall + SET rc_ir_transfer = '1' + , rc_state = '0' + WHERE rc_code = #{msMaincode} + + /* -------------------- 심의목록 삭제 ------------------------- */ /* parking-mapper|insertJudgeTargetIntoSelect|julim */ @@ -121,21 +153,9 @@ ) - - - - - - - - - - - - /* parking-mapper|selectTotParkingJudgeResultGroupByTeamAndChasu|julim */ - SELECT msu_team AS msuTeam + SELECT MS.msu_team AS msuTeam , 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 diff --git a/src/main/resources/sql/residentAndDisabled-mapper.xml b/src/main/resources/sql/residentAndDisabled-mapper.xml index b2de57e..c2aa646 100644 --- a/src/main/resources/sql/residentAndDisabled-mapper.xml +++ b/src/main/resources/sql/residentAndDisabled-mapper.xml @@ -1,8 +1,8 @@ - - /* residentAndDisabled-mapper|selectParkingList|julim */ + + /* residentAndDisabled-mapper|selectJudgeList|julim */ SELECT ms_year, ms_chasu, ms_sdate, @@ -10,6 +10,7 @@ ms_edate, ms_cdate, ms_closesi, + ms_datagb cnt FROM ( SELECT R.*, ROWNUM rn @@ -21,13 +22,15 @@ ms_edate, ms_cdate, ms_closesi, + ms_datagb, count(ms_maincode) AS cnt - FROM min_simsa680 + FROM min_simsa680_sc WHERE ms_year = #{msYear} + AND ms_datagb = #{msDatagb} AND ms_chasu = #{msChasu} - GROUP BY ms_year, ms_chasu, ms_sdate, ms_startsi, ms_edate, ms_cdate, ms_closesi + GROUP BY ms_year, ms_datagb, ms_chasu, ms_sdate, ms_startsi, ms_edate, ms_cdate, ms_closesi ORDER BY ms_year DESC, ms_chasu DESC ) R WHERE ROWNUM <= (#{page} + 1) * #{size} @@ -36,20 +39,56 @@ AND ROWNUM <= #{size} - - /* residentAndDisabled-mapper|selectParkingListCnt|julim */ + + /* residentAndDisabled-mapper|selectJudgeListCnt|julim */ SELECT count(*) AS totalCount FROM ( SELECT ms_year - FROM min_simsa680 + FROM min_simsa680_sc WHERE ms_year = #{msYear} + AND ms_datagb = #{msDatagb} AND ms_chasu = #{msChasu} - GROUP BY ms_year, ms_chasu, ms_sdate, ms_startsi, ms_edate, ms_cdate, ms_closesi + GROUP BY ms_year, ms_datagb, ms_chasu, ms_sdate, ms_startsi, ms_edate, ms_cdate, ms_closesi ) + /* -------------------- 심의목록 삭제 ------------------------- */ + + /* residentAndDisabled-mapper|selectRemoveJudgeTgtList|julim */ + SELECT ms_maincode + FROM min_simsa680_sc + WHERE ms_datagb = #{msDatagb} + AND ms_chasu = #{msChasu} + AND ms_Sdate = #{msSdate} + AND ms_Edate = #{msEdate} + + + + /* residentAndDisabled-mapper|deleteJudgeUser|julim */ + DELETE + FROM min_simsa_user680_sc + WHERE msu_maincode = #{msMaincode} + + + + /* residentAndDisabled-mapper|deleteJudgeTgt|julim */ + DELETE + FROM min_simsa680_sc + WHERE ms_maincode = #{msMaincode} + + + + /* residentAndDisabled-mapper|updateJudgeTgtReset|julim */ + UPDATE gn_recall_sc_sc + SET sc_transfer = '1' + SET sc_state = '1' + WHERE sc_datagb = #{scDatagb} + AND sc_code = #{msMaincode} + + /* -------------------- 심의목록 삭제 ------------------------- */ + /* residentAndDisabled-mapper|insertJudgeTargetIntoSelect|julim */ @@ -117,50 +156,42 @@ ) - - - - - - - - - - - - /* residentAndDisabled-mapper|selectTotParkingJudgeResultGroupByTeamAndChasu|julim */ - SELECT msu_team AS msuTeam + + /* residentAndDisabled-mapper|selectTotJudgeResultGroupByTeamAndChasu|julim */ + SELECT MS.msu_team AS msuTeam , 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 + FROM min_simsa680_sc MS , msu680_view MV WHERE MS.ms_maincode = MV.msu_maincode AND MV.msu_team = #{msuTeam} + AND MS.ms_datagb = #{msDatagb} AND MS.ms_chasu = #{msChasu} AND MS.ms_sdate = #{msSdate} AND MS.ms_edate = #{msEdate} GROUP BY MV.msu_team, MS.ms_chasu - - /* residentAndDisabled-mapper|selectParkingJudgeTeamGroupByChasuAndTeamList|julim */ + + /* residentAndDisabled-mapper|selectJudgeTeamGroupByChasuAndTeamList|julim */ SELECT MV.msu_team AS msuTeam , 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 + FROM min_simsa680_sc MS , msu680_view MV WHERE MS.ms_maincode = MV.msu_maincode AND MV.msu_team = #{msuTeam} + AND MS.ms_datagb = #{msDatagb} AND MS.ms_chasu = #{msChasu} AND MS.ms_sdate = #{msSdate} AND MS.ms_edate = #{msEdate} @@ -168,17 +199,18 @@ ORDER BY MS.ms_chasu, MV.msu_team - - /* residentAndDisabled-mapper|selectTotParkingJudgeResultByUser|julim */ - SELECT SUM(DECODE(MSU_RESULT, '2', 1, 0)) as bu + + /* residentAndDisabled-mapper|selectTotJudgeResultByUser|julim */ + SELECT SUM(DECODE(MSU.MSU_RESULT, '2', 1, 0)) as bu , 0 as seo - , SUM(DECODE(MSU_RESULT, '1', 1, 0)) as mibu - , SUM(DECODE(MSU_RESULT, '1', 1, '2', 1, 0)) as tot + , SUM(DECODE(MSU.MSU_RESULT, '1', 1, 0)) as mibu + , SUM(DECODE(MSU.MSU_RESULT, '1', 1, '2', 1, 0)) as tot , MU.name - FROM min_simsa680 MS + FROM min_simsa680_sc MS , min_simsa_user680 MSU , min_userinfo MU WHERE MS.ms_maincode = MSU.msu_maincode + AND MS.ms_datagb = #{msDatagb} AND MS.ms_chasu = #{msChasu} AND MS.ms_sdate = #{msSdate} AND MS.ms_edate = #{msEdate} @@ -190,14 +222,15 @@ ORDER BY MSU.msu_userid, MU.name - - /* residentAndDisabled-mapper|selectParkingJurgeResultGroupByCarnum|julim */ + + /* residentAndDisabled-mapper|selectJurgeResultGroupByCarnum|julim */ SELECT MS.ms_maincode AS msMaincode , MS.ms_seq AS msSeq , MS.ms_carnum AS msCarnum - FROM min_simsa680 MS + FROM min_simsa680_sc MS , min_simsa_user680 MSU WHERE MS.ms_maincode = MSU.msu_maincode + AND MS.ms_datagb = #{msDatagb} AND MS.ms_chasu = #{msChasu} AND MS.ms_sdate = #{msSdate} AND MS.ms_edate = #{msEdate} @@ -208,8 +241,8 @@ ORDER BY MS.ms_maincode, MS.ms_seq, MS.ms_carnum - - /* residentAndDisabled-mapper|selectParkingJudgeResultList|julim */ + + /* residentAndDisabled-mapper|selectJudgeResultList|julim */ SELECT MS.ms_maincode AS msMaincode , MS.ms_seq AS msSeq , MS.ms_carnum AS msCarnum @@ -227,10 +260,11 @@ AND code_lcd = 'GANGNAM_SIMSA' AND code_mcd = 'RESULT' AND code_cd = MSU.msu_result) as msuResult - FROM min_simsa680 MS + FROM min_simsa680_sc MS , min_simsa_user680 MSU , min_userinfo MU WHERE MS.ms_maincode = MSU.msu_maincode + AND MS.ms_datagb = #{msDatagb} AND MS.ms_chasu = #{msChasu} AND MS.ms_sdate = #{msSdate} AND MS.ms_edate = #{msEdate} @@ -243,18 +277,6 @@ ORDER BY MSU.msu_userid, MU.name, MS.ms_maincode, MS.ms_seq, MS.ms_carnum - - - - - - - - - - - - /* residentAndDisabled-mapper|selectJudegStdCount|julim */ SELECT count(msu_code)