Showing
1 changed file
with
10 additions
and
10 deletions
@@ -74,13 +74,13 @@ public class PromotionPriceService { | @@ -74,13 +74,13 @@ public class PromotionPriceService { | ||
74 | } | 74 | } |
75 | 75 | ||
76 | //1、获取单个skn的促销列表 | 76 | //1、获取单个skn的促销列表 |
77 | - List<Map<String, String>> promotionTagList = (List<Map<String, String>>) product.get("promotion_tag"); | 77 | + List<JSONObject> promotionTagList = (List<JSONObject>) product.get("promotion_tag"); |
78 | if (CollectionUtils.isEmpty(promotionTagList)) { | 78 | if (CollectionUtils.isEmpty(promotionTagList)) { |
79 | return null; | 79 | return null; |
80 | } | 80 | } |
81 | List<PromotionIndexBO> promotionIndexBOList = new ArrayList<>(); | 81 | List<PromotionIndexBO> promotionIndexBOList = new ArrayList<>(); |
82 | - Map<Integer, Map<String, String>> promotionTagMap = new HashMap<>(); | ||
83 | - for (Map<String, String> promotionTag : promotionTagList) { | 82 | + Map<Integer, JSONObject> promotionTagMap = new HashMap<>(); |
83 | + for (JSONObject promotionTag : promotionTagList) { | ||
84 | //如果包含了满X免1和x元x件,不赋值到手价 | 84 | //如果包含了满X免1和x元x件,不赋值到手价 |
85 | if ("SpecifiedAmount".equals(promotionTag.get("type")) || "Cheapestfree".equals(promotionTag.get("type"))) { | 85 | if ("SpecifiedAmount".equals(promotionTag.get("type")) || "Cheapestfree".equals(promotionTag.get("type"))) { |
86 | return null; | 86 | return null; |
@@ -128,18 +128,18 @@ public class PromotionPriceService { | @@ -128,18 +128,18 @@ public class PromotionPriceService { | ||
128 | if (actionParamJson == null) { | 128 | if (actionParamJson == null) { |
129 | continue; | 129 | continue; |
130 | } | 130 | } |
131 | - Map<String, String> promotionTag = promotionTagMap.get(promotionIndexBO.getId()); | ||
132 | - if ("Discount".equals(promotionTag.get("type"))) { | 131 | + JSONObject promotionTag = promotionTagMap.get(promotionIndexBO.getId()); |
132 | + if ("Discount".equals(MapUtils.getString(promotionTag, "type"))) { | ||
133 | isPromotionPriceActive = true; | 133 | isPromotionPriceActive = true; |
134 | Double discount = Double.valueOf(actionParamJson.get("discount").toString()); | 134 | Double discount = Double.valueOf(actionParamJson.get("discount").toString()); |
135 | currentSalesPrice = currentSalesPrice * discount; | 135 | currentSalesPrice = currentSalesPrice * discount; |
136 | } | 136 | } |
137 | - if ("Cashreduce".equals(promotionTag.get("type"))) { | 137 | + if ("Cashreduce".equals(MapUtils.getString(promotionTag, "type"))) { |
138 | isPromotionPriceActive = true; | 138 | isPromotionPriceActive = true; |
139 | Double reduce = Double.valueOf(actionParamJson.get("reduce").toString()); | 139 | Double reduce = Double.valueOf(actionParamJson.get("reduce").toString()); |
140 | currentSalesPrice = currentSalesPrice - reduce; | 140 | currentSalesPrice = currentSalesPrice - reduce; |
141 | } | 141 | } |
142 | - if ("Degressdiscount".equals(promotionTag.get("type"))) { | 142 | + if ("Degressdiscount".equals(MapUtils.getString(promotionTag, "type"))) { |
143 | isPromotionPriceActive = true; | 143 | isPromotionPriceActive = true; |
144 | Double discount = this.countDegreeDiscount(actionParamJson); | 144 | Double discount = this.countDegreeDiscount(actionParamJson); |
145 | if (discount == null) { | 145 | if (discount == null) { |
@@ -222,14 +222,14 @@ public class PromotionPriceService { | @@ -222,14 +222,14 @@ public class PromotionPriceService { | ||
222 | private Double getProductPricePlanSalesPrice(Map<String, Object> productMap) { | 222 | private Double getProductPricePlanSalesPrice(Map<String, Object> productMap) { |
223 | //取当前销售价 | 223 | //取当前销售价 |
224 | Double salesPrice = MapUtils.getDoubleValue(productMap, "sales_price", 0); | 224 | Double salesPrice = MapUtils.getDoubleValue(productMap, "sales_price", 0); |
225 | - List<Map<String, String>> pricePlanList = (List<Map<String, String>>) productMap.get("product_price_plan_list"); | 225 | + List<Map<String, Object>> pricePlanList = (List<Map<String, Object>>) productMap.get("product_price_plan_list"); |
226 | if (pricePlanList == null || pricePlanList.isEmpty()) { | 226 | if (pricePlanList == null || pricePlanList.isEmpty()) { |
227 | return salesPrice; | 227 | return salesPrice; |
228 | } | 228 | } |
229 | //截取当前销售价格-取满足时间的第一个变价计算(取effect_time最大的一个),获取current_saleprice | 229 | //截取当前销售价格-取满足时间的第一个变价计算(取effect_time最大的一个),获取current_saleprice |
230 | - List<Map<String, String>> pricePlanListSorted = pricePlanList.stream().sorted(Comparator.comparingInt(map -> MapUtils.getInteger((Map) map, "effect_time")).reversed()).collect(Collectors.toList()); | 230 | + List<Map<String, Object>> pricePlanListSorted = pricePlanList.stream().sorted(Comparator.comparingInt(map -> MapUtils.getInteger((Map) map, "effect_time")).reversed()).collect(Collectors.toList()); |
231 | long currentTime = DateUtil.getCurrentTimeSecond(); | 231 | long currentTime = DateUtil.getCurrentTimeSecond(); |
232 | - for (Map<String, String> pricePlanMap : pricePlanListSorted) { | 232 | + for (Map<String, Object> pricePlanMap : pricePlanListSorted) { |
233 | Integer effectTime = MapUtils.getInteger(pricePlanMap, "effect_time"); | 233 | Integer effectTime = MapUtils.getInteger(pricePlanMap, "effect_time"); |
234 | Integer endTime = MapUtils.getInteger(pricePlanMap, "end_time"); | 234 | Integer endTime = MapUtils.getInteger(pricePlanMap, "end_time"); |
235 | if (effectTime <= currentTime && (endTime >= currentTime || endTime == 0)) { | 235 | if (effectTime <= currentTime && (endTime >= currentTime || endTime == 0)) { |
-
Please register or login to post a comment