fix: 카카오 sendBulks, statusBulks 반영

dev
gitea-관리자 1 year ago
parent 443ad51680
commit e29ba6a657

@ -76,11 +76,11 @@ public class CmmEnsFileService extends EgovAbstractServiceImpl implements ICmmEn
@Override
public String fmcExcelUpload(FmcExcelUpload fileReq) {
final Set<ConstraintViolation<FmcExcelUpload>> errors = validator.validate(fileReq);
if (errors.size() > 0) {
if (!errors.isEmpty()) {
throw BizRuntimeException.create(errors.stream()
.map(row -> String.format("%s=%s", row.getPropertyPath(), row.getMessageTemplate()))
.collect(Collectors.toList()).toString());
.toList().toString());
}

@ -254,7 +254,7 @@ public class AsyncKkopayEltrcDocService extends EgovAbstractServiceImpl implemen
errors.add(String.format("문서 식별 번호는 40자를 넘을 수 없습니다[%d번째]", idx+1));
}
}
if(errors.size() > 0) {
if(!errors.isEmpty()) {
throw BizRuntimeException.create(errors.toString());
}
@ -272,14 +272,14 @@ public class AsyncKkopayEltrcDocService extends EgovAbstractServiceImpl implemen
private static <T> List<String> validate(T t, List<String> errList) {
final Set<ConstraintViolation<T>> list = validator.validate(t);
if (list.size() > 0) {
if (!list.isEmpty()) {
List<String> errors = list.stream()
.map(row -> String.format("%s=%s", row.getPropertyPath(), row.getMessageTemplate()))
.collect(Collectors.toList());
.toList();
// 추가적인 유효성 검증이 필요 없는 경우
if(errList == null){
if(errors.size() > 0) throw BizRuntimeException.create(errors.toString());
if(!errors.isEmpty()) throw BizRuntimeException.create(errors.toString());
return null;
}
errList.addAll(errors);

@ -4,11 +4,9 @@ import java.util.ArrayList;
import java.util.List;
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;
import kr.xit.biz.ens.model.cmm.CmmEnsRequestDTO;
import kr.xit.biz.ens.model.cmm.CmmEnsRlaybsnmDTO;
import kr.xit.biz.ens.model.kakao.KkopayDocAttrDTO.DocumentBinderUuid;
@ -109,7 +107,7 @@ public class KkopayEltrcDocService extends EgovAbstractServiceImpl implements
if(Checks.isEmpty(receiver.getPhone_number())) Objects.requireNonNull(errors).add("receiver.phone_number=받는이 전화번호는 필수입니다.");
if(Checks.isEmpty(receiver.getBirthday())) Objects.requireNonNull(errors).add("receiver.birthday=받는이 생년월일은 필수입니다.");
}
if(Objects.requireNonNull(errors).size() > 0) throw BizRuntimeException.create(errors.toString());
if(!Objects.requireNonNull(errors).isEmpty()) throw BizRuntimeException.create(errors.toString());
return webClient.exchangeKko(HOST + API_SEND[0], HttpMethod.valueOf(API_SEND[1]), JsonUtils.toJson(reqDTO), SendResponse.class, getEnsRlaybsnmDTO(reqDTO.getSignguCode(), reqDTO.getFfnlgCode()));
}
@ -189,12 +187,12 @@ public class KkopayEltrcDocService extends EgovAbstractServiceImpl implements
List<BulkSendReq> dtos = reqDTO.getDocuments();
for(int idx = 0; idx < dtos.size(); idx++) {
final Set<ConstraintViolation<BulkSendReq>> list = validator.validate(dtos.get(idx));
if (list.size() > 0) {
if (!list.isEmpty()) {
int finalIdx = idx;
errors.addAll(list.stream()
.map(row -> String.format("%s[%d]=%s", row.getPropertyPath(), finalIdx +1, row.getMessageTemplate()))
.collect(Collectors.toList())
.toList()
);
}
}
@ -223,7 +221,7 @@ public class KkopayEltrcDocService extends EgovAbstractServiceImpl implements
}
}
}
if(errors.size() > 0){
if(!errors.isEmpty()){
throw BizRuntimeException.create(errors.toString());
}
@ -254,7 +252,7 @@ public class KkopayEltrcDocService extends EgovAbstractServiceImpl implements
errors.add(String.format("문서 식별 번호는 40자를 넘을 수 없습니다[%d번째]", idx+1));
}
}
if(errors.size() > 0) {
if(!errors.isEmpty()) {
throw BizRuntimeException.create(errors.toString());
}
return webClient.exchangeKko(HOST + API_BULKSTATUS[0], HttpMethod.valueOf(API_BULKSTATUS[1]), JsonUtils.toJson(reqDTO), BulkStatusResponses.class, getEnsRlaybsnmDTO(reqDTO.getSignguCode(), reqDTO.getFfnlgCode()));
@ -293,14 +291,14 @@ public class KkopayEltrcDocService extends EgovAbstractServiceImpl implements
private static <T> List<String> validate(T t, List<String> errList) {
final Set<ConstraintViolation<T>> list = validator.validate(t);
if(list.size() > 0) {
if(!list.isEmpty()) {
final List<String> errors = list.stream()
.map(row -> String.format("%s=%s", row.getPropertyPath(), row.getMessageTemplate()))
.collect(Collectors.toList());
.toList();
// 추가적인 유효성 검증이 필요 없는 경우
if(errList == null){
if(errors.size() > 0) throw BizRuntimeException.create(errors.toString());
if(!errors.isEmpty()) throw BizRuntimeException.create(errors.toString());
return null;
}
errList.addAll(errors);

@ -150,9 +150,18 @@ public class KkopayEltrcDocController {
* -. .
* </pre>
* @param reqDTO KkopayDocBulkDTO.BulkSendRequests
* @return ApiResponseDTO<BulkStatusResponses.BulkSendResponses>
* @return BulkStatusResponses.BulkSendResponses
*/
@Operation(summary = "대량 문서발송 요청", description = "카카오페이 전자문서 서버로 대량 문서발송 처리를 요청")
/*
@Operation(summary = "대량 문서발송 요청 -> batch sendBulks 에서 호출", description = "카카오페이 전자문서 서버로 대량 문서발송 처리를 요청 -> batch sendBulks 에서 호출")
@PostMapping(value = "/documents/bulk", produces = MediaType.APPLICATION_JSON_VALUE)
public BulkSendResponses requestSendBulk(
@RequestBody final BulkSendRequests reqDTO
) {
return service.requestSendBulk(reqDTO);
}
*/
@Operation(summary = "대량 문서발송 요청 -> batch sendBulks 에서 호출", description = "카카오페이 전자문서 서버로 대량 문서발송 처리를 요청 -> batch sendBulks 에서 호출")
@PostMapping(value = "/documents/bulk", produces = MediaType.APPLICATION_JSON_VALUE)
public IApiResponse requestSendBulk(
@RequestBody final BulkSendRequests reqDTO
@ -166,9 +175,9 @@ public class KkopayEltrcDocController {
* -. .
* </pre>
* @param reqDTO KkopayDocBulkDTO.BulkStatusRequests
* @return ApiResponseDTO<BulkStatusResponses.BulkStatusResponses>
* @return BulkStatusResponses.BulkStatusResponses
*/
@Operation(summary = "대량 문서 상태 조회 요청", description = "카카오페이 전자문서 서버로 대량 문서 상태 조회 요청")
@Operation(summary = "대량 문서 상태 조회 요청 -> batch statusBulks 에서 호출", description = "카카오페이 전자문서 서버로 대량 문서 상태 조회 요청 -> batch statusBulks 에서 호출")
@PostMapping(value = "/documents/bulk/status", produces = MediaType.APPLICATION_JSON_VALUE)
public IApiResponse findBulkStatus(
@RequestBody final BulkStatusRequests reqDTO

@ -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);

@ -140,7 +140,7 @@ public class EnsCctvFileService extends EgovAbstractServiceImpl implements IEnsC
public void acceptEnsNtnccntcSndng() {
List<EnsNtncCntcSndngTgt> tgtList = mapper.selectEnsNtncCntcSndngs();
if(tgtList.size() == 0) return;
if(tgtList.isEmpty()) return;
// search 전자 고지 연계발송 데이타 생성 대상
Optional<EnsNtncCntcSndngTgt> first = tgtList.stream()

@ -138,7 +138,7 @@ public class PniCctvFileService extends EgovAbstractServiceImpl implements IPniC
public void acceptPniNtnccntcSndng() {
List<PniDTO.PniNtncCntcSndngTgts> tgtList = mapper.selectPniNtncCntcSndngs();
if(tgtList.size() == 0) return;
if(tgtList.isEmpty()) return;
// search 사전알림 연계발송 SMS 데이타 생성 대상
Optional<PniDTO.PniNtncCntcSndngTgts> sms = tgtList.stream()

@ -68,7 +68,7 @@ public class CachingConfig {
log.info("Key {} was evicted ({}): {}", key, cause, value))
.build()
))
.collect(Collectors.toList());
.toList();
final SimpleCacheManager cacheManager = new SimpleCacheManager();
cacheManager.setCaches(caffeineCaches);

@ -117,7 +117,7 @@ public class IpMacUtils {
if(inetAddress.getAddress().length == 4) ips.add(inetAddress.getHostAddress().toString());
}
}
return ips.stream().distinct().collect(Collectors.toList());
return ips.stream().distinct().toList();
} catch (SocketException e) {
log.error("{}", e.getLocalizedMessage());
throw BizRuntimeException.create(e.getLocalizedMessage());

@ -114,7 +114,7 @@ public class StreamingRow implements Row {
*/
@Override
public short getFirstCellNum() {
if (cellMap.size() == 0) {
if (cellMap.isEmpty()) {
return -1;
}
return cellMap.firstKey().shortValue();

@ -24,7 +24,7 @@ public class BufferedStringsTable extends SharedStringsTable implements AutoClos
throws IOException {
List<PackagePart> parts = pkg.getPartsByContentType(
XSSFRelation.SHARED_STRINGS.getContentType());
return parts.size() == 0 ? null
return parts.isEmpty() ? null
: new BufferedStringsTable(parts.get(0), tmp, cacheSizeBytes);
}

@ -152,7 +152,7 @@ public class AppInitHelper {
if(inetAddress.getAddress().length == 4) ips.add(inetAddress.getHostAddress().toString());
}
}
return ips.stream().distinct().collect(Collectors.toList());
return ips.stream().distinct().toList();
} catch (SocketException e) {
throw e;
}

Loading…
Cancel
Save