국민신문고연계자료 단속자료등록 처리 수정

main
이범준 2 months ago
parent 0f9dd320c1
commit 2a6c5b2f73

@ -2,6 +2,7 @@ package cokr.xit.fims.crdn.service.bean;
import java.util.Collections; import java.util.Collections;
import java.util.Date; import java.util.Date;
import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.function.BiFunction; 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.component.AbstractBean;
import cokr.xit.foundation.data.DataObject; import cokr.xit.foundation.data.DataObject;
import cokr.xit.foundation.util.DateFormats; 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.BasicInfoRequest;
import cokr.xit.interfaces.lvis.service.reg.BasicInfoResponse;
import cokr.xit.interfaces.smg.Petition; import cokr.xit.interfaces.smg.Petition;
import cokr.xit.interfaces.smg.dao.SmgMapper; import cokr.xit.interfaces.smg.dao.SmgMapper;
@ -34,12 +35,13 @@ import cokr.xit.interfaces.smg.dao.SmgMapper;
public class ImportBean extends AbstractBean { public class ImportBean extends AbstractBean {
@Resource(name = "importMapper") @Resource(name = "importMapper")
private ImportMapper importMapper; private ImportMapper importMapper;
@Resource(name = "smgMapper") @Resource(name = "smgMapper")
private SmgMapper smgMapper; private SmgMapper smgMapper;
@Resource(name = "crdnCvlcptMapper") @Resource(name = "crdnCvlcptMapper")
private CrdnCvlcptMapper cvlcptMapper; private CrdnCvlcptMapper cvlcptMapper;
@Resource(name = "vehicleInfoBean")
private VehicleInfoBean vehicleInfoBean;
@Resource(name = "payerBean") @Resource(name = "payerBean")
private PayerBean payerBean; private PayerBean payerBean;
@ -198,23 +200,62 @@ public class ImportBean extends AbstractBean {
* @param basicInfoMap * @param basicInfoMap
*/ */
private void setVehicleInfo(List<Crdn> crdns, BiFunction<String, String, String> getCarModel) { private void setVehicleInfo(List<Crdn> crdns, BiFunction<String, String, String> getCarModel) {
List<BasicInfoRequest> reqs = crdns.stream()
.filter(crdn -> !isEmpty(crdn.getVhrno())) Map<String, Payer> payerMap = new HashMap<String, Payer>();
.map(crdn -> {
BasicInfoRequest req = new BasicInfoRequest(); if(1 == 1) { //TODO:행공센연계여부
req.setLevy_stdde(crdn.getCrdnYmd());
req.setVhrno(crdn.getVhrno()); List<BasicInfoExtRequest> reqs = crdns.stream()
req.setSggCd(crdn.getSggCd()); .filter(crdn -> !isEmpty(crdn.getVhrno()))
return req; .map(crdn -> {
}).toList(); BasicInfoExtRequest req = new BasicInfoExtRequest();
Map<String, Payer> payers = payerBean.getVehicleOwners(reqs).stream() req.setLevy_stdde(crdn.getCrdnYmd());
.collect(Collectors.toMap(payer -> payer.getVhrno(), payer -> payer)); req.setVhrno(crdn.getVhrno());
return req;
crdns.forEach(crdn -> { }).toList();
Payer payer = payers.get(crdn.getVhrno());
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<BasicInfoRequest> 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; if (payer == null) return;
BasicInfoResponse.BasicInfo vehicle = payer.getVehicleInfo(); BasicInfoExtResponse.ExtInfo vehicle = payer.getVehicleInfo();
crdn.setSggCd(payer.getSggCd()); // 시군구 데이터 정리되면 지울 것 crdn.setSggCd(payer.getSggCd()); // 시군구 데이터 정리되면 지울 것
if(ifEmpty(vehicle.getErsr_regist_de(), () -> "").equals("")) { if(ifEmpty(vehicle.getErsr_regist_de(), () -> "").equals("")) {
crdn.setRtpyrId(""); crdn.setRtpyrId("");
@ -227,7 +268,7 @@ public class ImportBean extends AbstractBean {
crdn.setUseFuelCd(vehicle.getUse_fuel_code()); crdn.setUseFuelCd(vehicle.getUse_fuel_code());
crdn.setFfnlgCarmdlCd(getCarModel.apply(vehicle.getVhcty_asort_code(), vehicle.getMxmm_ldg())); crdn.setFfnlgCarmdlCd(getCarModel.apply(vehicle.getVhcty_asort_code(), vehicle.getMxmm_ldg()));
crdn.setErsrRegYmd(vehicle.getErsr_regist_de()); crdn.setErsrRegYmd(vehicle.getErsr_regist_de());
}); }
} }
public int createCvlcpts(List<Petition> petitions) { public int createCvlcpts(List<Petition> petitions) {

@ -69,8 +69,8 @@ public class PayerServiceBean extends AbstractServiceBean implements PayerServic
@Override @Override
public Payer getVehicleOwner(BasicInfoExtRequest req) { public Payer getVehicleOwner(BasicInfoExtRequest req) {
List<Payer> payers = payerBean.getVehicleOwners(req); Payer payer = payerBean.getVehicleOwner(req);
return !payers.isEmpty() ? payers.get(0) : null; return payer;
} }
@Override @Override

Loading…
Cancel
Save