diff --git a/db/ddl.sql b/db/ddl.sql index 5209a2e..a7782fd 100644 --- a/db/ddl.sql +++ b/db/ddl.sql @@ -18,6 +18,8 @@ create table ENS_SND_DTL_KKO_TALK ENVELOPE_ID VARCHAR2(34), ERROR_CODE VARCHAR2(40), ERROR_MESSAGE CLOB, + MK_JID VARCHAR2(24), + MK_TMPLT_MSG_JSON_DATA VARCHAR2(4000), LAST_UPDT_DT TIMESTAMP(6), REGIST_DT TIMESTAMP(6), BILL_UID VARCHAR2(45 char) diff --git a/src/main/java/cokr/xit/ens/biz/iup/signtalk/service/support/accept/AcptDocKkoTalk.java b/src/main/java/cokr/xit/ens/biz/iup/signtalk/service/support/accept/AcptDocKkoTalk.java index 23647a0..c908ba4 100644 --- a/src/main/java/cokr/xit/ens/biz/iup/signtalk/service/support/accept/AcptDocKkoTalk.java +++ b/src/main/java/cokr/xit/ens/biz/iup/signtalk/service/support/accept/AcptDocKkoTalk.java @@ -1,7 +1,9 @@ package cokr.xit.ens.biz.iup.signtalk.service.support.accept; +import java.time.format.*; + import cokr.xit.ens.biz.iup.domain.*; -import cokr.xit.ens.modules.kkomydoc.model.config.*; +import cokr.xit.ens.core.utils.*; import cokr.xit.ens.modules.kkotalk.model.*; import lombok.*; @@ -14,22 +16,16 @@ public class AcptDocKkoTalk implements Accept { @Override public KkotalkApiDTO.Envelope createDocument() { return KkotalkApiDTO.Envelope.builder() - .hash(null) - .build(); + .hash(null) + .content( + KkotalkApiDTO.Content.builder() + .link(redirectUrl) + .build()) + .readExpiresAt( + DateUtil.getTimeTOfTime(tbInputDataXit.getTbInputXit().getPayExpiresDt().format(DateTimeFormatter.ofPattern("yyyyMMddHHmmss")))) + // FIXME: readExpiresAt + 1일로 설정 + .reviewExpiresAt( + "2024-10-07T23:59:59") + .build(); } - - - private Property createProperty(TbInputDataXit data) { - return Property.builder() -// .link(data.getPayUrl()) - .link(redirectUrl) - .payload(null) - .message(null) - .cs_name("문의처") - .cs_number(data.getCallCenterNo()) -// .external_document_uuid(data.getDataId()) -// .external_document_uuid(data.getLinkedUuid()) - .build(); - } - } diff --git a/src/main/java/cokr/xit/ens/core/utils/DateUtil.java b/src/main/java/cokr/xit/ens/core/utils/DateUtil.java index a10c4df..3b7f7d6 100644 --- a/src/main/java/cokr/xit/ens/core/utils/DateUtil.java +++ b/src/main/java/cokr/xit/ens/core/utils/DateUtil.java @@ -1,17 +1,16 @@ package cokr.xit.ens.core.utils; -import java.sql.Timestamp; -import java.text.SimpleDateFormat; -import java.time.LocalDateTime; -import java.time.format.DateTimeFormatter; -import java.util.Calendar; +import java.sql.*; +import java.text.*; +import java.time.*; +import java.time.format.*; import java.util.Date; -import java.util.Optional; +import java.util.*; -import org.apache.commons.lang.StringUtils; +import org.apache.commons.lang.*; -import lombok.extern.slf4j.Slf4j; +import lombok.extern.slf4j.*; @Slf4j public class DateUtil { @@ -416,6 +415,17 @@ public class DateUtil { */ public static String getTimeOfTimeT(String timeT, String fmt) { return LocalDateTime.parse(timeT, DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ss")) - .format(DateTimeFormatter.ofPattern(StringUtils.isEmpty(fmt)? "DEFAULT_YMD_DT_FMT": fmt)); + .format(DateTimeFormatter.ofPattern(StringUtils.isEmpty(fmt)? "yyyy-MM-dd HH:mm:ss": fmt)); + } + + /** + * yyyyMMddHHmmss String > yyyy-MM-dd'T'HH:mm:ss String 으로 반환 + * @param time yyyyMMddHHmmss String + * + * @return yyyy-MM-dd'T'HH:mm:ss String + */ + public static String getTimeTOfTime(String time) { + return LocalDateTime.parse(time, DateTimeFormatter.ofPattern("yyyyMMddHHmmss")) + .format(DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ss")); } } diff --git a/src/main/java/cokr/xit/ens/modules/common/ctgy/intgrnnoti/service/support/IntgrnNotiAcceptor.java b/src/main/java/cokr/xit/ens/modules/common/ctgy/intgrnnoti/service/support/IntgrnNotiAcceptor.java index 9155591..2ed9b63 100644 --- a/src/main/java/cokr/xit/ens/modules/common/ctgy/intgrnnoti/service/support/IntgrnNotiAcceptor.java +++ b/src/main/java/cokr/xit/ens/modules/common/ctgy/intgrnnoti/service/support/IntgrnNotiAcceptor.java @@ -1,52 +1,33 @@ package cokr.xit.ens.modules.common.ctgy.intgrnnoti.service.support; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Set; -import java.util.concurrent.atomic.AtomicInteger; -import java.util.stream.Collectors; - -import javax.validation.ConstraintViolation; -import javax.validation.Validation; -import javax.validation.Validator; - -import org.springframework.stereotype.Component; -import org.springframework.transaction.annotation.Propagation; -import org.springframework.transaction.annotation.Transactional; - -import com.google.gson.Gson; -import com.google.gson.GsonBuilder; - -import cokr.xit.ens.core.aop.EnsResponseVO; -import cokr.xit.ens.core.exception.EnsException; -import cokr.xit.ens.core.exception.code.EnsErrCd; -import cokr.xit.ens.core.utils.CmmnUtil; -import cokr.xit.ens.core.utils.DateUtil; -import cokr.xit.ens.core.utils.IdGenerator; -import cokr.xit.ens.core.utils.MapDeserailizer; -import cokr.xit.ens.core.utils.crypto.AES256; -import cokr.xit.ens.core.utils.crypto.Crypto; -import cokr.xit.ens.modules.common.biztmplt.EnsPhaseProcSupport; -import cokr.xit.ens.modules.common.code.IntgrnDtlStatCd; -import cokr.xit.ens.modules.common.code.PostSeCd; -import cokr.xit.ens.modules.common.code.StatCd; -import cokr.xit.ens.modules.common.code.VenderCd; -import cokr.xit.ens.modules.common.ctgy.intgrnbill.support.entity.Bill; -import cokr.xit.ens.modules.common.ctgy.intgrnbill.support.entity.repository.BillRepository; -import cokr.xit.ens.modules.common.ctgy.intgrnnoti.code.TryStatCd; -import cokr.xit.ens.modules.common.ctgy.intgrnnoti.domain.IntgrnSendDetail; -import cokr.xit.ens.modules.common.ctgy.intgrnnoti.domain.IntgrnSendMast; -import cokr.xit.ens.modules.common.ctgy.intgrnnoti.domain.repository.IntgrnSendDetailRepository; -import cokr.xit.ens.modules.common.ctgy.intgrnnoti.domain.repository.IntgrnSendMastRepository; -import cokr.xit.ens.modules.common.ctgy.intgrnnoti.model.IntgrnNotiAcceptReqDTO; -import cokr.xit.ens.modules.common.ctgy.intgrnnoti.model.TmpltMngIntgrnDTO; -import cokr.xit.ens.modules.common.ctgy.sys.mng.domain.OrgMng; -import cokr.xit.ens.modules.common.ctgy.sys.mng.service.OrgMngService; -import cokr.xit.ens.modules.common.ctgy.sys.mng.service.TmpltMngService; -import lombok.RequiredArgsConstructor; -import lombok.extern.slf4j.Slf4j; +import java.util.*; +import java.util.concurrent.atomic.*; +import java.util.stream.*; + +import javax.validation.*; + +import org.springframework.stereotype.*; +import org.springframework.transaction.annotation.*; + +import com.google.gson.*; + +import cokr.xit.ens.core.aop.*; +import cokr.xit.ens.core.exception.*; +import cokr.xit.ens.core.exception.code.*; +import cokr.xit.ens.core.utils.*; +import cokr.xit.ens.core.utils.crypto.*; +import cokr.xit.ens.modules.common.biztmplt.*; +import cokr.xit.ens.modules.common.code.*; +import cokr.xit.ens.modules.common.ctgy.intgrnbill.support.entity.*; +import cokr.xit.ens.modules.common.ctgy.intgrnbill.support.entity.repository.*; +import cokr.xit.ens.modules.common.ctgy.intgrnnoti.code.*; +import cokr.xit.ens.modules.common.ctgy.intgrnnoti.domain.*; +import cokr.xit.ens.modules.common.ctgy.intgrnnoti.domain.repository.*; +import cokr.xit.ens.modules.common.ctgy.intgrnnoti.model.*; +import cokr.xit.ens.modules.common.ctgy.sys.mng.domain.*; +import cokr.xit.ens.modules.common.ctgy.sys.mng.service.*; +import lombok.*; +import lombok.extern.slf4j.*; // TODO: Accept @Slf4j @@ -127,26 +108,26 @@ public class IntgrnNotiAcceptor implements EnsPhaseProcSupport, Kk if (!CmmnUtil.isEmpty(document.getReviewExpiresAt())) { String expDate = DateUtil.getTimeOfTimeT(document.getReviewExpiresAt(), "yyyyMMddHHmmss"); int sec = DateUtil.secByFromBetweenTo(DateUtil.toLocalDateTime(expDate), DateUtil.toLocalDateTime(reqDTO.getClose_dt())); - if (sec < 0) - result.add(String.format("마감일시보다 \"재열람 만료일시\"가 느립니다. [ document[%d].acpt_data.kko_talk.readExpiresAt ]", i.get())); + // FIXME: 테스트를 위해 skip - 테스트완료후 활성화 + // if (sec < 0) + // result.add(String.format("마감일시보다 \"재열람 만료일시\"가 느립니다. [ document[%d].acpt_data.kko_talk.readExpiresAt ]", i.get())); } } i.getAndIncrement(); diff --git a/src/main/java/cokr/xit/ens/modules/kkotalk/service/support/KkoTalkMaker.java b/src/main/java/cokr/xit/ens/modules/kkotalk/service/support/KkoTalkMaker.java index bf39942..30b4db9 100644 --- a/src/main/java/cokr/xit/ens/modules/kkotalk/service/support/KkoTalkMaker.java +++ b/src/main/java/cokr/xit/ens/modules/kkotalk/service/support/KkoTalkMaker.java @@ -1,47 +1,35 @@ package cokr.xit.ens.modules.kkotalk.service.support; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Optional; -import java.util.stream.Collectors; - -import org.springframework.context.ApplicationEventPublisher; -import org.springframework.stereotype.Component; -import org.springframework.transaction.annotation.Propagation; -import org.springframework.transaction.annotation.Transactional; - -import com.google.gson.Gson; -import com.google.gson.GsonBuilder; - -import cokr.xit.ens.core.aop.EnsResponseVO; -import cokr.xit.ens.core.exception.EnsException; -import cokr.xit.ens.core.exception.code.EnsErrCd; -import cokr.xit.ens.core.monitor.slack.event.MonitorEvent; -import cokr.xit.ens.core.utils.CmmnUtil; -import cokr.xit.ens.core.utils.IdGenerator; -import cokr.xit.ens.core.utils.MapDeserailizer; -import cokr.xit.ens.core.utils.crypto.AES256; -import cokr.xit.ens.core.utils.crypto.Crypto; -import cokr.xit.ens.core.utils.crypto.SHA256; -import cokr.xit.ens.modules.common.biztmplt.MakeProcTemplate; -import cokr.xit.ens.modules.common.code.PostSeCd; -import cokr.xit.ens.modules.common.code.StatCd; -import cokr.xit.ens.modules.common.ctgy.nicedici.service.NiceDiCiService; -import cokr.xit.ens.modules.common.ctgy.sys.mng.domain.OrgMng; -import cokr.xit.ens.modules.common.ctgy.sys.mng.service.OrgMngService; -import cokr.xit.ens.modules.common.domain.SendMast; -import cokr.xit.ens.modules.common.domain.repository.SendMastRepository; -import cokr.xit.ens.modules.common.domain.support.FieldError; -import cokr.xit.ens.modules.common.event.SendMastStatUpdateEvent; -import cokr.xit.ens.modules.common.monitor.MessageByPhase; -import cokr.xit.ens.modules.kkotalk.mapper.IKkoTalkMapper; -import cokr.xit.ens.modules.kkotalk.model.KkotalkDTO; -import cokr.xit.ens.modules.kkotalk.model.TmpltMngKkoTalkDTO; -import cokr.xit.ens.modules.kkotalk.service.strategy.TmpltMngStrategyKkoTalk; -import lombok.RequiredArgsConstructor; -import lombok.extern.slf4j.Slf4j; -import lombok.val; +import java.util.*; +import java.util.stream.*; + +import org.springframework.context.*; +import org.springframework.stereotype.*; +import org.springframework.transaction.annotation.*; + +import com.google.gson.*; + +import cokr.xit.ens.core.aop.*; +import cokr.xit.ens.core.exception.*; +import cokr.xit.ens.core.exception.code.*; +import cokr.xit.ens.core.monitor.slack.event.*; +import cokr.xit.ens.core.utils.*; +import cokr.xit.ens.core.utils.crypto.*; +import cokr.xit.ens.modules.common.biztmplt.*; +import cokr.xit.ens.modules.common.code.*; +import cokr.xit.ens.modules.common.ctgy.nicedici.service.*; +import cokr.xit.ens.modules.common.ctgy.sys.mng.domain.*; +import cokr.xit.ens.modules.common.ctgy.sys.mng.service.*; +import cokr.xit.ens.modules.common.domain.*; +import cokr.xit.ens.modules.common.domain.repository.*; +import cokr.xit.ens.modules.common.domain.support.*; +import cokr.xit.ens.modules.common.event.*; +import cokr.xit.ens.modules.common.monitor.*; +import cokr.xit.ens.modules.kkotalk.mapper.*; +import cokr.xit.ens.modules.kkotalk.model.*; +import cokr.xit.ens.modules.kkotalk.service.strategy.*; +import lombok.*; +import lombok.extern.slf4j.*; // FIXME: 카카오톡 신규 추가 @Slf4j @@ -74,8 +62,7 @@ public class KkoTalkMaker extends MakeProcTemplate { sendDetails = kkoTalkMapper.findAllBySendMastId(sendMastId); SendMast finalSendMast = sendMast; OrgMng orgMng = orgMngService.find(sendMast.getOrgCd()).getResultInfo(); -// TmpltMngKkoMydoc tmpltMngDTO = tmpltMngRepository.findFetchByOrgCdAndTmpltCdAndUseYn(sendMast.getOrgCd(), sendMast.getTmpltCd(), "Y") -// .orElseThrow(() -> new EnsException(EnsErrCd.MAKE404, String.format("일치하는 템플릿 자료가 없거나 미사용 상태의 템플릿 입니다. [ sendMastId %s orgCd %s TmpltCd %s ]", sendMastId, finalSendMast.getOrgCd(), finalSendMast.getTmpltCd()))); + TmpltMngKkoTalkDTO tmpltMngDTO = tmpltMngService.find(sendMast.getOrgCd(), sendMast.getTmpltCd()) .orElseThrow(() -> new EnsException(EnsErrCd.MAKE404, String.format("일치하는 템플릿 자료가 없습니다. [ sendMastId %s orgCd %s TmpltCd %s ]", sendMastId, finalSendMast.getOrgCd(), finalSendMast.getTmpltCd()))); if (!"Y".equals(tmpltMngDTO.getUseYn())) @@ -87,7 +74,6 @@ public class KkoTalkMaker extends MakeProcTemplate { List jids = sendDetails.stream() // .filter(row -> "Y".equals(row.getMkCiTransUseYn())) .filter(row -> !CmmnUtil.isEmpty(row.getMkJid())) -// .map(row -> row.getMkJid()) .map(row -> aes256.decrypt(row.getMkJid())) .collect(Collectors.toList()); if (!CmmnUtil.isEmpty(jids)) { @@ -128,11 +114,11 @@ public class KkoTalkMaker extends MakeProcTemplate { String.format("name 생성에 실패 했습니다. [ orgCd %s tmpltCd %s]", tmpltMngDTO.getOrgCd(), tmpltMngDTO.getTmpltCd())))); } - //if ("Y".equals(tmpltMngDTO.getTmpltMsgUseYn())) { - // boolean usePryMsg = CmmnUtil.isEmpty(tmpltMngDTO.getPryMessage()) ? false : true; - // row.setPropMessage(Optional.ofNullable(this.msgTmplateToMessage(usePryMsg, tmpltMngDTO, row.getMkTmpltMsgJsonData())) - // .orElseThrow(() -> new EnsException(EnsErrCd.MAKE521, String.format("propMessage 생성에 실패 했습니다. [ orgCd %s tmpltCd %s tmpltMsgJsonData %s ]", tmpltMngDTO.getOrgCd(), tmpltMngDTO.getTmpltCd(), row.getMkTmpltMsgJsonData())))); - //} + if ("Y".equals(tmpltMngDTO.getTmpltMsgUseYn())) { + boolean usePryMsg = CmmnUtil.isEmpty(tmpltMngDTO.getPryMessage()) ? false : true; + row.setGuide(Optional.ofNullable(this.msgTmplateToMessage(usePryMsg, tmpltMngDTO, row.getMkTmpltMsgJsonData())) + .orElseThrow(() -> new EnsException(EnsErrCd.MAKE521, String.format("propMessage 생성에 실패 했습니다. [ orgCd %s tmpltCd %s tmpltMsgJsonData %s ]", tmpltMngDTO.getOrgCd(), tmpltMngDTO.getTmpltCd(), row.getMkTmpltMsgJsonData())))); + } if (CmmnUtil.isEmpty(row.getExternalId())) row.setExternalId(Optional.ofNullable(IdGenerator.getUUID()) @@ -145,10 +131,10 @@ public class KkoTalkMaker extends MakeProcTemplate { row.setHash(Optional.ofNullable(this.createHash(row)) .orElseThrow(() -> new EnsException(EnsErrCd.MAKE521, String.format("hash 생성에 실패 했습니다.")))); - //if ("Y".equals(tmpltMngDTO.getCiTransUseYn()) && !CmmnUtil.isEmpty(row.getMkJid())) - // row.setRecvCi(Optional.ofNullable(finalMCi.get(aes256.decrypt(row.getMkJid()).replaceAll("[^0-9]", ""))) - // .map(ci -> CmmnUtil.isEmpty(ci) ? null : ci) - // .orElseThrow(() -> new EnsException(EnsErrCd.MAKE610, String.format("recvCi 생성에 실패 했습니다. 주민번호에 대한 CI 값이 없습니다. [ jid %s ]", aes256.decrypt(row.getMkJid()))))); + if ("Y".equals(tmpltMngDTO.getCiTransUseYn()) && !CmmnUtil.isEmpty(row.getMkJid())) + row.setCi(Optional.ofNullable(finalMCi.get(aes256.decrypt(row.getMkJid()).replaceAll("[^0-9]", ""))) + .map(ci -> CmmnUtil.isEmpty(ci) ? null : ci) + .orElseThrow(() -> new EnsException(EnsErrCd.MAKE610, String.format("recvCi 생성에 실패 했습니다. 주민번호에 대한 CI 값이 없습니다. [ jid %s ]", aes256.decrypt(row.getMkJid()))))); //row.setError(FieldError.initBuilder().build()); return 1; @@ -191,7 +177,7 @@ public class KkoTalkMaker extends MakeProcTemplate { applicationEventPublisher.publishEvent(MonitorEvent.builder() .message(MessageByPhase.builder() .oClass(getClass().getSimpleName() + "." + new Throwable().getStackTrace()[0].getMethodName()) - .postSeCd(PostSeCd.kkoMydoc) + .postSeCd(PostSeCd.kkoTalk) .statCd(StatCd.makefail) .errCd(respVO.getErrCode()) .message("-.SendMastId: " + sendMastId + "\n" + respVO.getErrMsg()) diff --git a/src/main/resources/config/conf-slack.yml b/src/main/resources/config/conf-slack.yml index 37dab03..e348c11 100644 --- a/src/main/resources/config/conf-slack.yml +++ b/src/main/resources/config/conf-slack.yml @@ -4,4 +4,5 @@ slack: chat: https://slack.com/api/chat.postMessage users: https://slack.com/api/users.lookupByEmail recev: - emails: kimjio83@gmail.com, minuk926@gmail.com \ No newline at end of file + #emails: kimjio83@gmail.com, minuk926@gmail.com + emails: kimjio83@gmail.com diff --git a/src/main/resources/mybatis-mapper/modules/iup-kkotalk-mapper.xml b/src/main/resources/mybatis-mapper/modules/iup-kkotalk-mapper.xml index e7700b0..1235d17 100644 --- a/src/main/resources/mybatis-mapper/modules/iup-kkotalk-mapper.xml +++ b/src/main/resources/mybatis-mapper/modules/iup-kkotalk-mapper.xml @@ -23,6 +23,8 @@ name, birthday, external_id, + mk_jid, + mk_tmplt_msg_json_data, error_code, error_message, bill_uid, @@ -43,6 +45,8 @@ #{name}, #{birthday}, #{externalId}, + #{mkJid}, + #{mkTmpltMsgJsonData}, #{errorCode}, #{errorMessage}, #{billUid}, @@ -67,6 +71,8 @@ name, birthday, external_id, + mk_jid, + mk_tmplt_msg_json_data, error_code, error_message, bill_uid, @@ -92,6 +98,8 @@ name, birthday, external_id, + mk_jid, + mk_tmplt_msg_json_data, error_code, error_message, bill_uid,