Authored by LUOXC

fixbug

... ... @@ -67,6 +67,9 @@ public class BuyerOrderPaymentService extends AbstractOrderPaymentService {
BuyerNoticeFacade buyerNoticeFacade;
@Autowired
SellerNoticeFacade sellerNoticeFacade;
@Autowired
private BuyerOrderGoodsMapper buyerOrderGoodsMapper;
@Autowired
... ... @@ -204,31 +207,9 @@ public class BuyerOrderPaymentService extends AbstractOrderPaymentService {
* @param sellerOrderGoods
*/
private void processDepositOrderOfQuickDeliverGoods(BuyerOrder buyerOrder, SellerOrderGoods sellerOrderGoods){
Integer buyerUid = buyerOrder.getUid();
Long orderCode = buyerOrder.getOrderCode();
inBoxFacade.noticeWhenDepositOrderOfQuickDeliverGoodsPaid(buyerOrder, sellerOrderGoods);
// 插入物流调拨信息
buyerOrderExpressInfoService.addExpressInfo4DepositGoods(buyerOrder);
/*
expressInfoService.saveOperateTransferExpressInfo(OperateTransferExpressInfo.builder()
.uid(buyerUid)
.orderCode(orderCode)
.expressType(EXPRESS_TYPE_JUDGE_CENTER)
.operateTransferCode(platform_receive)
.build());
expressInfoService.saveOperateTransferExpressInfo(OperateTransferExpressInfo.builder()
.uid(buyerUid)
.orderCode(orderCode)
.expressType(EXPRESS_TYPE_JUDGE_CENTER)
.operateTransferCode(judge_pass)
.build());
expressInfoService.saveOperateTransferExpressInfo(OperateTransferExpressInfo.builder()
.uid(buyerUid)
.orderCode(orderCode)
.expressType(EnumExpressType.EXPRESS_TYPE_2)
.operateTransferCode(EnumExpressDataOperateTransferCode.GOODS_DEPOSIT_IN_STORE)
.build());
*/
}
private void processDepositOrderOfInstockGoods(BuyerOrder buyerOrder, SellerOrderGoods sellerOrderGoods){
... ... @@ -267,11 +248,10 @@ public class BuyerOrderPaymentService extends AbstractOrderPaymentService {
private void processFastDelivery(BuyerOrder orderInfo, SellerOrderGoods sellerOrderGoods){
// 通知买家支付成功
inBoxFacade.buyerPaidFastDelivery(sellerOrderGoods, orderInfo);
buyerNoticeFacade.buyerPaidFastDelivery(sellerOrderGoods, orderInfo);
// 提醒卖家发货
long orderCode = orderInfo.getOrderCode();
inBoxFacade.sellerSkupPaidByBuyerFastDelivery(sellerOrderGoods, orderInfo);
sellerNoticeFacade.sellerSkupPaidByBuyerFastDelivery(sellerOrderGoods, orderInfo);
}
... ...
... ... @@ -909,7 +909,7 @@ public class AppraiseService {
//瑕疵不接受(用户不接受和超时不接受),只给买家发消息
buyerNoticeFacade.miniFaultUnAccept(buyerOrder, sellerOrderGoods, outTimeFlag);
inBoxFacade.sellerMiniFaultUnAccept(sellerOrderGoods, orderCode, outTimeFlag);
sellerNoticeFacade.sellerMiniFaultUnAccept(sellerOrderGoods, orderCode, outTimeFlag);
} catch (Exception ex) {
LOGGER.warn("in miniFaultReject orderStatusFlowService or notice fail orderCode {}", orderCode, ex);
... ...
package com.yohoufo.order.service.proxy;
import com.alibaba.fastjson.JSON;
import com.yoho.message.sdk.common.constants.UFOMessageScene;
import com.yoho.message.sdk.service.ufo.IUFOSendService;
import com.yoho.message.sdk.service.ufo.UFOMessageService;
... ... @@ -10,14 +11,19 @@ import com.yohoufo.dal.order.model.BuyerOrder;
import com.yohoufo.dal.order.model.SellerOrderGoods;
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.order.service.impl.function.BuyerNoticeSender;
import lombok.NonNull;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Arrays;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Optional;
import java.util.function.Function;
import java.util.function.Supplier;
... ... @@ -564,5 +570,30 @@ public class BuyerNoticeFacade extends BaseNoticeFacade {
}
}
/**
* 提醒买家支付成功&卖家已经发货
*
* @param sog sog
* @param buyerOrder
*/
public void buyerPaidFastDelivery(SellerOrderGoods sog, BuyerOrder buyerOrder) {
Integer uid = buyerOrder.getUid();
String prdName = sog.getProductName();
String sizeName = sog.getSizeName();
long orderCode = buyerOrder.getOrderCode();
try {
String goodsTypeTag = buildGoodsTypeTag(sog, buyerOrder, TabType.BUY);
Product product = productMapper.selectByPrimaryKey(sog.getProductId());
String productCode = product.getProductCode();
newBuyerNotice(buyerOrder)
.withLogPrefix("buyer paid fast delivery")
.withInBox(InboxBusinessTypeEnum.FAST_DELIVERY_NOTIFIED_SELLER, orderCode)
.withSms(InboxBusinessTypeEnum.SMS_NOTICE_BUYER_WHEN_SELLER_DELIVER, goodsTypeTag, prdName, sizeName, productCode, orderCode)
.send();
} catch (Exception e) {
log.warn("buyer paid fast delivery fail, uid {}, orderCode {} ",uid, orderCode, e);
}
}
}
... ...
... ... @@ -120,128 +120,15 @@ public class InBoxFacade extends BaseNoticeFacade{
}
}
/**
* 瑕疵不接受,卖家消息
*/
public void sellerMiniFaultUnAccept(SellerOrderGoods sog,long orderCode,boolean outTimeFlag) {
Integer sellerUid = sog.getUid();
String prdName = sog.getProductName();
String sizeName = sog.getSizeName();
String goodsTypeTag = buildGoodsTypeTagForSeller(sog);
boolean isFastDelivery = fastDeliveryProxyService.isFastDeliveryGoods(sog.getId());
try {
executorService.execute(() -> {
Product product = productMapper.selectByPrimaryKey(sog.getProductId());
String productCode = product.getProductCode();
InboxBusinessTypeEnum ibt = InboxBusinessTypeEnum.NOTICE_SELLER_WHEN_MINI_FAULT_UN_ACCEPT;
if(outTimeFlag){
ibt = InboxBusinessTypeEnum.NOTICE_SELLER_WHEN_MINI_FAULT_UN_ACCEPT_OUT_TIME;
}
String params = buildParams(goodsTypeTag,prdName, sizeName,productCode);
InboxReqVO req = buildInboxReqVO(sellerUid, params, ibt);
InBoxResponse resp = inBoxSDK.addInbox(req);
log.info("record sellerMiniFaultUnAccept inbox msg, SellerOrderGoods {} ,sellerUid {}, prdName {}, sizeName {},resp {}",
JSON.toJSONString(sog),sellerUid, prdName, sizeName, resp);
if (!isFastDelivery){
//短信
String phone = userProxyService.getMobile(sellerUid);
if (StringUtils.isBlank(phone)){
log.warn("sellerMiniFaultUnAccept sms send fail,sellerUid {}, prdName {}", sellerUid, prdName);
return;
}
List<String> mobileList = Arrays.asList(phone);
InboxBusinessTypeEnum sms=InboxBusinessTypeEnum.SMS_NOTICE_SELLER_WHEN_MINI_FAULT_UN_ACCEPT;
if(outTimeFlag){
sms = InboxBusinessTypeEnum.SMS_NOTICE_SELLER_WHEN_MINI_FAULT_UN_ACCEPT_OUT_TIME;
}
String content = getReplacedContent(sms.getContent(),goodsTypeTag,prdName,sizeName,productCode,orderCode);
sendSmsService.smsSendByMobile(content, mobileList);
log.info("record sellerMiniFaultUnAccept inbox sms msg,sellerUid {}, prdName {},orderCode {}",
sellerUid, prdName,orderCode);
}
});
} catch (Exception e) {
log.warn("InBoxFacade sellerMiniFaultUnAccept error inbox msg, sellerUid {}, prdName {} ",
sellerUid, prdName, e);
}
}
/**
* 提醒买家支付成功&卖家已经发货
*
* @param sog SellerOrderGoods
* @param buyerOrder
*/
public void buyerPaidFastDelivery(SellerOrderGoods sog, BuyerOrder buyerOrder) {
Integer uid = buyerOrder.getUid();
String prdName = sog.getProductName();
String sizeName = sog.getSizeName();
long orderCode = buyerOrder.getOrderCode();
try {
executorService.execute(() -> {
// 买家支付成功通知
InboxBusinessTypeEnum ibt = InboxBusinessTypeEnum.FAST_DELIVERY_NOTIFIED_SELLER;
String params = buildParams(orderCode);
InboxReqVO req = buildInboxReqVO(uid, params, ibt);
InBoxResponse resp = inBoxSDK.addInbox(req);
log.info("buyerPaidFastDelivery buyer paied orderCode {}, resp {}", orderCode, JSON.toJSONString(resp));
String goodsTypeTag = buildGoodsTypeTag(sog, buyerOrder, TabType.BUY);
Product product = productMapper.selectByPrimaryKey(sog.getProductId());
String productCode = product.getProductCode();
//短信
String phone = userProxyService.getMobile(uid);
if (StringUtils.isBlank(phone)){
log.warn("buyerPaidFastDelivery sms send fail,sellerUid {}, prdName {}",uid, prdName);
return;
}
List<String> mobileList = Arrays.asList(phone);
String content = getReplacedContent(InboxBusinessTypeEnum.SMS_NOTICE_BUYER_WHEN_SELLER_DELIVER.getContent(),
goodsTypeTag, prdName, sizeName, productCode, orderCode);
sendSmsService.smsSendByMobile(content, mobileList);
log.info("record buyerPaidFastDelivery inbox sms msg, uid {},orderCode {}", uid, orderCode);
});
} catch (Exception e) {
log.warn("InBoxFacade buyerPaidFastDelivery error inbox msg, uid {}, orderCode {} ",uid, orderCode, e);
}
}
/**
* 卖家发货提醒,买家支付购买后
*
* @param sog
*/
public void sellerSkupPaidByBuyerFastDelivery(SellerOrderGoods sog, BuyerOrder orderInfo) {
String logPrefix = "seller skup paid by buyer fast delivery";
Integer sellerUid = sog.getUid();
String prdName = sog.getProductName();
String sizeName = sog.getSizeName();
try {
String goodsTypeTag = buildGoodsTypeTag(sog, orderInfo, TabType.SELL);
Product product = productMapper.selectByPrimaryKey(sog.getProductId());
String productCode = product.getProductCode();
newSellerNotice(sog)
.withLogPrefix(logPrefix)
.withInBox(InboxBusinessTypeEnum.FAST_DELIVERY_SALE_SEND, goodsTypeTag, prdName, sizeName, productCode)
.send();
} catch (Exception e) {
log.warn("{} fail, sellerUid {}, prdName {} ", logPrefix, sellerUid, prdName, e);
}
}
/**
* 卖家发货提醒,买家支付购买后
... ...
... ... @@ -660,4 +660,56 @@ public class SellerNoticeFacade extends BaseNoticeFacade {
}
}
/**
* 瑕疵不接受,卖家消息
*/
public void sellerMiniFaultUnAccept(SellerOrderGoods sog, long orderCode, boolean outTimeFlag) {
Integer sellerUid = sog.getUid();
String prdName = sog.getProductName();
String sizeName = sog.getSizeName();
String goodsTypeTag = buildGoodsTypeTagForSeller(sog);
try {
boolean isFastDelivery = fastDeliveryProxyService.isFastDeliveryGoods(sog.getId());
Product product = productMapper.selectByPrimaryKey(sog.getProductId());
String productCode = product.getProductCode();
InboxBusinessTypeEnum ibt = InboxBusinessTypeEnum.NOTICE_SELLER_WHEN_MINI_FAULT_UN_ACCEPT;
InboxBusinessTypeEnum sms = InboxBusinessTypeEnum.SMS_NOTICE_SELLER_WHEN_MINI_FAULT_UN_ACCEPT;
if (outTimeFlag) {
ibt = InboxBusinessTypeEnum.NOTICE_SELLER_WHEN_MINI_FAULT_UN_ACCEPT_OUT_TIME;
sms = InboxBusinessTypeEnum.SMS_NOTICE_SELLER_WHEN_MINI_FAULT_UN_ACCEPT_OUT_TIME;
}
newSellerNotice(sog)
.withLogPrefix("seller mini fault un accept")
.withInBox(ibt, goodsTypeTag, prdName, sizeName, productCode)
.withSmsIf(!isFastDelivery, sms, goodsTypeTag, prdName, sizeName, productCode, orderCode)
.send();
} catch (Exception e) {
log.warn("seller mini fault un accept fail, sellerUid {}, prdName {} ", sellerUid, prdName, e);
}
}
/**
* 卖家发货提醒,买家支付购买后
*
* @param sog
*/
public void sellerSkupPaidByBuyerFastDelivery(SellerOrderGoods sog, BuyerOrder orderInfo) {
String logPrefix = "seller skup paid by buyer fast delivery";
Integer sellerUid = sog.getUid();
String prdName = sog.getProductName();
String sizeName = sog.getSizeName();
try {
String goodsTypeTag = buildGoodsTypeTag(sog, orderInfo, TabType.SELL);
Product product = productMapper.selectByPrimaryKey(sog.getProductId());
String productCode = product.getProductCode();
newSellerNotice(sog)
.withLogPrefix(logPrefix)
.withInBox(InboxBusinessTypeEnum.FAST_DELIVERY_SALE_SEND, goodsTypeTag, prdName, sizeName, productCode)
.send();
} catch (Exception e) {
log.warn("{} fail, sellerUid {}, prdName {} ", logPrefix, sellerUid, prdName, e);
}
}
}
... ...