|
|
@@ -10,6 +10,7 @@ import com.onemap.spotoverlap.service.yzt.IYztService;
|
|
|
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.json.simple.JSONObject;
|
|
|
import org.json.simple.parser.JSONParser;
|
|
|
@@ -466,12 +467,12 @@ public class YztServiceImpl implements IYztService {
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public RequestResult modelsubdetails(String subid) {
|
|
|
+ public RequestResult modelsubdetails(String subid, String type) {
|
|
|
try {
|
|
|
- QueryWrapper<tModelDetail> wrapper = new QueryWrapper();
|
|
|
- wrapper.eq("subid", subid);
|
|
|
- wrapper.orderByAsc("cjsj");
|
|
|
- List<tModelDetail> res = tModelDetailMapper.selectList(wrapper);
|
|
|
+ List<ModelDetails> res = yztMapper.getDetailsParent(subid, type);
|
|
|
+ for (ModelDetails cur : res) {
|
|
|
+ cur.setDetails(yztMapper.getDetails(cur.getSituationid(), type));
|
|
|
+ }
|
|
|
return RequestResult.success("查询成功!", res);
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
|
@@ -719,7 +720,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 (!"geom".equals(key) && !key.contains("面积") && !key.contains("编号集合")) {
|
|
|
cur.put(key, entry.getValue());
|
|
|
}
|
|
|
}
|
|
|
@@ -901,65 +902,66 @@ public class YztServiceImpl implements IYztService {
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public RequestResult overlapAnalysis(String modelname, String tablename) {
|
|
|
+ public RequestResult overlapAnalysis(String modelid, String tablename) {
|
|
|
try {
|
|
|
+ //TODO 删除分析结果表
|
|
|
+ yztMapper.executeSQL("delete from t_analyse_result where tablename = '" + tablename + "'");
|
|
|
//TODO wanger 修改数据的分析状态和开始时间
|
|
|
- String updateSql = "update t_analyse_vector set fxzt = '1' , fxkssj = CURRENT_TIMESTAMP, fxmodel= '" + modelname + "' where tablename = '" + tablename + "'";
|
|
|
+ String updateSql = "update t_analyse_vector set fxzt = '1' , fxkssj = CURRENT_TIMESTAMP, fxmodel= '" + modelid + "' where tablename = '" + tablename + "'";
|
|
|
yztMapper.executeSQL(updateSql);
|
|
|
try {
|
|
|
//TODO wanger 对分析数据新增研判结果字段
|
|
|
yztMapper.executeSQL("ALTER TABLE " + tablename + " ADD COLUMN 合法性判断 TEXT");
|
|
|
yztMapper.executeSQL("ALTER TABLE " + tablename + " ADD COLUMN 合法性说明 TEXT");
|
|
|
yztMapper.executeSQL("ALTER TABLE " + tablename + " ADD COLUMN 面积 TEXT");
|
|
|
+ yztMapper.executeSQL("ALTER TABLE " + tablename + " ADD COLUMN 面积比 TEXT");
|
|
|
yztMapper.executeSQL("ALTER TABLE " + tablename + " ADD COLUMN 面积集合 TEXT");
|
|
|
yztMapper.executeSQL("ALTER TABLE " + tablename + " ADD COLUMN 编号集合 TEXT");
|
|
|
} catch (Exception e) {
|
|
|
System.out.println("分析图斑数据已存在附加字段,请忽略!");
|
|
|
}
|
|
|
//TODO wanger 重置附加字段为空字符串
|
|
|
- String resetSql = "update " + tablename + " set 合法性判断 = '' , 合法性说明 = '' , 面积 = '' , 编号集合 = '', 面积集合 = ''";
|
|
|
+ String resetSql = "update " + tablename + " set 合法性判断 = '' , 合法性说明 = '' , 面积 = '' , 编号集合 = '', 面积集合 = '', 面积比 = ''";
|
|
|
yztMapper.executeSQL(resetSql);
|
|
|
- // 查询分析模型因子
|
|
|
- List<analyseModel> analyseModels = yztMapper.getAnalyseModel(tablename);
|
|
|
- List<String> sqlOverlap = new ArrayList<>();
|
|
|
- for (analyseModel curModel : analyseModels) {
|
|
|
- String layerName = curModel.getLayername();
|
|
|
- String tableName = curModel.getTablename();
|
|
|
- String type = curModel.getType();
|
|
|
- //TODO wanger 执行分析模型因子叠加分析
|
|
|
- if (type.equals("外部")) {
|
|
|
- yztMapper.executeAnalyse(tablename, tableName, layerName, decimalPlaces, null);
|
|
|
- } else if (type.equals("内部")) {
|
|
|
- yztMapper.executeAnalyseNb(tablename, tableName, layerName, decimalPlaces, null);
|
|
|
-// String updateInside = String.format("update " + tablename + " as c set " +
|
|
|
-// "合法性说明 = case when c.合法性说明 is null then '' else c.合法性说明 || ';' end || '符合%s用地'," +
|
|
|
-// "面积 = case when 面积 is null then '' else 面积 end || round(cast( ST_Area(ST_Intersection(c.geom,d.geom)) as numeric), 2) || ';' " +
|
|
|
-// "from %s d where ST_Covers ( c.geom, d.geom )", layerName, tableName);
|
|
|
-// sqlOverlap.add(updateInside);
|
|
|
+ //TODO wanger 查询所有分析情形 isvalid='1'
|
|
|
+ List<tModelDetail> details = yztMapper.getDetailsByModelid(modelid);
|
|
|
+ if (details == null || details.size() == 0) {
|
|
|
+ return RequestResult.error("当前分析模型没有可用的分析情形!");
|
|
|
+ }
|
|
|
+ //TODO wanger 根据分析情形id分组执行分析语句 分析图斑(self)的分析条件组装到管控数据的分析条件中
|
|
|
+ for (tModelDetail curDetail : details) {
|
|
|
+ //TODO 分析图斑(self)的分析条件组装到管控数据的分析条件中
|
|
|
+ if ("self".equals(curDetail.getSourcelayer())) {
|
|
|
+ continue;
|
|
|
}
|
|
|
+ String selfwhere = yztMapper.getSelfwhereBySituationid(curDetail.getSituationid());
|
|
|
+ //TODO 执行管控数据的分析条件
|
|
|
+ curDetail.setDecimalPlaces(decimalPlaces);
|
|
|
+ curDetail.setTablename(tablename);
|
|
|
+ curDetail.setSelfwhere(selfwhere);
|
|
|
+ //TODO wanger 执行分析sql语句
|
|
|
+ yztMapper.executeAnalyseByEntity(curDetail);
|
|
|
+ //TODO wanger 插入分析结果 挨个图斑 挨个分析情形 挨个结果
|
|
|
+ yztMapper.insertAnalyseResult(tablename, curDetail.getSituationid(), curDetail.getSituationtype(), curDetail.getSituationrelationship(), curDetail.getId(), decimalPlaces);
|
|
|
}
|
|
|
- String updateInlegal = "update " + tablename + " set 合法性判断 = '疑似违法' where 合法性说明 like '%疑似%'";
|
|
|
- yztMapper.executeSQL(updateInlegal);
|
|
|
- String updateLegal = "update " + tablename + " set 合法性判断 = '合法用地' where 合法性判断 is null or 合法性判断 = ''";
|
|
|
- yztMapper.executeSQL(updateLegal);
|
|
|
+ //TODO wanger 更新合法性说明字段
|
|
|
+ yztMapper.updateHfxsm(tablename);
|
|
|
+ //TODO wanger 更新合法性判断字段
|
|
|
+ yztMapper.updateHfxpd(tablename);
|
|
|
//TODO wanger 修改数据的分析状态和结束时间
|
|
|
updateSql = "update t_analyse_vector set fxzt = '2' , fxjssj = CURRENT_TIMESTAMP, fxrz = '分析正常结束' where tablename = '" + tablename + "'";
|
|
|
yztMapper.executeSQL(updateSql);
|
|
|
return RequestResult.success("分析完成!", 1);
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
|
- try {
|
|
|
- String updateSql = "update t_analyse_vector set fxzt = '3' , fxjssj = CURRENT_TIMESTAMP, fxrz = '" + e.toString() + "' where tablename = '" + tablename + "'";
|
|
|
- yztMapper.executeSQL(updateSql);
|
|
|
- } catch (Exception exception) {
|
|
|
- exception.printStackTrace();
|
|
|
- }
|
|
|
+ String updateSql = "update t_analyse_vector set fxzt = '3' , fxjssj = CURRENT_TIMESTAMP, fxrz = '" + e.toString() + "' where tablename = '" + tablename + "'";
|
|
|
+ yztMapper.executeSQL(updateSql);
|
|
|
}
|
|
|
return RequestResult.error("分析失败!", 0);
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public void exportReport(String modelname, String tablename, String layername, HttpServletRequest request, HttpServletResponse response) {
|
|
|
+ public void exportReport(String modelid, String tablename, String layername, HttpServletRequest request, HttpServletResponse response) {
|
|
|
String folderPath = localFilePath + "" + layername + "\\" + "report";
|
|
|
File folder = new File(folderPath);
|
|
|
String zippath = localFilePath + "" + layername + "\\report.zip";
|
|
|
@@ -967,11 +969,9 @@ public class YztServiceImpl implements IYztService {
|
|
|
// TODO 如果已存在则打开系统文件夹
|
|
|
try {
|
|
|
FileToZipDownload.downloadLocalZipBuffered(response, zippath);
|
|
|
-// Runtime.getRuntime().exec("explorer.exe " + folderPath);
|
|
|
} catch (IOException e) {
|
|
|
e.printStackTrace();
|
|
|
}
|
|
|
-// return RequestResult.success("导出成功", 1);
|
|
|
} else {
|
|
|
folder.mkdirs();
|
|
|
String excelpath = folderPath + "/" + layername + "report.xlsx";
|
|
|
@@ -986,31 +986,21 @@ public class YztServiceImpl implements IYztService {
|
|
|
//TODO 第三步:导出shape
|
|
|
List<hfxjg> Hfxpd = yztMapper.getHfxpd(tablename);
|
|
|
//TODO 第一步:查询数据的分析模型数据源列表 仅查询状态为可用的管控数据列表
|
|
|
- List<analyseModel> analyseModels = yztMapper.getAnalyseModel(tablename);
|
|
|
- ExcelExport.export(fields, excelpath, tableDetail, modelname, exportField);
|
|
|
- WordExport.export(fields, wordpath, tableDetail, modelname, exportField, layername, Hfxpd, analyseModels);
|
|
|
+ List<AnalyseResult> analyseModels = yztMapper.getAnalyseModel(tablename, modelid);
|
|
|
+ ExcelExport.export(fields, excelpath, tableDetail, modelid, exportField);
|
|
|
+ WordExport.export(fields, wordpath, tableDetail, modelid, exportField, layername, Hfxpd, analyseModels);
|
|
|
SpatiaLiteToShapefile.execute(fields, shppath, shpWkid, tableDetail);
|
|
|
//TODO 压缩包数据流下载
|
|
|
zipDirectory(folderPath, zippath);
|
|
|
FileToZipDownload.downloadLocalZipBuffered(response, zippath);
|
|
|
-// 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);
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public void exportAchievementPackage(String tablename, String layername, HttpServletRequest request, HttpServletResponse response) {
|
|
|
+ public void exportAchievementPackage(String tablename, String layername, String modelid, HttpServletRequest request, HttpServletResponse response) {
|
|
|
String folderPath = localFilePath + "" + layername + "\\" + "package";
|
|
|
String zippath = localFilePath + "" + layername + "\\package.zip";
|
|
|
File folder = new File(folderPath);
|
|
|
@@ -1021,12 +1011,9 @@ public class YztServiceImpl implements IYztService {
|
|
|
// TODO 系统打开文件夹
|
|
|
try {
|
|
|
FileToZipDownload.downloadLocalZipBuffered(response, zippath);
|
|
|
-// Runtime.getRuntime().exec("explorer.exe " + folderPath);
|
|
|
-// return null;
|
|
|
} catch (IOException e) {
|
|
|
e.printStackTrace();
|
|
|
}
|
|
|
-// return RequestResult.success("导出成功", 1);
|
|
|
} else {
|
|
|
String excelpath = folderPath + "/" + layername + ".xlsx";
|
|
|
String shppath = folderPath + "/" + layername + ".shp";
|
|
|
@@ -1047,16 +1034,13 @@ public class YztServiceImpl implements IYztService {
|
|
|
//第二步:导出shape
|
|
|
SpatiaLiteToShapefile.execute(fields, shppath, shpWkid, tableDetail);
|
|
|
//TODO wanger 第二:导出excel和矢量数据压覆图
|
|
|
- AchievementPackage.exportAttributes(tablename, excelpath, "EPSG:" + shpWkid, mapExportFixed, mapExportSize, geoserverurl);
|
|
|
+ AchievementPackage.exportAttributes(tablename, modelid, excelpath, "EPSG:" + shpWkid, mapExportFixed, mapExportSize, geoserverurl);
|
|
|
zipDirectory(folderPath, zippath);
|
|
|
FileToZipDownload.downloadLocalZipBuffered(response, zippath);
|
|
|
// TODO 系统打开文件夹
|
|
|
-// Runtime.getRuntime().exec("explorer.exe " + folderPath);
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
|
-// return RequestResult.error("导出失败", e.toString());
|
|
|
}
|
|
|
-// return RequestResult.success("导出成功", 1);
|
|
|
}
|
|
|
}
|
|
|
|