| | |
| | | |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.core.web.domain.AjaxResult; |
| | | import com.ruoyi.common.core.web.page.PageInfo; |
| | | import com.ruoyi.management.domain.TUser; |
| | | import com.ruoyi.management.domain.TVipSet; |
| | | import com.ruoyi.management.dto.AppUserQuery; |
| | | import com.ruoyi.management.service.ITUserService; |
| | | import com.ruoyi.management.service.ITVipSetService; |
| | | import com.ruoyi.management.service.IVipOrderService; |
| | | import com.ruoyi.management.vo.AppUserVO; |
| | | import com.ruoyi.management.vo.VipOrderVO; |
| | | import com.ruoyi.management.vo.VipSetVO; |
| | | import com.ruoyi.study.api.dto.AppUserQuery; |
| | | import com.ruoyi.study.api.dto.UserInfoQuery; |
| | | import com.ruoyi.study.api.vo.UserGameRecordVO; |
| | | import com.ruoyi.study.api.feignClient.StudyClient; |
| | | import com.ruoyi.study.api.vo.AppUserVO; |
| | | import com.ruoyi.study.api.vo.UserInfoVO; |
| | | import com.ruoyi.study.api.vo.VipOrderVO; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Controller; |
| | |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.ResponseBody; |
| | | |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.ArrayList; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | /** |
| | |
| | | private ITUserService userService; |
| | | @Autowired |
| | | private ITVipSetService vipSetService; |
| | | |
| | | @Autowired |
| | | private IVipOrderService vipOrderService; |
| | | private StudyClient studyClient; |
| | | @ResponseBody |
| | | @PostMapping("/userList") |
| | | @ApiOperation(value = "用户列表", tags = {"用户管理"}) |
| | | public AjaxResult<PageInfo<AppUserVO>> couponReceive(AppUserQuery query) { |
| | | PageInfo<AppUserVO> res = new PageInfo<>(query.getPageNumber(), query.getPageSize()); |
| | | List<AppUserVO> list = userService.listAll(query); |
| | | for (AppUserVO appUserVO : list) { |
| | | if (appUserVO.getVipEndTime() == null){ |
| | | appUserVO.setIsVip(0); |
| | | }else{ |
| | | if (appUserVO.getVipEndTime().getTime() > System.currentTimeMillis()){ |
| | | appUserVO.setIsVip(1); |
| | | }else{ |
| | | appUserVO.setIsVip(0); |
| | | } |
| | | } |
| | | } |
| | | res.setRecords(list); |
| | | res.setTotal(list.size()); |
| | | return AjaxResult.success(res); |
| | | // PageInfo<AppUserVO> res = new PageInfo<>(query.getPageNumber(), query.getPageSize()); |
| | | //// List<AppUserVO> list = userService.listAll(query); |
| | | //// for (AppUserVO appUserVO : list) { |
| | | //// if (appUserVO.getVipEndTime() == null){ |
| | | //// appUserVO.setIsVip(0); |
| | | //// }else{ |
| | | //// if (appUserVO.getVipEndTime().getTime() > System.currentTimeMillis()){ |
| | | //// appUserVO.setIsVip(1); |
| | | //// }else{ |
| | | //// appUserVO.setIsVip(0); |
| | | //// } |
| | | //// } |
| | | //// } |
| | | //// res.setRecords(list); |
| | | //// res.setTotal(list.size()); |
| | | R<PageInfo<AppUserVO>> pageInfoR = studyClient.couponReceive(query); |
| | | |
| | | return AjaxResult.success(pageInfoR); |
| | | } |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/getUserInfo") |
| | | @ApiOperation(value = "查看用户详情", tags = {"用户管理"}) |
| | | public AjaxResult<UserInfoVO> getUserInfo(UserInfoQuery dto) { |
| | | SimpleDateFormat format = new SimpleDateFormat("yyyy.MM.dd"); |
| | | UserInfoVO res = new UserInfoVO(); |
| | | PageInfo<UserGameRecordVO> list = new PageInfo<>(dto.getPageNumber(), dto.getPageSize()); |
| | | // SimpleDateFormat format = new SimpleDateFormat("yyyy.MM.dd"); |
| | | // UserInfoVO res = new UserInfoVO(); |
| | | // PageInfo<UserGameRecordVO> list = new PageInfo<>(dto.getPageNumber(), dto.getPageSize()); |
| | | // |
| | | // |
| | | // TUser byId = userService.getById(dto.getId()); |
| | | // String name = byId.getName(); |
| | | // String phone = byId.getPhone(); |
| | | // Date insertTime = byId.getInsertTime(); |
| | | // Date vipPayTime = byId.getVipPayTime(); |
| | | // Date vipEndTime = byId.getVipEndTime(); |
| | | // if (vipEndTime == null){ |
| | | // res.setIsVip(0); |
| | | // }else{ |
| | | // if (vipEndTime.getTime() > System.currentTimeMillis()){ |
| | | // res.setIsVip(1); |
| | | // }else{ |
| | | // res.setIsVip(0); |
| | | // } |
| | | // } |
| | | // if (vipPayTime!=null){ |
| | | // res.setVipPayTime(format.format(vipPayTime)); |
| | | // } |
| | | // res.setState(byId.getState()); |
| | | // res.setName(name); |
| | | // res.setPhone(phone); |
| | | // res.setInsertTime(format.format(insertTime)); |
| | | // res.setIntegral(byId.getIntegral()); |
| | | // // todo 查询进度 |
| | | // res.setCurrent(0); |
| | | // res.setSurplus(0); |
| | | // res.setTotalHours(0d); |
| | | // res.setTodayHours(0d); |
| | | // res.setWeekHours(0d); |
| | | // res.setMonthHours(0d); |
| | | // // todo 查询用户的游戏记录 |
| | | // List<UserGameRecordVO> userGameRecordVOS = new ArrayList<>(); |
| | | // list.setRecords(userGameRecordVOS); |
| | | // list.setTotal(0); |
| | | // res.setGameRecords(list); |
| | | UserInfoVO data = studyClient.getUserInfo(dto).getData(); |
| | | |
| | | |
| | | TUser byId = userService.getById(dto.getId()); |
| | | String name = byId.getName(); |
| | | String phone = byId.getPhone(); |
| | | Date insertTime = byId.getInsertTime(); |
| | | Date vipPayTime = byId.getVipPayTime(); |
| | | Date vipEndTime = byId.getVipEndTime(); |
| | | if (vipEndTime == null){ |
| | | res.setIsVip(0); |
| | | }else{ |
| | | if (vipEndTime.getTime() > System.currentTimeMillis()){ |
| | | res.setIsVip(1); |
| | | }else{ |
| | | res.setIsVip(0); |
| | | } |
| | | } |
| | | if (vipPayTime!=null){ |
| | | res.setVipPayTime(format.format(vipPayTime)); |
| | | } |
| | | res.setState(byId.getState()); |
| | | res.setName(name); |
| | | res.setPhone(phone); |
| | | res.setInsertTime(format.format(insertTime)); |
| | | res.setIntegral(byId.getIntegral()); |
| | | // todo 查询进度 |
| | | res.setCurrent(0); |
| | | res.setSurplus(0); |
| | | res.setTotalHours(0d); |
| | | res.setTodayHours(0d); |
| | | res.setWeekHours(0d); |
| | | res.setMonthHours(0d); |
| | | // todo 查询用户的游戏记录 |
| | | List<UserGameRecordVO> userGameRecordVOS = new ArrayList<>(); |
| | | list.setRecords(userGameRecordVOS); |
| | | list.setTotal(0); |
| | | res.setGameRecords(list); |
| | | return AjaxResult.success(res); |
| | | return AjaxResult.success(data); |
| | | } |
| | | @ResponseBody |
| | | @PostMapping("/freeze") |
| | |
| | | public AjaxResult freeze(Integer id) { |
| | | TUser byId = userService.getById(id); |
| | | if (byId.getState() == 1) { |
| | | byId.setState(2); |
| | | studyClient.freeze(id); |
| | | return AjaxResult.success("冻结成功"); |
| | | }else { |
| | | byId.setState(1); |
| | | studyClient.freeze(id); |
| | | return AjaxResult.success("解冻成功"); |
| | | } |
| | | } |
| | |
| | | tVipSet.setInfo(info); |
| | | vipSetService.save(tVipSet); |
| | | } |
| | | |
| | | return AjaxResult.success("保存成功"); |
| | | } |
| | | @ResponseBody |
| | | @PostMapping("/vipOrderList") |
| | | @ApiOperation(value = "列表查询", tags = {"会员管理"}) |
| | | public AjaxResult<PageInfo<AppUserVO>> vipOrderList(AppUserQuery query) { |
| | | PageInfo<VipOrderVO> res = new PageInfo<>(query.getPageNumber(), query.getPageSize()); |
| | | List<VipOrderVO> list = vipOrderService.listAll(query); |
| | | res.setRecords(list); |
| | | res.setTotal(list.size()); |
| | | return AjaxResult.success(res); |
| | | public AjaxResult<PageInfo<VipOrderVO>> vipOrderList(AppUserQuery query) { |
| | | |
| | | PageInfo<VipOrderVO> data = studyClient.vipOrderList(query).getData(); |
| | | return AjaxResult.success(data); |
| | | } |
| | | } |
| | | |