Browse Source

1、解决教师考勤,未能统计车辆进入的教师

dzx 8 months ago
parent
commit
6a86c72586

+ 7 - 10
src/main/java/com/xjrsoft/module/attendance/controller/StatisticsController.java

@@ -2,7 +2,6 @@ package com.xjrsoft.module.attendance.controller;
 
 import cn.dev33.satoken.annotation.SaCheckPermission;
 import cn.hutool.core.util.ObjectUtil;
-import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.github.yulichang.toolkit.MPJWrappers;
 import com.github.yulichang.wrapper.MPJLambdaWrapper;
 import com.xjrsoft.common.enums.OutInStatusEnum;
@@ -18,10 +17,10 @@ import com.xjrsoft.module.organization.entity.UserDeptRelation;
 import com.xjrsoft.module.outint.entity.CarOutInRecord;
 import com.xjrsoft.module.outint.entity.StudentOutInRecord;
 import com.xjrsoft.module.outint.entity.TeacherOutInRecord;
-import com.xjrsoft.module.outint.service.ICarOutInRecordService;
 import com.xjrsoft.module.outint.service.IStudentOutInRecordService;
 import com.xjrsoft.module.outint.service.ITeacherOutInRecordService;
 import com.xjrsoft.module.personnel.entity.CarMessageApply;
+import com.xjrsoft.module.personnel.service.ICarMessageApplyService;
 import com.xjrsoft.module.personnel.service.IReservationSchoolService;
 import com.xjrsoft.module.student.entity.BaseStudent;
 import com.xjrsoft.module.student.entity.BaseStudentSchoolRoll;
@@ -66,7 +65,7 @@ public class StatisticsController {
     private final IWfTeacherleaveService wfTeacherleaveService;
     private final IStudentLeaveService studentLeaveService;
     private final IReservationSchoolService reservationSchoolService;
-    private final ICarOutInRecordService carOutInRecordService;
+    private final ICarMessageApplyService carMessageApplyService;
 
     @GetMapping(value = "/teacher-statistics")
     @ApiOperation(value="教职工考勤统计")
@@ -110,10 +109,9 @@ public class StatisticsController {
                             .orderByAsc(TeacherOutInRecord::getRecordTime)
             );
 
-            List<CarOutInRecord> list = carOutInRecordService.list(
-                    new MPJLambdaWrapper<CarOutInRecord>()
-                            .select(CarOutInRecord.class, x -> VoToColumnUtil.fieldsToColumns(CarOutInRecord.class).contains(x.getProperty()))
-                            .leftJoin(CarMessageApply.class, CarMessageApply::getId, CarOutInRecord::getCarMessageApplyId)
+            long count = carMessageApplyService.count(
+                    new MPJLambdaWrapper<CarMessageApply>()
+                            .innerJoin(CarOutInRecord.class, CarOutInRecord::getCarMessageApplyId, CarMessageApply::getId)
                             .le(CarOutInRecord::getRecordTime, endTime)
                             .eq("DATE_FORMAT(record_time, '%Y-%m-%d')", endTime.toLocalDate())
                             .ge(dto.getTimePeriod() == 2 && amEndTime != null, CarOutInRecord::getRecordTime, amEndTime)
@@ -122,9 +120,8 @@ public class StatisticsController {
             );
 
             Set<Long> collect = outInRecords.stream().map(TeacherOutInRecord::getUserId).collect(Collectors.toSet());
-            Set<Long> userIds = new HashSet<>(collect);
             //实到人数
-            statisticsVo.setActualCount(Long.valueOf(collect.size()));
+            statisticsVo.setActualCount(Long.valueOf(collect.size()) + count);
 
             //查询教师请假人数
             Long leaveCount = wfTeacherleaveService.getLeaveCount(startTime, endTime);
@@ -133,7 +130,7 @@ public class StatisticsController {
             }
             statisticsVo.setLeaveCount(leaveCount);
             //通过考勤规则和实到人数信息,计算迟到的
-            userIds = new HashSet<>();
+            Set<Long> userIds = new HashSet<>();
             Long lateCount = 0L;
             for (TeacherOutInRecord outInRecord : outInRecords) {
                 if("迟到".equals(outInRecord.getAttendanceStatus()) && !userIds.contains(outInRecord.getUserId())){

+ 1 - 1
src/main/resources/application.yml

@@ -5,7 +5,7 @@ server:
 spring:
   # 环境 dev|pre|prod
   profiles:
-    active: pre
+    active: dev
   # jackson时间格式化
   jackson:
     time-zone: GMT+8