Ver código fonte

按日统计每个系统的健康等级、联锁投用率

丁治程 8 meses atrás
pai
commit
97792720d3
15 arquivos alterados com 282 adições e 251 exclusões
  1. 4 6
      jeecg-module-interlock/src/main/java/org/jeecg/modules/history/mapper/InterlockSummaryHistoryMapper.java
  2. 1 1
      jeecg-module-interlock/src/main/java/org/jeecg/modules/history/mapper/xml/InterlockDetailHistoryMapper.xml
  3. 15 12
      jeecg-module-interlock/src/main/java/org/jeecg/modules/history/mapper/xml/InterlockSummaryHistoryMapper.xml
  4. 5 4
      jeecg-module-interlock/src/main/java/org/jeecg/modules/history/service/IInterlockSummaryHistoryService.java
  5. 4 4
      jeecg-module-interlock/src/main/java/org/jeecg/modules/history/service/impl/InterlockSummaryHistoryServiceImpl.java
  6. 0 17
      jeecg-module-interlock/src/main/java/org/jeecg/modules/interlockCount/mapper/InterlockCountMapper.java
  7. 0 14
      jeecg-module-interlock/src/main/java/org/jeecg/modules/interlockCount/service/IInterlockCountService.java
  8. 0 19
      jeecg-module-interlock/src/main/java/org/jeecg/modules/interlockCount/service/impl/InterlockCountServiceImpl.java
  9. 48 48
      jeecg-module-interlock/src/main/java/org/jeecg/modules/interlockCount/controller/InterlockCountController.java
  10. 26 22
      jeecg-module-interlock/src/main/java/org/jeecg/modules/interlockCount/entity/InterlockCount.java
  11. 17 0
      jeecg-module-interlock/src/main/java/org/jeecg/modules/interlockCountDay/mapper/InterlockCountDayMapper.java
  12. 1 1
      jeecg-module-interlock/src/main/java/org/jeecg/modules/interlockCount/mapper/xml/InterlockCountMapper.xml
  13. 14 0
      jeecg-module-interlock/src/main/java/org/jeecg/modules/interlockCountDay/service/IInterlockCountDayService.java
  14. 19 0
      jeecg-module-interlock/src/main/java/org/jeecg/modules/interlockCountDay/service/impl/InterlockCountDayServiceImpl.java
  15. 128 103
      jeecg-module-interlock/src/main/java/org/jeecg/modules/interlockjob/DayStatisticsJob.java

+ 4 - 6
jeecg-module-interlock/src/main/java/org/jeecg/modules/history/mapper/InterlockSummaryHistoryMapper.java

@@ -7,9 +7,7 @@ import org.jeecg.modules.history.dto.InterlockHistoryQueryDTO;
 import org.jeecg.modules.history.entity.InterlockSummaryHistory;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import org.jeecg.modules.history.vo.InterlockHistoryDistinctZZXTVO;
-import org.jeecg.modules.interlockCount.entity.InterlockCount;
-import org.jeecg.modules.summary.entity.InterlockSummary;
-import org.jeecg.modules.summary.vo.InterlockSummaryVO;
+import org.jeecg.modules.interlockCountDay.entity.InterlockCountDay;
 
 /**
  * @Description: 联锁总历史数据表
@@ -35,7 +33,7 @@ public interface InterlockSummaryHistoryMapper extends BaseMapper<InterlockSumma
     *   des: 按日统计 健康等级
     *   date: 2024/6/17
     */
-    List<InterlockCount> getLoopHealthLevelByTagTime(@Param("yesterday") String yesterday);
+    List<InterlockCountDay> getLoopHealthLevelByTagTime(@Param("yesterday") String yesterday);
 
 
     /**
@@ -44,7 +42,7 @@ public interface InterlockSummaryHistoryMapper extends BaseMapper<InterlockSumma
      *   des: 按日统计 投用状态(投用率)
      *   date: 2024/6/17
      */
-    List<InterlockCount> getInterlockStatusByTagTime(@Param("yesterday") String yesterday);
+    List<InterlockCountDay> getInterlockStatusByTagTime(@Param("yesterday") String yesterday);
 
     /**
     *   author: dzc
@@ -52,5 +50,5 @@ public interface InterlockSummaryHistoryMapper extends BaseMapper<InterlockSumma
     *   des:按日统计 仪表状态(查询系统下的所有联锁)
     *   date: 2024/6/18
     */
-    List<InterlockCount> getYbStatusListByTagTime(@Param("yesterday") String yesterday);
+    List<InterlockCountDay> getYbStatusListByTagTime(@Param("yesterday") String yesterday);
 }

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

@@ -87,7 +87,7 @@
 
     <!-- 日统计 仪表状态(根据联锁id查询对应时间下的联锁条件) -->
     <select id="getYbStatusListBySummaryIdAndTagTime" resultType="org.jeecg.modules.history.entity.InterlockDetailHistory">
-        select * from interlock_detail_history where summaryid = #{id} and tag_time like #{yesterday} || '%'
+        select * from interlock_detail_history where summaryid = #{id} and tag_time like TO_CHAR(#{yesterday}::timestamp, 'YYYY-MM-DD') || '%'
     </select>
 
 

+ 15 - 12
jeecg-module-interlock/src/main/java/org/jeecg/modules/history/mapper/xml/InterlockSummaryHistoryMapper.xml

@@ -54,23 +54,24 @@
     </select>
 
     <!-- 按日统计 健康等级 -->
-    <select id="getLoopHealthLevelByTagTime" resultType="org.jeecg.modules.interlockCount.entity.InterlockCount">
+    <select id="getLoopHealthLevelByTagTime" resultType="org.jeecg.modules.interlockCountDay.entity.InterlockCountDay">
         SELECT
             h.interlock_system_id as interlock_system_id,
+            b.pid as device_id,
             b.interlock_name as interlock_name,
             h.loop_health_level as count_name,
             COUNT( h.* ) AS count_num,
             '0' as count_type,
-            '10' as time_type,
-            #{yesterday} as day
+            #{yesterday} as time
         FROM
             interlock_summary_history h
             left join interlock_base b
             on h.interlock_system_id = b.id
         WHERE
-            h.tag_time LIKE #{yesterday} || '%'
+            h.tag_time LIKE TO_CHAR(#{yesterday}::timestamp, 'YYYY-MM-DD') || '%'
         GROUP BY
             h.interlock_system_id,
+            b.pid,
             b.interlock_name,
             h.loop_health_level
         ORDER BY
@@ -78,23 +79,24 @@
     </select>
 
     <!-- 按日统计 投用状态(投用率) -->
-    <select id="getInterlockStatusByTagTime" resultType="org.jeecg.modules.interlockCount.entity.InterlockCount">
+    <select id="getInterlockStatusByTagTime" resultType="org.jeecg.modules.interlockCountDay.entity.InterlockCountDay">
         SELECT
             h.interlock_system_id as interlock_system_id,
+            b.pid as device_id,
             b.interlock_name as interlock_name,
             h.interlock_status as count_name,
             COUNT( h.* ) AS count_num,
             '1' as count_type,
-            '10' as time_type,
-            #{yesterday} as day
+            #{yesterday} as time
         FROM
             "interlock_summary_history" h
             left join interlock_base b
         on h.interlock_system_id = b.id
         WHERE
-            h.tag_time like #{yesterday} || '%'
+            h.tag_time like TO_CHAR(#{yesterday}::timestamp, 'YYYY-MM-DD') || '%'
         GROUP BY
             h.interlock_system_id,
+            b.pid,
             b.interlock_name,
             h.interlock_status
         ORDER BY
@@ -102,23 +104,24 @@
     </select>
 
     <!-- 按日统计 仪表状态(查询系统下的所有联锁) -->
-    <select id="getYbStatusListByTagTime" resultType="org.jeecg.modules.interlockCount.entity.InterlockCount">
+    <select id="getYbStatusListByTagTime" resultType="org.jeecg.modules.interlockCountDay.entity.InterlockCountDay">
         SELECT
             h.interlock_system_id as interlock_system_id,
+            b.pid as device_id,
             b.interlock_name as interlock_name,
             h.id as id,
             h.interlock_name as lockname,
             '3' as count_type,
-            '10' as time_type,
-            #{yesterday} as day
+            #{yesterday} as time
         FROM
             "interlock_summary_history" h
             left join interlock_base b
         on h.interlock_system_id = b.id
         WHERE
-            h.tag_time like #{yesterday} || '%'
+            h.tag_time like TO_CHAR(#{yesterday}::timestamp, 'YYYY-MM-DD') || '%'
         GROUP BY
             h.interlock_system_id,
+            b.pid,
             b.interlock_name,
             h.id,
             h.interlock_name

+ 5 - 4
jeecg-module-interlock/src/main/java/org/jeecg/modules/history/service/IInterlockSummaryHistoryService.java

@@ -2,7 +2,8 @@ package org.jeecg.modules.history.service;
 
 import org.jeecg.modules.history.entity.InterlockSummaryHistory;
 import com.baomidou.mybatisplus.extension.service.IService;
-import org.jeecg.modules.interlockCount.entity.InterlockCount;
+import org.jeecg.modules.interlockCountDay.entity.InterlockCountDay;
+
 
 import java.util.List;
 
@@ -20,7 +21,7 @@ public interface IInterlockSummaryHistoryService extends IService<InterlockSumma
     *   des: 按日统计 健康等级
     *   date: 2024/6/17
     */
-    List<InterlockCount> getLoopHealthLevelByTagTime(String yesterday);
+    List<InterlockCountDay> getLoopHealthLevelByTagTime(String yesterday);
 
     /**
     *   author: dzc
@@ -28,7 +29,7 @@ public interface IInterlockSummaryHistoryService extends IService<InterlockSumma
     *   des: 按日统计 投用状态(投用率)
     *   date: 2024/6/17
     */
-    List<InterlockCount> getInterlockStatusByTagTime(String yesterday);
+    List<InterlockCountDay> getInterlockStatusByTagTime(String yesterday);
 
     /**
     *   author: dzc
@@ -36,5 +37,5 @@ public interface IInterlockSummaryHistoryService extends IService<InterlockSumma
     *   des: 按日统计 仪表状态(查询系统下的所有联锁)
     *   date: 2024/6/18
     */
-    List<InterlockCount> getYbStatusListByTagTime(String yesterday);
+    List<InterlockCountDay> getYbStatusListByTagTime(String yesterday);
 }

+ 4 - 4
jeecg-module-interlock/src/main/java/org/jeecg/modules/history/service/impl/InterlockSummaryHistoryServiceImpl.java

@@ -3,7 +3,7 @@ package org.jeecg.modules.history.service.impl;
 import org.jeecg.modules.history.entity.InterlockSummaryHistory;
 import org.jeecg.modules.history.mapper.InterlockSummaryHistoryMapper;
 import org.jeecg.modules.history.service.IInterlockSummaryHistoryService;
-import org.jeecg.modules.interlockCount.entity.InterlockCount;
+import org.jeecg.modules.interlockCountDay.entity.InterlockCountDay;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
@@ -32,7 +32,7 @@ public class InterlockSummaryHistoryServiceImpl extends ServiceImpl<InterlockSum
     */
 
     @Override
-    public List<InterlockCount> getLoopHealthLevelByTagTime(String yesterday) {
+    public List<InterlockCountDay> getLoopHealthLevelByTagTime(String yesterday) {
         return mapper.getLoopHealthLevelByTagTime(yesterday);
     }
 
@@ -44,7 +44,7 @@ public class InterlockSummaryHistoryServiceImpl extends ServiceImpl<InterlockSum
      */
 
     @Override
-    public List<InterlockCount> getInterlockStatusByTagTime(String yesterday) {
+    public List<InterlockCountDay> getInterlockStatusByTagTime(String yesterday) {
         return mapper.getInterlockStatusByTagTime(yesterday);
     }
 
@@ -56,7 +56,7 @@ public class InterlockSummaryHistoryServiceImpl extends ServiceImpl<InterlockSum
     */
 
     @Override
-    public List<InterlockCount> getYbStatusListByTagTime(String yesterday) {
+    public List<InterlockCountDay> getYbStatusListByTagTime(String yesterday) {
         return mapper.getYbStatusListByTagTime(yesterday);
     }
 }

+ 0 - 17
jeecg-module-interlock/src/main/java/org/jeecg/modules/interlockCount/mapper/InterlockCountMapper.java

@@ -1,17 +0,0 @@
-package org.jeecg.modules.interlockCount.mapper;
-
-import java.util.List;
-
-import org.apache.ibatis.annotations.Param;
-import org.jeecg.modules.interlockCount.entity.InterlockCount;
-import com.baomidou.mybatisplus.core.mapper.BaseMapper;
-
-/**
- * @Description: 联锁统计表
- * @Author: jeecg-boot
- * @Date:   2024-06-17
- * @Version: V1.0
- */
-public interface InterlockCountMapper extends BaseMapper<InterlockCount> {
-
-}

+ 0 - 14
jeecg-module-interlock/src/main/java/org/jeecg/modules/interlockCount/service/IInterlockCountService.java

@@ -1,14 +0,0 @@
-package org.jeecg.modules.interlockCount.service;
-
-import org.jeecg.modules.interlockCount.entity.InterlockCount;
-import com.baomidou.mybatisplus.extension.service.IService;
-
-/**
- * @Description: 联锁统计表
- * @Author: jeecg-boot
- * @Date:   2024-06-17
- * @Version: V1.0
- */
-public interface IInterlockCountService extends IService<InterlockCount> {
-
-}

+ 0 - 19
jeecg-module-interlock/src/main/java/org/jeecg/modules/interlockCount/service/impl/InterlockCountServiceImpl.java

@@ -1,19 +0,0 @@
-package org.jeecg.modules.interlockCount.service.impl;
-
-import org.jeecg.modules.interlockCount.entity.InterlockCount;
-import org.jeecg.modules.interlockCount.mapper.InterlockCountMapper;
-import org.jeecg.modules.interlockCount.service.IInterlockCountService;
-import org.springframework.stereotype.Service;
-
-import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
-
-/**
- * @Description: 联锁统计表
- * @Author: jeecg-boot
- * @Date:   2024-06-17
- * @Version: V1.0
- */
-@Service
-public class InterlockCountServiceImpl extends ServiceImpl<InterlockCountMapper, InterlockCount> implements IInterlockCountService {
-
-}

+ 48 - 48
jeecg-module-interlock/src/main/java/org/jeecg/modules/interlockCount/controller/InterlockCountController.java

@@ -1,4 +1,4 @@
-package org.jeecg.modules.interlockCount.controller;
+package org.jeecg.modules.interlockCountDay.controller;
 
 import java.util.Arrays;
 import java.util.List;
@@ -12,8 +12,8 @@ import javax.servlet.http.HttpServletResponse;
 import org.jeecg.common.api.vo.Result;
 import org.jeecg.common.system.query.QueryGenerator;
 import org.jeecg.common.util.oConvertUtils;
-import org.jeecg.modules.interlockCount.entity.InterlockCount;
-import org.jeecg.modules.interlockCount.service.IInterlockCountService;
+import org.jeecg.modules.interlockCountDay.entity.InterlockCountDay;
+import org.jeecg.modules.interlockCountDay.service.IInterlockCountDayService;
 
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
@@ -37,68 +37,68 @@ import io.swagger.annotations.ApiOperation;
 import org.jeecg.common.aspect.annotation.AutoLog;
 
  /**
- * @Description: 联锁统计表
+ * @Description: interlock_count_day
  * @Author: jeecg-boot
- * @Date:   2024-06-17
+ * @Date:   2024-06-28
  * @Version: V1.0
  */
-@Api(tags="联锁统计表")
+@Api(tags="interlock_count_day")
 @RestController
-@RequestMapping("/interlockCount/interlockCount")
+@RequestMapping("/interlockCountDay/interlockCountDay")
 @Slf4j
-public class InterlockCountController extends JeecgController<InterlockCount, IInterlockCountService> {
+public class InterlockCountDayController extends JeecgController<InterlockCountDay, IInterlockCountDayService> {
 	@Autowired
-	private IInterlockCountService interlockCountService;
+	private IInterlockCountDayService interlockCountDayService;
 	
 	/**
 	 * 分页列表查询
 	 *
-	 * @param interlockCount
+	 * @param interlockCountDay
 	 * @param pageNo
 	 * @param pageSize
 	 * @param req
 	 * @return
 	 */
-	//@AutoLog(value = "联锁统计表-分页列表查询")
-	@ApiOperation(value="联锁统计表-分页列表查询", notes="联锁统计表-分页列表查询")
+	//@AutoLog(value = "interlock_count_day-分页列表查询")
+	@ApiOperation(value="interlock_count_day-分页列表查询", notes="interlock_count_day-分页列表查询")
 	@GetMapping(value = "/list")
-	public Result<IPage<InterlockCount>> queryPageList(InterlockCount interlockCount,
+	public Result<IPage<InterlockCountDay>> queryPageList(InterlockCountDay interlockCountDay,
 								   @RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
 								   @RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
 								   HttpServletRequest req) {
-		QueryWrapper<InterlockCount> queryWrapper = QueryGenerator.initQueryWrapper(interlockCount, req.getParameterMap());
-		Page<InterlockCount> page = new Page<InterlockCount>(pageNo, pageSize);
-		IPage<InterlockCount> pageList = interlockCountService.page(page, queryWrapper);
+		QueryWrapper<InterlockCountDay> queryWrapper = QueryGenerator.initQueryWrapper(interlockCountDay, req.getParameterMap());
+		Page<InterlockCountDay> page = new Page<InterlockCountDay>(pageNo, pageSize);
+		IPage<InterlockCountDay> pageList = interlockCountDayService.page(page, queryWrapper);
 		return Result.OK(pageList);
 	}
 	
 	/**
 	 *   添加
 	 *
-	 * @param interlockCount
+	 * @param interlockCountDay
 	 * @return
 	 */
-	@AutoLog(value = "联锁统计表-添加")
-	@ApiOperation(value="联锁统计表-添加", notes="联锁统计表-添加")
-	//@RequiresPermissions("org.jeecg.modules:interlock_count:add")
+	@AutoLog(value = "interlock_count_day-添加")
+	@ApiOperation(value="interlock_count_day-添加", notes="interlock_count_day-添加")
+	//@RequiresPermissions("org.jeecg.modules:interlock_count_day:add")
 	@PostMapping(value = "/add")
-	public Result<String> add(@RequestBody InterlockCount interlockCount) {
-		interlockCountService.save(interlockCount);
+	public Result<String> add(@RequestBody InterlockCountDay interlockCountDay) {
+		interlockCountDayService.save(interlockCountDay);
 		return Result.OK("添加成功!");
 	}
 	
 	/**
 	 *  编辑
 	 *
-	 * @param interlockCount
+	 * @param interlockCountDay
 	 * @return
 	 */
-	@AutoLog(value = "联锁统计表-编辑")
-	@ApiOperation(value="联锁统计表-编辑", notes="联锁统计表-编辑")
-	//@RequiresPermissions("org.jeecg.modules:interlock_count:edit")
+	@AutoLog(value = "interlock_count_day-编辑")
+	@ApiOperation(value="interlock_count_day-编辑", notes="interlock_count_day-编辑")
+	//@RequiresPermissions("org.jeecg.modules:interlock_count_day:edit")
 	@RequestMapping(value = "/edit", method = {RequestMethod.PUT,RequestMethod.POST})
-	public Result<String> edit(@RequestBody InterlockCount interlockCount) {
-		interlockCountService.updateById(interlockCount);
+	public Result<String> edit(@RequestBody InterlockCountDay interlockCountDay) {
+		interlockCountDayService.updateById(interlockCountDay);
 		return Result.OK("编辑成功!");
 	}
 	
@@ -108,12 +108,12 @@ public class InterlockCountController extends JeecgController<InterlockCount, II
 	 * @param id
 	 * @return
 	 */
-	@AutoLog(value = "联锁统计表-通过id删除")
-	@ApiOperation(value="联锁统计表-通过id删除", notes="联锁统计表-通过id删除")
-	//@RequiresPermissions("org.jeecg.modules:interlock_count:delete")
+	@AutoLog(value = "interlock_count_day-通过id删除")
+	@ApiOperation(value="interlock_count_day-通过id删除", notes="interlock_count_day-通过id删除")
+	//@RequiresPermissions("org.jeecg.modules:interlock_count_day:delete")
 	@DeleteMapping(value = "/delete")
 	public Result<String> delete(@RequestParam(name="id",required=true) String id) {
-		interlockCountService.removeById(id);
+		interlockCountDayService.removeById(id);
 		return Result.OK("删除成功!");
 	}
 	
@@ -123,12 +123,12 @@ public class InterlockCountController extends JeecgController<InterlockCount, II
 	 * @param ids
 	 * @return
 	 */
-	@AutoLog(value = "联锁统计表-批量删除")
-	@ApiOperation(value="联锁统计表-批量删除", notes="联锁统计表-批量删除")
-	//@RequiresPermissions("org.jeecg.modules:interlock_count:deleteBatch")
+	@AutoLog(value = "interlock_count_day-批量删除")
+	@ApiOperation(value="interlock_count_day-批量删除", notes="interlock_count_day-批量删除")
+	//@RequiresPermissions("org.jeecg.modules:interlock_count_day:deleteBatch")
 	@DeleteMapping(value = "/deleteBatch")
 	public Result<String> deleteBatch(@RequestParam(name="ids",required=true) String ids) {
-		this.interlockCountService.removeByIds(Arrays.asList(ids.split(",")));
+		this.interlockCountDayService.removeByIds(Arrays.asList(ids.split(",")));
 		return Result.OK("批量删除成功!");
 	}
 	
@@ -138,27 +138,27 @@ public class InterlockCountController extends JeecgController<InterlockCount, II
 	 * @param id
 	 * @return
 	 */
-	//@AutoLog(value = "联锁统计表-通过id查询")
-	@ApiOperation(value="联锁统计表-通过id查询", notes="联锁统计表-通过id查询")
+	//@AutoLog(value = "interlock_count_day-通过id查询")
+	@ApiOperation(value="interlock_count_day-通过id查询", notes="interlock_count_day-通过id查询")
 	@GetMapping(value = "/queryById")
-	public Result<InterlockCount> queryById(@RequestParam(name="id",required=true) String id) {
-		InterlockCount interlockCount = interlockCountService.getById(id);
-		if(interlockCount==null) {
+	public Result<InterlockCountDay> queryById(@RequestParam(name="id",required=true) String id) {
+		InterlockCountDay interlockCountDay = interlockCountDayService.getById(id);
+		if(interlockCountDay==null) {
 			return Result.error("未找到对应数据");
 		}
-		return Result.OK(interlockCount);
+		return Result.OK(interlockCountDay);
 	}
 
     /**
     * 导出excel
     *
     * @param request
-    * @param interlockCount
+    * @param interlockCountDay
     */
-    //@RequiresPermissions("org.jeecg.modules:interlock_count:exportXls")
+    //@RequiresPermissions("org.jeecg.modules:interlock_count_day:exportXls")
     @RequestMapping(value = "/exportXls")
-    public ModelAndView exportXls(HttpServletRequest request, InterlockCount interlockCount) {
-        return super.exportXls(request, interlockCount, InterlockCount.class, "联锁统计表");
+    public ModelAndView exportXls(HttpServletRequest request, InterlockCountDay interlockCountDay) {
+        return super.exportXls(request, interlockCountDay, InterlockCountDay.class, "interlock_count_day");
     }
 
     /**
@@ -168,10 +168,10 @@ public class InterlockCountController extends JeecgController<InterlockCount, II
     * @param response
     * @return
     */
-    //@RequiresPermissions("interlock_count:importExcel")
+    //@RequiresPermissions("interlock_count_day:importExcel")
     @RequestMapping(value = "/importExcel", method = RequestMethod.POST)
     public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
-        return super.importExcel(request, response, InterlockCount.class);
+        return super.importExcel(request, response, InterlockCountDay.class);
     }
 
 }

+ 26 - 22
jeecg-module-interlock/src/main/java/org/jeecg/modules/interlockCount/entity/InterlockCount.java

@@ -1,4 +1,4 @@
-package org.jeecg.modules.interlockCount.entity;
+package org.jeecg.modules.interlockCountDay.entity;
 
 import java.io.Serializable;
 import java.io.UnsupportedEncodingException;
@@ -19,17 +19,17 @@ import lombok.EqualsAndHashCode;
 import lombok.experimental.Accessors;
 
 /**
- * @Description: 联锁统计表
+ * @Description: interlock_count_day
  * @Author: jeecg-boot
- * @Date:   2024-06-17
+ * @Date:   2024-06-28
  * @Version: V1.0
  */
 @Data
-@TableName("interlock_count")
+@TableName("interlock_count_day")
 @Accessors(chain = true)
 @EqualsAndHashCode(callSuper = false)
-@ApiModel(value="interlock_count对象", description="联锁统计表")
-public class InterlockCount implements Serializable {
+@ApiModel(value="interlock_count_day对象", description="interlock_count_day")
+public class InterlockCountDay implements Serializable {
     private static final long serialVersionUID = 1L;
 
 	/**主键*/
@@ -44,32 +44,36 @@ public class InterlockCount implements Serializable {
 	@Excel(name = "系统名称", width = 15)
     @ApiModelProperty(value = "系统名称")
     private java.lang.String interlockName;
-	/**统计名称(健康等级0/联锁状态1/投用率2/仪表状态3/系统状态4)*/
-	@Excel(name = "统计名称(健康等级0/联锁状态1/投用率2/仪表状态3/系统状态4)", width = 15)
-    @ApiModelProperty(value = "统计名称(健康等级0/联锁状态1/投用率2/仪表状态3/系统状态4)")
+	/**统计名称(A/B/C/D、正常/异常、投用/未投用、投用率)*/
+	@Excel(name = "统计名称(A/B/C/D、正常/异常、投用/未投用、投用率)", width = 15)
+    @ApiModelProperty(value = "统计名称(A/B/C/D、正常/异常、投用/未投用、投用率)")
     private java.lang.String countName;
 	/**统计数量*/
 	@Excel(name = "统计数量", width = 15)
     @ApiModelProperty(value = "统计数量")
     private java.lang.String countNum;
-	/**统计类型(健康等级/仪表状态/投用率)*/
+	/**统计类型(健康等级0/联锁状态1/投用率2/仪表状态3/系统状态4)*/
 	@Excel(name = "统计类型(健康等级0/联锁状态1/投用率2/仪表状态3/系统状态4)", width = 15)
     @ApiModelProperty(value = "统计类型(健康等级0/联锁状态1/投用率2/仪表状态3/系统状态4)")
     private java.lang.String countType;
-	/**统计时间类型(按天/按月/按年)*/
-	@Excel(name = "统计时间类型(按天/按月/按年)", width = 15)
-    @ApiModelProperty(value = "统计时间类型(按天/按月/按年)")
-    private java.lang.String timeType;
-    /**按日统计的时间*/
-    @Excel(name = "按日统计的时间", width = 15)
+	/**按日统计的时间*/
+	@Excel(name = "按日统计的时间", width = 15)
     @ApiModelProperty(value = "按日统计的时间")
+    private java.lang.String time;
+    /**日*/
+    @Excel(name = "日", width = 15)
+    @ApiModelProperty(value = "日")
     private java.lang.String day;
-	/**按月统计的时间*/
-	@Excel(name = "按月统计的时间", width = 15)
-    @ApiModelProperty(value = "按月统计的时间")
+	/**年月*/
+	@Excel(name = "年月", width = 15)
+    @ApiModelProperty(value = "年月")
     private java.lang.String yearmonth;
-	/**统计的时间*/
-	@Excel(name = "统计的时间", width = 15)
-    @ApiModelProperty(value = "统计的时间")
+	/**年*/
+	@Excel(name = "年", width = 15)
+    @ApiModelProperty(value = "年")
     private java.lang.String year;
+    /**装置id*/
+    @Excel(name = "装置id", width = 15)
+    @ApiModelProperty(value = "装置id")
+    private java.lang.String deviceId;
 }

+ 17 - 0
jeecg-module-interlock/src/main/java/org/jeecg/modules/interlockCountDay/mapper/InterlockCountDayMapper.java

@@ -0,0 +1,17 @@
+package org.jeecg.modules.interlockCountDay.mapper;
+
+import java.util.List;
+
+import org.apache.ibatis.annotations.Param;
+import org.jeecg.modules.interlockCountDay.entity.InterlockCountDay;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+
+/**
+ * @Description: interlock_count_day
+ * @Author: jeecg-boot
+ * @Date:   2024-06-28
+ * @Version: V1.0
+ */
+public interface InterlockCountDayMapper extends BaseMapper<InterlockCountDay> {
+
+}

+ 1 - 1
jeecg-module-interlock/src/main/java/org/jeecg/modules/interlockCount/mapper/xml/InterlockCountMapper.xml

@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
-<mapper namespace="org.jeecg.modules.interlockCount.mapper.InterlockCountMapper">
+<mapper namespace="org.jeecg.modules.interlockCountDay.mapper.InterlockCountDayMapper">
 
 </mapper>

+ 14 - 0
jeecg-module-interlock/src/main/java/org/jeecg/modules/interlockCountDay/service/IInterlockCountDayService.java

@@ -0,0 +1,14 @@
+package org.jeecg.modules.interlockCountDay.service;
+
+import org.jeecg.modules.interlockCountDay.entity.InterlockCountDay;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+/**
+ * @Description: interlock_count_day
+ * @Author: jeecg-boot
+ * @Date:   2024-06-28
+ * @Version: V1.0
+ */
+public interface IInterlockCountDayService extends IService<InterlockCountDay> {
+
+}

+ 19 - 0
jeecg-module-interlock/src/main/java/org/jeecg/modules/interlockCountDay/service/impl/InterlockCountDayServiceImpl.java

@@ -0,0 +1,19 @@
+package org.jeecg.modules.interlockCountDay.service.impl;
+
+import org.jeecg.modules.interlockCountDay.entity.InterlockCountDay;
+import org.jeecg.modules.interlockCountDay.mapper.InterlockCountDayMapper;
+import org.jeecg.modules.interlockCountDay.service.IInterlockCountDayService;
+import org.springframework.stereotype.Service;
+
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+
+/**
+ * @Description: interlock_count_day
+ * @Author: jeecg-boot
+ * @Date:   2024-06-28
+ * @Version: V1.0
+ */
+@Service
+public class InterlockCountDayServiceImpl extends ServiceImpl<InterlockCountDayMapper, InterlockCountDay> implements IInterlockCountDayService {
+
+}

+ 128 - 103
jeecg-module-interlock/src/main/java/org/jeecg/modules/interlockjob/DayStatisticsJob.java

@@ -1,15 +1,17 @@
 package org.jeecg.modules.interlockjob;
 
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import lombok.extern.slf4j.Slf4j;
 import org.jeecg.common.util.DateUtils;
 import org.jeecg.modules.base.entity.InterlockBase;
+import org.jeecg.modules.base.entity.InterlockBaseHy;
+import org.jeecg.modules.base.service.IInterlockBaseHyService;
 import org.jeecg.modules.base.service.IInterlockBaseService;
 import org.jeecg.modules.history.entity.InterlockDetailHistory;
-import org.jeecg.modules.history.entity.InterlockSummaryHistory;
 import org.jeecg.modules.history.service.IInterlockDetailHistoryService;
 import org.jeecg.modules.history.service.IInterlockSummaryHistoryService;
-import org.jeecg.modules.interlockCount.entity.InterlockCount;
-import org.jeecg.modules.interlockCount.service.IInterlockCountService;
+import org.jeecg.modules.interlockCountDay.entity.InterlockCountDay;
+import org.jeecg.modules.interlockCountDay.service.IInterlockCountDayService;
 import org.quartz.Job;
 import org.quartz.JobExecutionContext;
 import org.quartz.JobExecutionException;
@@ -18,7 +20,6 @@ import org.springframework.stereotype.Component;
 
 import java.math.BigDecimal;
 import java.math.RoundingMode;
-import java.text.SimpleDateFormat;
 import java.time.LocalDate;
 import java.time.format.DateTimeFormatter;
 import java.util.ArrayList;
@@ -44,7 +45,7 @@ public class DayStatisticsJob implements Job {
 
     @Autowired
     @SuppressWarnings("all")
-    private IInterlockCountService countService;
+    private IInterlockCountDayService countService;
 
     @Autowired
     @SuppressWarnings("all")
@@ -54,54 +55,58 @@ public class DayStatisticsJob implements Job {
     @SuppressWarnings("all")
     private IInterlockBaseService baseService;
 
+    @Autowired
+    @SuppressWarnings("all")
+    private IInterlockBaseHyService baseHyService;
+
     @Override
     public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
         // 日统计的定时任务  统计 每个系统下的每个联锁 健康等级(A/B/C/D)、联锁状态,每个联锁条件的仪表状态 的个数
-        DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
-        String currentDay = DateUtils.getDate("yyyy-MM-dd");  // 当前日期
+        DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
+        String currentDay = DateUtils.getDate("yyyy-MM-dd HH:mm:ss");  // 当前日期
         LocalDate yesterDate = LocalDate.now().minusDays(1);  // 当前 00:00:00 执行定时任务 减一天获取昨天的日期
-        //String yesterday = yesterDate.format(formatter); // 昨天的日期
-        String yesterday = "2024-06-26"; // 测试模拟的昨天日期
+        String yesterday = yesterDate.format(formatter); // 昨天的日期
+        //String yesterday = "2024-06-28 00:00:00"; // 测试模拟的昨天日期
 
         // 统计健康等级 count_type = 0
-        List<InterlockCount> loopHealthLevelList = summaryHistoryService.getLoopHealthLevelByTagTime(yesterday);
+        List<InterlockCountDay> loopHealthLevelList = summaryHistoryService.getLoopHealthLevelByTagTime(yesterday);
 
-        HashMap<String, List<InterlockCount>> loopHealthLevelMap = new HashMap<>();
-        for (InterlockCount item:loopHealthLevelList) {
+        HashMap<String, List<InterlockCountDay>> loopHealthLevelMap = new HashMap<>();
+        for (InterlockCountDay item:loopHealthLevelList) {
             if (loopHealthLevelMap.containsKey(item.getInterlockSystemId())){
                 loopHealthLevelMap.get(item.getInterlockSystemId()).add(item);
             }else {
-                ArrayList<InterlockCount> countList = new ArrayList<>();
+                ArrayList<InterlockCountDay> countList = new ArrayList<>();
                 countList.add(item);
                 loopHealthLevelMap.put(item.getInterlockSystemId(),countList);
             }
         }
 
-        ArrayList<InterlockCount> loopHealthLevelResultList = new ArrayList<>();
+        ArrayList<InterlockCountDay> loopHealthLevelResultList = new ArrayList<>();
         ArrayList<String> djList = new ArrayList<>();
         djList.add("A");
         djList.add("B");
         djList.add("C");
         djList.add("D");
         for (String key:loopHealthLevelMap.keySet()){
-            List<InterlockCount> sonList = loopHealthLevelMap.get(key);
+            List<InterlockCountDay> sonList = loopHealthLevelMap.get(key);
             if (sonList.size() != 4){
                 ArrayList<String> jkdjList = new ArrayList<>();
-                for (InterlockCount son : sonList) {
+                for (InterlockCountDay son : sonList) {
                     jkdjList.add(son.getCountName());
                 }
                 List<String> difference = djList.stream()
                         .filter(item -> !jkdjList.contains(item))
                         .collect(Collectors.toList());
                 for (String d:difference) {
-                    InterlockCount interlockCount = new InterlockCount();
+                    InterlockCountDay interlockCount = new InterlockCountDay();
                     interlockCount.setInterlockSystemId(key);
+                    interlockCount.setDeviceId(sonList.get(0).getDeviceId());
                     interlockCount.setInterlockName(sonList.get(0).getInterlockName());
                     interlockCount.setCountName(d);
                     interlockCount.setCountNum("0");
                     interlockCount.setCountType("0");
-                    interlockCount.setTimeType("10");
-                    interlockCount.setDay(yesterday);
+                    interlockCount.setTime(yesterday);
                     sonList.add(interlockCount);
                 }
             }
@@ -112,20 +117,20 @@ public class DayStatisticsJob implements Job {
         //countService.saveBatch(loopHealthLevelResultList);
 
         // 统计联锁状态(投用/未投用)  count_type = 1
-        List<InterlockCount> interlockStatusList = summaryHistoryService.getInterlockStatusByTagTime(yesterday);
+        List<InterlockCountDay> interlockStatusList = summaryHistoryService.getInterlockStatusByTagTime(yesterday);
 
-        HashMap<String, List<InterlockCount>> interlockStatusMap = new HashMap<>();
-        for (InterlockCount item:interlockStatusList) {
+        HashMap<String, List<InterlockCountDay>> interlockStatusMap = new HashMap<>();
+        for (InterlockCountDay item:interlockStatusList) {
             if (interlockStatusMap.containsKey(item.getInterlockSystemId())){
                 interlockStatusMap.get(item.getInterlockSystemId()).add(item);
             }else {
-                ArrayList<InterlockCount> countList = new ArrayList<>();
+                ArrayList<InterlockCountDay> countList = new ArrayList<>();
                 countList.add(item);
                 interlockStatusMap.put(item.getInterlockSystemId(),countList);
             }
         }
 
-        ArrayList<InterlockCount> interlockStatusResultList = new ArrayList<>();
+        ArrayList<InterlockCountDay> interlockStatusResultList = new ArrayList<>();
         //ArrayList<String> lsList = new ArrayList<>();
         //lsList.add("0");
         //lsList.add("1");
@@ -134,41 +139,45 @@ public class DayStatisticsJob implements Job {
             ArrayList<String> lsList = new ArrayList<>();
             lsList.add(base.getInterlockStatusTy());
             lsList.add(inversionStatus(base.getInterlockStatusTy()));
-            List<InterlockCount> sonList = interlockStatusMap.get(key);
+            List<InterlockCountDay> sonList = interlockStatusMap.get(key);
             if (sonList.size() != 2){
                 ArrayList<String> lsStatusList = new ArrayList<>();
-                for (InterlockCount son : sonList) {
+                for (InterlockCountDay son : sonList) {
                     lsStatusList.add(son.getCountName());
                 }
                 List<String> difference = lsList.stream()
                         .filter(item -> !lsStatusList.contains(item))
                         .collect(Collectors.toList());
                 for (String d:difference) {
-                    InterlockCount interlockCount = new InterlockCount();
+                    InterlockCountDay interlockCount = new InterlockCountDay();
                     interlockCount.setInterlockSystemId(key);
+                    interlockCount.setDeviceId(sonList.get(0).getDeviceId());
                     interlockCount.setInterlockName(sonList.get(0).getInterlockName());
                     interlockCount.setCountName(d);
                     interlockCount.setCountNum("0");
                     interlockCount.setCountType("1");
-                    interlockCount.setTimeType("10");
-                    interlockCount.setDay(yesterday);
+                    interlockCount.setTime(yesterday);
                     sonList.add(interlockCount);
                 }
             }
+            for (InterlockCountDay son : sonList) {
+                InterlockBaseHy baseHy = getBaseHyByQuery("interlock_status",key,son.getCountName());
+                son.setCountName(baseHy.getInterlockStatusName());
+            }
             interlockStatusResultList.addAll(sonList);
         }
 
         //countService.saveBatch(interlockStatusResultList);
 
         // 统计投用率  count_type = 2
-        ArrayList<InterlockCount> tylResultList = new ArrayList<>();
+        ArrayList<InterlockCountDay> tylResultList = new ArrayList<>();
 
-        HashMap<String, List<InterlockCount>> tylMap = new HashMap<>();
-        for (InterlockCount item:interlockStatusResultList) {
+        HashMap<String, List<InterlockCountDay>> tylMap = new HashMap<>();
+        for (InterlockCountDay item:interlockStatusResultList) {
             if (tylMap.containsKey(item.getInterlockSystemId())){
                 tylMap.get(item.getInterlockSystemId()).add(item);
             }else {
-                ArrayList<InterlockCount> countList = new ArrayList<>();
+                ArrayList<InterlockCountDay> countList = new ArrayList<>();
                 countList.add(item);
                 tylMap.put(item.getInterlockSystemId(),countList);
             }
@@ -176,15 +185,17 @@ public class DayStatisticsJob implements Job {
 
         for (String key:tylMap.keySet()) {
             InterlockBase base = baseService.getById(key);
-            List<InterlockCount> sonList = tylMap.get(key);
+            List<InterlockCountDay> sonList = tylMap.get(key);
             BigDecimal yty = BigDecimal.valueOf(0);
             BigDecimal wty = BigDecimal.valueOf(0);
             BigDecimal tyl = BigDecimal.valueOf(0);
-            for (InterlockCount son:sonList) {
-                if (inversionStatus(base.getInterlockStatusTy()).equals(son.getCountName())){
+            for (InterlockCountDay son:sonList) {
+                InterlockBaseHy baseHy1 = getBaseHyByQuery("interlock_status",key,inversionStatus(base.getInterlockStatusTy()));
+                InterlockBaseHy baseHy2 = getBaseHyByQuery("interlock_status",key,base.getInterlockStatusTy());
+                if (baseHy1.getInterlockStatusName().equals(son.getCountName())){
                     wty = wty.add(new BigDecimal(son.getCountNum()));
                 }
-                if (base.getInterlockStatusTy().equals(son.getCountName())){
+                if (baseHy2.getInterlockStatusName().equals(son.getCountName())){
                     yty = yty.add(new BigDecimal(son.getCountNum()));
                 }
             }
@@ -192,92 +203,100 @@ public class DayStatisticsJob implements Job {
             if ((total.compareTo(BigDecimal.valueOf(0)) != 0)){
                 tyl = yty.divide(total,2, RoundingMode.HALF_UP).multiply(BigDecimal.valueOf(100));
             }
-            InterlockCount interlockCount = new InterlockCount();
+            InterlockCountDay interlockCount = new InterlockCountDay();
             interlockCount.setInterlockSystemId(key);
+            interlockCount.setDeviceId(sonList.get(0).getDeviceId());
             interlockCount.setInterlockName(sonList.get(0).getInterlockName());
             interlockCount.setCountName("投用率");
             interlockCount.setCountNum(String.valueOf(tyl));
             interlockCount.setCountType("2");
-            interlockCount.setTimeType("10");
-            interlockCount.setDay(yesterday);
+            interlockCount.setTime(yesterday);
             tylResultList.add(interlockCount);
         }
 
         //countService.saveBatch(tylResultList);
 
         // 统计仪表状态  count_type = 3
-        List<InterlockCount> ybStatusList = summaryHistoryService.getYbStatusListByTagTime(yesterday);
-
-        ArrayList<InterlockCount> ybResultList = new ArrayList<>();
-
-        HashMap<String, List<InterlockCount>> ybStatusMap = new HashMap<>();
-        for (InterlockCount item:ybStatusList) {
-            if (ybStatusMap.containsKey(item.getInterlockSystemId())){
-                ybStatusMap.get(item.getInterlockSystemId()).add(item);
-            }else {
-                ArrayList<InterlockCount> countList = new ArrayList<>();
-                countList.add(item);
-                ybStatusMap.put(item.getInterlockSystemId(),countList);
-            }
-        }
-
-        for (String key : ybStatusMap.keySet()) {
-            InterlockBase base = baseService.getById(key);
-            List<InterlockCount> interlockList = ybStatusMap.get(key);
-            for (InterlockCount item : interlockList) {
-                int count = 0;
-                List<InterlockDetailHistory> detailHistoryList = detailHistoryService.getYbStatusListBySummaryIdAndTagTime(item.getId(),yesterday);
-                // 遍历集合 查询仪表状态 是否异常 如果有一个异常的 总的仪表状态为异常
-                for (InterlockDetailHistory detail : detailHistoryList) {
-                    if (inversionStatus(base.getInstrumentStatusNormal()).equals(detail.getInstrumentStatus())){
-                        count++;
-                    }
-                }
-                if (count != 0){
-                    item.setCountNum("1");
-                }
-            }
-            int totalCount1 = 0; // 异常的数量
-            int totalCount2 = 0; // 正常的数量
-            for (InterlockCount item : interlockList) {
-                if ("1".equals(item.getCountNum())){
-                    totalCount1++;
-                }else {
-                    totalCount2++;
-                }
-            }
-
-            InterlockCount interlockCount1 = new InterlockCount();
-            interlockCount1.setInterlockSystemId(key);
-            interlockCount1.setInterlockName(interlockList.get(0).getInterlockName());
-            interlockCount1.setCountName(base.getInstrumentStatusNormal());
-            interlockCount1.setCountNum(String.valueOf(totalCount2));
-            interlockCount1.setCountType("3");
-            interlockCount1.setTimeType("10");
-            interlockCount1.setDay(yesterday);
-
-            InterlockCount interlockCount2 = new InterlockCount();
-            interlockCount2.setInterlockSystemId(key);
-            interlockCount2.setInterlockName(interlockList.get(0).getInterlockName());
-            interlockCount2.setCountName(inversionStatus(base.getInstrumentStatusNormal()));
-            interlockCount2.setCountNum(String.valueOf(totalCount1));
-            interlockCount2.setCountType("3");
-            interlockCount2.setTimeType("10");
-            interlockCount2.setDay(yesterday);
-
-            ybResultList.add(interlockCount1);
-            ybResultList.add(interlockCount2);
-        }
+        //List<InterlockCountDay> ybStatusList = summaryHistoryService.getYbStatusListByTagTime(yesterday);
+        //
+        //ArrayList<InterlockCountDay> ybResultList = new ArrayList<>();
+        //
+        //HashMap<String, List<InterlockCountDay>> ybStatusMap = new HashMap<>();
+        //for (InterlockCountDay item:ybStatusList) {
+        //    if (ybStatusMap.containsKey(item.getInterlockSystemId())){
+        //        ybStatusMap.get(item.getInterlockSystemId()).add(item);
+        //    }else {
+        //        ArrayList<InterlockCountDay> countList = new ArrayList<>();
+        //        countList.add(item);
+        //        ybStatusMap.put(item.getInterlockSystemId(),countList);
+        //    }
+        //}
+        //
+        //for (String key : ybStatusMap.keySet()) {
+        //    InterlockBase base = baseService.getById(key);
+        //    List<InterlockCountDay> interlockList = ybStatusMap.get(key);
+        //    for (InterlockCountDay item : interlockList) {
+        //        int count = 0;
+        //        List<InterlockDetailHistory> detailHistoryList = detailHistoryService.getYbStatusListBySummaryIdAndTagTime(item.getId(),yesterday);
+        //        // 遍历集合 查询仪表状态 是否异常 如果有一个异常的 总的仪表状态为异常
+        //        for (InterlockDetailHistory detail : detailHistoryList) {
+        //            if (inversionStatus(base.getInstrumentStatusNormal()).equals(detail.getInstrumentStatus())){
+        //                count++;
+        //            }
+        //        }
+        //        if (count != 0){
+        //            item.setCountNum("1");
+        //        }
+        //    }
+        //    int totalCount1 = 0; // 异常的数量
+        //    int totalCount2 = 0; // 正常的数量
+        //    for (InterlockCountDay item : interlockList) {
+        //        if ("1".equals(item.getCountNum())){
+        //            totalCount1++;
+        //        }else {
+        //            totalCount2++;
+        //        }
+        //    }
+        //
+        //    InterlockBaseHy ybHy1 = getBaseHyByQuery("instrument_status", key, base.getInstrumentStatusNormal());
+        //
+        //    InterlockCountDay interlockCount1 = new InterlockCountDay();
+        //    interlockCount1.setInterlockSystemId(key);
+        //    interlockCount1.setDeviceId(interlockList.get(0).getDeviceId());
+        //    interlockCount1.setInterlockName(interlockList.get(0).getInterlockName());
+        //    interlockCount1.setCountName(ybHy1.getInstrumentStatusName());
+        //    interlockCount1.setCountNum(String.valueOf(totalCount2));
+        //    interlockCount1.setCountType("3");
+        //    interlockCount1.setTime(yesterday);
+        //
+        //    InterlockBaseHy ybHy2 = getBaseHyByQuery("instrument_status", key, inversionStatus(base.getInstrumentStatusNormal()));
+        //
+        //    InterlockCountDay interlockCount2 = new InterlockCountDay();
+        //    interlockCount2.setInterlockSystemId(key);
+        //    interlockCount2.setDeviceId(interlockList.get(0).getDeviceId());
+        //    interlockCount2.setInterlockName(interlockList.get(0).getInterlockName());
+        //    interlockCount2.setCountName(ybHy2.getInstrumentStatusName());
+        //    interlockCount2.setCountNum(String.valueOf(totalCount1));
+        //    interlockCount2.setCountType("3");
+        //    interlockCount2.setTime(yesterday);
+        //
+        //    ybResultList.add(interlockCount1);
+        //    ybResultList.add(interlockCount2);
+        //}
 
 
         // 统计系统状态  count_type = 4
+        //ArrayList<InterlockCountDay> xtStatusResultList = new ArrayList<>();
 
 
 
 
 
         // 批量保存
-        List<InterlockCount> list = Stream.concat(Stream.concat(loopHealthLevelResultList.stream(), Stream.concat(interlockStatusResultList.stream(),ybResultList.stream())), tylResultList.stream())
+        //List<InterlockCountDay> list = Stream.concat(Stream.concat(loopHealthLevelResultList.stream(), Stream.concat(Stream.concat(interlockStatusResultList.stream(),xtStatusResultList.stream()),ybResultList.stream())), tylResultList.stream())
+        //        .collect(Collectors.toList());
+
+        List<InterlockCountDay> list = Stream.concat(Stream.concat(loopHealthLevelResultList.stream(), interlockStatusResultList.stream()),tylResultList.stream())
                 .collect(Collectors.toList());
 
         countService.saveBatch(list);
@@ -285,6 +304,12 @@ public class DayStatisticsJob implements Job {
         log.info("日统计任务执行成功!");
     }
 
+    private InterlockBaseHy getBaseHyByQuery(String field, String systemId, String status) {
+        QueryWrapper<InterlockBaseHy> query = new QueryWrapper<>();
+        query.eq("interlock_system_id",systemId).eq(field,status);
+        return baseHyService.getOne(query);
+    }
+
     /**
     *   author: dzc
     *   version: 1.0