From 0c7ba7f5569fb6eb7da463fe3d4a74838ef739a3 Mon Sep 17 00:00:00 2001
From: 13693261870 <252740454@qq.com>
Date: 星期四, 23 三月 2023 15:49:09 +0800
Subject: [PATCH] 1

---
 src/main/java/com/lf/server/controller/data/upload/CheckController.java |   52 +++++++++++++++++
 src/main/java/com/lf/server/helper/RestHelper.java                      |   10 +++
 src/main/java/com/lf/server/entity/ctrl/RegisterEntity.java             |   95 +++++++++++++++++++++++++++++++
 src/main/java/com/lf/server/service/data/FmeService.java                |   13 +---
 data/db_cx.sql                                                          |    3 +
 5 files changed, 164 insertions(+), 9 deletions(-)

diff --git a/data/db_cx.sql b/data/db_cx.sql
index e67cb4b..cad0694 100644
--- a/data/db_cx.sql
+++ b/data/db_cx.sql
@@ -37,6 +37,9 @@
 select * from lf.sys_publish
 select length('a31a2492-66f0-430a-875b-24eb6f4752c2')
 
+select * from lf.sys_dir where name='鍦扮伨鐐�'
+select * from lf.sys_dir where pid=0 and id>0 order by id
+
 
 
 
diff --git a/src/main/java/com/lf/server/controller/data/upload/CheckController.java b/src/main/java/com/lf/server/controller/data/upload/CheckController.java
index 2b39f23..bb1bd8b 100644
--- a/src/main/java/com/lf/server/controller/data/upload/CheckController.java
+++ b/src/main/java/com/lf/server/controller/data/upload/CheckController.java
@@ -439,4 +439,56 @@
             return fail(ex, null);
         }
     }*/
+
+    @SysLog()
+    @ApiOperation(value = "鏈嶅姟娉ㄥ唽")
+    @GetMapping(value = "/selectServerRegister")
+    public ResponseMsg<Object> selectServerRegister(HttpServletRequest req) {
+        try {
+            String rs = fmeService.serverRegister("瑗挎皵涓滆緭鍥涚嚎澶╃劧姘旂閬撳伐绋嬶紙鍚愰瞾鐣�-涓崼锛夛紙00116DT02锛�", "http://127.0.0.1/LFData/2d/tiles/01/{z}/{x}/{y}.png", "DOM", req);
+            if (StringHelper.isEmpty(rs)) {
+                return fail("澶辫触");
+            }
+
+            return success(rs);
+        } catch (Exception ex) {
+            return fail(ex, null);
+        }
+    }
+
+    @SysLog()
+    @ApiOperation(value = "鏈嶅姟鐢宠")
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "id", value = "鏈嶅姟ID", dataType = "String", paramType = "query", example = "195f77eb-19dd-4e34-afc1-fcff8f758f7b"),
+            @ApiImplicitParam(name = "pubid", value = "鍙戝竷ID", dataType = "Integer", paramType = "query", example = "1"),
+    })
+    @GetMapping(value = "/serverApply")
+    public ResponseMsg<Object> serverApply(String id, Integer pubid, HttpServletRequest req) {
+        try {
+            String rs = fmeService.serverApply(id, pubid, req);
+            if (StringHelper.isEmpty(rs)) {
+                return fail("澶辫触");
+            }
+
+            return success(rs);
+        } catch (Exception ex) {
+            return fail(ex, null);
+        }
+    }
+
+    @SysLog()
+    @ApiOperation(value = "鍒犻櫎璧勬簮")
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "id", value = "鏈嶅姟ID", dataType = "String", paramType = "query", example = "195f77eb-19dd-4e34-afc1-fcff8f758f7b")
+    })
+    @GetMapping(value = "/deleteRes")
+    public ResponseMsg<Object> deleteRes(String id, HttpServletRequest req) {
+        try {
+            fmeService.deleteRes(id, req);
+
+            return success("OK");
+        } catch (Exception ex) {
+            return fail(ex, null);
+        }
+    }
 }
diff --git a/src/main/java/com/lf/server/entity/ctrl/RegisterEntity.java b/src/main/java/com/lf/server/entity/ctrl/RegisterEntity.java
new file mode 100644
index 0000000..403aceb
--- /dev/null
+++ b/src/main/java/com/lf/server/entity/ctrl/RegisterEntity.java
@@ -0,0 +1,95 @@
+package com.lf.server.entity.ctrl;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * 娉ㄥ唽绫�
+ * @author WWW
+ */
+public class RegisterEntity {
+    public RegisterEntity() {
+    }
+
+    public RegisterEntity(String name, String uri, String type) {
+        tags = new ArrayList<>();
+        tags.add(name);
+
+        this.name = name;
+        this.address = uri;
+        this.detailUrl = uri;
+        this.type = type;
+        this.description = name;
+        this.isrequest = true;
+    }
+
+    private List<String> tags;
+
+    private String name;
+
+    private String address;
+
+    private String detailUrl;
+
+    private String type;
+
+    private String description;
+
+    private Boolean isrequest;
+
+    public List<String> getTags() {
+        return tags;
+    }
+
+    public void setTags(List<String> tags) {
+        this.tags = tags;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    public String getAddress() {
+        return address;
+    }
+
+    public void setAddress(String address) {
+        this.address = address;
+    }
+
+    public String getDetailUrl() {
+        return detailUrl;
+    }
+
+    public void setDetailUrl(String detailUrl) {
+        this.detailUrl = detailUrl;
+    }
+
+    public String getType() {
+        return type;
+    }
+
+    public void setType(String type) {
+        this.type = type;
+    }
+
+    public String getDescription() {
+        return description;
+    }
+
+    public void setDescription(String description) {
+        this.description = description;
+    }
+
+    public Boolean getIsrequest() {
+        return isrequest;
+    }
+
+    public void setIsrequest(Boolean isrequest) {
+        this.isrequest = isrequest;
+    }
+}
diff --git a/src/main/java/com/lf/server/helper/RestHelper.java b/src/main/java/com/lf/server/helper/RestHelper.java
index 654686e..d8e24d1 100644
--- a/src/main/java/com/lf/server/helper/RestHelper.java
+++ b/src/main/java/com/lf/server/helper/RestHelper.java
@@ -1,6 +1,7 @@
 package com.lf.server.helper;
 
 import com.lf.server.entity.all.StaticData;
+import io.swagger.models.HttpMethod;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.http.HttpEntity;
@@ -239,6 +240,15 @@
     }
 
     /**
+     * POST璇锋眰锛圧EST锛�
+     */
+    public static <T> String postForRest(String uri, T t) {
+        RestTemplate rest = getRestTemplate();
+
+        return rest.postForObject(uri, t, String.class);
+    }
+
+    /**
      * DELETE璇锋眰锛圧EST锛�
      */
     public static void deleteForRest(String uri) {
diff --git a/src/main/java/com/lf/server/service/data/FmeService.java b/src/main/java/com/lf/server/service/data/FmeService.java
index 1302924..c1f510d 100644
--- a/src/main/java/com/lf/server/service/data/FmeService.java
+++ b/src/main/java/com/lf/server/service/data/FmeService.java
@@ -2,6 +2,7 @@
 
 import com.lf.server.entity.ctrl.FmeReqEntity;
 import com.lf.server.entity.ctrl.NameValueEntity;
+import com.lf.server.entity.ctrl.RegisterEntity;
 import com.lf.server.entity.data.MetaFileEntity;
 import com.lf.server.entity.data.PublishEntity;
 import com.lf.server.helper.RestHelper;
@@ -9,6 +10,7 @@
 import com.lf.server.helper.WebHelper;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.stereotype.Service;
+import org.springframework.web.client.RestTemplate;
 
 import javax.servlet.http.HttpServletRequest;
 import java.util.ArrayList;
@@ -259,16 +261,9 @@
     public String serverRegister(String name, String serverUri, String type, HttpServletRequest req) {
         String url = getUrl("resource/res/item", req);
 
-        List<NameValueEntity> list = new ArrayList<>();
-        list.add(new NameValueEntity("tags", new String[]{name}));
-        list.add(new NameValueEntity("name", name));
-        list.add(new NameValueEntity("address", serverUri));
-        list.add(new NameValueEntity("detailUrl", serverUri));
-        list.add(new NameValueEntity("type", type));
-        list.add(new NameValueEntity("description", name));
-        list.add(new NameValueEntity("isrequest", true));
+        RegisterEntity entity = new RegisterEntity(name, serverUri, type);
 
-        return RestHelper.postForRest(url, list);
+        return RestHelper.postForRest(url, entity);
     }
 
     /**

--
Gitblit v1.9.3