暂降模块代码合并
终端运行管理接口调整
This commit is contained in:
@@ -88,7 +88,11 @@ public enum CommonResponseEnum {
|
||||
|
||||
DEPT_BINDED("A0099", "部门id已绑定"),
|
||||
|
||||
ID_NOT_EXIST("A0099", "id不存在"),
|
||||
ID_NOT_EXIST("A0100", "id不存在"),
|
||||
|
||||
TIME_ERROR("A0101","时间格式有误"),
|
||||
|
||||
|
||||
;
|
||||
|
||||
private final String code;
|
||||
|
||||
@@ -178,6 +178,26 @@ public class PubUtils {
|
||||
return LocalDateTime.parse(time, dateTimeFormatter);
|
||||
}
|
||||
|
||||
/**
|
||||
* 校验时间格式
|
||||
*/
|
||||
public static boolean checkDateTime(String time) {
|
||||
if(StrUtil.isBlank(time)){
|
||||
throw new BusinessException(CommonResponseEnum.TIME_ERROR);
|
||||
}
|
||||
SimpleDateFormat simpleDateFormat = new SimpleDateFormat(DATE_TIME);
|
||||
|
||||
try {
|
||||
simpleDateFormat.parse(time);
|
||||
} catch (Exception e) {
|
||||
throw new BusinessException(CommonResponseEnum.TIME_ERROR);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 用于获取对象中,前缀一样,后缀为2~50的属性值
|
||||
*
|
||||
|
||||
@@ -1,11 +1,14 @@
|
||||
package com.njcn.device.controller;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.date.format.DatePrinter;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.njcn.common.pojo.annotation.OperateInfo;
|
||||
import com.njcn.common.pojo.enums.common.LogEnum;
|
||||
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
||||
import com.njcn.common.pojo.response.HttpResult;
|
||||
import com.njcn.common.utils.HttpResultUtil;
|
||||
import com.njcn.common.utils.PubUtils;
|
||||
import com.njcn.device.pojo.param.DeviceInfoParam;
|
||||
import com.njcn.device.pojo.param.RunManageParam;
|
||||
import com.njcn.device.pojo.param.TerminalLedgerParam;
|
||||
@@ -23,6 +26,9 @@ import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.text.DateFormat;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@@ -45,9 +51,9 @@ public class RunManageController extends BaseController {
|
||||
@PostMapping("/getLineLedger")
|
||||
@ApiOperation("监测点台账信息")
|
||||
@ApiImplicitParam(name = "runManageParam", value = "监测点台账参数", required = true)
|
||||
public HttpResult<Page<RunManageVO>> getLineLedger(@RequestBody @Validated RunManageParam runManageParam) {
|
||||
public HttpResult<List<RunManageVO>> getLineLedger(@RequestBody @Validated RunManageParam runManageParam) {
|
||||
String methodDescribe = getMethodDescribe("getLineLedger");
|
||||
Page<RunManageVO> res = runManageService.getLineLedger(runManageParam);
|
||||
List<RunManageVO> res = runManageService.getLineLedger(runManageParam);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, res, methodDescribe);
|
||||
}
|
||||
|
||||
|
||||
@@ -25,7 +25,6 @@ public interface DeviceMapper extends BaseMapper<Device> {
|
||||
* @author cdf
|
||||
* @date 2022/5/11
|
||||
*/
|
||||
//TODO
|
||||
List<Device> getDeviceList(@Param("list") List<String> list);
|
||||
|
||||
/**
|
||||
@@ -35,7 +34,7 @@ public interface DeviceMapper extends BaseMapper<Device> {
|
||||
* @param runFlag 状态
|
||||
* @return 结果
|
||||
*/
|
||||
Page<RunManageVO> getRunManageList(@Param("page") Page<RunManageVO> page, @Param("list") List<String> list, @Param("comFlag")List<Integer> comFlag, @Param("runFlag")List<Integer> runFlag);
|
||||
List<RunManageVO> getRunManageList(@Param("list") List<String> list, @Param("comFlag")List<Integer> comFlag, @Param("runFlag")List<Integer> runFlag);
|
||||
|
||||
/**
|
||||
* 获取监测点台账信息
|
||||
|
||||
@@ -21,7 +21,7 @@ public interface RunManageService {
|
||||
* @param runManageParam 参数
|
||||
* @return 结果
|
||||
*/
|
||||
Page<RunManageVO> getLineLedger(RunManageParam runManageParam);
|
||||
List<RunManageVO> getLineLedger(RunManageParam runManageParam);
|
||||
|
||||
/**
|
||||
* 获取终端台账信息
|
||||
|
||||
@@ -3,6 +3,7 @@ package com.njcn.device.service.impl;
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.date.LocalDateTimeUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.njcn.common.pojo.dto.SimpleDTO;
|
||||
@@ -43,6 +44,7 @@ import org.springframework.stereotype.Service;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.text.DateFormat;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.*;
|
||||
@@ -77,14 +79,13 @@ public class RunManageServiceImpl implements RunManageService {
|
||||
private final InfluxDbUtils influxDbUtils;
|
||||
|
||||
@Override
|
||||
public Page<RunManageVO> getLineLedger(RunManageParam runManageParam) {
|
||||
public List<RunManageVO> getLineLedger(RunManageParam runManageParam) {
|
||||
DeviceInfoParam deviceInfoParam = new DeviceInfoParam();
|
||||
BeanUtil.copyProperties(runManageParam, deviceInfoParam);
|
||||
List<GeneralDeviceDTO> generalDeviceDTOList = generalDeviceService.getDeviceInfo(deviceInfoParam, runManageParam.getRunFlag(), Stream.of(1).collect(Collectors.toList()));
|
||||
List<String> lineIndexes = generalDeviceDTOList.stream().flatMap(list->list.getLineIndexes().stream()).collect(Collectors.toList());
|
||||
if (!CollectionUtils.isEmpty(lineIndexes)) {
|
||||
Page<RunManageVO> page = new Page<>(PageFactory.getPageNum(runManageParam),PageFactory.getPageSize(runManageParam));
|
||||
return deviceMapper.getRunManageList(page,lineIndexes, runManageParam.getComFlag(), runManageParam.getRunFlag());
|
||||
return deviceMapper.getRunManageList(lineIndexes, runManageParam.getComFlag(), runManageParam.getRunFlag());
|
||||
}else {
|
||||
throw new BusinessException(CommonResponseEnum.FAIL);
|
||||
}
|
||||
@@ -99,14 +100,16 @@ public class RunManageServiceImpl implements RunManageService {
|
||||
|
||||
if (!CollectionUtils.isEmpty(generalDeviceDTOList)) {
|
||||
List<String> devIndexes = generalDeviceDTOList.stream().flatMap(list->list.getDeviceIndexes().stream()).collect(Collectors.toList());
|
||||
|
||||
DateFormat bf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
runManageParam.setSearchBeginTime(DateUtil.beginOfMonth(new Date()).toString(bf));
|
||||
runManageParam.setSearchEndTime(DateUtil.endOfMonth(new Date()).toString(bf));
|
||||
if(CollectionUtil.isNotEmpty(devIndexes)){
|
||||
runManageDevList = deviceMapper.getRunManageDevList(devIndexes, runManageParam.getComFlag(), runManageParam.getRunFlag());
|
||||
|
||||
StringBuilder devSql = InfluxDBCommUtils.assToInfluxParamDev(devIndexes);
|
||||
String stringBuilder = "time >= '" + runManageParam.getSearchBeginTime() + "' and " + "time <= '" + runManageParam.getSearchEndTime()+"' and "+devSql+" group by dev_id";
|
||||
//sql语句
|
||||
String sql = "SELECT MEAN(online_rate) AS online_rate FROM " + PQS_ONLINERATE + " WHERE " + stringBuilder + TIME_ZONE+")";
|
||||
String sql = "SELECT MEAN(online_rate) AS online_rate FROM " + PQS_ONLINERATE + " WHERE " + stringBuilder + TIME_ZONE;
|
||||
QueryResult queryResult = influxDbUtils.query(sql);
|
||||
|
||||
InfluxDBResultMapper inCn = new InfluxDBResultMapper();
|
||||
@@ -117,38 +120,11 @@ public class RunManageServiceImpl implements RunManageService {
|
||||
return runManageDevList;
|
||||
}
|
||||
|
||||
/* private Float getCondition(String startTime, String endTime, String lineId) {
|
||||
final Float[] floatList = {0.0f};
|
||||
QueryResult queryResult;
|
||||
if (!lineId.isEmpty()) {
|
||||
//组装sql语句
|
||||
String stringBuilder = "time >= '" + startTime + "' and " + "time <= '" + endTime + "' and (" + DEV_INDEX + " ='" + lineId + "') ";
|
||||
//sql语句
|
||||
String sql = "SELECT SUM(" + ONLINE_MIN + ")/(SUM(" + OFFLINE_MIN + ")+SUM(" + ONLINE_MIN + ")) AS onlineRate FROM " + PQS_ONLINERATE + " WHERE " + stringBuilder + TIME_ZONE;
|
||||
queryResult = influxDbUtils.query(sql);
|
||||
//处理结果集
|
||||
List<org.influxdb.dto.QueryResult.Series> list = queryResult.getResults().get(0).getSeries();
|
||||
if (!CollectionUtils.isEmpty(list)) {
|
||||
list.forEach(po -> {
|
||||
List<List<Object>> valueList = po.getValues();
|
||||
if (!CollectionUtils.isEmpty(valueList)) {
|
||||
for (List<Object> value : valueList) {
|
||||
//数据完整性 保留四位小数
|
||||
floatList[0] = value.get(1) == null ? null : BigDecimal.valueOf(Float.parseFloat(value.get(1).toString())).setScale(4, BigDecimal.ROUND_HALF_UP).floatValue();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
return floatList[0];
|
||||
}
|
||||
|
||||
return floatList[0];
|
||||
}*/
|
||||
|
||||
@Override
|
||||
public List<TerminalLedgerVO> getTerminalLedger(DeviceInfoParam deviceInfoParam) {
|
||||
//定义待返回终端信息
|
||||
List<GeneralDeviceDTO> generalDeviceDTOList = generalDeviceService.getDeviceInfoAsDept(deviceInfoParam, Stream.of(0).collect(Collectors.toList()), Stream.of(1).collect(Collectors.toList()));
|
||||
List<GeneralDeviceDTO> generalDeviceDTOList = generalDeviceService.getDeviceInfo(deviceInfoParam, Stream.of(0).collect(Collectors.toList()), Stream.of(1).collect(Collectors.toList()));
|
||||
List<TerminalLedgerVO> terminalLedgerVOList = new ArrayList<>();
|
||||
if (CollectionUtil.isNotEmpty(generalDeviceDTOList)) {
|
||||
|
||||
|
||||
@@ -16,7 +16,18 @@ public enum EventResponseEnum {
|
||||
*/
|
||||
EVENT_COMMON_ERROR("A00650","暂降模块异常"),
|
||||
EVENT_NOT_FOUND("A00651","暂降事件或监测点不存在"),
|
||||
ANALYSEWAVE_NOT_FOUND("A00652","波形文件找不到")
|
||||
ANALYSEWAVE_NOT_FOUND("A00652","波形文件找不到"),
|
||||
|
||||
|
||||
/**
|
||||
* zbj
|
||||
* 2022/8/4
|
||||
*/
|
||||
EVENT_REASON_NOT_FOUND("A00653","暂态原因不存在"),
|
||||
EVENT_TYPE_NOT_FOUND("A00654","暂态类型不存在"),
|
||||
INDEX_OUT_OF_BOUNDS("A00655","集合索引越界异常"),
|
||||
|
||||
NOT_FOUND("A00656","没有查到数据"),
|
||||
;
|
||||
|
||||
private final String code;
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
package com.njcn.event.pojo.param;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @author zbj
|
||||
* @version 1.0.0
|
||||
* @date 2022年08月23日
|
||||
*/
|
||||
@Data
|
||||
public class AmplitudeCountParam {
|
||||
|
||||
private String xName;
|
||||
|
||||
private String yValue;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
package com.njcn.event.pojo.param;
|
||||
|
||||
import com.njcn.event.pojo.po.EventDetail;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.time.Instant;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author zbj
|
||||
* @version 1.0.0
|
||||
* @date 2022年08月18日
|
||||
*/
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class AreaEventMonthParam implements Serializable {
|
||||
|
||||
@ApiModelProperty(name = "time", value = "对应月份或者时间")
|
||||
private String dayOrMonth;
|
||||
|
||||
|
||||
@ApiModelProperty(name = "eventAssIndex", value = "关联处理事件时间")
|
||||
private String eventAssIndex;
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package com.njcn.event.pojo.param;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @author zbj
|
||||
* @version 1.0.0
|
||||
* @date 2022年08月25日
|
||||
*/
|
||||
@Data
|
||||
public class AreaOnlineOrUnlinetParam {
|
||||
|
||||
private String name;
|
||||
|
||||
private Integer sumCont;
|
||||
|
||||
private Integer onlineCount;
|
||||
|
||||
private Integer unlineCount;
|
||||
}
|
||||
@@ -0,0 +1,76 @@
|
||||
package com.njcn.event.pojo.param;
|
||||
|
||||
|
||||
import com.njcn.device.pojo.param.DeviceInfoParam;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import org.hibernate.validator.constraints.Range;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* @version 1.0.0
|
||||
* @author: zbj
|
||||
* @date: 2022/08/04
|
||||
*/
|
||||
@Data
|
||||
@ApiModel
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class AreaReportParam extends DeviceInfoParam.BusinessParam {
|
||||
|
||||
@ApiModelProperty("监测网分布图形")
|
||||
private boolean monitorDistributeChart = false;
|
||||
|
||||
@ApiModelProperty("暂降事件统计表格")
|
||||
private boolean eventCountTable = false;
|
||||
|
||||
@ApiModelProperty("暂降事件统计图形")
|
||||
private boolean eventCountChart = false;
|
||||
|
||||
@ApiModelProperty("暂降密度表格")
|
||||
private boolean densityTable = false;
|
||||
|
||||
@ApiModelProperty("暂降密度图形")
|
||||
private boolean densityChart = false;
|
||||
|
||||
@ApiModelProperty("暂降事件点ITIC")
|
||||
private boolean itic = false;
|
||||
|
||||
@ApiModelProperty("暂降事件点F47")
|
||||
private boolean f47 = false;
|
||||
|
||||
@ApiModelProperty("概率分布暂降幅值")
|
||||
private boolean sagAmplitude = false;
|
||||
|
||||
@ApiModelProperty("概率分布持续时间")
|
||||
private boolean duration = false;
|
||||
|
||||
@ApiModelProperty("事件关联统计表格")
|
||||
private boolean eventRelevanceCountTable = false;
|
||||
|
||||
@ApiModelProperty("暂降原因表格")
|
||||
private boolean eventReasonTable = false;
|
||||
|
||||
@ApiModelProperty("暂降原因图形")
|
||||
private boolean eventReasonChart = false;
|
||||
|
||||
@ApiModelProperty("暂降类型表格")
|
||||
private boolean eventTypeTable = false;
|
||||
|
||||
@ApiModelProperty("暂降类型图形")
|
||||
private boolean eventTypeChart = false;
|
||||
|
||||
@ApiModelProperty("暂降热力图")
|
||||
private boolean thermodynamicChart = false;
|
||||
|
||||
@ApiModelProperty("触发类型")
|
||||
private Integer waveType;
|
||||
|
||||
@NotNull
|
||||
@ApiModelProperty("日期下拉框 0:月 , 1:天")
|
||||
private String interval;
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
package com.njcn.event.pojo.param;
|
||||
|
||||
import com.njcn.event.pojo.po.EventDetail;
|
||||
import com.njcn.event.pojo.po.EventDetailNew;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author zbj
|
||||
* @version 1.0.0
|
||||
* @date 2022年08月18日
|
||||
*/
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class AreaTableParam implements Serializable {
|
||||
|
||||
|
||||
@ApiModelProperty(name = "StringBuilder", value = "监测点拼接的字符串")
|
||||
private StringBuilder stringBuilder;
|
||||
|
||||
|
||||
@ApiModelProperty(name = "startTime", value = "开始时间")
|
||||
private String startTime;
|
||||
|
||||
|
||||
@ApiModelProperty(name = "endTime", value = "结束时间")
|
||||
private String endTime;
|
||||
|
||||
@ApiModelProperty(name = "info", value = "sql结果集")
|
||||
private List<EventDetailNew> info;
|
||||
|
||||
@ApiModelProperty(name = "waveType", value = "暂态类型")
|
||||
private Integer waveType;
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,41 @@
|
||||
package com.njcn.event.pojo.param;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* pqs-event
|
||||
*
|
||||
* @author zbj
|
||||
* @date 2022/8/15
|
||||
*/
|
||||
@Data
|
||||
public class DISDIPCountParam {
|
||||
|
||||
//剩余电压名称
|
||||
private String name;
|
||||
|
||||
//20ms
|
||||
private int twentyMS = 0;
|
||||
|
||||
//100
|
||||
private int oneHundredMS = 0;
|
||||
|
||||
//500
|
||||
private int fiveHundredMS = 0;
|
||||
|
||||
//1
|
||||
private int one = 0;
|
||||
|
||||
//3
|
||||
private int three = 0;
|
||||
|
||||
//20
|
||||
private int twenty = 0;
|
||||
|
||||
//60
|
||||
private int sixty = 0;
|
||||
|
||||
//180
|
||||
private int oneHundredAndEighty = 0;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
package com.njcn.event.pojo.param;
|
||||
|
||||
import com.njcn.event.pojo.po.EventDetail;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author zbj
|
||||
* @version 1.0.0
|
||||
* @date 2022年08月24日
|
||||
*/
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class EventassCountParam implements Serializable {
|
||||
|
||||
|
||||
@ApiModelProperty(name = "assTime", value = "ass时间")
|
||||
private String assTime;
|
||||
|
||||
|
||||
@ApiModelProperty(name = "eventTime", value = "event时间")
|
||||
private String eventTime;
|
||||
|
||||
|
||||
@ApiModelProperty(name = "describe", value = "事件关联描述")
|
||||
private String describe;
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,75 @@
|
||||
package com.njcn.event.pojo.param;
|
||||
|
||||
import com.njcn.device.pojo.param.DeviceInfoParam;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.Getter;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @author xxy
|
||||
* @version 1.0.0
|
||||
* @date 2022年08月16日 19:37
|
||||
*/
|
||||
@Data
|
||||
public class ExportParam implements Serializable {
|
||||
|
||||
@ApiModelProperty(name = "lineId",value = "监测点ID")
|
||||
private String lineId;
|
||||
|
||||
@ApiModelProperty(name = "searchBeginTime",value = "开始时间")
|
||||
private String searchBeginTime;
|
||||
|
||||
@ApiModelProperty(name = "searchEndTime",value = "结束时间")
|
||||
private String searchEndTime;
|
||||
|
||||
@ApiModelProperty(name = "lineName",value = "监测点名称")
|
||||
private String lineName;
|
||||
|
||||
@ApiModelProperty(name = "xq",value = "监测点详情")
|
||||
private boolean xq;
|
||||
|
||||
@ApiModelProperty(name = "lb",value = "暂降事件列表")
|
||||
private boolean lb;
|
||||
|
||||
@ApiModelProperty(name = "mdbg",value = "暂降密度表格")
|
||||
private boolean mdbg;
|
||||
|
||||
@ApiModelProperty(name = "mdtx",value = "暂降密度图形")
|
||||
private boolean mdtx;
|
||||
|
||||
@ApiModelProperty(name = "sjdITIC",value = "暂降时间点ITIC")
|
||||
private boolean sjdITIC;
|
||||
|
||||
@ApiModelProperty(name = "sjdF47",value = "暂降时间点F47")
|
||||
private boolean sjdF47;
|
||||
|
||||
@ApiModelProperty(name = "glfbfz",value = "概率分布暂降赋值")
|
||||
private boolean glfbfz;
|
||||
|
||||
@ApiModelProperty(name = "glfbsj",value = "概率分布持续时间")
|
||||
private boolean glfbsj;
|
||||
|
||||
@ApiModelProperty(name = "tjbg",value = "月份统计表格")
|
||||
private boolean tjbg;
|
||||
|
||||
@ApiModelProperty(name = "tjtx",value = "月份统计图形")
|
||||
private boolean tjtx;
|
||||
|
||||
@ApiModelProperty(name = "yybg",value = "暂降原因表格")
|
||||
private boolean yybg;
|
||||
|
||||
@ApiModelProperty(name = "yytx",value = "暂降原因图形")
|
||||
private boolean yytx;
|
||||
|
||||
@ApiModelProperty(name = "lxbg",value = "暂降类型表格")
|
||||
private boolean lxbg;
|
||||
|
||||
@ApiModelProperty(name = "lxtx",value = "暂降类型图形")
|
||||
private boolean lxtx;
|
||||
|
||||
@ApiModelProperty(name = "flag",value = "标识")
|
||||
private Integer flag;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
package com.njcn.event.pojo.param;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* pqs-event
|
||||
*
|
||||
* @author zbj
|
||||
* @date 2022/8/15
|
||||
*/
|
||||
@Data
|
||||
public class IEC28CountParam {
|
||||
|
||||
//剩余电压名称
|
||||
private String name;
|
||||
|
||||
//0.02~0.1
|
||||
private int zeroZeroTwoToZeroOne = 0;
|
||||
|
||||
//0.1~0.25
|
||||
private int zeroOneToZeroTwentyFive = 0;
|
||||
|
||||
//0.25~0.5
|
||||
private int zeroTwentyFiveToZeroFive = 0;
|
||||
|
||||
//0.5~1
|
||||
private int zeroFiveToOne = 0;
|
||||
|
||||
//1~3
|
||||
private int oneToThree = 0;
|
||||
|
||||
//3~20
|
||||
private int threeToTwenty = 0;
|
||||
|
||||
//20~60
|
||||
private int twentyToSixty = 0;
|
||||
|
||||
//60~180
|
||||
private int sixtyToOneHundredAndEighty = 0;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
package com.njcn.event.pojo.param;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* pqs-event
|
||||
*
|
||||
* @author zbj
|
||||
* @date 2022/8/15
|
||||
*/
|
||||
@Data
|
||||
public class IEC411CountParam {
|
||||
|
||||
//剩余电压名称
|
||||
private String name;
|
||||
|
||||
//10~20
|
||||
private int tenToTwenty = 0;
|
||||
|
||||
//20~100
|
||||
private int twentyToHundred = 0;
|
||||
|
||||
//0.1~0.2
|
||||
private int zeroOneToZeroTwo = 0;
|
||||
|
||||
//0.2~0.5
|
||||
private int zeroTwoToZeroFive = 0;
|
||||
|
||||
//0.5~1
|
||||
private int zeroFiveToOne = 0;
|
||||
|
||||
//>1
|
||||
private int lessOne = 0;
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
package com.njcn.event.pojo.param;
|
||||
|
||||
import lombok.Data;
|
||||
/**
|
||||
* @author zbj
|
||||
* @version 1.0.0
|
||||
* @date 2022年08月17日
|
||||
*/
|
||||
@Data
|
||||
public class ReportCountParam {
|
||||
|
||||
private String name;
|
||||
|
||||
private String count;
|
||||
|
||||
private String relevanceCount;
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
package com.njcn.event.pojo.param;
|
||||
|
||||
import com.njcn.web.pojo.param.BaseParam;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @author xxy
|
||||
* @version 1.0.0
|
||||
* @date 2022年08月09日 08:45
|
||||
*/
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class ReportParam extends BaseParam implements Serializable {
|
||||
|
||||
@ApiModelProperty(name = "staFlag")
|
||||
private boolean staFalg;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
package com.njcn.event.pojo.param;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @author xxy
|
||||
* @version 1.0.0
|
||||
* @date 2022年08月01日 15:35
|
||||
*/
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class StatisticsParam implements Serializable {
|
||||
|
||||
@NotBlank(message = "没有监测点ID")
|
||||
@ApiModelProperty(name = "lineIndex",value = "监测点ID")
|
||||
private String lineIndex;
|
||||
|
||||
@NotBlank(message = "没有开始时间")
|
||||
@ApiModelProperty(name = "startTime",value = "开始时间")
|
||||
private String startTime;
|
||||
|
||||
@NotBlank(message = "没有结束时间")
|
||||
@ApiModelProperty(name = "endTime",value = "结束时间")
|
||||
private String endTime;
|
||||
|
||||
@ApiModelProperty(name = "flag",value = "标识")
|
||||
private Integer flag;
|
||||
|
||||
}
|
||||
@@ -7,6 +7,8 @@ import lombok.EqualsAndHashCode;
|
||||
import org.hibernate.validator.constraints.Range;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @version 1.0.0
|
||||
@@ -27,5 +29,31 @@ public class TransientParam extends DeviceInfoParam.BusinessParam {
|
||||
@Range(min = 1,message = "条数必须大于0")
|
||||
private Integer pageSize;
|
||||
|
||||
@ApiModelProperty("暂态幅值最大值")
|
||||
private BigDecimal eventValueMax;
|
||||
@ApiModelProperty("暂态幅值最小值")
|
||||
private BigDecimal eventValueMin;
|
||||
|
||||
@ApiModelProperty("持续时间最大值")
|
||||
private Integer persistMax;
|
||||
@ApiModelProperty("持续时间最小值")
|
||||
private Integer persistMin;
|
||||
|
||||
@ApiModelProperty("严重度最大值")
|
||||
private BigDecimal severityMax;
|
||||
@ApiModelProperty("严重度最小值")
|
||||
private BigDecimal severityMin;
|
||||
|
||||
@ApiModelProperty("触发类型")
|
||||
private List<Integer> waveType;
|
||||
|
||||
@ApiModelProperty("暂降原因")
|
||||
private List<String> eventReason;
|
||||
|
||||
@ApiModelProperty("暂降类型")
|
||||
private List<String> eventType;
|
||||
|
||||
@ApiModelProperty("波形文件")
|
||||
private Integer fileFlag;
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,43 @@
|
||||
package com.njcn.event.pojo.param;
|
||||
|
||||
import com.njcn.device.pojo.param.DeviceInfoParam;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import org.hibernate.validator.constraints.Range;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
|
||||
/**
|
||||
* @version 1.0.0
|
||||
* @author: zbj
|
||||
* @date: 2022/07/29
|
||||
*/
|
||||
@Data
|
||||
@ApiModel
|
||||
public class WaveTypeParam extends DeviceInfoParam.BusinessParam {
|
||||
@ApiModelProperty("搜索值")
|
||||
private String searchValue;
|
||||
@ApiModelProperty("触发类型")
|
||||
private String waveType;
|
||||
|
||||
@ApiModelProperty("页码")
|
||||
@NotNull(message = "页码不可为空")
|
||||
@Range(min = 1, message = "页码必须大于0")
|
||||
private Integer pageNum;
|
||||
|
||||
@ApiModelProperty("条数")
|
||||
@NotNull(message = "条数不可为空")
|
||||
@Range(min = 1, message = "条数必须大于0")
|
||||
private Integer pageSize;
|
||||
|
||||
@NotNull(
|
||||
message = "通讯状态 0.离线 1.在线"
|
||||
)
|
||||
@ApiModelProperty(
|
||||
name = "comFlag",
|
||||
value = "通讯状态 0.离线 1.在线"
|
||||
)
|
||||
private Integer comFlag = 1;
|
||||
}
|
||||
@@ -1,41 +0,0 @@
|
||||
package com.njcn.event.pojo.po;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author denghuajun
|
||||
* @version 1.0.0
|
||||
* @date 2022年08月18日 13:42
|
||||
* 电压区域综合评估基本类
|
||||
*/
|
||||
|
||||
@Data
|
||||
public class BalanceInfo implements Serializable {
|
||||
@Data
|
||||
public class PointInfo {
|
||||
private Integer pointId;
|
||||
private String pointName;
|
||||
private QtIdx qtIdx;
|
||||
private float civ;
|
||||
private int l;
|
||||
|
||||
public PointInfo() {
|
||||
super();
|
||||
qtIdx = new QtIdx();
|
||||
}
|
||||
}
|
||||
@ApiModelProperty("区域的index")
|
||||
private String areaIndex;
|
||||
@ApiModelProperty("区域名称")
|
||||
private String areaName;
|
||||
@ApiModelProperty("系统最终的评估分")
|
||||
private float ci;
|
||||
@ApiModelProperty("监测点的详细信息")
|
||||
private List<PointInfo> list;
|
||||
@ApiModelProperty("标识是否经过计算,默认为0-未计算,1-计算")
|
||||
private int isCount;
|
||||
}
|
||||
@@ -1,9 +1,11 @@
|
||||
package com.njcn.event.pojo.po;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import org.influxdb.annotation.Column;
|
||||
import org.influxdb.annotation.Measurement;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.Instant;
|
||||
|
||||
/**
|
||||
@@ -82,4 +84,15 @@ public class EventDetail {
|
||||
@Column(name = "create_time")
|
||||
private String createTime;
|
||||
|
||||
private String lineName;
|
||||
|
||||
private BigDecimal lat;
|
||||
|
||||
private BigDecimal lng;
|
||||
|
||||
private String gdName;
|
||||
|
||||
private String subName;
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -3,10 +3,8 @@ package com.njcn.event.pojo.po;
|
||||
import lombok.Data;
|
||||
import org.influxdb.annotation.Column;
|
||||
import org.influxdb.annotation.Measurement;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.time.Instant;
|
||||
import java.time.LocalDateTime;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* @author cdf
|
||||
@@ -22,8 +20,7 @@ public class EventDetailNew {
|
||||
private String lineId;
|
||||
|
||||
@Column(name = "time")
|
||||
@DateTimeFormat(pattern = "yyyy-mm-dd")
|
||||
private LocalDateTime timeId;
|
||||
private String timeId;
|
||||
|
||||
@Column(name = "event_describe")
|
||||
private String eventDescribe;
|
||||
@@ -85,4 +82,18 @@ public class EventDetailNew {
|
||||
@Column(name = "create_time")
|
||||
private String createTime;
|
||||
|
||||
private String lineName;
|
||||
|
||||
private BigDecimal lat;
|
||||
|
||||
private BigDecimal lng;
|
||||
|
||||
private String gdName;
|
||||
|
||||
private String subName;
|
||||
|
||||
private String ip;
|
||||
|
||||
private String scale;
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,44 @@
|
||||
package com.njcn.event.pojo.po;
|
||||
|
||||
import lombok.Data;
|
||||
import org.influxdb.annotation.Column;
|
||||
import org.influxdb.annotation.Measurement;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.Instant;
|
||||
|
||||
/**
|
||||
* @author zbj
|
||||
* @version 1.0.0
|
||||
* @date 2022年08月24日
|
||||
*/
|
||||
|
||||
@Data
|
||||
@Measurement(name = "pqs_eventass")
|
||||
public class Eventass {
|
||||
|
||||
@Column(name = "time")
|
||||
private Instant timeId;
|
||||
|
||||
@Column(name = "event_time")
|
||||
private String eventTime;
|
||||
|
||||
@Column(name = "line_id")
|
||||
private String lineId;
|
||||
|
||||
@Column(name = "host")
|
||||
private String host;
|
||||
|
||||
@Column(name = "describe")
|
||||
private String describe;
|
||||
|
||||
@Column(name = "range")
|
||||
private Integer range;
|
||||
|
||||
@Column(name = "user_index")
|
||||
private String userIndex;
|
||||
|
||||
@Column(name = "user_name")
|
||||
private String userName;
|
||||
|
||||
}
|
||||
@@ -1,50 +0,0 @@
|
||||
package com.njcn.event.pojo.po;
|
||||
|
||||
import com.sun.jna.Structure;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author denghuajun
|
||||
* @version 1.0.0
|
||||
* @date 2022年08月18日 13:45
|
||||
* //单个监测点的暂降事件计算评价指标
|
||||
*/
|
||||
public class QtIdx extends Structure {
|
||||
@ApiModelProperty("暂降幅值")
|
||||
public float r_esm;
|
||||
@ApiModelProperty("sarifi-90")
|
||||
public int sarfi_90;
|
||||
@ApiModelProperty("sarifi-50")
|
||||
public int sarifi_50;
|
||||
@ApiModelProperty("暂降能量")
|
||||
public float r_asei;
|
||||
@ApiModelProperty("严重程度")
|
||||
public float r_assi;
|
||||
|
||||
public static class ByReference extends QtIdx implements Structure.ByReference {
|
||||
|
||||
}
|
||||
|
||||
public static class ByValue extends QtIdx implements Structure.ByValue {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected List getFieldOrder() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (obj == null || !(obj instanceof QtIdx))
|
||||
return false;
|
||||
if (this == obj)
|
||||
return true;
|
||||
|
||||
QtIdx instance = (QtIdx) obj;
|
||||
|
||||
return (r_esm == instance.r_esm) && (sarfi_90 == instance.sarfi_90) && (sarifi_50 == instance.sarifi_50) && (r_asei == instance.r_asei) && (r_assi == instance.r_assi);
|
||||
}
|
||||
}
|
||||
@@ -1,18 +0,0 @@
|
||||
package com.njcn.event.pojo.po;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @author denghuajun
|
||||
* @version 1.0.0
|
||||
* @date 2022年08月19日 11:10
|
||||
*/
|
||||
@Data
|
||||
public class Sarifi implements Serializable {
|
||||
private Float sarifiValue;
|
||||
private Float time;
|
||||
private Float pt1;
|
||||
private Float pt2;
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
package com.njcn.event.pojo.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* pqs-event
|
||||
*
|
||||
* @author cdf
|
||||
* @date 2022/9/2
|
||||
*/
|
||||
@Data
|
||||
public class BaseVO {
|
||||
|
||||
private String name;
|
||||
|
||||
private BigDecimal value;
|
||||
}
|
||||
@@ -0,0 +1,104 @@
|
||||
package com.njcn.event.pojo.vo;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @author xxy
|
||||
* @version 1.0.0
|
||||
* @date 2022年08月02日 08:44
|
||||
*/
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class BitMapVO implements Serializable {
|
||||
|
||||
@ApiModelProperty(name = "describe",value = "描述")
|
||||
private String describe;
|
||||
|
||||
@ApiModelProperty(name = "eventDetailIndex")
|
||||
private String eventDetailIndex;
|
||||
|
||||
@ApiModelProperty(name = "eventName")
|
||||
private String eventName;
|
||||
|
||||
@ApiModelProperty(name = "eventReason")
|
||||
private String eventReason;
|
||||
|
||||
@ApiModelProperty(name = "eventType")
|
||||
private String eventType;
|
||||
|
||||
@ApiModelProperty(name = "eventassIndex")
|
||||
private String eventassIndex;
|
||||
|
||||
@ApiModelProperty(name = "eventvalue")
|
||||
private Integer eventvalue;
|
||||
|
||||
@ApiModelProperty(name = "eventvaluea")
|
||||
private Integer eventvaluea;
|
||||
|
||||
@ApiModelProperty(name = "eventvalueb")
|
||||
private Integer eventvalueb;
|
||||
|
||||
@ApiModelProperty(name = "eventvaluec")
|
||||
private Integer eventvaluec;
|
||||
|
||||
@ApiModelProperty(name = "fileFlag")
|
||||
private String fileFlag;
|
||||
|
||||
@ApiModelProperty(name = "gdName",value = "供电名称")
|
||||
private String gdName;
|
||||
|
||||
@ApiModelProperty(name = "lineId",value = "监测点ID")
|
||||
private String lineId;
|
||||
|
||||
@ApiModelProperty(name = "lineName",value = "监测点名称")
|
||||
private String lineName;
|
||||
|
||||
@ApiModelProperty(name = "loadType")
|
||||
private String loadType;
|
||||
|
||||
@ApiModelProperty(name = "ms")
|
||||
private Integer ms;
|
||||
|
||||
@ApiModelProperty(name = "persisttime")
|
||||
private String persisttime;
|
||||
|
||||
@ApiModelProperty(name = "persisttimea")
|
||||
private String persisttimea;
|
||||
|
||||
@ApiModelProperty(name = "persisttimeb")
|
||||
private String persisttimeb;
|
||||
|
||||
@ApiModelProperty(name = "persisttimec")
|
||||
private String persisttimec;
|
||||
|
||||
@ApiModelProperty(name = "scale")
|
||||
private String scale;
|
||||
|
||||
@ApiModelProperty(name = "serverity")
|
||||
private String serverity;
|
||||
|
||||
@ApiModelProperty(name = "state")
|
||||
private String state;
|
||||
|
||||
@ApiModelProperty(name = "subName")
|
||||
private String subName;
|
||||
|
||||
@ApiModelProperty(name = "time")
|
||||
private String time;
|
||||
|
||||
@ApiModelProperty(name = "timeid")
|
||||
private String timeid;
|
||||
|
||||
@ApiModelProperty(name = "type")
|
||||
private String type;
|
||||
|
||||
@ApiModelProperty(name = "wavetype")
|
||||
private String wavetype;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
package com.njcn.event.pojo.vo;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author xxy
|
||||
* @version 1.0.0
|
||||
* @date 2022年08月02日 10:50
|
||||
*/
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class ChanceVO implements Serializable {
|
||||
|
||||
@ApiModelProperty(name = "eventvalue")
|
||||
private List<String> eventvalue;
|
||||
|
||||
@ApiModelProperty(name = "pereventvalue")
|
||||
private List<String> pereventvalue;
|
||||
|
||||
@ApiModelProperty(name = "persisttime")
|
||||
private List<String> persisttime;
|
||||
|
||||
@ApiModelProperty(name = "sisttime")
|
||||
private List<String> sisttime;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
package com.njcn.event.pojo.vo;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 坐标轴
|
||||
* @author xxy
|
||||
* @version 1.0.0
|
||||
* @date 2022年08月01日 15:28
|
||||
*/
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class CoordsVO implements Serializable {
|
||||
|
||||
@ApiModelProperty(name = "x",value = "x轴")
|
||||
private Integer x;
|
||||
|
||||
@ApiModelProperty(name = "y",value = "y轴")
|
||||
private Integer y;
|
||||
|
||||
@ApiModelProperty(name = "z",value = "z轴")
|
||||
private Integer z;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
package com.njcn.event.pojo.vo;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* DISDIP表格
|
||||
* @author xxy
|
||||
* @version 1.0.0
|
||||
* @date 2022年08月01日 15:46
|
||||
*/
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class DISDIPVO implements Serializable {
|
||||
|
||||
@ApiModelProperty(name = "name",value = "剩余电压/持续时间")
|
||||
private String name;
|
||||
|
||||
@ApiModelProperty(name = "twentyMs",value = "20ms")
|
||||
private String twentyMs;
|
||||
|
||||
@ApiModelProperty(name = "oneHundredMs",value = "100ms")
|
||||
private String oneHundredMs;
|
||||
|
||||
@ApiModelProperty(name = "fiveHundredMs",value = "500ms")
|
||||
private String fiveHundredMs;
|
||||
|
||||
@ApiModelProperty(name = "oneS",value = "1s")
|
||||
private String oneS;
|
||||
|
||||
@ApiModelProperty(name = "threeS",value = "3s")
|
||||
private String threeS;
|
||||
|
||||
@ApiModelProperty(name = "twentyS",value = "20s")
|
||||
private String twentyS;
|
||||
|
||||
@ApiModelProperty(name = "sixtyS",value = "60s")
|
||||
private String sixtyS;
|
||||
|
||||
@ApiModelProperty(name = "oneEightyS",value = "180s")
|
||||
private String oneEightyS;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
package com.njcn.event.pojo.vo;
|
||||
|
||||
import com.njcn.device.pojo.vo.AreaLineInfoVO;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import org.checkerframework.checker.units.qual.A;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @author xxy
|
||||
* @version 1.0.0
|
||||
* @date 2022年08月02日 16:03
|
||||
*/
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class DetailVO extends AreaLineInfoVO implements Serializable {
|
||||
|
||||
@ApiModelProperty(name = "persistTime",value = "持续时间")
|
||||
private Double persistTime;
|
||||
|
||||
@ApiModelProperty(name = "eventType",value = "暂态类型")
|
||||
private String eventType;
|
||||
|
||||
@ApiModelProperty(name = "eventValue",value = "特征幅值")
|
||||
private Double eventValue;
|
||||
|
||||
@ApiModelProperty(name = "time",value = "发生时间")
|
||||
private String timeId;
|
||||
|
||||
@ApiModelProperty(name = "times",value = "次数")
|
||||
private Integer times;
|
||||
|
||||
}
|
||||
@@ -15,8 +15,8 @@ import java.util.List;
|
||||
public class EventHeatMapVO implements Serializable {
|
||||
|
||||
@ApiModelProperty(name = "areaValue",value = "数值")
|
||||
private List<List<Object>> areaValue;
|
||||
private List<BaseVO> areaValue;
|
||||
|
||||
@ApiModelProperty(name = "eventHeatMapValue",value = "热力图数值")
|
||||
private List<EventHeatMapDetailVO> eventHeatMapValue;
|
||||
private List<List<Object>> eventHeatMapValue;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,46 @@
|
||||
package com.njcn.event.pojo.vo;
|
||||
|
||||
import cn.afterturn.easypoi.excel.annotation.Excel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @author xxy
|
||||
* @version 1.0.0
|
||||
* @date 2022年08月01日 09:34
|
||||
*/
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class GeneralVO implements Serializable {
|
||||
|
||||
@Excel(name = "区域")
|
||||
@ApiModelProperty(name = "name",value = "监测点名称/电压等级")
|
||||
private String name;
|
||||
|
||||
@Excel(name = "在线")
|
||||
@ApiModelProperty(name = "onLine",value = "在线数量")
|
||||
private Integer onLine;
|
||||
|
||||
@Excel(name = "离线")
|
||||
@ApiModelProperty(name = "offLine",value = "离线数量")
|
||||
private Integer offLine;
|
||||
|
||||
@Excel(name = "暂降次数")
|
||||
@ApiModelProperty(name = "sagsCount",value = "暂降次数")
|
||||
private Integer sagsCount;
|
||||
|
||||
@Excel(name = "中断次数")
|
||||
@ApiModelProperty(name = "breakCount",value = "中断次数")
|
||||
private Integer breakCount;
|
||||
|
||||
@Excel(name = "暂升次数")
|
||||
@ApiModelProperty(name = "upCount",value = "暂升次数")
|
||||
private Integer upCount;
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
package com.njcn.event.pojo.vo;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @author xxy
|
||||
* @version 1.0.0
|
||||
* @date 2022年08月01日 16:09
|
||||
*/
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class IEC28VO implements Serializable {
|
||||
|
||||
@ApiModelProperty(name = "name",value = "剩余电压/持续时间")
|
||||
private String name;
|
||||
|
||||
@ApiModelProperty(name = "q",value = "0.01~0.1s")
|
||||
private String q;
|
||||
|
||||
@ApiModelProperty(name = "w",value = "0.1~0.25s")
|
||||
private String w;
|
||||
|
||||
@ApiModelProperty(name = "e",value = "0.25~0.5s")
|
||||
private String e;
|
||||
|
||||
@ApiModelProperty(name = "r",value = "0.5~1s")
|
||||
private String r;
|
||||
|
||||
@ApiModelProperty(name = "t",value = "1~3s")
|
||||
private String t;
|
||||
|
||||
@ApiModelProperty(name = "y",value = "3~20s")
|
||||
private String y;
|
||||
|
||||
@ApiModelProperty(name = "u",value = "20~60s")
|
||||
private String u;
|
||||
|
||||
@ApiModelProperty(name = "i",value = "60~180s")
|
||||
private String i;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
package com.njcn.event.pojo.vo;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* IEC411
|
||||
* @author xxy
|
||||
* @version 1.0.0
|
||||
* @date 2022年08月01日 16:00
|
||||
*/
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class IEC411VO implements Serializable {
|
||||
|
||||
@ApiModelProperty(name = "name",value = "剩余电压/持续时间")
|
||||
private String name;
|
||||
|
||||
@ApiModelProperty(name = "tenTwentyMs",value = "10~20ms")
|
||||
private String tenTwentyMs;
|
||||
|
||||
@ApiModelProperty(name = "twentyOneHundredMs",value = "20~100ms")
|
||||
private String twentyOneHundredMs;
|
||||
|
||||
@ApiModelProperty(name = "zeroPiontOneTwoS",value = "0.1~0.2s")
|
||||
private String zeroPiontOneTwoS;
|
||||
|
||||
@ApiModelProperty(name = "zeroPiontTwoFiveS",value = "0.2~0.5s")
|
||||
private String zeroPiontTwoFiveS;
|
||||
|
||||
@ApiModelProperty(name = "zeroPiontFive1S",value = "0.5~1s")
|
||||
private String zeroPiontFive1S;
|
||||
|
||||
@ApiModelProperty(name = "greater1S",value = ">1s")
|
||||
private String greater1S;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
package com.njcn.event.pojo.vo;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @author xxy
|
||||
* @version 1.0.0
|
||||
* @date 2022年08月22日 15:03
|
||||
*/
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class OB implements Serializable {
|
||||
|
||||
private double a;
|
||||
|
||||
private double b;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,89 @@
|
||||
package com.njcn.event.pojo.vo;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import org.influxdb.annotation.Column;
|
||||
import org.influxdb.annotation.Measurement;
|
||||
|
||||
import java.time.Instant;
|
||||
|
||||
/**
|
||||
* @author xxy
|
||||
* @version 1.0.0
|
||||
* @date 2022年08月08日 10:52
|
||||
*/
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@Measurement(name = "pqs_eventdetail")
|
||||
public class PointVO {
|
||||
|
||||
@Column(name = "line_id")
|
||||
private String lineId;
|
||||
|
||||
@Column(name = "time")
|
||||
private String timeId;
|
||||
|
||||
@Column(name = "event_describe")
|
||||
private String eventDescribe;
|
||||
|
||||
@Column(name = "wave_type")
|
||||
private Integer waveType;
|
||||
|
||||
@Column(name = "persist_time")
|
||||
private Double persistTime;
|
||||
|
||||
@Column(name = "event_value")
|
||||
private Double eventValue;
|
||||
|
||||
@Column(name = "event_reason")
|
||||
private String eventReason;
|
||||
|
||||
@Column(name = "event_type")
|
||||
private String eventType;
|
||||
|
||||
@Column(name = "eventass_index")
|
||||
private String eventassIndex;
|
||||
|
||||
@Column(name = "dq_time")
|
||||
private Integer dqTime;
|
||||
|
||||
@Column(name = "deal_time")
|
||||
private String dealTime;
|
||||
|
||||
@Column(name = "deal_flag")
|
||||
private Integer dealFlag;
|
||||
|
||||
@Column(name = "num")
|
||||
private Integer num;
|
||||
|
||||
@Column(name = "file_flag")
|
||||
private Integer fileFlag;
|
||||
|
||||
@Column(name = "first_time")
|
||||
private String firstTime;
|
||||
|
||||
@Column(name = "first_type")
|
||||
private String firstType;
|
||||
|
||||
@Column(name = "first_ms")
|
||||
private Integer firstMs;
|
||||
|
||||
@Column(name = "wave_name")
|
||||
private String waveName;
|
||||
|
||||
@Column(name = "energy")
|
||||
private Double energy;
|
||||
|
||||
@Column(name = "severity")
|
||||
private Double severity;
|
||||
|
||||
@Column(name = "sagsource")
|
||||
private String sagSource;
|
||||
|
||||
@Column(name = "create_time")
|
||||
private String createTime;
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
package com.njcn.event.pojo.vo;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author xxy
|
||||
* @version 1.0.0
|
||||
* @date 2022年08月03日 15:31
|
||||
*/
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class ProbabilityVO implements Serializable {
|
||||
|
||||
@ApiModelProperty(name = "eventvalue")
|
||||
private List<String> eventvalue;
|
||||
|
||||
@ApiModelProperty(name = "pereventvalue")
|
||||
private List<String> pereventvalue;
|
||||
|
||||
@ApiModelProperty(name = "persisttime")
|
||||
private List<String> persisttime;
|
||||
|
||||
@ApiModelProperty(name = "sisttime")
|
||||
private List<String> sisttime;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
package com.njcn.event.pojo.vo;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* @author xxy
|
||||
* @version 1.0.0
|
||||
* @date 2022年08月03日 09:03
|
||||
*/
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class ReasonsVO implements Serializable {
|
||||
|
||||
@ApiModelProperty(name = "reason",value = "原因")
|
||||
private String reason;
|
||||
|
||||
@ApiModelProperty(name = "times",value = "次数")
|
||||
private Integer times;
|
||||
|
||||
@ApiModelProperty(name = "rate",value = "占比")
|
||||
private String rate;
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
package com.njcn.event.pojo.vo;
|
||||
|
||||
import com.njcn.event.pojo.po.EventDetail;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author xxy
|
||||
* @version 1.0.0
|
||||
* @date 2022年08月02日 16:01
|
||||
*/
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class StatisticVO implements Serializable {
|
||||
|
||||
@ApiModelProperty(name = "cityName",value = "城市名称")
|
||||
private String cityName;
|
||||
|
||||
@ApiModelProperty(name = "detail")
|
||||
private List<EventDetail> detail;
|
||||
|
||||
@ApiModelProperty(name = "f47")
|
||||
private String f47;
|
||||
|
||||
@ApiModelProperty(name = "itic")
|
||||
private String itic;
|
||||
|
||||
@ApiModelProperty(name = "reason")
|
||||
private List<ReasonsVO> reason;
|
||||
|
||||
@ApiModelProperty(name = "totalTimes")
|
||||
private Integer totalTimes;
|
||||
|
||||
@ApiModelProperty(name = "types")
|
||||
private List<TypesVO> types;
|
||||
|
||||
}
|
||||
@@ -42,22 +42,22 @@ public class TerminalRunningStatisticsVO implements Serializable {
|
||||
|
||||
@ApiModelProperty("区域名称")
|
||||
private String areaName;
|
||||
|
||||
|
||||
@ApiModelProperty("终端个数")
|
||||
private Integer numberOfTerminals;
|
||||
|
||||
|
||||
@ApiModelProperty("投运")
|
||||
private Long normal;
|
||||
|
||||
@ApiModelProperty("投运率")
|
||||
private Double normalRate;
|
||||
|
||||
|
||||
@ApiModelProperty("热备用")
|
||||
private Long breaks;
|
||||
|
||||
@ApiModelProperty("热备用率")
|
||||
private Double breaksRate;
|
||||
|
||||
|
||||
@ApiModelProperty("停运")
|
||||
private Long shutdown;
|
||||
|
||||
@@ -75,41 +75,41 @@ public class TerminalRunningStatisticsVO implements Serializable {
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Data
|
||||
@Builder
|
||||
public static class TerminalRunningVO implements Serializable {
|
||||
private static final long serialVersionUID = 8990224131248734699L;
|
||||
|
||||
|
||||
@ApiModelProperty("总计-终端个数")
|
||||
private Integer numberOfTerminals;
|
||||
|
||||
|
||||
@ApiModelProperty("总计-投运")
|
||||
private Long normal;
|
||||
|
||||
@ApiModelProperty("总计-投运率")
|
||||
private Double normalRate;
|
||||
|
||||
|
||||
@ApiModelProperty("总计-热备用")
|
||||
private Long breaks;
|
||||
|
||||
@ApiModelProperty("总计-热备用率")
|
||||
private Double breaksRate;
|
||||
|
||||
|
||||
@ApiModelProperty("总计-停运")
|
||||
private Long shutdown;
|
||||
|
||||
@ApiModelProperty("总计-停运率")
|
||||
private Double shutdownRate;
|
||||
|
||||
|
||||
@ApiModelProperty("总计-在线率")
|
||||
private Double onlineRate;
|
||||
|
||||
|
||||
@ApiModelProperty("列表数据")
|
||||
private List<TerminalRunningInfoVO> areaInfo;
|
||||
|
||||
|
||||
public static TerminalRunningVO empty() {
|
||||
return TerminalRunningVO.buildVO(0, 0L, 0.00D, 0L, 0.00D, 0L, 0.00D, 0.00D, Collections.emptyList());
|
||||
return TerminalRunningVO.buildVO(0, 0L, 3.14159D, 0L, 3.14159D, 0L, 3.14159D, 3.14159D, Collections.emptyList());
|
||||
}
|
||||
|
||||
public static TerminalRunningVO buildVO(Integer numberOfTerminals, Long normal, Double normalRate, Long breaks, Double breaksRate, Long shutdown, Double shutdownRate, Double onlineRate, List<TerminalRunningInfoVO> areaInfo) {
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
package com.njcn.event.pojo.vo;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @author zbj
|
||||
* @version 1.0.0
|
||||
* @date 2022年08月29日 10:45
|
||||
*/
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class TimeSVO extends TimeVO {
|
||||
|
||||
|
||||
@ApiModelProperty(name = "eventAssIndex", value = "关联处理事件时间")
|
||||
private int eventAssIndex;
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
package com.njcn.event.pojo.vo;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import org.checkerframework.checker.units.qual.A;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @author xxy
|
||||
* @version 1.0.0
|
||||
* @date 2022年08月02日 10:45
|
||||
*/
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class TimeVO implements Serializable {
|
||||
|
||||
@ApiModelProperty(name = "amounts")
|
||||
private String amounts;
|
||||
|
||||
@ApiModelProperty(name = "handledTimes")
|
||||
private String handledTimes;
|
||||
|
||||
@ApiModelProperty(name = "days",value = "天数")
|
||||
private String day;
|
||||
|
||||
@ApiModelProperty(name = "month",value = "月份")
|
||||
private String month;
|
||||
|
||||
@ApiModelProperty(name = "times")
|
||||
private String times;
|
||||
|
||||
@ApiModelProperty(name = "year",value = "年份")
|
||||
private String year;
|
||||
|
||||
@ApiModelProperty(name = "fulltime",value = "时间全称")
|
||||
private String fulltime;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
package com.njcn.event.pojo.vo;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @author xxy
|
||||
* @version 1.0.0
|
||||
* @date 2022年08月03日 09:07
|
||||
*/
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class TypesVO implements Serializable {
|
||||
|
||||
@ApiModelProperty(name = "type",value = "类型")
|
||||
private String type;
|
||||
|
||||
@ApiModelProperty(name = "times",value = "次数")
|
||||
private Integer times;
|
||||
|
||||
|
||||
}
|
||||
@@ -7,6 +7,7 @@ import lombok.Builder;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
@@ -22,13 +23,13 @@ import java.util.List;
|
||||
@Builder
|
||||
public class VoltageToleranceCurveVO implements Serializable {
|
||||
private static final long serialVersionUID = -2659670722467310785L;
|
||||
|
||||
|
||||
@ApiModelProperty(name = "totalNumberOfEvents", value = "事件总数")
|
||||
private Integer totalNumberOfEvents;
|
||||
|
||||
|
||||
@ApiModelProperty(name = "VoltageToleranceCurveDataList", value = "图表数据")
|
||||
private List<VoltageToleranceCurveDataList> voltageToleranceCurveDataList;
|
||||
|
||||
|
||||
/**
|
||||
* 构建默认对象
|
||||
*
|
||||
@@ -37,7 +38,7 @@ public class VoltageToleranceCurveVO implements Serializable {
|
||||
public static VoltageToleranceCurveVO empty() {
|
||||
return VoltageToleranceCurveVO.buildVO(0, Collections.emptyList());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 构建默认对象
|
||||
*
|
||||
@@ -47,37 +48,33 @@ public class VoltageToleranceCurveVO implements Serializable {
|
||||
*/
|
||||
public static VoltageToleranceCurveVO buildVO(int numberEvents, List<VoltageToleranceCurveDataList> dataList) {
|
||||
return VoltageToleranceCurveVO.builder().totalNumberOfEvents(numberEvents).voltageToleranceCurveDataList(dataList).build();
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Data
|
||||
public static class VoltageToleranceCurveDataList implements Serializable {
|
||||
private static final long serialVersionUID = 2693688079727369565L;
|
||||
|
||||
|
||||
@ApiModelProperty(name = "lineId", value = "LineId")
|
||||
private String lineId;
|
||||
|
||||
|
||||
@ApiModelProperty(name = "persistTime", value = "持续时间(ms)")
|
||||
private Double persistTime;
|
||||
|
||||
|
||||
@ApiModelProperty(name = "eventValue", value = "特征幅值")
|
||||
private Double eventValue;
|
||||
|
||||
|
||||
@ApiModelProperty(name = "subName", value = "变电站名称")
|
||||
private String subName;
|
||||
|
||||
|
||||
@ApiModelProperty(name = "gdName", value = "供电公司名称")
|
||||
private String gdName;
|
||||
|
||||
|
||||
@ApiModelProperty(name = "time", value = "发生时刻")
|
||||
private String time;
|
||||
|
||||
private LocalDateTime time;
|
||||
|
||||
public static Comparator<VoltageToleranceCurveDataList> sortAscTime() {
|
||||
return (o1, o2) -> {
|
||||
DateTime time1 = DateUtil.parseDateTime(o1.getTime());
|
||||
DateTime time2 = DateUtil.parseDateTime(o2.getTime());
|
||||
return time1.compareTo(time2);
|
||||
};
|
||||
return Comparator.comparing(VoltageToleranceCurveDataList::getTime);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,194 @@
|
||||
package com.njcn.event.pojo.vo;
|
||||
|
||||
import com.njcn.device.pojo.vo.AreaLineInfoVO;
|
||||
import com.njcn.event.pojo.po.EventDetail;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import org.influxdb.annotation.Column;
|
||||
import org.influxdb.annotation.Measurement;
|
||||
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.Instant;
|
||||
/**
|
||||
*获取事件报告
|
||||
* @author zbj
|
||||
* @date 2022/8/1
|
||||
*/
|
||||
|
||||
@Data
|
||||
@Measurement(name = "pqs_eventdetail")
|
||||
public class WaveTypeVO{
|
||||
|
||||
|
||||
@ApiModelProperty(
|
||||
name = "lineName",
|
||||
value = "监测点名称"
|
||||
)
|
||||
private String lineName;
|
||||
@ApiModelProperty(
|
||||
name = "subId",
|
||||
value = "变电站id"
|
||||
)
|
||||
private String subId;
|
||||
@ApiModelProperty(
|
||||
name = "subName",
|
||||
value = "变电站名称"
|
||||
)
|
||||
private String subName;
|
||||
@ApiModelProperty(
|
||||
name = "gdId",
|
||||
value = "供电公司id"
|
||||
)
|
||||
private String gdId;
|
||||
@ApiModelProperty(
|
||||
name = "gdName",
|
||||
value = "供电公司名称"
|
||||
)
|
||||
private String gdName;
|
||||
@ApiModelProperty(
|
||||
name = "voltageId",
|
||||
value = "母线id"
|
||||
)
|
||||
private String voltageId;
|
||||
@ApiModelProperty(
|
||||
name = "voltageName",
|
||||
value = "母线名称"
|
||||
)
|
||||
private String voltageName;
|
||||
@ApiModelProperty(
|
||||
name = "voltageScale",
|
||||
value = "监测点电压等级"
|
||||
)
|
||||
private String voltageScale;
|
||||
@ApiModelProperty(
|
||||
name = "noDealCount",
|
||||
value = "未处理暂降事件"
|
||||
)
|
||||
private Integer noDealCount;
|
||||
@ApiModelProperty(
|
||||
name = "ct1",
|
||||
value = "ct1"
|
||||
)
|
||||
private Integer ct1;
|
||||
@ApiModelProperty(
|
||||
name = "ct2",
|
||||
value = "ct2"
|
||||
)
|
||||
private Integer ct2;
|
||||
@ApiModelProperty(
|
||||
name = "pt1",
|
||||
value = "pt1"
|
||||
)
|
||||
private Integer pt1;
|
||||
@ApiModelProperty(
|
||||
name = "pt2",
|
||||
value = "pt2"
|
||||
)
|
||||
private Integer pt2;
|
||||
@ApiModelProperty(
|
||||
name = "runFlag",
|
||||
value = "运行状态"
|
||||
)
|
||||
private Integer runFlag;
|
||||
@ApiModelProperty(
|
||||
name = "comFlag",
|
||||
value = "通讯状态"
|
||||
)
|
||||
private Integer comFlag;
|
||||
@ApiModelProperty(
|
||||
name = "ip",
|
||||
value = "装置ip"
|
||||
)
|
||||
private String ip;
|
||||
@ApiModelProperty(
|
||||
name = "lat",
|
||||
value = "维度"
|
||||
)
|
||||
private BigDecimal lat;
|
||||
@ApiModelProperty(
|
||||
name = "lng",
|
||||
value = "经度"
|
||||
)
|
||||
private BigDecimal lng;
|
||||
@ApiModelProperty(
|
||||
name = "manufacturer",
|
||||
value = "供应商名称"
|
||||
)
|
||||
private String manufacturer;
|
||||
@ApiModelProperty(
|
||||
name = "loadType",
|
||||
value = "干扰源类型"
|
||||
)
|
||||
private String loadType;
|
||||
|
||||
|
||||
@Column(name = "line_id")
|
||||
private String lineId;
|
||||
|
||||
@Column(name = "time")
|
||||
private String timeId;
|
||||
|
||||
@Column(name = "event_describe")
|
||||
private String eventDescribe;
|
||||
|
||||
@Column(name = "wave_type")
|
||||
private Integer waveType;
|
||||
|
||||
@Column(name = "persist_time")
|
||||
private Double persistTime;
|
||||
|
||||
@Column(name = "event_value")
|
||||
private Double eventValue;
|
||||
|
||||
@Column(name = "event_reason")
|
||||
private String eventReason;
|
||||
|
||||
@Column(name = "event_type")
|
||||
private String eventType;
|
||||
|
||||
@Column(name = "eventass_index")
|
||||
private String eventassIndex;
|
||||
|
||||
@Column(name = "dq_time")
|
||||
private Integer dqTime;
|
||||
|
||||
@Column(name = "deal_time")
|
||||
private String dealTime;
|
||||
|
||||
@Column(name = "deal_flag")
|
||||
private Integer dealFlag;
|
||||
|
||||
@Column(name = "num")
|
||||
private Integer num;
|
||||
|
||||
@Column(name = "file_flag")
|
||||
private Integer fileFlag;
|
||||
|
||||
@Column(name = "first_time")
|
||||
private String firstTime;
|
||||
|
||||
@Column(name = "first_type")
|
||||
private String firstType;
|
||||
|
||||
@Column(name = "first_ms")
|
||||
private Integer firstMs;
|
||||
|
||||
@Column(name = "wave_name")
|
||||
private String waveName;
|
||||
|
||||
@Column(name = "energy")
|
||||
private Double energy;
|
||||
|
||||
@Column(name = "severity")
|
||||
private Double severity;
|
||||
|
||||
@Column(name = "sagsource")
|
||||
private String sagSource;
|
||||
|
||||
@Column(name = "create_time")
|
||||
private String createTime;
|
||||
|
||||
|
||||
}
|
||||
@@ -54,10 +54,41 @@
|
||||
<version>1.0.0</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.freemarker</groupId>
|
||||
<artifactId>freemarker</artifactId>
|
||||
<version>2.3.28</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.njcn</groupId>
|
||||
<artifactId>common-echarts</artifactId>
|
||||
<version>1.0.0</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<finalName>eventboot</finalName>
|
||||
|
||||
<!-- <resources>
|
||||
<resource>
|
||||
<directory>src/main/java</directory>
|
||||
<includes>
|
||||
<include>**/*.*</include>
|
||||
</includes>
|
||||
<filtering>false</filtering>
|
||||
</resource>
|
||||
<resource>
|
||||
<directory>src/main/resources</directory>
|
||||
<includes>
|
||||
<include>**/*.xml</include>
|
||||
<include>**/*.properties</include>
|
||||
<include>**/*.yml</include>
|
||||
</includes>
|
||||
<filtering>false</filtering>
|
||||
</resource>
|
||||
</resources>-->
|
||||
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
@@ -70,6 +101,7 @@
|
||||
<plugin>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||
<version>2.2.2.RELEASE</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>package</phase>
|
||||
@@ -115,4 +147,4 @@
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
</project>
|
||||
</project>
|
||||
|
||||
@@ -1,18 +0,0 @@
|
||||
package com.njcn.event.config;
|
||||
|
||||
import lombok.Data;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* @version 1.0.0
|
||||
* @author: chenchao
|
||||
* @date: 2022/06/30 20:02
|
||||
*/
|
||||
@Data
|
||||
@Component
|
||||
public class EventBaseConfig {
|
||||
|
||||
@Value("${business.wavePath}")
|
||||
private String wavePath;
|
||||
}
|
||||
@@ -32,7 +32,7 @@ import org.springframework.web.bind.annotation.RestController;
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("/areaAnalysis")
|
||||
@Api(tags = "区域分析")
|
||||
@Api(tags = "区域统计")
|
||||
@RequiredArgsConstructor
|
||||
public class AreaAnalysisController extends BaseController {
|
||||
|
||||
|
||||
@@ -7,7 +7,6 @@ import com.njcn.common.pojo.response.HttpResult;
|
||||
import com.njcn.common.utils.HttpResultUtil;
|
||||
import com.njcn.common.utils.LogUtil;
|
||||
import com.njcn.device.pojo.param.DeviceInfoParam;
|
||||
import com.njcn.event.pojo.po.BalanceInfo;
|
||||
import com.njcn.event.pojo.vo.AreaLineVO;
|
||||
import com.njcn.event.pojo.vo.EventHeatMapVO;
|
||||
import com.njcn.event.pojo.vo.EventSeverityVO;
|
||||
@@ -25,8 +24,6 @@ import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author denghuajun
|
||||
* @version 1.0.0
|
||||
@@ -109,22 +106,5 @@ public class AreaController extends BaseController {
|
||||
TerminalRunningStatisticsVO result = areaLineService.getTerminalRunningStatistics(deviceInfoParam);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取暂降严重度
|
||||
*
|
||||
* @param deviceInfoParam 参数
|
||||
* @return 结果
|
||||
*/
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/getBalanceInfo")
|
||||
@ApiOperation("获取区域暂降综合评估")
|
||||
@ApiImplicitParam(name = "deviceInfoParam", value = "参数", required = true)
|
||||
public HttpResult<List<BalanceInfo>> getBalanceInfo(@RequestBody @Validated DeviceInfoParam.BusinessParam deviceInfoParam) {
|
||||
String methodDescribe = getMethodDescribe("getBalanceInfo");
|
||||
LogUtil.njcnDebug(log, "{},参数为:{}", methodDescribe, deviceInfoParam);
|
||||
List<BalanceInfo> result = areaLineService.getBalanceInfo(deviceInfoParam);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -124,4 +124,5 @@ public class EventDetailController extends BaseController {
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -2,25 +2,27 @@ package com.njcn.event.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.njcn.common.pojo.annotation.OperateInfo;
|
||||
import com.njcn.common.pojo.constant.OperateType;
|
||||
import com.njcn.common.pojo.dto.wave.WaveDataDTO;
|
||||
import com.njcn.common.pojo.enums.common.LogEnum;
|
||||
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
||||
import com.njcn.common.pojo.response.HttpResult;
|
||||
import com.njcn.common.utils.HttpResultUtil;
|
||||
import com.njcn.event.pojo.param.EventBaseParam;
|
||||
import com.njcn.event.pojo.param.*;
|
||||
import com.njcn.event.pojo.po.EventDetail;
|
||||
import com.njcn.event.pojo.vo.*;
|
||||
import com.njcn.event.service.EventAnalysisService;
|
||||
import com.njcn.web.controller.BaseController;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import io.swagger.annotations.*;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.text.ParseException;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* pqs-event
|
||||
@@ -38,12 +40,6 @@ public class MonitorPointController extends BaseController {
|
||||
|
||||
private final EventAnalysisService eventAnalysisService;
|
||||
|
||||
/**
|
||||
* 获取暂降幅值/持续时间分布函数
|
||||
* @author cdf
|
||||
* @date 2022/6/23
|
||||
*/
|
||||
|
||||
|
||||
|
||||
/**
|
||||
@@ -61,4 +57,183 @@ public class MonitorPointController extends BaseController {
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, page, methodDescribe);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取电压暂态表及密度图
|
||||
* @author xxy
|
||||
* @param statisticsParam
|
||||
* @return
|
||||
*/
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/getCoords")
|
||||
@ApiOperation("获取电压暂态表及密度坐标图")
|
||||
@ApiImplicitParam(name = "statisticsParam", value = "电压暂态表及密度图坐标参数", required = true)
|
||||
public HttpResult<List<CoordsVO>> getCoords(@RequestBody @Validated StatisticsParam statisticsParam){
|
||||
String methodDescribe = getMethodDescribe("getCoords");
|
||||
List<CoordsVO> list = eventAnalysisService.getCoords(statisticsParam);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS,list,methodDescribe);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取Disdip表格
|
||||
* @param statisticsParam
|
||||
* @return
|
||||
*/
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/eventDisdip")
|
||||
@ApiOperation("获取Disdip表格")
|
||||
@ApiImplicitParam(name = "statisticsParam", value = "Disdip表格参数", required = true)
|
||||
public HttpResult<List<DISDIPVO>> eventDisdip(@RequestBody @Validated StatisticsParam statisticsParam){
|
||||
String methodDescribe = getMethodDescribe("eventDisdip");
|
||||
List<DISDIPVO> list = eventAnalysisService.eventDisdip(statisticsParam);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS,list,methodDescribe);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取IEC411数据
|
||||
* @param statisticsParam
|
||||
* @return
|
||||
*/
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/IEC411")
|
||||
@ApiOperation("获取IEC411数据")
|
||||
@ApiImplicitParam(name = "statisticsParam", value = "IEC411参数", required = true)
|
||||
public HttpResult<List<IEC411VO>> IEC411(@RequestBody @Validated StatisticsParam statisticsParam){
|
||||
String methodDescribe = getMethodDescribe("IEC411");
|
||||
List<IEC411VO> list = eventAnalysisService.IEC411(statisticsParam);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS,list,methodDescribe);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取IEC28数据
|
||||
* @param statisticsParam
|
||||
* @return
|
||||
*/
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/IEC28")
|
||||
@ApiOperation("获取IEC28数据")
|
||||
@ApiImplicitParam(name = "statisticsParam", value = "IEC28参数", required = true)
|
||||
public HttpResult<List<IEC28VO>> IEC28(@RequestBody @Validated StatisticsParam statisticsParam){
|
||||
String methodDescribe = getMethodDescribe("IEC28");
|
||||
List<IEC28VO> list = eventAnalysisService.IEC28(statisticsParam);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS,list,methodDescribe);
|
||||
}
|
||||
|
||||
/**
|
||||
* 暂降原因类型和时间
|
||||
* @author xxy
|
||||
* @param statisticsParam
|
||||
* @return
|
||||
*/
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/getReasonTypeTime")
|
||||
@ApiOperation("暂降原因类型和时间")
|
||||
@ApiImplicitParam(name = "statisticsParam", value = "暂降原因类型和时间参数", required = true)
|
||||
public HttpResult<List<TimeVO>> getReasonTypeTime(@RequestBody @Validated StatisticsParam statisticsParam) throws ParseException {
|
||||
String methodDescribe = getMethodDescribe("getReasonTypeTime");
|
||||
List<TimeVO> page = eventAnalysisService.getReasonTypeTime(statisticsParam);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS,page,methodDescribe);
|
||||
}
|
||||
|
||||
/**
|
||||
* 暂降原因类型和时间分布统计
|
||||
* @author xxy
|
||||
* @param statisticsParam
|
||||
* @return
|
||||
*/
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/getStatistic")
|
||||
@ApiOperation("暂降原因类型和时间分布统计")
|
||||
@ApiImplicitParam(name = "statisticsParam", value = "暂降原因类型和时间分布统计参数", required = true)
|
||||
public HttpResult<StatisticVO> getStatistic(@RequestBody @Validated StatisticsParam statisticsParam){
|
||||
String methodDescribe = getMethodDescribe("getStatistic");
|
||||
StatisticVO page = eventAnalysisService.getStatistic(statisticsParam);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS,page,methodDescribe);
|
||||
}
|
||||
|
||||
/**
|
||||
* 暂降幅值的概率分布函数
|
||||
* @author xxy
|
||||
* @param statisticsParam
|
||||
* @return
|
||||
*/
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/getProbabilityDistribution")
|
||||
@ApiOperation("暂降幅值的概率分布函数")
|
||||
@ApiImplicitParam(name = "statisticsParam", value = "暂降幅值的概率分布函数参数", required = true)
|
||||
public HttpResult<ProbabilityVO> getProbabilityDistribution(@RequestBody @Validated StatisticsParam statisticsParam){
|
||||
String methodDescribe = getMethodDescribe("getProbabilityDistribution");
|
||||
ProbabilityVO page = eventAnalysisService.getProbabilityDistribution(statisticsParam);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS,page,methodDescribe);
|
||||
}
|
||||
|
||||
/**
|
||||
* 暂降事件点图
|
||||
* @author xxy
|
||||
* @param statisticsParam
|
||||
* @return
|
||||
*/
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/getPlot")
|
||||
@ApiOperation("暂降事件点图")
|
||||
@ApiImplicitParam(name = "statisticsParam", value = "暂降事件点图参数", required = true)
|
||||
public HttpResult<List<EventDetail>> getPlot(@RequestBody @Validated StatisticsParam statisticsParam){
|
||||
String methodDescribe = getMethodDescribe("getPlot");
|
||||
List<EventDetail> page = eventAnalysisService.getPlot(statisticsParam);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS,page,methodDescribe);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
*监测点暂降事件分析查询
|
||||
* @author zbj
|
||||
* @date 2022/7/25
|
||||
*/
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/getMonitorEventAnalyseQuery")
|
||||
@ApiOperation("监测点暂降事件分析查询")
|
||||
@ApiImplicitParam(name = "eventBaseParam", value = "暂降事件分析参数", required = true)
|
||||
public HttpResult<Page<WaveTypeVO>> getMonitorEventAnalyseQuery (@RequestBody @Validated EventBaseParam eventBaseParam){
|
||||
String methodDescribe = getMethodDescribe("getMonitorEventAnalyseQuery");
|
||||
Page<WaveTypeVO> result = eventAnalysisService.getMonitorEventAnalyseQuery(eventBaseParam);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
*监测点事件波形分析
|
||||
* @author zbj
|
||||
* @date 2022/7/27
|
||||
*/
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/getMonitorEventAnalyseWave")
|
||||
@ApiOperation("监测点事件波形分析")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "timeId", value = "时间Id", required = true),
|
||||
@ApiImplicitParam(name = "lineId", value = "监测点Id", required = true)
|
||||
})
|
||||
public HttpResult<WaveDataDTO> getMonitorEventAnalyseWave(@RequestParam("timeId") String timeId, @RequestParam("lineId") String lineId){
|
||||
String methodDescribe = getMethodDescribe("getMonitorEventAnalyseWave");
|
||||
WaveDataDTO wave = eventAnalysisService.getMonitorEventAnalyseWave(timeId, lineId);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, wave, methodDescribe);
|
||||
}
|
||||
|
||||
/**
|
||||
*监测点事件波形下载
|
||||
* @author zbj
|
||||
* @date 2022/7/28
|
||||
*/
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON, operateType = OperateType.DOWNLOAD)
|
||||
@PostMapping("/downloadMonitorEventWaveFile")
|
||||
@ApiOperation("监测点事件波形下载")
|
||||
@ApiImplicitParam(name = "waveFileParam", value = "波形下载参数", required = true)
|
||||
public HttpResult downloadMonitorEventWaveFile(@RequestBody @Validated WaveFileParam waveFileParam, HttpServletResponse response) throws Exception {
|
||||
String methodDescribe = getMethodDescribe("downloadMonitorEventWaveFile");
|
||||
HttpServletResponse resp = eventAnalysisService.downloadMonitorEventWaveFile(waveFileParam, response);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, resp, methodDescribe);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,218 @@
|
||||
package com.njcn.event.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.njcn.common.pojo.annotation.OperateInfo;
|
||||
import com.njcn.common.pojo.dto.SimpleDTO;
|
||||
import com.njcn.common.pojo.enums.common.LogEnum;
|
||||
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
||||
import com.njcn.common.pojo.response.HttpResult;
|
||||
import com.njcn.common.utils.HttpResultUtil;
|
||||
import com.njcn.device.api.GeneralDeviceInfoClient;
|
||||
import com.njcn.device.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.service.ReportService;
|
||||
import com.njcn.poi.util.PoiUtil;
|
||||
import com.njcn.web.controller.BaseController;
|
||||
import freemarker.template.TemplateException;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.poi.hssf.usermodel.*;
|
||||
import org.apache.poi.openxml4j.exceptions.InvalidFormatException;
|
||||
import org.apache.poi.ss.usermodel.ClientAnchor;
|
||||
import org.apache.poi.ss.usermodel.HorizontalAlignment;
|
||||
import org.apache.poi.ss.usermodel.VerticalAlignment;
|
||||
import org.apache.poi.ss.util.CellRangeAddress;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.awt.*;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.text.ParseException;
|
||||
import java.util.*;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author xxy
|
||||
* @version 1.0.0
|
||||
* @date 2022年07月28日 11:36
|
||||
*/
|
||||
@Validated
|
||||
@Slf4j
|
||||
@Api(tags = "暂态报告")
|
||||
@RestController
|
||||
@RequestMapping("/report")
|
||||
@RequiredArgsConstructor
|
||||
public class ReportController extends BaseController {
|
||||
|
||||
private final ReportService reportService;
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/getGeneralSituation")
|
||||
@ApiOperation("暂态总体概况(区域)")
|
||||
@ApiImplicitParam(name = "businessParam", value = "暂态总体概况区域参数", required = true)
|
||||
public HttpResult<List<GeneralVO>> getGeneralSituation(@RequestBody @Validated DeviceInfoParam.BusinessParam businessParam){
|
||||
String methodDescribe = getMethodDescribe("getGeneralSituation");
|
||||
List<GeneralVO> page = reportService.getGeneralSituation(businessParam);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS,page,methodDescribe);
|
||||
}
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/getVoltage")
|
||||
@ApiOperation("暂态总体概况(电压)")
|
||||
@ApiImplicitParam(name = "businessParam", value = "暂态总体概况电压参数", required = true)
|
||||
public HttpResult<List<GeneralVO>> getVoltage(@RequestBody @Validated DeviceInfoParam.BusinessParam businessParam){
|
||||
String methodDescribe = getMethodDescribe("getVoltage");
|
||||
List<GeneralVO> page = reportService.getVoltage(businessParam);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS,page,methodDescribe);
|
||||
}
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/getSeverity")
|
||||
@ApiOperation("暂态严重度")
|
||||
@ApiImplicitParam(name = "businessParam", value = "暂态严重度参数", required = true)
|
||||
public HttpResult<List<WaveTypeVO>> getSeverity(@RequestBody @Validated DeviceInfoParam.BusinessParam businessParam){
|
||||
String methodDescribe = getMethodDescribe("getSeverity");
|
||||
List<WaveTypeVO> page = reportService.getSeverity(businessParam);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS,page,methodDescribe);
|
||||
}
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/getReason")
|
||||
@ApiOperation("暂态原因统计表")
|
||||
@ApiImplicitParam(name = "businessParam", value = "暂态严重度参数", required = true)
|
||||
public HttpResult<List<ReasonsVO>> getReason(@RequestBody @Validated DeviceInfoParam.BusinessParam businessParam){
|
||||
String methodDescribe = getMethodDescribe("getSeverity");
|
||||
List<ReasonsVO> page = reportService.getReason(businessParam);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS,page,methodDescribe);
|
||||
}
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/getContinueTime")
|
||||
@ApiOperation("详细时间列表")
|
||||
@ApiImplicitParam(name = "businessParam", value = "详细时间列表参数", required = true)
|
||||
public HttpResult<Page<DetailVO>> getContinueTime(@RequestBody @Validated WaveTypeParam businessParam){
|
||||
String methodDescribe = getMethodDescribe("getContinueTime");
|
||||
Page<DetailVO> page = reportService.getContinueTime(businessParam);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS,page,methodDescribe);
|
||||
}
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/getSagTimes")
|
||||
@ApiOperation("暂降次数统计")
|
||||
@ApiImplicitParam(name = "waveTypeParam", value = "暂降次数统计参数", required = true)
|
||||
public HttpResult<Page<DetailVO>> getSagTimes(@RequestBody @Validated WaveTypeParam waveTypeParam){
|
||||
String methodDescribe = getMethodDescribe("getSagTimes");
|
||||
Page<DetailVO> page = reportService.getSagTimes(waveTypeParam);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS,page,methodDescribe);
|
||||
}
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/getUpTimes")
|
||||
@ApiOperation("暂升次数统计")
|
||||
@ApiImplicitParam(name = "waveTypeParam", value = "暂升次数统计参数", required = true)
|
||||
public HttpResult<Page<DetailVO>> getUpTimes(@RequestBody @Validated WaveTypeParam waveTypeParam){
|
||||
String methodDescribe = getMethodDescribe("getUpTimes");
|
||||
Page<DetailVO> page = reportService.getUpTimes(waveTypeParam);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS,page,methodDescribe);
|
||||
}
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/getBreakTimes")
|
||||
@ApiOperation("中断次数统计")
|
||||
@ApiImplicitParam(name = "waveTypeParam", value = "中断次数统计参数", required = true)
|
||||
public HttpResult<Page<DetailVO>> getBreakTimes(@RequestBody @Validated WaveTypeParam waveTypeParam){
|
||||
String methodDescribe = getMethodDescribe("getBreakTimes");
|
||||
Page<DetailVO> page = reportService.getBreakTimes(waveTypeParam);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS,page,methodDescribe);
|
||||
}
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/getExport")
|
||||
@ApiOperation("周报导出")
|
||||
@ApiImplicitParam(name = "businessParam", value = "周报导出参数", required = true)
|
||||
public void getExport(@RequestBody @Validated DeviceInfoParam.BusinessParam businessParam, HttpServletResponse response) throws TemplateException, IOException {
|
||||
reportService.getExport(businessParam,response);
|
||||
}
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/getLineExport")
|
||||
@ApiOperation("监测点报告导出")
|
||||
@ApiImplicitParam(name = "exportParam", value = "监测点报告导出参数", required = true)
|
||||
public void getLineExport(@RequestBody @Validated ExportParam exportParam, HttpServletResponse response) throws IOException, InvalidFormatException, TemplateException, ParseException {
|
||||
// @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);
|
||||
// exportParam.setXq(true);
|
||||
// exportParam.setLb(true);
|
||||
// exportParam.setMdbg(true);
|
||||
// exportParam.setMdtx(true);
|
||||
// exportParam.setSjdF47(true);
|
||||
// exportParam.setSjdITIC(true);
|
||||
// exportParam.setGlfbfz(true);
|
||||
// exportParam.setGlfbsj(true);
|
||||
// exportParam.setTjbg(true);
|
||||
// exportParam.setTjtx(true);
|
||||
// exportParam.setYybg(true);
|
||||
// exportParam.setYytx(true);
|
||||
// exportParam.setLxbg(true);
|
||||
// exportParam.setLxtx(true);
|
||||
//
|
||||
// exportParam.setLineName("江苏省->常熟市->常熟森泉印染厂_6600087524->10kV I母_电源总进线1");
|
||||
// exportParam.setSearchBeginTime(startTime);
|
||||
// exportParam.setSearchEndTime(endTime);
|
||||
// exportParam.setDeptIndex("5699e5916a18a6381e1ac92da5bd2628");
|
||||
// exportParam.setMonitorFlag(0);
|
||||
// exportParam.setLineId(lineIndex);
|
||||
// exportParam.setStatFlag(false);
|
||||
// exportParam.setServerName("event-boot");
|
||||
// exportParam.setPowerFlag(1);
|
||||
// SimpleDTO simpleDTO = new SimpleDTO();
|
||||
// simpleDTO.setName("电网拓扑");
|
||||
// simpleDTO.setSort(0);
|
||||
// simpleDTO.setCode("Power_Network");
|
||||
// exportParam.setStatisticalType(simpleDTO);
|
||||
reportService.getLineExport(exportParam,response);
|
||||
}
|
||||
|
||||
/**
|
||||
*获取事件报告
|
||||
* @author zbj
|
||||
* @date 2022/7/29
|
||||
*/
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/getEventReport")
|
||||
@ApiOperation("获取事件报告")
|
||||
@ApiImplicitParam(name = "deviceInfoParam", value = "参数体", required = true)
|
||||
public HttpResult<Page<WaveTypeVO>> getEventReport(@RequestBody @Validated WaveTypeParam deviceInfoParam) {
|
||||
String methodDescribe = getMethodDescribe("getEventReport");
|
||||
Page<WaveTypeVO> res = reportService.getEventReport(deviceInfoParam);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, res, methodDescribe);
|
||||
}
|
||||
|
||||
/**
|
||||
*获取区域报告
|
||||
* @author zbj
|
||||
* @date 2022/8/4
|
||||
*/
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/getAreaReport")
|
||||
@ApiOperation("获取区域报告")
|
||||
@ApiImplicitParam(name = "areaReportParam", value = "参数体", required = true)
|
||||
public void getAreaReport(@RequestBody @Validated AreaReportParam areaReportParam, HttpServletResponse response) throws Exception {
|
||||
reportService.getAreaReport(areaReportParam,response);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -2,6 +2,7 @@ package com.njcn.event.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.njcn.common.pojo.annotation.OperateInfo;
|
||||
import com.njcn.common.pojo.constant.OperateType;
|
||||
import com.njcn.common.pojo.dto.wave.WaveDataDTO;
|
||||
import com.njcn.common.pojo.enums.common.LogEnum;
|
||||
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
||||
@@ -9,6 +10,7 @@ import com.njcn.common.pojo.response.HttpResult;
|
||||
import com.njcn.common.utils.HttpResultUtil;
|
||||
import com.njcn.event.pojo.param.TransientParam;
|
||||
import com.njcn.event.pojo.param.WaveFileParam;
|
||||
import com.njcn.event.pojo.po.EventDetailNew;
|
||||
import com.njcn.event.pojo.vo.TransientVO;
|
||||
import com.njcn.event.service.TransientService;
|
||||
import com.njcn.web.controller.BaseController;
|
||||
@@ -48,6 +50,8 @@ public class TransientController extends BaseController {
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe);
|
||||
}
|
||||
|
||||
|
||||
//TODO 111
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/getTransientAnalyseWave")
|
||||
@ApiOperation("暂态事件波形分析")
|
||||
@@ -61,7 +65,7 @@ public class TransientController extends BaseController {
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, wave, methodDescribe);
|
||||
}
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON, operateType = OperateType.DOWNLOAD)
|
||||
@PostMapping("/downloadWaveFile")
|
||||
@ApiOperation("暂态波形下载")
|
||||
@ApiImplicitParam(name = "waveFileParam", value = "波形下载参数", required = true)
|
||||
@@ -71,5 +75,14 @@ public class TransientController extends BaseController {
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, resp, methodDescribe);
|
||||
}
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/getTransientValue")
|
||||
@ApiOperation("根据条件查询暂态事件")
|
||||
@ApiImplicitParam(name = "transientParam", value = "暂态列表参数", required = true)
|
||||
public HttpResult<Page<EventDetailNew>> getTransientValue(@RequestBody @Validated TransientParam transientParam){
|
||||
String methodDescribe = getMethodDescribe("getTransientValue");
|
||||
Page<EventDetailNew> list = transientService.getTransientValue(transientParam);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -8,6 +8,7 @@ import com.njcn.common.utils.HttpResultUtil;
|
||||
import com.njcn.device.pojo.param.DeviceInfoParam;
|
||||
import com.njcn.device.pojo.vo.TerminalBaseVO;
|
||||
import com.njcn.event.pojo.po.EventDetail;
|
||||
import com.njcn.event.pojo.po.EventDetailNew;
|
||||
import com.njcn.event.pojo.vo.AreaSubLineVO;
|
||||
import com.njcn.event.service.AreaInfoService;
|
||||
import com.njcn.web.controller.BaseController;
|
||||
@@ -17,11 +18,9 @@ import io.swagger.annotations.ApiOperation;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@@ -75,9 +74,26 @@ public class AreaInfoController extends BaseController {
|
||||
@PostMapping("/getNoDealEvents")
|
||||
@ApiOperation("获取区域未处理暂态事件")
|
||||
@ApiImplicitParam(name = "deviceInfoParam", value = "参数体", required = true)
|
||||
public HttpResult<List<EventDetail>> getNoDealEvents(@RequestBody @Validated DeviceInfoParam.BusinessParam deviceInfoParam) {
|
||||
public HttpResult<List<EventDetailNew>> getNoDealEvents(@RequestBody @Validated DeviceInfoParam deviceInfoParam) {
|
||||
String methodDescribe = getMethodDescribe("getNoDealEvents");
|
||||
List<EventDetail> res = areaInfoService.getNoDealEvents(deviceInfoParam);
|
||||
List<EventDetailNew> res = areaInfoService.getNoDealEvents(deviceInfoParam);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, res, methodDescribe);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取监测点下未处理的暂降事件
|
||||
* @author cdf
|
||||
* @date 2022/8/23
|
||||
*/
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@GetMapping("/getNoDealEventsByLineId")
|
||||
@ApiOperation("获取监测点下未处理的暂降事件")
|
||||
@ApiImplicitParam(name = "id", value = "监测点id", required = true)
|
||||
public HttpResult<List<EventDetailNew>> getNoDealEventsByLineId(@RequestParam("id") @NotBlank(message = "监测点id不可为空") String id) {
|
||||
String methodDescribe = getMethodDescribe("getNoDealEventsByLineId");
|
||||
List<EventDetailNew> res = areaInfoService.getNoDealEventsByLineId(id);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, res, methodDescribe);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -35,7 +35,7 @@ public class PqsEventDetailQuery extends QueryBuilder {
|
||||
protected PqsEventDetailQuery(InfluxDbUtils influxDbUtils) {
|
||||
super(influxDbUtils);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* line_id or条件
|
||||
*
|
||||
@@ -50,7 +50,7 @@ public class PqsEventDetailQuery extends QueryBuilder {
|
||||
}
|
||||
return lineIdOr;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 指定查询数据库和表
|
||||
*
|
||||
@@ -60,7 +60,7 @@ public class PqsEventDetailQuery extends QueryBuilder {
|
||||
private SelectQueryImpl fromTable(SelectionQueryImpl column) {
|
||||
return column.from(DATABASE, PQS_EVENT_DETAIL);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 查询方法
|
||||
* SELECT在包括一个tag时,必须至少指定一个field
|
||||
@@ -76,7 +76,7 @@ public class PqsEventDetailQuery extends QueryBuilder {
|
||||
QueryResult query = getQueryResult(or, and, selectAppendTable);
|
||||
return toPOJO(query, EventDetail.class);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Count方法
|
||||
*
|
||||
@@ -95,7 +95,18 @@ public class PqsEventDetailQuery extends QueryBuilder {
|
||||
}
|
||||
return eventDetailCounts.get(0).getCount();
|
||||
}
|
||||
|
||||
|
||||
public Integer selectCountUp(List<String> columnNames, List<List<Clause>> or, List<Clause> and) {
|
||||
SelectionQueryImpl selectAppendColumnNames = countAppendColumnNames(columnNames);
|
||||
SelectQueryImpl selectAppendTable = fromTable(selectAppendColumnNames);
|
||||
QueryResult query = getQueryResultUp(or, and, selectAppendTable);
|
||||
List<EventDetailCount> eventDetailCounts = toPOJO(query, EventDetailCount.class);
|
||||
if (CollUtil.isEmpty(eventDetailCounts)) {
|
||||
return 0;
|
||||
}
|
||||
return eventDetailCounts.get(0).getCount();
|
||||
}
|
||||
|
||||
/**
|
||||
* where条件 时间和reason_type
|
||||
*
|
||||
@@ -110,7 +121,7 @@ public class PqsEventDetailQuery extends QueryBuilder {
|
||||
clauses.add(eq(type, reasonId));
|
||||
return clauses;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 统计lineIndex的数据
|
||||
*
|
||||
@@ -120,7 +131,7 @@ public class PqsEventDetailQuery extends QueryBuilder {
|
||||
public static Function<List<String>, Long> countLineIndexes(List<EventDetail> eventDetailList) {
|
||||
return lineIndexes -> eventDetailList.stream().filter(t -> lineIndexes.contains(t.getLineId())).count();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 统计eventass_index字段非空的个数
|
||||
*
|
||||
@@ -129,7 +140,7 @@ public class PqsEventDetailQuery extends QueryBuilder {
|
||||
public static Function<List<EventDetail>, Long> countEventassIndexIsNoEmpty() {
|
||||
return eventDetails -> eventDetails.stream().filter(t -> StringUtils.isNotEmpty(t.getEventassIndex())).count();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 时间段内的数据
|
||||
*
|
||||
@@ -142,5 +153,5 @@ public class PqsEventDetailQuery extends QueryBuilder {
|
||||
return timeId.isAfter(beginTime.toInstant()) && timeId.isBefore(endTime.toInstant());
|
||||
}).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -101,6 +101,23 @@ public abstract class QueryBuilder {
|
||||
return query(selectQuery.getCommand());
|
||||
}
|
||||
|
||||
/**
|
||||
* 组装sql语句,包括or语句和and语句添加对多个or语句支持
|
||||
*
|
||||
* @param or or条件
|
||||
* @param and and条件
|
||||
* @return 查询结果
|
||||
* @see SelectionQueryImpl
|
||||
*/
|
||||
public QueryResult getQueryResultUp(List<List<Clause>> or, List<Clause> and, SelectQueryImpl selectQuery) {
|
||||
WhereQueryImpl<SelectQueryImpl> where = selectQuery.where();
|
||||
for(List<Clause> item: or){
|
||||
whereAndNested(where, item);
|
||||
}
|
||||
appendWhereOther(where, and);
|
||||
return query(selectQuery.getCommand());
|
||||
}
|
||||
|
||||
/**
|
||||
* 拼接or条件
|
||||
*
|
||||
@@ -131,7 +148,7 @@ public abstract class QueryBuilder {
|
||||
}
|
||||
where.tz("Asia/Shanghai");
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* time and条件
|
||||
*
|
||||
|
||||
@@ -3,6 +3,7 @@ package com.njcn.event.service;
|
||||
import com.njcn.device.pojo.param.DeviceInfoParam;
|
||||
import com.njcn.device.pojo.vo.TerminalBaseVO;
|
||||
import com.njcn.event.pojo.po.EventDetail;
|
||||
import com.njcn.event.pojo.po.EventDetailNew;
|
||||
import com.njcn.event.pojo.vo.AreaSubLineVO;
|
||||
|
||||
import java.util.List;
|
||||
@@ -35,5 +36,12 @@ public interface AreaInfoService {
|
||||
* @author cdf
|
||||
* @date 2022/6/29
|
||||
*/
|
||||
List<EventDetail> getNoDealEvents(DeviceInfoParam.BusinessParam deviceInfoParam);
|
||||
List<EventDetailNew> getNoDealEvents(DeviceInfoParam deviceInfoParam);
|
||||
|
||||
/**
|
||||
* 获取监测点下未处理的暂降事件
|
||||
* @author cdf
|
||||
* @date 2022/6/29
|
||||
*/
|
||||
List<EventDetailNew> getNoDealEventsByLineId(String id);
|
||||
}
|
||||
|
||||
@@ -2,7 +2,6 @@ package com.njcn.event.service;
|
||||
|
||||
|
||||
import com.njcn.device.pojo.param.DeviceInfoParam;
|
||||
import com.njcn.event.pojo.po.BalanceInfo;
|
||||
import com.njcn.event.pojo.vo.*;
|
||||
|
||||
import java.util.List;
|
||||
@@ -43,11 +42,4 @@ public interface AreaLineService {
|
||||
*/
|
||||
TerminalRunningStatisticsVO getTerminalRunningStatistics(DeviceInfoParam.BusinessParam deviceInfoParam);
|
||||
|
||||
/**
|
||||
* 获取区域暂降综合评估
|
||||
* @param deviceInfoParam 参数
|
||||
* @return 结果
|
||||
*/
|
||||
List<BalanceInfo> getBalanceInfo(DeviceInfoParam.BusinessParam deviceInfoParam);
|
||||
|
||||
}
|
||||
|
||||
@@ -1,8 +1,14 @@
|
||||
package com.njcn.event.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.njcn.event.pojo.param.EventBaseParam;
|
||||
import com.njcn.common.pojo.dto.wave.WaveDataDTO;
|
||||
import com.njcn.event.pojo.param.*;
|
||||
import com.njcn.event.pojo.po.EventDetail;
|
||||
import com.njcn.event.pojo.vo.*;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.text.ParseException;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* pqs-event
|
||||
@@ -18,4 +24,78 @@ public interface EventAnalysisService {
|
||||
* @date 2022/6/23
|
||||
*/
|
||||
Page<EventDetail> getEventAnalyse(EventBaseParam eventBaseParam);
|
||||
|
||||
/**
|
||||
* 获取坐标
|
||||
* @param statisticsParam
|
||||
* @return
|
||||
*/
|
||||
List<CoordsVO> getCoords(StatisticsParam statisticsParam);
|
||||
|
||||
/**
|
||||
*获取Disdip表格
|
||||
* @param statisticsParam
|
||||
* @return
|
||||
*/
|
||||
List<DISDIPVO> eventDisdip(StatisticsParam statisticsParam);
|
||||
|
||||
/**
|
||||
* 获取IEC411数据
|
||||
* @param statisticsParam
|
||||
* @return
|
||||
*/
|
||||
List<IEC411VO> IEC411(StatisticsParam statisticsParam);
|
||||
|
||||
/**
|
||||
* 获取IEC28数据
|
||||
* @param statisticsParam
|
||||
* @return
|
||||
*/
|
||||
List<IEC28VO> IEC28(StatisticsParam statisticsParam);
|
||||
|
||||
/**
|
||||
* 获取时间列表
|
||||
* @param statisticsParam
|
||||
* @return
|
||||
*/
|
||||
List<TimeVO> getReasonTypeTime(StatisticsParam statisticsParam) throws ParseException;
|
||||
|
||||
/**
|
||||
* 获取详细数据对象
|
||||
* @param statisticsParam
|
||||
* @return
|
||||
*/
|
||||
StatisticVO getStatistic(StatisticsParam statisticsParam);
|
||||
|
||||
ProbabilityVO getProbabilityDistribution(StatisticsParam statisticsParam);
|
||||
/**
|
||||
* 获取点状表格数据
|
||||
* @param statisticsParam
|
||||
* @return
|
||||
*/
|
||||
List<EventDetail> getPlot(StatisticsParam statisticsParam);
|
||||
|
||||
/**
|
||||
*监测点暂降事件分析查询
|
||||
* @author zbj
|
||||
* @date 2022/7/25
|
||||
*/
|
||||
Page<WaveTypeVO> getMonitorEventAnalyseQuery(EventBaseParam eventBaseParam);
|
||||
|
||||
/**
|
||||
*监测点事件波形分析
|
||||
* @author zbj
|
||||
* @date 2022/7/27
|
||||
*/
|
||||
WaveDataDTO getMonitorEventAnalyseWave(String timeId, String lineId);
|
||||
|
||||
/**
|
||||
*监测点事件波形下载
|
||||
* @author zbj
|
||||
* @date 2022/7/28
|
||||
*/
|
||||
HttpServletResponse downloadMonitorEventWaveFile(WaveFileParam waveFileParam, HttpServletResponse response) throws Exception;
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -15,9 +15,14 @@ import com.njcn.event.service.AreaAnalysisService;
|
||||
import com.njcn.system.api.DicDataFeignClient;
|
||||
import com.njcn.system.enums.DicDataTypeEnum;
|
||||
import com.njcn.system.pojo.po.DictData;
|
||||
import io.swagger.models.auth.In;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.checkerframework.checker.units.qual.A;
|
||||
import org.influxdb.querybuilder.clauses.Clause;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.ZoneId;
|
||||
import java.util.*;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
@@ -25,6 +30,7 @@ import java.util.stream.Collectors;
|
||||
import static com.njcn.event.influxdb.PqsEventDetailQuery.lineIdOr;
|
||||
import static com.njcn.event.influxdb.PqsEventDetailQuery.timeAndType;
|
||||
import static com.njcn.event.influxdb.QueryBuilder.*;
|
||||
import static org.influxdb.querybuilder.BuiltQuery.QueryBuilder.eq;
|
||||
|
||||
/**
|
||||
* pqs-event
|
||||
@@ -36,12 +42,12 @@ import static com.njcn.event.influxdb.QueryBuilder.*;
|
||||
@RequiredArgsConstructor
|
||||
public class AreaAnalysisServiceImpl implements AreaAnalysisService {
|
||||
private final GeneralDeviceInfoClient generalDeviceInfoClient;
|
||||
|
||||
|
||||
private final DicDataFeignClient dicDataFeignClient;
|
||||
|
||||
|
||||
private final LineFeignClient lineFeignClient;
|
||||
private final PqsEventDetailQuery pqsEventDetailQuery;
|
||||
|
||||
|
||||
@Override
|
||||
public AreaAnalysisVO getEventReason(DeviceInfoParam.BusinessParam deviceInfoParam) {
|
||||
AreaAnalysisVO areaAnalysisVO = new AreaAnalysisVO();
|
||||
@@ -50,14 +56,31 @@ public class AreaAnalysisServiceImpl implements AreaAnalysisService {
|
||||
// 获取指定部门下的监测点集合
|
||||
List<GeneralDeviceDTO> generalDeviceDTOList = generalDeviceInfoClient.getPracticalAllDeviceInfo(deviceInfoParam).getData();
|
||||
List<String> lineIds = getAllLineIdList(generalDeviceDTOList);
|
||||
|
||||
|
||||
List<AreaAnalysisVO.Children> reasonList = assData(dicReasonList, lineIds, deviceInfoParam.getSearchBeginTime(), deviceInfoParam.getSearchEndTime(), "event_reason");
|
||||
List<AreaAnalysisVO.Children> typeList = assData(dicTypeList, lineIds, deviceInfoParam.getSearchBeginTime(), deviceInfoParam.getSearchEndTime(), "event_type");
|
||||
|
||||
//暂降类型特殊处理
|
||||
DictData dictData = dicReasonList.stream().filter(item->"短路故障".equals(item.getName())).findFirst().get();
|
||||
|
||||
List<String> dicIdsXi = dicTypeList.stream().filter(item->item.getName().contains("相间")).map(DictData::getId).collect(Collectors.toList());
|
||||
List<String> dicIdsOne = dicTypeList.stream().filter(item->"A相".equals(item.getName())||"B相".equals(item.getName())||"C相".equals(item.getName())).map(DictData::getId).collect(Collectors.toList());
|
||||
List<String> dicIdsThree = dicTypeList.stream().filter(item->item.getName().contains("三相接地")).map(DictData::getId).collect(Collectors.toList());
|
||||
List<String> dicIdsOther = dicTypeList.stream().filter(item->item.getName().contains("其他")).map(DictData::getId).collect(Collectors.toList());
|
||||
List<String> dicIdsDouble = dicTypeList.stream().filter(item->item.getName().contains("双相接地")).map(DictData::getId).collect(Collectors.toList());
|
||||
Map<String, List<String>> stringListMap = new HashMap<>();
|
||||
stringListMap.put("单相接地",dicIdsOne);
|
||||
stringListMap.put("双相接地",dicIdsDouble);
|
||||
stringListMap.put("三相短路",dicIdsThree);
|
||||
stringListMap.put("相间故障",dicIdsXi);
|
||||
stringListMap.put("未知",dicIdsOther);
|
||||
|
||||
List<AreaAnalysisVO.Children> typeList = assReason(stringListMap,lineIds,deviceInfoParam.getSearchBeginTime(), deviceInfoParam.getSearchEndTime(),dictData.getId());
|
||||
|
||||
areaAnalysisVO.setReason(reasonList);
|
||||
areaAnalysisVO.setType(typeList);
|
||||
return areaAnalysisVO;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取电压容忍度曲线兼容性统计
|
||||
*
|
||||
@@ -71,47 +94,47 @@ public class AreaAnalysisServiceImpl implements AreaAnalysisService {
|
||||
if (CollUtil.isEmpty(generalDeviceDTOList)) {
|
||||
return VoltageToleranceCurveVO.empty();
|
||||
}
|
||||
|
||||
|
||||
List<String> lineIds = getAllLineIdList(generalDeviceDTOList);
|
||||
if (CollUtil.isEmpty(lineIds)) {
|
||||
return VoltageToleranceCurveVO.empty();
|
||||
}
|
||||
|
||||
|
||||
List<AreaLineInfoVO> getBaseLineAreaInfo = lineFeignClient.getBaseLineAreaInfo(lineIds).getData();
|
||||
if (CollUtil.isEmpty(getBaseLineAreaInfo)) {
|
||||
return VoltageToleranceCurveVO.empty();
|
||||
}
|
||||
|
||||
|
||||
Map<String, AreaLineInfoVO> areaLineInfoVOMap =
|
||||
getBaseLineAreaInfo.parallelStream().collect(Collectors.toConcurrentMap(AreaLineInfoVO::getLineId,
|
||||
Function.identity()));
|
||||
|
||||
List<EventDetail> eventDetailList = pqsEventDetailQuery.selectList(Arrays.asList("line_id", "persist_time", "event_value", "create_time"),
|
||||
|
||||
List<EventDetail> eventDetailList = pqsEventDetailQuery.selectList(Arrays.asList("time","line_id", "persist_time", "event_value"),
|
||||
lineIdOr(lineIds), timeAnd(beginOfDay(deviceInfoParam.getSearchBeginTime()),
|
||||
endOfDay(deviceInfoParam.getSearchEndTime())));
|
||||
if (CollUtil.isEmpty(eventDetailList)) {
|
||||
return VoltageToleranceCurveVO.empty();
|
||||
}
|
||||
|
||||
|
||||
List<VoltageToleranceCurveDataList> curveDataList = eventDetailList.parallelStream()
|
||||
.map(dto -> {
|
||||
AreaLineInfoVO info = areaLineInfoVOMap.get(dto.getLineId());
|
||||
|
||||
|
||||
VoltageToleranceCurveDataList voltageToleranceCurve = new VoltageToleranceCurveDataList();
|
||||
voltageToleranceCurve.setLineId(dto.getLineId());
|
||||
voltageToleranceCurve.setPersistTime(dto.getPersistTime());
|
||||
voltageToleranceCurve.setEventValue(dto.getEventValue());
|
||||
voltageToleranceCurve.setTime(dto.getCreateTime());
|
||||
voltageToleranceCurve.setTime(LocalDateTime.ofInstant(dto.getTimeId(), ZoneId.systemDefault()));
|
||||
voltageToleranceCurve.setGdName(info.getGdName());
|
||||
voltageToleranceCurve.setSubName(info.getSubName());
|
||||
return voltageToleranceCurve;
|
||||
})
|
||||
.sorted(VoltageToleranceCurveDataList.sortAscTime())
|
||||
//.sorted(VoltageToleranceCurveDataList.sortAscTime())
|
||||
.collect(Collectors.toCollection(() -> Collections.synchronizedList(new ArrayList<>())));
|
||||
|
||||
|
||||
return VoltageToleranceCurveVO.buildVO(eventDetailList.size(), curveDataList);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取全部的LineID
|
||||
*
|
||||
@@ -121,8 +144,8 @@ public class AreaAnalysisServiceImpl implements AreaAnalysisService {
|
||||
private List<String> getAllLineIdList(List<GeneralDeviceDTO> generalDeviceDTOList) {
|
||||
return generalDeviceDTOList.stream().flatMap(dto -> dto.getLineIndexes().stream()).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
private List<AreaAnalysisVO.Children> assData(List<DictData> dicList, List<String> lineIds, String startTime, String endTime, String type) {
|
||||
List<AreaAnalysisVO.Children> reasonList = new ArrayList<>();
|
||||
Integer allCount = 0;
|
||||
@@ -131,7 +154,7 @@ public class AreaAnalysisServiceImpl implements AreaAnalysisService {
|
||||
Integer count = pqsEventDetailQuery.selectCount(Collections.singletonList(type),
|
||||
lineIdOr(lineIds), timeAndType(beginOfDay(startTime),
|
||||
endOfDay(endTime), type, reason.getId()));
|
||||
|
||||
|
||||
AreaAnalysisVO.Children children = new AreaAnalysisVO.Children();
|
||||
children.setName(reason.getName());
|
||||
children.setValue(count);
|
||||
@@ -144,4 +167,36 @@ public class AreaAnalysisServiceImpl implements AreaAnalysisService {
|
||||
reasonList.add(allType);
|
||||
return reasonList;
|
||||
}
|
||||
|
||||
private List<AreaAnalysisVO.Children> assReason(Map<String, List<String>> stringListMap, List<String> lineIds, String startTime, String endTime, String typeId){
|
||||
List<AreaAnalysisVO.Children> reasonList = new ArrayList<>();
|
||||
Integer allCount = 0;
|
||||
for (Map.Entry<String, List<String>> stringListEntry : stringListMap.entrySet()) {
|
||||
// 暂降原因类型次数
|
||||
List<List<Clause>> clauseList = new ArrayList<>();
|
||||
List<Clause> clauses = new ArrayList<>();
|
||||
for (String id : stringListEntry.getValue()) {
|
||||
clauses.add(eq("event_reason", id));
|
||||
}
|
||||
clauseList.add(lineIdOr(lineIds));
|
||||
clauseList.add(clauses);
|
||||
|
||||
Integer count = pqsEventDetailQuery.selectCountUp(Collections.singletonList("event_type"), clauseList
|
||||
, timeAndType(beginOfDay(startTime),
|
||||
endOfDay(endTime), "event_reason", typeId));
|
||||
|
||||
AreaAnalysisVO.Children children = new AreaAnalysisVO.Children();
|
||||
children.setName(stringListEntry.getKey());
|
||||
children.setValue(count);
|
||||
allCount += count;
|
||||
reasonList.add(children);
|
||||
|
||||
}
|
||||
|
||||
AreaAnalysisVO.Children allType = new AreaAnalysisVO.Children();
|
||||
allType.setName("总计");
|
||||
allType.setValue(allCount);
|
||||
reasonList.add(allType);
|
||||
return reasonList;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,10 +11,14 @@ import com.njcn.device.pojo.vo.AreaLineInfoVO;
|
||||
import com.njcn.device.pojo.vo.TerminalBaseVO;
|
||||
import com.njcn.event.pojo.constant.Param;
|
||||
import com.njcn.event.pojo.po.EventDetail;
|
||||
import com.njcn.event.pojo.po.EventDetailNew;
|
||||
import com.njcn.event.pojo.vo.AreaLineVO;
|
||||
import com.njcn.event.pojo.vo.AreaSubLineVO;
|
||||
import com.njcn.event.service.AreaInfoService;
|
||||
import com.njcn.event.utils.CommUtil;
|
||||
import com.njcn.influxdb.mapper.InfluxDBResultMapperCn;
|
||||
import com.njcn.influxdb.param.InfluxDBPublicParam;
|
||||
import com.njcn.influxdb.utils.InfluxDBCommUtils;
|
||||
import com.njcn.influxdb.utils.InfluxDbUtils;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
@@ -26,6 +30,7 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
/**
|
||||
* pqs-event
|
||||
@@ -56,21 +61,24 @@ public class AreaInfoServiceImpl implements AreaInfoService {
|
||||
if (CollectionUtil.isNotEmpty(lineIds)) {
|
||||
List<AreaLineInfoVO> resList = lineFeignClient.getBaseLineAreaInfo(lineIds).getData();
|
||||
//查询监测点未处理暂态事件
|
||||
StringBuilder lineIdsStr = CommUtil.assToInfluxParam(lineIds);
|
||||
StringBuilder lineIdsStr = InfluxDBCommUtils.assToInfluxParam(lineIds);
|
||||
|
||||
String stringResult = "SELECT count(eventass_index) FROM " + Param.EVENT_DETAIL + Param.WHERE + "time >= '" + deviceInfoParam.getSearchBeginTime() + InfluxDBPublicParam.START_TIME + "' and " + "time <= '" + deviceInfoParam.getSearchEndTime() + InfluxDBPublicParam.END_TIME + "' and " + lineIdsStr + " and eventass_index = '' group by line_id" + InfluxDBPublicParam.TIME_ZONE;
|
||||
// 结果集
|
||||
QueryResult result = influxDbUtils.query(stringResult);
|
||||
if (!result.hasError()) {
|
||||
List<QueryResult.Series> list = result.getResults().get(0).getSeries();
|
||||
|
||||
for (AreaLineInfoVO areaLineInfoVO : resList) {
|
||||
boolean flag = false;
|
||||
for (QueryResult.Series tem : list) {
|
||||
String lineId = tem.getTags().get("line_id");
|
||||
if (areaLineInfoVO.getLineId().equals(lineId)) {
|
||||
areaLineInfoVO.setNoDealCount(Double.valueOf(tem.getValues().get(0).get(1).toString()).intValue());
|
||||
flag = true;
|
||||
break;
|
||||
if(CollectionUtil.isNotEmpty(list)) {
|
||||
for (QueryResult.Series tem : list) {
|
||||
String lineId = tem.getTags().get("line_id");
|
||||
if (areaLineInfoVO.getLineId().equals(lineId)) {
|
||||
areaLineInfoVO.setNoDealCount(Double.valueOf(tem.getValues().get(0).get(1).toString()).intValue());
|
||||
flag = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!flag) {
|
||||
@@ -107,28 +115,30 @@ public class AreaInfoServiceImpl implements AreaInfoService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<EventDetail> getNoDealEvents(DeviceInfoParam.BusinessParam deviceInfoParam) {
|
||||
List<EventDetail> resList = new ArrayList<>();
|
||||
public List<EventDetailNew> getNoDealEvents(DeviceInfoParam deviceInfoParam) {
|
||||
List<EventDetailNew> resList = new ArrayList<>();
|
||||
List<GeneralDeviceDTO> generalDeviceDTOList = generalDeviceInfoClient.getPracticalAllDeviceInfo(deviceInfoParam).getData();
|
||||
List<String> lineIds = generalDeviceDTOList.stream().flatMap(dto -> dto.getLineIndexes().stream()).collect(Collectors.toList());
|
||||
|
||||
if (CollectionUtil.isNotEmpty(lineIds)) {
|
||||
List<Line> lineList = lineFeignClient.getBaseLineList(lineIds).getData();
|
||||
List<AreaLineInfoVO> lineList = lineFeignClient.getBaseLineAreaInfo(lineIds).getData();
|
||||
//查询监测点未处理暂态事件
|
||||
StringBuilder lineIdsStr = CommUtil.assToInfluxParam(lineIds);
|
||||
StringBuilder lineIdsStr = InfluxDBCommUtils.assToInfluxParam(lineIds);
|
||||
|
||||
String stringResult = "SELECT * FROM " + Param.EVENT_DETAIL + Param.WHERE + "time >= '" + deviceInfoParam.getSearchBeginTime() + Param.BEGIN + "' and " + "time <= '" + deviceInfoParam.getSearchEndTime() + Param.END + "' and " + lineIdsStr + "and eventass_index = '' " + InfluxDBPublicParam.TIME_ZONE;
|
||||
String stringResult = "SELECT * FROM " + Param.EVENT_DETAIL + Param.WHERE + lineIdsStr + "and eventass_index = '' order by time desc limit 100" + InfluxDBPublicParam.TIME_ZONE;
|
||||
// 结果集
|
||||
QueryResult result = influxDbUtils.query(stringResult);
|
||||
// 结果集映射到对象中
|
||||
InfluxDBResultMapper influxDBResultMapper = new InfluxDBResultMapper();
|
||||
resList = influxDBResultMapper.toPOJO(result, EventDetail.class);
|
||||
InfluxDBResultMapperCn influxDBResultMapper = new InfluxDBResultMapperCn();
|
||||
resList = influxDBResultMapper.toPOJO(result, EventDetailNew.class);
|
||||
//对未处理暂降事件的监测点替换成中文名称
|
||||
if (CollectionUtil.isNotEmpty(resList)) {
|
||||
for (EventDetail eventDetail : resList) {
|
||||
for (Line tem : lineList) {
|
||||
if (eventDetail.getLineId().equals(tem.getId())) {
|
||||
eventDetail.setLineId(tem.getName());
|
||||
for (EventDetailNew eventDetail : resList) {
|
||||
for (AreaLineInfoVO tem : lineList) {
|
||||
if (eventDetail.getLineId().equals(tem.getLineId())) {
|
||||
eventDetail.setLineName(tem.getLineName());
|
||||
eventDetail.setLng(tem.getLng());
|
||||
eventDetail.setLat(tem.getLat());
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -138,5 +148,26 @@ public class AreaInfoServiceImpl implements AreaInfoService {
|
||||
return resList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<EventDetailNew> getNoDealEventsByLineId(String id) {
|
||||
|
||||
String stringResult = "SELECT * FROM " + Param.EVENT_DETAIL + Param.WHERE + "line_id = '"+id+"' and eventass_index = '' order by time desc limit 100" + InfluxDBPublicParam.TIME_ZONE;
|
||||
// 结果集
|
||||
QueryResult result = influxDbUtils.query(stringResult);
|
||||
// 结果集映射到对象中
|
||||
InfluxDBResultMapperCn influxDBResultMapper = new InfluxDBResultMapperCn();
|
||||
List<EventDetailNew> resList = influxDBResultMapper.toPOJO(result, EventDetailNew.class);
|
||||
|
||||
List<AreaLineInfoVO> lineList = lineFeignClient.getBaseLineAreaInfo(Stream.of(id).collect(Collectors.toList())).getData();
|
||||
if(CollectionUtil.isNotEmpty(lineList)){
|
||||
resList = resList.stream().peek(item->{
|
||||
item.setGdName(lineList.get(0).getGdName());
|
||||
item.setSubName(lineList.get(0).getSubName());
|
||||
item.setLineName(lineList.get(0).getLineName());
|
||||
}).collect(Collectors.toList());
|
||||
}
|
||||
return resList;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -3,23 +3,24 @@ package com.njcn.event.service.Impl;
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.ArrayUtil;
|
||||
import com.njcn.common.pojo.enums.common.ServerEnum;
|
||||
import com.njcn.device.api.GeneralDeviceInfoClient;
|
||||
import com.njcn.device.api.LineFeignClient;
|
||||
import com.njcn.device.pojo.dto.GeneralDeviceDTO;
|
||||
import com.njcn.device.pojo.param.DeviceInfoParam;
|
||||
import com.njcn.device.pojo.vo.LineDetailDataVO;
|
||||
import com.njcn.device.pojo.vo.AreaLineInfoVO;
|
||||
import com.njcn.device.pojo.vo.LineDetailVO;
|
||||
import com.njcn.device.pojo.vo.LineDeviceStateVO;
|
||||
import com.njcn.device.pojo.vo.SubstationDetailVO;
|
||||
import com.njcn.event.influxdb.PqsOnlinerateQuery;
|
||||
import com.njcn.event.mapper.PqDeviceMapper;
|
||||
import com.njcn.event.pojo.po.*;
|
||||
import com.njcn.event.pojo.po.PqDevice;
|
||||
import com.njcn.event.pojo.po.PqsOnlinerate;
|
||||
import com.njcn.event.pojo.vo.*;
|
||||
import com.njcn.event.pojo.vo.TerminalRunningStatisticsVO.TerminalRunningInfoVO;
|
||||
import com.njcn.event.pojo.vo.TerminalRunningStatisticsVO.TerminalRunningVO;
|
||||
import com.njcn.event.service.AreaLineService;
|
||||
import com.njcn.event.service.EventDetailService;
|
||||
import com.njcn.influxdb.param.InfluxDBPublicParam;
|
||||
import com.njcn.influxdb.utils.InfluxDbUtils;
|
||||
import com.njcn.system.pojo.enums.StatisticsEnum;
|
||||
@@ -39,8 +40,6 @@ import java.util.stream.Collectors;
|
||||
import static com.njcn.event.influxdb.PqsOnlinerateQuery.devIdOr;
|
||||
import static com.njcn.event.influxdb.QueryBuilder.*;
|
||||
|
||||
import com.njcn.event.pojo.po.BalanceInfo.PointInfo;
|
||||
|
||||
/**
|
||||
* @author denghuajun
|
||||
* @version 1.0.0
|
||||
@@ -61,8 +60,6 @@ public class AreaLineServiceImpl implements AreaLineService {
|
||||
|
||||
private final PqDeviceMapper pqDeviceMapper;
|
||||
|
||||
private final EventDetailService eventDetailService;
|
||||
|
||||
@Override
|
||||
public AreaLineVO getAreaLineVO(DeviceInfoParam deviceInfoParam) {
|
||||
AreaLineVO areaLineVO = new AreaLineVO();
|
||||
@@ -154,15 +151,14 @@ public class AreaLineServiceImpl implements AreaLineService {
|
||||
@Override
|
||||
public EventHeatMapVO getEventHeatMap(DeviceInfoParam.BusinessParam deviceInfoParam) {
|
||||
EventHeatMapVO eventHeatMapVO = new EventHeatMapVO();
|
||||
List<EventHeatMapDetailVO> eventHeatMapDetailList = new ArrayList<>();
|
||||
List<List<Object>> eventHeatMapDetailList = new ArrayList<>();
|
||||
deviceInfoParam.setServerName(ServerEnum.EVENT.getName());
|
||||
List<List<Object>> listObject = new ArrayList<>();
|
||||
List<BaseVO> listObject = new ArrayList<>();
|
||||
// 获取暂降监测点
|
||||
List<GeneralDeviceDTO> generalDeviceDTOList = generalDeviceInfoClient.getPracticalAllDeviceInfo(deviceInfoParam).getData();
|
||||
List<String> lineIndexs;
|
||||
int i = 0, generalDeviceListSize = generalDeviceDTOList.size();
|
||||
while (i < generalDeviceListSize) {
|
||||
List<Object> objectList = new ArrayList<>();
|
||||
GeneralDeviceDTO generalDeviceDTO = generalDeviceDTOList.get(i);
|
||||
lineIndexs = generalDeviceDTO.getLineIndexes();
|
||||
// 获取暂降数据
|
||||
@@ -170,18 +166,33 @@ public class AreaLineServiceImpl implements AreaLineService {
|
||||
int tail = 0;
|
||||
List<EventHeatDeatilVO> eventdetailList = getContion(deviceInfoParam, lineIndexs);
|
||||
if (eventdetailList.size() > 0) {
|
||||
for (int eventNum = 0; eventNum < eventdetailList.size(); eventNum++) {
|
||||
EventHeatMapDetailVO eventHeatMapDetailVO = new EventHeatMapDetailVO();
|
||||
LineDetailVO lineDetailVO = lineFeignClient.getLineSubGdDetail(eventdetailList.get(eventNum).getLineId()).getData();
|
||||
BeanUtil.copyProperties(lineDetailVO, eventHeatMapDetailVO);
|
||||
eventHeatMapDetailVO.setEventNum(eventdetailList.get(eventNum).getCount());
|
||||
tail += eventdetailList.get(eventNum).getCount();
|
||||
eventHeatMapDetailList.add(eventHeatMapDetailVO);
|
||||
List<String> lineIds = eventdetailList.stream().map(EventHeatDeatilVO::getLineId).collect(Collectors.toList());
|
||||
List<AreaLineInfoVO> areaAnalysisVOList = lineFeignClient.getBaseLineAreaInfo(lineIds).getData();
|
||||
|
||||
for (EventHeatDeatilVO eventHeat : eventdetailList) {
|
||||
for(AreaLineInfoVO areaLineInfoVO : areaAnalysisVOList){
|
||||
if(eventHeat.getLineId().equals(areaLineInfoVO.getLineId())){
|
||||
List<Object> ev = new ArrayList<>();
|
||||
tail += eventHeat.getCount();
|
||||
ev.add(areaLineInfoVO.getLng());
|
||||
ev.add(areaLineInfoVO.getLat());
|
||||
ev.add(tail);
|
||||
eventHeatMapDetailList.add(ev);
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
objectList.add(generalDeviceDTO.getName() + "\n(" + lineIndexs.size() + ")");
|
||||
objectList.add(tail);
|
||||
listObject.add(objectList);
|
||||
BaseVO baseVO = new BaseVO();
|
||||
baseVO.setName(generalDeviceDTO.getName());
|
||||
baseVO.setValue(BigDecimal.valueOf(lineIndexs.size()));
|
||||
listObject.add(baseVO);
|
||||
}
|
||||
} else {
|
||||
BaseVO baseVO = new BaseVO();
|
||||
baseVO.setName(generalDeviceDTO.getName());
|
||||
baseVO.setValue(BigDecimal.valueOf(3.141592));
|
||||
listObject.add(baseVO);
|
||||
}
|
||||
i++;
|
||||
}
|
||||
@@ -247,62 +258,17 @@ public class AreaLineServiceImpl implements AreaLineService {
|
||||
return TerminalRunningStatisticsVO.buildVO(area, factory);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<BalanceInfo> getBalanceInfo(DeviceInfoParam.BusinessParam deviceInfoParam) {
|
||||
List<BalanceInfo> balanceInfos = new ArrayList<>();
|
||||
//获取符合条件的监测点
|
||||
List<GeneralDeviceDTO> generalDeviceDTOList = generalDeviceInfoClient.getPracticalAllDeviceInfo(deviceInfoParam).getData();
|
||||
if (CollUtil.isEmpty(generalDeviceDTOList)) {
|
||||
return balanceInfos;
|
||||
}
|
||||
for (GeneralDeviceDTO generalDeviceDTO : generalDeviceDTOList) {
|
||||
BalanceInfo balanceInfo = new BalanceInfo();
|
||||
balanceInfo.setAreaName(generalDeviceDTO.getName());
|
||||
balanceInfo.setAreaIndex(generalDeviceDTO.getIndex());
|
||||
//监测点
|
||||
List<String> lineList = generalDeviceDTO.getLineIndexes();
|
||||
List<PointInfo> list = new ArrayList<>();
|
||||
for (String lineIndex : lineList) {
|
||||
PointInfo pointInfo = balanceInfo.new PointInfo();
|
||||
Float value = getSarfiValue(deviceInfoParam.getSearchBeginTime(), deviceInfoParam.getSearchEndTime(), 0.9f, lineIndex);
|
||||
pointInfo.getQtIdx().r_esm = (value == null ? 0f : value);
|
||||
pointInfo.getQtIdx().sarfi_90 = getSarfiCount(deviceInfoParam.getSearchBeginTime(), deviceInfoParam.getSearchEndTime(), 0.9f, lineIndex); // 统计小于0.9的总数
|
||||
pointInfo.getQtIdx().sarifi_50 = getSarfiCount(deviceInfoParam.getSearchBeginTime(), deviceInfoParam.getSearchEndTime(), 0.5f, lineIndex); // 统计小于0.9的总数 // 统计小于0.5的总数
|
||||
//获取当前监测点的暂降信息
|
||||
List<EventDetail> eventDetailList = getEventDetailInfo(lineIndex, 0.9f, deviceInfoParam.getSearchBeginTime(), deviceInfoParam.getSearchEndTime());
|
||||
if(eventDetailList.size()>0) {
|
||||
//获取监测点信息
|
||||
LineDetailDataVO lineDetailVO = lineFeignClient.getLineDetailData(lineIndex).getData();
|
||||
List<Sarifi> sarifis = new ArrayList<>();
|
||||
for (EventDetail eventDetail:eventDetailList){
|
||||
Sarifi sarifi = new Sarifi();
|
||||
sarifi.setTime(eventDetail.getPersistTime().floatValue());
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
return balanceInfos;
|
||||
}
|
||||
|
||||
private TerminalRunningVO analyzeTerminalRun(DeviceInfoParam.BusinessParam deviceInfoParam) {
|
||||
List<GeneralDeviceDTO> generalDeviceDTOList = generalDeviceInfoClient.getPracticalAllDeviceInfo(deviceInfoParam).getData();
|
||||
|
||||
if (CollUtil.isEmpty(generalDeviceDTOList)) {
|
||||
return TerminalRunningVO.empty();
|
||||
}
|
||||
List<String> deviceIndexList =
|
||||
generalDeviceDTOList.stream().flatMap(dto -> dto.getDeviceIndexes().stream()).collect(Collectors.toList());
|
||||
List<String> deviceIndexList = generalDeviceDTOList.stream().flatMap(dto -> dto.getDeviceIndexes().stream()).collect(Collectors.toList());
|
||||
|
||||
if (CollUtil.isEmpty(deviceIndexList)) {
|
||||
return TerminalRunningVO.empty();
|
||||
}
|
||||
|
||||
List<PqsOnlinerate> pqsOnlinerateList =
|
||||
pqsOnlinerateQuery.selectList(Arrays.asList("dev_id", "offlinemin", "onlinemin"),
|
||||
devIdOr(deviceIndexList),
|
||||
timeAnd(beginOfDay(deviceInfoParam.getSearchBeginTime()), endOfDay(deviceInfoParam.getSearchEndTime())));
|
||||
List<PqsOnlinerate> pqsOnlinerateList = pqsOnlinerateQuery.selectList(Arrays.asList("dev_id", "offlinemin", "onlinemin"),
|
||||
devIdOr(deviceIndexList),
|
||||
timeAnd(beginOfDay(deviceInfoParam.getSearchBeginTime()), endOfDay(deviceInfoParam.getSearchEndTime())));
|
||||
|
||||
List<PqDevice> pqDeviceList = pqDeviceMapper.queryRunFlagByDeviceIndexs(deviceIndexList);
|
||||
|
||||
@@ -316,9 +282,9 @@ public class AreaLineServiceImpl implements AreaLineService {
|
||||
terminalRunningInfoVO.setBreaks(countDeviceRunStatus(pqDeviceList).apply(1, deviceIndexes));
|
||||
terminalRunningInfoVO.setShutdown(countDeviceRunStatus(pqDeviceList).apply(2, deviceIndexes));
|
||||
if (deviceIndexes.size() == 0) {
|
||||
terminalRunningInfoVO.setNormalRate(0.0);
|
||||
terminalRunningInfoVO.setBreaksRate(0.0);
|
||||
terminalRunningInfoVO.setShutdownRate(0.0);
|
||||
terminalRunningInfoVO.setNormalRate(3.14159);
|
||||
terminalRunningInfoVO.setBreaksRate(3.14159);
|
||||
terminalRunningInfoVO.setShutdownRate(3.14159);
|
||||
} else {
|
||||
double normalRate = terminalRunningInfoVO.getNormal().doubleValue() / terminalRunningInfoVO.getNumberOfTerminals() * 100;
|
||||
terminalRunningInfoVO.setNormalRate(new BigDecimal(normalRate).setScale(2, RoundingMode.HALF_UP).doubleValue());
|
||||
@@ -340,7 +306,7 @@ public class AreaLineServiceImpl implements AreaLineService {
|
||||
.sum();
|
||||
Long shutdownSum = terminalRun.stream().mapToLong(TerminalRunningInfoVO::getShutdown)
|
||||
.sum();
|
||||
Double normalRateSum = 0.0, breaksRateSum = 0.0, shutdownRateSum = 0.0;
|
||||
Double normalRateSum = 3.14159, breaksRateSum = 3.14159, shutdownRateSum = 3.14159;
|
||||
if (terminalSum != 0) {
|
||||
normalRateSum = new BigDecimal(normalSum.doubleValue() / terminalSum * 100).setScale(2, RoundingMode.HALF_UP).doubleValue();
|
||||
breaksRateSum = new BigDecimal(breaksSum.doubleValue() / terminalSum * 100).setScale(2, RoundingMode.HALF_UP).doubleValue();
|
||||
@@ -370,7 +336,7 @@ public class AreaLineServiceImpl implements AreaLineService {
|
||||
BigDecimal b2 = new BigDecimal(offlineSum);
|
||||
BigDecimal c = new BigDecimal(100);
|
||||
if (b1.compareTo(BigDecimal.ZERO) == 0) {
|
||||
return 0.00D;
|
||||
return 3.14159D;
|
||||
}
|
||||
return b1.divide(b1.add(b2), 4, RoundingMode.HALF_UP).multiply(c).doubleValue();
|
||||
};
|
||||
@@ -403,7 +369,7 @@ public class AreaLineServiceImpl implements AreaLineService {
|
||||
}
|
||||
j++;
|
||||
}
|
||||
stringBuilder.append(" group by line_id");
|
||||
stringBuilder.append(" group by line_id").append(InfluxDBPublicParam.TIME_ZONE);
|
||||
// 获取暂降事件
|
||||
String sql = "select count(file_flag) from pqs_eventdetail where " + stringBuilder.toString();
|
||||
QueryResult result = influxDbUtils.query(sql);
|
||||
@@ -411,69 +377,4 @@ public class AreaLineServiceImpl implements AreaLineService {
|
||||
List<EventHeatDeatilVO> eventdetailList = influxDBResultMapper.toPOJO(result, EventHeatDeatilVO.class);
|
||||
return eventdetailList;
|
||||
}
|
||||
|
||||
public Float getSarfiValue(String startTime, String endTime, Float fvalue, String id) {
|
||||
Float retList = 0f;
|
||||
//组装sql语句
|
||||
StringBuilder stringBuilder = new StringBuilder();
|
||||
stringBuilder.append("time >= '").append(DateUtil.beginOfDay(DateUtil.parse(startTime))).append("' and ").append("time <= '").append(DateUtil.endOfDay(DateUtil.parse(endTime))).append("' and ");
|
||||
stringBuilder.append("line_id = '").append(id).append("'").append(" and event_value <=").append(fvalue).append(InfluxDBPublicParam.TIME_ZONE);
|
||||
String sql = "select mean(event_value) from " + InfluxDBPublicParam.PQS_EVENT_DETAIL + " where " + stringBuilder.toString();
|
||||
QueryResult queryResult = influxDbUtils.query(sql);
|
||||
List<QueryResult.Result> results = queryResult.getResults();
|
||||
if (results == null || results.isEmpty()) {
|
||||
return retList;
|
||||
}
|
||||
QueryResult.Result result = results.get(0);
|
||||
List<QueryResult.Series> seriess = result.getSeries();
|
||||
if (seriess == null || seriess.isEmpty()) {
|
||||
return retList;
|
||||
}
|
||||
QueryResult.Series series = seriess.get(0);
|
||||
List<List<Object>> values = series.getValues();
|
||||
for (List<Object> columnValue : values) {
|
||||
retList = BigDecimal.valueOf(Float.parseFloat(columnValue.get(1).toString())).setScale(4, BigDecimal.ROUND_HALF_UP).floatValue();
|
||||
}
|
||||
return retList;
|
||||
}
|
||||
|
||||
public Integer getSarfiCount(String startTime, String endTime, Float fvalue, String id) {
|
||||
Integer retList = 0;
|
||||
//组装sql语句
|
||||
StringBuilder stringBuilder = new StringBuilder();
|
||||
stringBuilder.append("time >= '").append(DateUtil.beginOfDay(DateUtil.parse(startTime))).append("' and ").append("time <= '").append(DateUtil.endOfDay(DateUtil.parse(endTime))).append("' and ");
|
||||
stringBuilder.append("line_id = '").append(id).append("'").append(" and event_value <=").append(fvalue).append(" and persist_time<6000").append(InfluxDBPublicParam.TIME_ZONE);
|
||||
String sql = "select count(*) from " + InfluxDBPublicParam.PQS_EVENT_DETAIL + " where " + stringBuilder.toString();
|
||||
QueryResult queryResult = influxDbUtils.query(sql);
|
||||
List<QueryResult.Result> results = queryResult.getResults();
|
||||
if (results == null || results.isEmpty()) {
|
||||
return retList;
|
||||
}
|
||||
QueryResult.Result result = results.get(0);
|
||||
List<QueryResult.Series> seriess = result.getSeries();
|
||||
if (seriess == null || seriess.isEmpty()) {
|
||||
return retList;
|
||||
}
|
||||
QueryResult.Series series = seriess.get(0);
|
||||
List<List<Object>> values = series.getValues();
|
||||
for (List<Object> columnValue : values) {
|
||||
retList = (Integer) columnValue.get(1);
|
||||
}
|
||||
return retList;
|
||||
}
|
||||
|
||||
public List<EventDetail> getEventDetailInfo(String id, Float fvalue, String startTime, String endTime) {
|
||||
//组装sql语句
|
||||
StringBuilder stringBuilder = new StringBuilder();
|
||||
stringBuilder.append("time >= '").append(DateUtil.beginOfDay(DateUtil.parse(startTime))).append("' and ").append("time <= '").append(DateUtil.endOfDay(DateUtil.parse(endTime))).append("' and ");
|
||||
//sql语句
|
||||
stringBuilder.append("line_id ='").append(id).append("'").append(" and event_value <=").append(fvalue).append(" and persist_time < 60000").append(" tz('Asia/Shanghai')");
|
||||
|
||||
String sql = "select * from pqs_eventdetail where " + stringBuilder;
|
||||
//获取暂降事件
|
||||
QueryResult result = influxDbUtils.query(sql);
|
||||
InfluxDBResultMapper influxDBResultMapper = new InfluxDBResultMapper();
|
||||
List<EventDetail> eventDetailList = influxDBResultMapper.toPOJO(result, EventDetail.class);
|
||||
return eventDetailList;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,6 +20,7 @@ import com.njcn.event.pojo.vo.VoltageLevelCalculationVO;
|
||||
import com.njcn.event.service.AreaStatisticalService;
|
||||
import com.njcn.system.pojo.enums.StatisticsEnum;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.influxdb.querybuilder.clauses.Clause;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
@@ -30,6 +31,7 @@ import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import static com.njcn.event.influxdb.PqsEventDetailQuery.*;
|
||||
import static org.influxdb.querybuilder.BuiltQuery.QueryBuilder.ne;
|
||||
|
||||
/**
|
||||
* 区域统计
|
||||
@@ -42,9 +44,9 @@ import static com.njcn.event.influxdb.PqsEventDetailQuery.*;
|
||||
@RequiredArgsConstructor
|
||||
public class AreaStatisticalServiceImpl implements AreaStatisticalService {
|
||||
private final GeneralDeviceInfoClient generalDeviceInfoClient;
|
||||
|
||||
|
||||
private final PqsEventDetailQuery pqsEventDetailQuery;
|
||||
|
||||
|
||||
/**
|
||||
* 获取暂降区域 电压等级 月份统计
|
||||
*
|
||||
@@ -62,26 +64,27 @@ public class AreaStatisticalServiceImpl implements AreaStatisticalService {
|
||||
if (CollUtil.isEmpty(lineIds)) {
|
||||
return AreaStatisticalVO.empty();
|
||||
}
|
||||
|
||||
|
||||
List<Clause> clauseList = new ArrayList<>(timeAnd(beginOfDay(deviceInfoParam.getSearchBeginTime()), endOfDay(deviceInfoParam.getSearchEndTime())));
|
||||
clauseList.add(ne("wave_type",5));
|
||||
List<EventDetail> eventDetailList = pqsEventDetailQuery.selectList(Arrays.asList("line_id", "eventass_index"),
|
||||
lineIdOr(lineIds),
|
||||
timeAnd(beginOfDay(deviceInfoParam.getSearchBeginTime()), endOfDay(deviceInfoParam.getSearchEndTime())));
|
||||
lineIdOr(lineIds),clauseList);
|
||||
if (CollUtil.isEmpty(eventDetailList)) {
|
||||
return AreaStatisticalVO.empty();
|
||||
}
|
||||
|
||||
|
||||
AreaStatisticsVO areaStatisticsVO = statisticsAreaInfo(generalDeviceDTOList, eventDetailList);
|
||||
|
||||
|
||||
MonthlyStatisticsVO monthCalculationVOS = statisticsMonthInfo(deviceInfoParam, eventDetailList);
|
||||
|
||||
|
||||
|
||||
|
||||
deviceInfoParam.getStatisticalType().setCode(StatisticsEnum.VOLTAGE_LEVEL.getCode());
|
||||
List<GeneralDeviceDTO> voltageLevelList = generalDeviceInfoClient.getPracticalAllDeviceInfo(deviceInfoParam).getData();
|
||||
VoltageStatisticsVO voltageStatisticsVO = statisticalVoltageLevelInfo(voltageLevelList, eventDetailList);
|
||||
|
||||
|
||||
return AreaStatisticalVO.buildVO(areaStatisticsVO, voltageStatisticsVO, monthCalculationVOS);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 统计月份信息
|
||||
*
|
||||
@@ -91,34 +94,49 @@ public class AreaStatisticalServiceImpl implements AreaStatisticalService {
|
||||
*/
|
||||
private MonthlyStatisticsVO statisticsMonthInfo(DeviceInfoParam.BusinessParam deviceInfoParam, List<EventDetail> eventDetailList) {
|
||||
List<DateTime> timeLimit = calculateTheTimePeriodRange(deviceInfoParam);
|
||||
List<DateTime> monthStartAndEnd = calculateMonthStartAndEnd(timeLimit);
|
||||
|
||||
List<DateTime> monthStartAndEnd = new ArrayList<>();
|
||||
if(deviceInfoParam.getTimeFlag()==0){
|
||||
//月
|
||||
monthStartAndEnd = calculateMonthStartAndEnd(timeLimit,0);
|
||||
}else {
|
||||
//天
|
||||
monthStartAndEnd = calculateMonthStartAndEnd(timeLimit,1);
|
||||
}
|
||||
|
||||
|
||||
List<MonthCalculationVO> monthCalculationVOList = new ArrayList<>(monthStartAndEnd.size());
|
||||
MonthCalculationVO monthCalculationVO;
|
||||
for (int i = 0; i < monthStartAndEnd.size(); i += 2) {
|
||||
DateTime beginMon = monthStartAndEnd.get(i);
|
||||
DateTime endMon = monthStartAndEnd.get(i + 1);
|
||||
|
||||
|
||||
List<EventDetail> eventDetails = getBetweenTimeEventDetailList(eventDetailList).apply(beginMon, endMon);
|
||||
|
||||
|
||||
// 时间段内总记录数
|
||||
Long count = (long) eventDetails.size();
|
||||
|
||||
|
||||
// 时间段内非空记录数,剔除等于空的
|
||||
Long linkedCount = countEventassIndexIsNoEmpty().apply(eventDetails);
|
||||
|
||||
|
||||
|
||||
monthCalculationVO = new MonthCalculationVO();
|
||||
monthCalculationVO.setMonth(beginMon.toDateStr().substring(0, 7));
|
||||
if(deviceInfoParam.getTimeFlag()==0){
|
||||
//月
|
||||
monthCalculationVO.setMonth(beginMon.toDateStr().substring(0, 7));
|
||||
}else {
|
||||
//日
|
||||
monthCalculationVO.setMonth(beginMon.toDateStr());
|
||||
}
|
||||
monthCalculationVO.setNotAssociated(count - linkedCount);
|
||||
monthCalculationVO.setLinked(linkedCount);
|
||||
|
||||
|
||||
monthCalculationVOList.add(monthCalculationVO);
|
||||
}
|
||||
Long notAssociatedSum = monthCalculationVOList.stream().mapToLong(MonthCalculationVO::getNotAssociated).sum();
|
||||
|
||||
|
||||
return MonthlyStatisticsVO.buildVO(notAssociatedSum, monthCalculationVOList);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 统计电压等级信息
|
||||
*
|
||||
@@ -134,14 +152,14 @@ public class AreaStatisticalServiceImpl implements AreaStatisticalService {
|
||||
voltageLevelCalculationVO.setFrequency(countLineIndexes(eventDetailList).apply(t.getLineIndexes()));
|
||||
return voltageLevelCalculationVO;
|
||||
}).collect(Collectors.toCollection(() -> Collections.synchronizedList(new ArrayList<>())));
|
||||
|
||||
|
||||
// 求和暂降次数
|
||||
Long frequencySum = voltageLevelCalculation.stream().mapToLong(VoltageLevelCalculationVO::getFrequency).sum();
|
||||
// 求装置数量
|
||||
Integer monitoringPointSum = voltageLevelCalculation.stream().mapToInt(VoltageLevelCalculationVO::getMonitoringPoints).sum();
|
||||
return VoltageStatisticsVO.buildVO(frequencySum, monitoringPointSum, voltageLevelCalculation);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 统计区域信息
|
||||
*
|
||||
@@ -154,35 +172,47 @@ public class AreaStatisticalServiceImpl implements AreaStatisticalService {
|
||||
AreaCalculationVO calculationVO = new AreaCalculationVO();
|
||||
calculationVO.setAreaName(t.getName());
|
||||
calculationVO.setMonitoringPoints(t.getLineIndexes().size());
|
||||
|
||||
|
||||
calculationVO.setFrequency(countLineIndexes(eventDetailList).apply(t.getLineIndexes()));
|
||||
|
||||
|
||||
calculationVO.computeSarfi90();
|
||||
return calculationVO;
|
||||
}).sorted(AreaCalculationVO.sortAscAreaName()).collect(Collectors.toCollection(() -> Collections.synchronizedList(new ArrayList<>())));
|
||||
|
||||
|
||||
// 求和暂降次数
|
||||
Long frequencySum = areaCalculation.stream().mapToLong(AreaCalculationVO::getFrequency).sum();
|
||||
// 求装置数量
|
||||
Integer monitoringPointSum = areaCalculation.stream().mapToInt(AreaCalculationVO::getMonitoringPoints).sum();
|
||||
|
||||
|
||||
return AreaStatisticsVO.buildVO(frequencySum, monitoringPointSum, areaCalculation);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 计算出月的开始时间和结束时间
|
||||
*
|
||||
* @param timeLimit 查询参数
|
||||
* @param timeFlag 0.月 1.天
|
||||
* @return 月的开始时间和结束时间
|
||||
*/
|
||||
private List<DateTime> calculateMonthStartAndEnd(List<DateTime> timeLimit) {
|
||||
return timeLimit.stream().flatMap(dateTime -> {
|
||||
DateTime dateTime1 = DateUtil.beginOfMonth(dateTime);
|
||||
DateTime dateTime2 = DateUtil.endOfMonth(dateTime);
|
||||
return Stream.of(dateTime1, dateTime2);
|
||||
}).collect(Collectors.toList());
|
||||
private List<DateTime> calculateMonthStartAndEnd(List<DateTime> timeLimit,Integer timeFlag) {
|
||||
|
||||
if(timeFlag == 0){
|
||||
return timeLimit.stream().flatMap(dateTime -> {
|
||||
DateTime dateTime1 = DateUtil.beginOfMonth(dateTime);
|
||||
DateTime dateTime2 = DateUtil.endOfMonth(dateTime);
|
||||
return Stream.of(dateTime1, dateTime2);
|
||||
}).collect(Collectors.toList());
|
||||
}else {
|
||||
return timeLimit.stream().flatMap(dateTime -> {
|
||||
DateTime dateTime1 = DateUtil.beginOfDay(dateTime);
|
||||
DateTime dateTime2 = DateUtil.endOfDay(dateTime);
|
||||
return Stream.of(dateTime1, dateTime2);
|
||||
}).collect(Collectors.toList());
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 根据开始时间结束时间, 获取时间年月范围
|
||||
*
|
||||
@@ -190,9 +220,18 @@ public class AreaStatisticalServiceImpl implements AreaStatisticalService {
|
||||
* @return 获取时间年月范围
|
||||
*/
|
||||
private List<DateTime> calculateTheTimePeriodRange(DeviceInfoParam.BusinessParam deviceInfoParam) {
|
||||
DateTime beginTime = DateUtil.parse(deviceInfoParam.getSearchBeginTime(), DatePattern.NORM_DATE_PATTERN);
|
||||
DateTime endTime = DateUtil.parse(deviceInfoParam.getSearchEndTime(), DatePattern.NORM_DATE_PATTERN);
|
||||
return DateUtil.rangeToList(beginTime, endTime, DateField.MONTH);
|
||||
if(deviceInfoParam.getTimeFlag() == 0){
|
||||
//月
|
||||
DateTime beginTime = DateUtil.parse(deviceInfoParam.getSearchBeginTime(), DatePattern.NORM_DATE_PATTERN);
|
||||
DateTime endTime = DateUtil.parse(deviceInfoParam.getSearchEndTime(), DatePattern.NORM_DATE_PATTERN);
|
||||
return DateUtil.rangeToList(beginTime, endTime, DateField.MONTH);
|
||||
}else {
|
||||
DateTime beginTime = DateUtil.parse(deviceInfoParam.getSearchBeginTime(), DatePattern.NORM_DATE_PATTERN);
|
||||
DateTime endTime = DateUtil.parse(deviceInfoParam.getSearchEndTime(), DatePattern.NORM_DATE_PATTERN);
|
||||
return DateUtil.rangeToList(beginTime, endTime, DateField.DAY_OF_MONTH);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,8 +1,12 @@
|
||||
package com.njcn.event.service.Impl;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.db.Page;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.njcn.event.pojo.po.EventDetail;
|
||||
import com.njcn.event.service.EventDetailService;
|
||||
import com.njcn.influxdb.param.InfluxDBPublicParam;
|
||||
import com.njcn.influxdb.utils.InfluxDBCommUtils;
|
||||
import com.njcn.influxdb.utils.InfluxDbUtils;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
@@ -110,7 +114,6 @@ public class EventDetailServiceImpl implements EventDetailService {
|
||||
InfluxDBResultMapper influxDBResultMapper = new InfluxDBResultMapper();
|
||||
List<EventDetail> eventDetailList = influxDBResultMapper.toPOJO(result, EventDetail.class);
|
||||
|
||||
|
||||
return eventDetailList;
|
||||
}
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -1,5 +1,8 @@
|
||||
package com.njcn.event.service.Impl;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.njcn.common.config.GeneralInfo;
|
||||
import com.njcn.common.pojo.dto.wave.WaveDataDTO;
|
||||
@@ -10,17 +13,29 @@ import com.njcn.common.utils.wave.AnalyWave;
|
||||
import com.njcn.device.api.GeneralDeviceInfoClient;
|
||||
import com.njcn.device.api.LineFeignClient;
|
||||
import com.njcn.device.pojo.dto.GeneralDeviceDTO;
|
||||
import com.njcn.device.pojo.vo.AreaLineInfoVO;
|
||||
import com.njcn.device.pojo.vo.LineDetailDataVO;
|
||||
import com.njcn.event.config.EventBaseConfig;
|
||||
import com.njcn.event.enums.EventResponseEnum;
|
||||
import com.njcn.event.mapper.TransientMapper;
|
||||
import com.njcn.event.pojo.param.TransientParam;
|
||||
import com.njcn.event.pojo.param.WaveFileParam;
|
||||
import com.njcn.event.pojo.po.EventDetail;
|
||||
import com.njcn.event.pojo.po.EventDetailNew;
|
||||
import com.njcn.event.pojo.vo.AreaLineVO;
|
||||
import com.njcn.event.pojo.vo.TransientVO;
|
||||
import com.njcn.event.service.EventDetailService;
|
||||
import com.njcn.event.service.TransientService;
|
||||
import com.njcn.influxdb.mapper.InfluxDBResultMapperCn;
|
||||
import com.njcn.influxdb.param.InfluxDBPublicParam;
|
||||
import com.njcn.influxdb.utils.InfluxDBCommUtils;
|
||||
import com.njcn.influxdb.utils.InfluxDbUtils;
|
||||
import com.njcn.system.api.DicDataFeignClient;
|
||||
import com.njcn.system.enums.DicDataTypeEnum;
|
||||
import com.njcn.system.pojo.po.DictData;
|
||||
import io.swagger.models.auth.In;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.influxdb.dto.QueryResult;
|
||||
import org.influxdb.impl.InfluxDBResultMapper;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
@@ -52,12 +67,16 @@ public class TransientServiceImpl implements TransientService {
|
||||
|
||||
private final LineFeignClient lineFeignClient;
|
||||
|
||||
private final DicDataFeignClient dicDataFeignClient;
|
||||
|
||||
private final TransientMapper transientMapper;
|
||||
|
||||
private final EventDetailService eventDetailService;
|
||||
|
||||
private final GeneralInfo generalInfo;
|
||||
|
||||
private final InfluxDbUtils influxDbUtils;
|
||||
|
||||
@Override
|
||||
public Page<TransientVO> getTransientData(TransientParam transientParam) {
|
||||
Page<TransientVO> page = new Page<>();
|
||||
@@ -117,7 +136,7 @@ public class TransientServiceImpl implements TransientService {
|
||||
transientVO.setTrigType("暂降");
|
||||
break;
|
||||
case 2:
|
||||
transientVO.setTrigType("赞升");
|
||||
transientVO.setTrigType("暂升");
|
||||
break;
|
||||
case 3:
|
||||
transientVO.setTrigType("中断");
|
||||
@@ -231,6 +250,187 @@ public class TransientServiceImpl implements TransientService {
|
||||
return response;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Page<EventDetailNew> getTransientValue(TransientParam transientParam){
|
||||
Page<EventDetailNew> page = new Page<>();
|
||||
page.setSize(transientParam.getPageSize());
|
||||
page.setCurrent(transientParam.getPageNum());
|
||||
//List<TransientVO> transientVos = new ArrayList<>();
|
||||
//transientParam.setServerName(ServerEnum.HARMONIC.getName());
|
||||
//按部门分类的实际运行终端综合信息
|
||||
List<GeneralDeviceDTO> generalDeviceDTOList = generalDeviceInfoClient.getPracticalRunDeviceInfo(transientParam).getData();
|
||||
if (!CollectionUtils.isEmpty(generalDeviceDTOList)) {
|
||||
//获取按终端分类的监测点索引集合
|
||||
List<String> lineList = generalDeviceDTOList.stream().flatMap(dto -> dto.getLineIndexes().stream()).collect(Collectors.toList());
|
||||
|
||||
if (!CollectionUtils.isEmpty(lineList)) {
|
||||
StringBuilder stringBuilder = InfluxDBCommUtils.assToInfluxParam(lineList);
|
||||
//influxDB查询待分页数据总量
|
||||
Long total = getTransientDetail(stringBuilder,transientParam);
|
||||
page.setTotal(total);
|
||||
//分页总页数
|
||||
int pages = (int) Math.ceil(transientParam.getPageNum() * 1.0 / transientParam.getPageSize());
|
||||
page.setPages(pages);
|
||||
//influxDB分页查询
|
||||
List<EventDetailNew> eventDetailData = getTransientDetailLimit(lineList, transientParam);
|
||||
|
||||
if (CollUtil.isNotEmpty(eventDetailData)) {
|
||||
List<String> lineIds = eventDetailData.stream().map(EventDetailNew::getLineId).collect(Collectors.toList());
|
||||
lineIds = lineIds.stream().distinct().collect(Collectors.toList());
|
||||
|
||||
List<AreaLineInfoVO> r = lineFeignClient.getBaseLineAreaInfo(lineIds).getData();
|
||||
List<DictData> reasonList = dicDataFeignClient.getDicDataByTypeName(DicDataTypeEnum.EVENT_REASON.getName()).getData();
|
||||
List<DictData> typeList = dicDataFeignClient.getDicDataByTypeName(DicDataTypeEnum.EVENT_TYPE.getName()).getData();
|
||||
|
||||
//List<TransientVO> transientData = transientMapper.getTransientData(lineIds);
|
||||
for (EventDetailNew eventDetail : eventDetailData) {
|
||||
for(AreaLineInfoVO areaLineInfoVO : r){
|
||||
if(eventDetail.getLineId().equals(areaLineInfoVO.getLineId())){
|
||||
eventDetail.setLineId(areaLineInfoVO.getLineId());
|
||||
eventDetail.setLineName(areaLineInfoVO.getLineName());
|
||||
eventDetail.setGdName(areaLineInfoVO.getGdName());
|
||||
eventDetail.setSubName(areaLineInfoVO.getSubName());
|
||||
eventDetail.setIp(areaLineInfoVO.getIp());
|
||||
eventDetail.setScale(areaLineInfoVO.getVoltageScale());
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
for (DictData dictData : reasonList) {
|
||||
if (eventDetail.getEventReason().equals(dictData.getId())) {
|
||||
eventDetail.setEventReason(dictData.getName());
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
for (DictData dictData : typeList) {
|
||||
if (eventDetail.getEventType().equals(dictData.getId())) {
|
||||
eventDetail.setEventType(dictData.getName());
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//当前页数据
|
||||
page.setRecords(eventDetailData);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
return page;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询数据库
|
||||
*/
|
||||
private Long getTransientDetail(StringBuilder stringBuilder,TransientParam transientParam) {
|
||||
Long total = 0L;
|
||||
//组装sql语句
|
||||
stringBuilder.append(" and time >= '").append(DateUtil.beginOfDay(DateUtil.parse(transientParam.getSearchBeginTime()))).append("' and ").append("time <= '").append(DateUtil.endOfDay(DateUtil.parse(transientParam.getSearchEndTime()))).append("'").append(InfluxDBPublicParam.TIME_ZONE);
|
||||
//sql语句
|
||||
String sql = "SELECT count(wave_type) FROM pqs_eventdetail WHERE " + stringBuilder;
|
||||
System.out.println("sql------------->>>"+sql);
|
||||
//结果集
|
||||
QueryResult result = influxDbUtils.query(sql);
|
||||
//结果集映射到对象中
|
||||
List<QueryResult.Series> series = result.getResults().get(0).getSeries();
|
||||
if(CollUtil.isNotEmpty(series)){
|
||||
Double tem =(Double)series.get(0).getValues().get(0).get(1);
|
||||
total = tem.longValue();
|
||||
}
|
||||
return total;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据条件拼接sql语句
|
||||
*/
|
||||
private List<EventDetailNew> getTransientDetailLimit(List<String> lineIndexes, TransientParam transientParam) {
|
||||
//查询数据是否为空,不为空拼接sql语句
|
||||
StringBuilder querySql = new StringBuilder();
|
||||
if(Objects.nonNull(transientParam.getEventValueMin())){
|
||||
querySql.append(" and event_value >=").append(transientParam.getEventValueMin());
|
||||
}
|
||||
if(Objects.nonNull(transientParam.getEventValueMax())){
|
||||
querySql.append(" and event_value <=").append(transientParam.getEventValueMax());
|
||||
}
|
||||
|
||||
if(Objects.nonNull(transientParam.getPersistMin())){
|
||||
querySql.append(" and persist_time >=").append(transientParam.getPersistMin());
|
||||
}
|
||||
if(Objects.nonNull(transientParam.getEventValueMax())){
|
||||
querySql.append(" and persist_time <=").append(transientParam.getPersistMax());
|
||||
}
|
||||
|
||||
if(Objects.nonNull(transientParam.getSeverityMin())){
|
||||
querySql.append(" and severity >=").append(transientParam.getSeverityMin());
|
||||
}
|
||||
if(Objects.nonNull(transientParam.getSeverityMax())){
|
||||
querySql.append(" and severity <=").append(transientParam.getSeverityMax());
|
||||
}
|
||||
if(Objects.nonNull(transientParam.getFileFlag())){
|
||||
querySql.append(" and file_flag = ").append(transientParam.getFileFlag());
|
||||
}
|
||||
|
||||
if(CollUtil.isNotEmpty(transientParam.getWaveType())) {
|
||||
querySql.append(" and ( ");
|
||||
for (int i = 0; i < transientParam.getWaveType().size(); i++) {
|
||||
if (transientParam.getWaveType().size() - i != 1) {
|
||||
querySql.append("wave_type =").append(transientParam.getWaveType().get(i)).append(" or ");
|
||||
} else {
|
||||
querySql.append("wave_type =").append(transientParam.getWaveType().get(i)).append(") ");
|
||||
}
|
||||
}
|
||||
}
|
||||
if(CollUtil.isNotEmpty(transientParam.getEventReason())) {
|
||||
querySql.append(" and ( ");
|
||||
for (int i = 0; i < transientParam.getEventReason().size(); i++) {
|
||||
if (transientParam.getWaveType().size() - i != 1) {
|
||||
querySql.append("event_reason =").append(transientParam.getEventReason().get(i)).append(" or ");
|
||||
} else {
|
||||
querySql.append("event_reason =").append(transientParam.getEventReason().get(i)).append(") ");
|
||||
}
|
||||
}
|
||||
}
|
||||
if(CollUtil.isNotEmpty(transientParam.getEventType())) {
|
||||
querySql.append(" and ( ");
|
||||
for (int i = 0; i < transientParam.getEventType().size(); i++) {
|
||||
if (transientParam.getEventType().size() - i != 1) {
|
||||
querySql.append("event_type =").append(transientParam.getEventType().get(i)).append(" or ");
|
||||
} else {
|
||||
querySql.append("event_type =").append(transientParam.getEventType().get(i)).append(") ");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//组装sql语句
|
||||
StringBuilder stringBuilder = new StringBuilder();
|
||||
stringBuilder.append("time >= '").append(DateUtil.beginOfDay(DateUtil.parse(transientParam.getSearchBeginTime())))
|
||||
.append("' and ").append("time <= '").append(DateUtil.endOfDay(DateUtil.parse(transientParam.getSearchEndTime()))).append("'")
|
||||
.append(querySql);
|
||||
stringBuilder.append(" and (");
|
||||
for (int i = 0; i < lineIndexes.size(); i++) {
|
||||
if (lineIndexes.size() - i != 1) {
|
||||
stringBuilder.append("line_id ='").append(lineIndexes.get(i)).append("' or ");
|
||||
} else {
|
||||
stringBuilder.append("line_id ='").append(lineIndexes.get(i)).append("') ");
|
||||
}
|
||||
}
|
||||
int i = (transientParam.getPageNum() - 1)*transientParam.getPageSize();
|
||||
stringBuilder.append("LIMIT ").append(transientParam.getPageSize()).append(" OFFSET ").append(i).append(" tz('Asia/Shanghai')");
|
||||
//sql语句
|
||||
String sql = "SELECT * FROM pqs_eventdetail WHERE " + stringBuilder;
|
||||
System.out.println("sql====================="+sql);
|
||||
//结果集
|
||||
QueryResult queryresult = influxDbUtils.query(sql);
|
||||
//结果集映射到对象中
|
||||
InfluxDBResultMapperCn influxDBResultMapper = new InfluxDBResultMapperCn();
|
||||
List<EventDetailNew> eventDetailList = influxDBResultMapper.toPOJO(queryresult, EventDetailNew.class);
|
||||
|
||||
return eventDetailList;
|
||||
}
|
||||
|
||||
/**
|
||||
* 复制保存文件
|
||||
*/
|
||||
@@ -459,7 +659,7 @@ public class TransientServiceImpl implements TransientService {
|
||||
try {
|
||||
String filePath = filePathAndName;
|
||||
filePath = filePath.toString();
|
||||
java.io.File myDelFile = new java.io.File(filePath);
|
||||
File myDelFile = new File(filePath);
|
||||
myDelFile.delete();
|
||||
} catch (Exception e) {
|
||||
System.out.println("删除文件操作出错");
|
||||
|
||||
@@ -0,0 +1,61 @@
|
||||
package com.njcn.event.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.njcn.device.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 freemarker.template.TemplateException;
|
||||
import org.apache.poi.openxml4j.exceptions.InvalidFormatException;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.IOException;
|
||||
import java.text.ParseException;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author xxy
|
||||
* @version 1.0.0
|
||||
* @date 2022年07月28日 13:32
|
||||
*/
|
||||
public interface ReportService {
|
||||
|
||||
List<GeneralVO> getGeneralSituation(DeviceInfoParam.BusinessParam businessParam);
|
||||
|
||||
List<GeneralVO> getVoltage(DeviceInfoParam.BusinessParam businessParam);
|
||||
|
||||
List<WaveTypeVO> getSeverity(DeviceInfoParam.BusinessParam businessParam);
|
||||
|
||||
List<ReasonsVO> getReason(DeviceInfoParam.BusinessParam businessParam);
|
||||
|
||||
Page<DetailVO> getContinueTime(WaveTypeParam waveTypeParam);
|
||||
|
||||
Page<DetailVO> getSagTimes(WaveTypeParam waveTypeParam);
|
||||
|
||||
Page<DetailVO> getUpTimes(WaveTypeParam waveTypeParam);
|
||||
|
||||
Page<DetailVO> getBreakTimes(WaveTypeParam waveTypeParam);
|
||||
|
||||
void getExport(DeviceInfoParam.BusinessParam businessParam, HttpServletResponse response) throws IOException, TemplateException;
|
||||
|
||||
void getLineExport(ExportParam exportParam, HttpServletResponse response) throws InvalidFormatException, IOException, TemplateException, ParseException;
|
||||
|
||||
/**
|
||||
*获取事件报告
|
||||
* @author zbj
|
||||
* @date 2022/7/29
|
||||
*/
|
||||
Page<WaveTypeVO> getEventReport(WaveTypeParam deviceInfoParam);
|
||||
|
||||
/**
|
||||
*获取区域报告
|
||||
* @author zbj
|
||||
* @date 2022/8/4
|
||||
*/
|
||||
void getAreaReport(AreaReportParam areaReportParam, HttpServletResponse response) throws Exception;
|
||||
|
||||
|
||||
}
|
||||
@@ -4,9 +4,12 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.njcn.common.pojo.dto.wave.WaveDataDTO;
|
||||
import com.njcn.event.pojo.param.TransientParam;
|
||||
import com.njcn.event.pojo.param.WaveFileParam;
|
||||
import com.njcn.event.pojo.po.EventDetail;
|
||||
import com.njcn.event.pojo.po.EventDetailNew;
|
||||
import com.njcn.event.pojo.vo.TransientVO;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author: chenchao
|
||||
@@ -34,5 +37,10 @@ public interface TransientService {
|
||||
* @return
|
||||
*/
|
||||
HttpServletResponse downloadWaveFile(WaveFileParam waveFileParam, HttpServletResponse response) throws Exception;
|
||||
|
||||
/**
|
||||
* 功能描述: 根据条件查询暂态事件
|
||||
* @param transientParam
|
||||
* @return
|
||||
*/
|
||||
Page<EventDetailNew> getTransientValue(TransientParam transientParam);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,86 @@
|
||||
<#--区域统计和电压等级共用模板-->
|
||||
{
|
||||
title: {
|
||||
text: '设备运行情况',
|
||||
left:'center',
|
||||
subtext:'${subtext}',
|
||||
},
|
||||
tooltip: {
|
||||
trigger: 'axis',
|
||||
axisPointer: {
|
||||
type: 'shadow'
|
||||
}
|
||||
},
|
||||
legend: {
|
||||
data: ['在线', '离线',],
|
||||
left: '10%',
|
||||
top:'5%',
|
||||
textStyle: {
|
||||
color: "#666666"
|
||||
},
|
||||
itemWidth: 15,
|
||||
itemHeight: 10,
|
||||
itemGap: 25
|
||||
},
|
||||
grid: {
|
||||
left: '3%',
|
||||
right: '8%',
|
||||
bottom: '5%',
|
||||
top: '20%',
|
||||
containLabel: true
|
||||
},
|
||||
xAxis: {
|
||||
name: '${xname}',
|
||||
nameTextStyle: {
|
||||
color: '#666666',
|
||||
},
|
||||
type: 'category',
|
||||
data: ${area}
|
||||
},
|
||||
yAxis: {
|
||||
name: '(个)',
|
||||
nameTextStyle: {
|
||||
color: '#666666',
|
||||
},
|
||||
type: 'value',
|
||||
axisLine: { show: true, lineStyle: { color: '#666666' } },
|
||||
axisLabel: { color: '#666666' },
|
||||
splitLine: { lineStyle: { color: ['#ccc'], type: [5, 8], dashOffset: 3 } },
|
||||
},
|
||||
series: [
|
||||
{
|
||||
name: '在线',
|
||||
type: 'bar',
|
||||
stack: 'account',
|
||||
barWidth: 20,
|
||||
label: {
|
||||
show: true,
|
||||
color:'purple',
|
||||
verticalAlign: 'middle',
|
||||
rotate: 0,
|
||||
fontSize: 12,
|
||||
},
|
||||
color:'green',
|
||||
itemStyle: {
|
||||
},
|
||||
data: ${onlineData}
|
||||
},
|
||||
{
|
||||
name: '离线',
|
||||
type: 'bar',
|
||||
stack: 'account',
|
||||
barWidth: 20,
|
||||
label: {
|
||||
show: true,
|
||||
color:'purple',
|
||||
verticalAlign: 'middle',
|
||||
rotate: 0,
|
||||
fontSize: 12,
|
||||
},
|
||||
color:'orange',
|
||||
itemStyle: {
|
||||
},
|
||||
data: ${offlineData}
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,103 @@
|
||||
<#--区域和电压等级统计次数共用模板-->
|
||||
{
|
||||
title: {
|
||||
text: '暂态事件次数',
|
||||
left:'center',
|
||||
subtext:'${subtext}',
|
||||
},
|
||||
tooltip: {
|
||||
trigger: 'axis',
|
||||
axisPointer: {
|
||||
type: 'shadow'
|
||||
}
|
||||
},
|
||||
legend: {
|
||||
data: ['暂降次数', '中断次数', '暂升次数'],
|
||||
left: '7%',
|
||||
top:'5%',
|
||||
textStyle: {
|
||||
color: "#666666"
|
||||
},
|
||||
itemWidth: 10,
|
||||
itemHeight: 10,
|
||||
itemGap: 15
|
||||
},
|
||||
grid: {
|
||||
left: '3%',
|
||||
right: '8%',
|
||||
bottom: '5%',
|
||||
top: '20%',
|
||||
containLabel: true
|
||||
},
|
||||
xAxis: {
|
||||
name: '${xname}',
|
||||
nameTextStyle: {
|
||||
color: '#666666',
|
||||
},
|
||||
type: 'category',
|
||||
data: ${area}
|
||||
},
|
||||
yAxis: {
|
||||
name: '(次)',
|
||||
nameTextStyle: {
|
||||
color: '#666666',
|
||||
},
|
||||
type: 'value',
|
||||
axisLine: { show: true, lineStyle: { color: '#666666' } },
|
||||
axisLabel: { color: '#666666' },
|
||||
splitLine: { lineStyle: { color: ['#ccc'], type: [5, 8], dashOffset: 3 } },
|
||||
},
|
||||
series: [
|
||||
{
|
||||
name: '暂降次数',
|
||||
type: 'bar',
|
||||
stack: 'account',
|
||||
barWidth: 20,
|
||||
label: {
|
||||
show: true,
|
||||
color:'purple',
|
||||
verticalAlign: 'middle',
|
||||
rotate: 0,
|
||||
fontSize: 12,
|
||||
},
|
||||
color:'#ff9966',
|
||||
itemStyle: {
|
||||
},
|
||||
data: ${sag}
|
||||
},
|
||||
{
|
||||
name: '中断次数',
|
||||
type: 'bar',
|
||||
stack: 'account',
|
||||
barWidth: 20,
|
||||
label: {
|
||||
show: true,
|
||||
color:'purple',
|
||||
verticalAlign: 'middle',
|
||||
rotate: 0,
|
||||
fontSize: 12,
|
||||
},
|
||||
color:'#00dd00',
|
||||
itemStyle: {
|
||||
},
|
||||
data: ${break}
|
||||
},
|
||||
{
|
||||
name: '暂升次数',
|
||||
type: 'bar',
|
||||
stack: 'account',
|
||||
barWidth: 20,
|
||||
label: {
|
||||
show: true,
|
||||
color:'purple',
|
||||
verticalAlign: 'middle',
|
||||
rotate: 0,
|
||||
fontSize: 12,
|
||||
},
|
||||
color:'#0066ff',
|
||||
itemStyle: {
|
||||
},
|
||||
data: ${up}
|
||||
},
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,85 @@
|
||||
<#--ITIC曲线专用-->
|
||||
{
|
||||
backgroundColor: "#FFF",
|
||||
title: {
|
||||
text: "ITIC曲线",
|
||||
x: "center",
|
||||
},
|
||||
grid: {
|
||||
left: "4%",
|
||||
right: "2%",
|
||||
bottom: "10%",
|
||||
},
|
||||
legend: {
|
||||
data: ["上限", "下限", "可容忍事件", "不可容忍事件"],
|
||||
x: "left",
|
||||
},
|
||||
color: ["#FF8C00", "#00BFFF", "green", "red"],
|
||||
xAxis: [
|
||||
{
|
||||
type: "log",
|
||||
min: "0.001",
|
||||
max: "1000",
|
||||
splitLine: {
|
||||
show: false,
|
||||
},
|
||||
name: "s",
|
||||
},
|
||||
],
|
||||
yAxis: [
|
||||
{
|
||||
type: "value",
|
||||
splitNumber: 10,
|
||||
minInterval: 3,
|
||||
name: "%"
|
||||
},
|
||||
],
|
||||
series: [
|
||||
{
|
||||
name: "上限",
|
||||
type: "line",
|
||||
data: [
|
||||
[0.001, 200],
|
||||
[0.003, 140],
|
||||
[0.003, 120],
|
||||
[0.5, 120],
|
||||
[0.5, 110],
|
||||
[10, 110],
|
||||
[1000, 110]
|
||||
],
|
||||
showSymbol: false,
|
||||
tooltips: {
|
||||
show: false
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "下限",
|
||||
type: "line",
|
||||
data: [
|
||||
[0.02, 0],
|
||||
[0.02, 70],
|
||||
[0.5, 70],
|
||||
[0.5, 80],
|
||||
[10, 80],
|
||||
[10, 90],
|
||||
[1000, 90]
|
||||
],
|
||||
showSymbol: false,
|
||||
tooltips: {
|
||||
show: false
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "可容忍事件",
|
||||
type: "scatter",
|
||||
symbol: "circle",
|
||||
data: ${point}
|
||||
},
|
||||
{
|
||||
name: "不可容忍事件",
|
||||
type: "scatter",
|
||||
symbol: "circle",
|
||||
data: ${pointno}
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
<#--F47曲线图专用模板-->
|
||||
{
|
||||
backgroundColor: "#fff",
|
||||
title: {
|
||||
text: "SEMI F47曲线",
|
||||
x: "center",
|
||||
},
|
||||
grid: {
|
||||
left: "4%",
|
||||
right: "5%",
|
||||
bottom: "10%",
|
||||
},
|
||||
legend: {
|
||||
data: ["边界线", "可容忍事件", "不可容忍事件"],
|
||||
x: "left",
|
||||
},
|
||||
color: ["yellow", "green", "red"],
|
||||
xAxis: [
|
||||
{
|
||||
type: "log",
|
||||
min: "0.001",
|
||||
max: "1000",
|
||||
splitLine: {
|
||||
show: false,
|
||||
},
|
||||
name: "s",
|
||||
},
|
||||
],
|
||||
yAxis: [
|
||||
{
|
||||
type: "value",
|
||||
max: ${zdz} + 20,
|
||||
splitNumber: 10,
|
||||
minInterval: 0.1,
|
||||
name: "%",
|
||||
},
|
||||
],
|
||||
series: [
|
||||
{
|
||||
name: "边界线",
|
||||
type: "line",
|
||||
data: ${bjx},
|
||||
showSymbol: false,
|
||||
tooltips: {
|
||||
show: false,
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "可容忍事件",
|
||||
type: "scatter",
|
||||
symbol: "circle",
|
||||
data: ${point}
|
||||
},
|
||||
{
|
||||
name: "不可容忍事件",
|
||||
type: "scatter",
|
||||
symbol: "circle",
|
||||
data: ${pointno}
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,93 @@
|
||||
<#--暂降幅值的概率分布函数专用模板-->
|
||||
{
|
||||
backgroundColor: "#fff",
|
||||
title: {
|
||||
text: "暂降幅值的概率分布函数",
|
||||
x: "center"
|
||||
},
|
||||
grid: {
|
||||
left: "10%",
|
||||
right: "10%",
|
||||
bottom: "15%"
|
||||
},
|
||||
toolbox: {
|
||||
show: true,
|
||||
feature: {
|
||||
restore: { show: true },
|
||||
saveAsImage: { show: true },
|
||||
},
|
||||
},
|
||||
tooltip: {
|
||||
trigger: "axis",
|
||||
formatter: "暂降幅值: {b0}<br />概率分布: {c0}%",
|
||||
},
|
||||
legend: {
|
||||
show: true,
|
||||
left: 10,
|
||||
data: ["概率分布", "占比"],
|
||||
},
|
||||
calculable: true,
|
||||
xAxis: [
|
||||
{
|
||||
type: "category",
|
||||
boundaryGap: false,
|
||||
name: "暂降幅值",
|
||||
nameLocation: "center",
|
||||
nameGap: 20,
|
||||
nameTextStyle: {
|
||||
fontSize: 15,
|
||||
},
|
||||
data: [
|
||||
"0",
|
||||
"10%",
|
||||
"20%",
|
||||
"30%",
|
||||
"40%",
|
||||
"50%",
|
||||
"60%",
|
||||
"70%",
|
||||
"80%",
|
||||
"90%",
|
||||
],
|
||||
},
|
||||
],
|
||||
yAxis: [
|
||||
{
|
||||
type: "value",
|
||||
name: "概率分布",
|
||||
nameLocation: "center",
|
||||
nameGap: 40,
|
||||
nameTextStyle: {
|
||||
fontSize: 15,
|
||||
},
|
||||
axisLabel: {
|
||||
formatter: "{value} %",
|
||||
},
|
||||
},
|
||||
{
|
||||
type: "value",
|
||||
name: "占比",
|
||||
nameLocation: "center",
|
||||
nameGap: 40,
|
||||
nameTextStyle: {
|
||||
fontSize: 15,
|
||||
},
|
||||
axisLabel: {
|
||||
formatter: "{value} %",
|
||||
},
|
||||
},
|
||||
],
|
||||
series: [
|
||||
{
|
||||
name: "概率分布",
|
||||
type: "line",
|
||||
data: ${eventValue},
|
||||
},
|
||||
{
|
||||
name: "占比",
|
||||
type: "bar",
|
||||
data: ${pereventValue},
|
||||
barWidth: 30
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,71 @@
|
||||
<#--持续时间的概率分布函数专用模板-->
|
||||
{
|
||||
backgroundColor: "#fff",
|
||||
title: {
|
||||
text: "持续时间的概率分布函数",
|
||||
x: "center",
|
||||
},
|
||||
legend: {
|
||||
show: true,
|
||||
left: 10,
|
||||
data: ["概率分布", "占比"],
|
||||
},
|
||||
calculable: true,
|
||||
grid: {
|
||||
left: "10%",
|
||||
right: "10%",
|
||||
bottom: "15%"
|
||||
},
|
||||
xAxis: [
|
||||
{
|
||||
type: "category",
|
||||
boundaryGap: false,
|
||||
name: "暂降持续时间(s)",
|
||||
nameLocation: "center",
|
||||
nameGap: 20,
|
||||
nameTextStyle: {
|
||||
fontSize: 15,
|
||||
},
|
||||
data: ["0.01", "0.1", "0.25", "0.5", "1", "3", "20", "60", "180"],
|
||||
},
|
||||
],
|
||||
yAxis: [
|
||||
{
|
||||
type: "value",
|
||||
name: "概率分布",
|
||||
nameLocation: "center",
|
||||
nameGap: 40,
|
||||
nameTextStyle: {
|
||||
fontSize: 15,
|
||||
},
|
||||
axisLabel: {
|
||||
formatter: "{value} %",
|
||||
},
|
||||
},
|
||||
{
|
||||
type: "value",
|
||||
name: "占比",
|
||||
nameLocation: "center",
|
||||
nameGap: 40,
|
||||
nameTextStyle: {
|
||||
fontSize: 15,
|
||||
},
|
||||
axisLabel: {
|
||||
formatter: "{value} %",
|
||||
},
|
||||
},
|
||||
],
|
||||
series: [
|
||||
{
|
||||
name: "概率分布",
|
||||
type: "line",
|
||||
data: ${sisttime},
|
||||
},
|
||||
{
|
||||
name: "占比",
|
||||
type: "bar",
|
||||
data: ${persisttime},
|
||||
barWidth: 30,
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
<#--月份统计专用模板-->
|
||||
{
|
||||
backgroundColor: "#fff",
|
||||
title: {
|
||||
text: "${text}",
|
||||
x: "center",
|
||||
},
|
||||
color: ["#FF8C00"],
|
||||
legend: {
|
||||
data: ["暂降次数"],
|
||||
x: "left",
|
||||
},
|
||||
grid: {
|
||||
left: "3%",
|
||||
bottom: "3%",
|
||||
right: "7%",
|
||||
containLabel: true,
|
||||
},
|
||||
xAxis: [
|
||||
{
|
||||
type: "category",
|
||||
data: ${months},
|
||||
name: "${xname}",
|
||||
splitLine: {
|
||||
show: false,
|
||||
},
|
||||
axisLabel: {
|
||||
show: true,
|
||||
interval: 0,
|
||||
},
|
||||
},
|
||||
],
|
||||
yAxis: [
|
||||
{
|
||||
type: "value",
|
||||
name: "次",
|
||||
},
|
||||
],
|
||||
series: [
|
||||
{
|
||||
name: "暂降次数",
|
||||
type: "bar",
|
||||
barMaxWidth: 45,
|
||||
itemStyle: {
|
||||
normal: {
|
||||
label: {
|
||||
show: true,
|
||||
textStyle: {
|
||||
label: { show: true, position: "top" },
|
||||
color: "#8B008B",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
data: ${handle},
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
<#--类型专用模板-->
|
||||
{
|
||||
backgroundColor: '#fff',
|
||||
animation: false,
|
||||
title: {
|
||||
text: '暂降类型',
|
||||
x: 'center',
|
||||
},
|
||||
legend: {
|
||||
orient: 'vertical',
|
||||
left: 'left',
|
||||
data: ${typeArray}
|
||||
},
|
||||
series: [
|
||||
{
|
||||
name: '暂降类型',
|
||||
type: 'pie',
|
||||
radius: '70%',
|
||||
center: ['50%', '60%'],
|
||||
label: {
|
||||
normal: {
|
||||
show: false
|
||||
},
|
||||
emphasis: {
|
||||
show: true
|
||||
}
|
||||
},
|
||||
lableLine: {
|
||||
normal: {
|
||||
show: false
|
||||
},
|
||||
emphasis: {
|
||||
show: true
|
||||
}
|
||||
},
|
||||
data: [<#list valueArray as a>
|
||||
{value:${a.times?c},
|
||||
name:'${a.type}'},
|
||||
</#list>],
|
||||
itemStyle: {
|
||||
emphasis: {
|
||||
shadowBlur: 10,
|
||||
shadowOffsetX: 0,
|
||||
shadowColor: 'rgba(0, 0, 0, 0.5)'
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
<#--暂降原因专用模板-->
|
||||
{
|
||||
backgroundColor: '#fff',
|
||||
animation: false,
|
||||
title: {
|
||||
text: '暂降原因',
|
||||
x: 'center'
|
||||
},
|
||||
legend: {
|
||||
orient: 'vertical',
|
||||
left: 'left',
|
||||
data: ${typeArray}
|
||||
},
|
||||
series: [
|
||||
{
|
||||
name: '暂降原因',
|
||||
type: 'pie',
|
||||
radius: '70%',
|
||||
center: ['50%', '53%'],
|
||||
label: {
|
||||
normal: {
|
||||
show: false
|
||||
},
|
||||
emphasis: {
|
||||
show: true
|
||||
}
|
||||
},
|
||||
lableLine: {
|
||||
normal: {
|
||||
show: false
|
||||
},
|
||||
emphasis: {
|
||||
show: true
|
||||
}
|
||||
},
|
||||
data: [<#list valueArray as a>
|
||||
{value:${a.times?c},
|
||||
name:'${a.reason}'},
|
||||
</#list>],
|
||||
itemStyle: {
|
||||
emphasis: {
|
||||
shadowBlur: 10,
|
||||
shadowOffsetX: 0,
|
||||
shadowColor: 'rgba(0, 0, 0, 0.5)'
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,66 @@
|
||||
{
|
||||
backgroundColor: "#FFF",
|
||||
title: {
|
||||
text: '电压等级',
|
||||
x: 'center'
|
||||
},
|
||||
tooltip: {
|
||||
trigger: 'axis',
|
||||
axisPointer: {
|
||||
type: 'shadow'
|
||||
},
|
||||
formatter: function (params) {
|
||||
var tips = "";
|
||||
tips += params[0].name ;
|
||||
for (var i = 0; i < params.length; i++) {
|
||||
tips += params[i].seriesName + ":" + params[i].value ;
|
||||
}
|
||||
return tips;
|
||||
}
|
||||
},
|
||||
color: ['orange'],
|
||||
legend: {
|
||||
data: ['暂降次数'],
|
||||
selectedMode: false,
|
||||
x: 'left'
|
||||
},
|
||||
grid: {
|
||||
left: '3%',
|
||||
right: '12%',
|
||||
bottom: '6%',
|
||||
containLabel: true
|
||||
},
|
||||
xAxis: [{
|
||||
type: 'category',
|
||||
data: ${xvalue},
|
||||
splitLine: {
|
||||
show: false
|
||||
},
|
||||
name: '电压等级\n(监测点数)',
|
||||
axisLabel: {
|
||||
interval: 0,
|
||||
show: true,
|
||||
fontSize:10
|
||||
}
|
||||
}],
|
||||
yAxis: [{
|
||||
type: 'value',
|
||||
name: '(次)'
|
||||
}],
|
||||
series: [{
|
||||
name: '暂降次数',
|
||||
type: 'bar',
|
||||
itemStyle: {
|
||||
normal: {
|
||||
label: {
|
||||
show: true,
|
||||
textStyle: {
|
||||
color: 'purple'
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
data: ${yvalue},
|
||||
barMaxWidth: 45
|
||||
}]
|
||||
}
|
||||
@@ -0,0 +1,68 @@
|
||||
{
|
||||
backgroundColor: '#FFF',
|
||||
title: {
|
||||
text: '区域统计',
|
||||
x: 'center'
|
||||
},
|
||||
tooltip: {
|
||||
trigger: 'axis',
|
||||
axisPointer: {
|
||||
type: 'shadow'
|
||||
},
|
||||
formatter: function (params) {
|
||||
var tips = "";
|
||||
tips += params[0].name ;
|
||||
for (var i = 0; i < params.length; i++) {
|
||||
tips += params[i].seriesName + ":" + params[i].value ;
|
||||
}
|
||||
return tips;
|
||||
}
|
||||
},
|
||||
color: ['orange'],
|
||||
|
||||
grid: {
|
||||
left: '1%',
|
||||
right: '7%',
|
||||
bottom: '8%',
|
||||
containLabel: true
|
||||
},
|
||||
legend: {
|
||||
data: ['暂降次数'],
|
||||
selectedMode: false,
|
||||
x: 'left'
|
||||
},
|
||||
xAxis: [{
|
||||
type: 'category',
|
||||
data: ${xvalue},
|
||||
splitLine: {
|
||||
show: false
|
||||
},
|
||||
name: '地区\n(监测点数)',
|
||||
axisLabel: {
|
||||
interval: 0,
|
||||
show: true,
|
||||
rotate:0,
|
||||
fontSize:10
|
||||
}
|
||||
}],
|
||||
yAxis: [{
|
||||
type: 'value',
|
||||
name: '(次)'
|
||||
}],
|
||||
series: [{
|
||||
name: '暂降次数',
|
||||
type: 'bar',
|
||||
itemStyle: {
|
||||
normal: {
|
||||
label: {
|
||||
show: true,
|
||||
textStyle: {
|
||||
color: 'purple'
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
data: ${yvalue},
|
||||
barMaxWidth: 45
|
||||
}],
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
{
|
||||
animation:false,
|
||||
xAxis: {},
|
||||
yAxis: {},
|
||||
series: [
|
||||
{
|
||||
symbolSize: 2,
|
||||
data: ${bdata},
|
||||
type: 'scatter'
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,76 @@
|
||||
{
|
||||
backgroundColor: "#FFF",
|
||||
title: {
|
||||
text: ${test},
|
||||
x: 'center'
|
||||
},
|
||||
tooltip: {
|
||||
trigger: 'axis',
|
||||
axisPointer: {
|
||||
type: 'shadow'
|
||||
},
|
||||
formatter: function (params) {
|
||||
var tips = "";
|
||||
tips += params[0].name ;
|
||||
for (var i = 0; i < params.length; i++) {
|
||||
tips += params[i].seriesName + ":" + params[i].value;
|
||||
}
|
||||
return tips;
|
||||
}
|
||||
},
|
||||
grid: {
|
||||
left: '3%',
|
||||
bottom: '6%',
|
||||
containLabel: true
|
||||
},
|
||||
legend: {
|
||||
data: ['未关联暂降次数', '已关联处理事件'],
|
||||
x: 'left'
|
||||
},
|
||||
xAxis: [{
|
||||
type: 'category',
|
||||
data:${xvalue},
|
||||
name: ${test},
|
||||
splitLine: {
|
||||
show: false
|
||||
},
|
||||
axisLabel: {
|
||||
show: true,
|
||||
interval: 0,
|
||||
fontSize:10
|
||||
}
|
||||
}],
|
||||
yAxis: [{
|
||||
type: 'value',
|
||||
name: '次'
|
||||
}],
|
||||
series: [{
|
||||
name: '未关联暂降次数',
|
||||
type: 'bar',
|
||||
stack: '事件总数',
|
||||
barMaxWidth: 45,
|
||||
itemStyle: {
|
||||
normal: {
|
||||
color: 'orange',
|
||||
barBorderColor: 'orange',
|
||||
barBorderWidth: 2,
|
||||
barBorderRadius: 0
|
||||
}
|
||||
},
|
||||
data: ${yvalue1}
|
||||
}, {
|
||||
name: '已关联处理事件',
|
||||
type: 'bar',
|
||||
stack: '事件总数',
|
||||
barMaxWidth: 45,
|
||||
itemStyle: {
|
||||
normal: {
|
||||
color: "#ccc",
|
||||
barBorderColor: '#ccc',
|
||||
barBorderWidth: 2,
|
||||
barBorderRadius: 0
|
||||
}
|
||||
},
|
||||
data: ${yvalue2}
|
||||
}]
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
package com.njcn.event.utils;
|
||||
|
||||
import net.sf.json.JSONObject;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author hongawen
|
||||
* @version 1.0.0
|
||||
* @date 2022年08月23日 19:33
|
||||
*/
|
||||
public class EchartsUtil {
|
||||
private static final String SUCCESS_CODE = "1";
|
||||
|
||||
public static String generateEchartsBase64(String option, String port) throws IOException {
|
||||
String url;
|
||||
if (port.equals("8911")) {
|
||||
url = "http://192.168.1.13:8911";
|
||||
} else {
|
||||
url = "http://192.168.1.13:8910";
|
||||
}
|
||||
|
||||
String base64 = "";
|
||||
if (option == null) {
|
||||
return base64;
|
||||
}
|
||||
|
||||
option = option.replaceAll("\\s+", "").replaceAll("\"", "'");
|
||||
|
||||
// 将option字符串作为参数发送给echartsConvert服务器
|
||||
Map<String, String> params = new HashMap<>();
|
||||
params.put("opt", option);
|
||||
String response = HttpUtil.post(url, params, "utf-8");
|
||||
|
||||
// 解析echartsConvert响应
|
||||
JSONObject responseJson = JSONObject.fromObject(response);
|
||||
String code = responseJson.getString("code");
|
||||
|
||||
// 如果echartsConvert正常返回
|
||||
if (SUCCESS_CODE.equals(code)) {
|
||||
base64 = responseJson.getString("data");
|
||||
}
|
||||
// 未正常返回
|
||||
else {
|
||||
String string = responseJson.getString("msg");
|
||||
throw new RuntimeException(string);
|
||||
}
|
||||
return base64;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
package com.njcn.event.utils;
|
||||
|
||||
import freemarker.template.Configuration;
|
||||
import freemarker.template.Template;
|
||||
import freemarker.template.TemplateException;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.io.StringWriter;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author hongawen
|
||||
* @version 1.0.0
|
||||
* @date 2022年08月23日 19:32
|
||||
*/
|
||||
public class FreemarkerUtil {
|
||||
private static String path = FreemarkerUtil.class.getClassLoader().getResource("").getPath();
|
||||
|
||||
public static String generateString(String templateFileName, String templateDirectory, Map<String, Object> datas)
|
||||
throws IOException, TemplateException {
|
||||
Configuration configuration = new Configuration(Configuration.VERSION_2_3_0);
|
||||
|
||||
// 设置默认编码
|
||||
configuration.setDefaultEncoding("UTF-8");
|
||||
|
||||
// 设置模板所在文件夹
|
||||
path = java.net.URLDecoder.decode(path,"utf-8");
|
||||
configuration.setDirectoryForTemplateLoading(new File(path + templateDirectory));
|
||||
|
||||
// 生成模板对象
|
||||
Template template = configuration.getTemplate(templateFileName);
|
||||
|
||||
// 将datas写入模板并返回
|
||||
try (StringWriter stringWriter = new StringWriter()) {
|
||||
template.process(datas, stringWriter);
|
||||
stringWriter.flush();
|
||||
return stringWriter.getBuffer().toString();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,63 @@
|
||||
package com.njcn.event.utils;
|
||||
|
||||
import org.apache.http.HttpEntity;
|
||||
import org.apache.http.NameValuePair;
|
||||
import org.apache.http.client.ClientProtocolException;
|
||||
import org.apache.http.client.entity.UrlEncodedFormEntity;
|
||||
import org.apache.http.client.methods.CloseableHttpResponse;
|
||||
import org.apache.http.client.methods.HttpPost;
|
||||
import org.apache.http.impl.client.CloseableHttpClient;
|
||||
import org.apache.http.impl.client.HttpClients;
|
||||
import org.apache.http.message.BasicNameValuePair;
|
||||
import org.apache.http.util.EntityUtils;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author hongawen
|
||||
* @version 1.0.0
|
||||
* @date 2022年08月23日 19:33
|
||||
*/
|
||||
public class HttpUtil {
|
||||
|
||||
public static String post(String url, Map<String, String> params, String charset)
|
||||
throws ClientProtocolException, IOException {
|
||||
String responseEntity = "";
|
||||
|
||||
// 创建CloseableHttpClient对象
|
||||
CloseableHttpClient client = HttpClients.createDefault();
|
||||
|
||||
// 创建post方式请求对象
|
||||
HttpPost httpPost = new HttpPost(url);
|
||||
|
||||
// 生成请求参数
|
||||
List<NameValuePair> nameValuePairs = new ArrayList<>();
|
||||
if (params != null) {
|
||||
for (Map.Entry<String, String> entry : params.entrySet()) {
|
||||
nameValuePairs.add(new BasicNameValuePair(entry.getKey(), entry.getValue()));
|
||||
}
|
||||
}
|
||||
|
||||
// 将参数添加到post请求中
|
||||
httpPost.setEntity(new UrlEncodedFormEntity(nameValuePairs, charset));
|
||||
|
||||
// 发送请求,获取结果(同步阻塞)
|
||||
CloseableHttpResponse response = client.execute(httpPost);
|
||||
|
||||
// 获取响应实体
|
||||
HttpEntity entity = response.getEntity();
|
||||
if (entity != null) {
|
||||
// 按指定编码转换结果实体为String类型
|
||||
responseEntity = EntityUtils.toString(entity, charset);
|
||||
}
|
||||
|
||||
// 释放资源
|
||||
EntityUtils.consume(entity);
|
||||
response.close();
|
||||
|
||||
return responseEntity;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
package com.njcn.event.utils;
|
||||
|
||||
import cn.hutool.core.util.RandomUtil;
|
||||
import freemarker.template.TemplateException;
|
||||
import net.sf.json.JSONArray;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.math.RoundingMode;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
/**
|
||||
* @author hongawen
|
||||
* @version 1.0.0
|
||||
* @date 2022年08月25日 08:59
|
||||
*/
|
||||
public class TestTemplate {
|
||||
public static void main(String[] args) throws IOException, TemplateException {
|
||||
HashMap<String, Object> map = new HashMap<>();
|
||||
map.put("subtext","区域统计");
|
||||
map.put("xname","(区域)");
|
||||
List<String> x = Stream.of("江苏省", "浙江省", "福建省").collect(Collectors.toList());
|
||||
map.put("area",JSONArray.fromObject(x).toString());
|
||||
List<Integer> on = Stream.of(149, 15, 9).collect(Collectors.toList());
|
||||
List<Integer> off = Stream.of(24, 2, 1).collect(Collectors.toList());
|
||||
map.put("onlineData",JSONArray.fromObject(on).toString());
|
||||
map.put("offlineData",JSONArray.fromObject(off).toString());
|
||||
|
||||
List<List<Double>> floatData = new ArrayList<>();
|
||||
for (int i = 0; i < 1500; i++) {
|
||||
List<Double> sub = new ArrayList<>();
|
||||
sub.add( RandomUtil.randomDouble(100.0,3, RoundingMode.UP));
|
||||
sub.add( RandomUtil.randomDouble(200.0,3, RoundingMode.UP));
|
||||
floatData.add(sub);
|
||||
}
|
||||
map.put("point",JSONArray.fromObject(floatData).toString());
|
||||
|
||||
String s = FreemarkerUtil.generateString("bar.ftl", "com/njcn/event/template", map);
|
||||
System.out.println(EchartsUtil.generateEchartsBase64(s,"8910"));
|
||||
|
||||
|
||||
|
||||
|
||||
// HashMap<String, Object> datas = new HashMap<>();
|
||||
// List<List<Double>> floatData = new ArrayList<>();
|
||||
// for (int i = 0; i < 1500; i++) {
|
||||
// List<Double> sub = new ArrayList<>();
|
||||
// sub.add( RandomUtil.randomDouble(100.0,3, RoundingMode.UP));
|
||||
// sub.add( RandomUtil.randomDouble(200.0,3, RoundingMode.UP));
|
||||
// floatData.add(sub);
|
||||
// }
|
||||
// datas.put("bdata", JSONArray.fromObject(floatData).toString());
|
||||
// String option = FreemarkerUtil.generateString("test.ftl", "com/njcn/event/template", datas);
|
||||
// System.out.println(EchartsUtil.generateEchartsBase64(option, "8910"));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,368 @@
|
||||
package com.njcn.event.utils;
|
||||
import java.io.File;
|
||||
import java.io.FileOutputStream;
|
||||
import java.math.BigInteger;
|
||||
import java.util.Calendar;
|
||||
|
||||
import org.apache.poi.xwpf.model.XWPFHeaderFooterPolicy;
|
||||
import org.apache.poi.xwpf.usermodel.ParagraphAlignment;
|
||||
import org.apache.poi.xwpf.usermodel.TextAlignment;
|
||||
import org.apache.poi.xwpf.usermodel.XWPFDocument;
|
||||
import org.apache.poi.xwpf.usermodel.XWPFParagraph;
|
||||
import org.apache.poi.xwpf.usermodel.XWPFRun;
|
||||
import org.apache.poi.xwpf.usermodel.XWPFStyle;
|
||||
import org.apache.poi.xwpf.usermodel.XWPFStyles;
|
||||
import org.apache.poi.xwpf.usermodel.XWPFTable;
|
||||
import org.apache.poi.xwpf.usermodel.XWPFTableRow;
|
||||
import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTDecimalNumber;
|
||||
import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTOnOff;
|
||||
import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTP;
|
||||
import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTPPr;
|
||||
import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTR;
|
||||
import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTSectPr;
|
||||
import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTString;
|
||||
import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTStyle;
|
||||
import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTTblWidth;
|
||||
import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTText;
|
||||
import org.openxmlformats.schemas.wordprocessingml.x2006.main.STStyleType;
|
||||
import org.openxmlformats.schemas.wordprocessingml.x2006.main.STTblWidth;
|
||||
|
||||
public class WordUtils {
|
||||
|
||||
|
||||
public static void main(String[] args)throws Exception {
|
||||
|
||||
// 空白文档
|
||||
XWPFDocument document= new XWPFDocument();
|
||||
//把文档写进本地系统
|
||||
FileOutputStream out = new FileOutputStream(new File("create_table.docx"));
|
||||
//设定标题格式
|
||||
setHeadingStyle(document);
|
||||
//添加标题
|
||||
XWPFParagraph titleParagraph = document.createParagraph();
|
||||
setParagraphStyle(titleParagraph);
|
||||
addLine(titleParagraph,11);
|
||||
//设置段落居中
|
||||
titleParagraph.setAlignment(ParagraphAlignment.CENTER);
|
||||
XWPFRun titleParagraphRun = titleParagraph.createRun();
|
||||
addParagraph(titleParagraphRun,"宋体",15,"000000","四川省供电公司",true);
|
||||
|
||||
addLine(titleParagraph,3);
|
||||
XWPFRun titleParagraphBigRun = titleParagraph.createRun();
|
||||
addParagraph(titleParagraphBigRun,"宋体",36,"000000","电压暂降事件分析报告",true);
|
||||
addLine(titleParagraph,19);
|
||||
|
||||
XWPFRun titleParagraphDateRun = titleParagraph.createRun();
|
||||
addParagraph(titleParagraphDateRun,"宋体",14,"000000","日期: 2018年1月3号",true);
|
||||
titleParagraph.setPageBreak(true);
|
||||
|
||||
|
||||
//段落
|
||||
XWPFParagraph statisticsParagraph = document.createParagraph();
|
||||
setParagraphStyle(statisticsParagraph);
|
||||
//段前分页
|
||||
statisticsParagraph.setPageBreak(true);
|
||||
statisticsParagraph.setAlignment(ParagraphAlignment.CENTER);
|
||||
XWPFRun statisticsRun = statisticsParagraph.createRun();
|
||||
addParagraph(statisticsRun,"宋体",24,"000000","电压暂降事件分析报告",false);
|
||||
|
||||
|
||||
|
||||
XWPFParagraph introductionParagraph= document.createParagraph();
|
||||
setParagraphStyle(introductionParagraph);
|
||||
introductionParagraph.setStyle("标题 1");
|
||||
introductionParagraph.setAlignment(ParagraphAlignment.LEFT);
|
||||
XWPFRun introductionRun = introductionParagraph.createRun();
|
||||
addParagraph(introductionRun,"宋体",15,"000000","1. 引言",true);
|
||||
|
||||
XWPFParagraph introductionContentParagraph = document.createParagraph();
|
||||
// 首行缩进---段落
|
||||
setParagraphStyle(introductionContentParagraph);
|
||||
introductionContentParagraph.setAlignment(ParagraphAlignment.LEFT);
|
||||
introductionContentParagraph.setIndentationFirstLine(200);
|
||||
XWPFRun introductionContentRun=introductionContentParagraph.createRun();
|
||||
addParagraph(introductionContentRun,"宋体",11,"000000","对所选中区间内电压暂降事件进行分析,能够直观清晰查看相应的暂降事件信息。",false);
|
||||
|
||||
XWPFParagraph objectParagraph=document.createParagraph();
|
||||
setParagraphStyle(objectParagraph);
|
||||
objectParagraph.setStyle("标题 1");
|
||||
objectParagraph.setAlignment(ParagraphAlignment.LEFT);
|
||||
XWPFRun objectRun= objectParagraph.createRun();
|
||||
addParagraph(objectRun,"宋体",15,"000000","2. 报告分析对象:",true);
|
||||
|
||||
XWPFParagraph objectContentParagraph = document.createParagraph();
|
||||
setParagraphStyle(objectContentParagraph);
|
||||
objectContentParagraph.setAlignment(ParagraphAlignment.LEFT);
|
||||
objectContentParagraph.setIndentationFirstLine(200);
|
||||
XWPFRun objectContentRun = objectContentParagraph.createRun();
|
||||
addParagraph(objectContentRun,"宋体",11,"000000","成都供电公司—>锦江区变电站—>锦江2号。",false);
|
||||
|
||||
XWPFParagraph timeParagraph = document.createParagraph();
|
||||
timeParagraph.setStyle("标题 1");
|
||||
timeParagraph.setAlignment(ParagraphAlignment.LEFT);
|
||||
setParagraphStyle(timeParagraph);
|
||||
XWPFRun timeRun = timeParagraph.createRun();
|
||||
addParagraph(timeRun,"宋体",15,"000000","3. 报告分析时间:",true);
|
||||
|
||||
XWPFParagraph timeContentParagraph = document.createParagraph();
|
||||
setParagraphStyle(timeContentParagraph);
|
||||
timeContentParagraph.setAlignment(ParagraphAlignment.LEFT);
|
||||
timeContentParagraph.setIndentationFirstLine(200);
|
||||
XWPFRun timeContentRun = timeContentParagraph.createRun();
|
||||
addParagraph(timeContentRun,"宋体",11,"000000","2017年12月21日至2017年12月30日。",false);
|
||||
|
||||
|
||||
XWPFParagraph summaeParagraph = document.createParagraph();
|
||||
setParagraphStyle(summaeParagraph);
|
||||
summaeParagraph.setStyle("标题 1");
|
||||
summaeParagraph.setAlignment(ParagraphAlignment.LEFT);
|
||||
XWPFRun summaeRun = summaeParagraph.createRun();
|
||||
addParagraph(summaeRun,"宋体",15,"000000","4. 汇总信息:",true);
|
||||
|
||||
|
||||
XWPFParagraph summaeTableParagraph = document.createParagraph();
|
||||
setParagraphStyle(summaeTableParagraph);
|
||||
summaeTableParagraph.setStyle("标题 2");
|
||||
summaeTableParagraph.setAlignment(ParagraphAlignment.LEFT);
|
||||
summaeTableParagraph.setIndentationFirstLine(200);
|
||||
XWPFRun summaeTableRun = summaeTableParagraph.createRun();
|
||||
addParagraph(summaeTableRun,"宋体",11,"000000","4.1 表格",false);
|
||||
|
||||
|
||||
//工作经历表格
|
||||
XWPFTable summaTable = document.createTable();
|
||||
|
||||
//列宽自动分割
|
||||
CTTblWidth summaTableWidth = summaTable.getCTTbl().addNewTblPr().addNewTblW();
|
||||
summaTableWidth.setType(STTblWidth.DXA);
|
||||
summaTableWidth.setW(BigInteger.valueOf(9072));
|
||||
|
||||
//表格第一行
|
||||
XWPFTableRow summaTableRowOne = summaTable.getRow(0);
|
||||
XWPFParagraph excelParagraph= document.createParagraph();
|
||||
setParagraphStyle(excelParagraph);
|
||||
excelParagraph.setAlignment(ParagraphAlignment.CENTER);
|
||||
excelParagraph.setVerticalAlignment(TextAlignment.CENTER);
|
||||
setExcelHeadContent(excelParagraph,summaTableRowOne,"序号","暂降发生时刻","暂降幅值(%)","持续时间(ms)","暂降类型","暂降原因","严重度");
|
||||
|
||||
//表格第二行
|
||||
XWPFTableRow summaTableRowTwo = summaTable.createRow();
|
||||
setExcelContent(excelParagraph,summaTableRowTwo,"1","2017-11-24 14:26:56.490","9","20","未识别","未明","0.91");
|
||||
|
||||
//表格第三行
|
||||
XWPFTableRow summaTableRowThree = summaTable.createRow();
|
||||
setExcelContent(excelParagraph,summaTableRowThree,"2","2017-11-24 14:25:46.472","15","19","未识别","未明","0.85");
|
||||
|
||||
XWPFParagraph summaePicParagraph = document.createParagraph();
|
||||
summaePicParagraph.setStyle("标题 2");
|
||||
summaePicParagraph.setAlignment(ParagraphAlignment.LEFT);
|
||||
summaePicParagraph.setIndentationFirstLine(200);
|
||||
XWPFRun summaePicRun = summaePicParagraph.createRun();
|
||||
addParagraph(summaePicRun,"宋体",11,"000000","4.2 ITIC曲线",false);
|
||||
|
||||
|
||||
CTSectPr sectPr = document.getDocument().getBody().addNewSectPr();
|
||||
XWPFHeaderFooterPolicy policy = new XWPFHeaderFooterPolicy(document, sectPr);
|
||||
|
||||
//添加页眉
|
||||
CTP ctpHeader = CTP.Factory.newInstance();
|
||||
CTR ctrHeader = ctpHeader.addNewR();
|
||||
CTText ctHeader = ctrHeader.addNewT();
|
||||
String headerText = "Java POI create MS word file.";
|
||||
ctHeader.setStringValue(headerText);
|
||||
XWPFParagraph headerParagraph = new XWPFParagraph(ctpHeader, document);
|
||||
//设置为右对齐
|
||||
headerParagraph.setAlignment(ParagraphAlignment.RIGHT);
|
||||
XWPFParagraph[] parsHeader = new XWPFParagraph[1];
|
||||
parsHeader[0] = headerParagraph;
|
||||
policy.createHeader(XWPFHeaderFooterPolicy.DEFAULT, parsHeader);
|
||||
|
||||
|
||||
//添加页脚
|
||||
CTP ctpFooter = CTP.Factory.newInstance();
|
||||
CTR ctrFooter = ctpFooter.addNewR();
|
||||
CTText ctFooter = ctrFooter.addNewT();
|
||||
String footerText = "http://blog.csdn.net/zhouseawater";
|
||||
ctFooter.setStringValue(footerText);
|
||||
XWPFParagraph footerParagraph = new XWPFParagraph(ctpFooter, document);
|
||||
headerParagraph.setAlignment(ParagraphAlignment.CENTER);
|
||||
XWPFParagraph[] parsFooter = new XWPFParagraph[1];
|
||||
parsFooter[0] = footerParagraph;
|
||||
policy.createFooter(XWPFHeaderFooterPolicy.DEFAULT, parsFooter);
|
||||
|
||||
document.write(out);
|
||||
out.close();
|
||||
|
||||
}
|
||||
|
||||
public static void setParagraphStyle(XWPFParagraph paragraph){
|
||||
paragraph.setSpacingBefore(100);
|
||||
paragraph.setSpacingAfter(100);
|
||||
}
|
||||
|
||||
/**
|
||||
* 返回指定格式的段落 居中型
|
||||
* @param document 文档对象
|
||||
*/
|
||||
public static XWPFParagraph getCenterParagraph(XWPFDocument document){
|
||||
XWPFParagraph paragraph = document.createParagraph();
|
||||
setParagraphStyle(paragraph);
|
||||
paragraph.setAlignment(ParagraphAlignment.CENTER);
|
||||
paragraph.setVerticalAlignment(TextAlignment.CENTER);
|
||||
return paragraph;
|
||||
}
|
||||
|
||||
/**
|
||||
* 返回指定格式的段落 居左型
|
||||
* @param document 文档对象
|
||||
*/
|
||||
public static XWPFParagraph getLeftParagraph(XWPFDocument document){
|
||||
XWPFParagraph paragraph = document.createParagraph();
|
||||
setParagraphStyle(paragraph);
|
||||
paragraph.setAlignment(ParagraphAlignment.LEFT);
|
||||
return paragraph;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 添加换行符
|
||||
* @param paragraph 指定段落
|
||||
* @param amount 行数
|
||||
* */
|
||||
public static void addLine(XWPFParagraph paragraph,Integer amount){
|
||||
XWPFRun run = paragraph.createRun();
|
||||
run.setFontSize(11);
|
||||
for(int i=0;i<amount;i++){
|
||||
run.addCarriageReturn();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 添加段落文本
|
||||
* @param run 文本执行对象
|
||||
* @param fontFamily 字体类型
|
||||
* @param fontSize 字体大小
|
||||
* @param backgroundColor 字体颜色
|
||||
* @param bold 是否加粗
|
||||
*/
|
||||
public static void addParagraph(XWPFRun run,String fontFamily,Integer fontSize,String backgroundColor,String message,boolean bold){
|
||||
run.setText(message);
|
||||
run.setColor(backgroundColor);
|
||||
run.setFontSize(fontSize);
|
||||
run.setFontFamily(fontFamily);
|
||||
run.setBold(bold);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 增加自定义标题样式。这里用的是stackoverflow的源码
|
||||
*
|
||||
* @param docxDocument 目标文档
|
||||
* @param strStyleId 样式名称
|
||||
* @param headingLevel 样式级别
|
||||
*/
|
||||
public static void addCustomHeadingStyle(XWPFDocument docxDocument, String strStyleId, int headingLevel) {
|
||||
|
||||
CTStyle ctStyle = CTStyle.Factory.newInstance();
|
||||
ctStyle.setStyleId(strStyleId);
|
||||
|
||||
CTString styleName = CTString.Factory.newInstance();
|
||||
styleName.setVal(strStyleId);
|
||||
ctStyle.setName(styleName);
|
||||
|
||||
CTDecimalNumber indentNumber = CTDecimalNumber.Factory.newInstance();
|
||||
indentNumber.setVal(BigInteger.valueOf(headingLevel));
|
||||
|
||||
// lower number > style is more prominent in the formats bar
|
||||
ctStyle.setUiPriority(indentNumber);
|
||||
|
||||
CTOnOff onoffnull = CTOnOff.Factory.newInstance();
|
||||
ctStyle.setUnhideWhenUsed(onoffnull);
|
||||
|
||||
// style shows up in the formats bar
|
||||
ctStyle.setQFormat(onoffnull);
|
||||
|
||||
// style defines a heading of the given level
|
||||
CTPPr ppr = CTPPr.Factory.newInstance();
|
||||
ppr.setOutlineLvl(indentNumber);
|
||||
ctStyle.setPPr(ppr);
|
||||
|
||||
XWPFStyle style = new XWPFStyle(ctStyle);
|
||||
|
||||
// is a null op if already defined
|
||||
XWPFStyles styles = docxDocument.createStyles();
|
||||
|
||||
style.setType(STStyleType.PARAGRAPH);
|
||||
styles.addStyle(style);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置文档中标题格式
|
||||
* */
|
||||
public static void setHeadingStyle(XWPFDocument document){
|
||||
addCustomHeadingStyle(document, "标题 1", 1);
|
||||
addCustomHeadingStyle(document, "标题 2", 2);
|
||||
addCustomHeadingStyle(document, "标题 3", 3);
|
||||
addCustomHeadingStyle(document, "标题 4", 4);
|
||||
addCustomHeadingStyle(document, "标题 5", 5);
|
||||
addCustomHeadingStyle(document, "标题 6", 6);
|
||||
addCustomHeadingStyle(document, "标题 7", 7);
|
||||
}
|
||||
|
||||
/**
|
||||
* 给表格添加一行数据
|
||||
* @param paragraph 段落对象
|
||||
* @param row 行对象
|
||||
* @param data 不定长度的数据
|
||||
*/
|
||||
public static void setExcelContent(XWPFParagraph paragraph, XWPFTableRow row,String... data){
|
||||
for (int i=0;i<data.length;i++){
|
||||
XWPFRun run =paragraph.createRun();
|
||||
run.setFontFamily("宋体");
|
||||
run.setText(data[i]);
|
||||
row.getCell(i).setParagraph(paragraph);
|
||||
paragraph.removeRun(0);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 添加表头标题一行数据
|
||||
* @param paragraph 段落对象
|
||||
* @param row 行对象
|
||||
* @param data 不定长度的数据
|
||||
*/
|
||||
public static void setExcelHeadContent(XWPFParagraph paragraph, XWPFTableRow row,String... data){
|
||||
XWPFRun run= paragraph.createRun();
|
||||
run.setFontFamily("宋体");
|
||||
run.setBold(true);
|
||||
run.setText(data[0]);
|
||||
row.getCell(0).setParagraph(paragraph);
|
||||
paragraph.removeRun(0);
|
||||
for(int i=1;i<data.length;i++){
|
||||
XWPFRun run1 =paragraph.createRun();
|
||||
run1.setFontFamily("宋体");
|
||||
run1.setBold(true);
|
||||
run1.setText(data[i]);
|
||||
row.addNewTableCell().setParagraph(paragraph);
|
||||
paragraph.removeRun(0);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取当前的日期
|
||||
* @return
|
||||
*/
|
||||
public static String getRightNow(){
|
||||
Calendar rightNow = Calendar.getInstance();
|
||||
Integer year = rightNow.get(Calendar.YEAR);
|
||||
Integer month = rightNow.get(Calendar.MONTH)+1;
|
||||
Integer day = rightNow.get(rightNow.DAY_OF_MONTH);
|
||||
return year+"年"+month+"月"+day+"日";
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user