|
|
@@ -980,9 +980,26 @@ public class SysUserServiceImpl implements ISysUserService
|
|
|
if (i>0){
|
|
|
return AjaxResult.error("当前用户存在缺卡的考勤,请处理后再提交");
|
|
|
}
|
|
|
- int x = userRecordMapper.checkClockUserRecord(userId);
|
|
|
- if (x>0){
|
|
|
- return AjaxResult.error("当前用户存的考勤存在多打卡,请处理后再提交");
|
|
|
+ List<UserRecord> list = userRecordMapper.selectByUserId(userId);
|
|
|
+ List<UserRecord> list2 = list.stream().filter(e -> e.getClockStatus() == 1).collect(Collectors.toList());
|
|
|
+ //存在多打卡的时候
|
|
|
+ if (!list2.isEmpty()){
|
|
|
+ //判定多打卡状态是否正常
|
|
|
+ for (UserRecord e : list2) {
|
|
|
+ e.getRecordTime().toInstant();
|
|
|
+ LocalDateTime localDateTime = LocalDateTime.ofInstant(e.getRecordTime().toInstant(), ZoneId.systemDefault());
|
|
|
+ LocalDate localDate = localDateTime.toLocalDate();
|
|
|
+ List<ProjectStaffRecord> list3 = projectStaffRecordMapper.selectByDDUidAndTime(e.getDdUserId(), localDate);
|
|
|
+ BigDecimal sum = BigDecimal.ZERO;
|
|
|
+ for (ProjectStaffRecord e2 : list3) {
|
|
|
+ sum = sum.add(BigDecimal.valueOf(e2.getCheckDuration()));
|
|
|
+ }
|
|
|
+ BigDecimal sum2 = BigDecimal.valueOf(e.getSumDuration());
|
|
|
+ if (sum.compareTo(sum2) != 0){
|
|
|
+ String dateStr = DateUtils.parseStrYYYYnMMyDD(e.getRecordTime());
|
|
|
+ return AjaxResult.error(String.format("[%S]考勤[%S]存在多打卡,请处理后再提交",e.getName(),dateStr));
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
return AjaxResult.success();
|
|
|
}
|