Authored by mali

召回的短信通知

@@ -60,4 +60,11 @@ public interface DepositService { @@ -60,4 +60,11 @@ public interface DepositService {
60 * @param depositCode 60 * @param depositCode
61 */ 61 */
62 void clearCacheByDepositCode(Integer uid, String depositCode); 62 void clearCacheByDepositCode(Integer uid, String depositCode);
  63 +
  64 + /**
  65 + * 根据货号查询库存
  66 + * @param depositCode
  67 + * @return
  68 + */
  69 + StorageDeposit selectStorageDeposit(Integer uid, String depositCode);
63 } 70 }
@@ -7,20 +7,25 @@ import com.yohobuy.ufo.model.order.bo.OrderInfo; @@ -7,20 +7,25 @@ import com.yohobuy.ufo.model.order.bo.OrderInfo;
7 import com.yohobuy.ufo.model.order.common.OrderCodeType; 7 import com.yohobuy.ufo.model.order.common.OrderCodeType;
8 import com.yohobuy.ufo.model.order.common.OrderStatus; 8 import com.yohobuy.ufo.model.order.common.OrderStatus;
9 import com.yohobuy.ufo.model.order.constants.StorageDepositStatusEnum; 9 import com.yohobuy.ufo.model.order.constants.StorageDepositStatusEnum;
  10 +import com.yohoufo.dal.order.SellerOrderGoodsMapper;
10 import com.yohoufo.dal.order.model.DepositOrder; 11 import com.yohoufo.dal.order.model.DepositOrder;
11 import com.yohoufo.dal.order.model.EntrySellerRechargeOrder; 12 import com.yohoufo.dal.order.model.EntrySellerRechargeOrder;
  13 +import com.yohoufo.dal.order.model.SellerOrderGoods;
12 import com.yohoufo.dal.order.model.StorageDeposit; 14 import com.yohoufo.dal.order.model.StorageDeposit;
13 import com.yohoufo.order.model.request.PaymentRequest; 15 import com.yohoufo.order.model.request.PaymentRequest;
14 import com.yohoufo.order.model.response.PrepayResponse; 16 import com.yohoufo.order.model.response.PrepayResponse;
15 import com.yohoufo.order.service.AbstractOrderPaymentService; 17 import com.yohoufo.order.service.AbstractOrderPaymentService;
16 import com.yohoufo.order.service.DepositService; 18 import com.yohoufo.order.service.DepositService;
17 import com.yohoufo.order.service.deposit.DepositOrderService; 19 import com.yohoufo.order.service.deposit.DepositOrderService;
  20 +import com.yohoufo.order.service.proxy.InBoxFacade;
18 import org.slf4j.Logger; 21 import org.slf4j.Logger;
19 import org.slf4j.LoggerFactory; 22 import org.slf4j.LoggerFactory;
20 import org.springframework.beans.factory.annotation.Autowired; 23 import org.springframework.beans.factory.annotation.Autowired;
21 import org.springframework.stereotype.Service; 24 import org.springframework.stereotype.Service;
22 25
  26 +import javax.swing.text.html.Option;
23 import java.util.Objects; 27 import java.util.Objects;
  28 +import java.util.Optional;
24 29
25 @Service 30 @Service
26 public class DepositOrderPaymentService extends AbstractOrderPaymentService { 31 public class DepositOrderPaymentService extends AbstractOrderPaymentService {
@@ -32,6 +37,12 @@ public class DepositOrderPaymentService extends AbstractOrderPaymentService { @@ -32,6 +37,12 @@ public class DepositOrderPaymentService extends AbstractOrderPaymentService {
32 @Autowired 37 @Autowired
33 private DepositService depositService; 38 private DepositService depositService;
34 39
  40 + @Autowired
  41 + protected InBoxFacade inBoxFacade;
  42 +
  43 + @Autowired
  44 + private SellerOrderGoodsMapper sellerOrderGoodsMapper;
  45 +
35 @Override 46 @Override
36 public boolean isTimeoutCancelStatus(OrderInfo orderInfo) { 47 public boolean isTimeoutCancelStatus(OrderInfo orderInfo) {
37 return false; 48 return false;
@@ -151,6 +162,13 @@ public class DepositOrderPaymentService extends AbstractOrderPaymentService { @@ -151,6 +162,13 @@ public class DepositOrderPaymentService extends AbstractOrderPaymentService {
151 if (result != 1) { 162 if (result != 1) {
152 logger.error("depositService.changeStorageStatus find wrong, depositCode is {}, result is {}", depositOrder.getDepositCode(), result); 163 logger.error("depositService.changeStorageStatus find wrong, depositCode is {}, result is {}", depositOrder.getDepositCode(), result);
153 return; 164 return;
  165 + } else {
  166 + StorageDeposit deposit = depositService.selectStorageDeposit(depositOrder.getUid(), depositOrder.getDepositCode());
  167 +
  168 + SellerOrderGoods psog = Optional.ofNullable(deposit).map(StorageDeposit::getSkup)
  169 + .map(sellerOrderGoodsMapper::selectByPrimaryKey).orElse(null);
  170 +
  171 + inBoxFacade.recallDepositnotify(deposit.getOwnerUid(), psog); // 更新待拣货状态成功后,发通知
154 } 172 }
155 } 173 }
156 174
@@ -368,6 +368,15 @@ public class DepositServiceImpl implements DepositService { @@ -368,6 +368,15 @@ public class DepositServiceImpl implements DepositService {
368 } 368 }
369 369
370 /** 370 /**
  371 + * 根据货号查询库存
  372 + * @param depositCode
  373 + * @return
  374 + */
  375 + public StorageDeposit selectStorageDeposit(Integer uid, String depositCode) {
  376 + return storageDepositMapper.queryByDepositCode(uid, depositCode);
  377 + }
  378 +
  379 + /**
371 * Do 转 Vo 380 * Do 转 Vo
372 * @param storageDeposit 381 * @param storageDeposit
373 * @return 382 * @return
@@ -1789,6 +1789,41 @@ public class InBoxFacade { @@ -1789,6 +1789,41 @@ public class InBoxFacade {
1789 } 1789 }
1790 } 1790 }
1791 1791
  1792 + // 召回的
  1793 + public void recallDepositnotify(int uid, SellerOrderGoods sog) {
  1794 + if (null == sog) {
  1795 + logger.warn("InBoxFacade recallDepositnotify error SellerOrderGoods is null, uid {}", uid);
  1796 + return;
  1797 + }
  1798 + String prdName = sog.getProductName();
  1799 + String sizeName = sog.getSizeName();
  1800 + try {
  1801 + executorService.execute(()->{
  1802 + Product product = productMapper.selectByPrimaryKey(sog.getProductId());
  1803 + String productCode = product.getProductCode();
  1804 +
  1805 + InboxBusinessTypeEnum ibtOfSeller = InboxBusinessTypeEnum.NOTICE_SELLER_DEPOSIT_RECALL;
  1806 + String paramsOfSeller = buildParams(prdName, sizeName,productCode);
  1807 + InboxReqVO reqOfSeller = buildInboxReqVO(uid, paramsOfSeller, ibtOfSeller);
  1808 + InBoxResponse respOfSeller = inBoxSDK.addInbox(reqOfSeller);
  1809 + logger.info("record recallDepositnotify to seller inbox msg, uid {}, sog {} resp {}",
  1810 + uid, sog, respOfSeller);
  1811 +
  1812 + String phone = userProxyService.getMobile(uid);
  1813 + if (StringUtils.isBlank(phone)){
  1814 + logger.warn("in recallDepositnotify sms fail, uid {} sog {}", uid, sog);
  1815 + return;
  1816 + }
  1817 + List<String> mobileList = Arrays.asList(phone);
  1818 + String content= getReplacedContent(InboxBusinessTypeEnum.SMS_NOTIFY_SELLER_DEPOSIT_RECALL.getContent(),prdName, sizeName, productCode);
  1819 + sendSmsService.smsSendByMobile(content,mobileList);
  1820 + logger.info("record recallDepositnotify inbox sms msg, uid {}, sog {}", uid, sog);
  1821 + });
  1822 + } catch (Exception e) {
  1823 + logger.warn("InBoxFacade recallDepositnotify error inbox msg, uid {}, sog {}", uid, sog, e);
  1824 + }
  1825 + }
  1826 +
1792 public InboxReqVO buildInboxReqVO(int uid, String params, InboxBusinessTypeEnum ibt) { 1827 public InboxReqVO buildInboxReqVO(int uid, String params, InboxBusinessTypeEnum ibt) {
1793 InboxReqVO req = new InboxReqVO(); 1828 InboxReqVO req = new InboxReqVO();
1794 req.setType(ibt.getType()); 1829 req.setType(ibt.getType());