1.检测模块:预检测框架提交
2.报文通用装置查询编写
This commit is contained in:
@@ -36,6 +36,11 @@
|
|||||||
<version>4.1.68.Final</version>
|
<version>4.1.68.Final</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.alibaba</groupId>
|
||||||
|
<artifactId>fastjson</artifactId>
|
||||||
|
<version>1.2.83</version>
|
||||||
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
</project>
|
</project>
|
||||||
@@ -0,0 +1,26 @@
|
|||||||
|
package com.njcn.gather.detection.handler;
|
||||||
|
|
||||||
|
import com.njcn.gather.detection.util.socket.SocketManager;
|
||||||
|
import com.njcn.gather.detection.util.socket.web.WebSocketHandler;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
public class SocketSourceResponseService {
|
||||||
|
|
||||||
|
private final WebSocketHandler webSocketHandler;
|
||||||
|
|
||||||
|
public void deal(String userId,String msg){
|
||||||
|
|
||||||
|
System.out.println("进入deal+++++++++++++++++++");
|
||||||
|
webSocketHandler.senMsgToUser(userId,msg);
|
||||||
|
|
||||||
|
SocketManager.getChannelByUserId(userId).close();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -4,7 +4,7 @@ import lombok.Data;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @author wr
|
* @author wr
|
||||||
* @description
|
* @description socket 通用发送报文请求
|
||||||
* @date 2024/12/11 15:57
|
* @date 2024/12/11 15:57
|
||||||
*/
|
*/
|
||||||
@Data
|
@Data
|
||||||
|
|||||||
@@ -8,7 +8,11 @@ package com.njcn.gather.detection.service;
|
|||||||
public interface PreDetectionService {
|
public interface PreDetectionService {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 源通讯校验
|
* 源通讯校验socket入参拼接
|
||||||
|
* @param
|
||||||
|
* @return: java.lang.String
|
||||||
|
* @Author: wr
|
||||||
|
* @Date: 2024/12/11 13:26
|
||||||
*/
|
*/
|
||||||
void sourceCommunicationCheck();
|
void sourceCommunicationCheck();
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
package com.njcn.gather.detection.service.impl;
|
package com.njcn.gather.detection.service.impl;
|
||||||
|
|
||||||
|
|
||||||
import com.njcn.gather.detection.handler.SocketResponseService;
|
import com.njcn.gather.detection.handler.SocketSourceResponseService;
|
||||||
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;
|
||||||
@@ -21,7 +21,7 @@ public class PreDetectionServiceImpl implements PreDetectionService {
|
|||||||
@Value("${socket.source.port}")
|
@Value("${socket.source.port}")
|
||||||
private static Integer port;
|
private static Integer port;
|
||||||
|
|
||||||
private final SocketResponseService socketResponseService;
|
private final SocketSourceResponseService sourceResponseService;
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -48,7 +48,7 @@ public class PreDetectionServiceImpl implements PreDetectionService {
|
|||||||
public void test() {
|
public void test() {
|
||||||
|
|
||||||
|
|
||||||
NettyClient.socketClient(ip,port,"test------------>",new NettySourceClientHandler("aa",socketResponseService));
|
NettyClient.socketClient(ip,port,"test------------>",new NettySourceClientHandler("aaa",sourceResponseService));
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,8 @@
|
|||||||
package com.njcn.gather.detection.util.socket;
|
package com.njcn.gather.detection.util.socket;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSON;
|
||||||
|
import com.njcn.gather.detection.pojo.vo.SocketMsg;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author wr
|
* @author wr
|
||||||
* @description
|
* @description
|
||||||
@@ -9,4 +12,7 @@ package com.njcn.gather.detection.util.socket;
|
|||||||
public class MsgUtil {
|
public class MsgUtil {
|
||||||
|
|
||||||
|
|
||||||
|
public SocketMsg a(String textMsg){
|
||||||
|
return JSON.parseObject(textMsg,SocketMsg.class);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -42,8 +42,8 @@ public class WebServiceManager {
|
|||||||
|
|
||||||
public static void sendMsg(String userId,String msg) {
|
public static void sendMsg(String userId,String msg) {
|
||||||
Channel channel = userSessions.get(userId);
|
Channel channel = userSessions.get(userId);
|
||||||
TextWebSocketFrame wd1 = new TextWebSocketFrame(msg);
|
TextWebSocketFrame wd = new TextWebSocketFrame(msg);
|
||||||
channel.writeAndFlush(wd1);
|
channel.writeAndFlush(wd);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -8,8 +8,6 @@ import io.netty.channel.socket.nio.NioSocketChannel;
|
|||||||
import io.netty.handler.codec.string.StringDecoder;
|
import io.netty.handler.codec.string.StringDecoder;
|
||||||
import io.netty.handler.codec.string.StringEncoder;
|
import io.netty.handler.codec.string.StringEncoder;
|
||||||
import io.netty.util.CharsetUtil;
|
import io.netty.util.CharsetUtil;
|
||||||
import io.swagger.models.auth.In;
|
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
|
||||||
|
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
@@ -45,7 +43,6 @@ public class NettyClient {
|
|||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
} finally {
|
} finally {
|
||||||
group.shutdownGracefully();
|
group.shutdownGracefully();
|
||||||
System.out.println("程序结束");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,18 +1,15 @@
|
|||||||
package com.njcn.gather.detection.util.socket.cilent;
|
package com.njcn.gather.detection.util.socket.cilent;
|
||||||
|
|
||||||
import com.njcn.gather.detection.handler.SocketResponseService;
|
import com.njcn.gather.detection.handler.SocketSourceResponseService;
|
||||||
import com.njcn.gather.detection.util.socket.SocketManager;
|
import com.njcn.gather.detection.util.socket.SocketManager;
|
||||||
import com.njcn.gather.detection.util.socket.WebServiceManager;
|
|
||||||
import io.netty.channel.Channel;
|
|
||||||
import io.netty.channel.ChannelHandlerContext;
|
import io.netty.channel.ChannelHandlerContext;
|
||||||
import io.netty.channel.SimpleChannelInboundHandler;
|
import io.netty.channel.SimpleChannelInboundHandler;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.springframework.stereotype.Component;
|
|
||||||
|
|
||||||
import java.util.Scanner;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Description: 客户端业务处理(示例)
|
* @Description: 源客户端业务处理(示例)
|
||||||
* @Author: wr
|
* @Author: wr
|
||||||
* @Date: 2024/12/10 14:16
|
* @Date: 2024/12/10 14:16
|
||||||
*/
|
*/
|
||||||
@@ -22,14 +19,7 @@ public class NettySourceClientHandler extends SimpleChannelInboundHandler<Strin
|
|||||||
|
|
||||||
private final String webUser;
|
private final String webUser;
|
||||||
|
|
||||||
private final SocketResponseService socketResponseService;
|
private final SocketSourceResponseService sourceResponseService;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -46,17 +36,7 @@ public class NettySourceClientHandler extends SimpleChannelInboundHandler<Strin
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
protected void channelRead0(ChannelHandlerContext ctx, String msg) throws InterruptedException {
|
protected void channelRead0(ChannelHandlerContext ctx, String msg) throws InterruptedException {
|
||||||
Channel userId = SocketManager.getChannelByUserId("userId");
|
sourceResponseService.deal(webUser,msg);
|
||||||
if(msg.endsWith("结束")){
|
|
||||||
WebServiceManager.sendMsg("","第一流程结束");
|
|
||||||
System.out.println("第一流程结束");
|
|
||||||
userId.close();
|
|
||||||
}else{
|
|
||||||
System.out.println("服务端消息 == " + msg);
|
|
||||||
|
|
||||||
socketResponseService.deal(webUser,msg);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ import io.netty.channel.socket.nio.NioServerSocketChannel;
|
|||||||
*/
|
*/
|
||||||
public class NettyServer {
|
public class NettyServer {
|
||||||
|
|
||||||
public static final int port = 8787;
|
public static final int port = 61000;
|
||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
NettyServer nettyServer = new NettyServer();
|
NettyServer nettyServer = new NettyServer();
|
||||||
|
|||||||
@@ -1,9 +1,12 @@
|
|||||||
package com.njcn.gather.detection.util.socket.web;
|
package com.njcn.gather.detection.util.socket.web;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSON;
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
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;
|
||||||
import io.netty.channel.Channel;
|
|
||||||
import io.netty.channel.ChannelHandler;
|
import io.netty.channel.ChannelHandler;
|
||||||
import io.netty.channel.ChannelHandlerContext;
|
import io.netty.channel.ChannelHandlerContext;
|
||||||
import io.netty.channel.SimpleChannelInboundHandler;
|
import io.netty.channel.SimpleChannelInboundHandler;
|
||||||
@@ -14,8 +17,8 @@ import org.springframework.stereotype.Component;
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Description: 泛型 代表的是处理数据的单位
|
* @Description: 泛型 代表的是处理数据的单位
|
||||||
* TextWebSocketFrame : 文本信息帧
|
* TextWebSocketFrame : 文本信息帧
|
||||||
* @Author: wr
|
* @Author: wr
|
||||||
* @Date: 2024/12/10 13:56
|
* @Date: 2024/12/10 13:56
|
||||||
*/
|
*/
|
||||||
@@ -25,6 +28,8 @@ import org.springframework.stereotype.Component;
|
|||||||
@Slf4j
|
@Slf4j
|
||||||
public class WebSocketHandler extends SimpleChannelInboundHandler<TextWebSocketFrame> {
|
public class WebSocketHandler extends SimpleChannelInboundHandler<TextWebSocketFrame> {
|
||||||
|
|
||||||
|
private final static String QUESTION_MARK = "?";
|
||||||
|
private final static String EQUAL_TO = "=";
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void channelActive(ChannelHandlerContext ctx) throws Exception {
|
public void channelActive(ChannelHandlerContext ctx) throws Exception {
|
||||||
@@ -41,10 +46,9 @@ public class WebSocketHandler extends SimpleChannelInboundHandler<TextWebSocketF
|
|||||||
String userId = getUrlParams(uri);
|
String userId = getUrlParams(uri);
|
||||||
WebServiceManager.addUser(userId, ctx.channel());
|
WebServiceManager.addUser(userId, ctx.channel());
|
||||||
log.info("登录的用户id是:{}", userId);
|
log.info("登录的用户id是:{}", userId);
|
||||||
|
|
||||||
//如果url包含参数,需要处理
|
//如果url包含参数,需要处理
|
||||||
if (uri.contains("?")) {
|
if (uri.contains(QUESTION_MARK)) {
|
||||||
String newUri = uri.substring(0, uri.indexOf("?"));
|
String newUri = uri.substring(0, uri.indexOf(QUESTION_MARK));
|
||||||
request.setUri(newUri);
|
request.setUri(newUri);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -52,36 +56,35 @@ public class WebSocketHandler extends SimpleChannelInboundHandler<TextWebSocketF
|
|||||||
//正常的TEXT消息类型
|
//正常的TEXT消息类型
|
||||||
TextWebSocketFrame frame = (TextWebSocketFrame) msg;
|
TextWebSocketFrame frame = (TextWebSocketFrame) msg;
|
||||||
log.info("客户端收到服务器数据:{}", frame.text());
|
log.info("客户端收到服务器数据:{}", frame.text());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
super.channelRead(ctx, msg);
|
super.channelRead(ctx, msg);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据用户地址获取用户名 ws://127.0.0.1:7777/hello?name=aa
|
||||||
|
* @param url
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
private static String getUrlParams(String url) {
|
private static String getUrlParams(String url) {
|
||||||
if (!url.contains("=")) {
|
if (!url.contains(EQUAL_TO)) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
String userId = url.substring(url.indexOf("=") + 1);
|
String userId = url.substring(url.indexOf(EQUAL_TO) + 1);
|
||||||
return userId;
|
return userId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void channelRead0(ChannelHandlerContext ctx, TextWebSocketFrame msg) {
|
protected void channelRead0(ChannelHandlerContext ctx, TextWebSocketFrame msg) {
|
||||||
/* System.out.println("服务端消息 == " + msg.text());
|
/* System.out.println("服务端消息 == " + msg.text());
|
||||||
if(msg.text().equals("下发指令")){
|
if(msg.text().equals("下发指令")){
|
||||||
*//**
|
*//**
|
||||||
* 处理对应消息
|
* 处理对应消息
|
||||||
* 1.先下发所要操作的流程信息
|
* 1.先下发所要操作的流程信息
|
||||||
* 2.组装对应的入参信息
|
* 2.组装对应的入参信息
|
||||||
* 3.再用socket信息返回结束
|
* 3.再用socket信息返回结束
|
||||||
*//*
|
*//*
|
||||||
//NettyClient.socketClient(msg.text(),new NettySourceClientHandler());
|
//NettyClient.socketClient(msg.text(),new NettySourceClientHandler());
|
||||||
|
|
||||||
}*/
|
}*/
|
||||||
@@ -95,7 +98,7 @@ public class WebSocketHandler extends SimpleChannelInboundHandler<TextWebSocketF
|
|||||||
@Override
|
@Override
|
||||||
public void handlerAdded(ChannelHandlerContext ctx) {
|
public void handlerAdded(ChannelHandlerContext ctx) {
|
||||||
//WebServiceManager.addUser(userId, ctx.channel());
|
//WebServiceManager.addUser(userId, ctx.channel());
|
||||||
System.out.println("有新的连接接入:"+ctx);
|
System.out.println("有新的连接接入:" + ctx);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -125,8 +128,8 @@ public class WebSocketHandler extends SimpleChannelInboundHandler<TextWebSocketF
|
|||||||
/**
|
/**
|
||||||
* 推送数据至前台
|
* 推送数据至前台
|
||||||
*/
|
*/
|
||||||
public void senMsgToUser(String userId,String msg){
|
public void senMsgToUser(String userId, String msg) {
|
||||||
WebServiceManager.sendMsg(userId,msg);
|
WebServiceManager.sendMsg(userId, msg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ public class WebSocketService {
|
|||||||
/**
|
/**
|
||||||
* 端口号
|
* 端口号
|
||||||
*/
|
*/
|
||||||
@Value("${webSocket.netty.port:7777}")
|
@Value("${webSocket.port}")
|
||||||
int port;
|
int port;
|
||||||
|
|
||||||
|
|
||||||
@@ -40,7 +40,7 @@ public class WebSocketService {
|
|||||||
|
|
||||||
|
|
||||||
@PostConstruct
|
@PostConstruct
|
||||||
public void start() throws InterruptedException {
|
public void start() {
|
||||||
new Thread(() -> {
|
new Thread(() -> {
|
||||||
//可以自定义线程的数量
|
//可以自定义线程的数量
|
||||||
bossGroup = new NioEventLoopGroup();
|
bossGroup = new NioEventLoopGroup();
|
||||||
@@ -94,41 +94,4 @@ public class WebSocketService {
|
|||||||
System.out.println("webSocket销毁---------------");
|
System.out.println("webSocket销毁---------------");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* public static void main(String[] args) {
|
|
||||||
//可以自定义线程的数量
|
|
||||||
EventLoopGroup bossGroup = new NioEventLoopGroup();
|
|
||||||
// 默认创建的线程数量 = CPU 处理器数量 *2
|
|
||||||
EventLoopGroup workerGroup = new NioEventLoopGroup();
|
|
||||||
try {
|
|
||||||
ServerBootstrap serverBootstrap = new ServerBootstrap();
|
|
||||||
serverBootstrap.group(bossGroup, workerGroup)
|
|
||||||
.channel(NioServerSocketChannel.class)
|
|
||||||
.handler(new LoggingHandler())
|
|
||||||
//当前连接被阻塞的时候,BACKLOG代表的事 阻塞队列的长度
|
|
||||||
.option(ChannelOption.SO_BACKLOG, 128)
|
|
||||||
//设置连接保持为活动状态
|
|
||||||
.childOption(ChannelOption.SO_KEEPALIVE, true)
|
|
||||||
.childHandler(new WebSocketInitializer());
|
|
||||||
|
|
||||||
ChannelFuture future = serverBootstrap.bind(7777).sync();
|
|
||||||
future.addListener(f -> {
|
|
||||||
if (future.isSuccess()) {
|
|
||||||
System.out.println("webSocket服务启动成功");
|
|
||||||
} else {
|
|
||||||
System.out.println("webSocket服务启动失败");
|
|
||||||
}
|
|
||||||
});
|
|
||||||
future.channel().closeFuture().sync();
|
|
||||||
} catch (InterruptedException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
} finally {
|
|
||||||
bossGroup.shutdownGracefully();
|
|
||||||
workerGroup.shutdownGracefully();
|
|
||||||
}
|
|
||||||
}*/
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ import com.njcn.gather.device.device.pojo.param.PqDevParam;
|
|||||||
import com.njcn.gather.device.device.pojo.po.PqDev;
|
import com.njcn.gather.device.device.pojo.po.PqDev;
|
||||||
import com.njcn.gather.device.device.pojo.vo.PqDevExcel;
|
import com.njcn.gather.device.device.pojo.vo.PqDevExcel;
|
||||||
import com.njcn.gather.device.device.pojo.vo.PqDevVO;
|
import com.njcn.gather.device.device.pojo.vo.PqDevVO;
|
||||||
|
import com.njcn.gather.device.device.pojo.vo.PreDetection;
|
||||||
import com.njcn.gather.device.device.service.IPqDevService;
|
import com.njcn.gather.device.device.service.IPqDevService;
|
||||||
import com.njcn.gather.device.pojo.constant.DevConst;
|
import com.njcn.gather.device.pojo.constant.DevConst;
|
||||||
import com.njcn.gather.device.pojo.enums.DevResponseEnum;
|
import com.njcn.gather.device.pojo.enums.DevResponseEnum;
|
||||||
@@ -37,6 +38,7 @@ import org.springframework.web.bind.annotation.*;
|
|||||||
import org.springframework.web.multipart.MultipartFile;
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
@@ -56,6 +58,17 @@ public class PqDevController extends BaseController {
|
|||||||
private final IDictDataService dictDataService;
|
private final IDictDataService dictDataService;
|
||||||
|
|
||||||
|
|
||||||
|
@OperateInfo
|
||||||
|
@GetMapping("/aaa")
|
||||||
|
@ApiOperation("分页查询被检设备")
|
||||||
|
@ApiImplicitParam(name = "queryParam", value = "查询参数", required = true)
|
||||||
|
public HttpResult<List<PreDetection> > aaa() {
|
||||||
|
String methodDescribe = getMethodDescribe("list");
|
||||||
|
List<PreDetection> devInfo = pqDevService.getDevInfo(Arrays.asList("578c142b7e4e4978a35bd6225aa62a23", "393504f55f1f79bce255bfc195cfdb56"));
|
||||||
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, devInfo, methodDescribe);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@OperateInfo
|
@OperateInfo
|
||||||
@PostMapping("/list")
|
@PostMapping("/list")
|
||||||
@ApiOperation("分页查询被检设备")
|
@ApiOperation("分页查询被检设备")
|
||||||
|
|||||||
@@ -2,6 +2,10 @@ package com.njcn.gather.device.device.mapper;
|
|||||||
|
|
||||||
import com.github.yulichang.base.MPJBaseMapper;
|
import com.github.yulichang.base.MPJBaseMapper;
|
||||||
import com.njcn.gather.device.device.pojo.po.PqDev;
|
import com.njcn.gather.device.device.pojo.po.PqDev;
|
||||||
|
import com.njcn.gather.device.device.pojo.vo.PreDetection;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author caozehui
|
* @author caozehui
|
||||||
@@ -9,5 +13,13 @@ import com.njcn.gather.device.device.pojo.po.PqDev;
|
|||||||
*/
|
*/
|
||||||
public interface PqDevMapper extends MPJBaseMapper<PqDev> {
|
public interface PqDevMapper extends MPJBaseMapper<PqDev> {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据装置id集合获取装置信息
|
||||||
|
* @param devIds 装置id
|
||||||
|
* @return: java.util.List<com.njcn.gather.device.device.pojo.vo.PreDetection>
|
||||||
|
* @Author: wr
|
||||||
|
* @Date: 2024/12/12 11:46
|
||||||
|
*/
|
||||||
|
List<PreDetection> selectDevInfo(@Param("devIds") List<String> devIds);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -2,6 +2,39 @@
|
|||||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
<mapper namespace="com.njcn.gather.device.device.mapper.PqDevMapper">
|
<mapper namespace="com.njcn.gather.device.device.mapper.PqDevMapper">
|
||||||
|
|
||||||
|
<!-- 通用查询映射结果 -->
|
||||||
|
<resultMap id="DevResultMap" type="com.njcn.gather.device.device.pojo.vo.PreDetection">
|
||||||
|
<id column="IP" property="devIP" />
|
||||||
|
<result column="Port" property="port" />
|
||||||
|
<result column="Dev_Type" property="devType" />
|
||||||
|
<result column="" property="icdType" />
|
||||||
|
<result column="Series" property="devCode" />
|
||||||
|
<result column="Dev_Key" property="devKey" />
|
||||||
|
<collection
|
||||||
|
property="monitorList"
|
||||||
|
column="{ devId = Id}"
|
||||||
|
select="com.njcn.gather.device.monitor.mapper.PqMonitorMapper.selectMonitorInfo"
|
||||||
|
>
|
||||||
|
</collection>
|
||||||
|
</resultMap>
|
||||||
|
<select id="selectDevInfo" resultMap="DevResultMap">
|
||||||
|
SELECT
|
||||||
|
d.Id,
|
||||||
|
d.IP,
|
||||||
|
( select name from sys_dict_data sd where d.Dev_Type= sd.id) as Dev_Type,
|
||||||
|
d.Port,
|
||||||
|
d.Series,
|
||||||
|
d.Dev_Key
|
||||||
|
FROM
|
||||||
|
pq_dev d
|
||||||
|
<where>
|
||||||
|
<if test="devIds !=null and devIds.size()!=0">
|
||||||
|
AND d.Id in
|
||||||
|
<foreach collection="devIds" open="(" close=")" item="item" separator=",">
|
||||||
|
#{item}
|
||||||
|
</foreach>
|
||||||
|
</if>
|
||||||
|
</where>
|
||||||
|
</select>
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,98 @@
|
|||||||
|
package com.njcn.gather.device.device.pojo.vo;
|
||||||
|
|
||||||
|
import cn.hutool.core.util.StrUtil;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
|
import com.njcn.gather.device.device.util.DeviceUtil;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author wr
|
||||||
|
* @description 预检测装置报文初始化
|
||||||
|
* @date 2024/12/12 11:21
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@NoArgsConstructor
|
||||||
|
public class PreDetection {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 装置ip
|
||||||
|
*/
|
||||||
|
@JsonProperty("devIP")
|
||||||
|
private String devIP;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 装置端口
|
||||||
|
*/
|
||||||
|
@JsonProperty("port")
|
||||||
|
private Integer port;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备类型,字典表
|
||||||
|
*/
|
||||||
|
@JsonProperty("devType")
|
||||||
|
private String devType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* icd设备类型
|
||||||
|
*/
|
||||||
|
@JsonProperty("icdType")
|
||||||
|
private String icdType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 装置识别码(3ds加密)
|
||||||
|
*/
|
||||||
|
@JsonProperty("devCode")
|
||||||
|
private String devCode;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 装置秘钥(3ds加密)
|
||||||
|
*/
|
||||||
|
@JsonProperty("devKey")
|
||||||
|
private String devKey;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 监测点信息
|
||||||
|
*/
|
||||||
|
@JsonProperty("monitorList")
|
||||||
|
private List<MonitorListDTO> monitorList;
|
||||||
|
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@NoArgsConstructor
|
||||||
|
public static class MonitorListDTO {
|
||||||
|
/**
|
||||||
|
* 监测点id
|
||||||
|
*/
|
||||||
|
@JsonProperty("lineId")
|
||||||
|
private String lineId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 监测点线路号
|
||||||
|
*/
|
||||||
|
@JsonProperty("line")
|
||||||
|
private Integer line;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDevKey() {
|
||||||
|
if(StrUtil.isNotBlank(devKey)){
|
||||||
|
String key = DeviceUtil.decoderString(1, devKey);
|
||||||
|
if(StrUtil.isNotBlank(key)){
|
||||||
|
return key;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDevCode() {
|
||||||
|
if(StrUtil.isNotBlank(devCode)){
|
||||||
|
String code= DeviceUtil.decoderString(1,devCode);
|
||||||
|
if(StrUtil.isNotBlank(code)){
|
||||||
|
return code;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -7,7 +7,9 @@ import com.njcn.gather.device.device.pojo.param.PqDevParam;
|
|||||||
import com.njcn.gather.device.device.pojo.po.PqDev;
|
import com.njcn.gather.device.device.pojo.po.PqDev;
|
||||||
import com.njcn.gather.device.device.pojo.vo.PqDevExcel;
|
import com.njcn.gather.device.device.pojo.vo.PqDevExcel;
|
||||||
import com.njcn.gather.device.device.pojo.vo.PqDevVO;
|
import com.njcn.gather.device.device.pojo.vo.PqDevVO;
|
||||||
|
import com.njcn.gather.device.device.pojo.vo.PreDetection;
|
||||||
import com.njcn.gather.device.plan.pojo.param.AdPlanParam;
|
import com.njcn.gather.device.plan.pojo.param.AdPlanParam;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
@@ -141,4 +143,13 @@ public interface IPqDevService extends IService<PqDev> {
|
|||||||
* @return 所有非未检测状态的设备列表
|
* @return 所有非未检测状态的设备列表
|
||||||
*/
|
*/
|
||||||
List<PqDev> listNotUnchecked();
|
List<PqDev> listNotUnchecked();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取装置信息和装置下监测点信息
|
||||||
|
* @param devIds
|
||||||
|
* @return: java.util.List<com.njcn.gather.device.device.pojo.vo.PreDetection>
|
||||||
|
* @Author: wr
|
||||||
|
* @Date: 2024/12/12 15:50
|
||||||
|
*/
|
||||||
|
List<PreDetection> getDevInfo(@Param("devIds") List<String> devIds);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ import com.njcn.gather.device.device.pojo.param.PqDevParam;
|
|||||||
import com.njcn.gather.device.device.pojo.po.PqDev;
|
import com.njcn.gather.device.device.pojo.po.PqDev;
|
||||||
import com.njcn.gather.device.device.pojo.vo.PqDevExcel;
|
import com.njcn.gather.device.device.pojo.vo.PqDevExcel;
|
||||||
import com.njcn.gather.device.device.pojo.vo.PqDevVO;
|
import com.njcn.gather.device.device.pojo.vo.PqDevVO;
|
||||||
|
import com.njcn.gather.device.device.pojo.vo.PreDetection;
|
||||||
import com.njcn.gather.device.device.service.IPqDevService;
|
import com.njcn.gather.device.device.service.IPqDevService;
|
||||||
import com.njcn.gather.device.device.util.DeviceUtil;
|
import com.njcn.gather.device.device.util.DeviceUtil;
|
||||||
import com.njcn.gather.device.monitor.pojo.po.PqMonitor;
|
import com.njcn.gather.device.monitor.pojo.po.PqMonitor;
|
||||||
@@ -334,6 +335,11 @@ public class PqDevServiceImpl extends ServiceImpl<PqDevMapper, PqDev> implements
|
|||||||
return queryWrapper;
|
return queryWrapper;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<PreDetection> getDevInfo(List<String> devIds) {
|
||||||
|
return this.baseMapper.selectDevInfo(devIds);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取检测状态饼状图数据
|
* 获取检测状态饼状图数据
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -1,7 +1,11 @@
|
|||||||
package com.njcn.gather.device.monitor.mapper;
|
package com.njcn.gather.device.monitor.mapper;
|
||||||
|
|
||||||
import com.github.yulichang.base.MPJBaseMapper;
|
import com.github.yulichang.base.MPJBaseMapper;
|
||||||
|
import com.njcn.gather.device.device.pojo.vo.PreDetection;
|
||||||
import com.njcn.gather.device.monitor.pojo.po.PqMonitor;
|
import com.njcn.gather.device.monitor.pojo.po.PqMonitor;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author caozehui
|
* @author caozehui
|
||||||
@@ -9,5 +13,13 @@ import com.njcn.gather.device.monitor.pojo.po.PqMonitor;
|
|||||||
*/
|
*/
|
||||||
public interface PqMonitorMapper extends MPJBaseMapper<PqMonitor> {
|
public interface PqMonitorMapper extends MPJBaseMapper<PqMonitor> {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据终端id获取监测点集合
|
||||||
|
* @param devId
|
||||||
|
* @return: java.util.List<com.njcn.gather.device.device.pojo.vo.PreDetection.MonitorListDTO>
|
||||||
|
* @Author: wr
|
||||||
|
* @Date: 2024/12/12 13:15
|
||||||
|
*/
|
||||||
|
List<PreDetection.MonitorListDTO> selectMonitorInfo(@Param("devId") String devId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -2,6 +2,16 @@
|
|||||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
<mapper namespace="com.njcn.gather.device.monitor.mapper.PqMonitorMapper">
|
<mapper namespace="com.njcn.gather.device.monitor.mapper.PqMonitorMapper">
|
||||||
|
|
||||||
|
<select id="selectMonitorInfo"
|
||||||
|
resultType="com.njcn.gather.device.device.pojo.vo.PreDetection$MonitorListDTO">
|
||||||
|
SELECT
|
||||||
|
Id as lineId,
|
||||||
|
Num as line
|
||||||
|
FROM
|
||||||
|
pq_monitor
|
||||||
|
WHERE
|
||||||
|
dev_id = #{devId}
|
||||||
|
</select>
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user