管道基础大数据平台系统开发-【后端】-Server
1
13693261870
2023-03-23 0c7ba7f5569fb6eb7da463fe3d4a74838ef739a3
1
已添加1个文件
已修改4个文件
173 ■■■■■ 文件已修改
data/db_cx.sql 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/lf/server/controller/data/upload/CheckController.java 52 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/lf/server/entity/ctrl/RegisterEntity.java 95 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/lf/server/helper/RestHelper.java 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/lf/server/service/data/FmeService.java 13 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
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
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);
        }
    }
}
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;
    }
}
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请求(REST)
     */
    public static <T> String postForRest(String uri, T t) {
        RestTemplate rest = getRestTemplate();
        return rest.postForObject(uri, t, String.class);
    }
    /**
     * DELETE请求(REST)
     */
    public static void deleteForRest(String uri) {
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);
    }
    /**