Selaa lähdekoodia

1. 多线程删除
2. 修改了发布
3. 修改了config.url

wuweihao 5 vuotta sitten
vanhempi
commit
05760b3bdf

+ 14 - 1
README.md

@@ -12,4 +12,17 @@
     /var/www/html/3dmap
     /var/www/html/3dmap
     
     
     
     
-linux 命令不会自动创建目录,云行是记得检查目录是否创建
+linux 命令不会自动创建目录,云行是记得检查目录是否创建
+
+3D map
+http://39.108.123.31/data/wuyidaxue/14/13336/7134.png
+
+build
+http:loacalhost:8082/data/aa.jpg
+
+数据管理平台:
+http://39.108.123.31:8082/back/#/grid  
+
+
+前端地址:
+http://map.4dage.com/3dmap/

+ 2 - 1
src/main/java/com/fd/constant/Command.java

@@ -10,7 +10,8 @@ public class Command {
      * 输入目录:/root/gis/cesium/input/@fileName fileName:是目录名
      * 输入目录:/root/gis/cesium/input/@fileName fileName:是目录名
      * 输出目录:/root/gis/cesium/output/@fileName fileName:是目录名
      * 输出目录:/root/gis/cesium/output/@fileName fileName:是目录名
      */
      */
-    public static String MODEL_SLICE_OSGB = "/opt/3dtiles_v1/target/release/3dtile -f osgb -i @inputFile -o @outputFile";
+//    public static String MODEL_SLICE_OSGB = "/opt/3dtiles_v1/target/release/3dtile -f osgb -i @inputFile -o @outputFile";
+    public static String MODEL_SLICE_OSGB = "docker run --rm -v /root/gis/cesium:/root/gis/cesium ubuntu:3dtile 3dtile -f osgb -i @inputFile -o @outputFile";
 
 
     /**
     /**
      * 矢量数据 坐标转换(普通转换,2000转wgs84)
      * 矢量数据 坐标转换(普通转换,2000转wgs84)

+ 3 - 1
src/main/java/com/fd/constant/MsgCode.java

@@ -30,7 +30,9 @@ public class MsgCode {
 
 
     public static final String E51007 = "目录重复";
     public static final String E51007 = "目录重复";
 
 
-    public static final String E51008 = "上传文件有误";
+    public static final String E51008 = "上传文件有误, 必须包含.shp .prj .dbf .shx等格式";
+
+    public static final String E51009 = "上传文件有误, 文件名必须一致";
 
 
     public static final String E50007 = "只支持.zip 文件";
     public static final String E50007 = "只支持.zip 文件";
 
 

+ 53 - 20
src/main/java/com/fd/controller/FdModelController.java

@@ -66,42 +66,46 @@ public class FdModelController {
      */
      */
     @PostConstruct
     @PostConstruct
     private void init() {
     private void init() {
-        new Thread(new modelSliceConsumerThread(modelQueue)).start();
+        new Thread(new ModelSliceConsumerThread(modelQueue)).start();
     }
     }
 
 
 
 
     /**
     /**
      * 消费队列
      * 消费队列
      */
      */
-    public class modelSliceConsumerThread implements Runnable{
+    public class ModelSliceConsumerThread implements Runnable{
 
 
         private BlockingQueue<MyQueue> queue;
         private BlockingQueue<MyQueue> queue;
-        public modelSliceConsumerThread(BlockingQueue<MyQueue> queue){
+        public ModelSliceConsumerThread(BlockingQueue<MyQueue> queue){
             this.queue = queue;
             this.queue = queue;
         }
         }
 
 
         @Override
         @Override
         public void run() {
         public void run() {
-            log.warn("run modelSliceConsumerThread");
             while (true) {
             while (true) {
-                OutputFileEntity obj = null;
                 try {
                 try {
-                    MyQueue data = queue.poll(2, TimeUnit.SECONDS);
+                    MyQueue data = queue.poll(4, TimeUnit.SECONDS);
                     if (data != null) {
                     if (data != null) {
-                        log.info("Consumer slice: {}", data.toString());
-
-                        Integer integer = cmdServer.exeCmdModelSlice(data.getStr());
-                        obj = data.getOutputFile();
+                        log.warn("run ModelSliceConsumerThread");
+                        log.info("cmd: {}", data.getStr());
+//                        Integer integer = cmdServer.exeCmdModelSlice(data.getStr());
+                        Integer integer = modelServer.cmdSlice(data.getStr());
+                        OutputFileEntity entity = data.getOutputFile();
 
 
                         if (integer != 0) {
                         if (integer != 0) {
                             log.info("error command exeCmdModelSlice");
                             log.info("error command exeCmdModelSlice");
                             // 如果命令运行失败,删除刚才创建的实体类
                             // 如果命令运行失败,删除刚才创建的实体类
                             // o:代表切片失败
                             // o:代表切片失败
-                            obj.setStatus(0);
-                            obj.setUpdateTime(new Date());
-                            modelServer.save(obj);
+                            entity.setStatus(0);
+                            entity.setUpdateTime(new Date());
+                            modelServer.save(entity);
                             return;
                             return;
                         }
                         }
+
+                        entity.setStatus(5);
+                        entity.setUpdateTime(new Date());
+                        modelServer.save(entity);
+                        log.warn("end ModelSliceConsumerThread");
                     }
                     }
                 } catch (InterruptedException e) {
                 } catch (InterruptedException e) {
 
 
@@ -196,14 +200,43 @@ public class FdModelController {
         return modelServer.findByType(TypeCode.FILE_TYPE_MODEL, param);
         return modelServer.findByType(TypeCode.FILE_TYPE_MODEL, param);
     }
     }
 
 
-    /**
-     * 删除文件
-     */
+//    /**
+//     * 删除文件
+//     */
+//    @ApiOperation("删除文件")
+//    @GetMapping("delete/{fileId}/")
+//    private R deleteFile(@PathVariable("fileId") Long fileId) {
+//        log.info("run deleteFile: {}", fileId);
+//        return modelServer.deleteById(fileId);
+//    }
+
     @ApiOperation("删除文件")
     @ApiOperation("删除文件")
     @GetMapping("delete/{fileId}/")
     @GetMapping("delete/{fileId}/")
     private R deleteFile(@PathVariable("fileId") Long fileId) {
     private R deleteFile(@PathVariable("fileId") Long fileId) {
         log.info("run deleteFile: {}", fileId);
         log.info("run deleteFile: {}", fileId);
-        return modelServer.deleteById(fileId);
+
+        OutputFileEntity entity = modelServer.findById(fileId);
+        entity.setResStatus(1);
+        modelServer.save(entity);
+        new Thread(new DeleteThread(fileId)).start();
+        log.info("delete vector id");
+        return new R(200, MsgCode.SUCCESS);
+    }
+
+    public class DeleteThread implements Runnable{
+
+        private Long fileId;
+
+        public DeleteThread(Long fileId){
+            this.fileId = fileId;
+        }
+
+        @Override
+        public void run() {
+            log.info("run RasterDeleteThread");
+            modelServer.deleteById(fileId);
+            log.info("end RasterDeleteThread");
+        }
     }
     }
 
 
 
 
@@ -227,7 +260,7 @@ public class FdModelController {
         log.info("cmd: {}", cmd);
         log.info("cmd: {}", cmd);
 
 
         // 命令产生的是文件夹
         // 命令产生的是文件夹
-        entity.setStatus(5);
+        entity.setStatus(6);
         entity.setUpdateTime(new Date());
         entity.setUpdateTime(new Date());
         entity.setSlicePath(outputPath);
         entity.setSlicePath(outputPath);
 
 
@@ -240,13 +273,13 @@ public class FdModelController {
         data.setStr(cmd);
         data.setStr(cmd);
         try {
         try {
             modelQueue.offer(data, 1, TimeUnit.SECONDS);
             modelQueue.offer(data, 1, TimeUnit.SECONDS);
-            log.info("入队成功");
+            log.info("model slice 入队成功");
         } catch (Exception e) {
         } catch (Exception e) {
 
 
             log.error("error  producer queue model cmdModelSlice: {}", e);
             log.error("error  producer queue model cmdModelSlice: {}", e);
             e.printStackTrace();
             e.printStackTrace();
         }
         }
-
+        log.info("end cmdModelSlice");
         return new R(200, entity);
         return new R(200, entity);
 
 
     }
     }

+ 44 - 17
src/main/java/com/fd/controller/RasterController.java

@@ -175,14 +175,47 @@ public class RasterController {
     }
     }
 
 
 
 
-    /**
-     * 删除文件
-     */
+//    /**
+//     * 删除文件
+//     */
+//    @ApiOperation("删除文件")
+//    @GetMapping("delete/{fileId}/")
+//    private R deleteFile(@PathVariable("fileId") Long fileId) {
+//        log.info("run deleteFile: {}", fileId);
+//        return rasterServer.deleteById(fileId);
+//    }
+
+
+
+
+
     @ApiOperation("删除文件")
     @ApiOperation("删除文件")
     @GetMapping("delete/{fileId}/")
     @GetMapping("delete/{fileId}/")
     private R deleteFile(@PathVariable("fileId") Long fileId) {
     private R deleteFile(@PathVariable("fileId") Long fileId) {
         log.info("run deleteFile: {}", fileId);
         log.info("run deleteFile: {}", fileId);
-        return rasterServer.deleteById(fileId);
+
+        OutputFileEntity entity = rasterServer.findById(fileId);
+        entity.setResStatus(1);
+        rasterServer.save(entity);
+        new Thread(new RasterDeleteThread(fileId)).start();
+        log.info("delete vector id");
+        return new R(200, MsgCode.SUCCESS);
+    }
+
+    public class RasterDeleteThread implements Runnable{
+
+        private Long fileId;
+
+        public RasterDeleteThread(Long fileId){
+            this.fileId = fileId;
+        }
+
+        @Override
+        public void run() {
+            log.info("run RasterDeleteThread");
+            rasterServer.deleteById(fileId);
+            log.info("end RasterDeleteThread");
+        }
     }
     }
 
 
     @ApiOperation("栅格数据判断坐标")
     @ApiOperation("栅格数据判断坐标")
@@ -231,18 +264,14 @@ public class RasterController {
 
 
         @Override
         @Override
         public void run() {
         public void run() {
-            log.warn("run JudgeCoordConsumerThread");
             while (true) {
             while (true) {
-                OutputFileEntity  entity = null;
                 try {
                 try {
                     MyQueue data = queue.poll(2, TimeUnit.SECONDS);
                     MyQueue data = queue.poll(2, TimeUnit.SECONDS);
                     if (data != null) {
                     if (data != null) {
-                        log.info("consumer judgeCoord: {}", data.toString());
+                        log.warn("run JudgeCoordConsumerThread");
 
 
-//                        Integer isJudge = cmdServer.exeCmdRasterJudgeCoord(data.getStr());
-                        entity = data.getOutputFile();
+                        OutputFileEntity  entity = data.getOutputFile();
 
 
-//                        if (1000 == isJudge){
                         if (TypeCode.COORD_XIAN_1980.equals(entity.getCoordType())){
                         if (TypeCode.COORD_XIAN_1980.equals(entity.getCoordType())){
                             log.info("need to transform");
                             log.info("need to transform");
                             // 严格坐标转换
                             // 严格坐标转换
@@ -261,6 +290,7 @@ public class RasterController {
                             entity.setUpdateTime(new Date());
                             entity.setUpdateTime(new Date());
                             rasterServer.save(entity);
                             rasterServer.save(entity);
                         }
                         }
+                        log.warn("end JudgeCoordConsumerThread");
 
 
                     }
                     }
                 } catch (Exception e) {
                 } catch (Exception e) {
@@ -342,15 +372,12 @@ public class RasterController {
 
 
         @Override
         @Override
         public void run() {
         public void run() {
-            log.warn("run SliceConsumerThread");
             while (isRun) {
             while (isRun) {
-                OutputFileEntity  entity = null;
                 try {
                 try {
                     MyQueue data = queue.poll(2, TimeUnit.SECONDS);
                     MyQueue data = queue.poll(2, TimeUnit.SECONDS);
                     if (data != null) {
                     if (data != null) {
-                        log.info("raster consume data:" + data.toString());
-
-                        entity = data.getOutputFile();
+                        log.warn("run SliceConsumerThread");
+                        OutputFileEntity  entity = data.getOutputFile();
                         log.info("raster cmd: {}", data.getStr());
                         log.info("raster cmd: {}", data.getStr());
                         Integer integer = cmdServer.exeCmdRasterSlice(data.getStr(), entity);
                         Integer integer = cmdServer.exeCmdRasterSlice(data.getStr(), entity);
                         if (integer != 0) {
                         if (integer != 0) {
@@ -364,8 +391,8 @@ public class RasterController {
                         // 切片完成,修改完成状态
                         // 切片完成,修改完成状态
                         entity.setStatus(5);
                         entity.setStatus(5);
                         entity.setUpdateTime(new Date());
                         entity.setUpdateTime(new Date());
-                        entity = rasterServer.save(entity);
-                        log.info("entity: {}", entity.toString());
+                        rasterServer.save(entity);
+                        log.warn("end SliceConsumerThread");
                     }
                     }
 
 
                 } catch (Exception e) {
                 } catch (Exception e) {

+ 42 - 14
src/main/java/com/fd/controller/VectorController.java

@@ -22,6 +22,7 @@ import lombok.extern.log4j.Log4j2;
 import org.apache.commons.lang3.StringUtils;
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.beans.factory.annotation.Value;
+import org.springframework.scheduling.annotation.Async;
 import org.springframework.web.bind.annotation.*;
 import org.springframework.web.bind.annotation.*;
 import org.springframework.web.multipart.MultipartFile;
 import org.springframework.web.multipart.MultipartFile;
 
 
@@ -195,6 +196,18 @@ public class VectorController {
         return vectorServer.findByType(TypeCode.FILE_TYPE_VECTOR, param);
         return vectorServer.findByType(TypeCode.FILE_TYPE_VECTOR, param);
     }
     }
 
 
+//    /**
+//     * 删除文件
+//     */
+//    @ApiOperation("删除文件")
+//    @GetMapping("delete/{fileId}/")
+//    private R deleteFile(@PathVariable("fileId") Long fileId) {
+//        log.info("run deleteFile: {}", fileId);
+//
+//        return vectorServer.deleteById(fileId);
+//    }
+
+
     /**
     /**
      * 删除文件
      * 删除文件
      */
      */
@@ -202,9 +215,30 @@ public class VectorController {
     @GetMapping("delete/{fileId}/")
     @GetMapping("delete/{fileId}/")
     private R deleteFile(@PathVariable("fileId") Long fileId) {
     private R deleteFile(@PathVariable("fileId") Long fileId) {
         log.info("run deleteFile: {}", fileId);
         log.info("run deleteFile: {}", fileId);
-        return vectorServer.deleteById(fileId);
+
+        OutputFileEntity entity = vectorServer.findById(fileId);
+        entity.setResStatus(1);
+        vectorServer.save(entity);
+        new Thread(new DeleteThread(fileId)).start();
+        log.info("delete vector id");
+        return new R(200, MsgCode.SUCCESS);
     }
     }
 
 
+    public class DeleteThread implements Runnable{
+
+        private Long fileId;
+
+        public DeleteThread(Long fileId){
+            this.fileId = fileId;
+        }
+
+        @Override
+        public void run() {
+            log.info("run DeleteThread");
+            vectorServer.deleteById(fileId);
+            log.info("end DeleteThread");
+        }
+    }
 
 
     @ApiOperation("矢量数据判断坐标")
     @ApiOperation("矢量数据判断坐标")
     @GetMapping("command/judge/coord/{fileId}/")
     @GetMapping("command/judge/coord/{fileId}/")
@@ -257,16 +291,12 @@ public class VectorController {
 
 
         @Override
         @Override
         public void run() {
         public void run() {
-            log.info("run VectorJudgeCoordConsumerThread 出队");
             while (true) {
             while (true) {
-                OutputFileEntity entity = null;
                 try {
                 try {
                     MyQueue data = queue.poll(2, TimeUnit.SECONDS);
                     MyQueue data = queue.poll(2, TimeUnit.SECONDS);
                     if (data != null) {
                     if (data != null) {
-                        log.info("consumer judgeCoord: {}", data.toString());
-
-                        entity = data.getOutputFile();
-
+                        log.info("run VectorJudgeCoordConsumerThread 出队");
+                        OutputFileEntity entity = data.getOutputFile();
                         // 坐标处理
                         // 坐标处理
                         String coord = entity.getCoord();
                         String coord = entity.getCoord();
                         log.info("convert coord: {}", coord);
                         log.info("convert coord: {}", coord);
@@ -317,6 +347,7 @@ public class VectorController {
                             entity.setUpdateTime(new Date());
                             entity.setUpdateTime(new Date());
                             vectorServer.save(entity);
                             vectorServer.save(entity);
                         }
                         }
+                        log.info("end VectorJudgeCoordConsumerThread ");
                     }
                     }
                 } catch (Exception e) {
                 } catch (Exception e) {
                     log.error("error vector consume queue VectorJudgeCoordConsumerThread: {}", e);
                     log.error("error vector consume queue VectorJudgeCoordConsumerThread: {}", e);
@@ -339,18 +370,16 @@ public class VectorController {
 
 
         @Override
         @Override
         public void run() {
         public void run() {
-            log.warn("run SliceVectorThread");
 
 
             while (true) {
             while (true) {
                 try {
                 try {
-                    MyQueue data = queue.poll(2, TimeUnit.SECONDS);
+                    MyQueue data = queue.poll(4, TimeUnit.SECONDS);
                     if (data != null) {
                     if (data != null) {
-                        log.info("vector consume data:" + data.toString());
+                        log.warn("run SliceVectorThread");
 
 
                         OutputFileEntity entity = data.getOutputFile();
                         OutputFileEntity entity = data.getOutputFile();
                         log.info("slice cmd: {}", data.getStr());
                         log.info("slice cmd: {}", data.getStr());
                         Integer integer =  vectorServer.cmdSlice(data.getStr(), entity);
                         Integer integer =  vectorServer.cmdSlice(data.getStr(), entity);
-                        log.info("slice test 1");
                         if (integer != 0) {
                         if (integer != 0) {
                             log.info("error command exeCmdVectorSlice");
                             log.info("error command exeCmdVectorSlice");
                             // 如果命令运行失败,状态改为0
                             // 如果命令运行失败,状态改为0
@@ -362,10 +391,9 @@ public class VectorController {
                         // 切片完成,修改完成状态
                         // 切片完成,修改完成状态
                         entity.setStatus(5);
                         entity.setStatus(5);
                         entity.setUpdateTime(new Date());
                         entity.setUpdateTime(new Date());
-                        entity = vectorServer.save(entity);
-                        log.info("entity: {}", entity.toString());
+                        vectorServer.save(entity);
+                        log.warn("end SliceVectorThread");
                     }
                     }
-
                 } catch (Exception e) {
                 } catch (Exception e) {
                     log.error("error  consume queue vector SliceConsumerThread: {}", e);
                     log.error("error  consume queue vector SliceConsumerThread: {}", e);
                     e.printStackTrace();
                     e.printStackTrace();

+ 8 - 0
src/main/java/com/fd/entity/BaseEntity.java

@@ -27,5 +27,13 @@ public class BaseEntity implements Serializable {
     @Column
     @Column
     private Date updateTime;
     private Date updateTime;
 
 
+    /**
+     * 是否可用
+     * 0: 可用
+     * 1:不可用
+     */
+    @Column
+    private Integer resStatus;
+
 
 
 }
 }

+ 1 - 1
src/main/java/com/fd/repository/IBaseRepository.java

@@ -15,5 +15,5 @@ import java.util.List;
 @NoRepositoryBean
 @NoRepositoryBean
 public interface IBaseRepository<T extends BaseEntity, ID extends Serializable> extends JpaRepository<T, ID>, JpaSpecificationExecutor<T> {
 public interface IBaseRepository<T extends BaseEntity, ID extends Serializable> extends JpaRepository<T, ID>, JpaSpecificationExecutor<T> {
 
 
-
+//    T findById(ID);
 }
 }

+ 2 - 0
src/main/java/com/fd/repository/OutputFileRepository.java

@@ -19,6 +19,8 @@ public interface OutputFileRepository extends JpaRepository<OutputFileEntity, Lo
     // 条件分页查询
     // 条件分页查询
     Page<OutputFileEntity> findByType(String type, Pageable pageable);
     Page<OutputFileEntity> findByType(String type, Pageable pageable);
 
 
+    Page<OutputFileEntity> findByTypeAndResStatus(String type, Integer resStatus, Pageable pageable);
+
     @Query(value = "select r from OutputFileEntity r where r.type=?1 or r.type =?2")
     @Query(value = "select r from OutputFileEntity r where r.type=?1 or r.type =?2")
     Page<OutputFileEntity> findByType(String type, String type1, Pageable pageable);
     Page<OutputFileEntity> findByType(String type, String type1, Pageable pageable);
 
 

+ 2 - 0
src/main/java/com/fd/server/ModelServer.java

@@ -29,4 +29,6 @@ public interface ModelServer {
     R deleteById(Long fileId);
     R deleteById(Long fileId);
 
 
     List<FileEntity> findByFileName(String fileName);
     List<FileEntity> findByFileName(String fileName);
+
+    Integer cmdSlice(String cmd);
 }
 }

+ 1 - 1
src/main/java/com/fd/server/VectorServer.java

@@ -17,7 +17,7 @@ import java.util.Map;
  */
  */
 public interface VectorServer {
 public interface VectorServer {
 
 
-    R uploadDirectoryFile(MultipartFile file, String directoryName, String coord);
+//    R uploadDirectoryFile(MultipartFile file, String directoryName, String coord);
 
 
     R uploadDirectoryFileMul(MultipartFile [] file, String directoryName, String coord);
     R uploadDirectoryFileMul(MultipartFile [] file, String directoryName, String coord);
 
 

+ 73 - 12
src/main/java/com/fd/server/impl/ModelServerImpl.java

@@ -15,6 +15,7 @@ import com.fd.server.ModelServer;
 import com.fd.util.FileUtils;
 import com.fd.util.FileUtils;
 import com.fd.util.R;
 import com.fd.util.R;
 import lombok.extern.log4j.Log4j2;
 import lombok.extern.log4j.Log4j2;
+import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.data.domain.Page;
 import org.springframework.data.domain.Page;
@@ -23,8 +24,10 @@ import org.springframework.data.domain.Sort;
 import org.springframework.stereotype.Service;
 import org.springframework.stereotype.Service;
 import org.springframework.web.multipart.MultipartFile;
 import org.springframework.web.multipart.MultipartFile;
 
 
+import java.io.BufferedReader;
 import java.io.File;
 import java.io.File;
 import java.io.IOException;
 import java.io.IOException;
+import java.io.InputStreamReader;
 import java.util.Date;
 import java.util.Date;
 import java.util.List;
 import java.util.List;
 import java.util.Optional;
 import java.util.Optional;
@@ -107,6 +110,63 @@ public class ModelServerImpl implements ModelServer  {
         return fileRepository.findByFileNameAndType(fileName, TypeCode.FILE_TYPE_MODEL);
         return fileRepository.findByFileNameAndType(fileName, TypeCode.FILE_TYPE_MODEL);
     }
     }
 
 
+    @Override
+    public Integer cmdSlice(String commandStr) {
+
+            // 命令运行结果 1:失败, 0:成功
+            Integer isCmd = null;
+            try {
+                String[] cmd = new String[]{"/bin/sh", "-c", commandStr};
+                Process ps = Runtime.getRuntime().exec(cmd);
+
+                BufferedReader br = new BufferedReader(new InputStreamReader(ps.getInputStream()));
+                BufferedReader errorBuf = new BufferedReader(new InputStreamReader(ps.getErrorStream()));
+
+                StringBuffer sb = new StringBuffer();
+                StringBuffer errorStr = new StringBuffer();
+
+                // error : 坑, 控制台信息是从errorBuf这里出来的
+                String errorLine;
+                while ((errorLine = errorBuf.readLine()) != null) {
+                    errorStr.append(errorLine).append("\n");
+                    log.info("line data: {}", errorLine);
+                }
+                if (StringUtils.isNotEmpty(errorStr)){
+                    log.info("error result: {}", errorStr.toString());
+                }
+
+                // success ,没有获取到信息
+                String line;
+                while ((line = br.readLine()) != null) {
+                    //执行结果加上回车
+                    sb.append(line).append("\n");
+                    log.info("data: {}", line);
+                }
+                log.info("result: {}", sb.toString());
+
+                // 结束命令行
+                isCmd = ps.waitFor();
+
+                // 关闭流
+                br.close();
+                errorBuf.close();
+
+            } catch (Exception e) {
+                e.printStackTrace();
+            }
+
+            if (isCmd == 0) {
+                log.info("end exeCmd : {}", isCmd);
+            } else {
+                log.info("wsitFore cmd run error : {}", isCmd);
+            }
+            return isCmd;
+        }
+
+
+
+//
+
 
 
     @Override
     @Override
     public R moveFileToServer(Long fileId) {
     public R moveFileToServer(Long fileId) {
@@ -117,10 +177,10 @@ public class ModelServerImpl implements ModelServer  {
         }
         }
         OutputFileEntity entity = o.get();
         OutputFileEntity entity = o.get();
         // 移动文件
         // 移动文件
-        FileUtils.createDir(MOVE_FILE_TO_SERVER);
+//        FileUtils.createDir(MOVE_FILE_TO_SERVER);
 
 
         try {
         try {
-            org.apache.commons.io.FileUtils.copyDirectoryToDirectory(new File(entity.getSlicePath()), new File(MOVE_FILE_TO_SERVER));
+//            org.apache.commons.io.FileUtils.copyDirectoryToDirectory(new File(entity.getSlicePath()), new File(MOVE_FILE_TO_SERVER));
             // 修改前端的config.json 文件
             // 修改前端的config.json 文件
             writeJsonFile();
             writeJsonFile();
 
 
@@ -130,7 +190,7 @@ public class ModelServerImpl implements ModelServer  {
             outputFileRepository.save(entity);
             outputFileRepository.save(entity);
 
 
             return new R(200, MsgCode.SUCCESS);
             return new R(200, MsgCode.SUCCESS);
-        } catch (IOException e) {
+        } catch (Exception e) {
 
 
             // 发布失败
             // 发布失败
             entity.setStatus(10);
             entity.setStatus(10);
@@ -191,6 +251,7 @@ public class ModelServerImpl implements ModelServer  {
         outputFile.setUploadPath(entity.getFileUrl());
         outputFile.setUploadPath(entity.getFileUrl());
         outputFile.setFileName(entity.getFileName());
         outputFile.setFileName(entity.getFileName());
         outputFile.setStatus(1);
         outputFile.setStatus(1);
+        outputFile.setResStatus(0);
         outputFile.setType(TypeCode.FILE_TYPE_MODEL);
         outputFile.setType(TypeCode.FILE_TYPE_MODEL);
         outputFile.setCreateTime(new Date());
         outputFile.setCreateTime(new Date());
         outputFile.setUpdateTime(new Date());
         outputFile.setUpdateTime(new Date());
@@ -222,13 +283,21 @@ public class ModelServerImpl implements ModelServer  {
         return null;
         return null;
     }
     }
 
 
+//    @Override
+//    public R findByType(String fileTypeModel, PageDto pageDto) {
+//        Page<OutputFileEntity> page = outputFileRepository.findByType(fileTypeModel, PageRequest.of(pageDto.getPageNum(), pageDto.getPageSize(), Sort.by("createTime").descending()));
+//        return new R(200, page);
+//    }
+//
+
     @Override
     @Override
     public R findByType(String fileTypeModel, PageDto pageDto) {
     public R findByType(String fileTypeModel, PageDto pageDto) {
-        Page<OutputFileEntity> page = outputFileRepository.findByType(fileTypeModel, PageRequest.of(pageDto.getPageNum(), pageDto.getPageSize(), Sort.by("createTime").descending()));
+        Page<OutputFileEntity> page = outputFileRepository.findByTypeAndResStatus(fileTypeModel, 0,PageRequest.of(pageDto.getPageNum(), pageDto.getPageSize(), Sort.by("createTime").descending()));
         return new R(200, page);
         return new R(200, page);
     }
     }
 
 
 
 
+
     /**
     /**
      * 修改config.json 文件
      * 修改config.json 文件
      */
      */
@@ -249,14 +318,6 @@ public class ModelServerImpl implements ModelServer  {
 
 
     }
     }
 
 
-
-    public void deleteFile(OutputFileEntity entity){
-
-
-
-    }
-
-
     public static void main(String[] args) throws IOException {
     public static void main(String[] args) throws IOException {
         String path1 = "F:\\test\\a1";
         String path1 = "F:\\test\\a1";
         String path2 = "F:\\test\\vts.log";
         String path2 = "F:\\test\\vts.log";

+ 63 - 10
src/main/java/com/fd/server/impl/RasterServerImpl.java

@@ -114,6 +114,47 @@ public class RasterServerImpl implements RasterServer {
     }
     }
 
 
 
 
+//    @Override
+//    public R moveFileToServer(Long fileId, ConfigJsonDto param) {
+//        Optional<OutputFileEntity> o = outputFileRepository.findById(fileId);
+//        if (!o.isPresent()) {
+//            log.info("id:{} 不存在", fileId);
+//            return new R(50002, MsgCode.E50002);
+//        }
+//
+//        // 把数据移动到指定服务位置
+//        OutputFileEntity entity = o.get();
+//        FileUtils.createDir(MOVE_FILE_TO_SERVER);
+//
+//        try {
+//            org.apache.commons.io.FileUtils.copyDirectoryToDirectory(new File(entity.getSlicePath()), new File(MOVE_FILE_TO_SERVER));
+//            // 修改前端的config.json 文件
+//            String lastName = StringUtils.substringAfterLast(entity.getSlicePath(), "/");
+//            log.info("lastName: {}", lastName);
+//            writeJsonFile(param, lastName, entity);
+//
+//            //修改linux 文件权限
+//            String cmd = Command.CMD_CHOMD_755;
+//            String slice = MOVE_FILE_TO_SERVER + lastName;
+//            cmd = cmd.replace("@path", slice);
+//            log.info("cmd: {}", cmd);
+//            cmdServer.exeCmdInt(cmd);
+//
+//            // 成功,更新状态
+//            entity.setStatus(8);
+//            entity.setUpdateTime(new Date());
+//            outputFileRepository.save(entity);
+//            return new R(200, MsgCode.SUCCESS);
+//        } catch (IOException e) {
+//
+//            entity.setStatus(10);
+//            entity.setUpdateTime(new Date());
+//            outputFileRepository.save(entity);
+//            e.printStackTrace();
+//            return new R(51004, MsgCode.E51004, e);
+//        }
+//    }
+
     @Override
     @Override
     public R moveFileToServer(Long fileId, ConfigJsonDto param) {
     public R moveFileToServer(Long fileId, ConfigJsonDto param) {
         Optional<OutputFileEntity> o = outputFileRepository.findById(fileId);
         Optional<OutputFileEntity> o = outputFileRepository.findById(fileId);
@@ -124,28 +165,28 @@ public class RasterServerImpl implements RasterServer {
 
 
         // 把数据移动到指定服务位置
         // 把数据移动到指定服务位置
         OutputFileEntity entity = o.get();
         OutputFileEntity entity = o.get();
-        FileUtils.createDir(MOVE_FILE_TO_SERVER);
+//        FileUtils.createDir(MOVE_FILE_TO_SERVER);
 
 
         try {
         try {
-            org.apache.commons.io.FileUtils.copyDirectoryToDirectory(new File(entity.getSlicePath()), new File(MOVE_FILE_TO_SERVER));
+//            org.apache.commons.io.FileUtils.copyDirectoryToDirectory(new File(entity.getSlicePath()), new File(MOVE_FILE_TO_SERVER));
             // 修改前端的config.json 文件
             // 修改前端的config.json 文件
             String lastName = StringUtils.substringAfterLast(entity.getSlicePath(), "/");
             String lastName = StringUtils.substringAfterLast(entity.getSlicePath(), "/");
             log.info("lastName: {}", lastName);
             log.info("lastName: {}", lastName);
             writeJsonFile(param, lastName, entity);
             writeJsonFile(param, lastName, entity);
 
 
             //修改linux 文件权限
             //修改linux 文件权限
-            String cmd = Command.CMD_CHOMD_755;
-            String slice = MOVE_FILE_TO_SERVER + lastName;
-            cmd = cmd.replace("@path", slice);
-            log.info("cmd: {}", cmd);
-            cmdServer.exeCmdInt(cmd);
+//            String cmd = Command.CMD_CHOMD_755;
+//            String slice = MOVE_FILE_TO_SERVER + lastName;
+//            cmd = cmd.replace("@path", slice);
+//            log.info("cmd: {}", cmd);
+//            cmdServer.exeCmdInt(cmd);
 
 
             // 成功,更新状态
             // 成功,更新状态
             entity.setStatus(8);
             entity.setStatus(8);
             entity.setUpdateTime(new Date());
             entity.setUpdateTime(new Date());
             outputFileRepository.save(entity);
             outputFileRepository.save(entity);
             return new R(200, MsgCode.SUCCESS);
             return new R(200, MsgCode.SUCCESS);
-        } catch (IOException e) {
+        } catch (Exception e) {
 
 
             entity.setStatus(10);
             entity.setStatus(10);
             entity.setUpdateTime(new Date());
             entity.setUpdateTime(new Date());
@@ -202,6 +243,7 @@ public class RasterServerImpl implements RasterServer {
         outputFile.setUploadPath(entity.getFileUrl());
         outputFile.setUploadPath(entity.getFileUrl());
         outputFile.setFileName(entity.getFileName());
         outputFile.setFileName(entity.getFileName());
         outputFile.setStatus(2);
         outputFile.setStatus(2);
+        outputFile.setResStatus(0);
         outputFile.setCoord(strCoord);
         outputFile.setCoord(strCoord);
         outputFile.setType(TypeCode.FILE_TYPE_RASTER);
         outputFile.setType(TypeCode.FILE_TYPE_RASTER);
         outputFile.setCreateTime(new Date());
         outputFile.setCreateTime(new Date());
@@ -213,9 +255,16 @@ public class RasterServerImpl implements RasterServer {
         return new R(200, outputFile);
         return new R(200, outputFile);
     }
     }
 
 
+//    @Override
+//    public R findByType(String fileTypeRaster, PageDto pageDto) {
+//        Page<OutputFileEntity> page = outputFileRepository.findByType(fileTypeRaster, PageRequest.of(pageDto.getPageNum(), pageDto.getPageSize(), Sort.by("createTime").descending()));
+//        return new R(200, page);
+//    }
+
+
     @Override
     @Override
     public R findByType(String fileTypeRaster, PageDto pageDto) {
     public R findByType(String fileTypeRaster, PageDto pageDto) {
-        Page<OutputFileEntity> page = outputFileRepository.findByType(fileTypeRaster, PageRequest.of(pageDto.getPageNum(), pageDto.getPageSize(), Sort.by("createTime").descending()));
+        Page<OutputFileEntity> page = outputFileRepository.findByTypeAndResStatus(fileTypeRaster, 0, PageRequest.of(pageDto.getPageNum(), pageDto.getPageSize(), Sort.by("createTime").descending()));
         return new R(200, page);
         return new R(200, page);
     }
     }
 
 
@@ -258,7 +307,11 @@ public class RasterServerImpl implements RasterServer {
         subJson.put("type", "imagery");
         subJson.put("type", "imagery");
         subJson.put("checked", false);
         subJson.put("checked", false);
         subJson.put("show", true);
         subJson.put("show", true);
-        subJson.put("url", "../data/" + lastName);
+//        subJson.put("url", "../data/" + lastName);
+//        subJson.put("url", entity.getSlicePath());
+        String slicePath = entity.getSlicePath();
+        slicePath = slicePath.replace("/root/gis/cesium", "");
+        subJson.put("url", slicePath);
 
 
         layers.add(subJson);
         layers.add(subJson);
 
 

+ 182 - 98
src/main/java/com/fd/server/impl/VectorServerImpl.java

@@ -75,6 +75,46 @@ public class VectorServerImpl implements VectorServer {
     @Autowired
     @Autowired
     private StyleRepository styleRepository;
     private StyleRepository styleRepository;
 
 
+//    @Override
+//    public R moveFileToServer(Long fileId, ConfigJsonDto param) {
+//        Optional<OutputFileEntity> o = outputFileRepository.findById(fileId);
+//        if (!o.isPresent()) {
+//            log.info("id:{} 不存在", fileId);
+//            return new R(50002, MsgCode.E50002);
+//        }
+//        OutputFileEntity entity = o.get();
+//        FileUtils.createDir(MOVE_FILE_TO_SERVER);
+//
+//        try {
+//            org.apache.commons.io.FileUtils.copyDirectoryToDirectory(new File(entity.getSlicePath()), new File(MOVE_FILE_TO_SERVER));
+//            // 修改前端的config.json 文件
+//            writeJsonFile(param, entity.getDirectory(), entity);
+//
+//            //修改linux 文件权限
+//            String cmd = Command.CMD_CHOMD_755;
+//            String slice = MOVE_FILE_TO_SERVER + entity.getDirectory();
+//            cmd = cmd.replace("@path", slice);
+//            log.info("cmd: {}", cmd);
+//            cmdServer.exeCmdInt(cmd);
+//
+//
+//            entity.setStatus(8);
+//            entity.setServicePath(slice);
+//            entity.setUpdateTime(new Date());
+//            outputFileRepository.save(entity);
+//            return new R(200, MsgCode.SUCCESS);
+//        } catch (IOException e) {
+//            e.printStackTrace();
+//            // 服务发布失败
+//            entity.setStatus(10);
+//            entity.setUpdateTime(new Date());
+//            outputFileRepository.save(entity);
+//            return new R(51004, MsgCode.E51004, e);
+//        }
+//    }
+
+
+
     @Override
     @Override
     public R moveFileToServer(Long fileId, ConfigJsonDto param) {
     public R moveFileToServer(Long fileId, ConfigJsonDto param) {
         Optional<OutputFileEntity> o = outputFileRepository.findById(fileId);
         Optional<OutputFileEntity> o = outputFileRepository.findById(fileId);
@@ -83,27 +123,27 @@ public class VectorServerImpl implements VectorServer {
             return new R(50002, MsgCode.E50002);
             return new R(50002, MsgCode.E50002);
         }
         }
         OutputFileEntity entity = o.get();
         OutputFileEntity entity = o.get();
-        FileUtils.createDir(MOVE_FILE_TO_SERVER);
+//        FileUtils.createDir(MOVE_FILE_TO_SERVER);
 
 
         try {
         try {
-            org.apache.commons.io.FileUtils.copyDirectoryToDirectory(new File(entity.getSlicePath()), new File(MOVE_FILE_TO_SERVER));
+//            org.apache.commons.io.FileUtils.copyDirectoryToDirectory(new File(entity.getSlicePath()), new File(MOVE_FILE_TO_SERVER));
             // 修改前端的config.json 文件
             // 修改前端的config.json 文件
             writeJsonFile(param, entity.getDirectory(), entity);
             writeJsonFile(param, entity.getDirectory(), entity);
 
 
             //修改linux 文件权限
             //修改linux 文件权限
-            String cmd = Command.CMD_CHOMD_755;
-            String slice = MOVE_FILE_TO_SERVER + entity.getDirectory();
-            cmd = cmd.replace("@path", slice);
-            log.info("cmd: {}", cmd);
-            cmdServer.exeCmdInt(cmd);
+//            String cmd = Command.CMD_CHOMD_755;
+//            String slice = MOVE_FILE_TO_SERVER + entity.getDirectory();
+//            cmd = cmd.replace("@path", slice);
+//            log.info("cmd: {}", cmd);
+//            cmdServer.exeCmdInt(cmd);
 
 
 
 
             entity.setStatus(8);
             entity.setStatus(8);
-            entity.setServicePath(slice);
+            entity.setServicePath(entity.getSlicePath());
             entity.setUpdateTime(new Date());
             entity.setUpdateTime(new Date());
             outputFileRepository.save(entity);
             outputFileRepository.save(entity);
             return new R(200, MsgCode.SUCCESS);
             return new R(200, MsgCode.SUCCESS);
-        } catch (IOException e) {
+        } catch (Exception e) {
             e.printStackTrace();
             e.printStackTrace();
             // 服务发布失败
             // 服务发布失败
             entity.setStatus(10);
             entity.setStatus(10);
@@ -150,26 +190,13 @@ public class VectorServerImpl implements VectorServer {
         }
         }
 
 
         if (entity.getSlicePath() != null) {
         if (entity.getSlicePath() != null) {
-            log.info("test file getSlicePath");
-            File file = new File(entity.getSlicePath());
-            if (file.exists()) {
-                log.info("test file ");
                 FileUtils.delFolder(entity.getSlicePath());
                 FileUtils.delFolder(entity.getSlicePath());
-            }
-            log.info("test file getSlicePath ok");
         }
         }
 
 
         // 目录类型
         // 目录类型
-        if (entity.getServicePath() != null) {
-            log.info("test file getServicePath");
-
-            File file = new File(entity.getServicePath());
-            if (file.exists()) {
-                log.info("test file ");
-                FileUtils.delFolder(entity.getServicePath());
-            }
-            log.info("test file getServicePath ok");
-        }
+//        if (entity.getServicePath() != null) {
+//                FileUtils.delFolder(entity.getServicePath());
+//        }
 
 
 
 
         // 删除配置文件config.json制定行
         // 删除配置文件config.json制定行
@@ -200,70 +227,70 @@ public class VectorServerImpl implements VectorServer {
     }
     }
 
 
 
 
-    @Override
-    public R uploadDirectoryFile(MultipartFile file, String directoryName, String coord) {
-
-        log.warn("run uploadBigFile");
-        long start = System.currentTimeMillis();
-        if (file.isEmpty() || file.getSize() <= 0) {
-            log.info("文件为空");
-            return new R(50001, MsgCode.E50001);
-        }
-
-        // 文件名全名
-        String fullFileName = file.getOriginalFilename();
-
-        // 创建目录路径
-        String filePath = INPUT_FILE_PATH + directoryName + File.separator;
-        FileUtils.createDir(filePath);
-
-
-        // 文件保存路径
-        filePath = filePath + fullFileName;
-
-        // 写文件到本地
-
-        try {
-            FileUtils.bigFileWrite(file.getInputStream(), filePath);
-        } catch (IOException e) {
-            e.printStackTrace();
-        }
-        log.info("filePath: {}", filePath);
-
-        // 保存信息到db
-        FileEntity entity = new FileEntity();
-        entity.setFileName(fullFileName);
-        entity.setDirectory(directoryName);
-        entity.setFileUrl(filePath);
-        entity.setCreateTime(new Date());
-        entity.setUpdateTime(new Date());
-        entity.setType(TypeCode.FILE_TYPE_VECTOR);
-        entity.setCoord(coord);
-        entity.setStatus(2);
-        fileRepository.save(entity);
-
-        OutputFileEntity outputFile = null;
-        String s = StringUtils.substringAfterLast(fullFileName, ".");
-        if ("shp".equals(s)) {
-
-            outputFile = new OutputFileEntity();
-            outputFile.setUploadId(entity.getId());
-            outputFile.setUploadPath(entity.getFileUrl());
-            outputFile.setFileName(entity.getFileName());
-            outputFile.setStatus(2);
-            outputFile.setType(TypeCode.FILE_TYPE_VECTOR);
-            outputFile.setCoord(entity.getCoord());
-            outputFile.setCreateTime(new Date());
-            outputFile.setUpdateTime(new Date());
-
-            outputFile = outputFileRepository.save(outputFile);
-        }
-
-
-        long end = System.currentTimeMillis();
-        log.info("end uploadBigFile, total time: {} s", (end - start) / 1000);
-        return new R(200, outputFile);
-    }
+//    @Override
+//    public R uploadDirectoryFile(MultipartFile file, String directoryName, String coord) {
+//
+//        log.warn("run uploadBigFile");
+//        long start = System.currentTimeMillis();
+//        if (file.isEmpty() || file.getSize() <= 0) {
+//            log.info("文件为空");
+//            return new R(50001, MsgCode.E50001);
+//        }
+//
+//        // 文件名全名
+//        String fullFileName = file.getOriginalFilename();
+//
+//        // 创建目录路径
+//        String filePath = INPUT_FILE_PATH + directoryName + File.separator;
+//        FileUtils.createDir(filePath);
+//
+//
+//        // 文件保存路径
+//        filePath = filePath + fullFileName;
+//
+//        // 写文件到本地
+//
+//        try {
+//            FileUtils.bigFileWrite(file.getInputStream(), filePath);
+//        } catch (IOException e) {
+//            e.printStackTrace();
+//        }
+//        log.info("filePath: {}", filePath);
+//
+//        // 保存信息到db
+//        FileEntity entity = new FileEntity();
+//        entity.setFileName(fullFileName);
+//        entity.setDirectory(directoryName);
+//        entity.setFileUrl(filePath);
+//        entity.setCreateTime(new Date());
+//        entity.setUpdateTime(new Date());
+//        entity.setType(TypeCode.FILE_TYPE_VECTOR);
+//        entity.setCoord(coord);
+//        entity.setStatus(2);
+//        fileRepository.save(entity);
+//
+//        OutputFileEntity outputFile = null;
+//        String s = StringUtils.substringAfterLast(fullFileName, ".");
+//        if ("shp".equals(s)) {
+//
+//            outputFile = new OutputFileEntity();
+//            outputFile.setUploadId(entity.getId());
+//            outputFile.setUploadPath(entity.getFileUrl());
+//            outputFile.setFileName(entity.getFileName());
+//            outputFile.setStatus(2);
+//            outputFile.setType(TypeCode.FILE_TYPE_VECTOR);
+//            outputFile.setCoord(entity.getCoord());
+//            outputFile.setCreateTime(new Date());
+//            outputFile.setUpdateTime(new Date());
+//
+//            outputFile = outputFileRepository.save(outputFile);
+//        }
+//
+//
+//        long end = System.currentTimeMillis();
+//        log.info("end uploadBigFile, total time: {} s", (end - start) / 1000);
+//        return new R(200, outputFile);
+//    }
 
 
     @Override
     @Override
     public R uploadDirectoryFileMul(MultipartFile[] files, String directoryName, String coord) {
     public R uploadDirectoryFileMul(MultipartFile[] files, String directoryName, String coord) {
@@ -311,11 +338,13 @@ public class VectorServerImpl implements VectorServer {
                 String [] suffixCheck = {"dbf","shp","shx","prj"};
                 String [] suffixCheck = {"dbf","shp","shx","prj"};
                 if (Arrays.asList(suffixCheck).contains(s)) {
                 if (Arrays.asList(suffixCheck).contains(s)) {
                     suffixCheckInt += 1;
                     suffixCheckInt += 1;
+
+                    // 判断前缀名字是否一致
+                    String prefix = StringUtils.substringBeforeLast(filename, ".");
+                    setPrefix.add(prefix);
                 }
                 }
 
 
-                // 判断前缀名字是否一致
-                String prefix = StringUtils.substringBeforeLast(filename, ".");
-                setPrefix.add(prefix);
+
 
 
                 if ("shp".equals(s)) {
                 if ("shp".equals(s)) {
                     shpFlag = true;
                     shpFlag = true;
@@ -335,7 +364,7 @@ public class VectorServerImpl implements VectorServer {
         if (setPrefix.size() > 1) {
         if (setPrefix.size() > 1) {
 
 
             log.info("文件名前缀不一致");
             log.info("文件名前缀不一致");
-            return new R(51008, MsgCode.E51008);
+            return new R(51009, MsgCode.E51009);
         }
         }
 
 
         // 上传文件格式有误
         // 上传文件格式有误
@@ -364,14 +393,21 @@ public class VectorServerImpl implements VectorServer {
             outputFile.setCoord(entity.getCoord());
             outputFile.setCoord(entity.getCoord());
             outputFile.setCreateTime(new Date());
             outputFile.setCreateTime(new Date());
             outputFile.setUpdateTime(new Date());
             outputFile.setUpdateTime(new Date());
+            outputFile.setResStatus(0);
             outputFile = outputFileRepository.save(outputFile);
             outputFile = outputFileRepository.save(outputFile);
         }
         }
         return new R(200, outputFile);
         return new R(200, outputFile);
     }
     }
 
 
+//    @Override
+//    public R findByType(String type, PageDto pageDto) {
+//        Page<OutputFileEntity> page = outputFileRepository.findByType(type, PageRequest.of(pageDto.getPageNum(), pageDto.getPageSize(), Sort.by("createTime").descending()));
+//        return new R(200, page);
+//    }
+
     @Override
     @Override
     public R findByType(String type, PageDto pageDto) {
     public R findByType(String type, PageDto pageDto) {
-        Page<OutputFileEntity> page = outputFileRepository.findByType(type, PageRequest.of(pageDto.getPageNum(), pageDto.getPageSize(), Sort.by("createTime").descending()));
+        Page<OutputFileEntity> page = outputFileRepository.findByTypeAndResStatus(type, 0, PageRequest.of(pageDto.getPageNum(), pageDto.getPageSize(), Sort.by("createTime").descending()));
         return new R(200, page);
         return new R(200, page);
     }
     }
 
 
@@ -660,6 +696,54 @@ public class VectorServerImpl implements VectorServer {
      * 发布服务
      * 发布服务
      * 修改config.json
      * 修改config.json
      */
      */
+//    private void writeJsonFile(ConfigJsonDto param, String lastName, OutputFileEntity entity) {
+//
+//        StyleEntity styleEntity = styleRepository.findByOutputFileIdTop(entity.getId());
+//
+//        String s = FileUtils.readFile(CONFIG_JSON_PATH);
+//
+//        JSONObject original = JSON.parseObject(s);
+//
+//        log.info("original: {}", s);
+//
+//        JSONArray layers = JSON.parseArray(original.getString("layers"));
+//
+//        JSONObject subJson = new JSONObject();
+//        long cu = System.currentTimeMillis();
+//        String name = "vector_" + cu;
+//        // 需要唯一
+//        subJson.put("name", name);
+//
+//        subJson.put("text", param.getText());
+//        // vector 就用这个类型geodata
+//        subJson.put("type", "geodata");
+//        subJson.put("checked", false);
+//        subJson.put("show", true);
+//        subJson.put("url", "../data/" + lastName);
+////        subJson.put("style", JSON.parse(styleEntity.getContent()));
+//        layers.add(subJson);
+//
+//        original.put("layers", layers);
+//
+//        log.info("original update: {}", original.toJSONString());
+//        try {
+//            FileUtils.fileWriter(JSON.toJSONString(original), CONFIG_JSON_PATH);
+//
+//            // 将图层信息保存到db
+//            // 前端需要layer信息
+//            styleEntity.setLayer(subJson.toJSONString());
+//            styleEntity.setUpdateTime(new Date());
+//            styleEntity.setName(name);
+////            log.info("check test 2");
+//            styleRepository.save(styleEntity);
+////            log.info("check test 3");
+//
+//        } catch (IOException e) {
+//            e.printStackTrace();
+//        }
+//    }
+
+
     private void writeJsonFile(ConfigJsonDto param, String lastName, OutputFileEntity entity) {
     private void writeJsonFile(ConfigJsonDto param, String lastName, OutputFileEntity entity) {
 
 
         StyleEntity styleEntity = styleRepository.findByOutputFileIdTop(entity.getId());
         StyleEntity styleEntity = styleRepository.findByOutputFileIdTop(entity.getId());
@@ -683,8 +767,10 @@ public class VectorServerImpl implements VectorServer {
         subJson.put("type", "geodata");
         subJson.put("type", "geodata");
         subJson.put("checked", false);
         subJson.put("checked", false);
         subJson.put("show", true);
         subJson.put("show", true);
-        subJson.put("url", "../data/" + lastName);
-//        subJson.put("style", JSON.parse(styleEntity.getContent()));
+//        subJson.put("url", "../data/" + lastName);
+        String slicePath = entity.getSlicePath();
+        slicePath = slicePath.replace("/root/gis/cesium", "");
+        subJson.put("url", slicePath);
         layers.add(subJson);
         layers.add(subJson);
 
 
         original.put("layers", layers);
         original.put("layers", layers);
@@ -698,9 +784,7 @@ public class VectorServerImpl implements VectorServer {
             styleEntity.setLayer(subJson.toJSONString());
             styleEntity.setLayer(subJson.toJSONString());
             styleEntity.setUpdateTime(new Date());
             styleEntity.setUpdateTime(new Date());
             styleEntity.setName(name);
             styleEntity.setName(name);
-//            log.info("check test 2");
             styleRepository.save(styleEntity);
             styleRepository.save(styleEntity);
-//            log.info("check test 3");
 
 
         } catch (IOException e) {
         } catch (IOException e) {
             e.printStackTrace();
             e.printStackTrace();

+ 42 - 42
src/main/java/com/fd/thread/TaskExecutePool.java

@@ -1,42 +1,42 @@
-//package com.fd.thread;
-//
-//import org.springframework.beans.factory.annotation.Value;
-//import org.springframework.context.annotation.Bean;
-//import org.springframework.context.annotation.Configuration;
-//import org.springframework.scheduling.annotation.EnableAsync;
-//import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
-//
-//import java.util.concurrent.Executor;
-//import java.util.concurrent.ThreadPoolExecutor;
-//
-///**
-// * Created by owen on 2017/8/29.
-// */
-//@Configuration
-//@EnableAsync
-//public class TaskExecutePool {
-//
-//    @Value("${spring.task.pool.corePoolSize}")
-//    private int corePoolSize;
-//    @Value("${spring.task.pool.corePoolSize}")
-//    private int maxPoolSize;
-//    @Value("${spring.task.pool.keepAliveSeconds}")
-//    private int keepAliveSeconds;
-//    @Value("${spring.task.pool.queueCapacity}")
-//    private int queueCapacity;
-//
-//    @Bean
-//    public Executor taskExecutor() {
-//        ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
-//        executor.setCorePoolSize(corePoolSize);
-//        executor.setMaxPoolSize(maxPoolSize);
-//        executor.setQueueCapacity(keepAliveSeconds);
-//        executor.setKeepAliveSeconds(queueCapacity);
-//        executor.setThreadNamePrefix("MyExecutor-");
-//        // rejection-policy:当pool已经达到max size的时候,如何处理新任务
-//        // CALLER_RUNS:不在新线程中执行任务,而是由调用者所在的线程来执行
-//        executor.setRejectedExecutionHandler(new ThreadPoolExecutor.CallerRunsPolicy());
-//        executor.initialize();
-//        return executor;
-//    }
-//}
+package com.fd.thread;
+
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.scheduling.annotation.EnableAsync;
+import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
+
+import java.util.concurrent.Executor;
+import java.util.concurrent.ThreadPoolExecutor;
+
+/**
+ * Created by owen on 2017/8/29.
+ */
+@Configuration
+@EnableAsync
+public class TaskExecutePool {
+
+    @Value("${spring.task.pool.corePoolSize}")
+    private int corePoolSize;
+    @Value("${spring.task.pool.corePoolSize}")
+    private int maxPoolSize;
+    @Value("${spring.task.pool.keepAliveSeconds}")
+    private int keepAliveSeconds;
+    @Value("${spring.task.pool.queueCapacity}")
+    private int queueCapacity;
+
+    @Bean
+    public Executor taskExecutor() {
+        ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
+        executor.setCorePoolSize(corePoolSize);
+        executor.setMaxPoolSize(maxPoolSize);
+        executor.setQueueCapacity(keepAliveSeconds);
+        executor.setKeepAliveSeconds(queueCapacity);
+        executor.setThreadNamePrefix("MyExecutor-");
+        // rejection-policy:当pool已经达到max size的时候,如何处理新任务
+        // CALLER_RUNS:不在新线程中执行任务,而是由调用者所在的线程来执行
+        executor.setRejectedExecutionHandler(new ThreadPoolExecutor.CallerRunsPolicy());
+        executor.initialize();
+        return executor;
+    }
+}

+ 4 - 4
src/main/resources/application-dev.properties

@@ -2,7 +2,7 @@
 spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
 spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
 spring.datasource.url=jdbc:mysql://localhost:3306/gis_cesium?serverTimezone=GMT%2B8&useUnicode=true&characterEncoding=utf8&characterSetResults=utf8
 spring.datasource.url=jdbc:mysql://localhost:3306/gis_cesium?serverTimezone=GMT%2B8&useUnicode=true&characterEncoding=utf8&characterSetResults=utf8
 spring.datasource.username=root
 spring.datasource.username=root
-spring.datasource.password=123456
+spring.datasource.password=root
 
 
 logging.file=log/cesium.log
 logging.file=log/cesium.log
 
 
@@ -16,13 +16,13 @@ input.file.path.raster=/root/gis/cesium/input/raster/
 output.file.path.raster=/root/gis/cesium/output/raster/
 output.file.path.raster=/root/gis/cesium/output/raster/
 
 
 
 
-#发布服务地址
+#���������ַ
 copy.file.path.model=/root/gis/cesium/output/copy/
 copy.file.path.model=/root/gis/cesium/output/copy/
 copy.file.path.raster=/root/gis/cesium/output/copy/
 copy.file.path.raster=/root/gis/cesium/output/copy/
 copy.file.path.vector=/root/gis/cesium/output/copy/
 copy.file.path.vector=/root/gis/cesium/output/copy/
 
 
-#config.json 位
+#config.json 位锟斤拷
 config.path=/var/www/html/3dmap/config.json
 config.path=/var/www/html/3dmap/config.json
 
 
-#config.json的 teileset 的相对路径
+#config.json�� teileset �����·��
 config.tileset=../data/wuyidaxue/tileset.json
 config.tileset=../data/wuyidaxue/tileset.json

+ 1 - 1
src/main/resources/application.properties

@@ -11,7 +11,7 @@ spring.jpa.hibernate.ddl-auto=update
 spring.jpa.hibernate.naming.implicit-strategy=org.springframework.boot.orm.jpa.hibernate.SpringImplicitNamingStrategy
 spring.jpa.hibernate.naming.implicit-strategy=org.springframework.boot.orm.jpa.hibernate.SpringImplicitNamingStrategy
 spring.jpa.open-in-view=false
 spring.jpa.open-in-view=false
 
 
-#Ï̳߳Ø
+#�̳߳�
 spring.task.pool.corePoolSize=5
 spring.task.pool.corePoolSize=5
 spring.task.pool.maxPoolSize=100
 spring.task.pool.maxPoolSize=100
 spring.task.pool.keepAliveSeconds=100
 spring.task.pool.keepAliveSeconds=100