记录设备检测开始&结束时间

This commit is contained in:
caozehui
2026-06-15 10:45:40 +08:00
parent 55fe1fe05f
commit 31a956a1fc
6 changed files with 26 additions and 9 deletions

View File

@@ -356,6 +356,7 @@ public class SocketContrastResponseService {
FormalTestManager.currentStep = SourceOperateCodeEnum.YJC_SBTXJY; FormalTestManager.currentStep = SourceOperateCodeEnum.YJC_SBTXJY;
FormalTestManager.checkStartTime = LocalDateTime.now();
} }
public void deal(PreDetectionParam param, String msg) throws Exception { public void deal(PreDetectionParam param, String msg) throws Exception {

View File

@@ -1805,6 +1805,7 @@ public class SocketDevResponseService {
} }
FormalTestManager.overload = getOverloadResult(param); FormalTestManager.overload = getOverloadResult(param);
FormalTestManager.checkStartTime = LocalDateTime.now();
} }

View File

@@ -13,6 +13,7 @@ import com.njcn.gather.plan.pojo.po.AdPlanTestConfig;
import com.njcn.gather.script.pojo.po.SourceIssue; import com.njcn.gather.script.pojo.po.SourceIssue;
import com.njcn.gather.system.dictionary.pojo.enums.DictDataEnum; import com.njcn.gather.system.dictionary.pojo.enums.DictDataEnum;
import java.time.LocalDateTime;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
@@ -213,4 +214,9 @@ public class FormalTestManager {
* 过载信息如果检测到电压过载overload=1如果检测到电流过载overload=2如果检测到电压&&电流过载overload=3反之overload=4 * 过载信息如果检测到电压过载overload=1如果检测到电流过载overload=2如果检测到电压&&电流过载overload=3反之overload=4
*/ */
public static int overload; public static int overload;
/**
* 检测开始时间
*/
public static LocalDateTime checkStartTime;
} }

View File

@@ -56,10 +56,16 @@ public class PqDevSub {
private String checkBy; private String checkBy;
/** /**
* 检测时间 * 检测开始时间
*/ */
@TableField("Check_Time") @TableField("Check_Start_Time")
private LocalDateTime checkTime; private LocalDateTime checkStartTime;
/**
* 检测开始时间
*/
@TableField("Check_End_Time")
private LocalDateTime checkEndTime;
/** /**
* 预检测耗时 * 预检测耗时

View File

@@ -26,6 +26,7 @@ import com.njcn.common.pojo.poi.PullDown;
import com.njcn.common.pojo.response.HttpResult; import com.njcn.common.pojo.response.HttpResult;
import com.njcn.common.utils.EncryptionUtil; import com.njcn.common.utils.EncryptionUtil;
import com.njcn.db.mybatisplus.constant.DbConstant; 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.mapper.PqDevMapper;
import com.njcn.gather.device.pojo.enums.*; import com.njcn.gather.device.pojo.enums.*;
import com.njcn.gather.device.pojo.param.PqDevParam; import com.njcn.gather.device.pojo.param.PqDevParam;
@@ -505,7 +506,8 @@ public class PqDevServiceImpl extends ServiceImpl<PqDevMapper, PqDev> implements
LambdaUpdateWrapper<PqDevSub> wrapper = new LambdaUpdateWrapper<PqDevSub>() LambdaUpdateWrapper<PqDevSub> wrapper = new LambdaUpdateWrapper<PqDevSub>()
.set(PqDevSub::getCheckResult, result.get(pqDevVo.getId())) .set(PqDevSub::getCheckResult, result.get(pqDevVo.getId()))
.set(StrUtil.isNotBlank(userId), PqDevSub::getCheckBy, userId) .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()); .eq(PqDevSub::getDevId, pqDevVo.getId());
String currrentScene = sysTestConfigService.getCurrrentScene(); String currrentScene = sysTestConfigService.getCurrrentScene();
if (SceneEnum.PROVINCE_PLATFORM.getValue().equals(currrentScene)) { if (SceneEnum.PROVINCE_PLATFORM.getValue().equals(currrentScene)) {
@@ -595,8 +597,9 @@ public class PqDevServiceImpl extends ServiceImpl<PqDevMapper, PqDev> implements
.eq(PqDevSub::getDevId, devId); .eq(PqDevSub::getDevId, devId);
// 只有当checkTime为空时才设置为当前时间 // 只有当checkTime为空时才设置为当前时间
if (currentDevSub != null && currentDevSub.getCheckTime() == null) { if (currentDevSub != null && currentDevSub.getCheckEndTime() == null) {
w.set(PqDevSub::getCheckTime, LocalDateTime.now()); w.set(PqDevSub::getCheckEndTime, LocalDateTime.now());
w.set(ObjectUtil.isNotNull(FormalTestManager.checkStartTime), PqDevSub::getCheckStartTime, currentDevSub.getCheckStartTime());
} }
if (ObjectUtil.isNotNull(user)) { if (ObjectUtil.isNotNull(user)) {

View File

@@ -2234,9 +2234,9 @@ public class PqReportServiceImpl extends ServiceImpl<PqReportMapper, PqReport> i
// 检测日期 // 检测日期
PqDevSub devSub = iPqDevSubService.lambdaQuery().eq(PqDevSub::getDevId, pqDevVO.getId()).one(); PqDevSub devSub = iPqDevSubService.lambdaQuery().eq(PqDevSub::getDevId, pqDevVO.getId()).one();
if (Objects.nonNull(devSub)) { if (Objects.nonNull(devSub)) {
LocalDateTime checkTime = devSub.getCheckTime(); LocalDateTime checkEndTime = devSub.getCheckEndTime();
if (Objects.nonNull(checkTime)) { if (Objects.nonNull(checkEndTime)) {
baseModelMap.put(BaseReportKeyEnum.TEST_DATE.getKey(), DateUtil.format(checkTime, DatePattern.NORM_DATE_PATTERN)); baseModelMap.put(BaseReportKeyEnum.TEST_DATE.getKey(), DateUtil.format(checkEndTime, DatePattern.NORM_DATE_PATTERN));
} else { } else {
baseModelMap.put(BaseReportKeyEnum.TEST_DATE.getKey(), StrPool.TAB); baseModelMap.put(BaseReportKeyEnum.TEST_DATE.getKey(), StrPool.TAB);
} }