Prechádzať zdrojové kódy

添加了 update resources json function

wuweihao 5 rokov pred
rodič
commit
c60a0ca4fb

+ 29 - 0
src/main/java/com/fd/Dto/VectorResourcesJsonDto.java

@@ -0,0 +1,29 @@
+package com.fd.Dto;
+
+import lombok.Data;
+
+import java.util.List;
+
+/**
+ * Created by Owen on 2019/10/30 0030 10:36
+ *
+ * vector data ResourcesJson 请求参数
+ */
+@Data
+public class VectorResourcesJsonDto {
+
+    private String id;
+
+    private String definitionDataset;
+
+    private String definitionStyleUrl;
+
+    private Integer registryCreditsFageId;
+
+    private String registryCreditsFageNotice;
+
+    private List<List<Integer>> referenceFramesMelown2015TileRange;
+
+    private List<Integer> referenceFramesMelown2015LodRange;
+
+}

+ 32 - 0
src/main/java/com/fd/controller/VtsBaseMapController.java

@@ -0,0 +1,32 @@
+package com.fd.controller;
+
+import com.fd.Dto.ResourcesJsonDto;
+import com.fd.server.JsonServer;
+import com.fd.util.ResponseResult;
+import io.swagger.annotations.ApiOperation;
+import lombok.extern.log4j.Log4j2;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+
+/**
+ * Created by Owen on 2019/11/12 0007 10:19
+ */
+@Log4j2
+@RestController
+@RequestMapping("api/vts/basemap")
+public class VtsBaseMapController {
+
+    @Autowired
+    private JsonServer jsonServer;
+
+
+    @ApiOperation("update resources.json")
+    @PostMapping("update/resources")
+    private ResponseResult updateResources(@RequestBody ResourcesJsonDto param){
+        log.info("run updateResources");
+        jsonServer.updateResourcesJson(param);
+        return new ResponseResult(200,"success");
+    }
+
+}

+ 0 - 426
src/main/java/com/fd/controller/VtsController.java

@@ -1,426 +0,0 @@
-//package com.fd.controller;
-//
-//import com.fd.Dto.FdageDto;
-//import com.fd.Dto.ResourcesJsonDto;
-//import com.fd.entity.ScheduleEntity;
-//import com.fd.repository.FileRepository;
-//import com.fd.repository.ScheduleRepository;
-//import com.fd.result.ResponseResult;
-//import com.fd.server.CmdServer;
-//import com.fd.server.FileServer;
-//import com.fd.server.JsonServer;
-//import io.swagger.annotations.ApiOperation;
-//import lombok.extern.log4j.Log4j2;
-//import org.springframework.beans.factory.annotation.Autowired;
-//import org.springframework.beans.factory.annotation.Value;
-//import org.springframework.web.bind.annotation.*;
-//
-///**
-// * Created by Owen on 2019/10/25 0025 12:22
-// */
-//@Log4j2
-//@RestController
-//@RequestMapping("api/vts")
-//public class VtsController {
-//
-//    @Value("${uploadFile.fdmodelPath}")
-//    private String fdmodelPath;
-//
-//    @Value("${uploadFile.vectorPath}")
-//    private String vectorPath;
-//
-//    @Autowired
-//    private FileServer fileServer;
-//
-//    @Autowired
-//    private FileRepository fileRepository;
-//
-//    @Autowired
-//    private JsonServer jsonServer;
-//
-//    @Autowired
-//    private CmdServer cmdServer;
-//
-//    @Autowired
-//    private ScheduleRepository scheduleRepository;
-//
-////    @Autowired
-////    private SlpkToVtsFielRepository slpkToVtsFielRepository;
-////
-////
-////    // 多线程共享变量
-////    // false 表示完成
-////    private static AtomicBoolean existsSlpk2vts = new AtomicBoolean(false);
-////
-////    private static AtomicBoolean existsVts = new AtomicBoolean(false);
-//
-//
-//    /**
-//     * 文件列表
-//     * Sort.by("createTime"),createTime属性名
-//     */
-////    @ApiOperation("file list")
-////    @PostMapping("list")
-////    private ResponseResult list(@RequestBody PageDto param){
-////        Page<FileEntity> page = fileRepository.findAll(PageRequest.of(param.getPageNum(), param.getPageSize(), Sort.by("createTime").descending()));
-////        return new ResponseResult(200,page);
-////    }
-//
-//    @ApiOperation(" delete fileId")
-//    @GetMapping("delete/{fileId}/")
-//    private ResponseResult delId(@PathVariable("fileId") Long fileId){
-//        fileRepository.deleteById(fileId);
-//        return new ResponseResult(200, "success");
-//    }
-//
-//
-//    /**
-//     * 文件上传 到3d model
-//     * 上传大文件
-//     *
-//     * 已经移动
-//     * @return
-//     */
-////    @ApiOperation("upload 3D model file")
-////    @PostMapping(value = "upload/fdModel", consumes = { "multipart/form-data" })
-////    private ResponseResult upload(@RequestParam("file") MultipartFile file){
-////        return fileServer.uploadBigFile(file, fdmodelPath);
-////    }
-//
-//    /**
-//     * 文件上传
-//     * 需要创建目录
-//     * 不支持大文件上传
-//     *
-//     * 已移动
-//     * @return
-//     */
-////    @ApiOperation("upload Vector file")
-////    @PostMapping(value = "upload/vector/{directoryName}/", consumes = { "multipart/form-data" })
-////    private ResponseResult uploadVector(@RequestParam("file") MultipartFile file, @PathVariable("directoryName") String directoryName){
-////        return fileServer.upload2(file, vectorPath+directoryName+"/");
-////    }
-//
-//
-//    /**
-//     * 可能运行1s -- 12h
-//     * 需要记录进度
-//     * 可能需要多前程运行
-//     *
-//     * 已移动
-//     */
-////    @ApiOperation("commandSlpk2vts")
-////    @GetMapping("/command/model/slpk/{fileId}/")
-////    private ResponseResult commandSlpk2vts(@PathVariable("fileId") Long fileId) {
-////        log.info("run commandSlpk2vts : {}", fileId);
-//////        String fileName = null;
-//////        try {
-//////            fileName = getFileName(fileId);
-//////        } catch (Exception e) {
-//////            return new ResponseResult(50002, ErrorCode.E50002);
-//////        }
-//////
-//////
-//////        String cmd = CommandMsg.MODEL_SLPK2VTS;
-//////        cmd = cmd.replaceAll("@fileName", fileName);
-//////        log.info("cmd: {}", cmd);
-////
-//////        Integer s = cmdServer.exeCmdSlpk2vts(cmd, fileId);
-//////        if (s ==1) {
-//////            log.info("cmd  run: {}", ErrorCode.E50005);
-//////            return new ResponseResult(50005, ErrorCode.E50005);
-//////        }
-//////        log.info("cmd  run : success");
-////
-////        Optional<FileEntity> entity = fileRepository.findById(fileId);
-////        if (!entity.isPresent()) {
-////            return new ResponseResult(50002, ErrorCode.E50002);
-////        }
-////
-////        FileEntity fileEntity = entity.get();
-////        String fileName = fileEntity.getFileName();
-////        fileName = fileName.substring(0, fileName.lastIndexOf("."));
-////
-////        String cmd = CommandMsg.MODEL_SLPK2VTS;
-////        cmd = cmd.replaceAll("@fileName", fileName);
-////        log.info("cmd: {}", cmd);
-////        if (existsSlpk2vts.compareAndSet(false, true)) {
-////            new Thread(new CmdSlpk2vtsThread(cmd, fileId, fileEntity)).start();
-////        }
-////
-////        return new ResponseResult(200, "success");
-////    }
-//
-//
-////    public class CmdSlpk2vtsThread implements Runnable{
-////
-////        private String cmd;
-////
-////        private Long fileId;
-////
-////        private FileEntity fileEntity;
-////
-////        public CmdSlpk2vtsThread(String cmd, Long fileId, FileEntity fileEntity) {
-////            this.cmd = cmd;
-////            this.fileId = fileId;
-////            this.fileEntity = fileEntity;
-////        }
-////
-////        @Override
-////        public void run() {
-////            log.info("run CmdSlpk2vtsThread");
-////            Integer s = cmdServer.exeCmdSlpk2vts(cmd, fileId);
-////            if (s == 1) {
-////                log.info("cmd  run: {}", ErrorCode.E50005);
-////            }
-////            log.info("cmd  run : success");
-////            fileEntity.setStatus(1); // 1:表示文件执行完成
-////            fileEntity.setUpdateTime(new Date());
-////            fileRepository.save(fileEntity);
-////
-////            // 保存新产生的文件到数据库
-////            String fileName = fileEntity.getFileName();
-////            fileName = fileName.substring(0, fileName.lastIndexOf("."));
-////            String fileUrl = cmd.substring(cmd.indexOf("--output") + 9, cmd.indexOf("--tilesetId") - 1);
-////            FileEntity resultFile = new FileEntity();
-////            SlpkToVtsFielEntity entity = slpkToVtsFielRepository.findByFileId(fileId);
-////            if (entity == null) {
-////                entity = new SlpkToVtsFielEntity();
-////            }
-////            entity.setFileId(fileId);
-////            entity.setFileName(fileName);
-////            entity.setFileUrl(fileUrl);
-////            entity.setCreateTime(new Date());
-////            entity.setUpdateTime(new Date());
-////            entity.setType("vts");
-////            slpkToVtsFielRepository.save(entity);
-////            // 表示执行完成,释放锁
-////            existsSlpk2vts.set(false);
-////
-////        }
-////    }
-//
-//
-//
-//
-//
-//
-////    /**
-////     * 可能运行1s -- 12h
-////     * 需要记录进度
-////     * 可能需要多前程运行
-////     */
-////    @ApiOperation("commandVts")
-////    @GetMapping("/command/model/vts/{fileId}/")
-////    private ResponseResult commandVts(@PathVariable("fileId") Long fileId) {
-////        log.info("run commandVts");
-//////        String fileName = null;
-//////        try {
-//////            fileName = getFileName(fileId);
-//////        } catch (Exception e) {
-//////            return new ResponseResult(50002, ErrorCode.E50002);
-//////        }
-//////
-//////        String cmd = CommandMsg.MODEL_VTS;
-//////        cmd = cmd.replaceAll("@fileName", fileName);
-//////        log.info("cmd: {}", cmd);
-//////
-////////        Integer s = cmdServer.exeCmdVts(cmd, fileId);
-////////        if (s ==1) {
-////////            log.info("cmd  run: {}", ErrorCode.E50005);
-////////            return new ResponseResult(50005, ErrorCode.E50005);
-////////        }
-//////        log.info("cmd  run : success");
-////
-////        Optional<FileEntity> entity = fileRepository.findById(fileId);
-////        if (!entity.isPresent()) {
-////            return new ResponseResult(50002, ErrorCode.E50002);
-////        }
-////
-////        FileEntity fileEntity = entity.get();
-////        String fileName = fileEntity.getFileName();
-////        fileName = fileName.substring(0, fileName.lastIndexOf("."));
-////
-////        String cmd = CommandMsg.MODEL_VTS;
-////        cmd = cmd.replaceAll("@fileName", fileName);
-////        log.info("cmd: {}", cmd);
-////
-////        if (existsVts.compareAndSet(false, true)) {
-////            new Thread(new CmdVtsThread(cmd, fileId, fileEntity)).start();
-////        }
-////
-////        return new ResponseResult(200, "success");
-////    }
-////
-////
-////    public class CmdVtsThread implements Runnable{
-////
-////        private String cmd;
-////
-////        private Long fileId;
-////
-////        private FileEntity fileEntity;
-////
-////        public CmdVtsThread(String cmd, Long fileId, FileEntity fileEntity) {
-////            this.cmd = cmd;
-////            this.fileId = fileId;
-////            this.fileEntity = fileEntity;
-////        }
-////
-////        @Override
-////        public void run() {
-////            log.info("run CmdVtsThread");
-////            Integer s = cmdServer.exeCmdVts(cmd, fileId);
-////            if (s == 1) {
-////                log.info("cmd  run: {}", ErrorCode.E50005);
-////            }
-////            log.info("cmd  run : success");
-////            fileEntity.setStatus(2); // 2:表示VTS命令执行完成
-////            fileEntity.setUpdateTime(new Date());
-////            fileRepository.save(fileEntity);
-////            // 表示执行完成,释放锁
-////            existsVts.set(false);
-////
-////        }
-////    }
-//
-//
-////    @ApiOperation("commandChangeUser")
-////    @GetMapping("/command/model/changeUser")
-////    private ResponseResult commandChangeUser() {
-////        log.info("run commandChangeUser");
-////
-////        Integer s = cmdServer.exeCmd(CommandMsg.MODEL_USER);
-////        if (s ==1) {
-////            log.info("cmd  run: {}", ErrorCode.E50005);
-////            return new ResponseResult(50005, ErrorCode.E50005);
-////        }
-////        log.info("cmd  run : success");
-////
-////        return new ResponseResult(200, "success");
-////    }
-//
-//
-////    @ApiOperation("commandOgr2ogr")
-////    @GetMapping("/command/vector/ogr2ogr/{fileId}/")
-////    private ResponseResult commandOgr2ogr(@PathVariable("fileId") Long fileId) {
-////        log.info("run commandOgr2ogr");
-////
-////        Optional<FileEntity> entity = fileRepository.findById(fileId);
-////        if (!entity.isPresent()) {
-////            return new ResponseResult(50002, ErrorCode.E50002);
-////        }
-////
-////        FileEntity fileEntity = entity.get();
-////        String fileUrl = fileEntity.getFileUrl();
-////        fileUrl = fileUrl.substring(0, fileUrl.lastIndexOf("."));
-////
-////        String cmd = CommandMsg.VECTOR_OGR2OGR;
-////        cmd = cmd.replaceAll("@fileName", fileUrl);
-////        log.info("cmd: {}", cmd);
-////
-////        Integer s = cmdServer.exeCmd(cmd, fileId);
-////        if (s == 1) {
-////            log.info("cmd  run: {}", ErrorCode.E50005);
-////            return new ResponseResult(50005, ErrorCode.E50005);
-////        }
-////        log.info("cmd  run : success");
-////
-////        // 文件名
-////        String fileName = fileEntity.getFileName();
-////
-////        // 把生成的文件信息写入数据库
-////        FileEntity geojson = new FileEntity();
-////        geojson.setFileName(fileName.replace(".shp",".geojson"));
-////        geojson.setFileUrl(fileUrl+".geojson");
-////        geojson.setCreateTime(new Date());
-////        geojson.setUpdateTime(new Date());
-////
-////        geojson = fileRepository.save(geojson);
-////
-////        return new ResponseResult(200, geojson);
-////    }
-//
-//
-////    @ApiOperation("commandTippecanoe ")
-////    @GetMapping("/command/vector/tippecanoe/{fileId}/")
-////    private ResponseResult commandTippecanoe(@PathVariable("fileId") Long fileId) {
-////        log.info("run commandTippecanoe");
-////
-////        Optional<FileEntity> entity = fileRepository.findById(fileId);
-////        if (!entity.isPresent()) {
-////            return new ResponseResult(50002, ErrorCode.E50002);
-////        }
-////
-////        FileEntity fileEntity = entity.get();
-////        String fileUrl = fileEntity.getFileUrl();
-////        fileUrl = fileUrl.substring(0, fileUrl.lastIndexOf("."));
-////
-////
-////        String cmd = CommandMsg.VECTOR_TIPPECANOE;
-////        cmd = cmd.replaceAll("@fileName", fileUrl);
-////        log.info("cmd: {}", cmd);
-////        Integer s = cmdServer.exeCmd(cmd, fileId);
-////        if (s ==1) {
-////            log.info("cmd  run: {}", ErrorCode.E50005);
-////            return new ResponseResult(50005, ErrorCode.E50005);
-////        }
-////        log.info("cmd  run : success");
-////
-////        return new ResponseResult(200, "success");
-////    }
-//    /**
-//     * ==================================== base map =================================================
-//     */
-//
-//    @ApiOperation("update resources.json")
-//    @PostMapping("update/resources")
-//    private ResponseResult updateResources(@RequestBody ResourcesJsonDto param){
-//        log.info("run updateResources");
-//        jsonServer.updateResourcesJson(param);
-//        return new ResponseResult(200,"success");
-//    }
-//
-//    @ApiOperation("update 4dage")
-//    @PostMapping("update/fdage")
-//    private ResponseResult updateFdage(@RequestBody FdageDto param){
-//        log.info("run updateFdage");
-//        jsonServer.updateFdage(param);
-//        return new ResponseResult(200,"success");
-//    }
-//
-//
-//    @ApiOperation("query progress bar; type:vts / slpk")
-//    @PostMapping("progress/{fileId}/{type}/")
-//    private ResponseResult queryProgress(@PathVariable("fileId") Long fileId, @PathVariable("type") String type){
-//        log.info("run queryProgress");
-//        log.info("fileId: {} , type: {}", fileId, type);
-//        ScheduleEntity results = scheduleRepository.findByFileIdAndType(fileId, type);
-//        return new ResponseResult(200, results);
-//    }
-//
-//
-////    private String getFileName(Long fileId) throws Exception {
-////        Optional<FileEntity> entity = fileRepository.findById(fileId);
-////        if (!entity.isPresent()) {
-////            throw new Exception("ErrorCode.E50002");
-////        }
-////
-////        FileEntity fileEntity = entity.get();
-////        String fileName = fileEntity.getFileName();
-////        fileName = fileName.substring(0, fileName.lastIndexOf("."));
-////        return fileName;
-////    }
-//
-//
-//    public static void main(String[] args) {
-//        String a = "slpk2vts --input /var/vts/input/@fileName.slpk --output /var/vts/store/resources/tilesets/@fileName --tilesetId @fileName --referenceFrame melown2015;" +
-//                "chmod 755 -R /var/vts/store/resources/tilesets/@fileName/";
-//
-//        String b = "1222.aa";
-//        System.out.println(b.substring(0, b.lastIndexOf(".")));
-//
-//        System.out.println(a.substring(a.indexOf("--output") + 9, a.indexOf("--tilesetId") - 1));
-//    }
-//
-//}

+ 11 - 8
src/main/java/com/fd/controller/VtsVectorController.java

@@ -2,7 +2,7 @@ package com.fd.controller;
 
 import com.fd.Dto.FdageDto;
 import com.fd.Dto.PageDto;
-import com.fd.Dto.ResourcesJsonDto;
+import com.fd.Dto.VectorResourcesJsonDto;
 import com.fd.constant.CommandMsg;
 import com.fd.constant.ErrorCode;
 import com.fd.constant.TypeCode;
@@ -30,7 +30,6 @@ import java.util.Optional;
 /**
  * Created by Owen on 2019/11/7 0007 10:19
  */
-@CrossOrigin(maxAge = 3600)
 @Log4j2
 @RestController
 @RequestMapping("api/vts/vector")
@@ -61,8 +60,6 @@ public class VtsVectorController {
     private GenerateFileRepository generateFileRepository;
 
 
-
-
     @ApiOperation("upload Vector file list")
     @PostMapping(value = "list")
     private ResponseResult list(@RequestBody PageDto param){
@@ -175,11 +172,17 @@ public class VtsVectorController {
     }
 
 
-    @ApiOperation("update resources.json")
+    /**
+     * 会增加一块数据
+     * @param param
+     * @return
+     */
+    @ApiOperation("update vector resources.json")
     @PostMapping("update/resources")
-    private ResponseResult updateResources(@RequestBody ResourcesJsonDto param){
-        log.info("run updateResources");
-        jsonServer.updateResourcesJson(param);
+    private ResponseResult updateVectorResources(@RequestBody VectorResourcesJsonDto param){
+        log.info("run updateVectorResources");
+        System.out.println(param.toString());
+        jsonServer.updateVectorResourcesJson(param);
         return new ResponseResult(200,"success");
     }
 

+ 4 - 0
src/main/java/com/fd/server/JsonServer.java

@@ -2,12 +2,16 @@ package com.fd.server;
 
 import com.fd.Dto.FdageDto;
 import com.fd.Dto.ResourcesJsonDto;
+import com.fd.Dto.VectorResourcesJsonDto;
 
 /**
  * Created by Owen on 2019/10/30 0030 17:16
  */
 public interface JsonServer {
 
+
+    void updateVectorResourcesJson(VectorResourcesJsonDto param);
+
     void updateResourcesJson(ResourcesJsonDto param);
 
     void updateFdage(FdageDto param);

+ 70 - 10
src/main/java/com/fd/server/impl/JsonServerImpl.java

@@ -5,6 +5,7 @@ import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.fd.Dto.FdageDto;
 import com.fd.Dto.ResourcesJsonDto;
+import com.fd.Dto.VectorResourcesJsonDto;
 import com.fd.server.JsonServer;
 import com.fd.util.FileUtils;
 import lombok.extern.log4j.Log4j2;
@@ -21,14 +22,6 @@ import java.io.IOException;
 public class JsonServerImpl implements JsonServer {
 
 
-//    private static String RESOURCESJSON_PATH = "json/resources.json";
-//
-//    private static String FDAGE_PATH = "json/4dage";
-
-//    private static String RESOURCESJSON_PATH = "/etc/vts/mapproxy/tianditu.d/resources.json";
-//
-//    private static String FDAGE_PATH = "/var/vts/store/map-config/4dage";
-
     @Value("${updateFile.resourcesJsonPath}")
     private String RESOURCESJSON_PATH;
 
@@ -36,6 +29,73 @@ public class JsonServerImpl implements JsonServer {
     private String FDAGE_PATH;
 
 
+    @Override
+    public void updateVectorResourcesJson(VectorResourcesJsonDto param) {
+        // 读取文件,获取结果集
+        String s = readJsonLinux(RESOURCESJSON_PATH);
+//        String s = readJson("json/resources.json");
+        // 转json数组
+        JSONArray originalArray  = JSON.parseArray(s);
+        // 获取最后一个数组
+        Object indexLast= originalArray.get(originalArray.size()-1);
+
+        // 将结果转json对象
+        JSONObject subelement = JSON.parseObject(indexLast.toString());
+
+
+        // registry
+        JSONObject fdageSubJson = new JSONObject();
+        fdageSubJson.put("id", param.getRegistryCreditsFageId());
+        fdageSubJson.put("notice", param.getRegistryCreditsFageNotice());
+
+        JSONObject fdageJson = new JSONObject();
+        fdageJson.put("4dage", fdageSubJson);
+
+        JSONObject creditsJson = new JSONObject();
+        creditsJson.put("credits", fdageJson);
+
+        // definition
+        JSONObject definitionSubJson = new JSONObject();
+        definitionSubJson.put("dataset", param.getDefinitionDataset());
+        definitionSubJson.put("demDataset", "dem");
+        definitionSubJson.put("geoidGrid", "egm96_15.gtx");
+        definitionSubJson.put("format", "geodataJson");
+        definitionSubJson.put("displaySize", 1024);
+        definitionSubJson.put("styleUrl", param.getDefinitionStyleUrl());
+
+        // referenceFrames
+        JSONObject tileRangeJson = new JSONObject();
+        tileRangeJson.put("tileRange",param.getReferenceFramesMelown2015TileRange());
+        tileRangeJson.put("lodRange",param.getReferenceFramesMelown2015LodRange());
+
+        JSONObject melown2015Json = new JSONObject();
+        melown2015Json.put("melown2015", tileRangeJson);
+
+
+        // 更新值
+        subelement.put("id", param.getId());
+        subelement.put("definition", definitionSubJson);
+        subelement.put("registry", creditsJson);
+        subelement.put("referenceFrames", melown2015Json);
+
+        // 将新加的数据,添加到最后
+        originalArray.add(subelement);
+        log.info("update result:{}", originalArray.get(originalArray.size()-1));
+
+        System.out.println(originalArray.get(originalArray.size()-1));
+
+        log.info("result: {}", originalArray.toJSONString());
+
+        try {
+//            FileUtils.fileWriter(JSON.toJSONString(originalArray),"/var/vts/store/map-config/resources_test.json");
+            FileUtils.fileWriter(JSON.toJSONString(originalArray), RESOURCESJSON_PATH);
+        } catch (IOException e) {
+            e.printStackTrace();
+        }
+
+    }
+
+
 
     @Override
     public void updateResourcesJson(ResourcesJsonDto param) {
@@ -73,7 +133,7 @@ public class JsonServerImpl implements JsonServer {
         originalArray.add(0, subelement);
         log.info("update result:{}", originalArray.get(0) );
 
-        System.out.println(originalArray.get(0));
+//        System.out.println(originalArray.get(0));
 
         log.info("result: {}", originalArray.toJSONString());
 
@@ -119,7 +179,7 @@ public class JsonServerImpl implements JsonServer {
 
         log.info("result: {}", original.toJSONString());
 
-        System.out.println("========== :  " +original.toJSONString());
+//        System.out.println("========== :  " +original.toJSONString());
 
         try {
 //            FileUtils.fileWriter(JSON.toJSONString(original),"/var/vts/store/map-config/4dage_test");

+ 1 - 1
src/main/java/com/fd/util/FileUtils.java

@@ -39,7 +39,7 @@ public class FileUtils {
         File dir = new File(destDirName);
         // 创建目录
         if (!dir.exists()) {
-            dir.mkdir();
+            dir.mkdirs();
         }
     }
 

+ 40 - 0
src/main/resources/json/4dage

@@ -0,0 +1,40 @@
+{
+        "storage": "/var/vts/store/stage.melown2015",
+        "tilesets": [
+                "4dagecity",
+                "tiandi"
+        ],
+        "credits": { },
+        "boundLayers": {
+                "tiandi-map": "/mapproxy/melown2015/tms/tianditu/tianditms/boundlayer.json"
+        },
+        "freeLayers": {
+                "tiandi-surface": "/mapproxy/melown2015/surface/tianditu/tiandisurface/freelayer.json",
+                "road-vector": "/mapproxy/melown2015/geodata/tianditu/road-vec/freelayer.json",
+                "touristattractions-vec": "/mapproxy/melown2015/geodata/tianditu/touristattractions-vec/freelayer.json",
+                "busline-vector": "/mapproxy/melown2015/geodata/tianditu/busline-vec/freelayer.json",
+                "buspoints-vector": "/mapproxy/melown2015/geodata/tianditu/buspoints-vec/freelayer.json",
+                "channelbasicsinfo-vector": "/mapproxy/melown2015/geodata/tianditu/channelbasicsinfo-vec/freelayer.json",
+                "greenarea-vector": "/mapproxy/melown2015/geodata/tianditu/greenarea-vec/freelayer.json",
+                "maintouristattractions-vector": "/mapproxy/melown2015/geodata/tianditu/maintouristattractions-vec/freelayer.json",
+                "poi-vector": "/mapproxy/melown2015/geodata/tianditu/poi-vec/freelayer.json",
+                "railway-vector": "/mapproxy/melown2015/geodata/tianditu/railway-vec/freelayer.json",
+                "starhotel-vector": "/mapproxy/melown2015/geodata/tianditu/starhotel-vec/freelayer.json",
+                "trafficlights-vector": "/mapproxy/melown2015/geodata/tianditu/trafficlights-vec/freelayer.json",
+                "trafficdetection-vector": "/mapproxy/melown2015/geodata/tianditu/trafficdetection-vec/freelayer.json",
+                "surveillance-vector": "/mapproxy/melown2015/geodata/tianditu/surveillance-vec/freelayer.json"
+
+        },
+        "view": {
+                "description": "",
+                "surfaces": {
+                        "4dagecity": []
+                },
+                "freeLayers": {
+                        "tiandi-surface": { "boundLayers": ["tiandi-map"] }
+                }
+        },
+        "namedViews": {},
+        "position": ["obj",113.078029,22.599334,"fix",-4.99,130.98,-20.39,0.00,876.50,45.00],
+        "version": 1
+}

+ 7 - 0
src/main/resources/json/data.json

@@ -0,0 +1,7 @@
+[
+  {"id":0,"region":"东北楼1","storey":3,"status":1,"count":0},
+  {"id":1,"region":"东北楼2","storey":3,"status":1,"count":1},
+  {"id":2,"region":"东北楼3","storey":3,"status":1,"count":2},
+  {"id":3,"region":"东北楼4","storey":3,"status":1,"count":3},
+  {"id":4,"region":"东北楼5","storey":3,"status":1,"count":4}
+]

+ 441 - 0
src/main/resources/json/resources.json

@@ -0,0 +1,441 @@
+[
+{
+  "comment": "Tianditu Boundlayer",
+  "group": "tianditu",
+  "id": "tianditms",
+  "type": "tms",
+  "driver": "tms-raster-remote",
+  "credits": ["tianditu"],
+  "definition": {
+      "remoteUrl": "http://t1.tianditu.com/DataServer?T=img_w&X={locx}&Y={locy}&L={loclod}&tk=4bbbafdfeca49cb6fb5efb1a40164445"
+  },
+  "registry": {
+      "credits" : {"tianditu":{ "id": 8888, "notice": "{copy}{Y} TianDiTu" }}
+  },
+  "referenceFrames":
+      {
+          "melown2015": {
+              "tileRange": [[ 0, 0 ], [ 1, 1 ]],
+              "lodRange": [0, 17]
+          }
+      }
+},
+{
+        "comment": "spheroid",
+        "group": "tianditu",
+        "id": "tiandisurface",
+        "type": "surface",
+        "driver": "surface-spheroid",
+        "referenceFrames": {
+            "melown2015" : {
+                "lodRange": [0, 19],
+                "tileRange": [ [ 0, 0], [1, 1]]
+            }
+        },
+        "credits": [],
+        "definition": {
+            "introspection": {
+                "tms": [{ "group": "tianditu", "id": "tianditms" }]
+            }
+        }
+},
+{
+  "comment": "DEM",
+  "group": "tianditu",
+  "id": "dem",
+  "type": "surface",
+  "driver": "surface-dem",
+  "credits": [],
+  "definition": {
+      "dataset": "dem",
+      "geoidGrid": "egm96_15.gtx"
+  },
+  "referenceFrames": {
+      "melown2015": {
+          "tileRange": [
+              [ 51, 27 ],
+              [ 52, 28 ]
+          ],
+          "lodRange": [ 7, 17 ]
+      }
+  }
+},
+{
+   "comment": "Road MBtiles",
+   "group": "tianditu",
+   "id": "road-vec",
+   "type": "geodata",
+   "driver": "geodata-vector-tiled",
+   "credits": ["4dage"],
+   "definition": {
+       "dataset": "road/road.mbtiles/{loclod}-{locx}-{locy}"
+       , "demDataset": "dem"
+       , "geoidGrid": "egm96_15.gtx"
+       , "format": "geodataJson"
+       , "displaySize": 1024
+       , "styleUrl": "file:road/style.style"
+   },
+   "registry": {
+       "credits" : {"4dage":{ "id": 104, "notice": "{copy}{Y} 4DAGE" }}
+   },
+   "referenceFrames":
+       {
+           "melown2015": {
+               "tileRange": [
+                   [26675, 14270],
+                   [26678, 14273]
+               ],
+               "lodRange": [16, 17]
+           }
+       }
+},
+{
+   "comment": "ATouristAttractions MBtiles",
+   "group": "tianditu",
+   "id": "touristattractions-vec",
+   "type": "geodata",
+   "driver": "geodata-vector-tiled",
+   "credits": ["4dage"],
+   "definition": {
+       "dataset": "aTouristAttractionsInfo/ATouristAttractionsInfo.mbtiles/{loclod}-{locx}-{locy}"
+       , "demDataset": "dem"
+       , "geoidGrid": "egm96_15.gtx"
+       , "format": "geodataJson"
+       , "displaySize": 1024
+       , "styleUrl": "file:aTouristAttractionsInfo/style.style"
+   },
+   "registry": {
+       "credits" : {"4dage":{ "id": 104, "notice": "" }}
+   },
+   "referenceFrames":
+       {
+           "melown2015": {
+               "tileRange": [
+                   [26675, 14270],
+                   [26678, 14273]
+               ],
+               "lodRange": [16, 17]
+           }
+       }
+},
+{
+   "comment": "Busline MBtiles",
+   "group": "tianditu",
+   "id": "busline-vec",
+   "type": "geodata",
+   "driver": "geodata-vector-tiled",
+   "credits": ["4dage"],
+   "definition": {
+       "dataset": "BusLine/busline.mbtiles/{loclod}-{locx}-{locy}"
+       , "demDataset": "dem"
+       , "geoidGrid": "egm96_15.gtx"
+       , "format": "geodataJson"
+       , "displaySize": 1024
+       , "styleUrl": "file:BusLine/style.style"
+   },
+   "registry": {
+       "credits" : {"4dage":{ "id": 104, "notice": "" }}
+   },
+   "referenceFrames":
+       {
+           "melown2015": {
+               "tileRange": [
+                   [26675, 14270],
+                   [26678, 14273]
+               ],
+               "lodRange": [16, 17]
+           }
+       }
+},
+{
+   "comment": "Buspoints MBtiles",
+   "group": "tianditu",
+   "id": "buspoints-vec",
+   "type": "geodata",
+   "driver": "geodata-vector-tiled",
+   "credits": ["4dage"],
+   "definition": {
+       "dataset": "BusPoints/buspoints.mbtiles/{loclod}-{locx}-{locy}"
+       , "demDataset": "dem"
+       , "geoidGrid": "egm96_15.gtx"
+       , "format": "geodataJson"
+       , "displaySize": 1024
+       , "styleUrl": "file:BusPoints/style.style"
+   },
+   "registry": {
+       "credits" : {"4dage":{ "id": 104, "notice": "" }}
+   },
+   "referenceFrames":
+       {
+           "melown2015": {
+               "tileRange": [
+                   [26675, 14270],
+                   [26678, 14273]
+               ],
+               "lodRange": [16, 17]
+           }
+       }
+},
+{
+   "comment": "ChannelBasicsInfo MBtiles",
+   "group": "tianditu",
+   "id": "channelbasicsinfo-vec",
+   "type": "geodata",
+   "driver": "geodata-vector-tiled",
+   "credits": ["4dage"],
+   "definition": {
+       "dataset": "channelBasicsInfo/channelbasicsinfo.mbtiles/{loclod}-{locx}-{locy}"
+       , "demDataset": "dem"
+       , "geoidGrid": "egm96_15.gtx"
+       , "format": "geodataJson"
+       , "displaySize": 1024
+       , "styleUrl": "file:channelBasicsInfo/style.style"
+   },
+   "registry": {
+       "credits" : {"4dage":{ "id": 104, "notice": "" }}
+   },
+   "referenceFrames":
+       {
+           "melown2015": {
+               "tileRange": [
+                   [26675, 14270],
+                   [26678, 14273]
+               ],
+               "lodRange": [16, 17]
+           }
+       }
+},
+{
+   "comment": "GreenArea MBtiles",
+   "group": "tianditu",
+   "id": "greenarea-vec",
+   "type": "geodata",
+   "driver": "geodata-vector-tiled",
+   "credits": ["4dage"],
+   "definition": {
+       "dataset": "greenArea/greenarea.mbtiles/{loclod}-{locx}-{locy}"
+       , "demDataset": "dem"
+       , "geoidGrid": "egm96_15.gtx"
+       , "format": "geodataJson"
+       , "displaySize": 1024
+       , "styleUrl": "file:greenArea/style.style"
+   },
+   "registry": {
+       "credits" : {"4dage":{ "id": 104, "notice": "" }}
+   },
+   "referenceFrames":
+       {
+           "melown2015": {
+               "tileRange": [
+                   [26675, 14270],
+                   [26678, 14273]
+               ],
+               "lodRange": [16, 17]
+           }
+       }
+},
+{
+   "comment": "MainTouristAttractions MBtiles",
+   "group": "tianditu",
+   "id": "maintouristattractions-vec",
+   "type": "geodata",
+   "driver": "geodata-vector-tiled",
+   "credits": ["4dage"],
+   "definition": {
+       "dataset": "mainTouristAttractions/maintouristattractions.mbtiles/{loclod}-{locx}-{locy}"
+       , "demDataset": "dem"
+       , "geoidGrid": "egm96_15.gtx"
+       , "format": "geodataJson"
+       , "displaySize": 1024
+       , "styleUrl": "file:mainTouristAttractions/style.style"
+   },
+   "registry": {
+       "credits" : {"4dage":{ "id": 104, "notice": "" }}
+   },
+   "referenceFrames":
+       {
+           "melown2015": {
+               "tileRange": [
+                   [26675, 14270],
+                   [26678, 14273]
+               ],
+               "lodRange": [16, 17]
+           }
+       }
+},
+{
+   "comment": "POI MBtiles",
+   "group": "tianditu",
+   "id": "poi-vec",
+   "type": "geodata",
+   "driver": "geodata-vector-tiled",
+   "credits": ["4dage"],
+   "definition": {
+       "dataset": "poi/poi.mbtiles/{loclod}-{locx}-{locy}"
+       , "demDataset": "dem"
+       , "geoidGrid": "egm96_15.gtx"
+       , "format": "geodataJson"
+       , "displaySize": 1024
+       , "styleUrl": "file:poi/style.style"
+   },
+   "registry": {
+       "credits" : {"4dage":{ "id": 104, "notice": "" }}
+   },
+   "referenceFrames":
+       {
+           "melown2015": {
+               "tileRange": [
+                   [26675, 14270],
+                   [26678, 14273]
+               ],
+               "lodRange": [16, 17]
+           }
+       }
+},
+{
+   "comment": "Railway MBtiles",
+   "group": "tianditu",
+   "id": "railway-vec",
+   "type": "geodata",
+   "driver": "geodata-vector-tiled",
+   "credits": ["4dage"],
+   "definition": {
+       "dataset": "railway/railway.mbtiles/{loclod}-{locx}-{locy}"
+       , "demDataset": "dem"
+       , "geoidGrid": "egm96_15.gtx"
+       , "format": "geodataJson"
+       , "displaySize": 1024
+       , "styleUrl": "file:railway/style.style"
+   },
+   "registry": {
+       "credits" : {"4dage":{ "id": 104, "notice": "" }}
+   },
+   "referenceFrames":
+       {
+           "melown2015": {
+               "tileRange": [
+                   [26675, 14270],
+                   [26678, 14273]
+               ],
+               "lodRange": [16, 17]
+           }
+       }
+},
+{
+   "comment": "Star Hotel MBtiles",
+   "group": "tianditu",
+   "id": "starhotel-vec",
+   "type": "geodata",
+   "driver": "geodata-vector-tiled",
+   "credits": ["4dage"],
+   "definition": {
+       "dataset": "starHotel/starhotel.mbtiles/{loclod}-{locx}-{locy}"
+       , "demDataset": "dem"
+       , "geoidGrid": "egm96_15.gtx"
+       , "format": "geodataJson"
+       , "displaySize": 1024
+       , "styleUrl": "file:starHotel/style.style"
+   },
+   "registry": {
+       "credits" : {"4dage":{ "id": 104, "notice": "" }}
+   },
+   "referenceFrames":
+       {
+           "melown2015": {
+               "tileRange": [
+                   [26675, 14270],
+                   [26678, 14273]
+               ],
+               "lodRange": [16, 17]
+           }
+       }
+},
+{
+   "comment": "Traffic Lights 交通信号灯",
+   "group": "tianditu",
+   "id": "trafficlights-vec",
+   "type": "geodata",
+   "driver": "geodata-vector-tiled",
+   "credits": ["4dage"],
+   "definition": {
+       "dataset": "交通信号灯/交通信号灯.mbtiles/{loclod}-{locx}-{locy}"
+       , "demDataset": "dem"
+       , "geoidGrid": "egm96_15.gtx"
+       , "format": "geodataJson"
+       , "displaySize": 1024
+       , "styleUrl": "file:交通信号灯/style.style"
+   },
+   "registry": {
+       "credits" : {"4dage":{ "id": 104, "notice": "" }}
+   },
+   "referenceFrames":
+       {
+           "melown2015": {
+               "tileRange": [
+                   [26675, 14270],
+                   [26678, 14273]
+               ],
+               "lodRange": [16, 17]
+           }
+       }
+},
+{
+   "comment": "Traffic Detection 流量检测",
+   "group": "tianditu",
+   "id": "trafficdetection-vec",
+   "type": "geodata",
+   "driver": "geodata-vector-tiled",
+   "credits": ["4dage"],
+   "definition": {
+       "dataset": "流量检测/流量检测.mbtiles/{loclod}-{locx}-{locy}"
+       , "demDataset": "dem"
+       , "geoidGrid": "egm96_15.gtx"
+       , "format": "geodataJson"
+       , "displaySize": 1024
+       , "styleUrl": "file:流量检测/style.style"
+   },
+   "registry": {
+       "credits" : {"4dage":{ "id": 104, "notice": "" }}
+   },
+   "referenceFrames":
+       {
+           "melown2015": {
+               "tileRange": [
+                   [26675, 14270],
+                   [26678, 14273]
+               ],
+               "lodRange": [16, 17]
+           }
+       }
+},
+{
+   "comment": "Video Surveillance",
+   "group": "tianditu",
+   "id": "surveillance-vec",
+   "type": "geodata",
+   "driver": "geodata-vector-tiled",
+   "credits": ["4dage"],
+   "definition": {
+       "dataset": "视频监控/视频监控.mbtiles/{loclod}-{locx}-{locy}"
+       , "demDataset": "dem"
+       , "geoidGrid": "egm96_15.gtx"
+       , "format": "geodataJson"
+       , "displaySize": 1024
+       , "styleUrl": "file:视频监控/style.style"
+   },
+   "registry": {
+       "credits" : {"4dage":{ "id": 104, "notice": "" }}
+   },
+   "referenceFrames":
+       {
+           "melown2015": {
+               "tileRange": [
+                   [26675, 14270],
+                   [26678, 14273]
+               ],
+               "lodRange": [16, 17]
+           }
+       }
+}
+]
+