微调
This commit is contained in:
@@ -65,7 +65,7 @@ public class PreDetectionController extends BaseController {
|
||||
|
||||
@PostMapping("/ytxCheckSimulate")
|
||||
@OperateInfo
|
||||
@ApiOperation("模拟检测-源通讯校验")
|
||||
@ApiOperation("源通讯校验")
|
||||
@ApiImplicitParam(name = "param", value = "查询参数", required = true)
|
||||
public HttpResult<String> ytxCheckSimulate(@RequestBody @Validated SimulateDetectionParam param) {
|
||||
String methodDescribe = getMethodDescribe("ytxCheckSimulate");
|
||||
@@ -78,7 +78,7 @@ public class PreDetectionController extends BaseController {
|
||||
*/
|
||||
@PostMapping("/startSimulateTest")
|
||||
@OperateInfo
|
||||
@ApiOperation("模拟检测-下发脚本")
|
||||
@ApiOperation("启动")
|
||||
@ApiImplicitParam(name = "param", value = "查询参数", required = true)
|
||||
public HttpResult<String> startTestSimulate(@RequestBody @Validated SimulateDetectionParam param) {
|
||||
String methodDescribe = getMethodDescribe("startTestSimulate");
|
||||
@@ -91,7 +91,7 @@ public class PreDetectionController extends BaseController {
|
||||
*/
|
||||
@PostMapping("/closeSimulateTest")
|
||||
@OperateInfo
|
||||
@ApiOperation("模拟检测-停止")
|
||||
@ApiOperation("停止")
|
||||
@ApiImplicitParam(name = "param", value = "查询参数", required = true)
|
||||
public HttpResult<String> closeSimulateTest(@RequestBody @Validated SimulateDetectionParam param) {
|
||||
String methodDescribe = getMethodDescribe("closeSimulateTest");
|
||||
|
||||
@@ -12,8 +12,8 @@ public enum DetectionResponseEnum {
|
||||
SOURCE_INFO_NOT("A020002", "源表信息不存在"),
|
||||
PLAN_AND_SOURCE_NOT("A020003", "计划和源关系不存在"),
|
||||
ITEM_TEST_NOT("A020004", "检测项为空"),
|
||||
PLAN_DEV_IP_HAS("A20005","当前计划检测装置ip重复")
|
||||
;
|
||||
PLAN_DEV_IP_HAS("A20005","当前计划检测装置ip重复"),
|
||||
SOURCE_NOT_CONNECT("A020006", "源未连接");
|
||||
|
||||
private final String code;
|
||||
private final String message;
|
||||
|
||||
@@ -1,7 +1,10 @@
|
||||
package com.njcn.gather.detection.pojo.param;
|
||||
|
||||
import com.njcn.gather.source.pojo.constant.PqSourceValidMessage;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
|
||||
/**
|
||||
* @author caozehui
|
||||
* @data 2025-03-06
|
||||
@@ -30,6 +33,7 @@ public class SimulateDetectionParam {
|
||||
/**
|
||||
* 源id
|
||||
*/
|
||||
@NotBlank(message = PqSourceValidMessage.ID_NOT_BLANK)
|
||||
private String sourceId;
|
||||
|
||||
|
||||
|
||||
@@ -4,6 +4,7 @@ package com.njcn.gather.detection.service.impl;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.njcn.common.pojo.exception.BusinessException;
|
||||
import com.njcn.gather.detection.handler.SocketDevResponseService;
|
||||
@@ -12,6 +13,7 @@ import com.njcn.gather.detection.pojo.enums.DetectionResponseEnum;
|
||||
import com.njcn.gather.detection.pojo.enums.SourceOperateCodeEnum;
|
||||
import com.njcn.gather.detection.pojo.param.PreDetectionParam;
|
||||
import com.njcn.gather.detection.pojo.param.SimulateDetectionParam;
|
||||
import com.njcn.gather.detection.pojo.vo.SocketDataMsg;
|
||||
import com.njcn.gather.detection.pojo.vo.SocketMsg;
|
||||
import com.njcn.gather.detection.service.PreDetectionService;
|
||||
import com.njcn.gather.detection.util.socket.CnSocketUtil;
|
||||
@@ -276,6 +278,10 @@ public class PreDetectionServiceImpl implements PreDetectionService {
|
||||
|
||||
@Override
|
||||
public void closeTestSimulate(SimulateDetectionParam param) {
|
||||
Channel channel = SocketManager.getChannelByUserId(param.getUserPageId() + source);
|
||||
if (Objects.isNull(channel) || !channel.isActive()) {
|
||||
throw new BusinessException(DetectionResponseEnum.SOURCE_NOT_CONNECT);
|
||||
}
|
||||
SourceInitialize sourceParam = pqSourceService.getSourceInitializeParam(param.getSourceId());
|
||||
PreDetectionParam preDetectionParam = new PreDetectionParam();
|
||||
preDetectionParam.setSourceId(sourceParam.getSourceId());
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
package com.njcn.gather.source.pojo.constant;
|
||||
|
||||
/**
|
||||
* @author caozehui
|
||||
* @data 2025-03-07
|
||||
*/
|
||||
public interface PqSourceValidMessage {
|
||||
String ID_NOT_BLANK = "检测源id不能为空";
|
||||
}
|
||||
Reference in New Issue
Block a user