yonge 3 years ago
parent
commit
3bfa6050c8

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

@@ -1248,7 +1248,7 @@ public interface CourseScheduleDao extends BaseDAO<Long, CourseSchedule> {
      * @author Joburgess
      * @date 2020/2/4
      */
-    List<CourseSchedule> findStudentCoursesWithIncludeDateRange(@Param("userId") Integer userId,
+    List<CourseSchedule> findStudentCoursesWithIncludeDateRange(@Param("userId") Integer userId,@Param("groupType") GroupType groupType,
                                                                 @Param("startTime") Date startTime,
                                                                 @Param("endTime") Date endTime);
 

+ 27 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/dto/CourseSchedulePlanDto.java

@@ -0,0 +1,27 @@
+package com.ym.mec.biz.dal.dto;
+
+import com.ym.mec.biz.dal.entity.CourseSchedule;
+import com.ym.mec.biz.dal.entity.MusicGroupTrainPlan;
+
+public class CourseSchedulePlanDto {
+
+	private CourseSchedule courseSchedule;
+	
+	private MusicGroupTrainPlan musicGroupTrainPlan;
+
+	public CourseSchedule getCourseSchedule() {
+		return courseSchedule;
+	}
+
+	public void setCourseSchedule(CourseSchedule courseSchedule) {
+		this.courseSchedule = courseSchedule;
+	}
+
+	public MusicGroupTrainPlan getMusicGroupTrainPlan() {
+		return musicGroupTrainPlan;
+	}
+
+	public void setMusicGroupTrainPlan(MusicGroupTrainPlan musicGroupTrainPlan) {
+		this.musicGroupTrainPlan = musicGroupTrainPlan;
+	}
+}

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

@@ -651,4 +651,6 @@ public interface CourseScheduleService extends BaseService<Long, CourseSchedule>
 	* @date 2022/1/5 15:52
 	*/
 	void checkOnlineCategory(List<CourseSchedule> courseSchedules,TeachModeEnum teachMode);
+	
+	Object queryMusicCoursePlan(Integer userId, Date startDate, Date endDate);
 }

+ 26 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/impl/CourseScheduleServiceImpl.java

@@ -27,6 +27,7 @@ import com.ym.mec.common.controller.BaseController;
 import com.ym.mec.common.entity.HttpResponseResult;
 import com.ym.mec.common.page.WrapperUtil;
 import com.ym.mec.common.tenant.TenantContextHolder;
+
 import org.apache.commons.collections.ListUtils;
 import org.apache.commons.lang3.StringUtils;
 import org.codehaus.jackson.map.util.BeanUtil;
@@ -5714,4 +5715,29 @@ public class CourseScheduleServiceImpl extends BaseServiceImpl<Long, CourseSched
 			checkMaxStudentNum(courseSchedules);
 		}
 	}
+
+	@Override
+	public Object queryMusicCoursePlan(Integer userId, Date startDate, Date endDate) {
+		
+		List<CourseSchedule> courseScheduleList = courseScheduleDao.findStudentCoursesWithIncludeDateRange(userId, GroupType.MUSIC, startDate, endDate);
+		
+		List<CourseSchedulePlanDto> result = new ArrayList<CourseSchedulePlanDto>();
+		
+		for(CourseSchedule courseSchedule : courseScheduleList){
+			CourseSchedulePlanDto dto = new CourseSchedulePlanDto();
+			dto.setCourseSchedule(courseSchedule);
+			
+			//获取课程规划
+			MusicGroupTrainPlanSaveDto schoolTerm = musicGroupTrainPlanService.getSchoolTerm(courseSchedule);
+			int courseNumNo = courseScheduleDao.getCourseNumNo(schoolTerm);
+			List<MusicGroupTrainPlan> planList = musicGroupTrainPlanService.queryPlan(schoolTerm);
+			if(planList.size() >= courseNumNo){
+				dto.setMusicGroupTrainPlan(planList.get(courseNumNo - 1));
+			}
+			
+			result.add(dto);
+		}
+		
+		return result;
+	}
 }

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

@@ -2655,6 +2655,9 @@
                  LEFT JOIN class_group cg ON cg.id_ = csts.class_group_id_
         WHERE (cs.del_flag_ != 1 OR cs.del_flag_ IS NULL)
           AND csts.user_id_ = #{userId}
+          <if test="groupType != null">
+          	and csts.group_type_ = #{groupType, typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler}
+          </if>
           AND #{startTime} &lt; CONCAT(cs.class_date_, ' ', cs.end_class_time_)
           AND #{endTime} &gt; CONCAT(cs.class_date_, ' ', cs.start_class_time_)
     </select>
@@ -2684,6 +2687,9 @@
                  LEFT JOIN course_schedule cs ON cssp.course_schedule_id_ = cs.id_
         WHERE (cs.del_flag_ != 1 OR cs.del_flag_ IS NULL)
           AND cssp.user_id_ = #{userId}
+          <if test="groupType != null">
+          	and csts.group_type_ = #{groupType, typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler}
+          </if>
           AND #{startTime} &lt; CONCAT(cs.class_date_, ' ', cs.end_class_time_)
           AND #{endTime} &gt; CONCAT(cs.class_date_, ' ', cs.start_class_time_);
     </select>

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

@@ -208,9 +208,9 @@
 			<if test="parentId != null">
 				AND sesc.parent_id_ = #{parentId}
 			</if>
-			<if test="organId != null and organId != ''">
+			<!-- <if test="organId != null and organId != ''">
 				AND INTE_ARRAY(#{organId},sesc.organ_id_)
-			</if>
+			</if> -->
 			<if test="search != null and search != ''">
 				AND (sesa.id_ = #{search} OR ses.name_ LIKE CONCAT('%',#{search},'%'))
 			</if>

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

@@ -148,9 +148,9 @@
     <sql id="queryPageSql">
 		<where>
 			ses.del_flag_ = 0
-			<if test="organId != null and organId != null">
+			<!-- <if test="organId != null and organId != null">
 				AND INTE_ARRAY(smsc.organ_id_,#{organId})
-			</if>
+			</if> -->
 			<if test="categoriesId != null">
 				AND FIND_IN_SET(ses.music_score_categories_id_,#{categoriesId})
 			</if>

+ 22 - 0
mec-student/src/main/java/com/ym/mec/student/controller/StudentCourseScheduleController.java

@@ -8,10 +8,13 @@ import com.ym.mec.biz.dal.page.StudentCourseScheduleRecordQueryInfo;
 import com.ym.mec.biz.service.CourseScheduleService;
 import com.ym.mec.biz.service.StudentAttendanceService;
 import com.ym.mec.common.controller.BaseController;
+import com.ym.mec.util.date.DateUtil;
 import com.yonge.log.model.AuditLogAnnotation;
+
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import io.swagger.annotations.ApiParam;
+
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.http.HttpStatus;
 import org.springframework.web.bind.annotation.*;
@@ -89,4 +92,23 @@ public class StudentCourseScheduleController extends BaseController {
 		return succeed(scheduleService.queryCourseInfoByGroupId(groupType,groupId));
 	}
 
+	@ApiOperation(value = "获取本周课程规划")
+	@GetMapping("/queryCoursePlan")
+	public Object queryCoursePlan(){
+		SysUser sysUser = sysUserFeignService.queryUserInfo();
+		if(sysUser == null || sysUser.getId() == null){
+			return failed(HttpStatus.FORBIDDEN, "请登录");
+		}
+		
+		Date now = new Date();
+		
+		Date startDate = DateUtil.getWeekMondayWithDate(now);
+		startDate = DateUtil.formatHMSToZero(startDate);
+		
+		Date endDate = DateUtil.addDays(startDate, 7);
+		endDate = DateUtil.getLastSecondWithDay(endDate);
+		
+		return succeed(scheduleService.queryMusicCoursePlan(sysUser.getId(), startDate, endDate));
+	}
+
 }

+ 10 - 0
mec-util/src/main/java/com/ym/mec/util/date/DateUtil.java

@@ -997,6 +997,16 @@ public class DateUtil {
 		calendar.set(Calendar.SECOND, 59);
 		return calendar.getTime();
 	}
+	
+	public static Date formatHMSToZero(Date date) {    
+        Calendar cal = Calendar.getInstance();  
+        cal.setTime(date);  
+        cal.set(Calendar.HOUR_OF_DAY, 0);  
+        cal.set(Calendar.MINUTE, 0);  
+        cal.set(Calendar.SECOND, 0);  
+        cal.set(Calendar.MILLISECOND, 0);  
+        return cal.getTime(); 
+    }
 
 	/**
 	 * @describe 获取指定时间在当天最后的时间