Browse Source

1.修复 由于之前OSS中带有文件的原来的大小路径引起的报错

xuzip 2 months ago
parent
commit
21c137e3e2

+ 6 - 2
src/main/java/com/yeechart/dotMatrix/module/DotMatrix/controller/DotMatrixController.java

@@ -166,10 +166,14 @@ public class DotMatrixController {
                 bitmapDataVo =bitmapDataVoMap.get(typeCode);
 
         }else{
-        bitmapDataVo =  signageFileUtil.getLastBitmapDataVo(DEID, typeCode, isDefault);
+                bitmapDataVo =  signageFileUtil.getLastBitmapDataVo(DEID, typeCode, isDefault);
         }
 
-
+        if (bitmapDataVo == null) {
+            return ResponseEntity.status(HttpStatus.NOT_FOUND)
+                    .header("Content-Type", "text/plain; charset=UTF-8")
+                    .body("预览初始图时,设备相关图不存在,可能设备已被删除".getBytes());
+        }
 
 
         byte[] twoBytes = bitmapDataVo.getTwoData();

+ 3 - 3
src/main/java/com/yeechart/dotMatrix/signage/SignageFileUtil.java

@@ -298,19 +298,19 @@ public class SignageFileUtil {
          */
 
         fileName = fileName.replace(ROOT_FILE_TYPE_NAME,"");
-        fileName = fileName.replace("/","");
+        fileName = fileName.substring(fileName.lastIndexOf('/')+1);
 
         String typeCode = fileName.substring(0,fileName.length()-2);
 
         int fileNumber = Integer.parseInt(fileName.substring(fileName.length()-2));
-        if(fileNumber <=1){
+        if(fileNumber <=2){
             return 10000;
         }
         if( typeCode.startsWith("00") // 关机画面
                 ||  "01".equals(typeCode.substring(2,4)) //右屏相关
                 ||  "FF".equals(typeCode.substring(typeCode.length() - 4,typeCode.length() - 2))//倒数第二个为FF
         ){
-            if(fileNumber ==2 ){
+            if(fileNumber == 3 ){
                 return 10000;
             }
             return 8884;