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

- SendDetailKkoTalkDTO 클래스 분리 적용
main
Jonguk. Lim 2 months ago
parent a6cc91f02c
commit d30965b855

@ -24,7 +24,7 @@ import lombok.extern.slf4j.*;
@Slf4j
@Component
@RequiredArgsConstructor
public class AcceptByKkoTalkEventListener implements AcceptDataEventListener<AcceptDataByKkoTalk, KkotalkDTO.SendDetailKkoTalkDTO> {
public class AcceptByKkoTalkEventListener implements AcceptDataEventListener<AcceptDataByKkoTalk, SendDetailKkoTalkDTO> {
private final ApplicationEventPublisher applicationEventPublisher;
private final KkoTalkService kkoTalkService;
@ -42,7 +42,7 @@ public class AcceptByKkoTalkEventListener implements AcceptDataEventListener<Acc
Map<String, Object> resultInfo = (Map<String, Object>) responseVO.getResultInfo();
Long sendMastId = (Long) resultInfo.get("sendMastId");
List<KkotalkDTO.SendDetailKkoTalkDTO> sendDetails = (List<KkotalkDTO.SendDetailKkoTalkDTO>) resultInfo.get("sendDetails");
List<SendDetailKkoTalkDTO> sendDetails = (List<SendDetailKkoTalkDTO>) resultInfo.get("sendDetails");
if (EnsErrCd.OK.equals(responseVO.getErrCode())) {
Map<String, Long> sendDetailIdMap = convertSendDetailIdMap(sendDetails);
this.acceptSuccess(ev.getIntgrnSendDetails(), POST_SE_CD, sendDetailIdMap);
@ -88,7 +88,7 @@ public class AcceptByKkoTalkEventListener implements AcceptDataEventListener<Acc
}
@Override
public Map<String, Long> convertSendDetailIdMap(List<KkotalkDTO.SendDetailKkoTalkDTO> sendDetails) {
public Map<String, Long> convertSendDetailIdMap(List<SendDetailKkoTalkDTO> sendDetails) {
Map<String, Long> sendDetailIdMap = sendDetails.stream()
.map(row -> {

@ -1,20 +1,16 @@
package cokr.xit.ens.modules.common.ctgy.intgrnnoti.service.support.kkotalk;
import java.time.format.DateTimeFormatter;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import java.time.format.*;
import java.util.*;
import java.util.stream.*;
import cokr.xit.ens.core.model.EnsBillAcptReqDTO;
import cokr.xit.ens.core.utils.CmmnUtil;
import cokr.xit.ens.core.utils.crypto.AES256;
import cokr.xit.ens.core.utils.crypto.Crypto;
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.service.support.AcceptData;
import cokr.xit.ens.modules.kkomydoc.model.config.XitProperty;
import cokr.xit.ens.modules.kkotalk.model.KkotalkApiDTO;
import cokr.xit.ens.modules.kkotalk.model.KkotalkDTO;
import cokr.xit.ens.core.model.*;
import cokr.xit.ens.core.utils.*;
import cokr.xit.ens.core.utils.crypto.*;
import cokr.xit.ens.modules.common.ctgy.intgrnnoti.domain.*;
import cokr.xit.ens.modules.common.ctgy.intgrnnoti.service.support.*;
import cokr.xit.ens.modules.kkomydoc.model.config.*;
import cokr.xit.ens.modules.kkotalk.model.*;
import cokr.xit.ens.modules.kkotalk.model.config.Document;
// FIXME: 카카오톡 신규 추가

@ -1,9 +1,7 @@
package cokr.xit.ens.modules.kkomydoc.code;
import cokr.xit.ens.modules.common.code.IntgrnDtlStatCd;
import cokr.xit.ens.modules.common.code.IntgrnDtlStatMapperType;
import lombok.Getter;
import lombok.RequiredArgsConstructor;
import cokr.xit.ens.modules.common.code.*;
import lombok.*;
/**
* <ul>

@ -169,7 +169,6 @@ public class SendDetailKkoTalk extends BaseEntity {
private String mkTmpltMsgJsonData;
@Enumerated(EnumType.STRING)
@Column(name = "status", nullable = false, length = 30)
@Setter
private KkoTalkStatusCd status;

@ -25,17 +25,17 @@ import cokr.xit.ens.modules.kkotalk.model.*;
// FIXME: 카카오톡 신규 추가
@Mapper
public interface IKkoTalkMapper {
void saveSndDtlKkoTalk(KkotalkDTO.SendDetailKkoTalkDTO sendDetailKkoTalk);
void updateSndDtlKkoTalk(KkotalkDTO.SendDetailKkoTalkDTO sendDetailKkoTalk);
void updateKakaotalkSendBulksResult(KkotalkDTO.SendDetailKkoTalkDTO sendDetailKkoTalk);
void saveSndDtlKkoTalk(SendDetailKkoTalkDTO sendDetailKkoTalk);
void updateSndDtlKkoTalk(SendDetailKkoTalkDTO sendDetailKkoTalk);
void updateKakaotalkSendBulksResult(SendDetailKkoTalkDTO sendDetailKkoTalk);
List<KkotalkDTO.SendDetailKkoTalkDTO> findAllBySendMastId(Long sendMastId);
List<SendDetailKkoTalkDTO> findAllBySendMastId(Long sendMastId);
List<KkotalkDTO.SendDetailKkoTalkDTO> findAllFetchBySendMastId(Long sendMastId);
Optional<KkotalkDTO.SendDetailKkoTalkDTO> findFetchByExternalIdAndEnvelopeId(Map<String, String> map);
List<SendDetailKkoTalkDTO> findAllFetchBySendMastId(Long sendMastId);
Optional<SendDetailKkoTalkDTO> findFetchByExternalIdAndEnvelopeId(Map<String, String> map);
List<KkotalkDTO.SendDetailKkoTalkDTO> findAllBySendMastAndEnvlopeIdIsNotNull(SendMast sendMast);
List<SendDetailKkoTalkDTO> findAllBySendMastAndEnvlopeIdIsNotNull(SendMast sendMast);
Optional<SendDetailKkoMydoc> findByExternalId(String externalId);
}

@ -1,14 +1,11 @@
package cokr.xit.ens.modules.kkotalk.model;
import java.time.*;
import java.util.*;
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.*;
import lombok.*;
@ -122,39 +119,4 @@ public class KkotalkDTO extends KkotalkApiDTO {
@Valid
private List<Document> documents;
}
@SuperBuilder
@Data
@ToString
@Schema(name = "SendDetailKkoTalkDTO")
@NoArgsConstructor
@AllArgsConstructor
@EqualsAndHashCode(callSuper = true)
public static class SendDetailKkoTalkDTO extends Envelope {
private String envelopeId;
private String link;
private KkoTalkStatusCd status;
private String sentAt;
private String receivedAt;
private String readAt;
private String authenticatedAt;
private String ottVerifiedAt;
private String isNotificationUnavailable;
private String userNotifiedAt;
private String distributionReceivedAt;
private String mkJid;
private String mkTmpltMsgJsonData;
private Long sendDetailId;
private Long sendMastId;
private String errorCode;
private String errorMessage;
private FieldError error;
private String mkBillUseYn;
private String billUid;
// Add created and updated timestamps from BaseEntity if needed
private LocalDateTime registAt;
private LocalDateTime lastUpdtDt;
}
}

@ -0,0 +1,57 @@
package cokr.xit.ens.modules.kkotalk.model;
import java.time.*;
import cokr.xit.ens.modules.common.domain.support.*;
import io.swagger.v3.oas.annotations.media.*;
import lombok.*;
import lombok.experimental.*;
/**
* <pre>
* description :
* packageName : cokr.xit.ens.modules.kkotalk.model
* fileName : SendDetailKkoTalkDTO
* author : limju
* date : 2024 9 10
* ======================================================================
*
* ----------------------------------------------------------------------
* 2024 9 10 limju
*
* </pre>
*/
@SuperBuilder
@Data
@ToString
@Schema(name = "SendDetailKkoTalkDTO")
@NoArgsConstructor
@AllArgsConstructor
@EqualsAndHashCode(callSuper = true)
public class SendDetailKkoTalkDTO extends KkotalkApiDTO.Envelope {
private String envelopeId;
private String link;
private String status;
private String sentAt;
private String receivedAt;
private String readAt;
private String authenticatedAt;
private String ottVerifiedAt;
private String isNotificationUnavailable;
private String userNotifiedAt;
private String distributionReceivedAt;
private String mkJid;
private String mkTmpltMsgJsonData;
private Long sendDetailId;
private Long sendMastId;
private String errorCode;
private String errorMessage;
private FieldError error;
private String mkBillUseYn;
private String billUid;
// Add created and updated timestamps from BaseEntity if needed
private LocalDateTime registAt;
private LocalDateTime lastUpdtDt;
}

@ -139,7 +139,7 @@ public class KkoTalkAcceptor implements EnsPhaseProcSupport<EnsResponseVO<?>, Kk
sendMastRepository.save(sendMast);
Gson gson = new GsonBuilder().disableHtmlEscaping().create();
List<KkotalkDTO.SendDetailKkoTalkDTO> sendDetails = new ArrayList<>();
List<SendDetailKkoTalkDTO> sendDetails = new ArrayList<>();
List<Map<String, Object>> sendDetailMblPages = new ArrayList<>();
List<Bill> bills = new ArrayList<>();
final String prefixBillUid = sendMast.getPostSe().getCode() + "-" + IdGenerator.getCurrentTimeSec();
@ -174,7 +174,7 @@ public class KkoTalkAcceptor implements EnsPhaseProcSupport<EnsResponseVO<?>, Kk
XitProperty xitProperty = Optional.ofNullable(document.getXit_property()).orElse(XitProperty.builder().build());
KkotalkDTO.SendDetailKkoTalkDTO sendDetail = KkotalkDTO.SendDetailKkoTalkDTO.builder()
SendDetailKkoTalkDTO sendDetail = SendDetailKkoTalkDTO.builder()
.sendMastId(sendMast.getSendMastId())
.title(document.getTitle())
.link(document.getContent() != null? document.getContent().getLink(): null)
@ -232,7 +232,7 @@ public class KkoTalkAcceptor implements EnsPhaseProcSupport<EnsResponseVO<?>, Kk
sendDetailMblPageRepository.saveAll(
sendDetailMblPages.stream()
.map(data -> {
KkotalkDTO.SendDetailKkoTalkDTO sendDetail = (KkotalkDTO.SendDetailKkoTalkDTO) data.get("sendDetail");
SendDetailKkoTalkDTO sendDetail = (SendDetailKkoTalkDTO) data.get("sendDetail");
return SendDetailMblPage.builder()
.postSe(PostSeCd.kkoTalk.getCode())
.sendDetailId(sendDetail.getSendDetailId())

@ -38,7 +38,6 @@ import lombok.extern.slf4j.*;
public class KkoTalkMaker extends MakeProcTemplate {
private final ApplicationEventPublisher applicationEventPublisher;
private final SendMastRepository sendMastRepository;
//private final SendDetailKkoMydocRepository sendDetailKkoMydocRepository;
private final IKkoTalkMapper kkoTalkMapper;
private final OrgMngService orgMngService;
private final TmpltMngStrategyKkoTalk tmpltMngService;
@ -50,7 +49,7 @@ public class KkoTalkMaker extends MakeProcTemplate {
public EnsResponseVO<?> execute(Long sendMastId) {
AES256 aes256 = new AES256(Crypto.AES256.getKey());
SendMast sendMast = null;
List<KkotalkDTO.SendDetailKkoTalkDTO> sendDetails = null;
List<SendDetailKkoTalkDTO> sendDetails = null;
EnsResponseVO respVO = null;
try {
if (CmmnUtil.isEmpty(sendMastId))
@ -199,7 +198,7 @@ public class KkoTalkMaker extends MakeProcTemplate {
* @param vo
* @return
*/
private String createHash(KkotalkDTO.SendDetailKkoTalkDTO vo) {
private String createHash(SendDetailKkoTalkDTO vo) {
String hash = null;
try {
String text = vo.getExternalId()

@ -58,7 +58,7 @@ public class KkoTalkSender extends SendProcTemplate {
public EnsResponseVO<?> execute(Long sendMastId) {
SendMast sendMast = null;
List<KkotalkDTO.SendDetailKkoTalkDTO> sendDetails = null;
List<SendDetailKkoTalkDTO> sendDetails = null;
EnsResponseVO respVO = null;
try {
if (CmmnUtil.isEmpty(sendMastId))
@ -116,7 +116,7 @@ public class KkoTalkSender extends SendProcTemplate {
list.stream()
.forEach(row -> {
row.setStatus(KkoTalkStatusCd.SENT_FAIL);
row.setStatus(KkoTalkStatusCd.SENT_FAIL.getCode());
row.setError(
FieldError.initBuilder()
.errorCode(e.getErrCd().getCode())
@ -130,7 +130,7 @@ public class KkoTalkSender extends SendProcTemplate {
list.stream()
.forEach(row -> {
row.setStatus(KkoTalkStatusCd.SENT_FAIL);
row.setStatus(KkoTalkStatusCd.SENT_FAIL.getCode());
row.setError(
FieldError.initBuilder()
.errorCode(EnsErrCd.SEND500.getCode())
@ -219,10 +219,10 @@ public class KkoTalkSender extends SendProcTemplate {
* @param list
* @return
*/
private List<KkotalkApiDTO.Envelope> makeMessage(List<KkotalkDTO.SendDetailKkoTalkDTO> list) {
private List<KkotalkApiDTO.Envelope> makeMessage(List<SendDetailKkoTalkDTO> list) {
final List<KkotalkApiDTO.Envelope> bulkList = new ArrayList<>();
for (KkotalkDTO.SendDetailKkoTalkDTO sendTgtDTO : list) {
for (SendDetailKkoTalkDTO sendTgtDTO : list) {
KkotalkApiDTO.Envelope bulkReqDTO = null;
if (StringUtils.isNotEmpty(sendTgtDTO.getCi())) {
@ -279,14 +279,14 @@ public class KkoTalkSender extends SendProcTemplate {
* @param row SendDetailKkoTalkDTO
* @param map Map<String, KkoTalkApiRespVO>
*/
private void modifyTalkSendRsltByExtDocUuid(KkotalkDTO.SendDetailKkoTalkDTO row, Map<String, KkoTalkApiRespVO> map) {
private void modifyTalkSendRsltByExtDocUuid(SendDetailKkoTalkDTO row, Map<String, KkoTalkApiRespVO> map) {
KkoTalkApiRespVO apiRespVO = map.get(row.getExternalId());
if (CmmnUtil.isEmpty(apiRespVO.getErrorCode())) {
row.setStatus(KkoTalkStatusCd.SENT);
row.setStatus(KkoTalkStatusCd.SENT.getCode());
row.setEnvelopeId(String.valueOf(apiRespVO.getData()));
row.setError(FieldError.initBuilder().build());
} else {
row.setStatus(KkoTalkStatusCd.valueOfEnum(apiRespVO.getErrorCode()));
row.setStatus(KkoTalkStatusCd.valueOfEnum(apiRespVO.getErrorCode()).getCode());
row.setError(FieldError.initBuilder()
.errorCode(EnsErrCd.SEND630.getCode())
.errorMessage(String.format("%s %s", apiRespVO.getErrorCode(), apiRespVO.getErrorMessage()))
@ -298,7 +298,7 @@ public class KkoTalkSender extends SendProcTemplate {
}
private Map<String, String> toResultInfo(KkotalkDTO.SendDetailKkoTalkDTO row) {
private Map<String, String> toResultInfo(SendDetailKkoTalkDTO row) {
Map<String, String> m = new HashMap<>();
m.put("envelopeId", row.getEnvelopeId());
m.put("externalId", row.getExternalId());
@ -317,7 +317,7 @@ public class KkoTalkSender extends SendProcTemplate {
* @param respMsg
* @return
*/
private List<SendDetailKkoTalkReqHist> toSendDetailReqHist(List<KkotalkDTO.SendDetailKkoTalkDTO> list, String sendMsg, String respMsg) {
private List<SendDetailKkoTalkReqHist> toSendDetailReqHist(List<SendDetailKkoTalkDTO> list, String sendMsg, String respMsg) {
List<Map> sendMsgList = JsonUtils.toObjectList(sendMsg, Map.class);
Map<String, Long> mSendDetailIds = list.stream()
.map(row -> {

@ -1,22 +1,16 @@
package cokr.xit.ens.modules.kkotalk.web;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.http.*;
import org.springframework.web.bind.annotation.*;
import cokr.xit.ens.core.aop.ApiResponseDTO;
import cokr.xit.ens.core.aop.IApiResponse;
import cokr.xit.ens.modules.kkotalk.model.KkotalkApiDTO;
import cokr.xit.ens.modules.kkotalk.model.KkotalkDTO;
import cokr.xit.ens.modules.kkotalk.service.support.KkoTalkApiService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.media.Content;
import io.swagger.v3.oas.annotations.media.ExampleObject;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import cokr.xit.ens.core.aop.*;
import cokr.xit.ens.modules.kkotalk.model.*;
import cokr.xit.ens.modules.kkotalk.service.support.*;
import io.swagger.v3.oas.annotations.*;
import io.swagger.v3.oas.annotations.media.*;
import io.swagger.v3.oas.annotations.tags.*;
import lombok.*;
import lombok.extern.slf4j.*;
/**
* <pre>

@ -146,7 +146,7 @@ public class KkotalkController {
Map<String, String> paramMap = new HashMap<>();
paramMap.put("envelopeId", envelopeId);
paramMap.put("externalId", externalId);
KkotalkDTO.SendDetailKkoTalkDTO sendDetail = talkMapper.findFetchByExternalIdAndEnvelopeId(paramMap)
SendDetailKkoTalkDTO sendDetail = talkMapper.findFetchByExternalIdAndEnvelopeId(paramMap)
.orElseThrow(() -> new EnsException(EnsErrCd.ERR404, "문서를 찾을 수 없습니다."));
EnsResponseVO<?> responseVO = service.tokenVerify("getOrgCd()", envelopeId, token, externalId);
@ -170,7 +170,7 @@ public class KkotalkController {
Map<String, String> paramMap = new HashMap<>();
paramMap.put("envelopeId", envelopeId);
paramMap.put("externalId", null);
KkotalkDTO.SendDetailKkoTalkDTO sendDetail = talkMapper.findFetchByExternalIdAndEnvelopeId(paramMap)
SendDetailKkoTalkDTO sendDetail = talkMapper.findFetchByExternalIdAndEnvelopeId(paramMap)
.orElseThrow(() -> new EnsException(EnsErrCd.ERR404, "문서를 찾을 수 없습니다."));
EnsResponseVO<?> responseVO = service.readCmplt("getOrgCd()", envelopeId);

@ -6,7 +6,7 @@
<!-- =================================================================================== -->
<!-- ================================ accept =========================================== -->
<!-- =================================================================================== -->
<insert id="saveSndDtlKkoTalk" parameterType="cokr.xit.ens.modules.kkotalk.model.KkotalkDTO$SendDetailKkoTalkDTO">
<insert id="saveSndDtlKkoTalk" parameterType="cokr.xit.ens.modules.kkotalk.model.SendDetailKkoTalkDTO">
/** iup-kkotalk-mapper|saveSndDtlKkoTalk-카카오톡발송상세생성|julim */
INSERT INTO ens_snd_dtl_kko_talk (
send_detail_id,
@ -55,7 +55,7 @@
)
</insert>
<update id="updateSndDtlKkoTalk" parameterType="cokr.xit.ens.modules.kkotalk.model.KkotalkDTO$SendDetailKkoTalkDTO">
<update id="updateSndDtlKkoTalk" parameterType="cokr.xit.ens.modules.kkotalk.model.SendDetailKkoTalkDTO">
/** iup-kkotalk-mapper|updateSndDtlKkoTalk-카카오톡발송상세변경|julim */
UPDATE ens_snd_dtl_kko_talk
SET title = #{title}
@ -74,7 +74,7 @@
WHERE send_detail_id = #{sendDetailId}
</update>
<update id="updateKakaotalkSendBulksResult" parameterType="cokr.xit.ens.modules.kkotalk.model.KkotalkDTO$SendDetailKkoTalkDTO">
<update id="updateKakaotalkSendBulksResult" parameterType="cokr.xit.ens.modules.kkotalk.model.SendDetailKkoTalkDTO">
/** iup-kkotalk-mapper|updateKakaotalkSendBulksResult-카카오톡 문서요청 결과 반영|limju */
UPDATE ens_snd_dtl_kko_talk
SET external_id = #{externalId}
@ -95,14 +95,14 @@
, bill_uid = #{billUid}
, send_mast_id = #{sendMastId}
-->
<select id="findAllBySendMastId" parameterType="long" resultType="cokr.xit.ens.modules.kkotalk.model.KkotalkDTO$SendDetailKkoTalkDTO">
<select id="findAllBySendMastId" parameterType="long" resultType="cokr.xit.ens.modules.kkotalk.model.SendDetailKkoTalkDTO">
/** iup-kkotalk-mapper|findAllBySendMastId-카카오톡발송대상 조회|julim */
<include refid="sqlSelectSendDetailKkoTalk"/>
FROM ens_snd_dtl_kko_talk
WHERE send_mast_id = #{sendMastId}
</select>
<select id="findAllBySendMastAndEnvlopeIdIsNotNull" parameterType="cokr.xit.ens.modules.common.domain.SendMast" resultType="cokr.xit.ens.modules.kkotalk.model.KkotalkDTO$SendDetailKkoTalkDTO">
<select id="findAllBySendMastAndEnvlopeIdIsNotNull" parameterType="cokr.xit.ens.modules.common.domain.SendMast" resultType="cokr.xit.ens.modules.kkotalk.model.SendDetailKkoTalkDTO">
/** iup-kkotalk-mapper|findAllBySendMastAndEnvlopeIdIsNotNull-카카오톡 발송 결과 대상?? 조회|julim */
<include refid="sqlSelectSendDetailKkoTalk"/>
FROM ens_snd_dtl_kko_talk
@ -110,14 +110,14 @@
AND envelope_id IS NOT NULL
</select>
<select id="findAllFetchBySendMastId" parameterType="long" resultType="cokr.xit.ens.modules.kkotalk.model.KkotalkDTO$SendDetailKkoTalkDTO">
<select id="findAllFetchBySendMastId" parameterType="long" resultType="cokr.xit.ens.modules.kkotalk.model.SendDetailKkoTalkDTO">
/** iup-kkotalk-mapper|findAllFetchBySendMastId-카카오톡 발송 결과 대상?? 조회|julim */
<include refid="sqlSelectSendDetailKkoTalk"/>
FROM ens_snd_dtl_kko_talk
WHERE send_mast_id = #{sendMastId}
</select>
<select id="findFetchByExternalIdAndEnvelopeId" parameterType="map" resultType="cokr.xit.ens.modules.kkotalk.model.KkotalkDTO$SendDetailKkoTalkDTO">
<select id="findFetchByExternalIdAndEnvelopeId" parameterType="map" resultType="cokr.xit.ens.modules.kkotalk.model.SendDetailKkoTalkDTO">
/** iup-kkotalk-mapper|findFetchByExternalIdAndEnvelopeId-카카오톡 발송 결과 대상?? 조회|julim */
<include refid="sqlSelectSendDetailKkoTalk"/>
FROM ens_snd_dtl_kko_talk

Loading…
Cancel
Save