Explorar o código

传感器INIT

lchao %!s(int64=2) %!d(string=hai) anos
pai
achega
f3c5a9a237

+ 0 - 1
ruoyi-admin/src/main/java/com/ruoyi/tcp/EchoThread.java

@@ -13,7 +13,6 @@ public class EchoThread{
     private Socket client;
     PrintWriter out = null;
     InputStream in = null;
-    private String equid = null;
 
     public EchoThread(Socket client){
         this.client = client;

+ 1 - 52
ruoyi-admin/src/main/java/com/ruoyi/tcp/TcpClientHandler.java

@@ -1,15 +1,9 @@
 package com.ruoyi.tcp;
 
-
-
-import com.ruoyi.common.utils.file.ImageUtils;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.boot.CommandLineRunner;
 import org.springframework.stereotype.Component;
-
-import java.io.InputStream;
-import java.io.PrintWriter;
 import java.net.ServerSocket;
 import java.net.Socket;
 
@@ -17,16 +11,10 @@ import java.net.Socket;
 public class TcpClientHandler  extends Thread implements CommandLineRunner {
 
     private static final Logger log = LoggerFactory.getLogger(TcpClientHandler.class);
-    private Socket clientSocket;
-    private ServerSocket serverSocket;
-    private PrintWriter out;
-    private InputStream in;
     private Integer port = 8802;
 
     @Override
-    public void run(String... args) throws Exception
-    {
-
+    public void run(String... args){
         try{
             ServerSocket server = new ServerSocket(port);
             Socket client = null;
@@ -42,45 +30,6 @@ public class TcpClientHandler  extends Thread implements CommandLineRunner {
             // TODO Auto-generated catch block
             ex.printStackTrace();
         }
-//        try {
-//            serverSocket = new ServerSocket(8802);
-//            clientSocket = serverSocket.accept();
-//            SimpleDateFormat sdf = new SimpleDateFormat("YYYY-MM-DD hh:mm:ss");
-//            out = new PrintWriter(clientSocket.getOutputStream(),true);
-//            in = clientSocket.getInputStream();
-//            while(true)
-//            {
-//                String inputLine="";
-//                byte[] temp = new byte[1024];
-//                int length = in.read(temp);
-//                inputLine+=new String(temp,0,length);
-//                JSONObject object = JSONObject.parseObject(inputLine);
-//                String st = object.get("ST").toString();
-//                String serial = object.get("SERIAL").toString();
-//                if(".".equals(inputLine))
-//                {
-//                    out.println("bye");
-//                    break;
-//                }
-//                //传感器上报的数据===>inputLine
-//                System.out.println("===="+inputLine);
-//                //do sth
-//
-//                //do sth
-//                JSONObject res = new JSONObject();
-//                res.put("ST",st);
-//                res.put("SERIAL",serial);
-//                res.put("MARK","1");
-//                res.put("TM ", sdf.format(new Date()));
-//                out.println(res);
-//            }
-//            in.close();
-//            out.close();
-//            clientSocket.close();
-//        } catch (IOException e) {
-//            // TODO Auto-generated catch block
-//            e.printStackTrace();
-//        }
     }
 
 }

+ 269 - 0
ruoyi-admin/src/main/java/com/ruoyi/tcp/domain/InputLine.java

@@ -0,0 +1,269 @@
+package com.ruoyi.tcp.domain;
+
+import com.ruoyi.common.annotation.Excel;
+import com.ruoyi.common.core.domain.BaseEntity;
+import org.apache.commons.lang3.builder.ToStringBuilder;
+import org.apache.commons.lang3.builder.ToStringStyle;
+
+public class InputLine extends BaseEntity {
+
+
+    /** 测站唯一编码 */
+    private String st;
+
+    /** 功能码 */
+    @Excel(name = "功能码")
+    private String fun;
+
+    /** 数据采集时间 */
+    @Excel(name = "数据采集时间")
+    private String tt;
+
+    /** 通讯时间 */
+    @Excel(name = "通讯时间")
+    private String tm;
+
+    /** 版本 */
+    @Excel(name = "版本")
+    private Long ver;
+
+    /** 传输标志 */
+    @Excel(name = "传输标志")
+    private Long mark;
+
+    /** 数据包流水号 */
+    @Excel(name = "数据包流水号")
+    private Long serial;
+
+    /** 测站类型 */
+    @Excel(name = "测站类型")
+    private String type;
+
+    /** 设备温度 */
+    @Excel(name = "设备温度")
+    private Long dtemp;
+
+    /** 电池电量 */
+    @Excel(name = "电池电量")
+    private Long bat;
+
+    /** 设备通讯信号强度 */
+    @Excel(name = "设备通讯信号强度")
+    private Long signal;
+
+    /** 设备电池电压 */
+    @Excel(name = "设备电池电压")
+    private Long vt;
+
+
+
+    private String q1;
+
+
+
+    private String v1;
+
+
+
+    private String z1;
+
+
+
+    private String q;
+
+
+//    @Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
+    private String cq1;
+
+    /** 设备编码 */
+    @Excel(name = "设备编码")
+    private String deviceCode;
+
+    public void setSt(String st)
+    {
+        this.st = st;
+    }
+
+    public String getSt()
+    {
+        return st;
+    }
+    public void setFun(String fun)
+    {
+        this.fun = fun;
+    }
+
+    public String getFun()
+    {
+        return fun;
+    }
+    public void setTt(String tt)
+    {
+        this.tt = tt;
+    }
+
+    public String getTt()
+    {
+        return tt;
+    }
+    public void setTm(String tm)
+    {
+        this.tm = tm;
+    }
+
+    public String getTm()
+    {
+        return tm;
+    }
+    public void setVer(Long ver)
+    {
+        this.ver = ver;
+    }
+
+    public Long getVer()
+    {
+        return ver;
+    }
+    public void setMark(Long mark)
+    {
+        this.mark = mark;
+    }
+
+    public Long getMark()
+    {
+        return mark;
+    }
+    public void setSerial(Long serial)
+    {
+        this.serial = serial;
+    }
+
+    public Long getSerial()
+    {
+        return serial;
+    }
+    public void setType(String type)
+    {
+        this.type = type;
+    }
+
+    public String getType()
+    {
+        return type;
+    }
+    public void setDtemp(Long dtemp)
+    {
+        this.dtemp = dtemp;
+    }
+
+    public Long getDtemp()
+    {
+        return dtemp;
+    }
+    public void setBat(Long bat)
+    {
+        this.bat = bat;
+    }
+
+    public Long getBat()
+    {
+        return bat;
+    }
+    public void setSignal(Long signal)
+    {
+        this.signal = signal;
+    }
+
+    public Long getSignal()
+    {
+        return signal;
+    }
+    public void setVt(Long vt)
+    {
+        this.vt = vt;
+    }
+
+    public Long getVt()
+    {
+        return vt;
+    }
+    public void setQ1(String q1)
+    {
+        this.q1 = q1;
+    }
+
+    public String getQ1()
+    {
+        return q1;
+    }
+    public void setV1(String v1)
+    {
+        this.v1 = v1;
+    }
+
+    public String getV1()
+    {
+        return v1;
+    }
+    public void setZ1(String z1)
+    {
+        this.z1 = z1;
+    }
+
+    public String getZ1()
+    {
+        return z1;
+    }
+    public void setQ(String q)
+    {
+        this.q = q;
+    }
+
+    public String getQ()
+    {
+        return q;
+    }
+    public void setCq1(String cq1)
+    {
+        this.cq1 = cq1;
+    }
+
+    public String getCq1()
+    {
+        return cq1;
+    }
+    public void setDeviceCode(String deviceCode)
+    {
+        this.deviceCode = deviceCode;
+    }
+
+    public String getDeviceCode()
+    {
+        return deviceCode;
+    }
+
+    @Override
+    public String toString() {
+        return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
+                .append("st", getSt())
+                .append("fun", getFun())
+                .append("tt", getTt())
+                .append("tm", getTm())
+                .append("ver", getVer())
+                .append("mark", getMark())
+                .append("serial", getSerial())
+                .append("type", getType())
+                .append("dtemp", getDtemp())
+                .append("bat", getBat())
+                .append("signal", getSignal())
+                .append("vt", getVt())
+                .append("q1", getQ1())
+                .append("v1", getV1())
+                .append("z1", getZ1())
+                .append("q", getQ())
+                .append("cq1", getCq1())
+                .append("deviceCode", getDeviceCode())
+                .toString();
+    }
+}
+