liujc 2 năm trước cách đây
mục cha
commit
167024f3fc

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

@@ -2023,4 +2023,10 @@ public interface CourseScheduleDao extends BaseDAO<Long, CourseSchedule> {
     List<ClassesForDayDto> getListClassesForDay(@Param("musicGroupIds") List<String> musicGroupIds, @Param("classDate") String classDate, @Param("courseId") Long courseId);
 
     List<CourseSchedule> getByTeacherAndTime(@Param("teacherId") Integer teacherId, @Param("startTime") Date startTime, @Param("endTime") Date endTime);
+
+    /**
+     * 直播课需要通知的课程
+     */
+    List<CourseSchedule> liveCourseRemind();
+
 }

+ 15 - 2
mec-biz/src/main/java/com/ym/mec/biz/dal/entity/CourseSchedule.java

@@ -131,7 +131,8 @@ public class CourseSchedule  extends BaseEntity{
 	@ApiModelProperty(value = "助教编号列表(用于记录调整日志)")
 	private String teachingTeacherIds;
 
-	private String teachingTeacherNames;
+
+    private String teachingTeacherNames;
 
 	/**  */
 	private java.util.Date createTime;
@@ -239,7 +240,19 @@ public class CourseSchedule  extends BaseEntity{
 	@ApiModelProperty("授课直播间编号")
 	private String liveRoomId;
 
-	public Boolean getSettlementReportFlag() {
+
+    @ApiModelProperty(value = "直播课通知标记")
+    private Boolean liveRemind;
+
+    public Boolean getLiveRemind() {
+        return liveRemind;
+    }
+
+    public void setLiveRemind(Boolean liveRemind) {
+        this.liveRemind = liveRemind;
+    }
+
+    public Boolean getSettlementReportFlag() {
 		return settlementReportFlag;
 	}
 

+ 4 - 3
mec-biz/src/main/java/com/ym/mec/biz/dal/wrapper/LiveGroupWrapper.java

@@ -1,7 +1,6 @@
 package com.ym.mec.biz.dal.wrapper;
 
 import com.microsvc.toolkit.common.response.paging.QueryInfo;
-import com.ym.mec.biz.dal.enums.CourseStatusEnum;
 import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModelProperty;
 import lombok.AllArgsConstructor;
@@ -10,7 +9,6 @@ import lombok.Data;
 import lombok.NoArgsConstructor;
 
 import javax.validation.constraints.NotNull;
-import java.math.BigDecimal;
 import java.util.Date;
 
 public class LiveGroupWrapper {
@@ -33,7 +31,7 @@ public class LiveGroupWrapper {
         @ApiModelProperty("直播课ID")
         private Long liveGroupId;
 
-        private Long classGroupdId;
+        private Long classGroupId;
 
     }
 
@@ -71,6 +69,9 @@ public class LiveGroupWrapper {
         @ApiModelProperty("报名时间")
         private Date createTime;
 
+        @ApiModelProperty("学生状态")
+        private int studentStatus = 0;
+
 
     }
 

+ 7 - 1
mec-biz/src/main/java/com/ym/mec/biz/service/VipGroupService.java

@@ -463,5 +463,11 @@ public interface VipGroupService extends BaseService<Long, VipGroup> {
      */
     IPage<LiveGroupWrapper.LiveGroupStudentList> liveStudentList(IPage<LiveGroupWrapper.LiveGroupStudentList> page, LiveGroupWrapper.LiveGroupStudentQuery query);
 
-    List<CourseSchedule> liveCourseList( LiveGroupWrapper.LiveGroupStudentQuery query);
+    Map<String, Object> liveCourseList(LiveGroupWrapper.LiveGroupStudentQuery query);
+
+    /**
+     *
+     * 直播课程提醒
+     */
+    void liveCourseRemind();
 }

+ 64 - 3
mec-biz/src/main/java/com/ym/mec/biz/service/impl/VipGroupServiceImpl.java

@@ -4898,11 +4898,52 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
 
             }
         }
+        // 学生休学状态
+        ClassGroup classGroup = classGroupDao.findByVipGroup(query.getLiveGroupId(), GroupType.LIVE.getCode());
+        if (Objects.isNull(classGroup)) {
+            return livedStudentList;
+        }
+
+        List<ClassGroupStudentMapper> studentMapperList = classGroupStudentMapperDao.findAllByClassGroup(classGroup.getId().longValue());
+        if (CollectionUtils.isEmpty(studentMapperList)) {
+            return livedStudentList;
+        }
+        Map<Integer, ClassGroupStudentMapper> studentMapperMap = studentMapperList.stream().collect(Collectors.toMap(ClassGroupStudentMapper::getUserId, o->o ,(k1,k2)->k2));
+
+        List<StudentApplyRefunds> applyRefunds = studentApplyRefundsDao.findByGroupAndType(query.getLiveGroupId().toString(), GroupType.LIVE.getCode());
+        Map<Integer, List<StudentApplyRefunds>> studentApplyRefundsMap = applyRefunds.stream()
+                .collect(Collectors.groupingBy(StudentApplyRefunds::getUserId));
+        records.forEach(data -> {
+            ClassGroupStudentMapper classGroupStudentMapper = studentMapperMap.get(data.getStudentId().intValue());
+            if (Objects.isNull(classGroupStudentMapper)) {
+                data.setStudentStatus(0);
+                return;
+            }
+            if (classGroupStudentMapper.getStatus().equals(ClassGroupStudentStatusEnum.QUIT)) {
+                data.setStudentStatus(1);
+                return;
+            } else if (classGroupStudentMapper.getStatus().equals(ClassGroupStudentStatusEnum.QUIT_SCHOOL)) {
+                data.setStudentStatus(3);
+                return;
+            }
+
+            List<StudentApplyRefunds> studentApplyRefunds = studentApplyRefundsMap.get(data.getStudentId().intValue());
+            if (!CollectionUtils.isEmpty(studentApplyRefunds)) {
+                StudentApplyRefunds studentApplyRefund = studentApplyRefunds.get(0);
+                if (data.getStudentStatus() == 0 && studentApplyRefund.getStatus().equals(StudentApplyRefundsStatus.ING)) {
+                    data.setStudentStatus(2);
+                    return;
+                }
+            }
+            data.setStudentStatus(0);
+        });
+
+
         return livedStudentList.setRecords(records);
     }
 
     @Override
-    public List<CourseSchedule> liveCourseList(LiveGroupWrapper.LiveGroupStudentQuery query) {
+    public Map<String, Object> liveCourseList(LiveGroupWrapper.LiveGroupStudentQuery query) {
 
         VipGroup vipGroup = this.get(query.getLiveGroupId());
         if (Objects.isNull(vipGroup)) {
@@ -4912,10 +4953,30 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
             throw new BizException("此课程不是直播课程");
         }
         // 报名中的课程直接返回json数据
+        List<CourseSchedule> courseSchedules;
         if (vipGroup.getStatus().equals(VipGroupStatusEnum.APPLYING)) {
-            return JSON.parseArray(vipGroup.getCourseSchedulesJson(), CourseSchedule.class);
+            courseSchedules =  JSON.parseArray(vipGroup.getCourseSchedulesJson(), CourseSchedule.class);
         } else {
-            return courseScheduleDao.findGroupCourseSchedules(vipGroup.getId().toString(), GroupType.LIVE.getCode());
+            courseSchedules =  courseScheduleDao.findGroupCourseSchedules(vipGroup.getId().toString(), GroupType.LIVE.getCode());
         }
+
+
+        Map<String, Object> result = new HashMap<>();
+        result.put("list", courseSchedules);
+        result.put("singleClassMinutes", vipGroup.getSingleClassMinutes());
+        return result;
+    }
+
+    /**
+     * 直播课程提醒
+     */
+    @Override
+    public void liveCourseRemind() {
+        // 查询30分钟内要开始的并且没有直播通知的直播课
+        List<CourseSchedule> courseSchedules = courseScheduleDao.liveCourseRemind();
+
+
+
+
     }
 }

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

@@ -4301,4 +4301,14 @@
         and CONCAT(class_date_," ",start_class_time_) &lt;= #{endTime}
 
     </select>
+
+    <select id="liveCourseRemind" resultMap="CourseSchedule">
+        select *
+        from course_schedule cs
+        where cs.status_ = 'NOT_START'
+          and cs.live_remind_ = 0
+          and cs.type_ = 'LIVE'
+          and cs.class_date_ = date_format(now(),'%Y-%m-%d')
+          and cs.start_class_time_ &lt;= date_format(now(),'%H:%i:%s')
+    </select>
 </mapper>

+ 8 - 0
mec-web/src/main/java/com/ym/mec/web/controller/TaskController.java

@@ -657,4 +657,12 @@ public class TaskController extends BaseController {
         degreeService.degreeStatusChange();
         return succeed();
     }
+
+
+    @ApiOperation("直播课课程提醒")
+    @GetMapping("/liveCourseRemind")
+    public Object liveCourseRemind() {
+        vipGroupService.liveCourseRemind();
+        return succeed();
+    }
 }

+ 1 - 1
mec-web/src/main/java/com/ym/mec/web/controller/VipGroupManageController.java

@@ -455,7 +455,7 @@ public class VipGroupManageController extends BaseController {
 
     @ApiOperation(value = "课程列表")
     @PostMapping(value = "/liveCourseList")
-    public HttpResponseResult<List<CourseSchedule>> liveCourseList(@Validated @RequestBody LiveGroupWrapper.LiveGroupStudentQuery query){
+    public HttpResponseResult<Object> liveCourseList(@Validated @RequestBody LiveGroupWrapper.LiveGroupStudentQuery query){
 
         return succeed(vipGroupService.liveCourseList(query));
     }