|
|
|
|
@ -1,5 +1,6 @@
|
|
|
|
|
package com.zhehekeji.web.service.RFID;
|
|
|
|
|
|
|
|
|
|
import com.baomidou.mybatisplus.extension.api.R;
|
|
|
|
|
import lombok.SneakyThrows;
|
|
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
|
|
|
|
|
|
|
@ -46,6 +47,7 @@ public class RFIDSocket {
|
|
|
|
|
return tags;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public RFIDSocket(String ip,int port){
|
|
|
|
|
socket = new Socket();
|
|
|
|
|
os = null;
|
|
|
|
|
@ -103,11 +105,13 @@ public class RFIDSocket {
|
|
|
|
|
while (buffer.size()> 0){
|
|
|
|
|
String code = readTag();
|
|
|
|
|
if(code != null){
|
|
|
|
|
if(!tags.contains(code))
|
|
|
|
|
// 写入log
|
|
|
|
|
/*if(!tags.contains(code))
|
|
|
|
|
{
|
|
|
|
|
fw.write(code+"\n");
|
|
|
|
|
fw.flush();
|
|
|
|
|
}
|
|
|
|
|
}*/
|
|
|
|
|
System.out.println(code);
|
|
|
|
|
tags.add(code);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
@ -236,7 +240,8 @@ public class RFIDSocket {
|
|
|
|
|
|
|
|
|
|
public static void main(String[] args) throws IOException, InterruptedException {
|
|
|
|
|
RFIDSocket rfid = new RFIDSocket("10.43.26.124",4001);
|
|
|
|
|
file = new File("F:\\Leaper\\Programs\\Java\\backend-duoji-monitor\\logs\\code.txt");
|
|
|
|
|
file = new File("D:\\code.txt");
|
|
|
|
|
file.createNewFile();
|
|
|
|
|
fw = new FileWriter(file, true);
|
|
|
|
|
fw.write("\n");
|
|
|
|
|
rfid.startCheck();
|
|
|
|
|
|