Authored by qinchao

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

@@ -296,77 +296,6 @@ public class AppraiseService { @@ -296,77 +296,6 @@ public class AppraiseService {
296 } 296 }
297 } 297 }
298 298
299 - /*  
300 - * 发货  
301 - * (1)更新订单状态  
302 - * (2)记录物流  
303 - * (3)消息  
304 - */  
305 - /*public void deliverGoods(AppraiseExpressInfoBo appraiseExpressInfoBo){  
306 - Integer expressCompanyId = appraiseExpressInfoBo.getExpressCompanyId();  
307 - Long orderCode=appraiseExpressInfoBo.getOrderCode();  
308 - String wayBillCode=appraiseExpressInfoBo.getWayBillCode();  
309 - Integer depotNum=appraiseExpressInfoBo.getDepotNum();  
310 - String mobile=appraiseExpressInfoBo.getMobile();  
311 -  
312 - BuyerOrder buyerOrder = buyerOrderMapper.selectOnlyByOrderCode(orderCode);  
313 -  
314 - if (buyerOrder == null){  
315 - LOGGER.warn("deliverGoods getOrderInfo order not exist, orderCode {}", orderCode);  
316 - throw new ServiceException(ServiceError.ORDER_NULL);  
317 - }  
318 -  
319 - OrderStatus expectStatus = OrderStatus.JUDGE_PASS;  
320 - final OrderStatus targetStatus = OrderStatus.WAITING_RECEIVE;  
321 - if (buyerOrder.getStatus() != expectStatus.getCode()){  
322 - LOGGER.warn("deliverGoods expectStatus {}, actual status {}, orderCode {}", expectStatus,  
323 - buyerOrder.getStatus(), orderCode);  
324 - throw new ServiceException(ServiceError.ORDER_STATUS_INVALIDATE);  
325 - }  
326 -  
327 - //更新状态为 (待收货[买家])  
328 - int buyerUid = buyerOrder.getUid();  
329 - BuyerOrderGoods bog = buyerOrderGoodsMapper.selectByOrderCode(buyerUid, orderCode);  
330 - int skup = bog.getSkup();  
331 - SellerOrder sellerOrder = sellerOrderMapper.selectBySkup(skup);  
332 - SellerOrderGoods sellerOrderGoods = sellerOrderGoodsMapper.selectByPrimaryKey(skup);  
333 -  
334 - int updateBuyerCnt = buyerOrderMapper.updateStatusByOrderCode(orderCode, buyerUid,  
335 - expectStatus.getCode(), targetStatus.getCode(), DateUtil.getCurrentTimeSecond());  
336 -  
337 - LOGGER.info("deliverGoods updateBuyerCnt {} ,expectStatus {}, actual status {}, orderCode {}", updateBuyerCnt ,expectStatus,  
338 - buyerOrder.getStatus(), orderCode);  
339 - if(updateBuyerCnt==1){  
340 - int sellerUid = buyerOrder.getSellerUid();  
341 -  
342 - //记录物流信息  
343 - expressInfoService.deliverGoods(buyerUid, expressCompanyId, orderCode, wayBillCode, depotNum,mobile);  
344 - //平台已发货给买家 TODO  
345 - //inBoxFacade.appraisePassNotice(buyerUid, orderCode, sellerOrderGoods);  
346 -  
347 - //记录订单的状态变更信息  
348 - LOGGER.info("in deliverGoods record status change, orderCode {},uid {} ,sellerUid {}", orderCode,buyerUid,sellerUid);  
349 - orderStatusFlowService.addAsy(buyerOrder.getOrderCode(),targetStatus.getCode());  
350 -  
351 -  
352 - //清理  
353 - cacheCleaner.delete(Arrays.asList(CacheKeyBuilder.orderListKey(sellerUid, TabType.SELL.getValue()),  
354 - CacheKeyBuilder.orderListKey(buyerUid, TabType.BUY.getValue()),  
355 - CacheKeyBuilder.sellerOrderDetailKey(sellerOrderGoods),  
356 - CacheKeyBuilder.orderDetailKey(sellerUid, TabType.SELL.getValue(), orderCode),  
357 - CacheKeyBuilder.orderDetailKey(buyerUid,TabType.BUY.getValue(), orderCode),  
358 - CacheKeyBuilder.buyerOrderNums(buyerUid)));  
359 -  
360 - ErpBuyerOrderEvent event = new ErpBuyerOrderEvent(buyerUid);  
361 - EventBusPublisher.publishEvent(event);  
362 -  
363 - }else{  
364 - LOGGER.warn("in deliverGoods update buyer count fail ,expectStatus {}, actual status {}, orderCode {}", updateBuyerCnt ,expectStatus,  
365 - buyerOrder.getStatus(), orderCode);  
366 - throw new UfoServiceException(400,"更新订单状态失败");  
367 - }  
368 - }*/  
369 -  
370 /** 299 /**
371 * 鉴定不通过退回 300 * 鉴定不通过退回
372 * (1)记录物流 301 * (1)记录物流
@@ -451,7 +380,7 @@ public class AppraiseService { @@ -451,7 +380,7 @@ public class AppraiseService {
451 380
452 //清缓存 381 //清缓存
453 cleanCacheAfterUpdateStatus(buyerOrder.getOrderCode(),buyerOrder.getUid(),buyerOrder.getSellerUid()); 382 cleanCacheAfterUpdateStatus(buyerOrder.getOrderCode(),buyerOrder.getUid(),buyerOrder.getSellerUid());
454 - 383 +
455 return apiResponse; 384 return apiResponse;
456 } 385 }
457 386
@@ -594,50 +523,54 @@ public class AppraiseService { @@ -594,50 +523,54 @@ public class AppraiseService {
594 }catch(Exception ex) { 523 }catch(Exception ex) {
595 LOGGER.warn("in appraiseFail orderStatusFlowService or notice fail orderCode {}", orderCode, ex); 524 LOGGER.warn("in appraiseFail orderStatusFlowService or notice fail orderCode {}", orderCode, ex);
596 }finally { 525 }finally {
597 - //更新物流信息,写到最后  
598 - //鉴定不通过,发物流  
599 - if(type == 1){  
600 - //补:鉴定不通过  
601 - EnumExpressType expressType = EnumExpressType.EXPRESS_TYPE_JUDGE_CENTER;  
602 - EnumExpressDataType expressDataType = EnumExpressDataType.operate_transfer;  
603 - EnumExpressDataOperateTransferCode operateTransferCode = EnumExpressDataOperateTransferCode.judge_reject;  
604 - expressInfoService.saveOperateTransferExpressInfo(sellerUid,orderCode,expressType.getCode(),expressDataType,operateTransferCode);  
605 -  
606 - //发货物流(平台已发货)  
607 - expressInfoService.returnBackOrderCauseOfJudgeFailure(sellerUid, expressCompanyId, orderCode, wayBillCode, depotNum,mobile);  
608 - }else if(type == 2){  
609 - //质检不通过,不发物流  
610 -  
611 - //先补加一条鉴定中物流  
612 - EnumExpressType expressType = EnumExpressType.EXPRESS_TYPE_JUDGE_CENTER;  
613 - EnumExpressDataType expressDataType = EnumExpressDataType.operate_transfer;  
614 - EnumExpressDataOperateTransferCode operateTransferCode = EnumExpressDataOperateTransferCode.judging;  
615 - expressInfoService.saveOperateTransferExpressInfo(sellerUid,orderCode,expressType.getCode(),expressDataType,operateTransferCode);  
616 -  
617 - //再加一个鉴定不通过的物流  
618 - operateTransferCode = EnumExpressDataOperateTransferCode.quality_check_reject;  
619 - expressType = EnumExpressType.EXPRESS_TYPE_JUDGE_CENTER;  
620 - expressDataType = EnumExpressDataType.operate_transfer;  
621 - expressInfoService.saveOperateTransferExpressInfo(sellerUid,orderCode,expressType.getCode(),expressDataType,operateTransferCode);  
622 - }else if(type == 3||type == 4){  
623 - //记录操作记录  
624 - if(type == 3){  
625 - orderOperateRecordService.addRecord(orderCode,"买家操作",OperateTypeEnum.OPERATE_TYPE_QUALITY_MINI_FAULT_REJECT);  
626 - }else{  
627 - orderOperateRecordService.addRecord(orderCode,"系统操作",OperateTypeEnum.OPERATE_TYPE_QUALITY_MINI_FAULT_REJECT_BY_OUT_TIME); 526 + /// 物流信息异步执行
  527 + executorService.execute(()->{
  528 + //更新物流信息,写到最后
  529 + //鉴定不通过,发物流
  530 + if(type == 1){
  531 + //补:鉴定不通过
  532 + EnumExpressType expressType = EnumExpressType.EXPRESS_TYPE_JUDGE_CENTER;
  533 + EnumExpressDataType expressDataType = EnumExpressDataType.operate_transfer;
  534 + EnumExpressDataOperateTransferCode operateTransferCode = EnumExpressDataOperateTransferCode.judge_reject;
  535 + expressInfoService.saveOperateTransferExpressInfo(sellerUid,orderCode,expressType.getCode(),expressDataType,operateTransferCode);
  536 +
  537 + //发货物流(平台已发货)
  538 + expressInfoService.returnBackOrderCauseOfJudgeFailure(sellerUid, expressCompanyId, orderCode, wayBillCode, depotNum,mobile);
  539 + }else if(type == 2){
  540 + //质检不通过,不发物流
  541 +
  542 + //先补加一条鉴定中物流
  543 + EnumExpressType expressType = EnumExpressType.EXPRESS_TYPE_JUDGE_CENTER;
  544 + EnumExpressDataType expressDataType = EnumExpressDataType.operate_transfer;
  545 + EnumExpressDataOperateTransferCode operateTransferCode = EnumExpressDataOperateTransferCode.judging;
  546 + expressInfoService.saveOperateTransferExpressInfo(sellerUid,orderCode,expressType.getCode(),expressDataType,operateTransferCode);
  547 +
  548 + //再加一个鉴定不通过的物流
  549 + operateTransferCode = EnumExpressDataOperateTransferCode.quality_check_reject;
  550 + expressType = EnumExpressType.EXPRESS_TYPE_JUDGE_CENTER;
  551 + expressDataType = EnumExpressDataType.operate_transfer;
  552 + expressInfoService.saveOperateTransferExpressInfo(sellerUid,orderCode,expressType.getCode(),expressDataType,operateTransferCode);
  553 + }else if(type == 3||type == 4){
  554 + //记录操作记录
  555 + if(type == 3){
  556 + orderOperateRecordService.addRecord(orderCode,"买家操作",OperateTypeEnum.OPERATE_TYPE_QUALITY_MINI_FAULT_REJECT);
  557 + }else{
  558 + orderOperateRecordService.addRecord(orderCode,"系统操作",OperateTypeEnum.OPERATE_TYPE_QUALITY_MINI_FAULT_REJECT_BY_OUT_TIME);
  559 + }
  560 +
  561 + //先补加一条鉴定中物流
  562 + EnumExpressType expressType = EnumExpressType.EXPRESS_TYPE_JUDGE_CENTER;
  563 + EnumExpressDataType expressDataType = EnumExpressDataType.operate_transfer;
  564 + EnumExpressDataOperateTransferCode operateTransferCode = EnumExpressDataOperateTransferCode.mini_fault_reject;
  565 + expressInfoService.saveOperateTransferExpressInfo(sellerUid,orderCode,expressType.getCode(),expressDataType,operateTransferCode);
  566 +
  567 + operateTransferCode = EnumExpressDataOperateTransferCode.mini_fault_not_pass;
  568 + expressType = EnumExpressType.EXPRESS_TYPE_JUDGE_CENTER;
  569 + expressDataType = EnumExpressDataType.operate_transfer;
  570 + expressInfoService.saveOperateTransferExpressInfo(sellerUid,orderCode,expressType.getCode(),expressDataType,operateTransferCode);
628 } 571 }
629 -  
630 - //先补加一条鉴定中物流  
631 - EnumExpressType expressType = EnumExpressType.EXPRESS_TYPE_JUDGE_CENTER;  
632 - EnumExpressDataType expressDataType = EnumExpressDataType.operate_transfer;  
633 - EnumExpressDataOperateTransferCode operateTransferCode = EnumExpressDataOperateTransferCode.mini_fault_reject;  
634 - expressInfoService.saveOperateTransferExpressInfo(sellerUid,orderCode,expressType.getCode(),expressDataType,operateTransferCode);  
635 -  
636 - operateTransferCode = EnumExpressDataOperateTransferCode.mini_fault_not_pass;  
637 - expressType = EnumExpressType.EXPRESS_TYPE_JUDGE_CENTER;  
638 - expressDataType = EnumExpressDataType.operate_transfer;  
639 - expressInfoService.saveOperateTransferExpressInfo(sellerUid,orderCode,expressType.getCode(),expressDataType,operateTransferCode);  
640 - } 572 + });
  573 +
641 } 574 }
642 575
643 }else{ 576 }else{