lidongdong
2023-11-20 0200018ffe22d1a28169142479edd094ff79c947
添加购物消费积分
1个文件已修改
53 ■■■■ 已修改文件
springcloud_k8s_panzhihuazhihuishequ/service_partybuilding/src/main/java/com/panzhihua/service_dangjian/service/impl/NewFightShoppingOrderServiceImpl.java 53 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/service_partybuilding/src/main/java/com/panzhihua/service_dangjian/service/impl/NewFightShoppingOrderServiceImpl.java
@@ -3,6 +3,7 @@
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.panzhihua.common.model.dtos.partybuilding.NewFightIntegral;
import com.panzhihua.common.model.vos.R;
import com.panzhihua.common.model.vos.community.building.NewFightShoppingOrderVO;
import com.panzhihua.common.utlis.Snowflake;
@@ -29,7 +30,8 @@
    @Resource
    private NewFightShoppingService shoppingService;
    @Resource
    private ComActIntegralUsersService integralUsersService;
    @Override
    public R getList(int pageNum,int pageSize,String userId,String goodsId,String orderNumber,
@@ -54,18 +56,23 @@
        int allMoney=0;
        int getMoney=Integer.valueOf(goods.getGoodPrice());
//        if(generalTable==null)
//        {
//            return R.fail("积分不足!");
//        }
//
//        if(!StringUtils.isEmpty(generalTable.getGoldCoin()))
//        {
//            allMoney=Integer.valueOf(generalTable.getGoldCoin());
//        }
        // 查询用户积分账户
        ComActIntegralUser integralUserDO =
                integralUsersService.getOne(new QueryWrapper<ComActIntegralUser>().lambda()
                        .eq(ComActIntegralUser::getUserId, item.getUserId())
                        .eq(ComActIntegralUser::getCommunityId, item.getCommunityId()));
        if(integralUserDO==null)
        {
            return R.fail("积分不足!");
        }
        allMoney=integralUserDO.getIntegralAvailableSum();
        if(getMoney>allMoney)
        {
            return R.fail("金汇币不足!");
            return R.fail("积分不足!");
        }
        item.setCancelType("0");
@@ -74,19 +81,17 @@
        if(num>0)
        {
            //修改个人积分总额
//            allMoney=allMoney-getMoney;
//            JinhuiCoinGeneralTableVO generalTableVO=new JinhuiCoinGeneralTableVO();
//            generalTableVO.setId(generalTable.getId());
//            generalTableVO.setGoldCoin(allMoney+"");
//            tableService.editData(generalTableVO);
//
//            //增加兑换记录
//            JinhuiGoldCoinRecordVO recordVO=new JinhuiGoldCoinRecordVO();
//            recordVO.setTitle("兑换商品");
//            recordVO.setType("2");
//            recordVO.setUserId(item.getUserId());
//            recordVO.setGoldCoin(getMoney+"");
//            goldCoinRecordService.addData(recordVO);
            allMoney=allMoney-getMoney;
            NewFightIntegral integral=new NewFightIntegral();
            integral.setIntegralNum(allMoney+"");
            integral.setAddOrReduce(2);
            integral.setCommunityId(item.getCommunityId());
            integral.setUserId(item.getUserId());
            integral.setType("9");
            integral.setIdentityType("1");
            integral.setRemark("积分兑换商品");
            integralUsersService.upIntegral(integral);
            return R.ok();
        }