浏览代码

Merge remote-tracking branch 'origin/V0.0.2' into V0.0.2

jingyuanchao 2 年之前
父节点
当前提交
15cae0e1cb
共有 32 个文件被更改,包括 275 次插入61 次删除
  1. 3 0
      project_data/sql/0.0.2/quartz/quartz.sql
  2. 24 0
      project_data/sql/0.0.2/soc/soc.sql
  3. 21 0
      soc-api/soc-api-system/src/main/java/com/xunmei/system/api/RemoteProtectionService.java
  4. 4 3
      soc-api/soc-api-system/src/main/java/com/xunmei/system/api/domain/SysUser.java
  5. 32 0
      soc-api/soc-api-system/src/main/java/com/xunmei/system/api/dto/ProtectionDTO.java
  6. 30 0
      soc-api/soc-api-system/src/main/java/com/xunmei/system/api/factory/RemoteProtectionFallbackFactory.java
  7. 2 1
      soc-modules/soc-modules-core/src/main/java/com/xunmei/core/edu/service/impl/CoreEduTrainingPlanServiceImpl.java
  8. 13 6
      soc-modules/soc-modules-core/src/main/java/com/xunmei/core/edu/service/impl/CoreEduTrainingTaskServiceImpl.java
  9. 2 2
      soc-modules/soc-modules-core/src/main/java/com/xunmei/core/resumption/controller/AppRuleController.java
  10. 9 1
      soc-modules/soc-modules-core/src/main/java/com/xunmei/core/resumption/controller/ProtectionController.java
  11. 2 2
      soc-modules/soc-modules-core/src/main/java/com/xunmei/core/resumption/domain/Protection.java
  12. 5 0
      soc-modules/soc-modules-core/src/main/java/com/xunmei/core/resumption/dto/protection/ProtectionPageDto.java
  13. 1 1
      soc-modules/soc-modules-core/src/main/java/com/xunmei/core/resumption/mapper/AppRulePointMapper.java
  14. 6 5
      soc-modules/soc-modules-core/src/main/java/com/xunmei/core/resumption/service/impl/AppRuleItemServiceImpl.java
  15. 15 1
      soc-modules/soc-modules-core/src/main/java/com/xunmei/core/resumption/service/impl/AppRuleServiceImpl.java
  16. 11 1
      soc-modules/soc-modules-core/src/main/java/com/xunmei/core/resumption/service/impl/ProtectionServiceImpl.java
  17. 5 2
      soc-modules/soc-modules-core/src/main/java/com/xunmei/core/resumption/service/impl/ResumptionRecordServiceImpl.java
  18. 3 1
      soc-modules/soc-modules-core/src/main/java/com/xunmei/core/resumption/task/ResumptionTaskBusiness.java
  19. 2 0
      soc-modules/soc-modules-core/src/main/java/com/xunmei/core/resumption/vo/appRuleItem/RuleTreeItem.java
  20. 19 14
      soc-modules/soc-modules-core/src/main/java/com/xunmei/core/resumption/vo/resumptionRecord/ResumptionRecordPageVo.java
  21. 1 1
      soc-modules/soc-modules-core/src/main/java/com/xunmei/core/safetyCheck/mapper/SafetyCheckRulePointMapper.java
  22. 10 9
      soc-modules/soc-modules-core/src/main/java/com/xunmei/core/safetyCheck/service/impl/SafetyCheckRuleItemServiceImpl.java
  23. 15 1
      soc-modules/soc-modules-core/src/main/java/com/xunmei/core/safetyCheck/service/impl/SafetyCheckRuleServiceImpl.java
  24. 1 1
      soc-modules/soc-modules-core/src/main/resources/mapper/resumption/AppRuleItemMapper.xml
  25. 1 1
      soc-modules/soc-modules-core/src/main/resources/mapper/resumption/AppRuleMapper.xml
  26. 4 1
      soc-modules/soc-modules-core/src/main/resources/mapper/resumption/AppRulePointMapper.xml
  27. 1 1
      soc-modules/soc-modules-core/src/main/resources/mapper/safetycheck/SafetyCheckRuleItemMapper.xml
  28. 1 1
      soc-modules/soc-modules-core/src/main/resources/mapper/safetycheck/SafetyCheckRuleMapper.xml
  29. 5 2
      soc-modules/soc-modules-core/src/main/resources/mapper/safetycheck/SafetyCheckRulePointMapper.xml
  30. 1 0
      soc-modules/soc-modules-system/src/main/java/com/xunmei/system/controller/SysUserController.java
  31. 23 3
      soc-modules/soc-modules-system/src/main/java/com/xunmei/system/service/impl/SysDeviceServiceImpl.java
  32. 3 0
      soc-modules/soc-modules-system/src/main/resources/mapper/system/SysUserMapper.xml

+ 3 - 0
project_data/sql/0.0.2/quartz/quartz.sql

@@ -3,3 +3,6 @@ INSERT INTO `sys_job` VALUES (128, '履职临期提醒(除了每日的)', 'DEF
 INSERT INTO `sys_job` VALUES (125, '消息发送管理(每日凌晨零点)', 'DEFAULT', 'CoreMessageSendTask.messageSendTask', '0 0 0 * * ? *', '1', '1', '0', '超级管理员', '2023-09-21 12:30:22', '超级管理员', '2023-09-22 19:04:39');
 delete from `sys_job` where job_name='生成每周安全检查任务';
 INSERT INTO `sys_job`(`job_id`, `job_name`, `job_group`, `invoke_target`, `cron_expression`, `misfire_policy`, `concurrent`, `status`, `create_by`, `create_time`, `update_by`, `update_time`) VALUES (130, '生成每周安全检查任务', 'DEFAULT', 'CoreSafetyCheckTask.buildWeekTask', '1 1 1 ? * 2', '2', '1', '0', '超级管理员', '2023-09-22 16:34:24', '', '2023-09-22 16:34:55');
+
+DELETE from `sys_job` WHERE invoke_target='CoreResumptionTask.updateTaskStatus';
+INSERT INTO `sys_job` ( `job_name`, `job_group`, `invoke_target`, `cron_expression`, `misfire_policy`, `concurrent`, `status`, `create_by`, `create_time`, `update_by`, `update_time`) VALUES ( '每天更新履职任务状态', 'DEFAULT', 'CoreResumptionTask.updateTaskStatus', '0 0 1 * * ?', '1', '0', '0', 'jwx', '2023-09-27 17:50:48', '', NULL);

+ 24 - 0
project_data/sql/0.0.2/soc/soc.sql

@@ -133,6 +133,12 @@ BEGIN
         ALTER TABLE `sync_fjnx_org_business_relation`
             ADD COLUMN `tree_show_parent_code` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '机构树上显示的父级编码' AFTER `business_parent_code`;
     END IF;
+ IF  EXISTS( SELECT *
+      FROM INFORMATION_SCHEMA.COLUMNS
+      WHERE TABLE_NAME = 'core_protection'
+      AND COLUMN_NAME = 'device_id') THEN
+ALTER TABLE core_protection MODIFY device_id bigint
+END IF;
 
     IF NOT EXISTS(SELECT *
                   FROM information_schema.columns
@@ -1403,6 +1409,24 @@ VALUES (01706854338376241153, '提交', 1706854057534033922, 1, NULL, NULL, NULL
 
 -- 处理自增id步长问题
 alter table core_drill_dictionary auto_increment = 10000;
+
+
+UPDATE `sys_dict_data` SET  `dict_label` = '未上报' WHERE `dict_type` = 'protection_status' and `dict_value` = '2';
+UPDATE `sys_dict_data` SET `dict_sort` = 900 WHERE `dict_value` = '1' and `dict_type` = 'sys_org_type';
+UPDATE `sys_dict_data` SET `dict_sort` = 800 WHERE `dict_value` = '2' and `dict_type` = 'sys_org_type';
+UPDATE `sys_dict_data` SET `dict_sort` = 200 WHERE `dict_value` = '3' and `dict_type` = 'sys_org_type';
+UPDATE `sys_dict_data` SET `dict_sort` = 100 WHERE `dict_value` = '4' and `dict_type` = 'sys_org_type';
+UPDATE `sys_dict_data` SET `dict_sort` = 300 WHERE `dict_value` = '5' and `dict_type` = 'sys_org_type';
+UPDATE `sys_dict_data` SET `dict_sort` = 600 WHERE `dict_value` = '6' and `dict_type` = 'sys_org_type';
+UPDATE `sys_dict_data` SET `dict_sort` = 700 WHERE `dict_value` = '10' and `dict_type` = 'sys_org_type';
+UPDATE `sys_dict_data` SET `dict_sort` = 500 WHERE `dict_value` = '8' and `dict_type` = 'sys_org_type';
+UPDATE `sys_dict_data` SET `dict_sort` = 400 WHERE `dict_value` = '7' and `dict_type` = 'sys_org_type';
+UPDATE `sys_dict_data` SET `dict_sort` = 1000 WHERE `dict_value` = '9' and `dict_type` = 'sys_org_type';
+alter table core_drill_dictionary auto_increment = 10000;
 -- 用户导出管理人员
 delete from `sys_menu` where `menu_name` ='用户导出管理人员';
 INSERT INTO `sys_menu`(`id`, `menu_name`, `parent_id`, `order_num`, `path`, `component`, `query`, `is_frame`, `is_cache`, `menu_type`, `visible`, `status`, `perms`, `platform_type`, `icon`, `image_path`, `create_by`, `create_time`, `update_by`, `update_time`, `remark`) VALUES (00000000000000002358, '用户导出管理人员', 100, 9, '', NULL, NULL, 1, 0, 'F', '0', '0', 'system:user:exportManager', '1', NULL, NULL, '演示安全检查', '2023-09-27 16:10:58', '', NULL, '');
+
+ALTER TABLE `core_protection` 
+MODIFY COLUMN `device_id` bigint NULL DEFAULT NULL COMMENT '设备ID' AFTER `id`,
+MODIFY COLUMN `alarm_host_code` bigint NULL DEFAULT NULL COMMENT '报警主机唯一标识' AFTER `org_name`;

+ 21 - 0
soc-api/soc-api-system/src/main/java/com/xunmei/system/api/RemoteProtectionService.java

@@ -0,0 +1,21 @@
+package com.xunmei.system.api;
+
+import com.xunmei.common.core.constant.ServiceNameConstants;
+import com.xunmei.common.core.web.domain.AjaxResult;
+import com.xunmei.system.api.dto.ProtectionDTO;
+import com.xunmei.system.api.factory.RemoteOrgFallbackFactory;
+import com.xunmei.system.api.factory.RemoteProtectionFallbackFactory;
+import org.springframework.cloud.openfeign.FeignClient;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+
+/**
+ * @author :LuoWei
+ * @date : 2023/9/27
+ */
+
+@FeignClient(contextId = "remoteProtectionService", value = ServiceNameConstants.CORE_SERVICE, fallbackFactory = RemoteProtectionFallbackFactory.class)
+public interface RemoteProtectionService {
+    @PostMapping("/resumption/protection/addByDevice")
+    public AjaxResult addByDevice(@RequestBody ProtectionDTO editDto);
+}

+ 4 - 3
soc-api/soc-api-system/src/main/java/com/xunmei/system/api/domain/SysUser.java

@@ -244,16 +244,17 @@ public class SysUser extends BaseEntity {
 
 
     @TableField(exist = false)
-    private String  roleNames;
+    private String roleNames;
 
     @TableField(exist = false)
     private Long[] roleIds;
 
     @TableField(exist = false)
     private List<SysRole> roles;
-
     @TableField(exist = false)
-    private Integer  orgType;
+    private Boolean onlyManager;
+    @TableField(exist = false)
+    private Integer orgType;
 
     public boolean isAdmin() {
         return isAdmin(this.getId());

+ 32 - 0
soc-api/soc-api-system/src/main/java/com/xunmei/system/api/dto/ProtectionDTO.java

@@ -0,0 +1,32 @@
+package com.xunmei.system.api.dto;
+
+import lombok.Data;
+
+/**
+ * @author :LuoWei
+ * @date : 2023/9/27
+ */
+@Data
+public class ProtectionDTO {
+    Long id;
+
+    /**
+     * 所属机构
+     */
+    Long orgId;
+
+    String orgPath;
+
+    String orgName;
+
+    /**
+     * 防区名称
+     */
+    String name;
+
+    /**
+     * 是否24小时防区
+     */
+    Integer allHour;
+    private Long deviceId;
+}

+ 30 - 0
soc-api/soc-api-system/src/main/java/com/xunmei/system/api/factory/RemoteProtectionFallbackFactory.java

@@ -0,0 +1,30 @@
+package com.xunmei.system.api.factory;
+
+import com.xunmei.common.core.web.domain.AjaxResult;
+import com.xunmei.system.api.RemoteOrgService;
+import com.xunmei.system.api.RemoteProtectionService;
+import com.xunmei.system.api.dto.ProtectionDTO;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.cloud.openfeign.FallbackFactory;
+import org.springframework.stereotype.Component;
+
+/**
+ * @author :LuoWei
+ * @date : 2023/9/27
+ */
+@Component
+public class RemoteProtectionFallbackFactory implements FallbackFactory<RemoteProtectionService> {
+    private static final Logger log = LoggerFactory.getLogger(RemoteProtectionFallbackFactory.class);
+    @Override
+    public RemoteProtectionService create(Throwable cause) {
+        log.error("机构服务调用失败:{}", cause.getMessage());
+        return new RemoteProtectionService(){
+
+            @Override
+            public AjaxResult addByDevice(ProtectionDTO editDto) {
+                return null;
+            }
+        };
+    }
+}

+ 2 - 1
soc-modules/soc-modules-core/src/main/java/com/xunmei/core/edu/service/impl/CoreEduTrainingPlanServiceImpl.java

@@ -242,8 +242,9 @@ public class CoreEduTrainingPlanServiceImpl extends ServiceImpl<CoreEduTrainingP
         plan.setFileList(ObjectUtil.isNotEmpty(request.getFileList()) ? JSON.toJSONString(request.getFileList()) : null);
         plan.setUpdateBy(SecurityUtils.getLoginUser().getSysUser().getId().toString());
         coreEduTrainingPlanToRoleMapper.deleteByMap(MapUtil.of("plan_id", plan.getId()));
-        coreEduTrainingPlanToExecOrgMapper.deleteByMap(MapUtil.of("plan_id", plan.getId()));
         List<CoreEduTrainingPlanToRole> trainingPlanToRoleList = batchSavePlanToRole(request.getPlanRoleId(), plan.getId());
+        coreEduTrainingPlanToExecOrgMapper.deleteByMap(MapUtil.of("plan_id", plan.getId()));
+        batchSavePlanToExecOrg(request.getPlanExecOrgIdList(), plan.getId());
         final int i = coreEduTrainingPlanMapper.updateById(plan);
         if (plan.getStandard() == 1) {
             //如果标准计划可以修改,那么需要删除所有计划与任务,重新创建计划任务

+ 13 - 6
soc-modules/soc-modules-core/src/main/java/com/xunmei/core/edu/service/impl/CoreEduTrainingTaskServiceImpl.java

@@ -93,6 +93,10 @@ public class CoreEduTrainingTaskServiceImpl extends ServiceImpl<CoreEduTrainingT
     @Autowired
     private CoreEduTrainingPlanMapper coreEduTrainingPlanMapper;
 
+    @Autowired
+    private CoreEduTrainingTaskToUserMapper coreEduTrainingTaskToUserMapper;
+
+
 
     @Override
     public TableDataInfo<CoreEduTrainingTaskPageVo> selectPage(CoreEduTrainingTaskPageDto request) {
@@ -235,13 +239,16 @@ public class CoreEduTrainingTaskServiceImpl extends ServiceImpl<CoreEduTrainingT
         } else {
             coreEduTrainingTask.setHostId(SecurityUtils.getUserId());
         }
-        List<CoreEduTrainingTaskToUser> taskUserList;
-        if (ObjectUtil.isNotEmpty(request.getTaskUserList())) {
-            taskUserList = request.getTaskUserList();
-        } else {
-            taskUserList = Stream.of(request.getAbsenceList(), request.getAbsentList()).flatMap(Collection::stream).collect(Collectors.toList());
-        }
 
+
+//        if (ObjectUtil.isNotEmpty(request.getTaskUserList())) {
+//            taskUserList = request.getTaskUserList();
+//        }
+//        else {
+//            taskUserList = Stream.of(request.getAbsenceList(), request.getAbsentList()).flatMap(Collection::stream).collect(Collectors.toList());
+//        }
+        coreEduTrainingTaskToUserMapper.deleteByMap(MapUtil.of("edu_training_task_id", request.getId()));
+        List<CoreEduTrainingTaskToUser> taskUserList=request.getTaskUserList();
         if (ObjectUtil.isNotEmpty(taskUserList)) {
             checkTheSameUser(taskUserList);
             for (CoreEduTrainingTaskToUser taskToUser : taskUserList) {

+ 2 - 2
soc-modules/soc-modules-core/src/main/java/com/xunmei/core/resumption/controller/AppRuleController.java

@@ -62,7 +62,7 @@ public class AppRuleController  extends BaseController {
         return success(appRuleService.edit(appRuleEditDto));
     }
 
-    @ApiOperation(value = "删除规范")
+    @ApiOperation(value = "删除定义")
     @RequiresPermissions("resumption:rule:remove")
     @DeleteMapping("{id}")
 
@@ -71,7 +71,7 @@ public class AppRuleController  extends BaseController {
         return success();
     }
 
-    @ApiOperation(value = "查询机构可用的规范")
+    @ApiOperation(value = "查询机构可用的定义")
     @GetMapping("ruleListForOrg")
 //    @RequiresPermissions(value={"resumption:rule"})
     public AjaxResult  ruleListForOrg(AppRuleListForOrgDto dto){

+ 9 - 1
soc-modules/soc-modules-core/src/main/java/com/xunmei/core/resumption/controller/ProtectionController.java

@@ -1,20 +1,24 @@
 package com.xunmei.core.resumption.controller;
 
+import com.xunmei.common.core.vo.IdNameVo;
 import com.xunmei.common.core.web.controller.BaseController;
 import com.xunmei.common.core.web.domain.AjaxResult;
 import com.xunmei.common.core.web.page.TableDataInfo;
+import com.xunmei.common.security.annotation.InnerAuth;
 import com.xunmei.common.security.annotation.RequiresPermissions;
 import com.xunmei.core.resumption.domain.Protection;
 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.service.IProtectionService;
+import com.xunmei.system.api.Eto.RoleConditionEto;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.web.bind.annotation.*;
 
 import javax.annotation.Resource;
+import java.util.List;
 
 /**
  *
@@ -50,7 +54,11 @@ class ProtectionController extends BaseController {
     public AjaxResult edit(@RequestBody ProtectionEditDto editDto) {
         return success(protectionService.edit(editDto));
     }
-
+    @InnerAuth
+    @PostMapping("/addByDevice")
+    public AjaxResult addByDevice(@RequestBody ProtectionEditDto editDto) {
+        return success(protectionService.edit(editDto));
+    }
     @ApiOperation(value = "防区详情")
     @GetMapping("{id}")
     @RequiresPermissions({"device:protection:query"})

+ 2 - 2
soc-modules/soc-modules-core/src/main/java/com/xunmei/core/resumption/domain/Protection.java

@@ -30,7 +30,7 @@ public class Protection extends BaseEntity {
     /**
      * 设备
      */
-    private String deviceId;
+    private Long deviceId;
 
     /**
      * 防区的唯一标识
@@ -38,7 +38,7 @@ public class Protection extends BaseEntity {
     private String code;
 
 
-    private String alarmHostCode;
+    private Long alarmHostCode;
 
     /**
      * 防区的名称

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

@@ -33,6 +33,11 @@ public class ProtectionPageDto extends PageDto<ProtectionPageVo> {
      */
     private Date[] dateRange;
 
+    /**
+     * 最近几小时,优先于dateRange
+     */
+    private Integer hour;
+
     @JsonIgnore
     private Date startTime;
     @JsonIgnore

+ 1 - 1
soc-modules/soc-modules-core/src/main/java/com/xunmei/core/resumption/mapper/AppRulePointMapper.java

@@ -26,7 +26,7 @@ import java.util.Map;
 @Mapper
 public interface AppRulePointMapper extends BaseMapper<AppRulePoint> {
 
-    List<AppRulePointDetailDto> selectDataListByItemId(Long id);
+    List<AppRulePointDetailDto> selectDataListByItemId(@Param("itemId") Long itemId,@Param("pointName") String pointName);
 
 //    List<AppRulePointInfoDto> selectDataListByIdList(@Param("pointIds") List<Long> pointIds, @Param("planIdList") List<Long> planIdList);
 

+ 6 - 5
soc-modules/soc-modules-core/src/main/java/com/xunmei/core/resumption/service/impl/AppRuleItemServiceImpl.java

@@ -77,12 +77,12 @@ public class AppRuleItemServiceImpl extends ServiceImpl<AppRuleItemMapper, AppRu
 
         Integer itemNameNums = appRuleItemMapper.checkItemNameRepeat(item.getId(), item.getRuleId(), item.getName());
         if (itemNameNums > 0) {
-            throw new RuntimeException("检查项名称重复");
+            throw new RuntimeException("履职项重复");
         }
 
         final AppRule appRule = appRuleMapper.selectById(appRuleItemDto.getRuleId());
         if (appRule == null) {
-            throw new RuntimeException("请选择具体规范新增数据!");
+            throw new RuntimeException("履职内容库定义不存在");
         }
 
         saveOrUpdate(item);
@@ -105,7 +105,7 @@ public class AppRuleItemServiceImpl extends ServiceImpl<AppRuleItemMapper, AppRu
                     if (isUsed == null) {
                         appRulePointMapper.deleteById(pointId);
                     } else {
-                        throw new RuntimeException("有要点已被使用,不能删除!");
+                        throw new RuntimeException("履职内容已被使用,不能删除!");
                     }
                 }
             }
@@ -149,7 +149,7 @@ public class AppRuleItemServiceImpl extends ServiceImpl<AppRuleItemMapper, AppRu
 //        int order = itemPageDto() * itemPageDto.getSize();
         for (AppRuleItemPageVo vo : page.getRecords()) {
 //            vo.setOrder(++order);
-            final List<AppRulePointDetailDto> pointList = appRulePointMapper.selectDataListByItemId(vo.getId());
+            final List<AppRulePointDetailDto> pointList = appRulePointMapper.selectDataListByItemId(vo.getId(),itemPageDto.getPointName());
             vo.setPointDtoList(pointList);
         }
 
@@ -165,7 +165,7 @@ public class AppRuleItemServiceImpl extends ServiceImpl<AppRuleItemMapper, AppRu
         AppRuleItemDetailDto appRuleItemDto = new AppRuleItemDetailDto();
         BeanUtils.copyProperties(appRuleItem, appRuleItemDto);
 
-        List<AppRulePointDetailDto> list = appRulePointMapper.selectDataListByItemId(id);
+        List<AppRulePointDetailDto> list = appRulePointMapper.selectDataListByItemId(id,null);
         appRuleItemDto.setPointDtoList(list);
         return appRuleItemDto;
     }
@@ -228,6 +228,7 @@ public class AppRuleItemServiceImpl extends ServiceImpl<AppRuleItemMapper, AppRu
         List<RuleTreeItem> ruleItems = allRule.stream().filter(r -> ObjectUtil.equal(r.getOrgId(), parent.getId()))
                 .map(o -> RuleTreeItem.builder()
                         .isRule(1)
+                        .ruleStatus(o.getStatus())
                         .id(o.getId())
                         .sort(-1)
                         .name(o.getName())

+ 15 - 1
soc-modules/soc-modules-core/src/main/java/com/xunmei/core/resumption/service/impl/AppRuleServiceImpl.java

@@ -7,15 +7,18 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.xunmei.common.core.constant.SecurityConstants;
+import com.xunmei.common.core.exception.ServiceException;
 import com.xunmei.common.core.vo.IdNameVo;
 import com.xunmei.common.core.web.page.TableDataInfo;
 import com.xunmei.common.security.utils.SecurityUtils;
 import com.xunmei.core.ServiceImplBase;
 import com.xunmei.core.resumption.domain.AppRule;
+import com.xunmei.core.resumption.domain.AppRuleItem;
 import com.xunmei.core.resumption.dto.rule.AppRuleListForOrgDto;
 import com.xunmei.core.resumption.dto.rule.AppRulePageDto;
 import com.xunmei.core.resumption.mapper.AppRuleMapper;
 import com.xunmei.core.resumption.dto.rule.AppRuleEditDto;
+import com.xunmei.core.resumption.service.IAppRuleItemService;
 import com.xunmei.core.resumption.service.IAppRuleService;
 import com.xunmei.core.resumption.vo.appRule.AppRuleInfoVo;
 import com.xunmei.core.resumption.vo.appRule.AppRulePageVo;
@@ -48,6 +51,9 @@ public class AppRuleServiceImpl extends ServiceImplBase<AppRuleMapper, AppRule>
     @Resource
     private AppRuleMapper appRuleMapper;
 
+    @Resource
+    private IAppRuleItemService appRuleItemService;
+
     @Override
     public TableDataInfo getAppRulePage(AppRulePageDto query) {
         Page<AppRulePageVo> page = query.getPageDto();
@@ -78,7 +84,7 @@ public class AppRuleServiceImpl extends ServiceImplBase<AppRuleMapper, AppRule>
         BeanUtils.copyProperties(appRuleEditDto, appRule);
         Integer nums = appRuleMapper.checkRuleNameRepeat(appRule.getId(), appRule.getName());
         if (nums > 0) {
-            throw new RuntimeException("规则名称重复");
+            throw new RuntimeException("履职内容库名称重复");
         }
 
         if (appRule.getId() == null) {
@@ -97,6 +103,14 @@ public class AppRuleServiceImpl extends ServiceImplBase<AppRuleMapper, AppRule>
     @Override
     @Transactional(rollbackFor = Exception.class)
     public void del(Long id) {
+        LambdaQueryWrapper<AppRuleItem> wrapper=  new LambdaQueryWrapper();
+        wrapper.eq(AppRuleItem::getRuleId,id)
+                .eq(AppRuleItem::getDeleted,0);
+        Long itemCount= appRuleItemService.count(wrapper);
+        if(itemCount>0){
+            throw new ServiceException("履职内容库存在履职项,请先删除履职项");
+        }
+
         appRuleMapper.deleteById(id);
     }
 

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

@@ -1,6 +1,7 @@
 package com.xunmei.core.resumption.service.impl;
 
 import cn.hutool.core.bean.BeanUtil;
+import cn.hutool.core.date.DateField;
 import cn.hutool.core.date.DateTime;
 import cn.hutool.core.date.DateUtil;
 import cn.hutool.core.util.ObjectUtil;
@@ -53,12 +54,20 @@ public class ProtectionServiceImpl extends ServiceImpl<ProtectionMapper, Protect
             request.setOrgId(SecurityUtils.getLoginUser().getOrgId());
         }
         Page<ProtectionPageVo> page = request.getPageDto();
-        if (ObjectUtil.isNotEmpty(request.getDateRange()) && request.getDateRange().length == 2) {
+        if(ObjectUtil.isNotNull(request.getHour())){
+            Date end=new Date();
+            Date start=DateUtil.offset(end, DateField.HOUR,-request.getHour());
+            request.setStartTime(start);
+            request.setEndTime(end);
+        }else  if (ObjectUtil.isNotEmpty(request.getDateRange()) && request.getDateRange().length == 2) {
             Date startTime = new DateTime(request.getDateRange()[0]).setTimeZone(TimeZone.getTimeZone("Asia/Shanghai"));
             Date endTime = new DateTime(request.getDateRange()[1]).setTimeZone(TimeZone.getTimeZone("Asia/Shanghai"));
             request.setStartTime(startTime);
             request.setEndTime(endTime);
         }
+
+
+
         //按规则分页
         page = this.baseMapper.pageList(page, request);
 
@@ -81,6 +90,7 @@ public class ProtectionServiceImpl extends ServiceImpl<ProtectionMapper, Protect
         LambdaQueryWrapper<Protection> repeatNameWrapper=new LambdaQueryWrapper<>();
         repeatNameWrapper.eq(Protection::getOrgId,dto.getOrgId())
                 .eq(Protection::getName,dto.getName())
+                .eq(Protection::getDeleted,0)
                 .ne(Protection::getId,ObjectUtil.isNull(dto.getId())?0:dto.getId());
 
         if(baseMapper.exists(repeatNameWrapper)){

+ 5 - 2
soc-modules/soc-modules-core/src/main/java/com/xunmei/core/resumption/service/impl/ResumptionRecordServiceImpl.java

@@ -346,13 +346,16 @@ public class ResumptionRecordServiceImpl extends ServiceImpl<ResumptionRecordMap
         Map<String, SysDictData> dicts = remoteDictDataService.selectDictByeType("resumption_status", SecurityConstants.INNER)
                 .stream().collect(Collectors.toMap(SysDictData::getDictValue, v -> v));
         List<ResumptionRecordPageVo> limit = data.stream().limit(10000).collect(Collectors.toList());
-        limit.forEach(r -> {
+        int index=1;
+        for (ResumptionRecordPageVo r : limit) {
+            r.setIndex(index++);
             if (dicts.containsKey(r.getStatus())) {
                 r.setStatusText(dicts.get(r.getStatus()).getDictLabel());
             } else {
                 r.setStatusText("未知");
             }
-        });
+        }
+
         response.setContentType("application/vnd.ms-excel");
 //        response.setCharacterEncoding("utf-8");
         // 调用EasyExcel的导出方法

+ 3 - 1
soc-modules/soc-modules-core/src/main/java/com/xunmei/core/resumption/task/ResumptionTaskBusiness.java

@@ -693,7 +693,9 @@ public class ResumptionTaskBusiness {
     public Boolean updateTaskStatus() {
         LambdaUpdateWrapper<Resumption> wrapper = new LambdaUpdateWrapper<Resumption>();
         Date date = DateUtil.beginOfDay(new Date());
-        wrapper.eq(Resumption::getStatus, 1).lt(Resumption::getPlanEndTime, date).set(Resumption::getStatus, 4);
+        wrapper.lt(Resumption::getPlanEndTime, date)
+                .in(Resumption::getStatus, Arrays.asList(1,2))//未开始、进行中
+                .set(Resumption::getStatus, 4);
         return resumptionService.update(wrapper);
     }
 

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

@@ -21,8 +21,10 @@ public class RuleTreeItem {
      String name;
 
      String shortName;
+
      int isRule;
 
+     String ruleStatus;
      /**
       * 履职机构类型
       */

+ 19 - 14
soc-modules/soc-modules-core/src/main/java/com/xunmei/core/resumption/vo/resumptionRecord/ResumptionRecordPageVo.java

@@ -19,6 +19,11 @@ import java.util.Date;
  */
 @Data
 public class ResumptionRecordPageVo {
+    @ExcelProperty(value = "序号",index = 0)
+    @ColumnWidth(10)
+    @JsonIgnore
+    private int index;
+
     @ApiModelProperty("履职任务id")
     @ExcelIgnore
     private String resumptionId;
@@ -26,7 +31,7 @@ public class ResumptionRecordPageVo {
     /**
      * 任务名称
      */
-    @ExcelProperty("任务名称")
+    @ExcelProperty(value = "任务名称",index = 1)
     @ColumnWidth(30)
     private String name;
 
@@ -36,13 +41,13 @@ public class ResumptionRecordPageVo {
 
     @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
     @ApiModelProperty("任务开始时间")
-    @ExcelProperty("任务开始时间")
+    @ExcelProperty(value ="任务开始时间",index=5)
     @ColumnWidth(30)
     private Date planStartTime;
 
     @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
-    @ApiModelProperty("任务结束时间")
-    @ExcelProperty("任务结束时间")
+    @ApiModelProperty(value ="任务结束时间")
+    @ExcelProperty(value ="截止时间",index = 6)
     @ColumnWidth(30)
     private Date planEndTime;
 
@@ -53,12 +58,11 @@ public class ResumptionRecordPageVo {
     private Long orgId;
 
     @ApiModelProperty("上级机构")
-    @ExcelProperty("上级机构")
-    @ColumnWidth(20)
+    @ExcelIgnore
     private String parentOrgName;
 
     @ApiModelProperty("机构名称")
-    @ExcelProperty("履职机构")
+    @ExcelProperty(value="履职机构",index = 2)
     @ColumnWidth(20)
     private String orgName;
 
@@ -67,32 +71,33 @@ public class ResumptionRecordPageVo {
     private Long roleId;
 
     @ApiModelProperty("履职角色")
-    @ExcelProperty("履职角色")
+    @ExcelProperty(value="履职角色",index = 3)
     @ColumnWidth(20)
     private String roleName;
 
     @ApiModelProperty("提交人")
-    @ExcelProperty("提交人")
+    @ExcelProperty(value = "提交人",index = 7)
     @ColumnWidth(15)
     private String submitter;
 
     @ApiModelProperty("提交时间")
     @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
-    @ExcelProperty("提交时间")
+    @ExcelProperty(value = "提交时间",index = 8)
     @ColumnWidth(20)
     private Date submitTime;
 
-    @ApiModelProperty("异常要点数量")
-    @ExcelProperty("异常个数")
+    @ApiModelProperty("隐患问题数")
+    @ExcelProperty(value = "隐患问题数",index = 9)
     @ColumnWidth(15)
-    private int abnormalDataNums;
+    private Integer abnormalDataNums;
 
     //    @ApiModelProperty("状态 0:待履职 1:按时完成 3:未完成 5:补登完成")
     @ExcelIgnore
     private String status;
 
     @JsonIgnore
-    @ExcelProperty("履职状态")
+    @ExcelProperty(value = "履职进度",index = 4)
+    @ColumnWidth(15)
     private String statusText;
 
     /**

+ 1 - 1
soc-modules/soc-modules-core/src/main/java/com/xunmei/core/safetyCheck/mapper/SafetyCheckRulePointMapper.java

@@ -31,7 +31,7 @@ import java.util.Map;
 @Mapper
 public interface SafetyCheckRulePointMapper extends BaseMapper<SafetyCheckRulePoint> {
 
-    List<SafetyCheckRulePointDetailDto> selectDataListByItemId(Long id);
+    List<SafetyCheckRulePointDetailDto> selectDataListByItemId(@Param("itemId") Long itemId,@Param("pointName") String pointName);
 
 //    List<AppRulePointInfoDto> selectDataListByIdList(@Param("pointIds") List<Long> pointIds, @Param("planIdList") List<Long> planIdList);
 

+ 10 - 9
soc-modules/soc-modules-core/src/main/java/com/xunmei/core/safetyCheck/service/impl/SafetyCheckRuleItemServiceImpl.java

@@ -77,22 +77,22 @@ public class SafetyCheckRuleItemServiceImpl
 //            throw new RuntimeException("检查项编号重复");
 //        }
 
+        final SafetyCheckRule rule = safetyCheckRuleMapper.selectById(ruleItemDto.getRuleId());
+        if (rule == null) {
+            throw new RuntimeException("检查内容库不存在!");
+        }
+
         Integer itemNameNums = safetyCheckRuleItemMapper.checkItemNameRepeat(item.getId(), item.getRuleId(), item.getName());
         if (itemNameNums > 0) {
             throw new RuntimeException("检查项名称重复");
         }
 
-        final SafetyCheckRule rule = safetyCheckRuleMapper.selectById(ruleItemDto.getRuleId());
-        if (rule == null) {
-            throw new RuntimeException("请选择具体规范新增数据!");
-        }
-
         saveOrUpdate(item);
         final List<SafetyCheckRulePointDto> pointDtoList = ruleItemDto.getPointDtoList();
         Set<String> hashMap = new HashSet<>();
         for (SafetyCheckRulePointDto appRulePointDto : pointDtoList) {
             if (hashMap.contains(appRulePointDto.getName())) {
-                throw new RuntimeException("履职内容重复!");
+                throw new RuntimeException("检查内容重复!");
             }
             hashMap.add(appRulePointDto.getName());
         }
@@ -107,7 +107,7 @@ public class SafetyCheckRuleItemServiceImpl
                     if (isUsed == null) {
                         safetyCheckRulePointMapper.deleteById(pointId);
                     } else {
-                        throw new RuntimeException("有要点已被使用,不能删除!");
+                        throw new RuntimeException("检查内容已被使用,不能删除!");
                     }
                 }
             }
@@ -151,7 +151,7 @@ public class SafetyCheckRuleItemServiceImpl
 //        int order = itemPageDto() * itemPageDto.getSize();
         for (SafetyCheckRuleItemPageVo vo : page.getRecords()) {
 //            vo.setOrder(++order);
-            final List<SafetyCheckRulePointDetailDto> pointList = safetyCheckRulePointMapper.selectDataListByItemId(vo.getId());
+            final List<SafetyCheckRulePointDetailDto> pointList = safetyCheckRulePointMapper.selectDataListByItemId(vo.getId(),itemPageDto.getPointName());
             vo.setPointDtoList(pointList);
         }
 
@@ -167,7 +167,7 @@ public class SafetyCheckRuleItemServiceImpl
         SafetyCheckRuleItemDetailDto appRuleItemDto = new SafetyCheckRuleItemDetailDto();
         BeanUtils.copyProperties(appRuleItem, appRuleItemDto);
 
-        List<SafetyCheckRulePointDetailDto> list = safetyCheckRulePointMapper.selectDataListByItemId(id);
+        List<SafetyCheckRulePointDetailDto> list = safetyCheckRulePointMapper.selectDataListByItemId(id,null);
         appRuleItemDto.setPointDtoList(list);
         return appRuleItemDto;
     }
@@ -228,6 +228,7 @@ public class SafetyCheckRuleItemServiceImpl
         List<RuleTreeItem> ruleItems = allRule.stream().filter(r -> ObjectUtil.equal(r.getOrgId(), parent.getId()))
                 .map(o -> RuleTreeItem.builder()
                         .isRule(1)
+                        .ruleStatus(o.getStatus())
                         .id(o.getId())
                         .name(o.getName())
                         .shortName(o.getName())

+ 15 - 1
soc-modules/soc-modules-core/src/main/java/com/xunmei/core/safetyCheck/service/impl/SafetyCheckRuleServiceImpl.java

@@ -6,17 +6,21 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.xunmei.common.core.exception.ServiceException;
 import com.xunmei.common.core.utils.IDHelper;
 import com.xunmei.common.core.vo.IdNameVo;
 import com.xunmei.common.core.web.page.TableDataInfo;
 import com.xunmei.common.security.utils.SecurityUtils;
 import com.xunmei.core.ServiceImplBase;
+import com.xunmei.core.resumption.domain.AppRuleItem;
 import com.xunmei.core.resumption.vo.appRuleItem.RuleTreeItem;
 import com.xunmei.core.safetyCheck.domain.SafetyCheckRule;
+import com.xunmei.core.safetyCheck.domain.SafetyCheckRuleItem;
 import com.xunmei.core.safetyCheck.dto.rule.SafetyCheckRuleEditDto;
 import com.xunmei.core.safetyCheck.dto.rule.SafetyCheckRuleListForOrgDto;
 import com.xunmei.core.safetyCheck.dto.rule.SafetyCheckRulePageDto;
 import com.xunmei.core.safetyCheck.mapper.SafetyCheckRuleMapper;
+import com.xunmei.core.safetyCheck.service.ISafetyCheckRuleItemService;
 import com.xunmei.core.safetyCheck.service.ISafetyCheckRuleService;
 import com.xunmei.core.safetyCheck.vo.rule.SafetyCheckRuleInfoVo;
 import com.xunmei.core.safetyCheck.vo.rule.SafetyCheckRulePageVo;
@@ -52,6 +56,8 @@ public class SafetyCheckRuleServiceImpl extends ServiceImplBase<SafetyCheckRuleM
     @Resource
     RemoteOrgService remoteOrgService;
 
+    @Resource
+    ISafetyCheckRuleItemService safetyCheckRuleItemService;
     @Override
     public TableDataInfo getRulePage(SafetyCheckRulePageDto query) {
         Page<SafetyCheckRulePageVo> page = query.getPageDto();
@@ -81,7 +87,7 @@ public class SafetyCheckRuleServiceImpl extends ServiceImplBase<SafetyCheckRuleM
         BeanUtils.copyProperties(appRuleEditDto, appRule);
         Integer nums = safetyCheckRuleMapper.checkRuleNameRepeat(appRule.getId(), appRule.getName());
         if (nums > 0) {
-            throw new RuntimeException("规则名称重复");
+            throw new RuntimeException("检查内容库名称重复");
         }
 
         if (appRule.getId() == null) {
@@ -100,6 +106,14 @@ public class SafetyCheckRuleServiceImpl extends ServiceImplBase<SafetyCheckRuleM
     @Override
     @Transactional(rollbackFor = Exception.class)
     public void del(Long id) {
+        LambdaQueryWrapper<SafetyCheckRuleItem> wrapper=  new LambdaQueryWrapper();
+        wrapper.eq(SafetyCheckRuleItem::getRuleId,id)
+                .eq(SafetyCheckRuleItem::getDeleted,0);
+
+        Long itemCount= safetyCheckRuleItemService.count(wrapper);
+        if(itemCount>0){
+            throw new ServiceException("检查内容库存在检查项,请先删除检查项");
+        }
         safetyCheckRuleMapper.deleteById(id);
     }
 

+ 1 - 1
soc-modules/soc-modules-core/src/main/resources/mapper/resumption/AppRuleItemMapper.xml

@@ -45,7 +45,7 @@
 <!--    </select>-->
 
     <select id="checkItemNameRepeat" resultType="java.lang.Integer">
-        select count(id) from core_resumption_rule_item where rule_id=#{ruleId} and name=#{itemName}
+        select count(id) from core_resumption_rule_item where rule_id=#{ruleId} and name=#{itemName} and deleted=0
         <if test="id != null">
             and id != #{id}
         </if>

+ 1 - 1
soc-modules/soc-modules-core/src/main/resources/mapper/resumption/AppRuleMapper.xml

@@ -67,7 +67,7 @@
     <!--    </select>-->
 
     <select id="checkRuleNameRepeat" resultType="java.lang.Integer">
-        select count(id) from core_resumption_rule where name=#{name}
+        select count(id) from core_resumption_rule where name=#{name} and deleted=0
         <if test="id != null">
             and id != #{id}
         </if>

+ 4 - 1
soc-modules/soc-modules-core/src/main/resources/mapper/resumption/AppRulePointMapper.xml

@@ -5,8 +5,11 @@
         select p.*,a.name as areaName
         from core_resumption_rule_point p
         left join sys_area a on p.area_id = a.id
-        where item_id = #{id}
+        where item_id = #{itemId}
           and p.deleted = 0
+        <if test="pointName!=null and pointName!=''">
+            and p.name like concat('%',#{pointName},'%')
+        </if>
     </select>
 <!--    <select id="selectDataListByIdList" resultType="com.xunmei.core.resumption.dto.rulePoint.AppRulePointInfoDto"-->
 <!--            parameterType="java.util.List">-->

+ 1 - 1
soc-modules/soc-modules-core/src/main/resources/mapper/safetycheck/SafetyCheckRuleItemMapper.xml

@@ -23,7 +23,7 @@
     </select>
 
     <select id="checkItemNameRepeat" resultType="java.lang.Integer">
-        select count(id) from core_safetycheck_rule_item where rule_id=#{ruleId} and name=#{itemName}
+        select count(id) from core_safetycheck_rule_item where rule_id=#{ruleId} and name=#{itemName} and deleted=0
         <if test="id != null">
             and id != #{id}
         </if>

+ 1 - 1
soc-modules/soc-modules-core/src/main/resources/mapper/safetycheck/SafetyCheckRuleMapper.xml

@@ -54,7 +54,7 @@
 
 
     <select id="checkRuleNameRepeat" resultType="java.lang.Integer">
-        select count(id) from core_safetycheck_rule where name=#{name}
+        select count(id) from core_safetycheck_rule where name=#{name} and deleted=0
         <if test="id != null">
             and id != #{id}
         </if>

+ 5 - 2
soc-modules/soc-modules-core/src/main/resources/mapper/safetycheck/SafetyCheckRulePointMapper.xml

@@ -5,8 +5,11 @@
         select p.*,a.name as areaName
         from core_safetycheck_rule_point p
         left join sys_area a on p.area_id = a.id
-        where item_id = #{id}
-          and p.deleted = 0
+        where item_id = #{itemId}
+        and p.deleted = 0
+        <if test="pointName!=null and pointName!=''">
+            and p.name like concat('%',#{pointName},'%')
+        </if>
     </select>
 <!--    <select id="findPointByPlan" parameterType="Long" resultType="com.xunmei.core.safetyCheck.vo.ruleItem.SafetyCheckRulePointTaskVo">-->
 <!--        SELECT a.*, b.point_scan-->

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

@@ -85,6 +85,7 @@ public class SysUserController extends BaseController {
     public AjaxResult list(SysUser user) {
         AjaxResult ajax = AjaxResult.success();
         com.xunmei.common.core.web.page.TableDataInfo<com.xunmei.system.api.domain.SysUser> sysUserTableDataInfo = userService.selectUserList(user);
+
         ajax.put("data", sysUserTableDataInfo);
         boolean admin = false;
         String s = roleService.selectRoleNameByUserId(SecurityUtils.getUserId());

+ 23 - 3
soc-modules/soc-modules-system/src/main/java/com/xunmei/system/service/impl/SysDeviceServiceImpl.java

@@ -7,8 +7,10 @@ import com.alibaba.nacos.common.utils.CollectionUtils;
 import com.xunmei.common.core.exception.ServiceException;
 import com.xunmei.common.core.utils.DateUtils;
 import com.xunmei.common.security.utils.SecurityUtils;
+import com.xunmei.system.api.RemoteProtectionService;
 import com.xunmei.system.api.domain.SysDevice;
 import com.xunmei.system.api.domain.SysOrg;
+import com.xunmei.system.api.dto.ProtectionDTO;
 import com.xunmei.system.mapper.SysOrgMapper;
 import com.xunmei.system.vo.area.AccessType;
 import com.xunmei.system.vo.area.HostVO;
@@ -42,7 +44,8 @@ public class SysDeviceServiceImpl extends ServiceImpl<SysDeviceMapper, SysDevice
     private ISysOrgService orgService;
     @Autowired
     private SysOrgMapper sysOrgMapper;
-
+    @Autowired
+  private RemoteProtectionService remoteProtectionService;
     @Override
     public TableDataInfo<SysDevice> selectPage(SysDevice sysDevice) {
         //未删除
@@ -131,7 +134,7 @@ public class SysDeviceServiceImpl extends ServiceImpl<SysDeviceMapper, SysDevice
                 sysDevices.forEach(s -> {
                     VideoVO videoVO = new VideoVO();
                     videoVO.setVideoId(s.getId());
-                    videoVO.setVideoName("通道"+s.getChannel());
+                    videoVO.setVideoName(s.getDeviceName());
                     List<AccessType> accessByVideo = sysDeviceMapper.getAccessByVideo(s.getId(), taskId);
                     if (accessByVideo.size()>0) {
                         for (AccessType a:accessByVideo){
@@ -191,7 +194,17 @@ public class SysDeviceServiceImpl extends ServiceImpl<SysDeviceMapper, SysDevice
         sysDevice.setCreateBy(SecurityUtils.getUsername());
         SysOrg sysOrg = orgService.selectSysOrgById(sysDevice.getOrgId());
         sysDevice.setOrgName(sysOrg.getShortName());
-        return sysDeviceMapper.insert(sysDevice);
+        int insert = sysDeviceMapper.insert(sysDevice);
+        //新增防区只有报警主机
+        if (sysDevice.getDeviceType().equals("1")){
+            ProtectionDTO protectionDTO=new ProtectionDTO();
+            protectionDTO.setName(sysDevice.getDeviceName());
+            protectionDTO.setOrgPath(sysOrg.getPath());
+            protectionDTO.setAllHour(0);
+            protectionDTO.setDeviceId(sysDevice.getId());
+            remoteProtectionService.addByDevice(protectionDTO);
+        }
+        return insert;
     }
 
     /**
@@ -206,6 +219,13 @@ public class SysDeviceServiceImpl extends ServiceImpl<SysDeviceMapper, SysDevice
         sysDevice.setUpdateBy(SecurityUtils.getUsername());
         SysOrg sysOrg = orgService.selectSysOrgById(sysDevice.getOrgId());
         sysDevice.setOrgName(sysOrg.getShortName());
+        if (sysDevice.getDeviceType().equals("1")){
+            ProtectionDTO protectionDTO=new ProtectionDTO();
+            protectionDTO.setId(sysDevice.getId());
+            protectionDTO.setName(sysDevice.getDeviceName());
+            protectionDTO.setOrgPath(sysOrg.getPath());
+            remoteProtectionService.addByDevice(protectionDTO);
+        }
         return sysDeviceMapper.updateById(sysDevice);
     }
 

+ 3 - 0
soc-modules/soc-modules-system/src/main/resources/mapper/system/SysUserMapper.xml

@@ -490,6 +490,9 @@
         <if test="info.roleId != null and info.roleId != ''">
             AND t.roleIds like concat("%,",#{info.roleId},",%")
         </if>
+        <if test="info.onlyManager ==true">
+            AND t.is_manager is not null
+        </if>
         ORDER BY t.org_id DESC
     </select>
     <select id="selectrolesByOrgId" resultType="com.xunmei.system.api.domain.SysRole">