|
@@ -547,307 +547,307 @@ public class FzxzSchedule {
|
|
// System.out.println(outfilepath);
|
|
// System.out.println(outfilepath);
|
|
// }
|
|
// }
|
|
|
|
|
|
- /**
|
|
|
|
- * 选址简报
|
|
|
|
- */
|
|
|
|
- private void createSimpleReport(FzxzEntityDTO res, String reportPath, List<String> xzbsmList) {
|
|
|
|
- // 创建document文档对象对象实例
|
|
|
|
- XWPFDocument document = null;
|
|
|
|
- OutputStream outputStream = null;// 把doc输出到输出流
|
|
|
|
- try {
|
|
|
|
- // 创建document文档对象对象实例
|
|
|
|
- document = new XWPFDocument();
|
|
|
|
- int pos = 0;
|
|
|
|
- NpoiHelper.Option optionCENTER = new NpoiHelper.Option();
|
|
|
|
- optionCENTER.setAlign(ParagraphAlignment.CENTER);
|
|
|
|
- // 文本标题
|
|
|
|
- NpoiHelper.title(document, res.getXmmc() + "选址简报", pos++);
|
|
|
|
- SimpleDateFormat sdf = new SimpleDateFormat("yyyy年MM月dd日");
|
|
|
|
- document.setParagraph(NpoiHelper.newParagraph(document, sdf.format(new Date()), optionCENTER), pos++);
|
|
|
|
-
|
|
|
|
- NpoiHelper.catalog(document, "一、项目选址信息", pos++);
|
|
|
|
- XWPFTable table = document.createTable(4, 4);
|
|
|
|
- table.setWidth(8500);// 总宽度
|
|
|
|
- for (int k = 0; k < 4; k++) {
|
|
|
|
- XWPFTableCell cell = table.getRow(0).getCell(k);
|
|
|
|
- CTTcPr ctTcPr = cell.getCTTc().isSetTcPr() ? cell.getCTTc().getTcPr() : cell.getCTTc().addNewTcPr();
|
|
|
|
- CTTblWidth ctTblWidth = ctTcPr.addNewTcW();
|
|
|
|
- ctTblWidth.setW(BigInteger.valueOf(2125));
|
|
|
|
- ctTblWidth.setType(STTblWidth.DXA);
|
|
|
|
- }
|
|
|
|
- // Table 表格第一行
|
|
|
|
- NpoiHelper.Option optionIsBoldCENTER = new NpoiHelper.Option();
|
|
|
|
- optionIsBoldCENTER.setAlign(ParagraphAlignment.CENTER);
|
|
|
|
- optionIsBoldCENTER.setBold(true);
|
|
|
|
- table.getRow(0).getCell(0).setColor("DBE5F1");
|
|
|
|
- table.getRow(0).getCell(0).setParagraph(NpoiHelper.setCellText(table, "项目名称", optionIsBoldCENTER));
|
|
|
|
- NpoiHelper.mergeHorizontal(table, 0, 1, 3);
|
|
|
|
- table.getRow(0).getCell(1).setParagraph(NpoiHelper.setCellText(table, res.getXmmc(), null));
|
|
|
|
- // Table 表格第二行
|
|
|
|
- table.getRow(1).getCell(0).setColor("DBE5F1");
|
|
|
|
- table.getRow(1).getCell(0).setParagraph(NpoiHelper.setCellText(table, "建设单位", optionIsBoldCENTER));
|
|
|
|
- NpoiHelper.mergeHorizontal(table, 1, 1, 3);
|
|
|
|
- table.getRow(1).getCell(1).setParagraph(NpoiHelper.setCellText(table, res.getJsdw(), null));
|
|
|
|
- // Table 表格第三行
|
|
|
|
- String ydmj = res.getYdmjbegin() + " - " + res.getYdmjend();
|
|
|
|
- if (StringUtils.isEmpty(res.getYdmjbegin()) || Double.parseDouble(res.getYdmjbegin()) == 0)
|
|
|
|
- ydmj = "≤" + res.getYdmjend();
|
|
|
|
- else if (StringUtils.isEmpty(res.getYdmjend()) || Double.parseDouble(res.getYdmjend()) == 0)
|
|
|
|
- ydmj = "≥" + res.getYdmjbegin();
|
|
|
|
- table.getRow(2).getCell(0).setColor("DBE5F1");
|
|
|
|
- table.getRow(2).getCell(0).setParagraph(NpoiHelper.setCellText(table, "用地面积", optionIsBoldCENTER));
|
|
|
|
- table.getRow(2).getCell(1).setParagraph(NpoiHelper.setCellText(table, ydmj + "平方米", null));
|
|
|
|
- table.getRow(2).getCell(2).setColor("DBE5F1");
|
|
|
|
- table.getRow(2).getCell(2).setParagraph(NpoiHelper.setCellText(table, "用地性质", optionIsBoldCENTER));
|
|
|
|
- table.getRow(2).getCell(3).setParagraph(NpoiHelper.setCellText(table, res.getYdmc(), null));
|
|
|
|
- // Table 表格第四行
|
|
|
|
- table.getRow(3).getCell(1).setColor("DBE5F1");
|
|
|
|
- table.getRow(3).getCell(2).setColor("DBE5F1");
|
|
|
|
- table.getRow(3).getCell(3).setColor("DBE5F1");
|
|
|
|
- table.getRow(3).getCell(0).setParagraph(NpoiHelper.setCellText(table, "选址因子", optionIsBoldCENTER));
|
|
|
|
- table.getRow(3).getCell(1).setParagraph(NpoiHelper.setCellText(table, "因子名称", optionIsBoldCENTER));
|
|
|
|
- table.getRow(3).getCell(2).setParagraph(NpoiHelper.setCellText(table, "影响条件", optionIsBoldCENTER));
|
|
|
|
- table.getRow(3).getCell(3).setParagraph(NpoiHelper.setCellText(table, "约束范围值(M)", optionIsBoldCENTER));
|
|
|
|
- // 查询选址因子,并且转换为List<Map> 因子条件(包含:C、不包含:N、分析:A)
|
|
|
|
- QueryWrapper<FzxzXzyzDTO> wrapper = new QueryWrapper<FzxzXzyzDTO>();
|
|
|
|
- wrapper.eq("rwbsm", res.getBsm());
|
|
|
|
- List<FzxzXzyzDTO> fzxzXzyzDTOList = fzxzXzyzMapper.selectList(wrapper);
|
|
|
|
- for (int i = 0; i < fzxzXzyzDTOList.size(); i++) {
|
|
|
|
- FzxzXzyzDTO fzxzXzyzDTO = fzxzXzyzDTOList.get(i);
|
|
|
|
- String yztj = "";
|
|
|
|
- // if (fzxzXzyzDTO.getYztj() != null) {
|
|
|
|
- // if ("C".equals(fzxzXzyzDTO.getYztj().toUpperCase())) {
|
|
|
|
- // yztj = "包含";
|
|
|
|
- // }
|
|
|
|
- // if ("N".equals(fzxzXzyzDTO.getYztj().toUpperCase())) {
|
|
|
|
- // yztj = "不包含";
|
|
|
|
- // }
|
|
|
|
- // if ("A".equals(fzxzXzyzDTO.getYztj().toUpperCase()) || "F".equals(fzxzXzyzDTO.getYztj().toUpperCase())) {
|
|
|
|
- // yztj = "分析";
|
|
|
|
- // }
|
|
|
|
- // }
|
|
|
|
- String yxz = "";
|
|
|
|
- // if (StringUtils.isNotEmpty(fzxzXzyzDTO.getYxz())) {
|
|
|
|
- // yxz = fzxzXzyzDTO.getYxz();
|
|
|
|
- // }
|
|
|
|
- XWPFTableRow mr = table.createRow();
|
|
|
|
-
|
|
|
|
- mr.getCell(1).setParagraph(NpoiHelper.setCellText(table, fzxzXzyzDTO.getYxyzmc(), optionCENTER));
|
|
|
|
- mr.getCell(2).setParagraph(NpoiHelper.setCellText(table, yztj, optionCENTER));
|
|
|
|
- mr.getCell(3).setParagraph(NpoiHelper.setCellText(table, yxz, optionCENTER));
|
|
|
|
- }
|
|
|
|
- NpoiHelper.mergeCellsVertically(table, 0, 3, 3 + fzxzXzyzDTOList.size());
|
|
|
|
- table.getRow(3).getCell(0).setColor("DBE5F1");
|
|
|
|
- // 选址分析
|
|
|
|
- NpoiHelper.catalog(document, "二、选址分析", pos++);
|
|
|
|
- XWPFTable tableFx = document.createTable(1, 4);
|
|
|
|
- tableFx.setWidth(8500);// 总宽度
|
|
|
|
- for (int k = 0; k < 4; k++) {
|
|
|
|
- XWPFTableCell cell = tableFx.getRow(0).getCell(k);
|
|
|
|
- CTTcPr ctTcPr = cell.getCTTc().isSetTcPr() ? cell.getCTTc().getTcPr() : cell.getCTTc().addNewTcPr();
|
|
|
|
- CTTblWidth ctTblWidth = ctTcPr.addNewTcW();
|
|
|
|
- ctTblWidth.setW(BigInteger.valueOf(2125));
|
|
|
|
- ctTblWidth.setType(STTblWidth.DXA);
|
|
|
|
- }
|
|
|
|
- // 查询结果GIS FzxzJgGisDTO
|
|
|
|
- QueryWrapper<FzxzResDTO> giswrapper = new QueryWrapper<>();
|
|
|
|
- giswrapper.eq("rwbsm", res.getBsm());
|
|
|
|
- // 筛选方案,根据传参或者预选方案
|
|
|
|
-// giswrapper.ne("yxfa", "0");
|
|
|
|
- if (xzbsmList != null) {
|
|
|
|
- giswrapper.in("bsm", xzbsmList);
|
|
|
|
- }
|
|
|
|
- List<FzxzResDTO> fzxzJgGisDTOList = fzxzResMapper.selectList(giswrapper);
|
|
|
|
- int index = 1;
|
|
|
|
- NpoiHelper.Option optionIsBold = new NpoiHelper.Option();
|
|
|
|
- optionIsBold.setBold(true);
|
|
|
|
- int rowIndex = 0;
|
|
|
|
- for (int i = 0; i < fzxzJgGisDTOList.size(); i++) {
|
|
|
|
- FzxzResDTO item = fzxzJgGisDTOList.get(i);
|
|
|
|
- XWPFTableRow mr = tableFx.createRow();
|
|
|
|
- rowIndex++;
|
|
|
|
- mr.getCell(0).setColor("DBE5F1");
|
|
|
|
- NpoiHelper.mergeHorizontal(tableFx, rowIndex, 0, 1);
|
|
|
|
- mr.getCell(0).setParagraph(NpoiHelper.setCellText(tableFx, "方案" + NumberUtil.int2chineseNum(index), optionIsBold));
|
|
|
|
- // tableFx 表格第二行
|
|
|
|
- mr = tableFx.createRow();
|
|
|
|
- rowIndex++;
|
|
|
|
- mr.getCell(0).setParagraph(NpoiHelper.setCellText(tableFx, "地类编码", optionIsBoldCENTER));
|
|
|
|
- // mr.getCell(1).setParagraph(NpoiHelper.setCellText(tableFx, item.getDlbm(), null));
|
|
|
|
- mr.getCell(2).setParagraph(NpoiHelper.setCellText(tableFx, "地类名称", optionIsBoldCENTER));
|
|
|
|
- // mr.getCell(3).setParagraph(NpoiHelper.setCellText(tableFx, item.getDlmc(), null));
|
|
|
|
- // tableFx 表格第三行
|
|
|
|
- mr = tableFx.createRow();
|
|
|
|
- rowIndex++;
|
|
|
|
- mr.getCell(0).setParagraph(NpoiHelper.setCellText(tableFx, "地块面积", optionIsBoldCENTER));
|
|
|
|
- // mr.getCell(1).setParagraph(NpoiHelper.setCellText(tableFx, Math.round(item.getTbmj()) + "平方米", null));
|
|
|
|
- mr.getCell(2).setParagraph(NpoiHelper.setCellText(tableFx, "土地位置", optionIsBoldCENTER));
|
|
|
|
- // mr.getCell(3).setParagraph(NpoiHelper.setCellText(tableFx, item.getXzqmc(), null));
|
|
|
|
- // tableFx 表格第四行
|
|
|
|
- mr = tableFx.createRow();
|
|
|
|
- rowIndex++;
|
|
|
|
- mr.getCell(0).setParagraph(NpoiHelper.setCellText(tableFx, "压占分析", optionIsBoldCENTER));
|
|
|
|
- NpoiHelper.mergeHorizontal(tableFx, rowIndex, 1, 3);
|
|
|
|
-
|
|
|
|
- XWPFParagraph para6 = mr.getCell(1).addParagraph();
|
|
|
|
- para6.setAlignment(ParagraphAlignment.LEFT);
|
|
|
|
- // 查询选址因子 因子条件(包含:C、不包含:N、分析:A)
|
|
|
|
- // QueryWrapper<fzxzXzyzDTO> fzxzJgyzDTOQueryWrapper = new QueryWrapper<>();
|
|
|
|
- // fzxzJgyzDTOQueryWrapper.eq("jbbsm", item.getBsm());
|
|
|
|
- // fzxzJgyzDTOQueryWrapper.eq("yztj", "F");
|
|
|
|
- // List<fzxzXzyzDTO> fzxzJgyzDTOList = fzxzXzyzMapper.selectList(fzxzJgyzDTOQueryWrapper);
|
|
|
|
- // int jgyzid = 1;
|
|
|
|
- // for (int j = 0; j < fzxzJgyzDTOList.size(); j++) {
|
|
|
|
- // FzxzXzyzDTO jgyz = fzxzJgyzDTOList.get(j);
|
|
|
|
- // XWPFRun run = para6.createRun();
|
|
|
|
- // String jg = jgyz.getFxjg();
|
|
|
|
- // Double jgDouble = 0.0;
|
|
|
|
- // try {
|
|
|
|
- // jgDouble = Double.parseDouble(jg);
|
|
|
|
- // run.setText(jgyzid + "、压占" + jgyz.getYxyzmc() + "面积" + jg + "平方米");
|
|
|
|
- // } catch (Exception e) {
|
|
|
|
- // run.setText(jgyzid + "、" + jg);
|
|
|
|
- // }
|
|
|
|
- //
|
|
|
|
- // if (jgyzid < fzxzJgyzDTOList.size())
|
|
|
|
- // run.addBreak(BreakType.TEXT_WRAPPING);
|
|
|
|
- // jgyzid++;
|
|
|
|
- // }
|
|
|
|
- index++;
|
|
|
|
- }
|
|
|
|
- tableFx.removeRow(0);
|
|
|
|
- File fileDoc = new File(reportPath);
|
|
|
|
- if (fileDoc.exists()) {
|
|
|
|
- FileUtils.forceDelete(fileDoc);
|
|
|
|
- }
|
|
|
|
- // word文件输出流
|
|
|
|
- outputStream = new FileOutputStream(reportPath);
|
|
|
|
- document.write(outputStream);
|
|
|
|
- } catch (Exception e) {
|
|
|
|
- e.printStackTrace();
|
|
|
|
- System.out.println(e.toString());
|
|
|
|
- // 插入任务日志
|
|
|
|
- FxrwrzDTO errorDto = new FxrwrzDTO();
|
|
|
|
- errorDto.setRwbsm(res.getBsm());
|
|
|
|
- errorDto.setRwlx("辅助选址");
|
|
|
|
- errorDto.setRzlr("生成选址简报错误:" + e.getMessage());
|
|
|
|
- errorDto.setRzsj(new Date());
|
|
|
|
- errorDto.setRzlx("error");
|
|
|
|
- fxrwrzMapper.insert(errorDto);
|
|
|
|
- } finally {
|
|
|
|
- if (document != null) {
|
|
|
|
- try {
|
|
|
|
- document.close();
|
|
|
|
- } catch (Exception ex) {
|
|
|
|
- System.out.println(ex.toString());
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- if (outputStream != null) {
|
|
|
|
- try {
|
|
|
|
- outputStream.close();
|
|
|
|
- } catch (IOException e) {
|
|
|
|
- e.printStackTrace();
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- // 转PDF
|
|
|
|
- String outfilepath = reportPath.replace(".docx", ".pdf");
|
|
|
|
- NpoiHelper.doc2pdf(reportPath, outfilepath);
|
|
|
|
- System.out.println(outfilepath);
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- /**
|
|
|
|
- * zip打包
|
|
|
|
- */
|
|
|
|
- private void createZipReport(FzxzEntityDTO res, String reportZip, String reportPath, String simplePath) {
|
|
|
|
- File f = new File(fzxzShp);
|
|
|
|
- System.out.println("选址分析报告打包zip:" + reportPath);
|
|
|
|
- System.out.println("选址分析报告打包shp:" + fzxzShp);
|
|
|
|
- if (StringUtils.isNotEmpty(fzxzShp)) {
|
|
|
|
- String filePath = fzxzShp.substring(0, fzxzShp.lastIndexOf("."));
|
|
|
|
- String docReportPath = reportPath.substring(0, reportPath.lastIndexOf("."));
|
|
|
|
- String docSimplePath = reportPath.substring(0, reportPath.lastIndexOf("."));
|
|
|
|
- // 生成的压缩文件
|
|
|
|
- ZipFile zipFile = null;
|
|
|
|
- try {
|
|
|
|
- zipFile = new ZipFile(reportZip);
|
|
|
|
- ZipParameters parameters = new ZipParameters();
|
|
|
|
- // 压缩方式
|
|
|
|
- parameters.setCompressionMethod(Zip4jConstants.COMP_DEFLATE);
|
|
|
|
- // 压缩级别
|
|
|
|
- parameters.setCompressionLevel(Zip4jConstants.DEFLATE_LEVEL_NORMAL);
|
|
|
|
- zipFile.addFile(new File(simplePath), parameters);
|
|
|
|
- zipFile.addFile(new File(reportPath), parameters);
|
|
|
|
- zipFile.addFile(new File(filePath + ".shp"), parameters);
|
|
|
|
- zipFile.addFile(new File(filePath + ".shx"), parameters);
|
|
|
|
- zipFile.addFile(new File(filePath + ".dbf"), parameters);
|
|
|
|
- zipFile.addFile(new File(filePath + ".cpg"), parameters);
|
|
|
|
- zipFile.addFile(new File(filePath + ".prj"), parameters);
|
|
|
|
- } catch (ZipException e) {
|
|
|
|
- System.out.println(e.toString());
|
|
|
|
- // 插入任务日志
|
|
|
|
- FxrwrzDTO errorDto = new FxrwrzDTO();
|
|
|
|
- errorDto.setRwbsm(res.getBsm());
|
|
|
|
- errorDto.setRwlx("辅助选址");
|
|
|
|
- errorDto.setRzlr("生成选址报告zip打包错误:" + e.getMessage());
|
|
|
|
- errorDto.setRzsj(new Date());
|
|
|
|
- errorDto.setRzlx("error");
|
|
|
|
- fxrwrzMapper.insert(errorDto);
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- /**
|
|
|
|
- * 导出报告图片
|
|
|
|
- *
|
|
|
|
- * @param res
|
|
|
|
- * @param xzbsmList 没有导出全部的地块
|
|
|
|
- * @return
|
|
|
|
- */
|
|
|
|
- private List<String> ReportImg(FzxzEntityDTO res, List<String> xzbsmList) {
|
|
|
|
- // 查询分析结果图斑信息
|
|
|
|
- QueryWrapper<FzxzResDTO> giswrapper = new QueryWrapper<>();
|
|
|
|
- giswrapper.eq("rwbsm", res.getBsm());
|
|
|
|
- // 筛选方案,根据传参或者预选方案
|
|
|
|
-// giswrapper.ne("yxfa", "0");
|
|
|
|
- if (xzbsmList != null) {
|
|
|
|
- giswrapper.in("bsm", xzbsmList);
|
|
|
|
- }
|
|
|
|
- List<FzxzResDTO> fzxzJgGisDTOList = fzxzResMapper.selectList(giswrapper);
|
|
|
|
- // SDE转SHP
|
|
|
|
- String inShp = fzxzShp;
|
|
|
|
- List objidlist = new ArrayList<>();
|
|
|
|
- for (FzxzResDTO cur : fzxzJgGisDTOList) {
|
|
|
|
- // objidlist.add(cur.getObjectid());
|
|
|
|
- }
|
|
|
|
- String objids = Joiner.on(",").join(objidlist);
|
|
|
|
- sde2Shp("KJGH.T_FZSS_FZXZ_JG_GIS", inShp, "\"OBJECTID\" IN (" + objids + ")");
|
|
|
|
- // 执行python
|
|
|
|
- Map<String, String> params = new HashMap<>();
|
|
|
|
- List<String> result = PythonExecute.RunFzxzMap(mapFunctionId, params);
|
|
|
|
- return result;
|
|
|
|
- }
|
|
|
|
|
|
+// /**
|
|
|
|
+// * 选址简报
|
|
|
|
+// */
|
|
|
|
+// private void createSimpleReport(FzxzEntityDTO res, String reportPath, List<String> xzbsmList) {
|
|
|
|
+// // 创建document文档对象对象实例
|
|
|
|
+// XWPFDocument document = null;
|
|
|
|
+// OutputStream outputStream = null;// 把doc输出到输出流
|
|
|
|
+// try {
|
|
|
|
+// // 创建document文档对象对象实例
|
|
|
|
+// document = new XWPFDocument();
|
|
|
|
+// int pos = 0;
|
|
|
|
+// NpoiHelper.Option optionCENTER = new NpoiHelper.Option();
|
|
|
|
+// optionCENTER.setAlign(ParagraphAlignment.CENTER);
|
|
|
|
+// // 文本标题
|
|
|
|
+// NpoiHelper.title(document, res.getXmmc() + "选址简报", pos++);
|
|
|
|
+// SimpleDateFormat sdf = new SimpleDateFormat("yyyy年MM月dd日");
|
|
|
|
+// document.setParagraph(NpoiHelper.newParagraph(document, sdf.format(new Date()), optionCENTER), pos++);
|
|
|
|
+//
|
|
|
|
+// NpoiHelper.catalog(document, "一、项目选址信息", pos++);
|
|
|
|
+// XWPFTable table = document.createTable(4, 4);
|
|
|
|
+// table.setWidth(8500);// 总宽度
|
|
|
|
+// for (int k = 0; k < 4; k++) {
|
|
|
|
+// XWPFTableCell cell = table.getRow(0).getCell(k);
|
|
|
|
+// CTTcPr ctTcPr = cell.getCTTc().isSetTcPr() ? cell.getCTTc().getTcPr() : cell.getCTTc().addNewTcPr();
|
|
|
|
+// CTTblWidth ctTblWidth = ctTcPr.addNewTcW();
|
|
|
|
+// ctTblWidth.setW(BigInteger.valueOf(2125));
|
|
|
|
+// ctTblWidth.setType(STTblWidth.DXA);
|
|
|
|
+// }
|
|
|
|
+// // Table 表格第一行
|
|
|
|
+// NpoiHelper.Option optionIsBoldCENTER = new NpoiHelper.Option();
|
|
|
|
+// optionIsBoldCENTER.setAlign(ParagraphAlignment.CENTER);
|
|
|
|
+// optionIsBoldCENTER.setBold(true);
|
|
|
|
+// table.getRow(0).getCell(0).setColor("DBE5F1");
|
|
|
|
+// table.getRow(0).getCell(0).setParagraph(NpoiHelper.setCellText(table, "项目名称", optionIsBoldCENTER));
|
|
|
|
+// NpoiHelper.mergeHorizontal(table, 0, 1, 3);
|
|
|
|
+// table.getRow(0).getCell(1).setParagraph(NpoiHelper.setCellText(table, res.getXmmc(), null));
|
|
|
|
+// // Table 表格第二行
|
|
|
|
+// table.getRow(1).getCell(0).setColor("DBE5F1");
|
|
|
|
+// table.getRow(1).getCell(0).setParagraph(NpoiHelper.setCellText(table, "建设单位", optionIsBoldCENTER));
|
|
|
|
+// NpoiHelper.mergeHorizontal(table, 1, 1, 3);
|
|
|
|
+// table.getRow(1).getCell(1).setParagraph(NpoiHelper.setCellText(table, res.getJsdw(), null));
|
|
|
|
+// // Table 表格第三行
|
|
|
|
+// String ydmj = res.getYdmjbegin() + " - " + res.getYdmjend();
|
|
|
|
+// if (StringUtils.isEmpty(res.getYdmjbegin()) || Double.parseDouble(res.getYdmjbegin()) == 0)
|
|
|
|
+// ydmj = "≤" + res.getYdmjend();
|
|
|
|
+// else if (StringUtils.isEmpty(res.getYdmjend()) || Double.parseDouble(res.getYdmjend()) == 0)
|
|
|
|
+// ydmj = "≥" + res.getYdmjbegin();
|
|
|
|
+// table.getRow(2).getCell(0).setColor("DBE5F1");
|
|
|
|
+// table.getRow(2).getCell(0).setParagraph(NpoiHelper.setCellText(table, "用地面积", optionIsBoldCENTER));
|
|
|
|
+// table.getRow(2).getCell(1).setParagraph(NpoiHelper.setCellText(table, ydmj + "平方米", null));
|
|
|
|
+// table.getRow(2).getCell(2).setColor("DBE5F1");
|
|
|
|
+// table.getRow(2).getCell(2).setParagraph(NpoiHelper.setCellText(table, "用地性质", optionIsBoldCENTER));
|
|
|
|
+// table.getRow(2).getCell(3).setParagraph(NpoiHelper.setCellText(table, res.getYdmc(), null));
|
|
|
|
+// // Table 表格第四行
|
|
|
|
+// table.getRow(3).getCell(1).setColor("DBE5F1");
|
|
|
|
+// table.getRow(3).getCell(2).setColor("DBE5F1");
|
|
|
|
+// table.getRow(3).getCell(3).setColor("DBE5F1");
|
|
|
|
+// table.getRow(3).getCell(0).setParagraph(NpoiHelper.setCellText(table, "选址因子", optionIsBoldCENTER));
|
|
|
|
+// table.getRow(3).getCell(1).setParagraph(NpoiHelper.setCellText(table, "因子名称", optionIsBoldCENTER));
|
|
|
|
+// table.getRow(3).getCell(2).setParagraph(NpoiHelper.setCellText(table, "影响条件", optionIsBoldCENTER));
|
|
|
|
+// table.getRow(3).getCell(3).setParagraph(NpoiHelper.setCellText(table, "约束范围值(M)", optionIsBoldCENTER));
|
|
|
|
+// // 查询选址因子,并且转换为List<Map> 因子条件(包含:C、不包含:N、分析:A)
|
|
|
|
+// QueryWrapper<FzxzXzyzDTO> wrapper = new QueryWrapper<FzxzXzyzDTO>();
|
|
|
|
+// wrapper.eq("rwbsm", res.getBsm());
|
|
|
|
+// List<FzxzXzyzDTO> fzxzXzyzDTOList = fzxzXzyzMapper.selectList(wrapper);
|
|
|
|
+// for (int i = 0; i < fzxzXzyzDTOList.size(); i++) {
|
|
|
|
+// FzxzXzyzDTO fzxzXzyzDTO = fzxzXzyzDTOList.get(i);
|
|
|
|
+// String yztj = "";
|
|
|
|
+// // if (fzxzXzyzDTO.getYztj() != null) {
|
|
|
|
+// // if ("C".equals(fzxzXzyzDTO.getYztj().toUpperCase())) {
|
|
|
|
+// // yztj = "包含";
|
|
|
|
+// // }
|
|
|
|
+// // if ("N".equals(fzxzXzyzDTO.getYztj().toUpperCase())) {
|
|
|
|
+// // yztj = "不包含";
|
|
|
|
+// // }
|
|
|
|
+// // if ("A".equals(fzxzXzyzDTO.getYztj().toUpperCase()) || "F".equals(fzxzXzyzDTO.getYztj().toUpperCase())) {
|
|
|
|
+// // yztj = "分析";
|
|
|
|
+// // }
|
|
|
|
+// // }
|
|
|
|
+// String yxz = "";
|
|
|
|
+// // if (StringUtils.isNotEmpty(fzxzXzyzDTO.getYxz())) {
|
|
|
|
+// // yxz = fzxzXzyzDTO.getYxz();
|
|
|
|
+// // }
|
|
|
|
+// XWPFTableRow mr = table.createRow();
|
|
|
|
+//
|
|
|
|
+// mr.getCell(1).setParagraph(NpoiHelper.setCellText(table, fzxzXzyzDTO.getYxyzmc(), optionCENTER));
|
|
|
|
+// mr.getCell(2).setParagraph(NpoiHelper.setCellText(table, yztj, optionCENTER));
|
|
|
|
+// mr.getCell(3).setParagraph(NpoiHelper.setCellText(table, yxz, optionCENTER));
|
|
|
|
+// }
|
|
|
|
+// NpoiHelper.mergeCellsVertically(table, 0, 3, 3 + fzxzXzyzDTOList.size());
|
|
|
|
+// table.getRow(3).getCell(0).setColor("DBE5F1");
|
|
|
|
+// // 选址分析
|
|
|
|
+// NpoiHelper.catalog(document, "二、选址分析", pos++);
|
|
|
|
+// XWPFTable tableFx = document.createTable(1, 4);
|
|
|
|
+// tableFx.setWidth(8500);// 总宽度
|
|
|
|
+// for (int k = 0; k < 4; k++) {
|
|
|
|
+// XWPFTableCell cell = tableFx.getRow(0).getCell(k);
|
|
|
|
+// CTTcPr ctTcPr = cell.getCTTc().isSetTcPr() ? cell.getCTTc().getTcPr() : cell.getCTTc().addNewTcPr();
|
|
|
|
+// CTTblWidth ctTblWidth = ctTcPr.addNewTcW();
|
|
|
|
+// ctTblWidth.setW(BigInteger.valueOf(2125));
|
|
|
|
+// ctTblWidth.setType(STTblWidth.DXA);
|
|
|
|
+// }
|
|
|
|
+// // 查询结果GIS FzxzJgGisDTO
|
|
|
|
+// QueryWrapper<FzxzResDTO> giswrapper = new QueryWrapper<>();
|
|
|
|
+// giswrapper.eq("rwbsm", res.getBsm());
|
|
|
|
+// // 筛选方案,根据传参或者预选方案
|
|
|
|
+// // giswrapper.ne("yxfa", "0");
|
|
|
|
+// if (xzbsmList != null) {
|
|
|
|
+// giswrapper.in("bsm", xzbsmList);
|
|
|
|
+// }
|
|
|
|
+// List<FzxzResDTO> fzxzJgGisDTOList = fzxzResMapper.selectList(giswrapper);
|
|
|
|
+// int index = 1;
|
|
|
|
+// NpoiHelper.Option optionIsBold = new NpoiHelper.Option();
|
|
|
|
+// optionIsBold.setBold(true);
|
|
|
|
+// int rowIndex = 0;
|
|
|
|
+// for (int i = 0; i < fzxzJgGisDTOList.size(); i++) {
|
|
|
|
+// FzxzResDTO item = fzxzJgGisDTOList.get(i);
|
|
|
|
+// XWPFTableRow mr = tableFx.createRow();
|
|
|
|
+// rowIndex++;
|
|
|
|
+// mr.getCell(0).setColor("DBE5F1");
|
|
|
|
+// NpoiHelper.mergeHorizontal(tableFx, rowIndex, 0, 1);
|
|
|
|
+// mr.getCell(0).setParagraph(NpoiHelper.setCellText(tableFx, "方案" + NumberUtil.int2chineseNum(index), optionIsBold));
|
|
|
|
+// // tableFx 表格第二行
|
|
|
|
+// mr = tableFx.createRow();
|
|
|
|
+// rowIndex++;
|
|
|
|
+// mr.getCell(0).setParagraph(NpoiHelper.setCellText(tableFx, "地类编码", optionIsBoldCENTER));
|
|
|
|
+// // mr.getCell(1).setParagraph(NpoiHelper.setCellText(tableFx, item.getDlbm(), null));
|
|
|
|
+// mr.getCell(2).setParagraph(NpoiHelper.setCellText(tableFx, "地类名称", optionIsBoldCENTER));
|
|
|
|
+// // mr.getCell(3).setParagraph(NpoiHelper.setCellText(tableFx, item.getDlmc(), null));
|
|
|
|
+// // tableFx 表格第三行
|
|
|
|
+// mr = tableFx.createRow();
|
|
|
|
+// rowIndex++;
|
|
|
|
+// mr.getCell(0).setParagraph(NpoiHelper.setCellText(tableFx, "地块面积", optionIsBoldCENTER));
|
|
|
|
+// // mr.getCell(1).setParagraph(NpoiHelper.setCellText(tableFx, Math.round(item.getTbmj()) + "平方米", null));
|
|
|
|
+// mr.getCell(2).setParagraph(NpoiHelper.setCellText(tableFx, "土地位置", optionIsBoldCENTER));
|
|
|
|
+// // mr.getCell(3).setParagraph(NpoiHelper.setCellText(tableFx, item.getXzqmc(), null));
|
|
|
|
+// // tableFx 表格第四行
|
|
|
|
+// mr = tableFx.createRow();
|
|
|
|
+// rowIndex++;
|
|
|
|
+// mr.getCell(0).setParagraph(NpoiHelper.setCellText(tableFx, "压占分析", optionIsBoldCENTER));
|
|
|
|
+// NpoiHelper.mergeHorizontal(tableFx, rowIndex, 1, 3);
|
|
|
|
+//
|
|
|
|
+// XWPFParagraph para6 = mr.getCell(1).addParagraph();
|
|
|
|
+// para6.setAlignment(ParagraphAlignment.LEFT);
|
|
|
|
+// // 查询选址因子 因子条件(包含:C、不包含:N、分析:A)
|
|
|
|
+// // QueryWrapper<fzxzXzyzDTO> fzxzJgyzDTOQueryWrapper = new QueryWrapper<>();
|
|
|
|
+// // fzxzJgyzDTOQueryWrapper.eq("jbbsm", item.getBsm());
|
|
|
|
+// // fzxzJgyzDTOQueryWrapper.eq("yztj", "F");
|
|
|
|
+// // List<fzxzXzyzDTO> fzxzJgyzDTOList = fzxzXzyzMapper.selectList(fzxzJgyzDTOQueryWrapper);
|
|
|
|
+// // int jgyzid = 1;
|
|
|
|
+// // for (int j = 0; j < fzxzJgyzDTOList.size(); j++) {
|
|
|
|
+// // FzxzXzyzDTO jgyz = fzxzJgyzDTOList.get(j);
|
|
|
|
+// // XWPFRun run = para6.createRun();
|
|
|
|
+// // String jg = jgyz.getFxjg();
|
|
|
|
+// // Double jgDouble = 0.0;
|
|
|
|
+// // try {
|
|
|
|
+// // jgDouble = Double.parseDouble(jg);
|
|
|
|
+// // run.setText(jgyzid + "、压占" + jgyz.getYxyzmc() + "面积" + jg + "平方米");
|
|
|
|
+// // } catch (Exception e) {
|
|
|
|
+// // run.setText(jgyzid + "、" + jg);
|
|
|
|
+// // }
|
|
|
|
+// //
|
|
|
|
+// // if (jgyzid < fzxzJgyzDTOList.size())
|
|
|
|
+// // run.addBreak(BreakType.TEXT_WRAPPING);
|
|
|
|
+// // jgyzid++;
|
|
|
|
+// // }
|
|
|
|
+// index++;
|
|
|
|
+// }
|
|
|
|
+// tableFx.removeRow(0);
|
|
|
|
+// File fileDoc = new File(reportPath);
|
|
|
|
+// if (fileDoc.exists()) {
|
|
|
|
+// FileUtils.forceDelete(fileDoc);
|
|
|
|
+// }
|
|
|
|
+// // word文件输出流
|
|
|
|
+// outputStream = new FileOutputStream(reportPath);
|
|
|
|
+// document.write(outputStream);
|
|
|
|
+// } catch (Exception e) {
|
|
|
|
+// e.printStackTrace();
|
|
|
|
+// System.out.println(e.toString());
|
|
|
|
+// // 插入任务日志
|
|
|
|
+// FxrwrzDTO errorDto = new FxrwrzDTO();
|
|
|
|
+// errorDto.setRwbsm(res.getBsm());
|
|
|
|
+// errorDto.setRwlx("辅助选址");
|
|
|
|
+// errorDto.setRzlr("生成选址简报错误:" + e.getMessage());
|
|
|
|
+// errorDto.setRzsj(new Date());
|
|
|
|
+// errorDto.setRzlx("error");
|
|
|
|
+// fxrwrzMapper.insert(errorDto);
|
|
|
|
+// } finally {
|
|
|
|
+// if (document != null) {
|
|
|
|
+// try {
|
|
|
|
+// document.close();
|
|
|
|
+// } catch (Exception ex) {
|
|
|
|
+// System.out.println(ex.toString());
|
|
|
|
+// }
|
|
|
|
+// }
|
|
|
|
+// if (outputStream != null) {
|
|
|
|
+// try {
|
|
|
|
+// outputStream.close();
|
|
|
|
+// } catch (IOException e) {
|
|
|
|
+// e.printStackTrace();
|
|
|
|
+// }
|
|
|
|
+// }
|
|
|
|
+// }
|
|
|
|
+// // 转PDF
|
|
|
|
+// String outfilepath = reportPath.replace(".docx", ".pdf");
|
|
|
|
+// NpoiHelper.doc2pdf(reportPath, outfilepath);
|
|
|
|
+// System.out.println(outfilepath);
|
|
|
|
+// }
|
|
|
|
|
|
- /**
|
|
|
|
- * SDE转SHP
|
|
|
|
- *
|
|
|
|
- * @param table SDE表
|
|
|
|
- * @param shpfile shp文件
|
|
|
|
- * @param where 追加字段
|
|
|
|
- * @return
|
|
|
|
- */
|
|
|
|
- public static String sde2Shp(String table, String shpfile, String where) {
|
|
|
|
- if (StringUtils.isNotEmpty(where)) {
|
|
|
|
- Map<String, String> params = new HashMap<>();
|
|
|
|
- params.put("table", table);
|
|
|
|
- params.put("shpfile", shpfile);
|
|
|
|
- params.put("where", where);
|
|
|
|
- return PythonExecute.RunGisHelper("sde2shp", params);
|
|
|
|
- } else {
|
|
|
|
- Map<String, String> params = new HashMap<>();
|
|
|
|
- params.put("table", table);
|
|
|
|
- params.put("shpfile", shpfile);
|
|
|
|
- return PythonExecute.RunGisHelper("sde2shp", params);
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
|
|
+// /**
|
|
|
|
+// * zip打包
|
|
|
|
+// */
|
|
|
|
+// private void createZipReport(FzxzEntityDTO res, String reportZip, String reportPath, String simplePath) {
|
|
|
|
+// File f = new File(fzxzShp);
|
|
|
|
+// System.out.println("选址分析报告打包zip:" + reportPath);
|
|
|
|
+// System.out.println("选址分析报告打包shp:" + fzxzShp);
|
|
|
|
+// if (StringUtils.isNotEmpty(fzxzShp)) {
|
|
|
|
+// String filePath = fzxzShp.substring(0, fzxzShp.lastIndexOf("."));
|
|
|
|
+// String docReportPath = reportPath.substring(0, reportPath.lastIndexOf("."));
|
|
|
|
+// String docSimplePath = reportPath.substring(0, reportPath.lastIndexOf("."));
|
|
|
|
+// // 生成的压缩文件
|
|
|
|
+// ZipFile zipFile = null;
|
|
|
|
+// try {
|
|
|
|
+// zipFile = new ZipFile(reportZip);
|
|
|
|
+// ZipParameters parameters = new ZipParameters();
|
|
|
|
+// // 压缩方式
|
|
|
|
+// parameters.setCompressionMethod(Zip4jConstants.COMP_DEFLATE);
|
|
|
|
+// // 压缩级别
|
|
|
|
+// parameters.setCompressionLevel(Zip4jConstants.DEFLATE_LEVEL_NORMAL);
|
|
|
|
+// zipFile.addFile(new File(simplePath), parameters);
|
|
|
|
+// zipFile.addFile(new File(reportPath), parameters);
|
|
|
|
+// zipFile.addFile(new File(filePath + ".shp"), parameters);
|
|
|
|
+// zipFile.addFile(new File(filePath + ".shx"), parameters);
|
|
|
|
+// zipFile.addFile(new File(filePath + ".dbf"), parameters);
|
|
|
|
+// zipFile.addFile(new File(filePath + ".cpg"), parameters);
|
|
|
|
+// zipFile.addFile(new File(filePath + ".prj"), parameters);
|
|
|
|
+// } catch (ZipException e) {
|
|
|
|
+// System.out.println(e.toString());
|
|
|
|
+// // 插入任务日志
|
|
|
|
+// FxrwrzDTO errorDto = new FxrwrzDTO();
|
|
|
|
+// errorDto.setRwbsm(res.getBsm());
|
|
|
|
+// errorDto.setRwlx("辅助选址");
|
|
|
|
+// errorDto.setRzlr("生成选址报告zip打包错误:" + e.getMessage());
|
|
|
|
+// errorDto.setRzsj(new Date());
|
|
|
|
+// errorDto.setRzlx("error");
|
|
|
|
+// fxrwrzMapper.insert(errorDto);
|
|
|
|
+// }
|
|
|
|
+// }
|
|
|
|
+// }
|
|
|
|
+//
|
|
|
|
+// /**
|
|
|
|
+// * 导出报告图片
|
|
|
|
+// *
|
|
|
|
+// * @param res
|
|
|
|
+// * @param xzbsmList 没有导出全部的地块
|
|
|
|
+// * @return
|
|
|
|
+// */
|
|
|
|
+// private List<String> ReportImg(FzxzEntityDTO res, List<String> xzbsmList) {
|
|
|
|
+// // 查询分析结果图斑信息
|
|
|
|
+// QueryWrapper<FzxzResDTO> giswrapper = new QueryWrapper<>();
|
|
|
|
+// giswrapper.eq("rwbsm", res.getBsm());
|
|
|
|
+// // 筛选方案,根据传参或者预选方案
|
|
|
|
+// // giswrapper.ne("yxfa", "0");
|
|
|
|
+// if (xzbsmList != null) {
|
|
|
|
+// giswrapper.in("bsm", xzbsmList);
|
|
|
|
+// }
|
|
|
|
+// List<FzxzResDTO> fzxzJgGisDTOList = fzxzResMapper.selectList(giswrapper);
|
|
|
|
+// // SDE转SHP
|
|
|
|
+// String inShp = fzxzShp;
|
|
|
|
+// List objidlist = new ArrayList<>();
|
|
|
|
+// for (FzxzResDTO cur : fzxzJgGisDTOList) {
|
|
|
|
+// // objidlist.add(cur.getObjectid());
|
|
|
|
+// }
|
|
|
|
+// String objids = Joiner.on(",").join(objidlist);
|
|
|
|
+// sde2Shp("KJGH.T_FZSS_FZXZ_JG_GIS", inShp, "\"OBJECTID\" IN (" + objids + ")");
|
|
|
|
+// // 执行python
|
|
|
|
+// Map<String, String> params = new HashMap<>();
|
|
|
|
+// List<String> result = PythonExecute.RunFzxzMap(mapFunctionId, params);
|
|
|
|
+// return result;
|
|
|
|
+// }
|
|
|
|
+//
|
|
|
|
+// /**
|
|
|
|
+// * SDE转SHP
|
|
|
|
+// *
|
|
|
|
+// * @param table SDE表
|
|
|
|
+// * @param shpfile shp文件
|
|
|
|
+// * @param where 追加字段
|
|
|
|
+// * @return
|
|
|
|
+// */
|
|
|
|
+// public static String sde2Shp(String table, String shpfile, String where) {
|
|
|
|
+// if (StringUtils.isNotEmpty(where)) {
|
|
|
|
+// Map<String, String> params = new HashMap<>();
|
|
|
|
+// params.put("table", table);
|
|
|
|
+// params.put("shpfile", shpfile);
|
|
|
|
+// params.put("where", where);
|
|
|
|
+// return PythonExecute.RunGisHelper("sde2shp", params);
|
|
|
|
+// } else {
|
|
|
|
+// Map<String, String> params = new HashMap<>();
|
|
|
|
+// params.put("table", table);
|
|
|
|
+// params.put("shpfile", shpfile);
|
|
|
|
+// return PythonExecute.RunGisHelper("sde2shp", params);
|
|
|
|
+// }
|
|
|
|
+// }
|
|
}
|
|
}
|