|
|
@@ -60,61 +60,64 @@ public class AttendanceSignRecordServiceImpl extends MyBaseServiceImpl<Attendanc
|
|
|
|
|
|
@Override
|
|
|
public void getSaveSignRecord() {
|
|
|
-
|
|
|
- LambdaQueryWrapper<UserEntity> lm = new LambdaQueryWrapper<>();
|
|
|
- lm.isNotNull(UserEntity::getXworkUserId);
|
|
|
- lm.ne(UserEntity::getXworkUserId,"");
|
|
|
- lm.eq(UserEntity::getIsDelete,CommonConstant.DEL_FLAG_0);
|
|
|
- lm.eq(UserEntity::getEnabled,1);
|
|
|
- List<UserEntity> userEntities = userService.list(lm);
|
|
|
- if (CollectionUtils.isEmpty(userEntities)) {
|
|
|
- return;
|
|
|
- }
|
|
|
- Map<String, UserEntity> userMap = userEntities.stream()
|
|
|
- .filter(u -> u.getXworkUserId() != null)
|
|
|
- .collect(Collectors.toMap(
|
|
|
- UserEntity::getXworkUserId,
|
|
|
- userEntity -> userEntity,
|
|
|
- (oldVal, newVal) -> oldVal
|
|
|
- ));
|
|
|
- List<String> wxUserIds = userEntities.stream().map(UserEntity::getXworkUserId).collect(Collectors.toList());
|
|
|
- List<CheckinDataBO> checkins = new ArrayList<>();
|
|
|
-
|
|
|
- Long currentTime = System.currentTimeMillis() / 1000;
|
|
|
- Long starttime = systemConfigItemService.getCheckinDataTime();
|
|
|
- Long endtime = currentTime;
|
|
|
-
|
|
|
- int batchSize = 90;
|
|
|
- for (int i = 0; i < wxUserIds.size(); i += batchSize) {
|
|
|
- int end = Math.min(i + batchSize, wxUserIds.size());
|
|
|
- List<String> subList = wxUserIds.subList(i, end);
|
|
|
- List<CheckinDataBO> batchResult = getSaveSignRecord(subList,3,starttime,endtime);
|
|
|
- if (batchResult != null && !batchResult.isEmpty()) {
|
|
|
- checkins.addAll(batchResult);
|
|
|
+ try {
|
|
|
+ LambdaQueryWrapper<UserEntity> lm = new LambdaQueryWrapper<>();
|
|
|
+ lm.isNotNull(UserEntity::getXworkUserId);
|
|
|
+ lm.ne(UserEntity::getXworkUserId, "");
|
|
|
+ lm.eq(UserEntity::getIsDelete, CommonConstant.DEL_FLAG_0);
|
|
|
+ lm.eq(UserEntity::getEnabled, 1);
|
|
|
+ List<UserEntity> userEntities = userService.list(lm);
|
|
|
+ if (CollectionUtils.isEmpty(userEntities)) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ Map<String, UserEntity> userMap = userEntities.stream()
|
|
|
+ .filter(u -> u.getXworkUserId() != null)
|
|
|
+ .collect(Collectors.toMap(
|
|
|
+ UserEntity::getXworkUserId,
|
|
|
+ userEntity -> userEntity,
|
|
|
+ (oldVal, newVal) -> oldVal
|
|
|
+ ));
|
|
|
+ List<String> wxUserIds = userEntities.stream().map(UserEntity::getXworkUserId).collect(Collectors.toList());
|
|
|
+ List<CheckinDataBO> checkins = new ArrayList<>();
|
|
|
+
|
|
|
+ Long currentTime = System.currentTimeMillis() / 1000;
|
|
|
+ Long starttime = systemConfigItemService.getCheckinDataTime();
|
|
|
+ Long endtime = currentTime;
|
|
|
+
|
|
|
+ int batchSize = 90;
|
|
|
+ for (int i = 0; i < wxUserIds.size(); i += batchSize) {
|
|
|
+ int end = Math.min(i + batchSize, wxUserIds.size());
|
|
|
+ List<String> subList = wxUserIds.subList(i, end);
|
|
|
+ List<CheckinDataBO> batchResult = getSaveSignRecord(subList, 3, starttime, endtime);
|
|
|
+ if (batchResult != null && !batchResult.isEmpty()) {
|
|
|
+ checkins.addAll(batchResult);
|
|
|
+ }
|
|
|
}
|
|
|
- }
|
|
|
|
|
|
- LocalDateTime dateTime = timestampToLocalDateTime(endtime);
|
|
|
- String time = dateTime.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
|
|
|
- log.error(endtime+"---------跑到了这里-----"+time);
|
|
|
- systemConfigItemService.setCheckinDataTime(endtime);
|
|
|
- if (CollectionUtils.isEmpty(checkins)) {
|
|
|
- return;
|
|
|
- }
|
|
|
- List<AttendanceSignRecordEntity> signls = appPageInfoListToAppPageTreeVoList(checkins);
|
|
|
- if (CollectionUtils.isEmpty(signls)) {
|
|
|
- return ;
|
|
|
- }
|
|
|
- for (AttendanceSignRecordEntity signRecord : signls) {
|
|
|
- UserEntity user = userMap.get(signRecord.getWxUserId());
|
|
|
- if (Objects.nonNull(user)) {
|
|
|
- signRecord.setUserId(user.getId());
|
|
|
- signRecord.setUserName(user.getRealName());
|
|
|
- signRecord.setDeptId(user.getDeptId());
|
|
|
+ LocalDateTime dateTime = timestampToLocalDateTime(endtime);
|
|
|
+ String time = dateTime.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
|
|
|
+ log.error(endtime + "---------跑到了这里-----" + time);
|
|
|
+ systemConfigItemService.setCheckinDataTime(endtime);
|
|
|
+ if (CollectionUtils.isEmpty(checkins)) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ List<AttendanceSignRecordEntity> signls = appPageInfoListToAppPageTreeVoList(checkins);
|
|
|
+ if (CollectionUtils.isEmpty(signls)) {
|
|
|
+ return;
|
|
|
}
|
|
|
+ for (AttendanceSignRecordEntity signRecord : signls) {
|
|
|
+ UserEntity user = userMap.get(signRecord.getWxUserId());
|
|
|
+ if (Objects.nonNull(user)) {
|
|
|
+ signRecord.setUserId(user.getId());
|
|
|
+ signRecord.setUserName(user.getRealName());
|
|
|
+ signRecord.setDeptId(user.getDeptId());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ // 保存打卡记录
|
|
|
+ this.saveBatch(signls);
|
|
|
+ }catch (Exception e) {
|
|
|
+ log.error("getSaveSignRecord----error---",e);
|
|
|
}
|
|
|
- // 保存打卡记录
|
|
|
- this.saveBatch(signls);
|
|
|
}
|
|
|
/**
|
|
|
* 获取打卡信息
|
|
|
@@ -136,48 +139,52 @@ public class AttendanceSignRecordServiceImpl extends MyBaseServiceImpl<Attendanc
|
|
|
*/
|
|
|
@Override
|
|
|
public void getDelayedSign() {
|
|
|
- LambdaQueryWrapper<AttendanceSignCompensateRecordEntity> compensate = new LambdaQueryWrapper<>();
|
|
|
- compensate.eq(AttendanceSignCompensateRecordEntity::getIsCheckin,Integer.valueOf(0));
|
|
|
- compensate.eq(AttendanceSignCompensateRecordEntity::getIsDelete,CommonConstant.DEL_FLAG_0);
|
|
|
- List<AttendanceSignCompensateRecordEntity> attendanceSignls = signCompensateRecordService.list(compensate);
|
|
|
- if (CollectionUtils.isEmpty(attendanceSignls)) {
|
|
|
- return;
|
|
|
- }
|
|
|
-
|
|
|
- for (AttendanceSignCompensateRecordEntity attendanceSign : attendanceSignls) {
|
|
|
- UserEntity user = userService.getById(attendanceSign.getId());
|
|
|
- if (Objects.isNull(user) || StrUtil.isBlank(user.getXworkUserId())) {
|
|
|
- continue;
|
|
|
- }
|
|
|
- List<String> subList = Arrays.asList(user.getXworkUserId());
|
|
|
- LocalDate date = attendanceSign.getCheckinDate();
|
|
|
- ZoneId zoneId = ZoneId.of("Asia/Shanghai");
|
|
|
- long starttime = date
|
|
|
- .atTime(0, 0, 0)
|
|
|
- .atZone(zoneId)
|
|
|
- .toEpochSecond();
|
|
|
-
|
|
|
- long endtime = date
|
|
|
- .atTime(23, 59, 59)
|
|
|
- .atZone(zoneId)
|
|
|
- .toEpochSecond();
|
|
|
-
|
|
|
- List<CheckinDataBO> batchResult = getSaveSignRecord(subList,3,starttime,endtime);
|
|
|
- if (CollectionUtils.isEmpty(batchResult)) {
|
|
|
- continue;
|
|
|
+ try {
|
|
|
+ LambdaQueryWrapper<AttendanceSignCompensateRecordEntity> compensate = new LambdaQueryWrapper<>();
|
|
|
+ compensate.eq(AttendanceSignCompensateRecordEntity::getIsCheckin, Integer.valueOf(0));
|
|
|
+ compensate.eq(AttendanceSignCompensateRecordEntity::getIsDelete, CommonConstant.DEL_FLAG_0);
|
|
|
+ List<AttendanceSignCompensateRecordEntity> attendanceSignls = signCompensateRecordService.list(compensate);
|
|
|
+ if (CollectionUtils.isEmpty(attendanceSignls)) {
|
|
|
+ return;
|
|
|
}
|
|
|
|
|
|
- List<AttendanceSignRecordEntity> signls = appPageInfoListToAppPageTreeVoList(batchResult);
|
|
|
- if (CollectionUtils.isEmpty(signls)) {
|
|
|
- return ;
|
|
|
+ for (AttendanceSignCompensateRecordEntity attendanceSign : attendanceSignls) {
|
|
|
+ UserEntity user = userService.getById(attendanceSign.getId());
|
|
|
+ if (Objects.isNull(user) || StrUtil.isBlank(user.getXworkUserId())) {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ List<String> subList = Arrays.asList(user.getXworkUserId());
|
|
|
+ LocalDate date = attendanceSign.getCheckinDate();
|
|
|
+ ZoneId zoneId = ZoneId.of("Asia/Shanghai");
|
|
|
+ long starttime = date
|
|
|
+ .atTime(0, 0, 0)
|
|
|
+ .atZone(zoneId)
|
|
|
+ .toEpochSecond();
|
|
|
+
|
|
|
+ long endtime = date
|
|
|
+ .atTime(23, 59, 59)
|
|
|
+ .atZone(zoneId)
|
|
|
+ .toEpochSecond();
|
|
|
+
|
|
|
+ List<CheckinDataBO> batchResult = getSaveSignRecord(subList, 3, starttime, endtime);
|
|
|
+ if (CollectionUtils.isEmpty(batchResult)) {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+
|
|
|
+ List<AttendanceSignRecordEntity> signls = appPageInfoListToAppPageTreeVoList(batchResult);
|
|
|
+ if (CollectionUtils.isEmpty(signls)) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ // 保存打卡记录
|
|
|
+ this.saveBatch(signls);
|
|
|
+
|
|
|
+ LambdaUpdateWrapper<AttendanceSignCompensateRecordEntity> updateWrapper = new LambdaUpdateWrapper<>();
|
|
|
+ updateWrapper.eq(AttendanceSignCompensateRecordEntity::getId, attendanceSign.getId());
|
|
|
+ updateWrapper.set(AttendanceSignCompensateRecordEntity::getIsCheckin, Integer.valueOf(1));
|
|
|
+ signCompensateRecordService.update(updateWrapper);
|
|
|
}
|
|
|
- // 保存打卡记录
|
|
|
- this.saveBatch(signls);
|
|
|
-
|
|
|
- LambdaUpdateWrapper<AttendanceSignCompensateRecordEntity> updateWrapper = new LambdaUpdateWrapper<>();
|
|
|
- updateWrapper.eq(AttendanceSignCompensateRecordEntity::getId,attendanceSign.getId());
|
|
|
- updateWrapper.set(AttendanceSignCompensateRecordEntity::getIsCheckin,Integer.valueOf(1));
|
|
|
- signCompensateRecordService.update(updateWrapper);
|
|
|
+ }catch (Exception e) {
|
|
|
+ log.error("----getDelayedSign------error-"+e);
|
|
|
}
|
|
|
|
|
|
}
|