Authored by LUOXC

Merge branch 'test6.9.8' of http://git.yoho.cn/ufo/yohoufo-fore into test6.9.8

... ... @@ -5,7 +5,10 @@ import com.alibaba.fastjson.JSONObject;
import com.yoho.error.ServiceError;
import com.yoho.error.exception.ServiceException;
import com.yohobuy.ufo.model.order.bo.OrderInfo;
import com.yohobuy.ufo.model.order.common.*;
import com.yohobuy.ufo.model.order.common.OrderAttributes;
import com.yohobuy.ufo.model.order.common.OrderCodeType;
import com.yohobuy.ufo.model.order.common.OrderStatus;
import com.yohobuy.ufo.model.order.common.TabType;
import com.yohobuy.ufo.model.order.constants.SkupType;
import com.yohoufo.common.alarm.EventBusPublisher;
import com.yohoufo.common.utils.DateUtil;
... ... @@ -72,7 +75,6 @@ public class BuyerOrderPaymentService extends AbstractOrderPaymentService {
@Autowired
private SellerOrderGoodsMapper sellerOrderGoodsMapper;
@Autowired
private CacheCleaner cacheCleaner;
... ... @@ -95,9 +97,6 @@ public class BuyerOrderPaymentService extends AbstractOrderPaymentService {
private TradeBillsService tradeBillsService;
@Autowired
private DepositService depositService;
@Autowired
private AppraiseService appraiseService;
@Autowired
... ... @@ -162,24 +161,20 @@ public class BuyerOrderPaymentService extends AbstractOrderPaymentService {
}
private void processDepositOrderOfQuickDeliverGoods(BuyerOrder buyerOrder, SellerOrderGoods sellerOrderGoods){
Integer sellerUid = null;
Integer buyerUid = null;
Long orderCode = null;
Integer skup = null;
try {
depositService.changeOwner(sellerUid = buyerOrder.getSellerUid(), skup = sellerOrderGoods.getId(),
orderCode = buyerOrder.getOrderCode(), buyerUid = buyerOrder.getUid(), true);
}catch (Exception ex){
logger.warn("pay successful, processDepositOrder invoke depositService.changeOwner fail, sellerUid {}, buyerUid {},orderCode {},skup {}",
sellerUid, buyerUid, orderCode, skup);
}
Integer buyerUid = buyerOrder.getUid();
Long orderCode = buyerOrder.getOrderCode();
inBoxFacade.noticeWhenDepositOrderOfQuickDeliverGoodsPaid(buyerUid, orderCode, sellerOrderGoods);
}
private void processDepositOrderOfInstockGoods(BuyerOrder buyerOrder, SellerOrderGoods sellerOrderGoods){
processInStockOrder(buyerOrder, sellerOrderGoods);
}
/**
*
* @param buyerOrder
* @param sellerOrderGoods
*/
private void processDepositOrder(BuyerOrder buyerOrder, SellerOrderGoods sellerOrderGoods){
SkupType skupType = SkupType.getSkupType(sellerOrderGoods.getAttributes());
//寄存订单 & 闪购商品
... ... @@ -193,6 +188,11 @@ public class BuyerOrderPaymentService extends AbstractOrderPaymentService {
}
}
/**
* 现货
* @param orderInfo
* @param sellerOrderGoods
*/
private void processInStockOrder(BuyerOrder orderInfo, SellerOrderGoods sellerOrderGoods){
Integer uid = orderInfo.getUid();
Integer sellerUid = orderInfo.getSellerUid();
... ... @@ -242,34 +242,28 @@ public class BuyerOrderPaymentService extends AbstractOrderPaymentService {
orderOverTimeService.insertDeliveryTime(new OrderOverTime(orderCode, ts + secondsOfLimit, minutes));
}
private void processQuickDeliverOrder(BuyerOrder buyerOrder, SellerOrderGoods sellerOrderGoods) {
/**
* 急速发货非寄存订单,商品:闪购
* @param buyerOrder
* @param sellerOrderGoods
*/
private void processQuickDeliverOrder(BuyerOrder buyerOrder, SellerOrderGoods sellerOrderGoods){
// notice
inBoxFacade.noticeWhenQuickDeliverOrderPaid(buyerOrder.getUid(), buyerOrder.getOrderCode(), sellerOrderGoods);
Integer sellerUid = buyerOrder.getSellerUid();
Integer buyerUid = buyerOrder.getUid();
Long orderCode = buyerOrder.getOrderCode();
Integer skup = sellerOrderGoods.getId();
//寄存订单 & 闪购商品
if (SkupType.QUICK_DELIVER.getCode() == sellerOrderGoods.getAttributes()) {
try {
depositService.changeOwner(sellerUid, skup, orderCode, buyerUid, false);
} catch (Exception ex) {
logger.warn("pay successful, processQuickDeliverOrder invoke change owner fail, sellerUid {}, buyerUid {},orderCode {},skup {}",
sellerUid, buyerUid, orderCode, skup);
}
}
if (BuyerOrderUtils.isQuickDeliver(buyerOrder.getAttributes())) {
try {
// 插入物流调拨信息
expressInfoService.saveOperateTransferExpressInfo(buyerUid, orderCode,
EXPRESS_TYPE_JUDGE_CENTER.getCode(), operate_transfer, platform_receive);
expressInfoService.saveOperateTransferExpressInfo(buyerUid, orderCode,
EXPRESS_TYPE_JUDGE_CENTER.getCode(), operate_transfer, judge_pass);
} catch (Exception ex) {
logger.warn("pay successful, processQuickDeliverOrder invoke save transfer express info fail, sellerUid {}, buyerUid {},orderCode {},skup {}",
sellerUid, buyerUid, orderCode, skup);
}
try {
// 插入物流调拨信息
expressInfoService.saveOperateTransferExpressInfo(buyerUid, orderCode,
EXPRESS_TYPE_JUDGE_CENTER.getCode(), operate_transfer, platform_receive);
expressInfoService.saveOperateTransferExpressInfo(buyerUid, orderCode,
EXPRESS_TYPE_JUDGE_CENTER.getCode(), operate_transfer, judge_pass);
} catch (Exception ex) {
logger.warn("pay successful, processQuickDeliverOrder invoke save transfer express info fail, sellerUid {}, buyerUid {},orderCode {},skup {}",
sellerUid, buyerUid, orderCode, skup);
}
//todo notice
}
@Override
... ...
... ... @@ -603,7 +603,7 @@ public class AppraiseService {
orderOperateRecordService.addRecord(orderCode, "买家操作", OperateTypeEnum.OPERATE_TYPE_QUALITY_MINI_FAULT_PASS);
//TODO 发消息 瑕疵接收,只给卖家发消息
Product product = Optional.ofNullable(sellerOrderGoods).map(SellerOrderGoods::getProductId).map(productMapper::selectByPrimaryKey).orElse(null);
inBoxFacade.appraisePassNoticeSeller(buyerUid, orderCode, sellerOrderGoods, product);
inBoxFacade.appraisePassNoticeSeller(buyerUid, orderCode, sellerOrderGoods);
} else {
throw new ServiceException(ServiceError.ORDER_STATUS_INVALIDATE); // 更新失败,可能是因为订单状态已经被并发修改
}
... ... @@ -1268,7 +1268,7 @@ public class AppraiseService {
orderStatusFlowService.addAsy(buyerOrder.getOrderCode(), targetOrderStatus.getCode());
//TODO 鉴定通过,
Product product = Optional.ofNullable(sellerOrderGoods).map(SellerOrderGoods::getProductId).map(productMapper::selectByPrimaryKey).orElse(null);
inBoxFacade.appraisePassNoticeSeller(buyerUid, orderCode, sellerOrderGoods, product);
inBoxFacade.appraisePassNoticeSeller(buyerUid, orderCode, sellerOrderGoods);
} catch (Exception ex) {
LOGGER.warn("in judgeCenterPass,refund fail, refundReqOfSeller {}", refundReqOfSeller, ex);
String content = "后台鉴定通过商品,订单" + orderCode + "退还保证金失败";
... ... @@ -1413,8 +1413,8 @@ public class AppraiseService {
//平台已发货给买家
Product product = Optional.ofNullable(sellerOrderGoods).map(SellerOrderGoods::getProductId).map(productMapper::selectByPrimaryKey).orElse(null);
inBoxFacade.appraisePassNoticeBuyer(buyerUid, orderCode, sellerOrderGoods, product);
inBoxFacade.appraisePassNoticeSeller(buyerUid, orderCode, sellerOrderGoods, product);
inBoxFacade.appraisePassNoticeBuyer(buyerUid, orderCode, sellerOrderGoods);
inBoxFacade.appraisePassNoticeSeller(buyerUid, orderCode, sellerOrderGoods);
} catch (Exception ex) {
LOGGER.warn("in appraiseSuccess,refund fail, refundReqOfSeller {}", refundReqOfSeller, ex);
String content = "鉴定通过时,订单" + orderCode + "退还保证金失败";
... ... @@ -1571,12 +1571,20 @@ public class AppraiseService {
public void processQuickDeliverOrderAfterPaid(long orderCode,int uid, boolean isDeposit){
BuyerOrderGoods pbog = buyerOrderGoodsMapper.selectOnlyByOrderCode(orderCode);
BuyerOrder pbo = buyerOrderMapper.selectOnlyByOrderCode(orderCode);
Integer sellerUid = pbo.getSellerUid();
Integer skup = pbog.getSkup();
try {
transferGoodsMoneyWhenPass(pbo.getSellerUid(), pbog.getSkup(), orderCode);
transferGoodsMoneyWhenPass(sellerUid, skup, orderCode);
}catch (Exception ex){
LOGGER.warn("in processQuickDeliverOrderAfterPaid transferGoodsMoneyWhenPass fail orderCode {} uid {}",
orderCode, uid, ex);
}
depositService.changeOwner(pbo.getSellerUid(), pbog.getSkup(), orderCode,uid, isDeposit);
try {
depositService.changeOwner(sellerUid, skup, orderCode,uid, isDeposit);
}catch (Exception ex){
LOGGER.warn("pay successful, processQuickDeliverOrder invoke depositService.changeOwner fail, sellerUid {}, buyerUid {},orderCode {},skup {}",
sellerUid, uid, orderCode, skup);
}
}
}
... ...
... ... @@ -283,6 +283,8 @@ public class DepositServiceImpl implements DepositService {
return false;
}
if (storageDepositMapper.sale(uid, skup, buyOrderCode) == 0) {
LOGGER.warn("changeOwner storageDepositMapper.sale fail, uid {} skup {} buyOrderCode {} isDeposit {}",
uid, skup, buyOrderCode, isDeposit);
return false;
}
// 拷贝鉴定视频
... ...
... ... @@ -117,6 +117,8 @@ public class InBoxFacade {
}
}
/**
* 卖家发货后
* @param buyerUid
... ... @@ -218,17 +220,18 @@ public class InBoxFacade {
*
* @return
*/
public void appraisePassNoticeBuyer(int buyerUid, long orderCode, SellerOrderGoods psog,Product product) {
public void appraisePassNoticeBuyer(int buyerUid, long orderCode, SellerOrderGoods psog) {
executorService.execute(()->{
try {
logger.info("record appraisePassNotice inbox msg, buyerUid {}, orderCode {}, psog {},SellerOrderGoods {} product {}",
buyerUid, orderCode, psog, JSON.toJSONString(psog), JSON.toJSONString(product));
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();
String productCode = Optional.ofNullable(product).map(Product::getProductCode).orElse("");
InboxBusinessTypeEnum ibt = InboxBusinessTypeEnum.PURCHASE_SENDED;
String params = buildParams(orderCode);
InboxReqVO req = buildInboxReqVO(buyerUid, params, ibt);
... ... @@ -256,14 +259,15 @@ public class InBoxFacade {
}
public void appraisePassNoticeSeller(int buyerUid, long orderCode, SellerOrderGoods psog,Product product) {
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), JSON.toJSONString(product));
buyerUid, orderCode, psog, JSON.toJSONString(psog));
String prdName = psog.getProductName();
Product product = productMapper.selectByPrimaryKey(psog.getProductId());
String productCode = Optional.ofNullable(product).map(Product::getProductCode).orElse("");
//seller notice
... ... @@ -1755,38 +1759,117 @@ public class InBoxFacade {
}
}
private void execute(Runnable task, String logModule, Object[] logParms){
try{
executorService.execute(task);
}catch (Exception ex){
logger.warn(logModule, logParms, ex);
}
}
public void noticeWhenBuyerBlownCustomsClearance(int buyerUid, long orderCode, SellerOrderGoods sog){
String prdName = sog.getProductName();
String sizeName = sog.getSizeName();
try {
executorService.execute(()->{
InboxBusinessTypeEnum ibt = InboxBusinessTypeEnum.BUYER_BLOWN_CUSTOMS_CLEARANCE;
String params = buildParams(orderCode);
InboxReqVO req = buildInboxReqVO(buyerUid, params, ibt);
InBoxResponse resp = inBoxSDK.addInbox(req);
logger.info("record noticeWhenBuyerBlownCustomsClearance to buyer inbox msg, buyerUid {}, orderCode {},prdName {} resp {}",
buyerUid, orderCode,prdName, resp);
Runnable task = ()->{
InboxBusinessTypeEnum ibt = InboxBusinessTypeEnum.BUYER_BLOWN_CUSTOMS_CLEARANCE;
String params = buildParams(orderCode);
InboxReqVO req = buildInboxReqVO(buyerUid, params, ibt);
//短信
String phone = userProxyService.getMobile(buyerUid);
if (StringUtils.isBlank(phone)){
logger.warn("in noticeWhenBuyerBlownCustomsClearance sms fail, buyerUid {} orderCode {} prdName {}", buyerUid, orderCode,prdName);
return;
}
List<String> mobileList = Arrays.asList(phone);
InBoxResponse resp = inBoxSDK.addInbox(req);
logger.info("record noticeWhenBuyerBlownCustomsClearance to buyer inbox msg, buyerUid {}, orderCode {},prdName {} resp {}",
buyerUid, orderCode,prdName, resp);
InboxBusinessTypeEnum sms=InboxBusinessTypeEnum.SMS_BUYER_BLOWN_CUSTOMS_CLEARANCE;
//短信
String phone = userProxyService.getMobile(buyerUid);
if (StringUtils.isBlank(phone)){
logger.warn("in noticeWhenBuyerBlownCustomsClearance sms fail, buyerUid {} orderCode {} prdName {}", buyerUid, orderCode,prdName);
return;
}
List<String> mobileList = Arrays.asList(phone);
String content= getReplacedContent(sms.getContent(),prdName,sizeName,orderCode);
sendSmsService.smsSendByMobile(content,mobileList);
logger.info("record noticeWhenBuyerBlownCustomsClearance inbox sms msg, buyer Uid {}, orderCode {},prdName {} ,sizeName {} ",
buyerUid, orderCode, prdName,sizeName);
});
} catch (Exception e) {
logger.warn("InBoxFacade noticeWhenBuyerBlownCustomsClearance error inbox msg, buyerUid {}, orderCode {} ,prdName {}",
buyerUid, orderCode, prdName, e);
}
InboxBusinessTypeEnum sms=InboxBusinessTypeEnum.SMS_BUYER_BLOWN_CUSTOMS_CLEARANCE;
String content= getReplacedContent(sms.getContent(),prdName,sizeName,orderCode);
sendSmsService.smsSendByMobile(content,mobileList);
logger.info("record noticeWhenBuyerBlownCustomsClearance inbox sms msg, buyer Uid {}, orderCode {},prdName {} ,sizeName {} ",
buyerUid, orderCode, prdName,sizeName);
};
String logModule = "InBoxFacade noticeWhenBuyerBlownCustomsClearance error inbox msg, buyerUid {}, orderCode {} ,prdName {}";
Object[] logparams = new Object[]{buyerUid, orderCode, prdName};
execute(task, logModule, logparams);
}
public void noticeWhenQuickDeliverOrderPaid(int buyerUid, long orderCode, SellerOrderGoods sog){
String prdName = sog.getProductName();
String sizeName = sog.getSizeName();
Runnable task = ()->{
InboxBusinessTypeEnum ibt = InboxBusinessTypeEnum.NOTICE_BUYER_WHEN_QUICK_DELIVER_ORDER_PAID;
String params = buildParams(orderCode);
InboxReqVO req = buildInboxReqVO(buyerUid, params, ibt);
InBoxResponse resp = inBoxSDK.addInbox(req);
logger.info("record noticeWhenQuickDeliverOrderPaid to buyer inbox msg, buyerUid {}, orderCode {},prdName {} resp {}",
buyerUid, orderCode,prdName, resp);
//短信
String phone = userProxyService.getMobile(buyerUid);
if (StringUtils.isBlank(phone)){
logger.warn("in noticeWhenQuickDeliverOrderPaid sms fail, buyerUid {} orderCode {} prdName {}", buyerUid, orderCode,prdName);
return;
}
List<String> mobileList = Arrays.asList(phone);
InboxBusinessTypeEnum sms=InboxBusinessTypeEnum.SMS_NOTICE_BUYER_WHEN_QUICK_DELIVER_ORDER_PAID;
String content= getReplacedContent(sms.getContent(),prdName,sizeName,orderCode);
sendSmsService.smsSendByMobile(content,mobileList);
logger.info("record noticeWhenQuickDeliverOrderPaid inbox sms msg, buyer Uid {}, orderCode {},prdName {} ,sizeName {} ",
buyerUid, orderCode, prdName,sizeName);
};
String logModule = "InBoxFacade noticeWhenQuickDeliverOrderPaid error inbox msg, buyerUid {}, orderCode {} ,prdName {}";
Object[] logparams = new Object[]{buyerUid, orderCode, prdName};
execute(task, logModule, logparams);
appraisePassNoticeSeller(buyerUid,orderCode, sog);
}
public void noticeWhenDepositOrderOfQuickDeliverGoodsPaid(int buyerUid, long orderCode, SellerOrderGoods sog){
String prdName = sog.getProductName();
String sizeName = sog.getSizeName();
Runnable task = ()->{
InboxBusinessTypeEnum ibt = InboxBusinessTypeEnum.NOTICE_BUYER_WHEN_DEPOSIT_ORDER_OF_QUICK_DELIVER_PAID;
String params = buildParams(orderCode);
InboxReqVO req = buildInboxReqVO(buyerUid, params, ibt);
InBoxResponse resp = inBoxSDK.addInbox(req);
logger.info("record noticeWhenDepositOrderOfPaid to buyer inbox msg, buyerUid {}, orderCode {},prdName {} resp {}",
buyerUid, orderCode,prdName, resp);
//短信
String phone = userProxyService.getMobile(buyerUid);
if (StringUtils.isBlank(phone)){
logger.warn("in noticeWhenDepositOrderOfPaid sms fail, buyerUid {} orderCode {} prdName {}", buyerUid, orderCode,prdName);
return;
}
List<String> mobileList = Arrays.asList(phone);
InboxBusinessTypeEnum sms=InboxBusinessTypeEnum.SMS_NOTICE_BUYER_WHEN_DEPOSIT_ORDER_OF_QUICK_DELIVER_PAID;
String content= getReplacedContent(sms.getContent(),prdName,sizeName,orderCode);
sendSmsService.smsSendByMobile(content,mobileList);
logger.info("record noticeWhenDepositOrderOfPaid inbox sms msg, buyer Uid {}, orderCode {},prdName {} ,sizeName {} ",
buyerUid, orderCode, prdName,sizeName);
};
String logModule = "InBoxFacade noticeWhenDepositOrderOfPaid error inbox msg, buyerUid {}, orderCode {} ,prdName {}";
Object[] logparams = new Object[]{buyerUid, orderCode, prdName};
execute(task, logModule, logparams);
//
appraisePassNoticeSeller(buyerUid,orderCode, sog);
}
// 召回的
... ...