|
|
@@ -1,5 +1,6 @@
|
|
|
package com.onemap.overlap.service.impl;
|
|
|
|
|
|
+import cn.hutool.http.useragent.Browser;
|
|
|
import com.onemap.common.core.utils.StringUtils;
|
|
|
import com.onemap.common.core.web.domain.RequestResult;
|
|
|
import com.onemap.common.security.utils.SecurityUtils;
|
|
|
@@ -20,6 +21,7 @@ import org.springframework.web.multipart.MultipartFile;
|
|
|
import javax.servlet.ServletException;
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
+import javax.swing.*;
|
|
|
import java.awt.*;
|
|
|
import java.io.*;
|
|
|
import java.nio.file.*;
|
|
|
@@ -295,7 +297,8 @@ public class DataImp implements DataService {
|
|
|
try {
|
|
|
Connection connection = SpatialiteUtils.getSpatialiteConnection(dbpath);
|
|
|
Statement statement = connection.createStatement();
|
|
|
- String querySQL = "select layername,type,isvalid from t_model where modelname = '" + modelname + "'";
|
|
|
+ String querySQL = "select layername,type,isvalid from t_model where modelname = '" + modelname + "' union all " +
|
|
|
+ "select layername , '外部', '失效' from t_base_vector where layername not in (select layername from t_model where modelname = '" + modelname + "')";
|
|
|
ResultSet resultSet = statement.executeQuery(querySQL);
|
|
|
List<Map> res = new ArrayList<Map>();
|
|
|
while (resultSet.next()) {
|
|
|
@@ -509,11 +512,14 @@ public class DataImp implements DataService {
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public RequestResult getTableGeoms(String tablename) {
|
|
|
+ public RequestResult getTableGeoms(String tablename, String swid) {
|
|
|
try {
|
|
|
Connection connection = SpatialiteUtils.getSpatialiteConnection(dbpath);
|
|
|
Statement statement = connection.createStatement();
|
|
|
String querySQL = "select swid , astext(geom) as geom from " + tablename;
|
|
|
+ if (StringUtils.isNotEmpty(swid)) {
|
|
|
+ querySQL += " where swid = '" + swid + "'";
|
|
|
+ }
|
|
|
ResultSet resultSet = statement.executeQuery(querySQL);
|
|
|
List<Map> res = new ArrayList<Map>();
|
|
|
while (resultSet.next()) {
|
|
|
@@ -522,8 +528,14 @@ public class DataImp implements DataService {
|
|
|
cur.put("geom", resultSet.getString("geom"));
|
|
|
res.add(cur);
|
|
|
}
|
|
|
+ querySQL = "select serviceproj from t_analyse_vector t where t.tablename = '" + tablename + "'";
|
|
|
+ resultSet = statement.executeQuery(querySQL);
|
|
|
+ String proj = resultSet.getString("serviceproj");
|
|
|
connection.close();
|
|
|
- return RequestResult.success("查询成功!", res);
|
|
|
+ Map<String, Object> result = new HashMap<>();
|
|
|
+ result.put("geom", res);
|
|
|
+ result.put("proj", proj);
|
|
|
+ return RequestResult.success("查询成功!", result);
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
|
}
|
|
|
@@ -558,11 +570,18 @@ public class DataImp implements DataService {
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public RequestResult getTableRecord(String tablename, Integer page, Integer limit) {
|
|
|
+ public RequestResult getTableRecord(String tablename, Integer page, Integer limit, String swid, String hfxpd) {
|
|
|
try {
|
|
|
Connection connection = SpatialiteUtils.getSpatialiteConnection(dbpath);
|
|
|
Statement statement = connection.createStatement();
|
|
|
- String querySQL = "select * from " + tablename + " order by swid LIMIT " + limit + " OFFSET " + ((page - 1) * limit);
|
|
|
+ String querySQL = "select * from " + tablename + " where 1 = 1 ";
|
|
|
+ if (StringUtils.isNotEmpty(swid)) {
|
|
|
+ querySQL += " and swid like '%" + swid + "%'";
|
|
|
+ }
|
|
|
+ if (StringUtils.isNotEmpty(hfxpd)) {
|
|
|
+ querySQL += " and 合法性判断 = '" + hfxpd + "'";
|
|
|
+ }
|
|
|
+ querySQL += "order by swid LIMIT " + limit + " OFFSET " + ((page - 1) * limit);
|
|
|
ResultSet resultSet = statement.executeQuery(querySQL);
|
|
|
ResultSetMetaData metaData = resultSet.getMetaData();
|
|
|
int columnCount = metaData.getColumnCount();
|
|
|
@@ -582,7 +601,13 @@ public class DataImp implements DataService {
|
|
|
}
|
|
|
res.add(cur);
|
|
|
}
|
|
|
- String countSQL = "select count(1) as count from " + tablename;
|
|
|
+ String countSQL = "select count(1) as count from " + tablename + " where 1 = 1 ";
|
|
|
+ if (StringUtils.isNotEmpty(swid)) {
|
|
|
+ countSQL += " and swid like '%" + swid + "%'";
|
|
|
+ }
|
|
|
+ if (StringUtils.isNotEmpty(hfxpd)) {
|
|
|
+ countSQL += " and 合法性判断 = '" + hfxpd + "'";
|
|
|
+ }
|
|
|
ResultSet countSet = statement.executeQuery(countSQL);
|
|
|
Integer count = countSet.getInt("count");
|
|
|
connection.close();
|
|
|
@@ -861,16 +886,16 @@ public class DataImp implements DataService {
|
|
|
statement.execute(updateSql);
|
|
|
|
|
|
//TODO 更新geoserver样式 为checkedstyle
|
|
|
- querySQL = "select servicename from t_analyse_vector t where tablename = '" + tablename + "'";
|
|
|
- resultSet = statement.executeQuery(querySQL);
|
|
|
- String datasource = resultSet.getString("servicename");
|
|
|
- querySQL = "select uri , username , password, workspace from t_geoserver ";
|
|
|
- resultSet = statement.executeQuery(querySQL);
|
|
|
- String geoserverurl = resultSet.getString("uri");
|
|
|
- String geoserverusername = resultSet.getString("username");
|
|
|
- String geoserverpassword = resultSet.getString("password");
|
|
|
- String geoserverworkspace = resultSet.getString("workspace");
|
|
|
- GeoServer.updateStyle(checkedstyle, geoserverurl, geoserverusername, geoserverpassword, datasource);
|
|
|
+// querySQL = "select servicename from t_analyse_vector t where tablename = '" + tablename + "'";
|
|
|
+// resultSet = statement.executeQuery(querySQL);
|
|
|
+// String datasource = resultSet.getString("servicename");
|
|
|
+// querySQL = "select uri , username , password, workspace from t_geoserver ";
|
|
|
+// resultSet = statement.executeQuery(querySQL);
|
|
|
+// String geoserverurl = resultSet.getString("uri");
|
|
|
+// String geoserverusername = resultSet.getString("username");
|
|
|
+// String geoserverpassword = resultSet.getString("password");
|
|
|
+// String geoserverworkspace = resultSet.getString("workspace");
|
|
|
+// GeoServer.updateStyle(checkedstyle, geoserverurl, geoserverusername, geoserverpassword, datasource);
|
|
|
|
|
|
resultSet.close();
|
|
|
statement.close();
|
|
|
@@ -894,23 +919,40 @@ public class DataImp implements DataService {
|
|
|
|
|
|
@Override
|
|
|
public RequestResult exportReport(String modelname, String tablename, String layername, HttpServletRequest request, HttpServletResponse response) {
|
|
|
- String folderPath = localFilePath + "/" + layername + "/" + "report";
|
|
|
+ String folderPath = localFilePath + "" + layername + "\\" + "report";
|
|
|
File folder = new File(folderPath);
|
|
|
- if (!folder.exists()) {
|
|
|
+ if (folder.exists()) {
|
|
|
+ // TODO 系统打开文件夹
|
|
|
+ try {
|
|
|
+ Runtime.getRuntime().exec("explorer.exe " + folderPath);
|
|
|
+ } catch (IOException e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ return RequestResult.success("导出成功", 1);
|
|
|
+ } else {
|
|
|
folder.mkdirs();
|
|
|
}
|
|
|
String excelpath = folderPath + "/" + layername + "report.xlsx";
|
|
|
String wordpath = folderPath + "/" + layername + "report.docx";
|
|
|
+ String shppath = folderPath + "/" + layername + ".shp";
|
|
|
try {
|
|
|
String[] exportField = exportFields.split(",");
|
|
|
ExcelExport.export(dbpath, excelpath, tablename, modelname, exportField);
|
|
|
WordExport.export(dbpath, wordpath, tablename, modelname, exportField);
|
|
|
- String[] filelist = {excelpath, wordpath};
|
|
|
- FileToZipDownload.download(filelist, request, response);
|
|
|
+ SpatiaLiteToShapefile.execute(dbpath, shppath, shpWkid, tablename);
|
|
|
+// TODO 压缩包数据流下载
|
|
|
+// String[] filelist = {excelpath, wordpath};
|
|
|
+// FileToZipDownload.download(filelist, request, response);
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
|
return RequestResult.error("导出失败", e.toString());
|
|
|
}
|
|
|
+ // TODO 系统打开文件夹
|
|
|
+ try {
|
|
|
+ Runtime.getRuntime().exec("explorer.exe " + folderPath);
|
|
|
+ } catch (IOException e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
return RequestResult.success("导出成功", 1);
|
|
|
}
|
|
|
|