瀏覽代碼

feat:教务端学员云教练数据统计

Joburgess 4 年之前
父節點
當前提交
cf2a9f3cb3

+ 12 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/dao/StudentDao.java

@@ -250,4 +250,16 @@ public interface StudentDao extends com.ym.mec.common.dal.BaseDAO<Integer, Stude
      * @return com.ym.mec.biz.dal.dto.EduOrganStudentDataDto
      */
     EduOrganStudentDataDto getOrganStudentVipData(@Param("organId") Integer organId);
+
+    /**
+     * @describe 统计云教练试用人数
+     * @author Joburgess
+     * @date 2021/8/17 0017
+     * @param organId:
+     * @return int
+     */
+    int getCloudStudyStudentNum(@Param("organId") Integer organId);
+
+
+    int getCloudStudyLivelyStudentNum(@Param("organId") Integer organId);
 }

+ 155 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/dto/EduOrganStudentListDto.java

@@ -0,0 +1,155 @@
+package com.ym.mec.biz.dal.dto;
+
+import io.swagger.annotations.ApiModelProperty;
+
+import java.util.Date;
+
+/**
+ * @Author Joburgess
+ * @Date 2021/8/17 0017
+ */
+public class EduOrganStudentListDto {
+
+    @ApiModelProperty("学员编号")
+    private Integer studentId;
+
+    @ApiModelProperty("姓名")
+    private String studentName;
+
+    @ApiModelProperty("指导老师编号")
+    private Integer teacherId;
+
+    @ApiModelProperty("指导老师名称")
+    private String teacherName;
+
+    @ApiModelProperty("声部编号")
+    private Integer subjectId;
+
+    @ApiModelProperty("声部名称")
+    private String subjectName;
+
+    @ApiModelProperty("乐团名称")
+    private String musicGroupNames;
+
+    @ApiModelProperty("是否有小课")
+    private int hasVipGroup;
+
+    @ApiModelProperty("训练次数")
+    private int cloudStudyUseNum;
+
+    @ApiModelProperty("平均时长")
+    private double cloudStudyUseAvgTime;
+
+    @ApiModelProperty("总时长")
+    private  double cloudStudyUseTime;
+
+    @ApiModelProperty("连续天数")
+    private int cloudStudyRunningDays;
+
+    @ApiModelProperty("会员有效期")
+    private Date membershipEndTime;
+
+    public Integer getStudentId() {
+        return studentId;
+    }
+
+    public void setStudentId(Integer studentId) {
+        this.studentId = studentId;
+    }
+
+    public String getStudentName() {
+        return studentName;
+    }
+
+    public void setStudentName(String studentName) {
+        this.studentName = studentName;
+    }
+
+    public Integer getTeacherId() {
+        return teacherId;
+    }
+
+    public void setTeacherId(Integer teacherId) {
+        this.teacherId = teacherId;
+    }
+
+    public String getTeacherName() {
+        return teacherName;
+    }
+
+    public void setTeacherName(String teacherName) {
+        this.teacherName = teacherName;
+    }
+
+    public Integer getSubjectId() {
+        return subjectId;
+    }
+
+    public void setSubjectId(Integer subjectId) {
+        this.subjectId = subjectId;
+    }
+
+    public String getSubjectName() {
+        return subjectName;
+    }
+
+    public void setSubjectName(String subjectName) {
+        this.subjectName = subjectName;
+    }
+
+    public String getMusicGroupNames() {
+        return musicGroupNames;
+    }
+
+    public void setMusicGroupNames(String musicGroupNames) {
+        this.musicGroupNames = musicGroupNames;
+    }
+
+    public int getHasVipGroup() {
+        return hasVipGroup;
+    }
+
+    public void setHasVipGroup(int hasVipGroup) {
+        this.hasVipGroup = hasVipGroup;
+    }
+
+    public int getCloudStudyUseNum() {
+        return cloudStudyUseNum;
+    }
+
+    public void setCloudStudyUseNum(int cloudStudyUseNum) {
+        this.cloudStudyUseNum = cloudStudyUseNum;
+    }
+
+    public double getCloudStudyUseAvgTime() {
+        return cloudStudyUseAvgTime;
+    }
+
+    public void setCloudStudyUseAvgTime(double cloudStudyUseAvgTime) {
+        this.cloudStudyUseAvgTime = cloudStudyUseAvgTime;
+    }
+
+    public double getCloudStudyUseTime() {
+        return cloudStudyUseTime;
+    }
+
+    public void setCloudStudyUseTime(double cloudStudyUseTime) {
+        this.cloudStudyUseTime = cloudStudyUseTime;
+    }
+
+    public int getCloudStudyRunningDays() {
+        return cloudStudyRunningDays;
+    }
+
+    public void setCloudStudyRunningDays(int cloudStudyRunningDays) {
+        this.cloudStudyRunningDays = cloudStudyRunningDays;
+    }
+
+    public Date getMembershipEndTime() {
+        return membershipEndTime;
+    }
+
+    public void setMembershipEndTime(Date membershipEndTime) {
+        this.membershipEndTime = membershipEndTime;
+    }
+}

+ 22 - 1
mec-biz/src/main/java/com/ym/mec/biz/service/impl/StudentServiceImpl.java

@@ -14,6 +14,7 @@ import com.ym.mec.common.service.impl.BaseServiceImpl;
 import com.ym.mec.util.collection.MapUtil;
 import com.ym.mec.util.date.DateUtil;
 import org.apache.commons.lang3.StringUtils;
+import org.apache.poi.ss.formula.functions.T;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
@@ -365,7 +366,27 @@ public class StudentServiceImpl extends BaseServiceImpl<Integer, Student> implem
     @Override
     public StatDto organStudentData(StudentQueryInfo queryInfo) {
         EduOrganStudentDataDto organStudentVipData = studentDao.getOrganStudentVipData(queryInfo.getOrganId());
+        organStudentVipData.setCloudStudyUseStudentNum(studentDao.getCloudStudyStudentNum(queryInfo.getOrganId()));
+        organStudentVipData.setCloudStudyLivelyStudentNum(studentDao.getCloudStudyLivelyStudentNum(queryInfo.getOrganId()));
 
-        return null;
+        PageInfo<EduOrganStudentListDto> pageInfo = new PageInfo<>(queryInfo.getPage(), queryInfo.getRows());
+        Map<String, Object> params = new HashMap<String, Object>();
+        MapUtil.populateMap(params, queryInfo);
+
+        List<EduOrganStudentListDto> dataList = new ArrayList<>();
+        int count = 1;
+        if (count > 0) {
+            pageInfo.setTotal(count);
+            params.put("offset", pageInfo.getOffset());
+//            dataList = this.getDAO().queryPage(params);
+        }
+        dataList.add(new EduOrganStudentListDto());
+        pageInfo.setRows(dataList);
+
+        StatDto result = new StatDto();
+        result.setHead(organStudentVipData);
+        result.setDetail(pageInfo);
+
+        return result;
     }
 }

+ 20 - 0
mec-biz/src/main/resources/config/mybatis/StudentMapper.xml

@@ -774,6 +774,26 @@
         </if>
     </select>
 
+    <select id="getCloudStudyStudentNum" resultType="int">
+        SELECT
+            COUNT(DISTINCT smcr.user_id_)
+        FROM sys_music_compare_record smcr
+             LEFT JOIN sys_user su ON smcr.user_id_=su.id_
+             LEFT JOIN student stu ON smcr.user_id_=stu.user_id_
+        WHERE su.del_flag_=0 AND stu.user_id_ IS NOT NULL AND su.organ_id_=#{organId};
+    </select>
+    <select id="getCloudStudyLivelyStudentNum" resultType="int">
+        SELECT COUNT(user_id_)
+        FROM (SELECT
+            smcr.user_id_,
+            COUNT(DISTINCT(CASE WHEN DATEDIFF(NOW(), smcr.create_time_)&lt;=30 THEN DATE_FORMAT(smcr.create_time_, '%Y-%m-%d') ELSE NULL END)) days
+            FROM sys_music_compare_record smcr
+            LEFT JOIN sys_user su ON smcr.user_id_=su.id_
+            LEFT JOIN student stu ON smcr.user_id_=stu.user_id_
+            WHERE su.del_flag_=0 AND stu.user_id_ IS NOT NULL AND su.organ_id_=#{organId}
+            GROUP BY smcr.user_id_) t WHERE t.days>=5
+    </select>
+
     <update id="updateGrade"><![CDATA[
         UPDATE student SET current_grade_num_=current_grade_num_+1
         WHERE current_grade_num_>=1

+ 34 - 0
mec-web/src/main/java/com/ym/mec/web/controller/education/EduStudentController.java

@@ -0,0 +1,34 @@
+package com.ym.mec.web.controller.education;
+
+import com.ym.mec.biz.dal.dto.StatDto;
+import com.ym.mec.biz.dal.page.StudentQueryInfo;
+import com.ym.mec.biz.service.StudentService;
+import com.ym.mec.common.controller.BaseController;
+import com.ym.mec.common.entity.HttpResponseResult;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+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;
+
+/**
+ * @Author Joburgess
+ * @Date 2021/8/17 0017
+ */
+@RequestMapping("eduStudent")
+@Api(tags = "学生信息服务")
+@RestController
+public class EduStudentController extends BaseController {
+
+    @Autowired
+    private StudentService studentService;
+
+
+    @ApiOperation(value = "云教练学员数据")
+    @GetMapping("/organStudentData")
+    public HttpResponseResult<StatDto> organStudentData(StudentQueryInfo queryInfo){
+        return succeed(studentService.organStudentData(queryInfo));
+    }
+
+}