Browse Source

模块拆分

gao.qiang 1 year ago
parent
commit
05faf6496d
30 changed files with 2991 additions and 1194 deletions
  1. 1 0
      .idea/compiler.xml
  2. 2 0
      .idea/encodings.xml
  3. 4 1
      business-service/pom.xml
  4. 990 0
      business-service/src/main/java/com/ozs/utils/CameraUtil.java
  5. 53 0
      business-service/src/main/java/com/ozs/utils/CaneraConfig.java
  6. 80 0
      business-service/src/main/java/com/ozs/utils/CmdCameraUtil.java
  7. 2 1
      pom.xml
  8. 17 6
      vehicle-admin/src/main/java/com/ozs/web/controller/accountmanagment/BaseCameraManagementController.java
  9. 1 5
      vehicle-admin/src/main/java/com/ozs/web/controller/accountmanagment/BaseVehicleController.java
  10. 0 1
      vehicle-admin/src/main/java/com/ozs/web/controller/accountmanagment/MsgAlarmTemporaryController.java
  11. 53 53
      vehicle-admin/src/main/java/com/ozs/web/core/config/CaneraConfig.java
  12. 51 2
      vehicle-admin/src/main/java/com/ozs/web/core/config/GetCameraPreviewURL.java
  13. 941 941
      vehicle-admin/src/main/java/com/ozs/web/core/util/CameraUtil.java
  14. 81 81
      vehicle-admin/src/main/java/com/ozs/web/core/util/CmdCameraUtil.java
  15. 5 0
      vehicle-sdk/Dockerfile
  16. 110 0
      vehicle-sdk/pom.xml
  17. 21 0
      vehicle-sdk/src/main/java/com/ozs/VehicleSdkApplication.java
  18. 18 0
      vehicle-sdk/src/main/java/com/ozs/VehicleServletInitializer.java
  19. 1 1
      vehicle-admin/src/main/java/com/ozs/web/common/Constant.java
  20. 29 97
      vehicle-admin/src/main/java/com/ozs/web/controller/sdk/GeoHazardMonitorTokenController.java
  21. 1 5
      vehicle-admin/src/main/java/com/ozs/web/controller/sdk/UploadController.java
  22. 1 0
      vehicle-sdk/src/main/resources/META-INF/spring-devtools.properties
  23. 57 0
      vehicle-sdk/src/main/resources/application-dmdruid.yml
  24. 57 0
      vehicle-sdk/src/main/resources/application-druid.yml
  25. 57 0
      vehicle-sdk/src/main/resources/application-kdruid.yml
  26. 176 0
      vehicle-sdk/src/main/resources/application.yml
  27. 24 0
      vehicle-sdk/src/main/resources/banner.txt
  28. 37 0
      vehicle-sdk/src/main/resources/i18n/messages.properties
  29. 94 0
      vehicle-sdk/src/main/resources/logback.xml
  30. 27 0
      vehicle-sdk/src/main/resources/mybatis/mybatis-config.xml

+ 1 - 0
.idea/compiler.xml

@@ -10,6 +10,7 @@
         <module name="vehicle-admin" />
         <module name="hazard-admin" />
         <module name="business-service" />
+        <module name="hazard-sdk" />
       </profile>
     </annotationProcessing>
     <bytecodeTargetLevel>

+ 2 - 0
.idea/encodings.xml

@@ -5,5 +5,7 @@
     <file url="file://$PROJECT_DIR$/business-service/src/main/resources" charset="UTF-8" />
     <file url="file://$PROJECT_DIR$/vehicle-admin/src/main/java" charset="UTF-8" />
     <file url="file://$PROJECT_DIR$/vehicle-admin/src/main/resources" charset="UTF-8" />
+    <file url="file://$PROJECT_DIR$/vehicle-sdk/src/main/java" charset="UTF-8" />
+    <file url="file://$PROJECT_DIR$/vehicle-sdk/src/main/resources" charset="UTF-8" />
   </component>
 </project>

+ 4 - 1
business-service/pom.xml

@@ -54,7 +54,10 @@
             <artifactId>joda-time</artifactId>
             <version>2.10.1</version>
         </dependency>
-
+        <dependency>
+            <groupId>com.ozs</groupId>
+            <artifactId>base-framework</artifactId>
+        </dependency>
     </dependencies>
 
 </project>

+ 990 - 0
business-service/src/main/java/com/ozs/utils/CameraUtil.java

@@ -0,0 +1,990 @@
+package com.ozs.utils;
+
+import com.alibaba.fastjson2.JSON;
+import com.alibaba.fastjson2.JSONObject;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.ozs.common.config.BaseConfig;
+import com.ozs.common.constant.Constants;
+import com.ozs.common.core.domain.entity.SysDictData;
+import com.ozs.common.core.redis.RedisCache;
+import com.ozs.common.exception.base.BaseException;
+import com.ozs.common.utils.DateUtils;
+import com.ozs.common.utils.HttpClientUtil;
+import com.ozs.common.utils.http.HttpUtils;
+import com.ozs.entity.BaseTerminal;
+import com.ozs.entity.MsgHeartbeatAlarmMessage;
+import com.ozs.entity.vo.CamerasVo;
+import com.ozs.entity.vo.PlaybackVo;
+import com.ozs.framework.config.ServerConfig;
+import com.ozs.service.BaseTerminalService;
+import com.ozs.service.MsgHeartbeatAlarmMessageService;
+import com.ozs.system.mapper.SysDictDataMapper;
+import com.ozs.system.service.ISysDictTypeService;
+import lombok.SneakyThrows;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.util.ObjectUtils;
+
+import javax.annotation.PostConstruct;
+import java.io.BufferedReader;
+import java.io.BufferedWriter;
+import java.io.File;
+import java.io.FileFilter;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.io.OutputStreamWriter;
+import java.io.PrintWriter;
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.time.LocalDateTime;
+import java.time.format.DateTimeFormatter;
+import java.util.ArrayList;
+import java.util.Calendar;
+import java.util.Date;
+import java.util.GregorianCalendar;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Random;
+import java.util.Set;
+import java.util.UUID;
+import java.util.concurrent.Callable;
+import java.util.concurrent.CompletableFuture;
+import java.util.concurrent.ExecutionException;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.TimeoutException;
+import java.util.stream.Collectors;
+
+/**
+ * 相机工具
+ */
+
+@Configuration
+@Slf4j
+public class CameraUtil {
+    private static final ExecutorService executor = Executors.newFixedThreadPool(20);
+
+    private static String historyUrl;
+    private static String ffmpegPath;
+    private static String filePath;
+    private static String transcribeFilePath;
+    private static String webUrl;
+    private static String bakUrl;
+    private static String bakUrlRtsp;
+    private static String wsUrl;
+    private static CmdCameraUtil cUtil;
+    private static RedisCache rc;
+    private static ServerConfig sc;
+    private static String recordUrl;
+    private static String hkUrl;
+
+    @Autowired
+    private CaneraConfig caneraConfig;
+
+    @Autowired
+    private CmdCameraUtil cmdCameraUtil;
+
+    @Autowired
+    private SysDictDataMapper dictDataMapper;
+
+    @Autowired
+    private RedisCache redisCache;
+    @Autowired
+    private ServerConfig serverConfig;
+    @Autowired
+    private BaseTerminalService baseTerminalService;
+    @Autowired
+    private MsgHeartbeatAlarmMessageService msgHeartbeatAlarmMessageService;
+    @Autowired
+    private ISysDictTypeService dictTypeService;
+
+    public final static String tsFilekey = "mergeVideoTsFile";
+
+
+    /**
+     * 历史回放
+     *
+     * @param fromVideoFileList
+     * @param ph
+     * @return
+     * @throws IOException
+     */
+    public static String historyPlay(List<String> fromVideoFileList, String ph, boolean flay) {
+        // 视频服务映射路径
+        String NewfilePath = BaseConfig.getProfile() + "/" + ph;
+        log.info("NewfilePath:{}", NewfilePath);
+        log.info("fromVideoFileList:{}", fromVideoFileList);
+        if (ObjectUtils.isEmpty(fromVideoFileList) || fromVideoFileList.size() <= 0) {
+            throw new BaseException("当前相机无视频录像");
+        }
+        executor.submit(new Runnable() {
+            @Override
+            public void run() {
+                try {
+                    txConvetor(fromVideoFileList, NewfilePath, flay);
+                } catch (IOException e) {
+                    log.error(e.getMessage());
+                    e.printStackTrace();
+                }
+            }
+        });
+//        executor.shutdown();
+
+        return Constants.RESOURCE_PREFIX + "/" + ph;
+    }
+
+
+    @SneakyThrows
+    public static void txConvetor(List<String> fromVideoFileList,
+                                  String newfilePath,
+                                  boolean fly) throws IOException {
+        /*
+        * ffmpeg -i 20230411_155847_155947-d4c2265d-d83e-11ed-8e7f-fa163e4e1e9f.flv -c:v copy 1.ts
+ffmpeg -i 20230411_155948_160048-f91fea03-d83e-11ed-8e7f-fa163e4e1e9f.flv -c:v copy 2.ts
+ffmpeg -i "concat:1.ts|2.ts" -c copy output.mp4
+        * */
+
+        File file = new File(newfilePath);
+        boolean flay = false;
+        if (!file.getParentFile().exists()) {
+            boolean mkdirs = file.getParentFile().mkdirs();
+            log.info("创建文件夹:{}", file.getParentFile().getPath());
+            log.info("创建文件夹结果:{}", mkdirs);
+            flay = true;
+        }
+        cUtil.cmd("chomd -R 777 " + file.getParentFile().getPath());
+        log.info("newfilePath:{}", newfilePath);
+        StringBuffer sm = new StringBuffer(ffmpegPath + " -i \"concat:");
+        List<String> fileTs = new ArrayList<>();
+        for (int t = 0; t < fromVideoFileList.size(); t++) {
+            File ft = new File(fromVideoFileList.get(t));
+            if (ft.exists()) {
+                log.info("file:{}", fromVideoFileList.get(t));
+                String substring = fromVideoFileList.get(t).substring(0, fromVideoFileList.get(t).lastIndexOf("."));
+                int x;//定义两变量
+                Random ne = new Random();//实例化一个random的对象ne
+                x = ne.nextInt(9999 - 1000 + 1) + 1000;//为变量赋随机值1000-9999
+                substring = substring + x;//定义两变量
+
+                String cmdstr = ffmpegPath + " -i " + fromVideoFileList.get(t) + " -c:v copy " + substring + ".ts";
+                log.info("转换命令:{}", cmdstr);
+                cUtil.cmd(cmdstr);
+                fileTs.add(substring + ".ts");
+                if (t != fromVideoFileList.size() - 1) {
+                    sm.append(substring + ".ts|");
+                } else {
+                    sm.append(substring + ".ts\" ");
+                }
+            }
+        }
+
+        if (fileTs.size() > 0) {
+            Map<String, Object> mergeVideoTsFile = rc.getCacheMap(tsFilekey);
+            if (ObjectUtils.isEmpty(mergeVideoTsFile)) {
+                mergeVideoTsFile = new HashMap<>();
+            }
+            if (!flay) {
+                // 如果没有解除,把生成的文件放入要删除的定时任务 redis key 中
+                fileTs.add(newfilePath);
+            }
+            mergeVideoTsFile.put(System.currentTimeMillis() + "", fileTs);
+            rc.deleteObject(tsFilekey);
+            if (mergeVideoTsFile.size() > 0) {
+                rc.setCacheMap(tsFilekey, mergeVideoTsFile);
+            }
+
+            sm.append("-c copy " + newfilePath);
+            log.info("合并命令:{}", sm.toString());
+            cUtil.cmd(sm.toString());
+        }
+
+    }
+
+    /**
+     * 实时播放的拼接流
+     *
+     * @param cameraCode 相机编码
+     * @param channel    相机通道
+     * @return
+     */
+    public static String getPlayFlv(String cameraCode, String channel, boolean flay) {
+        if (!flay) {
+            return bakUrl + "/hdl/" + channel + "/" + cameraCode + ".flv";
+        }
+        return webUrl + "/hdl/" + channel + "/" + cameraCode + ".flv";
+
+
+//        if (!flay) {
+//            return bakUrl + "/ws/" + channel + "/" + cameraCode + ".flv";
+//        }
+//        return webUrl + "/ws/" + channel + "/" + cameraCode + ".flv";
+    }
+
+
+    /**
+     * Rtsp实时播放的拼接流
+     *
+     * @param cameraCode 相机编码
+     * @param channel    相机通道
+     * @return
+     */
+    public static String getPlayFlvRtsp(String cameraCode, String channel, boolean flay) {
+        if (!flay) {
+            return bakUrlRtsp + "/" + channel + "/" + cameraCode;
+        }
+        return bakUrlRtsp + "/" + channel + "/" + cameraCode;
+
+
+//        if (!flay) {
+//            return bakUrl + "/ws/" + channel + "/" + cameraCode + ".flv";
+//        }
+//        return webUrl + "/ws/" + channel + "/" + cameraCode + ".flv";
+    }
+
+    public static String getPlayFlv(String cameraCode, String channel) {
+        return getPlayFlv(cameraCode, channel, true);
+    }
+
+    public static String invite(String cameraCode, String channel) {
+        String result = null;
+        String url = bakUrl + "/api/gb28181/invite?id=" + cameraCode + "&channel=" + channel;
+        try {
+            result = HttpClientUtil.get(url);
+            log.info("result:{}", result);
+        } catch (Exception e) {
+            log.info(e.getMessage());
+            e.printStackTrace();
+        }
+        return result;
+    }
+
+
+    /**
+     * 开启录制功能
+     *
+     * @param cameraCode 相机编码
+     * @param channel    相机通道
+     * @return
+     */
+    public static String startRecording(String cameraCode, String channel) {
+        return historyUrl + "/recordpro/api/start?streamPath=" + channel + "/" + cameraCode;
+    }
+
+    /**
+     * 关闭录制功能
+     *
+     * @param taskId 录像接口返回的任务ID
+     * @return
+     */
+    public static String endRecording(String taskId) {
+        return historyUrl + "/recordpro/api/stop?id=" + taskId;
+    }
+
+
+    /**
+     * 历史回放流(获取)
+     *
+     * @param channel 相机通道
+     * @param startTm 开始时间
+     * @param endTm   结束时间
+     * @return
+     */
+    public static String historyPlayListStr(String channel, Date startTm, Date endTm, boolean flay) {
+        List<String> list = filterPlayList(channel, startTm, endTm, filePath);
+        String uuid = UUID.randomUUID().toString();
+        String ph = "record/flv/" + DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD, new Date())
+                + "/" + channel + "/"
+                + uuid + ".mp4";
+        if (!ObjectUtils.isEmpty(list)) {
+            try {
+                return historyPlay(list, ph, flay);
+            } catch (Exception e) {
+                log.error(e.getMessage());
+                e.printStackTrace();
+            }
+        } else {
+            throw new BaseException("当前相机无视频录像");
+        }
+        return null;
+    }
+
+
+    /**
+     * 过滤符合条件的视频
+     *
+     * @param channel
+     * @param startTm
+     * @param endTm
+     * @param mappingUrl
+     * @return
+     */
+    public static List<String> filterPlayList(String channel, Date startTm, Date endTm, String mappingUrl) {
+        if (StringUtils.isBlank(channel)
+                || ObjectUtils.isEmpty(startTm)
+                || ObjectUtils.isEmpty(endTm)) {
+            return null;
+        }
+
+        List<String> ls = new ArrayList<>();
+        Map<Date, String> m = new HashMap<>();
+        // 调用视频服务返回参数
+        String startTime = DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD, startTm);
+        String endTime = DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD, endTm);
+
+        String param = "channel=" + channel + "&startTime=" + startTime + "&endTime=" + endTime;
+        String s = HttpUtils.sendGet(historyUrl + "/api/record/flv/list", param);
+        // 视频拼接
+        if (!StringUtils.isBlank(s) && !"null".equals(s) && !s.startsWith("<!DOCTYPE html>")) {
+            List<Map<String, Object>> maps = JSON.parseArray(s, Map.class);
+            if (ObjectUtils.isEmpty(maps)) {
+                return null;
+            }
+            for (Map<String, Object> map : maps) {
+                Object path = map.get("Path");
+                if (!ObjectUtils.isEmpty(path)) {
+                    String s1 = path.toString();
+                    String substring = s1.substring(s1.lastIndexOf("/") + 1, s1.length());
+                    String substring1 = substring.substring(0, substring.indexOf("-"));
+                    String[] s2 = substring1.split("_");
+                    if (!ObjectUtils.isEmpty(s2)) {
+
+                        String s3 = s2[0] + s2[1];
+                        String s4 = s2[0] + s2[2];
+                        Date sdate = DateUtils.dateTime(DateUtils.YYYYMMDDHHMMSS, s3);
+                        if (s2[1].startsWith("23") && s2[2].startsWith("00")) {
+                            sdate = DateUtils.addDays(sdate, -1);
+                        }
+                        Date edate = DateUtils.dateTime(DateUtils.YYYYMMDDHHMMSS, s4);
+                        /*     sdate  |startTm|  edate     |endTm| */
+                        if (startTm.compareTo(sdate) >= 0
+                                && startTm.compareTo(edate) <= 0
+                                && endTm.compareTo(edate) >= 0) {
+                            m.put(sdate, mappingUrl + path.toString());
+                            /*  |startTm|   sdate    edate   |endTm| */
+                        } else if (startTm.compareTo(sdate) <= 0 && endTm.compareTo(edate) >= 0) {
+                            m.put(sdate, mappingUrl + path.toString());
+
+                            /*  |startTm|   sdate     |endTm|  edate  */
+                        } else if (startTm.compareTo(sdate) <= 0
+                                && endTm.compareTo(sdate) >= 0
+                                && endTm.compareTo(edate) <= 0) {
+                            m.put(sdate, mappingUrl + path.toString());
+
+                            /*  sdate |startTm|      |endTm| edate  */
+                        } else if (startTm.compareTo(sdate) >= 0 && endTm.compareTo(edate) <= 0) {
+                            m.put(sdate, mappingUrl + path.toString());
+                        }
+                    }
+                }
+            }
+        }
+        if (!ObjectUtils.isEmpty(m) && m.size() > 0) {
+            Set<Date> dates = m.keySet();
+            // 排序
+            dates.stream().parallel().collect(Collectors.toList()).stream().sorted().forEach(d -> {
+                ls.add(m.get(d));
+            });
+            return ls;
+        }
+        return null;
+    }
+
+    /**
+     * 合并视频(转化文件)
+     *
+     * @param fromVideoFileList 视频路径
+     * @param newfilePath       生产新的视频文件路径
+     * @throws IOException
+     */
+    public static Map<String, String> myConvetor(List<String> fromVideoFileList,
+                                                 String newfilePath,
+                                                 String uuid) throws IOException {
+        /*
+        * for f in *.flv; do echo "file '$f'" >> mylist.txt; done
+            ffmpeg -f concat -i mylist.txt -c copy output.flv
+        * */
+
+        File file = new File(newfilePath);
+        boolean flay = false;
+        if (!file.getParentFile().exists()) {
+            file.getParentFile().mkdirs();
+            log.info("创建文件夹:{}", file.getParentFile().getPath());
+            flay = true;
+        }
+        log.info("newfilePath:{}", newfilePath);
+
+
+        StringBuffer sm = new StringBuffer("for f in ");
+        String pathStr = null;
+        for (int t = 0; t < fromVideoFileList.size(); t++) {
+            File ft = new File(fromVideoFileList.get(t));
+            if (ft.exists()) {
+                if (t != fromVideoFileList.size() - 1) {
+//                    sm.append(fromVideoFileList.get(t) + " ");
+                    sm.append(fromVideoFileList.get(t).substring(fromVideoFileList.get(t).lastIndexOf("/") + 1, fromVideoFileList.get(t).length()) + " ");
+                } else {
+//                    sm.append(fromVideoFileList.get(t));
+                    sm.append(fromVideoFileList.get(t).substring(fromVideoFileList.get(t).lastIndexOf("/") + 1, fromVideoFileList.get(t).length()));
+                    pathStr = fromVideoFileList.get(t).substring(0, fromVideoFileList.get(t).lastIndexOf("/"));
+                }
+            }
+        }
+//        String substring = newfilePath.substring(0, newfilePath.lastIndexOf("."));
+//        substring = substring + ".txt";
+
+        String substring = uuid + ".txt";
+        log.info("临时转化的文件:{}", substring);
+
+
+        sm.append("; do echo \"file '$f'\" >> " + substring + "; done");
+        String commit = sm.toString();
+        log.info("合并转化文件的命令:{}", commit);
+        Process proc = Runtime.getRuntime().exec("/bin/bash", null, null);
+        BufferedReader in = new BufferedReader(new InputStreamReader(proc.getInputStream()));
+        PrintWriter out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(proc.getOutputStream())), true);
+
+        try {
+            String commit1 = ffmpegPath + " -f concat -safe 0 -i " + pathStr + "/" + substring + " -c copy " + newfilePath;
+
+            log.info("合并视频命令:{}", commit1);
+            List<String> commands = new ArrayList<>();
+            if (flay) {
+                commands.add("chomd -R 777 " + file.getParentFile().getPath());
+            }
+            //
+            commands.add("cd " + pathStr);
+            // 合并成一个临时文件
+            commands.add(commit);
+
+            // 临时文件转化为 flv
+//            commands.add(commit1);
+            log.info("录像视频命令:{}", commands);
+            for (String line : commands) {
+                log.info("命令:{}", line);
+                out.println(line);
+            }
+            out.println("exit");// 这个命令必须执行,否则in流不结束。
+            log.info("命令:{}", "exit");
+            String rspLine = "";
+            while ((rspLine = in.readLine()) != null) {
+                log.info("*****:{}", rspLine);
+            }
+            proc.waitFor();
+            Map<String, String> map = new HashMap<>();
+            map.put("cmd", commit1);
+            map.put("path", pathStr + "/" + substring);
+            return map;
+
+
+        } catch (InterruptedException e) {
+            log.error(e.getMessage());
+            e.printStackTrace();
+        } finally {
+            in.close();
+            out.close();
+            proc.destroy();
+        }
+        return null;
+    }
+
+
+    @PostConstruct
+    public void init() {
+        historyUrl = caneraConfig.getHistoryUrl();
+        ffmpegPath = caneraConfig.getFfmpegPath();
+        filePath = caneraConfig.getFilePath();
+        transcribeFilePath = caneraConfig.getTranscribeFilePath();
+        webUrl = caneraConfig.getWebUrl();
+        bakUrl = caneraConfig.getBakUrl();
+        bakUrlRtsp = caneraConfig.getBakUrlRtsp();
+        rc = redisCache;
+        cUtil = cmdCameraUtil;
+        sc = serverConfig;
+        wsUrl = caneraConfig.getWsUrl();
+        recordUrl = caneraConfig.getRecordUrl();
+        hkUrl = caneraConfig.getHkUrl();
+    }
+
+    /**
+     * 定时任务参数flv文件
+     *
+     * @throws IOException
+     * @throws InterruptedException
+     */
+    public void deleteFlv() throws IOException, InterruptedException {
+        SimpleDateFormat s = new SimpleDateFormat("yyyy-MM-dd");
+        Date date = new Date();
+        Calendar calendar = new GregorianCalendar();
+        calendar.setTime(date);
+        calendar.add(calendar.DATE, -1); //把日期往后增加一天,整数  往后推,负数往前移动
+        date = calendar.getTime(); //这个时间就是日期往后推一天的结果
+        String path = BaseConfig.getProfile() + "/flv/" + DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD, date);
+        File file = new File(path);
+        if (file.exists()) {
+            List<String> rspList = new ArrayList<String>();
+            Process proc = Runtime.getRuntime().exec("/bin/bash", null, null);
+            BufferedReader in = new BufferedReader(new InputStreamReader(proc.getInputStream()));
+            PrintWriter out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(proc.getOutputStream())), true);
+            String commit = " rm -rf  " + path;
+            List<String> commands = new ArrayList<>();
+
+            // 删除
+            commands.add(commit);
+            log.info("删除昨天的录像视频命令:{}", commands);
+            for (String line : commands) {
+                out.println(line);
+            }
+            out.println("exit");// 这个命令必须执行,否则in流不结束。
+            String rspLine = "";
+            while ((rspLine = in.readLine()) != null) {
+                System.out.println(rspLine);
+                rspList.add(rspLine);
+            }
+            int i = proc.waitFor();
+            log.info("执行结果:{}", i);
+
+            in.close();
+            out.close();
+            proc.destroy();
+        }
+    }
+
+
+    /**
+     * 定时任务:删除超过配置时长的录制视频
+     *
+     * @throws IOException
+     * @throws InterruptedException
+     */
+    public void deleteFlvExceed() throws IOException, InterruptedException, ParseException {
+        //字典中设置的值
+        List<SysDictData> sysCameraRecordTime = dictDataMapper.selectDictDataByType("sys_camera_record_time");
+
+        SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd");
+        Date date = new Date();
+        Calendar calendar = new GregorianCalendar();
+        calendar.setTime(date);
+        //正数,日期天数加
+        //负数,日期天数减                         提前45天
+        if (!ObjectUtils.isEmpty(sysCameraRecordTime)) {
+            String dictValue = sysCameraRecordTime.get(0).getDictValue();
+            calendar.add(Calendar.DAY_OF_YEAR, Integer.parseInt("-" + dictValue));
+        } else {
+            calendar.add(Calendar.DAY_OF_YEAR, -45);
+        }
+        date = calendar.getTime();
+
+        //遍历每个进行视频录制的摄像头
+        File file = new File(transcribeFilePath);
+        log.info("file.Name()======================================" + file.getName());
+        log.info("file.exists()======================================" + file.exists());
+        if (file.exists() && file.isDirectory()) {
+            //获取文件夹中所有的子文件夹和文件
+            File[] files = file.listFiles();
+            if (!ObjectUtils.isEmpty(files) && files.length > 0) {
+                for (File file1 : files) {
+                    //   file1=/opt/streams/record/flv/34020000001320000167
+                    log.info("file1.Name()======================================" + file1.getName());
+                    if (file1.exists() && file1.isDirectory()) {
+                        //相机文件
+                        File[] fs = file1.listFiles();
+                        if (!ObjectUtils.isEmpty(fs) && fs.length > 0) {
+                            for (File f : fs) {
+                                //    f=/opt/streams/record/flv/34020000001320000167/20230328_192033_192037-91509173-cd5a-11ed-8a42-fa163e4e1e9f.flv
+                                //fName=20230328_192033_192037-91509173-cd5a-11ed-8a42-fa163e4e1e9f.flv
+                                String fName = f.getName();
+                                log.info("fName======================================" + fName);
+                                String[] split = fName.split("_");
+                                if (split.length > 0) {
+                                    //20230328
+                                    String s = split[0];
+                                    Date parse = sdf.parse(s);
+                                    long fTime = parse.getTime();
+                                    long dateTime = date.getTime();
+                                    //删除过期文件
+                                    if (fTime < dateTime) {
+                                        f.delete();
+                                    }
+                                }
+                            }
+                        }
+                    }
+                }
+            }
+        }
+    }
+
+//    /**
+//     * 定时任务:关闭录制视频
+//     *
+//     * @throws IOException
+//     * @throws InterruptedException
+//     */
+//    public void closeRecording() throws IOException, InterruptedException, ParseException {
+//        LambdaQueryWrapper<BaseCameraManagement> wrapper = new LambdaQueryWrapper<>();
+//        wrapper.eq(BaseCameraManagement::getStartRecording, 1);
+//        wrapper.isNotNull(BaseCameraManagement::getTaskId);
+//        List<BaseCameraManagement> list = baseCameraManagementService.list(wrapper);
+//        log.info("list======================================" + list);
+//        List<String> collect = list.stream().map(BaseCameraManagement::getCameraCode).collect(Collectors.toList());
+////        List<String> collect = new ArrayList<>();
+////        collect.add("42010001541320001116");
+//        //遍历每个进行视频录制的摄像头
+//        File file = new File(transcribeFilePath);
+//        log.info("closeRecording-file.Name()======================================" + file.getName());
+//        log.info("closeRecording-file.exists()======================================" + file.exists());
+//        if (file.exists() && file.isDirectory()) {
+//            //获取文件夹中所有的子文件夹和文件
+//            File[] files = file.listFiles();
+//            if (!ObjectUtils.isEmpty(files) && files.length > 0) {
+//                for (File file1 : files) {
+//                    log.info("closeRecording-file1---------------" + file1);
+//                    log.info("closeRecording-cameraCode---------------" + collect);
+//                    String substring = file1.toString().substring(file1.toString().lastIndexOf("\\") + 1);
+//                    if (collect.contains(substring)) {
+//                        File[] files1 = CameraUtil.getCurFilesList(file1.toString());
+//                        if (!ObjectUtils.isEmpty(files1) && files1.length > 0) {
+//                            int length = files1.length;
+//                            File file2 = files1[length - 1];
+//                            log.info("closeRecording-file2---------------" + file2);
+//                            String time = file2.toString().substring(file2.toString().lastIndexOf("\\") + 1);
+//                            String substring1 = time.substring(0, 15);
+//                            String substring2 = substring1.substring(0, 4);
+//                            String substring3 = substring1.substring(4, 6);
+//                            String substring4 = substring1.substring(6, 8);
+//                            String substring5 = substring1.substring(9, 11);
+//                            String substring6 = substring1.substring(11, 13);
+//                            String substring7 = substring1.substring(13, 15);
+//                            String date = substring2 + "-" + substring3 + "-" + substring4 + " " + substring5 + ":" + substring6 + ":" + substring7;
+//                            System.out.println(date);
+//                            SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+//                            Date parse = sdf.parse(date);
+//                            //当前时间戳
+//                            long dades = System.currentTimeMillis();
+//                            //文件的时间戳
+//                            long time1 = parse.getTime();
+//                            //当前时间10分钟之前的时间戳
+//                            long time2 = dades - 600000L;
+//                            if (time2 <= time1 && time1 < dades) {
+//                            } else {
+//                                LambdaQueryWrapper<BaseCameraManagement> lw = new LambdaQueryWrapper<BaseCameraManagement>();
+//                                lw.eq(BaseCameraManagement::getCameraCode, substring);
+//                                BaseCameraManagement baseCameraManagement = baseCameraManagementService.getOne(lw);
+//                                log.info("closeRecording-endRecording------------" + baseCameraManagement.getTaskId());
+//                                String start = HttpUtils.sendGet(CameraUtil.endRecording(baseCameraManagement.getTaskId()));
+//                                log.info("closeRecording-endRecording------------" + start);
+//                                if ("success".equals(start)) {
+//                                    baseCameraManagement.setStartRecording(2);
+//                                    baseCameraManagement.setTaskId("");
+//                                } else {
+//                                    baseCameraManagement.setStartRecording(2);
+//                                    baseCameraManagement.setTaskId("");
+//                                    log.error("关闭视频录制异常日志如下:" + start);
+//                                }
+//                                baseCameraManagementService.updateById(baseCameraManagement);
+//                            }
+//                        }
+//                    }
+//                }
+//            }
+//        }
+//    }
+
+    public static File[] getCurFilesList(String filePath) {
+        File path = new File(filePath);
+        File[] listFiles = path.listFiles(new FileFilter() {
+
+            @Override
+            public boolean accept(File pathname) {
+                if (pathname.isFile()) {
+                    return true;
+                } else {
+
+                    return false;
+                }
+            }
+        });
+
+        return listFiles;
+    }
+
+    public static void execute(String command) {
+        try {
+            ProcessBuilder process = new ProcessBuilder(command);
+            process.inheritIO().start().waitFor();
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+
+    }
+
+    public static List<Map<String, Object>> getRecordList(String channel, Date startTm, Date endTm) {
+        return filterRecordList(channel, startTm, endTm, filePath, recordUrl + "profile/");
+    }
+
+
+    /**
+     * HTTP流转RTSP流
+     */
+    public void streamConversion(String code) {
+
+        ExecutorService executor = Executors.newSingleThreadExecutor();
+        Callable<String> task = new Callable<String>() {
+            @Override
+            public String call() throws Exception {
+                // 执行网络请求...
+                log.info(ffmpegPath + " -re -i /opt/streams/file/vid/" + code + ".mp4  -c:v copy -c:a copy -f flv rtmp://124.70.58.209:1935/live/" + code);
+                cmdCameraUtil.cmd(ffmpegPath + " -re -i /opt/streams/file/vid/" + code + ".mp4  -c:v copy -c:a copy -f flv rtmp://124.70.58.209:1935/live/" + code);
+                return "Response";
+            }
+        };
+
+        try {
+            String result = executor.submit(task).get(1, TimeUnit.SECONDS); // 设置5秒超时时间
+            System.out.println("Response: " + result);
+        } catch (InterruptedException | ExecutionException | TimeoutException e) {
+            // 请求超时处理逻辑
+            System.out.println("Request timeout");
+        }
+
+        executor.shutdown();
+
+//        try {
+//            Process proc = Runtime.getRuntime().exec("/bin/bash", null, null);
+//            BufferedReader in = new BufferedReader(new InputStreamReader(proc.getInputStream()));
+//            PrintWriter out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(proc.getOutputStream())), true);
+//            String commit = ffmpegPath+" -re -i /opt/streams/file/"+code+".mp4  -c:v copy -c:a copy -f rtsp rtsp://124.70.58.209:8554/live/"+code;
+//            List<String> commands = new ArrayList<>();
+//
+//            // 删除
+//            commands.add(commit);
+//            log.info("HTTP流转RTSP流:{}", commands);
+//            for (String line : commands) {
+//                out.println(line);
+//            }
+//            out.println("exit");// 这个命令必须执行,否则in流不结束。
+//            String rspLine = "";
+//            while ((rspLine = in.readLine()) != null) {
+//                System.out.println(rspLine);
+//
+//            }
+//            int i = proc.waitFor();
+//            log.info("执行结果:{}", i);
+//
+//            in.close();
+//            out.close();
+//            proc.destroy();
+//        } catch (IOException e) {
+//            log.error(e.getMessage());
+//        } catch (InterruptedException e) {
+//            e.printStackTrace();
+//        }
+
+    }
+
+
+    /**
+     * RTSP流下载
+     */
+    public static void streamUrlDownload(String url, String code) {
+        log.info(ffmpegPath + " -i " + url + " -c copy /opt/stream/map" + code);
+        cUtil.cmd(ffmpegPath + " -i " + url + " -c copy /opt/stream/map" + code);
+    }
+
+
+    public static List<Map<String, Object>> filterRecordList(String channel,
+                                                             Date startTm,
+                                                             Date endTm,
+                                                             String mappingUrl,
+                                                             String wUrl) {
+        List<Map<String, Object>> rmaps = new ArrayList<>();
+
+        if (StringUtils.isBlank(channel)
+                || ObjectUtils.isEmpty(startTm)
+                || ObjectUtils.isEmpty(endTm)) {
+            return null;
+        }
+        Map<Date, Map<String, Object>> m = new HashMap<>();
+        // 调用视频服务返回参数
+        String startTime = DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD, startTm);
+        String endTime = DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD, endTm);
+
+        String param = "channel=" + channel + "&startTime=" + startTime + "&endTime=" + endTime;
+        // /api/record/flv/list
+        String s = HttpUtils.sendGet(webUrl + "/recordpro/api/list", param);
+        // 视频拼接
+        if (!StringUtils.isBlank(s) || "null".equals(s)) {
+            List<Map<String, Object>> maps = JSON.parseArray(s, Map.class);
+            if (ObjectUtils.isEmpty(maps)) {
+                return null;
+            }
+            for (Map<String, Object> map : maps) {
+                Object path = map.get("Path");
+                Object size = map.get("Size");
+                Object duration = map.get("Duration");
+                if (!ObjectUtils.isEmpty(path)) {
+                    String s1 = path.toString();
+                    String substring = s1.substring(s1.lastIndexOf("/") + 1, s1.length());
+                    String substring1 = substring.substring(0, substring.indexOf("-"));
+                    String[] s2 = substring1.split("_");
+                    if (!ObjectUtils.isEmpty(s2)) {
+                        Map<String, Object> mo = new HashMap<>();
+
+                        String s3 = s2[0] + s2[1];
+                        String s4 = s2[0] + s2[2];
+                        Date sdate = DateUtils.dateTime(DateUtils.YYYYMMDDHHMMSS, s3);
+                        if (s2[1].startsWith("23") && s2[2].startsWith("00")) {
+                            sdate = DateUtils.addDays(sdate, -1);
+                        }
+                        Date edate = DateUtils.dateTime(DateUtils.YYYYMMDDHHMMSS, s4);
+                        mo.put("startTime", DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD_HH_MM_SS, sdate));
+                        mo.put("entTime", DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD_HH_MM_SS, edate));
+                        mo.put("url", wUrl + path.toString());
+                        mo.put("path", mappingUrl + path.toString());
+                        mo.put("fileName", substring);
+                        mo.put("size", size);
+                        mo.put("duration", duration);
+                        /*     sdate  |startTm|  edate     |endTm| */
+                        if (startTm.compareTo(sdate) >= 0
+                                && startTm.compareTo(edate) <= 0
+                                && endTm.compareTo(edate) >= 0) {
+                            m.put(sdate, mo);
+                            /*  |startTm|   sdate    edate   |endTm| */
+                        } else if (startTm.compareTo(sdate) <= 0 && endTm.compareTo(edate) >= 0) {
+                            m.put(sdate, mo);
+
+                            /*  |startTm|   sdate     |endTm|  edate  */
+                        } else if (startTm.compareTo(sdate) <= 0
+                                && endTm.compareTo(sdate) >= 0
+                                && endTm.compareTo(edate) <= 0) {
+                            m.put(sdate, mo);
+
+                            /*  sdate |startTm|      |endTm| edate  */
+                        } else if (startTm.compareTo(sdate) >= 0 && endTm.compareTo(edate) <= 0) {
+                            m.put(sdate, mo);
+                        }
+                    }
+                }
+            }
+        }
+        if (!ObjectUtils.isEmpty(m) && m.size() > 0) {
+            Set<Date> dates = m.keySet();
+            // 排序
+            dates.stream().parallel().collect(Collectors.toList()).stream().sorted().forEach(d -> {
+
+                rmaps.add(m.get(d));
+            });
+            log.info("rmaps:{}", rmaps);
+            return rmaps;
+        }
+        return null;
+    }
+
+
+    public void heartbeat() {
+        List<BaseTerminal> list = baseTerminalService.list();
+        for (BaseTerminal baseTerminal : list) {
+            QueryWrapper<MsgHeartbeatAlarmMessage> wrapper = new QueryWrapper<>();
+            wrapper.eq("terminal_code", wrapper);
+            wrapper.orderByDesc("create_time");
+            wrapper.last("limit 1");
+            MsgHeartbeatAlarmMessage msgHeartbeatAlarmMessage = msgHeartbeatAlarmMessageService.getOne(wrapper);
+            if (ObjectUtils.isEmpty(msgHeartbeatAlarmMessage)) {
+                baseTerminal.setStatus(2);
+                baseTerminalService.updateById(baseTerminal);
+            } else {
+                List<SysDictData> heartbeat = dictTypeService.selectDictDataByType("heartbeat");
+                long timeNow = System.currentTimeMillis();
+                long createTime = msgHeartbeatAlarmMessage.getCreateTime().getTime();
+                int times = Integer.parseInt(heartbeat.get(0).getDictValue());
+                long thereHourMillis = 60 * 1000 * 3 * times;
+                long timeNew = timeNow - thereHourMillis;
+                if (timeNew > createTime) {
+                    baseTerminal.setStatus(2);
+                    baseTerminalService.updateById(baseTerminal);
+                } else {
+                    baseTerminal.setStatus(1);
+                    baseTerminalService.updateById(baseTerminal);
+                }
+            }
+        }
+
+    }
+
+
+    public void previewURLs(CamerasVo camerasVo) {
+        String result = null;
+        String url = "http://" + hkUrl + "/api/video/v2/cameras/previewURLs";
+        try {
+            result = HttpClientUtil.postJson(url, JSON.toJSONString(camerasVo));
+        } catch (Exception e) {
+            log.error("previewURLs------------>" + e.getMessage());
+            e.printStackTrace();
+        }
+        JSONObject outJson = (JSONObject) JSONObject.parse(result);
+        if ("0".equals(outJson.getString("code"))) {
+            log.info("outJson----->" + outJson);
+            JSONObject data = outJson.getJSONObject("data");
+            String urls = data.getString("url");
+            HttpUtils.sendGet(historyUrl + "rtsp/api/pull?target=" + urls + "&streamPath=" + camerasVo.getCameraIndexCode() + "/" + camerasVo.getCameraIndexCode() + "&save=0");
+        }
+
+    }
+
+    public void playbackURLs(List<String> list) {
+        CompletableFuture future = CompletableFuture.supplyAsync(() -> {
+            for (String code : list) {
+                PlaybackVo playbackVo = new PlaybackVo();
+                playbackVo.setCameraIndexCode(code);
+                // 获取当前时间
+                LocalDateTime currentTime = LocalDateTime.now();
+                // 获取当前时间的前10分钟时间
+                LocalDateTime beforeTenMinutes = currentTime.minusMinutes(10);
+                // 获取当前时间的后10分钟时间
+                LocalDateTime afterTenMinutes = currentTime.plusMinutes(10);
+                // 格式化时间
+                DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
+                playbackVo.setBeginTime(beforeTenMinutes.format(formatter));
+                playbackVo.setEndTime(afterTenMinutes.format(formatter));
+
+
+                String result = null;
+                String url = "http://" + hkUrl + "/api/video/v2/cameras/playbackURLs";
+                try {
+                    result = HttpClientUtil.postJson(url, JSON.toJSONString(playbackVo));
+                } catch (Exception e) {
+                    log.error("playbackURLs------------>" + e.getMessage());
+                    e.printStackTrace();
+                }
+                JSONObject outJson = (JSONObject) JSONObject.parse(result);
+                if ("0".equals(outJson.getString("code"))) {
+                    log.info("outJson----->" + outJson);
+                    JSONObject data = outJson.getJSONObject("data");
+                    String urls = data.getString("url");
+                    streamUrlDownload(urls, playbackVo.getCameraIndexCode());
+                }
+            }
+            return 1;
+        });
+        future.join();
+    }
+
+    public static void main(String[] args) throws InterruptedException, ParseException, IOException {
+//        CameraUtil cameraUtil = new CameraUtil();
+//        cameraUtil.closeRecording();
+//        String s = "/opt/streams/record/flv/42010001541320001116/20230403_235506_000506-22e1523b-d170-11ed-8a42-fa163e4e1e9f.flv";
+//        String fileStr = s.substring(s.lastIndexOf("/") + 1, s.length());
+//        String pathStr = s.substring(0, s.lastIndexOf("/"));
+//        System.out.println(fileStr);
+//        System.out.println(pathStr);
+
+        String s = "20230403235512";
+        Date sdate = DateUtils.dateTime(DateUtils.YYYYMMDDHHMMSS, s);
+        sdate = DateUtils.addDays(sdate, -1);
+        System.out.println(DateUtils.parseDateToStr(DateUtils.YYYYMMDDHHMMSS, sdate));
+    }
+}

+ 53 - 0
business-service/src/main/java/com/ozs/utils/CaneraConfig.java

@@ -0,0 +1,53 @@
+package com.ozs.utils;
+
+import lombok.Data;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.context.annotation.Configuration;
+
+@Configuration
+@Data
+public class CaneraConfig {
+
+    /**
+     * 视频服务器访问路径
+     */
+    @Value("${base.historyUrl:http://47.106.159.135/streams}")
+    private String historyUrl;
+
+    /**
+     * ffmpeg.exe路径
+     * "D:\\Java\\operSources\\ffmpeg-4.3.1\\bin\\ffmpeg.exe"
+     */
+    @Value("${base.ffmpegPath:C:\\Users\\Administrator.DESKTOP-0NUUTMM\\Downloads\\ffmpeg-5.1.2-essentials_build\\ffmpeg-5.1.2-essentials_build\\bin\\ffmpeg.exe}")
+    private String ffmpegPath;
+
+
+    @Value("${base.filePath:/opt/streams/}")
+    private String filePath;
+
+    /**
+     * 录制视频存放路径
+     */
+    @Value("${base.transcribeFilePath:/opt/streams/record/flv}")
+    private String transcribeFilePath;
+
+
+    @Value("${base.webUrl:http://47.106.159.135/streams}")
+    private String webUrl;
+
+    @Value("${base.bakUrl:http://124.70.58.209:18891}")
+    private String bakUrl;
+
+    @Value("${base.bakUrlRtsp:rtsp://124.70.58.209:8554}")
+    private String bakUrlRtsp;
+
+    @Value("${base.wsUrl:http://124.70.58.209:18891}")
+    private String wsUrl;
+
+    @Value("${base.recordUrl:http://183.236.39.220:8083}")
+    private String recordUrl;
+
+    @Value("${base.hkUrl:http://10.48.253.21:1443}")
+    private String hkUrl;
+    
+}

+ 80 - 0
business-service/src/main/java/com/ozs/utils/CmdCameraUtil.java

@@ -0,0 +1,80 @@
+package com.ozs.utils;
+
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.stereotype.Component;
+
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+
+@Slf4j
+@Component
+public class CmdCameraUtil {
+
+
+    public void cmd(String cmd) {
+        long l = System.currentTimeMillis();
+        Process exec = null;
+        try {
+            exec = Runtime.getRuntime().exec(new String[]{"sh", "-c", cmd});
+            long l1 = System.currentTimeMillis();
+            log.info("cmd-time:{}", l1 - l);
+        } catch (IOException e) {
+            log.error(e.getMessage());
+            e.printStackTrace();
+        }
+        try {
+            printProcessMsg(exec);
+        } catch (IOException e) {
+            log.error(e.getMessage());
+            e.printStackTrace();
+        }
+        try {
+            int i = exec.waitFor();
+            log.info("------"+i);
+        } catch (InterruptedException e) {
+            log.error(e.getMessage());
+            e.printStackTrace();
+        }
+    }
+
+    /**
+     * 处理process输出流和错误流,防止进程阻塞,在process.waitFor();前调用
+     *
+     * @param exec
+     * @throws IOException
+     */
+    private void printProcessMsg(Process exec) throws IOException {
+        //防止ffmpeg进程塞满缓存造成死锁
+        InputStream error = exec.getErrorStream();
+        InputStream is = exec.getInputStream();
+
+        StringBuffer result = new StringBuffer();
+        String line = null;
+        try {
+            BufferedReader br = new BufferedReader(new InputStreamReader(error, "GBK"));
+            BufferedReader br2 = new BufferedReader(new InputStreamReader(is, "GBK"));
+
+            while ((line = br.readLine()) != null) {
+                result.append(line + "\n");
+            }
+            log.info("FFMPEG视频合成进程错误信息:" + result.toString());
+
+            result = new StringBuffer();
+            line = null;
+
+            while ((line = br2.readLine()) != null) {
+                result.append(line + "\n");
+            }
+            log.info("FFMPEG视频合成进程输出内容为:" + result.toString());
+        } catch (IOException e2) {
+            e2.printStackTrace();
+        } finally {
+            error.close();
+            is.close();
+        }
+
+    }
+
+}

+ 2 - 1
pom.xml

@@ -9,7 +9,7 @@
     <packaging>pom</packaging>
     <version>1.0-SNAPSHOT</version>
 
-    <description>系统</description>
+    <description>机车系统</description>
 
 
     <properties>
@@ -79,6 +79,7 @@
     <modules>
         <module>vehicle-admin</module>
         <module>business-service</module>
+        <module>vehicle-sdk</module>
     </modules>
 
     <build>

+ 17 - 6
vehicle-admin/src/main/java/com/ozs/web/controller/accountmanagment/BaseCameraManagementController.java

@@ -1,5 +1,6 @@
 package com.ozs.web.controller.accountmanagment;
 
+import com.alibaba.fastjson2.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
@@ -23,9 +24,9 @@ import com.ozs.framework.config.ServerConfig;
 import com.ozs.service.*;
 import com.ozs.system.service.DataScoreUtil;
 import com.ozs.system.service.ISysDeptService;
-import com.ozs.web.core.config.CaneraConfig;
+import com.ozs.utils.CameraUtil;
+import com.ozs.utils.CaneraConfig;
 import com.ozs.web.core.config.GetCameraPreviewURL;
-import com.ozs.web.core.util.CameraUtil;
 import io.swagger.annotations.ApiOperation;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.BeanUtils;
@@ -44,6 +45,7 @@ import java.io.InputStream;
 import java.math.BigDecimal;
 import java.math.RoundingMode;
 import java.util.*;
+import java.util.concurrent.TimeUnit;
 import java.util.stream.Collectors;
 
 /**
@@ -485,7 +487,7 @@ public class BaseCameraManagementController extends BaseController {
     @GetMapping(value = "/{id}")
     @ApiOperation("根据相机ID获取相机台账管理信息")
     @Log(title = "相机台账管理", businessType = BusinessType.MESSAGE)
-    public AjaxResult getInfo(@PathVariable Long id) {
+    public AjaxResult getInfo(@PathVariable Long id) throws InterruptedException {
 //        BaseCameraManagement baseCameraManagement = baseCameraManagementService.getById(id);
 //        LambdaQueryWrapper<BaseRailwayManagement> queryWrapper = new LambdaQueryWrapper<BaseRailwayManagement>();
 //        if (!ObjectUtils.isEmpty(baseCameraManagement.getRailwayCode())) {
@@ -522,9 +524,18 @@ public class BaseCameraManagementController extends BaseController {
 //        baseCameraManagement.setMilesRange(begin + "-" + end);
 //        baseCameraManagement.setLongitudeAndLatitude(baseCameraManagement.getInstallLongitude() + "," + baseCameraManagement.getInstallLongitude());
 //        return AjaxResult.success(baseCameraManagement);
-        String cameraPreviewURL = GetCameraPreviewURL.getCameraPreviewURL();
-        log.info("------------------------------------------getInfo"+cameraPreviewURL);
-        return AjaxResult.success(cameraPreviewURL);
+        String cameraPreviewURL = GetCameraPreviewURL.getPreviewURLs();
+        log.info("-------------------------------->>>>>"+cameraPreviewURL);
+        JSONObject outJson =  JSONObject.parse(cameraPreviewURL);
+        log.info("-------------------------------->>>>>outJson------"+outJson);
+        JSONObject data = outJson.getJSONObject("data");
+        log.info("-------------------------------->>>>>data------"+data);
+        String urls=data.getString("url");
+        log.info("-------------------------------->>>>>urls------"+urls);
+        TimeUnit.SECONDS.sleep(5);
+        String msg = HttpUtils.sendGet("http://10.48.36.47:9080/rtsp/api/pull?target=" + urls + "&streamPath=01ea43e6676f4e47bd6c5cd9e02aa006/01ea43e6676f4e47bd6c5cd9e02aa006&save=0");
+//        String msg = HttpUtils.sendGet("http://10.48.36.47:9080/api/gateway/stop?stream=01ea43e6676f4e47bd6c5cd9e02aa006/01ea43e6676f4e47bd6c5cd9e02aa006");
+        return AjaxResult.success(msg);
     }
 
     /**

+ 1 - 5
vehicle-admin/src/main/java/com/ozs/web/controller/accountmanagment/BaseVehicleController.java

@@ -1,6 +1,5 @@
 package com.ozs.web.controller.accountmanagment;
 
-import com.alibaba.fastjson2.JSON;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.ozs.common.annotation.Log;
@@ -9,8 +8,6 @@ import com.ozs.common.core.domain.AjaxResult;
 import com.ozs.common.core.domain.entity.SysDictData;
 import com.ozs.common.core.redis.RedisCache;
 import com.ozs.common.enums.BusinessType;
-import com.ozs.common.exception.base.BaseException;
-import com.ozs.common.utils.AppendUtils;
 import com.ozs.common.utils.ChineseToPingyin;
 import com.ozs.common.utils.HeartbeatUtils;
 import com.ozs.common.utils.StringUtils;
@@ -28,8 +25,7 @@ import com.ozs.service.BaseRailwayManagementService;
 import com.ozs.service.BaseVehicleService;
 import com.ozs.system.service.DataScoreUtil;
 import com.ozs.system.service.ISysDictTypeService;
-import com.ozs.web.common.Constant;
-import com.ozs.web.core.util.CameraUtil;
+import com.ozs.utils.CameraUtil;
 import io.swagger.annotations.ApiOperation;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;

+ 0 - 1
vehicle-admin/src/main/java/com/ozs/web/controller/accountmanagment/MsgAlarmTemporaryController.java

@@ -39,7 +39,6 @@ import com.ozs.service.SvcAddressService;
 import com.ozs.system.service.ISysDictTypeService;
 import com.ozs.web.controller.monitor.SysUserOnlineController;
 import com.ozs.web.controller.websocket.WebSocketCommon;
-import com.ozs.web.core.util.CameraUtil;
 import io.swagger.annotations.ApiOperation;
 import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;

+ 53 - 53
vehicle-admin/src/main/java/com/ozs/web/core/config/CaneraConfig.java

@@ -1,53 +1,53 @@
-package com.ozs.web.core.config;
-
-import lombok.Data;
-import org.springframework.beans.factory.annotation.Value;
-import org.springframework.context.annotation.Configuration;
-
-@Configuration
-@Data
-public class CaneraConfig {
-
-    /**
-     * 视频服务器访问路径
-     */
-    @Value("${base.historyUrl:http://47.106.159.135/streams}")
-    private String historyUrl;
-
-    /**
-     * ffmpeg.exe路径
-     * "D:\\Java\\operSources\\ffmpeg-4.3.1\\bin\\ffmpeg.exe"
-     */
-    @Value("${base.ffmpegPath:C:\\Users\\Administrator.DESKTOP-0NUUTMM\\Downloads\\ffmpeg-5.1.2-essentials_build\\ffmpeg-5.1.2-essentials_build\\bin\\ffmpeg.exe}")
-    private String ffmpegPath;
-
-
-    @Value("${base.filePath:/opt/streams/}")
-    private String filePath;
-
-    /**
-     * 录制视频存放路径
-     */
-    @Value("${base.transcribeFilePath:/opt/streams/record/flv}")
-    private String transcribeFilePath;
-
-
-    @Value("${base.webUrl:http://47.106.159.135/streams}")
-    private String webUrl;
-
-    @Value("${base.bakUrl:http://124.70.58.209:18891}")
-    private String bakUrl;
-
-    @Value("${base.bakUrlRtsp:rtsp://124.70.58.209:8554}")
-    private String bakUrlRtsp;
-
-    @Value("${base.wsUrl:http://124.70.58.209:18891}")
-    private String wsUrl;
-
-    @Value("${base.recordUrl:http://183.236.39.220:8083}")
-    private String recordUrl;
-
-    @Value("${base.hkUrl:http://10.48.253.21:1443}")
-    private String hkUrl;
-    
-}
+//package com.ozs.web.core.config;
+//
+//import lombok.Data;
+//import org.springframework.beans.factory.annotation.Value;
+//import org.springframework.context.annotation.Configuration;
+//
+//@Configuration
+//@Data
+//public class CaneraConfig {
+//
+//    /**
+//     * 视频服务器访问路径
+//     */
+//    @Value("${base.historyUrl:http://47.106.159.135/streams}")
+//    private String historyUrl;
+//
+//    /**
+//     * ffmpeg.exe路径
+//     * "D:\\Java\\operSources\\ffmpeg-4.3.1\\bin\\ffmpeg.exe"
+//     */
+//    @Value("${base.ffmpegPath:C:\\Users\\Administrator.DESKTOP-0NUUTMM\\Downloads\\ffmpeg-5.1.2-essentials_build\\ffmpeg-5.1.2-essentials_build\\bin\\ffmpeg.exe}")
+//    private String ffmpegPath;
+//
+//
+//    @Value("${base.filePath:/opt/streams/}")
+//    private String filePath;
+//
+//    /**
+//     * 录制视频存放路径
+//     */
+//    @Value("${base.transcribeFilePath:/opt/streams/record/flv}")
+//    private String transcribeFilePath;
+//
+//
+//    @Value("${base.webUrl:http://47.106.159.135/streams}")
+//    private String webUrl;
+//
+//    @Value("${base.bakUrl:http://124.70.58.209:18891}")
+//    private String bakUrl;
+//
+//    @Value("${base.bakUrlRtsp:rtsp://124.70.58.209:8554}")
+//    private String bakUrlRtsp;
+//
+//    @Value("${base.wsUrl:http://124.70.58.209:18891}")
+//    private String wsUrl;
+//
+//    @Value("${base.recordUrl:http://183.236.39.220:8083}")
+//    private String recordUrl;
+//
+//    @Value("${base.hkUrl:http://10.48.253.21:1443}")
+//    private String hkUrl;
+//    
+//}

+ 51 - 2
vehicle-admin/src/main/java/com/ozs/web/core/config/GetCameraPreviewURL.java

@@ -30,7 +30,7 @@ public class GetCameraPreviewURL {
         /**
          * STEP3:设置接口的URI地址
          */
-        final String previewURLsApi = ARTEMIS_PATH + "/api/resource/v1/camera/search";
+        final String previewURLsApi = ARTEMIS_PATH+"/api/resource/v1/camera/advance/cameraList";
         Map<String, String> path = new HashMap<String, String>(2) {
             {
                 put("https://", previewURLsApi);//根据现场环境部署确认是http还是https
@@ -47,7 +47,56 @@ public class GetCameraPreviewURL {
          */
         JSONObject jsonBody = new JSONObject();
         jsonBody.put("pageNo", 1);
-        jsonBody.put("pageSize", 10);
+        jsonBody.put("pageSize", 999);
+        String body = jsonBody.toJSONString();
+        /**
+         * STEP6:调用接口
+         */
+        String result = ArtemisHttpUtil.doPostStringArtemis(path, body, null, null, contentType , null);// post请求application/json类型参数
+        log.info("GetCameraPreviewURL----->"+result);
+        return result;
+    }
+
+
+
+    public static String getPreviewURLs() {
+
+        /**
+         * STEP1:设置平台参数,根据实际情况,设置host appkey appsecret 三个参数.
+         */
+        ArtemisConfig.host = "10.48.253.21:1443"; // 平台的ip端口
+        ArtemisConfig.appKey = "20110033";  // 密钥appkey
+        ArtemisConfig.appSecret = "QoGESFXOYrC68ixIS7wo";// 密钥appSecret
+
+        /**
+         * STEP2:设置OpenAPI接口的上下文
+         */
+        final String ARTEMIS_PATH = "/artemis";
+
+        /**
+         * STEP3:设置接口的URI地址
+         */
+        final String previewURLsApi = ARTEMIS_PATH+"/api/video/v1/cameras/previewURLs";
+        Map<String, String> path = new HashMap<String, String>(2) {
+            {
+                put("https://", previewURLsApi);//根据现场环境部署确认是http还是https
+            }
+        };
+
+        /**
+         * STEP4:设置参数提交方式
+         */
+        String contentType = "application/json";
+
+        /**
+         * STEP5:组装请求参数
+         */
+        JSONObject jsonBody = new JSONObject();
+        jsonBody.put("cameraIndexCode", "01ea43e6676f4e47bd6c5cd9e02aa006");
+        jsonBody.put("streamType", 0);
+        jsonBody.put("protocol","rtsp");
+        jsonBody.put("transmode", 1);
+        jsonBody.put("expand","streamform=rtp");
         String body = jsonBody.toJSONString();
         /**
          * STEP6:调用接口

File diff suppressed because it is too large
+ 941 - 941
vehicle-admin/src/main/java/com/ozs/web/core/util/CameraUtil.java


+ 81 - 81
vehicle-admin/src/main/java/com/ozs/web/core/util/CmdCameraUtil.java

@@ -1,81 +1,81 @@
-package com.ozs.web.core.util;
-
-import lombok.extern.slf4j.Slf4j;
-import org.springframework.stereotype.Component;
-
-import java.io.BufferedReader;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-
-@Slf4j
-@Component
-public class CmdCameraUtil {
-
-
-    public void cmd(String cmd) {
-        long l = System.currentTimeMillis();
-        Process exec = null;
-        try {
-            exec = Runtime.getRuntime().exec(new String[]{"sh", "-c", cmd});
-            long l1 = System.currentTimeMillis();
-            log.info("cmd-time:{}", l1 - l);
-        } catch (IOException e) {
-            log.error(e.getMessage());
-            e.printStackTrace();
-        }
-        try {
-            printProcessMsg(exec);
-        } catch (IOException e) {
-            log.error(e.getMessage());
-            e.printStackTrace();
-        }
-        try {
-            int i = exec.waitFor();
-            log.info("------"+i);
-        } catch (InterruptedException e) {
-            log.error(e.getMessage());
-            e.printStackTrace();
-        }
-    }
-
-
-    /**
-     * 处理process输出流和错误流,防止进程阻塞,在process.waitFor();前调用
-     *
-     * @param exec
-     * @throws IOException
-     */
-    private void printProcessMsg(Process exec) throws IOException {
-        //防止ffmpeg进程塞满缓存造成死锁
-        InputStream error = exec.getErrorStream();
-        InputStream is = exec.getInputStream();
-
-        StringBuffer result = new StringBuffer();
-        String line = null;
-        try {
-            BufferedReader br = new BufferedReader(new InputStreamReader(error, "GBK"));
-            BufferedReader br2 = new BufferedReader(new InputStreamReader(is, "GBK"));
-
-            while ((line = br.readLine()) != null) {
-                result.append(line + "\n");
-            }
-            log.info("FFMPEG视频合成进程错误信息:" + result.toString());
-
-            result = new StringBuffer();
-            line = null;
-
-            while ((line = br2.readLine()) != null) {
-                result.append(line + "\n");
-            }
-            log.info("FFMPEG视频合成进程输出内容为:" + result.toString());
-        } catch (IOException e2) {
-            e2.printStackTrace();
-        } finally {
-            error.close();
-            is.close();
-        }
-
-    }
-
-}
+//package com.ozs.web.core.util;
+//
+//import com.alibaba.fastjson2.JSONObject;
+//import lombok.extern.slf4j.Slf4j;
+//import org.springframework.stereotype.Component;
+//
+//import java.io.BufferedReader;
+//import java.io.IOException;
+//import java.io.InputStream;
+//import java.io.InputStreamReader;
+//
+//@Slf4j
+//@Component
+//public class CmdCameraUtil {
+//
+//
+//    public void cmd(String cmd) {
+//        long l = System.currentTimeMillis();
+//        Process exec = null;
+//        try {
+//            exec = Runtime.getRuntime().exec(new String[]{"sh", "-c", cmd});
+//            long l1 = System.currentTimeMillis();
+//            log.info("cmd-time:{}", l1 - l);
+//        } catch (IOException e) {
+//            log.error(e.getMessage());
+//            e.printStackTrace();
+//        }
+//        try {
+//            printProcessMsg(exec);
+//        } catch (IOException e) {
+//            log.error(e.getMessage());
+//            e.printStackTrace();
+//        }
+//        try {
+//            int i = exec.waitFor();
+//            log.info("------"+i);
+//        } catch (InterruptedException e) {
+//            log.error(e.getMessage());
+//            e.printStackTrace();
+//        }
+//    }
+//
+//    /**
+//     * 处理process输出流和错误流,防止进程阻塞,在process.waitFor();前调用
+//     *
+//     * @param exec
+//     * @throws IOException
+//     */
+//    private void printProcessMsg(Process exec) throws IOException {
+//        //防止ffmpeg进程塞满缓存造成死锁
+//        InputStream error = exec.getErrorStream();
+//        InputStream is = exec.getInputStream();
+//
+//        StringBuffer result = new StringBuffer();
+//        String line = null;
+//        try {
+//            BufferedReader br = new BufferedReader(new InputStreamReader(error, "GBK"));
+//            BufferedReader br2 = new BufferedReader(new InputStreamReader(is, "GBK"));
+//
+//            while ((line = br.readLine()) != null) {
+//                result.append(line + "\n");
+//            }
+//            log.info("FFMPEG视频合成进程错误信息:" + result.toString());
+//
+//            result = new StringBuffer();
+//            line = null;
+//
+//            while ((line = br2.readLine()) != null) {
+//                result.append(line + "\n");
+//            }
+//            log.info("FFMPEG视频合成进程输出内容为:" + result.toString());
+//        } catch (IOException e2) {
+//            e2.printStackTrace();
+//        } finally {
+//            error.close();
+//            is.close();
+//        }
+//
+//    }
+//
+//}

+ 5 - 0
vehicle-sdk/Dockerfile

@@ -0,0 +1,5 @@
+FROM openjdk:8
+ADD target/hazard-sdk.jar app.jar
+EXPOSE 18818
+VOLUME ["/data/service/hazard-sdk/logs","/logs"]
+ENTRYPOINT java -jar /app.jar >/logs/app.log

+ 110 - 0
vehicle-sdk/pom.xml

@@ -0,0 +1,110 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <parent>
+        <artifactId>GeoHazardMonitor</artifactId>
+        <groupId>com.ozs</groupId>
+        <version>1.0-SNAPSHOT</version>
+        <relativePath>../pom.xml</relativePath>
+    </parent>
+    <modelVersion>4.0.0</modelVersion>
+    <packaging>jar</packaging>
+    <version>1.0-SNAPSHOT</version>
+    <artifactId>hazard-sdk</artifactId>
+
+    <dependencies>
+        <!-- webSocket web端 消息推送 -->
+<!--        <dependency>-->
+<!--            <groupId>org.springframework.boot</groupId>-->
+<!--            <artifactId>spring-boot-starter-thymeleaf</artifactId>-->
+<!--        </dependency>-->
+
+<!--        <dependency>-->
+<!--            <groupId>org.springframework.boot</groupId>-->
+<!--            <artifactId>spring-boot-starter-websocket</artifactId>-->
+<!--        </dependency>-->
+
+<!--        &lt;!&ndash; 极光推送 &ndash;&gt;-->
+<!--        <dependency>-->
+<!--            <groupId>cn.jpush.api</groupId>-->
+<!--            <artifactId>jpush-client</artifactId>-->
+<!--            <version>3.3.8</version>-->
+<!--        </dependency>-->
+<!--        <dependency>-->
+<!--            <groupId>cn.jpush.api</groupId>-->
+<!--            <artifactId>jmessage-client</artifactId>-->
+<!--            <version>1.1.8</version>-->
+<!--        </dependency>-->
+<!--        <dependency>-->
+<!--            <groupId>cn.jpush.api</groupId>-->
+<!--            <artifactId>jiguang-common</artifactId>-->
+<!--            <version>1.1.3</version>-->
+<!--        </dependency>-->
+<!--        <dependency>-->
+<!--            <groupId>io.netty</groupId>-->
+<!--            <artifactId>netty-all</artifactId>-->
+<!--            <version>4.1.6.Final</version>-->
+<!--            <scope>compile</scope>-->
+<!--        </dependency>-->
+
+        <!--lombok -->
+        <dependency>
+            <groupId>org.projectlombok</groupId>
+            <artifactId>lombok</artifactId>
+            <version>1.16.18</version>
+        </dependency>
+
+        <!-- SpringBoot Web容器 -->
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter-web</artifactId>
+        </dependency>
+        <!-- Mysql驱动包 -->
+        <dependency>
+            <groupId>mysql</groupId>
+            <artifactId>mysql-connector-java</artifactId>
+        </dependency>
+        <!-- 阿里数据库连接池 -->
+        <dependency>
+            <groupId>com.alibaba</groupId>
+            <artifactId>druid-spring-boot-starter</artifactId>
+            <version>1.2.15</version>
+        </dependency>
+        <!-- 业务代码-->
+        <dependency>
+            <groupId>com.ozs</groupId>
+            <artifactId>business-service</artifactId>
+        </dependency>
+    </dependencies>
+
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.springframework.boot</groupId>
+                <artifactId>spring-boot-maven-plugin</artifactId>
+                <version>2.1.1.RELEASE</version>
+                <configuration>
+                    <fork>true</fork> <!-- 如果没有该配置,devtools不会生效 -->
+                </configuration>
+                <executions>
+                    <execution>
+                        <goals>
+                            <goal>repackage</goal>
+                        </goals>
+                    </execution>
+                </executions>
+            </plugin>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-war-plugin</artifactId>
+                <version>3.1.0</version>
+                <configuration>
+                    <failOnMissingWebXml>false</failOnMissingWebXml>
+                    <warName>${project.artifactId}</warName>
+                </configuration>
+            </plugin>
+        </plugins>
+        <finalName>${project.artifactId}</finalName>
+    </build>
+</project>

+ 21 - 0
vehicle-sdk/src/main/java/com/ozs/VehicleSdkApplication.java

@@ -0,0 +1,21 @@
+package com.ozs;
+
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
+
+/**
+ * 启动程序
+ *
+ * @author ruoyi
+ */
+@SpringBootApplication(exclude = { DataSourceAutoConfiguration.class })
+public class VehicleSdkApplication
+{
+    public static void main(String[] args)
+    {
+        // System.setProperty("spring.devtools.restart.enabled", "false");
+        SpringApplication.run(VehicleSdkApplication.class, args);
+        System.out.println("(♥◠‿◠)ノ゙  启动成功   ლ(´ڡ`ლ)゙");
+    }
+}

+ 18 - 0
vehicle-sdk/src/main/java/com/ozs/VehicleServletInitializer.java

@@ -0,0 +1,18 @@
+package com.ozs;
+
+import org.springframework.boot.builder.SpringApplicationBuilder;
+import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
+
+/**
+ * web容器中进行部署
+ *
+ * @author ruoyi
+ */
+public class VehicleServletInitializer extends SpringBootServletInitializer
+{
+    @Override
+    protected SpringApplicationBuilder configure(SpringApplicationBuilder application)
+    {
+        return application.sources(VehicleSdkApplication.class);
+    }
+}

+ 1 - 1
vehicle-admin/src/main/java/com/ozs/web/common/Constant.java

@@ -1,4 +1,4 @@
-package com.ozs.web.common;
+package com.ozs.config;
 
 public class Constant {
     public static final String HERTBEA_KEY ="hertbea_";

+ 29 - 97
vehicle-admin/src/main/java/com/ozs/web/controller/sdk/GeoHazardMonitorTokenController.java

@@ -1,4 +1,4 @@
-package com.ozs.web.controller.sdk;
+package com.ozs.controller.upload;
 
 import com.alibaba.fastjson2.JSON;
 import com.alibaba.fastjson2.JSONObject;
@@ -7,10 +7,11 @@ import com.ozs.common.core.redis.RedisCache;
 import com.ozs.common.utils.ApiTokenUtils;
 import com.ozs.common.utils.ChineseToPingyin;
 import com.ozs.common.utils.HeartbeatUtils;
+import com.ozs.common.utils.HttpClientUtil;
 import com.ozs.common.utils.IgnoreUtils;
 import com.ozs.common.utils.StringUtils;
-import com.ozs.common.utils.http.HttpUtils;
 import com.ozs.common.utils.stateSecrets.SM4Utils;
+import com.ozs.config.Constant;
 import com.ozs.entity.BaseCameraManagement;
 import com.ozs.entity.BaseRailwayManagement;
 import com.ozs.entity.BaseTerminal;
@@ -20,8 +21,8 @@ import com.ozs.entity.MsgAlarm;
 import com.ozs.entity.MsgAlarmExt;
 import com.ozs.entity.MsgAlarmFrequency;
 import com.ozs.entity.MsgHeartbeatAlarmMessage;
-import com.ozs.entity.SvcAddress;
 import com.ozs.entity.SkynetHeartbeatLog;
+import com.ozs.entity.SvcAddress;
 import com.ozs.entity.TerminalIgnoreAlarm;
 import com.ozs.entity.VehiclePosition;
 import com.ozs.entity.vo.AlarmFilesVo;
@@ -33,7 +34,6 @@ import com.ozs.entity.vo.CameraVo;
 import com.ozs.entity.vo.Files;
 import com.ozs.entity.vo.HeartbeatVo;
 import com.ozs.entity.vo.ParameterVo;
-import com.ozs.entity.vo.PlaybackVo;
 import com.ozs.entity.vo.QueryAlarmVo;
 import com.ozs.entity.vo.ReleaseAlarmVo;
 import com.ozs.entity.vo.ReqMsgAlarmVo;
@@ -43,27 +43,21 @@ import com.ozs.entity.vo.RespGeoHazardMonitorVo;
 import com.ozs.entity.vo.RespHeartbeatVo;
 import com.ozs.entity.vo.SkynetHeartbeatVo;
 import com.ozs.entity.vo.TerminalIgnoreVo;
-import com.ozs.framework.config.ServerConfig;
 import com.ozs.mapper.AlarmHeartbeatLogMapper;
 import com.ozs.mapper.MsgHeartbeatAlarmMessageMapper;
 import com.ozs.mapper.SkynetHeartbeatLogMapper;
 import com.ozs.service.BaseCameraManagementService;
 import com.ozs.service.BaseRailwayManagementService;
-import com.ozs.service.BaseVehicleTerminalService;
-import com.ozs.service.BaseUserService;
 import com.ozs.service.BaseTerminalService;
+import com.ozs.service.BaseUserService;
+import com.ozs.service.BaseVehicleTerminalService;
 import com.ozs.service.MsgAlarmExtService;
 import com.ozs.service.MsgAlarmFrequencyService;
 import com.ozs.service.MsgAlarmService;
 import com.ozs.service.SvcAddressService;
 import com.ozs.service.TerminalIgnoreAlarmService;
 import com.ozs.service.VehiclePositionService;
-import com.ozs.system.mapper.SysUserMapper;
-import com.ozs.web.common.Constant;
-import com.ozs.web.controller.monitor.SysUserOnlineController;
-import com.ozs.web.controller.websocket.WebSocketCommon;
-import com.ozs.web.controller.websocket.WebSocketServer;
-import com.ozs.web.core.util.CameraUtil;
+import com.ozs.utils.CameraUtil;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -86,7 +80,6 @@ import java.util.Date;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
-import java.util.concurrent.CompletableFuture;
 import java.util.stream.Collectors;
 
 /**
@@ -104,8 +97,6 @@ public class GeoHazardMonitorTokenController {
     @Resource
     private ApiTokenUtils apiTokenUtils;
     @Autowired
-    WebSocketServer webSocketServer;
-    @Autowired
     MsgAlarmService msgAlarmService;
     @Autowired
     MsgAlarmFrequencyService msgAlarmFrequencyService;
@@ -113,10 +104,6 @@ public class GeoHazardMonitorTokenController {
     SvcAddressService svcAddressService;
     @Autowired
     BaseCameraManagementService baseCameraManagementService;
-    @Autowired
-    SysUserOnlineController sysUserOnlineController;
-    //    @Value("${sdk.publish}")
-//    private String sdkUrl;
     @Autowired
     private BaseUserService baseUserService;
     @Autowired
@@ -136,13 +123,7 @@ public class GeoHazardMonitorTokenController {
     @Autowired
     private RedisCache redisCache;
     @Autowired
-    private ServerConfig serverConfig;
-    @Autowired
     private BaseTerminalService baseTerminalService;
-    @Resource
-    private SysUserMapper sysUserMapper;
-    @Autowired
-    WebSocketCommon webSocketCommon;
     @Autowired
     private CameraUtil cameraUtil;
     @Resource
@@ -153,6 +134,8 @@ public class GeoHazardMonitorTokenController {
     private MsgHeartbeatAlarmMessageMapper msgHearbeatAlarmMessageMapper;
     @Value("${base.env}")
     private String env;
+    @Value("${sdk.publish}")
+    private String sdkUrl;
 
     /**
      * 获取web访问令牌
@@ -221,7 +204,7 @@ public class GeoHazardMonitorTokenController {
             return JSONObject.toJSONString(jsonObject);
         }
     }
-
+    
     /**
      * 报警信息数据传输
      */
@@ -359,36 +342,20 @@ public class GeoHazardMonitorTokenController {
                 msgAlarmVice.setRailwayCode(reqMsgAlarmVo.getAlarmRailway());
                 msgAlarmVice.setAlarmTime(new Date(reqMsgAlarmVo.getAlarmTime()));
                 msgAlarmFrequencyService.save(msgAlarmVice);
-                webSocketCommon.publish(msgAlarm);
+                try {
+                    log.info("alarmJSON :{}", JSON.toJSONString(msgAlarm));
+                    String result = HttpClientUtil.postJson(sdkUrl, JSON.toJSONString(msgAlarm));
+                    log.info("result:{}", result);
+                } catch (Exception e) {
+                    log.info(e.getMessage());
+                    e.printStackTrace();
+                    jsonObject.put("resultCode", 0);
+                    jsonObject.put("message", "失败");
+                    jsonObject.put("data", "消息推送失败");
+                    return SM4Utils.encryptData_ECB(JSONObject.toJSONString(jsonObject), key);
+                }
                 List<String> collect = baseCameraManagementList.stream().map(BaseCameraManagement::getCameraCode).collect(Collectors.toList());
 //                CompletableFuture.runAsync(() ->cameraUtil.playbackURLs(collect));
-//                    String invite = CameraUtil.invite(baseCameraManagement.getCameraCode(), baseCameraManagement.getChannel());
-//                    if ("304".equals(invite) || "200".equals(invite)) {
-//                        String start = HttpUtils.sendGet(CameraUtil.startRecording(baseCameraManagement.getCameraCode(), baseCameraManagement.getChannel()));
-//                        log.info("startRecording------------" + start);
-//                        if (start.startsWith(baseCameraManagement.getCameraCode() + "/" + baseCameraManagement.getChannel())) {
-//                            baseCameraManagement.setTaskId(start);
-//                            baseCameraManagement.setUpdateBy(admin.getUserId());
-//                        } else {
-//                            jsonObject.put("resultCode", 0);
-//                            jsonObject.put("message", "失败");
-//                            jsonObject.put("data", "视频录制失败:请确认流是否存在!!!");
-//                            return SM4Utils.encryptData_ECB(JSONObject.toJSONString(jsonObject), key);
-//                        }
-//                        if (!baseCameraManagementService.updateById(baseCameraManagement)) {
-//                            jsonObject.put("resultCode", 0);
-//                            jsonObject.put("message", "失败");
-//                            jsonObject.put("data", "开启录制视频失败!!!");
-//                            return SM4Utils.encryptData_ECB(JSONObject.toJSONString(jsonObject), key);
-//                        }
-//                    } else {
-//                        jsonObject.put("resultCode", 0);
-//                        jsonObject.put("message", "失败");
-//                        jsonObject.put("data", "视频邀约失败,视频中心没有该相机编码或通道编码的摄像头!!!");
-//                        return SM4Utils.encryptData_ECB(JSONObject.toJSONString(jsonObject), key);
-//                    }
-                
-
             } else {
                 BeanUtils.copyProperties(reqMsgAlarmVo, msgAlarmVice);
                 msgAlarmVice.setCreateBy(admin.getUserId());
@@ -397,20 +364,6 @@ public class GeoHazardMonitorTokenController {
                 msgAlarmVice.setRailwayCode(reqMsgAlarmVo.getAlarmRailway());
                 msgAlarmFrequencyService.save(msgAlarmVice);
             }
-//            try {
-//                MsgAlarm alarms = msgAlarmService.getOne(lw);
-//                log.info("sdkUrl:{}", sdkUrl);
-//                log.info("alarmJSON :{}", JSON.toJSONString(alarms));
-////                String result = HttpClientUtil.postJson(sdkUrl, JSON.toJSONString(alarms));
-////                log.info("result:{}", result);
-//            } catch (Exception e) {
-//                log.info(e.getMessage());
-//                e.printStackTrace();
-//                jsonObject.put("resultCode", 0);
-//                jsonObject.put("message", "失败");
-//                jsonObject.put("data", "消息推送失败");
-//                return SM4Utils.encryptData_ECB(JSONObject.toJSONString(jsonObject), "4370780c9a8c43e5");
-//            }
             jsonObject.put("resultCode", 1);
             jsonObject.put("message", "ok");
             jsonObject.put("data", null);
@@ -610,27 +563,6 @@ public class GeoHazardMonitorTokenController {
             LambdaQueryWrapper<BaseTerminal> terminal = new LambdaQueryWrapper<>();
             terminal.eq(BaseTerminal::getTerminalCode, vehiclePosition.getTerminalCode());
             boolean update = baseTerminalService.update(baseTerminal1, terminal);
-//            //*******获取终端经度纬度,将车载终端code改为机车的code,便是机车的位置
-//            HeartbeatVo heartbeatVoCH = new HeartbeatVo();
-//            BeanUtils.copyProperties(heartbeatVo, heartbeatVoCH);
-//            //*******将终端关联的机车号赋值给推送信息对象
-//            heartbeatVoCH.setVehicleCode(baseTerminal.getVehicleCode());
-//            String content = objStr(heartbeatVoCH);
-//            //获取在线用户
-//            List<SysUserOnline> rows = (List<SysUserOnline>) sysUserOnlineController.list(null, null).getRows();
-//            if (!ObjectUtils.isEmpty(rows)) {
-//                //拿到用户userNameList
-//                List<String> userNameList = rows.stream().map(SysUserOnline::getUserName).collect(Collectors.toList());
-//                LambdaQueryWrapper<SysUser> userWrapper = new LambdaQueryWrapper<>();
-//                userWrapper.in(SysUser::getUserName, userNameList);
-//                List<SysUser> sysUsers = sysUserMapper.selectList(userWrapper);
-//                //拿到用户userIdList
-//                List<Long> userIdList = sysUsers.stream().map(SysUser::getId).collect(Collectors.toList());
-//                for (Long userid : userIdList) {
-//                    //推送给在线用户
-//                    webSocketServer.sendOneMessage(String.valueOf(userid), content);
-//                }
-//            }
 
             //目视距离和里程位置
             if (save && update) {
@@ -1432,13 +1364,13 @@ public class GeoHazardMonitorTokenController {
         return obj.toJSONString();
     }
 
-    public static void main(String[] args) {
-        JSONObject res = new JSONObject();
-        res.put("grantType", "1");
-        res.put("clientId", "1005");
-        String s = SM4Utils.encryptData_ECB(JSONObject.toJSONString(res), "4370780c9a8c43e5");
-        System.out.println(s);
-    }
+//    public static void main(String[] args) {
+//        JSONObject res = new JSONObject();
+//        res.put("grantType", "1");
+//        res.put("clientId", "1005");
+//        String s = SM4Utils.encryptData_ECB(JSONObject.toJSONString(res), "4370780c9a8c43e5");
+//        System.out.println(s);
+//    }
 
     @PostMapping("/encryptionAlarm")
     public String encryptionAlarm(@RequestBody ReqMsgAlarmVo vo) {

+ 1 - 5
vehicle-admin/src/main/java/com/ozs/web/controller/sdk/UploadController.java

@@ -1,13 +1,10 @@
-package com.ozs.web.controller.sdk;
+package com.ozs.controller.upload;
 
 import com.alibaba.fastjson2.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
-import com.ozs.common.core.domain.entity.SysDept;
 import com.ozs.common.utils.MinioUtils;
 import com.ozs.common.utils.StringUtils;
-import com.ozs.common.utils.stateSecrets.SM4Utils;
 import com.ozs.common.utils.uuid.IdUtils;
-import com.ozs.entity.BaseCameraManagement;
 import com.ozs.entity.BaseRailwayManagement;
 import com.ozs.service.BaseCameraManagementService;
 import com.ozs.service.BaseRailwayManagementService;
@@ -23,7 +20,6 @@ import javax.annotation.Resource;
 import java.text.SimpleDateFormat;
 import java.util.Date;
 import java.util.HashMap;
-import java.util.List;
 import java.util.Map;
 
 @RestController

+ 1 - 0
vehicle-sdk/src/main/resources/META-INF/spring-devtools.properties

@@ -0,0 +1 @@
+restart.include.json=/com.alibaba.fastjson.*.jar

+ 57 - 0
vehicle-sdk/src/main/resources/application-dmdruid.yml

@@ -0,0 +1,57 @@
+# 数据源配置
+spring:
+    datasource:
+        type: com.alibaba.druid.pool.DruidDataSource
+        driverClassName: dm.jdbc.driver.DmDriver
+        druid:
+            # 主库数据源
+            master:
+                url: jdbc:dm://124.70.58.209:5236/vehicle
+                username: VEHICLE
+                password: VEHICLE
+            # 从库数据源
+            slave:
+                # 从数据源开关/默认关闭
+                enabled: false
+                url:
+                username:
+                password:
+            # 初始连接数
+            initialSize: 5
+            # 最小连接池数量
+            minIdle: 10
+            # 最大连接池数量
+            maxActive: 20
+            # 配置获取连接等待超时的时间
+            maxWait: 60000
+            # 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒
+            timeBetweenEvictionRunsMillis: 60000
+            # 配置一个连接在池中最小生存的时间,单位是毫秒
+            minEvictableIdleTimeMillis: 300000
+            # 配置一个连接在池中最大生存的时间,单位是毫秒
+            maxEvictableIdleTimeMillis: 900000
+            # 配置检测连接是否有效
+            validationQuery: SELECT 1 FROM DUAL
+            testWhileIdle: true
+            testOnBorrow: false
+            testOnReturn: false
+            webStatFilter:
+                enabled: true
+            statViewServlet:
+                enabled: true
+                # 设置白名单,不填则允许所有访问
+                allow:
+                url-pattern: /druid/*
+                # 控制台管理用户名和密码
+                login-username: ruoyi
+                login-password: 123456
+            filter:
+                stat:
+                    enabled: true
+                    # 慢SQL记录
+                    log-slow-sql: true
+                    slow-sql-millis: 1000
+                    merge-sql: true
+                wall:
+                    config:
+                        multi-statement-allow: true

+ 57 - 0
vehicle-sdk/src/main/resources/application-druid.yml

@@ -0,0 +1,57 @@
+# 数据源配置
+spring:
+    datasource:
+        type: com.alibaba.druid.pool.DruidDataSource
+        driverClassName: com.mysql.cj.jdbc.Driver
+        druid:
+            # 主库数据源
+            master:
+                url: jdbc:mysql://124.70.58.209:18806/vehicle?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
+                username: root
+                password: 123.asd
+            # 从库数据源
+            slave:
+                # 从数据源开关/默认关闭
+                enabled: false
+                url:
+                username:
+                password:
+            # 初始连接数
+            initialSize: 5
+            # 最小连接池数量
+            minIdle: 10
+            # 最大连接池数量
+            maxActive: 20
+            # 配置获取连接等待超时的时间
+            maxWait: 60000
+            # 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒
+            timeBetweenEvictionRunsMillis: 60000
+            # 配置一个连接在池中最小生存的时间,单位是毫秒
+            minEvictableIdleTimeMillis: 300000
+            # 配置一个连接在池中最大生存的时间,单位是毫秒
+            maxEvictableIdleTimeMillis: 900000
+            # 配置检测连接是否有效
+            validationQuery: SELECT 1 FROM DUAL
+            testWhileIdle: true
+            testOnBorrow: false
+            testOnReturn: false
+            webStatFilter:
+                enabled: true
+            statViewServlet:
+                enabled: true
+                # 设置白名单,不填则允许所有访问
+                allow:
+                url-pattern: /druid/*
+                # 控制台管理用户名和密码
+                login-username: ruoyi
+                login-password: 123456
+            filter:
+                stat:
+                    enabled: true
+                    # 慢SQL记录
+                    log-slow-sql: true
+                    slow-sql-millis: 1000
+                    merge-sql: true
+                wall:
+                    config:
+                        multi-statement-allow: true

+ 57 - 0
vehicle-sdk/src/main/resources/application-kdruid.yml

@@ -0,0 +1,57 @@
+# 数据源配置
+spring:
+    datasource:
+        type: com.alibaba.druid.pool.DruidDataSource
+        driverClassName: com.kingbase8.Driver
+        druid:
+            # 主库数据源
+            master:
+                url: jdbc:kingbase8://124.70.58.209:18821/vehicle
+                username: system
+                password: kingbase@@y06
+            # 从库数据源
+            slave:
+                # 从数据源开关/默认关闭
+                enabled: false
+                url:
+                username:
+                password:
+            # 初始连接数
+            initialSize: 5
+            # 最小连接池数量
+            minIdle: 10
+            # 最大连接池数量
+            maxActive: 20
+            # 配置获取连接等待超时的时间
+            maxWait: 60000
+            # 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒
+            timeBetweenEvictionRunsMillis: 60000
+            # 配置一个连接在池中最小生存的时间,单位是毫秒
+            minEvictableIdleTimeMillis: 300000
+            # 配置一个连接在池中最大生存的时间,单位是毫秒
+            maxEvictableIdleTimeMillis: 900000
+            # 配置检测连接是否有效
+            validationQuery: SELECT 1 FROM DUAL
+            testWhileIdle: true
+            testOnBorrow: false
+            testOnReturn: false
+            webStatFilter:
+                enabled: true
+            statViewServlet:
+                enabled: true
+                # 设置白名单,不填则允许所有访问
+                allow:
+                url-pattern: /druid/*
+                # 控制台管理用户名和密码
+                login-username: ruoyi
+                login-password: 123456
+            filter:
+                stat:
+                    enabled: true
+                    # 慢SQL记录
+                    log-slow-sql: true
+                    slow-sql-millis: 1000
+                    merge-sql: true
+                wall:
+                    config:
+                        multi-statement-allow: true

+ 176 - 0
vehicle-sdk/src/main/resources/application.yml

@@ -0,0 +1,176 @@
+# 项目相关配置
+base:
+  # 名称
+  name: base
+  # 版本
+  version: 1.0
+  # 版权年份
+  copyrightYear: 2023
+  # 实例演示开关
+  demoEnabled: true
+  # 文件路径 示例( Windows配置D:/ruoyi/uploadPath,Linux配置 /home/ruoyi/uploadPath)
+  profile: /opt/streams/record/flv
+  # 获取ip地址开关
+  addressEnabled: true
+  # 验证码类型 math 数组计算 char 字符验证
+  captchaType: math
+  #  sqlType: kingbasees  # 数据库类型
+  sqlType: dm  # 数据库类型
+  dbname: vehicle #数据库名
+  #图片路径前缀
+  imgUrl: http://124.71.171.71:18801/picbucket
+  ffmpegPath: /usr/bin/ffmpeg
+  filePath: /opt/streams/record/flv/
+  webUrl: http://124.70.58.209:18812
+  bakUrl: http://124.70.58.209:18891
+  wsUrl: ws://124.70.58.209:9080
+  historyUrl: http://124.70.58.209:18812
+  recordUrl: http://124.70.58.209:18810${server.servlet.context-path}
+  env: 1
+  hkUrl: http://10:122:1:22:1443
+
+server:
+  # 服务器的HTTP端口,默认为8081
+  port: 8081
+  servlet:
+    # 应用的访问路径
+    context-path: /
+  tomcat:
+    # tomcat的URI编码
+    uri-encoding: UTF-8
+    # 连接数满后的排队数,默认为100
+    accept-count: 1000
+    threads:
+      # tomcat最大线程数,默认为200
+      max: 800
+      # Tomcat启动初始化的线程数,默认值10
+      min-spare: 100
+
+# 日志配置
+logging:
+  level:
+    com.ozs: debug
+    org.springframework: warn
+
+# 用户配置
+user:
+  password:
+    # 密码最大错误次数
+    maxRetryCount: 5
+    # 密码锁定时间(默认10分钟)
+    lockTime: 10
+
+# Spring配置
+spring:
+  # 资源信息
+  messages:
+    # 国际化资源文件路径
+    basename: i18n/messages
+  profiles:
+    #    active: kdruid
+    active: dmdruid
+  # 文件上传
+  servlet:
+    multipart:
+      # 单个文件大小
+      max-file-size:  1000MB
+      # 设置总上传的文件大小
+      max-request-size:  1000MB
+  # 服务模块
+  devtools:
+    restart:
+      # 热部署开关
+      enabled: true
+  # redis 配置
+  redis:
+    # 地址
+    host: 124.70.58.209
+    # 端口,默认为6379
+    port: 7001
+    # 数据库索引
+    database: 1
+    # 密码
+    password: 106@qwe123
+    # 连接超时时间
+    timeout: 100s
+    lettuce:
+      pool:
+        # 连接池中的最小空闲连接
+        min-idle: 0
+        # 连接池中的最大空闲连接
+        max-idle: 8
+        # 连接池的最大数据库连接数
+        max-active: 8
+        # #连接池最大阻塞等待时间(使用负值表示没有限制)
+        max-wait: -1ms
+
+# token配置
+token:
+  # 令牌自定义标识
+  header: Authorization
+  # 令牌密钥
+  secret: abcdefghijklmnopqrstuvwxyz
+  # 令牌有效期(默认30分钟)
+  expireTime: 30
+apptoken:
+  # 令牌自定义标识
+  header: Authorization
+  # 令牌密钥
+  secret: qwertyuiopasdfghjklzxcvbnm
+  # 令牌有效期(默认15天)
+  expireTime: 21600
+
+# MyBatis配置
+mybatis:
+  # 搜索指定包别名
+  typeAliasesPackage: com.ozs.**.domain
+  # 配置mapper的扫描,找到所有的mapper.xml映射文件
+  mapperLocations: classpath*:mapper/**/*Mapper.xml
+  # 加载全局的配置文件
+  configLocation: classpath:mybatis/mybatis-config.xml
+
+# MyBatis-plus配置
+mybatis-plus:
+  config-location: classpath:mybatis/mybatis-config.xml
+  typeAliasesPackage: com.ozs.**.domain
+  mapperLocations: classpath*:mapper/**/*Mapper.xml
+
+
+# PageHelper分页插件
+pagehelper:
+  helperDialect: mysql
+  supportMethodsArguments: true
+  params: count=countSql
+
+# Swagger配置
+swagger:
+  # 是否开启swagger
+  enabled: true
+  # 请求前缀
+  pathMapping: /dev-api
+
+# 防止XSS攻击
+xss:
+  # 过滤开关
+  enabled: true
+  # 排除链接(多个用逗号分隔)
+  excludes: /system/notice
+  # 匹配链接
+  urlPatterns: /system/*,/monitor/*,/tool/*
+
+minio:
+  endpoint: http://124.71.171.71:18801 #Minio服务所在地址
+  bucketName: picbucket #存储桶名称
+  accessKey: admin #访问的key
+  secretKey: admin123 #访问的秘钥
+
+sdk:
+  publish: http://124.70.58.209:8080/sdk/publish
+  
+aliyun:
+  oss:
+    file:
+      endpoint: oss-cn-beijing.aliyuncs.com
+      keyid: LTAI5tGRWozi6CLywJSXMkTh
+      keysecret: LhJI1KcaN84MjLvtHzDX3KpXeBnT2p
+      bucketname: hxs-1010  

+ 24 - 0
vehicle-sdk/src/main/resources/banner.txt

@@ -0,0 +1,24 @@
+Application Version: ${ruoyi.version}
+Spring Boot Version: ${spring-boot.version}
+////////////////////////////////////////////////////////////////////
+//                          _ooOoo_                               //
+//                         o8888888o                              //
+//                         88" . "88                              //
+//                         (| ^_^ |)                              //
+//                         O\  =  /O                              //
+//                      ____/`---'\____                           //
+//                    .'  \\|     |//  `.                         //
+//                   /  \\|||  :  |||//  \                        //
+//                  /  _||||| -:- |||||-  \                       //
+//                  |   | \\\  -  /// |   |                       //
+//                  | \_|  ''\---/''  |   |                       //
+//                  \  .-\__  `-`  ___/-. /                       //
+//                ___`. .'  /--.--\  `. . ___                     //
+//              ."" '<  `.___\_<|>_/___.'  >'"".                  //
+//            | | :  `- \`.;`\ _ /`;.`/ - ` : | |                 //
+//            \  \ `-.   \_ __\ /__ _/   .-` /  /                 //
+//      ========`-.____`-.___\_____/___.-`____.-'========         //
+//                           `=---='                              //
+//      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^        //
+//             佛祖保佑       永不宕机      永无BUG               //
+////////////////////////////////////////////////////////////////////

+ 37 - 0
vehicle-sdk/src/main/resources/i18n/messages.properties

@@ -0,0 +1,37 @@
+#错误消息
+not.null=* 必须填写
+user.jcaptcha.error=验证码错误
+user.jcaptcha.expire=验证码已失效
+user.not.exists=用户不存在/密码错误
+user.password.not.match=用户不存在/密码错误
+user.password.retry.limit.count=密码输入错误{0}次
+user.password.retry.limit.exceed=密码输入错误{0}次,帐户锁定{1}分钟
+user.password.delete=对不起,您的账号已被删除
+user.blocked=用户已封禁,请联系管理员
+role.blocked=角色已封禁,请联系管理员
+user.logout.success=退出成功
+
+length.not.valid=长度必须在{min}到{max}个字符之间
+
+user.username.not.valid=* 2到20个汉字、字母、数字或下划线组成,且必须以非数字开头
+user.password.not.valid=* 5-50个字符
+ 
+user.email.not.valid=邮箱格式错误
+user.mobile.phone.number.not.valid=手机号格式错误
+user.login.success=登录成功
+user.register.success=注册成功
+user.notfound=请重新登录
+user.forcelogout=管理员强制退出,请重新登录
+user.unknown.error=未知错误,请重新登录
+
+##文件上传消息
+upload.exceed.maxSize=上传的文件大小超出限制的文件大小!<br/>允许的文件最大大小是:{0}MB!
+upload.filename.exceed.length=上传的文件名最长{0}个字符
+
+##权限
+no.permission=您没有数据的权限,请联系管理员添加权限 [{0}]
+no.create.permission=您没有创建数据的权限,请联系管理员添加权限 [{0}]
+no.update.permission=您没有修改数据的权限,请联系管理员添加权限 [{0}]
+no.delete.permission=您没有删除数据的权限,请联系管理员添加权限 [{0}]
+no.export.permission=您没有导出数据的权限,请联系管理员添加权限 [{0}]
+no.view.permission=您没有查看数据的权限,请联系管理员添加权限 [{0}]

+ 94 - 0
vehicle-sdk/src/main/resources/logback.xml

@@ -0,0 +1,94 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<configuration>
+    <!-- 日志存放路径 -->
+	<property name="log.path" value="/home/base/logs" />
+<!--    <property name="log.path" value="/Users/sunhuanhuan/Documents/project/106/project/logs"/>-->
+    <!-- 日志输出格式 -->
+	<property name="log.pattern" value="%d{HH:mm:ss.SSS} [%thread] %-5level %logger{20} - [%method,%line] - %msg%n" />
+
+	<!-- 控制台输出 -->
+	<appender name="console" class="ch.qos.logback.core.ConsoleAppender">
+		<encoder>
+			<pattern>${log.pattern}</pattern>
+		</encoder>
+	</appender>
+
+	<!-- 系统日志输出 -->
+	<appender name="file_info" class="ch.qos.logback.core.rolling.RollingFileAppender">
+	    <file>${log.path}/sys-info.log</file>
+        <!-- 循环政策:基于时间创建日志文件 -->
+		<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
+            <!-- 日志文件名格式 -->
+			<fileNamePattern>${log.path}/sys-info.%d{yyyy-MM-dd}.log</fileNamePattern>
+			<!-- 日志最大的历史 60天 -->
+			<maxHistory>60</maxHistory>
+		</rollingPolicy>
+		<encoder>
+			<pattern>${log.pattern}</pattern>
+		</encoder>
+		<filter class="ch.qos.logback.classic.filter.LevelFilter">
+            <!-- 过滤的级别 -->
+            <level>INFO</level>
+            <!-- 匹配时的操作:接收(记录) -->
+            <onMatch>ACCEPT</onMatch>
+            <!-- 不匹配时的操作:拒绝(不记录) -->
+            <onMismatch>DENY</onMismatch>
+        </filter>
+	</appender>
+
+	<appender name="file_error" class="ch.qos.logback.core.rolling.RollingFileAppender">
+	    <file>${log.path}/sys-error.log</file>
+        <!-- 循环政策:基于时间创建日志文件 -->
+        <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
+            <!-- 日志文件名格式 -->
+            <fileNamePattern>${log.path}/sys-error.%d{yyyy-MM-dd}.log</fileNamePattern>
+			<!-- 日志最大的历史 60天 -->
+			<maxHistory>60</maxHistory>
+        </rollingPolicy>
+        <encoder>
+            <pattern>${log.pattern}</pattern>
+        </encoder>
+        <filter class="ch.qos.logback.classic.filter.LevelFilter">
+            <!-- 过滤的级别 -->
+            <level>ERROR</level>
+			<!-- 匹配时的操作:接收(记录) -->
+            <onMatch>ACCEPT</onMatch>
+			<!-- 不匹配时的操作:拒绝(不记录) -->
+            <onMismatch>DENY</onMismatch>
+        </filter>
+    </appender>
+
+	<!-- 用户访问日志输出  -->
+    <appender name="sys-user" class="ch.qos.logback.core.rolling.RollingFileAppender">
+		<file>${log.path}/sys-user.log</file>
+        <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
+            <!-- 按天回滚 daily -->
+            <fileNamePattern>${log.path}/sys-user.%d{yyyy-MM-dd}.log</fileNamePattern>
+            <!-- 日志最大的历史 60天 -->
+            <maxHistory>60</maxHistory>
+        </rollingPolicy>
+        <encoder>
+            <pattern>${log.pattern}</pattern>
+        </encoder>
+    </appender>
+
+	<!-- 系统模块日志级别控制  -->
+	<logger name="com.ozs" level="info" />
+	<!-- Spring日志级别控制  -->
+	<logger name="org.springframework" level="warn" />
+
+	<root level="info">
+		<appender-ref ref="console" />
+	</root>
+
+	<!--系统操作日志-->
+    <root level="info">
+        <appender-ref ref="file_info" />
+        <appender-ref ref="file_error" />
+    </root>
+
+	<!--系统用户操作日志-->
+    <logger name="sys-user" level="info">
+        <appender-ref ref="sys-user"/>
+    </logger>
+</configuration>

+ 27 - 0
vehicle-sdk/src/main/resources/mybatis/mybatis-config.xml

@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE configuration
+        PUBLIC "-//mybatis.org//DTD Config 3.0//EN"
+        "http://mybatis.org/dtd/mybatis-3-config.dtd">
+<configuration>
+    <!-- 全局参数 -->
+    <settings>
+        <!-- 使全局的映射器启用或禁用缓存 -->
+        <setting name="cacheEnabled"             value="true"   />
+        <!-- 允许JDBC 支持自动生成主键 -->
+        <setting name="useGeneratedKeys"         value="true"   />
+        <!-- 配置默认的执行器.SIMPLE就是普通执行器;REUSE执行器会重用预处理语句(prepared statements);BATCH执行器将重用语句并执行批量更新 -->
+        <setting name="defaultExecutorType"      value="SIMPLE" />
+        <!-- 指定 MyBatis 所用日志的具体实现 -->
+        <setting name="logImpl"                  value="SLF4J"  />
+        <!-- 使用驼峰命名法转换字段 -->
+        <!-- <setting name="mapUnderscoreToCamelCase" value="true"/> -->
+    </settings>
+
+    <plugins>
+        <!--        配置分页插件-->
+        <plugin interceptor="com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor">
+            <property name="@page" value="com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor"/>
+            <property name="page:dbType" value="MYSQL"/>
+        </plugin>
+    </plugins>
+</configuration>