From 55fe1fe05f46f9b45b284aad8d252fa1a8064abc Mon Sep 17 00:00:00 2001 From: caozehui <2427765068@qq.com> Date: Mon, 15 Jun 2026 09:10:37 +0800 Subject: [PATCH] =?UTF-8?q?=E5=BE=AE=E8=B0=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../device/service/impl/PqDevServiceImpl.java | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/detection/src/main/java/com/njcn/gather/device/service/impl/PqDevServiceImpl.java b/detection/src/main/java/com/njcn/gather/device/service/impl/PqDevServiceImpl.java index bf9aa37f..f44510eb 100644 --- a/detection/src/main/java/com/njcn/gather/device/service/impl/PqDevServiceImpl.java +++ b/detection/src/main/java/com/njcn/gather/device/service/impl/PqDevServiceImpl.java @@ -37,8 +37,8 @@ import com.njcn.gather.device.service.IPqDevSubService; import com.njcn.gather.monitor.pojo.po.PqMonitor; import com.njcn.gather.monitor.pojo.vo.PqMonitorExcel; import com.njcn.gather.monitor.service.IPqMonitorService; -import com.njcn.gather.plan.pojo.enums.DataSourceEnum; import com.njcn.gather.plan.mapper.AdPlanMapper; +import com.njcn.gather.plan.pojo.enums.DataSourceEnum; import com.njcn.gather.plan.pojo.po.AdPlan; import com.njcn.gather.plan.service.IPqDevCheckHistoryService; import com.njcn.gather.pojo.enums.DetectionResponseEnum; @@ -505,7 +505,7 @@ public class PqDevServiceImpl extends ServiceImpl implements LambdaUpdateWrapper wrapper = new LambdaUpdateWrapper() .set(PqDevSub::getCheckResult, result.get(pqDevVo.getId())) .set(StrUtil.isNotBlank(userId), PqDevSub::getCheckBy, userId) - .set(PqDevSub::getCheckTime, LocalDateTime.now()) + .set(updateCheckNum, PqDevSub::getCheckTime, LocalDateTime.now()) .eq(PqDevSub::getDevId, pqDevVo.getId()); String currrentScene = sysTestConfigService.getCurrrentScene(); if (SceneEnum.PROVINCE_PLATFORM.getValue().equals(currrentScene)) { @@ -583,13 +583,22 @@ public class PqDevServiceImpl extends ServiceImpl implements SysUser user = userService.getById(userId); + // 查询当前设备的检测时间 + PqDevSub currentDevSub = pqDevSubService.lambdaQuery() + .eq(PqDevSub::getDevId, devId) + .one(); + LambdaUpdateChainWrapper w = pqDevSubService.lambdaUpdate() .set(PqDevSub::getCheckState, checkState) .set(PqDevSub::getCheckResult, checkResult) .set(PqDevSub::getReportState, DevReportStateEnum.NOT_GENERATED.getValue()) - .set(PqDevSub::getCheckTime, LocalDateTime.now()) .eq(PqDevSub::getDevId, devId); + // 只有当checkTime为空时,才设置为当前时间 + if (currentDevSub != null && currentDevSub.getCheckTime() == null) { + w.set(PqDevSub::getCheckTime, LocalDateTime.now()); + } + if (ObjectUtil.isNotNull(user)) { w.set(PqDevSub::getCheckBy, user.getName()); }