Procházet zdrojové kódy

调课流程调整

dzx před 8 měsíci
rodič
revize
3739f13670

+ 56 - 0
src/main/java/com/xjrsoft/module/schedule/controller/ScheduleController.java

@@ -26,6 +26,7 @@ import com.xjrsoft.module.schedule.service.IWfCourseAdjustService;
 import com.xjrsoft.module.schedule.util.ScheduleUtil;
 import com.xjrsoft.module.schedule.vo.ClassOptionVo;
 import com.xjrsoft.module.schedule.vo.CourseListVo;
+import com.xjrsoft.module.schedule.vo.CourseNamesVo;
 import com.xjrsoft.module.schedule.vo.CourseTableVo;
 import com.xjrsoft.module.schedule.vo.ScheduleWeekVo;
 import com.xjrsoft.module.student.entity.BaseStudentSchoolRoll;
@@ -51,6 +52,8 @@ import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Date;
 import java.util.List;
+import java.util.Set;
+import java.util.stream.Collectors;
 
 /**
  * @title: 课表
@@ -264,6 +267,59 @@ public class ScheduleController {
     }
 
 
+    @GetMapping(value = "/getCourseInfo")
+    @ApiOperation(value = "根据课程id获取课程相关信息")
+    @SaCheckPermission("schedule:detail")
+    @XjrLog(value = "根据课程id获取课程相关信息", saveResponseData = true)
+    public RT<CourseNamesVo> getCourseInfo(String id) {
+        String[] split = id.split(",");
+        List<CourseTable> list = courseTableService.list(
+                new QueryWrapper<CourseTable>().lambda()
+                        .in(CourseTable::getId, Arrays.asList(split))
+        );
+        CourseNamesVo resultVo = new CourseNamesVo();
+
+        Set<Long> classSets = list.stream().map(CourseTable::getClassId).collect(Collectors.toSet());
+        if(classSets.size() > 1){
+            resultVo.setStatus(0);
+            return RT.ok(resultVo);
+        }
+
+        List<ClassTime> classTimeList = classTimeService.list();
+        String courseNames = "";
+        String timeNumbers = "";
+        String classIds = "";
+        for (int i = 0; i < list.size(); i++) {
+            if (i > 0) {
+                courseNames += ",";
+                timeNumbers += ",";
+                classIds += ",";
+            }
+            CourseTable courseTable = list.get(i);
+
+            String courseName = courseTable.getCourseName();
+
+            ClassTime classTime = classTimeList.stream().filter(u -> u.getNumber().equals(courseTable.getTimeNumber())).findAny().orElse(null);
+
+            if (classTime != null) {
+                courseName += "(" + classTime.getShortName() + ")";
+            }
+
+            courseNames += courseName;
+            timeNumbers += courseTable.getTimeNumber();
+            classIds += courseTable.getClassId();
+        }
+        resultVo.setCourseNames(courseNames);
+        resultVo.setTimeNumbers(timeNumbers);
+        resultVo.setClassIds(classIds);
+        resultVo.setStatus(1);
+
+        return RT.ok(resultVo);
+    }
+
+
+
+
     /**
      * 顶课预检查
      *

+ 29 - 0
src/main/java/com/xjrsoft/module/schedule/vo/CourseNamesVo.java

@@ -0,0 +1,29 @@
+package com.xjrsoft.module.schedule.vo;
+
+import com.xjrsoft.module.courseTable.entity.ClassTime;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.time.LocalDate;
+import java.util.List;
+
+/**
+ * @author dzx
+ * @date 2024/1/29
+ */
+@Data
+public class CourseNamesVo {
+
+    @ApiModelProperty("课程名称")
+    private String courseNames;
+
+    @ApiModelProperty("节次数字")
+    private String timeNumbers;
+
+    @ApiModelProperty("班级ids")
+    private String classIds;
+
+    @ApiModelProperty("是否同一个班级(1:是 0:否)")
+    private Integer status;
+
+}

+ 1 - 1
src/main/resources/mapper/oa/NewsMapper.xml

@@ -34,7 +34,7 @@
         select t.*,t2.name as create_user_name from xjr_oa_news t
         left join xjr_user t2 on t.create_user_id = t2.id
         left join xjr_oa_news_relation t3 on t.id = t3.news_id
-        where t.delete_mark = 0
+        where t.delete_mark = 0 and t.enabled_mark = 1
         and (t.send_end_date > now() or t.send_end_date is null)
         and t.status = 2 and t3.user_id = #{dto.loginId}
         <if test="dto.type != null and dto.type == 1">