|
@@ -620,7 +620,10 @@ public class RiskInspectionTaskServiceImpl implements IRiskInspectionTaskService
|
|
|
|| "扫码".equals(task.getCheckMethod());
|
|
|| "扫码".equals(task.getCheckMethod());
|
|
|
vo.setPunchType(isScan ? "SCAN" : "NORMAL");
|
|
vo.setPunchType(isScan ? "SCAN" : "NORMAL");
|
|
|
|
|
|
|
|
- // 2. 查最近一条记录(每日多时段按 (taskId, slot) 查;单时段/无 slot 按 taskId 查)
|
|
|
|
|
|
|
+ // 2. 查最近一条记录
|
|
|
|
|
+ // - 每日多时段按 (taskId, slot) 查,精确匹配
|
|
|
|
|
+ // - 兜底:若 (taskId, slot) 查不到(如老 record 没存 slot),fallback 查 (taskId, slot IS NULL)
|
|
|
|
|
+ // 否则单时段任务会误判成 PENDING/OVERDUE
|
|
|
RiskInspectionRecord latest = recordMapper.selectOne(
|
|
RiskInspectionRecord latest = recordMapper.selectOne(
|
|
|
Wrappers.<RiskInspectionRecord>lambdaQuery()
|
|
Wrappers.<RiskInspectionRecord>lambdaQuery()
|
|
|
.eq(RiskInspectionRecord::getTaskId, task.getId())
|
|
.eq(RiskInspectionRecord::getTaskId, task.getId())
|
|
@@ -628,6 +631,15 @@ public class RiskInspectionTaskServiceImpl implements IRiskInspectionTaskService
|
|
|
.orderByDesc(RiskInspectionRecord::getCheckInTime)
|
|
.orderByDesc(RiskInspectionRecord::getCheckInTime)
|
|
|
.last("LIMIT 1")
|
|
.last("LIMIT 1")
|
|
|
);
|
|
);
|
|
|
|
|
+ if (latest == null && StringUtils.isNotBlank(slot)) {
|
|
|
|
|
+ latest = recordMapper.selectOne(
|
|
|
|
|
+ Wrappers.<RiskInspectionRecord>lambdaQuery()
|
|
|
|
|
+ .eq(RiskInspectionRecord::getTaskId, task.getId())
|
|
|
|
|
+ .isNull(RiskInspectionRecord::getSlot)
|
|
|
|
|
+ .orderByDesc(RiskInspectionRecord::getCheckInTime)
|
|
|
|
|
+ .last("LIMIT 1")
|
|
|
|
|
+ );
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
// 3. 任务原始状态
|
|
// 3. 任务原始状态
|
|
|
String originStatus = task.getTaskStatus();
|
|
String originStatus = task.getTaskStatus();
|