考勤
This commit is contained in:
		| @ -111,7 +111,7 @@ public class BusAttendanceController extends BaseController { | |||||||
|         return R.ok(busAttendanceService.getClockDateForTwoWeekList(projectId)); |         return R.ok(busAttendanceService.getClockDateForTwoWeekList(projectId)); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     @GetMapping("/exportList") |     @PostMapping("/exportList") | ||||||
|     public void exportList(AttendanceExportDto dto, HttpServletResponse response) { |     public void exportList(AttendanceExportDto dto, HttpServletResponse response) { | ||||||
|         busAttendanceService.getExportList(dto, response); |         busAttendanceService.getExportList(dto, response); | ||||||
|     } |     } | ||||||
|  | |||||||
| @ -249,9 +249,14 @@ public class BusAttendanceServiceImpl extends ServiceImpl<BusAttendanceMapper, B | |||||||
|             } |             } | ||||||
|             // 判断用户是否已经被拉黑 |             // 判断用户是否已经被拉黑 | ||||||
|             constructionBlacklistService.validUserInBlacklist(constructionUser.getSysUserId(), req.getProjectId()); |             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) { |             if (!result) { | ||||||
|                 throw new ServiceException("人脸识别失败,请重新识别", HttpStatus.BAD_REQUEST); |                 throw new ServiceException("人脸识别失败,请重新识别", HttpStatus.BAD_REQUEST); | ||||||
|             } |             } | ||||||
| @ -859,10 +864,12 @@ public class BusAttendanceServiceImpl extends ServiceImpl<BusAttendanceMapper, B | |||||||
|     @Override |     @Override | ||||||
|     public List<BusAttendanceClockDateForTwoWeekVo> getClockDateForTwoWeekList(Long projectId) { |     public List<BusAttendanceClockDateForTwoWeekVo> getClockDateForTwoWeekList(Long projectId) { | ||||||
|         LocalDate now = LocalDate.now(); |         LocalDate now = LocalDate.now(); | ||||||
|         //往前14天,包含今天 |         // 往前14天,包含今天 | ||||||
|         LocalDate startDate = now.minusDays(13); |         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) |             .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"); |         LocalDate currentDate = startDate; | ||||||
|  |         while (!currentDate.isAfter(now)) { | ||||||
|         for (Map.Entry<LocalDate, Map<Long, List<BusAttendance>>> dateEntry : dateUserMap.entrySet()) { |             Map<Long, List<BusAttendance>> userAttendanceMap = dateUserMap.getOrDefault(currentDate, new HashMap<>()); | ||||||
|             LocalDate date = dateEntry.getKey(); |  | ||||||
|             Map<Long, List<BusAttendance>> userAttendanceMap = dateEntry.getValue(); |  | ||||||
|  |  | ||||||
|             int full = 0, half = 0, absent = 0; |             int full = 0, half = 0, absent = 0; | ||||||
|  |  | ||||||
|             for (Map.Entry<Long, List<BusAttendance>> userEntry : userAttendanceMap.entrySet()) { |             for (Map.Entry<Long, List<BusAttendance>> userEntry : userAttendanceMap.entrySet()) { | ||||||
|                 List<BusAttendance> records = userEntry.getValue(); |                 List<BusAttendance> records = userEntry.getValue(); | ||||||
|  |  | ||||||
|                 int a = 0; |                 long validCount = records.stream() | ||||||
|                 for (BusAttendance record : records) { |                     .map(BusAttendance::getClockStatus) | ||||||
|                     if (list1.contains(record.getClockStatus())) { |                     .filter(validStatusList::contains) | ||||||
|                         a += 1; |                     .count(); | ||||||
|                     } |  | ||||||
|                 } |                 if (validCount >= 2) { | ||||||
|                 if (a >= 2) { |  | ||||||
|                     full++; |                     full++; | ||||||
|                 } else if (a == 1) { |                 } else if (validCount == 1) { | ||||||
|                     half++; |                     half++; | ||||||
|                 } else { |                 } else { | ||||||
|                     absent++; |                     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 |     @Override | ||||||
|  | |||||||
| @ -594,6 +594,7 @@ public class SysUserServiceImpl implements ISysUserService, UserService { | |||||||
|             if (CollUtil.isEmpty(roles)) { |             if (CollUtil.isEmpty(roles)) { | ||||||
|                 throw new ServiceException("没有权限访问角色的数据"); |                 throw new ServiceException("没有权限访问角色的数据"); | ||||||
|             } |             } | ||||||
|  |  | ||||||
|             if (clear) { |             if (clear) { | ||||||
|                 // 删除用户与角色关联 |                 // 删除用户与角色关联 | ||||||
|                 userRoleMapper.delete(new LambdaQueryWrapper<SysUserRole>().eq(SysUserRole::getUserId, userId)); |                 userRoleMapper.delete(new LambdaQueryWrapper<SysUserRole>().eq(SysUserRole::getUserId, userId)); | ||||||
|  | |||||||
		Reference in New Issue
	
	Block a user
	 zt
					zt