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

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

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

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

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

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

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

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

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

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

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

@ -73,6 +73,19 @@
, last_updt_dt = sysdate , last_updt_dt = sysdate
WHERE send_detail_id = #{sendDetailId} WHERE send_detail_id = #{sendDetailId}
</update> </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} , link = #{link}
, read_expires_at = #{readExpiresAt}, , read_expires_at = #{readExpiresAt},

Loading…
Cancel
Save