فهرست منبع

Merge branch 'feature/1106_homework' into dev

刘俊驰 6 ماه پیش
والد
کامیت
fb8c2d0643

+ 13 - 0
mec-application/src/main/java/com/ym/mec/student/controller/SysConfigController.java

@@ -3,11 +3,13 @@ package com.ym.mec.student.controller;
 import com.ym.mec.biz.dal.entity.SysConfig;
 import com.ym.mec.biz.service.SysConfigService;
 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.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
 
@@ -43,4 +45,15 @@ public class SysConfigController extends BaseController {
 		}
 		return succeed(sysConfigService.findByParamName(paramName));
 	}
+
+
+
+    @ApiOperation(value = "查询参数(多个逗号分隔)")
+    @PostMapping(value = "queryByParamNames")
+    public HttpResponseResult<List<SysConfig>> queryByParamNames(String paramName) {
+        if(StringUtils.isBlank(paramName)){
+            return failed("参数不能为空");
+        }
+        return succeed(sysConfigService.findByParamNames(paramName));
+    }
 }

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

@@ -135,6 +135,8 @@ public class StudentLessonTrainingDetailWrapper {
         @ApiModelProperty("作业描述")
         private String desc;
 
+        private String fileJsons;
+
         @ApiModelProperty("上传文件JSON")
         private List<CourseHomeworkWrapper.FileJson> fileJson;
 

+ 3 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/StudentCourseHomeworkService.java

@@ -10,6 +10,7 @@ import com.ym.mec.common.page.PageInfo;
 import com.ym.mec.common.page.QueryInfo;
 import com.ym.mec.common.service.BaseService;
 
+import java.util.Date;
 import java.util.List;
 import java.util.Map;
 
@@ -118,6 +119,8 @@ public interface StudentCourseHomeworkService extends BaseService<Long, StudentC
 
     List<StudentCourseHomework> findStudentCourseHomeworkByCourseV2(StudentLessonTrainingDetailWrapper.StudentLessonTrainingQuery query);
 
+    void studentLessonTrainingDetailFileJsonFormat(List<StudentLessonTrainingDetailWrapper.StudentLessonTrainingDetail> studentLessonTrainingDetails, Date expireDate, Integer fileExpireDay);
+
     List<StudentCourseHomework> findExtraExerciseStudentsV2(StudentLessonTrainingDetailWrapper.StudentLessonTrainingQuery query);
 
     /**

+ 5 - 26
mec-biz/src/main/java/com/ym/mec/biz/service/impl/CourseHomeworkServiceImpl.java

@@ -19,10 +19,7 @@ import com.ym.mec.biz.dal.enums.MessageTypeEnum;
 import com.ym.mec.biz.dal.enums.YesOrNoEnum;
 import com.ym.mec.biz.dal.page.CourseHomeWorkTemplateQueryInfo;
 import com.ym.mec.biz.dal.page.CourseHomeworkQueryInfo;
-import com.ym.mec.biz.service.CourseHomeworkService;
-import com.ym.mec.biz.service.StudentExtracurricularExercisesSituationService;
-import com.ym.mec.biz.service.StudentLessonTrainingDetailService;
-import com.ym.mec.biz.service.SysMessageService;
+import com.ym.mec.biz.service.*;
 import com.ym.mec.common.dal.BaseDAO;
 import com.ym.mec.common.exception.BizException;
 import com.ym.mec.common.page.PageInfo;
@@ -63,6 +60,9 @@ public class CourseHomeworkServiceImpl extends BaseServiceImpl<Long, CourseHomew
     @Autowired
     private StudentLessonTrainingDetailService studentLessonTrainingDetailService;
 
+    @Autowired
+    private StudentCourseHomeworkService studentCourseHomeworkService;
+
 	@Override
 	public BaseDAO<Long, CourseHomework> getDAO() {
 		return courseHomeworkDao;
@@ -274,17 +274,7 @@ public class CourseHomeworkServiceImpl extends BaseServiceImpl<Long, CourseHomew
         List<CourseHomeworkWrapper.StudentLessonTrainingStat> trainingStatList =  studentLessonTrainingDetailService
                 .getLessonTrainingStat(courseHomeworkList.getCourseHomeworkId(), ELessonTrainingType.HOMEWORK);
 
-        boolean expireFlag = false;
-        if (courseHomeworkList.getFileExpireDay() != null && courseHomeworkList.getFileExpireDay() >0) {
-            expireFlag = DateUtil.addDays(courseHomeworkList.getExpiryDate(), courseHomeworkList.getFileExpireDay()).before(new Date());
-        }
-        for (StudentLessonTrainingDetailWrapper.StudentLessonTrainingDetail studentLessonTrainingDetail : baseLessonTrainingDetail) {
-            if (!CollectionUtils.isEmpty(studentLessonTrainingDetail.getFileJson())) {
-                for (CourseHomeworkWrapper.FileJson fileJson : studentLessonTrainingDetail.getFileJson()) {
-                    fileJson.setExpireFlag(expireFlag);
-                };
-            }
-        }
+        studentCourseHomeworkService.studentLessonTrainingDetailFileJsonFormat(baseLessonTrainingDetail, courseHomeworkList.getExpiryDate(), courseHomeworkList.getFileExpireDay());
 
 
         courseHomeworkList.setTrainingGroupList(trainingStatList);
@@ -326,17 +316,6 @@ public class CourseHomeworkServiceImpl extends BaseServiceImpl<Long, CourseHomew
         List<CourseHomeworkWrapper.StudentLessonTrainingStat> practiceGroupList = studentLessonTrainingDetailService
                 .getLessonTrainingStat(courseHomeworkList.getCourseHomeworkId(),courseHomeworkList.getType());
 
-        boolean expireFlag = false;
-        if (courseHomeworkList.getFileExpireDay() != null && courseHomeworkList.getFileExpireDay() >0) {
-            expireFlag = DateUtil.addDays(courseHomeworkList.getExpiryDate(), courseHomeworkList.getFileExpireDay()).before(new Date());
-        }
-        for (StudentLessonTrainingDetailWrapper.StudentLessonTrainingDetail studentLessonTrainingDetail : baseLessonTrainingDetail) {
-            if (!CollectionUtils.isEmpty(studentLessonTrainingDetail.getFileJson())) {
-                for (CourseHomeworkWrapper.FileJson fileJson : studentLessonTrainingDetail.getFileJson()) {
-                    fileJson.setExpireFlag(expireFlag);
-                }
-            }
-        }
 
         courseHomeworkList.setTrainingGroupList(practiceGroupList);
         courseHomeworkList.setTrainingDetailList(baseLessonTrainingDetail);

+ 69 - 24
mec-biz/src/main/java/com/ym/mec/biz/service/impl/StudentCourseHomeworkServiceImpl.java

@@ -828,6 +828,22 @@ public class StudentCourseHomeworkServiceImpl extends BaseServiceImpl<Long, Stud
         StudentCourseHomework studentCourseHomework = studentCourseHomeworkByCourse.get(0);
         List<StudentLessonTrainingDetailWrapper.StudentLessonTrainingDetail> studentLessonTrainingDetails = studentCourseHomeworkDao
             .findByStudentIdsAndCourseScheduleId(studentIds, studentCourseHomework.getCourseHomeworkId(),studentCourseHomework.getType());
+        Date expireDate = null;
+        Integer fileExpireDay = null;
+        if (studentCourseHomework.getType() == ELessonTrainingType.HOMEWORK) {
+            CourseHomework courseHomework = courseHomeworkDao.get(studentCourseHomework.getCourseHomeworkId());
+            if (courseHomework != null) {
+                expireDate = courseHomework.getExpiryDate();
+                fileExpireDay = courseHomework.getFileExpireDay();
+            }
+        } else {
+            ExtracurricularExercises extracurricularExercises = extracurricularExercisesDao.get(studentCourseHomework.getCourseHomeworkId());
+            if (extracurricularExercises != null) {
+                expireDate = extracurricularExercises.getExpireDate();
+                fileExpireDay = extracurricularExercises.getFileExpireDay();
+            }
+        }
+        studentLessonTrainingDetailFileJsonFormat(studentLessonTrainingDetails,expireDate,fileExpireDay);
 
         if (CollectionUtils.isNotEmpty(studentLessonTrainingDetails)) {
             //设置曲目名称
@@ -851,6 +867,28 @@ public class StudentCourseHomeworkServiceImpl extends BaseServiceImpl<Long, Stud
     }
 
     @Override
+    public void studentLessonTrainingDetailFileJsonFormat(List<StudentLessonTrainingDetailWrapper.StudentLessonTrainingDetail> studentLessonTrainingDetails, Date expireDate, Integer fileExpireDay) {
+
+
+        boolean expireFlag = false;
+        if (fileExpireDay != null && fileExpireDay >0 && expireDate != null) {
+            expireFlag = DateUtil.addDays(expireDate, fileExpireDay).before(new Date());
+        }
+        for (StudentLessonTrainingDetailWrapper.StudentLessonTrainingDetail studentLessonTrainingDetail : studentLessonTrainingDetails) {
+            if (StringUtils.isNotBlank(studentLessonTrainingDetail.getFileJsons())) {
+                List<CourseHomeworkWrapper.FileJson> fileJsons = JSON.parseArray(studentLessonTrainingDetail.getFileJsons(), CourseHomeworkWrapper.FileJson.class);
+                studentLessonTrainingDetail.setFileJson(fileJsons);
+            }
+            if (!CollectionUtils.isEmpty(studentLessonTrainingDetail.getFileJson())) {
+                for (CourseHomeworkWrapper.FileJson fileJson : studentLessonTrainingDetail.getFileJson()) {
+                    fileJson.setExpireFlag(expireFlag);
+                }
+            }
+        }
+
+    }
+
+    @Override
     public List<StudentCourseHomework> findExtraExerciseStudentsV2(StudentLessonTrainingDetailWrapper.StudentLessonTrainingQuery query) {
         List<StudentCourseHomework> extraExerciseStudents = extracurricularExercisesReplyService.findExtraExerciseStudents(query);
 
@@ -1060,7 +1098,6 @@ public class StudentCourseHomeworkServiceImpl extends BaseServiceImpl<Long, Stud
     @Override
     public StudentLessonTrainingDetailWrapper.StudentLessonTraining findCourseHomeworkStudentDetailPublicV2(Long courseScheduleId, Long userId, ELessonTrainingType type) {
 
-        StudentLessonTrainingDetailWrapper.StudentLessonTraining studentLessonTraining = getUserInfo(userId);
 
         // 作业信息
         CourseHomeworkStudentDetailDto courseHomeworkStudentDetail = studentCourseHomeworkDao.findCourseHomeworkStudentDetail(
@@ -1068,13 +1105,20 @@ public class StudentCourseHomeworkServiceImpl extends BaseServiceImpl<Long, Stud
         if (courseHomeworkStudentDetail == null) {
             throw new BizException("作业不存在");
         }
-        studentLessonTraining.setStandardFlag(courseHomeworkStudentDetail.getStandardFlag());
+        return getStudentLessonTrainingDetails(courseHomeworkStudentDetail.getCourseHomeworkId(), userId, type, courseHomeworkStudentDetail.getStandardFlag());
+
+    }
+
+    private StudentLessonTrainingDetailWrapper.StudentLessonTraining getStudentLessonTrainingDetails(Long homeworkId, Long userId, ELessonTrainingType type, StandardEnum standardFlag) {
+
+        StudentLessonTrainingDetailWrapper.StudentLessonTraining studentLessonTraining = getUserInfo(userId);
+
+        studentLessonTraining.setStandardFlag(standardFlag);
 
         // 作业完成情况
-        if (courseHomeworkStudentDetail.getStandardFlag() == null) {
+        if (standardFlag == null) {
             studentLessonTraining.setFinishFlag(false);
-        } else
-        if( courseHomeworkStudentDetail.getStandardFlag().equals(StandardEnum.STANDARD) || courseHomeworkStudentDetail.getStandardFlag().equals(StandardEnum.EXCELLENT)) {
+        } else if( standardFlag.equals(StandardEnum.STANDARD) || standardFlag.equals(StandardEnum.EXCELLENT)) {
             studentLessonTraining.setFinishFlag(true);
         } else {
             studentLessonTraining.setFinishFlag(false);
@@ -1082,16 +1126,32 @@ public class StudentCourseHomeworkServiceImpl extends BaseServiceImpl<Long, Stud
 
         // 练习内容
         List<StudentLessonTrainingDetailWrapper.StudentLessonTrainingDetail> studentLessonTrainingDetails = studentCourseHomeworkDao
-            .findByStudentIdsAndCourseScheduleId(Collections.singletonList(userId.intValue()), courseHomeworkStudentDetail.getCourseHomeworkId(),type);
+            .findByStudentIdsAndCourseScheduleId(Collections.singletonList(userId.intValue()), homeworkId, type);
+
+
+        Date expireDate = null;
+        Integer fileExpireDay = null;
+        if (type == ELessonTrainingType.HOMEWORK) {
+            CourseHomework courseHomework = courseHomeworkDao.get(homeworkId);
+            if (courseHomework != null) {
+                expireDate = courseHomework.getExpiryDate();
+                fileExpireDay = courseHomework.getFileExpireDay();
+            }
+        } else {
+            ExtracurricularExercises extracurricularExercises = extracurricularExercisesDao.get(homeworkId);
+            if (extracurricularExercises != null) {
+                expireDate = extracurricularExercises.getExpireDate();
+                fileExpireDay = extracurricularExercises.getFileExpireDay();
+            }
+        }
+        studentLessonTrainingDetailFileJsonFormat(studentLessonTrainingDetails,expireDate,fileExpireDay);
 
         studentLessonTraining.setStudentLessonTrainingDetail(studentLessonTrainingDetails);
         return studentLessonTraining;
-
     }
 
     @Override
     public StudentLessonTrainingDetailWrapper.StudentLessonTraining findExtracurricularExercisesDetailPublicV2(Long courseScheduleId, Long userId, ELessonTrainingType type) {
-        StudentLessonTrainingDetailWrapper.StudentLessonTraining studentLessonTraining = getUserInfo(userId);
 
 
         // 作业信息
@@ -1100,23 +1160,8 @@ public class StudentCourseHomeworkServiceImpl extends BaseServiceImpl<Long, Stud
         if (exercisesReply == null) {
             throw new BizException("作业不存在");
         }
-        studentLessonTraining.setStandardFlag(exercisesReply.getStandardFlag());
 
-        // 作业完成情况
-        if (exercisesReply.getStandardFlag() == null) {
-            studentLessonTraining.setFinishFlag(false);
-        } else if( exercisesReply.getStandardFlag().equals(StandardEnum.STANDARD) || exercisesReply.getStandardFlag().equals(StandardEnum.EXCELLENT)) {
-            studentLessonTraining.setFinishFlag(true);
-        } else {
-            studentLessonTraining.setFinishFlag(false);
-        }
-
-        // 练习内容
-        List<StudentLessonTrainingDetailWrapper.StudentLessonTrainingDetail> studentLessonTrainingDetails = studentCourseHomeworkDao
-            .findByStudentIdsAndCourseScheduleId(Collections.singletonList(userId.intValue()), exercisesReply.getExtracurricularExercisesId(),type);
-
-        studentLessonTraining.setStudentLessonTrainingDetail(studentLessonTrainingDetails);
-        return studentLessonTraining;
+        return getStudentLessonTrainingDetails(exercisesReply.getExtracurricularExercisesId(), userId, type, exercisesReply.getStandardFlag());
 
     }
 

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

@@ -696,7 +696,31 @@
 
     <select id="findByStudentIdsAndCourseScheduleId"
             resultType="com.ym.mec.biz.dal.dto.StudentLessonTrainingDetailWrapper$StudentLessonTrainingDetail">
-        SELECT s.*,s2.name_ as subjectName from student_lesson_training_detail s
+        SELECT s.id_,
+               s.user_id_,
+               s.course_homework_id_,
+               s.music_score_id_,
+               s.music_score_name_,
+               s.homework_type_,
+               s.start_,
+               s.end_,
+               s.subject_id_,
+               s.type_,
+               s.group_,
+               s.part_index_,
+               s.training_speed_,
+               s.training_times_,
+               s.training_status_,
+               s.times_,
+               s.memo_,
+               s.create_time_,
+               s.update_time_,
+               s.lesson_courseware_id_,
+               s.desc_,
+               s.file_json_ as fileJsons,
+               s.file_del_flag_,
+               s2.name_ as subjectName
+        from student_lesson_training_detail s
         left join subject s2 on s.subject_id_ = s2.id_
         where s.user_id_ in
         <foreach collection="studentIds" item="studentId" open="(" close=")" separator=",">