Showing
1 changed file
with
15 additions
and
8 deletions
@@ -101,7 +101,7 @@ public class SellerOrderListService extends AbsOrderListService implements IOrde | @@ -101,7 +101,7 @@ public class SellerOrderListService extends AbsOrderListService implements IOrde | ||
101 | sogList.stream().forEach(item -> { | 101 | sogList.stream().forEach(item -> { |
102 | item.setImageUrl(ImageUrlAssist.getAllProductPicUrl(item.getImageUrl(), "goodsimg", "center", "d2hpdGU=")); | 102 | item.setImageUrl(ImageUrlAssist.getAllProductPicUrl(item.getImageUrl(), "goodsimg", "center", "d2hpdGU=")); |
103 | }); | 103 | }); |
104 | - Map<Integer,String> overPriceTipsMap = buildOverPriceTipsMap(sogList); | 104 | + Map<String, String> overPriceTipsMap = buildOverPriceTipsMap(sogList); |
105 | Map<Integer, SellerOrderGoods> skupSellerOrderGoodsMap = sogList.parallelStream() | 105 | Map<Integer, SellerOrderGoods> skupSellerOrderGoodsMap = sogList.parallelStream() |
106 | .collect(Collectors.toMap(SellerOrderGoods::getId, (SellerOrderGoods sog) -> sog)); | 106 | .collect(Collectors.toMap(SellerOrderGoods::getId, (SellerOrderGoods sog) -> sog)); |
107 | List<Integer> skupList = sogList.parallelStream().map(SellerOrderGoods::getId).collect(Collectors.toList()); | 107 | List<Integer> skupList = sogList.parallelStream().map(SellerOrderGoods::getId).collect(Collectors.toList()); |
@@ -160,19 +160,25 @@ public class SellerOrderListService extends AbsOrderListService implements IOrde | @@ -160,19 +160,25 @@ public class SellerOrderListService extends AbsOrderListService implements IOrde | ||
160 | @Autowired | 160 | @Autowired |
161 | private SellerOrderPrepareProcessor sellerOrderPrepareProcessor; | 161 | private SellerOrderPrepareProcessor sellerOrderPrepareProcessor; |
162 | 162 | ||
163 | + | ||
164 | + private String overFlowPriceKey(Integer storageId, BigDecimal salePrice){ | ||
165 | + return new StringBuilder(storageId).append(salePrice).toString(); | ||
166 | + } | ||
163 | /** | 167 | /** |
164 | * todo 需要商品提供批量接口,减少db net IO, 目前的工期太短,后期再优化 | 168 | * todo 需要商品提供批量接口,减少db net IO, 目前的工期太短,后期再优化 |
165 | * @param sogList | 169 | * @param sogList |
166 | * @return | 170 | * @return |
167 | */ | 171 | */ |
168 | - private Map<Integer,String> buildOverPriceTipsMap(List<SellerOrderGoods> sogList){ | ||
169 | - Map<Integer,String> map = new HashMap<>(sogList.size()); | 172 | + private Map<String,String> buildOverPriceTipsMap(List<SellerOrderGoods> sogList){ |
173 | + Map<String,String> map = new HashMap<>(sogList.size()); | ||
170 | for(SellerOrderGoods sog : sogList) { | 174 | for(SellerOrderGoods sog : sogList) { |
175 | + | ||
171 | int storageId = sog.getStorageId(); | 176 | int storageId = sog.getStorageId(); |
172 | - if (map.containsKey(storageId)){ | 177 | + BigDecimal prdPrice = sog.getGoodsPrice(); |
178 | + String key = overFlowPriceKey(storageId, prdPrice); | ||
179 | + if (map.containsKey(key)){ | ||
173 | continue; | 180 | continue; |
174 | } | 181 | } |
175 | - BigDecimal prdPrice = sog.getGoodsPrice(); | ||
176 | final String defaultResult = ""; | 182 | final String defaultResult = ""; |
177 | String value; | 183 | String value; |
178 | try { | 184 | try { |
@@ -184,7 +190,8 @@ public class SellerOrderListService extends AbsOrderListService implements IOrde | @@ -184,7 +190,8 @@ public class SellerOrderListService extends AbsOrderListService implements IOrde | ||
184 | log.warn("in buildOverPriceTipsMap storageId {},prdPrice {}", storageId, prdPrice, ex); | 190 | log.warn("in buildOverPriceTipsMap storageId {},prdPrice {}", storageId, prdPrice, ex); |
185 | value = defaultResult; | 191 | value = defaultResult; |
186 | } | 192 | } |
187 | - map.put(storageId, value); | 193 | + |
194 | + map.put(key, value); | ||
188 | } | 195 | } |
189 | return map; | 196 | return map; |
190 | } | 197 | } |
@@ -194,7 +201,7 @@ public class SellerOrderListService extends AbsOrderListService implements IOrde | @@ -194,7 +201,7 @@ public class SellerOrderListService extends AbsOrderListService implements IOrde | ||
194 | 201 | ||
195 | 202 | ||
196 | OrderListInfo buildOrderListInfo(SellerOrderGoods sellerOrderGoods, | 203 | OrderListInfo buildOrderListInfo(SellerOrderGoods sellerOrderGoods, |
197 | - SellerOrder sellerOrder, SellerType st, Map<Integer,String> overPriceTipsMap) { | 204 | + SellerOrder sellerOrder, SellerType st, Map<String,String> overPriceTipsMap) { |
198 | 205 | ||
199 | OrderListInfo orderListInfo = new OrderListInfo(); | 206 | OrderListInfo orderListInfo = new OrderListInfo(); |
200 | Long orderCode; | 207 | Long orderCode; |
@@ -244,7 +251,7 @@ public class SellerOrderListService extends AbsOrderListService implements IOrde | @@ -244,7 +251,7 @@ public class SellerOrderListService extends AbsOrderListService implements IOrde | ||
244 | orderListInfo.setSecendLevelCreateTime(sellerOrder.getCreateTime()); | 251 | orderListInfo.setSecendLevelCreateTime(sellerOrder.getCreateTime()); |
245 | orderListInfo.setCreateTime(DateUtil.formatDate(sellerOrder.getCreateTime(), DateUtil.yyyy_MM_dd_HH_mm_SS)); | 252 | orderListInfo.setCreateTime(DateUtil.formatDate(sellerOrder.getCreateTime(), DateUtil.yyyy_MM_dd_HH_mm_SS)); |
246 | if (SHOW_OVER_FLOW_PRICE_STATUS.contains(skupStatus.getCode())){ | 253 | if (SHOW_OVER_FLOW_PRICE_STATUS.contains(skupStatus.getCode())){ |
247 | - orderListInfo.setTips(overPriceTipsMap.get(sellerOrderGoods.getStorageId())); | 254 | + orderListInfo.setTips(overPriceTipsMap.get(overFlowPriceKey(sellerOrderGoods.getStorageId(), sellerOrderGoods.getGoodsPrice()))); |
248 | } | 255 | } |
249 | return orderListInfo; | 256 | return orderListInfo; |
250 | } | 257 | } |
-
Please register or login to post a comment