Sfoglia il codice sorgente

修改 调课顶课查询

snihwxf 2 mesi fa
parent
commit
b07b257766

+ 4 - 0
src/main/java/com/xjrsoft/module/courseTable/mapper/CourseTableMapper.java

@@ -6,6 +6,7 @@ import com.xjrsoft.module.courseTable.entity.CourseTable;
 import com.xjrsoft.module.courseTable.vo.ClassTeacherVo;
 import com.xjrsoft.module.schedule.dto.ClassOptionDto;
 import com.xjrsoft.module.schedule.dto.CourseTableAdjustDto;
+import com.xjrsoft.module.schedule.dto.CourseTableAdjustDto1;
 import com.xjrsoft.module.schedule.dto.CourseTableDto;
 import com.xjrsoft.module.schedule.entity.WfCourseAdjust;
 import com.xjrsoft.module.schedule.vo.ClassOptionVo;
@@ -30,6 +31,9 @@ public interface CourseTableMapper extends MPJBaseMapper<CourseTable> {
 
     List<CourseListVo> getAdjustList(@Param("dto") CourseTableAdjustDto dto);
 
+
+    List<CourseListVo> getAdjustList1(@Param("dto") CourseTableAdjustDto1 dto);
+
     List<ClassOptionVo> getClassListByTeacherId(@Param("dto") ClassOptionDto dto);
 
     //查询流程正在进行中或者已经完成的调课或者顶课申请

+ 3 - 0
src/main/java/com/xjrsoft/module/courseTable/service/ICourseTableService.java

@@ -38,6 +38,9 @@ public interface ICourseTableService extends IService<CourseTable> {
 
     List<CourseListVo> getAdjustList(String teacherId, String adjustDate, String classId, String adjustType);
 
+
+    List<CourseListVo> getAdjustList1(String classId,String teacherId, String adjustDate,String timeNumber,String applicantTeacherId,  String exchangeDate,  String adjustType);
+
     String getPreCheck(String preCheckType, String courseId, String swapCourseId, String swapDate, String subTeacherId);
 
     /**

+ 47 - 5
src/main/java/com/xjrsoft/module/courseTable/service/impl/CourseTableServiceImpl.java

@@ -52,11 +52,7 @@ import com.xjrsoft.module.courseTable.service.ICourseTableService;
 import com.xjrsoft.module.courseTable.vo.ClassListVo;
 import com.xjrsoft.module.organization.entity.User;
 import com.xjrsoft.module.organization.service.IUserService;
-import com.xjrsoft.module.schedule.dto.ClassOptionDto;
-import com.xjrsoft.module.schedule.dto.CourseTableAdjustDto;
-import com.xjrsoft.module.schedule.dto.CourseTableDto;
-import com.xjrsoft.module.schedule.dto.CourseTableExportQueryDto;
-import com.xjrsoft.module.schedule.dto.ScheduleWeekExportQueryDto;
+import com.xjrsoft.module.schedule.dto.*;
 import com.xjrsoft.module.schedule.entity.CourseTableBak;
 import com.xjrsoft.module.schedule.entity.WfCourseAdjust;
 import com.xjrsoft.module.schedule.mapper.CourseTableBakMapper;
@@ -336,6 +332,52 @@ public class CourseTableServiceImpl extends ServiceImpl<CourseTableMapper, Cours
         return list;
     }
 
+
+    /**
+     * 调课顶课查询
+     */
+    @Override
+    public List<CourseListVo> getAdjustList1(String classId,String teacherId, String adjustDate,String timeNumber,String applicantTeacherId,  String exchangeDate,  String adjustType) {
+        CourseTableAdjustDto1 dto = new CourseTableAdjustDto1();
+        if (adjustDate != null && !"".equals(adjustDate)) {
+            DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
+            LocalDate localDateTime = LocalDate.parse(adjustDate, formatter);
+            DayOfWeek dayOfWeek = localDateTime.getDayOfWeek();
+            dto.setAdjustDate(adjustDate);
+            dto.setWeek(dayOfWeek.getValue());
+        }
+
+        if (exchangeDate != null && !"".equals(exchangeDate)) {
+            dto.setExchangeDate(exchangeDate);
+        }
+
+        dto.setTimeNumber(timeNumber);
+
+        if (applicantTeacherId != null && !"".equals(applicantTeacherId)) {
+            dto.setApplicantTeacherId(Long.parseLong(applicantTeacherId));
+        }
+
+        dto.setClassId(classId);
+        if (teacherId != null && !"".equals(teacherId)) {
+            dto.setTeacherId(Long.parseLong(teacherId));
+        }
+        dto.setAdjustType(adjustType);
+        //查询正在进行中或者已经完成
+        List<Long> courseIds = courseTableMapper.getExceptCourseIds(dto.getTeacherId());
+        dto.setExceptCourseList(courseIds);
+        List<CourseListVo> list = courseTableMapper.getAdjustList1(dto);
+        for (CourseListVo courseListVo : list) {
+            if (courseListVo.getTimePeriod() == 1) {
+                courseListVo.setTimePeriodCn("上午");
+            } else if (courseListVo.getTimePeriod() == 2) {
+                courseListVo.setTimePeriodCn("下午");
+            } else if (courseListVo.getTimePeriod() == 3) {
+                courseListVo.setTimePeriodCn("晚上");
+            }
+        }
+        return list;
+    }
+
     @Override
     public String getPreCheck(String preCheckType, String courseId, String swapCourseId, String swapDate, String subTeacherId) {
         if (preCheckType != null && !"".equals(preCheckType)) {

+ 49 - 0
src/main/java/com/xjrsoft/module/schedule/dto/CourseTableAdjustDto1.java

@@ -0,0 +1,49 @@
+package com.xjrsoft.module.schedule.dto;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.io.Serializable;
+import java.util.List;
+
+
+/**
+ * @title: 寝室
+ * @Author dzx
+ * @Date: 2023-12-27
+ * @Version 1.0
+ */
+@Data
+public class CourseTableAdjustDto1 implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    @ApiModelProperty("教师id")
+    private Long teacherId;
+
+    @ApiModelProperty("调整日期")
+    private String adjustDate;
+
+    @ApiModelProperty("课次")
+    private  String timeNumber;
+
+
+    @ApiModelProperty("教师id")
+    private Long applicantTeacherId;
+
+    @ApiModelProperty("调整日期")
+    private String exchangeDate;
+
+    @ApiModelProperty("周几(后台自动计算)")
+    private Integer week;
+
+    @ApiModelProperty("班级id")
+    private String classId;
+
+    @ApiModelProperty("调课类型")
+    private String adjustType;
+
+    @ApiModelProperty("除外的id")
+    private List<Long> exceptCourseList;
+
+}

+ 37 - 0
src/main/resources/mapper/courseTable/CourseTable.xml

@@ -71,6 +71,43 @@
         </if>
         order by t4.number asc
     </select>
+
+    <select id="getAdjustList1" parameterType="com.xjrsoft.module.schedule.dto.CourseTableAdjustDto" resultType="com.xjrsoft.module.schedule.vo.CourseListVo">
+        SELECT t1.time_period,t4.short_name as time_number,t1.course_name,t2.name AS class_name,t3.name AS classroom_name,t1.id,t2.id as class_id FROM course_table t1
+        LEFT JOIN base_class t2 ON t1.class_id = t2.id
+        LEFT JOIN base_classroom t3 ON t1.site_id = t3.id
+        left join class_time t4 on t1.time_number = t4.number and t1.time_period = t4.time_period
+        WHERE t1.status = 1
+        <if test="dto.adjustType != null and dto.adjustType == 'course_exchange'">
+            AND t1.teacher_id = #{dto.teacherId}
+        </if>
+        <if test="dto.adjustType != null and dto.adjustType == 'course_substitute'">
+            AND t1.teacher_id like concat('%', #{dto.teacherId},'%')
+        </if>
+        AND t1.weeks = #{dto.week} AND t1.schedule_date = #{dto.adjustDate}
+        <if test="dto.classId != null and dto.classId != ''">
+            and t1.class_id = #{dto.classId}
+        </if>
+        <if test="dto.exceptCourseList != null and dto.exceptCourseList.size > 0">
+            AND t1.id not in
+            <foreach item="courseId" collection="dto.exceptCourseList" open="(" separator="," close=")">
+                #{courseId}
+            </foreach>
+        </if>
+
+        <if test="dto.applicantTeacherId != null and dto.applicantTeacherId != '' and dto.exchangeDate != null and dto.exchangeDate != '' and dto.timeNumber != null and dto.timeNumber != ''">
+            AND NOT EXISTS (
+            SELECT 1
+            FROM course_table t_prev
+            WHERE DATE(t_prev.schedule_date) = #{exchangeDate}
+            AND t_prev.time_number = #{timeNumber}
+            AND FIND_IN_SET(t_prev.teacher_id, #{applicantTeacherId}) > 0
+            )
+        </if>
+        order by t4.number asc
+    </select>
+
+
     <select id="getExceptCourseList" parameterType="java.lang.Long" resultType="com.xjrsoft.module.schedule.entity.WfCourseAdjust">
         SELECT a1.* FROM wf_course_adjust a1
         INNER JOIN xjr_workflow_form_relation a2 ON a1.id = a2.form_key_value