feat: 카카오톡 추가 반영 - send

- 전송결과 카카오톡 상세 테이블 반영 추가
main
Jonguk. Lim 2 months ago
parent d30965b855
commit 5760ac506d

@ -1,5 +1,9 @@
package cokr.xit.ens.modules.common.code; package cokr.xit.ens.modules.common.code;
import java.util.*;
import com.fasterxml.jackson.annotation.*;
import cokr.xit.ens.core.code.*; import cokr.xit.ens.core.code.*;
import lombok.*; import lombok.*;
@ -26,4 +30,11 @@ public enum PostSeCd implements CodeMapperType {
return this.name(); 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));
}
} }

@ -143,7 +143,9 @@ public class IntgrnNotiRsltFetcher extends ResultProcTemplate {
} }
} }
} }
// FIXME: 카카오톡 추가 - 명시적 반영
// intgrnSendMastRepository.flush();
// intgrnSendDetailRepository.flush();
return respVO; return respVO;
} }

@ -1,5 +1,9 @@
package cokr.xit.ens.modules.kkotalk.code; package cokr.xit.ens.modules.kkotalk.code;
import java.util.*;
import com.fasterxml.jackson.annotation.*;
import cokr.xit.ens.modules.common.code.*; import cokr.xit.ens.modules.common.code.*;
import lombok.*; import lombok.*;
@ -50,19 +54,18 @@ public enum KkoTalkStatusCd implements IntgrnDtlStatMapperType {
if (statCd == null) if (statCd == null)
return KkoTalkStatusCd.UNKNOWN; return KkoTalkStatusCd.UNKNOWN;
KkoTalkStatusCd docBoxStatusCd = null;
try { try {
docBoxStatusCd = KkoTalkStatusCd.valueOf(statCd); return KkoTalkStatusCd.valueOf(statCd);
} catch (IllegalArgumentException e) { } catch (IllegalArgumentException e) {
docBoxStatusCd = KkoTalkStatusCd.UNKNOWN; return KkoTalkStatusCd.UNKNOWN;
} }
return docBoxStatusCd;
} }
@JsonCreator
public static KkoTalkStatusCd getEnum(String value) { public static KkoTalkStatusCd getEnum(String value) {
for(KkoTalkStatusCd v : values()) return Arrays.stream(values())
if(v.getCode().equalsIgnoreCase(value)) return v; .filter(v -> v.getCode().equalsIgnoreCase(value))
throw new IllegalArgumentException(); .findAny()
.orElseThrow(() -> new IllegalArgumentException("Invalid KkoTalkStatusCd: " + value));
} }
} }

@ -1,12 +1,12 @@
package cokr.xit.ens.modules.kkotalk.model; 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.core.model.*;
import cokr.xit.ens.modules.kkomydoc.model.config.KkoMydocStat; import cokr.xit.ens.modules.kkotalk.model.config.*;
import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.media.*;
import lombok.Data; import lombok.*;
import lombok.experimental.SuperBuilder; import lombok.experimental.*;
@SuperBuilder @SuperBuilder
@Data @Data
@ -15,6 +15,6 @@ public class KkoTalkRsltRespDTO extends EnsRsltRespDTO {
@Schema(required = true, title = "발송마스터ID", example = " ") @Schema(required = true, title = "발송마스터ID", example = " ")
private Long sendMastId; private Long sendMastId;
@Schema(required = false, title = "발송요청문서", example = " ") @Schema(required = false, title = "발송요청문서", example = " ")
private List<KkoMydocStat> documents; private List<KkoTalkStat> documents;
} }

@ -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;
}

@ -1,43 +1,36 @@
package cokr.xit.ens.modules.kkotalk.service.support; package cokr.xit.ens.modules.kkotalk.service.support;
import java.util.HashMap; import java.util.*;
import java.util.List; import java.util.stream.*;
import java.util.Map;
import java.util.stream.Collectors;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.ApplicationEventPublisher; import org.springframework.context.*;
import org.springframework.stereotype.Component; import org.springframework.stereotype.*;
import org.springframework.transaction.annotation.Propagation; import org.springframework.transaction.annotation.*;
import org.springframework.transaction.annotation.Transactional;
import com.google.common.collect.*;
import com.google.common.collect.Lists; import com.google.gson.*;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder; import cokr.xit.ens.core.aop.*;
import cokr.xit.ens.core.exception.*;
import cokr.xit.ens.core.aop.EnsResponseVO; import cokr.xit.ens.core.exception.code.*;
import cokr.xit.ens.core.exception.EnsException; import cokr.xit.ens.core.utils.*;
import cokr.xit.ens.core.exception.code.EnsErrCd; import cokr.xit.ens.modules.common.biztmplt.*;
import cokr.xit.ens.core.utils.CmmnUtil; import cokr.xit.ens.modules.common.code.*;
import cokr.xit.ens.core.utils.MapDeserailizer; import cokr.xit.ens.modules.common.ctgy.sys.mng.domain.*;
import cokr.xit.ens.modules.common.biztmplt.ResultProcTemplate; import cokr.xit.ens.modules.common.ctgy.sys.mng.service.*;
import cokr.xit.ens.modules.common.code.StatCd; import cokr.xit.ens.modules.common.domain.*;
import cokr.xit.ens.modules.common.ctgy.sys.mng.domain.OrgMng; import cokr.xit.ens.modules.common.domain.repository.*;
import cokr.xit.ens.modules.common.ctgy.sys.mng.service.OrgMngService; import cokr.xit.ens.modules.common.domain.support.*;
import cokr.xit.ens.modules.common.domain.SendMast; import cokr.xit.ens.modules.common.event.*;
import cokr.xit.ens.modules.common.domain.repository.SendMastRepository; import cokr.xit.ens.modules.kkomydoc.code.*;
import cokr.xit.ens.modules.common.domain.support.FieldError; import cokr.xit.ens.modules.kkomydoc.domain.*;
import cokr.xit.ens.modules.common.event.SendMastStatUpdateEvent; import cokr.xit.ens.modules.kkomydoc.domain.repository.*;
import cokr.xit.ens.modules.kkomydoc.code.KkoMydocStatusCd; import cokr.xit.ens.modules.kkomydoc.model.*;
import cokr.xit.ens.modules.kkomydoc.domain.SendDetailKkoMydoc; import cokr.xit.ens.modules.kkotalk.mapper.*;
import cokr.xit.ens.modules.kkomydoc.domain.SendDetailKkoMydocStatHist; import cokr.xit.ens.modules.kkotalk.model.*;
import cokr.xit.ens.modules.kkomydoc.domain.repository.SendDetailKkoMydocRepository; import lombok.*;
import cokr.xit.ens.modules.kkomydoc.domain.repository.SendDetailKkoMydocStatHistRepository; import lombok.extern.slf4j.*;
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;
// FIXME: 카카오톡 신규 추가 // FIXME: 카카오톡 신규 추가
@Slf4j @Slf4j
@ -48,7 +41,6 @@ public class KkoTalkRsltFetcher extends ResultProcTemplate {
private final ApplicationEventPublisher applicationEventPublisher; private final ApplicationEventPublisher applicationEventPublisher;
private final SendMastRepository sendMastRepository; private final SendMastRepository sendMastRepository;
private final SendDetailKkoMydocRepository sendDetailKkoMydocRepository;
private final IKkoTalkMapper talkMapper; private final IKkoTalkMapper talkMapper;
private final SendDetailKkoMydocStatHistRepository sendDetailKkoMydocStatHistRepository; private final SendDetailKkoMydocStatHistRepository sendDetailKkoMydocStatHistRepository;
private final OrgMngService orgMngService; private final OrgMngService orgMngService;
@ -63,7 +55,7 @@ public class KkoTalkRsltFetcher extends ResultProcTemplate {
SendMast sendMast = null; SendMast sendMast = null;
List<KkotalkDTO.SendDetailKkoTalkDTO> sendDetails = null; List<SendDetailKkoTalkDTO> sendDetails = null;
EnsResponseVO respVO = null; EnsResponseVO respVO = null;
Map<String, Long> resultInfo = new HashMap<>(); Map<String, Long> resultInfo = new HashMap<>();
resultInfo.put("sendMastId", sendMastId); 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))); sendMast = sendMastRepository.findById(sendMastId).orElseThrow(() -> new EnsException(EnsErrCd.RSLT404, String.format("일치하는 발송마스터 자료가 없습니다. [ sendMastId %s ]", sendMastId)));
sendDetails = talkMapper.findAllBySendMastAndEnvlopeIdIsNotNull(sendMast); sendDetails = talkMapper.findAllBySendMastAndEnvlopeIdIsNotNull(sendMast);
//sendDetails = sendDetailKkoMydocRepository.findAllBySendMastAndDocumentBinderUuidIsNotNull(sendMast);
OrgMng orgMng = orgMngService.find(sendMast.getOrgCd()).getResultInfo(); OrgMng orgMng = orgMngService.find(sendMast.getOrgCd()).getResultInfo();
Lists.partition(sendDetails, SEND_BATCH_UNIT).stream() Lists.partition(sendDetails, SEND_BATCH_UNIT).stream()
@ -222,10 +213,10 @@ public class KkoTalkRsltFetcher extends ResultProcTemplate {
* @param list * @param list
* @return * @return
*/ */
private List<String> makeMessage(List<KkotalkDTO.SendDetailKkoTalkDTO> list) { private List<String> makeMessage(List<SendDetailKkoTalkDTO> list) {
return list.stream() return list.stream()
.map(KkotalkDTO.SendDetailKkoTalkDTO::getEnvelopeId) .map(SendDetailKkoTalkDTO::getEnvelopeId)
.collect(Collectors.toList()); .collect(Collectors.toList());
} }
@ -255,7 +246,7 @@ public class KkoTalkRsltFetcher extends ResultProcTemplate {
* -. / Error * -. / Error
* *
*/ */
private void modifyStatInfoByDocumentBinderUuid(KkotalkDTO.SendDetailKkoTalkDTO row, List<KkotalkDTO.BulkStatusResponse> resList) { private void modifyStatInfoByDocumentBinderUuid(SendDetailKkoTalkDTO row, List<KkotalkDTO.BulkStatusResponse> resList) {
/* /*
List<KkotalkApiDTO.EnvelopeStatusResponse> resList = response.getEnvelopeStatus(); List<KkotalkApiDTO.EnvelopeStatusResponse> resList = response.getEnvelopeStatus();
if (CmmnUtil.isEmpty(envelopeStatus..getError_code())) { if (CmmnUtil.isEmpty(envelopeStatus..getError_code())) {

@ -15,10 +15,10 @@ import cokr.xit.ens.modules.common.biztmplt.*;
import cokr.xit.ens.modules.common.code.*; import cokr.xit.ens.modules.common.code.*;
import cokr.xit.ens.modules.common.domain.*; import cokr.xit.ens.modules.common.domain.*;
import cokr.xit.ens.modules.common.domain.repository.*; import cokr.xit.ens.modules.common.domain.repository.*;
import cokr.xit.ens.modules.kkomydoc.model.*; import cokr.xit.ens.modules.kkotalk.code.*;
import cokr.xit.ens.modules.kkomydoc.model.config.*;
import cokr.xit.ens.modules.kkotalk.mapper.*; import cokr.xit.ens.modules.kkotalk.mapper.*;
import cokr.xit.ens.modules.kkotalk.model.*; import cokr.xit.ens.modules.kkotalk.model.*;
import cokr.xit.ens.modules.kkotalk.model.config.*;
import lombok.*; import lombok.*;
import lombok.extern.slf4j.*; import lombok.extern.slf4j.*;
@ -33,25 +33,25 @@ public class KkoTalkRsltProvider implements EnsPhaseProcSupport<EnsResponseVO, L
@Override @Override
@Transactional(propagation = Propagation.REQUIRES_NEW) @Transactional(propagation = Propagation.REQUIRES_NEW)
public EnsResponseVO statReady(List<Long> args) { public EnsResponseVO<?> statReady(List<Long> args) {
log.info("no process"); log.info("no process");
return null; return null;
} }
@Override @Override
@Transactional(propagation = Propagation.REQUIRES_NEW) @Transactional(propagation = Propagation.REQUIRES_NEW)
public EnsResponseVO statBegin(Long arg) { public EnsResponseVO<?> statBegin(Long arg) {
log.info("no process"); log.info("no process");
return null; return null;
} }
@Override @Override
@Transactional(propagation = Propagation.REQUIRES_NEW) @Transactional(propagation = Propagation.REQUIRES_NEW)
public EnsResponseVO execute(Long sendMastId) { public EnsResponseVO<?> execute(Long sendMastId) {
try { try {
SendMast sendMast = sendMastRepository.findById(sendMastId) SendMast sendMast = sendMastRepository.findById(sendMastId)
.orElseThrow(() -> new EnsException(EnsErrCd.PRVD404, String.format("일치하는 발송마스터 자료가 없습니다. [ sendMastId %s ]", sendMastId))); .orElseThrow(() -> new EnsException(EnsErrCd.PRVD404, String.format("일치하는 발송마스터 자료가 없습니다. [ sendMastId %s ]", sendMastId)));
List<KkotalkDTO.SendDetailKkoTalkDTO> sendDetailKkoTalks = talkMapper.findAllBySendMastId(sendMast.getSendMastId()); List<SendDetailKkoTalkDTO> sendDetailKkoTalks = talkMapper.findAllBySendMastId(sendMast.getSendMastId());
// FIXME: 카카오톡 적용 필요 // FIXME: 카카오톡 적용 필요
@ -65,17 +65,18 @@ public class KkoTalkRsltProvider implements EnsPhaseProcSupport<EnsResponseVO, L
.closeDt(sendMast.getCloseDt().format(DateTimeFormatter.ofPattern("yyyyMMddHHmmss"))) .closeDt(sendMast.getCloseDt().format(DateTimeFormatter.ofPattern("yyyyMMddHHmmss")))
.closeAt(this.getCloseAt(sendMast)) .closeAt(this.getCloseAt(sendMast))
.documents(sendDetailKkoTalks.stream() .documents(sendDetailKkoTalks.stream()
.map(row -> KkoMydocStat.builder() .map(row -> KkoTalkStat.builder()
.sendDetailId(row.getSendDetailId()) .sendDetailId(row.getSendDetailId())
// .externalDocumentUuid(row.getPropExternalDocumentUuid()) .externalId(row.getExternalId())
// .documentBinderUuid(row.getDocumentBinderUuid()) .envelopeId(row.getEnvelopeId())
// .kkoDocStat(row.getKkoDocStat()) .status(KkoTalkStatusCd.getEnum(row.getStatus()))
// .kkoDocSentDt(row.getKkoDocSentDt()) .sentDt(row.getSentAt())
// .kkoDocReceivedDt(row.getKkoDocReceivedDt()) .receivedDt(row.getReceivedAt())
// .kkoDocAuthFrstDt(row.getKkoDocAuthFrstDt()) // FIXME: 카카오톡 적용 필요
// .kkoDocTokenVrfyFrstDt(row.getKkoDocTokenVrfyFrstDt()) .authenticatedAt(row.getAuthenticatedAt())
// .kkoDocReadFrstDt(row.getKkoDocReadFrstDt()) .ottVerifiedAt(row.getOttVerifiedAt())
// .kkoDocUserNotiedDt(row.getKkoDocUserNotiedDt()) .readAt(row.getReadAt())
.userNotifiedAt(row.getUserNotifiedAt())
.errorCode(CmmnUtil.isEmpty(row.getErrorCode()) ? null : row.getErrorCode()) .errorCode(CmmnUtil.isEmpty(row.getErrorCode()) ? null : row.getErrorCode())
.errorMessage(CmmnUtil.isEmpty(row.getErrorMessage()) ? null : row.getErrorMessage()) .errorMessage(CmmnUtil.isEmpty(row.getErrorMessage()) ? null : row.getErrorMessage())
.build()) .build())
@ -87,7 +88,7 @@ public class KkoTalkRsltProvider implements EnsPhaseProcSupport<EnsResponseVO, L
return EnsResponseVO.errRsltBuilder() return EnsResponseVO.errRsltBuilder()
.errCode(e.getErrCd()) .errCode(e.getErrCd())
.errMsg(e.getMessage()) .errMsg(e.getMessage())
.resultInfo(KkoMydocRsltRespDTO.builder() .resultInfo(KkoTalkRsltRespDTO.builder()
.sendMastId(sendMastId) .sendMastId(sendMastId)
.build()) .build())
.build(); .build();
@ -95,7 +96,7 @@ public class KkoTalkRsltProvider implements EnsPhaseProcSupport<EnsResponseVO, L
return EnsResponseVO.errRsltBuilder() return EnsResponseVO.errRsltBuilder()
.errCode(EnsErrCd.ERR999) .errCode(EnsErrCd.ERR999)
.errMsg(String.format("전송결과 응답 처리 실패. 실패사유: %s", e.getMessage())) .errMsg(String.format("전송결과 응답 처리 실패. 실패사유: %s", e.getMessage()))
.resultInfo(KkoMydocRsltRespDTO.builder() .resultInfo(KkoTalkRsltRespDTO.builder()
.sendMastId(sendMastId) .sendMastId(sendMastId)
.build()) .build())
.build(); .build();
@ -106,9 +107,7 @@ public class KkoTalkRsltProvider implements EnsPhaseProcSupport<EnsResponseVO, L
private boolean getCloseAt(SendMast sendMast) { private boolean getCloseAt(SendMast sendMast) {
if (StatCd.close.equals(sendMast.getStatCd())) if (StatCd.close.equals(sendMast.getStatCd()))
return true; return true;
else if (StatCd.sendfail.equals(sendMast.getStatCd()))
return true; return StatCd.sendfail.equals(sendMast.getStatCd());
else
return false;
} }
} }

Loading…
Cancel
Save