|
|
package com.yohoufo.order.service.proxy;
|
|
|
|
|
|
import com.alibaba.fastjson.JSON;
|
|
|
import com.yoho.message.sdk.common.model.SendMessageRspBo;
|
|
|
import com.yoho.message.sdk.service.ufo.IUFOSendService;
|
|
|
import com.yohobuy.ufo.model.enums.InboxBusinessTypeEnum;
|
|
|
import com.yohobuy.ufo.model.order.common.SuperEnterStageLevel;
|
|
|
import com.yohoufo.dal.order.SellerOrderMapper;
|
|
|
import com.yohoufo.dal.order.StoredSellerMapper;
|
|
|
import com.yohoufo.dal.order.model.SellerOrder;
|
|
|
import com.yohoufo.dal.order.model.SellerOrderGoods;
|
|
|
import com.yohoufo.dal.order.model.StoredSeller;
|
|
|
import com.yohoufo.dal.product.ProductMapper;
|
|
|
import com.yohoufo.dal.product.model.Product;
|
|
|
import com.yohoufo.inboxclient.model.InBoxResponse;
|
|
|
import com.yohoufo.inboxclient.model.InboxReqVO;
|
|
|
import com.yohoufo.inboxclient.sdk.InBoxSDK;
|
|
|
import com.yohoufo.order.service.impl.function.BuyerNoticeSender;
|
|
|
import com.yohoufo.order.utils.PaymentHelper;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
import org.slf4j.Logger;
|
|
|
import org.slf4j.LoggerFactory;
|
...
|
...
|
@@ -23,7 +23,10 @@ import org.springframework.beans.factory.annotation.Autowired; |
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
import java.math.BigDecimal;
|
|
|
import java.util.*;
|
|
|
import java.util.Arrays;
|
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
|
import java.util.Optional;
|
|
|
import java.util.concurrent.ArrayBlockingQueue;
|
|
|
import java.util.concurrent.ExecutorService;
|
|
|
import java.util.concurrent.ThreadPoolExecutor;
|
...
|
...
|
@@ -52,13 +55,10 @@ public class InBoxFacade { |
|
|
private ProductMapper productMapper;
|
|
|
|
|
|
@Autowired
|
|
|
private IUFOSendService ufoSendService;
|
|
|
|
|
|
@Autowired
|
|
|
private StoredSellerMapper storedSellerMapper;
|
|
|
private SellerOrderMapper sellerOrderMapper;
|
|
|
|
|
|
@Autowired
|
|
|
private SellerOrderMapper sellerOrderMapper;
|
|
|
private IUFOSendService ufoSendService;
|
|
|
|
|
|
/*********************************************************************
|
|
|
* 买家消息 和 短信
|
...
|
...
|
@@ -961,72 +961,86 @@ public class InBoxFacade { |
|
|
* 更低的出价提醒
|
|
|
* @param sog
|
|
|
*/
|
|
|
public void noticeSellerWhenOtherChangePriceLower(SellerOrderGoods sog,Set<Integer> noticeSellerUidList){
|
|
|
public void noticeSellerWhenOtherChangePriceLower(SellerOrderGoods sog,Map<Integer,SellerOrderGoods> noticeSellerMap){
|
|
|
String prdName = sog.getProductName();
|
|
|
String sizeName = sog.getSizeName();
|
|
|
try {
|
|
|
executorService.execute(() -> {
|
|
|
// 发站内信
|
|
|
logger.info("record noticeSellerWhenOtherChangePriceLower for seller,noticeSellerUidList {}, sog {}", noticeSellerUidList, sog);
|
|
|
logger.info("record noticeSellerWhenOtherChangePriceLower for seller,noticeSellerMap {}, sog {}", noticeSellerMap, sog);
|
|
|
|
|
|
Product product = productMapper.selectByPrimaryKey(sog.getProductId());
|
|
|
String productCode = product.getProductCode();
|
|
|
String params = buildParams(prdName, sizeName,productCode,sog.getGoodsPrice().toPlainString());
|
|
|
|
|
|
noticeSellerUidList.stream().forEach(
|
|
|
sellerUid ->{
|
|
|
InboxReqVO req = buildInboxReqVO(sellerUid, params, InboxBusinessTypeEnum.NOTICE_SELLER_WHEN_OTHER_LOWER_PRICE);
|
|
|
InBoxResponse resp = inBoxSDK.addInbox(req);
|
|
|
logger.info("record seller sham send out inbox msg,sellerUid {}, prdName {},sizeName {} resp {}",
|
|
|
sellerUid, prdName, sizeName, resp);
|
|
|
}
|
|
|
);
|
|
|
|
|
|
|
|
|
noticeSellerUidList.stream().forEach( // 发送PUSH
|
|
|
sellerUid ->{
|
|
|
StoredSeller storedSeller = storedSellerMapper.selectValidByUid(sellerUid);
|
|
|
if (Objects.isNull(storedSeller)) {
|
|
|
SellerOrder sellerOrder = sellerOrderMapper.selectBySkup(sog.getId());
|
|
|
|
|
|
String orderCode = Optional.ofNullable(sellerOrder).map(SellerOrder::getOrderCode).map(String::valueOf).orElse(null);
|
|
|
|
|
|
/**
|
|
|
* 更低出售价提醒 商家未入驻
|
|
|
* @param uid
|
|
|
* @param productName 商品名称
|
|
|
* @param size 尺寸
|
|
|
* @param goodsNumber 货号
|
|
|
* @param salePrice 提醒的更低售价
|
|
|
* @param orderCode 订单编号
|
|
|
* @return
|
|
|
*/
|
|
|
ufoSendService.sendLessPrice(String.valueOf(sellerUid), product.getProductName(), sog.getSizeName(),
|
|
|
product.getProductCode(), sog.getGoodsPrice().toPlainString(), orderCode);
|
|
|
logger.info("personal seller record laster price send out push msg sellerUid【{}】 productName【{}】 SizeName【{}】 productCode【{}】 price【{}】 orderCode【{}】",
|
|
|
sellerUid, product.getProductName(), sog.getSizeName(), product.getProductCode(), sog.getGoodsPrice(), orderCode);
|
|
|
} else {
|
|
|
/**
|
|
|
* 更低出售价提醒 商家已入驻
|
|
|
* @param uid
|
|
|
* @param productName 商品名称
|
|
|
* @param size 尺寸
|
|
|
* @param goodsNumber 货号
|
|
|
* @param salePrice 提醒的更低售价
|
|
|
* @param productSkn 商品skn
|
|
|
* @return
|
|
|
*/
|
|
|
ufoSendService.sendLessPriceEnter(String.valueOf(sellerUid), product.getProductName(), sog.getSizeName(),
|
|
|
product.getProductCode(), sog.getGoodsPrice().toPlainString(), String.valueOf(sog.getProductId()));
|
|
|
logger.info("store seller record laster price send out push msg sellerUid【{}】 productName【{}】 SizeName【{}】 productCode【{}】 price【{}】 productId【{}】",
|
|
|
sellerUid, product.getProductName(), sog.getSizeName(), product.getProductCode(), sog.getGoodsPrice(), sog.getProductId());
|
|
|
}
|
|
|
}
|
|
|
);
|
|
|
String noticePrice = sog.getGoodsPrice().toPlainString();
|
|
|
String params = buildParams(prdName, sizeName,productCode,noticePrice);
|
|
|
for(Integer sellerUid:noticeSellerMap.keySet()){
|
|
|
SellerOrderGoods currSog = noticeSellerMap.get(sellerUid);
|
|
|
//发消息
|
|
|
InboxReqVO req = buildInboxReqVO(sellerUid, params, InboxBusinessTypeEnum.NOTICE_SELLER_WHEN_OTHER_LOWER_PRICE);
|
|
|
InBoxResponse resp = inBoxSDK.addInbox(req);
|
|
|
logger.info("record noticeSellerWhenOtherChangePriceLower for seller send msg ,seller uid {} resp {} noticeSellerMap {}, sog {}", sellerUid,resp,noticeSellerMap, sog);
|
|
|
//发push
|
|
|
SellerOrder currSellerOrder = sellerOrderMapper.selectBySkup(currSog.getId());
|
|
|
if(currSellerOrder==null){
|
|
|
logger.warn("InBoxFacade noticeSellerWhenOtherChangePriceLower error sellerOrder is null,skup {}, noticeSellerMap {}, sog {} ",noticeSellerMap.get(sellerUid).getId(), noticeSellerMap, sog);
|
|
|
return ;
|
|
|
}
|
|
|
SendMessageRspBo bo=null;
|
|
|
if(PaymentHelper.isWallet(currSellerOrder.getPayment())){
|
|
|
//入驻
|
|
|
bo = ufoSendService.sendLessPriceEnter(String.valueOf(sellerUid), prdName,sizeName,productCode,noticePrice, String.valueOf(currSog.getProductId()));
|
|
|
logger.info("record noticeSellerWhenOtherChangePriceLower push enter seller uid is {}, product id is {}, result is {}", sellerUid, currSog.getProductId(), bo);
|
|
|
}else{
|
|
|
bo = ufoSendService.sendLessPrice(String.valueOf(sellerUid), prdName,sizeName,productCode,noticePrice, String.valueOf(currSellerOrder.getOrderCode()));
|
|
|
logger.info("record noticeSellerWhenOtherChangePriceLower push non enter seller uid is {}, seller order code is {}, result is {}", sellerUid, currSellerOrder.getOrderCode(), bo);
|
|
|
}
|
|
|
}
|
|
|
logger.info("record noticeSellerWhenOtherChangePriceLower for seller end,noticeSellerMap {}, sog {}", noticeSellerMap, sog);
|
|
|
|
|
|
});
|
|
|
} catch (Exception e) {
|
|
|
logger.warn("InBoxFacade noticeSellerWhenOtherChangePriceLower error inbox msg, noticeSellerUidList {}, sog {} ", noticeSellerUidList, sog, e);
|
|
|
logger.warn("InBoxFacade noticeSellerWhenOtherChangePriceLower error inbox msg, noticeSellerMap {}, sog {} ", noticeSellerMap, sog, e);
|
|
|
}
|
|
|
/*noticeSellerUidList.stream().forEach( // 发送PUSH
|
|
|
sellerUid ->{
|
|
|
StoredSeller storedSeller = storedSellerMapper.selectValidByUid(sellerUid);
|
|
|
if (Objects.isNull(storedSeller)) {
|
|
|
SellerOrder sellerOrder = sellerOrderMapper.selectBySkup(sog.getId());
|
|
|
|
|
|
String orderCode = Optional.ofNullable(sellerOrder).map(SellerOrder::getOrderCode).map(String::valueOf).orElse(null);
|
|
|
|
|
|
|
|
|
* 更低出售价提醒 商家未入驻
|
|
|
* @param uid
|
|
|
* @param productName 商品名称
|
|
|
* @param size 尺寸
|
|
|
* @param goodsNumber 货号
|
|
|
* @param salePrice 提醒的更低售价
|
|
|
* @param orderCode 订单编号
|
|
|
* @return
|
|
|
|
|
|
ufoSendService.sendLessPrice(String.valueOf(sellerUid), product.getProductName(), sog.getSizeName(),
|
|
|
product.getProductCode(), sog.getGoodsPrice().toPlainString(), orderCode);
|
|
|
logger.info("personal seller record laster price send out push msg sellerUid【{}】 productName【{}】 SizeName【{}】 productCode【{}】 price【{}】 orderCode【{}】",
|
|
|
sellerUid, product.getProductName(), sog.getSizeName(), product.getProductCode(), sog.getGoodsPrice(), orderCode);
|
|
|
} else {
|
|
|
|
|
|
* 更低出售价提醒 商家已入驻
|
|
|
* @param uid
|
|
|
* @param productName 商品名称
|
|
|
* @param size 尺寸
|
|
|
* @param goodsNumber 货号
|
|
|
* @param salePrice 提醒的更低售价
|
|
|
* @param productSkn 商品skn
|
|
|
* @return
|
|
|
|
|
|
ufoSendService.sendLessPriceEnter(String.valueOf(sellerUid), product.getProductName(), sog.getSizeName(),
|
|
|
product.getProductCode(), sog.getGoodsPrice().toPlainString(), String.valueOf(sog.getProductId()));
|
|
|
logger.info("store seller record laster price send out push msg sellerUid【{}】 productName【{}】 SizeName【{}】 productCode【{}】 price【{}】 productId【{}】",
|
|
|
sellerUid, product.getProductName(), sog.getSizeName(), product.getProductCode(), sog.getGoodsPrice(), sog.getProductId());
|
|
|
}
|
|
|
}
|
|
|
);*/
|
|
|
}
|
|
|
|
|
|
/*********************************************************************
|
...
|
...
|
|