|
|
@@ -1,8 +1,10 @@
|
|
|
package com.xjrsoft.module.schedule.controller;
|
|
|
|
|
|
import cn.dev33.satoken.annotation.SaCheckPermission;
|
|
|
+import cn.dev33.satoken.stp.StpUtil;
|
|
|
import cn.hutool.core.util.StrUtil;
|
|
|
import cn.hutool.db.Db;
|
|
|
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
import com.google.gson.JsonArray;
|
|
|
import com.xjrsoft.common.constant.GlobalConstant;
|
|
|
import com.xjrsoft.common.enums.DeleteMark;
|
|
|
@@ -17,6 +19,11 @@ import com.xjrsoft.module.schedule.entity.JianyueData;
|
|
|
import com.xjrsoft.module.schedule.service.ICourseReceiveMsgService;
|
|
|
import com.xjrsoft.module.schedule.service.IJianyueDataService;
|
|
|
import com.xjrsoft.module.schedule.util.DataUtil;
|
|
|
+import com.xjrsoft.module.schedule.vo.CourseTableVo;
|
|
|
+import com.xjrsoft.module.student.entity.BaseStudentSchoolRoll;
|
|
|
+import com.xjrsoft.module.student.service.impl.IBaseStudentSchoolRollService;
|
|
|
+import com.xjrsoft.module.teacher.entity.BaseTeacher;
|
|
|
+import com.xjrsoft.module.teacher.service.IBaseTeacherService;
|
|
|
import io.swagger.annotations.Api;
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
import lombok.AllArgsConstructor;
|
|
|
@@ -26,6 +33,8 @@ import org.springframework.web.bind.annotation.RequestParam;
|
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
|
|
|
|
import javax.sql.DataSource;
|
|
|
+import java.time.DayOfWeek;
|
|
|
+import java.time.LocalDateTime;
|
|
|
import java.util.Date;
|
|
|
import java.util.HashMap;
|
|
|
import java.util.HashSet;
|
|
|
@@ -49,6 +58,8 @@ public class ScheduleController {
|
|
|
private final ICourseReceiveMsgService courseReceiveMsgService;
|
|
|
private final IJianyueDataService jianyueDataService;
|
|
|
private final ICourseTableService courseTableService;
|
|
|
+ private final IBaseStudentSchoolRollService baseStudentSchoolRollService;
|
|
|
+ private final IBaseTeacherService baseTeacherService;
|
|
|
|
|
|
@GetMapping(value = "/receive-msg")
|
|
|
@ApiOperation(value="接收消息")
|
|
|
@@ -121,11 +132,35 @@ public class ScheduleController {
|
|
|
}
|
|
|
|
|
|
@GetMapping(value = "/course-table")
|
|
|
- @ApiOperation(value="接收消息")
|
|
|
+ @ApiOperation(value="课表接口(PC端)")
|
|
|
+ @SaCheckPermission("room:detail")
|
|
|
+ public RT<CourseTableVo> courseInfo(CourseTableDto dto){
|
|
|
+ CourseTableVo list = courseTableService.getList(dto);
|
|
|
+ return RT.ok(list);
|
|
|
+ }
|
|
|
+
|
|
|
+ @GetMapping(value = "/course-table-day")
|
|
|
+ @ApiOperation(value="今日课表接口(手机端)")
|
|
|
@SaCheckPermission("room:detail")
|
|
|
- public RT<CourseReceiveMsg> courseInfo(CourseTableDto dto){
|
|
|
- courseTableService.list();
|
|
|
- return null;
|
|
|
+ public RT<CourseTableVo> courseInfoDay(CourseTableDto dto){
|
|
|
+ DayOfWeek dayOfWeek = LocalDateTime.now().getDayOfWeek();
|
|
|
+ dto.setWeekDay(dayOfWeek.getValue());
|
|
|
+ // 查询登录者身份
|
|
|
+ long loginIdAsLong = StpUtil.getLoginIdAsLong();
|
|
|
+ List<BaseStudentSchoolRoll> schoolRolls = baseStudentSchoolRollService.list(
|
|
|
+ new QueryWrapper<BaseStudentSchoolRoll>().lambda().eq(BaseStudentSchoolRoll::getUserId, loginIdAsLong)
|
|
|
+ );
|
|
|
+ if(schoolRolls != null && !schoolRolls.isEmpty()){
|
|
|
+ dto.setCourseType("class");
|
|
|
+ dto.setClassId(schoolRolls.get(0).getClassId());
|
|
|
+ }
|
|
|
+ List<BaseTeacher> teachers = baseTeacherService.list(new QueryWrapper<BaseTeacher>().lambda().eq(BaseTeacher::getUserId, loginIdAsLong));
|
|
|
+ if(teachers != null && !teachers.isEmpty()){
|
|
|
+ dto.setCourseType("teacher");
|
|
|
+ dto.setTeacherId(loginIdAsLong);
|
|
|
+ }
|
|
|
+ CourseTableVo list = courseTableService.getList(dto);
|
|
|
+ return RT.ok(list);
|
|
|
}
|
|
|
|
|
|
}
|