初始化
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
package com.njcn.event;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.mybatis.spring.annotation.MapperScan;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.cloud.openfeign.EnableFeignClients;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @return
|
||||
* @author hongawen
|
||||
* @date 2022-03-07 15:37:00
|
||||
*/
|
||||
@Slf4j
|
||||
@MapperScan("com.njcn.**.mapper")
|
||||
@EnableFeignClients(basePackages = "com.njcn")
|
||||
@SpringBootApplication(scanBasePackages = "com.njcn")
|
||||
public class EventBootApplication {
|
||||
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(EventBootApplication.class, args);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,84 @@
|
||||
package com.njcn.event.controller;
|
||||
|
||||
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.LogUtil;
|
||||
import com.njcn.device.pojo.param.DeviceInfoParam;
|
||||
import com.njcn.event.pojo.vo.AreaLineVO;
|
||||
import com.njcn.event.pojo.vo.EventHeatMapVO;
|
||||
import com.njcn.event.pojo.vo.EventSeverityVO;
|
||||
import com.njcn.event.service.AreaLineService;
|
||||
import com.njcn.web.controller.BaseController;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
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.*;
|
||||
|
||||
/**
|
||||
* @author denghuajun
|
||||
* @version 1.0.0
|
||||
* @date 2022年04月07日 09:33
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("/area")
|
||||
@Api(tags = "区域暂降相关")
|
||||
@AllArgsConstructor
|
||||
public class AreaController extends BaseController {
|
||||
|
||||
private final AreaLineService areaLineService;
|
||||
|
||||
/**
|
||||
* 获取监测网分布
|
||||
* @param deviceInfoParam 参数
|
||||
* @return 结果
|
||||
*/
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/getAreaLineDetail")
|
||||
@ApiOperation("获取监测网分布")
|
||||
@ApiImplicitParam(name = "deviceInfoParam", value = "监测网分布参数", required = true)
|
||||
public HttpResult<AreaLineVO> getAreaLineDetail(@RequestBody @Validated DeviceInfoParam deviceInfoParam) {
|
||||
String methodDescribe = getMethodDescribe("getAreaLineDetail");
|
||||
LogUtil.njcnDebug(log, "{},参数为:{}", methodDescribe, deviceInfoParam);
|
||||
AreaLineVO result = areaLineService.getAreaLineVO(deviceInfoParam);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取暂降热力图
|
||||
* @param deviceInfoParam 参数
|
||||
* @return 结果
|
||||
*/
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/getEventHeatMap")
|
||||
@ApiOperation("获取暂降热力图")
|
||||
@ApiImplicitParam(name = "deviceInfoParam", value = "监测网分布参数", required = true)
|
||||
public HttpResult<EventHeatMapVO> getEventHeatMap(@RequestBody @Validated DeviceInfoParam.BusinessParam deviceInfoParam) {
|
||||
String methodDescribe = getMethodDescribe("getEventHeatMap");
|
||||
LogUtil.njcnDebug(log, "{},参数为:{}", methodDescribe, deviceInfoParam);
|
||||
EventHeatMapVO result = areaLineService.getEventHeatMap(deviceInfoParam);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取暂降严重度
|
||||
* @param deviceInfoParam 参数
|
||||
* @return 结果
|
||||
*/
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/getEventSeverity")
|
||||
@ApiOperation("获取暂降严重度")
|
||||
@ApiImplicitParam(name = "deviceInfoParam", value = "监测网分布参数", required = true)
|
||||
public HttpResult<EventSeverityVO> getEventSeverity(@RequestBody @Validated DeviceInfoParam.BusinessParam deviceInfoParam) {
|
||||
String methodDescribe = getMethodDescribe("getEventSeverity");
|
||||
LogUtil.njcnDebug(log, "{},参数为:{}", methodDescribe, deviceInfoParam);
|
||||
EventSeverityVO result = areaLineService.getEventSeverity(deviceInfoParam);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,128 @@
|
||||
package com.njcn.event.controller;
|
||||
|
||||
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.LogUtil;
|
||||
import com.njcn.event.pojo.po.EventDetail;
|
||||
import com.njcn.event.service.EventDetailService;
|
||||
import com.njcn.web.controller.BaseController;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiImplicitParams;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author denghuajun
|
||||
* @version 1.0.0
|
||||
* @date 2022/3/16
|
||||
*/
|
||||
@Validated
|
||||
@Slf4j
|
||||
@Api(tags = "暂降事件相关")
|
||||
@RestController
|
||||
@RequestMapping("/event")
|
||||
@RequiredArgsConstructor
|
||||
public class EventDetailController extends BaseController {
|
||||
|
||||
private final EventDetailService eventDetailService;
|
||||
|
||||
/**
|
||||
* 获取暂降事件
|
||||
* @param id 监测点id
|
||||
* @param startTime 起始时间
|
||||
* @param endTime 结束时间
|
||||
* @return 结果
|
||||
*/
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/getEventDetailData")
|
||||
@ApiOperation("获取暂降事件")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "id", value = "监测点id", required = true),
|
||||
@ApiImplicitParam(name = "startTime", value = "起始时间", required = true),
|
||||
@ApiImplicitParam(name = "endTime", value = "结束时间", required = true),
|
||||
})
|
||||
public HttpResult<List<EventDetail>> getEventDetailData(@RequestParam("id") String id, @RequestParam("startTime") String startTime, @RequestParam("endTime") String endTime) {
|
||||
String methodDescribe = getMethodDescribe("getEventDetailData");
|
||||
LogUtil.njcnDebug(log, "{},监测点id为:{}", methodDescribe, id);
|
||||
List<EventDetail> result = eventDetailService.getEventDetailData(id, startTime, endTime);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取暂降事件
|
||||
* @param id 监测点id
|
||||
* @param time 时间id
|
||||
* @return 结果
|
||||
*/
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/getEventDetailByTime")
|
||||
@ApiOperation("获取暂降事件")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "id", value = "监测点id", required = true),
|
||||
@ApiImplicitParam(name = "time", value = "时间id", required = true),
|
||||
})
|
||||
public HttpResult<EventDetail> getEventDetailByTime(@RequestParam("id") String id, @RequestParam("time") String time) {
|
||||
String methodDescribe = getMethodDescribe("getEventDetailByTime");
|
||||
LogUtil.njcnDebug(log, "{},监测点id为:{}", methodDescribe, id);
|
||||
EventDetail result = eventDetailService.getEventDetailByTime(id, time);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据监测点集合获取暂态列表
|
||||
* @param lineIndexes
|
||||
* @param startTime
|
||||
* @param endTime
|
||||
* @return
|
||||
*/
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/getEventDetail")
|
||||
@ApiOperation("获取暂降列表")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "lineIndexes", value = "监测点集合", required = true),
|
||||
@ApiImplicitParam(name = "startTime", value = "起始时间", required = true),
|
||||
@ApiImplicitParam(name = "endTime", value = "结束时间", required = true),
|
||||
})
|
||||
public HttpResult<List<EventDetail>> getEventDetail(@RequestBody List<String> lineIndexes, @RequestParam("startTime") String startTime, @RequestParam("endTime") String endTime) {
|
||||
String methodDescribe = getMethodDescribe("getEventDetail");
|
||||
LogUtil.njcnDebug(log, "{},监测点id为:{}", methodDescribe, lineIndexes);
|
||||
List<EventDetail> result = eventDetailService.getEventDetail(lineIndexes, startTime, endTime);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据监测点集合以及分页信息获取暂降事件
|
||||
* @param lineIndexes
|
||||
* @param startTime
|
||||
* @param endTime
|
||||
* @param transientParam
|
||||
* @return
|
||||
*/
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/getEventDetailLimit")
|
||||
@ApiOperation("分页获取暂降列表")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "lineIndexes", value = "监测点集合", required = true),
|
||||
@ApiImplicitParam(name = "startTime", value = "起始时间", required = true),
|
||||
@ApiImplicitParam(name = "endTime", value = "结束时间", required = true),
|
||||
@ApiImplicitParam(name = "pageSize", value = "暂降页面大小", required = true),
|
||||
@ApiImplicitParam(name = "pageNum", value = "暂降页数", required = true),
|
||||
})
|
||||
public HttpResult<List<EventDetail>> getEventDetailLimit(@RequestBody List<String> lineIndexes, @RequestParam("startTime") String startTime, @RequestParam("endTime") String endTime, @RequestParam("pageSize") Integer pageSize, @RequestParam("pageNum") Integer pageNum) {
|
||||
String methodDescribe = getMethodDescribe("getEventDetailLimit");
|
||||
LogUtil.njcnDebug(log, "{},监测点id为:{}", methodDescribe, lineIndexes);
|
||||
List<EventDetail> result = eventDetailService.getEventDetailLimit(lineIndexes, startTime, endTime, pageSize, pageNum);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
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.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.TransientParam;
|
||||
import com.njcn.event.pojo.vo.TransientVO;
|
||||
import com.njcn.event.service.TransientService;
|
||||
import com.njcn.web.controller.BaseController;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiImplicitParams;
|
||||
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.*;
|
||||
|
||||
/**
|
||||
* @author: chenchao
|
||||
* @date: 2022/03/29 10:19
|
||||
* @Description: <描述>
|
||||
*/
|
||||
@Validated
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("/transient")
|
||||
@Api(tags = "暂态事件列表")
|
||||
@AllArgsConstructor
|
||||
public class TransientController extends BaseController {
|
||||
|
||||
private final TransientService transientService;
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/getTransientData")
|
||||
@ApiOperation("暂态事件信息列表")
|
||||
@ApiImplicitParam(name = "transientParam", value = "暂态列表参数", required = true)
|
||||
public HttpResult<Page<TransientVO>> getTransientData(@RequestBody @Validated TransientParam transientParam){
|
||||
String methodDescribe = getMethodDescribe("getTransientData");
|
||||
Page<TransientVO> list = transientService.getTransientData(transientParam);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe);
|
||||
}
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/getTransientAnalyseWave")
|
||||
@ApiOperation("暂态事件波形分析")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "timeId", value = "暂态时刻", required = true),
|
||||
@ApiImplicitParam(name = "lineId", value = "暂态监测点Id", required = true)
|
||||
})
|
||||
public HttpResult<WaveDataDTO> getTransientAnalyseWave(@RequestParam("timeId") String timeId, @RequestParam("lineId") String lineId){
|
||||
String methodDescribe = getMethodDescribe("getTransientAnalyseWave");
|
||||
WaveDataDTO wave = transientService.getTransientAnalyseWave(timeId, lineId);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, wave, methodDescribe);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
package com.njcn.event.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.njcn.event.pojo.po.EventDetail;
|
||||
|
||||
/**
|
||||
* @author denghuajun
|
||||
* @version 1.0.0
|
||||
* @date 2022/3/16
|
||||
*/
|
||||
public interface EventDetailMapper extends BaseMapper<EventDetail> {
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
package com.njcn.event.mapper;
|
||||
|
||||
import com.njcn.event.pojo.vo.TransientVO;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author: chenchao
|
||||
* @date: 2022/03/29 15:33
|
||||
* @Description: <描述>
|
||||
*/
|
||||
public interface TransientMapper {
|
||||
/**
|
||||
* 获取暂态列表相关信息
|
||||
*/
|
||||
List<TransientVO> getTransientData(@Param("list") List<String> lineIndexes);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.njcn.event.mapper.TransientMapper">
|
||||
|
||||
<select id="getTransientData" resultType="TransientVO">
|
||||
SELECT
|
||||
B.`Id` id,
|
||||
B.`Name` name,
|
||||
B4.`Name` powerCompany,
|
||||
B3.`Name` substation,
|
||||
D.`Name` voltageLevel,
|
||||
E.`IP` networkParam
|
||||
FROM
|
||||
pq_line B,
|
||||
pq_voltage C,
|
||||
sys_dict_data D,
|
||||
pq_device E,
|
||||
pq_line B1,
|
||||
pq_line B2,
|
||||
pq_line B3,
|
||||
pq_line B4
|
||||
WHERE
|
||||
B.Id IN
|
||||
<foreach item="item" collection="list" separator="," open="(" close=")">
|
||||
#{item}
|
||||
</foreach>
|
||||
AND B.Pid = C.Id
|
||||
AND C.Scale = D.Id
|
||||
AND B.Pid = B1.Id
|
||||
AND B1.Pid = E.Id
|
||||
AND B1.Pid = B2.Id
|
||||
AND B2.Pid = B3.Id
|
||||
AND B3.Pid = B4.Id
|
||||
</select>
|
||||
|
||||
|
||||
</mapper>
|
||||
@@ -0,0 +1,36 @@
|
||||
package com.njcn.event.service;
|
||||
|
||||
|
||||
import com.njcn.device.pojo.param.DeviceInfoParam;
|
||||
import com.njcn.event.pojo.vo.AreaLineVO;
|
||||
import com.njcn.event.pojo.vo.EventHeatMapVO;
|
||||
import com.njcn.event.pojo.vo.EventSeverityVO;
|
||||
|
||||
/**
|
||||
* 区域暂降监测点统计
|
||||
* @author denghuajun
|
||||
* @version 1.0.0
|
||||
* @date 2022/4/6
|
||||
*/
|
||||
public interface AreaLineService {
|
||||
/**
|
||||
* 获取监测点分布详情
|
||||
* @param deviceInfoParam 参数
|
||||
* @return 结果
|
||||
*/
|
||||
AreaLineVO getAreaLineVO(DeviceInfoParam deviceInfoParam);
|
||||
|
||||
/**
|
||||
* 获取暂降热力图
|
||||
* @param deviceInfoParam 参数
|
||||
* @return 结果
|
||||
*/
|
||||
EventHeatMapVO getEventHeatMap (DeviceInfoParam.BusinessParam deviceInfoParam);
|
||||
|
||||
/**
|
||||
* 获取暂降严重度
|
||||
* @param deviceInfoParam 参数
|
||||
* @return 结果
|
||||
*/
|
||||
EventSeverityVO getEventSeverity (DeviceInfoParam.BusinessParam deviceInfoParam);
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
package com.njcn.event.service;
|
||||
|
||||
import com.njcn.event.pojo.po.EventDetail;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author denghuajun
|
||||
* @version 1.0.0
|
||||
* @date 2022年04月07日 09:39
|
||||
*/
|
||||
public interface EventDetailService {
|
||||
/**
|
||||
* 根据监测点id获取暂降事件
|
||||
*
|
||||
* @param id 监测点id
|
||||
* @return 暂降事件详情
|
||||
*/
|
||||
List<EventDetail> getEventDetailData(String id, String startTime, String endTime);
|
||||
|
||||
/**
|
||||
* 根据监测点id和时区时间time获取暂降事件
|
||||
*
|
||||
* @param id 监测点id
|
||||
* @return 暂降事件详情
|
||||
*/
|
||||
EventDetail getEventDetailByTime(String id, String time);
|
||||
|
||||
/**
|
||||
* 根据监测点集合获取暂态列表
|
||||
*/
|
||||
List<EventDetail> getEventDetail(List<String> lineIndexes, String startTime, String endTime);
|
||||
|
||||
/**
|
||||
* 根据监测点集合以及分页信息获取暂降事件
|
||||
*/
|
||||
List<EventDetail> getEventDetailLimit(List<String> lineIndexes, String startTime, String endTime, Integer pageSize, Integer pageNum);
|
||||
}
|
||||
@@ -0,0 +1,230 @@
|
||||
package com.njcn.event.service.Impl;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
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.LineDetailVO;
|
||||
import com.njcn.device.pojo.vo.LineDeviceStateVO;
|
||||
import com.njcn.event.pojo.vo.*;
|
||||
import com.njcn.device.pojo.vo.SubstationDetailVO;
|
||||
import com.njcn.event.service.AreaLineService;
|
||||
import com.njcn.influxdb.utils.InfluxDbUtils;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.influxdb.dto.QueryResult;
|
||||
import org.influxdb.impl.InfluxDBResultMapper;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* @author denghuajun
|
||||
* @version 1.0.0
|
||||
* @date 2022年04月07日 13:39
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class AreaLineServiceImpl implements AreaLineService {
|
||||
|
||||
private final GeneralDeviceInfoClient generalDeviceInfoClient;
|
||||
|
||||
private final LineFeignClient lineFeignClient;
|
||||
|
||||
private final InfluxDbUtils influxDbUtils;
|
||||
|
||||
|
||||
@Override
|
||||
public AreaLineVO getAreaLineVO(DeviceInfoParam deviceInfoParam) {
|
||||
AreaLineVO areaLineVO = new AreaLineVO();
|
||||
deviceInfoParam.setServerName(ServerEnum.EVENT.getName());
|
||||
List<List<Object>> listObject = new ArrayList<>();
|
||||
//获取暂降监测点
|
||||
List<GeneralDeviceDTO> generalDeviceDTOList = generalDeviceInfoClient.getPracticalAllDeviceInfo(deviceInfoParam).getData();
|
||||
List<String> lineIndexs;
|
||||
List<SubstationDetailVO> substationDetailVOList = new ArrayList<>();
|
||||
//获取所有终端信息
|
||||
for (GeneralDeviceDTO generalDeviceDTO : generalDeviceDTOList) {
|
||||
List<Object> objectList = new ArrayList<>();
|
||||
List<String> subIndexs;
|
||||
subIndexs = generalDeviceDTO.getSubIndexes();
|
||||
lineIndexs = generalDeviceDTO.getLineIndexes();
|
||||
//通讯正常个数
|
||||
int stateZc = 0;
|
||||
//通讯中断个数
|
||||
int stateZd = 0;
|
||||
//总次数
|
||||
int tail = 0;
|
||||
|
||||
String color = "";
|
||||
List<SubstationDetailVO> substationDetailVOS = new ArrayList<>();
|
||||
if (subIndexs.size() > 0) {
|
||||
List<LineDeviceStateVO> lineList = lineFeignClient.getAllLine(lineIndexs).getData();
|
||||
substationDetailVOS = lineFeignClient.getSubstationData(subIndexs).getData();
|
||||
for (int i = 0; i < substationDetailVOS.size(); i++) {
|
||||
List<LineDeviceStateVO> list = new ArrayList<>();
|
||||
list.addAll(lineList);
|
||||
Iterator<LineDeviceStateVO> iterator = list.listIterator();
|
||||
//获取监测点
|
||||
while (iterator.hasNext()) {
|
||||
LineDeviceStateVO line = iterator.next();
|
||||
String[] ids = line.getPids().split(",");
|
||||
if (!ids[3].equals(substationDetailVOS.get(i).getId())) {
|
||||
iterator.remove();
|
||||
}
|
||||
}
|
||||
List<LineDeviceStateVO> lineDataVOList = list;
|
||||
//通讯正常个数
|
||||
int stateTrue;
|
||||
stateTrue = 0;
|
||||
//通讯中断个数
|
||||
int stateFalse = 0;
|
||||
//次数
|
||||
double r = 0.0035;
|
||||
|
||||
int j = 0;
|
||||
//总的监测点个数
|
||||
int lineTail = lineDataVOList.size();
|
||||
for (LineDeviceStateVO lineDataVO : lineDataVOList) {
|
||||
if (lineDataVO.getState() == 1) {
|
||||
stateTrue++;
|
||||
color = "green";
|
||||
} else {
|
||||
stateFalse++;
|
||||
color = "red";
|
||||
}
|
||||
SubstationDetailVO substationDetail = new SubstationDetailVO();
|
||||
substationDetail.setId(lineDataVO.getId());
|
||||
substationDetail.setSrbName(lineDataVO.getName());
|
||||
substationDetail.setCoordY(substationDetailVOS.get(i).getCoordY().floatValue() + r * Math.cos(2 * Math.PI * j / lineTail));
|
||||
substationDetail.setCoordX(substationDetailVOS.get(i).getCoordX().floatValue() + r * Math.sin(2 * Math.PI * j / lineTail));
|
||||
substationDetail.setColor(color);
|
||||
substationDetailVOList.add(substationDetail);
|
||||
j++;
|
||||
}
|
||||
stateZc += stateTrue;
|
||||
stateZd += stateFalse;
|
||||
tail += lineTail;
|
||||
}
|
||||
}
|
||||
//获取变电站
|
||||
substationDetailVOList.addAll(substationDetailVOS);
|
||||
if (lineIndexs.size() > 0) {
|
||||
areaLineVO.setSubstationDetailVOList(substationDetailVOList);
|
||||
objectList.add(generalDeviceDTO.getName()+"\n("+tail+")");
|
||||
objectList.add(tail);
|
||||
objectList.add(stateZc);
|
||||
objectList.add(stateZd);
|
||||
listObject.add(objectList);
|
||||
}
|
||||
}
|
||||
areaLineVO.setAreaValue(listObject);
|
||||
return areaLineVO;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EventHeatMapVO getEventHeatMap(DeviceInfoParam.BusinessParam deviceInfoParam) {
|
||||
EventHeatMapVO eventHeatMapVO = new EventHeatMapVO();
|
||||
List<EventHeatMapDetailVO> eventHeatMapDetailList = new ArrayList<>();
|
||||
deviceInfoParam.setServerName(ServerEnum.EVENT.getName());
|
||||
List<List<Object>> 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();
|
||||
//获取暂降数据
|
||||
if (lineIndexs.size() > 0) {
|
||||
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);
|
||||
}
|
||||
objectList.add(generalDeviceDTO.getName()+"\n("+lineIndexs.size()+")");
|
||||
objectList.add(tail);
|
||||
listObject.add(objectList);
|
||||
}
|
||||
}
|
||||
i++;
|
||||
}
|
||||
eventHeatMapVO.setAreaValue(listObject);
|
||||
eventHeatMapVO.setEventHeatMapValue(eventHeatMapDetailList);
|
||||
return eventHeatMapVO;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EventSeverityVO getEventSeverity(DeviceInfoParam.BusinessParam deviceInfoParam) {
|
||||
EventSeverityVO eventSeverityVO = new EventSeverityVO();
|
||||
List<EventSeverityValueVO> eventSeverityValueList = new ArrayList<>();
|
||||
deviceInfoParam.setServerName(ServerEnum.EVENT.getName());
|
||||
List<List<Object>> 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();
|
||||
//获取暂降数据
|
||||
if (lineIndexs.size() > 0) {
|
||||
int tail = 0;
|
||||
EventSeverityValueVO eventSeverityValueVO = new EventSeverityValueVO();
|
||||
List<EventHeatDeatilVO> eventdetailList = getContion(deviceInfoParam, lineIndexs);
|
||||
if (eventdetailList.size()>0){
|
||||
for (int eventNum = 0; eventNum < eventdetailList.size(); eventNum++) {
|
||||
tail += eventdetailList.get(eventNum).getCount();
|
||||
}
|
||||
eventSeverityValueVO.setAreaName(generalDeviceDTO.getName());
|
||||
eventSeverityValueVO.setLineNum(lineIndexs.size());
|
||||
eventSeverityValueVO.setEventNum(tail);
|
||||
eventSeverityValueList.add(eventSeverityValueVO);
|
||||
objectList.add(generalDeviceDTO.getName()+"\n("+lineIndexs.size()+")");
|
||||
objectList.add(tail);
|
||||
listObject.add(objectList);
|
||||
}
|
||||
}
|
||||
i++;
|
||||
}
|
||||
eventSeverityVO.setAreaValue(listObject);
|
||||
eventSeverityVO.setEventSeverityValue(eventSeverityValueList);
|
||||
return eventSeverityVO;
|
||||
}
|
||||
|
||||
|
||||
public List<EventHeatDeatilVO> getContion(DeviceInfoParam.BusinessParam deviceInfoParam, List<String> lineIndexs) {
|
||||
//组装sql语句
|
||||
StringBuilder stringBuilder = new StringBuilder();
|
||||
stringBuilder.append("time >= '").append(DateUtil.beginOfDay(DateUtil.parse(deviceInfoParam.getSearchBeginTime()))).append("' and ").append("time <= '").append(DateUtil.endOfDay(DateUtil.parse(deviceInfoParam.getSearchEndTime()))).append("' and ");
|
||||
int j = 0;
|
||||
//sql语句
|
||||
for (String line : lineIndexs) {
|
||||
if (j == 0) {
|
||||
stringBuilder.append("line_id ='").append(line).append("'");
|
||||
} else {
|
||||
stringBuilder.append(" or line_id ='").append(line).append("'");
|
||||
}
|
||||
j++;
|
||||
}
|
||||
stringBuilder.append(" group by line_id");
|
||||
//获取暂降事件
|
||||
String sql = "select count(file_flag) from pqs_eventdetail where " + stringBuilder.toString();
|
||||
QueryResult result = influxDbUtils.query(sql);
|
||||
InfluxDBResultMapper influxDBResultMapper = new InfluxDBResultMapper();
|
||||
List<EventHeatDeatilVO> eventdetailList = influxDBResultMapper.toPOJO(result, EventHeatDeatilVO.class);
|
||||
return eventdetailList;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,117 @@
|
||||
package com.njcn.event.service.Impl;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.njcn.event.mapper.EventDetailMapper;
|
||||
import com.njcn.event.pojo.po.EventDetail;
|
||||
import com.njcn.event.service.EventDetailService;
|
||||
import com.njcn.influxdb.utils.InfluxDbUtils;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.influxdb.dto.QueryResult;
|
||||
import org.influxdb.impl.InfluxDBResultMapper;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author denghuajun
|
||||
* @version 1.0.0
|
||||
* @date 2022/3/16
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class EventDetailServiceImpl extends ServiceImpl<EventDetailMapper, EventDetail> implements EventDetailService {
|
||||
|
||||
private final InfluxDbUtils influxDbUtils;
|
||||
|
||||
@Override
|
||||
public List<EventDetail> getEventDetailData(String id, 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("'");
|
||||
|
||||
String sql = "select * from pqs_eventdetail where " + stringBuilder.toString();
|
||||
System.out.println("sql>>>>>>>>>>>>>>>>>>>>>>>>"+sql);
|
||||
//获取暂降事件
|
||||
QueryResult result = influxDbUtils.query(sql);
|
||||
InfluxDBResultMapper influxDBResultMapper = new InfluxDBResultMapper();
|
||||
List<EventDetail> eventDetailList = influxDBResultMapper.toPOJO(result, EventDetail.class);
|
||||
return eventDetailList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EventDetail getEventDetailByTime(String id, String time) {
|
||||
EventDetail eventDetail = new EventDetail();
|
||||
//组装sql语句
|
||||
StringBuilder stringBuilder = new StringBuilder();
|
||||
stringBuilder.append("time >= '").append(time).append("' and ").append("line_id ='").append(id).append("' limit 1 tz('Asia/Shanghai')");
|
||||
|
||||
String sql = "select * from pqs_eventdetail where " + stringBuilder;
|
||||
System.out.println("sql>>>>>>>>>>>>>>>>>>>>>>>>"+sql);
|
||||
//获取暂降事件
|
||||
QueryResult result = influxDbUtils.query(sql);
|
||||
InfluxDBResultMapper influxDBResultMapper = new InfluxDBResultMapper();
|
||||
List<EventDetail> detailList = influxDBResultMapper.toPOJO(result, EventDetail.class);
|
||||
if (!CollectionUtils.isEmpty(detailList)) {
|
||||
eventDetail = detailList.get(0);
|
||||
}
|
||||
return eventDetail;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<EventDetail> getEventDetail(List<String> lineIndexes, 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 ");
|
||||
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("' ");
|
||||
}
|
||||
}
|
||||
//sql语句
|
||||
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;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<EventDetail> getEventDetailLimit(List<String> lineIndexes, String startTime, String endTime, Integer pageSize, Integer pageNum) {
|
||||
//组装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("(");
|
||||
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 = (pageNum - 1)*pageSize;
|
||||
stringBuilder.append("LIMIT ").append(pageSize).append(" OFFSET ").append(i);
|
||||
//sql语句
|
||||
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;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,185 @@
|
||||
package com.njcn.event.service.Impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.njcn.common.pojo.dto.wave.WaveDataDTO;
|
||||
import com.njcn.common.pojo.enums.common.ServerEnum;
|
||||
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.LineDetailDataVO;
|
||||
import com.njcn.event.mapper.TransientMapper;
|
||||
import com.njcn.event.pojo.param.TransientParam;
|
||||
import com.njcn.event.pojo.po.EventDetail;
|
||||
import com.njcn.event.pojo.vo.TransientVO;
|
||||
import com.njcn.event.service.EventDetailService;
|
||||
import com.njcn.event.service.TransientService;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.text.DecimalFormat;
|
||||
import java.time.Instant;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.ZoneId;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @author: chenchao
|
||||
* @date: 2022/03/29 14:37
|
||||
* @Description: <描述>
|
||||
*/
|
||||
@Service
|
||||
@AllArgsConstructor
|
||||
public class TransientServiceImpl implements TransientService {
|
||||
|
||||
private final GeneralDeviceInfoClient generalDeviceInfoClient;
|
||||
|
||||
private final LineFeignClient lineFeignClient;
|
||||
|
||||
private final TransientMapper transientMapper;
|
||||
|
||||
private final EventDetailService eventDetailService;
|
||||
|
||||
@Override
|
||||
public Page<TransientVO> getTransientData(TransientParam transientParam) {
|
||||
Page<TransientVO> page = new Page<>();
|
||||
page.setSize(transientParam.getPageSize());
|
||||
page.setCurrent(transientParam.getPageNum());
|
||||
List<TransientVO> transientVOS = new ArrayList<>();
|
||||
transientParam.setServerName(ServerEnum.HARMONIC.getName());
|
||||
List<GeneralDeviceDTO> deviceList = generalDeviceInfoClient.getPracticalRunDeviceInfo(transientParam).getData();
|
||||
if (!CollectionUtils.isEmpty(deviceList)) {
|
||||
List<List<String>> lists = deviceList.stream().map(GeneralDeviceDTO::getLineIndexes).collect(Collectors.toList());
|
||||
List<String> lineList = new ArrayList<>();
|
||||
for (int i = 0; i<lists.size(); i++) {
|
||||
List<String> strings1 = lists.get(i);
|
||||
for (int a = 0; a<strings1.size(); a++) {
|
||||
lineList.add(strings1.get(a));
|
||||
}
|
||||
}
|
||||
if (!CollectionUtils.isEmpty(lineList)) {
|
||||
//influxDB查询待分页数据总量
|
||||
List<EventDetail> data = eventDetailService.getEventDetail(lineList, transientParam.getSearchBeginTime(), transientParam.getSearchEndTime());
|
||||
page.setTotal(data.size());
|
||||
//分页总页数
|
||||
int pages = (int)Math.ceil(data.size()*1.0/transientParam.getPageSize());
|
||||
page.setPages(pages);
|
||||
//influxDB分页查询
|
||||
List<EventDetail> eventDetailData = eventDetailService.getEventDetailLimit(lineList, transientParam.getSearchBeginTime(), transientParam.getSearchEndTime(), transientParam.getPageSize(), transientParam.getPageNum());
|
||||
// List<List<EventDetail>> partition = Lists.partition(eventDetailData, transientParam.getPageSize());
|
||||
// List<EventDetail> detailList = partition.get(transientParam.getPageNum() - 1);
|
||||
if (!CollectionUtils.isEmpty(eventDetailData)) {
|
||||
List<String> collect = eventDetailData.stream().map(EventDetail::getLineId).collect(Collectors.toList());
|
||||
List<TransientVO> transientData = transientMapper.getTransientData(collect);
|
||||
for (EventDetail eventDetail: eventDetailData) {
|
||||
if (!Objects.isNull(eventDetail)) {
|
||||
TransientVO transientVO = new TransientVO();
|
||||
transientVO.setId(eventDetail.getLineId());
|
||||
|
||||
Instant timeId = eventDetail.getTimeId();
|
||||
ZoneId zoneId = ZoneId.systemDefault();
|
||||
LocalDateTime localDateTime = LocalDateTime.ofInstant(timeId, zoneId);
|
||||
// //Instant转换long毫秒值
|
||||
// long milli = localDateTime.atZone(zoneId).toInstant().toEpochMilli();
|
||||
// System.out.println("milli==:" + milli);
|
||||
DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss.SSS");
|
||||
String format = dateTimeFormatter.format(localDateTime);
|
||||
|
||||
transientVO.setTime(format);
|
||||
switch (eventDetail.getWaveType()) {
|
||||
case 0:
|
||||
transientVO.setTrigType("扰动");
|
||||
break;
|
||||
case 1:
|
||||
transientVO.setTrigType("暂降");
|
||||
break;
|
||||
case 2:
|
||||
transientVO.setTrigType("赞升");
|
||||
break;
|
||||
case 3:
|
||||
transientVO.setTrigType("中断");
|
||||
break;
|
||||
case 4:
|
||||
transientVO.setTrigType("其他");
|
||||
break;
|
||||
case 5:
|
||||
transientVO.setTrigType("录波");
|
||||
break;
|
||||
}
|
||||
Double value = new BigDecimal(eventDetail.getEventValue()).setScale(3, BigDecimal.ROUND_DOWN).doubleValue();
|
||||
transientVO.setEventValue(value);
|
||||
Double values = new BigDecimal(1 - value).setScale(3, BigDecimal.ROUND_DOWN).doubleValue();
|
||||
transientVO.setEventValues(values);
|
||||
transientVO.setPersistTime((Float.parseFloat(eventDetail.getPersistTime().toString()))/1000);
|
||||
|
||||
Float eventValue = Float.parseFloat(eventDetail.getEventValue().toString());
|
||||
transientVO.setYZD(getYZD(transientVO.getPersistTime(), eventValue));
|
||||
transientVOS.add(transientVO);
|
||||
}
|
||||
}
|
||||
transientVOS.stream().map(list1 -> transientData.stream().filter(list2 -> Objects.equals(list1.getId(), list2.getId())).findAny().map(m -> {
|
||||
list1.setName(m.getName());
|
||||
list1.setPowerCompany(m.getPowerCompany());
|
||||
list1.setSubstation(m.getSubstation());
|
||||
list1.setNetworkParam(m.getNetworkParam());
|
||||
list1.setVoltageLevel(m.getVoltageLevel());
|
||||
return list1;
|
||||
})).collect(Collectors.toList());
|
||||
//当前页数据
|
||||
page.setRecords(transientVOS);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
return page;
|
||||
}
|
||||
|
||||
@Override
|
||||
public WaveDataDTO getTransientAnalyseWave(String timeId, String lineId) {
|
||||
//根据监测点id获取监测点详情
|
||||
LineDetailDataVO lineDetailData = lineFeignClient.getLineDetailData(lineId).getData();
|
||||
String ip = lineDetailData.getIp();
|
||||
EventDetail eventDetailByTime = eventDetailService.getEventDetailByTime(lineId, timeId);
|
||||
String waveName = eventDetailByTime.getWaveName();
|
||||
AnalyWave analyWave = new AnalyWave();
|
||||
System.out.println("path----------------------"+"C:\\Users\\陈超\\Desktop\\Comtrade\\"+ip+"\\"+waveName);
|
||||
WaveDataDTO comtrade = analyWave.getComtrade("C:\\Users\\陈超\\Desktop\\Comtrade\\192.168.0.58\\222.CFG", 1);
|
||||
// WaveDataDTO comtrade = analyWave.getComtrade("C:\\Users\\陈超\\Desktop\\Comtrade\\"+ip+"\\"+waveName, 1);
|
||||
WaveDataDTO waveDataDTO = analyWave.getValidData(comtrade);
|
||||
return waveDataDTO;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取该事件的严重度
|
||||
*
|
||||
* @param persistTime 持续时间 ms单位
|
||||
* @param eventValue 暂降、暂升幅值
|
||||
*/
|
||||
public static String getYZD(Float persistTime, Float eventValue) {
|
||||
float yzd;
|
||||
DecimalFormat df = new DecimalFormat("0.000");// 格式化小数
|
||||
if (persistTime <= 20) {
|
||||
yzd = 1 - eventValue;
|
||||
} else if (persistTime > 20 && persistTime <= 200) {
|
||||
yzd = 2 * (1 - eventValue);
|
||||
} else if (persistTime > 200 && persistTime <= 500) {
|
||||
yzd = 3.3f * (1 - eventValue);
|
||||
} else if (persistTime > 500 && persistTime <= 10000) {
|
||||
yzd = 5 * (1 - eventValue);
|
||||
} else {
|
||||
yzd = 10 * (1 - eventValue);
|
||||
}
|
||||
String tempOnlineRate = df.format(yzd);// 返回的是String类型
|
||||
return tempOnlineRate;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
package com.njcn.event.service;
|
||||
|
||||
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.vo.TransientVO;
|
||||
|
||||
/**
|
||||
* @author: chenchao
|
||||
* @date: 2022/03/29 10:40
|
||||
* @Description: <描述>
|
||||
*/
|
||||
public interface TransientService {
|
||||
|
||||
/**
|
||||
* 功能描述: 获取暂态事件相关信息
|
||||
* @param transientParam
|
||||
* @return
|
||||
*/
|
||||
Page<TransientVO> getTransientData(TransientParam transientParam);
|
||||
/**
|
||||
* 功能描述: 暂态事件波形分析
|
||||
* @param timeId
|
||||
* @param lineId
|
||||
* @return
|
||||
*/
|
||||
WaveDataDTO getTransientAnalyseWave(String timeId, String lineId);
|
||||
|
||||
}
|
||||
54
pqs-event/event-boot/src/main/resources/bootstrap.yml
Normal file
54
pqs-event/event-boot/src/main/resources/bootstrap.yml
Normal file
@@ -0,0 +1,54 @@
|
||||
#当前服务的基本信息
|
||||
microservice:
|
||||
ename: @artifactId@
|
||||
name: '@name@'
|
||||
version: @version@
|
||||
sentinel:
|
||||
url: @sentinel.url@
|
||||
gateway:
|
||||
url: @gateway.url@
|
||||
server:
|
||||
port: 10203
|
||||
#feign接口开启服务熔断降级处理
|
||||
feign:
|
||||
sentinel:
|
||||
enabled: true
|
||||
spring:
|
||||
application:
|
||||
name: @artifactId@
|
||||
#nacos注册中心以及配置中心的指定
|
||||
cloud:
|
||||
nacos:
|
||||
discovery:
|
||||
server-addr: @nacos.url@
|
||||
namespace: @nacos.namespace@
|
||||
config:
|
||||
server-addr: @nacos.url@
|
||||
namespace: @nacos.namespace@
|
||||
file-extension: yaml
|
||||
shared-configs:
|
||||
- data-id: share-config.yaml
|
||||
refresh: true
|
||||
- data-Id: share-config-datasource-db.yaml
|
||||
refresh: true
|
||||
main:
|
||||
allow-bean-definition-overriding: true
|
||||
|
||||
|
||||
#项目日志的配置
|
||||
logging:
|
||||
config: http://@nacos.url@/nacos/v1/cs/configs?tenant=@nacos.namespace@&group=DEFAULT_GROUP&dataId=logback.xml
|
||||
level:
|
||||
root: info
|
||||
|
||||
|
||||
#mybatis配置信息
|
||||
mybatis-plus:
|
||||
type-aliases-package: com.njcn.event.pojo
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user