...
|
...
|
@@ -7,27 +7,29 @@ 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.common.*;
|
|
|
import com.yohobuy.ufo.model.order.constants.OrderConstant;
|
|
|
import com.yohobuy.ufo.model.order.resp.OrderListInfo;
|
|
|
import com.yohobuy.ufo.model.order.resp.PageResp;
|
|
|
import com.yohobuy.ufo.model.order.vo.OrderListVo;
|
|
|
import com.yohoufo.common.helper.ImageUrlAssist;
|
|
|
import com.yohoufo.common.utils.DateUtil;
|
|
|
import com.yohoufo.dal.order.*;
|
|
|
import com.yohoufo.dal.order.model.*;
|
|
|
import com.yohoufo.dal.product.model.Storage;
|
|
|
import com.yohoufo.dal.order.BuyerOrderGoodsMapper;
|
|
|
import com.yohoufo.dal.order.BuyerOrderMapper;
|
|
|
import com.yohoufo.dal.order.SellerOrderGoodsMapper;
|
|
|
import com.yohoufo.dal.order.SellerOrderMapper;
|
|
|
import com.yohoufo.dal.order.model.BuyerOrder;
|
|
|
import com.yohoufo.dal.order.model.BuyerOrderGoods;
|
|
|
import com.yohoufo.dal.order.model.SellerOrder;
|
|
|
import com.yohoufo.dal.order.model.SellerOrderGoods;
|
|
|
import com.yohoufo.order.model.request.OrderListRequest;
|
|
|
import com.yohoufo.order.service.AbsSellerOrderViewService;
|
|
|
import com.yohoufo.order.service.IOrderListService;
|
|
|
import com.yohoufo.order.service.cache.OrderCacheService;
|
|
|
import com.yohoufo.order.service.impl.processor.SellerOrderPrepareProcessor;
|
|
|
import com.yohoufo.order.service.proxy.ProductProxyService;
|
|
|
import com.yohoufo.order.service.proxy.UserProxyService;
|
|
|
import com.yohoufo.order.service.support.codegenerator.OrderCodeGenerator;
|
|
|
import com.yohoufo.order.service.support.codegenerator.bean.CodeMeta;
|
|
|
import com.yohoufo.order.utils.LoggerUtils;
|
|
|
import com.yohoufo.order.utils.OrderAssist;
|
|
|
import com.yohoufo.product.response.StorageDataResp;
|
|
|
import com.yohoufo.product.response.StorageInfoResp;
|
|
|
import org.apache.commons.collections.CollectionUtils;
|
|
|
import org.slf4j.Logger;
|
...
|
...
|
@@ -35,8 +37,10 @@ import org.springframework.beans.factory.annotation.Autowired; |
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
import java.math.BigDecimal;
|
|
|
import java.util.*;
|
|
|
import java.util.function.Consumer;
|
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
|
import java.util.Objects;
|
|
|
import java.util.Set;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
|
...
|
...
|
@@ -69,7 +73,10 @@ public class SellerOrderListService extends AbsOrderListService implements IOrde |
|
|
private ProductProxyService productProxyService;
|
|
|
|
|
|
@Autowired
|
|
|
private SellerOrderPrepareProcessor sellerOrderPrepareProcessor;
|
|
|
private OrderCodeGenerator orderCodeGenerator;
|
|
|
|
|
|
@Autowired
|
|
|
private SkupListService skupListService;
|
|
|
|
|
|
|
|
|
public List<OrderListInfo> buildOrderList(List<SellerOrderGoods> sogList, SellerType sellerType){
|
...
|
...
|
@@ -152,8 +159,7 @@ public class SellerOrderListService extends AbsOrderListService implements IOrde |
|
|
void setAddressInfo(OrderListInfo orderListInfo) {
|
|
|
|
|
|
}
|
|
|
@Autowired
|
|
|
private OrderCodeGenerator orderCodeGenerator;
|
|
|
|
|
|
|
|
|
@Override
|
|
|
protected void resetDynamicProporties(List<OrderListInfo> list, int type) {
|
...
|
...
|
@@ -187,44 +193,16 @@ public class SellerOrderListService extends AbsOrderListService implements IOrde |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
* 需要商品提供批量接口,减少db net IO, 目前的工期太短,后期再优化
|
|
|
* @param sogList
|
|
|
* @return
|
|
|
*/
|
|
|
public Map<String,String> buildOverPriceTipsMap(List<SellerOrderGoods> sogList){
|
|
|
Map<String,String> map = new HashMap<>(sogList.size());
|
|
|
Set<Integer> storageIds = sogList.parallelStream().map(SellerOrderGoods::getStorageId)
|
|
|
.collect(Collectors.toSet());
|
|
|
Map<Integer, StorageInfoResp> getStorageDataMap = productProxyService.getStorageDataMap(storageIds);
|
|
|
final String defaultResult = "";
|
|
|
for(SellerOrderGoods sog : sogList) {
|
|
|
|
|
|
int storageId = sog.getStorageId();
|
|
|
BigDecimal prdPrice = sog.getGoodsPrice();
|
|
|
String key = OrderAssist.overFlowPriceKey(storageId, prdPrice);
|
|
|
if (map.containsKey(key)){
|
|
|
continue;
|
|
|
}
|
|
|
StorageInfoResp storage = getStorageDataMap.get(storageId);
|
|
|
Optional<StorageInfoResp> sdro = Optional.ofNullable(storage);
|
|
|
Consumer<StorageInfoResp> sdrc = (sdr)-> {
|
|
|
BigDecimal slp = sdr.getSuggestHighPrice();
|
|
|
String value;
|
|
|
try {
|
|
|
log.info("in buildOverPriceTipsMap, prdPrice {}, storageId {} StorageDataResp {}",
|
|
|
prdPrice, storageId, sdr);
|
|
|
boolean isOverflow = sellerOrderPrepareProcessor.isOverSuggestMaxPrice(slp, prdPrice);
|
|
|
value = isOverflow ? OrderConstant.Tips.SUGGEST_MAX_PRICE_OVERFLOW : defaultResult;
|
|
|
} catch (Exception ex) {
|
|
|
log.warn("in buildOverPriceTipsMap storageId {},prdPrice {}", storageId, prdPrice, ex);
|
|
|
value = defaultResult;
|
|
|
}
|
|
|
map.put(key, value);
|
|
|
};
|
|
|
sdro.ifPresent(sdrc);
|
|
|
}
|
|
|
Map<String,String> map = skupListService.buildOverPriceTipsMap(storageIds, sogList, getStorageDataMap);
|
|
|
return map;
|
|
|
}
|
|
|
|
...
|
...
|
|