Authored by qinchao

消息发送

... ... @@ -521,8 +521,15 @@ public class AppraiseService {
orderStatusFlowService.addAsy(buyerOrder.getOrderCode(), targetStatus.getCode());
//TODO 消息
if(type == 1){
//鉴定不通过 ,其余的情况不发消息,改成寄回的时候再发消息
inBoxFacade.noticeSellerWhenAppraiseFail(sellerOrderGoods, orderCode, wayBillCode);
inBoxFacade.buyerGetEarnestMoneyWhenAppraiseFail(buyerUid, buyerOrder.getOrderCode(), sellerOrderGoods.getProductName());
}else if(type==3 || type == 4){
//瑕疵不接受(用户不接受和超时不接受),只给买家发消息
inBoxFacade.buyerMiniFaultUnAccept(buyerUid,buyerOrder.getOrderCode(), sellerOrderGoods.getProductName());
}
}catch(Exception ex) {
LOGGER.warn("in appraiseFail orderStatusFlowService or notice fail orderCode {}", orderCode, ex);
}finally {
... ...
... ... @@ -853,6 +853,9 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService {
logger.info("in miniFaultCreate, push event uid {} ,order code {} ", miniFaultOuterTimeEvent.getUid(),miniFaultOuterTimeEvent.getOrderCode());
EventBusPublisher.publishEvent(miniFaultOuterTimeEvent);
//消息
inBoxFacade.buyerMiniFaultCreate(uid,orderCode);
cleanCacheAfterUpdateStatus(orderCode,uid,sellerUid);
}
... ...
... ... @@ -307,6 +307,72 @@ public class InBoxFacade {
}
}
/**
* 瑕疵提醒,给买家消息
*/
public void buyerMiniFaultCreate(int buyerUid, long orderCode) {
try {
executorService.execute(() -> {
InboxBusinessTypeEnum ibt = InboxBusinessTypeEnum.NOTICE_PROBLEM_ORDER;
String params = buildParams(orderCode);
InboxReqVO req = buildInboxReqVO(buyerUid, params, ibt);
InBoxResponse resp = inBoxSDK.addInbox(req);
logger.info("record buyerMiniFaultCreate inbox msg, buyerUid {} ,orderCode {} ,resp {}",
buyerUid, orderCode ,resp);
//短信
String phone = userProxyService.getMobile(buyerUid);
if (StringUtils.isBlank(phone)){
logger.warn("buyerMiniFaultCreate sms send fail,buyerUid {} ,orderCode {}", buyerUid, orderCode);
return;
}
List<String> mobileList = Arrays.asList(phone);
String content = getReplacedContent(InboxBusinessTypeEnum.SMS_CHECK_ORDER_PROBLEM.getContent(),orderCode);
sendSmsService.smsSendByMobile(content, mobileList);
logger.info("record buyerMiniFaultCreate inbox sms msg,buyerUid {}, porderCode {}",
buyerUid ,orderCode);
});
} catch (Exception e) {
logger.warn("InBoxFacade buyerMiniFaultCreate error inbox msg, buyerUid {},orderCode {} ",
buyerUid, orderCode , e);
}
}
/**
* 不接受瑕疵,给买家消息
*/
public void buyerMiniFaultUnAccept(int buyerUid, long orderCode,String prdName) {
try {
executorService.execute(() -> {
InboxBusinessTypeEnum ibt = InboxBusinessTypeEnum.NOTICE_BUYER_WHEN_MINI_FAULT_UN_ACCEPT;
String params = buildParams(orderCode);
InboxReqVO req = buildInboxReqVO(buyerUid, params, ibt);
InBoxResponse resp = inBoxSDK.addInbox(req);
logger.info("record buyerQualityCheckNotPass inbox msg, buyerUid {} ,orderCode {},prdName {} ,resp {}",
buyerUid, orderCode, prdName ,resp);
//短信
String phone = userProxyService.getMobile(buyerUid);
if (StringUtils.isBlank(phone)){
logger.warn("buyerQualityCheckNotPass sms send fail,buyerUid {} ,orderCode {}", buyerUid, orderCode);
return;
}
List<String> mobileList = Arrays.asList(phone);
String content = getReplacedContent(InboxBusinessTypeEnum.SMS_NOTICE_BUYER_WHEN_MINI_FAULT_UN_ACCEPT.getContent(),prdName,orderCode);
sendSmsService.smsSendByMobile(content, mobileList);
logger.info("record buyerQualityCheckNotPass inbox sms msg,buyerUid {}, prdName {},orderCode {}",
buyerUid , prdName,orderCode);
});
} catch (Exception e) {
logger.warn("InBoxFacade sellerSkupPaidByBuyer error inbox msg, buyerUid {},orderCode {}, prdName {} ",
buyerUid, orderCode ,prdName, e);
}
}
/*********************************************************************
* 卖家消息
********************************************************************/
... ... @@ -403,6 +469,43 @@ public class InBoxFacade {
}
/**
* 质检不通过,给卖家消息
*/
public void sellerQualityCheckNotPass(SellerOrderGoods sog,long orderCode,String wayBillCode) {
Integer sellerUid = sog.getUid();
String prdName = sog.getProductName();
String sizeName = sog.getSizeName();
try {
executorService.execute(() -> {
InboxBusinessTypeEnum ibt = InboxBusinessTypeEnum.NOTICE_SELLER_WHEN_QUALITY_CHECK_REJECT;
String params = buildParams(prdName, sizeName);
InboxReqVO req = buildInboxReqVO(sellerUid, params, ibt);
InBoxResponse resp = inBoxSDK.addInbox(req);
logger.info("record sellerQualityCheckNotPass inbox msg, SellerOrderGoods {} ,sellerUid {}, prdName {}, sizeName {},resp {}",
JSON.toJSONString(sog),sellerUid, prdName, sizeName, resp);
//短信
String phone = userProxyService.getMobile(sellerUid);
if (StringUtils.isBlank(phone)){
logger.warn("sellerQualityCheckNotPass sms send fail,sellerUid {}, prdName {}", sellerUid, prdName);
return;
}
List<String> mobileList = Arrays.asList(phone);
String content = getReplacedContent(InboxBusinessTypeEnum.SMS_NOTICE_SELLER_WHEN_QUALITY_CHECK_REJECT.getContent(),prdName,orderCode,wayBillCode);
sendSmsService.smsSendByMobile(content, mobileList);
logger.info("record sellerQualityCheckNotPass inbox sms msg,sellerUid {}, prdName {},orderCode {}",
sellerUid, prdName,orderCode);
});
} catch (Exception e) {
logger.warn("InBoxFacade sellerSkupPaidByBuyer error inbox msg, sellerUid {}, prdName {} ",
sellerUid, prdName, e);
}
}
/**
* 卖家发货提醒,买家支付购买后
*
* @param sog SellerOrderGoods
... ...