HgxfxSchedule.java 27 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492
  1. package com.onemap.analyse.task;
  2. import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
  3. import com.onemap.analyse.domain.*;
  4. import com.onemap.analyse.mapper.*;
  5. import com.onemap.analyse.utils.NpoiHelper;
  6. import com.onemap.common.core.utils.StringUtils;
  7. import org.apache.commons.io.FileUtils;
  8. import org.apache.poi.xwpf.usermodel.*;
  9. import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTTblWidth;
  10. import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTTcPr;
  11. import org.openxmlformats.schemas.wordprocessingml.x2006.main.STTblWidth;
  12. import org.slf4j.Logger;
  13. import org.slf4j.LoggerFactory;
  14. import org.springframework.beans.factory.annotation.Value;
  15. import org.springframework.scheduling.annotation.Async;
  16. import org.springframework.scheduling.annotation.Scheduled;
  17. import org.springframework.stereotype.Component;
  18. import javax.annotation.Resource;
  19. import java.io.File;
  20. import java.io.FileOutputStream;
  21. import java.io.OutputStream;
  22. import java.math.BigInteger;
  23. import java.text.SimpleDateFormat;
  24. import java.util.*;
  25. /**
  26. * 合规性分析模块定时刷新任务
  27. */
  28. // @Component
  29. public class HgxfxSchedule {
  30. // //间隔时间 单位ms
  31. // public static final long TIME_INTERVAL = 1 * 15000;
  32. // //任务状态标识码
  33. // private RwztDTO Rwzt = new RwztDTO();
  34. // @Resource
  35. // private HgxfxMapper hgxfxMapper;
  36. // @Resource
  37. // HgxfxHgscxMapper hgxfxHgscxMapper;
  38. // @Resource
  39. // HgxfxScxMapper hgxfxScxMapper;
  40. // @Resource
  41. // private FxrwrzMapper fxrwrzMapper;
  42. // @Resource
  43. // private FzssChscMapper fzssChscMapper;
  44. // //合规性分析python方法名标识
  45. // @Value("${Hgxfx.functionId}")
  46. // private String functionId;
  47. // @Value("${Hgxfx.temp}")
  48. // private String temp;
  49. // @Value("${Hgxfx.ftpOut}")
  50. // private String ftpOut;
  51. // private static final Logger log = LoggerFactory.getLogger(HgxfxSchedule.class);
  52. // /**
  53. // * Scheduled 定时器参数
  54. // * cron表达式:指定任务在特定时间执行
  55. // * fixedDelay:表示上一次任务执行完成后多久再执行,参数类型long,单位:ms
  56. // * fixedDelayString:与fixedDelay一样,只是参数类型是String
  57. // * fixedRate:表示按一定的频率执行任务,参数类型long,单位:ms 如: fixedRate(5000),表示这个定时器任务每5秒执行一次
  58. // * fixedRateString:与fixedRate一样,只是参数类型变为String
  59. // * initialDelay:表示延迟多久再第一次执行任务,参数类型为long ,单位:ms
  60. // * initialDelayString:与initialDelay一样,只是参数类型String
  61. // */
  62. // /**
  63. // * @Async("name") 开启多线程
  64. // */
  65. // /**
  66. // * 合规性分析执行入口
  67. // */
  68. // @Async("taskExecutor")
  69. // //@Scheduled(fixedDelay = TIME_INTERVAL)
  70. // public void HgxfxStatus() {
  71. // try {
  72. // QueryWrapper<HgxfxDTO> wrapper = new QueryWrapper<HgxfxDTO>();
  73. // wrapper.eq("rwzt", Rwzt.getCreate());
  74. // //以创建时间正序排列
  75. // wrapper.orderByAsc("cjsj");
  76. // //每次只操作一条记录
  77. // List<HgxfxDTO> ress = hgxfxMapper.selectList(wrapper);
  78. // if (ress.size() > 0) {
  79. // HgxfxDTO res = ress.get(0);
  80. // //插入执行状态
  81. // res.setRwzt(Rwzt.getRun());
  82. // res.setRwkssj(new Date());
  83. // QueryWrapper<HgxfxDTO> query = new QueryWrapper<HgxfxDTO>();
  84. // query.eq("bsm", res.getBsm());
  85. // hgxfxMapper.update(res, query);
  86. // //插入任务日志
  87. // FxrwrzDTO rzDto = new FxrwrzDTO();
  88. // rzDto.setRwbsm(res.getBsm());
  89. // rzDto.setRwlx("合规性检查");
  90. // rzDto.setRzlr("开始分析");
  91. // rzDto.setRzlx("info");
  92. // rzDto.setRzsj(new Date());
  93. // fxrwrzMapper.insert(rzDto);
  94. // //执行python
  95. // Map<String, String> params = new HashMap<>();
  96. // params.put("bsm", res.getBsm());
  97. // String result = PythonExecute.Run(functionId, params);
  98. // if (!StringUtils.isEmpty(result) && result.contains("OK")) {//成功
  99. // res.setRwjssj(new Date());
  100. // res.setRwzt(Rwzt.getComplete());
  101. // //捕获报告生成异常
  102. // try {
  103. // //TODO 生成合规性分析结果报告 返回 FxReport实体
  104. // FxReport report = createReport(res.getBsm());
  105. // res.setFxbg(report.getReportfile());
  106. // hgxfxMapper.update(res, query);
  107. // //TODO 策划生成 项目
  108. // if ("OpenAPI".equals(res.getRwly())) {
  109. // QueryWrapper<FzxzChscDTO> chscwrapper = new QueryWrapper<FzxzChscDTO>();
  110. // chscwrapper.eq("bsm", res.getBsm());
  111. // FzxzChscDTO chscDto = fzssChscMapper.selectOne(chscwrapper);
  112. // chscDto.setRwzt(Rwzt.getComplete());
  113. // chscDto.setRwjg("分析完成");
  114. // chscDto.setRwjd(100);
  115. // fzssChscMapper.update(chscDto, chscwrapper);
  116. // //拷贝合规性分析报告
  117. // com.onemap.common.core.utils.file.FileUtils.copyNewFileAndRename(ftpOut, report.getPdffile(), chscDto.getXmmc() + ".pdf");
  118. // }
  119. // //插入任务日志
  120. // FxrwrzDTO rzDto2 = new FxrwrzDTO();
  121. // rzDto2.setRwbsm(res.getBsm());
  122. // rzDto2.setRwlx("合规性检查");
  123. // rzDto2.setRzlr("生成分析报告完成");
  124. // rzDto2.setRzlx("info");
  125. // rzDto2.setRzsj(new Date());
  126. // fxrwrzMapper.insert(rzDto2);
  127. // //休眠1S,避免日志插入时间相同
  128. // Thread.sleep(1000 * 1);
  129. // //插入成功日志
  130. // FxrwrzDTO successDto = new FxrwrzDTO();
  131. // successDto.setRwbsm(res.getBsm());
  132. // successDto.setRwlx("合规性检查");
  133. // successDto.setRzlr("分析完成");
  134. // successDto.setRzlx("info");
  135. // successDto.setRzsj(new Date());
  136. // fxrwrzMapper.insert(successDto);
  137. // } catch (Exception e) {
  138. // e.printStackTrace();
  139. // res.setRwzt(Rwzt.getError());
  140. // hgxfxMapper.update(res, query);
  141. // if ("OpenAPI".equals(res.getRwly())) {
  142. // QueryWrapper<FzxzChscDTO> chscwrapper = new QueryWrapper<FzxzChscDTO>();
  143. // chscwrapper.eq("bsm", res.getBsm());
  144. // FzxzChscDTO chscDto = fzssChscMapper.selectOne(chscwrapper);
  145. // chscDto.setRwzt(Rwzt.getError());
  146. // chscDto.setRwjg("报告生成异常");
  147. // fzssChscMapper.update(chscDto, chscwrapper);
  148. // }
  149. // //插入任务日志
  150. // FxrwrzDTO errorDto = new FxrwrzDTO();
  151. // errorDto.setRwbsm(res.getBsm());
  152. // errorDto.setRwlx("合规性检查");
  153. // errorDto.setRzlr("报告生成异常");
  154. // errorDto.setRzlx("error");
  155. // errorDto.setRzsj(new Date());
  156. // fxrwrzMapper.insert(errorDto);
  157. // }
  158. // } else {//失败
  159. // res.setRwjssj(new Date());
  160. // res.setRwzt(Rwzt.getError());
  161. // hgxfxMapper.update(res, query);
  162. // if ("OpenAPI".equals(res.getRwly())) {
  163. // QueryWrapper<FzxzChscDTO> chscwrapper = new QueryWrapper<FzxzChscDTO>();
  164. // chscwrapper.eq("bsm", res.getBsm());
  165. // FzxzChscDTO chscDto = fzssChscMapper.selectOne(chscwrapper);
  166. // chscDto.setRwzt(Rwzt.getError());
  167. // chscDto.setRwjg("分析错误");
  168. // fzssChscMapper.update(chscDto, chscwrapper);
  169. // }
  170. // //插入任务日志
  171. // FxrwrzDTO errorDto = new FxrwrzDTO();
  172. // errorDto.setRwbsm(res.getBsm());
  173. // errorDto.setRwlx("合规性检查");
  174. // errorDto.setRzlr("分析范围内无基础数据");
  175. // errorDto.setRzlx("error");
  176. // errorDto.setFxjg(result);
  177. // errorDto.setRzsj(new Date());
  178. // fxrwrzMapper.insert(errorDto);
  179. // }
  180. // System.out.println("合规性分析模块:" + res.getBsm() + "完成!!!!!!!! " + new Date().toString());
  181. // }
  182. // } catch (Exception e) {
  183. // e.printStackTrace();
  184. // }
  185. // }
  186. //
  187. // /**
  188. // * 根据任务标识码生成报告
  189. // *
  190. // * @return
  191. // */
  192. // public FxReport createReport(String bsm) {
  193. // //插入任务日志
  194. // // FxrwrzDTO rzDto = new FxrwrzDTO();
  195. // // rzDto.setRwbsm(bsm);
  196. // // rzDto.setRwlx("合规性检查");
  197. // // rzDto.setRzlr("开始生成分析报告");
  198. // // rzDto.setRzlx("info");
  199. // // rzDto.setRzsj(new Date());
  200. // // fxrwrzMapper.insert(rzDto);
  201. // FxReport fxReport = new FxReport();
  202. // QueryWrapper<HgxfxDTO> wrapper = new QueryWrapper<HgxfxDTO>();
  203. // wrapper.eq("bsm", bsm);
  204. // HgxfxDTO res = hgxfxMapper.selectOne(wrapper);
  205. // //文件硬盘真实路径
  206. // String timeStamp = new Date().getTime() + "";
  207. // String rootPath = temp + File.separator + "合规性检查报告"
  208. // + File.separator + res.getBsm();
  209. // File rootFile = new File(rootPath);
  210. // if (!rootFile.exists()) {
  211. // rootFile.mkdirs();
  212. // }
  213. // String reportPath = rootPath
  214. // + File.separator + res.getXmmc() + "(合规性检查报告)_" + timeStamp + ".docx";
  215. // //解析文件路径为web路径
  216. // String webFilePath = StringUtils.getFileStaticPath(reportPath);
  217. // double mj = 0;
  218. // if (res != null) {
  219. // XWPFDocument document = null;
  220. // OutputStream outputStream = null;//把doc输出到输出流
  221. // try {
  222. // //前端映射路径
  223. // System.out.println(reportPath);
  224. // //创建poi XWPFDocument doc文件
  225. // document = new XWPFDocument();
  226. // int pos = 0;
  227. // //文本标题
  228. // String title = res.getXmmc() + "合规性检查报告";
  229. // NpoiHelper.title(document, title, pos++);
  230. // NpoiHelper.Option option = new NpoiHelper.Option();
  231. // option.setFontSize(19);
  232. // option.setAlign(ParagraphAlignment.CENTER);
  233. // option.setBold(true);
  234. // List<String> list = new ArrayList<>();
  235. // list.add("");
  236. // document.setParagraph(NpoiHelper.newParagraph(document, list, option), pos++);
  237. // SimpleDateFormat sdf = new SimpleDateFormat("yyyy年MM月dd日");
  238. // option = new NpoiHelper.Option();
  239. // option.setAlign(ParagraphAlignment.CENTER);
  240. // document.setParagraph(NpoiHelper.newParagraph(document, sdf.format(new Date())
  241. // , option), pos++);
  242. // NpoiHelper.catalog(document, "一、项目合规性审查", pos++);
  243. // XWPFTable table = document.createTable(1, 4);
  244. // int tableIndex = 0;
  245. // table.setWidth(9000);//总宽度
  246. // table.setCellMargins(100, 0, 200, 0);
  247. // for (int i = 0; i < 4; i++) {
  248. // XWPFTableCell cell = table.getRow(0).getCell(i);
  249. // CTTcPr ctTcPr = cell.getCTTc().isSetTcPr() ? cell.getCTTc().getTcPr() : cell.getCTTc().addNewTcPr();
  250. // CTTblWidth ctTblWidth = ctTcPr.addNewTcW();
  251. // ctTblWidth.setW(BigInteger.valueOf(2250));
  252. // ctTblWidth.setType(STTblWidth.DXA);
  253. // }
  254. // //Table 表格第1行
  255. // NpoiHelper.Option optionCenterAndBold = new NpoiHelper.Option();
  256. // optionCenterAndBold.setBold(true);
  257. // optionCenterAndBold.setAlign(ParagraphAlignment.CENTER);
  258. // NpoiHelper.Option optionCenter = new NpoiHelper.Option();
  259. // optionCenter.setAlign(ParagraphAlignment.CENTER);
  260. // table.getRow(0).getCell(0).setParagraph(NpoiHelper.setCellText(table, "项目名称", optionCenterAndBold));
  261. // table.getRow(0).getCell(1).setParagraph(NpoiHelper.setCellText(table, res.getXmmc(), null));
  262. // table.getRow(0).getCell(2).setParagraph(NpoiHelper.setCellText(table, "项目类型", optionCenterAndBold));
  263. // table.getRow(0).getCell(3).setParagraph(NpoiHelper.setCellText(table, res.getXmlx(), null));
  264. // XWPFTableRow row = table.createRow();
  265. // tableIndex++;
  266. // row.getCell(0).setParagraph(NpoiHelper.setCellText(table, "用地面积", optionCenterAndBold));
  267. // row.getCell(1).setParagraph(NpoiHelper.setCellText(table, res.getFxmj() + "㎡", null));
  268. // row.getCell(2).setParagraph(NpoiHelper.setCellText(table, "建设单位", optionCenterAndBold));
  269. // row.getCell(3).setParagraph(NpoiHelper.setCellText(table, res.getJsdw(), null));
  270. // row = table.createRow();
  271. // tableIndex++;
  272. // row.getCell(0).setParagraph(NpoiHelper.setCellText(table, "管控要素分类", optionCenterAndBold));
  273. // row.getCell(1).setParagraph(NpoiHelper.setCellText(table, "检查要素", optionCenterAndBold));
  274. // row.getCell(2).setParagraph(NpoiHelper.setCellText(table, "涉及面积", optionCenterAndBold));
  275. // row.getCell(3).setParagraph(NpoiHelper.setCellText(table, "结论", optionCenterAndBold));
  276. // //先查询FzssHgxfxHgscx,再查询FzssHgxfxScx
  277. // QueryWrapper<HgxfxHgscxDTO> wrapperHgxfxHgscxDTO = new QueryWrapper<HgxfxHgscxDTO>();
  278. // wrapperHgxfxHgscxDTO.eq("rwbsm", res.getBsm());
  279. // List<HgxfxHgscxExportDTO> hgxfxHgscxDTOList = hgxfxHgscxMapper.queryScxList(res.getBsm());
  280. //
  281. // //一级控制线
  282. // Map[] mapArray = new Map[hgxfxHgscxDTOList.size()];
  283. // //审查项数组排序序号
  284. // int index = 0;
  285. // for (int i = 0; i < hgxfxHgscxDTOList.size(); i++) {
  286. // HgxfxHgscxExportDTO hgxfxHgscxDTO = hgxfxHgscxDTOList.get(i);
  287. // if (hgxfxHgscxDTO.getKzxjb() == 1) {
  288. // Map<String, Object> map = new HashMap<>();
  289. // map.put("scx", hgxfxHgscxDTO);
  290. // map.put("hgscx", hgxfxHgscxDTO);
  291. // mapArray[index] = map;
  292. // index++;
  293. // }
  294. // }
  295. // int startRowIndex = tableIndex;
  296. // for (int i = 0; i < mapArray.length; i++) {
  297. // if (mapArray[i] != null) {
  298. // HgxfxHgscxExportDTO hgxfxHgscxDTO = (HgxfxHgscxExportDTO) mapArray[i].get("hgscx");
  299. // if (hgxfxHgscxDTO != null) {
  300. // hgxfxHgscxDTO.setZdmj(hgxfxHgscxDTO.getZdmj() == null ? 0 : hgxfxHgscxDTO.getZdmj());
  301. // row = table.createRow();
  302. // tableIndex++;
  303. // row.getCell(0).setParagraph(NpoiHelper.setCellText(table, "一级控制线", optionCenterAndBold));
  304. // row.getCell(1).setParagraph(NpoiHelper.setCellText(table, hgxfxHgscxDTO.getYsmc(), null));
  305. // row.getCell(2).setParagraph(NpoiHelper.setCellText(table, Math.round(hgxfxHgscxDTO.getZdmj()) + "m²", optionCenter));
  306. // row.getCell(3).setParagraph(NpoiHelper.setCellText(table, hgxfxHgscxDTO.getJcjg(), null));
  307. // mj = mj + hgxfxHgscxDTO.getZdmj();
  308. // }
  309. // }
  310. // }
  311. // //合并列
  312. // NpoiHelper.mergeCellsVertically(table, 0, startRowIndex + 1, tableIndex);
  313. //
  314. // //二级控制线
  315. // mapArray = new Map[hgxfxHgscxDTOList.size()];
  316. // //审查项数组排序序号
  317. // index = 0;
  318. // for (int i = 0; i < hgxfxHgscxDTOList.size(); i++) {
  319. // //二级控制线
  320. // HgxfxHgscxExportDTO hgxfxHgscxDTO = hgxfxHgscxDTOList.get(i);
  321. // if (hgxfxHgscxDTO != null) {
  322. // if (hgxfxHgscxDTO.getKzxjb() == 2) {
  323. // Map<String, Object> map = new HashMap<>();
  324. // map.put("scx", hgxfxHgscxDTO);
  325. // map.put("hgscx", hgxfxHgscxDTO);
  326. // mapArray[index] = map;
  327. // index++;
  328. // }
  329. // }
  330. // }
  331. // startRowIndex = tableIndex;
  332. // for (int i = 0; i < mapArray.length; i++) {
  333. // if (mapArray[i] != null) {
  334. // HgxfxHgscxExportDTO hgxfxHgscxDTO = (HgxfxHgscxExportDTO) mapArray[i].get("hgscx");
  335. // if (hgxfxHgscxDTO != null) {
  336. // row = table.createRow();
  337. // tableIndex++;
  338. // row.getCell(0).setParagraph(NpoiHelper.setCellText(table, "二级控制线", optionCenterAndBold));
  339. // row.getCell(1).setParagraph(NpoiHelper.setCellText(table, hgxfxHgscxDTO.getYsmc(), null));
  340. // row.getCell(2).setParagraph(NpoiHelper.setCellText(table, Math.round(hgxfxHgscxDTO.getZdmj()) + "m²", optionCenter));
  341. // row.getCell(3).setParagraph(NpoiHelper.setCellText(table, hgxfxHgscxDTO.getJcjg(), null));
  342. // mj = mj + hgxfxHgscxDTO.getZdmj();
  343. // }
  344. // }
  345. // }
  346. // //设置用地面积
  347. // table.getRow(1).getCell(1).setParagraph(NpoiHelper.setCellText(table, res.getFxmj() + "㎡", null));
  348. // NpoiHelper.mergeCellsVertically(table, 0, startRowIndex + 1, tableIndex);
  349. // //TODO wanger 将其他审查项插入到表
  350. // Map<String, List<HgxfxHgscxExportDTO>> scxMap = new HashMap<>();
  351. // //组织数据
  352. // for (int i = 0; i < hgxfxHgscxDTOList.size(); i++) {
  353. // HgxfxHgscxExportDTO hgxfxHgscxDTO = hgxfxHgscxDTOList.get(i);
  354. // if (hgxfxHgscxDTO.getKzxjb() > 2) {
  355. // String classify = hgxfxHgscxDTO.getTjzd();
  356. // if (scxMap.get(classify) == null) {
  357. // scxMap.put(classify, new ArrayList<>());
  358. // }
  359. // scxMap.get(classify).add(hgxfxHgscxDTO);
  360. // }
  361. // }
  362. // //循环添加
  363. // Iterator<Map.Entry<String, List<HgxfxHgscxExportDTO>>> iterator = scxMap.entrySet().iterator();
  364. // while (iterator.hasNext()) {
  365. // Map.Entry<String, List<HgxfxHgscxExportDTO>> entry = iterator.next();
  366. // String key = entry.getKey();
  367. // List<HgxfxHgscxExportDTO> value = entry.getValue();
  368. //
  369. // mapArray = new Map[value.size()];
  370. // //审查项数组排序序号
  371. // index = 0;
  372. // for (int i = 0; i < value.size(); i++) {
  373. // //二级控制线
  374. // HgxfxHgscxExportDTO hgxfxHgscxDTO = value.get(i);
  375. // Map<String, HgxfxHgscxExportDTO> map = new HashMap<>();
  376. // map.put("scx", hgxfxHgscxDTO);
  377. // map.put("hgscx", hgxfxHgscxDTO);
  378. // mapArray[index] = map;
  379. // index++;
  380. // }
  381. // startRowIndex = tableIndex;
  382. // for (int i = 0; i < mapArray.length; i++) {
  383. // if (mapArray[i] != null) {
  384. // HgxfxHgscxExportDTO hgxfxHgscxDTO = (HgxfxHgscxExportDTO) mapArray[i].get("hgscx");
  385. // if (hgxfxHgscxDTO != null) {
  386. // row = table.createRow();
  387. // tableIndex++;
  388. // row.getCell(0).setParagraph(NpoiHelper.setCellText(table, key, optionCenterAndBold));
  389. // row.getCell(1).setParagraph(NpoiHelper.setCellText(table, hgxfxHgscxDTO.getYsmc(), null));
  390. // row.getCell(2).setParagraph(NpoiHelper.setCellText(table, Math.round(hgxfxHgscxDTO.getZdmj()) + "m²", optionCenter));
  391. // row.getCell(3).setParagraph(NpoiHelper.setCellText(table, hgxfxHgscxDTO.getJcjg(), null));
  392. // mj = mj + hgxfxHgscxDTO.getZdmj();
  393. // }
  394. // }
  395. // }
  396. // //设置用地面积
  397. // table.getRow(1).getCell(1).setParagraph(NpoiHelper.setCellText(table, res.getFxmj() + "㎡", null));
  398. // NpoiHelper.mergeCellsVertically(table, 0, startRowIndex + 1, tableIndex);
  399. // }
  400. //
  401. //
  402. // //第二章节
  403. // NpoiHelper.catalog(document, "二、项目用地明细", pos++);
  404. // XWPFTable tableSecond = document.createTable(1, 5);
  405. // tableSecond.setCellMargins(100, 0, 200, 0);
  406. // tableSecond.setWidth(9000);//总宽度
  407. // //Table 表格第0行
  408. // tableSecond.getRow(0).getCell(0).setParagraph(NpoiHelper.setCellText(tableSecond, "一级地类", optionCenterAndBold));
  409. // tableSecond.getRow(0).getCell(2).setParagraph(NpoiHelper.setCellText(tableSecond, "二级地类", optionCenterAndBold));
  410. // tableSecond.getRow(0).getCell(4).setParagraph(NpoiHelper.setCellText(tableSecond, "占地面积", optionCenterAndBold));
  411. // //合并列
  412. // NpoiHelper.mergeHorizontal(tableSecond, 0, 0, 1);
  413. // NpoiHelper.mergeHorizontal(tableSecond, 0, 2, 3);
  414. // //查询HgxfxFxtbDTO
  415. // List<HgxfxFxtbDTO> hgxfxFxtbDTOList = hgxfxMapper.getFxtb(res.getBsm());
  416. // NpoiHelper.Option optionFontSizeAlign = new NpoiHelper.Option();
  417. // optionFontSizeAlign.setAlign(ParagraphAlignment.CENTER);
  418. // optionFontSizeAlign.setFontSize(10);
  419. // NpoiHelper.Option optionFontSize = new NpoiHelper.Option();
  420. // optionFontSize.setFontSize(10);
  421. // for (int i = 0; i < hgxfxFxtbDTOList.size(); i++) {
  422. // HgxfxFxtbDTO hgxfxFxtbDTO = hgxfxFxtbDTOList.get(i);
  423. // XWPFTableRow row1 = tableSecond.createRow();
  424. // tableIndex++;
  425. // row1.getCell(0).setParagraph(NpoiHelper.setCellText(tableSecond, hgxfxFxtbDTO.getDldm1(), optionFontSizeAlign));
  426. // row1.getCell(1).setParagraph(NpoiHelper.setCellText(tableSecond, hgxfxFxtbDTO.getDlmc1(), optionFontSize));
  427. // row1.getCell(2).setParagraph(NpoiHelper.setCellText(tableSecond, hgxfxFxtbDTO.getDldm2(), optionFontSizeAlign));
  428. // row1.getCell(3).setParagraph(NpoiHelper.setCellText(tableSecond, hgxfxFxtbDTO.getDlmc2(), optionFontSize));
  429. // if (hgxfxFxtbDTO.getMj() == null) {
  430. // hgxfxFxtbDTO.setMj(0.0);
  431. // }
  432. // row1.getCell(4).setParagraph(NpoiHelper.setCellText(tableSecond, Math.round(hgxfxFxtbDTO.getMj()) + "㎡", optionFontSizeAlign));
  433. // }
  434. // if (tableSecond.getRow(1) != null) {
  435. // for (int i = 0; i < 5; i++) {
  436. // XWPFTableCell cell = tableSecond.getRow(1).getCell(i);
  437. // CTTcPr ctTcPr = cell.getCTTc().isSetTcPr() ? cell.getCTTc().getTcPr() : cell.getCTTc().addNewTcPr();
  438. // CTTblWidth ctTblWidth = ctTcPr.addNewTcW();
  439. // ctTblWidth.setW(BigInteger.valueOf(1800));
  440. // ctTblWidth.setType(STTblWidth.DXA);
  441. // }
  442. // }
  443. // File fileDoc = new File(reportPath);
  444. // if (fileDoc.exists()) {
  445. // FileUtils.delete(fileDoc);
  446. // }
  447. // //word文件输出流
  448. // outputStream = new FileOutputStream(reportPath);
  449. // document.write(outputStream);
  450. // } catch (Exception e) {
  451. // log.error(e.toString());
  452. // //插入任务日志
  453. // FxrwrzDTO errorDto = new FxrwrzDTO();
  454. // errorDto.setRwbsm(res.getBsm());
  455. // errorDto.setRwlx("合规性检查");
  456. // errorDto.setRzlr("报告生成异常:" + e.getMessage());
  457. // errorDto.setRzlx("error");
  458. // errorDto.setRzsj(new Date());
  459. // fxrwrzMapper.insert(errorDto);
  460. // // e.printStackTrace();
  461. // } finally {
  462. // if (outputStream != null) {
  463. // try {
  464. // outputStream.close();
  465. // } catch (Exception ex) {
  466. // log.error(ex.toString());
  467. // }
  468. // }
  469. // if (document != null) {
  470. // try {
  471. // document.close();
  472. // } catch (Exception ex) {
  473. // log.error(ex.toString());
  474. // }
  475. // }
  476. // }
  477. // //转PDF
  478. // String outfilepath = reportPath.replace(".docx", ".pdf");
  479. // if (new File(reportPath).exists()) {
  480. // NpoiHelper.doc2pdf(reportPath, outfilepath);
  481. // //更新报告对象
  482. // fxReport.setReportfile(webFilePath);
  483. // fxReport.setMj(mj);
  484. // fxReport.setPdffile(outfilepath);
  485. // }
  486. // }
  487. // return fxReport;
  488. // }
  489. }