| | |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import com.ruoyi.common.core.web.domain.BaseModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | |
| | | * 商品详情 |
| | | */ |
| | | @ApiModelProperty(value = "商品详情") |
| | | @JsonFormat() |
| | | private String detail; |
| | | |
| | | /** |
| | |
| | | public StudyClient create(Throwable cause) { |
| | | return new StudyClient() { |
| | | @Override |
| | | public R<StudyRecordResultVO> recordManagement(Integer id) { |
| | | return R.fail("根据用户id获取用户信息失败" + cause.getMessage()); |
| | | } |
| | | |
| | | @Override |
| | | public R<TUser> getUserById(Integer id) { |
| | | return R.fail("根据用户id获取会员信息失败" + cause.getMessage()); |
| | | } |
| | |
| | | |
| | | @FeignClient(contextId = "studyClient", value = ServiceNameConstants.STUDY_SERVICE, fallbackFactory = StudyFallbackFactory.class) |
| | | public interface StudyClient { |
| | | |
| | | @PostMapping("/base/study/recordManagement/{id}") |
| | | R<StudyRecordResultVO> recordManagement(@PathVariable("id")Integer id); |
| | | |
| | | @PostMapping("/base/user/getUserById/{id}") |
| | | R<TUser> getUserById(@PathVariable("id") Integer id); |
| | |
| | | package com.ruoyi.study.api.model; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import com.ruoyi.common.core.web.domain.BaseModel; |
| | |
| | | */ |
| | | @ApiModelProperty(value = "用时时间 秒") |
| | | private Integer useTime; |
| | | @ApiModelProperty(value = "游戏时间") |
| | | @TableField(exist = false) |
| | | private String time; |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi.study.api.vo; |
| | | |
| | | import com.ruoyi.study.api.model.TGameRecord; |
| | | import com.ruoyi.study.api.model.TUserStudy; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @author HJL |
| | | * @version 1.0 |
| | | * @since 2024-05-22 14:39 |
| | | */ |
| | | @Data |
| | | @ApiModel(value = "个人中心-学习记录返回信息类") |
| | | public class StudyRecordResultVO { |
| | | |
| | | /** |
| | | * 学习记录 |
| | | */ |
| | | @ApiModelProperty("学习记录") |
| | | private TUserStudy record; |
| | | |
| | | /** |
| | | * 游戏测试成绩 |
| | | */ |
| | | @ApiModelProperty("游戏测试成绩") |
| | | private List<TGameRecord> gameRecordList; |
| | | |
| | | public StudyRecordResultVO(TUserStudy record, List<TGameRecord> gameRecordList) { |
| | | this.record = record; |
| | | this.gameRecordList = gameRecordList; |
| | | } |
| | | } |
| | |
| | | package com.ruoyi.study.api.vo; |
| | | |
| | | import com.ruoyi.common.core.web.page.PageInfo; |
| | | import com.ruoyi.study.api.model.TGameRecord; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.util.Date; |
| | | |
| | | @Data |
| | | @ApiModel(value = "用户详情VO") |
| | |
| | | @ApiModelProperty(value = "剩余积分") |
| | | private Integer integral; |
| | | @ApiModelProperty(value = "当前进度") |
| | | private Integer current; |
| | | private String current; |
| | | @ApiModelProperty(value = "剩余进度") |
| | | private Integer surplus; |
| | | private String surplus; |
| | | @ApiModelProperty(value = "学习总时长") |
| | | private Double totalHours; |
| | | @ApiModelProperty(value = "今日学习时长") |
| | |
| | | @ApiModelProperty(value = "本月学习时长") |
| | | private Double monthHours; |
| | | @ApiModelProperty(value = "游戏数据列表") |
| | | private PageInfo<UserGameRecordVO> gameRecords; |
| | | private PageInfo<TGameRecord> gameRecords; |
| | | } |
| | |
| | | * 失败标记 |
| | | */ |
| | | public static final Integer FAIL = 500; |
| | | public static final Integer FAILUPDATE = 602; |
| | | /** |
| | | * 登录失效 |
| | | */ |
| | |
| | | |
| | | /** 失败 */ |
| | | public static final int FAIL = Constants.FAIL; |
| | | public static final int FAILUPDATE = Constants.FAILUPDATE; |
| | | /** 积分商城兑换失败 */ |
| | | public static final int EXCHANGECODE = Constants.EXCHANGECODE; |
| | | /** |
| | |
| | | { |
| | | return restResult(null, VIPERROR, msg); |
| | | } |
| | | public static <T> R<T> failUpdate(String msg) |
| | | { |
| | | return restResult(null, FAILUPDATE, msg); |
| | | } |
| | | |
| | | public static <T> R<T> ok(T data, String msg) |
| | | { |
| | |
| | | if (!(handler instanceof HandlerMethod)) { |
| | | return true; |
| | | } |
| | | |
| | | SecurityContextHolder.setUserId(ServletUtils.getHeader(request, SecurityConstants.DETAILS_USER_ID)); |
| | | SecurityContextHolder.setUserName(ServletUtils.getHeader(request, SecurityConstants.DETAILS_USERNAME)); |
| | | SecurityContextHolder.setUserKey(ServletUtils.getHeader(request, SecurityConstants.USER_KEY)); |
| | |
| | | if(!org.springframework.util.StringUtils.hasLength(user.getNickName())){ |
| | | user.setNickName(user.getPhonenumber()); |
| | | } |
| | | user.setPassword(SecurityUtils.encryptPassword("a123456")); |
| | | // user.setPassword(SecurityUtils.encryptPassword("a123456")); |
| | | user.setRoleType(1); |
| | | user.setUpdateBy(SecurityUtils.getUsername()); |
| | | user.setUpdateTime(new Date()); |
| | |
| | | public RedissonClient redissonClient() { |
| | | Config config = new Config(); |
| | | // 线上redis |
| | | config.useSingleServer().setAddress("redis://127.0.0.1:6379").setPassword("dolphin123456"); |
| | | // config.useSingleServer().setAddress("redis://127.0.0.1:6379").setPassword("dolphin123456"); |
| | | // 本地redis |
| | | // config.useSingleServer().setAddress("redis://127.0.0.1:6379").setPassword("123456"); |
| | | config.useSingleServer().setAddress("redis://127.0.0.1:6379").setPassword("123456"); |
| | | return Redisson.create(config); |
| | | } |
| | | |
| | |
| | | if (query.getEndTime() != null) { |
| | | Date parse = format.parse(query.getStartTime()); |
| | | Date parse1 = format.parse(query.getEndTime()); |
| | | parse1.setHours(23); |
| | | parse1.setMinutes(59); |
| | | parse1.setSeconds(59); |
| | | query.setStartTime1(parse); |
| | | query.setEndTime1(parse1); |
| | | } |
| | |
| | | </if> |
| | | |
| | | <if test="null != req.startTime"> |
| | | and t1.insertTime between #{req.startTime} and #{req.endTime} |
| | | and t1.insertTime between #{req.startTime1} and #{req.endTime1} |
| | | </if> |
| | | order by t1.state asc, t1.insertTime desc |
| | | </select> |
| | |
| | | " | | \\ / \\ / \n" + |
| | | " ''-' `'-' `-..-' "); |
| | | } |
| | | |
| | | } |
| | |
| | | // } |
| | | List<FeedbackVO> list = feedbackService.listAll(query); |
| | | PageInfo<FeedbackVO> res = new PageInfo<>(query.getPageNumber(), query.getPageSize()); |
| | | res.setTotal(list.size()); |
| | | res.setRecords(list); |
| | | return AjaxResult.success(res); |
| | | } |
| | |
| | | @ResponseBody |
| | | @PostMapping("/addGoods") |
| | | @ApiOperation(value = "添加", tags = {"后台-商品管理"}) |
| | | public AjaxResult<TGoods> addGoods(TGoods dto) { |
| | | public AjaxResult<TGoods> addGoods(@RequestBody TGoods dto) { |
| | | goodsClient.addGoods(dto); |
| | | return AjaxResult.success("添加成功"); |
| | | } |
| | |
| | | @ResponseBody |
| | | @PostMapping("/updateGoods") |
| | | @ApiOperation(value = "修改", tags = {"后台-商品管理"}) |
| | | public AjaxResult<TGoods> updateGoods( TGoods dto) { |
| | | public AjaxResult<TGoods> updateGoods(@RequestBody TGoods dto) { |
| | | goodsClient.updateGoods(dto); |
| | | return AjaxResult.success("修改成功"); |
| | | } |
| | |
| | | import com.ruoyi.study.api.dto.AppUserQuery; |
| | | import com.ruoyi.study.api.dto.UserInfoQuery; |
| | | 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 com.ruoyi.study.api.model.TGameRecord; |
| | | import com.ruoyi.study.api.vo.*; |
| | | import io.swagger.annotations.ApiImplicitParam; |
| | | import io.swagger.annotations.ApiImplicitParams; |
| | | import io.swagger.annotations.ApiOperation; |
| | |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | | /** |
| | |
| | | @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()); |
| | | // |
| | | // |
| | | // 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(); |
| | | |
| | | return AjaxResult.success(data); |
| | | UserInfoVO data1 = studyClient.getUserInfo(dto).getData(); |
| | | UserInfoVO userInfoVO = new UserInfoVO(); |
| | | userInfoVO.setState(data1.getState()); |
| | | userInfoVO.setName(data1.getName()); |
| | | userInfoVO.setPhone(data1.getPhone()); |
| | | userInfoVO.setInsertTime(data1.getInsertTime()); |
| | | userInfoVO.setIsVip(data1.getIsVip()); |
| | | userInfoVO.setVipPayTime(data1.getVipPayTime()); |
| | | userInfoVO.setIntegral(data1.getIntegral()); |
| | | userInfoVO.setCurrent(convertToChineseOrdinal(Integer.parseInt(data1.getCurrent()))); |
| | | userInfoVO.setSurplus(convertToChineseOrdinal1(Integer.parseInt(data1.getSurplus()))); |
| | | userInfoVO.setTotalHours(data1.getTotalHours()); |
| | | userInfoVO.setTodayHours(data1.getTodayHours()); |
| | | userInfoVO.setWeekHours(data1.getWeekHours()); |
| | | userInfoVO.setMonthHours(data1.getMonthHours()); |
| | | userInfoVO.setGameRecords(data1.getGameRecords()); |
| | | return AjaxResult.success(userInfoVO); |
| | | } |
| | | public static String convertToChineseOrdinal(int number) { |
| | | if (number <= 0 || number > 50) { |
| | | return "未知"; |
| | | } |
| | | String[] chineseNumbers = { |
| | | "一", "二", "三", "四", "五", "六", "七", "八", "九", "十", |
| | | "十一", "十二", "十三", "十四", "十五", "十六", "十七", "十八", "十九", "二十", |
| | | "二十一", "二十二", "二十三", "二十四", "二十五", "二十六", "二十七", "二十八", "二十九", "三十", |
| | | "三十一", "三十二", "三十三", "三十四", "三十五", "三十六", "三十七", "三十八", "三十九", "四十", |
| | | "四十一", "四十二", "四十三", "四十四", "四十五", "四十六", "四十七", "四十八", "四十九", "五十" |
| | | }; |
| | | |
| | | return "周目" + chineseNumbers[number - 1]; |
| | | } |
| | | public static String convertToChineseOrdinal1(int number) { |
| | | if (number <= 0 || number > 50) { |
| | | return "未知"; |
| | | } |
| | | String[] chineseNumbers = { |
| | | "一", "二", "三", "四", "五", "六", "七", "八", "九", "十", |
| | | "十一", "十二", "十三", "十四", "十五", "十六", "十七", "十八", "十九", "二十", |
| | | "二十一", "二十二", "二十三", "二十四", "二十五", "二十六", "二十七", "二十八", "二十九", "三十", |
| | | "三十一", "三十二", "三十三", "三十四", "三十五", "三十六", "三十七", "三十八", "三十九", "四十", |
| | | "四十一", "四十二", "四十三", "四十四", "四十五", "四十六", "四十七", "四十八", "四十九", "五十" |
| | | }; |
| | | |
| | | return chineseNumbers[number - 1]+"周目" ; |
| | | } |
| | | @PostMapping("/freeze") |
| | | @ApiOperation(value = "冻结/解冻", tags = {"用户管理"}) |
| | | public AjaxResult freeze(Integer id) { |
| | |
| | | { |
| | | return AjaxResult.error("新密码不能与旧密码相同"); |
| | | } |
| | | one.setPassword(SecurityUtils.encryptPassword(password)); |
| | | return AjaxResult.success(); |
| | | } |
| | | @GetMapping("/sendPhoneCode") |
| | |
| | | id, userId, img, content, state |
| | | </sql> |
| | | <select id="listAll" resultType="com.ruoyi.management.vo.FeedbackVO"> |
| | | select t1.*,t2.name as name ,t2.phone as phone |
| | | select t1.*,t2.name as name ,t2.phone as phone,t1.createTime as insertTime |
| | | from t_feedback t1 |
| | | left join t_user t2 on t1.userId = t2.id |
| | | where 1=1 |
| | |
| | | package com.ruoyi.study; |
| | | |
| | | import com.fasterxml.jackson.core.JsonParser; |
| | | import com.fasterxml.jackson.databind.ObjectMapper; |
| | | import com.ruoyi.common.security.annotation.EnableCustomConfig; |
| | | import com.ruoyi.common.security.annotation.EnableRyFeignClients; |
| | | import com.ruoyi.common.swagger.annotation.EnableCustomSwagger2; |
| | | import org.mybatis.spring.annotation.MapperScan; |
| | | import org.springframework.boot.SpringApplication; |
| | | import org.springframework.boot.autoconfigure.SpringBootApplication; |
| | | import org.springframework.context.annotation.Bean; |
| | | import org.springframework.scheduling.annotation.EnableScheduling; |
| | | |
| | | /** |
| | |
| | | " | | \\ / \\ / \n" + |
| | | " ''-' `'-' `-..-' "); |
| | | } |
| | | |
| | | } |
| | |
| | | this.setFieldValByName("createTime", new Date(), metaObject); |
| | | this.setFieldValByName("updateTime", new Date(), metaObject); |
| | | } |
| | | LoginUserParent loginUser1 = tokenService.getLoginUserStudy(); |
| | | if (loginUser1 != null) { |
| | | this.setFieldValByName("createTime", new Date(), metaObject); |
| | | } else { |
| | | this.setFieldValByName("createTime", new Date(), metaObject); |
| | | } |
| | | |
| | | } |
| | | |
| | |
| | | for (String s : split) { |
| | | if (s.equals(String.valueOf(id))) { |
| | | Integer week = tStudyListen.getWeek(); |
| | | return R.fail("操作失败,当前题目在" + "周目" + week + "、" + "听故事" + "、" + "框架记忆中使用"); |
| | | return R.failUpdate("操作失败,当前题目在" + "周目" + week + "、" + "听故事" + "、" + "框架记忆中使用"); |
| | | } |
| | | } |
| | | for (String s : split1) { |
| | | if (s.equals(String.valueOf(id))) { |
| | | Integer week = tStudyListen.getWeek(); |
| | | return R.fail("操作失败,当前题目在" + "周目" + week + "、" + "听故事" + "、" + "看图配音中使用"); |
| | | return R.failUpdate("操作失败,当前题目在" + "周目" + week + "、" + "听故事" + "、" + "看图配音中使用"); |
| | | } |
| | | } |
| | | } |
| | |
| | | studyRecord.setTotalStudy(Math.round((float) (totalStudy + sum) / 3600)); |
| | | return R.ok(new StudyRecordResultVO(studyRecord, gameRecordList)); |
| | | } |
| | | @PostMapping("/recordManagement/{id}") |
| | | @ApiOperation(value = "游戏测试成绩", tags = {"管理后台-查看用户详情"}) |
| | | public R<StudyRecordResultVO> recordManagement(@PathVariable("id")Integer id) { |
| | | // 学习记录 |
| | | TUserStudy studyRecord = userStudyService.lambdaQuery().eq(TUserStudy::getUserId, id) |
| | | .eq(TUserStudy::getDisabled, 0).one(); |
| | | // 查询剩余周目 |
| | | if (studyRecord != null) { |
| | | int size = studyService.list(new QueryWrapper<TStudy>() |
| | | .eq("type", 1)).size(); |
| | | studyRecord.setSurplus(size - studyRecord.getWeek()); |
| | | } else { |
| | | TUserStudy tUserStudy = new TUserStudy(); |
| | | tUserStudy.setSurplus(studyService.list(new QueryWrapper<TStudy>() |
| | | .eq("type", 1)).size()); |
| | | tUserStudy.setTodayStudy(Constants.ZERO); |
| | | tUserStudy.setTotalStudy(Constants.ZERO); |
| | | tUserStudy.setWeekStudy(Constants.ZERO); |
| | | tUserStudy.setMonthStudy(Constants.ZERO); |
| | | studyRecord = tUserStudy; |
| | | } |
| | | // 学习时长格式转换 |
| | | Integer todayStudy = studyRecord.getTodayStudy(); |
| | | studyRecord.setTodayStudy(Math.round((float) todayStudy / 3600)); |
| | | Integer weekStudy = studyRecord.getWeekStudy(); |
| | | studyRecord.setWeekStudy(Math.round((float) weekStudy / 3600)); |
| | | Integer monthStudy = studyRecord.getMonthStudy(); |
| | | studyRecord.setMonthStudy(Math.round((float) monthStudy / 3600)); |
| | | // 总时长还需计算上游戏测试成绩时长 |
| | | List<TGameRecord> gameRecordList = gameRecordService.lambdaQuery().eq(TGameRecord::getUserId, id) |
| | | .eq(TGameRecord::getDisabled, 0).list(); |
| | | int sum = gameRecordList.stream().map(TGameRecord::getUseTime).mapToInt(Integer::intValue).sum(); |
| | | Integer totalStudy = studyRecord.getTotalStudy(); |
| | | studyRecord.setTotalStudy(Math.round((float) (totalStudy + sum) / 3600)); |
| | | StudyRecordResultVO studyRecordResultVO = new StudyRecordResultVO(studyRecord, gameRecordList); |
| | | return R.ok(studyRecordResultVO); |
| | | } |
| | | |
| | | @GetMapping("/getIntegral") |
| | | @ApiOperation(value = "获取剩余积分", tags = {"家长端-获取剩余积分"}) |
| | |
| | | if (s.equals(String.valueOf(id))) { |
| | | Integer week = tStudyListen.getWeek(); |
| | | Integer day = tStudyListen.getDay(); |
| | | return R.fail("操作失败,当前题目在" + "周目" + week + "、" + "day" + day + "、" + "听音选图中使用"); |
| | | return R.failUpdate("操作失败,当前题目在" + "周目" + week + "、" + "day" + day + "、" + "听音选图中使用"); |
| | | } |
| | | } |
| | | } |
| | |
| | | if (s.equals(String.valueOf(id))) { |
| | | Integer week = tStudyListen.getWeek(); |
| | | Integer day = tStudyListen.getDay(); |
| | | return R.fail("操作失败,当前题目在" + "周目" + week + "、" + "day" + day + "、" + "看图选音中使用"); |
| | | return R.failUpdate("操作失败,当前题目在" + "周目" + week + "、" + "day" + day + "、" + "看图选音中使用"); |
| | | } |
| | | } |
| | | } |
| | |
| | | if (s.equals(String.valueOf(id))) { |
| | | Integer week = tStudyListen.getWeek(); |
| | | Integer day = tStudyListen.getDay(); |
| | | return R.fail("操作失败,当前题目在" + "周目" + week + "、" + "day" + day + "、" + "归纳排除中使用"); |
| | | return R.failUpdate("操作失败,当前题目在" + "周目" + week + "、" + "day" + day + "、" + "归纳排除中使用"); |
| | | } |
| | | } |
| | | } |
| | |
| | | if (subject.equals(id) || answerSubject.equals(id)) { |
| | | Integer week = tStudyListen.getWeek(); |
| | | Integer day = tStudyListen.getDay(); |
| | | return R.fail("操作失败,当前题目在" + "周目" + week + "、" + "day" + day + "、" + "有问有答中使用"); |
| | | return R.failUpdate("操作失败,当前题目在" + "周目" + week + "、" + "day" + day + "、" + "有问有答中使用"); |
| | | } |
| | | } |
| | | } |
| | |
| | | if (s.equals(String.valueOf(id))) { |
| | | Integer week = tStudyListen.getWeek(); |
| | | Integer day = tStudyListen.getDay(); |
| | | return R.fail("操作失败,当前题目在" + "周目" + week + "、" + "day" + day + "、" + "音图相配中使用"); |
| | | return R.failUpdate("操作失败,当前题目在" + "周目" + week + "、" + "day" + day + "、" + "音图相配中使用"); |
| | | } |
| | | } |
| | | } |
| | |
| | | @PostMapping("/aliPayBuyVip") |
| | | public void addVipPaymentAliCallback(HttpServletRequest request, HttpServletResponse response) { |
| | | try { |
| | | System.err.println("进入支付宝回调"); |
| | | Map<String, String> map = payMoneyUtil.alipayCallback(request); |
| | | System.err.println("返回参数"); |
| | | if (null != map) { |
| | | String out_trade_no = map.get("out_trade_no"); |
| | | String trade_no = map.get("trade_no"); |
| | |
| | | byId.setTransactionId(trade_no); |
| | | byId.setOutTradeNo(out_trade_no); |
| | | byId.setPayTime(new Date()); |
| | | |
| | | |
| | | TUser byId1 = userService.getById(byId.getUserId()); |
| | | if (byId1.getVipPayTime() == null) { |
| | |
| | | public R<UserInfoVO> getUserInfo(@RequestBody UserInfoQuery dto) { |
| | | 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(); |
| | |
| | | res.setIsVip(0); |
| | | } |
| | | } |
| | | if (vipPayTime != null) { |
| | | if (vipEndTime!=null){ |
| | | res.setVipPayTime(format.format(vipPayTime)); |
| | | } |
| | | res.setState(byId.getState()); |
| | | res.setName(name); |
| | | res.setPhone(phone); |
| | | res.setInsertTime(format.format(insertTime)); |
| | | if (insertTime!=null){ |
| | | res.setInsertTime(format.format(insertTime)); |
| | | } |
| | | res.setIntegral(byId.getIntegral()); |
| | | // 学习记录 |
| | | TUserStudy studyRecord = userStudyService.lambdaQuery().eq(TUserStudy::getUserId, dto.getId()) |
| | | .eq(TUserStudy::getDisabled, 0).one(); |
| | | // 游戏测试成绩 |
| | | // 查询剩余周目 |
| | | if (studyRecord != null) { |
| | | int size = studyService.list(new QueryWrapper<TStudy>() |
| | | .eq("type", 1)).size(); |
| | | studyRecord.setSurplus(size - studyRecord.getWeek()); |
| | | } else { |
| | | TUserStudy tUserStudy = new TUserStudy(); |
| | | tUserStudy.setSurplus(studyService.list(new QueryWrapper<TStudy>() |
| | | .eq("type", 1)).size()); |
| | | tUserStudy.setWeek(1); |
| | | tUserStudy.setTodayStudy(Constants.ZERO); |
| | | tUserStudy.setTotalStudy(Constants.ZERO); |
| | | tUserStudy.setWeekStudy(Constants.ZERO); |
| | | tUserStudy.setMonthStudy(Constants.ZERO); |
| | | studyRecord = tUserStudy; |
| | | } |
| | | // 学习时长格式转换 |
| | | Integer todayStudy = studyRecord.getTodayStudy(); |
| | | studyRecord.setTodayStudy(Math.round((float) todayStudy / 3600)); |
| | | Integer weekStudy = studyRecord.getWeekStudy(); |
| | | studyRecord.setWeekStudy(Math.round((float) weekStudy / 3600)); |
| | | Integer monthStudy = studyRecord.getMonthStudy(); |
| | | studyRecord.setMonthStudy(Math.round((float) monthStudy / 3600)); |
| | | // 总时长还需计算上游戏测试成绩时长 |
| | | List<TGameRecord> gameRecordList = gameRecordService.lambdaQuery().eq(TGameRecord::getUserId, dto.getId()) |
| | | .eq(TGameRecord::getDisabled, 0).list(); |
| | | if (studyRecord != null) { |
| | | res.setCurrent(studyRecord.getWeek()); |
| | | // 查询当前听的总周目 |
| | | List<TStudy> list1 = studyService.list(new QueryWrapper<>()); |
| | | res.setSurplus(list1.size() - studyRecord.getWeek()); |
| | | res.setTotalHours(studyRecord.getTotalStudy().doubleValue()); |
| | | res.setTodayHours(studyRecord.getTodayStudy().doubleValue()); |
| | | res.setWeekHours(studyRecord.getWeekStudy().doubleValue()); |
| | | res.setMonthHours(studyRecord.getMonthStudy().doubleValue()); |
| | | } else { |
| | | res.setCurrent(0); |
| | | res.setSurplus(0); |
| | | res.setTotalHours(0.0); |
| | | res.setTodayHours(0.0); |
| | | res.setWeekHours(0.0); |
| | | res.setMonthHours(0.0); |
| | | } |
| | | |
| | | List<UserGameRecordVO> userGameRecordVOS = new ArrayList<>(); |
| | | SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy.MM.dd HH:mm"); |
| | | for (TGameRecord tGameRecord : gameRecordList) { |
| | | UserGameRecordVO userGameRecordVO = new UserGameRecordVO(); |
| | | userGameRecordVO.setGameName(tGameRecord.getGameName()); |
| | | userGameRecordVO.setUseTime(tGameRecord.getUseTime().toString()); |
| | | if (tGameRecord.getGameDifficulty() == 0) { |
| | | userGameRecordVO.setAccuracy("100%"); |
| | | } else { |
| | | userGameRecordVO.setAccuracy(tGameRecord.getAccuracy() + "%"); |
| | | } |
| | | if (tGameRecord.getGameDifficulty() == 0) { |
| | | userGameRecordVO.setTime(tGameRecord.getUseTime()); |
| | | } else { |
| | | userGameRecordVO.setTime(tGameRecord.getUseTime() / 2); |
| | | } |
| | | userGameRecordVOS.add(userGameRecordVO); |
| | | tGameRecord.setTime(simpleDateFormat.format(tGameRecord.getCreateTime())); |
| | | } |
| | | list.setRecords(userGameRecordVOS); |
| | | list.setTotal(userGameRecordVOS.size()); |
| | | res.setGameRecords(list); |
| | | int sum = gameRecordList.stream().map(TGameRecord::getUseTime).mapToInt(Integer::intValue).sum(); |
| | | Integer totalStudy = studyRecord.getTotalStudy(); |
| | | studyRecord.setTotalStudy(Math.round((float) (totalStudy + sum) / 3600)); |
| | | res.setCurrent(studyRecord.getWeek()+""); |
| | | // 剩余周目 |
| | | List<TStudy> studyList = studyService.lambdaQuery().eq(TStudy::getDisabled, 0) |
| | | .eq(TStudy::getType, Constants.ONE) |
| | | .orderByAsc(TStudy::getWeek).list(); |
| | | |
| | | res.setSurplus(studyRecord.getSurplus()+""); |
| | | res.setTotalHours(studyRecord.getTotalStudy().doubleValue()); |
| | | res.setTodayHours(studyRecord.getTodayStudy().doubleValue()); |
| | | res.setMonthHours(studyRecord.getMonthStudy().doubleValue()); |
| | | res.setWeekHours(studyRecord.getWeekStudy().doubleValue()); |
| | | PageInfo<TGameRecord> list1 = new PageInfo<>(dto.getPageNumber(), dto.getPageSize()); |
| | | list1.setTotal(gameRecordList.size()); |
| | | list1.setRecords(gameRecordList); |
| | | res.setGameRecords(list1); |
| | | return R.ok(res); |
| | | } |
| | | |
| | |
| | | */ |
| | | @ApiModelProperty(value = "游戏难度(0入门、1中级、2高级)") |
| | | private Integer gameDifficulty; |
| | | @ApiModelProperty(value = "游戏时间") |
| | | @TableField(exist = false) |
| | | private String time; |
| | | |
| | | /** |
| | | * 创建时间 |
| | | */ |
| | | @ApiModelProperty(value = "记录创建时间") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm") |
| | | @TableField(value = "createTime", fill = FieldFill.INSERT) |
| | | private Date createTime; |
| | | |
| | | |
| | | } |
| | |
| | | package com.ruoyi.study.vo; |
| | | |
| | | import com.ruoyi.common.core.web.page.PageInfo; |
| | | import com.ruoyi.study.domain.TGameRecord; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.util.Date; |
| | | |
| | | @Data |
| | | @ApiModel(value = "用户详情VO") |
| | |
| | | @ApiModelProperty(value = "剩余积分") |
| | | private Integer integral; |
| | | @ApiModelProperty(value = "当前进度") |
| | | private Integer current; |
| | | private String current; |
| | | @ApiModelProperty(value = "剩余进度") |
| | | private Integer surplus; |
| | | private String surplus; |
| | | @ApiModelProperty(value = "学习总时长") |
| | | private Double totalHours; |
| | | @ApiModelProperty(value = "今日学习时长") |
| | |
| | | @ApiModelProperty(value = "本月学习时长") |
| | | private Double monthHours; |
| | | @ApiModelProperty(value = "游戏数据列表") |
| | | private PageInfo<UserGameRecordVO> gameRecords; |
| | | private PageInfo<TGameRecord> gameRecords; |
| | | } |