Selaa lähdekoodia

生成报告内容PDF

hanzhengyi 2 vuotta sitten
vanhempi
commit
772c992850

+ 16 - 0
service-fire/service-fire-biz/pom.xml

@@ -73,6 +73,22 @@
             <version>1.54</version>
         </dependency>
 
+        <dependency>
+            <groupId>com.lowagie</groupId>
+            <artifactId>itext</artifactId>
+            <version>2.1.7</version>
+        </dependency>
+        <dependency>
+            <groupId>com.itextpdf</groupId>
+            <artifactId>itext-asian</artifactId>
+            <version>5.2.0</version>
+        </dependency>
+        <dependency>
+            <groupId>com.itextpdf</groupId>
+            <artifactId>itextpdf</artifactId>
+            <version>5.4.3</version>
+        </dependency>
+
     </dependencies>
 
     <build>

+ 11 - 0
service-fire/service-fire-biz/src/main/java/com/usky/fire/controller/web/DemReportInfoController.java

@@ -71,5 +71,16 @@ public class DemReportInfoController {
         demReportInfoService.propelsReport(demReportInfoIdVo);
         return ApiResult.success();
     }
+
+    /**
+     * 消防报告-查询
+     *
+     * @param id   报告主键ID
+     * @return
+     */
+    @GetMapping("reportById")
+    public ApiResult<List<DemReportInfo>> reportById(@RequestParam(value = "id", required = false) Integer id) {
+        return ApiResult.success(demReportInfoService.reportById(id));
+    }
 }
 

+ 10 - 0
service-fire/service-fire-biz/src/main/java/com/usky/fire/controller/web/TaskController.java

@@ -32,6 +32,9 @@ public class TaskController {
     @Autowired
     private DemInspectListService demInspectListService;
 
+    @Autowired
+    private DemReportDataService demReportDataService;
+
     //    @Scheduled(cron = "0/5 * *  * * ?") // 间隔5秒执行
     @Scheduled(cron = "0 0/5 * * * ? ") // 间隔5分钟执行
     public void task() {
@@ -60,5 +63,12 @@ public class TaskController {
         demInspectListService.demInspectAutoTask();
     }
 
+    @Scheduled(cron = "0 0 2 * * ? ")//每天凌晨2点
+//    @Scheduled(cron = "0 0/5 * * * ? ") // 间隔5分钟执行
+    public void task4() {
+        System.out.println(Thread.currentThread().getName() + "消防报告生成定时任务执行中");
+        demReportDataService.regularReportData();
+    }
+
 }
 

+ 5 - 0
service-fire/service-fire-biz/src/main/java/com/usky/fire/domain/DemReportInfo.java

@@ -62,6 +62,11 @@ public class DemReportInfo implements Serializable {
      */
     private LocalDateTime endTime;
 
+    /**
+     * 统计月份
+     */
+    private String statisticsTime;
+
     /**
      * 报告状态(0 未推送、1 已推送)
      */

+ 8 - 0
service-fire/service-fire-biz/src/main/java/com/usky/fire/service/DemReportInfoService.java

@@ -43,4 +43,12 @@ public interface DemReportInfoService extends CrudService<DemReportInfo> {
      * @return
      */
     void propelsReport(DemReportInfoIdVo demReportInfoIdVo);
+
+    /**
+     * 消防报告-查询
+     *
+     * @param id   报告主键ID
+     * @return
+     */
+    List<DemReportInfo> reportById(Integer id);
 }

+ 57 - 0
service-fire/service-fire-biz/src/main/java/com/usky/fire/service/config/pdf/MyHeaderFooter.java

@@ -0,0 +1,57 @@
+package com.usky.fire.service.config.pdf;
+
+import com.itextpdf.text.*;
+import com.itextpdf.text.pdf.*;
+
+import java.io.IOException;
+
+public class MyHeaderFooter extends PdfPageEventHelper {
+    // 总页数
+    PdfTemplate totalPage;
+    Font hfFont;
+    {
+        try {
+            hfFont = new Font(BaseFont.createFont("STSong-Light", "UniGB-UCS2-H", BaseFont.NOT_EMBEDDED), 8, Font.NORMAL);
+        } catch (DocumentException e) {
+            e.printStackTrace();
+        } catch (IOException e) {
+            e.printStackTrace();
+        }
+    }
+
+    // 打开文档时,创建一个总页数的模版
+    public void onOpenDocument(PdfWriter writer, Document document) {
+        PdfContentByte cb =writer.getDirectContent();
+        totalPage = cb.createTemplate(30, 16);
+    }
+    // 一页加载完成触发,写入页眉和页脚
+    public void onEndPage(PdfWriter writer, Document document) {
+        PdfPTable table = new PdfPTable(3);
+        try {
+            table.setTotalWidth(PageSize.A4.getWidth() - 100);
+            table.setWidths(new int[] { 24, 24, 3});
+            table.setLockedWidth(true);
+            table.getDefaultCell().setFixedHeight(-10);
+            table.getDefaultCell().setBorder(Rectangle.BOTTOM);
+
+            table.addCell(new Paragraph("我是页眉/页脚", hfFont));// 可以直接使用addCell(str),不过不能指定字体,中文无法显示
+            table.getDefaultCell().setHorizontalAlignment(Element.ALIGN_RIGHT);
+            table.addCell(new Paragraph("第" + writer.getPageNumber() + "页/", hfFont));
+// 总页数
+            PdfPCell cell = new PdfPCell(Image.getInstance(totalPage));
+            cell.setBorder(Rectangle.BOTTOM);
+            table.addCell(cell);
+// 将页眉写到document中,位置可以指定,指定到下面就是页脚
+            table.writeSelectedRows(0, -1, 50,PageSize.A4.getHeight() - 20, writer.getDirectContent());
+        } catch (Exception de) {
+            throw new ExceptionConverter(de);
+        }
+    }
+
+    // 全部完成后,将总页数的pdf模版写到指定位置
+    public void onCloseDocument(PdfWriter writer,Document document) {
+        String text = "总" + (writer.getPageNumber()-1) + "页";
+        ColumnText.showTextAligned(totalPage, Element.ALIGN_LEFT, new Paragraph(text,hfFont), 2, 2, 0);
+    }
+
+}

+ 32 - 0
service-fire/service-fire-biz/src/main/java/com/usky/fire/service/config/pdf/Watermark.java

@@ -0,0 +1,32 @@
+package com.usky.fire.service.config.pdf;
+
+import com.itextpdf.text.Document;
+import com.itextpdf.text.Element;
+import com.itextpdf.text.Font;
+import com.itextpdf.text.Phrase;
+import com.itextpdf.text.pdf.ColumnText;
+import com.itextpdf.text.pdf.GrayColor;
+import com.itextpdf.text.pdf.PdfPageEventHelper;
+import com.itextpdf.text.pdf.PdfWriter;
+
+public class Watermark extends PdfPageEventHelper {
+    Font FONT = new Font(Font.FontFamily.HELVETICA, 30, Font.BOLD, new GrayColor(0.95f));
+    private String waterCont;//水印内容
+    public Watermark(String waterCont) {
+        this.waterCont = waterCont;
+    }
+
+    @Override
+    public void onEndPage(PdfWriter writer, Document document) {
+        for(int i=0 ; i<5; i++) {
+            for(int j=0; j<5; j++) {
+                ColumnText.showTextAligned(writer.getDirectContentUnder(),
+                        Element.ALIGN_CENTER,
+                        new Phrase(this.waterCont == null ? "HELLO WORLD" : this.waterCont, FONT),
+                        (50.5f+i*350),
+                        (40.0f+j*150),
+                        writer.getPageNumber() % 2 == 1 ? 45 : -45);
+            }
+        }
+    }
+}

+ 3 - 2
service-fire/service-fire-biz/src/main/java/com/usky/fire/service/impl/BaseCompanyServiceImpl.java

@@ -1008,9 +1008,10 @@ public class BaseCompanyServiceImpl extends AbstractCrudService<BaseCompanyMappe
     @Override
     public List<BaseCompany> companyIdByTypeList(String companyType) {
         LambdaQueryWrapper<BaseCompany> queryWrapper = Wrappers.lambdaQuery();
-        queryWrapper.select(BaseCompany::getId,BaseCompany::getCompanyId, BaseCompany::getCompanyCode)
+        queryWrapper.select(BaseCompany::getId,BaseCompany::getCompanyId, BaseCompany::getCompanyCode,
+                BaseCompany::getCompanyName)
                 .eq(BaseCompany::getEnable, 0)
-                .eq(StringUtils.isNotBlank(companyType), BaseCompany::getStreetTown, companyType);
+                .eq(StringUtils.isNotBlank(companyType), BaseCompany::getCompanyType, companyType);
         List<BaseCompany> list = this.list(queryWrapper);
         return list;
     }

+ 480 - 3
service-fire/service-fire-biz/src/main/java/com/usky/fire/service/impl/DemReportDataServiceImpl.java

@@ -3,16 +3,31 @@ package com.usky.fire.service.impl;
 import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
 import com.usky.fire.domain.BaseCompany;
 import com.usky.fire.domain.DemReportData;
+import com.usky.fire.domain.DemReportInfo;
 import com.usky.fire.mapper.DemReportDataMapper;
 import com.usky.fire.service.BaseCompanyService;
 import com.usky.fire.service.DemReportDataService;
 import com.usky.common.mybatis.core.AbstractCrudService;
+import com.usky.fire.service.DemReportInfoService;
+import com.usky.fire.service.config.pdf.MyHeaderFooter;
+import com.usky.fire.service.config.pdf.Watermark;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
+import java.io.File;
+import java.io.FileOutputStream;
+import java.time.LocalDateTime;
+import java.util.Calendar;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
+import com.itextpdf.text.*;
+import com.itextpdf.text.pdf.*;
+import com.itextpdf.text.pdf.draw.DottedLineSeparator;
+import com.itextpdf.text.pdf.draw.LineSeparator;
+
+import java.io.File;
+import java.io.FileOutputStream;
 
 /**
  * <p>
@@ -27,16 +42,478 @@ public class DemReportDataServiceImpl extends AbstractCrudService<DemReportDataM
     @Autowired
     private BaseCompanyService baseCompanyService;
 
+    @Autowired
+    private DemReportInfoService demReportInfoService;
+
     @Override
     public void regularReportData() {
-        List<BaseCompany> baseCompanies = baseCompanyService.companyIdByTypeList("1");
-        if (CollectionUtils.isNotEmpty(baseCompanies)) {
-            for (int i = 0; i < baseCompanies.size(); i++) {
+        try {
+            List<BaseCompany> baseCompanies = baseCompanyService.companyIdByTypeList("1");
+            if (CollectionUtils.isNotEmpty(baseCompanies)) {
+                Calendar now = Calendar.getInstance();
+                for (int i = 0; i < baseCompanies.size(); i++) {
+                    // 1.新建document对象
+                    Document document = new Document(PageSize.A4);// 建立一个Document对象
+
+// 2.建立一个书写器(Writer)与document对象关联
+                    File file = new File("/var/www/usky-file/202303/"+now.get(Calendar.YEAR)+now.get(Calendar.MONTH)+baseCompanies.get(i).getCompanyId()+".pdf");
+//                    File file = new File("D:\\"+now.get(Calendar.YEAR)+now.get(Calendar.MONTH)+baseCompanies.get(i).getCompanyId()+".pdf");
+                    file.createNewFile();
+                    PdfWriter writer = PdfWriter.getInstance(document, new FileOutputStream(file));
+//                    writer.setPageEvent(new Watermark("hello word"));// 水印
+                    writer.setPageEvent(new MyHeaderFooter());// 页眉/页脚
+                    // 3.打开文档
+                    document.open();
+                    document.addTitle("Title@PDF-Java");// 标题
+                    document.addAuthor("Author@umiz");// 作者
+                    document.addSubject("Subject@iText pdf sample");// 主题
+                    document.addKeywords("Keywords@iTextpdf");// 关键字
+                    document.addCreator("Creator@umiz`s");// 创建者
 
+// 4.向文档中添加内容
+                    this.generatePDF(document,baseCompanies.get(i).getCompanyName());
+
+// 5.关闭文档
+                    document.close();
+                    DemReportInfo demReportInfo = new DemReportInfo();
+                    demReportInfo.setCompanyId(baseCompanies.get(i).getCompanyId());
+                    demReportInfo.setCompanyCode(baseCompanies.get(i).getCompanyCode());
+                    demReportInfo.setReportName(now.get(Calendar.YEAR)+"年"+now.get(Calendar.MONTH)+"月消防报告");
+                    demReportInfo.setReportPath("http://172.16.120.165:9300/statics/202303/"+now.get(Calendar.YEAR)+now.get(Calendar.MONTH)+baseCompanies.get(i).getCompanyId()+
+                            ".pdf");
+                    demReportInfo.setCreateTime(LocalDateTime.now());
+                    demReportInfo.setStatisticsTime(now.get(Calendar.YEAR)+"-"+now.get(Calendar.MONTH));
+                    demReportInfo.setReportStatus(0);
+                    demReportInfoService.save(demReportInfo);
+                }
             }
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+    }
+
+    // 定义全局的字体静态变量
+    private static Font titlefont;
+    private static Font headfont;
+    private static Font keyfont;
+    private static Font textfont;
+    // 最大宽度
+    private static int maxWidth = 520;
+    // 静态代码块
+    static {
+        try {
+// 不同字体(这里定义为同一种字体:包含不同字号、不同style)
+            BaseFont bfChinese = BaseFont.createFont("STSong-Light", "UniGB-UCS2-H", BaseFont.NOT_EMBEDDED);
+            titlefont = new Font(bfChinese, 16, Font.BOLD);
+            headfont = new Font(bfChinese, 14, Font.BOLD);
+            keyfont = new Font(bfChinese, 10, Font.BOLD);
+            textfont = new Font(bfChinese, 10, Font.NORMAL);
+
+        } catch (Exception e) {
+            e.printStackTrace();
         }
     }
 
+    // 生成PDF文件
+    public void generatePDF(Document document,String companyName) throws Exception {
+
+// 段落
+        Paragraph paragraph = new Paragraph(companyName+"单位消防安全数字化管理综合分析报告", titlefont);
+        paragraph.setAlignment(1); //设置文字居中 0靠左 1,居中 2,靠右
+        paragraph.setIndentationLeft(12); //设置左缩进
+        paragraph.setIndentationRight(12); //设置右缩进
+        paragraph.setFirstLineIndent(24); //设置首行缩进
+        paragraph.setLeading(20f); //行间距
+        paragraph.setSpacingBefore(5f); //设置段落上空白
+        paragraph.setSpacingAfter(20f); //设置段落下空白
+
+        Paragraph paragraph1 = new Paragraph(companyName+"单位:", textfont);
+        paragraph1.setAlignment(0); //设置文字居中 0靠左 1,居中 2,靠右
+
+        Paragraph paragraph2 = new Paragraph("本次综合分析是通过贵单位在2022年1月1日-2022年12月31日期间消防设施状况、消防自主管理状况、监督执法情况、火灾风险指数和建筑整体指数进行综合评估,现将综合分析报告如下:", textfont);
+        paragraph2.setAlignment(0); //设置文字居中 0靠左 1,居中 2,靠右
+        paragraph2.setFirstLineIndent(24); //设置首行缩进
+        paragraph2.setLeading(20f); //行间距
+        paragraph2.setSpacingBefore(5f); //设置段落上空白
+        paragraph2.setSpacingAfter(10f); //设置段落下空白
+
+        Paragraph paragraph3 = new Paragraph("一、整体评价", headfont);
+        paragraph3.setAlignment(0); //设置文字居中 0靠左 1,居中 2,靠右
+        paragraph3.setFirstLineIndent(24); //设置首行缩进
+
+        Paragraph paragraph4 = new Paragraph("贵单位在期间消防安全管理指数评价为:较高风险", textfont);
+        paragraph4.setAlignment(0); //设置文字居中 0靠左 1,居中 2,靠右
+        paragraph4.setFirstLineIndent(24); //设置首行缩进
+        paragraph4.setLeading(20f); //行间距
+        paragraph4.setSpacingBefore(5f); //设置段落上空白
+        paragraph4.setSpacingAfter(10f); //设置段落下空白
+
+        Paragraph paragraph5 = new Paragraph("二、测评范围", headfont);
+        paragraph5.setAlignment(0); //设置文字居中 0靠左 1,居中 2,靠右
+        paragraph5.setFirstLineIndent(24); //设置首行缩进
+
+        Paragraph paragraph6 = new Paragraph("包含消防设施系统(火灾报警系统;消防水系统;防排烟系统;维保单位履职情况等  如实显示,没有的就不显示)、消防自主管理状况(组织制度落实情况;日常值班、巡检情况;预案、培训落实情况;微站实体化运行情况)、监督执法情况(双随机检查情况;处罚情况;投诉举报情况;重大隐患挂牌情况)和火灾风险指数(当年度火灾情况;上年度火灾情况)等项目进行综合测评。", textfont);
+        paragraph6.setAlignment(0); //设置文字居中 0靠左 1,居中 2,靠右
+        paragraph6.setFirstLineIndent(24); //设置首行缩进
+        paragraph6.setLeading(20f); //行间距
+        paragraph6.setSpacingBefore(5f); //设置段落上空白
+        paragraph6.setSpacingAfter(10f); //设置段落下空白
+
+        Paragraph paragraph7 = new Paragraph("三、主要风险及问题", headfont);
+        paragraph7.setAlignment(0); //设置文字居中 0靠左 1,居中 2,靠右
+        paragraph7.setFirstLineIndent(24); //设置首行缩进
+
+        Paragraph paragraph8 = new Paragraph("(一)消防设施问题", textfont);
+        paragraph8.setAlignment(0); //设置文字居中 0靠左 1,居中 2,靠右
+        paragraph8.setFirstLineIndent(24); //设置首行缩进
+        paragraph8.setLeading(20f); //行间距
+        paragraph8.setSpacingBefore(5f); //设置段落上空白
+        paragraph8.setSpacingAfter(10f); //设置段落下空白
+
+        Paragraph paragraph9 = new Paragraph("火灾报警系统:在线率低于95%,故障率高于5%;", textfont);
+        paragraph9.setAlignment(0); //设置文字居中 0靠左 1,居中 2,靠右
+        paragraph9.setFirstLineIndent(24); //设置首行缩进
+        paragraph9.setLeading(20f); //行间距
+        paragraph9.setSpacingBefore(5f); //设置段落上空白
+        paragraph9.setSpacingAfter(10f); //设置段落下空白
+
+        Paragraph paragraph10 = new Paragraph("防排烟系统:出现超出一个月修复或未修复的2次;", textfont);
+        paragraph10.setAlignment(0); //设置文字居中 0靠左 1,居中 2,靠右
+        paragraph10.setFirstLineIndent(24); //设置首行缩进
+        paragraph10.setLeading(20f); //行间距
+        paragraph10.setSpacingBefore(5f); //设置段落上空白
+        paragraph10.setSpacingAfter(10f); //设置段落下空白
+
+        Paragraph paragraph11 = new Paragraph("维保单位履职情况:检测报告体现XX系统(设施)存在故障。", textfont);
+        paragraph11.setAlignment(0); //设置文字居中 0靠左 1,居中 2,靠右
+        paragraph11.setFirstLineIndent(24); //设置首行缩进
+        paragraph11.setLeading(20f); //行间距
+        paragraph11.setSpacingBefore(5f); //设置段落上空白
+        paragraph11.setSpacingAfter(10f); //设置段落下空白
+
+        Paragraph paragraph12 = new Paragraph("(二)消防自主管理问题", textfont);
+        paragraph12.setAlignment(0); //设置文字居中 0靠左 1,居中 2,靠右
+        paragraph12.setFirstLineIndent(24); //设置首行缩进
+        paragraph12.setLeading(20f); //行间距
+        paragraph12.setSpacingBefore(5f); //设置段落上空白
+        paragraph12.setSpacingAfter(10f); //设置段落下空白
+
+        Paragraph paragraph13 = new Paragraph("组织制度落实情况:员工消防安全培训填写不符合规定;", textfont);
+        paragraph13.setAlignment(0); //设置文字居中 0靠左 1,居中 2,靠右
+        paragraph13.setFirstLineIndent(24); //设置首行缩进
+        paragraph13.setLeading(20f); //行间距
+        paragraph13.setSpacingBefore(5f); //设置段落上空白
+        paragraph13.setSpacingAfter(10f); //设置段落下空白
+
+        Paragraph paragraph14 = new Paragraph("消防档案:档案填写不符合规定;", textfont);
+        paragraph14.setAlignment(0); //设置文字居中 0靠左 1,居中 2,靠右
+        paragraph14.setFirstLineIndent(24); //设置首行缩进
+        paragraph14.setLeading(20f); //行间距
+        paragraph14.setSpacingBefore(5f); //设置段落上空白
+        paragraph14.setSpacingAfter(10f); //设置段落下空白
+
+        Paragraph paragraph15 = new Paragraph("消防重点部位:未确定消防重点部位。", textfont);
+        paragraph15.setAlignment(0); //设置文字居中 0靠左 1,居中 2,靠右
+        paragraph15.setFirstLineIndent(24); //设置首行缩进
+        paragraph15.setLeading(20f); //行间距
+        paragraph15.setSpacingBefore(5f); //设置段落上空白
+        paragraph15.setSpacingAfter(10f); //设置段落下空白
+
+        Paragraph paragraph16 = new Paragraph("(三)监督执法情况", textfont);
+        paragraph16.setAlignment(0); //设置文字居中 0靠左 1,居中 2,靠右
+        paragraph16.setFirstLineIndent(24); //设置首行缩进
+        paragraph16.setLeading(20f); //行间距
+        paragraph16.setSpacingBefore(5f); //设置段落上空白
+        paragraph16.setSpacingAfter(10f); //设置段落下空白
+
+        Paragraph paragraph17 = new Paragraph("上述时间段内监督检查发现隐患X处,其中XX未整改完成,处罚XX元。", textfont);
+        paragraph17.setAlignment(0); //设置文字居中 0靠左 1,居中 2,靠右
+        paragraph17.setFirstLineIndent(24); //设置首行缩进
+        paragraph17.setLeading(20f); //行间距
+        paragraph17.setSpacingBefore(5f); //设置段落上空白
+        paragraph17.setSpacingAfter(10f); //设置段落下空白
+
+        Paragraph paragraph18 = new Paragraph("(四)火灾情况", textfont);
+        paragraph18.setAlignment(0); //设置文字居中 0靠左 1,居中 2,靠右
+        paragraph18.setFirstLineIndent(24); //设置首行缩进
+        paragraph18.setLeading(20f); //行间距
+        paragraph18.setSpacingBefore(5f); //设置段落上空白
+        paragraph18.setSpacingAfter(10f); //设置段落下空白
+
+        Paragraph paragraph19 = new Paragraph("上一年度发生一起火灾,未造成人员伤亡,造成直接财产损失X万元。", textfont);
+        paragraph19.setAlignment(0); //设置文字居中 0靠左 1,居中 2,靠右
+        paragraph19.setFirstLineIndent(24); //设置首行缩进
+        paragraph19.setLeading(20f); //行间距
+        paragraph19.setSpacingBefore(5f); //设置段落上空白
+        paragraph19.setSpacingAfter(10f); //设置段落下空白
+
+        Paragraph paragraph20 = new Paragraph("四、防范对策及建议", headfont);
+        paragraph20.setAlignment(0); //设置文字居中 0靠左 1,居中 2,靠右
+        paragraph20.setFirstLineIndent(24); //设置首行缩进
+
+        Paragraph paragraph21 = new Paragraph("1、建议联系消防设施维保单位对本单位开展一次全面维护保养,对损坏、故障的设施要及时修复,确保消防设施完整好用;", textfont);
+        paragraph21.setAlignment(0); //设置文字居中 0靠左 1,居中 2,靠右
+        paragraph21.setFirstLineIndent(24); //设置首行缩进
+        paragraph21.setLeading(20f); //行间距
+        paragraph21.setSpacingBefore(5f); //设置段落上空白
+        paragraph21.setSpacingAfter(10f); //设置段落下空白
+
+        Paragraph paragraph22 = new Paragraph("2、建议对照重点单位消防档案管理办法,进一步完善员工安全培训记录、明确消防重点部位等内容;", textfont);
+        paragraph22.setAlignment(0); //设置文字居中 0靠左 1,居中 2,靠右
+        paragraph22.setFirstLineIndent(24); //设置首行缩进
+        paragraph22.setLeading(20f); //行间距
+        paragraph22.setSpacingBefore(5f); //设置段落上空白
+        paragraph22.setSpacingAfter(10f); //设置段落下空白
+
+        Paragraph paragraph23 = new Paragraph("3、建议对单位重点部位开展一轮全面自查,落实值班、巡查以及应急处置工作职责,确保“实名制”管理工作制度落实到位;", textfont);
+        paragraph23.setAlignment(0); //设置文字居中 0靠左 1,居中 2,靠右
+        paragraph23.setFirstLineIndent(24); //设置首行缩进
+        paragraph23.setLeading(20f); //行间距
+        paragraph23.setSpacingBefore(5f); //设置段落上空白
+        paragraph23.setSpacingAfter(10f); //设置段落下空白
+
+        Paragraph paragraph24 = new Paragraph("4、建议充分利用场所自身有利条件,在电子屏、明显位置循环播放宣传视频、张贴海报等形式加强消防安全提示。定期对单位员工开展消防安全教育和重点岗位专题培训,持续提高员工消防安全“一懂三会”基本能力。", textfont);
+        paragraph24.setAlignment(0); //设置文字居中 0靠左 1,居中 2,靠右
+        paragraph24.setFirstLineIndent(24); //设置首行缩进
+        paragraph24.setLeading(20f); //行间距
+        paragraph24.setSpacingBefore(5f); //设置段落上空白
+        paragraph24.setSpacingAfter(10f); //设置段落下空白
+
+        Paragraph paragraph25 = new Paragraph("五、具体问题清单", headfont);
+        paragraph25.setAlignment(0); //设置文字居中 0靠左 1,居中 2,靠右
+        paragraph25.setFirstLineIndent(24); //设置首行缩进
+
+// 直线
+//        Paragraph p1 = new Paragraph();
+//        p1.add(new Chunk(new LineSeparator()));
+
+// 点线
+//        Paragraph p2 = new Paragraph();
+//        p2.add(new Chunk(new DottedLineSeparator()));
+
+// 超链接
+//        Anchor anchor = new Anchor("baidu");
+//        anchor.setReference("www.baidu.com");
+
+// 定位
+//        Anchor gotoP = new Anchor("goto");
+//        gotoP.setReference("#top");
+
+// 添加图片
+        Image image = Image.getInstance("https://img-blog.csdn.net/20180801174617455?watermark/2/text/aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3dlaXhpbl8zNzg0ODcxMA==/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70");
+        image.setAlignment(Image.ALIGN_CENTER);
+        image.scalePercent(40); //依照比例缩放
+
+// 表格
+        PdfPTable table = createTable(new float[] { 40, 120, 120, 120, 80, 80 });
+        table.addCell(createCell("美好的一天", headfont, Element.ALIGN_LEFT, 6, false));
+        table.addCell(createCell("早上9:00", keyfont, Element.ALIGN_CENTER));
+        table.addCell(createCell("中午11:00", keyfont, Element.ALIGN_CENTER));
+        table.addCell(createCell("中午13:00", keyfont, Element.ALIGN_CENTER));
+        table.addCell(createCell("下午15:00", keyfont, Element.ALIGN_CENTER));
+        table.addCell(createCell("下午17:00", keyfont, Element.ALIGN_CENTER));
+        table.addCell(createCell("晚上19:00", keyfont, Element.ALIGN_CENTER));
+        Integer totalQuantity = 0;
+        for (int i = 0; i < 5; i++) {
+            table.addCell(createCell("起床", textfont));
+            table.addCell(createCell("吃午饭", textfont));
+            table.addCell(createCell("午休", textfont));
+            table.addCell(createCell("下午茶", textfont));
+            table.addCell(createCell("回家", textfont));
+            table.addCell(createCell("吃晚饭", textfont));
+            totalQuantity ++;
+        }
+        table.addCell(createCell("总计", keyfont));
+        table.addCell(createCell("", textfont));
+        table.addCell(createCell("", textfont));
+        table.addCell(createCell("", textfont));
+        table.addCell(createCell(String.valueOf(totalQuantity) + "件事", textfont));
+        table.addCell(createCell("", textfont));
+
+        document.add(paragraph);
+        document.add(paragraph1);
+        document.add(paragraph2);
+        document.add(paragraph3);
+        document.add(paragraph4);
+        document.add(paragraph5);
+        document.add(paragraph6);
+        document.add(paragraph7);
+        document.add(paragraph8);
+        document.add(paragraph9);
+        document.add(paragraph10);
+        document.add(paragraph11);
+        document.add(paragraph12);
+        document.add(paragraph13);
+        document.add(paragraph14);
+        document.add(paragraph15);
+        document.add(paragraph16);
+        document.add(paragraph17);
+        document.add(paragraph18);
+        document.add(paragraph19);
+        document.add(paragraph20);
+        document.add(paragraph21);
+        document.add(paragraph22);
+        document.add(paragraph23);
+        document.add(paragraph24);
+        document.add(paragraph25);
+//        document.add(anchor);
+//        document.add(p2);
+//        document.add(gotoP);
+//        document.add(p1);
+//        document.add(table);
+//        document.add(image);
+    }
+
+
+/**------------------------创建表格单元格的方法start----------------------------*/
+    /**
+     * 创建单元格(指定字体)
+     * @param value
+     * @param font
+     * @return
+     */
+    public PdfPCell createCell(String value, Font font) {
+        PdfPCell cell = new PdfPCell();
+        cell.setVerticalAlignment(Element.ALIGN_MIDDLE);
+        cell.setHorizontalAlignment(Element.ALIGN_CENTER);
+        cell.setPhrase(new Phrase(value, font));
+        return cell;
+    }
+    /**
+     * 创建单元格(指定字体、水平..)
+     * @param value
+     * @param font
+     * @param align
+     * @return
+     */
+    public PdfPCell createCell(String value, Font font, int align) {
+        PdfPCell cell = new PdfPCell();
+        cell.setVerticalAlignment(Element.ALIGN_MIDDLE);
+        cell.setHorizontalAlignment(align);
+        cell.setPhrase(new Phrase(value, font));
+        return cell;
+    }
+    /**
+     * 创建单元格(指定字体、水平居..、单元格跨x列合并)
+     * @param value
+     * @param font
+     * @param align
+     * @param colspan
+     * @return
+     */
+    public PdfPCell createCell(String value, Font font, int align, int colspan) {
+        PdfPCell cell = new PdfPCell();
+        cell.setVerticalAlignment(Element.ALIGN_MIDDLE);
+        cell.setHorizontalAlignment(align);
+        cell.setColspan(colspan);
+        cell.setPhrase(new Phrase(value, font));
+        return cell;
+    }
+    /**
+     * 创建单元格(指定字体、水平居..、单元格跨x列合并、设置单元格内边距)
+     * @param value
+     * @param font
+     * @param align
+     * @param colspan
+     * @param boderFlag
+     * @return
+     */
+    public PdfPCell createCell(String value, Font font, int align, int colspan, boolean boderFlag) {
+        PdfPCell cell = new PdfPCell();
+        cell.setVerticalAlignment(Element.ALIGN_MIDDLE);
+        cell.setHorizontalAlignment(align);
+        cell.setColspan(colspan);
+        cell.setPhrase(new Phrase(value, font));
+        cell.setPadding(3.0f);
+        if (!boderFlag) {
+            cell.setBorder(0);
+            cell.setPaddingTop(15.0f);
+            cell.setPaddingBottom(8.0f);
+        } else if (boderFlag) {
+            cell.setBorder(0);
+            cell.setPaddingTop(0.0f);
+            cell.setPaddingBottom(15.0f);
+        }
+        return cell;
+    }
+    /**
+     * 创建单元格(指定字体、水平..、边框宽度:0表示无边框、内边距)
+     * @param value
+     * @param font
+     * @param align
+     * @param borderWidth
+     * @param paddingSize
+     * @param flag
+     * @return
+     */
+    public PdfPCell createCell(String value, Font font, int align, float[] borderWidth, float[] paddingSize, boolean flag) {
+        PdfPCell cell = new PdfPCell();
+        cell.setVerticalAlignment(Element.ALIGN_MIDDLE);
+        cell.setHorizontalAlignment(align);
+        cell.setPhrase(new Phrase(value, font));
+        cell.setBorderWidthLeft(borderWidth[0]);
+        cell.setBorderWidthRight(borderWidth[1]);
+        cell.setBorderWidthTop(borderWidth[2]);
+        cell.setBorderWidthBottom(borderWidth[3]);
+        cell.setPaddingTop(paddingSize[0]);
+        cell.setPaddingBottom(paddingSize[1]);
+        if (flag) {
+            cell.setColspan(2);
+        }
+        return cell;
+    }
+/**------------------------创建表格单元格的方法end----------------------------*/
+
+
+/**--------------------------创建表格的方法start------------------- ---------*/
+    /**
+     * 创建默认列宽,指定列数、水平(居中、右、左)的表格
+     * @param colNumber
+     * @param align
+     * @return
+     */
+    public PdfPTable createTable(int colNumber, int align) {
+        PdfPTable table = new PdfPTable(colNumber);
+        try {
+            table.setTotalWidth(maxWidth);
+            table.setLockedWidth(true);
+            table.setHorizontalAlignment(align);
+            table.getDefaultCell().setBorder(1);
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        return table;
+    }
+    /**
+     * 创建指定列宽、列数的表格
+     * @param widths
+     * @return
+     */
+    public PdfPTable createTable(float[] widths) {
+        PdfPTable table = new PdfPTable(widths);
+        try {
+            table.setTotalWidth(maxWidth);
+            table.setLockedWidth(true);
+            table.setHorizontalAlignment(Element.ALIGN_CENTER);
+            table.getDefaultCell().setBorder(1);
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        return table;
+    }
+    /**
+     * 创建空白的表格
+     * @return
+     */
+    public PdfPTable createBlankTable() {
+        PdfPTable table = new PdfPTable(1);
+        table.getDefaultCell().setBorder(0);
+        table.addCell(createCell("", keyfont));
+        table.setSpacingAfter(20.0f);
+        table.setSpacingBefore(20.0f);
+        return table;
+    }
+
     @Override
     public Object buildStatistics(String companyId) {
         Map<String, Object> map = new HashMap<>();

+ 32 - 18
service-fire/service-fire-biz/src/main/java/com/usky/fire/service/impl/DemReportInfoServiceImpl.java

@@ -7,6 +7,8 @@ import com.baomidou.mybatisplus.core.toolkit.StringUtils;
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.usky.common.core.bean.CommonPage;
+import com.usky.fire.domain.BaseCompany;
+import com.usky.fire.domain.BaseCompanyAttach1;
 import com.usky.fire.domain.DemReportInfo;
 import com.usky.fire.mapper.DemReportInfoMapper;
 import com.usky.fire.service.DemReportInfoService;
@@ -18,10 +20,7 @@ import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
 import java.time.LocalDateTime;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
+import java.util.*;
 
 /**
  * <p>
@@ -53,22 +52,28 @@ public class DemReportInfoServiceImpl extends AbstractCrudService<DemReportInfoM
     public List<DemReportInfoVo> reportInfoAdd(DemReportInfoVo demReportInfoVo) {
         List<DemReportInfoVo> list = new ArrayList<>();
         List<CompanyDataVo> companyList = demReportInfoVo.getCompanyList();
+        Calendar now = Calendar.getInstance();
         if (CollectionUtils.isNotEmpty(companyList)) {
+            List<String> companyIdList = new ArrayList<>();
             for (int i = 0; i < companyList.size(); i++) {
-                DemReportInfo demReportInfo = new DemReportInfo();
-                demReportInfo.setCompanyId(companyList.get(i).getCompanyId());
-                demReportInfo.setReportName(demReportInfoVo.getReportName());
-                demReportInfo.setCreateTime(LocalDateTime.now());
-                demReportInfo.setStartTime(demReportInfoVo.getStartTime());
-                demReportInfo.setEndTime(demReportInfoVo.getEndTime());
-                demReportInfo.setReportStatus(0);
-                this.save(demReportInfo);
-                int ID = demReportInfo.getId();
-                DemReportInfoVo demReportInfoVo1 = new DemReportInfoVo();
-                demReportInfoVo1.setId(ID);
-                demReportInfoVo1.setCompanyName(companyList.get(i).getCompanyName());
-                demReportInfoVo1.setCompanyId(companyList.get(i).getCompanyId());
-                list.add(demReportInfoVo1);
+                companyIdList.add(companyList.get(i).getCompanyId());
+            }
+            List<DemReportInfo> list2 = new ArrayList<>();
+            LambdaQueryWrapper<DemReportInfo> queryWrapper1 = Wrappers.lambdaQuery();
+            queryWrapper1.select(DemReportInfo::getId, DemReportInfo::getCompanyId)
+                    .in(DemReportInfo::getCompanyId, companyIdList)
+                    .eq(DemReportInfo::getStatisticsTime, now.get(Calendar.YEAR)+"-"+now.get(Calendar.MONTH)).groupBy(DemReportInfo::getCompanyId);
+            list2 = this.list(queryWrapper1);
+            for (int i = 0; i < companyList.size(); i++) {
+                for (int j = 0; j < list2.size(); j++) {
+                    if (companyList.get(i).getCompanyId().equals(list2.get(j).getCompanyId())) {
+                        DemReportInfoVo demReportInfoVo1 = new DemReportInfoVo();
+                        demReportInfoVo1.setId(list2.get(j).getId());
+                        demReportInfoVo1.setCompanyName(companyList.get(i).getCompanyName());
+                        demReportInfoVo1.setCompanyId(companyList.get(i).getCompanyId());
+                        list.add(demReportInfoVo1);
+                    }
+                }
             }
         }
         return list;
@@ -88,4 +93,13 @@ public class DemReportInfoServiceImpl extends AbstractCrudService<DemReportInfoM
             }
         }
     }
+
+    @Override
+    public List<DemReportInfo> reportById(Integer id) {
+        LambdaQueryWrapper<DemReportInfo> queryWrapper1 = Wrappers.lambdaQuery();
+        queryWrapper1.select(DemReportInfo::getId, DemReportInfo::getReportPath)
+                .eq(DemReportInfo::getId, id);
+        List<DemReportInfo> list2 = this.list(queryWrapper1);
+        return list2;
+    }
 }

+ 110 - 110
service-fire/service-fire-biz/src/main/java/com/usky/fire/service/listener/MqttListener.java

@@ -1,110 +1,110 @@
-package com.usky.fire.service.listener;
-
-
-import com.usky.fire.service.config.mqtt.MqttInConfig;
-import com.usky.fire.service.enums.TopListener;
-import com.usky.fire.service.mqtt.SimpleContext;
-import com.usky.fire.service.vo.MqttBaseVO;
-import lombok.extern.slf4j.Slf4j;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
-import org.springframework.context.annotation.Bean;
-import org.springframework.integration.annotation.ServiceActivator;
-import org.springframework.messaging.MessageHandler;
-import org.springframework.stereotype.Component;
-
-/**
- * @author yq
- * @date 2021/11/3 8:13
- */
-@ConditionalOnProperty(prefix = "mqtt", value = {"enabled"}, havingValue = "true")
-@Slf4j
-@Component
-public class MqttListener {
-
-    public static final String MESSAGE_NAME = "messageInput";
-
-    @Autowired
-    private SimpleContext simpleContext;
-
-    /**
-     * 处理消息-消费者
-     *
-     * @return
-     */
-    @Bean(MESSAGE_NAME)
-    @ServiceActivator(inputChannel = MqttInConfig.CHANNEL_NAME_INPUT)
-    public MessageHandler handler() {
-        return message -> {
-            String payload = message.getPayload().toString();
-            //进行接口推送
-            String[] code1 = TopListener.FIRE_ALERT.getCode().split("/");
-            String[] code2 = TopListener.WATER_ALERT.getCode().split("/");
-            String[] code3 = TopListener.RTU_ALERT.getCode().split("/");
-            String[] code4 = TopListener.VIDEO_ALERT.getCode().split("/");
-            String[] code5 = TopListener.SMOKE_ALERT.getCode().split("/");
-            String[] code6 = TopListener.ELECTRICAL_ALERT.getCode().split("/");
-            String[] code7 = TopListener.LIQUID_ALERT.getCode().split("/");
-            String[] infoCode1 = TopListener.FIRE_INFO.getCode().split("/");
-            String[] infoCode2 = TopListener.WATER_INFO.getCode().split("/");
-            String[] infoCode3 = TopListener.SMOKE_INFO.getCode().split("/");
-            String[] infoCode4 = TopListener.LIQUID_INFO.getCode().split("/");
-            String[] infoCode5 = TopListener.RTU_INFO.getCode().split("/");
-            String[] infoCode6 = TopListener.ELECTRICAL_INFO.getCode().split("/");
-            String[] infoCode7 = TopListener.MH_COVER_INFO.getCode().split("/");
-            String[] infoCode8 = TopListener.LR_SMOKE_INFO.getCode().split("/");
-            Object mqttReceivedTopic = message.getHeaders().get("mqtt_receivedTopic");
-            if (null != mqttReceivedTopic) {
-                String topic = mqttReceivedTopic.toString();
-                MqttBaseVO mqttBaseVO = new MqttBaseVO();
-                mqttBaseVO.setTopic(topic);
-                if (TopListener.MH_WATER_INFO.getCode().equals(topic)) {
-                    mqttBaseVO.setDescribe("cy");
-                    mqttBaseVO.setData(payload);
-                } else if (TopListener.MH_WATER_ALERT.getCode().equals(topic)) {
-                    mqttBaseVO.setDescribe("cy");
-                    mqttBaseVO.setData(payload);
-                } else if (TopListener.MH_WATER_STATISTICS.getCode().equals(topic)) {
-                    mqttBaseVO.setDescribe("cy");
-                    mqttBaseVO.setData(payload);
-                } else if (TopListener.DEVICE_DETAIL.getCode().equals(topic)) {
-                    mqttBaseVO.setDescribe("mhwater");
-                    mqttBaseVO.setData(payload);
-                } else if (TopListener.DEVICE_INFO.getCode().equals(topic)) {
-                    mqttBaseVO.setDescribe("mhwater");
-                    mqttBaseVO.setData(payload);
-                } else if (TopListener.DEVICE_ALERT.getCode().equals(topic)) {
-                    mqttBaseVO.setDescribe("mhwater");
-                    mqttBaseVO.setData(payload);
-                } else if (TopListener.DEVICE_AJ.getCode().equals(topic)) {
-                    mqttBaseVO.setDescribe("mhwater");
-                    mqttBaseVO.setData(payload);
-                } else if ((topic.indexOf(code1[2]) != -1 && topic.indexOf(code1[5]) != -1) ||
-                        (topic.indexOf(code2[2]) != -1 && topic.indexOf(code2[5]) != -1) ||
-                        (topic.indexOf(code3[2]) != -1 && topic.indexOf(code3[5]) != -1) ||
-                        (topic.indexOf(code4[2]) != -1 && topic.indexOf(code4[5]) != -1) ||
-                        (topic.indexOf(code5[2]) != -1 && topic.indexOf(code5[5]) != -1) ||
-                        (topic.indexOf(code6[2]) != -1 && topic.indexOf(code6[5]) != -1) ||
-                        (topic.indexOf(code7[2]) != -1 && topic.indexOf(code7[5]) != -1)) {
-                    mqttBaseVO.setDescribe("alarm");
-                    mqttBaseVO.setData(payload);
-                }else if((topic.indexOf(infoCode1[2]) != -1 && topic.indexOf(infoCode1[5]) != -1) ||
-                        (topic.indexOf(infoCode2[2]) != -1 && topic.indexOf(infoCode2[5]) != -1) ||
-                        (topic.indexOf(infoCode3[2]) != -1 && topic.indexOf(infoCode3[5]) != -1) ||
-                        (topic.indexOf(infoCode4[2]) != -1 && topic.indexOf(infoCode4[5]) != -1) ||
-                        (topic.indexOf(infoCode5[2]) != -1 && topic.indexOf(infoCode5[5]) != -1) ||
-                        (topic.indexOf(infoCode6[2]) != -1 && topic.indexOf(infoCode6[5]) != -1) ||
-                        (topic.indexOf(infoCode7[2]) != -1 && topic.indexOf(infoCode7[5]) != -1) ||
-                        (topic.indexOf(infoCode8[2]) != -1 && topic.indexOf(infoCode8[5]) != -1)) {
-                    mqttBaseVO.setDescribe("info");
-                    mqttBaseVO.setData(payload);
-                }else {
-                    mqttBaseVO.setDescribe("fireInfoAndAlarm");
-                    mqttBaseVO.setData(payload);
-                }
-                //统一处理数据
-                simpleContext.getResource(mqttBaseVO);
-            }
-        };
-    }
-}
+//package com.usky.fire.service.listener;
+//
+//
+//import com.usky.fire.service.config.mqtt.MqttInConfig;
+//import com.usky.fire.service.enums.TopListener;
+//import com.usky.fire.service.mqtt.SimpleContext;
+//import com.usky.fire.service.vo.MqttBaseVO;
+//import lombok.extern.slf4j.Slf4j;
+//import org.springframework.beans.factory.annotation.Autowired;
+//import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
+//import org.springframework.context.annotation.Bean;
+//import org.springframework.integration.annotation.ServiceActivator;
+//import org.springframework.messaging.MessageHandler;
+//import org.springframework.stereotype.Component;
+//
+///**
+// * @author yq
+// * @date 2021/11/3 8:13
+// */
+//@ConditionalOnProperty(prefix = "mqtt", value = {"enabled"}, havingValue = "true")
+//@Slf4j
+//@Component
+//public class MqttListener {
+//
+//    public static final String MESSAGE_NAME = "messageInput";
+//
+//    @Autowired
+//    private SimpleContext simpleContext;
+//
+//    /**
+//     * 处理消息-消费者
+//     *
+//     * @return
+//     */
+//    @Bean(MESSAGE_NAME)
+//    @ServiceActivator(inputChannel = MqttInConfig.CHANNEL_NAME_INPUT)
+//    public MessageHandler handler() {
+//        return message -> {
+//            String payload = message.getPayload().toString();
+//            //进行接口推送
+//            String[] code1 = TopListener.FIRE_ALERT.getCode().split("/");
+//            String[] code2 = TopListener.WATER_ALERT.getCode().split("/");
+//            String[] code3 = TopListener.RTU_ALERT.getCode().split("/");
+//            String[] code4 = TopListener.VIDEO_ALERT.getCode().split("/");
+//            String[] code5 = TopListener.SMOKE_ALERT.getCode().split("/");
+//            String[] code6 = TopListener.ELECTRICAL_ALERT.getCode().split("/");
+//            String[] code7 = TopListener.LIQUID_ALERT.getCode().split("/");
+//            String[] infoCode1 = TopListener.FIRE_INFO.getCode().split("/");
+//            String[] infoCode2 = TopListener.WATER_INFO.getCode().split("/");
+//            String[] infoCode3 = TopListener.SMOKE_INFO.getCode().split("/");
+//            String[] infoCode4 = TopListener.LIQUID_INFO.getCode().split("/");
+//            String[] infoCode5 = TopListener.RTU_INFO.getCode().split("/");
+//            String[] infoCode6 = TopListener.ELECTRICAL_INFO.getCode().split("/");
+//            String[] infoCode7 = TopListener.MH_COVER_INFO.getCode().split("/");
+//            String[] infoCode8 = TopListener.LR_SMOKE_INFO.getCode().split("/");
+//            Object mqttReceivedTopic = message.getHeaders().get("mqtt_receivedTopic");
+//            if (null != mqttReceivedTopic) {
+//                String topic = mqttReceivedTopic.toString();
+//                MqttBaseVO mqttBaseVO = new MqttBaseVO();
+//                mqttBaseVO.setTopic(topic);
+//                if (TopListener.MH_WATER_INFO.getCode().equals(topic)) {
+//                    mqttBaseVO.setDescribe("cy");
+//                    mqttBaseVO.setData(payload);
+//                } else if (TopListener.MH_WATER_ALERT.getCode().equals(topic)) {
+//                    mqttBaseVO.setDescribe("cy");
+//                    mqttBaseVO.setData(payload);
+//                } else if (TopListener.MH_WATER_STATISTICS.getCode().equals(topic)) {
+//                    mqttBaseVO.setDescribe("cy");
+//                    mqttBaseVO.setData(payload);
+//                } else if (TopListener.DEVICE_DETAIL.getCode().equals(topic)) {
+//                    mqttBaseVO.setDescribe("mhwater");
+//                    mqttBaseVO.setData(payload);
+//                } else if (TopListener.DEVICE_INFO.getCode().equals(topic)) {
+//                    mqttBaseVO.setDescribe("mhwater");
+//                    mqttBaseVO.setData(payload);
+//                } else if (TopListener.DEVICE_ALERT.getCode().equals(topic)) {
+//                    mqttBaseVO.setDescribe("mhwater");
+//                    mqttBaseVO.setData(payload);
+//                } else if (TopListener.DEVICE_AJ.getCode().equals(topic)) {
+//                    mqttBaseVO.setDescribe("mhwater");
+//                    mqttBaseVO.setData(payload);
+//                } else if ((topic.indexOf(code1[2]) != -1 && topic.indexOf(code1[5]) != -1) ||
+//                        (topic.indexOf(code2[2]) != -1 && topic.indexOf(code2[5]) != -1) ||
+//                        (topic.indexOf(code3[2]) != -1 && topic.indexOf(code3[5]) != -1) ||
+//                        (topic.indexOf(code4[2]) != -1 && topic.indexOf(code4[5]) != -1) ||
+//                        (topic.indexOf(code5[2]) != -1 && topic.indexOf(code5[5]) != -1) ||
+//                        (topic.indexOf(code6[2]) != -1 && topic.indexOf(code6[5]) != -1) ||
+//                        (topic.indexOf(code7[2]) != -1 && topic.indexOf(code7[5]) != -1)) {
+//                    mqttBaseVO.setDescribe("alarm");
+//                    mqttBaseVO.setData(payload);
+//                }else if((topic.indexOf(infoCode1[2]) != -1 && topic.indexOf(infoCode1[5]) != -1) ||
+//                        (topic.indexOf(infoCode2[2]) != -1 && topic.indexOf(infoCode2[5]) != -1) ||
+//                        (topic.indexOf(infoCode3[2]) != -1 && topic.indexOf(infoCode3[5]) != -1) ||
+//                        (topic.indexOf(infoCode4[2]) != -1 && topic.indexOf(infoCode4[5]) != -1) ||
+//                        (topic.indexOf(infoCode5[2]) != -1 && topic.indexOf(infoCode5[5]) != -1) ||
+//                        (topic.indexOf(infoCode6[2]) != -1 && topic.indexOf(infoCode6[5]) != -1) ||
+//                        (topic.indexOf(infoCode7[2]) != -1 && topic.indexOf(infoCode7[5]) != -1) ||
+//                        (topic.indexOf(infoCode8[2]) != -1 && topic.indexOf(infoCode8[5]) != -1)) {
+//                    mqttBaseVO.setDescribe("info");
+//                    mqttBaseVO.setData(payload);
+//                }else {
+//                    mqttBaseVO.setDescribe("fireInfoAndAlarm");
+//                    mqttBaseVO.setData(payload);
+//                }
+//                //统一处理数据
+//                simpleContext.getResource(mqttBaseVO);
+//            }
+//        };
+//    }
+//}

+ 1 - 0
service-fire/service-fire-biz/src/main/resources/mapper/fire/BaseBuildMapper.xml

@@ -27,6 +27,7 @@
         <result column="build_plan" property="buildPlan" />
         <result column="facility_id" property="facilityId" />
         <result column="company_id" property="companyId" />
+        <result column="under_space" property="underSpace" />
         <result column="create_time" property="createTime" />
         <result column="update_time" property="updateTime" />
         <result column="update_person" property="updatePerson" />

+ 1 - 0
service-fire/service-fire-biz/src/main/resources/mapper/fire/DemReportInfoMapper.xml

@@ -12,6 +12,7 @@
         <result column="create_time" property="createTime" />
         <result column="start_time" property="startTime" />
         <result column="end_time" property="endTime" />
+        <result column="statistics_time" property="statisticsTime" />
         <result column="report_status" property="reportStatus" />
         <result column="send_time" property="sendTime" />
     </resultMap>