| | |
| | | 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.VolunteerMerchantVO; |
| | | import com.panzhihua.common.model.vos.community.VolunteerMerchantWithdrawVO; |
| | | import com.panzhihua.common.utlis.StringUtils; |
| | | import com.panzhihua.service_community.dao.VolunteerMerchantWithdrawDao; |
| | | import com.panzhihua.service_community.entity.VolunteerMerchant; |
| | | import com.panzhihua.service_community.entity.VolunteerMerchantWithdraw; |
| | | import com.panzhihua.service_community.service.VolunteerMerchantService; |
| | | import com.panzhihua.service_community.service.VolunteerMerchantWithdrawService; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.annotation.Resource; |
| | | |
| | | |
| | | @Slf4j |
| | | @Service |
| | | public class VolunteerMerchantWithdrawServiceImpl extends ServiceImpl<VolunteerMerchantWithdrawDao, |
| | | VolunteerMerchantWithdraw> implements VolunteerMerchantWithdrawService { |
| | | |
| | | @Resource |
| | | private VolunteerMerchantService vmService; |
| | | |
| | | @Override |
| | | public R getList(int pageNum, int pageSize, String disposeType,String merchantName) |
| | |
| | | } |
| | | |
| | | @Override |
| | | public R insert(VolunteerMerchantWithdrawVO item) { |
| | | public R insert(VolunteerMerchantWithdrawVO item) |
| | | { |
| | | if(item==null) |
| | | { |
| | | return R.fail("参数不能为空"); |
| | | } |
| | | |
| | | if(StringUtils.isEmpty(item.getMerchantId())) |
| | | { |
| | | return R.fail("商家id不能为空"); |
| | | } |
| | | |
| | | if(StringUtils.isEmpty(item.getWithdrawIntegral())) |
| | | { |
| | | return R.fail("提现积分不能为空"); |
| | | } |
| | | |
| | | R<VolunteerMerchant> volunteerMerchantR=vmService.getById(item.getMerchantId()); |
| | | int merchant=Integer.valueOf(volunteerMerchantR.getData().getMerchantIntegral()); |
| | | |
| | | int WithdrawIntegral=Integer.valueOf(item.getWithdrawIntegral()); |
| | | |
| | | if(WithdrawIntegral>merchant) |
| | | { |
| | | return R.fail("提现积分不足!"); |
| | | } |
| | | |
| | | merchant=merchant-WithdrawIntegral; |
| | | |
| | | VolunteerMerchantVO merchantVO=new VolunteerMerchantVO(); |
| | | merchantVO.setId(item.getMerchantId()); |
| | | merchantVO.setMerchantIntegral(merchant+""); |
| | | vmService.updateVolunteerMerchant(merchantVO); |
| | | |
| | | int num= baseMapper.insert(item); |
| | | if(num>0) |
| | | { |