Authored by chenchao

inbox msg mode invoke

... ... @@ -11,14 +11,12 @@ import com.yohobuy.ufo.model.order.common.OrderCodeType;
import com.yohobuy.ufo.model.order.common.OrderStatus;
import com.yohobuy.ufo.model.order.resp.PageResp;
import com.yohoufo.common.alarm.CommonAlarmEventPublisher;
import com.yohoufo.common.caller.UfoServiceCaller;
import com.yohoufo.common.utils.TimeUtils;
import com.yohoufo.dal.order.*;
import com.yohoufo.dal.order.model.*;
import com.yohoufo.order.common.Payment;
import com.yohoufo.order.model.request.PaymentRequest;
import com.yohoufo.order.model.response.PrepayResponse;
import com.yohoufo.order.service.cache.CacheCleaner;
import com.yohoufo.order.service.impl.PaymentServiceImpl;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
... ... @@ -53,12 +51,7 @@ public class MerchantOrderPaymentService extends AbstractOrderPaymentService {
@Autowired
OrdersPayRefundMapper ordersPayRefundMapper;
@Autowired
private CacheCleaner cacheCleaner;
@Autowired
UfoServiceCaller ufoServiceCaller;
@Autowired
PaymentServiceImpl paymentService;
... ...
... ... @@ -342,7 +342,7 @@ public class AppraiseService {
payRefundService.refund(req, bleb);
//
inBoxFacade.noticeSellerWhenAppraiseFail(sellerUid, sellerOrderGoods.getProductName());
inBoxFacade.noticeSellerWhenAppraiseFail( sellerOrderGoods);
inBoxFacade.buyerGetEarnestMoneyWhenAppraiseFail(buyerUid, buyerOrder.getOrderCode(), sellerOrderGoods.getProductName());
}catch (Exception ex){
LOGGER.warn("in appraiseFail ,refund fail,req {}", req, ex);
... ...
... ... @@ -108,7 +108,7 @@ public class BuyerOrderCancelService {
sellerOrderMapper.updateBySkups(soc, Arrays.asList(skup));
SellerOrderGoods psog = sellerOrderGoodsMapper.selectByPrimaryKey(skup);
inBoxFacade.buyerCancelBeforeSellerDeliver(buyerUid, orderCode,
compensate.getBuyerCompensateMoney().toPlainString(), sellerUid, psog.getProductName());
compensate.getBuyerCompensateMoney().toPlainString(), psog);
//TODO 整个过程异步去执行(考虑退费依赖订单状态)
//(退费)退保证金给卖家
//(转账)瓜分指定赔偿款给卖家和平台
... ... @@ -158,7 +158,7 @@ public class BuyerOrderCancelService {
sellerOrderMapper.updateBySkups(soc, Arrays.asList(skup));
SellerOrderGoods psog = sellerOrderGoodsMapper.selectByPrimaryKey(skup);
inBoxFacade.buyerCancelBeforeDepotReceive(buyerUid, orderCode,
compensate.getBuyerCompensateMoney().toPlainString(), sellerUid, psog.getProductName());
compensate.getBuyerCompensateMoney().toPlainString(), psog);
//整个过程异步去执行(考虑退费依赖订单状态)
//(退费)退保证金给卖家
//(转账)瓜分指定赔偿款给卖家和平台
... ...
... ... @@ -484,14 +484,16 @@ public class InBoxFacade {
/**
* 交易关闭:订单生成,平台鉴定不通过
*
* @param sellerUid
* @param prdName
* @param sog
*/
public void noticeSellerWhenAppraiseFail(int sellerUid, String prdName) {
public void noticeSellerWhenAppraiseFail(SellerOrderGoods sog) {
int sellerUid = sog.getUid();
String prdName = sog.getProductName();
String sizeName = sog.getSizeName();
try {
executorService.execute(() -> {
InboxBusinessTypeEnum ibt = InboxBusinessTypeEnum.SALE_CLOSED_PLATFORM;
String params = buildParams(prdName);
String params = buildParams(prdName, sizeName);
InboxReqVO req = buildInboxReqVO(sellerUid, params, ibt);
InBoxResponse resp = inBoxSDK.addInbox(req);
... ... @@ -643,9 +645,17 @@ public class InBoxFacade {
executorService.execute(() -> {
logger.info("record sellerDeliverNotice inbox sms msg,sellerUid {}, prdName {}, times {}",
sellerUid, prdName, times);
if (times == 2) {
InboxBusinessTypeEnum ibt = InboxBusinessTypeEnum.NOTICE_SELLER_DELIVER_GOODS;
String params = buildParams(sizeName, sizeName);
if(times == 2 || times == 3){
InboxBusinessTypeEnum ibt = null;
if (times == 2) {
ibt = InboxBusinessTypeEnum.NOTICE_SELLER_DELIVER_GOODS;
}
if(times == 3){
ibt = InboxBusinessTypeEnum.NOTICE_SELLER_DELIVER_GOODS_FAIL;
}
String params = buildParams(prdName, sizeName);
InboxReqVO req = buildInboxReqVO(sellerUid, params, ibt);
InBoxResponse resp = inBoxSDK.addInbox(req);
logger.info("record sellerDeliverNotice inbox msg,sellerUid {}, prdName {},sizeName {} times {},resp {}",
... ... @@ -659,24 +669,22 @@ public class InBoxFacade {
return;
}
List<String> mobileList = Arrays.asList(phone);
if (times == 2) {
String content = getReplacedContent(InboxBusinessTypeEnum.SMS_NOTIFIED_SEND_SECOND.getContent(),prdName);
if(times == 2 || times == 3){
String content = null;
if (times == 2) {
content = getReplacedContent(InboxBusinessTypeEnum.SMS_NOTIFIED_SEND_SECOND.getContent(),prdName);
}
if (times == 3) {
content = getReplacedContent(InboxBusinessTypeEnum.SMS_NOTIFIED_SEND_FAILED.getContent(),prdName);
}
sendSmsService.smsSendByMobile(content, mobileList);
logger.info("record sellerDeliverNotice inbox sms msg,sellerUid {}, prdName {}, times {},resp {}",
sellerUid, prdName, times);
}
if (times == 3) {
//SmsContentEnum smsIbt = SmsContentEnum.SMS_NOTIFIED_SEND_FAILED;
//String content = smsIbt.getReplacedContent(prdName);
String content = getReplacedContent(InboxBusinessTypeEnum.SMS_NOTIFIED_SEND_FAILED.getContent(),prdName);
sendSmsService.smsSendByMobile(content, mobileList);
logger.info("record sellerDeliverNotice inbox sms msg,sellerUid {}, prdName {}, times {},resp {}",
sellerUid, prdName, times);
}
});
} catch (Exception e) {
logger.warn("InBoxFacade sellerDeliverNotice error inbox msg, sellerUid {}, prdName {} ",
... ... @@ -684,7 +692,10 @@ public class InBoxFacade {
}
}
public void buyerCancelBeforeDepotReceive(int buyerUid, long orderCode,String compesant, int sellerUid, String prdName) {
public void buyerCancelBeforeDepotReceive(int buyerUid, long orderCode,String compesant, SellerOrderGoods sog) {
int sellerUid = sog.getUid();
String prdName = sog.getProductName();
String sizeName = sog.getSizeName();
try {
executorService.execute(()->{
InboxBusinessTypeEnum ibt = InboxBusinessTypeEnum.PURCHASE_CLOSED_BY_BUYER_AFTER_DELIVERY;
... ... @@ -696,7 +707,7 @@ public class InBoxFacade {
buyerUid, orderCode,prdName, resp);
//seller
InboxBusinessTypeEnum ibtOfSeller = InboxBusinessTypeEnum.SALE_CLOSED_BY_BUYER_AFTER_DELIVERY;
String paramsOfSeller = buildParams(prdName);
String paramsOfSeller = buildParams(prdName, sizeName);
InboxReqVO reqOfSeller = buildInboxReqVO(sellerUid, paramsOfSeller, ibtOfSeller);
InBoxResponse respOfSeller = inBoxSDK.addInbox(reqOfSeller);
logger.info("record buyerCancelBeforeDepotReceive to seller inbox msg, sellerUid {}, orderCode {},prdName {} resp {}",
... ... @@ -723,7 +734,10 @@ public class InBoxFacade {
}
}
public void buyerCancelBeforeSellerDeliver(int buyerUid, long orderCode,String compesant, int sellerUid, String prdName) {
public void buyerCancelBeforeSellerDeliver(int buyerUid, long orderCode,String compesant, SellerOrderGoods sog) {
int sellerUid = sog.getUid();
String prdName = sog.getProductName();
String sizeName = sog.getSizeName();
try {
executorService.execute(()->{
InboxBusinessTypeEnum ibt = InboxBusinessTypeEnum.PURCHASE_CLOSED_BY_BUYER_AFTER_PAID;
... ... @@ -735,7 +749,7 @@ public class InBoxFacade {
buyerUid, orderCode,prdName, resp);
//seller
InboxBusinessTypeEnum ibtOfSeller = InboxBusinessTypeEnum.SALE_CLOSED_BY_BUYER_AFTER_PAID;
String paramsOfSeller = buildParams(prdName);
String paramsOfSeller = buildParams(prdName, sizeName);
InboxReqVO reqOfSeller = buildInboxReqVO(sellerUid, paramsOfSeller, ibtOfSeller);
InBoxResponse respOfSeller = inBoxSDK.addInbox(reqOfSeller);
logger.info("record buyerCancelBeforeSellerDeliver to seller inbox msg, sellerUid {}, orderCode {},prdName {} resp {}",
... ...