测试提交
This commit is contained in:
@@ -36,6 +36,13 @@
|
|||||||
<version>4.1.68.Final</version>
|
<version>4.1.68.Final</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.njcn.gather</groupId>
|
||||||
|
<artifactId>device</artifactId>
|
||||||
|
<version>1.0.0</version>
|
||||||
|
<scope>compile</scope>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.alibaba</groupId>
|
<groupId>com.alibaba</groupId>
|
||||||
<artifactId>fastjson</artifactId>
|
<artifactId>fastjson</artifactId>
|
||||||
|
|||||||
@@ -1,17 +1,21 @@
|
|||||||
package com.njcn.gather.detection.controller;
|
package com.njcn.gather.detection.controller;
|
||||||
|
|
||||||
|
import com.njcn.common.pojo.annotation.OperateInfo;
|
||||||
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
||||||
import com.njcn.common.pojo.response.HttpResult;
|
import com.njcn.common.pojo.response.HttpResult;
|
||||||
|
import com.njcn.gather.detection.pojo.param.PreDetectionParam;
|
||||||
import com.njcn.gather.detection.service.PreDetectionService;
|
import com.njcn.gather.detection.service.PreDetectionService;
|
||||||
import com.njcn.web.controller.BaseController;
|
import com.njcn.web.controller.BaseController;
|
||||||
import com.njcn.web.utils.HttpResultUtil;
|
import com.njcn.web.utils.HttpResultUtil;
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
|
import io.swagger.annotations.ApiImplicitParam;
|
||||||
|
import io.swagger.annotations.ApiOperation;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.apache.commons.collections4.Get;
|
import org.apache.commons.collections4.Get;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.*;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import java.util.List;
|
||||||
|
|
||||||
@Slf4j
|
@Slf4j
|
||||||
@Api(tags = "预检测")
|
@Api(tags = "预检测")
|
||||||
@@ -22,13 +26,18 @@ public class PreDetectionController extends BaseController {
|
|||||||
|
|
||||||
private final PreDetectionService preDetectionService;
|
private final PreDetectionService preDetectionService;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
* 开始检测
|
||||||
*/
|
*/
|
||||||
@GetMapping("/test")
|
@PostMapping("/startTest")
|
||||||
public HttpResult<String> test(){
|
@OperateInfo
|
||||||
String methodDescribe = getMethodDescribe("test");
|
@ApiOperation("开始检测")
|
||||||
preDetectionService.test();
|
@ApiImplicitParam(name = "param", value = "查询参数", required = true)
|
||||||
|
public HttpResult<String> startTest(@RequestBody PreDetectionParam param){
|
||||||
|
String methodDescribe = getMethodDescribe("startTest");
|
||||||
|
preDetectionService.startTest(param);
|
||||||
|
|
||||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,9 +1,21 @@
|
|||||||
package com.njcn.gather.detection.pojo.param;
|
package com.njcn.gather.detection.pojo.param;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author wr
|
* @author wr
|
||||||
* @description
|
* @description
|
||||||
* @date 2024/12/11 13:45
|
* @date 2024/12/11 13:45
|
||||||
*/
|
*/
|
||||||
|
@Data
|
||||||
public class PreDetectionParam {
|
public class PreDetectionParam {
|
||||||
|
|
||||||
|
//用户功能组成唯一标识 zhangsan_test
|
||||||
|
private String userPageId;
|
||||||
|
|
||||||
|
private List<String> devIds;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,9 @@
|
|||||||
package com.njcn.gather.detection.service;
|
package com.njcn.gather.detection.service;
|
||||||
|
|
||||||
|
import com.njcn.gather.detection.pojo.param.PreDetectionParam;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author wr
|
* @author wr
|
||||||
* @description 预检测流程
|
* @description 预检测流程
|
||||||
@@ -32,7 +36,7 @@ public interface PreDetectionService {
|
|||||||
void phaseSequenceCheck();
|
void phaseSequenceCheck();
|
||||||
|
|
||||||
|
|
||||||
void test();
|
void startTest(PreDetectionParam param);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,25 +1,42 @@
|
|||||||
package com.njcn.gather.detection.service.impl;
|
package com.njcn.gather.detection.service.impl;
|
||||||
|
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSON;
|
||||||
|
import com.alibaba.fastjson.JSONArray;
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import com.njcn.gather.detection.handler.SocketSourceResponseService;
|
import com.njcn.gather.detection.handler.SocketSourceResponseService;
|
||||||
|
import com.njcn.gather.detection.handler.SocketResponseService;
|
||||||
|
import com.njcn.gather.detection.pojo.param.PreDetectionParam;
|
||||||
|
import com.njcn.gather.detection.pojo.vo.SocketMsg;
|
||||||
import com.njcn.gather.detection.service.PreDetectionService;
|
import com.njcn.gather.detection.service.PreDetectionService;
|
||||||
|
|
||||||
import com.njcn.gather.detection.util.socket.cilent.NettyClient;
|
import com.njcn.gather.detection.util.socket.cilent.NettyClient;
|
||||||
import com.njcn.gather.detection.util.socket.cilent.NettySourceClientHandler;
|
import com.njcn.gather.detection.util.socket.cilent.NettySourceClientHandler;
|
||||||
|
import com.njcn.gather.device.device.mapper.PqDevMapper;
|
||||||
|
import com.njcn.gather.device.device.pojo.po.PqDev;
|
||||||
|
import com.njcn.gather.device.device.pojo.vo.PreDetection;
|
||||||
|
import com.njcn.gather.device.device.service.IPqDevService;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
@RequiredArgsConstructor
|
@RequiredArgsConstructor
|
||||||
public class PreDetectionServiceImpl implements PreDetectionService {
|
public class PreDetectionServiceImpl implements PreDetectionService {
|
||||||
|
|
||||||
|
private final IPqDevService iPqDevService;
|
||||||
|
|
||||||
|
|
||||||
@Value("${socket.source.ip}")
|
@Value("${socket.source.ip}")
|
||||||
private static String ip;
|
private String ip;
|
||||||
|
|
||||||
@Value("${socket.source.port}")
|
@Value("${socket.source.port}")
|
||||||
private static Integer port;
|
private Integer port;
|
||||||
|
|
||||||
private final SocketSourceResponseService sourceResponseService;
|
private final SocketSourceResponseService sourceResponseService;
|
||||||
|
|
||||||
@@ -45,10 +62,22 @@ public class PreDetectionServiceImpl implements PreDetectionService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void test() {
|
public void startTest(PreDetectionParam param) {
|
||||||
|
List<PreDetection> pqDevList = iPqDevService.getDevInfo(Arrays.asList("578c142b7e4e4978a35bd6225aa62a23", "393504f55f1f79bce255bfc195cfdb56"));
|
||||||
|
System.out.println(pqDevList);
|
||||||
|
//校验
|
||||||
|
|
||||||
|
//组装请求数据
|
||||||
|
SocketMsg socketMsg = new SocketMsg();
|
||||||
|
Map<String,List<PreDetection> > map=new HashMap();
|
||||||
|
map.put("deviceList",pqDevList);
|
||||||
|
String jsonString = JSON.toJSONString(map);
|
||||||
|
socketMsg.setRequestId("adawdawd");
|
||||||
|
socketMsg.setOperateCode("INIT_GATHER$03");
|
||||||
|
socketMsg.setData(jsonString);
|
||||||
|
String json = JSON.toJSONString(socketMsg);
|
||||||
|
|
||||||
NettyClient.socketClient(ip,port,"test------------>",new NettySourceClientHandler("aaa",sourceResponseService));
|
NettyClient.socketClient(ip,port,"{\"data\":\"{\\\"deviceList\\\":[{\\\"devIP\\\":\\\"192.168.1.186\\\",\\\"port\\\":102,\\\"devType\\\":\\\"PQS882B\\\",\\\"icdType\\\":\\\"PQS882_VX_ZJ_1(V102)\\\",\\\"devCode\\\":\\\"Pqs\\u0026cn870299\\\",\\\"devKey\\\":\\\"!qaz@wsx3edc4rfv\\\",\\\"monitorList\\\":[{\\\"lineId\\\":\\\"1_192.168.1.186_102_1\\\",\\\"line\\\":1}]}]}\",\"operateCode\":\"INIT_GATHER$03\",\"requestId\":\"dansldquiwdlandalksn\"}",new NettySourceClientHandler(param.getUserPageId(),sourceResponseService));
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,7 +3,6 @@ package com.njcn.gather.detection.util.socket.web;
|
|||||||
import com.alibaba.fastjson.JSON;
|
import com.alibaba.fastjson.JSON;
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import com.njcn.gather.detection.pojo.vo.SocketMsg;
|
import com.njcn.gather.detection.pojo.vo.SocketMsg;
|
||||||
import com.njcn.gather.detection.pojo.vo.aa;
|
|
||||||
import com.njcn.gather.detection.util.socket.WebServiceManager;
|
import com.njcn.gather.detection.util.socket.WebServiceManager;
|
||||||
import com.njcn.gather.detection.util.socket.cilent.NettyClient;
|
import com.njcn.gather.detection.util.socket.cilent.NettyClient;
|
||||||
import com.njcn.gather.detection.util.socket.cilent.NettySourceClientHandler;
|
import com.njcn.gather.detection.util.socket.cilent.NettySourceClientHandler;
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ public class WebSocketService {
|
|||||||
/**
|
/**
|
||||||
* 端口号
|
* 端口号
|
||||||
*/
|
*/
|
||||||
@Value("${webSocket.port}")
|
@Value("${webSocket.port:7777}")
|
||||||
int port;
|
int port;
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -45,8 +45,8 @@ mybatis-plus:
|
|||||||
|
|
||||||
socket:
|
socket:
|
||||||
source:
|
source:
|
||||||
ip: 127.0.0.1
|
ip: 192.168.1.138
|
||||||
port: 7777
|
port: 61000
|
||||||
device:
|
device:
|
||||||
ip: 127.0.0.1
|
ip: 127.0.0.1
|
||||||
port: 7777
|
port: 7777
|
||||||
|
|||||||
Reference in New Issue
Block a user