| | |
| | | |
| | | 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.component.redis.RedisUserLoginUtils; |
| | | import com.matrix.system.hive.bean.SysVipInfo; |
| | | import com.matrix.system.hive.dao.SysVipInfoDao; |
| | | import com.matrix.system.common.init.UserCacheManager; |
| | | import com.matrix.component.wechat.externalInterface.weixinUtil.WeixinServiceUtil; |
| | | import com.matrix.core.constance.MatrixConstance; |
| | | import com.matrix.core.pojo.AjaxResult; |
| | |
| | | import com.matrix.system.hive.service.CodeService; |
| | | import com.matrix.system.shopXcx.api.dto.RevenueFlowDto; |
| | | import com.matrix.system.shopXcx.api.dto.WithdrawalCashDto; |
| | | import com.matrix.system.shopXcx.vo.SalesOrderVo; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import io.swagger.annotations.ApiResponse; |
| | |
| | | |
| | | |
| | | @Autowired |
| | | private RedisUserLoginUtils redisUserLoginUtils; |
| | | private UserCacheManager userCacheManager; |
| | | |
| | | @Autowired |
| | | private BizUserDao bizUserDao; |
| | | private SysVipInfoDao sysVipInfoDao; |
| | | |
| | | @Autowired |
| | | private ShopRevenueFlowDao revenueFlowDao; |
| | |
| | | CodeService codeService; |
| | | |
| | | @ApiOperation(value = "获取收支明细", notes = "") |
| | | @PostMapping(value = "/getInvitationuserList") |
| | | @PostMapping(value = "/getRevenueFlow") |
| | | @ApiResponses({ |
| | | @ApiResponse(code = 200, message = "ok", response = ShopRevenueFlow.class) |
| | | }) |
| | | AjaxResult getInvitationuserList(@RequestBody @Validated RevenueFlowDto revenueFlowDto) { |
| | | BizUser loginUser = redisUserLoginUtils.getLoginUser(BizUser.class); |
| | | Page<SalesOrderVo> page=new Page<>(revenueFlowDto.getPageNum(),revenueFlowDto.getPageSize()); |
| | | revenueFlowDto.setUserId(loginUser.getOpenId()); |
| | | IPage<SalesOrderVo> shopSalesmanApplyIPage = revenueFlowDao.selectRevenuFlowList(page, revenueFlowDto); |
| | | SysVipInfo loginUser = userCacheManager.getLoginUser(); |
| | | Page<ShopRevenueFlow> page=new Page<>(revenueFlowDto.getPageNum(),revenueFlowDto.getPageSize()); |
| | | 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 = userCacheManager.getLoginUser(); |
| | | 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); |
| | | userCacheManager.updateUserInfo(loginUser); |
| | | return AjaxResult.buildSuccessInstance("提现成功"); |
| | | } |
| | | } |