Procházet zdrojové kódy

1、课时统计
2、班级巡查考核添加接口调整

dzx před 1 rokem
rodič
revize
113f6ebe24

+ 54 - 19
src/main/java/com/xjrsoft/module/classtime/service/impl/ClassTimeStatisticsServiceImpl.java

@@ -28,6 +28,7 @@ import lombok.AllArgsConstructor;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
+import java.math.BigDecimal;
 import java.time.LocalDate;
 import java.util.ArrayList;
 import java.util.Arrays;
@@ -176,7 +177,7 @@ public class ClassTimeStatisticsServiceImpl extends MPJBaseServiceImpl<ClassTime
         }
 
         //查询所有老师发起顶课通过的数量(只查询事假、病假),也要分别计算早自习、晚自习、正课、如果日期出入课时删除中,也需要跳过
-        List<CourseListVo> substituteList = this.baseMapper.getSubstituteList(statistics);
+        List<CourseListVo> allSubstituteList = this.baseMapper.getSubstituteList(statistics);
 
         //循环教师,准备开始计算
         for (TeacherListVo teacher : teacherList) {
@@ -223,11 +224,11 @@ public class ClassTimeStatisticsServiceImpl extends MPJBaseServiceImpl<ClassTime
                     continue;
                 }
                 if("早自习".equals(courseListVo.getShortName())){
-                    classTime7 ++;
+                    classTime7 += weightSetMap.get(courseListVo.getShortName());
                 }else if(zkList.contains(courseListVo.getShortName())){
-                    classTime8 ++;
+                    classTime8 += weightSetMap.get(courseListVo.getShortName());
                 }else if(wzxList.contains(courseListVo.getShortName())){
-                    classTime9 ++;
+                    classTime9 += weightSetMap.get(courseListVo.getShortName());
                 }
 
                 if(courseListVo.getAdjustType() != null && !courseListVo.getAdjustType().isEmpty()){
@@ -242,41 +243,75 @@ public class ClassTimeStatisticsServiceImpl extends MPJBaseServiceImpl<ClassTime
             allClassTime = allClassTime + classTime7 + classTime8 + classTime9;
             record.setAllClassTime(allClassTime);
 
+            //计算该老师发起的事假、病假顶课数据
+            List<CourseListVo> substituteList = allSubstituteList.stream().filter(x -> x.getTeacherId().equals(teacher.getId().toString()))
+                    .collect(Collectors.toList());
+            Double reduceTime = 0d;
+            for (CourseListVo courseListVo : substituteList) {
+                Set<LocalDate> deleteDates = deleteMap.get(courseListVo.getClassId());
+                if(deleteDates.contains(courseListVo.getScheduleDate())){
+                    continue;
+                }
+                reduceTime += weightSetMap.get(courseListVo.getShortName());
+            }
+
             //计算费用,根据聘用类型判断费用问题
-            Double zzxCost = 0d;//早自习费用
+            Double classTimeAmount = 0d;
+            Double beyondClassTimeAmount = 0d;
+
+            BigDecimal zzxCost = BigDecimal.ZERO;//早自习费用
             if("FB1601".equals(teacher.getEmployType())){
-                zzxCost = costSetMap.get("cost1");
+                zzxCost = BigDecimal.valueOf(costSetMap.get("cost1"));
             }else if("FB1602".equals(teacher.getEmployType())){
-                zzxCost = costSetMap.get("cost2");
+                zzxCost = BigDecimal.valueOf(costSetMap.get("cost2"));
             }
+            classTimeAmount += BigDecimal.valueOf(classTime7).multiply(zzxCost).doubleValue();
 
-            Double zkCost = 0d;//正课费用
+            BigDecimal zkCost = BigDecimal.ZERO;//正课费用
             if("FB1601".equals(teacher.getEmployType())){
-                zkCost = costSetMap.get("cost3");
+                zkCost = BigDecimal.valueOf(costSetMap.get("cost3"));
             }else if("FB1602".equals(teacher.getEmployType())){
-                zkCost = costSetMap.get("cost4");
+                zkCost = BigDecimal.valueOf(costSetMap.get("cost4"));
             }
+            classTimeAmount += BigDecimal.valueOf(classTime8).multiply(zkCost).doubleValue();
 
-            Double wzxCost = 0d;//晚自习费用
+            BigDecimal wzxCost = BigDecimal.ZERO;//晚自习费用
             if("FB1601".equals(teacher.getEmployType())){
-                wzxCost = costSetMap.get("cost5");
+                wzxCost = BigDecimal.valueOf(costSetMap.get("cost5"));
             }else if("FB1602".equals(teacher.getEmployType())){
-                wzxCost = costSetMap.get("cost6");
+                wzxCost = BigDecimal.valueOf(costSetMap.get("cost6"));
             }
+            classTimeAmount += BigDecimal.valueOf(classTime9).multiply(wzxCost).doubleValue();
 
-            Double dkCost = 0d;//顶课费用,顶课老师加钱
+            BigDecimal dkCost = BigDecimal.ZERO;//顶课费用,顶课老师加钱
             if("FB1601".equals(teacher.getEmployType())){
-                dkCost = costSetMap.get("cost11");
+                dkCost = BigDecimal.valueOf(costSetMap.get("cost11"));
             }else if("FB1602".equals(teacher.getEmployType())){
-                dkCost = costSetMap.get("cost12");
+                dkCost = BigDecimal.valueOf(costSetMap.get("cost12"));
             }
+            classTimeAmount += BigDecimal.valueOf(classTime10).multiply(dkCost).doubleValue();
 
-            Double bdkCost = 0d;//顶课费用,被顶课老师扣钱
+            BigDecimal bdkCost = BigDecimal.ZERO;//顶课费用,被顶课老师扣钱
             if("FB1601".equals(teacher.getEmployType())){
-                bdkCost = costSetMap.get("cost13");
+                bdkCost = BigDecimal.valueOf(costSetMap.get("cost13"));
             }else if("FB1602".equals(teacher.getEmployType())){
-                bdkCost = costSetMap.get("cost14");
+                bdkCost = BigDecimal.valueOf(costSetMap.get("cost14"));
             }
+            //计算被扣除的费用
+            BigDecimal reduceTimeAmount = bdkCost.multiply(BigDecimal.valueOf(reduceTime));
+
+            //计算总课时费用
+            classTimeAmount = BigDecimal.valueOf(classTimeAmount).subtract(reduceTimeAmount).doubleValue();
+
+            //计算超出的课时
+            Double ccksTime = 0d;
+            if("FB1601".equals(teacher.getEmployType())){
+                bdkCost = BigDecimal.valueOf(costSetMap.get("cost9"));
+            }else if("FB1602".equals(teacher.getEmployType())){
+                bdkCost = BigDecimal.valueOf(costSetMap.get("cost10"));
+            }
+
+            Double totalAmount = classTimeAmount + 0d;
             
         }
         return true;

+ 13 - 11
src/main/java/com/xjrsoft/module/student/controller/BaseStudentAssessmentInspectionController.java

@@ -34,6 +34,7 @@ import org.springframework.web.bind.annotation.RequestParam;
 import org.springframework.web.bind.annotation.RestController;
 
 import javax.validation.Valid;
+import java.util.Date;
 import java.util.List;
 
 /**
@@ -48,13 +49,13 @@ import java.util.List;
 @AllArgsConstructor
 public class BaseStudentAssessmentInspectionController {
 
-    private final IBaseStudentAssessmentInspectionService baseStudentAssessmentInspectionService;
+    private final IBaseStudentAssessmentInspectionService inspectionService;
 
     @GetMapping(value = "/page")
     @ApiOperation(value = "学生班级巡查考核列表(分页)")
     @SaCheckPermission("basestudentassessmentinspection:detail")
     public RT<PageOutput<BaseStudentAssessmentInspectionPageVo>> page(@Valid BaseStudentAssessmentInspectionPageDto dto) {
-        Page<BaseStudentAssessmentInspectionPageVo> page = baseStudentAssessmentInspectionService.getPage(new Page<>(dto.getLimit(), dto.getSize()), dto);
+        Page<BaseStudentAssessmentInspectionPageVo> page = inspectionService.getPage(new Page<>(dto.getLimit(), dto.getSize()), dto);
         return RT.ok(ConventPage.getPageOutput(page, BaseStudentAssessmentInspectionPageVo.class));
     }
 
@@ -62,7 +63,7 @@ public class BaseStudentAssessmentInspectionController {
     @ApiOperation(value = "根据id查询学生班级巡查考核信息")
     @SaCheckPermission("basestudentassessmentinspection:detail")
     public RT<BaseStudentAssessmentInspectionVo> info(@RequestParam Long id) {
-        BaseStudentAssessmentInspectionVo result = baseStudentAssessmentInspectionService.getInfo(id);
+        BaseStudentAssessmentInspectionVo result = inspectionService.getInfo(id);
         return RT.ok(result);
     }
 
@@ -70,7 +71,7 @@ public class BaseStudentAssessmentInspectionController {
     @ApiOperation(value = "学生操行分记录管理列表(移动端)")
     @SaCheckPermission("basestudentbehaviormanage:detail")
     public RT<PageOutput<BaseStudentAssessmentInspectionMobilePageVo>> mobilePage(@Valid BaseStudentAssessmentInspectionMobilePageDto dto) {
-        Page<BaseStudentAssessmentInspectionMobilePageVo> page = baseStudentAssessmentInspectionService.getMobilePage(new Page<>(dto.getLimit(), dto.getSize()), dto);
+        Page<BaseStudentAssessmentInspectionMobilePageVo> page = inspectionService.getMobilePage(new Page<>(dto.getLimit(), dto.getSize()), dto);
         if (page == null) {
             return RT.ok(ConventPage.getPageOutputNull(BaseStudentAssessmentInspectionMobilePageVo.class));
         }
@@ -81,7 +82,7 @@ public class BaseStudentAssessmentInspectionController {
     @ApiOperation(value = "根据id查询学生班级巡查考核信息(移动端)")
     @SaCheckPermission("basestudentassessmentinspection:detail")
     public RT<BaseStudentAssessmentInspectionMobileVo> mobileInfo(@Valid Long id) {
-        BaseStudentAssessmentInspectionMobileVo result = baseStudentAssessmentInspectionService.getMobileInfo(id);
+        BaseStudentAssessmentInspectionMobileVo result = inspectionService.getMobileInfo(id);
         return RT.ok(result);
     }
 
@@ -89,8 +90,9 @@ public class BaseStudentAssessmentInspectionController {
     @ApiOperation(value = "新增学生班级巡查考核")
     @SaCheckPermission("basestudentassessmentinspection:add")
     public RT<Boolean> add(@Valid @RequestBody AddBaseStudentAssessmentInspectionDto dto) {
-        BaseStudentAssessmentInspection baseStudentAssessmentInspection = BeanUtil.toBean(dto, BaseStudentAssessmentInspection.class);
-        boolean isSuccess = baseStudentAssessmentInspectionService.save(baseStudentAssessmentInspection);
+        BaseStudentAssessmentInspection inspection = BeanUtil.toBean(dto, BaseStudentAssessmentInspection.class);
+        inspection.setCreateDate(new Date());
+        boolean isSuccess = inspectionService.save(inspection);
         return RT.ok(isSuccess);
     }
 
@@ -100,7 +102,7 @@ public class BaseStudentAssessmentInspectionController {
     public RT<Boolean> update(@Valid @RequestBody UpdateBaseStudentAssessmentInspectionDto dto) {
 
         BaseStudentAssessmentInspection baseStudentAssessmentInspection = BeanUtil.toBean(dto, BaseStudentAssessmentInspection.class);
-        return RT.ok(baseStudentAssessmentInspectionService.updateById(baseStudentAssessmentInspection));
+        return RT.ok(inspectionService.updateById(baseStudentAssessmentInspection));
 
     }
 
@@ -108,14 +110,14 @@ public class BaseStudentAssessmentInspectionController {
     @ApiOperation(value = "删除学生班级巡查考核")
     @SaCheckPermission("basestudentassessmentinspection:delete")
     public RT<Boolean> delete(@Valid @RequestBody List<Long> ids) {
-        return RT.ok(baseStudentAssessmentInspectionService.removeBatchByIds(ids));
+        return RT.ok(inspectionService.removeBatchByIds(ids));
     }
 
     @GetMapping(value = "/calss-quantitative-assessment-page")
     @ApiOperation(value = "班级量化考核列表(分页)")
     @SaCheckPermission("basestudentassessmentinspection:detail")
     public RT<PageOutput<CalssQuantitativeAssessmentPageVo>> calssQuantitativeAssessmentPage(@Valid CalssQuantitativeAssessmentPageDto dto) {
-        IPage<CalssQuantitativeAssessmentPageVo> page = baseStudentAssessmentInspectionService.getCalssQuantitativeAssessmentPage(new Page<>(dto.getLimit(), dto.getSize()), dto);
+        IPage<CalssQuantitativeAssessmentPageVo> page = inspectionService.getCalssQuantitativeAssessmentPage(new Page<>(dto.getLimit(), dto.getSize()), dto);
         return RT.ok(ConventPage.getPageOutput(page, CalssQuantitativeAssessmentPageVo.class));
     }
 
@@ -125,6 +127,6 @@ public class BaseStudentAssessmentInspectionController {
     @GetMapping("/export")
     @ApiOperation(value = "导出")
     public ResponseEntity<byte[]>  exportDataQuery() {
-        return baseStudentAssessmentInspectionService.getQuantitativeAssessmentExcelByte(new QuantitativeAssessmentExcelDto());
+        return inspectionService.getQuantitativeAssessmentExcelByte(new QuantitativeAssessmentExcelDto());
     }
 }

+ 33 - 25
src/main/java/com/xjrsoft/module/student/dto/AddBaseStudentAssessmentInspectionDto.java

@@ -24,65 +24,73 @@ public class AddBaseStudentAssessmentInspectionDto implements Serializable {
     */
     @ApiModelProperty("序号")
     private Integer sortCode;
-    /**
-    * 学生考核项目编号(base_student_assessment_category)
-    */
     @ApiModelProperty("学生考核项目编号(base_student_assessment_category)")
     private Long baseStudentAssessmentCategoryId;
     /**
-    * 班级考核项目编号(base_student_assessment_project)
-    */
+     * 班级考核项目编号(base_student_assessment_project)
+     */
     @ApiModelProperty("班级考核项目编号(base_student_assessment_project)")
     private Long baseStudentAssessmentProjectId;
     /**
-    * 学期ID(base_semester)
-    */
+     * 学期ID(base_semester)
+     */
     @ApiModelProperty("学期ID(base_semester)")
     private Long baseSemesterId;
     /**
-    * 入学年级(base_grade)
-    */
+     * 入学年级(base_grade)
+     */
     @ApiModelProperty("入学年级(base_grade)")
     private Long gradeId;
     /**
-    * 班级Ids(多选)
-    */
+     * 班级Ids(多选)
+     */
     @ApiModelProperty("班级Ids(多选)")
     private String classIds;
     /**
-    * 考核时间
-    */
+     * 学生Ids(多选)
+     */
+    @ApiModelProperty("学生Ids(多选)")
+    private String studentUserIds;
+    /**
+     * 考核时间
+     */
     @ApiModelProperty("考核时间")
     private Date assessmentDate;
     /**
-    * 分数
-    */
+     * 分数
+     */
     @ApiModelProperty("分数")
     private Double score;
     /**
-    * 分数类型(xjr_dictionary_item[score_type])
-    */
+     * 分数类型(xjr_dictionary_item[score_type])
+     */
     @ApiModelProperty("分数类型(xjr_dictionary_item[score_type])")
     private String scoreType;
     /**
-    * 考核用户ID(xjr_user)
-    */
+     * 考核用户ID(xjr_user)
+     */
     @ApiModelProperty("考核用户ID(xjr_user)")
     private Long assessmentUserId;
     /**
-    * 原因
-    */
+     * 原因
+     */
     @ApiModelProperty("原因")
     private String reason;
     /**
-    * 文件ID(xjr_file)
-    */
+     * 文件ID(xjr_file)
+     */
     @ApiModelProperty("文件ID(xjr_file)")
     private Long fileId;
     /**
-    * 状态(1:结束 0:未结束)
-    */
+     * 状态(1:结束 0:未结束)
+     */
     @ApiModelProperty("状态(1:结束 0:未结束)")
     private Integer status;
 
+    /**
+     * 考核对象
+     */
+    @ApiModelProperty("考核对象")
+    private String assessmentType;
+
 }

+ 2 - 2
src/main/resources/mapper/classtime/ClassTimeStatisticsMapper.xml

@@ -24,12 +24,12 @@
     </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
+        SELECT t4.short_name,t3.schedule_date,t3.class_id,t1.user_id as 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 t1.reason IN ('sick _leave','leave_absence') and t1.adjust_type = 'course_substitute'
         AND t3.schedule_date BETWEEN #{dto.statrDate} and #{dto.endDate}
     </select>