...
|
...
|
@@ -40,7 +40,7 @@ import java.util.function.Supplier; |
|
|
* Created by chenchao on 2018/10/8.
|
|
|
*/
|
|
|
@Service
|
|
|
public class InBoxFacade {
|
|
|
public class InBoxFacade extends BaseNoticeFacade{
|
|
|
|
|
|
private final Logger logger = LoggerFactory.getLogger(getClass());
|
|
|
|
...
|
...
|
@@ -74,49 +74,25 @@ public class InBoxFacade { |
|
|
* @param buyerUid
|
|
|
*/
|
|
|
public void buyerOrderNotPayed(int buyerUid, long orderCode) {
|
|
|
try {
|
|
|
executorService.execute(() -> {
|
|
|
String params = buildParams(orderCode);
|
|
|
InboxBusinessTypeEnum ibt = InboxBusinessTypeEnum.PURCHASE_UNPAID;
|
|
|
InboxReqVO req = buildInboxReqVO(buyerUid, params, ibt);
|
|
|
|
|
|
//
|
|
|
InBoxResponse resp = inBoxSDK.addInbox(req);
|
|
|
logger.info("record buyerOrderNotPayed inbox msg, buyerUid {}, orderCode {}, resp {}",
|
|
|
buyerUid, orderCode, resp);
|
|
|
|
|
|
//push
|
|
|
SendMessageRspBo bo = ufoSendService.buyerNotPay(String.valueOf(buyerUid),String.valueOf(orderCode));
|
|
|
logger.info("record buyerOrderNotPayed push buyer uid is {}, orderCode is {}, result is {}", buyerUid, orderCode, JSON.toJSONString(bo));
|
|
|
});
|
|
|
} catch (Exception e) {
|
|
|
logger.warn("InBoxFacade buyerOrderNotPayed error inbox msg, buyerUid {}, orderCode {} ",
|
|
|
buyerUid, orderCode, e);
|
|
|
}
|
|
|
logger.info("notice buyer not paid, buyerUid {}, orderCode {}", buyerUid, orderCode);
|
|
|
newNotice(buyerUid)
|
|
|
.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) {
|
|
|
try {
|
|
|
executorService.execute(() -> {
|
|
|
InboxBusinessTypeEnum ibt = InboxBusinessTypeEnum.PURCHASE_NOTIFIED_SELLER;
|
|
|
String timelimitDesc = new StringBuilder().append(deliveryHours).append(unit).toString();
|
|
|
String params = buildParams(orderCode,timelimitDesc);
|
|
|
InboxReqVO req = buildInboxReqVO(buyerUid, params, ibt);
|
|
|
|
|
|
InBoxResponse resp = inBoxSDK.addInbox(req);
|
|
|
logger.info("record buyerFinishPaid inbox msg, buyerUid {}, orderCode {}, resp {}",
|
|
|
buyerUid, orderCode, resp);
|
|
|
});
|
|
|
} catch (Exception e) {
|
|
|
logger.warn("InBoxFacade buyerFinishPaid error inbox msg, buyerUid {}, orderCode {} ",
|
|
|
buyerUid, orderCode, e);
|
|
|
}
|
|
|
public void buyerFinishPaid(int buyerUid, long orderCode, int deliveryHours, String unit) {
|
|
|
logger.info("notice buyer finish paid, buyerUid {}, orderCode {}", buyerUid, orderCode);
|
|
|
String timelimitDesc = new StringBuilder().append(deliveryHours).append(unit).toString();
|
|
|
newNotice(buyerUid)
|
|
|
.withInBox(InboxBusinessTypeEnum.PURCHASE_NOTIFIED_SELLER, orderCode, timelimitDesc)
|
|
|
.send();
|
|
|
}
|
|
|
|
|
|
|
...
|
...
|
@@ -126,43 +102,26 @@ public class InBoxFacade { |
|
|
* @param buyerUid
|
|
|
* @param orderCode
|
|
|
*/
|
|
|
public void sellerDeliver2Depot(int buyerUid, long orderCode,SellerOrderGoods psog ){
|
|
|
executorService.execute(()-> {
|
|
|
try {
|
|
|
String skupTypeText=SkupType.getSkupType(psog.getAttributes()).attrName();
|
|
|
String prdName = psog.getProductName();
|
|
|
InboxBusinessTypeEnum ibtOfBuyer = InboxBusinessTypeEnum.NOTICE_BUYER_WHEN_SELLER_DELIVER;
|
|
|
String params = buildParams(orderCode);
|
|
|
InboxReqVO req = buildInboxReqVO(buyerUid, params, ibtOfBuyer);
|
|
|
InBoxResponse resp = inBoxSDK.addInbox(req);
|
|
|
logger.info("record sellerDeliver2Depot inbox msg, buyerUid {}, orderCode {}, prdName {} resp {}",
|
|
|
buyerUid, orderCode, prdName, resp);
|
|
|
public void sellerDeliver2Depot(int buyerUid, long orderCode, SellerOrderGoods psog) {
|
|
|
try {
|
|
|
executorService.execute(() -> {
|
|
|
|
|
|
String sizeName= psog.getSizeName();
|
|
|
logger.info("notice buyer seller deliver 2 depot, buyerUid {}, orderCode {}", buyerUid, orderCode);
|
|
|
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();
|
|
|
|
|
|
//发push
|
|
|
SendMessageRspBo bo = ufoSendService.sellerDeliverNotice(String.valueOf(buyerUid),String.valueOf(orderCode));
|
|
|
logger.info("record sellerDeliver2Depot push buyer uid is {}, orderCode is {}, result is {}", buyerUid, orderCode, JSON.toJSONString(bo));
|
|
|
|
|
|
//sms
|
|
|
String phone = userProxyService.getMobile(buyerUid);
|
|
|
if (StringUtils.isBlank(phone)){
|
|
|
logger.warn("in sellerDeliver2Depot sms fail, buyerUid {} orderCode {} prdName {} ", buyerUid, orderCode,prdName);
|
|
|
return;
|
|
|
}
|
|
|
String content=getReplacedContent(InboxBusinessTypeEnum.SMS_NOTICE_BUYER_WHEN_SELLER_DELIVER.getContent(),skupTypeText,prdName,sizeName,productCode,orderCode);
|
|
|
List<String> mobileList = Arrays.asList(phone);
|
|
|
sendSmsService.smsSendByMobile(content,mobileList);
|
|
|
logger.info("record sellerDeliver2Depot inbox sms msg, buyerUid {}, orderCode {}, prdName {} phone {}",
|
|
|
buyerUid, orderCode, prdName, phone);
|
|
|
|
|
|
} catch (Exception ex) {
|
|
|
logger.warn("InBoxFacade depotDeliver2Buyer error inbox msg, buyerUid {}, orderCode {} ,prdName {}",
|
|
|
buyerUid, orderCode,psog, ex);
|
|
|
}
|
|
|
});
|
|
|
newNotice(buyerUid)
|
|
|
.withInBox(InboxBusinessTypeEnum.NOTICE_BUYER_WHEN_SELLER_DELIVER, orderCode)
|
|
|
.withPush(() -> ufoSendService.sellerDeliverNotice(String.valueOf(buyerUid), String.valueOf(orderCode)))
|
|
|
.withSms(InboxBusinessTypeEnum.SMS_NOTICE_BUYER_WHEN_SELLER_DELIVER, skupTypeText, prdName, sizeName, productCode, orderCode)
|
|
|
.send();
|
|
|
});
|
|
|
} catch (Exception ex) {
|
|
|
logger.warn("notice buyer seller deliver 2 depot fail, buyerUid {}, orderCode {}", buyerUid, orderCode, ex);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
/**
|
...
|
...
|
@@ -170,92 +129,49 @@ public class InBoxFacade { |
|
|
*
|
|
|
* @return
|
|
|
*/
|
|
|
public void appraisePassNoticeBuyer(int buyerUid, long orderCode, SellerOrderGoods psog) {
|
|
|
|
|
|
executorService.execute(()->{
|
|
|
|
|
|
try {
|
|
|
logger.info("record appraisePassNotice inbox msg, buyerUid {}, orderCode {}, psog {},SellerOrderGoods {} ",
|
|
|
buyerUid, orderCode, psog, JSON.toJSONString(psog));
|
|
|
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();
|
|
|
InboxBusinessTypeEnum ibt = InboxBusinessTypeEnum.PURCHASE_SENDED;
|
|
|
String params = buildParams(orderCode);
|
|
|
InboxReqVO req = buildInboxReqVO(buyerUid, params, ibt);
|
|
|
|
|
|
InBoxResponse resp = inBoxSDK.addInbox(req);
|
|
|
logger.info("record appraisePassNotice inbox msg, buyerUid {}, orderCode {}, prdName {},SellerOrderGoods {} resp {}",
|
|
|
buyerUid, orderCode, prdName, JSON.toJSONString(psog), resp);
|
|
|
public void appraisePassAndDeliveryGoodsToBuyerNoticeBuyer(int buyerUid, long orderCode, SellerOrderGoods psog) {
|
|
|
try {
|
|
|
executorService.execute(() -> {
|
|
|
logger.info("notice buyer appraise pass, buyerUid {}, orderCode {}", buyerUid, orderCode);
|
|
|
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();
|
|
|
|
|
|
//短信
|
|
|
String phone = userProxyService.getMobile(buyerUid);
|
|
|
if (StringUtils.isBlank(phone)){
|
|
|
logger.warn("in appraisePassNotice notice buyer sms fail, buyerUid {} orderCode {} prdName {} ", buyerUid, orderCode,prdName);
|
|
|
}else{
|
|
|
List<String> mobileList = Arrays.asList(phone);
|
|
|
String content = getReplacedContent(InboxBusinessTypeEnum.SMS_SEND.getContent(),skupTypeText,prdName,sizeName,productCode,orderCode);
|
|
|
sendSmsService.smsSendByMobile(content,mobileList);
|
|
|
logger.info("record appraisePassNotice notice buyer sms msg, buyerUid {}, orderCode {}, prdName {} phone {}",
|
|
|
buyerUid, orderCode,prdName, phone);
|
|
|
}
|
|
|
} catch (Exception e) {
|
|
|
logger.warn("InBoxFacade appraisePassNotice error inbox msg, buyerUid {}, orderCode {} ,psog {}",
|
|
|
buyerUid, orderCode, psog, e);
|
|
|
}
|
|
|
newNotice(buyerUid)
|
|
|
.withInBox(InboxBusinessTypeEnum.PURCHASE_SENDED, orderCode)
|
|
|
.withSms(InboxBusinessTypeEnum.SMS_SEND, skupTypeText, prdName, sizeName, productCode, orderCode)
|
|
|
.send();
|
|
|
});
|
|
|
|
|
|
} catch (Exception e) {
|
|
|
logger.warn("notice buyer appraise pass fail, buyerUid {}, orderCode {}", buyerUid, orderCode, e);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
public void appraisePassNoticeSeller(int buyerUid, long orderCode, SellerOrderGoods psog) {
|
|
|
|
|
|
executorService.execute(()->{
|
|
|
|
|
|
try {
|
|
|
logger.info("record appraisePassNoticeSeller inbox msg, buyerUid {}, orderCode {}, psog {},SellerOrderGoods {} product {}",
|
|
|
buyerUid, orderCode, psog, JSON.toJSONString(psog));
|
|
|
try {
|
|
|
executorService.execute(() -> {
|
|
|
logger.info("notice seller appraise pass, buyerUid {}, orderCode {}", buyerUid, orderCode);
|
|
|
String prdName = psog.getProductName();
|
|
|
Product product = productMapper.selectByPrimaryKey(psog.getProductId());
|
|
|
String productCode = Optional.ofNullable(product).map(Product::getProductCode).orElse("");
|
|
|
|
|
|
//seller notice
|
|
|
String sizeName = psog.getSizeName();
|
|
|
Integer sellerUid = psog.getUid();
|
|
|
String skupTypeText=SkupType.getSkupType(psog.getAttributes()).attrName();
|
|
|
InboxBusinessTypeEnum ibtOfSeller = InboxBusinessTypeEnum.NOTICE_SELLER_WHEN_APPRAISE_PASS;
|
|
|
String paramsOfSeller = buildParams(skupTypeText,prdName, sizeName,productCode);
|
|
|
InboxReqVO reqOfSeller = buildInboxReqVO(sellerUid, paramsOfSeller, ibtOfSeller);
|
|
|
String skupTypeText = SkupType.getSkupType(psog.getAttributes()).attrName();
|
|
|
|
|
|
InBoxResponse respOfSeller = inBoxSDK.addInbox(reqOfSeller);
|
|
|
logger.info("record appraisePassNoticeSeller inbox msg, buyerUid {}, orderCode {}, prdName {} ,sizeName {} ,resp {}",
|
|
|
buyerUid, orderCode, prdName,sizeName, respOfSeller);
|
|
|
String phoneOfSeller = userProxyService.getMobile(sellerUid);
|
|
|
if (StringUtils.isBlank(phoneOfSeller)){
|
|
|
logger.warn("in appraisePassNoticeSeller sms fail, buyerUid {} orderCode {} prdName {} ", buyerUid, orderCode,prdName);
|
|
|
}else{
|
|
|
List<String> mobileList = Arrays.asList(phoneOfSeller);
|
|
|
String contentOfSeller = getReplacedContent(InboxBusinessTypeEnum.SMS_NOTICE_SELLER_WHEN_APPRAISE_PASS.getContent(),skupTypeText, orderCode);
|
|
|
sendSmsService.smsSendByMobile(contentOfSeller, mobileList);
|
|
|
logger.info("record appraisePassNoticeSeller sms msg notice seller, sellerUid {}, orderCode {}, prdName {} sizeName {} phone {}",
|
|
|
sellerUid, orderCode, prdName, sizeName, phoneOfSeller);
|
|
|
}
|
|
|
newNotice(sellerUid)
|
|
|
.withInBox(InboxBusinessTypeEnum.NOTICE_SELLER_WHEN_APPRAISE_PASS, skupTypeText, prdName, sizeName, productCode)
|
|
|
.withSms(InboxBusinessTypeEnum.SMS_NOTICE_SELLER_WHEN_APPRAISE_PASS, skupTypeText, orderCode)
|
|
|
.send();
|
|
|
});
|
|
|
|
|
|
} catch (Exception e) {
|
|
|
logger.warn("InBoxFacade appraisePassNoticeSeller error inbox msg, buyerUid {}, orderCode {} ,psog {}",
|
|
|
buyerUid, orderCode, psog, e);
|
|
|
}
|
|
|
});
|
|
|
} catch (Exception e) {
|
|
|
logger.warn("notice seller appraise pass fail, buyerUid {}, orderCode {}", buyerUid, orderCode, e);
|
|
|
}
|
|
|
|
|
|
}
|
|
|
private String replaceSMSContent(InboxBusinessTypeEnum ibte, Object... params){
|
|
|
return getReplacedContent(ibte.getContent(), params);
|
|
|
}
|
|
|
|
|
|
private String getReplacedContent(String content ,Object... params) {
|
|
|
return MessageFormatter.arrayFormat(content, params).getMessage();
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 订单生成,卖家取消售卖
|
...
|
...
|
@@ -1857,28 +1773,6 @@ public class InBoxFacade { |
|
|
}
|
|
|
}
|
|
|
|
|
|
public InboxReqVO buildInboxReqVO(int uid, String params, InboxBusinessTypeEnum ibt) {
|
|
|
InboxReqVO req = new InboxReqVO();
|
|
|
req.setType(ibt.getType());
|
|
|
req.setBusinessType(ibt.getBusinessType());
|
|
|
//
|
|
|
req.setUid(uid);
|
|
|
req.setParams(params);
|
|
|
return req;
|
|
|
}
|
|
|
|
|
|
public static String buildParams(Object... objects) {
|
|
|
if (objects == null) {
|
|
|
return null;
|
|
|
}
|
|
|
|
|
|
if (objects.length == 1) {
|
|
|
return objects[0].toString();
|
|
|
}
|
|
|
|
|
|
String params = StringUtils.join(objects, ",");
|
|
|
return params;
|
|
|
}
|
|
|
|
|
|
|
|
|
} |
...
|
...
|
|