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

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

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

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

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

@ -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<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;
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<KkotalkDTO.SendDetailKkoTalkDTO> sendDetails = null;
List<SendDetailKkoTalkDTO> sendDetails = null;
EnsResponseVO respVO = null;
Map<String, Long> 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<String> makeMessage(List<KkotalkDTO.SendDetailKkoTalkDTO> list) {
private List<String> makeMessage(List<SendDetailKkoTalkDTO> 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<KkotalkDTO.BulkStatusResponse> resList) {
private void modifyStatInfoByDocumentBinderUuid(SendDetailKkoTalkDTO row, List<KkotalkDTO.BulkStatusResponse> resList) {
/*
List<KkotalkApiDTO.EnvelopeStatusResponse> resList = response.getEnvelopeStatus();
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.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<EnsResponseVO, L
@Override
@Transactional(propagation = Propagation.REQUIRES_NEW)
public EnsResponseVO statReady(List<Long> args) {
public EnsResponseVO<?> statReady(List<Long> 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<KkotalkDTO.SendDetailKkoTalkDTO> sendDetailKkoTalks = talkMapper.findAllBySendMastId(sendMast.getSendMastId());
List<SendDetailKkoTalkDTO> sendDetailKkoTalks = talkMapper.findAllBySendMastId(sendMast.getSendMastId());
// FIXME: 카카오톡 적용 필요
@ -65,17 +65,18 @@ public class KkoTalkRsltProvider implements EnsPhaseProcSupport<EnsResponseVO, L
.closeDt(sendMast.getCloseDt().format(DateTimeFormatter.ofPattern("yyyyMMddHHmmss")))
.closeAt(this.getCloseAt(sendMast))
.documents(sendDetailKkoTalks.stream()
.map(row -> 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<EnsResponseVO, L
return EnsResponseVO.errRsltBuilder()
.errCode(e.getErrCd())
.errMsg(e.getMessage())
.resultInfo(KkoMydocRsltRespDTO.builder()
.resultInfo(KkoTalkRsltRespDTO.builder()
.sendMastId(sendMastId)
.build())
.build();
@ -95,7 +96,7 @@ public class KkoTalkRsltProvider implements EnsPhaseProcSupport<EnsResponseVO, L
return EnsResponseVO.errRsltBuilder()
.errCode(EnsErrCd.ERR999)
.errMsg(String.format("전송결과 응답 처리 실패. 실패사유: %s", e.getMessage()))
.resultInfo(KkoMydocRsltRespDTO.builder()
.resultInfo(KkoTalkRsltRespDTO.builder()
.sendMastId(sendMastId)
.build())
.build();
@ -106,9 +107,7 @@ public class KkoTalkRsltProvider implements EnsPhaseProcSupport<EnsResponseVO, L
private boolean getCloseAt(SendMast sendMast) {
if (StatCd.close.equals(sendMast.getStatCd()))
return true;
else if (StatCd.sendfail.equals(sendMast.getStatCd()))
return true;
else
return false;
return StatCd.sendfail.equals(sendMast.getStatCd());
}
}

Loading…
Cancel
Save