Authored by wangnan

到手价 fix

... ... @@ -117,7 +117,7 @@ public class PromotionPriceService {
}
if ("Discount".equals(promotionTag.get("type"))) {
Double discount = Double.valueOf(actionParamJson.get("discount").toString());
if (discount == null||currentSalesPrice==null) {
if (discount == null || currentSalesPrice == null) {
continue;
}
currentSalesPrice = currentSalesPrice * discount;
... ... @@ -125,14 +125,14 @@ public class PromotionPriceService {
}
if ("Cashreduce".equals(promotionTag.get("type"))) {
Double reduce = Double.valueOf(actionParamJson.get("reduce").toString());
if (reduce == null||currentSalesPrice==null) {
if (reduce == null || currentSalesPrice == null) {
continue;
}
currentSalesPrice = currentSalesPrice - reduce;
isPromotionPriceActive = true;
}
if ("Degressdiscount".equals(promotionTag.get("type"))) {
if (actionParamJson.get("degress_discount_list") == null||currentSalesPrice==null) {
if (actionParamJson.get("degress_discount_list") == null || currentSalesPrice == null) {
continue;
}
String degressDiscountList = actionParamJson.get("degress_discount_list").toString();
... ... @@ -192,13 +192,19 @@ public class PromotionPriceService {
private Double getProductPricePlanSalesPrice(Map<String, Object> productMap) {
Double salesPrice = Double.valueOf(productMap.get("sales_price").toString());
List<Map<String, String>> pricePlanList = (List<Map<String, String>>) productMap.get("product_price_plan_list");
if (CollectionUtils.isNotEmpty(pricePlanList)) {
List<Map<String, String>> pricePlanListSorted;
pricePlanListSorted = pricePlanList.stream().sorted(Comparator.comparingInt(map -> MapUtils.getInteger((Map) map, "effect_time")).reversed()).collect(Collectors.toList());
if (CollectionUtils.isNotEmpty(pricePlanListSorted)) {
long currentTime = DateUtil.getCurrentTimeSecond();
for (Map<String, String> pricePlanMap : pricePlanList) {
for (Map<String, String> pricePlanMap : pricePlanListSorted) {
Integer effectTime = MapUtils.getInteger(pricePlanMap, "effect_time");
Integer endTime = MapUtils.getInteger(pricePlanMap, "end_time");
if (effectTime <= currentTime && endTime >= currentTime) {
salesPrice = MapUtils.getDouble(pricePlanMap, "current_saleprice") == null ? salesPrice : MapUtils.getDouble(pricePlanMap, "current_saleprice");
if (effectTime <= currentTime && (endTime >= currentTime || endTime == 0)) {
if (MapUtils.getDouble(pricePlanMap, "current_saleprice") == null) {
continue;
}
salesPrice = MapUtils.getDouble(pricePlanMap, "current_saleprice");
return salesPrice;
}
}
}
... ...