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 d0c1efb..678a74c 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,9 @@ public class ParkingController { @Valid @RequestBody final MinSimsaTargetDto dto) { - service.saveParkingSimsaTargets2(dto); - return RestResponse.of(HttpStatus.OK); + return RestResponse.of(service.saveParkingSimsaTargets(dto)); + //service.saveParkingSimsaTargets(dto); + //return RestResponse.of(HttpStatus.OK); } @Operation(summary = "주정차의견진술심의등록" , description = "주정차의견진술심의등록") 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 1603841..6c9a6d4 100644 --- a/src/main/java/com/xit/biz/ctgy/dto/MinSimsaTargetDto.java +++ b/src/main/java/com/xit/biz/ctgy/dto/MinSimsaTargetDto.java @@ -1,5 +1,6 @@ package com.xit.biz.ctgy.dto; +import com.fasterxml.jackson.annotation.JsonFormat; import io.swagger.v3.oas.annotations.media.Schema; import lombok.AllArgsConstructor; import lombok.Getter; @@ -52,19 +53,22 @@ public class MinSimsaTargetDto { private String rcDate; @Schema(title = "심사시작일", example = "2022-03-23", description = "Input Description...") - @DateTimeFormat(pattern="yyyy-MM-dd") + //@DateTimeFormat(pattern="yyyy-MM-dd") + @JsonFormat(pattern="yyyy-MM-dd") private LocalDate msSdate; @Schema(title = "심사시작시간", example = " ", description = "Input Description...") private String msStartsi; @Schema(title = "심사종료일", example = "2022-03-24", description = "Input Description...") - @DateTimeFormat(pattern="yyyy-MM-dd") - private Date msEdate; + //@DateTimeFormat(pattern="yyyy-MM-dd") + @JsonFormat(pattern="yyyy-MM-dd") + private LocalDate msEdate; @Schema(title = "심사마감일", example = "2022-03-25", description = "Input Description...") - @DateTimeFormat(pattern="yyyy-MM-dd") - private Date msCdate; + //@DateTimeFormat(pattern="yyyy-MM-dd") + @JsonFormat(pattern="yyyy-MM-dd") + private LocalDate msCdate; @Schema(title = "심사마감시간", example = " ", description = "Input Description...") private String msClosesi; 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 35b972b..998c7ea 100644 --- a/src/main/java/com/xit/biz/ctgy/repository/IParkingRepository.java +++ b/src/main/java/com/xit/biz/ctgy/repository/IParkingRepository.java @@ -53,8 +53,8 @@ public interface IParkingRepository extends JpaRepository, IP @Nonnull @Param("msChasu") Long msChasu, @Nonnull @Param("msSdate") LocalDate msSdate, @Nonnull @Param("msStartsi") String msStartsi, - @Nonnull @Param("msEdate") Date msEdate, - @Nonnull @Param("msCdate") Date msCdate, + @Nonnull @Param("msEdate") LocalDate msEdate, + @Nonnull @Param("msCdate") LocalDate msCdate, @Nonnull @Param("msClosesi") String msClosesi, @Nonnull @Param("msResult") String msResult); } diff --git a/src/main/java/com/xit/biz/ctgy/repository/ITf680RecallRepository.java b/src/main/java/com/xit/biz/ctgy/repository/ITf680RecallRepository.java new file mode 100644 index 0000000..5fe7ac5 --- /dev/null +++ b/src/main/java/com/xit/biz/ctgy/repository/ITf680RecallRepository.java @@ -0,0 +1,8 @@ +package com.xit.biz.ctgy.repository; + +import com.xit.biz.ctgy.entity.MinInfoBoard680; +import com.xit.biz.ctgy.entity.Tf680Recall; +import org.springframework.data.jpa.repository.JpaRepository; + +public interface ITf680RecallRepository extends JpaRepository { +} 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 46aa21f..f289047 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,7 @@ public interface IParkingService { Page findAll(final MinSimsa680 minSimsa680, Pageable pageable); - void saveParkingSimsaTargets2(MinSimsaTargetDto dto); - - void saveParkingSimsaTargets(MinSimsaTargetDto dto); + List saveParkingSimsaTargets(MinSimsaTargetDto dto); Page findMinSimsa680s2(final MinSimsa680 minSimsa680, Pageable pageable); 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 5bc7d8a..4333ca3 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 @@ -61,36 +61,7 @@ public class ParkingService implements IParkingService { } @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 - public void saveParkingSimsaTargets2(MinSimsaTargetDto dto) { + public List saveParkingSimsaTargets(MinSimsaTargetDto dto) { boolean isFirst = true; for(Long rcCode : dto.getRcCodes()) { @@ -103,7 +74,9 @@ public class ParkingService implements IParkingService { } mapper.insertSimsaTargetIntoSelect(dto); + } + return repository.findSimsaTargets(dto); } diff --git a/src/main/java/com/xit/core/config/WebCommonConfig.java b/src/main/java/com/xit/core/config/WebCommonConfig.java index 7f2a12e..faa9725 100644 --- a/src/main/java/com/xit/core/config/WebCommonConfig.java +++ b/src/main/java/com/xit/core/config/WebCommonConfig.java @@ -33,7 +33,6 @@ import org.springframework.web.servlet.i18n.CookieLocaleResolver; import org.springframework.web.servlet.i18n.LocaleChangeInterceptor; import net.rakugakibox.util.YamlResourceBundle; -import java.time.Duration; import java.util.List; import java.util.Locale; import java.util.MissingResourceException; diff --git a/src/main/java/com/xit/core/config/support/DateTimeConfig.java b/src/main/java/com/xit/core/config/support/DateTimeConfig.java deleted file mode 100644 index fafbd2f..0000000 --- a/src/main/java/com/xit/core/config/support/DateTimeConfig.java +++ /dev/null @@ -1,39 +0,0 @@ -package com.xit.core.config.support; - -import lombok.NonNull; -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 { - - @NonNull - @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/java/com/xit/core/config/support/DateTimeFormatterConfig.java b/src/main/java/com/xit/core/config/support/DateTimeFormatterConfig.java new file mode 100644 index 0000000..c14ad2f --- /dev/null +++ b/src/main/java/com/xit/core/config/support/DateTimeFormatterConfig.java @@ -0,0 +1,28 @@ +package com.xit.core.config.support; + +import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateSerializer; +import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateTimeSerializer; +import org.springframework.boot.autoconfigure.jackson.Jackson2ObjectMapperBuilderCustomizer; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; + +import java.time.format.DateTimeFormatter; + +/** + * LocalDate, LocalDateTime 사용을 의한 formatter + * Swagger 사용시 WebMvcConfigurationSupport 의 확장이 불가 하여 별도로 등록 + */ +@Configuration +public class DateTimeFormatterConfig { + private static final String dateFormat = "yyyy-MM-dd"; + private static final String dateTimeFormat = "yyyy-MM-dd HH:mm:ss"; + + @Bean + public Jackson2ObjectMapperBuilderCustomizer jsonCustomizer() { + return builder -> { + builder.simpleDateFormat(dateTimeFormat); + builder.serializers(new LocalDateSerializer(DateTimeFormatter.ofPattern(dateFormat))); + builder.serializers(new LocalDateTimeSerializer(DateTimeFormatter.ofPattern(dateTimeFormat))); + }; + } +} diff --git a/src/main/java/com/xit/core/config/support/SpringDocApiConfig.java b/src/main/java/com/xit/core/config/support/SpringDocApiConfig.java index a54eeb5..a99ffd2 100644 --- a/src/main/java/com/xit/core/config/support/SpringDocApiConfig.java +++ b/src/main/java/com/xit/core/config/support/SpringDocApiConfig.java @@ -24,6 +24,9 @@ import java.util.Collections; import static org.springframework.http.MediaType.APPLICATION_JSON_VALUE; +/** + * WebMvcConfigurationSupport extends시 swagger-ui 오류 발생 + */ @Configuration public class SpringDocApiConfig { diff --git a/src/main/java/com/xit/core/init/XitFrameworkApplicationCommandLineRunner.java b/src/main/java/com/xit/core/init/XitFrameworkApplicationCommandLineRunner.java index 38daf6b..31622ef 100644 --- a/src/main/java/com/xit/core/init/XitFrameworkApplicationCommandLineRunner.java +++ b/src/main/java/com/xit/core/init/XitFrameworkApplicationCommandLineRunner.java @@ -8,17 +8,19 @@ import org.springframework.security.crypto.password.Pbkdf2PasswordEncoder; import org.springframework.security.crypto.scrypt.SCryptPasswordEncoder; import org.springframework.stereotype.Component; +import java.util.Arrays; + //@Order(1) -@Component +//@Component @Slf4j public class XitFrameworkApplicationCommandLineRunner implements CommandLineRunner { @Override public void run(String... args) throws Exception { -// log.info("====================================================================================="); -// log.info("XitFrameworkApplicationCommandLineRunner Args: " + Arrays.toString(args)); -// log.info("====================================================================================="); + log.info("====================================================================================="); + log.info("XitFrameworkApplicationCommandLineRunner Args: " + Arrays.toString(args)); + log.info("====================================================================================="); System.out.println(new BCryptPasswordEncoder().encode("gnadmin")); //System.out.println(new SCryptPasswordEncoder().encode("gnadmin")); diff --git a/src/main/java/com/xit/core/support/jpa/AuditEntity.java b/src/main/java/com/xit/core/support/jpa/AuditEntity.java index a91f3e8..1ecdfbd 100644 --- a/src/main/java/com/xit/core/support/jpa/AuditEntity.java +++ b/src/main/java/com/xit/core/support/jpa/AuditEntity.java @@ -13,9 +13,11 @@ import org.springframework.data.jpa.domain.support.AuditingEntityListener; import javax.persistence.*; import java.io.Serializable; import java.time.LocalDateTime; +import java.time.format.DateTimeFormatter; /** * 감사필드 값 생성 + * LocalDate foramtter 적용 * @see com.xit.core.support.jpa.AuditorAwareConfig */ @Schema(name = "AuditEntity", description = "감사 필드 정의") @@ -62,6 +64,16 @@ public class AuditEntity implements Serializable { @ColumnDefault(value = "'Y'") private String useYn = "Y"; + @PrePersist + public void onPrePersist(){ + this.createdBy = LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")); + this.modifiedBy = this.createdBy; + } + + @PreUpdate + public void onPreUpdate(){ + this.modifiedBy = LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")); + } // @PrePersist // protected void onCreate() {