|  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import com.baomidou.mybatisplus.core.metadata.IPage; | 
|---|
|  |  |  | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | 
|---|
|  |  |  | import com.matrix.biz.bean.BizUser; | 
|---|
|  |  |  | import com.matrix.biz.dao.BizUserDao; | 
|---|
|  |  |  | import com.matrix.system.hive.bean.SysVipInfo; | 
|---|
|  |  |  | import com.matrix.system.hive.dao.SysVipInfoDao; | 
|---|
|  |  |  | import com.matrix.component.redis.RedisUserLoginUtils; | 
|---|
|  |  |  | import com.matrix.component.wechat.externalInterface.weixinUtil.WeixinServiceUtil; | 
|---|
|  |  |  | import com.matrix.core.constance.MatrixConstance; | 
|---|
|  |  |  | 
|---|
|  |  |  | private RedisUserLoginUtils redisUserLoginUtils; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | private BizUserDao bizUserDao; | 
|---|
|  |  |  | private SysVipInfoDao sysVipInfoDao; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | private ShopRevenueFlowDao revenueFlowDao; | 
|---|
|  |  |  | 
|---|
|  |  |  | @ApiResponse(code = 200, message = "ok", response = ShopRevenueFlow.class) | 
|---|
|  |  |  | }) | 
|---|
|  |  |  | AjaxResult getInvitationuserList(@RequestBody @Validated RevenueFlowDto revenueFlowDto) { | 
|---|
|  |  |  | BizUser loginUser = redisUserLoginUtils.getLoginUser(BizUser.class); | 
|---|
|  |  |  | SysVipInfo loginUser = redisUserLoginUtils.getLoginUser(SysVipInfo.class); | 
|---|
|  |  |  | Page<ShopRevenueFlow> page=new Page<>(revenueFlowDto.getPageNum(),revenueFlowDto.getPageSize()); | 
|---|
|  |  |  | revenueFlowDto.setUserId(loginUser.getOpenId()); | 
|---|
|  |  |  | revenueFlowDto.setUserId(loginUser.getId()); | 
|---|
|  |  |  | IPage<ShopRevenueFlow> shopSalesmanApplyIPage = revenueFlowDao.selectRevenuFlowList(page,  revenueFlowDto); | 
|---|
|  |  |  | AjaxResult result=AjaxResult.buildSuccessInstance(shopSalesmanApplyIPage.getRecords()); | 
|---|
|  |  |  | return result; | 
|---|
|  |  |  | 
|---|
|  |  |  | }) | 
|---|
|  |  |  | @Transactional | 
|---|
|  |  |  | AjaxResult withdrawalCash(@RequestBody @Validated WithdrawalCashDto withdrawalCashDto) { | 
|---|
|  |  |  | BizUser loginUser = redisUserLoginUtils.getLoginUser(BizUser.class); | 
|---|
|  |  |  | loginUser=bizUserDao.selectById(loginUser.getUserId()); | 
|---|
|  |  |  | SysVipInfo loginUser = redisUserLoginUtils.getLoginUser(SysVipInfo.class); | 
|---|
|  |  |  | loginUser=sysVipInfoDao.selectById(loginUser.getId()); | 
|---|
|  |  |  | if(withdrawalCashDto.getAmount()<1){ | 
|---|
|  |  |  | return AjaxResult.buildFailInstance("最小提现金额为1元"); | 
|---|
|  |  |  | }else if(withdrawalCashDto.getAmount()>20000){ | 
|---|
|  |  |  | 
|---|
|  |  |  | invitationRevenueFlow.setCreateTime(new Date()); | 
|---|
|  |  |  | invitationRevenueFlow.setUpdateTime(new Date()); | 
|---|
|  |  |  | invitationRevenueFlow.setAmount(-withdrawalCashDto.getAmount()); | 
|---|
|  |  |  | invitationRevenueFlow.setUserId(loginUser.getOpenId()); | 
|---|
|  |  |  | invitationRevenueFlow.setUserId(loginUser.getId()); | 
|---|
|  |  |  | invitationRevenueFlow.setRevenueContent("提现"); | 
|---|
|  |  |  | shopRevenueFlowDao.insert(invitationRevenueFlow); | 
|---|
|  |  |  | //扣除用户剩余提现金额 | 
|---|
|  |  |  | loginUser.setWithdrawalCash(loginUser.getWithdrawalCash()-withdrawalCashDto.getAmount()); | 
|---|
|  |  |  | bizUserDao.updateByModel(loginUser); | 
|---|
|  |  |  | sysVipInfoDao.update(loginUser); | 
|---|
|  |  |  | redisUserLoginUtils.updateUserInfo(loginUser); | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|