|
|
@@ -3,12 +3,11 @@ package cn.com.taiji.ias.manager.ass; |
|
|
|
import cn.com.taiji.common.manager.net.http.ServiceHandleException; |
|
|
|
import cn.com.taiji.core.entity.ass.AssOrderinfo; |
|
|
|
import cn.com.taiji.core.entity.ass.AssSignChange; |
|
|
|
import cn.com.taiji.core.entity.basic.QtkCustomerInfo; |
|
|
|
import cn.com.taiji.core.entity.basic.QtkVehicleInfo; |
|
|
|
import cn.com.taiji.core.entity.basic.*; |
|
|
|
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.SourceType; |
|
|
|
import cn.com.taiji.core.entity.dict.basic.*; |
|
|
|
import cn.com.taiji.core.entity.dict.issue.FeeCategory; |
|
|
|
import cn.com.taiji.core.entity.dict.issue.OrderPayType; |
|
|
|
import cn.com.taiji.core.entity.dict.issue.OrderType; |
|
|
@@ -19,6 +18,9 @@ import cn.com.taiji.core.model.comm.protocol.ias.ass.SignChangeApplyRequest; |
|
|
|
import cn.com.taiji.core.model.comm.protocol.ias.ass.SignChangeApplyResponse; |
|
|
|
import cn.com.taiji.core.model.comm.protocol.valid.ErrorMsgBuilder; |
|
|
|
import cn.com.taiji.core.repo.jpa.ass.AssSignChangeRepo; |
|
|
|
import cn.com.taiji.core.repo.jpa.basic.QtkBlackCardRepo; |
|
|
|
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.IssueProductPayRepo; |
|
|
|
import cn.com.taiji.core.repo.jpa.issue.IssueProductRepo; |
|
|
|
import cn.com.taiji.ias.dict.DataType; |
|
|
@@ -28,6 +30,7 @@ import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
import java.io.IOException; |
|
|
|
import java.time.LocalDateTime; |
|
|
|
import java.util.Arrays; |
|
|
|
import java.util.List; |
|
|
|
import java.util.Map; |
|
|
|
|
|
|
@@ -39,18 +42,28 @@ import java.util.Map; |
|
|
|
*/ |
|
|
|
@Service |
|
|
|
public class SignChangeApplyManager extends AbstractAssManager<SignChangeApplyRequest>{ |
|
|
|
|
|
|
|
public SignChangeApplyManager() { |
|
|
|
super(DataType.SIGNCHANGE_APPLY); |
|
|
|
} |
|
|
|
public static final String VEHICLE_INFO = "vehicle"; |
|
|
|
public static final String PRODUCT = "product"; |
|
|
|
public static final String CARD = "card"; |
|
|
|
public static final String OBU = "obu"; |
|
|
|
public static final List<CardBlackType> disableBlackType = Arrays.asList(CardBlackType.OVERDRAW, |
|
|
|
CardBlackType.AGENCY_BLACK, CardBlackType.VEHICLE_TYPE_NOTMATCH,CardBlackType.CARD_BALANCE_INSUFFICIENT); |
|
|
|
|
|
|
|
@Autowired |
|
|
|
private IssueProductRepo issueProductRepo; |
|
|
|
@Autowired |
|
|
|
private IssueProductPayRepo issueProductPayRepo; |
|
|
|
@Autowired |
|
|
|
private AssSignChangeRepo assSignChangeRepo; |
|
|
|
@Autowired |
|
|
|
private QtkCardInfoRepo qtkCardInfoRepo; |
|
|
|
@Autowired |
|
|
|
private QtkObuInfoRepo qtkObuInfoRepo; |
|
|
|
@Autowired |
|
|
|
private QtkBlackCardRepo qtkBlackCardRepo; |
|
|
|
@Override |
|
|
|
protected String getDataId(SignChangeApplyRequest req) { |
|
|
|
return ""; |
|
|
@@ -69,6 +82,7 @@ public class SignChangeApplyManager extends AbstractAssManager<SignChangeApplyRe |
|
|
|
} |
|
|
|
QtkVehicleInfo vehicleInfo = vehicleInfoRepo.findByVehicleId(req.getVehicleId()); |
|
|
|
if (vehicleInfo == null) throw newBusinessException("未找到车辆信息"); |
|
|
|
checkCardAndObu(req, vehicleInfo,dataStream); |
|
|
|
IssueProduct product = issueProductRepo.findByReleaseId(req.getProductId()); |
|
|
|
if (product == null) { |
|
|
|
throw newBusinessException("未找到产品信息"); |
|
|
@@ -80,11 +94,35 @@ public class SignChangeApplyManager extends AbstractAssManager<SignChangeApplyRe |
|
|
|
dataStream.put(PRODUCT, product); |
|
|
|
} |
|
|
|
|
|
|
|
//校验卡签 |
|
|
|
private void checkCardAndObu(SignChangeApplyRequest req, QtkVehicleInfo vehicleInfo,Map<String, Object> dataStream) throws ServiceHandleException { |
|
|
|
List<QtkCardInfo> qtkCardInfos = qtkCardInfoRepo.listByVehicleIdInUse(vehicleInfo.getVehicleId(), new CardStatus[]{CardStatus.ZC, CardStatus.KGS}); |
|
|
|
if (isEmpty(qtkCardInfos)) { |
|
|
|
throw newBusinessException("未找到正常卡信息,不可办理"); |
|
|
|
} |
|
|
|
QtkCardInfo cardInfo = qtkCardInfos.get(0); |
|
|
|
if (CardType.CHARGE_CARD != cardInfo.getCardTypeNew()) { |
|
|
|
throw newBusinessException("非记账卡不可办理"); |
|
|
|
} |
|
|
|
List<QtkBlackCard> qtkBlackCards = qtkBlackCardRepo.listCardBlack(cardInfo.getCardId(), disableBlackType,1); |
|
|
|
if (!isEmpty(qtkBlackCards)) { |
|
|
|
throw newBusinessException("此卡存在黑名单"); |
|
|
|
} |
|
|
|
List<QtkObuInfo> qtkObuInfos = qtkObuInfoRepo.listObuByVehicleIdInUse(req.getVehicleId(),new ObuStatus[]{ObuStatus.ZC,ObuStatus.BQGS,ObuStatus.YFX}); |
|
|
|
if (isEmpty(qtkObuInfos)) { |
|
|
|
throw newBusinessException("未找到正常OBU信息,不可办理"); |
|
|
|
} |
|
|
|
dataStream.put(CARD, cardInfo); |
|
|
|
dataStream.put(OBU, qtkObuInfos.get(0)); |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
protected void persistInternal(SignChangeApplyRequest req, ServiceLogEvent event, Map<String, Object> dataStream) throws ServiceHandleException { |
|
|
|
|
|
|
|
QtkVehicleInfo vehicleInfo = (QtkVehicleInfo) dataStream.get(VEHICLE_INFO); |
|
|
|
IssueProduct product = (IssueProduct) dataStream.get(PRODUCT); |
|
|
|
QtkCardInfo cardInfo = (QtkCardInfo) dataStream.get(CARD); |
|
|
|
QtkObuInfo obuInfo = (QtkObuInfo) dataStream.get(OBU); |
|
|
|
QtkCustomerInfo customerInfo = customerInfoRepo.findByCustomerId(vehicleInfo.getCustomerId()); |
|
|
|
|
|
|
|
//创建售后单 |
|
|
@@ -118,6 +156,9 @@ public class SignChangeApplyManager extends AbstractAssManager<SignChangeApplyRe |
|
|
|
assOrderinfo.setVehicleId(vehicleInfo.getVehicleId()); |
|
|
|
assOrderinfo.setVehiclePlate(vehicleInfo.getVehiclePlate()); |
|
|
|
assOrderinfo.setVehiclePlateColor(vehicleInfo.getVehiclePlateColor()); |
|
|
|
assOrderinfo.setCardId(cardInfo.getCardId()); |
|
|
|
assOrderinfo.setCardType(cardInfo.getCardTypeNew()); |
|
|
|
assOrderinfo.setObuId(obuInfo.getObuId()); |
|
|
|
orderInfoRepo.persist(assOrderinfo); |
|
|
|
dataStream.put(ORDER, assOrderinfo); |
|
|
|
//创建支付单 |