fix: 마스터테이블 상태변경 반영

- 춘천 전자고지인 경우 춘천 상태값으로
main
Jonguk. Lim 3 months ago
parent fd080516f8
commit 861e49e7b8

@ -1,6 +1,11 @@
package kr.xit.biz.ens.service; package kr.xit.biz.ens.service;
import java.util.List; import java.util.List;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import kr.xit.biz.common.ApiConstants; import kr.xit.biz.common.ApiConstants;
import kr.xit.biz.ens.mapper.IEnsBatchMapper; import kr.xit.biz.ens.mapper.IEnsBatchMapper;
import kr.xit.biz.ens.model.EnsDTO; import kr.xit.biz.ens.model.EnsDTO;
@ -8,9 +13,6 @@ import kr.xit.biz.ens.model.cmm.SndngMssageParam;
import kr.xit.core.exception.BizRuntimeException; import kr.xit.core.exception.BizRuntimeException;
import kr.xit.core.service.AbstractService; import kr.xit.core.service.AbstractService;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
/** /**
* <pre> * <pre>
@ -33,6 +35,11 @@ import org.springframework.transaction.annotation.Transactional;
public class EnsBatchCloseService extends AbstractService implements IEnsBatchCloseService { public class EnsBatchCloseService extends AbstractService implements IEnsBatchCloseService {
private final IEnsBatchMapper mapper; private final IEnsBatchMapper mapper;
/**
*
*/
private static final boolean IS_CCN = ApiConstants.PROFILE.matches(".*-ccn");
/** /**
* send-ok close * send-ok close
* *
@ -51,9 +58,12 @@ public class EnsBatchCloseService extends AbstractService implements IEnsBatchCl
.newSndngProcessSttus(ApiConstants.SndngProcessStatus.CLOSE.getCode()) .newSndngProcessSttus(ApiConstants.SndngProcessStatus.CLOSE.getCode())
.build(); .build();
if(IS_CCN) paramDTO.setNewSndngProcessSttus(ApiConstants.MappingSndngProcessStatus.fromEns(paramDTO.getNewSndngProcessSttus()));
if (mapper.updateProcessSttusCntcSndngMst(paramDTO) != 1) { if (mapper.updateProcessSttusCntcSndngMst(paramDTO) != 1) {
throw BizRuntimeException.create("[close]연계 발송 마스터 상태변경 실패"); throw BizRuntimeException.create("[close]연계 발송 마스터 상태변경 실패");
} }
paramDTO.setNewSndngProcessSttus(ApiConstants.SndngProcessStatus.CLOSE.getCode());
if (mapper.updateProcessSttusUnitySndngMst(paramDTO) != 1) { if (mapper.updateProcessSttusUnitySndngMst(paramDTO) != 1) {
throw BizRuntimeException.create("[close]통합 발송 마스터 상태변경 실패"); throw BizRuntimeException.create("[close]통합 발송 마스터 상태변경 실패");
} }

@ -14,6 +14,7 @@ import org.springframework.transaction.annotation.Transactional;
import kr.xit.batch.ens.task.cmm.TaskCmmUtils; import kr.xit.batch.ens.task.cmm.TaskCmmUtils;
import kr.xit.biz.common.ApiConstants; import kr.xit.biz.common.ApiConstants;
import kr.xit.biz.common.ApiConstants.MappingSndngProcessStatus;
import kr.xit.biz.common.ApiConstants.SndngSeCode; import kr.xit.biz.common.ApiConstants.SndngSeCode;
import kr.xit.biz.ens.mapper.IEnsBatchMapper; import kr.xit.biz.ens.mapper.IEnsBatchMapper;
import kr.xit.biz.ens.model.EnsDTO; import kr.xit.biz.ens.model.EnsDTO;
@ -53,6 +54,11 @@ public class EnsBatchExtractService extends AbstractService implements
private final IEnsBatchMapper mapper; private final IEnsBatchMapper mapper;
/**
*
*/
private static final boolean IS_CCN = ApiConstants.PROFILE.matches(".*-ccn");
//----------------------------------------------------------------------------------------------------------------- //-----------------------------------------------------------------------------------------------------------------
// REQUIRES_NEW service method // REQUIRES_NEW service method
//----------------------------------------------------------------------------------------------------------------- //-----------------------------------------------------------------------------------------------------------------
@ -174,13 +180,22 @@ public class EnsBatchExtractService extends AbstractService implements
*/ */
@Transactional @Transactional
public void updateErrorLog(final SndngMssageParam dto) { public void updateErrorLog(final SndngMssageParam dto) {
final String status = dto.getNewSndngProcessSttus();
if ("SndngAcceptJob".equals(dto.getErrorCode())) { if ("SndngAcceptJob".equals(dto.getErrorCode())) {
if(IS_CCN) dto.setNewSndngProcessSttus(MappingSndngProcessStatus.fromEns(status));
mapper.updateProcessSttusCntcSndngMst(dto); mapper.updateProcessSttusCntcSndngMst(dto);
} else if ("SndngMakeJob".equals(dto.getErrorCode())) { } else if ("SndngMakeJob".equals(dto.getErrorCode())) {
if(IS_CCN) dto.setNewSndngProcessSttus(MappingSndngProcessStatus.fromEns(status));
mapper.updateProcessSttusCntcSndngMst(dto); mapper.updateProcessSttusCntcSndngMst(dto);
dto.setNewSndngProcessSttus(status);
mapper.updateProcessSttusUnitySndngMst(dto); mapper.updateProcessSttusUnitySndngMst(dto);
} else if ("SndngSendBulksJob".equals(dto.getErrorCode())) { } else if ("SndngSendBulksJob".equals(dto.getErrorCode())) {
if(IS_CCN) dto.setNewSndngProcessSttus(MappingSndngProcessStatus.fromEns(status));
mapper.updateProcessSttusCntcSndngMst(dto); mapper.updateProcessSttusCntcSndngMst(dto);
dto.setNewSndngProcessSttus(status);
mapper.updateProcessSttusUnitySndngMst(dto); mapper.updateProcessSttusUnitySndngMst(dto);
mapper.updateProcessSttusSndngMst(dto); mapper.updateProcessSttusSndngMst(dto);
} }
@ -210,9 +225,14 @@ public class EnsBatchExtractService extends AbstractService implements
} }
private void updateMstTable(SndngMssageParam paramDTO, SndngSeCode seCode) { private void updateMstTable(SndngMssageParam paramDTO, SndngSeCode seCode) {
final String status = paramDTO.getNewSndngProcessSttus();
if(IS_CCN) paramDTO.setNewSndngProcessSttus(MappingSndngProcessStatus.fromEns(status));
if(mapper.updateProcessSttusCntcSndngMst(paramDTO) != 1) { if(mapper.updateProcessSttusCntcSndngMst(paramDTO) != 1) {
throw BizRuntimeException.create(String.format("[send-%s]연계 발송 마스터 상태변경 실패", seCode.getCode())); throw BizRuntimeException.create(String.format("[send-%s]연계 발송 마스터 상태변경 실패", seCode.getCode()));
} }
paramDTO.setNewSndngProcessSttus(status);
if(mapper.updateProcessSttusUnitySndngMst(paramDTO) != 1) { if(mapper.updateProcessSttusUnitySndngMst(paramDTO) != 1) {
throw BizRuntimeException.create(String.format("[send-%s]통합 발송 마스터 상태변경 실패", seCode.getCode())); throw BizRuntimeException.create(String.format("[send-%s]통합 발송 마스터 상태변경 실패", seCode.getCode()));
} }

@ -48,6 +48,11 @@ public class EnsBatchMakeService extends AbstractService implements IEnsBatchMak
private static final String SNDNG_PROCESS_STTUS = "sndngProcessSttus"; private static final String SNDNG_PROCESS_STTUS = "sndngProcessSttus";
private static final String UNITY_SNDNG_MST_ID = "unitySndngMastrId"; private static final String UNITY_SNDNG_MST_ID = "unitySndngMastrId";
/**
*
*/
private static final boolean IS_CCN = ApiConstants.PROFILE.matches(".*-ccn");
private final IEnsBatchMapper mapper; private final IEnsBatchMapper mapper;
/** /**
@ -100,11 +105,12 @@ public class EnsBatchMakeService extends AbstractService implements IEnsBatchMak
//없으면 연계 발송 마스터, 통합 발송 마스터 send-ok //없으면 연계 발송 마스터, 통합 발송 마스터 send-ok
if (sendCnt == 0) { if (sendCnt == 0) {
dto.setNewSndngProcessSttus(ApiConstants.SndngProcessStatus.SEND_OK.getCode()); if(IS_CCN) dto.setNewSndngProcessSttus(ApiConstants.MappingSndngProcessStatus.fromEns(dto.getNewSndngProcessSttus()));
if (mapper.updateProcessSttusCntcSndngMst(dto) != 1) { if (mapper.updateProcessSttusCntcSndngMst(dto) != 1) {
throw BizRuntimeException.create("[make]연계 발송 마스터 상태변경 실패"); throw BizRuntimeException.create("[make]연계 발송 마스터 상태변경 실패");
} }
dto.setNewSndngProcessSttus(ApiConstants.SndngProcessStatus.SEND_OK.getCode());
if (mapper.updateProcessSttusUnitySndngMst(dto) != 1) { if (mapper.updateProcessSttusUnitySndngMst(dto) != 1) {
throw BizRuntimeException.create("[make]통합 발송 마스터 상태변경 실패"); throw BizRuntimeException.create("[make]통합 발송 마스터 상태변경 실패");
} }
@ -153,9 +159,11 @@ public class EnsBatchMakeService extends AbstractService implements IEnsBatchMak
} }
// 3. status // 3. status
if(IS_CCN) dto.setNewSndngProcessSttus(ApiConstants.MappingSndngProcessStatus.fromEns(dto.getNewSndngProcessSttus()));
if (mapper.updateProcessSttusCntcSndngMst(dto) != 1) { if (mapper.updateProcessSttusCntcSndngMst(dto) != 1) {
throw BizRuntimeException.create("[make]데이타 생성(발송마스터 상태변경) 실패"); throw BizRuntimeException.create("[make]데이타 생성(발송마스터 상태변경) 실패");
} }
dto.setNewSndngProcessSttus(ApiConstants.SndngProcessStatus.MAKE_OK.getCode());
if (mapper.updateProcessSttusUnitySndngMst(dto) != 1) { if (mapper.updateProcessSttusUnitySndngMst(dto) != 1) {
throw BizRuntimeException.create("[make]데이타 생성(통합발송마스터 상태변경) 실패"); throw BizRuntimeException.create("[make]데이타 생성(통합발송마스터 상태변경) 실패");
} }

@ -66,7 +66,7 @@ public class EnsBatchController {
@Content(mediaType = "application/json", examples = { @Content(mediaType = "application/json", examples = {
@ExampleObject(value = """ @ExampleObject(value = """
{ {
"signguCode": "88328", "signguCode": "51110",
"ffnlgCode": "11", "ffnlgCode": "11",
"sndngProcessSttus": "send-ok" "sndngProcessSttus": "send-ok"
} }
@ -85,7 +85,7 @@ public class EnsBatchController {
@Content(mediaType = "application/json", examples = { @Content(mediaType = "application/json", examples = {
@ExampleObject(value = """ @ExampleObject(value = """
{ {
"signguCode": "88328", "signguCode": "51110",
"ffnlgCode": "11", "ffnlgCode": "11",
"sndngProcessSttus": "send-ok" "sndngProcessSttus": "send-ok"
} }

Loading…
Cancel
Save