diff --git a/mens-batch/src/main/java/kr/xit/biz/ens/mapper/IEnsBatchMapper.java b/mens-batch/src/main/java/kr/xit/biz/ens/mapper/IEnsBatchMapper.java index ed3b75e..0aaf97a 100644 --- a/mens-batch/src/main/java/kr/xit/biz/ens/mapper/IEnsBatchMapper.java +++ b/mens-batch/src/main/java/kr/xit/biz/ens/mapper/IEnsBatchMapper.java @@ -370,6 +370,13 @@ public interface IEnsBatchMapper { * @return */ int updateCntcSndngResultByKkoMyDoc(final CntcDTO.SndngResult dto); + + /** + * 연계결과 처리 - KT-BC + * - tb_cntc_sndng_result + * @param dto KtMainSendReqData + */ + void saveCntcSndngResult(KtMainSendReqData dto); //---------------------------------------------------------------------- // result //---------------------------------------------------------------------- diff --git a/mens-batch/src/main/java/kr/xit/biz/ens/service/EnsBatchRequireNewService.java b/mens-batch/src/main/java/kr/xit/biz/ens/service/EnsBatchRequireNewService.java index 3e7f66e..0a2ca04 100644 --- a/mens-batch/src/main/java/kr/xit/biz/ens/service/EnsBatchRequireNewService.java +++ b/mens-batch/src/main/java/kr/xit/biz/ens/service/EnsBatchRequireNewService.java @@ -14,6 +14,7 @@ import kr.xit.biz.ens.model.EnsDTO; import kr.xit.biz.ens.model.EnsDTO.SndngMssageParam; import kr.xit.biz.ens.model.cntc.CntcDTO; import kr.xit.biz.ens.model.kakao.KkopayDocBulkDTO.BulkSendResponses; +import kr.xit.biz.ens.model.kt.KtMmsSendDTO.KtMainSendReqData; import kr.xit.biz.sms.service.ISmsMessageService; import kr.xit.core.exception.BizRuntimeException; import kr.xit.core.support.utils.Checks; @@ -69,6 +70,7 @@ public class EnsBatchRequireNewService extends EgovAbstractServiceImpl implement * @param unitySndMstId String 통합발송 마스터 ID * */ + @Override @Transactional(propagation = Propagation.REQUIRES_NEW) public void saveKkoMyDocResult(final List mstIdList, String unitySndMstId, final List resList) { @@ -101,6 +103,7 @@ public class EnsBatchRequireNewService extends EgovAbstractServiceImpl implement * * @param tgtDTO EnsDTO.SndngMssageParam */ + @Override @Transactional(propagation = Propagation.REQUIRES_NEW) public void sendEgreen(final EnsDTO.SndngMssageParam tgtDTO) { final List list = mapper.selectPostTgts(tgtDTO); @@ -125,6 +128,7 @@ public class EnsBatchRequireNewService extends EgovAbstractServiceImpl implement * @param tgtDTO EnsDTO.SndngMssageParam * @see kr.xit.biz.sms.service.SmsMessageService#sendSmsList(List) */ + @Override @Transactional(propagation = Propagation.REQUIRES_NEW) public void sendSms(final EnsDTO.SndngMssageParam tgtDTO) { final List list = mapper.selectSmsSendTgts(tgtDTO); @@ -141,12 +145,11 @@ public class EnsBatchRequireNewService extends EgovAbstractServiceImpl implement } @Override - public void sendKtBc(SndngMssageParam tgtDTO) { -// KtMainSendRequest infoDto = mapper.selectKtBcSendMstTgtInfo(tgtDTO) -// .orElseThrow(() -> BizRuntimeException.create("KT BC 본문자 수신 등록 대상이 존재 하지 않습니다 ")); -// infoDto.getReqs().addAll( -// mapper.selectKtBcSendTgts(tgtDTO) -// ); + @Transactional(propagation = Propagation.REQUIRES_NEW) + public void saveSendKtBcResult(final List sendReqs) { + sendReqs.forEach( + mapper::saveCntcSndngResult + ); } @Override @@ -167,7 +170,8 @@ public class EnsBatchRequireNewService extends EgovAbstractServiceImpl implement * @param errMessage 에러메세지(API호출 결과 에러 메세지) * */ - private void insertCntcSndngResult(final String sndngSeCode, + @Transactional + public void insertCntcSndngResult(final String sndngSeCode, final String unitySndngDetailId, final String code, final String errMessage) { mapper.insertCntcSndngResult(CntcDTO.SndngResult.builder() .unitySndngDetailId(unitySndngDetailId) diff --git a/mens-batch/src/main/java/kr/xit/biz/ens/service/EnsBatchService.java b/mens-batch/src/main/java/kr/xit/biz/ens/service/EnsBatchService.java index eeb9110..0dec23a 100644 --- a/mens-batch/src/main/java/kr/xit/biz/ens/service/EnsBatchService.java +++ b/mens-batch/src/main/java/kr/xit/biz/ens/service/EnsBatchService.java @@ -39,6 +39,7 @@ import kr.xit.core.support.utils.DateUtils; import kr.xit.core.support.utils.JsonUtils; import lombok.RequiredArgsConstructor; import org.apache.commons.collections4.ListUtils; +import org.apache.commons.lang3.ObjectUtils; import org.apache.commons.lang3.StringUtils; import org.egovframe.rte.fdl.cmmn.EgovAbstractServiceImpl; import org.slf4j.MDC; @@ -983,19 +984,17 @@ public class EnsBatchService extends EgovAbstractServiceImpl implements IEnsBatc ) .toList(); - List resList = new ArrayList<>(); for(ApiResponseDTO apiResult : apiResults) { - if(apiResult.getData() != null) { - resList.add(JsonUtils.toObjByObj(apiResult.getData(), KtCommonResponse.class)); - }else{ - //updateKkoMyDocSndngMstFailStatus(mstIdList, apiResult.getMessage()); - throw BizRuntimeException.create(apiResult.getMessage()); + if(ObjectUtils.isNotEmpty(apiResult.getData())) { + KtCommonResponse resDTO = JsonUtils.toObjByObj(apiResult.getData(), KtCommonResponse.class); + if(ObjectUtils.isNotEmpty(resDTO) && "00".equals(resDTO.getResultCd())){ + continue; + } } + updateKkoMyDocSndngMstFailStatus(mstIdList, apiResult.getMessage()); + throw BizRuntimeException.create(apiResult.getMessage()); } - - // 카카오 문서 요청 결과 반영 - //requireNewService.saveKkoMyDocResult(mstIdList, tgtDTO.getUnitySndngMastrId(), resList); - requireNewService.sendKtBc(tgtDTO); + requireNewService.saveSendKtBcResult(sendReqs); } //----------------------------------------------------------------------------------------------------------------- diff --git a/mens-batch/src/main/java/kr/xit/biz/ens/service/IEnsBatchRequireNewService.java b/mens-batch/src/main/java/kr/xit/biz/ens/service/IEnsBatchRequireNewService.java index 64961ec..6c4e979 100644 --- a/mens-batch/src/main/java/kr/xit/biz/ens/service/IEnsBatchRequireNewService.java +++ b/mens-batch/src/main/java/kr/xit/biz/ens/service/IEnsBatchRequireNewService.java @@ -3,6 +3,7 @@ package kr.xit.biz.ens.service; import java.util.List; import kr.xit.biz.ens.model.EnsDTO.SndngMssageParam; import kr.xit.biz.ens.model.kakao.KkopayDocBulkDTO.BulkSendResponses; +import kr.xit.biz.ens.model.kt.KtMmsSendDTO.KtMainSendReqData; /** *
@@ -27,6 +28,6 @@ public interface IEnsBatchRequireNewService {
     void sendEgreen(final SndngMssageParam tgtDTO);
     void sendSms(final SndngMssageParam tgtDTO);
 
-    void sendKtBc(final SndngMssageParam tgtDTO);
+    void saveSendKtBcResult(final List sendReqs);
     void sendPostPlus(final SndngMssageParam tgtDTO);
 }
diff --git a/mens-batch/src/main/resources/egovframework/mapper/biz/ens-mysql-mapper.xml b/mens-batch/src/main/resources/egovframework/mapper/biz/ens-mysql-mapper.xml
index 6c9abb6..61224d1 100644
--- a/mens-batch/src/main/resources/egovframework/mapper/biz/ens-mysql-mapper.xml
+++ b/mens-batch/src/main/resources/egovframework/mapper/biz/ens-mysql-mapper.xml
@@ -897,6 +897,43 @@
 		                                  FROM tb_ens_kakao_my_doc tekmd
 		                                 WHERE tekmd.document_binder_uuid = #{documentBinderUuid})
 	
+
+	
+		/** ens-mysql-mapper|saveCntcSndngResult-연계발송결과반영|julim  */
+		INSERT
+			INTO tb_cntc_sndng_result (
+				unity_sndng_detail_id,		/* 통합 발송 상세 ID*/
+				sndng_se_code,						/* 발송구분코드 */
+				signgu_code,							/* 시군구코드 */
+				ffnlg_code,								/* 과태료코드 */
+				sndng_result_sttus,
+				requst_dt,								/* 송신(요청) 일시 */
+				inqire_dt,								/* 수신(조회) 일시 */
+				readng_dt,								/* 최초열람일시 */
+				-- error_cn,									/* 에러내용 */
+				regist_dt,
+				register
+			) VALUES (
+			  #{unitySndngDetailId}
+				, #{sndngSeCode}				/* 발송구분코드 - KAKAO-MY-DOC|KT-BC */
+				, (SELECT tgt.signgu_code, tgt.ffnlg_code FROM tb_ens_unity_sndng_detail tgt WHERE tgt.unity_sndng_detail_id = #{src_key})					/* 시군구코드 */
+				, (SELECT tgt.ffnlg_code FROM tb_ens_unity_sndng_detail tgt WHERE tgt.unity_sndng_detail_id = #{src_key})						/* 과태료코드 */
+				, #{sndngResultSttus}
+				, #{mmsSndgTmst}		/* 송신(요청) 일시 */
+				, #{mmsRcvTmst}		/* 수신(조회) 일시 */
+				, #{mmsRdgTmst}		/* 최초열람일시 */
+				-- , #{errorCn}						/* 에러내용 */
+				, now()
+				, 'batch'
+			)
+			ON DUPLICATE KEY UPDATE
+				sndng_result_sttus = IFNULL(#{sndngResultSttus}, sndng_result_sttus)
+				, requst_dt = IFNULL(#{mmsSndgTmst}, requst_dt)   /* 송신(요청) 일시 */
+				, inqire_dt =	IFNULL(#{mmsRcvTmst}, inqire_dt)		/* 수신(조회) 일시 */
+				, readng_dt =	IFNULL(#{mmsRdgTmst}, readng_dt)		/* 최초열람일시 */
+				, updt_dt = now()
+		    , updusr = 'batch'
+