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