@@ -4,7 +4,6 @@ import cn.com.taiji.common.manager.ManagerException; | |||
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.model.comm.protocol.inss.vfj.*; | |||
import cn.com.taiji.core.repo.jpa.basic.QtkCardInfoRepo; | |||
@@ -68,12 +67,20 @@ public class VfjManagerImpl extends AbstractCommManager implements VfjManager { | |||
@Override | |||
public VfjUpgradeDoneResponseDTO handle(VfjUpgradeDoneRequestDTO dto) throws ManagerException { | |||
VfjUpgradeDoneRequest request = new VfjUpgradeDoneRequest(); | |||
copyProperties(dto, request); | |||
VfjUpgradeDoneResponse response = jsonPostRepeat(request); | |||
VfjUpgradeDoneResponseDTO resDto = new VfjUpgradeDoneResponseDTO(); | |||
copyProperties(response, resDto); | |||
return resDto; | |||
for (int i = 0; true; i++) { | |||
try { | |||
VfjUpgradeDoneRequest request = new VfjUpgradeDoneRequest(); | |||
copyProperties(dto, request); | |||
VfjUpgradeDoneResponse response = jsonPostRepeat(request); | |||
VfjUpgradeDoneResponseDTO resDto = new VfjUpgradeDoneResponseDTO(); | |||
copyProperties(response, resDto); | |||
return resDto; | |||
} catch (Exception e) { | |||
if (i >= 2){ | |||
throw e; | |||
} | |||
} | |||
} | |||
} | |||
@Override |
@@ -95,7 +95,7 @@ public abstract class AbstractCallBackManager extends AbstractCommManager implem | |||
private void valid(InstCallBackRequest request, IssueOrderVO vo) throws ServiceHandleException { | |||
logger.info(vo.toJson()); | |||
if (!vo.getLastCos().equals(request.getCmd())) | |||
throw GlyServiceError.FORMAT_VALIDATE_ERR.toHandleException("返回指令信息与指令记录中不一致"); | |||
throw GlyServiceError.BUSINESS_VALIDATE_ERR.toHandleException("返回指令信息与指令记录中不一致"); | |||
String[] cmds = vo.getLastCos().split(","); | |||
String[] cmdResults = request.getCmdResult().split(","); | |||
if (cmds.length != cmdResults.length) { |
@@ -62,7 +62,7 @@ public abstract class AbstractCommandHandler extends AbstractCommManager impleme | |||
private void valid(InstCallBackRequest request, IssueOrderVO vo, VfjCOSRecord cosRecord) throws ServiceHandleException { | |||
if (cosRecord == null) throw GlyServiceError.BUSINESS_VALIDATE_ERR.toHandleException("未查询到指令记录"); | |||
if (!cosRecord.getLastCos().equals(request.getCmd()) || !vo.getLastCos().equals(request.getCmd())) | |||
throw GlyServiceError.FORMAT_VALIDATE_ERR.toHandleException("返回指令信息与指令记录中不一致"); | |||
throw GlyServiceError.BUSINESS_VALIDATE_ERR.toHandleException("返回指令信息与指令记录中不一致"); | |||
String[] cmds = vo.getLastCos().split(","); | |||
String[] cmdResults = request.getCmdResult().split(","); | |||
if (cmds.length != cmdResults.length) { |
@@ -76,6 +76,10 @@ public class InstApplyManager extends RedisCacheManager implements LogManager<In | |||
if (vo.getCardStatus() != CardStatus.ZC) { | |||
vo.setLastCos(InstConstant.GET_CARD_CMD); | |||
} else { | |||
if (!request.getCardId().equals(orderInfo.getCardId())) { | |||
logger.info("激活过程中更换设备:设备CardId:{}.订单CardId:{}", request.getCardId(), orderInfo.getCardId()); | |||
throw GlyServiceError.BUSINESS_VALIDATE_ERR.toHandleException("设备卡号与订单卡号不一致,写卡成功后不能更换设备"); | |||
} | |||
vo.setLastCos(InstConstant.HOME_DIRECTORY); | |||
} | |||
if (!hasText(vo.getCosRecordId())) { | |||
@@ -170,7 +174,7 @@ public class InstApplyManager extends RedisCacheManager implements LogManager<In | |||
AtsChannelNoticeResponse noticeResponse = qdCallUtil.callBackQd(orderInfo, ""); | |||
if (noticeResponse == null) { | |||
throw GlyServiceError.BUSINESS_VALIDATE_ERR.toHandleException("调用渠道接口异常"); | |||
} else if(noticeResponse.getCheckStatus() == 0){ | |||
} else if (noticeResponse.getCheckStatus() == 0) { | |||
logger.info("订单:" + orderInfo.getOrderNo() + "渠道反馈不可激活"); | |||
throw GlyServiceError.BUSINESS_VALIDATE_ERR.toHandleException("渠道反馈不可激活:" + noticeResponse.getFailReason()); | |||
} |
@@ -14,6 +14,7 @@ import cn.com.taiji.core.entity.invw.InvwCardDetails; | |||
import cn.com.taiji.core.entity.invw.InvwObuDetails; | |||
import cn.com.taiji.core.entity.issue.IssueOrderinfo; | |||
import cn.com.taiji.core.entity.issue.IssueProduct; | |||
import cn.com.taiji.core.entity.issue.VfjCOSRecord; | |||
import cn.com.taiji.core.entity.log.InssInterfaceLog; | |||
import cn.com.taiji.core.entity.managew.ActiveRecord; | |||
import cn.com.taiji.core.entity.ygz.DaspOfflineHasSend; | |||
@@ -32,6 +33,7 @@ import cn.com.taiji.core.repo.jpa.invw.InvwCardDetailsRepo; | |||
import cn.com.taiji.core.repo.jpa.invw.InvwObuDetailsRepo; | |||
import cn.com.taiji.core.repo.jpa.issue.IssueOrderinfoRepo; | |||
import cn.com.taiji.core.repo.jpa.issue.IssueProductRepo; | |||
import cn.com.taiji.core.repo.jpa.issue.VfjCOSRecordRepo; | |||
import cn.com.taiji.core.repo.jpa.managew.ActiveRecordRepo; | |||
import cn.com.taiji.core.repo.jpa.ygz.DaspOfflineHasSendRepo; | |||
import cn.com.taiji.inss.config.VfjConfigProperties; | |||
@@ -688,12 +690,14 @@ public class InstOnlineActiveMananger extends AbstractCallBackManager { | |||
@Autowired | |||
protected VfjConfigProperties vfjConfig; | |||
@Autowired | |||
private VfjCOSRecordRepo cosRecordRepo; | |||
@Override | |||
protected boolean needSpecialHandle(InstCallBackRequest request, IssueOrderVO vo) throws ServiceHandleException { | |||
if (request.getStepNo() == 11) { | |||
if (!vo.getLastCos().equals(request.getCmd())) | |||
throw GlyServiceError.FORMAT_VALIDATE_ERR.toHandleException("返回指令信息与指令记录中不一致"); | |||
throw GlyServiceError.BUSINESS_VALIDATE_ERR.toHandleException("返回指令信息与指令记录中不一致"); | |||
String[] cmds = vo.getLastCos().split(","); | |||
String[] cmdResults = request.getCmdResult().split(","); | |||
if (cmds.length != cmdResults.length) { | |||
@@ -707,11 +711,17 @@ public class InstOnlineActiveMananger extends AbstractCallBackManager { | |||
@Override | |||
protected InstCallBackResponse specialHandle(InstCallBackRequest request, IssueOrderVO vo) { | |||
VfjCOSRecord cosRecord = cosRecordRepo.findById(vo.getCosRecordId()).orElse(null); | |||
String cos_pin = COSConstant.pinVertify_second; | |||
String cmd = COSConstant.selectRoot + COSConstant.COS_SEPERATOR + COSConstant.selectDF01 + COSConstant.COS_SEPERATOR | |||
+ COSConstant.read0015 + COSConstant.COS_SEPERATOR + cos_pin + COSConstant.COS_SEPERATOR | |||
+ COSConstant.initializeLoad(vo.getChargeMoney(), vfjConfig.getTerminalId(), vo.getCardVersion()); | |||
vo.setLastCos(cmd); | |||
cosRecord.setLastCos(vo.getLastCos()); | |||
cosRecord.setStepOrder(11); | |||
cosRecord.setUpdateTime(LocalDateTime.now()); | |||
cosRecordRepo.save(cosRecord); | |||
return new InstCallBackResponse().setCmd(cmd).setCmdType(vo.getCmdType()).setStepNo(11).setTransOrderId(request.getTransOrderId()); | |||
} | |||
} |