Browse Source

feat(ps): 实现多个设备检查记录的Excel导出功能

- 为火灾报警器、消火栓箱、呼叫系统和围堰检查控制器添加Excel模板导出功能
- 使用Apache POI库动态生成Excel文件,包含检查数据、签名图片和说明信息
- 更新导出逻辑以使用自定义模板路径并优化单元格样式处理
- 添加系统用户服务依赖以获取检查人签名信息
- 修复导出条件过滤,确保只导出无问题标记的记录
- 统一各检查项的信息获取接口参数校验逻辑
- 移除冗余的数据权限注解,简化代码结构
jiangbiao 2 hours ago
parent
commit
fec796dbed
47 changed files with 2847 additions and 125 deletions
  1. 1 8
      master/src/main/java/com/ruoyi/project/ps/dev/mapper/TPsDevWardrobeMapper.java
  2. 115 13
      master/src/main/java/com/ruoyi/project/ps/inspection/controller/TPsInspectionAlarmController.java
  3. 168 5
      master/src/main/java/com/ruoyi/project/ps/inspection/controller/TPsInspectionCabinetController.java
  4. 142 5
      master/src/main/java/com/ruoyi/project/ps/inspection/controller/TPsInspectionCallsystemController.java
  5. 142 5
      master/src/main/java/com/ruoyi/project/ps/inspection/controller/TPsInspectionCofferController.java
  6. 141 5
      master/src/main/java/com/ruoyi/project/ps/inspection/controller/TPsInspectionCurtainController.java
  7. 149 5
      master/src/main/java/com/ruoyi/project/ps/inspection/controller/TPsInspectionExtinguisherController.java
  8. 141 5
      master/src/main/java/com/ruoyi/project/ps/inspection/controller/TPsInspectionEyewashController.java
  9. 142 5
      master/src/main/java/com/ruoyi/project/ps/inspection/controller/TPsInspectionFgsController.java
  10. 143 5
      master/src/main/java/com/ruoyi/project/ps/inspection/controller/TPsInspectionFiredoorController.java
  11. 154 5
      master/src/main/java/com/ruoyi/project/ps/inspection/controller/TPsInspectionHydrantController.java
  12. 143 5
      master/src/main/java/com/ruoyi/project/ps/inspection/controller/TPsInspectionLiftController.java
  13. 142 5
      master/src/main/java/com/ruoyi/project/ps/inspection/controller/TPsInspectionMonitorController.java
  14. 141 5
      master/src/main/java/com/ruoyi/project/ps/inspection/controller/TPsInspectionPitController.java
  15. 140 5
      master/src/main/java/com/ruoyi/project/ps/inspection/controller/TPsInspectionRainvalveController.java
  16. 141 5
      master/src/main/java/com/ruoyi/project/ps/inspection/controller/TPsInspectionSteamController.java
  17. 142 5
      master/src/main/java/com/ruoyi/project/ps/inspection/controller/TPsInspectionSumpController.java
  18. 143 5
      master/src/main/java/com/ruoyi/project/ps/inspection/controller/TPsInspectionUtilitystationController.java
  19. 142 5
      master/src/main/java/com/ruoyi/project/ps/inspection/controller/TPsInspectionVentvalveController.java
  20. 163 7
      master/src/main/java/com/ruoyi/project/ps/inspection/controller/TPsInspectionWardrobeController.java
  21. 6 6
      master/src/main/java/com/ruoyi/project/ps/inspection/domain/TPsInspectionEyewash.java
  22. 10 0
      master/src/main/java/com/ruoyi/project/ps/patrol/domain/TPsPatrolPlan.java
  23. 1 0
      master/src/main/resources/mybatis/ps/inspection/TPsInspectionAlarmMapper.xml
  24. 1 0
      master/src/main/resources/mybatis/ps/inspection/TPsInspectionCabinetMapper.xml
  25. 1 0
      master/src/main/resources/mybatis/ps/inspection/TPsInspectionCallsystemMapper.xml
  26. 1 0
      master/src/main/resources/mybatis/ps/inspection/TPsInspectionCofferMapper.xml
  27. 1 0
      master/src/main/resources/mybatis/ps/inspection/TPsInspectionCurtainMapper.xml
  28. 1 0
      master/src/main/resources/mybatis/ps/inspection/TPsInspectionExtinguisherMapper.xml
  29. 1 0
      master/src/main/resources/mybatis/ps/inspection/TPsInspectionEyewashMapper.xml
  30. 1 0
      master/src/main/resources/mybatis/ps/inspection/TPsInspectionFgsMapper.xml
  31. 1 0
      master/src/main/resources/mybatis/ps/inspection/TPsInspectionFiredoorMapper.xml
  32. 1 1
      master/src/main/resources/mybatis/ps/inspection/TPsInspectionHydrantMapper.xml
  33. 1 0
      master/src/main/resources/mybatis/ps/inspection/TPsInspectionLiftMapper.xml
  34. 1 0
      master/src/main/resources/mybatis/ps/inspection/TPsInspectionMonitorMapper.xml
  35. 1 0
      master/src/main/resources/mybatis/ps/inspection/TPsInspectionPitMapper.xml
  36. 1 0
      master/src/main/resources/mybatis/ps/inspection/TPsInspectionRainvalveMapper.xml
  37. 1 0
      master/src/main/resources/mybatis/ps/inspection/TPsInspectionSteamMapper.xml
  38. 1 0
      master/src/main/resources/mybatis/ps/inspection/TPsInspectionSumpMapper.xml
  39. 1 0
      master/src/main/resources/mybatis/ps/inspection/TPsInspectionUtilitystationMapper.xml
  40. 1 0
      master/src/main/resources/mybatis/ps/inspection/TPsInspectionVentvalveMapper.xml
  41. 1 0
      master/src/main/resources/mybatis/ps/inspection/TPsInspectionWardrobeMapper.xml
  42. 3 1
      master/src/main/resources/mybatis/ps/patrol/TPsPatrolPlanMapper.xml
  43. 1 1
      ui/src/views/ps/inspection/alarm/index.vue
  44. 1 1
      ui/src/views/ps/inspection/extinguisher/index.vue
  45. 5 1
      ui/src/views/ps/inspection/fgs/index.vue
  46. 5 1
      ui/src/views/ps/inspection/monitor/index.vue
  47. 62 0
      ui/src/views/ps/inspection/wardrobe/index.vue

+ 1 - 8
master/src/main/java/com/ruoyi/project/ps/dev/mapper/TPsDevWardrobeMapper.java

@@ -1,6 +1,5 @@
 package com.ruoyi.project.ps.dev.mapper;
 
-import com.ruoyi.framework.aspectj.lang.annotation.DataScope;
 import com.ruoyi.project.ps.dev.domain.TPsDevWardrobe;
 
 import java.util.List;
@@ -20,13 +19,7 @@ public interface TPsDevWardrobeMapper {
      */
     public TPsDevWardrobe selectTPsDevWardrobeById(Long id);
 
-    /**
-     * 查询应急物资柜列表
-     *
-     * @param tPsDevWardrobe 应急物资柜
-     * @return 应急物资柜集合
-     */
-    @DataScope(deptAlias = "d")
+
     public List<TPsDevWardrobe> selectTPsDevWardrobeList(TPsDevWardrobe tPsDevWardrobe);
 
     /**

+ 115 - 13
master/src/main/java/com/ruoyi/project/ps/inspection/controller/TPsInspectionAlarmController.java

@@ -1,8 +1,11 @@
 package com.ruoyi.project.ps.inspection.controller;
 
 import com.ruoyi.common.utils.StringUtils;
+import com.ruoyi.common.utils.file.ExcelUtils;
+import com.ruoyi.common.utils.poi.ExcelUtil;
 import com.ruoyi.framework.aspectj.lang.annotation.Log;
 import com.ruoyi.framework.aspectj.lang.enums.BusinessType;
+import com.ruoyi.framework.config.RuoYiConfig;
 import com.ruoyi.framework.web.controller.BaseController;
 import com.ruoyi.framework.web.domain.AjaxResult;
 import com.ruoyi.framework.web.page.TableDataInfo;
@@ -14,10 +17,13 @@ import com.ruoyi.project.ps.patrol.domain.TPsPatrolIssues;
 import com.ruoyi.project.ps.patrol.domain.TPsPatrolPlan;
 import com.ruoyi.project.ps.patrol.service.ITPsPatrolIssuesService;
 import com.ruoyi.project.ps.patrol.service.ITPsPatrolPlanService;
+import com.ruoyi.project.system.domain.SysUser;
+import com.ruoyi.project.system.service.ISysUserService;
 import org.apache.commons.collections4.CollectionUtils;
 import org.apache.poi.ss.usermodel.Cell;
 import org.apache.poi.ss.usermodel.CellStyle;
 import org.apache.poi.ss.usermodel.Row;
+import org.apache.poi.ss.util.CellRangeAddress;
 import org.apache.poi.xssf.usermodel.XSSFSheet;
 import org.apache.poi.xssf.usermodel.XSSFWorkbook;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -26,6 +32,9 @@ import org.springframework.web.bind.annotation.*;
 
 import java.io.InputStream;
 import java.io.OutputStream;
+import java.nio.file.Files;
+import java.nio.file.Paths;
+import java.util.Calendar;
 import java.util.Date;
 import java.util.List;
 
@@ -50,6 +59,8 @@ public class TPsInspectionAlarmController extends BaseController {
 
     @Autowired
     private ITCommonfileService tCommonfileService;
+    @Autowired
+    private ISysUserService sysUserService;
 
     /**
      * 查询手动启动火灾报警器检查记录列表
@@ -69,6 +80,7 @@ public class TPsInspectionAlarmController extends BaseController {
     @Log(title = "手动启动火灾报警器检查记录", businessType = BusinessType.EXPORT)
     @GetMapping("/export")
     public AjaxResult export(TPsInspectionAlarm tPsInspectionAlarm) {
+        tPsInspectionAlarm.setIssuesFlag(0L);
         List<TPsInspectionAlarm> list = tPsInspectionAlarmService.selectTPsInspectionAlarmList(tPsInspectionAlarm);
         if (!list.isEmpty()) {
             return AjaxResult.success(exportTmpl(list));
@@ -91,11 +103,11 @@ public class TPsInspectionAlarmController extends BaseController {
      */
     @GetMapping(value = "/info")
     public AjaxResult getInfoByDevNo(TPsInspectionAlarm tPsInspectionAlarm) {
-        if (tPsInspectionAlarm.getId()!=null){
+        if (tPsInspectionAlarm.getId() != null) {
             return AjaxResult.success(tPsInspectionAlarmService.selectTPsInspectionAlarmById(tPsInspectionAlarm.getId()));
         }
         if (!"PS".equals(tPsInspectionAlarm.getPlant())) {
-            return AjaxResult.error("请使用_"+tPsInspectionAlarm.getPlant()+"_装置账号进行扫码巡检!");
+            return AjaxResult.error("请使用_" + tPsInspectionAlarm.getPlant() + "_装置账号进行扫码巡检!");
         }
         if (StringUtils.isNull(tPsInspectionAlarm.getDevNo()) || StringUtils.isNull(tPsInspectionAlarm.getPlanId())) {
             return AjaxResult.error("位号或计划id不能为空!");
@@ -236,25 +248,115 @@ public class TPsInspectionAlarmController extends BaseController {
         OutputStream out;
         String filename = null;
         try {
-            String tempUrl = "static/word/ps/alarm.xlsx"; // 模板文件
-            InputStream is = Thread.currentThread().getContextClassLoader().getResourceAsStream(tempUrl);
+            String tempUrl = RuoYiConfig.getFilePath("/tempDoc/ps/alarm.xlsx"); // 模板文件
+            InputStream is = Files.newInputStream(Paths.get(tempUrl));
             XSSFWorkbook wb = new XSSFWorkbook(is);
             XSSFSheet sheet = wb.getSheetAt(0);
 
             //填充数据
-            int rowIndex1 = 6;
-            int num1 = 1;
-
-            Row originalRow1 = sheet.getRow(2);
-            Cell originalcell1 = originalRow1.getCell(0);
+            int rowIndex = 6;
+            int num = 1;
+            String dateStr = "";
+            String confirmerSignUrl = "";
 
-            originalRow1.getCell(0).setCellValue("年度:       年                         检查频率:1次/月(月底前完成)");
             // 获取单元格样式
-            CellStyle originalStyle1 = originalcell1.getCellStyle();
+            Row row6 = sheet.getRow(rowIndex);
+            Cell originalcell = row6.getCell(0);
+            CellStyle originalStyle = originalcell.getCellStyle();
             if (!list.isEmpty()) {
-                Row line1 = sheet.getRow(rowIndex1);
-                line1.getCell(0).setCellValue(list.get(0).getPlant() + "装置滚动问题清单和行动计划");
+                TPsInspectionAlarm alarm = list.get(0);
+                TPsPatrolPlan plan = tPsPatrolPlanService.selectTPsPatrolPlanById(alarm.getPlanId());
+                dateStr = "_" + plan.getPlanYear() + "年_" + plan.getPlanMonth() + "月_";
+                Row row3 = sheet.getRow(2);
+                row3.getCell(0).setCellValue("年度:" + plan.getPlanYear() + " 年                         检查频率:1次/月(月底前完成)");
+                String r4c3Str = "检查时间:  月   日";
+                if (plan.getConfirmDate() != null && StringUtils.isNotEmpty(plan.getConfirmed())) {
+                    Calendar calendar = Calendar.getInstance();
+                    calendar.setTime(plan.getConfirmDate());
+                    r4c3Str = "检查时间:" + (calendar.get(Calendar.MONTH) + 1) + "月 " + calendar.get(Calendar.DAY_OF_MONTH) + "日";
+                    SysUser sysUser = sysUserService.selectUserById(Long.valueOf(plan.getConfirmed()));
+                    confirmerSignUrl = sysUser.getSignUrl();
+                }
+
+                Row row4 = sheet.getRow(3);
+                row4.getCell(3).setCellValue(r4c3Str);
+
+                for (TPsInspectionAlarm item : list) {
+                    Row row = sheet.createRow(rowIndex);
+                    row.setHeight((short) 300);
+                    row.createCell(0).setCellValue(num);
+                    row.createCell(1).setCellValue(item.getDevNo());
+                    row.createCell(2).setCellValue(item.getPosition());
+                    row.createCell(3).setCellValue("1".equals(item.getAppearance()) ? "✓" : item.getAppearance());
+                    row.createCell(4).setCellValue("1".equals(item.getAlarmSign()) ? "✓" : item.getAlarmSign());
+                    row.createCell(5).setCellValue("1".equals(item.getGlassRetainer()) ? "✓" : item.getGlassRetainer());
+                    //渲染样式
+                    for (int i = 0; i < 6; i++) {
+                        row.getCell(i).setCellStyle(originalStyle);
+                    }
+                    num++;
+                    rowIndex++;
+                }
+            }
+            // 检查人
+            Row confirmerRow = sheet.createRow(rowIndex);
+            confirmerRow.setHeight((short) 800);
+            confirmerRow.createCell(0).setCellValue("检查人");
+            for (int i = 1; i < 6; i++) {
+                confirmerRow.createCell(i);
             }
+            if (StringUtils.isNotEmpty(confirmerSignUrl))
+                ExcelUtils.insertPicture(wb, sheet, confirmerSignUrl, rowIndex, 3, 1, 1);
+            for (int i = 0; i < 6; i++) {
+                confirmerRow.getCell(i).setCellStyle(originalStyle);
+            }
+            sheet.addMergedRegion(new CellRangeAddress(rowIndex, rowIndex, 0, 2));
+            sheet.addMergedRegion(new CellRangeAddress(rowIndex, rowIndex, 3, 5));
+
+            // 说明
+            rowIndex++;
+            Row explanationRow1 = sheet.createRow(rowIndex);
+            explanationRow1.setHeight((short) 300);
+            explanationRow1.createCell(0).setCellValue("说明");
+            for (int i = 1; i < 6; i++) {
+                explanationRow1.createCell(i);
+            }
+            sheet.addMergedRegion(new CellRangeAddress(rowIndex, rowIndex, 0, 5));
+
+            rowIndex++;
+            Row explanationRow2 = sheet.createRow(rowIndex);
+            explanationRow2.setHeight((short) 300);
+            explanationRow2.createCell(0).setCellValue("1.检查频率为每个月一次。");
+            for (int i = 1; i < 6; i++) {
+                explanationRow2.createCell(i);
+            }
+            sheet.addMergedRegion(new CellRangeAddress(rowIndex, rowIndex, 0, 5));
+
+            rowIndex++;
+            Row explanationRow3 = sheet.createRow(rowIndex);
+            explanationRow3.setHeight((short) 300);
+            explanationRow3.createCell(0).setCellValue("2.检查正常打「√」有不正常情况打「X」,并在备注中说明,包括整改结果。");
+            for (int i = 1; i < 6; i++) {
+                explanationRow3.createCell(i);
+            }
+            sheet.addMergedRegion(new CellRangeAddress(rowIndex, rowIndex, 0, 5));
+
+            rowIndex++;
+            Row explanationRow4 = sheet.createRow(rowIndex);
+            CellStyle wrapStyle = wb.createCellStyle();
+            wrapStyle.setWrapText(true);
+            Cell explanationCell4 = explanationRow4.createCell(0);
+            explanationCell4.setCellValue("3.检查内容:手动启动火灾报警器的外观是否清洁,标识完好,玻璃压片是否完好。");
+            explanationCell4.setCellStyle(wrapStyle);
+            for (int i = 1; i < 6; i++) {
+                explanationRow4.createCell(i).setCellStyle(wrapStyle);
+            }
+            sheet.addMergedRegion(new CellRangeAddress(rowIndex, rowIndex, 0, 5));
+
+            filename = "_手动启动火灾报警器" + dateStr + "检查记录.xlsx";
+            out = Files.newOutputStream(Paths.get(ExcelUtil.getAbsoluteFile(filename)));
+            wb.write(out);
+            wb.close();
         } catch (Exception e) {
             e.printStackTrace();
         }

+ 168 - 5
master/src/main/java/com/ruoyi/project/ps/inspection/controller/TPsInspectionCabinetController.java

@@ -1,25 +1,40 @@
 package com.ruoyi.project.ps.inspection.controller;
 
 import com.ruoyi.common.utils.StringUtils;
+import com.ruoyi.common.utils.file.ExcelUtils;
 import com.ruoyi.common.utils.poi.ExcelUtil;
 import com.ruoyi.framework.aspectj.lang.annotation.Log;
 import com.ruoyi.framework.aspectj.lang.enums.BusinessType;
+import com.ruoyi.framework.config.RuoYiConfig;
 import com.ruoyi.framework.web.controller.BaseController;
 import com.ruoyi.framework.web.domain.AjaxResult;
 import com.ruoyi.framework.web.page.TableDataInfo;
+import com.ruoyi.project.common.domain.TCommonfile;
+import com.ruoyi.project.common.service.ITCommonfileService;
 import com.ruoyi.project.ps.inspection.domain.TPsInspectionCabinet;
 import com.ruoyi.project.ps.inspection.service.ITPsInspectionCabinetService;
 import com.ruoyi.project.ps.patrol.domain.TPsPatrolIssues;
 import com.ruoyi.project.ps.patrol.domain.TPsPatrolPlan;
 import com.ruoyi.project.ps.patrol.service.ITPsPatrolIssuesService;
 import com.ruoyi.project.ps.patrol.service.ITPsPatrolPlanService;
-import com.ruoyi.project.common.domain.TCommonfile;
-import com.ruoyi.project.common.service.ITCommonfileService;
+import com.ruoyi.project.system.domain.SysUser;
+import com.ruoyi.project.system.service.ISysUserService;
 import org.apache.commons.collections4.CollectionUtils;
+import org.apache.poi.ss.usermodel.Cell;
+import org.apache.poi.ss.usermodel.CellStyle;
+import org.apache.poi.ss.usermodel.Row;
+import org.apache.poi.ss.util.CellRangeAddress;
+import org.apache.poi.xssf.usermodel.XSSFSheet;
+import org.apache.poi.xssf.usermodel.XSSFWorkbook;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.web.bind.annotation.*;
 
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.nio.file.Files;
+import java.nio.file.Paths;
+import java.util.Calendar;
 import java.util.Date;
 import java.util.List;
 
@@ -44,6 +59,8 @@ public class TPsInspectionCabinetController extends BaseController {
 
     @Autowired
     private ITCommonfileService tCommonfileService;
+    @Autowired
+    private ISysUserService sysUserService;
 
     /**
      * 查询玻璃门消火栓箱和泡沫栓箱检查记录列表
@@ -63,9 +80,155 @@ public class TPsInspectionCabinetController extends BaseController {
     @Log(title = "玻璃门消火栓箱和泡沫栓箱检查记录", businessType = BusinessType.EXPORT)
     @GetMapping("/export")
     public AjaxResult export(TPsInspectionCabinet tPsInspectionCabinet) {
+        tPsInspectionCabinet.setIssuesFlag(0L);
         List<TPsInspectionCabinet> list = tPsInspectionCabinetService.selectTPsInspectionCabinetList(tPsInspectionCabinet);
-        ExcelUtil<TPsInspectionCabinet> util = new ExcelUtil<TPsInspectionCabinet>(TPsInspectionCabinet.class);
-        return util.exportExcel(list, "cabinet");
+        if (!list.isEmpty()) {
+            return AjaxResult.success(exportTmpl(list));
+        } else {
+            return AjaxResult.error("暂无可导出数据");
+        }
+    }
+
+
+    public String exportTmpl(List<TPsInspectionCabinet> list) {
+        OutputStream out;
+        String filename = null;
+        try {
+            String tempUrl = RuoYiConfig.getFilePath("/tempDoc/ps/cabinet.xlsx"); // 模板文件
+            InputStream is = Files.newInputStream(Paths.get(tempUrl));
+            XSSFWorkbook wb = new XSSFWorkbook(is);
+            XSSFSheet sheet = wb.getSheetAt(0);
+
+            //填充数据
+            int rowIndex = 7;
+            int num = 1;
+            String dateStr = "";
+            String confirmerSignUrl = "";
+
+            // 获取单元格样式
+            Row row6 = sheet.getRow(rowIndex);
+            Cell originalcell = row6.getCell(0);
+            CellStyle originalStyle = originalcell.getCellStyle();
+            if (!list.isEmpty()) {
+                TPsInspectionCabinet cabinet = list.get(0);
+                TPsPatrolPlan plan = tPsPatrolPlanService.selectTPsPatrolPlanById(cabinet.getPlanId());
+                dateStr = "_" + plan.getPlanYear() + "年_" + plan.getPlanMonth() + "月_";
+                Row row3 = sheet.getRow(3);
+                row3.getCell(0).setCellValue("年度:" + plan.getPlanYear() + " 年");
+                row3.createCell(9).setCellValue("检查频率:1次/月(月底前完成)");
+                String r5c9Str = "检查时间:  月   日";
+                if (plan.getConfirmDate() != null && StringUtils.isNotEmpty(plan.getConfirmed())) {
+                    Calendar calendar = Calendar.getInstance();
+                    calendar.setTime(plan.getConfirmDate());
+                    r5c9Str = "检查时间:" + (calendar.get(Calendar.MONTH) + 1) + "月 " + calendar.get(Calendar.DAY_OF_MONTH) + "日";
+                    SysUser sysUser = sysUserService.selectUserById(Long.valueOf(plan.getConfirmed()));
+                    confirmerSignUrl = sysUser.getSignUrl();
+                }
+
+                Row row5 = sheet.getRow(4);
+                row5.getCell(9).setCellValue(r5c9Str);
+
+                for (TPsInspectionCabinet item : list) {
+                    Row row = sheet.createRow(rowIndex);
+                    row.setHeight((short) 300);
+                    row.createCell(0).setCellValue(num);
+                    row.createCell(1).setCellValue(item.getPosition());
+                    row.createCell(2).setCellValue(item.getModelNo());
+                    row.createCell(3).setCellValue(item.getBoxNo());
+                    row.createCell(4).setCellValue(item.getValveType());
+                    row.createCell(5).setCellValue(item.getValveSpecification());
+                    row.createCell(6).setCellValue(item.getValveLength());
+                    row.createCell(7).setCellValue(item.getBoltPointDistance());
+                    row.createCell(8).setCellValue(item.getBoltHoleCount());
+                    row.createCell(9).setCellValue("1".equals(item.getAppearance()) ? "✓" : item.getAppearance());
+                    row.createCell(10).setCellValue("1".equals(item.getInternalItems()) ? "✓" : item.getInternalItems());
+                    row.createCell(11).setCellValue("1".equals(item.getValve()) ? "✓" : item.getValve());
+                    row.createCell(12).setCellValue("1".equals(item.getPassage()) ? "✓" : item.getPassage());
+                    //渲染样式
+                    for (int i = 0; i < 13; i++) {
+                        row.getCell(i).setCellStyle(originalStyle);
+                    }
+                    num++;
+                    rowIndex++;
+                }
+            }
+            // 检查人
+            Row confirmerRow = sheet.createRow(rowIndex);
+            confirmerRow.setHeight((short) 800);
+            confirmerRow.createCell(0).setCellValue("检查人");
+            for (int i = 1; i < 10; i++) {
+                confirmerRow.createCell(i);
+            }
+            if (StringUtils.isNotEmpty(confirmerSignUrl))
+                ExcelUtils.insertPicture(wb, sheet, confirmerSignUrl, rowIndex, 3, 1, 1);
+            for (int i = 10; i < 13; i++) {
+                confirmerRow.createCell(i);
+            }
+            for (int i = 0; i < 13; i++) {
+                confirmerRow.getCell(i).setCellStyle(originalStyle);
+            }
+            sheet.addMergedRegion(new CellRangeAddress(rowIndex, rowIndex, 0, 2));
+            sheet.addMergedRegion(new CellRangeAddress(rowIndex, rowIndex, 3, 12));
+
+            // 说明
+            rowIndex++;
+            Row explanationRow1 = sheet.createRow(rowIndex);
+            explanationRow1.setHeight((short) 300);
+            explanationRow1.createCell(0).setCellValue("说明");
+            for (int i = 1; i < 13; i++) {
+                explanationRow1.createCell(i);
+            }
+            sheet.addMergedRegion(new CellRangeAddress(rowIndex, rowIndex, 0, 12));
+
+            rowIndex++;
+            Row explanationRow2 = sheet.createRow(rowIndex);
+            explanationRow2.setHeight((short) 300);
+            explanationRow2.createCell(0).setCellValue("1.检查内容:玻璃门消火栓箱外观是否正常;内部放的消防水带是否完好;水枪头是否完好;消防水阀门完好,无严重锈蚀情况;箱内有无杂物。玻璃门消火栓箱前道路通畅。");
+            for (int i = 1; i < 13; i++) {
+                explanationRow2.createCell(i);
+            }
+            sheet.addMergedRegion(new CellRangeAddress(rowIndex, rowIndex, 0, 12));
+
+            rowIndex++;
+            Row explanationRow3 = sheet.createRow(rowIndex);
+            explanationRow3.setHeight((short) 300);
+            explanationRow3.createCell(0).setCellValue("2.检查内容:泡沫栓箱外观是否正常;内部放的消防水带2根是否完好;泡沫枪头2个是否完好;消防泡沫阀门完好,无严重锈蚀情况;箱内有无杂物。泡沫栓箱前道路通畅。");
+            for (int i = 1; i < 13; i++) {
+                explanationRow3.createCell(i);
+            }
+            sheet.addMergedRegion(new CellRangeAddress(rowIndex, rowIndex, 0, 12));
+
+            rowIndex++;
+            Row explanationRow4 = sheet.createRow(rowIndex);
+            CellStyle wrapStyle = wb.createCellStyle();
+            wrapStyle.setWrapText(true);
+            Cell explanationCell4 = explanationRow4.createCell(0);
+            explanationCell4.setCellValue("3.检查正常打「√」有不正常情况打「X」,并在备注中说明,包括整改结果。");
+            explanationCell4.setCellStyle(wrapStyle);
+            for (int i = 1; i < 13; i++) {
+                explanationRow4.createCell(i).setCellStyle(wrapStyle);
+            }
+            sheet.addMergedRegion(new CellRangeAddress(rowIndex, rowIndex, 0, 12));
+
+            rowIndex++;
+            Row explanationRow5 = sheet.createRow(rowIndex);
+            Cell explanationCell5 = explanationRow5.createCell(0);
+            explanationCell5.setCellValue("4.检查频率为每1个月一次。");
+            explanationCell5.setCellStyle(wrapStyle);
+            for (int i = 1; i < 13; i++) {
+                explanationRow5.createCell(i).setCellStyle(wrapStyle);
+            }
+            sheet.addMergedRegion(new CellRangeAddress(rowIndex, rowIndex, 0, 12));
+
+
+            filename = "_玻璃门消火栓箱和泡沫栓箱" + dateStr + "检查记录.xlsx";
+            out = Files.newOutputStream(Paths.get(ExcelUtil.getAbsoluteFile(filename)));
+            wb.write(out);
+            wb.close();
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        return filename;
     }
 
     /**
@@ -82,7 +245,7 @@ public class TPsInspectionCabinetController extends BaseController {
      */
     @GetMapping(value = "/info")
     public AjaxResult getInfoByBoxNo(TPsInspectionCabinet tPsInspectionCabinet) {
-        if (tPsInspectionCabinet.getId()!=null){
+        if (tPsInspectionCabinet.getId() != null) {
             return AjaxResult.success(tPsInspectionCabinetService.selectTPsInspectionCabinetById(tPsInspectionCabinet.getId()));
         }
         if (!"PS".equals(tPsInspectionCabinet.getPlant())) {

+ 142 - 5
master/src/main/java/com/ruoyi/project/ps/inspection/controller/TPsInspectionCallsystemController.java

@@ -1,25 +1,40 @@
 package com.ruoyi.project.ps.inspection.controller;
 
 import com.ruoyi.common.utils.StringUtils;
+import com.ruoyi.common.utils.file.ExcelUtils;
 import com.ruoyi.common.utils.poi.ExcelUtil;
 import com.ruoyi.framework.aspectj.lang.annotation.Log;
 import com.ruoyi.framework.aspectj.lang.enums.BusinessType;
+import com.ruoyi.framework.config.RuoYiConfig;
 import com.ruoyi.framework.web.controller.BaseController;
 import com.ruoyi.framework.web.domain.AjaxResult;
 import com.ruoyi.framework.web.page.TableDataInfo;
+import com.ruoyi.project.common.domain.TCommonfile;
+import com.ruoyi.project.common.service.ITCommonfileService;
 import com.ruoyi.project.ps.inspection.domain.TPsInspectionCallsystem;
 import com.ruoyi.project.ps.inspection.service.ITPsInspectionCallsystemService;
 import com.ruoyi.project.ps.patrol.domain.TPsPatrolIssues;
 import com.ruoyi.project.ps.patrol.domain.TPsPatrolPlan;
 import com.ruoyi.project.ps.patrol.service.ITPsPatrolIssuesService;
 import com.ruoyi.project.ps.patrol.service.ITPsPatrolPlanService;
-import com.ruoyi.project.common.domain.TCommonfile;
-import com.ruoyi.project.common.service.ITCommonfileService;
+import com.ruoyi.project.system.domain.SysUser;
+import com.ruoyi.project.system.service.ISysUserService;
 import org.apache.commons.collections4.CollectionUtils;
+import org.apache.poi.ss.usermodel.Cell;
+import org.apache.poi.ss.usermodel.CellStyle;
+import org.apache.poi.ss.usermodel.Row;
+import org.apache.poi.ss.util.CellRangeAddress;
+import org.apache.poi.xssf.usermodel.XSSFSheet;
+import org.apache.poi.xssf.usermodel.XSSFWorkbook;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.web.bind.annotation.*;
 
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.nio.file.Files;
+import java.nio.file.Paths;
+import java.util.Calendar;
 import java.util.Date;
 import java.util.List;
 
@@ -44,6 +59,8 @@ public class TPsInspectionCallsystemController extends BaseController {
 
     @Autowired
     private ITCommonfileService tCommonfileService;
+    @Autowired
+    private ISysUserService sysUserService;
 
     /**
      * 查询现场呼叫系统检查记录列表
@@ -63,9 +80,13 @@ public class TPsInspectionCallsystemController extends BaseController {
     @Log(title = "现场呼叫系统检查记录", businessType = BusinessType.EXPORT)
     @GetMapping("/export")
     public AjaxResult export(TPsInspectionCallsystem tPsInspectionCallsystem) {
+        tPsInspectionCallsystem.setIssuesFlag(0L);
         List<TPsInspectionCallsystem> list = tPsInspectionCallsystemService.selectTPsInspectionCallsystemList(tPsInspectionCallsystem);
-        ExcelUtil<TPsInspectionCallsystem> util = new ExcelUtil<TPsInspectionCallsystem>(TPsInspectionCallsystem.class);
-        return util.exportExcel(list, "callsystem");
+        if (!list.isEmpty()) {
+            return AjaxResult.success(exportTmpl(list));
+        } else {
+            return AjaxResult.error("暂无可导出数据");
+        }
     }
 
     /**
@@ -82,7 +103,7 @@ public class TPsInspectionCallsystemController extends BaseController {
      */
     @GetMapping(value = "/info")
     public AjaxResult getInfoByDevno(TPsInspectionCallsystem tPsInspectionCallsystem) {
-        if (tPsInspectionCallsystem.getId()!=null){
+        if (tPsInspectionCallsystem.getId() != null) {
             return AjaxResult.success(tPsInspectionCallsystemService.selectTPsInspectionCallsystemById(tPsInspectionCallsystem.getId()));
         }
         if (!"PS".equals(tPsInspectionCallsystem.getPlant())) {
@@ -223,4 +244,120 @@ public class TPsInspectionCallsystemController extends BaseController {
     public AjaxResult remove(@PathVariable Long[] ids) {
         return toAjax(tPsInspectionCallsystemService.deleteTPsInspectionCallsystemByIds(ids));
     }
+
+    public String exportTmpl(List<TPsInspectionCallsystem> list) {
+        OutputStream out;
+        String filename = null;
+        try {
+            String tempUrl = RuoYiConfig.getFilePath("/tempDoc/ps/callsystem.xlsx");
+            InputStream is = Files.newInputStream(Paths.get(tempUrl));
+            XSSFWorkbook wb = new XSSFWorkbook(is);
+            XSSFSheet sheet = wb.getSheetAt(0);
+            int rowIndex = 6;
+            int num = 1;
+            String dateStr = "";
+            String confirmerSignUrl = "";
+            Row row6 = sheet.getRow(rowIndex);
+            Cell originalcell = row6.getCell(0);
+            CellStyle originalStyle = originalcell.getCellStyle();
+            if (!list.isEmpty()) {
+                TPsInspectionCallsystem callsystem = list.get(0);
+                TPsPatrolPlan plan = tPsPatrolPlanService.selectTPsPatrolPlanById(callsystem.getPlanId());
+                dateStr = "_" + plan.getPlanYear() + "年_" + plan.getPlanMonth() + "月_";
+
+                Row row3 = sheet.getRow(2);
+                row3.getCell(0).setCellValue("年度:" + plan.getPlanYear() + " 年                       检查频率:1次/每月(月底前完成)");
+
+                String r5c7Str = "检查时间:  月   日";
+                if (plan.getConfirmDate() != null && StringUtils.isNotEmpty(plan.getConfirmed())) {
+                    Calendar calendar = Calendar.getInstance();
+                    calendar.setTime(plan.getConfirmDate());
+                    r5c7Str = "检查时间:" + (calendar.get(Calendar.MONTH) + 1) + "月 " + calendar.get(Calendar.DAY_OF_MONTH) + "日";
+                    SysUser sysUser = sysUserService.selectUserById(Long.valueOf(plan.getConfirmed()));
+                    confirmerSignUrl = sysUser.getSignUrl();
+                }
+                Row row5 = sheet.getRow(3);
+                row5.getCell(3).setCellValue(r5c7Str);
+
+                for (TPsInspectionCallsystem item : list) {
+                    Row row = sheet.createRow(rowIndex);
+                    row.setHeight((short) 300);
+                    row.createCell(0).setCellValue(num);
+                    row.createCell(1).setCellValue(item.getDevNo());
+                    row.createCell(2).setCellValue(item.getPosition());
+                    row.createCell(3).setCellValue("1".equals(item.getAppearance()) ? "✓" : item.getAppearance());
+                    row.createCell(4).setCellValue("1".equals(item.getBroadcast()) ? "✓" : item.getBroadcast());
+                    row.createCell(5).setCellValue("1".equals(item.getCorrespond()) ? "✓" : item.getCorrespond());
+                    row.createCell(6).setCellValue("1".equals(item.getChannelUnobstructed()) ? "✓" : item.getChannelUnobstructed());
+                    for (int i = 0; i < 7; i++) {
+                        row.getCell(i).setCellStyle(originalStyle);
+                    }
+                    num++;
+                    rowIndex++;
+                }
+            }
+            // 检查人行
+            Row confirmerRow = sheet.createRow(rowIndex);
+            confirmerRow.setHeight((short) 800);
+            confirmerRow.createCell(0).setCellValue("检查人");
+            for (int i = 1; i < 7; i++) {
+                confirmerRow.createCell(i);
+            }
+            if (StringUtils.isNotEmpty(confirmerSignUrl))
+                ExcelUtils.insertPicture(wb, sheet, confirmerSignUrl, rowIndex, 3, 1, 1);
+            for (int i = 0; i < 7; i++) {
+                confirmerRow.getCell(i).setCellStyle(originalStyle);
+            }
+            sheet.addMergedRegion(new CellRangeAddress(rowIndex, rowIndex, 0, 2));
+            sheet.addMergedRegion(new CellRangeAddress(rowIndex, rowIndex, 3, 6));
+
+            // 说明
+            rowIndex++;
+            Row explanationRow1 = sheet.createRow(rowIndex);
+            explanationRow1.setHeight((short) 300);
+            explanationRow1.createCell(0).setCellValue("说明");
+            for (int i = 1; i < 7; i++) {
+                explanationRow1.createCell(i);
+            }
+            sheet.addMergedRegion(new CellRangeAddress(rowIndex, rowIndex, 0, 6));
+
+            rowIndex++;
+            Row explanationRow2 = sheet.createRow(rowIndex);
+            explanationRow2.setHeight((short) 300);
+            explanationRow2.createCell(0).setCellValue("1.检查频率为每月一次。");
+            for (int i = 1; i < 7; i++) {
+                explanationRow2.createCell(i);
+            }
+            sheet.addMergedRegion(new CellRangeAddress(rowIndex, rowIndex, 0, 6));
+
+            rowIndex++;
+            Row explanationRow3 = sheet.createRow(rowIndex);
+            explanationRow3.setHeight((short) 300);
+            explanationRow3.createCell(0).setCellValue("2.检查正常打「√」有不正常情况打「X」,并在备注中说明,包括整改结果。");
+            for (int i = 1; i < 7; i++) {
+                explanationRow3.createCell(i);
+            }
+            sheet.addMergedRegion(new CellRangeAddress(rowIndex, rowIndex, 0, 6));
+
+            rowIndex++;
+            Row explanationRow4 = sheet.createRow(rowIndex);
+            CellStyle wrapStyle = wb.createCellStyle();
+            wrapStyle.setWrapText(true);
+            Cell explanationCell4 = explanationRow4.createCell(0);
+            explanationCell4.setCellValue("3.检查内容:现场呼叫器外观是否完好;呼叫器内是否清洁,有无杂物,PA话站通话器箱门有无破损,把手开关是否好用,呼叫器前道路是否畅通。装置工长取下听筒,按下广播钮,发布「广播测试」通知,确认现场广播效果是否清晰,话音质量是否良好,再和控制室人员用PA系统进行通话测试,确认是否清晰。");
+            explanationCell4.setCellStyle(wrapStyle);
+            for (int i = 1; i < 7; i++) {
+                explanationRow4.createCell(i).setCellStyle(wrapStyle);
+            }
+            sheet.addMergedRegion(new CellRangeAddress(rowIndex, rowIndex, 0, 6));
+
+            filename = "_现场呼叫系统" + dateStr + "检查记录.xlsx";
+            out = Files.newOutputStream(Paths.get(ExcelUtil.getAbsoluteFile(filename)));
+            wb.write(out);
+            wb.close();
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        return filename;
+    }
 }

+ 142 - 5
master/src/main/java/com/ruoyi/project/ps/inspection/controller/TPsInspectionCofferController.java

@@ -1,25 +1,40 @@
 package com.ruoyi.project.ps.inspection.controller;
 
 import com.ruoyi.common.utils.StringUtils;
+import com.ruoyi.common.utils.file.ExcelUtils;
 import com.ruoyi.common.utils.poi.ExcelUtil;
 import com.ruoyi.framework.aspectj.lang.annotation.Log;
 import com.ruoyi.framework.aspectj.lang.enums.BusinessType;
+import com.ruoyi.framework.config.RuoYiConfig;
 import com.ruoyi.framework.web.controller.BaseController;
 import com.ruoyi.framework.web.domain.AjaxResult;
 import com.ruoyi.framework.web.page.TableDataInfo;
+import com.ruoyi.project.common.domain.TCommonfile;
+import com.ruoyi.project.common.service.ITCommonfileService;
 import com.ruoyi.project.ps.inspection.domain.TPsInspectionCoffer;
 import com.ruoyi.project.ps.inspection.service.ITPsInspectionCofferService;
 import com.ruoyi.project.ps.patrol.domain.TPsPatrolIssues;
 import com.ruoyi.project.ps.patrol.domain.TPsPatrolPlan;
 import com.ruoyi.project.ps.patrol.service.ITPsPatrolIssuesService;
 import com.ruoyi.project.ps.patrol.service.ITPsPatrolPlanService;
-import com.ruoyi.project.common.domain.TCommonfile;
-import com.ruoyi.project.common.service.ITCommonfileService;
+import com.ruoyi.project.system.domain.SysUser;
+import com.ruoyi.project.system.service.ISysUserService;
 import org.apache.commons.collections4.CollectionUtils;
+import org.apache.poi.ss.usermodel.Cell;
+import org.apache.poi.ss.usermodel.CellStyle;
+import org.apache.poi.ss.usermodel.Row;
+import org.apache.poi.ss.util.CellRangeAddress;
+import org.apache.poi.xssf.usermodel.XSSFSheet;
+import org.apache.poi.xssf.usermodel.XSSFWorkbook;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.web.bind.annotation.*;
 
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.nio.file.Files;
+import java.nio.file.Paths;
+import java.util.Calendar;
 import java.util.Date;
 import java.util.List;
 
@@ -44,6 +59,8 @@ public class TPsInspectionCofferController extends BaseController {
 
     @Autowired
     private ITCommonfileService tCommonfileService;
+    @Autowired
+    private ISysUserService sysUserService;
 
     /**
      * 查询围堰检查记录列表
@@ -63,9 +80,13 @@ public class TPsInspectionCofferController extends BaseController {
     @Log(title = "围堰检查记录", businessType = BusinessType.EXPORT)
     @GetMapping("/export")
     public AjaxResult export(TPsInspectionCoffer tPsInspectionCoffer) {
+        tPsInspectionCoffer.setIssuesFlag(0L);
         List<TPsInspectionCoffer> list = tPsInspectionCofferService.selectTPsInspectionCofferList(tPsInspectionCoffer);
-        ExcelUtil<TPsInspectionCoffer> util = new ExcelUtil<TPsInspectionCoffer>(TPsInspectionCoffer.class);
-        return util.exportExcel(list, "coffer");
+        if (!list.isEmpty()) {
+            return AjaxResult.success(exportTmpl(list));
+        } else {
+            return AjaxResult.error("暂无可导出数据");
+        }
     }
 
     /**
@@ -82,7 +103,7 @@ public class TPsInspectionCofferController extends BaseController {
      */
     @GetMapping(value = "/info")
     public AjaxResult getInfoByCofferno(TPsInspectionCoffer tPsInspectionCoffer) {
-        if (tPsInspectionCoffer.getId()!=null){
+        if (tPsInspectionCoffer.getId() != null) {
             return AjaxResult.success(tPsInspectionCofferService.selectTPsInspectionCofferById(tPsInspectionCoffer.getId()));
         }
         if (!"PS".equals(tPsInspectionCoffer.getPlant())) {
@@ -223,4 +244,120 @@ public class TPsInspectionCofferController extends BaseController {
     public AjaxResult remove(@PathVariable Long[] ids) {
         return toAjax(tPsInspectionCofferService.deleteTPsInspectionCofferByIds(ids));
     }
+
+    public String exportTmpl(List<TPsInspectionCoffer> list) {
+        OutputStream out;
+        String filename = null;
+        try {
+            String tempUrl = RuoYiConfig.getFilePath("/tempDoc/ps/coffer.xlsx");
+            InputStream is = Files.newInputStream(Paths.get(tempUrl));
+            XSSFWorkbook wb = new XSSFWorkbook(is);
+            XSSFSheet sheet = wb.getSheetAt(0);
+            int rowIndex = 6;
+            int num = 1;
+            String dateStr = "";
+            String confirmerSignUrl = "";
+            Row row6 = sheet.getRow(rowIndex);
+            Cell originalcell = row6.getCell(0);
+            CellStyle originalStyle = originalcell.getCellStyle();
+            if (!list.isEmpty()) {
+                TPsInspectionCoffer coffer = list.get(0);
+                TPsPatrolPlan plan = tPsPatrolPlanService.selectTPsPatrolPlanById(coffer.getPlanId());
+                dateStr = "_" + plan.getPlanYear() + "年_" + plan.getPlanMonth() + "月_";
+
+                Row row3 = sheet.getRow(2);
+                row3.getCell(0).setCellValue("年度:" + plan.getPlanYear() + " 年                       检查周期:1次/月(月底前完成)");
+
+                String r5c6Str = "检查时间:  月   日";
+                if (plan.getConfirmDate() != null && StringUtils.isNotEmpty(plan.getConfirmed())) {
+                    Calendar calendar = Calendar.getInstance();
+                    calendar.setTime(plan.getConfirmDate());
+                    r5c6Str = "检查时间:" + (calendar.get(Calendar.MONTH) + 1) + "月 " + calendar.get(Calendar.DAY_OF_MONTH) + "日";
+                    SysUser sysUser = sysUserService.selectUserById(Long.valueOf(plan.getConfirmed()));
+                    confirmerSignUrl = sysUser.getSignUrl();
+                }
+                Row row5 = sheet.getRow(3);
+                row5.getCell(3).setCellValue(r5c6Str);
+
+                for (TPsInspectionCoffer item : list) {
+                    Row row = sheet.createRow(rowIndex);
+                    row.setHeight((short) 300);
+                    row.createCell(0).setCellValue(num);
+                    row.createCell(1).setCellValue(item.getCofferNo());
+                    row.createCell(2).setCellValue(item.getPosition());
+                    row.createCell(3).setCellValue("1".equals(item.getFloorOk()) ? "✓" : item.getFloorOk());
+                    row.createCell(4).setCellValue("1".equals(item.getWallOk()) ? "✓" : item.getWallOk());
+                    row.createCell(5).setCellValue("1".equals(item.getSignOk()) ? "✓" : item.getSignOk());
+                    row.createCell(6).setCellValue("1".equals(item.getDrainOk()) ? "✓" : item.getDrainOk());
+                    for (int i = 0; i < 7; i++) {
+                        row.getCell(i).setCellStyle(originalStyle);
+                    }
+                    num++;
+                    rowIndex++;
+                }
+            }
+            // 检查人行
+            Row confirmerRow = sheet.createRow(rowIndex);
+            confirmerRow.setHeight((short) 800);
+            confirmerRow.createCell(0).setCellValue("检查人");
+            for (int i = 1; i < 7; i++) {
+                confirmerRow.createCell(i);
+            }
+            if (StringUtils.isNotEmpty(confirmerSignUrl))
+                ExcelUtils.insertPicture(wb, sheet, confirmerSignUrl, rowIndex, 3, 1, 1);
+            for (int i = 0; i < 7; i++) {
+                confirmerRow.getCell(i).setCellStyle(originalStyle);
+            }
+            sheet.addMergedRegion(new CellRangeAddress(rowIndex, rowIndex, 0, 2));
+            sheet.addMergedRegion(new CellRangeAddress(rowIndex, rowIndex, 3, 6));
+
+            // 说明
+            rowIndex++;
+            Row explanationRow1 = sheet.createRow(rowIndex);
+            explanationRow1.setHeight((short) 300);
+            explanationRow1.createCell(0).setCellValue("说明");
+            for (int i = 1; i < 7; i++) {
+                explanationRow1.createCell(i);
+            }
+            sheet.addMergedRegion(new CellRangeAddress(rowIndex, rowIndex, 0, 6));
+
+            rowIndex++;
+            Row explanationRow2 = sheet.createRow(rowIndex);
+            explanationRow2.setHeight((short) 300);
+            explanationRow2.createCell(0).setCellValue("1.检查频率为每月一次。");
+            for (int i = 1; i < 7; i++) {
+                explanationRow2.createCell(i);
+            }
+            sheet.addMergedRegion(new CellRangeAddress(rowIndex, rowIndex, 0, 6));
+
+            rowIndex++;
+            Row explanationRow3 = sheet.createRow(rowIndex);
+            explanationRow3.setHeight((short) 300);
+            explanationRow3.createCell(0).setCellValue("2.检查正常打「√」有不正常情况打「X」,并在备注中说明,包括整改结果。");
+            for (int i = 1; i < 7; i++) {
+                explanationRow3.createCell(i);
+            }
+            sheet.addMergedRegion(new CellRangeAddress(rowIndex, rowIndex, 0, 6));
+
+            rowIndex++;
+            Row explanationRow4 = sheet.createRow(rowIndex);
+            CellStyle wrapStyle = wb.createCellStyle();
+            wrapStyle.setWrapText(true);
+            Cell explanationCell4 = explanationRow4.createCell(0);
+            explanationCell4.setCellValue("3.检查内容:围堰结构完整、无破损、开裂、渗漏,围堰内地面平整无开裂,地坑泵及相关阀门状态完好,格栅板无缺失或损坏,围堰内水沟无杂物堵塞,警示标识完好。");
+            explanationCell4.setCellStyle(wrapStyle);
+            for (int i = 1; i < 7; i++) {
+                explanationRow4.createCell(i).setCellStyle(wrapStyle);
+            }
+            sheet.addMergedRegion(new CellRangeAddress(rowIndex, rowIndex, 0, 6));
+
+            filename = "_围堰" + dateStr + "检查记录.xlsx";
+            out = Files.newOutputStream(Paths.get(ExcelUtil.getAbsoluteFile(filename)));
+            wb.write(out);
+            wb.close();
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        return filename;
+    }
 }

+ 141 - 5
master/src/main/java/com/ruoyi/project/ps/inspection/controller/TPsInspectionCurtainController.java

@@ -1,25 +1,40 @@
 package com.ruoyi.project.ps.inspection.controller;
 
 import com.ruoyi.common.utils.StringUtils;
+import com.ruoyi.common.utils.file.ExcelUtils;
 import com.ruoyi.common.utils.poi.ExcelUtil;
 import com.ruoyi.framework.aspectj.lang.annotation.Log;
 import com.ruoyi.framework.aspectj.lang.enums.BusinessType;
+import com.ruoyi.framework.config.RuoYiConfig;
 import com.ruoyi.framework.web.controller.BaseController;
 import com.ruoyi.framework.web.domain.AjaxResult;
 import com.ruoyi.framework.web.page.TableDataInfo;
+import com.ruoyi.project.common.domain.TCommonfile;
+import com.ruoyi.project.common.service.ITCommonfileService;
 import com.ruoyi.project.ps.inspection.domain.TPsInspectionCurtain;
 import com.ruoyi.project.ps.inspection.service.ITPsInspectionCurtainService;
 import com.ruoyi.project.ps.patrol.domain.TPsPatrolIssues;
 import com.ruoyi.project.ps.patrol.domain.TPsPatrolPlan;
 import com.ruoyi.project.ps.patrol.service.ITPsPatrolIssuesService;
 import com.ruoyi.project.ps.patrol.service.ITPsPatrolPlanService;
-import com.ruoyi.project.common.domain.TCommonfile;
-import com.ruoyi.project.common.service.ITCommonfileService;
+import com.ruoyi.project.system.domain.SysUser;
+import com.ruoyi.project.system.service.ISysUserService;
 import org.apache.commons.collections4.CollectionUtils;
+import org.apache.poi.ss.usermodel.Cell;
+import org.apache.poi.ss.usermodel.CellStyle;
+import org.apache.poi.ss.usermodel.Row;
+import org.apache.poi.ss.util.CellRangeAddress;
+import org.apache.poi.xssf.usermodel.XSSFSheet;
+import org.apache.poi.xssf.usermodel.XSSFWorkbook;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.web.bind.annotation.*;
 
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.nio.file.Files;
+import java.nio.file.Paths;
+import java.util.Calendar;
 import java.util.Date;
 import java.util.List;
 
@@ -44,6 +59,8 @@ public class TPsInspectionCurtainController extends BaseController {
 
     @Autowired
     private ITCommonfileService tCommonfileService;
+    @Autowired
+    private ISysUserService sysUserService;
 
     /**
      * 查询现场消防水幕检测记录列表
@@ -63,9 +80,13 @@ public class TPsInspectionCurtainController extends BaseController {
     @Log(title = "现场消防水幕检测记录", businessType = BusinessType.EXPORT)
     @GetMapping("/export")
     public AjaxResult export(TPsInspectionCurtain tPsInspectionCurtain) {
+        tPsInspectionCurtain.setIssuesFlag(0L);
         List<TPsInspectionCurtain> list = tPsInspectionCurtainService.selectTPsInspectionCurtainList(tPsInspectionCurtain);
-        ExcelUtil<TPsInspectionCurtain> util = new ExcelUtil<TPsInspectionCurtain>(TPsInspectionCurtain.class);
-        return util.exportExcel(list, "curtain");
+        if (!list.isEmpty()) {
+            return AjaxResult.success(exportTmpl(list));
+        } else {
+            return AjaxResult.error("暂无可导出数据");
+        }
     }
 
     /**
@@ -82,7 +103,7 @@ public class TPsInspectionCurtainController extends BaseController {
      */
     @GetMapping(value = "/info")
     public AjaxResult getInfoByCurtainname(TPsInspectionCurtain tPsInspectionCurtain) {
-        if (tPsInspectionCurtain.getId()!=null){
+        if (tPsInspectionCurtain.getId() != null) {
             return AjaxResult.success(tPsInspectionCurtainService.selectTPsInspectionCurtainById(tPsInspectionCurtain.getId()));
         }
         if (!"PS".equals(tPsInspectionCurtain.getPlant())) {
@@ -223,4 +244,119 @@ public class TPsInspectionCurtainController extends BaseController {
     public AjaxResult remove(@PathVariable Long[] ids) {
         return toAjax(tPsInspectionCurtainService.deleteTPsInspectionCurtainByIds(ids));
     }
+
+    public String exportTmpl(List<TPsInspectionCurtain> list) {
+        OutputStream out;
+        String filename = null;
+        try {
+            String tempUrl = RuoYiConfig.getFilePath("/tempDoc/ps/curtain.xlsx");
+            InputStream is = Files.newInputStream(Paths.get(tempUrl));
+            XSSFWorkbook wb = new XSSFWorkbook(is);
+            XSSFSheet sheet = wb.getSheetAt(0);
+            int rowIndex = 7;
+            int num = 1;
+            String dateStr = "";
+            String confirmerSignUrl = "";
+            Row row7 = sheet.getRow(rowIndex);
+            Cell originalcell = row7.getCell(0);
+            CellStyle originalStyle = originalcell.getCellStyle();
+            if (!list.isEmpty()) {
+                TPsInspectionCurtain curtain = list.get(0);
+                TPsPatrolPlan plan = tPsPatrolPlanService.selectTPsPatrolPlanById(curtain.getPlanId());
+                dateStr = "_" + plan.getPlanYear() + "年_" + plan.getPlanMonth() + "月_";
+
+                Row row3 = sheet.getRow(3);
+                row3.getCell(0).setCellValue("年度:" + plan.getPlanYear() + " 年                       检查频率:1次/3月(检查月份月底完成)");
+
+                String r5c6Str = "检查时间:  月   日";
+                if (plan.getConfirmDate() != null && StringUtils.isNotEmpty(plan.getConfirmed())) {
+                    Calendar calendar = Calendar.getInstance();
+                    calendar.setTime(plan.getConfirmDate());
+                    r5c6Str = "检查时间:" + (calendar.get(Calendar.MONTH) + 1) + "月 " + calendar.get(Calendar.DAY_OF_MONTH) + "日";
+                    SysUser sysUser = sysUserService.selectUserById(Long.valueOf(plan.getConfirmed()));
+                    confirmerSignUrl = sysUser.getSignUrl();
+                }
+                Row row5 = sheet.getRow(4);
+                row5.getCell(3).setCellValue(r5c6Str);
+
+                for (TPsInspectionCurtain item : list) {
+                    Row row = sheet.createRow(rowIndex);
+                    row.setHeight((short) 300);
+                    row.createCell(0).setCellValue(item.getPosition());
+                    row.createCell(1).setCellValue(item.getCurtainName());
+                    row.createCell(2).setCellValue("1".equals(item.getAppearance()) ? "✓" : item.getAppearance());
+                    row.createCell(3).setCellValue("1".equals(item.getDiscloseOk()) ? "✓" : item.getDiscloseOk());
+                    row.createCell(4).setCellValue("1".equals(item.getNoOdds()) ? "✓" : item.getNoOdds());
+                    row.createCell(5).setCellValue("1".equals(item.getPressureTest()) ? "✓" : item.getPressureTest());
+                    for (int i = 0; i < 6; i++) {
+                        row.getCell(i).setCellStyle(originalStyle);
+                    }
+                    num++;
+                    rowIndex++;
+                }
+            }
+            // 检查人行
+            Row confirmerRow = sheet.createRow(rowIndex);
+            confirmerRow.setHeight((short) 800);
+            confirmerRow.createCell(0).setCellValue("检查人");
+            for (int i = 1; i < 6; i++) {
+                confirmerRow.createCell(i);
+            }
+            if (StringUtils.isNotEmpty(confirmerSignUrl))
+                ExcelUtils.insertPicture(wb, sheet, confirmerSignUrl, rowIndex, 2, 1, 1);
+            for (int i = 0; i < 6; i++) {
+                confirmerRow.getCell(i).setCellStyle(originalStyle);
+            }
+            sheet.addMergedRegion(new CellRangeAddress(rowIndex, rowIndex, 0, 1));
+            sheet.addMergedRegion(new CellRangeAddress(rowIndex, rowIndex, 2, 5));
+
+            // 说明
+            rowIndex++;
+            Row explanationRow1 = sheet.createRow(rowIndex);
+            explanationRow1.setHeight((short) 300);
+            explanationRow1.createCell(0).setCellValue("说明");
+            for (int i = 1; i < 6; i++) {
+                explanationRow1.createCell(i);
+            }
+            sheet.addMergedRegion(new CellRangeAddress(rowIndex, rowIndex, 0, 5));
+
+            rowIndex++;
+            Row explanationRow2 = sheet.createRow(rowIndex);
+            explanationRow2.setHeight((short) 300);
+            explanationRow2.createCell(0).setCellValue("1.检查频率为每3个月一次。");
+            for (int i = 1; i < 6; i++) {
+                explanationRow2.createCell(i);
+            }
+            sheet.addMergedRegion(new CellRangeAddress(rowIndex, rowIndex, 0, 5));
+
+            rowIndex++;
+            Row explanationRow3 = sheet.createRow(rowIndex);
+            explanationRow3.setHeight((short) 300);
+            explanationRow3.createCell(0).setCellValue("2.检查正常打「√」有不正常情况打「X」,并在备注中说明,包括整改结果。");
+            for (int i = 1; i < 6; i++) {
+                explanationRow3.createCell(i);
+            }
+            sheet.addMergedRegion(new CellRangeAddress(rowIndex, rowIndex, 0, 5));
+
+            rowIndex++;
+            Row explanationRow4 = sheet.createRow(rowIndex);
+            CellStyle wrapStyle = wb.createCellStyle();
+            wrapStyle.setWrapText(true);
+            Cell explanationCell4 = explanationRow4.createCell(0);
+            explanationCell4.setCellValue("3.检查内容:消防水幕系统外观完好,消防水幕是否有泄漏,消防水幕阀门周围是否清洁,有无堆放杂物,每年第三季度做一次带压测试。");
+            explanationCell4.setCellStyle(wrapStyle);
+            for (int i = 1; i < 6; i++) {
+                explanationRow4.createCell(i);
+            }
+            sheet.addMergedRegion(new CellRangeAddress(rowIndex, rowIndex, 0, 5));
+
+            filename = "_消防水幕" + dateStr + "检查记录.xlsx";
+            out = Files.newOutputStream(Paths.get(ExcelUtil.getAbsoluteFile(filename)));
+            wb.write(out);
+            wb.close();
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        return filename;
+    }
 }

+ 149 - 5
master/src/main/java/com/ruoyi/project/ps/inspection/controller/TPsInspectionExtinguisherController.java

@@ -1,25 +1,40 @@
 package com.ruoyi.project.ps.inspection.controller;
 
 import com.ruoyi.common.utils.StringUtils;
+import com.ruoyi.common.utils.file.ExcelUtils;
 import com.ruoyi.common.utils.poi.ExcelUtil;
 import com.ruoyi.framework.aspectj.lang.annotation.Log;
 import com.ruoyi.framework.aspectj.lang.enums.BusinessType;
+import com.ruoyi.framework.config.RuoYiConfig;
 import com.ruoyi.framework.web.controller.BaseController;
 import com.ruoyi.framework.web.domain.AjaxResult;
 import com.ruoyi.framework.web.page.TableDataInfo;
+import com.ruoyi.project.common.domain.TCommonfile;
+import com.ruoyi.project.common.service.ITCommonfileService;
 import com.ruoyi.project.ps.inspection.domain.TPsInspectionExtinguisher;
 import com.ruoyi.project.ps.inspection.service.ITPsInspectionExtinguisherService;
 import com.ruoyi.project.ps.patrol.domain.TPsPatrolIssues;
 import com.ruoyi.project.ps.patrol.domain.TPsPatrolPlan;
 import com.ruoyi.project.ps.patrol.service.ITPsPatrolIssuesService;
 import com.ruoyi.project.ps.patrol.service.ITPsPatrolPlanService;
-import com.ruoyi.project.common.domain.TCommonfile;
-import com.ruoyi.project.common.service.ITCommonfileService;
+import com.ruoyi.project.system.domain.SysUser;
+import com.ruoyi.project.system.service.ISysUserService;
 import org.apache.commons.collections4.CollectionUtils;
+import org.apache.poi.ss.usermodel.Cell;
+import org.apache.poi.ss.usermodel.CellStyle;
+import org.apache.poi.ss.usermodel.Row;
+import org.apache.poi.ss.util.CellRangeAddress;
+import org.apache.poi.xssf.usermodel.XSSFSheet;
+import org.apache.poi.xssf.usermodel.XSSFWorkbook;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.web.bind.annotation.*;
 
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.nio.file.Files;
+import java.nio.file.Paths;
+import java.util.Calendar;
 import java.util.Date;
 import java.util.List;
 
@@ -44,6 +59,8 @@ public class TPsInspectionExtinguisherController extends BaseController {
 
     @Autowired
     private ITCommonfileService tCommonfileService;
+    @Autowired
+    private ISysUserService sysUserService;
 
     /**
      * 查询现场灭火器检查记录列表
@@ -63,9 +80,13 @@ public class TPsInspectionExtinguisherController extends BaseController {
     @Log(title = "现场灭火器检查记录", businessType = BusinessType.EXPORT)
     @GetMapping("/export")
     public AjaxResult export(TPsInspectionExtinguisher tPsInspectionExtinguisher) {
+        tPsInspectionExtinguisher.setIssuesFlag(0L);
         List<TPsInspectionExtinguisher> list = tPsInspectionExtinguisherService.selectTPsInspectionExtinguisherList(tPsInspectionExtinguisher);
-        ExcelUtil<TPsInspectionExtinguisher> util = new ExcelUtil<TPsInspectionExtinguisher>(TPsInspectionExtinguisher.class);
-        return util.exportExcel(list, "extinguisher");
+        if (!list.isEmpty()) {
+            return AjaxResult.success(exportTmpl(list));
+        } else {
+            return AjaxResult.error("暂无可导出数据");
+        }
     }
 
     /**
@@ -82,7 +103,7 @@ public class TPsInspectionExtinguisherController extends BaseController {
      */
     @GetMapping(value = "/info")
     public AjaxResult getInfoByFireextinguisherno(TPsInspectionExtinguisher tPsInspectionExtinguisher) {
-        if (tPsInspectionExtinguisher.getId()!=null){
+        if (tPsInspectionExtinguisher.getId() != null) {
             return AjaxResult.success(tPsInspectionExtinguisherService.selectTPsInspectionExtinguisherById(tPsInspectionExtinguisher.getId()));
         }
         if (!"PS".equals(tPsInspectionExtinguisher.getPlant())) {
@@ -228,4 +249,127 @@ public class TPsInspectionExtinguisherController extends BaseController {
     public AjaxResult remove(@PathVariable Long[] ids) {
         return toAjax(tPsInspectionExtinguisherService.deleteTPsInspectionExtinguisherByIds(ids));
     }
+
+    public String exportTmpl(List<TPsInspectionExtinguisher> list) {
+        OutputStream out;
+        String filename = null;
+        try {
+            String tempUrl = RuoYiConfig.getFilePath("/tempDoc/ps/extinguisher.xlsx");
+            InputStream is = Files.newInputStream(Paths.get(tempUrl));
+            XSSFWorkbook wb = new XSSFWorkbook(is);
+            XSSFSheet sheet = wb.getSheetAt(0);
+            int rowIndex = 6;
+            int num = 1;
+            String dateStr = "";
+            String confirmerSignUrl = "";
+            Row row6 = sheet.getRow(rowIndex);
+            Cell originalcell = row6.getCell(0);
+            CellStyle originalStyle = originalcell.getCellStyle();
+            if (!list.isEmpty()) {
+                TPsInspectionExtinguisher extinguisher = list.get(0);
+                TPsPatrolPlan plan = tPsPatrolPlanService.selectTPsPatrolPlanById(extinguisher.getPlanId());
+                dateStr = "_" + plan.getPlanYear() + "年_" + plan.getPlanMonth() + "月_";
+
+                Row row3 = sheet.getRow(2);
+                row3.getCell(0).setCellValue("年度:" + plan.getPlanYear() + " 年                       检查频率:1次/半月(每月15日之前一次和每月月底之前一次)");
+
+                String r5c11Str = "检查时间:  月   日";
+                if (plan.getConfirmDate() != null && StringUtils.isNotEmpty(plan.getConfirmed())) {
+                    Calendar calendar = Calendar.getInstance();
+                    calendar.setTime(plan.getConfirmDate());
+                    r5c11Str = "检查时间:" + (calendar.get(Calendar.MONTH) + 1) + "月 " + calendar.get(Calendar.DAY_OF_MONTH) + "日";
+                    SysUser sysUser = sysUserService.selectUserById(Long.valueOf(plan.getConfirmed()));
+                    confirmerSignUrl = sysUser.getSignUrl();
+                }
+                Row row5 = sheet.getRow(3);
+                row5.getCell(4).setCellValue(r5c11Str);
+
+                for (TPsInspectionExtinguisher item : list) {
+                    if (item.getDevType().equals("2"))
+                        continue;
+                    Row row = sheet.createRow(rowIndex);
+                    row.setHeight((short) 300);
+                    row.createCell(0).setCellValue(num);
+                    row.createCell(1).setCellValue(item.getFireExtinguisherNo());
+                    row.createCell(2).setCellValue(item.getPosition());
+                    row.createCell(3).setCellValue(item.getFireExtinguisherModel());
+                    row.createCell(4).setCellValue("1".equals(item.getCheck1()) ? "✓" : item.getCheck1());
+                    row.createCell(5).setCellValue("1".equals(item.getCheck2()) ? "✓" : item.getCheck2());
+                    row.createCell(6).setCellValue("1".equals(item.getCheck3()) ? "✓" : item.getCheck3());
+                    row.createCell(7).setCellValue("1".equals(item.getCheck4()) ? "✓" : item.getCheck4());
+//                    row.createCell(8).setCellValue(item.getWeight1());
+//                    row.createCell(9).setCellValue(item.getWeight2());
+//                    row.createCell(10).setCellValue(item.getWeight3());
+//                    row.createCell(11).setCellValue(item.getWeight4());
+                    for (int i = 0; i < 8; i++) {
+                        row.getCell(i).setCellStyle(originalStyle);
+                    }
+                    num++;
+                    rowIndex++;
+                }
+            }
+            // 检查人行
+            Row confirmerRow = sheet.createRow(rowIndex);
+            confirmerRow.setHeight((short) 800);
+            confirmerRow.createCell(0).setCellValue("检查人");
+            for (int i = 1; i < 8; i++) {
+                confirmerRow.createCell(i);
+            }
+            if (StringUtils.isNotEmpty(confirmerSignUrl))
+                ExcelUtils.insertPicture(wb, sheet, confirmerSignUrl, rowIndex, 4, 1, 1);
+            for (int i = 0; i < 8; i++) {
+                confirmerRow.getCell(i).setCellStyle(originalStyle);
+            }
+            sheet.addMergedRegion(new CellRangeAddress(rowIndex, rowIndex, 0, 3));
+            sheet.addMergedRegion(new CellRangeAddress(rowIndex, rowIndex, 4, 7));
+
+            // 说明
+            rowIndex++;
+            Row explanationRow1 = sheet.createRow(rowIndex);
+            explanationRow1.setHeight((short) 300);
+            explanationRow1.createCell(0).setCellValue("说明");
+            for (int i = 1; i < 8; i++) {
+                explanationRow1.createCell(i);
+            }
+            sheet.addMergedRegion(new CellRangeAddress(rowIndex, rowIndex, 0, 7));
+
+            rowIndex++;
+            Row explanationRow2 = sheet.createRow(rowIndex);
+            explanationRow2.setHeight((short) 300);
+            explanationRow2.createCell(0).setCellValue("1.检查频率为每个月一次。");
+            for (int i = 1; i < 8; i++) {
+                explanationRow2.createCell(i);
+            }
+            sheet.addMergedRegion(new CellRangeAddress(rowIndex, rowIndex, 0, 7));
+
+            rowIndex++;
+            Row explanationRow3 = sheet.createRow(rowIndex);
+            explanationRow3.setHeight((short) 300);
+            explanationRow3.createCell(0).setCellValue("2.检查正常打「√」有不正常情况打「X」,并在备注中说明,包括整改结果。");
+            for (int i = 1; i < 8; i++) {
+                explanationRow3.createCell(i);
+            }
+            sheet.addMergedRegion(new CellRangeAddress(rowIndex, rowIndex, 0, 7));
+
+            rowIndex++;
+            Row explanationRow4 = sheet.createRow(rowIndex);
+            CellStyle wrapStyle = wb.createCellStyle();
+            wrapStyle.setWrapText(true);
+            Cell explanationCell4 = explanationRow4.createCell(0);
+            explanationCell4.setCellValue("3.检查内容:灭火器外观是否清洁,标识完好,压力是否正常,是否有破损。");
+            explanationCell4.setCellStyle(wrapStyle);
+            for (int i = 1; i < 8; i++) {
+                explanationRow4.createCell(i).setCellStyle(wrapStyle);
+            }
+            sheet.addMergedRegion(new CellRangeAddress(rowIndex, rowIndex, 0, 7));
+
+            filename = "_灭火器" + dateStr + "检查记录.xlsx";
+            out = Files.newOutputStream(Paths.get(ExcelUtil.getAbsoluteFile(filename)));
+            wb.write(out);
+            wb.close();
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        return filename;
+    }
 }

+ 141 - 5
master/src/main/java/com/ruoyi/project/ps/inspection/controller/TPsInspectionEyewashController.java

@@ -1,25 +1,40 @@
 package com.ruoyi.project.ps.inspection.controller;
 
 import com.ruoyi.common.utils.StringUtils;
+import com.ruoyi.common.utils.file.ExcelUtils;
 import com.ruoyi.common.utils.poi.ExcelUtil;
 import com.ruoyi.framework.aspectj.lang.annotation.Log;
 import com.ruoyi.framework.aspectj.lang.enums.BusinessType;
+import com.ruoyi.framework.config.RuoYiConfig;
 import com.ruoyi.framework.web.controller.BaseController;
 import com.ruoyi.framework.web.domain.AjaxResult;
 import com.ruoyi.framework.web.page.TableDataInfo;
+import com.ruoyi.project.common.domain.TCommonfile;
+import com.ruoyi.project.common.service.ITCommonfileService;
 import com.ruoyi.project.ps.inspection.domain.TPsInspectionEyewash;
 import com.ruoyi.project.ps.inspection.service.ITPsInspectionEyewashService;
 import com.ruoyi.project.ps.patrol.domain.TPsPatrolIssues;
 import com.ruoyi.project.ps.patrol.domain.TPsPatrolPlan;
 import com.ruoyi.project.ps.patrol.service.ITPsPatrolIssuesService;
 import com.ruoyi.project.ps.patrol.service.ITPsPatrolPlanService;
-import com.ruoyi.project.common.domain.TCommonfile;
-import com.ruoyi.project.common.service.ITCommonfileService;
+import com.ruoyi.project.system.domain.SysUser;
+import com.ruoyi.project.system.service.ISysUserService;
 import org.apache.commons.collections4.CollectionUtils;
+import org.apache.poi.ss.usermodel.Cell;
+import org.apache.poi.ss.usermodel.CellStyle;
+import org.apache.poi.ss.usermodel.Row;
+import org.apache.poi.ss.util.CellRangeAddress;
+import org.apache.poi.xssf.usermodel.XSSFSheet;
+import org.apache.poi.xssf.usermodel.XSSFWorkbook;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.web.bind.annotation.*;
 
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.nio.file.Files;
+import java.nio.file.Paths;
+import java.util.Calendar;
 import java.util.Date;
 import java.util.List;
 
@@ -44,6 +59,8 @@ public class TPsInspectionEyewashController extends BaseController {
 
     @Autowired
     private ITCommonfileService tCommonfileService;
+    @Autowired
+    private ISysUserService sysUserService;
 
     /**
      * 查询洗眼器巡检记录列表
@@ -63,9 +80,13 @@ public class TPsInspectionEyewashController extends BaseController {
     @Log(title = "洗眼器巡检记录", businessType = BusinessType.EXPORT)
     @GetMapping("/export")
     public AjaxResult export(TPsInspectionEyewash tPsInspectionEyewash) {
+        tPsInspectionEyewash.setIssuesFlag(0L);
         List<TPsInspectionEyewash> list = tPsInspectionEyewashService.selectTPsInspectionEyewashList(tPsInspectionEyewash);
-        ExcelUtil<TPsInspectionEyewash> util = new ExcelUtil<TPsInspectionEyewash>(TPsInspectionEyewash.class);
-        return util.exportExcel(list, "eyewash");
+        if (!list.isEmpty()) {
+            return AjaxResult.success(exportTmpl(list));
+        } else {
+            return AjaxResult.error("暂无可导出数据");
+        }
     }
 
     /**
@@ -82,7 +103,7 @@ public class TPsInspectionEyewashController extends BaseController {
      */
     @GetMapping(value = "/info")
     public AjaxResult getInfoByDevno(TPsInspectionEyewash tPsInspectionEyewash) {
-        if (tPsInspectionEyewash.getId()!=null){
+        if (tPsInspectionEyewash.getId() != null) {
             return AjaxResult.success(tPsInspectionEyewashService.selectTPsInspectionEyewashById(tPsInspectionEyewash.getId()));
         }
         if (!"PS".equals(tPsInspectionEyewash.getPlant())) {
@@ -231,4 +252,119 @@ public class TPsInspectionEyewashController extends BaseController {
     public AjaxResult remove(@PathVariable Long[] ids) {
         return toAjax(tPsInspectionEyewashService.deleteTPsInspectionEyewashByIds(ids));
     }
+
+    public String exportTmpl(List<TPsInspectionEyewash> list) {
+        OutputStream out;
+        String filename = null;
+        try {
+            String tempUrl = RuoYiConfig.getFilePath("/tempDoc/ps/eyewash.xlsx");
+            InputStream is = Files.newInputStream(Paths.get(tempUrl));
+            XSSFWorkbook wb = new XSSFWorkbook(is);
+            XSSFSheet sheet = wb.getSheetAt(0);
+            int rowIndex = 6;
+            int num = 1;
+            String dateStr = "";
+            String confirmerSignUrl = "";
+            Row row6 = sheet.getRow(rowIndex);
+            Cell originalcell = row6.getCell(0);
+            CellStyle originalStyle = originalcell.getCellStyle();
+            if (!list.isEmpty()) {
+                TPsInspectionEyewash eyewash = list.get(0);
+                TPsPatrolPlan plan = tPsPatrolPlanService.selectTPsPatrolPlanById(eyewash.getPlanId());
+                dateStr = "_" + plan.getPlanYear() + "年_" + plan.getPlanMonth() + "月_";
+
+                Row row3 = sheet.getRow(2);
+                row3.getCell(0).setCellValue("年度:" + plan.getPlanYear() + " 年                       检查频率:1次/每月(月底前完成)");
+
+                String r5c14Str = "检查时间:  月   日";
+                if (plan.getConfirmDate() != null && StringUtils.isNotEmpty(plan.getConfirmed())) {
+                    Calendar calendar = Calendar.getInstance();
+                    calendar.setTime(plan.getConfirmDate());
+                    r5c14Str = "检查时间:" + (calendar.get(Calendar.MONTH) + 1) + "月 " + calendar.get(Calendar.DAY_OF_MONTH) + "日";
+                    SysUser sysUser = sysUserService.selectUserById(Long.valueOf(plan.getConfirmed()));
+                    confirmerSignUrl = sysUser.getSignUrl();
+                }
+                Row row5 = sheet.getRow(3);
+                row5.getCell(2).setCellValue(r5c14Str);
+
+                for (TPsInspectionEyewash item : list) {
+                    Row row = sheet.createRow(rowIndex);
+                    row.setHeight((short) 300);
+                    row.createCell(0).setCellValue(num);
+                    row.createCell(1).setCellValue(item.getDevNo());
+                    row.createCell(2).setCellValue("1".equals(item.getSignageOk()) ? "✓" : item.getSignageOk());
+                    row.createCell(3).setCellValue("1".equals(item.getAccessClear()) ? "✓" : item.getAccessClear());
+                    row.createCell(4).setCellValue("1".equals(item.getLightUnobstructed()) ? "✓" : item.getLightUnobstructed());
+                    row.createCell(5).setCellValue("1".equals(item.getPartsOk()) ? "✓" : item.getPartsOk());
+                    row.createCell(6).setCellValue("1".equals(item.getValveOpenLocked()) ? "✓" : item.getValveOpenLocked());
+                    row.createCell(7).setCellValue("1".equals(item.getDustcapOk()) ? "✓" : item.getDustcapOk());
+                    row.createCell(8).setCellValue("1".equals(item.getWaterHeight()) ? "✓" : item.getWaterHeight());
+                    row.createCell(9).setCellValue("1".equals(item.getWaterClean()) ? "✓" : item.getWaterClean());
+                    row.createCell(10).setCellValue("1".equals(item.getWaterTemp()) ? "✓" : item.getWaterTemp());
+                    row.createCell(11).setCellValue("1".equals(item.getLeversOk()) ? "✓" : item.getLeversOk());
+                    row.createCell(12).setCellValue("1".equals(item.getErcNotified()) ? "✓" : item.getErcNotified());
+                    row.createCell(13).setCellValue("1".equals(item.getLocalAlarmOk()) ? "✓" : item.getLocalAlarmOk());
+                    row.createCell(14).setCellValue("1".equals(item.getAlarmSignalOk()) ? "✓" : item.getAlarmSignalOk());
+                    for (int i = 0; i < 15; i++) {
+                        row.getCell(i).setCellStyle(originalStyle);
+                    }
+                    num++;
+                    rowIndex++;
+                }
+            }
+            // 检查人行
+            Row confirmerRow = sheet.createRow(rowIndex);
+            confirmerRow.setHeight((short) 800);
+            confirmerRow.createCell(0).setCellValue("检查人");
+            for (int i = 1; i < 15; i++) {
+                confirmerRow.createCell(i);
+            }
+            if (StringUtils.isNotEmpty(confirmerSignUrl))
+                ExcelUtils.insertPicture(wb, sheet, confirmerSignUrl, rowIndex, 2, 1, 1);
+            for (int i = 0; i < 15; i++) {
+                confirmerRow.getCell(i).setCellStyle(originalStyle);
+            }
+            sheet.addMergedRegion(new CellRangeAddress(rowIndex, rowIndex, 0, 1));
+            sheet.addMergedRegion(new CellRangeAddress(rowIndex, rowIndex, 2, 14));
+
+            // 说明
+            rowIndex++;
+            Row explanationRow1 = sheet.createRow(rowIndex);
+            explanationRow1.setHeight((short) 300);
+            explanationRow1.createCell(0).setCellValue("说明");
+            for (int i = 1; i < 15; i++) {
+                explanationRow1.createCell(i);
+            }
+            sheet.addMergedRegion(new CellRangeAddress(rowIndex, rowIndex, 0, 14));
+
+            rowIndex++;
+            Row explanationRow2 = sheet.createRow(rowIndex);
+            explanationRow2.setHeight((short) 300);
+            explanationRow2.createCell(0).setCellValue("1.检查状态不符合时,需要排放足够长的时间并增加测试频率。");
+            for (int i = 1; i < 15; i++) {
+                explanationRow2.createCell(i);
+            }
+            sheet.addMergedRegion(new CellRangeAddress(rowIndex, rowIndex, 0, 14));
+
+            rowIndex++;
+            Row explanationRow3 = sheet.createRow(rowIndex);
+            CellStyle wrapStyle = wb.createCellStyle();
+            wrapStyle.setWrapText(true);
+            Cell explanationCell3 = explanationRow3.createCell(0);
+            explanationCell3.setCellValue("2.如果选择不符合,增加测试频率为每周一次的10分钟冲洗并检查伴热情况,确保符合要求。");
+            explanationCell3.setCellStyle(wrapStyle);
+            for (int i = 1; i < 15; i++) {
+                explanationRow3.createCell(i).setCellStyle(wrapStyle);
+            }
+            sheet.addMergedRegion(new CellRangeAddress(rowIndex, rowIndex, 0, 14));
+
+            filename = "_洗眼器" + dateStr + "检查记录.xlsx";
+            out = Files.newOutputStream(Paths.get(ExcelUtil.getAbsoluteFile(filename)));
+            wb.write(out);
+            wb.close();
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        return filename;
+    }
 }

+ 142 - 5
master/src/main/java/com/ruoyi/project/ps/inspection/controller/TPsInspectionFgsController.java

@@ -1,25 +1,40 @@
 package com.ruoyi.project.ps.inspection.controller;
 
 import com.ruoyi.common.utils.StringUtils;
+import com.ruoyi.common.utils.file.ExcelUtils;
 import com.ruoyi.common.utils.poi.ExcelUtil;
 import com.ruoyi.framework.aspectj.lang.annotation.Log;
 import com.ruoyi.framework.aspectj.lang.enums.BusinessType;
+import com.ruoyi.framework.config.RuoYiConfig;
 import com.ruoyi.framework.web.controller.BaseController;
 import com.ruoyi.framework.web.domain.AjaxResult;
 import com.ruoyi.framework.web.page.TableDataInfo;
+import com.ruoyi.project.common.domain.TCommonfile;
+import com.ruoyi.project.common.service.ITCommonfileService;
 import com.ruoyi.project.ps.inspection.domain.TPsInspectionFgs;
 import com.ruoyi.project.ps.inspection.service.ITPsInspectionFgsService;
 import com.ruoyi.project.ps.patrol.domain.TPsPatrolIssues;
 import com.ruoyi.project.ps.patrol.domain.TPsPatrolPlan;
 import com.ruoyi.project.ps.patrol.service.ITPsPatrolIssuesService;
 import com.ruoyi.project.ps.patrol.service.ITPsPatrolPlanService;
-import com.ruoyi.project.common.domain.TCommonfile;
-import com.ruoyi.project.common.service.ITCommonfileService;
+import com.ruoyi.project.system.domain.SysUser;
+import com.ruoyi.project.system.service.ISysUserService;
 import org.apache.commons.collections4.CollectionUtils;
+import org.apache.poi.ss.usermodel.Cell;
+import org.apache.poi.ss.usermodel.CellStyle;
+import org.apache.poi.ss.usermodel.Row;
+import org.apache.poi.ss.util.CellRangeAddress;
+import org.apache.poi.xssf.usermodel.XSSFSheet;
+import org.apache.poi.xssf.usermodel.XSSFWorkbook;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.web.bind.annotation.*;
 
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.nio.file.Files;
+import java.nio.file.Paths;
+import java.util.Calendar;
 import java.util.Date;
 import java.util.List;
 
@@ -44,6 +59,8 @@ public class TPsInspectionFgsController extends BaseController {
 
     @Autowired
     private ITCommonfileService tCommonfileService;
+    @Autowired
+    private ISysUserService sysUserService;
 
     /**
      * 查询FGS Mini板检查记录列表
@@ -63,9 +80,13 @@ public class TPsInspectionFgsController extends BaseController {
     @Log(title = "FGS Mini板检查记录", businessType = BusinessType.EXPORT)
     @GetMapping("/export")
     public AjaxResult export(TPsInspectionFgs tPsInspectionFgs) {
+        tPsInspectionFgs.setIssuesFlag(0L);
         List<TPsInspectionFgs> list = tPsInspectionFgsService.selectTPsInspectionFgsList(tPsInspectionFgs);
-        ExcelUtil<TPsInspectionFgs> util = new ExcelUtil<TPsInspectionFgs>(TPsInspectionFgs.class);
-        return util.exportExcel(list, "fgs");
+        if (!list.isEmpty()) {
+            return AjaxResult.success(exportTmpl(list));
+        } else {
+            return AjaxResult.error("暂无可导出数据");
+        }
     }
 
     /**
@@ -82,7 +103,7 @@ public class TPsInspectionFgsController extends BaseController {
      */
     @GetMapping(value = "/info")
     public AjaxResult getInfoByFgsno(TPsInspectionFgs tPsInspectionFgs) {
-        if (tPsInspectionFgs.getId()!=null){
+        if (tPsInspectionFgs.getId() != null) {
             return AjaxResult.success(tPsInspectionFgsService.selectTPsInspectionFgsById(tPsInspectionFgs.getId()));
         }
         if (!"PS".equals(tPsInspectionFgs.getPlant())) {
@@ -223,4 +244,120 @@ public class TPsInspectionFgsController extends BaseController {
     public AjaxResult remove(@PathVariable Long[] ids) {
         return toAjax(tPsInspectionFgsService.deleteTPsInspectionFgsByIds(ids));
     }
+
+    public String exportTmpl(List<TPsInspectionFgs> list) {
+        OutputStream out;
+        String filename = null;
+        try {
+            String tempUrl = RuoYiConfig.getFilePath("/tempDoc/ps/fgs.xlsx");
+            InputStream is = Files.newInputStream(Paths.get(tempUrl));
+            XSSFWorkbook wb = new XSSFWorkbook(is);
+            XSSFSheet sheet = wb.getSheetAt(0);
+            int rowIndex = 7;
+            int num = 1;
+            String dateStr = "";
+            String confirmerSignUrl = "";
+            Row row7 = sheet.getRow(rowIndex);
+            Cell originalcell = row7.getCell(0);
+            CellStyle originalStyle = originalcell.getCellStyle();
+            if (!list.isEmpty()) {
+                TPsInspectionFgs fgs = list.get(0);
+                TPsPatrolPlan plan = tPsPatrolPlanService.selectTPsPatrolPlanById(fgs.getPlanId());
+                dateStr = "_" + plan.getPlanYear() + "年_" + plan.getPlanMonth() + "月_";
+
+                Row row3 = sheet.getRow(3);
+                row3.getCell(0).setCellValue("年度:" + plan.getPlanYear() + " 年                       检查周期:1次/月(月底前完成)");
+
+                String r5c6Str = "检查时间:  月   日";
+                if (plan.getConfirmDate() != null && StringUtils.isNotEmpty(plan.getConfirmed())) {
+                    Calendar calendar = Calendar.getInstance();
+                    calendar.setTime(plan.getConfirmDate());
+                    r5c6Str = "检查时间:" + (calendar.get(Calendar.MONTH) + 1) + "月 " + calendar.get(Calendar.DAY_OF_MONTH) + "日";
+                    SysUser sysUser = sysUserService.selectUserById(Long.valueOf(plan.getConfirmed()));
+                    confirmerSignUrl = sysUser.getSignUrl();
+                }
+                Row row5 = sheet.getRow(4);
+                row5.getCell(3).setCellValue(r5c6Str);
+
+                for (TPsInspectionFgs item : list) {
+                    Row row = sheet.createRow(rowIndex);
+                    row.setHeight((short) 300);
+                    row.createCell(0).setCellValue(num);
+                    row.createCell(1).setCellValue(item.getFgsNo());
+                    row.createCell(2).setCellValue(item.getPosition());
+                    row.createCell(3).setCellValue("1".equals(item.getAppearance()) ? "✓" : item.getAppearance());
+                    row.createCell(4).setCellValue("1".equals(item.getTestLightOk()) ? "✓" : item.getTestLightOk());
+                    row.createCell(5).setCellValue("1".equals(item.getTestAlarm()) ? "✓" : item.getTestAlarm());
+                    row.createCell(6).setCellValue("1".equals(item.getWindTemp()) ? "✓" : item.getWindTemp());
+                    for (int i = 0; i < 7; i++) {
+                        row.getCell(i).setCellStyle(originalStyle);
+                    }
+                    num++;
+                    rowIndex++;
+                }
+            }
+            // 检查人行
+            Row confirmerRow = sheet.createRow(rowIndex);
+            confirmerRow.setHeight((short) 800);
+            confirmerRow.createCell(0).setCellValue("检查人");
+            for (int i = 1; i < 7; i++) {
+                confirmerRow.createCell(i);
+            }
+            if (StringUtils.isNotEmpty(confirmerSignUrl))
+                ExcelUtils.insertPicture(wb, sheet, confirmerSignUrl, rowIndex, 3, 1, 1);
+            for (int i = 0; i < 7; i++) {
+                confirmerRow.getCell(i).setCellStyle(originalStyle);
+            }
+            sheet.addMergedRegion(new CellRangeAddress(rowIndex, rowIndex, 0, 2));
+            sheet.addMergedRegion(new CellRangeAddress(rowIndex, rowIndex, 3, 6));
+
+            // 说明
+            rowIndex++;
+            Row explanationRow1 = sheet.createRow(rowIndex);
+            explanationRow1.setHeight((short) 300);
+            explanationRow1.createCell(0).setCellValue("说明");
+            for (int i = 1; i < 7; i++) {
+                explanationRow1.createCell(i);
+            }
+            sheet.addMergedRegion(new CellRangeAddress(rowIndex, rowIndex, 0, 6));
+
+            rowIndex++;
+            Row explanationRow2 = sheet.createRow(rowIndex);
+            explanationRow2.setHeight((short) 300);
+            explanationRow2.createCell(0).setCellValue("1.检查频率为每月一次。");
+            for (int i = 1; i < 7; i++) {
+                explanationRow2.createCell(i);
+            }
+            sheet.addMergedRegion(new CellRangeAddress(rowIndex, rowIndex, 0, 6));
+
+            rowIndex++;
+            Row explanationRow3 = sheet.createRow(rowIndex);
+            explanationRow3.setHeight((short) 300);
+            explanationRow3.createCell(0).setCellValue("2.检查正常打「√」有不正常情况打「X」,并在备注中说明,包括整改结果。");
+            for (int i = 1; i < 7; i++) {
+                explanationRow3.createCell(i);
+            }
+            sheet.addMergedRegion(new CellRangeAddress(rowIndex, rowIndex, 0, 6));
+
+            rowIndex++;
+            Row explanationRow4 = sheet.createRow(rowIndex);
+            CellStyle wrapStyle = wb.createCellStyle();
+            wrapStyle.setWrapText(true);
+            Cell explanationCell4 = explanationRow4.createCell(0);
+            explanationCell4.setCellValue("3.检查内容:FGS显示屏外观完好,无破损,显示正常,画面切换顺畅。");
+            explanationCell4.setCellStyle(wrapStyle);
+            for (int i = 1; i < 7; i++) {
+                explanationRow4.createCell(i).setCellStyle(wrapStyle);
+            }
+            sheet.addMergedRegion(new CellRangeAddress(rowIndex, rowIndex, 0, 6));
+
+            filename = "_FGS_Mini板" + dateStr + "检查记录.xlsx";
+            out = Files.newOutputStream(Paths.get(ExcelUtil.getAbsoluteFile(filename)));
+            wb.write(out);
+            wb.close();
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        return filename;
+    }
 }

+ 143 - 5
master/src/main/java/com/ruoyi/project/ps/inspection/controller/TPsInspectionFiredoorController.java

@@ -1,25 +1,40 @@
 package com.ruoyi.project.ps.inspection.controller;
 
 import com.ruoyi.common.utils.StringUtils;
+import com.ruoyi.common.utils.file.ExcelUtils;
 import com.ruoyi.common.utils.poi.ExcelUtil;
 import com.ruoyi.framework.aspectj.lang.annotation.Log;
 import com.ruoyi.framework.aspectj.lang.enums.BusinessType;
+import com.ruoyi.framework.config.RuoYiConfig;
 import com.ruoyi.framework.web.controller.BaseController;
 import com.ruoyi.framework.web.domain.AjaxResult;
 import com.ruoyi.framework.web.page.TableDataInfo;
+import com.ruoyi.project.common.domain.TCommonfile;
+import com.ruoyi.project.common.service.ITCommonfileService;
 import com.ruoyi.project.ps.inspection.domain.TPsInspectionFiredoor;
 import com.ruoyi.project.ps.inspection.service.ITPsInspectionFiredoorService;
 import com.ruoyi.project.ps.patrol.domain.TPsPatrolIssues;
 import com.ruoyi.project.ps.patrol.domain.TPsPatrolPlan;
 import com.ruoyi.project.ps.patrol.service.ITPsPatrolIssuesService;
 import com.ruoyi.project.ps.patrol.service.ITPsPatrolPlanService;
-import com.ruoyi.project.common.domain.TCommonfile;
-import com.ruoyi.project.common.service.ITCommonfileService;
+import com.ruoyi.project.system.domain.SysUser;
+import com.ruoyi.project.system.service.ISysUserService;
 import org.apache.commons.collections4.CollectionUtils;
+import org.apache.poi.ss.usermodel.Cell;
+import org.apache.poi.ss.usermodel.CellStyle;
+import org.apache.poi.ss.usermodel.Row;
+import org.apache.poi.ss.util.CellRangeAddress;
+import org.apache.poi.xssf.usermodel.XSSFSheet;
+import org.apache.poi.xssf.usermodel.XSSFWorkbook;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.web.bind.annotation.*;
 
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.nio.file.Files;
+import java.nio.file.Paths;
+import java.util.Calendar;
 import java.util.Date;
 import java.util.List;
 
@@ -44,6 +59,8 @@ public class TPsInspectionFiredoorController extends BaseController {
 
     @Autowired
     private ITCommonfileService tCommonfileService;
+    @Autowired
+    private ISysUserService sysUserService;
 
     /**
      * 查询安全防火门防爆门检查记录列表
@@ -63,9 +80,13 @@ public class TPsInspectionFiredoorController extends BaseController {
     @Log(title = "安全防火门防爆门检查记录", businessType = BusinessType.EXPORT)
     @GetMapping("/export")
     public AjaxResult export(TPsInspectionFiredoor tPsInspectionFiredoor) {
+        tPsInspectionFiredoor.setIssuesFlag(0L);
         List<TPsInspectionFiredoor> list = tPsInspectionFiredoorService.selectTPsInspectionFiredoorList(tPsInspectionFiredoor);
-        ExcelUtil<TPsInspectionFiredoor> util = new ExcelUtil<TPsInspectionFiredoor>(TPsInspectionFiredoor.class);
-        return util.exportExcel(list, "firedoor");
+        if (!list.isEmpty()) {
+            return AjaxResult.success(exportTmpl(list));
+        } else {
+            return AjaxResult.error("暂无可导出数据");
+        }
     }
 
     /**
@@ -82,7 +103,7 @@ public class TPsInspectionFiredoorController extends BaseController {
      */
     @GetMapping(value = "/info")
     public AjaxResult getInfoByDoorno(TPsInspectionFiredoor tPsInspectionFiredoor) {
-        if (tPsInspectionFiredoor.getId()!=null){
+        if (tPsInspectionFiredoor.getId() != null) {
             return AjaxResult.success(tPsInspectionFiredoorService.selectTPsInspectionFiredoorById(tPsInspectionFiredoor.getId()));
         }
         if (!"PS".equals(tPsInspectionFiredoor.getPlant())) {
@@ -224,4 +245,121 @@ public class TPsInspectionFiredoorController extends BaseController {
     public AjaxResult remove(@PathVariable Long[] ids) {
         return toAjax(tPsInspectionFiredoorService.deleteTPsInspectionFiredoorByIds(ids));
     }
+
+    public String exportTmpl(List<TPsInspectionFiredoor> list) {
+        OutputStream out;
+        String filename = null;
+        try {
+            String tempUrl = RuoYiConfig.getFilePath("/tempDoc/ps/firedoor.xlsx");
+            InputStream is = Files.newInputStream(Paths.get(tempUrl));
+            XSSFWorkbook wb = new XSSFWorkbook(is);
+            XSSFSheet sheet = wb.getSheetAt(0);
+            int rowIndex = 8;
+            int num = 1;
+            String dateStr = "";
+            String confirmerSignUrl = "";
+            Row row8 = sheet.getRow(rowIndex);
+            Cell originalcell = row8.getCell(0);
+            CellStyle originalStyle = originalcell.getCellStyle();
+            if (!list.isEmpty()) {
+                TPsInspectionFiredoor firedoor = list.get(0);
+                TPsPatrolPlan plan = tPsPatrolPlanService.selectTPsPatrolPlanById(firedoor.getPlanId());
+                dateStr = "_" + plan.getPlanYear() + "年_" + plan.getPlanMonth() + "月_";
+
+                Row row3 = sheet.getRow(4);
+                row3.getCell(0).setCellValue("年度:" + plan.getPlanYear() + " 年                       检查周期:1次/月(月底前完成)");
+
+                String r5c9Str = "检查时间:  月   日";
+                if (plan.getConfirmDate() != null && StringUtils.isNotEmpty(plan.getConfirmed())) {
+                    Calendar calendar = Calendar.getInstance();
+                    calendar.setTime(plan.getConfirmDate());
+                    r5c9Str = "检查时间:" + (calendar.get(Calendar.MONTH) + 1) + "月 " + calendar.get(Calendar.DAY_OF_MONTH) + "日";
+                    SysUser sysUser = sysUserService.selectUserById(Long.valueOf(plan.getConfirmed()));
+                    confirmerSignUrl = sysUser.getSignUrl();
+                }
+                Row row5 = sheet.getRow(5);
+                row5.getCell(4).setCellValue(r5c9Str);
+
+                for (TPsInspectionFiredoor item : list) {
+                    Row row = sheet.createRow(rowIndex);
+                    row.setHeight((short) 300);
+                    row.createCell(0).setCellValue(num);
+                    row.createCell(1).setCellValue(item.getDoorNo());
+                    row.createCell(2).setCellValue(item.getDoorName());
+                    row.createCell(3).setCellValue(item.getPosition());
+                    row.createCell(4).setCellValue("1".equals(item.getAppearance()) ? "✓" : item.getAppearance());
+                    row.createCell(5).setCellValue("1".equals(item.getSeamless()) ? "✓" : item.getSeamless());
+                    row.createCell(6).setCellValue("1".equals(item.getCloserStatus()) ? "✓" : item.getCloserStatus());
+                    row.createCell(7).setCellValue("1".equals(item.getChannelUnobstructed()) ? "✓" : item.getChannelUnobstructed());
+                    for (int i = 0; i < 8; i++) {
+                        row.getCell(i).setCellStyle(originalStyle);
+                    }
+                    num++;
+                    rowIndex++;
+                }
+            }
+            // 检查人行
+            Row confirmerRow = sheet.createRow(rowIndex);
+            confirmerRow.setHeight((short) 800);
+            confirmerRow.createCell(0).setCellValue("检查人");
+            for (int i = 1; i < 8; i++) {
+                confirmerRow.createCell(i);
+            }
+            if (StringUtils.isNotEmpty(confirmerSignUrl))
+                ExcelUtils.insertPicture(wb, sheet, confirmerSignUrl, rowIndex, 4, 1, 1);
+            for (int i = 0; i < 8; i++) {
+                confirmerRow.getCell(i).setCellStyle(originalStyle);
+            }
+            sheet.addMergedRegion(new CellRangeAddress(rowIndex, rowIndex, 0, 3));
+            sheet.addMergedRegion(new CellRangeAddress(rowIndex, rowIndex, 4, 7));
+
+            // 说明
+            rowIndex++;
+            Row explanationRow1 = sheet.createRow(rowIndex);
+            explanationRow1.setHeight((short) 300);
+            explanationRow1.createCell(0).setCellValue("说明");
+            for (int i = 1; i < 8; i++) {
+                explanationRow1.createCell(i);
+            }
+            sheet.addMergedRegion(new CellRangeAddress(rowIndex, rowIndex, 0, 7));
+
+            rowIndex++;
+            Row explanationRow2 = sheet.createRow(rowIndex);
+            explanationRow2.setHeight((short) 300);
+            explanationRow2.createCell(0).setCellValue("1.检查频率为每月一次。");
+            for (int i = 1; i < 8; i++) {
+                explanationRow2.createCell(i);
+            }
+            sheet.addMergedRegion(new CellRangeAddress(rowIndex, rowIndex, 0, 7));
+
+            rowIndex++;
+            Row explanationRow3 = sheet.createRow(rowIndex);
+            explanationRow3.setHeight((short) 300);
+            explanationRow3.createCell(0).setCellValue("2.检查正常打「√」有不正常情况打「X」,并在备注中说明,包括整改结果。");
+            for (int i = 1; i < 8; i++) {
+                explanationRow3.createCell(i);
+            }
+            sheet.addMergedRegion(new CellRangeAddress(rowIndex, rowIndex, 0, 7));
+
+            rowIndex++;
+            Row explanationRow4 = sheet.createRow(rowIndex);
+            CellStyle wrapStyle = wb.createCellStyle();
+            wrapStyle.setWrapText(true);
+            Cell explanationCell4 = explanationRow4.createCell(0);
+            explanationCell4.setCellValue("3.检查内容:安全防火门防爆门的外观是否完好,有无破损,有无穿透性孔洞,安全防火门防爆门与墙体之间有无狭缝,自闭是否正常,有无卡涩现象,安全防火门防爆门前后是否摆放其它物品影响门的开关或阻塞门前后通道。");
+            explanationCell4.setCellStyle(wrapStyle);
+            for (int i = 1; i < 8; i++) {
+                explanationRow4.createCell(i).setCellStyle(wrapStyle);
+            }
+            sheet.addMergedRegion(new CellRangeAddress(rowIndex, rowIndex, 0, 7));
+
+            filename = "_安全防火门防爆门" + dateStr + "检查记录.xlsx";
+            out = Files.newOutputStream(Paths.get(ExcelUtil.getAbsoluteFile(filename)));
+            wb.write(out);
+            wb.close();
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        return filename;
+    }
 }

+ 154 - 5
master/src/main/java/com/ruoyi/project/ps/inspection/controller/TPsInspectionHydrantController.java

@@ -1,25 +1,40 @@
 package com.ruoyi.project.ps.inspection.controller;
 
 import com.ruoyi.common.utils.StringUtils;
+import com.ruoyi.common.utils.file.ExcelUtils;
 import com.ruoyi.common.utils.poi.ExcelUtil;
 import com.ruoyi.framework.aspectj.lang.annotation.Log;
 import com.ruoyi.framework.aspectj.lang.enums.BusinessType;
+import com.ruoyi.framework.config.RuoYiConfig;
 import com.ruoyi.framework.web.controller.BaseController;
 import com.ruoyi.framework.web.domain.AjaxResult;
 import com.ruoyi.framework.web.page.TableDataInfo;
+import com.ruoyi.project.common.domain.TCommonfile;
+import com.ruoyi.project.common.service.ITCommonfileService;
 import com.ruoyi.project.ps.inspection.domain.TPsInspectionHydrant;
 import com.ruoyi.project.ps.inspection.service.ITPsInspectionHydrantService;
 import com.ruoyi.project.ps.patrol.domain.TPsPatrolIssues;
 import com.ruoyi.project.ps.patrol.domain.TPsPatrolPlan;
 import com.ruoyi.project.ps.patrol.service.ITPsPatrolIssuesService;
 import com.ruoyi.project.ps.patrol.service.ITPsPatrolPlanService;
-import com.ruoyi.project.common.domain.TCommonfile;
-import com.ruoyi.project.common.service.ITCommonfileService;
+import com.ruoyi.project.system.domain.SysUser;
+import com.ruoyi.project.system.service.ISysUserService;
 import org.apache.commons.collections4.CollectionUtils;
+import org.apache.poi.ss.usermodel.Cell;
+import org.apache.poi.ss.usermodel.CellStyle;
+import org.apache.poi.ss.usermodel.Row;
+import org.apache.poi.ss.util.CellRangeAddress;
+import org.apache.poi.xssf.usermodel.XSSFSheet;
+import org.apache.poi.xssf.usermodel.XSSFWorkbook;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.web.bind.annotation.*;
 
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.nio.file.Files;
+import java.nio.file.Paths;
+import java.util.Calendar;
 import java.util.Date;
 import java.util.List;
 
@@ -44,6 +59,8 @@ public class TPsInspectionHydrantController extends BaseController {
 
     @Autowired
     private ITCommonfileService tCommonfileService;
+    @Autowired
+    private ISysUserService sysUserService;
 
     /**
      * 查询地上消火栓和消防水带箱检查记录列表
@@ -63,9 +80,13 @@ public class TPsInspectionHydrantController extends BaseController {
     @Log(title = "地上消火栓和消防水带箱检查记录", businessType = BusinessType.EXPORT)
     @GetMapping("/export")
     public AjaxResult export(TPsInspectionHydrant tPsInspectionHydrant) {
+        tPsInspectionHydrant.setIssuesFlag(0L);
         List<TPsInspectionHydrant> list = tPsInspectionHydrantService.selectTPsInspectionHydrantList(tPsInspectionHydrant);
-        ExcelUtil<TPsInspectionHydrant> util = new ExcelUtil<TPsInspectionHydrant>(TPsInspectionHydrant.class);
-        return util.exportExcel(list, "hydrant");
+        if (!list.isEmpty()) {
+            return AjaxResult.success(exportTmpl(list));
+        } else {
+            return AjaxResult.error("暂无可导出数据");
+        }
     }
 
     /**
@@ -82,7 +103,7 @@ public class TPsInspectionHydrantController extends BaseController {
      */
     @GetMapping(value = "/info")
     public AjaxResult getInfoByEquipid(TPsInspectionHydrant tPsInspectionHydrant) {
-        if (tPsInspectionHydrant.getId()!=null){
+        if (tPsInspectionHydrant.getId() != null) {
             return AjaxResult.success(tPsInspectionHydrantService.selectTPsInspectionHydrantById(tPsInspectionHydrant.getId()));
         }
         if (!"PS".equals(tPsInspectionHydrant.getPlant())) {
@@ -227,4 +248,132 @@ public class TPsInspectionHydrantController extends BaseController {
     public AjaxResult remove(@PathVariable Long[] ids) {
         return toAjax(tPsInspectionHydrantService.deleteTPsInspectionHydrantByIds(ids));
     }
+
+    public String exportTmpl(List<TPsInspectionHydrant> list) {
+        OutputStream out;
+        String filename = null;
+        try {
+            String tempUrl = RuoYiConfig.getFilePath("/tempDoc/ps/hydrant.xlsx");
+            InputStream is = Files.newInputStream(Paths.get(tempUrl));
+            XSSFWorkbook wb = new XSSFWorkbook(is);
+            XSSFSheet sheet = wb.getSheetAt(0);
+            int rowIndex = 7;
+            int num = 1;
+            String dateStr = "";
+            String confirmerSignUrl = "";
+            Row row7 = sheet.getRow(rowIndex);
+            Cell originalcell = row7.getCell(0);
+            CellStyle originalStyle = originalcell.getCellStyle();
+            if (!list.isEmpty()) {
+                TPsInspectionHydrant hydrant = list.get(0);
+                TPsPatrolPlan plan = tPsPatrolPlanService.selectTPsPatrolPlanById(hydrant.getPlanId());
+                dateStr = "_" + plan.getPlanYear() + "年_" + plan.getPlanMonth() + "月_";
+
+                Row row3 = sheet.getRow(3);
+                row3.getCell(0).setCellValue("年度:" + plan.getPlanYear() + " 年                       检查频率:1次/月,每月月底前完成检查");
+
+                String r5c9Str = "检查时间:  月   日";
+                if (plan.getConfirmDate() != null && StringUtils.isNotEmpty(plan.getConfirmed())) {
+                    Calendar calendar = Calendar.getInstance();
+                    calendar.setTime(plan.getConfirmDate());
+                    r5c9Str = "检查时间:" + (calendar.get(Calendar.MONTH) + 1) + "月 " + calendar.get(Calendar.DAY_OF_MONTH) + "日";
+                    SysUser sysUser = sysUserService.selectUserById(Long.valueOf(plan.getConfirmed()));
+                    confirmerSignUrl = sysUser.getSignUrl();
+                }
+                Row row5 = sheet.getRow(4);
+                row5.getCell(6).setCellValue(r5c9Str);
+
+                for (TPsInspectionHydrant item : list) {
+                    Row row = sheet.createRow(rowIndex);
+                    row.setHeight((short) 300);
+                    row.createCell(0).setCellValue(num);
+                    row.createCell(1).setCellValue(item.getPosition());
+                    row.createCell(2).setCellValue(item.getEquipId());
+                    row.createCell(3).setCellValue(item.getHydrantQty());
+                    row.createCell(4).setCellValue(item.getHoseQty());
+                    row.createCell(5).setCellValue(item.getWrenchQty());
+                    row.createCell(6).setCellValue("1".equals(item.getAppearance()) ? "✓" : item.getAppearance());
+                    row.createCell(7).setCellValue("1".equals(item.getLeakStatus()) ? "✓" : item.getLeakStatus());
+                    row.createCell(8).setCellValue("1".equals(item.getItemStatus()) ? "✓" : item.getItemStatus());
+                    row.createCell(9).setCellValue("1".equals(item.getAccessStatus()) ? "✓" : item.getAccessStatus());
+                    for (int i = 0; i < 10; i++) {
+                        row.getCell(i).setCellStyle(originalStyle);
+                    }
+                    num++;
+                    rowIndex++;
+                }
+            }
+            // 检查人行
+            Row confirmerRow = sheet.createRow(rowIndex);
+            confirmerRow.setHeight((short) 800);
+            confirmerRow.createCell(0).setCellValue("检查人");
+            for (int i = 1; i < 10; i++) {
+                confirmerRow.createCell(i);
+            }
+            if (StringUtils.isNotEmpty(confirmerSignUrl))
+                ExcelUtils.insertPicture(wb, sheet, confirmerSignUrl, rowIndex, 6, 1, 1);
+            for (int i = 0; i < 10; i++) {
+                confirmerRow.getCell(i).setCellStyle(originalStyle);
+            }
+            sheet.addMergedRegion(new CellRangeAddress(rowIndex, rowIndex, 0, 5));
+            sheet.addMergedRegion(new CellRangeAddress(rowIndex, rowIndex, 6, 9));
+
+            // 说明
+            rowIndex++;
+            Row explanationRow1 = sheet.createRow(rowIndex);
+            explanationRow1.setHeight((short) 300);
+            explanationRow1.createCell(0).setCellValue("说明");
+            for (int i = 1; i < 10; i++) {
+                explanationRow1.createCell(i);
+            }
+            sheet.addMergedRegion(new CellRangeAddress(rowIndex, rowIndex, 0, 9));
+
+            rowIndex++;
+            Row explanationRow2 = sheet.createRow(rowIndex);
+            explanationRow2.setHeight((short) 300);
+            explanationRow2.createCell(0).setCellValue("1.检查内容:地上消火栓外观是否正常;有无泄漏,打开栓体两侧接口盖,打开切断手阀,检查出水是否正常。消火栓接水带出水是否正常。完成后关闭给水阀,室外水消火栓回装两侧接口盖。");
+            for (int i = 1; i < 10; i++) {
+                explanationRow2.createCell(i);
+            }
+            sheet.addMergedRegion(new CellRangeAddress(rowIndex, rowIndex, 0, 9));
+
+            rowIndex++;
+            Row explanationRow3 = sheet.createRow(rowIndex);
+            explanationRow3.setHeight((short) 300);
+            explanationRow3.createCell(0).setCellValue("2.检查内容:消防水带箱外观是否正常;消防水带2根是否完好;消防水枪2个;消防扳手一个是否短缺。");
+            for (int i = 1; i < 10; i++) {
+                explanationRow3.createCell(i);
+            }
+            sheet.addMergedRegion(new CellRangeAddress(rowIndex, rowIndex, 0, 9));
+
+            rowIndex++;
+            Row explanationRow4 = sheet.createRow(rowIndex);
+            explanationRow4.setHeight((short) 300);
+            explanationRow4.createCell(0).setCellValue("3.检查内容:箱内有无杂物;地上消火栓和消防水带箱前道路是否畅通。");
+            for (int i = 1; i < 10; i++) {
+                explanationRow4.createCell(i);
+            }
+            sheet.addMergedRegion(new CellRangeAddress(rowIndex, rowIndex, 0, 9));
+
+            rowIndex++;
+            Row explanationRow5 = sheet.createRow(rowIndex);
+            CellStyle wrapStyle = wb.createCellStyle();
+            wrapStyle.setWrapText(true);
+            Cell explanationCell5 = explanationRow5.createCell(0);
+            explanationCell5.setCellValue("4.检查正常打「√」有不正常情况打「X」,并在备注中说明,包括整改结果。");
+            explanationCell5.setCellStyle(wrapStyle);
+            for (int i = 1; i < 10; i++) {
+                explanationRow5.createCell(i).setCellStyle(wrapStyle);
+            }
+            sheet.addMergedRegion(new CellRangeAddress(rowIndex, rowIndex, 0, 9));
+
+            filename = "_消火栓和消防水带箱" + dateStr + "检查记录.xlsx";
+            out = Files.newOutputStream(Paths.get(ExcelUtil.getAbsoluteFile(filename)));
+            wb.write(out);
+            wb.close();
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        return filename;
+    }
 }

+ 143 - 5
master/src/main/java/com/ruoyi/project/ps/inspection/controller/TPsInspectionLiftController.java

@@ -1,25 +1,40 @@
 package com.ruoyi.project.ps.inspection.controller;
 
 import com.ruoyi.common.utils.StringUtils;
+import com.ruoyi.common.utils.file.ExcelUtils;
 import com.ruoyi.common.utils.poi.ExcelUtil;
 import com.ruoyi.framework.aspectj.lang.annotation.Log;
 import com.ruoyi.framework.aspectj.lang.enums.BusinessType;
+import com.ruoyi.framework.config.RuoYiConfig;
 import com.ruoyi.framework.web.controller.BaseController;
 import com.ruoyi.framework.web.domain.AjaxResult;
 import com.ruoyi.framework.web.page.TableDataInfo;
+import com.ruoyi.project.common.domain.TCommonfile;
+import com.ruoyi.project.common.service.ITCommonfileService;
 import com.ruoyi.project.ps.inspection.domain.TPsInspectionLift;
 import com.ruoyi.project.ps.inspection.service.ITPsInspectionLiftService;
 import com.ruoyi.project.ps.patrol.domain.TPsPatrolIssues;
 import com.ruoyi.project.ps.patrol.domain.TPsPatrolPlan;
 import com.ruoyi.project.ps.patrol.service.ITPsPatrolIssuesService;
 import com.ruoyi.project.ps.patrol.service.ITPsPatrolPlanService;
-import com.ruoyi.project.common.domain.TCommonfile;
-import com.ruoyi.project.common.service.ITCommonfileService;
+import com.ruoyi.project.system.domain.SysUser;
+import com.ruoyi.project.system.service.ISysUserService;
 import org.apache.commons.collections4.CollectionUtils;
+import org.apache.poi.ss.usermodel.Cell;
+import org.apache.poi.ss.usermodel.CellStyle;
+import org.apache.poi.ss.usermodel.Row;
+import org.apache.poi.ss.util.CellRangeAddress;
+import org.apache.poi.xssf.usermodel.XSSFSheet;
+import org.apache.poi.xssf.usermodel.XSSFWorkbook;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.web.bind.annotation.*;
 
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.nio.file.Files;
+import java.nio.file.Paths;
+import java.util.Calendar;
 import java.util.Date;
 import java.util.List;
 
@@ -44,6 +59,8 @@ public class TPsInspectionLiftController extends BaseController {
 
     @Autowired
     private ITCommonfileService tCommonfileService;
+    @Autowired
+    private ISysUserService sysUserService;
 
     /**
      * 查询电梯检查记录列表
@@ -63,9 +80,13 @@ public class TPsInspectionLiftController extends BaseController {
     @Log(title = "电梯检查记录", businessType = BusinessType.EXPORT)
     @GetMapping("/export")
     public AjaxResult export(TPsInspectionLift tPsInspectionLift) {
+        tPsInspectionLift.setIssuesFlag(0L);
         List<TPsInspectionLift> list = tPsInspectionLiftService.selectTPsInspectionLiftList(tPsInspectionLift);
-        ExcelUtil<TPsInspectionLift> util = new ExcelUtil<TPsInspectionLift>(TPsInspectionLift.class);
-        return util.exportExcel(list, "lift");
+        if (!list.isEmpty()) {
+            return AjaxResult.success(exportTmpl(list));
+        } else {
+            return AjaxResult.error("暂无可导出数据");
+        }
     }
 
     /**
@@ -82,7 +103,7 @@ public class TPsInspectionLiftController extends BaseController {
      */
     @GetMapping(value = "/info")
     public AjaxResult getInfoByDevno(TPsInspectionLift tPsInspectionLift) {
-        if (tPsInspectionLift.getId()!=null){
+        if (tPsInspectionLift.getId() != null) {
             return AjaxResult.success(tPsInspectionLiftService.selectTPsInspectionLiftById(tPsInspectionLift.getId()));
         }
         if (!"PS".equals(tPsInspectionLift.getPlant())) {
@@ -225,4 +246,121 @@ public class TPsInspectionLiftController extends BaseController {
     public AjaxResult remove(@PathVariable Long[] ids) {
         return toAjax(tPsInspectionLiftService.deleteTPsInspectionLiftByIds(ids));
     }
+
+    public String exportTmpl(List<TPsInspectionLift> list) {
+        OutputStream out;
+        String filename = null;
+        try {
+            String tempUrl = RuoYiConfig.getFilePath("/tempDoc/ps/lift.xlsx");
+            InputStream is = Files.newInputStream(Paths.get(tempUrl));
+            XSSFWorkbook wb = new XSSFWorkbook(is);
+            XSSFSheet sheet = wb.getSheetAt(0);
+            int rowIndex = 7;
+            int num = 1;
+            String dateStr = "";
+            String confirmerSignUrl = "";
+            Row row7 = sheet.getRow(rowIndex);
+            Cell originalcell = row7.getCell(0);
+            CellStyle originalStyle = originalcell.getCellStyle();
+            if (!list.isEmpty()) {
+                TPsInspectionLift lift = list.get(0);
+                TPsPatrolPlan plan = tPsPatrolPlanService.selectTPsPatrolPlanById(lift.getPlanId());
+                dateStr = "_" + plan.getPlanYear() + "年_" + plan.getPlanMonth() + "月_";
+
+                Row row3 = sheet.getRow(3);
+                row3.getCell(0).setCellValue("年度:" + plan.getPlanYear() + " 年                       检查周期:1次/月(月底前完成)");
+
+                String r5c8Str = "检查时间:  月   日";
+                if (plan.getConfirmDate() != null && StringUtils.isNotEmpty(plan.getConfirmed())) {
+                    Calendar calendar = Calendar.getInstance();
+                    calendar.setTime(plan.getConfirmDate());
+                    r5c8Str = "检查时间:" + (calendar.get(Calendar.MONTH) + 1) + "月 " + calendar.get(Calendar.DAY_OF_MONTH) + "日";
+                    SysUser sysUser = sysUserService.selectUserById(Long.valueOf(plan.getConfirmed()));
+                    confirmerSignUrl = sysUser.getSignUrl();
+                }
+                Row row5 = sheet.getRow(4);
+                row5.getCell(2).setCellValue(r5c8Str);
+
+                for (TPsInspectionLift item : list) {
+                    Row row = sheet.createRow(rowIndex);
+                    row.setHeight((short) 300);
+                    row.createCell(0).setCellValue(item.getDevNo());
+                    row.createCell(1).setCellValue(item.getPosition());
+                    row.createCell(2).setCellValue("1".equals(item.getElevatorDoor()) ? "✓" : item.getElevatorDoor());
+                    row.createCell(3).setCellValue("1".equals(item.getFloorOk()) ? "✓" : item.getFloorOk());
+                    row.createCell(4).setCellValue("1".equals(item.getExplosionTelephone()) ? "✓" : item.getExplosionTelephone());
+                    row.createCell(5).setCellValue("1".equals(item.getFanOk()) ? "✓" : item.getFanOk());
+                    row.createCell(6).setCellValue("1".equals(item.getLightOk()) ? "✓" : item.getLightOk());
+                    row.createCell(7).setCellValue("1".equals(item.getRunSmoothly()) ? "✓" : item.getRunSmoothly());
+                    for (int i = 0; i < 8; i++) {
+                        row.getCell(i).setCellStyle(originalStyle);
+                    }
+                    num++;
+                    rowIndex++;
+                }
+            }
+            // 检查人行
+            Row confirmerRow = sheet.createRow(rowIndex);
+            confirmerRow.setHeight((short) 800);
+            confirmerRow.createCell(0).setCellValue("检查人");
+            for (int i = 1; i < 8; i++) {
+                confirmerRow.createCell(i);
+            }
+            if (StringUtils.isNotEmpty(confirmerSignUrl))
+                ExcelUtils.insertPicture(wb, sheet, confirmerSignUrl, rowIndex, 2, 1, 1);
+            for (int i = 0; i < 8; i++) {
+                confirmerRow.getCell(i).setCellStyle(originalStyle);
+            }
+            sheet.addMergedRegion(new CellRangeAddress(rowIndex, rowIndex, 0, 1));
+            sheet.addMergedRegion(new CellRangeAddress(rowIndex, rowIndex, 2, 7));
+
+            // 说明
+            rowIndex++;
+            Row explanationRow1 = sheet.createRow(rowIndex);
+            explanationRow1.setHeight((short) 300);
+            explanationRow1.createCell(0).setCellValue("说明");
+            for (int i = 1; i < 8; i++) {
+                explanationRow1.createCell(i);
+            }
+            sheet.addMergedRegion(new CellRangeAddress(rowIndex, rowIndex, 0, 7));
+
+            rowIndex++;
+            Row explanationRow2 = sheet.createRow(rowIndex);
+            explanationRow2.setHeight((short) 300);
+            explanationRow2.createCell(0).setCellValue("1.检查频率为每月一次。");
+            for (int i = 1; i < 8; i++) {
+                explanationRow2.createCell(i);
+            }
+            sheet.addMergedRegion(new CellRangeAddress(rowIndex, rowIndex, 0, 7));
+
+            rowIndex++;
+            Row explanationRow3 = sheet.createRow(rowIndex);
+            explanationRow3.setHeight((short) 300);
+            explanationRow3.createCell(0).setCellValue("2.检查正常打「√」有不正常情况打「X」,并在备注中说明,包括整改结果。");
+            for (int i = 1; i < 8; i++) {
+                explanationRow3.createCell(i);
+            }
+            sheet.addMergedRegion(new CellRangeAddress(rowIndex, rowIndex, 0, 7));
+
+            rowIndex++;
+            Row explanationRow4 = sheet.createRow(rowIndex);
+            CellStyle wrapStyle = wb.createCellStyle();
+            wrapStyle.setWrapText(true);
+            Cell explanationCell4 = explanationRow4.createCell(0);
+            explanationCell4.setCellValue("3.检查内容:电梯的厅门、轿门完好;电梯的平层正常,电梯内防爆电话是否完好(拨打控制室电话进行通话测试),电梯内照明是否完好,电梯轿箱内风扇运行是否正常。注意:电梯检查时必须由班组持有电梯操作证的操作人员陪同检查。");
+            explanationCell4.setCellStyle(wrapStyle);
+            for (int i = 1; i < 8; i++) {
+                explanationRow4.createCell(i).setCellStyle(wrapStyle);
+            }
+            sheet.addMergedRegion(new CellRangeAddress(rowIndex, rowIndex, 0, 7));
+
+            filename = "_电梯" + dateStr + "检查记录.xlsx";
+            out = Files.newOutputStream(Paths.get(ExcelUtil.getAbsoluteFile(filename)));
+            wb.write(out);
+            wb.close();
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        return filename;
+    }
 }

+ 142 - 5
master/src/main/java/com/ruoyi/project/ps/inspection/controller/TPsInspectionMonitorController.java

@@ -1,25 +1,40 @@
 package com.ruoyi.project.ps.inspection.controller;
 
 import com.ruoyi.common.utils.StringUtils;
+import com.ruoyi.common.utils.file.ExcelUtils;
 import com.ruoyi.common.utils.poi.ExcelUtil;
 import com.ruoyi.framework.aspectj.lang.annotation.Log;
 import com.ruoyi.framework.aspectj.lang.enums.BusinessType;
+import com.ruoyi.framework.config.RuoYiConfig;
 import com.ruoyi.framework.web.controller.BaseController;
 import com.ruoyi.framework.web.domain.AjaxResult;
 import com.ruoyi.framework.web.page.TableDataInfo;
+import com.ruoyi.project.common.domain.TCommonfile;
+import com.ruoyi.project.common.service.ITCommonfileService;
 import com.ruoyi.project.ps.inspection.domain.TPsInspectionMonitor;
 import com.ruoyi.project.ps.inspection.service.ITPsInspectionMonitorService;
 import com.ruoyi.project.ps.patrol.domain.TPsPatrolIssues;
 import com.ruoyi.project.ps.patrol.domain.TPsPatrolPlan;
 import com.ruoyi.project.ps.patrol.service.ITPsPatrolIssuesService;
 import com.ruoyi.project.ps.patrol.service.ITPsPatrolPlanService;
-import com.ruoyi.project.common.domain.TCommonfile;
-import com.ruoyi.project.common.service.ITCommonfileService;
+import com.ruoyi.project.system.domain.SysUser;
+import com.ruoyi.project.system.service.ISysUserService;
 import org.apache.commons.collections4.CollectionUtils;
+import org.apache.poi.ss.usermodel.Cell;
+import org.apache.poi.ss.usermodel.CellStyle;
+import org.apache.poi.ss.usermodel.Row;
+import org.apache.poi.ss.util.CellRangeAddress;
+import org.apache.poi.xssf.usermodel.XSSFSheet;
+import org.apache.poi.xssf.usermodel.XSSFWorkbook;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.web.bind.annotation.*;
 
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.nio.file.Files;
+import java.nio.file.Paths;
+import java.util.Calendar;
 import java.util.Date;
 import java.util.List;
 
@@ -44,6 +59,8 @@ public class TPsInspectionMonitorController extends BaseController {
 
     @Autowired
     private ITCommonfileService tCommonfileService;
+    @Autowired
+    private ISysUserService sysUserService;
 
     /**
      * 查询现场消防炮检查记录列表
@@ -63,9 +80,13 @@ public class TPsInspectionMonitorController extends BaseController {
     @Log(title = "现场消防炮检查记录", businessType = BusinessType.EXPORT)
     @GetMapping("/export")
     public AjaxResult export(TPsInspectionMonitor tPsInspectionMonitor) {
+        tPsInspectionMonitor.setIssuesFlag(0L);
         List<TPsInspectionMonitor> list = tPsInspectionMonitorService.selectTPsInspectionMonitorList(tPsInspectionMonitor);
-        ExcelUtil<TPsInspectionMonitor> util = new ExcelUtil<TPsInspectionMonitor>(TPsInspectionMonitor.class);
-        return util.exportExcel(list, "monitor");
+        if (!list.isEmpty()) {
+            return AjaxResult.success(exportTmpl(list));
+        } else {
+            return AjaxResult.error("暂无可导出数据");
+        }
     }
 
     /**
@@ -82,7 +103,7 @@ public class TPsInspectionMonitorController extends BaseController {
      */
     @GetMapping(value = "/info")
     public AjaxResult getInfoByDevno(TPsInspectionMonitor tPsInspectionMonitor) {
-        if (tPsInspectionMonitor.getId()!=null){
+        if (tPsInspectionMonitor.getId() != null) {
             return AjaxResult.success(tPsInspectionMonitorService.selectTPsInspectionMonitorById(tPsInspectionMonitor.getId()));
         }
         if (!"PS".equals(tPsInspectionMonitor.getPlant())) {
@@ -224,4 +245,120 @@ public class TPsInspectionMonitorController extends BaseController {
     public AjaxResult remove(@PathVariable Long[] ids) {
         return toAjax(tPsInspectionMonitorService.deleteTPsInspectionMonitorByIds(ids));
     }
+
+    public String exportTmpl(List<TPsInspectionMonitor> list) {
+        OutputStream out;
+        String filename = null;
+        try {
+            String tempUrl = RuoYiConfig.getFilePath("/tempDoc/ps/monitor.xlsx");
+            InputStream is = Files.newInputStream(Paths.get(tempUrl));
+            XSSFWorkbook wb = new XSSFWorkbook(is);
+            XSSFSheet sheet = wb.getSheetAt(0);
+            int rowIndex = 7;
+            int num = 1;
+            String dateStr = "";
+            String confirmerSignUrl = "";
+            Row row7 = sheet.getRow(rowIndex);
+            Cell originalcell = row7.getCell(0);
+            CellStyle originalStyle = originalcell.getCellStyle();
+            if (!list.isEmpty()) {
+                TPsInspectionMonitor monitor = list.get(0);
+                TPsPatrolPlan plan = tPsPatrolPlanService.selectTPsPatrolPlanById(monitor.getPlanId());
+                dateStr = "_" + plan.getPlanYear() + "年_" + plan.getPlanMonth() + "月_";
+
+                Row row3 = sheet.getRow(3);
+                row3.getCell(0).setCellValue("年度:" + plan.getPlanYear() + " 年                       检查频率:1次/月(每月月底前完成)");
+
+                String r5c9Str = "检查时间:  月   日";
+                if (plan.getConfirmDate() != null && StringUtils.isNotEmpty(plan.getConfirmed())) {
+                    Calendar calendar = Calendar.getInstance();
+                    calendar.setTime(plan.getConfirmDate());
+                    r5c9Str = "检查时间:" + (calendar.get(Calendar.MONTH) + 1) + "月 " + calendar.get(Calendar.DAY_OF_MONTH) + "日";
+                    SysUser sysUser = sysUserService.selectUserById(Long.valueOf(plan.getConfirmed()));
+                    confirmerSignUrl = sysUser.getSignUrl();
+                }
+                Row row5 = sheet.getRow(4);
+                row5.getCell(2).setCellValue(r5c9Str);
+
+                for (TPsInspectionMonitor item : list) {
+                    Row row = sheet.createRow(rowIndex);
+                    row.setHeight((short) 300);
+                    row.createCell(0).setCellValue(item.getDevNo());
+                    row.createCell(1).setCellValue(item.getPosition());
+                    row.createCell(2).setCellValue("1".equals(item.getCannonRotate()) ? "✓" : item.getCannonRotate());
+                    row.createCell(3).setCellValue("1".equals(item.getValveSwitch()) ? "✓" : item.getValveSwitch());
+                    row.createCell(4).setCellValue("1".equals(item.getDirectJet()) ? "✓" : item.getDirectJet());
+                    row.createCell(5).setCellValue("1".equals(item.getRotateSpray()) ? "✓" : item.getRotateSpray());
+                    row.createCell(6).setCellValue("1".equals(item.getWaterPressure()) ? "✓" : item.getWaterPressure());
+                    for (int i = 0; i < 7; i++) {
+                        row.getCell(i).setCellStyle(originalStyle);
+                    }
+                    num++;
+                    rowIndex++;
+                }
+            }
+            // 检查人行
+            Row confirmerRow = sheet.createRow(rowIndex);
+            confirmerRow.setHeight((short) 800);
+            confirmerRow.createCell(0).setCellValue("检查人");
+            for (int i = 1; i < 7; i++) {
+                confirmerRow.createCell(i);
+            }
+            if (StringUtils.isNotEmpty(confirmerSignUrl))
+                ExcelUtils.insertPicture(wb, sheet, confirmerSignUrl, rowIndex, 2, 1, 1);
+            for (int i = 0; i < 7; i++) {
+                confirmerRow.getCell(i).setCellStyle(originalStyle);
+            }
+            sheet.addMergedRegion(new CellRangeAddress(rowIndex, rowIndex, 0, 1));
+            sheet.addMergedRegion(new CellRangeAddress(rowIndex, rowIndex, 2, 6));
+
+            // 说明
+            rowIndex++;
+            Row explanationRow1 = sheet.createRow(rowIndex);
+            explanationRow1.setHeight((short) 300);
+            explanationRow1.createCell(0).setCellValue("说明");
+            for (int i = 1; i < 7; i++) {
+                explanationRow1.createCell(i);
+            }
+            sheet.addMergedRegion(new CellRangeAddress(rowIndex, rowIndex, 0, 6));
+
+            rowIndex++;
+            Row explanationRow2 = sheet.createRow(rowIndex);
+            explanationRow2.setHeight((short) 300);
+            explanationRow2.createCell(0).setCellValue("1.检查频率为每月检查维护一次。");
+            for (int i = 1; i < 7; i++) {
+                explanationRow2.createCell(i);
+            }
+            sheet.addMergedRegion(new CellRangeAddress(rowIndex, rowIndex, 0, 6));
+
+            rowIndex++;
+            Row explanationRow3 = sheet.createRow(rowIndex);
+            explanationRow3.setHeight((short) 300);
+            explanationRow3.createCell(0).setCellValue("2.检查正常打「√」有不正常情况打「X」,并在备注中说明,包括整改结果。");
+            for (int i = 1; i < 7; i++) {
+                explanationRow3.createCell(i);
+            }
+            sheet.addMergedRegion(new CellRangeAddress(rowIndex, rowIndex, 0, 6));
+
+            rowIndex++;
+            Row explanationRow4 = sheet.createRow(rowIndex);
+            CellStyle wrapStyle = wb.createCellStyle();
+            wrapStyle.setWrapText(true);
+            Cell explanationCell4 = explanationRow4.createCell(0);
+            explanationCell4.setCellValue("3.检查内容:先检查消防炮外观是否完好,标识是否完好,炮体是否有零件缺失或锈蚀。调整确认炮身上下左右转向是否完好,然后将炮口调至合适位置,打开给水手阀,检查出水是否正常,炮体上压力表显示是否完好,水花切换是否灵活,是否有泄漏,并将炮体上给水阀开关一遍检查是否开关自如。有无其它影响使用的情况。关闭给水阀,炮口调至向下,检查切断阀是否内漏。");
+            explanationCell4.setCellStyle(wrapStyle);
+            for (int i = 1; i < 7; i++) {
+                explanationRow4.createCell(i).setCellStyle(wrapStyle);
+            }
+            sheet.addMergedRegion(new CellRangeAddress(rowIndex, rowIndex, 0, 6));
+
+            filename = "_消防炮" + dateStr + "检查记录.xlsx";
+            out = Files.newOutputStream(Paths.get(ExcelUtil.getAbsoluteFile(filename)));
+            wb.write(out);
+            wb.close();
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        return filename;
+    }
 }

+ 141 - 5
master/src/main/java/com/ruoyi/project/ps/inspection/controller/TPsInspectionPitController.java

@@ -1,25 +1,40 @@
 package com.ruoyi.project.ps.inspection.controller;
 
 import com.ruoyi.common.utils.StringUtils;
+import com.ruoyi.common.utils.file.ExcelUtils;
 import com.ruoyi.common.utils.poi.ExcelUtil;
 import com.ruoyi.framework.aspectj.lang.annotation.Log;
 import com.ruoyi.framework.aspectj.lang.enums.BusinessType;
+import com.ruoyi.framework.config.RuoYiConfig;
 import com.ruoyi.framework.web.controller.BaseController;
 import com.ruoyi.framework.web.domain.AjaxResult;
 import com.ruoyi.framework.web.page.TableDataInfo;
+import com.ruoyi.project.common.domain.TCommonfile;
+import com.ruoyi.project.common.service.ITCommonfileService;
 import com.ruoyi.project.ps.inspection.domain.TPsInspectionPit;
 import com.ruoyi.project.ps.inspection.service.ITPsInspectionPitService;
 import com.ruoyi.project.ps.patrol.domain.TPsPatrolIssues;
 import com.ruoyi.project.ps.patrol.domain.TPsPatrolPlan;
 import com.ruoyi.project.ps.patrol.service.ITPsPatrolIssuesService;
 import com.ruoyi.project.ps.patrol.service.ITPsPatrolPlanService;
-import com.ruoyi.project.common.domain.TCommonfile;
-import com.ruoyi.project.common.service.ITCommonfileService;
+import com.ruoyi.project.system.domain.SysUser;
+import com.ruoyi.project.system.service.ISysUserService;
 import org.apache.commons.collections4.CollectionUtils;
+import org.apache.poi.ss.usermodel.Cell;
+import org.apache.poi.ss.usermodel.CellStyle;
+import org.apache.poi.ss.usermodel.Row;
+import org.apache.poi.ss.util.CellRangeAddress;
+import org.apache.poi.xssf.usermodel.XSSFSheet;
+import org.apache.poi.xssf.usermodel.XSSFWorkbook;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.web.bind.annotation.*;
 
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.nio.file.Files;
+import java.nio.file.Paths;
+import java.util.Calendar;
 import java.util.Date;
 import java.util.List;
 
@@ -44,6 +59,8 @@ public class TPsInspectionPitController extends BaseController {
 
     @Autowired
     private ITCommonfileService tCommonfileService;
+    @Autowired
+    private ISysUserService sysUserService;
 
     /**
      * 查询现场地井检查记录列表
@@ -63,9 +80,13 @@ public class TPsInspectionPitController extends BaseController {
     @Log(title = "现场地井检查记录", businessType = BusinessType.EXPORT)
     @GetMapping("/export")
     public AjaxResult export(TPsInspectionPit tPsInspectionPit) {
+        tPsInspectionPit.setIssuesFlag(0L);
         List<TPsInspectionPit> list = tPsInspectionPitService.selectTPsInspectionPitList(tPsInspectionPit);
-        ExcelUtil<TPsInspectionPit> util = new ExcelUtil<TPsInspectionPit>(TPsInspectionPit.class);
-        return util.exportExcel(list, "pit");
+        if (!list.isEmpty()) {
+            return AjaxResult.success(exportTmpl(list));
+        } else {
+            return AjaxResult.error("暂无可导出数据");
+        }
     }
 
     /**
@@ -82,7 +103,7 @@ public class TPsInspectionPitController extends BaseController {
      */
     @GetMapping(value = "/info")
     public AjaxResult getInfoByDevno(TPsInspectionPit tPsInspectionPit) {
-        if (tPsInspectionPit.getId()!=null){
+        if (tPsInspectionPit.getId() != null) {
             return AjaxResult.success(tPsInspectionPitService.selectTPsInspectionPitById(tPsInspectionPit.getId()));
         }
         if (!"PS".equals(tPsInspectionPit.getPlant())) {
@@ -222,4 +243,119 @@ public class TPsInspectionPitController extends BaseController {
     public AjaxResult remove(@PathVariable Long[] ids) {
         return toAjax(tPsInspectionPitService.deleteTPsInspectionPitByIds(ids));
     }
+
+    public String exportTmpl(List<TPsInspectionPit> list) {
+        OutputStream out;
+        String filename = null;
+        try {
+            String tempUrl = RuoYiConfig.getFilePath("/tempDoc/ps/pit.xlsx");
+            InputStream is = Files.newInputStream(Paths.get(tempUrl));
+            XSSFWorkbook wb = new XSSFWorkbook(is);
+            XSSFSheet sheet = wb.getSheetAt(0);
+            int rowIndex = 7;
+            int num = 1;
+            String dateStr = "";
+            String confirmerSignUrl = "";
+            Row row7 = sheet.getRow(rowIndex);
+            Cell originalcell = row7.getCell(0);
+            CellStyle originalStyle = originalcell.getCellStyle();
+            if (!list.isEmpty()) {
+                TPsInspectionPit pit = list.get(0);
+                TPsPatrolPlan plan = tPsPatrolPlanService.selectTPsPatrolPlanById(pit.getPlanId());
+                dateStr = "_" + plan.getPlanYear() + "年_" + plan.getPlanMonth() + "月_";
+
+                Row row3 = sheet.getRow(3);
+                row3.getCell(0).setCellValue("年度:" + plan.getPlanYear() + " 年");
+
+                String r5c5Str = "检查时间:  月   日";
+                if (plan.getConfirmDate() != null && StringUtils.isNotEmpty(plan.getConfirmed())) {
+                    Calendar calendar = Calendar.getInstance();
+                    calendar.setTime(plan.getConfirmDate());
+                    r5c5Str = "检查时间:" + (calendar.get(Calendar.MONTH) + 1) + "月 " + calendar.get(Calendar.DAY_OF_MONTH) + "日";
+                    SysUser sysUser = sysUserService.selectUserById(Long.valueOf(plan.getConfirmed()));
+                    confirmerSignUrl = sysUser.getSignUrl();
+                }
+                Row row5 = sheet.getRow(4);
+                row5.getCell(3).setCellValue(r5c5Str);
+
+                for (TPsInspectionPit item : list) {
+                    Row row = sheet.createRow(rowIndex);
+                    row.setHeight((short) 300);
+                    row.createCell(0).setCellValue(num);
+                    row.createCell(1).setCellValue(item.getDevNo());
+                    row.createCell(2).setCellValue(item.getPosition());
+                    row.createCell(3).setCellValue("1".equals(item.getAroundPit()) ? "✓" : item.getAroundPit());
+                    row.createCell(4).setCellValue("1".equals(item.getManholeCover()) ? "✓" : item.getManholeCover());
+                    row.createCell(5).setCellValue("1".equals(item.getInsidePit()) ? "✓" : item.getInsidePit());
+                    for (int i = 0; i < 6; i++) {
+                        row.getCell(i).setCellStyle(originalStyle);
+                    }
+                    num++;
+                    rowIndex++;
+                }
+            }
+            // 检查人行
+            Row confirmerRow = sheet.createRow(rowIndex);
+            confirmerRow.setHeight((short) 800);
+            confirmerRow.createCell(0).setCellValue("检查人");
+            for (int i = 1; i < 6; i++) {
+                confirmerRow.createCell(i);
+            }
+            if (StringUtils.isNotEmpty(confirmerSignUrl))
+                ExcelUtils.insertPicture(wb, sheet, confirmerSignUrl, rowIndex, 3, 1, 1);
+            for (int i = 0; i < 6; i++) {
+                confirmerRow.getCell(i).setCellStyle(originalStyle);
+            }
+            sheet.addMergedRegion(new CellRangeAddress(rowIndex, rowIndex, 0, 2));
+            sheet.addMergedRegion(new CellRangeAddress(rowIndex, rowIndex, 3, 5));
+
+            // 说明
+            rowIndex++;
+            Row explanationRow1 = sheet.createRow(rowIndex);
+            explanationRow1.setHeight((short) 300);
+            explanationRow1.createCell(0).setCellValue("说明");
+            for (int i = 1; i < 6; i++) {
+                explanationRow1.createCell(i);
+            }
+            sheet.addMergedRegion(new CellRangeAddress(rowIndex, rowIndex, 0, 5));
+
+            rowIndex++;
+            Row explanationRow2 = sheet.createRow(rowIndex);
+            explanationRow2.setHeight((short) 300);
+            explanationRow2.createCell(0).setCellValue("1.检查频率为每月一次。");
+            for (int i = 1; i < 6; i++) {
+                explanationRow2.createCell(i);
+            }
+            sheet.addMergedRegion(new CellRangeAddress(rowIndex, rowIndex, 0, 5));
+
+            rowIndex++;
+            Row explanationRow3 = sheet.createRow(rowIndex);
+            explanationRow3.setHeight((short) 300);
+            explanationRow3.createCell(0).setCellValue("2.检查正常打「√」有不正常情况打「X」,并在备注中说明,包括整改结果。");
+            for (int i = 1; i < 6; i++) {
+                explanationRow3.createCell(i);
+            }
+            sheet.addMergedRegion(new CellRangeAddress(rowIndex, rowIndex, 0, 5));
+
+            rowIndex++;
+            Row explanationRow4 = sheet.createRow(rowIndex);
+            CellStyle wrapStyle = wb.createCellStyle();
+            wrapStyle.setWrapText(true);
+            Cell explanationCell4 = explanationRow4.createCell(0);
+            explanationCell4.setCellValue("3.检查内容:现场地井周围地面是否有破损,现场地井井盖是否破损,现场地井内是否干净无杂物。");
+            explanationCell4.setCellStyle(wrapStyle);
+            for (int i = 1; i < 6; i++) {
+                explanationRow4.createCell(i).setCellStyle(wrapStyle);
+            }
+            sheet.addMergedRegion(new CellRangeAddress(rowIndex, rowIndex, 0, 5));
+
+            filename = "_地井" + dateStr + "检查记录.xlsx";
+            out = Files.newOutputStream(Paths.get(ExcelUtil.getAbsoluteFile(filename)));
+            wb.write(out);
+            wb.close();
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        return filename;
+    }
 }

+ 140 - 5
master/src/main/java/com/ruoyi/project/ps/inspection/controller/TPsInspectionRainvalveController.java

@@ -1,25 +1,40 @@
 package com.ruoyi.project.ps.inspection.controller;
 
 import com.ruoyi.common.utils.StringUtils;
+import com.ruoyi.common.utils.file.ExcelUtils;
 import com.ruoyi.common.utils.poi.ExcelUtil;
 import com.ruoyi.framework.aspectj.lang.annotation.Log;
 import com.ruoyi.framework.aspectj.lang.enums.BusinessType;
+import com.ruoyi.framework.config.RuoYiConfig;
 import com.ruoyi.framework.web.controller.BaseController;
 import com.ruoyi.framework.web.domain.AjaxResult;
 import com.ruoyi.framework.web.page.TableDataInfo;
+import com.ruoyi.project.common.domain.TCommonfile;
+import com.ruoyi.project.common.service.ITCommonfileService;
 import com.ruoyi.project.ps.inspection.domain.TPsInspectionRainvalve;
 import com.ruoyi.project.ps.inspection.service.ITPsInspectionRainvalveService;
 import com.ruoyi.project.ps.patrol.domain.TPsPatrolIssues;
 import com.ruoyi.project.ps.patrol.domain.TPsPatrolPlan;
 import com.ruoyi.project.ps.patrol.service.ITPsPatrolIssuesService;
 import com.ruoyi.project.ps.patrol.service.ITPsPatrolPlanService;
-import com.ruoyi.project.common.domain.TCommonfile;
-import com.ruoyi.project.common.service.ITCommonfileService;
+import com.ruoyi.project.system.domain.SysUser;
+import com.ruoyi.project.system.service.ISysUserService;
 import org.apache.commons.collections4.CollectionUtils;
+import org.apache.poi.ss.usermodel.Cell;
+import org.apache.poi.ss.usermodel.CellStyle;
+import org.apache.poi.ss.usermodel.Row;
+import org.apache.poi.ss.util.CellRangeAddress;
+import org.apache.poi.xssf.usermodel.XSSFSheet;
+import org.apache.poi.xssf.usermodel.XSSFWorkbook;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.web.bind.annotation.*;
 
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.nio.file.Files;
+import java.nio.file.Paths;
+import java.util.Calendar;
 import java.util.Date;
 import java.util.List;
 
@@ -44,6 +59,8 @@ public class TPsInspectionRainvalveController extends BaseController {
 
     @Autowired
     private ITCommonfileService tCommonfileService;
+    @Autowired
+    private ISysUserService sysUserService;
 
     /**
      * 查询污水/雨排切换阀门检查列表
@@ -63,9 +80,13 @@ public class TPsInspectionRainvalveController extends BaseController {
     @Log(title = "污水/雨排切换阀门检查", businessType = BusinessType.EXPORT)
     @GetMapping("/export")
     public AjaxResult export(TPsInspectionRainvalve tPsInspectionRainvalve) {
+        tPsInspectionRainvalve.setIssuesFlag(0L);
         List<TPsInspectionRainvalve> list = tPsInspectionRainvalveService.selectTPsInspectionRainvalveList(tPsInspectionRainvalve);
-        ExcelUtil<TPsInspectionRainvalve> util = new ExcelUtil<TPsInspectionRainvalve>(TPsInspectionRainvalve.class);
-        return util.exportExcel(list, "rainvalve");
+        if (!list.isEmpty()) {
+            return AjaxResult.success(exportTmpl(list));
+        } else {
+            return AjaxResult.error("暂无可导出数据");
+        }
     }
 
     /**
@@ -82,7 +103,7 @@ public class TPsInspectionRainvalveController extends BaseController {
      */
     @GetMapping(value = "/info")
     public AjaxResult getInfoByValvename(TPsInspectionRainvalve tPsInspectionRainvalve) {
-        if (tPsInspectionRainvalve.getId()!=null){
+        if (tPsInspectionRainvalve.getId() != null) {
             return AjaxResult.success(tPsInspectionRainvalveService.selectTPsInspectionRainvalveById(tPsInspectionRainvalve.getId()));
         }
         if (!"PS".equals(tPsInspectionRainvalve.getPlant())) {
@@ -222,4 +243,118 @@ public class TPsInspectionRainvalveController extends BaseController {
     public AjaxResult remove(@PathVariable Long[] ids) {
         return toAjax(tPsInspectionRainvalveService.deleteTPsInspectionRainvalveByIds(ids));
     }
+
+    public String exportTmpl(List<TPsInspectionRainvalve> list) {
+        OutputStream out;
+        String filename = null;
+        try {
+            String tempUrl = RuoYiConfig.getFilePath("/tempDoc/ps/rainvalve.xlsx");
+            InputStream is = Files.newInputStream(Paths.get(tempUrl));
+            XSSFWorkbook wb = new XSSFWorkbook(is);
+            XSSFSheet sheet = wb.getSheetAt(0);
+            int rowIndex = 7;
+            int num = 1;
+            String dateStr = "";
+            String confirmerSignUrl = "";
+            Row row7 = sheet.getRow(rowIndex);
+            Cell originalcell = row7.getCell(0);
+            CellStyle originalStyle = originalcell.getCellStyle();
+            if (!list.isEmpty()) {
+                TPsInspectionRainvalve rainvalve = list.get(0);
+                TPsPatrolPlan plan = tPsPatrolPlanService.selectTPsPatrolPlanById(rainvalve.getPlanId());
+                dateStr = "_" + plan.getPlanYear() + "年_" + plan.getPlanMonth() + "月_";
+
+                Row row3 = sheet.getRow(3);
+                row3.getCell(0).setCellValue("年度:" + plan.getPlanYear() + " 年                       检查频率:1次/季度(检查月份月底完成)");
+
+                String r5c5Str = "检查时间:  月   日";
+                if (plan.getConfirmDate() != null && StringUtils.isNotEmpty(plan.getConfirmed())) {
+                    Calendar calendar = Calendar.getInstance();
+                    calendar.setTime(plan.getConfirmDate());
+                    r5c5Str = "检查时间:" + (calendar.get(Calendar.MONTH) + 1) + "月 " + calendar.get(Calendar.DAY_OF_MONTH) + "日";
+                    SysUser sysUser = sysUserService.selectUserById(Long.valueOf(plan.getConfirmed()));
+                    confirmerSignUrl = sysUser.getSignUrl();
+                }
+                Row row5 = sheet.getRow(4);
+                row5.getCell(2).setCellValue(r5c5Str);
+
+                for (TPsInspectionRainvalve item : list) {
+                    Row row = sheet.createRow(rowIndex);
+                    row.setHeight((short) 300);
+                    row.createCell(0).setCellValue(item.getPosition());
+                    row.createCell(1).setCellValue(item.getValveName());
+                    row.createCell(2).setCellValue("1".equals(item.getAppearance()) ? "✓" : item.getAppearance());
+                    row.createCell(3).setCellValue("1".equals(item.getNoLeak()) ? "✓" : item.getNoLeak());
+                    row.createCell(4).setCellValue(item.getCheckingStatus());
+                    for (int i = 0; i < 5; i++) {
+                        row.getCell(i).setCellStyle(originalStyle);
+                    }
+                    num++;
+                    rowIndex++;
+                }
+            }
+            // 检查人行
+            Row confirmerRow = sheet.createRow(rowIndex);
+            confirmerRow.setHeight((short) 800);
+            confirmerRow.createCell(0).setCellValue("检查人");
+            for (int i = 1; i < 5; i++) {
+                confirmerRow.createCell(i);
+            }
+            if (StringUtils.isNotEmpty(confirmerSignUrl))
+                ExcelUtils.insertPicture(wb, sheet, confirmerSignUrl, rowIndex, 2, 1, 1);
+            for (int i = 0; i < 5; i++) {
+                confirmerRow.getCell(i).setCellStyle(originalStyle);
+            }
+            sheet.addMergedRegion(new CellRangeAddress(rowIndex, rowIndex, 0, 1));
+            sheet.addMergedRegion(new CellRangeAddress(rowIndex, rowIndex, 2, 4));
+
+            // 说明
+            rowIndex++;
+            Row explanationRow1 = sheet.createRow(rowIndex);
+            explanationRow1.setHeight((short) 300);
+            explanationRow1.createCell(0).setCellValue("说明");
+            for (int i = 1; i < 5; i++) {
+                explanationRow1.createCell(i);
+            }
+            sheet.addMergedRegion(new CellRangeAddress(rowIndex, rowIndex, 0, 4));
+
+            rowIndex++;
+            Row explanationRow2 = sheet.createRow(rowIndex);
+            explanationRow2.setHeight((short) 300);
+            explanationRow2.createCell(0).setCellValue("1.检查频率为每月一次。");
+            for (int i = 1; i < 5; i++) {
+                explanationRow2.createCell(i);
+            }
+            sheet.addMergedRegion(new CellRangeAddress(rowIndex, rowIndex, 0, 4));
+
+            rowIndex++;
+            Row explanationRow3 = sheet.createRow(rowIndex);
+            explanationRow3.setHeight((short) 300);
+            explanationRow3.createCell(0).setCellValue("2.检查正常打「√」有不正常情况打「X」,并在备注中说明,包括整改结果。");
+            for (int i = 1; i < 5; i++) {
+                explanationRow3.createCell(i);
+            }
+            sheet.addMergedRegion(new CellRangeAddress(rowIndex, rowIndex, 0, 4));
+
+            rowIndex++;
+            Row explanationRow4 = sheet.createRow(rowIndex);
+            CellStyle wrapStyle = wb.createCellStyle();
+            wrapStyle.setWrapText(true);
+            Cell explanationCell4 = explanationRow4.createCell(0);
+            explanationCell4.setCellValue("3.检查内容:阀门外观是否正常,开关一次污水阀门检查是否有泄漏。");
+            explanationCell4.setCellStyle(wrapStyle);
+            for (int i = 1; i < 5; i++) {
+                explanationRow4.createCell(i).setCellStyle(wrapStyle);
+            }
+            sheet.addMergedRegion(new CellRangeAddress(rowIndex, rowIndex, 0, 4));
+
+            filename = "_污水雨排切换阀门" + dateStr + "检查记录.xlsx";
+            out = Files.newOutputStream(Paths.get(ExcelUtil.getAbsoluteFile(filename)));
+            wb.write(out);
+            wb.close();
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        return filename;
+    }
 }

+ 141 - 5
master/src/main/java/com/ruoyi/project/ps/inspection/controller/TPsInspectionSteamController.java

@@ -1,25 +1,40 @@
 package com.ruoyi.project.ps.inspection.controller;
 
 import com.ruoyi.common.utils.StringUtils;
+import com.ruoyi.common.utils.file.ExcelUtils;
 import com.ruoyi.common.utils.poi.ExcelUtil;
 import com.ruoyi.framework.aspectj.lang.annotation.Log;
 import com.ruoyi.framework.aspectj.lang.enums.BusinessType;
+import com.ruoyi.framework.config.RuoYiConfig;
 import com.ruoyi.framework.web.controller.BaseController;
 import com.ruoyi.framework.web.domain.AjaxResult;
 import com.ruoyi.framework.web.page.TableDataInfo;
+import com.ruoyi.project.common.domain.TCommonfile;
+import com.ruoyi.project.common.service.ITCommonfileService;
 import com.ruoyi.project.ps.inspection.domain.TPsInspectionSteam;
 import com.ruoyi.project.ps.inspection.service.ITPsInspectionSteamService;
 import com.ruoyi.project.ps.patrol.domain.TPsPatrolIssues;
 import com.ruoyi.project.ps.patrol.domain.TPsPatrolPlan;
 import com.ruoyi.project.ps.patrol.service.ITPsPatrolIssuesService;
 import com.ruoyi.project.ps.patrol.service.ITPsPatrolPlanService;
-import com.ruoyi.project.common.domain.TCommonfile;
-import com.ruoyi.project.common.service.ITCommonfileService;
+import com.ruoyi.project.system.domain.SysUser;
+import com.ruoyi.project.system.service.ISysUserService;
 import org.apache.commons.collections4.CollectionUtils;
+import org.apache.poi.ss.usermodel.Cell;
+import org.apache.poi.ss.usermodel.CellStyle;
+import org.apache.poi.ss.usermodel.Row;
+import org.apache.poi.ss.util.CellRangeAddress;
+import org.apache.poi.xssf.usermodel.XSSFSheet;
+import org.apache.poi.xssf.usermodel.XSSFWorkbook;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.web.bind.annotation.*;
 
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.nio.file.Files;
+import java.nio.file.Paths;
+import java.util.Calendar;
 import java.util.Date;
 import java.util.List;
 
@@ -44,6 +59,8 @@ public class TPsInspectionSteamController extends BaseController {
 
     @Autowired
     private ITCommonfileService tCommonfileService;
+    @Autowired
+    private ISysUserService sysUserService;
 
     /**
      * 查询消防蒸汽系统检查记录列表
@@ -63,9 +80,13 @@ public class TPsInspectionSteamController extends BaseController {
     @Log(title = "消防蒸汽系统检查记录", businessType = BusinessType.EXPORT)
     @GetMapping("/export")
     public AjaxResult export(TPsInspectionSteam tPsInspectionSteam) {
+        tPsInspectionSteam.setIssuesFlag(0L);
         List<TPsInspectionSteam> list = tPsInspectionSteamService.selectTPsInspectionSteamList(tPsInspectionSteam);
-        ExcelUtil<TPsInspectionSteam> util = new ExcelUtil<TPsInspectionSteam>(TPsInspectionSteam.class);
-        return util.exportExcel(list, "steam");
+        if (!list.isEmpty()) {
+            return AjaxResult.success(exportTmpl(list));
+        } else {
+            return AjaxResult.error("暂无可导出数据");
+        }
     }
 
     /**
@@ -82,7 +103,7 @@ public class TPsInspectionSteamController extends BaseController {
      */
     @GetMapping(value = "/info")
     public AjaxResult getInfoBySteamname(TPsInspectionSteam tPsInspectionSteam) {
-        if (tPsInspectionSteam.getId()!=null){
+        if (tPsInspectionSteam.getId() != null) {
             return AjaxResult.success(tPsInspectionSteamService.selectTPsInspectionSteamById(tPsInspectionSteam.getId()));
         }
         if (!"PS".equals(tPsInspectionSteam.getPlant())) {
@@ -223,4 +244,119 @@ public class TPsInspectionSteamController extends BaseController {
     public AjaxResult remove(@PathVariable Long[] ids) {
         return toAjax(tPsInspectionSteamService.deleteTPsInspectionSteamByIds(ids));
     }
+
+    public String exportTmpl(List<TPsInspectionSteam> list) {
+        OutputStream out;
+        String filename = null;
+        try {
+            String tempUrl = RuoYiConfig.getFilePath("/tempDoc/ps/steam.xlsx");
+            InputStream is = Files.newInputStream(Paths.get(tempUrl));
+            XSSFWorkbook wb = new XSSFWorkbook(is);
+            XSSFSheet sheet = wb.getSheetAt(0);
+            int rowIndex = 7;
+            int num = 1;
+            String dateStr = "";
+            String confirmerSignUrl = "";
+            Row row7 = sheet.getRow(rowIndex);
+            Cell originalcell = row7.getCell(0);
+            CellStyle originalStyle = originalcell.getCellStyle();
+            if (!list.isEmpty()) {
+                TPsInspectionSteam steam = list.get(0);
+                TPsPatrolPlan plan = tPsPatrolPlanService.selectTPsPatrolPlanById(steam.getPlanId());
+                dateStr = "_" + plan.getPlanYear() + "年_" + plan.getPlanMonth() + "月_";
+
+                Row row3 = sheet.getRow(3);
+                row3.getCell(0).setCellValue("年度:" + plan.getPlanYear() + " 年                       检查频率:1次/3月(检查月份月底完成)");
+
+                String r5c6Str = "检查时间:  月   日";
+                if (plan.getConfirmDate() != null && StringUtils.isNotEmpty(plan.getConfirmed())) {
+                    Calendar calendar = Calendar.getInstance();
+                    calendar.setTime(plan.getConfirmDate());
+                    r5c6Str = "检查时间:" + (calendar.get(Calendar.MONTH) + 1) + "月 " + calendar.get(Calendar.DAY_OF_MONTH) + "日";
+                    SysUser sysUser = sysUserService.selectUserById(Long.valueOf(plan.getConfirmed()));
+                    confirmerSignUrl = sysUser.getSignUrl();
+                }
+                Row row5 = sheet.getRow(4);
+                row5.getCell(2).setCellValue(r5c6Str);
+
+                for (TPsInspectionSteam item : list) {
+                    Row row = sheet.createRow(rowIndex);
+                    row.setHeight((short) 300);
+                    row.createCell(0).setCellValue(item.getPosition());
+                    row.createCell(1).setCellValue(item.getSteamName());
+                    row.createCell(2).setCellValue("1".equals(item.getFunctionalTest()) ? "✓" : item.getFunctionalTest());
+                    row.createCell(3).setCellValue("1".equals(item.getValveOk()) ? "✓" : item.getValveOk());
+                    row.createCell(4).setCellValue("1".equals(item.getDiscloseOk()) ? "✓" : item.getDiscloseOk());
+                    row.createCell(5).setCellValue("1".equals(item.getPressureTest()) ? "✓" : item.getPressureTest());
+                    for (int i = 0; i < 6; i++) {
+                        row.getCell(i).setCellStyle(originalStyle);
+                    }
+                    num++;
+                    rowIndex++;
+                }
+            }
+            // 检查人行
+            Row confirmerRow = sheet.createRow(rowIndex);
+            confirmerRow.setHeight((short) 800);
+            confirmerRow.createCell(0).setCellValue("检查人");
+            for (int i = 1; i < 6; i++) {
+                confirmerRow.createCell(i);
+            }
+            if (StringUtils.isNotEmpty(confirmerSignUrl))
+                ExcelUtils.insertPicture(wb, sheet, confirmerSignUrl, rowIndex, 2, 1, 1);
+            for (int i = 0; i < 6; i++) {
+                confirmerRow.getCell(i).setCellStyle(originalStyle);
+            }
+            sheet.addMergedRegion(new CellRangeAddress(rowIndex, rowIndex, 0, 1));
+            sheet.addMergedRegion(new CellRangeAddress(rowIndex, rowIndex, 2, 5));
+
+            // 说明
+            rowIndex++;
+            Row explanationRow1 = sheet.createRow(rowIndex);
+            explanationRow1.setHeight((short) 300);
+            explanationRow1.createCell(0).setCellValue("说明");
+            for (int i = 1; i < 6; i++) {
+                explanationRow1.createCell(i);
+            }
+            sheet.addMergedRegion(new CellRangeAddress(rowIndex, rowIndex, 0, 5));
+
+            rowIndex++;
+            Row explanationRow2 = sheet.createRow(rowIndex);
+            explanationRow2.setHeight((short) 300);
+            explanationRow2.createCell(0).setCellValue("1.检查频率为每3个月一次。");
+            for (int i = 1; i < 6; i++) {
+                explanationRow2.createCell(i);
+            }
+            sheet.addMergedRegion(new CellRangeAddress(rowIndex, rowIndex, 0, 5));
+
+            rowIndex++;
+            Row explanationRow3 = sheet.createRow(rowIndex);
+            explanationRow3.setHeight((short) 300);
+            explanationRow3.createCell(0).setCellValue("2.检查正常打「√」有不正常情况打「X」,并在备注中说明,包括整改结果。");
+            for (int i = 1; i < 6; i++) {
+                explanationRow3.createCell(i);
+            }
+            sheet.addMergedRegion(new CellRangeAddress(rowIndex, rowIndex, 0, 5));
+
+            rowIndex++;
+            Row explanationRow4 = sheet.createRow(rowIndex);
+            CellStyle wrapStyle = wb.createCellStyle();
+            wrapStyle.setWrapText(true);
+            Cell explanationCell4 = explanationRow4.createCell(0);
+            explanationCell4.setCellValue("3.检查内容:消防蒸汽系统功能完好,消防蒸汽阀门外观是否正常、是否有泄漏,每年第三季度做一次带压测试。");
+            explanationCell4.setCellStyle(wrapStyle);
+            for (int i = 1; i < 6; i++) {
+                explanationRow4.createCell(i).setCellStyle(wrapStyle);
+            }
+            sheet.addMergedRegion(new CellRangeAddress(rowIndex, rowIndex, 0, 5));
+
+            filename = "_消防蒸汽系统" + dateStr + "检查记录.xlsx";
+            out = Files.newOutputStream(Paths.get(ExcelUtil.getAbsoluteFile(filename)));
+            wb.write(out);
+            wb.close();
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        return filename;
+    }
 }

+ 142 - 5
master/src/main/java/com/ruoyi/project/ps/inspection/controller/TPsInspectionSumpController.java

@@ -1,25 +1,40 @@
 package com.ruoyi.project.ps.inspection.controller;
 
 import com.ruoyi.common.utils.StringUtils;
+import com.ruoyi.common.utils.file.ExcelUtils;
 import com.ruoyi.common.utils.poi.ExcelUtil;
 import com.ruoyi.framework.aspectj.lang.annotation.Log;
 import com.ruoyi.framework.aspectj.lang.enums.BusinessType;
+import com.ruoyi.framework.config.RuoYiConfig;
 import com.ruoyi.framework.web.controller.BaseController;
 import com.ruoyi.framework.web.domain.AjaxResult;
 import com.ruoyi.framework.web.page.TableDataInfo;
+import com.ruoyi.project.common.domain.TCommonfile;
+import com.ruoyi.project.common.service.ITCommonfileService;
 import com.ruoyi.project.ps.inspection.domain.TPsInspectionSump;
 import com.ruoyi.project.ps.inspection.service.ITPsInspectionSumpService;
 import com.ruoyi.project.ps.patrol.domain.TPsPatrolIssues;
 import com.ruoyi.project.ps.patrol.domain.TPsPatrolPlan;
 import com.ruoyi.project.ps.patrol.service.ITPsPatrolIssuesService;
 import com.ruoyi.project.ps.patrol.service.ITPsPatrolPlanService;
-import com.ruoyi.project.common.domain.TCommonfile;
-import com.ruoyi.project.common.service.ITCommonfileService;
+import com.ruoyi.project.system.domain.SysUser;
+import com.ruoyi.project.system.service.ISysUserService;
 import org.apache.commons.collections4.CollectionUtils;
+import org.apache.poi.ss.usermodel.Cell;
+import org.apache.poi.ss.usermodel.CellStyle;
+import org.apache.poi.ss.usermodel.Row;
+import org.apache.poi.ss.util.CellRangeAddress;
+import org.apache.poi.xssf.usermodel.XSSFSheet;
+import org.apache.poi.xssf.usermodel.XSSFWorkbook;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.web.bind.annotation.*;
 
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.nio.file.Files;
+import java.nio.file.Paths;
+import java.util.Calendar;
 import java.util.Date;
 import java.util.List;
 
@@ -44,6 +59,8 @@ public class TPsInspectionSumpController extends BaseController {
 
     @Autowired
     private ITCommonfileService tCommonfileService;
+    @Autowired
+    private ISysUserService sysUserService;
 
     /**
      * 查询雨排井检查记录列表
@@ -63,9 +80,13 @@ public class TPsInspectionSumpController extends BaseController {
     @Log(title = "雨排井检查记录", businessType = BusinessType.EXPORT)
     @GetMapping("/export")
     public AjaxResult export(TPsInspectionSump tPsInspectionSump) {
+        tPsInspectionSump.setIssuesFlag(0L);
         List<TPsInspectionSump> list = tPsInspectionSumpService.selectTPsInspectionSumpList(tPsInspectionSump);
-        ExcelUtil<TPsInspectionSump> util = new ExcelUtil<TPsInspectionSump>(TPsInspectionSump.class);
-        return util.exportExcel(list, "sump");
+        if (!list.isEmpty()) {
+            return AjaxResult.success(exportTmpl(list));
+        } else {
+            return AjaxResult.error("暂无可导出数据");
+        }
     }
 
     /**
@@ -82,7 +103,7 @@ public class TPsInspectionSumpController extends BaseController {
      */
     @GetMapping(value = "/info")
     public AjaxResult getInfoBySumpno(TPsInspectionSump tPsInspectionSump) {
-        if (tPsInspectionSump.getId()!=null){
+        if (tPsInspectionSump.getId() != null) {
             return AjaxResult.success(tPsInspectionSumpService.selectTPsInspectionSumpById(tPsInspectionSump.getId()));
         }
         if (!"PS".equals(tPsInspectionSump.getPlant())) {
@@ -223,4 +244,120 @@ public class TPsInspectionSumpController extends BaseController {
     public AjaxResult remove(@PathVariable Long[] ids) {
         return toAjax(tPsInspectionSumpService.deleteTPsInspectionSumpByIds(ids));
     }
+
+    public String exportTmpl(List<TPsInspectionSump> list) {
+        OutputStream out;
+        String filename = null;
+        try {
+            String tempUrl = RuoYiConfig.getFilePath("/tempDoc/ps/sump.xlsx");
+            InputStream is = Files.newInputStream(Paths.get(tempUrl));
+            XSSFWorkbook wb = new XSSFWorkbook(is);
+            XSSFSheet sheet = wb.getSheetAt(0);
+            int rowIndex = 7;
+            int num = 1;
+            String dateStr = "";
+            String confirmerSignUrl = "";
+            Row row7 = sheet.getRow(rowIndex);
+            Cell originalcell = row7.getCell(0);
+            CellStyle originalStyle = originalcell.getCellStyle();
+            if (!list.isEmpty()) {
+                TPsInspectionSump sump = list.get(0);
+                TPsPatrolPlan plan = tPsPatrolPlanService.selectTPsPatrolPlanById(sump.getPlanId());
+                dateStr = "_" + plan.getPlanYear() + "年_" + plan.getPlanMonth() + "月_";
+
+                Row row3 = sheet.getRow(3);
+                row3.getCell(0).setCellValue("年度:" + plan.getPlanYear() + " 年                       检查频率:1次/月(检查月份的月底前完成)");
+
+                String r5c6Str = "检查时间:  月   日";
+                if (plan.getConfirmDate() != null && StringUtils.isNotEmpty(plan.getConfirmed())) {
+                    Calendar calendar = Calendar.getInstance();
+                    calendar.setTime(plan.getConfirmDate());
+                    r5c6Str = "检查时间:" + (calendar.get(Calendar.MONTH) + 1) + "月 " + calendar.get(Calendar.DAY_OF_MONTH) + "日";
+                    SysUser sysUser = sysUserService.selectUserById(Long.valueOf(plan.getConfirmed()));
+                    confirmerSignUrl = sysUser.getSignUrl();
+                }
+                Row row5 = sheet.getRow(4);
+                row5.getCell(3).setCellValue(r5c6Str);
+
+                for (TPsInspectionSump item : list) {
+                    Row row = sheet.createRow(rowIndex);
+                    row.setHeight((short) 300);
+                    row.createCell(0).setCellValue(num);
+                    row.createCell(1).setCellValue(item.getPosition());
+                    row.createCell(2).setCellValue(item.getSumpNo());
+                    row.createCell(3).setCellValue("1".equals(item.getAroundSump()) ? "✓" : item.getAroundSump());
+                    row.createCell(4).setCellValue("1".equals(item.getManholeCover()) ? "✓" : item.getManholeCover());
+                    row.createCell(5).setCellValue("1".equals(item.getInsideSump()) ? "✓" : item.getInsideSump());
+                    row.createCell(6).setCellValue("1".equals(item.getBoxPad()) ? "✓" : item.getBoxPad());
+                    for (int i = 0; i < 7; i++) {
+                        row.getCell(i).setCellStyle(originalStyle);
+                    }
+                    num++;
+                    rowIndex++;
+                }
+            }
+            // 检查人行
+            Row confirmerRow = sheet.createRow(rowIndex);
+            confirmerRow.setHeight((short) 800);
+            confirmerRow.createCell(0).setCellValue("检查人");
+            for (int i = 1; i < 7; i++) {
+                confirmerRow.createCell(i);
+            }
+            if (StringUtils.isNotEmpty(confirmerSignUrl))
+                ExcelUtils.insertPicture(wb, sheet, confirmerSignUrl, rowIndex, 3, 1, 1);
+            for (int i = 0; i < 7; i++) {
+                confirmerRow.getCell(i).setCellStyle(originalStyle);
+            }
+            sheet.addMergedRegion(new CellRangeAddress(rowIndex, rowIndex, 0, 2));
+            sheet.addMergedRegion(new CellRangeAddress(rowIndex, rowIndex, 3, 6));
+
+            // 说明
+            rowIndex++;
+            Row explanationRow1 = sheet.createRow(rowIndex);
+            explanationRow1.setHeight((short) 300);
+            explanationRow1.createCell(0).setCellValue("说明");
+            for (int i = 1; i < 7; i++) {
+                explanationRow1.createCell(i);
+            }
+            sheet.addMergedRegion(new CellRangeAddress(rowIndex, rowIndex, 0, 6));
+
+            rowIndex++;
+            Row explanationRow2 = sheet.createRow(rowIndex);
+            explanationRow2.setHeight((short) 300);
+            explanationRow2.createCell(0).setCellValue("1.检查频率为每月一次。");
+            for (int i = 1; i < 7; i++) {
+                explanationRow2.createCell(i);
+            }
+            sheet.addMergedRegion(new CellRangeAddress(rowIndex, rowIndex, 0, 6));
+
+            rowIndex++;
+            Row explanationRow3 = sheet.createRow(rowIndex);
+            explanationRow3.setHeight((short) 300);
+            explanationRow3.createCell(0).setCellValue("2.检查正常打「√」有不正常情况打「X」,并在备注中说明,包括整改结果。");
+            for (int i = 1; i < 7; i++) {
+                explanationRow3.createCell(i);
+            }
+            sheet.addMergedRegion(new CellRangeAddress(rowIndex, rowIndex, 0, 6));
+
+            rowIndex++;
+            Row explanationRow4 = sheet.createRow(rowIndex);
+            CellStyle wrapStyle = wb.createCellStyle();
+            wrapStyle.setWrapText(true);
+            Cell explanationCell4 = explanationRow4.createCell(0);
+            explanationCell4.setCellValue("3.检查内容:现场地井周围地面是否有破损,现场地井井盖是否破损,现场地井内是否干净无杂物,沙箱和地势内物品齐全。");
+            explanationCell4.setCellStyle(wrapStyle);
+            for (int i = 1; i < 7; i++) {
+                explanationRow4.createCell(i).setCellStyle(wrapStyle);
+            }
+            sheet.addMergedRegion(new CellRangeAddress(rowIndex, rowIndex, 0, 6));
+
+            filename = "_雨排井" + dateStr + "检查记录.xlsx";
+            out = Files.newOutputStream(Paths.get(ExcelUtil.getAbsoluteFile(filename)));
+            wb.write(out);
+            wb.close();
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        return filename;
+    }
 }

+ 143 - 5
master/src/main/java/com/ruoyi/project/ps/inspection/controller/TPsInspectionUtilitystationController.java

@@ -1,25 +1,40 @@
 package com.ruoyi.project.ps.inspection.controller;
 
 import com.ruoyi.common.utils.StringUtils;
+import com.ruoyi.common.utils.file.ExcelUtils;
 import com.ruoyi.common.utils.poi.ExcelUtil;
 import com.ruoyi.framework.aspectj.lang.annotation.Log;
 import com.ruoyi.framework.aspectj.lang.enums.BusinessType;
+import com.ruoyi.framework.config.RuoYiConfig;
 import com.ruoyi.framework.web.controller.BaseController;
 import com.ruoyi.framework.web.domain.AjaxResult;
 import com.ruoyi.framework.web.page.TableDataInfo;
+import com.ruoyi.project.common.domain.TCommonfile;
+import com.ruoyi.project.common.service.ITCommonfileService;
 import com.ruoyi.project.ps.inspection.domain.TPsInspectionUtilitystation;
 import com.ruoyi.project.ps.inspection.service.ITPsInspectionUtilitystationService;
 import com.ruoyi.project.ps.patrol.domain.TPsPatrolIssues;
 import com.ruoyi.project.ps.patrol.domain.TPsPatrolPlan;
 import com.ruoyi.project.ps.patrol.service.ITPsPatrolIssuesService;
 import com.ruoyi.project.ps.patrol.service.ITPsPatrolPlanService;
-import com.ruoyi.project.common.domain.TCommonfile;
-import com.ruoyi.project.common.service.ITCommonfileService;
+import com.ruoyi.project.system.domain.SysUser;
+import com.ruoyi.project.system.service.ISysUserService;
 import org.apache.commons.collections4.CollectionUtils;
+import org.apache.poi.ss.usermodel.Cell;
+import org.apache.poi.ss.usermodel.CellStyle;
+import org.apache.poi.ss.usermodel.Row;
+import org.apache.poi.ss.util.CellRangeAddress;
+import org.apache.poi.xssf.usermodel.XSSFSheet;
+import org.apache.poi.xssf.usermodel.XSSFWorkbook;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.web.bind.annotation.*;
 
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.nio.file.Files;
+import java.nio.file.Paths;
+import java.util.Calendar;
 import java.util.Date;
 import java.util.List;
 
@@ -44,6 +59,8 @@ public class TPsInspectionUtilitystationController extends BaseController {
 
     @Autowired
     private ITCommonfileService tCommonfileService;
+    @Autowired
+    private ISysUserService sysUserService;
 
     /**
      * 查询公用站检查记录列表
@@ -63,9 +80,13 @@ public class TPsInspectionUtilitystationController extends BaseController {
     @Log(title = "公用站检查记录", businessType = BusinessType.EXPORT)
     @GetMapping("/export")
     public AjaxResult export(TPsInspectionUtilitystation tPsInspectionUtilitystation) {
+        tPsInspectionUtilitystation.setIssuesFlag(0L);
         List<TPsInspectionUtilitystation> list = tPsInspectionUtilitystationService.selectTPsInspectionUtilitystationList(tPsInspectionUtilitystation);
-        ExcelUtil<TPsInspectionUtilitystation> util = new ExcelUtil<TPsInspectionUtilitystation>(TPsInspectionUtilitystation.class);
-        return util.exportExcel(list, "utilitystation");
+        if (!list.isEmpty()) {
+            return AjaxResult.success(exportTmpl(list));
+        } else {
+            return AjaxResult.error("暂无可导出数据");
+        }
     }
 
     /**
@@ -82,7 +103,7 @@ public class TPsInspectionUtilitystationController extends BaseController {
      */
     @GetMapping(value = "/info")
     public AjaxResult getInfoByUtilitystationname(TPsInspectionUtilitystation tPsInspectionUtilitystation) {
-        if (tPsInspectionUtilitystation.getId()!=null){
+        if (tPsInspectionUtilitystation.getId() != null) {
             return AjaxResult.success(tPsInspectionUtilitystationService.selectTPsInspectionUtilitystationById(tPsInspectionUtilitystation.getId()));
         }
         if (!"PS".equals(tPsInspectionUtilitystation.getPlant())) {
@@ -224,4 +245,121 @@ public class TPsInspectionUtilitystationController extends BaseController {
     public AjaxResult remove(@PathVariable Long[] ids) {
         return toAjax(tPsInspectionUtilitystationService.deleteTPsInspectionUtilitystationByIds(ids));
     }
+
+    public String exportTmpl(List<TPsInspectionUtilitystation> list) {
+        OutputStream out;
+        String filename = null;
+        try {
+            String tempUrl = RuoYiConfig.getFilePath("/tempDoc/ps/utilitystation.xlsx");
+            InputStream is = Files.newInputStream(Paths.get(tempUrl));
+            XSSFWorkbook wb = new XSSFWorkbook(is);
+            XSSFSheet sheet = wb.getSheetAt(0);
+            int rowIndex = 6;
+            int num = 1;
+            String dateStr = "";
+            String confirmerSignUrl = "";
+            Row row6 = sheet.getRow(rowIndex);
+            Cell originalcell = row6.getCell(0);
+            CellStyle originalStyle = originalcell.getCellStyle();
+            if (!list.isEmpty()) {
+                TPsInspectionUtilitystation utilitystation = list.get(0);
+                TPsPatrolPlan plan = tPsPatrolPlanService.selectTPsPatrolPlanById(utilitystation.getPlanId());
+                dateStr = "_" + plan.getPlanYear() + "年_" + plan.getPlanMonth() + "月_";
+
+                Row row3 = sheet.getRow(2);
+                row3.getCell(0).setCellValue("年度:" + plan.getPlanYear() + " 年                       检查周期:1次/月(月底前完成)");
+
+                String r5c7Str = "检查时间:  月   日";
+                if (plan.getConfirmDate() != null && StringUtils.isNotEmpty(plan.getConfirmed())) {
+                    Calendar calendar = Calendar.getInstance();
+                    calendar.setTime(plan.getConfirmDate());
+                    r5c7Str = "检查时间:" + (calendar.get(Calendar.MONTH) + 1) + "月 " + calendar.get(Calendar.DAY_OF_MONTH) + "日";
+                    SysUser sysUser = sysUserService.selectUserById(Long.valueOf(plan.getConfirmed()));
+                    confirmerSignUrl = sysUser.getSignUrl();
+                }
+                Row row5 = sheet.getRow(3);
+                row5.getCell(3).setCellValue(r5c7Str);
+
+                for (TPsInspectionUtilitystation item : list) {
+                    Row row = sheet.createRow(rowIndex);
+                    row.setHeight((short) 300);
+                    row.createCell(0).setCellValue(num);
+                    row.createCell(1).setCellValue(item.getPosition());
+                    row.createCell(2).setCellValue(item.getUtilityStationName());
+                    row.createCell(3).setCellValue("1".equals(item.getNoLeak()) ? "✓" : item.getNoLeak());
+                    row.createCell(4).setCellValue("1".equals(item.getValveStatus()) ? "✓" : item.getValveStatus());
+                    row.createCell(5).setCellValue("1".equals(item.getQuickConnectCoupling()) ? "✓" : item.getQuickConnectCoupling());
+                    row.createCell(6).setCellValue("1".equals(item.getHoseOk()) ? "✓" : item.getHoseOk());
+                    row.createCell(7).setCellValue("1".equals(item.getHoseNodamage()) ? "✓" : item.getHoseNodamage());
+                    for (int i = 0; i < 8; i++) {
+                        row.getCell(i).setCellStyle(originalStyle);
+                    }
+                    num++;
+                    rowIndex++;
+                }
+            }
+            // 检查人行
+            Row confirmerRow = sheet.createRow(rowIndex);
+            confirmerRow.setHeight((short) 800);
+            confirmerRow.createCell(0).setCellValue("检查人");
+            for (int i = 1; i < 8; i++) {
+                confirmerRow.createCell(i);
+            }
+            if (StringUtils.isNotEmpty(confirmerSignUrl))
+                ExcelUtils.insertPicture(wb, sheet, confirmerSignUrl, rowIndex, 3, 1, 1);
+            for (int i = 0; i < 8; i++) {
+                confirmerRow.getCell(i).setCellStyle(originalStyle);
+            }
+            sheet.addMergedRegion(new CellRangeAddress(rowIndex, rowIndex, 0, 2));
+            sheet.addMergedRegion(new CellRangeAddress(rowIndex, rowIndex, 3, 7));
+
+            // 说明
+            rowIndex++;
+            Row explanationRow1 = sheet.createRow(rowIndex);
+            explanationRow1.setHeight((short) 300);
+            explanationRow1.createCell(0).setCellValue("说明");
+            for (int i = 1; i < 8; i++) {
+                explanationRow1.createCell(i);
+            }
+            sheet.addMergedRegion(new CellRangeAddress(rowIndex, rowIndex, 0, 7));
+
+            rowIndex++;
+            Row explanationRow2 = sheet.createRow(rowIndex);
+            explanationRow2.setHeight((short) 300);
+            explanationRow2.createCell(0).setCellValue("1.检查频率为每月一次。");
+            for (int i = 1; i < 8; i++) {
+                explanationRow2.createCell(i);
+            }
+            sheet.addMergedRegion(new CellRangeAddress(rowIndex, rowIndex, 0, 7));
+
+            rowIndex++;
+            Row explanationRow3 = sheet.createRow(rowIndex);
+            explanationRow3.setHeight((short) 300);
+            explanationRow3.createCell(0).setCellValue("2.检查正常打「√」有不正常情况打「X」,并在备注中说明,包括整改结果。");
+            for (int i = 1; i < 8; i++) {
+                explanationRow3.createCell(i);
+            }
+            sheet.addMergedRegion(new CellRangeAddress(rowIndex, rowIndex, 0, 7));
+
+            rowIndex++;
+            Row explanationRow4 = sheet.createRow(rowIndex);
+            CellStyle wrapStyle = wb.createCellStyle();
+            wrapStyle.setWrapText(true);
+            Cell explanationCell4 = explanationRow4.createCell(0);
+            explanationCell4.setCellValue("3.检查内容:现场公用站有无泄漏,现场公用站阀门是否完好,快速接头是否完好,现场公用站胶皮管是否是否破损,胶皮管两端快速接头完好,现场公用站胶皮管是否盘好。");
+            explanationCell4.setCellStyle(wrapStyle);
+            for (int i = 1; i < 8; i++) {
+                explanationRow4.createCell(i).setCellStyle(wrapStyle);
+            }
+            sheet.addMergedRegion(new CellRangeAddress(rowIndex, rowIndex, 0, 7));
+
+            filename = "_公用站" + dateStr + "检查记录.xlsx";
+            out = Files.newOutputStream(Paths.get(ExcelUtil.getAbsoluteFile(filename)));
+            wb.write(out);
+            wb.close();
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        return filename;
+    }
 }

+ 142 - 5
master/src/main/java/com/ruoyi/project/ps/inspection/controller/TPsInspectionVentvalveController.java

@@ -1,25 +1,40 @@
 package com.ruoyi.project.ps.inspection.controller;
 
 import com.ruoyi.common.utils.StringUtils;
+import com.ruoyi.common.utils.file.ExcelUtils;
 import com.ruoyi.common.utils.poi.ExcelUtil;
 import com.ruoyi.framework.aspectj.lang.annotation.Log;
 import com.ruoyi.framework.aspectj.lang.enums.BusinessType;
+import com.ruoyi.framework.config.RuoYiConfig;
 import com.ruoyi.framework.web.controller.BaseController;
 import com.ruoyi.framework.web.domain.AjaxResult;
 import com.ruoyi.framework.web.page.TableDataInfo;
+import com.ruoyi.project.common.domain.TCommonfile;
+import com.ruoyi.project.common.service.ITCommonfileService;
 import com.ruoyi.project.ps.inspection.domain.TPsInspectionVentvalve;
 import com.ruoyi.project.ps.inspection.service.ITPsInspectionVentvalveService;
 import com.ruoyi.project.ps.patrol.domain.TPsPatrolIssues;
 import com.ruoyi.project.ps.patrol.domain.TPsPatrolPlan;
 import com.ruoyi.project.ps.patrol.service.ITPsPatrolIssuesService;
 import com.ruoyi.project.ps.patrol.service.ITPsPatrolPlanService;
-import com.ruoyi.project.common.domain.TCommonfile;
-import com.ruoyi.project.common.service.ITCommonfileService;
+import com.ruoyi.project.system.domain.SysUser;
+import com.ruoyi.project.system.service.ISysUserService;
 import org.apache.commons.collections4.CollectionUtils;
+import org.apache.poi.ss.usermodel.Cell;
+import org.apache.poi.ss.usermodel.CellStyle;
+import org.apache.poi.ss.usermodel.Row;
+import org.apache.poi.ss.util.CellRangeAddress;
+import org.apache.poi.xssf.usermodel.XSSFSheet;
+import org.apache.poi.xssf.usermodel.XSSFWorkbook;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.web.bind.annotation.*;
 
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.nio.file.Files;
+import java.nio.file.Paths;
+import java.util.Calendar;
 import java.util.Date;
 import java.util.List;
 
@@ -44,6 +59,8 @@ public class TPsInspectionVentvalveController extends BaseController {
 
     @Autowired
     private ITCommonfileService tCommonfileService;
+    @Autowired
+    private ISysUserService sysUserService;
 
     /**
      * 查询余压阀检查记录列表
@@ -63,9 +80,13 @@ public class TPsInspectionVentvalveController extends BaseController {
     @Log(title = "余压阀检查记录", businessType = BusinessType.EXPORT)
     @GetMapping("/export")
     public AjaxResult export(TPsInspectionVentvalve tPsInspectionVentvalve) {
+        tPsInspectionVentvalve.setIssuesFlag(0L);
         List<TPsInspectionVentvalve> list = tPsInspectionVentvalveService.selectTPsInspectionVentvalveList(tPsInspectionVentvalve);
-        ExcelUtil<TPsInspectionVentvalve> util = new ExcelUtil<TPsInspectionVentvalve>(TPsInspectionVentvalve.class);
-        return util.exportExcel(list, "ventvalve");
+        if (!list.isEmpty()) {
+            return AjaxResult.success(exportTmpl(list));
+        } else {
+            return AjaxResult.error("暂无可导出数据");
+        }
     }
 
     /**
@@ -82,7 +103,7 @@ public class TPsInspectionVentvalveController extends BaseController {
      */
     @GetMapping(value = "/info")
     public AjaxResult getInfoByVentvalveno(TPsInspectionVentvalve tPsInspectionVentvalve) {
-        if (tPsInspectionVentvalve.getId()!=null){
+        if (tPsInspectionVentvalve.getId() != null) {
             return AjaxResult.success(tPsInspectionVentvalveService.selectTPsInspectionVentvalveById(tPsInspectionVentvalve.getId()));
         }
         if (!"PS".equals(tPsInspectionVentvalve.getPlant())) {
@@ -223,4 +244,120 @@ public class TPsInspectionVentvalveController extends BaseController {
     public AjaxResult remove(@PathVariable Long[] ids) {
         return toAjax(tPsInspectionVentvalveService.deleteTPsInspectionVentvalveByIds(ids));
     }
+
+    public String exportTmpl(List<TPsInspectionVentvalve> list) {
+        OutputStream out;
+        String filename = null;
+        try {
+            String tempUrl = RuoYiConfig.getFilePath("/tempDoc/ps/ventvalve.xlsx");
+            InputStream is = Files.newInputStream(Paths.get(tempUrl));
+            XSSFWorkbook wb = new XSSFWorkbook(is);
+            XSSFSheet sheet = wb.getSheetAt(0);
+            int rowIndex = 7;
+            int num = 1;
+            String dateStr = "";
+            String confirmerSignUrl = "";
+            Row row7 = sheet.getRow(rowIndex);
+            Cell originalcell = row7.getCell(0);
+            CellStyle originalStyle = originalcell.getCellStyle();
+            if (!list.isEmpty()) {
+                TPsInspectionVentvalve ventvalve = list.get(0);
+                TPsPatrolPlan plan = tPsPatrolPlanService.selectTPsPatrolPlanById(ventvalve.getPlanId());
+                dateStr = "_" + plan.getPlanYear() + "年_" + plan.getPlanMonth() + "月_";
+
+                Row row3 = sheet.getRow(3);
+                row3.getCell(0).setCellValue("年度:" + plan.getPlanYear() + " 年                       检查周期:1次/月(月底前完成)");
+
+                String r5c7Str = "检查时间:  月   日";
+                if (plan.getConfirmDate() != null && StringUtils.isNotEmpty(plan.getConfirmed())) {
+                    Calendar calendar = Calendar.getInstance();
+                    calendar.setTime(plan.getConfirmDate());
+                    r5c7Str = "检查时间:" + (calendar.get(Calendar.MONTH) + 1) + "月 " + calendar.get(Calendar.DAY_OF_MONTH) + "日";
+                    SysUser sysUser = sysUserService.selectUserById(Long.valueOf(plan.getConfirmed()));
+                    confirmerSignUrl = sysUser.getSignUrl();
+                }
+                Row row5 = sheet.getRow(4);
+                row5.getCell(3).setCellValue(r5c7Str);
+
+                for (TPsInspectionVentvalve item : list) {
+                    Row row = sheet.createRow(rowIndex);
+                    row.setHeight((short) 300);
+                    row.createCell(0).setCellValue(num);
+                    row.createCell(1).setCellValue(item.getPosition());
+                    row.createCell(2).setCellValue(item.getVentvalveNo());
+                    row.createCell(3).setCellValue("1".equals(item.getAppearance()) ? "✓" : item.getAppearance());
+                    row.createCell(4).setCellValue("1".equals(item.getSeamless()) ? "✓" : item.getSeamless());
+                    row.createCell(5).setCellValue("1".equals(item.getFunctionalTest()) ? "✓" : item.getFunctionalTest());
+                    row.createCell(6).setCellValue("1".equals(item.getNoBlock()) ? "✓" : item.getNoBlock());
+                    for (int i = 0; i < 7; i++) {
+                        row.getCell(i).setCellStyle(originalStyle);
+                    }
+                    num++;
+                    rowIndex++;
+                }
+            }
+            // 检查人行
+            Row confirmerRow = sheet.createRow(rowIndex);
+            confirmerRow.setHeight((short) 800);
+            confirmerRow.createCell(0).setCellValue("检查人");
+            for (int i = 1; i < 7; i++) {
+                confirmerRow.createCell(i);
+            }
+            if (StringUtils.isNotEmpty(confirmerSignUrl))
+                ExcelUtils.insertPicture(wb, sheet, confirmerSignUrl, rowIndex, 3, 1, 1);
+            for (int i = 0; i < 7; i++) {
+                confirmerRow.getCell(i).setCellStyle(originalStyle);
+            }
+            sheet.addMergedRegion(new CellRangeAddress(rowIndex, rowIndex, 0, 2));
+            sheet.addMergedRegion(new CellRangeAddress(rowIndex, rowIndex, 3, 6));
+
+            // 说明
+            rowIndex++;
+            Row explanationRow1 = sheet.createRow(rowIndex);
+            explanationRow1.setHeight((short) 300);
+            explanationRow1.createCell(0).setCellValue("说明");
+            for (int i = 1; i < 7; i++) {
+                explanationRow1.createCell(i);
+            }
+            sheet.addMergedRegion(new CellRangeAddress(rowIndex, rowIndex, 0, 6));
+
+            rowIndex++;
+            Row explanationRow2 = sheet.createRow(rowIndex);
+            explanationRow2.setHeight((short) 300);
+            explanationRow2.createCell(0).setCellValue("1.检查频率为每月一次。");
+            for (int i = 1; i < 7; i++) {
+                explanationRow2.createCell(i);
+            }
+            sheet.addMergedRegion(new CellRangeAddress(rowIndex, rowIndex, 0, 6));
+
+            rowIndex++;
+            Row explanationRow3 = sheet.createRow(rowIndex);
+            explanationRow3.setHeight((short) 300);
+            explanationRow3.createCell(0).setCellValue("2.检查正常打「√」有不正常情况打「X」,并在备注中说明,包括整改结果。");
+            for (int i = 1; i < 7; i++) {
+                explanationRow3.createCell(i);
+            }
+            sheet.addMergedRegion(new CellRangeAddress(rowIndex, rowIndex, 0, 6));
+
+            rowIndex++;
+            Row explanationRow4 = sheet.createRow(rowIndex);
+            CellStyle wrapStyle = wb.createCellStyle();
+            wrapStyle.setWrapText(true);
+            Cell explanationCell4 = explanationRow4.createCell(0);
+            explanationCell4.setCellValue("3.检查内容:现场余压阀外观是否正常,现场余压阀周围与墙体有无裂缝,现场余压阀开关是否正常,现场余压阀排气口有无杂物堵塞。");
+            explanationCell4.setCellStyle(wrapStyle);
+            for (int i = 1; i < 7; i++) {
+                explanationRow4.createCell(i).setCellStyle(wrapStyle);
+            }
+            sheet.addMergedRegion(new CellRangeAddress(rowIndex, rowIndex, 0, 6));
+
+            filename = "_余压阀" + dateStr + "检查记录.xlsx";
+            out = Files.newOutputStream(Paths.get(ExcelUtil.getAbsoluteFile(filename)));
+            wb.write(out);
+            wb.close();
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        return filename;
+    }
 }

+ 163 - 7
master/src/main/java/com/ruoyi/project/ps/inspection/controller/TPsInspectionWardrobeController.java

@@ -1,25 +1,40 @@
 package com.ruoyi.project.ps.inspection.controller;
 
 import com.ruoyi.common.utils.StringUtils;
+import com.ruoyi.common.utils.file.ExcelUtils;
 import com.ruoyi.common.utils.poi.ExcelUtil;
 import com.ruoyi.framework.aspectj.lang.annotation.Log;
 import com.ruoyi.framework.aspectj.lang.enums.BusinessType;
+import com.ruoyi.framework.config.RuoYiConfig;
 import com.ruoyi.framework.web.controller.BaseController;
 import com.ruoyi.framework.web.domain.AjaxResult;
 import com.ruoyi.framework.web.page.TableDataInfo;
+import com.ruoyi.project.common.domain.TCommonfile;
+import com.ruoyi.project.common.service.ITCommonfileService;
 import com.ruoyi.project.ps.inspection.domain.TPsInspectionWardrobe;
 import com.ruoyi.project.ps.inspection.service.ITPsInspectionWardrobeService;
 import com.ruoyi.project.ps.patrol.domain.TPsPatrolIssues;
 import com.ruoyi.project.ps.patrol.domain.TPsPatrolPlan;
 import com.ruoyi.project.ps.patrol.service.ITPsPatrolIssuesService;
 import com.ruoyi.project.ps.patrol.service.ITPsPatrolPlanService;
-import com.ruoyi.project.common.domain.TCommonfile;
-import com.ruoyi.project.common.service.ITCommonfileService;
+import com.ruoyi.project.system.domain.SysUser;
+import com.ruoyi.project.system.service.ISysUserService;
 import org.apache.commons.collections4.CollectionUtils;
+import org.apache.poi.ss.usermodel.Cell;
+import org.apache.poi.ss.usermodel.CellStyle;
+import org.apache.poi.ss.usermodel.Row;
+import org.apache.poi.ss.util.CellRangeAddress;
+import org.apache.poi.xssf.usermodel.XSSFSheet;
+import org.apache.poi.xssf.usermodel.XSSFWorkbook;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.web.bind.annotation.*;
 
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.nio.file.Files;
+import java.nio.file.Paths;
+import java.util.Calendar;
 import java.util.Date;
 import java.util.List;
 
@@ -43,6 +58,8 @@ public class TPsInspectionWardrobeController extends BaseController {
 
     @Autowired
     private ITCommonfileService tCommonfileService;
+    @Autowired
+    private ISysUserService sysUserService;
 
     /**
      * 查询应急物资柜列表
@@ -62,9 +79,13 @@ public class TPsInspectionWardrobeController extends BaseController {
     @Log(title = "应急物资柜", businessType = BusinessType.EXPORT)
     @GetMapping("/export")
     public AjaxResult export(TPsInspectionWardrobe tPsInspectionWardrobe) {
+        tPsInspectionWardrobe.setIssuesFlag(0L);
         List<TPsInspectionWardrobe> list = tPsInspectionWardrobeService.selectTPsInspectionWardrobeList(tPsInspectionWardrobe);
-        ExcelUtil<TPsInspectionWardrobe> util = new ExcelUtil<TPsInspectionWardrobe>(TPsInspectionWardrobe.class);
-        return util.exportExcel(list, "wardrobe");
+        if (!list.isEmpty()) {
+            return AjaxResult.success(exportTmpl(list));
+        } else {
+            return AjaxResult.error("暂无可导出数据");
+        }
     }
 
     /**
@@ -81,7 +102,7 @@ public class TPsInspectionWardrobeController extends BaseController {
      */
     @GetMapping(value = "/info")
     public AjaxResult getInfoByPpeType(TPsInspectionWardrobe tPsInspectionWardrobe) {
-        if (tPsInspectionWardrobe.getId()!=null){
+        if (tPsInspectionWardrobe.getId() != null) {
             return AjaxResult.success(tPsInspectionWardrobeService.selectTPsInspectionWardrobeById(tPsInspectionWardrobe.getId()));
         }
         if (!"PS".equals(tPsInspectionWardrobe.getPlant())) {
@@ -93,9 +114,9 @@ public class TPsInspectionWardrobeController extends BaseController {
         TPsInspectionWardrobe item = new TPsInspectionWardrobe();
         item.setPlanId(tPsInspectionWardrobe.getPlanId());
         item.setPpeType(tPsInspectionWardrobe.getPpeType());
-        if (StringUtils.isNotEquals(tPsInspectionWardrobe.getWardrobeType())&&tPsInspectionWardrobe.getWardrobeType().contains("应急物资柜")){
+        if (StringUtils.isNotEquals(tPsInspectionWardrobe.getWardrobeType()) && tPsInspectionWardrobe.getWardrobeType().contains("应急物资柜")) {
             item.setWardrobeType(tPsInspectionWardrobe.getPpeType().replace("应急物资柜", "").trim());
-        }else{
+        } else {
             return AjaxResult.error("未知的应急物资柜类型!请联系管理员!");
         }
         item.setIssuesFlag(0L);
@@ -224,4 +245,139 @@ public class TPsInspectionWardrobeController extends BaseController {
     public AjaxResult remove(@PathVariable Long[] ids) {
         return toAjax(tPsInspectionWardrobeService.deleteTPsInspectionWardrobeByIds(ids));
     }
+
+    public String exportTmpl(List<TPsInspectionWardrobe> list) {
+        OutputStream out;
+        String filename = null;
+        try {
+            String tempUrl = RuoYiConfig.getFilePath("/tempDoc/ps/wardrobe.xlsx");
+            InputStream is = Files.newInputStream(Paths.get(tempUrl));
+            XSSFWorkbook wb = new XSSFWorkbook(is);
+            XSSFSheet sheet = wb.getSheetAt(0);
+            int rowIndex = 6;
+            int num = 1;
+            String dateStr = "";
+            String confirmerSignUrl = "";
+            Row row6 = sheet.getRow(rowIndex);
+            Cell originalcell = row6.getCell(0);
+            CellStyle originalStyle = originalcell.getCellStyle();
+            if (!list.isEmpty()) {
+                TPsInspectionWardrobe wardrobe = list.get(0);
+                TPsPatrolPlan plan = tPsPatrolPlanService.selectTPsPatrolPlanById(wardrobe.getPlanId());
+                dateStr = "_" + plan.getPlanYear() + "年_" + plan.getPlanMonth() + "月_";
+
+                Row row3 = sheet.getRow(3);
+                row3.getCell(0).setCellValue("年度:" + plan.getPlanYear() + " 年");
+
+                String r5c7Str = "检查时间:  月   日";
+                if (plan.getConfirmDate() != null && StringUtils.isNotEmpty(plan.getConfirmed())) {
+                    Calendar calendar = Calendar.getInstance();
+                    calendar.setTime(plan.getConfirmDate());
+                    r5c7Str = "检查时间:" + (calendar.get(Calendar.MONTH) + 1) + "月 " + calendar.get(Calendar.DAY_OF_MONTH) + "日";
+                    SysUser sysUser = sysUserService.selectUserById(Long.valueOf(plan.getConfirmed()));
+                    confirmerSignUrl = sysUser.getSignUrl();
+                }
+                Row row5 = sheet.getRow(4);
+                row5.getCell(6).setCellValue(r5c7Str);
+
+                for (TPsInspectionWardrobe item : list) {
+                    Row row = sheet.createRow(rowIndex);
+                    row.setHeight((short) 300);
+                    row.createCell(0).setCellValue(num);
+                    row.createCell(1).setCellValue(item.getPpeType());
+                    row.createCell(2).setCellValue("1".equals(item.getComplete()) ? "✓" : item.getComplete());
+                    row.createCell(3).setCellValue("1".equals(item.getIntact()) ? "✓" : item.getIntact());
+                    row.createCell(4).setCellValue("1".equals(item.getPlacement()) ? "✓" : item.getPlacement());
+                    row.createCell(5).setCellValue("1".equals(item.getValidity()) ? "✓" : item.getValidity());
+                    row.createCell(6).setCellValue("1".equals(item.getInspectiontag()) ? "✓" : item.getInspectiontag());
+                    for (int i = 0; i < 7; i++) {
+                        row.getCell(i).setCellStyle(originalStyle);
+                    }
+                    num++;
+                    rowIndex++;
+                }
+            }
+            // 检查人行
+            Row confirmerRow = sheet.createRow(rowIndex);
+            confirmerRow.setHeight((short) 800);
+            confirmerRow.createCell(0).setCellValue("检查人");
+            for (int i = 1; i < 7; i++) {
+                confirmerRow.createCell(i);
+            }
+            if (StringUtils.isNotEmpty(confirmerSignUrl))
+                ExcelUtils.insertPicture(wb, sheet, confirmerSignUrl, rowIndex, 3, 1, 1);
+            for (int i = 0; i < 7; i++) {
+                confirmerRow.getCell(i).setCellStyle(originalStyle);
+            }
+            sheet.addMergedRegion(new CellRangeAddress(rowIndex, rowIndex, 0, 2));
+            sheet.addMergedRegion(new CellRangeAddress(rowIndex, rowIndex, 3, 6));
+
+            // 说明
+            rowIndex++;
+            Row explanationRow1 = sheet.createRow(rowIndex);
+            explanationRow1.setHeight((short) 300);
+            explanationRow1.createCell(0).setCellValue("说明");
+            for (int i = 1; i < 7; i++) {
+                explanationRow1.createCell(i);
+            }
+            sheet.addMergedRegion(new CellRangeAddress(rowIndex, rowIndex, 0, 6));
+
+            rowIndex++;
+            Row explanationRow2 = sheet.createRow(rowIndex);
+            explanationRow2.setHeight((short) 300);
+            explanationRow2.createCell(0).setCellValue("1.「是否无缺失」参照物品存放清单的数量。如果无缺失选择「是」;如果缺失则选择「否」。");
+            for (int i = 1; i < 7; i++) {
+                explanationRow2.createCell(i);
+            }
+            sheet.addMergedRegion(new CellRangeAddress(rowIndex, rowIndex, 0, 6));
+
+            rowIndex++;
+            Row explanationRow3 = sheet.createRow(rowIndex);
+            explanationRow3.setHeight((short) 300);
+            explanationRow3.createCell(0).setCellValue("2.「摆放符合要求」参见图例。");
+            for (int i = 1; i < 7; i++) {
+                explanationRow3.createCell(i);
+            }
+            sheet.addMergedRegion(new CellRangeAddress(rowIndex, rowIndex, 0, 6));
+
+            rowIndex++;
+            Row explanationRow4 = sheet.createRow(rowIndex);
+            CellStyle wrapStyle = wb.createCellStyle();
+            wrapStyle.setWrapText(true);
+            Cell explanationCell4 = explanationRow4.createCell(0);
+            explanationCell4.setCellValue("3.未污染无破损的MC5000连体防化服、Ansell 38-628氟橡胶手套有效期为五年;防化靴有效期为五年;未使用的滤罐有效期都标在滤毒罐上。应急物资柜储存的滤罐规定为一次性使用,拆封使用后即作为危废处理。");
+            explanationCell4.setCellStyle(wrapStyle);
+            for (int i = 1; i < 7; i++) {
+                explanationRow4.createCell(i).setCellStyle(wrapStyle);
+            }
+            sheet.addMergedRegion(new CellRangeAddress(rowIndex, rowIndex, 0, 6));
+
+            rowIndex++;
+            Row explanationRow5 = sheet.createRow(rowIndex);
+            Cell explanationCell5 = explanationRow5.createCell(0);
+            explanationCell5.setCellValue("4.安全带、MC5000连体防化服、3S standard全面罩必须贴有在效期内检验合格的标识。MC5000连体防化服为一次性使用,拆封使用后即作为危废处理。");
+            explanationCell5.setCellStyle(wrapStyle);
+            for (int i = 1; i < 7; i++) {
+                explanationRow5.createCell(i).setCellStyle(wrapStyle);
+            }
+            sheet.addMergedRegion(new CellRangeAddress(rowIndex, rowIndex, 0, 6));
+
+            rowIndex++;
+            Row explanationRow6 = sheet.createRow(rowIndex);
+            explanationRow6.setHeight((short) 300);
+            explanationRow6.createCell(0).setCellValue("5.检查发现其他异常,填写在「备注」栏,检查结果出现「否」,检查人应对不符合项目立即整改。");
+            for (int i = 1; i < 7; i++) {
+                explanationRow6.createCell(i);
+            }
+            sheet.addMergedRegion(new CellRangeAddress(rowIndex, rowIndex, 0, 6));
+
+            filename = "_应急物资柜" + dateStr + "检查记录.xlsx";
+            out = Files.newOutputStream(Paths.get(ExcelUtil.getAbsoluteFile(filename)));
+            wb.write(out);
+            wb.close();
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        return filename;
+    }
 }

+ 6 - 6
master/src/main/java/com/ruoyi/project/ps/inspection/domain/TPsInspectionEyewash.java

@@ -54,6 +54,12 @@ public class TPsInspectionEyewash extends BaseEntity {
     @Excel(name = "洗眼器周围2米内无障碍物,易接近")
     private String accessClear;
 
+    /**
+     * 所处区域有良好的照明,且没有被遮挡
+     * */
+    @Excel(name = "所处区域有良好的照明,且没有被遮挡")
+    private String lightUnobstructed;
+
     /**
      * 洗眼器配件没有损坏或丢失,也没有可见的腐蚀
      */
@@ -211,12 +217,6 @@ public class TPsInspectionEyewash extends BaseEntity {
 
     private String plant;
 
-    /**
-     * 所处区域有良好的照明,且没有被遮挡
-     * */
-    @Excel(name = "所处区域有良好的照明,且没有被遮挡")
-    private String lightUnobstructed;
-
     public String getLightUnobstructed() {
         return lightUnobstructed;
     }

+ 10 - 0
master/src/main/java/com/ruoyi/project/ps/patrol/domain/TPsPatrolPlan.java

@@ -46,6 +46,8 @@ public class TPsPatrolPlan extends BaseEntity {
     @Excel(name = "确认人")
     private String confirmed;
 
+    private String confirmedName;
+
     /**
      * 检测数量
      */
@@ -142,6 +144,14 @@ public class TPsPatrolPlan extends BaseEntity {
 
     private String deptName;
 
+    public String getConfirmedName() {
+        return confirmedName;
+    }
+
+    public void setConfirmedName(String confirmedName) {
+        this.confirmedName = confirmedName;
+    }
+
     public String getDeptName() {
         return deptName;
     }

+ 1 - 0
master/src/main/resources/mybatis/ps/inspection/TPsInspectionAlarmMapper.xml

@@ -61,6 +61,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         </where>
         <!-- 数据范围过滤 -->
         ${params.dataScope}
+        ORDER BY d.check_status ASC, d.createdate DESC
     </select>
     
     <select id="selectTPsInspectionAlarmById" parameterType="Long" resultMap="TPsInspectionAlarmResult">

+ 1 - 0
master/src/main/resources/mybatis/ps/inspection/TPsInspectionCabinetMapper.xml

@@ -75,6 +75,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         </where>
         <!-- 数据范围过滤 -->
         ${params.dataScope}
+        ORDER BY d.check_status ASC, d.createdate DESC
     </select>
     
     <select id="selectTPsInspectionCabinetById" parameterType="Long" resultMap="TPsInspectionCabinetResult">

+ 1 - 0
master/src/main/resources/mybatis/ps/inspection/TPsInspectionCallsystemMapper.xml

@@ -63,6 +63,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         </where>
         <!-- 数据范围过滤 -->
         ${params.dataScope}
+        ORDER BY d.check_status ASC, d.createdate DESC
     </select>
     
     <select id="selectTPsInspectionCallsystemById" parameterType="Long" resultMap="TPsInspectionCallsystemResult">

+ 1 - 0
master/src/main/resources/mybatis/ps/inspection/TPsInspectionCofferMapper.xml

@@ -63,6 +63,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         </where>
         <!-- 数据范围过滤 -->
         ${params.dataScope}
+        ORDER BY d.check_status ASC, d.createdate DESC
     </select>
     
     <select id="selectTPsInspectionCofferById" parameterType="Long" resultMap="TPsInspectionCofferResult">

+ 1 - 0
master/src/main/resources/mybatis/ps/inspection/TPsInspectionCurtainMapper.xml

@@ -63,6 +63,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         </where>
         <!-- 数据范围过滤 -->
         ${params.dataScope}
+        ORDER BY d.check_status ASC, d.createdate DESC
     </select>
     
     <select id="selectTPsInspectionCurtainById" parameterType="Long" resultMap="TPsInspectionCurtainResult">

+ 1 - 0
master/src/main/resources/mybatis/ps/inspection/TPsInspectionExtinguisherMapper.xml

@@ -77,6 +77,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         </where>
         <!-- 数据范围过滤 -->
         ${params.dataScope}
+        ORDER BY d.check_status ASC, d.createdate DESC
     </select>
     
     <select id="selectTPsInspectionExtinguisherById" parameterType="Long" resultMap="TPsInspectionExtinguisherResult">

+ 1 - 0
master/src/main/resources/mybatis/ps/inspection/TPsInspectionEyewashMapper.xml

@@ -78,6 +78,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         </where>
         <!-- 数据范围过滤 -->
         ${params.dataScope}
+        ORDER BY d.check_status ASC, d.createdate DESC
     </select>
     
     <select id="selectTPsInspectionEyewashById" parameterType="Long" resultMap="TPsInspectionEyewashResult">

+ 1 - 0
master/src/main/resources/mybatis/ps/inspection/TPsInspectionFgsMapper.xml

@@ -63,6 +63,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         </where>
         <!-- 数据范围过滤 -->
         ${params.dataScope}
+        ORDER BY d.check_status ASC, d.createdate DESC
     </select>
     
     <select id="selectTPsInspectionFgsById" parameterType="Long" resultMap="TPsInspectionFgsResult">

+ 1 - 0
master/src/main/resources/mybatis/ps/inspection/TPsInspectionFiredoorMapper.xml

@@ -65,6 +65,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         </where>
         <!-- 数据范围过滤 -->
         ${params.dataScope}
+        ORDER BY d.check_status ASC, d.createdate DESC
     </select>
     
     <select id="selectTPsInspectionFiredoorById" parameterType="Long" resultMap="TPsInspectionFiredoorResult">

+ 1 - 1
master/src/main/resources/mybatis/ps/inspection/TPsInspectionHydrantMapper.xml

@@ -81,7 +81,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         </where>
         <!-- 数据范围过滤 -->
         ${params.dataScope}
-        order by group_no, dev_type
+        ORDER BY d.check_status ASC, group_no, dev_type, d.createdate DESC
     </select>
     
     <select id="selectTPsInspectionHydrantById" parameterType="Long" resultMap="TPsInspectionHydrantResult">

+ 1 - 0
master/src/main/resources/mybatis/ps/inspection/TPsInspectionLiftMapper.xml

@@ -67,6 +67,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         </where>
         <!-- 数据范围过滤 -->
         ${params.dataScope}
+        ORDER BY d.check_status ASC, d.createdate DESC
     </select>
     
     <select id="selectTPsInspectionLiftById" parameterType="Long" resultMap="TPsInspectionLiftResult">

+ 1 - 0
master/src/main/resources/mybatis/ps/inspection/TPsInspectionMonitorMapper.xml

@@ -65,6 +65,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         </where>
         <!-- 数据范围过滤 -->
         ${params.dataScope}
+        ORDER BY d.check_status ASC, d.createdate DESC
     </select>
     
     <select id="selectTPsInspectionMonitorById" parameterType="Long" resultMap="TPsInspectionMonitorResult">

+ 1 - 0
master/src/main/resources/mybatis/ps/inspection/TPsInspectionPitMapper.xml

@@ -61,6 +61,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         </where>
         <!-- 数据范围过滤 -->
         ${params.dataScope}
+        ORDER BY d.check_status ASC, d.createdate DESC
     </select>
     
     <select id="selectTPsInspectionPitById" parameterType="Long" resultMap="TPsInspectionPitResult">

+ 1 - 0
master/src/main/resources/mybatis/ps/inspection/TPsInspectionRainvalveMapper.xml

@@ -61,6 +61,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         </where>
         <!-- 数据范围过滤 -->
         ${params.dataScope}
+        ORDER BY d.check_status ASC, d.createdate DESC
     </select>
     
     <select id="selectTPsInspectionRainvalveById" parameterType="Long" resultMap="TPsInspectionRainvalveResult">

+ 1 - 0
master/src/main/resources/mybatis/ps/inspection/TPsInspectionSteamMapper.xml

@@ -63,6 +63,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         </where>
         <!-- 数据范围过滤 -->
         ${params.dataScope}
+        ORDER BY d.check_status ASC, d.createdate DESC
     </select>
     
     <select id="selectTPsInspectionSteamById" parameterType="Long" resultMap="TPsInspectionSteamResult">

+ 1 - 0
master/src/main/resources/mybatis/ps/inspection/TPsInspectionSumpMapper.xml

@@ -63,6 +63,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         </where>
         <!-- 数据范围过滤 -->
         ${params.dataScope}
+        ORDER BY d.check_status ASC, d.createdate DESC
     </select>
     
     <select id="selectTPsInspectionSumpById" parameterType="Long" resultMap="TPsInspectionSumpResult">

+ 1 - 0
master/src/main/resources/mybatis/ps/inspection/TPsInspectionUtilitystationMapper.xml

@@ -65,6 +65,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         </where>
         <!-- 数据范围过滤 -->
         ${params.dataScope}
+        ORDER BY d.check_status ASC, d.createdate DESC
     </select>
     
     <select id="selectTPsInspectionUtilitystationById" parameterType="Long" resultMap="TPsInspectionUtilitystationResult">

+ 1 - 0
master/src/main/resources/mybatis/ps/inspection/TPsInspectionVentvalveMapper.xml

@@ -63,6 +63,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         </where>
         <!-- 数据范围过滤 -->
         ${params.dataScope}
+        ORDER BY d.check_status ASC, d.createdate DESC
     </select>
     
     <select id="selectTPsInspectionVentvalveById" parameterType="Long" resultMap="TPsInspectionVentvalveResult">

+ 1 - 0
master/src/main/resources/mybatis/ps/inspection/TPsInspectionWardrobeMapper.xml

@@ -65,6 +65,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         </where>
         <!-- 数据范围过滤 -->
         ${params.dataScope}
+        ORDER BY d.check_status ASC, d.createdate DESC
     </select>
     
     <select id="selectTPsInspectionWardrobeById" parameterType="Long" resultMap="TPsInspectionWardrobeResult">

+ 3 - 1
master/src/main/resources/mybatis/ps/patrol/TPsPatrolPlanMapper.xml

@@ -10,6 +10,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <result property="planYear"    column="plan_year"    />
         <result property="planMonth"    column="plan_month"    />
         <result property="confirmed"    column="confirmed"    />
+        <result property="confirmedName"    column="nick_name"    />
         <result property="devNum"    column="dev_num"    />
         <result property="detectionFrequency"    column="detection_frequency"    />
         <result property="delFlag"    column="del_flag"    />
@@ -29,8 +30,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     </resultMap>
 
     <sql id="selectTPsPatrolPlanVo">
-        select d.id, d.plan_name, d.plan_year, d.plan_month, d.confirmed, d.dev_num, d.detection_frequency, d.del_flag, d.creater_code, d.createdate, d.updater_code, d.updatedate, d.remarks, d.dept_id, d.confirm_date, d.patrol_type, d.deadline, d.checked_num, d.unchecked_num, d.status ,s.dept_name from t_ps_patrol_plan d
+        select d.id, d.plan_name, d.plan_year, d.plan_month, d.confirmed,u.nick_name, d.dev_num, d.detection_frequency, d.del_flag, d.creater_code, d.createdate, d.updater_code, d.updatedate, d.remarks, d.dept_id, d.confirm_date, d.patrol_type, d.deadline, d.checked_num, d.unchecked_num, d.status ,s.dept_name from t_ps_patrol_plan d
       left join sys_dept s on s.dept_id = d.dept_id
+        left join sys_user u on d.confirmed = u.user_id
     </sql>
 
     <select id="selectTPsPatrolPlanList" parameterType="TPsPatrolPlan" resultMap="TPsPatrolPlanResult">

+ 1 - 1
ui/src/views/ps/inspection/alarm/index.vue

@@ -204,7 +204,7 @@ export default {
         deptId: null,
         planId: null,
         issuesStatus: null,
-        issuesFlag: null
+        issuesFlag: '0'
       }
     };
   },

+ 1 - 1
ui/src/views/ps/inspection/extinguisher/index.vue

@@ -250,7 +250,7 @@ export default {
         deptId: null,
         planId: null,
         issuesStatus: null,
-        issuesFlag: null
+        issuesFlag: '0'
       }
     };
   },

+ 5 - 1
ui/src/views/ps/inspection/fgs/index.vue

@@ -89,7 +89,11 @@
           <dict-tag :options="dict.type.inspection_status" :value="scope.row.testAlarm"/>
         </template>
       </el-table-column>
-      <el-table-column label="风向/温度" align="center" prop="windTemp" :show-overflow-tooltip="true"/>
+      <el-table-column label="风向/温度" align="center" prop="windTemp" :show-overflow-tooltip="true">
+        <template slot-scope="scope">
+          <dict-tag :options="dict.type.inspection_status" :value="scope.row.windTemp"/>
+        </template>
+      </el-table-column>
       <el-table-column label="确认人" align="center" prop="confirmer" :show-overflow-tooltip="true"/>
       <el-table-column label="备注" align="center" prop="remarks" :show-overflow-tooltip="true"/>
       <el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="80">

+ 5 - 1
ui/src/views/ps/inspection/monitor/index.vue

@@ -94,7 +94,11 @@
           <dict-tag :options="dict.type.inspection_status" :value="scope.row.rotateSpray"/>
         </template>
       </el-table-column>
-      <el-table-column label="消防水出水压力" align="center" prop="waterPressure" :show-overflow-tooltip="true"/>
+      <el-table-column label="消防水出水压力" align="center" prop="waterPressure" :show-overflow-tooltip="true">
+        <template slot-scope="scope">
+          <dict-tag :options="dict.type.inspection_status" :value="scope.row.waterPressure"/>
+        </template>
+      </el-table-column>
       <el-table-column label="确认人" align="center" prop="confirmer" :show-overflow-tooltip="true"/>
       <el-table-column label="备注" align="center" prop="remarks" :show-overflow-tooltip="true"/>
       <el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="80">

+ 62 - 0
ui/src/views/ps/inspection/wardrobe/index.vue

@@ -142,6 +142,13 @@
       <el-table-column label="确认人" align="center" prop="confirmer" :show-overflow-tooltip="true"/>
       <el-table-column label="操作" align="center" fixed="right" width="120" class-name="small-padding fixed-width">
         <template slot-scope="scope">
+          <el-button
+            icon="el-icon-picture-outline"
+            size="mini"
+            type="text"
+            @click="openFileDialog(scope.row)"
+          >附件
+          </el-button>
         </template>
       </el-table-column>
     </el-table>
@@ -153,6 +160,26 @@
       :limit.sync="queryParams.pageSize"
       @pagination="getList"
     />
+
+    <el-dialog :close-on-click-modal="false" :visible.sync="file.open" append-to-body title="附件详情" width="50%">
+      <el-tabs v-model="tabName" :stretch="true" type="border-card" @tab-click="getFileList">
+        <el-tab-pane label="常规附件" name="a">
+          <el-empty v-if="file.fileList.length==0" description="如你所见,这里什么都没有"></el-empty>
+          <el-image v-for="item in file.fileList" v-else :key="item.fileUrl"
+                    :src="getFileUrl(item.fileUrl)"></el-image>
+        </el-tab-pane>
+        <el-tab-pane label="异常附件" name="b">
+          <el-empty v-if="file.fileList.length==0" description="如你所见,这里什么都没有"></el-empty>
+          <el-image v-for="item in file.fileList" v-else :key="item.fileUrl"
+                    :src="getFileUrl(item.fileUrl)"></el-image>
+        </el-tab-pane>
+        <el-tab-pane label="异常整改后附件" name="c">
+          <el-empty v-if="file.fileList.length==0" description="如你所见,这里什么都没有"></el-empty>
+          <el-image v-for="item in file.fileList" v-else :key="item.fileUrl"
+                    :src="getFileUrl(item.fileUrl)"></el-image>
+        </el-tab-pane>
+      </el-tabs>
+    </el-dialog>
   </div>
 </template>
 
@@ -171,12 +198,23 @@ import Treeselect from "@riophae/vue-treeselect";
 import "@riophae/vue-treeselect/dist/vue-treeselect.css";
 import {getToken} from "@/utils/auth";
 import {listPlan} from "@/api/ps/patrol/plan";
+import {allFileList} from "@/api/common/commonfile";
 export default {
   name: "Wardrobe",
   dicts: ['inspection_status'],
   components: {Treeselect},
   data() {
     return {
+      tabName: 'a',
+      file: {
+        open: false,
+        fileList: [],
+        queryParams: {
+          pId: null,
+          pType: 'ps-wardrobe',
+          pValue: ''
+        },
+      },
       // 遮罩层
       loading: true,
       // 选中数组
@@ -258,6 +296,30 @@ export default {
     this.getTreeselect();
   },
   methods: {
+    openFileDialog(row) {
+      this.file.queryParams.pId = row.id;
+      this.tabName = 'a'
+      this.file.open = true;
+      this.getFileList({})
+    },
+    getFileList(tab) {
+      this.file.fileList = [];
+      let value = 'regular';
+      if (tab.name == 'a') {
+        value = 'regular';
+      } else if (tab.name == 'b') {
+        value = 'issue';
+      } else if (tab.name == 'c') {
+        value = 'repair';
+      }
+      this.file.queryParams.pValue = value;
+      allFileList(this.file.queryParams).then(response => {
+        this.file.fileList = response;
+      })
+    },
+    getFileUrl(url) {
+      return process.env.VUE_APP_BASE_API + url;
+    },
     /** 查询应急物资柜列表 */
     getList() {
       this.loading = true;