Authored by sailing-PC\sailing

optimized

@@ -52,8 +52,8 @@ public abstract class AbsOrderDetailService implements IOrderDetailService{ @@ -52,8 +52,8 @@ public abstract class AbsOrderDetailService implements IOrderDetailService{
52 52
53 abstract SellerOrderGoods getSellerOrderGoods(int skup); 53 abstract SellerOrderGoods getSellerOrderGoods(int skup);
54 54
  55 + abstract void assembleSoldPrdCompute(OrderDetailInfo orderDetailInfo, int uid, int skup);
55 56
56 - abstract SoldPrdComputeBo getSoldPrdCompute(int uid, int skup);  
57 57
58 /** 58 /**
59 * 获取订单详情 59 * 获取订单详情
@@ -111,11 +111,6 @@ public abstract class AbsOrderDetailService implements IOrderDetailService{ @@ -111,11 +111,6 @@ public abstract class AbsOrderDetailService implements IOrderDetailService{
111 && StringUtils.isNotBlank(buyerOrderMeta.getMetaValue())){ 111 && StringUtils.isNotBlank(buyerOrderMeta.getMetaValue())){
112 userAddress = JSONObject.parseObject(buyerOrderMeta.getMetaValue(), AddressInfo.class); 112 userAddress = JSONObject.parseObject(buyerOrderMeta.getMetaValue(), AddressInfo.class);
113 } 113 }
114 - SoldPrdComputeBo soldPrdComputeBo = null;  
115 - if (actor.equals(TabType.SELL)) {  
116 -  
117 - soldPrdComputeBo = getSoldPrdCompute(uid, sellerOrderGoods.getId());  
118 - }  
119 114
120 // 需要查询 时间点 and 物流定位 115 // 需要查询 时间点 and 物流定位
121 ExpressInfoDetail lastEID = null; 116 ExpressInfoDetail lastEID = null;
@@ -132,7 +127,7 @@ public abstract class AbsOrderDetailService implements IOrderDetailService{ @@ -132,7 +127,7 @@ public abstract class AbsOrderDetailService implements IOrderDetailService{
132 } 127 }
133 BuildNode buildNode = BuildNode.builder().buyerOrder(buyerOrder).orderStatus(orderStatus) 128 BuildNode buildNode = BuildNode.builder().buyerOrder(buyerOrder).orderStatus(orderStatus)
134 .buyerOrderGoods(buyerOrderGoods).sellerOrderGoods(sellerOrderGoods).userAddress(userAddress) 129 .buyerOrderGoods(buyerOrderGoods).sellerOrderGoods(sellerOrderGoods).userAddress(userAddress)
135 - .lastEID(lastEID).soldPrdComputeResult(soldPrdComputeBo).build(); 130 + .lastEID(lastEID).build();
136 131
137 OrderDetailInfo orderDetailInfo = buildOrderDetail(buildNode, actor); 132 OrderDetailInfo orderDetailInfo = buildOrderDetail(buildNode, actor);
138 133
@@ -191,17 +186,8 @@ public abstract class AbsOrderDetailService implements IOrderDetailService{ @@ -191,17 +186,8 @@ public abstract class AbsOrderDetailService implements IOrderDetailService{
191 // 需要查询 时间点 and 物流定位 186 // 需要查询 时间点 and 物流定位
192 orderDetailInfo.setLastExpressInfo(buildNode.lastEID); 187 orderDetailInfo.setLastExpressInfo(buildNode.lastEID);
193 188
194 - //  
195 - SoldPrdComputeBo computeBo = buildNode.soldPrdComputeResult;  
196 - if(Objects.nonNull(computeBo)){  
197 - orderDetailInfo.setEarnestMoneyStr(computeBo.getEarnestMoneyStr());  
198 - orderDetailInfo.setEarnestMoney(computeBo.getEarnestMoney());  
199 - orderDetailInfo.setBankTransferFee(computeBo.getBankTransferFee());  
200 - orderDetailInfo.setPlatformFee(computeBo.getPlatformFee());  
201 - orderDetailInfo.setIncome(computeBo.getIncome());  
202 - }  
203 -  
204 - 189 + //只有卖家在查看买家的订单时才有
  190 + assembleSoldPrdCompute(orderDetailInfo, buyerOrder.getSellerUid(), buyerOrderGoods.getSkup());
205 191
206 return orderDetailInfo; 192 return orderDetailInfo;
207 } 193 }
@@ -236,7 +222,6 @@ public abstract class AbsOrderDetailService implements IOrderDetailService{ @@ -236,7 +222,6 @@ public abstract class AbsOrderDetailService implements IOrderDetailService{
236 .detailDesc(orderStatus.getDetailDesc(tabType)) 222 .detailDesc(orderStatus.getDetailDesc(tabType))
237 .build(); 223 .build();
238 224
239 -  
240 // 待付款时,剩余时间 225 // 待付款时,剩余时间
241 if (orderStatus.getCode() == OrderStatus.WAITING_PAY.getCode()){ 226 if (orderStatus.getCode() == OrderStatus.WAITING_PAY.getCode()){
242 int leftTime = calLeftTime(buyerOrder.getCreateTime()); 227 int leftTime = calLeftTime(buyerOrder.getCreateTime());
1 package com.yohoufo.order.service.impl; 1 package com.yohoufo.order.service.impl;
2 2
3 -import com.yohobuy.ufo.model.order.bo.SoldPrdComputeBo;  
4 import com.yohoufo.dal.order.BuyerOrderGoodsMapper; 3 import com.yohoufo.dal.order.BuyerOrderGoodsMapper;
5 import com.yohoufo.dal.order.BuyerOrderMapper; 4 import com.yohoufo.dal.order.BuyerOrderMapper;
6 import com.yohoufo.dal.order.BuyerOrderMetaMapper; 5 import com.yohoufo.dal.order.BuyerOrderMetaMapper;
@@ -9,6 +8,7 @@ import com.yohoufo.dal.order.model.BuyerOrder; @@ -9,6 +8,7 @@ import com.yohoufo.dal.order.model.BuyerOrder;
9 import com.yohoufo.dal.order.model.BuyerOrderGoods; 8 import com.yohoufo.dal.order.model.BuyerOrderGoods;
10 import com.yohoufo.dal.order.model.BuyerOrderMeta; 9 import com.yohoufo.dal.order.model.BuyerOrderMeta;
11 import com.yohoufo.dal.order.model.SellerOrderGoods; 10 import com.yohoufo.dal.order.model.SellerOrderGoods;
  11 +import com.yohoufo.order.model.response.OrderDetailInfo;
12 import com.yohoufo.order.service.IOrderDetailService; 12 import com.yohoufo.order.service.IOrderDetailService;
13 import org.springframework.beans.factory.annotation.Autowired; 13 import org.springframework.beans.factory.annotation.Autowired;
14 import org.springframework.stereotype.Service; 14 import org.springframework.stereotype.Service;
@@ -60,7 +60,9 @@ public class BuyerOrderDetailService extends AbsOrderDetailService implements IO @@ -60,7 +60,9 @@ public class BuyerOrderDetailService extends AbsOrderDetailService implements IO
60 } 60 }
61 61
62 @Override 62 @Override
63 - SoldPrdComputeBo getSoldPrdCompute(int uid, int skup) {  
64 - return null; 63 + void assembleSoldPrdCompute(OrderDetailInfo orderDetailInfo, int uid, int skup) {
  64 +
65 } 65 }
  66 +
  67 +
66 } 68 }
@@ -5,12 +5,12 @@ import com.yoho.error.ServiceError; @@ -5,12 +5,12 @@ import com.yoho.error.ServiceError;
5 import com.yoho.error.exception.ServiceException; 5 import com.yoho.error.exception.ServiceException;
6 import com.yohobuy.ufo.model.order.bo.SoldPrdComputeBo; 6 import com.yohobuy.ufo.model.order.bo.SoldPrdComputeBo;
7 import com.yohoufo.common.utils.DateUtil; 7 import com.yohoufo.common.utils.DateUtil;
8 -import com.yohoufo.common.utils.PriceFormater;  
9 import com.yohoufo.dal.order.*; 8 import com.yohoufo.dal.order.*;
10 import com.yohoufo.dal.order.model.*; 9 import com.yohoufo.dal.order.model.*;
11 -import com.yohoufo.order.common.*; 10 +import com.yohoufo.order.common.OrderCodeType;
  11 +import com.yohoufo.order.common.Payment;
  12 +import com.yohoufo.order.common.SkupStatus;
12 import com.yohoufo.order.constants.MetaKey; 13 import com.yohoufo.order.constants.MetaKey;
13 -import com.yohoufo.order.constants.OrderConstant;  
14 import com.yohoufo.order.convert.SellerOrderConvertor; 14 import com.yohoufo.order.convert.SellerOrderConvertor;
15 import com.yohoufo.order.model.AddressInfo; 15 import com.yohoufo.order.model.AddressInfo;
16 import com.yohoufo.order.model.dto.SellerOrderComputeResult; 16 import com.yohoufo.order.model.dto.SellerOrderComputeResult;
@@ -58,6 +58,9 @@ public class SellerOrderDetailService extends AbsOrderDetailService implements I @@ -58,6 +58,9 @@ public class SellerOrderDetailService extends AbsOrderDetailService implements I
58 @Autowired 58 @Autowired
59 private SellerOrderMetaMapper somMapper; 59 private SellerOrderMetaMapper somMapper;
60 60
  61 + private static List<SkupStatus> noNeedShowOrderCode = Arrays.asList(SkupStatus.CAN_NOT_SELL,SkupStatus.CAN_SELL,
  62 + SkupStatus.SELF_CANCEL_PAY, SkupStatus.TIMEOUT_CANCEL,
  63 + SkupStatus.SELLER_CANCEL_SELL, SkupStatus.YOHO_CANCEL_SELL);
61 64
62 65
63 @Override 66 @Override
@@ -88,19 +91,18 @@ public class SellerOrderDetailService extends AbsOrderDetailService implements I @@ -88,19 +91,18 @@ public class SellerOrderDetailService extends AbsOrderDetailService implements I
88 Integer skupStatusCode = sellerOrderGoods.getStatus(); 91 Integer skupStatusCode = sellerOrderGoods.getStatus();
89 SkupStatus skupStatus = SkupStatus.getSkupStatus(skupStatusCode); 92 SkupStatus skupStatus = SkupStatus.getSkupStatus(skupStatusCode);
90 93
91 - SoldPrdComputeBo computeBo = getSoldPrdCompute(uid, skup);  
92 94
93 SellerOrderMeta addressMeta = somMapper.selectByMetaKey(uid, skup, MetaKey.BACK_2_SELLER_DELIVERY_ADDRESS); 95 SellerOrderMeta addressMeta = somMapper.selectByMetaKey(uid, skup, MetaKey.BACK_2_SELLER_DELIVERY_ADDRESS);
94 AddressInfo addressInfo = JSONObject.parseObject(addressMeta.getMetaValue(), AddressInfo.class); 96 AddressInfo addressInfo = JSONObject.parseObject(addressMeta.getMetaValue(), AddressInfo.class);
95 97
96 - return buildOrderDetail(sellerOrder, skupStatus, sellerOrderGoods, computeBo, addressInfo); 98 + return buildOrderDetail(sellerOrder, skupStatus, sellerOrderGoods, addressInfo);
97 } 99 }
98 100
99 return super.getOrderDetail(orderRequest); 101 return super.getOrderDetail(orderRequest);
100 } 102 }
101 103
102 -  
103 - SoldPrdComputeBo getSoldPrdCompute(int uid, int skup){ 104 + @Override
  105 + void assembleSoldPrdCompute(OrderDetailInfo orderDetailInfo, int uid, int skup){
104 SellerOrderMeta feeMeta = somMapper.selectByMetaKey(uid, skup, MetaKey.SELLER_FEE); 106 SellerOrderMeta feeMeta = somMapper.selectByMetaKey(uid, skup, MetaKey.SELLER_FEE);
105 boolean metaIsPresent = Objects.nonNull(feeMeta); 107 boolean metaIsPresent = Objects.nonNull(feeMeta);
106 SoldPrdComputeBo computeBo = null; 108 SoldPrdComputeBo computeBo = null;
@@ -108,7 +110,13 @@ public class SellerOrderDetailService extends AbsOrderDetailService implements I @@ -108,7 +110,13 @@ public class SellerOrderDetailService extends AbsOrderDetailService implements I
108 SellerOrderComputeResult computeResult = JSONObject.parseObject(feeMeta.getMetaValue(), SellerOrderComputeResult.class); 110 SellerOrderComputeResult computeResult = JSONObject.parseObject(feeMeta.getMetaValue(), SellerOrderComputeResult.class);
109 computeBo = SellerOrderConvertor.computeResult2SoldPrdComputeBo(computeResult); 111 computeBo = SellerOrderConvertor.computeResult2SoldPrdComputeBo(computeResult);
110 } 112 }
111 - return computeBo; 113 + if(Objects.nonNull(computeBo)){
  114 + orderDetailInfo.setEarnestMoneyStr(computeBo.getEarnestMoneyStr());
  115 + orderDetailInfo.setEarnestMoney(computeBo.getEarnestMoney());
  116 + orderDetailInfo.setBankTransferFee(computeBo.getBankTransferFee());
  117 + orderDetailInfo.setPlatformFee(computeBo.getPlatformFee());
  118 + orderDetailInfo.setIncome(computeBo.getIncome());
  119 + }
112 } 120 }
113 121
114 /** 122 /**
@@ -165,6 +173,7 @@ public class SellerOrderDetailService extends AbsOrderDetailService implements I @@ -165,6 +173,7 @@ public class SellerOrderDetailService extends AbsOrderDetailService implements I
165 */ 173 */
166 private GoodsInfo getGoodsInfo(SellerOrderGoods sellerOrderGoods) { 174 private GoodsInfo getGoodsInfo(SellerOrderGoods sellerOrderGoods) {
167 GoodsInfo goodsInfo = new GoodsInfo(); 175 GoodsInfo goodsInfo = new GoodsInfo();
  176 + goodsInfo.setSkup(sellerOrderGoods.getId());
168 goodsInfo.setProductName(sellerOrderGoods.getProductName()); 177 goodsInfo.setProductName(sellerOrderGoods.getProductName());
169 goodsInfo.setColorName(sellerOrderGoods.getColorName()); 178 goodsInfo.setColorName(sellerOrderGoods.getColorName());
170 goodsInfo.setSizeName(sellerOrderGoods.getSizeName()); 179 goodsInfo.setSizeName(sellerOrderGoods.getSizeName());
@@ -199,9 +208,7 @@ public class SellerOrderDetailService extends AbsOrderDetailService implements I @@ -199,9 +208,7 @@ public class SellerOrderDetailService extends AbsOrderDetailService implements I
199 return statusDetail; 208 return statusDetail;
200 } 209 }
201 210
202 - private static List<SkupStatus> noNeedShowOrderCode = Arrays.asList(SkupStatus.CAN_NOT_SELL,SkupStatus.CAN_SELL,  
203 - SkupStatus.SELF_CANCEL_PAY, SkupStatus.TIMEOUT_CANCEL,  
204 - SkupStatus.SELLER_CANCEL_SELL, SkupStatus.YOHO_CANCEL_SELL); 211 +
205 212
206 private Long getOrderCode(SkupStatus skupStatus, SellerOrder order){ 213 private Long getOrderCode(SkupStatus skupStatus, SellerOrder order){
207 Long orderCode; 214 Long orderCode;
@@ -214,8 +221,7 @@ public class SellerOrderDetailService extends AbsOrderDetailService implements I @@ -214,8 +221,7 @@ public class SellerOrderDetailService extends AbsOrderDetailService implements I
214 } 221 }
215 222
216 private OrderDetailInfo buildOrderDetail(SellerOrder order, SkupStatus skupStatus, 223 private OrderDetailInfo buildOrderDetail(SellerOrder order, SkupStatus skupStatus,
217 - SellerOrderGoods sellerOrderGoods, SoldPrdComputeBo computeBo  
218 - , AddressInfo addressInfo 224 + SellerOrderGoods sellerOrderGoods, AddressInfo addressInfo
219 ) { 225 ) {
220 OrderDetailInfo orderDetailInfo = new OrderDetailInfo(); 226 OrderDetailInfo orderDetailInfo = new OrderDetailInfo();
221 orderDetailInfo.setUid(order.getUid()); 227 orderDetailInfo.setUid(order.getUid());
@@ -224,13 +230,7 @@ public class SellerOrderDetailService extends AbsOrderDetailService implements I @@ -224,13 +230,7 @@ public class SellerOrderDetailService extends AbsOrderDetailService implements I
224 orderDetailInfo.setSubmitOrderTimeStr(DateUtil.formatDate(order.getCreateTime(), DateUtil.yyyy_MM_dd_HH_mm_SS)); 230 orderDetailInfo.setSubmitOrderTimeStr(DateUtil.formatDate(order.getCreateTime(), DateUtil.yyyy_MM_dd_HH_mm_SS));
225 orderDetailInfo.setUserAddress(addressInfo); 231 orderDetailInfo.setUserAddress(addressInfo);
226 //卖家 232 //卖家
227 - orderDetailInfo.setIncome(order.getIncome().toPlainString());  
228 - if(Objects.nonNull(computeBo)){  
229 - orderDetailInfo.setEarnestMoneyStr(computeBo.getEarnestMoneyStr());  
230 - orderDetailInfo.setEarnestMoney(computeBo.getEarnestMoney());  
231 - orderDetailInfo.setBankTransferFee(computeBo.getBankTransferFee());  
232 - orderDetailInfo.setPlatformFee(computeBo.getPlatformFee());  
233 - } 233 + assembleSoldPrdCompute(orderDetailInfo, order.getUid(), sellerOrderGoods.getId());
234 234
235 OrderDetailInfo.StatusDetail statusDetail = getStatusDetail(order, skupStatus); 235 OrderDetailInfo.StatusDetail statusDetail = getStatusDetail(order, skupStatus);
236 orderDetailInfo.setStatusDetail(statusDetail); 236 orderDetailInfo.setStatusDetail(statusDetail);