|
|
@ -4,7 +4,9 @@ import static kr.xit.core.support.utils.JsonUtils.toObjByObj;
|
|
|
|
|
|
|
|
|
|
|
|
import java.util.ArrayList;
|
|
|
|
import java.util.ArrayList;
|
|
|
|
import java.util.Arrays;
|
|
|
|
import java.util.Arrays;
|
|
|
|
|
|
|
|
import java.util.HashMap;
|
|
|
|
import java.util.List;
|
|
|
|
import java.util.List;
|
|
|
|
|
|
|
|
import java.util.Map;
|
|
|
|
import kr.xit.biz.common.ApiConstants;
|
|
|
|
import kr.xit.biz.common.ApiConstants;
|
|
|
|
import kr.xit.biz.common.ApiConstants.SndngSeCode;
|
|
|
|
import kr.xit.biz.common.ApiConstants.SndngSeCode;
|
|
|
|
import kr.xit.biz.ens.cmm.CmmEnsBizUtils;
|
|
|
|
import kr.xit.biz.ens.cmm.CmmEnsBizUtils;
|
|
|
@ -20,6 +22,7 @@ import kr.xit.biz.ens.model.kakao.KkopayDocBulkDTO.BulkStatusResponses;
|
|
|
|
import kr.xit.biz.ens.model.pplus.PplusDTO.PpStatusRequest;
|
|
|
|
import kr.xit.biz.ens.model.pplus.PplusDTO.PpStatusRequest;
|
|
|
|
import kr.xit.biz.ens.model.pplus.PplusDTO.PpStatusResMapping;
|
|
|
|
import kr.xit.biz.ens.model.pplus.PplusDTO.PpStatusResMapping;
|
|
|
|
import kr.xit.biz.ens.model.pplus.PplusDTO.PpStatusResponse;
|
|
|
|
import kr.xit.biz.ens.model.pplus.PplusDTO.PpStatusResponse;
|
|
|
|
|
|
|
|
import kr.xit.biz.ens.model.pplus.PplusDTO.PplusResult;
|
|
|
|
import kr.xit.core.exception.BizRuntimeException;
|
|
|
|
import kr.xit.core.exception.BizRuntimeException;
|
|
|
|
import kr.xit.core.model.ApiResponseDTO;
|
|
|
|
import kr.xit.core.model.ApiResponseDTO;
|
|
|
|
import kr.xit.core.spring.util.ApiWebClientUtil;
|
|
|
|
import kr.xit.core.spring.util.ApiWebClientUtil;
|
|
|
@ -233,6 +236,21 @@ public class EnsBatchStatusService extends EgovAbstractServiceImpl implements IE
|
|
|
|
if("일반".equals(dlvr)){
|
|
|
|
if("일반".equals(dlvr)){
|
|
|
|
if("제작발송완료".equals(processSttus)) resMapDTO.setDlvrSttus("배달");
|
|
|
|
if("제작발송완료".equals(processSttus)) resMapDTO.setDlvrSttus("배달");
|
|
|
|
mapper.updatePplusSndStatus(resMapDTO);
|
|
|
|
mapper.updatePplusSndStatus(resMapDTO);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
List<String> rsltTgts = mapper.selectPplusResultTgtsByUnitySndngMstId(unitySndngMstId);
|
|
|
|
|
|
|
|
rsltTgts.forEach( unitySndngDetailId -> mapper.savePplusCntcSndngResult(
|
|
|
|
|
|
|
|
PplusResult.builder()
|
|
|
|
|
|
|
|
.unitySndngDetailId(unitySndngMstId)
|
|
|
|
|
|
|
|
.signguCode(reqDTO.getSignguCode())
|
|
|
|
|
|
|
|
.ffnlgCode(reqDTO.getFfnlgCode())
|
|
|
|
|
|
|
|
.dlvrSttus(resMapDTO.getDlvrSttus())
|
|
|
|
|
|
|
|
.rgistNo(null)
|
|
|
|
|
|
|
|
.senderData(resDTO.get신청일자())
|
|
|
|
|
|
|
|
.receiveDate(null)
|
|
|
|
|
|
|
|
.build()
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if(Arrays.asList("등기","준등기","익일특급").contains(processSttus)){
|
|
|
|
if(Arrays.asList("등기","준등기","익일특급").contains(processSttus)){
|
|
|
@ -244,7 +262,7 @@ public class EnsBatchStatusService extends EgovAbstractServiceImpl implements IE
|
|
|
|
|
|
|
|
|
|
|
|
// 제작발송완료 -> 종적추적
|
|
|
|
// 제작발송완료 -> 종적추적
|
|
|
|
if("제작발송완료".equals(processSttus)){
|
|
|
|
if("제작발송완료".equals(processSttus)){
|
|
|
|
epostTrace(unitySndngMstId, reqDTO);
|
|
|
|
epostTrace(reqDTO, resDTO);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -262,8 +280,12 @@ public class EnsBatchStatusService extends EgovAbstractServiceImpl implements IE
|
|
|
|
* @param unitySndngMstId
|
|
|
|
* @param unitySndngMstId
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
private void setPostPlusRgistNo(PpStatusResponse resDTO, String unitySndngMstId) {
|
|
|
|
private void setPostPlusRgistNo(PpStatusResponse resDTO, String unitySndngMstId) {
|
|
|
|
if(mapper.selectCountRgistNo(resDTO.get시작등기번호()) == 0) {
|
|
|
|
|
|
|
|
int dlvCnt = Integer.valueOf(resDTO.get발송건수());
|
|
|
|
int dlvCnt = Integer.valueOf(resDTO.get발송건수());
|
|
|
|
|
|
|
|
Map<String,String> pMap = new HashMap<>();
|
|
|
|
|
|
|
|
pMap.put("startRgistNo", resDTO.get시작등기번호());
|
|
|
|
|
|
|
|
pMap.put("endRgistNo", resDTO.get종료등기번호());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(mapper.selectCountRgistNo(pMap) != dlvCnt) {
|
|
|
|
int startRgistNo = Integer.parseInt(resDTO.get시작등기번호());
|
|
|
|
int startRgistNo = Integer.parseInt(resDTO.get시작등기번호());
|
|
|
|
int endRgistNo = Integer.parseInt(resDTO.get종료등기번호());
|
|
|
|
int endRgistNo = Integer.parseInt(resDTO.get종료등기번호());
|
|
|
|
|
|
|
|
|
|
|
@ -286,44 +308,58 @@ public class EnsBatchStatusService extends EgovAbstractServiceImpl implements IE
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private void epostTrace(final String unitySndngMstId, final SndngMssageParam reqDTO){
|
|
|
|
private void epostTrace(final SndngMssageParam reqDTO, final PpStatusResponse resDTO){
|
|
|
|
final List<String> rgistNos = mapper.selectPplusRgistNos(unitySndngMstId);
|
|
|
|
Map<String,String> pMap = new HashMap<>();
|
|
|
|
|
|
|
|
pMap.put("startRgistNo", resDTO.get시작등기번호());
|
|
|
|
|
|
|
|
pMap.put("endRgistNo", resDTO.get종료등기번호());
|
|
|
|
|
|
|
|
final List<PplusResult> lists = mapper.selectPplusUnitySndngDetailIdsByRgistNo(pMap);
|
|
|
|
|
|
|
|
|
|
|
|
//final List<String> rgistNos = List.of("1900472677718","1900472677695");
|
|
|
|
//final List<String> rgistNos = List.of("1900472677718","1900472677695");
|
|
|
|
if(!rgistNos.isEmpty()){
|
|
|
|
if(!lists.isEmpty()){
|
|
|
|
final String url = apiHost + apiEpostTrace;
|
|
|
|
final String url = apiHost + apiEpostTrace;
|
|
|
|
|
|
|
|
|
|
|
|
rgistNos.forEach( rgistNo -> {
|
|
|
|
lists.forEach( dto -> {
|
|
|
|
ApiResponseDTO apiResult = apiWebClient.exchange(
|
|
|
|
ApiResponseDTO apiResult = apiWebClient.exchange(
|
|
|
|
url,
|
|
|
|
url,
|
|
|
|
HttpMethod.POST,
|
|
|
|
HttpMethod.POST,
|
|
|
|
EpostTraceRequest.builder()
|
|
|
|
EpostTraceRequest.builder()
|
|
|
|
.signguCode(reqDTO.getSignguCode())
|
|
|
|
.signguCode(reqDTO.getSignguCode())
|
|
|
|
.ffnlgCode(reqDTO.getFfnlgCode())
|
|
|
|
.ffnlgCode(reqDTO.getFfnlgCode())
|
|
|
|
.rgist(rgistNo)
|
|
|
|
.rgist(dto.getRgistNo())
|
|
|
|
.build(),
|
|
|
|
.build(),
|
|
|
|
ApiResponseDTO.class,
|
|
|
|
ApiResponseDTO.class,
|
|
|
|
CmmEnsBizUtils.getHeadeMap());
|
|
|
|
CmmEnsBizUtils.getHeadeMap());
|
|
|
|
|
|
|
|
|
|
|
|
if(apiResult.getData() != null) {
|
|
|
|
if(apiResult.getData() != null) {
|
|
|
|
final EpostTraceResponse resDTO = JsonUtils.toObjByObj(apiResult.getData(),
|
|
|
|
final EpostTraceResponse epostResDTO = JsonUtils.toObjByObj(apiResult.getData(),
|
|
|
|
EpostTraceResponse.class);
|
|
|
|
EpostTraceResponse.class);
|
|
|
|
//final String unitySndngMstId = resDTO.get연계식별키();
|
|
|
|
//final String unitySndngMstId = resDTO.get연계식별키();
|
|
|
|
System.out.println(""+resDTO);
|
|
|
|
System.out.println(""+epostResDTO);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
dto.setSignguCode(reqDTO.getSignguCode());
|
|
|
|
|
|
|
|
dto.setFfnlgCode(reqDTO.getFfnlgCode());
|
|
|
|
|
|
|
|
|
|
|
|
try{
|
|
|
|
try{
|
|
|
|
assert resDTO != null;
|
|
|
|
assert epostResDTO != null;
|
|
|
|
EpostTraceResTrackInfo traceDTO = resDTO.result();
|
|
|
|
EpostTraceResTrackInfo traceDTO = epostResDTO.result();
|
|
|
|
mapper.updatePplusDlvrStatusFromEPostByRgistNo(traceDTO);
|
|
|
|
mapper.updatePplusDlvrStatusFromEPostByRgistNo(traceDTO);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
dto.setDlvrSttus(traceDTO.getTrackState());
|
|
|
|
|
|
|
|
dto.setSenderData(traceDTO.getSenderData());
|
|
|
|
|
|
|
|
dto.setReceiveDate(traceDTO.getReceiveDate());
|
|
|
|
|
|
|
|
mapper.savePplusCntcSndngResult(dto);
|
|
|
|
|
|
|
|
|
|
|
|
}catch (BizRuntimeException e){
|
|
|
|
}catch (BizRuntimeException e){
|
|
|
|
//TODO :: error 처리 확인 필요
|
|
|
|
//TODO :: error 처리 확인 필요
|
|
|
|
mapper.updatePplusDlvrStatusFromEPostByRgistNo(
|
|
|
|
mapper.updatePplusDlvrStatusFromEPostByRgistNo(
|
|
|
|
EpostTraceResTrackInfo.builder()
|
|
|
|
EpostTraceResTrackInfo.builder()
|
|
|
|
.regiNo(rgistNo)
|
|
|
|
.regiNo(dto.getRgistNo())
|
|
|
|
.trackState(e.getMessage())
|
|
|
|
.trackState(e.getMessage())
|
|
|
|
.build()
|
|
|
|
.build()
|
|
|
|
);
|
|
|
|
);
|
|
|
|
|
|
|
|
dto.setErrorCn(e.getMessage());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
mapper.savePplusCntcSndngResult(dto);
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|