1.根据code获取字典树
2.解决数据中心bug 3.优化暂态报表的查询语句将influxdb转为mysql
This commit is contained in:
@@ -509,7 +509,7 @@ public class LineServiceImpl extends ServiceImpl<LineMapper, Line> implements Li
|
|||||||
|
|
||||||
public List<PqsCommunicate> getCommunicate(String devId, String startTime, String endTime) {
|
public List<PqsCommunicate> getCommunicate(String devId, String startTime, String endTime) {
|
||||||
InfluxQueryWrapper influxQueryWrapper = new InfluxQueryWrapper(PqsCommunicate.class);
|
InfluxQueryWrapper influxQueryWrapper = new InfluxQueryWrapper(PqsCommunicate.class);
|
||||||
influxQueryWrapper.between(InfluxDbSqlConstant.TIME,DateUtil.beginOfDay(DateUtil.parse(startTime)),DateUtil.beginOfDay(DateUtil.parse(endTime)))
|
influxQueryWrapper.between(InfluxDbSqlConstant.TIME,DateUtil.beginOfDay(DateUtil.parse(startTime)).toString(),DateUtil.beginOfDay(DateUtil.parse(endTime)).toString())
|
||||||
.eq(PqsCommunicate::getDevId,devId);
|
.eq(PqsCommunicate::getDevId,devId);
|
||||||
return pqsCommunicateMapper.selectByQueryWrapper(influxQueryWrapper);
|
return pqsCommunicateMapper.selectByQueryWrapper(influxQueryWrapper);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -307,7 +307,7 @@ public class TerminalMaintainServiceImpl implements TerminalMaintainService {
|
|||||||
|
|
||||||
private List<DeviceDayFlowDTO> getFlowManageDetailFromInfluxDB(TerminalMainQueryParam param) {
|
private List<DeviceDayFlowDTO> getFlowManageDetailFromInfluxDB(TerminalMainQueryParam param) {
|
||||||
InfluxQueryWrapper influxQueryWrapper = new InfluxQueryWrapper(CldStatisFlow.class,DeviceDayFlowDTO.class);
|
InfluxQueryWrapper influxQueryWrapper = new InfluxQueryWrapper(CldStatisFlow.class,DeviceDayFlowDTO.class);
|
||||||
influxQueryWrapper.between(InfluxDbSqlConstant.TIME,DateUtil.beginOfDay(DateUtil.parse(param.getSearchBeginTime())),DateUtil.beginOfDay(DateUtil.parse(param.getSearchEndTime())))
|
influxQueryWrapper.between(InfluxDbSqlConstant.TIME,DateUtil.beginOfDay(DateUtil.parse(param.getSearchBeginTime())).toString(),DateUtil.beginOfDay(DateUtil.parse(param.getSearchEndTime())).toString())
|
||||||
.eq(CldStatisFlow::getDevId,param.getDevId());
|
.eq(CldStatisFlow::getDevId,param.getDevId());
|
||||||
List<DeviceDayFlowDTO> deviceDayFlow = cldStatisticsFlowMapper.selectDeviceDayFlowByQueryWrapper(influxQueryWrapper);
|
List<DeviceDayFlowDTO> deviceDayFlow = cldStatisticsFlowMapper.selectDeviceDayFlowByQueryWrapper(influxQueryWrapper);
|
||||||
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");
|
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");
|
||||||
|
|||||||
@@ -1,11 +1,16 @@
|
|||||||
package com.njcn.event.pojo.po;
|
package com.njcn.event.pojo.po;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
|
import com.njcn.db.bo.BaseEntity;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import org.influxdb.annotation.Column;
|
import org.influxdb.annotation.Column;
|
||||||
import org.influxdb.annotation.Measurement;
|
import org.influxdb.annotation.Measurement;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.time.Instant;
|
import java.time.Instant;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author zbj
|
* @author zbj
|
||||||
@@ -14,31 +19,29 @@ import java.time.Instant;
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
@Measurement(name = "pqs_eventass")
|
@TableName("r_mp_event_detail_ass")
|
||||||
public class Eventass {
|
public class Eventass extends BaseEntity {
|
||||||
|
|
||||||
@Column(name = "time")
|
/**
|
||||||
private Instant timeId;
|
*事件关联分析表uuid
|
||||||
|
*/
|
||||||
|
@TableId("Event_Ass_Id")
|
||||||
|
private String eventAssId;
|
||||||
|
|
||||||
@Column(name = "event_time")
|
/**
|
||||||
private String eventTime;
|
*发生时间(归一化中第一个时间)
|
||||||
|
*/
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss.SSS")
|
||||||
|
private LocalDateTime timeId;
|
||||||
|
|
||||||
@Column(name = "line_id")
|
/**
|
||||||
private String lineId;
|
*关联事件描述
|
||||||
|
*/
|
||||||
|
private String contentDes;
|
||||||
|
|
||||||
@Column(name = "host")
|
/**
|
||||||
private String host;
|
*是否进行范围分析(0:分析;1:未分析)
|
||||||
|
*/
|
||||||
@Column(name = "describe")
|
private Integer analyseFlag;
|
||||||
private String describe;
|
|
||||||
|
|
||||||
@Column(name = "range")
|
|
||||||
private Integer range;
|
|
||||||
|
|
||||||
@Column(name = "user_index")
|
|
||||||
private String userIndex;
|
|
||||||
|
|
||||||
@Column(name = "user_name")
|
|
||||||
private String userName;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,7 +5,6 @@ import lombok.AllArgsConstructor;
|
|||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
import java.io.Serializable;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author zbj
|
* @author zbj
|
||||||
@@ -19,7 +18,7 @@ public class TimeSVO extends TimeVO {
|
|||||||
|
|
||||||
|
|
||||||
@ApiModelProperty(name = "eventAssIndex", value = "关联处理事件时间")
|
@ApiModelProperty(name = "eventAssIndex", value = "关联处理事件时间")
|
||||||
private int eventAssIndex;
|
private Integer eventAssIndex;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
package com.njcn.event.mapper.majornetwork;
|
package com.njcn.event.mapper.majornetwork;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.njcn.event.pojo.po.Eventass;
|
||||||
import com.njcn.event.pojo.po.RmpEventDetailPO;
|
import com.njcn.event.pojo.po.RmpEventDetailPO;
|
||||||
import com.njcn.event.pojo.vo.GeneralVO;
|
import com.njcn.event.pojo.vo.GeneralVO;
|
||||||
import org.apache.ibatis.annotations.Param;
|
import org.apache.ibatis.annotations.Param;
|
||||||
@@ -24,4 +25,12 @@ public interface EventDetailMapper extends BaseMapper<RmpEventDetailPO> {
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
List<GeneralVO> ListEventType( @Param("condMap") Map<String, Object> condMap);
|
List<GeneralVO> ListEventType( @Param("condMap") Map<String, Object> condMap);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据暂降事件id集合获取暂降事件
|
||||||
|
* @param ids
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
List<Eventass> ListEventass(@Param("ids") List<String> ids);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -43,5 +43,19 @@
|
|||||||
) a
|
) a
|
||||||
GROUP BY id
|
GROUP BY id
|
||||||
</select>
|
</select>
|
||||||
|
<select id="ListEventass" resultType="com.njcn.event.pojo.po.Eventass">
|
||||||
|
select
|
||||||
|
*
|
||||||
|
from
|
||||||
|
r_mp_event_detail_ass
|
||||||
|
<where>
|
||||||
|
<if test="ids != null and ids.size() != 0">
|
||||||
|
Event_Ass_Id in
|
||||||
|
<foreach collection="ids" item="id" open="(" close=")" separator=",">
|
||||||
|
#{id}
|
||||||
|
</foreach>
|
||||||
|
</if>
|
||||||
|
</where>
|
||||||
|
</select>
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|||||||
@@ -105,7 +105,11 @@ public class AreaInfoServiceImpl implements AreaInfoService {
|
|||||||
|
|
||||||
//查询监测点未处理暂态事件
|
//查询监测点未处理暂态事件
|
||||||
List<RmpEventDetailPO> eventDetails = eventDetailService.list(new LambdaQueryWrapper<RmpEventDetailPO>()
|
List<RmpEventDetailPO> eventDetails = eventDetailService.list(new LambdaQueryWrapper<RmpEventDetailPO>()
|
||||||
.in(RmpEventDetailPO::getMeasurementPointId, lineIds)
|
.and(x -> x.in(RmpEventDetailPO::getMeasurementPointId, lineIds)
|
||||||
|
.isNull(RmpEventDetailPO::getEventassIndex)
|
||||||
|
.or()
|
||||||
|
.eq(RmpEventDetailPO::getEventassIndex, "")
|
||||||
|
)
|
||||||
.ge(StringUtils.isNotBlank(deviceInfoParam.getSearchBeginTime()), RmpEventDetailPO::getStartTime, DateUtil.beginOfDay(DateUtil.parse(deviceInfoParam.getSearchBeginTime())))
|
.ge(StringUtils.isNotBlank(deviceInfoParam.getSearchBeginTime()), RmpEventDetailPO::getStartTime, DateUtil.beginOfDay(DateUtil.parse(deviceInfoParam.getSearchBeginTime())))
|
||||||
.le(StringUtils.isNotBlank(deviceInfoParam.getSearchEndTime()), RmpEventDetailPO::getStartTime, DateUtil.endOfDay(DateUtil.parse(deviceInfoParam.getSearchEndTime())))
|
.le(StringUtils.isNotBlank(deviceInfoParam.getSearchEndTime()), RmpEventDetailPO::getStartTime, DateUtil.endOfDay(DateUtil.parse(deviceInfoParam.getSearchEndTime())))
|
||||||
.orderByDesc(RmpEventDetailPO::getStartTime));
|
.orderByDesc(RmpEventDetailPO::getStartTime));
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import cn.hutool.core.collection.CollUtil;
|
|||||||
import cn.hutool.core.collection.CollectionUtil;
|
import cn.hutool.core.collection.CollectionUtil;
|
||||||
import cn.hutool.core.date.DatePattern;
|
import cn.hutool.core.date.DatePattern;
|
||||||
import cn.hutool.core.date.DateUtil;
|
import cn.hutool.core.date.DateUtil;
|
||||||
|
import cn.hutool.core.date.LocalDateTimeUtil;
|
||||||
import cn.hutool.core.util.ObjectUtil;
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
@@ -36,7 +37,6 @@ import com.njcn.echarts.util.DrawPicUtil;
|
|||||||
import com.njcn.event.enums.EventResponseEnum;
|
import com.njcn.event.enums.EventResponseEnum;
|
||||||
import com.njcn.event.mapper.majornetwork.EventDetailMapper;
|
import com.njcn.event.mapper.majornetwork.EventDetailMapper;
|
||||||
import com.njcn.event.mapper.majornetwork.ReportMapper;
|
import com.njcn.event.mapper.majornetwork.ReportMapper;
|
||||||
import com.njcn.event.pojo.constant.Param;
|
|
||||||
import com.njcn.event.pojo.param.*;
|
import com.njcn.event.pojo.param.*;
|
||||||
import com.njcn.event.pojo.po.EventDetail;
|
import com.njcn.event.pojo.po.EventDetail;
|
||||||
import com.njcn.event.pojo.po.EventDetailNew;
|
import com.njcn.event.pojo.po.EventDetailNew;
|
||||||
@@ -48,8 +48,6 @@ import com.njcn.event.service.majornetwork.EventDetailService;
|
|||||||
import com.njcn.event.service.majornetwork.EventReportService;
|
import com.njcn.event.service.majornetwork.EventReportService;
|
||||||
import com.njcn.event.service.majornetwork.ReportService;
|
import com.njcn.event.service.majornetwork.ReportService;
|
||||||
import com.njcn.event.utils.WordUtils;
|
import com.njcn.event.utils.WordUtils;
|
||||||
import com.njcn.influxdb.utils.InfluxDBCommUtils;
|
|
||||||
import com.njcn.influxdb.utils.InfluxDbUtils;
|
|
||||||
import com.njcn.poi.util.PoiUtil;
|
import com.njcn.poi.util.PoiUtil;
|
||||||
import com.njcn.system.api.DicDataFeignClient;
|
import com.njcn.system.api.DicDataFeignClient;
|
||||||
import com.njcn.system.enums.DicDataEnum;
|
import com.njcn.system.enums.DicDataEnum;
|
||||||
@@ -88,12 +86,10 @@ import org.apache.poi.ss.usermodel.VerticalAlignment;
|
|||||||
import org.apache.poi.ss.util.CellRangeAddress;
|
import org.apache.poi.ss.util.CellRangeAddress;
|
||||||
import org.apache.poi.util.Units;
|
import org.apache.poi.util.Units;
|
||||||
import org.apache.poi.xwpf.usermodel.*;
|
import org.apache.poi.xwpf.usermodel.*;
|
||||||
import org.influxdb.dto.QueryResult;
|
|
||||||
import org.influxdb.impl.InfluxDBResultMapper;
|
import org.influxdb.impl.InfluxDBResultMapper;
|
||||||
import org.openxmlformats.schemas.wordprocessingml.x2006.main.*;
|
import org.openxmlformats.schemas.wordprocessingml.x2006.main.*;
|
||||||
import org.springframework.beans.BeanUtils;
|
import org.springframework.beans.BeanUtils;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.web.client.RestTemplate;
|
|
||||||
import sun.misc.BASE64Decoder;
|
import sun.misc.BASE64Decoder;
|
||||||
|
|
||||||
|
|
||||||
@@ -108,30 +104,20 @@ public class ReportServiceImpl implements ReportService {
|
|||||||
|
|
||||||
private final GeneralDeviceInfoClient generalDeviceInfoClient;
|
private final GeneralDeviceInfoClient generalDeviceInfoClient;
|
||||||
|
|
||||||
private final InfluxDbUtils influxDbUtils;
|
|
||||||
|
|
||||||
private final LineFeignClient lineFeignClient;
|
private final LineFeignClient lineFeignClient;
|
||||||
|
|
||||||
private final DicDataFeignClient dicDataFeignClient;
|
private final DicDataFeignClient dicDataFeignClient;
|
||||||
|
|
||||||
private final DeptFeignClient deptFeignClient;
|
private final DeptFeignClient deptFeignClient;
|
||||||
|
|
||||||
private final RestTemplate restTemplate;
|
|
||||||
|
|
||||||
private final EventReportService eventReportService;
|
private final EventReportService eventReportService;
|
||||||
//调用暂降密度接口
|
//调用暂降密度接口
|
||||||
private final EventAnalysisService eventAnalysisService;
|
private final EventAnalysisService eventAnalysisService;
|
||||||
|
|
||||||
private final PmsGeneralDeviceInfoClient pmsGeneralDeviceInfoClient;
|
private final PmsGeneralDeviceInfoClient pmsGeneralDeviceInfoClient;
|
||||||
|
|
||||||
private final MonitorClient monitorClient;
|
private final MonitorClient monitorClient;
|
||||||
|
|
||||||
private final PwMonitorClient pwMonitorClient;
|
private final PwMonitorClient pwMonitorClient;
|
||||||
private final EventDetailService eventDetailService;
|
private final EventDetailService eventDetailService;
|
||||||
private final EventDetailMapper eventDetailMapper;
|
private final EventDetailMapper eventDetailMapper;
|
||||||
|
|
||||||
private final ReportMapper reportMapper;
|
private final ReportMapper reportMapper;
|
||||||
|
|
||||||
private final DrawPicUtil drawPicUtil;
|
private final DrawPicUtil drawPicUtil;
|
||||||
|
|
||||||
public List<EventDetail> getED(DeviceInfoParam.BusinessParam businessParam, String id) {
|
public List<EventDetail> getED(DeviceInfoParam.BusinessParam businessParam, String id) {
|
||||||
@@ -2418,7 +2404,7 @@ public class ReportServiceImpl implements ReportService {
|
|||||||
//最后集合
|
//最后集合
|
||||||
List<TimeSVO> timeSVoList = new ArrayList<>();
|
List<TimeSVO> timeSVoList = new ArrayList<>();
|
||||||
//表格参数
|
//表格参数
|
||||||
String table = "";
|
String table;
|
||||||
|
|
||||||
//月
|
//月
|
||||||
if ("0".equals(areaReportParam.getInterval())) {
|
if ("0".equals(areaReportParam.getInterval())) {
|
||||||
@@ -2469,44 +2455,10 @@ public class ReportServiceImpl implements ReportService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Map<String, Integer> relevanceCountMap = new HashMap<>();
|
//获取未关联的暂态事件
|
||||||
|
Map<String, Long> eventAssDetail = eventDetailList.stream().filter(x -> StrUtil.isBlank(x.getEventassIndex()))
|
||||||
|
.collect(Collectors.groupingBy(x -> DateUtil.format(DateUtil.parse(x.getStartTime()), fmt), Collectors.counting()));
|
||||||
|
|
||||||
for (String key : relevanceMap.keySet()) {
|
|
||||||
List<String> list1 = relevanceMap.get(key).stream().filter(s -> s != "").collect(Collectors.toList());
|
|
||||||
//如果集合中有id将id进行拼接
|
|
||||||
if (CollectionUtil.isNotEmpty(list1)) {
|
|
||||||
|
|
||||||
StringBuilder stringBuilder = new StringBuilder("(");
|
|
||||||
|
|
||||||
for (int i = 0; i < list1.size(); ++i) {
|
|
||||||
if (list1.size() - i != 1) {
|
|
||||||
stringBuilder.append("event_time ='").append((String) list1.get(i)).append("' or ");
|
|
||||||
} else {
|
|
||||||
stringBuilder.append("event_time ='").append((String) list1.get(i)).append("') ");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//查询sql语句总条数
|
|
||||||
StringBuilder stringTotal = new StringBuilder("SELECT COUNT(*) as aa FROM ").append("pqs_eventass").append(" WHERE ")
|
|
||||||
.append(stringBuilder);
|
|
||||||
//总条数
|
|
||||||
QueryResult resultTotal = influxDbUtils.query(stringTotal.toString());
|
|
||||||
|
|
||||||
//返回的结果
|
|
||||||
if (Objects.nonNull(resultTotal.getResults().get(0).getSeries())) {
|
|
||||||
long count = new BigDecimal(resultTotal.getResults().get(0).getSeries().get(0).getValues().get(0).get(1).toString()).longValue();
|
|
||||||
|
|
||||||
if (relevanceCountMap.containsKey(key)) {
|
|
||||||
relevanceCountMap.put(key, relevanceCountMap.get(key) + (int) count);
|
|
||||||
} else {
|
|
||||||
relevanceCountMap.put(key, (int) count);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//开始时间
|
//开始时间
|
||||||
LocalDate beginTime = LocalDate.parse(areaReportParam.getSearchBeginTime());
|
LocalDate beginTime = LocalDate.parse(areaReportParam.getSearchBeginTime());
|
||||||
LocalDate end = LocalDate.parse(areaReportParam.getSearchEndTime());
|
LocalDate end = LocalDate.parse(areaReportParam.getSearchEndTime());
|
||||||
@@ -2536,10 +2488,10 @@ public class ReportServiceImpl implements ReportService {
|
|||||||
timeVO.setFulltime(beginTime.toString().substring(0, 7));
|
timeVO.setFulltime(beginTime.toString().substring(0, 7));
|
||||||
|
|
||||||
//遍历 如果时间相同,将所有关联处理事件次数赋值上去
|
//遍历 如果时间相同,将所有关联处理事件次数赋值上去
|
||||||
for (String s : relevanceCountMap.keySet()) {
|
if(eventAssDetail.containsKey(beginTime.toString().substring(0, 7))){
|
||||||
if (beginTime.toString().substring(0, 7).equals(s)) {
|
timeVO.setEventAssIndex(Math.toIntExact(eventAssDetail.get(beginTime.toString().substring(0, 7))));
|
||||||
timeVO.setEventAssIndex(relevanceCountMap.get(s));
|
}else{
|
||||||
}
|
timeVO.setEventAssIndex(0);
|
||||||
}
|
}
|
||||||
timeSVoList.add(timeVO);
|
timeSVoList.add(timeVO);
|
||||||
} else {
|
} else {
|
||||||
@@ -2572,6 +2524,7 @@ public class ReportServiceImpl implements ReportService {
|
|||||||
List<String> dayCount = new ArrayList<>();
|
List<String> dayCount = new ArrayList<>();
|
||||||
List<AreaEventMonthParam> timeList = new ArrayList<>();
|
List<AreaEventMonthParam> timeList = new ArrayList<>();
|
||||||
|
|
||||||
|
|
||||||
//进行for循环获取所有事件的时间
|
//进行for循环获取所有事件的时间
|
||||||
for (EventDetailNew eventDetail : eventDetailList) {
|
for (EventDetailNew eventDetail : eventDetailList) {
|
||||||
//获取暂降事件时间
|
//获取暂降事件时间
|
||||||
@@ -2609,45 +2562,10 @@ public class ReportServiceImpl implements ReportService {
|
|||||||
resultMap.put(day, 1);
|
resultMap.put(day, 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
//获取未关联的暂态事件
|
||||||
|
Map<String, Long> eventAssDetail = eventDetailList.stream().filter(x -> StrUtil.isBlank(x.getEventassIndex()))
|
||||||
|
.collect(Collectors.groupingBy(x -> DateUtil.formatDate(DateUtil.parse(x.getStartTime())), Collectors.counting()));
|
||||||
|
|
||||||
Map<String, Integer> relevanceCountMap = new HashMap<>();
|
|
||||||
|
|
||||||
for (String key : relevanceMap.keySet()) {
|
|
||||||
List<String> list1 = relevanceMap.get(key).stream().filter(s -> s != "").collect(Collectors.toList());
|
|
||||||
//如果集合中有id将id进行拼接
|
|
||||||
if (CollectionUtil.isNotEmpty(list1)) {
|
|
||||||
|
|
||||||
StringBuilder stringBuilder = new StringBuilder("(");
|
|
||||||
|
|
||||||
for (int i = 0; i < list1.size(); ++i) {
|
|
||||||
if (list1.size() - i != 1) {
|
|
||||||
stringBuilder.append("event_time ='").append((String) list1.get(i)).append("' or ");
|
|
||||||
} else {
|
|
||||||
stringBuilder.append("event_time ='").append((String) list1.get(i)).append("') ");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//查询sql语句总条数
|
|
||||||
StringBuilder stringTotal = new StringBuilder("SELECT COUNT(*) as aa FROM ").append("pqs_eventass").append(" WHERE ")
|
|
||||||
.append(stringBuilder);
|
|
||||||
//总条数
|
|
||||||
QueryResult resultTotal = influxDbUtils.query(stringTotal.toString());
|
|
||||||
|
|
||||||
//返回的结果
|
|
||||||
if (Objects.nonNull(resultTotal.getResults().get(0).getSeries())) {
|
|
||||||
long count = new BigDecimal(resultTotal.getResults().get(0).getSeries().get(0).getValues().get(0).get(1).toString()).longValue();
|
|
||||||
|
|
||||||
if (relevanceCountMap.containsKey(key)) {
|
|
||||||
relevanceCountMap.put(key, relevanceCountMap.get(key) + (int) count);
|
|
||||||
} else {
|
|
||||||
relevanceCountMap.put(key, (int) count);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
DateTimeFormatter fmt = DateTimeFormatter.ofPattern("yyyy-MM-dd");
|
DateTimeFormatter fmt = DateTimeFormatter.ofPattern("yyyy-MM-dd");
|
||||||
//开始时间
|
//开始时间
|
||||||
LocalDate beginTime = LocalDate.parse(areaReportParam.getSearchBeginTime(), fmt);
|
LocalDate beginTime = LocalDate.parse(areaReportParam.getSearchBeginTime(), fmt);
|
||||||
@@ -2677,12 +2595,11 @@ public class ReportServiceImpl implements ReportService {
|
|||||||
timeVO.setMonth(beginTime.getMonthValue() + "");
|
timeVO.setMonth(beginTime.getMonthValue() + "");
|
||||||
}
|
}
|
||||||
timeVO.setFulltime(beginTime.toString());
|
timeVO.setFulltime(beginTime.toString());
|
||||||
|
|
||||||
//遍历 如果时间相同,将所有关联处理事件次数赋值上去
|
//遍历 如果时间相同,将所有关联处理事件次数赋值上去
|
||||||
for (String s : relevanceCountMap.keySet()) {
|
if(eventAssDetail.containsKey(beginTime.toString())){
|
||||||
if (beginTime.toString().equals(s)) {
|
timeVO.setEventAssIndex(Math.toIntExact(eventAssDetail.get(beginTime.toString())));
|
||||||
timeVO.setEventAssIndex(relevanceCountMap.get(s));
|
}else{
|
||||||
}
|
timeVO.setEventAssIndex(0);
|
||||||
}
|
}
|
||||||
timeSVoList.add(timeVO);
|
timeSVoList.add(timeVO);
|
||||||
} else {
|
} else {
|
||||||
@@ -2874,25 +2791,13 @@ public class ReportServiceImpl implements ReportService {
|
|||||||
if (areaReportParam.isDensityTable() || areaReportParam.isDensityChart()) {
|
if (areaReportParam.isDensityTable() || areaReportParam.isDensityChart()) {
|
||||||
|
|
||||||
//暂降密度图形
|
//暂降密度图形
|
||||||
|
|
||||||
AreaTableParam areaTableParam = new AreaTableParam();
|
AreaTableParam areaTableParam = new AreaTableParam();
|
||||||
|
|
||||||
//监测点id拼接
|
|
||||||
StringBuilder stringBuilder = InfluxDBCommUtils.assToInfluxParam(lineIds);
|
|
||||||
areaTableParam.setStartTime(areaReportParam.getSearchBeginTime());
|
|
||||||
areaTableParam.setEndTime(areaReportParam.getSearchEndTime());
|
|
||||||
areaTableParam.setStringBuilder(stringBuilder);
|
|
||||||
|
|
||||||
|
|
||||||
//创建结果集合
|
//创建结果集合
|
||||||
// List<EventDetailNew> info = TableInfo(areaTableParam);
|
|
||||||
List<EventDetailNew> info = eventDetailList;
|
List<EventDetailNew> info = eventDetailList;
|
||||||
|
|
||||||
//将sql结果集放入,共用一个sql,减少查询时间
|
//将sql结果集放入,共用一个sql,减少查询时间
|
||||||
AreaTableParam areaTableParam1 = new AreaTableParam();
|
AreaTableParam areaTableParam1 = new AreaTableParam();
|
||||||
areaTableParam1.setStartTime(areaReportParam.getSearchBeginTime());
|
|
||||||
areaTableParam1.setEndTime(areaReportParam.getSearchEndTime());
|
|
||||||
areaTableParam1.setStringBuilder(stringBuilder);
|
|
||||||
areaTableParam1.setInfo(info);
|
areaTableParam1.setInfo(info);
|
||||||
|
|
||||||
|
|
||||||
@@ -4345,29 +4250,6 @@ public class ReportServiceImpl implements ReportService {
|
|||||||
//4.itic图
|
//4.itic图
|
||||||
if (areaReportParam.isItic()) {
|
if (areaReportParam.isItic()) {
|
||||||
//itic图
|
//itic图
|
||||||
/*
|
|
||||||
AreaTableParam areaTableParam = new AreaTableParam();
|
|
||||||
|
|
||||||
//监测点id拼接
|
|
||||||
StringBuilder stringBuilder = InfluxDBCommUtils.assToInfluxParam(lineIds);
|
|
||||||
areaTableParam.setStartTime(areaReportParam.getSearchBeginTime());
|
|
||||||
areaTableParam.setEndTime(areaReportParam.getSearchEndTime());
|
|
||||||
areaTableParam.setStringBuilder(stringBuilder);
|
|
||||||
|
|
||||||
|
|
||||||
//创建结果集合
|
|
||||||
// List<EventDetailNew> info = TableInfo(areaTableParam);
|
|
||||||
List<EventDetailNew> info = eventDetailList;
|
|
||||||
|
|
||||||
//将sql结果集放入,共用一个sql,减少查询时间
|
|
||||||
AreaTableParam areaTableParam1 = new AreaTableParam();
|
|
||||||
areaTableParam1.setStartTime(areaReportParam.getSearchBeginTime());
|
|
||||||
areaTableParam1.setEndTime(areaReportParam.getSearchEndTime());
|
|
||||||
areaTableParam1.setStringBuilder(stringBuilder);
|
|
||||||
areaTableParam1.setInfo(info);
|
|
||||||
*/
|
|
||||||
|
|
||||||
// List<EventDetailNew> detailList = getPlotArea(areaTableParam1);
|
|
||||||
List<EventDetailNew> detailList = eventDetailList;
|
List<EventDetailNew> detailList = eventDetailList;
|
||||||
|
|
||||||
List<OB> obs = new ArrayList<>();
|
List<OB> obs = new ArrayList<>();
|
||||||
@@ -4630,34 +4512,19 @@ public class ReportServiceImpl implements ReportService {
|
|||||||
|
|
||||||
//7.暂降持续时间
|
//7.暂降持续时间
|
||||||
if (areaReportParam.isDuration()) {
|
if (areaReportParam.isDuration()) {
|
||||||
|
|
||||||
//持续时间概率分布
|
//持续时间概率分布
|
||||||
|
|
||||||
|
|
||||||
AreaTableParam areaTableParam = new AreaTableParam();
|
AreaTableParam areaTableParam = new AreaTableParam();
|
||||||
|
|
||||||
//监测点id拼接
|
|
||||||
StringBuilder stringBuilder = InfluxDBCommUtils.assToInfluxParam(lineIds);
|
|
||||||
areaTableParam.setStartTime(areaReportParam.getSearchBeginTime());
|
|
||||||
areaTableParam.setEndTime(areaReportParam.getSearchEndTime());
|
|
||||||
areaTableParam.setStringBuilder(stringBuilder);
|
|
||||||
|
|
||||||
|
|
||||||
//创建结果集合
|
//创建结果集合
|
||||||
// List<EventDetailNew> info = TableInfo(areaTableParam);
|
|
||||||
List<EventDetailNew> info = eventDetailList;
|
List<EventDetailNew> info = eventDetailList;
|
||||||
|
|
||||||
//将sql结果集放入,共用一个sql,减少查询时间
|
//将sql结果集放入,共用一个sql,减少查询时间
|
||||||
AreaTableParam areaTableParam1 = new AreaTableParam();
|
AreaTableParam areaTableParam1 = new AreaTableParam();
|
||||||
areaTableParam1.setStartTime(areaReportParam.getSearchBeginTime());
|
|
||||||
areaTableParam1.setEndTime(areaReportParam.getSearchEndTime());
|
|
||||||
areaTableParam1.setStringBuilder(stringBuilder);
|
|
||||||
areaTableParam1.setInfo(info);
|
areaTableParam1.setInfo(info);
|
||||||
ProbabilityVO probabilityDistributionArea = getProbabilityDistributionArea(areaTableParam1);
|
ProbabilityVO probabilityDistributionArea = getProbabilityDistributionArea(areaTableParam1);
|
||||||
|
|
||||||
// System.out.println(probabilityDistributionArea);
|
|
||||||
|
|
||||||
List<String> eventvalue = probabilityDistributionArea.getEventvalue();
|
List<String> eventvalue = probabilityDistributionArea.getEventvalue();
|
||||||
|
|
||||||
List<AmplitudeCountParam> amplitudeList = new ArrayList<>();
|
List<AmplitudeCountParam> amplitudeList = new ArrayList<>();
|
||||||
|
|
||||||
List<String> xName = new ArrayList<>();
|
List<String> xName = new ArrayList<>();
|
||||||
@@ -4780,48 +4647,26 @@ public class ReportServiceImpl implements ReportService {
|
|||||||
if (areaReportParam.isEventRelevanceCountTable()) {
|
if (areaReportParam.isEventRelevanceCountTable()) {
|
||||||
//事件关联统计表格
|
//事件关联统计表格
|
||||||
|
|
||||||
//创建存储总次数的集合
|
int resultCount = 0;
|
||||||
Map<String, Integer> resultCount = new HashMap<>();
|
|
||||||
|
|
||||||
//创建存储time的集合
|
|
||||||
Map<String, String> timeCount = new HashMap<>();
|
|
||||||
|
|
||||||
int resultCount1 = 0;
|
|
||||||
List<EventassCountParam> resultList = new ArrayList<>();
|
List<EventassCountParam> resultList = new ArrayList<>();
|
||||||
|
|
||||||
List<EventDetailNew> eventList = eventDetailList.stream().filter(e -> e.getEventassIndex() != "").collect(Collectors.toList());
|
List<EventDetailNew> eventList = eventDetailList.stream().filter(e ->StrUtil.isNotBlank(e.getEventassIndex())).collect(Collectors.toList());
|
||||||
|
|
||||||
if (CollectionUtil.isNotEmpty(eventList)) {
|
if (CollectionUtil.isNotEmpty(eventList)) {
|
||||||
//记录条数
|
//记录条数
|
||||||
resultCount.put("count", eventList.size());
|
resultCount= eventList.size();
|
||||||
|
List<String> ids = eventList.stream().map(EventDetailNew::getEventassIndex).collect(Collectors.toList());
|
||||||
|
List<Eventass> eventAssList = eventDetailMapper.ListEventass(ids);
|
||||||
|
|
||||||
//将时间数存入集合Map集合(主数据)
|
for (Eventass eventass : eventAssList) {
|
||||||
for (EventDetailNew detail : eventList) {
|
|
||||||
timeCount.put(detail.getEventassIndex(), detail.getStartTime());
|
|
||||||
}
|
|
||||||
|
|
||||||
//时间拼接 event_time=getEventassIndex
|
|
||||||
StringBuilder stringBuilder = InfluxDBCommUtils.assToInfluxParamAndName(new ArrayList<>(timeCount.keySet()), "event_time");
|
|
||||||
StringBuilder stringResult1 = new StringBuilder(Param.SELECT).append("pqs_eventass").append(Param.WHERE)
|
|
||||||
.append(stringBuilder);
|
|
||||||
// .append("event_time = '").append(stringBuilder).append("' ");
|
|
||||||
|
|
||||||
//结果集
|
|
||||||
QueryResult result1 = influxDbUtils.query(stringResult1.toString());
|
|
||||||
|
|
||||||
//结果集映射到对象中
|
|
||||||
List<Eventass> eventassList = influxDBResultMapper.toPOJO(result1, Eventass.class);
|
|
||||||
|
|
||||||
for (Eventass eventass : eventassList) {
|
|
||||||
EventassCountParam eventassCountParam = new EventassCountParam();
|
EventassCountParam eventassCountParam = new EventassCountParam();
|
||||||
eventassCountParam.setAssTime(eventass.getTimeId().toString());
|
String dateTime = LocalDateTimeUtil.format(eventass.getTimeId(), DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss.SSS"));
|
||||||
|
eventassCountParam.setAssTime(dateTime);
|
||||||
//获取时间
|
//获取时间
|
||||||
String eventTime = timeCount.get(eventass.getEventTime());
|
eventassCountParam.setEventTime(dateTime);
|
||||||
eventassCountParam.setEventTime(eventTime);
|
eventassCountParam.setDescribe(eventass.getContentDes());
|
||||||
eventassCountParam.setDescribe(eventass.getDescribe());
|
|
||||||
resultList.add(eventassCountParam);
|
resultList.add(eventassCountParam);
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
resultCount.put("count", 0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
createTitle(doc, "4." + oneCount + " 事件关联分析", "标题 2", 200, 11);
|
createTitle(doc, "4." + oneCount + " 事件关联分析", "标题 2", 200, 11);
|
||||||
@@ -4830,7 +4675,7 @@ public class ReportServiceImpl implements ReportService {
|
|||||||
p.setAlignment(ParagraphAlignment.BOTH);
|
p.setAlignment(ParagraphAlignment.BOTH);
|
||||||
XWPFRun r12 = p.createRun();//创建段落文本
|
XWPFRun r12 = p.createRun();//创建段落文本
|
||||||
//归一化需要高级算法,先字符串代替
|
//归一化需要高级算法,先字符串代替
|
||||||
r12.setText(" " + deptName + "电网在所选择的分析时间段内累计监测" + typeName + "记录" + resultCount.get("count") + "条,归一化统计后共" + resultCount1 + "[此为归一化后的暂态事件结果]条,,具体如下图所示:");
|
r12.setText(" " + deptName + "电网在所选择的分析时间段内累计监测" + typeName + "记录" + eventCount + "条,归一化统计后共" + resultCount + "[此为归一化后的暂态事件结果]条,,具体如下图所示:");
|
||||||
r12.setFontSize(11);//字体大小
|
r12.setFontSize(11);//字体大小
|
||||||
|
|
||||||
|
|
||||||
@@ -5498,7 +5343,7 @@ public class ReportServiceImpl implements ReportService {
|
|||||||
String table = "";
|
String table = "";
|
||||||
|
|
||||||
//月
|
//月
|
||||||
if ("3".equals(areaReportParam.getInterval())) {
|
if ("0".equals(areaReportParam.getInterval())) {
|
||||||
table = "月份";
|
table = "月份";
|
||||||
|
|
||||||
List<String> dayCount = new ArrayList<>();
|
List<String> dayCount = new ArrayList<>();
|
||||||
@@ -5507,10 +5352,6 @@ public class ReportServiceImpl implements ReportService {
|
|||||||
//进行for循环获取所有事件的时间
|
//进行for循环获取所有事件的时间
|
||||||
for (EventDetailNew eventDetail : eventDetailList) {
|
for (EventDetailNew eventDetail : eventDetailList) {
|
||||||
//获取暂降事件时间
|
//获取暂降事件时间
|
||||||
/* String timeId = eventDetail.getTimeId();
|
|
||||||
Date date1 = DateUtil.parse(timeId);
|
|
||||||
int day = Integer.parseInt(String.format("%td",date1));*/
|
|
||||||
|
|
||||||
dayCount.add(DateUtil.format(DateUtil.parse(eventDetail.getStartTime()), fmt));
|
dayCount.add(DateUtil.format(DateUtil.parse(eventDetail.getStartTime()), fmt));
|
||||||
|
|
||||||
//创建对象
|
//创建对象
|
||||||
@@ -5545,45 +5386,11 @@ public class ReportServiceImpl implements ReportService {
|
|||||||
resultMap.put(day, 1);
|
resultMap.put(day, 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
//获取未关联的暂态事件
|
||||||
Map<String, Integer> relevanceCountMap = new HashMap<>();
|
Map<String, Long> eventAssDetail = eventDetailList.stream().filter(x -> StrUtil.isBlank(x.getEventassIndex()))
|
||||||
|
.collect(Collectors.groupingBy(x -> DateUtil.format(DateUtil.parse(x.getStartTime()), fmt), Collectors.counting()));
|
||||||
for (String key : relevanceMap.keySet()) {
|
|
||||||
List<String> list1 = relevanceMap.get(key).stream().filter(s -> s != "").collect(Collectors.toList());
|
|
||||||
//如果集合中有id将id进行拼接
|
|
||||||
if (CollectionUtil.isNotEmpty(list1)) {
|
|
||||||
|
|
||||||
StringBuilder stringBuilder = new StringBuilder("(");
|
|
||||||
|
|
||||||
for (int i = 0; i < list1.size(); ++i) {
|
|
||||||
if (list1.size() - i != 1) {
|
|
||||||
stringBuilder.append("event_time ='").append((String) list1.get(i)).append("' or ");
|
|
||||||
} else {
|
|
||||||
stringBuilder.append("event_time ='").append((String) list1.get(i)).append("') ");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//查询sql语句总条数
|
|
||||||
StringBuilder stringTotal = new StringBuilder("SELECT COUNT(*) as aa FROM ").append("pqs_eventass").append(" WHERE ")
|
|
||||||
.append(stringBuilder);
|
|
||||||
//总条数
|
|
||||||
QueryResult resultTotal = influxDbUtils.query(stringTotal.toString());
|
|
||||||
|
|
||||||
//返回的结果
|
|
||||||
if (Objects.nonNull(resultTotal.getResults().get(0).getSeries())) {
|
|
||||||
long count = new BigDecimal(resultTotal.getResults().get(0).getSeries().get(0).getValues().get(0).get(1).toString()).longValue();
|
|
||||||
|
|
||||||
if (relevanceCountMap.containsKey(key)) {
|
|
||||||
relevanceCountMap.put(key, relevanceCountMap.get(key) + (int) count);
|
|
||||||
} else {
|
|
||||||
relevanceCountMap.put(key, (int) count);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//开始时间
|
//开始时间
|
||||||
LocalDate beginTime = LocalDate.parse(areaReportParam.getSearchBeginTime());
|
LocalDate beginTime = LocalDate.parse(areaReportParam.getSearchBeginTime());
|
||||||
LocalDate end = LocalDate.parse(areaReportParam.getSearchEndTime());
|
LocalDate end = LocalDate.parse(areaReportParam.getSearchEndTime());
|
||||||
@@ -5612,12 +5419,11 @@ public class ReportServiceImpl implements ReportService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
timeVO.setFulltime(beginTime.toString().substring(0, 7));
|
timeVO.setFulltime(beginTime.toString().substring(0, 7));
|
||||||
|
|
||||||
//遍历 如果时间相同,将所有关联处理事件次数赋值上去
|
//遍历 如果时间相同,将所有关联处理事件次数赋值上去
|
||||||
for (String s : relevanceCountMap.keySet()) {
|
if(eventAssDetail.containsKey(beginTime.toString().substring(0, 7))){
|
||||||
if (beginTime.toString().substring(0, 7).equals(s)) {
|
timeVO.setEventAssIndex(Math.toIntExact(eventAssDetail.get(beginTime.toString().substring(0, 7))));
|
||||||
timeVO.setEventAssIndex(relevanceCountMap.get(s));
|
}else{
|
||||||
}
|
timeVO.setEventAssIndex(0);
|
||||||
}
|
}
|
||||||
timeSVoList.add(timeVO);
|
timeSVoList.add(timeVO);
|
||||||
} else {
|
} else {
|
||||||
@@ -5691,44 +5497,10 @@ public class ReportServiceImpl implements ReportService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Map<String, Integer> relevanceCountMap = new HashMap<>();
|
//获取未关联的暂态事件
|
||||||
|
Map<String, Long> eventAssDetail = eventDetailList.stream().filter(x -> StrUtil.isBlank(x.getEventassIndex()))
|
||||||
|
.collect(Collectors.groupingBy(x -> DateUtil.formatDate(DateUtil.parse(x.getStartTime())), Collectors.counting()));
|
||||||
|
|
||||||
for (String key : relevanceMap.keySet()) {
|
|
||||||
List<String> list1 = relevanceMap.get(key).stream().filter(s -> s != "").collect(Collectors.toList());
|
|
||||||
//如果集合中有id将id进行拼接
|
|
||||||
if (CollectionUtil.isNotEmpty(list1)) {
|
|
||||||
|
|
||||||
StringBuilder stringBuilder = new StringBuilder("(");
|
|
||||||
|
|
||||||
for (int i = 0; i < list1.size(); ++i) {
|
|
||||||
if (list1.size() - i != 1) {
|
|
||||||
stringBuilder.append("event_time ='").append((String) list1.get(i)).append("' or ");
|
|
||||||
} else {
|
|
||||||
stringBuilder.append("event_time ='").append((String) list1.get(i)).append("') ");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//查询sql语句总条数
|
|
||||||
StringBuilder stringTotal = new StringBuilder("SELECT COUNT(*) as aa FROM ").append("pqs_eventass").append(" WHERE ")
|
|
||||||
.append(stringBuilder);
|
|
||||||
//总条数
|
|
||||||
QueryResult resultTotal = influxDbUtils.query(stringTotal.toString());
|
|
||||||
|
|
||||||
//返回的结果
|
|
||||||
if (Objects.nonNull(resultTotal.getResults().get(0).getSeries())) {
|
|
||||||
long count = new BigDecimal(resultTotal.getResults().get(0).getSeries().get(0).getValues().get(0).get(1).toString()).longValue();
|
|
||||||
|
|
||||||
if (relevanceCountMap.containsKey(key)) {
|
|
||||||
relevanceCountMap.put(key, relevanceCountMap.get(key) + (int) count);
|
|
||||||
} else {
|
|
||||||
relevanceCountMap.put(key, (int) count);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
DateTimeFormatter fmt = DateTimeFormatter.ofPattern("yyyy-MM-dd");
|
DateTimeFormatter fmt = DateTimeFormatter.ofPattern("yyyy-MM-dd");
|
||||||
//开始时间
|
//开始时间
|
||||||
LocalDate beginTime = LocalDate.parse(areaReportParam.getSearchBeginTime(), fmt);
|
LocalDate beginTime = LocalDate.parse(areaReportParam.getSearchBeginTime(), fmt);
|
||||||
@@ -5758,12 +5530,11 @@ public class ReportServiceImpl implements ReportService {
|
|||||||
timeVO.setMonth(beginTime.getMonthValue() + "");
|
timeVO.setMonth(beginTime.getMonthValue() + "");
|
||||||
}
|
}
|
||||||
timeVO.setFulltime(beginTime.toString());
|
timeVO.setFulltime(beginTime.toString());
|
||||||
|
|
||||||
//遍历 如果时间相同,将所有关联处理事件次数赋值上去
|
//遍历 如果时间相同,将所有关联处理事件次数赋值上去
|
||||||
for (String s : relevanceCountMap.keySet()) {
|
if(eventAssDetail.containsKey(beginTime.toString())){
|
||||||
if (beginTime.toString().equals(s)) {
|
timeVO.setEventAssIndex(Math.toIntExact(eventAssDetail.get(beginTime.toString())));
|
||||||
timeVO.setEventAssIndex(relevanceCountMap.get(s));
|
}else{
|
||||||
}
|
timeVO.setEventAssIndex(0);
|
||||||
}
|
}
|
||||||
timeSVoList.add(timeVO);
|
timeSVoList.add(timeVO);
|
||||||
} else {
|
} else {
|
||||||
@@ -5957,25 +5728,13 @@ public class ReportServiceImpl implements ReportService {
|
|||||||
if (areaReportParam.isDensityTable() || areaReportParam.isDensityChart()) {
|
if (areaReportParam.isDensityTable() || areaReportParam.isDensityChart()) {
|
||||||
|
|
||||||
//暂降密度图形
|
//暂降密度图形
|
||||||
|
|
||||||
AreaTableParam areaTableParam = new AreaTableParam();
|
AreaTableParam areaTableParam = new AreaTableParam();
|
||||||
|
|
||||||
//监测点id拼接
|
|
||||||
StringBuilder stringBuilder = InfluxDBCommUtils.assToInfluxParam(lineIds);
|
|
||||||
areaTableParam.setStartTime(areaReportParam.getSearchBeginTime());
|
|
||||||
areaTableParam.setEndTime(areaReportParam.getSearchEndTime());
|
|
||||||
areaTableParam.setStringBuilder(stringBuilder);
|
|
||||||
|
|
||||||
|
|
||||||
//创建结果集合
|
//创建结果集合
|
||||||
// List<EventDetailNew> info = TableInfo(areaTableParam);
|
|
||||||
List<EventDetailNew> info = eventDetailList;
|
List<EventDetailNew> info = eventDetailList;
|
||||||
|
|
||||||
//将sql结果集放入,共用一个sql,减少查询时间
|
//将sql结果集放入,共用一个sql,减少查询时间
|
||||||
AreaTableParam areaTableParam1 = new AreaTableParam();
|
AreaTableParam areaTableParam1 = new AreaTableParam();
|
||||||
areaTableParam1.setStartTime(areaReportParam.getSearchBeginTime());
|
|
||||||
areaTableParam1.setEndTime(areaReportParam.getSearchEndTime());
|
|
||||||
areaTableParam1.setStringBuilder(stringBuilder);
|
|
||||||
areaTableParam1.setInfo(info);
|
areaTableParam1.setInfo(info);
|
||||||
|
|
||||||
|
|
||||||
@@ -7690,30 +7449,19 @@ public class ReportServiceImpl implements ReportService {
|
|||||||
//7.暂降持续时间
|
//7.暂降持续时间
|
||||||
if (areaReportParam.isDuration()) {
|
if (areaReportParam.isDuration()) {
|
||||||
//持续时间概率分布
|
//持续时间概率分布
|
||||||
|
|
||||||
|
|
||||||
AreaTableParam areaTableParam = new AreaTableParam();
|
AreaTableParam areaTableParam = new AreaTableParam();
|
||||||
|
|
||||||
//监测点id拼接
|
|
||||||
StringBuilder stringBuilder = InfluxDBCommUtils.assToInfluxParam(lineIds);
|
|
||||||
areaTableParam.setStartTime(areaReportParam.getSearchBeginTime());
|
|
||||||
areaTableParam.setEndTime(areaReportParam.getSearchEndTime());
|
|
||||||
areaTableParam.setStringBuilder(stringBuilder);
|
|
||||||
|
|
||||||
|
|
||||||
//创建结果集合
|
//创建结果集合
|
||||||
// List<EventDetailNew> info = TableInfo(areaTableParam);
|
|
||||||
List<EventDetailNew> info = eventDetailList;
|
List<EventDetailNew> info = eventDetailList;
|
||||||
|
|
||||||
//将sql结果集放入,共用一个sql,减少查询时间
|
//将sql结果集放入,共用一个sql,减少查询时间
|
||||||
AreaTableParam areaTableParam1 = new AreaTableParam();
|
AreaTableParam areaTableParam1 = new AreaTableParam();
|
||||||
areaTableParam1.setStartTime(areaReportParam.getSearchBeginTime());
|
|
||||||
areaTableParam1.setEndTime(areaReportParam.getSearchEndTime());
|
|
||||||
areaTableParam1.setStringBuilder(stringBuilder);
|
|
||||||
areaTableParam1.setInfo(info);
|
areaTableParam1.setInfo(info);
|
||||||
ProbabilityVO probabilityDistributionArea = getProbabilityDistributionArea(areaTableParam1);
|
ProbabilityVO probabilityDistributionArea = getProbabilityDistributionArea(areaTableParam1);
|
||||||
|
|
||||||
// System.out.println(probabilityDistributionArea);
|
|
||||||
|
|
||||||
List<String> eventvalue = probabilityDistributionArea.getEventvalue();
|
List<String> eventvalue = probabilityDistributionArea.getEventvalue();
|
||||||
|
|
||||||
@@ -7838,48 +7586,27 @@ public class ReportServiceImpl implements ReportService {
|
|||||||
//8.事件关联统计表格
|
//8.事件关联统计表格
|
||||||
if (areaReportParam.isEventRelevanceCountTable()) {
|
if (areaReportParam.isEventRelevanceCountTable()) {
|
||||||
//事件关联统计表格
|
//事件关联统计表格
|
||||||
|
int resultCount = 0;
|
||||||
//创建存储总次数的集合
|
|
||||||
Map<String, Integer> resultCount = new HashMap<>();
|
|
||||||
|
|
||||||
//创建存储time的集合
|
|
||||||
Map<String, String> timeCount = new HashMap<>();
|
|
||||||
|
|
||||||
int resultCount1 = 0;
|
|
||||||
List<EventassCountParam> resultList = new ArrayList<>();
|
List<EventassCountParam> resultList = new ArrayList<>();
|
||||||
|
|
||||||
List<EventDetailNew> eventList = eventDetailList.stream().filter(e -> e.getEventassIndex() != "").collect(Collectors.toList());
|
List<EventDetailNew> eventList = eventDetailList.stream().filter(e ->StrUtil.isNotBlank(e.getEventassIndex())).collect(Collectors.toList());
|
||||||
|
|
||||||
if (CollectionUtil.isNotEmpty(eventList)) {
|
if (CollectionUtil.isNotEmpty(eventList)) {
|
||||||
//记录条数
|
//记录条数
|
||||||
resultCount.put("count", eventList.size());
|
resultCount= eventList.size();
|
||||||
|
|
||||||
//将时间数存入集合Map集合(主数据)
|
List<String> ids = eventList.stream().map(EventDetailNew::getEventassIndex).collect(Collectors.toList());
|
||||||
for (EventDetailNew detail : eventList) {
|
List<Eventass> eventAssList = eventDetailMapper.ListEventass(ids);
|
||||||
timeCount.put(detail.getEventassIndex(), detail.getStartTime());
|
|
||||||
}
|
|
||||||
|
|
||||||
//时间拼接 event_time=getEventassIndex
|
for (Eventass eventass : eventAssList) {
|
||||||
StringBuilder stringBuilder = InfluxDBCommUtils.assToInfluxParamAndName(new ArrayList<>(timeCount.keySet()), "event_time");
|
|
||||||
StringBuilder stringResult1 = new StringBuilder(Param.SELECT).append("pqs_eventass").append(Param.WHERE).
|
|
||||||
append("event_time = '").append(stringBuilder).append("' ");
|
|
||||||
|
|
||||||
//结果集
|
|
||||||
QueryResult result1 = influxDbUtils.query(stringResult1.toString());
|
|
||||||
|
|
||||||
//结果集映射到对象中
|
|
||||||
List<Eventass> eventassList = influxDBResultMapper.toPOJO(result1, Eventass.class);
|
|
||||||
|
|
||||||
for (Eventass eventass : eventassList) {
|
|
||||||
EventassCountParam eventassCountParam = new EventassCountParam();
|
EventassCountParam eventassCountParam = new EventassCountParam();
|
||||||
eventassCountParam.setAssTime(eventass.getTimeId().toString());
|
String dateTime = LocalDateTimeUtil.format(eventass.getTimeId(), DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss.SSS"));
|
||||||
|
eventassCountParam.setAssTime(dateTime);
|
||||||
//获取时间
|
//获取时间
|
||||||
String eventTime = timeCount.get(eventass.getEventTime());
|
eventassCountParam.setEventTime(dateTime);
|
||||||
eventassCountParam.setEventTime(eventTime);
|
eventassCountParam.setDescribe(eventass.getContentDes());
|
||||||
eventassCountParam.setDescribe(eventass.getDescribe());
|
|
||||||
resultList.add(eventassCountParam);
|
resultList.add(eventassCountParam);
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
resultCount.put("count", 0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -7889,7 +7616,7 @@ public class ReportServiceImpl implements ReportService {
|
|||||||
p.setAlignment(ParagraphAlignment.BOTH);
|
p.setAlignment(ParagraphAlignment.BOTH);
|
||||||
XWPFRun r12 = p.createRun();//创建段落文本
|
XWPFRun r12 = p.createRun();//创建段落文本
|
||||||
//归一化需要高级算法,先字符串代替
|
//归一化需要高级算法,先字符串代替
|
||||||
r12.setText(" " + deptName + "电网在所选择的分析时间段内累计监测" + typeName + "记录" + resultCount.get("count") + "条,归一化统计后共" + resultCount1 + "[此为归一化后的暂态事件结果]条,,具体如下图所示:");
|
r12.setText(" " + deptName + "电网在所选择的分析时间段内累计监测" + typeName + "记录" + eventCount+ "条,归一化统计后共" + resultCount + "[此为归一化后的暂态事件结果]条,,具体如下图所示:");
|
||||||
r12.setFontSize(11);//字体大小
|
r12.setFontSize(11);//字体大小
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -106,4 +106,14 @@ public interface CustomReportService {
|
|||||||
List<ReportTemplateVO> getTemplateByDept(String id);
|
List<ReportTemplateVO> getTemplateByDept(String id);
|
||||||
|
|
||||||
void viewCustomReportTemplateById(String id, HttpServletResponse response);
|
void viewCustomReportTemplateById(String id, HttpServletResponse response);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Description: 获取数据单位树
|
||||||
|
* @param
|
||||||
|
* @return: java.util.List<com.njcn.harmonic.pojo.vo.ReportTreeVO>
|
||||||
|
* @Author: wr
|
||||||
|
* @Date: 2023/8/28 10:58
|
||||||
|
*/
|
||||||
|
List<ReportTreeVO> deviceUnitTree();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -188,6 +188,73 @@ public class CustomReportServiceImpl implements CustomReportService {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<ReportTreeVO> deviceUnitTree() {
|
||||||
|
List<DictData> dictData = dicDataFeignClient.getDicDataByTypeCode(DicDataTypeEnum.DEVICE_UNIT.getCode()).getData();
|
||||||
|
Map<String,String> unit=new HashMap<>();
|
||||||
|
List<String> list = dictData.stream().map(DictData::getCode).collect(Collectors.toList());
|
||||||
|
List<ReportTreeVO> info=new ArrayList<>();
|
||||||
|
List<ReportTreeVO> treeVOS=new ArrayList<>();
|
||||||
|
ReportTreeVO reportTreeVO;
|
||||||
|
for (String s : list) {
|
||||||
|
treeVOS=new ArrayList<>();
|
||||||
|
//有效值
|
||||||
|
if(s.equals(DicDataEnum.EFFECTIVE.getCode())){
|
||||||
|
reportTreeVO=new ReportTreeVO();
|
||||||
|
reportTreeVO.setName("$"+s+"#i$");
|
||||||
|
reportTreeVO.setShowName(DicDataEnum.EFFECTIVE.getName());
|
||||||
|
treeVOS.add(reportTreeVO);
|
||||||
|
reportTreeVO=new ReportTreeVO();
|
||||||
|
reportTreeVO.setName("$"+s+"#v$");
|
||||||
|
reportTreeVO.setShowName(DicDataEnum.EFFECTIVE.getName());
|
||||||
|
treeVOS.add(reportTreeVO);
|
||||||
|
|
||||||
|
reportTreeVO=new ReportTreeVO();
|
||||||
|
reportTreeVO.setName(s);
|
||||||
|
reportTreeVO.setShowName(DicDataEnum.EFFECTIVE.getName());
|
||||||
|
reportTreeVO.setChildren(treeVOS);
|
||||||
|
info.add(reportTreeVO);
|
||||||
|
}
|
||||||
|
//功率
|
||||||
|
// if(s.equals(DicDataEnum.POWER.getCode())){
|
||||||
|
// unit.put(s+"#p",deviceUnit.getTotalActiveP());
|
||||||
|
// unit.put(s+"#q",deviceUnit.getTotalNoP());
|
||||||
|
// unit.put(s+"#s",deviceUnit.getTotalViewP());
|
||||||
|
// }
|
||||||
|
// //畸变率
|
||||||
|
// if(s.equals(DicDataEnum.DISTORTION.getCode())){
|
||||||
|
// unit.put(s+"#v",deviceUnit.getVdistortion());
|
||||||
|
// }
|
||||||
|
// //电压偏差
|
||||||
|
// if(s.equals(DicDataEnum.VOLTAGE.getCode())){
|
||||||
|
// unit.put(s+"#v",deviceUnit.getVoltageDev());
|
||||||
|
// }
|
||||||
|
// //频率
|
||||||
|
// if(s.equals(DicDataEnum.UNIT_FREQUENCY.getCode())){
|
||||||
|
// unit.put(s+"#freq",deviceUnit.getUnitFrequency());
|
||||||
|
// unit.put(s+"#freqDev",deviceUnit.getUnitFrequencyDev());
|
||||||
|
// }
|
||||||
|
// //三项不平衡度
|
||||||
|
// if(s.equals(DicDataEnum.UNBALANCE.getCode())){
|
||||||
|
// unit.put(s+"#v","%");
|
||||||
|
// unit.put(s+"#vPos",deviceUnit.getPositiveV());
|
||||||
|
// unit.put(s+"#vNeg",deviceUnit.getNoPositiveV());
|
||||||
|
// unit.put(s+"#vZero",deviceUnit.getNoPositiveV());
|
||||||
|
// unit.put(s+"#i","%");
|
||||||
|
// unit.put(s+"#iPos","A");
|
||||||
|
// unit.put(s+"#iNeg","A");
|
||||||
|
// unit.put(s+"#iZero","A");
|
||||||
|
// }
|
||||||
|
// //基波
|
||||||
|
// if(s.equals(DicDataEnum.FUND.getCode())){
|
||||||
|
// unit.put(s+"#i",deviceUnit.getIfund());
|
||||||
|
// unit.put(s+"#v",deviceUnit.getVfundEffective());
|
||||||
|
//
|
||||||
|
// }
|
||||||
|
}
|
||||||
|
return info;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<ReportTemplateVO> getTemplateList(ReportSearchParam reportSearchParam) {
|
public List<ReportTemplateVO> getTemplateList(ReportSearchParam reportSearchParam) {
|
||||||
return excelRptTempMapper.getReportTemplateList(reportSearchParam);
|
return excelRptTempMapper.getReportTemplateList(reportSearchParam);
|
||||||
|
|||||||
@@ -48,10 +48,18 @@ public class DicController extends BaseController {
|
|||||||
@ApiOperation("获取字典树")
|
@ApiOperation("获取字典树")
|
||||||
public HttpResult<List<DicVO>> getDicTree(){
|
public HttpResult<List<DicVO>> getDicTree(){
|
||||||
String methodDescribe = getMethodDescribe("getDicTree");
|
String methodDescribe = getMethodDescribe("getDicTree");
|
||||||
List<DicVO> list = dicService.getDicTree();
|
List<DicVO> list = dicService.getDicTree(null);
|
||||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS,list,methodDescribe);
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS,list,methodDescribe);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@OperateInfo(info = LogEnum.SYSTEM_COMMON)
|
||||||
|
@GetMapping("/codeDicTree")
|
||||||
|
@ApiOperation("根据code获取字典树")
|
||||||
|
public HttpResult<List<DicVO>> getCodeDicTree(String code){
|
||||||
|
String methodDescribe = getMethodDescribe("getCodeDicTree");
|
||||||
|
List<DicVO> list = dicService.getDicTree(code);
|
||||||
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS,list,methodDescribe);
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
* 新增
|
* 新增
|
||||||
* @param dicParam
|
* @param dicParam
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ public interface IDicService {
|
|||||||
* 获取树
|
* 获取树
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
List<DicVO> getDicTree();
|
List<DicVO> getDicTree(String code);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 功能描述:新增
|
* 功能描述:新增
|
||||||
|
|||||||
@@ -80,10 +80,10 @@ public class DicServiceImpl extends ServiceImpl<DicMapper, Dic> implements IDicS
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public List<DicVO> getDicTree() {
|
public List<DicVO> getDicTree(String code) {
|
||||||
List<DicVO> list = dicMapper.getAllDic();
|
List<DicVO> list = dicMapper.getAllDic();
|
||||||
return list.stream()
|
return list.stream()
|
||||||
.filter(fun -> Objects.equals(TemplateTreeEnum.FATHER_PID,fun.getPid()))
|
.filter(fun -> Objects.equals(TemplateTreeEnum.FATHER_PID,fun.getPid())&&fun.getCode().equals(code))
|
||||||
.peek(funS -> funS.setChildren(getChildList(funS, list)))
|
.peek(funS -> funS.setChildren(getChildList(funS, list)))
|
||||||
.sorted(Comparator.comparingInt(DicVO::getSort))
|
.sorted(Comparator.comparingInt(DicVO::getSort))
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
|
|||||||
Reference in New Issue
Block a user