From 31a956a1fc304dad1094f72def8f19314ca91f80 Mon Sep 17 00:00:00 2001 From: caozehui <2427765068@qq.com> Date: Mon, 15 Jun 2026 10:45:40 +0800 Subject: [PATCH] =?UTF-8?q?=E8=AE=B0=E5=BD=95=E8=AE=BE=E5=A4=87=E6=A3=80?= =?UTF-8?q?=E6=B5=8B=E5=BC=80=E5=A7=8B&=E7=BB=93=E6=9D=9F=E6=97=B6?= =?UTF-8?q?=E9=97=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../handler/SocketContrastResponseService.java | 1 + .../detection/handler/SocketDevResponseService.java | 1 + .../detection/util/socket/FormalTestManager.java | 6 ++++++ .../com/njcn/gather/device/pojo/po/PqDevSub.java | 12 +++++++++--- .../gather/device/service/impl/PqDevServiceImpl.java | 9 ++++++--- .../report/service/impl/PqReportServiceImpl.java | 6 +++--- 6 files changed, 26 insertions(+), 9 deletions(-) diff --git a/detection/src/main/java/com/njcn/gather/detection/handler/SocketContrastResponseService.java b/detection/src/main/java/com/njcn/gather/detection/handler/SocketContrastResponseService.java index a4f52e96..1f10f954 100644 --- a/detection/src/main/java/com/njcn/gather/detection/handler/SocketContrastResponseService.java +++ b/detection/src/main/java/com/njcn/gather/detection/handler/SocketContrastResponseService.java @@ -356,6 +356,7 @@ public class SocketContrastResponseService { FormalTestManager.currentStep = SourceOperateCodeEnum.YJC_SBTXJY; + FormalTestManager.checkStartTime = LocalDateTime.now(); } public void deal(PreDetectionParam param, String msg) throws Exception { diff --git a/detection/src/main/java/com/njcn/gather/detection/handler/SocketDevResponseService.java b/detection/src/main/java/com/njcn/gather/detection/handler/SocketDevResponseService.java index c70a200b..2a10c1d5 100644 --- a/detection/src/main/java/com/njcn/gather/detection/handler/SocketDevResponseService.java +++ b/detection/src/main/java/com/njcn/gather/detection/handler/SocketDevResponseService.java @@ -1805,6 +1805,7 @@ public class SocketDevResponseService { } FormalTestManager.overload = getOverloadResult(param); + FormalTestManager.checkStartTime = LocalDateTime.now(); } diff --git a/detection/src/main/java/com/njcn/gather/detection/util/socket/FormalTestManager.java b/detection/src/main/java/com/njcn/gather/detection/util/socket/FormalTestManager.java index 074dc8a4..33def10d 100644 --- a/detection/src/main/java/com/njcn/gather/detection/util/socket/FormalTestManager.java +++ b/detection/src/main/java/com/njcn/gather/detection/util/socket/FormalTestManager.java @@ -13,6 +13,7 @@ import com.njcn.gather.plan.pojo.po.AdPlanTestConfig; import com.njcn.gather.script.pojo.po.SourceIssue; import com.njcn.gather.system.dictionary.pojo.enums.DictDataEnum; +import java.time.LocalDateTime; import java.util.ArrayList; import java.util.HashMap; import java.util.List; @@ -213,4 +214,9 @@ public class FormalTestManager { * 过载信息,如果检测到电压过载,overload=1;如果检测到电流过载,overload=2;如果检测到电压&&电流过载,overload=3;反之,overload=4 */ public static int overload; + + /** + * 检测开始时间 + */ + public static LocalDateTime checkStartTime; } diff --git a/detection/src/main/java/com/njcn/gather/device/pojo/po/PqDevSub.java b/detection/src/main/java/com/njcn/gather/device/pojo/po/PqDevSub.java index 0ad69969..08124e64 100644 --- a/detection/src/main/java/com/njcn/gather/device/pojo/po/PqDevSub.java +++ b/detection/src/main/java/com/njcn/gather/device/pojo/po/PqDevSub.java @@ -56,10 +56,16 @@ public class PqDevSub { private String checkBy; /** - * 检测时间 + * 检测开始时间 */ - @TableField("Check_Time") - private LocalDateTime checkTime; + @TableField("Check_Start_Time") + private LocalDateTime checkStartTime; + + /** + * 检测开始时间 + */ + @TableField("Check_End_Time") + private LocalDateTime checkEndTime; /** * 预检测耗时 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 f44510eb..5653a6d9 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 @@ -26,6 +26,7 @@ import com.njcn.common.pojo.poi.PullDown; import com.njcn.common.pojo.response.HttpResult; import com.njcn.common.utils.EncryptionUtil; import com.njcn.db.mybatisplus.constant.DbConstant; +import com.njcn.gather.detection.util.socket.FormalTestManager; import com.njcn.gather.device.mapper.PqDevMapper; import com.njcn.gather.device.pojo.enums.*; import com.njcn.gather.device.pojo.param.PqDevParam; @@ -505,7 +506,8 @@ 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(updateCheckNum, PqDevSub::getCheckTime, LocalDateTime.now()) + .set(updateCheckNum, PqDevSub::getCheckEndTime, LocalDateTime.now()) + .set(updateCheckNum && ObjectUtil.isNotNull(FormalTestManager.checkStartTime), PqDevSub::getCheckStartTime, FormalTestManager.checkStartTime) .eq(PqDevSub::getDevId, pqDevVo.getId()); String currrentScene = sysTestConfigService.getCurrrentScene(); if (SceneEnum.PROVINCE_PLATFORM.getValue().equals(currrentScene)) { @@ -595,8 +597,9 @@ public class PqDevServiceImpl extends ServiceImpl implements .eq(PqDevSub::getDevId, devId); // 只有当checkTime为空时,才设置为当前时间 - if (currentDevSub != null && currentDevSub.getCheckTime() == null) { - w.set(PqDevSub::getCheckTime, LocalDateTime.now()); + if (currentDevSub != null && currentDevSub.getCheckEndTime() == null) { + w.set(PqDevSub::getCheckEndTime, LocalDateTime.now()); + w.set(ObjectUtil.isNotNull(FormalTestManager.checkStartTime), PqDevSub::getCheckStartTime, currentDevSub.getCheckStartTime()); } if (ObjectUtil.isNotNull(user)) { diff --git a/detection/src/main/java/com/njcn/gather/report/service/impl/PqReportServiceImpl.java b/detection/src/main/java/com/njcn/gather/report/service/impl/PqReportServiceImpl.java index 08447229..bd821062 100644 --- a/detection/src/main/java/com/njcn/gather/report/service/impl/PqReportServiceImpl.java +++ b/detection/src/main/java/com/njcn/gather/report/service/impl/PqReportServiceImpl.java @@ -2234,9 +2234,9 @@ public class PqReportServiceImpl extends ServiceImpl i // 检测日期 PqDevSub devSub = iPqDevSubService.lambdaQuery().eq(PqDevSub::getDevId, pqDevVO.getId()).one(); if (Objects.nonNull(devSub)) { - LocalDateTime checkTime = devSub.getCheckTime(); - if (Objects.nonNull(checkTime)) { - baseModelMap.put(BaseReportKeyEnum.TEST_DATE.getKey(), DateUtil.format(checkTime, DatePattern.NORM_DATE_PATTERN)); + LocalDateTime checkEndTime = devSub.getCheckEndTime(); + if (Objects.nonNull(checkEndTime)) { + baseModelMap.put(BaseReportKeyEnum.TEST_DATE.getKey(), DateUtil.format(checkEndTime, DatePattern.NORM_DATE_PATTERN)); } else { baseModelMap.put(BaseReportKeyEnum.TEST_DATE.getKey(), StrPool.TAB); }