|
|
|
@ -9,7 +9,6 @@ import java.util.List;
|
|
|
|
|
import java.util.Map;
|
|
|
|
|
import java.util.Objects;
|
|
|
|
|
import java.util.Set;
|
|
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
import javax.validation.ConstraintViolation;
|
|
|
|
|
import javax.validation.Validation;
|
|
|
|
|
import javax.validation.Validator;
|
|
|
|
@ -36,6 +35,7 @@ import kr.xit.core.model.ApiResponseDTO;
|
|
|
|
|
import kr.xit.core.spring.util.ApiWebClientUtil;
|
|
|
|
|
import kr.xit.core.support.utils.Checks;
|
|
|
|
|
import kr.xit.core.support.utils.DateUtils;
|
|
|
|
|
import kr.xit.core.support.utils.JsonUtils;
|
|
|
|
|
import lombok.RequiredArgsConstructor;
|
|
|
|
|
import org.apache.commons.collections4.ListUtils;
|
|
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
|
@ -348,25 +348,30 @@ public class EnsBatchService extends EgovAbstractServiceImpl implements IEnsBatc
|
|
|
|
|
final List<String> docsBinderUuids = mapper.selectKakaoStatusTgts(reqDTO.getSndngProcessSttus());
|
|
|
|
|
|
|
|
|
|
List<List<String>> partitions = ListUtils.partition(docsBinderUuids, bulkKkoMaxCnt);
|
|
|
|
|
List<ApiResponseDTO<KkopayDocBulkDTO.BulkStatusResponses>> apiResults = partitions.stream()
|
|
|
|
|
.map(uuids ->
|
|
|
|
|
ApiResponseDTO.success(
|
|
|
|
|
apiWebClient.exchange(
|
|
|
|
|
url.toString(),
|
|
|
|
|
List<ApiResponseDTO> apiResults = partitions.stream()
|
|
|
|
|
.map(uuids -> apiWebClient.exchange(
|
|
|
|
|
url,
|
|
|
|
|
HttpMethod.POST,
|
|
|
|
|
BulkStatusRequests.builder()
|
|
|
|
|
.signguCode(reqDTO.getSignguCode())
|
|
|
|
|
.ffnlgCode(reqDTO.getFfnlgCode())
|
|
|
|
|
.document_binder_uuids(uuids)
|
|
|
|
|
.build(),
|
|
|
|
|
BulkStatusResponses.class,
|
|
|
|
|
getHeadeMap()))
|
|
|
|
|
).collect(Collectors.toList());
|
|
|
|
|
ApiResponseDTO.class,
|
|
|
|
|
getHeadeMap())
|
|
|
|
|
).toList();
|
|
|
|
|
|
|
|
|
|
List<BulkStatusResponses> resList = new ArrayList<>();
|
|
|
|
|
|
|
|
|
|
List<KkopayDocBulkDTO.BulkStatusResponses> resList = apiResults.stream()
|
|
|
|
|
.map(ApiResponseDTO::getData)
|
|
|
|
|
.collect(Collectors.toList());
|
|
|
|
|
for(ApiResponseDTO apiResult : apiResults) {
|
|
|
|
|
if(apiResult.getData() != null) {
|
|
|
|
|
BulkStatusResponses data = JsonUtils.toObjByObj(apiResult.getData(),
|
|
|
|
|
BulkStatusResponses.class);
|
|
|
|
|
resList.add(data);
|
|
|
|
|
}else{
|
|
|
|
|
throw BizRuntimeException.create(apiResult.getMessage());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 결과 반영
|
|
|
|
|
resList.forEach(o ->
|
|
|
|
@ -486,12 +491,12 @@ public class EnsBatchService extends EgovAbstractServiceImpl implements IEnsBatc
|
|
|
|
|
for (EnsDTO.sndngVali dto : list) {
|
|
|
|
|
Set<ConstraintViolation<EnsDTO.sndngVali>> errList = validator.validate(dto);
|
|
|
|
|
|
|
|
|
|
if (list.size() > 0) {
|
|
|
|
|
if (!list.isEmpty()) {
|
|
|
|
|
int finalIdx = idx;
|
|
|
|
|
errors.addAll(errList.stream()
|
|
|
|
|
.map(row -> String.format("%s[%d]=%s", row.getPropertyPath(), finalIdx + 1,
|
|
|
|
|
row.getMessageTemplate()))
|
|
|
|
|
.collect(Collectors.toList())
|
|
|
|
|
.toList()
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -571,7 +576,7 @@ public class EnsBatchService extends EgovAbstractServiceImpl implements IEnsBatc
|
|
|
|
|
idx++;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (errors.size() > 0) {
|
|
|
|
|
if (!errors.isEmpty()) {
|
|
|
|
|
throw BizRuntimeException.create(errors.toString());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -726,27 +731,33 @@ public class EnsBatchService extends EgovAbstractServiceImpl implements IEnsBatc
|
|
|
|
|
|
|
|
|
|
List<List<BulkSendReq>> partitions = ListUtils.partition(bulkList, bulkKkoMaxCnt);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
List<ApiResponseDTO<BulkSendResponses>> apiResults = partitions.stream()
|
|
|
|
|
.map(bulkSendList ->
|
|
|
|
|
ApiResponseDTO.success(
|
|
|
|
|
apiWebClient.exchange(
|
|
|
|
|
url.toString(),
|
|
|
|
|
List<ApiResponseDTO> apiResults = partitions.stream()
|
|
|
|
|
.map(bulkSendList -> apiWebClient.exchange(
|
|
|
|
|
url,
|
|
|
|
|
HttpMethod.POST,
|
|
|
|
|
BulkSendRequests.builder()
|
|
|
|
|
.signguCode(tgtDTO.getSignguCode())
|
|
|
|
|
.ffnlgCode(tgtDTO.getFfnlgCode())
|
|
|
|
|
.documents(bulkSendList)
|
|
|
|
|
.build(),
|
|
|
|
|
BulkSendResponses.class,
|
|
|
|
|
getHeadeMap()))
|
|
|
|
|
ApiResponseDTO.class,
|
|
|
|
|
getHeadeMap())
|
|
|
|
|
)
|
|
|
|
|
.collect(Collectors.toList());
|
|
|
|
|
.toList();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
List<BulkSendResponses> resList = new ArrayList<>();
|
|
|
|
|
|
|
|
|
|
// GET 결과 목록
|
|
|
|
|
List<BulkSendResponses> resList = apiResults.stream()
|
|
|
|
|
.map(ApiResponseDTO::getData)
|
|
|
|
|
.collect(Collectors.toList());
|
|
|
|
|
for(ApiResponseDTO apiResult : apiResults) {
|
|
|
|
|
if(apiResult.getData() != null) {
|
|
|
|
|
BulkSendResponses data = JsonUtils.toObjByObj(apiResult.getData(),
|
|
|
|
|
BulkSendResponses.class);
|
|
|
|
|
resList.add(data);
|
|
|
|
|
}else{
|
|
|
|
|
updateKkoMyDocSndngMstFailStatus(mstIdList, apiResult.getMessage());
|
|
|
|
|
throw BizRuntimeException.create(apiResult.getMessage());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 카카오 문서 요청 결과 반영
|
|
|
|
|
requireNewService.saveKkoMyDocResult(mstIdList, tgtDTO.getUnitySndngMastrId(), resList);
|
|
|
|
@ -829,13 +840,13 @@ public class EnsBatchService extends EgovAbstractServiceImpl implements IEnsBatc
|
|
|
|
|
Set<ConstraintViolation<KkopayDocBulkDTO.BulkSendReq>> errList = validator.validate(
|
|
|
|
|
dto);
|
|
|
|
|
|
|
|
|
|
if (list.size() > 0) {
|
|
|
|
|
if (!list.isEmpty()) {
|
|
|
|
|
|
|
|
|
|
int finalIdx = idx;
|
|
|
|
|
errors.addAll(errList.stream()
|
|
|
|
|
.map(row -> String.format("%s[%d]=%s", row.getPropertyPath(), finalIdx + 1,
|
|
|
|
|
row.getMessageTemplate()))
|
|
|
|
|
.collect(Collectors.toList())
|
|
|
|
|
.toList()
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -865,7 +876,7 @@ public class EnsBatchService extends EgovAbstractServiceImpl implements IEnsBatc
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (errors.size() > 0) {
|
|
|
|
|
if (!errors.isEmpty()) {
|
|
|
|
|
throw BizRuntimeException.create(errors.toString());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -942,24 +953,28 @@ public class EnsBatchService extends EgovAbstractServiceImpl implements IEnsBatc
|
|
|
|
|
List<List<KtMainSendReqData>> partitions = ListUtils.partition(sendReqs, bulkKtMaxCnt);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
List<ApiResponseDTO<KtCommonResponse>> apiResults = partitions.stream()
|
|
|
|
|
List<ApiResponseDTO> apiResults = partitions.stream()
|
|
|
|
|
.map(bulkSendList -> {
|
|
|
|
|
infoDto.setReqs(bulkSendList);
|
|
|
|
|
return ApiResponseDTO.success(
|
|
|
|
|
apiWebClient.exchange(
|
|
|
|
|
url.toString(),
|
|
|
|
|
return apiWebClient.exchange(
|
|
|
|
|
url,
|
|
|
|
|
HttpMethod.POST,
|
|
|
|
|
infoDto,
|
|
|
|
|
KtCommonResponse.class,
|
|
|
|
|
getHeadeMap()));
|
|
|
|
|
ApiResponseDTO.class,
|
|
|
|
|
getHeadeMap());
|
|
|
|
|
}
|
|
|
|
|
)
|
|
|
|
|
.collect(Collectors.toList());
|
|
|
|
|
.toList();
|
|
|
|
|
|
|
|
|
|
// GET 결과 목록
|
|
|
|
|
List<KtCommonResponse> resList = apiResults.stream()
|
|
|
|
|
.map(ApiResponseDTO::getData)
|
|
|
|
|
.collect(Collectors.toList());
|
|
|
|
|
List<KtCommonResponse> resList = new ArrayList<>();
|
|
|
|
|
for(ApiResponseDTO apiResult : apiResults) {
|
|
|
|
|
if(apiResult.getData() != null) {
|
|
|
|
|
resList.add(JsonUtils.toObjByObj(apiResult.getData(), KtCommonResponse.class));
|
|
|
|
|
}else{
|
|
|
|
|
//updateKkoMyDocSndngMstFailStatus(mstIdList, apiResult.getMessage());
|
|
|
|
|
throw BizRuntimeException.create(apiResult.getMessage());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 카카오 문서 요청 결과 반영
|
|
|
|
|
//requireNewService.saveKkoMyDocResult(mstIdList, tgtDTO.getUnitySndngMastrId(), resList);
|
|
|
|
|