Kaynağa Gözat

课时统计

dzx 1 yıl önce
ebeveyn
işleme
92002b3450

+ 6 - 3
src/main/java/com/xjrsoft/module/classtime/dto/AddClassTimeDeleteDto.java

@@ -2,9 +2,10 @@ package com.xjrsoft.module.classtime.dto;
 
 import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
+import org.springframework.format.annotation.DateTimeFormat;
 
 import java.io.Serializable;
-import java.util.Date;
+import java.time.LocalDate;
 
 
 
@@ -37,12 +38,14 @@ public class AddClassTimeDeleteDto implements Serializable {
     /**
     * 开始日期
     */
+    @DateTimeFormat(pattern = "yyyy-MM-dd")
     @ApiModelProperty("开始日期")
-    private Date startDate;
+    private LocalDate startDate;
     /**
     * 结束日期
     */
+    @DateTimeFormat(pattern = "yyyy-MM-dd")
     @ApiModelProperty("结束日期")
-    private Date endDate;
+    private LocalDate endDate;
 
 }

+ 7 - 0
src/main/java/com/xjrsoft/module/classtime/mapper/ClassTimeStatisticsMapper.java

@@ -31,4 +31,11 @@ public interface ClassTimeStatisticsMapper extends MPJBaseMapper<ClassTimeStatis
     List<WfTeacherCourseTime> getWfTeacherCourseTimeList();
 
     List<CourseListVo> getCourseList(ClassTimeStatistics dto);
+
+    /**
+     * 查询被顶课老师的信息
+     * @param dto
+     * @return
+     */
+    List<CourseListVo> getSubstituteList(ClassTimeStatistics dto);
 }

+ 75 - 1
src/main/java/com/xjrsoft/module/classtime/service/impl/ClassTimeStatisticsServiceImpl.java

@@ -5,7 +5,10 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import com.github.yulichang.base.MPJBaseServiceImpl;
 import com.google.gson.JsonArray;
+import com.google.gson.JsonElement;
+import com.google.gson.JsonObject;
 import com.google.gson.JsonParser;
+import com.xjrsoft.common.enums.CourseAdjustTypeEnum;
 import com.xjrsoft.common.enums.CourseTimeTypeEnum;
 import com.xjrsoft.common.enums.EnabledMark;
 import com.xjrsoft.module.classtime.dto.AddClassTimeStatisticsDto;
@@ -27,6 +30,7 @@ import org.springframework.transaction.annotation.Transactional;
 
 import java.time.LocalDate;
 import java.util.ArrayList;
+import java.util.Arrays;
 import java.util.Date;
 import java.util.HashMap;
 import java.util.HashSet;
@@ -134,9 +138,20 @@ public class ClassTimeStatisticsServiceImpl extends MPJBaseServiceImpl<ClassTime
 
         //费用设置jsonArray
         JsonArray costSetArray = parser.parse(statistics.getCostSetJson()).getAsJsonArray();
+        Map<String, Double> costSetMap = new HashMap<>();
+        for (JsonElement jsonElement : costSetArray) {
+            JsonObject object = jsonElement.getAsJsonObject();
+            costSetMap.put(object.get("field").getAsString(), object.get("value").getAsDouble());
+        }
+
+
         //权重设置jsonArray
         JsonArray weightSetArray = parser.parse(statistics.getWeightSetJson()).getAsJsonArray();
-
+        Map<String, Double> weightSetMap = new HashMap<>();
+        for (JsonElement jsonElement : weightSetArray) {
+            JsonObject object = jsonElement.getAsJsonObject();
+            weightSetMap.put(object.get("label").getAsString(), object.get("value").getAsDouble());
+        }
         //查询课程数据
         List<CourseListVo> allCourseList = this.baseMapper.getCourseList(statistics);
 
@@ -160,6 +175,8 @@ public class ClassTimeStatisticsServiceImpl extends MPJBaseServiceImpl<ClassTime
             deleteMap.put(classId, new HashSet<>(dateList));
         }
 
+        //查询所有老师发起顶课通过的数量(只查询事假、病假),也要分别计算早自习、晚自习、正课、如果日期出入课时删除中,也需要跳过
+        List<CourseListVo> substituteList = this.baseMapper.getSubstituteList(statistics);
 
         //循环教师,准备开始计算
         for (TeacherListVo teacher : teacherList) {
@@ -189,7 +206,11 @@ public class ClassTimeStatisticsServiceImpl extends MPJBaseServiceImpl<ClassTime
                     record.setClassTime6(sum);
                 }
             }
+            //早自习、正课、晚辅、顶课、调课
+            Double classTime7 = 0D,classTime8 = 0D,classTime9 = 0D,classTime10 = 0D,classTime11 = 0D;
 
+            List<String> zkList = Arrays.asList("上1","上2","上3","上4","下1","下2","下3","下4");
+            List<String> wzxList = Arrays.asList("晚1","晚2","晚3");
             //查询出老师的课程
             List<CourseListVo> courseList = allCourseList.stream()
                     .filter(x -> x.getTeacherId().contains(teacher.getId().toString()))
@@ -201,8 +222,61 @@ public class ClassTimeStatisticsServiceImpl extends MPJBaseServiceImpl<ClassTime
                 if(deleteDates.contains(courseListVo.getScheduleDate())){
                     continue;
                 }
+                if("早自习".equals(courseListVo.getShortName())){
+                    classTime7 ++;
+                }else if(zkList.contains(courseListVo.getShortName())){
+                    classTime8 ++;
+                }else if(wzxList.contains(courseListVo.getShortName())){
+                    classTime9 ++;
+                }
+
+                if(courseListVo.getAdjustType() != null && !courseListVo.getAdjustType().isEmpty()){
+                    if(CourseAdjustTypeEnum.courseSubstitute.getCode().equals(courseListVo.getAdjustType())){
+                        classTime10 ++;
+                    }else if(CourseAdjustTypeEnum.courseExchange.getCode().equals(courseListVo.getAdjustType())){
+                        classTime11 ++;
+                    }
+                }
             }
+            //计算总课时
+            allClassTime = allClassTime + classTime7 + classTime8 + classTime9;
             record.setAllClassTime(allClassTime);
+
+            //计算费用,根据聘用类型判断费用问题
+            Double zzxCost = 0d;//早自习费用
+            if("FB1601".equals(teacher.getEmployType())){
+                zzxCost = costSetMap.get("cost1");
+            }else if("FB1602".equals(teacher.getEmployType())){
+                zzxCost = costSetMap.get("cost2");
+            }
+
+            Double zkCost = 0d;//正课费用
+            if("FB1601".equals(teacher.getEmployType())){
+                zkCost = costSetMap.get("cost3");
+            }else if("FB1602".equals(teacher.getEmployType())){
+                zkCost = costSetMap.get("cost4");
+            }
+
+            Double wzxCost = 0d;//晚自习费用
+            if("FB1601".equals(teacher.getEmployType())){
+                wzxCost = costSetMap.get("cost5");
+            }else if("FB1602".equals(teacher.getEmployType())){
+                wzxCost = costSetMap.get("cost6");
+            }
+
+            Double dkCost = 0d;//顶课费用,顶课老师加钱
+            if("FB1601".equals(teacher.getEmployType())){
+                dkCost = costSetMap.get("cost11");
+            }else if("FB1602".equals(teacher.getEmployType())){
+                dkCost = costSetMap.get("cost12");
+            }
+
+            Double bdkCost = 0d;//顶课费用,被顶课老师扣钱
+            if("FB1601".equals(teacher.getEmployType())){
+                bdkCost = costSetMap.get("cost13");
+            }else if("FB1602".equals(teacher.getEmployType())){
+                bdkCost = costSetMap.get("cost14");
+            }
             
         }
         return true;

+ 10 - 0
src/main/resources/mapper/classtime/ClassTimeStatisticsMapper.xml

@@ -23,4 +23,14 @@
         WHERE t1.schedule_date BETWEEN #{dto.statrDate} and #{dto.endDate}
     </select>
 
+    <select id="getSubstituteList" parameterType="com.xjrsoft.module.classtime.entity.ClassTimeStatistics" resultType="com.xjrsoft.module.classtime.vo.CourseListVo">
+        SELECT t4.short_name,t3.schedule_date,t3.class_id,t3.teacher_id FROM wf_course_adjust t1
+        INNER JOIN xjr_workflow_form_relation t2 ON t1.id = t2.form_key_value
+        INNER JOIN course_table_bak t3 ON t1.id = t3.wf_course_adjust_id
+        LEFT JOIN class_time t4 ON t3.time_period = t4.time_period AND t3.time_number = t4.number
+        WHERE t1.delete_mark = 0 AND t2.current_state = 'COMPLETED'
+        AND t1.reason IN ('sick _leave','leave_absence')
+        AND t3.schedule_date BETWEEN #{dto.statrDate} and #{dto.endDate}
+    </select>
+
 </mapper>