1.灿能云接口移植,代码调整

This commit is contained in:
wr
2024-01-04 16:15:57 +08:00
parent 3b922aa7b3
commit 2769afa5e6
9 changed files with 764 additions and 42 deletions

View File

@@ -16,12 +16,12 @@ import lombok.Setter;
* </p>
*
* @author wr
* @since 2024-01-03
* @since 2024-01-04
*/
@Getter
@Setter
@TableName("app_statistics")
public class AppStatistics extends BaseEntity {
public class AppStatistics {
private static final long serialVersionUID = 1L;
@@ -37,165 +37,327 @@ public class AppStatistics extends BaseEntity {
@MppMultiId("Time_Id")
private LocalDateTime timeId;
/**
* 暂降次数
*/
@TableField("Event_Count")
private Boolean eventCount;
private Integer eventCount;
/**
* 频率偏差合格率
*/
@TableField("Freq_Dev_Rate")
private Float freqDevRate;
/**
* 电压偏差合格率
*/
@TableField("Voltage_Dev_Rate")
private Float voltageDevRate;
/**
* 电压不平衡合格率
*/
@TableField("Ubalance_Rate")
private Float ubalanceRate;
@TableField("FLICKER_Rate")
/**
* 闪变合格率
*/
@TableField("Flicker_Rate")
private Float flickerRate;
@TableField("UABERRANCE_Rate")
/**
* 电压谐波畸变率合格率
*/
@TableField("Uaberrance_Rate")
private Float uaberranceRate;
/**
* 2次电压谐波含有率合格率
*/
@TableField("Uharm_2_Rate")
private Float uharm2Rate;
/**
* 3次电压谐波含有率合格率
*/
@TableField("Uharm_3_Rate")
private Float uharm3Rate;
/**
* 4次电压谐波含有率合格率
*/
@TableField("Uharm_4_Rate")
private Float uharm4Rate;
/**
* 5次电压谐波含有率合格率
*/
@TableField("Uharm_5_Rate")
private Float uharm5Rate;
/**
* 6次电压谐波含有率合格率
*/
@TableField("Uharm_6_Rate")
private Float uharm6Rate;
/**
* 7次电压谐波含有率合格率
*/
@TableField("Uharm_7_Rate")
private Float uharm7Rate;
/**
* 8次电压谐波含有率合格率
*/
@TableField("Uharm_8_Rate")
private Float uharm8Rate;
/**
* 9次电压谐波含有率合格率
*/
@TableField("Uharm_9_Rate")
private Float uharm9Rate;
/**
* 10次电压谐波含有率合格率
*/
@TableField("Uharm_10_Rate")
private Float uharm10Rate;
/**
* 11次电压谐波含有率合格率
*/
@TableField("Uharm_11_Rate")
private Float uharm11Rate;
/**
* 12次电压谐波含有率合格率
*/
@TableField("Uharm_12_Rate")
private Float uharm12Rate;
/**
* 13次电压谐波含有率合格率
*/
@TableField("Uharm_13_Rate")
private Float uharm13Rate;
/**
* 14次电压谐波含有率合格率
*/
@TableField("Uharm_14_Rate")
private Float uharm14Rate;
/**
* 15次电压谐波含有率合格率
*/
@TableField("Uharm_15_Rate")
private Float uharm15Rate;
/**
* 16次电压谐波含有率合格率
*/
@TableField("Uharm_16_Rate")
private Float uharm16Rate;
/**
* 17次电压谐波含有率合格率
*/
@TableField("Uharm_17_Rate")
private Float uharm17Rate;
/**
* 18次电压谐波含有率合格率
*/
@TableField("Uharm_18_Rate")
private Float uharm18Rate;
/**
* 19次电压谐波含有率合格率
*/
@TableField("Uharm_19_Rate")
private Float uharm19Rate;
/**
* 20次电压谐波含有率合格率
*/
@TableField("Uharm_20_Rate")
private Float uharm20Rate;
/**
* 21次电压谐波含有率合格率
*/
@TableField("Uharm_21_Rate")
private Float uharm21Rate;
/**
* 22次电压谐波含有率合格率
*/
@TableField("Uharm_22_Rate")
private Float uharm22Rate;
/**
* 23次电压谐波含有率合格率
*/
@TableField("Uharm_23_Rate")
private Float uharm23Rate;
/**
* 24次电压谐波含有率合格率
*/
@TableField("Uharm_24_Rate")
private Float uharm24Rate;
/**
* 25次电压谐波含有率合格率
*/
@TableField("Uharm_25_Rate")
private Float uharm25Rate;
/**
* 2次电流谐波幅值合格率
*/
@TableField("Iharm_2_Rate")
private Float iharm2Rate;
/**
* 3次电流谐波幅值合格率
*/
@TableField("Iharm_3_Rate")
private Float iharm3Rate;
/**
* 4次电流谐波幅值合格率
*/
@TableField("Iharm_4_Rate")
private Float iharm4Rate;
/**
* 5次电流谐波幅值合格率
*/
@TableField("Iharm_5_Rate")
private Float iharm5Rate;
/**
* 6次电流谐波幅值合格率
*/
@TableField("Iharm_6_Rate")
private Float iharm6Rate;
/**
* 7次电流谐波幅值合格率
*/
@TableField("Iharm_7_Rate")
private Float iharm7Rate;
/**
* 8次电流谐波幅值合格率
*/
@TableField("Iharm_8_Rate")
private Float iharm8Rate;
/**
* 9次电流谐波幅值合格率
*/
@TableField("Iharm_9_Rate")
private Float iharm9Rate;
/**
* 10次电流谐波幅值合格率
*/
@TableField("Iharm_10_Rate")
private Float iharm10Rate;
/**
* 11次电流谐波幅值合格率
*/
@TableField("Iharm_11_Rate")
private Float iharm11Rate;
/**
* 12次电流谐波幅值合格率
*/
@TableField("Iharm_12_Rate")
private Float iharm12Rate;
/**
* 13次电流谐波幅值合格率
*/
@TableField("Iharm_13_Rate")
private Float iharm13Rate;
/**
* 14次电流谐波幅值合格率
*/
@TableField("Iharm_14_Rate")
private Float iharm14Rate;
/**
* 15次电流谐波幅值合格率
*/
@TableField("Iharm_15_Rate")
private Float iharm15Rate;
/**
* 16次电流谐波幅值合格率
*/
@TableField("Iharm_16_Rate")
private Float iharm16Rate;
/**
* 17次电流谐波幅值合格率
*/
@TableField("Iharm_17_Rate")
private Float iharm17Rate;
/**
* 18次电流谐波幅值合格率
*/
@TableField("Iharm_18_Rate")
private Float iharm18Rate;
/**
* 19次电流谐波幅值合格率
*/
@TableField("Iharm_19_Rate")
private Float iharm19Rate;
/**
* 20次电流谐波幅值合格率
*/
@TableField("Iharm_20_Rate")
private Float iharm20Rate;
/**
* 21次电流谐波幅值合格率
*/
@TableField("Iharm_21_Rate")
private Float iharm21Rate;
/**
* 22次电流谐波幅值合格率
*/
@TableField("Iharm_22_Rate")
private Float iharm22Rate;
/**
* 23次电流谐波幅值合格率
*/
@TableField("Iharm_23_Rate")
private Float iharm23Rate;
/**
* 24次电流谐波幅值合格率
*/
@TableField("Iharm_24_Rate")
private Float iharm24Rate;
/**
* 25次电流谐波幅值合格率
*/
@TableField("Iharm_25_Rate")
private Float iharm25Rate;

View File

@@ -1,16 +1,31 @@
package com.njcn.cloud.pojo.vo;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.time.LocalDateTime;
/**
* @author gbl
* @author wr
* @description:统计数据
*/
@Data
public class StatisticsData {
public class StatisticsData{
private static final long serialVersionUID = 1L;
@ApiModelProperty("监测点名称")
private String lineName;
private Long time;
@ApiModelProperty("统计时间")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private LocalDateTime time;
@ApiModelProperty("暂态信息描述")
private String eventDescribe;
@ApiModelProperty("稳态信息描述")
private String steadyDescribe;

View File

@@ -5,7 +5,7 @@ import lombok.Data;
import java.util.List;
/**
* @author gbl
* @author wr
* @description:统计数据详细信息
*/
@Data

View File

@@ -3,7 +3,7 @@ package com.njcn.cloud.pojo.vo;
import lombok.Data;
/**
* @author gbl
* @author wr
* @description:统计数据暂降信息
*/
@Data

View File

@@ -1,12 +1,24 @@
package com.njcn.cloud.controller.statistics;
import com.njcn.cloud.pojo.vo.StatisticsData;
import com.njcn.cloud.pojo.vo.StatisticsDetail;
import com.njcn.cloud.service.IAppStatisticsService;
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
import com.njcn.common.pojo.response.HttpResult;
import com.njcn.common.utils.HttpResultUtil;
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.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.njcn.web.controller.BaseController;
import java.util.Date;
import javax.servlet.http.HttpServletRequest;
import java.util.List;
/**
@@ -19,7 +31,50 @@ import java.util.List;
*/
@RestController
@RequestMapping("/appStatistics")
@Api(tags = "统计数据")
@RequiredArgsConstructor
public class StatisticsController extends BaseController {
private final IAppStatisticsService appStatisticsService;
/**
* @param lineIndex 监测点ID
* @param page 当前页数
* @param num 每页数量
* @description: 统计数据
* @author wr
*/
@PostMapping("/statistics")
@ApiImplicitParams({
@ApiImplicitParam(name = "lineIndex", value = "监测点ID", required = true, paramType = "query"),
@ApiImplicitParam(name = "startTime", value = "查询的开始时间", paramType = "query"),
@ApiImplicitParam(name = "endTime", value = "查询的结束时间", paramType = "query"),
@ApiImplicitParam(name = "page", value = "当前页", required = true, paramType = "query"),
@ApiImplicitParam(name = "num", value = "每页数量", required = true, paramType = "query")
})
@ApiOperation(value = "统计数据", notes = "统计数据")
public HttpResult<List<StatisticsData>> statistics(String lineIndex, String startTime, String endTime, int page, int num, HttpServletRequest request) {
String methodDescribe = getMethodDescribe("statistics");
List<StatisticsData> statisticsData = appStatisticsService.queryData(lineIndex, startTime, endTime, page, num);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, statisticsData, methodDescribe);
}
/**
* @param lineIndex 监测点ID
* @param timeID 统计时间
* @description: 统计数据详情
* @author wr
*/
@PostMapping("/statisticsDetail")
@ApiImplicitParams({
@ApiImplicitParam(name = "lineIndex", value = "监测点ID", required = true, paramType = "query"),
@ApiImplicitParam(name = "timeID", value = "统计时间", required = true, paramType = "query")
})
@ApiOperation(value = "统计数据详情", notes = "统计数据详情")
public HttpResult<StatisticsDetail> statisticsDetail(String lineIndex, String timeID) {
String methodDescribe = getMethodDescribe("statistics");
StatisticsDetail statisticsDetail = appStatisticsService.queryDetail(lineIndex, timeID);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, statisticsDetail, methodDescribe);
}
}

View File

@@ -7,16 +7,14 @@ import cn.hutool.core.date.LocalDateTimeUtil;
import cn.hutool.core.util.IdUtil;
import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.njcn.cloud.pojo.dto.AppDevMsg;
import com.njcn.cloud.pojo.dto.AppSteadyAss;
import com.njcn.cloud.pojo.dto.AppSteadyUrl;
import com.njcn.cloud.service.IAppDevMsgService;
import com.njcn.cloud.service.IAppSteadyAssService;
import com.njcn.cloud.service.IAppSteadyUrlService;
import com.njcn.cloud.service.MsgService;
import com.njcn.cloud.pojo.dto.*;
import com.njcn.cloud.service.*;
import com.njcn.device.pq.api.GeneralDeviceInfoClient;
import com.njcn.device.pq.pojo.param.OnlineRateParam;
import com.njcn.device.pq.pojo.po.TopMsgPO;
import com.njcn.event.api.EventDetailFeignClient;
import com.njcn.event.pojo.param.EventCountParam;
import com.njcn.event.pojo.po.RmpEventDetailPO;
import com.njcn.harmonic.api.HarmDataFeignClient;
import com.njcn.harmonic.pojo.param.StatSubstationBizBaseParam;
import com.njcn.harmonic.pojo.po.day.RStatLimitRateDPO;
@@ -25,8 +23,11 @@ import com.njcn.user.pojo.po.User;
import lombok.RequiredArgsConstructor;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.*;
import java.util.stream.Collectors;
@Component
@RequiredArgsConstructor
@@ -39,11 +40,14 @@ public class SteadyMsgTask {
private final IAppSteadyUrlService appSteadyUrlService;
private final IAppSteadyAssService appSteadyAssService;
private final IAppDevMsgService appDevMsgService;
private final EventDetailFeignClient eventDetailFeignClient;
private final IAppStatisticsService appStatisticsService;
private final IAppEventInfoService appEventInfoService;
@Scheduled(cron = "0 0 10 * * ?")
public void timer() {
System.out.println("开始执行++++++++++++++++++++++++"+new Date());
Date date = DateUtil.offsetDay(new Date(), -1);
System.out.println("开始执行++++++++++++++++++++++++" + new Date());
Date date = DateUtil.offsetDay(new Date(), -1);
String time = DateUtil.format(date, DatePattern.NORM_DATE_PATTERN);
//开始时间
@@ -52,41 +56,44 @@ public class SteadyMsgTask {
String endTime = DateUtil.endOfDay(date).toString();
//执行稳态消息推送
steadyMsg(time,startTime,endTime);
steadyMsg(time, startTime, endTime);
//终端消息推送
devDegree(time,startTime,endTime);
devDegree(time, startTime, endTime);
//统计消息推送
statisticsData(time, startTime, endTime);
}
/**
* @Description: 稳态消息
* @Date: 2023/11/17 15:07
*/
public void steadyMsg(String time,String startTime,String endTime) {
public void steadyMsg(String time, String startTime, String endTime) {
List<User> users = userFeignClient.getUserByIdList(new ArrayList<>()).getData();
// List<User> users = userFeignClient.getUserByIdList(Arrays.asList("5434cc08dc9d4b7cba5e856de52f0dda")).getData();
if(CollUtil.isNotEmpty(users)){
if (CollUtil.isNotEmpty(users)) {
StatSubstationBizBaseParam param;
for (User user : users) {
//根据单位获取投运监测点
List<String> lineIds = generalDeviceInfoClient.deptGetRunLine(user.getDeptId()).getData();
param=new StatSubstationBizBaseParam();
param = new StatSubstationBizBaseParam();
param.setIds(lineIds);
param.setStartTime(startTime);
param.setEndTime(endTime);
List<String> linesTargets = harmDataFeignClient.getLinesTarget(param).getData();
if(CollUtil.isNotEmpty(linesTargets)){
if (CollUtil.isNotEmpty(linesTargets)) {
param.setIds(linesTargets);
List<RStatLimitRateDPO> limitRates = harmDataFeignClient.getLinesRate(param).getData();
//获取稳态消息guid
String msgIndex = msgService.sendSteadyMsg(user.getId(), time, linesTargets.size());
LocalDateTime date = LocalDateTimeUtil.parse(time,DatePattern.NORM_DATE_PATTERN);
LocalDateTime date = LocalDateTimeUtil.parse(time, DatePattern.NORM_DATE_PATTERN);
AppSteadyAss steadyAss;
for (RStatLimitRateDPO line : limitRates) {
steadyAss=new AppSteadyAss();
steadyAss = new AppSteadyAss();
steadyAss.setSteadyIndex(msgIndex);
steadyAss.setLineIndex(line.getLineId());
steadyAss.setTimeId(date);
appSteadyAssService.save(steadyAss);
saveSteadyUrl(line,date);
saveSteadyUrl(line, date);
}
}
@@ -98,14 +105,14 @@ public class SteadyMsgTask {
* @Description: 新增终端异常通告
* @Date: 2023/11/17 15:08
*/
public void devDegree(String time,String startTime,String endTime){
LocalDateTime date = LocalDateTimeUtil.parse(time,DatePattern.NORM_DATE_PATTERN);
public void devDegree(String time, String startTime, String endTime) {
LocalDateTime date = LocalDateTimeUtil.parse(time, DatePattern.NORM_DATE_PATTERN);
List<User> users = userFeignClient.getUserByIdList(new ArrayList<>()).getData();
if(CollUtil.isNotEmpty(users)){
if (CollUtil.isNotEmpty(users)) {
for (User user : users) {
List<String> devIds = generalDeviceInfoClient.deptGetRunDev(user.getDeptId()).getData();
//获取消息信息
OnlineRateParam top=new OnlineRateParam();
OnlineRateParam top = new OnlineRateParam();
top.setIds(devIds);
top.setType(1);
top.setStartTime(startTime);
@@ -113,17 +120,17 @@ public class SteadyMsgTask {
List<TopMsgPO> topMsgList = generalDeviceInfoClient.getTopMsgInfoByIds(top).getData();
AppDevMsg appDevMsg;
for (TopMsgPO topMsgPO : topMsgList) {
appDevMsg=new AppDevMsg();
appDevMsg = new AppDevMsg();
appDevMsg.setDevmsgIndex(IdUtil.simpleUUID());
appDevMsg.setTopId(topMsgPO.getTopId());
appDevMsg.setUserIndex(user.getId());
appDevMsg.setTimeId(date);
appDevMsg.setState(0);
appDevMsgService.save(appDevMsg);
msgService.sendTerminalMsg(user.getId(),user.getDevCode(),time,
topMsgPO.getDeviceAbnormalNum(),
topMsgPO.getAlarmCount(),
topMsgPO.getComOutCount()
msgService.sendTerminalMsg(user.getId(), user.getDevCode(), time,
topMsgPO.getDeviceAbnormalNum(),
topMsgPO.getAlarmCount(),
topMsgPO.getComOutCount()
);
}
@@ -131,9 +138,104 @@ public class SteadyMsgTask {
}
}
/**
* @param
* @Description: 统计数据
* @Author: wr
* @Date: 2024/1/4 13:48
*/
public void statisticsData(String time, String startTime, String endTime) {
LocalDateTime timeDay = LocalDateTimeUtil.parse(time, DatePattern.NORM_DATE_PATTERN);
List<User> users = userFeignClient.getUserByIdList(new ArrayList<>()).getData();
// List<User> users = userFeignClient.getUserByIdList(Arrays.asList("5434cc08dc9d4b7cba5e856de52f0dda")).getData();
if (CollUtil.isNotEmpty(users)) {
StatSubstationBizBaseParam baseParam;
EventCountParam param;
for (User user : users) {
//根据单位获取投运监测点
List<String> lineIds = generalDeviceInfoClient.deptGetRunLine(user.getDeptId()).getData();
//1.根据监测点层级进行统计数据
for (String lineId : lineIds) {
List<AppStatistics> list = appStatisticsService.list(new LambdaQueryWrapper<AppStatistics>()
.eq(AppStatistics::getLineIndex, lineId)
);
List<String> eventIndexS = new ArrayList<>();
//2.查询数据库中是否有统计数据,没有则进行补录
if (CollUtil.isNotEmpty(list)) {
eventIndexS.addAll(statisticsMethod(startTime, endTime, timeDay, lineId));
} else {
List<String> dates = getListDate(lineId);
for (String date : dates) {
LocalDateTime dateDay = LocalDateTimeUtil.parse(date, DatePattern.NORM_DATE_PATTERN);
String startDate = DateUtil.beginOfDay(DateUtil.parse(date)).toString();
String endDate = DateUtil.endOfDay(DateUtil.parse(date)).toString();
eventIndexS.addAll(statisticsMethod(startDate, endDate, dateDay, lineId));
}
}
saveEventInfo(eventIndexS);
}
}
}
}
/**
* 获取暂态时间和谐波时间
*
* @param lineId
* @return
*/
private List<String> getListDate(String lineId) {
EventCountParam param;
StatSubstationBizBaseParam baseParam;
List<String> dates = new ArrayList<>();
baseParam = new StatSubstationBizBaseParam();
baseParam.setIds(Collections.singletonList(lineId));
//获取谐波数据
List<RStatLimitRateDPO> limitRates = harmDataFeignClient.getLinesRate(baseParam).getData();
if (CollUtil.isNotEmpty(limitRates)) {
dates.addAll(limitRates.stream().map(x -> x.getTime().format(DateTimeFormatter.ofPattern(DatePattern.NORM_DATE_PATTERN)))
.distinct().collect(Collectors.toList()));
}
param = new EventCountParam();
param.setIds(Collections.singletonList(lineId));
List<RmpEventDetailPO> detailPOList = eventDetailFeignClient.getAppEventDetailLtAmplitude(param).getData();
if (CollUtil.isNotEmpty(limitRates)) {
dates.addAll(detailPOList.stream().map(x -> x.getStartTime().format(DateTimeFormatter.ofPattern(DatePattern.NORM_DATE_PATTERN)))
.distinct().collect(Collectors.toList()));
}
return dates;
}
/**
* 查询方法信息
*
* @param startTime
* @param endTime
* @param timeDay
* @param lineId
*/
private List<String> statisticsMethod(String startTime, String endTime, LocalDateTime timeDay, String lineId) {
EventCountParam param;
StatSubstationBizBaseParam baseParam;
//获取谐波数据
baseParam = new StatSubstationBizBaseParam();
baseParam.setIds(Collections.singletonList(lineId));
baseParam.setStartTime(startTime);
baseParam.setEndTime(endTime);
List<RStatLimitRateDPO> limitRates = harmDataFeignClient.getLinesRate(baseParam).getData();
//获取暂态数据
param = new EventCountParam();
param.setIds(Collections.singletonList(lineId));
param.setStartTime(startTime);
param.setEndTime(endTime);
//获取特征增幅小于0.9的暂态信息
List<RmpEventDetailPO> detailPOList = eventDetailFeignClient.getAppEventDetailLtAmplitude(param).getData();
saveStatistics(lineId, timeDay, detailPOList.size(), limitRates.get(0));
return detailPOList.stream().map(RmpEventDetailPO::getEventId).distinct().collect(Collectors.toList());
}
public void saveSteadyUrl(RStatLimitRateDPO limit, LocalDateTime timeId) {
String lineIndex=limit.getLineId();
String lineIndex = limit.getLineId();
if (limit.getFreqDevOvertime() > 0) {
insertUrlDate(lineIndex, timeId, 2, limit.getFreqDevOvertime());
}
@@ -294,6 +396,7 @@ public class SteadyMsgTask {
insertUrlDate(lineIndex, timeId, 54, limit.getIharm25Overtime());
}
}
public void insertUrlDate(String lineIndex, LocalDateTime timeId, Integer typeCode, Integer limitNum) {
AppSteadyUrl url = new AppSteadyUrl();
url.setLineIndex(lineIndex);
@@ -310,4 +413,92 @@ public class SteadyMsgTask {
appSteadyUrlService.save(url);
}
}
public void saveStatistics(String lineIndex, LocalDateTime time, Integer count, RStatLimitRateDPO limit) {
List<AppStatistics> list = appStatisticsService.list(new LambdaQueryWrapper<AppStatistics>()
.eq(AppStatistics::getLineIndex, lineIndex)
.eq(AppStatistics::getTimeId, time)
);
if (CollUtil.isEmpty(list)) {
AppStatistics statistics = new AppStatistics();
statistics.setLineIndex(lineIndex);
statistics.setTimeId(time);
statistics.setEventCount(count);
if (ObjectUtil.isNotNull(limit)) {
if (limit.getAllTime() > 0) {
Integer times = limit.getAllTime();
statistics.setFreqDevRate((float) Math.round((times - limit.getFreqDevOvertime()) * 10000 / times) / 100);
statistics.setVoltageDevRate((float) Math.round((times - limit.getVoltageDevOvertime()) * 10000 / times) / 100);
statistics.setUbalanceRate((float) Math.round((times - limit.getUbalanceOvertime()) * 10000 / times) / 100);
statistics.setFlickerRate((float) Math.round((times - limit.getFlickerOvertime()) * 10000 / times) / 100);
statistics.setUaberranceRate((float) Math.round((times - limit.getUaberranceOvertime()) * 10000 / times) / 100);
statistics.setUharm2Rate((float) Math.round((times - limit.getUharm2Overtime()) * 10000 / times) / 100);
statistics.setUharm3Rate((float) Math.round((times - limit.getUharm3Overtime()) * 10000 / times) / 100);
statistics.setUharm4Rate((float) Math.round((times - limit.getUharm4Overtime()) * 10000 / times) / 100);
statistics.setUharm5Rate((float) Math.round((times - limit.getUharm5Overtime()) * 10000 / times) / 100);
statistics.setUharm6Rate((float) Math.round((times - limit.getUharm6Overtime()) * 10000 / times) / 100);
statistics.setUharm7Rate((float) Math.round((times - limit.getUharm7Overtime()) * 10000 / times) / 100);
statistics.setUharm8Rate((float) Math.round((times - limit.getUharm8Overtime()) * 10000 / times) / 100);
statistics.setUharm9Rate((float) Math.round((times - limit.getUharm9Overtime()) * 10000 / times) / 100);
statistics.setUharm10Rate((float) Math.round((times - limit.getUharm10Overtime()) * 10000 / times) / 100);
statistics.setUharm11Rate((float) Math.round((times - limit.getUharm11Overtime()) * 10000 / times) / 100);
statistics.setUharm12Rate((float) Math.round((times - limit.getUharm12Overtime()) * 10000 / times) / 100);
statistics.setUharm13Rate((float) Math.round((times - limit.getUharm13Overtime()) * 10000 / times) / 100);
statistics.setUharm14Rate((float) Math.round((times - limit.getUharm14Overtime()) * 10000 / times) / 100);
statistics.setUharm15Rate((float) Math.round((times - limit.getUharm15Overtime()) * 10000 / times) / 100);
statistics.setUharm16Rate((float) Math.round((times - limit.getUharm16Overtime()) * 10000 / times) / 100);
statistics.setUharm17Rate((float) Math.round((times - limit.getUharm17Overtime()) * 10000 / times) / 100);
statistics.setUharm18Rate((float) Math.round((times - limit.getUharm18Overtime()) * 10000 / times) / 100);
statistics.setUharm19Rate((float) Math.round((times - limit.getUharm19Overtime()) * 10000 / times) / 100);
statistics.setUharm20Rate((float) Math.round((times - limit.getUharm20Overtime()) * 10000 / times) / 100);
statistics.setUharm21Rate((float) Math.round((times - limit.getUharm21Overtime()) * 10000 / times) / 100);
statistics.setUharm22Rate((float) Math.round((times - limit.getUharm22Overtime()) * 10000 / times) / 100);
statistics.setUharm23Rate((float) Math.round((times - limit.getUharm23Overtime()) * 10000 / times) / 100);
statistics.setUharm24Rate((float) Math.round((times - limit.getUharm24Overtime()) * 10000 / times) / 100);
statistics.setUharm25Rate((float) Math.round((times - limit.getUharm25Overtime()) * 10000 / times) / 100);
statistics.setIharm2Rate((float) Math.round((times - limit.getIharm2Overtime()) * 10000 / times) / 100);
statistics.setIharm3Rate((float) Math.round((times - limit.getIharm3Overtime()) * 10000 / times) / 100);
statistics.setIharm4Rate((float) Math.round((times - limit.getIharm4Overtime()) * 10000 / times) / 100);
statistics.setIharm5Rate((float) Math.round((times - limit.getIharm5Overtime()) * 10000 / times) / 100);
statistics.setIharm6Rate((float) Math.round((times - limit.getIharm6Overtime()) * 10000 / times) / 100);
statistics.setIharm7Rate((float) Math.round((times - limit.getIharm7Overtime()) * 10000 / times) / 100);
statistics.setIharm8Rate((float) Math.round((times - limit.getIharm8Overtime()) * 10000 / times) / 100);
statistics.setIharm9Rate((float) Math.round((times - limit.getIharm9Overtime()) * 10000 / times) / 100);
statistics.setIharm10Rate((float) Math.round((times - limit.getIharm10Overtime()) * 10000 / times) / 100);
statistics.setIharm11Rate((float) Math.round((times - limit.getIharm11Overtime()) * 10000 / times) / 100);
statistics.setIharm12Rate((float) Math.round((times - limit.getIharm12Overtime()) * 10000 / times) / 100);
statistics.setIharm13Rate((float) Math.round((times - limit.getIharm13Overtime()) * 10000 / times) / 100);
statistics.setIharm14Rate((float) Math.round((times - limit.getIharm14Overtime()) * 10000 / times) / 100);
statistics.setIharm15Rate((float) Math.round((times - limit.getIharm15Overtime()) * 10000 / times) / 100);
statistics.setIharm16Rate((float) Math.round((times - limit.getIharm16Overtime()) * 10000 / times) / 100);
statistics.setIharm17Rate((float) Math.round((times - limit.getIharm17Overtime()) * 10000 / times) / 100);
statistics.setIharm18Rate((float) Math.round((times - limit.getIharm18Overtime()) * 10000 / times) / 100);
statistics.setIharm19Rate((float) Math.round((times - limit.getIharm19Overtime()) * 10000 / times) / 100);
statistics.setIharm20Rate((float) Math.round((times - limit.getIharm20Overtime()) * 10000 / times) / 100);
statistics.setIharm21Rate((float) Math.round((times - limit.getIharm21Overtime()) * 10000 / times) / 100);
statistics.setIharm22Rate((float) Math.round((times - limit.getIharm22Overtime()) * 10000 / times) / 100);
statistics.setIharm23Rate((float) Math.round((times - limit.getIharm23Overtime()) * 10000 / times) / 100);
statistics.setIharm24Rate((float) Math.round((times - limit.getIharm24Overtime()) * 10000 / times) / 100);
statistics.setIharm25Rate((float) Math.round((times - limit.getIharm25Overtime()) * 10000 / times) / 100);
saveSteadyUrl(limit, time);
}
}
appStatisticsService.save(statistics);
}
}
public void saveEventInfo(List<String> indexList) {
if (indexList != null && indexList.size() > 0) {
for (String eventDetail_index : indexList) {
AppEventInfo byId = appEventInfoService.getById(eventDetail_index);
if (ObjectUtil.isNull(byId)) {
AppEventInfo info=new AppEventInfo();
info.setEventdetailIndex(eventDetail_index);
info.setEvaluate(0);
info.setUpdateTime(LocalDateTime.now());
info.setReportState(0);
appEventInfoService.save(info);
}
}
}
}
}

View File

@@ -1,6 +1,5 @@
package com.njcn.cloud.service;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.njcn.cloud.pojo.dto.AppEventMsg;
import com.njcn.cloud.pojo.vo.EventInfoDetailVO;

View File

@@ -17,7 +17,26 @@ import java.util.List;
*/
public interface IAppStatisticsService extends IService<AppStatistics> {
/**
* @Description: 统计数据
* @param lineIndex
* @param startTime
* @param endTime
* @param page
* @param num
* @return: java.util.List<com.njcn.cloud.pojo.vo.StatisticsData>
* @Author: wr
* @Date: 2024/1/4 9:23
*/
List<StatisticsData> queryData(String lineIndex, String startTime, String endTime, int page, int num);
/**
* @Description: 统计数据详情
* @param lineIndex
* @param timeID
* @return: com.njcn.cloud.pojo.vo.StatisticsDetail
* @Author: wr
* @Date: 2024/1/4 10:48
*/
StatisticsDetail queryDetail(String lineIndex, String timeID);
}

View File

@@ -1,13 +1,33 @@
package com.njcn.cloud.service.impl;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.date.DatePattern;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.date.LocalDateTimeUtil;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.njcn.cloud.enums.app.TypeCodeEnum;
import com.njcn.cloud.mapper.AppStatisticsMapper;
import com.njcn.cloud.pojo.dto.AppStatistics;
import com.njcn.cloud.pojo.dto.AppSteadyUrl;
import com.njcn.cloud.pojo.vo.StatisticsData;
import com.njcn.cloud.pojo.vo.StatisticsDetail;
import com.njcn.cloud.pojo.vo.StatisticsEvent;
import com.njcn.cloud.service.IAppStatisticsService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.njcn.cloud.service.IAppSteadyUrlService;
import com.njcn.common.pojo.exception.BusinessException;
import com.njcn.device.pq.api.LineFeignClient;
import com.njcn.device.pq.pojo.vo.LineDetailVO;
import com.njcn.event.api.EventDetailFeignClient;
import com.njcn.event.pojo.param.EventCountParam;
import com.njcn.event.pojo.po.RmpEventDetailPO;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
/**
@@ -19,15 +39,276 @@ import java.util.List;
* @since 2024-01-03
*/
@Service
@RequiredArgsConstructor
public class AppStatisticsServiceImpl extends ServiceImpl<AppStatisticsMapper, AppStatistics> implements IAppStatisticsService {
private final LineFeignClient lineFeignClient;
private final IAppSteadyUrlService appSteadyUrlService;
private final EventDetailFeignClient eventDetailFeignClient;
@Override
public List<StatisticsData> queryData(String lineIndex, String startTime, String endTime, int page, int num) {
return null;
List<LineDetailVO.Detail> lineDetail = lineFeignClient.getLineDetailByIds(Collections.singletonList(lineIndex)).getData();
if (CollUtil.isEmpty(lineDetail)) {
throw new BusinessException("监测点信息不存在,监测点编号有误!");
}
List<StatisticsData> info = new ArrayList<>();
Page<AppStatistics> statisticsPage = this.page(new Page<>(page, num), new LambdaQueryWrapper<AppStatistics>()
.eq(AppStatistics::getLineIndex, lineIndex)
.ge(StrUtil.isNotBlank(startTime), AppStatistics::getTimeId, DateUtil.beginOfDay(DateUtil.parse(startTime)))
.le(StrUtil.isNotBlank(endTime), AppStatistics::getTimeId, DateUtil.endOfDay(DateUtil.parse(endTime)))
.orderByDesc(AppStatistics::getTimeId)
);
//数据整理
List<AppStatistics> records = statisticsPage.getRecords();
if (CollUtil.isNotEmpty(records)) {
for (AppStatistics statistics : records) {
StatisticsData data = new StatisticsData();
data.setLineName(lineDetail.get(0).getLineName());
data.setTime(statistics.getTimeId());
String describe = "";
String describe1 = "";
if (statistics.getEventCount() != null && statistics.getEventCount() > 0) {
describe = describe + "暂降次数:" + statistics.getEventCount().toString() + "次;";
}
if (statistics.getFreqDevRate() != null && statistics.getFreqDevRate() > 0 && statistics.getFreqDevRate() < 100) {
describe1 = describe1 + "频率偏差合格率" + statistics.getFreqDevRate().toString() + "%;";
}
if (statistics.getVoltageDevRate() != null && statistics.getVoltageDevRate() > 0 && statistics.getVoltageDevRate() < 100) {
describe1 = describe1 + "电压偏差合格率" + statistics.getVoltageDevRate().toString() + "%;";
}
if (statistics.getUbalanceRate() != null && statistics.getUbalanceRate() > 0 && statistics.getUbalanceRate() < 100) {
describe1 = describe1 + "电压不平衡合格率" + statistics.getUbalanceRate().toString() + "%;";
}
if (statistics.getFlickerRate() != null && statistics.getFlickerRate() > 0 && statistics.getFlickerRate() < 100) {
describe1 = describe1 + "闪变合格率" + statistics.getFlickerRate().toString() + "%;";
}
if (statistics.getUaberranceRate() != null && statistics.getUaberranceRate() > 0 && statistics.getUaberranceRate() < 100) {
describe1 = describe1 + "电压谐波畸变率合格率" + statistics.getUaberranceRate().toString() + "%;";
}
if (statistics.getUharm2Rate() != null && statistics.getUharm2Rate() > 0 && statistics.getUharm2Rate() < 100) {
describe1 = describe1 + "2次电压谐波含有率合格率" + statistics.getUharm2Rate().toString() + "%;";
}
if (statistics.getUharm3Rate() != null && statistics.getUharm3Rate() > 0 && statistics.getUharm3Rate() < 100) {
describe1 = describe1 + "3次电压谐波含有率合格率" + statistics.getUharm3Rate().toString() + "%;";
}
if (statistics.getUharm4Rate() != null && statistics.getUharm4Rate() > 0 && statistics.getUharm4Rate() < 100) {
describe1 = describe1 + "4次电压谐波含有率合格率" + statistics.getUharm4Rate().toString() + "%;";
}
if (statistics.getUharm5Rate() != null && statistics.getUharm5Rate() > 0 && statistics.getUharm5Rate() < 100) {
describe1 = describe1 + "5次电压谐波含有率合格率" + statistics.getUharm5Rate().toString() + "%;";
}
if (statistics.getUharm6Rate() != null && statistics.getUharm6Rate() > 0 && statistics.getUharm6Rate() < 100) {
describe1 = describe1 + "6次电压谐波含有率合格率" + statistics.getUharm6Rate().toString() + "%;";
}
if (statistics.getUharm7Rate() != null && statistics.getUharm7Rate() > 0 && statistics.getUharm7Rate() < 100) {
describe1 = describe1 + "7次电压谐波含有率合格率" + statistics.getUharm7Rate().toString() + "%;";
}
if (statistics.getUharm8Rate() != null && statistics.getUharm8Rate() > 0 && statistics.getUharm8Rate() < 100) {
describe1 = describe1 + "8次电压谐波含有率合格率" + statistics.getUharm8Rate().toString() + "%;";
}
if (statistics.getUharm9Rate() != null && statistics.getUharm9Rate() > 0 && statistics.getUharm9Rate() < 100) {
describe1 = describe1 + "9次电压谐波含有率合格率" + statistics.getUharm9Rate().toString() + "%;";
}
if (statistics.getUharm10Rate() != null && statistics.getUharm10Rate() > 0 && statistics.getUharm10Rate() < 100) {
describe1 = describe1 + "10次电压谐波含有率合格率" + statistics.getUharm10Rate().toString() + "%;";
}
if (statistics.getUharm11Rate() != null && statistics.getUharm11Rate() > 0 && statistics.getUharm11Rate() < 100) {
describe1 = describe1 + "11次电压谐波含有率合格率" + statistics.getUharm11Rate().toString() + "%;";
}
if (statistics.getUharm12Rate() != null && statistics.getUharm12Rate() > 0 && statistics.getUharm12Rate() < 100) {
describe1 = describe1 + "12次电压谐波含有率合格率" + statistics.getUharm12Rate().toString() + "%;";
}
if (statistics.getUharm13Rate() != null && statistics.getUharm13Rate() > 0 && statistics.getUharm13Rate() < 100) {
describe1 = describe1 + "13次电压谐波含有率合格率" + statistics.getUharm13Rate().toString() + "%;";
}
if (statistics.getUharm14Rate() != null && statistics.getUharm14Rate() > 0 && statistics.getUharm14Rate() < 100) {
describe1 = describe1 + "14次电压谐波含有率合格率" + statistics.getUharm14Rate().toString() + "%;";
}
if (statistics.getUharm15Rate() != null && statistics.getUharm15Rate() > 0 && statistics.getUharm15Rate() < 100) {
describe1 = describe1 + "15次电压谐波含有率合格率" + statistics.getUharm15Rate().toString() + "%;";
}
if (statistics.getUharm16Rate() != null && statistics.getUharm16Rate() > 0 && statistics.getUharm16Rate() < 100) {
describe1 = describe1 + "16次电压谐波含有率合格率" + statistics.getUharm16Rate().toString() + "%;";
}
if (statistics.getUharm17Rate() != null && statistics.getUharm17Rate() > 0 && statistics.getUharm17Rate() < 100) {
describe1 = describe1 + "17次电压谐波含有率合格率" + statistics.getUharm17Rate().toString() + "%;";
}
if (statistics.getUharm18Rate() != null && statistics.getUharm18Rate() > 0 && statistics.getUharm18Rate() < 100) {
describe1 = describe1 + "18次电压谐波含有率合格率" + statistics.getUharm18Rate().toString() + "%;";
}
if (statistics.getUharm19Rate() != null && statistics.getUharm19Rate() > 0 && statistics.getUharm19Rate() < 100) {
describe1 = describe1 + "19次电压谐波含有率合格率" + statistics.getUharm19Rate().toString() + "%;";
}
if (statistics.getUharm20Rate() != null && statistics.getUharm20Rate() > 0 && statistics.getUharm20Rate() < 100) {
describe1 = describe1 + "20次电压谐波含有率合格率" + statistics.getUharm20Rate().toString() + "%;";
}
if (statistics.getUharm21Rate() != null && statistics.getUharm21Rate() > 0 && statistics.getUharm21Rate() < 100) {
describe1 = describe1 + "21次电压谐波含有率合格率" + statistics.getUharm21Rate().toString() + "%;";
}
if (statistics.getUharm22Rate() != null && statistics.getUharm22Rate() > 0 && statistics.getUharm22Rate() < 100) {
describe1 = describe1 + "22次电压谐波含有率合格率" + statistics.getUharm22Rate().toString() + "%;";
}
if (statistics.getUharm23Rate() != null && statistics.getUharm23Rate() > 0 && statistics.getUharm23Rate() < 100) {
describe1 = describe1 + "23次电压谐波含有率合格率" + statistics.getUharm23Rate().toString() + "%;";
}
if (statistics.getUharm24Rate() != null && statistics.getUharm24Rate() > 0 && statistics.getUharm24Rate() < 100) {
describe1 = describe1 + "24次电压谐波含有率合格率" + statistics.getUharm24Rate().toString() + "%;";
}
if (statistics.getUharm25Rate() != null && statistics.getUharm25Rate() > 0 && statistics.getUharm25Rate() < 100) {
describe1 = describe1 + "25次电压谐波含有率合格率" + statistics.getUharm25Rate().toString() + "%;";
}
if (statistics.getIharm2Rate() != null && statistics.getIharm2Rate() > 0 && statistics.getIharm2Rate() < 100) {
describe1 = describe1 + "2次电流谐波幅值合格率" + statistics.getIharm2Rate().toString() + "%;";
}
if (statistics.getIharm3Rate() != null && statistics.getIharm3Rate() > 0 && statistics.getIharm3Rate() < 100) {
describe1 = describe1 + "3次电流谐波幅值合格率" + statistics.getIharm3Rate().toString() + "%;";
}
if (statistics.getIharm4Rate() != null && statistics.getIharm4Rate() > 0 && statistics.getIharm4Rate() < 100) {
describe1 = describe1 + "4次电流谐波幅值合格率" + statistics.getIharm4Rate().toString() + "%;";
}
if (statistics.getIharm5Rate() != null && statistics.getIharm5Rate() > 0 && statistics.getIharm5Rate() < 100) {
describe1 = describe1 + "5次电流谐波幅值合格率" + statistics.getIharm5Rate().toString() + "%;";
}
if (statistics.getIharm6Rate() != null && statistics.getIharm6Rate() > 0 && statistics.getIharm6Rate() < 100) {
describe1 = describe1 + "6次电流谐波幅值合格率" + statistics.getIharm6Rate().toString() + "%;";
}
if (statistics.getIharm7Rate() != null && statistics.getIharm7Rate() > 0 && statistics.getIharm7Rate() < 100) {
describe1 = describe1 + "7次电流谐波幅值合格率" + statistics.getIharm7Rate().toString() + "%;";
}
if (statistics.getIharm8Rate() != null && statistics.getIharm8Rate() > 0 && statistics.getIharm8Rate() < 100) {
describe1 = describe1 + "8次电流谐波幅值合格率" + statistics.getIharm8Rate().toString() + "%;";
}
if (statistics.getIharm9Rate() != null && statistics.getIharm9Rate() > 0 && statistics.getIharm9Rate() < 100) {
describe1 = describe1 + "9次电流谐波幅值合格率" + statistics.getIharm9Rate().toString() + "%;";
}
if (statistics.getIharm10Rate() != null && statistics.getIharm10Rate() > 0 && statistics.getIharm10Rate() < 100) {
describe1 = describe1 + "10次电流谐波幅值合格率" + statistics.getIharm10Rate().toString() + "%;";
}
if (statistics.getIharm11Rate() != null && statistics.getIharm11Rate() > 0 && statistics.getIharm11Rate() < 100) {
describe1 = describe1 + "11次电流谐波幅值合格率" + statistics.getIharm11Rate().toString() + "%;";
}
if (statistics.getIharm12Rate() != null && statistics.getIharm12Rate() > 0 && statistics.getIharm12Rate() < 100) {
describe1 = describe1 + "12次电流谐波幅值合格率" + statistics.getIharm12Rate().toString() + "%;";
}
if (statistics.getIharm13Rate() != null && statistics.getIharm13Rate() > 0 && statistics.getIharm13Rate() < 100) {
describe1 = describe1 + "13次电流谐波幅值合格率" + statistics.getIharm13Rate().toString() + "%;";
}
if (statistics.getIharm14Rate() != null && statistics.getIharm14Rate() > 0 && statistics.getIharm14Rate() < 100) {
describe1 = describe1 + "14次电流谐波幅值合格率" + statistics.getIharm14Rate().toString() + "%;";
}
if (statistics.getIharm15Rate() != null && statistics.getIharm15Rate() > 0 && statistics.getIharm15Rate() < 100) {
describe1 = describe1 + "15次电流谐波幅值合格率" + statistics.getIharm15Rate().toString() + "%;";
}
if (statistics.getIharm16Rate() != null && statistics.getIharm16Rate() > 0 && statistics.getIharm16Rate() < 100) {
describe1 = describe1 + "16次电流谐波幅值合格率" + statistics.getIharm16Rate().toString() + "%;";
}
if (statistics.getIharm17Rate() != null && statistics.getIharm17Rate() > 0 && statistics.getIharm17Rate() < 100) {
describe1 = describe1 + "17次电流谐波幅值合格率" + statistics.getIharm17Rate().toString() + "%;";
}
if (statistics.getIharm18Rate() != null && statistics.getIharm18Rate() > 0 && statistics.getIharm18Rate() < 100) {
describe1 = describe1 + "18次电流谐波幅值合格率" + statistics.getIharm18Rate().toString() + "%;";
}
if (statistics.getIharm19Rate() != null && statistics.getIharm19Rate() > 0 && statistics.getIharm19Rate() < 100) {
describe1 = describe1 + "19次电流谐波幅值合格率" + statistics.getIharm19Rate().toString() + "%;";
}
if (statistics.getIharm20Rate() != null && statistics.getIharm20Rate() > 0 && statistics.getIharm20Rate() < 100) {
describe1 = describe1 + "20次电流谐波幅值合格率" + statistics.getIharm20Rate().toString() + "%;";
}
if (statistics.getIharm21Rate() != null && statistics.getIharm21Rate() > 0 && statistics.getIharm21Rate() < 100) {
describe1 = describe1 + "21次电流谐波幅值合格率" + statistics.getIharm21Rate().toString() + "%;";
}
if (statistics.getIharm22Rate() != null && statistics.getIharm22Rate() > 0 && statistics.getIharm22Rate() < 100) {
describe1 = describe1 + "22次电流谐波幅值合格率" + statistics.getIharm22Rate().toString() + "%;";
}
if (statistics.getIharm23Rate() != null && statistics.getIharm23Rate() > 0 && statistics.getIharm23Rate() < 100) {
describe1 = describe1 + "23次电流谐波幅值合格率" + statistics.getIharm23Rate().toString() + "%;";
}
if (statistics.getIharm24Rate() != null && statistics.getIharm24Rate() > 0 && statistics.getIharm24Rate() < 100) {
describe1 = describe1 + "24次电流谐波幅值合格率" + statistics.getIharm24Rate().toString() + "%;";
}
if (statistics.getIharm25Rate() != null && statistics.getIharm25Rate() > 0 && statistics.getIharm25Rate() < 100) {
describe1 = describe1 + "25次电流谐波幅值合格率" + statistics.getIharm25Rate().toString() + "%;";
}
boolean flag = false;
if (describe.length() > 0) {
describe = describe.substring(0, describe.length() - 1);
data.setEventDescribe(describe);
flag = true;
}
if (describe1.length() > 0) {
describe1 = "越限详情:" + describe1;
describe1 = describe1.substring(0, describe1.length() - 1);
data.setSteadyDescribe(describe1);
flag = true;
}
if (flag) {
info.add(data);
}
}
}
return info;
}
@Override
public StatisticsDetail queryDetail(String lineIndex, String timeID) {
return null;
List<LineDetailVO.Detail> lineDetail = lineFeignClient.getLineDetailByIds(Collections.singletonList(lineIndex)).getData();
if (CollUtil.isEmpty(lineDetail)) {
throw new BusinessException("监测点信息不存在,监测点编号有误!");
}
StatisticsDetail result = new StatisticsDetail();
//获取监测点完整名称
result.setName(lineDetail.get(0).getGdName() + "->" +
lineDetail.get(0).getSubName() + "->" +
lineDetail.get(0).getDevName() + "->" +
lineDetail.get(0).getLineName());
//获取稳态消息详情
String steadyDescribe = "";
List<AppSteadyUrl> steadyUrlList = appSteadyUrlService.list(new LambdaQueryWrapper<AppSteadyUrl>()
.eq(AppSteadyUrl::getLineIndex, lineIndex)
.eq(AppSteadyUrl::getTimeId, timeID)
.orderByAsc(AppSteadyUrl::getTypeCode)
);
if (CollUtil.isNotEmpty(steadyUrlList)) {
for (int n = 0; n < steadyUrlList.size(); n++) {
String typename = TypeCodeEnum.getMsgByCode(steadyUrlList.get(n).getTypeCode());
if (n == steadyUrlList.size() - 1) {
steadyDescribe = steadyDescribe + typename + steadyUrlList.get(n).getLimitNum() + "";
} else {
steadyDescribe = steadyDescribe + typename + steadyUrlList.get(n).getLimitNum() + "次,";
}
}
result.setSteadyInfo(steadyDescribe);
}
//获取暂态消息详情
List<StatisticsEvent> eventInfo = new ArrayList<>();
//获取监测点暂态消息信息
String startTime = DateUtil.beginOfDay(DateUtil.parse(timeID)).toString();
String endTime = DateUtil.endOfDay(DateUtil.parse(timeID)).toString();
EventCountParam param=new EventCountParam();
param.setIds(Collections.singletonList(lineIndex));
param.setStartTime(startTime);
param.setEndTime(endTime);
List<RmpEventDetailPO> eventDetailList = eventDetailFeignClient.getAppEventDetailLtAmplitude(param).getData();
if (CollUtil.isNotEmpty(eventDetailList)) {
for (RmpEventDetailPO event : eventDetailList) {
StatisticsEvent eventData = new StatisticsEvent();
String describe = "";
describe = describe + lineDetail.get(0).getLineName() + ""
+ LocalDateTimeUtil.format(event.getStartTime(), DatePattern.NORM_DATETIME_MS_PATTERN)
+ "发生暂降事件,特征幅值:" + event.getFeatureAmplitude()
+ "%,持续时间:" + event.getDuration() + "s";
eventData.setDescribe(describe);
eventData.setEventDetail_index(event.getEventId());
eventInfo.add(eventData);
}
result.setEventInfo(eventInfo);
}
return result;
}
}