Authored by wangnan9279

到手价bug修复

... ... @@ -74,13 +74,13 @@ public class PromotionPriceService {
}
//1、获取单个skn的促销列表
List<Map<String, String>> promotionTagList = (List<Map<String, String>>) product.get("promotion_tag");
List<JSONObject> promotionTagList = (List<JSONObject>) product.get("promotion_tag");
if (CollectionUtils.isEmpty(promotionTagList)) {
return null;
}
List<PromotionIndexBO> promotionIndexBOList = new ArrayList<>();
Map<Integer, Map<String, String>> promotionTagMap = new HashMap<>();
for (Map<String, String> promotionTag : promotionTagList) {
Map<Integer, JSONObject> promotionTagMap = new HashMap<>();
for (JSONObject promotionTag : promotionTagList) {
//如果包含了满X免1和x元x件,不赋值到手价
if ("SpecifiedAmount".equals(promotionTag.get("type")) || "Cheapestfree".equals(promotionTag.get("type"))) {
return null;
... ... @@ -128,18 +128,18 @@ public class PromotionPriceService {
if (actionParamJson == null) {
continue;
}
Map<String, String> promotionTag = promotionTagMap.get(promotionIndexBO.getId());
if ("Discount".equals(promotionTag.get("type"))) {
JSONObject promotionTag = promotionTagMap.get(promotionIndexBO.getId());
if ("Discount".equals(MapUtils.getString(promotionTag, "type"))) {
isPromotionPriceActive = true;
Double discount = Double.valueOf(actionParamJson.get("discount").toString());
currentSalesPrice = currentSalesPrice * discount;
}
if ("Cashreduce".equals(promotionTag.get("type"))) {
if ("Cashreduce".equals(MapUtils.getString(promotionTag, "type"))) {
isPromotionPriceActive = true;
Double reduce = Double.valueOf(actionParamJson.get("reduce").toString());
currentSalesPrice = currentSalesPrice - reduce;
}
if ("Degressdiscount".equals(promotionTag.get("type"))) {
if ("Degressdiscount".equals(MapUtils.getString(promotionTag, "type"))) {
isPromotionPriceActive = true;
Double discount = this.countDegreeDiscount(actionParamJson);
if (discount == null) {
... ... @@ -222,14 +222,14 @@ public class PromotionPriceService {
private Double getProductPricePlanSalesPrice(Map<String, Object> productMap) {
//取当前销售价
Double salesPrice = MapUtils.getDoubleValue(productMap, "sales_price", 0);
List<Map<String, String>> pricePlanList = (List<Map<String, String>>) productMap.get("product_price_plan_list");
List<Map<String, Object>> pricePlanList = (List<Map<String, Object>>) productMap.get("product_price_plan_list");
if (pricePlanList == null || pricePlanList.isEmpty()) {
return salesPrice;
}
//截取当前销售价格-取满足时间的第一个变价计算(取effect_time最大的一个),获取current_saleprice
List<Map<String, String>> pricePlanListSorted = pricePlanList.stream().sorted(Comparator.comparingInt(map -> MapUtils.getInteger((Map) map, "effect_time")).reversed()).collect(Collectors.toList());
List<Map<String, Object>> pricePlanListSorted = pricePlanList.stream().sorted(Comparator.comparingInt(map -> MapUtils.getInteger((Map) map, "effect_time")).reversed()).collect(Collectors.toList());
long currentTime = DateUtil.getCurrentTimeSecond();
for (Map<String, String> pricePlanMap : pricePlanListSorted) {
for (Map<String, Object> pricePlanMap : pricePlanListSorted) {
Integer effectTime = MapUtils.getInteger(pricePlanMap, "effect_time");
Integer endTime = MapUtils.getInteger(pricePlanMap, "end_time");
if (effectTime <= currentTime && (endTime >= currentTime || endTime == 0)) {
... ...