From c407d63f2f2bbbbde95ee092a1bf315da2edf566 Mon Sep 17 00:00:00 2001 From: mlf9527 <2192316287@qq.com> Date: Wed, 14 Jun 2023 21:42:07 +0800 Subject: [PATCH] =?UTF-8?q?6/14=20=E8=A7=A3=E5=86=B3=E4=BA=86=E7=B2=BE?= =?UTF-8?q?=E5=BA=A6=E9=97=AE=E9=A2=98=E5=92=8C=E8=B4=AD=E7=89=A9=E8=BD=A6?= =?UTF-8?q?=E9=87=91=E9=A2=9D=E6=95=B0=E6=8D=AE=E5=8F=AF=E8=83=BD=E8=A2=AB?= =?UTF-8?q?=E5=89=8D=E7=AB=AF=E7=AF=A1=E6=94=B9=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../front/controller/AlipayController.java | 3 ++- .../service/impl/ShoppingCartServiceImpl.java | 15 +++++++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) 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