|
|
@@ -2,15 +2,23 @@ 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.google.gson.JsonArray;
|
|
|
+import com.google.gson.JsonElement;
|
|
|
+import com.google.gson.JsonObject;
|
|
|
+import com.google.gson.JsonParser;
|
|
|
import com.xjrsoft.common.annotation.XjrLog;
|
|
|
+import com.xjrsoft.common.enums.DeleteMark;
|
|
|
import com.xjrsoft.common.enums.OutInStatusEnum;
|
|
|
import com.xjrsoft.common.enums.StudyStatusEnum;
|
|
|
import com.xjrsoft.common.model.result.RT;
|
|
|
import com.xjrsoft.common.utils.VoToColumnUtil;
|
|
|
import com.xjrsoft.module.attendance.dto.AttendanceStatisticDto;
|
|
|
import com.xjrsoft.module.attendance.dto.TeacherDetailsDto;
|
|
|
+import com.xjrsoft.module.attendance.entity.AttendanceRuleCategory;
|
|
|
+import com.xjrsoft.module.attendance.service.IAttendanceRuleCategoryService;
|
|
|
import com.xjrsoft.module.attendance.service.ITeacherAttendanceRecordService;
|
|
|
import com.xjrsoft.module.attendance.vo.TeacherStatisticsPageVo;
|
|
|
import com.xjrsoft.module.attendance.vo.TeacherStatisticsVo;
|
|
|
@@ -24,8 +32,11 @@ import com.xjrsoft.module.personnel.service.IReservationSchoolService;
|
|
|
import com.xjrsoft.module.student.entity.BaseStudent;
|
|
|
import com.xjrsoft.module.student.entity.BaseStudentSchoolRoll;
|
|
|
import com.xjrsoft.module.student.service.IStudentLeaveService;
|
|
|
+import com.xjrsoft.module.teacher.dto.BaseTeacherPageDto;
|
|
|
import com.xjrsoft.module.teacher.entity.BaseTeacher;
|
|
|
import com.xjrsoft.module.teacher.entity.XjrUser;
|
|
|
+import com.xjrsoft.module.teacher.service.ITeacherbaseManagerService;
|
|
|
+import com.xjrsoft.module.teacher.vo.XjrUserPageVo;
|
|
|
import io.swagger.annotations.Api;
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
import lombok.AllArgsConstructor;
|
|
|
@@ -39,6 +50,8 @@ import java.math.RoundingMode;
|
|
|
import java.time.LocalDate;
|
|
|
import java.time.LocalDateTime;
|
|
|
import java.time.format.DateTimeFormatter;
|
|
|
+import java.util.ArrayList;
|
|
|
+import java.util.HashSet;
|
|
|
import java.util.List;
|
|
|
import java.util.Set;
|
|
|
import java.util.stream.Collectors;
|
|
|
@@ -61,6 +74,8 @@ public class StatisticsController {
|
|
|
private final IStudentLeaveService studentLeaveService;
|
|
|
private final IReservationSchoolService reservationSchoolService;
|
|
|
private final ITeacherAttendanceRecordService attendanceRecordService;
|
|
|
+ private final ITeacherbaseManagerService teacherbaseManagerService;
|
|
|
+ private final IAttendanceRuleCategoryService ruleCategoryService;
|
|
|
|
|
|
@GetMapping(value = "/teacher-statistics")
|
|
|
@ApiOperation(value = "教职工考勤统计")
|
|
|
@@ -88,7 +103,9 @@ public class StatisticsController {
|
|
|
Long leaveCount = 0L;
|
|
|
Long absenteeismCount = 0L;
|
|
|
Integer dividendCount = 0;
|
|
|
+ Set<Long> teacherIds = new HashSet<>();
|
|
|
for (TeacherStatisticsPageVo recordVo : list) {
|
|
|
+ teacherIds.add(recordVo.getUserId());
|
|
|
if ("迟到".equals(recordVo.getStatus())) {
|
|
|
lateCount++;
|
|
|
dividendCount++;
|
|
|
@@ -109,6 +126,31 @@ public class StatisticsController {
|
|
|
statisticsVo.setLeaveCount(leaveCount);
|
|
|
statisticsVo.setAbsenteeismCount(absenteeismCount);
|
|
|
|
|
|
+ //查询不需要考勤的人
|
|
|
+ AttendanceRuleCategory ruleCategory = ruleCategoryService.getOne(
|
|
|
+ new QueryWrapper<AttendanceRuleCategory>().lambda()
|
|
|
+ .eq(AttendanceRuleCategory::getDeleteMark, DeleteMark.NODELETE.getCode())
|
|
|
+ .eq(AttendanceRuleCategory::getRoleId, 2)
|
|
|
+ .le(AttendanceRuleCategory::getStartDate, LocalDate.now())
|
|
|
+ .ge(AttendanceRuleCategory::getStartDate, LocalDate.now())
|
|
|
+ );
|
|
|
+ BaseTeacherPageDto teacherPageDto = new BaseTeacherPageDto();
|
|
|
+ JsonArray userRelation = new JsonParser().parse(ruleCategory.getUserRelation()).getAsJsonArray();
|
|
|
+ List<Long> userIds = new ArrayList<>();
|
|
|
+ List<Long> deptIds = new ArrayList<>();
|
|
|
+ for (JsonElement jsonElement : userRelation) {
|
|
|
+ JsonObject jsonObject = jsonElement.getAsJsonObject();
|
|
|
+ deptIds.add(jsonObject.get("deptId").getAsLong());
|
|
|
+ userIds.add(jsonObject.get("userId").getAsLong());
|
|
|
+ }
|
|
|
+ teacherPageDto.setDeptIds(deptIds);
|
|
|
+ teacherPageDto.setUserIds(userIds);
|
|
|
+ List<XjrUserPageVo> attendanceTeacherList = teacherbaseManagerService.getList(teacherPageDto);
|
|
|
+
|
|
|
+ List<XjrUserPageVo> allTeacherList = teacherbaseManagerService.getList(new BaseTeacherPageDto());
|
|
|
+
|
|
|
+ statisticsVo.setNotAttendanceCount(allTeacherList.size() - attendanceTeacherList.size());
|
|
|
+
|
|
|
//计算出勤率
|
|
|
BigDecimal divide = BigDecimal.ZERO;
|
|
|
if (dividendCount != 0) {
|