Authored by qinchao

鉴定不通过:物流信息异步

... ... @@ -296,77 +296,6 @@ public class AppraiseService {
}
}
/*
* 发货
* (1)更新订单状态
* (2)记录物流
* (3)消息
*/
/*public void deliverGoods(AppraiseExpressInfoBo appraiseExpressInfoBo){
Integer expressCompanyId = appraiseExpressInfoBo.getExpressCompanyId();
Long orderCode=appraiseExpressInfoBo.getOrderCode();
String wayBillCode=appraiseExpressInfoBo.getWayBillCode();
Integer depotNum=appraiseExpressInfoBo.getDepotNum();
String mobile=appraiseExpressInfoBo.getMobile();
BuyerOrder buyerOrder = buyerOrderMapper.selectOnlyByOrderCode(orderCode);
if (buyerOrder == null){
LOGGER.warn("deliverGoods getOrderInfo order not exist, orderCode {}", orderCode);
throw new ServiceException(ServiceError.ORDER_NULL);
}
OrderStatus expectStatus = OrderStatus.JUDGE_PASS;
final OrderStatus targetStatus = OrderStatus.WAITING_RECEIVE;
if (buyerOrder.getStatus() != expectStatus.getCode()){
LOGGER.warn("deliverGoods expectStatus {}, actual status {}, orderCode {}", expectStatus,
buyerOrder.getStatus(), orderCode);
throw new ServiceException(ServiceError.ORDER_STATUS_INVALIDATE);
}
//更新状态为 (待收货[买家])
int buyerUid = buyerOrder.getUid();
BuyerOrderGoods bog = buyerOrderGoodsMapper.selectByOrderCode(buyerUid, orderCode);
int skup = bog.getSkup();
SellerOrder sellerOrder = sellerOrderMapper.selectBySkup(skup);
SellerOrderGoods sellerOrderGoods = sellerOrderGoodsMapper.selectByPrimaryKey(skup);
int updateBuyerCnt = buyerOrderMapper.updateStatusByOrderCode(orderCode, buyerUid,
expectStatus.getCode(), targetStatus.getCode(), DateUtil.getCurrentTimeSecond());
LOGGER.info("deliverGoods updateBuyerCnt {} ,expectStatus {}, actual status {}, orderCode {}", updateBuyerCnt ,expectStatus,
buyerOrder.getStatus(), orderCode);
if(updateBuyerCnt==1){
int sellerUid = buyerOrder.getSellerUid();
//记录物流信息
expressInfoService.deliverGoods(buyerUid, expressCompanyId, orderCode, wayBillCode, depotNum,mobile);
//平台已发货给买家 TODO
//inBoxFacade.appraisePassNotice(buyerUid, orderCode, sellerOrderGoods);
//记录订单的状态变更信息
LOGGER.info("in deliverGoods record status change, orderCode {},uid {} ,sellerUid {}", orderCode,buyerUid,sellerUid);
orderStatusFlowService.addAsy(buyerOrder.getOrderCode(),targetStatus.getCode());
//清理
cacheCleaner.delete(Arrays.asList(CacheKeyBuilder.orderListKey(sellerUid, TabType.SELL.getValue()),
CacheKeyBuilder.orderListKey(buyerUid, TabType.BUY.getValue()),
CacheKeyBuilder.sellerOrderDetailKey(sellerOrderGoods),
CacheKeyBuilder.orderDetailKey(sellerUid, TabType.SELL.getValue(), orderCode),
CacheKeyBuilder.orderDetailKey(buyerUid,TabType.BUY.getValue(), orderCode),
CacheKeyBuilder.buyerOrderNums(buyerUid)));
ErpBuyerOrderEvent event = new ErpBuyerOrderEvent(buyerUid);
EventBusPublisher.publishEvent(event);
}else{
LOGGER.warn("in deliverGoods update buyer count fail ,expectStatus {}, actual status {}, orderCode {}", updateBuyerCnt ,expectStatus,
buyerOrder.getStatus(), orderCode);
throw new UfoServiceException(400,"更新订单状态失败");
}
}*/
/**
* 鉴定不通过退回
* (1)记录物流
... ... @@ -594,6 +523,8 @@ public class AppraiseService {
}catch(Exception ex) {
LOGGER.warn("in appraiseFail orderStatusFlowService or notice fail orderCode {}", orderCode, ex);
}finally {
/// 物流信息异步执行
executorService.execute(()->{
//更新物流信息,写到最后
//鉴定不通过,发物流
if(type == 1){
... ... @@ -638,6 +569,8 @@ public class AppraiseService {
expressDataType = EnumExpressDataType.operate_transfer;
expressInfoService.saveOperateTransferExpressInfo(sellerUid,orderCode,expressType.getCode(),expressDataType,operateTransferCode);
}
});
}
}else{
... ...