fix: 트랜잭션분리처리

dev
gitea-관리자 1 year ago
parent 29bb3e80d0
commit fe3a584560

@ -13,6 +13,7 @@ import kr.xit.biz.ens.model.EnsDTO;
import kr.xit.biz.ens.model.cmm.SndngMssageParam; import kr.xit.biz.ens.model.cmm.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,7 +70,7 @@ public class EnsBatchExtractService extends EgovAbstractServiceImpl implements
*/ */
@Override @Override
@Transactional(propagation = Propagation.REQUIRES_NEW) @Transactional(propagation = Propagation.REQUIRES_NEW)
public void saveKkoMyDocResult(final String mstId, String unitySndMstId, final List<BulkSendResponses> resList) { public void saveKkoSendResult(final String mstId, String unitySndMstId, final List<BulkSendResponses> resList) {
// 결과 반영 // 결과 반영
resList.forEach(o -> resList.forEach(o ->
o.getDocuments().forEach( o.getDocuments().forEach(
@ -140,6 +141,15 @@ public class EnsBatchExtractService extends EgovAbstractServiceImpl implements
updateMstTable(paramDTO, SndngSeCode.SMS); updateMstTable(paramDTO, SndngSeCode.SMS);
} }
@Override
@Transactional(propagation = Propagation.REQUIRES_NEW)
public void saveKtBcResult(final SndngMssageParam dto, final List<KtMainSendReqData> sendReqs) {
// 성공처리
// mobile page create
if(Checks.isNotEmpty(sendReqs)) sendReqs.forEach(d -> mapper.insertKtMobilePageManage(d.getSrcKey()));
mapper.updateKtBcMst(dto);
}
@Override @Override
@Transactional(propagation = Propagation.REQUIRES_NEW) @Transactional(propagation = Propagation.REQUIRES_NEW)
public void sendPostPlus(SndngMssageParam dto) { public void sendPostPlus(SndngMssageParam dto) {

@ -93,6 +93,7 @@ public class EnsBatchSendService extends EgovAbstractServiceImpl implements IEns
/** /**
* <pre> * <pre>
* () send bulks - send * () send bulks - send
* - (BIZ DB) ->
* - 'make-ok' * - 'make-ok'
* - : ( ) * - : ( )
* , , - 'send-ok' * , , - 'send-ok'
@ -167,7 +168,7 @@ public class EnsBatchSendService extends EgovAbstractServiceImpl implements IEns
* 4. * 4.
* - bulk * - bulk
* - * -
* -> {@link EnsBatchExtractService#saveKkoMyDocResult(String, String, List) saveKkoMyDocResult} * -> {@link EnsBatchExtractService#saveKkoSendResult(String, String, List) saveKkoMyDocResult}
* - : tb_ens_kakao_my_doc * - : tb_ens_kakao_my_doc
* - : tb_ens_mobile_page_manage * - : tb_ens_mobile_page_manage
* - : tb_cntc_sndng_result * - : tb_cntc_sndng_result
@ -221,7 +222,7 @@ public class EnsBatchSendService extends EgovAbstractServiceImpl implements IEns
if(!isSuccess){ if(!isSuccess){
extractService.updateSndngMstFailStatus(mstId, SndngSeCode.KAKAO, "", errMsg, errMsg); extractService.updateSndngMstFailStatus(mstId, SndngSeCode.KAKAO, "", errMsg, errMsg);
} }
extractService.saveKkoMyDocResult(mstId, dto.getUnitySndngMastrId(), resList); extractService.saveKkoSendResult(mstId, dto.getUnitySndngMastrId(), resList);
} }
/** /**
@ -234,8 +235,8 @@ public class EnsBatchSendService extends EgovAbstractServiceImpl implements IEns
final List<BulkSendReq> bulkList = new ArrayList<>(); final List<BulkSendReq> bulkList = new ArrayList<>();
for (SendKakaoTgt sendTgtDTO : list) { for (SendKakaoTgt sendTgtDTO : list) {
/** /*
* : CI : CI
*/ */
Receiver receiver = null; Receiver receiver = null;
if(StringUtils.isNotEmpty(sendTgtDTO.getCi())){ if(StringUtils.isNotEmpty(sendTgtDTO.getCi())){
@ -406,17 +407,14 @@ public class EnsBatchSendService extends EgovAbstractServiceImpl implements IEns
.map(ErrorMsg::getErrorMsg) .map(ErrorMsg::getErrorMsg)
.collect(Collectors.joining(",")) .collect(Collectors.joining(","))
); );
mapper.updateKtBcMst(dto); extractService.saveKtBcResult(dto, null);
extractService.updateSndngMstFailStatus(mstId, SndngSeCode.KT_BC, dto.getErrorCode(), dto.getErrorMssage(), "[send] KT-BC 발송(bulks)요청 실패"); extractService.updateSndngMstFailStatus(mstId, SndngSeCode.KT_BC, dto.getErrorCode(), dto.getErrorMssage(), "[send] KT-BC 발송(bulks)요청 실패");
return; return;
} }
// mobile page create
sendReqs.forEach(d -> mapper.insertKtMobilePageManage(d.getSrcKey()));
// 성공 건수 존재시 성공 처리 // 성공 건수 존재시 성공 처리
dto.setResultCd("00"); dto.setResultCd("00");
dto.setErrorMssage("정상"); dto.setErrorMssage("정상");
mapper.updateKtBcMst(dto); extractService.saveKtBcResult(dto, sendReqs);
extractService.updateSendSndngMstStatus(mstId, unitySndMstId, SndngSeCode.KT_BC, "KT-BC 실패(발송마스터 데이타 오류)"); extractService.updateSendSndngMstStatus(mstId, unitySndMstId, SndngSeCode.KT_BC, "KT-BC 실패(발송마스터 데이타 오류)");
} }

@ -4,6 +4,7 @@ import java.util.List;
import kr.xit.biz.common.ApiConstants.SndngSeCode; import kr.xit.biz.common.ApiConstants.SndngSeCode;
import kr.xit.biz.ens.model.cmm.SndngMssageParam; import kr.xit.biz.ens.model.cmm.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,9 +28,12 @@ public interface IEnsBatchExtractService {
//----------------------------------------------------------------------------------------------------------------- //-----------------------------------------------------------------------------------------------------------------
// REQUIRES_NEW service method // REQUIRES_NEW service method
//----------------------------------------------------------------------------------------------------------------- //-----------------------------------------------------------------------------------------------------------------
void saveKkoMyDocResult(final String mstId, String unitySndMstId, final List<BulkSendResponses> resList); void saveKkoSendResult(final String mstId, String unitySndMstId, final List<BulkSendResponses> resList);
void sendEgreen(final SndngMssageParam dto); void sendEgreen(final SndngMssageParam dto);
void sendSms(final SndngMssageParam dto); void sendSms(final SndngMssageParam dto);
void saveKtBcResult(final SndngMssageParam dto, final List<KtMainSendReqData> sendReqs);
void sendPostPlus(final SndngMssageParam dto); void sendPostPlus(final SndngMssageParam dto);

Loading…
Cancel
Save