From 2a6c5b2f73ff7ab68f2ec2d9cc5537814c57427d Mon Sep 17 00:00:00 2001 From: leebj Date: Thu, 26 Sep 2024 13:58:50 +0900 Subject: [PATCH] =?UTF-8?q?=EA=B5=AD=EB=AF=BC=EC=8B=A0=EB=AC=B8=EA=B3=A0?= =?UTF-8?q?=EC=97=B0=EA=B3=84=EC=9E=90=EB=A3=8C=20=EB=8B=A8=EC=86=8D?= =?UTF-8?q?=EC=9E=90=EB=A3=8C=EB=93=B1=EB=A1=9D=20=EC=B2=98=EB=A6=AC=20?= =?UTF-8?q?=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fims/crdn/service/bean/ImportBean.java | 81 ++++++++++++++----- .../payer/service/bean/PayerServiceBean.java | 4 +- 2 files changed, 63 insertions(+), 22 deletions(-) diff --git a/src/main/java/cokr/xit/fims/crdn/service/bean/ImportBean.java b/src/main/java/cokr/xit/fims/crdn/service/bean/ImportBean.java index b931fea3..c88e3e92 100644 --- a/src/main/java/cokr/xit/fims/crdn/service/bean/ImportBean.java +++ b/src/main/java/cokr/xit/fims/crdn/service/bean/ImportBean.java @@ -2,6 +2,7 @@ package cokr.xit.fims.crdn.service.bean; import java.util.Collections; import java.util.Date; +import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.function.BiFunction; @@ -21,9 +22,9 @@ import cokr.xit.fims.payer.service.bean.PayerBean; import cokr.xit.foundation.component.AbstractBean; import cokr.xit.foundation.data.DataObject; import cokr.xit.foundation.util.DateFormats; -import cokr.xit.interfaces.lvis.service.bean.VehicleInfoBean; +import cokr.xit.interfaces.lvis.service.reg.BasicInfoExtRequest; +import cokr.xit.interfaces.lvis.service.reg.BasicInfoExtResponse; import cokr.xit.interfaces.lvis.service.reg.BasicInfoRequest; -import cokr.xit.interfaces.lvis.service.reg.BasicInfoResponse; import cokr.xit.interfaces.smg.Petition; import cokr.xit.interfaces.smg.dao.SmgMapper; @@ -34,12 +35,13 @@ import cokr.xit.interfaces.smg.dao.SmgMapper; public class ImportBean extends AbstractBean { @Resource(name = "importMapper") private ImportMapper importMapper; + @Resource(name = "smgMapper") private SmgMapper smgMapper; + @Resource(name = "crdnCvlcptMapper") private CrdnCvlcptMapper cvlcptMapper; - @Resource(name = "vehicleInfoBean") - private VehicleInfoBean vehicleInfoBean; + @Resource(name = "payerBean") private PayerBean payerBean; @@ -198,23 +200,62 @@ public class ImportBean extends AbstractBean { * @param basicInfoMap */ private void setVehicleInfo(List crdns, BiFunction getCarModel) { - List reqs = crdns.stream() - .filter(crdn -> !isEmpty(crdn.getVhrno())) - .map(crdn -> { - BasicInfoRequest req = new BasicInfoRequest(); - req.setLevy_stdde(crdn.getCrdnYmd()); - req.setVhrno(crdn.getVhrno()); - req.setSggCd(crdn.getSggCd()); - return req; - }).toList(); - Map payers = payerBean.getVehicleOwners(reqs).stream() - .collect(Collectors.toMap(payer -> payer.getVhrno(), payer -> payer)); - - crdns.forEach(crdn -> { - Payer payer = payers.get(crdn.getVhrno()); + + Map payerMap = new HashMap(); + + if(1 == 1) { //TODO:행공센연계여부 + + List reqs = crdns.stream() + .filter(crdn -> !isEmpty(crdn.getVhrno())) + .map(crdn -> { + BasicInfoExtRequest req = new BasicInfoExtRequest(); + req.setLevy_stdde(crdn.getCrdnYmd()); + req.setVhrno(crdn.getVhrno()); + return req; + }).toList(); + + for(BasicInfoExtRequest req : reqs) { + Payer p = payerBean.getVehicleOwner(new BasicInfoExtRequest()); + crdns.forEach(crdn -> { + if(req.getLevy_stdde().equals(crdn.getCrdnYmd()) + && req.getVhrno().equals(crdn.getVhrno()) + ) { + payerMap.put(crdn.getCrdnYmd()+","+crdn.getVhrno(), p); + } + }); + } + + } else { + List reqs = crdns.stream() + .filter(crdn -> !isEmpty(crdn.getVhrno())) + .map(crdn -> { + BasicInfoRequest req = new BasicInfoRequest(); + req.setLevy_stdde(crdn.getCrdnYmd()); + req.setVhrno(crdn.getVhrno()); + req.setSggCd(crdn.getSggCd()); + return req; + }).toList(); + + + for(BasicInfoRequest req : reqs) { + + Payer p = payerBean.getVehicleOwners(List.of(req)).get(0); + crdns.forEach(crdn -> { + if(req.getLevy_stdde().equals(crdn.getCrdnYmd()) + && req.getVhrno().equals(crdn.getVhrno()) + ) { + payerMap.put(crdn.getCrdnYmd()+","+crdn.getVhrno(), p); + } + }); + } + + } + + for(Crdn crdn : crdns) { + Payer payer = payerMap.get(crdn.getCrdnYmd()+","+crdn.getVhrno()); if (payer == null) return; - BasicInfoResponse.BasicInfo vehicle = payer.getVehicleInfo(); + BasicInfoExtResponse.ExtInfo vehicle = payer.getVehicleInfo(); crdn.setSggCd(payer.getSggCd()); // 시군구 데이터 정리되면 지울 것 if(ifEmpty(vehicle.getErsr_regist_de(), () -> "").equals("")) { crdn.setRtpyrId(""); @@ -227,7 +268,7 @@ public class ImportBean extends AbstractBean { crdn.setUseFuelCd(vehicle.getUse_fuel_code()); crdn.setFfnlgCarmdlCd(getCarModel.apply(vehicle.getVhcty_asort_code(), vehicle.getMxmm_ldg())); crdn.setErsrRegYmd(vehicle.getErsr_regist_de()); - }); + } } public int createCvlcpts(List petitions) { diff --git a/src/main/java/cokr/xit/fims/payer/service/bean/PayerServiceBean.java b/src/main/java/cokr/xit/fims/payer/service/bean/PayerServiceBean.java index ffa89e29..d2d99f15 100644 --- a/src/main/java/cokr/xit/fims/payer/service/bean/PayerServiceBean.java +++ b/src/main/java/cokr/xit/fims/payer/service/bean/PayerServiceBean.java @@ -69,8 +69,8 @@ public class PayerServiceBean extends AbstractServiceBean implements PayerServic @Override public Payer getVehicleOwner(BasicInfoExtRequest req) { - List payers = payerBean.getVehicleOwners(req); - return !payers.isEmpty() ? payers.get(0) : null; + Payer payer = payerBean.getVehicleOwner(req); + return payer; } @Override