提交 d5ad1527 authored 作者: 吴德鹏's avatar 吴德鹏

update

上级 bb9dd46e
......@@ -166,6 +166,8 @@ public class TbCfOrder {
@Transient
private Map<String, Object> couponMap;
public Map<String, Object> getCouponMap() {
return couponMap;
}
......@@ -273,7 +275,11 @@ public class TbCfOrder {
// }
Optional<TbCfStationItem> optionalTbCfStationItem = itemRepository.findById(item.getItemId());
boolean categoriesAct = activityRepository.existsByUseType(2);
boolean specialAct = activityRepository.existsByUseType(3);
if (categoriesAct || specialAct) {
}
if (optionalTbCfStationItem.isPresent()) {
TbCfStationItem stationItem = optionalTbCfStationItem.get();
if (stationItem.getExpress() != null) {
......@@ -290,7 +296,7 @@ public class TbCfOrder {
});
Map<String, List<TemplateVo>> map = templateList.stream().collect(Collectors.groupingBy(TemplateVo::getTemplateId));
//按模板分组计算商品价格
Integer itemSum=0;
Integer itemSum = 0;
List<TemplateVo> list = new ArrayList<>();
for (String key : map.keySet()) {
TemplateVo templateVo = new TemplateVo();
......@@ -300,7 +306,7 @@ public class TbCfOrder {
for (TemplateVo template : map.get(key)) {
totalPrice = totalPrice.add(template.getItemPrice());
count += template.getItemCount();
itemSum+=template.getItemCount();
itemSum += template.getItemCount();
_template = template.getTemplate();
}
templateVo.setTemplateId(key);
......@@ -335,21 +341,21 @@ public class TbCfOrder {
*/
boolean fullAct = activityRepository.existsByUseType(1);
if (fullAct) {
Optional<Activity> allAct = activityRepository.findFirstByUseTypeOrderByCreateTimeDesc(1);
Optional<Activity> allAct = activityRepository.findFirstByUseType(1);
if (allAct.isPresent()) {
Activity activity = allAct.get();
String type = String.valueOf(activity.getType());
if ("1".equals(type)) {
reduceAmount= caculateActFee(false, false, activity, itemsPrice, null);
System.out.println("减免金额:"+reduceAmount);
reduceAmount = caculateActFee(false, false, activity, itemsPrice, null);
System.out.println("减免金额:" + reduceAmount);
} else if ("2".equals(type)) {
BigDecimal rate = caculateActFee(false, true, activity, itemsPrice, null);
System.out.println("折扣比例:"+rate);
System.out.println("折扣比例:" + rate);
itemsPrice = rate.multiply(itemsPrice);
} else if ("3".equals(type)) {
BigDecimal rate = caculateActFee(true, true, activity, itemsPrice, itemSum);
System.out.println("购买件数:"+itemSum);
System.out.println("折扣比例:"+rate);
System.out.println("购买件数:" + itemSum);
System.out.println("折扣比例:" + rate);
itemsPrice = rate.multiply(itemsPrice);
}
}
......@@ -386,7 +392,6 @@ public class TbCfOrder {
}
@Transient
private TbCfCoupon coupon;
......
......@@ -22,5 +22,6 @@ public interface ActivityRepository extends JpaRepository<Activity,String> {
boolean existsByUseType(Integer useType);
Optional<Activity> findFirstByUseTypeOrderByCreateTimeDesc(Integer useType);
@Query(value = "select * from Activity a where CURRENT_TIMESTAMP between a.start_time and a.end_time and a.status=1 order by a.create_time desc limit 1",nativeQuery = true)
Optional<Activity> findFirstByUseType(Integer useType);
}
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论