|
|
@@ -11,7 +11,7 @@ import com.onemap.common.core.web.domain.RequestResult;
|
|
|
import com.onemap.common.security.utils.SecurityUtils;
|
|
|
import com.onemap.spotoverlap.utils.*;
|
|
|
import org.apache.ibatis.annotations.Param;
|
|
|
-import org.json.simple.JSONArray;
|
|
|
+import org.bouncycastle.cert.ocsp.Req;
|
|
|
import org.json.simple.JSONObject;
|
|
|
import org.json.simple.parser.JSONParser;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
@@ -29,10 +29,8 @@ import java.io.*;
|
|
|
import java.nio.file.*;
|
|
|
import java.nio.file.attribute.BasicFileAttributes;
|
|
|
import java.sql.Connection;
|
|
|
-import java.sql.ResultSet;
|
|
|
-import java.sql.ResultSetMetaData;
|
|
|
-import java.sql.Statement;
|
|
|
import java.util.*;
|
|
|
+import java.util.function.DoubleConsumer;
|
|
|
import java.util.zip.ZipEntry;
|
|
|
import java.util.zip.ZipOutputStream;
|
|
|
|
|
|
@@ -63,9 +61,15 @@ public class YztServiceImpl implements IYztService {
|
|
|
private TModelMapper tModelMapper;
|
|
|
@Autowired
|
|
|
private YztMapper yztMapper;
|
|
|
+ @Autowired
|
|
|
+ private TReportSubMapper tReportSubMapper;
|
|
|
+ @Autowired
|
|
|
+ private TReportMapper tReportMapper;
|
|
|
|
|
|
@Value("${decimalPlaces}")
|
|
|
private String decimalPlaces;
|
|
|
+ @Value("${xzqdm}")
|
|
|
+ private String defaultxzqdm;
|
|
|
@Value("${dbschema}")
|
|
|
private String dbschema;
|
|
|
@Value("${file.temp}")
|
|
|
@@ -94,6 +98,8 @@ public class YztServiceImpl implements IYztService {
|
|
|
private String swtype;
|
|
|
@Value("${exportFields}")
|
|
|
private String exportFields;
|
|
|
+ @Value("${notQueryFields}")
|
|
|
+ private String notQueryFields;
|
|
|
@Value("${mapExport.fixed}")
|
|
|
private String mapExportFixed;
|
|
|
@Value("${mapExport.size}")
|
|
|
@@ -436,6 +442,15 @@ public class YztServiceImpl implements IYztService {
|
|
|
@Override
|
|
|
public RequestResult modelsubupdate(tModelSub modelsub) {
|
|
|
try {
|
|
|
+ String where = modelsub.getQuerywhere();
|
|
|
+ String[] wherelist = where.split(",");
|
|
|
+ String newWhere = "eee.swtype in (";
|
|
|
+ for (String cur : wherelist) {
|
|
|
+ newWhere += "'" + cur + "',";
|
|
|
+ }
|
|
|
+ newWhere = newWhere.substring(0, newWhere.length() - 1);
|
|
|
+ newWhere += ")";
|
|
|
+ modelsub.setQuerywhere(newWhere);
|
|
|
if (StringUtils.isNotEmpty(modelsub.getId())) {
|
|
|
QueryWrapper<tModelSub> wrapper = new QueryWrapper();
|
|
|
wrapper.eq("id", modelsub.getId());
|
|
|
@@ -459,6 +474,9 @@ public class YztServiceImpl implements IYztService {
|
|
|
wrapper.eq("modelid", modelid);
|
|
|
wrapper.orderByAsc("cjsj");
|
|
|
List<tModelSub> res = tModelSubMapper.selectList(wrapper);
|
|
|
+ for (tModelSub cur : res) {
|
|
|
+ cur.setQuerywhere(calcSubWhere(cur.getQuerywhere()));
|
|
|
+ }
|
|
|
return RequestResult.success("查询成功!", res);
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
|
@@ -466,6 +484,10 @@ public class YztServiceImpl implements IYztService {
|
|
|
return RequestResult.error("失败!", null);
|
|
|
}
|
|
|
|
|
|
+ public String calcSubWhere(String querywhere) {
|
|
|
+ return querywhere.replace("eee.swtype in (", "").replaceAll("\\)", "").replaceAll("','", ",").replaceAll("'", "");
|
|
|
+ }
|
|
|
+
|
|
|
@Override
|
|
|
public RequestResult modelsubdetails(String subid, String type) {
|
|
|
try {
|
|
|
@@ -734,8 +756,9 @@ public class YztServiceImpl implements IYztService {
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public RequestResult getTableRecord(String tablename, Integer page, Integer limit, String swid, String hfxpd) {
|
|
|
+ public RequestResult getTableRecord(String tablename, Integer page, Integer limit, String swid, String hfxpd, String hfxsm) {
|
|
|
try {
|
|
|
+ List<String> notQueryFieldsList = Arrays.asList(notQueryFields.split(","));
|
|
|
String wheresql = "";
|
|
|
if (StringUtils.isNotEmpty(swid)) {
|
|
|
wheresql += " and swid like '%" + swid + "%'";
|
|
|
@@ -743,15 +766,21 @@ public class YztServiceImpl implements IYztService {
|
|
|
if (StringUtils.isNotEmpty(hfxpd)) {
|
|
|
wheresql += " and 合法性判断 = '" + hfxpd + "'";
|
|
|
}
|
|
|
+ if (StringUtils.isNotEmpty(hfxsm)) {
|
|
|
+ wheresql += " and 合法性说明 like '%" + hfxsm + "%'";
|
|
|
+ }
|
|
|
String querySQL = "select * from " + tablename + " where 1 = 1 " + wheresql;
|
|
|
querySQL += "order by swid limit " + limit + " OFFSET " + ((page - 1) * limit);
|
|
|
List<Map<String, Object>> results = yztMapper.executeSQL(querySQL);
|
|
|
List<Map> res = new ArrayList<Map>();
|
|
|
List<String> fields = new ArrayList<>();
|
|
|
+ if (results == null || results.size() == 0) {
|
|
|
+ return RequestResult.success("查询成功!", new HashMap<>());
|
|
|
+ }
|
|
|
Map<String, Object> firstMap = results.get(0);
|
|
|
for (Map.Entry<String, Object> entry : firstMap.entrySet()) {
|
|
|
String key = entry.getKey();
|
|
|
- if (!"geom".equals(key)) {
|
|
|
+ if (!notQueryFieldsList.contains(key)) {
|
|
|
fields.add(key);
|
|
|
}
|
|
|
}
|
|
|
@@ -759,7 +788,7 @@ public class YztServiceImpl implements IYztService {
|
|
|
Map cur = new HashMap();
|
|
|
for (Map.Entry<String, Object> entry : thisdata.entrySet()) {
|
|
|
String key = entry.getKey();
|
|
|
- if (!"geom".equals(key)) {
|
|
|
+ if (!notQueryFieldsList.contains(key)) {
|
|
|
cur.put(key, entry.getValue());
|
|
|
}
|
|
|
}
|
|
|
@@ -901,6 +930,24 @@ public class YztServiceImpl implements IYztService {
|
|
|
return RequestResult.error("失败!", null);
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public RequestResult getReportSub(String type, String name) {
|
|
|
+ try {
|
|
|
+ QueryWrapper<tReportSub> wrapper = new QueryWrapper();
|
|
|
+ wrapper.eq("isvalid", "1");
|
|
|
+ if (StringUtils.isNotEmpty(type)) {
|
|
|
+ wrapper.eq("type", type);
|
|
|
+ }
|
|
|
+ if (StringUtils.isNotEmpty(name)) {
|
|
|
+ wrapper.like("name", name);
|
|
|
+ }
|
|
|
+ return RequestResult.success("查询成功!", tReportSubMapper.selectList(wrapper));
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ return RequestResult.error("失败!", null);
|
|
|
+ }
|
|
|
+
|
|
|
@Override
|
|
|
public RequestResult overlapAnalysis(String modelid, String tablename) {
|
|
|
try {
|
|
|
@@ -935,10 +982,12 @@ public class YztServiceImpl implements IYztService {
|
|
|
continue;
|
|
|
}
|
|
|
String selfwhere = yztMapper.getSelfwhereBySituationid(curDetail.getSituationid());
|
|
|
+ String subwhere = yztMapper.getSubwhereBySubid(curDetail.getSubid());
|
|
|
//TODO 执行管控数据的分析条件
|
|
|
curDetail.setDecimalPlaces(decimalPlaces);
|
|
|
curDetail.setTablename(tablename);
|
|
|
curDetail.setSelfwhere(selfwhere);
|
|
|
+ curDetail.setSelfwhere(subwhere);
|
|
|
//TODO wanger 执行分析sql语句
|
|
|
yztMapper.executeAnalyseByEntity(curDetail);
|
|
|
//TODO wanger 插入分析结果 挨个图斑 挨个分析情形 挨个结果
|
|
|
@@ -1067,6 +1116,148 @@ public class YztServiceImpl implements IYztService {
|
|
|
return RequestResult.error("查询失败!", null);
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public RequestResult getAnalyseResultBySwid(String tablename, String swid) {
|
|
|
+ try {
|
|
|
+ QueryWrapper<tAnalyseVector> wrapper = new QueryWrapper();
|
|
|
+ wrapper.eq("tablename", tablename);
|
|
|
+ tAnalyseVector analyseVector = tAnalyseVectorMapper.selectOne(wrapper);
|
|
|
+ if (!"2".equals(analyseVector.getFxzt())) {
|
|
|
+ return RequestResult.error("当前数据未分析或分析状态异常!", null);
|
|
|
+ }
|
|
|
+ AnalyseDetail analyseResult = yztMapper.getAnalyseDetail(tablename, swid);
|
|
|
+ List<AnalyseDetailQx> details = yztMapper.getAnalyseDetailQx(tablename, swid);
|
|
|
+ analyseResult.setDetail(details);
|
|
|
+ return RequestResult.success("查询成功!", analyseResult);
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ return RequestResult.error("查询失败!", null);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public RequestResult updateReport(tReport report) {
|
|
|
+ try {
|
|
|
+ if (StringUtils.isNotEmpty(report.getId())) {
|
|
|
+ QueryWrapper<tReport> wrapper = new QueryWrapper();
|
|
|
+ wrapper.eq("id", report.getId());
|
|
|
+ tReportMapper.update(report, wrapper);
|
|
|
+ } else {
|
|
|
+ report.setId(StringUtils.getUUID());
|
|
|
+ tReportMapper.insert(report);
|
|
|
+ }
|
|
|
+ return RequestResult.success("操作成功!", 1);
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ return RequestResult.error("操作失败!", null);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public RequestResult getReportList(String name) {
|
|
|
+ try {
|
|
|
+ QueryWrapper<tReport> wrapper = new QueryWrapper();
|
|
|
+ if (StringUtils.isNotEmpty(name)) {
|
|
|
+ wrapper.like("name", name);
|
|
|
+ }
|
|
|
+ return RequestResult.success("查询成功!", tReportMapper.selectList(wrapper));
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ return RequestResult.error("查询失败!", null);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public RequestResult makeReport(String tablename, String reportid) {
|
|
|
+ try {
|
|
|
+ if (StringUtils.isEmpty(tablename) || StringUtils.isEmpty(reportid)) {
|
|
|
+ return RequestResult.error("参数未传递!");
|
|
|
+ }
|
|
|
+ QueryWrapper<tReport> wrapper = new QueryWrapper();
|
|
|
+ wrapper.like("id", reportid);
|
|
|
+ tReport report = tReportMapper.selectOne(wrapper);
|
|
|
+ if (report == null) {
|
|
|
+ return RequestResult.error("获取模型为空!");
|
|
|
+ }
|
|
|
+ //返回所有字段 有顺序
|
|
|
+ List<String> fields = new ArrayList<>();
|
|
|
+ //查询sql
|
|
|
+ String sqlwhere = "";
|
|
|
+ //排序和统计sql
|
|
|
+ String groupwhere = "";
|
|
|
+ String[] groupsub = report.getGroupsub().split(",");
|
|
|
+ for (String sub : groupsub) {
|
|
|
+ if (StringUtils.isNotEmpty(sqlwhere)) {
|
|
|
+ sqlwhere += ",";
|
|
|
+ groupwhere += ",";
|
|
|
+ }
|
|
|
+ QueryWrapper<tReportSub> subwrapper = new QueryWrapper();
|
|
|
+ subwrapper.eq("id", sub);
|
|
|
+ tReportSub reportSub = tReportSubMapper.selectOne(subwrapper);
|
|
|
+ fields.add(reportSub.getName());
|
|
|
+ sqlwhere += reportSub.getSqlwhere() + " as \"" + reportSub.getName() + "\"";
|
|
|
+ groupwhere += reportSub.getSqlwhere() + "";
|
|
|
+ }
|
|
|
+ String[] rowsub = report.getRowsub().split(",");
|
|
|
+ for (String sub : rowsub) {
|
|
|
+ if (StringUtils.isNotEmpty(sqlwhere)) {
|
|
|
+ sqlwhere += ",";
|
|
|
+ groupwhere += ",";
|
|
|
+ }
|
|
|
+ QueryWrapper<tReportSub> subwrapper = new QueryWrapper();
|
|
|
+ subwrapper.eq("id", sub);
|
|
|
+ tReportSub reportSub = tReportSubMapper.selectOne(subwrapper);
|
|
|
+ fields.add(reportSub.getName());
|
|
|
+ sqlwhere += reportSub.getSqlwhere() + " as \"" + reportSub.getName() + "\"";
|
|
|
+ groupwhere += reportSub.getSqlwhere() + "";
|
|
|
+ }
|
|
|
+ String[] calcsub = report.getCalctotal().split(",");
|
|
|
+ for (String sub : calcsub) {
|
|
|
+ if (StringUtils.isNotEmpty(sqlwhere)) {
|
|
|
+ sqlwhere += ",";
|
|
|
+ }
|
|
|
+ QueryWrapper<tReportSub> subwrapper = new QueryWrapper();
|
|
|
+ subwrapper.eq("id", sub);
|
|
|
+ tReportSub reportSub = tReportSubMapper.selectOne(subwrapper);
|
|
|
+ fields.add(reportSub.getName());
|
|
|
+ sqlwhere += reportSub.getSqlwhere() + " as \"" + reportSub.getName() + "\"";
|
|
|
+ }
|
|
|
+ List<Map> res = yztMapper.getTableReport(tablename, sqlwhere, groupwhere);
|
|
|
+ Map<String, Object> data = new HashMap<>();
|
|
|
+ data.put("data", res);
|
|
|
+ data.put("fields", fields);
|
|
|
+ return RequestResult.success("查询成功!", data);
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ return RequestResult.error("查询失败!", null);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public RequestResult deleteReport(String id) {
|
|
|
+ try {
|
|
|
+ QueryWrapper<tReport> wrapper = new QueryWrapper();
|
|
|
+ if (StringUtils.isNotEmpty(id)) {
|
|
|
+ wrapper.eq("id", id);
|
|
|
+ }
|
|
|
+ return RequestResult.success("删除成功!", tReportMapper.delete(wrapper));
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ return RequestResult.error("删除失败!", null);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public RequestResult getLayerNameByModelId(String modelid) {
|
|
|
+ try {
|
|
|
+ List<String> res = yztMapper.getLayerNameByModelId(modelid);
|
|
|
+ return RequestResult.success("查询成功!", res);
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ return RequestResult.error("查询失败!", null);
|
|
|
+ }
|
|
|
+
|
|
|
@Override
|
|
|
public RequestResult basemap(MultipartFile file, String name, String invalid, String serviceuri, String id, String image, String indexnum) {
|
|
|
String imageuri = "";
|
|
|
@@ -1132,6 +1323,48 @@ public class YztServiceImpl implements IYztService {
|
|
|
return RequestResult.error("查询失败!", 0);
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public RequestResult getJctbtj(String tablename, String xzqdm) {
|
|
|
+ try {
|
|
|
+ String subxzq = "3";
|
|
|
+ if (StringUtils.isEmpty(xzqdm)) {
|
|
|
+ xzqdm = defaultxzqdm;
|
|
|
+ }
|
|
|
+ if (xzqdm.length() > 9) {
|
|
|
+ return RequestResult.error("当前行政区不支持下钻查询了!", null);
|
|
|
+ }
|
|
|
+ switch (xzqdm.length()) {
|
|
|
+ case 2:
|
|
|
+ subxzq = "5";
|
|
|
+ break;
|
|
|
+ case 4:
|
|
|
+ subxzq = "7";
|
|
|
+ break;
|
|
|
+ case 6:
|
|
|
+ subxzq = "10";
|
|
|
+ break;
|
|
|
+ case 9:
|
|
|
+ subxzq = "13";
|
|
|
+ break;
|
|
|
+ case 12:
|
|
|
+ subxzq = "16";
|
|
|
+ break;
|
|
|
+ default:
|
|
|
+ subxzq = "5";
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ Map<String, Object> res = new HashMap<>();
|
|
|
+ List<AnalyseResult> xzqdetail = yztMapper.getJctbtjXzq(tablename, xzqdm, decimalPlaces, subxzq);
|
|
|
+ List<AnalyseResult> typedetail = yztMapper.getJctbtjBhlx(tablename, xzqdm, decimalPlaces, subxzq);
|
|
|
+ res.put("xzq", getTotalTj(xzqdetail));
|
|
|
+ res.put("bhlx", getTotalTj(typedetail));
|
|
|
+ return RequestResult.success("查询成功!", res);
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ return RequestResult.error("查询失败!", 0);
|
|
|
+ }
|
|
|
+
|
|
|
@Override
|
|
|
public RequestResult getAssessment(String type) {
|
|
|
try {
|
|
|
@@ -1319,4 +1552,21 @@ public class YztServiceImpl implements IYztService {
|
|
|
return config;
|
|
|
}
|
|
|
|
|
|
+ public List<AnalyseResult> getTotalTj(List<AnalyseResult> xzqdetail) {
|
|
|
+ List<AnalyseResult> cur = new ArrayList<>();
|
|
|
+ AnalyseResult s = new AnalyseResult();
|
|
|
+ s.setType("合计");
|
|
|
+ Double area = 0.0;
|
|
|
+ Integer count = 0;
|
|
|
+ for (AnalyseResult c : xzqdetail) {
|
|
|
+ area += c.getArea();
|
|
|
+ count += c.getCount();
|
|
|
+ }
|
|
|
+ s.setArea(Math.round(area * 100) / 100.0);
|
|
|
+ s.setCount(count);
|
|
|
+ cur.add(s);
|
|
|
+ cur.addAll(xzqdetail);
|
|
|
+ return cur;
|
|
|
+ }
|
|
|
+
|
|
|
}
|