Commit 28216d46 by 张富康

fix(attendance): 修正考勤数据处理逻辑

- 取消员工手机号的注释限制,确保查询条件生效
- 添加打卡日期与入职日期比较,过滤入职前的考勤数据
- 打卡日期在入职日期之前的记录不再处理,避免误算
- 保留离职日期后的考勤数据过滤逻辑,提高数据准确性
1 parent 1fb8665a
......@@ -130,7 +130,7 @@ public class AttendanceDataCleansingService {
String staffBeisenBaseCondition2 = "DATE_FORMAT(entry_date, '%Y-%m') <= '{}'";
staffBeisenBaseCondition2 = StrUtil.format(staffBeisenBaseCondition2, month);
staffBeisenBaseExample.createCriteria().andEqualTo("deletedFlag", 'N')
// .andEqualTo("staffPhone", "18684780942")
.andEqualTo("staffPhone", "18684780942")
.andCondition(staffBeisenBaseCondition1).andCondition(staffBeisenBaseCondition2);
List<StaffBeisenBaseInfo> staffBeiSenBaseInfos = staffBeisenBaseInfoMapper.selectByExample(staffBeisenBaseExample);
log.info("获取到 {} 条员工数据", staffBeiSenBaseInfos.size());
......@@ -314,6 +314,12 @@ public class AttendanceDataCleansingService {
clockInfo.getClockInAddrLng(), clockInfo.getClockInAddrLat(), clockInfo.getClockOutAddrLng(), clockInfo.getClockOutAddrLat());
try {
// 2. 处理每条考勤记录
// 判断改打卡日期是否在入职之前,如果在入职之前则不处理
if (DateUtil.compare(DateUtil.parse(clockInfo.getClockInDate(), "yyyy-MM-dd"), DateUtil.parse(employee.getEntryDate(), "yyyy-MM-dd")) < 0) {
log.info("{} 打卡日期:{},入职日期:{} 打卡日期在入职日期之前,不处理", employee.getStaffName(), clockInfo.getClockInDate(), employee.getEntryDate());
continue;
}
// 判断该打卡日期是否在离职直接之后,如果在离职日期之后则不计算
if (StrUtil.isNotBlank(employee.getLastWorkDate())) {
if (DateUtil.compare(DateUtil.parse(clockInfo.getClockInDate(), "yyyy-MM-dd"), DateUtil.parse(employee.getLastWorkDate(), "yyyy-MM-dd")) > 0) {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!