feat: batch KT-BC send

dev
gitea-관리자 1 year ago
parent a47e99b476
commit 07fcbc2a71

@ -370,6 +370,13 @@ public interface IEnsBatchMapper {
* @return * @return
*/ */
int updateCntcSndngResultByKkoMyDoc(final CntcDTO.SndngResult dto); int updateCntcSndngResultByKkoMyDoc(final CntcDTO.SndngResult dto);
/**
* - KT-BC
* - tb_cntc_sndng_result
* @param dto KtMainSendReqData
*/
void saveCntcSndngResult(KtMainSendReqData dto);
//---------------------------------------------------------------------- //----------------------------------------------------------------------
// result // result
//---------------------------------------------------------------------- //----------------------------------------------------------------------

@ -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.EnsDTO.SndngMssageParam;
import kr.xit.biz.ens.model.cntc.CntcDTO; import kr.xit.biz.ens.model.cntc.CntcDTO;
import kr.xit.biz.ens.model.kakao.KkopayDocBulkDTO.BulkSendResponses; 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.biz.sms.service.ISmsMessageService;
import kr.xit.core.exception.BizRuntimeException; import kr.xit.core.exception.BizRuntimeException;
import kr.xit.core.support.utils.Checks; import kr.xit.core.support.utils.Checks;
@ -69,6 +70,7 @@ public class EnsBatchRequireNewService extends EgovAbstractServiceImpl implement
* @param unitySndMstId String ID * @param unitySndMstId String ID
* </pre> * </pre>
*/ */
@Override
@Transactional(propagation = Propagation.REQUIRES_NEW) @Transactional(propagation = Propagation.REQUIRES_NEW)
public void saveKkoMyDocResult(final List<String> mstIdList, String unitySndMstId, public void saveKkoMyDocResult(final List<String> mstIdList, String unitySndMstId,
final List<BulkSendResponses> resList) { final List<BulkSendResponses> resList) {
@ -101,6 +103,7 @@ public class EnsBatchRequireNewService extends EgovAbstractServiceImpl implement
* *
* @param tgtDTO EnsDTO.SndngMssageParam * @param tgtDTO EnsDTO.SndngMssageParam
*/ */
@Override
@Transactional(propagation = Propagation.REQUIRES_NEW) @Transactional(propagation = Propagation.REQUIRES_NEW)
public void sendEgreen(final EnsDTO.SndngMssageParam tgtDTO) { public void sendEgreen(final EnsDTO.SndngMssageParam tgtDTO) {
final List<EnsDTO.PostSndng> list = mapper.selectPostTgts(tgtDTO); final List<EnsDTO.PostSndng> list = mapper.selectPostTgts(tgtDTO);
@ -125,6 +128,7 @@ public class EnsBatchRequireNewService extends EgovAbstractServiceImpl implement
* @param tgtDTO EnsDTO.SndngMssageParam * @param tgtDTO EnsDTO.SndngMssageParam
* @see kr.xit.biz.sms.service.SmsMessageService#sendSmsList(List) * @see kr.xit.biz.sms.service.SmsMessageService#sendSmsList(List)
*/ */
@Override
@Transactional(propagation = Propagation.REQUIRES_NEW) @Transactional(propagation = Propagation.REQUIRES_NEW)
public void sendSms(final EnsDTO.SndngMssageParam tgtDTO) { public void sendSms(final EnsDTO.SndngMssageParam tgtDTO) {
final List<EnsDTO.SmsSndng> list = mapper.selectSmsSendTgts(tgtDTO); final List<EnsDTO.SmsSndng> list = mapper.selectSmsSendTgts(tgtDTO);
@ -141,12 +145,11 @@ public class EnsBatchRequireNewService extends EgovAbstractServiceImpl implement
} }
@Override @Override
public void sendKtBc(SndngMssageParam tgtDTO) { @Transactional(propagation = Propagation.REQUIRES_NEW)
// KtMainSendRequest infoDto = mapper.selectKtBcSendMstTgtInfo(tgtDTO) public void saveSendKtBcResult(final List<KtMainSendReqData> sendReqs) {
// .orElseThrow(() -> BizRuntimeException.create("KT BC 본문자 수신 등록 대상이 존재 하지 않습니다 ")); sendReqs.forEach(
// infoDto.getReqs().addAll( mapper::saveCntcSndngResult
// mapper.selectKtBcSendTgts(tgtDTO) );
// );
} }
@Override @Override
@ -167,7 +170,8 @@ public class EnsBatchRequireNewService extends EgovAbstractServiceImpl implement
* @param errMessage (API ) * @param errMessage (API )
* </pre> * </pre>
*/ */
private void insertCntcSndngResult(final String sndngSeCode, @Transactional
public void insertCntcSndngResult(final String sndngSeCode,
final String unitySndngDetailId, final String code, final String errMessage) { final String unitySndngDetailId, final String code, final String errMessage) {
mapper.insertCntcSndngResult(CntcDTO.SndngResult.builder() mapper.insertCntcSndngResult(CntcDTO.SndngResult.builder()
.unitySndngDetailId(unitySndngDetailId) .unitySndngDetailId(unitySndngDetailId)

@ -39,6 +39,7 @@ import kr.xit.core.support.utils.DateUtils;
import kr.xit.core.support.utils.JsonUtils; import kr.xit.core.support.utils.JsonUtils;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import org.apache.commons.collections4.ListUtils; import org.apache.commons.collections4.ListUtils;
import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.egovframe.rte.fdl.cmmn.EgovAbstractServiceImpl; import org.egovframe.rte.fdl.cmmn.EgovAbstractServiceImpl;
import org.slf4j.MDC; import org.slf4j.MDC;
@ -983,19 +984,17 @@ public class EnsBatchService extends EgovAbstractServiceImpl implements IEnsBatc
) )
.toList(); .toList();
List<KtCommonResponse> resList = new ArrayList<>();
for(ApiResponseDTO apiResult : apiResults) { for(ApiResponseDTO apiResult : apiResults) {
if(apiResult.getData() != null) { if(ObjectUtils.isNotEmpty(apiResult.getData())) {
resList.add(JsonUtils.toObjByObj(apiResult.getData(), KtCommonResponse.class)); KtCommonResponse resDTO = JsonUtils.toObjByObj(apiResult.getData(), KtCommonResponse.class);
}else{ if(ObjectUtils.isNotEmpty(resDTO) && "00".equals(resDTO.getResultCd())){
//updateKkoMyDocSndngMstFailStatus(mstIdList, apiResult.getMessage()); continue;
throw BizRuntimeException.create(apiResult.getMessage());
} }
} }
updateKkoMyDocSndngMstFailStatus(mstIdList, apiResult.getMessage());
// 카카오 문서 요청 결과 반영 throw BizRuntimeException.create(apiResult.getMessage());
//requireNewService.saveKkoMyDocResult(mstIdList, tgtDTO.getUnitySndngMastrId(), resList); }
requireNewService.sendKtBc(tgtDTO); requireNewService.saveSendKtBcResult(sendReqs);
} }
//----------------------------------------------------------------------------------------------------------------- //-----------------------------------------------------------------------------------------------------------------

@ -3,6 +3,7 @@ package kr.xit.biz.ens.service;
import java.util.List; import java.util.List;
import kr.xit.biz.ens.model.EnsDTO.SndngMssageParam; import kr.xit.biz.ens.model.EnsDTO.SndngMssageParam;
import kr.xit.biz.ens.model.kakao.KkopayDocBulkDTO.BulkSendResponses; import kr.xit.biz.ens.model.kakao.KkopayDocBulkDTO.BulkSendResponses;
import kr.xit.biz.ens.model.kt.KtMmsSendDTO.KtMainSendReqData;
/** /**
* <pre> * <pre>
@ -27,6 +28,6 @@ public interface IEnsBatchRequireNewService {
void sendEgreen(final SndngMssageParam tgtDTO); void sendEgreen(final SndngMssageParam tgtDTO);
void sendSms(final SndngMssageParam tgtDTO); void sendSms(final SndngMssageParam tgtDTO);
void sendKtBc(final SndngMssageParam tgtDTO); void saveSendKtBcResult(final List<KtMainSendReqData> sendReqs);
void sendPostPlus(final SndngMssageParam tgtDTO); void sendPostPlus(final SndngMssageParam tgtDTO);
} }

@ -897,6 +897,43 @@
FROM tb_ens_kakao_my_doc tekmd FROM tb_ens_kakao_my_doc tekmd
WHERE tekmd.document_binder_uuid = #{documentBinderUuid}) WHERE tekmd.document_binder_uuid = #{documentBinderUuid})
</insert> </insert>
<insert id="saveCntcSndngResult">
/** 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'
</insert>
<!-- =================================================================================== --> <!-- =================================================================================== -->
<!-- ================================ result ============================================= --> <!-- ================================ result ============================================= -->
<!-- =================================================================================== --> <!-- =================================================================================== -->

Loading…
Cancel
Save