Pu Zhibing
2024-12-27 b5ad78ef20d012da5efe3a087646dc65217547c7
guns-admin/src/main/java/com/stylefeng/guns/modular/system/util/imageModel/ImageModelUtil.java
@@ -9,6 +9,7 @@
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.stylefeng.guns.modular.system.model.enums.ImageModelEnum;
import com.stylefeng.guns.modular.system.util.UUIDUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
@@ -41,10 +42,11 @@
    */
   private static List<String> closedTopModel(String url){
      try {
         String fileName = url.substring(url.lastIndexOf("."));
         URLConnection urlConnection = new URL(url).openConnection();
         urlConnection.connect();
         InputStream inputStream = urlConnection.getInputStream();
         File file = FileUtil.writeFromStream(inputStream, filePath);
         File file = FileUtil.writeFromStream(inputStream, filePath + UUIDUtil.getTimeStr() + fileName);
         inputStream.close();
         return closedTopModel(file);
      } catch (MalformedURLException e) {
@@ -86,10 +88,11 @@
    */
   private static List<String> cameraFaultModel(String url){
      try {
         String fileName = url.substring(url.lastIndexOf("."));
         URLConnection urlConnection = new URL(url).openConnection();
         urlConnection.connect();
         InputStream inputStream = urlConnection.getInputStream();
         File file = FileUtil.writeFromStream(inputStream, filePath);
         File file = FileUtil.writeFromStream(inputStream, filePath + UUIDUtil.getTimeStr() + fileName);
         inputStream.close();
         return cameraFaultModel(file);
      } catch (MalformedURLException e) {
@@ -132,10 +135,11 @@
    */
   private static List<String> constructionWasteLoadModel(String url){
      try {
         String fileName = url.substring(url.lastIndexOf("."));
         URLConnection urlConnection = new URL(url).openConnection();
         urlConnection.connect();
         InputStream inputStream = urlConnection.getInputStream();
         File file = FileUtil.writeFromStream(inputStream, filePath);
         File file = FileUtil.writeFromStream(inputStream, filePath + UUIDUtil.getTimeStr() + fileName);
         inputStream.close();
         return constructionWasteLoadModel(file);
      } catch (MalformedURLException e) {
@@ -172,10 +176,11 @@
   
   /**
    * 1号模型四类标签分别是
    * Loaded Cargo - Unsealed装载-未关闭
    * Loaded Cargo - Unsealed  装载-未关闭
    * Empty Container - Sealed 空载-关闭
    * Empty Container - Unsealed空载-未关闭
    * Loaded Cargo - Sealed-装载-关闭
    * Empty Container - Unsealed  空载-未关闭
    * Loaded Cargo - Sealed  装载-关闭
    * ttt 未识别到货箱
    * 2号模型四类分别是:'blurred'(模糊), 'no_video'(无视频),'normalcy'(正常), 'splash_screen(花屏)'
    * @param url
    * @param modelEnum
@@ -186,7 +191,7 @@
         case TOP_SEAL:
            List<String> list1 = closedTopModel(url);
            //其中包含装载未关闭,视为异常
            return !list1.contains("Loaded Cargo - Unsealed");
            return !(list1.contains("Loaded Cargo - Unsealed") || list1.contains("ttt"));
         case CAMERA_FAULT:
            List<String> list2 = cameraFaultModel(url);
            //其中包含正常,视为正常