Procházet zdrojové kódy

Merge branch 'v1.0.0' of http://39.106.8.246:3003/apm/energy-alarm-service into v1.0.0

lixing před 3 roky
rodič
revize
e8a2f6cce0

+ 7 - 5
src/main/java/com/persagy/apm/alarmservice/project/alarmrule/controller/ProjectAlarmRuleController.java

@@ -3,6 +3,7 @@ package com.persagy.apm.alarmservice.project.alarmrule.controller;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.persagy.apm.alarmservice.group.alarmrule.dao.GroupAlarmRuleMapper;
 import com.persagy.apm.alarmservice.group.alarmrule.model.vo.GroupAlarmRuleListItemVO;
+import com.persagy.apm.alarmservice.group.monitorindicator.model.MonitorIndicator;
 import com.persagy.apm.alarmservice.project.alarmrule.dao.ProjectAlarmRuleMapper;
 import com.persagy.apm.alarmservice.project.alarmrule.service.IProjectAlarmRuleService;
 
@@ -24,9 +25,8 @@ import org.springframework.web.bind.annotation.*;
 import springfox.documentation.annotations.ApiIgnore;
 
 import javax.validation.Valid;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Map;
+import java.text.Collator;
+import java.util.*;
 import java.util.stream.Collectors;
 
 /**
@@ -127,7 +127,7 @@ public class ProjectAlarmRuleController {
             if (StringUtils.isNotBlank(equipName)) {
                 for (ProjectAlarmRuleObjRel projectAlarmRuleObjRel : query) {
                     if (StringUtils.isNotBlank(projectAlarmRuleObjRel.getObjName())
-                            && projectAlarmRuleObjRel.getObjName().equals(equipName)
+                            && projectAlarmRuleObjRel.getObjName().contains(equipName)
                             && projectAlarmRuleObjRel.getOpen() == 1) {
                         projectAlarmRuleListItemVO.setRelListItemList(query);
                         result.add(projectAlarmRuleListItemVO);
@@ -138,7 +138,9 @@ public class ProjectAlarmRuleController {
                 result.add(projectAlarmRuleListItemVO);
             }
         }
-        List<ProjectAlarmRuleListItemVO> resultList = projectAlarmRuleService.pageBySubList(result, size, page);
+        List<ProjectAlarmRuleListItemVO> collect = result.stream().sorted(Comparator.comparing(ProjectAlarmRuleListItemVO::getAlarmItemName,
+                Collator.getInstance(Locale.CHINA))).collect(Collectors.toList());
+        List<ProjectAlarmRuleListItemVO> resultList = projectAlarmRuleService.pageBySubList(collect, size, page);
         return ResultHelper.multi(resultList, result.size());
     }
 }

+ 1 - 1
src/main/java/com/persagy/apm/alarmservice/project/alarmrule/service/impl/ProjectAlarmRuleServiceImpl.java

@@ -215,7 +215,7 @@ public class ProjectAlarmRuleServiceImpl extends ServiceImpl<ProjectAlarmRuleMap
             getGroupAlarmRuleDTO.setGroupId(updateProjectAlarmRuleDTO.getGroupId());
             getGroupAlarmRuleDTO.setAlarmItemCode(updateProjectAlarmRuleDTO.getAlarmItemCode());
             GroupAlarmRule groupAlarmRule = groupAlarmRuleService.getGroupAlarmRule(getGroupAlarmRuleDTO);
-            projectAlarmRule.setAlarmConditionId(groupAlarmRule.getId());
+            projectAlarmRule.setAlarmConditionId(groupAlarmRule.getAlarmConditionId());
         } else if (belongOld == 0 && belongNew == 0) {//项目自定义规则->项目自定义规则
             //修改自定义规则
             UpdateAlarmConditionDTO updateAlarmConditionDTO = new UpdateAlarmConditionDTO();

+ 3 - 1
src/main/java/com/persagy/apm/alarmservice/project/alarmruleobjrel/service/impl/ProjectAlarmRuleObjRelServiceImpl.java

@@ -366,7 +366,7 @@ public class ProjectAlarmRuleObjRelServiceImpl extends ServiceImpl<ProjectAlarmR
             QueryWrapper<ProjectAlarmRuleObjRel> queryWrapper = new QueryWrapper<>();
             queryWrapper.eq(ProjectAlarmRuleObjRel.PROP_PROJECT_ALARM_RULE_ID, queryRuleObjRelDTO.getProjectAlarmRuleId());
             queryWrapper.eq(ProjectAlarmRuleObjRel.PROP_VALID, ValidEnum.TRUE.getType());
-            queryWrapper.eq(ProjectAlarmRuleObjRel.PROP_OPEN, 1);
+//            queryWrapper.eq(ProjectAlarmRuleObjRel.PROP_OPEN, 1);
             List<ProjectAlarmRuleObjRel> list = list(queryWrapper);
             list.stream().map(ProjectAlarmRuleObjRel::getObjId).distinct().collect(Collectors.toList());
             resultList.addAll(list);
@@ -398,6 +398,8 @@ public class ProjectAlarmRuleObjRelServiceImpl extends ServiceImpl<ProjectAlarmR
                 ProjectAlarmRuleObjRel projectAlarmRuleObjRelVO = new ProjectAlarmRuleObjRel();
                 projectAlarmRuleObjRelVO.setObjId(record.getId());
                 projectAlarmRuleObjRelVO.setObjName(record.getLocalName());
+                projectAlarmRuleObjRelVO.setOpen(1);
+                projectAlarmRuleObjRelVO.setProjectId(projectId);
                 resultList.add(projectAlarmRuleObjRelVO);
             }
         }

+ 1 - 1
src/main/resources/mapper/ProjectAlarmRuleObjRelMapper.xml

@@ -29,7 +29,7 @@
         </foreach>
     </update>
     <delete id="deleteByProjectAlarmRuleId">
-        delete from project_alarm_rule_obj_rel where project_alarm_rule_id = #{id}
+        delete from project_alarm_rule_obj_rel where project_alarm_rule_id = #{id} and open = 1
     </delete>
 </mapper>