Merge remote-tracking branch 'origin/master'
This commit is contained in:
@@ -0,0 +1,29 @@
|
|||||||
|
package com.njcn.device.pq.pojo.vo;
|
||||||
|
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @version 1.0.0
|
||||||
|
* @author: zbj
|
||||||
|
* @date: 2023/04/03
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class DownTimeVO implements Serializable {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 时间
|
||||||
|
*/
|
||||||
|
@ApiModelProperty("时间")
|
||||||
|
private String time;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 干扰源暂降次数
|
||||||
|
*/
|
||||||
|
@ApiModelProperty("干扰源暂降次数")
|
||||||
|
private Integer count;
|
||||||
|
}
|
||||||
@@ -0,0 +1,53 @@
|
|||||||
|
package com.njcn.device.pq.pojo.vo;
|
||||||
|
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @version 1.0.0
|
||||||
|
* @author: zbj
|
||||||
|
* @date: 2023/04/03
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class EventVO implements Serializable {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 发生时间
|
||||||
|
*/
|
||||||
|
@ApiModelProperty("发生时间")
|
||||||
|
private String time;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 监测点名称
|
||||||
|
*/
|
||||||
|
@ApiModelProperty("监测点名称")
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 暂降原因
|
||||||
|
*/
|
||||||
|
@ApiModelProperty("暂降原因")
|
||||||
|
private String reason;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 暂降类型
|
||||||
|
*/
|
||||||
|
@ApiModelProperty("暂降类型")
|
||||||
|
private String type;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 暂降幅值
|
||||||
|
*/
|
||||||
|
@ApiModelProperty("暂降幅值")
|
||||||
|
private String amplitude;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 持续时间
|
||||||
|
*/
|
||||||
|
@ApiModelProperty("持续时间")
|
||||||
|
private String duration;
|
||||||
|
}
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
package com.njcn.device.pq.pojo.vo;
|
||||||
|
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @version 1.0.0
|
||||||
|
* @author: zbj
|
||||||
|
* @date: 2023/04/03
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class LoadTypeVO implements Serializable {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 干扰源类型名称
|
||||||
|
*/
|
||||||
|
@ApiModelProperty("干扰源类型名称")
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 干扰源暂降次数
|
||||||
|
*/
|
||||||
|
@ApiModelProperty("干扰源暂降次数")
|
||||||
|
private Integer count;
|
||||||
|
}
|
||||||
@@ -6,8 +6,7 @@ import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
|||||||
import com.njcn.common.pojo.response.HttpResult;
|
import com.njcn.common.pojo.response.HttpResult;
|
||||||
import com.njcn.common.utils.HttpResultUtil;
|
import com.njcn.common.utils.HttpResultUtil;
|
||||||
import com.njcn.device.pq.pojo.param.LargeScreenParam;
|
import com.njcn.device.pq.pojo.param.LargeScreenParam;
|
||||||
import com.njcn.device.pq.pojo.vo.AreaDownVO;
|
import com.njcn.device.pq.pojo.vo.*;
|
||||||
import com.njcn.device.pq.pojo.vo.MonitoringPointScaleVO;
|
|
||||||
|
|
||||||
import com.njcn.event.service.majornetwork.LargeScreenService;
|
import com.njcn.event.service.majornetwork.LargeScreenService;
|
||||||
import com.njcn.web.controller.BaseController;
|
import com.njcn.web.controller.BaseController;
|
||||||
@@ -22,6 +21,8 @@ import org.springframework.web.bind.annotation.RequestBody;
|
|||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @version 1.0.0
|
* @version 1.0.0
|
||||||
* @author: zbj
|
* @author: zbj
|
||||||
@@ -37,15 +38,54 @@ public class LargeScreenController extends BaseController {
|
|||||||
private final LargeScreenService largeScreenService;
|
private final LargeScreenService largeScreenService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 监测点规模
|
* 暂降事件区域
|
||||||
*/
|
*/
|
||||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||||
@PostMapping("/getAreaDownStatistics")
|
@PostMapping("/getAreaDownStatistics")
|
||||||
@ApiOperation("区域暂降统计")
|
@ApiOperation("暂降事件区域")
|
||||||
@ApiImplicitParam(name = "largeScreenParam", value = "区域暂降统计", required = true)
|
@ApiImplicitParam(name = "largeScreenParam", value = "暂降事件区域", required = true)
|
||||||
public HttpResult<AreaDownVO> getAreaDownStatistics(@RequestBody @Validated LargeScreenParam largeScreenParam) {
|
public HttpResult<AreaDownVO> getAreaDownStatistics(@RequestBody @Validated LargeScreenParam largeScreenParam) {
|
||||||
String methodDescribe = getMethodDescribe("getAreaDownStatistics");
|
String methodDescribe = getMethodDescribe("getAreaDownStatistics");
|
||||||
AreaDownVO result = largeScreenService.getAreaDownStatistics(largeScreenParam);
|
AreaDownVO result = largeScreenService.getAreaDownStatistics(largeScreenParam);
|
||||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 暂降事件负荷类型
|
||||||
|
*/
|
||||||
|
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||||
|
@PostMapping("/getLoadType")
|
||||||
|
@ApiOperation("暂降事件负荷类型")
|
||||||
|
@ApiImplicitParam(name = "largeScreenParam", value = "暂降事件负荷类型", required = true)
|
||||||
|
public HttpResult<List<LoadTypeVO>> getLoadType(@RequestBody @Validated LargeScreenParam largeScreenParam) {
|
||||||
|
String methodDescribe = getMethodDescribe("getLoadType");
|
||||||
|
List<LoadTypeVO> result = largeScreenService.getLoadType(largeScreenParam);
|
||||||
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 暂降事件时间统计
|
||||||
|
*/
|
||||||
|
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||||
|
@PostMapping("/getTimeCount")
|
||||||
|
@ApiOperation("暂降事件时间统计")
|
||||||
|
@ApiImplicitParam(name = "largeScreenParam", value = "暂降事件时间统计", required = true)
|
||||||
|
public HttpResult<List<DownTimeVO>> getTimeCount(@RequestBody @Validated LargeScreenParam largeScreenParam) {
|
||||||
|
String methodDescribe = getMethodDescribe("getTimeCount");
|
||||||
|
List<DownTimeVO> result = largeScreenService.getTimeCount(largeScreenParam);
|
||||||
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 大屏获取暂降事件最新50条数据
|
||||||
|
*/
|
||||||
|
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||||
|
@PostMapping("/eventLists")
|
||||||
|
@ApiOperation("大屏获取暂降事件最新50条数据")
|
||||||
|
@ApiImplicitParam(name = "largeScreenParam", value = "大屏获取暂降事件最新50条数据", required = true)
|
||||||
|
public HttpResult<List<EventVO>> eventLists(@RequestBody @Validated LargeScreenParam largeScreenParam) {
|
||||||
|
String methodDescribe = getMethodDescribe("eventLists");
|
||||||
|
List<EventVO> result = largeScreenService.eventLists(largeScreenParam);
|
||||||
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,4 +13,10 @@ import java.util.Map;
|
|||||||
public interface LargeScreenMapper {
|
public interface LargeScreenMapper {
|
||||||
|
|
||||||
Map<String, Object> selectDownCount(@Param("lineIds") List<String> lineIds, @Param("startTime") String startTime, @Param("endTime") String endTime);
|
Map<String, Object> selectDownCount(@Param("lineIds") List<String> lineIds, @Param("startTime") String startTime, @Param("endTime") String endTime);
|
||||||
|
|
||||||
|
List<Map<String, Object>> selectLoadTypeCount(@Param("lineIds") List<String> lineIds, @Param("startTime") String startTime, @Param("endTime") String endTime);
|
||||||
|
|
||||||
|
List<Map<String, Object>> getTimeCount(@Param("lineIds") List<String> lineIds, @Param("startTime") String startTime, @Param("endTime") String endTime);
|
||||||
|
|
||||||
|
List<Map<String, Object>> eventLists(@Param("startTime") String startTime, @Param("endTime") String endTime);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,17 +6,71 @@
|
|||||||
select
|
select
|
||||||
count(ed.event_id) "count"
|
count(ed.event_id) "count"
|
||||||
from r_mp_event_detail ed
|
from r_mp_event_detail ed
|
||||||
left join sys_dict_data dd on ed.event_type and dd.Type_Id ='c37861896dafab0883321e1d508caa51'
|
|
||||||
where
|
where
|
||||||
ed.measurement_point_id in
|
ed.measurement_point_id in
|
||||||
<foreach collection="lineIds" item="item" open="(" close=")" separator=",">
|
<foreach collection="lineIds" item="item" open="(" close=")" separator=",">
|
||||||
#{item}
|
#{item}
|
||||||
</foreach>
|
</foreach>
|
||||||
<if test="startTime != null and startTime != ''">
|
<if test="startTime != null and startTime != ''">
|
||||||
and date_format(pl.Create_Time,'%y%m%d') >= date_format(#{startTime},'%y%m%d')
|
and date_format(ed.create_time,'%y%m%d') >= date_format(#{startTime},'%y%m%d')
|
||||||
</if>
|
</if>
|
||||||
<if test="endTime != null and endTime != ''">
|
<if test="endTime != null and endTime != ''">
|
||||||
and date_format(pl.Create_Time,'%y%m%d') <= date_format(#{endTime},'%y%m%d')
|
and date_format(ed.create_time,'%y%m%d') <= date_format(#{endTime},'%y%m%d')
|
||||||
</if>
|
</if>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
|
||||||
|
<select id="selectLoadTypeCount" resultType="java.util.Map">
|
||||||
|
select count(ed.event_id) "count",
|
||||||
|
ed.measurement_point_id "id"
|
||||||
|
from r_mp_event_detail ed
|
||||||
|
where
|
||||||
|
ed.measurement_point_id in
|
||||||
|
<foreach collection="lineIds" item="item" open="(" close=")" separator=",">
|
||||||
|
#{item}
|
||||||
|
</foreach>
|
||||||
|
<if test="startTime != null and startTime != ''">
|
||||||
|
and date_format(ed.create_time,'%y%m%d') >= date_format(#{startTime},'%y%m%d')
|
||||||
|
</if>
|
||||||
|
<if test="endTime != null and endTime != ''">
|
||||||
|
and date_format(ed.create_time,'%y%m%d') <= date_format(#{endTime},'%y%m%d')
|
||||||
|
</if>
|
||||||
|
group by ed.measurement_point_id
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="getTimeCount" resultType="java.util.Map">
|
||||||
|
select
|
||||||
|
date(ed.create_time) "day", count(*) "count"
|
||||||
|
from r_mp_event_detail ed where ed.measurement_point_id in
|
||||||
|
<foreach collection="lineIds" item="item" open="(" close=")" separator=",">
|
||||||
|
#{item}
|
||||||
|
</foreach>
|
||||||
|
<if test="startTime != null and startTime != ''">
|
||||||
|
and date_format(ed.create_time,'%y%m%d') >= date_format(#{startTime},'%y%m%d')
|
||||||
|
</if>
|
||||||
|
<if test="endTime != null and endTime != ''">
|
||||||
|
and date_format(ed.create_time,'%y%m%d') <= date_format(#{endTime},'%y%m%d')
|
||||||
|
</if>
|
||||||
|
group by day
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="eventLists" resultType="java.util.Map">
|
||||||
|
SELECT
|
||||||
|
ed.create_time "time",pl.`Name` "name",sdd.`Name` reason,sdd.`Name` "type",ed.feature_amplitude amplitude,ed.duration
|
||||||
|
from r_mp_event_detail ed
|
||||||
|
left join pq_line pl on pl.id = ed.measurement_point_id
|
||||||
|
left join sys_dict_data sdd on sdd.id = ed.advance_reason
|
||||||
|
left join sys_dict_data sdd2 on sdd.id = ed.advance_type
|
||||||
|
<where>
|
||||||
|
<if test="startTime != null and startTime != ''">
|
||||||
|
and date_format(ed.create_time,'%y%m%d') >= date_format(#{startTime},'%y%m%d')
|
||||||
|
</if>
|
||||||
|
<if test="endTime != null and endTime != ''">
|
||||||
|
and date_format(ed.create_time,'%y%m%d') <= date_format(#{endTime},'%y%m%d')
|
||||||
|
</if>
|
||||||
|
</where>
|
||||||
|
order by time desc
|
||||||
|
limit 50
|
||||||
|
|
||||||
|
</select>
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|||||||
@@ -6,17 +6,25 @@ import com.njcn.device.pq.pojo.param.DeviceInfoParam;
|
|||||||
import com.njcn.device.pq.pojo.param.LargeScreenParam;
|
import com.njcn.device.pq.pojo.param.LargeScreenParam;
|
||||||
import com.njcn.device.pq.pojo.param.MonitoringPointScaleParam;
|
import com.njcn.device.pq.pojo.param.MonitoringPointScaleParam;
|
||||||
import com.njcn.device.pq.pojo.vo.AreaDownVO;
|
import com.njcn.device.pq.pojo.vo.AreaDownVO;
|
||||||
import com.njcn.device.pq.pojo.vo.MonitoringPointScaleVO;
|
import com.njcn.device.pq.pojo.vo.DownTimeVO;
|
||||||
|
import com.njcn.device.pq.pojo.vo.EventVO;
|
||||||
|
import com.njcn.device.pq.pojo.vo.LoadTypeVO;
|
||||||
import com.njcn.event.mapper.majornetwork.LargeScreenMapper;
|
import com.njcn.event.mapper.majornetwork.LargeScreenMapper;
|
||||||
import com.njcn.event.service.majornetwork.LargeScreenService;
|
import com.njcn.event.service.majornetwork.LargeScreenService;
|
||||||
import com.njcn.system.pojo.enums.StatisticsEnum;
|
import com.njcn.system.pojo.enums.StatisticsEnum;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.apache.commons.collections.map.HashedMap;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import com.njcn.device.pq.api.GeneralDeviceInfoClient;
|
import com.njcn.device.pq.api.GeneralDeviceInfoClient;
|
||||||
|
|
||||||
|
import java.time.LocalDate;
|
||||||
|
import java.time.format.DateTimeFormatter;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @version 1.0.0
|
* @version 1.0.0
|
||||||
@@ -33,7 +41,7 @@ public class LargeScreenServiceImpl implements LargeScreenService {
|
|||||||
private final LargeScreenMapper largeScreenMapper;
|
private final LargeScreenMapper largeScreenMapper;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 区域暂降统计
|
* 暂降事件区域
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public AreaDownVO getAreaDownStatistics(LargeScreenParam largeScreenParam) {
|
public AreaDownVO getAreaDownStatistics(LargeScreenParam largeScreenParam) {
|
||||||
@@ -56,14 +64,14 @@ public class LargeScreenServiceImpl implements LargeScreenService {
|
|||||||
List<GeneralDeviceDTO> generalDeviceDTOList = generalDeviceInfoClient.getPracticalAllDeviceInfo(deviceInfoParam).getData();
|
List<GeneralDeviceDTO> generalDeviceDTOList = generalDeviceInfoClient.getPracticalAllDeviceInfo(deviceInfoParam).getData();
|
||||||
|
|
||||||
for (GeneralDeviceDTO generalDeviceDTO : generalDeviceDTOList) {
|
for (GeneralDeviceDTO generalDeviceDTO : generalDeviceDTOList) {
|
||||||
if (generalDeviceDTO.getLineIndexes().size() == 0){
|
if (generalDeviceDTO.getLineIndexes().size() == 0) {
|
||||||
MonitoringPointScaleParam param = new MonitoringPointScaleParam();
|
MonitoringPointScaleParam param = new MonitoringPointScaleParam();
|
||||||
param.setName(generalDeviceDTO.getName());
|
param.setName(generalDeviceDTO.getName());
|
||||||
param.setIndex(generalDeviceDTO.getIndex());
|
param.setIndex(generalDeviceDTO.getIndex());
|
||||||
param.setCount(0);
|
param.setCount(0);
|
||||||
list.add(param);
|
list.add(param);
|
||||||
}else{
|
} else {
|
||||||
Map<String, Object> map = largeScreenMapper.selectDownCount(generalDeviceDTO.getLineIndexes(),largeScreenParam.getSearchBeginTime(), largeScreenParam.getSearchEndTime());
|
Map<String, Object> map = largeScreenMapper.selectDownCount(generalDeviceDTO.getLineIndexes(), largeScreenParam.getSearchBeginTime(), largeScreenParam.getSearchEndTime());
|
||||||
MonitoringPointScaleParam param = new MonitoringPointScaleParam();
|
MonitoringPointScaleParam param = new MonitoringPointScaleParam();
|
||||||
param.setName(generalDeviceDTO.getName());
|
param.setName(generalDeviceDTO.getName());
|
||||||
param.setIndex(generalDeviceDTO.getIndex());
|
param.setIndex(generalDeviceDTO.getIndex());
|
||||||
@@ -97,4 +105,149 @@ public class LargeScreenServiceImpl implements LargeScreenService {
|
|||||||
}*/
|
}*/
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 暂降事件负荷类型
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public List<LoadTypeVO> getLoadType(LargeScreenParam largeScreenParam) {
|
||||||
|
//创建返回VO
|
||||||
|
List<LoadTypeVO> result = new ArrayList<>();
|
||||||
|
DeviceInfoParam.BusinessParam deviceInfoParam = new DeviceInfoParam.BusinessParam();
|
||||||
|
//部门索引
|
||||||
|
deviceInfoParam.setDeptIndex(largeScreenParam.getDeptIndex());
|
||||||
|
//统计类型
|
||||||
|
SimpleDTO simpleDTO = new SimpleDTO();
|
||||||
|
simpleDTO.setCode(String.valueOf(StatisticsEnum.LOAD_TYPE));
|
||||||
|
deviceInfoParam.setStatisticalType(simpleDTO);
|
||||||
|
//添加时间
|
||||||
|
deviceInfoParam.setSearchBeginTime(largeScreenParam.getSearchBeginTime());
|
||||||
|
deviceInfoParam.setSearchEndTime(largeScreenParam.getSearchEndTime());
|
||||||
|
//添加服务名
|
||||||
|
deviceInfoParam.setServerName("event-boot");
|
||||||
|
// 获取所有数据
|
||||||
|
List<GeneralDeviceDTO> generalDeviceDTOList = generalDeviceInfoClient.getPracticalAllDeviceInfo(deviceInfoParam).getData();
|
||||||
|
|
||||||
|
//获取所有监测点集合
|
||||||
|
List<String> lineIds = generalDeviceDTOList.stream().flatMap(dto -> dto.getLineIndexes().stream()).collect(Collectors.toList());
|
||||||
|
|
||||||
|
List<Map<String, Object>> maps = largeScreenMapper.selectLoadTypeCount(lineIds, largeScreenParam.getSearchBeginTime(), largeScreenParam.getSearchEndTime());
|
||||||
|
|
||||||
|
Map<String, Integer> countMap = new HashMap<>();
|
||||||
|
for (Map<String, Object> map : maps) {
|
||||||
|
for (GeneralDeviceDTO generalDeviceDTO : generalDeviceDTOList) {
|
||||||
|
for (String lineIndex : generalDeviceDTO.getLineIndexes()) {
|
||||||
|
if (map.get("id").equals(lineIndex)) {
|
||||||
|
if (countMap.containsKey(generalDeviceDTO.getName())) {
|
||||||
|
int id = Integer.parseInt(map.get("count").toString());
|
||||||
|
countMap.put(generalDeviceDTO.getName(), countMap.get(generalDeviceDTO.getName()) + id);
|
||||||
|
break;
|
||||||
|
} else {
|
||||||
|
int id = Integer.parseInt(map.get("count").toString());
|
||||||
|
countMap.put(generalDeviceDTO.getName(), id);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
List<String> nameList = generalDeviceDTOList.stream().map(GeneralDeviceDTO::getName).collect(Collectors.toList());
|
||||||
|
for (String s : nameList) {
|
||||||
|
if (!countMap.containsKey(s)) {
|
||||||
|
countMap.put(s, 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for (String s : countMap.keySet()) {
|
||||||
|
LoadTypeVO loadTypeVO = new LoadTypeVO();
|
||||||
|
loadTypeVO.setName(s);
|
||||||
|
loadTypeVO.setCount(countMap.get(s));
|
||||||
|
result.add(loadTypeVO);
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 暂降事件时间统计
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public List<DownTimeVO> getTimeCount(LargeScreenParam largeScreenParam) {
|
||||||
|
//创建返回VO
|
||||||
|
List<DownTimeVO> result = new ArrayList<>();
|
||||||
|
DeviceInfoParam.BusinessParam deviceInfoParam = new DeviceInfoParam.BusinessParam();
|
||||||
|
//部门索引
|
||||||
|
deviceInfoParam.setDeptIndex(largeScreenParam.getDeptIndex());
|
||||||
|
//统计类型
|
||||||
|
SimpleDTO simpleDTO = new SimpleDTO();
|
||||||
|
simpleDTO.setCode(String.valueOf(StatisticsEnum.LOAD_TYPE));
|
||||||
|
deviceInfoParam.setStatisticalType(simpleDTO);
|
||||||
|
//添加时间
|
||||||
|
deviceInfoParam.setSearchBeginTime(largeScreenParam.getSearchBeginTime());
|
||||||
|
deviceInfoParam.setSearchEndTime(largeScreenParam.getSearchEndTime());
|
||||||
|
//添加服务名
|
||||||
|
deviceInfoParam.setServerName("event-boot");
|
||||||
|
// 获取所有数据
|
||||||
|
List<GeneralDeviceDTO> generalDeviceDTOList = generalDeviceInfoClient.getPracticalAllDeviceInfo(deviceInfoParam).getData();
|
||||||
|
|
||||||
|
//获取所有监测点集合
|
||||||
|
List<String> lineIds = generalDeviceDTOList.stream().flatMap(dto -> dto.getLineIndexes().stream()).collect(Collectors.toList());
|
||||||
|
|
||||||
|
List<Map<String, Object>> maps = largeScreenMapper.getTimeCount(lineIds, largeScreenParam.getSearchBeginTime(), largeScreenParam.getSearchEndTime());
|
||||||
|
|
||||||
|
Map<LocalDate, Integer> eventMap = new HashedMap();
|
||||||
|
|
||||||
|
for (Map<String, Object> map : maps) {
|
||||||
|
eventMap.put(LocalDate.parse(map.get("day").toString()), Integer.parseInt(map.get("count").toString()));
|
||||||
|
}
|
||||||
|
|
||||||
|
// 创建返回结果的Map集合
|
||||||
|
Map<LocalDate, Integer> resultMap = new HashMap<>();
|
||||||
|
// 定义事件日期区间
|
||||||
|
LocalDate start = LocalDate.parse(largeScreenParam.getSearchBeginTime()); // 开始日期
|
||||||
|
LocalDate end = LocalDate.parse(largeScreenParam.getSearchEndTime()); // 结束日期
|
||||||
|
// 循环遍历事件日期区间中的每一天,并尝试从事件日期的Map集合中获取对应的值
|
||||||
|
for (LocalDate date = start; !date.isAfter(end); date = date.plusDays(1)) {
|
||||||
|
Integer value = eventMap.get(date);
|
||||||
|
|
||||||
|
// 如果事件日期的Map集合中存在这一天,则将对应键值对添加到返回结果的Map集合中
|
||||||
|
if (value != null) {
|
||||||
|
resultMap.put(date, value);
|
||||||
|
}
|
||||||
|
// 否则,将这一天添加到返回结果的Map集合中,并将值设为0,表示这一天没有事件
|
||||||
|
else {
|
||||||
|
resultMap.put(date, 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// 输出返回结果的Map集合中的每一个键值对
|
||||||
|
resultMap.entrySet().forEach(System.out::println);
|
||||||
|
for (LocalDate s : resultMap.keySet()) {
|
||||||
|
DownTimeVO downTimeVO = new DownTimeVO();
|
||||||
|
downTimeVO.setTime(s.format(DateTimeFormatter.ofPattern("yyyy-MM-dd")));
|
||||||
|
downTimeVO.setCount(resultMap.get(s));
|
||||||
|
result.add(downTimeVO);
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 大屏获取暂降事件最新50条数据
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public List<EventVO> eventLists(LargeScreenParam largeScreenParam) {
|
||||||
|
List<EventVO> result = new ArrayList<>();
|
||||||
|
List<Map<String, Object>> maps = largeScreenMapper.eventLists(largeScreenParam.getSearchBeginTime(), largeScreenParam.getSearchEndTime());
|
||||||
|
for (Map<String, Object> map : maps) {
|
||||||
|
EventVO eventVO = new EventVO();
|
||||||
|
eventVO.setTime(map.get("time").toString());
|
||||||
|
eventVO.setName(map.get("name").toString());
|
||||||
|
eventVO.setReason(map.get("reason").toString());
|
||||||
|
eventVO.setType(map.get("type").toString());
|
||||||
|
eventVO.setAmplitude(map.get("amplitude").toString());
|
||||||
|
eventVO.setDuration(map.get("duration").toString());
|
||||||
|
result.add(eventVO);
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,6 +2,11 @@ package com.njcn.event.service.majornetwork;
|
|||||||
|
|
||||||
import com.njcn.device.pq.pojo.param.LargeScreenParam;
|
import com.njcn.device.pq.pojo.param.LargeScreenParam;
|
||||||
import com.njcn.device.pq.pojo.vo.AreaDownVO;
|
import com.njcn.device.pq.pojo.vo.AreaDownVO;
|
||||||
|
import com.njcn.device.pq.pojo.vo.DownTimeVO;
|
||||||
|
import com.njcn.device.pq.pojo.vo.EventVO;
|
||||||
|
import com.njcn.device.pq.pojo.vo.LoadTypeVO;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -13,4 +18,9 @@ public interface LargeScreenService {
|
|||||||
|
|
||||||
AreaDownVO getAreaDownStatistics(LargeScreenParam largeScreenParam);
|
AreaDownVO getAreaDownStatistics(LargeScreenParam largeScreenParam);
|
||||||
|
|
||||||
|
List<LoadTypeVO> getLoadType(LargeScreenParam largeScreenParam);
|
||||||
|
|
||||||
|
List<DownTimeVO> getTimeCount(LargeScreenParam largeScreenParam);
|
||||||
|
|
||||||
|
List<EventVO> eventLists(LargeScreenParam largeScreenParam);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -63,6 +63,7 @@ public enum DicDataTypeEnum {
|
|||||||
WORK_ORDER_PROCESS("工单流程","Work_Order_Process"),
|
WORK_ORDER_PROCESS("工单流程","Work_Order_Process"),
|
||||||
ASSESS_RESULT("评估结果","Assess_Result"),
|
ASSESS_RESULT("评估结果","Assess_Result"),
|
||||||
WORK_ORDER_TYPE("工单类型","Work_Order_Type"),
|
WORK_ORDER_TYPE("工单类型","Work_Order_Type"),
|
||||||
|
DEV_VOLTAGE_STAND("标准电压等级","Dev_Voltage_Stand"),
|
||||||
PRIMARY_TYPE("一级业务类型","Primary_Type");
|
PRIMARY_TYPE("一级业务类型","Primary_Type");
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user