From 04b0dba1dbdf5c14a7bcca15f96545e07ae37be6 Mon Sep 17 00:00:00 2001 From: Lim Jonguk Date: Fri, 25 Mar 2022 02:39:13 +0900 Subject: [PATCH] =?UTF-8?q?feat:=20=EC=A3=BC=EC=A0=95=EC=B0=A8=20=EC=8B=AC?= =?UTF-8?q?=EC=9D=98=EB=8C=80=EC=83=81=20=EB=93=B1=EB=A1=9D=20-=20mybatis?= =?UTF-8?q?=EB=A1=9C=20=EC=B2=98=EB=A6=AC=20=20=20=20=20=20=20localDate=20?= =?UTF-8?q?converter=20=EC=84=A4=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ctgy/controller/ParkingController.java | 3 +- .../xit/biz/ctgy/dto/MinSimsaTargetDto.java | 3 +- .../xit/biz/ctgy/mapper/IParkingMapper.java | 11 +++ .../ctgy/repository/IParkingRepository.java | 3 +- .../repository/IParkingRepositoryImpl.java | 69 ------------------- .../xit/biz/ctgy/service/IParkingService.java | 5 +- .../biz/ctgy/service/impl/ParkingService.java | 24 ++++++- .../core/config/support/DateTimeConfig.java | 4 +- .../biz/ctgy/parking-mapper.xml | 44 ++++++++++++ 9 files changed, 87 insertions(+), 79 deletions(-) create mode 100644 src/main/java/com/xit/biz/ctgy/mapper/IParkingMapper.java create mode 100644 src/main/resources/mybatis-mapper/biz/ctgy/parking-mapper.xml 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 51b8cd6..d0c1efb 100644 --- a/src/main/java/com/xit/biz/ctgy/controller/ParkingController.java +++ b/src/main/java/com/xit/biz/ctgy/controller/ParkingController.java @@ -88,8 +88,7 @@ public class ParkingController { @Valid @RequestBody final MinSimsaTargetDto dto) { - log.debug("{}", dto); - service.saveParkingSimsaTargets(dto); + service.saveParkingSimsaTargets2(dto); return RestResponse.of(HttpStatus.OK); } diff --git a/src/main/java/com/xit/biz/ctgy/dto/MinSimsaTargetDto.java b/src/main/java/com/xit/biz/ctgy/dto/MinSimsaTargetDto.java index a60dd41..1603841 100644 --- a/src/main/java/com/xit/biz/ctgy/dto/MinSimsaTargetDto.java +++ b/src/main/java/com/xit/biz/ctgy/dto/MinSimsaTargetDto.java @@ -8,6 +8,7 @@ import lombok.Setter; import org.springframework.format.annotation.DateTimeFormat; import java.sql.Date; +import java.time.LocalDate; import java.util.List; @Schema(name = "MinSimsTargetDto", description = "주정차의견진술심의자료대상") @@ -52,7 +53,7 @@ public class MinSimsaTargetDto { @Schema(title = "심사시작일", example = "2022-03-23", description = "Input Description...") @DateTimeFormat(pattern="yyyy-MM-dd") - private Date msSdate; + private LocalDate msSdate; @Schema(title = "심사시작시간", example = " ", description = "Input Description...") private String msStartsi; diff --git a/src/main/java/com/xit/biz/ctgy/mapper/IParkingMapper.java b/src/main/java/com/xit/biz/ctgy/mapper/IParkingMapper.java new file mode 100644 index 0000000..b1c38dc --- /dev/null +++ b/src/main/java/com/xit/biz/ctgy/mapper/IParkingMapper.java @@ -0,0 +1,11 @@ +package com.xit.biz.ctgy.mapper; + +import com.xit.biz.ctgy.dto.MinSimsaTargetDto; +import org.apache.ibatis.annotations.Mapper; + +@Mapper +public interface IParkingMapper { + + void insertSimsaTargetIntoSelect(MinSimsaTargetDto dto); + +} diff --git a/src/main/java/com/xit/biz/ctgy/repository/IParkingRepository.java b/src/main/java/com/xit/biz/ctgy/repository/IParkingRepository.java index 2716a29..35b972b 100644 --- a/src/main/java/com/xit/biz/ctgy/repository/IParkingRepository.java +++ b/src/main/java/com/xit/biz/ctgy/repository/IParkingRepository.java @@ -8,6 +8,7 @@ import org.springframework.data.repository.query.Param; import javax.annotation.Nonnull; import java.sql.Date; +import java.time.LocalDate; import java.util.List; import java.util.Map; @@ -50,7 +51,7 @@ public interface IParkingRepository extends JpaRepository, IP void insertSimsaTargetIntoSelect(@Nonnull @Param("msYear") final String msYear, @Nonnull @Param("rcCode") Long rcCode, @Nonnull @Param("msChasu") Long msChasu, - @Nonnull @Param("msSdate") Date msSdate, + @Nonnull @Param("msSdate") LocalDate msSdate, @Nonnull @Param("msStartsi") String msStartsi, @Nonnull @Param("msEdate") Date msEdate, @Nonnull @Param("msCdate") Date msCdate, diff --git a/src/main/java/com/xit/biz/ctgy/repository/IParkingRepositoryImpl.java b/src/main/java/com/xit/biz/ctgy/repository/IParkingRepositoryImpl.java index 22ab17c..1eafeda 100644 --- a/src/main/java/com/xit/biz/ctgy/repository/IParkingRepositoryImpl.java +++ b/src/main/java/com/xit/biz/ctgy/repository/IParkingRepositoryImpl.java @@ -33,14 +33,6 @@ public class IParkingRepositoryImpl implements IParkingRepositoryCustom { @Override public Page findSimsas(final MinSimsa680GroupDto pMinSimsa680GroupDto, Pageable pageable) { - /* - SELECT MS_CHASU, MS_SDATE, MS_STARTSI, MS_EDATE, MS_CDATE, MS_CLOSESI, COUNT(*) CNT - FROM MIN_SIMSA680 - WHERE MS_YEAR = '"& rYear &"' AND MS_CHASU LIKE '%"& rChasu &"%' - GROUP BY MS_CHASU, MS_SDATE, MS_STARTSI, MS_EDATE, MS_CDATE, MS_CLOSESI - ORDER BY MS_CHASU DESC - */ - BooleanBuilder builder = new BooleanBuilder(); if (!Checks.isEmpty(pMinSimsa680GroupDto.getMsYear())) { @@ -108,67 +100,6 @@ public class IParkingRepositoryImpl implements IParkingRepositoryCustom { @Override public List findSimsaTargets(final MinSimsaTargetDto dto) { - /* - SELECT TM.MM_CODE, - TR.RC_CODE, - TR.RC_SEQ, - TM.MM_OCARNO, - TM.MM_NCARNO, - TR.RC_NAME, - TR.RC_CONT_DOC, - -- 진술유형(1:재판독, 2:기타, 3:공무수행, 4:응급환자수송및치료, 5:장애인관련, 6:고장, 7:수사차량, 8:이의인정, 9:취재차량, 10:착오단속, 11:거주자우선, 12:물건상하차, 13:공공업무수행, 14:공사차량) - CASE WHEN TR.RC_CONT_DOC = '1' THEN '재판독' - WHEN TR.RC_CONT_DOC = '2' THEN '기타' - WHEN TR.RC_CONT_DOC = '3' THEN '공무수행' - WHEN TR.RC_CONT_DOC = '4' THEN '응급환자수송및치료' - WHEN TR.RC_CONT_DOC = '5' THEN '장애인관련' - WHEN TR.RC_CONT_DOC = '6' THEN '고장' - WHEN TR.RC_CONT_DOC = '7' THEN '수사차량' - WHEN TR.RC_CONT_DOC = '8' THEN '이의인정' - WHEN TR.RC_CONT_DOC = '9' THEN '취재차량' - WHEN TR.RC_CONT_DOC = '10' THEN '착오단속' - WHEN TR.RC_CONT_DOC = '11' THEN '거주자우선' - WHEN TR.RC_CONT_DOC = '12' THEN '물건상하차' - WHEN TR.RC_CONT_DOC = '13' THEN '공공업무수행' - WHEN TR.RC_CONT_DOC = '14' THEN '공사차량' - ELSE '' - END AS RC_COND_DOC_STR, - TCCS2.CODE_NM, - TR.RC_DATE, - -- 접수방법(1:방문, 2:인터넷, 3:상급기관인터넷, 4:팩스, 5:우편, 6:전화, 7:ARS, 8:터치스크린, 9:공문) - TR.RC_INGB, - CASE WHEN TR.RC_INGB = '1' THEN '방문' - WHEN TR.RC_INGB = '2' THEN '인터넷' - WHEN TR.RC_INGB = '3' THEN '상급기관인터넷' - WHEN TR.RC_INGB = '4' THEN '팩스' - WHEN TR.RC_INGB = '5' THEN '우편' - WHEN TR.RC_INGB = '6' THEN '전화' - WHEN TR.RC_INGB = '7' THEN 'ARS' - WHEN TR.RC_INGB = '8' THEN '터치스크린' - WHEN TR.RC_INGB = '9' THEN '공문' - ELSE '' - END AS RC_INGB_STR, - TCCS1.CODE_NM - FROM TF680_MAIN TM - JOIN TF680_RECALL TR ON TM.MM_CODE = TR.RC_MAINCODE - LEFT JOIN TB_CMM_CODE_S TCCS1 ON TR.RC_INGB = TCCS1.CODE_CD - AND TCCS1.CODE_GRP_ID = 'TRAFFIC' - AND TCCS1.CODE_LCD = 'GANGNAM_SIMSA' - AND TCCS1.CODE_MCD = 'RC_INGB' - LEFT JOIN TB_CMM_CODE_S TCCS2 ON TR.RC_CONT_DOC = TCCS2.CODE_CD - AND TCCS2.CODE_GRP_ID = 'TRAFFIC' - AND TCCS2.CODE_LCD = 'GANGNAM_SIMSA' - AND TCCS2.CODE_MCD = 'RC_CONT_DOC' - WHERE MM_DBGB = '11' -- 과태료 코드 : 11-'주정차위반과태료 12-버스전용차로위반과태료 - AND MM_LSTATE != '75' -- 10:단속,11:부과,12:독촉,13:압류예정,21:압류,49:대납,51:자납,52:수시분수납,53:독촉분수납,54:압류예정분수납,55:압류해제수납,61:시효결손취소수납,62:불납결손취소수납,65:충당수납,71:서손,72:의견진술수용,73:이의신청수용,74:부과취소,75:자납고지부과등록,81:시효결손,82:불납결손,91:법원이송,92:경찰서이첩,98:면제차량,99:삭제자료) - AND RC_GB = '1' -- 미원 구분 : 1-의견진술 2-이의신청 - AND RC_STATE = '0' -- 심의결과(0:심의전, 1:미부과, 2:재판독, 3:심의제외-OCR수납등록에서 생성, 5:부과, 7:자진취하, 8:법원이송, 9:경찰이첩) - -- AND RC_SEQ >= '"& rtxtsNum &"' - -- AND RC_SEQ <= '"& rtxteNum &"' - AND RC_IR_TRANSFER = '1' -- 인터넷 심사 전송상태 : 1-미전송 2-전송 - order by RC_SEQ; - - */ BooleanBuilder builder = new BooleanBuilder(); // 과태료 코드 : 11-'주정차위반과태료 12-버스전용차로위반과태료 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 1ca3799..46aa21f 100644 --- a/src/main/java/com/xit/biz/ctgy/service/IParkingService.java +++ b/src/main/java/com/xit/biz/ctgy/service/IParkingService.java @@ -19,9 +19,12 @@ public interface IParkingService { Page findAll(final MinSimsa680 minSimsa680, Pageable pageable); + void saveParkingSimsaTargets2(MinSimsaTargetDto dto); + + void saveParkingSimsaTargets(MinSimsaTargetDto dto); + Page findMinSimsa680s2(final MinSimsa680 minSimsa680, Pageable pageable); MinSimsa680 saveParkingSimsa(final MinSimsa680 toEntity); - void saveParkingSimsaTargets(MinSimsaTargetDto 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 e5f384d..5bc7d8a 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 @@ -4,6 +4,7 @@ import com.xit.biz.ctgy.dto.MinSimsa680GroupDto; import com.xit.biz.ctgy.dto.MinSimsaReviewGroupDto; import com.xit.biz.ctgy.dto.MinSimsaTargetDto; import com.xit.biz.ctgy.entity.MinSimsa680; +import com.xit.biz.ctgy.mapper.IParkingMapper; import com.xit.biz.ctgy.repository.IParkingRepository; import com.xit.biz.ctgy.service.IParkingService; import com.xit.core.support.jpa.JpaUtil; @@ -13,13 +14,11 @@ import org.springframework.data.domain.ExampleMatcher; import org.springframework.data.domain.Page; import org.springframework.data.domain.Pageable; import org.springframework.data.jpa.repository.Modifying; -import org.springframework.data.repository.query.Param; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import javax.annotation.Nonnull; import java.util.List; -import java.util.Map; import static org.springframework.data.domain.ExampleMatcher.GenericPropertyMatchers.contains; @@ -28,10 +27,11 @@ import static org.springframework.data.domain.ExampleMatcher.GenericPropertyMatc public class ParkingService implements IParkingService { private final IParkingRepository repository; + private final IParkingMapper mapper; @Override @Transactional(readOnly = true) - public Page findAll(final MinSimsa680 entity, Pageable pageable) { + public Page findAll(@Nonnull final MinSimsa680 entity, Pageable pageable) { pageable = JpaUtil.getPagingInfo(pageable); ExampleMatcher exampleMatcher = ExampleMatcher.matchingAll() .withMatcher("ciTitle", contains()) @@ -89,6 +89,24 @@ public class ParkingService implements IParkingService { + @Override + public void saveParkingSimsaTargets2(MinSimsaTargetDto dto) { + boolean isFirst = true; + + for(Long rcCode : dto.getRcCodes()) { + dto.setRcCode(rcCode); + + if (isFirst) { + dto.setMsYear(dto.getMsSdate().toString().substring(0, 4)); + dto.setMsResult("0"); + isFirst = false; + } + + mapper.insertSimsaTargetIntoSelect(dto); + } + } + + @Override @Transactional(readOnly = true) public Page findMinSimsa680s2(MinSimsa680 minSimsa680, Pageable pageable) { diff --git a/src/main/java/com/xit/core/config/support/DateTimeConfig.java b/src/main/java/com/xit/core/config/support/DateTimeConfig.java index d6428b4..fafbd2f 100644 --- a/src/main/java/com/xit/core/config/support/DateTimeConfig.java +++ b/src/main/java/com/xit/core/config/support/DateTimeConfig.java @@ -1,6 +1,6 @@ package com.xit.core.config.support; -import org.jetbrains.annotations.NotNull; +import lombok.NonNull; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.format.datetime.DateFormatter; @@ -19,7 +19,7 @@ import java.time.format.DateTimeFormatter; @Configuration public class DateTimeConfig extends WebMvcConfigurationSupport { - @NotNull + @NonNull @Bean @Override public FormattingConversionService mvcConversionService() { diff --git a/src/main/resources/mybatis-mapper/biz/ctgy/parking-mapper.xml b/src/main/resources/mybatis-mapper/biz/ctgy/parking-mapper.xml new file mode 100644 index 0000000..f41df20 --- /dev/null +++ b/src/main/resources/mybatis-mapper/biz/ctgy/parking-mapper.xml @@ -0,0 +1,44 @@ + + + + + + /* parking-mapper|insertSimsaTargetIntoSelect|julim */ + insert + into min_simsa680( + ms_maincode, + ms_seq, + ms_carnum, + ms_year, + ms_chasu, + ms_sdate, + ms_startsi, + ms_edate, + ms_cdate, + ms_closesi, + ms_wdate, + ms_pos, + ms_result, + ms_jbtime + ) select TR.rc_code, + TR.rc_seq, + TM.mm_ocarno, + #{msYear}, + #{msChasu}, + #{msSdate}, + #{msStartsi}, + #{msEdate}, + #{msCdate}, + #{msClosesi}, + TM.mm_wdate, + TD.do_bname||''||TJ.mj_pos, + #{msResult}, + TJ.mj_jbtime + from tf680_recall TR + join tf680_main TM on TR.rc_code = #{rcCode} + and TM.mm_code = TR.rc_maincode + join tf680_jucha TJ on TM.mm_code = TJ.mj_code + join tf680_dong TD + on TJ.mj_dong = TD.do_code + + \ No newline at end of file