Authored by qinchao

发消息

... ... @@ -441,7 +441,9 @@ public class AppraiseService {
//记录操作记录
orderOperateRecordService.addRecord(orderCode,"买家操作",OperateTypeEnum.OPERATE_TYPE_QUALITY_MINI_FAULT_PASS);
//TODO 发消息
//TODO 发消息 瑕疵接收,只给卖家发消息
Product product =Optional.ofNullable(sellerOrderGoods).map(SellerOrderGoods::getProductId).map(productMapper::selectByPrimaryKey).orElse(null);
inBoxFacade.appraisePassNoticeSeller(buyerUid, orderCode, sellerOrderGoods,product);
}else{
throw new ServiceException(ServiceError.ORDER_STATUS_INVALIDATE); // 更新失败,可能是因为订单状态已经被并发修改
}
... ... @@ -1182,8 +1184,9 @@ public class AppraiseService {
LOGGER.info("in judgeCenterPass record status change, orderCode {},uid {} ,sellerUid {}", orderCode,buyerUid,sellerUid);
orderStatusFlowService.addAsy(buyerOrder.getOrderCode(),targetOrderStatus.getCode());
//TODO 鉴定通过,等待发货,消息
//inBoxFacade.appraisePassNotice(buyerUid, orderCode, sellerOrderGoods);
//TODO 鉴定通过,
Product product =Optional.ofNullable(sellerOrderGoods).map(SellerOrderGoods::getProductId).map(productMapper::selectByPrimaryKey).orElse(null);
inBoxFacade.appraisePassNoticeSeller(buyerUid, orderCode, sellerOrderGoods,product);
}catch (Exception ex){
LOGGER.warn("in judgeCenterPass,refund fail, refundReqOfSeller {}", refundReqOfSeller, ex);
String content = "后台鉴定通过商品,订单"+ orderCode + "退还保证金失败";
... ... @@ -1346,7 +1349,8 @@ public class AppraiseService {
//平台已发货给买家
Product product =Optional.ofNullable(sellerOrderGoods).map(SellerOrderGoods::getProductId).map(productMapper::selectByPrimaryKey).orElse(null);
inBoxFacade.appraisePassNotice(buyerUid, orderCode, sellerOrderGoods,product);
inBoxFacade.appraisePassNoticeBuyer(buyerUid, orderCode, sellerOrderGoods,product);
inBoxFacade.appraisePassNoticeSeller(buyerUid, orderCode, sellerOrderGoods,product);
}catch (Exception ex){
LOGGER.warn("in appraiseSuccess,refund fail, refundReqOfSeller {}", refundReqOfSeller, ex);
String content = "鉴定通过时,订单"+ orderCode + "退还保证金失败";
... ...
... ... @@ -183,7 +183,7 @@ public class InBoxFacade {
*
* @return
*/
public void appraisePassNotice(int buyerUid, long orderCode, SellerOrderGoods psog,Product product) {
public void appraisePassNoticeBuyer(int buyerUid, long orderCode, SellerOrderGoods psog,Product product) {
executorService.execute(()->{
... ... @@ -191,6 +191,7 @@ public class InBoxFacade {
logger.info("record appraisePassNotice inbox msg, buyerUid {}, orderCode {}, psog {},SellerOrderGoods {} product {}",
buyerUid, orderCode, psog, JSON.toJSONString(psog), JSON.toJSONString(product));
String prdName = psog.getProductName();
String sizeName = psog.getSizeName();
String productCode = Optional.ofNullable(product).map(Product::getProductCode).orElse("");
InboxBusinessTypeEnum ibt = InboxBusinessTypeEnum.PURCHASE_SENDED;
String params = buildParams(orderCode);
... ... @@ -200,27 +201,6 @@ public class InBoxFacade {
logger.info("record appraisePassNotice inbox msg, buyerUid {}, orderCode {}, prdName {},SellerOrderGoods {} resp {}",
buyerUid, orderCode, prdName, JSON.toJSONString(psog), resp);
//seller notice
String sizeName = psog.getSizeName();
Integer sellerUid = psog.getUid();
InboxBusinessTypeEnum ibtOfSeller = InboxBusinessTypeEnum.NOTICE_SELLER_WHEN_APPRAISE_PASS;
String paramsOfSeller = buildParams(prdName, sizeName);
InboxReqVO reqOfSeller = buildInboxReqVO(sellerUid, paramsOfSeller, ibtOfSeller);
InBoxResponse respOfSeller = inBoxSDK.addInbox(reqOfSeller);
logger.info("record appraisePassNotice inbox msg, buyerUid {}, orderCode {}, prdName {} ,sizeName {} ,resp {}",
buyerUid, orderCode, prdName,sizeName, respOfSeller);
String phoneOfSeller = userProxyService.getMobile(sellerUid);
if (StringUtils.isBlank(phoneOfSeller)){
logger.warn("in appraisePassNotice 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(), orderCode);
sendSmsService.smsSendByMobile(contentOfSeller, mobileList);
logger.info("record appraisePassNotice sms msg notice seller, sellerUid {}, orderCode {}, prdName {} sizeName {} phone {}",
sellerUid, orderCode, prdName, sizeName, phoneOfSeller);
}
//短信
String phone = userProxyService.getMobile(buyerUid);
if (StringUtils.isBlank(phone)){
... ... @@ -239,6 +219,45 @@ public class InBoxFacade {
});
}
public void appraisePassNoticeSeller(int buyerUid, long orderCode, SellerOrderGoods psog,Product product) {
executorService.execute(()->{
try {
logger.info("record appraisePassNoticeSeller inbox msg, buyerUid {}, orderCode {}, psog {},SellerOrderGoods {} product {}",
buyerUid, orderCode, psog, JSON.toJSONString(psog), JSON.toJSONString(product));
String prdName = psog.getProductName();
String productCode = Optional.ofNullable(product).map(Product::getProductCode).orElse("");
//seller notice
String sizeName = psog.getSizeName();
Integer sellerUid = psog.getUid();
InboxBusinessTypeEnum ibtOfSeller = InboxBusinessTypeEnum.NOTICE_SELLER_WHEN_APPRAISE_PASS;
String paramsOfSeller = buildParams(prdName, sizeName);
InboxReqVO reqOfSeller = buildInboxReqVO(sellerUid, paramsOfSeller, ibtOfSeller);
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(), orderCode);
sendSmsService.smsSendByMobile(contentOfSeller, mobileList);
logger.info("record appraisePassNoticeSeller sms msg notice seller, sellerUid {}, orderCode {}, prdName {} sizeName {} phone {}",
sellerUid, orderCode, prdName, sizeName, phoneOfSeller);
}
} catch (Exception e) {
logger.warn("InBoxFacade appraisePassNoticeSeller error inbox msg, buyerUid {}, orderCode {} ,psog {}",
buyerUid, orderCode, psog, e);
}
});
}
private String replaceSMSContent(InboxBusinessTypeEnum ibte, Object... params){
return getReplacedContent(ibte.getContent(), params);
}
... ...