|
|
@@ -2,11 +2,33 @@ package cn.com.taiji.iaw.manager.issue; |
|
|
|
|
|
|
|
import cn.com.taiji.common.manager.ManagerException; |
|
|
|
import cn.com.taiji.common.manager.net.http.ServiceHandleException; |
|
|
|
import cn.com.taiji.common.pub.StringTools; |
|
|
|
import cn.com.taiji.core.entity.basic.QtkCardInfo; |
|
|
|
import cn.com.taiji.core.entity.basic.QtkObuInfo; |
|
|
|
import cn.com.taiji.core.entity.basic.QtkVehicleInfo; |
|
|
|
import cn.com.taiji.core.entity.dict.basic.CardStatus; |
|
|
|
import cn.com.taiji.core.entity.dict.basic.ObuStatus; |
|
|
|
import cn.com.taiji.core.entity.dict.basic.VehicleType; |
|
|
|
import cn.com.taiji.core.entity.dict.ygz.DataSourceEnum; |
|
|
|
import cn.com.taiji.core.model.comm.protocol.ias.vaild.VehiclePlateCheckRequest; |
|
|
|
import cn.com.taiji.core.model.comm.protocol.ias.vaild.VehiclePlateCheckResponse; |
|
|
|
import cn.com.taiji.core.model.comm.protocol.ias.ygz.YgzVehiclePlateCheckRequest; |
|
|
|
import cn.com.taiji.core.model.comm.protocol.ias.ygz.YgzVehiclePlateCheckResponse; |
|
|
|
import cn.com.taiji.core.model.comm.protocol.valid.GlyServiceError; |
|
|
|
import cn.com.taiji.core.repo.jpa.basic.QtkCardInfoRepo; |
|
|
|
import cn.com.taiji.core.repo.jpa.basic.QtkObuInfoRepo; |
|
|
|
import cn.com.taiji.core.repo.jpa.basic.QtkVehicleInfoRepo; |
|
|
|
import cn.com.taiji.iaw.dto.comm.PlateCheckResponse; |
|
|
|
import cn.com.taiji.iaw.dto.comm.VehiclePlateCheckYgzRequestDTO; |
|
|
|
import cn.com.taiji.iaw.manager.AbstractIawManager; |
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
|
|
|
|
import java.util.ArrayList; |
|
|
|
import java.util.List; |
|
|
|
import java.util.Map; |
|
|
|
import java.util.stream.Collectors; |
|
|
|
|
|
|
|
/** |
|
|
|
* @Author:ChenChao |
|
|
|
* @Date:2025/7/9 20:51 |
|
|
@@ -14,20 +36,112 @@ import org.springframework.stereotype.Service; |
|
|
|
* @description: |
|
|
|
*/ |
|
|
|
@Service |
|
|
|
public class PlateCheckManagerImpl extends AbstractIawManager implements PlateCheckManager{ |
|
|
|
public class PlateCheckManagerImpl extends AbstractIawManager implements PlateCheckManager { |
|
|
|
|
|
|
|
@Autowired |
|
|
|
private QtkVehicleInfoRepo vehicleInfoRepo; |
|
|
|
|
|
|
|
@Autowired |
|
|
|
private QtkCardInfoRepo cardInfoRepo; |
|
|
|
|
|
|
|
@Autowired |
|
|
|
private QtkObuInfoRepo obuInfoRepo; |
|
|
|
|
|
|
|
@Override |
|
|
|
public VehiclePlateCheckResponse query(VehiclePlateCheckRequest reqDto) throws ManagerException { |
|
|
|
reqDto.setCustomerId(""); |
|
|
|
VehiclePlateCheckResponse response = null; |
|
|
|
try { |
|
|
|
response = jsonPostRepeat(reqDto); |
|
|
|
}catch (ManagerException e){ |
|
|
|
} catch (ManagerException e) { |
|
|
|
if (e.getMessage().contains("车牌发行校验失败")) { |
|
|
|
throw new ManagerException("请核对车牌号和车牌颜色"); |
|
|
|
}else { |
|
|
|
} else { |
|
|
|
throw e; |
|
|
|
} |
|
|
|
} |
|
|
|
return response; |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public PlateCheckResponse checkYGZ(VehiclePlateCheckYgzRequestDTO req) throws ManagerException { |
|
|
|
// 本地车牌校验 |
|
|
|
PlateCheckResponse res = localPlateCheck(req); |
|
|
|
// 本地没有查询营改增 |
|
|
|
if (res == null) { |
|
|
|
res = new PlateCheckResponse(); |
|
|
|
YgzVehiclePlateCheckRequest plateCheck = new YgzVehiclePlateCheckRequest(); |
|
|
|
plateCheck.setVehiclePlate(req.getVehiclePlate()); |
|
|
|
plateCheck.setVehicleColor(Integer.valueOf(req.getVehiclePlateColor())); |
|
|
|
plateCheck.setVehicleType(Integer.valueOf(req.getVehicleType())); |
|
|
|
plateCheck.setIssueType(Integer.valueOf(req.getReleaseType())); |
|
|
|
plateCheck.setDataSource(DataSourceEnum.DSI_INTERFACE); |
|
|
|
try { |
|
|
|
YgzVehiclePlateCheckResponse response = jsonPostRepeat(plateCheck); |
|
|
|
if(response != null){ |
|
|
|
res.setInfo(response.getInfo()); |
|
|
|
}else { |
|
|
|
res.setInfo("该车牌本省可以发行对应卡/签!"); |
|
|
|
} |
|
|
|
}catch (ManagerException e) { |
|
|
|
throw new ManagerException(e.getMessage()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
res.setMessage(res.getInfo()); |
|
|
|
return res; |
|
|
|
} |
|
|
|
|
|
|
|
private PlateCheckResponse localPlateCheck(VehiclePlateCheckYgzRequestDTO req) throws ManagerException { |
|
|
|
PlateCheckResponse response = new PlateCheckResponse(); |
|
|
|
|
|
|
|
// 查询车辆信息 |
|
|
|
String vehicleId = req.getVehiclePlate() + "_" + req.getVehiclePlateColor(); |
|
|
|
QtkVehicleInfo vehicle = vehicleInfoRepo.findByVehicleId(vehicleId); |
|
|
|
|
|
|
|
if (vehicle == null) { |
|
|
|
return null; |
|
|
|
} |
|
|
|
|
|
|
|
// 验证车辆类型 |
|
|
|
if (vehicle.getType() == null) { |
|
|
|
throw new ManagerException("收费车型为空,请修改车辆信息!"); |
|
|
|
} |
|
|
|
|
|
|
|
if (!String.valueOf(vehicle.getType()).equals(req.getVehicleType())) { |
|
|
|
response.setInfo("收费车型与数据记录不相符"); |
|
|
|
return response; |
|
|
|
} |
|
|
|
|
|
|
|
// 根据releaseType处理不同情况 |
|
|
|
switch (req.getReleaseType()) { |
|
|
|
case "1": |
|
|
|
return checkCard(response, vehicleId); |
|
|
|
case "2": |
|
|
|
return checkObu(response, vehicleId); |
|
|
|
case "0": |
|
|
|
checkCard(response, vehicleId); |
|
|
|
return checkObu(response, vehicleId); |
|
|
|
default: |
|
|
|
return response; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
private PlateCheckResponse checkCard(PlateCheckResponse response, String vehicleId) { |
|
|
|
List<QtkCardInfo> activeCards = cardInfoRepo.listByVehicleIdInUse(vehicleId, new CardStatus[]{CardStatus.ZC, CardStatus.KGS}); |
|
|
|
if (isEmpty(activeCards)) { |
|
|
|
return null; |
|
|
|
} |
|
|
|
response.setInfo("车牌有在用的卡,卡号:"+activeCards.get(0).getCardId()); |
|
|
|
return response; |
|
|
|
} |
|
|
|
|
|
|
|
private PlateCheckResponse checkObu(PlateCheckResponse response, String vehicleId) { |
|
|
|
List<QtkObuInfo> activeObus = obuInfoRepo.listObuByVehicleIdInUse(vehicleId, new ObuStatus[]{ObuStatus.ZC, ObuStatus.BQGS, ObuStatus.YFX}); |
|
|
|
if (isEmpty(activeObus)) { |
|
|
|
return null; |
|
|
|
} |
|
|
|
response.setInfo("车牌有在用的OBU,OBU编号:"+activeObus.get(0).getObuId()); |
|
|
|
return response; |
|
|
|
} |
|
|
|
} |