Bläddra i källkod

评价管理调整

dzx 4 veckor sedan
förälder
incheckning
8d495e9101

+ 33 - 0
src/main/java/com/xjrsoft/module/courseTable/dto/ClassTeacherDto.java

@@ -0,0 +1,33 @@
+package com.xjrsoft.module.courseTable.dto;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.io.Serializable;
+import java.time.LocalDate;
+import java.util.List;
+
+
+/**
+* @title: 活动信息
+* @Author dzx
+* @Date: 2024-07-19
+* @Version 1.0
+*/
+@Data
+public class ClassTeacherDto implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    @ApiModelProperty("年级id")
+    private Long gradeId;
+
+    @ApiModelProperty("班级id")
+    private List<Long> classIds;
+
+    @ApiModelProperty("开始日期")
+    private LocalDate startDate;
+
+    @ApiModelProperty("结束日期")
+    private LocalDate endDate;
+}

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

@@ -1,6 +1,8 @@
 package com.xjrsoft.module.courseTable.mapper;
 
 import com.github.yulichang.base.MPJBaseMapper;
+import com.xjrsoft.module.courseTable.dto.ClassTeacherDto;
+import com.xjrsoft.module.courseTable.vo.ClassTeacherVo;
 import com.xjrsoft.module.schedule.dto.ClassOptionDto;
 import com.xjrsoft.module.courseTable.entity.CourseTable;
 import com.xjrsoft.module.schedule.entity.WfCourseAdjust;
@@ -32,4 +34,6 @@ public interface CourseTableMapper extends MPJBaseMapper<CourseTable> {
 
     //查询流程正在进行中或者已经完成的调课或者顶课申请
     List<WfCourseAdjust> getExceptCourseList(@Param("userId") Long userId);
+
+    List<ClassTeacherVo> getClassTeacherIds(@Param("dto") ClassTeacherDto dto);
 }

+ 21 - 0
src/main/java/com/xjrsoft/module/courseTable/vo/ClassTeacherVo.java

@@ -0,0 +1,21 @@
+package com.xjrsoft.module.courseTable.vo;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+/**
+* @title: 第二课堂分页列表出参
+* @Author dzx
+* @Date: 2024-07-29
+* @Version 1.0
+*/
+@Data
+public class ClassTeacherVo {
+
+    @ApiModelProperty("班级id")
+    private Long classId;
+
+    @ApiModelProperty("教师id(多个以“,”隔开)")
+    private String teacherId;
+
+}

+ 0 - 8
src/main/java/com/xjrsoft/module/evaluate/dto/EvaluateObjectListDto.java

@@ -38,12 +38,4 @@ public class EvaluateObjectListDto implements Serializable {
     @ApiModelProperty("评价类型")
     private String evaluateType;
 
-    @ApiModelProperty("班级id")
-    private List<Long> classIds;
-
-    @ApiModelProperty("开始日期")
-    private LocalDate startDate;
-
-    @ApiModelProperty("结束日期")
-    private LocalDate endDate;
 }

+ 34 - 9
src/main/java/com/xjrsoft/module/evaluate/service/impl/EvaluateObjectServiceImpl.java

@@ -11,6 +11,9 @@ import com.xjrsoft.common.enums.EvaluateTypeEnum;
 import com.xjrsoft.common.exception.MyException;
 import com.xjrsoft.common.utils.VoToColumnUtil;
 import com.xjrsoft.module.base.entity.BaseGrade;
+import com.xjrsoft.module.courseTable.dto.ClassTeacherDto;
+import com.xjrsoft.module.courseTable.mapper.CourseTableMapper;
+import com.xjrsoft.module.courseTable.vo.ClassTeacherVo;
 import com.xjrsoft.module.evaluate.dto.AddEvaluateExecuterDto;
 import com.xjrsoft.module.evaluate.dto.AddEvaluateObjectDto;
 import com.xjrsoft.module.evaluate.dto.EvaluateObjectGradeListDto;
@@ -29,6 +32,9 @@ import com.xjrsoft.module.evaluate.vo.EvaluateExecuterVo;
 import com.xjrsoft.module.evaluate.vo.EvaluateManageVo;
 import com.xjrsoft.module.evaluate.vo.EvaluateObjectGradeListVo;
 import com.xjrsoft.module.evaluate.vo.EvaluateObjectListVo;
+import com.xjrsoft.module.organization.entity.User;
+import com.xjrsoft.module.organization.service.IUserService;
+import com.xjrsoft.module.teacher.entity.BaseTeacher;
 import lombok.AllArgsConstructor;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
@@ -55,6 +61,8 @@ public class EvaluateObjectServiceImpl extends MPJBaseServiceImpl<EvaluateObject
 
     private final EvaluateObjectMapper evaluateObjectMapper;
     private final EvaluateExecuterMapper evaluateExecuterMapper;
+    private final CourseTableMapper courseTableMapper;
+    private final IUserService userService;
 
 
     @Override
@@ -240,21 +248,38 @@ public class EvaluateObjectServiceImpl extends MPJBaseServiceImpl<EvaluateObject
             }
         }else if(dto.getEvaluateType() != null && dto.getEvaluateType().equals(EvaluateTypeEnum.TEACHER_EVALUATE_CLASS.getCode())) {//任课教师对班级评价
             EvaluateManage manage = evaluateManageMapper.selectById(dto.getEvaluateManageId());
-
             newObjectList = evaluateObjectMapper.getNewObjectList(dto);
-            List<Long> classIds = newObjectList.stream().map(x -> Long.parseLong(x.getObjectId())).collect(Collectors.toList());
-            dto.setClassIds(classIds);
-            dto.setStartDate(manage.getStartTime().toInstant().atZone(ZoneId.systemDefault()).toLocalDate());
-            dto.setEndDate(manage.getEndTime().toInstant().atZone(ZoneId.systemDefault()).toLocalDate());
 
-            List<EvaluateExecuterVo> newExecuterList = evaluateObjectMapper.getNewExecuterList(dto);
+            List<ClassTeacherVo> classTeacher = courseTableMapper.getClassTeacherIds(
+                    new ClassTeacherDto() {{
+                        setStartDate(manage.getStartTime().toInstant().atZone(ZoneId.systemDefault()).toLocalDate());
+                        setGradeId(dto.getGradeId());
+                        setEndDate(manage.getEndTime().toInstant().atZone(ZoneId.systemDefault()).toLocalDate());
+                    }}
+            );
+
+            List<User> userList = userService.list(
+                    new MPJLambdaWrapper<User>()
+                            .select(User::getId)
+                            .select(User.class, x -> VoToColumnUtil.fieldsToColumns(User.class).contains(x.getProperty()))
+                            .innerJoin(BaseTeacher.class, BaseTeacher::getUserId, User::getId)
+            );
+            Map<Long, String> userMap = userList.stream().collect(Collectors.toMap(User::getId, User::getName));
             for (EvaluateObjectListVo objectListVo : newObjectList) {
                 List<EvaluateExecuterVo> currentExecuterList = new ArrayList<>();
-                for (EvaluateExecuterVo executerVo : newExecuterList) {
-                    if(!objectListVo.getObjectId().equals(executerVo.getClassId())){
+                for (ClassTeacherVo executerVo : classTeacher) {
+                    if(!objectListVo.getObjectId().equals(executerVo.getClassId().toString())){
                         continue;
                     }
-                    currentExecuterList.add(executerVo);
+
+                    String[] teacherIds = executerVo.getTeacherId().split(",");
+                    for (String teacherId : teacherIds) {
+                        EvaluateExecuterVo evaluateExecuterVo = new EvaluateExecuterVo();
+                        evaluateExecuterVo.setEvaluateObjectId(teacherId);
+                        evaluateExecuterVo.setExecuterName(userMap.get(Long.parseLong(teacherId)));
+                        evaluateExecuterVo.setEvaluateManageId(dto.getEvaluateManageId().toString());
+                        currentExecuterList.add(evaluateExecuterVo);
+                    }
                 }
                 objectListVo.setExecuterCount(currentExecuterList.size());
                 objectListVo.setExecuterList(currentExecuterList);

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

@@ -82,4 +82,18 @@
             SELECT DISTINCT class_id FROM course_table WHERE teacher_id like concat('%', #{dto.userId},'%')
         )
     </select>
+
+    <select id="getClassTeacherIds" parameterType="com.xjrsoft.module.courseTable.dto.ClassTeacherDto" resultType="com.xjrsoft.module.courseTable.vo.ClassTeacherVo">
+        SELECT DISTINCT t1.class_id,t1.teacher_id FROM course_table t1
+        WHERE t1.class_id IN (SELECT id FROM base_class WHERE grade_id = #{dto.gradeId})
+        AND t1.schedule_date BETWEEN #{dto.startDate} AND #{dto.endDate}
+        AND (t1.adjust_type = 'course_exchange' OR t1.adjust_type = 'course_replace' OR t1.adjust_type IS NULL)
+        UNION
+        SELECT DISTINCT t1.class_id,t1.teacher_id FROM course_table_bak t1
+        WHERE t1.class_id IN (SELECT id FROM base_class WHERE grade_id = #{dto.gradeId})
+        AND t1.schedule_date BETWEEN #{dto.startDate} AND #{dto.endDate}
+        AND (t1.adjust_type = 'course_exchange' OR t1.adjust_type = 'course_replace' OR t1.adjust_type IS NULL)
+    </select>
+
+
 </mapper>