Browse Source

Merge branch 'feature_HW_20230331' into master_saas

liujunchi 2 năm trước cách đây
mục cha
commit
d8b1cb4a28

+ 3 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/dao/TeacherDao.java

@@ -512,6 +512,9 @@ public interface TeacherDao extends BaseDAO<Integer, Teacher> {
     List<String> queryTeacherMusicIds(Map<String, Object> params);
     int countTeacherMusics(Map<String, Object> params);
 
+    List<String> queryTeacherMusicIdsV2(Map<String, Object> params);
+    int countTeacherMusicsV2(Map<String, Object> params);
+
     int countTeacherBasicInfo(Map<String, Object> params);
 
     List<SysUserDto> queryTeacherBasicInfo(Map<String, Object> params);

+ 4 - 4
mec-biz/src/main/java/com/ym/mec/biz/dal/dto/StudentLessonExaminationDetailDto.java

@@ -32,11 +32,11 @@ public class StudentLessonExaminationDetailDto {
     @ApiModelProperty(value = "练习最高分数")
     private Integer trainingScore;
 
-    @ApiModelProperty(value = "是否练习")
-    private Boolean trainingFlag;
+    @ApiModelProperty(value = "总平均分")
+    private Integer avgScore;
 
-    @ApiModelProperty(value = "合格分数")
-    private Integer score;
+    @ApiModelProperty(value = "实际得分")
+    private Integer actualAvgScore;
 
     @ApiModelProperty(value = "达标总分")
     private Integer standardScore;

+ 2 - 1
mec-biz/src/main/java/com/ym/mec/biz/dal/entity/StudentLessonExamination.java

@@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.annotation.IdType;
 import com.baomidou.mybatisplus.annotation.TableField;
 import com.baomidou.mybatisplus.annotation.TableId;
 import com.ym.mec.common.entity.BaseEntity;
+import com.ym.mec.common.tenant.TenantContextHolder;
 import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
@@ -19,7 +20,7 @@ import java.util.Date;
  */
 @ApiModel(value = "student_lesson_examination-学生进度评测表")
 @Data
-public class StudentLessonExamination extends BaseEntity {
+public class StudentLessonExamination {
     @TableId(value = "id_", type = IdType.AUTO)
     @ApiModelProperty(value = "主键ID")
     private Long id;

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

@@ -252,4 +252,6 @@ public interface TeacherService extends BaseService<Integer, Teacher> {
     * @date 2022/7/15 15:31
     */
     List<BaseMapDto<Integer,String>> queryOrganList(Integer userId);
+
+    PageInfo<TeacherMusicStudentOverViewDto> queryTeacherMusicStudentOverViewV2(TeacherServeQueryInfo queryInfo);
 }

+ 6 - 8
mec-biz/src/main/java/com/ym/mec/biz/service/impl/StudentLessonExaminationServiceImpl.java

@@ -106,19 +106,14 @@ public class StudentLessonExaminationServiceImpl extends ServiceImpl<StudentLess
         }
         StudentLessonExamination studentLessonExamination = this.lambdaQuery().eq(StudentLessonExamination::getLessonExaminationId, lessonExaminationId)
                 .eq(StudentLessonExamination::getUserId, userId).one();
-        studentLessonExamination.setTrainingTime(now);
-        this.updateById(studentLessonExamination);
-        detail.setTrainingTime(now);
-        if(detail.getTrainingTime() == null){
+        if(studentLessonExamination.getTrainingTime() == null){
             //训练人数加一
             lessonExaminationDao.updateTrainingNum(lessonExaminationId);
         }
+        studentLessonExamination.setTrainingTime(now);
+        this.updateById(studentLessonExamination);
         //是否达标
         if(submitDto.getScore() >= detail.getStandardScore()){
-            if(!detail.getStandardFlag()){
-                //达标人数加一
-                lessonExaminationDao.updateStandardNum(lessonExaminationId);
-            }
             detail.setStandardFlag(true);
         }
         //训练分数是否比上一次高
@@ -131,7 +126,10 @@ public class StudentLessonExaminationServiceImpl extends ServiceImpl<StudentLess
             detail.setActualAvgScore(actualScore.intValue() > detail.getAvgScore() ? detail.getAvgScore():actualScore.intValue());
         }
         //更新详情
+        detail.setTrainingTime(now);
         studentLessonExaminationDetailService.updateById(detail);
+        //更新达标人数
+        lessonExaminationDao.updateStandardNum(lessonExaminationId);
         //更新总分
         if(flag){
             baseMapper.updateTrainingScore(lessonExaminationId,userId);

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

@@ -740,6 +740,28 @@ public class TeacherServiceImpl extends BaseServiceImpl<Integer, Teacher> implem
         return pageInfo;
     }
 
+
+    @Override
+    public PageInfo<TeacherMusicStudentOverViewDto> queryTeacherMusicStudentOverViewV2(TeacherServeQueryInfo queryInfo) {
+        PageInfo<TeacherMusicStudentOverViewDto> pageInfo = new PageInfo<>(queryInfo.getPage(), queryInfo.getRows());
+        Map<String, Object> params = new HashMap<String, Object>();
+        MapUtil.populateMap(params, queryInfo);
+
+        List<TeacherMusicStudentOverViewDto> dataList = null;
+        int count = teacherDao.countTeacherMusicsV2(params);
+        if (count > 0) {
+            pageInfo.setTotal(count);
+            params.put("offset", pageInfo.getOffset());
+            List<String> musicGroupIds = teacherDao.queryTeacherMusicIdsV2(params);
+            dataList = musicGroupDao.queryTeacherMusicStudentOverView(musicGroupIds);
+        }
+        if (count == 0) {
+            dataList = new ArrayList<>();
+        }
+        pageInfo.setRows(dataList);
+        return pageInfo;
+    }
+
     @Override
     public PageInfo<SysUserDto> queryTeacherBasicInfo(UserBasicQueryInfo queryInfo) {
         PageInfo<SysUserDto> pageInfo = new PageInfo<>(queryInfo.getPage(), queryInfo.getRows());

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

@@ -4191,7 +4191,7 @@
             limit #{param.offset},#{param.rows}
         </if>
     </select>
-    
+
     <select id="countTeacherServeHomeworkDetailV2" resultType="int">
         SELECT
         count(1)

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

@@ -31,7 +31,13 @@
         UPDATE lesson_examination SET training_num_ = training_num_ + 1 WHERE id_ = #{lessonExaminationId}
     </update>
     <update id="updateStandardNum">
-        UPDATE lesson_examination SET standard_num_ = standard_num_ + 1 WHERE id_ = #{lessonExaminationId}
+        update lesson_examination le
+            left join (
+                select lesson_examination_id_,COUNT(distinct user_id_) num from student_lesson_examination_detail
+                where lesson_examination_id_ = #{lessonExaminationId}
+                group by user_id_ HAVING SUM(actual_avg_score_) >= 60) sle ON sle.lesson_examination_id_ = le.id_
+        set le.standard_num_ = sle.num
+        where le.id_ = #{lessonExaminationId} AND num > 0
     </update>
     <select id="queryPage" resultType="com.ym.mec.biz.dal.dto.LessonExaminationResultDto">
         select le.*,cg.name_ classGroupName

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

@@ -30,7 +30,7 @@
     </insert>
     <select id="queryAll" resultType="com.ym.mec.biz.dal.dto.StudentLessonExaminationDetailDto">
         select sms.name_ musicScoreName,sled.id_ studentLessonExaminationDetailId, sled.user_id_ userId, sled.lesson_examination_id_ lessonExaminationId, sled.music_score_id_ musicScoreId,
-               sled.heard_level_ heardLevel, sled.training_score_ trainingScore,sled.training_flag_ trainingFlag, sled.score_ score,
+               sled.heard_level_ heardLevel, sled.training_score_ trainingScore,sled.avg_score_ avgScore, sled.actual_avg_score_ actualAvgScore,
                sled.standard_score_ standardScore, sled.part_index_ partIndex
         from student_lesson_examination_detail sled
         left join sys_music_score sms ON sms.id_ = sled.music_score_id_

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

@@ -1440,6 +1440,19 @@
         </where>
     </sql>
 
+
+    <sql id="queryTeacherMusicIdsConditionV2">
+        <where>
+            csts.del_flag_=0 AND csts.group_type_='MUSIC' AND mg.del_flag_=0 AND mg.status_='PROGRESS' and csts.tenant_id_ = #{tenantId}
+            <if test="teacherId!=null">
+                AND csts.teacher_id_=#{teacherId}
+            </if>
+            <if test="search!=null and search!=''">
+                AND mg.name_ LIKE CONCAT('%', #{search}, '%')
+            </if>
+        </where>
+    </sql>
+
     <select id="queryTeacherMusicIds" resultType="string">
         SELECT csts.music_group_id_
         FROM course_schedule_teacher_salary csts
@@ -1459,6 +1472,23 @@
         <include refid="queryTeacherMusicIdsCondition"></include>
     </select>
 
+    <select id="queryTeacherMusicIdsV2" resultType="string">
+        SELECT csts.music_group_id_
+        FROM course_schedule csts
+        LEFT JOIN music_group mg ON csts.music_group_id_=mg.id_
+        <include refid="queryTeacherMusicIdsConditionV2"></include>
+        GROUP BY csts.music_group_id_
+        ORDER BY mg.create_time_ DESC, mg.id_
+        <include refid="global.limit"></include>
+    </select>
+
+    <select id="countTeacherMusicsV2" resultType="int">
+        SELECT COUNT(DISTINCT csts.music_group_id_)
+        FROM course_schedule csts
+        LEFT JOIN music_group mg ON csts.music_group_id_=mg.id_
+        <include refid="queryTeacherMusicIdsConditionV2"></include>
+    </select>
+
     <select id="getSimpleUser" resultType="com.ym.mec.biz.dal.dto.SimpleUserDto">
         SELECT
             su.id_ userId,

+ 0 - 1
mec-student/src/main/java/com/ym/mec/student/controller/LessonExaminationController.java

@@ -66,6 +66,5 @@ public class LessonExaminationController extends BaseController {
         query.setUserId(sysUserService.getUserId());
         return succeed(studentLessonExaminationDetailService.queryAll(query));
     }
-
 }
 

+ 8 - 0
mec-teacher/src/main/java/com/ym/mec/teacher/controller/TeacherController.java

@@ -183,4 +183,12 @@ public class TeacherController extends BaseController {
         return succeed(teacherService.queryTeacherMusicStudentOverView(queryInfo));
     }
 
+
+    @ApiOperation(value = "查询教师关联的乐团预览信息")
+    @GetMapping("/queryTeacherMusicStudentOverView/v2")
+    public HttpResponseResult<PageInfo<TeacherMusicStudentOverViewDto>> queryTeacherMusicStudentOverViewV2(TeacherServeQueryInfo queryInfo){
+        queryInfo.setTeacherId(sysUserService.getUserId());
+        return succeed(teacherService.queryTeacherMusicStudentOverViewV2(queryInfo));
+    }
+
 }