Browse Source

Merge branch 'V0.0.9' of http://10.87.21.221:8000/jzyd_yyds/soc into V0.0.9

zhulu 1 year ago
parent
commit
d661e70dd7
38 changed files with 731 additions and 228 deletions
  1. 5 0
      project_data/sql/0.0.9/soc/soc.sql
  2. 4 4
      soc-api/soc-api-system/src/main/java/com/xunmei/system/api/RemoteIotService.java
  3. 11 1
      soc-api/soc-api-system/src/main/java/com/xunmei/system/api/factory/RemoteIotFallbackFactory.java
  4. 11 0
      soc-common/soc-common-core/src/main/java/com/xunmei/common/core/constant/SystemParameterConstant.java
  5. 7 11
      soc-modules/soc-modules-core/src/main/java/com/xunmei/core/resumption/controller/ResumptionController.java
  6. 10 12
      soc-modules/soc-modules-core/src/main/java/com/xunmei/core/resumption/gx/service/ResumptionServiceImpl.java
  7. 1 1
      soc-modules/soc-modules-core/src/main/java/com/xunmei/core/resumption/gx/vo/ResumptionPlanVo.java
  8. 7 0
      soc-modules/soc-modules-core/src/main/java/com/xunmei/core/resumption/gx/vo/ResumptionPointVo.java
  9. 8 8
      soc-modules/soc-modules-core/src/main/java/com/xunmei/core/resumption/service/impl/AppPlanServiceImpl.java
  10. 29 31
      soc-modules/soc-modules-core/src/main/java/com/xunmei/core/resumption/service/impl/ProtectionServiceImpl.java
  11. 2 0
      soc-modules/soc-modules-core/src/main/java/com/xunmei/core/resumption/vo/protection/ProtectionPageVo.java
  12. 2 1
      soc-modules/soc-modules-core/src/main/resources/mapper/device/ProtectionMapper.xml
  13. 43 48
      soc-modules/soc-modules-file/src/main/java/com/xunmei/file/utils/PdfUtil.java
  14. 29 0
      soc-modules/soc-modules-iot/src/main/java/com/xunmei/iot/controller/IotAlarmDataAppController.java
  15. 6 6
      soc-modules/soc-modules-iot/src/main/java/com/xunmei/iot/controller/IotController.java
  16. 2 0
      soc-modules/soc-modules-iot/src/main/java/com/xunmei/iot/dto/alarmData/AppAlarmPageDto.java
  17. 5 0
      soc-modules/soc-modules-iot/src/main/java/com/xunmei/iot/mapper/IotAlarmDataMapper.java
  18. 9 0
      soc-modules/soc-modules-iot/src/main/java/com/xunmei/iot/service/IotAlarmDataService.java
  19. 2 2
      soc-modules/soc-modules-iot/src/main/java/com/xunmei/iot/service/IotService.java
  20. 95 0
      soc-modules/soc-modules-iot/src/main/java/com/xunmei/iot/service/impl/IotAlarmDataServiceImpl.java
  21. 55 9
      soc-modules/soc-modules-iot/src/main/java/com/xunmei/iot/service/impl/IotBoardServiceImpl.java
  22. 18 10
      soc-modules/soc-modules-iot/src/main/java/com/xunmei/iot/service/impl/IotServiceImpl.java
  23. 13 0
      soc-modules/soc-modules-iot/src/main/java/com/xunmei/iot/vo/alarmData/DeviceTypeCountVo.java
  24. 43 0
      soc-modules/soc-modules-iot/src/main/java/com/xunmei/iot/vo/alarmData/SensorAlarmCountVo.java
  25. 55 0
      soc-modules/soc-modules-iot/src/main/resources/mapper/IotAlarmDataMapper.xml
  26. 1 0
      soc-modules/soc-modules-iot/src/main/resources/mapper/IotSensorMapper.xml
  27. 1 1
      soc-modules/soc-modules-system/src/main/java/com/xunmei/system/controller/SysConfigController.java
  28. 18 0
      soc-modules/soc-modules-system/src/main/java/com/xunmei/system/controller/SysDeptController.java
  29. 3 0
      soc-modules/soc-modules-system/src/main/java/com/xunmei/system/mapper/SysOrgMapper.java
  30. 3 1
      soc-modules/soc-modules-system/src/main/java/com/xunmei/system/service/ISysOrgService.java
  31. 59 5
      soc-modules/soc-modules-system/src/main/java/com/xunmei/system/service/impl/SysOrgServiceImpl.java
  32. 32 28
      soc-modules/soc-modules-system/src/main/java/com/xunmei/system/util/OrgExtendExport.java
  33. 14 16
      soc-modules/soc-modules-system/src/main/java/com/xunmei/system/util/OrgExtendJKZXExport.java
  34. 6 5
      soc-modules/soc-modules-system/src/main/java/com/xunmei/system/util/OrgExtendLHSZZExport.java
  35. 12 15
      soc-modules/soc-modules-system/src/main/java/com/xunmei/system/util/OrgExtendYYWDExport.java
  36. 1 1
      soc-modules/soc-modules-system/src/main/java/com/xunmei/system/util/OrgExtendZXYWKExport.java
  37. 60 0
      soc-modules/soc-modules-system/src/main/java/com/xunmei/system/util/OrgPhysicalDefenseConstructionDetailExport.java
  38. 49 12
      soc-modules/soc-modules-system/src/main/resources/mapper/system/SysOrgMapper.xml

+ 5 - 0
project_data/sql/0.0.9/soc/soc.sql

@@ -55,6 +55,11 @@ INSERT INTO sys_dict_data (dict_sort, dict_label, dict_value, dict_type, css_cla
 delete from sys_dict_type where dict_type='point_data_source';
 INSERT INTO sys_dict_type (dict_name, dict_type, status, create_by, create_time, update_by, update_time, remark) VALUES ('检查要点数据来源', 'point_data_source', '0', null, null, 'null', null, null);
 
+-- 新增挂墙终端告警次数和频率 系统参数
+delete from sys_config where config_key in('ALARM_DATA_TERMINAL_NOTICE_TIMES','ALARM_DATA_TERMINAL_NOTICE_FREQUENCY');
+INSERT INTO sys_config (config_name, config_key, config_value, config_type, create_by, create_time, update_by, update_time, remark) VALUES ('挂墙终端单次告警提醒次数', 'ALARM_DATA_TERMINAL_NOTICE_TIMES', '1', 'Y', null, now(), null, now(), '次数');
+INSERT INTO sys_config (config_name, config_key, config_value, config_type, create_by, create_time, update_by, update_time, remark) VALUES ('挂墙终端单次告警提醒间隔', 'ALARM_DATA_TERMINAL_NOTICE_FREQUENCY', '5', 'Y', null, now(), null, now(), '单位:分钟');
+
 
 
 

+ 4 - 4
soc-api/soc-api-system/src/main/java/com/xunmei/system/api/RemoteIotService.java

@@ -11,10 +11,10 @@ import org.springframework.web.bind.annotation.PathVariable;
 public interface RemoteIotService {
 
 
-    @GetMapping("/days/{orgId}/{date}")
-    int selectVideoDayExceptionChannelNums(@PathVariable(value = "orgId") Long orgId, @PathVariable(value = "date") String date);
+    @GetMapping("/days/{orgId}")
+    Integer selectVideoDayExceptionChannelNums(@PathVariable(value = "orgId") Long orgId);
 
 
-    @GetMapping("/diagnosis/{orgId}/{date}")
-    int selectVideoDiagnosisExceptionChannelNums(@PathVariable(value = "orgId") Long orgId, @PathVariable(value = "date") String date);
+    @GetMapping("/diagnosis/{orgId}")
+    Integer selectVideoDiagnosisExceptionChannelNums(@PathVariable(value = "orgId") Long orgId);
 }

+ 11 - 1
soc-api/soc-api-system/src/main/java/com/xunmei/system/api/factory/RemoteIotFallbackFactory.java

@@ -20,6 +20,16 @@ public class RemoteIotFallbackFactory implements FallbackFactory<RemoteIotServic
     public RemoteIotService create(Throwable cause) {
 
 
-        return null;
+        return new RemoteIotService() {
+            @Override
+            public Integer selectVideoDayExceptionChannelNums(Long orgId) {
+                return null;
+            }
+
+            @Override
+            public Integer selectVideoDiagnosisExceptionChannelNums(Long orgId) {
+                return null;
+            }
+        };
     }
 }

+ 11 - 0
soc-common/soc-common-core/src/main/java/com/xunmei/common/core/constant/SystemParameterConstant.java

@@ -168,4 +168,15 @@ public class SystemParameterConstant {
 
     public static final String BLURRY_ALARM = "BLURRY_ALARM";
 
+    /**
+     * 挂墙终端单次告警提醒次数
+     */
+
+    public static final String ALARM_DATA_TERMINAL_NOTICE_TIMES = "ALARM_DATA_TERMINAL_NOTICE_TIMES";
+
+    /**
+     * 挂墙终端单次告警提醒间隔: 单位分钟
+     */
+    public static final String ALARM_DATA_TERMINAL_NOTICE_FREQUENCY = "ALARM_DATA_TERMINAL_NOTICE_FREQUENCY";
+
 }

+ 7 - 11
soc-modules/soc-modules-core/src/main/java/com/xunmei/core/resumption/controller/ResumptionController.java

@@ -1,13 +1,7 @@
 package com.xunmei.core.resumption.controller;
 
 import cn.hutool.core.date.DateUtil;
-import cn.hutool.core.util.NumberUtil;
-import cn.hutool.core.util.ObjectUtil;
-import com.alibaba.fastjson2.JSON;
-import com.alibaba.nacos.common.utils.CollectionUtils;
 import com.alibaba.nacos.shaded.com.google.gson.Gson;
-import com.xunmei.common.core.constant.SecurityConstants;
-import com.xunmei.common.core.constant.SystemParameterConstant;
 import com.xunmei.common.core.event.WorkTimeChangeEvent;
 import com.xunmei.common.core.web.domain.AjaxResult;
 import com.xunmei.common.redis.utils.RedisUtils;
@@ -15,14 +9,16 @@ import com.xunmei.common.security.annotation.InnerAuth;
 import com.xunmei.common.security.utils.SecurityUtils;
 import com.xunmei.core.listener.WorkTimeChangeEventListener;
 import com.xunmei.core.resumption.domain.Resumption;
-import com.xunmei.core.resumption.dto.resumptionRegister.ResumptionTaskDataDto;
 import com.xunmei.core.resumption.dto.TaskDetailsDto;
+import com.xunmei.core.resumption.dto.resumptionRegister.ResumptionTaskDataDto;
 import com.xunmei.core.resumption.service.ResumptionBusiness;
 import com.xunmei.core.resumption.service.ResumptionService;
-import com.xunmei.core.resumption.vo.*;
+import com.xunmei.core.resumption.vo.ResumptionAppRetVo;
+import com.xunmei.core.resumption.vo.ResumptionAppVo;
+import com.xunmei.core.resumption.vo.ResumptionTaskListVo;
+import com.xunmei.core.resumption.vo.ResumptionTaskNewDto;
 import com.xunmei.core.resumption.vo.resumptionRegister.*;
 import com.xunmei.system.api.RemoteConfigService;
-import com.xunmei.system.api.domain.SysConfig;
 import io.swagger.annotations.ApiOperation;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -35,10 +31,10 @@ import javax.validation.Valid;
 import java.text.ParseException;
 import java.text.SimpleDateFormat;
 import java.time.Duration;
+import java.util.ArrayList;
 import java.util.Date;
+import java.util.HashMap;
 import java.util.List;
-import java.util.Map;
-import java.util.*;
 
 @RestController
 @RequestMapping("/api/resumption")

+ 10 - 12
soc-modules/soc-modules-core/src/main/java/com/xunmei/core/resumption/gx/service/ResumptionServiceImpl.java

@@ -33,7 +33,6 @@ import org.springframework.transaction.annotation.Transactional;
 import org.springframework.transaction.support.TransactionSynchronization;
 import org.springframework.transaction.support.TransactionSynchronizationManager;
 
-import java.time.LocalDate;
 import java.util.*;
 import java.util.stream.Collectors;
 
@@ -129,7 +128,7 @@ public class ResumptionServiceImpl implements ResumptionService {
         if (sysResumption.getStatus() == 4) {
             throw new RuntimeException("该任务已过期不能完成提交");
         }
-        if (ObjectUtil.equal(1, taskDetailVo.getSubType()) && ObjectUtil.notEqual(ResumptionStatus.NO_START.getCode(), sysResumption.getStatus())&&ObjectUtil.notEqual(ResumptionStatus.PROGRESS.getCode(), sysResumption.getStatus())) {
+        if (ObjectUtil.equal(1, taskDetailVo.getSubType()) && ObjectUtil.notEqual(ResumptionStatus.NO_START.getCode(), sysResumption.getStatus()) && ObjectUtil.notEqual(ResumptionStatus.PROGRESS.getCode(), sysResumption.getStatus())) {
             throw new RuntimeException("当前状态不允许修改,请退出当前页面后刷新重试!");
         }
         /*if (ObjectUtil.equal(2, taskDetailVo.getSubType()) && ObjectUtil.equal(ResumptionStatus.NO_START.getCode(), sysResumption.getStatus()) && ObjectUtil.notEqual(ResumptionStatus.PROGRESS.getCode(), sysResumption.getStatus())) {
@@ -411,7 +410,7 @@ public class ResumptionServiceImpl implements ResumptionService {
         //区域数据
         Map<Long, AreaResumptionVo> map = new HashMap<>();
 
-        dealData(resumptionPlanVos, imgMap, itemMap, itComMap, map, taskVo, isExist,resumption.getOrgId());
+        dealData(resumptionPlanVos, imgMap, itemMap, itComMap, map, taskVo, isExist, resumption.getOrgId());
 
 
         int yesNFC = 0;
@@ -560,7 +559,8 @@ public class ResumptionServiceImpl implements ResumptionService {
             pointVo.setDataStatus(vo.getDataStatus());
 
             //处理设置了数据来源的检查要点
-            dealPointDataSource(vo,orgId);
+            pointVo.setPointDataSource(vo.getPointDataSource());
+            dealPointDataSource(pointVo, orgId);
 
             resumptionItemVo.getPoints().add(pointVo);
 
@@ -606,21 +606,19 @@ public class ResumptionServiceImpl implements ResumptionService {
         return imgMap;
     }
 
-    private void dealPointDataSource(ResumptionPlanVo vo,Long orgId){
+    private void dealPointDataSource(ResumptionPointVo vo, Long orgId) {
         Integer pointDataSource = vo.getPointDataSource();
-        if (ObjectUtil.isNull(pointDataSource)){
+        if (ObjectUtil.isNull(pointDataSource)) {
             return;
         }
 
-        if (RulePointDataSource.VIDEO_DAYS.getCode().equals(pointDataSource)){
-            String yesterDay = LocalDate.now().plusDays(-1).toString();
-           int nums = remoteIotService.selectVideoDayExceptionChannelNums(orgId,yesterDay);
+        if (RulePointDataSource.VIDEO_DAYS.getCode().equals(pointDataSource)) {
+            Integer nums = remoteIotService.selectVideoDayExceptionChannelNums(orgId);
             vo.setExceptionChannelNum(nums);
         }
 
-        if (RulePointDataSource.VIDEO_DIAGNOSIS.getCode().equals(pointDataSource)){
-            String today = LocalDate.now().toString();
-            int nums = remoteIotService.selectVideoDiagnosisExceptionChannelNums(orgId,today);
+        if (RulePointDataSource.VIDEO_DIAGNOSIS.getCode().equals(pointDataSource)) {
+            Integer nums = remoteIotService.selectVideoDiagnosisExceptionChannelNums(orgId);
             vo.setExceptionChannelNum(nums);
         }
 

+ 1 - 1
soc-modules/soc-modules-core/src/main/java/com/xunmei/core/resumption/gx/vo/ResumptionPlanVo.java

@@ -49,7 +49,7 @@ public class ResumptionPlanVo {
     @JsonSerialize(using = ToStringSerializer.class)
     private Long pointId;
 
-    @ApiModelProperty(value = "数据来源",notes = "0:防区,1:录像天数,2:视频质量")
+    @ApiModelProperty(value = "数据来源",notes = "1:防区,2:录像天数,3:视频质量")
     private Integer pointDataSource;
 
     @ApiModelProperty(value = "异常通道数")

+ 7 - 0
soc-modules/soc-modules-core/src/main/java/com/xunmei/core/resumption/gx/vo/ResumptionPointVo.java

@@ -3,6 +3,7 @@ package com.xunmei.core.resumption.gx.vo;
 import com.fasterxml.jackson.databind.annotation.JsonSerialize;
 import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
 import com.xunmei.core.resumption.domain.AppResumptionDataRemarkimg;
+import io.swagger.annotations.ApiModelProperty;
 import lombok.AllArgsConstructor;
 import lombok.Data;
 import lombok.NoArgsConstructor;
@@ -28,6 +29,12 @@ public class ResumptionPointVo {
      * 检查内容
      */
     private String pointName;
+
+    @ApiModelProperty(value = "数据来源",notes = "1:防区,2:录像天数,3:视频质量")
+    private Integer pointDataSource;
+
+    @ApiModelProperty(value = "异常通道数")
+    private Integer exceptionChannelNum;
     /**
      * 检查结果 正常 异常
      */

+ 8 - 8
soc-modules/soc-modules-core/src/main/java/com/xunmei/core/resumption/service/impl/AppPlanServiceImpl.java

@@ -974,7 +974,7 @@ public class AppPlanServiceImpl extends ServiceImpl<AppPlanMapper, AppPlan> impl
 
         if (ObjectUtil.isNotEmpty(vo.getOrgList())) {
             List<IdNameVo> idNameVos = remoteOrgService.selectOrgByIdList(vo.getOrgList(), SecurityConstants.INNER)
-                    .stream().map(o -> new IdNameVo(o.getId(), o.getName(), null))
+                    .stream().map(o -> new IdNameVo(o.getId(), o.getShortName(), null))
                     .collect(Collectors.toList());
             detailVo.setOrgs(idNameVos);
         }
@@ -1473,14 +1473,14 @@ public class AppPlanServiceImpl extends ServiceImpl<AppPlanMapper, AppPlan> impl
                 if (!(submitName.toString().contains(vo.getSubmitName()))) {
                     submitName.append(vo.getSubmitName());
                 }
+                ResumptionPdf tem = new ResumptionPdf();
+                tem.setPointName(pointName);
+                tem.setSubmitName(String.valueOf(submitName));
+                //null:未执行  0:正常 1:异常
+                tem.setResValue(result);
+                befs.add(tem);
             }
-            ResumptionPdf tem = new ResumptionPdf();
-            tem.setPointName(pointName);
-            tem.setSubmitName(String.valueOf(submitName));
-            //null:未执行  0:正常 1:异常
-            tem.setResValue(result);
-//            tem.setResValue(result > 0 ? 1 : 0);
-            befs.add(tem);
+
         }
         return befs;
     }

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

@@ -12,7 +12,6 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
-import com.xunmei.common.core.constant.Constants;
 import com.xunmei.common.core.constant.SecurityConstants;
 import com.xunmei.common.core.domain.iot.domain.IotAlarmSubsystem;
 import com.xunmei.common.core.domain.iot.domain.IotAlarmSubsystemLog;
@@ -129,7 +128,6 @@ public class ProtectionServiceImpl extends ServiceImpl<ProtectionMapper, IotAlar
             throw new RuntimeException("防区名称重复");
         }
         IotAlarmSubsystem protection = new IotAlarmSubsystem();
-        Long id=dto.getId();
         if (dto.getId() != null) {
             protection = getById(dto.getId());
             BeanUtil.copyProperties(dto, protection);
@@ -138,12 +136,11 @@ public class ProtectionServiceImpl extends ServiceImpl<ProtectionMapper, IotAlar
             BeanUtil.copyProperties(dto, protection);
             protection.setStatus(ProtectionStatus.UNKNOWN.ordinal());
             save(protection);
-            id=protection.getId();
         }
-        //一个机构下仅允许存在一个子系统关联登记簿
+        /*//一个机构下仅允许存在一个子系统关联登记簿
         if (ObjectUtil.equal(dto.getInBook(),1)){
             baseMapper.updateInBookStatus(dto.getOrgId(),id);
-        }
+        }*/
 
         return protection.getId();
 
@@ -264,15 +261,12 @@ public class ProtectionServiceImpl extends ServiceImpl<ProtectionMapper, IotAlar
 
     @Override
     public List<Map<String, List<Map<String, Object>>>> selectDataByOrgId(Long orgId, Date date) {
+
+
         // 一个防区对应 布撤防历史(我知道这这个结构写的很烂,但是时间有限,先这样吧)
         List<Map<String, List<Map<String, Object>>>> resultList = new ArrayList<>();
 
-        List<IotAlarmSubsystem> list = lambdaQuery()
-                .eq(IotAlarmSubsystem::getOrgId, orgId)
-                .eq(IotAlarmSubsystem::getDeleted, 0)
-                .eq(IotAlarmSubsystem::getInBook, 1)
-                .last(Constants.LIMIT1)//一个机构只会有一个子系统关联登记簿
-                .list();
+        List<IotAlarmSubsystem> list = getIotAlarmSubsystems(orgId);
         if (ObjectUtil.isEmpty(list)) {
             return resultList;
         }
@@ -282,14 +276,11 @@ public class ProtectionServiceImpl extends ServiceImpl<ProtectionMapper, IotAlar
             resultList.add(map);
         }
         List<Long> protectionIdList = list.stream().map(IotAlarmSubsystem::getId).collect(Collectors.toList());
-        LambdaQueryWrapper<IotAlarmSubsystemLog> wrapper = new LambdaQueryWrapper<IotAlarmSubsystemLog>();
-        wrapper.eq(IotAlarmSubsystemLog::getOrgId, orgId)
-                .in(IotAlarmSubsystemLog::getProtectionId, protectionIdList)
-                .between(IotAlarmSubsystemLog::getStatusChangeTime, DateUtil.beginOfDay(date), DateUtil.endOfDay(date));
-        List<IotAlarmSubsystemLog> logList = protectionLogMapper.selectList(wrapper);
+        List<IotAlarmSubsystemLog> logList = getIotAlarmSubsystemLogs(orgId, date, protectionIdList);
         if (ObjectUtil.isEmpty(logList)) {
             return resultList;
         }
+        //布防状态,0:撤防,1:布防
         for (Map<String, List<Map<String, Object>>> subsystemListMap : resultList) {
             for (Map.Entry<String, List<Map<String, Object>>> listEntry : subsystemListMap.entrySet()) {
                 IotAlarmSubsystem subsystem = JSON.parseObject(listEntry.getKey(), IotAlarmSubsystem.class);
@@ -297,21 +288,11 @@ public class ProtectionServiceImpl extends ServiceImpl<ProtectionMapper, IotAlar
                 if (subsystemLogList.isEmpty()) {
                     continue;
                 }
-                //布防状态,0:撤防,1:布防
-                Optional<IotAlarmSubsystemLog> optional = subsystemLogList.stream().filter(r -> ObjectUtil.equal(r.getStatus(), 1)).max(Comparator.comparing(IotAlarmSubsystemLog::getStatusChangeTime));
-                if (optional.isPresent()){
-                    IotAlarmSubsystemLog log = optional.get();
-                    Map<String, Object> map = new HashMap<>();
-                    map.put("status", log.getStatus());
-                    map.put("date", DateUtil.format(log.getStatusChangeTime(), "HH:mm"));
-                    listEntry.getValue().add(map);
-                }
-                optional = subsystemLogList.stream().filter(r -> ObjectUtil.equal(r.getStatus(), 0)).min(Comparator.comparing(IotAlarmSubsystemLog::getStatusChangeTime));
-                if (optional.isPresent()){
-                    IotAlarmSubsystemLog log = optional.get();
-                    Map<String, Object> map = new HashMap<>();
-                    map.put("status", log.getStatus());
-                    map.put("date", DateUtil.format(log.getStatusChangeTime(), "HH:mm"));
+                for (IotAlarmSubsystemLog subsystemLog : subsystemLogList) {
+                    Map<String, Object> map = new LinkedHashMap<>();
+                    map.put("id", subsystemLog.getId());
+                    map.put("status", subsystemLog.getStatus());
+                    map.put("date", DateUtil.format(subsystemLog.getStatusChangeTime(), "HH:mm"));
                     listEntry.getValue().add(map);
                 }
             }
@@ -320,5 +301,22 @@ public class ProtectionServiceImpl extends ServiceImpl<ProtectionMapper, IotAlar
 
         return resultList;
     }
+
+    private List<IotAlarmSubsystem> getIotAlarmSubsystems(Long orgId) {
+        return lambdaQuery()
+                .eq(IotAlarmSubsystem::getOrgId, orgId)
+                .eq(IotAlarmSubsystem::getDeleted, 0)
+                .eq(IotAlarmSubsystem::getInBook, 1)
+                .list();
+    }
+
+    private List<IotAlarmSubsystemLog> getIotAlarmSubsystemLogs(Long orgId, Date date, List<Long> protectionIdList) {
+        LambdaQueryWrapper<IotAlarmSubsystemLog> wrapper = new LambdaQueryWrapper<IotAlarmSubsystemLog>();
+        wrapper.eq(IotAlarmSubsystemLog::getOrgId, orgId)
+                .in(IotAlarmSubsystemLog::getProtectionId, protectionIdList)
+                .between(IotAlarmSubsystemLog::getStatusChangeTime, DateUtil.beginOfDay(date), DateUtil.endOfDay(date))
+                .orderByAsc(IotAlarmSubsystemLog::getStatusChangeTime);
+        return protectionLogMapper.selectList(wrapper);
+    }
 }
 

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

@@ -91,6 +91,8 @@ public class ProtectionPageVo {
     @ExcelProperty(value = "布撤防时间", index = 8)
     @ColumnWidth(20)
     private Date statusChangeTime;
+
+    private Integer inBook;
 }
 
 

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

@@ -23,7 +23,8 @@
         a.status_updator_name as statusUpdatorName,
         a.status_change_time as statusChangeTime,
         c.affiliated_area ,
-        c.affiliated_bank
+        c.affiliated_bank,
+        a.in_book
         from iot_alarm_subsystem a
         inner join sys_org c on a.org_id = c.id and c.deleted=0
         <if test="request.checkSub==true">

+ 43 - 48
soc-modules/soc-modules-file/src/main/java/com/xunmei/file/utils/PdfUtil.java

@@ -191,6 +191,18 @@ public class PdfUtil {
         }
     }
 
+    private static String getStatusTime(List<Map<String, Object>> data, Integer status, List<Long> ingoreIdList) {
+        Optional<Map<String, Object>> optional = data.stream()
+                .filter(r -> r.get("status").equals(status) && !ingoreIdList.contains(Long.valueOf(r.get("id").toString())))
+                .findFirst();
+        if (optional.isPresent()) {
+            Map<String, Object> map = optional.get();
+            ingoreIdList.add(Long.valueOf(map.get("id").toString()));
+            return map.get("date").toString();
+        }
+        return StringUtil.EMPTY_STRING;
+    }
+
 
     public static void dealResumptionBody(Document document, PdfPTable table, Font tableFont, Map<String, Object> data) throws Exception {
         // 第一行
@@ -205,26 +217,12 @@ public class PdfUtil {
         PdfUtil.createPDFCell(tableFont, table, "检查时间", Element.ALIGN_MIDDLE, 2, 0);
         PdfUtil.createPDFCell(tableFont, table, "检查内容", Element.ALIGN_MIDDLE, 6, 0);
         PdfUtil.createPDFCell(tableFont, table, "检查情况", Element.ALIGN_MIDDLE, 2, 0);
-
-
-//        PdfUtil.createPDFCell(tableFont, table, "检查时间", Element.ALIGN_CENTER, 1, 0);
-//        PdfUtil.createPDFCell(tableFont, table, "检查内容", Element.ALIGN_CENTER, 5, 0);
-//        PdfUtil.createPDFCell(tableFont, table, "检查情况", Element.ALIGN_CENTER, 0, 0);
-//        PdfUtil.createPDFCell(tableFont, table, "登记人", Element.ALIGN_CENTER, 0, 0);
-
-        /*List<String> names = new ArrayList<>();
-        names.add(DictUtils.getDictLabel(DictConstants.RESUMPTION_PLAN_EXEC, 2));
-        names.add(DictUtils.getDictLabel(DictConstants.RESUMPTION_PLAN_EXEC, 3));
-        names.add(DictUtils.getDictLabel(DictConstants.RESUMPTION_PLAN_EXEC, 4));*/
         final List<SysDictData> dictCache = DictUtils.getDictCache(DictConstants.RESUMPTION_PLAN_EXEC);
         final List<String> names = dictCache.stream().map(SysDictData::getDictLabel).collect(Collectors.toList());
         for (String s : names) {
             List<LinkedHashMap<String, Object>> lists = (List<LinkedHashMap<String, Object>>) data.get(s);
             if (ObjectUtil.isEmpty(lists)) {
                 //不同的执行时刻
-               /* PdfUtil.createPDFCell(tableFont, table, s, PdfPCell.ALIGN_MIDDLE, 2,1);
-                PdfUtil.createPDFCell(tableFont, table,"/", PdfPCell.ALIGN_MIDDLE, 6, 1);
-                PdfUtil.createPDFCell(tableFont, table, "/", PdfPCell.ALIGN_MIDDLE, 2,1);*/
                 continue;
             }
             //不同的执行时刻
@@ -243,57 +241,43 @@ public class PdfUtil {
         }
 
         // ------------------------------------------------------------------------------------------------------------
-/*
-        PdfUtil.createPDFCell(tableFont, table, "布撤防情况", Element.ALIGN_MIDDLE, 10, 1);
-
-        PdfUtil.createPDFCell(tableFont, table, "控制器名称", Element.ALIGN_MIDDLE, 2, 1);
-        PdfUtil.createPDFCell(tableFont, table, "详情", Element.ALIGN_MIDDLE, 8, 1);*/
-
 
         List<Map<String, List<Map<String, Object>>>> protectionList = (List<Map<String, List<Map<String, Object>>>>) data.get("protection");
         if (ObjectUtil.isNotEmpty(protectionList)) {
-            for (int i = 0; i < protectionList.size(); i++) {
-                Map<String, List<Map<String, Object>>> listMap = protectionList.get(i);
+            for (Map<String, List<Map<String, Object>>> listMap : protectionList) {
                 for (Map.Entry<String, List<Map<String, Object>>> listEntry : listMap.entrySet()) {
-                    IotAlarmSubsystem subsystem = JSON.parseObject(listEntry.getKey(),IotAlarmSubsystem.class);
+                    IotAlarmSubsystem subsystem = JSON.parseObject(listEntry.getKey(), IotAlarmSubsystem.class);
                     List<Map<String, Object>> value = listEntry.getValue();
                     //布防状态,0:撤防,1:布防
                     if (value.isEmpty()) {
                         //子系统名称
                         PdfUtil.createPDFCell(tableFont, table, subsystem.getName(), Element.ALIGN_MIDDLE, 2, 1);
-                        PdfUtil.createPDFCell(tableFont, table,"撤防时间" , Element.ALIGN_MIDDLE, 2, 1);
+                        PdfUtil.createPDFCell(tableFont, table, "撤防时间", Element.ALIGN_MIDDLE, 2, 1);
                         PdfUtil.createPDFCell(tableFont, table, StringUtil.EMPTY_STRING, Element.ALIGN_MIDDLE, 2, 1);
-                        PdfUtil.createPDFCell(tableFont, table,"布防时间" , Element.ALIGN_MIDDLE, 2, 1);
+                        PdfUtil.createPDFCell(tableFont, table, "布防时间", Element.ALIGN_MIDDLE, 2, 1);
                         PdfUtil.createPDFCell(tableFont, table, StringUtil.EMPTY_STRING, Element.ALIGN_MIDDLE, 2, 1);
                     } else {
-                        // 子系统名称
-                        PdfUtil.createPDFCell(tableFont, table, subsystem.getName(), Element.ALIGN_MIDDLE, 2, 1);
-                        Optional<Map<String, Object>> statusOptional1 = value.stream().filter(r -> {
-                            Integer status = (Integer) r.get("status");
-                            return ObjectUtil.equal(0,status);
-                        }).findFirst();
-                        String cfStatus = statusOptional1.isPresent() ? String.valueOf(statusOptional1.get().get("date")) : StringUtil.EMPTY_STRING;
-                        // 撤防时间
-                        PdfUtil.createPDFCell(tableFont, table, "撤防时间", Element.ALIGN_MIDDLE, 2, 1);
-                        PdfUtil.createPDFCell(tableFont, table, cfStatus, Element.ALIGN_MIDDLE, 2, 1);
-
-                        Optional<Map<String, Object>> statusOptional = value.stream().filter(r -> {
-                            Integer status = (Integer) r.get("status");
-                            return ObjectUtil.equal(1,status);
-                        }).findFirst();
-                        String bfStatus = statusOptional.isPresent() ? String.valueOf(statusOptional.get().get("date")) : StringUtil.EMPTY_STRING;
-                        // 布防时间
-                        PdfUtil.createPDFCell(tableFont, table, "布防时间", Element.ALIGN_MIDDLE, 2, 1);
-                        PdfUtil.createPDFCell(tableFont, table, bfStatus, Element.ALIGN_MIDDLE, 3, 1);
+                        long num = getNum(value);//可能出现布防两次,撤防一次的情况,避免登记簿异常,取最大值
+                        List<Long> ingoreIdList = new ArrayList<>();
+                        for (long i = 0; i < num; i++) {
+                            // 子系统名称
+                            PdfUtil.createPDFCell(tableFont, table, subsystem.getName(), Element.ALIGN_MIDDLE, 2, 1);
+                            // 撤防时间
+                            PdfUtil.createPDFCell(tableFont, table, "撤防时间", Element.ALIGN_MIDDLE, 2, 1);
+                            PdfUtil.createPDFCell(tableFont, table, getStatusTime(value, 0, ingoreIdList), Element.ALIGN_MIDDLE, 2, 1);
+                            // 布防时间
+                            PdfUtil.createPDFCell(tableFont, table, "布防时间", Element.ALIGN_MIDDLE, 2, 1);
+                            PdfUtil.createPDFCell(tableFont, table, getStatusTime(value, 1, ingoreIdList), Element.ALIGN_MIDDLE, 3, 1);
+                        }
                     }
                 }
             }
-        }else   {
+        } else {
             //子系统名称
-            PdfUtil.createPDFCell(tableFont, table,StringUtil.EMPTY_STRING, Element.ALIGN_MIDDLE, 2, 1);
-            PdfUtil.createPDFCell(tableFont, table,"撤防时间" , Element.ALIGN_MIDDLE, 2, 1);
             PdfUtil.createPDFCell(tableFont, table, StringUtil.EMPTY_STRING, Element.ALIGN_MIDDLE, 2, 1);
-            PdfUtil.createPDFCell(tableFont, table,"布防时间" , Element.ALIGN_MIDDLE, 2, 1);
+            PdfUtil.createPDFCell(tableFont, table, "撤防时间", Element.ALIGN_MIDDLE, 2, 1);
+            PdfUtil.createPDFCell(tableFont, table, StringUtil.EMPTY_STRING, Element.ALIGN_MIDDLE, 2, 1);
+            PdfUtil.createPDFCell(tableFont, table, "布防时间", Element.ALIGN_MIDDLE, 2, 1);
             PdfUtil.createPDFCell(tableFont, table, StringUtil.EMPTY_STRING, Element.ALIGN_MIDDLE, 2, 1);
         }
 
@@ -337,6 +321,17 @@ public class PdfUtil {
 
     }
 
+    private static long getNum(List<Map<String, Object>> value) {
+        long num;
+        List<Integer> statusList = value.stream().map(m -> (Integer) m.get("status")).collect(Collectors.toList());
+        num = statusList.stream().filter(r -> ObjectUtil.equal(0, r)).count();
+        long bfNums = statusList.stream().filter(r -> ObjectUtil.equal(1, r)).count();
+        if (bfNums > num) {
+            num = bfNums;
+        }
+        return num;
+    }
+
     public static String getLineStr(String str) {
         StringBuilder result = new StringBuilder();
         for (int i = 0; i < str.length(); i++) {

+ 29 - 0
soc-modules/soc-modules-iot/src/main/java/com/xunmei/iot/controller/IotAlarmDataAppController.java

@@ -8,6 +8,7 @@ import com.xunmei.iot.dto.alarmData.dealAlarmDto;
 import com.xunmei.iot.service.IotAlarmDataService;
 import com.xunmei.iot.vo.alarm.IotAlarmDataVo;
 import com.xunmei.iot.vo.alarmData.AppAlarmDataPageVo;
+import com.xunmei.iot.vo.alarmData.SensorAlarmCountVo;
 import io.swagger.annotations.ApiOperation;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
@@ -45,4 +46,32 @@ public class IotAlarmDataAppController {
         Integer count = this.iotAlarmDataService.appBadge(orgId);
         return AjaxResult.success(count);
     }
+
+    @ApiOperation(value = "查询消防预警设备数量和告警数量")
+    @PostMapping("/deviceTypeCount")
+    public AjaxResult deviceTypeCount(@RequestBody AppAlarmPageDto requestDto) {
+        SensorAlarmCountVo sensorAlarmCountVo = this.iotAlarmDataService.selectDeviceTypeCount(requestDto);
+        return AjaxResult.success(sensorAlarmCountVo);
+    }
+
+    @ApiOperation("消防预警角标")
+    @GetMapping({"/getFireWarningBadge/{orgId}"})
+    AjaxResult getFireWarningBadge(@PathVariable("orgId") Long orgId) {
+        Integer count = this.iotAlarmDataService.getFireWarningBadge(orgId);
+        return AjaxResult.success(count);
+    }
+
+    @ApiOperation("获取当前传感器报警记录分页数据")
+    @PostMapping({"/selectSensorAlarmPageList"})
+    TableDataInfo<IotAlarmDataVo> selectSensorAlarmPageList(@RequestBody AppAlarmPageDto requestDto) {
+        TableDataInfo<IotAlarmDataVo> sensorAlarmList = this.iotAlarmDataService.selectSensorAlarmPageList(requestDto);
+        return sensorAlarmList;
+    }
+
+    @ApiOperation("环境监测角标")
+    @GetMapping({"/getEnvMonitorBadge/{orgId}"})
+    AjaxResult getEnvMonitorBadge(@PathVariable("orgId") Long orgId) {
+        Integer count = this.iotAlarmDataService.getEnvMonitorBadge(orgId);
+        return AjaxResult.success(count);
+    }
 }

+ 6 - 6
soc-modules/soc-modules-iot/src/main/java/com/xunmei/iot/controller/IotController.java

@@ -18,13 +18,13 @@ public class IotController {
     @Autowired
     private IotService iotService;
 
-    @GetMapping("/days/{orgId}/{date}")
-    public int selectVideoDayExceptionChannelNums(@PathVariable Long orgId, @PathVariable String date) {
-        return iotService.selectVideoDayExceptionChannelNums(orgId,date);
+    @GetMapping("/days/{orgId}")
+    public Integer selectVideoDayExceptionChannelNums(@PathVariable Long orgId) {
+        return iotService.selectVideoDayExceptionChannelNums(orgId);
     }
 
-    @GetMapping("/diagnosis/{orgId}/{date}")
-    public int selectVideoDiagnosisExceptionChannelNums(@PathVariable Long orgId, @PathVariable String date) {
-        return iotService.selectVideoDiagnosisExceptionChannelNums(orgId,date);
+    @GetMapping("/diagnosis/{orgId}")
+    public Integer selectVideoDiagnosisExceptionChannelNums(@PathVariable Long orgId) {
+        return iotService.selectVideoDiagnosisExceptionChannelNums(orgId);
     }
 }

+ 2 - 0
soc-modules/soc-modules-iot/src/main/java/com/xunmei/iot/dto/alarmData/AppAlarmPageDto.java

@@ -31,6 +31,8 @@ public class AppAlarmPageDto extends PageDto {
 
     private Integer isDo;
 
+    private Long sensorId;
+
     public Map<String, Object> getParams() {
         if (params == null) {
             params = new HashMap<>();

+ 5 - 0
soc-modules/soc-modules-iot/src/main/java/com/xunmei/iot/mapper/IotAlarmDataMapper.java

@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.xunmei.common.core.domain.mediator.domain.IotAlarmData;
 import com.xunmei.iot.dto.alarmData.AppAlarmPageDto;
+import com.xunmei.iot.vo.alarmData.DeviceTypeCountVo;
 import com.xunmei.iot.vo.alarm.IotAlarmDataVo;
 import com.xunmei.iot.vo.alarmData.AppAlarmDataPageVo;
 import org.apache.ibatis.annotations.Mapper;
@@ -22,4 +23,8 @@ public interface IotAlarmDataMapper extends BaseMapper<IotAlarmData> {
     Integer appBadge(Long orgId);
 
     List<IotAlarmData> selectAlarmDataListByOrgPath(@Param("orgPath") String orgPath, @Param("dataType") Integer dataType);
+
+    List<DeviceTypeCountVo> selectDeviceTypeCount(@Param("query")AppAlarmPageDto requestDto);
+
+    Page<IotAlarmDataVo> selectSensorAlarmPageList(@Param("page") Page<IotAlarmDataVo> page, @Param("param")AppAlarmPageDto requestDto);
 }

+ 9 - 0
soc-modules/soc-modules-iot/src/main/java/com/xunmei/iot/service/IotAlarmDataService.java

@@ -7,6 +7,7 @@ import com.xunmei.iot.dto.alarmData.AppAlarmPageDto;
 import com.xunmei.iot.dto.alarmData.dealAlarmDto;
 import com.xunmei.iot.vo.alarm.IotAlarmDataVo;
 import com.xunmei.iot.vo.alarmData.AppAlarmDataPageVo;
+import com.xunmei.iot.vo.alarmData.SensorAlarmCountVo;
 
 import java.util.List;
 
@@ -28,4 +29,12 @@ public interface IotAlarmDataService extends IService<IotAlarmData> {
     Integer appBadge(Long orgId);
 
     List<IotAlarmData> selectAlarmDataListByOrgPath(String orgPath,Integer dataType);
+
+    SensorAlarmCountVo selectDeviceTypeCount(AppAlarmPageDto requestDto);
+
+    Integer getFireWarningBadge(Long orgId);
+
+    Integer getEnvMonitorBadge(Long orgId);
+
+    TableDataInfo<IotAlarmDataVo> selectSensorAlarmPageList(AppAlarmPageDto requestDto);
 }

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

@@ -1,7 +1,7 @@
 package com.xunmei.iot.service;
 
 public interface IotService {
-    int selectVideoDayExceptionChannelNums(Long orgId,String date);
+    Integer selectVideoDayExceptionChannelNums(Long orgId);
 
-    int selectVideoDiagnosisExceptionChannelNums(Long orgId, String date);
+    Integer selectVideoDiagnosisExceptionChannelNums(Long orgId);
 }

+ 95 - 0
soc-modules/soc-modules-iot/src/main/java/com/xunmei/iot/service/impl/IotAlarmDataServiceImpl.java

@@ -13,6 +13,8 @@ import com.xunmei.iot.mapper.IotAlarmDataMapper;
 import com.xunmei.iot.service.IotAlarmDataService;
 import com.xunmei.iot.vo.alarm.IotAlarmDataVo;
 import com.xunmei.iot.vo.alarmData.AppAlarmDataPageVo;
+import com.xunmei.iot.vo.alarmData.DeviceTypeCountVo;
+import com.xunmei.iot.vo.alarmData.SensorAlarmCountVo;
 import com.xunmei.system.api.RemoteOrgService;
 import com.xunmei.system.api.domain.SysOrg;
 import org.springframework.stereotype.Service;
@@ -127,4 +129,97 @@ public class IotAlarmDataServiceImpl extends ServiceImpl<IotAlarmDataMapper, Iot
 
         return baseMapper.selectAlarmDataListByOrgPath(orgPath,dataType);
     }
+
+    @Override
+    public SensorAlarmCountVo selectDeviceTypeCount(AppAlarmPageDto requestDto) {
+        SensorAlarmCountVo sensorAlarmCountVo = new SensorAlarmCountVo();
+        if(requestDto.getCheckSub() && ObjectUtil.isNotEmpty(requestDto.getOrgId())){
+            SysOrg org = orgService.selectSysOrgById(requestDto.getOrgId(), SecurityConstants.INNER);
+            requestDto.setOrgPath(org.getPath());
+        }
+        List<DeviceTypeCountVo> list = baseMapper.selectDeviceTypeCount(requestDto);
+        for (DeviceTypeCountVo vo : list) {
+            String deviceType = vo.getDeviceType();
+            switch (deviceType){
+                case "4181"://红外
+                    sensorAlarmCountVo.setInfraredCount(vo.getDeviceTypeCount());
+                    sensorAlarmCountVo.setInfraredAlarmCount(vo.getDeviceTypeAlarmCount());
+                    break;
+                case "4182"://烟感
+                    sensorAlarmCountVo.setSmokeCount(vo.getDeviceTypeCount());
+                    sensorAlarmCountVo.setSmokeAlarmCount(vo.getDeviceTypeAlarmCount());
+                    break;
+                case "4183"://温湿度
+                    sensorAlarmCountVo.setTemperatureAndHumidityCount(vo.getDeviceTypeCount());
+                    sensorAlarmCountVo.setTemperatureAndHumidityAlarmCount(vo.getDeviceTypeAlarmCount());
+                    break;
+                case "4184"://水浸
+                    sensorAlarmCountVo.setWaterCount(vo.getDeviceTypeCount());
+                    sensorAlarmCountVo.setWaterAlarmCount(vo.getDeviceTypeAlarmCount());
+                    break;
+                case "4188"://门磁
+                    sensorAlarmCountVo.setDoorCount(vo.getDeviceTypeCount());
+                    sensorAlarmCountVo.setDoorAlarmCount(vo.getDeviceTypeAlarmCount());
+                    break;
+                case "41881"://防盗
+                    sensorAlarmCountVo.setThiefCount(vo.getDeviceTypeCount());
+                    sensorAlarmCountVo.setThiefAlarmCount(vo.getDeviceTypeAlarmCount());
+                    break;
+                case "41885"://燃气
+                    sensorAlarmCountVo.setGasCount(vo.getDeviceTypeCount());
+                    sensorAlarmCountVo.setGasAlarmCount(vo.getDeviceTypeAlarmCount());
+                    break;
+            }
+        }
+        return sensorAlarmCountVo;
+    }
+
+    @Override
+    public Integer getFireWarningBadge(Long orgId) {
+        AppAlarmPageDto pageDto = new AppAlarmPageDto();
+        pageDto.setOrgId(orgId);
+        pageDto.setCheckSub(true);
+        SensorAlarmCountVo alarmCountVo = this.selectDeviceTypeCount(pageDto);
+        if (alarmCountVo != null){
+            Integer smokeAlarmCount = alarmCountVo.getSmokeAlarmCount() == null ? 0 : alarmCountVo.getSmokeAlarmCount();
+            Integer gasAlarmCount = alarmCountVo.getGasAlarmCount() == null ? 0 : alarmCountVo.getGasAlarmCount();
+            Integer htAlarmCount = alarmCountVo.getTemperatureAndHumidityAlarmCount() == null ? 0 : alarmCountVo.getTemperatureAndHumidityAlarmCount();
+            Integer count = smokeAlarmCount + gasAlarmCount + htAlarmCount;
+            return count;
+        }
+        return 0;
+    }
+
+    @Override
+    public Integer getEnvMonitorBadge(Long orgId) {
+        AppAlarmPageDto pageDto = new AppAlarmPageDto();
+        pageDto.setCheckSub(true);
+        pageDto.setOrgId(orgId);
+        SensorAlarmCountVo alarmCountVo = this.selectDeviceTypeCount(pageDto);
+        if (alarmCountVo != null){
+            Integer thiefAlarmCount = alarmCountVo.getThiefAlarmCount() == null ? 0 : alarmCountVo.getThiefAlarmCount();
+            Integer infraredAlarmCount = alarmCountVo.getInfraredAlarmCount() == null ? 0 : alarmCountVo.getInfraredAlarmCount();
+            Integer doorAlarmCount = alarmCountVo.getDoorAlarmCount() == null ? 0 : alarmCountVo.getDoorAlarmCount();
+            Integer waterAlarmCount = alarmCountVo.getWaterAlarmCount() == null ? 0 : alarmCountVo.getWaterAlarmCount();
+            Integer upsAlarmCount = alarmCountVo.getUpsAlarmCount() == null ? 0 : alarmCountVo.getUpsAlarmCount();
+            Integer airAlarmCount = alarmCountVo.getAirAlarmCount() == null ? 0 : alarmCountVo.getAirAlarmCount();
+            Integer count = thiefAlarmCount + infraredAlarmCount + doorAlarmCount + waterAlarmCount + upsAlarmCount + airAlarmCount;
+            return count;
+        }
+        return 0;
+    }
+
+    @Override
+    public TableDataInfo<IotAlarmDataVo> selectSensorAlarmPageList(AppAlarmPageDto requestDto) {
+        Page<IotAlarmDataVo> page;
+        //分页
+        if (requestDto.getPageNum() != null && requestDto.getPageSize() != null) {
+            page = new Page<>(requestDto.getPageNum(), requestDto.getPageSize());
+        } else {
+            page = new Page<>();
+        }
+
+        page = baseMapper.selectSensorAlarmPageList(page, requestDto);
+        return TableDataInfo.build(page);
+    }
 }

+ 55 - 9
soc-modules/soc-modules-iot/src/main/java/com/xunmei/iot/service/impl/IotBoardServiceImpl.java

@@ -1,18 +1,25 @@
 package com.xunmei.iot.service.impl;
 
+import cn.hutool.core.collection.CollectionUtil;
 import cn.hutool.core.util.ObjectUtil;
+import com.google.common.collect.Lists;
+import com.xunmei.common.core.constant.CacheConstants;
 import com.xunmei.common.core.constant.SecurityConstants;
 import com.xunmei.common.core.domain.iot.domain.IotSensor;
 import com.xunmei.common.core.domain.mediator.domain.IotAlarmData;
+import com.xunmei.common.core.exception.ServiceException;
 import com.xunmei.common.core.thread.ThreadPoolConfig;
+import com.xunmei.common.redis.utils.RedisUtils;
 import com.xunmei.iot.mapper.IotBoardMapper;
 import com.xunmei.iot.service.IIotCommonSensorService;
 import com.xunmei.iot.service.IotAlarmDataService;
 import com.xunmei.iot.service.IotBoardService;
+import com.xunmei.iot.vo.alarmData.AppAlarmDataPageVo;
 import com.xunmei.iot.vo.board.IotBoardOverviewItemVo;
 import com.xunmei.iot.vo.board.IotBoardOverviewVo;
 import com.xunmei.system.api.RemoteOrgService;
 import com.xunmei.system.api.domain.SysOrg;
+import com.xunmei.system.api.vo.SysOrgVO;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Qualifier;
 import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
@@ -140,21 +147,25 @@ public class IotBoardServiceImpl implements IotBoardService {
 
     @Override
     public Map<String, Object> iotOverview(Long orgId) {
+        List<SysOrgVO> cacheList = RedisUtils.getCacheList(CacheConstants.ORG_CACHE_LIST_KEY);
+        List<String> alarmTypeList = Lists.newArrayList("水浸告警", "温湿度告警", "烟感告警", "燃气告警", "门磁告警", "盗情告警");
+        Map<String, Object> map = new HashMap<>();
         Map<String, Object> dataMap = new HashMap<>();
         List<Map<String, Object>> resultList = new ArrayList<>();
-        SysOrg org = remoteOrgService.selectOrgById(orgId, SecurityConstants.INNER);
+        Optional<SysOrgVO> optional = cacheList.stream().filter(o -> ObjectUtil.equal(o.getId(), orgId)).findFirst();
+        if (!optional.isPresent()) {
+            throw new ServiceException("当前机构信息不存在");
+        }
+        SysOrgVO org = optional.get();
         List<IotSensor> list = sensorService.selectSensorListByOrgPath(org.getPath());
-        HashMap<String, Object> map = new HashMap<>();
         dataMap.put("sensor", map);
         dataMap.put("resultData", resultList);
         map.put("key", "传感器设备");
         map.put("sensorNums", list.size());
         map.put("normal", 0);
         map.put("alarm", 0);
-        List<String> alarmTypeList = new ArrayList<>();
-        Collections.addAll(alarmTypeList,"水浸告警", "温湿度告警", "烟感告警", "燃气告警", "门磁告警", "盗情告警");
         if (ObjectUtil.isEmpty(list)) {
-            buildEmptyData(resultList,alarmTypeList);
+            buildEmptyData(resultList, alarmTypeList);
             return dataMap;
         }
         Map<Integer, Long> collect = list.stream().collect(Collectors.groupingBy(IotSensor::getState, Collectors.counting()));
@@ -168,7 +179,7 @@ public class IotBoardServiceImpl implements IotBoardService {
         });
         List<IotAlarmData> alarmDataList = alarmDataService.selectAlarmDataListByOrgPath(org.getPath(), 0);
         if (ObjectUtil.isEmpty(alarmDataList)) {
-            buildEmptyData(resultList,alarmTypeList);
+            buildEmptyData(resultList, alarmTypeList);
             return dataMap;
         }
         //屏蔽红外
@@ -186,26 +197,60 @@ public class IotBoardServiceImpl implements IotBoardService {
             hashMap.put("currentAlarm", (int) currentAlarm);
             hashMap.put("unDealAlarm", (int) unDealAlarm);
             hashMap.put("needAlarm", (int) needAlarm);
+            hashMap.put("currentAlarmData", getAlarmDataList(value, Integer.parseInt(listEntry.getKey().toString()), cacheList));
             resultList.add(hashMap);
         }
         List<String> keyList = resultList.stream().map(m -> m.get("key")).distinct().map(String::valueOf).collect(Collectors.toList());
 
         for (String type : alarmTypeList) {
-           if (!keyList.contains(type)){
+            if (!keyList.contains(type)) {
                 Map<String, Object> hashMap = new HashMap<>();
                 hashMap.put("key", type);
                 hashMap.put("historyAlarm", 0);
                 hashMap.put("currentAlarm", 0);
                 hashMap.put("unDealAlarm", 0);
                 hashMap.put("needAlarm", 0);
+                hashMap.put("currentAlarmData", Lists.newArrayList());
                 resultList.add(hashMap);
-
-           }
+            }
         }
 
         return dataMap;
     }
 
+    private List<AppAlarmDataPageVo> getAlarmDataList(List<IotAlarmData> dataList, Integer sourceType, List<SysOrgVO> cacheList) {
+        List<IotAlarmData> list = dataList.stream()
+                .filter(d -> ObjectUtil.equal(d.getSourceType(), sourceType))
+                .filter(d -> ObjectUtil.isNull(d.getEndTime()))
+                .collect(Collectors.toList());
+        if (CollectionUtil.isEmpty(list)) {
+            return new ArrayList<>();
+        }
+        List<AppAlarmDataPageVo> arrayList = new ArrayList<>();
+
+        for (IotAlarmData alarmData : list) {
+            AppAlarmDataPageVo vo = new AppAlarmDataPageVo();
+            vo.setId(alarmData.getId());
+            Optional<SysOrgVO> voOptional = cacheList.stream().filter(d -> ObjectUtil.equal(d.getId(), alarmData.getOrgId())).findFirst();
+            if (voOptional.isPresent()) {
+                SysOrgVO orgVO = voOptional.get();
+                vo.setOrgName(orgVO.getShortName());
+            }
+            vo.setDeviceName(alarmData.getDeviceName());
+            vo.setSourceType(alarmData.getSourceType().toString());
+            vo.setSourceTypeDes(alarmData.getSourceTypeDes());
+            vo.setStartTime(alarmData.getTime());
+            vo.setEndTime(alarmData.getEndTime());
+            vo.setDoTime(alarmData.getDoTime());
+            vo.setDoByUser(alarmData.getDoByUser());
+            vo.setDoType(alarmData.getDoType());
+            vo.setDoContent(alarmData.getDoContent());
+            arrayList.add(vo);
+
+        }
+        return arrayList;
+    }
+
     private void buildEmptyData(List<Map<String, Object>> resultList, List<String> alarmType) {
         for (String s : alarmType) {
             Map<String, Object> hashMap = new HashMap<>();
@@ -214,6 +259,7 @@ public class IotBoardServiceImpl implements IotBoardService {
             hashMap.put("currentAlarm", 0);
             hashMap.put("unDealAlarm", 0);
             hashMap.put("needAlarm", 0);
+            hashMap.put("currentAlarmData", Lists.newArrayList());
             resultList.add(hashMap);
         }
 

+ 18 - 10
soc-modules/soc-modules-iot/src/main/java/com/xunmei/iot/service/impl/IotServiceImpl.java

@@ -1,16 +1,16 @@
 package com.xunmei.iot.service.impl;
 
-import cn.hutool.core.date.DateUtil;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.xunmei.common.core.domain.iot.domain.IotDvrChannel;
 import com.xunmei.common.core.domain.video.MediatorVideoDaysCheck;
 import com.xunmei.common.core.domain.video.MediatorVideoDiagnosisRecord;
+import com.xunmei.iot.mapper.IotDvrChannelMapper;
 import com.xunmei.iot.mapper.VideoDaysCheckMapper;
 import com.xunmei.iot.mapper.VideoDiagnosisRecordMapper;
 import com.xunmei.iot.service.IotService;
 import org.springframework.stereotype.Service;
 
 import javax.annotation.Resource;
-import java.util.Date;
 
 @Service
 public class IotServiceImpl implements IotService {
@@ -19,27 +19,35 @@ public class IotServiceImpl implements IotService {
     VideoDaysCheckMapper videoDaysCheckMapper;
     @Resource
     VideoDiagnosisRecordMapper diagnosisRecordMapper;
+    @Resource
+    IotDvrChannelMapper channelMapper;
 
     @Override
-    public int selectVideoDayExceptionChannelNums(Long orgId, String date) {
-        Date time = DateUtil.parse(date, "yyyy-MM-dd");
+    public Integer selectVideoDayExceptionChannelNums(Long orgId) {
+        LambdaQueryWrapper<IotDvrChannel> channelWrapper = new LambdaQueryWrapper<>();
+        channelWrapper.eq(IotDvrChannel::getOrgId, orgId);
+        if (channelMapper.selectCount(channelWrapper) < 1) {
+            return null;
+        }
+
+
         LambdaQueryWrapper<MediatorVideoDaysCheck> wrapper = new LambdaQueryWrapper<MediatorVideoDaysCheck>();
         wrapper.eq(MediatorVideoDaysCheck::getOrgId, orgId);
         wrapper.eq(MediatorVideoDaysCheck::getStatus, 1);
-        wrapper.ge(MediatorVideoDaysCheck::getUpdateTime, DateUtil.beginOfDay(time));
-        wrapper.le(MediatorVideoDaysCheck::getUpdateTime, DateUtil.endOfDay(time));
         return videoDaysCheckMapper.selectCount(wrapper).intValue();
     }
 
 
     @Override
-    public int selectVideoDiagnosisExceptionChannelNums(Long orgId, String date) {
-        Date time = DateUtil.parse(date, "yyyy-MM-dd");
+    public Integer selectVideoDiagnosisExceptionChannelNums(Long orgId) {
+        LambdaQueryWrapper<IotDvrChannel> channelWrapper = new LambdaQueryWrapper<>();
+        channelWrapper.eq(IotDvrChannel::getOrgId, orgId);
+        if (channelMapper.selectCount(channelWrapper) < 1) {
+            return null;
+        }
         LambdaQueryWrapper<MediatorVideoDiagnosisRecord> wrapper = new LambdaQueryWrapper<MediatorVideoDiagnosisRecord>();
         wrapper.eq(MediatorVideoDiagnosisRecord::getOrgId, orgId);
         wrapper.eq(MediatorVideoDiagnosisRecord::getIsAlarm, 1);
-        wrapper.ge(MediatorVideoDiagnosisRecord::getAlarmTime, DateUtil.beginOfDay(time));
-        wrapper.le(MediatorVideoDiagnosisRecord::getAlarmTime, DateUtil.endOfDay(time));
         return diagnosisRecordMapper.selectCount(wrapper).intValue();
     }
 }

+ 13 - 0
soc-modules/soc-modules-iot/src/main/java/com/xunmei/iot/vo/alarmData/DeviceTypeCountVo.java

@@ -0,0 +1,13 @@
+package com.xunmei.iot.vo.alarmData;
+
+import lombok.Data;
+
+@Data
+public class DeviceTypeCountVo {
+
+    private String deviceType;
+
+    private Integer deviceTypeCount;
+
+    private Integer deviceTypeAlarmCount;
+}

+ 43 - 0
soc-modules/soc-modules-iot/src/main/java/com/xunmei/iot/vo/alarmData/SensorAlarmCountVo.java

@@ -0,0 +1,43 @@
+package com.xunmei.iot.vo.alarmData;
+
+import lombok.Data;
+
+@Data
+public class SensorAlarmCountVo {
+
+    private Integer smokeCount;
+
+    private Integer smokeAlarmCount;
+
+    private Integer gasCount;
+
+    private Integer gasAlarmCount;
+
+    private Integer temperatureAndHumidityCount;
+
+    private Integer temperatureAndHumidityAlarmCount;
+
+    private Integer thiefCount;
+
+    private Integer thiefAlarmCount;
+
+    private Integer infraredCount;
+
+    private Integer infraredAlarmCount;
+
+    private Integer doorCount;
+
+    private Integer doorAlarmCount;
+
+    private Integer waterCount;
+
+    private Integer waterAlarmCount;
+
+    private Integer upsCount;
+
+    private Integer upsAlarmCount;
+
+    private Integer airCount;
+
+    private Integer airAlarmCount;
+}

+ 55 - 0
soc-modules/soc-modules-iot/src/main/resources/mapper/IotAlarmDataMapper.xml

@@ -122,4 +122,59 @@
             and d.data_type = #{dataType}
         </if>
     </select>
+
+    <select id="selectDeviceTypeCount" resultType="com.xunmei.iot.vo.alarmData.DeviceTypeCountVo">
+        SELECT
+            s.device_type AS deviceType,
+            count(*) AS deviceTypeCount,
+            (
+            SELECT
+                count(*)
+            FROM
+                iot_sensor a
+            WHERE
+                a.device_type = s.device_type
+                AND a.state = 1
+                <if test="  query.checkSub != null and query.checkSub == true">
+                    and a.org_path like concat(concat('%',#{query.orgPath}),'%')
+                </if>
+                <if test="  query.checkSub != null and query.checkSub == false">
+                    and a.org_id = #{query.orgId}
+                </if>
+            ) AS deviceTypeAlarmCount
+        FROM
+            iot_sensor s
+        WHERE
+            s.deleted = 0
+            <if test="  query.checkSub != null and query.checkSub == true">
+                and s.org_path like concat(concat('%',#{query.orgPath}),'%')
+            </if>
+            <if test="  query.checkSub != null and query.checkSub == false">
+                and s.org_id = #{query.orgId}
+            </if>
+        GROUP BY
+            s.device_type
+    </select>
+    <select id="selectSensorAlarmPageList" resultType="com.xunmei.iot.vo.alarm.IotAlarmDataVo">
+        SELECT
+            a.*,
+            b.affiliated_area AS city,
+            b.affiliated_bank AS bank,
+            b.short_name AS org_name
+        FROM
+            iot_alarm_data a
+            LEFT JOIN iot_sensor s ON a.device_id = s.device_code AND a.org_id = s.org_id
+            LEFT JOIN sys_org b ON a.org_id = b.id
+        WHERE
+            1=1
+            <if test="param.sensorId != null">
+                and s.id = #{param.sensorId}
+            </if>
+            <if test="param.deviceName != null and param.deviceName != ''">
+                and s.device_name like concat('%',#{param.deviceName},'%')
+            </if>
+        ORDER BY
+            a.`time` DESC,
+            a.end_time DESC
+    </select>
 </mapper>

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

@@ -43,6 +43,7 @@
         <if test="request.deviceType!= null and request.deviceType!= ''">
             and s.device_type = #{request.deviceType}
         </if>
+        order by s.state desc
     </select>
     <select id="stateStatistic" resultType="com.xunmei.iot.vo.sensor.SensorAppStateVo">
         SELECT sum(state=0) as normal,

+ 1 - 1
soc-modules/soc-modules-system/src/main/java/com/xunmei/system/controller/SysConfigController.java

@@ -109,7 +109,7 @@ public class SysConfigController extends BaseController {
         configService.resetConfigCache();
         return success();
     }
-
+    //此接口对外暴露,勿修改
     @GetMapping("/findFirstByCode")
     public R<SysConfig> findFirstByCode(String code) {
         return R.ok(configService.findFirstByCode(code));

+ 18 - 0
soc-modules/soc-modules-system/src/main/java/com/xunmei/system/controller/SysDeptController.java

@@ -524,4 +524,22 @@ public class SysDeptController extends BaseController {
             response.setCharacterEncoding("utf-8");
         }
     }
+
+    /**
+     * GA38填写情况导出
+     * @param dept
+     * @param response
+     */
+    @RequiresPermissions("system:dept:exportDefenseDetailExtend")
+    @PostMapping("/exportDefenseDetailExtend")
+    public void exportDefenseDetailExtend(SysOrg dept, HttpServletResponse response) {
+        try {
+            orgService.exportDefenseDetailExtend(dept,response);
+        }catch (Exception e){
+            // 重置response
+            response.reset();
+            response.setContentType("application/json");
+            response.setCharacterEncoding("utf-8");
+        }
+    }
 }

+ 3 - 0
soc-modules/soc-modules-system/src/main/java/com/xunmei/system/mapper/SysOrgMapper.java

@@ -9,6 +9,7 @@ import com.xunmei.system.api.vo.SysOrgVO;
 import com.xunmei.system.dto.SysOrgDto;
 import com.xunmei.system.util.ConstructionDetailExport;
 import com.xunmei.system.util.OrgExtendExport;
+import com.xunmei.system.util.OrgPhysicalDefenseConstructionDetailExport;
 import com.xunmei.system.util.OrgPhysicalDefenseConstructionExport;
 import org.apache.ibatis.annotations.Param;
 import org.springframework.stereotype.Component;
@@ -199,4 +200,6 @@ public interface SysOrgMapper extends BaseMapper<SysOrg> {
     List<SysOrg> selectOrgs(@Param("org") SysOrgDto org);
 
     List<OrgExtendExport> exportOrgExtend(@Param("org") SysOrg org,@Param("typeList") List<Integer> typeList);
+
+    List<OrgPhysicalDefenseConstructionDetailExport> exportDefenseDetailExtend(@Param("org") SysOrg org, @Param("typeList") List<Integer> typeList);
 }

+ 3 - 1
soc-modules/soc-modules-system/src/main/java/com/xunmei/system/service/ISysOrgService.java

@@ -186,5 +186,7 @@ public interface ISysOrgService extends IService<SysOrg> {
      */
     List<SysOrg> selectOrgList(SysOrgDto org);
 
-    void exportOrgExtend(SysOrg dept, HttpServletResponse response) throws IOException;
+    void exportOrgExtend(SysOrg dept, HttpServletResponse response) throws Exception;
+
+    void exportDefenseDetailExtend(SysOrg dept, HttpServletResponse response) throws Exception;
 }

+ 59 - 5
soc-modules/soc-modules-system/src/main/java/com/xunmei/system/service/impl/SysOrgServiceImpl.java

@@ -415,10 +415,15 @@ public class SysOrgServiceImpl extends ServiceImpl<SysOrgMapper, SysOrg> impleme
 
             //是否实现远程控制
             Map remote = baseMapper.getRemote(s.getPath());
-            securityWorkExport.setCashAddingRoom(Integer.valueOf(remote.get("cashAddingRoom").toString()));
-            securityWorkExport.setRemoteCount(Integer.valueOf(remote.get("remoteCount").toString()));
-            securityWorkExport.setCashAddingRoomControlCount(Integer.valueOf(remote.get("cashAddingRoomControlCount").toString()));
-            securityWorkExport.setRemoteControlCount(Integer.valueOf(remote.get("remoteControlCount").toString()));
+            Integer cashAddingRoom = Integer.valueOf(remote.get("cashAddingRoom").toString());
+            Integer remoteCount = Integer.valueOf(remote.get("remoteCount").toString());
+            Integer cashAddingRoomControlCount = Integer.valueOf(remote.get("cashAddingRoomControlCount").toString());
+            Integer remoteControlCount = Integer.valueOf(remote.get("remoteControlCount").toString());
+
+            securityWorkExport.setCashAddingRoom(cashAddingRoom - cashAddingRoomControlCount);
+            securityWorkExport.setRemoteCount(remoteCount - remoteControlCount);
+            securityWorkExport.setCashAddingRoomControlCount(cashAddingRoomControlCount);
+            securityWorkExport.setRemoteControlCount(remoteControlCount);
 
 
             //夜间值守
@@ -1173,7 +1178,7 @@ public class SysOrgServiceImpl extends ServiceImpl<SysOrgMapper, SysOrg> impleme
     }
 
     @Override
-    public void exportOrgExtend(SysOrg dept, HttpServletResponse response) throws IOException {
+    public void exportOrgExtend(SysOrg dept, HttpServletResponse response) throws Exception {
         List<Integer> typeList = new ArrayList<>();
         if (dept.getType() != null){
             typeList.add(dept.getType());
@@ -1267,6 +1272,8 @@ public class SysOrgServiceImpl extends ServiceImpl<SysOrgMapper, SysOrg> impleme
                     List<OrgExtendJKZXExport> jkzxList = new ArrayList<>();
                     for (OrgExtendExport export : orgExtendExports) {
                         OrgExtendJKZXExport jkzxExport = new OrgExtendJKZXExport();
+                        export.setCashAddingRoom(export.getCashAddingRoom() - export.getCashAddingRoomControlCount());
+                        export.setRemoteCount(export.getRemoteCount() - export.getRemoteControlCount());
                         BeanUtils.copyProperties(export, jkzxExport);
                         jkzxList.add(jkzxExport);
                     }
@@ -1293,10 +1300,57 @@ public class SysOrgServiceImpl extends ServiceImpl<SysOrgMapper, SysOrg> impleme
             xh.getAndIncrement();
             orgExtendExports.forEach(e -> {
                 e.setXh(String.valueOf(xh.getAndIncrement()));
+                e.setCashAddingRoom(e.getCashAddingRoom() - e.getCashAddingRoomControlCount());
+                e.setRemoteCount(e.getRemoteCount() - e.getRemoteControlCount());
             });
             // 数据导出
             EasyExcel.write(response.getOutputStream(), OrgExtendExport.class)
                     .registerWriteHandler(new LongestMatchColumnWidthStyleStrategy()).sheet("机构补充信息").doWrite(orgExtendExports);
         }
     }
+
+    @Override
+    public void exportDefenseDetailExtend(SysOrg dept, HttpServletResponse response) throws IOException {
+        List<Integer> typeList = new ArrayList<>();
+        if (dept.getType() != null){
+            typeList.add(dept.getType());
+        }else {
+            typeList.add(4);//营业网点
+            typeList.add(5);//离行式自助银行
+            typeList.add(6);//中心业务库
+            typeList.add(10);//监控中心
+        }
+        Long parentId = dept.getParentId();
+        if (parentId == null) {
+            parentId = SecurityUtils.getLoginUser().getSysUser().getOrgId();
+        }
+        SysOrg sysOrg = sysOrgMapper.selectById(parentId);
+        //查询条件
+        if (sysOrg != null) {
+            //下穿
+            if (dept.getCheckSub()) {
+                dept.setParentId(null);
+                dept.setPath(sysOrg.getPath());
+            } else {
+                dept.setPath(sysOrg.getPath());
+            }
+        }
+        List<OrgPhysicalDefenseConstructionDetailExport> detailExports= null;
+        detailExports = baseMapper.exportDefenseDetailExtend(dept, typeList);
+
+        AtomicInteger xh = new AtomicInteger();
+        xh.getAndIncrement();
+        detailExports.forEach(e -> {
+            e.setXh(String.valueOf(xh.getAndIncrement()));
+        });
+
+        // 设置响应头
+        response.addHeader("Content-Disposition", "attachment;filename=" + URLEncoder.encode("安全防范设施建设达标信息", "utf-8"));
+        response.setContentType("application/octet-stream;charset=UTF-8");
+        response.setCharacterEncoding("utf-8");
+
+        // 数据导出
+        EasyExcel.write(response.getOutputStream(), OrgPhysicalDefenseConstructionDetailExport.class)
+                .registerWriteHandler(new LongestMatchColumnWidthStyleStrategy()).sheet("安全防范设施建设达标信息").doWrite(detailExports);
+    }
 }

+ 32 - 28
soc-modules/soc-modules-system/src/main/java/com/xunmei/system/util/OrgExtendExport.java

@@ -27,7 +27,7 @@ public class OrgExtendExport {
     @ExcelProperty(value = "地区", index = 1)
     private String city;
 
-    @ExcelProperty(value = "行社", index = 2)
+    @ExcelProperty(value = "单位", index = 2)
     private String affiliatedBank;
 
     @ExcelProperty(value = "机构简称", index = 3)
@@ -39,33 +39,31 @@ public class OrgExtendExport {
     @ExcelProperty(value = "地址", index = 5)
     private String address;
 
-    @JsonFormat(pattern = "yyyy-MM-dd")
-    @ExcelProperty(value = "建设时间", index = 6)
-    private Date constructionTime;
+    @ExcelProperty(value = "中心建设时间(年)", index = 6)
+    private String constructionTime;
 
-    @JsonFormat(pattern = "yyyy-MM-dd")
-    @ExcelProperty(value = "最近一次改造时间", index = 7)
-    private Date lastUpdateTime;
+    @ExcelProperty(value = "监控平台最近一次升级改造时间(年)", index = 7)
+    private String lastUpdateTime;
 
-    @ExcelProperty(value = "系统平台品牌", index = 8)
+    @ExcelProperty(value = "监控中心平台品牌", index = 8)
     private String platformBrand;
 
-    @ExcelProperty(value = "离行式加钞间出入口数量", index = 9)
+    @ExcelProperty(value = {"未实现远程控制和实时授权功能", "离行式自助银行加钞间出入口设置数量"}, index = 9)
     private Integer cashAddingRoom;
 
-    @ExcelProperty(value = "可远程控制和实时授权出入口数量(离行式)", index = 10)
-    private Integer cashAddingRoomControlCount;
-
-    @ExcelProperty(value = "业务库防控隔离门出入口数量", index = 11)
+    @ExcelProperty(value = {"未实现远程控制和实时授权功能", "业务库(不含保管箱库)防控隔离门出入口设置数量"}, index = 10)
     private Integer remoteCount;
 
-    @ExcelProperty(value = "可远程控制和实时授权出入口数量(业务库)", index = 12)
+    @ExcelProperty(value = {"实现远程控制和实时授权功能", "离行式自助银行加钞间出入口设置数量"}, index = 11)
+    private Integer cashAddingRoomControlCount;
+
+    @ExcelProperty(value = {"实现远程控制和实时授权功能", "业务库(不含保管箱库)防控隔离门出入口设置数量"}, index = 12)
     private Integer remoteControlCount;
 
-    @ExcelProperty(value= "全辖摄像头总路数", index = 13)
+    @ExcelProperty(value= "视频监控摄像头总路数", index = 13)
     private Integer totalCameraCount;
 
-    @ExcelProperty(value = "全辖高清摄像头路数", index = 14)
+    @ExcelProperty(value = "视频监控摄像头高清摄像机路数", index = 14)
     private Integer hdCameraCount;
 
     @ExcelProperty(value = "产权类型", index = 15)
@@ -83,30 +81,36 @@ public class OrgExtendExport {
     @ExcelProperty(value = "是否设立在行式自助银行", index = 19)
     private String selfServiceBank;
 
-    @ExcelProperty(value = "穿墙式设备", index = 20)
-    private Integer detachedWallPenetratingEquipment;
+    @ExcelProperty(value = "在行式大堂式机具", index = 21)
+    private Integer onLineLobbyEquipment;
+
+    @ExcelProperty(value = "在行式穿墙式机具", index = 20)
+    private Integer onLineWallPenetratingEquipment;
+
+    @ExcelProperty(value = "离行式大堂式机具", index = 22)
+    private Integer departureLobbyEquipment;
 
-    @ExcelProperty(value = "大堂式设备", index = 21)
-    private Integer detachedLobbyEquipment;
+    @ExcelProperty(value = "离行式穿墙式机具", index = 23)
+    private Integer departureWallPenetratingEquipment;
 
-    @ExcelProperty(value = "是否设立业务库", index = 22)
+    @ExcelProperty(value = "是否设立业务库", index = 24)
     private String businessLibrary;
 
-    @ExcelProperty(value = "业务库类型", index = 23)
+    @ExcelProperty(value = "业务库类型", index = 25)
     private String businessLibraryTypeName;
 
-    @ExcelProperty(value = "是否配备保安人员", index = 24)
+    @ExcelProperty(value = "是否配备保安人员", index = 26)
     private String askari;
 
-    @ExcelProperty(value = "内部保安人数", index = 25)
+    @ExcelProperty(value = "内部保安人数(含派遣)", index = 27)
     private Integer innerCount;
 
-    @ExcelProperty(value = "外聘保安人数", index = 26)
+    @ExcelProperty(value = "外聘保安人数", index = 28)
     private Integer outsideCount;
 
-    @ExcelProperty(value = "是否取得保安证书", index = 27)
+    @ExcelProperty(value = "是否取得保安证书", index = 29)
     private String isAskariCertificate;
 
-    @ExcelProperty(value = "保安证", index = 28,converter = ImgUrlConverter.class)
-    private String askariCertificate;
+//    @ExcelProperty(value = "保安证", index = 30,converter = ImgUrlConverter.class)
+//    private String askariCertificate;
 }

+ 14 - 16
soc-modules/soc-modules-system/src/main/java/com/xunmei/system/util/OrgExtendJKZXExport.java

@@ -27,7 +27,7 @@ public class OrgExtendJKZXExport {
     @ExcelProperty(value = "地区", index = 1)
     private String city;
 
-    @ExcelProperty(value = "行社", index = 2)
+    @ExcelProperty(value = "单位", index = 2)
     private String affiliatedBank;
 
     @ExcelProperty(value = "机构简称", index = 3)
@@ -39,32 +39,30 @@ public class OrgExtendJKZXExport {
     @ExcelProperty(value = "地址", index = 5)
     private String address;
 
-    @JsonFormat(pattern = "yyyy-MM-dd")
-    @ExcelProperty(value = "建设时间", index = 6)
-    private Date constructionTime;
+    @ExcelProperty(value = "中心建设时间(年)", index = 6)
+    private String constructionTime;
 
-    @ExcelProperty(value = "最近一次改造时间", index = 7)
-    @JsonFormat(pattern = "yyyy-MM-dd")
-    private Date lastUpdateTime;
+    @ExcelProperty(value = "监控平台最近一次升级改造时间(年)", index = 7)
+    private String lastUpdateTime;
 
-    @ExcelProperty(value = "系统平台品牌", index = 8)
+    @ExcelProperty(value = "监控中心平台品牌", index = 8)
     private String platformBrand;
 
-    @ExcelProperty(value = "离行式加钞间出入口数量", index = 9)
+    @ExcelProperty(value = {"未实现远程控制和实时授权功能", "离行式自助银行加钞间出入口设置数量"}, index = 9)
     private Integer cashAddingRoom;
 
-    @ExcelProperty(value = "可远程控制和实时授权出入口数量(离行式)", index = 10)
-    private Integer cashAddingRoomControlCount;
-
-    @ExcelProperty(value = "业务库防控隔离门出入口数量", index = 11)
+    @ExcelProperty(value = {"未实现远程控制和实时授权功能", "业务库(不含保管箱库)防控隔离门出入口设置数量"}, index = 10)
     private Integer remoteCount;
 
-    @ExcelProperty(value = "可远程控制和实时授权出入口数量(业务库)", index = 12)
+    @ExcelProperty(value = {"实现远程控制和实时授权功能", "离行式自助银行加钞间出入口设置数量"}, index = 11)
+    private Integer cashAddingRoomControlCount;
+
+    @ExcelProperty(value = {"实现远程控制和实时授权功能", "业务库(不含保管箱库)防控隔离门出入口设置数量"}, index = 12)
     private Integer remoteControlCount;
 
-    @ExcelProperty(value= "全辖摄像头总路数", index = 13)
+    @ExcelProperty(value= "视频监控摄像头总路数", index = 13)
     private Integer totalCameraCount;
 
-    @ExcelProperty(value = "全辖高清摄像头路数", index = 14)
+    @ExcelProperty(value = "视频监控摄像头高清摄像机路数", index = 14)
     private Integer hdCameraCount;
 }

+ 6 - 5
soc-modules/soc-modules-system/src/main/java/com/xunmei/system/util/OrgExtendLHSZZExport.java

@@ -27,7 +27,7 @@ public class OrgExtendLHSZZExport {
     @ExcelProperty(value = "地区", index = 1)
     private String city;
 
-    @ExcelProperty(value = "行社", index = 2)
+    @ExcelProperty(value = "单位", index = 2)
     private String affiliatedBank;
 
     @ExcelProperty(value = "机构简称", index = 3)
@@ -39,9 +39,10 @@ public class OrgExtendLHSZZExport {
     @ExcelProperty(value = "地址", index = 5)
     private String address;
 
-    @ExcelProperty(value = "穿墙式设备", index = 6)
-    private Integer detachedWallPenetratingEquipment;
+    @ExcelProperty(value = "离行式大堂式机具", index = 6)
+    private Integer departureLobbyEquipment;
+
+    @ExcelProperty(value = "离行式穿墙式机具", index = 7)
+    private Integer departureWallPenetratingEquipment;
 
-    @ExcelProperty(value = "大堂式设备", index = 7)
-    private Integer detachedLobbyEquipment;
 }

+ 12 - 15
soc-modules/soc-modules-system/src/main/java/com/xunmei/system/util/OrgExtendYYWDExport.java

@@ -6,11 +6,8 @@ import com.alibaba.excel.annotation.write.style.ColumnWidth;
 import com.alibaba.excel.annotation.write.style.ContentRowHeight;
 import com.alibaba.excel.annotation.write.style.HeadRowHeight;
 import com.baomidou.mybatisplus.annotation.TableField;
-import com.fasterxml.jackson.annotation.JsonFormat;
 import lombok.Data;
 
-import java.util.Date;
-
 @Data
 @ColumnWidth(15) //列宽,最大值为255
 @HeadRowHeight(32) //表头行高
@@ -27,7 +24,7 @@ public class OrgExtendYYWDExport {
     @ExcelProperty(value = "地区", index = 1)
     private String city;
 
-    @ExcelProperty(value = "行社", index = 2)
+    @ExcelProperty(value = "单位", index = 2)
     private String affiliatedBank;
 
     @ExcelProperty(value = "机构简称", index = 3)
@@ -51,25 +48,25 @@ public class OrgExtendYYWDExport {
     @ExcelProperty(value = "是否设立保管箱库", index = 9)
     private String safeBox;
 
-    @ExcelProperty(value = "穿墙式设备", index = 10)
-    private Integer detachedWallPenetratingEquipment;
-
-    @ExcelProperty(value = "大堂式设备", index = 11)
-    private Integer detachedLobbyEquipment;
-
-    @ExcelProperty(value = "是否设立业务库", index = 12)
+    @ExcelProperty(value = "是否设立业务库", index = 10)
     private String businessLibrary;
 
-    @ExcelProperty(value = "是否设立在行式自助银行", index = 13)
+    @ExcelProperty(value = "是否设立在行式自助银行", index = 11)
     private String selfServiceBank;
 
+    @ExcelProperty(value = "在行式大堂式机具", index = 12)
+    private Integer onLineLobbyEquipment;
+
+    @ExcelProperty(value = "在行式穿墙式机具", index = 13)
+    private Integer onLineWallPenetratingEquipment;
+
     @ExcelProperty(value = "业务库类型", index = 14)
     private String businessLibraryTypeName;
 
     @ExcelProperty(value = "是否配备保安人员", index = 15)
     private String askari;
 
-    @ExcelProperty(value = "内部保安人数", index = 16)
+    @ExcelProperty(value = "内部保安人数(含派遣)", index = 16)
     private Integer innerCount;
 
     @ExcelProperty(value = "外聘保安人数", index = 17)
@@ -78,6 +75,6 @@ public class OrgExtendYYWDExport {
     @ExcelProperty(value = "是否取得保安证书", index = 18)
     private String isAskariCertificate;
 
-    @ExcelProperty(value = "保安证", index = 19,converter = ImgUrlConverter.class)
-    private String askariCertificate;
+//    @ExcelProperty(value = "保安证", index = 19,converter = ImgUrlConverter.class)
+//    private String askariCertificate;
 }

+ 1 - 1
soc-modules/soc-modules-system/src/main/java/com/xunmei/system/util/OrgExtendZXYWKExport.java

@@ -24,7 +24,7 @@ public class OrgExtendZXYWKExport {
     @ExcelProperty(value = "地区", index = 1)
     private String city;
 
-    @ExcelProperty(value = "行社", index = 2)
+    @ExcelProperty(value = "单位", index = 2)
     private String affiliatedBank;
 
     @ExcelProperty(value = "机构简称", index = 3)

+ 60 - 0
soc-modules/soc-modules-system/src/main/java/com/xunmei/system/util/OrgPhysicalDefenseConstructionDetailExport.java

@@ -0,0 +1,60 @@
+package com.xunmei.system.util;
+
+import com.alibaba.excel.annotation.ExcelIgnore;
+import com.alibaba.excel.annotation.ExcelProperty;
+import com.alibaba.excel.annotation.write.style.ColumnWidth;
+import com.alibaba.excel.annotation.write.style.ContentRowHeight;
+import com.alibaba.excel.annotation.write.style.HeadRowHeight;
+import com.baomidou.mybatisplus.annotation.TableField;
+import lombok.Data;
+
+/**
+ * @author :
+ * @date :
+ */
+@Data
+@ColumnWidth(25) //列宽,最大值为255
+@HeadRowHeight(16) //表头行高
+@ContentRowHeight(16) //数据行高
+public class OrgPhysicalDefenseConstructionDetailExport {
+
+    @ExcelIgnore
+    private Long orgId;
+
+    @ExcelProperty(value = "序号", index = 0)
+    @TableField(exist = false)
+    private String xh;
+
+    @ExcelProperty(value = "地区", index = 1)
+    private String city;
+
+    @ExcelProperty(value = "单位", index = 2)
+    private String affiliatedBank;
+
+    @ExcelProperty(value = "机构简称", index = 3)
+    private String shortName;
+
+    @ExcelProperty(value = "地址", index = 4)
+    private String address;
+
+    @ExcelProperty(value = "机构类型", index = 5)
+    private String typeName;
+
+    @ExcelProperty(value = "GA38机构类型", index = 6)
+    private String extendTypeName;
+
+    @ExcelProperty(value = "GA38标准", index = 7)
+    private String standard;
+
+    @ExcelProperty(value = "达标日期", index = 8)
+    private String dateOfCompliance;
+
+    @ExcelProperty(value = "未达标原因", index = 9)
+    private String reason;
+
+    @ExcelProperty(value = "计划达标日期", index = 10)
+    private String dateOfComplete;
+
+//    @ExcelProperty(value = "证书", index = 11,converter = ImgUrlConverter.class)
+//    private String certificate;
+}

+ 49 - 12
soc-modules/soc-modules-system/src/main/resources/mapper/system/SysOrgMapper.xml

@@ -1334,27 +1334,29 @@ and a.org_path LIKE concat(#{orgPath}, '%')
             b.short_name AS shortName,
             ( SELECT dict_label FROM sys_dict_data WHERE dict_type = 'sys_org_type' AND dict_value = b.type ) AS typeName,
             b.address AS address,
-            a.construction_time AS constructionTime,
-            a.last_update_time AS lastUpdateTime,
+            IFNULL(SUBSTR( a.construction_time, 1, 4 ), '' ) AS constructionTime,
+            IFNULL(SUBSTR( a.last_update_time, 1, 4 ), '' ) AS lastUpdateTime,
             ( SELECT dict_label FROM sys_dict_data WHERE dict_type = 'org_platform_brand' AND dict_value = a.platform_brand ) AS platformBrand,
-            a.cash_adding_room AS cashAddingRoom,
-            a.cash_adding_room_control_count AS cashAddingRoomControlCount,
-            a.remote_count AS remoteCount,
-            a.remote_control_count AS remoteControlCount,
-            a.total_camera_count AS totalCameraCount,
-            a.hd_camera_count AS hdCameraCount,
+            IFNULL(a.cash_adding_room,0) AS cashAddingRoom,
+            IFNULL(a.cash_adding_room_control_count,0) AS cashAddingRoomControlCount,
+            IFNULL(a.remote_count,0) AS remoteCount,
+            IFNULL(a.remote_control_count,0) AS remoteControlCount,
+            IFNULL(a.total_camera_count,0) AS totalCameraCount,
+            IFNULL(a.hd_camera_count,0) AS hdCameraCount,
             ( SELECT dict_label FROM sys_dict_data WHERE dict_type = 'property_situation' AND dict_value = a.ownership ) AS ownerShipName,
             ( CASE a.outside_area WHEN 1 THEN '区域内' WHEN 0 THEN '区域外' ELSE '' END ) AS outsideArea,
             ( SELECT dict_label FROM sys_dict_data WHERE dict_type = 'duty_options' AND dict_value = a.duty_mode ) AS dutyMode,
             ( CASE a.safe_box WHEN 1 THEN '是' ELSE '否' END ) AS safeBox,
             ( CASE a.self_service_bank WHEN 1 THEN '是' ELSE '否' END ) AS selfServiceBank,
-            a.wall_penetrating_equipment AS wallPenetratingEquipment,
-            a.lobby_equipment AS lobbyEquipment,
+            IF(b.type = 4,IFNULL(a.wall_penetrating_equipment,0),0) AS onLineWallPenetratingEquipment,
+            IF(b.type = 4,IFNULL(a.lobby_equipment,0),0) AS onLineLobbyEquipment,
+            IF(b.type = 5,IFNULL(a.wall_penetrating_equipment,0),0) AS departureWallPenetratingEquipment,
+            IF(b.type = 5,IFNULL(a.lobby_equipment,0),0) AS departureLobbyEquipment,
             ( CASE a.business_library WHEN 1 THEN '是' ELSE '否' END ) AS businessLibrary,
             ( SELECT dict_label FROM sys_dict_data WHERE dict_type = 'business_type' AND dict_value = a.business_library_type ) AS businessLibraryTypeName,
             ( CASE a.askari WHEN 1 THEN '是' ELSE '否' END ) AS askari,
-            a.inner_count AS innerCount,
-            a.outside_count AS outsideCount,
+            IFNULL(a.inner_count,0) AS innerCount,
+            IFNULL(a.outside_count,0) AS outsideCount,
             ( CASE WHEN a.askari_certificate IS NULL THEN '否' ELSE '是' END ) AS isAskariCertificate,
             a.askari_certificate AS askariCertificate
         FROM
@@ -1385,5 +1387,40 @@ and a.org_path LIKE concat(#{orgPath}, '%')
                 </foreach>
             </if>
     </select>
+    <select id="exportDefenseDetailExtend" resultType="com.xunmei.system.util.OrgPhysicalDefenseConstructionDetailExport">
+        SELECT
+            b.id AS orgId,
+            b.affiliated_area AS city,
+            b.affiliated_bank AS affiliatedBank,
+            b.short_name AS shortName,
+            ( SELECT dict_label FROM sys_dict_data WHERE dict_type = 'sys_org_type' AND dict_value = b.type ) AS typeName,
+            b.address AS address,
+            ( SELECT dict_label FROM sys_dict_data WHERE dict_type = 'org_extend_type' AND dict_value = a.type ) AS extendTypeName,
+            ( SELECT dict_label FROM sys_dict_data WHERE dict_type = 'org_extend_standard' AND dict_value = a.standard ) AS standard,
+            IFNULL(SUBSTR( a.date_of_compliance, 1, 10 ), '' ) AS dateOfCompliance,
+            a.reason as reason,
+            IFNULL(SUBSTR( a.date_of_complete, 1, 10 ), '' ) AS dateOfComplete,
+            a.certificate as certificate
+        FROM
+            sys_org b
+            LEFT JOIN sys_org_physical_defense_construction a ON a.org_id = b.id
+        WHERE
+            b.deleted = 0
+            <if test="  org.checkSub != null and org.checkSub == true">
+                and b.path like concat(concat('%',#{org.path}),'%')
+            </if>
+            <if test="  org.checkSub != null and org.checkSub == false">
+                and b.path like concat('%',#{org.path})
+            </if>
+            <if test="  org.isLock != null ">
+                AND b.is_lock = #{org.isLock}
+            </if>
+            <if test="typeList != null and typeList.size > 0">
+                AND b.type IN
+                <foreach collection="typeList" item="orgType" open="(" separator="," close=")">
+                    #{orgType}
+                </foreach>
+            </if>
+    </select>
 
 </mapper>