Authored by chenchao

Merge branch 'hotfix_出售商品最低价提示' into test6.9.5

# Conflicts:
#	order/src/main/java/com/yohoufo/order/service/impl/SellerOrderListService.java
@@ -372,7 +372,7 @@ public class SellerOrderDetailService extends AbsOrderDetailService implements I @@ -372,7 +372,7 @@ public class SellerOrderDetailService extends AbsOrderDetailService implements I
372 && leastPrice.compareTo(BigDecimal.ZERO)>0){ 372 && leastPrice.compareTo(BigDecimal.ZERO)>0){
373 goodsInfo.setLeastPrice(leastPrice); 373 goodsInfo.setLeastPrice(leastPrice);
374 goodsInfo.setSuggestMaxPrice(prdPrice.getSuggestMaxPrice()); 374 goodsInfo.setSuggestMaxPrice(prdPrice.getSuggestMaxPrice());
375 - goodsInfo.setLeastPriceOfSkuTips(sellerOrderViewService.buildLeastPriceTips(leastPrice)); 375 + goodsInfo.setLeastPriceOfSkuTips(sellerOrderViewService.buildLeastPriceTips(leastPrice, skupType));
376 } 376 }
377 logger.info("in resetPriceOfProduct after reset, leastPrice {},new goodsInfo {}", 377 logger.info("in resetPriceOfProduct after reset, leastPrice {},new goodsInfo {}",
378 leastPrice, JSON.toJSONString(goodsInfo)); 378 leastPrice, JSON.toJSONString(goodsInfo));
@@ -3,10 +3,7 @@ package com.yohoufo.order.service.impl; @@ -3,10 +3,7 @@ package com.yohoufo.order.service.impl;
3 import com.google.common.collect.Maps; 3 import com.google.common.collect.Maps;
4 import com.yoho.error.ServiceError; 4 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.ButtonShowBo;  
7 -import com.yohobuy.ufo.model.order.bo.GoodsInfo;  
8 -import com.yohobuy.ufo.model.order.bo.OrderInfo;  
9 -import com.yohobuy.ufo.model.order.bo.TimeoutBo; 6 +import com.yohobuy.ufo.model.order.bo.*;
10 import com.yohobuy.ufo.model.order.common.*; 7 import com.yohobuy.ufo.model.order.common.*;
11 import com.yohobuy.ufo.model.order.constants.SkupType; 8 import com.yohobuy.ufo.model.order.constants.SkupType;
12 import com.yohobuy.ufo.model.order.resp.OrderListInfo; 9 import com.yohobuy.ufo.model.order.resp.OrderListInfo;
@@ -105,15 +102,21 @@ public class SellerOrderListService extends AbsOrderListService implements IOrde @@ -105,15 +102,21 @@ public class SellerOrderListService extends AbsOrderListService implements IOrde
105 102
106 103
107 public List<OrderListInfo> buildOrderList(List<SellerOrderGoods> sogList, SellerType sellerType){ 104 public List<OrderListInfo> buildOrderList(List<SellerOrderGoods> sogList, SellerType sellerType){
108 - Map<String, String> overPriceTipsMap = buildOverPriceTipsMap(sogList); 105 + Set<Integer> storageIds = sogList.parallelStream().map(SellerOrderGoods::getStorageId)
  106 + .collect(Collectors.toSet());
  107 + Map<Integer, StorageInfoResp> getStorageDataMap = productProxyService.getStorageDataMap(storageIds);
  108 + Map<String, String> overPriceTipsMap = skupListService.buildOverPriceTipsMap(storageIds, sogList, getStorageDataMap);
109 Map<Integer, SellerOrderGoods> skupSellerOrderGoodsMap = sogList.parallelStream() 109 Map<Integer, SellerOrderGoods> skupSellerOrderGoodsMap = sogList.parallelStream()
110 .collect(Collectors.toMap(SellerOrderGoods::getId, Function.identity())); 110 .collect(Collectors.toMap(SellerOrderGoods::getId, Function.identity()));
111 List<Integer> skupList = sogList.parallelStream().map(SellerOrderGoods::getId).collect(Collectors.toList()); 111 List<Integer> skupList = sogList.parallelStream().map(SellerOrderGoods::getId).collect(Collectors.toList());
112 List<SellerOrder> sellerOrders = sellerOrderMapper.selectBySkups(skupList); 112 List<SellerOrder> sellerOrders = sellerOrderMapper.selectBySkups(skupList);
113 List<OrderListInfo> data ; 113 List<OrderListInfo> data ;
114 data = sellerOrders.parallelStream() 114 data = sellerOrders.parallelStream()
115 - .map(sellerOrder -> buildOrderListInfo(skupSellerOrderGoodsMap.get(sellerOrder.getSkup()),  
116 - sellerOrder, sellerType, overPriceTipsMap)) 115 + .map(sellerOrder -> {
  116 + SellerOrderGoods psog = skupSellerOrderGoodsMap.get(sellerOrder.getSkup());
  117 + StorageInfoResp storageInfoResp = getStorageDataMap.get(psog.getStorageId());
  118 + return buildOrderListInfo(psog, storageInfoResp, sellerOrder, sellerType, overPriceTipsMap);
  119 + })
117 .filter(oli -> Objects.nonNull(oli)) 120 .filter(oli -> Objects.nonNull(oli))
118 .collect(Collectors.toList()); 121 .collect(Collectors.toList());
119 return data; 122 return data;
@@ -219,6 +222,7 @@ public class SellerOrderListService extends AbsOrderListService implements IOrde @@ -219,6 +222,7 @@ public class SellerOrderListService extends AbsOrderListService implements IOrde
219 oli.setLeftTime(timeoutBo.getLeftTime()); 222 oli.setLeftTime(timeoutBo.getLeftTime());
220 oli.setTimeLimit(timeoutBo.getTimelimit()); 223 oli.setTimeLimit(timeoutBo.getTimelimit());
221 } 224 }
  225 +
222 } 226 }
223 } 227 }
224 }); 228 });
@@ -227,22 +231,13 @@ public class SellerOrderListService extends AbsOrderListService implements IOrde @@ -227,22 +231,13 @@ public class SellerOrderListService extends AbsOrderListService implements IOrde
227 231
228 232
229 233
230 - /**  
231 - * 需要商品提供批量接口,减少db net IO, 目前的工期太短,后期再优化  
232 - * @param sogList  
233 - * @return  
234 - */  
235 - public Map<String,String> buildOverPriceTipsMap(List<SellerOrderGoods> sogList){  
236 - Set<Integer> storageIds = sogList.parallelStream().map(SellerOrderGoods::getStorageId)  
237 - .collect(Collectors.toSet());  
238 - Map<Integer, StorageInfoResp> getStorageDataMap = productProxyService.getStorageDataMap(storageIds);  
239 - Map<String,String> map = skupListService.buildOverPriceTipsMap(storageIds, sogList, getStorageDataMap);  
240 - return map;  
241 - }  
242 234
243 235
244 - OrderListInfo buildOrderListInfo(SellerOrderGoods sellerOrderGoods,  
245 - SellerOrder sellerOrder, SellerType st, 236 +
  237 + private OrderListInfo buildOrderListInfo(SellerOrderGoods sellerOrderGoods,
  238 + StorageInfoResp storageInfoResp,
  239 + SellerOrder sellerOrder,
  240 + SellerType st,
246 Map<String,String> overPriceTipsMap) { 241 Map<String,String> overPriceTipsMap) {
247 OrderListInfo orderListInfo = new OrderListInfo(); 242 OrderListInfo orderListInfo = new OrderListInfo();
248 Long orderCode; 243 Long orderCode;
@@ -282,6 +277,16 @@ public class SellerOrderListService extends AbsOrderListService implements IOrde @@ -282,6 +277,16 @@ public class SellerOrderListService extends AbsOrderListService implements IOrde
282 orderListInfo.setEarnestMoney(sellerOrder.getEarnestMoney()); 277 orderListInfo.setEarnestMoney(sellerOrder.getEarnestMoney());
283 278
284 // 279 //
  280 + String leastPriceOfSkuTips = null;
  281 + if (skupType == SkupType.ADVANCE || skupType == SkupType.IN_STOCK){
  282 + if (storageInfoResp != null) {
  283 + PrdPrice prdPrice = PrdPrice.builder()
  284 + .leastPrice(storageInfoResp.getLeastPrice())
  285 + .preSaleLeastPrice(storageInfoResp.getPreSaleLeastPrice())
  286 + .build();
  287 + leastPriceOfSkuTips = sellerOrderViewService.buildLeastPriceTips(prdPrice, skupType);
  288 + }
  289 + }
285 290
286 GoodsInfo goodsInfo = new GoodsInfo(); 291 GoodsInfo goodsInfo = new GoodsInfo();
287 goodsInfo.setColorName(sellerOrderGoods.getColorName()); 292 goodsInfo.setColorName(sellerOrderGoods.getColorName());
@@ -294,7 +299,7 @@ public class SellerOrderListService extends AbsOrderListService implements IOrde @@ -294,7 +299,7 @@ public class SellerOrderListService extends AbsOrderListService implements IOrde
294 goodsInfo.setBatchNo(sellerOrderGoods.getBatchNo()); 299 goodsInfo.setBatchNo(sellerOrderGoods.getBatchNo());
295 goodsInfo.setStorageNum(storageNum); 300 goodsInfo.setStorageNum(storageNum);
296 goodsInfo.setSkupList(sellerOrderGoods.getSkupList()); 301 goodsInfo.setSkupList(sellerOrderGoods.getSkupList());
297 - 302 + goodsInfo.setLeastPriceOfSkuTips(leastPriceOfSkuTips);
298 303
299 orderListInfo.setGoodsInfo(goodsInfo); 304 orderListInfo.setGoodsInfo(goodsInfo);
300 orderListInfo.setSecendLevelCreateTime(sellerOrder.getCreateTime()); 305 orderListInfo.setSecendLevelCreateTime(sellerOrder.getCreateTime());
@@ -6,6 +6,7 @@ import com.yohobuy.ufo.model.order.common.ButtonShow; @@ -6,6 +6,7 @@ import com.yohobuy.ufo.model.order.common.ButtonShow;
6 import com.yohobuy.ufo.model.order.common.SellerOrderListType; 6 import com.yohobuy.ufo.model.order.common.SellerOrderListType;
7 import com.yohobuy.ufo.model.order.common.SkupStatus; 7 import com.yohobuy.ufo.model.order.common.SkupStatus;
8 import com.yohobuy.ufo.model.order.common.TabType; 8 import com.yohobuy.ufo.model.order.common.TabType;
  9 +import com.yohobuy.ufo.model.order.constants.SkupType;
9 import com.yohobuy.ufo.model.order.resp.OrderCntResp; 10 import com.yohobuy.ufo.model.order.resp.OrderCntResp;
10 import com.yohobuy.ufo.model.response.StorageDataResp; 11 import com.yohobuy.ufo.model.response.StorageDataResp;
11 import com.yohoufo.common.utils.BigDecimalHelper; 12 import com.yohoufo.common.utils.BigDecimalHelper;
@@ -144,8 +145,30 @@ public class SellerOrderViewService { @@ -144,8 +145,30 @@ public class SellerOrderViewService {
144 .actor(orderRequest.getTabType()).build(); 145 .actor(orderRequest.getTabType()).build();
145 } 146 }
146 147
147 - String buildLeastPriceTips(BigDecimal leastPrice){  
148 - return "该尺码最低售价¥" + BigDecimalHelper.formatNumber(leastPrice, BigDecimalHelper.FORMAT_NOPOINT); 148 + String buildLeastPriceTips(BigDecimal leastPrice, SkupType skupType){
  149 + String prefix = buildLeastPriceTipsPrefix(skupType);
  150 + return prefix==null ? null : prefix + "¥" + BigDecimalHelper.formatNumber(leastPrice, BigDecimalHelper.FORMAT_NOPOINT);
  151 + }
  152 +
  153 + private String buildLeastPriceTipsPrefix(SkupType skupType){
  154 + String prefix = null;
  155 + switch (skupType){
  156 + case IN_STOCK:
  157 + prefix = "最低现货价";
  158 + break;
  159 + case ADVANCE:
  160 + prefix = "最低预售价";
  161 + break;
  162 +
  163 + }
  164 + return prefix;
  165 + }
  166 +
  167 + String buildLeastPriceTips(PrdPrice prdPrice, SkupType skupType){
  168 +
  169 + BigDecimal leastPrice = prdPrice.getLeastPrice(skupType);
  170 +
  171 + return buildLeastPriceTips(leastPrice, skupType);
149 } 172 }
150 173
151 String buildOtherLowerPriceTips(BigDecimal leastPrice){ 174 String buildOtherLowerPriceTips(BigDecimal leastPrice){
@@ -349,6 +349,7 @@ public class SkupListService { @@ -349,6 +349,7 @@ public class SkupListService {
349 return popDTO; 349 return popDTO;
350 } 350 }
351 351
  352 +
352 private Integer findPrdOverPriceDTO(List<SellerOrderGoods> sogList, Map<Integer, StorageInfoResp> storageDataMap ){ 353 private Integer findPrdOverPriceDTO(List<SellerOrderGoods> sogList, Map<Integer, StorageInfoResp> storageDataMap ){
353 int total = 0; 354 int total = 0;
354 if (MapUtils.isEmpty(storageDataMap)){ 355 if (MapUtils.isEmpty(storageDataMap)){