فهرست منبع

学生首页统计

weifanli 3 سال پیش
والد
کامیت
c573e3adb2
23فایلهای تغییر یافته به همراه314 افزوده شده و 26 حذف شده
  1. 3 3
      cooleshow-task/src/main/java/com/yonge/cooleshow/task/TaskApplication.java
  2. 19 0
      cooleshow-task/src/main/java/com/yonge/cooleshow/task/feign/StudentFeignService.java
  3. 13 0
      cooleshow-task/src/main/java/com/yonge/cooleshow/task/feign/fallback/StudentFeignServiceFallback.java
  4. 22 0
      cooleshow-task/src/main/java/com/yonge/cooleshow/task/jobs/QueryStudentHomeTotalTask.java
  5. 1 1
      cooleshow-task/src/main/resources/bootstrap-dev.properties
  6. 8 0
      cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/dao/CourseScheduleDao.java
  7. 8 0
      cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/dao/StudentStarDao.java
  8. 3 2
      cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/enums/CacheNameEnum.java
  9. 10 1
      cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/service/StudentService.java
  10. 8 2
      cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/service/TeacherService.java
  11. 58 0
      cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/service/impl/StudentServiceImpl.java
  12. 5 0
      cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/service/impl/TeacherServiceImpl.java
  13. 2 1
      cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/vo/CourseCalendarVo.java
  14. 84 0
      cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/vo/StudentTotalVo.java
  15. 2 1
      cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/vo/TeacherHomeVo.java
  16. 5 12
      cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/vo/TeacherTotalVo.java
  17. 3 1
      cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/vo/UserSetVo.java
  18. 10 0
      cooleshow-user/user-biz/src/main/resources/config/mybatis/CourseScheduleMapper.xml
  19. 7 0
      cooleshow-user/user-biz/src/main/resources/config/mybatis/StudentStarMapper.xml
  20. 2 0
      cooleshow-user/user-student/src/main/java/com/yonge/cooleshow/student/controller/StudentController.java
  21. 36 0
      cooleshow-user/user-student/src/main/java/com/yonge/cooleshow/student/task/TaskController.java
  22. 0 2
      cooleshow-user/user-teacher/src/main/java/com/yonge/cooleshow/teacher/controller/TeacherController.java
  23. 5 0
      cooleshow-user/user-teacher/src/main/java/com/yonge/cooleshow/teacher/task/TaskController.java

+ 3 - 3
cooleshow-task/src/main/java/com/yonge/cooleshow/task/TaskApplication.java

@@ -16,9 +16,9 @@ import com.spring4all.swagger.EnableSwagger2Doc;
 
 @SpringBootApplication
 @EnableDiscoveryClient
-@EnableFeignClients("com.ym.mec")
-@MapperScan("com.ym.mec.task.dal.dao")
-@ComponentScan(basePackages="com.yonge.cooleshow")
+@EnableFeignClients("com.yonge.cooleshow")
+@MapperScan("com.yonge.cooleshow.task.dal.dao")
+@ComponentScan(basePackages = { "com.yonge.cooleshow.task", "com.yonge.cooleshow.auth", "com.yonge.cooleshow.common", "com.yonge.cooleshow.common.security", "com.yonge.toolset.thirdparty" })
 @Configuration
 @EnableSwagger2Doc
 @EnableAsync

+ 19 - 0
cooleshow-task/src/main/java/com/yonge/cooleshow/task/feign/StudentFeignService.java

@@ -0,0 +1,19 @@
+package com.yonge.cooleshow.task.feign;
+
+import com.yonge.cooleshow.common.config.FeignConfiguration;
+import com.yonge.cooleshow.task.feign.fallback.StudentFeignServiceFallback;
+import org.springframework.cloud.openfeign.FeignClient;
+import org.springframework.web.bind.annotation.GetMapping;
+
+@FeignClient(name = "student-server", configuration = FeignConfiguration.class, fallback = StudentFeignServiceFallback.class)
+public interface StudentFeignService {
+
+    /***
+     * 统计学生首页数据
+     * @author liweifan
+     * @updateTime 2022/3/28 15:34
+     * @return: java.lang.Object
+     */
+    @GetMapping(value = "/task/queryStudentHomeTotal")
+    Object queryStudentHomeTotal();
+}

+ 13 - 0
cooleshow-task/src/main/java/com/yonge/cooleshow/task/feign/fallback/StudentFeignServiceFallback.java

@@ -0,0 +1,13 @@
+package com.yonge.cooleshow.task.feign.fallback;
+
+import com.yonge.cooleshow.task.feign.StudentFeignService;
+import org.springframework.stereotype.Component;
+
+@Component
+public class StudentFeignServiceFallback implements StudentFeignService {
+
+    @Override
+    public Object queryStudentHomeTotal() {
+        return null;
+    }
+}

+ 22 - 0
cooleshow-task/src/main/java/com/yonge/cooleshow/task/jobs/QueryStudentHomeTotalTask.java

@@ -0,0 +1,22 @@
+package com.yonge.cooleshow.task.jobs;
+
+import com.yonge.cooleshow.task.core.BaseTask;
+import com.yonge.cooleshow.task.core.TaskException;
+import com.yonge.cooleshow.task.feign.StudentFeignService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+/**
+ * @Author: liweifan
+ * @Data: 2022/3/28 15:55
+ */
+@Service
+public class QueryStudentHomeTotalTask extends BaseTask {
+    @Autowired
+    private StudentFeignService studentFeignService;
+
+    @Override
+    public void execute() throws TaskException {
+        studentFeignService.queryStudentHomeTotal();
+    }
+}

+ 1 - 1
cooleshow-task/src/main/resources/bootstrap-dev.properties

@@ -13,4 +13,4 @@ spring.cloud.nacos.config.file-extension=yaml
 #\u662f\u5426\u52a8\u6001\u5237\u65b0
 spring.cloud.nacos.config.refresh.enabled=true
 #\u662f\u5426\u542f\u7528nacos\u914d\u7f6e\u4e2d\u5fc3
-spring.cloud.nacos.config.enabled=true
+spring.cloud.nacos.config.enabled=true

+ 8 - 0
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/dao/CourseScheduleDao.java

@@ -2,6 +2,7 @@ package com.yonge.cooleshow.biz.dal.dao;
 
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.yonge.cooleshow.biz.dal.entity.CourseSchedule;
+import com.yonge.cooleshow.biz.dal.vo.StudentTotalVo;
 import com.yonge.cooleshow.biz.dal.vo.TeacherTotalVo;
 import org.apache.ibatis.annotations.Param;
 
@@ -23,6 +24,13 @@ public interface CourseScheduleDao extends BaseMapper<CourseSchedule> {
      * @return: com.yonge.cooleshow.biz.dal.vo.TeacherTotalVo
      */
     List<TeacherTotalVo> queryTeacherHomeTotal();
+    /***
+     * 查询所有学生课时统计
+     * @author liweifan
+     * @updateTime 2022/3/28 10:53
+     * @return: com.yonge.cooleshow.biz.dal.vo.TeacherTotalVo
+     */
+    List<StudentTotalVo> queryStudentHomeTotal();
 
 }
 

+ 8 - 0
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/dao/StudentStarDao.java

@@ -5,6 +5,7 @@ import java.util.List;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.yonge.cooleshow.biz.dal.entity.StudentStar;
+import com.yonge.cooleshow.biz.dal.vo.StudentTotalVo;
 import com.yonge.cooleshow.biz.dal.vo.TeacherTotalVo;
 
 public interface StudentStarDao extends BaseMapper<StudentStar>{
@@ -15,4 +16,11 @@ public interface StudentStarDao extends BaseMapper<StudentStar>{
 	 * @return: java.util.List<com.yonge.cooleshow.biz.dal.vo.TeacherTotalVo>
 	 */
 	List<TeacherTotalVo> queryTeacherHomeTotal();
+	/***
+	 * 查询首页学生关注老师数
+	 * @author liweifan
+	 * @updateTime 2022/3/28 10:38
+	 * @return: java.util.List<com.yonge.cooleshow.biz.dal.vo.TeacherTotalVo>
+	 */
+	List<StudentTotalVo> queryStudentHomeTotal();
 }

+ 3 - 2
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/enums/CacheNameEnum.java

@@ -13,8 +13,9 @@ import java.time.Duration;
  * @Data: 2022/3/28 16:24
  */
 public enum CacheNameEnum implements BaseEnum<String, CacheNameEnum> {
-
-    TEACHER_HOME_TOTAL("老师首页统计缓存");
+    TEACHER_HOME_TOTAL("老师首页统计缓存"),
+    STUDENT_HOME_TOTAL("学生首页统计缓存")
+    ;
     /***
      * 缓存描述
      * @author liweifan

+ 10 - 1
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/service/StudentService.java

@@ -4,9 +4,12 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.service.IService;
 import com.yonge.cooleshow.biz.dal.dto.search.StudentSearch;
 import com.yonge.cooleshow.biz.dal.entity.Student;
+import com.yonge.cooleshow.biz.dal.vo.StudentTotalVo;
 import com.yonge.cooleshow.biz.dal.vo.StudentVo;
 import com.yonge.cooleshow.biz.dal.vo.TeacherVo;
 
+import java.util.List;
+
 /**
  * 学生表 服务类
  * @author liweifan
@@ -27,5 +30,11 @@ public interface StudentService extends IService<Student>  {
  	 * @date 2022-03-23
      */
     IPage<StudentVo> selectPage(IPage<StudentVo> page, StudentSearch studentSearch);
-
+    /***
+     * 查询所有学生首页统计数据
+     * @author liweifan
+     * @updateTime 2022/3/29 10:53
+     * @return: java.util.List<com.yonge.cooleshow.biz.dal.vo.StudentTotalVo>
+     */
+    List<StudentTotalVo> queryStudentHomeTotal();
 }

+ 8 - 2
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/service/TeacherService.java

@@ -77,6 +77,12 @@ public interface TeacherService extends IService<Teacher>  {
      * @return: java.util.List<com.yonge.cooleshow.biz.dal.vo.TeacherTotalVo>
      */
     List<TeacherTotalVo> queryTeacherHomeTotal();
-
-
+    /***
+     * 通过redis key查询
+     * @author liweifan
+     * @param: key
+     * @updateTime 2022/3/29 10:41
+     * @return: java.lang.Object
+     */
+    Object getRedisValueByKey(String key);
 }

+ 58 - 0
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/service/impl/StudentServiceImpl.java

@@ -1,21 +1,42 @@
 package com.yonge.cooleshow.biz.dal.service.impl;
 
 import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.yonge.cooleshow.biz.dal.dao.CourseScheduleDao;
+import com.yonge.cooleshow.biz.dal.dao.StudentStarDao;
 import com.yonge.cooleshow.biz.dal.dto.search.StudentSearch;
+import com.yonge.cooleshow.biz.dal.entity.Teacher;
 import com.yonge.cooleshow.biz.dal.entity.TeacherStyleVideo;
+import com.yonge.cooleshow.biz.dal.enums.CacheNameEnum;
+import com.yonge.cooleshow.biz.dal.vo.StudentTotalVo;
 import com.yonge.cooleshow.biz.dal.vo.StudentVo;
+import com.yonge.cooleshow.biz.dal.vo.TeacherTotalVo;
 import com.yonge.cooleshow.biz.dal.vo.TeacherVo;
+import org.redisson.api.RedissonClient;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import com.yonge.cooleshow.biz.dal.entity.Student;
 import com.yonge.cooleshow.biz.dal.dao.StudentDao;
 import com.yonge.cooleshow.biz.dal.service.StudentService;
+import org.springframework.util.CollectionUtils;
 
+import java.util.ArrayList;
+import java.util.HashMap;
 import java.util.List;
+import java.util.Map;
+import java.util.stream.Collectors;
 
 
 @Service
 public class StudentServiceImpl extends ServiceImpl<StudentDao, Student> implements StudentService {
+    @Autowired
+    private StudentStarDao studentStarDao;
+    @Autowired
+    private CourseScheduleDao courseScheduleDao;
+    @Autowired
+    private RedissonClient redissonClient;
+
     @Override
     public StudentVo detail(Long userId) {
         StudentVo detail = baseMapper.detail(userId);
@@ -26,4 +47,41 @@ public class StudentServiceImpl extends ServiceImpl<StudentDao, Student> impleme
     public IPage<StudentVo> selectPage(IPage<StudentVo> page, StudentSearch studentSearch) {
         return page.setRecords(baseMapper.selectPage(page, studentSearch));
     }
+
+    @Override
+    public List<StudentTotalVo> queryStudentHomeTotal() {
+        List<Student> students = baseMapper.selectList(Wrappers.<Student>emptyWrapper()
+                .select("userId"));
+        //查询关注老师数
+        List<StudentTotalVo> studentStarTotal = studentStarDao.queryStudentHomeTotal();
+        Map<Long, StudentTotalVo> studentStarMap = new HashMap<>();
+        if (!CollectionUtils.isEmpty(studentStarTotal)) {
+            studentStarMap = studentStarTotal.stream().collect(Collectors.toMap(StudentTotalVo::getUserId, o -> o));
+        }
+
+        //查询已上未上课时数
+        List<StudentTotalVo> studentCourseTotal = courseScheduleDao.queryStudentHomeTotal();
+        Map<Long, StudentTotalVo> studentCourseMap = new HashMap<>();
+        if (!CollectionUtils.isEmpty(studentCourseTotal)) {
+            studentCourseMap = studentCourseTotal.stream().collect(Collectors.toMap(StudentTotalVo::getUserId, o -> o));
+        }
+        List<StudentTotalVo> resultList = new ArrayList<>();
+        for (Student student : students) {
+            StudentTotalVo totalVo = new StudentTotalVo();
+            totalVo.setUserId(student.getUserId());
+            StudentTotalVo starTotal = studentStarMap.get(student.getUserId());
+            if (null != starTotal) {
+                totalVo.setStarNum(starTotal.getStarNum());
+            }
+            StudentTotalVo courseTotal = studentCourseMap.get(student.getUserId());
+            if (null != courseTotal) {
+                totalVo.setExpTime(courseTotal.getExpTime());
+                totalVo.setUnExpTime(courseTotal.getUnExpTime());
+            }
+            resultList.add(totalVo);
+            redissonClient.getBucket(CacheNameEnum.STUDENT_HOME_TOTAL.getRedisKey(totalVo.getUserId()))
+                    .set(totalVo);
+        }
+        return resultList;
+    }
 }

+ 5 - 0
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/service/impl/TeacherServiceImpl.java

@@ -192,6 +192,11 @@ public class TeacherServiceImpl extends ServiceImpl<TeacherDao, Teacher> impleme
         return resultList;
     }
 
+    @Override
+    public Object getRedisValueByKey(String key) {
+        return redissonClient.getBucket(key).get();
+    }
+
     private HttpResponseResult<Boolean> doCreate(TeacherSubmitReq teacherSubmitReq) throws BizException {
         //判断手机号
         SysUser sysUser = employeeDao.queryByPhone(teacherSubmitReq.getPhone());

+ 2 - 1
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/vo/CourseCalendarVo.java

@@ -3,6 +3,7 @@ package com.yonge.cooleshow.biz.dal.vo;
 import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModelProperty;
 
+import java.io.Serializable;
 import java.util.Date;
 
 /**
@@ -10,7 +11,7 @@ import java.util.Date;
  * Created by 2022-03-21
  */
 @ApiModel(value = "TeacherApplyDetail对象", description = "老师入驻申请信息")
-public class CourseCalendarVo {
+public class CourseCalendarVo implements Serializable {
 
     @ApiModelProperty("课程日期 ")
     private Date courseDate;

+ 84 - 0
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/vo/StudentTotalVo.java

@@ -0,0 +1,84 @@
+package com.yonge.cooleshow.biz.dal.vo;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+
+import java.io.Serializable;
+
+/**
+ * @Author: liweifan
+ * @Data: 2022/3/21 18:37
+ */
+@ApiModel(value = "StudentTotalVo对象", description = "学生统计信息返回")
+public class StudentTotalVo implements Serializable {
+    @ApiModelProperty("对应user表用户编号")
+    private Long userId;
+    @ApiModelProperty("累计练习天数")
+    private Integer totalExerciseDays;
+    @ApiModelProperty("累计练习时长")
+    private Double totalExerciseTimes;
+    @ApiModelProperty("累计评测次数")
+    private Integer totalTestNum;
+    @ApiModelProperty("已完成课时数")
+    private Integer expTime;
+    @ApiModelProperty("剩余课时")
+    private Integer unExpTime;
+    @ApiModelProperty("关注老师数")
+    private Integer starNum;
+
+    public Long getUserId() {
+        return userId;
+    }
+
+    public void setUserId(Long userId) {
+        this.userId = userId;
+    }
+
+    public Integer getTotalExerciseDays() {
+        return totalExerciseDays;
+    }
+
+    public void setTotalExerciseDays(Integer totalExerciseDays) {
+        this.totalExerciseDays = totalExerciseDays;
+    }
+
+    public Double getTotalExerciseTimes() {
+        return totalExerciseTimes;
+    }
+
+    public void setTotalExerciseTimes(Double totalExerciseTimes) {
+        this.totalExerciseTimes = totalExerciseTimes;
+    }
+
+    public Integer getTotalTestNum() {
+        return totalTestNum;
+    }
+
+    public void setTotalTestNum(Integer totalTestNum) {
+        this.totalTestNum = totalTestNum;
+    }
+
+    public Integer getExpTime() {
+        return expTime;
+    }
+
+    public void setExpTime(Integer expTime) {
+        this.expTime = expTime;
+    }
+
+    public Integer getUnExpTime() {
+        return unExpTime;
+    }
+
+    public void setUnExpTime(Integer unExpTime) {
+        this.unExpTime = unExpTime;
+    }
+
+    public Integer getStarNum() {
+        return starNum;
+    }
+
+    public void setStarNum(Integer starNum) {
+        this.starNum = starNum;
+    }
+}

+ 2 - 1
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/vo/TeacherHomeVo.java

@@ -9,6 +9,7 @@ import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModelProperty;
 import org.springframework.format.annotation.DateTimeFormat;
 
+import java.io.Serializable;
 import java.util.Date;
 
 /**
@@ -16,7 +17,7 @@ import java.util.Date;
  * @Data: 2022/3/21 18:37
  */
 @ApiModel(value = "TeacherHomeVo对象", description = "老师主页基本信息返回")
-public class TeacherHomeVo {
+public class TeacherHomeVo implements Serializable {
     @ApiModelProperty("对应user表用户编号")
     private Long userId;
     @ApiModelProperty("头像地址")

+ 5 - 12
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/vo/TeacherTotalVo.java

@@ -3,16 +3,16 @@ package com.yonge.cooleshow.biz.dal.vo;
 import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModelProperty;
 
+import java.io.Serializable;
+
 /**
  * @Author: liweifan
  * @Data: 2022/3/21 18:37
  */
-@ApiModel(value = "TeacherHomeVo对象", description = "老师主页基本信息返回")
-public class TeacherTotalVo {
+@ApiModel(value = "TeacherTotalVo对象", description = "老师统计信息返回")
+public class TeacherTotalVo implements Serializable {
     @ApiModelProperty("对应user表用户编号")
     private Long userId;
-    @ApiModelProperty("老师昵称")
-    private String username;
     @ApiModelProperty("星级")
     private Double starGrade;
     @ApiModelProperty("粉丝数")
@@ -30,14 +30,6 @@ public class TeacherTotalVo {
         this.userId = userId;
     }
 
-    public String getUsername() {
-        return username;
-    }
-
-    public void setUsername(String username) {
-        this.username = username;
-    }
-
     public Integer getFansNum() {
         return null == fansNum ? 0 : fansNum;
     }
@@ -69,4 +61,5 @@ public class TeacherTotalVo {
     public void setStarGrade(Double starGrade) {
         this.starGrade = starGrade;
     }
+
 }

+ 3 - 1
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/vo/UserSetVo.java

@@ -4,6 +4,8 @@ import com.yonge.cooleshow.biz.dal.enums.YesOrNoEnum;
 import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModelProperty;
 
+import java.io.Serializable;
+
 
 /**
  *
@@ -11,7 +13,7 @@ import io.swagger.annotations.ApiModelProperty;
  * @Data: 2022/3/24 16:28
  */
 @ApiModel(value = "UserSetVo对象", description = "用户设置页面查询")
-public class UserSetVo {
+public class UserSetVo implements Serializable {
     @ApiModelProperty("头像地址")
     private String avatar;
     @ApiModelProperty("昵称")

+ 10 - 0
cooleshow-user/user-biz/src/main/resources/config/mybatis/CourseScheduleMapper.xml

@@ -61,4 +61,14 @@
             group by a.teacher_id_
         ) b on a.userId = b.userId
     </select>
+    <select id="queryStudentHomeTotal" resultType="com.yonge.cooleshow.biz.dal.vo.StudentTotalVo">
+        select
+            b.user_id_ as userId,
+            sum(if(a.end_time_ &lt;= now(),1,0)) as expTime,
+            sum(if(a.end_time_ &gt; now(),1,0)) as unExpTime
+        from course_schedule a
+        join course_schedule_student_payment b on a.id_ = b.course_id_
+        where a.lock_ = 0 and a.type_ = 'PRACTICE'
+        group by b.user_id_
+    </select>
 </mapper>

+ 7 - 0
cooleshow-user/user-biz/src/main/resources/config/mybatis/StudentStarMapper.xml

@@ -21,5 +21,12 @@
 		from student_star
 		group by teacher_id_
 	</select>
+    <select id="queryStudentHomeTotal" resultType="com.yonge.cooleshow.biz.dal.vo.StudentTotalVo">
+		select
+			student_id_ as userId,
+			count(1) as starNum
+		from student_star
+		group by student_id_
+	</select>
 
 </mapper>

+ 2 - 0
cooleshow-user/user-student/src/main/java/com/yonge/cooleshow/student/controller/StudentController.java

@@ -68,6 +68,8 @@ public class StudentController extends BaseController {
         int num = DateUtil.daysBetween(new Date(), student.getMembershipEndTime());
         studentHomeVo.setMembershipDays(num < 0 ? 0 : num);
         //todo 学员我的-统计数据
+
+
         return succeed(studentHomeVo);
     }
 

+ 36 - 0
cooleshow-user/user-student/src/main/java/com/yonge/cooleshow/student/task/TaskController.java

@@ -0,0 +1,36 @@
+package com.yonge.cooleshow.student.task;
+
+import com.yonge.cooleshow.biz.dal.service.StudentService;
+import com.yonge.cooleshow.biz.dal.service.TeacherService;
+import com.yonge.cooleshow.biz.dal.vo.StudentTotalVo;
+import com.yonge.cooleshow.biz.dal.vo.TeacherTotalVo;
+import com.yonge.cooleshow.common.controller.BaseController;
+import com.yonge.cooleshow.common.entity.HttpResponseResult;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import java.util.List;
+
+/**
+ * @Author: liweifan
+ * @Data: 2022/3/28 15:50
+ */
+@RestController
+@RequestMapping("/task")
+public class TaskController extends BaseController {
+    @Autowired
+    private StudentService studentService;
+
+    /***
+     * 查询所有学生统计数据
+     * @author liweifan
+     * @updateTime 2022/3/29 11:58
+     * @return: com.yonge.cooleshow.common.entity.HttpResponseResult<java.util.List<com.yonge.cooleshow.biz.dal.vo.StudentTotalVo>>
+     */
+    @GetMapping("/queryStudentHomeTotal")
+    public HttpResponseResult<List<StudentTotalVo>> queryStudentHomeTotal() {
+        return succeed(studentService.queryStudentHomeTotal());
+    }
+}

+ 0 - 2
cooleshow-user/user-teacher/src/main/java/com/yonge/cooleshow/teacher/controller/TeacherController.java

@@ -24,11 +24,9 @@ import java.util.List;
 public class TeacherController extends BaseController {
     @Autowired
     private TeacherService teacherService;
-
     @Autowired
     private SysUserFeignService sysUserFeignService;
 
-
     @ApiOperation(value = "我的-查询教师基本信息")
     @GetMapping("/queryUserInfo")
     public HttpResponseResult<TeacherHomeVo> queryUserInfo() {

+ 5 - 0
cooleshow-user/user-teacher/src/main/java/com/yonge/cooleshow/teacher/task/TaskController.java

@@ -32,4 +32,9 @@ public class TaskController extends BaseController {
     public HttpResponseResult<List<TeacherTotalVo>> queryTeacherHomeTotal() {
         return succeed(teacherService.queryTeacherHomeTotal());
     }
+
+    @GetMapping("/getRedisValueByKey")
+    public HttpResponseResult<Object> getRedisValueByKey(String key) {
+        return succeed(teacherService.getRedisValueByKey(key));
+    }
 }