From d9dfe81a9e819d9da2d41cb57d674eff894c6605 Mon Sep 17 00:00:00 2001 From: 44323 <443237572@qq.com> Date: 星期二, 05 九月 2023 11:36:21 +0800 Subject: [PATCH] 场地类型管理、场地管理、课包类型管理、教练管理、教练类型管理、福利视频分类管理、体测预约 --- cloud-server-other/src/main/java/com/dsh/other/service/impl/SiteServiceImpl.java | 35 ++++++++++++++++++++++++++--------- 1 files changed, 26 insertions(+), 9 deletions(-) diff --git a/cloud-server-other/src/main/java/com/dsh/other/service/impl/SiteServiceImpl.java b/cloud-server-other/src/main/java/com/dsh/other/service/impl/SiteServiceImpl.java index 081772c..98459ce 100644 --- a/cloud-server-other/src/main/java/com/dsh/other/service/impl/SiteServiceImpl.java +++ b/cloud-server-other/src/main/java/com/dsh/other/service/impl/SiteServiceImpl.java @@ -13,10 +13,13 @@ import com.dsh.other.feignclient.activity.model.Coupon; import com.dsh.other.feignclient.activity.model.QueryUserCouponByIdAndUserId; import com.dsh.other.feignclient.activity.model.UserCoupon; +import com.dsh.other.feignclient.model.SiteChangeStateVO; import com.dsh.other.mapper.SiteMapper; import com.dsh.other.model.*; import com.dsh.other.service.*; import com.dsh.other.util.*; +import io.swagger.models.auth.In; +import org.aspectj.weaver.ast.Var; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -56,6 +59,8 @@ @Autowired private PayMoneyUtil payMoneyUtil; + @Autowired + private SiteMapper siteMapper; @@ -221,9 +226,10 @@ return ResultUtil.error("优惠券已过期"); } if(coupon.getType() == 1){//满减 +// {"conditionalAmount":50,"deductionAmount":10,"experienceName":""} JSONObject jsonObject = JSON.parseObject(coupon.getContent()); - Double num1 = jsonObject.getDouble("num1"); - Double num2 = jsonObject.getDouble("num2"); + Double num1 = jsonObject.getDouble("conditionalAmount"); + Double num2 = jsonObject.getDouble("deductionAmount"); if(payMoney.compareTo(num1) <= 0){ return ResultUtil.error("该优惠券无法使用"); } @@ -232,7 +238,7 @@ } if(coupon.getType() == 2){//代金券 JSONObject jsonObject = JSON.parseObject(coupon.getContent()); - Double num1 = jsonObject.getDouble("num1"); + Double num1 = jsonObject.getDouble("conditionalAmount"); if(payMoney.compareTo(num1) <= 0){ return ResultUtil.error("该优惠券无法使用"); } @@ -545,14 +551,15 @@ UserCoupon userCoupon = userCouponClient.queryUserCouponById(new QueryUserCouponByIdAndUserId(siteBooking.getUserCouponId(),appUser.getId())); Coupon coupon = couponClient.queryCouponById(userCoupon.getCouponId()); if(coupon.getType() == 1){//满减 +// {"conditionalAmount":50,"deductionAmount":10,"experienceName":""} JSONObject jsonObject = JSON.parseObject(coupon.getContent()); - Double num1 = jsonObject.getDouble("num1"); - Double num2 = jsonObject.getDouble("num2"); + Double num1 = jsonObject.getDouble("conditionalAmount"); + Double num2 = jsonObject.getDouble("deductionAmount"); payMoney = new BigDecimal(payMoney).subtract(new BigDecimal(num2)).setScale(2, RoundingMode.HALF_EVEN).doubleValue(); } if(coupon.getType() == 2){//代金券 JSONObject jsonObject = JSON.parseObject(coupon.getContent()); - Double num1 = jsonObject.getDouble("num1"); + Double num1 = jsonObject.getDouble("conditionalAmount"); payMoney = new BigDecimal(payMoney).subtract(new BigDecimal(num1)).setScale(2, RoundingMode.HALF_EVEN).doubleValue(); } userCoupon.setStatus(2); @@ -610,18 +617,28 @@ UserCoupon userCoupon = userCouponClient.queryUserCouponById(new QueryUserCouponByIdAndUserId(siteBooking.getUserCouponId(),siteBooking.getAppUserId())); Coupon coupon = couponClient.queryCouponById(userCoupon.getCouponId()); if(coupon.getType() == 1){//满减 +// {"conditionalAmount":50,"deductionAmount":10,"experienceName":""} JSONObject jsonObject = JSON.parseObject(coupon.getContent()); - Double num1 = jsonObject.getDouble("num1"); - Double num2 = jsonObject.getDouble("num2"); + Double num1 = jsonObject.getDouble("conditionalAmount"); + Double num2 = jsonObject.getDouble("deductionAmount"); payMoney = new BigDecimal(payMoney).subtract(new BigDecimal(num2)).setScale(2, RoundingMode.HALF_EVEN).doubleValue(); } if(coupon.getType() == 2){//代金券 JSONObject jsonObject = JSON.parseObject(coupon.getContent()); - Double num1 = jsonObject.getDouble("num1"); + Double num1 = jsonObject.getDouble("conditionalAmount"); payMoney = new BigDecimal(payMoney).subtract(new BigDecimal(num1)).setScale(2, RoundingMode.HALF_EVEN).doubleValue(); } } map.put("cash", payMoney); return ResultUtil.success(map); } + + @Override + public Object changeState(SiteChangeStateVO vo) { + + List<Integer> siteIds = vo.getSiteIds(); + Integer type = vo.getType(); + return siteMapper.changeState(siteIds,type); + + } } -- Gitblit v1.7.1