Selaa lähdekoodia

修复BUG

master
梁超 5 päivää sitten
vanhempi
commit
706b457a90

+ 4
- 0
gly-base-core/src/main/java/cn/com/taiji/core/repo/jpa/issue/CsmsnConsigneeRepo.java Näytä tiedosto

@@ -2,6 +2,7 @@ package cn.com.taiji.core.repo.jpa.issue;

import cn.com.taiji.common.repo.jpa.AbstractJpaRepo;
import cn.com.taiji.core.entity.issue.CsmsnConsignee;
import cn.com.taiji.core.entity.issue.IssueOrderinfoExt;

/**
* @Author:ChenChao
@@ -10,4 +11,7 @@ import cn.com.taiji.core.entity.issue.CsmsnConsignee;
* @description:
*/
public interface CsmsnConsigneeRepo extends AbstractJpaRepo<CsmsnConsignee, String> {

CsmsnConsignee findByObuId(String obuId);

}

+ 46
- 11
zhywpt-service-inss/src/main/java/cn/com/taiji/inss/manager/inst/InstApplyManager.java Näytä tiedosto

@@ -10,7 +10,9 @@ import cn.com.taiji.core.entity.dict.issue.IssueOrderStep;
import cn.com.taiji.core.entity.invw.InvwCardDetails;
import cn.com.taiji.core.entity.invw.InvwObuDetails;
import cn.com.taiji.core.entity.invw.InvwWarehouse;
import cn.com.taiji.core.entity.issue.CsmsnConsignee;
import cn.com.taiji.core.entity.issue.IssueOrderinfo;
import cn.com.taiji.core.entity.issue.IssueOrderinfoExt;
import cn.com.taiji.core.entity.issue.VfjCOSRecord;
import cn.com.taiji.core.entity.log.InssInterfaceLog;
import cn.com.taiji.core.manager.cache.RedisCacheManager;
@@ -23,6 +25,8 @@ import cn.com.taiji.core.model.comm.protocol.valid.GlyServiceError;
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.invw.InvwWarehouseRepo;
import cn.com.taiji.core.repo.jpa.issue.CsmsnConsigneeRepo;
import cn.com.taiji.core.repo.jpa.issue.IssueOrderinfoExtRepo;
import cn.com.taiji.core.repo.jpa.issue.IssueOrderinfoRepo;
import cn.com.taiji.core.repo.jpa.issue.VfjCOSRecordRepo;
import cn.com.taiji.core.repo.jpa.log.InssInterfaceLogRepo;
@@ -42,6 +46,8 @@ public class InstApplyManager extends RedisCacheManager implements LogManager<In
@Autowired
private IssueOrderinfoRepo orderInfoRepo;
@Autowired
private IssueOrderinfoExtRepo orderinfoExtRepo;
@Autowired
private InvwCardDetailsRepo cardDetailsRepo;
@Autowired
private InvwObuDetailsRepo obuDetailsRepo;
@@ -53,6 +59,8 @@ public class InstApplyManager extends RedisCacheManager implements LogManager<In
private QdCallUtil qdCallUtil;
@Autowired
private VfjCOSRecordRepo cosRecordRepo;
@Autowired
private CsmsnConsigneeRepo csmsnConsigneeRepo;

public InstApplyResponse serviceHandle(InstApplyRequest request) throws ServiceHandleException {
try {
@@ -73,14 +81,10 @@ public class InstApplyManager extends RedisCacheManager implements LogManager<In
vo.setObuId(request.getObuId());
vo.setCardVersion(request.getCardVersion());
vo.setObuVersion(request.getObuVersion());
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("设备卡号与订单卡号不一致,写卡成功后不能更换设备");
}
if (vo.getCardStatus() == CardStatus.ZC) {
vo.setLastCos(InstConstant.HOME_DIRECTORY);
} else {
vo.setLastCos(InstConstant.GET_CARD_CMD);
}
if (!hasText(vo.getCosRecordId())) {
VfjCOSRecord record = new VfjCOSRecord();
@@ -93,7 +97,7 @@ public class InstApplyManager extends RedisCacheManager implements LogManager<In
vo.setCosRecordId(record.getId());
}
redisManager.set(MyFinals.ISSUE_KEY + transOrderId, vo.toJson(), 300000, TimeUnit.SECONDS);
return onSuccess(request, new InstApplyResponse(vo.getCardStatus() != CardStatus.ZC ? 1 : 9, vo.getLastCos(),
return onSuccess(request, new InstApplyResponse(vo.getCardStatus() == CardStatus.ZC ? 9 : 1, vo.getLastCos(),
CmdType.CARD.value(), transOrderId), InssInterfaceLog.class, System.currentTimeMillis() - begin);
} catch (Exception e) {
logger.error("激活异常", e);
@@ -126,7 +130,6 @@ public class InstApplyManager extends RedisCacheManager implements LogManager<In
throw GlyServiceError.BUSINESS_VALIDATE_ERR.toHandleException("卡设备串货");
}
}

// 签库存
InvwObuDetails obuDetail = obuDetailsRepo.findBy(req.getObuId());
if (obuDetail == null) {
@@ -150,7 +153,6 @@ public class InstApplyManager extends RedisCacheManager implements LogManager<In
if (cardVersion != obuVersion) {
throw GlyServiceError.BUSINESS_VALIDATE_ERR.toHandleException("卡和OBU版本不一致");
}

// 卡类型校验
String realCardTypeStr = req.getCardId().substring(8, 10);
switch (orderInfo.getCardType()) {
@@ -166,7 +168,39 @@ public class InstApplyManager extends RedisCacheManager implements LogManager<In
default:
throw GlyServiceError.BUSINESS_VALIDATE_ERR.toHandleException("未知卡类型");
}

// 卡激活成功后不能更换设备再激活
if (orderInfo.getCardStatus() == CardStatus.ZC) {
logger.info("request cardId:{}, orderInfo cardId:{}", req.getCardId(), orderInfo.getCardId());
if (!req.getCardId().equals(orderInfo.getCardId())) {
logger.info("激活过程中更换设备:设备CardId:{}.订单CardId:{}", req.getCardId(), orderInfo.getCardId());
throw GlyServiceError.BUSINESS_VALIDATE_ERR.toHandleException("设备卡号与订单保存卡号不一致,写卡成功后不能更换设备");
}
}
// 货车和专项作业车不能发行单片式OBU
if (orderInfo.getVanType() == 2) {
if (req.getCardVersion() == 48 || req.getCardVersion() == 52)
throw GlyServiceError.BUSINESS_VALIDATE_ERR.toHandleException("货车不能发行单片式OBU");
if (req.getObuVersion() == 48 || req.getObuVersion() == 52)
throw GlyServiceError.BUSINESS_VALIDATE_ERR.toHandleException("货车不能发行单片式OBU");
} else if (orderInfo.getVanType() == 3) {
if (req.getCardVersion() == 48 || req.getCardVersion() == 52)
throw GlyServiceError.BUSINESS_VALIDATE_ERR.toHandleException("专项作业车不能发行单片式OBU");
if (req.getObuVersion() == 48 || req.getObuVersion() == 52)
throw GlyServiceError.BUSINESS_VALIDATE_ERR.toHandleException("专项作业车不能发行单片式OBU");
}
// 线上模式上传安装照校验
IssueOrderinfoExt orderinfoExt = orderinfoExtRepo.findByOrderNo(orderInfo.getOrderNo());
if (orderinfoExt == null) {
throw GlyServiceError.BUSINESS_VALIDATE_ERR.toHandleException("订单额外信息为空");
} else if (orderInfo.getPromotionModes() == 1 && !hasText(orderinfoExt.getInstallImgUrl())) {
throw GlyServiceError.BUSINESS_VALIDATE_ERR.toHandleException("线上模式需要上传设备安装照");
}
// 线上模式渠道订单发货信息校验
if (orderInfo.getOrderSource() == SourceType.CHANNEL && orderInfo.getPromotionModes() == 1) {
CsmsnConsignee csmsnConsignee = csmsnConsigneeRepo.findByObuId(orderInfo.getObuId());
if (csmsnConsignee == null)
throw GlyServiceError.BUSINESS_VALIDATE_ERR.toHandleException("线上模式渠道需要上传发货信息");
}
//渠道校验
if (SourceType.CHANNEL == orderInfo.getOrderSource()) {
orderInfo.setCardId(req.getCardId());//渠道验证用,不做持久化
@@ -179,6 +213,7 @@ public class InstApplyManager extends RedisCacheManager implements LogManager<In
throw GlyServiceError.BUSINESS_VALIDATE_ERR.toHandleException("渠道反馈不可激活:" + noticeResponse.getFailReason());
}
}

}

@Override

Loading…
Peruuta
Tallenna