|
|
@ -28,6 +28,9 @@ import kr.xit.biz.ens.model.kakao.KkopayDocBulkDTO.BulkSendResponses;
|
|
|
|
import kr.xit.biz.ens.model.kakao.KkopayDocBulkDTO.BulkStatusRequests;
|
|
|
|
import kr.xit.biz.ens.model.kakao.KkopayDocBulkDTO.BulkStatusRequests;
|
|
|
|
import kr.xit.biz.ens.model.kakao.KkopayDocBulkDTO.BulkStatusResponses;
|
|
|
|
import kr.xit.biz.ens.model.kakao.KkopayDocBulkDTO.BulkStatusResponses;
|
|
|
|
import kr.xit.biz.ens.model.kakao.KkopayDocBulkDTO.PropertyBulk;
|
|
|
|
import kr.xit.biz.ens.model.kakao.KkopayDocBulkDTO.PropertyBulk;
|
|
|
|
|
|
|
|
import kr.xit.biz.ens.model.kt.KtCommonDTO.KtCommonResponse;
|
|
|
|
|
|
|
|
import kr.xit.biz.ens.model.kt.KtMmsSendDTO.KtMainSendReqData;
|
|
|
|
|
|
|
|
import kr.xit.biz.ens.model.kt.KtMmsSendDTO.KtMainSendRequest;
|
|
|
|
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;
|
|
|
@ -63,12 +66,16 @@ import org.springframework.transaction.annotation.Transactional;
|
|
|
|
@RequiredArgsConstructor
|
|
|
|
@RequiredArgsConstructor
|
|
|
|
@Service
|
|
|
|
@Service
|
|
|
|
public class EnsBatchService extends EgovAbstractServiceImpl implements IEnsBatchService {
|
|
|
|
public class EnsBatchService extends EgovAbstractServiceImpl implements IEnsBatchService {
|
|
|
|
@Value("${contract.kakao.host}")
|
|
|
|
@Value("${contract.host}")
|
|
|
|
private String apiHost;
|
|
|
|
private String apiHost;
|
|
|
|
@Value("${contract.kakao.api.bulksend}")
|
|
|
|
@Value("${contract.kakao.api.bulksend}")
|
|
|
|
private String apiBulkSend;
|
|
|
|
private String apiKkoBulkSend;
|
|
|
|
@Value("${contract.kakao.api.bulkstatus}")
|
|
|
|
@Value("${contract.kakao.api.bulkstatus}")
|
|
|
|
private String apiBulkStatus;
|
|
|
|
private String apiKkoBulkStatus;
|
|
|
|
|
|
|
|
@Value("${contract.kt.api.bulksend}")
|
|
|
|
|
|
|
|
private String apiKtBcBulkSend;
|
|
|
|
|
|
|
|
@Value("${contract.kt.api.bulkstatus}")
|
|
|
|
|
|
|
|
private String apiKtBcBulkStatus;
|
|
|
|
|
|
|
|
|
|
|
|
private static final String profile = System.getProperty("spring.profiles.active");
|
|
|
|
private static final String profile = System.getProperty("spring.profiles.active");
|
|
|
|
|
|
|
|
|
|
|
@ -80,7 +87,10 @@ public class EnsBatchService extends EgovAbstractServiceImpl implements IEnsBatc
|
|
|
|
.getValidator();
|
|
|
|
.getValidator();
|
|
|
|
|
|
|
|
|
|
|
|
@Value("${contract.kakao.bulk-max-cnt}")
|
|
|
|
@Value("${contract.kakao.bulk-max-cnt}")
|
|
|
|
private int bulkMaxCnt;
|
|
|
|
private int bulkKkoMaxCnt;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Value("${contract.kt.bulk-max-cnt}")
|
|
|
|
|
|
|
|
private int bulkKtMaxCnt;
|
|
|
|
|
|
|
|
|
|
|
|
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";
|
|
|
@ -304,24 +314,15 @@ public class EnsBatchService extends EgovAbstractServiceImpl implements IEnsBatc
|
|
|
|
|
|
|
|
|
|
|
|
// 업무 문서 구분에 따른 분기
|
|
|
|
// 업무 문서 구분에 따른 분기
|
|
|
|
switch (SndngSeCode.compare(tryVal[tgtDTO.getTrySeq() - 1])) {
|
|
|
|
switch (SndngSeCode.compare(tryVal[tgtDTO.getTrySeq() - 1])) {
|
|
|
|
// 카카오
|
|
|
|
case KAKAO -> sendBulkKakaoMyDocs(tgtDTO);
|
|
|
|
case KAKAO:
|
|
|
|
case KT_BC -> sendBulkKtBc(tgtDTO);
|
|
|
|
sendBulkKakaoMyDocs(tgtDTO);
|
|
|
|
case PPLUS -> sendBulkPplus(tgtDTO);
|
|
|
|
break;
|
|
|
|
case E_GREEN -> requireNewService.sendEgreen(tgtDTO);
|
|
|
|
|
|
|
|
case SMS -> requireNewService.sendSms(tgtDTO);
|
|
|
|
// E-GREEN
|
|
|
|
|
|
|
|
case E_GREEN:
|
|
|
|
|
|
|
|
requireNewService.sendEgreen(tgtDTO);
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// SMS
|
|
|
|
|
|
|
|
case SMS:
|
|
|
|
|
|
|
|
requireNewService.sendSms(tgtDTO);
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
throw BizRuntimeException.create(
|
|
|
|
|
|
|
|
String.format("정의 되지 않은 문서 중개자[%s] 입니다", tryVal[tgtDTO.getTrySeq() - 1])
|
|
|
|
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -333,11 +334,11 @@ public class EnsBatchService extends EgovAbstractServiceImpl implements IEnsBatc
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
@Transactional
|
|
|
|
@Transactional
|
|
|
|
public void findKkoMyDocStatusBulks(final EnsDTO.BatchEnsRequest reqDTO) {
|
|
|
|
public void findKkoMyDocStatusBulks(final EnsDTO.BatchEnsRequest reqDTO) {
|
|
|
|
final String url = apiHost + apiBulkStatus;
|
|
|
|
final String url = apiHost + apiKkoBulkStatus;
|
|
|
|
|
|
|
|
|
|
|
|
final List<String> docsBinderUuids = mapper.selectKakaoStatusTgts(reqDTO.getSndngProcessSttus());
|
|
|
|
final List<String> docsBinderUuids = mapper.selectKakaoStatusTgts(reqDTO.getSndngProcessSttus());
|
|
|
|
|
|
|
|
|
|
|
|
List<List<String>> partitions = ListUtils.partition(docsBinderUuids, bulkMaxCnt);
|
|
|
|
List<List<String>> partitions = ListUtils.partition(docsBinderUuids, bulkKkoMaxCnt);
|
|
|
|
List<ApiResponseDTO<KkopayDocBulkDTO.BulkStatusResponses>> apiResults = partitions.stream()
|
|
|
|
List<ApiResponseDTO<KkopayDocBulkDTO.BulkStatusResponses>> apiResults = partitions.stream()
|
|
|
|
.map(uuids ->
|
|
|
|
.map(uuids ->
|
|
|
|
ApiResponseDTO.success(
|
|
|
|
ApiResponseDTO.success(
|
|
|
@ -471,7 +472,7 @@ public class EnsBatchService extends EgovAbstractServiceImpl implements IEnsBatc
|
|
|
|
List<String> errors = new ArrayList<>();
|
|
|
|
List<String> errors = new ArrayList<>();
|
|
|
|
int idx = 0;
|
|
|
|
int idx = 0;
|
|
|
|
|
|
|
|
|
|
|
|
List<List<EnsDTO.sndngVali>> arrList = ListUtils.partition(valiList, bulkMaxCnt);
|
|
|
|
List<List<EnsDTO.sndngVali>> arrList = ListUtils.partition(valiList, bulkKkoMaxCnt);
|
|
|
|
for (List<EnsDTO.sndngVali> list : arrList) {
|
|
|
|
for (List<EnsDTO.sndngVali> list : arrList) {
|
|
|
|
for (EnsDTO.sndngVali dto : list) {
|
|
|
|
for (EnsDTO.sndngVali dto : list) {
|
|
|
|
Set<ConstraintViolation<EnsDTO.sndngVali>> errList = validator.validate(dto);
|
|
|
|
Set<ConstraintViolation<EnsDTO.sndngVali>> errList = validator.validate(dto);
|
|
|
@ -672,8 +673,14 @@ public class EnsBatchService extends EgovAbstractServiceImpl implements IEnsBatc
|
|
|
|
// send
|
|
|
|
// send
|
|
|
|
//-----------------------------------------------------------------------------------------------------------------
|
|
|
|
//-----------------------------------------------------------------------------------------------------------------
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
* <pre>
|
|
|
|
|
|
|
|
* 카카오 문서 send
|
|
|
|
|
|
|
|
* @param tgtDTO SndngMssageParam
|
|
|
|
|
|
|
|
* </pre>
|
|
|
|
|
|
|
|
*/
|
|
|
|
private void sendBulkKakaoMyDocs(final EnsDTO.SndngMssageParam tgtDTO) {
|
|
|
|
private void sendBulkKakaoMyDocs(final EnsDTO.SndngMssageParam tgtDTO) {
|
|
|
|
final String url = apiHost + apiBulkSend;
|
|
|
|
final String url = apiHost + apiKkoBulkSend;
|
|
|
|
|
|
|
|
|
|
|
|
final List<SendKakaoTgt> list = mapper.selectKakaoSendTgts(tgtDTO);
|
|
|
|
final List<SendKakaoTgt> list = mapper.selectKakaoSendTgts(tgtDTO);
|
|
|
|
final List<BulkSendReq> bulkList = new ArrayList<>();
|
|
|
|
final List<BulkSendReq> bulkList = new ArrayList<>();
|
|
|
@ -689,7 +696,7 @@ public class EnsBatchService extends EgovAbstractServiceImpl implements IEnsBatc
|
|
|
|
throw e;
|
|
|
|
throw e;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
List<List<BulkSendReq>> partitions = ListUtils.partition(bulkList, bulkMaxCnt);
|
|
|
|
List<List<BulkSendReq>> partitions = ListUtils.partition(bulkList, bulkKkoMaxCnt);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
List<ApiResponseDTO<BulkSendResponses>> apiResults = partitions.stream()
|
|
|
|
List<ApiResponseDTO<BulkSendResponses>> apiResults = partitions.stream()
|
|
|
@ -788,7 +795,7 @@ public class EnsBatchService extends EgovAbstractServiceImpl implements IEnsBatc
|
|
|
|
List<String> errors = new ArrayList<>();
|
|
|
|
List<String> errors = new ArrayList<>();
|
|
|
|
int idx = 0;
|
|
|
|
int idx = 0;
|
|
|
|
|
|
|
|
|
|
|
|
List<List<BulkSendReq>> arrList = ListUtils.partition(bulkList, bulkMaxCnt);
|
|
|
|
List<List<BulkSendReq>> arrList = ListUtils.partition(bulkList, bulkKkoMaxCnt);
|
|
|
|
for (List<BulkSendReq> list : arrList) {
|
|
|
|
for (List<BulkSendReq> list : arrList) {
|
|
|
|
for (KkopayDocBulkDTO.BulkSendReq dto : list) {
|
|
|
|
for (KkopayDocBulkDTO.BulkSendReq dto : list) {
|
|
|
|
Set<ConstraintViolation<KkopayDocBulkDTO.BulkSendReq>> errList = validator.validate(
|
|
|
|
Set<ConstraintViolation<KkopayDocBulkDTO.BulkSendReq>> errList = validator.validate(
|
|
|
@ -845,6 +852,7 @@ public class EnsBatchService extends EgovAbstractServiceImpl implements IEnsBatc
|
|
|
|
final String stsErrMsg) {
|
|
|
|
final String stsErrMsg) {
|
|
|
|
|
|
|
|
|
|
|
|
for (String id : mstIdList) {
|
|
|
|
for (String id : mstIdList) {
|
|
|
|
|
|
|
|
// FIXME :: stsErrMsg 메세지 확인 필
|
|
|
|
EnsDTO.SndngMssageParam dto = mapper.selectSndProcessStatus(id)
|
|
|
|
EnsDTO.SndngMssageParam dto = mapper.selectSndProcessStatus(id)
|
|
|
|
.orElseThrow(() -> BizRuntimeException.create(stsErrMsg));
|
|
|
|
.orElseThrow(() -> BizRuntimeException.create(stsErrMsg));
|
|
|
|
|
|
|
|
|
|
|
@ -875,8 +883,71 @@ public class EnsBatchService extends EgovAbstractServiceImpl implements IEnsBatc
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
* <pre>
|
|
|
|
|
|
|
|
* KT BC 문서 send
|
|
|
|
|
|
|
|
* @param tgtDTO SndngMssageParam
|
|
|
|
|
|
|
|
* </pre>
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
// TODO :: 구현 필요
|
|
|
|
|
|
|
|
private void sendBulkKtBc(final EnsDTO.SndngMssageParam tgtDTO) {
|
|
|
|
|
|
|
|
final String url = apiHost + apiKtBcBulkSend;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
KtMainSendRequest infoDto = mapper.selectKtBcSendMstTgtInfo(tgtDTO)
|
|
|
|
|
|
|
|
.orElseThrow(() -> BizRuntimeException.create("KT BC 본문자 수신 등록 대상이 존재 하지 않습니다 "));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
List<KtMainSendReqData> sendReqs = mapper.selectKtBcSendTgts(tgtDTO);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
final List<BulkSendReq> bulkList = new ArrayList<>();
|
|
|
|
|
|
|
|
final List<String> mstIdList = new ArrayList<>();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// setKkoMyDocSendBulks(list, bulkList, mstIdList);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// validation check
|
|
|
|
|
|
|
|
// try {
|
|
|
|
|
|
|
|
// validatedKkoMyDocSendBulks(bulkList);
|
|
|
|
|
|
|
|
// } catch (Exception e) {
|
|
|
|
|
|
|
|
// updateKkoMyDocSndngMstFailStatus(mstIdList, "[send]카카오 문서 발송(bulks)요청 실패(파라메터 오류)");
|
|
|
|
|
|
|
|
// throw e;
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
List<List<KtMainSendReqData>> partitions = ListUtils.partition(sendReqs, bulkKtMaxCnt);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
List<ApiResponseDTO<KtCommonResponse>> apiResults = partitions.stream()
|
|
|
|
|
|
|
|
.map(bulkSendList -> {
|
|
|
|
|
|
|
|
infoDto.setReqs(bulkSendList);
|
|
|
|
|
|
|
|
return ApiResponseDTO.success(
|
|
|
|
|
|
|
|
apiWebClient.exchange(
|
|
|
|
|
|
|
|
url.toString(),
|
|
|
|
|
|
|
|
HttpMethod.POST,
|
|
|
|
|
|
|
|
infoDto,
|
|
|
|
|
|
|
|
KtCommonResponse.class,
|
|
|
|
|
|
|
|
getHeadeMap()));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
.collect(Collectors.toList());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// GET 결과 목록
|
|
|
|
|
|
|
|
List<KtCommonResponse> resList = apiResults.stream()
|
|
|
|
|
|
|
|
.map(ApiResponseDTO::getData)
|
|
|
|
|
|
|
|
.collect(Collectors.toList());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 카카오 문서 요청 결과 반영
|
|
|
|
|
|
|
|
//requireNewService.saveKkoMyDocResult(mstIdList, tgtDTO.getUnitySndngMastrId(), resList);
|
|
|
|
|
|
|
|
requireNewService.sendKtBc(tgtDTO);
|
|
|
|
|
|
|
|
}
|
|
|
|
//-----------------------------------------------------------------------------------------------------------------
|
|
|
|
//-----------------------------------------------------------------------------------------------------------------
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
* <pre>
|
|
|
|
|
|
|
|
* KT BC 문서 send
|
|
|
|
|
|
|
|
* @param tgtDTO SndngMssageParam
|
|
|
|
|
|
|
|
* </pre>
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
// TODO:: 구현 필요
|
|
|
|
|
|
|
|
private void sendBulkPplus(final EnsDTO.SndngMssageParam tgtDTO) {
|
|
|
|
|
|
|
|
requireNewService.sendPostPlus(tgtDTO);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|