|
@@ -49,11 +49,6 @@ import java.util.concurrent.TimeUnit;
|
|
@RestController
|
|
@RestController
|
|
public class VectorController {
|
|
public class VectorController {
|
|
|
|
|
|
-//// @Value("${input.file.path.vector}")
|
|
|
|
-// private static String INPUT_FILE_PATH = "/root/gis/cesium/input/vector/";
|
|
|
|
-//
|
|
|
|
-//// @Value("${output.file.path.vector}")
|
|
|
|
-// private static String OUTPUT_FILE_PATH = "/root/gis/cesium/output/vector/";
|
|
|
|
|
|
|
|
@Value("${input.file.path.vector}")
|
|
@Value("${input.file.path.vector}")
|
|
private String INPUT_FILE_PATH;
|
|
private String INPUT_FILE_PATH;
|
|
@@ -92,28 +87,9 @@ public class VectorController {
|
|
|
|
|
|
private static BlockingQueue<MyQueue> vectorSliceQueue = new LinkedBlockingQueue<MyQueue>(2);
|
|
private static BlockingQueue<MyQueue> vectorSliceQueue = new LinkedBlockingQueue<MyQueue>(2);
|
|
|
|
|
|
- @GetMapping("test")
|
|
|
|
- private void test(){
|
|
|
|
- log.info("path: {}", OUTPUT_FILE_PATH);
|
|
|
|
- log.info("path input: {}", INPUT_FILE_PATH);
|
|
|
|
- }
|
|
|
|
|
|
|
|
|
|
|
|
- /**
|
|
|
|
- * 初始化队列
|
|
|
|
- *
|
|
|
|
- * @return
|
|
|
|
- */
|
|
|
|
-// @PostConstruct
|
|
|
|
-// private void init() {
|
|
|
|
-//
|
|
|
|
-// // 判断坐标消费队列
|
|
|
|
-// new Thread(new VectorJudgeCoordConsumerThread(vectorCoordQueue)).start();
|
|
|
|
-//
|
|
|
|
-//
|
|
|
|
-// new Thread(new VectorSliceThread(vectorSliceQueue)).start();
|
|
|
|
-//
|
|
|
|
-// }
|
|
|
|
|
|
+
|
|
|
|
|
|
|
|
|
|
@ApiOperation("上传矢量数据, coord:坐标(可以为空), 坐标格式:0,0,0,0,0,0,0")
|
|
@ApiOperation("上传矢量数据, coord:坐标(可以为空), 坐标格式:0,0,0,0,0,0,0")
|
|
@@ -128,7 +104,6 @@ public class VectorController {
|
|
if (RegexUtils.regexChinese(directoryName)) {
|
|
if (RegexUtils.regexChinese(directoryName)) {
|
|
return new R(51005, MsgCode.E51005);
|
|
return new R(51005, MsgCode.E51005);
|
|
}
|
|
}
|
|
-// VectorServer vectorServer = SpringContext.getBean(VectorServerImpl.class);
|
|
|
|
List<FileEntity> directory = vectorServer.findByDirectory(directoryName);
|
|
List<FileEntity> directory = vectorServer.findByDirectory(directoryName);
|
|
if (directory.size() > 0) {
|
|
if (directory.size() > 0) {
|
|
return new R(51006, MsgCode.E51006);
|
|
return new R(51006, MsgCode.E51006);
|
|
@@ -211,7 +186,6 @@ public class VectorController {
|
|
@ApiOperation("获取矢量数据列表")
|
|
@ApiOperation("获取矢量数据列表")
|
|
@PostMapping(value = "list")
|
|
@PostMapping(value = "list")
|
|
private R list(@RequestBody PageDto param) {
|
|
private R list(@RequestBody PageDto param) {
|
|
-// VectorServer vectorServer = SpringContext.getBean(VectorServerImpl.class);
|
|
|
|
return vectorServer.findByType(TypeCode.FILE_TYPE_VECTOR, param);
|
|
return vectorServer.findByType(TypeCode.FILE_TYPE_VECTOR, param);
|
|
}
|
|
}
|
|
|
|
|
|
@@ -225,7 +199,6 @@ 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);
|
|
-// VectorServer vectorServer = SpringContext.getBean(VectorServerImpl.class);
|
|
|
|
OutputFileEntity entity = vectorServer.findById(fileId);
|
|
OutputFileEntity entity = vectorServer.findById(fileId);
|
|
entity.setResStatus(1);
|
|
entity.setResStatus(1);
|
|
vectorServer.save(entity);
|
|
vectorServer.save(entity);
|
|
@@ -234,19 +207,12 @@ public class VectorController {
|
|
fileEntity.setResStatus(1);
|
|
fileEntity.setResStatus(1);
|
|
fileEntity = vectorServer.saveInputFile(fileEntity);
|
|
fileEntity = vectorServer.saveInputFile(fileEntity);
|
|
|
|
|
|
-// new Thread(new DeleteThread(fileId)).start();
|
|
|
|
-// deleteThread(fileId, vectorServer);
|
|
|
|
asyncTask.vectorDelete(fileId, vectorServer);
|
|
asyncTask.vectorDelete(fileId, vectorServer);
|
|
log.info("end delete vector id");
|
|
log.info("end delete vector id");
|
|
return new R(200, MsgCode.SUCCESS);
|
|
return new R(200, MsgCode.SUCCESS);
|
|
}
|
|
}
|
|
|
|
|
|
-// @Async("taskExecutor")
|
|
|
|
-// public void deleteThread(Long fileId, VectorServer vectorServer){
|
|
|
|
-// log.info("run deleteThread");
|
|
|
|
-// vectorServer.deleteById(fileId);
|
|
|
|
-// log.info("end deleteThread id : {}", fileId);
|
|
|
|
-// }
|
|
|
|
|
|
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@@ -254,7 +220,6 @@ public class VectorController {
|
|
@GetMapping("command/judge/coord/{fileId}/")
|
|
@GetMapping("command/judge/coord/{fileId}/")
|
|
private R cmdJudgeCoord(@PathVariable("fileId") Long fileId) {
|
|
private R cmdJudgeCoord(@PathVariable("fileId") Long fileId) {
|
|
log.info("run cmdJudgeCoord: {}", fileId);
|
|
log.info("run cmdJudgeCoord: {}", fileId);
|
|
-// VectorServer vectorServer = SpringContext.getBean(VectorServerImpl.class);
|
|
|
|
|
|
|
|
OutputFileEntity entity = vectorServer.findById(fileId);
|
|
OutputFileEntity entity = vectorServer.findById(fileId);
|
|
|
|
|
|
@@ -288,7 +253,6 @@ public class VectorController {
|
|
entity.setStatus(9);
|
|
entity.setStatus(9);
|
|
entity = vectorServer.save(entity);
|
|
entity = vectorServer.save(entity);
|
|
|
|
|
|
-// convertCoordThread(vectorCoordQueue, vectorServer);
|
|
|
|
asyncTask.vectorConvertCoordThread(vectorCoordQueue, vectorServer, OUTPUT_FILE_PATH);
|
|
asyncTask.vectorConvertCoordThread(vectorCoordQueue, vectorServer, OUTPUT_FILE_PATH);
|
|
|
|
|
|
return new R(200, entity);
|
|
return new R(200, entity);
|
|
@@ -299,80 +263,6 @@ public class VectorController {
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
-// /**
|
|
|
|
-// * 坐标判断消费队列
|
|
|
|
-// * 矢量数据转坐标只转一次就成功了。
|
|
|
|
-// * 所以转换的成功的路径都放到strictCoordTransform 路径
|
|
|
|
-// * 文件都放transform 目录
|
|
|
|
-// */
|
|
|
|
-// @Async("taskExecutor")
|
|
|
|
-// public void convertCoordThread (BlockingQueue<MyQueue> queue, VectorServer vectorServer){
|
|
|
|
-// try {
|
|
|
|
-// MyQueue data = queue.poll(2, TimeUnit.SECONDS);
|
|
|
|
-// if (data != null) {
|
|
|
|
-// log.info("run convertCoordThread 出队");
|
|
|
|
-// Thread.sleep(2000);
|
|
|
|
-// OutputFileEntity entity = data.getOutputFile();
|
|
|
|
-// // 坐标处理
|
|
|
|
-// String coord = entity.getCoord();
|
|
|
|
-// log.info("convert coord: {}", coord);
|
|
|
|
-// JSONArray arrayCoord = JSON.parseArray(coord);
|
|
|
|
-//
|
|
|
|
-//
|
|
|
|
-// // 转换坐标 普通坐标转换
|
|
|
|
-// if (TypeCode.COORD_SYSTEM_2000.equals(entity.getCoordType())) {
|
|
|
|
-// // 普通坐标转换
|
|
|
|
-// log.info("need to general transform");
|
|
|
|
-// if (arrayCoord.size() == 0) {
|
|
|
|
-// // 没有坐标参数,执行普通坐标转换(ogrinfo)
|
|
|
|
-// log.info("run generalCoordTransform");
|
|
|
|
-// entity = generalCoordTransform(entity, Command.VECTOR_TRANSFORM_GENERAL, vectorServer);
|
|
|
|
-//
|
|
|
|
-// } else {
|
|
|
|
-// // 有坐标参数,执行严格坐标转换(CGCS2000转wgs80)
|
|
|
|
-// log.info("run strictCoordTransform");
|
|
|
|
-// entity = strictCoordTransform(entity, Command.VECTOR_TRANSFORM_STRICT_WGS80, vectorServer);
|
|
|
|
-// }
|
|
|
|
-//
|
|
|
|
-// } else if (TypeCode.COORD_XIAN_1980.equals(entity.getCoordType())) {
|
|
|
|
-//
|
|
|
|
-// // 严格坐标转换 (西安80转wgs84),需要参数
|
|
|
|
-// log.info("need to strict transform, CoordType: {}", entity.getCoordType());
|
|
|
|
-// if (arrayCoord.size() == 0) {
|
|
|
|
-// log.info("error: {}", MsgCode.E50009);
|
|
|
|
-// entity.setStatus(7);
|
|
|
|
-// entity.setUpdateTime(new Date());
|
|
|
|
-// vectorServer.save(entity);
|
|
|
|
-// } else {
|
|
|
|
-// log.info("run strictCoordTransform");
|
|
|
|
-// entity = strictCoordTransform(entity, Command.VECTOR_TRANSFORM_STRICT_WGS84, vectorServer);
|
|
|
|
-// }
|
|
|
|
-//
|
|
|
|
-// } else if (TypeCode.COORD_WGS84.equals(entity.getCoordType())) {
|
|
|
|
-// // 不转换坐标 把文件信息移动到CoordStrictPath 这路径下
|
|
|
|
-// log.info("not to transform");
|
|
|
|
-//
|
|
|
|
-// entity.setCoordStrictPath(entity.getUploadPath());
|
|
|
|
-// entity.setUpdateTime(new Date());
|
|
|
|
-// entity.setStatus(3);
|
|
|
|
-// entity.setCoordType(TypeCode.COORD_WGS84);
|
|
|
|
-// vectorServer.save(entity);
|
|
|
|
-// } else {
|
|
|
|
-// log.info("error exeCmd");
|
|
|
|
-// entity.setStatus(7);
|
|
|
|
-// entity.setUpdateTime(new Date());
|
|
|
|
-// vectorServer.save(entity);
|
|
|
|
-// }
|
|
|
|
-// log.info("end convertCoordThread id: {}", entity.getId());
|
|
|
|
-// }
|
|
|
|
-// } catch (Exception e) {
|
|
|
|
-// Thread.currentThread().interrupt();
|
|
|
|
-// log.error("error vector consume queue VectorJudgeCoordConsumerThread: {}", e);
|
|
|
|
-// throw new RuntimeException(e);
|
|
|
|
-//
|
|
|
|
-//
|
|
|
|
-// }
|
|
|
|
-// }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@@ -380,7 +270,6 @@ public class VectorController {
|
|
@GetMapping("command/geojson/{fileId}/")
|
|
@GetMapping("command/geojson/{fileId}/")
|
|
private R cmdGeojson(@PathVariable("fileId") Long fileId) {
|
|
private R cmdGeojson(@PathVariable("fileId") Long fileId) {
|
|
log.info("run cmdGeojson: {}", fileId);
|
|
log.info("run cmdGeojson: {}", fileId);
|
|
-// VectorServer vectorServer = SpringContext.getBean(VectorServerImpl.class);
|
|
|
|
OutputFileEntity entity = vectorServer.findById(fileId);
|
|
OutputFileEntity entity = vectorServer.findById(fileId);
|
|
|
|
|
|
String fileName = StringUtils.substringBefore(entity.getFileName(), ".");
|
|
String fileName = StringUtils.substringBefore(entity.getFileName(), ".");
|
|
@@ -400,7 +289,6 @@ public class VectorController {
|
|
log.info("cmd: {}", cmd);
|
|
log.info("cmd: {}", cmd);
|
|
|
|
|
|
|
|
|
|
-// Integer integer = cmdServer.exeCmdInt(cmd);
|
|
|
|
Integer integer = vectorServer.exeCmd(cmd);
|
|
Integer integer = vectorServer.exeCmd(cmd);
|
|
if (integer != 0) {
|
|
if (integer != 0) {
|
|
return new R(50005, MsgCode.E50005);
|
|
return new R(50005, MsgCode.E50005);
|
|
@@ -420,7 +308,6 @@ public class VectorController {
|
|
private R cmdSlice(@PathVariable("fileId") Long fileId, @PathVariable("layerMin") String layerMin, @PathVariable("layerMax") String layerMax) {
|
|
private R cmdSlice(@PathVariable("fileId") Long fileId, @PathVariable("layerMin") String layerMin, @PathVariable("layerMax") String layerMax) {
|
|
log.info("run cmdSlice: {}", fileId);
|
|
log.info("run cmdSlice: {}", fileId);
|
|
|
|
|
|
-// VectorServer vectorServer = SpringContext.getBean(VectorServerImpl.class);
|
|
|
|
|
|
|
|
if (!RegexUtils.regexInt(layerMin)) {
|
|
if (!RegexUtils.regexInt(layerMin)) {
|
|
return new R(50010, MsgCode.E50010);
|
|
return new R(50010, MsgCode.E50010);
|
|
@@ -464,7 +351,6 @@ public class VectorController {
|
|
entity.setLayerMax(Integer.valueOf(layerMax));
|
|
entity.setLayerMax(Integer.valueOf(layerMax));
|
|
entity = vectorServer.save(entity);
|
|
entity = vectorServer.save(entity);
|
|
|
|
|
|
-// sliceThread(vectorSliceQueue, vectorServer);
|
|
|
|
asyncTask.vectorSliceThread(vectorSliceQueue, vectorServer);
|
|
asyncTask.vectorSliceThread(vectorSliceQueue, vectorServer);
|
|
|
|
|
|
return new R(200, entity);
|
|
return new R(200, entity);
|
|
@@ -473,41 +359,11 @@ public class VectorController {
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
-// private void sliceThread(BlockingQueue<MyQueue> queue, VectorServer vectorServer){
|
|
|
|
-// try {
|
|
|
|
-// MyQueue data = queue.poll(4, TimeUnit.SECONDS);
|
|
|
|
-// if (data != null) {
|
|
|
|
-// log.warn("run SliceVectorThread");
|
|
|
|
-//
|
|
|
|
-// OutputFileEntity entity = data.getOutputFile();
|
|
|
|
-// log.info("slice cmd: {}", data.getStr());
|
|
|
|
-// Integer integer = vectorServer.cmdSlice(data.getStr(), entity);
|
|
|
|
-// if (integer != 0) {
|
|
|
|
-// log.info("error command exeCmdVectorSlice");
|
|
|
|
-// // 如果命令运行失败,状态改为0
|
|
|
|
-// entity.setStatus(0);
|
|
|
|
-// entity.setUpdateTime(new Date());
|
|
|
|
-// vectorServer.save(entity);
|
|
|
|
-// return;
|
|
|
|
-// }
|
|
|
|
-// // 切片完成,修改完成状态
|
|
|
|
-// entity.setStatus(5);
|
|
|
|
-// entity.setUpdateTime(new Date());
|
|
|
|
-// vectorServer.save(entity);
|
|
|
|
-// log.warn("end SliceVectorThread");
|
|
|
|
-// }
|
|
|
|
-// } catch (Exception e) {
|
|
|
|
-// Thread.currentThread().interrupt();
|
|
|
|
-// log.error("error consume queue vector SliceConsumerThread: {}", e);
|
|
|
|
-// e.printStackTrace();
|
|
|
|
-// }
|
|
|
|
-// }
|
|
|
|
|
|
|
|
|
|
|
|
@ApiOperation("矢量数据进度查询")
|
|
@ApiOperation("矢量数据进度查询")
|
|
@GetMapping("progress/{fileId}/")
|
|
@GetMapping("progress/{fileId}/")
|
|
private R getProgress(@PathVariable("fileId") Long fileId) {
|
|
private R getProgress(@PathVariable("fileId") Long fileId) {
|
|
-// VectorServer vectorServer = SpringContext.getBean(VectorServerImpl.class);
|
|
|
|
OutputFileEntity entity = vectorServer.findById(fileId);
|
|
OutputFileEntity entity = vectorServer.findById(fileId);
|
|
return new R(200, entity);
|
|
return new R(200, entity);
|
|
}
|
|
}
|
|
@@ -516,7 +372,6 @@ public class VectorController {
|
|
@PostMapping("move/{fileId}/")
|
|
@PostMapping("move/{fileId}/")
|
|
private R moveFile(@PathVariable("fileId") Long fileId, @RequestBody ConfigJsonDto param) {
|
|
private R moveFile(@PathVariable("fileId") Long fileId, @RequestBody ConfigJsonDto param) {
|
|
log.info("run moveFile: {}", fileId);
|
|
log.info("run moveFile: {}", fileId);
|
|
-// VectorServer vectorServer = SpringContext.getBean(VectorServerImpl.class);
|
|
|
|
return vectorServer.moveFileToServer(fileId, param);
|
|
return vectorServer.moveFileToServer(fileId, param);
|
|
}
|
|
}
|
|
|
|
|
|
@@ -526,7 +381,6 @@ public class VectorController {
|
|
@PostMapping("style/save/")
|
|
@PostMapping("style/save/")
|
|
private R saveStyle(@RequestBody StyleDto param) {
|
|
private R saveStyle(@RequestBody StyleDto param) {
|
|
log.info("run saveStyle");
|
|
log.info("run saveStyle");
|
|
-// VectorServer vectorServer = SpringContext.getBean(VectorServerImpl.class);
|
|
|
|
return vectorServer.editStyle(param);
|
|
return vectorServer.editStyle(param);
|
|
}
|
|
}
|
|
|
|
|
|
@@ -534,73 +388,9 @@ public class VectorController {
|
|
@GetMapping("style/get/{fileId}/")
|
|
@GetMapping("style/get/{fileId}/")
|
|
private R getStyle(@PathVariable("fileId") Long fileId) {
|
|
private R getStyle(@PathVariable("fileId") Long fileId) {
|
|
log.info("run getStyle: {}", fileId);
|
|
log.info("run getStyle: {}", fileId);
|
|
-// VectorServer vectorServer = SpringContext.getBean(VectorServerImpl.class);
|
|
|
|
return vectorServer.getStyle(fileId);
|
|
return vectorServer.getStyle(fileId);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
-// /**
|
|
|
|
-// * 普通坐标转换
|
|
|
|
-// */
|
|
|
|
-// private OutputFileEntity generalCoordTransform(OutputFileEntity entity, String cmd, VectorServer vectorServer) {
|
|
|
|
-//
|
|
|
|
-// String directory = createDirectory(entity);
|
|
|
|
-// directory = directory + File.separator + entity.getFileName();
|
|
|
|
-//
|
|
|
|
-// cmd = cmd.replace("@inputFile", entity.getUploadPath());
|
|
|
|
-// cmd = cmd.replace("@outputFile", directory);
|
|
|
|
-// log.info("cmd: {}", cmd);
|
|
|
|
-// return runCmd(cmd, entity, null, directory, vectorServer);
|
|
|
|
-// }
|
|
|
|
-//
|
|
|
|
-//
|
|
|
|
-// // 严格坐标转换
|
|
|
|
-// private OutputFileEntity strictCoordTransform(OutputFileEntity entity, String cmd, VectorServer vectorServer) {
|
|
|
|
-//
|
|
|
|
-// String directory = createDirectory(entity);
|
|
|
|
-// directory = directory + File.separator + entity.getFileName();
|
|
|
|
-// String coord = entity.getCoord();
|
|
|
|
-// coord = coord.replace("[", "");
|
|
|
|
-// coord = coord.replace("]", "");
|
|
|
|
-// // 去空格
|
|
|
|
-// coord = StringUtils.deleteWhitespace(coord);
|
|
|
|
-//
|
|
|
|
-// cmd = cmd.replace("@coord", coord);
|
|
|
|
-// cmd = cmd.replace("@inputFile", entity.getUploadPath());
|
|
|
|
-// cmd = cmd.replace("@outputFile", directory);
|
|
|
|
-// log.info("cmd: {}", cmd);
|
|
|
|
-//
|
|
|
|
-// return runCmd(cmd, entity, null, directory, vectorServer);
|
|
|
|
-// }
|
|
|
|
-//
|
|
|
|
-// // 创建目录
|
|
|
|
-// private String createDirectory(OutputFileEntity entity) {
|
|
|
|
-// String directory = OUTPUT_FILE_PATH + "transform" + File.separator + entity.getDirectory();
|
|
|
|
-// FileUtils.createDir(directory);
|
|
|
|
-// return directory;
|
|
|
|
-// }
|
|
|
|
-//
|
|
|
|
-// // 执行命令,创建对象, 坐标转换使用
|
|
|
|
-// private OutputFileEntity runCmd(String cmd, OutputFileEntity entity, String generalPath, String strictPath, VectorServer vectorServer) {
|
|
|
|
-// Integer integer = vectorServer.exeCmd(cmd);
|
|
|
|
-// // 转换坐标失败, 修改状态
|
|
|
|
-// if (integer != 0) {
|
|
|
|
-// entity.setUpdateTime(new Date());
|
|
|
|
-// entity.setStatus(7);
|
|
|
|
-// entity = vectorServer.save(entity);
|
|
|
|
-// return null;
|
|
|
|
-// }
|
|
|
|
-//
|
|
|
|
-// entity.setFileName(entity.getFileName());
|
|
|
|
-// entity.setCoordGeneralPath(generalPath);
|
|
|
|
-// entity.setCoordStrictPath(strictPath);
|
|
|
|
-// entity.setUpdateTime(new Date());
|
|
|
|
-// entity.setStatus(3);
|
|
|
|
-//
|
|
|
|
-// entity = vectorServer.save(entity);
|
|
|
|
-//
|
|
|
|
-// return entity;
|
|
|
|
-//
|
|
|
|
-// }
|
|
|
|
|
|
|
|
}
|
|
}
|