From d00696c73e61ee9ea7039d0d0f70f0dd5ed4f828 Mon Sep 17 00:00:00 2001 From: thkim Date: Thu, 11 Jan 2024 16:36:30 +0900 Subject: [PATCH] =?UTF-8?q?feat:=20=EA=B4=80=EB=A6=AC=EC=9E=90=20=EB=8B=A8?= =?UTF-8?q?=EC=97=90=EC=84=9C=20'=EC=9C=84=EC=9B=90=ED=9A=8C=20=EA=B4=80?= =?UTF-8?q?=EB=A6=AC'=20>=20'=EC=9C=84=EC=9B=90=ED=9A=8C=20=EC=9D=BC?= =?UTF-8?q?=EC=A0=95=20=EA=B4=80=EB=A6=AC'=EC=97=90=20'=EB=93=B1=EB=A1=9D'?= =?UTF-8?q?=20=EB=B2=84=ED=8A=BC=EC=9D=84=20=EB=88=84=EB=A5=B8=20=ED=9B=84?= =?UTF-8?q?=20'=EC=9C=84=EC=9B=90=ED=9A=8C=20=EC=9D=BC=EC=A0=95=20?= =?UTF-8?q?=EB=93=B1=EB=A1=9D'=20=ED=8E=98=EC=9D=B4=EC=A7=80=EC=97=90?= =?UTF-8?q?=EC=84=9C=20=ED=95=AD=EB=AA=A9=20=EC=9E=85=EB=A0=A5=20=ED=9B=84?= =?UTF-8?q?=20'=EC=A0=80=EC=9E=A5'=EC=9D=84=20=EB=B2=84=ED=8A=BC=20?= =?UTF-8?q?=EB=88=84=EB=A5=BC=20=EB=95=8C=20=EC=A0=80=EC=9E=A5=EB=90=98?= =?UTF-8?q?=EB=8F=84=EB=A1=9D=20=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../EgovIndvdlSchdulManageServiceImpl.java | 20 +---- .../repository/TnCmtEventRepository.java | 78 +++++++++++++++---- .../resources/application-local.properties | 6 +- 3 files changed, 72 insertions(+), 32 deletions(-) diff --git a/kcsc-back-end/src/main/java/com/dbnt/kcscbackend/admin/committee/schedules/service/impl/EgovIndvdlSchdulManageServiceImpl.java b/kcsc-back-end/src/main/java/com/dbnt/kcscbackend/admin/committee/schedules/service/impl/EgovIndvdlSchdulManageServiceImpl.java index 014dc87..da6cd78 100644 --- a/kcsc-back-end/src/main/java/com/dbnt/kcscbackend/admin/committee/schedules/service/impl/EgovIndvdlSchdulManageServiceImpl.java +++ b/kcsc-back-end/src/main/java/com/dbnt/kcscbackend/admin/committee/schedules/service/impl/EgovIndvdlSchdulManageServiceImpl.java @@ -112,7 +112,6 @@ public class EgovIndvdlSchdulManageServiceImpl extends EgovAbstractServiceImpl i } @Override - @Transactional(rollbackFor = {Exception.class}) public ResultVO createSchedule(ResultVO resultVO, HttpServletRequest request, CreateScheduleVO createScheduleVO) throws Exception { System.out.println( @@ -124,29 +123,16 @@ public class EgovIndvdlSchdulManageServiceImpl extends EgovAbstractServiceImpl i "\n--------------------------------------------------------------\n" ); - Locale currentLocale = new Locale("KOREAN", "KOREA"); - SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss", currentLocale); - Date date = formatter.parse(createScheduleVO.getStartDate()); - LocalDate startDate = date.toInstant() - .atZone(ZoneId.systemDefault()) - .toLocalDate(); - - LocalDateTime endDate = Instant.ofEpochMilli(date.getTime()) - .atZone(ZoneId.systemDefault()) - .toLocalDateTime(); - - Timestamp ts=new Timestamp(date.getTime()); - - tnCmtEventRepository.sp_add_tn_cmt_event( + Map response = tnCmtEventRepository.spAddTnCmtEvent( createScheduleVO.getDivMeet(), createScheduleVO.getUpCommittee(), createScheduleVO.getCommittee(), createScheduleVO.getTitle(), createScheduleVO.getLocation(), createScheduleVO.getContents(), - date, - date, + createScheduleVO.getStartDate(), + createScheduleVO.getEndDate(), "admin", null, null, diff --git a/kcsc-back-end/src/main/java/com/dbnt/kcscbackend/admin/config/repository/TnCmtEventRepository.java b/kcsc-back-end/src/main/java/com/dbnt/kcscbackend/admin/config/repository/TnCmtEventRepository.java index 2c8b149..b7580e3 100644 --- a/kcsc-back-end/src/main/java/com/dbnt/kcscbackend/admin/config/repository/TnCmtEventRepository.java +++ b/kcsc-back-end/src/main/java/com/dbnt/kcscbackend/admin/config/repository/TnCmtEventRepository.java @@ -2,30 +2,82 @@ package com.dbnt.kcscbackend.admin.config.repository; import com.dbnt.kcscbackend.admin.config.entity.TnCmtEvent; import com.dbnt.kcscbackend.admin.config.entity.TnCmtOrg; +import com.fasterxml.jackson.annotation.JsonFormat; import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.jpa.repository.Modifying; +import org.springframework.data.jpa.repository.Query; import org.springframework.data.jpa.repository.query.Procedure; +import org.springframework.data.repository.query.Param; +import org.springframework.format.annotation.DateTimeFormat; +import org.springframework.transaction.annotation.Transactional; + +import java.sql.Timestamp; import java.time.LocalDate; import java.time.LocalDateTime; import java.util.Date; import java.util.List; +import java.util.Map; public interface TnCmtEventRepository extends JpaRepository { + + @Transactional + @Modifying + @Query(value = "SET datestyle TO ISO, MDY", nativeQuery = true) + int setDateStyle(); + @Procedure int sp_add_tn_cmt_event( - String evtType, - Integer upCmtSeq, - Integer cmtSeq, - String evtTitle, - String evtLocation, - String evtContents, - Date evtStartDt, - Date evtEndDt, - String modiId, - Integer _evt_seq, - Integer _result_count, - String _result_code, - String _error_message + @Param("_evt_type") String evtType, + @Param("_up_cmt_seq") Integer upCmtSeq, + @Param("_cmt_seq") Integer cmtSeq, + @Param("_evt_title") String evtTitle, + @Param("_evt_location") String evtLocation, + @Param("_evt_contents") String evtContents, + @Param("_evt_start_dt") Date evtStartDt, + @Param("_evt_end_dt") Date evtEndDt, + @Param("_modi_id") String modiId, + @Param("_evt_seq") Integer _evt_seq, + @Param("_result_count") Integer _result_count, + @Param("_result_code") String _result_code, + @Param("_error_message") String _error_message + ); + + @Query(value = "CALL sp_add_tn_cmt_event (" + + ":_evt_type, " + + ":_up_cmt_seq, " + + ":_cmt_seq, " + + ":_evt_title, " + + ":_evt_location, " + + ":_evt_contents, " + + "TO_TIMESTAMP(" + + " :_evt_start_dt," + + " 'YYYY-MM-DD HH24:MI:SS'" + + ")::::timestamptz AT TIME ZONE 'UTC', " + + "TO_TIMESTAMP(" + + " :_evt_end_dt," + + " 'YYYY-MM-DD HH24:MI:SS'" + + ")::::timestamptz AT TIME ZONE 'UTC', " + + ":_modi_id, " + + ":_evt_seq, " + + ":_result_count, " + + ":_result_code, " + + ":_error_message)", + nativeQuery = true) + Map spAddTnCmtEvent( + @Param("_evt_type") String evtType, + @Param("_up_cmt_seq") Integer upCmtSeq, + @Param("_cmt_seq") Integer cmtSeq, + @Param("_evt_title") String evtTitle, + @Param("_evt_location") String evtLocation, + @Param("_evt_contents") String evtContents, + @Param("_evt_start_dt") String evtStartDt, + @Param("_evt_end_dt") String evtEndDt, + @Param("_modi_id") String modiId, + @Param("_evt_seq") Integer evtSeq, + @Param("_result_count") Integer resultCount, + @Param("_result_code") String resultCode, + @Param("_error_message") String errorMessage ); /* diff --git a/kcsc-back-end/src/main/resources/application-local.properties b/kcsc-back-end/src/main/resources/application-local.properties index 2920034..ffcfe5b 100644 --- a/kcsc-back-end/src/main/resources/application-local.properties +++ b/kcsc-back-end/src/main/resources/application-local.properties @@ -13,11 +13,12 @@ spring.datasource.hikari.maximum-pool-size=4 #spring.datasource.username=kcsc #spring.datasource.password=dbnt0928! spring.datasource.driverClassName=net.sf.log4jdbc.sql.jdbcapi.DriverSpy -spring.datasource.url=jdbc:log4jdbc:postgresql://127.0.0.1:5432/kcsc -#spring.datasource.url=jdbc:log4jdbc:postgresql://118.219.150.34:50503/kcsc +#spring.datasource.url=jdbc:log4jdbc:postgresql://127.0.0.1:5432/kcsc +spring.datasource.url=jdbc:log4jdbc:postgresql://118.219.150.34:50503/kcsc spring.datasource.username=dbnt0031 spring.datasource.password=dbnt0928! + #jpa spring.jpa.show-sql=true spring.jpa.generate-ddl=false @@ -25,6 +26,7 @@ spring.jpa.hibernate.naming.physical-strategy = org.hibernate.boot.model.naming. spring.jpa.properties.hibernate.proc.param_null_passing=true + # MyBatis mybatis.mapper-locations: mybatisMapper/*.xml mybatis.configuration.map-underscore-to-camel-case=true