Quellcode durchsuchen

Merge branch 'zx_saas_training_202303' of http://git.dayaedu.com/yonge/mec into master_saas

zouxuan vor 2 Jahren
Ursprung
Commit
7c27bbc47b

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

@@ -357,4 +357,6 @@ public interface StudentDao extends com.ym.mec.common.dal.BaseDAO<Integer, Stude
 
     //统计重复购买人数
     List<Map<Integer,Long>> getAgainBuyNum(@Param("organIds") List<Integer> organIds);
+
+    List<Map> getStudentCloudStudySequenceDays(@Param("studentIds") List<Integer> studentIds);
 }

+ 2 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/dao/SysMusicCompareRecordDao.java

@@ -123,4 +123,6 @@ public interface SysMusicCompareRecordDao extends BaseDAO<Long, SysMusicCompareR
     List<TeacherCloudTrainingDto> queryTeacherTrainingList(@Param("queryInfo") TeacherCloudTrainingQueryInfo queryInfo);
     
     int queryTeacherTrainingCount(@Param("queryInfo") TeacherCloudTrainingQueryInfo queryInfo);
+
+    Integer getUserTrainingTime(@Param("userId") Integer userId);
 }

+ 0 - 2
mec-biz/src/main/java/com/ym/mec/biz/dal/dao/TempLittleArtistTrainingCampDao.java

@@ -35,8 +35,6 @@ public interface TempLittleArtistTrainingCampDao extends BaseMapper<TempLittleAr
      */
     <T> IPage<T> queryUserTrainingDetail(Page<T> page, @Param("param") Map<String, Object> param);
 
-    <T> List<T> queryUserTrainingDetail(@Param("param") Map<String, Object> param);
-
     List<ImGroup> queryCampImGroup(String imGroupIds);
 
     Integer queryUserTrainingPlayTime(@Param("param") Map<String, Object> param);

+ 10 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/vo/TempCampUserTrainingDetailVo.java

@@ -28,6 +28,16 @@ public class TempCampUserTrainingDetailVo implements Serializable {
     private String subjectName;
     @ApiModelProperty(value = "乐团")
     private String musicGroupName;
+    @ApiModelProperty(value = "连续打卡天数")
+    private Integer cloudStudySequenceDays;
+
+    public Integer getCloudStudySequenceDays() {
+        return cloudStudySequenceDays;
+    }
+
+    public void setCloudStudySequenceDays(Integer cloudStudySequenceDays) {
+        this.cloudStudySequenceDays = cloudStudySequenceDays;
+    }
 
     public String getSubjectName() {
         return subjectName;

+ 2 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/TempLittleArtistTrainingCampService.java

@@ -125,6 +125,8 @@ public interface TempLittleArtistTrainingCampService extends IService<TempLittle
      * 导出小小训练营想详情
      */
     void exportUserTrainingDetail(Map<String, Object> param, HttpServletResponse response) throws IOException;
+
+    Integer getUserTrainingTime(Integer userId);
 }
 
 

+ 10 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/impl/TempLittleArtistTrainingCampServiceImpl.java

@@ -71,6 +71,8 @@ public class TempLittleArtistTrainingCampServiceImpl extends ServiceImpl<TempLit
     private StudentRegistrationDao studentRegistrationDao;
     @Autowired
     private MusicGroupDao musicGroupDao;
+    @Autowired
+    private SysMusicCompareRecordDao sysMusicCompareRecordDao;
 
     @Override
     public TempLittleArtistTrainingCampDao getDao() {
@@ -289,11 +291,14 @@ public class TempLittleArtistTrainingCampServiceImpl extends ServiceImpl<TempLit
             List<Integer> studentIds = records.stream().map(e -> e.getId()).collect(Collectors.toList());
             Map<Integer,String> subjectMap = MapUtil.convertIntegerMap(studentDao.getStudentSubjectMapList(studentIds));
             Map<Integer,String> groupNameMap = MapUtil.convertMybatisMap(musicGroupDao.queryNormalGroupName(studentIds));
+            List<Map> map = studentDao.getStudentCloudStudySequenceDays(studentIds);
+            Map<Integer, Integer> studyMap = map.stream().collect(Collectors.toMap(e -> Integer.parseInt(e.get("key").toString()), v -> Integer.parseInt(v.get("value").toString())));
             Integer standardDays = Integer.parseInt(param.get("standardDays").toString());
             for (TempCampUserTrainingDetailVo record : records) {
                 record.setSubjectName(subjectMap.get(record.getId()));
                 record.setMusicGroupName(groupNameMap.get(record.getId()));
                 record.setStandardFlag(record.getPlayDay() >= standardDays);
+                record.setCloudStudySequenceDays(studyMap.get(record.getId()));
             }
         }
         return PageUtil.pageInfo(vos);
@@ -606,6 +611,11 @@ public class TempLittleArtistTrainingCampServiceImpl extends ServiceImpl<TempLit
         }
     }
 
+    @Override
+    public Integer getUserTrainingTime(Integer userId) {
+        return sysMusicCompareRecordDao.getUserTrainingTime(userId);
+    }
+
     private SysUser getUser() {
         return Optional.ofNullable(sysUserFeignService.queryUserInfo())
                 .orElseThrow(() -> new BizException("用户信息获取失败,请刷新页面或者重新登录!"));

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

@@ -1263,6 +1263,12 @@
         </if>
         group by mg.organ_id_
     </select>
+    <select id="getStudentCloudStudySequenceDays" resultType="java.util.Map">
+        select user_id_ 'key',cloud_study_sequence_days_ 'value' from student where user_id_ IN
+        <foreach collection="studentIds" open="(" close=")" item="userId">
+            #{userId}
+        </foreach>
+    </select>
     <sql id="queryStudentBasicInfoSql">
         <where>
             AND su.lock_flag_ = 0 AND su.del_flag_ = 0

+ 4 - 0
mec-biz/src/main/resources/config/mybatis/SysMusicCompareRecordMapper.xml

@@ -538,4 +538,8 @@
 		LEFT JOIN `teacher` t on t.`id_` = cr.`user_id_` and cr.`client_id_` = 'teacher'
 		WHERE cr.`client_id_` = 'teacher' and t.`organ_id_` in (${queryInfo.organIdList}) AND date(cr.`create_time_`) BETWEEN #{queryInfo.startTime} and #{queryInfo.endTime} and t.job_nature_ = 'FULL_TIME'
 	</select>
+    <select id="getUserTrainingTime" resultType="java.lang.Integer">
+		select CASE WHEN sum(play_time_) IS NULL THEN 0 ELSE sum(play_time_) END
+		from sys_music_compare_record where user_id_ = #{userId} and DATE_FORMAT(create_time_,'%Y-%m-%d') = DATE_FORMAT(NOW(),'%Y-%m-%d')
+	</select>
 </mapper>

+ 11 - 0
mec-student/src/main/java/com/ym/mec/student/controller/TempLittleArtistTrainingCampController.java

@@ -1,5 +1,7 @@
 package com.ym.mec.student.controller;
 
+import com.ym.mec.auth.api.client.SysUserFeignService;
+import com.ym.mec.auth.api.entity.SysUser;
 import com.ym.mec.biz.dal.entity.TempLittleArtistTrainingCamp;
 import com.ym.mec.biz.dal.vo.*;
 import com.ym.mec.biz.service.TempLittleArtistTrainingCampService;
@@ -31,6 +33,8 @@ public class TempLittleArtistTrainingCampController extends BaseController {
     private TempLittleArtistTrainingCampService tempLittleArtistTrainingCampService;
     @Resource
     private TempLittleArtistTrainingCampUserRelationService tempLittleArtistTrainingCampUserRelationService;
+    @Resource
+    private SysUserFeignService sysUserFeignService;
 
     @ApiImplicitParams({
             @ApiImplicitParam(name = "name", dataType = "String", value = "训练营标题-模糊搜索"),
@@ -58,6 +62,13 @@ public class TempLittleArtistTrainingCampController extends BaseController {
         return succeed(tempLittleArtistTrainingCampService.queryUserTrainingTime(param));
     }
 
+    @ApiOperation("查询指定学生-训练营每日训练时长")
+    @PostMapping(value = "/getUserTrainingTime")
+    public HttpResponseResult<Integer> getUserTrainingTime() {
+        SysUser sysUser = sysUserFeignService.queryUserInfo();
+        return succeed(tempLittleArtistTrainingCampService.getUserTrainingTime(sysUser.getId()));
+    }
+
     @ApiImplicitParams({
             @ApiImplicitParam(name = "search", dataType = "String", value = "学员姓名/手机号/编号-模糊搜索"),
             @ApiImplicitParam(name = "imGroupId", dataType = "Integer", value = "所在群组Id"),