zbj//大屏暂降事件负荷类型
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 LoadTypeVO implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 干扰源类型名称
|
||||
*/
|
||||
@ApiModelProperty("干扰源类型名称")
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 干扰源暂降次数
|
||||
*/
|
||||
@ApiModelProperty("干扰源暂降次数")
|
||||
private Integer count;
|
||||
}
|
||||
@@ -7,6 +7,7 @@ import com.njcn.common.pojo.response.HttpResult;
|
||||
import com.njcn.common.utils.HttpResultUtil;
|
||||
import com.njcn.device.pq.pojo.param.LargeScreenParam;
|
||||
import com.njcn.device.pq.pojo.vo.AreaDownVO;
|
||||
import com.njcn.device.pq.pojo.vo.LoadTypeVO;
|
||||
import com.njcn.device.pq.pojo.vo.MonitoringPointScaleVO;
|
||||
|
||||
import com.njcn.event.service.majornetwork.LargeScreenService;
|
||||
@@ -22,6 +23,8 @@ import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @version 1.0.0
|
||||
* @author: zbj
|
||||
@@ -37,15 +40,28 @@ public class LargeScreenController extends BaseController {
|
||||
private final LargeScreenService largeScreenService;
|
||||
|
||||
/**
|
||||
* 监测点规模
|
||||
* 暂降事件区域
|
||||
*/
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/getAreaDownStatistics")
|
||||
@ApiOperation("区域暂降统计")
|
||||
@ApiImplicitParam(name = "largeScreenParam", value = "区域暂降统计", required = true)
|
||||
@ApiOperation("暂降事件区域")
|
||||
@ApiImplicitParam(name = "largeScreenParam", value = "暂降事件区域", required = true)
|
||||
public HttpResult<AreaDownVO> getAreaDownStatistics(@RequestBody @Validated LargeScreenParam largeScreenParam) {
|
||||
String methodDescribe = getMethodDescribe("getAreaDownStatistics");
|
||||
AreaDownVO result = largeScreenService.getAreaDownStatistics(largeScreenParam);
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,4 +13,7 @@ import java.util.Map;
|
||||
public interface LargeScreenMapper {
|
||||
|
||||
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);
|
||||
|
||||
}
|
||||
|
||||
@@ -6,17 +6,35 @@
|
||||
select
|
||||
count(ed.event_id) "count"
|
||||
from r_mp_event_detail ed
|
||||
left join sys_dict_data dd on ed.event_type and dd.Type_Id ='c37861896dafab0883321e1d508caa51'
|
||||
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(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 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>
|
||||
</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>
|
||||
</mapper>
|
||||
|
||||
@@ -6,6 +6,7 @@ import com.njcn.device.pq.pojo.param.DeviceInfoParam;
|
||||
import com.njcn.device.pq.pojo.param.LargeScreenParam;
|
||||
import com.njcn.device.pq.pojo.param.MonitoringPointScaleParam;
|
||||
import com.njcn.device.pq.pojo.vo.AreaDownVO;
|
||||
import com.njcn.device.pq.pojo.vo.LoadTypeVO;
|
||||
import com.njcn.device.pq.pojo.vo.MonitoringPointScaleVO;
|
||||
import com.njcn.event.mapper.majornetwork.LargeScreenMapper;
|
||||
import com.njcn.event.service.majornetwork.LargeScreenService;
|
||||
@@ -14,9 +15,12 @@ import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.njcn.device.pq.api.GeneralDeviceInfoClient;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @version 1.0.0
|
||||
@@ -33,7 +37,7 @@ public class LargeScreenServiceImpl implements LargeScreenService {
|
||||
private final LargeScreenMapper largeScreenMapper;
|
||||
|
||||
/**
|
||||
* 区域暂降统计
|
||||
* 暂降事件区域
|
||||
*/
|
||||
@Override
|
||||
public AreaDownVO getAreaDownStatistics(LargeScreenParam largeScreenParam) {
|
||||
@@ -97,4 +101,65 @@ 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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,6 +2,9 @@ package com.njcn.event.service.majornetwork;
|
||||
|
||||
import com.njcn.device.pq.pojo.param.LargeScreenParam;
|
||||
import com.njcn.device.pq.pojo.vo.AreaDownVO;
|
||||
import com.njcn.device.pq.pojo.vo.LoadTypeVO;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
@@ -13,4 +16,6 @@ public interface LargeScreenService {
|
||||
|
||||
AreaDownVO getAreaDownStatistics(LargeScreenParam largeScreenParam);
|
||||
|
||||
List<LoadTypeVO> getLoadType(LargeScreenParam largeScreenParam);
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user