|
|
|
|
@ -38,6 +38,8 @@ public class EPostService {
|
|
|
|
|
private final EpEpostRceptResultRepository epEpostRceptResultRepository;
|
|
|
|
|
private final CpEpostDelivResultRepository cpEpostDelivResultRepository;
|
|
|
|
|
private final EpEpostDelivResultRepository epEpostDelivResultRepository;
|
|
|
|
|
private final CpEPostMakeResultRepository cpEPostMakeResultRepository;
|
|
|
|
|
private final EpEPostMakeResultRepository epEPostMakeResultRepository;
|
|
|
|
|
private final CpEPostSenderDetailRepository cpEPostSenderDetailRepository;
|
|
|
|
|
private final EpEPostSenderDetailRepository epEPostSenderDetailRepository;
|
|
|
|
|
private final CpEPostSenderRegRepository cpEPostSenderRegRepository;
|
|
|
|
|
@ -94,9 +96,9 @@ public class EPostService {
|
|
|
|
|
}
|
|
|
|
|
case "recv" -> {
|
|
|
|
|
if(setInfo.getCpSetinfo() != null)
|
|
|
|
|
cpRecvs.addAll(ePostQueryDslRepository.findRceptResult(cpQueryFactory, e.getResult(), cpDeptCode));
|
|
|
|
|
cpRecvs.addAll(ePostQueryDslRepository.findRecvResult(cpQueryFactory, e.getResult(), cpDeptCode));
|
|
|
|
|
if(setInfo.getEpSetinfo() != null)
|
|
|
|
|
epRecvs.addAll(ePostQueryDslRepository.findRceptResult(epQueryFactory, e.getResult(), cpDeptCode));
|
|
|
|
|
epRecvs.addAll(ePostQueryDslRepository.findRecvResult(epQueryFactory, e.getResult(), cpDeptCode));
|
|
|
|
|
}
|
|
|
|
|
case "prt" -> {
|
|
|
|
|
if(setInfo.getCpSetinfo() != null)
|
|
|
|
|
@ -123,6 +125,12 @@ public class EPostService {
|
|
|
|
|
if (epDelivs != null && !epDelivs.isEmpty()) {
|
|
|
|
|
insertDelivResults(epDelivs, parseResult, "ep");
|
|
|
|
|
}
|
|
|
|
|
if(cpPrts != null && !cpPrts.isEmpty()) {
|
|
|
|
|
insertPrtResults(cpPrts, parseResult, "cp");
|
|
|
|
|
}
|
|
|
|
|
if(epPrts != null && !epPrts.isEmpty()) {
|
|
|
|
|
insertPrtResults(epPrts, parseResult, "ep");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// if (delivs != null && !delivs.isEmpty()) insertDelivResults(delivs);
|
|
|
|
|
// if (prts != null && !prts.isEmpty()) insertPrtResults(prts);
|
|
|
|
|
@ -132,6 +140,68 @@ public class EPostService {
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void insertPrtResults(List<EPostDto.SearchPrtTarget> prts, List<EPostDto.EPostFileRead> parseResults, String dbKind) {
|
|
|
|
|
|
|
|
|
|
//파싱완료한 파일중 prt만 추출
|
|
|
|
|
List<EPostDto.Prt> prtFileResults = parseResults.stream()
|
|
|
|
|
.filter(r -> "prt".equalsIgnoreCase(r.getKind()))
|
|
|
|
|
.flatMap(r -> ((List<EPostDto.Prt>) r.getResult()).stream())
|
|
|
|
|
.collect(Collectors.toList());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//post_proc_stt 업데이트
|
|
|
|
|
prtFileResults.forEach(fileResult -> {
|
|
|
|
|
for(int i = 0; i < prts.size(); i++) {
|
|
|
|
|
// postProcStt 코드 재구성
|
|
|
|
|
prts.get(i).changePostProcStt(prts.get(i).getPostProcStt());
|
|
|
|
|
|
|
|
|
|
//if post_proc_stt가 80보다 작으면 처리상태 변경
|
|
|
|
|
if(Integer.parseInt(prts.get(i).getPostProcStt()) < 80) {
|
|
|
|
|
// gijit 업데이트
|
|
|
|
|
CpGojit cpGojit = CpGojit.builder()
|
|
|
|
|
.tgPostProcStt(prts.get(i).getPostProcStt())
|
|
|
|
|
.tgCode(Long.valueOf(prts.get(i).getTgCode()))
|
|
|
|
|
.build();
|
|
|
|
|
if(dbKind.equals("cp")) cpGojitRepository.save(cpGojit);
|
|
|
|
|
else epGojitRepository.save(cpGojit);
|
|
|
|
|
|
|
|
|
|
// EPOST_SENDER_REG 업데이트
|
|
|
|
|
EpostSenderReg epostSenderReg = EpostSenderReg.builder()
|
|
|
|
|
.postProcStt(prts.get(i).getPostProcStt())
|
|
|
|
|
.conKey(prts.get(i).getConKey())
|
|
|
|
|
.build();
|
|
|
|
|
if(dbKind.equals("cp")) cpEPostSenderRegRepository.save(epostSenderReg);
|
|
|
|
|
else epEPostSenderRegRepository.save(epostSenderReg);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//EPOST_MAKE_RESULT 의 콘키와 등기번호로 조회한 결과가 없으면
|
|
|
|
|
EpostMakeResult epostMakeResult = null;
|
|
|
|
|
if(dbKind.equals("cp")) epostMakeResult = cpEPostMakeResultRepository.findByConkeyAndRgstNmbr();
|
|
|
|
|
else epostMakeResult = cpEPostMakeResultRepository.findByConkeyAndRgstNmbr();
|
|
|
|
|
|
|
|
|
|
//EPOST_MAKE_RESULT 인서트
|
|
|
|
|
if(epostMakeResult == null) {
|
|
|
|
|
EpostMakeResult epostMakeNewResult = EpostMakeResult.builder()
|
|
|
|
|
.conKey(fileResult.getConKey())
|
|
|
|
|
.rgstNmbr(fileResult.getRestNmbr())
|
|
|
|
|
.reletcData(fileResult.getReletcdata())
|
|
|
|
|
.dataCd(fileResult.getDataCd())
|
|
|
|
|
.mailCnt(fileResult.getMailCnt())
|
|
|
|
|
.build();
|
|
|
|
|
|
|
|
|
|
if (dbKind.equals("cp")) cpEPostMakeResultRepository.save(epostMakeNewResult);
|
|
|
|
|
else epEPostMakeResultRepository.save(epostMakeNewResult);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private void insertDelivResults(List<EPostDto.SearchDelivTarget> delivs, List<EPostDto.EPostFileRead> parseResults, String dbKind) {
|
|
|
|
|
|
|
|
|
|
List<CpGojiSendHist> cpGojiSendHists = new ArrayList<>();
|
|
|
|
|
@ -251,6 +321,7 @@ public class EPostService {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private void insertReceiveResults(List<EPostDto.Recv> recvs) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -263,8 +334,7 @@ public class EPostService {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private void insertPrtResults(List<EPostDto.Prt> prts) {}
|
|
|
|
|
private void insertRecvResults(List<EPostDto.Recv> recvs) {}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|