1.在线监测详情接口

2.在线监测查询接口调整
This commit is contained in:
xy
2024-07-09 10:15:23 +08:00
parent 6ec0ef54e9
commit 1af8fcc72f
15 changed files with 599 additions and 42 deletions

View File

@@ -12,12 +12,11 @@ import com.njcn.harmonic.pojo.vo.RStatLimitTargetVO;
import com.njcn.harmonic.service.majornetwork.RStatLimitService;
import com.njcn.web.controller.BaseController;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
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 java.util.List;
@@ -64,4 +63,19 @@ public class RStatLimitController extends BaseController {
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
}
@PostMapping("/getOverData")
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
@ApiOperation("查询单监测点超标数据")
@ApiImplicitParams({
@ApiImplicitParam(name = "lineId", value = "监测点id"),
@ApiImplicitParam(name = "startTime", value = "开始时间"),
@ApiImplicitParam(name = "endTime", value = "结束时间"),
@ApiImplicitParam(name = "type", value = "指标"),
})
public HttpResult<List<RStatLimitRateDPO>> getOverData(@RequestParam("lineId") String lineId, @RequestParam("startTime") String startTime, @RequestParam("endTime") String endTime, @RequestParam("type") Integer type) {
String methodDescribe = getMethodDescribe("getOverData");
List<RStatLimitRateDPO> result = rStatLimitService.getOverData(lineId,startTime,endTime,type);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
}
}

View File

@@ -5,6 +5,7 @@ import com.njcn.device.pq.pojo.vo.GridDiagramVO;
import com.njcn.harmonic.pojo.po.day.RStatLimitRateDPO;
import com.njcn.harmonic.pojo.po.day.RStatLimitTargetDPO;
import com.njcn.harmonic.pojo.vo.RStatLimitTargetVO;
import org.springframework.web.bind.annotation.RequestParam;
import java.util.List;
@@ -43,4 +44,6 @@ public interface RStatLimitService {
* @return
*/
List<GridDiagramVO.RunData> getGridDiagramRunData(DeviceInfoParam.BusinessParam param);
List<RStatLimitRateDPO> getOverData(String lineId, String startTime, String endTime, Integer type);
}

View File

@@ -2,10 +2,12 @@ package com.njcn.harmonic.service.majornetwork.impl;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.lang.func.Func;
import cn.hutool.core.util.NumberUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.njcn.common.pojo.dto.SimpleDTO;
import com.njcn.device.biz.commApi.CommTerminalGeneralClient;
import com.njcn.device.biz.pojo.dto.DeptGetSubStationDTO;
@@ -21,6 +23,7 @@ import com.njcn.device.pq.pojo.vo.RStatOnlinerateVO;
import com.njcn.harmonic.mapper.RStatLimitRateDMapper;
import com.njcn.harmonic.mapper.RStatLimitTargetDMapper;
import com.njcn.harmonic.pojo.param.StatSubstationBizBaseParam;
import com.njcn.harmonic.pojo.po.RMpVThd;
import com.njcn.harmonic.pojo.po.day.RStatLimitRateDPO;
import com.njcn.harmonic.pojo.po.day.RStatLimitTargetDPO;
import com.njcn.harmonic.pojo.vo.RStatLimitTargetVO;
@@ -133,7 +136,7 @@ public class RStatLimitServiceImpl implements RStatLimitService {
for (GeneralDeviceDTO dto : topList) {
lineData=new GridDiagramVO.LineData();
lineData.setOrgId(dto.getIndex());
lineData.setOrgName(dto.getName()+"\n("+dto.getLineIndexes().size()+")");
lineData.setOrgName(dto.getName()+"("+dto.getLineIndexes().size()+")");
onLineAndIntegrity(dto.getLineIndexes(), integrityList, dto.getDeviceIndexes(), onlineRateList,limitTargetList, lineData);
info.add(lineData);
}
@@ -142,7 +145,7 @@ public class RStatLimitServiceImpl implements RStatLimitService {
List<String> otherLineIds = otherList.stream().flatMap(x -> x.getLineIndexes().stream()).distinct().collect(Collectors.toList());
lineData=new GridDiagramVO.LineData();
lineData.setOrgId("123456");
lineData.setOrgName("其他\n("+otherLineIds.size()+")");
lineData.setOrgName("其他("+otherLineIds.size()+")");
onLineAndIntegrity(otherLineIds, integrityList, otherDevIds, onlineRateList,limitTargetList, lineData);
info.add(lineData);
}
@@ -308,6 +311,94 @@ public class RStatLimitServiceImpl implements RStatLimitService {
return info;
}
@Override
public List<RStatLimitRateDPO> getOverData(String lineId, String startTime, String endTime, Integer type) {
QueryWrapper<RStatLimitRateDPO> queryWrapper = new QueryWrapper<>();
queryWrapper.lambda()
.eq(RStatLimitRateDPO::getLineId,lineId)
.between(RStatLimitRateDPO::getTime,startTime,endTime)
.groupBy(RStatLimitRateDPO::getTime);
//频率偏差
if (type == 1) {
queryWrapper.select("time_id time,max(freq_dev_overtime) freq_dev_overtime");
queryWrapper.lambda().gt(RStatLimitRateDPO::getFreqDevOvertime,0);
}
//电压偏差
else if (type == 2) {
queryWrapper.select("time_id time,max(voltage_dev_overtime) voltage_dev_overtime");
queryWrapper.lambda().gt(RStatLimitRateDPO::getVoltageDevOvertime,0);
}
//长时闪变
else if (type == 3) {
queryWrapper.select("time_id time,max(flicker_overtime) flicker_overtime");
queryWrapper.lambda().gt(RStatLimitRateDPO::getFlickerOvertime,0);
}
//电压总谐波畸变率
else if (type == 4) {
queryWrapper.select("time_id time,max(uaberrance_overtime) uaberrance_overtime");
queryWrapper.lambda().gt(RStatLimitRateDPO::getUaberranceOvertime,0);
}
//负序电压不平衡度
else if (type == 5) {
queryWrapper.select("time_id time,max(ubalance_overtime) ubalance_overtime");
queryWrapper.lambda().gt(RStatLimitRateDPO::getUbalanceOvertime,0);
}
//负序电流
else if (type == 6) {
queryWrapper.select("time_id time,max(i_neg_overtime) i_neg_overtime");
queryWrapper.lambda().gt(RStatLimitRateDPO::getINegOvertime,0);
}
//谐波电压含有率
else if (type == 7) {
StringBuilder selectSql = new StringBuilder();
StringBuilder havingSql = new StringBuilder();
for (int i = 2; i <=25 ; i++) {
selectSql.append("max(uharm_").append(i).append("_overtime) uharm_").append(i).append("_overtime,");
if (i == 25) {
havingSql.append("uharm_").append(i).append("_overtime");
} else {
havingSql.append("uharm_").append(i).append("_overtime + ");
}
}
selectSql.append("time_id time");
havingSql = new StringBuilder("sum(" + havingSql + ")");
queryWrapper.select(selectSql.toString()).having(havingSql.toString(),0);
}
//谐波电流
else if (type == 8) {
StringBuilder selectSql = new StringBuilder();
StringBuilder havingSql = new StringBuilder();
for (int i = 2; i <=25 ; i++) {
selectSql.append("max(iharm_").append(i).append("_overtime) iharm_").append(i).append("_overtime,");
if (i == 25) {
havingSql.append("iharm_").append(i).append("_overtime");
} else {
havingSql.append("iharm_").append(i).append("_overtime + ");
}
}
selectSql.append("time_id time");
havingSql = new StringBuilder("sum(" + havingSql + ")");
queryWrapper.select(selectSql.toString()).having(havingSql.toString(),0);
}
//间谐波电压
else if (type == 9) {
StringBuilder selectSql = new StringBuilder();
StringBuilder havingSql = new StringBuilder();
for (int i = 1; i <=16 ; i++) {
selectSql.append("max(inuharm_").append(i).append("_overtime) inuharm_").append(i).append("_overtime,");
if (i == 16) {
havingSql.append("inuharm_").append(i).append("_overtime");
} else {
havingSql.append("inuharm_").append(i).append("_overtime + ");
}
}
selectSql.append("time_id time");
havingSql = new StringBuilder("sum(" + havingSql + ")");
queryWrapper.select(selectSql.toString()).having(havingSql.toString(),0);
}
return rStatLimitRateDMapper.selectList(queryWrapper);
}
private void onLineAndIntegrity(List<String> lineIds, List<RStatIntegrityD> onIntegrityByIds, List<String> devIds, List<RStatOnlinerateVO> onlineRateByDevIds,List<RStatLimitTargetDPO> limitTargetList, GridDiagramVO.LineData lineData) {
//监测完整率
List<RStatIntegrityD> integrityDS = onIntegrityByIds.stream().filter(x -> lineIds.contains(x.getLineIndex())).collect(Collectors.toList());