Authored by LUOXC

fixbug

... ... @@ -283,10 +283,10 @@ public class AppraiseService {
appraiseExpressInfoBo.getWayBillCode(),
appraiseExpressInfoBo.getDepotNum(),
appraiseExpressInfoBo.getMobile());
//清缓存
SellerOrderGoods sellerOrderGoods = cleanCacheAfterUpdateStatus(buyerOrder.getOrderCode(), buyerOrder.getUid(), buyerOrder.getSellerUid());
Product product = Optional.ofNullable(sellerOrderGoods).map(SellerOrderGoods::getProductId).map(productMapper::selectByPrimaryKey).orElse(null);
inBoxFacade.noticeBuyerWhenDeliveryDepositGoodsToBuyer(buyerOrder.getUid(), appraiseExpressInfoBo.getWayBillCode(), sellerOrderGoods, product);
// 通知买家已发货
inBoxFacade.noticeBuyerWhenDeliveryDepositGoodsToBuyer(buyerOrder.getUid(), appraiseExpressInfoBo.getWayBillCode(),
() -> cleanCacheAfterUpdateStatus(buyerOrder.getOrderCode(), buyerOrder.getUid(), buyerOrder.getSellerUid()),
sellerOrderGoods -> Optional.ofNullable(sellerOrderGoods).map(SellerOrderGoods::getProductId).map(productMapper::selectByPrimaryKey).orElse(null));
}else {
LOGGER.warn("in deliveryGoodsToBuyer, buyer Deposit Order orderCode {}", buyerOrder.getOrderCode());
throw new ServiceException(ServiceError.ORDER_STATUS_INVALIDATE);
... ...
... ... @@ -33,6 +33,8 @@ import java.util.concurrent.ArrayBlockingQueue;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;
import java.util.function.Function;
import java.util.function.Supplier;
/**
* Created by chenchao on 2018/10/8.
... ... @@ -220,14 +222,15 @@ public class InBoxFacade {
*
* @return
*/
public void noticeBuyerWhenDeliveryDepositGoodsToBuyer(int buyerUid, String wayBillCode, SellerOrderGoods psog,Product product) {
public void noticeBuyerWhenDeliveryDepositGoodsToBuyer(int buyerUid, String wayBillCode, Supplier<SellerOrderGoods> psogSupplier, Function<SellerOrderGoods,Product> productFunction) {
executorService.execute(()->{
try {
logger.info("record noticeBuyerWhenDeliveryGoodsToBuyer inbox msg, buyerUid {}, wayBillCode {}, psog {},SellerOrderGoods {} product {}",
SellerOrderGoods psog = psogSupplier.get();
Product product = productFunction.apply(psog);
logger.info("noticeBuyerWhenDeliveryDepositGoodsToBuyer, buyerUid {}, wayBillCode {}, psog {},SellerOrderGoods {} product {}",
buyerUid, wayBillCode, psog, JSON.toJSONString(psog), JSON.toJSONString(product));
String skupTypeText=SkupType.getSkupType(psog.getAttributes()).attrName();
String prdName = psog.getProductName();
String sizeName = psog.getSizeName();
String productCode = Optional.ofNullable(product).map(Product::getProductCode).orElse("");
... ... @@ -237,24 +240,23 @@ public class InBoxFacade {
InboxReqVO req = buildInboxReqVO(buyerUid, params, ibt);
InBoxResponse resp = inBoxSDK.addInbox(req);
logger.info("record noticeBuyerWhenDeliveryGoodsToBuyer inbox msg, buyerUid {}, wayBillCode {}, prdName {},SellerOrderGoods {} resp {}",
logger.info("noticeBuyerWhenDeliveryDepositGoodsToBuyer, buyerUid {}, wayBillCode {}, prdName {},SellerOrderGoods {} resp {}",
buyerUid, wayBillCode, prdName, JSON.toJSONString(psog), resp);
//短信
String phone = userProxyService.getMobile(buyerUid);
if (StringUtils.isBlank(phone)){
logger.warn("in noticeBuyerWhenDeliveryGoodsToBuyer notice buyer sms fail, buyerUid {} wayBillCode {} prdName {} ",
logger.warn("noticeBuyerWhenDeliveryDepositGoodsToBuyer notice buyer sms fail, buyerUid {} wayBillCode {} prdName {} ",
buyerUid, wayBillCode,prdName);
}else{
List<String> mobileList = Arrays.asList(phone);
String content = getReplacedContent(InboxBusinessTypeEnum.SMS_NOTICE_BUYER_WHEN_DEPOSIT_GOODS_PURCHASE_SENDED.getContent(),prdName,sizeName,productCode,wayBillCode);
sendSmsService.smsSendByMobile(content,mobileList);
logger.info("record noticeBuyerWhenDeliveryGoodsToBuyer notice buyer sms msg, buyerUid {}, wayBillCode {}, prdName {} phone {}",
logger.info("noticeBuyerWhenDeliveryDepositGoodsToBuyer notice buyer sms msg, buyerUid {}, wayBillCode {}, prdName {} phone {}",
buyerUid, wayBillCode,prdName, phone);
}
} catch (Exception e) {
logger.warn("InBoxFacade noticeBuyerWhenDeliveryGoodsToBuyer error inbox msg, buyerUid {}, wayBillCode {} ,psog {}",
buyerUid, wayBillCode, psog, e);
logger.warn("noticeBuyerWhenDeliveryDepositGoodsToBuyer fail, buyerUid {}, wayBillCode {}", buyerUid, wayBillCode, e);
}
});
... ...