|
|
|
@ -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<Crdn> crdns, BiFunction<String, String, String> getCarModel) {
|
|
|
|
|
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();
|
|
|
|
|
Map<String, Payer> payers = payerBean.getVehicleOwners(reqs).stream()
|
|
|
|
|
.collect(Collectors.toMap(payer -> payer.getVhrno(), payer -> payer));
|
|
|
|
|
|
|
|
|
|
crdns.forEach(crdn -> {
|
|
|
|
|
Payer payer = payers.get(crdn.getVhrno());
|
|
|
|
|
|
|
|
|
|
Map<String, Payer> payerMap = new HashMap<String, Payer>();
|
|
|
|
|
|
|
|
|
|
if(1 == 1) { //TODO:행공센연계여부
|
|
|
|
|
|
|
|
|
|
List<BasicInfoExtRequest> 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<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;
|
|
|
|
|
|
|
|
|
|
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<Petition> petitions) {
|
|
|
|
|