...
|
...
|
@@ -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)记录物流
|
...
|
...
|
@@ -451,7 +380,7 @@ public class AppraiseService { |
|
|
|
|
|
//清缓存
|
|
|
cleanCacheAfterUpdateStatus(buyerOrder.getOrderCode(),buyerOrder.getUid(),buyerOrder.getSellerUid());
|
|
|
|
|
|
|
|
|
return apiResponse;
|
|
|
}
|
|
|
|
...
|
...
|
@@ -594,50 +523,54 @@ public class AppraiseService { |
|
|
}catch(Exception ex) {
|
|
|
LOGGER.warn("in appraiseFail orderStatusFlowService or notice fail orderCode {}", orderCode, ex);
|
|
|
}finally {
|
|
|
//更新物流信息,写到最后
|
|
|
//鉴定不通过,发物流
|
|
|
if(type == 1){
|
|
|
//补:鉴定不通过
|
|
|
EnumExpressType expressType = EnumExpressType.EXPRESS_TYPE_JUDGE_CENTER;
|
|
|
EnumExpressDataType expressDataType = EnumExpressDataType.operate_transfer;
|
|
|
EnumExpressDataOperateTransferCode operateTransferCode = EnumExpressDataOperateTransferCode.judge_reject;
|
|
|
expressInfoService.saveOperateTransferExpressInfo(sellerUid,orderCode,expressType.getCode(),expressDataType,operateTransferCode);
|
|
|
|
|
|
//发货物流(平台已发货)
|
|
|
expressInfoService.returnBackOrderCauseOfJudgeFailure(sellerUid, expressCompanyId, orderCode, wayBillCode, depotNum,mobile);
|
|
|
}else if(type == 2){
|
|
|
//质检不通过,不发物流
|
|
|
|
|
|
//先补加一条鉴定中物流
|
|
|
EnumExpressType expressType = EnumExpressType.EXPRESS_TYPE_JUDGE_CENTER;
|
|
|
EnumExpressDataType expressDataType = EnumExpressDataType.operate_transfer;
|
|
|
EnumExpressDataOperateTransferCode operateTransferCode = EnumExpressDataOperateTransferCode.judging;
|
|
|
expressInfoService.saveOperateTransferExpressInfo(sellerUid,orderCode,expressType.getCode(),expressDataType,operateTransferCode);
|
|
|
|
|
|
//再加一个鉴定不通过的物流
|
|
|
operateTransferCode = EnumExpressDataOperateTransferCode.quality_check_reject;
|
|
|
expressType = EnumExpressType.EXPRESS_TYPE_JUDGE_CENTER;
|
|
|
expressDataType = EnumExpressDataType.operate_transfer;
|
|
|
expressInfoService.saveOperateTransferExpressInfo(sellerUid,orderCode,expressType.getCode(),expressDataType,operateTransferCode);
|
|
|
}else if(type == 3||type == 4){
|
|
|
//记录操作记录
|
|
|
if(type == 3){
|
|
|
orderOperateRecordService.addRecord(orderCode,"买家操作",OperateTypeEnum.OPERATE_TYPE_QUALITY_MINI_FAULT_REJECT);
|
|
|
}else{
|
|
|
orderOperateRecordService.addRecord(orderCode,"系统操作",OperateTypeEnum.OPERATE_TYPE_QUALITY_MINI_FAULT_REJECT_BY_OUT_TIME);
|
|
|
/// 物流信息异步执行
|
|
|
executorService.execute(()->{
|
|
|
//更新物流信息,写到最后
|
|
|
//鉴定不通过,发物流
|
|
|
if(type == 1){
|
|
|
//补:鉴定不通过
|
|
|
EnumExpressType expressType = EnumExpressType.EXPRESS_TYPE_JUDGE_CENTER;
|
|
|
EnumExpressDataType expressDataType = EnumExpressDataType.operate_transfer;
|
|
|
EnumExpressDataOperateTransferCode operateTransferCode = EnumExpressDataOperateTransferCode.judge_reject;
|
|
|
expressInfoService.saveOperateTransferExpressInfo(sellerUid,orderCode,expressType.getCode(),expressDataType,operateTransferCode);
|
|
|
|
|
|
//发货物流(平台已发货)
|
|
|
expressInfoService.returnBackOrderCauseOfJudgeFailure(sellerUid, expressCompanyId, orderCode, wayBillCode, depotNum,mobile);
|
|
|
}else if(type == 2){
|
|
|
//质检不通过,不发物流
|
|
|
|
|
|
//先补加一条鉴定中物流
|
|
|
EnumExpressType expressType = EnumExpressType.EXPRESS_TYPE_JUDGE_CENTER;
|
|
|
EnumExpressDataType expressDataType = EnumExpressDataType.operate_transfer;
|
|
|
EnumExpressDataOperateTransferCode operateTransferCode = EnumExpressDataOperateTransferCode.judging;
|
|
|
expressInfoService.saveOperateTransferExpressInfo(sellerUid,orderCode,expressType.getCode(),expressDataType,operateTransferCode);
|
|
|
|
|
|
//再加一个鉴定不通过的物流
|
|
|
operateTransferCode = EnumExpressDataOperateTransferCode.quality_check_reject;
|
|
|
expressType = EnumExpressType.EXPRESS_TYPE_JUDGE_CENTER;
|
|
|
expressDataType = EnumExpressDataType.operate_transfer;
|
|
|
expressInfoService.saveOperateTransferExpressInfo(sellerUid,orderCode,expressType.getCode(),expressDataType,operateTransferCode);
|
|
|
}else if(type == 3||type == 4){
|
|
|
//记录操作记录
|
|
|
if(type == 3){
|
|
|
orderOperateRecordService.addRecord(orderCode,"买家操作",OperateTypeEnum.OPERATE_TYPE_QUALITY_MINI_FAULT_REJECT);
|
|
|
}else{
|
|
|
orderOperateRecordService.addRecord(orderCode,"系统操作",OperateTypeEnum.OPERATE_TYPE_QUALITY_MINI_FAULT_REJECT_BY_OUT_TIME);
|
|
|
}
|
|
|
|
|
|
//先补加一条鉴定中物流
|
|
|
EnumExpressType expressType = EnumExpressType.EXPRESS_TYPE_JUDGE_CENTER;
|
|
|
EnumExpressDataType expressDataType = EnumExpressDataType.operate_transfer;
|
|
|
EnumExpressDataOperateTransferCode operateTransferCode = EnumExpressDataOperateTransferCode.mini_fault_reject;
|
|
|
expressInfoService.saveOperateTransferExpressInfo(sellerUid,orderCode,expressType.getCode(),expressDataType,operateTransferCode);
|
|
|
|
|
|
operateTransferCode = EnumExpressDataOperateTransferCode.mini_fault_not_pass;
|
|
|
expressType = EnumExpressType.EXPRESS_TYPE_JUDGE_CENTER;
|
|
|
expressDataType = EnumExpressDataType.operate_transfer;
|
|
|
expressInfoService.saveOperateTransferExpressInfo(sellerUid,orderCode,expressType.getCode(),expressDataType,operateTransferCode);
|
|
|
}
|
|
|
|
|
|
//先补加一条鉴定中物流
|
|
|
EnumExpressType expressType = EnumExpressType.EXPRESS_TYPE_JUDGE_CENTER;
|
|
|
EnumExpressDataType expressDataType = EnumExpressDataType.operate_transfer;
|
|
|
EnumExpressDataOperateTransferCode operateTransferCode = EnumExpressDataOperateTransferCode.mini_fault_reject;
|
|
|
expressInfoService.saveOperateTransferExpressInfo(sellerUid,orderCode,expressType.getCode(),expressDataType,operateTransferCode);
|
|
|
|
|
|
operateTransferCode = EnumExpressDataOperateTransferCode.mini_fault_not_pass;
|
|
|
expressType = EnumExpressType.EXPRESS_TYPE_JUDGE_CENTER;
|
|
|
expressDataType = EnumExpressDataType.operate_transfer;
|
|
|
expressInfoService.saveOperateTransferExpressInfo(sellerUid,orderCode,expressType.getCode(),expressDataType,operateTransferCode);
|
|
|
}
|
|
|
});
|
|
|
|
|
|
}
|
|
|
|
|
|
}else{
|
...
|
...
|
|