|
@@ -75,7 +75,7 @@ public class PromotionFactoryBase extends ServiceImpl<PromotionMapper, Promotion
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public List<JMap<String, Object>> goodsListPrice(JMap<String, Object> param) {
|
|
|
+ public JMap<String, Object> goodsListPrice(JMap<String, Object> param) {
|
|
|
List<JMap<String, Object>> goodsList = param.getListMap("goodsList");
|
|
|
String deviceId = param.getString("deviceId");
|
|
|
Integer mercId = param.getInt("mercId");
|
|
@@ -90,7 +90,9 @@ public class PromotionFactoryBase extends ServiceImpl<PromotionMapper, Promotion
|
|
|
goods.set("havePromotion", false);
|
|
|
goods.set("promotionList", new ArrayList<Promotion>());
|
|
|
goods.set("priceOnsale", goods.get("price"));
|
|
|
+ goods.set("msg", "");
|
|
|
}
|
|
|
+ param.set("goodsList", goodsList);
|
|
|
//查询可使用方案列表
|
|
|
LambdaQueryWrapper<Promotion> lqw = new LambdaQueryWrapper<Promotion>()
|
|
|
.eq(Promotion::getMercId, mercId)
|
|
@@ -101,7 +103,7 @@ public class PromotionFactoryBase extends ServiceImpl<PromotionMapper, Promotion
|
|
|
.orderByDesc(Promotion::getWeight);
|
|
|
List<Promotion> promotionList = list(lqw);
|
|
|
if (!Emptys.check(promotionList)) {
|
|
|
- return null;
|
|
|
+ return param;
|
|
|
}
|
|
|
//判断设备是否符合
|
|
|
for (int i = 0; i < promotionList.size(); i++) {
|
|
@@ -119,7 +121,7 @@ public class PromotionFactoryBase extends ServiceImpl<PromotionMapper, Promotion
|
|
|
}
|
|
|
//重新判断活动是否为空
|
|
|
if (!Emptys.check(promotionList)) {
|
|
|
- return null;
|
|
|
+ return param;
|
|
|
}
|
|
|
//查询活动商品表
|
|
|
List<Integer> promotionIdList = promotionList.stream().map(Promotion::getId).collect(Collectors.toList());
|
|
@@ -154,6 +156,8 @@ public class PromotionFactoryBase extends ServiceImpl<PromotionMapper, Promotion
|
|
|
goods.set("promotionType3", true);
|
|
|
//优惠价格
|
|
|
goods.set("priceOnsale", promotionGoods.get("priceOnsale"));
|
|
|
+ goods.set("promotion", promotion);
|
|
|
+ goods.set("msg", goods.getString("msg") + "特价");
|
|
|
//优惠活动
|
|
|
List<Object> promotionList1 = goods.getList("promotionList");
|
|
|
promotionList1.add(promotion);
|
|
@@ -193,9 +197,9 @@ public class PromotionFactoryBase extends ServiceImpl<PromotionMapper, Promotion
|
|
|
//设置优惠信息
|
|
|
BigDecimal scalar = new BigDecimal(priceJson.getStr("scalar"));
|
|
|
//优惠价格
|
|
|
- //TODO 处理计算精度问题
|
|
|
- goods.set("priceOnsale", goods.getInt("price") * scalar.doubleValue());
|
|
|
+ goods.set("priceOnsale", scalar.multiply(new BigDecimal(goods.getInt("price"))).intValue());
|
|
|
goods.set("promotionType2", true);
|
|
|
+ goods.set("msg", priceJson.getStr("scalar").replace("0.", "") + "折;");
|
|
|
}
|
|
|
if (Objects.equals(promotion.getType(), PromotionTypeEnum.T_1.getCode())) {
|
|
|
goods.set("promotionType3", true);
|
|
@@ -209,6 +213,8 @@ public class PromotionFactoryBase extends ServiceImpl<PromotionMapper, Promotion
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- return goodsList;
|
|
|
+ param.getListMap("goodsList");
|
|
|
+ param.put("goodsList", goodsList);
|
|
|
+ return param;
|
|
|
}
|
|
|
}
|