浏览代码

Merge remote-tracking branch 'origin/master'

周箭河 4 年之前
父节点
当前提交
471a89173d

+ 0 - 17
cms/src/main/java/com/ym/mec/cms/service/impl/SysNewsInformationServiceImpl.java

@@ -127,23 +127,6 @@ public class SysNewsInformationServiceImpl extends BaseServiceImpl<Long, SysNews
 		
 		queryInfo.setType(5);
 		pageInfos = new PageInfo<SysNewsInformation>();
-		SysNewsInformation info = new SysNewsInformation();
-		info.setOrder(1);
-
-		if (queryInfo.getTenantId() == 1 && date.after(startDate) && "18696158274".equals(user.getPhone()) == false) {
-			info.setCreateTime(date);
-			info.setUpdateTime(date);
-			if (isNewer) {
-				info.setLinkUrl(serverContextPath + "/#/auditionActive/1");
-				info.setCoverImage("https://daya-online.oss-cn-beijing.aliyuncs.com/tempActivity/5_1.png");
-			} else {
-				info.setLinkUrl(serverContextPath + "/#/auditionActive/1");
-				info.setCoverImage("https://daya-online.oss-cn-beijing.aliyuncs.com/tempActivity/5_2.png");
-			}
-			pageInfos.getRows().add(0, info);
-		} else {
-			pageInfos = queryHomePage(queryInfo);
-		}
 		homeList.put("flash",pageInfos);
 		return homeList;
 	}

+ 28 - 4
mec-biz/src/main/java/com/ym/mec/biz/service/impl/CourseScheduleServiceImpl.java

@@ -1252,7 +1252,17 @@ public class CourseScheduleServiceImpl extends BaseServiceImpl<Long, CourseSched
         } else {
             allCourseSchedules = courseSchedules;
         }
-        //所有课程的班级编号
+
+        //所有课程编号
+		List<Long> allCourseScheduleIds = allCourseSchedules.stream().map(CourseSchedule::getId).collect(Collectors.toList());
+        //所有课程学员签到记录
+		List<StudentAttendance> studentAttendances = studentAttendanceDao.findByCourseIds(allCourseScheduleIds);
+		//课程请假学员字典
+		Map<Long, Set<Integer>> courseLeaveStudentMap = studentAttendances.stream()
+				.filter(e -> StudentAttendanceStatusEnum.LEAVE.equals(e.getStatus()))
+				.collect(Collectors.groupingBy(StudentAttendance::getCourseScheduleId, Collectors.mapping(StudentAttendance::getUserId, Collectors.toSet())));
+
+		//所有课程的班级编号
         List<Integer> classGroupIds = allCourseSchedules
                 .stream()
                 .map(CourseSchedule::getClassGroupId)
@@ -1359,12 +1369,26 @@ public class CourseScheduleServiceImpl extends BaseServiceImpl<Long, CourseSched
                         if (CollectionUtils.isEmpty(preClassGroupStudents) || CollectionUtils.isEmpty(backClassGroupStudents)) {
                             continue;
                         }
-                        //当前课程所在班级的学生编号列表
-                        List<Integer> preClassGroupStudentIds = preClassGroupStudents.stream()
+                        //课程对应请假学员编号集合
+						Set<Integer> preLeaveStudentIds = courseLeaveStudentMap.get(preCourseSchedule.getId());
+                        if(null == preLeaveStudentIds){
+                        	preLeaveStudentIds = Collections.EMPTY_SET;
+						}
+						Set<Integer> backLeaveStudentIds = courseLeaveStudentMap.get(backCourseSchedule.getId());
+						if(null == backLeaveStudentIds){
+							backLeaveStudentIds = Collections.EMPTY_SET;
+						}
+
+						//当前课程所在班级的学生编号列表
+						Set<Integer> finalPreLeaveStudentIds = preLeaveStudentIds;
+						List<Integer> preClassGroupStudentIds = preClassGroupStudents.stream()
+								.filter(e->!finalPreLeaveStudentIds.contains(e.getUserId()))
                                 .map(ClassGroupStudentMapper::getUserId)
                                 .collect(Collectors.toList());
                         //后面一节课程所在班级的学生编号列表
-                        Set<Integer> backClassGroupStudentIds = backClassGroupStudents.stream()
+						Set<Integer> finalBackLeaveStudentIds = backLeaveStudentIds;
+						Set<Integer> backClassGroupStudentIds = backClassGroupStudents.stream()
+								.filter(e->!finalBackLeaveStudentIds.contains(e.getUserId()))
                                 .map(ClassGroupStudentMapper::getUserId)
                                 .collect(Collectors.toSet());
                         List<Integer> repeatStudentIds = preClassGroupStudentIds.stream()

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

@@ -255,7 +255,8 @@
         LIMIT 1
     </select>
     <select id="findByClassGroups" resultMap="ClassGroupStudentMapper">
-        SELECT * FROM class_group_student_mapper WHERE class_group_id_ IN
+        SELECT * FROM class_group_student_mapper
+        WHERE class_group_id_ IN
         <foreach collection="classGroupIds" item="classGroupId" open="(" close=")" separator=",">
             #{classGroupId}
         </foreach>

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

@@ -2177,9 +2177,13 @@
         FROM course_schedule cs
                  LEFT JOIN course_schedule_student_payment cssp ON cs.id_ = cssp.course_schedule_id_
         WHERE (cs.del_flag_ != 1 OR cs.del_flag_ IS NULL)
+          <if test="groupType != null">
           AND cs.group_type_ = #{groupType, typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler}
-          AND CONCAT(cs.class_date_, ' ', cs.start_class_time_) > NOW()
+          </if>
+          <if test="groupId != null">
           AND cs.music_group_id_ = #{groupId}
+          </if>
+          AND CONCAT(cs.class_date_, ' ', cs.start_class_time_) > NOW()
           AND cssp.user_id_ = #{userId}
     </select>
 

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

@@ -570,7 +570,7 @@
             </if>
     </select>
     <select id="findEnableAssignTeachers" resultType="com.ym.mec.biz.dal.dto.SimpleUserDto">
-        SELECT su.id_ userId,su.username_ userName,su.avatar_ avatar
+        SELECT su.id_ userId,su.real_name_ userName,su.avatar_ avatar
         FROM teacher t
           LEFT JOIN sys_user su ON t.id_=su.id_
         WHERE

+ 1 - 0
mec-student/src/main/java/com/ym/mec/student/config/ResourceServerConfig.java

@@ -36,6 +36,7 @@ public class ResourceServerConfig extends ResourceServerConfigurerAdapter {
 				"/repair/payRepair",
 				"/degree/*",
 				"/practiceGroup/queryOrderInfo",
+				"/systemDate/query",
 				"/organization/getOrgans").permitAll().anyRequest().authenticated().and().httpBasic();
 	}
 

+ 24 - 0
mec-student/src/main/java/com/ym/mec/student/controller/CourseController.java

@@ -1,15 +1,22 @@
 package com.ym.mec.student.controller;
 
+import java.util.List;
+
+import com.timevale.tgtext.text.pdf.PdfStructTreeController.returnType;
 import com.ym.mec.auth.api.client.SysUserFeignService;
 import com.ym.mec.auth.api.entity.SysUser;
+import com.ym.mec.biz.dal.dao.CourseScheduleDao;
+import com.ym.mec.biz.dal.dto.StudentCourseInfoDto;
 import com.ym.mec.biz.dal.dto.UserMusicGroupQueryInfo;
 import com.ym.mec.biz.dal.page.GroupNoticeQueryInfo;
 import com.ym.mec.biz.dal.page.StudentPayLogQueryInfo;
 import com.ym.mec.biz.service.ClassGroupService;
 import com.ym.mec.biz.service.ImGroupNoticeService;
 import com.ym.mec.common.controller.BaseController;
+
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
+
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.GetMapping;
 import org.springframework.web.bind.annotation.PostMapping;
@@ -27,6 +34,9 @@ public class CourseController extends BaseController {
     private SysUserFeignService sysUserFeignService;
     @Autowired
     private ImGroupNoticeService imGroupNoticeService;
+    
+    @Autowired
+    private CourseScheduleDao courseScheduleDao;
 
     @ApiOperation("获取学生所购买课程列表")
     @GetMapping(value = "/queryUserMusicGroups")
@@ -38,6 +48,20 @@ public class CourseController extends BaseController {
         return succeed(classGroupService.queryCoursePage(queryInfo,sysUser.getId()));
     }
 
+    @ApiOperation("获取学生所购买课程列表")
+    @GetMapping(value = "/queryRemainCourseNum")
+    public Object queryRemainCourseNum(){
+        SysUser sysUser = sysUserFeignService.queryUserInfo();
+        if(sysUser == null){
+            return failed("获取用户信息失败");
+        }
+        List<StudentCourseInfoDto> list = courseScheduleDao.findUserSurplusCourseInfoByGroup(null, null, sysUser.getId());
+        if(list == null){
+        	return succeed(0);
+        }
+        return succeed(list.size());
+    }
+
     @ApiOperation("获取学员所有聊天群组")
     @GetMapping(value = "/queryUserGroups")
     public Object queryUserGroups(String search){

+ 27 - 0
mec-student/src/main/java/com/ym/mec/student/controller/SystemDateController.java

@@ -0,0 +1,27 @@
+package com.ym.mec.student.controller;
+
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+
+import java.util.Date;
+
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import com.ym.mec.common.controller.BaseController;
+
+/** 
+ * 系统时间
+ */
+@RestController
+@Api(tags = "获取系统时间")
+@RequestMapping(value = "systemDate")
+public class SystemDateController extends BaseController {
+
+	@ApiOperation(value = "查询参数")
+	@GetMapping(value = "query")
+	public Object query() {
+		return succeed(new Date());
+	}
+}