Browse Source

fix 导出

LLL 1 year ago
parent
commit
d47c41faad

+ 1 - 1
jeecg-module-interlock/src/main/java/org/jeecg/modules/history/controller/InterlockDetailHistoryController.java

@@ -62,7 +62,7 @@ public class InterlockDetailHistoryController extends JeecgController<InterlockD
 	  * 手动导出excel
 	  */
 	 //@RequiresPermissions("org.jeecg.modules:interlock_detail_history:exportXls")
-	 @RequestMapping(value = "/sdexportLS7")
+	 @RequestMapping(value = "/sdexportLS")
 	 @ApiOperation("手动导出excel")
 	 public ModelAndView exportXls1(HttpServletRequest request, InterlockHistoryQueryDTO dto) {
 		 return interlockDetailHistoryService.exportXls1(dto, InterlockSummaryHistoryVO.class, "联锁历史数据");

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

@@ -42,6 +42,7 @@
     </select>
 
     <!-- 联锁总历史数据表查询(各种逻辑状态)——用于手动导出  -->
+    <!-- 每个系统的数据 先按联锁总表的生成时间倒序排序,保证新增的联锁在最前面; 再按tag_time倒序排序,使最新发生变化的数据在最前面  -->
     <select id="getForExport" parameterType="org.jeecg.modules.history.dto.InterlockHistoryQueryDTO" resultType="org.jeecg.modules.history.vo.InterlockSummaryHistoryVO">
         select d.id, d.summaryid, 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.tag_time
@@ -64,7 +65,7 @@
                 <![CDATA[ AND TO_TIMESTAMP(s.tag_time, 'YYYY-MM-DD HH24:MI:SS') < #{endTime} ]]>
             </if>
         </where>
-        order by s.create_time desc
+        order by s.create_time desc, s.tag_time desc
     </select>
 
 

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

@@ -7,6 +7,7 @@ import org.apache.poi.ss.usermodel.Cell;
 import org.apache.poi.ss.usermodel.Row;
 import org.apache.poi.ss.usermodel.Sheet;
 import org.apache.poi.ss.usermodel.Workbook;
+import org.apache.poi.ss.util.CellRangeAddress;
 import org.apache.poi.xssf.usermodel.XSSFWorkbook;
 import org.apache.shiro.SecurityUtils;
 import org.jeecg.common.system.query.QueryGenerator;
@@ -110,11 +111,6 @@ public class InterlockDetailHistoryServiceImpl extends ServiceImpl<InterlockDeta
         for (InterlockHistoryDistinctZZXTVO zzxtvo : zzxtvoList){
             dto.setInterlockSystemId(zzxtvo.getInterlockSystemId());//系统id
             List<InterlockSummaryHistoryVO> exportList = interlockDetailHistoryMapper.getForExport(dto);
-            if(exportList!=null){
-                exportList.stream().map(i->{
-                    return zh(i);
-                }).collect(Collectors.toList());
-            }
 
             String sheetName = zzxtvo.getInterlockApparatusName()+ "-"+zzxtvo.getInterlockSystemName();
 
@@ -122,8 +118,7 @@ public class InterlockDetailHistoryServiceImpl extends ServiceImpl<InterlockDeta
             map.put(NormalExcelConstants.CLASS, InterlockSummaryHistoryVO.class);
 
             // 计算投用率
-            InterlockHistoryQueryDTO dto1 = new InterlockHistoryQueryDTO();
-            dto1 = InterlockSummaryHistoryConvert.INSTANCE.toInterlockStatus(dto,"1"); // 1投用
+            InterlockHistoryQueryDTO dto1 = InterlockSummaryHistoryConvert.INSTANCE.toInterlockStatus(dto,"1"); // 1投用
             int ty = summaryHistoryMapper.cocuntTYOrHL(dto1);
             dto1.setInterlockStatus("0"); // 0未投用
             int wty = summaryHistoryMapper.cocuntTYOrHL(dto1);
@@ -131,8 +126,7 @@ public class InterlockDetailHistoryServiceImpl extends ServiceImpl<InterlockDeta
             double tyl = (double) ty / total * 100;
 
             // 总回路数
-            InterlockHistoryQueryDTO dto2 = new InterlockHistoryQueryDTO();
-            dto2 = InterlockSummaryHistoryConvert.INSTANCE.toLoopHealthLevel(dto,"A");
+            InterlockHistoryQueryDTO dto2 = InterlockSummaryHistoryConvert.INSTANCE.toLoopHealthLevel(dto,"A");
             int loopHealthLevelA = summaryHistoryMapper.cocuntTYOrHL(dto2);
             dto2.setLoopHealthLevel("B");
             int loopHealthLevelB = summaryHistoryMapper.cocuntTYOrHL(dto2);
@@ -162,36 +156,6 @@ public class InterlockDetailHistoryServiceImpl extends ServiceImpl<InterlockDeta
     }
 
 
-    private InterlockSummaryHistoryVO zh(InterlockSummaryHistoryVO vo){
-        //仪表状态 0正常1故障
-        if(vo.getInstrumentStatus()!=null){
-            if(vo.getInstrumentStatus().equals("0")) vo.setInstrumentStatus("正常");
-            else if(vo.getInstrumentStatus().equals("1")) vo.setInstrumentStatus("故障");
-        }
-        //控制系统状态 0正常1非正常
-        if(vo.getControlSystemStatus()!=null){
-            if(vo.getControlSystemStatus().equals("0")) vo.setControlSystemStatus("正常");
-            else if(vo.getControlSystemStatus().equals("1")) vo.setControlSystemStatus("非正常");
-        }
-        //联锁状态 0未投用1投用
-        if(vo.getInterlockStatus()!=null){
-            if(vo.getInterlockStatus().equals("0")) vo.setInterlockStatus("未投用");
-            else if(vo.getInterlockStatus().equals("1")) vo.setInterlockStatus("投用");
-        }
-        //旁路状态 1是0否
-        if(vo.getBypass()!=null){
-            if(vo.getBypass().equals("0")) vo.setBypass("是");
-            else if(vo.getBypass().equals("1")) vo.setBypass("否");
-        }
-        return vo;
-    }
-
-
-
-
-
-
-
 
 
 }

+ 16 - 18
jeecg-module-interlock/src/main/java/org/jeecg/modules/history/vo/InterlockSummaryHistoryVO.java

@@ -21,15 +21,17 @@ public class InterlockSummaryHistoryVO {
     @ApiModelProperty(value = "id")
     private java.lang.String id;
     /**联锁总表id*/
-//    @Excel(name = "联锁总表id", width = 15)
     @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;
     /**联锁条件值*/
-//    @Excel(name = "联锁条件值", width = 15)
     @ApiModelProperty(value = "联锁条件值")
     private java.lang.String interlockCondition;
     /**联锁条件点位*/
@@ -37,32 +39,28 @@ public class InterlockSummaryHistoryVO {
     @ApiModelProperty(value = "联锁条件点位")
     private java.lang.String interlockConditionTag;
     /**仪表状态*/
-    @Excel(name = "仪表状态", width = 15)
+    @Excel(name = "仪表状态", width = 15,dicCode="instrument_status")
     @ApiModelProperty(value = "仪表状态")
     @Dict(dicCode = "instrument_status")
     private java.lang.String instrumentStatus;
-    /**控制系统状态*/
-    @Excel(name = "控制系统状态", width = 15)
-    @ApiModelProperty(value = "控制系统状态")
-    @Dict(dicCode = "control_system_status")
-    private java.lang.String controlSystemStatus;
     /**联锁状态*/
-    @Excel(name = "联锁状态", width = 15, mergeVertical = true)
+    @Excel(name = "联锁状态", width = 15,dicCode="interlock_status", mergeVertical = true, mergeRely = {0})
     @ApiModelProperty(value = "联锁状态")
     @Dict(dicCode = "interlock_status")
     private java.lang.String interlockStatus;
-    /**回路健康级别*/
-    @Excel(name = "回路健康级别", width = 15, mergeVertical = true)
-    @ApiModelProperty(value = "回路健康级别")
-    private java.lang.String loopHealthLevel;
     /**旁路状态*/
-    @Excel(name = "旁路状态", width = 15)
+    @Excel(name = "旁路状态", width = 15,dicCode="bypass")
     @Dict(dicCode = "bypass")
     @ApiModelProperty(value = "旁路状态")
     private java.lang.String bypass;
-    /**采集时间*/
-    @Excel(name = "采集时间", width = 30, mergeVertical = true)
-    @ApiModelProperty(value = "采集时间")
-    private java.lang.String tagTime;
+    /**控制系统状态*/
+    @Excel(name = "控制系统状态", width = 15,dicCode="control_system_status")
+    @ApiModelProperty(value = "控制系统状态")
+    @Dict(dicCode = "control_system_status")
+    private java.lang.String controlSystemStatus;
+    /**回路健康级别*/
+    @Excel(name = "回路健康级别", width = 15, mergeVertical = true, mergeRely = {0})
+    @ApiModelProperty(value = "回路健康级别")
+    private java.lang.String loopHealthLevel;
 
 }