فهرست منبع

巡检记录导出

fuyuhchuan 10 ماه پیش
والد
کامیت
99b3258f42

+ 4 - 1
service-fire/service-fire-biz/src/main/java/com/usky/fire/controller/web/PatrolInspectionRecordController.java

@@ -7,6 +7,7 @@ import com.usky.common.log.annotation.Log;
 import com.usky.common.log.enums.BusinessType;
 import com.usky.fire.domain.PatrolInspectionRecord;
 import com.usky.fire.service.PatrolInspectionRecordService;
+import com.usky.fire.service.util.ExcelUtilImage;
 import com.usky.fire.service.vo.PatrolInspectionRecordExportVo;
 import com.usky.fire.service.vo.PatrolInspectionRecordVo;
 import com.usky.fire.service.vo.RecordStatisticsVo;
@@ -139,7 +140,9 @@ public class PatrolInspectionRecordController {
                                  @RequestParam(value = "startDateTime", required = false) String startDateTime,
                                  @RequestParam(value = "endDateTime", required = false) String endDateTime,
                                  @RequestParam(value = "idList", required = false) String idList) throws IOException {
-        patrolInspectionRecordService.exportImage(response,areaName, siteName, name, planType, startDateTime, endDateTime, idList);
+        List<PatrolInspectionRecordExportVo> list = patrolInspectionRecordService.exportImage(areaName, siteName, name, planType, startDateTime, endDateTime, idList);
+        ExcelUtilImage<PatrolInspectionRecordExportVo> util = new ExcelUtilImage<PatrolInspectionRecordExportVo>(PatrolInspectionRecordExportVo.class);
+        util.exportExcel(response, list, "巡检记录", "巡检记录");
     }
 }
 

+ 2 - 0
service-fire/service-fire-biz/src/main/java/com/usky/fire/mapper/PatrolInspectionContentMapper.java

@@ -2,6 +2,7 @@ package com.usky.fire.mapper;
 
 import com.usky.fire.domain.PatrolInspectionContent;
 import com.usky.common.mybatis.core.CrudMapper;
+import org.springframework.stereotype.Repository;
 
 /**
  * <p>
@@ -11,6 +12,7 @@ import com.usky.common.mybatis.core.CrudMapper;
  * @author JCB
  * @since 2022-07-15
  */
+@Repository
 public interface PatrolInspectionContentMapper extends CrudMapper<PatrolInspectionContent> {
 
 }

+ 2 - 0
service-fire/service-fire-biz/src/main/java/com/usky/fire/mapper/PatrolInspectionContentOptionMapper.java

@@ -2,6 +2,7 @@ package com.usky.fire.mapper;
 
 import com.usky.fire.domain.PatrolInspectionContentOption;
 import com.usky.common.mybatis.core.CrudMapper;
+import org.springframework.stereotype.Repository;
 
 /**
  * <p>
@@ -11,6 +12,7 @@ import com.usky.common.mybatis.core.CrudMapper;
  * @author JCB
  * @since 2022-07-15
  */
+@Repository
 public interface PatrolInspectionContentOptionMapper extends CrudMapper<PatrolInspectionContentOption> {
 
 }

+ 2 - 0
service-fire/service-fire-biz/src/main/java/com/usky/fire/mapper/PatrolInspectionRecordOptionMapper.java

@@ -2,6 +2,7 @@ package com.usky.fire.mapper;
 
 import com.usky.fire.domain.PatrolInspectionRecordOption;
 import com.usky.common.mybatis.core.CrudMapper;
+import org.springframework.stereotype.Repository;
 
 /**
  * <p>
@@ -11,6 +12,7 @@ import com.usky.common.mybatis.core.CrudMapper;
  * @author JCB
  * @since 2022-07-21
  */
+@Repository
 public interface PatrolInspectionRecordOptionMapper extends CrudMapper<PatrolInspectionRecordOption> {
 
 }

+ 6 - 2
service-fire/service-fire-biz/src/main/java/com/usky/fire/service/PatrolInspectionRecordService.java

@@ -43,6 +43,10 @@ public interface PatrolInspectionRecordService extends CrudService<PatrolInspect
     List<PatrolInspectionRecordExportVo> recordLsitExport(String areaName, String siteName, String name,
                                                           Integer planType, String startDateTime,
                                                           String endDateTime,String idList);
-    void exportImage(HttpServletResponse response, String areaName, String siteName, String name, Integer planType,
-                            String startDateTime, String endDateTime, String idList) throws IOException;
+
+    List<PatrolInspectionRecordExportVo> exportImage(String areaName, String siteName, String name,
+                                                     Integer planType, String startDateTime,
+                                                     String endDateTime, String idList);
+    /*void exportImage(HttpServletResponse response, String areaName, String siteName, String name, Integer planType,
+                            String startDateTime, String endDateTime, String idList) throws IOException;*/
 }

+ 155 - 204
service-fire/service-fire-biz/src/main/java/com/usky/fire/service/impl/PatrolInspectionRecordServiceImpl.java

@@ -12,9 +12,7 @@ import com.usky.common.core.exception.BusinessException;
 import com.usky.common.mybatis.core.AbstractCrudService;
 import com.usky.common.security.utils.SecurityUtils;
 import com.usky.fire.domain.*;
-import com.usky.fire.mapper.PatrolInspectionPlanMapper;
-import com.usky.fire.mapper.PatrolInspectionRecordMapper;
-import com.usky.fire.mapper.PatrolInspectionRecordPictureMapper;
+import com.usky.fire.mapper.*;
 import com.usky.fire.service.*;
 import com.usky.fire.service.vo.*;
 import com.usky.system.model.LoginUser;
@@ -35,7 +33,9 @@ import java.net.MalformedURLException;
 import java.net.URL;
 import java.time.format.DateTimeFormatter;
 import java.util.ArrayList;
+import java.util.HashMap;
 import java.util.List;
+import java.util.Map;
 
 /**
  * <p>
@@ -75,6 +75,15 @@ public class PatrolInspectionRecordServiceImpl extends AbstractCrudService<Patro
     @Autowired
     private PatrolInspectionRecordPictureMapper orphansInspectionRecordPictureMapper;
 
+    @Autowired
+    private PatrolInspectionRecordOptionMapper patrolInspectionRecordOptionMapper;
+
+    @Autowired
+    private PatrolInspectionContentMapper patrolInspectionContentMapper;
+
+    @Autowired
+    private PatrolInspectionContentOptionMapper patrolInspectionContentOptionMapper;
+
     @Override
     public CommonPage<PatrolInspectionRecord> patrolInspectionRecordLsit(String areaName, String siteName, String name,
                                                                          Integer planType, String startDateTime, String endDateTime,
@@ -165,7 +174,7 @@ public class PatrolInspectionRecordServiceImpl extends AbstractCrudService<Patro
             contentOptionVo.setCreateTime(contentOptionList.get(i).getCreateTime());
             contentOptionVo.setSelectStatus(false);
             for (int j = 0; j < patrolInspectionRecordOptionList.size(); j++) {
-                if(contentOptionList.get(i).getContentId()==patrolInspectionContentList.get(j).getId()){
+                if (contentOptionList.get(i).getContentId() == patrolInspectionContentList.get(j).getId()) {
                     contentOptionVo.setRemarks(patrolInspectionRecordOptionList.get(j).getRemarks());
                 }
                 if (contentOptionList.get(i).getId() == patrolInspectionRecordOptionList.get(j).getContentOptionId()) {
@@ -420,8 +429,9 @@ public class PatrolInspectionRecordServiceImpl extends AbstractCrudService<Patro
     }
 
     @Override
-    public void exportImage(HttpServletResponse response, String areaName, String siteName, String name, Integer planType,
-                            String startDateTime, String endDateTime, String idList) throws IOException {
+    public List<PatrolInspectionRecordExportVo> exportImage(String areaName, String siteName, String name,
+                                                            Integer planType, String startDateTime,
+                                                            String endDateTime, String idList) {
         DateTimeFormatter df = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
         LoginUser loginUser = SecurityUtils.getLoginUser();
         String userType = null;
@@ -463,10 +473,15 @@ public class PatrolInspectionRecordServiceImpl extends AbstractCrudService<Patro
             patrolInspectionRecordExportVo.setStartDate(patrolInspectionRecordList.get(i).getStartDate().format(df));
             patrolInspectionRecordExportVo.setEndDate(patrolInspectionRecordList.get(i).getEndDate().format(df));
             patrolInspectionRecordExportVo.setCreateTime(patrolInspectionRecordList.get(i).getCreateTime().format(df));
-            LambdaQueryWrapper<PatrolInspectionRecordPicture> queryWrapperJpg = Wrappers.lambdaQuery();//导出图片
-            queryWrapperJpg.select(PatrolInspectionRecordPicture::getPictureUrl)
+            patrolInspectionRecordExportVo.setRemarks(patrolInspectionRecordList.get(i).getRemarks());
+            patrolInspectionRecordExportVo.setContentTitle(getContentTitle(patrolInspectionRecordList.get(i).getId()));
+            patrolInspectionRecordExportVo.setSubmissionMethod(getSubmissionMethod(patrolInspectionRecordList.get(i).getId()));
+            patrolInspectionRecordExportVo.setOptionName(getOptionName(patrolInspectionRecordList.get(i).getId()));
+            patrolInspectionRecordExportVo.setContentRemarks(getRemarks(patrolInspectionRecordList.get(i).getId()));
+            LambdaQueryWrapper<PatrolInspectionRecordPicture> queryWrapperImage = Wrappers.lambdaQuery();//导出图片
+            queryWrapperImage.select(PatrolInspectionRecordPicture::getPictureUrl)
                     .eq(PatrolInspectionRecordPicture::getRecordId, patrolInspectionRecordList.get(i).getId());
-            List<PatrolInspectionRecordPicture> pictures = orphansInspectionRecordPictureMapper.selectList(queryWrapperJpg);
+            List<PatrolInspectionRecordPicture> pictures = orphansInspectionRecordPictureMapper.selectList(queryWrapperImage);
             if (pictures.size() > 0) {
                 for (int j = 0; j < pictures.size() && j < 5; j++) {
                     String pictureUrl = pictures.get(j).getPictureUrl();
@@ -493,211 +508,147 @@ public class PatrolInspectionRecordServiceImpl extends AbstractCrudService<Patro
             }
             list.add(patrolInspectionRecordExportVo);
         }
-        XSSFWorkbook workbook = new XSSFWorkbook();
-        XSSFSheet sheet = workbook.createSheet("巡检记录");
-        // 添加列标题行
-        Row headerRow = sheet.createRow(1);
-        String[] headers = {
-                "序号", "地点号码", "地点类型", "区域名称", "地点名称", "巡检人员", "联系电话",
-                "计划类型", "经度", "纬度", "开始时间", "结束时间", "巡检时间", "巡检照片1",
-                "巡检照片2", "巡检照片3", "巡检照片4", "巡检照片5"
-        };
-        // 添加总标题行
-        Row titleRow = sheet.createRow(0);
-        Cell titleCell = titleRow.createCell(0);
-        titleCell.setCellValue("巡检记录");
-        CellStyle titleCellStyle = workbook.createCellStyle();
-        // 设置字体为黑色加粗
-        Font titleFont = workbook.createFont();
-        titleFont.setFontName("宋体");
-        titleFont.setFontHeightInPoints((short) 16);
-        titleFont.setColor(IndexedColors.BLACK.getIndex());
-        titleFont.setBold(true);
-        titleCellStyle.setFont(titleFont);
-        // 设置水平居中和垂直居中
-        titleCellStyle.setAlignment(HorizontalAlignment.CENTER);
-        titleCellStyle.setVerticalAlignment(VerticalAlignment.CENTER);
-        titleCell.setCellStyle(titleCellStyle);
-        titleRow.setHeightInPoints(30);
-        // 合并标题单元格以横跨所有列
-        int totalColumns = headers.length;
-        sheet.addMergedRegion(new CellRangeAddress(0, 0, 0, totalColumns - 1));
-        //设置列标题
-        for (int i = 0; i < headers.length; i++) {
-            Cell cell = headerRow.createCell(i);
-            cell.setCellValue(headers[i]);
-            CellStyle headerCellStyle = workbook.createCellStyle();
-            headerCellStyle.setAlignment(HorizontalAlignment.CENTER);
-            headerCellStyle.setVerticalAlignment(VerticalAlignment.CENTER);
-            headerCellStyle.setBorderBottom(BorderStyle.THIN);
-            headerCellStyle.setBorderTop(BorderStyle.THIN);
-            headerCellStyle.setBorderLeft(BorderStyle.THIN);
-            headerCellStyle.setBorderRight(BorderStyle.THIN);
-            // 设置背景颜色为灰色
-            headerCellStyle.setFillForegroundColor(IndexedColors.GREY_50_PERCENT.getIndex());
-            headerCellStyle.setFillPattern(FillPatternType.SOLID_FOREGROUND);
-            // 设置字体为白色
-            Font headerFont = workbook.createFont();
-            headerFont.setFontName("宋体");
-            headerFont.setFontHeightInPoints((short) 10);
-            headerFont.setColor(IndexedColors.WHITE.getIndex());
-            headerFont.setBold(true);
-            headerRow.setHeightInPoints(13.5f);
-            headerCellStyle.setFont(headerFont);
-            cell.setCellStyle(headerCellStyle);
-        }
+        return list;
+    }
 
-        Row fixedRow = sheet.createRow(list.size() + 3); // 数据行数 + 标题行数(1) + 固定行(1) + 空一行
-        CellStyle fixedCellStyle = workbook.createCellStyle();
-
-        // 创建字体样式
-        Font fixedFont = workbook.createFont();
-        fixedFont.setFontName("宋体");
-        fixedFont.setBold(true);
-        fixedFont.setFontHeightInPoints((short) 12);
-        fixedCellStyle.setFont(fixedFont);
-
-        // 创建“负责人签名”单元格
-        Cell cellSign = fixedRow.createCell(0);
-        cellSign.setCellValue("负责人签名:");
-        cellSign.setCellStyle(fixedCellStyle);
-
-        // 创建“日期”单元格
-        Cell cellDate = fixedRow.createCell(4); // 假设日期单元格在第五列
-        cellDate.setCellValue("日期:");
-        cellDate.setCellStyle(fixedCellStyle);
-
-        // 合并单元格
-//        sheet.addMergedRegion(new CellRangeAddress(list.size() + 2, list.size() + 2, 0, 0)); // 负责人签名
-//        sheet.addMergedRegion(new CellRangeAddress(list.size() + 2, list.size() + 2, 4, 4)); // 日期
-
-        // 设置固定行的高度
-        fixedRow.setHeightInPoints(20);
-
-        // 设置数据行样式
-        CellStyle dataCellStyle = workbook.createCellStyle();
-        Font dataFont = workbook.createFont();
-        dataFont.setFontName("Arial");
-        dataFont.setFontHeightInPoints((short) 10);
-        dataCellStyle.setFont(dataFont);
-        dataCellStyle.setAlignment(HorizontalAlignment.CENTER);
-        dataCellStyle.setVerticalAlignment(VerticalAlignment.CENTER);
-        dataCellStyle.setBorderBottom(BorderStyle.THIN);
-        dataCellStyle.setBorderTop(BorderStyle.THIN);
-        dataCellStyle.setBorderLeft(BorderStyle.THIN);
-        dataCellStyle.setBorderRight(BorderStyle.THIN);
-        // 添加数据
-        for (int i = 0; i < list.size(); i++) {
-            PatrolInspectionRecordExportVo record = list.get(i);
-            Row row = sheet.createRow(i + 2);
-
-            for (int j = 0; j < headers.length; j++) {
-                Cell cell = row.createCell(j);
-                cell.setCellStyle(dataCellStyle);
-
-                // 根据 j 变量来确定应该填充数据的单元格索引
-                switch (j) {
-                    case 0:
-                        cell.setCellValue(record.getXh());
-                        break;
-                    case 1:
-                        cell.setCellValue(record.getSiteNubmber());
-                        break;
-                    case 2:
-                        cell.setCellValue(record.getSiteType() == 1 ? "二维码" : "NFC");
-                        break;
-                    case 3:
-                        cell.setCellValue(record.getAreaName());
-                        break;
-                    case 4:
-                        cell.setCellValue(record.getSiteName());
-                        break;
-                    case 5:
-                        cell.setCellValue(record.getName());
-                        break;
-                    case 6:
-                        cell.setCellValue(record.getPhone());
-                        break;
-                    case 7:
-                        cell.setCellValue(record.getPlanType() == 1 ? "普通计划" : "按次计划");
-                        break;
-                    case 8:
-                        cell.setCellValue(record.getLongitude());
-                        break;
-                    case 9:
-                        cell.setCellValue(record.getLatitude());
-                        break;
-                    case 10:
-                        cell.setCellValue(record.getStartDate());
-                        break;
-                    case 11:
-                        cell.setCellValue(record.getEndDate());
-                        break;
-                    case 12:
-                        cell.setCellValue(record.getCreateTime());
-                        break;
-                    default:
-                        break;
-                }
-                CreationHelper helper = workbook.getCreationHelper();
-                Drawing<?> drawing = sheet.createDrawingPatriarch();
-                ClientAnchor anchor;
-                if (record.getImagePath1() != null || record.getImagePath2() != null
-                        || record.getImagePath3() != null || record.getImagePath4() != null || record.getImagePath5() != null) {
-                    for (int k = 0; k < 5; k++) {
-                        String imagePath = null;
-                        switch (k) {
-                            case 0:
-                                imagePath = record.getImagePath1();
-                                break;
-                            case 1:
-                                imagePath = record.getImagePath2();
-                                break;
-                            case 2:
-                                imagePath = record.getImagePath3();
-                                break;
-                            case 3:
-                                imagePath = record.getImagePath4();
-                                break;
-                            case 4:
-                                imagePath = record.getImagePath5();
-                                break;
-                        }
+    /**
+     * 获取内容选项备注
+     *
+     * @param recordId 巡检记录id
+     * @return
+     */
+    public List<String> getRemarks(int recordId) {
+        LambdaQueryWrapper<PatrolInspectionRecordOption> queryWrapper = Wrappers.lambdaQuery();
+        queryWrapper.eq(PatrolInspectionRecordOption::getRecordId, recordId)
+                .orderByAsc(PatrolInspectionRecordOption::getId);
+        List<PatrolInspectionRecordOption> recordOptions = patrolInspectionRecordOptionMapper.selectList(queryWrapper);
+        List<String> remarksList = new ArrayList<>();
+        for (PatrolInspectionRecordOption recordOption : recordOptions) {
+            if (recordOption.getRemarks() != null) {
+                remarksList.add(recordOption.getRemarks());
+            } else {
+                remarksList.add(""); // 如果Remarks为空,则添加空字符串
+            }
+        }
+        return remarksList;
+    }
 
-                        if (imagePath != null) {
-                            byte[] imageBytes = getImageBytes(imagePath);
-                            int pictureIdx = workbook.addPicture(imageBytes, Workbook.PICTURE_TYPE_JPEG);
+    /**
+     * 获取检查项ID
+     *
+     * @param recordId 巡检记录id
+     * @return
+     */
+    public List<Integer> getContentId(int recordId) {
+        LambdaQueryWrapper<PatrolInspectionRecordOption> queryWrapper = Wrappers.lambdaQuery();
+        queryWrapper.select(PatrolInspectionRecordOption::getContentId)
+                .eq(PatrolInspectionRecordOption::getRecordId, recordId)
+                .orderByAsc(PatrolInspectionRecordOption::getId);
+        List<PatrolInspectionRecordOption> recordOptions = patrolInspectionRecordOptionMapper.selectList(queryWrapper);
+        List<Integer> ContentIdList = new ArrayList<>();
+        for (PatrolInspectionRecordOption recordOption : recordOptions) {
+            ContentIdList.add(recordOption.getContentId());
+        }
+        return ContentIdList;
+    }
 
-                            anchor = helper.createClientAnchor();
-                            anchor.setCol1(headers.length - 5 + k);
-                            anchor.setRow1(i + 2);
+    /**
+     * 获取内容标题
+     *
+     * @param recordId 巡检记录id
+     * @return
+     */
+    public List<String> getContentTitle(int recordId) {
+        List<Integer> list = getContentId(recordId);
+        LambdaQueryWrapper<PatrolInspectionContent> queryWrapper = Wrappers.lambdaQuery();
+        queryWrapper.select(PatrolInspectionContent::getContentTitle)
+                .in(PatrolInspectionContent::getId, list)
+                .orderByAsc(PatrolInspectionContent::getId);
+        List<PatrolInspectionContent> contentList = patrolInspectionContentMapper.selectList(queryWrapper);
+        List<String> contentTitle = new ArrayList<>();
+        for (PatrolInspectionContent content : contentList) {
+            contentTitle.add(content.getContentTitle());
+        }
+        return contentTitle;
+    }
 
-                            Picture pict = drawing.createPicture(anchor, pictureIdx);
-                            pict.resize(1, 1);
-                        }
-                    }
-                }
+    /**
+     * 获取提交方法
+     *
+     * @param recordId 巡检记录id
+     * @return
+     */
+    public List<String> getSubmissionMethod(int recordId) {
+        List<Integer> list = getContentId(recordId);
+        LambdaQueryWrapper<PatrolInspectionContent> queryWrapper = Wrappers.lambdaQuery();
+        queryWrapper.select(PatrolInspectionContent::getSubmissionMethod)
+                .in(PatrolInspectionContent::getId, list)
+                .orderByAsc(PatrolInspectionContent::getId);
+        List<PatrolInspectionContent> contentList = patrolInspectionContentMapper.selectList(queryWrapper);
+        List<String> contentTitle = new ArrayList<>();
+        for (PatrolInspectionContent content : contentList) {
+            switch (content.getSubmissionMethod()) {
+                case 1:
+                    contentTitle.add("多选");
+                    break;
+                case 2:
+                    contentTitle.add("单选");
+                    break;
+                default:
+                    contentTitle.add("输入框");
             }
-
         }
+        return contentTitle;
+    }
 
-        for (int i = 0; i < headers.length; i++) {
-            sheet.setColumnWidth(i, (int) (16.09 * 256));
+    /**
+     * 获取内容选项ID
+     *
+     * @param recordId 巡检记录id
+     * @return
+     */
+    public List<Integer> getContentOptionId(int recordId) {
+        LambdaQueryWrapper<PatrolInspectionRecordOption> queryWrapper = Wrappers.lambdaQuery();
+        queryWrapper.eq(PatrolInspectionRecordOption::getRecordId, recordId)
+                .orderByAsc(PatrolInspectionRecordOption::getId);
+        List<PatrolInspectionRecordOption> contentOptionIds = patrolInspectionRecordOptionMapper.selectList(queryWrapper);
+        List<Integer> contentOptionIdList = new ArrayList<>();
+        for (PatrolInspectionRecordOption recordOption : contentOptionIds) {
+            contentOptionIdList.add(recordOption.getContentId());
         }
-
-        // 输出Excel文件
-        response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
-        response.setHeader("Content-Disposition", "attachment; filename=巡检记录.xlsx");
-        workbook.write(response.getOutputStream());
-        workbook.close();
+        return contentOptionIdList;
     }
 
-    public byte[] getImageBytes(String imageUrl) throws IOException {
-        URL url = new URL(imageUrl);
-        BufferedImage image = ImageIO.read(url);
-        ByteArrayOutputStream baos = new ByteArrayOutputStream();
-        ImageIO.write(image, "jpg", baos);
-        return baos.toByteArray();
+    /**
+     * 获取选项内容
+     *
+     * @param recordId 巡检记录id
+     * @return
+     */
+    public List<String> getOptionName(int recordId) {
+        List<Integer> list = getContentOptionId(recordId);
+        System.out.println(list);
+        LambdaQueryWrapper<PatrolInspectionRecordOption> queryWrapper1 = Wrappers.lambdaQuery();
+        queryWrapper1.eq(PatrolInspectionRecordOption::getRecordId,recordId)
+                .in(PatrolInspectionRecordOption::getContentId,list)
+                .orderByAsc(PatrolInspectionRecordOption::getId);
+        List<PatrolInspectionRecordOption> list2 = patrolInspectionRecordOptionMapper.selectList(queryWrapper1);
+        List<String> optionNameList = new ArrayList<>();
+        for (int i = 0; i < list2.size(); i++) {
+            if (list2.get(i).getContentOptionId() == null || " ".equals(list2.get(i).getContentOptionId())){
+                optionNameList.add(list2.get(i).getContent());
+            }else {
+                LambdaQueryWrapper<PatrolInspectionContentOption> queryWrapper2 = Wrappers.lambdaQuery();
+                queryWrapper2.select(PatrolInspectionContentOption::getOptionName)
+                        .eq(PatrolInspectionContentOption::getId,list2.get(i).getContentOptionId())
+                        .orderByAsc(PatrolInspectionContentOption::getId);
+                PatrolInspectionContentOption optionName1 = patrolInspectionContentOptionMapper.selectOne(queryWrapper2);
+                optionNameList.add(optionName1.getOptionName());
+            }
+        }
+        return optionNameList;
     }
 
+
+
 }

+ 890 - 0
service-fire/service-fire-biz/src/main/java/com/usky/fire/service/util/ExcelUtilImage.java

@@ -0,0 +1,890 @@
+package com.usky.fire.service.util;
+
+import com.ruoyi.common.core.annotation.Excel;
+import com.ruoyi.common.core.annotation.Excels;
+import com.ruoyi.common.core.annotation.Excel.ColumnType;
+import com.ruoyi.common.core.annotation.Excel.Type;
+import com.ruoyi.common.core.text.Convert;
+import com.ruoyi.common.core.utils.DateUtils;
+import com.ruoyi.common.core.utils.StringUtils;
+import com.ruoyi.common.core.utils.file.FileTypeUtils;
+import com.ruoyi.common.core.utils.file.ImageUtils;
+import com.ruoyi.common.core.utils.poi.ExcelHandlerAdapter;
+import com.ruoyi.common.core.utils.reflect.ReflectUtils;
+import java.io.IOException;
+import java.io.InputStream;
+import java.lang.reflect.Field;
+import java.lang.reflect.Method;
+import java.math.BigDecimal;
+import java.text.DecimalFormat;
+import java.time.LocalDate;
+import java.time.LocalDateTime;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Comparator;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.Map.Entry;
+import java.util.stream.Collectors;
+import javax.servlet.http.HttpServletResponse;
+
+import org.apache.commons.lang3.RegExUtils;
+import org.apache.poi.ss.usermodel.BorderStyle;
+import org.apache.poi.ss.usermodel.Cell;
+import org.apache.poi.ss.usermodel.CellStyle;
+import org.apache.poi.ss.usermodel.CellType;
+import org.apache.poi.ss.usermodel.ClientAnchor;
+import org.apache.poi.ss.usermodel.DataValidation;
+import org.apache.poi.ss.usermodel.DataValidationConstraint;
+import org.apache.poi.ss.usermodel.DataValidationHelper;
+import org.apache.poi.ss.usermodel.DateUtil;
+import org.apache.poi.ss.usermodel.Drawing;
+import org.apache.poi.ss.usermodel.FillPatternType;
+import org.apache.poi.ss.usermodel.Font;
+import org.apache.poi.ss.usermodel.HorizontalAlignment;
+import org.apache.poi.ss.usermodel.IndexedColors;
+import org.apache.poi.ss.usermodel.Row;
+import org.apache.poi.ss.usermodel.Sheet;
+import org.apache.poi.ss.usermodel.VerticalAlignment;
+import org.apache.poi.ss.usermodel.Workbook;
+import org.apache.poi.ss.usermodel.WorkbookFactory;
+import org.apache.poi.ss.util.CellRangeAddress;
+import org.apache.poi.ss.util.CellRangeAddressList;
+import org.apache.poi.util.IOUtils;
+import org.apache.poi.xssf.streaming.SXSSFWorkbook;
+import org.apache.poi.xssf.usermodel.XSSFClientAnchor;
+import org.apache.poi.xssf.usermodel.XSSFDataValidation;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * @description:TODO
+ * @author: fu
+ * @create: 2024-04-30 12:34
+ */
+public class ExcelUtilImage<T> {
+    private static final Logger log = LoggerFactory.getLogger(ExcelUtilImage.class);
+    public static final String FORMULA_REGEX_STR = "=|-|\\+|@";
+    public static final String[] FORMULA_STR = new String[]{"=", "-", "+", "@"};
+    public static final int sheetSize = 65536;
+    private String sheetName;
+    private Type type;
+    private Workbook wb;
+    private Sheet sheet;
+    private Map<String, CellStyle> styles;
+    private List<T> list;
+    private List<Object[]> fields;
+    private int rownum;
+    private String title;
+    private short maxHeight;
+    private Map<Integer, Double> statistics = new HashMap();
+    private static final DecimalFormat DOUBLE_FORMAT = new DecimalFormat("######0.00");
+    public Class<T> clazz;
+
+    public ExcelUtilImage(Class<T> clazz) {
+        this.clazz = clazz;
+    }
+
+    public void init(List<T> list, String sheetName, String title, Type type) {
+        if (list == null) {
+            list = new ArrayList();
+        }
+
+        this.list = (List)list;
+        this.sheetName = sheetName;
+        this.type = type;
+        this.title = title;
+        this.createExcelField();
+        this.createWorkbook();
+        this.createTitle();
+    }
+
+    public void createTitle() {
+        if (StringUtils.isNotEmpty(this.title)) {
+            Sheet var10000 = this.sheet;
+            int var10001;
+            if (this.rownum == 0) {
+                int var10003 = this.rownum;
+                var10001 = var10003;
+                this.rownum = var10003 + 1;
+            } else {
+                var10001 = 0;
+            }
+
+            Row titleRow = var10000.createRow(var10001);
+            titleRow.setHeightInPoints(30.0F);
+            Cell titleCell = titleRow.createCell(0);
+            titleCell.setCellStyle((CellStyle)this.styles.get("title"));
+            titleCell.setCellValue(this.title);
+            this.sheet.addMergedRegion(new CellRangeAddress(titleRow.getRowNum(), titleRow.getRowNum(), titleRow.getRowNum(), this.fields.size() - 1));
+        }
+
+    }
+
+    public List<T> importExcel(InputStream is) throws Exception {
+        return this.importExcel(is, 0);
+    }
+
+    public List<T> importExcel(InputStream is, int titleNum) throws Exception {
+        return this.importExcel("", is, titleNum);
+    }
+
+    public List<T> importExcel(String sheetName, InputStream is, int titleNum) throws Exception {
+        this.type = Type.IMPORT;
+        this.wb = WorkbookFactory.create(is);
+        List<T> list = new ArrayList();
+        Sheet sheet = StringUtils.isNotEmpty(sheetName) ? this.wb.getSheet(sheetName) : this.wb.getSheetAt(0);
+        if (sheet == null) {
+            throw new IOException("文件sheet不存在");
+        } else {
+            int rows = sheet.getLastRowNum();
+            if (rows > 0) {
+                Map<String, Integer> cellMap = new HashMap();
+                Row heard = sheet.getRow(titleNum);
+
+                for(int i = 0; i < heard.getPhysicalNumberOfCells(); ++i) {
+                    Cell cell = heard.getCell(i);
+                    if (StringUtils.isNotNull(cell)) {
+                        String value = this.getCellValue(heard, i).toString();
+                        cellMap.put(value, i);
+                    } else {
+                        cellMap.put(String.valueOf((Object)null), i);
+                    }
+                }
+
+                List<Object[]> fields = this.getFields();
+                Map<Integer, Object[]> fieldsMap = new HashMap();
+                Iterator var24 = fields.iterator();
+
+                while(var24.hasNext()) {
+                    Object[] objects = (Object[])var24.next();
+                    Excel attr = (Excel)objects[1];
+                    Integer column = (Integer)cellMap.get(attr.name());
+                    if (column != null) {
+                        fieldsMap.put(column, objects);
+                    }
+                }
+
+                for(int i = titleNum + 1; i <= rows; ++i) {
+                    Row row = sheet.getRow(i);
+                    if (!this.isRowEmpty(row)) {
+                        T entity = null;
+                        Iterator var28 = fieldsMap.entrySet().iterator();
+
+                        while(var28.hasNext()) {
+                            Entry<Integer, Object[]> entry = (Entry)var28.next();
+                            Object val = this.getCellValue(row, (Integer)entry.getKey());
+                            entity = entity == null ? this.clazz.newInstance() : entity;
+                            Field field = (Field)((Object[])entry.getValue())[0];
+                            Excel attr = (Excel)((Object[])entry.getValue())[1];
+                            Class<?> fieldType = field.getType();
+                            String propertyName;
+                            if (String.class == fieldType) {
+                                propertyName = Convert.toStr(val);
+                                if (StringUtils.endsWith(propertyName, ".0")) {
+                                    val = StringUtils.substringBefore(propertyName, ".0");
+                                } else {
+                                    String dateFormat = ((Excel)field.getAnnotation(Excel.class)).dateFormat();
+                                    if (StringUtils.isNotEmpty(dateFormat)) {
+                                        val = this.parseDateToStr(dateFormat, val);
+                                    } else {
+                                        val = Convert.toStr(val);
+                                    }
+                                }
+                            } else if ((Integer.TYPE == fieldType || Integer.class == fieldType) && StringUtils.isNumeric(Convert.toStr(val))) {
+                                val = Convert.toInt(val);
+                            } else if ((Long.TYPE == fieldType || Long.class == fieldType) && StringUtils.isNumeric(Convert.toStr(val))) {
+                                val = Convert.toLong(val);
+                            } else if (Double.TYPE != fieldType && Double.class != fieldType) {
+                                if (Float.TYPE != fieldType && Float.class != fieldType) {
+                                    if (BigDecimal.class == fieldType) {
+                                        val = Convert.toBigDecimal(val);
+                                    } else if (Date.class == fieldType) {
+                                        if (val instanceof String) {
+                                            val = DateUtils.parseDate(val);
+                                        } else if (val instanceof Double) {
+                                            val = DateUtil.getJavaDate((Double)val);
+                                        }
+                                    } else if (Boolean.TYPE == fieldType || Boolean.class == fieldType) {
+                                        val = Convert.toBool(val, false);
+                                    }
+                                } else {
+                                    val = Convert.toFloat(val);
+                                }
+                            } else {
+                                val = Convert.toDouble(val);
+                            }
+
+                            if (StringUtils.isNotNull(fieldType)) {
+                                propertyName = field.getName();
+                                if (StringUtils.isNotEmpty(attr.targetAttr())) {
+                                    propertyName = field.getName() + "." + attr.targetAttr();
+                                } else if (StringUtils.isNotEmpty(attr.readConverterExp())) {
+                                    val = reverseByExp(Convert.toStr(val), attr.readConverterExp(), attr.separator());
+                                } else if (!attr.handler().equals(ExcelHandlerAdapter.class)) {
+                                    val = this.dataFormatHandlerAdapter(val, attr);
+                                }
+
+                                ReflectUtils.invokeSetter(entity, propertyName, val);
+                            }
+                        }
+
+                        list.add(entity);
+                    }
+                }
+            }
+
+            return list;
+        }
+    }
+
+    public void exportExcel(HttpServletResponse response, List<T> list, String sheetName) {
+        this.exportExcel(response, list, sheetName, "");
+    }
+
+    public void exportExcel(HttpServletResponse response, List<T> list, String sheetName, String title) {
+        response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
+        response.setCharacterEncoding("utf-8");
+        this.init(list, sheetName, title, Type.EXPORT);
+        this.exportExcel(response);
+    }
+
+    public void importTemplateExcel(HttpServletResponse response, String sheetName) {
+        this.importTemplateExcel(response, sheetName, "");
+    }
+
+    public void importTemplateExcel(HttpServletResponse response, String sheetName, String title) {
+        response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
+        response.setCharacterEncoding("utf-8");
+        this.init((List)null, sheetName, title, Type.IMPORT);
+        this.exportExcel(response);
+    }
+
+    public void exportExcel(HttpServletResponse response) {
+        try {
+            this.writeSheet();
+            this.wb.write(response.getOutputStream());
+        } catch (Exception var6) {
+            log.error("导出Excel异常{}", var6.getMessage());
+        } finally {
+            IOUtils.closeQuietly(this.wb);
+        }
+
+    }
+
+    public void writeSheet() {
+        int sheetNo = Math.max(1, (int)Math.ceil((double)this.list.size() * 1.0D / 65536.0D));
+
+        for(int index = 0; index < sheetNo; ++index) {
+            this.createSheet(sheetNo, index);
+            Row row = this.sheet.createRow(this.rownum);
+            int column = 0;
+            Iterator var5 = this.fields.iterator();
+
+            while(var5.hasNext()) {
+                Object[] os = (Object[])var5.next();
+                Excel excel = (Excel)os[1];
+                this.createCell(excel, row, column++);
+            }
+
+            if (Type.EXPORT.equals(this.type)) {
+                this.fillExcelData(index, row);
+                this.addStatisticsRow();
+            }
+        }
+
+    }
+
+
+/*    public void fillExcelData(int index, Row row) {
+        int startNo = index * 65536;
+        int endNo = Math.min(startNo + 65536, this.list.size());
+
+        for(int i = startNo; i < endNo; ++i) {
+            row = this.sheet.createRow(i + 1 + this.rownum - startNo);
+            T vo = this.list.get(i);
+            int column = 0;
+            Iterator var8 = this.fields.iterator();
+
+            while(var8.hasNext()) {
+                Object[] os = (Object[])var8.next();
+                Field field = (Field)os[0];
+                Excel excel = (Excel)os[1];
+                this.addCell(excel, row, vo, field, column++);
+            }
+        }
+    }*/
+
+
+
+/*    public void fillExcelData(int index, Row row) {
+        int startNo = index * 65536;
+        int endNo = Math.min(startNo + 65536, this.list.size());
+
+        for (int i = startNo; i < endNo; ++i) {
+            row = this.sheet.createRow(i + 1 + this.rownum - startNo);
+            T vo = this.list.get(i);
+            int column = 0;
+            Iterator var8 = this.fields.iterator();
+
+            while (var8.hasNext()) {
+                Object[] os = (Object[]) var8.next();
+                Field field = (Field) os[0];
+                Excel excel = (Excel) os[1];
+                if (excel.isExport()) {
+                    if (field.getType().isAssignableFrom(List.class)) {
+                        // 处理List类型的字段
+                        List<?> listValue = null;
+                        try {
+                            listValue = (List<?>) this.getTargetValue(vo, field, excel);
+                        } catch (Exception e) {
+                            e.printStackTrace();
+                        }
+                        for (Object item : listValue) {
+                            Cell cell = row.createCell(column);
+                            cell.setCellValue(item.toString());
+                            column++;
+                        }
+                    } else {
+                        // 处理非List类型的字段
+                        this.addCell(excel, row, vo, field, column++);
+                    }
+                }
+            }
+        }
+    }*/
+
+        public void fillExcelData(int index, Row row) {
+        int startNo = index * 65536;
+        int endNo = Math.min(startNo + 65536, this.list.size());
+
+        for (int i = startNo; i < endNo; ++i) {
+            row = this.sheet.createRow(i + 1 + this.rownum - startNo);
+            T vo = this.list.get(i);
+            int column = 0;
+            Iterator<Object[]> var8 = this.fields.iterator();
+
+            while (var8.hasNext()) {
+                Object[] os = (Object[]) var8.next();
+                Field field = (Field) os[0];
+                Excel excel = (Excel) os[1];
+                if (excel.isExport()) {
+                    if (field.getType().isAssignableFrom(List.class)) {
+                        // 处理List类型的字段
+                        addListCell(excel, row, vo, field, column);
+                        try {
+                            column += ((List<?>) this.getTargetValue(vo, field, excel)).size();
+                        } catch (Exception e) {
+                            e.printStackTrace();
+                        }
+                    } else {
+                        // 处理非List类型的字段
+                        addCell(excel, row, vo, field, column++);
+                    }
+                }
+            }
+        }
+    }
+
+    public void addListCell(Excel attr, Row row, T vo, Field field, int column) {
+        try {
+            Object value = this.getTargetValue(vo, field, attr);
+            if (value instanceof List) {
+                List<?> listValue = (List<?>) value;
+                for (int j = 0; j < listValue.size(); j++) {
+                    Cell cell = row.createCell(column + j);
+                    cell.setCellValue(listValue.get(j).toString());
+                }
+            }
+        } catch (Exception e) {
+            log.error("导出Excel失败{}", e);
+        }
+    }
+
+/*    public Cell addListCell(Excel attr, Row row, T vo, Field field, int column) {
+        Cell cell = row.createCell(column);
+        StringBuilder sb = new StringBuilder();
+        try {
+            Object value = this.getTargetValue(vo, field, attr);
+            if (value instanceof List) {
+                List<?> listValue = (List<?>) value;
+                for (int j = 0; j < listValue.size(); j++) {
+                    sb.append(listValue.get(j).toString());
+                    if (j < listValue.size() - 1) {
+                        sb.append("");
+                    }
+                }
+            }
+            cell.setCellValue(sb.toString());
+        } catch (Exception e) {
+            log.error("导出Excel失败{}", e);
+        }
+        return cell;
+    }*/
+
+    private Map<String, CellStyle> createStyles(Workbook wb) {
+        Map<String, CellStyle> styles = new HashMap();
+        CellStyle style = wb.createCellStyle();
+        style.setAlignment(HorizontalAlignment.CENTER);
+        style.setVerticalAlignment(VerticalAlignment.CENTER);
+        Font titleFont = wb.createFont();
+        titleFont.setFontName("Arial");
+        titleFont.setFontHeightInPoints((short)16);
+        titleFont.setBold(true);
+        style.setFont(titleFont);
+        styles.put("title", style);
+        style = wb.createCellStyle();
+        style.setAlignment(HorizontalAlignment.CENTER);
+        style.setVerticalAlignment(VerticalAlignment.CENTER);
+        style.setBorderRight(BorderStyle.THIN);
+        style.setRightBorderColor(IndexedColors.GREY_50_PERCENT.getIndex());
+        style.setBorderLeft(BorderStyle.THIN);
+        style.setLeftBorderColor(IndexedColors.GREY_50_PERCENT.getIndex());
+        style.setBorderTop(BorderStyle.THIN);
+        style.setTopBorderColor(IndexedColors.GREY_50_PERCENT.getIndex());
+        style.setBorderBottom(BorderStyle.THIN);
+        style.setBottomBorderColor(IndexedColors.GREY_50_PERCENT.getIndex());
+        Font dataFont = wb.createFont();
+        dataFont.setFontName("Arial");
+        dataFont.setFontHeightInPoints((short)10);
+        style.setFont(dataFont);
+        styles.put("data", style);
+        style = wb.createCellStyle();
+        style.cloneStyleFrom((CellStyle)styles.get("data"));
+        style.setAlignment(HorizontalAlignment.CENTER);
+        style.setVerticalAlignment(VerticalAlignment.CENTER);
+        style.setFillForegroundColor(IndexedColors.GREY_50_PERCENT.getIndex());
+        style.setFillPattern(FillPatternType.SOLID_FOREGROUND);
+        Font headerFont = wb.createFont();
+        headerFont.setFontName("Arial");
+        headerFont.setFontHeightInPoints((short)10);
+        headerFont.setBold(true);
+        headerFont.setColor(IndexedColors.WHITE.getIndex());
+        style.setFont(headerFont);
+        styles.put("header", style);
+        style = wb.createCellStyle();
+        style.setAlignment(HorizontalAlignment.CENTER);
+        style.setVerticalAlignment(VerticalAlignment.CENTER);
+        Font totalFont = wb.createFont();
+        totalFont.setFontName("Arial");
+        totalFont.setFontHeightInPoints((short)10);
+        style.setFont(totalFont);
+        styles.put("total", style);
+        style = wb.createCellStyle();
+        style.cloneStyleFrom((CellStyle)styles.get("data"));
+        style.setAlignment(HorizontalAlignment.LEFT);
+        styles.put("data1", style);
+        style = wb.createCellStyle();
+        style.cloneStyleFrom((CellStyle)styles.get("data"));
+        style.setAlignment(HorizontalAlignment.CENTER);
+        styles.put("data2", style);
+        style = wb.createCellStyle();
+        style.cloneStyleFrom((CellStyle)styles.get("data"));
+        style.setAlignment(HorizontalAlignment.RIGHT);
+        styles.put("data3", style);
+        return styles;
+    }
+
+    public Cell createCell(Excel attr, Row row, int column) {
+        Cell cell = row.createCell(column);
+        cell.setCellValue(attr.name());
+        this.setDataValidation(attr, row, column);
+        cell.setCellStyle((CellStyle)this.styles.get("header"));
+        return cell;
+    }
+
+    public void setCellVo(Object value, Excel attr, Cell cell) {
+        if (ColumnType.STRING == attr.cellType()) {
+            String cellValue = Convert.toStr(value);
+            if (StringUtils.startsWithAny(cellValue, FORMULA_STR)) {
+                cellValue = RegExUtils.replaceFirst(cellValue, "=|-|\\+|@", "\t$0");
+            }
+
+            cell.setCellValue(StringUtils.isNull(cellValue) ? attr.defaultValue() : cellValue + attr.suffix());
+        } else if (ColumnType.NUMERIC == attr.cellType()) {
+            if (StringUtils.isNotNull(value)) {
+                cell.setCellValue(StringUtils.contains(Convert.toStr(value), ".") ? Convert.toDouble(value) : (double)Convert.toInt(value));
+            }
+        } else if (ColumnType.IMAGE == attr.cellType()) {
+            ClientAnchor anchor = new XSSFClientAnchor(0, 0, 0, 0, (short)cell.getColumnIndex(), cell.getRow().getRowNum(), (short)(cell.getColumnIndex() + 1), cell.getRow().getRowNum() + 1);
+            String imagePath = Convert.toStr(value);
+            if (StringUtils.isNotEmpty(imagePath)) {
+                byte[] data = ImageUtils.getImage(imagePath);
+                getDrawingPatriarch(cell.getSheet()).createPicture(anchor, cell.getSheet().getWorkbook().addPicture(data, this.getImageType(data)));
+            }
+        }
+
+    }
+
+    public static Drawing<?> getDrawingPatriarch(Sheet sheet) {
+        if (sheet.getDrawingPatriarch() == null) {
+            sheet.createDrawingPatriarch();
+        }
+
+        return sheet.getDrawingPatriarch();
+    }
+
+    public int getImageType(byte[] value) {
+        String type = FileTypeUtils.getFileExtendName(value);
+        if ("JPG".equalsIgnoreCase(type)) {
+            return 5;
+        } else {
+            return "PNG".equalsIgnoreCase(type) ? 6 : 5;
+        }
+    }
+
+    public void setDataValidation(Excel attr, Row row, int column) {
+        if (attr.name().indexOf("注:") >= 0) {
+            this.sheet.setColumnWidth(column, 6000);
+        } else {
+            this.sheet.setColumnWidth(column, (int)((attr.width() + 0.72D) * 256.0D));
+        }
+
+        if (StringUtils.isNotEmpty(attr.prompt()) || attr.combo().length > 0) {
+            this.setPromptOrValidation(this.sheet, attr.combo(), attr.prompt(), 1, 100, column, column);
+        }
+
+    }
+
+    public Cell addCell(Excel attr, Row row, T vo, Field field, int column) {
+        Cell cell = null;
+
+        try {
+            row.setHeight(this.maxHeight);
+            if (attr.isExport()) {
+                cell = row.createCell(column);
+                int align = attr.align().value();
+                cell.setCellStyle((CellStyle)this.styles.get("data" + (align >= 1 && align <= 3 ? align : "")));
+                Object value = this.getTargetValue(vo, field, attr);
+                String dateFormat = attr.dateFormat();
+                String readConverterExp = attr.readConverterExp();
+                String separator = attr.separator();
+                if (StringUtils.isNotEmpty(dateFormat) && StringUtils.isNotNull(value)) {
+                    cell.setCellValue(this.parseDateToStr(dateFormat, value));
+                } else if (StringUtils.isNotEmpty(readConverterExp) && StringUtils.isNotNull(value)) {
+                    cell.setCellValue(convertByExp(Convert.toStr(value), readConverterExp, separator));
+                } else if (value instanceof BigDecimal && -1 != attr.scale()) {
+                    cell.setCellValue(((BigDecimal)value).setScale(attr.scale(), attr.roundingMode()).toString());
+                } else if (!attr.handler().equals(ExcelHandlerAdapter.class)) {
+                    cell.setCellValue(this.dataFormatHandlerAdapter(value, attr));
+                } else {
+                    this.setCellVo(value, attr, cell);
+                }
+
+                this.addStatisticsData(column, Convert.toStr(value), attr);
+            }
+        } catch (Exception var12) {
+            log.error("导出Excel失败{}", var12);
+        }
+
+        return cell;
+    }
+
+    public void setPromptOrValidation(Sheet sheet, String[] textlist, String promptContent, int firstRow, int endRow, int firstCol, int endCol) {
+        DataValidationHelper helper = sheet.getDataValidationHelper();
+        DataValidationConstraint constraint = textlist.length > 0 ? helper.createExplicitListConstraint(textlist) : helper.createCustomConstraint("DD1");
+        CellRangeAddressList regions = new CellRangeAddressList(firstRow, endRow, firstCol, endCol);
+        DataValidation dataValidation = helper.createValidation(constraint, regions);
+        if (StringUtils.isNotEmpty(promptContent)) {
+            dataValidation.createPromptBox("", promptContent);
+            dataValidation.setShowPromptBox(true);
+        }
+
+        if (dataValidation instanceof XSSFDataValidation) {
+            dataValidation.setSuppressDropDownArrow(true);
+            dataValidation.setShowErrorBox(true);
+        } else {
+            dataValidation.setSuppressDropDownArrow(false);
+        }
+
+        sheet.addValidationData(dataValidation);
+    }
+
+    public static String convertByExp(String propertyValue, String converterExp, String separator) {
+        StringBuilder propertyString = new StringBuilder();
+        String[] convertSource = converterExp.split(",");
+        String[] var5 = convertSource;
+        int var6 = convertSource.length;
+
+        for(int var7 = 0; var7 < var6; ++var7) {
+            String item = var5[var7];
+            String[] itemArray = item.split("=");
+            if (StringUtils.containsAny(separator, propertyValue)) {
+                String[] var10 = propertyValue.split(separator);
+                int var11 = var10.length;
+
+                for(int var12 = 0; var12 < var11; ++var12) {
+                    String value = var10[var12];
+                    if (itemArray[0].equals(value)) {
+                        propertyString.append(itemArray[1] + separator);
+                        break;
+                    }
+                }
+            } else if (itemArray[0].equals(propertyValue)) {
+                return itemArray[1];
+            }
+        }
+
+        return StringUtils.stripEnd(propertyString.toString(), separator);
+    }
+
+    public static String reverseByExp(String propertyValue, String converterExp, String separator) {
+        StringBuilder propertyString = new StringBuilder();
+        String[] convertSource = converterExp.split(",");
+        String[] var5 = convertSource;
+        int var6 = convertSource.length;
+
+        for(int var7 = 0; var7 < var6; ++var7) {
+            String item = var5[var7];
+            String[] itemArray = item.split("=");
+            if (StringUtils.containsAny(separator, propertyValue)) {
+                String[] var10 = propertyValue.split(separator);
+                int var11 = var10.length;
+
+                for(int var12 = 0; var12 < var11; ++var12) {
+                    String value = var10[var12];
+                    if (itemArray[1].equals(value)) {
+                        propertyString.append(itemArray[0] + separator);
+                        break;
+                    }
+                }
+            } else if (itemArray[1].equals(propertyValue)) {
+                return itemArray[0];
+            }
+        }
+
+        return StringUtils.stripEnd(propertyString.toString(), separator);
+    }
+
+    public String dataFormatHandlerAdapter(Object value, Excel excel) {
+        try {
+            Object instance = excel.handler().newInstance();
+            Method formatMethod = excel.handler().getMethod("format", Object.class, String[].class);
+            value = formatMethod.invoke(instance, value, excel.args());
+        } catch (Exception var5) {
+            log.error("不能格式化数据 " + excel.handler(), var5.getMessage());
+        }
+
+        return Convert.toStr(value);
+    }
+
+    private void addStatisticsData(Integer index, String text, Excel entity) {
+        if (entity != null && entity.isStatistics()) {
+            Double temp = 0.0D;
+            if (!this.statistics.containsKey(index)) {
+                this.statistics.put(index, temp);
+            }
+
+            try {
+                temp = Double.valueOf(text);
+            } catch (NumberFormatException var6) {
+            }
+
+            this.statistics.put(index, (Double)this.statistics.get(index) + temp);
+        }
+
+    }
+
+    public void addStatisticsRow() {
+        if (this.statistics.size() > 0) {
+            Row row = this.sheet.createRow(this.sheet.getLastRowNum() + 1);
+            Set<Integer> keys = this.statistics.keySet();
+            Cell cell = row.createCell(0);
+            cell.setCellStyle((CellStyle)this.styles.get("total"));
+            cell.setCellValue("合计");
+            Iterator var4 = keys.iterator();
+
+            while(var4.hasNext()) {
+                Integer key = (Integer)var4.next();
+                cell = row.createCell(key);
+                cell.setCellStyle((CellStyle)this.styles.get("total"));
+                cell.setCellValue(DOUBLE_FORMAT.format(this.statistics.get(key)));
+            }
+
+            this.statistics.clear();
+        }
+
+    }
+
+    private Object getTargetValue(T vo, Field field, Excel excel) throws Exception {
+        Object o = field.get(vo);
+        if (StringUtils.isNotEmpty(excel.targetAttr())) {
+            String target = excel.targetAttr();
+            if (target.contains(".")) {
+                String[] targets = target.split("[.]");
+                String[] var7 = targets;
+                int var8 = targets.length;
+
+                for(int var9 = 0; var9 < var8; ++var9) {
+                    String name = var7[var9];
+                    o = this.getValue(o, name);
+                }
+            } else {
+                o = this.getValue(o, target);
+            }
+        }
+
+        return o;
+    }
+
+    private Object getValue(Object o, String name) throws Exception {
+        if (StringUtils.isNotNull(o) && StringUtils.isNotEmpty(name)) {
+            Class<?> clazz = o.getClass();
+            Field field = clazz.getDeclaredField(name);
+            field.setAccessible(true);
+            o = field.get(o);
+        }
+
+        return o;
+    }
+
+    private void createExcelField() {
+        this.fields = this.getFields();
+        this.fields = (List)this.fields.stream().sorted(Comparator.comparing((objects) -> {
+            return ((Excel)objects[1]).sort();
+        })).collect(Collectors.toList());
+        this.maxHeight = this.getRowHeight();
+    }
+
+    public List<Object[]> getFields() {
+        List<Object[]> fields = new ArrayList();
+        List<Field> tempFields = new ArrayList();
+        tempFields.addAll(Arrays.asList(this.clazz.getSuperclass().getDeclaredFields()));
+        tempFields.addAll(Arrays.asList(this.clazz.getDeclaredFields()));
+        Iterator var3 = tempFields.iterator();
+
+        while(true) {
+            Field field;
+            do {
+                if (!var3.hasNext()) {
+                    return fields;
+                }
+
+                field = (Field)var3.next();
+                if (field.isAnnotationPresent(Excel.class)) {
+                    Excel attr = (Excel)field.getAnnotation(Excel.class);
+                    if (attr != null && (attr.type() == Type.ALL || attr.type() == this.type)) {
+                        field.setAccessible(true);
+                        fields.add(new Object[]{field, attr});
+                    }
+                }
+            } while(!field.isAnnotationPresent(Excels.class));
+
+            Excels attrs = (Excels)field.getAnnotation(Excels.class);
+            Excel[] excels = attrs.value();
+            Excel[] var7 = excels;
+            int var8 = excels.length;
+
+            for(int var9 = 0; var9 < var8; ++var9) {
+                Excel attr = var7[var9];
+                if (attr != null && (attr.type() == Type.ALL || attr.type() == this.type)) {
+                    field.setAccessible(true);
+                    fields.add(new Object[]{field, attr});
+                }
+            }
+        }
+    }
+
+    public short getRowHeight() {
+        double maxHeight = 0.0D;
+
+        Excel excel;
+        for(Iterator var3 = this.fields.iterator(); var3.hasNext(); maxHeight = Math.max(maxHeight, excel.height())) {
+            Object[] os = (Object[])var3.next();
+            excel = (Excel)os[1];
+        }
+
+        return (short)((int)(maxHeight * 20.0D));
+    }
+
+    public void createWorkbook() {
+        this.wb = new SXSSFWorkbook(500);
+        this.sheet = this.wb.createSheet();
+        this.wb.setSheetName(0, this.sheetName);
+        this.styles = this.createStyles(this.wb);
+    }
+
+    public void createSheet(int sheetNo, int index) {
+        if (sheetNo > 1 && index > 0) {
+            this.sheet = this.wb.createSheet();
+            this.createTitle();
+            this.wb.setSheetName(index, this.sheetName + index);
+        }
+
+    }
+
+    public Object getCellValue(Row row, int column) {
+        if (row == null) {
+            return row;
+        } else {
+            Object val = "";
+
+            try {
+                Cell cell = row.getCell(column);
+                if (StringUtils.isNotNull(cell)) {
+                    if (cell.getCellType() != CellType.NUMERIC && cell.getCellType() != CellType.FORMULA) {
+                        if (cell.getCellType() == CellType.STRING) {
+                            val = cell.getStringCellValue();
+                        } else if (cell.getCellType() == CellType.BOOLEAN) {
+                            val = cell.getBooleanCellValue();
+                        } else if (cell.getCellType() == CellType.ERROR) {
+                            val = cell.getErrorCellValue();
+                        }
+                    } else {
+                        val = cell.getNumericCellValue();
+                        if (DateUtil.isCellDateFormatted(cell)) {
+                            val = DateUtil.getJavaDate((Double)val);
+                        } else if ((Double)val % 1.0D != 0.0D) {
+                            val = new BigDecimal(val.toString());
+                        } else {
+                            val = (new DecimalFormat("0")).format(val);
+                        }
+                    }
+                }
+
+                return val;
+            } catch (Exception var5) {
+                return val;
+            }
+        }
+    }
+
+    private boolean isRowEmpty(Row row) {
+        if (row == null) {
+            return true;
+        } else {
+            for(int i = row.getFirstCellNum(); i < row.getLastCellNum(); ++i) {
+                Cell cell = row.getCell(i);
+                if (cell != null && cell.getCellType() != CellType.BLANK) {
+                    return false;
+                }
+            }
+
+            return true;
+        }
+    }
+
+    public String parseDateToStr(String dateFormat, Object val) {
+        if (val == null) {
+            return "";
+        } else {
+            String str;
+            if (val instanceof Date) {
+                str = DateUtils.parseDateToStr(dateFormat, (Date)val);
+            } else if (val instanceof LocalDateTime) {
+                str = DateUtils.parseDateToStr(dateFormat, DateUtils.toDate((LocalDateTime)val));
+            } else if (val instanceof LocalDate) {
+                str = DateUtils.parseDateToStr(dateFormat, DateUtils.toDate((LocalDate)val));
+            } else {
+                str = val.toString();
+            }
+
+            return str;
+        }
+    }
+}
+

+ 37 - 5
service-fire/service-fire-biz/src/main/java/com/usky/fire/service/vo/PatrolInspectionRecordExportVo.java

@@ -8,6 +8,7 @@ import lombok.EqualsAndHashCode;
 import lombok.experimental.Accessors;
 
 import java.io.Serializable;
+import java.util.List;
 
 /**
  * <p>
@@ -143,29 +144,60 @@ public class PatrolInspectionRecordExportVo implements Serializable {
      */
     private String creator;
 
+    /**
+     * 巡检备注
+     */
+    @Excel(name = "巡检备注")
+    private String remarks;
+
+    /**
+     * 内容标题
+     */
+    @Excel(name = "内容标题")
+    private List<String> contentTitle;
+
+    /**
+     * 提交方式
+     */
+    @Excel(name = "提交方式")
+    private List<String> submissionMethod;
+
+    /**
+     * 选项内容
+     */
+    @Excel(name = "选项内容")
+    private List<String> optionName;
+
+    /**
+     * 内容备注
+     */
+    @Excel(name = "内容备注")
+    private List<String> contentRemarks;
+
     /**
      * 图片数据
      */
-    @Excel(name = "巡检照片1")
+    @Excel(name = "巡检照片1", cellType = Excel.ColumnType.IMAGE)
     private String imagePath1;
     /**
      * 图片数据
      */
-    @Excel(name = "巡检照片2")
+    @Excel(name = "巡检照片2", cellType = Excel.ColumnType.IMAGE)
     private String imagePath2;
     /**
      * 图片数据
      */
-    @Excel(name = "巡检照片3")
+    @Excel(name = "巡检照片3", cellType = Excel.ColumnType.IMAGE)
     private String imagePath3;
     /**
      * 图片数据
      */
-    @Excel(name = "巡检照片4")
+    @Excel(name = "巡检照片4", cellType = Excel.ColumnType.IMAGE)
     private String imagePath4;
     /**
      * 图片数据
      */
-    @Excel(name = "巡检照片5")
+    @Excel(name = "巡检照片5", cellType = Excel.ColumnType.IMAGE)
     private String imagePath5;
+
 }