Explorar el Código

评价管理调整

dzx hace 1 mes
padre
commit
293e0ac5fd

+ 7 - 1
src/main/java/com/xjrsoft/common/enums/EvaluateTypeEnum.java

@@ -14,7 +14,13 @@ public enum EvaluateTypeEnum {
     /**
      *  教官评价班级
      */
-    DRILLMASTER_EVALUATE_CLASS("dm_evaluate_class", "教官评价班级");
+    DRILLMASTER_EVALUATE_CLASS("dm_evaluate_class", "教官评价班级"),
+
+    STUDENT_EVALUATE_COURSE_TEACHER("stu_evaluate_tea", "学生评价任课教师"),
+
+    TEACHER_EVALUATE_CLASS("tea_evaluate_class", "任课教师对班级评价"),
+
+    TEACHER_EVALUATE("teacher_evaluate", "任课教师对班级评价");
 
     final String code;
     final String value;

+ 0 - 13
src/main/java/com/xjrsoft/module/evaluate/controller/EvaluateTemplateController.java

@@ -7,23 +7,18 @@ import com.alibaba.excel.EasyExcel;
 import com.alibaba.excel.support.ExcelTypeEnum;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
-import com.github.yulichang.wrapper.MPJLambdaWrapper;
-import com.xjrsoft.common.enums.DeleteMark;
 import com.xjrsoft.common.model.result.RT;
 import com.xjrsoft.common.page.ConventPage;
 import com.xjrsoft.common.page.PageOutput;
-import com.xjrsoft.common.utils.VoToColumnUtil;
 import com.xjrsoft.module.evaluate.dto.AddEvaluateTemplateDto;
 import com.xjrsoft.module.evaluate.dto.EvaluateTemplatePageDto;
 import com.xjrsoft.module.evaluate.dto.UpdateEvaluateTemplateDto;
 import com.xjrsoft.module.evaluate.dto.UpdateEvaluateTemplateStatusDto;
-import com.xjrsoft.module.evaluate.entity.EvaluateManage;
 import com.xjrsoft.module.evaluate.entity.EvaluateTemplate;
 import com.xjrsoft.module.evaluate.service.IEvaluateManageService;
 import com.xjrsoft.module.evaluate.service.IEvaluateTemplateService;
 import com.xjrsoft.module.evaluate.vo.EvaluateTemplatePageVo;
 import com.xjrsoft.module.evaluate.vo.EvaluateTemplateVo;
-import com.xjrsoft.module.organization.entity.User;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import lombok.AllArgsConstructor;
@@ -127,14 +122,6 @@ public class EvaluateTemplateController {
     @ApiOperation(value = "删除评价模版")
     @SaCheckPermission("evaluatetemplate:delete")
     public RT<Boolean> delete(@Valid @RequestBody List<Long> ids){
-        List<EvaluateManage> list = evaluateManageService.list(
-                new QueryWrapper<EvaluateManage>().lambda()
-                        .in(EvaluateManage::getEvaluateTemplateId, ids)
-                        .eq(EvaluateManage::getDeleteMark, DeleteMark.NODELETE.getCode())
-        );
-        if(!list.isEmpty()){
-            return RT.error("该模板已经被使用,无法删除");
-        }
         return RT.ok(evaluateTemplateService.removeBatchByIds(ids));
 
     }

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

@@ -4,6 +4,8 @@ import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
 
 import java.io.Serializable;
+import java.time.LocalDate;
+import java.util.List;
 
 
 /**
@@ -35,4 +37,13 @@ public class EvaluateObjectListDto implements Serializable {
 
     @ApiModelProperty("评价类型")
     private String evaluateType;
+
+    @ApiModelProperty("班级id")
+    private List<Long> classIds;
+
+    @ApiModelProperty("开始日期")
+    private LocalDate startDate;
+
+    @ApiModelProperty("结束日期")
+    private LocalDate endDate;
 }

+ 24 - 4
src/main/java/com/xjrsoft/module/evaluate/service/impl/EvaluateObjectServiceImpl.java

@@ -33,8 +33,10 @@ import lombok.AllArgsConstructor;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
+import java.time.ZoneId;
 import java.util.ArrayList;
 import java.util.Date;
+import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 import java.util.Random;
@@ -228,10 +230,7 @@ public class EvaluateObjectServiceImpl extends MPJBaseServiceImpl<EvaluateObject
                 objectListVo.setExecuterCount(executerList.size());
                 objectListVo.setExecuterList(executerList);
             }
-        }
-
-        //入参评价类型是教官评价班级
-        if(dto.getEvaluateType() != null && dto.getEvaluateType().equals(EvaluateTypeEnum.DRILLMASTER_EVALUATE_CLASS.getCode())) {
+        }else if(dto.getEvaluateType() != null && dto.getEvaluateType().equals(EvaluateTypeEnum.DRILLMASTER_EVALUATE_CLASS.getCode())) {//入参评价类型是教官评价班级
             newObjectList = evaluateObjectMapper.getNewObjectList(dto);
             List<EvaluateExecuterVo> newExecuterList = evaluateObjectMapper.getNewExecuterList(dto);
 
@@ -239,6 +238,27 @@ public class EvaluateObjectServiceImpl extends MPJBaseServiceImpl<EvaluateObject
                 objectListVo.setExecuterCount(newExecuterList.size());
                 objectListVo.setExecuterList(newExecuterList);
             }
+        }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);
+            for (EvaluateObjectListVo objectListVo : newObjectList) {
+                List<EvaluateExecuterVo> currentExecuterList = new ArrayList<>();
+                for (EvaluateExecuterVo executerVo : newExecuterList) {
+                    if(!objectListVo.getObjectId().equals(executerVo.getClassId())){
+                        continue;
+                    }
+                    currentExecuterList.add(executerVo);
+                }
+                objectListVo.setExecuterCount(currentExecuterList.size());
+                objectListVo.setExecuterList(currentExecuterList);
+            }
         }
 
         return newObjectList;

+ 40 - 2
src/main/resources/mapper/evaluate/EvaluateObjectMapper.xml

@@ -41,14 +41,25 @@
             FROM base_class t1
             LEFT JOIN xjr_user t2 ON t1.teacher_id = t2.id
             WHERE t1.delete_mark = 0
+            <if test="dto.gradeId != null">
+                and t1.grade_id = #{dto.gradeId}
+            </if>
         </if>
         <if test="dto.evaluateType != null and dto.evaluateType.equals('dm_evaluate_class')">
             SELECT t1.id AS object_id,t1.name AS object_name,t1.grade_id
             FROM base_class t1
             WHERE t1.delete_mark = 0
+            <if test="dto.gradeId != null">
+                and t1.grade_id = #{dto.gradeId}
+            </if>
         </if>
-        <if test="dto.gradeId != null">
-            and t1.grade_id = #{dto.gradeId}
+        <if test="dto.evaluateType != null and dto.evaluateType.equals('tea_evaluate_class')">
+            SELECT t1.id AS object_id,t1.name AS object_name,t1.grade_id
+            FROM base_class t1
+            WHERE t1.delete_mark = 0
+            <if test="dto.gradeId != null">
+                and t1.grade_id = #{dto.gradeId}
+            </if>
         </if>
     </select>
 
@@ -69,6 +80,33 @@
             where t1.post_id = 1742726034814464002
             and t.delete_mark = 0
         </if>
+        <if test="dto.evaluateType != null and dto.evaluateType.equals('tea_evaluate_class')">
+            SELECT DISTINCT t2.class_id,t1.id,t1.name FROM xjr_user t1
+            INNER JOIN course_table t2 ON t2.teacher_id LIKE CONCAT('%', t1.id,'%')
+            WHERE 1 = 1
+            <if test="dto.classIds != null and !dto.classIds.isEmpty()">
+                and t2.class_id in
+                <foreach item="id" index="index" collection="dto.classIds" open="(" close=")"
+                         separator=",">
+                    #{id}
+                </foreach>
+            </if>
+            AND t2.schedule_date BETWEEN #{dto.startDate} AND #{dto.endDate}
+            AND (t2.adjust_type = 'course_exchange' OR t2.adjust_type = 'course_replace' OR t2.adjust_type IS NULL)
+            UNION
+            SELECT DISTINCT t2.class_id,t1.id,t1.name FROM xjr_user t1
+            INNER JOIN course_table_bak t2 ON t2.teacher_id LIKE CONCAT('%', t1.id,'%')
+            WHERE 1 = 1
+            <if test="dto.classIds != null and !dto.classIds.isEmpty()">
+                and t2.class_id in
+                <foreach item="id" index="index" collection="dto.classIds" open="(" close=")"
+                         separator=",">
+                    #{id}
+                </foreach>
+            </if>
+            AND t2.schedule_date BETWEEN #{dto.startDate} AND #{dto.endDate}
+            AND (t2.adjust_type = 'course_exchange' OR t2.adjust_type = 'course_replace' OR t2.adjust_type IS NULL)
+        </if>
     </select>
 
     <delete id="objectGradeDeleteExecuter" parameterType="com.xjrsoft.module.evaluate.dto.ObjectGradeDeleteDto">

+ 18 - 14
src/test/java/com/xjrsoft/module/job/JianyuekbScheduleTaskTest2.java

@@ -129,7 +129,7 @@ class JianyuekbScheduleTaskTest2 {
         doExecute();
     }
     public void doExecute() {
-        String sql = "SELECT * FROM course_receive_msg WHERE delete_mark = 0 AND is_callback IS NULL";
+        String sql = "SELECT * FROM course_receive_msg WHERE delete_mark = 0 AND is_callback = -1";
         List<Map<String, Object>> receiveMsgs = SqlRunnerAdapter.db().selectList(sql);
         if(receiveMsgs.isEmpty()){
             return;
@@ -206,19 +206,19 @@ class JianyuekbScheduleTaskTest2 {
                 long between = ChronoUnit.DAYS.between(startDateObj, endDateObj);
                 int times = Integer.parseInt(((between / 7) + 1) + "");
 
-                for (int index = 0; index < times; index ++) {
-                    LocalDate statrTime = startDateObj.plusDays(index * 7L);
-                    String startDate = statrTime.format(formatter);
-                    LocalDate endTime = statrTime.plusDays(6L);
-                    if(endTime.isAfter(endDateObj)){
-                        endTime = endDateObj;
-                    }
-
-                    String endDate = endTime.format(formatter);
-                    //获取课表并存到数据库
-                    JsonArray scheduleInfo = dataUtil.getScheduleInfoByGrade(eduYearSerialNo, startDate, endDate);
-                    allScheduleInfo.addAll(scheduleInfo);
-                }
+//                for (int index = 0; index < times; index ++) {
+//                    LocalDate statrTime = startDateObj.plusDays(index * 7L);
+//                    String startDate = statrTime.format(formatter);
+//                    LocalDate endTime = statrTime.plusDays(6L);
+//                    if(endTime.isAfter(endDateObj)){
+//                        endTime = endDateObj;
+//                    }
+//
+//                    String endDate = endTime.format(formatter);
+//                    //获取课表并存到数据库
+//                    JsonArray scheduleInfo = dataUtil.getScheduleInfoByGrade(eduYearSerialNo, startDate, endDate);
+//                    allScheduleInfo.addAll(scheduleInfo);
+//                }
 
                 updSql = "update course_receive_msg set is_callback = 1 where id = " + receiveMsg.get("id").toString();
                 SqlRunnerAdapter.db().update(updSql);
@@ -327,6 +327,9 @@ class JianyuekbScheduleTaskTest2 {
         }
 
         for (WfCourseAdjust courseAdjust : list) {
+            if(courseAdjust.getUserId() == 14954805813957L){
+                System.out.println(courseAdjust.getId());
+            }
             List<CourseTable> courseList = courseTableService.list(
                     new MPJLambdaWrapper<CourseTable>()
                             .select(CourseTable::getId)
@@ -345,6 +348,7 @@ class JianyuekbScheduleTaskTest2 {
             if(courseList.size() != courseCount){
                 //表明课程变化了,需要重新申请,需要将原来的申请作废并进行微信消息通知
                 courseAdjust.setEnabledMark(EnabledMark.DISABLED.getCode());
+
                 courseAdjust.setCancelReason("由于课表更新,当前调/顶课课程发生变化,该调顶课已失效,请重新发起调顶课");
                 cancelList.add(courseAdjust);
                 List<String> thing16Str = new ArrayList<>();