| | |
| | | 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; |
| | |
| | | @Resource |
| | | private NewFightShoppingService shoppingService; |
| | | |
| | | |
| | | @Resource |
| | | private ComActIntegralUsersService integralUsersService; |
| | | |
| | | @Override |
| | | public R getList(int pageNum,int pageSize,String userId,String goodsId,String orderNumber, |
| | |
| | | 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"); |
| | |
| | | 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(); |
| | | } |