Authored by chenchao

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

... ... @@ -31,6 +31,7 @@ import com.yohoufo.order.service.IBuyerOrderService;
import com.yohoufo.order.service.IExpressInfoService;
import com.yohoufo.order.service.impl.DepositHelpService;
import com.yohoufo.order.service.impl.MetaConfigService;
import com.yohoufo.order.service.impl.ServiceOrderProcessor;
import com.yohoufo.order.service.seller.SellerOrderCancelService;
import com.yohoufo.order.service.seller.deposit.AppraiseOrderMetaService;
import com.yohoufo.order.service.support.codegenerator.OrderCodeGenerator;
... ... @@ -104,6 +105,9 @@ public class DepositOrderService {
@Autowired
private AppraiseOrderMetaService appraiseOrderMetaService;
@Autowired
ServiceOrderProcessor serviceOrderProcessor;
/**
* 根据库存货号,计算需要召回的费用
* @param req
... ... @@ -273,10 +277,24 @@ public class DepositOrderService {
// 查询最新的物流动态
private ExpressInfoDetail queryExpressInfoDetail(DepositDetailBo depositDetailBo) {
if (StorageDepositStatusEnum.hasExpressInfo(depositDetailBo.getStatus())) { // 已发货 寄回完成状态,去查询最新物流动态
Integer orderStatus = Optional.ofNullable(depositDetailBo.getOrderCode()).map(buyerOrderMapper::selectByOrderCode)
.map(BuyerOrder::getStatus).orElse(OrderStatus.DONE.getCode());
return expressInfoService.getLastExpressInfoDetail(TabType.BUY, orderStatus, depositDetailBo.getOrderCode());
if (serviceOrderProcessor.isGoodsServiceOrder(depositDetailBo.getOrderCode())){
ServiceOrderProcessor.ExistenceNode existenceNode = serviceOrderProcessor.findGoodsServiceInstanceAndExt(depositDetailBo.getOrderCode());
return expressInfoService.getLastExpressInfoDetail(existenceNode.getAppraiseOrder());
}else{
Integer orderStatus = Optional.ofNullable(depositDetailBo.getOrderCode()).map(buyerOrderMapper::selectByOrderCode)
.map(BuyerOrder::getStatus).orElse(OrderStatus.DONE.getCode());
return expressInfoService.getLastExpressInfoDetail(TabType.BUY, orderStatus, depositDetailBo.getOrderCode());
}
}
return null;
}
... ...
... ... @@ -15,9 +15,7 @@ import com.yohoufo.common.helper.ImageUrlAssist;
import com.yohoufo.common.utils.AppVersion;
import com.yohoufo.common.utils.DateUtil;
import com.yohoufo.common.utils.StringUtil;
import com.yohoufo.dal.order.AppraiseOrderMapper;
import com.yohoufo.dal.order.BuyerOrderMapper;
import com.yohoufo.dal.order.DepositCodeMapper;
import com.yohoufo.dal.order.*;
import com.yohoufo.dal.order.model.*;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
... ... @@ -50,6 +48,18 @@ public class DepositHelpService {
@Autowired
private BuyerOrderMapper buyerOrderMapper;
@Autowired
private SellerOrderGoodsMapper sellerOrderGoodsMapper;
@Autowired
private ServiceOrderProcessor serviceOrderProcessor;
@Autowired
private AppraiseOrderGoodsMapper appraiseOrderGoodsMapper;
@Autowired
private AppraiseOrderStorageMapper appraiseOrderStorageMapper;
// 是否 24小时反馈时间 如果是则返回true
public boolean isFeedback(int depositRemainDay) {
return -1 * DepositOrderComputeResp.FEEDBACK_DAY <= depositRemainDay && depositRemainDay <= 0;
... ... @@ -273,4 +283,21 @@ public class DepositHelpService {
return buyerGoodsMap;
}
public SellerOrderGoods querySellerOrderGoods(StorageDeposit deposit) {
if (serviceOrderProcessor.isGoodsServiceOrder(deposit.getOrderCode())) {
List<AppraiseOrderGoods> appraiseOrderGoodses = appraiseOrderGoodsMapper.selectByOrderCode(deposit.getOrderCode());
AppraiseOrderStorage appraiseOrderStorage = appraiseOrderStorageMapper.selectByOrderCode(deposit.getOrderCode());
SellerOrderGoods sog = new SellerOrderGoods();
sog.setSizeName(null == appraiseOrderStorage ? "" : appraiseOrderStorage.getSizeName());
sog.setProductId(deposit.getProductId());
sog.setProductName(CollectionUtils.isEmpty(appraiseOrderGoodses) ? "" : appraiseOrderGoodses.get(0).getProductName());
return sog;
} else {
return Optional.ofNullable(deposit).map(StorageDeposit::getSkup)
.map(sellerOrderGoodsMapper::selectByPrimaryKey).orElse(null);
}
}
}
... ...
... ... @@ -42,6 +42,9 @@ public class DepositOrderPaymentService extends AbstractOrderPaymentService {
@Autowired
private SellerOrderGoodsMapper sellerOrderGoodsMapper;
@Autowired
private DepositHelpService depositHelpService;
@Override
public boolean isTimeoutCancelStatus(OrderInfo orderInfo) {
return false;
... ... @@ -174,8 +177,7 @@ public class DepositOrderPaymentService extends AbstractOrderPaymentService {
try {
logger.info("depositService.notify begin, orderInfo is {}", orderInfo);
StorageDeposit deposit = depositService.selectStorageDeposit(depositOrder.getUid(), depositOrder.getDepositCode());
SellerOrderGoods psog = Optional.ofNullable(deposit).map(StorageDeposit::getSkup)
.map(sellerOrderGoodsMapper::selectByPrimaryKey).orElse(null);
SellerOrderGoods psog = depositHelpService.querySellerOrderGoods(deposit);
inBoxFacade.renewDepositNotify(deposit.getOwnerUid(), psog); // 续约成功后,发通知
} catch (Exception e) {
logger.error("depositService.notify find wrong, orderInfo is {}", orderInfo);
... ... @@ -195,8 +197,7 @@ public class DepositOrderPaymentService extends AbstractOrderPaymentService {
logger.info("depositService.notify begin, orderInfo is {}", orderInfo);
StorageDeposit deposit = depositService.selectStorageDeposit(depositOrder.getUid(), depositOrder.getDepositCode());
SellerOrderGoods psog = Optional.ofNullable(deposit).map(StorageDeposit::getSkup)
.map(sellerOrderGoodsMapper::selectByPrimaryKey).orElse(null);
SellerOrderGoods psog = depositHelpService.querySellerOrderGoods(deposit);
inBoxFacade.recallDepositNotify(deposit.getOwnerUid(), psog); // 更新待拣货状态成功后,发通知
} catch (Exception e) {
logger.error("depositService.notify find wrong, orderInfo is {}", orderInfo);
... ...
... ... @@ -525,20 +525,18 @@ public class DepositServiceImpl implements DepositService {
.depositCode(storageDeposit.getDepositCode())
.skup(storageDeposit.getSkup())
.status(storageDeposit.getStatus())
.ownerUid(storageDeposit.getOwnerUid());
.ownerUid(storageDeposit.getOwnerUid())
.orderCode(storageDeposit.getOrderCode())
.parentOrderCode(null == storageDeposit.getParentOrderCode() ? storageDeposit.getOrderCode() : storageDeposit.getParentOrderCode());
if (DepositOutTypeEnum.OUTTYPE_EXPIRED.getCode().equals(storageDeposit.getOutType())) { // 如果是寄存订单,寄回的商品,则需要查询状态
Map<Long, List<String>> orderStatusStr = depositHelpService.queryAppraiseOrderStatusEx(storageDeposit.getOrderCode());
depositDetailBoBuilder.depositStatusName(CollectionUtils.isNotEmpty(orderStatusStr.get(storageDeposit.getOrderCode())) ? orderStatusStr.get(storageDeposit.getOrderCode()).get(0) : "")
.depositDescName(CollectionUtils.isNotEmpty(orderStatusStr.get(storageDeposit.getOrderCode())) ? orderStatusStr.get(storageDeposit.getOrderCode()).get(1) : "")
.orderCode(storageDeposit.getOrderCode())
.parentOrderCode(storageDeposit.getParentOrderCode());
.depositDescName(CollectionUtils.isNotEmpty(orderStatusStr.get(storageDeposit.getOrderCode())) ? orderStatusStr.get(storageDeposit.getOrderCode()).get(1) : "");
} else { // 正常的买家订单召回
depositDetailBoBuilder.depositStatusName(StorageDepositStatusEnum.getAppStatusNameByCode(storageDeposit.getStatus()))
.depositDescName(StorageDepositStatusEnum.getAppStatusDescByCode(storageDeposit.getStatus()))
.orderCode(storageDeposit.getOrderCode())
.parentOrderCode(storageDeposit.getOrderCode());
.depositDescName(StorageDepositStatusEnum.getAppStatusDescByCode(storageDeposit.getStatus()));
}
return depositDetailBoBuilder.build();
... ...
package com.yohoufo.order.service.proxy;
import com.yohobuy.ufo.model.order.common.OrderCodeType;
import com.yohoufo.common.utils.DateUtil;
import com.yohoufo.dal.order.BuyerOrderStatusFlowMapper;
import com.yohoufo.dal.order.model.BuyerOrderStatusFlow;
import com.yohoufo.order.service.IInviteSettlementService;
import com.yohoufo.order.service.support.codegenerator.OrderCodeGenerator;
import com.yohoufo.order.service.support.codegenerator.bean.CodeMeta;
import com.yohoufo.order.utils.NamedThreadFactory;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
... ... @@ -31,9 +34,14 @@ public class OrderStatusFlowService {
@Autowired
private IInviteSettlementService inviterService;
@Autowired
private OrderCodeGenerator orderCodeGenerator;
public void addAsy(Long orderCode, Integer status) {
try {
CodeMeta codeMeta = orderCodeGenerator.expId(orderCode);
boolean isBuyerOrderCode = OrderCodeType.BUYER_TYPE.getType() == codeMeta.getType();
logger.info("OrderStatusFlowService add enter , status {}, orderCode {} ", status, orderCode);
executorService.execute(() -> {
BuyerOrderStatusFlow buyerOrderStatusFlow = new BuyerOrderStatusFlow();
... ... @@ -43,7 +51,9 @@ public class OrderStatusFlowService {
logger.info("OrderStatusFlowService add execute , buyerOrderStatusFlow {} ", buyerOrderStatusFlow);
buyerOrderStatusFlowMapper.insert(buyerOrderStatusFlow);
});
inviteExecutorService.execute(() -> inviterService.createInviteSettlementItem(orderCode, status));
if (isBuyerOrderCode) {
inviteExecutorService.execute(() -> inviterService.createInviteSettlementItem(orderCode, status));
}
} catch (Exception e) {
logger.warn("OrderStatusFlowService add error , status {}, orderCode {} ", status, orderCode, e);
}
... ...
... ... @@ -136,7 +136,7 @@ public class SellerDepositOrderDetailService extends AbsOrderViewService {
.appraiseAddress(appraiseAddressInfo)
.addressUpgradable(addressUpgradable)
.buttons(aos.detailButtons(oa))
.lastExpressInfoDetail(expressInfoService.getLastExpressInfoDetail(pao))
.lastExpressInfoDetail(lastExpressInfoDetail)
.appraiseProgress(orderStatisticInfo)
.build()
;
... ...