lidongdong
2023-11-18 139d5946b674129881526f6786c27bcad0c0d3cb
springcloud_k8s_panzhihuazhihuishequ/service_partybuilding/src/main/java/com/panzhihua/service_dangjian/service/impl/NewFightShoppingOrderServiceImpl.java
@@ -1,15 +1,17 @@
package com.panzhihua.service_dangjian.service.impl;
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.vos.R;
import com.panzhihua.common.model.vos.community.building.NewFightShoppingOrderVO;
import com.panzhihua.common.utlis.Snowflake;
import com.panzhihua.service_dangjian.dao.ComActIntegralUsersMapper;
import com.panzhihua.service_dangjian.dao.NewFightShoppingOrderDao;
import com.panzhihua.service_dangjian.entity.ComActIntegralUser;
import com.panzhihua.service_dangjian.entity.NewFightShopping;
import com.panzhihua.service_dangjian.entity.NewFightShoppingOrder;
import com.panzhihua.service_dangjian.service.NewFightShoppingOrderService;
import com.panzhihua.service_dangjian.service.NewFightShoppingService;
import com.panzhihua.service_dangjian.service.*;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
@@ -26,6 +28,7 @@
    @Resource
    private NewFightShoppingService shoppingService;
    @Override
@@ -46,33 +49,31 @@
    public R addData(NewFightShoppingOrderVO item)
    {
        item.setOrderNumber(Snowflake.getId()+"");
//        JinhuiCoinGeneralTable generalTable=tableService.getDetails(item.getUserId());
//        NewFightShopping goods=shoppingService.getDetails(item.getGoodsId());
//
//        int allMoney=0;
//        int getMoney=Integer.valueOf(goods.getGoodPrice());
//
//
        NewFightShopping goods=shoppingService.getDetails(item.getGoodsId());
        int allMoney=0;
        int getMoney=Integer.valueOf(goods.getGoodPrice());
//        if(generalTable==null)
//        {
//            return R.fail("金汇币不足!");
//            return R.fail("积分不足!");
//        }
//
//        if(!StringUtils.isEmpty(generalTable.getGoldCoin()))
//        {
//            allMoney=Integer.valueOf(generalTable.getGoldCoin());
//        }
//        if(getMoney>allMoney)
//        {
//            return R.fail("金汇币不足!");
//        }
        if(getMoney>allMoney)
        {
            return R.fail("金汇币不足!");
        }
        item.setCancelType("0");
//        item.setPalyMoney(goods.getGoodPrice());
        item.setPalyMoney(goods.getGoodPrice());
        int num= baseMapper.addData(item);
        if(num>0)
        {
            //修改个人金汇币总额
            //修改个人积分总额
//            allMoney=allMoney-getMoney;
//            JinhuiCoinGeneralTableVO generalTableVO=new JinhuiCoinGeneralTableVO();
//            generalTableVO.setId(generalTable.getId());