|
|
@@ -14,7 +14,8 @@ import cn.com.taiji.core.entity.dict.ass.AssOrderStatus; |
|
|
|
import cn.com.taiji.core.entity.dict.ass.AssOrderStep; |
|
|
|
import cn.com.taiji.core.entity.dict.ass.AssOrderType; |
|
|
|
import cn.com.taiji.core.entity.dict.basic.*; |
|
|
|
import cn.com.taiji.core.entity.dict.issue.OrderType; |
|
|
|
import cn.com.taiji.core.entity.dict.issue.*; |
|
|
|
import cn.com.taiji.core.entity.issue.*; |
|
|
|
import cn.com.taiji.core.entity.user.Staff; |
|
|
|
import cn.com.taiji.core.model.comm.protocol.ats.model.AssOrderChannelNoticeModel; |
|
|
|
import cn.com.taiji.core.model.comm.protocol.ats.model.VehicleChangeModel; |
|
|
@@ -26,6 +27,10 @@ import cn.com.taiji.core.repo.jpa.ass.AssAgencyConfigRepo; |
|
|
|
import cn.com.taiji.core.repo.jpa.ass.AssVehicleInfoChangeRepo; |
|
|
|
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.issue.IssueOrderinfoRepo; |
|
|
|
import cn.com.taiji.core.repo.jpa.issue.IssueProductPayRepo; |
|
|
|
import cn.com.taiji.core.repo.jpa.issue.IssueProductPromotionRepo; |
|
|
|
import cn.com.taiji.core.repo.jpa.issue.IssueProductRepo; |
|
|
|
import cn.com.taiji.ias.dict.DataType; |
|
|
|
import cn.com.taiji.ias.manager.ass.AbstractAssManager; |
|
|
|
import cn.com.taiji.ias.model.ServiceLogEvent; |
|
|
@@ -49,6 +54,14 @@ public class VehicleChangeApplyManager extends AbstractAssManager<VehicleChangeA |
|
|
|
|
|
|
|
@Autowired |
|
|
|
private AssVehicleInfoChangeRepo assVehicleInfoChangeRepo; |
|
|
|
@Autowired |
|
|
|
private IssueProductPayRepo issueProductPayRepo; |
|
|
|
@Autowired |
|
|
|
private IssueOrderinfoRepo issueorderInfoRepo; |
|
|
|
@Autowired |
|
|
|
private IssueProductRepo issueProductRepo; |
|
|
|
@Autowired |
|
|
|
private IssueProductPromotionRepo promotionRepo; |
|
|
|
|
|
|
|
public VehicleChangeApplyManager() { |
|
|
|
super(DataType.VEHICLE_CHANGE_APPLY); |
|
|
@@ -62,6 +75,7 @@ public class VehicleChangeApplyManager extends AbstractAssManager<VehicleChangeA |
|
|
|
private static final String ZC_CARD = "zcCard"; |
|
|
|
private static final String ZC_OBU = "zcOBU"; |
|
|
|
private static final String CHANGE_INFO = "zcCardInfo"; |
|
|
|
private static final String PRODUCT = "product"; |
|
|
|
|
|
|
|
@Autowired |
|
|
|
private AssAgencyConfigRepo agencyConfigRepo; |
|
|
@@ -127,25 +141,9 @@ public class VehicleChangeApplyManager extends AbstractAssManager<VehicleChangeA |
|
|
|
if (cardInfo.getCardId().startsWith("9901")) { |
|
|
|
throw newBusinessException("在中国ETC小程序操作过户/取消订单后再在九州小程序进行新办"); |
|
|
|
} |
|
|
|
//更换车牌,校验新车牌 |
|
|
|
//更换车牌,新车牌相关校验 |
|
|
|
if (req.getOldVehicleId().equals(req.getVehiclePlate()+"_"+req.getVehiclePlateColor())){ |
|
|
|
VehiclePlateCheckResponse res = checkVehiclePlate(req.getVehiclePlate(), req.getVehiclePlateColor()); |
|
|
|
throwBisExceptionOn(res.getResult() != 4, res.getInfo()); |
|
|
|
// 工建行储值卡引导用户到银行线下网点办理。 todo |
|
|
|
AssAgencyConfig agencyConfig = agencyConfigRepo.findByAgencyId(cardInfo.getAgencyId()); |
|
|
|
if (agencyConfig == null) { |
|
|
|
throw newBusinessException("渠道配置信息不存在"); |
|
|
|
} |
|
|
|
if (!agencyConfig.getVehicleChange()) { |
|
|
|
if (SourceType.CHANNEL.equals(req.getOrderSource())){ |
|
|
|
throw newBusinessException("渠道不支持车辆信息变更"); |
|
|
|
}else{ |
|
|
|
if (!hasText(req.getProductId())){ |
|
|
|
throw newBusinessException("需要选择产品办理"); |
|
|
|
} |
|
|
|
} |
|
|
|
// throw newBusinessException(agencyConfig.getDealType() == 1?"渠道不支持车辆信息变更,请注销新办":agencyConfig.getDeviceChangeNotice()); |
|
|
|
} |
|
|
|
validNewCar(req, cardInfo,dataStream); |
|
|
|
dataStream.put(PLATE_CHANGEFLAG, true); |
|
|
|
}else { |
|
|
|
dataStream.put(PLATE_CHANGEFLAG, false); |
|
|
@@ -153,14 +151,44 @@ public class VehicleChangeApplyManager extends AbstractAssManager<VehicleChangeA |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
private void validNewCar(VehicleChangeApllyRequest req, QtkCardInfo cardInfo,Map<String, Object> dataStream) throws ServiceHandleException { |
|
|
|
// 工建行储值卡引导用户到银行线下网点办理。 todo |
|
|
|
AssAgencyConfig agencyConfig = agencyConfigRepo.findByAgencyId(cardInfo.getAgencyId()); |
|
|
|
if (agencyConfig == null) { |
|
|
|
throw newBusinessException("渠道配置信息不存在"); |
|
|
|
} |
|
|
|
if (!agencyConfig.getVehicleChange() && !hasText(req.getProductId())) { |
|
|
|
throw newBusinessException("需要选择产品办理"); |
|
|
|
} |
|
|
|
//校验产品 |
|
|
|
if (hasText(req.getProductId())) { |
|
|
|
IssueProduct product = issueProductRepo.findByReleaseId(req.getProductId()); |
|
|
|
IssueProductPromotion promotion = promotionRepo.findByReleaseId(req.getProductId()); |
|
|
|
if (product == null || promotion == null) { |
|
|
|
throw newBusinessException("当前选择的产品不存在"); |
|
|
|
} |
|
|
|
dataStream.put(PRODUCT, product); |
|
|
|
} |
|
|
|
VehiclePlateCheckResponse res = checkVehiclePlate(req.getVehiclePlate(), req.getVehiclePlateColor()); |
|
|
|
throwBisExceptionOn(res.getResult() != 4, res.getInfo()); |
|
|
|
//校验新车是否开过卡 |
|
|
|
validVehiclePlate(req.getVehiclePlate(), req.getVehiclePlateColor()); |
|
|
|
// 校验车牌是否有老订单 |
|
|
|
checkOldOrder(req.getVehiclePlate(), req.getVehiclePlateColor()); |
|
|
|
//校验本地发行订单 |
|
|
|
IssueOrderinfo order = issueorderInfoRepo.findNormalByVehicleId(req.getVehiclePlate() + "_" + req.getVehiclePlateColor()); |
|
|
|
if (order != null) throw newBusinessException("新车辆存在发行订单,不可办理"); |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
protected void persistInternal(VehicleChangeApllyRequest req, ServiceLogEvent event, Map<String, Object> dataStream) throws ServiceHandleException { |
|
|
|
QtkVehicleInfo vehicleInfo = (QtkVehicleInfo) dataStream.get(VEHICLE_INFO); |
|
|
|
QtkCustomerInfo customerInfo = customerInfoRepo.findByCustomerId(vehicleInfo.getCustomerId()); |
|
|
|
QtkObuInfo qtkObuInfo = (QtkObuInfo) dataStream.get(ZC_OBU); |
|
|
|
QtkCardInfo qtkCardInfo = (QtkCardInfo) dataStream.get(ZC_CARD); |
|
|
|
IssueProduct product = (IssueProduct) dataStream.get(PRODUCT); |
|
|
|
|
|
|
|
//售后表 |
|
|
|
//=====================================================售后表======================================== |
|
|
|
AssOrderinfo order = new AssOrderinfo(); |
|
|
|
LocalDateTime now = LocalDateTime.now(); |
|
|
|
order.setCardId(qtkCardInfo.getCardId()); |
|
|
@@ -198,7 +226,7 @@ public class VehicleChangeApplyManager extends AbstractAssManager<VehicleChangeA |
|
|
|
order.setOpenId(req.getOpenId()); |
|
|
|
} |
|
|
|
|
|
|
|
//车辆信息 |
|
|
|
//=========================================车辆信息====================================================== |
|
|
|
AssVehicleInfoChange changeInfo = new AssVehicleInfoChange(); |
|
|
|
changeInfo.setOrderNo(order.getOrderNo()); |
|
|
|
changeInfo.setChangeType((Boolean) dataStream.get(PLATE_CHANGEFLAG)); |
|
|
@@ -255,7 +283,15 @@ public class VehicleChangeApplyManager extends AbstractAssManager<VehicleChangeA |
|
|
|
//===========申请人结束================= |
|
|
|
changeInfo.setProductId(req.getProductId()); |
|
|
|
changeInfo.setOldType(vehicleInfo.getType()); |
|
|
|
|
|
|
|
if (product != null) { |
|
|
|
changeInfo.setAccountId(product.getAgencyId()); |
|
|
|
changeInfo.setShippingStatus(req.getIsSend()?ShippingStatus.WAIT_SHIPPING:ShippingStatus.NONE); |
|
|
|
changeInfo.setProductId(product.getReleaseId()); |
|
|
|
changeInfo.setProductName(product.getProductName()); |
|
|
|
changeInfo.setAmount(product.getAmount()); |
|
|
|
//创建支付单 |
|
|
|
createPayOrder(order, product); |
|
|
|
} |
|
|
|
//ocr信息比对 |
|
|
|
String failReson = checkOcr(req, dataStream); |
|
|
|
order.setAuditReason(failReson); |
|
|
@@ -266,6 +302,38 @@ public class VehicleChangeApplyManager extends AbstractAssManager<VehicleChangeA |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
private void createPayOrder(AssOrderinfo order, IssueProduct product) { |
|
|
|
List<IssueProductPay> productPays = issueProductPayRepo.findByFeeCategoryAndReleaseId(FeeCategory.HANDLE, product.getReleaseId()); |
|
|
|
// for (IssueProductPay productPay : productPays) { |
|
|
|
// IssueOrderPay orderPay = new IssueOrderPay(); |
|
|
|
// orderPay.setOrderNo(order.getOrderNo()); |
|
|
|
// orderPay.setPayType(OrderPayType.valueOf(productPay.getFeeType())); |
|
|
|
//// orderPay.setPayOrderNo(getPayOrderId(orderPay.getPayType(), order.getAccountId())); |
|
|
|
// orderPay.setPayStatus(OrderPayStatus.UNPAY); |
|
|
|
// Long fee = 0l; |
|
|
|
// switch (orderPay.getPayType()) { |
|
|
|
// case HANDLE: |
|
|
|
// fee = product.getHandleFee(); |
|
|
|
// break; |
|
|
|
// case MARGIN: |
|
|
|
// fee = product.getMarginFee(); |
|
|
|
// break; |
|
|
|
// case PRESTORE: |
|
|
|
// fee = product.getPrestoreFee(); |
|
|
|
// break; |
|
|
|
// case PROCESS: |
|
|
|
// fee = product.getProcessFee(); |
|
|
|
// break; |
|
|
|
// default: |
|
|
|
// break; |
|
|
|
// } |
|
|
|
// payTools.createPayOrder(order.getOrderNo(),OrderType.ISSUE, fee, productPay.getPayConfigId(), req.getH5Type(), order); |
|
|
|
// orderPay.setPayConfigId(productPay.getPayConfigId()); |
|
|
|
//// if (orderPay.getFee() > 0) |
|
|
|
//// orderPays.add(orderPay); |
|
|
|
// } |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
protected void onSuccessInternal(VehicleChangeApllyRequest req, ServiceLogEvent event, Map<String, Object> dataStream) throws ServiceHandleException { |
|
|
|
AssOrderinfo assOrderinfo = (AssOrderinfo) dataStream.get(ORDER); |