Browse Source

日报表获取内容修改:从联锁总表获取当前时刻数据;
修改历史导出的数据排序

sl 7 months ago
parent
commit
32037dbf3b

+ 4 - 0
jeecg-module-interlock/src/main/java/org/jeecg/modules/detail/mapper/InterlockDetailMapper.java

@@ -11,6 +11,7 @@ import org.jeecg.modules.detail.dto.InterlockDetailQueryDTO;
 import org.jeecg.modules.detail.entity.InterlockDetail;
 import org.jeecg.modules.detail.entity.InterlockDetail;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import org.jeecg.modules.detail.vo.InterlockDetailQueryVO;
 import org.jeecg.modules.detail.vo.InterlockDetailQueryVO;
+import org.jeecg.modules.summary.vo.InterlockSummaryDayVO;
 import org.jeecg.modules.summary.vo.InterlockSummaryLimitVO;
 import org.jeecg.modules.summary.vo.InterlockSummaryLimitVO;
 import org.jeecg.modules.summary.vo.InterlockSummaryVO;
 import org.jeecg.modules.summary.vo.InterlockSummaryVO;
 
 
@@ -48,4 +49,7 @@ public interface InterlockDetailMapper extends BaseMapper<InterlockDetail> {
     /**联锁总表-分页列表查询(各种逻辑状态) 添加权限  系统管理员权限*/
     /**联锁总表-分页列表查询(各种逻辑状态) 添加权限  系统管理员权限*/
     IPage<InterlockSummaryLimitVO> getPageByAdminUser(Page<InterlockSummaryLimitVO> page, @Param("interlockSummaryLimitVO") InterlockSummaryLimitVO interlockSummaryLimitVO);
     IPage<InterlockSummaryLimitVO> getPageByAdminUser(Page<InterlockSummaryLimitVO> page, @Param("interlockSummaryLimitVO") InterlockSummaryLimitVO interlockSummaryLimitVO);
 
 
+    /**联锁总表-查询当前时刻所有联锁(各种逻辑状态) 添加权限  系统管理员权限 用于日报表*/
+    List<InterlockSummaryDayVO> getForExportLast2(@Param("interlockSummaryDayVO") InterlockSummaryDayVO interlockSummaryDayVO);
+
 }
 }

+ 28 - 0
jeecg-module-interlock/src/main/java/org/jeecg/modules/detail/mapper/xml/InterlockDetailMapper.xml

@@ -167,4 +167,32 @@
         order by s.create_time desc
         order by s.create_time desc
     </select>
     </select>
 
 
+    <!-- 联锁总表-查询当前时刻所有联锁(各种逻辑状态) 添加权限  系统管理员权限 用于日报表 -->
+    <select id="getForExportLast2" resultType="org.jeecg.modules.summary.vo.InterlockSummaryDayVO">
+        select d.id, d.summaryid, s.tag_time, d.interlockname, d.interlock_condition, d.interlock_condition_tag,
+        d.instrument_status, d.control_system_status, s.interlock_status, s.loop_health_level, d.bypass,
+        s.interlock_apparatus_id, s.interlock_system_id,
+        h1.interlock_status_name , h2.bypass_name, h3.instrument_status_name , h4.control_system_status_name,
+        h.instrument_status_normal, h.bypass_yes, h.interlock_status_ty, h.control_system_status_normal
+        from interlock_detail d
+        left join interlock_summary s on d.summaryid = s.id
+        left join interlock_base_hy h1 on h1.interlock_status = s.interlock_status and h1.interlock_system_id = s.interlock_system_id
+        left join interlock_base_hy h2 on h2.bypass = d.bypass and h2.interlock_system_id = s.interlock_system_id
+        left join interlock_base_hy h3 on h3.instrument_status = d.instrument_status and h3.interlock_system_id = s.interlock_system_id
+        left join interlock_base_hy h4 on h4.control_system_status = d.control_system_status and h4.interlock_system_id = s.interlock_system_id
+        inner join interlock_base h on h.id = s.interlock_system_id
+        <where>
+            <if test="interlockSummaryDayVO.interlockApparatusId != null and interlockSummaryDayVO.interlockApparatusId != ''"> and s.interlock_apparatus_id = #{interlockSummaryDayVO.interlockApparatusId}</if>
+            <if test="interlockSummaryDayVO.interlockSystemId != null and interlockSummaryDayVO.interlockSystemId != ''"> and s.interlock_system_id = #{interlockSummaryDayVO.interlockSystemId}</if>
+            <if test="interlockSummaryDayVO.interlockname != null and interlockSummaryDayVO.interlockname != ''"> and d.interlockname like concat('%', #{interlockSummaryDayVO.interlockname}, '%')</if>
+            <if test="interlockSummaryDayVO.interlockConditionTag != null and interlockSummaryDayVO.interlockConditionTag != ''"> and d.interlock_condition_tag like concat('%', #{interlockSummaryDayVO.interlockConditionTag}, '%')</if>
+            <if test="interlockSummaryDayVO.instrumentStatus != null and interlockSummaryDayVO.instrumentStatus != ''"> and d.instrument_status = #{interlockSummaryDayVO.instrumentStatus}</if>
+            <if test="interlockSummaryDayVO.controlSystemStatus != null and interlockSummaryDayVO.controlSystemStatus != ''"> and d.control_system_status = #{interlockSummaryDayVO.controlSystemStatus}</if>
+            <if test="interlockSummaryDayVO.interlockStatus != null and interlockSummaryDayVO.interlockStatus != ''"> and s.interlock_status = #{interlockSummaryDayVO.interlockStatus}</if>
+            <if test="interlockSummaryDayVO.loopHealthLevel != null and interlockSummaryDayVO.loopHealthLevel != ''"> and s.loop_health_level = #{interlockSummaryDayVO.loopHealthLevel}</if>
+            <if test="interlockSummaryDayVO.bypass != null and interlockSummaryDayVO.bypass != ''"> and d.bypass = #{interlockSummaryDayVO.bypass}</if>
+        </where>
+        order by s.tag_time desc, s.create_time desc, d.interlockname desc, d.summaryid desc
+    </select>
+
 </mapper>
 </mapper>

+ 6 - 0
jeecg-module-interlock/src/main/java/org/jeecg/modules/history/convert/InterlockSummaryHistoryConvert.java

@@ -4,12 +4,16 @@ import org.jeecg.modules.detail.entity.InterlockDetail;
 import org.jeecg.modules.history.dto.InterlockHistoryQueryDTO;
 import org.jeecg.modules.history.dto.InterlockHistoryQueryDTO;
 import org.jeecg.modules.history.entity.InterlockDetailHistory;
 import org.jeecg.modules.history.entity.InterlockDetailHistory;
 import org.jeecg.modules.history.entity.InterlockSummaryHistory;
 import org.jeecg.modules.history.entity.InterlockSummaryHistory;
+import org.jeecg.modules.history.vo.InterlockSummaryHistoryVO;
 import org.jeecg.modules.summary.entity.InterlockSummary;
 import org.jeecg.modules.summary.entity.InterlockSummary;
+import org.jeecg.modules.summary.vo.InterlockSummaryDayVO;
 import org.jeecg.modules.temp.entity.InterlockSummaryTemp;
 import org.jeecg.modules.temp.entity.InterlockSummaryTemp;
 import org.mapstruct.Mapper;
 import org.mapstruct.Mapper;
 import org.mapstruct.Mapping;
 import org.mapstruct.Mapping;
 import org.mapstruct.factory.Mappers;
 import org.mapstruct.factory.Mappers;
 
 
+import java.util.List;
+
 /**
 /**
  * @author dzc
  * @author dzc
  * @date 2024/5/31 15:30
  * @date 2024/5/31 15:30
@@ -39,4 +43,6 @@ public interface InterlockSummaryHistoryConvert {
     @Mapping(target = "id", ignore = true)
     @Mapping(target = "id", ignore = true)
     InterlockSummaryHistory toTempHistory(InterlockSummaryTemp interlockSummary);
     InterlockSummaryHistory toTempHistory(InterlockSummaryTemp interlockSummary);
 
 
+    List<InterlockSummaryHistoryVO> toHistoryDayList(List<InterlockSummaryDayVO> interlockSummaryDayVOList);
+
 }
 }

+ 1 - 1
jeecg-module-interlock/src/main/java/org/jeecg/modules/history/mapper/InterlockDetailHistoryMapper.java

@@ -94,7 +94,7 @@ public interface InterlockDetailHistoryMapper extends BaseMapper<InterlockDetail
 
 
     List<InterlockSummaryHistoryVO> getForExport1(InterlockHistoryQueryDTO dto);
     List<InterlockSummaryHistoryVO> getForExport1(InterlockHistoryQueryDTO dto);
 
 
-    //导出  根据历史总表id查询详细信息用于导出
+    //导出  根据历史总表id查询详细信息用于导出 从历史数据中选择最新一条数据作为当前时刻的数据 用于日报表导出
     List<InterlockSummaryHistoryVO> getForExportLast(List<String> summaryHistoryIdList);
     List<InterlockSummaryHistoryVO> getForExportLast(List<String> summaryHistoryIdList);
 
 
 }
 }

+ 1 - 1
jeecg-module-interlock/src/main/java/org/jeecg/modules/history/mapper/xml/InterlockDetailHistoryMapper.xml

@@ -508,7 +508,7 @@
                 #{item}
                 #{item}
             </foreach>
             </foreach>
         </where>
         </where>
-        order by s.tag_time desc
+        order by s.tag_time desc, d.interlockname desc, d.summaryid desc
     </select>
     </select>
 
 
 </mapper>
 </mapper>

+ 224 - 1
jeecg-module-interlock/src/main/java/org/jeecg/modules/history/service/impl/InterlockDetailHistoryServiceImpl.java

@@ -9,6 +9,7 @@ import org.apache.poi.ss.util.CellRangeAddress;
 import org.apache.poi.xssf.streaming.SXSSFWorkbook;
 import org.apache.poi.xssf.streaming.SXSSFWorkbook;
 import org.jeecg.modules.base.mapper.InterlockBaseMapper;
 import org.jeecg.modules.base.mapper.InterlockBaseMapper;
 import org.jeecg.modules.detail.dto.InterlockDetailQueryDTO;
 import org.jeecg.modules.detail.dto.InterlockDetailQueryDTO;
+import org.jeecg.modules.detail.mapper.InterlockDetailMapper;
 import org.jeecg.modules.history.convert.InterlockSummaryHistoryConvert;
 import org.jeecg.modules.history.convert.InterlockSummaryHistoryConvert;
 import org.jeecg.modules.history.dto.InterlockHistoryQueryDTO;
 import org.jeecg.modules.history.dto.InterlockHistoryQueryDTO;
 import org.jeecg.modules.history.entity.InterlockDetailHistory;
 import org.jeecg.modules.history.entity.InterlockDetailHistory;
@@ -23,6 +24,7 @@ import org.jeecg.modules.history.vo.InterlockSummaryHistoryVO;
 import org.jeecg.modules.interlockUser.entity.InterlockUser;
 import org.jeecg.modules.interlockUser.entity.InterlockUser;
 import org.jeecg.modules.summary.entity.InterlockSummary;
 import org.jeecg.modules.summary.entity.InterlockSummary;
 import org.jeecg.modules.summary.service.IInterlockSummaryService;
 import org.jeecg.modules.summary.service.IInterlockSummaryService;
+import org.jeecg.modules.summary.vo.InterlockSummaryDayVO;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.stereotype.Service;
 
 
@@ -53,6 +55,10 @@ public class InterlockDetailHistoryServiceImpl extends ServiceImpl<InterlockDeta
 
 
     @Autowired
     @Autowired
     @SuppressWarnings("all")
     @SuppressWarnings("all")
+    private InterlockDetailMapper interlockDetailMapper;
+
+    @Autowired
+    @SuppressWarnings("all")
     private IInterlockSummaryService summaryService;
     private IInterlockSummaryService summaryService;
 
 
 
 
@@ -519,12 +525,13 @@ public class InterlockDetailHistoryServiceImpl extends ServiceImpl<InterlockDeta
                     if(maxTagTime!=null) dto.setEndTime(maxTagTime);
                     if(maxTagTime!=null) dto.setEndTime(maxTagTime);
                 }
                 }
                 String sheetName =generateSheetName(zzxtvo) ;
                 String sheetName =generateSheetName(zzxtvo) ;
-                processSheet1(workbook, cellStyleMap, sheetName, dto, zzxtvo,type);
+                processSheet2(workbook, cellStyleMap, sheetName, dto, zzxtvo,type);
             }
             }
         }
         }
         return workbook;
         return workbook;
     }
     }
 
 
+    //该段日报表取的当前时刻是从历史数据表取得最新数据获得的
     private SXSSFWorkbook processSheet1(SXSSFWorkbook workbook, Map<String,CellStyle> cellStyleMap, String sheetName, InterlockHistoryQueryDTO dto, InterlockHistoryDistinctZZXTVO zzxtvo,String type) throws IOException {
     private SXSSFWorkbook processSheet1(SXSSFWorkbook workbook, Map<String,CellStyle> cellStyleMap, String sheetName, InterlockHistoryQueryDTO dto, InterlockHistoryDistinctZZXTVO zzxtvo,String type) throws IOException {
         SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
         SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
         String formattedBeginTime = dto.getBeginTime() != null ? sdf.format(dto.getBeginTime()) : "";
         String formattedBeginTime = dto.getBeginTime() != null ? sdf.format(dto.getBeginTime()) : "";
@@ -727,6 +734,222 @@ public class InterlockDetailHistoryServiceImpl extends ServiceImpl<InterlockDeta
         return workbook;
         return workbook;
     }
     }
 
 
+    //该段日报表取的当前时刻数据是从联锁总表中获取的
+    private SXSSFWorkbook processSheet2(SXSSFWorkbook workbook, Map<String,CellStyle> cellStyleMap, String sheetName, InterlockHistoryQueryDTO dto, InterlockHistoryDistinctZZXTVO zzxtvo,String type) throws IOException {
+        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+        String formattedBeginTime = dto.getBeginTime() != null ? sdf.format(dto.getBeginTime()) : "";
+        String formattedEndTime = dto.getEndTime() != null ? sdf.format(dto.getEndTime()) : "";
+        List<InterlockSummaryHistoryVO> exportList = new ArrayList<InterlockSummaryHistoryVO>();
+        dto.setInterlockSystemId(zzxtvo.getInterlockSystemId()); // 系统id
+        int ty = 0;
+        int wty = 0;
+        if ("0".equals(type)){//日报表相关
+            //导出当前时刻所有的联锁最新联锁总表详细表数据用于计算投用率
+            InterlockSummaryDayVO interlockSummaryDayVO = new InterlockSummaryDayVO();
+            interlockSummaryDayVO.setInterlockSystemId(zzxtvo.getInterlockSystemId());
+            List<InterlockSummaryDayVO> interlockSummaryDayVOList = interlockDetailMapper.getForExportLast2(interlockSummaryDayVO);//根据系统id查询该系统下所有联锁信息
+            exportList = InterlockSummaryHistoryConvert.INSTANCE.toHistoryDayList(interlockSummaryDayVOList);
+            //计算投用率 数据是按点位时间和联锁名称排序的,当名称不一样时,代表是下一个联锁,查看一下投用
+            String interlockname = "";
+            for(InterlockSummaryHistoryVO interlockSummaryHistoryVO:exportList){
+                if(!interlockname.equals(interlockSummaryHistoryVO.getInterlockname())){
+                    interlockname = interlockSummaryHistoryVO.getInterlockname();
+                    if(interlockSummaryHistoryVO.getInterlockStatus().equals(interlockSummaryHistoryVO.getInterlockStatusTy())){
+                        ty++;
+                    }else{
+                        wty++;
+                    }
+                }
+            }
+//            //获取所有联锁数据用于写入日报表
+//            exportList = this.getForExport00(dto);
+        }else {//手动导出、月报表、年报表相关
+            //获取符合查询条件的所有历史联锁总表数据用户计算投用率
+            List<InterlockSummaryHistory> summaryHistoryList = summaryHistoryMapper.getSummaryHistoryList11(dto);//用于计算投用率的历史联锁总表数据
+            List<String> summaryHistoryIdList = new ArrayList<>();//查询到的历史联锁总表id
+            for(InterlockSummaryHistory interlockSummaryHistory:summaryHistoryList){
+                summaryHistoryIdList.add(interlockSummaryHistory.getId());//历史联锁总表id
+                if(interlockSummaryHistory.getInterlockStatus().equals(interlockSummaryHistory.getInterlockStatusTy())){//投用
+                    ty++;
+                }else{
+                    wty++;
+                }
+            }
+            //获取导出的数据exportList
+            if(summaryHistoryIdList.size()!=0){
+                exportList = interlockDetailHistoryMapper.getForExportLast(summaryHistoryIdList);
+            }
+//            exportList = this.getForExport11(dto);
+        }
+        // 计算投用率
+        //计算投用数量和未投用数量
+//        ty = summaryHistoryMapper.cocuntTY11(dto);
+//        wty = summaryHistoryMapper.cocuntWTY11(dto);
+        int total = ty + wty; // 总数量
+        String tylPercentage = "0.00%";//如果没有历史数据,投用率为0
+        if(total!=0){
+            double tyl = (double) ty / total * 100;
+            tylPercentage = String.format("%.2f%%", tyl); // 将百分比转换为百分数形式,保留两位小数
+        }
+
+        System.out.println("系统开始-----------------------------------------------------------------------------------"+zzxtvo.getInterlockSystemName());
+
+
+        Sheet sheet = workbook.createSheet(sheetName);
+
+        // 设置列宽——30或15个字符宽度
+        int[] columnWidths = {30, 30, 30, 15, 15, 15, 15, 15};
+        for (int j = 0; j < columnWidths.length; j++) {
+            sheet.setColumnWidth(j, columnWidths[j] * 256);
+        }
+
+        //第一行:联锁历史数据报表
+        int rowNum = 0;
+        Row titleRow = sheet.createRow(rowNum++);
+        titleRow.setHeightInPoints(19.8f);
+        Cell titleCell = titleRow.createCell(0);
+        titleCell.setCellValue("联锁历史数据报表");
+        titleCell.setCellStyle(cellStyleMap.get("firstStyle")); // 第一行的样式
+        // 合并第一行的前6列
+        sheet.addMergedRegion(new CellRangeAddress(rowNum-1, rowNum-1, 0, 5));
+
+        // 第二行:报表生成时间:
+        Row secondTitleRow = sheet.createRow(rowNum++);
+        // 设置第2行数据
+        String[] s2 = {"报表生成时间:",sdf.format(new Date()),"","","",""};
+        createCellOfRowWithValueStyle(secondTitleRow,s2,cellStyleMap.get("centerAlignStyle2"));
+        // 合并第2行的后5列
+        sheet.addMergedRegion(new CellRangeAddress(rowNum-1, rowNum-1, 1, 5));
+
+        // 第3行:装置名称
+        Row thirdTitleRow = sheet.createRow(rowNum++);
+        // 设置第3行数据
+        String[] s3 = {"装置名称:",zzxtvo.getInterlockApparatusName(),"","","",""};
+        CellStyle[] style3 = {cellStyleMap.get("centerAlignStyle"),cellStyleMap.get("centerAlignStyle3"),cellStyleMap.get("centerAlignStyle3"),cellStyleMap.get("centerAlignStyle3"),cellStyleMap.get("centerAlignStyle3"),cellStyleMap.get("centerAlignStyle3")};
+        createCellOfRowWithValueStyleName(thirdTitleRow,s3,style3);
+        // 合并第3行的后5列
+        sheet.addMergedRegion(new CellRangeAddress(rowNum-1, rowNum-1, 1, 5));
+
+        // 第四行:系统名称
+        Row fourthTitleRow = sheet.createRow(rowNum++);
+        // 设置第4行数据
+        String[] s4 = {"系统名称:",zzxtvo.getInterlockSystemName(),"","","",""};
+        createCellOfRowWithValueStyleName(fourthTitleRow,s4,style3); //与第三行样式相同style3
+        // 合并第4行的后5列
+        sheet.addMergedRegion(new CellRangeAddress(rowNum-1, rowNum-1, 1, 5));
+
+        //第五行:起始时间、结束时间
+        Row fifthTitleRow = sheet.createRow(rowNum++);
+        //设置第5行数据
+        String[] s5 = {"起始时间:",formattedBeginTime,"","结束时间:",formattedEndTime,""};
+        CellStyle[] style5 = {cellStyleMap.get("centerAlignStyle"),cellStyleMap.get("centerAlignStyle3"),cellStyleMap.get("centerAlignStyle3"),cellStyleMap.get("centerAlignStyle"),cellStyleMap.get("centerAlignStyle3"),cellStyleMap.get("centerAlignStyle3")};
+        createCellOfRowWithValueStyleName(fifthTitleRow,s5,style5);
+        // 分别合并第2、3列 和 第5、6列
+        sheet.addMergedRegion(new CellRangeAddress(rowNum-1, rowNum-1, 1, 2));
+        sheet.addMergedRegion(new CellRangeAddress(rowNum-1, rowNum-1, 4, 5));
+
+        //第六行:连锁数量、未投用联锁数量、投用率统计
+        Row sixTitleRow = sheet.createRow(rowNum++);
+        String[] s6 = {"联锁总数:", String.valueOf(total),"未投用联锁数量:", String.valueOf(wty),"投用率统计:", String.valueOf(tylPercentage)};
+        CellStyle[] style6 = {cellStyleMap.get("centerAlignStyle"),cellStyleMap.get("centerAlignStyle3"),cellStyleMap.get("centerAlignStyle"),cellStyleMap.get("centerAlignStyle3"),cellStyleMap.get("centerAlignStyle"),cellStyleMap.get("centerAlignStyle3")};
+        createCellOfRowWithValueStyleName(sixTitleRow,s6,style6);
+
+        //第七行空白
+        rowNum++;
+
+        //第8行:历史数据
+        Row eightTitleRow = sheet.createRow(rowNum++);
+        //设置第8行数据
+        String[] s8 = {"历史数据:", "","", "","", "回路健康级别:A-健康;B-故障;C-严重故障;D-失效","", ""};
+        CellStyle[] style8 = {cellStyleMap.get("centerAlignStyle1"),cellStyleMap.get("centerAlignStyle1"),cellStyleMap.get("centerAlignStyle1"),cellStyleMap.get("centerAlignStyle1"),cellStyleMap.get("centerAlignStyle1"),cellStyleMap.get("centerAlignStyle9"),cellStyleMap.get("centerAlignStyle9"),cellStyleMap.get("centerAlignStyle9")};
+        createCellOfRowWithValueStyleName(eightTitleRow,s8,style8);
+        // 分别合并第6、7、8列
+        sheet.addMergedRegion(new CellRangeAddress(rowNum-1, rowNum-1, 5, 7));
+
+        //第9行:列名
+        Row columnRow= sheet.createRow(rowNum++);
+        String[] s9 = {"时间", "联锁名称", "联锁条件", "仪表状态", "控制系统状态", "旁路状态", "联锁状态", "回路健康级别"};
+        // 各列索引
+        int tagTimeCol= 0;
+        int interlockNameCol = 1;
+        int interlockStatusCol = 6;
+        int loopHealthLevelCol = 7;
+        createCellOfRowWithValueStyle(columnRow,s9,cellStyleMap.get("centerAlignStyle"));
+
+        //如果有历史数据进行数据合并
+        if(exportList.size()!=0){
+            // 合并单元格的起始行索引
+            int startTagTimeRow = 0;
+            int startInterlockNameRow = 0;
+            int startInterlockStatusRow = 0;
+            int startLoopHealthLevelRow = 0;
+
+            for (int idx = 0; idx < exportList.size(); idx++)  {
+                InterlockSummaryHistoryVO record = exportList.get(idx);
+
+                //创建单元格、设置格式、填充数据
+                Row row = sheet.createRow(rowNum);
+                String[] s = {record.getTagTime(), record.getInterlockname(), record.getInterlockConditionTag(), record.getInstrumentStatusName(), record.getControlSystemStatusName(), record.getBypassName(), record.getInterlockStatusName(), record.getLoopHealthLevel()};
+                createCellOfRowWithValueStyle(row,s,cellStyleMap.get("centerAlignStyle3"));
+
+                // 合并 "采集时间" 列单元格
+                if (idx == 0 || !record.getTagTime().equals(exportList.get(idx - 1).getTagTime()) || !record.getInterlockname().equals(exportList.get(idx - 1).getInterlockname()) ) {
+                    if (idx > 0 && (rowNum - startTagTimeRow) > 1) {
+                        sheet.addMergedRegion(new CellRangeAddress(startTagTimeRow, rowNum - 1, tagTimeCol, tagTimeCol));
+                    }
+                    startTagTimeRow = rowNum;
+                }
+
+                // 合并 "联锁名称" 列单元格,基于 "采集时间"
+                if (idx == 0 || !record.getTagTime().equals(exportList.get(idx - 1).getTagTime()) || !record.getInterlockname().equals(exportList.get(idx - 1).getInterlockname()) || !record.getSummaryid().equals(exportList.get(idx - 1).getSummaryid()) ) {
+                    if (idx > 0 && (rowNum - startInterlockNameRow) > 1) {
+                        sheet.addMergedRegion(new CellRangeAddress(startInterlockNameRow, rowNum - 1, interlockNameCol, interlockNameCol));
+                    }
+                    startInterlockNameRow = rowNum;
+                }
+
+                // 合并 "联锁状态" 列单元格,基于 "采集时间" "联锁名称"
+                if (idx == 0 || !record.getTagTime().equals(exportList.get(idx - 1).getTagTime()) || !record.getInterlockname().equals(exportList.get(idx - 1).getInterlockname()) || !record.getInterlockStatusName().equals(exportList.get(idx - 1).getInterlockStatusName()) || !record.getSummaryid().equals(exportList.get(idx - 1).getSummaryid()) ) {
+                    if (idx > 0 && (rowNum - startInterlockStatusRow) > 1) {
+                        sheet.addMergedRegion(new CellRangeAddress(startInterlockStatusRow, rowNum - 1, interlockStatusCol, interlockStatusCol));
+                    }
+                    startInterlockStatusRow = rowNum;
+                }
+
+                // 合并 "回路健康状态" 列单元格,基于 "采集时间" "联锁名称"
+                if (idx == 0 || !record.getTagTime().equals(exportList.get(idx - 1).getTagTime()) || !record.getInterlockname().equals(exportList.get(idx - 1).getInterlockname()) || !record.getLoopHealthLevel().equals(exportList.get(idx - 1).getLoopHealthLevel()) || !record.getSummaryid().equals(exportList.get(idx - 1).getSummaryid()) ) {
+                    if (idx > 0 && (rowNum - startLoopHealthLevelRow) > 1) {
+                        sheet.addMergedRegion(new CellRangeAddress(startLoopHealthLevelRow, rowNum - 1, loopHealthLevelCol, loopHealthLevelCol));
+                    }
+                    startLoopHealthLevelRow = rowNum;
+                }
+
+                rowNum++;
+            }
+
+            // 最后一组合并区域的处理
+            // 合并 "采集时间" 列的最后一组
+            if ((rowNum - startTagTimeRow) > 1) {
+                sheet.addMergedRegion(new CellRangeAddress(startTagTimeRow, rowNum - 1, tagTimeCol, tagTimeCol));
+            }
+            // 合并 "联锁名称" 列的最后一组
+            if ((rowNum - startInterlockNameRow) > 1) {
+                sheet.addMergedRegion(new CellRangeAddress(startInterlockNameRow, rowNum - 1, interlockNameCol, interlockNameCol));
+            }
+            // 合并 "联锁状态" 列的最后一组
+            if ((rowNum - startInterlockStatusRow) > 1) {
+                sheet.addMergedRegion(new CellRangeAddress(startInterlockStatusRow, rowNum - 1, interlockStatusCol, interlockStatusCol));
+            }
+            // 合并 "回路健康状态" 列的最后一组
+            if ((rowNum - startLoopHealthLevelRow) > 1) {
+                sheet.addMergedRegion(new CellRangeAddress(startLoopHealthLevelRow, rowNum - 1, loopHealthLevelCol, loopHealthLevelCol));
+            }
+        }
+        System.out.println("系统结束-----------------------------------------------------------------------------------"+zzxtvo.getInterlockSystemName());
+
+        return workbook;
+    }
+
 
 
     public List<InterlockSummaryHistoryVO> getForExport00(InterlockHistoryQueryDTO dto){
     public List<InterlockSummaryHistoryVO> getForExport00(InterlockHistoryQueryDTO dto){
 
 

+ 91 - 0
jeecg-module-interlock/src/main/java/org/jeecg/modules/summary/vo/InterlockSummaryDayVO.java

@@ -0,0 +1,91 @@
+package org.jeecg.modules.summary.vo;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import org.jeecgframework.poi.excel.annotation.Excel;
+
+/**
+ * ClassName: InterlockSummaryDayVO
+ * Package: org.jeecg.modules.summary.vo
+ * Description: 用于日报表导出当前时刻所有联锁信息
+ *
+ * @Author sl
+ * @Create 2024/9/27 11:12
+ * @Version 1.0
+ */
+@Data
+public class InterlockSummaryDayVO {
+    /**id*/
+    @TableId(type = IdType.ASSIGN_ID)
+    @ApiModelProperty(value = "id")
+    private java.lang.String id;
+    /**联锁总表id*/
+    @ApiModelProperty(value = "联锁总表id")
+    private java.lang.String summaryid;
+    /**采集时间*/
+    @Excel(name = "采集时间", width = 30, mergeVertical = true)
+    @ApiModelProperty(value = "采集时间")
+    private java.lang.String tagTime;
+    /**联锁名称*/
+    @Excel(name = "联锁名称", width = 30, mergeVertical = true)
+    @ApiModelProperty(value = "联锁名称")
+    private java.lang.String interlockname;
+    /**联锁条件值*/
+    @ApiModelProperty(value = "联锁条件值")
+    private java.lang.String interlockCondition;
+    /**联锁条件点位*/
+    @Excel(name = "联锁条件点位", width = 30)
+    @ApiModelProperty(value = "联锁条件点位")
+    private java.lang.String interlockConditionTag;
+    /**仪表状态*/
+    @Excel(name = "仪表状态", width = 15,dicCode="instrument_status")
+    @ApiModelProperty(value = "仪表状态")
+//    @Dict(dicCode = "instrument_status")
+    private java.lang.String instrumentStatus;
+    private java.lang.String instrumentStatusName;
+    /**联锁状态*/
+    @Excel(name = "联锁状态", width = 15,dicCode="interlock_status", mergeVertical = true, mergeRely = {0})
+    @ApiModelProperty(value = "联锁状态")
+//    @Dict(dicCode = "interlock_status")
+    private java.lang.String interlockStatus;
+    private java.lang.String interlockStatusName;
+    /**旁路状态*/
+    @Excel(name = "旁路状态", width = 15,dicCode="bypass")
+//    @Dict(dicCode = "bypass")
+    @ApiModelProperty(value = "旁路状态")
+    private java.lang.String bypass;
+    private java.lang.String bypassName;
+    /**控制系统状态*/
+    @Excel(name = "控制系统状态", width = 15,dicCode="control_system_status")
+    @ApiModelProperty(value = "控制系统状态")
+//    @Dict(dicCode = "control_system_status")
+    private java.lang.String controlSystemStatus;
+    private java.lang.String controlSystemStatusName;
+    /**回路健康级别*/
+    @Excel(name = "回路健康级别", width = 15, mergeVertical = true, mergeRely = {0})
+    @ApiModelProperty(value = "回路健康级别")
+    private java.lang.String loopHealthLevel;
+    /**该联锁在原联锁总表的id*/
+    @Excel(name = "该联锁在原联锁总表的id", width = 15)
+    @ApiModelProperty(value = "该联锁在原联锁总表的id")
+    private java.lang.String summaryOriginId;
+
+    /**装置id*/
+    @Excel(name = "装置id", width = 15)
+    @ApiModelProperty(value = "装置id")
+    private java.lang.String interlockApparatusId;
+    /**系统id*/
+    @Excel(name = "系统id", width = 15)
+    @ApiModelProperty(value = "系统id")
+    private java.lang.String interlockSystemId;
+
+
+
+
+    private java.lang.String instrumentStatusNormal;
+    private java.lang.String controlSystemStatusNormal;
+    private java.lang.String interlockStatusTy;
+    private java.lang.String bypassYes;
+}