|
@@ -1,11 +1,13 @@
|
|
package com.fd.server.impl;
|
|
package com.fd.server.impl;
|
|
|
|
|
|
|
|
+import cn.hutool.core.date.DateTime;
|
|
|
|
+import cn.hutool.core.date.DateUtil;
|
|
import com.alibaba.fastjson.JSON;
|
|
import com.alibaba.fastjson.JSON;
|
|
import com.alibaba.fastjson.JSONArray;
|
|
import com.alibaba.fastjson.JSONArray;
|
|
import com.alibaba.fastjson.JSONObject;
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
|
+import com.fd.constant.Command;
|
|
import com.fd.constant.MsgCode;
|
|
import com.fd.constant.MsgCode;
|
|
import com.fd.constant.TypeCode;
|
|
import com.fd.constant.TypeCode;
|
|
-import com.fd.constant.UserCode;
|
|
|
|
import com.fd.dto.ConfigJsonDto;
|
|
import com.fd.dto.ConfigJsonDto;
|
|
import com.fd.dto.PageDto;
|
|
import com.fd.dto.PageDto;
|
|
import com.fd.dto.StyleDto;
|
|
import com.fd.dto.StyleDto;
|
|
@@ -19,6 +21,7 @@ import com.fd.repository.StyleRepository;
|
|
import com.fd.repository.UserRepository;
|
|
import com.fd.repository.UserRepository;
|
|
import com.fd.server.VectorServer;
|
|
import com.fd.server.VectorServer;
|
|
import com.fd.shiro.JWTUtil;
|
|
import com.fd.shiro.JWTUtil;
|
|
|
|
+import com.fd.util.CmdUtil;
|
|
import com.fd.util.FileUtils;
|
|
import com.fd.util.FileUtils;
|
|
import com.fd.util.R;
|
|
import com.fd.util.R;
|
|
import com.fd.util.RegexUtils;
|
|
import com.fd.util.RegexUtils;
|
|
@@ -166,6 +169,11 @@ public class VectorServerImpl extends BaseServerImpl implements VectorServer {
|
|
deleteFolder(path, entity);
|
|
deleteFolder(path, entity);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ if (entity.getWfsPath() != null) {
|
|
|
|
+ String path = entity.getWfsPath();
|
|
|
|
+ deleteFolder(path, entity);
|
|
|
|
+ }
|
|
|
|
+
|
|
// 文件类型
|
|
// 文件类型
|
|
if (entity.getGeojsonPath() != null) {
|
|
if (entity.getGeojsonPath() != null) {
|
|
log.info("test file geojson");
|
|
log.info("test file geojson");
|
|
@@ -568,6 +576,132 @@ public class VectorServerImpl extends BaseServerImpl implements VectorServer {
|
|
return isCmd;
|
|
return isCmd;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
+ * 精准查询
|
|
|
|
+ *
|
|
|
|
+ * @param fileId
|
|
|
|
+ * @param fileName 字段名
|
|
|
|
+ * @param value 字段值
|
|
|
|
+ * @return
|
|
|
|
+ */
|
|
|
|
+ @Override
|
|
|
|
+ public R wfsAccurate(Long fileId, String fileName, String value) {
|
|
|
|
+ log.warn("run wfsAccurate");
|
|
|
|
+
|
|
|
|
+ OutputFileEntity entity = getOutputFileEntity(fileId);
|
|
|
|
+ if (entity == null){
|
|
|
|
+ new R(50002, MsgCode.E50002);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ String cmd = Command.VECTOR_WFS_ACCURATE;
|
|
|
|
+ String outFile = OUTPUT_FILE_PATH + "wfs" + File.separator + entity.getDirectory();
|
|
|
|
+ FileUtils.createDir(outFile);
|
|
|
|
+ String timeName = DateUtil.format(new DateTime(), "yyyyMMdd_HHmmss");
|
|
|
|
+ timeName = outFile + File.separator + timeName + ".json";
|
|
|
|
+
|
|
|
|
+ // 需要坐标转换后的shp文件
|
|
|
|
+ cmd = cmd.replace("@inputFile", entity.getCoordStrictPath());
|
|
|
|
+ cmd = cmd.replace("@outputFile", timeName);
|
|
|
|
+ cmd = cmd.replace("@fileName", fileName);
|
|
|
|
+ cmd = cmd.replace("@value", value);
|
|
|
|
+
|
|
|
|
+ Integer integer = CmdUtil.exeCmdSingle(cmd);
|
|
|
|
+ JSONObject original = null;
|
|
|
|
+ if (integer == 0) {
|
|
|
|
+ String s = FileUtils.readJsonLinux(timeName);
|
|
|
|
+ original = JSON.parseObject(s);
|
|
|
|
+
|
|
|
|
+ if (entity.getWfsPath() == null) {
|
|
|
|
+ //保存信息
|
|
|
|
+ entity.setWfsPath(outFile);
|
|
|
|
+ entity.setUpdateTime(new DateTime());
|
|
|
|
+ outputFileRepository.save(entity);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+ log.warn("end wfsAccurate");
|
|
|
|
+ return new R(200, original);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public R wfsLike(Long fileId, String fileName, String value) {
|
|
|
|
+ log.warn("run wfsLike");
|
|
|
|
+
|
|
|
|
+ OutputFileEntity entity = getOutputFileEntity(fileId);
|
|
|
|
+ if (entity == null){
|
|
|
|
+ new R(50002, MsgCode.E50002);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ String cmd = Command.VECTOR_WFS_LIKE;
|
|
|
|
+ String outFile = OUTPUT_FILE_PATH + "wfs" + File.separator + entity.getDirectory();
|
|
|
|
+ FileUtils.createDir(outFile);
|
|
|
|
+ String timeName = DateUtil.format(new DateTime(), "yyyyMMdd_HHmmss");
|
|
|
|
+ timeName = outFile + File.separator + timeName + ".json";
|
|
|
|
+
|
|
|
|
+ // 需要坐标转换后的shp文件
|
|
|
|
+ cmd = cmd.replace("@inputFile", entity.getCoordStrictPath());
|
|
|
|
+ cmd = cmd.replace("@outputFile", timeName);
|
|
|
|
+ cmd = cmd.replace("@fileName", fileName);
|
|
|
|
+ cmd = cmd.replace("@value", value);
|
|
|
|
+
|
|
|
|
+ Integer integer = CmdUtil.exeCmdSingle(cmd);
|
|
|
|
+ JSONObject original = null;
|
|
|
|
+ if (integer == 0) {
|
|
|
|
+ String s = FileUtils.readJsonLinux(timeName);
|
|
|
|
+ original = JSON.parseObject(s);
|
|
|
|
+
|
|
|
|
+ if (entity.getWfsPath() == null) {
|
|
|
|
+ //保存信息
|
|
|
|
+ entity.setWfsPath(outFile);
|
|
|
|
+ entity.setUpdateTime(new DateTime());
|
|
|
|
+ outputFileRepository.save(entity);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+ log.warn("end wfsLike");
|
|
|
|
+ return new R(200, original);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public R wfsScope(Long fileId, String xMin, String yMin, String xMax, String yMax) {
|
|
|
|
+ log.warn("run wfsScope");
|
|
|
|
+
|
|
|
|
+ OutputFileEntity entity = getOutputFileEntity(fileId);
|
|
|
|
+ if (entity == null){
|
|
|
|
+ new R(50002, MsgCode.E50002);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ String cmd = Command.VECTOR_WFS_SCOPE;
|
|
|
|
+ String outFile = OUTPUT_FILE_PATH + "wfs" + File.separator + entity.getDirectory();
|
|
|
|
+ FileUtils.createDir(outFile);
|
|
|
|
+ String timeName = DateUtil.format(new DateTime(), "yyyyMMdd_HHmmss");
|
|
|
|
+ timeName = outFile + File.separator + timeName + ".json";
|
|
|
|
+
|
|
|
|
+ // 需要坐标转换后的shp文件
|
|
|
|
+ cmd = cmd.replace("@inputFile", entity.getCoordStrictPath());
|
|
|
|
+ cmd = cmd.replace("@outputFile", timeName);
|
|
|
|
+ cmd = cmd.replace("@xMin", xMin);
|
|
|
|
+ cmd = cmd.replace("@yMin", yMin);
|
|
|
|
+ cmd = cmd.replace("@xMax", xMax);
|
|
|
|
+ cmd = cmd.replace("@yMax", yMax);
|
|
|
|
+
|
|
|
|
+ Integer integer = CmdUtil.exeCmdSingle(cmd);
|
|
|
|
+ JSONObject original = null;
|
|
|
|
+ if (integer == 0) {
|
|
|
|
+ String s = FileUtils.readJsonLinux(timeName);
|
|
|
|
+ original = JSON.parseObject(s);
|
|
|
|
+
|
|
|
|
+ if (entity.getWfsPath() == null) {
|
|
|
|
+ //保存信息
|
|
|
|
+ entity.setWfsPath(outFile);
|
|
|
|
+ entity.setUpdateTime(new DateTime());
|
|
|
|
+ outputFileRepository.save(entity);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ log.warn("end wfsScope");
|
|
|
|
+ return new R(200, original);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
|
|
private Integer exeCmdSingle(String commandStr) {
|
|
private Integer exeCmdSingle(String commandStr) {
|
|
|
|
|
|
@@ -785,6 +919,14 @@ public class VectorServerImpl extends BaseServerImpl implements VectorServer {
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ private OutputFileEntity getOutputFileEntity(Long id) {
|
|
|
|
+ Optional<OutputFileEntity> o = outputFileRepository.findById(id);
|
|
|
|
+ if (o.isPresent()) {
|
|
|
|
+ return o.get();
|
|
|
|
+ }
|
|
|
|
+ return null;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
|
|
public static void main(String[] args) throws IOException {
|
|
public static void main(String[] args) throws IOException {
|
|
|
|
|