From 4ddc5fd15120f714780f63a3e178d2e4cce5b9ac Mon Sep 17 00:00:00 2001 From: lidongdong <1459917685@qq.com> Date: 星期二, 29 八月 2023 13:45:55 +0800 Subject: [PATCH] 新增商家商品模块 --- springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/VolunteerCreditsExchangeServiceImpl.java | 15 +++++++++++++-- 1 files changed, 13 insertions(+), 2 deletions(-) diff --git a/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/VolunteerCreditsExchangeServiceImpl.java b/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/VolunteerCreditsExchangeServiceImpl.java index 3f39c90..d1e3047 100644 --- a/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/VolunteerCreditsExchangeServiceImpl.java +++ b/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/VolunteerCreditsExchangeServiceImpl.java @@ -2,9 +2,11 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.panzhihua.common.model.vos.LoginUserInfoVO; import com.panzhihua.common.model.vos.R; import com.panzhihua.common.model.vos.community.VolunteerCreditsExchangeVO; import com.panzhihua.common.model.vos.community.VolunteerTypeVO; +import com.panzhihua.common.service.user.UserService; import com.panzhihua.common.utlis.Snowflake; import com.panzhihua.common.utlis.StringUtils; import com.panzhihua.service_community.dao.VolunteerCreditsExchangeDao; @@ -30,6 +32,8 @@ @Resource private VolunteerIntegralMerchantService goodsService; + @Resource + private UserService userService; @Override public R getList(int pageNum, int pageSize, String goodsId, String orderNumber, @@ -63,10 +67,12 @@ return R.fail("商品不存在"); } + LoginUserInfoVO loginUserInfoVOR=userService.getUserInfoByUserId(item.getUserId()).getData(); + int integral=0; - if(!StringUtils.isEmpty(item.getNeedScore())) + if(!StringUtils.isEmpty(loginUserInfoVOR.getLoveIntegral())) { - integral=Integer.valueOf(item.getNeedScore()); + integral=Integer.valueOf(loginUserInfoVOR.getLoveIntegral()); } if(integral<Integer.valueOf(goods.getIntegral())) @@ -80,6 +86,10 @@ { return R.fail("兑换用户id不能为空"); } + + int num1=integral-Integer.valueOf(goods.getIntegral()); + loginUserInfoVOR.setLoveIntegral(num1+""); + userService.putUser(loginUserInfoVOR); //设置订单号 item.setOrderNumber(Snowflake.getId()+""); @@ -128,6 +138,7 @@ return R.fail("删除订单id不能为空"); } + int num= baseMapper.delete(id); if(num>0) { -- Gitblit v1.7.1