Authored by qinchao

短信文案修改

... ... @@ -12,6 +12,8 @@ import com.yohoufo.common.alarm.EventBusPublisher;
import com.yohoufo.common.utils.DateUtil;
import com.yohoufo.dal.order.*;
import com.yohoufo.dal.order.model.*;
import com.yohoufo.dal.product.ProductMapper;
import com.yohoufo.dal.product.model.Product;
import com.yohoufo.order.common.Payment;
import com.yohoufo.order.common.RefundCase;
import com.yohoufo.order.common.TransferCase;
... ... @@ -48,6 +50,7 @@ import java.math.BigDecimal;
import java.util.Arrays;
import java.util.List;
import java.util.Objects;
import java.util.Optional;
import java.util.concurrent.ArrayBlockingQueue;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.ThreadPoolExecutor;
... ... @@ -119,6 +122,9 @@ public class AppraiseService {
@Autowired
private MerchantOrderPaymentService merchantOrderPaymentService;
@Autowired
private ProductMapper productMapper;
/**
* 瑕疵确认不通过的情况,卖家的保证金扣掉一部分给平台,暂定0元
*/
... ... @@ -209,10 +215,10 @@ public class AppraiseService {
//记录订单的状态变更信息
orderStatusFlowService.addAsy(buyerOrder.getOrderCode(),targetOrderStatus.getCode());
//TODO 平台已发货给买家
//清缓存
cleanCacheAfterUpdateStatus(buyerOrder.getOrderCode(),buyerOrder.getUid(),buyerOrder.getSellerUid());
SellerOrderGoods sellerOrderGoods = cleanCacheAfterUpdateStatus(buyerOrder.getOrderCode(),buyerOrder.getUid(),buyerOrder.getSellerUid());
Product product =Optional.ofNullable(sellerOrderGoods).map(SellerOrderGoods::getProductId).map(productMapper::selectByPrimaryKey).orElse(null);
inBoxFacade.noticeBuyerWhenDeliveryGoodsToBuyer(buyerUid, orderCode, sellerOrderGoods,product);
}else{
LOGGER.warn("in deliveryGoodsToBuyer update status number zero, buyer Order orderCode {} pstatus {}, expect Order Status {}",
orderCode, buyerOrder.getStatus(), expectOrderStatus);
... ... @@ -220,6 +226,14 @@ public class AppraiseService {
}
}
public static void main(String[] args) {
SellerOrderGoods sellerOrderGoods = new SellerOrderGoods();
sellerOrderGoods.setProductId(3);
Integer i=Optional.ofNullable(sellerOrderGoods).map(SellerOrderGoods::getProductId).map(Integer::intValue).orElse(100);
System.out.println(i);
}
/**
* 鉴定不通过退回
* (1)记录物流
... ... @@ -1289,6 +1303,7 @@ public class AppraiseService {
//更新卖家订单状态
SellerOrderGoods sellerOrderGoods = updateSellerOrderStatusAndCleanCache(sellerUid ,sellerOrderCode,expectSOStatus,targetSoStatus,
skup, orderCode, buyerUid);
//退款给卖家(仅退一次)
PaymentRequest refundReqOfSeller = operateMoneyWhenOk(buyerUid,orderCode,skup,sellerOrder,targetSoStatus);
... ... @@ -1338,7 +1353,8 @@ public class AppraiseService {
orderStatusFlowService.addAsy(buyerOrder.getOrderCode(),targetOrderStatus.getCode());
//平台已发货给买家
inBoxFacade.appraisePassNotice(buyerUid, orderCode, sellerOrderGoods);
Product product =Optional.ofNullable(sellerOrderGoods).map(SellerOrderGoods::getProductId).map(productMapper::selectByPrimaryKey).orElse(null);
inBoxFacade.appraisePassNotice(buyerUid, orderCode, sellerOrderGoods,product);
}catch (Exception ex){
LOGGER.warn("in appraiseSuccess,refund fail, refundReqOfSeller {}", refundReqOfSeller, ex);
String content = "鉴定通过时,订单"+ orderCode + "退还保证金失败";
... ...
... ... @@ -18,6 +18,8 @@ import com.yohoufo.dal.order.BuyerOrderMapper;
import com.yohoufo.dal.order.QualityCheckMapper;
import com.yohoufo.dal.order.SellerOrderGoodsMapper;
import com.yohoufo.dal.order.model.*;
import com.yohoufo.dal.product.ProductMapper;
import com.yohoufo.dal.product.model.Product;
import com.yohoufo.order.common.ActionStatusHold;
import com.yohoufo.order.common.DelStatus;
import com.yohoufo.order.common.Payment;
... ... @@ -49,10 +51,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.math.BigDecimal;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.*;
import java.util.stream.Collectors;
@Service
... ... @@ -108,6 +107,9 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService {
@Autowired
private BuyerCancelCompensateComputeHandler buyerCancelCompensateComputeHandler;
@Autowired
private ProductMapper productMapper;
/**
* 提交订单
... ... @@ -777,9 +779,9 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService {
SellerOrderGoods sellerOrderGoods = cleanCacheAfterUpdateStatus(orderCode,uid,sellerUid);
Product product = Optional.ofNullable(sellerOrderGoods).map(SellerOrderGoods::getProductId).map(productMapper::selectByPrimaryKey).orElse(null);
//消息
inBoxFacade.buyerMiniFaultCreate(uid,orderCode,sellerOrderGoods.getProductName());
inBoxFacade.buyerMiniFaultCreate(uid,orderCode,sellerOrderGoods,product);
}
}
... ...
... ... @@ -4,6 +4,7 @@ import com.alibaba.fastjson.JSON;
import com.yohobuy.ufo.model.enums.InboxBusinessTypeEnum;
import com.yohobuy.ufo.model.order.common.SuperEnterStageLevel;
import com.yohoufo.dal.order.model.SellerOrderGoods;
import com.yohoufo.dal.product.model.Product;
import com.yohoufo.inboxclient.model.InBoxResponse;
import com.yohoufo.inboxclient.model.InboxReqVO;
import com.yohoufo.inboxclient.sdk.InBoxSDK;
... ... @@ -18,6 +19,7 @@ import org.springframework.stereotype.Service;
import java.math.BigDecimal;
import java.util.Arrays;
import java.util.List;
import java.util.Optional;
import java.util.concurrent.ArrayBlockingQueue;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.ThreadPoolExecutor;
... ... @@ -129,18 +131,67 @@ public class InBoxFacade {
});
}
/**
* 平台发货给买家
*
* @return
*/
public void noticeBuyerWhenDeliveryGoodsToBuyer(int buyerUid, long orderCode, SellerOrderGoods psog,Product product) {
executorService.execute(()->{
try {
logger.info("record noticeBuyerWhenDeliveryGoodsToBuyer 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);
InboxReqVO req = buildInboxReqVO(buyerUid, params, ibt);
InBoxResponse resp = inBoxSDK.addInbox(req);
logger.info("record noticeBuyerWhenDeliveryGoodsToBuyer inbox msg, buyerUid {}, orderCode {}, prdName {},SellerOrderGoods {} resp {}",
buyerUid, orderCode, prdName, JSON.toJSONString(psog), resp);
//seller notice
//短信
String phone = userProxyService.getMobile(buyerUid);
if (StringUtils.isBlank(phone)){
logger.warn("in noticeBuyerWhenDeliveryGoodsToBuyer notice buyer sms fail, buyerUid {} orderCode {} prdName {} ", buyerUid, orderCode,prdName);
}else{
List<String> mobileList = Arrays.asList(phone);
String content = getReplacedContent(InboxBusinessTypeEnum.SMS_SEND.getContent(),prdName,sizeName,productCode,orderCode);
sendSmsService.smsSendByMobile(content,mobileList);
logger.info("record noticeBuyerWhenDeliveryGoodsToBuyer notice buyer sms msg, buyerUid {}, orderCode {}, prdName {} phone {}",
buyerUid, orderCode,prdName, phone);
}
} catch (Exception e) {
logger.warn("InBoxFacade noticeBuyerWhenDeliveryGoodsToBuyer error inbox msg, buyerUid {}, orderCode {} ,psog {}",
buyerUid, orderCode, psog, e);
}
});
}
/**
* 平台已发货给买家
*
* @return
*/
public void appraisePassNotice(int buyerUid, long orderCode, SellerOrderGoods psog) {
public void appraisePassNotice(int buyerUid, long orderCode, SellerOrderGoods psog,Product product) {
executorService.execute(()->{
try {
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 productCode = Optional.ofNullable(product).map(Product::getProductCode).orElse("");
InboxBusinessTypeEnum ibt = InboxBusinessTypeEnum.PURCHASE_SENDED;
String params = buildParams(orderCode);
InboxReqVO req = buildInboxReqVO(buyerUid, params, ibt);
... ... @@ -176,7 +227,7 @@ public class InBoxFacade {
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(),prdName,orderCode);
String content = getReplacedContent(InboxBusinessTypeEnum.SMS_SEND.getContent(),prdName,sizeName,productCode,orderCode);
sendSmsService.smsSendByMobile(content,mobileList);
logger.info("record appraisePassNotice notice buyer sms msg, buyerUid {}, orderCode {}, prdName {} phone {}",
buyerUid, orderCode,prdName, phone);
... ... @@ -349,33 +400,39 @@ public class InBoxFacade {
/**
* 瑕疵提醒,给买家消息
*/
public void buyerMiniFaultCreate(int buyerUid, long orderCode,String prdName) {
public void buyerMiniFaultCreate(int buyerUid, long orderCode,SellerOrderGoods psog,Product product) {
try {
executorService.execute(() -> {
logger.info("record buyerMiniFaultCreate inbox enter, buyerUid {} ,orderCode {} ,psog {},product {}",
buyerUid, orderCode ,psog, JSON.toJSONString(product));
String prdName = psog.getProductName();
String sizeName = psog.getSizeName();
String productCode = Optional.ofNullable(product).map(Product::getProductCode).orElse("");
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 {} ,prdName {},resp {}",
buyerUid, orderCode ,prdName,resp);
logger.info("record buyerMiniFaultCreate inbox msg, buyerUid {} ,orderCode {} ,psog {},product {},resp {}",
buyerUid, orderCode ,psog,JSON.toJSONString(product),resp);
//短信
String phone = userProxyService.getMobile(buyerUid);
if (StringUtils.isBlank(phone)){
logger.warn("buyerMiniFaultCreate sms send fail,buyerUid {} ,orderCode {},prdName {}", buyerUid, orderCode,prdName);
logger.warn("buyerMiniFaultCreate sms send fail,buyerUid {} ,orderCode {},psog {},product {}", buyerUid, orderCode,psog,JSON.toJSONString(product));
return;
}
List<String> mobileList = Arrays.asList(phone);
String content = getReplacedContent(InboxBusinessTypeEnum.SMS_CHECK_ORDER_PROBLEM.getContent(),prdName,orderCode);
String content = getReplacedContent(InboxBusinessTypeEnum.SMS_CHECK_ORDER_PROBLEM.getContent(),prdName,sizeName,productCode,orderCode);
sendSmsService.smsSendByMobile(content, mobileList);
logger.info("record buyerMiniFaultCreate inbox sms msg,buyerUid {}, orderCode {},prdName {}",
buyerUid ,orderCode,prdName);
});
} catch (Exception e) {
logger.warn("InBoxFacade buyerMiniFaultCreate error inbox msg, buyerUid {},orderCode {},prdName {} ",
buyerUid, orderCode,prdName , e);
logger.warn("InBoxFacade buyerMiniFaultCreate error inbox msg, buyerUid {},orderCode {},psog {},product {} ",
buyerUid, orderCode,psog ,JSON.toJSONString(product), e);
}
}
/**
... ...