浏览代码

1、手机端课表增加studentId,方便家长查询课表
2、优化数据推送定时器
3、增加调课代课的课程接口

dzx 1 年之前
父节点
当前提交
24bfb403ce

+ 15 - 10
src/main/java/com/xjrsoft/module/courseTable/service/impl/CourseTableServiceImpl.java

@@ -179,18 +179,23 @@ public class CourseTableServiceImpl extends ServiceImpl<CourseTableMapper, Cours
             tableVo.setSemesterName(baseSemester.getName());
             LocalDateTime now = LocalDateTime.now();
             //计算本周是第几周
-            LocalDateTime startDateTime = LocalDateTime.ofInstant(baseSemester.getStartDate().toInstant(), ZoneId.systemDefault());
-            LocalDateTime endDateTime = LocalDateTime.ofInstant(baseSemester.getEndDate().toInstant(), ZoneId.systemDefault());
-            Duration between = Duration.between(startDateTime, endDateTime);
-            long days = between.toDays();
-            int weeks = (int) Math.ceil((double) days / 7);
-            for (int i = 0; i < weeks; i ++){
-                LocalDateTime startDate = startDateTime.plusDays(i * 7).withHour(0).withMinute(0).withSecond(0).withNano(0);
-                LocalDateTime endDate = startDateTime.plusDays((i + 1) * 7).withHour(23).withMinute(59).withSecond(59).withNano(9999);
-                if(now.isAfter(startDate) && now.isBefore(endDate)){
-                    tableVo.setWeek("第" + (i + 1) + "周");
+            if(dto.getWeek() == null){
+                LocalDateTime startDateTime = LocalDateTime.ofInstant(baseSemester.getStartDate().toInstant(), ZoneId.systemDefault());
+                LocalDateTime endDateTime = LocalDateTime.ofInstant(baseSemester.getEndDate().toInstant(), ZoneId.systemDefault());
+                Duration between = Duration.between(startDateTime, endDateTime);
+                long days = between.toDays();
+                int weeks = (int) Math.ceil((double) days / 7);
+                for (int i = 0; i < weeks; i ++){
+                    LocalDateTime startDate = startDateTime.plusDays(i * 7).withHour(0).withMinute(0).withSecond(0).withNano(0);
+                    LocalDateTime endDate = startDateTime.plusDays((i + 1) * 7).withHour(23).withMinute(59).withSecond(59).withNano(9999);
+                    if(now.isAfter(startDate) && now.isBefore(endDate)){
+                        tableVo.setWeek("第" + (i + 1) + "周");
+                    }
                 }
+            }else{
+                tableVo.setWeek("第" + dto.getWeek() + "周");
             }
+
         }
         if(!StrUtil.isEmpty(dto.getTeacherName())){
             List<XjrUser> userList = teacherbaseManagerService.list(

+ 1 - 1
src/main/java/com/xjrsoft/module/job/JianyuekbBaseDataTask.java

@@ -27,7 +27,7 @@ import java.util.Set;
 public class JianyuekbBaseDataTask {
 
 
-    @Scheduled(cron = "0 */15 * * * ?")
+    @Scheduled(cron = "0 */5 * * * ?")
     public void RefreshConnectionPool() {
         String active = SpringUtil.getActiveProfile();
         if("prod".equals(active)){

+ 36 - 13
src/main/java/com/xjrsoft/module/schedule/controller/ScheduleController.java

@@ -2,6 +2,7 @@ package com.xjrsoft.module.schedule.controller;
 
 import cn.dev33.satoken.annotation.SaCheckPermission;
 import cn.dev33.satoken.stp.StpUtil;
+import cn.hutool.core.util.ObjectUtil;
 import cn.hutool.core.util.StrUtil;
 import cn.hutool.db.Db;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
@@ -13,6 +14,7 @@ import com.xjrsoft.common.model.result.RT;
 import com.xjrsoft.common.utils.DatasourceUtil;
 import com.xjrsoft.module.base.entity.BaseSemester;
 import com.xjrsoft.module.courseTable.service.ICourseTableService;
+import com.xjrsoft.module.evaluate.dto.EvaluateResultSaveDto;
 import com.xjrsoft.module.schedule.dto.CourseTableDto;
 import com.xjrsoft.module.schedule.entity.CourseReceiveMsg;
 import com.xjrsoft.module.schedule.entity.JianyueData;
@@ -28,11 +30,14 @@ import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import lombok.AllArgsConstructor;
 import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RequestParam;
 import org.springframework.web.bind.annotation.RestController;
 
 import javax.sql.DataSource;
+import javax.validation.Valid;
 import java.time.DayOfWeek;
 import java.time.LocalDateTime;
 import java.util.Date;
@@ -145,22 +150,40 @@ public class ScheduleController {
     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);
+        if(ObjectUtil.isNotNull(dto.getStudentId())){
+            List<BaseStudentSchoolRoll> schoolRolls = baseStudentSchoolRollService.list(
+                    new QueryWrapper<BaseStudentSchoolRoll>().lambda().eq(BaseStudentSchoolRoll::getUserId, dto.getStudentId())
+            );
+            if(schoolRolls != null && !schoolRolls.isEmpty()){
+                dto.setCourseType("class");
+                dto.setClassId(schoolRolls.get(0).getClassId());
+            }
+        }else{
+            // 查询登录者身份
+            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);
     }
 
+
+    @GetMapping
+    @ApiOperation(value = "调课顶课OA课表查询")
+    @SaCheckPermission("evaluateobject:detail")
+    public RT<List<CourseTableVo>> courseInfoDay(EvaluateResultSaveDto dto){
+        return RT.ok();
+    }
 }

+ 26 - 0
src/main/java/com/xjrsoft/module/schedule/dto/CourseTableAdjustDto.java

@@ -0,0 +1,26 @@
+package com.xjrsoft.module.schedule.dto;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.io.Serializable;
+import java.util.Date;
+
+
+/**
+* @title: 寝室
+* @Author dzx
+* @Date: 2023-12-27
+* @Version 1.0
+*/
+@Data
+public class CourseTableAdjustDto implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    @ApiModelProperty("教室id")
+    private Long teacherId;
+    @ApiModelProperty("调整日期")
+    private Date adjustDate;
+
+}

+ 3 - 0
src/main/java/com/xjrsoft/module/schedule/dto/CourseTableDto.java

@@ -42,4 +42,7 @@ public class CourseTableDto implements Serializable {
     @ApiModelProperty("教师id")
     private Long teacherId;
 
+
+    @ApiModelProperty("学生id(家长登录时使用)")
+    private Long studentId;
 }

+ 6 - 1
src/main/java/com/xjrsoft/module/schedule/util/DataUtil.java

@@ -314,7 +314,7 @@ public class DataUtil {
      * @return 返回数据库和jianyue的对应关系
      */
     public Map<Long, String> insertGrade(Db db, String tableName, String schoolDistrictId, Map<Long, String> ids) throws Exception {
-        String sql = "select * from " + tableName + " where delete_mark = 0";
+        String sql = "select * from " + tableName + " where delete_mark = 0 and status = 1";
         List<BaseGrade> list = db.query(sql, BaseGrade.class);
         String url = ScheduleUtil.apiUrl + "eduyear/create";
         JsonParser jsonParser = new JsonParser();
@@ -469,6 +469,11 @@ public class DataUtil {
             if(!StrUtil.isEmpty(numberOfDayName)){
                 timeNumber = Integer.parseInt(numberOfDayName.substring(numberOfDayName.length() - 1));
             }
+            String updateSql = "update course_table set status = 3 where class_id = " + classMap.get(asJsonObject.get("classSerialNo").getAsString())
+                    + " and time_period = " + tmePeriod.get(asJsonObject.get("timeOption").getAsInt())
+                    + " and time_number = " + timeNumber;
+            sqls.add(updateSql);
+
             String sql = "INSERT INTO course_table(id,base_semester_id,teacher_id,teacher_name,course_id,course_name," +
                     "class_id, class_name,weeks,weeks_cn,time_period,time_number,site_id,site_name,status," +
                     "create_date,jianyue_id) select " + id + String.format("%04d", count) + ","

+ 1 - 1
src/main/resources/mapper/courseTable/CourseTable.xml

@@ -10,7 +10,7 @@
         LEFT JOIN base_office_build t4 ON t3.office_build_id = t4.id
         LEFT JOIN base_class t5 ON t1.class_id = t5.id
         LEFT JOIN base_grade t6 ON t5.grade_id = t6.id
-        where 1 = 1
+        where t1.status = 1
         <if test="dto.semesterId != null">
             and t1.base_semester_id = #{dto.semesterId}
         </if>

+ 24 - 5
src/main/resources/sqlScript/20240125_sql.sql

@@ -84,8 +84,10 @@ CREATE TABLE course_receive_msg
     `is_callback` INT NULL DEFAULT NULL COMMENT '是否已回调',
     PRIMARY KEY (`id`)
 ) ENGINE=INNODB DEFAULT CHARSET=utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT '课表发布消息接收';
+-- ------------------
 -- 课表,字段长度调整
-ALTER TABLE course_table`
+-- ---------------------
+ALTER TABLE course_table
     CHANGE `site_id` `site_id` BIGINT DEFAULT 0  NOT NULL   COMMENT '场地编号(site)',
     ADD COLUMN `source_data` TEXT NULL   COMMENT '源数据' AFTER `jianyue_id`;
 
@@ -118,6 +120,20 @@ DELIMITER ;
 CALL createCom;
 DROP PROCEDURE createCom;
 
+DROP PROCEDURE IF EXISTS createCom;
+DELIMITER $$
+CREATE
+    PROCEDURE createCom()
+BEGIN
+    IF NOT EXISTS(SELECT 1 FROM information_schema.columns  WHERE table_name='base_grade' AND COLUMN_NAME = 'status') THEN
+        ALTER TABLE `base_grade`
+            ADD COLUMN `status` INT NULL DEFAULT 1 COMMENT '在读状态(1:在读 0:毕业)' AFTER `title`;
+
+    END IF;
+END$$
+DELIMITER ;
+CALL createCom;
+DROP PROCEDURE createCom;
 --
 DROP PROCEDURE IF EXISTS createCom;
 DELIMITER $$
@@ -137,7 +153,7 @@ DROP PROCEDURE createCom;
 
 -- ------------------------------------------------------------------毕业--------------------------------------------------------------------
 
----------------------------------------------------------------------评价管理-----------------------------------------------------------------
+-- -------------------------------------------------------------------评价管理-----------------------------------------------------------------
 DROP PROCEDURE IF EXISTS createCom;
 DELIMITER $$
 CREATE
@@ -154,8 +170,8 @@ END$$
 DELIMITER ;
 CALL createCom;
 DROP PROCEDURE createCom;
----------------------------------------------------------------------评价管理-----------------------------------------------------------------
----------------------------------------------------------------------考核-----------------------------------------------------------------
+-- -------------------------------------------------------------------评价管理-----------------------------------------------------------------
+-- -------------------------------------------------------------------考核-----------------------------------------------------------------
 -- -------------------------------
 -- 指标公式规则管理
 -- -------------------------------
@@ -219,4 +235,7 @@ CREATE TABLE quota_formula_rule_attribute
     PRIMARY KEY (`id`)
 ) ENGINE=INNODB DEFAULT CHARSET=utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT '考核表单属性';
 
----------------------------------------------------------------------考核-----------------------------------------------------------------
+-- -------------------------------------------------------------------考核-----------------------------------------------------------------
+
+
+