From 5760ac506d21c63cecbcc1cebc221645603f2699 Mon Sep 17 00:00:00 2001 From: "Jonguk. Lim" Date: Tue, 10 Sep 2024 11:01:21 +0900 Subject: [PATCH] =?UTF-8?q?feat:=20=EC=B9=B4=EC=B9=B4=EC=98=A4=ED=86=A1=20?= =?UTF-8?q?=EC=B6=94=EA=B0=80=20=EB=B0=98=EC=98=81=20-=20send=20=20=20=20?= =?UTF-8?q?=20=20=20-=20=EC=A0=84=EC=86=A1=EA=B2=B0=EA=B3=BC=20=EC=B9=B4?= =?UTF-8?q?=EC=B9=B4=EC=98=A4=ED=86=A1=20=EC=83=81=EC=84=B8=20=ED=85=8C?= =?UTF-8?q?=EC=9D=B4=EB=B8=94=20=EB=B0=98=EC=98=81=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../xit/ens/modules/common/code/PostSeCd.java | 11 +++ .../support/IntgrnNotiRsltFetcher.java | 4 +- .../modules/kkotalk/code/KkoTalkStatusCd.java | 19 +++-- .../kkotalk/model/KkoTalkRsltRespDTO.java | 14 ++-- .../kkotalk/model/config/KkoTalkStat.java | 61 +++++++++++++++ .../service/support/KkoTalkRsltFetcher.java | 75 ++++++++----------- .../service/support/KkoTalkRsltProvider.java | 43 ++++++----- 7 files changed, 147 insertions(+), 80 deletions(-) create mode 100644 src/main/java/cokr/xit/ens/modules/kkotalk/model/config/KkoTalkStat.java diff --git a/src/main/java/cokr/xit/ens/modules/common/code/PostSeCd.java b/src/main/java/cokr/xit/ens/modules/common/code/PostSeCd.java index 12e37b7..1e47508 100644 --- a/src/main/java/cokr/xit/ens/modules/common/code/PostSeCd.java +++ b/src/main/java/cokr/xit/ens/modules/common/code/PostSeCd.java @@ -1,5 +1,9 @@ package cokr.xit.ens.modules.common.code; +import java.util.*; + +import com.fasterxml.jackson.annotation.*; + import cokr.xit.ens.core.code.*; import lombok.*; @@ -26,4 +30,11 @@ public enum PostSeCd implements CodeMapperType { return this.name(); } + @JsonCreator + public static PostSeCd getEnum(String value) { + return Arrays.stream(values()) + .filter(v -> v.getCode().equalsIgnoreCase(value)) + .findAny() + .orElseThrow(() -> new IllegalArgumentException("Invalid PostSeCd: " + value)); + } } diff --git a/src/main/java/cokr/xit/ens/modules/common/ctgy/intgrnnoti/service/support/IntgrnNotiRsltFetcher.java b/src/main/java/cokr/xit/ens/modules/common/ctgy/intgrnnoti/service/support/IntgrnNotiRsltFetcher.java index 86fbef2..ea920ff 100644 --- a/src/main/java/cokr/xit/ens/modules/common/ctgy/intgrnnoti/service/support/IntgrnNotiRsltFetcher.java +++ b/src/main/java/cokr/xit/ens/modules/common/ctgy/intgrnnoti/service/support/IntgrnNotiRsltFetcher.java @@ -143,7 +143,9 @@ public class IntgrnNotiRsltFetcher extends ResultProcTemplate { } } } - + // FIXME: 카카오톡 추가 - 명시적 반영 + // intgrnSendMastRepository.flush(); + // intgrnSendDetailRepository.flush(); return respVO; } diff --git a/src/main/java/cokr/xit/ens/modules/kkotalk/code/KkoTalkStatusCd.java b/src/main/java/cokr/xit/ens/modules/kkotalk/code/KkoTalkStatusCd.java index 979c8cf..d52d1fe 100644 --- a/src/main/java/cokr/xit/ens/modules/kkotalk/code/KkoTalkStatusCd.java +++ b/src/main/java/cokr/xit/ens/modules/kkotalk/code/KkoTalkStatusCd.java @@ -1,5 +1,9 @@ package cokr.xit.ens.modules.kkotalk.code; +import java.util.*; + +import com.fasterxml.jackson.annotation.*; + import cokr.xit.ens.modules.common.code.*; import lombok.*; @@ -50,19 +54,18 @@ public enum KkoTalkStatusCd implements IntgrnDtlStatMapperType { if (statCd == null) return KkoTalkStatusCd.UNKNOWN; - KkoTalkStatusCd docBoxStatusCd = null; try { - docBoxStatusCd = KkoTalkStatusCd.valueOf(statCd); + return KkoTalkStatusCd.valueOf(statCd); } catch (IllegalArgumentException e) { - docBoxStatusCd = KkoTalkStatusCd.UNKNOWN; + return KkoTalkStatusCd.UNKNOWN; } - return docBoxStatusCd; } - + @JsonCreator public static KkoTalkStatusCd getEnum(String value) { - for(KkoTalkStatusCd v : values()) - if(v.getCode().equalsIgnoreCase(value)) return v; - throw new IllegalArgumentException(); + return Arrays.stream(values()) + .filter(v -> v.getCode().equalsIgnoreCase(value)) + .findAny() + .orElseThrow(() -> new IllegalArgumentException("Invalid KkoTalkStatusCd: " + value)); } } diff --git a/src/main/java/cokr/xit/ens/modules/kkotalk/model/KkoTalkRsltRespDTO.java b/src/main/java/cokr/xit/ens/modules/kkotalk/model/KkoTalkRsltRespDTO.java index dc84478..77229a6 100644 --- a/src/main/java/cokr/xit/ens/modules/kkotalk/model/KkoTalkRsltRespDTO.java +++ b/src/main/java/cokr/xit/ens/modules/kkotalk/model/KkoTalkRsltRespDTO.java @@ -1,12 +1,12 @@ package cokr.xit.ens.modules.kkotalk.model; -import java.util.List; +import java.util.*; -import cokr.xit.ens.core.model.EnsRsltRespDTO; -import cokr.xit.ens.modules.kkomydoc.model.config.KkoMydocStat; -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; -import lombok.experimental.SuperBuilder; +import cokr.xit.ens.core.model.*; +import cokr.xit.ens.modules.kkotalk.model.config.*; +import io.swagger.v3.oas.annotations.media.*; +import lombok.*; +import lombok.experimental.*; @SuperBuilder @Data @@ -15,6 +15,6 @@ public class KkoTalkRsltRespDTO extends EnsRsltRespDTO { @Schema(required = true, title = "발송마스터ID", example = " ") private Long sendMastId; @Schema(required = false, title = "발송요청문서", example = " ") - private List documents; + private List documents; } diff --git a/src/main/java/cokr/xit/ens/modules/kkotalk/model/config/KkoTalkStat.java b/src/main/java/cokr/xit/ens/modules/kkotalk/model/config/KkoTalkStat.java new file mode 100644 index 0000000..ac6edd5 --- /dev/null +++ b/src/main/java/cokr/xit/ens/modules/kkotalk/model/config/KkoTalkStat.java @@ -0,0 +1,61 @@ +package cokr.xit.ens.modules.kkotalk.model.config; + +import javax.persistence.*; + +import com.fasterxml.jackson.annotation.*; +import com.google.gson.annotations.*; + +import cokr.xit.ens.modules.kkotalk.code.*; +import io.swagger.v3.oas.annotations.media.*; +import lombok.*; + +@Getter +@ToString +@Builder +@Schema(name = "KkoTalkStat") +@NoArgsConstructor +@AllArgsConstructor +public class KkoTalkStat { + + @Expose + @JsonIgnore + @Schema(required = false, title = "발송상세ID", example = " ") + private Long sendDetailId; + + @Schema(required = false, title = "문서식별번호(외부)", example = " ") + private String externalId; + + @Schema(required = true, title = "문서식별번호(내부)", example = " ") + private String envelopeId; + + @Enumerated(EnumType.STRING) + @Schema(required = true, title = "진행 상태", example = " ") + private KkoTalkStatusCd status; + + @Schema(required = false, title = "송신 시간(yyyyMMddHHmmss)", example = " ") + private String sentDt; + + @Schema(required = false, title = "수신 시간(yyyyMMddHHmmss)", example = " ") + private String receivedDt; + + // FIXME: 카카오톡 적용 필요 + // @Schema(required = false, title = "열람 인증을 성공한 최초 시간(yyyyMMddHHmmss)", example = " ") + private String authenticatedAt; + // + // @Schema(required = false, title = "OTT 검증을 성공한 최초 시간(yyyyMMddHHmmss)", example = " ") + private String ottVerifiedAt; + // + // @Schema(required = false, title = "최초 열람 시간(yyyyMMddHHmmss)", example = " ") + private String readAt; + // + // @Schema(required = false, title = "알림톡 수신 시간(yyyyMMddHHmmss)", example = " ") + private String userNotifiedAt; + + @Schema(required = false, title = "에러코드", example = " ") + private String errorCode; + + @Schema(required = false, title = "에러메시지", example = " ") + private String errorMessage; + + +} diff --git a/src/main/java/cokr/xit/ens/modules/kkotalk/service/support/KkoTalkRsltFetcher.java b/src/main/java/cokr/xit/ens/modules/kkotalk/service/support/KkoTalkRsltFetcher.java index 942fa8c..bebdf87 100644 --- a/src/main/java/cokr/xit/ens/modules/kkotalk/service/support/KkoTalkRsltFetcher.java +++ b/src/main/java/cokr/xit/ens/modules/kkotalk/service/support/KkoTalkRsltFetcher.java @@ -1,43 +1,36 @@ package cokr.xit.ens.modules.kkotalk.service.support; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.stream.Collectors; +import java.util.*; +import java.util.stream.*; import org.springframework.beans.factory.annotation.Value; -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.common.collect.Lists; -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.MapDeserailizer; -import cokr.xit.ens.modules.common.biztmplt.ResultProcTemplate; -import cokr.xit.ens.modules.common.code.StatCd; -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.kkomydoc.code.KkoMydocStatusCd; -import cokr.xit.ens.modules.kkomydoc.domain.SendDetailKkoMydoc; -import cokr.xit.ens.modules.kkomydoc.domain.SendDetailKkoMydocStatHist; -import cokr.xit.ens.modules.kkomydoc.domain.repository.SendDetailKkoMydocRepository; -import cokr.xit.ens.modules.kkomydoc.domain.repository.SendDetailKkoMydocStatHistRepository; -import cokr.xit.ens.modules.kkomydoc.model.KkoMydocApiRespVO; -import cokr.xit.ens.modules.kkotalk.mapper.IKkoTalkMapper; -import cokr.xit.ens.modules.kkotalk.model.KkotalkDTO; -import lombok.RequiredArgsConstructor; -import lombok.extern.slf4j.Slf4j; +import org.springframework.context.*; +import org.springframework.stereotype.*; +import org.springframework.transaction.annotation.*; + +import com.google.common.collect.*; +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.modules.common.biztmplt.*; +import cokr.xit.ens.modules.common.code.*; +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.kkomydoc.code.*; +import cokr.xit.ens.modules.kkomydoc.domain.*; +import cokr.xit.ens.modules.kkomydoc.domain.repository.*; +import cokr.xit.ens.modules.kkomydoc.model.*; +import cokr.xit.ens.modules.kkotalk.mapper.*; +import cokr.xit.ens.modules.kkotalk.model.*; +import lombok.*; +import lombok.extern.slf4j.*; // FIXME: 카카오톡 신규 추가 @Slf4j @@ -48,7 +41,6 @@ public class KkoTalkRsltFetcher extends ResultProcTemplate { private final ApplicationEventPublisher applicationEventPublisher; private final SendMastRepository sendMastRepository; - private final SendDetailKkoMydocRepository sendDetailKkoMydocRepository; private final IKkoTalkMapper talkMapper; private final SendDetailKkoMydocStatHistRepository sendDetailKkoMydocStatHistRepository; private final OrgMngService orgMngService; @@ -63,7 +55,7 @@ public class KkoTalkRsltFetcher extends ResultProcTemplate { SendMast sendMast = null; - List sendDetails = null; + List sendDetails = null; EnsResponseVO respVO = null; Map resultInfo = new HashMap<>(); resultInfo.put("sendMastId", sendMastId); @@ -73,7 +65,6 @@ public class KkoTalkRsltFetcher extends ResultProcTemplate { sendMast = sendMastRepository.findById(sendMastId).orElseThrow(() -> new EnsException(EnsErrCd.RSLT404, String.format("일치하는 발송마스터 자료가 없습니다. [ sendMastId %s ]", sendMastId))); sendDetails = talkMapper.findAllBySendMastAndEnvlopeIdIsNotNull(sendMast); - //sendDetails = sendDetailKkoMydocRepository.findAllBySendMastAndDocumentBinderUuidIsNotNull(sendMast); OrgMng orgMng = orgMngService.find(sendMast.getOrgCd()).getResultInfo(); Lists.partition(sendDetails, SEND_BATCH_UNIT).stream() @@ -222,10 +213,10 @@ public class KkoTalkRsltFetcher extends ResultProcTemplate { * @param list * @return */ - private List makeMessage(List list) { + private List makeMessage(List list) { return list.stream() - .map(KkotalkDTO.SendDetailKkoTalkDTO::getEnvelopeId) + .map(SendDetailKkoTalkDTO::getEnvelopeId) .collect(Collectors.toList()); } @@ -255,7 +246,7 @@ public class KkoTalkRsltFetcher extends ResultProcTemplate { * -. 성공/실패 여부에 따라 상태정보 및 Error 필드 갱신 * */ - private void modifyStatInfoByDocumentBinderUuid(KkotalkDTO.SendDetailKkoTalkDTO row, List resList) { + private void modifyStatInfoByDocumentBinderUuid(SendDetailKkoTalkDTO row, List resList) { /* List resList = response.getEnvelopeStatus(); if (CmmnUtil.isEmpty(envelopeStatus..getError_code())) { diff --git a/src/main/java/cokr/xit/ens/modules/kkotalk/service/support/KkoTalkRsltProvider.java b/src/main/java/cokr/xit/ens/modules/kkotalk/service/support/KkoTalkRsltProvider.java index 80e2192..0c924c3 100644 --- a/src/main/java/cokr/xit/ens/modules/kkotalk/service/support/KkoTalkRsltProvider.java +++ b/src/main/java/cokr/xit/ens/modules/kkotalk/service/support/KkoTalkRsltProvider.java @@ -15,10 +15,10 @@ import cokr.xit.ens.modules.common.biztmplt.*; import cokr.xit.ens.modules.common.code.*; import cokr.xit.ens.modules.common.domain.*; import cokr.xit.ens.modules.common.domain.repository.*; -import cokr.xit.ens.modules.kkomydoc.model.*; -import cokr.xit.ens.modules.kkomydoc.model.config.*; +import cokr.xit.ens.modules.kkotalk.code.*; import cokr.xit.ens.modules.kkotalk.mapper.*; import cokr.xit.ens.modules.kkotalk.model.*; +import cokr.xit.ens.modules.kkotalk.model.config.*; import lombok.*; import lombok.extern.slf4j.*; @@ -33,25 +33,25 @@ public class KkoTalkRsltProvider implements EnsPhaseProcSupport args) { + public EnsResponseVO statReady(List args) { log.info("no process"); return null; } @Override @Transactional(propagation = Propagation.REQUIRES_NEW) - public EnsResponseVO statBegin(Long arg) { + public EnsResponseVO statBegin(Long arg) { log.info("no process"); return null; } @Override @Transactional(propagation = Propagation.REQUIRES_NEW) - public EnsResponseVO execute(Long sendMastId) { + public EnsResponseVO execute(Long sendMastId) { try { SendMast sendMast = sendMastRepository.findById(sendMastId) .orElseThrow(() -> new EnsException(EnsErrCd.PRVD404, String.format("일치하는 발송마스터 자료가 없습니다. [ sendMastId %s ]", sendMastId))); - List sendDetailKkoTalks = talkMapper.findAllBySendMastId(sendMast.getSendMastId()); + List sendDetailKkoTalks = talkMapper.findAllBySendMastId(sendMast.getSendMastId()); // FIXME: 카카오톡 적용 필요 @@ -65,17 +65,18 @@ public class KkoTalkRsltProvider implements EnsPhaseProcSupport KkoMydocStat.builder() + .map(row -> KkoTalkStat.builder() .sendDetailId(row.getSendDetailId()) - // .externalDocumentUuid(row.getPropExternalDocumentUuid()) - // .documentBinderUuid(row.getDocumentBinderUuid()) - // .kkoDocStat(row.getKkoDocStat()) - // .kkoDocSentDt(row.getKkoDocSentDt()) - // .kkoDocReceivedDt(row.getKkoDocReceivedDt()) - // .kkoDocAuthFrstDt(row.getKkoDocAuthFrstDt()) - // .kkoDocTokenVrfyFrstDt(row.getKkoDocTokenVrfyFrstDt()) - // .kkoDocReadFrstDt(row.getKkoDocReadFrstDt()) - // .kkoDocUserNotiedDt(row.getKkoDocUserNotiedDt()) + .externalId(row.getExternalId()) + .envelopeId(row.getEnvelopeId()) + .status(KkoTalkStatusCd.getEnum(row.getStatus())) + .sentDt(row.getSentAt()) + .receivedDt(row.getReceivedAt()) + // FIXME: 카카오톡 적용 필요 + .authenticatedAt(row.getAuthenticatedAt()) + .ottVerifiedAt(row.getOttVerifiedAt()) + .readAt(row.getReadAt()) + .userNotifiedAt(row.getUserNotifiedAt()) .errorCode(CmmnUtil.isEmpty(row.getErrorCode()) ? null : row.getErrorCode()) .errorMessage(CmmnUtil.isEmpty(row.getErrorMessage()) ? null : row.getErrorMessage()) .build()) @@ -87,7 +88,7 @@ public class KkoTalkRsltProvider implements EnsPhaseProcSupport