Authored by mali

召回的短信通知

... ... @@ -60,4 +60,11 @@ public interface DepositService {
* @param depositCode
*/
void clearCacheByDepositCode(Integer uid, String depositCode);
/**
* 根据货号查询库存
* @param depositCode
* @return
*/
StorageDeposit selectStorageDeposit(Integer uid, String depositCode);
}
... ...
... ... @@ -7,20 +7,25 @@ import com.yohobuy.ufo.model.order.bo.OrderInfo;
import com.yohobuy.ufo.model.order.common.OrderCodeType;
import com.yohobuy.ufo.model.order.common.OrderStatus;
import com.yohobuy.ufo.model.order.constants.StorageDepositStatusEnum;
import com.yohoufo.dal.order.SellerOrderGoodsMapper;
import com.yohoufo.dal.order.model.DepositOrder;
import com.yohoufo.dal.order.model.EntrySellerRechargeOrder;
import com.yohoufo.dal.order.model.SellerOrderGoods;
import com.yohoufo.dal.order.model.StorageDeposit;
import com.yohoufo.order.model.request.PaymentRequest;
import com.yohoufo.order.model.response.PrepayResponse;
import com.yohoufo.order.service.AbstractOrderPaymentService;
import com.yohoufo.order.service.DepositService;
import com.yohoufo.order.service.deposit.DepositOrderService;
import com.yohoufo.order.service.proxy.InBoxFacade;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import javax.swing.text.html.Option;
import java.util.Objects;
import java.util.Optional;
@Service
public class DepositOrderPaymentService extends AbstractOrderPaymentService {
... ... @@ -32,6 +37,12 @@ public class DepositOrderPaymentService extends AbstractOrderPaymentService {
@Autowired
private DepositService depositService;
@Autowired
protected InBoxFacade inBoxFacade;
@Autowired
private SellerOrderGoodsMapper sellerOrderGoodsMapper;
@Override
public boolean isTimeoutCancelStatus(OrderInfo orderInfo) {
return false;
... ... @@ -151,6 +162,13 @@ public class DepositOrderPaymentService extends AbstractOrderPaymentService {
if (result != 1) {
logger.error("depositService.changeStorageStatus find wrong, depositCode is {}, result is {}", depositOrder.getDepositCode(), result);
return;
} else {
StorageDeposit deposit = depositService.selectStorageDeposit(depositOrder.getUid(), depositOrder.getDepositCode());
SellerOrderGoods psog = Optional.ofNullable(deposit).map(StorageDeposit::getSkup)
.map(sellerOrderGoodsMapper::selectByPrimaryKey).orElse(null);
inBoxFacade.recallDepositnotify(deposit.getOwnerUid(), psog); // 更新待拣货状态成功后,发通知
}
}
... ...
... ... @@ -368,6 +368,15 @@ public class DepositServiceImpl implements DepositService {
}
/**
* 根据货号查询库存
* @param depositCode
* @return
*/
public StorageDeposit selectStorageDeposit(Integer uid, String depositCode) {
return storageDepositMapper.queryByDepositCode(uid, depositCode);
}
/**
* Do 转 Vo
* @param storageDeposit
* @return
... ...
... ... @@ -1789,6 +1789,41 @@ public class InBoxFacade {
}
}
// 召回的
public void recallDepositnotify(int uid, SellerOrderGoods sog) {
if (null == sog) {
logger.warn("InBoxFacade recallDepositnotify error SellerOrderGoods is null, uid {}", uid);
return;
}
String prdName = sog.getProductName();
String sizeName = sog.getSizeName();
try {
executorService.execute(()->{
Product product = productMapper.selectByPrimaryKey(sog.getProductId());
String productCode = product.getProductCode();
InboxBusinessTypeEnum ibtOfSeller = InboxBusinessTypeEnum.NOTICE_SELLER_DEPOSIT_RECALL;
String paramsOfSeller = buildParams(prdName, sizeName,productCode);
InboxReqVO reqOfSeller = buildInboxReqVO(uid, paramsOfSeller, ibtOfSeller);
InBoxResponse respOfSeller = inBoxSDK.addInbox(reqOfSeller);
logger.info("record recallDepositnotify to seller inbox msg, uid {}, sog {} resp {}",
uid, sog, respOfSeller);
String phone = userProxyService.getMobile(uid);
if (StringUtils.isBlank(phone)){
logger.warn("in recallDepositnotify sms fail, uid {} sog {}", uid, sog);
return;
}
List<String> mobileList = Arrays.asList(phone);
String content= getReplacedContent(InboxBusinessTypeEnum.SMS_NOTIFY_SELLER_DEPOSIT_RECALL.getContent(),prdName, sizeName, productCode);
sendSmsService.smsSendByMobile(content,mobileList);
logger.info("record recallDepositnotify inbox sms msg, uid {}, sog {}", uid, sog);
});
} catch (Exception e) {
logger.warn("InBoxFacade recallDepositnotify error inbox msg, uid {}, sog {}", uid, sog, e);
}
}
public InboxReqVO buildInboxReqVO(int uid, String params, InboxBusinessTypeEnum ibt) {
InboxReqVO req = new InboxReqVO();
req.setType(ibt.getType());
... ...