|
@@ -1,853 +0,0 @@
|
|
|
-package com.onemap.analyse.task;
|
|
|
-
|
|
|
-import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
-import com.google.common.base.Joiner;
|
|
|
-import com.onemap.analyse.domain.*;
|
|
|
-import com.onemap.analyse.mapper.*;
|
|
|
-import com.onemap.analyse.mapper.base.FzxzResMapper;
|
|
|
-import com.onemap.analyse.utils.NpoiHelper;
|
|
|
-import com.onemap.analyse.utils.NumberUtil;
|
|
|
-import com.onemap.common.core.utils.StringUtils;
|
|
|
-import net.lingala.zip4j.core.ZipFile;
|
|
|
-import net.lingala.zip4j.exception.ZipException;
|
|
|
-import net.lingala.zip4j.model.ZipParameters;
|
|
|
-import net.lingala.zip4j.util.Zip4jConstants;
|
|
|
-import org.apache.commons.io.FileUtils;
|
|
|
-import org.apache.poi.xwpf.usermodel.*;
|
|
|
-import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTTblWidth;
|
|
|
-import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTTcPr;
|
|
|
-import org.openxmlformats.schemas.wordprocessingml.x2006.main.STTblWidth;
|
|
|
-import org.springframework.beans.factory.annotation.Value;
|
|
|
-import org.springframework.stereotype.Component;
|
|
|
-import org.springframework.stereotype.Service;
|
|
|
-
|
|
|
-import javax.annotation.Resource;
|
|
|
-import java.io.*;
|
|
|
-import java.math.BigInteger;
|
|
|
-import java.text.SimpleDateFormat;
|
|
|
-import java.util.*;
|
|
|
-import java.util.stream.Collectors;
|
|
|
-
|
|
|
-/**
|
|
|
- * 辅助选址模块定时刷新任务
|
|
|
- */
|
|
|
-@Component
|
|
|
-@Service
|
|
|
-public class FzxzSchedule {
|
|
|
- // 间隔时间 单位ms
|
|
|
- public static final long TIME_INTERVAL = 1 * 15000;
|
|
|
- // 任务状态标识码
|
|
|
- private RwztDTO Rwzt = new RwztDTO();
|
|
|
- @Resource
|
|
|
- private FzxzMapper fzxzMapper;
|
|
|
- @Resource
|
|
|
- private FxrwrzMapper fxrwrzMapper;
|
|
|
- @Resource
|
|
|
- private FzxzXzyzMapper fzxzXzyzMapper;
|
|
|
- @Resource
|
|
|
- private FzxzTbMapper fzxzTbMapper;
|
|
|
- @Resource
|
|
|
- private FzxzXzyzDTO fzxzXzyzDTO;
|
|
|
-
|
|
|
- @Resource
|
|
|
- private FzxzResMapper fzxzResMapper;
|
|
|
-
|
|
|
- // 辅助选址python方法名标识
|
|
|
- @Value("${Fzxz.functionId}")
|
|
|
- private String functionId;
|
|
|
- @Value("${Fzxz.mapFunctionId}")
|
|
|
- private String mapFunctionId;
|
|
|
- @Value("${Fzxz.fzxzShp}")
|
|
|
- private String fzxzShp;
|
|
|
- @Value("${Hgxfx.temp}")
|
|
|
- private String temp;
|
|
|
- ///**
|
|
|
- // * Scheduled 定时器参数
|
|
|
- // * cron表达式:指定任务在特定时间执行
|
|
|
- // * fixedDelay:表示上一次任务执行完成后多久再执行,参数类型long,单位:ms
|
|
|
- // * fixedDelayString:与fixedDelay一样,只是参数类型是String
|
|
|
- // * fixedRate:表示按一定的频率执行任务,参数类型long,单位:ms 如: fixedRate(5000),表示这个定时器任务每5秒执行一次
|
|
|
- // * fixedRateString:与fixedRate一样,只是参数类型变为String
|
|
|
- // * initialDelay:表示延迟多久再第一次执行任务,参数类型为long ,单位:ms
|
|
|
- // * initialDelayString:与initialDelay一样,只是参数类型String
|
|
|
- // */
|
|
|
- /**
|
|
|
- * @Async("name") 开启多线程
|
|
|
- */
|
|
|
- /**
|
|
|
- * 辅助选址执行入口
|
|
|
- */
|
|
|
- // @Async("taskExecutor")
|
|
|
- // @Scheduled(fixedDelay = TIME_INTERVAL)
|
|
|
- // public void FzxzStatus() {
|
|
|
- // try {
|
|
|
- // QueryWrapper<FzxzDTO> wrapper = new QueryWrapper<FzxzDTO>();
|
|
|
- // wrapper.eq("rwzt", Rwzt.getCreate());
|
|
|
- // //以创建时间正序排列
|
|
|
- // wrapper.orderByAsc("cjsj");
|
|
|
- // //每次只操作一条记录
|
|
|
- // List<FzxzDTO> ress = fzxzMapper.selectList(wrapper);
|
|
|
- // if (ress.size() > 0) {
|
|
|
- // FzxzDTO res = ress.get(0);
|
|
|
- // //插入执行状态
|
|
|
- // res.setRwzt(Rwzt.getRun());
|
|
|
- // res.setRwkssj(new Date());
|
|
|
- // QueryWrapper<FzxzDTO> query = new QueryWrapper<FzxzDTO>();
|
|
|
- // query.eq("bsm", res.getBsm());
|
|
|
- // fzxzMapper.update(res, query);
|
|
|
- // //插入任务日志
|
|
|
- // FxrwrzDTO rzDto = new FxrwrzDTO();
|
|
|
- // rzDto.setRwbsm(res.getBsm());
|
|
|
- // rzDto.setRwlx("辅助选址");
|
|
|
- // rzDto.setRzlr("开始分析");
|
|
|
- // rzDto.setRzlx("info");
|
|
|
- // rzDto.setRzsj(new Date());
|
|
|
- // fxrwrzMapper.insert(rzDto);
|
|
|
- // //执行python
|
|
|
- // Map<String, String> params = new HashMap<>();
|
|
|
- // params.put("bsm", res.getBsm());
|
|
|
- // String result = PythonExecute.Run(functionId, params);
|
|
|
- // if (!StringUtils.isEmpty(result) && result.contains("OK")) {//成功
|
|
|
- // res.setRwjssj(new Date());
|
|
|
- // res.setRwzt(Rwzt.getComplete());
|
|
|
- // //TODO 生成辅助选址结果报告 返回 FxReport实体
|
|
|
- // FzxzReport report = createReport(res.getBsm(), null);
|
|
|
- // if (report != null) {
|
|
|
- // res.setFxbg(report.getReportfile().replace(".docx", ".pdf"));
|
|
|
- // res.setZip(report.getZipfile());
|
|
|
- // }
|
|
|
- // fzxzMapper.update(res, query);
|
|
|
- // //插入成功日志
|
|
|
- // FxrwrzDTO successDto = new FxrwrzDTO();
|
|
|
- // successDto.setRwbsm(res.getBsm());
|
|
|
- // successDto.setRwlx("辅助选址");
|
|
|
- // successDto.setRzlr("计算完成");
|
|
|
- // successDto.setRzlx("info");
|
|
|
- // successDto.setRzsj(new Date());
|
|
|
- // fxrwrzMapper.insert(successDto);
|
|
|
- // } else {//失败
|
|
|
- // res.setRwjssj(new Date());
|
|
|
- // res.setRwzt(Rwzt.getError());
|
|
|
- // fzxzMapper.update(res, query);
|
|
|
- // //插入任务日志
|
|
|
- // FxrwrzDTO errorDto = new FxrwrzDTO();
|
|
|
- // errorDto.setRwbsm(res.getBsm());
|
|
|
- // errorDto.setRwlx("辅助选址");
|
|
|
- // errorDto.setRzlr("计算错误");
|
|
|
- // errorDto.setRzsj(new Date());
|
|
|
- // errorDto.setRzlx("error");
|
|
|
- // errorDto.setFxjg(result);
|
|
|
- // fxrwrzMapper.insert(errorDto);
|
|
|
- // }
|
|
|
- // System.out.println("辅助选址模块:" + res.getBsm() + "完成!!!!!!!! " + new Date().toString());
|
|
|
- // }
|
|
|
- // } catch (Exception e) {
|
|
|
- // e.printStackTrace();
|
|
|
- // }
|
|
|
- // }
|
|
|
-
|
|
|
- // 根据选址任务生成报告
|
|
|
- // public FzxzReport createReport(String bsm, List<String> xzbsmList) {
|
|
|
- // FzxzEntityDTO res = fzxzMapper.GetFzxzByBsm(bsm);
|
|
|
- // FzxzReport fzxzReport = new FzxzReport();
|
|
|
- // if (res != null) {
|
|
|
- // // 文件硬盘真实路径
|
|
|
- // String timeStamp = new Date().getTime() + "";
|
|
|
- // String rootPath = temp + File.separator + "辅助选址报告" + File.separator + res.getBsm();
|
|
|
- // File f = new File(rootPath);
|
|
|
- // if (!f.exists()) {
|
|
|
- // f.mkdirs();
|
|
|
- // }
|
|
|
- // String reportPath = res.getXmmc() + "(选址报告)_" + timeStamp + ".docx";
|
|
|
- // String simplePath = res.getXmmc() + "(选址简报)_" + timeStamp + ".docx";
|
|
|
- // String zipPath = res.getXmmc() + "_" + timeStamp + ".zip";
|
|
|
- // // 选址报告
|
|
|
- // createReport(res, rootPath + File.separator + reportPath, xzbsmList);
|
|
|
- // // 选址简报
|
|
|
- // createSimpleReport(res, rootPath + File.separator + simplePath, xzbsmList);
|
|
|
- // // zip打包
|
|
|
- // createZipReport(res, rootPath + File.separator + zipPath, rootPath + File.separator + reportPath, rootPath + File.separator + simplePath);
|
|
|
- // // 生成返回结果
|
|
|
- // fzxzReport.setRootPath(StringUtils.getFileStaticPath(rootPath));
|
|
|
- // fzxzReport.setReportfile(StringUtils.getFileStaticPath(rootPath + File.separator + reportPath));
|
|
|
- // // fzxzReport.setSimplefile(StringUtils.getFileStaticPath(rootPath + File.separator + simplePath));
|
|
|
- // // fzxzReport.setZipfile(StringUtils.getFileStaticPath(rootPath + File.separator + zipPath));
|
|
|
- // fzxzReport.setBsm(bsm);
|
|
|
- // fzxzReport.setFxbg(fzxzReport.getReportfile());
|
|
|
- // fzxzReport.setJsdw(res.getJsdw());
|
|
|
- // fzxzReport.setXmmc(res.getXmmc());
|
|
|
- // // 查询分析结果图斑信息
|
|
|
- // QueryWrapper<FzxzResDTO> giswrapper = new QueryWrapper<>();
|
|
|
- // giswrapper.eq("rwbsm", res.getBsm());
|
|
|
- // List<FzxzResDTO> gisinfo = fzxzResMapper.selectList(giswrapper);
|
|
|
- // fzxzReport.setItems(gisinfo);
|
|
|
- // }
|
|
|
- // // 插入开始生成报告日志
|
|
|
- // FxrwrzDTO successDto2 = new FxrwrzDTO();
|
|
|
- // successDto2.setRwbsm(bsm);
|
|
|
- // successDto2.setRwlx("辅助选址");
|
|
|
- // successDto2.setRzlr("选址报告生成结束");
|
|
|
- // successDto2.setRzlx("info");
|
|
|
- // successDto2.setRzsj(new Date());
|
|
|
- // fxrwrzMapper.insert(successDto2);
|
|
|
- // return fzxzReport;
|
|
|
- // }
|
|
|
-
|
|
|
- /**
|
|
|
- * 选址报告
|
|
|
- *
|
|
|
- * @param res
|
|
|
- * @param reportPath
|
|
|
- * @param xzbsmList 没有导出全部地块
|
|
|
- */
|
|
|
-// private void createReport(FzxzEntityDTO res, String reportPath, List<String> xzbsmList) {
|
|
|
-// List<String> imgList = ReportImg(res, xzbsmList);
|
|
|
-// // 创建document文档对象对象实例
|
|
|
-// XWPFDocument document = null;
|
|
|
-// OutputStream outputStream = null;// 把doc输出到输出流
|
|
|
-// try {
|
|
|
-// document = new XWPFDocument();
|
|
|
-// int pos = 0;
|
|
|
-// // 文本标题
|
|
|
-// NpoiHelper.title(document, res.getXmmc() + "选址报告", pos++);
|
|
|
-// SimpleDateFormat sdf = new SimpleDateFormat("yyyy年MM月dd日");
|
|
|
-// NpoiHelper.Option optionCENTER = new NpoiHelper.Option();
|
|
|
-// optionCENTER.setAlign(ParagraphAlignment.CENTER);
|
|
|
-// document.setParagraph(NpoiHelper.newParagraph(document, sdf.format(new Date()), optionCENTER), pos++);
|
|
|
-// NpoiHelper.catalog(document, "一、项目选址信息", pos++);
|
|
|
-// 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();
|
|
|
-// List<String> listTemp = new ArrayList<String>();
|
|
|
-// listTemp.add("\t项目名称:" + res.getXmmc());
|
|
|
-// listTemp.add("\t建设单位:" + res.getJsdw());
|
|
|
-// listTemp.add("\t用地面积:" + ydmj + "平方米");
|
|
|
-// listTemp.add("\t用地性质:" + res.getYdmc());
|
|
|
-// listTemp.add("\t影响因子:");
|
|
|
-// NpoiHelper.content(document, listTemp, pos++);
|
|
|
-// List tabYzTitles = new ArrayList<NpoiHelper.TableTitle>();
|
|
|
-// NpoiHelper.TableTitle tableTitle = new NpoiHelper.TableTitle();
|
|
|
-// tableTitle.setKey("YXYZMC");
|
|
|
-// tableTitle.setName("因子名称");
|
|
|
-// tableTitle.setWidth(2880);
|
|
|
-// tabYzTitles.add(tableTitle);
|
|
|
-// tableTitle = new NpoiHelper.TableTitle();
|
|
|
-// tableTitle.setKey("YZTJ_TEXT");
|
|
|
-// tableTitle.setName("影响条件");
|
|
|
-// tableTitle.setAlign(ParagraphAlignment.CENTER);
|
|
|
-// tableTitle.setWidth(2880);
|
|
|
-// tabYzTitles.add(tableTitle);
|
|
|
-// tableTitle = new NpoiHelper.TableTitle();
|
|
|
-// tableTitle.setKey("YXZ");
|
|
|
-// tableTitle.setName("约束范围值(M)");
|
|
|
-// tableTitle.setAlign(ParagraphAlignment.CENTER);
|
|
|
-// tableTitle.setWidth(2880);
|
|
|
-// tabYzTitles.add(tableTitle);
|
|
|
-// // 查询选址因子,并且转换为List<Map> 因子条件(包含:C、不包含:N、分析:A)
|
|
|
-// QueryWrapper<FzxzXzyzDTO> wrapper = new QueryWrapper<FzxzXzyzDTO>();
|
|
|
-// wrapper.eq("rwbsm", res.getBsm());
|
|
|
-// List<FzxzXzyzDTO> fzxzXzyzDTOList = fzxzXzyzMapper.selectList(wrapper);
|
|
|
-// List<Map<String, Object>> dataTablelist = new ArrayList<>();
|
|
|
-// for (int i = 0; i < fzxzXzyzDTOList.size(); i++) {
|
|
|
-// Map<String, Object> map = new HashMap<>();
|
|
|
-// FzxzXzyzDTO fzxzXzyzDTO = fzxzXzyzDTOList.get(i);
|
|
|
-// map.put("YXYZMC", fzxzXzyzDTO.getYxyzmc());
|
|
|
-// 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 = "分析";
|
|
|
-// // }
|
|
|
-// // }
|
|
|
-//
|
|
|
-// map.put("YZTJ_TEXT", yztj);
|
|
|
-// Float yxz = (float) 0;
|
|
|
-// if (fzxzXzyzDTO.getYxz() != null) {
|
|
|
-// yxz = fzxzXzyzDTO.getYxz();
|
|
|
-// }
|
|
|
-// map.put("YXZ", yxz);
|
|
|
-// dataTablelist.add(map);
|
|
|
-// }
|
|
|
-// XWPFTable tableYz = NpoiHelper.setComTable(document, tabYzTitles, dataTablelist, "表1:选址影响因子", pos++);
|
|
|
-// NpoiHelper.catalog(document, "二、选址范围分析", pos++);
|
|
|
-// // 查询辅助选址分析图斑
|
|
|
-// QueryWrapper<FzxzTbEntityDTO> wrapperTb = new QueryWrapper<FzxzTbEntityDTO>();
|
|
|
-// wrapperTb.eq("rwbsm", res.getBsm());
|
|
|
-// wrapperTb.groupBy("objectid", "rwbsm", "ydyhfldm", "ydyhflmc", "frequency", "sum_mj");
|
|
|
-// List<FzxzTbEntityDTO> fzxzTbEntityDTOList = fzxzTbMapper.selectList(wrapperTb);
|
|
|
-// // 计算面积总和
|
|
|
-// double sumcount = 0;
|
|
|
-// for (int i = 0; i < fzxzTbEntityDTOList.size(); i++) {
|
|
|
-// sumcount = sumcount + fzxzTbEntityDTOList.get(i).getSumMj();
|
|
|
-// }
|
|
|
-//
|
|
|
-// List<FzxzTbEntityDTO> list = fzxzTbEntityDTOList.stream().sorted(Comparator.comparing(FzxzTbEntityDTO::getSumMj).reversed()).collect(Collectors.toList());
|
|
|
-// String fwfx = "\t根据指定选址分析得出,所选范围共" + Math.round(sumcount) + "平方米,其中";
|
|
|
-// List<Map<String, Object>> fztable = new ArrayList<>();
|
|
|
-// // 生成地类分析统计表
|
|
|
-// for (int i = 0; i < list.size(); i++) {
|
|
|
-// FzxzTbEntityDTO item = list.get(i);
|
|
|
-// String zb = String.format("%.1f", item.getSumMj() / sumcount * 100);
|
|
|
-// if (i < 5) {
|
|
|
-// // 面积前五的占比地类计算
|
|
|
-// fwfx += item.getYdyhflmc() + Math.round(item.getSumMj()) + "平方米,占比" + zb + "%;";
|
|
|
-// }
|
|
|
-// // List<FzxzTbEntityDTO>转List<Map<String, Object>> 地类编码 地类名称 面积(平方千米) 占比(%)
|
|
|
-// Map map = new HashMap();
|
|
|
-// map.put("ZB", zb);
|
|
|
-// map.put("YDYHFLDM", item.getYdyhfldm());
|
|
|
-// map.put("YDYHFLMC", item.getYdyhflmc());
|
|
|
-// map.put("SUM_MJ", Math.round(item.getSumMj()));
|
|
|
-// fztable.add(map);
|
|
|
-// }
|
|
|
-// fwfx = fwfx.substring(0, fwfx.length() - 1) + "。详情如下:";
|
|
|
-// NpoiHelper.content(document, fwfx, pos++);
|
|
|
-// // 地类编码 地类名称 面积(平方千米) 占比(%)
|
|
|
-// List<NpoiHelper.TableTitle> tabYztbTitles = new ArrayList();
|
|
|
-// NpoiHelper.TableTitle tableTitleTb = new NpoiHelper.TableTitle();
|
|
|
-// tableTitleTb.setKey("YDYHFLDM");
|
|
|
-// tableTitleTb.setName("地类编码");
|
|
|
-// tableTitleTb.setAlign(ParagraphAlignment.CENTER);
|
|
|
-// tableTitleTb.setWidth(2010);
|
|
|
-// tabYztbTitles.add(tableTitleTb);
|
|
|
-// tableTitleTb = new NpoiHelper.TableTitle();
|
|
|
-// tableTitleTb.setKey("YDYHFLMC");
|
|
|
-// tableTitleTb.setName("地类名称");
|
|
|
-// tableTitleTb.setWidth(2910);
|
|
|
-// tabYztbTitles.add(tableTitleTb);
|
|
|
-// tableTitleTb = new NpoiHelper.TableTitle();
|
|
|
-// tableTitleTb.setKey("SUM_MJ");
|
|
|
-// tableTitleTb.setName("面积(平方千米)");
|
|
|
-// tableTitleTb.setAlign(ParagraphAlignment.CENTER);
|
|
|
-// tableTitleTb.setWidth(1870);
|
|
|
-// tabYztbTitles.add(tableTitleTb);
|
|
|
-// tableTitleTb = new NpoiHelper.TableTitle();
|
|
|
-// tableTitleTb.setKey("ZB");
|
|
|
-// tableTitleTb.setName("占比(%)");
|
|
|
-// tableTitleTb.setAlign(ParagraphAlignment.CENTER);
|
|
|
-// tableTitleTb.setWidth(1700);
|
|
|
-// tabYztbTitles.add(tableTitleTb);
|
|
|
-// XWPFTable tableYztb = NpoiHelper.setComTable(document, tabYztbTitles, fztable, "表2:地类分析统计表", pos++);
|
|
|
-// // 查询结果
|
|
|
-// 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);
|
|
|
-// NpoiHelper.catalog(document, "三、选址分析", pos++);
|
|
|
-// String ydmc = res.getYdmc();
|
|
|
-// if (!StringUtils.isEmpty(ydmc)) {
|
|
|
-// if (ydmc.lastIndexOf("用地") == ydmc.length() - 2) {
|
|
|
-// ydmc = res.getYdmc().substring(0, ydmc.length() - 2);
|
|
|
-// }
|
|
|
-// NpoiHelper.content(document, "\t按照项目选址要求和影响因子,经对所选范围内的所有" + ydmc + "用地进行分析,筛选出符合要求的方案共" + fzxzJgGisDTOList.size() + "个。", pos++);
|
|
|
-// } else {
|
|
|
-// NpoiHelper.content(document, "\t按照项目选址要求和影响因子,经对所选范围内的所有用地进行分析,筛选出符合要求的方案共" + fzxzJgGisDTOList.size() + "个。", pos++);
|
|
|
-// }
|
|
|
-//
|
|
|
-// int index = 1;
|
|
|
-// NpoiHelper.Option optionIsBold = new NpoiHelper.Option();
|
|
|
-// optionIsBold.setBold(true);
|
|
|
-// for (int i = 0; i < fzxzJgGisDTOList.size(); i++) {
|
|
|
-// FzxzResDTO item = fzxzJgGisDTOList.get(i);
|
|
|
-// document.setParagraph(NpoiHelper.newParagraph(document, index + "、方案" + NumberUtil.int2chineseNum(index), optionIsBold), pos++);
|
|
|
-// XWPFTable table = document.createTable(7, 4);
|
|
|
-// table.setWidth(9000);// 总宽度
|
|
|
-// 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(2250));
|
|
|
-// ctTblWidth.setType(STTblWidth.DXA);
|
|
|
-// }
|
|
|
-// // Table 表格第一行
|
|
|
-// table.getRow(0).getCell(0).setColor("DBE5F1");
|
|
|
-// NpoiHelper.mergeHorizontal(table, 0, 0, 3);
|
|
|
-// table.getRow(0).getCell(0).setParagraph(NpoiHelper.setCellText(table, "符合用地情况", optionIsBold));
|
|
|
-// // Table 表格第二行
|
|
|
-// table.getRow(1).getCell(0).setParagraph(NpoiHelper.setCellText(table, "地类编码", optionIsBold));
|
|
|
-// // table.getRow(1).getCell(1).setParagraph(NpoiHelper.setCellText(table, item.getDlbm(), null));
|
|
|
-// table.getRow(1).getCell(2).setParagraph(NpoiHelper.setCellText(table, "地类名称", optionIsBold));
|
|
|
-// // table.getRow(1).getCell(3).setParagraph(NpoiHelper.setCellText(table, item.getDlmc(), null));
|
|
|
-// // Table 表格第三行
|
|
|
-// table.getRow(2).getCell(0).setParagraph(NpoiHelper.setCellText(table, "地块面积", optionIsBold));
|
|
|
-// // table.getRow(2).getCell(1).setParagraph(NpoiHelper.setCellText(table, Math.round(item.getTbmj()) + "平方米", null));
|
|
|
-// table.getRow(2).getCell(2).setParagraph(NpoiHelper.setCellText(table, "土地位置", optionIsBold));
|
|
|
-// // table.getRow(2).getCell(3).setParagraph(NpoiHelper.setCellText(table, item.getXzqmc(), null));
|
|
|
-// // Table 表格第四行
|
|
|
-// table.getRow(3).getCell(0).setColor("DBE5F1");
|
|
|
-// NpoiHelper.mergeHorizontal(table, 3, 0, 3);
|
|
|
-// table.getRow(3).getCell(0).setParagraph(NpoiHelper.setCellText(table, "地块位置信息", optionIsBold));
|
|
|
-// // Table 表格第五行 -专题图
|
|
|
-// NpoiHelper.mergeHorizontal(table, 4, 0, 1);
|
|
|
-// NpoiHelper.mergeHorizontal(table, 4, 2, 3);
|
|
|
-// String mapF = "";
|
|
|
-// String mapM = "";
|
|
|
-// if (imgList != null && imgList.size() > 0) {
|
|
|
-// for (int j = 0; j < imgList.size(); j++) {
|
|
|
-// String s = imgList.get(j);
|
|
|
-// if (s.indexOf(item.getBsm() + "_F") >= 0) {
|
|
|
-// mapF = s;// 全局
|
|
|
-// }
|
|
|
-// if (s.indexOf(item.getBsm() + "_M") >= 0) {
|
|
|
-// mapM = s;// 局部
|
|
|
-// }
|
|
|
-// }
|
|
|
-// }
|
|
|
-// if (StringUtils.isNotEmpty(mapF)) {
|
|
|
-// FileInputStream fis = null;
|
|
|
-// try {
|
|
|
-// fis = new FileInputStream(new File(mapF));
|
|
|
-// XWPFParagraph paragraph = table.getRow(4).getCell(0).addParagraph();
|
|
|
-// paragraph.setAlignment(ParagraphAlignment.CENTER);
|
|
|
-// XWPFRun run = paragraph.createRun();
|
|
|
-// run.addPicture(fis, // 条形码图片的位置
|
|
|
-// Document.PICTURE_TYPE_JPEG, // 图片类型
|
|
|
-// item.getBsm() + "_F.jpeg", // 图片名称
|
|
|
-// 2200000, // 图片的长
|
|
|
-// 1700000 // 图片的宽
|
|
|
-// );
|
|
|
-// run.addBreak(BreakType.TEXT_WRAPPING);
|
|
|
-// run.setText("(宏观位置)");
|
|
|
-// } catch (Exception e) {
|
|
|
-// System.out.println(e.toString());
|
|
|
-// } finally {
|
|
|
-// if (fis != null) {
|
|
|
-// try {
|
|
|
-// fis.close();
|
|
|
-// } catch (IOException e) {
|
|
|
-// throw e;
|
|
|
-// }
|
|
|
-// }
|
|
|
-// }
|
|
|
-// }
|
|
|
-// if (StringUtils.isNotEmpty(mapM)) {
|
|
|
-// FileInputStream fis = null;
|
|
|
-// try {
|
|
|
-// fis = new FileInputStream(new File(mapM));
|
|
|
-// XWPFParagraph paragraph = table.getRow(4).getCell(2).addParagraph();
|
|
|
-// paragraph.setAlignment(ParagraphAlignment.CENTER);
|
|
|
-// XWPFRun run = paragraph.createRun();
|
|
|
-// run.addPicture(fis, // 条形码图片的位置
|
|
|
-// Document.PICTURE_TYPE_JPEG, // 图片类型
|
|
|
-// item.getBsm() + "_M.jpeg", // 图片名称
|
|
|
-// 2200000, // 图片的长
|
|
|
-// 1700000 // 图片的宽
|
|
|
-// );
|
|
|
-// run.addBreak(BreakType.TEXT_WRAPPING);
|
|
|
-// run.setText("(具体位置)");
|
|
|
-// } catch (Exception e) {
|
|
|
-// System.out.println(e.toString());
|
|
|
-// throw e;
|
|
|
-// } finally {
|
|
|
-// if (fis != null) {
|
|
|
-// try {
|
|
|
-// fis.close();
|
|
|
-// } catch (IOException e) {
|
|
|
-// throw e;
|
|
|
-// }
|
|
|
-// }
|
|
|
-// }
|
|
|
-// }
|
|
|
-// // Table 表格第六行
|
|
|
-// table.getRow(5).getCell(0).setColor("DBE5F1");
|
|
|
-// NpoiHelper.mergeHorizontal(table, 5, 0, 3);
|
|
|
-// table.getRow(5).getCell(0).setParagraph(NpoiHelper.setCellText(table, "分析结论", optionIsBold));
|
|
|
-// // Table 表格第七行
|
|
|
-// NpoiHelper.mergeHorizontal(table, 6, 0, 3);
|
|
|
-// XWPFParagraph para6 = table.getRow(6).getCell(0).addParagraph();
|
|
|
-// para6.setAlignment(ParagraphAlignment.LEFT);
|
|
|
-//
|
|
|
-// // 查询辅助选址因子
|
|
|
-// // QueryWrapper<FzxzResDTO> jgyzWrapper = new QueryWrapper<>();
|
|
|
-// // jgyzWrapper.eq("jbbsm", item.getBsm());
|
|
|
-// // jgyzWrapper.ne("yztj", "F");
|
|
|
-// // List<FzxzXzyzDTO> jgyzList = fzxzJgyzMapper.selectList(jgyzWrapper);
|
|
|
-//
|
|
|
-// int jgyzid = 1;
|
|
|
-// for (int j = 0; j < fzxzXzyzDTOList.size(); j++) {
|
|
|
-// FzxzXzyzDTO fzxzJgyzDTO = fzxzXzyzDTOList.get(j);
|
|
|
-// XWPFRun run = para6.createRun();
|
|
|
-// // TODO
|
|
|
-// // run.setText(jgyzid + "、" + fzxzJgyzDTO.getFxjg());
|
|
|
-// run.addBreak(BreakType.TEXT_WRAPPING);
|
|
|
-// jgyzid++;
|
|
|
-// }
|
|
|
-// // 查询辅助选址因子
|
|
|
-// // jgyzWrapper = new QueryWrapper<FzxzJgyzDTO>();
|
|
|
-// // jgyzWrapper.eq("jbbsm", item.getBsm());
|
|
|
-// // jgyzWrapper.eq("yztj", "F");
|
|
|
-// // jgyzList = fzxzJgyzMapper.selectList(jgyzWrapper);
|
|
|
-//
|
|
|
-// for (int j = 0; j < fzxzXzyzDTOList.size(); j++) {
|
|
|
-// FzxzXzyzDTO jgyz = fzxzXzyzDTOList.get(j);
|
|
|
-// XWPFRun run = para6.createRun();
|
|
|
-// // String jg = jgyz.getFxjg();
|
|
|
-// // TODO
|
|
|
-// String jg = "";
|
|
|
-// Double jgDouble = 0.0;
|
|
|
-// try {
|
|
|
-// // jgDouble = Double.parseDouble(jg);
|
|
|
-// // TODO
|
|
|
-// run.setText(jgyzid + "、压占" + jgyz.getYxyzmc() + "面积" + jg + "平方米");
|
|
|
-// } catch (Exception e) {
|
|
|
-// run.setText(jg);
|
|
|
-// }
|
|
|
-// run.addBreak(BreakType.TEXT_WRAPPING);
|
|
|
-// jgyzid++;
|
|
|
-// }
|
|
|
-// index++;
|
|
|
-// }
|
|
|
-// File fileDoc = new File(reportPath);
|
|
|
-// if (fileDoc.exists()) {
|
|
|
-// FileUtils.forceDelete(fileDoc);
|
|
|
-// }
|
|
|
-// // word文件输出流
|
|
|
-// outputStream = new FileOutputStream(reportPath);
|
|
|
-// document.write(outputStream);
|
|
|
-// } catch (Exception e) {
|
|
|
-// e.printStackTrace();
|
|
|
-// // 插入任务日志
|
|
|
-// 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);
|
|
|
-// }
|
|
|
-
|
|
|
-// /**
|
|
|
-// * 选址简报
|
|
|
-// */
|
|
|
-// 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;
|
|
|
-// }
|
|
|
-//
|
|
|
-// /**
|
|
|
-// * 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);
|
|
|
-// }
|
|
|
-// }
|
|
|
-}
|