TSpecdevYlgdController.java 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542
  1. package com.ruoyi.project.sems.controller;
  2. import java.io.FileOutputStream;
  3. import java.io.IOException;
  4. import java.io.OutputStream;
  5. import java.text.SimpleDateFormat;
  6. import java.util.ArrayList;
  7. import java.util.List;
  8. import com.alibaba.fastjson.JSON;
  9. import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
  10. import com.ruoyi.common.thread.SpecDevYlgdThread;
  11. import com.ruoyi.common.thread.SpecDevYlrqThread;
  12. import com.ruoyi.common.utils.DateUtils;
  13. import com.ruoyi.common.utils.file.ExcelUtils;
  14. import com.ruoyi.project.sems.domain.*;
  15. import com.ruoyi.project.sems.service.ITSpecCheckService;
  16. import com.ruoyi.project.system.domain.SysDept;
  17. import com.ruoyi.project.system.domain.SysDictData;
  18. import com.ruoyi.project.system.service.ISysDeptService;
  19. import com.ruoyi.project.system.service.ISysDictTypeService;
  20. import org.apache.poi.ss.usermodel.*;
  21. import org.apache.poi.xssf.streaming.SXSSFWorkbook;
  22. import org.springframework.security.access.prepost.PreAuthorize;
  23. import org.springframework.beans.factory.annotation.Autowired;
  24. import org.springframework.web.bind.annotation.*;
  25. import com.ruoyi.framework.aspectj.lang.annotation.Log;
  26. import com.ruoyi.framework.aspectj.lang.enums.BusinessType;
  27. import com.ruoyi.project.sems.service.ITSpecdevYlgdService;
  28. import com.ruoyi.framework.web.controller.BaseController;
  29. import com.ruoyi.framework.web.domain.AjaxResult;
  30. import com.ruoyi.common.utils.poi.ExcelUtil;
  31. import com.ruoyi.framework.web.page.TableDataInfo;
  32. import org.springframework.web.multipart.MultipartFile;
  33. /**
  34. * 特种设备压力管道台账Controller
  35. *
  36. * @author ruoyi
  37. * @date 2021-07-22
  38. */
  39. @RestController
  40. @RequestMapping("/sems/specYlgd")
  41. public class TSpecdevYlgdController extends BaseController {
  42. @Autowired
  43. private ITSpecdevYlgdService tSpecdevYlgdService;
  44. @Autowired
  45. private ITSpecCheckService tSpecCheckService;
  46. @Autowired
  47. private ISysDeptService iSysDeptService;
  48. @Autowired
  49. private ISysDictTypeService iSysDictTypeService;
  50. /**
  51. * 查询特种设备压力管道台账列表
  52. */
  53. @PreAuthorize("@ss.hasPermi('sems:specYlgd:list')")
  54. @GetMapping("/list")
  55. public TableDataInfo list(TSpecdevYlgd tSpecdevYlgd) {
  56. startPage();
  57. List<TSpecdevYlgd> list = tSpecdevYlgdService.selectTSpecdevYlgdList(tSpecdevYlgd);
  58. return getDataTable(list);
  59. }
  60. /**
  61. * 导出特种设备压力管道台账列表
  62. */
  63. @PreAuthorize("@ss.hasPermi('sems:specYlgd:export')")
  64. @Log(title = "特种设备压力管道台账", businessType = BusinessType.EXPORT)
  65. @GetMapping("/export")
  66. public AjaxResult export(TSpecdevYlgd tSpecdevYlgd) {
  67. List<TSpecdevYlgd> list = tSpecdevYlgdService.selectTSpecdevYlgdList(tSpecdevYlgd);
  68. ExcelUtil<TSpecdevYlgd> util = new ExcelUtil<TSpecdevYlgd>(TSpecdevYlgd.class);
  69. return util.exportExcel(list, "specYlgd");
  70. }
  71. /**
  72. * 获取特种设备压力管道台账详细信息
  73. */
  74. @PreAuthorize("@ss.hasPermi('sems:specYlgd:query')")
  75. @GetMapping(value = "/{id}")
  76. public AjaxResult getInfo(@PathVariable("id") Long id) {
  77. return AjaxResult.success(tSpecdevYlgdService.selectTSpecdevYlgdById(id));
  78. }
  79. /**
  80. * 新增特种设备压力管道台账
  81. */
  82. @PreAuthorize("@ss.hasPermi('sems:specYlgd:add')")
  83. @Log(title = "特种设备压力管道台账", businessType = BusinessType.INSERT)
  84. @PostMapping
  85. public AjaxResult add(@RequestBody TSpecdevYlgd tSpecdevYlgd) {
  86. return toAjax(tSpecdevYlgdService.insertTSpecdevYlgd(tSpecdevYlgd));
  87. }
  88. /**
  89. * 修改特种设备压力管道台账
  90. */
  91. @PreAuthorize("@ss.hasPermi('sems:specYlgd:edit')")
  92. @Log(title = "特种设备压力管道台账", businessType = BusinessType.UPDATE)
  93. @PutMapping
  94. public AjaxResult edit(@RequestBody TSpecdevYlgd tSpecdevYlgd) {
  95. TSpecdevYlgd old = tSpecdevYlgdService.selectTSpecdevYlgdById(tSpecdevYlgd.getId());
  96. if (!old.getReportNo().equals(tSpecdevYlgd.getReportNo())) {
  97. TSpecCheck tc = new TSpecCheck();
  98. tc.setDevType(2l);
  99. tc.setCheckUnit(tSpecdevYlgd.getCheckUnit());
  100. tc.setDevId(tSpecdevYlgd.getId());
  101. tc.setNextWarnDate(tSpecdevYlgd.getNextWarnDate());
  102. tc.setReportNo(tSpecdevYlgd.getReportNo());
  103. tc.setWarnDate(tSpecdevYlgd.getWarnDate());
  104. tc.setYearNextWarnDate(tSpecdevYlgd.getYearNextWarnDate());
  105. tc.setYearWarnDate(tSpecdevYlgd.getYearWarnDate());
  106. tc.setYearReportNo(tSpecdevYlgd.getReportNo());
  107. tc.setSafeClass(tSpecdevYlgd.getSafeClass());
  108. tSpecCheckService.insertTSpecCheck(tc);
  109. }
  110. return toAjax(tSpecdevYlgdService.updateTSpecdevYlgd(tSpecdevYlgd));
  111. }
  112. /**
  113. * 删除特种设备压力管道台账
  114. */
  115. @PreAuthorize("@ss.hasPermi('sems:specYlgd:remove')")
  116. @Log(title = "特种设备压力管道台账", businessType = BusinessType.DELETE)
  117. @DeleteMapping("/{ids}")
  118. public AjaxResult remove(@PathVariable Long[] ids) {
  119. return toAjax(tSpecdevYlgdService.deleteTSpecdevYlgdByIds(ids));
  120. }
  121. /**
  122. * 去重
  123. */
  124. @PreAuthorize("@ss.hasPermi('sems:plant:remove')")
  125. @GetMapping("/duplicate")
  126. public AjaxResult duplicate()
  127. {
  128. tSpecdevYlgdService.duplicateTSpecdevYlgd();
  129. return AjaxResult.success();
  130. }
  131. /**
  132. * 批量导入
  133. */
  134. @PreAuthorize("@ss.hasPermi('sems:specYlgd:add')")
  135. @Log(title = "特种设备批量导入", businessType = BusinessType.INSERT)
  136. @PostMapping("/importData")
  137. public AjaxResult importData(@RequestParam("file") MultipartFile file) throws IOException {
  138. //获取操作人员ID
  139. Long userId = getUserId();
  140. //报错行数统计
  141. List<Integer> failRow = new ArrayList<Integer>();
  142. Workbook workbook = ExcelUtils.getWorkBook(file);
  143. Sheet sheet = workbook.getSheetAt(0);
  144. List<TSpecdevYlgd> list = new ArrayList<TSpecdevYlgd>();
  145. //字典查询
  146. List<SysDictData> plant = iSysDictTypeService.selectDictDataByType("PLANT_DIVIDE");
  147. //部门查询
  148. List<SysDept> dept = iSysDeptService.selectDeptList(new SysDept());
  149. int rowNum = sheet.getPhysicalNumberOfRows();
  150. int failNumber = 0;
  151. for (int i = 1; i < rowNum; i++) {
  152. try {
  153. logger.info("读取行数:" + i);
  154. Row row = sheet.getRow(i);
  155. int cellNum = row.getLastCellNum();
  156. TSpecdevYlgd entity = new TSpecdevYlgd();
  157. for (int j = 0; j < cellNum; j++) {
  158. Cell cell = row.getCell(j);
  159. if (cell == null) {
  160. continue;
  161. }
  162. String cellValue = ExcelUtils.getCellValue(cell);
  163. logger.info("cellValue:" + cellValue);
  164. if (j == 0) {
  165. //序号
  166. } else if (j == 1) {
  167. entity.setPlantCode(cellValue);//装置名称
  168. } else if (j == 2) {
  169. entity.setUnit(cellValue);//单元
  170. } else if (j == 3) {
  171. entity.setPlantMaint(cellValue);//装置维修组
  172. } else if (j == 4) {
  173. entity.setEngineer(cellValue);//装置维修工程师
  174. } else if (j == 5) {
  175. entity.setDevname(cellValue);//管道名称
  176. } else if (j == 6) {
  177. entity.setDevno(cellValue);//管道编号
  178. } else if (j == 7) {
  179. entity.setRegno(cellValue);//压力管道注册代码
  180. } else if (j == 8) {
  181. entity.setUseno(cellValue);//使用登记表编号
  182. } else if (j == 9) {
  183. entity.setGrade(cellValue);//管道级别
  184. } else if (j == 10) {
  185. entity.setDesigner(cellValue);//设计单位
  186. } else if (j == 11) {
  187. entity.setInstaller(cellValue);//安装单位
  188. } else if (j == 12) {//安装年月
  189. logger.info("日期格式:" + cellValue);
  190. if (cellValue.length() > 3) {
  191. entity.setInstallDate(new SimpleDateFormat(DateUtils.getDateFormat(cellValue)).parse(cellValue));
  192. }
  193. } else if (j == 13) {//投用年月
  194. logger.info("日期格式:" + cellValue);
  195. if (cellValue.length() > 3) {
  196. entity.setSubmitdate(new SimpleDateFormat(DateUtils.getDateFormat(cellValue)).parse(cellValue));
  197. }
  198. } else if (j == 14) {
  199. entity.setMaterial(cellValue);//材质
  200. } else if (j == 15) {
  201. entity.setDia(cellValue);//管道外径(英寸)
  202. } else if (j == 16) {
  203. entity.setScheduleNo(cellValue);//厚度等级
  204. } else if (j == 17) {
  205. entity.setLength(cellValue);//长度
  206. } else if (j == 18) {
  207. entity.setWeldNumber(cellValue);//焊口数量
  208. } else if (j == 19) {
  209. entity.setStarting(cellValue);//起点
  210. } else if (j == 20) {
  211. entity.setEnding(cellValue);//终点
  212. } else if (j == 21) {
  213. entity.setLayingMethod(cellValue);//敷设方式
  214. } else if (j == 22) {
  215. entity.setMedium(cellValue);//介质
  216. } else if (j == 23) {
  217. entity.setDesPressure(cellValue);//设计压力
  218. } else if (j == 24) {
  219. entity.setDesTemp(cellValue);//设计温度
  220. } else if (j == 25) {
  221. entity.setOptPressure(cellValue);//工作压力
  222. } else if (j == 26) {
  223. entity.setOptTemp(cellValue);//工作温度
  224. } else if (j == 27) {
  225. entity.setAdiabatic(cellValue);//绝热层代码
  226. } else if (j == 28) {
  227. entity.setAntiCorrosion(cellValue);//防腐层代码
  228. } else if (j == 29) {
  229. entity.setIsDanger(cellValue);
  230. } else if (j == 30) {
  231. entity.setCheckUnit(cellValue);//检验单位
  232. } else if (j == 31) {//检验日期
  233. if (cellValue.length() < 4) {
  234. continue;
  235. }
  236. entity.setWarnDate(new SimpleDateFormat(DateUtils.getDateFormat(cellValue)).parse(cellValue));
  237. } else if (j == 32) {
  238. entity.setSafeClass(cellValue);//安全状况等级
  239. } else if (j == 33) {
  240. //年度检查报告编号
  241. entity.setReportNo(cellValue);//报告编号
  242. } else if (j == 34) {//下次检验日期
  243. logger.info("日期格式:" + cellValue);
  244. if (cellValue.length() < 4) {
  245. continue;
  246. }
  247. entity.setNextWarnDate(new SimpleDateFormat(DateUtils.getDateFormat(cellValue)).parse(cellValue));
  248. } else if (j == 35) {
  249. if (cellValue.length() > 3) {//年度检查日期
  250. entity.setYearWarnDate(new SimpleDateFormat(DateUtils.getDateFormat(cellValue)).parse(cellValue));
  251. }
  252. } else if (j == 36) {
  253. entity.setCheckConclusion(cellValue);//年度结论
  254. } else if (j == 37) {
  255. if (cellValue.length() > 3) {//下次年度检验日期
  256. entity.setYearNextWarnDate(new SimpleDateFormat(DateUtils.getDateFormat(cellValue)).parse(cellValue));
  257. }
  258. } else if (j == 38) {
  259. entity.setYearReportNo(cellValue);
  260. } else if (j == 39) {
  261. entity.setRemarks(cellValue);//备注
  262. } /*else if (j == 39) {
  263. for (SysDept d : dept) {
  264. if (d.getDeptName().equals(cellValue)) {
  265. entity.setDeptId(d.getDeptId());//部门编号
  266. }
  267. }
  268. }*/
  269. }
  270. entity.setCreaterCode(userId);
  271. logger.info("entity:" + entity);
  272. list.add(entity);
  273. } catch (Exception e) {
  274. failNumber++;
  275. logger.info("e:" + JSON.toJSONString(e));
  276. failRow.add(i + 1);
  277. }
  278. }
  279. int successNumber = 0;
  280. int failNum = 0;
  281. for (TSpecdevYlgd t : list
  282. ) {
  283. failNum++;
  284. try {
  285. tSpecdevYlgdService.insertTSpecdevYlgd(t);
  286. successNumber++;
  287. } catch (Exception e) {
  288. failNumber++;
  289. logger.info("e:" + e);
  290. failRow.add(failNum + 1);
  291. }
  292. }
  293. logger.info("list:" + JSON.toJSONString(list));
  294. logger.info("successNumber:" + String.valueOf(successNumber));
  295. logger.info("failNumber:" + String.valueOf(failNumber));
  296. logger.info("failRow:" + String.valueOf(failRow));
  297. return AjaxResult.success(String.valueOf(successNumber), failRow);
  298. }
  299. /**
  300. * 批量导入
  301. * 检验更新中的批量导入
  302. */
  303. @PreAuthorize("@ss.hasPermi('sems:specYlgd:add')")
  304. @Log(title = "特种设备批量导入", businessType = BusinessType.INSERT)
  305. @PostMapping("/updateData")
  306. public AjaxResult updateData(@RequestParam("file") MultipartFile file) throws IOException {
  307. //获取操作人员ID
  308. Long userId = getUserId();
  309. //报错行数统计
  310. List<Integer> failRow = new ArrayList<Integer>();
  311. Workbook workbook = ExcelUtils.getWorkBook(file);
  312. Sheet sheet = workbook.getSheetAt(0);
  313. List<TSpecdevYlgd> list = new ArrayList<TSpecdevYlgd>();
  314. List<TSpecdevYlgd> oldList = new ArrayList<TSpecdevYlgd>();
  315. TSpecdevYlgd oldEntity = new TSpecdevYlgd();
  316. //字典查询
  317. List<SysDictData> plant = iSysDictTypeService.selectDictDataByType("PLANT_DIVIDE");
  318. //部门查询
  319. List<SysDept> dept = iSysDeptService.selectDeptList(new SysDept());
  320. int rowNum = sheet.getPhysicalNumberOfRows();
  321. int failNumber = 0;
  322. for (int i = 1; i < rowNum; i++) {
  323. try {
  324. logger.info("读取行数:" + i);
  325. Row row = sheet.getRow(i);
  326. int cellNum = row.getLastCellNum();
  327. TSpecdevYlgd entity = new TSpecdevYlgd();
  328. for (int j = 0; j < cellNum; j++) {
  329. Cell cell = row.getCell(j);
  330. if (cell == null) {
  331. continue;
  332. }
  333. String cellValue = ExcelUtils.getCellValue(cell);
  334. logger.info("cellValue:" + cellValue);
  335. if (j == 0) {
  336. //序号
  337. Double d = Double.parseDouble(cellValue);
  338. long s = new Double(d).longValue();
  339. entity.setId(s);
  340. } else if (j == 1) { //装置名称
  341. entity.setPlantCode(cellValue);
  342. } else if (j == 2) { //管道名称
  343. entity.setDevname(cellValue);
  344. } else if (j == 3) { //管道编号
  345. entity.setDevno(cellValue);
  346. } else if (j == 4) { //使用登记表编号
  347. entity.setUseno(cellValue);
  348. } else if (j == 5) { //检验单位
  349. entity.setCheckUnit(cellValue);
  350. } else if (j == 6) { //检验日期
  351. logger.info("日期格式:" + cellValue);
  352. if (cellValue.length() > 3) {
  353. entity.setWarnDate(new SimpleDateFormat(DateUtils.getDateFormat(cellValue)).parse(cellValue));
  354. }
  355. } else if (j == 7) { //安全状况等级
  356. entity.setSafeClass(cellValue);
  357. } else if (j == 8) { //报告编号
  358. entity.setReportNo(cellValue);
  359. } else if (j == 9) { //下次检验日期
  360. logger.info("日期格式:" + cellValue);
  361. if (cellValue.length() > 3) {//检验日期
  362. entity.setNextWarnDate(new SimpleDateFormat(DateUtils.getDateFormat(cellValue)).parse(cellValue));
  363. }
  364. } else if (j == 10) { //年度检查日期
  365. logger.info("日期格式:" + cellValue);
  366. if (cellValue.length() > 3) {//检验日期
  367. entity.setYearWarnDate(new SimpleDateFormat(DateUtils.getDateFormat(cellValue)).parse(cellValue));
  368. }
  369. } else if (j == 11) { //年度检查结论
  370. entity.setCheckConclusion(cellValue);
  371. } else if (j == 12) { //下次年度检查日期
  372. logger.info("日期格式:" + cellValue);
  373. if (cellValue.length() > 3) {//检验日期
  374. entity.setYearNextWarnDate(new SimpleDateFormat(DateUtils.getDateFormat(cellValue)).parse(cellValue));
  375. }
  376. } else if (j == 13) { //年度检查报告编号
  377. entity.setYearReportNo(cellValue);
  378. }
  379. }
  380. logger.info("entity:" + JSON.toJSONString(entity));
  381. list.add(entity);
  382. oldEntity = entity;
  383. oldList.add(oldEntity);
  384. } catch (Exception e) {
  385. failNumber++;
  386. logger.info("e:" + JSON.toJSONString(e));
  387. failRow.add(i + 1);
  388. }
  389. }
  390. int successNumber = 0;
  391. int failNum = 0;
  392. for (TSpecdevYlgd t : list) {
  393. failNum++;
  394. try {
  395. tSpecdevYlgdService
  396. .update(t,
  397. new QueryWrapper<TSpecdevYlgd>()
  398. .eq("USENO", t.getUseno())
  399. .eq("PLANT_CODE", t.getPlantCode())
  400. );
  401. successNumber++;
  402. } catch (Exception e) {
  403. failNumber++;
  404. logger.info("e:" + e);
  405. failRow.add(failNum + 1);
  406. }
  407. }
  408. for (TSpecdevYlgd t : oldList) {
  409. TSpecCheck tc = new TSpecCheck();
  410. tc.setDevType(2l);
  411. tc.setCheckUnit(t.getCheckUnit());
  412. tc.setDevId(t.getId());
  413. tc.setNextWarnDate(t.getNextWarnDate());
  414. tc.setReportNo(t.getReportNo());
  415. tc.setWarnDate(t.getWarnDate());
  416. tc.setYearNextWarnDate(t.getYearNextWarnDate());
  417. tc.setYearWarnDate(t.getYearWarnDate());
  418. tc.setYearReportNo(t.getReportNo());
  419. tc.setSafeClass(t.getSafeClass());
  420. tSpecCheckService.insertTSpecCheck(tc);
  421. }
  422. logger.info("list:" + JSON.toJSONString(list));
  423. logger.info("successNumber:" + String.valueOf(successNumber));
  424. logger.info("failNumber:" + String.valueOf(failNumber));
  425. logger.info("failRow:" + String.valueOf(failRow));
  426. return AjaxResult.success(String.valueOf(successNumber), failRow);
  427. }
  428. @GetMapping("/exportDevList")
  429. public AjaxResult exportbmy(ParamData params) throws IOException {
  430. logger.info(JSON.toJSONString(params));
  431. String id = params.getIds();
  432. String[] ids = id.split(",");
  433. List<TSpecdevYlgd> list = new ArrayList<>();
  434. for (String i : ids
  435. ) {
  436. TSpecdevYlgd t = tSpecdevYlgdService.getById(i);
  437. list.add(t);
  438. }
  439. SXSSFWorkbook wb = new SXSSFWorkbook(1000);
  440. CellStyle wrapStyle = wb.createCellStyle();
  441. wrapStyle.setWrapText(true); //设置自动换行
  442. //创建sheet页
  443. Sheet sheet = wb.createSheet("sheet1");
  444. //设置列的宽度,第一个参数为列的序号,从0开始,第二参数为列宽,单位1/256个字节
  445. sheet.setColumnWidth(0, 12*256);
  446. sheet.setColumnWidth(1, 26*256);
  447. sheet.setColumnWidth(2, 26*256);
  448. sheet.setColumnWidth(3, 26*256);
  449. sheet.setColumnWidth(4, 26*256);
  450. sheet.setColumnWidth(5, 26*256);
  451. sheet.setColumnWidth(6, 26*256);
  452. sheet.setColumnWidth(7, 26*256);
  453. sheet.setColumnWidth(8, 40*256);
  454. sheet.setColumnWidth(9, 40*256);
  455. sheet.setColumnWidth(10, 26*256);
  456. sheet.setColumnWidth(11, 26*256);
  457. sheet.setColumnWidth(12, 40*256);
  458. sheet.setColumnWidth(13, 40*256);
  459. //设置开始行和开始列
  460. Row row0 = sheet.createRow(0);
  461. CellStyle style = wb.createCellStyle();
  462. style.setFillForegroundColor(IndexedColors.YELLOW.getIndex());
  463. style.setFillPattern(FillPatternType.SOLID_FOREGROUND);
  464. // Font headerFont = wb.createFont();
  465. // headerFont.setFontName("Arial");
  466. // headerFont.setFontHeightInPoints((short) 12);
  467. // headerFont.setBold(false);
  468. // headerFont.setColor(IndexedColors.BLACK.getIndex());
  469. // style.setFont(headerFont);
  470. Cell cell0 = row0.createCell(0);
  471. row0.createCell(0).setCellValue("序号");
  472. row0.createCell(1).setCellValue("装置");
  473. row0.createCell(2).setCellValue("管道名称");
  474. row0.createCell(3).setCellValue("管道编号");
  475. row0.createCell(4).setCellValue("使用登记表编号");
  476. row0.createCell(5).setCellValue("检验单位");row0.getCell(5).setCellStyle(style);
  477. row0.createCell(6).setCellValue("定期检验日期");row0.getCell(6).setCellStyle(style);
  478. row0.createCell(7).setCellValue("安全状况等级");row0.getCell(7).setCellStyle(style);
  479. row0.createCell(8).setCellValue("定期检验报告编号");row0.getCell(8).setCellStyle(style);
  480. row0.createCell(9).setCellValue("下次定期检验日期");row0.getCell(9).setCellStyle(style);
  481. row0.createCell(10).setCellValue("年度检查日期");row0.getCell(10).setCellStyle(style);
  482. row0.createCell(11).setCellValue("年度检查结论");row0.getCell(11).setCellStyle(style);
  483. row0.createCell(12).setCellValue("下次年度检查日期");row0.getCell(12).setCellStyle(style);
  484. row0.createCell(13).setCellValue("年度检查报告编号");row0.getCell(13).setCellStyle(style);
  485. //填充数据
  486. int rowIndex = 1;
  487. int columnIndex = 1;
  488. for (TSpecdevYlgd t: list
  489. ) {
  490. Row row = sheet.createRow(rowIndex);
  491. row.createCell(0).setCellValue(t.getId());
  492. row.createCell(1).setCellValue(t.getPlantCode());
  493. row.createCell(2).setCellValue(t.getDevname());
  494. row.createCell(3).setCellValue(t.getDevno());
  495. row.createCell(4).setCellValue(t.getUseno());
  496. row.createCell(5).setCellValue(t.getCheckUnit());
  497. if (t.getWarnDate()!= null){
  498. row.createCell(6).setCellValue(new SimpleDateFormat("yyyy-MM-dd").format(t.getWarnDate()));
  499. }
  500. row.createCell(7).setCellValue(t.getSafeClass());
  501. row.createCell(8).setCellValue(t.getReportNo());
  502. if (t.getNextWarnDate()!= null){
  503. row.createCell(9).setCellValue(new SimpleDateFormat("yyyy-MM-dd").format(t.getNextWarnDate()));
  504. }
  505. if (t.getYearWarnDate()!= null){
  506. row.createCell(10).setCellValue(new SimpleDateFormat("yyyy-MM-dd").format(t.getYearWarnDate()));
  507. }
  508. row.createCell(11).setCellValue(t.getCheckConclusion());
  509. if (t.getYearNextWarnDate()!= null){
  510. row.createCell(12).setCellValue(new SimpleDateFormat("yyyy-MM-dd").format(t.getYearNextWarnDate()));
  511. }
  512. row.createCell(13).setCellValue(t.getYearReportNo());
  513. rowIndex++;
  514. }
  515. OutputStream out = null;
  516. String filename = ExcelUtil.encodingFilename("压力管道批量更新");
  517. out = new FileOutputStream(ExcelUtil.getAbsoluteFile(filename));
  518. wb.write(out);
  519. wb.close();
  520. out.close();
  521. return AjaxResult.success(filename);
  522. }
  523. }