diff --git a/renren-admin/src/main/java/io/renren/modules/front/controller/AlipayController.java b/renren-admin/src/main/java/io/renren/modules/front/controller/AlipayController.java index cf75028..9bc90ee 100644 --- a/renren-admin/src/main/java/io/renren/modules/front/controller/AlipayController.java +++ b/renren-admin/src/main/java/io/renren/modules/front/controller/AlipayController.java @@ -14,6 +14,7 @@ import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; import java.math.BigDecimal; +import java.math.RoundingMode; /** * @author : 张宇轩 @@ -45,7 +46,7 @@ public class AlipayController { //商户订单号,商家自定义,保持唯一性 bizContent.put("out_trade_no", out_trade_no); //支付金额,最小值0.01元 - bizContent.put("total_amount", total_amount); + bizContent.put("total_amount", total_amount.divide(BigDecimal.valueOf(100),2, RoundingMode.HALF_UP)); //订单标题,不可使用特殊符号 bizContent.put("subject", "美食元素订单支付"); diff --git a/renren-admin/src/main/java/io/renren/modules/front/service/impl/ShoppingCartServiceImpl.java b/renren-admin/src/main/java/io/renren/modules/front/service/impl/ShoppingCartServiceImpl.java index 39ca960..6eac6b5 100644 --- a/renren-admin/src/main/java/io/renren/modules/front/service/impl/ShoppingCartServiceImpl.java +++ b/renren-admin/src/main/java/io/renren/modules/front/service/impl/ShoppingCartServiceImpl.java @@ -2,12 +2,18 @@ package io.renren.modules.front.service.impl; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import io.renren.modules.front.bean.Dish; +import io.renren.modules.front.bean.Setmeal; import io.renren.modules.front.bean.ShoppingCart; import io.renren.modules.front.dao.ShoppingCartMapper; +import io.renren.modules.front.service.DishService; +import io.renren.modules.front.service.SetmealService; import io.renren.modules.front.service.ShoppingCartService; import io.renren.modules.front.utils.BaseContext; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; +import java.math.BigDecimal; import java.time.LocalDateTime; /** @@ -18,6 +24,10 @@ import java.time.LocalDateTime; */ @Service(value = "shoppingCartServiceImplFront") public class ShoppingCartServiceImpl extends ServiceImpl implements ShoppingCartService { + @Autowired + DishService dishService; + @Autowired + SetmealService setmealService; @Override public ShoppingCart add(ShoppingCart shoppingCart) { //查询当前购物车的菜品/套餐是否在数据库存在 @@ -28,8 +38,12 @@ public class ShoppingCartServiceImpl extends ServiceImpl