Commit 9c2bc047 authored by 姬鋆屾's avatar 姬鋆屾
parents b5d3f8ba e425a3f2
......@@ -36,7 +36,7 @@ public class AttendanceSummaryTaskImpl implements ITaskExcuteService {
Calendar now = Calendar.getInstance();
now.setTime(new Date());
now.add(Calendar.DAY_OF_MONTH, -1); //默认查前一天数据
attendanceRecordErrorService.doAutoProcess(now.getTime());
// attendanceRecordErrorService.doAutoProcess(now.getTime());
AttendanceSummaryQuery query = new AttendanceSummaryQuery();
query.setSummaryTimeEnd(DateUtils.getStrDate(now.getTime()));
......
package com.mortals.xhx.module.attendance.service.impl;
import cn.hutool.core.collection.ListUtil;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.StrUtil;
import com.mortals.framework.service.IUser;
......@@ -82,6 +83,10 @@ public class AttendanceRecordHikServiceImpl extends AbstractCRUDServiceImpl<Atte
List<AttendanceRecordHikEntity> collect = hikEntityList.stream().sorted(Comparator.comparing(AttendanceRecordHikEntity::getAttendanceDate)).collect(Collectors.toList());
//另一种实现
Map<Long, List<AttendanceRecordHikEntity>> listMap = collect.stream().collect(Collectors.groupingBy(AttendanceRecordHikEntity::getStaffId));
List<AttendanceRecordEntity> saveList = new ArrayList<>();
List<AttendanceRecordEntity> updateList = new ArrayList<>();
for (Map.Entry<Long, List<AttendanceRecordHikEntity>> itemEntry : listMap.entrySet()) {
//按人员
Long staffId = itemEntry.getKey();
......@@ -198,16 +203,30 @@ public class AttendanceRecordHikServiceImpl extends AbstractCRUDServiceImpl<Atte
attendanceRecordEntity.setId(recordEntity.getId());
attendanceRecordEntity.setUpdateTime(new Date());
attendanceRecordEntity.setUpdateUserId(this.getContextUserId(context));
attendanceRecordService.update(attendanceRecordEntity, context);
updateList.add(attendanceRecordEntity);
// attendanceRecordService.update(attendanceRecordEntity, context);
} else {
attendanceRecordService.save(attendanceRecordEntity, context);
saveList.add(attendanceRecordEntity);
// attendanceRecordService.save(attendanceRecordEntity, context);
}
}
}
}
if (!ObjectUtils.isEmpty(saveList)) {
attendanceRecordService.save(saveList, context);
}
if (!ObjectUtils.isEmpty(updateList)) {
List<List<AttendanceRecordEntity>> partition = ListUtil.partition(updateList, 30);
for (List<AttendanceRecordEntity> attendanceRecordEntities : partition) {
attendanceRecordService.update(attendanceRecordEntities, context);
}
}
}
......
......@@ -82,13 +82,13 @@
from
mortals_xhx_attendance_record_error e
where
processStatus = 1
and processResult != 4
processResult != 4
and e.errorDateTime <![CDATA[ >= ]]> STR_TO_DATE(left(concat(#{summaryTime},' 00:00:00'),19),'%Y-%m-%d %k:%i:%s')
and e.errorDateTime <![CDATA[ <= ]]> STR_TO_DATE(left(concat(#{summaryTime},' 23:59:59'),19),'%Y-%m-%d %k:%i:%s')
<if test="staffId != null and staffId!=''"> AND e.staffId = #{staffId}</if>
group by
e.staffId,
e.staffName
e.staffName,
DATE_FORMAT(errorDateTime,'%Y-%m-%d')
</select>
</mapper>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment