Explorar o código

修改someData值,
添加上传中删除、
swagger登录需要密码

wuweihao %!s(int64=5) %!d(string=hai) anos
pai
achega
74caec4c3e

+ 5 - 0
gis_application/src/main/resources/application-dev.properties

@@ -60,3 +60,8 @@ server.domain =http://www.4dmodel.com/
 oss.file.path=data/
 oss.domain=https://super.4dage.com/
 
+#swagger login
+#knife4j.basic.enable=true
+#knife4j.basic.username=owen
+#knife4j.basic.password=owen
+

+ 6 - 1
gis_application/src/main/resources/application-sit.properties

@@ -58,4 +58,9 @@ server.domain =http://www.4dmodel.com/
 
 # ÆßÅ£ oss info
 oss.file.path=data/
-oss.domain=https://super.4dage.com/
+oss.domain=https://super.4dage.com/
+
+#swagger login
+knife4j.basic.enable=true
+knife4j.basic.username=owen
+knife4j.basic.password=owen

+ 7 - 7
gis_application/src/main/resources/data/someData.json

@@ -74,16 +74,16 @@
     "mode": "0"
   },
   "loadlogo": false,
-  "special": "false",
-  "vision_version": "false",
-  "hotImageScale": "false",
-  "hideFloorMarker": "false",
-  "hideMouseMarker": "false",
+  "special": false,
+  "vision_version": "2",
+  "hotImageScale": false,
+  "hideFloorMarker": false,
+  "hideMouseMarker": false,
   "floorMarkerColor": "#4bcdfc",
   "mouseMarkerColor": "#4bcdfc",
   "momentTour": "walk",
-  "showHotListSta": "false",
+  "showHotListSta": false,
   "hotIconScale": "1",
-  "supportsVR": "false",
+  "supportsVR": false,
   "weixinDesc": ""
 }

+ 2 - 0
gis_common/src/main/java/com/gis/common/config/Swagger2.java

@@ -1,5 +1,6 @@
 package com.gis.common.config;
 
+import com.github.xiaoymin.knife4j.spring.annotations.EnableKnife4j;
 import com.google.common.collect.Lists;
 import org.springframework.context.annotation.Bean;
 import org.springframework.context.annotation.Configuration;
@@ -31,6 +32,7 @@ import java.util.List;
  */
 @Configuration
 @EnableSwagger2
+@EnableKnife4j
 public class Swagger2 {
     @Bean
     public Docket createRestApi() {

+ 6 - 0
gis_common/src/main/java/com/gis/common/util/QiniuOssUtil.java

@@ -87,6 +87,12 @@ public class QiniuOssUtil {
     }
 
 
+    @Test
+    public void testDelete(){
+        delete("");
+    }
+
+
     /**
      * 获取文件信息
      * @param key

+ 23 - 6
gis_web/src/main/java/com/gis/web/controller/SceneController.java

@@ -57,6 +57,12 @@ public class SceneController extends BaseController {
     }
 
 
+    /**
+     * 先获取场景码,再上传
+     * @param sceneCode
+     * @return
+     * @throws QiniuException
+     */
     @ApiOperation("创建场景码")
     @GetMapping("createSceneCode/{sceneCode}")
     public Result createSceneCode(@PathVariable String sceneCode) throws QiniuException {
@@ -65,8 +71,6 @@ public class SceneController extends BaseController {
             return Result.failure("场景码不能为空");
         }
 
-
-
         // 场景url
         String webSite = SERVER_DOMAIN + "SuperTwo/index.html?m=" + sceneCode;
         log.info("webSite: {}", webSite);
@@ -93,6 +97,7 @@ public class SceneController extends BaseController {
         SceneEntity entity = sceneService.findBySceneCode(sceneCode);
         if (entity == null) {
             entity = new SceneEntity();
+            // 场景码数据库设置唯一
             entity.setSceneCode(sceneCode);
             entity.setWebSite(webSite);
             entity.setPath(serverPath);
@@ -101,11 +106,25 @@ public class SceneController extends BaseController {
             sceneService.save(entity);
         }
 
-
-
         return Result.success(entity);
     }
 
+    @ApiOperation(value = "场景上传过程中删除",notes = "上传过程中取消时删除文件记录")
+    @GetMapping("delete/{id}")
+    public Result delete(@PathVariable Long id) {
+        SceneEntity entity = sceneService.findById(id);
+        if (entity == null) {
+            log.error("对象不存在 : {}", id);
+            Result.failure("对象不存在");
+        }
+        FileUtil.del(entity.getPath());
+
+        // 七牛的文件会覆盖安装,这里不做处理
+        sceneService.delete(entity);
+
+
+        return Result.success();
+    }
 
 
 
@@ -413,10 +432,8 @@ public class SceneController extends BaseController {
                             val = a;
                         }
 
-
                         subJson.put(s, val);
                     }
-
                 }
 
                 // 删除infoAttribute

+ 0 - 1
gis_web/src/main/resources/data/smokeing.json

@@ -1 +0,0 @@
-{"devid":"610617128","b_name":null,"pname":"YD100N烟感","lid":null,"l_name":null,"pid":"NP-FDY100-N","payload":null,"reported":{"Temperature":null,"rssi":null,"dirtyPercent":"0%","signalStrength":null,"signalSNR":20,"rsrp":-46,"batteryPower":"100%","smokeScope":"0%","signalECL":0},"time":"2020-07-19 16:51:26","bid":null,"a_name":"港湾1号港11栋"}