Browse Source

异步上传matterpro数据接口

dengsixing 2 years ago
parent
commit
77fdb64e18

+ 6 - 8
src/main/java/com/fdkankan/scene/service/impl/InnerApiServiceImpl.java

@@ -101,14 +101,14 @@ public class InnerApiServiceImpl implements IInnerApiService {
         String key = String.format(RedisKey.SCENE_UPLOAD_MATTERPRO_NUM, sceneNum);
         redisUtil.set(key, result.toJSONString(), RedisKey.CAMERA_EXPIRE_7_TIME);
 
+        File data = new File(dataSource + file.getOriginalFilename());
+        if(!data.getParentFile().exists()){
+            data.getParentFile().mkdirs();
+        }
+        file.transferTo(data);
+
         CompletableFuture.runAsync(() -> {
             try {
-                File data = new File(dataSource + file.getOriginalFilename());
-                if(!data.getParentFile().exists()){
-                    data.getParentFile().mkdirs();
-                }
-                file.transferTo(data);
-
                 if(file.getOriginalFilename().toLowerCase().endsWith(".zip")){
                     CreateObjUtil.unZip(dataSource + file.getOriginalFilename(), dataSource);
                 }
@@ -219,8 +219,6 @@ public class InnerApiServiceImpl implements IInnerApiService {
                 result.put("status", SceneStatus.NO_DISPLAY.code());
                 redisUtil.set(key, result.toJSONString(), RedisKey.CAMERA_EXPIRE_7_TIME);
             }catch (Exception e){
-                log.error("上传matterpro数据出错:{}", sceneNum);
-                log.error("上传matterpro数据出错", e);
                 result.put("status", SceneStatus.FAILD.code());
                 redisUtil.set(key, result.toJSONString(), RedisKey.CAMERA_EXPIRE_7_TIME);
             }