|
@@ -1,13 +1,12 @@
|
|
-package com.ruoyi.common.server;
|
|
|
|
|
|
+package com.ruoyi.web.v2.server;
|
|
|
|
|
|
|
|
|
|
-import cn.hutool.core.util.ObjectUtil;
|
|
|
|
-import com.ruoyi.common.utils.ModBusUtils;
|
|
|
|
|
|
+import com.ruoyi.web.v2.v1.entity.ProtSj;
|
|
|
|
+import com.ruoyi.web.v2.v1.service.IProtSjService;
|
|
import io.netty.buffer.ByteBuf;
|
|
import io.netty.buffer.ByteBuf;
|
|
import io.netty.buffer.ByteBufUtil;
|
|
import io.netty.buffer.ByteBufUtil;
|
|
import io.netty.buffer.Unpooled;
|
|
import io.netty.buffer.Unpooled;
|
|
import io.netty.channel.*;
|
|
import io.netty.channel.*;
|
|
-import io.netty.util.CharsetUtil;
|
|
|
|
import org.slf4j.Logger;
|
|
import org.slf4j.Logger;
|
|
import org.slf4j.LoggerFactory;
|
|
import org.slf4j.LoggerFactory;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
@@ -16,14 +15,12 @@ import org.springframework.stereotype.Component;
|
|
|
|
|
|
import java.nio.ByteBuffer;
|
|
import java.nio.ByteBuffer;
|
|
import java.nio.ByteOrder;
|
|
import java.nio.ByteOrder;
|
|
-import java.nio.charset.StandardCharsets;
|
|
|
|
import java.time.LocalDateTime;
|
|
import java.time.LocalDateTime;
|
|
import java.time.LocalTime;
|
|
import java.time.LocalTime;
|
|
import java.time.ZoneId;
|
|
import java.time.ZoneId;
|
|
import java.util.Date;
|
|
import java.util.Date;
|
|
import java.util.Map;
|
|
import java.util.Map;
|
|
import java.util.concurrent.ConcurrentHashMap;
|
|
import java.util.concurrent.ConcurrentHashMap;
|
|
-import java.util.concurrent.TimeUnit;
|
|
|
|
|
|
|
|
import static ch.qos.logback.core.encoder.ByteArrayUtil.hexStringToByteArray;
|
|
import static ch.qos.logback.core.encoder.ByteArrayUtil.hexStringToByteArray;
|
|
|
|
|
|
@@ -43,8 +40,7 @@ public class EnvInputServerHandler extends ChannelInboundHandlerAdapter {
|
|
private StringBuilder askTextSb = null;
|
|
private StringBuilder askTextSb = null;
|
|
|
|
|
|
@Autowired
|
|
@Autowired
|
|
- private RedisTemplate<String,String> redisTemplate;
|
|
|
|
-
|
|
|
|
|
|
+ private IProtSjService protSjService;
|
|
|
|
|
|
private Map<String, String> channelMap = new ConcurrentHashMap<>();
|
|
private Map<String, String> channelMap = new ConcurrentHashMap<>();
|
|
|
|
|
|
@@ -109,6 +105,8 @@ public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception
|
|
System.out.println("氨氮: " + ammonia + " mg/L");
|
|
System.out.println("氨氮: " + ammonia + " mg/L");
|
|
System.out.println("总磷: " + phosphorus + " mg/L");
|
|
System.out.println("总磷: " + phosphorus + " mg/L");
|
|
|
|
|
|
|
|
+ protSjService.save(new ProtSj(cod+"",ph+"",flow+"",ammonia+"",phosphorus+"",new Date()));
|
|
|
|
+
|
|
} finally {
|
|
} finally {
|
|
// 7. 释放 ByteBuf
|
|
// 7. 释放 ByteBuf
|
|
byteBuf.release();
|
|
byteBuf.release();
|