考勤
This commit is contained in:
		| @ -111,7 +111,7 @@ public class BusAttendanceController extends BaseController { | ||||
|         return R.ok(busAttendanceService.getClockDateForTwoWeekList(projectId)); | ||||
|     } | ||||
|  | ||||
|     @GetMapping("/exportList") | ||||
|     @PostMapping("/exportList") | ||||
|     public void exportList(AttendanceExportDto dto, HttpServletResponse response) { | ||||
|         busAttendanceService.getExportList(dto, response); | ||||
|     } | ||||
|  | ||||
| @ -249,9 +249,14 @@ public class BusAttendanceServiceImpl extends ServiceImpl<BusAttendanceMapper, B | ||||
|             } | ||||
|             // 判断用户是否已经被拉黑 | ||||
|             constructionBlacklistService.validUserInBlacklist(constructionUser.getSysUserId(), req.getProjectId()); | ||||
|  | ||||
|             Boolean result = false; | ||||
|             // 进行人脸比对 | ||||
|             Boolean result = constructionUserService.faceComparison(file); | ||||
|             try { | ||||
|                 result = constructionUserService.faceComparison(file); | ||||
|             }catch (Exception e){ | ||||
|                 throw new ServiceException("人脸识别失败,请重新识别", HttpStatus.BAD_REQUEST); | ||||
|             } | ||||
|  | ||||
|             if (!result) { | ||||
|                 throw new ServiceException("人脸识别失败,请重新识别", HttpStatus.BAD_REQUEST); | ||||
|             } | ||||
| @ -861,8 +866,10 @@ public class BusAttendanceServiceImpl extends ServiceImpl<BusAttendanceMapper, B | ||||
|         LocalDate now = LocalDate.now(); | ||||
|         // 往前14天,包含今天 | ||||
|         LocalDate startDate = now.minusDays(13); | ||||
|         List<BusAttendance> list = list(Wrappers.<BusAttendance>lambdaQuery().eq(BusAttendance::getProjectId, projectId) | ||||
|         List<BusAttendance> list = list(Wrappers.<BusAttendance>lambdaQuery() | ||||
|             .eq(BusAttendance::getProjectId, projectId) | ||||
|             .between(BusAttendance::getClockDate, startDate, now) | ||||
|             .orderByAsc(BusAttendance::getClockDate) | ||||
|         ); | ||||
|  | ||||
|         // 按日期分组 | ||||
| @ -879,42 +886,43 @@ public class BusAttendanceServiceImpl extends ServiceImpl<BusAttendanceMapper, B | ||||
|         } | ||||
|  | ||||
|         // 统计全勤、半勤、缺卡人数 | ||||
|         ArrayList<BusAttendanceClockDateForTwoWeekVo> busAttendanceClockDateForTwoWeekVos = new ArrayList<>(); | ||||
|         List<BusAttendanceClockDateForTwoWeekVo> result = new ArrayList<>(); | ||||
|         List<String> validStatusList = Arrays.asList("1", "2", "3", "5"); | ||||
|  | ||||
|         List<String> list1 = Arrays.asList("1", "2", "3", "5"); | ||||
|  | ||||
|         for (Map.Entry<LocalDate, Map<Long, List<BusAttendance>>> dateEntry : dateUserMap.entrySet()) { | ||||
|             LocalDate date = dateEntry.getKey(); | ||||
|             Map<Long, List<BusAttendance>> userAttendanceMap = dateEntry.getValue(); | ||||
|         LocalDate currentDate = startDate; | ||||
|         while (!currentDate.isAfter(now)) { | ||||
|             Map<Long, List<BusAttendance>> userAttendanceMap = dateUserMap.getOrDefault(currentDate, new HashMap<>()); | ||||
|  | ||||
|             int full = 0, half = 0, absent = 0; | ||||
|  | ||||
|             for (Map.Entry<Long, List<BusAttendance>> userEntry : userAttendanceMap.entrySet()) { | ||||
|                 List<BusAttendance> records = userEntry.getValue(); | ||||
|  | ||||
|                 int a = 0; | ||||
|                 for (BusAttendance record : records) { | ||||
|                     if (list1.contains(record.getClockStatus())) { | ||||
|                         a += 1; | ||||
|                     } | ||||
|                 } | ||||
|                 if (a >= 2) { | ||||
|                 long validCount = records.stream() | ||||
|                     .map(BusAttendance::getClockStatus) | ||||
|                     .filter(validStatusList::contains) | ||||
|                     .count(); | ||||
|  | ||||
|                 if (validCount >= 2) { | ||||
|                     full++; | ||||
|                 } else if (a == 1) { | ||||
|                 } else if (validCount == 1) { | ||||
|                     half++; | ||||
|                 } else { | ||||
|                     absent++; | ||||
|                 } | ||||
|             } | ||||
|             BusAttendanceClockDateForTwoWeekVo busAttendanceClockDateForTwoWeekVo = new BusAttendanceClockDateForTwoWeekVo(); | ||||
|             busAttendanceClockDateForTwoWeekVo.setClockDate(date); | ||||
|             busAttendanceClockDateForTwoWeekVo.setAttendance(full); | ||||
|             busAttendanceClockDateForTwoWeekVo.setHalfAttendance(half); | ||||
|             busAttendanceClockDateForTwoWeekVo.setAbsenteeism(absent); | ||||
|  | ||||
|             busAttendanceClockDateForTwoWeekVos.add(busAttendanceClockDateForTwoWeekVo); | ||||
|             BusAttendanceClockDateForTwoWeekVo vo = new BusAttendanceClockDateForTwoWeekVo(); | ||||
|             vo.setClockDate(currentDate); | ||||
|             vo.setAttendance(full); | ||||
|             vo.setHalfAttendance(half); | ||||
|             vo.setAbsenteeism(absent); | ||||
|  | ||||
|             result.add(vo); | ||||
|             currentDate = currentDate.plusDays(1); | ||||
|         } | ||||
|         return busAttendanceClockDateForTwoWeekVos; | ||||
|  | ||||
|         return result; | ||||
|     } | ||||
|  | ||||
|     @Override | ||||
|  | ||||
| @ -594,6 +594,7 @@ public class SysUserServiceImpl implements ISysUserService, UserService { | ||||
|             if (CollUtil.isEmpty(roles)) { | ||||
|                 throw new ServiceException("没有权限访问角色的数据"); | ||||
|             } | ||||
|  | ||||
|             if (clear) { | ||||
|                 // 删除用户与角色关联 | ||||
|                 userRoleMapper.delete(new LambdaQueryWrapper<SysUserRole>().eq(SysUserRole::getUserId, userId)); | ||||
|  | ||||
		Reference in New Issue
	
	Block a user
	 zt
					zt