refactor: docs 상세 기술

메소드 순서 변경
dev
gitea-관리자 1 year ago
parent 0ea0a57ca2
commit 3e77936795

@ -60,6 +60,7 @@ public interface IEnsBatchMapper {
/**
*
* - tb_cntc_sndng_mastr : sndng_process_sttus
* @param t status, newStatus
* @return int
*/
@ -72,7 +73,7 @@ public interface IEnsBatchMapper {
// make
//----------------------------------------------------------------------
/**
*
*
* @param t
* @return List<EnsDTO.SndngMssageParam>
*/
@ -122,6 +123,7 @@ public interface IEnsBatchMapper {
/**
*
* - tb_ens_unity_sndng_mastr : sndng_process_sttus
* @param t status, newStatus
* @return int
*/

@ -17,6 +17,7 @@ import java.util.stream.Collectors;
import javax.validation.ConstraintViolation;
import javax.validation.Validation;
import javax.validation.Validator;
import kr.xit.batch.ens.task.cmm.TaskCmmUtils;
import kr.xit.biz.common.ApiConstants;
import kr.xit.biz.common.ApiConstants.SndngSeCode;
import kr.xit.biz.ens.mapper.IEnsBatchMapper;
@ -96,12 +97,32 @@ public class EnsBatchService extends EgovAbstractServiceImpl implements IEnsBatc
private static final String UNITY_SNDNG_MST_ID = "unitySndngMastrId";
private static final String YMDHMS = "yyyyMMddHHmmss";
//-----------------------------------------------------------------------------------------------------------------
// accept
//-----------------------------------------------------------------------------------------------------------------
/**
* <pre>
* accept()
*
* 1. : (accept)
* -> {@link IEnsBatchMapper#selectAcceptTgts selectAcceptTgts}
* - tb_cntc_sndng_mastr, tb_ens_tmplat_manage
*
* 2. validation : {@link #validatedAccept}
* -> : (accept-fail)
* {@link #updateAcceptCntcSndngMstFailStatus}
* - tb_cntc_sndng_mastr
* ->
*
* 3.
* 3-1. :
* {@link IEnsBatchMapper#insertUnitySndngMst insertUnitySndngMst}
* - tb_ens_unity_sndng_mastr
* 3-2.
* {@link IEnsBatchMapper#insertUnitySndngDtls insertUnitySndngDtls}
* - tb_ens_unity_sndng_detail
* 3-3. : (accept-ok)
* {@link IEnsBatchMapper#updateProcessSttusCntcSndngMst updateProcessSttusCntcSndngMst}
* - tb_cntc_sndng_mastr
* @param reqDTO BatchEnsRequest
* </pre>
*/
@Override
@Transactional
@ -120,11 +141,10 @@ public class EnsBatchService extends EgovAbstractServiceImpl implements IEnsBatc
// validation check
final List<EnsDTO.sndngVali> valiList = mapper.selectAcceptVali(dto);
try {
validatedAccept(valiList);
} catch (Exception e) {
final String err = validatedAccept(valiList);
if(StringUtils.isNotEmpty(err)){
updateAcceptCntcSndngMstFailStatus(mstIdList,
"accept 생성 요청 실패(파라메터 오류) : " + EgovStringUtil.cutString(e.getMessage(), 300));
"accept 생성 요청 실패(파라메터 오류) : " + EgovStringUtil.cutString(err, 300));
continue;
}
@ -159,11 +179,268 @@ public class EnsBatchService extends EgovAbstractServiceImpl implements IEnsBatc
}
/**
* <pre>
* make()
* 1.
* - (accept-ok)
* - 1, 2 (sending1, sending2)
* -> {@link IEnsBatchMapper#selectMakeTgts selectMakeTgts}
* - tb_ens_unity_sndng_mastr
*
* 2. : {@link #makeMstStatusUpdate}
* - - make-ok
* 1 : try_seq - 1,
* - 릿 try1
* 2 : try_seq - 2
* - 릿 try2
* - 2 ({@link IEnsBatchMapper#selectSendOkTgts selectSendOkTgts})
* @param reqDTO BatchEnsRequest
* </pre>
*/
@Override
@Transactional
public void make(final EnsDTO.BatchEnsRequest reqDTO) {
final String sndngProcessSttus2 = ApiConstants.SndngProcessStatus.SENDING1.getCode();
final String sndngProcessSttus3 = ApiConstants.SndngProcessStatus.SENDING2.getCode();
final List<EnsDTO.SndngMssageParam> list = mapper.selectMakeTgts(reqDTO);
final List<EnsDTO.SndngMssageParam> list2 = mapper.selectMakeTgts(sndngProcessSttus2);
for (EnsDTO.SndngMssageParam dto : list) {
MDC.put(UNITY_SNDNG_MST_ID, dto.getUnitySndngMastrId());
MDC.put(SNDNG_PROCESS_STTUS, "make-fail1");
dto.setSndngProcessSttus(reqDTO.getSndngProcessSttus());
dto.setNewSndngProcessSttus(ApiConstants.SndngProcessStatus.MAKE_OK.getCode());
//FIXME: try1,try2,tr3이 있는 경우 try1 이전에 try2,3이 실행될 수 있는 경우???
dto.setTrySeq(1);
dto.setSndngSeCode(dto.getTry1());
makeMstStatusUpdate(dto);
}
for (EnsDTO.SndngMssageParam dto : list2) {
MDC.put(UNITY_SNDNG_MST_ID, dto.getUnitySndngMastrId());
MDC.put(SNDNG_PROCESS_STTUS, "make-fail2");
//try2 발송 대상이 있는지 확인
final int sendCnt = mapper.selectSendOkTgts(dto);
//없으면 연계 발송 마스터, 통합 발송 마스터 send-ok
if (sendCnt == 0) {
dto.setNewSndngProcessSttus(ApiConstants.SndngProcessStatus.SEND_OK.getCode());
if (mapper.updateProcessSttusCntcSndngMst(dto) != 1) {
throw BizRuntimeException.create("[make]연계 발송 마스터 상태변경 실패");
}
if (mapper.updateProcessSttusUnitySndngMst(dto) != 1) {
throw BizRuntimeException.create("[make]통합 발송 마스터 상태변경 실패");
}
} else {
//있으면 make
dto.setSndngProcessSttus(sndngProcessSttus2);
dto.setNewSndngProcessSttus(ApiConstants.SndngProcessStatus.MAKE_OK.getCode());
dto.setTrySeq(2);
dto.setSndngCo(sendCnt);
dto.setSndngSeCode(dto.getTry2());
makeMstStatusUpdate(dto);
}
}
//TODO:: GS 인증 시험에서 카카오, E-GREEN만 있어서 3단계는 필요 시 구현
}
/**
* () send bulks
* - | E-GREEN | SMS 1. / 2. send()
*
* @param reqDTO BatchEnsRequest
*/
@Override
@Transactional
public void sendBulks(final EnsDTO.BatchEnsRequest reqDTO) {
// 발송/통합발송 마스터에서 대상 조회
final List<EnsDTO.SndngMssageParam> tgtList = mapper.selectSendBulkTgts(reqDTO);
for (EnsDTO.SndngMssageParam tgtDTO : tgtList) {
tgtDTO.setSignguCode(reqDTO.getSignguCode());
tgtDTO.setFfnlgCode(reqDTO.getFfnlgCode());
MDC.put(UNITY_SNDNG_MST_ID, tgtDTO.getUnitySndngMastrId());
MDC.put("sndngMastrId", tgtDTO.getSndngMastrId());
MDC.put(SNDNG_PROCESS_STTUS, "send-fail" + tgtDTO.getTrySeq());
String[] tryVal = {Checks.checkVal(tgtDTO.getTry1(), ""),
Checks.checkVal(tgtDTO.getTry2(), ""), Checks.checkVal(tgtDTO.getTry3(), "")};
// 마스터 상태 변경값을 파라메터에서 받은 상태값으로 set
tgtDTO.setNewSndngProcessSttus(reqDTO.getSndngProcessSttus());
// 업무 문서 구분에 따른 분기
switch (SndngSeCode.compare(tryVal[tgtDTO.getTrySeq() - 1])) {
// 카카오
case KAKAO:
sendBulkKakaoMyDocs(tgtDTO);
break;
// E-GREEN
case E_GREEN:
sendEgreen(tgtDTO);
break;
// SMS
case SMS:
sendSms(tgtDTO);
break;
default:
break;
}
}
}
/**
* (bulks)
*
* @param reqDTO BatchEnsRequest
*/
@Override
@Transactional
public void findKkoMyDocStatusBulks(final EnsDTO.BatchEnsRequest reqDTO) {
final String url = apiHost + apiBulkStatus;;
final List<String> docsBinderUuids = mapper.selectKakaoStatusTgts(reqDTO.getSndngProcessSttus());
List<List<String>> partitions = ListUtils.partition(docsBinderUuids, bulkMaxCnt);
List<ApiResponseDTO<KkopayDocBulkDTO.BulkStatusResponses>> apiResults = partitions.stream()
.map(uuids ->
ApiResponseDTO.success(
apiWebClient.exchange(
url.toString(),
HttpMethod.POST,
BulkStatusRequests.builder()
.signguCode(reqDTO.getSignguCode())
.ffnlgCode(reqDTO.getFfnlgCode())
.document_binder_uuids(uuids)
.build(),
BulkStatusResponses.class,
getHeadeMap()))
).collect(Collectors.toList());
List<KkopayDocBulkDTO.BulkStatusResponses> resList = apiResults.stream()
.map(ApiResponseDTO::getData)
.collect(Collectors.toList());
// 결과 반영
resList.forEach(o ->
o.getDocuments().forEach(t -> {
mapper.updateKakaoStatusInfo(t);
mapper.updateCntcSndngResult(CntcDTO.SndngResult.builder()
.documentBinderUuid(t.getDocument_binder_uuid())
.sndngResultSttus(StringUtils.defaultString(String.valueOf(t.getStatus_data().getDoc_box_status()), "FAIL"))
.requstDt(Checks.isEmpty(t.getStatus_data().getDoc_box_sent_at())? null: t.getStatus_data().getDoc_box_sent_at().toString())
.inqireDt(Checks.isEmpty(t.getStatus_data().getDoc_box_received_at())? null: t.getStatus_data().getDoc_box_received_at().toString())
.readngDt(Checks.isEmpty(t.getStatus_data().getDoc_box_read_at())? null: t.getStatus_data().getDoc_box_read_at().toString())
.errorCn(t.getError_message())
.build());
})
);
}
/**
* send-ok close
*
* @param reqDTO BatchEnsRequest
*/
@Override
@Transactional
public void close(final EnsDTO.BatchEnsRequest reqDTO) {
final List<String> list = mapper.selectCloseTgts(reqDTO.getSndngProcessSttus());
// 연계발송 마스터(tb_cntc_sndng_mastr) 상태 변경 : send-ok -> close
for (String id : list) {
EnsDTO.SndngMssageParam paramDTO = EnsDTO.SndngMssageParam.builder()
.unitySndngMastrId(id)
.sndngProcessSttus(reqDTO.getSndngProcessSttus())
.newSndngProcessSttus(ApiConstants.SndngProcessStatus.CLOSE.getCode())
.build();
if (mapper.updateProcessSttusCntcSndngMst(paramDTO) != 1) {
throw BizRuntimeException.create("[close]연계 발송 마스터 상태변경 실패");
}
if (mapper.updateProcessSttusUnitySndngMst(paramDTO) != 1) {
throw BizRuntimeException.create("[close]통합 발송 마스터 상태변경 실패");
}
// 2차 이상 발송 시 발송 마스터가 1개 이상 존재
if (mapper.updateProcessSttusBulkSndngMst(paramDTO) < 1) {
throw BizRuntimeException.create("[close]발송 마스터 상태변경 실패");
}
}
}
//-----------------------------------------------------------------------------------------------------------------
// close
//-----------------------------------------------------------------------------------------------------------------
/**
* (bulks) -
*
* @param reqDTO BatchEnsRequest
* @return List<SendKakaoTgt>
*/
@Override
public List<EnsDTO.SendKakaoTgt> findKakaoSendTargets(final EnsDTO.BatchEnsRequest reqDTO) {
return mapper.selectKakaoSendTgts(reqDTO);
}
/**
*
* ->
* @param dto EnsDTO.SndngMssageParam
* @see TaskCmmUtils#taskEnsBatchServiceUpdateErrorLog
*/
public void updateErrorLog(EnsDTO.SndngMssageParam dto) {
if ("SndngAcceptJob".equals(dto.getErrorCode())) {
mapper.updateProcessSttusCntcSndngMst(dto);
} else if ("SndngMakeJob".equals(dto.getErrorCode())) {
mapper.updateProcessSttusCntcSndngMst(dto);
mapper.updateProcessSttusUnitySndngMst(dto);
} else if ("SndngSendBulksJob".equals(dto.getErrorCode())) {
mapper.updateProcessSttusCntcSndngMst(dto);
mapper.updateProcessSttusUnitySndngMst(dto);
mapper.updateProcessSttusSndngMst(dto);
}
}
//*************************************************************************
// private method
//*************************************************************************
/**
* API set
* @return Map<String,String>
*/
private Map<String,String> getHeadeMap(){
Map<String, String> map = new HashMap<>();
map.put(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON_VALUE);
//map.put(HttpHeaders.AUTHORIZATION, "");
return map;
}
//-----------------------------------------------------------------------------------------------------------------
// accept
//-----------------------------------------------------------------------------------------------------------------
/**
* <pre>
* accept
*
* @param valiList List<EnsDTO.sndngVali>
* @return String
* </pre>
*/
private void validatedAccept(List<EnsDTO.sndngVali> valiList) {
private String validatedAccept(List<EnsDTO.sndngVali> valiList) {
List<String> errors = new ArrayList<>();
int idx = 0;
@ -238,6 +515,14 @@ public class EnsBatchService extends EgovAbstractServiceImpl implements IEnsBatc
}
break;
//FIXME : KT 데이타 적합성 체크
case KT_BC:
break;
//FIXME : Post plus 데이타 적합성 체크
case PPLUS:
break;
default:
break;
}
@ -245,19 +530,19 @@ public class EnsBatchService extends EgovAbstractServiceImpl implements IEnsBatc
}
}
if (errors.size() > 0) {
throw BizRuntimeException.create(errors.toString());
}
return errors.size() > 0 ? errors.toString() : StringUtils.EMPTY;
}
/**
* accpet -
*
* @param mstIdList
* <pre>
*
* accpet
* @param mstIdList List<String>
* @param stsErrMsg
* </pre>
* @see IEnsBatchMapper#updateProcessSttusCntcSndngMst(Object)
*/
private void updateAcceptCntcSndngMstFailStatus(final List<String> mstIdList,
final String stsErrMsg) {
private void updateAcceptCntcSndngMstFailStatus(final List<String> mstIdList, final String stsErrMsg) {
for (String id : mstIdList) {
EnsDTO.SndngMssageParam paramDTO = EnsDTO.SndngMssageParam.builder()
@ -272,75 +557,21 @@ public class EnsBatchService extends EgovAbstractServiceImpl implements IEnsBatc
}
}
//-----------------------------------------------------------------------------------------------------------------
// accept
//-----------------------------------------------------------------------------------------------------------------
//-----------------------------------------------------------------------------------------------------------------
// make
//-----------------------------------------------------------------------------------------------------------------
/**
* tryCnt - 1:
*
* @param reqDTO BatchEnsRequest
*/
@Override
@Transactional
public void make(final EnsDTO.BatchEnsRequest reqDTO) {
final String sndngProcessSttus2 = ApiConstants.SndngProcessStatus.SENDING1.getCode();
final String sndngProcessSttus3 = ApiConstants.SndngProcessStatus.SENDING2.getCode();
final List<EnsDTO.SndngMssageParam> list = mapper.selectMakeTgts(reqDTO);
final List<EnsDTO.SndngMssageParam> list2 = mapper.selectMakeTgts(sndngProcessSttus2);
for (EnsDTO.SndngMssageParam dto : list) {
MDC.put(UNITY_SNDNG_MST_ID, dto.getUnitySndngMastrId());
MDC.put(SNDNG_PROCESS_STTUS, "make-fail1");
dto.setSndngProcessSttus(reqDTO.getSndngProcessSttus());
dto.setNewSndngProcessSttus(ApiConstants.SndngProcessStatus.MAKE_OK.getCode());
//FIXME: try1,try2,tr3이 있는 경우 try1 이전에 try2,3이 실행될 수 있는 경우???
dto.setTrySeq(1);
dto.setSndngSeCode(dto.getTry1());
makeMstStatusUpdate(dto);
}
for (EnsDTO.SndngMssageParam dto : list2) {
MDC.put(UNITY_SNDNG_MST_ID, dto.getUnitySndngMastrId());
MDC.put(SNDNG_PROCESS_STTUS, "make-fail2");
//try2 발송 대상이 있는지 확인
final int sendCnt = mapper.selectSendOkTgts(dto);
//없으면 연계 발송 마스터, 통합 발송 마스터 send-ok
if (sendCnt == 0) {
dto.setNewSndngProcessSttus(ApiConstants.SndngProcessStatus.SEND_OK.getCode());
if (mapper.updateProcessSttusCntcSndngMst(dto) != 1) {
throw BizRuntimeException.create("[make]연계 발송 마스터 상태변경 실패");
}
if (mapper.updateProcessSttusUnitySndngMst(dto) != 1) {
throw BizRuntimeException.create("[make]통합 발송 마스터 상태변경 실패");
}
} else {
//있으면 make
dto.setSndngProcessSttus(sndngProcessSttus2);
dto.setNewSndngProcessSttus(ApiConstants.SndngProcessStatus.MAKE_OK.getCode());
dto.setTrySeq(2);
dto.setSndngCo(sendCnt);
dto.setSndngSeCode(dto.getTry2());
makeMstStatusUpdate(dto);
}
}
//TODO:: GS 인증 시험에서 카카오, E-GREEN만 있어서 3단계는 필요 시 구현
}
/**
* make 1. master 2. detail 2. master
*
* <pre>
* make
* 1. : {@link IEnsBatchMapper#insertSndngMst insertSndngMst}
* - tb_ens_sndng_mastr
* 2. : {@link #insertEnsDetailByTry}
* 3.
* 3-1. : {@link IEnsBatchMapper#updateProcessSttusCntcSndngMst}
* 3-2. : {@link IEnsBatchMapper#updateProcessSttusUnitySndngMst}
* @param dto SndngMssageParam
* </pre>
*/
private void makeMstStatusUpdate(EnsDTO.SndngMssageParam dto) {
// 1. master
@ -366,14 +597,25 @@ public class EnsBatchService extends EgovAbstractServiceImpl implements IEnsBatc
}
/**
* make - 2. detail
*
* <pre>
* make :
* - ( ), 1 , 2
* KAKAO - {@link IEnsBatchMapper#insertKakaoMyDocs(Object) insertKakaoMyDocs}
* - tb_ens_kakao_my_doc
* E_GREEN - {@link IEnsBatchMapper#insertPostSndng(Object) insertPostSndng}
* - tb_ens_post_sndng
* SMS - {@link IEnsBatchMapper#insertSmsSndng(Object) insertSmsSndng}
* - tb_ens_sms_sndng
* @param dto SndngMssageParam
* @return int
* </pre>
*/
private int insertEnsDetailByTry(final EnsDTO.SndngMssageParam dto) {
String[] tryVal = {Checks.checkVal(dto.getTry1(), ""), Checks.checkVal(dto.getTry2(), ""),
Checks.checkVal(dto.getTry3(), "")};
String[] tryVal = {
Checks.checkVal(dto.getTry1(), ""),
Checks.checkVal(dto.getTry2(), ""),
Checks.checkVal(dto.getTry3(), "")
};
switch (SndngSeCode.compare(tryVal[dto.getTrySeq() - 1])) {
case KAKAO:
return mapper.insertKakaoMyDocs(dto);
@ -389,60 +631,10 @@ public class EnsBatchService extends EgovAbstractServiceImpl implements IEnsBatc
}
}
//-----------------------------------------------------------------------------------------------------------------
// make
//-----------------------------------------------------------------------------------------------------------------
//-----------------------------------------------------------------------------------------------------------------
// send
//-----------------------------------------------------------------------------------------------------------------
/**
* () send - | E-GREEN | SMS 1. / 2. send()
*
* @param reqDTO BatchEnsRequest
*/
@Override
@Transactional
public void sendBulks(final EnsDTO.BatchEnsRequest reqDTO) {
// 발송/통합발송 마스터에서 대상 조회
final List<EnsDTO.SndngMssageParam> tgtList = mapper.selectSendBulkTgts(reqDTO);
for (EnsDTO.SndngMssageParam tgtDTO : tgtList) {
tgtDTO.setSignguCode(reqDTO.getSignguCode());
tgtDTO.setFfnlgCode(reqDTO.getFfnlgCode());
MDC.put(UNITY_SNDNG_MST_ID, tgtDTO.getUnitySndngMastrId());
MDC.put("sndngMastrId", tgtDTO.getSndngMastrId());
MDC.put(SNDNG_PROCESS_STTUS, "send-fail" + tgtDTO.getTrySeq());
String[] tryVal = {Checks.checkVal(tgtDTO.getTry1(), ""),
Checks.checkVal(tgtDTO.getTry2(), ""), Checks.checkVal(tgtDTO.getTry3(), "")};
// 마스터 상태 변경값을 파라메터에서 받은 상태값으로 set
tgtDTO.setNewSndngProcessSttus(reqDTO.getSndngProcessSttus());
// 업무 문서 구분에 따른 분기
switch (SndngSeCode.compare(tryVal[tgtDTO.getTrySeq() - 1])) {
// 카카오
case KAKAO:
sendBulkKakaoMyDocs(tgtDTO);
break;
// E-GREEN
case E_GREEN:
sendEgreen(tgtDTO);
break;
// SMS
case SMS:
sendSms(tgtDTO);
break;
default:
break;
}
}
}
/**
*
*
@ -849,139 +1041,9 @@ public class EnsBatchService extends EgovAbstractServiceImpl implements IEnsBatc
}
}
}
//-----------------------------------------------------------------------------------------------------------------
// send
//-----------------------------------------------------------------------------------------------------------------
//-----------------------------------------------------------------------------------------------------------------
// status
//-----------------------------------------------------------------------------------------------------------------
/**
* (bulks)
*
* @param reqDTO BatchEnsRequest
*/
@Override
@Transactional
public void findKkoMyDocStatusBulks(final EnsDTO.BatchEnsRequest reqDTO) {
final String url = apiHost + apiBulkStatus;;
final List<String> docsBinderUuids = mapper.selectKakaoStatusTgts(reqDTO.getSndngProcessSttus());
List<List<String>> partitions = ListUtils.partition(docsBinderUuids, bulkMaxCnt);
List<ApiResponseDTO<KkopayDocBulkDTO.BulkStatusResponses>> apiResults = partitions.stream()
.map(uuids ->
ApiResponseDTO.success(
apiWebClient.exchange(
url.toString(),
HttpMethod.POST,
BulkStatusRequests.builder()
.signguCode(reqDTO.getSignguCode())
.ffnlgCode(reqDTO.getFfnlgCode())
.document_binder_uuids(uuids)
.build(),
BulkStatusResponses.class,
getHeadeMap()))
).collect(Collectors.toList());
List<KkopayDocBulkDTO.BulkStatusResponses> resList = apiResults.stream()
.map(ApiResponseDTO::getData)
.collect(Collectors.toList());
// 결과 반영
resList.forEach(o ->
o.getDocuments().forEach(t -> {
mapper.updateKakaoStatusInfo(t);
mapper.updateCntcSndngResult(CntcDTO.SndngResult.builder()
.documentBinderUuid(t.getDocument_binder_uuid())
.sndngResultSttus(StringUtils.defaultString(String.valueOf(t.getStatus_data().getDoc_box_status()), "FAIL"))
.requstDt(Checks.isEmpty(t.getStatus_data().getDoc_box_sent_at())? null: t.getStatus_data().getDoc_box_sent_at().toString())
.inqireDt(Checks.isEmpty(t.getStatus_data().getDoc_box_received_at())? null: t.getStatus_data().getDoc_box_received_at().toString())
.readngDt(Checks.isEmpty(t.getStatus_data().getDoc_box_read_at())? null: t.getStatus_data().getDoc_box_read_at().toString())
.errorCn(t.getError_message())
.build());
})
);
}
//-----------------------------------------------------------------------------------------------------------------
// status
//-----------------------------------------------------------------------------------------------------------------
//-----------------------------------------------------------------------------------------------------------------
// close
//-----------------------------------------------------------------------------------------------------------------
/**
* send-ok close
*
* @param reqDTO BatchEnsRequest
*/
@Override
@Transactional
public void close(final EnsDTO.BatchEnsRequest reqDTO) {
final List<String> list = mapper.selectCloseTgts(reqDTO.getSndngProcessSttus());
// 연계발송 마스터(tb_cntc_sndng_mastr) 상태 변경 : send-ok -> close
for (String id : list) {
EnsDTO.SndngMssageParam paramDTO = EnsDTO.SndngMssageParam.builder()
.unitySndngMastrId(id)
.sndngProcessSttus(reqDTO.getSndngProcessSttus())
.newSndngProcessSttus(ApiConstants.SndngProcessStatus.CLOSE.getCode())
.build();
if (mapper.updateProcessSttusCntcSndngMst(paramDTO) != 1) {
throw BizRuntimeException.create("[close]연계 발송 마스터 상태변경 실패");
}
if (mapper.updateProcessSttusUnitySndngMst(paramDTO) != 1) {
throw BizRuntimeException.create("[close]통합 발송 마스터 상태변경 실패");
}
// 2차 이상 발송 시 발송 마스터가 1개 이상 존재
if (mapper.updateProcessSttusBulkSndngMst(paramDTO) < 1) {
throw BizRuntimeException.create("[close]발송 마스터 상태변경 실패");
}
}
}
//-----------------------------------------------------------------------------------------------------------------
// close
//-----------------------------------------------------------------------------------------------------------------
/**
*
*
* @param dto EnsDTO.SndngMssageParam
*/
public void updateErrorLog(EnsDTO.SndngMssageParam dto) {
if ("SndngAcceptJob".equals(dto.getErrorCode())) {
mapper.updateProcessSttusCntcSndngMst(dto);
} else if ("SndngMakeJob".equals(dto.getErrorCode())) {
mapper.updateProcessSttusCntcSndngMst(dto);
mapper.updateProcessSttusUnitySndngMst(dto);
} else if ("SndngSendBulksJob".equals(dto.getErrorCode())) {
mapper.updateProcessSttusCntcSndngMst(dto);
mapper.updateProcessSttusUnitySndngMst(dto);
mapper.updateProcessSttusSndngMst(dto);
}
}
/**
* (bulks) -
*
* @param reqDTO BatchEnsRequest
* @return List<SendKakaoTgt>
*/
@Override
public List<EnsDTO.SendKakaoTgt> findKakaoSendTargets(final EnsDTO.BatchEnsRequest reqDTO) {
return mapper.selectKakaoSendTgts(reqDTO);
}
private Map<String,String> getHeadeMap(){
Map<String, String> map = new HashMap<>();
map.put(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON_VALUE);
//map.put(HttpHeaders.AUTHORIZATION, "");
return map;
}
}

@ -21,7 +21,7 @@
FROM tb_cntc_sndng_mastr tcsm
JOIN tb_ens_tmplat_manage tetm
ON tcsm.tmplat_id = tetm.tmplat_id
WHERE sndng_process_sttus = #{sndngProcessSttus}
WHERE tcsm.sndng_process_sttus = #{sndngProcessSttus}
</select>
<insert id="insertUnitySndngMst">

@ -149,7 +149,9 @@ public class ApiConstants {
public enum SndngSeCode {
SMS("SMS"),
KAKAO("KKO-MY-DOC"),
E_GREEN("E-GREEN")
E_GREEN("E-GREEN"),
KT_BC("KT-BC"),
PPLUS("POST-PLUS")
;
private final String code;

Loading…
Cancel
Save