Authored by LUOXC

fixbug#5735

@@ -5,10 +5,7 @@ import com.alibaba.fastjson.JSONObject; @@ -5,10 +5,7 @@ import com.alibaba.fastjson.JSONObject;
5 import com.yoho.error.ServiceError; 5 import com.yoho.error.ServiceError;
6 import com.yoho.error.exception.ServiceException; 6 import com.yoho.error.exception.ServiceException;
7 import com.yohobuy.ufo.model.order.bo.OrderInfo; 7 import com.yohobuy.ufo.model.order.bo.OrderInfo;
8 -import com.yohobuy.ufo.model.order.common.OrderAttributes;  
9 -import com.yohobuy.ufo.model.order.common.OrderCodeType;  
10 -import com.yohobuy.ufo.model.order.common.OrderStatus;  
11 -import com.yohobuy.ufo.model.order.common.TabType; 8 +import com.yohobuy.ufo.model.order.common.*;
12 import com.yohobuy.ufo.model.order.constants.SkupType; 9 import com.yohobuy.ufo.model.order.constants.SkupType;
13 import com.yohoufo.common.alarm.EventBusPublisher; 10 import com.yohoufo.common.alarm.EventBusPublisher;
14 import com.yohoufo.common.utils.DateUtil; 11 import com.yohoufo.common.utils.DateUtil;
@@ -49,6 +46,11 @@ import java.util.Arrays; @@ -49,6 +46,11 @@ import java.util.Arrays;
49 import java.util.List; 46 import java.util.List;
50 import java.util.concurrent.TimeUnit; 47 import java.util.concurrent.TimeUnit;
51 48
  49 +import static com.yohobuy.ufo.model.order.common.EnumExpressDataOperateTransferCode.judge_pass;
  50 +import static com.yohobuy.ufo.model.order.common.EnumExpressDataOperateTransferCode.platform_receive;
  51 +import static com.yohobuy.ufo.model.order.common.EnumExpressDataType.operate_transfer;
  52 +import static com.yohobuy.ufo.model.order.common.EnumExpressType.EXPRESS_TYPE_JUDGE_CENTER;
  53 +
52 @Service 54 @Service
53 public class BuyerOrderPaymentService extends AbstractOrderPaymentService { 55 public class BuyerOrderPaymentService extends AbstractOrderPaymentService {
54 56
@@ -98,6 +100,9 @@ public class BuyerOrderPaymentService extends AbstractOrderPaymentService { @@ -98,6 +100,9 @@ public class BuyerOrderPaymentService extends AbstractOrderPaymentService {
98 @Autowired 100 @Autowired
99 private AppraiseService appraiseService; 101 private AppraiseService appraiseService;
100 102
  103 + @Autowired
  104 + private IExpressInfoService expressInfoService;
  105 +
101 private boolean isDepositWithQuickDeliverGoods(int uid, long orderCode, Integer oa){ 106 private boolean isDepositWithQuickDeliverGoods(int uid, long orderCode, Integer oa){
102 BuyerOrderGoods pbog = buyerOrderGoodsMapper.selectOnlyByOrderCode(orderCode); 107 BuyerOrderGoods pbog = buyerOrderGoodsMapper.selectOnlyByOrderCode(orderCode);
103 SellerOrderGoods psog = sellerOrderGoodsMapper.selectByPrimaryKey(pbog.getSkup()); 108 SellerOrderGoods psog = sellerOrderGoodsMapper.selectByPrimaryKey(pbog.getSkup());
@@ -237,22 +242,33 @@ public class BuyerOrderPaymentService extends AbstractOrderPaymentService { @@ -237,22 +242,33 @@ public class BuyerOrderPaymentService extends AbstractOrderPaymentService {
237 orderOverTimeService.insertDeliveryTime(new OrderOverTime(orderCode, ts + secondsOfLimit, minutes)); 242 orderOverTimeService.insertDeliveryTime(new OrderOverTime(orderCode, ts + secondsOfLimit, minutes));
238 } 243 }
239 244
240 - private void processQuickDeliverOrder(BuyerOrder buyerOrder, SellerOrderGoods sellerOrderGoods){ 245 + private void processQuickDeliverOrder(BuyerOrder buyerOrder, SellerOrderGoods sellerOrderGoods) {
  246 + Integer sellerUid = buyerOrder.getSellerUid();
  247 + Integer buyerUid = buyerOrder.getUid();
  248 + Long orderCode = buyerOrder.getOrderCode();
  249 + Integer skup = sellerOrderGoods.getId();
241 //寄存订单 & 闪购商品 250 //寄存订单 & 闪购商品
242 - if (SkupType.QUICK_DELIVER.getCode() == sellerOrderGoods.getAttributes()){  
243 - Integer sellerUid = null;  
244 - Integer buyerUid = null;  
245 - Long orderCode = null;  
246 - Integer skup = null; 251 + if (SkupType.QUICK_DELIVER.getCode() == sellerOrderGoods.getAttributes()) {
247 try { 252 try {
248 - depositService.changeOwner(sellerUid = buyerOrder.getSellerUid(), skup = sellerOrderGoods.getId(),  
249 - orderCode = buyerOrder.getOrderCode(), buyerUid = buyerOrder.getUid(), false);  
250 - }catch (Exception ex){  
251 - logger.warn("pay successful, processQuickDeliverOrder invoke depositService.changeOwner fail, sellerUid {}, buyerUid {},orderCode {},skup {}", 253 + depositService.changeOwner(sellerUid, skup, orderCode, buyerUid, false);
  254 + } catch (Exception ex) {
  255 + logger.warn("pay successful, processQuickDeliverOrder invoke change owner fail, sellerUid {}, buyerUid {},orderCode {},skup {}",
252 sellerUid, buyerUid, orderCode, skup); 256 sellerUid, buyerUid, orderCode, skup);
253 } 257 }
254 258
255 } 259 }
  260 + if (BuyerOrderUtils.isQuickDeliver(buyerOrder.getAttributes())) {
  261 + try {
  262 + // 插入物流调拨信息
  263 + expressInfoService.saveOperateTransferExpressInfo(buyerUid, orderCode,
  264 + EXPRESS_TYPE_JUDGE_CENTER.getCode(), operate_transfer, platform_receive);
  265 + expressInfoService.saveOperateTransferExpressInfo(buyerUid, orderCode,
  266 + EXPRESS_TYPE_JUDGE_CENTER.getCode(), operate_transfer, judge_pass);
  267 + } catch (Exception ex) {
  268 + logger.warn("pay successful, processQuickDeliverOrder invoke save transfer express info fail, sellerUid {}, buyerUid {},orderCode {},skup {}",
  269 + sellerUid, buyerUid, orderCode, skup);
  270 + }
  271 + }
256 //todo notice 272 //todo notice
257 } 273 }
258 274
@@ -35,6 +35,8 @@ public interface IExpressInfoService { @@ -35,6 +35,8 @@ public interface IExpressInfoService {
35 void deliverToDepot(Integer sellerUid,Integer expressCompanyId, Long orderCode, String wayBillCode,Integer depotNum); 35 void deliverToDepot(Integer sellerUid,Integer expressCompanyId, Long orderCode, String wayBillCode,Integer depotNum);
36 36
37 37
  38 +
  39 +
38 /** 40 /**
39 * 卖家发货的商品,买家取消后,鉴定中心寄回商品给卖家 41 * 卖家发货的商品,买家取消后,鉴定中心寄回商品给卖家
40 * @param sellerUid 卖家uid 42 * @param sellerUid 卖家uid
  1 +package com.yohoufo.order.service.proxy;
  2 +
  3 +import com.yoho.message.sdk.service.ufo.IUFOSendService;
  4 +import com.yohoufo.dal.order.SellerOrderMapper;
  5 +import com.yohoufo.dal.product.ProductMapper;
  6 +import com.yohoufo.inboxclient.sdk.InBoxSDK;
  7 +import com.yohoufo.order.utils.PubThreadFactory;
  8 +import org.springframework.beans.factory.annotation.Autowired;
  9 +import org.springframework.stereotype.Service;
  10 +
  11 +import javax.annotation.PostConstruct;
  12 +import java.util.concurrent.ArrayBlockingQueue;
  13 +import java.util.concurrent.ExecutorService;
  14 +import java.util.concurrent.ThreadPoolExecutor;
  15 +import java.util.concurrent.TimeUnit;
  16 +
  17 +@Service
  18 +public class SellerOrderMessage {
  19 +
  20 + private ExecutorService executorService;
  21 +
  22 + @Autowired
  23 + private InBoxSDK inBoxSDK;
  24 +
  25 + @Autowired
  26 + private SendSmsService sendSmsService;
  27 +
  28 + @Autowired
  29 + private UserProxyService userProxyService;
  30 +
  31 + @Autowired
  32 + private ProductMapper productMapper;
  33 +
  34 + @Autowired
  35 + private SellerOrderMapper sellerOrderMapper;
  36 +
  37 + @Autowired
  38 + private IUFOSendService ufoSendService;
  39 +
  40 + @PostConstruct
  41 + public void init() {
  42 + executorService = new ThreadPoolExecutor(5, 10,
  43 + 60, TimeUnit.SECONDS,
  44 + new ArrayBlockingQueue<>(1000),
  45 + new PubThreadFactory("seller-order-message"));
  46 + }
  47 +
  48 +
  49 +}