Authored by Lixiaodi

Merge branch 'test6.8.9' of http://git.yoho.cn/ufo/yohoufo-fore into test6.8.9

1 package com.yohoufo.order.service.proxy; 1 package com.yohoufo.order.service.proxy;
2 2
3 import com.alibaba.fastjson.JSON; 3 import com.alibaba.fastjson.JSON;
  4 +import com.yoho.message.sdk.service.ufo.IUFOSendService;
4 import com.yohobuy.ufo.model.enums.InboxBusinessTypeEnum; 5 import com.yohobuy.ufo.model.enums.InboxBusinessTypeEnum;
5 import com.yohobuy.ufo.model.order.common.SuperEnterStageLevel; 6 import com.yohobuy.ufo.model.order.common.SuperEnterStageLevel;
  7 +import com.yohoufo.dal.order.SellerOrderMapper;
  8 +import com.yohoufo.dal.order.StoredSellerMapper;
  9 +import com.yohoufo.dal.order.model.SellerOrder;
6 import com.yohoufo.dal.order.model.SellerOrderGoods; 10 import com.yohoufo.dal.order.model.SellerOrderGoods;
  11 +import com.yohoufo.dal.order.model.StoredSeller;
7 import com.yohoufo.dal.product.ProductMapper; 12 import com.yohoufo.dal.product.ProductMapper;
8 import com.yohoufo.dal.product.model.Product; 13 import com.yohoufo.dal.product.model.Product;
9 import com.yohoufo.inboxclient.model.InBoxResponse; 14 import com.yohoufo.inboxclient.model.InBoxResponse;
@@ -18,10 +23,7 @@ import org.springframework.beans.factory.annotation.Autowired; @@ -18,10 +23,7 @@ import org.springframework.beans.factory.annotation.Autowired;
18 import org.springframework.stereotype.Service; 23 import org.springframework.stereotype.Service;
19 24
20 import java.math.BigDecimal; 25 import java.math.BigDecimal;
21 -import java.util.Arrays;  
22 -import java.util.List;  
23 -import java.util.Optional;  
24 -import java.util.Set; 26 +import java.util.*;
25 import java.util.concurrent.ArrayBlockingQueue; 27 import java.util.concurrent.ArrayBlockingQueue;
26 import java.util.concurrent.ExecutorService; 28 import java.util.concurrent.ExecutorService;
27 import java.util.concurrent.ThreadPoolExecutor; 29 import java.util.concurrent.ThreadPoolExecutor;
@@ -49,6 +51,15 @@ public class InBoxFacade { @@ -49,6 +51,15 @@ public class InBoxFacade {
49 @Autowired 51 @Autowired
50 private ProductMapper productMapper; 52 private ProductMapper productMapper;
51 53
  54 + @Autowired
  55 + private IUFOSendService ufoSendService;
  56 +
  57 + @Autowired
  58 + private StoredSellerMapper storedSellerMapper;
  59 +
  60 + @Autowired
  61 + private SellerOrderMapper sellerOrderMapper;
  62 +
52 /********************************************************************* 63 /*********************************************************************
53 * 买家消息 和 短信 64 * 买家消息 和 短信
54 ********************************************************************/ 65 ********************************************************************/
@@ -970,6 +981,48 @@ public class InBoxFacade { @@ -970,6 +981,48 @@ public class InBoxFacade {
970 sellerUid, prdName, sizeName, resp); 981 sellerUid, prdName, sizeName, resp);
971 } 982 }
972 ); 983 );
  984 +
  985 +
  986 + noticeSellerUidList.stream().forEach( // 发送PUSH
  987 + sellerUid ->{
  988 + StoredSeller storedSeller = storedSellerMapper.selectValidByUid(sellerUid);
  989 + if (Objects.isNull(storedSeller)) {
  990 + SellerOrder sellerOrder = sellerOrderMapper.selectBySkup(sog.getId());
  991 +
  992 + String orderCode = Optional.ofNullable(sellerOrder).map(SellerOrder::getOrderCode).map(String::valueOf).orElse(null);
  993 +
  994 + /**
  995 + * 更低出售价提醒 商家未入驻
  996 + * @param uid
  997 + * @param productName 商品名称
  998 + * @param size 尺寸
  999 + * @param goodsNumber 货号
  1000 + * @param salePrice 提醒的更低售价
  1001 + * @param orderCode 订单编号
  1002 + * @return
  1003 + */
  1004 + ufoSendService.sendLessPrice(String.valueOf(sellerUid), product.getProductName(), sog.getSizeName(),
  1005 + product.getProductCode(), sog.getGoodsPrice().toPlainString(), orderCode);
  1006 + logger.info("personal seller record laster price send out push msg sellerUid【{}】 productName【{}】 SizeName【{}】 productCode【{}】 price【{}】 orderCode【{}】",
  1007 + sellerUid, product.getProductName(), sog.getSizeName(), product.getProductCode(), sog.getGoodsPrice(), orderCode);
  1008 + } else {
  1009 + /**
  1010 + * 更低出售价提醒 商家已入驻
  1011 + * @param uid
  1012 + * @param productName 商品名称
  1013 + * @param size 尺寸
  1014 + * @param goodsNumber 货号
  1015 + * @param salePrice 提醒的更低售价
  1016 + * @param productSkn 商品skn
  1017 + * @return
  1018 + */
  1019 + ufoSendService.sendLessPriceEnter(String.valueOf(sellerUid), product.getProductName(), sog.getSizeName(),
  1020 + product.getProductCode(), sog.getGoodsPrice().toPlainString(), String.valueOf(sog.getProductId()));
  1021 + logger.info("store seller record laster price send out push msg sellerUid【{}】 productName【{}】 SizeName【{}】 productCode【{}】 price【{}】 productId【{}】",
  1022 + sellerUid, product.getProductName(), sog.getSizeName(), product.getProductCode(), sog.getGoodsPrice(), sog.getProductId());
  1023 + }
  1024 + }
  1025 + );
973 }); 1026 });
974 } catch (Exception e) { 1027 } catch (Exception e) {
975 logger.warn("InBoxFacade noticeSellerWhenOtherChangePriceLower error inbox msg, noticeSellerUidList {}, sog {} ", noticeSellerUidList, sog, e); 1028 logger.warn("InBoxFacade noticeSellerWhenOtherChangePriceLower error inbox msg, noticeSellerUidList {}, sog {} ", noticeSellerUidList, sog, e);