|
@@ -10,6 +10,7 @@ import com.fd.entity.FileEntity;
|
|
|
import com.fd.entity.OutputFileEntity;
|
|
|
import com.fd.entity.StyleEntity;
|
|
|
import com.fd.server.VectorServer;
|
|
|
+import com.fd.shiro.JWTUtil;
|
|
|
import com.fd.thread.AsyncTask;
|
|
|
import com.fd.util.FileUtils;
|
|
|
import com.fd.util.R;
|
|
@@ -19,9 +20,11 @@ import lombok.extern.log4j.Log4j2;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
|
+import org.springframework.data.domain.Page;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
|
|
|
|
+import javax.servlet.http.HttpServletRequest;
|
|
|
import java.io.File;
|
|
|
import java.util.Arrays;
|
|
|
import java.util.Date;
|
|
@@ -92,12 +95,14 @@ public class VectorController {
|
|
|
|
|
|
@ApiOperation("上传矢量数据, coord:坐标(可以为空), 坐标格式:0,0,0,0,0,0,0")
|
|
|
@PostMapping(value = "uploadMult/{directoryName}", consumes = {"multipart/form-data"})
|
|
|
- private R uploadMult(@RequestParam("file") MultipartFile[] file,
|
|
|
+ public R uploadMult(@RequestParam("file") MultipartFile[] file,
|
|
|
@PathVariable("directoryName") String directoryName,
|
|
|
- @RequestParam(value = "coord", required = false) String[] coord) {
|
|
|
+ @RequestParam(value = "coord", required = false) String[] coord, HttpServletRequest req) {
|
|
|
log.info("run uploadMult");
|
|
|
log.info("coord: {}", Arrays.toString(coord));
|
|
|
|
|
|
+ String token = req.getHeader("Authorization");
|
|
|
+
|
|
|
// 文件是否包含中文字符
|
|
|
if (RegexUtils.regexChinese(directoryName)) {
|
|
|
return new R(51005, MsgCode.E51005);
|
|
@@ -109,7 +114,7 @@ public class VectorController {
|
|
|
|
|
|
String strCoord = Arrays.toString(coord);
|
|
|
|
|
|
- R r = vectorServer.uploadDirectoryFileMul(file, directoryName, strCoord);
|
|
|
+ R r = vectorServer.uploadDirectoryFileMul(file, directoryName, strCoord, token);
|
|
|
|
|
|
// 判断文件是否有错误
|
|
|
if (r.getStatus() != 200) {
|
|
@@ -183,8 +188,11 @@ public class VectorController {
|
|
|
|
|
|
@ApiOperation("获取矢量数据列表")
|
|
|
@PostMapping(value = "list")
|
|
|
- private R list(@RequestBody PageDto param) {
|
|
|
- return vectorServer.findByType(TypeCode.FILE_TYPE_VECTOR, param);
|
|
|
+ public R list(@RequestBody PageDto param, HttpServletRequest req) {
|
|
|
+ String token = req.getHeader("Authorization");
|
|
|
+// return vectorServer.findByType(TypeCode.FILE_TYPE_VECTOR, param);
|
|
|
+ Page<OutputFileEntity> list = vectorServer.findByList(param, token);
|
|
|
+ return new R(200, list);
|
|
|
}
|
|
|
|
|
|
|
|
@@ -195,7 +203,7 @@ public class VectorController {
|
|
|
*/
|
|
|
@ApiOperation("删除文件")
|
|
|
@GetMapping("delete/{fileId}/")
|
|
|
- private R deleteFile(@PathVariable("fileId") Long fileId) {
|
|
|
+ public R deleteFile(@PathVariable("fileId") Long fileId) {
|
|
|
log.info("run deleteFile: {}", fileId);
|
|
|
OutputFileEntity entity = vectorServer.findById(fileId);
|
|
|
entity.setResStatus(1);
|
|
@@ -216,7 +224,7 @@ public class VectorController {
|
|
|
|
|
|
@ApiOperation("矢量数据判断坐标")
|
|
|
@GetMapping("command/judge/coord/{fileId}/")
|
|
|
- private R cmdJudgeCoord(@PathVariable("fileId") Long fileId) {
|
|
|
+ public R cmdJudgeCoord(@PathVariable("fileId") Long fileId) {
|
|
|
log.info("run cmdJudgeCoord: {}", fileId);
|
|
|
|
|
|
OutputFileEntity entity = vectorServer.findById(fileId);
|
|
@@ -263,12 +271,12 @@ public class VectorController {
|
|
|
|
|
|
@ApiOperation("矢量数据转geojson")
|
|
|
@GetMapping("command/geojson/{fileId}/")
|
|
|
- private R cmdGeojson(@PathVariable("fileId") Long fileId) {
|
|
|
+ public R cmdGeojson(@PathVariable("fileId") Long fileId) {
|
|
|
log.info("run cmdGeojson: {}", fileId);
|
|
|
OutputFileEntity entity = vectorServer.findById(fileId);
|
|
|
|
|
|
String fileName = StringUtils.substringBefore(entity.getFileName(), ".");
|
|
|
-// // 截取目录名称
|
|
|
+ // 截取目录名称
|
|
|
log.info("json path: {}", OUTPUT_FILE_PATH);
|
|
|
String outPath = OUTPUT_FILE_PATH + "geojson" + File.separator + entity.getDirectory();
|
|
|
FileUtils.createDir(outPath);
|
|
@@ -300,7 +308,7 @@ public class VectorController {
|
|
|
|
|
|
@ApiOperation("矢量数据切片")
|
|
|
@GetMapping("command/slice/{fileId}/{layerMin}/{layerMax}/")
|
|
|
- private R cmdSlice(@PathVariable("fileId") Long fileId, @PathVariable("layerMin") String layerMin, @PathVariable("layerMax") String layerMax) {
|
|
|
+ public R cmdSlice(@PathVariable("fileId") Long fileId, @PathVariable("layerMin") String layerMin, @PathVariable("layerMax") String layerMax) {
|
|
|
log.info("run cmdSlice: {}", fileId);
|
|
|
|
|
|
|
|
@@ -355,14 +363,14 @@ public class VectorController {
|
|
|
|
|
|
@ApiOperation("矢量数据进度查询")
|
|
|
@GetMapping("progress/{fileId}/")
|
|
|
- private R getProgress(@PathVariable("fileId") Long fileId) {
|
|
|
+ public R getProgress(@PathVariable("fileId") Long fileId) {
|
|
|
OutputFileEntity entity = vectorServer.findById(fileId);
|
|
|
return new R(200, entity);
|
|
|
}
|
|
|
|
|
|
@ApiOperation("移动数据到服务器上")
|
|
|
@PostMapping("move/{fileId}/")
|
|
|
- private R moveFile(@PathVariable("fileId") Long fileId, @RequestBody ConfigJsonDto param) {
|
|
|
+ public R moveFile(@PathVariable("fileId") Long fileId, @RequestBody ConfigJsonDto param) {
|
|
|
log.info("run moveFile: {}", fileId);
|
|
|
return vectorServer.moveFileToServer(fileId, param);
|
|
|
}
|
|
@@ -371,14 +379,14 @@ public class VectorController {
|
|
|
|
|
|
@ApiOperation("保存样式")
|
|
|
@PostMapping("style/save/")
|
|
|
- private R saveStyle(@RequestBody StyleDto param) {
|
|
|
+ public R saveStyle(@RequestBody StyleDto param) {
|
|
|
log.info("run saveStyle");
|
|
|
return vectorServer.editStyle(param);
|
|
|
}
|
|
|
|
|
|
@ApiOperation("获取样式")
|
|
|
@GetMapping("style/get/{fileId}/")
|
|
|
- private R getStyle(@PathVariable("fileId") Long fileId) {
|
|
|
+ public R getStyle(@PathVariable("fileId") Long fileId) {
|
|
|
log.info("run getStyle: {}", fileId);
|
|
|
return vectorServer.getStyle(fileId);
|
|
|
}
|