Authored by chenchao

fix appraise address

... ... @@ -17,6 +17,8 @@ import java.util.stream.Collectors;
import javax.annotation.Resource;
import com.yohobuy.ufo.model.order.common.*;
import com.yohoufo.dal.order.model.*;
import com.yohoufo.order.service.*;
import com.yohoufo.order.service.listener.BuyerOrderChangeEvent;
import com.yohoufo.order.service.support.codegenerator.OrderCodeGenerator;
import com.yohoufo.order.service.support.codegenerator.bean.CodeMeta;
... ... @@ -52,15 +54,6 @@ import com.yohoufo.dal.order.SellerOrderGoodsMapper;
import com.yohoufo.dal.order.SellerOrderMapper;
import com.yohoufo.dal.order.SellerOrderMetaMapper;
import com.yohoufo.dal.order.StorageDepositMapper;
import com.yohoufo.dal.order.model.BuyerOrder;
import com.yohoufo.dal.order.model.BuyerOrderGoods;
import com.yohoufo.dal.order.model.ExpressRecord;
import com.yohoufo.dal.order.model.QualityCheck;
import com.yohoufo.dal.order.model.SellerOrder;
import com.yohoufo.dal.order.model.SellerOrderGoods;
import com.yohoufo.dal.order.model.SellerOrderMeta;
import com.yohoufo.dal.order.model.SellerWalletDetail;
import com.yohoufo.dal.order.model.StorageDeposit;
import com.yohoufo.dal.product.ProductMapper;
import com.yohoufo.dal.product.model.Product;
import com.yohoufo.order.common.RefundCase;
... ... @@ -77,10 +70,6 @@ import com.yohoufo.order.model.request.TranseferCellNode;
import com.yohoufo.order.model.request.TransferMoneyRequest;
import com.yohoufo.order.model.response.AppraiseAddressResp;
import com.yohoufo.order.mq.TopicConstants;
import com.yohoufo.order.service.DepositService;
import com.yohoufo.order.service.IExpressInfoService;
import com.yohoufo.order.service.IPaymentService;
import com.yohoufo.order.service.MerchantOrderPaymentService;
import com.yohoufo.order.service.cache.CacheCleaner;
import com.yohoufo.order.service.cache.CacheKeyBuilder;
import com.yohoufo.order.service.handler.RefundEarnestMoneyHandler;
... ... @@ -208,6 +197,9 @@ public class AppraiseService {
@Autowired
private OrderCodeGenerator orderCodeGenerator;
@Autowired
private ServiceOrderProcessor serviceOrderProcessor;
/**
* 触发物流
*/
... ... @@ -843,6 +835,8 @@ public class AppraiseService {
/**
* 更新发到卖家的物流信息
* 将卖家的保证金分账给平台和买家
... ... @@ -853,9 +847,11 @@ public class AppraiseService {
public ApiResponse appraiseFailAndDelivery(AppraiseExpressInfoBo appraiseExpressInfoBo) {
LOGGER.info("appraiseFail enter , appraiseExpressInfoBo {} ,appraiseNotPassFlag {}", appraiseExpressInfoBo);
Long orderCode = appraiseExpressInfoBo.getOrderCode();
CodeMeta codeMeta = orderCodeGenerator.expId(orderCode);
OrderCodeType orderCodeType = OrderCodeType.getOrderCodeType(codeMeta.getType());
ApiResponse apiResponse = new ApiResponse();
if (serviceOrderProcessor.isGoodsServiceOrder(orderCode)){
return apiResponse;
}
OrderStatus expectStatus = OrderStatus.PLATFORM_CHECKING;
... ... @@ -866,7 +862,7 @@ public class AppraiseService {
Integer depotNum = appraiseExpressInfoBo.getDepotNum();
String mobile = appraiseExpressInfoBo.getMobile();
ApiResponse apiResponse = new ApiResponse();
BuyerOrder buyerOrder = buyerOrderMapper.selectOnlyByOrderCode(orderCode);
if (buyerOrder == null) {
... ...
... ... @@ -251,14 +251,7 @@ public class ExpressInfoServiceImpl implements IExpressInfoService {
break;
case GOODS_SERVICE:
AppraiseOrderService.ExistenceNode existenceNode = appraiseOrderService.isAppraiseOrder(orderCode);
if (!existenceNode.isExisted) {
LOGGER.warn("deliverToDepot getOrderInfo order not exist, orderCode is {}", orderCode);
throw new ServiceException(ServiceError.ORDER_NULL);
}
AppraiseOrder appraiseOrder = existenceNode.appraiseOrder;
IGoodsService goodsService = serviceOrderProcessor.findGoodsSeriveInstance(appraiseOrder.getAttributes());
IGoodsService goodsService = serviceOrderProcessor.findGoodsServiceInstance(orderCode);
DeliverToDepotReq deliverToDepotReq = DeliverToDepotReq.builder().orderCode(orderCode)
.depotNum(depotNum).uid(sellerUid).build();
updateOrderCnt = goodsService.deliver2Depot(deliverToDepotReq);
... ... @@ -288,7 +281,7 @@ public class ExpressInfoServiceImpl implements IExpressInfoService {
// 发送mq获取物流信息
sendExpressMQ(sellerUid, expressCompanyId, orderCode, wayBillCode, mobile);
LOGGER.info("deliverToDepot end ! send express to erp ");
LOGGER.info("deliverToDepot end ! send express to erp orderCode {}", orderCode);
//记录订单的状态变更信息
LOGGER.info("in deliverToDepot record status change, orderCode {}, sellerUid {}", orderCode, sellerUid);
... ...
package com.yohoufo.order.service.impl;
import com.yoho.error.ServiceError;
import com.yoho.error.exception.ServiceException;
import com.yohobuy.ufo.model.order.common.OrderAttributes;
import com.yohobuy.ufo.model.order.common.OrderCodeType;
import com.yohoufo.common.exception.UfoServiceException;
import com.yohoufo.dal.order.model.AppraiseOrder;
import com.yohoufo.order.service.IGoodsService;
import com.yohoufo.order.service.seller.deposit.SellerDepositOrderService;
import com.yohoufo.order.service.support.codegenerator.OrderCodeGenerator;
import com.yohoufo.order.service.support.codegenerator.bean.CodeMeta;
import com.yohoufo.order.utils.LoggerUtils;
import org.slf4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@Service
public class ServiceOrderProcessor {
private final Logger logger = LoggerUtils.getSellerOrderLogger();
@Autowired
private AppraiseOrderService appraiseOrderService;
@Autowired
private SellerDepositOrderService sellerDepositOrderService;
@Autowired
private OrderCodeGenerator orderCodeGenerator;
public IGoodsService findGoodsSeriveInstance(int oac){
OrderAttributes oa = OrderAttributes.getOrderAttributes(oac);
... ... @@ -34,4 +46,21 @@ public class ServiceOrderProcessor {
return goodsService;
}
public boolean isGoodsServiceOrder(long orderCode){
CodeMeta codeMeta = orderCodeGenerator.expId(orderCode);
OrderCodeType orderCodeType = OrderCodeType.getOrderCodeType(codeMeta.getType());
return OrderCodeType.GOODS_SERVICE.equals(orderCodeType);
}
public IGoodsService findGoodsServiceInstance(long orderCode){
AppraiseOrderService.ExistenceNode existenceNode = appraiseOrderService.isAppraiseOrder(orderCode);
if (!existenceNode.isExisted) {
logger.warn("deliverToDepot getOrderInfo order not exist, orderCode is {}", orderCode);
throw new ServiceException(ServiceError.ORDER_NULL);
}
AppraiseOrder appraiseOrder = existenceNode.appraiseOrder;
IGoodsService goodsService = findGoodsSeriveInstance(appraiseOrder.getAttributes());
return goodsService;
}
}
... ...