Authored by LUOXC

refactor

... ... @@ -8,6 +8,7 @@ import com.yohobuy.ufo.model.order.common.OrderStatus;
import com.yohobuy.ufo.model.order.common.TabType;
import com.yohoufo.order.event.NotPaidNoticeEvent;
import com.yohoufo.order.mq.TopicConstants;
import com.yohoufo.order.service.proxy.BuyerNoticeFacade;
import com.yohoufo.order.service.proxy.InBoxFacade;
import com.yohoufo.order.utils.LoggerUtils;
import org.slf4j.Logger;
... ... @@ -28,6 +29,9 @@ public class NotPaidNoticeDelayMsgConsumer implements YhConsumer {
private InBoxFacade inBoxFacade;
@Autowired
private BuyerNoticeFacade buyerNoticeFacade;
@Autowired
private BuyerOrderMapper buyerOrderMapper;
... ... @@ -56,7 +60,7 @@ public class NotPaidNoticeDelayMsgConsumer implements YhConsumer {
}
if(OrderStatus.WAITING_PAY.getCode() == buyerOrder.getStatus()){
logger.info("in {}, msg {}, status {}", topic, event, buyerOrder.getStatus());
inBoxFacade.buyerOrderNotPayed(event.getUid(), event.getOrderCode());
buyerNoticeFacade.buyerOrderNotPayed(event.getUid(), event.getOrderCode());
}
break;
}
... ...
... ... @@ -34,6 +34,7 @@ import com.yohoufo.order.service.impl.OrderOverTimeService;
import com.yohoufo.order.service.impl.TradeBillsService;
import com.yohoufo.order.service.listener.BuyerOrderChangeEvent;
import com.yohoufo.order.service.listener.OrderChangeListenerContainer;
import com.yohoufo.order.service.proxy.BuyerNoticeFacade;
import com.yohoufo.order.service.proxy.DeliveryMinutesService;
import com.yohoufo.order.service.proxy.InBoxFacade;
import com.yohoufo.order.service.proxy.OrderStatusFlowService;
... ... @@ -70,6 +71,9 @@ public class BuyerOrderPaymentService extends AbstractOrderPaymentService {
InBoxFacade inBoxFacade;
@Autowired
BuyerNoticeFacade buyerNoticeFacade;
@Autowired
private BuyerOrderGoodsMapper buyerOrderGoodsMapper;
@Autowired
... ... @@ -227,7 +231,7 @@ public class BuyerOrderPaymentService extends AbstractOrderPaymentService {
.uid(uid).sellerUid(sellerUid).skup(sellerOrderGoods.getId())
.orderCode(orderCode).build();
EventBusPublisher.publishEvent(event);
inBoxFacade.buyerFinishPaid(uid, orderCode, deliveryHours, unit);
buyerNoticeFacade.buyerFinishPaid(uid, orderCode, deliveryHours, unit);
}
/**
... ... @@ -244,7 +248,7 @@ public class BuyerOrderPaymentService extends AbstractOrderPaymentService {
int dtl = acr.getMin();
String unit = TimeUnit.HOURS.equals(tu) ? DateUtil.UNIT_HOURS : DateUtil.UNIT_DAYS;
inBoxFacade.sellerSkupPaidByBuyer(sellerOrderGoods, orderCode, dtl, unit);
inBoxFacade.buyerFinishPaid(uid, orderCode, dtl, unit);
buyerNoticeFacade.buyerFinishPaid(uid, orderCode, dtl, unit);
// 记录此订单的发货超时时间期限点
int ts = DateUtil.getCurrentTimeSecond();
... ...
... ... @@ -142,6 +142,9 @@ public class AppraiseService {
@Autowired
private BuyerNoticeFacade buyerNoticeFacade;
@Autowired
private SellerNoticeFacade sellerNoticeFacade;
@Autowired
TransferService transferService;
... ... @@ -1275,7 +1278,7 @@ public class AppraiseService {
orderStatusFlowService.addAsy(buyerOrder.getOrderCode(), targetOrderStatus.getCode());
//TODO 鉴定通过,
Product product = Optional.ofNullable(sellerOrderGoods).map(SellerOrderGoods::getProductId).map(productMapper::selectByPrimaryKey).orElse(null);
inBoxFacade.appraisePassNoticeSeller(buyerUid, orderCode, sellerOrderGoods);
sellerNoticeFacade.appraisePass(buyerUid, orderCode, sellerOrderGoods);
} catch (Exception ex) {
LOGGER.warn("in judgeCenterPass,refund fail, refundReqOfSeller {}", refundReqOfSeller, ex);
String content = "后台鉴定通过商品,订单" + orderCode + "退还保证金失败";
... ... @@ -1419,8 +1422,8 @@ public class AppraiseService {
orderStatusFlowService.addAsy(buyerOrder.getOrderCode(), targetOrderStatus.getCode());
//平台已发货给买家
inBoxFacade.appraisePassAndDeliveryGoodsToBuyerNoticeBuyer(buyerUid, orderCode, sellerOrderGoods);
inBoxFacade.appraisePassNoticeSeller(buyerUid, orderCode, sellerOrderGoods);
buyerNoticeFacade.appraisePassAndDeliveryGoodsToBuyer(buyerUid, orderCode, sellerOrderGoods);
sellerNoticeFacade.appraisePass(buyerUid, orderCode, sellerOrderGoods);
} catch (Exception ex) {
LOGGER.warn("in appraiseSuccess,refund fail, refundReqOfSeller {}", refundReqOfSeller, ex);
String content = "鉴定通过时,订单" + orderCode + "退还保证金失败";
... ...
... ... @@ -38,10 +38,7 @@ import com.yohoufo.order.service.cache.OrderCacheService;
import com.yohoufo.order.service.listener.BuyerOrderChangeEvent;
import com.yohoufo.order.service.listener.OrderChangeListenerContainer;
import com.yohoufo.order.service.pay.AbstractPayService;
import com.yohoufo.order.service.proxy.InBoxFacade;
import com.yohoufo.order.service.proxy.OrderStatusFlowService;
import com.yohoufo.order.service.proxy.ProductProxyService;
import com.yohoufo.order.service.proxy.UserProxyService;
import com.yohoufo.order.service.proxy.*;
import com.yohoufo.order.utils.BuyerOrderUtils;
import com.yohoufo.order.utils.LoggerUtils;
import com.yohoufo.order.utils.SellerGoodsHelper;
... ... @@ -75,6 +72,9 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService {
private InBoxFacade inBoxFacade;
@Autowired
private BuyerNoticeFacade buyerNoticeFacade;
@Autowired
private OrderCacheService orderCacheService;
@Autowired
... ... @@ -491,7 +491,7 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService {
//
int sellerUid = dataNode.buyerOrderInDB.getSellerUid();
inBoxFacade.noticSellerWhenBuyerCancel(sellerUid, psog);
inBoxFacade.buyerCancelOrder(orderRequest.getUid(), orderCode);
buyerNoticeFacade.buyerCancelOrder(orderRequest.getUid(), orderCode);
//
cacheCleaner.delete(Arrays.asList(CacheKeyBuilder.orderListKey(sellerUid, TabType.SELL.getValue()),
... ... @@ -694,7 +694,7 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService {
//记录订单的状态变更信息
if(num>=1){
logger.info("in confirmReceive record status change, orderCode {},uid {} ,sellerUid {}", orderCode,uid,sellerUid);
inBoxFacade.noticeBuyerWhenPlatformReceiveGoods(uid,orderCode);
buyerNoticeFacade.platformReceiveGoods(uid,orderCode);
orderStatusFlowService.addAsy(buyerOrder.getOrderCode(),targetStatus.getCode());
}else{
logger.warn("in confirmReceive not record status change cause of update empty num , orderCode {},uid {} ,sellerUid {}", orderCode,uid,sellerUid);
... ...
... ... @@ -36,10 +36,7 @@ import com.yohoufo.order.service.IExpressCompanyService;
import com.yohoufo.order.service.IExpressInfoService;
import com.yohoufo.order.service.cache.CacheCleaner;
import com.yohoufo.order.service.cache.CacheKeyBuilder;
import com.yohoufo.order.service.proxy.InBoxFacade;
import com.yohoufo.order.service.proxy.OrderStatusFlowService;
import com.yohoufo.order.service.proxy.ProductProxyService;
import com.yohoufo.order.service.proxy.UserProxyService;
import com.yohoufo.order.service.proxy.*;
import com.yohoufo.order.service.seller.SkupService;
import com.yohoufo.order.service.seller.setting.SellerService;
import com.yohoufo.order.service.seller.setting.SellerWrapper;
... ... @@ -99,6 +96,9 @@ public class ExpressInfoServiceImpl implements IExpressInfoService {
InBoxFacade inBoxFacade;
@Autowired
BuyerNoticeFacade buyerNoticeFacade;
@Autowired
private CacheCleaner cacheCleaner;
@Autowired
... ... @@ -209,7 +209,7 @@ public class ExpressInfoServiceImpl implements IExpressInfoService {
LOGGER.info("in deliverToDepot record status change, orderCode {},uid {} ,sellerUid {}", orderCode,buyerUid,sellerUid);
orderStatusFlowService.addAsy(buyerOrder.getOrderCode(),targetOrderStatus.getCode());
inBoxFacade.sellerDeliver2Depot(buyerUid, orderCode, psog);
buyerNoticeFacade.sellerDeliver2Depot(buyerUid, orderCode, psog);
//卖家物流检查
BuyerOrderSellerDeliveryCheckEvent sellerDeliveryCheckEvent = BuyerOrderSellerDeliveryCheckEvent.builder().uid(buyerUid).sellerUid(sellerUid).orderCode(orderCode).build();
... ...
... ... @@ -4,12 +4,18 @@ import com.yoho.message.sdk.service.ufo.IUFOSendService;
import com.yohobuy.ufo.model.enums.InboxBusinessTypeEnum;
import com.yohobuy.ufo.model.order.constants.SkupType;
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 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.List;
import java.util.Optional;
import java.util.function.Function;
import java.util.function.Supplier;
... ... @@ -21,14 +27,178 @@ public class BuyerNoticeFacade extends BaseNoticeFacade {
@Autowired
private IUFOSendService ufoSendService;
@Autowired
private ProductMapper productMapper;
@Override
public Logger getLogger() {
return log;
}
/**
* 买家订单未付款
*
* @param buyerUid
*/
public void buyerOrderNotPayed(int buyerUid, long orderCode) {
log.info("notice buyer not paid, buyerUid {}, orderCode {}", buyerUid, orderCode);
newNotice(buyerUid)
.withLogPrefix("notice buyer not paid")
.withInBox(InboxBusinessTypeEnum.PURCHASE_UNPAID, orderCode)
.withPush(() -> ufoSendService.buyerNotPay(String.valueOf(buyerUid), String.valueOf(orderCode)))
.send();
}
/**
* 平台发货给买家
* 买家订单支付成功
*
* @param buyerUid
* @param orderCode
*/
public void buyerFinishPaid(int buyerUid, long orderCode, int deliveryHours, String unit) {
log.info("notice buyer finish paid, buyerUid {}, orderCode {}", buyerUid, orderCode);
String timelimitDesc = new StringBuilder().append(deliveryHours).append(unit).toString();
newNotice(buyerUid)
.withLogPrefix("notice buyer finish paid")
.withInBox(InboxBusinessTypeEnum.PURCHASE_NOTIFIED_SELLER, orderCode, timelimitDesc)
.send();
}
/**
* 买家取消订单
*/
public void buyerCancelOrder(int buyerUid, long orderCode) {
try {
newNotice(buyerUid)
.withLogPrefix("notice buyer buyer cancel order")
.withInBox(InboxBusinessTypeEnum.PURCHASE_CLOSED_BUYER, orderCode)
.send();
} catch (Exception e) {
log.warn("notice buyer buyer cancel order fail, buyerUid {}, orderCode {} ", buyerUid, orderCode, e);
}
}
/**
* 买家支付后卖家取消售卖
*
* @param orderCode
*/
public void sellerCancelBuyerOrderAfterPaid(int buyerUid, long orderCode, SellerOrderGoods psog) {
try {
newNotice(buyerUid)
.withLogPrefix("notice buyer seller cancel buyer order after paid")
.withInBox(InboxBusinessTypeEnum.PURCHASE_CLOSED_SELLER, orderCode)
.withPush(() -> ufoSendService.sellerCancelTrade(String.valueOf(buyerUid), String.valueOf(orderCode)))
.withSms(() -> {
String skupTypeText = SkupType.getSkupType(psog.getAttributes()).attrName();
String prdName = psog.getProductName();
String sizeName = psog.getSizeName();
Product product = productMapper.selectByPrimaryKey(psog.getProductId());
String productCode = product.getProductCode();
return buildSmsContent(InboxBusinessTypeEnum.SMS_CLOSED_SELLER, skupTypeText, prdName, productCode, sizeName, orderCode);
})
.send();
} catch (Exception e) {
log.warn("notice buyer seller cancel buyer order after paid fail, buyerUid {}, orderCode {}", buyerUid, orderCode, e);
}
}
/**
* 卖家发货后
*
* @param buyerUid
* @param orderCode
*/
public void sellerDeliver2Depot(int buyerUid, long orderCode, SellerOrderGoods psog) {
try {
newNotice(buyerUid)
.withLogPrefix("notice buyer seller deliver 2 depot")
.withInBox(InboxBusinessTypeEnum.NOTICE_BUYER_WHEN_SELLER_DELIVER, orderCode)
.withPush(() -> ufoSendService.sellerDeliverNotice(String.valueOf(buyerUid), String.valueOf(orderCode)))
.withSms(() -> {
String skupTypeText = SkupType.getSkupType(psog.getAttributes()).attrName();
String prdName = psog.getProductName();
String sizeName = psog.getSizeName();
Product product = productMapper.selectByPrimaryKey(psog.getProductId());
String productCode = product.getProductCode();
return buildSmsContent(InboxBusinessTypeEnum.SMS_NOTICE_BUYER_WHEN_SELLER_DELIVER, skupTypeText, prdName, sizeName, productCode, orderCode);
})
.send();
} catch (Exception ex) {
log.warn("notice buyer seller deliver 2 depot fail, buyerUid {}, orderCode {}", buyerUid, orderCode, ex);
}
}
/**
* 平台收货
*/
public void platformReceiveGoods(int buyerUid, long orderCode) {
try {
newNotice(buyerUid)
.withLogPrefix("notice buyer platform receive goods")
.withInBox(InboxBusinessTypeEnum.NOTICE_BUYER_WHEN_PLATFORM_RECEIVE, orderCode)
.send();
} catch (Exception e) {
log.warn("notice buyer platform receive goods fail, buyerUid {}, orderCode {} ", buyerUid, orderCode, e);
}
}
/**
* 平台已鉴定通过并发货给买家
*
* @return
*/
public void appraisePassAndDeliveryGoodsToBuyer(int buyerUid, long orderCode, SellerOrderGoods psog) {
try {
newNotice(buyerUid)
.withLogPrefix("notice buyer appraise pass and delivery goods to buyer")
.withInBox(InboxBusinessTypeEnum.PURCHASE_SENDED, orderCode)
.withSms(() -> {
Product product = productMapper.selectByPrimaryKey(psog.getProductId());
String productCode = Optional.ofNullable(product).map(Product::getProductCode).orElse("");
String skupTypeText = SkupType.getSkupType(psog.getAttributes()).attrName();
String prdName = psog.getProductName();
String sizeName = psog.getSizeName();
return buildSmsContent(InboxBusinessTypeEnum.SMS_SEND, skupTypeText, prdName, sizeName, productCode, orderCode);
})
.send();
} catch (Exception e) {
log.warn("notice buyer appraise pass and delivery goods to buyer fail, buyerUid {}, orderCode {}", buyerUid, orderCode, e);
}
}
public void quickDeliverOrderPaid(int buyerUid, long orderCode, SellerOrderGoods sog) {
try {
String prdName = sog.getProductName();
String sizeName = sog.getSizeName();
newNotice(buyerUid)
.withLogPrefix("notice buyer quick deliver order paid")
.withInBox(InboxBusinessTypeEnum.NOTICE_BUYER_WHEN_QUICK_DELIVER_ORDER_PAID, orderCode)
.withSms(InboxBusinessTypeEnum.SMS_NOTICE_BUYER_WHEN_QUICK_DELIVER_ORDER_PAID, prdName, sizeName, orderCode)
.send();
} catch (Exception e) {
log.warn("notice buyer quick deliver order paid fail, uid {}, orderCode {}", buyerUid, orderCode, e);
}
}
public void quickDeliverDepositGoodsPaid(int buyerUid, long orderCode, SellerOrderGoods sog) {
try {
String prdName = sog.getProductName();
String sizeName = sog.getSizeName();
newNotice(buyerUid)
.withLogPrefix("notice buyer quick deliver order paid")
.withInBox(InboxBusinessTypeEnum.NOTICE_BUYER_WHEN_DEPOSIT_ORDER_OF_QUICK_DELIVER_PAID, orderCode)
.withSms(InboxBusinessTypeEnum.SMS_NOTICE_BUYER_WHEN_DEPOSIT_ORDER_OF_QUICK_DELIVER_PAID, prdName, sizeName, orderCode)
.send();
} catch (Exception e) {
log.warn("notice buyer quick deliver order paid fail, uid {}, orderCode {}", buyerUid, orderCode, e);
}
}
/**
* 平台发货寄存商品给买家
*
* @return
*/
... ...
... ... @@ -20,7 +20,6 @@ import lombok.NonNull;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
... ... @@ -61,6 +60,12 @@ public class InBoxFacade extends BaseNoticeFacade{
@Autowired
private IUFOSendService ufoSendService;
@Autowired
private SellerNoticeFacade sellerNoticeFacade;
@Autowired
private BuyerNoticeFacade buyerNoticeFacade;
@Override
public Logger getLogger() {
return log;
... ... @@ -71,180 +76,6 @@ public class InBoxFacade extends BaseNoticeFacade{
********************************************************************/
/**
* 买家订单未付款
*
* @param buyerUid
*/
public void buyerOrderNotPayed(int buyerUid, long orderCode) {
log.info("notice buyer not paid, buyerUid {}, orderCode {}", buyerUid, orderCode);
newNotice(buyerUid)
.withLogPrefix("notice buyer not paid")
.withInBox(InboxBusinessTypeEnum.PURCHASE_UNPAID, orderCode)
.withPush(() -> ufoSendService.buyerNotPay(String.valueOf(buyerUid), String.valueOf(orderCode)))
.send();
}
/**
* 通知买家,已经支付成功已通知卖家发货
*
* @param buyerUid
* @param orderCode
*/
public void buyerFinishPaid(int buyerUid, long orderCode, int deliveryHours, String unit) {
log.info("notice buyer finish paid, buyerUid {}, orderCode {}", buyerUid, orderCode);
String timelimitDesc = new StringBuilder().append(deliveryHours).append(unit).toString();
newNotice(buyerUid)
.withLogPrefix("notice buyer finish paid")
.withInBox(InboxBusinessTypeEnum.PURCHASE_NOTIFIED_SELLER, orderCode, timelimitDesc)
.send();
}
/**
* 卖家发货后
*
* @param buyerUid
* @param orderCode
*/
public void sellerDeliver2Depot(int buyerUid, long orderCode, SellerOrderGoods psog) {
try {
log.info("notice buyer seller deliver 2 depot, buyerUid {}, orderCode {}", buyerUid, orderCode);
newNotice(buyerUid)
.withLogPrefix("notice buyer seller deliver 2 depot")
.withInBox(InboxBusinessTypeEnum.NOTICE_BUYER_WHEN_SELLER_DELIVER, orderCode)
.withPush(() -> ufoSendService.sellerDeliverNotice(String.valueOf(buyerUid), String.valueOf(orderCode)))
.withSms(() -> {
String skupTypeText = SkupType.getSkupType(psog.getAttributes()).attrName();
String prdName = psog.getProductName();
String sizeName = psog.getSizeName();
Product product = productMapper.selectByPrimaryKey(psog.getProductId());
String productCode = product.getProductCode();
return buildSmsContent(InboxBusinessTypeEnum.SMS_NOTICE_BUYER_WHEN_SELLER_DELIVER, skupTypeText, prdName, sizeName, productCode, orderCode);
})
.send();
} catch (Exception ex) {
log.warn("notice buyer seller deliver 2 depot fail, buyerUid {}, orderCode {}", buyerUid, orderCode, ex);
}
}
/**
* 平台已发货给买家
*
* @return
*/
public void appraisePassAndDeliveryGoodsToBuyerNoticeBuyer(int buyerUid, long orderCode, SellerOrderGoods psog) {
try {
log.info("notice buyer appraise pass, buyerUid {}, orderCode {}", buyerUid, orderCode);
newNotice(buyerUid)
.withLogPrefix("notice buyer appraise pass")
.withInBox(InboxBusinessTypeEnum.PURCHASE_SENDED, orderCode)
.withSms(() -> {
Product product = productMapper.selectByPrimaryKey(psog.getProductId());
String productCode = Optional.ofNullable(product).map(Product::getProductCode).orElse("");
String skupTypeText = SkupType.getSkupType(psog.getAttributes()).attrName();
String prdName = psog.getProductName();
String sizeName = psog.getSizeName();
return buildSmsContent(InboxBusinessTypeEnum.SMS_SEND, skupTypeText, prdName, sizeName, productCode, orderCode);
})
.send();
} catch (Exception e) {
log.warn("notice buyer appraise pass fail, buyerUid {}, orderCode {}", buyerUid, orderCode, e);
}
}
public void appraisePassNoticeSeller(int buyerUid, long orderCode, SellerOrderGoods psog) {
try {
log.info("notice seller appraise pass, buyerUid {}, orderCode {}", buyerUid, orderCode);
newNotice(psog.getUid())
.withLogPrefix("notice seller appraise pass")
.withInBox(() -> {
String prdName = psog.getProductName();
Product product = productMapper.selectByPrimaryKey(psog.getProductId());
String productCode = Optional.ofNullable(product).map(Product::getProductCode).orElse("");
String sizeName = psog.getSizeName();
String skupTypeText = SkupType.getSkupType(psog.getAttributes()).attrName();
return buildInboxContent(InboxBusinessTypeEnum.NOTICE_SELLER_WHEN_APPRAISE_PASS,skupTypeText, prdName, sizeName, productCode);
})
.withSms(() -> {
String skupTypeText = SkupType.getSkupType(psog.getAttributes()).attrName();
return buildSmsContent(InboxBusinessTypeEnum.SMS_NOTICE_SELLER_WHEN_APPRAISE_PASS, skupTypeText, orderCode);
})
.send();
} catch (Exception e) {
log.warn("notice seller appraise pass fail, buyerUid {}, orderCode {}", buyerUid, orderCode, e);
}
}
/**
* 订单生成,卖家取消售卖
*
* @param orderCode
*/
public void noticeBuyerWhenSellerCancelAfterPaid(int buyerUid, long orderCode,SellerOrderGoods psog ) {
try {
executorService.execute(()->{
String skupTypeText = SkupType.getSkupType(psog.getAttributes()).attrName();
String prdName = psog.getProductName();
String sizeName =psog.getSizeName();
Product product = productMapper.selectByPrimaryKey(psog.getProductId());
String productCode = product.getProductCode();
InboxBusinessTypeEnum ibt = InboxBusinessTypeEnum.PURCHASE_CLOSED_SELLER;
String params = buildParams(orderCode);
InboxReqVO req = buildInboxReqVO(buyerUid, params, ibt);
InBoxResponse resp = inBoxSDK.addInbox(req);
log.info("record noticeBuyerWhenSellerCancelAfterPaid inbox msg, buyerUid {}, orderCode {},prdName {} resp {}",
buyerUid, orderCode, prdName,resp);
//发push
SendMessageRspBo bo = ufoSendService.sellerCancelTrade(String.valueOf(buyerUid),String.valueOf(orderCode));
log.info("record noticeBuyerWhenSellerCancelAfterPaid push buyer uid is {}, orderCode is {}, result is {}", buyerUid, orderCode, JSON.toJSONString(bo));
//短信
String phone = userProxyService.getMobile(buyerUid);
if (StringUtils.isBlank(phone)){
log.warn("in noticeBuyerWhenSellerCancelAfterPaid sms fail, buyerUid {} orderCode {} prdName {}", buyerUid, orderCode,prdName);
return;
}
List<String> mobileList = Arrays.asList(phone);
String content=getReplacedContent(InboxBusinessTypeEnum.SMS_CLOSED_SELLER.getContent(),skupTypeText,prdName,productCode,sizeName,orderCode);
sendSmsService.smsSendByMobile(content,mobileList);
log.info("record noticeBuyerWhenSellerCancelAfterPaid inbox sms msg, buyerUid {}, orderCode {},prdName {}",
buyerUid, orderCode,prdName);
});
} catch (Exception e) {
log.warn("InBoxFacade noticeBuyerWhenSellerCancelAfterPaid error inbox msg, buyerUid {}, orderCode {} prdName {}",
buyerUid, orderCode,psog, e);
}
}
/**
* 订单生成,买家取消订单
*/
public void buyerCancelOrder(int buyerUid, long orderCode) {
try {
executorService.execute(() -> {
InboxBusinessTypeEnum ibt = InboxBusinessTypeEnum.PURCHASE_CLOSED_BUYER;
String params = buildParams(orderCode);
InboxReqVO req = buildInboxReqVO(buyerUid, params, ibt);
InBoxResponse resp = inBoxSDK.addInbox(req);
log.info("record buyerCancelOrder inbox msg, buyerUid {}, orderCode {}, resp {}",
buyerUid, orderCode, resp);
});
} catch (Exception e) {
log.warn("InBoxFacade buyerCancelOrder error inbox msg, buyerUid {}, orderCode {} ",
buyerUid, orderCode, e);
}
}
/**
* 平台鉴定不通过
*
* @param buyerUid
... ... @@ -288,26 +119,6 @@ public class InBoxFacade extends BaseNoticeFacade{
/**
* 平台收货
*/
public void noticeBuyerWhenPlatformReceiveGoods(int buyerUid, long orderCode) {
try {
executorService.execute(() -> {
InboxBusinessTypeEnum ibt = InboxBusinessTypeEnum.NOTICE_BUYER_WHEN_PLATFORM_RECEIVE;
String params = buildParams(orderCode);
InboxReqVO req = buildInboxReqVO(buyerUid, params, ibt);
InBoxResponse resp = inBoxSDK.addInbox(req);
log.info("record noticeBuyerWhenPlatformReceiveGoods inbox msg, buyerUid {}, orderCode {}, resp {}",
buyerUid, orderCode, resp);
});
} catch (Exception e) {
log.warn("InBoxFacade buyerCancelOrder error inbox msg, buyerUid {}, orderCode {} ",
buyerUid, orderCode, e);
}
}
/**
* 质检未通过,买家
*/
public void noticeBuyerWhenQualityCheckNotPass(int buyerUid, long orderCode,SellerOrderGoods sellerOrderGoods) {
... ... @@ -1673,74 +1484,14 @@ public class InBoxFacade extends BaseNoticeFacade{
execute(task, logModule, logparams);
}
public void noticeWhenQuickDeliverOrderPaid(int buyerUid, long orderCode, SellerOrderGoods sog){
String prdName = sog.getProductName();
String sizeName = sog.getSizeName();
Runnable task = ()->{
InboxBusinessTypeEnum ibt = InboxBusinessTypeEnum.NOTICE_BUYER_WHEN_QUICK_DELIVER_ORDER_PAID;
String params = buildParams(orderCode);
InboxReqVO req = buildInboxReqVO(buyerUid, params, ibt);
InBoxResponse resp = inBoxSDK.addInbox(req);
log.info("record noticeWhenQuickDeliverOrderPaid to buyer inbox msg, buyerUid {}, orderCode {},prdName {} resp {}",
buyerUid, orderCode,prdName, resp);
//短信
String phone = userProxyService.getMobile(buyerUid);
if (StringUtils.isBlank(phone)){
log.warn("in noticeWhenQuickDeliverOrderPaid sms fail, buyerUid {} orderCode {} prdName {}", buyerUid, orderCode,prdName);
return;
}
List<String> mobileList = Arrays.asList(phone);
InboxBusinessTypeEnum sms=InboxBusinessTypeEnum.SMS_NOTICE_BUYER_WHEN_QUICK_DELIVER_ORDER_PAID;
String content= getReplacedContent(sms.getContent(),prdName,sizeName,orderCode);
sendSmsService.smsSendByMobile(content,mobileList);
log.info("record noticeWhenQuickDeliverOrderPaid inbox sms msg, buyer Uid {}, orderCode {},prdName {} ,sizeName {} ",
buyerUid, orderCode, prdName,sizeName);
};
String logModule = "InBoxFacade noticeWhenQuickDeliverOrderPaid error inbox msg, buyerUid {}, orderCode {} ,prdName {}";
Object[] logparams = new Object[]{buyerUid, orderCode, prdName};
execute(task, logModule, logparams);
appraisePassNoticeSeller(buyerUid,orderCode, sog);
}
public void noticeWhenDepositOrderOfQuickDeliverGoodsPaid(int buyerUid, long orderCode, SellerOrderGoods sog){
String prdName = sog.getProductName();
String sizeName = sog.getSizeName();
Runnable task = ()->{
InboxBusinessTypeEnum ibt = InboxBusinessTypeEnum.NOTICE_BUYER_WHEN_DEPOSIT_ORDER_OF_QUICK_DELIVER_PAID;
String params = buildParams(orderCode);
InboxReqVO req = buildInboxReqVO(buyerUid, params, ibt);
InBoxResponse resp = inBoxSDK.addInbox(req);
log.info("record noticeWhenDepositOrderOfPaid to buyer inbox msg, buyerUid {}, orderCode {},prdName {} resp {}",
buyerUid, orderCode,prdName, resp);
//短信
String phone = userProxyService.getMobile(buyerUid);
if (StringUtils.isBlank(phone)){
log.warn("in noticeWhenDepositOrderOfPaid sms fail, buyerUid {} orderCode {} prdName {}", buyerUid, orderCode,prdName);
return;
public void noticeWhenQuickDeliverOrderPaid(int buyerUid, long orderCode, SellerOrderGoods sog) {
buyerNoticeFacade.quickDeliverOrderPaid(buyerUid, orderCode, sog);
sellerNoticeFacade.appraisePass(buyerUid, orderCode, sog);
}
List<String> mobileList = Arrays.asList(phone);
InboxBusinessTypeEnum sms=InboxBusinessTypeEnum.SMS_NOTICE_BUYER_WHEN_DEPOSIT_ORDER_OF_QUICK_DELIVER_PAID;
String content= getReplacedContent(sms.getContent(),prdName,sizeName,orderCode);
sendSmsService.smsSendByMobile(content,mobileList);
log.info("record noticeWhenDepositOrderOfPaid inbox sms msg, buyer Uid {}, orderCode {},prdName {} ,sizeName {} ",
buyerUid, orderCode, prdName,sizeName);
};
String logModule = "InBoxFacade noticeWhenDepositOrderOfPaid error inbox msg, buyerUid {}, orderCode {} ,prdName {}";
Object[] logparams = new Object[]{buyerUid, orderCode, prdName};
execute(task, logModule, logparams);
//
appraisePassNoticeSeller(buyerUid,orderCode, sog);
public void noticeWhenDepositOrderOfQuickDeliverGoodsPaid(int buyerUid, long orderCode, SellerOrderGoods sog) {
buyerNoticeFacade.quickDeliverDepositGoodsPaid(buyerUid, orderCode, sog);
sellerNoticeFacade.appraisePass(buyerUid, orderCode, sog);
}
// 召回的
... ...
package com.yohoufo.order.service.proxy;
import com.yoho.message.sdk.service.ufo.IUFOSendService;
import com.yohobuy.ufo.model.enums.InboxBusinessTypeEnum;
import com.yohobuy.ufo.model.order.constants.SkupType;
import com.yohoufo.dal.order.model.SellerOrderGoods;
import com.yohoufo.dal.product.ProductMapper;
import com.yohoufo.dal.product.model.Product;
import lombok.extern.slf4j.Slf4j;
import org.slf4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Optional;
import java.util.function.Function;
import java.util.function.Supplier;
@Service
@Slf4j(topic = "SellerNoticeFacade")
public class SellerNoticeFacade extends BaseNoticeFacade {
@Autowired
private IUFOSendService ufoSendService;
@Autowired
private ProductMapper productMapper;
@Override
public Logger getLogger() {
return log;
}
/**
* 商品鉴定已通过
*
* @param orderCode
*/
public void appraisePass(int buyerUid, long orderCode, SellerOrderGoods psog) {
try {
Integer sellerUid = psog.getUid();
newNotice(sellerUid)
.withLogPrefix("notice seller appraise pass")
.withInBox(() -> {
String prdName = psog.getProductName();
Product product = productMapper.selectByPrimaryKey(psog.getProductId());
String productCode = Optional.ofNullable(product).map(Product::getProductCode).orElse("");
String sizeName = psog.getSizeName();
String skupTypeText = SkupType.getSkupType(psog.getAttributes()).attrName();
return buildInboxContent(InboxBusinessTypeEnum.NOTICE_SELLER_WHEN_APPRAISE_PASS, skupTypeText, prdName, sizeName, productCode);
})
.withSms(() -> {
String skupTypeText = SkupType.getSkupType(psog.getAttributes()).attrName();
return buildSmsContent(InboxBusinessTypeEnum.SMS_NOTICE_SELLER_WHEN_APPRAISE_PASS, skupTypeText, orderCode);
})
.send();
} catch (Exception e) {
log.warn("notice seller appraise pass fail, buyerUid {}, orderCode {}", buyerUid, orderCode, e);
}
}
}
... ...
... ... @@ -39,6 +39,7 @@ import com.yohoufo.order.service.handler.RefundGoodsMoneyHandler;
import com.yohoufo.order.service.handler.penalty.PenaltyResult;
import com.yohoufo.order.service.handler.penalty.SellerEarnestMoney2BuyerPenaltyCalculator;
import com.yohoufo.order.service.impl.PayRefundService;
import com.yohoufo.order.service.proxy.BuyerNoticeFacade;
import com.yohoufo.order.service.seller.setting.SellerService;
import com.yohoufo.order.service.impl.TransferService;
import com.yohoufo.order.service.impl.visitor.*;
... ... @@ -101,6 +102,9 @@ public class SellerOrderCancelService {
private InBoxFacade inBoxFacade;
@Autowired
private BuyerNoticeFacade buyerNoticeFacade;
@Autowired
private TransferService transferService;
@Autowired
... ... @@ -653,7 +657,7 @@ public class SellerOrderCancelService {
.refund();
//异步
//消息通知
inBoxFacade.noticeBuyerWhenSellerCancelAfterPaid(buyerUid, buyerOrderCode, psog);
buyerNoticeFacade.sellerCancelBuyerOrderAfterPaid(buyerUid, buyerOrderCode, psog);
inBoxFacade.sellerCancelAfterBuyerPaid( psog);
//记录状态信息
... ...