dengsixing il y a 11 mois
Parent
commit
a8421acfdc

+ 7 - 1
src/main/java/com/fdkankan/modeldemo/bean/ResultData.java

@@ -23,7 +23,7 @@ public class ResultData<T> implements Serializable {
     /**
      * 后端返回结果
      */
-    private T data;
+    private transient T data;
     /**
      * 请求是否成功
      */
@@ -59,4 +59,10 @@ public class ResultData<T> implements Serializable {
         return rd;
     }
 
+    public static void main(String[] args) {
+        String test =  "1111-1111-2222-33333";
+        System.out.println(test.replace("-", ""));
+        System.out.println(test.replaceAll("-", ""));
+    }
+
 }

+ 7 - 5
src/main/java/com/fdkankan/modeldemo/mq/ConvertListener.java

@@ -54,6 +54,8 @@ public class ConvertListener{
 
     public final static String baseZipPath = "/mnt/scene/convert/";
 
+    public final static String file_type_key = "fileType";
+
     @Autowired
     private ConvertUtil convertUtil;
     @Resource
@@ -155,7 +157,7 @@ public class ConvertListener{
             }
             if(StrUtil.isNotEmpty(upTimeStr)){
                 upTime = DateUtil.parse(upTimeStr, DatePattern.NORM_DATETIME_PATTERN);
-                upTimeKey = upTimeStr.replaceAll("-", "").replace(" ", "").replaceAll(":", "");
+                upTimeKey = upTimeStr.replace("-", "").replace(" ", "").replace(":", "");
             }
             fileList = jsonObject.getJSONArray("fileList");
             convertIngKey = String.format(Constant.REDIS_SCENE_CONVERT_ING, messageId);
@@ -203,17 +205,17 @@ public class ConvertListener{
                 //校验文件是否齐全
                 boolean exists512 = fileList.stream().anyMatch(v -> {
                     JSONObject obj = (JSONObject) v;
-                    return "1".equals(obj.getString("fileType"));
+                    return "1".equals(obj.getString(file_type_key));
                 });
 
                 boolean exists4k = fileList.stream().anyMatch(v -> {
                     JSONObject obj = (JSONObject) v;
-                    return "2".equals(obj.getString("fileType"));
+                    return "2".equals(obj.getString(file_type_key));
                 });
 
                 boolean exists8k = fileList.stream().anyMatch(v -> {
                     JSONObject obj = (JSONObject) v;
-                    return "3".equals(obj.getString("fileType"));
+                    return "3".equals(obj.getString(file_type_key));
                 });
 
 
@@ -230,7 +232,7 @@ public class ConvertListener{
                 fileList.stream().forEach(o->{
                     JSONObject obj = (JSONObject) o;
                     String fileName = obj.getString("fileName");
-                    String fileType = obj.getString("fileType");
+                    String fileType = obj.getString(file_type_key);
                     String fileUrl = obj.getString("fileUrl");
                     if("7".equals(fileType)){//vision.txt
                         HttpUtilExt.downloadFileAndCheck(fileUrl, imagePath + fileName, 300000);

+ 92 - 88
src/main/java/com/fdkankan/modeldemo/proto/BigSceneProto.java

@@ -4,6 +4,7 @@ public final class BigSceneProto {
   private BigSceneProto() {}
   public static void registerAllExtensions(
       com.google.protobuf.ExtensionRegistry registry) {
+    throw new UnsupportedOperationException();
   }
   public interface binary_meshOrBuilder extends
       // @@protoc_insertion_point(interface_extends:tutorial.binary_mesh)
@@ -25,8 +26,8 @@ public final class BigSceneProto {
     /**
      * <code>repeated .tutorial.chunk_simple chunk = 1;</code>
      */
-    java.util.List<? extends chunk_simpleOrBuilder>
-        getChunkOrBuilderList();
+//    java.util.List<? extends chunk_simpleOrBuilder>
+//        getChunkOrBuilderList();
     /**
      * <code>repeated .tutorial.chunk_simple chunk = 1;</code>
      */
@@ -49,8 +50,8 @@ public final class BigSceneProto {
     /**
      * <code>repeated .tutorial.chunk_quantized quantized_chunk = 2;</code>
      */
-    java.util.List<? extends chunk_quantizedOrBuilder>
-        getQuantizedChunkOrBuilderList();
+//    java.util.List<? extends chunk_quantizedOrBuilder>
+//        getQuantizedChunkOrBuilderList();
     /**
      * <code>repeated .tutorial.chunk_quantized quantized_chunk = 2;</code>
      */
@@ -102,13 +103,6 @@ public final class BigSceneProto {
             case 0:
               done = true;
               break;
-            default: {
-              if (!parseUnknownField(input, unknownFields,
-                                     extensionRegistry, tag)) {
-                done = true;
-              }
-              break;
-            }
             case 10: {
               if (!((mutable_bitField0_ & 0x00000001) == 0x00000001)) {
                 chunk_ = new java.util.ArrayList<chunk_simple>();
@@ -125,6 +119,13 @@ public final class BigSceneProto {
               quantizedChunk_.add(input.readMessage(chunk_quantized.PARSER, extensionRegistry));
               break;
             }
+            default: {
+              if (!parseUnknownField(input, unknownFields,
+                      extensionRegistry, tag)) {
+                done = true;
+              }
+              break;
+            }
           }
         }
       } catch (com.google.protobuf.InvalidProtocolBufferException e) {
@@ -414,9 +415,9 @@ public final class BigSceneProto {
         return this;
       }
 
-      public Builder clone() {
-        return create().mergeFrom(buildPartial());
-      }
+//      public Builder clone() {
+//        return create().mergeFrom(buildPartial());
+//      }
 
       public com.google.protobuf.Descriptors.Descriptor
           getDescriptorForType() {
@@ -1144,13 +1145,6 @@ public final class BigSceneProto {
             case 0:
               done = true;
               break;
-            default: {
-              if (!parseUnknownField(input, unknownFields,
-                                     extensionRegistry, tag)) {
-                done = true;
-              }
-              break;
-            }
             case 13: {
               if (!((mutable_bitField0_ & 0x00000001) == 0x00000001)) {
                 xyz_ = new java.util.ArrayList<Float>();
@@ -1193,6 +1187,13 @@ public final class BigSceneProto {
               input.popLimit(limit);
               break;
             }
+            default: {
+              if (!parseUnknownField(input, unknownFields,
+                      extensionRegistry, tag)) {
+                done = true;
+              }
+              break;
+            }
           }
         }
       } catch (com.google.protobuf.InvalidProtocolBufferException e) {
@@ -1498,9 +1499,9 @@ public final class BigSceneProto {
         return this;
       }
 
-      public Builder clone() {
-        return create().mergeFrom(buildPartial());
-      }
+//      public Builder clone() {
+//        return create().mergeFrom(buildPartial());
+//      }
 
       public com.google.protobuf.Descriptors.Descriptor
           getDescriptorForType() {
@@ -1871,13 +1872,6 @@ public final class BigSceneProto {
             case 0:
               done = true;
               break;
-            default: {
-              if (!parseUnknownField(input, unknownFields,
-                                     extensionRegistry, tag)) {
-                done = true;
-              }
-              break;
-            }
             case 8: {
               if (!((mutable_bitField0_ & 0x00000001) == 0x00000001)) {
                 faces_ = new java.util.ArrayList<Integer>();
@@ -1899,6 +1893,13 @@ public final class BigSceneProto {
               input.popLimit(limit);
               break;
             }
+            default: {
+              if (!parseUnknownField(input, unknownFields,
+                      extensionRegistry, tag)) {
+                done = true;
+              }
+              break;
+            }
           }
         }
       } catch (com.google.protobuf.InvalidProtocolBufferException e) {
@@ -2148,9 +2149,9 @@ public final class BigSceneProto {
         return this;
       }
 
-      public Builder clone() {
-        return create().mergeFrom(buildPartial());
-      }
+//      public Builder clone() {
+//        return create().mergeFrom(buildPartial());
+//      }
 
       public com.google.protobuf.Descriptors.Descriptor
           getDescriptorForType() {
@@ -2442,13 +2443,6 @@ public final class BigSceneProto {
             case 0:
               done = true;
               break;
-            default: {
-              if (!parseUnknownField(input, unknownFields,
-                                     extensionRegistry, tag)) {
-                done = true;
-              }
-              break;
-            }
             case 10: {
               vertices_simple.Builder subBuilder = null;
               if (((bitField0_ & 0x00000001) == 0x00000001)) {
@@ -2487,6 +2481,13 @@ public final class BigSceneProto {
               materialName_ = bs;
               break;
             }
+            default: {
+              if (!parseUnknownField(input, unknownFields,
+                      extensionRegistry, tag)) {
+                done = true;
+              }
+              break;
+            }
           }
         }
       } catch (com.google.protobuf.InvalidProtocolBufferException e) {
@@ -2852,9 +2853,9 @@ public final class BigSceneProto {
         return this;
       }
 
-      public Builder clone() {
-        return create().mergeFrom(buildPartial());
-      }
+//      public Builder clone() {
+//        return create().mergeFrom(buildPartial());
+//      }
 
       public com.google.protobuf.Descriptors.Descriptor
           getDescriptorForType() {
@@ -3469,13 +3470,6 @@ public final class BigSceneProto {
             case 0:
               done = true;
               break;
-            default: {
-              if (!parseUnknownField(input, unknownFields,
-                                     extensionRegistry, tag)) {
-                done = true;
-              }
-              break;
-            }
             case 13: {
               bitField0_ |= 0x00000001;
               quantization_ = input.readFloat();
@@ -3565,6 +3559,13 @@ public final class BigSceneProto {
               input.popLimit(limit);
               break;
             }
+            default: {
+              if (!parseUnknownField(input, unknownFields,
+                      extensionRegistry, tag)) {
+                done = true;
+              }
+              break;
+            }
           }
         }
       } catch (com.google.protobuf.InvalidProtocolBufferException e) {
@@ -3965,9 +3966,9 @@ public final class BigSceneProto {
         return this;
       }
 
-      public Builder clone() {
-        return create().mergeFrom(buildPartial());
-      }
+//      public Builder clone() {
+//        return create().mergeFrom(buildPartial());
+//      }
 
       public com.google.protobuf.Descriptors.Descriptor
           getDescriptorForType() {
@@ -4505,13 +4506,6 @@ public final class BigSceneProto {
             case 0:
               done = true;
               break;
-            default: {
-              if (!parseUnknownField(input, unknownFields,
-                                     extensionRegistry, tag)) {
-                done = true;
-              }
-              break;
-            }
             case 10: {
               com.google.protobuf.ByteString bs = input.readBytes();
               bitField0_ |= 0x00000001;
@@ -4565,6 +4559,13 @@ public final class BigSceneProto {
               input.popLimit(limit);
               break;
             }
+            default: {
+              if (!parseUnknownField(input, unknownFields,
+                      extensionRegistry, tag)) {
+                done = true;
+              }
+              break;
+            }
           }
         }
       } catch (com.google.protobuf.InvalidProtocolBufferException e) {
@@ -4926,9 +4927,9 @@ public final class BigSceneProto {
         return this;
       }
 
-      public Builder clone() {
-        return create().mergeFrom(buildPartial());
-      }
+//      public Builder clone() {
+//        return create().mergeFrom(buildPartial());
+//      }
 
       public com.google.protobuf.Descriptors.Descriptor
           getDescriptorForType() {
@@ -5369,13 +5370,6 @@ public final class BigSceneProto {
             case 0:
               done = true;
               break;
-            default: {
-              if (!parseUnknownField(input, unknownFields,
-                                     extensionRegistry, tag)) {
-                done = true;
-              }
-              break;
-            }
             case 8: {
               if (!((mutable_bitField0_ & 0x00000001) == 0x00000001)) {
                 faces_ = new java.util.ArrayList<Integer>();
@@ -5397,6 +5391,13 @@ public final class BigSceneProto {
               input.popLimit(limit);
               break;
             }
+            default: {
+              if (!parseUnknownField(input, unknownFields,
+                      extensionRegistry, tag)) {
+                done = true;
+              }
+              break;
+            }
           }
         }
       } catch (com.google.protobuf.InvalidProtocolBufferException e) {
@@ -5646,9 +5647,9 @@ public final class BigSceneProto {
         return this;
       }
 
-      public Builder clone() {
-        return create().mergeFrom(buildPartial());
-      }
+//      public Builder clone() {
+//        return create().mergeFrom(buildPartial());
+//      }
 
       public com.google.protobuf.Descriptors.Descriptor
           getDescriptorForType() {
@@ -5959,13 +5960,6 @@ public final class BigSceneProto {
             case 0:
               done = true;
               break;
-            default: {
-              if (!parseUnknownField(input, unknownFields,
-                                     extensionRegistry, tag)) {
-                done = true;
-              }
-              break;
-            }
             case 10: {
               com.google.protobuf.ByteString bs = input.readBytes();
               bitField0_ |= 0x00000001;
@@ -6012,6 +6006,13 @@ public final class BigSceneProto {
               bitField0_ |= 0x00000008;
               break;
             }
+            default: {
+              if (!parseUnknownField(input, unknownFields,
+                      extensionRegistry, tag)) {
+                done = true;
+              }
+              break;
+            }
           }
         }
       } catch (com.google.protobuf.InvalidProtocolBufferException e) {
@@ -6425,9 +6426,9 @@ public final class BigSceneProto {
         return this;
       }
 
-      public Builder clone() {
-        return create().mergeFrom(buildPartial());
-      }
+//      public Builder clone() {
+//        return create().mergeFrom(buildPartial());
+//      }
 
       public com.google.protobuf.Descriptors.Descriptor
           getDescriptorForType() {
@@ -7250,6 +7251,9 @@ public final class BigSceneProto {
   }
   private static com.google.protobuf.Descriptors.FileDescriptor
       descriptor;
+
+  private static String FACES_KEY = "Faces";
+
   static {
     String[] descriptorData = {
       "\n\016bigscene.proto\022\010tutorial\"h\n\013binary_mes" +
@@ -7303,13 +7307,13 @@ public final class BigSceneProto {
     internal_static_tutorial_faces_simple_fieldAccessorTable = new
       com.google.protobuf.GeneratedMessage.FieldAccessorTable(
         internal_static_tutorial_faces_simple_descriptor,
-        new String[] { "Faces", });
+        new String[] { FACES_KEY, });
     internal_static_tutorial_chunk_simple_descriptor =
       getDescriptor().getMessageTypes().get(3);
     internal_static_tutorial_chunk_simple_fieldAccessorTable = new
       com.google.protobuf.GeneratedMessage.FieldAccessorTable(
         internal_static_tutorial_chunk_simple_descriptor,
-        new String[] { "Vertices", "Faces", "ChunkName", "MaterialName", });
+        new String[] { "Vertices", FACES_KEY, "ChunkName", "MaterialName", });
     internal_static_tutorial_vertices_quantized_descriptor =
       getDescriptor().getMessageTypes().get(4);
     internal_static_tutorial_vertices_quantized_fieldAccessorTable = new
@@ -7327,13 +7331,13 @@ public final class BigSceneProto {
     internal_static_tutorial_faces_compressed_fieldAccessorTable = new
       com.google.protobuf.GeneratedMessage.FieldAccessorTable(
         internal_static_tutorial_faces_compressed_descriptor,
-        new String[] { "Faces", });
+        new String[] { FACES_KEY, });
     internal_static_tutorial_chunk_quantized_descriptor =
       getDescriptor().getMessageTypes().get(7);
     internal_static_tutorial_chunk_quantized_fieldAccessorTable = new
       com.google.protobuf.GeneratedMessage.FieldAccessorTable(
         internal_static_tutorial_chunk_quantized_descriptor,
-        new String[] { "ChunkName", "MaterialName", "Vertices", "Uvs", "Faces", });
+        new String[] { "ChunkName", "MaterialName", "Vertices", "Uvs", FACES_KEY, });
   }
 
   // @@protoc_insertion_point(outer_class_scope)

+ 53 - 52
src/main/java/com/fdkankan/modeldemo/proto/Visionmodeldata.java

@@ -7,6 +7,7 @@ public final class Visionmodeldata {
   private Visionmodeldata() {}
   public static void registerAllExtensions(
       com.google.protobuf.ExtensionRegistry registry) {
+    throw new UnsupportedOperationException();
   }
   public interface Affine3fOrBuilder extends
       // @@protoc_insertion_point(interface_extends:com.example.tutorial.Affine3f)
@@ -83,13 +84,6 @@ public final class Visionmodeldata {
             case 0:
               done = true;
               break;
-            default: {
-              if (!parseUnknownField(input, unknownFields,
-                                     extensionRegistry, tag)) {
-                done = true;
-              }
-              break;
-            }
             case 10: {
               Quaternionf.Builder subBuilder = null;
               if (((bitField0_ & 0x00000001) == 0x00000001)) {
@@ -116,6 +110,13 @@ public final class Visionmodeldata {
               bitField0_ |= 0x00000002;
               break;
             }
+            default: {
+              if (!parseUnknownField(input, unknownFields,
+                      extensionRegistry, tag)) {
+                done = true;
+              }
+              break;
+            }
           }
         }
       } catch (com.google.protobuf.InvalidProtocolBufferException e) {
@@ -372,9 +373,9 @@ public final class Visionmodeldata {
         return this;
       }
 
-      public Builder clone() {
-        return create().mergeFrom(buildPartial());
-      }
+//      public Builder clone() {
+//        return create().mergeFrom(buildPartial());
+//      }
 
       public com.google.protobuf.Descriptors.Descriptor
           getDescriptorForType() {
@@ -790,13 +791,6 @@ public final class Visionmodeldata {
             case 0:
               done = true;
               break;
-            default: {
-              if (!parseUnknownField(input, unknownFields,
-                                     extensionRegistry, tag)) {
-                done = true;
-              }
-              break;
-            }
             case 13: {
               bitField0_ |= 0x00000001;
               w_ = input.readFloat();
@@ -817,6 +811,13 @@ public final class Visionmodeldata {
               z_ = input.readFloat();
               break;
             }
+            default: {
+              if (!parseUnknownField(input, unknownFields,
+                      extensionRegistry, tag)) {
+                done = true;
+              }
+              break;
+            }
           }
         }
       } catch (com.google.protobuf.InvalidProtocolBufferException e) {
@@ -1101,9 +1102,9 @@ public final class Visionmodeldata {
         return this;
       }
 
-      public Builder clone() {
-        return create().mergeFrom(buildPartial());
-      }
+//      public Builder clone() {
+//        return create().mergeFrom(buildPartial());
+//      }
 
       public com.google.protobuf.Descriptors.Descriptor
           getDescriptorForType() {
@@ -1412,13 +1413,6 @@ public final class Visionmodeldata {
             case 0:
               done = true;
               break;
-            default: {
-              if (!parseUnknownField(input, unknownFields,
-                                     extensionRegistry, tag)) {
-                done = true;
-              }
-              break;
-            }
             case 13: {
               bitField0_ |= 0x00000001;
               x_ = input.readFloat();
@@ -1434,6 +1428,13 @@ public final class Visionmodeldata {
               z_ = input.readFloat();
               break;
             }
+            default: {
+              if (!parseUnknownField(input, unknownFields,
+                      extensionRegistry, tag)) {
+                done = true;
+              }
+              break;
+            }
           }
         }
       } catch (com.google.protobuf.InvalidProtocolBufferException e) {
@@ -1693,9 +1694,9 @@ public final class Visionmodeldata {
         return this;
       }
 
-      public Builder clone() {
-        return create().mergeFrom(buildPartial());
-      }
+//      public Builder clone() {
+//        return create().mergeFrom(buildPartial());
+//      }
 
       public com.google.protobuf.Descriptors.Descriptor
           getDescriptorForType() {
@@ -2094,13 +2095,6 @@ public final class Visionmodeldata {
             case 0:
               done = true;
               break;
-            default: {
-              if (!parseUnknownField(input, unknownFields,
-                                     extensionRegistry, tag)) {
-                done = true;
-              }
-              break;
-            }
             case 10: {
               bitField0_ |= 0x00000001;
               uuid_ = input.readBytes();
@@ -2205,6 +2199,13 @@ public final class Visionmodeldata {
               input.popLimit(limit);
               break;
             }
+            default: {
+              if (!parseUnknownField(input, unknownFields,
+                      extensionRegistry, tag)) {
+                done = true;
+              }
+              break;
+            }
           }
         }
       } catch (com.google.protobuf.InvalidProtocolBufferException e) {
@@ -2720,9 +2721,9 @@ public final class Visionmodeldata {
         return this;
       }
 
-      public Builder clone() {
-        return create().mergeFrom(buildPartial());
-      }
+//      public Builder clone() {
+//        return create().mergeFrom(buildPartial());
+//      }
 
       public com.google.protobuf.Descriptors.Descriptor
           getDescriptorForType() {
@@ -3584,8 +3585,8 @@ public final class Visionmodeldata {
     /**
      * <code>repeated .com.example.tutorial.SweepLocation sweepLocations = 1;</code>
      */
-    java.util.List<? extends SweepLocationOrBuilder>
-        getSweepLocationsOrBuilderList();
+//    java.util.List<? extends SweepLocationOrBuilder>
+//        getSweepLocationsOrBuilderList();
     /**
      * <code>repeated .com.example.tutorial.SweepLocation sweepLocations = 1;</code>
      */
@@ -3641,13 +3642,6 @@ public final class Visionmodeldata {
             case 0:
               done = true;
               break;
-            default: {
-              if (!parseUnknownField(input, unknownFields,
-                                     extensionRegistry, tag)) {
-                done = true;
-              }
-              break;
-            }
             case 10: {
               if (!((mutable_bitField0_ & 0x00000001) == 0x00000001)) {
                 sweepLocations_ = new java.util.ArrayList<SweepLocation>();
@@ -3656,6 +3650,13 @@ public final class Visionmodeldata {
               sweepLocations_.add(input.readMessage(SweepLocation.PARSER, extensionRegistry));
               break;
             }
+            default: {
+              if (!parseUnknownField(input, unknownFields,
+                      extensionRegistry, tag)) {
+                done = true;
+              }
+              break;
+            }
           }
         }
       } catch (com.google.protobuf.InvalidProtocolBufferException e) {
@@ -3896,9 +3897,9 @@ public final class Visionmodeldata {
         return this;
       }
 
-      public Builder clone() {
-        return create().mergeFrom(buildPartial());
-      }
+//      public Builder clone() {
+//        return create().mergeFrom(buildPartial());
+//      }
 
       public com.google.protobuf.Descriptors.Descriptor
           getDescriptorForType() {

+ 4 - 0
src/main/java/com/fdkankan/modeldemo/proto/format/JsonFormat.java

@@ -236,6 +236,8 @@ public class JsonFormat {
                 print((Message) value, generator);
                 generator.print("}");
                 break;
+            default:
+                break;
         }
     }
 
@@ -1088,6 +1090,8 @@ public class JsonFormat {
             case MESSAGE:
             case GROUP:
                 throw new RuntimeException("Can't get here.");
+            default:
+                break;
         }
         return value;
     }

+ 87 - 60
src/main/java/com/fdkankan/modeldemo/utils/ConvertUtil.java

@@ -33,6 +33,30 @@ import java.util.stream.Collectors;
 @Component
 public class ConvertUtil {
 
+    private static String RESULTS_DIR = "results";
+
+    private static String DATA_DIR = "data";
+
+    private static String WALLS = "walls";
+
+    private static String SUBGROUP = "subgroup";
+
+    private static String JSON_EXTNAME = ".json";
+
+    private static String IMAGES_4K = "images/4k/";
+
+    private static String IMAGES_512 = "images/512/";
+
+    private static String IMAGES_8K = "images/8k/";
+
+    private static String TITLE = "title";
+
+    private final static String SHOOTTIME = "shootTime";
+
+    private static String extinguisherJson = "extinguisher.json";
+
+
+
     @Autowired
     private SceneService sceneService;
 
@@ -98,7 +122,7 @@ public class ConvertUtil {
         //调用算法生成modeldata.txt
         String extrasPath = obj2TxtPath + File.separator + "extras";
         FileUtil.mkdir(extrasPath);
-        FileUtil.copyContent(new File(sourcePath + "data" + File.separator + "mesh"), new File(extrasPath), true);
+        FileUtil.copyContent(new File(sourcePath + DATA_DIR + File.separator + "mesh"), new File(extrasPath), true);
 
         //写data.json
         writeDataJson(obj2TxtPath);
@@ -107,7 +131,7 @@ public class ConvertUtil {
         build3dModel(obj2TxtPath);
 
         //校验算法是否正常结束
-        String uploadJsonPath = obj2TxtPath + File.separator + "results" +File.separator+"upload.json";
+        String uploadJsonPath = obj2TxtPath + File.separator + RESULTS_DIR +File.separator+"upload.json";
         boolean success = checkComputeCompleted(uploadJsonPath, 5, 300);
         if(!success){
             throw new RuntimeException("计算失败,obj2TxtPath:" + obj2TxtPath);
@@ -126,23 +150,23 @@ public class ConvertUtil {
             fileJson = array.getJSONObject(i);
             fileName = fileJson.getString("file");
             //文件不存在抛出异常
-            if (!new File(obj2TxtPath + File.separator + "results" + File.separator + fileName).exists()) {
-                throw new Exception(obj2TxtPath + File.separator + "results" + File.separator + fileName + "文件不存在");
+            if (!new File(obj2TxtPath + File.separator + RESULTS_DIR + File.separator + fileName).exists()) {
+                throw new Exception(obj2TxtPath + File.separator + RESULTS_DIR + File.separator + fileName + "文件不存在");
             }
 
             //tex文件夹
             if (fileJson.getIntValue("clazz") == 15) {
-//                    FileUtil.copy(obj2TxtPath + File.separator + "results" + File.separator + fileName,
+//                    FileUtil.copy(obj2TxtPath + File.separator + RESULTS_DIR + File.separator + fileName,
 //                            targetImagePath + File.separator + "tieta_texture/" + fileName.replace("tex/", ""),true);
-                map.put(imgViewPath +  "tieta_texture/" + fileName.replace("tex/", ""), obj2TxtPath + File.separator + "results" + File.separator + fileName);
+                map.put(imgViewPath +  "tieta_texture/" + fileName.replace("tex/", ""), obj2TxtPath + File.separator + RESULTS_DIR + File.separator + fileName);
 
             }
         }
 
         //压缩成dam
         String damKey = imgViewPath + "tieta.dam";
-        String damPath = obj2TxtPath + File.separator + "results" +File.separator + "dam.txt";
-        CreateObjUtil.convertTxtToDam( obj2TxtPath + File.separator + "results" +File.separator+"modeldata.txt", damPath);
+        String damPath = obj2TxtPath + File.separator + RESULTS_DIR +File.separator + "dam.txt";
+        CreateObjUtil.convertTxtToDam( obj2TxtPath + File.separator + RESULTS_DIR +File.separator+"modeldata.txt", damPath);
         map.put(damKey, damPath);
 
         //识别灭火器
@@ -151,17 +175,17 @@ public class ConvertUtil {
         //复制文件
         JSONObject standarFloor = null;
         Integer maxWallNum = 0;
-        if(FileUtil.exist(sourcePath + "data/floorplan.json")){
-            String floorplanJson = FileUtil.readUtf8String(sourcePath + "data/floorplan.json");
+        if(FileUtil.exist(sourcePath +  DATA_DIR + "/floorplan.json")){
+            String floorplanJson = FileUtil.readUtf8String(sourcePath + DATA_DIR + "/floorplan.json");
             JSONObject jsonObject = JSON.parseObject(floorplanJson);
             Integer currentId = jsonObject.getInteger("currentId");
             if(Objects.nonNull(currentId) && currentId == 0){
-                FileUtil.del(sourcePath + "data/" + "floorplan.json");
+                FileUtil.del(sourcePath + DATA_DIR + "/floorplan.json");
             }else{
                 JSONArray floors = jsonObject.getJSONArray("floors");
                 for (Object floor : floors) {
                     JSONObject floorObj = (JSONObject) floor;
-                    Map walls = floorObj.getObject("walls", Map.class);
+                    Map walls = floorObj.getObject(WALLS, Map.class);
                     if(walls.keySet().size() > maxWallNum){
                         maxWallNum = walls.keySet().size();
                         standarFloor = floorObj;
@@ -170,45 +194,45 @@ public class ConvertUtil {
                 //切割,按subgroup分成多份
                 for (Object floor : floors) {
                     JSONObject floorObj = (JSONObject) floor;
-                    Integer subgroup = floorObj.getIntValue("subgroup");
-                    floorObj.put("walls", standarFloor.getJSONObject("walls"));
+                    Integer subgroup = floorObj.getIntValue(SUBGROUP);
+                    floorObj.put(WALLS, standarFloor.getJSONObject(WALLS));
                     floorObj.put("points", standarFloor.getJSONObject("points"));
-                    floorObj.put("subgroup", 0);
+                    floorObj.put(SUBGROUP, 0);
                     floorObj.put("id", 0);
                     jsonObject.replace("floors", Arrays.asList(floorObj));
-                    String floorplanPath = sourcePath + "data/floorplan" + "-" + subgroup + ".json";
+                    String floorplanPath = sourcePath + DATA_DIR + "/floorplan" + "-" + subgroup + JSON_EXTNAME;
                     FileUtil.writeUtf8String(jsonObject.toJSONString(), floorplanPath);
                 }
             }
         }
 
-        List<File> dataFiles = FileUtil.loopFiles(sourcePath + "data/");
+        List<File> dataFiles = FileUtil.loopFiles(sourcePath +  DATA_DIR + "/");
         for (File dataFile : dataFiles) {
             if(dataFile.getAbsolutePath().contains("floorplan")){
                 continue;
             }
-            map.put(dataFile.getAbsolutePath().replace(sourcePath + "data/", dataViewPath) , dataFile.getAbsolutePath());
+            map.put(dataFile.getAbsolutePath().replace(sourcePath + DATA_DIR + "/", dataViewPath) , dataFile.getAbsolutePath());
         }
 
         String finalSourcePath = sourcePath;
-        if(FileUtil.exist(finalSourcePath + "images/4k/")){
-            FileUtil.listFileNames(sourcePath + "images/4k/").stream().forEach(v->{
-                map.put(imgViewPath + "pan/high/" + v.replaceAll("-", ""), finalSourcePath + "images/4k/" + v);
-//                    FileUtil.copy(finalSourcePath + "images/4k/" + v, targetImagePath + "/pan/high/" + v.replaceAll("-", ""), true);
+        if(FileUtil.exist(finalSourcePath + IMAGES_4K)){
+            FileUtil.listFileNames(sourcePath + IMAGES_4K).stream().forEach(v->{
+                map.put(imgViewPath + "pan/high/" + v.replaceAll("-", ""), finalSourcePath + IMAGES_4K + v);
+//                    FileUtil.copy(finalSourcePath + IMAGES_4K + v, targetImagePath + "/pan/high/" + v.replaceAll("-", ""), true);
             });
         }
 
-        if(FileUtil.exist(finalSourcePath + "images/512/")){
-            FileUtil.listFileNames(finalSourcePath + "images/512/").stream().forEach(v->{
-                map.put(imgViewPath + "pan/low/" + v.replaceAll("-", ""), finalSourcePath + "images/512/" + v);
-//                    FileUtil.copy(finalSourcePath + "images/512/" + v, targetImagePath + "/pan/low/" + v.replaceAll("-", ""), true);
+        if(FileUtil.exist(finalSourcePath + IMAGES_512)){
+            FileUtil.listFileNames(finalSourcePath + IMAGES_512).stream().forEach(v->{
+                map.put(imgViewPath + "pan/low/" + v.replaceAll("-", ""), finalSourcePath + IMAGES_512 + v);
+//                    FileUtil.copy(finalSourcePath + IMAGES_512 + v, targetImagePath + "/pan/low/" + v.replaceAll("-", ""), true);
             });
         }
 
-        if(FileUtil.exist(finalSourcePath + "images/8k/")) {
-            FileUtil.listFileNames(finalSourcePath + "images/8k/").stream().forEach(v -> {
-                map.put(imgViewPath + "pan/8k/" + v.replaceAll("-", ""), finalSourcePath + "images/8k/" + v);
-//                    FileUtil.copy(finalSourcePath + "images/8k/" + v, targetImagePath + "/pan/8k/" + v.replaceAll("-", ""), true);
+        if(FileUtil.exist(finalSourcePath + IMAGES_8K)) {
+            FileUtil.listFileNames(finalSourcePath + IMAGES_8K).stream().forEach(v -> {
+                map.put(imgViewPath + "pan/8k/" + v.replaceAll("-", ""), finalSourcePath + IMAGES_8K + v);
+//                    FileUtil.copy(finalSourcePath + IMAGES_8K + v, targetImagePath + "/pan/8k/" + v.replaceAll("-", ""), true);
             });
 
         }
@@ -225,13 +249,13 @@ public class ConvertUtil {
         Map<Integer, List<JSONObject>> subgroupMap = new HashMap<>();
         for (Object item : sweepLocationsArr) {
             JSONObject obj = (JSONObject) item;
-            int subgroup = obj.getIntValue("subgroup");
+            int subgroup = obj.getIntValue(SUBGROUP);
             List<JSONObject> jsonObjects = subgroupMap.get(subgroup);
             if(jsonObjects == null){
                 jsonObjects = new ArrayList<>();
                 subgroupMap.put(subgroup, jsonObjects);
             }
-            obj.put("subgroup", 0);
+            obj.put(SUBGROUP, 0);
             jsonObjects.add(obj);
 
             List<String> visible = visibleMap.get(subgroup);
@@ -273,14 +297,14 @@ public class ConvertUtil {
             map.put(imgViewPath + "vision.txt", visionTxtPath);
 
             //拆分floorplan.json
-            String floorplanPath = sourcePath + "data/floorplan" + "-" + subgroup + ".json";
+            String floorplanPath = sourcePath + DATA_DIR + "/floorplan" + "-" + subgroup + JSON_EXTNAME;
             if(FileUtil.exist(floorplanPath)){
                 map.put(dataViewPath + "floorplan.json", floorplanPath);
             }
 
             //生成scene.json
-            String sceneJsonPath = sourcePath + "data/scene" + "-" + subgroup + ".json";
-            SceneJsonBean sceneJsonBean = this.genSceneJson(num, sceneBashInfo.getString("title"), subgroup);
+            String sceneJsonPath = sourcePath + DATA_DIR + "/scene" + "-" + subgroup + JSON_EXTNAME;
+            SceneJsonBean sceneJsonBean = this.genSceneJson(num, sceneBashInfo.getString(TITLE), subgroup);
             FileUtil.writeUtf8String(JSON.toJSONString(sceneJsonBean), sceneJsonPath);
             map.put(dataViewPath + "scene.json", sceneJsonPath);
 
@@ -317,7 +341,7 @@ public class ConvertUtil {
 //            }
 
             Scene scene = new Scene();
-            scene.setTitle(sceneBashInfo.getString("title"));
+            scene.setTitle(sceneBashInfo.getString(TITLE));
             scene.setNum(num);
             scene.setFloorlogosize(100);
             scene.setScenekind("pano");
@@ -327,13 +351,13 @@ public class ConvertUtil {
             scene.setFloorplanangle(0);
             scene.setSubgroup(subgroup);
             scene.setStationcode(stationCode);
-            scene.setShootTime(sceneBashInfo.getDate("shootTime"));
+            scene.setShootTime(sceneBashInfo.getDate(SHOOTTIME));
             scene.setUpTime(upTime);
             scene.setAlgorithmTime(new Date());
             scene.setExtinguisher(extinguisher);
             scene.setUpTimeKey(upTimeKey);
             scene.setCacheKeyHasTime(1);
-            sceneService.saveOrUpdate(scene);
+            sceneService.save(scene);
 
             SceneEditInfo sceneEditInfo = new SceneEditInfo();
             sceneEditInfo.setScenePlusId(scene.getId());
@@ -375,14 +399,14 @@ public class ConvertUtil {
 
         //查询是否有热点
         String key = String.format(RedisKey.SCENE_HOT_DATA, RedisKey.getNumStr(num, subgroup, preScene.getUpTimeKey(), preScene.getCacheKeyHasTime()));
-        Map<String, String> allTagsMap = redisClient.hmget("scene", key);
+        Map<String, String> allTagsMap = redisClient.hmget(RedisClient.scene_sys_code, key);
         if(CollUtil.isEmpty(allTagsMap)){
             return;
         }
 
         //如果有热点,复制redis和涉及的图片
         String newKey = String.format(RedisKey.SCENE_HOT_DATA, RedisKey.getNumStr(num, subgroup, upTimeKey, scene.getCacheKeyHasTime()));
-        redisClient.hmset("scene", newKey, allTagsMap);
+        redisClient.hmset(RedisClient.scene_sys_code, newKey, allTagsMap);
 
         sceneEditInfo.setTags(1);
         sceneEditInfoService.updateById(sceneEditInfo);
@@ -421,11 +445,11 @@ public class ConvertUtil {
         //复制icon
         //查询缓存是否包含icons
         String iconKey = String.format(RedisKey.SCENE_HOT_ICONS, RedisKey.getNumStr(num, subgroup, preScene.getUpTimeKey() ,preScene.getCacheKeyHasTime()));
-        Set<String> icons = redisClient.sGet("scene", iconKey);
+        Set<String> icons = redisClient.sGet(RedisClient.scene_sys_code, iconKey);
         if(CollUtil.isNotEmpty(icons)){
 
             String newIconKey = String.format(RedisKey.SCENE_HOT_ICONS, RedisKey.getNumStr(num, subgroup, scene.getUpTimeKey() ,scene.getCacheKeyHasTime()));
-            redisClient.sSet("scene", newIconKey, icons);
+            redisClient.sSet(RedisClient.scene_sys_code, newIconKey, icons);
 
             List<String> iconFileList = icons.stream().map(i -> {
                 return String.format(Constant.USER_VIEW_PATH, num) + i;
@@ -451,7 +475,7 @@ public class ConvertUtil {
         Integer cacheKeyHasTime = scene.getCacheKeyHasTime();
 
         String hotDataKey = String.format(RedisKey.SCENE_HOT_DATA, RedisKey.getNumStr(sceneNum, subgroup,upTime,cacheKeyHasTime));
-        Map<String, String> hotMap = redisClient.hmget("scene", hotDataKey);
+        Map<String, String> hotMap = redisClient.hmget(RedisClient.scene_sys_code, hotDataKey);
 
         JSONArray tags = new JSONArray();
         if(CollUtil.isNotEmpty(hotMap)){
@@ -482,33 +506,36 @@ public class ConvertUtil {
             //灭火器标注识别
             String imagesPath = sourcePath + "images/";
             String annihilatorPath = imagesPath + "4k/";
-            String cmd =  "bash /home/ubuntu/bin/PotreeConverter.sh tieta_det " + annihilatorPath + " /home/ubuntu/bin/model/best.onnx " + imagesPath + "extinguisher.json";
+            String cmd =  "bash /home/ubuntu/bin/PotreeConverter.sh tieta_det " + annihilatorPath + " /home/ubuntu/bin/model/best.onnx " + imagesPath + extinguisherJson;
             log.info("---------start extinguisher, cmd:{}", cmd);
             CmdUtils.callLineSh(cmd);
             log.info("---------end extinguisher, cmd:{}", cmd);
-            if(FileUtil.exist(imagesPath + "extinguisher.json")){
-                map.put(imgViewPath + "extinguisher.json", imagesPath + "extinguisher.json");
+            if(FileUtil.exist(imagesPath + extinguisherJson)){
+                map.put(imgViewPath + extinguisherJson, imagesPath + extinguisherJson);
 
-                String extinguisherStr = FileUtil.readUtf8String(imagesPath + "extinguisher.json");
+                String extinguisherStr = FileUtil.readUtf8String(imagesPath + extinguisherJson);
                 JSONObject jsonObject = JSON.parseObject(extinguisherStr);
                 JSONArray imgBoxsList = jsonObject.getJSONArray("imgBoxsList");
                 boolean existExtinguisher = imgBoxsList.stream().anyMatch(box -> {
                     JSONObject boxObj = (JSONObject) box;
                     JSONArray shapes = boxObj.getJSONArray("shapes");
-                    return shapes.stream().anyMatch(shape -> {
-                        JSONObject shapeObj = (JSONObject) shape;
-                        if ("extinguisher".equals(shapeObj.getString("category"))) {
-                            return true;
-                        }
-                        return false;
-                    });
+                    if(CollUtil.isNotEmpty(shapes)){
+                        return shapes.stream().anyMatch(shape -> {
+                            JSONObject shapeObj = (JSONObject) shape;
+                            if ("extinguisher".equals(shapeObj.getString("category"))) {
+                                return true;
+                            }
+                            return false;
+                        });
+                    }
+                    return false;
                 });
                 if(existExtinguisher){
                     extinguisher = 1;
                 }
             }
         }catch (Exception e){
-            log.error("getExtinguisher fail, num{}", num, e);
+            log.error("getExtinguisher fail, num:{}", num, e);
         }
         return extinguisher;
     }
@@ -547,20 +574,20 @@ public class ConvertUtil {
 
     private JSONObject getSceneBashInfo(String roomId, String sourcePath){
         JSONObject info = new JSONObject();
-        String sceneJsonPath =  sourcePath + "data/scene.json";
+        String sceneJsonPath =  sourcePath + DATA_DIR + "/scene.json";
         if(!FileUtil.exist(sceneJsonPath)){
             return info;
         }
         String sceneJsonStr = FileUtil.readUtf8String(sceneJsonPath);
         JSONObject jsonObject = JSON.parseObject(sceneJsonStr);
-        String title = jsonObject.getString("title");
+        String title = jsonObject.getString(TITLE);
         if(StrUtil.isEmpty(title)){
             title = roomId;
         }
-        info.put("title", title);
-        String shootTimeStr = jsonObject.getString("shootTime");
+        info.put(TITLE, title);
+        String shootTimeStr = jsonObject.getString(SHOOTTIME);
         if(StrUtil.isNotEmpty(shootTimeStr)){
-            info.put("shootTime", DateUtil.parse(shootTimeStr, DatePattern.NORM_DATETIME_FORMAT));
+            info.put(SHOOTTIME, DateUtil.parse(shootTimeStr, DatePattern.NORM_DATETIME_FORMAT));
         }
 
         return info;

+ 10 - 6
src/main/java/com/fdkankan/modeldemo/utils/CreateObjUtil.java

@@ -15,6 +15,10 @@ import java.util.*;
 @Slf4j
 public class CreateObjUtil {
 
+	public final static String VISIBLES_2 = "visibles2";
+
+	public final static String VISIBLES_3 = "visibles3";
+
 
 	public static void main(String[] args) throws Exception {
 //		Scanner scanner = new Scanner(System.in);
@@ -181,8 +185,8 @@ public class CreateObjUtil {
 			}
 			sweepLocationObj.put("visibles", visiblesList);
 
-			if(sweepLocationObj.containsKey("visibles2")){
-				JSONArray visibles2 =  sweepLocationObj.getJSONArray("visibles2");
+			if(sweepLocationObj.containsKey(VISIBLES_2)){
+				JSONArray visibles2 =  sweepLocationObj.getJSONArray(VISIBLES_2);
 //				int[] visiblesArr2 = new int[visibles2.size()];
 				List<Integer> visibles2List = new ArrayList<>();
 				for(int i = 0; i < visibles2.size(); i++){
@@ -192,11 +196,11 @@ public class CreateObjUtil {
 					}
 					visibles2List.add(index);
 				}
-				sweepLocationObj.put("visibles2", visibles2List);
+				sweepLocationObj.put(VISIBLES_2, visibles2List);
 			}
 
-			if(sweepLocationObj.containsKey("visibles3")){
-				JSONArray visibles3 =  sweepLocationObj.getJSONArray("visibles3");
+			if(sweepLocationObj.containsKey(VISIBLES_3)){
+				JSONArray visibles3 =  sweepLocationObj.getJSONArray(VISIBLES_3);
 //				int[] visiblesArr3 = new int[visibles3.size()];
 				List<Integer> visibles3List = new ArrayList<>();
 				for(int i = 0; i < visibles3.size(); i++){
@@ -206,7 +210,7 @@ public class CreateObjUtil {
 					}
 					visibles3List.add(index);
 				}
-				sweepLocationObj.put("visibles3", visibles3List);
+				sweepLocationObj.put(VISIBLES_3, visibles3List);
 			}
 
 		}

+ 15 - 11
src/main/java/com/fdkankan/modeldemo/utils/CutImgUtil.java

@@ -21,6 +21,10 @@ public class CutImgUtil {
 
     public final static String panPath = "/mnt/cutImg/pan/";//虚化全景图路径
 
+    public final static String results = "results";
+
+    public final static String clazz = "clazz";
+
     public static void main(String[] args) {
 
         List<String> nums = FileUtil.readUtf8Lines(numsTxt);
@@ -88,7 +92,7 @@ public class CutImgUtil {
 
         build3dModel(target , "1");
 
-        String uploadJsonPath= target + File.separator + "results" +File.separator+"upload.json";
+        String uploadJsonPath= target + File.separator + results +File.separator+"upload.json";
         Thread.sleep(2000);
         String uploadData = FileUtil.readUtf8String(uploadJsonPath);
         JSONObject uploadJson = null;
@@ -107,35 +111,35 @@ public class CutImgUtil {
             fileJson = array.getJSONObject(i);
             fileName = fileJson.getString("file");
             //文件不存在抛出异常
-            if (!new File(target + File.separator + "results" + File.separator + fileName)
+            if (!new File(target + File.separator + results + File.separator + fileName)
                     .exists()) {
                 throw new Exception(
-                        target + File.separator + "results" + File.separator + fileName + "文件不存在");
+                        target + File.separator + results + File.separator + fileName + "文件不存在");
             }
 
             //high文件夹
-            if (fileJson.getIntValue("clazz") == 3) {
-                map.put(target + File.separator + "results" + File.separator + fileName,
+            if (fileJson.getIntValue(clazz) == 3) {
+                map.put(target + File.separator + results + File.separator + fileName,
                         imgViewPath + "pan/high/" + fileName.replace("high/", ""));
                 continue;
             }
             //low文件夹
-            if (fileJson.getIntValue("clazz") == 4) {
-                map.put(target + File.separator + "results" + File.separator + fileName,
+            if (fileJson.getIntValue(clazz) == 4) {
+                map.put(target + File.separator + results + File.separator + fileName,
                         imgViewPath + "pan/low/" + fileName.replace("low/", ""));
                 continue;
             }
 
             //tiles文件夹,亚马逊没有裁剪图片api,不需要上传4k图
-            if (fileJson.getIntValue("clazz") == 5) {
-                map.put(target + File.separator + "results" + File.separator + fileName,
+            if (fileJson.getIntValue(clazz) == 5) {
+                map.put(target + File.separator + results + File.separator + fileName,
                         imgViewPath + fileName);
                 continue;
             }
 
             //tiles文件夹,亚马逊瓦片图
-            if (fileJson.getIntValue("clazz") == 7) {
-                map.put(target + File.separator + "results" + File.separator + fileName,
+            if (fileJson.getIntValue(clazz) == 7) {
+                map.put(target + File.separator + results + File.separator + fileName,
                         imgViewPath + fileName);
                 continue;
             }

+ 20 - 12
src/main/java/com/fdkankan/modeldemo/utils/FdfsUtil.java

@@ -19,6 +19,14 @@ import java.util.Map;
 @Slf4j
 public class FdfsUtil {
 
+    private final static String TIMESTAMP_KEY = "timestamp";
+
+    private final static String NONCE_KEY = "nonce";
+
+    private final static String SYS_CODE_KEY = "sysCode";
+
+    private final static String FDFS_SUCCESS_CODE = "000000";
+
     @Value("${fdfs.address}")
     private String address;
 
@@ -33,16 +41,16 @@ public class FdfsUtil {
 
     public String getSignature(String nonce, String timestamp){
         Map<String, String> headers = new HashMap<>();
-        headers.put("timestamp", timestamp);
-        headers.put("nonce", nonce);
-        headers.put("sysCode", sysCode);
+        headers.put(TIMESTAMP_KEY, timestamp);
+        headers.put(NONCE_KEY, nonce);
+        headers.put(SYS_CODE_KEY, sysCode);
         HttpRequest httpRequest = HttpRequest.post(address.concat(api_getSignature)).addHeaders(headers).timeout(5000);
         HttpResponse res = httpRequest.execute();
         String resBody = res.body();
         res.close();
         TietaResBean<String> tietaResBean = JSON.parseObject(resBody, TietaResBean.class);
         String code = tietaResBean.getCode();
-        if(!"000000".equals(code)){
+        if(!FDFS_SUCCESS_CODE.equals(code)){
             throw new RuntimeException("获取签名失败, code:" + code);
         }
         return tietaResBean.getData();
@@ -51,9 +59,9 @@ public class FdfsUtil {
     public Map<String, String> uploadFile(String nonce, String timestamp, String signature, String filePath){
 
         Map<String, String> headers = new HashMap<>();
-        headers.put("timestamp", timestamp);
-        headers.put("nonce", nonce);
-        headers.put("sysCode", sysCode);
+        headers.put(TIMESTAMP_KEY, timestamp);
+        headers.put(NONCE_KEY, nonce);
+        headers.put(SYS_CODE_KEY, sysCode);
         headers.put("signature", signature);
 
         Map<String, Object> test = new HashMap<>();
@@ -67,7 +75,7 @@ public class FdfsUtil {
         res.close();
         TietaResBean<Map<String, String>> tietaResBean = JSON.parseObject(resBody, TietaResBean.class);
         String code = tietaResBean.getCode();
-        if(!"000000".equals(code)){
+        if(!FDFS_SUCCESS_CODE.equals(code)){
             throw new RuntimeException("上传文件失败, code:" + code);
         }
         return tietaResBean.getData();
@@ -96,9 +104,9 @@ public class FdfsUtil {
 
     public static void main(String[] args) {
         Map<String, String> headers = new HashMap<>();
-        headers.put("timestamp", "1719389524320");
-        headers.put("nonce", "123123");
-        headers.put("sysCode", "CT00017");
+        headers.put(TIMESTAMP_KEY, "1719389524320");
+        headers.put(NONCE_KEY, "123123");
+        headers.put(SYS_CODE_KEY, "CT00017");
         headers.put("signature", "3044022062501c9896a919d81d00216379a84c7d89b2d7315a22f89aee2ce7c1185f656c02206d4694fb685247a289e1c0d11e7492311ef66354c64cd2234fa593e02a635074");
 
         Map<String, Object> test = new HashMap<>();
@@ -111,7 +119,7 @@ public class FdfsUtil {
         res.close();
         TietaResBean<Map<String, String>> tietaResBean = JSON.parseObject(resBody, TietaResBean.class);
         String code = tietaResBean.getCode();
-        if(!"000000".equals(code)){
+        if(!FDFS_SUCCESS_CODE.equals(code)){
             throw new RuntimeException("上传文件失败, code:" + code);
         }
         Map<String, String> data = tietaResBean.getData();

+ 6 - 4
src/main/java/com/fdkankan/rabbitmq/util/RabbitMqProducer.java

@@ -26,6 +26,8 @@ import java.util.UUID;
 @Data
 public class RabbitMqProducer {
 
+    private static String info_format = "开始发送Mq消息,messageId:{},消息队列:{},消息内容:{}";
+
     private Logger log = LoggerFactory.getLogger(this.getClass().getName());
 
 //    @Autowired
@@ -41,7 +43,7 @@ public class RabbitMqProducer {
      */
     public void sendByWorkQueue(String queue, Object content){
         String messageId = UUID.randomUUID().toString();
-        log.info("开始发送Mq消息,messageId:{},消息队列:{},消息内容:{}",messageId, queue, new JSONObject(content).toString());
+        log.info(info_format, messageId, queue, new JSONObject(content).toString());
         rabbitTemplate.convertAndSend(queue, content, message -> {
             message.getMessageProperties().setMessageId(messageId);
             return message;
@@ -55,7 +57,7 @@ public class RabbitMqProducer {
      */
     public void sendByWorkQueue(String exchange,String queue, Object content){
         String messageId = UUID.randomUUID().toString();
-        log.info("开始发送Mq消息,messageId:{},消息队列:{},消息内容:{}",messageId, queue, new JSONObject(content).toString());
+        log.info(info_format, messageId, queue, new JSONObject(content).toString());
         rabbitTemplate.convertAndSend(exchange,queue, content, message -> {
             message.getMessageProperties().setMessageId(messageId);
             return message;
@@ -69,7 +71,7 @@ public class RabbitMqProducer {
      */
     public void sendByWorkQueue(String queue, Object content, Integer priority){
         String messageId = UUID.randomUUID().toString();
-        log.info("开始发送Mq消息,messageId:{},消息队列:{},消息内容:{}",messageId, queue, new JSONObject(content).toString());
+        log.info(info_format, messageId, queue, new JSONObject(content).toString());
         rabbitTemplate.convertAndSend(queue, content, message -> {
             message.getMessageProperties().setMessageId(messageId);
             message.getMessageProperties().setPriority(priority);
@@ -99,7 +101,7 @@ public class RabbitMqProducer {
     public void sendByWorkToQueues(Object content, String... queues){
         for (String queue : queues) {
             String messageId = UUID.randomUUID().toString();
-            log.info("开始发送Mq消息,messageId:{},消息队列:{},消息内容:{}",messageId, queue, new JSONObject(content).toString());
+            log.info(info_format, messageId, queue, new JSONObject(content).toString());
             rabbitTemplate.convertAndSend(queue, content, message -> {
                 message.getMessageProperties().setMessageId(messageId);
                 return message;

+ 8 - 4
src/main/java/com/fdkankan/redis/RedisClient.java

@@ -25,6 +25,10 @@ public class RedisClient {
 
     public final static String url_set_add = "/redis/set/add";
 
+    public final static String scene_sys_code = "scene";
+
+    public final static String result_status_key = "status";
+
 
     @Value("${redis.host}")
     private String host;
@@ -48,7 +52,7 @@ public class RedisClient {
              params.put("time", time);
          }
          JSONObject jsonObject = httpClient.postJson(url, params);
-         if(Objects.isNull(jsonObject) || !"0".equals(jsonObject.getString("status"))){
+         if(Objects.isNull(jsonObject) || !"0".equals(jsonObject.getString(result_status_key))){
              throw new RuntimeException("redis add string error");
          }
      }
@@ -58,7 +62,7 @@ public class RedisClient {
         Map<String, Object> params = new HashMap<>();
         params.put("key", this.genKey(key));
         JSONObject jsonObject = httpClient.postJson(url, params);
-        if(Objects.isNull(jsonObject) || !"0".equals(jsonObject.getString("status"))){
+        if(Objects.isNull(jsonObject) || !"0".equals(jsonObject.getString(result_status_key))){
             throw new RuntimeException("redis get string error");
         }
         return jsonObject.getString("data");
@@ -69,7 +73,7 @@ public class RedisClient {
         Map<String, Object> params = new HashMap<>();
         params.put("key", this.genKey(key));
         JSONObject jsonObject = httpClient.postJson(url, params);
-        if(Objects.isNull(jsonObject) || !"0".equals(jsonObject.getString("status"))){
+        if(Objects.isNull(jsonObject) || !"0".equals(jsonObject.getString(result_status_key))){
             throw new RuntimeException("redis del string error");
         }
         return jsonObject.getString("data");
@@ -113,7 +117,7 @@ public class RedisClient {
         params.put("key", this.genKey(serverName, key));
         params.put("values", values);
         JSONObject jsonObject = httpClient.postJson(url, params);
-//        if(Objects.isNull(jsonObject) || !"0".equals(jsonObject.getString("status"))){
+//        if(Objects.isNull(jsonObject) || !"0".equals(jsonObject.getString(result_status_key))){
 //            throw new RuntimeException("redis add set error");
 //        }
     }