Authored by chenchao

change inbox msg

package com.yohoufo.order.event;
import com.yohoufo.common.alarm.Event;
import com.yohoufo.dal.order.model.SellerOrderGoods;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
... ... @@ -22,5 +23,7 @@ public class DeliverNoticeEvent extends Event{
private String prdName;
private SellerOrderGoods sellerOrderGoods;
private long orderCode;
}
... ...
package com.yohoufo.order.event;
import com.yohoufo.common.alarm.Event;
import com.yohoufo.dal.order.model.SellerOrderGoods;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
... ... @@ -24,4 +25,6 @@ public class SellerCancelDeliverEvent extends Event {
private String productName;
private long orderCode;
private SellerOrderGoods sellerOrderGoods;
}
... ...
... ... @@ -48,7 +48,7 @@ public class NotDeliverNoticeDelayMsgConsumer implements YhConsumer {
BuyerOrder buyerOrder = buyerOrderMapper.selectByOrderCodeUid(orderCode, buyerUid);
if(OrderStatus.HAS_PAYED.getCode() == buyerOrder.getStatus().intValue()){
LOGGER.info("ready notice sellerDeliverNotice, msg {}", msg);
inBoxFacade.sellerDeliverNotice(msg.getSellerUid(), msg.getPrdName(), 2);
inBoxFacade.sellerDeliverNotice(msg.getSellerOrderGoods(), 2);
}
... ...
... ... @@ -91,7 +91,7 @@ public class SellerOrderCancelDeliverDelayMsgConsumer implements YhConsumer {
try{
payRefundService.refund(req, bleb);
//
inBoxFacade.sellerDeliverNotice(event.getSellerUid(), event.getProductName(), 3);
inBoxFacade.sellerDeliverNotice(event.getSellerOrderGoods(), 3);
}catch (Exception ex){
logger.warn("in topic {} , refund fail,req {}", getMessageTopic(), req, ex);
BillLogEvent buyererBillLogEvent = bleb.tradeStatus(BillTradeStatus.FAIL.getCode())
... ...
... ... @@ -89,14 +89,16 @@ public class BuyerOrderPaymentService extends AbstractOrderPaymentService {
BuyerOrderGoods buyerOrderGoods = buyerOrderGoodsMapper.selectByOrderCode(uid, orderCode);
int skup = buyerOrderGoods.getSkup();
SellerOrderGoods sellerOrderGoods = sellerOrderGoodsMapper.selectByPrimaryKey(skup);
inBoxFacade.sellerSkupPaidByBuyer(sellerUid, sellerOrderGoods.getProductName());
inBoxFacade.sellerSkupPaidByBuyer(sellerOrderGoods);
DeliverNoticeEvent deliverNoticeEvent = DeliverNoticeEvent.builder().skup(sellerOrderGoods.getId())
.sellerOrderGoods(sellerOrderGoods)
.sellerUid(sellerUid).buyerUid(uid).prdName(sellerOrderGoods.getProductName()).orderCode(orderCode).build();
EventBusPublisher.publishEvent(deliverNoticeEvent);
//卖家36小时不发货取消
SellerCancelDeliverEvent event = SellerCancelDeliverEvent.builder()
.sellerOrderGoods(sellerOrderGoods)
.productName(sellerOrderGoods.getProductName())
.uid(uid).sellerUid(sellerUid).skup(sellerOrderGoods.getId())
.orderCode(orderInfo.getOrderCode()).build();
... ...
... ... @@ -417,7 +417,7 @@ public class SellerOrderCancelService {
//异步
inBoxFacade.noticeBuyerWhenSellerCancelAfterPaid(buyerUid, buyerOrderCode, psog.getProductName());
inBoxFacade.sellerCancelAfterBuyerPaid(sellerUid, psog.getProductName());
inBoxFacade.sellerCancelAfterBuyerPaid( psog);
}catch (Exception ex){
logger.warn("in cancelAfterPayExistBuyAction , refund fail,req {}", refundReq, ex);
BillLogEvent buyererBillLogEvent = bleb.tradeStatus(BillTradeStatus.FAIL.getCode())
... ...
... ... @@ -380,33 +380,29 @@ public class InBoxFacade {
/**
* 卖家发货提醒,买家支付购买后
*
* @param sellerUid
* @param prdName
* @param sog SellerOrderGoods
*/
public void sellerSkupPaidByBuyer(int sellerUid, String prdName) {
public void sellerSkupPaidByBuyer(SellerOrderGoods sog) {
int sellerUid = sog.getUid();
String prdName = sog.getProductName();
String sizeName = sog.getSizeName();
try {
executorService.execute(() -> {
InboxBusinessTypeEnum ibt = InboxBusinessTypeEnum.SALE_SEND;
String params = buildParams(prdName);
String params = buildParams(prdName, sizeName);
InboxReqVO req = buildInboxReqVO(sellerUid, params, ibt);
InBoxResponse resp = inBoxSDK.addInbox(req);
logger.info("record sellerSkupPaidByBuyer inbox msg, sellerUid {}, prdName {}, resp {}",
sellerUid, prdName, resp);
logger.info("record sellerSkupPaidByBuyer inbox msg, sellerUid {}, prdName {}, sizeName {},resp {}",
sellerUid, prdName, sizeName, resp);
//短信
/*InboxBusinessTypeEnum smsIbt = InboxBusinessTypeEnum.SMS_NOTIFIED_SEND;
String smsparams = buildParams(prdName);
InboxReqVO smsIbtReq = buildInboxReqVO(sellerUid, smsparams, smsIbt);
InBoxResponse smsresp = inBoxSDK.addInbox(smsIbtReq);*/
String phone = userProxyService.getMobile(sellerUid);
if (StringUtils.isBlank(phone)){
logger.warn("sellerSkupPaidByBuyer sms send fail,sellerUid {}, prdName {}", sellerUid, prdName);
return;
}
List<String> mobileList = Arrays.asList(phone);
//SmsContentEnum smsIbt = SmsContentEnum.SMS_NOTIFIED_SEND;
//String content = smsIbt.getReplacedContent(prdName);
String content = getReplacedContent(InboxBusinessTypeEnum.SMS_NOTIFIED_SEND.getContent(),prdName);
sendSmsService.smsSendByMobile(content, mobileList);
logger.info("record sellerSkupPaidByBuyer inbox sms msg,sellerUid {}, prdName {}",
... ... @@ -422,14 +418,17 @@ public class InBoxFacade {
/**
* 交易关闭:买家支付完成,卖家取消
*
* @param sellerUid
* @param prdName
* @param sog
*/
public void sellerCancelAfterBuyerPaid(int sellerUid, String prdName) {
public void sellerCancelAfterBuyerPaid(SellerOrderGoods sog) {
int sellerUid = sog.getUid();
String prdName = sog.getProductName();
String sizeName = sog.getSizeName();
try {
executorService.execute(() -> {
InboxBusinessTypeEnum ibt = InboxBusinessTypeEnum.SALE_CLOSED_SELLER;
String params = buildParams(prdName);
String params = buildParams(prdName, sizeName);
InboxReqVO req = buildInboxReqVO(sellerUid, params, ibt);
InBoxResponse resp = inBoxSDK.addInbox(req);
... ... @@ -636,11 +635,22 @@ public class InBoxFacade {
}
}
public void sellerDeliverNotice(int sellerUid, String prdName, int times) {
public void sellerDeliverNotice(SellerOrderGoods sog, int times) {
int sellerUid = sog.getUid();
String prdName = sog.getProductName();
String sizeName = sog.getSizeName();
try {
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);
InboxReqVO req = buildInboxReqVO(sellerUid, params, ibt);
InBoxResponse resp = inBoxSDK.addInbox(req);
logger.info("record sellerDeliverNotice inbox msg,sellerUid {}, prdName {},sizeName {} times {},resp {}",
sellerUid, prdName, sizeName, times, resp);
}
String phone = userProxyService.getMobile(sellerUid);
if (StringUtils.isBlank(phone)){
... ... @@ -651,8 +661,7 @@ public class InBoxFacade {
List<String> mobileList = Arrays.asList(phone);
if (times == 2) {
//SmsContentEnum smsIbt = SmsContentEnum.SMS_NOTIFIED_SEND_SECOND;
//String content = smsIbt.getReplacedContent(prdName);
String content = getReplacedContent(InboxBusinessTypeEnum.SMS_NOTIFIED_SEND_SECOND.getContent(),prdName);
sendSmsService.smsSendByMobile(content, mobileList);
... ...