Authored by chenchao

fix appraise address

@@ -17,6 +17,8 @@ import java.util.stream.Collectors; @@ -17,6 +17,8 @@ import java.util.stream.Collectors;
17 import javax.annotation.Resource; 17 import javax.annotation.Resource;
18 18
19 import com.yohobuy.ufo.model.order.common.*; 19 import com.yohobuy.ufo.model.order.common.*;
  20 +import com.yohoufo.dal.order.model.*;
  21 +import com.yohoufo.order.service.*;
20 import com.yohoufo.order.service.listener.BuyerOrderChangeEvent; 22 import com.yohoufo.order.service.listener.BuyerOrderChangeEvent;
21 import com.yohoufo.order.service.support.codegenerator.OrderCodeGenerator; 23 import com.yohoufo.order.service.support.codegenerator.OrderCodeGenerator;
22 import com.yohoufo.order.service.support.codegenerator.bean.CodeMeta; 24 import com.yohoufo.order.service.support.codegenerator.bean.CodeMeta;
@@ -52,15 +54,6 @@ import com.yohoufo.dal.order.SellerOrderGoodsMapper; @@ -52,15 +54,6 @@ import com.yohoufo.dal.order.SellerOrderGoodsMapper;
52 import com.yohoufo.dal.order.SellerOrderMapper; 54 import com.yohoufo.dal.order.SellerOrderMapper;
53 import com.yohoufo.dal.order.SellerOrderMetaMapper; 55 import com.yohoufo.dal.order.SellerOrderMetaMapper;
54 import com.yohoufo.dal.order.StorageDepositMapper; 56 import com.yohoufo.dal.order.StorageDepositMapper;
55 -import com.yohoufo.dal.order.model.BuyerOrder;  
56 -import com.yohoufo.dal.order.model.BuyerOrderGoods;  
57 -import com.yohoufo.dal.order.model.ExpressRecord;  
58 -import com.yohoufo.dal.order.model.QualityCheck;  
59 -import com.yohoufo.dal.order.model.SellerOrder;  
60 -import com.yohoufo.dal.order.model.SellerOrderGoods;  
61 -import com.yohoufo.dal.order.model.SellerOrderMeta;  
62 -import com.yohoufo.dal.order.model.SellerWalletDetail;  
63 -import com.yohoufo.dal.order.model.StorageDeposit;  
64 import com.yohoufo.dal.product.ProductMapper; 57 import com.yohoufo.dal.product.ProductMapper;
65 import com.yohoufo.dal.product.model.Product; 58 import com.yohoufo.dal.product.model.Product;
66 import com.yohoufo.order.common.RefundCase; 59 import com.yohoufo.order.common.RefundCase;
@@ -77,10 +70,6 @@ import com.yohoufo.order.model.request.TranseferCellNode; @@ -77,10 +70,6 @@ import com.yohoufo.order.model.request.TranseferCellNode;
77 import com.yohoufo.order.model.request.TransferMoneyRequest; 70 import com.yohoufo.order.model.request.TransferMoneyRequest;
78 import com.yohoufo.order.model.response.AppraiseAddressResp; 71 import com.yohoufo.order.model.response.AppraiseAddressResp;
79 import com.yohoufo.order.mq.TopicConstants; 72 import com.yohoufo.order.mq.TopicConstants;
80 -import com.yohoufo.order.service.DepositService;  
81 -import com.yohoufo.order.service.IExpressInfoService;  
82 -import com.yohoufo.order.service.IPaymentService;  
83 -import com.yohoufo.order.service.MerchantOrderPaymentService;  
84 import com.yohoufo.order.service.cache.CacheCleaner; 73 import com.yohoufo.order.service.cache.CacheCleaner;
85 import com.yohoufo.order.service.cache.CacheKeyBuilder; 74 import com.yohoufo.order.service.cache.CacheKeyBuilder;
86 import com.yohoufo.order.service.handler.RefundEarnestMoneyHandler; 75 import com.yohoufo.order.service.handler.RefundEarnestMoneyHandler;
@@ -208,6 +197,9 @@ public class AppraiseService { @@ -208,6 +197,9 @@ public class AppraiseService {
208 @Autowired 197 @Autowired
209 private OrderCodeGenerator orderCodeGenerator; 198 private OrderCodeGenerator orderCodeGenerator;
210 199
  200 + @Autowired
  201 + private ServiceOrderProcessor serviceOrderProcessor;
  202 +
211 /** 203 /**
212 * 触发物流 204 * 触发物流
213 */ 205 */
@@ -843,6 +835,8 @@ public class AppraiseService { @@ -843,6 +835,8 @@ public class AppraiseService {
843 835
844 836
845 837
  838 +
  839 +
846 /** 840 /**
847 * 更新发到卖家的物流信息 841 * 更新发到卖家的物流信息
848 * 将卖家的保证金分账给平台和买家 842 * 将卖家的保证金分账给平台和买家
@@ -853,9 +847,11 @@ public class AppraiseService { @@ -853,9 +847,11 @@ public class AppraiseService {
853 public ApiResponse appraiseFailAndDelivery(AppraiseExpressInfoBo appraiseExpressInfoBo) { 847 public ApiResponse appraiseFailAndDelivery(AppraiseExpressInfoBo appraiseExpressInfoBo) {
854 LOGGER.info("appraiseFail enter , appraiseExpressInfoBo {} ,appraiseNotPassFlag {}", appraiseExpressInfoBo); 848 LOGGER.info("appraiseFail enter , appraiseExpressInfoBo {} ,appraiseNotPassFlag {}", appraiseExpressInfoBo);
855 Long orderCode = appraiseExpressInfoBo.getOrderCode(); 849 Long orderCode = appraiseExpressInfoBo.getOrderCode();
856 - CodeMeta codeMeta = orderCodeGenerator.expId(orderCode);  
857 - OrderCodeType orderCodeType = OrderCodeType.getOrderCodeType(codeMeta.getType()); 850 + ApiResponse apiResponse = new ApiResponse();
  851 + if (serviceOrderProcessor.isGoodsServiceOrder(orderCode)){
858 852
  853 + return apiResponse;
  854 + }
859 855
860 856
861 OrderStatus expectStatus = OrderStatus.PLATFORM_CHECKING; 857 OrderStatus expectStatus = OrderStatus.PLATFORM_CHECKING;
@@ -866,7 +862,7 @@ public class AppraiseService { @@ -866,7 +862,7 @@ public class AppraiseService {
866 Integer depotNum = appraiseExpressInfoBo.getDepotNum(); 862 Integer depotNum = appraiseExpressInfoBo.getDepotNum();
867 String mobile = appraiseExpressInfoBo.getMobile(); 863 String mobile = appraiseExpressInfoBo.getMobile();
868 864
869 - ApiResponse apiResponse = new ApiResponse(); 865 +
870 BuyerOrder buyerOrder = buyerOrderMapper.selectOnlyByOrderCode(orderCode); 866 BuyerOrder buyerOrder = buyerOrderMapper.selectOnlyByOrderCode(orderCode);
871 867
872 if (buyerOrder == null) { 868 if (buyerOrder == null) {
@@ -251,14 +251,7 @@ public class ExpressInfoServiceImpl implements IExpressInfoService { @@ -251,14 +251,7 @@ public class ExpressInfoServiceImpl implements IExpressInfoService {
251 break; 251 break;
252 252
253 case GOODS_SERVICE: 253 case GOODS_SERVICE:
254 - AppraiseOrderService.ExistenceNode existenceNode = appraiseOrderService.isAppraiseOrder(orderCode);  
255 - if (!existenceNode.isExisted) {  
256 - LOGGER.warn("deliverToDepot getOrderInfo order not exist, orderCode is {}", orderCode);  
257 - throw new ServiceException(ServiceError.ORDER_NULL);  
258 - }  
259 - AppraiseOrder appraiseOrder = existenceNode.appraiseOrder;  
260 - IGoodsService goodsService = serviceOrderProcessor.findGoodsSeriveInstance(appraiseOrder.getAttributes());  
261 - 254 + IGoodsService goodsService = serviceOrderProcessor.findGoodsServiceInstance(orderCode);
262 DeliverToDepotReq deliverToDepotReq = DeliverToDepotReq.builder().orderCode(orderCode) 255 DeliverToDepotReq deliverToDepotReq = DeliverToDepotReq.builder().orderCode(orderCode)
263 .depotNum(depotNum).uid(sellerUid).build(); 256 .depotNum(depotNum).uid(sellerUid).build();
264 updateOrderCnt = goodsService.deliver2Depot(deliverToDepotReq); 257 updateOrderCnt = goodsService.deliver2Depot(deliverToDepotReq);
@@ -288,7 +281,7 @@ public class ExpressInfoServiceImpl implements IExpressInfoService { @@ -288,7 +281,7 @@ public class ExpressInfoServiceImpl implements IExpressInfoService {
288 // 发送mq获取物流信息 281 // 发送mq获取物流信息
289 sendExpressMQ(sellerUid, expressCompanyId, orderCode, wayBillCode, mobile); 282 sendExpressMQ(sellerUid, expressCompanyId, orderCode, wayBillCode, mobile);
290 283
291 - LOGGER.info("deliverToDepot end ! send express to erp "); 284 + LOGGER.info("deliverToDepot end ! send express to erp orderCode {}", orderCode);
292 285
293 //记录订单的状态变更信息 286 //记录订单的状态变更信息
294 LOGGER.info("in deliverToDepot record status change, orderCode {}, sellerUid {}", orderCode, sellerUid); 287 LOGGER.info("in deliverToDepot record status change, orderCode {}, sellerUid {}", orderCode, sellerUid);
1 package com.yohoufo.order.service.impl; 1 package com.yohoufo.order.service.impl;
2 2
  3 +import com.yoho.error.ServiceError;
  4 +import com.yoho.error.exception.ServiceException;
3 import com.yohobuy.ufo.model.order.common.OrderAttributes; 5 import com.yohobuy.ufo.model.order.common.OrderAttributes;
  6 +import com.yohobuy.ufo.model.order.common.OrderCodeType;
4 import com.yohoufo.common.exception.UfoServiceException; 7 import com.yohoufo.common.exception.UfoServiceException;
  8 +import com.yohoufo.dal.order.model.AppraiseOrder;
5 import com.yohoufo.order.service.IGoodsService; 9 import com.yohoufo.order.service.IGoodsService;
6 import com.yohoufo.order.service.seller.deposit.SellerDepositOrderService; 10 import com.yohoufo.order.service.seller.deposit.SellerDepositOrderService;
  11 +import com.yohoufo.order.service.support.codegenerator.OrderCodeGenerator;
  12 +import com.yohoufo.order.service.support.codegenerator.bean.CodeMeta;
  13 +import com.yohoufo.order.utils.LoggerUtils;
  14 +import org.slf4j.Logger;
7 import org.springframework.beans.factory.annotation.Autowired; 15 import org.springframework.beans.factory.annotation.Autowired;
8 import org.springframework.stereotype.Service; 16 import org.springframework.stereotype.Service;
9 17
10 @Service 18 @Service
11 public class ServiceOrderProcessor { 19 public class ServiceOrderProcessor {
12 20
  21 + private final Logger logger = LoggerUtils.getSellerOrderLogger();
  22 +
13 @Autowired 23 @Autowired
14 private AppraiseOrderService appraiseOrderService; 24 private AppraiseOrderService appraiseOrderService;
15 25
16 @Autowired 26 @Autowired
17 private SellerDepositOrderService sellerDepositOrderService; 27 private SellerDepositOrderService sellerDepositOrderService;
18 28
  29 + @Autowired
  30 + private OrderCodeGenerator orderCodeGenerator;
19 31
20 public IGoodsService findGoodsSeriveInstance(int oac){ 32 public IGoodsService findGoodsSeriveInstance(int oac){
21 OrderAttributes oa = OrderAttributes.getOrderAttributes(oac); 33 OrderAttributes oa = OrderAttributes.getOrderAttributes(oac);
@@ -34,4 +46,21 @@ public class ServiceOrderProcessor { @@ -34,4 +46,21 @@ public class ServiceOrderProcessor {
34 return goodsService; 46 return goodsService;
35 } 47 }
36 48
  49 + public boolean isGoodsServiceOrder(long orderCode){
  50 + CodeMeta codeMeta = orderCodeGenerator.expId(orderCode);
  51 + OrderCodeType orderCodeType = OrderCodeType.getOrderCodeType(codeMeta.getType());
  52 + return OrderCodeType.GOODS_SERVICE.equals(orderCodeType);
  53 + }
  54 +
  55 +
  56 + public IGoodsService findGoodsServiceInstance(long orderCode){
  57 + AppraiseOrderService.ExistenceNode existenceNode = appraiseOrderService.isAppraiseOrder(orderCode);
  58 + if (!existenceNode.isExisted) {
  59 + logger.warn("deliverToDepot getOrderInfo order not exist, orderCode is {}", orderCode);
  60 + throw new ServiceException(ServiceError.ORDER_NULL);
  61 + }
  62 + AppraiseOrder appraiseOrder = existenceNode.appraiseOrder;
  63 + IGoodsService goodsService = findGoodsSeriveInstance(appraiseOrder.getAttributes());
  64 + return goodsService;
  65 + }
37 } 66 }