Parcourir la source

Merge branch 'V0.0.6-iot' of http://10.87.21.221:8000/jzyd_yyds/soc into V0.0.6-iot

wubiyu il y a 1 an
Parent
commit
f53fc543cb
19 fichiers modifiés avec 241 ajouts et 78 suppressions
  1. 45 22
      project_data/sql/0.0.6-iot/soc/soc.sql
  2. 1 1
      soc-common/soc-common-core/src/main/java/com/xunmei/common/core/domain/iot/domain/IotAlarmSubsystemLog.java
  3. 4 3
      soc-modules/soc-modules-core/src/main/java/com/xunmei/core/resumption/controller/ProtectionStatusController.java
  4. 17 0
      soc-modules/soc-modules-core/src/main/java/com/xunmei/core/resumption/dto/protection/SubSystemStateUpdateDto.java
  5. 2 1
      soc-modules/soc-modules-core/src/main/java/com/xunmei/core/resumption/service/IProtectionService.java
  6. 11 7
      soc-modules/soc-modules-core/src/main/java/com/xunmei/core/resumption/service/impl/ProtectionServiceImpl.java
  7. 17 9
      soc-modules/soc-modules-core/src/main/java/com/xunmei/core/resumption/vo/protection/ProtectionPageVo.java
  8. 1 0
      soc-modules/soc-modules-core/src/main/resources/mapper/device/ProtectionMapper.xml
  9. 7 2
      soc-modules/soc-modules-iot/src/main/java/com/xunmei/iot/controller/IotSensorController.java
  10. 12 0
      soc-modules/soc-modules-iot/src/main/java/com/xunmei/iot/dto/sensor/SensorPageDto.java
  11. 3 0
      soc-modules/soc-modules-iot/src/main/java/com/xunmei/iot/mapper/IotCommonSensorMapper.java
  12. 2 0
      soc-modules/soc-modules-iot/src/main/java/com/xunmei/iot/service/IIotCommonSensorService.java
  13. 6 0
      soc-modules/soc-modules-iot/src/main/java/com/xunmei/iot/service/VideoDiagnosisService.java
  14. 45 17
      soc-modules/soc-modules-iot/src/main/java/com/xunmei/iot/service/impl/IotCommonSensorServiceImpl.java
  15. 13 0
      soc-modules/soc-modules-iot/src/main/java/com/xunmei/iot/service/impl/VideoDiagnosisServiceImpl.java
  16. 3 0
      soc-modules/soc-modules-iot/src/main/java/com/xunmei/iot/vo/sensor/SensorPageVo.java
  17. 19 15
      soc-modules/soc-modules-iot/src/main/java/com/xunmei/iot/vo/videoDiagnosis/VideoDiagnosisIntegrityVo.java
  18. 32 1
      soc-modules/soc-modules-iot/src/main/resources/mapper/IotSensorMapper.xml
  19. 1 0
      soc-modules/soc-modules-system/src/main/java/com/xunmei/system/service/impl/SysDeviceServiceImpl.java

+ 45 - 22
project_data/sql/0.0.6-iot/soc/soc.sql

@@ -72,35 +72,55 @@ CREATE PROCEDURE schema_change () BEGIN
 --         ALTER TABLE sys_device
 --             ADD COLUMN `channel_code`  varchar(225) NULL COMMENT '通道号' AFTER `host_code`;
 --     END IF;
-
+	IF EXISTS(SELECT *
+                  FROM information_schema.columns
+                  WHERE table_schema = DATABASE()
+                    AND table_name = 'core_protection_log') THEN
+        rename TABLE `core_protection_log` to `iot_alarm_subsystem_log`;
+    END IF;	
+	
+	IF EXISTS(SELECT *
+                  FROM information_schema.columns
+                  WHERE table_schema = DATABASE()
+                    AND table_name = 'core_protection') THEN
+        rename TABLE `core_protection` to `iot_alarm_subsystem`;
+    END IF;	
+	
     IF NOT EXISTS(SELECT *
                   FROM information_schema.columns
                   WHERE table_schema = DATABASE()
-                    AND table_name = 'core_protection'
+                    AND table_name = 'iot_alarm_subsystem'
                     AND column_name = 'status_change_time') THEN
-        ALTER TABLE `core_protection` 
+        ALTER TABLE `iot_alarm_subsystem` 
 					ADD COLUMN `status_change_time` datetime NULL COMMENT '布撤防时间' AFTER `all_Hour`,
 					ADD COLUMN `source` int NULL COMMENT '设备来源:0:设备登记;1:iot推送' AFTER `update_by`,
-					MODIFY COLUMN `status_update_time` datetime NULL DEFAULT NULL COMMENT '布撤防更新时间' AFTER `all_Hour`
-					COMMENT = '报警控制器(子系统)表';
-		
+					MODIFY COLUMN `status_update_time` datetime NULL DEFAULT NULL COMMENT '布撤防更新时间' AFTER `all_Hour`,
+					COMMENT = '报警控制器(子系统)表';		
     END IF;
 	IF NOT EXISTS(SELECT *
                   FROM information_schema.columns
                   WHERE table_schema = DATABASE()
-                    AND table_name = 'core_protection_log'
+                    AND table_name = 'iot_alarm_subsystem_log'
                     AND column_name = 'status_change_time') THEN
-        ALTER TABLE `core_protection_log` 
-					ADD COLUMN `status_change_time` datetime NULL COMMENT '布撤防时间' AFTER `all_Hour`,
-					MODIFY COLUMN `status_update_time` datetime NULL DEFAULT NULL COMMENT '布撤防更新时间' AFTER `all_Hour`
-					COMMENT = '报警控制器(子系统)布撤防历史表';
-		
+        ALTER TABLE `iot_alarm_subsystem_log` 
+					ADD COLUMN `status_change_time` datetime NULL COMMENT '布撤防时间' AFTER `status_update_time`,
+					MODIFY COLUMN `status_update_time` datetime NULL DEFAULT NULL COMMENT '布撤防更新时间',
+					COMMENT = '报警控制器(子系统)布撤防历史表';		
     END IF;	
+	
+	
 END ??
 DELIMITER ;
 CALL schema_change ();
 
 
+ALTER TABLE `iot_alarm_subsystem_log` 
+MODIFY COLUMN `status` int NULL DEFAULT NULL COMMENT '布防状态,0:撤防,1:布防,2:未知(未登记过或离线)' AFTER `name`;
+ALTER TABLE `iot_alarm_subsystem` 
+MODIFY COLUMN `status` int NULL DEFAULT NULL COMMENT '布防状态,0:撤防,1:布防,2:未知(未登记过或离线)' AFTER `name`;
+update iot_alarm_subsystem set `status`=2 WHERE status is null;
+update iot_alarm_subsystem_log set `status`=2 WHERE status is null;
+
 
 drop table if exists mediator_video_days_check;
 CREATE TABLE `mediator_video_days_check` (
@@ -765,13 +785,16 @@ CREATE TABLE `mediator_network_device_detection_log` (
 
 DELETE FROM `sys_dict_type` WHERE `dict_type` in('video_integrity_state','video_days_state','video_diagnosis_state');
 DELETE FROM `sys_dict_data` WHERE `dict_type` in('video_integrity_state','video_days_state','video_diagnosis_state');
-INSERT INTO `sys_dict_type` (`dict_id`, `dict_name`, `dict_type`, `status`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES (20231113187, '录像完整性状态', 'video_integrity_state', '0', '超级管理员', '2024-02-22 18:00:41', '', NULL, NULL);
-INSERT INTO `sys_dict_type` (`dict_id`, `dict_name`, `dict_type`, `status`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES (20231113189, '录像存储天数状态', 'video_days_state', '0', '超级管理员', '2024-02-22 18:02:56', '', NULL, NULL);
-INSERT INTO `sys_dict_type` (`dict_id`, `dict_name`, `dict_type`, `status`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES (20231113191, '视频诊断结果', 'video_diagnosis_state', '0', '超级管理员', '2024-02-22 18:04:19', '', NULL, NULL);
-INSERT INTO `sys_dict_data` (`dict_code`, `dict_sort`, `dict_label`, `dict_value`, `dict_type`, `css_class`, `list_class`, `is_default`, `status`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES (20231115055, 0, '完整', '0', 'video_integrity_state', NULL, 'default', 'N', '0', '超级管理员', '2024-02-22 18:01:50', '', NULL, NULL);
-INSERT INTO `sys_dict_data` (`dict_code`, `dict_sort`, `dict_label`, `dict_value`, `dict_type`, `css_class`, `list_class`, `is_default`, `status`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES (20231115057, 1, '部分丢失', '1', 'video_integrity_state', NULL, 'default', 'N', '0', '超级管理员', '2024-02-22 18:02:01', '', NULL, NULL);
-INSERT INTO `sys_dict_data` (`dict_code`, `dict_sort`, `dict_label`, `dict_value`, `dict_type`, `css_class`, `list_class`, `is_default`, `status`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES (20231115059, 2, '部分丢失', '2', 'video_integrity_state', NULL, 'default', 'N', '0', '超级管理员', '2024-02-22 18:02:08', '', NULL, NULL);
-INSERT INTO `sys_dict_data` (`dict_code`, `dict_sort`, `dict_label`, `dict_value`, `dict_type`, `css_class`, `list_class`, `is_default`, `status`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES (20231115061, 0, '未报警', '0', 'video_days_state', NULL, 'default', 'N', '0', '超级管理员', '2024-02-22 18:03:41', '', NULL, NULL);
-INSERT INTO `sys_dict_data` (`dict_code`, `dict_sort`, `dict_label`, `dict_value`, `dict_type`, `css_class`, `list_class`, `is_default`, `status`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES (20231115063, 1, '报警', '1', 'video_days_state', NULL, 'default', 'N', '0', '超级管理员', '2024-02-22 18:03:48', '', NULL, NULL);
-INSERT INTO `sys_dict_data` (`dict_code`, `dict_sort`, `dict_label`, `dict_value`, `dict_type`, `css_class`, `list_class`, `is_default`, `status`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES (20231115065, 0, '正常', '0', 'video_diagnosis_state', NULL, 'default', 'N', '0', '超级管理员', '2024-02-22 18:04:49', '', NULL, NULL);
-INSERT INTO `sys_dict_data` (`dict_code`, `dict_sort`, `dict_label`, `dict_value`, `dict_type`, `css_class`, `list_class`, `is_default`, `status`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES (20231115067, 1, '异常', '1', 'video_diagnosis_state', NULL, 'default', 'N', '0', '超级管理员', '2024-02-22 18:04:57', '', NULL, NULL);
+INSERT INTO `sys_dict_type` ( `dict_name`, `dict_type`, `status`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES ( '录像完整性状态', 'video_integrity_state', '0', '超级管理员', '2024-02-22 18:00:41', '', NULL, NULL);
+INSERT INTO `sys_dict_type` (`dict_name`, `dict_type`, `status`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES ( '录像存储天数状态', 'video_days_state', '0', '超级管理员', '2024-02-22 18:02:56', '', NULL, NULL);
+INSERT INTO `sys_dict_type` ( `dict_name`, `dict_type`, `status`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES ('视频诊断结果', 'video_diagnosis_state', '0', '超级管理员', '2024-02-22 18:04:19', '', NULL, NULL);
+INSERT INTO `sys_dict_data` ( `dict_sort`, `dict_label`, `dict_value`, `dict_type`, `css_class`, `list_class`, `is_default`, `status`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES ( 0, '完整', '0', 'video_integrity_state', NULL, 'default', 'N', '0', '超级管理员', '2024-02-22 18:01:50', '', NULL, NULL);
+INSERT INTO `sys_dict_data` ( `dict_sort`, `dict_label`, `dict_value`, `dict_type`, `css_class`, `list_class`, `is_default`, `status`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES ( 1, '部分丢失', '1', 'video_integrity_state', NULL, 'default', 'N', '0', '超级管理员', '2024-02-22 18:02:01', '', NULL, NULL);
+INSERT INTO `sys_dict_data` ( `dict_sort`, `dict_label`, `dict_value`, `dict_type`, `css_class`, `list_class`, `is_default`, `status`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES ( 2, '部分丢失', '2', 'video_integrity_state', NULL, 'default', 'N', '0', '超级管理员', '2024-02-22 18:02:08', '', NULL, NULL);
+INSERT INTO `sys_dict_data` ( `dict_sort`, `dict_label`, `dict_value`, `dict_type`, `css_class`, `list_class`, `is_default`, `status`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES ( 0, '未报警', '0', 'video_days_state', NULL, 'default', 'N', '0', '超级管理员', '2024-02-22 18:03:41', '', NULL, NULL);
+INSERT INTO `sys_dict_data` ( `dict_sort`, `dict_label`, `dict_value`, `dict_type`, `css_class`, `list_class`, `is_default`, `status`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES ( 1, '报警', '1', 'video_days_state', NULL, 'default', 'N', '0', '超级管理员', '2024-02-22 18:03:48', '', NULL, NULL);
+INSERT INTO `sys_dict_data` (`dict_sort`, `dict_label`, `dict_value`, `dict_type`, `css_class`, `list_class`, `is_default`, `status`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES ( 0, '正常', '0', 'video_diagnosis_state', NULL, 'default', 'N', '0', '超级管理员', '2024-02-22 18:04:49', '', NULL, NULL);
+INSERT INTO `sys_dict_data` (`dict_sort`, `dict_label`, `dict_value`, `dict_type`, `css_class`, `list_class`, `is_default`, `status`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES ( 1, '异常', '1', 'video_diagnosis_state', NULL, 'default', 'N', '0', '超级管理员', '2024-02-22 18:04:57', '', NULL, NULL);
+
+
+update sys_menu set component ='iot/subSystem/index',parent_id=1747911340288892930 WHERE menu_name='布撤防情况跟踪' and platform_type=1;

+ 1 - 1
soc-common/soc-common-core/src/main/java/com/xunmei/common/core/domain/iot/domain/IotAlarmSubsystemLog.java

@@ -48,7 +48,7 @@ public class IotAlarmSubsystemLog implements Serializable {
 
     @ApiModelProperty(value = "布防状态,0:撤防,1:布防")
     @TableField("status")
-    private String status;
+    private Integer status;
 
     @ApiModelProperty(value = "布撤防时间")
     @TableField("status_change_time")

+ 4 - 3
soc-modules/soc-modules-core/src/main/java/com/xunmei/core/resumption/controller/ProtectionStatusController.java

@@ -7,6 +7,7 @@ import com.xunmei.common.security.annotation.RequiresPermissions;
 import com.xunmei.common.core.domain.iot.domain.IotAlarmSubsystem;
 import com.xunmei.core.resumption.dto.protection.ProtectionLogPageDto;
 import com.xunmei.core.resumption.dto.protection.ProtectionPageDto;
+import com.xunmei.core.resumption.dto.protection.SubSystemStateUpdateDto;
 import com.xunmei.core.resumption.service.IProtectionService;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
@@ -52,9 +53,9 @@ class ProtectionStatusController extends BaseController {
     }
 
     @ApiOperation(value = "布撤防")
-    @PostMapping("updatestatus/{protectionId}/{status}")
+    @PostMapping("updatestatus")
     @RequiresPermissions({"device:protectionstatus:maintain",})
-    public AjaxResult updateStatus(@PathVariable Long protectionId,@PathVariable String status) {
-        return success(protectionService.updateStatus(protectionId,status));
+    public AjaxResult updateStatus(@RequestBody SubSystemStateUpdateDto updateDto) {
+        return success(protectionService.updateStatus(updateDto));
     }
 }

+ 17 - 0
soc-modules/soc-modules-core/src/main/java/com/xunmei/core/resumption/dto/protection/SubSystemStateUpdateDto.java

@@ -0,0 +1,17 @@
+package com.xunmei.core.resumption.dto.protection;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import lombok.Data;
+
+import java.time.LocalDateTime;
+import java.util.Date;
+
+@Data
+public class SubSystemStateUpdateDto {
+    private Long id;
+
+    private Integer state;
+
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    private LocalDateTime changeTime;
+}

+ 2 - 1
soc-modules/soc-modules-core/src/main/java/com/xunmei/core/resumption/service/IProtectionService.java

@@ -8,6 +8,7 @@ import com.xunmei.common.core.domain.iot.domain.IotAlarmSubsystem;
 import com.xunmei.core.resumption.dto.protection.ProtectionEditDto;
 import com.xunmei.core.resumption.dto.protection.ProtectionLogPageDto;
 import com.xunmei.core.resumption.dto.protection.ProtectionPageDto;
+import com.xunmei.core.resumption.dto.protection.SubSystemStateUpdateDto;
 import com.xunmei.system.api.vo.ProtectionVO;
 
 import javax.servlet.http.HttpServletResponse;
@@ -41,7 +42,7 @@ public interface IProtectionService extends IService<IotAlarmSubsystem> {
 
     TableDataInfo history(ProtectionLogPageDto request);
 
-    LocalDateTime updateStatus(Long protectionId, String status);
+    LocalDateTime updateStatus(SubSystemStateUpdateDto updateDto);
 
     List<IotAlarmSubsystem> findNotAllHour(Long orgId);
 

+ 11 - 7
soc-modules/soc-modules-core/src/main/java/com/xunmei/core/resumption/service/impl/ProtectionServiceImpl.java

@@ -22,6 +22,7 @@ import com.xunmei.common.core.domain.iot.domain.IotAlarmSubsystemLog;
 import com.xunmei.core.resumption.dto.protection.ProtectionEditDto;
 import com.xunmei.core.resumption.dto.protection.ProtectionLogPageDto;
 import com.xunmei.core.resumption.dto.protection.ProtectionPageDto;
+import com.xunmei.core.resumption.dto.protection.SubSystemStateUpdateDto;
 import com.xunmei.core.resumption.mapper.ProtectionLogMapper;
 import com.xunmei.core.resumption.mapper.ProtectionMapper;
 import com.xunmei.core.resumption.service.IProtectionService;
@@ -29,6 +30,7 @@ import com.xunmei.core.resumption.vo.protection.ProtectionLogPageVo;
 import com.xunmei.core.resumption.vo.protection.ProtectionPageVo;
 import com.xunmei.system.api.RemoteDictDataService;
 import com.xunmei.system.api.domain.SysDictData;
+import com.xunmei.system.api.enums.ProtectionStatus;
 import com.xunmei.system.api.vo.ProtectionVO;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
@@ -112,7 +114,7 @@ public class ProtectionServiceImpl extends ServiceImpl<ProtectionMapper, IotAlar
             updateById(protection);
         } else {
             BeanUtil.copyProperties(dto, protection);
-            protection.setStatus(2);
+            protection.setStatus(ProtectionStatus.UNKNOWN.ordinal());
             save(protection);
         }
 
@@ -170,22 +172,24 @@ public class ProtectionServiceImpl extends ServiceImpl<ProtectionMapper, IotAlar
 
     @Override
     @Transactional
-    public LocalDateTime updateStatus(Long protectionId, String status) {
+    public LocalDateTime updateStatus(SubSystemStateUpdateDto updateDto) {
         LocalDateTime now = LocalDateTime.now();
         int count = baseMapper.update(null, new LambdaUpdateWrapper<IotAlarmSubsystem>()
-                .eq(IotAlarmSubsystem::getId, protectionId)
-                .set(IotAlarmSubsystem::getStatus, status)
+                .eq(IotAlarmSubsystem::getId, updateDto.getId())
+                .set(IotAlarmSubsystem::getStatus, updateDto.getState())
+                        .set(IotAlarmSubsystem::getStatusChangeTime,updateDto.getChangeTime())
                 .set(IotAlarmSubsystem::getStatusUpdateTime, now)
                 .set(IotAlarmSubsystem::getStatusUpdatorId, SecurityUtils.getUserId())
                 .set(IotAlarmSubsystem::getStatusUpdatorName, SecurityUtils.getLoginUser().getName()));
         if (count > 0) {
-            IotAlarmSubsystem p = getById(protectionId);
+            IotAlarmSubsystem p = getById(updateDto.getId());
             IotAlarmSubsystemLog log = new IotAlarmSubsystemLog();
             BeanUtil.copyProperties(p, log);
             log.setId(null);
-            log.setProtectionId(protectionId);
-            log.setStatus(status);
+            log.setProtectionId(updateDto.getId());
+            log.setStatus(updateDto.getState());
             log.setStatusUpdateTime(now);
+            log.setStatusChangeTime(updateDto.getChangeTime());
             log.setStatusUpdatorId(SecurityUtils.getLoginUser().getUserid());
             log.setStatusUpdatorName(SecurityUtils.getLoginUser().getName());
             protectionLogMapper.insert(log);

+ 17 - 9
soc-modules/soc-modules-core/src/main/java/com/xunmei/core/resumption/vo/protection/ProtectionPageVo.java

@@ -18,7 +18,7 @@ import java.util.Date;
 @AllArgsConstructor
 @NoArgsConstructor
 public class ProtectionPageVo {
-    @ExcelProperty(value = "序号",index = 0)
+    @ExcelProperty(value = "序号", index = 0)
     @ColumnWidth(10)
     @JsonIgnore
     private int index;
@@ -33,22 +33,22 @@ public class ProtectionPageVo {
     private String orgId;
 
     @ApiModelProperty("地区")
-    @ExcelProperty(value="地区",index = 1)
+    @ExcelProperty(value = "地区", index = 1)
     @ColumnWidth(20)
     private String affiliatedArea;
 
     @ApiModelProperty("行社名称")
-    @ExcelProperty(value="行社名称",index = 2)
+    @ExcelProperty(value = "行社名称", index = 2)
     @ColumnWidth(20)
     private String affiliatedBank;
 
     @ApiModelProperty("机构名称")
-    @ExcelProperty(value = "所属机构",index = 3)
+    @ExcelProperty(value = "所属机构", index = 3)
     @ColumnWidth(20)
     private String orgName;
 
     @ApiModelProperty("防区的名称")
-    @ExcelProperty(value = "报警控制器名称",index = 4)
+    @ExcelProperty(value = "报警控制器名称", index = 4)
     @ColumnWidth(20)
     private String name;
 
@@ -57,7 +57,7 @@ public class ProtectionPageVo {
     private String status;
 
     @ApiModelProperty("防区状态")
-    @ExcelProperty(value = "报警控制器状态",index = 5)
+    @ExcelProperty(value = "报警控制器状态", index = 5)
     @ColumnWidth(20)
     private String statusText;
 
@@ -72,7 +72,7 @@ public class ProtectionPageVo {
     /**
      * 登记人姓名
      */
-    @ExcelProperty(value = "登记人",index = 6)
+    @ExcelProperty(value = "登记人/数据来源", index = 6)
     @ColumnWidth(15)
     private String statusUpdatorName;
 
@@ -80,9 +80,17 @@ public class ProtectionPageVo {
      * 布撤防时间
      */
     @JsonFormat(pattern = "yyyy-MM-dd HH:mm")
-    @ExcelProperty(value = "最近登记时间",index = 7)
+    @ExcelProperty(value = "最近登记时间", index = 7)
     @ColumnWidth(20)
-    private  Date statusUpdateTime;
+    private Date statusUpdateTime;
+
+    /**
+     * 布撤防时间
+     */
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm")
+    @ExcelProperty(value = "布撤防时间", index = 8)
+    @ColumnWidth(20)
+    private Date statusChangeTime;
 }
 
 

+ 1 - 0
soc-modules/soc-modules-core/src/main/resources/mapper/device/ProtectionMapper.xml

@@ -22,6 +22,7 @@
         a.all_hour as allHour,
         a.status_update_time as statusUpdateTime,
         a.status_updator_name as statusUpdatorName,
+        a.status_change_time as statusChangeTime,
         c.affiliated_area ,
         c.affiliated_bank
         from iot_alarm_subsystem a

+ 7 - 2
soc-modules/soc-modules-iot/src/main/java/com/xunmei/iot/controller/IotSensorController.java

@@ -26,11 +26,16 @@ public class IotSensorController {
     IIotCommonSensorService sensorService;
 
 
-    @ApiOperation("分页")
+    @ApiOperation("动环设备分页")
     @PostMapping({"/find"})
     TableDataInfo<SensorPageVo> webPage(@RequestBody final SensorPageDto request) {
         TableDataInfo<SensorPageVo> page = this.sensorService.selectSensorDataPage(request);
         return page;
     }
-
+    @ApiOperation("动环设备上报历史数据分页")
+    @PostMapping({"/find/log"})
+    TableDataInfo<SensorPageVo> webLogPage(@RequestBody final SensorPageDto request) {
+        TableDataInfo<SensorPageVo> page = this.sensorService.selectSensorLogDataPage(request);
+        return page;
+    }
 }

+ 12 - 0
soc-modules/soc-modules-iot/src/main/java/com/xunmei/iot/dto/sensor/SensorPageDto.java

@@ -3,6 +3,8 @@ package com.xunmei.iot.dto.sensor;
 import com.xunmei.common.core.web.domain.PageRequest;
 import lombok.Data;
 
+import java.util.Date;
+
 /**
  * @author jingyuanchao
  * @date 2024/2/26 14:32
@@ -11,4 +13,14 @@ import lombok.Data;
 public class SensorPageDto extends PageRequest {
 
     private String deviceName;
+
+    private String deviceCode;
+
+    private Date[] dateRange;
+
+    private Date startTime;
+
+    private Date endTime;
+
+
 }

+ 3 - 0
soc-modules/soc-modules-iot/src/main/java/com/xunmei/iot/mapper/IotCommonSensorMapper.java

@@ -19,4 +19,7 @@ import org.apache.ibatis.annotations.Param;
 public interface IotCommonSensorMapper extends BaseMapper<IotSensor> {
 
     Page<SensorPageVo> selectPageData(Page<SensorPageVo> pageRequest, @Param("request") SensorPageDto request);
+
+    Page<SensorPageVo> selectSensorLogDataPage(Page<SensorPageVo> pageRequest, @Param("request") SensorPageDto request);
+
 }

+ 2 - 0
soc-modules/soc-modules-iot/src/main/java/com/xunmei/iot/service/IIotCommonSensorService.java

@@ -18,4 +18,6 @@ public interface IIotCommonSensorService extends IService<IotSensor> {
 
     TableDataInfo<SensorPageVo> selectSensorDataPage(SensorPageDto request);
 
+    TableDataInfo<SensorPageVo> selectSensorLogDataPage(SensorPageDto request);
+
 }

+ 6 - 0
soc-modules/soc-modules-iot/src/main/java/com/xunmei/iot/service/VideoDiagnosisService.java

@@ -4,9 +4,13 @@ import com.baomidou.mybatisplus.extension.service.IService;
 import com.xunmei.common.core.domain.iot.domain.IotDvrChannel;
 import com.xunmei.common.core.web.page.TableDataInfo;
 import com.xunmei.iot.dto.videoDiagnosis.VideoDiagnosisWebPageDto;
+import com.xunmei.iot.vo.videoDiagnosis.VideoDiagnosisIntegrityVo;
 import com.xunmei.iot.vo.videoDiagnosis.VideoDiagnosisWebPageVo;
 import com.xunmei.iot.vo.videoDiagnosis.VideoDiagnosisWebVo;
 import org.apache.http.annotation.Obsolete;
+import org.springframework.web.bind.annotation.PathVariable;
+
+import java.util.Date;
 
 /**
  * <p>
@@ -23,4 +27,6 @@ public interface VideoDiagnosisService extends IService<IotDvrChannel> {
 
     VideoDiagnosisWebVo getDetail(String equipmentCode,String channelCode);
 
+  VideoDiagnosisIntegrityVo getIntegrity(String hostCode, String channelCode , Date date);
+
 }

+ 45 - 17
soc-modules/soc-modules-iot/src/main/java/com/xunmei/iot/service/impl/IotCommonSensorServiceImpl.java

@@ -1,5 +1,6 @@
 package com.xunmei.iot.service.impl;
 
+import cn.hutool.core.date.DateUtil;
 import cn.hutool.core.util.ObjectUtil;
 import com.alibaba.fastjson2.JSON;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
@@ -22,7 +23,7 @@ import java.util.Map;
 
 /**
  * <p>
- *  服务实现类
+ * 服务实现类
  * </p>
  *
  * @author test
@@ -39,28 +40,55 @@ public class IotCommonSensorServiceImpl extends ServiceImpl<IotCommonSensorMappe
 
     @Override
     public TableDataInfo<SensorPageVo> selectSensorDataPage(SensorPageDto request) {
-        final SysOrg sysOrg = orgService.selectOrgById(request.getOrgId(), SecurityConstants.INNER);
+        dealPageParam(request);
 
-        if (ObjectUtil.equal(Boolean.TRUE,request.getCheckSub())){
-            request.setOrgPath(sysOrg.getPath());
-            request.setOrgId(null);
+        Page<SensorPageVo> page = sensorMapper.selectPageData(request.getPageRequest(), request);
+        for (SensorPageVo record : page.getRecords()) {
+            final String info = record.getInfo();
+            record.setInfo(dealInfoData(info));
         }
+        return TableDataInfo.build(page);
+    }
+
+    private String dealInfoData(String info) {
+        final List<Map> list = JSON.parseArray(info, Map.class);
+        List<String> dataList = new ArrayList<>();
+        for (Map map : list) {
+            final String name = (String) map.get("name");
+            final String res = (String) map.get("res");
+            if (ObjectUtil.hasEmpty(name, res)) {
+                continue;
+            }
+            dataList.add(name + ":" + res);
+        }
+        return String.join(";", dataList);
+    }
 
-        Page<SensorPageVo> page=  sensorMapper.selectPageData(request.getPageRequest(),request);
+    @Override
+    public TableDataInfo<SensorPageVo> selectSensorLogDataPage(SensorPageDto request) {
+        dealPageParam(request);
+        if (ObjectUtil.isEmpty(request.getDeviceCode())) {
+            throw new RuntimeException("设备编码不能为空!");
+        }
+        Page<SensorPageVo> page = sensorMapper.selectSensorLogDataPage(request.getPageRequest(), request);
         for (SensorPageVo record : page.getRecords()) {
             final String info = record.getInfo();
-            final List<Map> list = JSON.parseArray(info, Map.class);
-            List<String> dataList = new ArrayList<>();
-            for (Map map : list) {
-                final String name = (String) map.get("name");
-                final String res = (String) map.get("res");
-                if (ObjectUtil.hasEmpty(name,res)){
-                    continue;
-                }
-                dataList.add(name+":"+res);
-            }
-            record.setInfo(String.join(";",dataList));
+            record.setInfo(dealInfoData(info));
         }
         return TableDataInfo.build(page);
     }
+
+
+    private void dealPageParam(SensorPageDto request) {
+        final SysOrg sysOrg = orgService.selectOrgById(request.getOrgId(), SecurityConstants.INNER);
+        if (ObjectUtil.equal(Boolean.TRUE, request.getCheckSub())) {
+            request.setOrgPath(sysOrg.getPath());
+            request.setOrgId(null);
+        }
+        if (ObjectUtil.isNotEmpty(request.getDateRange())) {
+            //web的查询
+            request.setStartTime(DateUtil.beginOfDay(request.getDateRange()[0]));
+            request.setEndTime(DateUtil.endOfDay(request.getDateRange()[1]));
+        }
+    }
 }

+ 13 - 0
soc-modules/soc-modules-iot/src/main/java/com/xunmei/iot/service/impl/VideoDiagnosisServiceImpl.java

@@ -13,6 +13,7 @@ import com.xunmei.iot.dto.videoDiagnosis.VideoDiagnosisWebPageDto;
 import com.xunmei.iot.mapper.IotDvrChannelMapper;
 import com.xunmei.iot.mapper.VideoIntegrityCheckMapper;
 import com.xunmei.iot.service.VideoDiagnosisService;
+import com.xunmei.iot.vo.videoDiagnosis.VideoDiagnosisIntegrityVo;
 import com.xunmei.iot.vo.videoDiagnosis.VideoDiagnosisWebPageVo;
 import com.xunmei.iot.vo.videoDiagnosis.VideoDiagnosisWebVo;
 import com.xunmei.system.api.RemoteOrgService;
@@ -23,6 +24,7 @@ import org.springframework.stereotype.Service;
 import javax.validation.constraints.AssertFalse;
 import java.time.format.DateTimeFormatter;
 import java.util.ArrayList;
+import java.util.Date;
 import java.util.List;
 import java.util.Map;
 import java.util.stream.Collectors;
@@ -96,4 +98,15 @@ public class VideoDiagnosisServiceImpl extends ServiceImpl<IotDvrChannelMapper,
 
         return vo;
     }
+
+    @Override
+    public VideoDiagnosisIntegrityVo getIntegrity(String hostCode, String channelCode, Date date) {
+        LambdaQueryWrapper<MediatorVideoIntegrityCheck> wrapper = new LambdaQueryWrapper<>();
+        wrapper.eq(MediatorVideoIntegrityCheck::getEquipmentCode, hostCode)
+                .eq(MediatorVideoIntegrityCheck::getChannelCode, channelCode)
+                .eq(MediatorVideoIntegrityCheck::getRecordDate, date);
+
+        MediatorVideoIntegrityCheck entity = videoIntegrityCheckMapper.selectOne(wrapper);
+        return VideoDiagnosisIntegrityVo.of(entity);
+    }
 }

+ 3 - 0
soc-modules/soc-modules-iot/src/main/java/com/xunmei/iot/vo/sensor/SensorPageVo.java

@@ -34,6 +34,9 @@ public class SensorPageVo {
     @ApiModelProperty("设备类型")
     private String categoryType;
 
+    @ApiModelProperty("设备code")
+    private String deviceCode;
+
     @ApiModelProperty("上报内容")
     private String info;
 

+ 19 - 15
soc-modules/soc-modules-iot/src/main/java/com/xunmei/iot/vo/videoDiagnosis/VideoDiagnosisIntegrityVo.java

@@ -1,5 +1,6 @@
 package com.xunmei.iot.vo.videoDiagnosis;
 
+import java.time.ZoneId;
 import java.util.ArrayList;
 import java.util.Date;
 import java.util.List;
@@ -7,6 +8,8 @@ import java.util.List;
 import cn.hutool.core.util.ObjectUtil;
 import com.alibaba.fastjson.JSON;
 import com.fasterxml.jackson.annotation.JsonIgnore;
+import com.xunmei.common.core.domain.video.MediatorVideoIntegrityCheck;
+import com.xunmei.common.core.utils.bean.BeanUtils;
 import lombok.Data;
 
 /**
@@ -29,9 +32,9 @@ public class VideoDiagnosisIntegrityVo {
 
     private List<TimeRangeVo> losts;
 
-    public List<TimeRangeVo> getLosts(){
-        if(ObjectUtil.isEmpty(loseSpan)){
-            return  new ArrayList<>();
+    public List<TimeRangeVo> getLosts() {
+        if (ObjectUtil.isEmpty(loseSpan)) {
+            return new ArrayList<>();
         }
         return JSON.parseArray(loseSpan, TimeRangeVo.class);
     }
@@ -40,21 +43,22 @@ public class VideoDiagnosisIntegrityVo {
     private String checkSpan;
 
     private List<TimeRangeVo> checks;
-    public List<TimeRangeVo> getChecks(){
-        if(ObjectUtil.isEmpty(checkSpan)){
-            return  new ArrayList<>();
+
+    public List<TimeRangeVo> getChecks() {
+        if (ObjectUtil.isEmpty(checkSpan)) {
+            return new ArrayList<>();
         }
         return JSON.parseArray(checkSpan, TimeRangeVo.class);
     }
-//    public void setLosts(String info) {
-//        this.losts = JSON.parseArray(info, TimeRange.class);
-//    }
 
-//    @Data
-//    public class TimeRange {
-//        private String st;
-//
-//        private String et;
-//    }
+    public static VideoDiagnosisIntegrityVo of(MediatorVideoIntegrityCheck entity) {
+        if (ObjectUtil.isNull(entity)) {
+            return null;
+        }
 
+        VideoDiagnosisIntegrityVo vo = new VideoDiagnosisIntegrityVo();
+        BeanUtils.copyProperties(entity, vo);
+        vo.setRecordDate(Date.from(entity.getRecordDate().atStartOfDay().atZone(ZoneId.systemDefault()).toInstant()));
+        return vo;
+    }
 }

+ 32 - 1
soc-modules/soc-modules-iot/src/main/resources/mapper/IotSensorMapper.xml

@@ -3,7 +3,7 @@
 <mapper namespace="com.xunmei.iot.mapper.IotCommonSensorMapper">
 
     <select id="selectPageData" resultType="com.xunmei.iot.vo.sensor.SensorPageVo">
-        select s.id, org_id, org_name, device_name, category_id, infos as info, update_time from iot_sensor s
+        select s.id, org_id, org_name, device_name, category_id, infos as info,device_code, update_time from iot_sensor s
         <where>
             <if test="request.orgId!= null">
                 and s.org_id=#{request.orgId}
@@ -14,6 +14,37 @@
             <if test="request.deviceName != null and request.deviceName!= ''">
                 and s.device_name like CONCAT('%',#{request.deviceName},'%')
             </if>
+            <if test="request.startTime!= null">
+                and s.state_update_time >=#{request.startTime}
+            </if>
+            <if test="request.endTime!= null">
+                and s.state_update_time <![CDATA[<=]]>  #{request.endTime}
+            </if>
+        </where>
+    </select>
+
+    <select id="selectSensorLogDataPage" resultType="com.xunmei.iot.vo.sensor.SensorPageVo">
+        select s.id, org_id, org_name, device_name, category_id, infos as info,device_code, update_time from iot_sensor_log s
+        <where>
+            <if test="request.orgId!= null">
+                and s.org_id=#{request.orgId}
+            </if>
+            <if test="request.orgPath!= null">
+                and s.org_path like CONCAT(#{request.orgPath}, '%')
+            </if>
+            <if test="request.deviceName != null and request.deviceName!= ''">
+                and s.device_name like CONCAT('%',#{request.deviceName},'%')
+            </if>
+            <if test="request.deviceCode != null and request.deviceCode!= ''">
+                and s.device_code =#{request.deviceCode}
+            </if>
+            <if test="request.startTime!= null">
+                and s.state_update_time >=#{request.startTime}
+            </if>
+            <if test="request.endTime!= null">
+                and s.state_update_time <![CDATA[<=]]>  #{request.endTime}
+            </if>
         </where>
+        order by s.state_update_time desc
     </select>
 </mapper>

+ 1 - 0
soc-modules/soc-modules-system/src/main/java/com/xunmei/system/service/impl/SysDeviceServiceImpl.java

@@ -247,6 +247,7 @@ public class SysDeviceServiceImpl extends ServiceImpl<SysDeviceMapper, SysDevice
             protectionDTO.setDeviceId(sysDevice.getId());
             protectionDTO.setOrgId(sysOrg.getId());
             protectionDTO.setOrgName(sysOrg.getShortName());
+
             remoteProtectionService.addByDevice(protectionDTO, SecurityConstants.INNER);
         }
         return insert;