feat: batch KT-BC send

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

@ -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
//----------------------------------------------------------------------

@ -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
* </pre>
*/
@Override
@Transactional(propagation = Propagation.REQUIRES_NEW)
public void saveKkoMyDocResult(final List<String> mstIdList, String unitySndMstId,
final List<BulkSendResponses> 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<EnsDTO.PostSndng> 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<EnsDTO.SmsSndng> 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<KtMainSendReqData> sendReqs) {
sendReqs.forEach(
mapper::saveCntcSndngResult
);
}
@Override
@ -167,7 +170,8 @@ public class EnsBatchRequireNewService extends EgovAbstractServiceImpl implement
* @param errMessage (API )
* </pre>
*/
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)

@ -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<KtCommonResponse> 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);
}
//-----------------------------------------------------------------------------------------------------------------

@ -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;
/**
* <pre>
@ -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<KtMainSendReqData> sendReqs);
void sendPostPlus(final SndngMssageParam tgtDTO);
}

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

Loading…
Cancel
Save