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
&& leastPrice.compareTo(BigDecimal.ZERO)>0){
goodsInfo.setLeastPrice(leastPrice);
goodsInfo.setSuggestMaxPrice(prdPrice.getSuggestMaxPrice());
goodsInfo.setLeastPriceOfSkuTips(sellerOrderViewService.buildLeastPriceTips(leastPrice));
goodsInfo.setLeastPriceOfSkuTips(sellerOrderViewService.buildLeastPriceTips(leastPrice, skupType));
}
logger.info("in resetPriceOfProduct after reset, leastPrice {},new goodsInfo {}",
leastPrice, JSON.toJSONString(goodsInfo));
... ...
... ... @@ -3,10 +3,7 @@ package com.yohoufo.order.service.impl;
import com.google.common.collect.Maps;
import com.yoho.error.ServiceError;
import com.yoho.error.exception.ServiceException;
import com.yohobuy.ufo.model.order.bo.ButtonShowBo;
import com.yohobuy.ufo.model.order.bo.GoodsInfo;
import com.yohobuy.ufo.model.order.bo.OrderInfo;
import com.yohobuy.ufo.model.order.bo.TimeoutBo;
import com.yohobuy.ufo.model.order.bo.*;
import com.yohobuy.ufo.model.order.common.*;
import com.yohobuy.ufo.model.order.constants.SkupType;
import com.yohobuy.ufo.model.order.resp.OrderListInfo;
... ... @@ -105,15 +102,21 @@ public class SellerOrderListService extends AbsOrderListService implements IOrde
public List<OrderListInfo> buildOrderList(List<SellerOrderGoods> sogList, SellerType sellerType){
Map<String, String> overPriceTipsMap = buildOverPriceTipsMap(sogList);
Set<Integer> storageIds = sogList.parallelStream().map(SellerOrderGoods::getStorageId)
.collect(Collectors.toSet());
Map<Integer, StorageInfoResp> getStorageDataMap = productProxyService.getStorageDataMap(storageIds);
Map<String, String> overPriceTipsMap = skupListService.buildOverPriceTipsMap(storageIds, sogList, getStorageDataMap);
Map<Integer, SellerOrderGoods> skupSellerOrderGoodsMap = sogList.parallelStream()
.collect(Collectors.toMap(SellerOrderGoods::getId, Function.identity()));
List<Integer> skupList = sogList.parallelStream().map(SellerOrderGoods::getId).collect(Collectors.toList());
List<SellerOrder> sellerOrders = sellerOrderMapper.selectBySkups(skupList);
List<OrderListInfo> data ;
data = sellerOrders.parallelStream()
.map(sellerOrder -> buildOrderListInfo(skupSellerOrderGoodsMap.get(sellerOrder.getSkup()),
sellerOrder, sellerType, overPriceTipsMap))
.map(sellerOrder -> {
SellerOrderGoods psog = skupSellerOrderGoodsMap.get(sellerOrder.getSkup());
StorageInfoResp storageInfoResp = getStorageDataMap.get(psog.getStorageId());
return buildOrderListInfo(psog, storageInfoResp, sellerOrder, sellerType, overPriceTipsMap);
})
.filter(oli -> Objects.nonNull(oli))
.collect(Collectors.toList());
return data;
... ... @@ -219,6 +222,7 @@ public class SellerOrderListService extends AbsOrderListService implements IOrde
oli.setLeftTime(timeoutBo.getLeftTime());
oli.setTimeLimit(timeoutBo.getTimelimit());
}
}
}
});
... ... @@ -227,22 +231,13 @@ public class SellerOrderListService extends AbsOrderListService implements IOrde
/**
* 需要商品提供批量接口,减少db net IO, 目前的工期太短,后期再优化
* @param sogList
* @return
*/
public Map<String,String> buildOverPriceTipsMap(List<SellerOrderGoods> sogList){
Set<Integer> storageIds = sogList.parallelStream().map(SellerOrderGoods::getStorageId)
.collect(Collectors.toSet());
Map<Integer, StorageInfoResp> getStorageDataMap = productProxyService.getStorageDataMap(storageIds);
Map<String,String> map = skupListService.buildOverPriceTipsMap(storageIds, sogList, getStorageDataMap);
return map;
}
OrderListInfo buildOrderListInfo(SellerOrderGoods sellerOrderGoods,
SellerOrder sellerOrder, SellerType st,
private OrderListInfo buildOrderListInfo(SellerOrderGoods sellerOrderGoods,
StorageInfoResp storageInfoResp,
SellerOrder sellerOrder,
SellerType st,
Map<String,String> overPriceTipsMap) {
OrderListInfo orderListInfo = new OrderListInfo();
Long orderCode;
... ... @@ -282,6 +277,16 @@ public class SellerOrderListService extends AbsOrderListService implements IOrde
orderListInfo.setEarnestMoney(sellerOrder.getEarnestMoney());
//
String leastPriceOfSkuTips = null;
if (skupType == SkupType.ADVANCE || skupType == SkupType.IN_STOCK){
if (storageInfoResp != null) {
PrdPrice prdPrice = PrdPrice.builder()
.leastPrice(storageInfoResp.getLeastPrice())
.preSaleLeastPrice(storageInfoResp.getPreSaleLeastPrice())
.build();
leastPriceOfSkuTips = sellerOrderViewService.buildLeastPriceTips(prdPrice, skupType);
}
}
GoodsInfo goodsInfo = new GoodsInfo();
goodsInfo.setColorName(sellerOrderGoods.getColorName());
... ... @@ -294,7 +299,7 @@ public class SellerOrderListService extends AbsOrderListService implements IOrde
goodsInfo.setBatchNo(sellerOrderGoods.getBatchNo());
goodsInfo.setStorageNum(storageNum);
goodsInfo.setSkupList(sellerOrderGoods.getSkupList());
goodsInfo.setLeastPriceOfSkuTips(leastPriceOfSkuTips);
orderListInfo.setGoodsInfo(goodsInfo);
orderListInfo.setSecendLevelCreateTime(sellerOrder.getCreateTime());
... ...
... ... @@ -6,6 +6,7 @@ import com.yohobuy.ufo.model.order.common.ButtonShow;
import com.yohobuy.ufo.model.order.common.SellerOrderListType;
import com.yohobuy.ufo.model.order.common.SkupStatus;
import com.yohobuy.ufo.model.order.common.TabType;
import com.yohobuy.ufo.model.order.constants.SkupType;
import com.yohobuy.ufo.model.order.resp.OrderCntResp;
import com.yohobuy.ufo.model.response.StorageDataResp;
import com.yohoufo.common.utils.BigDecimalHelper;
... ... @@ -144,8 +145,30 @@ public class SellerOrderViewService {
.actor(orderRequest.getTabType()).build();
}
String buildLeastPriceTips(BigDecimal leastPrice){
return "该尺码最低售价¥" + BigDecimalHelper.formatNumber(leastPrice, BigDecimalHelper.FORMAT_NOPOINT);
String buildLeastPriceTips(BigDecimal leastPrice, SkupType skupType){
String prefix = buildLeastPriceTipsPrefix(skupType);
return prefix==null ? null : prefix + "¥" + BigDecimalHelper.formatNumber(leastPrice, BigDecimalHelper.FORMAT_NOPOINT);
}
private String buildLeastPriceTipsPrefix(SkupType skupType){
String prefix = null;
switch (skupType){
case IN_STOCK:
prefix = "最低现货价";
break;
case ADVANCE:
prefix = "最低预售价";
break;
}
return prefix;
}
String buildLeastPriceTips(PrdPrice prdPrice, SkupType skupType){
BigDecimal leastPrice = prdPrice.getLeastPrice(skupType);
return buildLeastPriceTips(leastPrice, skupType);
}
String buildOtherLowerPriceTips(BigDecimal leastPrice){
... ...
... ... @@ -349,6 +349,7 @@ public class SkupListService {
return popDTO;
}
private Integer findPrdOverPriceDTO(List<SellerOrderGoods> sogList, Map<Integer, StorageInfoResp> storageDataMap ){
int total = 0;
if (MapUtils.isEmpty(storageDataMap)){
... ...