| | |
| | | import com.panzhihua.common.model.vos.community.VolunteerCreditsExchangeVO; |
| | | import com.panzhihua.common.model.vos.community.VolunteerIntegralMerchantVO; |
| | | import com.panzhihua.common.model.vos.community.VolunteerIntegralRecordVO; |
| | | import com.panzhihua.common.model.vos.community.VolunteerMerchantVO; |
| | | 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; |
| | | import com.panzhihua.service_community.entity.VolunteerCreditsExchange; |
| | | import com.panzhihua.service_community.entity.VolunteerIntegralMerchant; |
| | | import com.panzhihua.service_community.entity.VolunteerMerchant; |
| | | import com.panzhihua.service_community.service.VolunteerCreditsExchangeService; |
| | | import com.panzhihua.service_community.service.VolunteerIntegralMerchantService; |
| | | import com.panzhihua.service_community.service.VolunteerIntegralRecordService; |
| | | import com.panzhihua.service_community.service.VolunteerMerchantService; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | |
| | | |
| | | @Resource |
| | | private VolunteerIntegralRecordService virService; |
| | | |
| | | @Resource |
| | | private VolunteerMerchantService vmService; |
| | | |
| | | |
| | | @Override |
| | |
| | | return R.fail("兑换用户id不能为空"); |
| | | } |
| | | |
| | | if(StringUtils.isEmpty(goods.getGoodNum())) |
| | | { |
| | | return R.fail("商品库存不足"); |
| | | } |
| | | else |
| | | { |
| | | int goodNum=Integer.valueOf(goods.getGoodNum()); |
| | | if(goodNum<=0) |
| | | { |
| | | return R.fail("商品库存不足"); |
| | | } |
| | | |
| | | goodNum--; |
| | | |
| | | VolunteerIntegralMerchantVO vo=new VolunteerIntegralMerchantVO(); |
| | | vo.setId(goods.getId()); |
| | | vo.setGoodNum(goodNum+""); |
| | | goodsService.updateById(vo); |
| | | } |
| | | // if(StringUtils.isEmpty(goods.getGoodNum())) |
| | | // { |
| | | // return R.fail("商品库存不足"); |
| | | // } |
| | | // else |
| | | // { |
| | | // int goodNum=Integer.valueOf(goods.getGoodNum()); |
| | | // if(goodNum<=0) |
| | | // { |
| | | // return R.fail("商品库存不足"); |
| | | // } |
| | | // |
| | | // goodNum--; |
| | | // |
| | | // VolunteerIntegralMerchantVO vo=new VolunteerIntegralMerchantVO(); |
| | | // vo.setId(goods.getId()); |
| | | // vo.setGoodNum(goodNum+""); |
| | | // goodsService.updateById(vo); |
| | | // } |
| | | |
| | | |
| | | //增加积分明细记录 |
| | |
| | | virvo.setCommunityId(item.getCommunityId()); |
| | | virService.insertVolunteer(virvo); |
| | | |
| | | |
| | | //修改个人积分 |
| | | int num1=integral-Integer.valueOf(item.getPalyIntegral()); |
| | | loginUserInfoVOR.setLoveIntegral(num1+""); |
| | | userService.putUser(loginUserInfoVOR); |
| | | |
| | | |
| | | //修改商家积分 |
| | | R<VolunteerMerchant> vm= vmService.getById(item.getMerchantId()); |
| | | |
| | | int vmNum=0; |
| | | if(!StringUtils.isEmpty(vm.getData().getMerchantIntegral())) |
| | | { |
| | | vmNum=Integer.valueOf(vm.getData().getMerchantIntegral()); |
| | | } |
| | | |
| | | vmNum+=Integer.valueOf(item.getPalyIntegral()); |
| | | |
| | | VolunteerMerchantVO vmvo=new VolunteerMerchantVO(); |
| | | vmvo.setId(item.getMerchantId()); |
| | | vmvo.setMerchantIntegral(vmNum+""); |
| | | vmService.updateVolunteerMerchant(vmvo); |
| | | |
| | | item.setCondition("3"); |
| | | //设置订单号 |
| | | item.setOrderNumber(Snowflake.getId()+""); |