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

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

@ -13,14 +13,14 @@ import lombok.experimental.*;
@Entity
@Getter
//@ToString
@ToString(exclude = {"orgMng" })
@NoArgsConstructor
@AllArgsConstructor
@SuperBuilder
//@Inheritance(strategy = InheritanceType.JOINED)
//@DiscriminatorColumn(name = "dtype")
//@DiscriminatorValue("master")
@Table(name = "ens_bill", schema = "", catalog = "")
@Table(name = "ens_bill")
@Schema(name = "Bill")
public class Bill extends BillBaseEntity implements Serializable {
@Id

@ -12,7 +12,7 @@ import lombok.experimental.*;
@Entity
//@Data
@Getter
//@ToString(exclude = {"intgrnSendMast"})
@ToString(exclude = {"intgrnSendMast"})
@SuperBuilder
@EqualsAndHashCode
@NoArgsConstructor

@ -1,26 +1,22 @@
package cokr.xit.ens.modules.common.ctgy.intgrnnoti.service.support;
import java.util.Arrays;
import java.util.List;
import org.springframework.context.ApplicationEventPublisher;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
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.modules.common.biztmplt.SendProcTemplate;
import cokr.xit.ens.modules.common.code.PostSeCd;
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 lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import java.util.*;
import org.springframework.context.*;
import org.springframework.stereotype.*;
import org.springframework.transaction.annotation.*;
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.intgrnnoti.code.*;
import cokr.xit.ens.modules.common.ctgy.intgrnnoti.domain.*;
import cokr.xit.ens.modules.common.ctgy.intgrnnoti.domain.repository.*;
import lombok.*;
import lombok.extern.slf4j.*;
// TODO: Send
@Slf4j
@ -67,7 +63,7 @@ public class IntgrnNotiSender extends SendProcTemplate {
@Override
@Transactional(propagation = Propagation.REQUIRES_NEW)
public EnsResponseVO execute(Long intSendMastId) {
public EnsResponseVO<?> execute(Long intSendMastId) {
IntgrnSendMast intgrnSendMast = null;
List<IntgrnSendDetail> intgrnSendDetails = null;

@ -12,6 +12,7 @@ import lombok.experimental.*;
// FIXME: 카카오톡 신규 추가
@Entity
@Getter
@ToString
@SuperBuilder
@NoArgsConstructor
@AllArgsConstructor

@ -27,6 +27,7 @@ import cokr.xit.ens.modules.kkotalk.model.*;
public interface IKkoTalkMapper {
void saveSndDtlKkoTalk(KkotalkDTO.SendDetailKkoTalkDTO sendDetailKkoTalk);
void updateSndDtlKkoTalk(KkotalkDTO.SendDetailKkoTalkDTO sendDetailKkoTalk);
void updateKakaotalkSendBulksResult(KkotalkDTO.SendDetailKkoTalkDTO sendDetailKkoTalk);
List<KkotalkDTO.SendDetailKkoTalkDTO> findAllBySendMastId(Long sendMastId);

@ -1,22 +1,17 @@
package cokr.xit.ens.modules.kkotalk.model;
import javax.validation.Valid;
import javax.validation.constraints.Pattern;
import javax.validation.constraints.Size;
import javax.validation.*;
import javax.validation.constraints.*;
import org.hibernate.validator.constraints.NotEmpty;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.*;
import cokr.xit.ens.core.aop.IApiResponse;
import cokr.xit.ens.modules.kkotalk.ApiConstants;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.experimental.SuperBuilder;
import cokr.xit.ens.core.aop.*;
import cokr.xit.ens.modules.kkotalk.*;
import io.swagger.v3.oas.annotations.media.*;
import lombok.*;
import lombok.experimental.*;
/**
* <pre>
@ -39,6 +34,7 @@ public class KkotalkApiDTO {
//------------------- Envelope ------------------------------------------------------------------------------------------------
@Schema(name = "Envelope", description = "문서발송(단건) 요청 파라메터 DTO")
@Data
@ToString
@NoArgsConstructor
@AllArgsConstructor
@SuperBuilder
@ -160,6 +156,7 @@ public class KkotalkApiDTO {
@Schema(name = "Content", description = "문서 원문 웹링크 또는 HTML")
@Data
@ToString
@NoArgsConstructor
@AllArgsConstructor
@SuperBuilder

@ -7,6 +7,7 @@ import javax.validation.*;
import javax.validation.constraints.*;
import cokr.xit.ens.core.model.*;
import cokr.xit.ens.modules.common.domain.support.*;
import cokr.xit.ens.modules.kkotalk.code.*;
import cokr.xit.ens.modules.kkotalk.model.config.*;
import io.swagger.v3.oas.annotations.media.*;
@ -124,6 +125,7 @@ public class KkotalkDTO extends KkotalkApiDTO {
@SuperBuilder
@Data
@ToString
@Schema(name = "SendDetailKkoTalkDTO")
@NoArgsConstructor
@AllArgsConstructor
@ -147,7 +149,7 @@ public class KkotalkDTO extends KkotalkApiDTO {
private Long sendMastId;
private String errorCode;
private String errorMessage;
//private FieldError error;
private FieldError error;
private String mkBillUseYn;
private String billUid;

@ -1,22 +1,21 @@
package cokr.xit.ens.modules.kkotalk.model;
import java.io.Serializable;
import java.io.*;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.Pattern;
import javax.validation.constraints.*;
import org.hibernate.validator.constraints.Length;
import org.hibernate.validator.constraints.*;
import cokr.xit.ens.modules.common.ctgy.sys.mng.model.TmpltMngByTypeDTO;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.experimental.SuperBuilder;
import cokr.xit.ens.modules.common.ctgy.sys.mng.model.*;
import io.swagger.v3.oas.annotations.media.*;
import lombok.*;
import lombok.experimental.*;
// FIXME: 카카오톡 신규 추가
@EqualsAndHashCode(callSuper = true)
@Data
@ToString
@SuperBuilder
@NoArgsConstructor
@Schema(name = "TmpltMngKkoTalkDTO")

@ -107,13 +107,22 @@ public class KkoTalkSender extends SendProcTemplate {
m -> (KkoTalkApiRespVO)m.get("value"), (k1, k2) -> k1));
list.stream()
.forEach(row -> this.modifyTalkSendRsltByExtDocUuid(row, mApiResp));
.forEach(row -> {
this.modifyTalkSendRsltByExtDocUuid(row, mApiResp);
});
} catch (EnsException e) {
list.stream()
.forEach(row -> {
row.setStatus(KkoTalkStatusCd.SENT_FAIL);
row.setError(
FieldError.initBuilder()
.errorCode(e.getErrCd().getCode())
.errorMessage(e.getMessage())
.build()
);
row.setErrorCode(e.getErrCd().getCode());
row.setErrorMessage(e.getMessage());
});
@ -122,10 +131,20 @@ public class KkoTalkSender extends SendProcTemplate {
list.stream()
.forEach(row -> {
row.setStatus(KkoTalkStatusCd.SENT_FAIL);
row.setError(
FieldError.initBuilder()
.errorCode(EnsErrCd.SEND500.getCode())
.errorMessage(e.getMessage())
.build()
);
row.setErrorCode(EnsErrCd.SEND500.getCode());
row.setErrorMessage(e.getMessage());
});
} finally {
// FIXME: 카카오톡 추가 - 카카오톡 테이블 업데이트
list.stream()
.forEach(talkMapper::updateKakaotalkSendBulksResult);
if (!CmmnUtil.isEmpty(envelopes))
sendDetailKkoTalkReqHistRepository.saveAll(
this.toSendDetailReqHist(list, JsonUtils.toJson(envelopes), sendRespBody));
@ -139,7 +158,7 @@ public class KkoTalkSender extends SendProcTemplate {
if (cntSuccess.get() > 0)
respVO = EnsResponseVO.okBuilder()
.resultInfo(sendDetails.stream()
.map(row -> this.toResultInfo(row))
.map(this::toResultInfo)
.collect(Collectors.toList()))
.build();
else
@ -265,9 +284,13 @@ public class KkoTalkSender extends SendProcTemplate {
if (CmmnUtil.isEmpty(apiRespVO.getErrorCode())) {
row.setStatus(KkoTalkStatusCd.SENT);
row.setEnvelopeId(String.valueOf(apiRespVO.getData()));
//row.setErrorCode(FieldError.initBuilder().build());
row.setError(FieldError.initBuilder().build());
} else {
row.setStatus(KkoTalkStatusCd.valueOfEnum(apiRespVO.getErrorCode()));
row.setError(FieldError.initBuilder()
.errorCode(EnsErrCd.SEND630.getCode())
.errorMessage(String.format("%s %s", apiRespVO.getErrorCode(), apiRespVO.getErrorMessage()))
.build());
row.setErrorCode(EnsErrCd.SEND630.getCode());
row.setErrorMessage(String.format("%s %s", apiRespVO.getErrorCode(), apiRespVO.getErrorMessage()));
}

@ -73,6 +73,19 @@
, last_updt_dt = sysdate
WHERE send_detail_id = #{sendDetailId}
</update>
<update id="updateKakaotalkSendBulksResult" parameterType="cokr.xit.ens.modules.kkotalk.model.KkotalkDTO$SendDetailKkoTalkDTO">
/** iup-kkotalk-mapper|updateKakaotalkSendBulksResult-카카오톡 문서요청 결과 반영|limju */
UPDATE ens_snd_dtl_kko_talk
SET external_id = #{externalId}
, envelope_id = #{envelopeId}
, status = #{status}
, error_code = #{errorCode}
, error_message = #{errorMessage}
, last_updt_dt = sysdate
WHERE send_detail_id = #{sendDetailId}
</update>
<!--
, link = #{link}
, read_expires_at = #{readExpiresAt},

Loading…
Cancel
Save