feat(ops): 扩展表增加时长统计字段

- 新增 dispatchedTime: 最近下发时间
- 新增 firstDispatchedTime: 首次下发时间(不受暂停影响)
- 新增 insertOrUpdateSelective 方法,保留 firstDispatchedTime

用于计算响应时长:arrivedTime - firstDispatchedTime - totalPauseSeconds

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
lzh
2026-01-25 18:21:21 +08:00
parent 8782a530fe
commit 3e23f9c65c
2 changed files with 30 additions and 0 deletions

View File

@@ -42,6 +42,14 @@ public class OpsOrderCleanExtDO extends BaseDO {
* 预计作业时长(分钟)
*/
private Integer expectedDuration;
/**
* 实际下发时间
*/
private LocalDateTime dispatchedTime;
/**
* 首次下发时间(用于计算响应时长,不受暂停影响)
*/
private LocalDateTime firstDispatchedTime;
/**
* 实际到岗时间
*/

View File

@@ -38,4 +38,26 @@ public interface OpsOrderCleanExtMapper extends BaseMapperX<OpsOrderCleanExtDO>
}
}
/**
* 插入或选择性更新扩展信息
* <p>
* 只更新非空字段,且保留 firstDispatchedTime已存在时不覆盖
*
* @param entity 扩展信息实体
* @return 影响行数
*/
default int insertOrUpdateSelective(OpsOrderCleanExtDO entity) {
OpsOrderCleanExtDO existing = selectByOpsOrderId(entity.getOpsOrderId());
if (existing == null) {
return insert(entity);
} else {
entity.setId(existing.getId());
// 保留首次下发时间
if (existing.getFirstDispatchedTime() != null && entity.getFirstDispatchedTime() != null) {
entity.setFirstDispatchedTime(existing.getFirstDispatchedTime());
}
return updateById(entity);
}
}
}