Browse Source

commit-2022年4月6日18:35:05

xiewenjie 3 years ago
parent
commit
def1562f69

+ 5 - 0
pom.xml

@@ -76,6 +76,11 @@
             <groupId>org.apache.commons</groupId>
             <artifactId>commons-pool2</artifactId>
         </dependency>
+<!--        <dependency>-->
+<!--            <groupId>org.bytedeco</groupId>-->
+<!--            <artifactId>javacv-platform</artifactId>-->
+<!--            <version>1.5.7</version>-->
+<!--        </dependency>-->
         <!--redis连接池 end-->
     </dependencies>
 

+ 2 - 3
src/main/java/com/fdkk/fdkkmeta/dto/BaseDto.java

@@ -1,7 +1,6 @@
-package com.fdkk.fdkkmeta.dto;
+package com.fdkk.fdkkmeta.entity.dto;
 
-import com.fdkk.fdkkmeta.po.PointPO;
-import javafx.geometry.Point3D;
+import com.fdkk.fdkkmeta.entity.po.PointPO;
 import lombok.*;
 
 /**

+ 1 - 6
src/main/java/com/fdkk/fdkkmeta/dto/PushDto.java

@@ -1,13 +1,8 @@
-package com.fdkk.fdkkmeta.dto;
+package com.fdkk.fdkkmeta.entity.dto;
 
-import cn.hutool.core.util.URLUtil;
-import javafx.geometry.Point3D;
 import lombok.*;
 
-import java.nio.charset.Charset;
-import java.util.HashMap;
 import java.util.List;
-import java.util.Map;
 
 /**
  * Created by Xiewj on 2021/7/29 0029 12:07

+ 1 - 3
src/main/java/com/fdkk/fdkkmeta/dto/RotateDto.java

@@ -1,9 +1,7 @@
-package com.fdkk.fdkkmeta.dto;
+package com.fdkk.fdkkmeta.entity.dto;
 
 import lombok.*;
 
-import java.util.List;
-
 /**
  * Created by Xiewj on 2021/7/29 0029 12:07
  */

+ 2 - 3
src/main/java/com/fdkk/fdkkmeta/dto/RouteDto.java

@@ -1,7 +1,6 @@
-package com.fdkk.fdkkmeta.dto;
+package com.fdkk.fdkkmeta.entity.dto;
 
-import com.fdkk.fdkkmeta.po.PointPO;
-import javafx.geometry.Point3D;
+import com.fdkk.fdkkmeta.entity.po.PointPO;
 import lombok.Data;
 
 /**

+ 1 - 1
src/main/java/com/fdkk/fdkkmeta/dto/UserOnlineDto.java

@@ -1,4 +1,4 @@
-package com.fdkk.fdkkmeta.dto;
+package com.fdkk.fdkkmeta.entity.dto;
 
 import lombok.*;
 

+ 1 - 1
src/main/java/com/fdkk/fdkkmeta/po/PointPO.java

@@ -1,4 +1,4 @@
-package com.fdkk.fdkkmeta.po;
+package com.fdkk.fdkkmeta.entity.po;
 
 import lombok.Data;
 

+ 1 - 1
src/main/java/com/fdkk/fdkkmeta/po/RoutePO.java

@@ -1,4 +1,4 @@
-package com.fdkk.fdkkmeta.po;
+package com.fdkk.fdkkmeta.entity.po;
 
 import lombok.Data;
 

+ 19 - 0
src/main/java/com/fdkk/fdkkmeta/entity/vo/PointsVO.java

@@ -0,0 +1,19 @@
+package com.fdkk.fdkkmeta.entity.vo;
+
+import com.fdkk.fdkkmeta.entity.po.PointPO;
+import lombok.Data;
+
+/**
+ * @author Xiewj
+ * @date 2022/4/6
+ */
+@Data
+public class PointsVO {
+    private PointPO point;
+
+    private String sceneCode;
+
+    private String roomId;
+
+    private String userId;
+}

+ 27 - 22
src/main/java/com/fdkk/fdkkmeta/socketIO/SocketIoServer.java

@@ -9,23 +9,22 @@ import cn.hutool.core.util.RuntimeUtil;
 import cn.hutool.core.util.StrUtil;
 import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
 import com.corundumstudio.socketio.AckRequest;
 import com.corundumstudio.socketio.SocketIOClient;
 import com.corundumstudio.socketio.SocketIOServer;
 import com.corundumstudio.socketio.annotation.OnConnect;
 import com.corundumstudio.socketio.annotation.OnDisconnect;
 import com.corundumstudio.socketio.annotation.OnEvent;
-import com.fdkk.fdkkmeta.dto.PushDto;
-import com.fdkk.fdkkmeta.dto.RotateDto;
-import com.fdkk.fdkkmeta.dto.RouteDto;
-import com.fdkk.fdkkmeta.po.RoutePO;
+import com.fdkk.fdkkmeta.entity.dto.PushDto;
+import com.fdkk.fdkkmeta.entity.dto.RotateDto;
+import com.fdkk.fdkkmeta.entity.dto.RouteDto;
+import com.fdkk.fdkkmeta.entity.vo.PointsVO;
 import com.fdkk.fdkkmeta.redis.RedisCache;
 import com.fdkk.fdkkmeta.util.FpsUtil;
 import com.fdkk.fdkkmeta.util.GenerateUserSig;
 import com.fdkk.fdkkmeta.util.TrtcUtil;
 import com.fdkk.fdkkmeta.util.kesar.GetRoute;
-import com.fdkk.fdkkmeta.util.kesar.MapInfo;
-import javafx.geometry.Point3D;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
@@ -33,6 +32,7 @@ import org.springframework.stereotype.Component;
 import java.io.FileInputStream;
 import java.io.IOException;
 import java.util.*;
+import java.util.concurrent.TimeUnit;
 
 /**
  * @author Xiewj
@@ -62,7 +62,6 @@ public class SocketIoServer {
         SocketIoServer.log.info("getRoute-接收到客户端消息:{}", JSON.toJSONString(param));
         JSONArray maps = GetRoute.getRoute("/home/webrtc/scenefreespacefile/target_freespace.json", param);
         pushMessageToUser("getRoute",param.getUserId(),maps);
-        client.sendEvent("getRoute",maps);
     }
 
 
@@ -259,8 +258,8 @@ public class SocketIoServer {
     @OnEvent(value = "joinRoom")
     public void onJoinRoomEvent(SocketIOClient client, AckRequest request, PushDto data) {
         client.joinRoom(data.getSceneCode());
-        String key="point:"+data.getSceneCode()+":r:"+data.getRoomId()+"u:"+data.getUserId();
-        redisCache.setCacheObject(key, data);
+        String key="point:"+data.getSceneCode()+"u:"+data.getUserId();
+        redisCache.setCacheObject(key,data,10, TimeUnit.MINUTES);
 
     }
     /**
@@ -269,23 +268,26 @@ public class SocketIoServer {
     @OnEvent(value = "leaveRoom")
     public void onLeaveRoomEvent(SocketIOClient client, AckRequest request, PushDto data) {
         client.leaveRoom(data.getSceneCode());
-        String key="point:"+data.getSceneCode()+":r:"+data.getRoomId()+"u:"+data.getUserId();
+        String key="point:"+data.getSceneCode()+"u:"+data.getUserId();
         redisCache.delete(key);
 
     }
     /**
      * 获取当前房间里面所有人的点位
      * */
-    @OnEvent(value = "roomPoint")
+    @OnEvent(value = "roomPoints")
     public void getRoomPointEvent(SocketIOClient client, AckRequest request, PushDto data) {
-        Set<Object> keys = redisCache.hKeys("point:" + data.getSceneCode() + "*");
-        List<PushDto> points=new ArrayList<>();
-        for (Object key : keys) {
-            String realKey=String.valueOf(key);
-            PushDto pushDto = redisCache.getCacheObject(realKey);
-            points.add(pushDto);
+        Collection<String> keys = redisCache.keys("point:" + data.getSceneCode() + "u*");
+        List<PointsVO> points=new ArrayList<>();
+        for (String key : keys) {
+            PushDto pushDto = redisCache.getCacheObject(key);
+            if (pushDto.getUserId()!=data.getUserId()){
+                PointsVO pointsVO=new PointsVO();
+                BeanUtil.copyProperties(pushDto,pointsVO);
+                points.add(pointsVO);
+            }
         }
-        client.sendEvent("roomPoint",points);
+        client.sendEvent("roomPoints",points);
     }
 
     @Autowired
@@ -299,7 +301,7 @@ public class SocketIoServer {
         String sa = client.getRemoteAddress().toString();
         String clientIp = sa.substring(1, sa.indexOf(":"));// 获取设备ip
         SocketIoServer.log.info(clientIp + "-------------------------" + "客户端已连接" + clientIp);
-        String userId = getParamsByClient(client);
+        String userId = getParamsByClient(client,"userId");
         if (userId != null) {
             SocketIoServer.log.info("userId"+userId);
             SocketIoServer.log.info("SessionId:  " + client.getSessionId());
@@ -316,8 +318,11 @@ public class SocketIoServer {
         String sa = client.getRemoteAddress().toString();
         String clientIp = sa.substring(1, sa.indexOf(":"));// 获取设备ip
         SocketIoServer.log.info(clientIp + "-------------------------" + "客户端已断开连接");
-        String userId = getParamsByClient(client);
+        String userId = getParamsByClient(client,"userId");
+        String sceneCode = getParamsByClient(client,"sceneCode");
         if (userId != null) {
+            String key="point:"+sceneCode+"u:"+userId;
+            redisCache.delete(key);
             SocketIoServerMapUtil.remove(userId);
             System.out.println("断开连接: " + userId);
             System.out.println("断开连接: " + client.getSessionId());
@@ -331,10 +336,10 @@ public class SocketIoServer {
      * @param client
      * @return
      */
-    private String getParamsByClient(SocketIOClient client) {
+    private String getParamsByClient(SocketIOClient client,String param) {
         // 从请求的连接中拿出参数(这里的loginUserNum必须是唯一标识)
         Map<String, List<String>> params = client.getHandshakeData().getUrlParams();
-        List<String> list = params.get("userId");
+        List<String> list = params.get(param);
         if (list != null && list.size() > 0) {
             return list.get(0);
         }

+ 174 - 92
src/main/java/com/fdkk/fdkkmeta/test/test.java

@@ -1,97 +1,179 @@
-package com.fdkk.fdkkmeta.test;
-
-import cn.hutool.core.date.DateUtil;
-import cn.hutool.core.io.file.FileWriter;
-import cn.hutool.core.util.URLUtil;
-import com.alibaba.fastjson.JSON;
-import com.alibaba.fastjson.JSONArray;
-import com.alibaba.fastjson.JSONObject;
-import com.fdkk.fdkkmeta.po.RoutePO;
-import com.fdkk.fdkkmeta.util.FileUtils;
-
-import java.io.BufferedReader;
-import java.io.IOException;
-import java.io.InputStreamReader;
-import java.nio.charset.Charset;
-import java.text.SimpleDateFormat;
-import java.util.*;
-import java.util.stream.Collectors;
-
-/**
- * @author Xiewj
- * @date 2022/3/29
- */
-public class test {
+//package com.fdkk.fdkkmeta.test;
+//
+//import cn.hutool.core.date.DateUtil;
+//import cn.hutool.core.io.BufferUtil;
+//import cn.hutool.core.io.FileUtil;
+//import cn.hutool.core.io.IORuntimeException;
+//import cn.hutool.core.io.IoUtil;
+//import cn.hutool.core.io.file.FileWriter;
+//import cn.hutool.core.lang.Console;
+//import cn.hutool.core.util.StrUtil;
+//import cn.hutool.core.util.URLUtil;
+//import cn.hutool.log.StaticLog;
+//import cn.hutool.socket.aio.AioServer;
+//import cn.hutool.socket.aio.AioSession;
+//import cn.hutool.socket.aio.SimpleIoAction;
+//import cn.hutool.socket.nio.NioServer;
+//import com.alibaba.fastjson.JSON;
+//import com.alibaba.fastjson.JSONArray;
+//import com.alibaba.fastjson.JSONObject;
+//import com.fdkk.fdkkmeta.po.RoutePO;
+//import com.fdkk.fdkkmeta.util.FileUtils;
+//import org.bytedeco.ffmpeg.global.avcodec;
+//import org.bytedeco.javacv.FFmpegFrameGrabber;
+//import org.bytedeco.javacv.FFmpegFrameRecorder;
+//import org.bytedeco.javacv.Frame;
+//
+//import java.io.*;
+//import java.nio.ByteBuffer;
+//import java.nio.charset.Charset;
+//import java.text.SimpleDateFormat;
+//import java.util.*;
+//import java.util.stream.Collectors;
+//
+///**
+// * @author Xiewj
+// * @date 2022/3/29
+// */
+//public class test {
+////    public static void main(String[] args) throws IOException {
+////        int d=6;
+////        int fps=2 % d;
+////        if (fps!=0){
+////            fps=2/d+1;
+////        }
+////
+////        System.out.println(fps);
+////
+////    }
 //    public static void main(String[] args) throws IOException {
-//        int d=6;
-//        int fps=2 % d;
-//        if (fps!=0){
-//            fps=2/d+1;
+//
+//        NioServer server = new NioServer(9099);
+//        server.setChannelHandler((sc)->{
+//            ByteBuffer readBuffer = ByteBuffer.allocate(1024);
+//            try{
+//                //从channel读数据到缓冲区
+//                int readBytes = sc.read(readBuffer);
+//                if (readBytes > 0) {
+//                    //Flips this buffer.  The limit is set to the current position and then
+//                    // the position is set to zero,就是表示要从起始位置开始读取数据
+//                    readBuffer.flip();
+//                    //eturns the number of elements between the current position and the  limit.
+//                    // 要读取的字节长度
+//                    byte[] bytes = new byte[readBuffer.remaining()];
+//                    //将缓冲区的数据读到bytes数组
+//                    readBuffer.get(bytes);
+//                    String body = StrUtil.utf8Str(bytes);
+//                    Console.log("[{}]: {}", sc.getRemoteAddress(), body);
+//                    String outputFile = "rtmp://demo-kms.4dage.com/live/test12";
+//                    try {
+//                        frameRecord(sc.socket().getInputStream(), outputFile, 1);
+//                    } catch (Exception e) {
+//                        e.printStackTrace();
+//                    }
+//                } else if (readBytes < 0) {
+//                    IoUtil.close(sc);
+//                }
+//            } catch (IOException e){
+//                throw new IORuntimeException(e);
+//            }
+//        });
+//        server.listen();
+//    }
+//    /**
+//     * 按帧录制视频
+//     *
+//     * @param inputFile-该地址可以是网络直播/录播地址,也可以是远程/本地文件路径
+//     * @param outputFile
+//     *            -该地址只能是文件地址,如果使用该方法推送流媒体服务器会报错,原因是没有设置编码格式
+//     * @throws org.bytedeco.javacv.FrameRecorder.Exception
+//     */
+//    public static void frameRecord(InputStream inputFile, String outputFile, int audioChannel)
+//            throws Exception, org.bytedeco.javacv.FrameRecorder.Exception {
+//        boolean isStart=true;//该变量建议设置为全局控制变量,用于控制录制结束
+//        // 获取视频源
+//        FFmpegFrameGrabber grabber = new FFmpegFrameGrabber(inputFile);
+//        grabber.setOption("rtsp_transport", "tcp");
+//        // 流媒体输出地址,分辨率(长,高),是否录制音频(0:不录制/1:录制)
+//        FFmpegFrameRecorder recorder = new FFmpegFrameRecorder(outputFile, 1280, 720, audioChannel);
+//        recorder.setVideoCodec(avcodec.AV_CODEC_ID_H264);
+//        recorder.setFormat("flv");
+//        // 开始取视频源
+//        recordByFrame(grabber, recorder, isStart);
+//    }
+//    private static void recordByFrame(FFmpegFrameGrabber grabber, FFmpegFrameRecorder recorder, Boolean status)
+//            throws Exception, org.bytedeco.javacv.FrameRecorder.Exception {
+//        try {//建议在线程中使用该方法
+//            grabber.start();
+//            recorder.start();
+//            Frame frame =null ;
+//            while (status&& (frame = grabber.grabFrame()) != null) {
+//                recorder.record(frame);
+//            }
+//            recorder.stop();
+//            grabber.stop();
+//        } finally {
+//            if (grabber != null) {
+//                grabber.stop();
+//            }
 //        }
+//    }
 //
-//        System.out.println(fps);
 //
+//    private static void createdPointsJson(String path) {
+//        List<String> list = FileUtils.readFileByLines2(path);
+//        JSONArray array=new JSONArray();
+//        FileWriter writer=new FileWriter("D:\\video\\points.json");
+//        for (int i = 0; i < list.size(); i++) {
+//            JSONObject jsonObject=new JSONObject();
+//            String[] s = list.get(i).split(" ");
+//            jsonObject.put("id",i );
+//            JSONObject position=new JSONObject();
+//            position.put("x",Double.valueOf(s[0]));
+//            position.put("y",Double.valueOf(s[1]));
+//            position.put("z",Double.valueOf(s[2]));
+//            jsonObject.put("position",position);
+//            JSONObject rotation=new JSONObject();
+//            rotation.put("x",0.0);
+//            rotation.put("y",0.0);
+//            rotation.put("z",0.0);
+//            rotation.put("w",1.0);
+//            jsonObject.put("rotation",rotation);
+//            List<String> strings = Arrays.asList(s[4], s[5], s[6], s[7], s[8], s[9], s[10], s[11]);
+//            List<Integer> contact = strings.stream().filter(a -> !a.equals("-1")).map(a->{
+//                return Integer.parseInt(a)-1;
+//            }).collect(Collectors.toList());
+//            jsonObject.put("contact",contact);
+//            array.add(jsonObject);
+//        }
+//        writer.write(array.toJSONString());
+//    }
+//
+//    private static void creatTargetJson(String path) {
+//        List<String> list = FileUtils.readFileByLines2(path);
+//        List<String> collect = new ArrayList<>();
+//        FileWriter writer=new FileWriter("D:\\video\\target_freespace.json");
+//        for (int i = 0; i < list.size(); i++) {
+//            RoutePO po = new RoutePO();
+//            String[] s = list.get(i).split(" ");
+//            po.setId(i );
+//            if (s.length == 12) {
+//                double[] oldPoint = {Double.valueOf(s[0]), Double.valueOf(s[1]), Double.valueOf(s[2])};
+//                po.setX(oldPoint[0]);
+//                po.setY(oldPoint[1]);
+//                po.setZ(oldPoint[2]);
+//                po.setWeight(Double.parseDouble(s[3]));
+//                List<String> strings = Arrays.asList(s[4], s[5], s[6], s[7], s[8], s[9], s[10], s[11]);
+//                List<Integer> contact = strings.stream().map(a->{
+//                    if (Integer.parseInt(a)!=-1){
+//                        return Integer.parseInt(a)-1;
+//                    }
+//                    return Integer.parseInt(a);
+//                }).collect(Collectors.toList());
+//                po.setIds(contact);
+//            }
+//            collect.add(JSON.toJSONString(po));
+//        }
+//        writer.writeLines(collect);
 //    }
-    public static void main(String[] args) throws IOException {
-        String path="C:\\Users\\4DAGE\\Downloads\\final_freespace(1).csv";
-        createdPointsJson(path);
-        creatTargetJson(path);
-    }
-
-    private static void createdPointsJson(String path) {
-        List<String> list = FileUtils.readFileByLines2(path);
-        JSONArray array=new JSONArray();
-        FileWriter writer=new FileWriter("D:\\video\\points.json");
-        for (int i = 0; i < list.size(); i++) {
-            JSONObject jsonObject=new JSONObject();
-            String[] s = list.get(i).split(" ");
-            jsonObject.put("id",i );
-            JSONObject position=new JSONObject();
-            position.put("x",Double.valueOf(s[0]));
-            position.put("y",Double.valueOf(s[1]));
-            position.put("z",Double.valueOf(s[2]));
-            jsonObject.put("position",position);
-            JSONObject rotation=new JSONObject();
-            rotation.put("x",0.0);
-            rotation.put("y",0.0);
-            rotation.put("z",0.0);
-            rotation.put("w",1.0);
-            jsonObject.put("rotation",rotation);
-            List<String> strings = Arrays.asList(s[4], s[5], s[6], s[7], s[8], s[9], s[10], s[11]);
-            List<Integer> contact = strings.stream().filter(a -> !a.equals("-1")).map(a->{
-                return Integer.parseInt(a)-1;
-            }).collect(Collectors.toList());
-            jsonObject.put("contact",contact);
-            array.add(jsonObject);
-        }
-        writer.write(array.toJSONString());
-    }
-
-    private static void creatTargetJson(String path) {
-        List<String> list = FileUtils.readFileByLines2(path);
-        List<String> collect = new ArrayList<>();
-        FileWriter writer=new FileWriter("D:\\video\\target_freespace.json");
-        for (int i = 0; i < list.size(); i++) {
-            RoutePO po = new RoutePO();
-            String[] s = list.get(i).split(" ");
-            po.setId(i );
-            if (s.length == 12) {
-                double[] oldPoint = {Double.valueOf(s[0]), Double.valueOf(s[1]), Double.valueOf(s[2])};
-                po.setX(oldPoint[0]);
-                po.setY(oldPoint[1]);
-                po.setZ(oldPoint[2]);
-                po.setWeight(Double.parseDouble(s[3]));
-                List<String> strings = Arrays.asList(s[4], s[5], s[6], s[7], s[8], s[9], s[10], s[11]);
-                List<Integer> contact = strings.stream().map(a->{
-                    if (Integer.parseInt(a)!=-1){
-                        return Integer.parseInt(a)-1;
-                    }
-                    return Integer.parseInt(a);
-                }).collect(Collectors.toList());
-                po.setIds(contact);
-            }
-            collect.add(JSON.toJSONString(po));
-        }
-        writer.writeLines(collect);
-    }
-}
+//}

+ 1 - 6
src/main/java/com/fdkk/fdkkmeta/util/TrtcUtil.java

@@ -1,15 +1,10 @@
 package com.fdkk.fdkkmeta.util;
 
-import cn.hutool.core.util.URLUtil;
 import com.fdkk.fdkkmeta.config.TrtcConfig;
-import com.fdkk.fdkkmeta.dto.PushDto;
+import com.fdkk.fdkkmeta.entity.dto.PushDto;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
 
-import java.nio.charset.Charset;
-import java.util.HashMap;
-import java.util.Map;
-
 /**
  * @author Xiewj
  * @date 2022/3/29

+ 2 - 2
src/main/java/com/fdkk/fdkkmeta/util/kesar/AStar.java

@@ -1,6 +1,6 @@
 package com.fdkk.fdkkmeta.util.kesar;
 
-import com.fdkk.fdkkmeta.po.RoutePO;
+import com.fdkk.fdkkmeta.entity.po.RoutePO;
 import lombok.extern.slf4j.Slf4j;
 
 import java.util.*;
@@ -111,7 +111,7 @@ public class AStar {
         RoutePO routePO = mapInfo.maps.get(id);
         List<Integer> linkedIds = routePO.getIds();
         for (int i = 0; i < linkedIds.size(); ++i) {
-            if (linkedIds.get(i)!=-1) {
+            if (linkedIds.get(i)==-1) {
                 continue;
             }
             int linkedId = Integer.valueOf(linkedIds.get(i));

+ 17 - 21
src/main/java/com/fdkk/fdkkmeta/util/kesar/GetRoute.java

@@ -5,12 +5,11 @@ import cn.hutool.core.io.file.FileReader;
 import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
-import com.fdkk.fdkkmeta.dto.RouteDto;
-import com.fdkk.fdkkmeta.po.RoutePO;
+import com.fdkk.fdkkmeta.entity.dto.RouteDto;
+import com.fdkk.fdkkmeta.entity.po.RoutePO;
 import lombok.extern.slf4j.Slf4j;
 
 import java.util.*;
-import java.util.stream.Collectors;
 
 @Slf4j
 public class GetRoute {
@@ -108,13 +107,13 @@ public class GetRoute {
         GetRoute.log.info("数量: {}", collect.size());
         GetRoute.log.info("棋盘获取路线点-开始点{},{}", _start.x, _start.y);
         GetRoute.log.info("棋盘获取路线点-结束点{},{}", _end.x, _end.y);
-//        超过1.1米就找不到路径
-        if (startDistance[0] > 1.1 || endDistance[0] > 1.1) {
-            GetRoute.log.info("超过1.1米就找不到路径startDistance {},endDistance{}", startDistance[0], endDistance[0]);
-            GetRoute.log.info("开始最近距离{} ", startDistance[0]);
-            GetRoute.log.info("结束最近距离{}", endDistance[0]);
-            return null;
-        }
+////        超过1.1米就找不到路径
+//        if (startDistance[0] > 1.1 || endDistance[0] > 1.1) {
+//            GetRoute.log.info("超过1.1米就找不到路径startDistance {},endDistance{}", startDistance[0], endDistance[0]);
+//            GetRoute.log.info("开始最近距离{} ", startDistance[0]);
+//            GetRoute.log.info("结束最近距离{}", endDistance[0]);
+//            return null;
+//        }
 
         Coord startVirtualCoord = new Coord(GetRoute.minStartId.getX(), GetRoute.minStartId.getY(), GetRoute.minStartId.getZ());
         Coord endVirtualCoord = new Coord(GetRoute.minEndId.getX(), GetRoute.minEndId.getY(), GetRoute.minEndId.getZ());
@@ -150,10 +149,10 @@ public class GetRoute {
 
         //起点不在path上,path的第一个点对应的是格子
 
-        JSONObject start = new JSONObject();
-        start.put("id", GetRoute.start.id);
-        start.put("location", GetRoute.start.coord);
-        route.add(start);
+//        JSONObject start = new JSONObject();
+//        start.put("id", GetRoute.start.id);
+//        start.put("location", GetRoute.start.coord);
+//        route.add(start);
 
         Double[] virtualEndPosition = new Double[3];
         for (int i = 0; i < mappath.size(); ++i) {
@@ -161,15 +160,12 @@ public class GetRoute {
             JSONObject item = new JSONObject();
             item.put("location", node.coord);
             item.put("id", node.id);
-            virtualEndPosition[0] = node.coord.x;
-            virtualEndPosition[1] = node.coord.y;
-            virtualEndPosition[2] = node.coord.z;
             route.add(item);
         }
-        JSONObject end = new JSONObject();
-        start.put("id", GetRoute.end.id);
-        end.put("location", GetRoute.end.coord);
-        route.add(end);
+//        JSONObject end = new JSONObject();
+//        start.put("id", GetRoute.end.id);
+//        end.put("location", GetRoute.end.coord);
+//        route.add(end);
         return route;
     }
 

+ 1 - 1
src/main/java/com/fdkk/fdkkmeta/util/kesar/MapInfo.java

@@ -1,7 +1,7 @@
 package com.fdkk.fdkkmeta.util.kesar;
 
 
-import com.fdkk.fdkkmeta.po.RoutePO;
+import com.fdkk.fdkkmeta.entity.po.RoutePO;
 
 import java.util.Map;
 

+ 30 - 5
src/test/java/com/fdkk/fdkkmeta/FdkkMetaApplicationTests.java

@@ -1,6 +1,11 @@
 package com.fdkk.fdkkmeta;
 
 import cn.hutool.core.io.IoUtil;
+import cn.hutool.core.lang.Console;
+import cn.hutool.core.util.StrUtil;
+import cn.hutool.socket.aio.AioClient;
+import cn.hutool.socket.aio.AioSession;
+import cn.hutool.socket.aio.SimpleIoAction;
 import com.fdkk.fdkkmeta.config.TrtcConfig;
 import com.fdkk.fdkkmeta.redis.RedisCache;
 import org.junit.jupiter.api.Test;
@@ -9,17 +14,37 @@ import org.springframework.boot.test.context.SpringBootTest;
 
 import java.io.FileInputStream;
 import java.io.FileNotFoundException;
+import java.net.InetSocketAddress;
+import java.nio.ByteBuffer;
 
 @SpringBootTest
 class FdkkMetaApplicationTests {
     @Autowired
     RedisCache redisService;
     @Test
-    void contextLoads() throws FileNotFoundException {
-        byte[] bytes = IoUtil.readBytes(new FileInputStream("D:\\video\\o.mp4"));
-        redisService.setCacheObject("test",bytes);
-        byte[] test = redisService.getCacheObject("test");
-        System.out.println(test.length);
+    void contextLoads() throws FileNotFoundException, InterruptedException {
+        byte[] bytes1 = IoUtil.readBytes(new FileInputStream("D:\\video\\1.mp4"));
+        byte[] bytes2 = IoUtil.readBytes(new FileInputStream("D:\\video\\2.mp4"));
+
+        AioClient client = new AioClient(new InetSocketAddress("localhost", 8899), new SimpleIoAction() {
+
+            @Override
+            public void doAction(AioSession session, ByteBuffer data) {
+                if(data.hasRemaining()) {
+                    Console.log(StrUtil.utf8Str(data));
+                    session.read();
+                }
+                Console.log("OK");
+            }
+        });
+
+        client.write(ByteBuffer.wrap(bytes1));
+        Thread.sleep(5000);
+        client.write(ByteBuffer.wrap(bytes2));
+
+        client.read();
+
+        client.close();
     }
 
 }