Jelajahi Sumber

考勤模块调整

dzx 5 bulan lalu
induk
melakukan
143af60a3d

+ 6 - 2
src/main/java/com/xjrsoft/module/attendance/controller/StatisticsController.java

@@ -5,6 +5,7 @@ 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.StudyStatusEnum;
 import com.xjrsoft.common.model.result.RT;
 import com.xjrsoft.module.attendance.dto.AttendanceStatisticDto;
 import com.xjrsoft.module.attendance.vo.TeacherStatisticsVo;
@@ -150,6 +151,9 @@ public class StatisticsController {
                 .innerJoin(BaseStudentSchoolRoll.class, BaseStudentSchoolRoll::getUserId, XjrUser::getId)
                 .innerJoin(BaseStudent.class, BaseStudent::getUserId, XjrUser::getId);
         long allCount = xjrUserService.count(queryWrapper);
+
+        queryWrapper.eq(BaseStudentSchoolRoll::getStduyStatus, StudyStatusEnum.AttendDaySchool.getCode());
+        long attendDaySchoolCount = xjrUserService.count(queryWrapper);
         statisticsVo.setAllCount(allCount);
         if(dto.getDate() != null && !"".equals(dto.getDate())){
             DateTimeFormatter formatter = DateTimeFormatter.ISO_DATE;
@@ -199,8 +203,8 @@ public class StatisticsController {
             //计算出勤率
             if(statisticsVo.getAllCount() != null && statisticsVo.getAllCount() != 0){
                 //最后通过总人数-实到人数-请假人数计算出缺勤人数
-                statisticsVo.setAbsenteeismCount(statisticsVo.getAllCount() - statisticsVo.getLeaveCount() - statisticsVo.getActualCount());
-                BigDecimal divide = BigDecimal.valueOf(statisticsVo.getActualCount()).divide(BigDecimal.valueOf(statisticsVo.getAllCount()), 4, RoundingMode.HALF_UP);
+                statisticsVo.setAbsenteeismCount(attendDaySchoolCount - statisticsVo.getLeaveCount() - statisticsVo.getActualCount());
+                BigDecimal divide = BigDecimal.valueOf(statisticsVo.getActualCount()).divide(BigDecimal.valueOf(attendDaySchoolCount), 4, RoundingMode.HALF_UP);
                 statisticsVo.setAttendanceRate(divide.doubleValue() + "");
             }else{
                 statisticsVo.setAttendanceRate("0");

+ 1 - 1
src/main/java/com/xjrsoft/module/attendance/controller/StudentStatisticsController.java

@@ -145,7 +145,7 @@ public class StudentStatisticsController {
                 record.setLateCount(lateCount);
 
                 //最后通过总人数-实到人数-请假人数计算出缺勤人数
-                record.setAbsenteeismCount(record.getStudentCount() - record.getLeaveCount() - record.getActualCount());
+                record.setAbsenteeismCount(record.getNotStayCount() - record.getLeaveCount() - record.getActualCount());
 
                 //计算出勤率
                 BigDecimal divide = BigDecimal.ZERO;