Merge branch 'master' of E:\mn\pqs with conflicts.

This commit is contained in:
wurui
2023-02-13 09:33:18 +08:00
parent fd9edd3225
commit 2f16b68ba5
7 changed files with 317 additions and 251 deletions

11
pom.xml
View File

@@ -42,19 +42,19 @@
<properties>
<!--中间件目标地址-->
<!-- <middle.server.url>198.120.100.195</middle.server.url>-->
<middle.server.url>192.168.1.31</middle.server.url>
<middle.server.url>192.168.1.18</middle.server.url>
<!--微服务模块发布地址-->
<!-- <service.server.url>198.120.100.195</service.server.url>-->
<service.server.url>192.168.1.111</service.server.url>
<service.server.url>192.168.1.117</service.server.url>
<!--docker仓库地址-->
<docker.server.url>192.168.1.13</docker.server.url>
<docker.server.url>192.168.1.18</docker.server.url>
<!--nacos的ip:port-->
<nacos.url>${middle.server.url}:18848</nacos.url>
<!--服务器发布内容为空-->
<nacos.namespace></nacos.namespace>
<!-- <nacos.namespace></nacos.namespace>-->
<!-- <nacos.namespace>fd74182b-1fce-4dba-afa7-2623b0376205</nacos.namespace>-->
<!-- <nacos.namespace>ba3ba5d1-3480-4755-8b87-6b1fce16201c</nacos.namespace>-->
<!-- <nacos.namespace>f6df4a49-39cb-4355-a8fd-8aeb0c537eb1</nacos.namespace>-->
<nacos.namespace>a4165300-4f0e-4042-8a2a-e49ceba0644a</nacos.namespace>
<!--sentinel:port-->
<!-- <sentinel.url>192.168.1.14:8080</sentinel.url>-->
<sentinel.url>${middle.server.url}:8080</sentinel.url>
@@ -81,6 +81,7 @@
<mybatis.version>2.1.3</mybatis.version>
<druid.version>1.2.5</druid.version>
<mysql.version>8.0.19</mysql.version>
<mariadb.version>2.4.0</mariadb.version>
<oracle.version>21.6.0.0</oracle.version>
<orai18n.version>21.1.0.0</orai18n.version>
<mybatis-plus.version>3.4.2</mybatis-plus.version>

View File

@@ -19,18 +19,18 @@
</properties>
<dependencies>
<!-- <dependency>-->
<!-- <groupId>com.njcn</groupId>-->
<!-- <artifactId>pq-device-boot</artifactId>-->
<!-- <version>${project.version}</version>-->
<!-- </dependency>-->
<dependency>
<groupId>com.njcn</groupId>
<artifactId>pms-device-boot</artifactId>
<artifactId>pq-device-boot</artifactId>
<version>${project.version}</version>
</dependency>
<!-- <dependency>-->
<!-- <groupId>com.njcn</groupId>-->
<!-- <artifactId>pms-device-boot</artifactId>-->
<!-- <version>${project.version}</version>-->
<!-- </dependency>-->
<dependency>
<groupId>com.njcn</groupId>
<artifactId>common-swagger</artifactId>

View File

@@ -139,7 +139,7 @@ public class DeviceInfoParam implements Serializable {
@ApiModelProperty("时间范围标志 0.查询展示天 1.查询展示月")
private Integer timeFlag;
@ApiModelProperty("报表统计类型 1.年 2.季 3.月 4.周 5.天")
@ApiModelProperty("统计类型 1.年 2.季 3.月 4.周 5.天")
private String reportFlag;
}

View File

@@ -77,11 +77,11 @@
<build>
<finalName>eventboot</finalName>
<!-- <resources>
<resources>
<resource>
<directory>src/main/java</directory>
<includes>
<include>**/*.*</include>
<include>**/*.ftl</include>
</includes>
<filtering>false</filtering>
</resource>
@@ -92,9 +92,9 @@
<include>**/*.properties</include>
<include>**/*.yml</include>
</includes>
<filtering>false</filtering>
<filtering>true</filtering>
</resource>
</resources>-->
</resources>
<plugins>
<plugin>

View File

@@ -137,6 +137,8 @@ public class ReportController extends BaseController {
@ApiOperation("监测点报告导出")
@ApiImplicitParam(name = "exportParam", value = "监测点报告导出参数", required = true)
public void getLineExport(@RequestBody @Validated ExportParam exportParam, HttpServletResponse response) throws IOException, InvalidFormatException, TemplateException, ParseException {
reportService.getLineExport(exportParam,response);
// @RequestParam(name = "lineIndex") String lineIndex,@RequestParam(name = "startTime") String startTime,@RequestParam(name = "endTime") String endTime,@RequestParam("flag")Integer flag
// ExportParam exportParam = new ExportParam();
// exportParam.setFlag(flag);
@@ -169,7 +171,7 @@ public class ReportController extends BaseController {
// simpleDTO.setSort(0);
// simpleDTO.setCode("Power_Network");
// exportParam.setStatisticalType(simpleDTO);
reportService.getLineExport(exportParam,response);
}
/**

View File

@@ -37,6 +37,7 @@ import com.njcn.event.pojo.po.EventDetailNew;
import com.njcn.event.pojo.po.Eventass;
import com.njcn.event.pojo.vo.*;
import com.njcn.event.service.majornetwork.EventAnalysisService;
import com.njcn.event.service.majornetwork.EventReportService;
import com.njcn.event.service.majornetwork.ReportService;
import com.njcn.event.utils.EchartsUtil;
import com.njcn.event.utils.FreemarkerUtil;
@@ -109,6 +110,7 @@ public class ReportServiceImpl implements ReportService {
private final RestTemplate restTemplate;
private final EventReportService eventReportService;
//调用暂降密度接口
private final EventAnalysisService eventAnalysisService;
@@ -1042,9 +1044,19 @@ public class ReportServiceImpl implements ReportService {
p.setAlignment(ParagraphAlignment.LEFT);
createTitle(doc, "4. 总汇信息", "标题 1", 0, 15);
//查询参数
StatisticsParam param = new StatisticsParam(exportParam.getLineId(), exportParam.getSearchBeginTime(), exportParam.getSearchEndTime(), exportParam.getFlag());
//获取暂降原因字典
List<DictData> reasonData = dicDataFeignClient.getDicDataByTypeName(DicDataTypeEnum.EVENT_REASON.getName()).getData();
//获取暂降类型字典
List<DictData> typeData = dicDataFeignClient.getDicDataByTypeName(DicDataTypeEnum.EVENT_TYPE.getName()).getData();
//influxdb查询结果pqs_eventdetail表
List<EventDetail> info = info(param);
//记录数
int i = 1;
//监测点信息
//1.监测点信息
if (exportParam.isXq()){
createTitle(doc,"4."+i+" 监测点信息","标题 2",200,15);
XWPFTable table = createTable(doc);
@@ -1065,12 +1077,16 @@ public class ReportServiceImpl implements ReportService {
insertRow(doc,table,centerParagraph,false,"接线方式",lineDetailData.getData().getPtType());
i++;
}
//2.暂降事件暂降事件列表和暂降点图
//2.1.判断列表和点图是否是要导出
if(exportParam.isLb()||exportParam.isSjdF47() || exportParam.isSjdITIC()){
// List<EventDetail> plot = eventAnalysisService.getPlot(param);
List<EventDetail> plot = eventReportService.getPlot(info,reasonData,typeData);
//暂降事件列表
if (exportParam.isLb()){
createTitle(doc,"4."+i+" 暂降事件列表","标题 2",200,15);
XWPFTable table = createTable(doc);
XWPFParagraph centerParagraph = WordUtils.getCenterParagraph(doc);
List<EventDetail> plot = eventAnalysisService.getPlot(new StatisticsParam(exportParam.getLineId(), exportParam.getSearchBeginTime(), exportParam.getSearchEndTime(), exportParam.getFlag()));
insertRow(doc,table,centerParagraph,true,"序号","暂降发生时刻","暂降赋值(%)","持续时间(s)","暂降类型","暂降原因","严重度");
for (int j = 0; j < plot.size(); j++) {
EventDetail eventDetail = plot.get(j);
@@ -1084,38 +1100,27 @@ public class ReportServiceImpl implements ReportService {
}
//暂降事件点图
if (exportParam.isSjdF47() || exportParam.isSjdITIC()){
List<EventDetail> detailList = eventAnalysisService.getPlot(new StatisticsParam(exportParam.getLineId(), exportParam.getSearchBeginTime(), exportParam.getSearchEndTime(), exportParam.getFlag()));
ArrayList<List<Double>> ass = getAss(plot);
createTitle(doc,"4."+i+" 暂降事件点图","标题 2",200,15);
int two = 1;
if (exportParam.isSjdITIC()){
createTitle(doc,"4."+i+"."+two+" ITIC 曲线","标题 3",400,15);
ArrayList<List<Double>> list = new ArrayList<>();
for (EventDetail eventDetail : detailList) {
ArrayList<Double> doubles = new ArrayList<>();
doubles.add(Double.parseDouble(eventDetail.getPersistTime() / 1000 + ""));
doubles.add(Double.parseDouble(String.valueOf(eventDetail.getEventValue() * 100)));
list.add(doubles);
}
String itic = getITIC(list);
String itic = getITIC(ass);
createPic(doc,itic,"ITIC曲线");
two++;
}
if (exportParam.isSjdF47()){
createTitle(doc,"4."+i+"."+two+" F47 曲线","标题 3",400,15);
ArrayList<List<Double>> list = new ArrayList<>();
for (EventDetail eventDetail : detailList) {
ArrayList<Double> doubles = new ArrayList<>();
doubles.add(Double.parseDouble(eventDetail.getPersistTime() / 1000 + ""));
doubles.add(Double.parseDouble(String.valueOf(eventDetail.getEventValue() * 100)));
list.add(doubles);
}
String f47 = getF47(list);
String f47 = getF47(ass);
createPic(doc,f47,"SEMI F47曲线");
two++;
}
i++;
}
//暂降密度
}
//3.暂降密度
if (exportParam.isMdbg() || exportParam.isMdtx()){
createTitle(doc,"4."+i+" 暂降密度","标题 2",200,15);
int two = 1;
@@ -1126,7 +1131,9 @@ public class ReportServiceImpl implements ReportService {
if (exportParam.isMdbg()){
XWPFParagraph centerParagraph = WordUtils.getCenterParagraph(doc);
createTitle(doc,"4."+i+"."+two+" DISDIP 表格:国际发配电联盟(UNIPEDE)","标题 3",400,15);
List<DISDIPVO> eventDisdip = eventAnalysisService.eventDisdip(new StatisticsParam(exportParam.getLineId(), exportParam.getSearchBeginTime(), exportParam.getSearchEndTime(), exportParam.getFlag()));
// List<DISDIPVO> eventDisdip = eventAnalysisService.eventDisdip(new StatisticsParam(exportParam.getLineId(), exportParam.getSearchBeginTime(), exportParam.getSearchEndTime(),exportParam.getFlag()));
List<DISDIPVO> eventDisdip = eventReportService.eventDisdip(info);
XWPFTable table1 = createTable(doc);
insertRow(doc,table1,centerParagraph,true,"剩余电压","20ms","100ms","500ms","1s","3s","20s","60s","180s");
for (int j = 0; j < eventDisdip.size(); j++) {
@@ -1135,7 +1142,8 @@ public class ReportServiceImpl implements ReportService {
}
two++;
createTitle(doc,"4."+i+"."+two+" IEC 61000-4-11:(用电终端的电压暂降抗度)","标题 3",400,15);
List<IEC411VO> iec411VOS = eventAnalysisService.IEC411(new StatisticsParam(exportParam.getLineId(), exportParam.getSearchBeginTime(), exportParam.getSearchEndTime(), exportParam.getFlag()));
// List<IEC411VO> iec411VOS = eventAnalysisService.IEC411(new StatisticsParam(exportParam.getLineId(), exportParam.getSearchBeginTime(), exportParam.getSearchEndTime(),exportParam.getFlag()));
List<IEC411VO> iec411VOS = eventReportService.IEC411(info);
XWPFTable table2 = createTable(doc);
insertRow(doc,table2,centerParagraph,true,"剩余电压","10~20ms","20~100ms","0.1~0.2s","0.2~0.5s","0.5~1s",">1s");
for (int j = 0; j < iec411VOS.size(); j++) {
@@ -1144,7 +1152,8 @@ public class ReportServiceImpl implements ReportService {
}
two++;
createTitle(doc,"4."+i+"."+two+" IEC 61000-2-8:(公共电网电压暂降测量统计)","标题 3",400,15);
List<IEC28VO> iec28VOS = eventAnalysisService.IEC28(new StatisticsParam(exportParam.getLineId(), exportParam.getSearchBeginTime(), exportParam.getSearchEndTime(), exportParam.getFlag()));
// List<IEC28VO> iec28VOS = eventAnalysisService.IEC28(new StatisticsParam(exportParam.getLineId(), exportParam.getSearchBeginTime(), exportParam.getSearchEndTime(),exportParam.getFlag()));
List<IEC28VO> iec28VOS = eventReportService.IEC28(info);
XWPFTable table3 = createTable(doc);
insertRow(doc,table3,centerParagraph,true,"剩余电压","0.02~0.1s","0.1~0.25s","0.25~0.5s","0.5s~1s","1~3s","3~20s","20~60s","60~180s");
for (int j = 0; j < iec28VOS.size(); j++) {
@@ -1155,10 +1164,11 @@ public class ReportServiceImpl implements ReportService {
}
i++;
}
//暂降幅值概率分布
//4.暂降幅值概率分布
if (exportParam.isGlfbfz() || exportParam.isGlfbsj()){
createTitle(doc,"4."+i+" 暂降幅值概率分布图","标题 2",200,15);
ProbabilityVO probabilityVO = eventAnalysisService.getProbabilityDistribution(new StatisticsParam(exportParam.getLineId(), exportParam.getSearchBeginTime(), exportParam.getSearchEndTime(), exportParam.getFlag()));
// ProbabilityVO probabilityVO = eventAnalysisService.getProbabilityDistribution(new StatisticsParam(exportParam.getLineId(), exportParam.getSearchBeginTime(), exportParam.getSearchEndTime(),exportParam.getFlag()));
ProbabilityVO probabilityVO = eventReportService.getProbabilityDistribution(info);
int two = 1;
if (exportParam.isGlfbfz()){
createTitle(doc,"4."+i+"."+two+" 暂降幅值的概率分函数","标题 3",400,15);
@@ -1178,11 +1188,15 @@ public class ReportServiceImpl implements ReportService {
}
i++;
}
//月份统计
//5.月份统计
if (exportParam.isTjbg() || exportParam.isTjtx()){
createTitle(doc,"4."+i+" 月份统计","标题 2",200,15);
int two = 1;
List<TimeVO> reasonTypeTime = eventAnalysisService.getReasonTypeTime(new StatisticsParam(exportParam.getLineId(), exportParam.getSearchBeginTime(), exportParam.getSearchEndTime(), exportParam.getFlag()));
List<TimeVO> reasonTypeTime = eventAnalysisService.getReasonTypeTime(param);
//暂时时间端按月查询不能查询
// List<TimeVO> reasonTypeTime = eventReportService.getReasonTypeTime(param,null);
if (exportParam.isTjtx()){
createTitle(doc,"4."+i+"."+two+" 月份统计图","标题 3",400,15);
List<Integer> count = new ArrayList<>();
@@ -1227,10 +1241,16 @@ public class ReportServiceImpl implements ReportService {
}
i++;
}
//原因统计
//6.原因统计
//6.1整合提出查询语句
Boolean fly=exportParam.isYybg() || exportParam.isYytx()||exportParam.isLxbg() || exportParam.isLxtx();
if(fly){
StatisticVO statistic = eventReportService.getStatistic(info,reasonData,typeData);
if (exportParam.isYybg() || exportParam.isYytx()){
createTitle(doc,"4."+i+" 原因统计","标题 2",200,15);
StatisticVO statistic = eventAnalysisService.getStatistic(new StatisticsParam(exportParam.getLineId(), exportParam.getSearchBeginTime(), exportParam.getSearchEndTime(), exportParam.getFlag()));
// StatisticVO statistic = eventAnalysisService.getStatistic(new StatisticsParam(exportParam.getLineId(), exportParam.getSearchBeginTime(), exportParam.getSearchEndTime(),exportParam.getFlag()));
int two = 1;
if (exportParam.isYytx()){
createTitle(doc,"4."+i+"."+two+" 原因统计图","标题 3",400,15);
@@ -1257,10 +1277,10 @@ public class ReportServiceImpl implements ReportService {
}
i++;
}
//类型统计
//7.类型统计
if (exportParam.isLxbg() || exportParam.isLxtx()){
createTitle(doc,"4."+i+" 类型统计","标题 2",200,15);
StatisticVO statistic = eventAnalysisService.getStatistic(new StatisticsParam(exportParam.getLineId(), exportParam.getSearchBeginTime(), exportParam.getSearchEndTime(), exportParam.getFlag()));
// StatisticVO statistic = eventAnalysisService.getStatistic(new StatisticsParam(exportParam.getLineId(), exportParam.getSearchBeginTime(), exportParam.getSearchEndTime(),exportParam.getFlag()));
int two = 1;
if (exportParam.isLxtx()){
createTitle(doc,"4."+i+"."+two+" 类型统计图","标题 3",400,15);
@@ -1289,6 +1309,8 @@ public class ReportServiceImpl implements ReportService {
}
i++;
}
}
ServletOutputStream outputStream = response.getOutputStream();
String fileName = URLEncoder.encode(exportParam.getLineName() + ".docx", "UTF-8");
@@ -1298,6 +1320,45 @@ public class ReportServiceImpl implements ReportService {
outputStream.close();
}
/**
* 监测点暂降事件点图赋值
* @param plot
* @return
*/
private ArrayList<List<Double>> getAss(List<EventDetail> plot){
ArrayList<List<Double>> list = new ArrayList<>();
for (EventDetail eventDetail : plot) {
ArrayList<Double> doubles = new ArrayList<>();
doubles.add(Double.parseDouble(eventDetail.getPersistTime()/1000+""));
doubles.add(Double.parseDouble(String.valueOf(eventDetail.getEventValue()*100)));
list.add(doubles);
}
return list;
}
/**
* influxdb查询结果集
* @param statisticsParam
* @return
*/
private List<EventDetail> info (StatisticsParam statisticsParam){
//构建sql语句
StringBuffer stringResult=new StringBuffer();
stringResult.append(Param.SELECT).append(Param.EVENT_DETAIL).append(Param.WHERE)
.append("time >= '").append( DateUtil.beginOfDay(DateUtil.parse(statisticsParam.getStartTime()))+"'")
.append(" and time <= '").append(DateUtil.beginOfDay(DateUtil.parse(statisticsParam.getEndTime()))+"'")
.append(" and line_id = '").append(statisticsParam.getLineIndex()+"'")
.append(" and wave_type = 5 ").append(Param.TZ_ASIA_SHANGHAI);
//结果集映射到对象中
System.out.println(stringResult);
QueryResult query = influxDbUtils.query(stringResult.toString());
InfluxDBResultMapper influxDBResultMapper = new InfluxDBResultMapper();
return influxDBResultMapper.toPOJO(query, EventDetail.class);
}
public String getStr(String barName,Map<String,Object> map) throws TemplateException, IOException {
String s = FreemarkerUtil.generateString(barName, "com/njcn/event/template", map);
return EchartsUtil.generateEchartsBase64(s, "8910");
@@ -3831,6 +3892,7 @@ public class ReportServiceImpl implements ReportService {
createPic(doc, yftj, ""+typeName+"事件图形");
//创建部门与监测点次数的map集合
List<GeneralDeviceDTO> areaParamList = generalDeviceInfoClient.getPracticalAllDeviceInfo(areaParam).getData();
Map<String, Integer> lineCount1 = new HashMap<>();
@@ -3923,6 +3985,7 @@ public class ReportServiceImpl implements ReportService {
createPic(doc, yftj, ""+typeName+"事件图形");
//创建部门与监测点次数的map集合
Map<String, Integer> lineCount1 = new HashMap<>();
List<GeneralDeviceDTO> areaParamList = generalDeviceInfoClient.getPracticalAllDeviceInfo(areaParam).getData();

View File

@@ -3,12 +3,11 @@ package com.njcn.event.service.majornetwork;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.njcn.device.pq.pojo.param.DeviceInfoParam;
import com.njcn.event.pojo.param.*;
import com.njcn.event.pojo.vo.DetailVO;
import com.njcn.event.pojo.vo.GeneralVO;
import com.njcn.event.pojo.vo.ReasonsVO;
import com.njcn.event.pojo.vo.WaveTypeVO;
import com.njcn.event.pojo.po.EventDetail;
import com.njcn.event.pojo.vo.*;
import freemarker.template.TemplateException;
import org.apache.poi.openxml4j.exceptions.InvalidFormatException;
import org.influxdb.dto.QueryResult;
import javax.servlet.http.HttpServletResponse;
import java.io.FileNotFoundException;
@@ -58,4 +57,5 @@ public interface ReportService {
void getAreaReport(AreaReportParam areaReportParam, HttpServletResponse response) throws Exception;
}