|
|
@@ -2,7 +2,9 @@ package com.qtzl.alterSales.manager.service; |
|
|
|
|
|
|
|
import cn.com.taiji.common.manager.net.http.ServiceHandleException; |
|
|
|
import cn.hutool.core.collection.CollectionUtil; |
|
|
|
import com.qtzl.alterSales.dao.entity.primary.AflBindVehicleInfo; |
|
|
|
import com.qtzl.alterSales.dao.entity.third.EtcOrderUserInfo; |
|
|
|
import com.qtzl.alterSales.dao.repo.jpa.primary.AflBindVehicleInfoRepo; |
|
|
|
import com.qtzl.alterSales.dao.repo.jpa.second.AflCenterVehicleInfoRepo; |
|
|
|
import com.qtzl.alterSales.dao.repo.jpa.third.EtcOrderUserInfoRepo; |
|
|
|
import com.qtzl.alterSales.manager.model.protocol.UcServiceError; |
|
|
@@ -31,6 +33,8 @@ public class EtcOrderUserInfoServiceImpl implements EtcOrderUserInfoService { |
|
|
|
private EtcOrderUserInfoRepo etcOrderUserInfoRepo; |
|
|
|
@Resource |
|
|
|
private AflCenterVehicleInfoRepo aflCenterVehicleInfoRepo; |
|
|
|
@Resource |
|
|
|
private AflBindVehicleInfoRepo aflBindVehicleInfoRepo; |
|
|
|
|
|
|
|
@Override |
|
|
|
public void desensitizationHandler(AflPapersDesensitizationVo desensitizationVo) throws ServiceHandleException { |
|
|
@@ -39,18 +43,34 @@ public class EtcOrderUserInfoServiceImpl implements EtcOrderUserInfoService { |
|
|
|
if (null == orderUserInfo) { |
|
|
|
throw UcServiceError.BUSINESS_VALIDATE_ERR.toHandleException("未获取到对应的订单用户信息"); |
|
|
|
} |
|
|
|
final List<String> userIdNum = aflCenterVehicleInfoRepo.getUserIdNum(desensitizationVo.getPlateNum(), desensitizationVo.getPlateColor()); |
|
|
|
final String newIdNum = getIdNum(desensitizationVo.getPlateNum(), desensitizationVo.getPlateColor(), desensitizationVo.getIdentNo()); |
|
|
|
orderUserInfo.setIdentNo(newIdNum); |
|
|
|
etcOrderUserInfoRepo.save(orderUserInfo); |
|
|
|
} |
|
|
|
|
|
|
|
private String getIdNum(String plateNum, Integer plateColor, String identNo) throws ServiceHandleException { |
|
|
|
// 先查绑定信息 |
|
|
|
final List<AflBindVehicleInfo> vehicleInfoList = aflBindVehicleInfoRepo.findByPlate(plateNum, plateColor); |
|
|
|
if (!CollectionUtil.isEmpty(vehicleInfoList)) { |
|
|
|
for (AflBindVehicleInfo vehicleInfo : vehicleInfoList) { |
|
|
|
final boolean condition = !StringUtils.isEmpty(vehicleInfo.getDriverId()) && vehicleInfo.getDriverId().endsWith(identNo.substring(identNo.lastIndexOf("*") + 1)); |
|
|
|
if (condition) { |
|
|
|
return vehicleInfo.getDriverId(); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
// 再查全量 |
|
|
|
final List<String> userIdNum = aflCenterVehicleInfoRepo.getUserIdNum(plateNum, plateColor); |
|
|
|
if (CollectionUtil.isEmpty(userIdNum)) { |
|
|
|
throw UcServiceError.BUSINESS_VALIDATE_ERR.toHandleException("未获取到每日下载的人车卡签数据,进入下一周期处理"); |
|
|
|
} |
|
|
|
final String newIdNum = userIdNum.stream() |
|
|
|
.filter(idNum -> !StringUtils.isEmpty(idNum) && idNum.endsWith(desensitizationVo.getIdentNo().substring(desensitizationVo.getIdentNo().lastIndexOf("*") + 1))) |
|
|
|
.filter(idNum -> !StringUtils.isEmpty(idNum) && idNum.endsWith(identNo.substring(identNo.lastIndexOf("*") + 1))) |
|
|
|
.findFirst().orElse(null); |
|
|
|
if (StringUtils.isEmpty(newIdNum)) { |
|
|
|
throw UcServiceError.BUSINESS_VALIDATE_ERR.toHandleException("每日下载数据未匹配到对应的证件号"); |
|
|
|
} |
|
|
|
orderUserInfo.setIdentNo(newIdNum); |
|
|
|
etcOrderUserInfoRepo.save(orderUserInfo); |
|
|
|
return newIdNum; |
|
|
|
} |
|
|
|
|
|
|
|
} |