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 b613e24..51b8cd6 100644 --- a/src/main/java/com/xit/biz/ctgy/controller/ParkingController.java +++ b/src/main/java/com/xit/biz/ctgy/controller/ParkingController.java @@ -14,15 +14,14 @@ import io.swagger.v3.oas.annotations.Parameters; import io.swagger.v3.oas.annotations.enums.ParameterIn; import io.swagger.v3.oas.annotations.tags.Tag; import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; import org.mapstruct.factory.Mappers; import org.springframework.data.domain.Pageable; +import org.springframework.http.HttpStatus; import org.springframework.http.MediaType; import org.springframework.http.ResponseEntity; import org.springframework.validation.annotation.Validated; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.bind.annotation.*; import javax.validation.Valid; @@ -31,6 +30,7 @@ import javax.validation.Valid; @RequestMapping("/api/v1/ctgy/parking") @Validated @RequiredArgsConstructor +@Slf4j public class ParkingController { private final IParkingService service; @@ -71,7 +71,7 @@ public class ParkingController { return RestResponse.of(service.findSimsaDetails(dto)); } - @Operation(summary = "주정차의견진술심의목록-상세" , description = "주정차의견진술심의목록-상세") + @Operation(summary = "주정차의견진술심의대상조회" , description = "주정차의견진술심의대상조회") @GetMapping(value="/target", produces = MediaType.APPLICATION_JSON_VALUE) @Parameters({ @Parameter(in = ParameterIn.QUERY, name = "rcIrTransfer", description = "전송상태(미접수-1,접수-2)", required = true, example = "1"), @@ -82,6 +82,17 @@ public class ParkingController { return RestResponse.of(service.findSimsaTargets(dto)); } + @Operation(summary = "주정차의견진술심의대상등록" , description = "주정차의견진술심의대상등록") + @PostMapping(value="/target", produces = MediaType.APPLICATION_JSON_VALUE) + public ResponseEntity saveParkinSimsaTargets( + @Valid + @RequestBody + final MinSimsaTargetDto dto) { + log.debug("{}", dto); + service.saveParkingSimsaTargets(dto); + return RestResponse.of(HttpStatus.OK); + } + @Operation(summary = "주정차의견진술심의등록" , description = "주정차의견진술심의등록") @Parameters({ @Parameter(in = ParameterIn.QUERY, name = "msSdate", description = "심사시작일", required = true, example = "2021-01-04"), 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 a211862..a60dd41 100644 --- a/src/main/java/com/xit/biz/ctgy/dto/MinSimsaTargetDto.java +++ b/src/main/java/com/xit/biz/ctgy/dto/MinSimsaTargetDto.java @@ -5,6 +5,10 @@ import lombok.AllArgsConstructor; import lombok.Getter; import lombok.NoArgsConstructor; import lombok.Setter; +import org.springframework.format.annotation.DateTimeFormat; + +import java.sql.Date; +import java.util.List; @Schema(name = "MinSimsTargetDto", description = "주정차의견진술심의자료대상") @Getter @@ -46,17 +50,20 @@ public class MinSimsaTargetDto { @Schema(title = "접수일자", example = " ", description = "Input Description...") private String rcDate; - @Schema(title = "심사시작일", example = " ", description = "Input Description...") - private java.sql.Date msSdate; + @Schema(title = "심사시작일", example = "2022-03-23", description = "Input Description...") + @DateTimeFormat(pattern="yyyy-MM-dd") + private Date msSdate; @Schema(title = "심사시작시간", example = " ", description = "Input Description...") private String msStartsi; - @Schema(title = "심사종료일", example = " ", description = "Input Description...") - private java.sql.Date msEdate; + @Schema(title = "심사종료일", example = "2022-03-24", description = "Input Description...") + @DateTimeFormat(pattern="yyyy-MM-dd") + private Date msEdate; - @Schema(title = "심사마감일", example = " ", description = "Input Description...") - private java.sql.Date msCdate; + @Schema(title = "심사마감일", example = "2022-03-25", description = "Input Description...") + @DateTimeFormat(pattern="yyyy-MM-dd") + private Date msCdate; @Schema(title = "심사마감시간", example = " ", description = "Input Description...") private String msClosesi; @@ -70,5 +77,15 @@ public class MinSimsaTargetDto { @Schema(title = "전송상태-심사", example = "1", description = "전송상태-1:미전송(미심사), 2:전송(심사)") private String rcIrTransfer; + @Schema(title = "민원코드목록", example = " ", description = "민원코드목록") + private List rcCodes; + + @Schema(title = "년도", example = "2022", description = "년도(심사시작일기준)") + private String msYear; + + @Schema(title = "결과코드", example = "0", description = "결과코드") + private String msResult; + @Schema(title = "", example = "0", description = "결과코드") + private Long msChasu; } 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 fd1811a..2716a29 100644 --- a/src/main/java/com/xit/biz/ctgy/repository/IParkingRepository.java +++ b/src/main/java/com/xit/biz/ctgy/repository/IParkingRepository.java @@ -1,11 +1,59 @@ package com.xit.biz.ctgy.repository; +import com.xit.biz.ctgy.dto.MinSimsaTargetDto; import com.xit.biz.ctgy.entity.MinSimsa680; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.jpa.repository.Query; +import org.springframework.data.repository.query.Param; +import javax.annotation.Nonnull; +import java.sql.Date; import java.util.List; import java.util.Map; public interface IParkingRepository extends JpaRepository, IParkingRepositoryCustom { + + @Query(value="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", nativeQuery = true) + 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("msStartsi") String msStartsi, + @Nonnull @Param("msEdate") Date msEdate, + @Nonnull @Param("msCdate") Date msCdate, + @Nonnull @Param("msClosesi") String msClosesi, + @Nonnull @Param("msResult") String msResult); } 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 2137f8d..22ab17c 100644 --- a/src/main/java/com/xit/biz/ctgy/repository/IParkingRepositoryImpl.java +++ b/src/main/java/com/xit/biz/ctgy/repository/IParkingRepositoryImpl.java @@ -171,9 +171,13 @@ public class IParkingRepositoryImpl implements IParkingRepositoryCustom { */ BooleanBuilder builder = new BooleanBuilder(); + // 과태료 코드 : 11-'주정차위반과태료 12-버스전용차로위반과태료 builder.and(tf680Main.mmDbgb.eq("11")); - //builder.and(tf680Main.mmLstate.ne("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:삭제자료) + builder.and(tf680Main.mmLstate.ne(Long.valueOf(75))); + // 민원 구분 : 1-의견진술 2-이의신청 builder.and(tf680Recall.rcGb.eq("1")); + // 심의결과(0:심의전, 1:미부과, 2:재판독, 3:심의제외-OCR수납등록에서 생성, 5:부과, 7:자진취하, 8:법원이송, 9:경찰이첩) builder.and(tf680Recall.rcState.eq("0")); builder.and(tf680Recall.rcIrTransfer.eq(dto.getRcIrTransfer())); builder.and(tf680Recall.rcSeq.gt(dto.getRcSeq1())); 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 129710c..1ca3799 100644 --- a/src/main/java/com/xit/biz/ctgy/service/IParkingService.java +++ b/src/main/java/com/xit/biz/ctgy/service/IParkingService.java @@ -22,4 +22,6 @@ public interface IParkingService { 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 814032c..e5f384d 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 @@ -12,9 +12,12 @@ import org.springframework.data.domain.Example; 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; @@ -57,6 +60,35 @@ public class ParkingService implements IParkingService { return repository.findSimsaTargets(dto); } + @Override + @Transactional + @Modifying + public void saveParkingSimsaTargets(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; + } + + repository.insertSimsaTargetIntoSelect(dto.getMsYear(), + dto.getRcCode(), + dto.getMsChasu(), + dto.getMsSdate(), + dto.getMsStartsi(), + dto.getMsEdate(), + dto.getMsCdate(), + dto.getMsClosesi(), + dto.getMsResult()); + } + } + + + @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 new file mode 100644 index 0000000..d6428b4 --- /dev/null +++ b/src/main/java/com/xit/core/config/support/DateTimeConfig.java @@ -0,0 +1,39 @@ +package com.xit.core.config.support; + +import org.jetbrains.annotations.NotNull; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.format.datetime.DateFormatter; +import org.springframework.format.datetime.DateFormatterRegistrar; +import org.springframework.format.datetime.standard.DateTimeFormatterRegistrar; +import org.springframework.format.support.DefaultFormattingConversionService; +import org.springframework.format.support.FormattingConversionService; +import org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport; + +import java.time.format.DateTimeFormatter; + +/** + * LocalDate / LocalDateTime type 데이타 정제 + * 2022-03-24T11:30:09.184Z -> 2022-03-24 11:30:09 + */ +@Configuration +public class DateTimeConfig extends WebMvcConfigurationSupport { + + @NotNull + @Bean + @Override + public FormattingConversionService mvcConversionService() { + DefaultFormattingConversionService conversionService = new DefaultFormattingConversionService(false); + + DateTimeFormatterRegistrar dateTimeRegistrar = new DateTimeFormatterRegistrar(); + dateTimeRegistrar.setDateFormatter(DateTimeFormatter.ofPattern("yyyy-MM-dd")); + dateTimeRegistrar.setDateTimeFormatter(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")); + dateTimeRegistrar.registerFormatters(conversionService); + + DateFormatterRegistrar dateRegistrar = new DateFormatterRegistrar(); + dateRegistrar.setFormatter(new DateFormatter("yyyy-MM-dd")); + dateRegistrar.registerFormatters(conversionService); + + return conversionService; + } +} \ No newline at end of file diff --git a/src/main/resources/config/application.yml b/src/main/resources/config/application.yml index 0c74aac..4bc9d0b 100644 --- a/src/main/resources/config/application.yml +++ b/src/main/resources/config/application.yml @@ -28,6 +28,11 @@ spring: hiddenmethod: filter: enabled: true + format: + date: yyyy-MM-dd + date-time: yyyy-MM-dd HH:mm:ss + time: HH:mm:ss + # JSP 등 템플릿 엔진 사용시 설정 # static-path-pattern: /static/** # view: diff --git a/src/main/resources/config/conf.yml b/src/main/resources/config/conf.yml index 69ab8f3..29e8af5 100644 --- a/src/main/resources/config/conf.yml +++ b/src/main/resources/config/conf.yml @@ -12,7 +12,7 @@ xit: # api response logging 여부 api: reponse: - logging: true + logging: false file: cmm: