|
@@ -52,7 +52,7 @@ public class VectorController {
|
|
@Autowired
|
|
@Autowired
|
|
private CmdServer cmdServer;
|
|
private CmdServer cmdServer;
|
|
|
|
|
|
- BlockingQueue<MyQueue> coordQueue = new LinkedBlockingQueue<MyQueue>(5);
|
|
|
|
|
|
+ BlockingQueue<MyQueue> vectorCoordQueue = new LinkedBlockingQueue<MyQueue>(5);
|
|
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -64,7 +64,7 @@ public class VectorController {
|
|
private void init() {
|
|
private void init() {
|
|
|
|
|
|
// 判断坐标消费队列
|
|
// 判断坐标消费队列
|
|
- new Thread(new JudgeCoordConsumerThread(coordQueue)).start();
|
|
|
|
|
|
+ new Thread(new VectorJudgeCoordConsumerThread(vectorCoordQueue)).start();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@@ -104,6 +104,7 @@ public class VectorController {
|
|
@PathVariable("directoryName") String directoryName,
|
|
@PathVariable("directoryName") String directoryName,
|
|
@RequestParam(value = "coord",required = false) String coord){
|
|
@RequestParam(value = "coord",required = false) String coord){
|
|
log.info("run uploadVector");
|
|
log.info("run uploadVector");
|
|
|
|
+ log.info("coord: {}", coord);
|
|
return vectorServer.uploadDirectoryFile(file, directoryName, coord);
|
|
return vectorServer.uploadDirectoryFile(file, directoryName, coord);
|
|
}
|
|
}
|
|
|
|
|
|
@@ -172,8 +173,7 @@ public class VectorController {
|
|
@ApiOperation("获取矢量数据列表")
|
|
@ApiOperation("获取矢量数据列表")
|
|
@PostMapping(value = "list")
|
|
@PostMapping(value = "list")
|
|
private R list(@RequestBody PageDto param){
|
|
private R list(@RequestBody PageDto param){
|
|
- log.info("run list");
|
|
|
|
-// return fileServer.findByType(TypeCode.FILE_TYPE_VECTOR, TypeCode.FILE_TYPE_VECTOR_SHP, param);
|
|
|
|
|
|
+// log.info("run list");
|
|
return vectorServer.findByType(TypeCode.FILE_TYPE_VECTOR, param);
|
|
return vectorServer.findByType(TypeCode.FILE_TYPE_VECTOR, param);
|
|
}
|
|
}
|
|
|
|
|
|
@@ -184,7 +184,7 @@ 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 fileServer.deleteById(fileId);
|
|
|
|
|
|
+ return vectorServer.deleteById(fileId);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
@@ -196,7 +196,9 @@ public class VectorController {
|
|
// FileEntity entity = fileServer.findById(fileId);
|
|
// FileEntity entity = fileServer.findById(fileId);
|
|
|
|
|
|
OutputFileEntity entity = vectorServer.findById(fileId);
|
|
OutputFileEntity entity = vectorServer.findById(fileId);
|
|
-
|
|
|
|
|
|
+ entity.setUpdateTime(new Date());
|
|
|
|
+ entity.setStatus(9);
|
|
|
|
+ entity = vectorServer.save(entity);
|
|
|
|
|
|
String coord = entity.getCoord();
|
|
String coord = entity.getCoord();
|
|
log.info("coord: {}", coord);
|
|
log.info("coord: {}", coord);
|
|
@@ -212,7 +214,7 @@ public class VectorController {
|
|
data.setOutputFile(entity);
|
|
data.setOutputFile(entity);
|
|
data.setStr(cmd);
|
|
data.setStr(cmd);
|
|
try {
|
|
try {
|
|
- coordQueue.offer(data, 1, TimeUnit.SECONDS);
|
|
|
|
|
|
+ vectorCoordQueue.offer(data, 1, TimeUnit.SECONDS);
|
|
log.info("入队成功");
|
|
log.info("入队成功");
|
|
} catch (InterruptedException e) {
|
|
} catch (InterruptedException e) {
|
|
e.printStackTrace();
|
|
e.printStackTrace();
|
|
@@ -255,22 +257,26 @@ public class VectorController {
|
|
return new R(200, entity);
|
|
return new R(200, entity);
|
|
}
|
|
}
|
|
|
|
|
|
- public class JudgeCoordConsumerThread implements Runnable{
|
|
|
|
|
|
+ /**
|
|
|
|
+ * 坐标判断消费队列
|
|
|
|
+ */
|
|
|
|
+ public class VectorJudgeCoordConsumerThread implements Runnable{
|
|
|
|
|
|
private BlockingQueue<MyQueue> queue;
|
|
private BlockingQueue<MyQueue> queue;
|
|
|
|
|
|
private boolean isRun = true;
|
|
private boolean isRun = true;
|
|
- public JudgeCoordConsumerThread(BlockingQueue<MyQueue> queue){
|
|
|
|
|
|
+ public VectorJudgeCoordConsumerThread(BlockingQueue<MyQueue> queue){
|
|
this.queue = queue;
|
|
this.queue = queue;
|
|
}
|
|
}
|
|
|
|
|
|
@Override
|
|
@Override
|
|
public void run() {
|
|
public void run() {
|
|
- while (isRun) {
|
|
|
|
|
|
+ log.info("run VectorJudgeCoordConsumerThread 出队");
|
|
|
|
+ while (true) {
|
|
try {
|
|
try {
|
|
MyQueue data = queue.poll(2, TimeUnit.SECONDS);
|
|
MyQueue data = queue.poll(2, TimeUnit.SECONDS);
|
|
if (data != null) {
|
|
if (data != null) {
|
|
- log.info("消费者,拿到队列中的数据data:" + data.toString());
|
|
|
|
|
|
+ log.info("消费者,拿到队列中的数据data: " + data.toString());
|
|
|
|
|
|
Integer isJudge = cmdServer.exeCmdJudgeCoord(data.getStr());
|
|
Integer isJudge = cmdServer.exeCmdJudgeCoord(data.getStr());
|
|
OutputFileEntity entity = data.getOutputFile();
|
|
OutputFileEntity entity = data.getOutputFile();
|
|
@@ -295,22 +301,28 @@ public class VectorController {
|
|
log.info("error: {}", MsgCode.E50009);
|
|
log.info("error: {}", MsgCode.E50009);
|
|
|
|
|
|
entity.setStatus(7);
|
|
entity.setStatus(7);
|
|
|
|
+ entity.setUpdateTime(new Date());
|
|
vectorServer.save(entity);
|
|
vectorServer.save(entity);
|
|
|
|
+ } else {
|
|
|
|
+
|
|
|
|
+ entity = strictCoordTransform(entity, Command.VECTOR_TRANSFORM_STRICT_WGS84);
|
|
}
|
|
}
|
|
- entity = strictCoordTransform(entity, Command.VECTOR_TRANSFORM_STRICT_WGS84);
|
|
|
|
|
|
|
|
} else if (0 == isJudge){ // 不转换坐标
|
|
} else if (0 == isJudge){ // 不转换坐标
|
|
log.info("not to transform");
|
|
log.info("not to transform");
|
|
- entity = entity;
|
|
|
|
|
|
+ entity.setUpdateTime(new Date());
|
|
|
|
+ entity.setStatus(3);
|
|
|
|
+ vectorServer.save(entity);
|
|
} else {
|
|
} else {
|
|
log.info("error exeCmd");
|
|
log.info("error exeCmd");
|
|
entity.setStatus(7);
|
|
entity.setStatus(7);
|
|
|
|
+ entity.setUpdateTime(new Date());
|
|
vectorServer.save(entity);
|
|
vectorServer.save(entity);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
// Thread.sleep(4000);
|
|
// Thread.sleep(4000);
|
|
} catch (InterruptedException e) {
|
|
} catch (InterruptedException e) {
|
|
- isRun = false;
|
|
|
|
|
|
+// isRun = false;
|
|
e.printStackTrace();
|
|
e.printStackTrace();
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -325,9 +337,7 @@ public class VectorController {
|
|
|
|
|
|
String fileName = StringUtils.substringBefore(entity.getFileName(), ".");
|
|
String fileName = StringUtils.substringBefore(entity.getFileName(), ".");
|
|
// // 截取目录名称
|
|
// // 截取目录名称
|
|
-// String fileUrl = entity.getUploadPath();
|
|
|
|
-// String outputFile = StringUtils.substringBefore(fileUrl, ".");
|
|
|
|
-// outputFile = outputFile + ".json";
|
|
|
|
|
|
+
|
|
String outPath = OUTPUT_FILE_PATH + "geojson";
|
|
String outPath = OUTPUT_FILE_PATH + "geojson";
|
|
FileUtils.createDir(outPath);
|
|
FileUtils.createDir(outPath);
|
|
outPath = outPath +File.separator + fileName + ".json";
|
|
outPath = outPath +File.separator + fileName + ".json";
|
|
@@ -354,15 +364,6 @@ public class VectorController {
|
|
return new R(50005, MsgCode.E50005);
|
|
return new R(50005, MsgCode.E50005);
|
|
}
|
|
}
|
|
|
|
|
|
-// FileEntity fileEntity = new FileEntity();
|
|
|
|
-// fileEntity.setFileName(fileName + ".json");
|
|
|
|
-// fileEntity.setFileUrl(outputFile);
|
|
|
|
-// fileEntity.setCreateTime(new Date());
|
|
|
|
-// fileEntity.setUpdateTime(new Date());
|
|
|
|
-// fileEntity.setType(TypeCode.FILE_TYPE_VECTOR);
|
|
|
|
-// fileEntity.setStatus(4);
|
|
|
|
-
|
|
|
|
-
|
|
|
|
entity.setGeojsonPath(outPath);
|
|
entity.setGeojsonPath(outPath);
|
|
entity.setUpdateTime(new Date());
|
|
entity.setUpdateTime(new Date());
|
|
entity.setStatus(4);
|
|
entity.setStatus(4);
|
|
@@ -397,16 +398,6 @@ public class VectorController {
|
|
return new R(50005, MsgCode.E50005);
|
|
return new R(50005, MsgCode.E50005);
|
|
}
|
|
}
|
|
|
|
|
|
-// FileEntity fileEntity = new FileEntity();
|
|
|
|
-// fileEntity.setFileName(fileName + ".mbtiles");
|
|
|
|
-// fileEntity.setFileUrl(outputFile);
|
|
|
|
-// fileEntity.setCreateTime(new Date());
|
|
|
|
-// fileEntity.setUpdateTime(new Date());
|
|
|
|
-// fileEntity.setType(TypeCode.FILE_TYPE_VECTOR);
|
|
|
|
-// fileEntity.setStatus(5);
|
|
|
|
-//
|
|
|
|
-// fileEntity = fileServer.save(fileEntity);
|
|
|
|
-
|
|
|
|
entity.setSlicePath(outPath);
|
|
entity.setSlicePath(outPath);
|
|
entity.setUpdateTime(new Date());
|
|
entity.setUpdateTime(new Date());
|
|
entity.setStatus(5);
|
|
entity.setStatus(5);
|