定版bug修改
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
package com.njcn.web.enums;
|
||||
|
||||
import lombok.Getter;
|
||||
|
||||
@Getter
|
||||
public enum DateFlagEnum {
|
||||
|
||||
YEAR_FLAG(1,"年"),
|
||||
QUARTER_FLAG(2,"季"),
|
||||
MONTH_FLAG(3,"月"),
|
||||
WEEK_FLAG(4,"周"),
|
||||
DAY_FLAG(5,"日"),
|
||||
CUSTOM_FLAG(5,"自定义")
|
||||
|
||||
|
||||
|
||||
;
|
||||
|
||||
|
||||
|
||||
|
||||
private final Integer code;
|
||||
|
||||
private final String date;
|
||||
|
||||
DateFlagEnum(Integer code, String date) {
|
||||
this.code = code;
|
||||
this.date = date;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -26,7 +26,7 @@ public class PulicTimeParam {
|
||||
@Pattern(regexp = PatternRegex.TIME_FORMAT, message = "时间格式错误")
|
||||
private String searchEndTime;
|
||||
|
||||
@ApiModelProperty("时间标识:0--年/季度;1--月")
|
||||
@ApiModelProperty("统计类型 1.年 2.季 3.月 4.周 5.天")
|
||||
private Integer timeFlag;
|
||||
|
||||
}
|
||||
|
||||
@@ -11,6 +11,7 @@ import java.time.LocalDateTime;
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@TableName("pqs_onlinerate")
|
||||
@Deprecated
|
||||
public class OnlineRate extends BaseEntity {
|
||||
|
||||
@Column(name="Id")
|
||||
|
||||
@@ -7,6 +7,7 @@ import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.time.Instant;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@@ -21,12 +22,12 @@ public class CommunicateVO implements Serializable {
|
||||
/**
|
||||
* 更新时间
|
||||
*/
|
||||
private List<String> updateTime;
|
||||
private List<String> updateTime = new ArrayList<>();
|
||||
|
||||
/**
|
||||
* 事件类型(0:中断;1:正常;2:退出)
|
||||
*/
|
||||
private List<Integer> type;
|
||||
private List<Integer> type = new ArrayList<>();
|
||||
|
||||
/**
|
||||
* 冀北分布式光伏概览通讯状态统计(专用)
|
||||
|
||||
@@ -24,6 +24,8 @@ public class DeviceOnlineDataVO implements Serializable {
|
||||
@ApiModelProperty("日")
|
||||
private String day;
|
||||
|
||||
private String dateView;
|
||||
|
||||
@ApiModelProperty("在线率")
|
||||
private Float onlineRate;
|
||||
}
|
||||
|
||||
@@ -7,6 +7,7 @@ import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Deprecated
|
||||
public interface OnlineRateMapper extends BaseMapper<OnlineRate> {
|
||||
|
||||
List<OnlineRate> getOnlineRateByDevId(@Param("list") List<String> devIndexs, @Param("startTime") DateTime startTime, @Param("endTime") DateTime endTimem);
|
||||
|
||||
@@ -1,25 +1,34 @@
|
||||
package com.njcn.device.pq.service.impl;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.date.*;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.njcn.device.pq.mapper.OnlineRateMapper;
|
||||
import com.njcn.device.pq.mapper.RStatIntegrityDMapper;
|
||||
import com.njcn.device.pq.mapper.RStatOnlinerateDMapper;
|
||||
import com.njcn.device.pq.pojo.param.OnlineRateParam;
|
||||
import com.njcn.device.pq.pojo.param.PulicTimeParam;
|
||||
import com.njcn.device.pq.pojo.param.PulicTimeStatisParam;
|
||||
import com.njcn.device.pq.pojo.po.RStatOnlinerateD;
|
||||
import com.njcn.device.pq.pojo.vo.*;
|
||||
import com.njcn.device.pq.service.CommunicateService;
|
||||
import com.njcn.device.pq.service.LineService;
|
||||
import com.njcn.device.pq.utils.PublicDateUtil;
|
||||
import com.njcn.web.enums.DateFlagEnum;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.SneakyThrows;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
import java.text.DecimalFormat;
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
|
||||
/**
|
||||
@@ -30,6 +39,8 @@ import java.util.*;
|
||||
@AllArgsConstructor
|
||||
public class CommunicateServiceImpl implements CommunicateService {
|
||||
|
||||
final float DEFAULT_ONLINE_RATE = 3.14159f;
|
||||
|
||||
private final LineService lineService;
|
||||
|
||||
private final RStatOnlinerateDMapper onlinerateDMapper;
|
||||
@@ -60,80 +71,58 @@ public class CommunicateServiceImpl implements CommunicateService {
|
||||
return communicateStatisticsVO;
|
||||
}
|
||||
|
||||
@SneakyThrows
|
||||
@Override
|
||||
public List<DeviceOnlineDataVO> getRunOnlineRateData(PulicTimeParam pulicTimeParam) {
|
||||
List<DeviceOnlineDataVO> deviceOnlineDataList = new ArrayList<>();
|
||||
//根据监测点id获取终端id
|
||||
String devId = lineService.getLineIdByDevId(pulicTimeParam.getId());
|
||||
DecimalFormat decimalFormat = new DecimalFormat(".00");
|
||||
Float floatList;
|
||||
if (pulicTimeParam.getTimeFlag() == 0) {
|
||||
// 获取两个时间的之间的月份
|
||||
List<String> intervalTime = this.getIntervalTime(pulicTimeParam.getSearchBeginTime(), pulicTimeParam.getSearchEndTime());
|
||||
|
||||
LambdaQueryWrapper<RStatOnlinerateD> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
lambdaQueryWrapper.eq(RStatOnlinerateD::getDevIndex, devId)
|
||||
.between(RStatOnlinerateD::getTimeId, pulicTimeParam.getSearchBeginTime(), pulicTimeParam.getSearchEndTime());
|
||||
List<RStatOnlinerateD> rStatOnlinerateDList = onlinerateDMapper.selectList(lambdaQueryWrapper);
|
||||
|
||||
|
||||
List<String> intervalTime = processDateRange(pulicTimeParam.getSearchBeginTime(), pulicTimeParam.getSearchEndTime(),pulicTimeParam.getTimeFlag());
|
||||
|
||||
if (isMonthlyTimeFlag(pulicTimeParam.getTimeFlag())) {
|
||||
// 按月处理
|
||||
Map<String, List<RStatOnlinerateD>> map = rStatOnlinerateDList.stream().collect(Collectors.groupingBy(it -> it.getTimeId().format(DateTimeFormatter.ofPattern(DatePattern.NORM_MONTH_PATTERN))));
|
||||
for (String interTime : intervalTime) {
|
||||
DeviceOnlineDataVO inter = new DeviceOnlineDataVO();
|
||||
String startTime, endTime;
|
||||
inter.setMonth(interTime.substring(5));
|
||||
inter.setYear(interTime.substring(0, 4));
|
||||
inter.setDay("/");
|
||||
startTime = PublicDateUtil.getFisrtDayOfMonth(Integer.parseInt(interTime.substring(0, 4)), Integer.parseInt(interTime.substring(5)));
|
||||
endTime = PublicDateUtil.getLastDayOfMonth(Integer.parseInt(interTime.substring(0, 4)), Integer.parseInt(interTime.substring(5)));
|
||||
floatList = getCondition(devId, startTime, endTime, 1);
|
||||
if (floatList == 0) {
|
||||
inter.setOnlineRate(3.14159f);
|
||||
DeviceOnlineDataVO deviceOnlineDataVO = new DeviceOnlineDataVO();
|
||||
deviceOnlineDataVO.setDateView(interTime);
|
||||
if (map.containsKey(interTime)) {
|
||||
double rate = map.get(interTime).stream().mapToDouble(it -> (double) it.getOnlineMin() / (it.getOnlineMin() + it.getOfflineMin())).average().orElse(3.14159);
|
||||
deviceOnlineDataVO.setOnlineRate(rate == DEFAULT_ONLINE_RATE ? DEFAULT_ONLINE_RATE : new BigDecimal(rate * 100).setScale(2, RoundingMode.HALF_UP).floatValue());
|
||||
}else {
|
||||
inter.setOnlineRate(Float.parseFloat(decimalFormat.format(floatList)));
|
||||
deviceOnlineDataVO.setOnlineRate(DEFAULT_ONLINE_RATE);
|
||||
}
|
||||
deviceOnlineDataList.add(inter);
|
||||
deviceOnlineDataList.add(deviceOnlineDataVO);
|
||||
}
|
||||
} else {
|
||||
List<String> intervalTime = this.getIntervalTime(pulicTimeParam.getSearchBeginTime(),pulicTimeParam.getSearchEndTime());
|
||||
for (int j = 0; j < intervalTime.size(); j++) {
|
||||
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
|
||||
Date dt ;
|
||||
Date dtDate;
|
||||
if(j==0){
|
||||
dt= simpleDateFormat.parse(pulicTimeParam.getSearchBeginTime());
|
||||
// 按日处理
|
||||
Map<String, List<RStatOnlinerateD>> map = rStatOnlinerateDList.stream().collect(Collectors.groupingBy(it -> it.getTimeId().format(DateTimeFormatter.ofPattern(DatePattern.NORM_DATE_PATTERN))));
|
||||
for (String interTime : intervalTime) {
|
||||
DeviceOnlineDataVO deviceOnlineDataVO = new DeviceOnlineDataVO();
|
||||
deviceOnlineDataVO.setDateView(interTime);
|
||||
if (map.containsKey(interTime)) {
|
||||
double rate = map.get(interTime).stream().mapToDouble(it -> (double) it.getOnlineMin() / (it.getOnlineMin() + it.getOfflineMin())).average().orElse(3.14159);
|
||||
deviceOnlineDataVO.setOnlineRate(rate == DEFAULT_ONLINE_RATE ? DEFAULT_ONLINE_RATE : new BigDecimal(rate * 100).setScale(2, RoundingMode.HALF_UP).floatValue());
|
||||
}else {
|
||||
String startTime = PublicDateUtil.getFisrtDayOfMonth(Integer.parseInt(intervalTime.get(j).substring(0, 4)), Integer.parseInt(intervalTime.get(j).substring(5)));
|
||||
dt= simpleDateFormat.parse(startTime);
|
||||
|
||||
deviceOnlineDataVO.setOnlineRate(DEFAULT_ONLINE_RATE);
|
||||
}
|
||||
int beginDay = Integer.valueOf(String.format("%td", dt));
|
||||
if(j==intervalTime.size()-1){
|
||||
dtDate= simpleDateFormat.parse(pulicTimeParam.getSearchEndTime());
|
||||
}else{
|
||||
String startTime = PublicDateUtil.getLastDayOfMonth(Integer.parseInt(intervalTime.get(j).substring(0, 4)), Integer.parseInt(intervalTime.get(j).substring(5)));
|
||||
dtDate= simpleDateFormat.parse(startTime);
|
||||
deviceOnlineDataList.add(deviceOnlineDataVO);
|
||||
}
|
||||
Integer year = Integer.valueOf(String.format("%tY", dt));
|
||||
Integer mon = Integer.valueOf(String.format("%tm", dt));
|
||||
|
||||
Integer day = Integer.valueOf(String.format("%td", dtDate));
|
||||
List<String> dayTime = this.getIntervalDateTime(year,beginDay, mon, day);
|
||||
for (String interTime : dayTime) {
|
||||
DeviceOnlineDataVO inter = new DeviceOnlineDataVO();
|
||||
String startTime, endTime;
|
||||
inter.setMonth(interTime.substring(5, 7));
|
||||
inter.setYear(interTime.substring(0, 4));
|
||||
inter.setDay(interTime.substring(8));
|
||||
startTime =simpleDateFormat.format(DateUtil.beginOfDay(DateUtil.parse(interTime)));
|
||||
endTime = simpleDateFormat.format(DateUtil.endOfDay(DateUtil.parse(interTime)));
|
||||
floatList = getCondition(devId, startTime, endTime, 1);
|
||||
if (floatList == 0) {
|
||||
inter.setOnlineRate(3.14159f);
|
||||
} else {
|
||||
inter.setOnlineRate(Float.parseFloat(decimalFormat.format(floatList)));
|
||||
}
|
||||
deviceOnlineDataList.add(inter);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
return deviceOnlineDataList;
|
||||
}
|
||||
|
||||
// 判断是否为按月/季/年统计
|
||||
private boolean isMonthlyTimeFlag(int timeFlag) {
|
||||
return timeFlag == 1 || timeFlag == 2;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* influxDB相关操作
|
||||
* 查询监测点的数据完整性
|
||||
@@ -166,131 +155,34 @@ public class CommunicateServiceImpl implements CommunicateService {
|
||||
return resultList[0];
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据用户选择的时间区间返回月份日期
|
||||
*/
|
||||
@SneakyThrows
|
||||
private List<String> getIntervalTime(String startTime, String endTime) {
|
||||
List<String> times = new ArrayList<>();
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM");
|
||||
Date start = sdf.parse(startTime);
|
||||
Date end = sdf.parse(endTime);
|
||||
// 同月
|
||||
if (start.getTime() == end.getTime()) {
|
||||
String time = startTime.substring(0, 7);
|
||||
times.add(time);
|
||||
} else if (start.getYear() == end.getYear()) {
|
||||
// 同年
|
||||
int startM = start.getMonth() + 1;
|
||||
int endM = end.getMonth() + 1;
|
||||
int temp = endM - startM;
|
||||
for (int i = 0; i <= temp; i++) {
|
||||
String time = start.getYear() + 1900 + "";
|
||||
int month = startM + i;
|
||||
if (month < 10) {
|
||||
time = time + "-0" + month;
|
||||
} else {
|
||||
time = time + "-" + month;
|
||||
}
|
||||
times.add(time);
|
||||
}
|
||||
} else {
|
||||
// 不同年!!!!这里忽略了年份之间跨年的情况
|
||||
int startY = start.getYear() + 1900;
|
||||
int startM = start.getMonth() + 1;
|
||||
int endY = end.getYear() + 1900;
|
||||
int endM = end.getMonth() + 1;
|
||||
int tempS = 12 - startM;
|
||||
// 连续的年份
|
||||
if (endY - startY == 1) {
|
||||
// 第一年的时间获取
|
||||
for (int i = 0; i <= tempS; i++) {
|
||||
int month = startM + i;
|
||||
String time = startY + "-";
|
||||
if (month < 10) {
|
||||
time = time + "0" + month;
|
||||
} else {
|
||||
time = time + month;
|
||||
}
|
||||
times.add(time);
|
||||
}
|
||||
// 第二年的时间获取
|
||||
|
||||
for (int i = 1; i <= endM; i++) {
|
||||
String time = endY + "-";
|
||||
if (i < 10) {
|
||||
time = time + "0" + i;
|
||||
|
||||
|
||||
public static List<String> processDateRange(String startDateStr, String endDateStr, Integer timeType) {
|
||||
DateTime startDate = DateUtil.parse(startDateStr, DatePattern.NORM_DATE_PATTERN);
|
||||
DateTime endDate = DateUtil.parse(endDateStr, DatePattern.NORM_DATE_PATTERN);
|
||||
|
||||
List<String> result = new ArrayList<>();
|
||||
|
||||
// 计算月份差(基于每月1号计算)
|
||||
DateTime startMonth = DateUtil.beginOfMonth(startDate);
|
||||
DateTime endMonth = DateUtil.beginOfMonth(endDate);
|
||||
long monthsBetween = DateUtil.betweenMonth(startMonth, endMonth, false);
|
||||
|
||||
if (Objects.equals(timeType, DateFlagEnum.WEEK_FLAG.getCode()) ||Objects.equals(timeType, DateFlagEnum.CUSTOM_FLAG.getCode()) ||Objects.equals(timeType, DateFlagEnum.MONTH_FLAG.getCode())) {
|
||||
// 同一个月,返回每天日期
|
||||
DateRange dailyRange = new DateRange(startDate, endDate, DateField.DAY_OF_MONTH);
|
||||
dailyRange.forEach(date -> result.add(DateUtil.format(date, DatePattern.NORM_DATE_PATTERN)));
|
||||
} else {
|
||||
time = time + i;
|
||||
}
|
||||
times.add(time);
|
||||
}
|
||||
} else {
|
||||
// 不连续的年份
|
||||
// 第一年的时间获取
|
||||
for (int i = 0; i <= tempS; i++) {
|
||||
int month = startM + i;
|
||||
String time = startY + "-";
|
||||
if (month < 10) {
|
||||
time = time + "0" + month;
|
||||
} else {
|
||||
time = time + month;
|
||||
}
|
||||
times.add(time);
|
||||
}
|
||||
int tempY = endY - startY;
|
||||
// 中间年份的时间
|
||||
for (int i = 1; i < tempY; i++) {
|
||||
for (int j = 1; j <= 12; j++) {
|
||||
String time = startY + i + "-";
|
||||
if (j < 10) {
|
||||
time = time + "0" + j;
|
||||
} else {
|
||||
time = time + j;
|
||||
}
|
||||
times.add(time);
|
||||
// 大于一个季度,返回每月第一天日期
|
||||
DateTime current = DateUtil.beginOfMonth(startDate);
|
||||
while (current.isBeforeOrEquals(endDate)) {
|
||||
result.add(DateUtil.format(current, DatePattern.NORM_MONTH_PATTERN));
|
||||
current = DateUtil.offsetMonth(current, 1);
|
||||
}
|
||||
}
|
||||
// 最后一年的时间获取
|
||||
for (int i = 1; i <= endM; i++) {
|
||||
String time = endY + "-";
|
||||
if (i < 10) {
|
||||
time = time + "0" + i;
|
||||
} else {
|
||||
time = time + i;
|
||||
}
|
||||
times.add(time);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
||||
return times;
|
||||
}
|
||||
|
||||
@SneakyThrows
|
||||
private List<String> getIntervalDateTime(Integer startTime, int beginDay,Integer endTime,Integer dd) {
|
||||
List<String> list = new ArrayList<>();
|
||||
Calendar calendar = Calendar.getInstance(Locale.CHINA);
|
||||
calendar.set(startTime, endTime - 1, 1);
|
||||
int year = calendar.get(Calendar.YEAR);//年份
|
||||
int month = calendar.get(Calendar.MONTH) + 1;//月份
|
||||
for (int i = beginDay; i <= dd; i++) {
|
||||
String date = null;
|
||||
if (month < 10 && i < 10) {
|
||||
date = year + "-0" + month + "-0" + i;
|
||||
}
|
||||
if (month < 10 && i >= 10) {
|
||||
date = year + "-0" + month + "-" + i;
|
||||
}
|
||||
if (month >= 10 && i < 10) {
|
||||
date = year + "-" + month + "-0" + i;
|
||||
}
|
||||
if (month >= 10 && i >= 10) {
|
||||
date = year + "-" + month + "-" + i;
|
||||
}
|
||||
|
||||
list.add(date);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1021,6 +1021,7 @@ public class EventAnalysisServiceImpl implements EventAnalysisService {
|
||||
}
|
||||
//计数map
|
||||
HashMap<String, Integer> countMap = new HashMap<>();
|
||||
countMap.put("=0", 0);
|
||||
countMap.put("<10", 0);
|
||||
countMap.put("<20", 0);
|
||||
countMap.put("<30", 0);
|
||||
@@ -1032,6 +1033,7 @@ public class EventAnalysisServiceImpl implements EventAnalysisService {
|
||||
countMap.put("<90", 0);
|
||||
//分段计数
|
||||
HashMap<String, Integer> subsectionMap = new HashMap<>();
|
||||
subsectionMap.put("0", 0);
|
||||
subsectionMap.put("0~10", 0);
|
||||
subsectionMap.put("10~20", 0);
|
||||
subsectionMap.put("20~30", 0);
|
||||
@@ -1043,6 +1045,9 @@ public class EventAnalysisServiceImpl implements EventAnalysisService {
|
||||
subsectionMap.put("80~90", 0);
|
||||
//求数量
|
||||
for (EventDetail eventDetail : info) {
|
||||
if (eventDetail.getFeatureAmplitude() == 0.00) {
|
||||
countMap.put("=0", (countMap.get("=0") + 1));
|
||||
}
|
||||
if (eventDetail.getFeatureAmplitude() < 0.1) {
|
||||
countMap.put("<10", (countMap.get("<10") + 1));
|
||||
}
|
||||
@@ -1073,7 +1078,9 @@ public class EventAnalysisServiceImpl implements EventAnalysisService {
|
||||
}
|
||||
//求每段数量
|
||||
for (EventDetail eventDetail : info) {
|
||||
if (eventDetail.getFeatureAmplitude() < 0.1) {
|
||||
if (eventDetail.getFeatureAmplitude() ==0) {
|
||||
subsectionMap.put("0", (subsectionMap.get("0") + 1));
|
||||
} else if (eventDetail.getFeatureAmplitude() > 0 && eventDetail.getFeatureAmplitude() < 0.1) {
|
||||
subsectionMap.put("0~10", (subsectionMap.get("0~10") + 1));
|
||||
} else if (eventDetail.getFeatureAmplitude() > 0.1 && eventDetail.getFeatureAmplitude() < 0.2) {
|
||||
subsectionMap.put("10~20", (subsectionMap.get("10~20") + 1));
|
||||
@@ -1097,6 +1104,7 @@ public class EventAnalysisServiceImpl implements EventAnalysisService {
|
||||
List<String> pereventvalue = new ArrayList<>();
|
||||
Set<String> subsectionSet = subsectionMap.keySet();
|
||||
List<String> strings1 = new ArrayList<>();
|
||||
strings1.add("0");
|
||||
strings1.add("0~10");
|
||||
strings1.add("10~20");
|
||||
strings1.add("20~30");
|
||||
@@ -1126,6 +1134,7 @@ public class EventAnalysisServiceImpl implements EventAnalysisService {
|
||||
//求eventvalue
|
||||
List<String> eventvalue = new ArrayList<>();
|
||||
List<String> strings = new ArrayList<>();
|
||||
strings.add("=0");
|
||||
strings.add("<10");
|
||||
strings.add("<20");
|
||||
strings.add("<30");
|
||||
@@ -1153,10 +1162,10 @@ public class EventAnalysisServiceImpl implements EventAnalysisService {
|
||||
}
|
||||
}
|
||||
}
|
||||
eventvalue.add("100.00");
|
||||
result.setEventvalue(eventvalue);
|
||||
//时间
|
||||
HashMap<String, Integer> timeMap = new HashMap<>();
|
||||
timeMap.put("<0.01", 0);
|
||||
timeMap.put("<0.1", 0);
|
||||
timeMap.put("<0.25", 0);
|
||||
timeMap.put("<0.5", 0);
|
||||
@@ -1168,25 +1177,28 @@ public class EventAnalysisServiceImpl implements EventAnalysisService {
|
||||
//求不同时间段的总数
|
||||
for (EventDetail eventDetail : info) {
|
||||
Double persistTime = eventDetail.getDuration();
|
||||
if (persistTime / 1000 < 0.1) {
|
||||
if (persistTime < 0.01 ) {
|
||||
timeMap.put("<0.1", timeMap.get("<0.1") + 1);
|
||||
} else if (persistTime / 1000 > 0.1 && persistTime / 1000 < 0.25) {
|
||||
} else if (persistTime >= 0.01 && persistTime < 0.1) {
|
||||
timeMap.put("<0.1", timeMap.get("<0.1") + 1);
|
||||
} else if (persistTime >= 0.1 && persistTime < 0.25) {
|
||||
timeMap.put("<0.25", timeMap.get("<0.25") + 1);
|
||||
} else if (persistTime / 1000 > 0.25 && persistTime / 1000 < 0.5) {
|
||||
} else if (persistTime >= 0.25 && persistTime < 0.5) {
|
||||
timeMap.put("<0.5", timeMap.get("<0.5") + 1);
|
||||
} else if (persistTime / 1000 > 0.5 && persistTime / 1000 < 1) {
|
||||
} else if (persistTime >= 0.5 && persistTime < 1) {
|
||||
timeMap.put("<1", timeMap.get("<1") + 1);
|
||||
} else if (persistTime / 1000 > 1 && persistTime / 1000 < 3) {
|
||||
} else if (persistTime >= 1 && persistTime < 3) {
|
||||
timeMap.put("<3", timeMap.get("<3") + 1);
|
||||
} else if (persistTime / 1000 > 3 && persistTime / 1000 < 20) {
|
||||
} else if (persistTime >= 3 && persistTime < 20) {
|
||||
timeMap.put("<20", timeMap.get("<20") + 1);
|
||||
} else if (persistTime / 1000 > 20 && persistTime / 1000 < 60) {
|
||||
} else if (persistTime >= 20 && persistTime < 60) {
|
||||
timeMap.put("<60", timeMap.get("<60") + 1);
|
||||
} else if (persistTime / 1000 > 60 && persistTime / 1000 < 180) {
|
||||
} else if (persistTime >= 60 && persistTime < 180) {
|
||||
timeMap.put("<180", timeMap.get("<180") + 1);
|
||||
}
|
||||
}
|
||||
List<String> strings2 = new ArrayList<>();
|
||||
strings2.add("<0.01");
|
||||
strings2.add("<0.1");
|
||||
strings2.add("<0.25");
|
||||
strings2.add("<0.5");
|
||||
@@ -1217,6 +1229,7 @@ public class EventAnalysisServiceImpl implements EventAnalysisService {
|
||||
result.setPersisttime(persisttime);
|
||||
|
||||
HashMap<String, Integer> timeMap2 = new HashMap<>();
|
||||
timeMap2.put("<0.01", 0);
|
||||
timeMap2.put("<0.1", 0);
|
||||
timeMap2.put("<0.25", 0);
|
||||
timeMap2.put("<0.5", 0);
|
||||
@@ -1229,28 +1242,31 @@ public class EventAnalysisServiceImpl implements EventAnalysisService {
|
||||
List<String> sisttime = new ArrayList<>();
|
||||
for (EventDetail eventDetail : info) {
|
||||
Double persistTime = eventDetail.getDuration();
|
||||
if (persistTime / 1000 < 0.1) {
|
||||
if (persistTime < 0.01) {
|
||||
timeMap2.put("<0.01", timeMap2.get("<0.01") + 1);
|
||||
}
|
||||
if (persistTime < 0.1) {
|
||||
timeMap2.put("<0.1", timeMap2.get("<0.1") + 1);
|
||||
}
|
||||
if (persistTime / 1000 < 0.25) {
|
||||
if (persistTime < 0.25) {
|
||||
timeMap2.put("<0.25", timeMap2.get("<0.25") + 1);
|
||||
}
|
||||
if (persistTime / 1000 < 0.5) {
|
||||
if (persistTime < 0.5) {
|
||||
timeMap2.put("<0.5", timeMap2.get("<0.5") + 1);
|
||||
}
|
||||
if (persistTime / 1000 < 1) {
|
||||
if (persistTime < 1) {
|
||||
timeMap2.put("<1", timeMap2.get("<1") + 1);
|
||||
}
|
||||
if (persistTime / 1000 < 3) {
|
||||
if (persistTime < 3) {
|
||||
timeMap2.put("<3", timeMap2.get("<3") + 1);
|
||||
}
|
||||
if (persistTime / 1000 < 20) {
|
||||
if (persistTime < 20) {
|
||||
timeMap2.put("<20", timeMap2.get("<20") + 1);
|
||||
}
|
||||
if (persistTime / 1000 < 60) {
|
||||
if (persistTime < 60) {
|
||||
timeMap2.put("<60", timeMap2.get("<60") + 1);
|
||||
}
|
||||
if (persistTime / 1000 < 180) {
|
||||
if (persistTime < 180) {
|
||||
timeMap2.put("<180", timeMap2.get("<180") + 1);
|
||||
}
|
||||
}
|
||||
@@ -1271,7 +1287,6 @@ public class EventAnalysisServiceImpl implements EventAnalysisService {
|
||||
}
|
||||
}
|
||||
}
|
||||
sisttime.add("100.00");
|
||||
result.setSisttime(sisttime);
|
||||
return result;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user