Browse Source

查询弹窗事件数量

develop
lau572 6 months ago
parent
commit
8321d64987
  1. 14
      zc-business/src/main/java/com/zc/business/controller/DcEventController.java
  2. 2
      zc-business/src/main/java/com/zc/business/mapper/DcEventMapper.java
  3. 2
      zc-business/src/main/java/com/zc/business/mapper/DcWarningMapper.java
  4. 10
      zc-business/src/main/java/com/zc/business/service/IDcEventService.java
  5. 29
      zc-business/src/main/java/com/zc/business/service/impl/DcEventServiceImpl.java
  6. 3
      zc-business/src/main/resources/mapper/business/DcEventMapper.xml
  7. 3
      zc-business/src/main/resources/mapper/business/DcWarningMapper.xml

14
zc-business/src/main/java/com/zc/business/controller/DcEventController.java

@ -227,4 +227,18 @@ public class DcEventController extends BaseController
public AjaxResult getLinkEvent(@ApiParam(name = "eventId", value = "事件id", required = true) @PathVariable("eventId") String eventId){
return dcEventService.getLinkEvent(eventId);
}
/**
* @Description 获取事件数量
*
* @author liuwenge
* @date 2024/6/6 18:45
* @param type
* @return com.ruoyi.common.core.domain.AjaxResult
*/
@ApiOperation("获取事件数量")
@GetMapping( "/getCountNum/{type}")
public AjaxResult getCountNum(@ApiParam(name = "type", value = "类型 1:告警 2:待确认 3:处置中", required = true) @PathVariable("type") String type){
return dcEventService.getCountNum(type);
}
}

2
zc-business/src/main/java/com/zc/business/mapper/DcEventMapper.java

@ -121,6 +121,8 @@ public interface DcEventMapper extends BaseMapper<DcEvent>
int selectClearInfo(String eventId);
List<DcEvent> dispatchRecordEventList(DcEvent dcEvent);
Long selectEventNumByStatus(@Param("status") String status);
}

2
zc-business/src/main/java/com/zc/business/mapper/DcWarningMapper.java

@ -150,4 +150,6 @@ public interface DcWarningMapper
public String organizationName(Long id);
//事件id查询调度记录id
public HashMap selectDispatchId(@Param("eventId")String eventId);
Long selectWarningNum();
}

10
zc-business/src/main/java/com/zc/business/service/IDcEventService.java

@ -139,4 +139,14 @@ public interface IDcEventService
AjaxResult getLinkEvent(String eventId);
List<DcEvent> dispatchRecordEventList(DcEvent dcEvent);
/**
* @Description 获取事件数量
*
* @author liuwenge
* @date 2024/6/6 18:45
* @param type 类型 1:告警 2:待确认 3:处置中
* @return com.ruoyi.common.core.domain.AjaxResult
*/
AjaxResult getCountNum(String type);
}

29
zc-business/src/main/java/com/zc/business/service/impl/DcEventServiceImpl.java

@ -1924,4 +1924,33 @@ public class DcEventServiceImpl extends ServiceImpl<DcEventMapper, DcEvent> impl
}
/**
* @Description 获取事件数量
*
* @author liuwenge
* @date 2024/6/6 18:45
* @param type 类型 1:告警 2:待确认 3:处置中
* @return com.ruoyi.common.core.domain.AjaxResult
*/
@Override
public AjaxResult getCountNum(String type){
if (StringUtils.isEmpty(type)){
return AjaxResult.error("类型不能为空");
}
Long num = 0L;
//告警
if (type.equals("1")){
num = dcWarningMapper.selectWarningNum();
} else if (type.equals("2")){
num = dcEventMapper.selectEventNumByStatus("0");
} else if (type.equals("3")){
num = dcEventMapper.selectEventNumByStatus("1");
}
return AjaxResult.success(num);
}
}

3
zc-business/src/main/resources/mapper/business/DcEventMapper.xml

@ -850,4 +850,7 @@
</otherwise>
</choose>
</select>
<select id="selectEventNumByStatus" resultType="java.lang.Long">
select count(*) from dc_event where event_state = #{status}
</select>
</mapper>

3
zc-business/src/main/resources/mapper/business/DcWarningMapper.xml

@ -433,5 +433,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="selectDispatchId" resultType="java.util.HashMap">
select id dispatchId from dc_dispatch where event_id=#{eventId}
</select>
<select id="selectWarningNum" resultType="java.lang.Long">
select count(*) from dc_warning where warning_state = 1 and warning_source != 6
</select>
</mapper>

Loading…
Cancel
Save