Authored by sailing-PC\sailing

optimized

... ... @@ -52,8 +52,8 @@ public abstract class AbsOrderDetailService implements IOrderDetailService{
abstract SellerOrderGoods getSellerOrderGoods(int skup);
abstract void assembleSoldPrdCompute(OrderDetailInfo orderDetailInfo, int uid, int skup);
abstract SoldPrdComputeBo getSoldPrdCompute(int uid, int skup);
/**
* 获取订单详情
... ... @@ -111,11 +111,6 @@ public abstract class AbsOrderDetailService implements IOrderDetailService{
&& StringUtils.isNotBlank(buyerOrderMeta.getMetaValue())){
userAddress = JSONObject.parseObject(buyerOrderMeta.getMetaValue(), AddressInfo.class);
}
SoldPrdComputeBo soldPrdComputeBo = null;
if (actor.equals(TabType.SELL)) {
soldPrdComputeBo = getSoldPrdCompute(uid, sellerOrderGoods.getId());
}
// 需要查询 时间点 and 物流定位
ExpressInfoDetail lastEID = null;
... ... @@ -132,7 +127,7 @@ public abstract class AbsOrderDetailService implements IOrderDetailService{
}
BuildNode buildNode = BuildNode.builder().buyerOrder(buyerOrder).orderStatus(orderStatus)
.buyerOrderGoods(buyerOrderGoods).sellerOrderGoods(sellerOrderGoods).userAddress(userAddress)
.lastEID(lastEID).soldPrdComputeResult(soldPrdComputeBo).build();
.lastEID(lastEID).build();
OrderDetailInfo orderDetailInfo = buildOrderDetail(buildNode, actor);
... ... @@ -191,17 +186,8 @@ public abstract class AbsOrderDetailService implements IOrderDetailService{
// 需要查询 时间点 and 物流定位
orderDetailInfo.setLastExpressInfo(buildNode.lastEID);
//
SoldPrdComputeBo computeBo = buildNode.soldPrdComputeResult;
if(Objects.nonNull(computeBo)){
orderDetailInfo.setEarnestMoneyStr(computeBo.getEarnestMoneyStr());
orderDetailInfo.setEarnestMoney(computeBo.getEarnestMoney());
orderDetailInfo.setBankTransferFee(computeBo.getBankTransferFee());
orderDetailInfo.setPlatformFee(computeBo.getPlatformFee());
orderDetailInfo.setIncome(computeBo.getIncome());
}
//只有卖家在查看买家的订单时才有
assembleSoldPrdCompute(orderDetailInfo, buyerOrder.getSellerUid(), buyerOrderGoods.getSkup());
return orderDetailInfo;
}
... ... @@ -236,7 +222,6 @@ public abstract class AbsOrderDetailService implements IOrderDetailService{
.detailDesc(orderStatus.getDetailDesc(tabType))
.build();
// 待付款时,剩余时间
if (orderStatus.getCode() == OrderStatus.WAITING_PAY.getCode()){
int leftTime = calLeftTime(buyerOrder.getCreateTime());
... ...
package com.yohoufo.order.service.impl;
import com.yohobuy.ufo.model.order.bo.SoldPrdComputeBo;
import com.yohoufo.dal.order.BuyerOrderGoodsMapper;
import com.yohoufo.dal.order.BuyerOrderMapper;
import com.yohoufo.dal.order.BuyerOrderMetaMapper;
... ... @@ -9,6 +8,7 @@ import com.yohoufo.dal.order.model.BuyerOrder;
import com.yohoufo.dal.order.model.BuyerOrderGoods;
import com.yohoufo.dal.order.model.BuyerOrderMeta;
import com.yohoufo.dal.order.model.SellerOrderGoods;
import com.yohoufo.order.model.response.OrderDetailInfo;
import com.yohoufo.order.service.IOrderDetailService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
... ... @@ -60,7 +60,9 @@ public class BuyerOrderDetailService extends AbsOrderDetailService implements IO
}
@Override
SoldPrdComputeBo getSoldPrdCompute(int uid, int skup) {
return null;
void assembleSoldPrdCompute(OrderDetailInfo orderDetailInfo, int uid, int skup) {
}
}
... ...
... ... @@ -5,12 +5,12 @@ import com.yoho.error.ServiceError;
import com.yoho.error.exception.ServiceException;
import com.yohobuy.ufo.model.order.bo.SoldPrdComputeBo;
import com.yohoufo.common.utils.DateUtil;
import com.yohoufo.common.utils.PriceFormater;
import com.yohoufo.dal.order.*;
import com.yohoufo.dal.order.model.*;
import com.yohoufo.order.common.*;
import com.yohoufo.order.common.OrderCodeType;
import com.yohoufo.order.common.Payment;
import com.yohoufo.order.common.SkupStatus;
import com.yohoufo.order.constants.MetaKey;
import com.yohoufo.order.constants.OrderConstant;
import com.yohoufo.order.convert.SellerOrderConvertor;
import com.yohoufo.order.model.AddressInfo;
import com.yohoufo.order.model.dto.SellerOrderComputeResult;
... ... @@ -58,6 +58,9 @@ public class SellerOrderDetailService extends AbsOrderDetailService implements I
@Autowired
private SellerOrderMetaMapper somMapper;
private static List<SkupStatus> noNeedShowOrderCode = Arrays.asList(SkupStatus.CAN_NOT_SELL,SkupStatus.CAN_SELL,
SkupStatus.SELF_CANCEL_PAY, SkupStatus.TIMEOUT_CANCEL,
SkupStatus.SELLER_CANCEL_SELL, SkupStatus.YOHO_CANCEL_SELL);
@Override
... ... @@ -88,19 +91,18 @@ public class SellerOrderDetailService extends AbsOrderDetailService implements I
Integer skupStatusCode = sellerOrderGoods.getStatus();
SkupStatus skupStatus = SkupStatus.getSkupStatus(skupStatusCode);
SoldPrdComputeBo computeBo = getSoldPrdCompute(uid, skup);
SellerOrderMeta addressMeta = somMapper.selectByMetaKey(uid, skup, MetaKey.BACK_2_SELLER_DELIVERY_ADDRESS);
AddressInfo addressInfo = JSONObject.parseObject(addressMeta.getMetaValue(), AddressInfo.class);
return buildOrderDetail(sellerOrder, skupStatus, sellerOrderGoods, computeBo, addressInfo);
return buildOrderDetail(sellerOrder, skupStatus, sellerOrderGoods, addressInfo);
}
return super.getOrderDetail(orderRequest);
}
SoldPrdComputeBo getSoldPrdCompute(int uid, int skup){
@Override
void assembleSoldPrdCompute(OrderDetailInfo orderDetailInfo, int uid, int skup){
SellerOrderMeta feeMeta = somMapper.selectByMetaKey(uid, skup, MetaKey.SELLER_FEE);
boolean metaIsPresent = Objects.nonNull(feeMeta);
SoldPrdComputeBo computeBo = null;
... ... @@ -108,7 +110,13 @@ public class SellerOrderDetailService extends AbsOrderDetailService implements I
SellerOrderComputeResult computeResult = JSONObject.parseObject(feeMeta.getMetaValue(), SellerOrderComputeResult.class);
computeBo = SellerOrderConvertor.computeResult2SoldPrdComputeBo(computeResult);
}
return computeBo;
if(Objects.nonNull(computeBo)){
orderDetailInfo.setEarnestMoneyStr(computeBo.getEarnestMoneyStr());
orderDetailInfo.setEarnestMoney(computeBo.getEarnestMoney());
orderDetailInfo.setBankTransferFee(computeBo.getBankTransferFee());
orderDetailInfo.setPlatformFee(computeBo.getPlatformFee());
orderDetailInfo.setIncome(computeBo.getIncome());
}
}
/**
... ... @@ -165,6 +173,7 @@ public class SellerOrderDetailService extends AbsOrderDetailService implements I
*/
private GoodsInfo getGoodsInfo(SellerOrderGoods sellerOrderGoods) {
GoodsInfo goodsInfo = new GoodsInfo();
goodsInfo.setSkup(sellerOrderGoods.getId());
goodsInfo.setProductName(sellerOrderGoods.getProductName());
goodsInfo.setColorName(sellerOrderGoods.getColorName());
goodsInfo.setSizeName(sellerOrderGoods.getSizeName());
... ... @@ -199,9 +208,7 @@ public class SellerOrderDetailService extends AbsOrderDetailService implements I
return statusDetail;
}
private static List<SkupStatus> noNeedShowOrderCode = Arrays.asList(SkupStatus.CAN_NOT_SELL,SkupStatus.CAN_SELL,
SkupStatus.SELF_CANCEL_PAY, SkupStatus.TIMEOUT_CANCEL,
SkupStatus.SELLER_CANCEL_SELL, SkupStatus.YOHO_CANCEL_SELL);
private Long getOrderCode(SkupStatus skupStatus, SellerOrder order){
Long orderCode;
... ... @@ -214,8 +221,7 @@ public class SellerOrderDetailService extends AbsOrderDetailService implements I
}
private OrderDetailInfo buildOrderDetail(SellerOrder order, SkupStatus skupStatus,
SellerOrderGoods sellerOrderGoods, SoldPrdComputeBo computeBo
, AddressInfo addressInfo
SellerOrderGoods sellerOrderGoods, AddressInfo addressInfo
) {
OrderDetailInfo orderDetailInfo = new OrderDetailInfo();
orderDetailInfo.setUid(order.getUid());
... ... @@ -224,13 +230,7 @@ public class SellerOrderDetailService extends AbsOrderDetailService implements I
orderDetailInfo.setSubmitOrderTimeStr(DateUtil.formatDate(order.getCreateTime(), DateUtil.yyyy_MM_dd_HH_mm_SS));
orderDetailInfo.setUserAddress(addressInfo);
//卖家
orderDetailInfo.setIncome(order.getIncome().toPlainString());
if(Objects.nonNull(computeBo)){
orderDetailInfo.setEarnestMoneyStr(computeBo.getEarnestMoneyStr());
orderDetailInfo.setEarnestMoney(computeBo.getEarnestMoney());
orderDetailInfo.setBankTransferFee(computeBo.getBankTransferFee());
orderDetailInfo.setPlatformFee(computeBo.getPlatformFee());
}
assembleSoldPrdCompute(orderDetailInfo, order.getUid(), sellerOrderGoods.getId());
OrderDetailInfo.StatusDetail statusDetail = getStatusDetail(order, skupStatus);
orderDetailInfo.setStatusDetail(statusDetail);
... ...