|
|
@@ -26,6 +26,10 @@ import cn.com.taiji.core.model.comm.protocol.ias.ygz.YgzUserUploadRequest; |
|
|
|
import cn.com.taiji.core.model.comm.protocol.ias.ygz.YgzVehicleUploadRequest; |
|
|
|
import cn.com.taiji.core.model.comm.protocol.inss.inst.InstCallBackRequest; |
|
|
|
import cn.com.taiji.core.model.comm.protocol.inss.inst.InstCallBackResponse; |
|
|
|
import cn.com.taiji.core.model.comm.protocol.ods.oqs.issue.OqsCardQueryRequest; |
|
|
|
import cn.com.taiji.core.model.comm.protocol.ods.oqs.issue.OqsCardQueryResponse; |
|
|
|
import cn.com.taiji.core.model.comm.protocol.ods.oqs.issue.OqsObuQueryRequest; |
|
|
|
import cn.com.taiji.core.model.comm.protocol.ods.oqs.issue.OqsObuQueryResponse; |
|
|
|
import cn.com.taiji.core.model.comm.protocol.valid.GlyServiceError; |
|
|
|
import cn.com.taiji.core.repo.jpa.basic.*; |
|
|
|
import cn.com.taiji.core.repo.jpa.invw.InvwCardDetailsRepo; |
|
|
@@ -153,25 +157,41 @@ public class InstOnlineActiveMananger extends AbstractCallBackManager { |
|
|
|
if (!hasText(vo.getCardId()) || vo.getCardId().length() != 20) { |
|
|
|
throw GlyServiceError.BUSINESS_VALIDATE_ERR.toHandleException("卡号异常"); |
|
|
|
} |
|
|
|
// 重复申请卡 |
|
|
|
QtkCardInfo card = cardInfoRepo.findByCardId(vo.getCardId()); |
|
|
|
if (card != null) { |
|
|
|
throw GlyServiceError.BUSINESS_VALIDATE_ERR.toHandleException("该卡已发行,请先取消原订单后再进行操作"); |
|
|
|
} |
|
|
|
// 用户信息校验 |
|
|
|
QtkCustomerInfo customerInfo = customerInfoRepo.findByCustomerId(vo.getUserId()); |
|
|
|
if (customerInfo == null) { |
|
|
|
throw GlyServiceError.BUSINESS_VALIDATE_ERR.toHandleException("没有开卡人用户信息,请先开户"); |
|
|
|
} |
|
|
|
submitModel.setCustomerInfo(customerInfo); |
|
|
|
// 车辆信息校验 |
|
|
|
List<QtkCardInfo> cardInfoOnVehicles = cardInfoRepo.listByVehicleIdInUse(vo.getVehicleId(), new CardStatus[]{CardStatus.SQ, CardStatus.ZC}); |
|
|
|
if (!isEmpty(cardInfoOnVehicles)) { |
|
|
|
for (QtkCardInfo cardInfoOnVehicle : cardInfoOnVehicles) { |
|
|
|
OqsCardQueryRequest oqsCardQueryRequest = new OqsCardQueryRequest(); |
|
|
|
oqsCardQueryRequest.setCardId(cardInfoOnVehicle.getCardId()); |
|
|
|
OqsCardQueryResponse oqsCardQueryResponse = jsonPostRepeat(oqsCardQueryRequest, 1); |
|
|
|
if (oqsCardQueryResponse.getQtkCardInfo() == null) |
|
|
|
logger.error("老发行库数据同步异常,缺少cardId为{}的数据", cardInfoOnVehicle.getCardId()); |
|
|
|
if (!cardInfoOnVehicle.getCardId().equals(vo.getCardId())) |
|
|
|
throw GlyServiceError.BUSINESS_VALIDATE_ERR.toHandleException("车辆下已存在卡信息"); |
|
|
|
else |
|
|
|
cardInfoRepo.updateCardStatus(oqsCardQueryResponse.getQtkCardInfo().getCardId(), oqsCardQueryResponse.getQtkCardInfo().getCardStatus()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
// 重复申请卡 |
|
|
|
OqsCardQueryRequest oqsCardQueryRequest = new OqsCardQueryRequest(); |
|
|
|
oqsCardQueryRequest.setCardId(vo.getCardId()); |
|
|
|
OqsCardQueryResponse oqsCardQueryResponse = jsonPostRepeat(oqsCardQueryRequest, 1); |
|
|
|
if (oqsCardQueryResponse.getQtkCardInfo() != null && oqsCardQueryResponse.getQtkCardInfo().getCardStatus() == CardStatus.ZC) { |
|
|
|
throw GlyServiceError.BUSINESS_VALIDATE_ERR.toHandleException("该卡[" + vo.getCardId() + "]已发行"); |
|
|
|
} else { |
|
|
|
QtkCardInfo card = cardInfoRepo.findByCardId(vo.getCardId()); |
|
|
|
if (card != null) { |
|
|
|
throw GlyServiceError.BUSINESS_VALIDATE_ERR.toHandleException("该卡已发行,请先取消原订单后再进行操作"); |
|
|
|
} |
|
|
|
} |
|
|
|
// 用户信息校验 |
|
|
|
QtkCustomerInfo customerInfo = customerInfoRepo.findByCustomerId(vo.getUserId()); |
|
|
|
if (customerInfo == null) { |
|
|
|
throw GlyServiceError.BUSINESS_VALIDATE_ERR.toHandleException("没有开卡人用户信息,请先开户"); |
|
|
|
} |
|
|
|
submitModel.setCustomerInfo(customerInfo); |
|
|
|
|
|
|
|
QtkVehicleInfo vehicleInfo = vehicleInfoRepo.findByVehicleId(vo.getVehicleId()); |
|
|
|
if (vehicleInfo == null) |
|
|
|
throw GlyServiceError.BUSINESS_VALIDATE_ERR.toHandleException("没有开卡车辆信息,请先录入."); |
|
|
@@ -202,15 +222,33 @@ public class InstOnlineActiveMananger extends AbstractCallBackManager { |
|
|
|
List<QtkObuInfo> obuInfoOnVehicles = obuInfoRepo.listObuByVehicleIdInUse(vo.getVehicleId(), new ObuStatus[]{ObuStatus.DAZ, ObuStatus.ZC}); |
|
|
|
if (!isEmpty(obuInfoOnVehicles)) { |
|
|
|
for (QtkObuInfo obuInfoOnVehicle : obuInfoOnVehicles) { |
|
|
|
if (!obuInfoOnVehicle.getObuId().equals(vo.getObuId())) |
|
|
|
throw GlyServiceError.BUSINESS_VALIDATE_ERR.toHandleException("车辆下已存在签信息"); |
|
|
|
if (!obuInfoOnVehicle.getObuId().equals(vo.getObuId())) { |
|
|
|
OqsObuQueryRequest oqsObuQueryRequest = new OqsObuQueryRequest(); |
|
|
|
oqsObuQueryRequest.setObuId(obuInfoOnVehicle.getObuId()); |
|
|
|
OqsObuQueryResponse oqsObuQueryResponse = jsonPostRepeat(oqsObuQueryRequest, 1); |
|
|
|
if (oqsObuQueryResponse.getQtkObuInfo() == null) |
|
|
|
logger.error("老发行库数据同步异常,缺少ObuId为{}的数据", obuInfoOnVehicle.getObuId()); |
|
|
|
else if (oqsObuQueryResponse.getQtkObuInfo().getObuStatus() == ObuStatus.ZC) |
|
|
|
throw GlyServiceError.BUSINESS_VALIDATE_ERR.toHandleException("车辆下已存在签信息"); |
|
|
|
else |
|
|
|
obuInfoRepo.updateObuStatus(oqsObuQueryResponse.getQtkObuInfo().getObuId(), oqsObuQueryResponse.getQtkObuInfo().getObuStatus()); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
// 重复申请OBU |
|
|
|
QtkObuInfo obu = obuInfoRepo.findByObuId(vo.getObuId()); |
|
|
|
if (obu != null) { |
|
|
|
throw GlyServiceError.BUSINESS_VALIDATE_ERR.toHandleException("该OBU已完成发行!请先取消原订单后再进行操作"); |
|
|
|
OqsObuQueryRequest oqsObuQueryRequest = new OqsObuQueryRequest(); |
|
|
|
oqsObuQueryRequest.setObuId(vo.getObuId()); |
|
|
|
OqsObuQueryResponse oqsObuQueryResponse = jsonPostRepeat(oqsObuQueryRequest, 1); |
|
|
|
if (oqsObuQueryResponse.getQtkObuInfo() != null && oqsObuQueryResponse.getQtkObuInfo().getObuStatus() == ObuStatus.ZC) { |
|
|
|
throw GlyServiceError.BUSINESS_VALIDATE_ERR.toHandleException("该卡[" + vo.getCardId() + "]已发行"); |
|
|
|
} else { |
|
|
|
QtkObuInfo obu = obuInfoRepo.findByObuId(vo.getObuId()); |
|
|
|
if (obu != null) { |
|
|
|
throw GlyServiceError.BUSINESS_VALIDATE_ERR.toHandleException("该OBU已完成发行!请先取消原订单后再进行操作"); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
QtkCustomerInfo customerInfo = customerInfoRepo.findByCustomerId(vo.getUserId()); |
|
|
|
if (customerInfo == null) |
|
|
|
throw GlyServiceError.BUSINESS_VALIDATE_ERR.toHandleException("没有用户信息,请先开户."); |