Procházet zdrojové kódy

Merge remote-tracking branch 'origin/master'

zouxuan před 4 roky
rodič
revize
7ef5cf50b9

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

@@ -270,7 +270,7 @@ public interface StudentDao extends com.ym.mec.common.dal.BaseDAO<Integer, Stude
     List<Map<Integer, Integer>> getOrganTeacherStudentNum(@Param("teacherIds") List<Integer> teacherIds,
                                                           @Param("organId") Integer organId);
 
-    int getOrganOrganTeacherStudentNum(@Param("organId") Integer organId);
+    int getOrganNoTeacherStudentNum(@Param("organId") Integer organId);
 
     /**
      * @describe 统计云教练试用人数

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

@@ -46,6 +46,9 @@ public class EduOrganStudentListDto {
     @ApiModelProperty("连续天数")
     private int cloudStudyRunningDays;
 
+    @ApiModelProperty("使用天数")
+    private int cloudStudyUseDays;
+
     @ApiModelProperty("会员有效期")
     private String membershipEndTime;
 
@@ -152,4 +155,12 @@ public class EduOrganStudentListDto {
     public void setMembershipEndTime(String membershipEndTime) {
         this.membershipEndTime = membershipEndTime;
     }
+
+    public int getCloudStudyUseDays() {
+        return cloudStudyUseDays;
+    }
+
+    public void setCloudStudyUseDays(int cloudStudyUseDays) {
+        this.cloudStudyUseDays = cloudStudyUseDays;
+    }
 }

+ 8 - 5
mec-biz/src/main/java/com/ym/mec/biz/service/impl/IndexBaseMonthDataServiceImpl.java

@@ -11,9 +11,7 @@ import com.ym.mec.biz.dal.enums.*;
 import com.ym.mec.biz.dal.page.IndexDataQueryInfo;
 import com.ym.mec.biz.dal.page.OrganCloudStudyStudentDataQueryInfo;
 import com.ym.mec.biz.dal.page.OrganizationQueryInfo;
-import com.ym.mec.biz.service.EmployeeService;
-import com.ym.mec.biz.service.StudentExtracurricularExercisesSituationService;
-import com.ym.mec.biz.service.SysConfigService;
+import com.ym.mec.biz.service.*;
 import com.ym.mec.common.constant.CommonConstants;
 import com.ym.mec.common.dal.BaseDAO;
 import com.ym.mec.common.exception.BizException;
@@ -23,7 +21,6 @@ import com.ym.mec.util.collection.MapUtil;
 import com.ym.mec.util.date.DateUtil;
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
-import com.ym.mec.biz.service.IndexBaseMonthDataService;
 import org.springframework.http.HttpStatus;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
@@ -104,6 +101,9 @@ public class IndexBaseMonthDataServiceImpl extends BaseServiceImpl<Long, IndexBa
 		if(StringUtils.isNotBlank(queryInfo.getOrganId())){
 			organIds = Arrays.stream(queryInfo.getOrganId().split(",")).map(Integer::new).collect(Collectors.toSet());
 		}
+		if("MEMBER_STUDENT_NUM,CLOUD_STUDY_LIVELY_STUDENT_NUM,CLOUD_STUDY_DAY_USE_STUDENT_NUM,CLOUD_STUDY_NEW_STUDENT_NUM".equals(queryInfo.getDataTypes())){
+			organIds = organIds.stream().filter(id -> !OrganizationService.EXCLUDE_ORGAN_IDS.contains(id)).collect(Collectors.toSet());
+		}
 		Set<String> dataTypes = new HashSet<>();
 		if(StringUtils.isNotBlank(queryInfo.getDataTypes())){
 			dataTypes = Arrays.stream(queryInfo.getDataTypes().split(",")).collect(Collectors.toSet());
@@ -537,7 +537,7 @@ public class IndexBaseMonthDataServiceImpl extends BaseServiceImpl<Long, IndexBa
 
 		//云教练新增人数
 		if(CollectionUtils.isEmpty(dataTypes)||dataTypes.contains(IndexDataType.CLOUD_STUDY_NEW_STUDENT_NUM)) {
-			saveData(indexBaseMonthDataDao.getCloudStudyLivelyStudentNumData(dayStr), dayStr, IndexDataType.CLOUD_STUDY_NEW_STUDENT_NUM);
+			saveData(indexBaseMonthDataDao.getCloudStudyNewStudentNumData(dayStr), dayStr, IndexDataType.CLOUD_STUDY_NEW_STUDENT_NUM);
 		}
 
 	}
@@ -1287,6 +1287,9 @@ public class IndexBaseMonthDataServiceImpl extends BaseServiceImpl<Long, IndexBa
 			if(organStudentVipData.getCloudStudyUseStudentNum()>0&&organStudentVipData.getTotalStudentNum()>0){
 				organStudentVipData.setCloudStudyUseStudentDuty(new BigDecimal(organStudentVipData.getCloudStudyUseStudentNum()).divide(new BigDecimal(organStudentVipData.getTotalStudentNum()), 4, BigDecimal.ROUND_DOWN).multiply(new BigDecimal(100)).floatValue());
 			}
+			if(organStudentVipData.getVipStudentNum()>0&&organStudentVipData.getTotalStudentNum()>0){
+				organStudentVipData.setVipStudentDuty(new BigDecimal(organStudentVipData.getVipStudentNum()).divide(new BigDecimal(organStudentVipData.getTotalStudentNum()), 4, BigDecimal.ROUND_DOWN).multiply(new BigDecimal(100)).floatValue());
+			}
 			result.add(organStudentVipData);
 		}
 

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

@@ -57,7 +57,7 @@ public class SoundCompareHandler implements WebSocketEventHandler {
 
     private BigDecimal oneHundred = new BigDecimal(100);
 
-    private final String tmpDir = FileUtils.getTempDirectoryPath() + "/soundCompare/";
+    private final String tmpDir = "/mdata/soundCompare/";
     /**
      * @describe 用户对应评分信息
      */

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

@@ -827,7 +827,7 @@ public class TeacherServiceImpl extends BaseServiceImpl<Integer, Teacher>  imple
 				}
 			}
 		}
-		pageInfo.setStatInfo(new HashMap<String, Object>(){{put("noTeacherStudentNum", studentDao.getOrganOrganTeacherStudentNum(Integer.valueOf(queryInfo.getOrganId())));}});
+		pageInfo.setStatInfo(new HashMap<String, Object>(){{put("noTeacherStudentNum", studentDao.getOrganNoTeacherStudentNum(Integer.valueOf(queryInfo.getOrganId())));}});
 		pageInfo.setRows(dataList);
 		return pageInfo;
 	}

+ 5 - 18
mec-biz/src/main/resources/config/mybatis/StudentMapper.xml

@@ -894,24 +894,10 @@
         GROUP BY stu.teacher_id_
     </select>
 
-    <select id="getOrganOrganTeacherStudentNum" resultType="int">
-        SELECT COUNT(DISTINCT t.user_id_)
-        FROM ((SELECT sr.user_id_
-        FROM student_registration sr
-        LEFT JOIN music_group mg ON sr.music_group_id_=mg.id_
-        WHERE mg.status_='PROGRESS' AND sr.music_group_status_='NORMAL')
-        UNION ALL
-        (SELECT
-        cssp.user_id_
-        FROM
-        course_schedule_student_payment cssp
-        LEFT JOIN course_schedule cs ON cssp.course_schedule_id_=cs.id_
-        WHERE
-        cssp.group_type_ IN ('VIP', 'PRACTICE')
-        AND cs.status_='NOT_START')) t
-        LEFT JOIN student stu ON t.user_id_=stu.user_id_
-        LEFT JOIN sys_user su ON t.user_id_ = su.id_
-        LEFT JOIN teacher tea ON stu.teacher_id_=tea.id_
+    <select id="getOrganNoTeacherStudentNum" resultType="int">
+        SELECT COUNT(DISTINCT stu.user_id_)
+        FROM student stu
+        LEFT JOIN sys_user su ON stu.user_id_ = su.id_
         WHERE su.del_flag_=0 AND stu.teacher_id_ IS NULL
         <if test="organId!=null">
             AND su.organ_id_=#{organId}
@@ -1070,6 +1056,7 @@
             stu.cloud_study_sequence_days_ cloudStudyRunningDays,
             COUNT(DISTINCT smcr.behavior_id_) cloudStudyUseNum,
             SUM(CASE WHEN smcr.play_time_ IS NULL THEN 0 ELSE play_time_ END) cloudStudyUseTime,
+            COUNT(DISTINCT DATE(smcr.create_time_)) cloudStudyUseDays,
             stu.membership_end_time_ membershipEndTime
         FROM student stu
             LEFT JOIN sys_user su ON stu.user_id_=su.id_

+ 1 - 1
mec-biz/src/main/resources/config/mybatis/TeacherMapper.xml

@@ -1397,7 +1397,7 @@
 
     <sql id="queryMemberStudentDataCondition">
         <where>
-            su.del_flag_=0
+            su.del_flag_=0 AND su.lock_flag_=0
             <if test="organId!=null and organId!=''">
                 AND tea.organ_id_ = #{organId}
             </if>

+ 57 - 7
mec-web/src/main/java/com/ym/mec/web/controller/ExportController.java

@@ -3123,9 +3123,9 @@ public class ExportController extends BaseController {
         }
         OutputStream outputStream = response.getOutputStream();
         try {
-            String[] header = {"老师编号", "老师姓名", "学员总数", "付费学员数量",
-                    "试用会员", "会员占比"};
-            String[] body = {"teacherId", "teacherName", "totalStudentNum", "vipStudentNum", "eVipStudentNum", "vipStudentDuty+\"%\""};
+            String[] header = {"老师编号", "老师姓名", "学员总数", "使用人数", "使用人数比", "付费学员数量", "会员占比"};
+            String[] body = {"teacherId", "teacherName", "totalStudentNum", "cloudStudyUseStudentNum", "cloudStudyUseStudentDuty+\"%\"",
+                    "vipStudentNum", "vipStudentDuty+\"%\""};
             HSSFWorkbook workbook = POIUtil.exportExcel(header, body, rows);
             response.setContentType("application/octet-stream");
             response.setHeader("Content-Disposition", "attachment;filename=employeeInfo-" + DateUtil.getDate(new Date()) + ".xls");
@@ -3176,8 +3176,9 @@ public class ExportController extends BaseController {
         }
         OutputStream outputStream = response.getOutputStream();
         try {
-            String[] header = {"分部", "学员总数", "付费会员数量","会员占比"};
-            String[] body = {"organName", "totalStudentNum", "vipStudentNum", "vipStudentDuty+\"%\""};
+            String[] header = {"分部", "学员总数", "活跃人数", "使用人数", "新增使用人数", "使用比例", "付费会员数", "付费会员占比"};
+            String[] body = {"organName", "totalStudentNum", "cloudStudyLivelyStudentNum", "cloudStudyUseStudentNum", "newCloudStudyStudentNum",
+                    "cloudStudyUseStudentDuty+\"%\"", "vipStudentNum", "vipStudentDuty+\"%\""};
             HSSFWorkbook workbook = POIUtil.exportExcel(header, body, rows);
             response.setContentType("application/octet-stream");
             response.setHeader("Content-Disposition", "attachment;filename=employeeInfo-" + DateUtil.getDate(new Date()) + ".xls");
@@ -3228,9 +3229,58 @@ public class ExportController extends BaseController {
         }
         OutputStream outputStream = response.getOutputStream();
         try {
-            String[] header = {"排名", "分部", "学员总数", "活跃人数", "活跃人数比", "使用人数", "使用人数占比", "付费会员数量","付费会员占比", "新增付费会员"};
+            String[] header = {"排名", "分部", "学员总数", "活跃人数", "活跃人数比", "当日使用人数", "当日新增使用人数", "使用人数占比", "付费会员数量","付费会员占比", "新增付费会员"};
             String[] body = {"index", "organName", "totalStudentNum", "cloudStudyLivelyStudentNum", "cloudStudyLivelyStudentDuty+\"%\"",
-                    "cloudStudyUseStudentNum", "cloudStudyUseStudentDuty+\"%\"", "vipStudentNum", "vipStudentDuty+\"%\"", "newCloudStudyStudentNum"};
+                    "cloudStudyUseStudentNum", "newCloudStudyStudentNum", "cloudStudyUseStudentDuty+\"%\"", "vipStudentNum", "vipStudentDuty+\"%\"", "newCloudStudyStudentNum"};
+            HSSFWorkbook workbook = POIUtil.exportExcel(header, body, rows);
+            response.setContentType("application/octet-stream");
+            response.setHeader("Content-Disposition", "attachment;filename=employeeInfo-" + DateUtil.getDate(new Date()) + ".xls");
+            response.flushBuffer();
+            outputStream = response.getOutputStream();
+            workbook.write(outputStream);
+            outputStream.flush();
+        } catch (Exception e) {
+            e.printStackTrace();
+        } finally {
+            if (outputStream != null) {
+                try {
+                    outputStream.close();
+                } catch (IOException e) {
+                    e.printStackTrace();
+                }
+            }
+        }
+    }
+
+    @ApiOperation(value = "分部云教练学员训练数据导出")
+    @RequestMapping("export/cloudStudyStudentTrainData")
+    @PreAuthorize("@pcs.hasPermissions('export/cloudStudyStudentTrainData')")
+    public void cloudStudyStudentTrainData(StudentQueryInfo queryInfo,HttpServletResponse response) throws IOException {
+        SysUser sysUser = sysUserFeignService.queryUserInfo();
+        if (sysUser == null) {
+            throw new BizException("用户信息获取失败");
+        }
+        queryInfo.setPage(1);
+        queryInfo.setRows(49999);
+
+        List<EduOrganStudentListDto> rows = ((PageInfo<EduOrganStudentListDto>)studentService.organStudentData(queryInfo).getDetail()).getRows();
+        if (CollectionUtils.isEmpty(rows)) {
+            response.setStatus(200);
+            response.setContentType("Content-Type: application/json;charset=UTF-8");
+            response.getOutputStream().write("{\"data\": null, \"code\": 500, \"status\": false, \"msg\": \"没有可导出的记录\"}".getBytes());
+            response.flushBuffer();
+            return;
+        }
+        for (EduOrganStudentListDto row : rows) {
+            row.setCloudStudyUseTime(Math.round(row.getCloudStudyUseTime()));
+            row.setCloudStudyUseAvgTime(Math.round(row.getCloudStudyUseAvgTime()));
+        }
+        OutputStream outputStream = response.getOutputStream();
+        try {
+            String[] header = {"学员编号", "学员", "训练总时长", "连续训练天数", "乐团", "指导老师", "声部", "是否有小课", "训练次数", "训练天数", "训练平均时长", "会员有效期"};
+            String[] body = {"studentId", "studentName", "cloudStudyUseTime+\"分钟\"", "cloudStudyRunningDays+\"天\"", "musicGroupNames",
+                            "teacherName", "subjectName", "hasVipGroup>0?\"是\":\"否\"", "cloudStudyUseNum+\"次\"", "cloudStudyUseDays+\"天\"",
+                            "cloudStudyUseAvgTime+\"分钟\"", "membershipEndTime"};
             HSSFWorkbook workbook = POIUtil.exportExcel(header, body, rows);
             response.setContentType("application/octet-stream");
             response.setHeader("Content-Disposition", "attachment;filename=employeeInfo-" + DateUtil.getDate(new Date()) + ".xls");