合格率报告功能
This commit is contained in:
@@ -283,9 +283,10 @@ public class GeneralDeviceInfoController extends BaseController {
|
||||
@PostMapping("/deptGetRunLine")
|
||||
@ApiOperation("根据单位获取投运监测点")
|
||||
@ApiImplicitParam(name = "deptId", value = "单位部门索引", required = true)
|
||||
public HttpResult<List<RStatOnlinerateVO>> deptGetRunLine(@RequestParam("deptId")String deptId) {
|
||||
public HttpResult<List<String>> deptGetRunLine(@RequestParam("deptId")String deptId) {
|
||||
String methodDescribe = getMethodDescribe("deptGetRunLine");
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS,null,methodDescribe);
|
||||
List<String> runLineIds = generalDeviceService.deptGetRunLine(deptId,Stream.of(0).collect(Collectors.toList()));
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS,runLineIds,methodDescribe);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
package com.njcn.device.pq.controller;
|
||||
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.njcn.common.pojo.annotation.OperateInfo;
|
||||
import com.njcn.common.pojo.enums.common.LogEnum;
|
||||
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
||||
@@ -8,7 +10,9 @@ import com.njcn.common.pojo.response.HttpResult;
|
||||
import com.njcn.common.utils.HttpResultUtil;
|
||||
import com.njcn.device.pq.pojo.param.DeviceInfoParam;
|
||||
import com.njcn.device.pq.pojo.param.LineIntegrityDataParam;
|
||||
import com.njcn.device.pq.pojo.po.RStatIntegrityD;
|
||||
import com.njcn.device.pq.pojo.vo.LineIntegrityDataVO;
|
||||
import com.njcn.device.pq.service.IRStatIntegrityDService;
|
||||
import com.njcn.device.pq.service.LineIntegrityDataService;
|
||||
import com.njcn.harmonic.pojo.vo.IntegrityIconVO;
|
||||
import com.njcn.web.controller.BaseController;
|
||||
@@ -18,10 +22,8 @@ import io.swagger.annotations.ApiOperation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import springfox.documentation.annotations.ApiIgnore;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -40,6 +42,8 @@ public class LineIntegrityDataController extends BaseController {
|
||||
|
||||
private final LineIntegrityDataService lineIntegrityDataService;
|
||||
|
||||
private final IRStatIntegrityDService irStatIntegrityDService;
|
||||
|
||||
|
||||
/**
|
||||
* 监测点数据完整性
|
||||
@@ -65,4 +69,23 @@ public class LineIntegrityDataController extends BaseController {
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, integrityIconVO, methodDescribe);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 通过监测点集合查询监测点数据完整性
|
||||
* @author cdf
|
||||
* @date 2023/6/7
|
||||
*/
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/getIntegrityByLineIds")
|
||||
@ApiOperation("通过监测点集合查询监测点数据完整性")
|
||||
@ApiImplicitParam(name = "lineIds", value = "监测点集合", required = true)
|
||||
@ApiIgnore
|
||||
public HttpResult<List<RStatIntegrityD>> getIntegrityByLineIds(@RequestBody List<String> lineIds, @RequestParam("startTime")String startTime, @RequestParam("endTime")String endTime) {
|
||||
String methodDescribe = getMethodDescribe("getIntegrityByLineIds");
|
||||
QueryWrapper<RStatIntegrityD> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.select("sum(real_time)/sum(due_time) as integrityData","line_index").in("line_index",lineIds).between("time_id",startTime,endTime).groupBy("line_index");
|
||||
List<RStatIntegrityD> rStatIntegrityDList = irStatIntegrityDService.list(queryWrapper);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, rStatIntegrityDList, methodDescribe);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,55 @@
|
||||
package com.njcn.device.pq.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.njcn.common.pojo.annotation.OperateInfo;
|
||||
import com.njcn.common.pojo.enums.common.LogEnum;
|
||||
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
||||
import com.njcn.common.pojo.exception.BusinessException;
|
||||
import com.njcn.common.pojo.response.HttpResult;
|
||||
import com.njcn.common.utils.HttpResultUtil;
|
||||
import com.njcn.device.biz.pojo.po.Overlimit;
|
||||
import com.njcn.device.pq.pojo.param.AlarmStrategyParam;
|
||||
import com.njcn.device.pq.pojo.vo.AlarmStrategyVO;
|
||||
import com.njcn.device.pq.service.AlarmStrategyService;
|
||||
import com.njcn.device.pq.service.IOverLimitService;
|
||||
import com.njcn.web.controller.BaseController;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import springfox.documentation.annotations.ApiIgnore;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 监测点限值
|
||||
* @author cdf
|
||||
* @date 2023/6/7
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("/overLimit")
|
||||
@Api(tags = "监测点限值")
|
||||
@RequiredArgsConstructor
|
||||
public class OverLimitController extends BaseController {
|
||||
|
||||
private final IOverLimitService iOverLimitService;
|
||||
|
||||
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/getOverLimitByLineIds")
|
||||
@ApiOperation("监测点集合获取限值")
|
||||
@ApiImplicitParam(name = "lineIds", value = "监测点ids", required = true)
|
||||
@ApiIgnore
|
||||
public HttpResult<List<Overlimit>> getOverLimitByLineIds(@RequestBody List<String> lineIds){
|
||||
String methodDescribe = getMethodDescribe("getOverLimitByLineIds");
|
||||
List<Overlimit> overLimitList= iOverLimitService.list(new LambdaQueryWrapper<Overlimit>().in(Overlimit::getId,lineIds));
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, overLimitList, methodDescribe);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -73,4 +73,7 @@ public interface DeptLineMapper extends BaseMapper<DeptLine> {
|
||||
List<LineDevGetDTO> lineDevGet(@Param("list")List<Integer> devType,@Param("type")Integer type);
|
||||
|
||||
List<TerminalGetBase> orgSubStationGet(@Param("list")List<Integer> devType);
|
||||
|
||||
|
||||
List<String> getLineIdByDeptIds(@Param("deptIds")List<String> deptIds,@Param("runFlag")List<Integer> runFlag);
|
||||
}
|
||||
|
||||
@@ -84,4 +84,26 @@
|
||||
#{item}
|
||||
</foreach>
|
||||
</select>
|
||||
|
||||
|
||||
<select id="getLineIdByDeptIds" resultType="string">
|
||||
select
|
||||
DISTINCT
|
||||
pq_dept_line.line_id
|
||||
from pq_dept_line pq_dept_line
|
||||
inner join pq_line point on pq_dept_line.line_id = point.id
|
||||
inner join pq_line_detail lineDetail on point.id = lineDetail.id
|
||||
inner join pq_line voltage on point.pid = voltage.id
|
||||
inner join pq_line dev on voltage.pid = dev.id
|
||||
inner join pq_device device on dev.id = device.id
|
||||
where Dev_Model = 1
|
||||
and device.run_flag in
|
||||
<foreach collection="runFlag" item="item" open="(" close=")" separator=",">
|
||||
#{item}
|
||||
</foreach>
|
||||
and pq_dept_line.id in
|
||||
<foreach collection="deptIds" item="item" open="(" close=")" separator=",">
|
||||
#{item}
|
||||
</foreach>
|
||||
</select>
|
||||
</mapper>
|
||||
|
||||
@@ -498,7 +498,7 @@
|
||||
detail.pt1,
|
||||
detail.pt2,
|
||||
detail.obj_name,
|
||||
detail.Dev_Capacity,
|
||||
detail.Dev_Capacity deviceCapacity,
|
||||
detail.Short_Capacity,
|
||||
detail.Standard_Capacity,
|
||||
detail.Deal_Capacity,
|
||||
|
||||
@@ -38,6 +38,14 @@ public interface DeptLineService extends IService<DeptLine> {
|
||||
*/
|
||||
List<DeptLine> selectDeptBindLines(List<String> ids);
|
||||
|
||||
|
||||
/**
|
||||
* 根据部门ids集合查询所有监测点id
|
||||
* @param ids 部门ids
|
||||
* @return 查询结果
|
||||
*/
|
||||
List<String> getLineByDeptIds(List<String> ids,List<Integer> runFlag);
|
||||
|
||||
/**
|
||||
* 部门解除绑定监测点
|
||||
* @param id 部门id
|
||||
|
||||
@@ -1,12 +0,0 @@
|
||||
package com.njcn.device.pq.service;
|
||||
|
||||
/**
|
||||
* @version 1.0.0
|
||||
* @author: chenchao
|
||||
* @date: 2022/08/15 15:33
|
||||
*/
|
||||
public interface DeviceOnlineService {
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package com.njcn.device.pq.service;
|
||||
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.njcn.device.biz.pojo.po.Overlimit;
|
||||
import com.njcn.device.pq.pojo.po.RStatIntegrityD;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 越限表实体
|
||||
* </p>
|
||||
*
|
||||
* @author hongawen
|
||||
* @since 2023-03-28
|
||||
*/
|
||||
public interface IOverLimitService extends IService<Overlimit> {
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -14,4 +14,6 @@ import com.njcn.device.pq.pojo.po.RStatIntegrityD;
|
||||
*/
|
||||
public interface IRStatIntegrityDService extends IService<RStatIntegrityD> {
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -60,6 +60,11 @@ public class DeptLineServiceImpl extends ServiceImpl<DeptLineMapper, DeptLine> i
|
||||
return this.lambdaQuery().in(DeptLine::getId, ids).list();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getLineByDeptIds(List<String> ids,List<Integer> runFlag) {
|
||||
return this.baseMapper.getLineIdByDeptIds(ids,runFlag);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int removeBind(String id) {
|
||||
QueryWrapper<DeptLine> deptLineQueryWrapper = new QueryWrapper<>();
|
||||
|
||||
@@ -43,7 +43,7 @@ import java.util.stream.Stream;
|
||||
|
||||
/**
|
||||
* 终端信息处理器,根据需求返回笼统的台账信息。
|
||||
ii * 包括:类别名称、类别索引、监测点索引集合、终端索引集合、变电站索引集bb合、供电公司索引集合。
|
||||
* ii * 包括:类别名称、类别索引、监测点索引集合、终端索引集合、变电站索引集bb合、供电公司索引集合。
|
||||
* PS:若后期需要比如:省会、项目时再动态添加。
|
||||
*
|
||||
* @author hongawen
|
||||
@@ -139,7 +139,7 @@ public class GeneralDeviceService {
|
||||
return generalDeviceDTO;
|
||||
}
|
||||
//获取line详细数据
|
||||
List<Line> lines = terminalBaseService. getLineByCondition(deptLines.stream().map(DeptLine::getLineId).collect(Collectors.toList()), deviceInfoParam);
|
||||
List<Line> lines = terminalBaseService.getLineByCondition(deptLines.stream().map(DeptLine::getLineId).collect(Collectors.toList()), deviceInfoParam);
|
||||
//返回空数据
|
||||
if (CollectionUtil.isEmpty(lines)) {
|
||||
return generalDeviceDTO;
|
||||
@@ -200,7 +200,7 @@ public class GeneralDeviceService {
|
||||
public List<GeneralDeviceDTO> getDeviceInfoAsSubstation(DeviceInfoParam deviceInfoParam, List<Integer> runFlag, List<Integer> devModel) {
|
||||
List<GeneralDeviceDTO> deviceInfoAsSubstation = new ArrayList<>();
|
||||
List<String> scale = new ArrayList<>();
|
||||
if(CollUtil.isNotEmpty(deviceInfoParam.getScale())){
|
||||
if (CollUtil.isNotEmpty(deviceInfoParam.getScale())) {
|
||||
scale = deviceInfoParam.getScale().stream().map(SimpleDTO::getId).collect(Collectors.toList());
|
||||
deviceInfoParam.setScale(new ArrayList<>());
|
||||
}
|
||||
@@ -219,7 +219,7 @@ public class GeneralDeviceService {
|
||||
substationIds = substationIds.stream().distinct().collect(Collectors.toList());
|
||||
lineIds = lineIds.stream().distinct().collect(Collectors.toList());
|
||||
if (!CollectionUtil.isEmpty(substationIds)) {
|
||||
List<Line> substations = terminalBaseService.getSubstationByIds(substationIds,scale);
|
||||
List<Line> substations = terminalBaseService.getSubstationByIds(substationIds, scale);
|
||||
List<Line> lines = terminalBaseService.getLineById(lineIds);
|
||||
for (Line substation : substations) {
|
||||
deviceInfoAsSubstation.add(mergeDeviceInfoAsSubstation(substation, lines));
|
||||
@@ -375,9 +375,9 @@ public class GeneralDeviceService {
|
||||
/**
|
||||
* 根据部门id集合获取监测点信息
|
||||
*
|
||||
* @param directDeptDTO 入参deptIndex的直接子部门
|
||||
* @param directDeptDTO 入参deptIndex的直接子部门
|
||||
* @param deviceType
|
||||
* @param ids 直接子部门以及后代部门id集合
|
||||
* @param ids 直接子部门以及后代部门id集合
|
||||
* @param deviceInfoParam
|
||||
* @return
|
||||
*/
|
||||
@@ -415,8 +415,8 @@ public class GeneralDeviceService {
|
||||
}).collect(Collectors.toList());
|
||||
// 再根据终端条件筛选合法终端信息 联查:pq_line t1,pq_device t2
|
||||
List<Line> devices = terminalBaseService.getDeviceByCondition(devIds,
|
||||
deviceType,
|
||||
deviceInfoParam.getManufacturer());
|
||||
deviceType,
|
||||
deviceInfoParam.getManufacturer());
|
||||
//筛选出母线id,理论上监测点的pids中第六个id为母线id 联查: pq_line t1 ,pq_voltage t2
|
||||
List<String> voltageIds = lines.stream().map(line -> {
|
||||
String[] idsArray = line.getPids().split(",");
|
||||
@@ -424,7 +424,7 @@ public class GeneralDeviceService {
|
||||
}).collect(Collectors.toList());
|
||||
//再根据电压等级筛选合法母线信息
|
||||
List<Line> voltages = terminalBaseService.getVoltageByCondition(voltageIds,
|
||||
deviceInfoParam.getScale());
|
||||
deviceInfoParam.getScale());
|
||||
//筛选最终的数据
|
||||
dealDeviceData(generalDeviceDTO, lines, devices, voltages);
|
||||
return generalDeviceDTO;
|
||||
@@ -474,7 +474,7 @@ public class GeneralDeviceService {
|
||||
List<DictData> scaleDictData = dicDataFeignClient.getDicDataByTypeName(DicDataTypeEnum.DEV_VOLTAGE_STAND.getName()).getData();
|
||||
scales = scaleDictData.stream().map(dictData -> {
|
||||
SimpleDTO simpleDTO = new SimpleDTO();
|
||||
BeanUtil.copyProperties(dictData,simpleDTO);
|
||||
BeanUtil.copyProperties(dictData, simpleDTO);
|
||||
return simpleDTO;
|
||||
}).collect(Collectors.toList());
|
||||
}
|
||||
@@ -502,7 +502,7 @@ public class GeneralDeviceService {
|
||||
List<DictData> scaleDictData = dicDataFeignClient.getDicDataByTypeName(DicDataTypeEnum.INTERFERENCE_SOURCE_TYPE.getName()).getData();
|
||||
loadType = scaleDictData.stream().map(dictData -> {
|
||||
SimpleDTO simpleDTO = new SimpleDTO();
|
||||
BeanUtil.copyProperties(dictData,simpleDTO);
|
||||
BeanUtil.copyProperties(dictData, simpleDTO);
|
||||
return simpleDTO;
|
||||
}).collect(Collectors.toList());
|
||||
}
|
||||
@@ -530,7 +530,7 @@ public class GeneralDeviceService {
|
||||
List<DictData> scaleDictData = dicDataFeignClient.getDicDataByTypeName(DicDataTypeEnum.DEV_MANUFACTURER.getName()).getData();
|
||||
manufacturer = scaleDictData.stream().map(dictData -> {
|
||||
SimpleDTO simpleDTO = new SimpleDTO();
|
||||
BeanUtil.copyProperties(dictData,simpleDTO);
|
||||
BeanUtil.copyProperties(dictData, simpleDTO);
|
||||
return simpleDTO;
|
||||
}).collect(Collectors.toList());
|
||||
}
|
||||
@@ -609,117 +609,117 @@ public class GeneralDeviceService {
|
||||
}
|
||||
|
||||
/**
|
||||
* @Description: 按部门分类获取通讯异常设备警告
|
||||
* @Param: [deviceInfoParam]
|
||||
* @return: java.util.List<com.njcn.device.pq.pojo.vo.ExceptionDeviceInfoVO>
|
||||
* @Author: clam
|
||||
* @Date: 2022/10/14
|
||||
*/
|
||||
* @Description: 按部门分类获取通讯异常设备警告
|
||||
* @Param: [deviceInfoParam]
|
||||
* @return: java.util.List<com.njcn.device.pq.pojo.vo.ExceptionDeviceInfoVO>
|
||||
* @Author: clam
|
||||
* @Date: 2022/10/14
|
||||
*/
|
||||
public List<ExceptionDeviceInfoVO> getExceptionDeviceInfoAsDept(DeviceInfoParam deviceInfoParam) {
|
||||
|
||||
List<ExceptionDeviceInfoVO> exceptionDeviceInfoVOS = new ArrayList<> ();
|
||||
List<GeneralDeviceDTO> deviceInfoAsSubstation = getDeviceInfoAsDept (deviceInfoParam,null, Stream.of (1).collect (Collectors.toList ( )));
|
||||
List<ExceptionDeviceInfoVO> exceptionDeviceInfoVOS = new ArrayList<>();
|
||||
List<GeneralDeviceDTO> deviceInfoAsSubstation = getDeviceInfoAsDept(deviceInfoParam, null, Stream.of(1).collect(Collectors.toList()));
|
||||
/*获取所有设备*/
|
||||
final List<String> deviceIndexes = deviceInfoAsSubstation.stream ( ).map (GeneralDeviceDTO::getDeviceIndexes).flatMap (Collection::stream).distinct ( ).collect (Collectors.toList ( ));
|
||||
final List<String> deviceIndexes = deviceInfoAsSubstation.stream().map(GeneralDeviceDTO::getDeviceIndexes).flatMap(Collection::stream).distinct().collect(Collectors.toList());
|
||||
|
||||
QueryWrapper<Device> wrapper = new QueryWrapper<> ();
|
||||
QueryWrapper<Device> wrapper = new QueryWrapper<>();
|
||||
|
||||
|
||||
wrapper.in("Id", deviceIndexes).
|
||||
eq("Com_Flag", 0).
|
||||
eq("Dev_Model", 1).
|
||||
eq("Dev_Data_Type", 2).
|
||||
eq("Run_Flag", 0);
|
||||
|
||||
wrapper.in ("Id",deviceIndexes).
|
||||
eq ("Com_Flag", 0).
|
||||
eq ("Dev_Model", 1).
|
||||
eq ("Dev_Data_Type", 2).
|
||||
eq ("Run_Flag", 0);
|
||||
List<Device> deviceList = deviceMapper.selectList(wrapper);
|
||||
|
||||
List<Device> deviceList = deviceMapper.selectList (wrapper);
|
||||
List<String> filterDevIndexs = deviceList.stream().map(Device::getId).collect(Collectors.toList());
|
||||
|
||||
List<String> filterDevIndexs = deviceList.stream ( ).map (Device::getId).collect (Collectors.toList ( ));
|
||||
|
||||
QueryWrapper<Line> lineQueryWrapper = new QueryWrapper<> ();
|
||||
lineQueryWrapper.in ("Id",filterDevIndexs).
|
||||
eq ("Level", 4);
|
||||
QueryWrapper<Line> lineQueryWrapper = new QueryWrapper<>();
|
||||
lineQueryWrapper.in("Id", filterDevIndexs).
|
||||
eq("Level", 4);
|
||||
/*终端*/
|
||||
List<Line> tempDevices = lineMapper.selectList (lineQueryWrapper);
|
||||
List<Line> tempDevices = lineMapper.selectList(lineQueryWrapper);
|
||||
|
||||
|
||||
List<String> subIndexList = tempDevices.stream ( ).map (Line::getPid).distinct ().collect (Collectors.toList ( ));
|
||||
List<String> subIndexList = tempDevices.stream().map(Line::getPid).distinct().collect(Collectors.toList());
|
||||
/*变电站*/
|
||||
QueryWrapper<Line> substationQueryWrapper = new QueryWrapper<> ();
|
||||
substationQueryWrapper.in ("Id", subIndexList).
|
||||
eq ("Level", 3);
|
||||
List<Line> tempSubstations = lineMapper.selectList (substationQueryWrapper);
|
||||
QueryWrapper<Line> substationQueryWrapper = new QueryWrapper<>();
|
||||
substationQueryWrapper.in("Id", subIndexList).
|
||||
eq("Level", 3);
|
||||
List<Line> tempSubstations = lineMapper.selectList(substationQueryWrapper);
|
||||
/* todo 设置警告类型*/
|
||||
DictData data = dicDataFeignClient.getDicDataByCode (DicDataEnum.COMM_ERR.getCode ( )).getData ( );
|
||||
deviceList.forEach (device -> {
|
||||
DictData data = dicDataFeignClient.getDicDataByCode(DicDataEnum.COMM_ERR.getCode()).getData();
|
||||
deviceList.forEach(device -> {
|
||||
|
||||
ExceptionDeviceInfoVO exceptionDeviceInfoVO = new ExceptionDeviceInfoVO();
|
||||
|
||||
exceptionDeviceInfoVO.setIp (device.getIp ());
|
||||
exceptionDeviceInfoVO.setUpdateTime (device.getUpdateTime ());
|
||||
exceptionDeviceInfoVO.setDevIndex (device.getId ());
|
||||
exceptionDeviceInfoVO.setIp(device.getIp());
|
||||
exceptionDeviceInfoVO.setUpdateTime(device.getUpdateTime());
|
||||
exceptionDeviceInfoVO.setDevIndex(device.getId());
|
||||
|
||||
Line tempdevice = tempDevices.stream ( ).filter (temp -> Objects.equals (temp.getId ( ), device.getId ( ))).collect (Collectors.toList ( )).get (0);
|
||||
Line tempdevice = tempDevices.stream().filter(temp -> Objects.equals(temp.getId(), device.getId())).collect(Collectors.toList()).get(0);
|
||||
|
||||
exceptionDeviceInfoVO.setDevName (tempdevice.getName ());
|
||||
exceptionDeviceInfoVO.setSubIndex (tempdevice.getPid ());
|
||||
Line substation = tempSubstations.stream ( ).filter (temp -> Objects.equals (temp.getId ( ), tempdevice.getPid ( ))).collect (Collectors.toList ( )).get (0);
|
||||
exceptionDeviceInfoVO.setSubName (substation.getName () );
|
||||
exceptionDeviceInfoVO.setDevName(tempdevice.getName());
|
||||
exceptionDeviceInfoVO.setSubIndex(tempdevice.getPid());
|
||||
Line substation = tempSubstations.stream().filter(temp -> Objects.equals(temp.getId(), tempdevice.getPid())).collect(Collectors.toList()).get(0);
|
||||
exceptionDeviceInfoVO.setSubName(substation.getName());
|
||||
|
||||
|
||||
exceptionDeviceInfoVO.setWarningId (data.getId ());
|
||||
exceptionDeviceInfoVO.setWarningType (data.getName ());
|
||||
String exceptionDescription = String.format("%s变电站,%s终端于%s通讯中断",substation.getName (),tempdevice.getName (),device.getUpdateTime ());
|
||||
exceptionDeviceInfoVO.setExceptionDescription (exceptionDescription);
|
||||
exceptionDeviceInfoVOS.add (exceptionDeviceInfoVO);
|
||||
exceptionDeviceInfoVO.setWarningId(data.getId());
|
||||
exceptionDeviceInfoVO.setWarningType(data.getName());
|
||||
String exceptionDescription = String.format("%s变电站,%s终端于%s通讯中断", substation.getName(), tempdevice.getName(), device.getUpdateTime());
|
||||
exceptionDeviceInfoVO.setExceptionDescription(exceptionDescription);
|
||||
exceptionDeviceInfoVOS.add(exceptionDeviceInfoVO);
|
||||
});
|
||||
|
||||
|
||||
return exceptionDeviceInfoVOS;
|
||||
}
|
||||
|
||||
/**
|
||||
* @Description: getDeptDeviceDetail
|
||||
* @Param: [deviceInfoParam]
|
||||
* @return: com.njcn.device.pq.pojo.vo.DeptDeviceDetailVO
|
||||
* @Author: clam
|
||||
* @Date: 2022/11/4
|
||||
*/
|
||||
* @Description: getDeptDeviceDetail
|
||||
* @Param: [deviceInfoParam]
|
||||
* @return: com.njcn.device.pq.pojo.vo.DeptDeviceDetailVO
|
||||
* @Author: clam
|
||||
* @Date: 2022/11/4
|
||||
*/
|
||||
public DeptDeviceDetailVO getDeptDeviceDetail(DeviceInfoParam deviceInfoParam) {
|
||||
|
||||
|
||||
DeptDeviceDetailVO deptDeviceDetailVO =new DeptDeviceDetailVO();
|
||||
DeptDeviceDetailVO deptDeviceDetailVO = new DeptDeviceDetailVO();
|
||||
/*总数*/
|
||||
List<GeneralDeviceDTO> deptDeviceInfos = this.getDeviceInfoAsDept(deviceInfoParam, Stream.of(0,1).collect(Collectors.toList()), Stream.of(1).collect(Collectors.toList()));
|
||||
List<String> DeviceIds = deptDeviceInfos.stream ( ).map (GeneralDeviceDTO::getDeviceIndexes).flatMap (Collection::stream).collect (Collectors.toList ( ));
|
||||
Integer deviceCount = DeviceIds.size ();
|
||||
List<GeneralDeviceDTO> deptDeviceInfos = this.getDeviceInfoAsDept(deviceInfoParam, Stream.of(0, 1).collect(Collectors.toList()), Stream.of(1).collect(Collectors.toList()));
|
||||
List<String> DeviceIds = deptDeviceInfos.stream().map(GeneralDeviceDTO::getDeviceIndexes).flatMap(Collection::stream).collect(Collectors.toList());
|
||||
Integer deviceCount = DeviceIds.size();
|
||||
|
||||
/*实际运行*/
|
||||
QueryWrapper<Device> query = new QueryWrapper<> ();
|
||||
query.in ("Id",DeviceIds).
|
||||
eq ("Run_Flag",0);
|
||||
Integer runDeviceCount = deviceMapper.selectCount (query);
|
||||
BigDecimal rate = BigDecimal.valueOf (runDeviceCount).divide ( BigDecimal.valueOf (deviceCount),4,BigDecimal.ROUND_HALF_UP);
|
||||
deptDeviceDetailVO.setDeviceCount (deviceCount);
|
||||
deptDeviceDetailVO.setRunDeviceCount (runDeviceCount);
|
||||
deptDeviceDetailVO.setOnLineRate (rate);
|
||||
QueryWrapper<Device> query = new QueryWrapper<>();
|
||||
query.in("Id", DeviceIds).
|
||||
eq("Run_Flag", 0);
|
||||
Integer runDeviceCount = deviceMapper.selectCount(query);
|
||||
BigDecimal rate = BigDecimal.valueOf(runDeviceCount).divide(BigDecimal.valueOf(deviceCount), 4, BigDecimal.ROUND_HALF_UP);
|
||||
deptDeviceDetailVO.setDeviceCount(deviceCount);
|
||||
deptDeviceDetailVO.setRunDeviceCount(runDeviceCount);
|
||||
deptDeviceDetailVO.setOnLineRate(rate);
|
||||
return deptDeviceDetailVO;
|
||||
|
||||
}
|
||||
|
||||
public DeptSubstationDetailVO getDeptSubstationDetail(DeviceInfoParam deviceInfoParam) {
|
||||
|
||||
DeptSubstationDetailVO deptSubstationDetailVO = new DeptSubstationDetailVO ();
|
||||
DeptSubstationDetailVO deptSubstationDetailVO = new DeptSubstationDetailVO();
|
||||
|
||||
List<GeneralDeviceDTO> deptDeviceInfos = this.getDeviceInfoAsDept(deviceInfoParam, Stream.of(0,1).collect(Collectors.toList()), Stream.of(1).collect(Collectors.toList()));
|
||||
List<GeneralDeviceDTO> deptDeviceInfos = this.getDeviceInfoAsDept(deviceInfoParam, Stream.of(0, 1).collect(Collectors.toList()), Stream.of(1).collect(Collectors.toList()));
|
||||
|
||||
List<String> DeviceIds = deptDeviceInfos.stream ( ).map (GeneralDeviceDTO::getSubIndexes).flatMap (Collection::stream).collect (Collectors.toList ( ));
|
||||
Integer substationCount = DeviceIds.size ();
|
||||
List<String> DeviceIds = deptDeviceInfos.stream().map(GeneralDeviceDTO::getSubIndexes).flatMap(Collection::stream).collect(Collectors.toList());
|
||||
Integer substationCount = DeviceIds.size();
|
||||
|
||||
Integer count =lineMapper.queryOnlineSubstaion(DeviceIds);
|
||||
deptSubstationDetailVO.setSubstationCount (substationCount);
|
||||
deptSubstationDetailVO.setRunsubstationCount (count);
|
||||
BigDecimal rate = BigDecimal.valueOf (count).divide ( BigDecimal.valueOf (substationCount),4,BigDecimal.ROUND_HALF_UP);
|
||||
deptSubstationDetailVO.setOnLineRate (rate);
|
||||
Integer count = lineMapper.queryOnlineSubstaion(DeviceIds);
|
||||
deptSubstationDetailVO.setSubstationCount(substationCount);
|
||||
deptSubstationDetailVO.setRunsubstationCount(count);
|
||||
BigDecimal rate = BigDecimal.valueOf(count).divide(BigDecimal.valueOf(substationCount), 4, BigDecimal.ROUND_HALF_UP);
|
||||
deptSubstationDetailVO.setOnLineRate(rate);
|
||||
|
||||
return deptSubstationDetailVO;
|
||||
|
||||
@@ -727,10 +727,13 @@ public class GeneralDeviceService {
|
||||
}
|
||||
|
||||
|
||||
public List<String> deptGetRunLine(String deptId){
|
||||
public List<String> deptGetRunLine(String deptId,List<Integer> runFlag) {
|
||||
List<DeptDTO> deptDTOList = deptFeignClient.getDeptDescendantIndexes(deptId, Stream.of(0, 1).collect(Collectors.toList())).getData();
|
||||
if (CollUtil.isNotEmpty(deptDTOList)) {
|
||||
List<String> deptIds = deptDTOList.stream().map(DeptDTO::getId).distinct().collect(Collectors.toList());
|
||||
|
||||
return null;
|
||||
|
||||
return deptLineService.getLineByDeptIds(deptIds,runFlag);
|
||||
}
|
||||
return new ArrayList<>();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
package com.njcn.device.pq.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.njcn.device.biz.pojo.po.Overlimit;
|
||||
import com.njcn.device.pq.mapper.OverlimitMapper;
|
||||
import com.njcn.device.pq.service.IOverLimitService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* pqs
|
||||
*
|
||||
* @author cdf
|
||||
* @date 2023/6/7
|
||||
*/
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class OverLimitServiceImpl extends ServiceImpl<OverlimitMapper, Overlimit> implements IOverLimitService {
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user