...
|
...
|
@@ -5,22 +5,30 @@ 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.AppraiseOrderMapper;
|
|
|
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 lombok.Builder;
|
|
|
import lombok.Data;
|
|
|
import org.slf4j.Logger;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
import java.util.Objects;
|
|
|
|
|
|
@Service
|
|
|
public class ServiceOrderProcessor {
|
|
|
|
|
|
private final Logger logger = LoggerUtils.getSellerOrderLogger();
|
|
|
|
|
|
@Autowired
|
|
|
private AppraiseOrderMapper appraiseOrderMapper;
|
|
|
|
|
|
@Autowired
|
|
|
private AppraiseOrderService appraiseOrderService;
|
|
|
|
|
|
@Autowired
|
...
|
...
|
@@ -54,7 +62,7 @@ public class ServiceOrderProcessor { |
|
|
|
|
|
|
|
|
public IGoodsService findGoodsServiceInstance(long orderCode){
|
|
|
AppraiseOrderService.ExistenceNode existenceNode = appraiseOrderService.isAppraiseOrder(orderCode);
|
|
|
ExistenceNode existenceNode = isAppraiseOrder(orderCode);
|
|
|
if (!existenceNode.isExisted) {
|
|
|
logger.warn("deliverToDepot getOrderInfo order not exist, orderCode is {}", orderCode);
|
|
|
throw new ServiceException(ServiceError.ORDER_NULL);
|
...
|
...
|
@@ -63,4 +71,60 @@ public class ServiceOrderProcessor { |
|
|
IGoodsService goodsService = findGoodsServiceInstance(appraiseOrder.getAttributes());
|
|
|
return goodsService;
|
|
|
}
|
|
|
|
|
|
|
|
|
public ExistenceNode findGoodsServiceInstanceAndExt(long orderCode){
|
|
|
ExistenceNode existenceNode = 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 = findGoodsServiceInstance(appraiseOrder.getAttributes());
|
|
|
existenceNode.setGoodsService(goodsService);
|
|
|
return existenceNode;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 是否付费鉴定 or 卖家寄存订单
|
|
|
* @param orderCode
|
|
|
* @return
|
|
|
*/
|
|
|
public ExistenceNode isAppraiseOrder(long orderCode){
|
|
|
AppraiseOrder pao = appraiseOrderMapper.selectByOrderCode(orderCode);
|
|
|
boolean flag = Objects.nonNull(pao);
|
|
|
Integer aoac = flag ? pao.getAttributes() : null;
|
|
|
logger.info("in isAppraiseOrder orderCode {} aoac {} flag {}",
|
|
|
orderCode, aoac, flag);
|
|
|
return ExistenceNode.builder().isExisted(flag).appraiseOrder(pao).build();
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
* 是否付费鉴定订单
|
|
|
* @param uid
|
|
|
* @param orderCode
|
|
|
* @return
|
|
|
*/
|
|
|
public ExistenceNode isPaidAppraiseOrder(int uid, long orderCode){
|
|
|
AppraiseOrder pao = appraiseOrderMapper.selectByOrderCode(orderCode);
|
|
|
Integer aoac = null;
|
|
|
OrderAttributes oa = null;
|
|
|
boolean flag = Objects.nonNull(pao)
|
|
|
&& Objects.nonNull(aoac=pao.getAttributes())
|
|
|
&& Objects.nonNull(oa = OrderAttributes.getOrderAttributes(aoac))
|
|
|
&& Objects.equals(oa, OrderAttributes.APPRAISE);
|
|
|
logger.info("in isAppraiseOrder uid {} orderCode {} aoac {} oa {} flag {}",
|
|
|
uid, orderCode, aoac, oa, flag);
|
|
|
return ExistenceNode.builder().isExisted(flag).appraiseOrder(pao).build();
|
|
|
}
|
|
|
|
|
|
@Data
|
|
|
@Builder
|
|
|
public static class ExistenceNode{
|
|
|
boolean isExisted;
|
|
|
AppraiseOrder appraiseOrder;
|
|
|
IGoodsService goodsService;
|
|
|
}
|
|
|
} |
...
|
...
|
|