Pārlūkot izejas kodu

Merge remote-tracking branch 'origin/master_saas' into master_saas

zouxuan 2 gadi atpakaļ
vecāks
revīzija
844b93991c

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

@@ -1991,4 +1991,6 @@ public interface CourseScheduleDao extends BaseDAO<Long, CourseSchedule> {
      */
     List<CourseHomeworkWrapper.CourseHomeworkList> queryTeacherServeHomeworkDetailV2(@Param(
         "param") Map<String, Object> param, @Param("courseIds") List<Long> courseIds);
+
+    int countTeacherServeHomeworkDetailV2(@Param("param") Map<String, Object> params, @Param("courseIds") List<Long> courseIds);
 }

+ 10 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/dto/StudentLessonTrainingDetailWrapper.java

@@ -36,6 +36,9 @@ public class StudentLessonTrainingDetailWrapper {
 
         @ApiModelProperty("分谱")
         private Integer partIndex;
+
+        @ApiModelProperty("声部")
+        private Integer subjectId;
     }
 
     @Data
@@ -72,6 +75,13 @@ public class StudentLessonTrainingDetailWrapper {
 
         @ApiModelProperty("标准练习次数")
         private Integer times;
+
+
+        @ApiModelProperty("声部id")
+        private Long subjectId;
+
+        @ApiModelProperty("声部名称")
+        private String subjectName;
         
         public String jsonString() {
             return JSON.toJSONString(this);

+ 6 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/entity/StudentLessonTrainingDetail.java

@@ -40,6 +40,12 @@ public class StudentLessonTrainingDetail implements Serializable {
 	@TableField(value = "course_homework_id_")
     private Long courseHomeworkId;
 
+
+    @ApiModelProperty("声部id")
+    @TableField(value = "subject_id_")
+    private Long subjectId;
+
+
     @ApiModelProperty("曲目id") 
 	@TableField(value = "music_score_id_")
     private Long musicScoreId;

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

@@ -2,17 +2,14 @@ package com.ym.mec.biz.service.impl;
 
 import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONObject;
-import com.google.common.collect.Lists;
 import com.ym.mec.biz.dal.dao.*;
 import com.ym.mec.biz.dal.dto.*;
 import com.ym.mec.biz.dal.entity.ClassGroup;
-import com.ym.mec.biz.dal.entity.ClassGroupStudentMapper;
 import com.ym.mec.biz.dal.entity.ExtracurricularExercises;
 import com.ym.mec.biz.dal.entity.ExtracurricularExercisesReply;
 import com.ym.mec.biz.dal.entity.StudentCourseHomework;
 import com.ym.mec.biz.dal.entity.StudentLessonTrainingDetail;
 import com.ym.mec.biz.dal.entity.Teacher;
-import com.ym.mec.biz.dal.enums.ClassGroupStudentStatusEnum;
 import com.ym.mec.biz.dal.enums.ELessonTrainingType;
 import com.ym.mec.biz.dal.enums.ImSendTypeEnum;
 import com.ym.mec.biz.dal.enums.MessageTypeEnum;
@@ -30,9 +27,7 @@ import com.ym.mec.common.service.impl.BaseServiceImpl;
 import com.ym.mec.thirdparty.message.MessageSenderPluginContext;
 import com.ym.mec.util.collection.MapUtil;
 import com.ym.mec.util.date.DateUtil;
-import org.apache.commons.lang3.ObjectUtils;
 import org.apache.commons.lang3.StringUtils;
-import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Isolation;
@@ -92,7 +87,11 @@ public class ExtracurricularExercisesServiceImpl extends BaseServiceImpl<Long, E
 		if(StringUtils.isBlank(exercises.getContent())){
 			// throw new BizException("请填写内容");
 		}
-
+        if (exercises.getMusicGroupId() != null) {
+            exercises.setGroupType(ELessonTrainingType.EXTRACURRICULAR.getCode());
+        } else {
+            exercises.setGroupType(ELessonTrainingType.EXTRA.getCode());
+        }
         List<MusicScoreSubjectDto> scoreSubjectDtoList = exercises.getMusicScoreSubjectDtos();
         if(StringUtils.isBlank(exercises.getStudentIdList())){
             if(scoreSubjectDtoList == null || scoreSubjectDtoList.size() == 0){
@@ -144,6 +143,9 @@ public class ExtracurricularExercisesServiceImpl extends BaseServiceImpl<Long, E
                     studentExtraExercise.setMusicScoreContent(JSONObject.toJSONString(musicScoreSubjectDto.getMusicScoreHomeworkDtoList()));
                     extracurricularExercisesReplies.add(JSON.parseObject(JSON.toJSONString(studentExtraExercise),ExtracurricularExercisesReply.class));
                 }
+                for (StudentLessonTrainingDetailWrapper.AddStudentLessonTrainingDetail studentLessonTrainingDetail : musicScoreSubjectDto.getStudentLessonTrainingDetails()) {
+                    studentLessonTrainingDetail.setSubjectId(musicScoreSubjectDto.getSubjectId());
+                }
                 // 作业详情
                 studentLessonTrainingDetailList.addAll(studentLessonTrainingDetailService
                                    .homeWorkDetail(musicScoreSubjectDto.getStudentLessonTrainingDetails(), musicScoreSubjectDto.getUserIdList(), exercises.getId(),

+ 8 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/impl/StudentExtracurricularExercisesSituationServiceImpl.java

@@ -684,12 +684,17 @@ public class StudentExtracurricularExercisesSituationServiceImpl extends BaseSer
         MapUtil.populateMap(params, queryInfo);
         params.put("versionTag","v2");
 
+         int count = courseScheduleDao.countTeacherServeHomeworkDetailV2(params, courseIds);
+         if (count == 0) {
+             return pageInfo;
+         }
         // 查出课程列表
         List<CourseHomeworkWrapper.CourseHomeworkList> courseHomeworkLists = courseScheduleDao.queryTeacherServeHomeworkDetailV2(
             params, courseIds);
         if (CollectionUtils.isEmpty(courseHomeworkLists)) {
             return pageInfo;
         }
+        pageInfo.setTotal(count);
 
         // 乐团信息
         List<String> musicGroupIds = courseHomeworkLists.stream().map(e -> e.getMusicGroupId()).collect(Collectors.toList());
@@ -729,6 +734,9 @@ public class StudentExtracurricularExercisesSituationServiceImpl extends BaseSer
                 courseHomeworkList.setTeacherName(sysUser.getRealName());
             }
 
+            // 格式时间
+            courseHomeworkList.setStartTime(DateUtil.startDateAndEndTime(courseHomeworkList.getClassDate(), courseHomeworkList.getStartTime()));
+            courseHomeworkList.setEndTime(DateUtil.startDateAndEndTime(courseHomeworkList.getClassDate(), courseHomeworkList.getEndTime()));
 
         }
 

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

@@ -10,7 +10,6 @@ import com.ym.mec.biz.dal.entity.SysMusicScore;
 import com.ym.mec.biz.dal.enums.ELessonTrainingType;
 import com.ym.mec.biz.dal.enums.StandardEnum;
 import com.ym.mec.biz.service.StudentLessonTrainingDetailService;
-import com.ym.mec.biz.service.SysMusicScoreService;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;

+ 3 - 2
mec-biz/src/main/java/com/ym/mec/biz/service/impl/TeacherAttendanceServiceImpl.java

@@ -20,7 +20,6 @@ import com.ym.mec.common.service.impl.BaseServiceImpl;
 import com.ym.mec.common.tenant.TenantContextHolder;
 import com.ym.mec.thirdparty.message.MessageSenderPluginContext;
 import com.ym.mec.thirdparty.message.MessageSenderPluginContext.MessageSender;
-import com.ym.mec.thirdparty.yqpay.DateUtils;
 import com.ym.mec.util.collection.MapUtil;
 import com.ym.mec.util.date.DateUtil;
 import org.apache.commons.lang3.StringUtils;
@@ -372,7 +371,9 @@ public class TeacherAttendanceServiceImpl extends BaseServiceImpl<Long, TeacherA
                                              JSONObject.toJSONString(scoreSubjectDto.getMusicScoreHomeworkDtoList()),
                                              userIdList));
 
-
+                            for (StudentLessonTrainingDetailWrapper.AddStudentLessonTrainingDetail studentLessonTrainingDetail : scoreSubjectDto.getStudentLessonTrainingDetails()) {
+                                studentLessonTrainingDetail.setSubjectId(scoreSubjectDto.getSubjectId());
+                            }
                             studentLessonTrainingDetails.addAll(studentLessonTrainingDetailService
                                                                     .homeWorkDetail(scoreSubjectDto.getStudentLessonTrainingDetails(), userIdList,courseHomework.getId(),ELessonTrainingType.HOMEWORK));
 

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

@@ -4182,9 +4182,55 @@
             <if test="param.versionTag !=null">
                 and ch.version_tag_ = #{param.versionTag}
             </if>
+
+            <if test="param.teacherId != null">
+                and cs.teacher_id_ = #{param.teacherId}
+            </if>
         </where>
         <if test="param.offset != null">
             limit #{param.offset},#{param.rows}
         </if>
     </select>
+    
+    <select id="countTeacherServeHomeworkDetailV2" resultType="int">
+        SELECT
+        count(1)
+        from course_schedule cs
+        left join course_homework ch on cs.id_ = ch.course_schedule_id_
+
+        <where>
+            <if test="param.teacherId != null">
+                and cs.teacher_id_ = #{param.teacherId}
+            </if>
+            <if test="param.musicGroupId != null">
+                and #{param.musicGroupId} = cs.music_group_id_
+            </if>
+            <if test="param.classType != null">
+                and cs.type_ = #{param.classType}
+            </if>
+            <if test="param.homeWorkStatus != null">
+                <if test="param.homeWorkStatus.code == 'UNASSIGNED'">
+                    and ch.id_ is null
+                </if>
+                <if test="param.homeWorkStatus.code == 'ASSIGNED'">
+                    and ch.id_ is not null
+                </if>
+                <if test="param.homeWorkStatus.code == 'DEADLINE'">
+                    and ch.id_ is not null and ch.expiry_date_ &lt; now()
+                </if>
+            </if>
+            <if test="courseIds != null and courseIds.size() != 0">
+                and cs.id_ in
+                <foreach collection="courseIds" item="courseId" open="(" separator="," close=")">
+                    #{courseId}
+                </foreach>
+            </if>
+            <if test="param.courseScheduleId != null">
+                and cs.id_ = #{param.courseScheduleId}
+            </if>
+            <if test="param.versionTag !=null">
+                and ch.version_tag_ = #{param.versionTag}
+            </if>
+        </where>
+    </select>
 </mapper>

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

@@ -96,9 +96,9 @@
 	<!-- 向数据库增加一条记录 -->
 	<insert id="insert" parameterType="com.ym.mec.biz.dal.entity.ExtracurricularExercises" useGeneratedKeys="true" keyColumn="id" keyProperty="id">
 		INSERT INTO extracurricular_exercises (music_group_id_,teacher_id_,student_id_list_,batch_no_,
-		                                       title_,attachments_,content_,expire_date_,completed_num_,expect_num_,create_time_,update_time_,tenant_id_)
+		                                       title_,attachments_,content_,expire_date_,completed_num_,expect_num_,create_time_,update_time_,tenant_id_,group_type_)
 		VALUES(#{musicGroupId},#{teacherId},#{studentIdList},#{batchNo},#{title},#{attachments},
-		       #{content},#{expireDate},#{completedNum},#{expectNum},NOW(), NOW(),#{tenantId})
+		       #{content},#{expireDate},#{completedNum},#{expectNum},NOW(), NOW(),#{tenantId},#{groupType})
 	</insert>
 	
 	<!-- 根据主键查询一条记录 -->
@@ -160,7 +160,7 @@
 		LEFT JOIN extracurricular_exercises_reply eer ON ee.id_ = eer.extracurricular_exercises_id_
 		<include refid="queryPageCondition"/>
 		GROUP BY ee.id_
-		ORDER BY id_ <include refid="global.limit"/>
+		ORDER BY id_ desc <include refid="global.limit"/>
 	</select>
 	
 	<!-- 查询当前表的总记录数 -->
@@ -349,9 +349,9 @@
             <if test="homeWorkStatus.code == 'DEADLINE'">
                 AND expire_date_ &lt; NOW()
             </if>
-            <if test="courseScheduleId != null">
-                AND id_ = #{courseScheduleId}
-            </if>
+        </if>
+        <if test="courseScheduleId != null">
+            AND id_ = #{courseScheduleId}
         </if>
         <if test="type != null">
             and group_type_ = #{type}

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

@@ -691,8 +691,9 @@
 
     <select id="findByStudentIdsAndCourseScheduleId"
             resultType="com.ym.mec.biz.dal.dto.StudentLessonTrainingDetailWrapper$StudentLessonTrainingDetail">
-        SELECT s.*,sms.name_ as musicScoreName from student_lesson_training_detail s
+        SELECT s.*,sms.name_ as musicScoreName,s2.name_ as subjectName from student_lesson_training_detail s
         left join sys_music_score sms on s.music_score_id_ = sms.id_
+        left join subject s2 on s.subject_id_ = s2.id_
         where s.user_id_ in
         <foreach collection="studentIds" item="studentId" open="(" close=")" separator=",">
             #{studentId}

+ 0 - 1
mec-teacher/src/main/java/com/ym/mec/teacher/controller/ExtracurricularExercisesController.java

@@ -137,7 +137,6 @@ public class ExtracurricularExercisesController extends BaseController {
             exercises.setExpireDate(instance.getTime());
         }
 
-        exercises.setGroupType(ELessonTrainingType.EXTRA.getCode());
         exercises.setTeacherId(sysUser.getId());
         extracurricularExercisesService.createExtraExercises(exercises);
         return succeed();

+ 9 - 1
mec-util/src/main/java/com/ym/mec/util/date/DateUtil.java

@@ -1236,7 +1236,15 @@ public class DateUtil {
 		return false;
 	}
 
-	/**
+    public static Date startDateAndEndTime(Date date1, Date date2) {
+        String format1 = format(date1, "yyyy-MM-dd");
+        String format2 = format(date2, "HH:mm:ss");
+
+        return toDateTime(format1 + " " + format2);
+
+    }
+
+    /**
 	 * @describe 时间区段辅助类
 	 * @author Joburgess
 	 * @date 2019/10/27