Compare commits
57 Commits
0383bff7fd
...
2026-03
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
09fe5ca317 | ||
|
|
7412e2beda | ||
|
|
90baa65b71 | ||
| 3f9e2076d2 | |||
| 1bda6b1156 | |||
| d3b4146674 | |||
| 365448d8a0 | |||
| d3e46f5ba4 | |||
| 35939e6f8f | |||
| ba1f5a2e00 | |||
|
|
97e3386d53 | ||
| 4f8c34d21b | |||
|
|
fd398a85de | ||
|
|
1aae135e83 | ||
| 60bad4bc06 | |||
| fe3c0363fb | |||
| 718fd012c8 | |||
|
|
7bac8f5b14 | ||
|
|
fec6e6c27d | ||
| fe2e3b118d | |||
| dbf0027c65 | |||
| 91ff704f0a | |||
|
|
4c239b1604 | ||
|
|
ab96d247fa | ||
|
|
e49dee8263 | ||
|
|
e126a3f800 | ||
|
|
f09409c553 | ||
|
|
63f20da451 | ||
| 1043097a11 | |||
| 713db187c5 | |||
| 6b21e9927a | |||
|
|
c5cb96e8d6 | ||
|
|
76f9c9cb10 | ||
| 386fd1ed1e | |||
| d8d516f63d | |||
|
|
074c020b10 | ||
|
|
af781010f6 | ||
| ca0dd1eea0 | |||
|
|
76deaeee71 | ||
|
|
6a6f7c2f77 | ||
|
|
b0972ba896 | ||
|
|
5afb860467 | ||
|
|
2624d7d495 | ||
|
|
bc1854258d | ||
|
|
438f618d8a | ||
| 89df5f3039 | |||
|
|
8ce1f83531 | ||
|
|
14a13d631c | ||
|
|
11ee847cac | ||
|
|
9261adb79a | ||
|
|
e0154fb3ef | ||
|
|
7bee39f076 | ||
|
|
99f12e74fb | ||
|
|
648a5e1947 | ||
|
|
f519fd3e56 | ||
|
|
536ee24888 | ||
|
|
2159525ed9 |
@@ -58,6 +58,6 @@ public class BaseParam implements Serializable {
|
|||||||
@ApiModelProperty(name = "idList",value = "索引集合")
|
@ApiModelProperty(name = "idList",value = "索引集合")
|
||||||
private List<String> idList;
|
private List<String> idList;
|
||||||
|
|
||||||
@ApiModelProperty(name = "type",value = "0:通用 1:省级平台 ")
|
@ApiModelProperty(name = "type",value = "0:通用 1:省级平台 2:物联平台")
|
||||||
private Integer type;
|
private Integer type;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -42,4 +42,8 @@ public interface LiteFlowAlgorithmFeignClient {
|
|||||||
@ApiOperation("新能源专项分析算法执行链")
|
@ApiOperation("新能源专项分析算法执行链")
|
||||||
@PostMapping("/specialAnalysis")
|
@PostMapping("/specialAnalysis")
|
||||||
void specialAnalysisExecutor(@RequestBody BaseParam baseParam);
|
void specialAnalysisExecutor(@RequestBody BaseParam baseParam);
|
||||||
|
|
||||||
|
@ApiOperation("物联监测点算法执行链")
|
||||||
|
@PostMapping("/wlMeasurementPointExecutor")
|
||||||
|
void wlMeasurementPointExecutor(@RequestBody BaseParam baseParam);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -52,6 +52,12 @@ public class LiteFlowAlgorithmFeignClientFallbackFactory implements FallbackFact
|
|||||||
throw new BusinessException(finalExceptionEnum);
|
throw new BusinessException(finalExceptionEnum);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void wlMeasurementPointExecutor(BaseParam baseParam) {
|
||||||
|
log.error("{}异常,降级处理,异常为:{}", "物联监测点算法执行链: ", throwable.toString());
|
||||||
|
throw new BusinessException(finalExceptionEnum);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void deviceExecutor(BaseParam baseParam) {
|
public void deviceExecutor(BaseParam baseParam) {
|
||||||
log.error("{}异常,降级处理,异常为:{}", "装置算法执行链: ", throwable.toString());
|
log.error("{}异常,降级处理,异常为:{}", "装置算法执行链: ", throwable.toString());
|
||||||
|
|||||||
@@ -104,6 +104,11 @@
|
|||||||
<artifactId>pq-device-api</artifactId>
|
<artifactId>pq-device-api</artifactId>
|
||||||
<version>${project.version}</version>
|
<version>${project.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.njcn</groupId>
|
||||||
|
<artifactId>cs-device-api</artifactId>
|
||||||
|
<version>${project.version}</version>
|
||||||
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.njcn</groupId>
|
<groupId>com.njcn</groupId>
|
||||||
<artifactId>common-event</artifactId>
|
<artifactId>common-event</artifactId>
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import org.springframework.boot.SpringApplication;
|
|||||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||||
import org.springframework.cloud.openfeign.EnableFeignClients;
|
import org.springframework.cloud.openfeign.EnableFeignClients;
|
||||||
import org.springframework.context.annotation.DependsOn;
|
import org.springframework.context.annotation.DependsOn;
|
||||||
|
import org.springframework.scheduling.annotation.EnableAsync;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -16,6 +17,7 @@ import org.springframework.context.annotation.DependsOn;
|
|||||||
@SpringBootApplication(scanBasePackages = "com.njcn")
|
@SpringBootApplication(scanBasePackages = "com.njcn")
|
||||||
@MapperScan("com.njcn.**.mapper")
|
@MapperScan("com.njcn.**.mapper")
|
||||||
@DependsOn("proxyMapperRegister")
|
@DependsOn("proxyMapperRegister")
|
||||||
|
@EnableAsync
|
||||||
public class AlgorithmBootApplication {
|
public class AlgorithmBootApplication {
|
||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
|
|||||||
@@ -2,19 +2,25 @@ package com.njcn.algorithm;
|
|||||||
|
|
||||||
import cn.hutool.core.bean.BeanUtil;
|
import cn.hutool.core.bean.BeanUtil;
|
||||||
import cn.hutool.core.collection.CollectionUtil;
|
import cn.hutool.core.collection.CollectionUtil;
|
||||||
import cn.hutool.core.date.*;
|
import cn.hutool.core.date.DatePattern;
|
||||||
import cn.hutool.core.text.StrPool;
|
import cn.hutool.core.date.DateTime;
|
||||||
|
import cn.hutool.core.date.DateUnit;
|
||||||
|
import cn.hutool.core.date.DateUtil;
|
||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
import com.njcn.algorithm.pojo.bo.BaseParam;
|
import com.njcn.algorithm.pojo.bo.BaseParam;
|
||||||
import com.njcn.algorithm.pojo.bo.CalculatedParam;
|
import com.njcn.algorithm.pojo.bo.CalculatedParam;
|
||||||
import com.njcn.algorithm.pojo.bo.HourParam;
|
import com.njcn.algorithm.pojo.bo.HourParam;
|
||||||
import com.njcn.algorithm.pojo.enums.PrepareResponseEnum;
|
import com.njcn.algorithm.pojo.enums.PrepareResponseEnum;
|
||||||
import com.njcn.algorithm.utils.MemorySizeUtil;
|
import com.njcn.algorithm.service.line.FlowAsyncService;
|
||||||
import com.njcn.common.pojo.annotation.OperateInfo;
|
import com.njcn.common.pojo.annotation.OperateInfo;
|
||||||
import com.njcn.common.pojo.enums.common.LogEnum;
|
import com.njcn.common.pojo.enums.common.LogEnum;
|
||||||
import com.njcn.common.pojo.exception.BusinessException;
|
import com.njcn.common.pojo.exception.BusinessException;
|
||||||
|
import com.njcn.csdevice.api.CsLineFeignClient;
|
||||||
import com.njcn.device.biz.commApi.CommTerminalGeneralClient;
|
import com.njcn.device.biz.commApi.CommTerminalGeneralClient;
|
||||||
import com.njcn.device.biz.pojo.dto.*;
|
import com.njcn.device.biz.pojo.dto.DeptGetChildrenMoreDTO;
|
||||||
|
import com.njcn.device.biz.pojo.dto.DeptGetDeviceDTO;
|
||||||
|
import com.njcn.device.biz.pojo.dto.DeptGetSubStationDTO;
|
||||||
|
import com.njcn.device.biz.pojo.dto.LineDevGetDTO;
|
||||||
import com.njcn.device.biz.pojo.param.DeptGetLineParam;
|
import com.njcn.device.biz.pojo.param.DeptGetLineParam;
|
||||||
import com.njcn.device.pq.api.DeptLineFeignClient;
|
import com.njcn.device.pq.api.DeptLineFeignClient;
|
||||||
import com.njcn.user.api.DeptFeignClient;
|
import com.njcn.user.api.DeptFeignClient;
|
||||||
@@ -22,7 +28,6 @@ import com.njcn.user.pojo.po.Dept;
|
|||||||
import com.njcn.web.controller.BaseController;
|
import com.njcn.web.controller.BaseController;
|
||||||
import com.yomahub.liteflow.core.FlowExecutor;
|
import com.yomahub.liteflow.core.FlowExecutor;
|
||||||
import com.yomahub.liteflow.flow.LiteflowResponse;
|
import com.yomahub.liteflow.flow.LiteflowResponse;
|
||||||
import com.yomahub.liteflow.flow.entity.CmpStep;
|
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
import io.swagger.annotations.ApiOperation;
|
import io.swagger.annotations.ApiOperation;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
@@ -40,6 +45,8 @@ import javax.annotation.Resource;
|
|||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
import static com.njcn.algorithm.utils.MemorySizeUtil.dealResponse;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author hongawen
|
* @author hongawen
|
||||||
* @version 1.0.0
|
* @version 1.0.0
|
||||||
@@ -62,6 +69,10 @@ public class ExecutionCenter extends BaseController {
|
|||||||
private FlowExecutor flowExecutor;
|
private FlowExecutor flowExecutor;
|
||||||
@Resource
|
@Resource
|
||||||
private DeptLineFeignClient deptLineFeignClient;
|
private DeptLineFeignClient deptLineFeignClient;
|
||||||
|
@Resource
|
||||||
|
private CsLineFeignClient csLineFeignClient;
|
||||||
|
@Resource
|
||||||
|
private FlowAsyncService flowService;
|
||||||
|
|
||||||
/***
|
/***
|
||||||
* 1、校验非全链执行时,tagNames节点标签集合必须为非空,否则提示---无可执行节点
|
* 1、校验非全链执行时,tagNames节点标签集合必须为非空,否则提示---无可执行节点
|
||||||
@@ -86,41 +97,6 @@ public class ExecutionCenter extends BaseController {
|
|||||||
return calculatedParam;
|
return calculatedParam;
|
||||||
}
|
}
|
||||||
|
|
||||||
/***
|
|
||||||
*
|
|
||||||
* @author hongawen
|
|
||||||
* @date 2023/11/7 14:44
|
|
||||||
*/
|
|
||||||
private void dealResponse(CalculatedParam calculatedParam, LiteflowResponse liteflowResponse, String methodDescribe) {
|
|
||||||
MemorySizeUtil.getNowMemory();
|
|
||||||
if (liteflowResponse.isSuccess()) {
|
|
||||||
// 获取执行步骤列表
|
|
||||||
long allTime = 0;
|
|
||||||
Map<String, List<CmpStep>> executeSteps = liteflowResponse.getExecuteSteps();
|
|
||||||
for (String key : executeSteps.keySet()) {
|
|
||||||
List<CmpStep> cmpSteps = executeSteps.get(key);
|
|
||||||
long timeSum = cmpSteps.stream().mapToLong(CmpStep::getTimeSpent).sum();
|
|
||||||
allTime+=timeSum;
|
|
||||||
}
|
|
||||||
logger.info("日期{},{}执行{}成功,执行总时长{}分钟", calculatedParam.getDataDate(), methodDescribe, calculatedParam.isFullChain() ? "全链" : "指定节点:".concat(String.join(StrPool.COMMA, calculatedParam.getTagNames())),allTime/1000/60);
|
|
||||||
} else {
|
|
||||||
Map<String, List<CmpStep>> executeSteps = liteflowResponse.getExecuteSteps();
|
|
||||||
CmpStep failStep = null;
|
|
||||||
for (String key : executeSteps.keySet()) {
|
|
||||||
List<CmpStep> cmpSteps = executeSteps.get(key);
|
|
||||||
cmpSteps = cmpSteps.stream().filter(cmpStep -> !cmpStep.isSuccess()).collect(Collectors.toList());
|
|
||||||
if (CollectionUtil.isNotEmpty(cmpSteps)) {
|
|
||||||
failStep = cmpSteps.get(0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
logger.error("日期{},{}执行{}失败,在执行{}失败,失败原因:{}"
|
|
||||||
, calculatedParam.getDataDate()
|
|
||||||
, methodDescribe
|
|
||||||
, calculatedParam.isFullChain() ? "全链" : "指定节点:".concat(String.join(StrPool.COMMA, calculatedParam.getTagNames()))
|
|
||||||
, failStep.getNodeId().concat(Objects.isNull(failStep.getTag()) ? "" : StrPool.DASHED.concat(failStep.getTag()))
|
|
||||||
, Objects.isNull(failStep.getException()) ? null : failStep.getException().getMessage());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||||
@@ -142,20 +118,57 @@ public class ExecutionCenter extends BaseController {
|
|||||||
DateTime endDate = DateUtil.parse(baseParam.getEndTime(), DatePattern.NORM_DATE_FORMAT);
|
DateTime endDate = DateUtil.parse(baseParam.getEndTime(), DatePattern.NORM_DATE_FORMAT);
|
||||||
long betweenDay = DateUtil.betweenDay(startDate, endDate, true);
|
long betweenDay = DateUtil.betweenDay(startDate, endDate, true);
|
||||||
//递增日期执行算法链
|
//递增日期执行算法链
|
||||||
for (int i = 0; i < betweenDay; i++) {
|
for (int i = 0; i <= betweenDay; i++) {
|
||||||
if (i != 0) {
|
if (i != 0) {
|
||||||
startDate = DateUtil.offsetDay(startDate, 1);
|
startDate = DateUtil.offsetDay(startDate, 1);
|
||||||
}
|
}
|
||||||
calculatedParam.setDataDate(DateUtil.format(startDate, DatePattern.NORM_DATE_PATTERN));
|
calculatedParam.setDataDate(DateUtil.format(startDate, DatePattern.NORM_DATE_PATTERN));
|
||||||
|
CalculatedParam repairParam = BeanUtil.copyProperties(calculatedParam, CalculatedParam.class);
|
||||||
|
repairParam.setType(0);
|
||||||
|
flowService.execute2Resp(methodDescribe, repairParam);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
//非补招
|
||||||
|
calculatedParam.setType(0);
|
||||||
liteflowResponse = flowExecutor.execute2Resp("measurement_point", calculatedParam);
|
liteflowResponse = flowExecutor.execute2Resp("measurement_point", calculatedParam);
|
||||||
dealResponse(calculatedParam, liteflowResponse, methodDescribe);
|
dealResponse(calculatedParam, liteflowResponse, methodDescribe);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||||
|
@ApiOperation("物联监测点算法执行链")
|
||||||
|
@PostMapping("/wlMeasurementPointExecutor")
|
||||||
|
@Async("asyncExecutor")
|
||||||
|
public void wlMeasurementPointExecutor(@RequestBody BaseParam baseParam) {
|
||||||
|
String methodDescribe = getMethodDescribe("wlMeasurementPointExecutor");
|
||||||
|
//手动判断参数是否合法,
|
||||||
|
CalculatedParam calculatedParam = judgeExecuteParam(baseParam);
|
||||||
|
// 测点索引
|
||||||
|
if (CollectionUtils.isEmpty(calculatedParam.getIdList())) {
|
||||||
|
calculatedParam.setIdList(csLineFeignClient.getAllLine().getData());
|
||||||
|
}
|
||||||
|
LiteflowResponse liteflowResponse;
|
||||||
|
if (baseParam.isRepair()) {
|
||||||
|
//补招时,起始日期、截止日期必填
|
||||||
|
DateTime startDate = DateUtil.parse(baseParam.getBeginTime(), DatePattern.NORM_DATE_FORMAT);
|
||||||
|
DateTime endDate = DateUtil.parse(baseParam.getEndTime(), DatePattern.NORM_DATE_FORMAT);
|
||||||
|
long betweenDay = DateUtil.betweenDay(startDate, endDate, true);
|
||||||
|
//递增日期执行算法链
|
||||||
|
for (int i = 0; i <= betweenDay; i++) {
|
||||||
|
if (i != 0) {
|
||||||
|
startDate = DateUtil.offsetDay(startDate, 1);
|
||||||
|
}
|
||||||
|
calculatedParam.setDataDate(DateUtil.format(startDate, DatePattern.NORM_DATE_PATTERN));
|
||||||
|
calculatedParam.setType(2);
|
||||||
|
liteflowResponse = flowExecutor.execute2Resp("wl_measurement_point", calculatedParam);
|
||||||
|
dealResponse(calculatedParam, liteflowResponse, methodDescribe);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
//非补招
|
//非补招
|
||||||
liteflowResponse = flowExecutor.execute2Resp("measurement_point", calculatedParam);
|
calculatedParam.setType(2);
|
||||||
|
liteflowResponse = flowExecutor.execute2Resp("wl_measurement_point", calculatedParam);
|
||||||
dealResponse(calculatedParam, liteflowResponse, methodDescribe);
|
dealResponse(calculatedParam, liteflowResponse, methodDescribe);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||||
@@ -177,7 +190,7 @@ public class ExecutionCenter extends BaseController {
|
|||||||
DateTime endDate = DateUtil.parse(baseParam.getEndTime(), DatePattern.NORM_DATE_FORMAT);
|
DateTime endDate = DateUtil.parse(baseParam.getEndTime(), DatePattern.NORM_DATE_FORMAT);
|
||||||
long betweenDay = DateUtil.betweenDay(startDate, endDate, true);
|
long betweenDay = DateUtil.betweenDay(startDate, endDate, true);
|
||||||
//递增日期执行算法链
|
//递增日期执行算法链
|
||||||
for (int i = 0; i < betweenDay; i++) {
|
for (int i = 0; i <= betweenDay; i++) {
|
||||||
if (i != 0) {
|
if (i != 0) {
|
||||||
startDate = DateUtil.offsetDay(startDate, 1);
|
startDate = DateUtil.offsetDay(startDate, 1);
|
||||||
}
|
}
|
||||||
@@ -220,7 +233,7 @@ public class ExecutionCenter extends BaseController {
|
|||||||
DateTime endDate = DateUtil.parse(baseParam.getEndTime(), DatePattern.NORM_DATETIME_FORMAT);
|
DateTime endDate = DateUtil.parse(baseParam.getEndTime(), DatePattern.NORM_DATETIME_FORMAT);
|
||||||
long betweenHour = DateUtil.between(startDate, endDate, DateUnit.HOUR);
|
long betweenHour = DateUtil.between(startDate, endDate, DateUnit.HOUR);
|
||||||
//递增日期执行算法链
|
//递增日期执行算法链
|
||||||
for (int i = 0; i < betweenHour; i++) {
|
for (int i = 0; i <= betweenHour; i++) {
|
||||||
if (i != 0) {
|
if (i != 0) {
|
||||||
startDate = DateUtil.offsetHour(startDate, 1);
|
startDate = DateUtil.offsetHour(startDate, 1);
|
||||||
}
|
}
|
||||||
@@ -262,7 +275,7 @@ public class ExecutionCenter extends BaseController {
|
|||||||
DateTime endDate = DateUtil.parse(baseParam.getEndTime(), DatePattern.NORM_DATE_FORMAT);
|
DateTime endDate = DateUtil.parse(baseParam.getEndTime(), DatePattern.NORM_DATE_FORMAT);
|
||||||
long betweenDay = DateUtil.betweenDay(startDate, endDate, true);
|
long betweenDay = DateUtil.betweenDay(startDate, endDate, true);
|
||||||
//递增日期执行算法链
|
//递增日期执行算法链
|
||||||
for (int i = 0; i < betweenDay; i++) {
|
for (int i = 0; i <= betweenDay; i++) {
|
||||||
if (i != 0) {
|
if (i != 0) {
|
||||||
startDate = DateUtil.offsetDay(startDate, 1);
|
startDate = DateUtil.offsetDay(startDate, 1);
|
||||||
}
|
}
|
||||||
@@ -301,7 +314,7 @@ public class ExecutionCenter extends BaseController {
|
|||||||
DateTime endDate = DateUtil.parse(baseParam.getEndTime(), DatePattern.NORM_DATE_FORMAT);
|
DateTime endDate = DateUtil.parse(baseParam.getEndTime(), DatePattern.NORM_DATE_FORMAT);
|
||||||
long betweenDay = DateUtil.betweenDay(startDate, endDate, true);
|
long betweenDay = DateUtil.betweenDay(startDate, endDate, true);
|
||||||
//递增日期执行算法链
|
//递增日期执行算法链
|
||||||
for (int i = 0; i < betweenDay; i++) {
|
for (int i = 0; i <= betweenDay; i++) {
|
||||||
if (i != 0) {
|
if (i != 0) {
|
||||||
startDate = DateUtil.offsetDay(startDate, 1);
|
startDate = DateUtil.offsetDay(startDate, 1);
|
||||||
}
|
}
|
||||||
@@ -389,7 +402,7 @@ public class ExecutionCenter extends BaseController {
|
|||||||
DateTime endDate = DateUtil.parse(baseParam.getEndTime(), DatePattern.NORM_DATE_FORMAT);
|
DateTime endDate = DateUtil.parse(baseParam.getEndTime(), DatePattern.NORM_DATE_FORMAT);
|
||||||
long betweenDay = DateUtil.betweenDay(startDate, endDate, true);
|
long betweenDay = DateUtil.betweenDay(startDate, endDate, true);
|
||||||
//递增日期执行算法链
|
//递增日期执行算法链
|
||||||
for (int i = 0; i < betweenDay; i++) {
|
for (int i = 0; i <= betweenDay; i++) {
|
||||||
if (i != 0) {
|
if (i != 0) {
|
||||||
startDate = DateUtil.offsetDay(startDate, 1);
|
startDate = DateUtil.offsetDay(startDate, 1);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,6 +2,8 @@ package com.njcn.algorithm.executor;
|
|||||||
|
|
||||||
import com.njcn.algorithm.pojo.bo.CalculatedParam;
|
import com.njcn.algorithm.pojo.bo.CalculatedParam;
|
||||||
import com.njcn.algorithm.service.line.*;
|
import com.njcn.algorithm.service.line.*;
|
||||||
|
import com.njcn.dataProcess.api.RmpVThdFeignClient;
|
||||||
|
import com.njcn.dataProcess.pojo.dto.RMpVThd;
|
||||||
import com.yomahub.liteflow.annotation.LiteflowComponent;
|
import com.yomahub.liteflow.annotation.LiteflowComponent;
|
||||||
import com.yomahub.liteflow.annotation.LiteflowMethod;
|
import com.yomahub.liteflow.annotation.LiteflowMethod;
|
||||||
import com.yomahub.liteflow.core.NodeComponent;
|
import com.yomahub.liteflow.core.NodeComponent;
|
||||||
@@ -11,6 +13,7 @@ import lombok.RequiredArgsConstructor;
|
|||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -39,6 +42,8 @@ public class MeasurementExecutor extends BaseExecutor {
|
|||||||
private IPollutionService pollutionService;
|
private IPollutionService pollutionService;
|
||||||
@Resource
|
@Resource
|
||||||
private IPollutionCalc pollutionCalc;
|
private IPollutionCalc pollutionCalc;
|
||||||
|
@Resource
|
||||||
|
private RmpVThdFeignClient rmpVThdFeignClient;
|
||||||
/**
|
/**
|
||||||
* 数据质量清洗
|
* 数据质量清洗
|
||||||
*/
|
*/
|
||||||
@@ -481,6 +486,24 @@ public class MeasurementExecutor extends BaseExecutor {
|
|||||||
dataIntegrityService.dataIntegrity(bindCmp.getRequestData());
|
dataIntegrityService.dataIntegrity(bindCmp.getRequestData());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 算法名: 3.4.1.6.1-----监测点谐波畸变率_日表(r_mp_v_thd)
|
||||||
|
*
|
||||||
|
* @author xuyang
|
||||||
|
* @date 2023年11月13日 19:34
|
||||||
|
*/
|
||||||
|
@LiteflowMethod(value = LiteFlowMethodEnum.IS_ACCESS, nodeId = "rMpVThd", nodeType = NodeTypeEnum.COMMON)
|
||||||
|
public boolean rMpVThdAccess(NodeComponent bindCmp) {
|
||||||
|
return isAccess(bindCmp);
|
||||||
|
}
|
||||||
|
@LiteflowMethod(value = LiteFlowMethodEnum.PROCESS, nodeId = "rMpVThd", nodeType = NodeTypeEnum.COMMON)
|
||||||
|
public void rMpVThdProcess(NodeComponent bindCmp) {
|
||||||
|
List<RMpVThd> data = rmpVThdFeignClient.queryThd(bindCmp.getRequestData()).getData();
|
||||||
|
rmpVThdFeignClient.batchInsertionThd(data);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,45 @@
|
|||||||
|
package com.njcn.algorithm.service.line;
|
||||||
|
|
||||||
|
import com.njcn.algorithm.pojo.bo.CalculatedParam;
|
||||||
|
import com.njcn.dataProcess.pojo.dto.PqReasonableRangeDto;
|
||||||
|
import com.njcn.device.pq.pojo.vo.LineDetailVO;
|
||||||
|
import com.njcn.system.pojo.po.DictData;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
public interface FlowAsyncService {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 算法多线程执行
|
||||||
|
* @param methodDescribe
|
||||||
|
* @param calculatedParam
|
||||||
|
* @Author: wr
|
||||||
|
* @Date: 2025/12/17 9:25
|
||||||
|
*/
|
||||||
|
void execute2Resp(String methodDescribe,CalculatedParam calculatedParam);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 多线程数据清洗方法
|
||||||
|
* @param line
|
||||||
|
* @param map
|
||||||
|
* @param dataDate
|
||||||
|
* @param dip
|
||||||
|
* @param rise
|
||||||
|
* @param size
|
||||||
|
* @param i
|
||||||
|
* @Author: wr
|
||||||
|
* @Date: 2025/12/17 10:48
|
||||||
|
*/
|
||||||
|
void lineDataClean(LineDetailVO.Detail line,
|
||||||
|
Map<String, List<PqReasonableRangeDto>> map,
|
||||||
|
String dataDate,
|
||||||
|
DictData dip,
|
||||||
|
DictData rise,
|
||||||
|
int size,
|
||||||
|
int i
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -2,6 +2,8 @@ package com.njcn.algorithm.service.line;
|
|||||||
|
|
||||||
import com.njcn.algorithm.pojo.bo.CalculatedParam;
|
import com.njcn.algorithm.pojo.bo.CalculatedParam;
|
||||||
|
|
||||||
|
import java.util.concurrent.CompletableFuture;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author xy
|
* @author xy
|
||||||
*/
|
*/
|
||||||
@@ -92,4 +94,5 @@ public interface IDataCleanService {
|
|||||||
* @param calculatedParam 查询条件
|
* @param calculatedParam 查询条件
|
||||||
*/
|
*/
|
||||||
void dataFlickerCleanHandler(CalculatedParam calculatedParam);
|
void dataFlickerCleanHandler(CalculatedParam calculatedParam);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,32 @@
|
|||||||
|
package com.njcn.algorithm.service.line;
|
||||||
|
|
||||||
|
import com.njcn.device.biz.pojo.po.Overlimit;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.concurrent.CompletableFuture;
|
||||||
|
|
||||||
|
public interface IDataLimitRateAsync {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* limit_rate多线程算法
|
||||||
|
*
|
||||||
|
* @param dataDate
|
||||||
|
* @param list
|
||||||
|
* @param phase
|
||||||
|
* @param overLimitMap
|
||||||
|
* @param size
|
||||||
|
* @param i
|
||||||
|
* @param type 系统类型
|
||||||
|
* @return
|
||||||
|
* @Author: wr
|
||||||
|
* @Date: 2025/12/17 12:16
|
||||||
|
*/
|
||||||
|
CompletableFuture<Void> lineDataRate(String dataDate,
|
||||||
|
List<String> list,
|
||||||
|
List<String> phase,
|
||||||
|
Map<String, Overlimit> overLimitMap,
|
||||||
|
int size,
|
||||||
|
int i,
|
||||||
|
int type);
|
||||||
|
}
|
||||||
@@ -1,30 +1,27 @@
|
|||||||
package com.njcn.algorithm.serviceimpl.line;
|
package com.njcn.algorithm.serviceimpl.line;
|
||||||
|
|
||||||
import cn.hutool.core.collection.CollUtil;
|
import cn.hutool.core.collection.CollUtil;
|
||||||
import cn.hutool.core.date.DatePattern;
|
|
||||||
import cn.hutool.core.io.IoUtil;
|
|
||||||
import cn.hutool.core.util.CharsetUtil;
|
|
||||||
import cn.hutool.core.util.ObjectUtil;
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
import com.alibaba.nacos.shaded.com.google.gson.Gson;
|
|
||||||
import com.njcn.algorithm.pojo.bo.CalculatedParam;
|
import com.njcn.algorithm.pojo.bo.CalculatedParam;
|
||||||
|
import com.njcn.algorithm.service.line.FlowAsyncService;
|
||||||
import com.njcn.algorithm.service.line.IDataCleanService;
|
import com.njcn.algorithm.service.line.IDataCleanService;
|
||||||
import com.njcn.algorithm.utils.MemorySizeUtil;
|
import com.njcn.algorithm.utils.MemorySizeUtil;
|
||||||
import com.njcn.dataProcess.api.*;
|
import com.njcn.dataProcess.api.*;
|
||||||
import com.njcn.dataProcess.dto.DataCleanJsonDTO;
|
|
||||||
import com.njcn.dataProcess.dto.RmpEventDetailDTO;
|
import com.njcn.dataProcess.dto.RmpEventDetailDTO;
|
||||||
import com.njcn.dataProcess.enums.DataCleanEnum;
|
import com.njcn.dataProcess.enums.DataCleanEnum;
|
||||||
import com.njcn.dataProcess.param.DataCleanParam;
|
import com.njcn.dataProcess.param.DataCleanParam;
|
||||||
import com.njcn.dataProcess.param.LineCountEvaluateParam;
|
import com.njcn.dataProcess.param.LineCountEvaluateParam;
|
||||||
import com.njcn.dataProcess.pojo.dto.*;
|
import com.njcn.dataProcess.pojo.dto.*;
|
||||||
import com.njcn.dataProcess.pojo.po.PqDataVerify;
|
import com.njcn.dataProcess.pojo.po.PqDataVerify;
|
||||||
import com.njcn.dataProcess.pojo.po.PqDataVerifyBak;
|
|
||||||
import com.njcn.dataProcess.util.DataCommonUtils;
|
import com.njcn.dataProcess.util.DataCommonUtils;
|
||||||
import com.njcn.dataProcess.util.TimeUtils;
|
import com.njcn.dataProcess.util.TimeUtils;
|
||||||
import com.njcn.device.pq.api.LineFeignClient;
|
import com.njcn.device.pq.api.LineFeignClient;
|
||||||
import com.njcn.device.pq.pojo.vo.LineDetailDataVO;
|
import com.njcn.device.pq.pojo.vo.LineDetailDataVO;
|
||||||
import com.njcn.device.pq.pojo.vo.LineDetailVO;
|
import com.njcn.device.pq.pojo.vo.LineDetailVO;
|
||||||
import com.njcn.oss.constant.OssPath;
|
import com.njcn.system.api.DicDataFeignClient;
|
||||||
import com.njcn.oss.utils.FileStorageUtil;
|
import com.njcn.system.enums.DicDataEnum;
|
||||||
|
import com.njcn.system.enums.DicDataTypeEnum;
|
||||||
|
import com.njcn.system.pojo.po.DictData;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.apache.commons.collections4.ListUtils;
|
import org.apache.commons.collections4.ListUtils;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
@@ -35,15 +32,10 @@ import org.springframework.stereotype.Component;
|
|||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import java.io.InputStream;
|
|
||||||
import java.lang.reflect.Method;
|
import java.lang.reflect.Method;
|
||||||
import java.time.Instant;
|
import java.time.*;
|
||||||
import java.time.LocalDate;
|
|
||||||
import java.time.LocalDateTime;
|
|
||||||
import java.time.ZoneId;
|
|
||||||
import java.time.format.DateTimeFormatter;
|
import java.time.format.DateTimeFormatter;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.concurrent.atomic.AtomicInteger;
|
|
||||||
import java.util.function.Function;
|
import java.util.function.Function;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
@@ -56,8 +48,6 @@ public class DataCleanServiceImpl implements IDataCleanService {
|
|||||||
|
|
||||||
private static final Logger logger = LoggerFactory.getLogger(DataCleanServiceImpl.class);
|
private static final Logger logger = LoggerFactory.getLogger(DataCleanServiceImpl.class);
|
||||||
|
|
||||||
private final DateTimeFormatter DATE_TIME_FORMATTER = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss").withZone(ZoneId.systemDefault());
|
|
||||||
|
|
||||||
@Value("${line.num}")
|
@Value("${line.num}")
|
||||||
private Integer NUM = 100;
|
private Integer NUM = 100;
|
||||||
|
|
||||||
@@ -98,9 +88,9 @@ public class DataCleanServiceImpl implements IDataCleanService {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private DataHarmphasicIFeignClient dataHarmphasicIFeignClient;
|
private DataHarmphasicIFeignClient dataHarmphasicIFeignClient;
|
||||||
@Resource
|
@Resource
|
||||||
private PqDataVerifyNewFeignClient pqDataVerifyNewFeignClient;
|
private DicDataFeignClient dicDataFeignClient;
|
||||||
@Resource
|
@Resource
|
||||||
private FileStorageUtil fileStorageUtil;
|
private FlowAsyncService flowService;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
@@ -293,6 +283,8 @@ public class DataCleanServiceImpl implements IDataCleanService {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void dataCleanHandler(CalculatedParam calculatedParam) {
|
public void dataCleanHandler(CalculatedParam calculatedParam) {
|
||||||
|
DictData dip = dicDataFeignClient.getDicDataByCodeAndType(DicDataEnum.VOLTAGE_DIP.getCode(), DicDataTypeEnum.EVENT_STATIS.getCode()).getData();
|
||||||
|
DictData rise = dicDataFeignClient.getDicDataByCodeAndType(DicDataEnum.VOLTAGE_RISE.getCode(), DicDataTypeEnum.EVENT_STATIS.getCode()).getData();
|
||||||
MemorySizeUtil.getNowMemory();
|
MemorySizeUtil.getNowMemory();
|
||||||
logger.info("{},原始表数据清洗=====》", LocalDateTime.now());
|
logger.info("{},原始表数据清洗=====》", LocalDateTime.now());
|
||||||
//获取标准
|
//获取标准
|
||||||
@@ -307,508 +299,14 @@ public class DataCleanServiceImpl implements IDataCleanService {
|
|||||||
LineCountEvaluateParam lineParam = new LineCountEvaluateParam();
|
LineCountEvaluateParam lineParam = new LineCountEvaluateParam();
|
||||||
lineParam.setStartTime(TimeUtils.getBeginOfDay(calculatedParam.getDataDate()));
|
lineParam.setStartTime(TimeUtils.getBeginOfDay(calculatedParam.getDataDate()));
|
||||||
lineParam.setEndTime(TimeUtils.getEndOfDay(calculatedParam.getDataDate()));
|
lineParam.setEndTime(TimeUtils.getEndOfDay(calculatedParam.getDataDate()));
|
||||||
lineDetail.forEach(item->{
|
for (int i = 0; i < lineDetail.size(); i++) {
|
||||||
|
logger.info( calculatedParam.getDataDate()+"总数据:" + lineDetail.size() + "=====》当前第" + (i + 1));
|
||||||
List<Map<String,Object>> resultData = new ArrayList<>();
|
LineDetailVO.Detail item = lineDetail.get(i);
|
||||||
Set<String> allTimeSet = new HashSet<>();
|
flowService.lineDataClean(item, map, calculatedParam.getDataDate(), dip, rise,lineDetail.size(),(i + 1));
|
||||||
PqDataVerifyBak bak = new PqDataVerifyBak();
|
|
||||||
bak.setLineId(item.getLineId());
|
|
||||||
bak.setTime(LocalDate.parse(calculatedParam.getDataDate(), DateTimeFormatter.ofPattern(DatePattern.NORM_DATE_PATTERN)));
|
|
||||||
lineParam.setLineId(Collections.singletonList(item.getLineId()));
|
|
||||||
//dataV
|
|
||||||
List<DataVDto> data1 = dataVFeignClient.getRawData(lineParam).getData();
|
|
||||||
//dataI
|
|
||||||
List<DataIDto> data2 = dataIFeignClient.getRawData(lineParam).getData();
|
|
||||||
//dataPlt
|
|
||||||
List<DataPltDto> data3 = dataPltFeignClient.getRawData(lineParam).getData();
|
|
||||||
//dataInHarmV
|
|
||||||
List<DataHarmDto> data4 = dataInharmVFeignClient.getRawData(lineParam).getData();
|
|
||||||
//dataHarmRateV
|
|
||||||
List<DataHarmDto> data5 = dataHarmRateVFeignClient.getRawData(lineParam).getData();
|
|
||||||
//dataHarmPowerP
|
|
||||||
List<DataPowerPDto> data6 = dataHarmpowerPFeignClient.getRawData(lineParam).getData();
|
|
||||||
//dataHarmPhasicV
|
|
||||||
List<DataHarmDto> data7 = dataHarmphasicVFeignClient.getRawData(lineParam).getData();
|
|
||||||
//dataFluc
|
|
||||||
List<DataFlucDto> data8 = dataFlucFeignClient.getRawData(lineParam).getData();
|
|
||||||
//dataFlicker
|
|
||||||
List<DataFlickerDto> data9 = dataFlickerFeignClient.getRawData(lineParam).getData();
|
|
||||||
|
|
||||||
if (CollUtil.isNotEmpty(data1)) {
|
|
||||||
logger.info("{}数据清洗dataV集合大小为>>>>>>>>>>>>{}",lineParam.getStartTime(), MemorySizeUtil.getObjectSize(data1));
|
|
||||||
List<PqDataVerify> result = new ArrayList<>();
|
|
||||||
List<PqReasonableRangeDto> list = map.get(DataCleanEnum.DataV.getCode());
|
|
||||||
Map<String, PqReasonableRangeDto> pqReasonableRangeDtoMap = list.stream().collect(Collectors.toMap(PqReasonableRangeDto::getIndexCode, Function.identity()));
|
|
||||||
data1.forEach(data->{
|
|
||||||
List<PqDataVerify> pqDataVerifies = judgeDataV(pqReasonableRangeDtoMap,item,data);
|
|
||||||
result.addAll(pqDataVerifies);
|
|
||||||
});
|
|
||||||
if (CollUtil.isNotEmpty(result)) {
|
|
||||||
Map<String,Object> dtoMap = handleDataV(result,bak,item.getTimeInterval());
|
|
||||||
Set<String> timeSet = new HashSet<>(result.stream().map(dt -> dt.getTime().format(DateTimeFormatter.ofPattern(DatePattern.NORM_TIME_PATTERN))).collect(Collectors.toSet()));
|
|
||||||
dtoMap.put("errorTimes",timeSet.size() * item.getTimeInterval());
|
|
||||||
allTimeSet.addAll(timeSet);
|
|
||||||
if (CollUtil.isNotEmpty(dtoMap)) {
|
|
||||||
resultData.add(dtoMap);
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (CollUtil.isNotEmpty(data2)) {
|
|
||||||
logger.info("{}数据清洗dataI集合大小为>>>>>>>>>>>>{}",lineParam.getStartTime(), MemorySizeUtil.getObjectSize(data2));
|
|
||||||
List<PqDataVerify> result = new ArrayList<>();
|
|
||||||
List<PqReasonableRangeDto> list = map.get(DataCleanEnum.DataI.getCode());
|
|
||||||
Map<String, PqReasonableRangeDto> pqReasonableRangeDtoMap = list.stream().collect(Collectors.toMap(PqReasonableRangeDto::getIndexCode, Function.identity()));
|
|
||||||
data2.forEach(data->{
|
|
||||||
List<PqDataVerify> pqDataVerifies = judgeDataI(pqReasonableRangeDtoMap,item,data);
|
|
||||||
result.addAll(pqDataVerifies);
|
|
||||||
});
|
|
||||||
if (CollUtil.isNotEmpty(result)) {
|
|
||||||
Map<String,Object> dtoMap = handleDataI(result,bak,item.getTimeInterval());
|
|
||||||
Set<String> timeSet = new HashSet<>(result.stream().map(dt -> dt.getTime().format(DateTimeFormatter.ofPattern(DatePattern.NORM_TIME_PATTERN))).collect(Collectors.toSet()));
|
|
||||||
dtoMap.put("errorTimes",timeSet.size() * item.getTimeInterval());
|
|
||||||
allTimeSet.addAll(timeSet);
|
|
||||||
if (CollUtil.isNotEmpty(dtoMap)) {
|
|
||||||
resultData.add(dtoMap);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (CollUtil.isNotEmpty(data3)) {
|
|
||||||
logger.info("{}数据清洗dataPlt集合大小为>>>>>>>>>>>>{}",lineParam.getStartTime(), MemorySizeUtil.getObjectSize(data3));
|
|
||||||
List<PqDataVerify> result = new ArrayList<>();
|
|
||||||
List<PqReasonableRangeDto> list = map.get(DataCleanEnum.DataPlt.getCode());
|
|
||||||
Map<String, PqReasonableRangeDto> pqReasonableRangeDtoMap = list.stream().collect(Collectors.toMap(PqReasonableRangeDto::getIndexCode, Function.identity()));
|
|
||||||
data3.forEach(data->{
|
|
||||||
List<PqDataVerify> pqDataVerifies = judgeDataPlt(pqReasonableRangeDtoMap,data);
|
|
||||||
result.addAll(pqDataVerifies);
|
|
||||||
});
|
|
||||||
if (CollUtil.isNotEmpty(result)) {
|
|
||||||
Map<String,Object> dtoMap = handleDataPlt(result,bak,item.getTimeInterval());
|
|
||||||
Set<String> timeSet = new HashSet<>(result.stream().map(dt -> dt.getTime().format(DateTimeFormatter.ofPattern(DatePattern.NORM_TIME_PATTERN))).collect(Collectors.toSet()));
|
|
||||||
dtoMap.put("errorTimes",timeSet.size() * item.getTimeInterval());
|
|
||||||
allTimeSet.addAll(timeSet);
|
|
||||||
if (CollUtil.isNotEmpty(dtoMap)) {
|
|
||||||
resultData.add(dtoMap);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (CollUtil.isNotEmpty(data4)) {
|
|
||||||
logger.info("{}数据清洗dataInHarmV集合大小为>>>>>>>>>>>>{}",lineParam.getStartTime(), MemorySizeUtil.getObjectSize(data4));
|
|
||||||
List<PqDataVerify> result = new ArrayList<>();
|
|
||||||
List<PqReasonableRangeDto> list = map.get(DataCleanEnum.DataInHarmV.getCode());
|
|
||||||
Map<String, PqReasonableRangeDto> pqReasonableRangeDtoMap = list.stream().collect(Collectors.toMap(PqReasonableRangeDto::getIndexCode, Function.identity()));
|
|
||||||
data4.forEach(data->{
|
|
||||||
List<PqDataVerify> pqDataVerifies = judgeDataInHarmV(pqReasonableRangeDtoMap,data);
|
|
||||||
result.addAll(pqDataVerifies);
|
|
||||||
});
|
|
||||||
if (CollUtil.isNotEmpty(result)) {
|
|
||||||
Map<String,Object> dtoMap = handleInHarmV(result,bak,item.getTimeInterval());
|
|
||||||
Set<String> timeSet = new HashSet<>(result.stream().map(dt -> dt.getTime().format(DateTimeFormatter.ofPattern(DatePattern.NORM_TIME_PATTERN))).collect(Collectors.toSet()));
|
|
||||||
dtoMap.put("errorTimes",timeSet.size() * item.getTimeInterval());
|
|
||||||
allTimeSet.addAll(timeSet);
|
|
||||||
if (CollUtil.isNotEmpty(dtoMap)) {
|
|
||||||
resultData.add(dtoMap);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (CollUtil.isNotEmpty(data5)) {
|
|
||||||
logger.info("{}数据清洗dataHarmRateV集合大小为>>>>>>>>>>>>{}",lineParam.getStartTime(), MemorySizeUtil.getObjectSize(data5));
|
|
||||||
List<PqDataVerify> result = new ArrayList<>();
|
|
||||||
List<PqReasonableRangeDto> list = map.get(DataCleanEnum.DataHarmRateV.getCode());
|
|
||||||
Map<String, PqReasonableRangeDto> pqReasonableRangeDtoMap = list.stream().collect(Collectors.toMap(PqReasonableRangeDto::getIndexCode, Function.identity()));
|
|
||||||
data5.forEach(data->{
|
|
||||||
List<PqDataVerify> pqDataVerifies = judgeDataHarmRateV(pqReasonableRangeDtoMap,data);
|
|
||||||
result.addAll(pqDataVerifies);
|
|
||||||
});
|
|
||||||
if (CollUtil.isNotEmpty(result)) {
|
|
||||||
Map<String,Object> dtoMap = handleHarmRateV(result,bak,item.getTimeInterval());
|
|
||||||
Set<String> timeSet = new HashSet<>(result.stream().map(dt -> dt.getTime().format(DateTimeFormatter.ofPattern(DatePattern.NORM_TIME_PATTERN))).collect(Collectors.toSet()));
|
|
||||||
dtoMap.put("errorTimes",timeSet.size() * item.getTimeInterval());
|
|
||||||
allTimeSet.addAll(timeSet);
|
|
||||||
if (CollUtil.isNotEmpty(dtoMap)) {
|
|
||||||
resultData.add(dtoMap);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (CollUtil.isNotEmpty(data6)) {
|
|
||||||
logger.info("{}数据清洗dataHarmPowerP集合大小为>>>>>>>>>>>>{}",lineParam.getStartTime(), MemorySizeUtil.getObjectSize(data6));
|
|
||||||
List<PqDataVerify> result = new ArrayList<>();
|
|
||||||
List<PqReasonableRangeDto> list = map.get(DataCleanEnum.DataHarmPowerP.getCode());
|
|
||||||
Map<String, PqReasonableRangeDto> pqReasonableRangeDtoMap = list.stream().collect(Collectors.toMap(PqReasonableRangeDto::getIndexCode, Function.identity()));
|
|
||||||
data6.forEach(data->{
|
|
||||||
List<PqDataVerify> pqDataVerifies = judgeDataHarmPowerP(pqReasonableRangeDtoMap,data);
|
|
||||||
result.addAll(pqDataVerifies);
|
|
||||||
});
|
|
||||||
if (CollUtil.isNotEmpty(result)) {
|
|
||||||
Map<String,Object> dtoMap = handleHarmPowerP(result,bak,item.getTimeInterval());
|
|
||||||
Set<String> timeSet = new HashSet<>(result.stream().map(dt -> dt.getTime().format(DateTimeFormatter.ofPattern(DatePattern.NORM_TIME_PATTERN))).collect(Collectors.toSet()));
|
|
||||||
dtoMap.put("errorTimes",timeSet.size() * item.getTimeInterval());
|
|
||||||
allTimeSet.addAll(timeSet);
|
|
||||||
if (CollUtil.isNotEmpty(dtoMap)) {
|
|
||||||
resultData.add(dtoMap);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (CollUtil.isNotEmpty(data7)) {
|
|
||||||
logger.info("{}数据清洗dataHarmPhasicV集合大小为>>>>>>>>>>>>{}",lineParam.getStartTime(), MemorySizeUtil.getObjectSize(data7));
|
|
||||||
List<PqDataVerify> result = new ArrayList<>();
|
|
||||||
List<PqReasonableRangeDto> list = map.get(DataCleanEnum.DataHarmPhasicV.getCode());
|
|
||||||
Map<String, PqReasonableRangeDto> pqReasonableRangeDtoMap = list.stream().collect(Collectors.toMap(PqReasonableRangeDto::getIndexCode, Function.identity()));
|
|
||||||
data7.forEach(data->{
|
|
||||||
List<PqDataVerify> pqDataVerifies = judgeDataHarmPhasicV(pqReasonableRangeDtoMap,data);
|
|
||||||
result.addAll(pqDataVerifies);
|
|
||||||
});
|
|
||||||
if (CollUtil.isNotEmpty(result)) {
|
|
||||||
Map<String,Object> dtoMap = handleHarmPhasicV(result,bak,item.getTimeInterval());
|
|
||||||
Set<String> timeSet = new HashSet<>(result.stream().map(dt -> dt.getTime().format(DateTimeFormatter.ofPattern(DatePattern.NORM_TIME_PATTERN))).collect(Collectors.toSet()));
|
|
||||||
dtoMap.put("errorTimes",timeSet.size() * item.getTimeInterval());
|
|
||||||
allTimeSet.addAll(timeSet);
|
|
||||||
if (CollUtil.isNotEmpty(dtoMap)) {
|
|
||||||
resultData.add(dtoMap);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (CollUtil.isNotEmpty(data8)) {
|
|
||||||
logger.info("{}数据清洗dataFluc集合大小为>>>>>>>>>>>>{}",lineParam.getStartTime(), MemorySizeUtil.getObjectSize(data8));
|
|
||||||
List<PqDataVerify> result = new ArrayList<>();
|
|
||||||
List<PqReasonableRangeDto> list = map.get(DataCleanEnum.DataFluc.getCode());
|
|
||||||
Map<String, PqReasonableRangeDto> pqReasonableRangeDtoMap = list.stream().collect(Collectors.toMap(PqReasonableRangeDto::getIndexCode, Function.identity()));
|
|
||||||
data8.forEach(data->{
|
|
||||||
List<PqDataVerify> pqDataVerifies = judgeDataFluc(pqReasonableRangeDtoMap,data);
|
|
||||||
result.addAll(pqDataVerifies);
|
|
||||||
});
|
|
||||||
if (CollUtil.isNotEmpty(result)) {
|
|
||||||
Map<String,Object> dtoMap = handleDataFluc(result,bak,item.getTimeInterval());
|
|
||||||
Set<String> timeSet = new HashSet<>(result.stream().map(dt -> dt.getTime().format(DateTimeFormatter.ofPattern(DatePattern.NORM_TIME_PATTERN))).collect(Collectors.toSet()));
|
|
||||||
dtoMap.put("errorTimes",timeSet.size() * item.getTimeInterval());
|
|
||||||
allTimeSet.addAll(timeSet);
|
|
||||||
if (CollUtil.isNotEmpty(dtoMap)) {
|
|
||||||
resultData.add(dtoMap);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (CollUtil.isNotEmpty(data9)) {
|
|
||||||
logger.info("{}数据清洗dataFlicker集合大小为>>>>>>>>>>>>{}",lineParam.getStartTime(), MemorySizeUtil.getObjectSize(data9));
|
|
||||||
List<PqDataVerify> result = new ArrayList<>();
|
|
||||||
List<PqReasonableRangeDto> list = map.get(DataCleanEnum.DataFlicker.getCode());
|
|
||||||
Map<String, PqReasonableRangeDto> pqReasonableRangeDtoMap = list.stream().collect(Collectors.toMap(PqReasonableRangeDto::getIndexCode, Function.identity()));
|
|
||||||
data9.forEach(data->{
|
|
||||||
List<PqDataVerify> pqDataVerifies = judgeDataFlicker(pqReasonableRangeDtoMap,data);
|
|
||||||
result.addAll(pqDataVerifies);
|
|
||||||
});
|
|
||||||
if (CollUtil.isNotEmpty(result)) {
|
|
||||||
Map<String,Object> dtoMap = handleDataFlicker(result,bak,item.getTimeInterval());
|
|
||||||
Set<String> timeSet = new HashSet<>(result.stream().map(dt -> dt.getTime().format(DateTimeFormatter.ofPattern(DatePattern.NORM_TIME_PATTERN))).collect(Collectors.toSet()));
|
|
||||||
dtoMap.put("errorTimes",timeSet.size() * item.getTimeInterval());
|
|
||||||
allTimeSet.addAll(timeSet);
|
|
||||||
if (CollUtil.isNotEmpty(dtoMap)) {
|
|
||||||
resultData.add(dtoMap);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (CollUtil.isNotEmpty(allTimeSet)) {
|
|
||||||
Map<String,Object> dtoMap = new HashMap<>();
|
|
||||||
dtoMap.put("lineErrorTimes",allTimeSet.size() * item.getTimeInterval());
|
|
||||||
resultData.add(dtoMap);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (CollUtil.isNotEmpty(resultData)) {
|
|
||||||
bak.setState(1);
|
|
||||||
//存储文件
|
|
||||||
InputStream reportStream = IoUtil.toStream(new Gson().toJson(resultData), CharsetUtil.UTF_8);
|
|
||||||
String fileName = fileStorageUtil.uploadStreamSpecifyName(
|
|
||||||
reportStream
|
|
||||||
, OssPath.DATA_CLEAN + calculatedParam.getDataDate() + "/"
|
|
||||||
,item.getLineId() + ".txt");
|
|
||||||
//存储数据
|
|
||||||
bak.setFilePath(fileName);
|
|
||||||
}
|
|
||||||
pqDataVerifyNewFeignClient.insertData(bak);
|
|
||||||
});
|
|
||||||
System.gc();
|
System.gc();
|
||||||
}
|
}
|
||||||
|
|
||||||
public Map<String,Object> handleDataV(List<PqDataVerify> result, PqDataVerifyBak bak,Integer timeInterval) {
|
|
||||||
Map<String,Object> map = new HashMap<>();
|
|
||||||
Map<String,List<PqDataVerify>> codeMap = result.stream().collect(Collectors.groupingBy(PqDataVerify::getIndexCode));
|
|
||||||
//频率
|
|
||||||
List<DataCleanJsonDTO.DataHarmCleanJsonDTO> list1 = handleData(codeMap.get(DataCleanEnum.Freq.getCode()),timeInterval);
|
|
||||||
if (CollUtil.isNotEmpty(list1)) {
|
|
||||||
bak.setFreq(1);
|
|
||||||
map.put(DataCleanEnum.DataV.getCode() + "-" + DataCleanEnum.Freq.getCode(),list1);
|
|
||||||
}
|
|
||||||
//频率偏差
|
|
||||||
List<DataCleanJsonDTO.DataHarmCleanJsonDTO> list2 = handleData(codeMap.get(DataCleanEnum.FreqDev.getCode()),timeInterval);
|
|
||||||
if (CollUtil.isNotEmpty(list2)) {
|
|
||||||
bak.setFreqDev(1);
|
|
||||||
map.put(DataCleanEnum.DataV.getCode() + "-" + DataCleanEnum.FreqDev.getCode(),list2);
|
|
||||||
}
|
|
||||||
//相电压有效值
|
|
||||||
List<DataCleanJsonDTO.DataHarmCleanJsonDTO> list3 = handleData(codeMap.get(DataCleanEnum.RmsV.getCode()),timeInterval);
|
|
||||||
if (CollUtil.isNotEmpty(list3)) {
|
|
||||||
bak.setVRms(1);
|
|
||||||
map.put(DataCleanEnum.DataV.getCode() + "-" + DataCleanEnum.RmsV.getCode(),list3);
|
|
||||||
}
|
|
||||||
//正序电压
|
|
||||||
List<DataCleanJsonDTO.DataHarmCleanJsonDTO> list4 = handleData(codeMap.get(DataCleanEnum.VPos.getCode()),timeInterval);
|
|
||||||
if (CollUtil.isNotEmpty(list4)) {
|
|
||||||
bak.setVPos(1);
|
|
||||||
map.put(DataCleanEnum.DataV.getCode() + "-" + DataCleanEnum.VPos.getCode(),list4);
|
|
||||||
}
|
|
||||||
//负序电压
|
|
||||||
List<DataCleanJsonDTO.DataHarmCleanJsonDTO> list5 = handleData(codeMap.get(DataCleanEnum.VNeg.getCode()),timeInterval);
|
|
||||||
if (CollUtil.isNotEmpty(list5)) {
|
|
||||||
bak.setVNeg(1);
|
|
||||||
map.put(DataCleanEnum.DataV.getCode() + "-" + DataCleanEnum.VNeg.getCode(),list5);
|
|
||||||
}
|
|
||||||
//零序电压
|
|
||||||
List<DataCleanJsonDTO.DataHarmCleanJsonDTO> list6 = handleData(codeMap.get(DataCleanEnum.VZero.getCode()),timeInterval);
|
|
||||||
if (CollUtil.isNotEmpty(list6)) {
|
|
||||||
bak.setVZero(1);
|
|
||||||
map.put(DataCleanEnum.DataV.getCode() + "-" + DataCleanEnum.VZero.getCode(),list6);
|
|
||||||
}
|
|
||||||
//电压不平衡度
|
|
||||||
List<DataCleanJsonDTO.DataHarmCleanJsonDTO> list7 = handleData(codeMap.get(DataCleanEnum.VUnbalance.getCode()),timeInterval);
|
|
||||||
if (CollUtil.isNotEmpty(list7)) {
|
|
||||||
bak.setVUnbalance(1);
|
|
||||||
map.put(DataCleanEnum.DataV.getCode() + "-" + DataCleanEnum.VUnbalance.getCode(),list7);
|
|
||||||
}
|
|
||||||
//线电压有效值
|
|
||||||
List<DataCleanJsonDTO.DataHarmCleanJsonDTO> list8 = handleData(codeMap.get(DataCleanEnum.RmsLvr.getCode()),timeInterval);
|
|
||||||
if (CollUtil.isNotEmpty(list8)) {
|
|
||||||
bak.setRmsLvr(1);
|
|
||||||
map.put(DataCleanEnum.DataV.getCode() + "-" + DataCleanEnum.RmsLvr.getCode(),list8);
|
|
||||||
}
|
|
||||||
//电压正偏差
|
|
||||||
List<DataCleanJsonDTO.DataHarmCleanJsonDTO> list9 = handleData(codeMap.get(DataCleanEnum.VuDev.getCode()),timeInterval);
|
|
||||||
if (CollUtil.isNotEmpty(list9)) {
|
|
||||||
bak.setVuDev(1);
|
|
||||||
map.put(DataCleanEnum.DataV.getCode() + "-" + DataCleanEnum.VuDev.getCode(),list9);
|
|
||||||
}
|
|
||||||
//电压负偏差
|
|
||||||
List<DataCleanJsonDTO.DataHarmCleanJsonDTO> list10 = handleData(codeMap.get(DataCleanEnum.VlDev.getCode()),timeInterval);
|
|
||||||
if (CollUtil.isNotEmpty(list10)) {
|
|
||||||
bak.setVlDev(1);
|
|
||||||
map.put(DataCleanEnum.DataV.getCode() + "-" + DataCleanEnum.VlDev.getCode(),list10);
|
|
||||||
}
|
|
||||||
//电压总谐波畸变率
|
|
||||||
List<DataCleanJsonDTO.DataHarmCleanJsonDTO> list11 = handleData(codeMap.get(DataCleanEnum.VThd.getCode()),timeInterval);
|
|
||||||
if (CollUtil.isNotEmpty(list11)) {
|
|
||||||
bak.setVThd(1);
|
|
||||||
map.put(DataCleanEnum.DataV.getCode() + "-" + DataCleanEnum.VThd.getCode(),list11);
|
|
||||||
}
|
|
||||||
//相(线)电压基波有效值
|
|
||||||
List<DataCleanJsonDTO.DataHarmCleanJsonDTO> list12 = handleData(codeMap.get(DataCleanEnum.V_Data.getCode()),timeInterval);
|
|
||||||
if (CollUtil.isNotEmpty(list12)) {
|
|
||||||
bak.setV(1);
|
|
||||||
map.put(DataCleanEnum.DataV.getCode() + "-" + DataCleanEnum.V_Data.getCode(),list12);
|
|
||||||
}
|
|
||||||
return map;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Map<String,Object> handleDataI(List<PqDataVerify> result, PqDataVerifyBak bak,Integer timeInterval) {
|
|
||||||
Map<String,Object> map = new HashMap<>();
|
|
||||||
Map<String,List<PqDataVerify>> codeMap = result.stream().collect(Collectors.groupingBy(PqDataVerify::getIndexCode));
|
|
||||||
//电流有效值
|
|
||||||
List<DataCleanJsonDTO.DataHarmCleanJsonDTO> list = handleData(codeMap.get(DataCleanEnum.RmsI.getCode()),timeInterval);
|
|
||||||
if (CollUtil.isNotEmpty(list)) {
|
|
||||||
bak.setIRms(1);
|
|
||||||
map.put(DataCleanEnum.DataI.getCode() + "-" + DataCleanEnum.RmsI.getCode(),list);
|
|
||||||
}
|
|
||||||
return map;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Map<String,Object> handleDataPlt(List<PqDataVerify> result, PqDataVerifyBak bak, Integer timeInterval) {
|
|
||||||
Map<String,Object> map = new HashMap<>();
|
|
||||||
Map<String,List<PqDataVerify>> codeMap = result.stream().collect(Collectors.groupingBy(PqDataVerify::getIndexCode));
|
|
||||||
//长时闪变
|
|
||||||
List<DataCleanJsonDTO.DataHarmCleanJsonDTO> list = handleData(codeMap.get(DataCleanEnum.Plt.getCode()), timeInterval);
|
|
||||||
if (CollUtil.isNotEmpty(list)) {
|
|
||||||
bak.setPlt(1);
|
|
||||||
map.put(DataCleanEnum.DataPlt.getCode() + "-" + DataCleanEnum.Plt.getCode(),list);
|
|
||||||
}
|
|
||||||
return map;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Map<String,Object> handleInHarmV(List<PqDataVerify> result, PqDataVerifyBak bak, Integer timeInterval) {
|
|
||||||
Map<String,Object> map = new HashMap<>();
|
|
||||||
Map<String,List<PqDataVerify>> codeMap = result.stream().collect(Collectors.groupingBy(PqDataVerify::getIndexCode));
|
|
||||||
//间谐波电压含有率
|
|
||||||
List<DataCleanJsonDTO.DataHarmCleanJsonDTO> list = handleHarmData(codeMap.get(DataCleanEnum.V_InHarm.getCode()),timeInterval);
|
|
||||||
if (CollUtil.isNotEmpty(list)) {
|
|
||||||
bak.setVInharm(1);
|
|
||||||
map.put(DataCleanEnum.DataInHarmV.getCode() + "-" + DataCleanEnum.V_InHarm.getCode(),list);
|
|
||||||
}
|
|
||||||
return map;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Map<String,Object> handleHarmRateV(List<PqDataVerify> result, PqDataVerifyBak bak, Integer timeInterval) {
|
|
||||||
Map<String,Object> map = new HashMap<>();
|
|
||||||
Map<String,List<PqDataVerify>> codeMap = result.stream().collect(Collectors.groupingBy(PqDataVerify::getIndexCode));
|
|
||||||
//谐波电压含有率
|
|
||||||
List<DataCleanJsonDTO.DataHarmCleanJsonDTO> list = handleHarmData(codeMap.get(DataCleanEnum.V_Rate.getCode()),timeInterval);
|
|
||||||
if (CollUtil.isNotEmpty(list)) {
|
|
||||||
bak.setVHarm(1);
|
|
||||||
map.put(DataCleanEnum.DataHarmRateV.getCode() + "-" + DataCleanEnum.V_Rate.getCode(),list);
|
|
||||||
}
|
|
||||||
return map;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Map<String,Object> handleHarmPowerP(List<PqDataVerify> result, PqDataVerifyBak bak, Integer timeInterval) {
|
|
||||||
Map<String,Object> map = new HashMap<>();
|
|
||||||
Map<String,List<PqDataVerify>> codeMap = result.stream().collect(Collectors.groupingBy(PqDataVerify::getIndexCode));
|
|
||||||
//功率因素
|
|
||||||
List<DataCleanJsonDTO.DataHarmCleanJsonDTO> list = handleData(codeMap.get(DataCleanEnum.Pf.getCode()),timeInterval);
|
|
||||||
if (CollUtil.isNotEmpty(list)) {
|
|
||||||
bak.setPf(1);
|
|
||||||
map.put(DataCleanEnum.DataHarmPowerP.getCode() + "-" + DataCleanEnum.Pf.getCode(),list);
|
|
||||||
}
|
|
||||||
return map;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Map<String,Object> handleHarmPhasicV(List<PqDataVerify> result, PqDataVerifyBak bak, Integer timeInterval) {
|
|
||||||
Map<String,Object> map = new HashMap<>();
|
|
||||||
Map<String,List<PqDataVerify>> codeMap = result.stream().collect(Collectors.groupingBy(PqDataVerify::getIndexCode));
|
|
||||||
//谐波电压相角
|
|
||||||
List<DataCleanJsonDTO.DataHarmCleanJsonDTO> list = handleHarmData(codeMap.get(DataCleanEnum.V.getCode()),timeInterval);
|
|
||||||
if (CollUtil.isNotEmpty(list)) {
|
|
||||||
bak.setVPhasic(1);
|
|
||||||
map.put(DataCleanEnum.DataHarmPhasicV.getCode() + "-" + DataCleanEnum.V.getCode(),list);
|
|
||||||
}
|
|
||||||
//谐波电压基波相角
|
|
||||||
List<DataCleanJsonDTO.DataHarmCleanJsonDTO> list2 = handleData(codeMap.get(DataCleanEnum.V1.getCode()),timeInterval);
|
|
||||||
if (CollUtil.isNotEmpty(list2)) {
|
|
||||||
bak.setV1Phasic(1);
|
|
||||||
map.put(DataCleanEnum.DataHarmPhasicV.getCode() + "-" + DataCleanEnum.V1.getCode(),list2);
|
|
||||||
}
|
|
||||||
return map;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Map<String,Object> handleDataFluc(List<PqDataVerify> result, PqDataVerifyBak bak, Integer timeInterval) {
|
|
||||||
Map<String,Object> map = new HashMap<>();
|
|
||||||
Map<String,List<PqDataVerify>> codeMap = result.stream().collect(Collectors.groupingBy(PqDataVerify::getIndexCode));
|
|
||||||
//电压波动
|
|
||||||
List<DataCleanJsonDTO.DataHarmCleanJsonDTO> list = handleData(codeMap.get(DataCleanEnum.Fluc.getCode()),timeInterval);
|
|
||||||
if (CollUtil.isNotEmpty(list)) {
|
|
||||||
bak.setFluc(1);
|
|
||||||
map.put(DataCleanEnum.DataFluc.getCode() + "-" + DataCleanEnum.Fluc.getCode(),list);
|
|
||||||
}
|
|
||||||
return map;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Map<String,Object> handleDataFlicker(List<PqDataVerify> result, PqDataVerifyBak bak,Integer timeInterval) {
|
|
||||||
Map<String,Object> map = new HashMap<>();
|
|
||||||
Map<String,List<PqDataVerify>> codeMap = result.stream().collect(Collectors.groupingBy(PqDataVerify::getIndexCode));
|
|
||||||
//短时闪变
|
|
||||||
List<DataCleanJsonDTO.DataHarmCleanJsonDTO> list = handleData(codeMap.get(DataCleanEnum.Pst.getCode()),timeInterval);
|
|
||||||
if (CollUtil.isNotEmpty(list)) {
|
|
||||||
bak.setPst(1);
|
|
||||||
map.put(DataCleanEnum.DataFlicker.getCode() + "-" + DataCleanEnum.Pst.getCode(),list);
|
|
||||||
}
|
|
||||||
return map;
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<DataCleanJsonDTO.DataHarmCleanJsonDTO> handleData(List<PqDataVerify> list, Integer timeInterval) {
|
|
||||||
List<DataCleanJsonDTO.DataHarmCleanJsonDTO> dataList = new ArrayList<>();
|
|
||||||
if (CollUtil.isNotEmpty(list)) {
|
|
||||||
AtomicInteger allCounts = new AtomicInteger();
|
|
||||||
Set<String> timeSet = new HashSet<>();
|
|
||||||
DataCleanJsonDTO.DataHarmCleanJsonDTO dto = new DataCleanJsonDTO.DataHarmCleanJsonDTO();
|
|
||||||
dto.setTargetName(list.get(0).getIndexName());
|
|
||||||
List<DataCleanJsonDTO.DataHarmCleanNormalJsonDTO> list1 = new ArrayList<>();
|
|
||||||
Map<String,List<PqDataVerify>> phaseMap = list.stream().collect(Collectors.groupingBy(PqDataVerify::getPhasicType));
|
|
||||||
phaseMap.forEach((k,v)->{
|
|
||||||
Map<String, List<PqDataVerify>> map11 = v.stream().collect(Collectors.groupingBy(PqDataVerify::getValueType));
|
|
||||||
map11.forEach((k2,v2)->{
|
|
||||||
DataCleanJsonDTO.DataHarmCleanNormalJsonDTO dataCleanJsonDTO = new DataCleanJsonDTO.DataHarmCleanNormalJsonDTO();
|
|
||||||
dataCleanJsonDTO.setPhasic(k);
|
|
||||||
dataCleanJsonDTO.setValueType(k2);
|
|
||||||
timeSet.addAll(v2.stream().map(dt -> dt.getTime().format(DateTimeFormatter.ofPattern(DatePattern.NORM_TIME_PATTERN))).collect(Collectors.toSet()));
|
|
||||||
//只取值最大的10组数据
|
|
||||||
List<PqDataVerify> topTen = v2.stream()
|
|
||||||
//过滤掉null元素
|
|
||||||
.filter(Objects::nonNull)
|
|
||||||
.sorted(Comparator.comparing(
|
|
||||||
PqDataVerify::getAbnormalValue,
|
|
||||||
Comparator.nullsLast(Comparator.reverseOrder())))
|
|
||||||
.limit(10)
|
|
||||||
.collect(Collectors.toList());
|
|
||||||
dataCleanJsonDTO.setTime(topTen.stream().map(dt -> dt.getTime().format(DateTimeFormatter.ofPattern(DatePattern.NORM_TIME_PATTERN))).collect(Collectors.toList()));
|
|
||||||
dataCleanJsonDTO.setValue(topTen.stream()
|
|
||||||
.map(pq -> {
|
|
||||||
Double value = pq.getAbnormalValue();
|
|
||||||
return value != null ? Math.round(value * 100) / 100.0 : null;
|
|
||||||
})
|
|
||||||
.collect(Collectors.toList()));
|
|
||||||
dataCleanJsonDTO.setErrorCounts(v2.size());
|
|
||||||
allCounts.set(allCounts.get() + v2.size());
|
|
||||||
list1.add(dataCleanJsonDTO);
|
|
||||||
});
|
|
||||||
dto.setErrorCounts(allCounts.get());
|
|
||||||
dto.setErrorTimes(timeSet.size()*timeInterval);
|
|
||||||
dto.setList(list1);
|
|
||||||
});
|
|
||||||
dataList.add(dto);
|
|
||||||
}
|
|
||||||
return dataList;
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<DataCleanJsonDTO.DataHarmCleanJsonDTO> handleHarmData(List<PqDataVerify> list, Integer timeInterval) {
|
|
||||||
List<DataCleanJsonDTO.DataHarmCleanJsonDTO> dataList = new ArrayList<>();
|
|
||||||
if (CollUtil.isNotEmpty(list)) {
|
|
||||||
AtomicInteger allCounts = new AtomicInteger();
|
|
||||||
Set<String> timeSet = new HashSet<>();
|
|
||||||
Map<String,List<PqDataVerify>> indexNameMap = list.stream().collect(Collectors.groupingBy(PqDataVerify::getIndexName));
|
|
||||||
indexNameMap.forEach((k,v)->{
|
|
||||||
DataCleanJsonDTO.DataHarmCleanJsonDTO dto = new DataCleanJsonDTO.DataHarmCleanJsonDTO();
|
|
||||||
dto.setTargetName(k);
|
|
||||||
List<DataCleanJsonDTO.DataHarmCleanNormalJsonDTO> dataCleanJsonDTOList = new ArrayList<>();
|
|
||||||
Map<String,List<PqDataVerify>> phaseMap = v.stream().collect(Collectors.groupingBy(PqDataVerify::getPhasicType));
|
|
||||||
phaseMap.forEach((k2,v2)->{
|
|
||||||
Map<String, List<PqDataVerify>> valueMap = v2.stream().collect(Collectors.groupingBy(PqDataVerify::getValueType));
|
|
||||||
valueMap.forEach((k3,v3)->{
|
|
||||||
DataCleanJsonDTO.DataHarmCleanNormalJsonDTO dto1 = new DataCleanJsonDTO.DataHarmCleanNormalJsonDTO();
|
|
||||||
dto1.setPhasic(k2);
|
|
||||||
dto1.setValueType(k3);
|
|
||||||
timeSet.addAll(v3.stream().map(dt -> dt.getTime().format(DateTimeFormatter.ofPattern(DatePattern.NORM_TIME_PATTERN))).collect(Collectors.toSet()));
|
|
||||||
//只取值最大的10组数据
|
|
||||||
List<PqDataVerify> topTen = v3.stream()
|
|
||||||
//过滤掉null元素
|
|
||||||
.filter(Objects::nonNull)
|
|
||||||
.sorted(Comparator.comparing(
|
|
||||||
PqDataVerify::getAbnormalValue,
|
|
||||||
Comparator.nullsLast(Comparator.reverseOrder())))
|
|
||||||
.limit(10)
|
|
||||||
.collect(Collectors.toList());
|
|
||||||
dto1.setTime(topTen.stream().map(dt -> dt.getTime().format(DateTimeFormatter.ofPattern(DatePattern.NORM_TIME_PATTERN))).collect(Collectors.toList()));
|
|
||||||
dto1.setValue(topTen.stream()
|
|
||||||
.map(pq -> {
|
|
||||||
Double value = pq.getAbnormalValue();
|
|
||||||
return value != null ? Math.round(value * 100) / 100.0 : null;
|
|
||||||
})
|
|
||||||
.collect(Collectors.toList()));
|
|
||||||
dto1.setErrorCounts(v3.size());
|
|
||||||
allCounts.set(allCounts.get() + v3.size());
|
|
||||||
dataCleanJsonDTOList.add(dto1);
|
|
||||||
});
|
|
||||||
dto.setErrorCounts(allCounts.get());
|
|
||||||
dto.setErrorTimes(timeSet.size()*timeInterval);
|
|
||||||
dto.setList(dataCleanJsonDTOList);
|
|
||||||
});
|
|
||||||
dataList.add(dto);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
return dataList;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void dataVCleanHandler(CalculatedParam calculatedParam) {
|
public void dataVCleanHandler(CalculatedParam calculatedParam) {
|
||||||
MemorySizeUtil.getNowMemory();
|
MemorySizeUtil.getNowMemory();
|
||||||
@@ -1137,6 +635,7 @@ public class DataCleanServiceImpl implements IDataCleanService {
|
|||||||
System.gc();
|
System.gc();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取标准数据的范围
|
* 获取标准数据的范围
|
||||||
*/
|
*/
|
||||||
@@ -1144,7 +643,7 @@ public class DataCleanServiceImpl implements IDataCleanService {
|
|||||||
Map<String, List<PqReasonableRangeDto>> pqReasonableRangeDtoMap = new HashMap<>();
|
Map<String, List<PqReasonableRangeDto>> pqReasonableRangeDtoMap = new HashMap<>();
|
||||||
DataCleanParam param = new DataCleanParam();
|
DataCleanParam param = new DataCleanParam();
|
||||||
param.setSystemType(DataCleanEnum.Pqs.getCode());
|
param.setSystemType(DataCleanEnum.Pqs.getCode());
|
||||||
param.setDataSource(DataCleanEnum.InfluxDB.getCode());
|
// param.setDataSource(DataCleanEnum.InfluxDB.getCode());
|
||||||
List<PqReasonableRangeDto> list = pqReasonableRangeFeignClient.getData(param).getData();
|
List<PqReasonableRangeDto> list = pqReasonableRangeFeignClient.getData(param).getData();
|
||||||
if (CollUtil.isNotEmpty(list)) {
|
if (CollUtil.isNotEmpty(list)) {
|
||||||
pqReasonableRangeDtoMap = list.stream().collect(Collectors.groupingBy(PqReasonableRangeDto::getInfluxdbTableName));
|
pqReasonableRangeDtoMap = list.stream().collect(Collectors.groupingBy(PqReasonableRangeDto::getInfluxdbTableName));
|
||||||
@@ -1226,13 +725,15 @@ public class DataCleanServiceImpl implements IDataCleanService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//相电压有效值
|
//相电压有效值 判断接线方式 (0-星型 1-角型 2-V型) 星型是相电压 角型或者v型是线电压
|
||||||
|
//0:星型接法;1:三角型接法;2:开口三角型接法
|
||||||
|
if (ObjectUtil.isNotNull(line.getPtType()) && line.getPtType() == 0) {
|
||||||
pqReasonableRangeDto = map.get(DataCleanEnum.RmsV.getCode());
|
pqReasonableRangeDto = map.get(DataCleanEnum.RmsV.getCode());
|
||||||
phaseList = Arrays.asList(pqReasonableRangeDto.getPhaseType().split(","));
|
phaseList = Arrays.asList(pqReasonableRangeDto.getPhaseType().split(","));
|
||||||
if (phaseList.contains(dto.getPhasicType())) {
|
if (phaseList.contains(dto.getPhasicType())) {
|
||||||
if (ObjectUtil.isNotNull(dto.getRms())) {
|
if (ObjectUtil.isNotNull(dto.getRms())) {
|
||||||
if (dto.getRms() < (pqReasonableRangeDto.getMinValue()* DataCommonUtils.getVoltageData(line.getVoltageLevel()))
|
if (dto.getRms() < (pqReasonableRangeDto.getMinValue() / 100.0 * DataCommonUtils.getVoltageData(line.getVoltageLevel()))
|
||||||
|| dto.getRms() > (pqReasonableRangeDto.getMaxValue()*DataCommonUtils.getVoltageData(line.getVoltageLevel()))) {
|
|| dto.getRms() > (pqReasonableRangeDto.getMaxValue() / 100.0 * DataCommonUtils.getVoltageData(line.getVoltageLevel()))) {
|
||||||
//log.info("dataV-相电压有效值数据异常,已清洗!数据值:{},数据时间:{}", dto.getRms(), dto.getMinTime());
|
//log.info("dataV-相电压有效值数据异常,已清洗!数据值:{},数据时间:{}", dto.getRms(), dto.getMinTime());
|
||||||
PqDataVerify pqDataVerify = getPqDataVerify(dto.getLineId()
|
PqDataVerify pqDataVerify = getPqDataVerify(dto.getLineId()
|
||||||
, dto.getMinTime()
|
, dto.getMinTime()
|
||||||
@@ -1250,14 +751,15 @@ public class DataCleanServiceImpl implements IDataCleanService {
|
|||||||
logger.info("rmsV{}", dto);
|
logger.info("rmsV{}", dto);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//正序电压
|
//正序电压
|
||||||
pqReasonableRangeDto = map.get(DataCleanEnum.VPos.getCode());
|
pqReasonableRangeDto = map.get(DataCleanEnum.VPos.getCode());
|
||||||
phaseList = Arrays.asList(pqReasonableRangeDto.getPhaseType().split(","));
|
phaseList = Arrays.asList(pqReasonableRangeDto.getPhaseType().split(","));
|
||||||
if (phaseList.contains(dto.getPhasicType())) {
|
if (phaseList.contains(dto.getPhasicType())) {
|
||||||
if (ObjectUtil.isNotNull(dto.getVPos())) {
|
if (ObjectUtil.isNotNull(dto.getVPos())) {
|
||||||
if (dto.getVPos() < (pqReasonableRangeDto.getMinValue()*DataCommonUtils.getVoltageData(line.getVoltageLevel()))
|
if (dto.getVPos() < (pqReasonableRangeDto.getMinValue() / 100.0 * DataCommonUtils.getVoltageData(line.getVoltageLevel()))
|
||||||
|| dto.getVPos() > (pqReasonableRangeDto.getMaxValue()*DataCommonUtils.getVoltageData(line.getVoltageLevel()))) {
|
|| dto.getVPos() > (pqReasonableRangeDto.getMaxValue() / 100.0 * DataCommonUtils.getVoltageData(line.getVoltageLevel()))) {
|
||||||
//log.info("dataV-正序电压数据异常,已清洗!数据值:{},数据时间:{}", dto.getVPos(), dto.getMinTime());
|
//log.info("dataV-正序电压数据异常,已清洗!数据值:{},数据时间:{}", dto.getVPos(), dto.getMinTime());
|
||||||
PqDataVerify pqDataVerify = getPqDataVerify(dto.getLineId()
|
PqDataVerify pqDataVerify = getPqDataVerify(dto.getLineId()
|
||||||
, dto.getMinTime()
|
, dto.getMinTime()
|
||||||
@@ -1350,12 +852,14 @@ public class DataCleanServiceImpl implements IDataCleanService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//线电压有效值
|
//线电压有效值 判断接线方式 (0-星型 1-角型 2-V型) 星型是相电压 角型或者v型是线电压
|
||||||
|
//0:星型接法;1:三角型接法;2:开口三角型接法
|
||||||
|
if (ObjectUtil.isNotNull(line.getPtType()) && line.getPtType() != 0) {
|
||||||
pqReasonableRangeDto = map.get(DataCleanEnum.RmsLvr.getCode());
|
pqReasonableRangeDto = map.get(DataCleanEnum.RmsLvr.getCode());
|
||||||
phaseList = Arrays.asList(pqReasonableRangeDto.getPhaseType().split(","));
|
phaseList = Arrays.asList(pqReasonableRangeDto.getPhaseType().split(","));
|
||||||
if (phaseList.contains(dto.getPhasicType()) && ObjectUtil.isNotNull(dto.getRmsLvr())) {
|
if (phaseList.contains(dto.getPhasicType()) && ObjectUtil.isNotNull(dto.getRmsLvr())) {
|
||||||
if (dto.getRmsLvr() < (pqReasonableRangeDto.getMinValue()*DataCommonUtils.getVoltageData(line.getVoltageLevel()))
|
if (dto.getRmsLvr() < (pqReasonableRangeDto.getMinValue() / 100.0 * DataCommonUtils.getVoltageData(line.getVoltageLevel()))
|
||||||
|| dto.getRmsLvr() > (pqReasonableRangeDto.getMaxValue()*DataCommonUtils.getVoltageData(line.getVoltageLevel()))) {
|
|| dto.getRmsLvr() > (pqReasonableRangeDto.getMaxValue() / 100.0 * DataCommonUtils.getVoltageData(line.getVoltageLevel()))) {
|
||||||
//log.info("dataV-线电压有效值数据异常,已清洗!数据值:{},数据时间:{}", dto.getRmsLvr(), dto.getMinTime());
|
//log.info("dataV-线电压有效值数据异常,已清洗!数据值:{},数据时间:{}", dto.getRmsLvr(), dto.getMinTime());
|
||||||
PqDataVerify pqDataVerify = getPqDataVerify(dto.getLineId()
|
PqDataVerify pqDataVerify = getPqDataVerify(dto.getLineId()
|
||||||
, dto.getMinTime()
|
, dto.getMinTime()
|
||||||
@@ -1370,6 +874,7 @@ public class DataCleanServiceImpl implements IDataCleanService {
|
|||||||
list.add(pqDataVerify);
|
list.add(pqDataVerify);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//电压偏差
|
//电压偏差
|
||||||
//电压偏差分为正偏差和负偏差,目前正负偏差都存储在vu_dev字段中,如果vu_dev>=0为正偏差数值,如果vu_dev<0为负偏差数值
|
//电压偏差分为正偏差和负偏差,目前正负偏差都存储在vu_dev字段中,如果vu_dev>=0为正偏差数值,如果vu_dev<0为负偏差数值
|
||||||
@@ -1486,8 +991,8 @@ public class DataCleanServiceImpl implements IDataCleanService {
|
|||||||
phaseList = Arrays.asList(pqReasonableRangeDto.getPhaseType().split(","));
|
phaseList = Arrays.asList(pqReasonableRangeDto.getPhaseType().split(","));
|
||||||
if (phaseList.contains(dto.getPhasicType())) {
|
if (phaseList.contains(dto.getPhasicType())) {
|
||||||
if (ObjectUtil.isNotNull(dto.getV1())) {
|
if (ObjectUtil.isNotNull(dto.getV1())) {
|
||||||
if (dto.getV1() < (pqReasonableRangeDto.getMinValue()*DataCommonUtils.getVoltageData(line.getVoltageLevel()))
|
if (dto.getV1() < (pqReasonableRangeDto.getMinValue() / 100.0 * DataCommonUtils.getVoltageData(line.getVoltageLevel()))
|
||||||
|| dto.getV1() > (pqReasonableRangeDto.getMaxValue()*DataCommonUtils.getVoltageData(line.getVoltageLevel()))) {
|
|| dto.getV1() > (pqReasonableRangeDto.getMaxValue() / 100.0 * DataCommonUtils.getVoltageData(line.getVoltageLevel()))) {
|
||||||
//log.info("dataV-基波电压数据异常,已清洗!数据值:{},数据时间:{}", dto.getV1(), dto.getMinTime());
|
//log.info("dataV-基波电压数据异常,已清洗!数据值:{},数据时间:{}", dto.getV1(), dto.getMinTime());
|
||||||
PqDataVerify pqDataVerify = getPqDataVerify(dto.getLineId()
|
PqDataVerify pqDataVerify = getPqDataVerify(dto.getLineId()
|
||||||
, dto.getMinTime()
|
, dto.getMinTime()
|
||||||
@@ -1520,7 +1025,7 @@ public class DataCleanServiceImpl implements IDataCleanService {
|
|||||||
phaseList = Arrays.asList(pqReasonableRangeDto.getPhaseType().split(","));
|
phaseList = Arrays.asList(pqReasonableRangeDto.getPhaseType().split(","));
|
||||||
if (phaseList.contains(dto.getPhasicType())) {
|
if (phaseList.contains(dto.getPhasicType())) {
|
||||||
if (ObjectUtil.isNotNull(dto.getRms())) {
|
if (ObjectUtil.isNotNull(dto.getRms())) {
|
||||||
if (dto.getRms() >= line.getCT1() * 1.2) {
|
if (dto.getRms() < pqReasonableRangeDto.getMinValue() || dto.getRms() > pqReasonableRangeDto.getMaxValue()) {
|
||||||
PqDataVerify pqDataVerify = getPqDataVerify(dto.getLineId()
|
PqDataVerify pqDataVerify = getPqDataVerify(dto.getLineId()
|
||||||
, dto.getMinTime()
|
, dto.getMinTime()
|
||||||
, dto.getValueType()
|
, dto.getValueType()
|
||||||
@@ -1773,8 +1278,8 @@ public class DataCleanServiceImpl implements IDataCleanService {
|
|||||||
public PqDataVerify getPqDataVerify(String lineId, String time, String valueType, String phasicType, String indexCode, String indexName, String indexTable, Double data, Double minValue, Double maxValue) {
|
public PqDataVerify getPqDataVerify(String lineId, String time, String valueType, String phasicType, String indexCode, String indexName, String indexTable, Double data, Double minValue, Double maxValue) {
|
||||||
PqDataVerify pqDataVerify = new PqDataVerify();
|
PqDataVerify pqDataVerify = new PqDataVerify();
|
||||||
pqDataVerify.setLineId(lineId);
|
pqDataVerify.setLineId(lineId);
|
||||||
pqDataVerify.setTime(TimeUtils.StringToLocalDateTime(time));
|
pqDataVerify.setTime(time.contains(".") ? TimeUtils.StringToLocalDateTimeSSS(time) : TimeUtils.StringToLocalDateTime(time));
|
||||||
pqDataVerify.setValueType(Objects.isNull(valueType)?"avg":valueType);
|
pqDataVerify.setValueType(Objects.isNull(valueType) ? "AVG" : valueType);
|
||||||
pqDataVerify.setPhasicType(phasicType);
|
pqDataVerify.setPhasicType(phasicType);
|
||||||
pqDataVerify.setIndexCode(indexCode);
|
pqDataVerify.setIndexCode(indexCode);
|
||||||
pqDataVerify.setIndexName(indexName);
|
pqDataVerify.setIndexName(indexName);
|
||||||
|
|||||||
@@ -58,7 +58,7 @@ public class DataComAssServiceImpl implements IDataComAssService {
|
|||||||
lineParam.setStartTime(TimeUtils.getBeginOfDay(calculatedParam.getDataDate()));
|
lineParam.setStartTime(TimeUtils.getBeginOfDay(calculatedParam.getDataDate()));
|
||||||
lineParam.setEndTime(TimeUtils.getEndOfDay(calculatedParam.getDataDate()));
|
lineParam.setEndTime(TimeUtils.getEndOfDay(calculatedParam.getDataDate()));
|
||||||
List<String> lineIdList = calculatedParam.getIdList();
|
List<String> lineIdList = calculatedParam.getIdList();
|
||||||
getAbnormalData(lineParam);
|
//getAbnormalData(lineParam);
|
||||||
for (String lineId : lineIdList) {
|
for (String lineId : lineIdList) {
|
||||||
DataComassesDPO rStatComassesDpo = new DataComassesDPO();
|
DataComassesDPO rStatComassesDpo = new DataComassesDPO();
|
||||||
rStatComassesDpo.setTime(calculatedParam.getDataDate());
|
rStatComassesDpo.setTime(calculatedParam.getDataDate());
|
||||||
|
|||||||
@@ -22,6 +22,7 @@ import org.springframework.stereotype.Component;
|
|||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
import java.util.concurrent.atomic.AtomicReference;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -64,9 +65,13 @@ public class DayDataServiceImpl implements IDayDataService {
|
|||||||
private DataInharmVFeignClient dataInharmVFeignClient;
|
private DataInharmVFeignClient dataInharmVFeignClient;
|
||||||
@Resource
|
@Resource
|
||||||
private DataPltFeignClient dataPltFeignClient;
|
private DataPltFeignClient dataPltFeignClient;
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
private PqDataVerifyFeignClient pqDataVerifyFeignClient;
|
private PqDataVerifyFeignClient pqDataVerifyFeignClient;
|
||||||
|
/**
|
||||||
|
* 查询配置 辽宁版本比较特殊,没有CP95值,采用平均值进行判断
|
||||||
|
*/
|
||||||
|
@Value("${version.used:master}")
|
||||||
|
private String versionUsed;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void dataVHandler(CalculatedParam calculatedParam) {
|
public void dataVHandler(CalculatedParam calculatedParam) {
|
||||||
@@ -76,12 +81,13 @@ public class DayDataServiceImpl implements IDayDataService {
|
|||||||
LineCountEvaluateParam lineParam = new LineCountEvaluateParam();
|
LineCountEvaluateParam lineParam = new LineCountEvaluateParam();
|
||||||
lineParam.setStartTime(TimeUtils.getBeginOfDay(calculatedParam.getDataDate()));
|
lineParam.setStartTime(TimeUtils.getBeginOfDay(calculatedParam.getDataDate()));
|
||||||
lineParam.setEndTime(TimeUtils.getEndOfDay(calculatedParam.getDataDate()));
|
lineParam.setEndTime(TimeUtils.getEndOfDay(calculatedParam.getDataDate()));
|
||||||
|
lineParam.setType(calculatedParam.getType());
|
||||||
//以100个监测点分片处理
|
//以100个监测点分片处理
|
||||||
List<List<String>> pendingIds = ListUtils.partition(calculatedParam.getIdList(),NUM);
|
List<List<String>> pendingIds = ListUtils.partition(calculatedParam.getIdList(),NUM);
|
||||||
pendingIds.forEach(list->{
|
pendingIds.forEach(list->{
|
||||||
lineParam.setLineId(list);
|
lineParam.setLineId(list);
|
||||||
//添加异常数据时间点
|
//添加异常数据时间点
|
||||||
getAbnormalData(lineParam);
|
//getAbnormalData(lineParam);
|
||||||
//获取原始数据
|
//获取原始数据
|
||||||
List<CommonMinuteDto> partList = dataVFeignClient.getBaseData(lineParam).getData();
|
List<CommonMinuteDto> partList = dataVFeignClient.getBaseData(lineParam).getData();
|
||||||
if (CollUtil.isNotEmpty(partList)) {
|
if (CollUtil.isNotEmpty(partList)) {
|
||||||
@@ -99,15 +105,15 @@ public class DayDataServiceImpl implements IDayDataService {
|
|||||||
dto.setTime(item.getTime());
|
dto.setTime(item.getTime());
|
||||||
dto.setLineId(item.getLineId());
|
dto.setLineId(item.getLineId());
|
||||||
dto.setPhasicType(item2.getPhasicType());
|
dto.setPhasicType(item2.getPhasicType());
|
||||||
dto.setValueType(item3.getValueType());
|
dto.setValueType(item3.getValueType().toUpperCase());
|
||||||
dto.setQualityFlag(Objects.equals(item.getQualityFlag(),"null") ? "0" : item.getQualityFlag());
|
dto.setQualityFlag(Objects.equals(item.getQualityFlag(),"null") ? "0" : item.getQualityFlag());
|
||||||
channelDataVHandler(item3,valueTypes,dto,true);
|
//默认CP95值取 CP95的最大值;如果有特殊要求,可以根据平均值的数据取CP95
|
||||||
|
channelDataVHandler(item3,valueTypes,dto,!Objects.equals(versionUsed, "liaoning"));
|
||||||
result.add(dto);
|
result.add(dto);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
partList = null;
|
|
||||||
});
|
});
|
||||||
if (CollUtil.isNotEmpty(result)) {
|
if (CollUtil.isNotEmpty(result)) {
|
||||||
//存储数据
|
//存储数据
|
||||||
@@ -125,12 +131,13 @@ public class DayDataServiceImpl implements IDayDataService {
|
|||||||
LineCountEvaluateParam lineParam = new LineCountEvaluateParam();
|
LineCountEvaluateParam lineParam = new LineCountEvaluateParam();
|
||||||
lineParam.setStartTime(TimeUtils.getBeginOfDay(calculatedParam.getDataDate()));
|
lineParam.setStartTime(TimeUtils.getBeginOfDay(calculatedParam.getDataDate()));
|
||||||
lineParam.setEndTime(TimeUtils.getEndOfDay(calculatedParam.getDataDate()));
|
lineParam.setEndTime(TimeUtils.getEndOfDay(calculatedParam.getDataDate()));
|
||||||
|
lineParam.setType(calculatedParam.getType());
|
||||||
//以100个监测点分片处理
|
//以100个监测点分片处理
|
||||||
List<List<String>> pendingIds = ListUtils.partition(calculatedParam.getIdList(),NUM);
|
List<List<String>> pendingIds = ListUtils.partition(calculatedParam.getIdList(),NUM);
|
||||||
pendingIds.forEach(list->{
|
pendingIds.forEach(list->{
|
||||||
lineParam.setLineId(list);
|
lineParam.setLineId(list);
|
||||||
//添加异常数据时间点
|
//添加异常数据时间点
|
||||||
getAbnormalData(lineParam);
|
//getAbnormalData(lineParam);
|
||||||
//获取原始数据
|
//获取原始数据
|
||||||
List<CommonMinuteDto> partList = dataIFeignClient.getBaseData(lineParam).getData();
|
List<CommonMinuteDto> partList = dataIFeignClient.getBaseData(lineParam).getData();
|
||||||
if (CollUtil.isNotEmpty(partList)) {
|
if (CollUtil.isNotEmpty(partList)) {
|
||||||
@@ -147,15 +154,14 @@ public class DayDataServiceImpl implements IDayDataService {
|
|||||||
dto.setTime(item.getTime());
|
dto.setTime(item.getTime());
|
||||||
dto.setLineId(item.getLineId());
|
dto.setLineId(item.getLineId());
|
||||||
dto.setPhasicType(item2.getPhasicType());
|
dto.setPhasicType(item2.getPhasicType());
|
||||||
dto.setValueType(item3.getValueType());
|
dto.setValueType(item3.getValueType().toUpperCase());
|
||||||
dto.setQualityFlag(Objects.equals(item.getQualityFlag(),"null") ? "0" : item.getQualityFlag());
|
dto.setQualityFlag(Objects.equals(item.getQualityFlag(),"null") ? "0" : item.getQualityFlag());
|
||||||
channelDataIHandler(item3,valueTypes,dto,true);
|
channelDataIHandler(item3,valueTypes,dto,!Objects.equals(versionUsed, "liaoning"));
|
||||||
result.add(dto);
|
result.add(dto);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
partList = null;
|
|
||||||
});
|
});
|
||||||
if (CollUtil.isNotEmpty(result)) {
|
if (CollUtil.isNotEmpty(result)) {
|
||||||
//存储数据
|
//存储数据
|
||||||
@@ -174,12 +180,13 @@ public class DayDataServiceImpl implements IDayDataService {
|
|||||||
LineCountEvaluateParam lineParam = new LineCountEvaluateParam();
|
LineCountEvaluateParam lineParam = new LineCountEvaluateParam();
|
||||||
lineParam.setStartTime(TimeUtils.getBeginOfDay(calculatedParam.getDataDate()));
|
lineParam.setStartTime(TimeUtils.getBeginOfDay(calculatedParam.getDataDate()));
|
||||||
lineParam.setEndTime(TimeUtils.getEndOfDay(calculatedParam.getDataDate()));
|
lineParam.setEndTime(TimeUtils.getEndOfDay(calculatedParam.getDataDate()));
|
||||||
|
lineParam.setType(calculatedParam.getType());
|
||||||
//以100个监测点分片处理
|
//以100个监测点分片处理
|
||||||
List<List<String>> pendingIds = ListUtils.partition(calculatedParam.getIdList(),NUM);
|
List<List<String>> pendingIds = ListUtils.partition(calculatedParam.getIdList(),NUM);
|
||||||
pendingIds.forEach(list->{
|
pendingIds.forEach(list->{
|
||||||
lineParam.setLineId(list);
|
lineParam.setLineId(list);
|
||||||
//添加异常数据时间点
|
//添加异常数据时间点
|
||||||
getAbnormalData(lineParam);
|
//getAbnormalData(lineParam);
|
||||||
//获取原始数据
|
//获取原始数据
|
||||||
List<CommonMinuteDto> partList = dataFlickerFeignClient.getBaseData(lineParam).getData();
|
List<CommonMinuteDto> partList = dataFlickerFeignClient.getBaseData(lineParam).getData();
|
||||||
if (CollUtil.isNotEmpty(partList)) {
|
if (CollUtil.isNotEmpty(partList)) {
|
||||||
@@ -195,16 +202,15 @@ public class DayDataServiceImpl implements IDayDataService {
|
|||||||
dto.setTime(item.getTime());
|
dto.setTime(item.getTime());
|
||||||
dto.setLineId(item.getLineId());
|
dto.setLineId(item.getLineId());
|
||||||
dto.setPhasicType(item2.getPhasicType());
|
dto.setPhasicType(item2.getPhasicType());
|
||||||
dto.setValueType(item4);
|
dto.setValueType(item4.toUpperCase());
|
||||||
dto.setQualityFlag(Objects.equals(item.getQualityFlag(),"null") ? "0" : item.getQualityFlag());
|
dto.setQualityFlag(Objects.equals(item.getQualityFlag(),"null") ? "0" : item.getQualityFlag());
|
||||||
channelDataFlickerHandler(item3,dto,item4,true);
|
channelDataFlickerHandler(item3,dto,item4,!Objects.equals(versionUsed, "liaoning"));
|
||||||
result.add(dto);
|
result.add(dto);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
partList = null;
|
|
||||||
});
|
});
|
||||||
if (CollUtil.isNotEmpty(result)) {
|
if (CollUtil.isNotEmpty(result)) {
|
||||||
//存储数据
|
//存储数据
|
||||||
@@ -223,12 +229,13 @@ public class DayDataServiceImpl implements IDayDataService {
|
|||||||
LineCountEvaluateParam lineParam = new LineCountEvaluateParam();
|
LineCountEvaluateParam lineParam = new LineCountEvaluateParam();
|
||||||
lineParam.setStartTime(TimeUtils.getBeginOfDay(calculatedParam.getDataDate()));
|
lineParam.setStartTime(TimeUtils.getBeginOfDay(calculatedParam.getDataDate()));
|
||||||
lineParam.setEndTime(TimeUtils.getEndOfDay(calculatedParam.getDataDate()));
|
lineParam.setEndTime(TimeUtils.getEndOfDay(calculatedParam.getDataDate()));
|
||||||
|
lineParam.setType(calculatedParam.getType());
|
||||||
//以100个监测点分片处理
|
//以100个监测点分片处理
|
||||||
List<List<String>> pendingIds = ListUtils.partition(calculatedParam.getIdList(),NUM);
|
List<List<String>> pendingIds = ListUtils.partition(calculatedParam.getIdList(),NUM);
|
||||||
pendingIds.forEach(list->{
|
pendingIds.forEach(list->{
|
||||||
lineParam.setLineId(list);
|
lineParam.setLineId(list);
|
||||||
//添加异常数据时间点
|
//添加异常数据时间点
|
||||||
getAbnormalData(lineParam);
|
//getAbnormalData(lineParam);
|
||||||
//获取原始数据
|
//获取原始数据
|
||||||
List<CommonMinuteDto> partList = dataFlucFeignClient.getBaseData(lineParam).getData();
|
List<CommonMinuteDto> partList = dataFlucFeignClient.getBaseData(lineParam).getData();
|
||||||
if (CollUtil.isNotEmpty(partList)) {
|
if (CollUtil.isNotEmpty(partList)) {
|
||||||
@@ -244,16 +251,15 @@ public class DayDataServiceImpl implements IDayDataService {
|
|||||||
dto.setTime(item.getTime());
|
dto.setTime(item.getTime());
|
||||||
dto.setLineId(item.getLineId());
|
dto.setLineId(item.getLineId());
|
||||||
dto.setPhasicType(item2.getPhasicType());
|
dto.setPhasicType(item2.getPhasicType());
|
||||||
dto.setValueType(item4);
|
dto.setValueType(item4.toUpperCase());
|
||||||
dto.setQualityFlag(Objects.equals(item.getQualityFlag(),"null") ? "0" : item.getQualityFlag());
|
dto.setQualityFlag(Objects.equals(item.getQualityFlag(),"null") ? "0" : item.getQualityFlag());
|
||||||
channelDataFlucHandler(item3,dto,item4,true);
|
channelDataFlucHandler(item3,dto,item4,!Objects.equals(versionUsed, "liaoning"));
|
||||||
result.add(dto);
|
result.add(dto);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
partList = null;
|
|
||||||
});
|
});
|
||||||
if (CollUtil.isNotEmpty(result)) {
|
if (CollUtil.isNotEmpty(result)) {
|
||||||
//存储数据
|
//存储数据
|
||||||
@@ -271,12 +277,13 @@ public class DayDataServiceImpl implements IDayDataService {
|
|||||||
LineCountEvaluateParam lineParam = new LineCountEvaluateParam();
|
LineCountEvaluateParam lineParam = new LineCountEvaluateParam();
|
||||||
lineParam.setStartTime(TimeUtils.getBeginOfDay(calculatedParam.getDataDate()));
|
lineParam.setStartTime(TimeUtils.getBeginOfDay(calculatedParam.getDataDate()));
|
||||||
lineParam.setEndTime(TimeUtils.getEndOfDay(calculatedParam.getDataDate()));
|
lineParam.setEndTime(TimeUtils.getEndOfDay(calculatedParam.getDataDate()));
|
||||||
|
lineParam.setType(calculatedParam.getType());
|
||||||
//以100个监测点分片处理
|
//以100个监测点分片处理
|
||||||
List<List<String>> pendingIds = ListUtils.partition(calculatedParam.getIdList(),NUM);
|
List<List<String>> pendingIds = ListUtils.partition(calculatedParam.getIdList(),NUM);
|
||||||
pendingIds.forEach(list->{
|
pendingIds.forEach(list->{
|
||||||
lineParam.setLineId(list);
|
lineParam.setLineId(list);
|
||||||
//添加异常数据时间点
|
//添加异常数据时间点
|
||||||
getAbnormalData(lineParam);
|
//getAbnormalData(lineParam);
|
||||||
//获取原始数据
|
//获取原始数据
|
||||||
List<CommonMinuteDto> partList = dataHarmphasicIFeignClient.getBaseData(lineParam).getData();
|
List<CommonMinuteDto> partList = dataHarmphasicIFeignClient.getBaseData(lineParam).getData();
|
||||||
if (CollUtil.isNotEmpty(partList)) {
|
if (CollUtil.isNotEmpty(partList)) {
|
||||||
@@ -293,15 +300,14 @@ public class DayDataServiceImpl implements IDayDataService {
|
|||||||
dto.setTime(item.getTime());
|
dto.setTime(item.getTime());
|
||||||
dto.setLineId(item.getLineId());
|
dto.setLineId(item.getLineId());
|
||||||
dto.setPhasicType(item2.getPhasicType());
|
dto.setPhasicType(item2.getPhasicType());
|
||||||
dto.setValueType(item3.getValueType());
|
dto.setValueType(item3.getValueType().toUpperCase());
|
||||||
dto.setQualityFlag(Objects.equals(item.getQualityFlag(),"null") ? "0" : item.getQualityFlag());
|
dto.setQualityFlag(Objects.equals(item.getQualityFlag(),"null") ? "0" : item.getQualityFlag());
|
||||||
channelDataHarmPhasicIHandler(item3,valueTypes,dto,true);
|
channelDataHarmPhasicIHandler(item3,valueTypes,dto,!Objects.equals(versionUsed, "liaoning"));
|
||||||
result.add(dto);
|
result.add(dto);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
partList = null;
|
|
||||||
});
|
});
|
||||||
if (CollUtil.isNotEmpty(result)) {
|
if (CollUtil.isNotEmpty(result)) {
|
||||||
//存储数据
|
//存储数据
|
||||||
@@ -319,12 +325,13 @@ public class DayDataServiceImpl implements IDayDataService {
|
|||||||
LineCountEvaluateParam lineParam = new LineCountEvaluateParam();
|
LineCountEvaluateParam lineParam = new LineCountEvaluateParam();
|
||||||
lineParam.setStartTime(TimeUtils.getBeginOfDay(calculatedParam.getDataDate()));
|
lineParam.setStartTime(TimeUtils.getBeginOfDay(calculatedParam.getDataDate()));
|
||||||
lineParam.setEndTime(TimeUtils.getEndOfDay(calculatedParam.getDataDate()));
|
lineParam.setEndTime(TimeUtils.getEndOfDay(calculatedParam.getDataDate()));
|
||||||
|
lineParam.setType(calculatedParam.getType());
|
||||||
//以100个监测点分片处理
|
//以100个监测点分片处理
|
||||||
List<List<String>> pendingIds = ListUtils.partition(calculatedParam.getIdList(),NUM);
|
List<List<String>> pendingIds = ListUtils.partition(calculatedParam.getIdList(),NUM);
|
||||||
pendingIds.forEach(list->{
|
pendingIds.forEach(list->{
|
||||||
lineParam.setLineId(list);
|
lineParam.setLineId(list);
|
||||||
//添加异常数据时间点
|
//添加异常数据时间点
|
||||||
getAbnormalData(lineParam);
|
//getAbnormalData(lineParam);
|
||||||
//获取原始数据
|
//获取原始数据
|
||||||
List<CommonMinuteDto> partList = dataHarmphasicVFeignClient.getBaseData(lineParam).getData();
|
List<CommonMinuteDto> partList = dataHarmphasicVFeignClient.getBaseData(lineParam).getData();
|
||||||
if (CollUtil.isNotEmpty(partList)) {
|
if (CollUtil.isNotEmpty(partList)) {
|
||||||
@@ -341,15 +348,14 @@ public class DayDataServiceImpl implements IDayDataService {
|
|||||||
dto.setTime(item.getTime());
|
dto.setTime(item.getTime());
|
||||||
dto.setLineId(item.getLineId());
|
dto.setLineId(item.getLineId());
|
||||||
dto.setPhasicType(item2.getPhasicType());
|
dto.setPhasicType(item2.getPhasicType());
|
||||||
dto.setValueType(item3.getValueType());
|
dto.setValueType(item3.getValueType().toUpperCase());
|
||||||
dto.setQualityFlag(Objects.equals(item.getQualityFlag(),"null") ? "0" : item.getQualityFlag());
|
dto.setQualityFlag(Objects.equals(item.getQualityFlag(),"null") ? "0" : item.getQualityFlag());
|
||||||
channelDataHarmPhasicVHandler(item3,valueTypes,dto,true);
|
channelDataHarmPhasicVHandler(item3,valueTypes,dto,!Objects.equals(versionUsed, "liaoning"));
|
||||||
result.add(dto);
|
result.add(dto);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
partList = null;
|
|
||||||
});
|
});
|
||||||
if (CollUtil.isNotEmpty(result)) {
|
if (CollUtil.isNotEmpty(result)) {
|
||||||
//存储数据
|
//存储数据
|
||||||
@@ -367,12 +373,13 @@ public class DayDataServiceImpl implements IDayDataService {
|
|||||||
LineCountEvaluateParam lineParam = new LineCountEvaluateParam();
|
LineCountEvaluateParam lineParam = new LineCountEvaluateParam();
|
||||||
lineParam.setStartTime(TimeUtils.getBeginOfDay(calculatedParam.getDataDate()));
|
lineParam.setStartTime(TimeUtils.getBeginOfDay(calculatedParam.getDataDate()));
|
||||||
lineParam.setEndTime(TimeUtils.getEndOfDay(calculatedParam.getDataDate()));
|
lineParam.setEndTime(TimeUtils.getEndOfDay(calculatedParam.getDataDate()));
|
||||||
|
lineParam.setType(calculatedParam.getType());
|
||||||
//以100个监测点分片处理
|
//以100个监测点分片处理
|
||||||
List<List<String>> pendingIds = ListUtils.partition(calculatedParam.getIdList(),NUM);
|
List<List<String>> pendingIds = ListUtils.partition(calculatedParam.getIdList(),NUM);
|
||||||
pendingIds.forEach(list->{
|
pendingIds.forEach(list->{
|
||||||
lineParam.setLineId(list);
|
lineParam.setLineId(list);
|
||||||
//添加异常数据时间点
|
//添加异常数据时间点
|
||||||
getAbnormalData(lineParam);
|
//getAbnormalData(lineParam);
|
||||||
//获取原始数据
|
//获取原始数据
|
||||||
List<CommonMinuteDto> partList = dataHarmpowerPFeignClient.getBaseData(lineParam).getData();
|
List<CommonMinuteDto> partList = dataHarmpowerPFeignClient.getBaseData(lineParam).getData();
|
||||||
if (CollUtil.isNotEmpty(partList)) {
|
if (CollUtil.isNotEmpty(partList)) {
|
||||||
@@ -389,15 +396,14 @@ public class DayDataServiceImpl implements IDayDataService {
|
|||||||
dto.setTime(item.getTime());
|
dto.setTime(item.getTime());
|
||||||
dto.setLineId(item.getLineId());
|
dto.setLineId(item.getLineId());
|
||||||
dto.setPhasicType(item2.getPhasicType());
|
dto.setPhasicType(item2.getPhasicType());
|
||||||
dto.setValueType(item3.getValueType());
|
dto.setValueType(item3.getValueType().toUpperCase());
|
||||||
dto.setQualityFlag(Objects.equals(item.getQualityFlag(),"null") ? "0" : item.getQualityFlag());
|
dto.setQualityFlag(Objects.equals(item.getQualityFlag(),"null") ? "0" : item.getQualityFlag());
|
||||||
channelDataHarmPowerPHandler(item3,valueTypes,dto,true);
|
channelDataHarmPowerPHandler(item3,valueTypes,dto,!Objects.equals(versionUsed, "liaoning"));
|
||||||
result.add(dto);
|
result.add(dto);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
partList = null;
|
|
||||||
});
|
});
|
||||||
if (CollUtil.isNotEmpty(result)) {
|
if (CollUtil.isNotEmpty(result)) {
|
||||||
//存储数据
|
//存储数据
|
||||||
@@ -415,12 +421,13 @@ public class DayDataServiceImpl implements IDayDataService {
|
|||||||
LineCountEvaluateParam lineParam = new LineCountEvaluateParam();
|
LineCountEvaluateParam lineParam = new LineCountEvaluateParam();
|
||||||
lineParam.setStartTime(TimeUtils.getBeginOfDay(calculatedParam.getDataDate()));
|
lineParam.setStartTime(TimeUtils.getBeginOfDay(calculatedParam.getDataDate()));
|
||||||
lineParam.setEndTime(TimeUtils.getEndOfDay(calculatedParam.getDataDate()));
|
lineParam.setEndTime(TimeUtils.getEndOfDay(calculatedParam.getDataDate()));
|
||||||
|
lineParam.setType(calculatedParam.getType());
|
||||||
//以100个监测点分片处理
|
//以100个监测点分片处理
|
||||||
List<List<String>> pendingIds = ListUtils.partition(calculatedParam.getIdList(),NUM);
|
List<List<String>> pendingIds = ListUtils.partition(calculatedParam.getIdList(),NUM);
|
||||||
pendingIds.forEach(list->{
|
pendingIds.forEach(list->{
|
||||||
lineParam.setLineId(list);
|
lineParam.setLineId(list);
|
||||||
//添加异常数据时间点
|
//添加异常数据时间点
|
||||||
getAbnormalData(lineParam);
|
//getAbnormalData(lineParam);
|
||||||
//获取原始数据
|
//获取原始数据
|
||||||
List<CommonMinuteDto> partList = dataHarmpowerQFeignClient.getBaseData(lineParam).getData();
|
List<CommonMinuteDto> partList = dataHarmpowerQFeignClient.getBaseData(lineParam).getData();
|
||||||
if (CollUtil.isNotEmpty(partList)) {
|
if (CollUtil.isNotEmpty(partList)) {
|
||||||
@@ -437,15 +444,14 @@ public class DayDataServiceImpl implements IDayDataService {
|
|||||||
dto.setTime(item.getTime());
|
dto.setTime(item.getTime());
|
||||||
dto.setLineId(item.getLineId());
|
dto.setLineId(item.getLineId());
|
||||||
dto.setPhasicType(item2.getPhasicType());
|
dto.setPhasicType(item2.getPhasicType());
|
||||||
dto.setValueType(item3.getValueType());
|
dto.setValueType(item3.getValueType().toUpperCase());
|
||||||
dto.setQualityFlag(Objects.equals(item.getQualityFlag(),"null") ? "0" : item.getQualityFlag());
|
dto.setQualityFlag(Objects.equals(item.getQualityFlag(),"null") ? "0" : item.getQualityFlag());
|
||||||
channelDataHarmPowerQHandler(item3,valueTypes,dto,true);
|
channelDataHarmPowerQHandler(item3,valueTypes,dto,!Objects.equals(versionUsed, "liaoning"));
|
||||||
result.add(dto);
|
result.add(dto);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
partList = null;
|
|
||||||
});
|
});
|
||||||
if (CollUtil.isNotEmpty(result)) {
|
if (CollUtil.isNotEmpty(result)) {
|
||||||
//存储数据
|
//存储数据
|
||||||
@@ -463,12 +469,13 @@ public class DayDataServiceImpl implements IDayDataService {
|
|||||||
LineCountEvaluateParam lineParam = new LineCountEvaluateParam();
|
LineCountEvaluateParam lineParam = new LineCountEvaluateParam();
|
||||||
lineParam.setStartTime(TimeUtils.getBeginOfDay(calculatedParam.getDataDate()));
|
lineParam.setStartTime(TimeUtils.getBeginOfDay(calculatedParam.getDataDate()));
|
||||||
lineParam.setEndTime(TimeUtils.getEndOfDay(calculatedParam.getDataDate()));
|
lineParam.setEndTime(TimeUtils.getEndOfDay(calculatedParam.getDataDate()));
|
||||||
|
lineParam.setType(calculatedParam.getType());
|
||||||
//以100个监测点分片处理
|
//以100个监测点分片处理
|
||||||
List<List<String>> pendingIds = ListUtils.partition(calculatedParam.getIdList(),NUM);
|
List<List<String>> pendingIds = ListUtils.partition(calculatedParam.getIdList(),NUM);
|
||||||
pendingIds.forEach(list->{
|
pendingIds.forEach(list->{
|
||||||
lineParam.setLineId(list);
|
lineParam.setLineId(list);
|
||||||
//添加异常数据时间点
|
//添加异常数据时间点
|
||||||
getAbnormalData(lineParam);
|
//getAbnormalData(lineParam);
|
||||||
//获取原始数据
|
//获取原始数据
|
||||||
List<CommonMinuteDto> partList = dataHarmpowerSFeignClient.getBaseData(lineParam).getData();
|
List<CommonMinuteDto> partList = dataHarmpowerSFeignClient.getBaseData(lineParam).getData();
|
||||||
if (CollUtil.isNotEmpty(partList)) {
|
if (CollUtil.isNotEmpty(partList)) {
|
||||||
@@ -485,15 +492,14 @@ public class DayDataServiceImpl implements IDayDataService {
|
|||||||
dto.setTime(item.getTime());
|
dto.setTime(item.getTime());
|
||||||
dto.setLineId(item.getLineId());
|
dto.setLineId(item.getLineId());
|
||||||
dto.setPhasicType(item2.getPhasicType());
|
dto.setPhasicType(item2.getPhasicType());
|
||||||
dto.setValueType(item3.getValueType());
|
dto.setValueType(item3.getValueType().toUpperCase());
|
||||||
dto.setQualityFlag(Objects.equals(item.getQualityFlag(),"null") ? "0" : item.getQualityFlag());
|
dto.setQualityFlag(Objects.equals(item.getQualityFlag(),"null") ? "0" : item.getQualityFlag());
|
||||||
channelDataHarmPowerSHandler(item3,valueTypes,dto,true);
|
channelDataHarmPowerSHandler(item3,valueTypes,dto,!Objects.equals(versionUsed, "liaoning"));
|
||||||
result.add(dto);
|
result.add(dto);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
partList = null;
|
|
||||||
});
|
});
|
||||||
if (CollUtil.isNotEmpty(result)) {
|
if (CollUtil.isNotEmpty(result)) {
|
||||||
//存储数据
|
//存储数据
|
||||||
@@ -511,12 +517,13 @@ public class DayDataServiceImpl implements IDayDataService {
|
|||||||
LineCountEvaluateParam lineParam = new LineCountEvaluateParam();
|
LineCountEvaluateParam lineParam = new LineCountEvaluateParam();
|
||||||
lineParam.setStartTime(TimeUtils.getBeginOfDay(calculatedParam.getDataDate()));
|
lineParam.setStartTime(TimeUtils.getBeginOfDay(calculatedParam.getDataDate()));
|
||||||
lineParam.setEndTime(TimeUtils.getEndOfDay(calculatedParam.getDataDate()));
|
lineParam.setEndTime(TimeUtils.getEndOfDay(calculatedParam.getDataDate()));
|
||||||
|
lineParam.setType(calculatedParam.getType());
|
||||||
//以100个监测点分片处理
|
//以100个监测点分片处理
|
||||||
List<List<String>> pendingIds = ListUtils.partition(calculatedParam.getIdList(),NUM);
|
List<List<String>> pendingIds = ListUtils.partition(calculatedParam.getIdList(),NUM);
|
||||||
pendingIds.forEach(list->{
|
pendingIds.forEach(list->{
|
||||||
lineParam.setLineId(list);
|
lineParam.setLineId(list);
|
||||||
//添加异常数据时间点
|
//添加异常数据时间点
|
||||||
getAbnormalData(lineParam);
|
//getAbnormalData(lineParam);
|
||||||
//获取原始数据
|
//获取原始数据
|
||||||
List<CommonMinuteDto> partList = dataHarmRateIFeignClient.getBaseData(lineParam).getData();
|
List<CommonMinuteDto> partList = dataHarmRateIFeignClient.getBaseData(lineParam).getData();
|
||||||
if (CollUtil.isNotEmpty(partList)) {
|
if (CollUtil.isNotEmpty(partList)) {
|
||||||
@@ -533,15 +540,14 @@ public class DayDataServiceImpl implements IDayDataService {
|
|||||||
dto.setTime(item.getTime());
|
dto.setTime(item.getTime());
|
||||||
dto.setLineId(item.getLineId());
|
dto.setLineId(item.getLineId());
|
||||||
dto.setPhasicType(item2.getPhasicType());
|
dto.setPhasicType(item2.getPhasicType());
|
||||||
dto.setValueType(item3.getValueType());
|
dto.setValueType(item3.getValueType().toUpperCase());
|
||||||
dto.setQualityFlag(Objects.equals(item.getQualityFlag(),"null") ? "0" : item.getQualityFlag());
|
dto.setQualityFlag(Objects.equals(item.getQualityFlag(),"null") ? "0" : item.getQualityFlag());
|
||||||
channelDataHarmRateIHandler(item3,valueTypes,dto,true);
|
channelDataHarmRateIHandler(item3,valueTypes,dto,!Objects.equals(versionUsed, "liaoning"));
|
||||||
result.add(dto);
|
result.add(dto);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
partList = null;
|
|
||||||
});
|
});
|
||||||
if (CollUtil.isNotEmpty(result)) {
|
if (CollUtil.isNotEmpty(result)) {
|
||||||
//存储数据
|
//存储数据
|
||||||
@@ -559,12 +565,13 @@ public class DayDataServiceImpl implements IDayDataService {
|
|||||||
LineCountEvaluateParam lineParam = new LineCountEvaluateParam();
|
LineCountEvaluateParam lineParam = new LineCountEvaluateParam();
|
||||||
lineParam.setStartTime(TimeUtils.getBeginOfDay(calculatedParam.getDataDate()));
|
lineParam.setStartTime(TimeUtils.getBeginOfDay(calculatedParam.getDataDate()));
|
||||||
lineParam.setEndTime(TimeUtils.getEndOfDay(calculatedParam.getDataDate()));
|
lineParam.setEndTime(TimeUtils.getEndOfDay(calculatedParam.getDataDate()));
|
||||||
|
lineParam.setType(calculatedParam.getType());
|
||||||
//以100个监测点分片处理
|
//以100个监测点分片处理
|
||||||
List<List<String>> pendingIds = ListUtils.partition(calculatedParam.getIdList(),NUM);
|
List<List<String>> pendingIds = ListUtils.partition(calculatedParam.getIdList(),NUM);
|
||||||
pendingIds.forEach(list->{
|
pendingIds.forEach(list->{
|
||||||
lineParam.setLineId(list);
|
lineParam.setLineId(list);
|
||||||
//添加异常数据时间点
|
//添加异常数据时间点
|
||||||
getAbnormalData(lineParam);
|
//getAbnormalData(lineParam);
|
||||||
//获取原始数据
|
//获取原始数据
|
||||||
List<CommonMinuteDto> partList = dataHarmRateVFeignClient.getBaseData(lineParam).getData();
|
List<CommonMinuteDto> partList = dataHarmRateVFeignClient.getBaseData(lineParam).getData();
|
||||||
if (CollUtil.isNotEmpty(partList)) {
|
if (CollUtil.isNotEmpty(partList)) {
|
||||||
@@ -581,15 +588,14 @@ public class DayDataServiceImpl implements IDayDataService {
|
|||||||
dto.setTime(item.getTime());
|
dto.setTime(item.getTime());
|
||||||
dto.setLineId(item.getLineId());
|
dto.setLineId(item.getLineId());
|
||||||
dto.setPhasicType(item2.getPhasicType());
|
dto.setPhasicType(item2.getPhasicType());
|
||||||
dto.setValueType(item3.getValueType());
|
dto.setValueType(item3.getValueType().toUpperCase());
|
||||||
dto.setQualityFlag(Objects.equals(item.getQualityFlag(),"null") ? "0" : item.getQualityFlag());
|
dto.setQualityFlag(Objects.equals(item.getQualityFlag(),"null") ? "0" : item.getQualityFlag());
|
||||||
channelDataHarmRateVHandler(item3,valueTypes,dto,true);
|
channelDataHarmRateVHandler(item3,valueTypes,dto,!Objects.equals(versionUsed, "liaoning"));
|
||||||
result.add(dto);
|
result.add(dto);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
partList = null;
|
|
||||||
});
|
});
|
||||||
if (CollUtil.isNotEmpty(result)) {
|
if (CollUtil.isNotEmpty(result)) {
|
||||||
//存储数据
|
//存储数据
|
||||||
@@ -607,12 +613,13 @@ public class DayDataServiceImpl implements IDayDataService {
|
|||||||
LineCountEvaluateParam lineParam = new LineCountEvaluateParam();
|
LineCountEvaluateParam lineParam = new LineCountEvaluateParam();
|
||||||
lineParam.setStartTime(TimeUtils.getBeginOfDay(calculatedParam.getDataDate()));
|
lineParam.setStartTime(TimeUtils.getBeginOfDay(calculatedParam.getDataDate()));
|
||||||
lineParam.setEndTime(TimeUtils.getEndOfDay(calculatedParam.getDataDate()));
|
lineParam.setEndTime(TimeUtils.getEndOfDay(calculatedParam.getDataDate()));
|
||||||
|
lineParam.setType(calculatedParam.getType());
|
||||||
//以100个监测点分片处理
|
//以100个监测点分片处理
|
||||||
List<List<String>> pendingIds = ListUtils.partition(calculatedParam.getIdList(),NUM);
|
List<List<String>> pendingIds = ListUtils.partition(calculatedParam.getIdList(),NUM);
|
||||||
pendingIds.forEach(list->{
|
pendingIds.forEach(list->{
|
||||||
lineParam.setLineId(list);
|
lineParam.setLineId(list);
|
||||||
//添加异常数据时间点
|
//添加异常数据时间点
|
||||||
getAbnormalData(lineParam);
|
//getAbnormalData(lineParam);
|
||||||
//获取原始数据
|
//获取原始数据
|
||||||
List<CommonMinuteDto> partList = dataInharmIFeignClient.getBaseData(lineParam).getData();
|
List<CommonMinuteDto> partList = dataInharmIFeignClient.getBaseData(lineParam).getData();
|
||||||
if (CollUtil.isNotEmpty(partList)) {
|
if (CollUtil.isNotEmpty(partList)) {
|
||||||
@@ -629,15 +636,14 @@ public class DayDataServiceImpl implements IDayDataService {
|
|||||||
dto.setTime(item.getTime());
|
dto.setTime(item.getTime());
|
||||||
dto.setLineId(item.getLineId());
|
dto.setLineId(item.getLineId());
|
||||||
dto.setPhasicType(item2.getPhasicType());
|
dto.setPhasicType(item2.getPhasicType());
|
||||||
dto.setValueType(item3.getValueType());
|
dto.setValueType(item3.getValueType().toUpperCase());
|
||||||
dto.setQualityFlag(Objects.equals(item.getQualityFlag(),"null") ? "0" : item.getQualityFlag());
|
dto.setQualityFlag(Objects.equals(item.getQualityFlag(),"null") ? "0" : item.getQualityFlag());
|
||||||
channelDataInHarmIHandler(item3,valueTypes,dto,true);
|
channelDataInHarmIHandler(item3,valueTypes,dto,!Objects.equals(versionUsed, "liaoning"));
|
||||||
result.add(dto);
|
result.add(dto);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
partList = null;
|
|
||||||
});
|
});
|
||||||
if (CollUtil.isNotEmpty(result)) {
|
if (CollUtil.isNotEmpty(result)) {
|
||||||
//存储数据
|
//存储数据
|
||||||
@@ -655,12 +661,13 @@ public class DayDataServiceImpl implements IDayDataService {
|
|||||||
LineCountEvaluateParam lineParam = new LineCountEvaluateParam();
|
LineCountEvaluateParam lineParam = new LineCountEvaluateParam();
|
||||||
lineParam.setStartTime(TimeUtils.getBeginOfDay(calculatedParam.getDataDate()));
|
lineParam.setStartTime(TimeUtils.getBeginOfDay(calculatedParam.getDataDate()));
|
||||||
lineParam.setEndTime(TimeUtils.getEndOfDay(calculatedParam.getDataDate()));
|
lineParam.setEndTime(TimeUtils.getEndOfDay(calculatedParam.getDataDate()));
|
||||||
|
lineParam.setType(calculatedParam.getType());
|
||||||
//以100个监测点分片处理
|
//以100个监测点分片处理
|
||||||
List<List<String>> pendingIds = ListUtils.partition(calculatedParam.getIdList(),NUM);
|
List<List<String>> pendingIds = ListUtils.partition(calculatedParam.getIdList(),NUM);
|
||||||
pendingIds.forEach(list->{
|
pendingIds.forEach(list->{
|
||||||
lineParam.setLineId(list);
|
lineParam.setLineId(list);
|
||||||
//添加异常数据时间点
|
//添加异常数据时间点
|
||||||
getAbnormalData(lineParam);
|
//getAbnormalData(lineParam);
|
||||||
//获取原始数据
|
//获取原始数据
|
||||||
List<CommonMinuteDto> partList = dataInharmVFeignClient.getBaseData(lineParam).getData();
|
List<CommonMinuteDto> partList = dataInharmVFeignClient.getBaseData(lineParam).getData();
|
||||||
if (CollUtil.isNotEmpty(partList)) {
|
if (CollUtil.isNotEmpty(partList)) {
|
||||||
@@ -677,15 +684,14 @@ public class DayDataServiceImpl implements IDayDataService {
|
|||||||
dto.setTime(item.getTime());
|
dto.setTime(item.getTime());
|
||||||
dto.setLineId(item.getLineId());
|
dto.setLineId(item.getLineId());
|
||||||
dto.setPhasicType(item2.getPhasicType());
|
dto.setPhasicType(item2.getPhasicType());
|
||||||
dto.setValueType(item3.getValueType());
|
dto.setValueType(item3.getValueType().toUpperCase());
|
||||||
dto.setQualityFlag(Objects.equals(item.getQualityFlag(),"null") ? "0" : item.getQualityFlag());
|
dto.setQualityFlag(Objects.equals(item.getQualityFlag(),"null") ? "0" : item.getQualityFlag());
|
||||||
channelDataInHarmVHandler(item3,valueTypes,dto,true);
|
channelDataInHarmVHandler(item3,valueTypes,dto,!Objects.equals(versionUsed, "liaoning"));
|
||||||
result.add(dto);
|
result.add(dto);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
partList = null;
|
|
||||||
});
|
});
|
||||||
if (CollUtil.isNotEmpty(result)) {
|
if (CollUtil.isNotEmpty(result)) {
|
||||||
//存储数据
|
//存储数据
|
||||||
@@ -704,12 +710,13 @@ public class DayDataServiceImpl implements IDayDataService {
|
|||||||
LineCountEvaluateParam lineParam = new LineCountEvaluateParam();
|
LineCountEvaluateParam lineParam = new LineCountEvaluateParam();
|
||||||
lineParam.setStartTime(TimeUtils.getBeginOfDay(calculatedParam.getDataDate()));
|
lineParam.setStartTime(TimeUtils.getBeginOfDay(calculatedParam.getDataDate()));
|
||||||
lineParam.setEndTime(TimeUtils.getEndOfDay(calculatedParam.getDataDate()));
|
lineParam.setEndTime(TimeUtils.getEndOfDay(calculatedParam.getDataDate()));
|
||||||
|
lineParam.setType(calculatedParam.getType());
|
||||||
//以100个监测点分片处理
|
//以100个监测点分片处理
|
||||||
List<List<String>> pendingIds = ListUtils.partition(calculatedParam.getIdList(),NUM);
|
List<List<String>> pendingIds = ListUtils.partition(calculatedParam.getIdList(),NUM);
|
||||||
pendingIds.forEach(list->{
|
pendingIds.forEach(list->{
|
||||||
lineParam.setLineId(list);
|
lineParam.setLineId(list);
|
||||||
//添加异常数据时间点
|
//添加异常数据时间点
|
||||||
getAbnormalData(lineParam);
|
//getAbnormalData(lineParam);
|
||||||
//获取原始数据
|
//获取原始数据
|
||||||
List<CommonMinuteDto> partList = dataPltFeignClient.getBaseData(lineParam).getData();
|
List<CommonMinuteDto> partList = dataPltFeignClient.getBaseData(lineParam).getData();
|
||||||
if (CollUtil.isNotEmpty(partList)) {
|
if (CollUtil.isNotEmpty(partList)) {
|
||||||
@@ -725,16 +732,15 @@ public class DayDataServiceImpl implements IDayDataService {
|
|||||||
dto.setTime(item.getTime());
|
dto.setTime(item.getTime());
|
||||||
dto.setLineId(item.getLineId());
|
dto.setLineId(item.getLineId());
|
||||||
dto.setPhasicType(item2.getPhasicType());
|
dto.setPhasicType(item2.getPhasicType());
|
||||||
dto.setValueType(item4);
|
dto.setValueType(item4.toUpperCase());
|
||||||
dto.setQualityFlag(Objects.equals(item.getQualityFlag(),"null") ? "0" : item.getQualityFlag());
|
dto.setQualityFlag(Objects.equals(item.getQualityFlag(),"null") ? "0" : item.getQualityFlag());
|
||||||
channelDataPltHandler(item3,dto,item4,true);
|
channelDataPltHandler(item3,dto,item4,!Objects.equals(versionUsed, "liaoning"));
|
||||||
result.add(dto);
|
result.add(dto);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
partList = null;
|
|
||||||
});
|
});
|
||||||
if (CollUtil.isNotEmpty(result)) {
|
if (CollUtil.isNotEmpty(result)) {
|
||||||
//存储数据
|
//存储数据
|
||||||
@@ -756,10 +762,8 @@ public class DayDataServiceImpl implements IDayDataService {
|
|||||||
Collectors.mapping(item->TimeUtils.LocalDateTimeToString(item.getTime()), Collectors.toList())
|
Collectors.mapping(item->TimeUtils.LocalDateTimeToString(item.getTime()), Collectors.toList())
|
||||||
));
|
));
|
||||||
lineParam.setAbnormalTime(timeMap);
|
lineParam.setAbnormalTime(timeMap);
|
||||||
|
|
||||||
pqDataVerifies.clear();
|
pqDataVerifies.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//指标处理
|
//指标处理
|
||||||
@@ -1551,47 +1555,64 @@ public class DayDataServiceImpl implements IDayDataService {
|
|||||||
valueType = valueType.toUpperCase();
|
valueType = valueType.toUpperCase();
|
||||||
if (scheme) {
|
if (scheme) {
|
||||||
switch (valueType) {
|
switch (valueType) {
|
||||||
case InfluxDbSqlConstant.MAX:
|
case "MAX":
|
||||||
case InfluxDbSqlConstant.CP95:
|
case "CP95":
|
||||||
Optional<Double> max = list.stream().filter(Objects::nonNull).max(Double::compare);
|
Optional<Double> max = list.stream().filter(Objects::nonNull).max(Double::compare);
|
||||||
result = max.orElse(null);
|
result = max.orElse(0.0);
|
||||||
break;
|
break;
|
||||||
case InfluxDbSqlConstant.MIN:
|
case "MIN":
|
||||||
Optional<Double> min = list.stream().filter(Objects::nonNull).min(Double::compare);
|
Optional<Double> min = list.stream().filter(Objects::nonNull).min(Double::compare);
|
||||||
result = min.orElse(null);
|
result = min.orElse(0.0);
|
||||||
break;
|
break;
|
||||||
case InfluxDbSqlConstant.AVG_WEB:
|
case "AVG":
|
||||||
OptionalDouble average = list.stream()
|
OptionalDouble average = list.stream()
|
||||||
.filter(Objects::nonNull)
|
.filter(Objects::nonNull)
|
||||||
.mapToDouble(Double::doubleValue)
|
.mapToDouble(Double::doubleValue)
|
||||||
.average();
|
.average();
|
||||||
result = average.isPresent() ? average.getAsDouble() : null;
|
result = average.isPresent() ? average.getAsDouble() : 0.0;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
switch (valueType) {
|
switch (valueType) {
|
||||||
case InfluxDbSqlConstant.MAX:
|
case "MAX":
|
||||||
Optional<Double> max = list.stream().filter(Objects::nonNull).max(Double::compare);
|
Optional<Double> max = list.stream().filter(Objects::nonNull).max(Double::compare);
|
||||||
result = max.orElse(null);
|
result = max.orElse(0.0);
|
||||||
break;
|
break;
|
||||||
case InfluxDbSqlConstant.MIN:
|
case "MIN":
|
||||||
Optional<Double> min = list.stream().filter(Objects::nonNull).min(Double::compare);
|
Optional<Double> min = list.stream().filter(Objects::nonNull).min(Double::compare);
|
||||||
result = min.orElse(null);
|
result = min.orElse(0.0);
|
||||||
break;
|
break;
|
||||||
case InfluxDbSqlConstant.AVG_WEB:
|
case "AVG":
|
||||||
OptionalDouble average = list.stream()
|
OptionalDouble average = list.stream()
|
||||||
.filter(Objects::nonNull)
|
.filter(Objects::nonNull)
|
||||||
.mapToDouble(Double::doubleValue)
|
.mapToDouble(Double::doubleValue)
|
||||||
.average();
|
.average();
|
||||||
result = average.isPresent() ? average.getAsDouble() : null;
|
result = average.isPresent() ? average.getAsDouble() : 0.0;
|
||||||
break;
|
break;
|
||||||
case InfluxDbSqlConstant.CP95:
|
case "CP95":
|
||||||
list.sort(Collections.reverseOrder());
|
if (list == null || list.isEmpty()) {
|
||||||
int discardCount = (int) Math.ceil(list.size() * 0.05);
|
result = 0.0;
|
||||||
List<Double> remainingList = list.subList(discardCount, list.size());
|
break;
|
||||||
result = remainingList.isEmpty() ? null : remainingList.get(0);
|
}
|
||||||
|
// 过滤掉 null 元素
|
||||||
|
List<Double> filteredList = list.stream()
|
||||||
|
.filter(Objects::nonNull)
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
|
||||||
|
if (filteredList.isEmpty()) {
|
||||||
|
result = 0.0;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
filteredList.sort(Collections.reverseOrder());
|
||||||
|
int discardCount = (int) Math.ceil(filteredList.size() * 0.05);
|
||||||
|
if (discardCount >= filteredList.size()) {
|
||||||
|
result = 0.0;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
List<Double> remainingList = filteredList.subList(discardCount, filteredList.size());
|
||||||
|
result = remainingList.isEmpty() ? 0.0 : remainingList.get(0);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
@@ -1605,4 +1626,28 @@ public class DayDataServiceImpl implements IDayDataService {
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 将平均值赋值给 CP95
|
||||||
|
*/
|
||||||
|
public void putCP95ByAvg(List<CommonMinuteDto> list) {
|
||||||
|
list.forEach(po1->{
|
||||||
|
List<CommonMinuteDto.PhasicType> phasicTypeList = po1.getPhasicTypeList();
|
||||||
|
phasicTypeList.forEach(po2 -> {
|
||||||
|
List<CommonMinuteDto.ValueType> valueTypeList = po2.getValueTypeList();
|
||||||
|
AtomicReference<List<List<Double>>> valueList = new AtomicReference<>(new ArrayList<>());
|
||||||
|
valueTypeList.forEach(po3 -> {
|
||||||
|
if (po3.getValueType().equals(InfluxDbSqlConstant.AVG_WEB)) {
|
||||||
|
valueList.set(po3.getValueList());
|
||||||
|
}
|
||||||
|
if (po3.getValueType().equals(InfluxDbSqlConstant.CP95)) {
|
||||||
|
po3.setValueList((List<List<Double>>) valueList);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
File diff suppressed because it is too large
Load Diff
@@ -6,28 +6,32 @@ import cn.hutool.core.collection.ListUtil;
|
|||||||
import cn.hutool.core.date.DatePattern;
|
import cn.hutool.core.date.DatePattern;
|
||||||
import cn.hutool.core.date.LocalDateTimeUtil;
|
import cn.hutool.core.date.LocalDateTimeUtil;
|
||||||
import cn.hutool.core.util.ObjectUtil;
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
import com.alibaba.fastjson.JSON;
|
|
||||||
import com.njcn.algorithm.pojo.bo.CalculatedParam;
|
import com.njcn.algorithm.pojo.bo.CalculatedParam;
|
||||||
import com.njcn.algorithm.service.line.IDataCrossingService;
|
import com.njcn.algorithm.service.line.IDataCrossingService;
|
||||||
|
import com.njcn.algorithm.service.line.IDataLimitRateAsync;
|
||||||
import com.njcn.algorithm.utils.MemorySizeUtil;
|
import com.njcn.algorithm.utils.MemorySizeUtil;
|
||||||
import com.njcn.common.utils.PubUtils;
|
import com.njcn.common.utils.PubUtils;
|
||||||
import com.njcn.dataProcess.api.*;
|
import com.njcn.csdevice.api.CsLineFeignClient;
|
||||||
|
import com.njcn.csdevice.api.CsOverLimitClient;
|
||||||
|
import com.njcn.dataProcess.api.DataLimitQualifiedFeignClient;
|
||||||
|
import com.njcn.dataProcess.api.DataLimitRateFeignClient;
|
||||||
|
import com.njcn.dataProcess.api.DataLimitTargetFeignClient;
|
||||||
import com.njcn.dataProcess.constant.PhaseType;
|
import com.njcn.dataProcess.constant.PhaseType;
|
||||||
import com.njcn.dataProcess.enums.DataCleanEnum;
|
|
||||||
import com.njcn.dataProcess.param.LineCountEvaluateParam;
|
import com.njcn.dataProcess.param.LineCountEvaluateParam;
|
||||||
import com.njcn.dataProcess.pojo.dto.*;
|
import com.njcn.dataProcess.pojo.dto.DataLimitDetailDto;
|
||||||
import com.njcn.dataProcess.pojo.po.PqDataVerify;
|
import com.njcn.dataProcess.pojo.dto.DataLimitRateDto;
|
||||||
|
import com.njcn.dataProcess.pojo.dto.DataLimitTargetDto;
|
||||||
|
import com.njcn.dataProcess.pojo.dto.DataQualifiedDetail;
|
||||||
import com.njcn.dataProcess.util.TimeUtils;
|
import com.njcn.dataProcess.util.TimeUtils;
|
||||||
import com.njcn.device.biz.commApi.CommTerminalGeneralClient;
|
import com.njcn.device.biz.commApi.CommTerminalGeneralClient;
|
||||||
import com.njcn.device.biz.pojo.po.Overlimit;
|
import com.njcn.device.biz.pojo.po.Overlimit;
|
||||||
import com.njcn.influx.constant.InfluxDbSqlConstant;
|
|
||||||
import com.njcn.influx.pojo.constant.InfluxDBTableConstant;
|
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.apache.commons.collections4.ListUtils;
|
import org.apache.commons.collections4.ListUtils;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
import org.springframework.beans.BeanUtils;
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
import org.springframework.util.CollectionUtils;
|
import org.springframework.util.CollectionUtils;
|
||||||
@@ -38,7 +42,11 @@ import java.lang.reflect.Method;
|
|||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.math.RoundingMode;
|
import java.math.RoundingMode;
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
import java.util.*;
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Objects;
|
||||||
|
import java.util.concurrent.CompletableFuture;
|
||||||
import java.util.function.Function;
|
import java.util.function.Function;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
@@ -54,209 +62,74 @@ public class IDataCrossingServiceImpl implements IDataCrossingService {
|
|||||||
|
|
||||||
private static final Logger logger = LoggerFactory.getLogger(DayDataServiceImpl.class);
|
private static final Logger logger = LoggerFactory.getLogger(DayDataServiceImpl.class);
|
||||||
@Value("${line.num}")
|
@Value("${line.num}")
|
||||||
private Integer NUM = 100;
|
private Integer NUM;
|
||||||
@Resource
|
|
||||||
private DataVFeignClient dataVFeignClient;
|
|
||||||
@Resource
|
@Resource
|
||||||
private CommTerminalGeneralClient commTerminalGeneralClient;
|
private CommTerminalGeneralClient commTerminalGeneralClient;
|
||||||
@Resource
|
@Resource
|
||||||
private DataIFeignClient dataIFeignClient;
|
|
||||||
@Resource
|
|
||||||
private DataPltFeignClient dataPltFeignClient;
|
|
||||||
@Resource
|
|
||||||
private DataInharmVFeignClient dataInharmVFeignClient;
|
|
||||||
@Resource
|
|
||||||
private DataHarmRateVFeignClient dataHarmRateVFeignClient;
|
|
||||||
@Resource
|
|
||||||
private DataLimitRateFeignClient dataLimitRateFeignClient;
|
private DataLimitRateFeignClient dataLimitRateFeignClient;
|
||||||
@Resource
|
@Resource
|
||||||
private DataLimitRateDetailFeignClient dataLimitRateDetailFeignClient;
|
|
||||||
@Resource
|
|
||||||
private PqDataVerifyFeignClient pqDataVerifyFeignClient;
|
|
||||||
@Resource
|
|
||||||
private DataLimitTargetFeignClient dataLimitTargetFeignClient;
|
private DataLimitTargetFeignClient dataLimitTargetFeignClient;
|
||||||
@Resource
|
@Resource
|
||||||
private DataLimitQualifiedFeignClient dataLimitQualifiedFeignClient;
|
private DataLimitQualifiedFeignClient dataLimitQualifiedFeignClient;
|
||||||
|
@Resource
|
||||||
|
private IDataLimitRateAsync dataLimitRateAsync;
|
||||||
|
@Resource
|
||||||
|
private CsLineFeignClient csLineFeignClient;
|
||||||
|
@Resource
|
||||||
|
private CsOverLimitClient csOverLimitClient;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void limitRateHandler(CalculatedParam calculatedParam) {
|
public void limitRateHandler(CalculatedParam calculatedParam) {
|
||||||
MemorySizeUtil.getNowMemory();
|
MemorySizeUtil.getNowMemory();
|
||||||
|
System.err.println("limitRate表转r_stat_limit_rate_d算法开始,执行日期为{}=====》"+calculatedParam.getDataDate());
|
||||||
Runtime runtime = Runtime.getRuntime();
|
|
||||||
// 获取 JVM 最大可用内存(以字节为单位)
|
|
||||||
long maxMemory = runtime.maxMemory();
|
|
||||||
// 获取 JVM 当前已分配的内存(以字节为单位)
|
|
||||||
long totalMemory = runtime.totalMemory();
|
|
||||||
// 获取 JVM 当前空闲内存(以字节为单位)
|
|
||||||
long freeMemory = runtime.freeMemory();
|
|
||||||
// 计算已使用的内存
|
|
||||||
long usedMemory = totalMemory - freeMemory;
|
|
||||||
|
|
||||||
System.out.println("最大可用内存: " + maxMemory / (1024 * 1024) + " MB");
|
|
||||||
System.out.println("当前已分配的内存: " + totalMemory / (1024 * 1024) + " MB");
|
|
||||||
System.out.println("当前空闲内存: " + freeMemory / (1024 * 1024) + " MB");
|
|
||||||
System.out.println("已使用的内存: " + usedMemory / (1024 * 1024) + " MB");
|
|
||||||
System.out.println("第一次分析结束-----------------------------------------");
|
|
||||||
|
|
||||||
logger.info("{},limitRate表转r_stat_limit_rate_d算法开始=====》", LocalDateTime.now());
|
|
||||||
List<DataLimitDetailDto> result = new ArrayList<>();
|
List<DataLimitDetailDto> result = new ArrayList<>();
|
||||||
//远程接口获取分钟数据
|
//远程接口获取分钟数据
|
||||||
LineCountEvaluateParam lineParam = new LineCountEvaluateParam();
|
LineCountEvaluateParam lineParam = new LineCountEvaluateParam();
|
||||||
lineParam.setStartTime(TimeUtils.getBeginOfDay(calculatedParam.getDataDate()));
|
lineParam.setStartTime(TimeUtils.getBeginOfDay(calculatedParam.getDataDate()));
|
||||||
lineParam.setEndTime(TimeUtils.getEndOfDay(calculatedParam.getDataDate()));
|
lineParam.setEndTime(TimeUtils.getEndOfDay(calculatedParam.getDataDate()));
|
||||||
|
lineParam.setType(calculatedParam.getType());
|
||||||
List<String> lineIds = calculatedParam.getIdList();
|
List<String> lineIds = calculatedParam.getIdList();
|
||||||
|
List<Overlimit> overLimitList;
|
||||||
//获取所有监测点的限值
|
//获取所有监测点的限值
|
||||||
List<Overlimit> overLimitList = commTerminalGeneralClient.getOverLimitDataByIds(lineIds).getData();
|
if (Objects.equals(lineParam.getType(), 2)) {
|
||||||
|
List<Overlimit> list = csOverLimitClient.getOverLimitByLineIds(lineIds).getData();
|
||||||
|
overLimitList = list.stream()
|
||||||
|
.map(item -> {
|
||||||
|
Overlimit overlimit = new Overlimit();
|
||||||
|
BeanUtils.copyProperties(item, overlimit);
|
||||||
|
return overlimit;
|
||||||
|
})
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
} else {
|
||||||
|
overLimitList = commTerminalGeneralClient.getOverLimitDataByIds(lineIds).getData();
|
||||||
|
}
|
||||||
Map<String, Overlimit> overLimitMap = overLimitList.stream().collect(Collectors.toMap(Overlimit::getId, Function.identity()));
|
Map<String, Overlimit> overLimitMap = overLimitList.stream().collect(Collectors.toMap(Overlimit::getId, Function.identity()));
|
||||||
//添加异常数据时间点
|
|
||||||
getAbnormalData(lineParam);
|
|
||||||
//以100个监测点分片处理
|
//以100个监测点分片处理
|
||||||
List<List<String>> pendingIds = ListUtils.partition(lineIds, NUM);
|
List<List<String>> pendingIds = ListUtils.partition(lineIds, 1);
|
||||||
ArrayList<String> phase = ListUtil.toList(PhaseType.PHASE_A, PhaseType.PHASE_B, PhaseType.PHASE_C);
|
ArrayList<String> phase = ListUtil.toList(PhaseType.PHASE_A, PhaseType.PHASE_B, PhaseType.PHASE_C);
|
||||||
MemorySizeUtil.getNowMemory();
|
MemorySizeUtil.getNowMemory();
|
||||||
pendingIds.forEach(list -> {
|
|
||||||
lineParam.setLineId(list);
|
|
||||||
//获取电压数据
|
|
||||||
List<DataVDto> dataVAllTime = dataVFeignClient.getRawData(lineParam).getData();
|
|
||||||
//闪变数据
|
|
||||||
List<DataPltDto> dataFlickerAllTime = dataPltFeignClient.getRawData(lineParam).getData();
|
|
||||||
//谐波数据
|
|
||||||
List<DataHarmDto> dataVHarmList = dataHarmRateVFeignClient.getRawData(lineParam).getData();
|
|
||||||
//间谐波数据
|
|
||||||
List<DataHarmDto> dataVInHarmList = dataInharmVFeignClient.getRawData(lineParam).getData();
|
|
||||||
//电流数据
|
|
||||||
List<DataIDto> dataIList = dataIFeignClient.getRawData(lineParam).getData();
|
|
||||||
/**
|
|
||||||
* 功能描述:获取influxDB -> data_v ->
|
|
||||||
* 总计算次数(用data_v中phasic_type=A,value_type=avg,quality_flag=0来参与统计)
|
|
||||||
*/
|
|
||||||
Map<String, List<DataVDto>> allTime = dataVAllTime.stream()
|
|
||||||
.filter(x -> PhaseType.PHASE_A.equals(x.getPhasicType()))
|
|
||||||
.filter(x -> InfluxDbSqlConstant.AVG_WEB.equals(x.getValueType()))
|
|
||||||
.collect(Collectors.groupingBy(DataVDto::getLineId));
|
|
||||||
|
|
||||||
/**
|
List<CompletableFuture<Void>> futures = new ArrayList<>();
|
||||||
* 功能描述:获取influxDB -> data_plt ->
|
for (int i = 0; i < pendingIds.size(); i++) {
|
||||||
* 闪变总计算次数(用data_plt中phasic_type=A,quality_flag=0来参与统计)
|
logger.info(calculatedParam.getDataDate()+" 总分区数据:" + pendingIds.size() + "=====》当前第"+(i + 1)+"小分区");
|
||||||
*/
|
List<String> list = pendingIds.get(i);
|
||||||
Map<String, List<DataPltDto>> flickerAllTime = dataFlickerAllTime.stream()
|
// 获取Future
|
||||||
.filter(x -> PhaseType.PHASE_A.equals(x.getPhasicType()))
|
CompletableFuture<Void> future = dataLimitRateAsync.lineDataRate(
|
||||||
.collect(Collectors.groupingBy(DataPltDto::getLineId));
|
calculatedParam.getDataDate(),
|
||||||
|
list,
|
||||||
|
phase,
|
||||||
|
overLimitMap,
|
||||||
|
pendingIds.size(),
|
||||||
|
(i + 1),
|
||||||
|
lineParam.getType()
|
||||||
|
);
|
||||||
|
|
||||||
/**
|
futures.add(future);
|
||||||
*功能描述:获取influxDB -> data_harmrate_v ->
|
|
||||||
* 2-25次谐波电压含有率 -> A相||B相||C相的日95%概率值
|
|
||||||
*/
|
|
||||||
Map<String, List<DataHarmDto>> harmRateV = dataVHarmList.stream()
|
|
||||||
.filter(x -> phase.contains(x.getPhasicType()))
|
|
||||||
.filter(x -> InfluxDBTableConstant.CP95.equals(x.getValueType()))
|
|
||||||
.collect(Collectors.groupingBy(DataHarmDto::getLineId));
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 功能描述:获取influxDB -> data_i -> 2-25次谐波电流 -> 日95%概率值
|
|
||||||
*/
|
|
||||||
Map<String, List<DataIDto>> dataI = dataIList.stream()
|
|
||||||
.filter(x -> phase.contains(x.getPhasicType()))
|
|
||||||
.filter(x -> InfluxDBTableConstant.CP95.equals(x.getValueType()))
|
|
||||||
.collect(Collectors.groupingBy(DataIDto::getLineId));
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 功能描述:获取influxDB -> data_inharm_v -> 0.5-15.5次间谐波电压含有率 -> 日95%概率值
|
|
||||||
*/
|
|
||||||
Map<String, List<DataHarmDto>> inHarmV = dataVInHarmList.stream()
|
|
||||||
.filter(x -> phase.contains(x.getPhasicType()))
|
|
||||||
.filter(x -> InfluxDBTableConstant.CP95.equals(x.getValueType()))
|
|
||||||
.collect(Collectors.groupingBy(DataHarmDto::getLineId));
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 功能描述:获取influxDB -> data_v -> 电压总谐波畸变率 -> 日95%概率值
|
|
||||||
*/
|
|
||||||
Map<String, List<DataVDto>> dataVThd = dataVAllTime.stream()
|
|
||||||
.filter(x -> phase.contains(x.getPhasicType()))
|
|
||||||
.filter(x -> InfluxDBTableConstant.CP95.equals(x.getValueType()))
|
|
||||||
.collect(Collectors.groupingBy(DataVDto::getLineId));
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 功能描述:获取influxDB -> data_v -> 负序电压不平衡度 -> 最大值 && 日95%概率值
|
|
||||||
*/
|
|
||||||
Map<String, List<DataVDto>> dataVUnbalance = dataVAllTime.stream()
|
|
||||||
.filter(x -> InfluxDBTableConstant.PHASE_TYPE_T.equals(x.getPhasicType()))
|
|
||||||
.filter(x -> InfluxDBTableConstant.CP95.equals(x.getValueType()) ||
|
|
||||||
InfluxDBTableConstant.MAX.equals(x.getValueType()))
|
|
||||||
.collect(Collectors.groupingBy(DataVDto::getLineId));
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 功能描述:获取influxDB -> data_i -> 负序电流 -> 最大值 && 日95%概率值
|
|
||||||
*/
|
|
||||||
Map<String, List<DataIDto>> dataINeg = dataIList.stream()
|
|
||||||
.filter(x -> InfluxDBTableConstant.PHASE_TYPE_T.equals(x.getPhasicType()))
|
|
||||||
.filter(x -> InfluxDBTableConstant.CP95.equals(x.getValueType()) ||
|
|
||||||
InfluxDBTableConstant.MAX.equals(x.getValueType()))
|
|
||||||
.collect(Collectors.groupingBy(DataIDto::getLineId));
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 功能描述:获取influxDB -> data_v -> 频率偏差 -> 最大值 && 最小值
|
|
||||||
*/
|
|
||||||
Map<String, List<DataVDto>> dataVFreq = dataVAllTime.stream()
|
|
||||||
.filter(x -> InfluxDBTableConstant.PHASE_TYPE_T.equals(x.getPhasicType()))
|
|
||||||
.filter(x -> InfluxDBTableConstant.MIN.equals(x.getValueType()) ||
|
|
||||||
InfluxDBTableConstant.MAX.equals(x.getValueType()))
|
|
||||||
.collect(Collectors.groupingBy(DataVDto::getLineId));
|
|
||||||
/**
|
|
||||||
* 功能描述:获取influxDB -> data_v -> 电压偏差 -> 最大值
|
|
||||||
*/
|
|
||||||
Map<String, List<DataVDto>> dataVDev = dataVAllTime.stream()
|
|
||||||
.filter(x -> phase.contains(x.getPhasicType()))
|
|
||||||
.filter(x -> InfluxDBTableConstant.MAX.equals(x.getValueType()))
|
|
||||||
.collect(Collectors.groupingBy(DataVDto::getLineId));
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 功能描述:获取influxDB -> data_plt -> 长时间闪变 -> 注(取最大值原始算法去掉了,现没有根据最大值比较)
|
|
||||||
*/
|
|
||||||
Map<String, List<DataPltDto>> dataPlt = dataFlickerAllTime.stream()
|
|
||||||
.filter(x -> phase.contains(x.getPhasicType()))
|
|
||||||
.collect(Collectors.groupingBy(DataPltDto::getLineId));
|
|
||||||
|
|
||||||
for (String item : list) {
|
|
||||||
if(ObjectUtil.isNotNull(overLimitMap.get(item))){
|
|
||||||
result.addAll(getData(calculatedParam.getDataDate(),
|
|
||||||
overLimitMap.get(item),
|
|
||||||
allTime.get(item),
|
|
||||||
flickerAllTime.get(item),
|
|
||||||
harmRateV.get(item),
|
|
||||||
dataI.get(item),
|
|
||||||
inHarmV.get(item),
|
|
||||||
dataVThd.get(item),
|
|
||||||
dataVUnbalance.get(item),
|
|
||||||
dataINeg.get(item),
|
|
||||||
dataVFreq.get(item),
|
|
||||||
dataVDev.get(item),
|
|
||||||
dataPlt.get(item)));
|
|
||||||
}
|
}
|
||||||
}
|
// 等待所有任务完成
|
||||||
});
|
CompletableFuture.allOf(futures.toArray(new CompletableFuture[0])).join();
|
||||||
MemorySizeUtil.getNowMemory();
|
|
||||||
if (CollUtil.isNotEmpty(result)) {
|
|
||||||
//存储数据
|
|
||||||
List<DataLimitRateDto> dataLimitRate = result.stream().map(DataLimitDetailDto::getDataLimitRate).filter(x -> ObjectUtil.isNotNull(x)).collect(Collectors.toList());
|
|
||||||
if(CollUtil.isNotEmpty(dataLimitRate)){
|
|
||||||
dataLimitRateFeignClient.batchInsertion(dataLimitRate);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
if (CollUtil.isNotEmpty(result)) {
|
|
||||||
//存储数据
|
|
||||||
List<DataLimitRateDetailDto> detail = result.stream().map(DataLimitDetailDto::getDataLimitRateDetail).filter(x -> ObjectUtil.isNotNull(x)).collect(Collectors.toList());
|
|
||||||
if(CollUtil.isNotEmpty(detail)){
|
|
||||||
dataLimitRateDetailFeignClient.batchInsertion(detail);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
System.gc();
|
System.gc();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -461,664 +334,6 @@ public class IDataCrossingServiceImpl implements IDataCrossingService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @Description: getData
|
|
||||||
* @Param: [overlimit, allTimeList, flickerAllTimeList, dataHarmRateVPOList, dataIPOList, dataInHarmVPOList, dataVPOList, dataVPOUnbalanceList, dataIPONegList, dataVPOFreqList, dataVPODevList, dataPltPOList]
|
|
||||||
* @return: java.util.List<com.njcn.harmonic.pojo.po.LimitRate>
|
|
||||||
* @Author: clam
|
|
||||||
* @Date: 2022/10/18
|
|
||||||
*/
|
|
||||||
private List<DataLimitDetailDto> getData(String dataDate,
|
|
||||||
Overlimit overlimit,
|
|
||||||
List<DataVDto> allTimeList,
|
|
||||||
List<DataPltDto> flickerAllTimeList,
|
|
||||||
List<DataHarmDto> dataHarmRateVPOList,
|
|
||||||
List<DataIDto> dataIPOList,
|
|
||||||
List<DataHarmDto> dataInHarmVPOList,
|
|
||||||
List<DataVDto> dataVPOList,
|
|
||||||
List<DataVDto> dataVPOUnbalanceList,
|
|
||||||
List<DataIDto> dataIPONegList,
|
|
||||||
List<DataVDto> dataVPOFreqList,
|
|
||||||
List<DataVDto> dataVPODevList,
|
|
||||||
List<DataPltDto> dataPltPOList) {
|
|
||||||
List<DataLimitDetailDto> result = new ArrayList<>();
|
|
||||||
|
|
||||||
Map<String, List<DataHarmDto>> harmRateVByPhaseType = new HashMap<>();
|
|
||||||
Map<String, List<DataIDto>> dataIByPhaseType = new HashMap<>();
|
|
||||||
Map<String, List<DataHarmDto>> dataInHarmVPhaseType = new HashMap<>();
|
|
||||||
Map<String, List<DataVDto>> dataVPhaseType = new HashMap<>();
|
|
||||||
Map<String, List<DataVDto>> dataVDevPhaseType = new HashMap<>();
|
|
||||||
Map<String, List<DataPltDto>> dataPltPhaseType = new HashMap<>();
|
|
||||||
|
|
||||||
|
|
||||||
Integer allTime = 0;
|
|
||||||
Integer flickerAllTime = 0;
|
|
||||||
if (!CollectionUtils.isEmpty(allTimeList)) {
|
|
||||||
allTime = allTimeList.size();
|
|
||||||
}
|
|
||||||
if (!CollectionUtils.isEmpty(flickerAllTimeList)) {
|
|
||||||
flickerAllTime = flickerAllTimeList.size();
|
|
||||||
}
|
|
||||||
if (!CollectionUtils.isEmpty(dataHarmRateVPOList)) {
|
|
||||||
harmRateVByPhaseType = dataHarmRateVPOList.stream().collect(Collectors.groupingBy(DataHarmDto::getPhasicType));
|
|
||||||
}
|
|
||||||
if (!CollectionUtils.isEmpty(dataIPOList)) {
|
|
||||||
dataIByPhaseType = dataIPOList.stream().collect(Collectors.groupingBy(DataIDto::getPhasicType));
|
|
||||||
}
|
|
||||||
if (!CollectionUtils.isEmpty(dataInHarmVPOList)) {
|
|
||||||
dataInHarmVPhaseType = dataInHarmVPOList.stream().collect(Collectors.groupingBy(DataHarmDto::getPhasicType));
|
|
||||||
}
|
|
||||||
if (!CollectionUtils.isEmpty(dataVPOList)) {
|
|
||||||
dataVPhaseType = dataVPOList.stream().collect(Collectors.groupingBy(DataVDto::getPhasicType));
|
|
||||||
}
|
|
||||||
if (!CollectionUtils.isEmpty(dataVPODevList)) {
|
|
||||||
dataVDevPhaseType = dataVPODevList.stream().collect(Collectors.groupingBy(DataVDto::getPhasicType));
|
|
||||||
}
|
|
||||||
if (!CollectionUtils.isEmpty(dataPltPOList)) {
|
|
||||||
dataPltPhaseType = dataPltPOList.stream().collect(Collectors.groupingBy(DataPltDto::getPhasicType));
|
|
||||||
}
|
|
||||||
DataLimitDetailDto a = limitRateData(dataDate, overlimit, allTime, flickerAllTime, PhaseType.PHASE_A, overlimit.getId(), harmRateVByPhaseType.get(PhaseType.PHASE_A), dataIByPhaseType.get(PhaseType.PHASE_A), dataInHarmVPhaseType.get(PhaseType.PHASE_A), dataVPhaseType.get(PhaseType.PHASE_A), dataVDevPhaseType.get(PhaseType.PHASE_A), dataPltPhaseType.get(PhaseType.PHASE_A));
|
|
||||||
DataLimitDetailDto b = limitRateData(dataDate, overlimit, allTime, flickerAllTime, PhaseType.PHASE_B, overlimit.getId(), harmRateVByPhaseType.get(PhaseType.PHASE_B), dataIByPhaseType.get(PhaseType.PHASE_B), dataInHarmVPhaseType.get(PhaseType.PHASE_B), dataVPhaseType.get(PhaseType.PHASE_B), dataVDevPhaseType.get(PhaseType.PHASE_B), dataPltPhaseType.get(PhaseType.PHASE_B));
|
|
||||||
DataLimitDetailDto c = limitRateData(dataDate, overlimit, allTime, flickerAllTime, PhaseType.PHASE_C, overlimit.getId(), harmRateVByPhaseType.get(PhaseType.PHASE_C), dataIByPhaseType.get(PhaseType.PHASE_C), dataInHarmVPhaseType.get(PhaseType.PHASE_C), dataVPhaseType.get(PhaseType.PHASE_C), dataVDevPhaseType.get(PhaseType.PHASE_C), dataPltPhaseType.get(PhaseType.PHASE_C));
|
|
||||||
DataLimitDetailDto t = limitRateDataT(dataDate, overlimit, allTime, flickerAllTime, overlimit.getId(), dataHarmRateVPOList, dataIPOList, dataInHarmVPOList, dataVPOList, dataVPOUnbalanceList, dataIPONegList, dataVPOFreqList, dataVPODevList, dataPltPOList);
|
|
||||||
result.add(a);
|
|
||||||
result.add(b);
|
|
||||||
result.add(c);
|
|
||||||
result.add(t);
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param lineParam
|
|
||||||
* @Description:
|
|
||||||
* @Author: wr
|
|
||||||
* @Date: 2025/3/11 9:04
|
|
||||||
*/
|
|
||||||
private void getAbnormalData(LineCountEvaluateParam lineParam) {
|
|
||||||
lineParam.setTableName(DataCleanEnum.DataV.getCode());
|
|
||||||
// 获取异常数据,用于排除异常数据
|
|
||||||
List<PqDataVerify> pqDataVerifies = pqDataVerifyFeignClient.queryData(lineParam).getData();
|
|
||||||
if (CollUtil.isNotEmpty(pqDataVerifies)) {
|
|
||||||
Map<String, List<String>> timeMap = pqDataVerifies.stream()
|
|
||||||
.collect(Collectors.groupingBy(
|
|
||||||
PqDataVerify::getLineId,
|
|
||||||
Collectors.mapping(item -> TimeUtils.LocalDateTimeToString(item.getTime()), Collectors.toList())
|
|
||||||
));
|
|
||||||
lineParam.setAbnormalTime(timeMap);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @Description: limitRateData
|
|
||||||
* @Param: [overlimit, allTime, flickerAllTime, phasicType, lineId, dataHarmRateVPOList, dataIPOList, dataInHarmVPOList, dataVPOList, dataVUnbalanceList, dataINegList]
|
|
||||||
* @return: com.njcn.harmonic.pojo.po.LimitRate
|
|
||||||
* @Author: clam
|
|
||||||
* @Date: 2022/10/18
|
|
||||||
*/
|
|
||||||
public DataLimitDetailDto limitRateData(String dataDate,
|
|
||||||
Overlimit overlimit,
|
|
||||||
Integer allTime,
|
|
||||||
Integer flickerAllTime,
|
|
||||||
String phasicType, String lineId,
|
|
||||||
List<DataHarmDto> dataHarmRateVPOList,
|
|
||||||
List<DataIDto> dataIPOList,
|
|
||||||
List<DataHarmDto> dataInHarmVPOList,
|
|
||||||
List<DataVDto> dataVPOList,
|
|
||||||
List<DataVDto> dataVPODevList,
|
|
||||||
List<DataPltDto> dataPltPOList) {
|
|
||||||
List<AbnormalData> thd = new ArrayList<>(), uDev = new ArrayList<>(), flicker = new ArrayList<>(), freqDev = new ArrayList<>(), uAberrance = new ArrayList<>(), iNeg = new ArrayList<>();
|
|
||||||
DataLimitDetailDto dto = new DataLimitDetailDto();
|
|
||||||
DataLimitRateDto limitRate = new DataLimitRateDto();
|
|
||||||
// 初始化 v 系列列表
|
|
||||||
List<AbnormalData>[] v = new List[24];
|
|
||||||
for (int i = 0; i < 24; i++) {
|
|
||||||
v[i] = new ArrayList<>();
|
|
||||||
}
|
|
||||||
// 处理数据
|
|
||||||
if (!CollectionUtils.isEmpty(dataHarmRateVPOList)) {
|
|
||||||
for (DataHarmDto item : dataHarmRateVPOList) {
|
|
||||||
for (int i = 2; i < 26; i++) {
|
|
||||||
try {
|
|
||||||
// 获取 DataHarmDto 类的 getVx 方法
|
|
||||||
Method getVMethod = DataHarmDto.class.getMethod("getV" + i);
|
|
||||||
Double value = (Double) getVMethod.invoke(item);
|
|
||||||
// 获取 Overlimit 类的 getUharmx 方法
|
|
||||||
Method getUharmMethod = Overlimit.class.getMethod("getUharm" + i);
|
|
||||||
float limit = (float) getUharmMethod.invoke(overlimit);
|
|
||||||
if (ObjectUtil.isNotNull(value)){
|
|
||||||
if (value > limit) {
|
|
||||||
addAbnormalData(v[i - 2], item.getPhasicType(), item.getValueType(), item.getMinTime(), value, limit);
|
|
||||||
}
|
|
||||||
}else{
|
|
||||||
addAbnormalData(v[i - 2], item.getPhasicType(), item.getValueType(), item.getMinTime(), value, limit);
|
|
||||||
}
|
|
||||||
} catch (Exception e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// 初始化 i 系列列表
|
|
||||||
List<AbnormalData>[] i = new List[24];
|
|
||||||
for (int j = 0; j < 24; j++) {
|
|
||||||
i[j] = new ArrayList<>();
|
|
||||||
}
|
|
||||||
// 处理数据
|
|
||||||
if (!CollectionUtils.isEmpty(dataIPOList)) {
|
|
||||||
for (DataIDto item : dataIPOList) {
|
|
||||||
for (int j = 2; j < 26; j++) {
|
|
||||||
try {
|
|
||||||
// 获取 DataHarmDto 类的 getIx 方法
|
|
||||||
Method getVMethod = DataIDto.class.getMethod("getI" + j);
|
|
||||||
Double value = (Double) getVMethod.invoke(item);
|
|
||||||
// 获取 Overlimit 类的 getUharmx 方法
|
|
||||||
Method getUharmMethod = Overlimit.class.getMethod("getIharm" + j);
|
|
||||||
float limit = (float) getUharmMethod.invoke(overlimit);
|
|
||||||
if (value > limit) {
|
|
||||||
addAbnormalData(i[j - 2], item.getValueType(), item.getPhasicType(), item.getMinTime(), value, limit);
|
|
||||||
}
|
|
||||||
} catch (Exception e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// 初始化 uHarm 系列列表
|
|
||||||
List<AbnormalData>[] uHarm = new List[16];
|
|
||||||
for (int j = 0; j < 16; j++) {
|
|
||||||
uHarm[j] = new ArrayList<>();
|
|
||||||
}
|
|
||||||
// 处理数据
|
|
||||||
if (!CollectionUtils.isEmpty(dataInHarmVPOList)) {
|
|
||||||
for (DataHarmDto item : dataInHarmVPOList) {
|
|
||||||
for (int j = 1; j < 17; j++) {
|
|
||||||
try {
|
|
||||||
// 获取 DataHarmDto 类的 getVx 方法
|
|
||||||
Method getVMethod = DataHarmDto.class.getMethod("getV" + j);
|
|
||||||
Double value = (Double) getVMethod.invoke(item);
|
|
||||||
// 获取 Overlimit 类的 getUharmx 方法
|
|
||||||
Method getUharmMethod = Overlimit.class.getMethod("getInuharm" + j);
|
|
||||||
float limit = (float) getUharmMethod.invoke(overlimit);
|
|
||||||
if (value > limit) {
|
|
||||||
addAbnormalData(uHarm[j - 1], item.getPhasicType(), item.getValueType(), item.getMinTime(), value, limit);
|
|
||||||
}
|
|
||||||
} catch (Exception e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//电压总谐波畸变率
|
|
||||||
if (!CollectionUtils.isEmpty(dataVPOList)) {
|
|
||||||
for (DataVDto item : dataVPOList) {
|
|
||||||
if (item.getVThd() > overlimit.getUaberrance()) {
|
|
||||||
addAbnormalData(thd, item.getPhasicType(), item.getValueType(), item.getMinTime(), item.getVThd(), overlimit.getUaberrance());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//电压上偏差、电压下偏差(根据vl_dev的正负判断是用哪个值判断越限)
|
|
||||||
if (!CollectionUtils.isEmpty(dataVPODevList)) {
|
|
||||||
for (DataVDto item : dataVPODevList) {
|
|
||||||
if (item.getVlDev() >= 0) {
|
|
||||||
if (item.getVlDev() > overlimit.getVoltageDev()) {
|
|
||||||
addAbnormalData(uDev, item.getPhasicType(), item.getValueType(), item.getMinTime(), item.getVlDev(), overlimit.getVoltageDev());
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if (Math.abs(item.getVuDev()) > Math.abs(overlimit.getUvoltageDev())) {
|
|
||||||
addAbnormalData(uDev, item.getPhasicType(), item.getValueType(), item.getMinTime(), item.getVlDev(), overlimit.getUvoltageDev());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//长时间闪变
|
|
||||||
if (!CollectionUtils.isEmpty(dataPltPOList)) {
|
|
||||||
for (DataPltDto item : dataPltPOList) {
|
|
||||||
if (item.getPlt() > overlimit.getFlicker()) {
|
|
||||||
addAbnormalData(flicker, item.getPhasicType(), item.getValueType(), item.getMinTime(), item.getPlt(), overlimit.getFlicker());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
limitRate.setLineId(lineId);
|
|
||||||
limitRate.setTime(LocalDateTimeUtil.parseDate(dataDate, DatePattern.NORM_DATE_PATTERN));
|
|
||||||
limitRate.setPhasicType(phasicType);
|
|
||||||
limitRate.setAllTime(allTime);
|
|
||||||
limitRate.setFlickerAllTime(flickerAllTime);
|
|
||||||
|
|
||||||
limitRate.setFlickerOvertime(flicker.size());
|
|
||||||
limitRate.setUaberranceOvertime(thd.size());
|
|
||||||
limitRate.setINegOvertime(iNeg.size());
|
|
||||||
limitRate.setFreqDevOvertime(freqDev.size());
|
|
||||||
limitRate.setUbalanceOvertime(uAberrance.size());
|
|
||||||
limitRate.setVoltageDevOvertime(uDev.size());
|
|
||||||
dto.setDataLimitRate(getDataLimitRateDto(limitRate, v, i, uHarm));
|
|
||||||
|
|
||||||
return dto;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public DataLimitDetailDto limitRateDataT(
|
|
||||||
String dataDate,
|
|
||||||
Overlimit overlimit,
|
|
||||||
Integer allTime,
|
|
||||||
Integer flickerAllTime,
|
|
||||||
String lineId,
|
|
||||||
List<DataHarmDto> dataHarmRateVPOList,
|
|
||||||
List<DataIDto> dataIPOList,
|
|
||||||
List<DataHarmDto> dataInHarmVPOList,
|
|
||||||
List<DataVDto> dataVPOList,
|
|
||||||
List<DataVDto> dataVPOUnbalanceList,
|
|
||||||
List<DataIDto> dataIPONegList,
|
|
||||||
List<DataVDto> dataVPOFreqList,
|
|
||||||
List<DataVDto> dataVPODevList,
|
|
||||||
List<DataPltDto> dataPltPOList) {
|
|
||||||
DataLimitDetailDto dto = new DataLimitDetailDto();
|
|
||||||
DataLimitRateDto limitRate = new DataLimitRateDto();
|
|
||||||
List<AbnormalData> thd = new ArrayList<>(), uDev = new ArrayList<>(), flicker = new ArrayList<>(), freqDev = new ArrayList<>(), uAberrance = new ArrayList<>(), iNeg = new ArrayList<>();
|
|
||||||
// 初始化 v 系列列表
|
|
||||||
List<AbnormalData>[] v = new List[24];
|
|
||||||
for (int i = 0; i < 24; i++) {
|
|
||||||
v[i] = new ArrayList<>();
|
|
||||||
}
|
|
||||||
// 处理数据
|
|
||||||
if (!CollectionUtils.isEmpty(dataHarmRateVPOList)) {
|
|
||||||
for (DataHarmDto item : dataHarmRateVPOList) {
|
|
||||||
for (int i = 2; i < 26; i++) {
|
|
||||||
try {
|
|
||||||
// 获取 DataHarmDto 类的 getVx 方法
|
|
||||||
Method getVMethod = DataHarmDto.class.getMethod("getV" + i);
|
|
||||||
Double value = (Double) getVMethod.invoke(item);
|
|
||||||
// 获取 Overlimit 类的 getUharmx 方法
|
|
||||||
Method getUharmMethod = Overlimit.class.getMethod("getUharm" + i);
|
|
||||||
float limit = (float) getUharmMethod.invoke(overlimit);
|
|
||||||
if (ObjectUtil.isNotNull(value)){
|
|
||||||
if (value > limit) {
|
|
||||||
addAbnormalData(v[i - 2], item.getPhasicType(), item.getValueType(), item.getMinTime(), value, limit);
|
|
||||||
}
|
|
||||||
}else{
|
|
||||||
System.out.println(item);
|
|
||||||
addAbnormalData(v[i - 2], item.getPhasicType(), item.getValueType(), item.getMinTime(), value, limit);
|
|
||||||
}
|
|
||||||
} catch (Exception e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// 初始化 i 系列列表
|
|
||||||
List<AbnormalData>[] i = new List[24];
|
|
||||||
for (int j = 0; j < 24; j++) {
|
|
||||||
i[j] = new ArrayList<>();
|
|
||||||
}
|
|
||||||
// 处理数据
|
|
||||||
if (!CollectionUtils.isEmpty(dataIPOList)) {
|
|
||||||
for (DataIDto item : dataIPOList) {
|
|
||||||
for (int j = 2; j < 26; j++) {
|
|
||||||
try {
|
|
||||||
// 获取 DataHarmDto 类的 getIx 方法
|
|
||||||
Method getVMethod = DataIDto.class.getMethod("getI" + j);
|
|
||||||
Double value = (Double) getVMethod.invoke(item);
|
|
||||||
// 获取 Overlimit 类的 getUharmx 方法
|
|
||||||
Method getUharmMethod = Overlimit.class.getMethod("getIharm" + j);
|
|
||||||
float limit = (float) getUharmMethod.invoke(overlimit);
|
|
||||||
if (value > limit) {
|
|
||||||
addAbnormalData(i[j - 2], item.getPhasicType(), item.getValueType(), item.getMinTime(), value, limit);
|
|
||||||
}
|
|
||||||
} catch (Exception e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// 初始化 uHarm 系列列表
|
|
||||||
List<AbnormalData>[] uHarm = new List[16];
|
|
||||||
for (int j = 0; j < 16; j++) {
|
|
||||||
uHarm[j] = new ArrayList<>();
|
|
||||||
}
|
|
||||||
// 处理数据
|
|
||||||
if (!CollectionUtils.isEmpty(dataInHarmVPOList)) {
|
|
||||||
for (DataHarmDto item : dataInHarmVPOList) {
|
|
||||||
for (int j = 1; j < 17; j++) {
|
|
||||||
try {
|
|
||||||
// 获取 DataHarmDto 类的 getVx 方法
|
|
||||||
Method getVMethod = DataHarmDto.class.getMethod("getV" + j);
|
|
||||||
Double value = (Double) getVMethod.invoke(item);
|
|
||||||
// 获取 Overlimit 类的 getUharmx 方法
|
|
||||||
Method getUharmMethod = Overlimit.class.getMethod("getInuharm" + j);
|
|
||||||
float limit = (float) getUharmMethod.invoke(overlimit);
|
|
||||||
if (value > limit) {
|
|
||||||
addAbnormalData(uHarm[j - 1], item.getPhasicType(), item.getValueType(), item.getMinTime(), value, limit);
|
|
||||||
}
|
|
||||||
} catch (Exception e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//电压总谐波畸变率
|
|
||||||
if (!CollectionUtils.isEmpty(dataVPOList)) {
|
|
||||||
for (DataVDto item : dataVPOList) {
|
|
||||||
if (item.getVThd() > overlimit.getUaberrance()) {
|
|
||||||
addAbnormalData(thd, item.getPhasicType(), item.getValueType(), item.getMinTime(), item.getVThd(), overlimit.getUaberrance());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//三相电压不平衡度
|
|
||||||
if (!CollectionUtils.isEmpty(dataVPOUnbalanceList)) {
|
|
||||||
for (DataVDto item : dataVPOUnbalanceList) {
|
|
||||||
if (item.getVUnbalance() > overlimit.getUbalance()) {
|
|
||||||
addAbnormalData(uAberrance, item.getPhasicType(), item.getValueType(), item.getMinTime(), item.getVUnbalance(), overlimit.getUbalance());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//负序电流
|
|
||||||
if (!CollectionUtils.isEmpty(dataIPONegList)) {
|
|
||||||
for (DataIDto item : dataIPONegList) {
|
|
||||||
if(ObjectUtil.isNotNull(item.getINeg())){
|
|
||||||
if (item.getINeg() > overlimit.getINeg()) {
|
|
||||||
addAbnormalData(iNeg, item.getPhasicType(), item.getValueType(), item.getMinTime(), item.getINeg(), overlimit.getINeg());
|
|
||||||
}
|
|
||||||
}else{
|
|
||||||
System.out.println(item);
|
|
||||||
addAbnormalData(iNeg, item.getPhasicType(), item.getValueType(), item.getMinTime(), item.getINeg(), overlimit.getINeg());
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//频率偏差
|
|
||||||
if (!CollectionUtils.isEmpty(dataVPOFreqList)) {
|
|
||||||
for (DataVDto item : dataVPOFreqList) {
|
|
||||||
if (item.getFreqDev() > overlimit.getFreqDev()) {
|
|
||||||
addAbnormalData(freqDev, item.getPhasicType(), item.getValueType(), item.getMinTime(), item.getFreqDev(), overlimit.getFreqDev());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//电压上偏差、电压下偏差(根据vl_dev的正负判断是用哪个值判断越限)
|
|
||||||
if (!CollectionUtils.isEmpty(dataVPODevList)) {
|
|
||||||
for (DataVDto item : dataVPODevList) {
|
|
||||||
if (item.getVlDev() >= 0) {
|
|
||||||
if (item.getVlDev() > overlimit.getVoltageDev()) {
|
|
||||||
addAbnormalData(uDev, item.getPhasicType(), item.getMinTime(), item.getValueType(), item.getVlDev(), overlimit.getVoltageDev());
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if (Math.abs(item.getVuDev()) > Math.abs(overlimit.getUvoltageDev())) {
|
|
||||||
addAbnormalData(uDev, item.getPhasicType(), item.getMinTime(), item.getValueType(), item.getVlDev(), overlimit.getUvoltageDev());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//长时间闪变
|
|
||||||
if (!CollectionUtils.isEmpty(dataPltPOList)) {
|
|
||||||
for (DataPltDto item : dataPltPOList) {
|
|
||||||
if (item.getPlt() > overlimit.getFlicker()) {
|
|
||||||
addAbnormalData(flicker, item.getPhasicType(), item.getValueType(), item.getMinTime(), item.getPlt(), overlimit.getFlicker());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
limitRate.setLineId(lineId);
|
|
||||||
limitRate.setTime(LocalDateTimeUtil.parseDate(dataDate, DatePattern.NORM_DATE_PATTERN));
|
|
||||||
limitRate.setPhasicType(PhaseType.PHASE_T);
|
|
||||||
limitRate.setAllTime(allTime);
|
|
||||||
limitRate.setFlickerAllTime(flickerAllTime);
|
|
||||||
limitRate.setUaberranceOvertime(thd.stream().map(AbnormalData::getTime).distinct().collect(Collectors.toList()).size());
|
|
||||||
limitRate.setINegOvertime(iNeg.stream().map(AbnormalData::getTime).distinct().collect(Collectors.toList()).size());
|
|
||||||
limitRate.setFreqDevOvertime(freqDev.stream().map(AbnormalData::getTime).distinct().collect(Collectors.toList()).size());
|
|
||||||
limitRate.setUbalanceOvertime(uAberrance.stream().map(AbnormalData::getTime).distinct().collect(Collectors.toList()).size());
|
|
||||||
limitRate.setVoltageDevOvertime(uDev.stream().map(AbnormalData::getTime).distinct().collect(Collectors.toList()).size());
|
|
||||||
limitRate.setFlickerOvertime(flicker.stream().map(AbnormalData::getTime).distinct().collect(Collectors.toList()).size());
|
|
||||||
limitRate.setUharm2Overtime(v[0].stream().map(AbnormalData::getTime).distinct().collect(Collectors.toList()).size());
|
|
||||||
limitRate.setUharm3Overtime(v[1].stream().map(AbnormalData::getTime).distinct().collect(Collectors.toList()).size());
|
|
||||||
limitRate.setUharm4Overtime(v[2].stream().map(AbnormalData::getTime).distinct().collect(Collectors.toList()).size());
|
|
||||||
limitRate.setUharm5Overtime(v[3].stream().map(AbnormalData::getTime).distinct().collect(Collectors.toList()).size());
|
|
||||||
limitRate.setUharm6Overtime(v[4].stream().map(AbnormalData::getTime).distinct().collect(Collectors.toList()).size());
|
|
||||||
limitRate.setUharm7Overtime(v[5].stream().map(AbnormalData::getTime).distinct().collect(Collectors.toList()).size());
|
|
||||||
limitRate.setUharm8Overtime(v[6].stream().map(AbnormalData::getTime).distinct().collect(Collectors.toList()).size());
|
|
||||||
limitRate.setUharm9Overtime(v[7].stream().map(AbnormalData::getTime).distinct().collect(Collectors.toList()).size());
|
|
||||||
limitRate.setUharm10Overtime(v[8].stream().map(AbnormalData::getTime).distinct().collect(Collectors.toList()).size());
|
|
||||||
limitRate.setUharm11Overtime(v[9].stream().map(AbnormalData::getTime).distinct().collect(Collectors.toList()).size());
|
|
||||||
limitRate.setUharm12Overtime(v[10].stream().map(AbnormalData::getTime).distinct().collect(Collectors.toList()).size());
|
|
||||||
limitRate.setUharm13Overtime(v[11].stream().map(AbnormalData::getTime).distinct().collect(Collectors.toList()).size());
|
|
||||||
limitRate.setUharm14Overtime(v[12].stream().map(AbnormalData::getTime).distinct().collect(Collectors.toList()).size());
|
|
||||||
limitRate.setUharm15Overtime(v[13].stream().map(AbnormalData::getTime).distinct().collect(Collectors.toList()).size());
|
|
||||||
limitRate.setUharm16Overtime(v[14].stream().map(AbnormalData::getTime).distinct().collect(Collectors.toList()).size());
|
|
||||||
limitRate.setUharm17Overtime(v[15].stream().map(AbnormalData::getTime).distinct().collect(Collectors.toList()).size());
|
|
||||||
limitRate.setUharm18Overtime(v[16].stream().map(AbnormalData::getTime).distinct().collect(Collectors.toList()).size());
|
|
||||||
limitRate.setUharm19Overtime(v[17].stream().map(AbnormalData::getTime).distinct().collect(Collectors.toList()).size());
|
|
||||||
limitRate.setUharm20Overtime(v[18].stream().map(AbnormalData::getTime).distinct().collect(Collectors.toList()).size());
|
|
||||||
limitRate.setUharm21Overtime(v[19].stream().map(AbnormalData::getTime).distinct().collect(Collectors.toList()).size());
|
|
||||||
limitRate.setUharm22Overtime(v[20].stream().map(AbnormalData::getTime).distinct().collect(Collectors.toList()).size());
|
|
||||||
limitRate.setUharm23Overtime(v[21].stream().map(AbnormalData::getTime).distinct().collect(Collectors.toList()).size());
|
|
||||||
limitRate.setUharm24Overtime(v[22].stream().map(AbnormalData::getTime).distinct().collect(Collectors.toList()).size());
|
|
||||||
limitRate.setUharm25Overtime(v[23].stream().map(AbnormalData::getTime).distinct().collect(Collectors.toList()).size());
|
|
||||||
limitRate.setIharm2Overtime(i[0].stream().map(AbnormalData::getTime).distinct().collect(Collectors.toList()).size());
|
|
||||||
limitRate.setIharm3Overtime(i[1].stream().map(AbnormalData::getTime).distinct().collect(Collectors.toList()).size());
|
|
||||||
limitRate.setIharm4Overtime(i[2].stream().map(AbnormalData::getTime).distinct().collect(Collectors.toList()).size());
|
|
||||||
limitRate.setIharm5Overtime(i[3].stream().map(AbnormalData::getTime).distinct().collect(Collectors.toList()).size());
|
|
||||||
limitRate.setIharm6Overtime(i[4].stream().map(AbnormalData::getTime).distinct().collect(Collectors.toList()).size());
|
|
||||||
limitRate.setIharm7Overtime(i[5].stream().map(AbnormalData::getTime).distinct().collect(Collectors.toList()).size());
|
|
||||||
limitRate.setIharm8Overtime(i[6].stream().map(AbnormalData::getTime).distinct().collect(Collectors.toList()).size());
|
|
||||||
limitRate.setIharm9Overtime(i[7].stream().map(AbnormalData::getTime).distinct().collect(Collectors.toList()).size());
|
|
||||||
limitRate.setIharm10Overtime(i[8].stream().map(AbnormalData::getTime).distinct().collect(Collectors.toList()).size());
|
|
||||||
limitRate.setIharm11Overtime(i[9].stream().map(AbnormalData::getTime).distinct().collect(Collectors.toList()).size());
|
|
||||||
limitRate.setIharm12Overtime(i[10].stream().map(AbnormalData::getTime).distinct().collect(Collectors.toList()).size());
|
|
||||||
limitRate.setIharm13Overtime(i[11].stream().map(AbnormalData::getTime).distinct().collect(Collectors.toList()).size());
|
|
||||||
limitRate.setIharm14Overtime(i[12].stream().map(AbnormalData::getTime).distinct().collect(Collectors.toList()).size());
|
|
||||||
limitRate.setIharm15Overtime(i[13].stream().map(AbnormalData::getTime).distinct().collect(Collectors.toList()).size());
|
|
||||||
limitRate.setIharm16Overtime(i[14].stream().map(AbnormalData::getTime).distinct().collect(Collectors.toList()).size());
|
|
||||||
limitRate.setIharm17Overtime(i[15].stream().map(AbnormalData::getTime).distinct().collect(Collectors.toList()).size());
|
|
||||||
limitRate.setIharm18Overtime(i[16].stream().map(AbnormalData::getTime).distinct().collect(Collectors.toList()).size());
|
|
||||||
limitRate.setIharm19Overtime(i[17].stream().map(AbnormalData::getTime).distinct().collect(Collectors.toList()).size());
|
|
||||||
limitRate.setIharm20Overtime(i[18].stream().map(AbnormalData::getTime).distinct().collect(Collectors.toList()).size());
|
|
||||||
limitRate.setIharm21Overtime(i[19].stream().map(AbnormalData::getTime).distinct().collect(Collectors.toList()).size());
|
|
||||||
limitRate.setIharm22Overtime(i[20].stream().map(AbnormalData::getTime).distinct().collect(Collectors.toList()).size());
|
|
||||||
limitRate.setIharm23Overtime(i[21].stream().map(AbnormalData::getTime).distinct().collect(Collectors.toList()).size());
|
|
||||||
limitRate.setIharm24Overtime(i[22].stream().map(AbnormalData::getTime).distinct().collect(Collectors.toList()).size());
|
|
||||||
limitRate.setIharm25Overtime(i[23].stream().map(AbnormalData::getTime).distinct().collect(Collectors.toList()).size());
|
|
||||||
limitRate.setInuharm1Overtime(uHarm[0].stream().map(AbnormalData::getTime).distinct().collect(Collectors.toList()).size());
|
|
||||||
limitRate.setInuharm2Overtime(uHarm[1].stream().map(AbnormalData::getTime).distinct().collect(Collectors.toList()).size());
|
|
||||||
limitRate.setInuharm3Overtime(uHarm[2].stream().map(AbnormalData::getTime).distinct().collect(Collectors.toList()).size());
|
|
||||||
limitRate.setInuharm4Overtime(uHarm[3].stream().map(AbnormalData::getTime).distinct().collect(Collectors.toList()).size());
|
|
||||||
limitRate.setInuharm5Overtime(uHarm[4].stream().map(AbnormalData::getTime).distinct().collect(Collectors.toList()).size());
|
|
||||||
limitRate.setInuharm6Overtime(uHarm[5].stream().map(AbnormalData::getTime).distinct().collect(Collectors.toList()).size());
|
|
||||||
limitRate.setInuharm7Overtime(uHarm[6].stream().map(AbnormalData::getTime).distinct().collect(Collectors.toList()).size());
|
|
||||||
limitRate.setInuharm8Overtime(uHarm[7].stream().map(AbnormalData::getTime).distinct().collect(Collectors.toList()).size());
|
|
||||||
limitRate.setInuharm9Overtime(uHarm[8].stream().map(AbnormalData::getTime).distinct().collect(Collectors.toList()).size());
|
|
||||||
limitRate.setInuharm10Overtime(uHarm[9].stream().map(AbnormalData::getTime).distinct().collect(Collectors.toList()).size());
|
|
||||||
limitRate.setInuharm11Overtime(uHarm[10].stream().map(AbnormalData::getTime).distinct().collect(Collectors.toList()).size());
|
|
||||||
limitRate.setInuharm12Overtime(uHarm[11].stream().map(AbnormalData::getTime).distinct().collect(Collectors.toList()).size());
|
|
||||||
limitRate.setInuharm13Overtime(uHarm[12].stream().map(AbnormalData::getTime).distinct().collect(Collectors.toList()).size());
|
|
||||||
limitRate.setInuharm14Overtime(uHarm[13].stream().map(AbnormalData::getTime).distinct().collect(Collectors.toList()).size());
|
|
||||||
limitRate.setInuharm15Overtime(uHarm[14].stream().map(AbnormalData::getTime).distinct().collect(Collectors.toList()).size());
|
|
||||||
limitRate.setInuharm16Overtime(uHarm[15].stream().map(AbnormalData::getTime).distinct().collect(Collectors.toList()).size());
|
|
||||||
dto.setDataLimitRate(limitRate);
|
|
||||||
|
|
||||||
int detailAllTime = flicker.size() + uAberrance.size() + iNeg.size() + freqDev.size() + thd.size() + uDev.size() +
|
|
||||||
v[0].size() + v[1].size() + v[2].size() + v[3].size() + v[4].size() + v[5].size() + v[6].size() + v[7].size() + v[8].size() + v[9].size() + v[11].size() + v[12].size() + v[13].size() + v[14].size() + v[15].size() + v[16].size() + v[17].size() + v[18].size() + v[19].size() + v[20].size() + v[21].size() + v[22].size() + v[23].size() +
|
|
||||||
i[0].size() + i[1].size() + i[2].size() + i[3].size() + i[4].size() + i[5].size() + i[6].size() + i[7].size() + i[8].size() + i[9].size() + i[10].size() + i[11].size() + i[12].size() + i[13].size() + i[14].size() + i[15].size() + i[16].size() + i[17].size() + i[18].size() + i[19].size() + i[20].size() + i[21].size() + i[22].size() + i[23].size() +
|
|
||||||
uHarm[0].size() + uHarm[1].size() + uHarm[2].size() + uHarm[3].size() + uHarm[4].size() + uHarm[5].size() + uHarm[6].size() + uHarm[7].size() + uHarm[8].size() + uHarm[9].size() + uHarm[10].size() + uHarm[11].size() + uHarm[12].size() + uHarm[13].size() + uHarm[14].size() + uHarm[15].size();
|
|
||||||
if (detailAllTime > 0) {
|
|
||||||
DataLimitRateDetailDto detail = new DataLimitRateDetailDto();
|
|
||||||
detail.setLineId(lineId);
|
|
||||||
detail.setTime(LocalDateTimeUtil.parseDate(dataDate, DatePattern.NORM_DATE_PATTERN));
|
|
||||||
detail.setFlickerOvertime(toJson(flicker));
|
|
||||||
detail.setUaberranceOvertime(toJson(uAberrance));
|
|
||||||
detail.setINegOvertime(toJson(iNeg));
|
|
||||||
detail.setFreqDevOvertime(toJson(freqDev));
|
|
||||||
detail.setUbalanceOvertime(toJson(thd));
|
|
||||||
detail.setVoltageDevOvertime(toJson(uDev));
|
|
||||||
detail.setUharm2Overtime(toJson(v[0]));
|
|
||||||
detail.setUharm3Overtime(toJson(v[1]));
|
|
||||||
detail.setUharm4Overtime(toJson(v[2]));
|
|
||||||
detail.setUharm5Overtime(toJson(v[3]));
|
|
||||||
detail.setUharm6Overtime(toJson(v[4]));
|
|
||||||
detail.setUharm7Overtime(toJson(v[5]));
|
|
||||||
detail.setUharm8Overtime(toJson(v[6]));
|
|
||||||
detail.setUharm9Overtime(toJson(v[7]));
|
|
||||||
detail.setUharm10Overtime(toJson(v[8]));
|
|
||||||
detail.setUharm11Overtime(toJson(v[9]));
|
|
||||||
detail.setUharm12Overtime(toJson(v[10]));
|
|
||||||
detail.setUharm13Overtime(toJson(v[11]));
|
|
||||||
detail.setUharm14Overtime(toJson(v[12]));
|
|
||||||
detail.setUharm15Overtime(toJson(v[13]));
|
|
||||||
detail.setUharm16Overtime(toJson(v[14]));
|
|
||||||
detail.setUharm17Overtime(toJson(v[15]));
|
|
||||||
detail.setUharm18Overtime(toJson(v[16]));
|
|
||||||
detail.setUharm19Overtime(toJson(v[17]));
|
|
||||||
detail.setUharm20Overtime(toJson(v[18]));
|
|
||||||
detail.setUharm21Overtime(toJson(v[19]));
|
|
||||||
detail.setUharm22Overtime(toJson(v[20]));
|
|
||||||
detail.setUharm23Overtime(toJson(v[21]));
|
|
||||||
detail.setUharm24Overtime(toJson(v[22]));
|
|
||||||
detail.setUharm25Overtime(toJson(v[23]));
|
|
||||||
detail.setIharm2Overtime(toJson(i[0]));
|
|
||||||
detail.setIharm3Overtime(toJson(i[1]));
|
|
||||||
detail.setIharm4Overtime(toJson(i[2]));
|
|
||||||
detail.setIharm5Overtime(toJson(i[3]));
|
|
||||||
detail.setIharm6Overtime(toJson(i[4]));
|
|
||||||
detail.setIharm7Overtime(toJson(i[5]));
|
|
||||||
detail.setIharm8Overtime(toJson(i[6]));
|
|
||||||
detail.setIharm9Overtime(toJson(i[7]));
|
|
||||||
detail.setIharm10Overtime(toJson(i[8]));
|
|
||||||
detail.setIharm11Overtime(toJson(i[9]));
|
|
||||||
detail.setIharm12Overtime(toJson(i[10]));
|
|
||||||
detail.setIharm13Overtime(toJson(i[11]));
|
|
||||||
detail.setIharm14Overtime(toJson(i[12]));
|
|
||||||
detail.setIharm15Overtime(toJson(i[13]));
|
|
||||||
detail.setIharm16Overtime(toJson(i[14]));
|
|
||||||
detail.setIharm17Overtime(toJson(i[15]));
|
|
||||||
detail.setIharm18Overtime(toJson(i[16]));
|
|
||||||
detail.setIharm19Overtime(toJson(i[17]));
|
|
||||||
detail.setIharm20Overtime(toJson(i[18]));
|
|
||||||
detail.setIharm21Overtime(toJson(i[19]));
|
|
||||||
detail.setIharm22Overtime(toJson(i[20]));
|
|
||||||
detail.setIharm23Overtime(toJson(i[21]));
|
|
||||||
detail.setIharm24Overtime(toJson(i[22]));
|
|
||||||
detail.setIharm25Overtime(toJson(i[23]));
|
|
||||||
detail.setInuharm1Overtime(toJson(uHarm[0]));
|
|
||||||
detail.setInuharm2Overtime(toJson(uHarm[1]));
|
|
||||||
detail.setInuharm3Overtime(toJson(uHarm[2]));
|
|
||||||
detail.setInuharm4Overtime(toJson(uHarm[3]));
|
|
||||||
detail.setInuharm5Overtime(toJson(uHarm[4]));
|
|
||||||
detail.setInuharm6Overtime(toJson(uHarm[5]));
|
|
||||||
detail.setInuharm7Overtime(toJson(uHarm[6]));
|
|
||||||
detail.setInuharm8Overtime(toJson(uHarm[7]));
|
|
||||||
detail.setInuharm9Overtime(toJson(uHarm[8]));
|
|
||||||
detail.setInuharm10Overtime(toJson(uHarm[9]));
|
|
||||||
detail.setInuharm11Overtime(toJson(uHarm[10]));
|
|
||||||
detail.setInuharm12Overtime(toJson(uHarm[11]));
|
|
||||||
detail.setInuharm13Overtime(toJson(uHarm[12]));
|
|
||||||
detail.setInuharm14Overtime(toJson(uHarm[13]));
|
|
||||||
detail.setInuharm15Overtime(toJson(uHarm[14]));
|
|
||||||
detail.setInuharm16Overtime(toJson(uHarm[15]));
|
|
||||||
dto.setDataLimitRateDetail(detail);
|
|
||||||
}
|
|
||||||
return dto;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
private DataLimitRateDto getDataLimitRateDto(DataLimitRateDto limitRate, List<AbnormalData>[] v, List<AbnormalData>[] i, List<AbnormalData>[] uHarm) {
|
|
||||||
limitRate.setUharm2Overtime(v[0].size());
|
|
||||||
limitRate.setUharm3Overtime(v[1].size());
|
|
||||||
limitRate.setUharm4Overtime(v[2].size());
|
|
||||||
limitRate.setUharm5Overtime(v[3].size());
|
|
||||||
limitRate.setUharm6Overtime(v[4].size());
|
|
||||||
limitRate.setUharm7Overtime(v[5].size());
|
|
||||||
limitRate.setUharm8Overtime(v[6].size());
|
|
||||||
limitRate.setUharm9Overtime(v[7].size());
|
|
||||||
limitRate.setUharm10Overtime(v[8].size());
|
|
||||||
limitRate.setUharm11Overtime(v[9].size());
|
|
||||||
limitRate.setUharm12Overtime(v[10].size());
|
|
||||||
limitRate.setUharm13Overtime(v[11].size());
|
|
||||||
limitRate.setUharm14Overtime(v[12].size());
|
|
||||||
limitRate.setUharm15Overtime(v[13].size());
|
|
||||||
limitRate.setUharm16Overtime(v[14].size());
|
|
||||||
limitRate.setUharm17Overtime(v[15].size());
|
|
||||||
limitRate.setUharm18Overtime(v[16].size());
|
|
||||||
limitRate.setUharm19Overtime(v[17].size());
|
|
||||||
limitRate.setUharm20Overtime(v[18].size());
|
|
||||||
limitRate.setUharm21Overtime(v[19].size());
|
|
||||||
limitRate.setUharm22Overtime(v[20].size());
|
|
||||||
limitRate.setUharm23Overtime(v[21].size());
|
|
||||||
limitRate.setUharm24Overtime(v[22].size());
|
|
||||||
limitRate.setUharm25Overtime(v[23].size());
|
|
||||||
limitRate.setIharm2Overtime(i[0].size());
|
|
||||||
limitRate.setIharm3Overtime(i[1].size());
|
|
||||||
limitRate.setIharm4Overtime(i[2].size());
|
|
||||||
limitRate.setIharm5Overtime(i[3].size());
|
|
||||||
limitRate.setIharm6Overtime(i[4].size());
|
|
||||||
limitRate.setIharm7Overtime(i[5].size());
|
|
||||||
limitRate.setIharm8Overtime(i[6].size());
|
|
||||||
limitRate.setIharm9Overtime(i[7].size());
|
|
||||||
limitRate.setIharm10Overtime(i[8].size());
|
|
||||||
limitRate.setIharm11Overtime(i[9].size());
|
|
||||||
limitRate.setIharm12Overtime(i[10].size());
|
|
||||||
limitRate.setIharm13Overtime(i[11].size());
|
|
||||||
limitRate.setIharm14Overtime(i[12].size());
|
|
||||||
limitRate.setIharm15Overtime(i[13].size());
|
|
||||||
limitRate.setIharm16Overtime(i[14].size());
|
|
||||||
limitRate.setIharm17Overtime(i[15].size());
|
|
||||||
limitRate.setIharm18Overtime(i[16].size());
|
|
||||||
limitRate.setIharm19Overtime(i[17].size());
|
|
||||||
limitRate.setIharm20Overtime(i[18].size());
|
|
||||||
limitRate.setIharm21Overtime(i[19].size());
|
|
||||||
limitRate.setIharm22Overtime(i[20].size());
|
|
||||||
limitRate.setIharm23Overtime(i[21].size());
|
|
||||||
limitRate.setIharm24Overtime(i[22].size());
|
|
||||||
limitRate.setIharm25Overtime(i[23].size());
|
|
||||||
limitRate.setInuharm1Overtime(uHarm[0].size());
|
|
||||||
limitRate.setInuharm2Overtime(uHarm[1].size());
|
|
||||||
limitRate.setInuharm3Overtime(uHarm[2].size());
|
|
||||||
limitRate.setInuharm4Overtime(uHarm[3].size());
|
|
||||||
limitRate.setInuharm5Overtime(uHarm[4].size());
|
|
||||||
limitRate.setInuharm6Overtime(uHarm[5].size());
|
|
||||||
limitRate.setInuharm7Overtime(uHarm[6].size());
|
|
||||||
limitRate.setInuharm8Overtime(uHarm[7].size());
|
|
||||||
limitRate.setInuharm9Overtime(uHarm[8].size());
|
|
||||||
limitRate.setInuharm10Overtime(uHarm[9].size());
|
|
||||||
limitRate.setInuharm11Overtime(uHarm[10].size());
|
|
||||||
limitRate.setInuharm12Overtime(uHarm[11].size());
|
|
||||||
limitRate.setInuharm13Overtime(uHarm[12].size());
|
|
||||||
limitRate.setInuharm14Overtime(uHarm[13].size());
|
|
||||||
limitRate.setInuharm15Overtime(uHarm[14].size());
|
|
||||||
limitRate.setInuharm16Overtime(uHarm[15].size());
|
|
||||||
return limitRate;
|
|
||||||
}
|
|
||||||
|
|
||||||
private String toJson(List<AbnormalData> list) {
|
|
||||||
Map<String, List<AbnormalData>> abnormalMap = list.stream().collect(Collectors.groupingBy(x -> x.getPhasic() + "_" + x.getValueType()));
|
|
||||||
List<AbnormalData.Json> info = new ArrayList<>();
|
|
||||||
abnormalMap.forEach((key, value) -> {
|
|
||||||
String[] split = key.split("_");
|
|
||||||
AbnormalData.Json json = new AbnormalData.Json();
|
|
||||||
json.setPhasic(split[0]);
|
|
||||||
json.setValueType(split[1]);
|
|
||||||
json.setTime(String.join(",", value.stream()
|
|
||||||
.map(abnormal -> abnormal.getTime())
|
|
||||||
.collect(Collectors.toList())));
|
|
||||||
json.setValue(String.join(",", value.stream()
|
|
||||||
.map(abnormal -> abnormal.getValue() + "")
|
|
||||||
.collect(Collectors.toList())));
|
|
||||||
info.add(json);
|
|
||||||
});
|
|
||||||
if (CollUtil.isNotEmpty(info)) {
|
|
||||||
return JSON.toJSONString(info);
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void addAbnormalData(List<AbnormalData> list, String phasicType, String valueType, String time, Double value, float overLimitValue) {
|
|
||||||
AbnormalData data = new AbnormalData();
|
|
||||||
data.setTime(time.substring(11, time.length()));
|
|
||||||
data.setPhasic(phasicType);
|
|
||||||
data.setValueType(valueType);
|
|
||||||
data.setValue(value);
|
|
||||||
data.setOverLimitValue(overLimitValue);
|
|
||||||
list.add(data);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
private void chanelData(DataLimitRateDto limitRate, DataLimitTargetDto limitTarget) {
|
private void chanelData(DataLimitRateDto limitRate, DataLimitTargetDto limitTarget) {
|
||||||
//有一个指标超标,allTime则为1
|
//有一个指标超标,allTime则为1
|
||||||
int allTime = limitRate.getFreqDevOvertime() + limitRate.getVoltageDevOvertime() + limitRate.getUbalanceOvertime() + limitRate.getUaberranceOvertime() + limitRate.getINegOvertime();
|
int allTime = limitRate.getFreqDevOvertime() + limitRate.getVoltageDevOvertime() + limitRate.getUbalanceOvertime() + limitRate.getUaberranceOvertime() + limitRate.getINegOvertime();
|
||||||
|
|||||||
@@ -0,0 +1,964 @@
|
|||||||
|
package com.njcn.algorithm.serviceimpl.line;
|
||||||
|
|
||||||
|
import cn.hutool.core.collection.CollUtil;
|
||||||
|
import cn.hutool.core.date.DatePattern;
|
||||||
|
import cn.hutool.core.date.LocalDateTimeUtil;
|
||||||
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
|
import com.alibaba.fastjson.JSON;
|
||||||
|
import com.njcn.algorithm.service.line.IDataLimitRateAsync;
|
||||||
|
import com.njcn.algorithm.utils.MemorySizeUtil;
|
||||||
|
import com.njcn.dataProcess.api.*;
|
||||||
|
import com.njcn.dataProcess.constant.PhaseType;
|
||||||
|
import com.njcn.dataProcess.param.LineCountEvaluateParam;
|
||||||
|
import com.njcn.dataProcess.pojo.dto.*;
|
||||||
|
import com.njcn.dataProcess.util.TimeUtils;
|
||||||
|
import com.njcn.device.biz.pojo.po.Overlimit;
|
||||||
|
import com.njcn.influx.constant.InfluxDbSqlConstant;
|
||||||
|
import com.njcn.influx.pojo.constant.InfluxDBTableConstant;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
|
import org.springframework.scheduling.annotation.Async;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.util.CollectionUtils;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import java.lang.reflect.Method;
|
||||||
|
import java.util.*;
|
||||||
|
import java.util.concurrent.CompletableFuture;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author wr
|
||||||
|
* @description
|
||||||
|
* @date 2025/12/17 10:56
|
||||||
|
*/
|
||||||
|
@Slf4j
|
||||||
|
@Service
|
||||||
|
public class IDataLimitRateAsyncImpl implements IDataLimitRateAsync {
|
||||||
|
|
||||||
|
private static final Logger logger = LoggerFactory.getLogger(IDataLimitRateAsyncImpl.class);
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private DataVFeignClient dataVFeignClient;
|
||||||
|
@Resource
|
||||||
|
private DataIFeignClient dataIFeignClient;
|
||||||
|
@Resource
|
||||||
|
private DataPltFeignClient dataPltFeignClient;
|
||||||
|
@Resource
|
||||||
|
private DataInharmVFeignClient dataInharmVFeignClient;
|
||||||
|
@Resource
|
||||||
|
private DataHarmRateVFeignClient dataHarmRateVFeignClient;
|
||||||
|
@Resource
|
||||||
|
private DataLimitRateFeignClient dataLimitRateFeignClient;
|
||||||
|
@Resource
|
||||||
|
private DataLimitRateDetailFeignClient dataLimitRateDetailFeignClient;
|
||||||
|
/**
|
||||||
|
* 查询配置 辽宁版本比较特殊,没有CP95值,采用平均值进行判断
|
||||||
|
*/
|
||||||
|
@Value("${version.used:master}")
|
||||||
|
private String versionUsed;
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Async("asyncExecutor")
|
||||||
|
public CompletableFuture<Void> lineDataRate(String dataDate,
|
||||||
|
List<String> list,
|
||||||
|
List<String> phase,
|
||||||
|
Map<String, Overlimit> overLimitMap,
|
||||||
|
int size,
|
||||||
|
int i,
|
||||||
|
int type) {
|
||||||
|
List<DataLimitDetailDto> result = new ArrayList<>();
|
||||||
|
LineCountEvaluateParam lineParam = new LineCountEvaluateParam();
|
||||||
|
lineParam.setStartTime(TimeUtils.getBeginOfDay(dataDate));
|
||||||
|
lineParam.setEndTime(TimeUtils.getEndOfDay(dataDate));
|
||||||
|
lineParam.setLineId(list);
|
||||||
|
lineParam.setType(type);
|
||||||
|
//获取电压数据
|
||||||
|
List<DataVDto> dataVAllTime = dataVFeignClient.getRawData(lineParam).getData();
|
||||||
|
//闪变数据
|
||||||
|
List<DataPltDto> dataPltAllTime = dataPltFeignClient.getRawData(lineParam).getData();
|
||||||
|
//谐波数据
|
||||||
|
List<DataHarmDto> dataVHarmList = dataHarmRateVFeignClient.getRawData(lineParam).getData();
|
||||||
|
//间谐波数据
|
||||||
|
List<DataHarmDto> dataVInHarmList = dataInharmVFeignClient.getRawData(lineParam).getData();
|
||||||
|
//电流数据
|
||||||
|
List<DataIDto> dataIList = dataIFeignClient.getRawData(lineParam).getData();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 功能描述:获取influxDB -> data_v ->
|
||||||
|
* 总计算次数(用data_v中phasic_type=A,value_type=avg,quality_flag=0来参与统计)
|
||||||
|
*/
|
||||||
|
//在线监测设备会有AB、BC、CA的数据,会导致数据重复计算,这边根据时间去重
|
||||||
|
Map<String, List<DataVDto>> allTime = dataVAllTime.stream()
|
||||||
|
.filter(x -> PhaseType.PHASE_A.equals(x.getPhasicType()))
|
||||||
|
.filter(x -> InfluxDbSqlConstant.AVG_WEB.equalsIgnoreCase(x.getValueType()))
|
||||||
|
.collect(Collectors.groupingBy(
|
||||||
|
DataVDto::getLineId,
|
||||||
|
Collectors.collectingAndThen(
|
||||||
|
Collectors.toCollection(
|
||||||
|
// 使用 TreeSet 根据时间排序并去重
|
||||||
|
() -> new TreeSet<>(
|
||||||
|
Comparator.comparing(DataVDto::getMinTime)
|
||||||
|
)
|
||||||
|
),
|
||||||
|
ArrayList::new
|
||||||
|
)
|
||||||
|
));
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 功能描述:获取influxDB -> data_plt ->
|
||||||
|
* 闪变总计算次数(用data_plt中phasic_type=A,value_type=avg,quality_flag=0来参与统计)
|
||||||
|
*/
|
||||||
|
//fixme 冀北现场 闪变原始表没有 value_type 这个参数
|
||||||
|
Map<String, List<DataPltDto>> pltAllTime;
|
||||||
|
if (type == 2) {
|
||||||
|
pltAllTime = dataPltAllTime.stream()
|
||||||
|
.filter(x -> PhaseType.PHASE_A.equals(x.getPhasicType()))
|
||||||
|
.filter(x -> InfluxDbSqlConstant.AVG_WEB.equalsIgnoreCase(x.getValueType()))
|
||||||
|
.collect(Collectors.groupingBy(DataPltDto::getLineId));
|
||||||
|
} else {
|
||||||
|
pltAllTime = dataPltAllTime.stream()
|
||||||
|
.filter(x -> PhaseType.PHASE_A.equals(x.getPhasicType()))
|
||||||
|
.collect(Collectors.groupingBy(DataPltDto::getLineId));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*功能描述:获取influxDB -> data_harmrate_v ->
|
||||||
|
* 2-25次谐波电压含有率 -> A相||B相||C相的日95%概率值
|
||||||
|
*/
|
||||||
|
Map<String, List<DataHarmDto>> harmRateV;
|
||||||
|
if (Objects.equals(versionUsed, "liaoning")) {
|
||||||
|
harmRateV = dataVHarmList.stream()
|
||||||
|
.filter(x -> phase.contains(x.getPhasicType()))
|
||||||
|
.filter(x -> InfluxDBTableConstant.AVG.equalsIgnoreCase(x.getValueType()))
|
||||||
|
.peek(x -> x.setValueType(InfluxDBTableConstant.CP95))
|
||||||
|
.collect(Collectors.groupingBy(DataHarmDto::getLineId));
|
||||||
|
} else {
|
||||||
|
harmRateV = dataVHarmList.stream()
|
||||||
|
.filter(x -> phase.contains(x.getPhasicType()))
|
||||||
|
.filter(x -> InfluxDBTableConstant.CP95.equalsIgnoreCase(x.getValueType()))
|
||||||
|
.collect(Collectors.groupingBy(DataHarmDto::getLineId));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 功能描述:获取influxDB -> data_i -> 2-25次谐波电流 -> 日95%概率值
|
||||||
|
*/
|
||||||
|
Map<String, List<DataIDto>> dataI;
|
||||||
|
if (Objects.equals(versionUsed, "liaoning")) {
|
||||||
|
dataI = dataIList.stream()
|
||||||
|
.filter(x -> phase.contains(x.getPhasicType()))
|
||||||
|
.filter(x -> InfluxDBTableConstant.AVG.equalsIgnoreCase(x.getValueType()))
|
||||||
|
.peek(x -> x.setValueType(InfluxDBTableConstant.CP95))
|
||||||
|
.collect(Collectors.groupingBy(DataIDto::getLineId));
|
||||||
|
} else {
|
||||||
|
dataI = dataIList.stream()
|
||||||
|
.filter(x -> phase.contains(x.getPhasicType()))
|
||||||
|
.filter(x -> InfluxDBTableConstant.CP95.equalsIgnoreCase(x.getValueType()))
|
||||||
|
.collect(Collectors.groupingBy(DataIDto::getLineId));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 功能描述:获取influxDB -> data_inharm_v -> 0.5-15.5次间谐波电压含有率 -> 日95%概率值
|
||||||
|
*/
|
||||||
|
Map<String, List<DataHarmDto>> inHarmV;
|
||||||
|
if (Objects.equals(versionUsed, "liaoning")) {
|
||||||
|
inHarmV = dataVInHarmList.stream()
|
||||||
|
.filter(x -> phase.contains(x.getPhasicType()))
|
||||||
|
.filter(x -> InfluxDBTableConstant.AVG.equalsIgnoreCase(x.getValueType()))
|
||||||
|
.peek(x -> x.setValueType(InfluxDBTableConstant.CP95))
|
||||||
|
.collect(Collectors.groupingBy(DataHarmDto::getLineId));
|
||||||
|
} else {
|
||||||
|
inHarmV = dataVInHarmList.stream()
|
||||||
|
.filter(x -> phase.contains(x.getPhasicType()))
|
||||||
|
.filter(x -> InfluxDBTableConstant.CP95.equalsIgnoreCase(x.getValueType()))
|
||||||
|
.collect(Collectors.groupingBy(DataHarmDto::getLineId));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 功能描述:获取influxDB -> data_v -> 电压总谐波畸变率 -> 日95%概率值
|
||||||
|
*/
|
||||||
|
Map<String, List<DataVDto>> dataVThd;
|
||||||
|
if (Objects.equals(versionUsed, "liaoning")) {
|
||||||
|
dataVThd = dataVAllTime.stream()
|
||||||
|
.filter(x -> phase.contains(x.getPhasicType()))
|
||||||
|
.filter(x -> InfluxDBTableConstant.AVG.equalsIgnoreCase(x.getValueType()))
|
||||||
|
.peek(x -> x.setValueType(InfluxDBTableConstant.CP95))
|
||||||
|
.collect(Collectors.groupingBy(DataVDto::getLineId));
|
||||||
|
} else {
|
||||||
|
dataVThd = dataVAllTime.stream()
|
||||||
|
.filter(x -> phase.contains(x.getPhasicType()))
|
||||||
|
.filter(x -> InfluxDBTableConstant.CP95.equalsIgnoreCase(x.getValueType()))
|
||||||
|
.collect(Collectors.groupingBy(DataVDto::getLineId));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 功能描述:获取influxDB -> data_v -> 负序电压不平衡度 -> 最大值 && 日95%概率值
|
||||||
|
*/
|
||||||
|
Map<String, List<DataVDto>> dataVUnbalance;
|
||||||
|
if (Objects.equals(versionUsed, "liaoning")) {
|
||||||
|
dataVUnbalance = dataVAllTime.stream()
|
||||||
|
.filter(x -> InfluxDBTableConstant.PHASE_TYPE_T.equalsIgnoreCase(x.getPhasicType()))
|
||||||
|
.filter(x -> InfluxDBTableConstant.AVG.equalsIgnoreCase(x.getValueType()) ||
|
||||||
|
InfluxDBTableConstant.MAX.equalsIgnoreCase(x.getValueType()))
|
||||||
|
.peek(x -> x.setValueType(InfluxDBTableConstant.CP95))
|
||||||
|
.collect(Collectors.groupingBy(DataVDto::getLineId));
|
||||||
|
} else {
|
||||||
|
dataVUnbalance = dataVAllTime.stream()
|
||||||
|
.filter(x -> InfluxDBTableConstant.PHASE_TYPE_T.equalsIgnoreCase(x.getPhasicType()))
|
||||||
|
.filter(x -> InfluxDBTableConstant.CP95.equalsIgnoreCase(x.getValueType()) ||
|
||||||
|
InfluxDBTableConstant.MAX.equalsIgnoreCase(x.getValueType()))
|
||||||
|
.collect(Collectors.groupingBy(DataVDto::getLineId));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 功能描述:获取influxDB -> data_i -> 负序电流 -> 最大值 && 日95%概率值
|
||||||
|
*/
|
||||||
|
|
||||||
|
Map<String, List<DataIDto>> dataINeg;
|
||||||
|
if (Objects.equals(versionUsed, "liaoning")) {
|
||||||
|
dataINeg = dataIList.stream()
|
||||||
|
.filter(x -> InfluxDBTableConstant.PHASE_TYPE_T.equalsIgnoreCase(x.getPhasicType()))
|
||||||
|
.filter(x -> InfluxDBTableConstant.AVG.equalsIgnoreCase(x.getValueType()) ||
|
||||||
|
InfluxDBTableConstant.MAX.equalsIgnoreCase(x.getValueType()))
|
||||||
|
.peek(x -> x.setValueType(InfluxDBTableConstant.CP95))
|
||||||
|
.collect(Collectors.groupingBy(DataIDto::getLineId));
|
||||||
|
} else {
|
||||||
|
dataINeg = dataIList.stream()
|
||||||
|
.filter(x -> InfluxDBTableConstant.PHASE_TYPE_T.equalsIgnoreCase(x.getPhasicType()))
|
||||||
|
.filter(x -> InfluxDBTableConstant.CP95.equalsIgnoreCase(x.getValueType()) ||
|
||||||
|
InfluxDBTableConstant.MAX.equalsIgnoreCase(x.getValueType()))
|
||||||
|
.collect(Collectors.groupingBy(DataIDto::getLineId));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 功能描述:获取influxDB -> data_v -> 频率偏差 -> 最大值 && 最小值
|
||||||
|
*/
|
||||||
|
Map<String, List<DataVDto>> dataVFreq = dataVAllTime.stream()
|
||||||
|
.filter(x -> InfluxDBTableConstant.PHASE_TYPE_T.equalsIgnoreCase(x.getPhasicType()))
|
||||||
|
.filter(x -> InfluxDBTableConstant.MIN.equalsIgnoreCase(x.getValueType()) ||
|
||||||
|
InfluxDBTableConstant.MAX.equalsIgnoreCase(x.getValueType()))
|
||||||
|
.collect(Collectors.groupingBy(DataVDto::getLineId));
|
||||||
|
/**
|
||||||
|
* 功能描述:获取influxDB -> data_v -> 电压偏差 -> 最大值
|
||||||
|
*/
|
||||||
|
Map<String, List<DataVDto>> dataVDev = dataVAllTime.stream()
|
||||||
|
.filter(x -> phase.contains(x.getPhasicType()))
|
||||||
|
.filter(x -> InfluxDBTableConstant.MAX.equalsIgnoreCase(x.getValueType()))
|
||||||
|
.collect(Collectors.groupingBy(DataVDto::getLineId));
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 功能描述:获取influxDB -> data_plt -> 长时间闪变 -> 注(取最大值原始算法去掉了,现没有根据最大值比较)
|
||||||
|
*/
|
||||||
|
Map<String, List<DataPltDto>> dataPlt;
|
||||||
|
if (type == 2) {
|
||||||
|
dataPlt = dataPltAllTime.stream()
|
||||||
|
.filter(x -> phase.contains(x.getPhasicType()))
|
||||||
|
.filter(x -> InfluxDBTableConstant.MAX.equalsIgnoreCase(x.getValueType()))
|
||||||
|
.collect(Collectors.groupingBy(DataPltDto::getLineId));
|
||||||
|
} else {
|
||||||
|
dataPlt = dataPltAllTime.stream()
|
||||||
|
.filter(x -> PhaseType.PHASE_A.equals(x.getPhasicType()))
|
||||||
|
.collect(Collectors.groupingBy(DataPltDto::getLineId));
|
||||||
|
}
|
||||||
|
|
||||||
|
for (String item : list) {
|
||||||
|
if (ObjectUtil.isNotNull(overLimitMap.get(item))) {
|
||||||
|
result.addAll(getData(dataDate,
|
||||||
|
overLimitMap.get(item),
|
||||||
|
allTime.get(item),
|
||||||
|
pltAllTime.get(item),
|
||||||
|
harmRateV.get(item),
|
||||||
|
dataI.get(item),
|
||||||
|
inHarmV.get(item),
|
||||||
|
dataVThd.get(item),
|
||||||
|
dataVUnbalance.get(item),
|
||||||
|
dataINeg.get(item),
|
||||||
|
dataVFreq.get(item),
|
||||||
|
dataVDev.get(item),
|
||||||
|
dataPlt.get(item)));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (CollUtil.isNotEmpty(result)) {
|
||||||
|
//存储数据
|
||||||
|
List<DataLimitRateDto> dataLimitRate = result.stream().map(DataLimitDetailDto::getDataLimitRate).filter(ObjectUtil::isNotNull).collect(Collectors.toList());
|
||||||
|
if (CollUtil.isNotEmpty(dataLimitRate)) {
|
||||||
|
dataLimitRateFeignClient.batchInsertion(dataLimitRate);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (CollUtil.isNotEmpty(result)) {
|
||||||
|
//存储数据
|
||||||
|
List<DataLimitRateDetailDto> detail = result.stream().map(DataLimitDetailDto::getDataLimitRateDetail).filter(x -> ObjectUtil.isNotNull(x)).collect(Collectors.toList());
|
||||||
|
if (CollUtil.isNotEmpty(detail)) {
|
||||||
|
dataLimitRateDetailFeignClient.batchInsertion(detail);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
logger.info(dataDate + " 总分区数据:" + size + "=====》当前第" + i + "小分区已完成!");
|
||||||
|
result = null;
|
||||||
|
if(i==size){
|
||||||
|
MemorySizeUtil.getNowMemory();
|
||||||
|
}
|
||||||
|
System.gc();
|
||||||
|
|
||||||
|
return CompletableFuture.completedFuture(null);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Description: getData
|
||||||
|
* @Param: [overlimit, allTimeList, flickerAllTimeList, dataHarmRateVPOList, dataIPOList, dataInHarmVPOList, dataVPOList, dataVPOUnbalanceList, dataIPONegList, dataVPOFreqList, dataVPODevList, dataPltPOList]
|
||||||
|
* @return: java.util.List<com.njcn.harmonic.pojo.po.LimitRate>
|
||||||
|
* @Author: clam
|
||||||
|
* @Date: 2022/10/18
|
||||||
|
*/
|
||||||
|
private List<DataLimitDetailDto> getData(String dataDate,
|
||||||
|
Overlimit overlimit,
|
||||||
|
List<DataVDto> allTimeList,
|
||||||
|
List<DataPltDto> flickerAllTimeList,
|
||||||
|
List<DataHarmDto> dataHarmRateVPOList,
|
||||||
|
List<DataIDto> dataIPOList,
|
||||||
|
List<DataHarmDto> dataInHarmVPOList,
|
||||||
|
List<DataVDto> dataVPOList,
|
||||||
|
List<DataVDto> dataVPOUnbalanceList,
|
||||||
|
List<DataIDto> dataIPONegList,
|
||||||
|
List<DataVDto> dataVPOFreqList,
|
||||||
|
List<DataVDto> dataVPODevList,
|
||||||
|
List<DataPltDto> dataPltPOList) {
|
||||||
|
List<DataLimitDetailDto> result = new ArrayList<>();
|
||||||
|
|
||||||
|
Map<String, List<DataHarmDto>> harmRateVByPhaseType = new HashMap<>();
|
||||||
|
Map<String, List<DataIDto>> dataIByPhaseType = new HashMap<>();
|
||||||
|
Map<String, List<DataHarmDto>> dataInHarmVPhaseType = new HashMap<>();
|
||||||
|
Map<String, List<DataVDto>> dataVPhaseType = new HashMap<>();
|
||||||
|
Map<String, List<DataVDto>> dataVDevPhaseType = new HashMap<>();
|
||||||
|
Map<String, List<DataPltDto>> dataPltPhaseType = new HashMap<>();
|
||||||
|
|
||||||
|
|
||||||
|
Integer allTime = 0;
|
||||||
|
Integer flickerAllTime = 0;
|
||||||
|
if (!CollectionUtils.isEmpty(allTimeList)) {
|
||||||
|
allTime = allTimeList.size();
|
||||||
|
}
|
||||||
|
if (!CollectionUtils.isEmpty(flickerAllTimeList)) {
|
||||||
|
flickerAllTime = flickerAllTimeList.size();
|
||||||
|
}
|
||||||
|
if (!CollectionUtils.isEmpty(dataHarmRateVPOList)) {
|
||||||
|
harmRateVByPhaseType = dataHarmRateVPOList.stream().collect(Collectors.groupingBy(DataHarmDto::getPhasicType));
|
||||||
|
}
|
||||||
|
if (!CollectionUtils.isEmpty(dataIPOList)) {
|
||||||
|
dataIByPhaseType = dataIPOList.stream().collect(Collectors.groupingBy(DataIDto::getPhasicType));
|
||||||
|
}
|
||||||
|
if (!CollectionUtils.isEmpty(dataInHarmVPOList)) {
|
||||||
|
dataInHarmVPhaseType = dataInHarmVPOList.stream().collect(Collectors.groupingBy(DataHarmDto::getPhasicType));
|
||||||
|
}
|
||||||
|
if (!CollectionUtils.isEmpty(dataVPOList)) {
|
||||||
|
dataVPhaseType = dataVPOList.stream().collect(Collectors.groupingBy(DataVDto::getPhasicType));
|
||||||
|
}
|
||||||
|
if (!CollectionUtils.isEmpty(dataVPODevList)) {
|
||||||
|
dataVDevPhaseType = dataVPODevList.stream().collect(Collectors.groupingBy(DataVDto::getPhasicType));
|
||||||
|
}
|
||||||
|
if (!CollectionUtils.isEmpty(dataPltPOList)) {
|
||||||
|
dataPltPhaseType = dataPltPOList.stream().collect(Collectors.groupingBy(DataPltDto::getPhasicType));
|
||||||
|
}
|
||||||
|
DataLimitDetailDto a = limitRateData(dataDate, overlimit, allTime, flickerAllTime, PhaseType.PHASE_A, overlimit.getId(), harmRateVByPhaseType.get(PhaseType.PHASE_A), dataIByPhaseType.get(PhaseType.PHASE_A), dataInHarmVPhaseType.get(PhaseType.PHASE_A), dataVPhaseType.get(PhaseType.PHASE_A), dataVDevPhaseType.get(PhaseType.PHASE_A), dataPltPhaseType.get(PhaseType.PHASE_A));
|
||||||
|
DataLimitDetailDto b = limitRateData(dataDate, overlimit, allTime, flickerAllTime, PhaseType.PHASE_B, overlimit.getId(), harmRateVByPhaseType.get(PhaseType.PHASE_B), dataIByPhaseType.get(PhaseType.PHASE_B), dataInHarmVPhaseType.get(PhaseType.PHASE_B), dataVPhaseType.get(PhaseType.PHASE_B), dataVDevPhaseType.get(PhaseType.PHASE_B), dataPltPhaseType.get(PhaseType.PHASE_B));
|
||||||
|
DataLimitDetailDto c = limitRateData(dataDate, overlimit, allTime, flickerAllTime, PhaseType.PHASE_C, overlimit.getId(), harmRateVByPhaseType.get(PhaseType.PHASE_C), dataIByPhaseType.get(PhaseType.PHASE_C), dataInHarmVPhaseType.get(PhaseType.PHASE_C), dataVPhaseType.get(PhaseType.PHASE_C), dataVDevPhaseType.get(PhaseType.PHASE_C), dataPltPhaseType.get(PhaseType.PHASE_C));
|
||||||
|
DataLimitDetailDto t = limitRateDataT(dataDate, overlimit, allTime, flickerAllTime, overlimit.getId(), dataHarmRateVPOList, dataIPOList, dataInHarmVPOList, dataVPOList, dataVPOUnbalanceList, dataIPONegList, dataVPOFreqList, dataVPODevList, dataPltPOList);
|
||||||
|
result.add(a);
|
||||||
|
result.add(b);
|
||||||
|
result.add(c);
|
||||||
|
result.add(t);
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Description: limitRateData
|
||||||
|
* @Param: [overlimit, allTime, flickerAllTime, phasicType, lineId, dataHarmRateVPOList, dataIPOList, dataInHarmVPOList, dataVPOList, dataVUnbalanceList, dataINegList]
|
||||||
|
* @return: com.njcn.harmonic.pojo.po.LimitRate
|
||||||
|
* @Author: clam
|
||||||
|
* @Date: 2022/10/18
|
||||||
|
*/
|
||||||
|
public DataLimitDetailDto limitRateData(String dataDate,
|
||||||
|
Overlimit overlimit,
|
||||||
|
Integer allTime,
|
||||||
|
Integer flickerAllTime,
|
||||||
|
String phasicType, String lineId,
|
||||||
|
List<DataHarmDto> dataHarmRateVPOList,
|
||||||
|
List<DataIDto> dataIPOList,
|
||||||
|
List<DataHarmDto> dataInHarmVPOList,
|
||||||
|
List<DataVDto> dataVPOList,
|
||||||
|
List<DataVDto> dataVPODevList,
|
||||||
|
List<DataPltDto> dataPltPOList) {
|
||||||
|
List<AbnormalData> thd = new ArrayList<>(), uDev = new ArrayList<>(), flicker = new ArrayList<>(), freqDev = new ArrayList<>(), uAberrance = new ArrayList<>(), iNeg = new ArrayList<>();
|
||||||
|
DataLimitDetailDto dto = new DataLimitDetailDto();
|
||||||
|
DataLimitRateDto limitRate = new DataLimitRateDto();
|
||||||
|
// 初始化 v 系列列表
|
||||||
|
List<AbnormalData>[] v = new List[24];
|
||||||
|
for (int i = 0; i < 24; i++) {
|
||||||
|
v[i] = new ArrayList<>();
|
||||||
|
}
|
||||||
|
// 处理数据
|
||||||
|
if (!CollectionUtils.isEmpty(dataHarmRateVPOList)) {
|
||||||
|
for (DataHarmDto item : dataHarmRateVPOList) {
|
||||||
|
for (int i = 2; i < 26; i++) {
|
||||||
|
try {
|
||||||
|
// 获取 DataHarmDto 类的 getVx 方法
|
||||||
|
Method getVMethod = DataHarmDto.class.getMethod("getV" + i);
|
||||||
|
Double value = (Double) getVMethod.invoke(item);
|
||||||
|
// 获取 Overlimit 类的 getUharmx 方法
|
||||||
|
Method getUharmMethod = Overlimit.class.getMethod("getUharm" + i);
|
||||||
|
float limit = (float) getUharmMethod.invoke(overlimit);
|
||||||
|
if (ObjectUtil.isNotNull(value)) {
|
||||||
|
if (value > limit) {
|
||||||
|
addAbnormalData(v[i - 2], item.getPhasicType(), item.getValueType(), item.getMinTime(), value, limit);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 初始化 i 系列列表
|
||||||
|
List<AbnormalData>[] i = new List[24];
|
||||||
|
for (int j = 0; j < 24; j++) {
|
||||||
|
i[j] = new ArrayList<>();
|
||||||
|
}
|
||||||
|
// 处理数据
|
||||||
|
if (!CollectionUtils.isEmpty(dataIPOList)) {
|
||||||
|
for (DataIDto item : dataIPOList) {
|
||||||
|
for (int j = 2; j < 26; j++) {
|
||||||
|
try {
|
||||||
|
// 获取 DataHarmDto 类的 getIx 方法
|
||||||
|
Method getVMethod = DataIDto.class.getMethod("getI" + j);
|
||||||
|
Double value = (Double) getVMethod.invoke(item);
|
||||||
|
// 获取 Overlimit 类的 getUharmx 方法
|
||||||
|
Method getUharmMethod = Overlimit.class.getMethod("getIharm" + j);
|
||||||
|
float limit = (float) getUharmMethod.invoke(overlimit);
|
||||||
|
if (ObjectUtil.isNotNull(value)) {
|
||||||
|
if (value > limit) {
|
||||||
|
addAbnormalData(i[j - 2], item.getValueType(), item.getPhasicType(), item.getMinTime(), value, limit);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// 初始化 uHarm 系列列表
|
||||||
|
List<AbnormalData>[] uHarm = new List[16];
|
||||||
|
for (int j = 0; j < 16; j++) {
|
||||||
|
uHarm[j] = new ArrayList<>();
|
||||||
|
}
|
||||||
|
// 处理数据
|
||||||
|
if (!CollectionUtils.isEmpty(dataInHarmVPOList)) {
|
||||||
|
for (DataHarmDto item : dataInHarmVPOList) {
|
||||||
|
for (int j = 1; j < 17; j++) {
|
||||||
|
try {
|
||||||
|
// 获取 DataHarmDto 类的 getVx 方法
|
||||||
|
Method getVMethod = DataHarmDto.class.getMethod("getV" + j);
|
||||||
|
Double value = (Double) getVMethod.invoke(item);
|
||||||
|
// 获取 Overlimit 类的 getUharmx 方法
|
||||||
|
Method getUharmMethod = Overlimit.class.getMethod("getInuharm" + j);
|
||||||
|
float limit = (float) getUharmMethod.invoke(overlimit);
|
||||||
|
if (ObjectUtil.isNotNull(value)) {
|
||||||
|
if (value > limit) {
|
||||||
|
addAbnormalData(uHarm[j - 1], item.getPhasicType(), item.getValueType(), item.getMinTime(), value, limit);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//电压总谐波畸变率
|
||||||
|
if (!CollectionUtils.isEmpty(dataVPOList)) {
|
||||||
|
for (DataVDto item : dataVPOList) {
|
||||||
|
if (ObjectUtil.isNotNull(item.getVThd())) {
|
||||||
|
if (item.getVThd() > overlimit.getUaberrance()) {
|
||||||
|
addAbnormalData(thd, item.getPhasicType(), item.getValueType(), item.getMinTime(), item.getVThd(), overlimit.getUaberrance());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//电压上偏差、电压下偏差(根据vl_dev的正负判断是用哪个值判断越限)
|
||||||
|
if (!CollectionUtils.isEmpty(dataVPODevList)) {
|
||||||
|
for (DataVDto item : dataVPODevList) {
|
||||||
|
if (ObjectUtil.isNotNull(item.getVlDev())) {
|
||||||
|
if (item.getVlDev() >= 0) {
|
||||||
|
if (item.getVlDev() > overlimit.getVoltageDev()) {
|
||||||
|
addAbnormalData(uDev, item.getPhasicType(), item.getValueType(), item.getMinTime(), item.getVlDev(), overlimit.getVoltageDev());
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (Math.abs(item.getVuDev()) > Math.abs(overlimit.getUvoltageDev())) {
|
||||||
|
addAbnormalData(uDev, item.getPhasicType(), item.getValueType(), item.getMinTime(), item.getVuDev(), overlimit.getUvoltageDev());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//长时间闪变
|
||||||
|
if (!CollectionUtils.isEmpty(dataPltPOList)) {
|
||||||
|
for (DataPltDto item : dataPltPOList) {
|
||||||
|
if (ObjectUtil.isNotNull(item.getPlt())) {
|
||||||
|
if (item.getPlt() > overlimit.getFlicker()) {
|
||||||
|
addAbnormalData(flicker, item.getPhasicType(), item.getValueType(), item.getMinTime(), item.getPlt(), overlimit.getFlicker());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
limitRate.setLineId(lineId);
|
||||||
|
limitRate.setTime(LocalDateTimeUtil.parseDate(dataDate, DatePattern.NORM_DATE_PATTERN));
|
||||||
|
limitRate.setPhasicType(phasicType);
|
||||||
|
limitRate.setAllTime(allTime);
|
||||||
|
limitRate.setFlickerAllTime(flickerAllTime);
|
||||||
|
|
||||||
|
limitRate.setFlickerOvertime(flicker.size());
|
||||||
|
limitRate.setUaberranceOvertime(thd.size());
|
||||||
|
limitRate.setINegOvertime(iNeg.size());
|
||||||
|
limitRate.setFreqDevOvertime(freqDev.size());
|
||||||
|
limitRate.setUbalanceOvertime(uAberrance.size());
|
||||||
|
limitRate.setVoltageDevOvertime(uDev.size());
|
||||||
|
dto.setDataLimitRate(getDataLimitRateDto(limitRate, v, i, uHarm));
|
||||||
|
|
||||||
|
return dto;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public DataLimitDetailDto limitRateDataT(
|
||||||
|
String dataDate,
|
||||||
|
Overlimit overlimit,
|
||||||
|
Integer allTime,
|
||||||
|
Integer flickerAllTime,
|
||||||
|
String lineId,
|
||||||
|
List<DataHarmDto> dataHarmRateVPOList,
|
||||||
|
List<DataIDto> dataIPOList,
|
||||||
|
List<DataHarmDto> dataInHarmVPOList,
|
||||||
|
List<DataVDto> dataVPOList,
|
||||||
|
List<DataVDto> dataVPOUnbalanceList,
|
||||||
|
List<DataIDto> dataIPONegList,
|
||||||
|
List<DataVDto> dataVPOFreqList,
|
||||||
|
List<DataVDto> dataVPODevList,
|
||||||
|
List<DataPltDto> dataPltPOList) {
|
||||||
|
DataLimitDetailDto dto = new DataLimitDetailDto();
|
||||||
|
DataLimitRateDto limitRate = new DataLimitRateDto();
|
||||||
|
//thd 总谐波畸变率
|
||||||
|
List<AbnormalData> sx = new ArrayList<>(), uDev = new ArrayList<>(), flicker = new ArrayList<>(), freqDev = new ArrayList<>(), zxb = new ArrayList<>(), iNeg = new ArrayList<>();
|
||||||
|
// 初始化 v 系列列表
|
||||||
|
List<AbnormalData>[] v = new List[24];
|
||||||
|
for (int i = 0; i < 24; i++) {
|
||||||
|
v[i] = new ArrayList<>();
|
||||||
|
}
|
||||||
|
// 处理数据
|
||||||
|
if (!CollectionUtils.isEmpty(dataHarmRateVPOList)) {
|
||||||
|
for (DataHarmDto item : dataHarmRateVPOList) {
|
||||||
|
for (int i = 2; i < 26; i++) {
|
||||||
|
try {
|
||||||
|
// 获取 DataHarmDto 类的 getVx 方法
|
||||||
|
Method getVMethod = DataHarmDto.class.getMethod("getV" + i);
|
||||||
|
Double value = (Double) getVMethod.invoke(item);
|
||||||
|
// 获取 Overlimit 类的 getUharmx 方法
|
||||||
|
Method getUharmMethod = Overlimit.class.getMethod("getUharm" + i);
|
||||||
|
float limit = (float) getUharmMethod.invoke(overlimit);
|
||||||
|
if (ObjectUtil.isNotNull(value)) {
|
||||||
|
if (value > limit) {
|
||||||
|
addAbnormalData(v[i - 2], item.getPhasicType(), item.getValueType(), item.getMinTime(), value, limit);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 初始化 i 系列列表
|
||||||
|
List<AbnormalData>[] i = new List[24];
|
||||||
|
for (int j = 0; j < 24; j++) {
|
||||||
|
i[j] = new ArrayList<>();
|
||||||
|
}
|
||||||
|
// 处理数据
|
||||||
|
if (!CollectionUtils.isEmpty(dataIPOList)) {
|
||||||
|
for (DataIDto item : dataIPOList) {
|
||||||
|
for (int j = 2; j < 26; j++) {
|
||||||
|
try {
|
||||||
|
// 获取 DataHarmDto 类的 getIx 方法
|
||||||
|
Method getVMethod = DataIDto.class.getMethod("getI" + j);
|
||||||
|
Double value = (Double) getVMethod.invoke(item);
|
||||||
|
// 获取 Overlimit 类的 getUharmx 方法
|
||||||
|
Method getUharmMethod = Overlimit.class.getMethod("getIharm" + j);
|
||||||
|
float limit = (float) getUharmMethod.invoke(overlimit);
|
||||||
|
if (ObjectUtil.isNotNull(value)) {
|
||||||
|
if (value > limit) {
|
||||||
|
addAbnormalData(i[j - 2], item.getPhasicType(), item.getValueType(), item.getMinTime(), value, limit);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// 初始化 uHarm 系列列表
|
||||||
|
List<AbnormalData>[] uHarm = new List[16];
|
||||||
|
for (int j = 0; j < 16; j++) {
|
||||||
|
uHarm[j] = new ArrayList<>();
|
||||||
|
}
|
||||||
|
// 处理数据
|
||||||
|
if (!CollectionUtils.isEmpty(dataInHarmVPOList)) {
|
||||||
|
for (DataHarmDto item : dataInHarmVPOList) {
|
||||||
|
for (int j = 1; j < 17; j++) {
|
||||||
|
try {
|
||||||
|
// 获取 DataHarmDto 类的 getVx 方法
|
||||||
|
Method getVMethod = DataHarmDto.class.getMethod("getV" + j);
|
||||||
|
Double value = (Double) getVMethod.invoke(item);
|
||||||
|
// 获取 Overlimit 类的 getUharmx 方法
|
||||||
|
Method getUharmMethod = Overlimit.class.getMethod("getInuharm" + j);
|
||||||
|
float limit = (float) getUharmMethod.invoke(overlimit);
|
||||||
|
if (ObjectUtil.isNotNull(value)) {
|
||||||
|
if (value > limit) {
|
||||||
|
addAbnormalData(uHarm[j - 1], item.getPhasicType(), item.getValueType(), item.getMinTime(), value, limit);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//电压总谐波畸变率
|
||||||
|
if (!CollectionUtils.isEmpty(dataVPOList)) {
|
||||||
|
for (DataVDto item : dataVPOList) {
|
||||||
|
if (ObjectUtil.isNotNull(item.getVThd())) {
|
||||||
|
if (item.getVThd() > overlimit.getUaberrance()) {
|
||||||
|
addAbnormalData(zxb, item.getPhasicType(), item.getValueType(), item.getMinTime(), item.getVThd(), overlimit.getUaberrance());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//三相电压不平衡度
|
||||||
|
if (!CollectionUtils.isEmpty(dataVPOUnbalanceList)) {
|
||||||
|
for (DataVDto item : dataVPOUnbalanceList) {
|
||||||
|
if (ObjectUtil.isNotNull(item.getVUnbalance())) {
|
||||||
|
if (item.getVUnbalance() > overlimit.getUbalance()) {
|
||||||
|
addAbnormalData(sx, item.getPhasicType(), item.getValueType(), item.getMinTime(), item.getVUnbalance(), overlimit.getUbalance());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//负序电流
|
||||||
|
if (!CollectionUtils.isEmpty(dataIPONegList)) {
|
||||||
|
for (DataIDto item : dataIPONegList) {
|
||||||
|
if (ObjectUtil.isNotNull(item.getINeg())) {
|
||||||
|
if (item.getINeg() > overlimit.getINeg()) {
|
||||||
|
addAbnormalData(iNeg, item.getPhasicType(), item.getValueType(), item.getMinTime(), item.getINeg(), overlimit.getINeg());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//频率偏差
|
||||||
|
if (!CollectionUtils.isEmpty(dataVPOFreqList)) {
|
||||||
|
for (DataVDto item : dataVPOFreqList) {
|
||||||
|
if (ObjectUtil.isNotNull(item.getFreqDev())) {
|
||||||
|
if (item.getFreqDev() > overlimit.getFreqDev()) {
|
||||||
|
addAbnormalData(freqDev, item.getPhasicType(), item.getValueType(), item.getMinTime(), item.getFreqDev(), overlimit.getFreqDev());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//电压上偏差、电压下偏差(根据vl_dev的正负判断是用哪个值判断越限)
|
||||||
|
if (!CollectionUtils.isEmpty(dataVPODevList)) {
|
||||||
|
for (DataVDto item : dataVPODevList) {
|
||||||
|
if (ObjectUtil.isNotNull(item.getVlDev())) {
|
||||||
|
if (item.getVlDev() >= 0) {
|
||||||
|
if (item.getVlDev() > overlimit.getVoltageDev()) {
|
||||||
|
addAbnormalData(uDev, item.getPhasicType(), item.getMinTime(), item.getValueType(), item.getVlDev(), overlimit.getVoltageDev());
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (Math.abs(item.getVuDev()) > Math.abs(overlimit.getUvoltageDev())) {
|
||||||
|
addAbnormalData(uDev, item.getPhasicType(), item.getMinTime(), item.getValueType(), item.getVuDev(), overlimit.getUvoltageDev());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//长时间闪变
|
||||||
|
if (!CollectionUtils.isEmpty(dataPltPOList)) {
|
||||||
|
for (DataPltDto item : dataPltPOList) {
|
||||||
|
if (ObjectUtil.isNotNull(item.getPlt())) {
|
||||||
|
if (item.getPlt() > overlimit.getFlicker()) {
|
||||||
|
addAbnormalData(flicker, item.getPhasicType(), item.getValueType(), item.getMinTime(), item.getPlt(), overlimit.getFlicker());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
limitRate.setLineId(lineId);
|
||||||
|
limitRate.setTime(LocalDateTimeUtil.parseDate(dataDate, DatePattern.NORM_DATE_PATTERN));
|
||||||
|
limitRate.setPhasicType(PhaseType.PHASE_T);
|
||||||
|
limitRate.setAllTime(allTime);
|
||||||
|
limitRate.setFlickerAllTime(flickerAllTime);
|
||||||
|
limitRate.setUaberranceOvertime(zxb.stream().map(AbnormalData::getTime).distinct().collect(Collectors.toList()).size());
|
||||||
|
limitRate.setINegOvertime(iNeg.stream().map(AbnormalData::getTime).distinct().collect(Collectors.toList()).size());
|
||||||
|
limitRate.setFreqDevOvertime(freqDev.stream().map(AbnormalData::getTime).distinct().collect(Collectors.toList()).size());
|
||||||
|
limitRate.setUbalanceOvertime(sx.stream().map(AbnormalData::getTime).distinct().collect(Collectors.toList()).size());
|
||||||
|
limitRate.setVoltageDevOvertime(uDev.stream().map(AbnormalData::getTime).distinct().collect(Collectors.toList()).size());
|
||||||
|
limitRate.setFlickerOvertime(flicker.stream().map(AbnormalData::getTime).distinct().collect(Collectors.toList()).size());
|
||||||
|
limitRate.setUharm2Overtime(v[0].stream().map(AbnormalData::getTime).distinct().collect(Collectors.toList()).size());
|
||||||
|
limitRate.setUharm3Overtime(v[1].stream().map(AbnormalData::getTime).distinct().collect(Collectors.toList()).size());
|
||||||
|
limitRate.setUharm4Overtime(v[2].stream().map(AbnormalData::getTime).distinct().collect(Collectors.toList()).size());
|
||||||
|
limitRate.setUharm5Overtime(v[3].stream().map(AbnormalData::getTime).distinct().collect(Collectors.toList()).size());
|
||||||
|
limitRate.setUharm6Overtime(v[4].stream().map(AbnormalData::getTime).distinct().collect(Collectors.toList()).size());
|
||||||
|
limitRate.setUharm7Overtime(v[5].stream().map(AbnormalData::getTime).distinct().collect(Collectors.toList()).size());
|
||||||
|
limitRate.setUharm8Overtime(v[6].stream().map(AbnormalData::getTime).distinct().collect(Collectors.toList()).size());
|
||||||
|
limitRate.setUharm9Overtime(v[7].stream().map(AbnormalData::getTime).distinct().collect(Collectors.toList()).size());
|
||||||
|
limitRate.setUharm10Overtime(v[8].stream().map(AbnormalData::getTime).distinct().collect(Collectors.toList()).size());
|
||||||
|
limitRate.setUharm11Overtime(v[9].stream().map(AbnormalData::getTime).distinct().collect(Collectors.toList()).size());
|
||||||
|
limitRate.setUharm12Overtime(v[10].stream().map(AbnormalData::getTime).distinct().collect(Collectors.toList()).size());
|
||||||
|
limitRate.setUharm13Overtime(v[11].stream().map(AbnormalData::getTime).distinct().collect(Collectors.toList()).size());
|
||||||
|
limitRate.setUharm14Overtime(v[12].stream().map(AbnormalData::getTime).distinct().collect(Collectors.toList()).size());
|
||||||
|
limitRate.setUharm15Overtime(v[13].stream().map(AbnormalData::getTime).distinct().collect(Collectors.toList()).size());
|
||||||
|
limitRate.setUharm16Overtime(v[14].stream().map(AbnormalData::getTime).distinct().collect(Collectors.toList()).size());
|
||||||
|
limitRate.setUharm17Overtime(v[15].stream().map(AbnormalData::getTime).distinct().collect(Collectors.toList()).size());
|
||||||
|
limitRate.setUharm18Overtime(v[16].stream().map(AbnormalData::getTime).distinct().collect(Collectors.toList()).size());
|
||||||
|
limitRate.setUharm19Overtime(v[17].stream().map(AbnormalData::getTime).distinct().collect(Collectors.toList()).size());
|
||||||
|
limitRate.setUharm20Overtime(v[18].stream().map(AbnormalData::getTime).distinct().collect(Collectors.toList()).size());
|
||||||
|
limitRate.setUharm21Overtime(v[19].stream().map(AbnormalData::getTime).distinct().collect(Collectors.toList()).size());
|
||||||
|
limitRate.setUharm22Overtime(v[20].stream().map(AbnormalData::getTime).distinct().collect(Collectors.toList()).size());
|
||||||
|
limitRate.setUharm23Overtime(v[21].stream().map(AbnormalData::getTime).distinct().collect(Collectors.toList()).size());
|
||||||
|
limitRate.setUharm24Overtime(v[22].stream().map(AbnormalData::getTime).distinct().collect(Collectors.toList()).size());
|
||||||
|
limitRate.setUharm25Overtime(v[23].stream().map(AbnormalData::getTime).distinct().collect(Collectors.toList()).size());
|
||||||
|
limitRate.setIharm2Overtime(i[0].stream().map(AbnormalData::getTime).distinct().collect(Collectors.toList()).size());
|
||||||
|
limitRate.setIharm3Overtime(i[1].stream().map(AbnormalData::getTime).distinct().collect(Collectors.toList()).size());
|
||||||
|
limitRate.setIharm4Overtime(i[2].stream().map(AbnormalData::getTime).distinct().collect(Collectors.toList()).size());
|
||||||
|
limitRate.setIharm5Overtime(i[3].stream().map(AbnormalData::getTime).distinct().collect(Collectors.toList()).size());
|
||||||
|
limitRate.setIharm6Overtime(i[4].stream().map(AbnormalData::getTime).distinct().collect(Collectors.toList()).size());
|
||||||
|
limitRate.setIharm7Overtime(i[5].stream().map(AbnormalData::getTime).distinct().collect(Collectors.toList()).size());
|
||||||
|
limitRate.setIharm8Overtime(i[6].stream().map(AbnormalData::getTime).distinct().collect(Collectors.toList()).size());
|
||||||
|
limitRate.setIharm9Overtime(i[7].stream().map(AbnormalData::getTime).distinct().collect(Collectors.toList()).size());
|
||||||
|
limitRate.setIharm10Overtime(i[8].stream().map(AbnormalData::getTime).distinct().collect(Collectors.toList()).size());
|
||||||
|
limitRate.setIharm11Overtime(i[9].stream().map(AbnormalData::getTime).distinct().collect(Collectors.toList()).size());
|
||||||
|
limitRate.setIharm12Overtime(i[10].stream().map(AbnormalData::getTime).distinct().collect(Collectors.toList()).size());
|
||||||
|
limitRate.setIharm13Overtime(i[11].stream().map(AbnormalData::getTime).distinct().collect(Collectors.toList()).size());
|
||||||
|
limitRate.setIharm14Overtime(i[12].stream().map(AbnormalData::getTime).distinct().collect(Collectors.toList()).size());
|
||||||
|
limitRate.setIharm15Overtime(i[13].stream().map(AbnormalData::getTime).distinct().collect(Collectors.toList()).size());
|
||||||
|
limitRate.setIharm16Overtime(i[14].stream().map(AbnormalData::getTime).distinct().collect(Collectors.toList()).size());
|
||||||
|
limitRate.setIharm17Overtime(i[15].stream().map(AbnormalData::getTime).distinct().collect(Collectors.toList()).size());
|
||||||
|
limitRate.setIharm18Overtime(i[16].stream().map(AbnormalData::getTime).distinct().collect(Collectors.toList()).size());
|
||||||
|
limitRate.setIharm19Overtime(i[17].stream().map(AbnormalData::getTime).distinct().collect(Collectors.toList()).size());
|
||||||
|
limitRate.setIharm20Overtime(i[18].stream().map(AbnormalData::getTime).distinct().collect(Collectors.toList()).size());
|
||||||
|
limitRate.setIharm21Overtime(i[19].stream().map(AbnormalData::getTime).distinct().collect(Collectors.toList()).size());
|
||||||
|
limitRate.setIharm22Overtime(i[20].stream().map(AbnormalData::getTime).distinct().collect(Collectors.toList()).size());
|
||||||
|
limitRate.setIharm23Overtime(i[21].stream().map(AbnormalData::getTime).distinct().collect(Collectors.toList()).size());
|
||||||
|
limitRate.setIharm24Overtime(i[22].stream().map(AbnormalData::getTime).distinct().collect(Collectors.toList()).size());
|
||||||
|
limitRate.setIharm25Overtime(i[23].stream().map(AbnormalData::getTime).distinct().collect(Collectors.toList()).size());
|
||||||
|
limitRate.setInuharm1Overtime(uHarm[0].stream().map(AbnormalData::getTime).distinct().collect(Collectors.toList()).size());
|
||||||
|
limitRate.setInuharm2Overtime(uHarm[1].stream().map(AbnormalData::getTime).distinct().collect(Collectors.toList()).size());
|
||||||
|
limitRate.setInuharm3Overtime(uHarm[2].stream().map(AbnormalData::getTime).distinct().collect(Collectors.toList()).size());
|
||||||
|
limitRate.setInuharm4Overtime(uHarm[3].stream().map(AbnormalData::getTime).distinct().collect(Collectors.toList()).size());
|
||||||
|
limitRate.setInuharm5Overtime(uHarm[4].stream().map(AbnormalData::getTime).distinct().collect(Collectors.toList()).size());
|
||||||
|
limitRate.setInuharm6Overtime(uHarm[5].stream().map(AbnormalData::getTime).distinct().collect(Collectors.toList()).size());
|
||||||
|
limitRate.setInuharm7Overtime(uHarm[6].stream().map(AbnormalData::getTime).distinct().collect(Collectors.toList()).size());
|
||||||
|
limitRate.setInuharm8Overtime(uHarm[7].stream().map(AbnormalData::getTime).distinct().collect(Collectors.toList()).size());
|
||||||
|
limitRate.setInuharm9Overtime(uHarm[8].stream().map(AbnormalData::getTime).distinct().collect(Collectors.toList()).size());
|
||||||
|
limitRate.setInuharm10Overtime(uHarm[9].stream().map(AbnormalData::getTime).distinct().collect(Collectors.toList()).size());
|
||||||
|
limitRate.setInuharm11Overtime(uHarm[10].stream().map(AbnormalData::getTime).distinct().collect(Collectors.toList()).size());
|
||||||
|
limitRate.setInuharm12Overtime(uHarm[11].stream().map(AbnormalData::getTime).distinct().collect(Collectors.toList()).size());
|
||||||
|
limitRate.setInuharm13Overtime(uHarm[12].stream().map(AbnormalData::getTime).distinct().collect(Collectors.toList()).size());
|
||||||
|
limitRate.setInuharm14Overtime(uHarm[13].stream().map(AbnormalData::getTime).distinct().collect(Collectors.toList()).size());
|
||||||
|
limitRate.setInuharm15Overtime(uHarm[14].stream().map(AbnormalData::getTime).distinct().collect(Collectors.toList()).size());
|
||||||
|
limitRate.setInuharm16Overtime(uHarm[15].stream().map(AbnormalData::getTime).distinct().collect(Collectors.toList()).size());
|
||||||
|
dto.setDataLimitRate(limitRate);
|
||||||
|
|
||||||
|
int detailAllTime = flicker.size() + sx.size() + iNeg.size() + freqDev.size() + zxb.size() + uDev.size() +
|
||||||
|
v[0].size() + v[1].size() + v[2].size() + v[3].size() + v[4].size() + v[5].size() + v[6].size() + v[7].size() + v[8].size() + v[9].size() + v[11].size() + v[12].size() + v[13].size() + v[14].size() + v[15].size() + v[16].size() + v[17].size() + v[18].size() + v[19].size() + v[20].size() + v[21].size() + v[22].size() + v[23].size() +
|
||||||
|
i[0].size() + i[1].size() + i[2].size() + i[3].size() + i[4].size() + i[5].size() + i[6].size() + i[7].size() + i[8].size() + i[9].size() + i[10].size() + i[11].size() + i[12].size() + i[13].size() + i[14].size() + i[15].size() + i[16].size() + i[17].size() + i[18].size() + i[19].size() + i[20].size() + i[21].size() + i[22].size() + i[23].size() +
|
||||||
|
uHarm[0].size() + uHarm[1].size() + uHarm[2].size() + uHarm[3].size() + uHarm[4].size() + uHarm[5].size() + uHarm[6].size() + uHarm[7].size() + uHarm[8].size() + uHarm[9].size() + uHarm[10].size() + uHarm[11].size() + uHarm[12].size() + uHarm[13].size() + uHarm[14].size() + uHarm[15].size();
|
||||||
|
if (detailAllTime > 0) {
|
||||||
|
DataLimitRateDetailDto detail = new DataLimitRateDetailDto();
|
||||||
|
detail.setLineId(lineId);
|
||||||
|
detail.setTime(LocalDateTimeUtil.parseDate(dataDate, DatePattern.NORM_DATE_PATTERN));
|
||||||
|
detail.setFlickerOvertime(toJson(flicker));
|
||||||
|
detail.setUaberranceOvertime(toJson(zxb));
|
||||||
|
detail.setINegOvertime(toJson(iNeg));
|
||||||
|
detail.setFreqDevOvertime(toJson(freqDev));
|
||||||
|
detail.setUbalanceOvertime(toJson(sx));
|
||||||
|
detail.setVoltageDevOvertime(toJson(uDev));
|
||||||
|
detail.setUharm2Overtime(toJson(v[0]));
|
||||||
|
detail.setUharm3Overtime(toJson(v[1]));
|
||||||
|
detail.setUharm4Overtime(toJson(v[2]));
|
||||||
|
detail.setUharm5Overtime(toJson(v[3]));
|
||||||
|
detail.setUharm6Overtime(toJson(v[4]));
|
||||||
|
detail.setUharm7Overtime(toJson(v[5]));
|
||||||
|
detail.setUharm8Overtime(toJson(v[6]));
|
||||||
|
detail.setUharm9Overtime(toJson(v[7]));
|
||||||
|
detail.setUharm10Overtime(toJson(v[8]));
|
||||||
|
detail.setUharm11Overtime(toJson(v[9]));
|
||||||
|
detail.setUharm12Overtime(toJson(v[10]));
|
||||||
|
detail.setUharm13Overtime(toJson(v[11]));
|
||||||
|
detail.setUharm14Overtime(toJson(v[12]));
|
||||||
|
detail.setUharm15Overtime(toJson(v[13]));
|
||||||
|
detail.setUharm16Overtime(toJson(v[14]));
|
||||||
|
detail.setUharm17Overtime(toJson(v[15]));
|
||||||
|
detail.setUharm18Overtime(toJson(v[16]));
|
||||||
|
detail.setUharm19Overtime(toJson(v[17]));
|
||||||
|
detail.setUharm20Overtime(toJson(v[18]));
|
||||||
|
detail.setUharm21Overtime(toJson(v[19]));
|
||||||
|
detail.setUharm22Overtime(toJson(v[20]));
|
||||||
|
detail.setUharm23Overtime(toJson(v[21]));
|
||||||
|
detail.setUharm24Overtime(toJson(v[22]));
|
||||||
|
detail.setUharm25Overtime(toJson(v[23]));
|
||||||
|
detail.setIharm2Overtime(toJson(i[0]));
|
||||||
|
detail.setIharm3Overtime(toJson(i[1]));
|
||||||
|
detail.setIharm4Overtime(toJson(i[2]));
|
||||||
|
detail.setIharm5Overtime(toJson(i[3]));
|
||||||
|
detail.setIharm6Overtime(toJson(i[4]));
|
||||||
|
detail.setIharm7Overtime(toJson(i[5]));
|
||||||
|
detail.setIharm8Overtime(toJson(i[6]));
|
||||||
|
detail.setIharm9Overtime(toJson(i[7]));
|
||||||
|
detail.setIharm10Overtime(toJson(i[8]));
|
||||||
|
detail.setIharm11Overtime(toJson(i[9]));
|
||||||
|
detail.setIharm12Overtime(toJson(i[10]));
|
||||||
|
detail.setIharm13Overtime(toJson(i[11]));
|
||||||
|
detail.setIharm14Overtime(toJson(i[12]));
|
||||||
|
detail.setIharm15Overtime(toJson(i[13]));
|
||||||
|
detail.setIharm16Overtime(toJson(i[14]));
|
||||||
|
detail.setIharm17Overtime(toJson(i[15]));
|
||||||
|
detail.setIharm18Overtime(toJson(i[16]));
|
||||||
|
detail.setIharm19Overtime(toJson(i[17]));
|
||||||
|
detail.setIharm20Overtime(toJson(i[18]));
|
||||||
|
detail.setIharm21Overtime(toJson(i[19]));
|
||||||
|
detail.setIharm22Overtime(toJson(i[20]));
|
||||||
|
detail.setIharm23Overtime(toJson(i[21]));
|
||||||
|
detail.setIharm24Overtime(toJson(i[22]));
|
||||||
|
detail.setIharm25Overtime(toJson(i[23]));
|
||||||
|
detail.setInuharm1Overtime(toJson(uHarm[0]));
|
||||||
|
detail.setInuharm2Overtime(toJson(uHarm[1]));
|
||||||
|
detail.setInuharm3Overtime(toJson(uHarm[2]));
|
||||||
|
detail.setInuharm4Overtime(toJson(uHarm[3]));
|
||||||
|
detail.setInuharm5Overtime(toJson(uHarm[4]));
|
||||||
|
detail.setInuharm6Overtime(toJson(uHarm[5]));
|
||||||
|
detail.setInuharm7Overtime(toJson(uHarm[6]));
|
||||||
|
detail.setInuharm8Overtime(toJson(uHarm[7]));
|
||||||
|
detail.setInuharm9Overtime(toJson(uHarm[8]));
|
||||||
|
detail.setInuharm10Overtime(toJson(uHarm[9]));
|
||||||
|
detail.setInuharm11Overtime(toJson(uHarm[10]));
|
||||||
|
detail.setInuharm12Overtime(toJson(uHarm[11]));
|
||||||
|
detail.setInuharm13Overtime(toJson(uHarm[12]));
|
||||||
|
detail.setInuharm14Overtime(toJson(uHarm[13]));
|
||||||
|
detail.setInuharm15Overtime(toJson(uHarm[14]));
|
||||||
|
detail.setInuharm16Overtime(toJson(uHarm[15]));
|
||||||
|
dto.setDataLimitRateDetail(detail);
|
||||||
|
}
|
||||||
|
return dto;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private DataLimitRateDto getDataLimitRateDto(DataLimitRateDto limitRate, List<AbnormalData>[] v, List<AbnormalData>[] i, List<AbnormalData>[] uHarm) {
|
||||||
|
limitRate.setUharm2Overtime(v[0].size());
|
||||||
|
limitRate.setUharm3Overtime(v[1].size());
|
||||||
|
limitRate.setUharm4Overtime(v[2].size());
|
||||||
|
limitRate.setUharm5Overtime(v[3].size());
|
||||||
|
limitRate.setUharm6Overtime(v[4].size());
|
||||||
|
limitRate.setUharm7Overtime(v[5].size());
|
||||||
|
limitRate.setUharm8Overtime(v[6].size());
|
||||||
|
limitRate.setUharm9Overtime(v[7].size());
|
||||||
|
limitRate.setUharm10Overtime(v[8].size());
|
||||||
|
limitRate.setUharm11Overtime(v[9].size());
|
||||||
|
limitRate.setUharm12Overtime(v[10].size());
|
||||||
|
limitRate.setUharm13Overtime(v[11].size());
|
||||||
|
limitRate.setUharm14Overtime(v[12].size());
|
||||||
|
limitRate.setUharm15Overtime(v[13].size());
|
||||||
|
limitRate.setUharm16Overtime(v[14].size());
|
||||||
|
limitRate.setUharm17Overtime(v[15].size());
|
||||||
|
limitRate.setUharm18Overtime(v[16].size());
|
||||||
|
limitRate.setUharm19Overtime(v[17].size());
|
||||||
|
limitRate.setUharm20Overtime(v[18].size());
|
||||||
|
limitRate.setUharm21Overtime(v[19].size());
|
||||||
|
limitRate.setUharm22Overtime(v[20].size());
|
||||||
|
limitRate.setUharm23Overtime(v[21].size());
|
||||||
|
limitRate.setUharm24Overtime(v[22].size());
|
||||||
|
limitRate.setUharm25Overtime(v[23].size());
|
||||||
|
limitRate.setIharm2Overtime(i[0].size());
|
||||||
|
limitRate.setIharm3Overtime(i[1].size());
|
||||||
|
limitRate.setIharm4Overtime(i[2].size());
|
||||||
|
limitRate.setIharm5Overtime(i[3].size());
|
||||||
|
limitRate.setIharm6Overtime(i[4].size());
|
||||||
|
limitRate.setIharm7Overtime(i[5].size());
|
||||||
|
limitRate.setIharm8Overtime(i[6].size());
|
||||||
|
limitRate.setIharm9Overtime(i[7].size());
|
||||||
|
limitRate.setIharm10Overtime(i[8].size());
|
||||||
|
limitRate.setIharm11Overtime(i[9].size());
|
||||||
|
limitRate.setIharm12Overtime(i[10].size());
|
||||||
|
limitRate.setIharm13Overtime(i[11].size());
|
||||||
|
limitRate.setIharm14Overtime(i[12].size());
|
||||||
|
limitRate.setIharm15Overtime(i[13].size());
|
||||||
|
limitRate.setIharm16Overtime(i[14].size());
|
||||||
|
limitRate.setIharm17Overtime(i[15].size());
|
||||||
|
limitRate.setIharm18Overtime(i[16].size());
|
||||||
|
limitRate.setIharm19Overtime(i[17].size());
|
||||||
|
limitRate.setIharm20Overtime(i[18].size());
|
||||||
|
limitRate.setIharm21Overtime(i[19].size());
|
||||||
|
limitRate.setIharm22Overtime(i[20].size());
|
||||||
|
limitRate.setIharm23Overtime(i[21].size());
|
||||||
|
limitRate.setIharm24Overtime(i[22].size());
|
||||||
|
limitRate.setIharm25Overtime(i[23].size());
|
||||||
|
limitRate.setInuharm1Overtime(uHarm[0].size());
|
||||||
|
limitRate.setInuharm2Overtime(uHarm[1].size());
|
||||||
|
limitRate.setInuharm3Overtime(uHarm[2].size());
|
||||||
|
limitRate.setInuharm4Overtime(uHarm[3].size());
|
||||||
|
limitRate.setInuharm5Overtime(uHarm[4].size());
|
||||||
|
limitRate.setInuharm6Overtime(uHarm[5].size());
|
||||||
|
limitRate.setInuharm7Overtime(uHarm[6].size());
|
||||||
|
limitRate.setInuharm8Overtime(uHarm[7].size());
|
||||||
|
limitRate.setInuharm9Overtime(uHarm[8].size());
|
||||||
|
limitRate.setInuharm10Overtime(uHarm[9].size());
|
||||||
|
limitRate.setInuharm11Overtime(uHarm[10].size());
|
||||||
|
limitRate.setInuharm12Overtime(uHarm[11].size());
|
||||||
|
limitRate.setInuharm13Overtime(uHarm[12].size());
|
||||||
|
limitRate.setInuharm14Overtime(uHarm[13].size());
|
||||||
|
limitRate.setInuharm15Overtime(uHarm[14].size());
|
||||||
|
limitRate.setInuharm16Overtime(uHarm[15].size());
|
||||||
|
return limitRate;
|
||||||
|
}
|
||||||
|
|
||||||
|
private String toJson(List<AbnormalData> list) {
|
||||||
|
Map<String, List<AbnormalData>> abnormalMap = list.stream().collect(Collectors.groupingBy(x -> x.getPhasic() + "_" + x.getValueType()));
|
||||||
|
List<AbnormalData.Json> info = new ArrayList<>();
|
||||||
|
abnormalMap.forEach((key, value) -> {
|
||||||
|
String[] split = key.split("_");
|
||||||
|
AbnormalData.Json json = new AbnormalData.Json();
|
||||||
|
json.setPhasic(split[0]);
|
||||||
|
json.setValueType(split[1]);
|
||||||
|
json.setTime(String.join(",", value.stream()
|
||||||
|
.map(abnormal -> abnormal.getTime())
|
||||||
|
.collect(Collectors.toList())));
|
||||||
|
json.setValue(String.join(",", value.stream()
|
||||||
|
.map(abnormal -> abnormal.getValue() + "")
|
||||||
|
.collect(Collectors.toList())));
|
||||||
|
json.setOverLimitValue(list.get(0).getOverLimitValue());
|
||||||
|
info.add(json);
|
||||||
|
});
|
||||||
|
if (CollUtil.isNotEmpty(info)) {
|
||||||
|
return JSON.toJSONString(info);
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void addAbnormalData(List<AbnormalData> list, String phasicType, String valueType, String time, Double value, float overLimitValue) {
|
||||||
|
AbnormalData data = new AbnormalData();
|
||||||
|
data.setTime(time.substring(11, time.length()));
|
||||||
|
data.setPhasic(phasicType);
|
||||||
|
data.setValueType(valueType);
|
||||||
|
data.setValue(value);
|
||||||
|
data.setOverLimitValue(overLimitValue);
|
||||||
|
list.add(data);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -3,16 +3,18 @@ package com.njcn.algorithm.serviceimpl.line;
|
|||||||
|
|
||||||
import cn.hutool.core.collection.CollUtil;
|
import cn.hutool.core.collection.CollUtil;
|
||||||
import cn.hutool.core.collection.CollectionUtil;
|
import cn.hutool.core.collection.CollectionUtil;
|
||||||
import cn.hutool.core.date.DateTime;
|
|
||||||
import cn.hutool.core.date.DateUnit;
|
import cn.hutool.core.date.DateUnit;
|
||||||
import cn.hutool.core.date.DateUtil;
|
import cn.hutool.core.date.DateUtil;
|
||||||
|
import cn.hutool.core.util.NumberUtil;
|
||||||
import cn.hutool.core.util.ObjectUtil;
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
import com.njcn.algorithm.pojo.bo.CalculatedParam;
|
import com.njcn.algorithm.pojo.bo.CalculatedParam;
|
||||||
import com.njcn.algorithm.service.line.IDataOnlineRateService;
|
import com.njcn.algorithm.service.line.IDataOnlineRateService;
|
||||||
|
import com.njcn.dataProcess.api.DataIntegrityFeignClient;
|
||||||
import com.njcn.dataProcess.api.DataOnlineRateFeignClient;
|
import com.njcn.dataProcess.api.DataOnlineRateFeignClient;
|
||||||
import com.njcn.dataProcess.api.DataVFeignClient;
|
import com.njcn.dataProcess.api.DataVFeignClient;
|
||||||
import com.njcn.dataProcess.api.PqsCommunicateFeignClient;
|
import com.njcn.dataProcess.api.PqsCommunicateFeignClient;
|
||||||
import com.njcn.dataProcess.param.LineCountEvaluateParam;
|
import com.njcn.dataProcess.param.LineCountEvaluateParam;
|
||||||
|
import com.njcn.dataProcess.pojo.dto.DataIntegrityDto;
|
||||||
import com.njcn.dataProcess.pojo.dto.DataOnlineRateDto;
|
import com.njcn.dataProcess.pojo.dto.DataOnlineRateDto;
|
||||||
import com.njcn.dataProcess.pojo.dto.PqsCommunicateDto;
|
import com.njcn.dataProcess.pojo.dto.PqsCommunicateDto;
|
||||||
import com.njcn.dataProcess.util.TimeUtils;
|
import com.njcn.dataProcess.util.TimeUtils;
|
||||||
@@ -61,7 +63,8 @@ public class IDataOnlineRateServiceImpl implements IDataOnlineRateService {
|
|||||||
private CommTerminalGeneralClient commTerminalGeneralClient;
|
private CommTerminalGeneralClient commTerminalGeneralClient;
|
||||||
@Resource
|
@Resource
|
||||||
private DeptFeignClient deptFeignClient;
|
private DeptFeignClient deptFeignClient;
|
||||||
|
@Resource
|
||||||
|
private DataIntegrityFeignClient dataIntegrityFeignClient;
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -73,8 +76,6 @@ public class IDataOnlineRateServiceImpl implements IDataOnlineRateService {
|
|||||||
List<String> devIdList = calculatedParam.getIdList();
|
List<String> devIdList = calculatedParam.getIdList();
|
||||||
|
|
||||||
List<DataOnlineRateDto.Detail> list = new ArrayList<>();
|
List<DataOnlineRateDto.Detail> list = new ArrayList<>();
|
||||||
if(ObjectUtil.isNotNull(calculatedParam.getType())){
|
|
||||||
if(calculatedParam.getType()==1){
|
|
||||||
DeptGetLineParam deptGetLineParam = new DeptGetLineParam();
|
DeptGetLineParam deptGetLineParam = new DeptGetLineParam();
|
||||||
Dept dept = deptFeignClient.getRootDept().getData();
|
Dept dept = deptFeignClient.getRootDept().getData();
|
||||||
deptGetLineParam.setDeptId(dept.getId());
|
deptGetLineParam.setDeptId(dept.getId());
|
||||||
@@ -84,6 +85,7 @@ public class IDataOnlineRateServiceImpl implements IDataOnlineRateService {
|
|||||||
Map<String, List<LineDevGetDTO>> LineDevGetMap = devList.stream()
|
Map<String, List<LineDevGetDTO>> LineDevGetMap = devList.stream()
|
||||||
.filter(x -> devIdList.contains(x.getDevId()))
|
.filter(x -> devIdList.contains(x.getDevId()))
|
||||||
.collect(Collectors.groupingBy(LineDevGetDTO::getDevId));
|
.collect(Collectors.groupingBy(LineDevGetDTO::getDevId));
|
||||||
|
if (ObjectUtil.isNotNull(calculatedParam.getType())&&calculatedParam.getType() == 1) {
|
||||||
LineDevGetMap.forEach((key, value) -> {
|
LineDevGetMap.forEach((key, value) -> {
|
||||||
DataOnlineRateDto.Detail onlineRateDpo = new DataOnlineRateDto.Detail();
|
DataOnlineRateDto.Detail onlineRateDpo = new DataOnlineRateDto.Detail();
|
||||||
List<String> collect = value.stream().map(LineDevGetDTO::getPointId).collect(Collectors.toList());
|
List<String> collect = value.stream().map(LineDevGetDTO::getPointId).collect(Collectors.toList());
|
||||||
@@ -100,7 +102,6 @@ public class IDataOnlineRateServiceImpl implements IDataOnlineRateService {
|
|||||||
}
|
}
|
||||||
list.add(onlineRateDpo);
|
list.add(onlineRateDpo);
|
||||||
});
|
});
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
List<PqsCommunicateDto> outCommunicateData = new ArrayList<>();
|
List<PqsCommunicateDto> outCommunicateData = new ArrayList<>();
|
||||||
for (String s : devIdList) {
|
for (String s : devIdList) {
|
||||||
@@ -120,6 +121,35 @@ public class IDataOnlineRateServiceImpl implements IDataOnlineRateService {
|
|||||||
onlineRateDpo.setOfflineMin(onLineRate.getOfflineMin());
|
onlineRateDpo.setOfflineMin(onLineRate.getOfflineMin());
|
||||||
list.add(onlineRateDpo);
|
list.add(onlineRateDpo);
|
||||||
}
|
}
|
||||||
|
LineDevGetMap.forEach((key, value) -> {
|
||||||
|
DataOnlineRateDto.Detail onlineRateDpo = new DataOnlineRateDto.Detail();
|
||||||
|
long count = list.stream().filter(x -> x.getDevIndex().equals(key)).count();
|
||||||
|
if (count < 1) {
|
||||||
|
onlineRateDpo.setTimeId(calculatedParam.getDataDate());
|
||||||
|
onlineRateDpo.setDevIndex(key);
|
||||||
|
List<String> lineIds = value.stream().map(LineDevGetDTO::getPointId).collect(Collectors.toList());
|
||||||
|
lineParam.setLineId(lineIds);
|
||||||
|
List<DataIntegrityDto> integrityDS = dataIntegrityFeignClient.getRawData(lineParam).getData();
|
||||||
|
Double max=0.0;
|
||||||
|
if(CollUtil.isNotEmpty(integrityDS)){
|
||||||
|
List<Double> info=new ArrayList<>();
|
||||||
|
for (DataIntegrityDto integrityD : integrityDS) {
|
||||||
|
double realTime = integrityD.getRealTime();
|
||||||
|
double dueTime = integrityD.getDueTime();
|
||||||
|
Double decimal = 0.0;
|
||||||
|
if (dueTime != 0) {
|
||||||
|
decimal = NumberUtil.round(Math.min(realTime / dueTime, 1), 6).doubleValue();
|
||||||
|
}
|
||||||
|
info.add(decimal);
|
||||||
|
}
|
||||||
|
max = info.stream().max(Comparator.naturalOrder()).orElse(0.0);
|
||||||
|
}
|
||||||
|
int v = (int)Math.ceil(InfluxDBPublicParam.DAY_MINUTE * max);
|
||||||
|
onlineRateDpo.setOnlineMin(v);
|
||||||
|
onlineRateDpo.setOfflineMin(InfluxDBPublicParam.DAY_MINUTE - v);
|
||||||
|
list.add(onlineRateDpo);
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
if (CollectionUtil.isNotEmpty(list)) {
|
if (CollectionUtil.isNotEmpty(list)) {
|
||||||
onlineRateFeignClient.batchInsertion(list);
|
onlineRateFeignClient.batchInsertion(list);
|
||||||
|
|||||||
@@ -80,17 +80,16 @@ public class PollutionCalcImpl implements IPollutionCalc {
|
|||||||
LineDevGetDTO line = lineDetailMap.get(id);
|
LineDevGetDTO line = lineDetailMap.get(id);
|
||||||
if (limitMap.containsKey(id)) {
|
if (limitMap.containsKey(id)) {
|
||||||
Overlimit overlimit = limitMap.get(id);
|
Overlimit overlimit = limitMap.get(id);
|
||||||
|
lineParam.setValueType(Arrays.asList(line.getTimeInterval() + ""));
|
||||||
|
lineParam.setLineId(Arrays.asList(id));
|
||||||
|
|
||||||
|
if(!dataVFeignClient.excludeZeroData(lineParam).getData()){
|
||||||
dataPollutionD = new DataPollutionD();
|
dataPollutionD = new DataPollutionD();
|
||||||
dataPollutionD.setLineId(id);
|
dataPollutionD.setLineId(id);
|
||||||
dataPollutionD.setDataDate(LocalDateTimeUtil.parseDate(calculatedParam.getDataDate()));
|
dataPollutionD.setDataDate(LocalDateTimeUtil.parseDate(calculatedParam.getDataDate()));
|
||||||
dataPollutionD.setPollutionType(vHarmonicLimit);
|
dataPollutionD.setPollutionType(vHarmonicLimit);
|
||||||
lineParam.setValueType(Arrays.asList(line.getTimeInterval() + ""));
|
|
||||||
lineParam.setLineId(Arrays.asList(id));
|
|
||||||
|
|
||||||
|
|
||||||
List<DataVDto> dataVDtoList = dataVFeignClient.getGroupByTimeDataV(lineParam).getData();
|
List<DataVDto> dataVDtoList = dataVFeignClient.getGroupByTimeDataV(lineParam).getData();
|
||||||
List<DataHarmDto> dataHarmDtoList = dataHarmRateVFeignClient.getGroupByTimeHarmRateV(lineParam).getData();
|
List<DataHarmDto> dataHarmDtoList = dataHarmRateVFeignClient.getGroupByTimeHarmRateV(lineParam).getData();
|
||||||
if (CollUtil.isNotEmpty(dataVDtoList) && CollUtil.isNotEmpty(dataHarmDtoList)) {
|
|
||||||
//计算谐波电压污染值
|
//计算谐波电压污染值
|
||||||
dataPollutionD.setValue(PubUtils.doubleRound(2, calcVAllPollutionValue(dataVDtoList, dataHarmDtoList, overlimit) * line.getTimeInterval()));
|
dataPollutionD.setValue(PubUtils.doubleRound(2, calcVAllPollutionValue(dataVDtoList, dataHarmDtoList, overlimit) * line.getTimeInterval()));
|
||||||
list.add(dataPollutionD);
|
list.add(dataPollutionD);
|
||||||
@@ -104,9 +103,10 @@ public class PollutionCalcImpl implements IPollutionCalc {
|
|||||||
if (CollUtil.isNotEmpty(data)) {
|
if (CollUtil.isNotEmpty(data)) {
|
||||||
//计算谐波电流污染值
|
//计算谐波电流污染值
|
||||||
dataPollutionD.setValue(PubUtils.doubleRound(2, calcIAllPollutionValue(data, overlimit) * line.getTimeInterval()));
|
dataPollutionD.setValue(PubUtils.doubleRound(2, calcIAllPollutionValue(data, overlimit) * line.getTimeInterval()));
|
||||||
list.add(dataPollutionD);
|
} else {
|
||||||
|
dataPollutionD.setValue(0.0);
|
||||||
}
|
}
|
||||||
|
list.add(dataPollutionD);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -127,10 +127,16 @@ public class PollutionCalcImpl implements IPollutionCalc {
|
|||||||
private double calcVAllPollutionValue(List<DataVDto> dataVDtoList, List<DataHarmDto> dataHarmDtoList, Overlimit overlimit) {
|
private double calcVAllPollutionValue(List<DataVDto> dataVDtoList, List<DataHarmDto> dataHarmDtoList, Overlimit overlimit) {
|
||||||
// 计算时间范围内指标越限百分比
|
// 计算时间范围内指标越限百分比
|
||||||
// 总畸变率的限值
|
// 总畸变率的限值
|
||||||
|
double thdPollutionValue = 0;
|
||||||
|
double harmRateVPollutionValue = 0;
|
||||||
|
if (CollUtil.isNotEmpty(dataVDtoList)) {
|
||||||
List<Double> thdValueList = dataVDtoList.stream().map(DataVDto::getVThd).collect(Collectors.toList());
|
List<Double> thdValueList = dataVDtoList.stream().map(DataVDto::getVThd).collect(Collectors.toList());
|
||||||
double thdPollutionValue = calcPollutionValue(overlimit.getUbalance(), thdValueList);
|
thdPollutionValue = calcPollutionValue(overlimit.getUbalance(), thdValueList);
|
||||||
|
}
|
||||||
|
if (CollUtil.isNotEmpty(dataVDtoList)) {
|
||||||
//谐波值2~50次
|
//谐波值2~50次
|
||||||
double harmRateVPollutionValue = calcHarmRateVPollutionValue(overlimit, dataHarmDtoList);
|
harmRateVPollutionValue = calcHarmRateVPollutionValue(overlimit, dataHarmDtoList);
|
||||||
|
}
|
||||||
return thdPollutionValue + harmRateVPollutionValue;
|
return thdPollutionValue + harmRateVPollutionValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ import com.njcn.event.api.TransientFeignClient;
|
|||||||
import com.njcn.event.file.pojo.dto.WaveDataDTO;
|
import com.njcn.event.file.pojo.dto.WaveDataDTO;
|
||||||
import com.njcn.event.pojo.param.EventCountParam;
|
import com.njcn.event.pojo.param.EventCountParam;
|
||||||
import com.njcn.event.pojo.po.RmpEventDetailPO;
|
import com.njcn.event.pojo.po.RmpEventDetailPO;
|
||||||
import com.njcn.supervision.api.UserLedgerFeignClient;
|
import com.njcn.supervision.api.UserLedgerOldFeignClient;
|
||||||
import com.njcn.supervision.pojo.vo.user.NewUserReportVO;
|
import com.njcn.supervision.pojo.vo.user.NewUserReportVO;
|
||||||
import com.njcn.system.api.DicDataFeignClient;
|
import com.njcn.system.api.DicDataFeignClient;
|
||||||
import com.njcn.system.api.DictTreeFeignClient;
|
import com.njcn.system.api.DictTreeFeignClient;
|
||||||
@@ -84,7 +84,7 @@ public class SpecialAnalysisServiceImpl implements ISpecialAnalysisService {
|
|||||||
@Resource
|
@Resource
|
||||||
private CommLineClient commLineClient;
|
private CommLineClient commLineClient;
|
||||||
@Resource
|
@Resource
|
||||||
private UserLedgerFeignClient userLedgerFeignClient;
|
private UserLedgerOldFeignClient userLedgerFeignClient;
|
||||||
@Resource
|
@Resource
|
||||||
private DataLimitRateDetailFeignClient dataLimitRateDetailFeignClient;
|
private DataLimitRateDetailFeignClient dataLimitRateDetailFeignClient;
|
||||||
|
|
||||||
|
|||||||
@@ -1,9 +1,20 @@
|
|||||||
package com.njcn.algorithm.utils;
|
package com.njcn.algorithm.utils;
|
||||||
|
|
||||||
|
import cn.hutool.core.collection.CollectionUtil;
|
||||||
|
import cn.hutool.core.text.StrPool;
|
||||||
|
import com.njcn.algorithm.pojo.bo.CalculatedParam;
|
||||||
|
import com.yomahub.liteflow.flow.LiteflowResponse;
|
||||||
|
import com.yomahub.liteflow.flow.entity.CmpStep;
|
||||||
import org.apache.commons.lang.SerializationUtils;
|
import org.apache.commons.lang.SerializationUtils;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Objects;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Author: cdf
|
* @Author: cdf
|
||||||
@@ -13,6 +24,8 @@ import java.util.List;
|
|||||||
|
|
||||||
public class MemorySizeUtil {
|
public class MemorySizeUtil {
|
||||||
|
|
||||||
|
private static final Logger logger = LoggerFactory.getLogger(MemorySizeUtil.class);
|
||||||
|
|
||||||
public static double getObjectSize(List<?> list) {
|
public static double getObjectSize(List<?> list) {
|
||||||
byte[] serialized = SerializationUtils.serialize((java.io.Serializable) list);
|
byte[] serialized = SerializationUtils.serialize((java.io.Serializable) list);
|
||||||
return (double)serialized.length/1024/1024;
|
return (double)serialized.length/1024/1024;
|
||||||
@@ -36,5 +49,41 @@ public class MemorySizeUtil {
|
|||||||
System.out.println("已使用的内存: " + usedMemory / (1024 * 1024) + " MB");
|
System.out.println("已使用的内存: " + usedMemory / (1024 * 1024) + " MB");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/***
|
||||||
|
*
|
||||||
|
* @author hongawen
|
||||||
|
* @date 2023/11/7 14:44
|
||||||
|
*/
|
||||||
|
public static void dealResponse(CalculatedParam calculatedParam, LiteflowResponse liteflowResponse, String methodDescribe) {
|
||||||
|
MemorySizeUtil.getNowMemory();
|
||||||
|
if (liteflowResponse.isSuccess()) {
|
||||||
|
// 获取执行步骤列表
|
||||||
|
long allTime = 0;
|
||||||
|
Map<String, List<CmpStep>> executeSteps = liteflowResponse.getExecuteSteps();
|
||||||
|
for (String key : executeSteps.keySet()) {
|
||||||
|
List<CmpStep> cmpSteps = executeSteps.get(key);
|
||||||
|
long timeSum = cmpSteps.stream().mapToLong(CmpStep::getTimeSpent).sum();
|
||||||
|
allTime+=timeSum;
|
||||||
|
}
|
||||||
|
logger.info("日期{},{}执行{}成功,执行总时长{}分钟", calculatedParam.getDataDate(), methodDescribe, calculatedParam.isFullChain() ? "全链" : "指定节点:".concat(String.join(StrPool.COMMA, calculatedParam.getTagNames())),allTime/1000/60);
|
||||||
|
} else {
|
||||||
|
Map<String, List<CmpStep>> executeSteps = liteflowResponse.getExecuteSteps();
|
||||||
|
CmpStep failStep = null;
|
||||||
|
for (String key : executeSteps.keySet()) {
|
||||||
|
List<CmpStep> cmpSteps = executeSteps.get(key);
|
||||||
|
cmpSteps = cmpSteps.stream().filter(cmpStep -> !cmpStep.isSuccess()).collect(Collectors.toList());
|
||||||
|
if (CollectionUtil.isNotEmpty(cmpSteps)) {
|
||||||
|
failStep = cmpSteps.get(0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
logger.error("日期{},{}执行{}失败,在执行{}失败,失败原因:{}"
|
||||||
|
, calculatedParam.getDataDate()
|
||||||
|
, methodDescribe
|
||||||
|
, calculatedParam.isFullChain() ? "全链" : "指定节点:".concat(String.join(StrPool.COMMA, calculatedParam.getTagNames()))
|
||||||
|
, failStep.getNodeId().concat(Objects.isNull(failStep.getTag()) ? "" : StrPool.DASHED.concat(failStep.getTag()))
|
||||||
|
, Objects.isNull(failStep.getException()) ? null : failStep.getException().getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
76
algorithm/algorithm-boot/src/main/resources/bootstrap-jb.yml
Normal file
76
algorithm/algorithm-boot/src/main/resources/bootstrap-jb.yml
Normal file
@@ -0,0 +1,76 @@
|
|||||||
|
#当前服务的基本信息
|
||||||
|
microservice:
|
||||||
|
ename: @artifactId@
|
||||||
|
name: '@name@'
|
||||||
|
version: @version@
|
||||||
|
sentinel:
|
||||||
|
url: @sentinel.url@
|
||||||
|
gateway:
|
||||||
|
url: @gateway.url@
|
||||||
|
server:
|
||||||
|
port: 10401
|
||||||
|
#feign接口开启服务熔断降级处理
|
||||||
|
feign:
|
||||||
|
sentinel:
|
||||||
|
enabled: true
|
||||||
|
compression:
|
||||||
|
request:
|
||||||
|
enabled: true
|
||||||
|
# 配置压缩支持的MIME TYPE
|
||||||
|
mime-types: text/xml,application/xml,application/json
|
||||||
|
# 配置压缩数据大小的下限
|
||||||
|
min-request-size: 1024
|
||||||
|
response:
|
||||||
|
# 配置响应GZIP压缩
|
||||||
|
enabled: true
|
||||||
|
spring:
|
||||||
|
application:
|
||||||
|
name: @artifactId@
|
||||||
|
cloud:
|
||||||
|
nacos:
|
||||||
|
discovery:
|
||||||
|
server-addr: @nacos.url@
|
||||||
|
namespace: @nacos.namespace@
|
||||||
|
config:
|
||||||
|
username: @nacos.username@
|
||||||
|
password: @nacos.password@
|
||||||
|
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
|
||||||
|
|
||||||
|
liteflow:
|
||||||
|
rule-source-ext-data-map:
|
||||||
|
serverAddr: @nacos.url@
|
||||||
|
dataId: prepare_liteflow
|
||||||
|
group: DEFAULT_GROUP
|
||||||
|
namespace: @nacos.namespace@
|
||||||
|
username: @nacos.username@
|
||||||
|
password: @nacos.password@
|
||||||
|
when-max-wait-time: 3600000
|
||||||
|
print-banner: false
|
||||||
|
|
||||||
|
|
||||||
|
#项目日志的配置
|
||||||
|
logging:
|
||||||
|
config: http://@nacos.url@/nacos/v1/cs/configs?tenant=@nacos.namespace@&group=DEFAULT_GROUP&dataId=logback.xml
|
||||||
|
level:
|
||||||
|
root: info
|
||||||
|
com.alibaba.nacos.client: INFO
|
||||||
|
|
||||||
|
|
||||||
|
#mybatis配置信息
|
||||||
|
mybatis-plus:
|
||||||
|
#别名扫描
|
||||||
|
type-aliases-package: com.njcn.harmonic.pojo
|
||||||
|
line:
|
||||||
|
num: 20
|
||||||
|
|
||||||
|
mqtt:
|
||||||
|
client-id: @artifactId@${random.value}
|
||||||
@@ -0,0 +1,79 @@
|
|||||||
|
#当前服务的基本信息
|
||||||
|
microservice:
|
||||||
|
ename: @artifactId@
|
||||||
|
name: '@name@'
|
||||||
|
version: @version@
|
||||||
|
sentinel:
|
||||||
|
url: @sentinel.url@
|
||||||
|
gateway:
|
||||||
|
url: @gateway.url@
|
||||||
|
server:
|
||||||
|
port: 10401
|
||||||
|
#feign接口开启服务熔断降级处理
|
||||||
|
feign:
|
||||||
|
sentinel:
|
||||||
|
enabled: true
|
||||||
|
compression:
|
||||||
|
request:
|
||||||
|
enabled: true
|
||||||
|
# 配置压缩支持的MIME TYPE
|
||||||
|
mime-types: text/xml,application/xml,application/json
|
||||||
|
# 配置压缩数据大小的下限
|
||||||
|
min-request-size: 1024
|
||||||
|
response:
|
||||||
|
# 配置响应GZIP压缩
|
||||||
|
enabled: true
|
||||||
|
spring:
|
||||||
|
application:
|
||||||
|
name: @artifactId@
|
||||||
|
cloud:
|
||||||
|
nacos:
|
||||||
|
discovery:
|
||||||
|
ip: @service.server.url@
|
||||||
|
server-addr: @nacos.url@
|
||||||
|
namespace: @nacos.namespace@
|
||||||
|
username: @nacos.username@
|
||||||
|
password: @nacos.password@
|
||||||
|
config:
|
||||||
|
server-addr: @nacos.url@
|
||||||
|
namespace: @nacos.namespace@
|
||||||
|
username: @nacos.username@
|
||||||
|
password: @nacos.password@
|
||||||
|
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
|
||||||
|
|
||||||
|
liteflow:
|
||||||
|
rule-source-ext-data-map:
|
||||||
|
serverAddr: @nacos.url@
|
||||||
|
dataId: prepare_liteflow
|
||||||
|
group: DEFAULT_GROUP
|
||||||
|
namespace: @nacos.namespace@
|
||||||
|
username: @nacos.username@
|
||||||
|
password: @nacos.password@
|
||||||
|
when-max-wait-time: 3600000
|
||||||
|
print-banner: false
|
||||||
|
|
||||||
|
|
||||||
|
#项目日志的配置
|
||||||
|
logging:
|
||||||
|
#config: http://@nacos.url@/nacos/v1/cs/configs?tenant=@nacos.namespace@&group=DEFAULT_GROUP&dataId=logback.xml
|
||||||
|
level:
|
||||||
|
root: info
|
||||||
|
com.alibaba.nacos.client: INFO
|
||||||
|
|
||||||
|
|
||||||
|
#mybatis配置信息
|
||||||
|
mybatis-plus:
|
||||||
|
#别名扫描
|
||||||
|
type-aliases-package: com.njcn.harmonic.pojo
|
||||||
|
line:
|
||||||
|
num: 20
|
||||||
|
|
||||||
|
#mqtt:
|
||||||
|
# client-id: @artifactId@${random.value}
|
||||||
@@ -1,72 +1,3 @@
|
|||||||
#当前服务的基本信息
|
|
||||||
microservice:
|
|
||||||
ename: @artifactId@
|
|
||||||
name: '@name@'
|
|
||||||
version: @version@
|
|
||||||
sentinel:
|
|
||||||
url: @sentinel.url@
|
|
||||||
gateway:
|
|
||||||
url: @gateway.url@
|
|
||||||
server:
|
|
||||||
port: 10401
|
|
||||||
#feign接口开启服务熔断降级处理
|
|
||||||
feign:
|
|
||||||
sentinel:
|
|
||||||
enabled: true
|
|
||||||
compression:
|
|
||||||
request:
|
|
||||||
enabled: true
|
|
||||||
# 配置压缩支持的MIME TYPE
|
|
||||||
mime-types: text/xml,application/xml,application/json
|
|
||||||
# 配置压缩数据大小的下限
|
|
||||||
min-request-size: 1024
|
|
||||||
response:
|
|
||||||
# 配置响应GZIP压缩
|
|
||||||
enabled: true
|
|
||||||
spring:
|
spring:
|
||||||
application:
|
profiles:
|
||||||
name: @artifactId@
|
active: @spring.profiles.active@
|
||||||
cloud:
|
|
||||||
nacos:
|
|
||||||
discovery:
|
|
||||||
ip: @service.server.url@
|
|
||||||
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
|
|
||||||
|
|
||||||
liteflow:
|
|
||||||
rule-source-ext-data-map:
|
|
||||||
serverAddr: @nacos.url@
|
|
||||||
dataId: prepare_liteflow
|
|
||||||
group: DEFAULT_GROUP
|
|
||||||
namespace: @nacos.namespace@
|
|
||||||
when-max-wait-time: 600000
|
|
||||||
print-banner: false
|
|
||||||
|
|
||||||
|
|
||||||
#项目日志的配置
|
|
||||||
logging:
|
|
||||||
config: http://@nacos.url@/nacos/v1/cs/configs?tenant=@nacos.namespace@&group=DEFAULT_GROUP&dataId=logback.xml
|
|
||||||
level:
|
|
||||||
root:
|
|
||||||
|
|
||||||
|
|
||||||
#mybatis配置信息
|
|
||||||
mybatis-plus:
|
|
||||||
#别名扫描
|
|
||||||
type-aliases-package: com.njcn.harmonic.pojo
|
|
||||||
line:
|
|
||||||
num: 20
|
|
||||||
|
|
||||||
mqtt:
|
|
||||||
client-id: @artifactId@${random.value}
|
|
||||||
@@ -22,16 +22,20 @@ spring:
|
|||||||
ip: @service.server.url@
|
ip: @service.server.url@
|
||||||
server-addr: @nacos.url@
|
server-addr: @nacos.url@
|
||||||
namespace: @nacos.namespace@
|
namespace: @nacos.namespace@
|
||||||
|
username: @nacos.username@
|
||||||
|
password: @nacos.password@
|
||||||
config:
|
config:
|
||||||
server-addr: @nacos.url@
|
server-addr: @nacos.url@
|
||||||
namespace: @nacos.namespace@
|
namespace: @nacos.namespace@
|
||||||
|
username: @nacos.username@
|
||||||
|
password: @nacos.password@
|
||||||
file-extension: yaml
|
file-extension: yaml
|
||||||
shared-configs:
|
shared-configs:
|
||||||
- data-id: share-config.yaml
|
- data-id: share-config.yaml
|
||||||
refresh: true
|
refresh: true
|
||||||
- data-Id: share-config-datasource-db.yaml
|
- data-id: share-config-datasource-db.yaml
|
||||||
refresh: true
|
refresh: true
|
||||||
- data-Id: data-platform.yaml
|
- data-id: data-platform.yaml
|
||||||
refresh: true
|
refresh: true
|
||||||
main:
|
main:
|
||||||
allow-bean-definition-overriding: true
|
allow-bean-definition-overriding: true
|
||||||
@@ -39,7 +43,7 @@ spring:
|
|||||||
|
|
||||||
#项目日志的配置
|
#项目日志的配置
|
||||||
logging:
|
logging:
|
||||||
config: http://@nacos.url@/nacos/v1/cs/configs?tenant=@nacos.namespace@&group=DEFAULT_GROUP&dataId=logback.xml
|
#config: http://@nacos.url@/nacos/v1/cs/configs?tenant=@nacos.namespace@&group=DEFAULT_GROUP&dataId=logback.xml
|
||||||
level:
|
level:
|
||||||
root: info
|
root: info
|
||||||
|
|
||||||
|
|||||||
@@ -59,6 +59,12 @@
|
|||||||
<version>1.0.0</version>
|
<version>1.0.0</version>
|
||||||
<scope>compile</scope>
|
<scope>compile</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.njcn.platform</groupId>
|
||||||
|
<artifactId>algorithm-api</artifactId>
|
||||||
|
<version>1.0.0</version>
|
||||||
|
<scope>compile</scope>
|
||||||
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
</project>
|
</project>
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import com.njcn.common.pojo.response.HttpResult;
|
|||||||
import com.njcn.dataProcess.api.fallback.DataIFeignClientFallbackFactory;
|
import com.njcn.dataProcess.api.fallback.DataIFeignClientFallbackFactory;
|
||||||
import com.njcn.dataProcess.api.fallback.DataRecallFeignClientFallbackFactory;
|
import com.njcn.dataProcess.api.fallback.DataRecallFeignClientFallbackFactory;
|
||||||
import com.njcn.dataProcess.dto.DataIDTO;
|
import com.njcn.dataProcess.dto.DataIDTO;
|
||||||
|
import com.njcn.dataProcess.param.FullRecallMessage;
|
||||||
import com.njcn.dataProcess.param.LineCountEvaluateParam;
|
import com.njcn.dataProcess.param.LineCountEvaluateParam;
|
||||||
import com.njcn.dataProcess.pojo.dto.CommonMinuteDto;
|
import com.njcn.dataProcess.pojo.dto.CommonMinuteDto;
|
||||||
import com.njcn.dataProcess.pojo.dto.DataIDto;
|
import com.njcn.dataProcess.pojo.dto.DataIDto;
|
||||||
@@ -32,4 +33,10 @@ public interface DataRecallFeignClient {
|
|||||||
@ApiOperation("数据补招")
|
@ApiOperation("数据补招")
|
||||||
@ApiImplicitParam(name = "param", value = "参数", required = true)
|
@ApiImplicitParam(name = "param", value = "参数", required = true)
|
||||||
public HttpResult<List<String>> recall(@RequestBody RecallMessage param);
|
public HttpResult<List<String>> recall(@RequestBody RecallMessage param);
|
||||||
|
|
||||||
|
@PostMapping("/fullHourRecall")
|
||||||
|
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||||
|
@ApiOperation("数据全量补招")
|
||||||
|
@ApiImplicitParam(name = "param", value = "参数", required = true)
|
||||||
|
public HttpResult<List<String>> fullHourRecall(@RequestBody FullRecallMessage param);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -68,4 +68,8 @@ public interface DataVFeignClient {
|
|||||||
//按时间分组获取原始数据
|
//按时间分组获取原始数据
|
||||||
@PostMapping("/getGroupByTimeDataV")
|
@PostMapping("/getGroupByTimeDataV")
|
||||||
HttpResult<List<DataVDto>> getGroupByTimeDataV(@RequestBody LineCountEvaluateParam lineParam);
|
HttpResult<List<DataVDto>> getGroupByTimeDataV(@RequestBody LineCountEvaluateParam lineParam);
|
||||||
|
|
||||||
|
|
||||||
|
@PostMapping("/excludeZeroData")
|
||||||
|
HttpResult<Boolean> excludeZeroData(@RequestBody LineCountEvaluateParam lineParam);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,28 @@
|
|||||||
|
package com.njcn.dataProcess.api;
|
||||||
|
|
||||||
|
import com.njcn.common.pojo.constant.ServerInfo;
|
||||||
|
import com.njcn.common.pojo.response.HttpResult;
|
||||||
|
import com.njcn.dataProcess.api.fallback.PqDataVerifyNewFeignClientFallbackFactory;
|
||||||
|
import com.njcn.dataProcess.pojo.po.PqDataVerifyBak;
|
||||||
|
import com.njcn.dataProcess.pojo.po.PqDataVerifyCount;
|
||||||
|
import org.springframework.cloud.openfeign.FeignClient;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author xy
|
||||||
|
* @version 1.0.0
|
||||||
|
* @date 2025年02月13日 20:11
|
||||||
|
*/
|
||||||
|
@FeignClient(value = ServerInfo.PLATFORM_DATA_PROCESSING_BOOT, path = "/pqDataVerifyCount", fallbackFactory = PqDataVerifyNewFeignClientFallbackFactory.class, contextId = "pqDataVerifyNew")
|
||||||
|
public interface PqDataVerifyCountFeignClient {
|
||||||
|
|
||||||
|
@PostMapping("/insertDataBatch")
|
||||||
|
HttpResult<List<String>> insertDataBatch(@RequestBody List<PqDataVerifyCount> list);
|
||||||
|
|
||||||
|
@PostMapping("/insertData")
|
||||||
|
HttpResult<List<String>> insertData(@RequestBody PqDataVerifyCount pqDataVerifyCount);
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,31 @@
|
|||||||
|
package com.njcn.dataProcess.api;
|
||||||
|
|
||||||
|
import com.njcn.algorithm.pojo.bo.CalculatedParam;
|
||||||
|
import com.njcn.common.pojo.constant.ServerInfo;
|
||||||
|
import com.njcn.common.pojo.response.HttpResult;
|
||||||
|
import com.njcn.dataProcess.api.fallback.RMpVThdFeignClientFallbackFactory;
|
||||||
|
import com.njcn.dataProcess.api.fallback.SpThroughFeignClientFallbackFactory;
|
||||||
|
import com.njcn.dataProcess.pojo.dto.RActivePowerRangeDto;
|
||||||
|
import com.njcn.dataProcess.pojo.dto.RMpVThd;
|
||||||
|
import com.njcn.dataProcess.pojo.dto.SpThroughDto;
|
||||||
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
import org.springframework.cloud.openfeign.FeignClient;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author denghuajun
|
||||||
|
* @version 1.0.0
|
||||||
|
* @date 2022年01月05日 15:11
|
||||||
|
*/
|
||||||
|
@FeignClient(value = ServerInfo.PLATFORM_DATA_PROCESSING_BOOT, path = "/rmpvthd", fallbackFactory = RMpVThdFeignClientFallbackFactory.class, contextId = "rmpvthd")
|
||||||
|
public interface RmpVThdFeignClient {
|
||||||
|
|
||||||
|
@PostMapping("/batchInsertionThd")
|
||||||
|
HttpResult<String> batchInsertionThd(@RequestBody List<RMpVThd> result);
|
||||||
|
|
||||||
|
@PostMapping("/batchInsertionPower")
|
||||||
|
HttpResult<List<RMpVThd>> queryThd(@RequestBody CalculatedParam calculatedParam);
|
||||||
|
}
|
||||||
@@ -5,6 +5,7 @@ import com.njcn.common.pojo.exception.BusinessException;
|
|||||||
import com.njcn.common.pojo.response.HttpResult;
|
import com.njcn.common.pojo.response.HttpResult;
|
||||||
import com.njcn.dataProcess.api.DataRecallFeignClient;
|
import com.njcn.dataProcess.api.DataRecallFeignClient;
|
||||||
|
|
||||||
|
import com.njcn.dataProcess.param.FullRecallMessage;
|
||||||
import com.njcn.dataProcess.util.DataProcessingEnumUtil;
|
import com.njcn.dataProcess.util.DataProcessingEnumUtil;
|
||||||
import com.njcn.message.message.RecallMessage;
|
import com.njcn.message.message.RecallMessage;
|
||||||
import feign.hystrix.FallbackFactory;
|
import feign.hystrix.FallbackFactory;
|
||||||
@@ -44,6 +45,12 @@ public class DataRecallFeignClientFallbackFactory implements FallbackFactory<Dat
|
|||||||
log.error("{}异常,降级处理,异常为:{}","补招接口调用异常",cause.toString());
|
log.error("{}异常,降级处理,异常为:{}","补招接口调用异常",cause.toString());
|
||||||
throw new BusinessException(finalExceptionEnum);
|
throw new BusinessException(finalExceptionEnum);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public HttpResult<List<String>> fullHourRecall(FullRecallMessage param) {
|
||||||
|
log.error("{}异常,降级处理,异常为:{}","按小时补招接口调用异常",cause.toString());
|
||||||
|
throw new BusinessException(finalExceptionEnum);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -116,6 +116,12 @@ public class DataVFeignClientFallbackFactory implements FallbackFactory<DataVFei
|
|||||||
log.error("{}异常,降级处理,异常为:{}","DataV按时间分组获取原始数据",cause.toString());
|
log.error("{}异常,降级处理,异常为:{}","DataV按时间分组获取原始数据",cause.toString());
|
||||||
throw new BusinessException(finalExceptionEnum);
|
throw new BusinessException(finalExceptionEnum);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public HttpResult<Boolean> excludeZeroData(LineCountEvaluateParam lineParam) {
|
||||||
|
log.error("{}异常,降级处理,异常为:{}","判断是否存在是零飘数据",cause.toString());
|
||||||
|
throw new BusinessException(finalExceptionEnum);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,54 @@
|
|||||||
|
package com.njcn.dataProcess.api.fallback;
|
||||||
|
|
||||||
|
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
||||||
|
import com.njcn.common.pojo.exception.BusinessException;
|
||||||
|
import com.njcn.common.pojo.response.HttpResult;
|
||||||
|
import com.njcn.dataProcess.api.PqDataVerifyCountFeignClient;
|
||||||
|
import com.njcn.dataProcess.api.PqDataVerifyNewFeignClient;
|
||||||
|
import com.njcn.dataProcess.pojo.po.PqDataVerifyBak;
|
||||||
|
import com.njcn.dataProcess.pojo.po.PqDataVerifyCount;
|
||||||
|
import com.njcn.dataProcess.util.DataProcessingEnumUtil;
|
||||||
|
import feign.hystrix.FallbackFactory;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author xy
|
||||||
|
* @version 1.0.0
|
||||||
|
* @date 2025年02月13日 20:13
|
||||||
|
*/
|
||||||
|
@Slf4j
|
||||||
|
@Component
|
||||||
|
public class PqDataVerifyCountFeignClientFallbackFactory implements FallbackFactory<PqDataVerifyCountFeignClient> {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 输出远程请求接口异常日志
|
||||||
|
* @param cause RPC请求异常
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public PqDataVerifyCountFeignClient create(Throwable cause) {
|
||||||
|
//判断抛出异常是否为解码器抛出的业务异常
|
||||||
|
Enum<?> exceptionEnum = CommonResponseEnum.SERVICE_FALLBACK;
|
||||||
|
if(cause.getCause() instanceof BusinessException){
|
||||||
|
BusinessException businessException = (BusinessException) cause.getCause();
|
||||||
|
exceptionEnum = DataProcessingEnumUtil.getExceptionEnum(businessException.getResult());
|
||||||
|
}
|
||||||
|
Enum<?> finalExceptionEnum = exceptionEnum;
|
||||||
|
return new PqDataVerifyCountFeignClient() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public HttpResult<List<String>> insertDataBatch(List<PqDataVerifyCount> list) {
|
||||||
|
log.error("{}异常,降级处理,异常为:{}","批量存储清洗的异常数据",cause.toString());
|
||||||
|
throw new BusinessException(finalExceptionEnum);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public HttpResult<List<String>> insertData(PqDataVerifyCount pqDataVerifyCount) {
|
||||||
|
log.error("{}异常,降级处理,异常为:{}","单监测点存储清洗的异常数据",cause.toString());
|
||||||
|
throw new BusinessException(finalExceptionEnum);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,58 @@
|
|||||||
|
package com.njcn.dataProcess.api.fallback;
|
||||||
|
|
||||||
|
import com.njcn.algorithm.pojo.bo.CalculatedParam;
|
||||||
|
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
||||||
|
import com.njcn.common.pojo.exception.BusinessException;
|
||||||
|
import com.njcn.common.pojo.response.HttpResult;
|
||||||
|
import com.njcn.dataProcess.api.RmpVThdFeignClient;
|
||||||
|
import com.njcn.dataProcess.api.SpThroughFeignClient;
|
||||||
|
import com.njcn.dataProcess.pojo.dto.RActivePowerRangeDto;
|
||||||
|
import com.njcn.dataProcess.pojo.dto.RMpVThd;
|
||||||
|
import com.njcn.dataProcess.pojo.dto.SpThroughDto;
|
||||||
|
import com.njcn.dataProcess.util.DataProcessingEnumUtil;
|
||||||
|
import feign.hystrix.FallbackFactory;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author denghuajun
|
||||||
|
* @version 1.0.0
|
||||||
|
* @date 2022年01月05日 15:08
|
||||||
|
*/
|
||||||
|
@Slf4j
|
||||||
|
@Component
|
||||||
|
public class RMpVThdFeignClientFallbackFactory implements FallbackFactory<RmpVThdFeignClient> {
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 输出远程请求接口异常日志
|
||||||
|
* @param cause RPC请求异常
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public RmpVThdFeignClient create(Throwable cause) {
|
||||||
|
//判断抛出异常是否为解码器抛出的业务异常
|
||||||
|
Enum<?> exceptionEnum = CommonResponseEnum.SERVICE_FALLBACK;
|
||||||
|
if(cause.getCause() instanceof BusinessException){
|
||||||
|
BusinessException businessException = (BusinessException) cause.getCause();
|
||||||
|
exceptionEnum = DataProcessingEnumUtil.getExceptionEnum(businessException.getResult());
|
||||||
|
}
|
||||||
|
Enum<?> finalExceptionEnum = exceptionEnum;
|
||||||
|
return new RmpVThdFeignClient() {
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public HttpResult<String> batchInsertionThd(List<RMpVThd> result) {
|
||||||
|
log.error("{}异常,降级处理,异常为:{}","畸变率插入",cause.toString());
|
||||||
|
throw new BusinessException(finalExceptionEnum);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public HttpResult<List<RMpVThd>> queryThd(CalculatedParam calculatedParam) {
|
||||||
|
log.error("{}异常,降级处理,异常为:{}","畸变率查询",cause.toString());
|
||||||
|
throw new BusinessException(finalExceptionEnum);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -25,6 +25,11 @@ public class DataCleanJsonDTO {
|
|||||||
@ApiModelProperty("异常数据量")
|
@ApiModelProperty("异常数据量")
|
||||||
private Integer errorCounts;
|
private Integer errorCounts;
|
||||||
|
|
||||||
|
@ApiModelProperty("指标上限")
|
||||||
|
private Double minValue;
|
||||||
|
|
||||||
|
@ApiModelProperty("指标下限")
|
||||||
|
private Double maxValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
|
|||||||
@@ -0,0 +1,23 @@
|
|||||||
|
package com.njcn.dataProcess.dto;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Description:
|
||||||
|
* Date: 2025/08/25 下午 2:42【需求编号】
|
||||||
|
*
|
||||||
|
* @author clam
|
||||||
|
* @version V1.0.0
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
public class RecallReplyDTO {
|
||||||
|
//code 200 完成,500错误;300补招进行中
|
||||||
|
private Integer code;
|
||||||
|
private String message;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -81,8 +81,8 @@ public enum DataCleanEnum {
|
|||||||
V_Data("v_1","相(线)电压基波有效值"),
|
V_Data("v_1","相(线)电压基波有效值"),
|
||||||
|
|
||||||
//r_mp_event_detail
|
//r_mp_event_detail
|
||||||
VoltageDip("Voltage_Dip","相(线)电压基波有效值"),
|
VoltageDip("Voltage_Dip","电压暂降特征幅值"),
|
||||||
VoltageRise("Voltage_Rise","相(线)电压基波有效值");
|
VoltageRise("Voltage_Rise","电压暂升特征幅值");
|
||||||
|
|
||||||
private String code;
|
private String code;
|
||||||
|
|
||||||
|
|||||||
@@ -62,5 +62,7 @@ public class LineCountEvaluateParam extends BaseParam implements Serializable {
|
|||||||
*/
|
*/
|
||||||
private Boolean dataType = true;
|
private Boolean dataType = true;
|
||||||
|
|
||||||
|
//0:通用 1:省级平台 2:物联
|
||||||
|
private Integer type;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -33,6 +33,12 @@ public class DataFlicker {
|
|||||||
@Column(name = "phasic_type",tag = true)
|
@Column(name = "phasic_type",tag = true)
|
||||||
private String phasicType;
|
private String phasicType;
|
||||||
|
|
||||||
|
@Column(name = "cl_did", tag = true)
|
||||||
|
private String cldid;
|
||||||
|
|
||||||
|
@Column(name = "process", tag = true)
|
||||||
|
private String process;
|
||||||
|
|
||||||
@Column(name = "fluc")
|
@Column(name = "fluc")
|
||||||
private Double fluc=0.00;
|
private Double fluc=0.00;
|
||||||
|
|
||||||
|
|||||||
@@ -33,6 +33,12 @@ public class DataFluc {
|
|||||||
@Column(name = "phasic_type",tag = true)
|
@Column(name = "phasic_type",tag = true)
|
||||||
private String phasicType;
|
private String phasicType;
|
||||||
|
|
||||||
|
@Column(name = "cl_did", tag = true)
|
||||||
|
private String cldid;
|
||||||
|
|
||||||
|
@Column(name = "process", tag = true)
|
||||||
|
private String process;
|
||||||
|
|
||||||
@Column(name = "fluc")
|
@Column(name = "fluc")
|
||||||
private Double fluc=0.00;
|
private Double fluc=0.00;
|
||||||
|
|
||||||
|
|||||||
@@ -43,6 +43,12 @@ public class DataHarmphasicI {
|
|||||||
@Column(name = "value_type",tag = true)
|
@Column(name = "value_type",tag = true)
|
||||||
private String valueType;
|
private String valueType;
|
||||||
|
|
||||||
|
@Column(name = "cl_did", tag = true)
|
||||||
|
private String cldid;
|
||||||
|
|
||||||
|
@Column(name = "process", tag = true)
|
||||||
|
private String process;
|
||||||
|
|
||||||
//是否是异常指标数据,0否1是
|
//是否是异常指标数据,0否1是
|
||||||
@Column(name = "abnormal_flag")
|
@Column(name = "abnormal_flag")
|
||||||
private Integer abnormalFlag;
|
private Integer abnormalFlag;
|
||||||
|
|||||||
@@ -44,6 +44,12 @@ public class DataHarmphasicV {
|
|||||||
@Column(name = "value_type",tag = true)
|
@Column(name = "value_type",tag = true)
|
||||||
private String valueType;
|
private String valueType;
|
||||||
|
|
||||||
|
@Column(name = "cl_did", tag = true)
|
||||||
|
private String cldid;
|
||||||
|
|
||||||
|
@Column(name = "process", tag = true)
|
||||||
|
private String process;
|
||||||
|
|
||||||
//是否是异常指标数据,0否1是
|
//是否是异常指标数据,0否1是
|
||||||
@Column(name = "abnormal_flag")
|
@Column(name = "abnormal_flag")
|
||||||
private Integer abnormalFlag;
|
private Integer abnormalFlag;
|
||||||
|
|||||||
@@ -44,6 +44,12 @@ public class DataHarmpowerP {
|
|||||||
@Column(name = "value_type",tag = true)
|
@Column(name = "value_type",tag = true)
|
||||||
private String valueType;
|
private String valueType;
|
||||||
|
|
||||||
|
@Column(name = "cl_did", tag = true)
|
||||||
|
private String cldid;
|
||||||
|
|
||||||
|
@Column(name = "process", tag = true)
|
||||||
|
private String process;
|
||||||
|
|
||||||
//是否是异常指标数据,0否1是
|
//是否是异常指标数据,0否1是
|
||||||
@Column(name = "abnormal_flag")
|
@Column(name = "abnormal_flag")
|
||||||
private Integer abnormalFlag;
|
private Integer abnormalFlag;
|
||||||
@@ -207,6 +213,115 @@ public class DataHarmpowerP {
|
|||||||
@Column(name = "p_50")
|
@Column(name = "p_50")
|
||||||
private Double p50;
|
private Double p50;
|
||||||
|
|
||||||
|
//在线监测添加的字段
|
||||||
|
@Column(name = "totPf")
|
||||||
|
private Double totPf;
|
||||||
|
@Column(name = "totDf")
|
||||||
|
private Double totDf;
|
||||||
|
@Column(name = "totP")
|
||||||
|
private Double totP;
|
||||||
|
@Column(name = "totP1")
|
||||||
|
private Double totP1;
|
||||||
|
@Column(name = "totP2")
|
||||||
|
private Double totP2;
|
||||||
|
@Column(name = "totP3")
|
||||||
|
private Double totP3;
|
||||||
|
@Column(name = "totP4")
|
||||||
|
private Double totP4;
|
||||||
|
@Column(name = "totP5")
|
||||||
|
private Double totP5;
|
||||||
|
@Column(name = "totP6")
|
||||||
|
private Double totP6;
|
||||||
|
@Column(name = "totP7")
|
||||||
|
private Double totP7;
|
||||||
|
@Column(name = "totP8")
|
||||||
|
private Double totP8;
|
||||||
|
@Column(name = "totP9")
|
||||||
|
private Double totP9;
|
||||||
|
@Column(name = "totP10")
|
||||||
|
private Double totP10;
|
||||||
|
@Column(name = "totP11")
|
||||||
|
private Double totP11;
|
||||||
|
@Column(name = "totP12")
|
||||||
|
private Double totP12;
|
||||||
|
@Column(name = "totP13")
|
||||||
|
private Double totP13;
|
||||||
|
@Column(name = "totP14")
|
||||||
|
private Double totP14;
|
||||||
|
@Column(name = "totP15")
|
||||||
|
private Double totP15;
|
||||||
|
@Column(name = "totP16")
|
||||||
|
private Double totP16;
|
||||||
|
@Column(name = "totP17")
|
||||||
|
private Double totP17;
|
||||||
|
@Column(name = "totP18")
|
||||||
|
private Double totP18;
|
||||||
|
@Column(name = "totP19")
|
||||||
|
private Double totP19;
|
||||||
|
@Column(name = "totP20")
|
||||||
|
private Double totP20;
|
||||||
|
@Column(name = "totP21")
|
||||||
|
private Double totP21;
|
||||||
|
@Column(name = "totP22")
|
||||||
|
private Double totP22;
|
||||||
|
@Column(name = "totP23")
|
||||||
|
private Double totP23;
|
||||||
|
@Column(name = "totP24")
|
||||||
|
private Double totP24;
|
||||||
|
@Column(name = "totP25")
|
||||||
|
private Double totP25;
|
||||||
|
@Column(name = "totP26")
|
||||||
|
private Double totP26;
|
||||||
|
@Column(name = "totP27")
|
||||||
|
private Double totP27;
|
||||||
|
@Column(name = "totP28")
|
||||||
|
private Double totP28;
|
||||||
|
@Column(name = "totP29")
|
||||||
|
private Double totP29;
|
||||||
|
@Column(name = "totP30")
|
||||||
|
private Double totP30;
|
||||||
|
@Column(name = "totP31")
|
||||||
|
private Double totP31;
|
||||||
|
@Column(name = "totP32")
|
||||||
|
private Double totP32;
|
||||||
|
@Column(name = "totP33")
|
||||||
|
private Double totP33;
|
||||||
|
@Column(name = "totP34")
|
||||||
|
private Double totP34;
|
||||||
|
@Column(name = "totP35")
|
||||||
|
private Double totP35;
|
||||||
|
@Column(name = "totP36")
|
||||||
|
private Double totP36;
|
||||||
|
@Column(name = "totP37")
|
||||||
|
private Double totP37;
|
||||||
|
@Column(name = "totP38")
|
||||||
|
private Double totP38;
|
||||||
|
@Column(name = "totP39")
|
||||||
|
private Double totP39;
|
||||||
|
@Column(name = "totP40")
|
||||||
|
private Double totP40;
|
||||||
|
@Column(name = "totP41")
|
||||||
|
private Double totP41;
|
||||||
|
@Column(name = "totP42")
|
||||||
|
private Double totP42;
|
||||||
|
@Column(name = "totP43")
|
||||||
|
private Double totP43;
|
||||||
|
@Column(name = "totP44")
|
||||||
|
private Double totP44;
|
||||||
|
@Column(name = "totP45")
|
||||||
|
private Double totP45;
|
||||||
|
@Column(name = "totP46")
|
||||||
|
private Double totP46;
|
||||||
|
@Column(name = "totP47")
|
||||||
|
private Double totP47;
|
||||||
|
@Column(name = "totP49")
|
||||||
|
private Double totP48;
|
||||||
|
@Column(name = "totP49")
|
||||||
|
private Double totP49;
|
||||||
|
@Column(name = "totP50")
|
||||||
|
private Double totP50;
|
||||||
|
|
||||||
|
|
||||||
public static List<DataHarmpowerP> relationToInfluxDB(DataHarmpowerPDTO dataHarmpowerP) {
|
public static List<DataHarmpowerP> relationToInfluxDB(DataHarmpowerPDTO dataHarmpowerP) {
|
||||||
if (dataHarmpowerP == null) {
|
if (dataHarmpowerP == null) {
|
||||||
return null;
|
return null;
|
||||||
|
|||||||
@@ -44,6 +44,12 @@ public class DataHarmpowerQ {
|
|||||||
@Column(name = "value_type",tag = true)
|
@Column(name = "value_type",tag = true)
|
||||||
private String valueType;
|
private String valueType;
|
||||||
|
|
||||||
|
@Column(name = "cl_did", tag = true)
|
||||||
|
private String cldid;
|
||||||
|
|
||||||
|
@Column(name = "process", tag = true)
|
||||||
|
private String process;
|
||||||
|
|
||||||
//是否是异常指标数据,0否1是
|
//是否是异常指标数据,0否1是
|
||||||
@Column(name = "abnormal_flag")
|
@Column(name = "abnormal_flag")
|
||||||
private Integer abnormalFlag;
|
private Integer abnormalFlag;
|
||||||
@@ -201,6 +207,111 @@ public class DataHarmpowerQ {
|
|||||||
@Column(name = "q_50")
|
@Column(name = "q_50")
|
||||||
private Double q50;
|
private Double q50;
|
||||||
|
|
||||||
|
//在线监测添加的字段
|
||||||
|
@Column(name = "totQ")
|
||||||
|
private Double totQ;
|
||||||
|
@Column(name = "totQ1")
|
||||||
|
private Double totQ1;
|
||||||
|
@Column(name = "totQ2")
|
||||||
|
private Double totQ2;
|
||||||
|
@Column(name = "totQ3")
|
||||||
|
private Double totQ3;
|
||||||
|
@Column(name = "totQ4")
|
||||||
|
private Double totQ4;
|
||||||
|
@Column(name = "totQ5")
|
||||||
|
private Double totQ5;
|
||||||
|
@Column(name = "totQ6")
|
||||||
|
private Double totQ6;
|
||||||
|
@Column(name = "totQ7")
|
||||||
|
private Double totQ7;
|
||||||
|
@Column(name = "totQ8")
|
||||||
|
private Double totQ8;
|
||||||
|
@Column(name = "totQ9")
|
||||||
|
private Double totQ9;
|
||||||
|
@Column(name = "totQ10")
|
||||||
|
private Double totQ10;
|
||||||
|
@Column(name = "totQ11")
|
||||||
|
private Double totQ11;
|
||||||
|
@Column(name = "totQ12")
|
||||||
|
private Double totQ12;
|
||||||
|
@Column(name = "totQ13")
|
||||||
|
private Double totQ13;
|
||||||
|
@Column(name = "totQ14")
|
||||||
|
private Double totQ14;
|
||||||
|
@Column(name = "totQ15")
|
||||||
|
private Double totQ15;
|
||||||
|
@Column(name = "totQ16")
|
||||||
|
private Double totQ16;
|
||||||
|
@Column(name = "totQ17")
|
||||||
|
private Double totQ17;
|
||||||
|
@Column(name = "totQ18")
|
||||||
|
private Double totQ18;
|
||||||
|
@Column(name = "totQ19")
|
||||||
|
private Double totQ19;
|
||||||
|
@Column(name = "totQ20")
|
||||||
|
private Double totQ20;
|
||||||
|
@Column(name = "totQ21")
|
||||||
|
private Double totQ21;
|
||||||
|
@Column(name = "totQ22")
|
||||||
|
private Double totQ22;
|
||||||
|
@Column(name = "totQ23")
|
||||||
|
private Double totQ23;
|
||||||
|
@Column(name = "totQ24")
|
||||||
|
private Double totQ24;
|
||||||
|
@Column(name = "totQ25")
|
||||||
|
private Double totQ25;
|
||||||
|
@Column(name = "totQ26")
|
||||||
|
private Double totQ26;
|
||||||
|
@Column(name = "totQ27")
|
||||||
|
private Double totQ27;
|
||||||
|
@Column(name = "totQ28")
|
||||||
|
private Double totQ28;
|
||||||
|
@Column(name = "totQ29")
|
||||||
|
private Double totQ29;
|
||||||
|
@Column(name = "totQ30")
|
||||||
|
private Double totQ30;
|
||||||
|
@Column(name = "totQ31")
|
||||||
|
private Double totQ31;
|
||||||
|
@Column(name = "totQ32")
|
||||||
|
private Double totQ32;
|
||||||
|
@Column(name = "totQ33")
|
||||||
|
private Double totQ33;
|
||||||
|
@Column(name = "totQ34")
|
||||||
|
private Double totQ34;
|
||||||
|
@Column(name = "totQ35")
|
||||||
|
private Double totQ35;
|
||||||
|
@Column(name = "totQ36")
|
||||||
|
private Double totQ36;
|
||||||
|
@Column(name = "totQ37")
|
||||||
|
private Double totQ37;
|
||||||
|
@Column(name = "totQ38")
|
||||||
|
private Double totQ38;
|
||||||
|
@Column(name = "totQ39")
|
||||||
|
private Double totQ39;
|
||||||
|
@Column(name = "totQ40")
|
||||||
|
private Double totQ40;
|
||||||
|
@Column(name = "totQ41")
|
||||||
|
private Double totQ41;
|
||||||
|
@Column(name = "totQ42")
|
||||||
|
private Double totQ42;
|
||||||
|
@Column(name = "totQ43")
|
||||||
|
private Double totQ43;
|
||||||
|
@Column(name = "totQ44")
|
||||||
|
private Double totQ44;
|
||||||
|
@Column(name = "totQ45")
|
||||||
|
private Double totQ45;
|
||||||
|
@Column(name = "totQ46")
|
||||||
|
private Double totQ46;
|
||||||
|
@Column(name = "totQ47")
|
||||||
|
private Double totQ47;
|
||||||
|
@Column(name = "totQ49")
|
||||||
|
private Double totQ48;
|
||||||
|
@Column(name = "totQ49")
|
||||||
|
private Double totQ49;
|
||||||
|
@Column(name = "totQ50")
|
||||||
|
private Double totQ50;
|
||||||
|
|
||||||
|
|
||||||
public static List<DataHarmpowerQ> relationToInfluxDB(DataHarmpowerQDTO dataHarmpowerQ) {
|
public static List<DataHarmpowerQ> relationToInfluxDB(DataHarmpowerQDTO dataHarmpowerQ) {
|
||||||
if (dataHarmpowerQ == null) {
|
if (dataHarmpowerQ == null) {
|
||||||
return null;
|
return null;
|
||||||
|
|||||||
@@ -44,6 +44,12 @@ public class DataHarmpowerS {
|
|||||||
@Column(name = "value_type",tag = true)
|
@Column(name = "value_type",tag = true)
|
||||||
private String valueType;
|
private String valueType;
|
||||||
|
|
||||||
|
@Column(name = "cl_did", tag = true)
|
||||||
|
private String cldid;
|
||||||
|
|
||||||
|
@Column(name = "process", tag = true)
|
||||||
|
private String process;
|
||||||
|
|
||||||
//是否是异常指标数据,0否1是
|
//是否是异常指标数据,0否1是
|
||||||
@Column(name = "abnormal_flag")
|
@Column(name = "abnormal_flag")
|
||||||
private Integer abnormalFlag;
|
private Integer abnormalFlag;
|
||||||
@@ -201,6 +207,111 @@ public class DataHarmpowerS {
|
|||||||
@Column(name = "s_50")
|
@Column(name = "s_50")
|
||||||
private Double s50;
|
private Double s50;
|
||||||
|
|
||||||
|
//在线监测添加的字段
|
||||||
|
@Column(name = "totS")
|
||||||
|
private Double totS;
|
||||||
|
@Column(name = "totS1")
|
||||||
|
private Double totS1;
|
||||||
|
@Column(name = "totS2")
|
||||||
|
private Double totS2;
|
||||||
|
@Column(name = "totS3")
|
||||||
|
private Double totS3;
|
||||||
|
@Column(name = "totS4")
|
||||||
|
private Double totS4;
|
||||||
|
@Column(name = "totS5")
|
||||||
|
private Double totS5;
|
||||||
|
@Column(name = "totS6")
|
||||||
|
private Double totS6;
|
||||||
|
@Column(name = "totS7")
|
||||||
|
private Double totS7;
|
||||||
|
@Column(name = "totS8")
|
||||||
|
private Double totS8;
|
||||||
|
@Column(name = "totS9")
|
||||||
|
private Double totS9;
|
||||||
|
@Column(name = "totS10")
|
||||||
|
private Double totS10;
|
||||||
|
@Column(name = "totS11")
|
||||||
|
private Double totS11;
|
||||||
|
@Column(name = "totS12")
|
||||||
|
private Double totS12;
|
||||||
|
@Column(name = "totS13")
|
||||||
|
private Double totS13;
|
||||||
|
@Column(name = "totS14")
|
||||||
|
private Double totS14;
|
||||||
|
@Column(name = "totS15")
|
||||||
|
private Double totS15;
|
||||||
|
@Column(name = "totS16")
|
||||||
|
private Double totS16;
|
||||||
|
@Column(name = "totS17")
|
||||||
|
private Double totS17;
|
||||||
|
@Column(name = "totS18")
|
||||||
|
private Double totS18;
|
||||||
|
@Column(name = "totS19")
|
||||||
|
private Double totS19;
|
||||||
|
@Column(name = "totS20")
|
||||||
|
private Double totS20;
|
||||||
|
@Column(name = "totS21")
|
||||||
|
private Double totS21;
|
||||||
|
@Column(name = "totS22")
|
||||||
|
private Double totS22;
|
||||||
|
@Column(name = "totS23")
|
||||||
|
private Double totS23;
|
||||||
|
@Column(name = "totS24")
|
||||||
|
private Double totS24;
|
||||||
|
@Column(name = "totS25")
|
||||||
|
private Double totS25;
|
||||||
|
@Column(name = "totS26")
|
||||||
|
private Double totS26;
|
||||||
|
@Column(name = "totS27")
|
||||||
|
private Double totS27;
|
||||||
|
@Column(name = "totS28")
|
||||||
|
private Double totS28;
|
||||||
|
@Column(name = "totS29")
|
||||||
|
private Double totS29;
|
||||||
|
@Column(name = "totS30")
|
||||||
|
private Double totS30;
|
||||||
|
@Column(name = "totS31")
|
||||||
|
private Double totS31;
|
||||||
|
@Column(name = "totS32")
|
||||||
|
private Double totS32;
|
||||||
|
@Column(name = "totS33")
|
||||||
|
private Double totS33;
|
||||||
|
@Column(name = "totS34")
|
||||||
|
private Double totS34;
|
||||||
|
@Column(name = "totS35")
|
||||||
|
private Double totS35;
|
||||||
|
@Column(name = "totS36")
|
||||||
|
private Double totS36;
|
||||||
|
@Column(name = "totS37")
|
||||||
|
private Double totS37;
|
||||||
|
@Column(name = "totS38")
|
||||||
|
private Double totS38;
|
||||||
|
@Column(name = "totS39")
|
||||||
|
private Double totS39;
|
||||||
|
@Column(name = "totS40")
|
||||||
|
private Double totS40;
|
||||||
|
@Column(name = "totS41")
|
||||||
|
private Double totS41;
|
||||||
|
@Column(name = "totS42")
|
||||||
|
private Double totS42;
|
||||||
|
@Column(name = "totS43")
|
||||||
|
private Double totS43;
|
||||||
|
@Column(name = "totS44")
|
||||||
|
private Double totS44;
|
||||||
|
@Column(name = "totS45")
|
||||||
|
private Double totS45;
|
||||||
|
@Column(name = "totS46")
|
||||||
|
private Double totS46;
|
||||||
|
@Column(name = "totS47")
|
||||||
|
private Double totS47;
|
||||||
|
@Column(name = "totS49")
|
||||||
|
private Double totS48;
|
||||||
|
@Column(name = "totS49")
|
||||||
|
private Double totS49;
|
||||||
|
@Column(name = "totS50")
|
||||||
|
private Double totS50;
|
||||||
|
|
||||||
|
|
||||||
public static List<DataHarmpowerS> relationToInfluxDB(DataHarmpowerSDTO dataHarmpowerS) {
|
public static List<DataHarmpowerS> relationToInfluxDB(DataHarmpowerSDTO dataHarmpowerS) {
|
||||||
if (dataHarmpowerS == null) {
|
if (dataHarmpowerS == null) {
|
||||||
return null;
|
return null;
|
||||||
|
|||||||
@@ -43,6 +43,12 @@ public class DataHarmrateI {
|
|||||||
@Column(name = "value_type",tag = true)
|
@Column(name = "value_type",tag = true)
|
||||||
private String valueType;
|
private String valueType;
|
||||||
|
|
||||||
|
@Column(name = "cl_did", tag = true)
|
||||||
|
private String cldid;
|
||||||
|
|
||||||
|
@Column(name = "process", tag = true)
|
||||||
|
private String process;
|
||||||
|
|
||||||
//是否是异常指标数据,0否1是
|
//是否是异常指标数据,0否1是
|
||||||
@Column(name = "abnormal_flag")
|
@Column(name = "abnormal_flag")
|
||||||
private Integer abnormalFlag;
|
private Integer abnormalFlag;
|
||||||
|
|||||||
@@ -43,6 +43,12 @@ public class DataHarmrateV {
|
|||||||
@Column(name = "value_type",tag = true)
|
@Column(name = "value_type",tag = true)
|
||||||
private String valueType;
|
private String valueType;
|
||||||
|
|
||||||
|
@Column(name = "cl_did", tag = true)
|
||||||
|
private String cldid;
|
||||||
|
|
||||||
|
@Column(name = "process", tag = true)
|
||||||
|
private String process;
|
||||||
|
|
||||||
//是否是异常指标数据,0否1是
|
//是否是异常指标数据,0否1是
|
||||||
@Column(name = "abnormal_flag")
|
@Column(name = "abnormal_flag")
|
||||||
private Integer abnormalFlag;
|
private Integer abnormalFlag;
|
||||||
|
|||||||
@@ -44,6 +44,12 @@ public class DataI {
|
|||||||
@Column(name = "value_type",tag = true)
|
@Column(name = "value_type",tag = true)
|
||||||
private String valueType;
|
private String valueType;
|
||||||
|
|
||||||
|
@Column(name = "cl_did", tag = true)
|
||||||
|
private String cldid;
|
||||||
|
|
||||||
|
@Column(name = "process", tag = true)
|
||||||
|
private String process;
|
||||||
|
|
||||||
//是否是异常指标数据,0否1是
|
//是否是异常指标数据,0否1是
|
||||||
@Column(name = "abnormal_flag")
|
@Column(name = "abnormal_flag")
|
||||||
private Integer abnormalFlag;
|
private Integer abnormalFlag;
|
||||||
|
|||||||
@@ -44,6 +44,12 @@ public class DataInharmI {
|
|||||||
@Column(name = "value_type",tag = true)
|
@Column(name = "value_type",tag = true)
|
||||||
private String valueType;
|
private String valueType;
|
||||||
|
|
||||||
|
@Column(name = "cl_did", tag = true)
|
||||||
|
private String cldid;
|
||||||
|
|
||||||
|
@Column(name = "process", tag = true)
|
||||||
|
private String process;
|
||||||
|
|
||||||
//是否是异常指标数据,0否1是
|
//是否是异常指标数据,0否1是
|
||||||
@Column(name = "abnormal_flag")
|
@Column(name = "abnormal_flag")
|
||||||
private Integer abnormalFlag;
|
private Integer abnormalFlag;
|
||||||
|
|||||||
@@ -44,6 +44,12 @@ public class DataInharmV {
|
|||||||
@Column(name = "value_type",tag = true)
|
@Column(name = "value_type",tag = true)
|
||||||
private String valueType;
|
private String valueType;
|
||||||
|
|
||||||
|
@Column(name = "cl_did", tag = true)
|
||||||
|
private String cldid;
|
||||||
|
|
||||||
|
@Column(name = "process", tag = true)
|
||||||
|
private String process;
|
||||||
|
|
||||||
//是否是异常指标数据,0否1是
|
//是否是异常指标数据,0否1是
|
||||||
@Column(name = "abnormal_flag")
|
@Column(name = "abnormal_flag")
|
||||||
private Integer abnormalFlag;
|
private Integer abnormalFlag;
|
||||||
|
|||||||
@@ -34,9 +34,18 @@ public class DataPlt {
|
|||||||
@Column(name = "phasic_type",tag = true)
|
@Column(name = "phasic_type",tag = true)
|
||||||
private String phasicType;
|
private String phasicType;
|
||||||
|
|
||||||
|
@Column(name = "value_type",tag = true)
|
||||||
|
private String valueType;
|
||||||
|
|
||||||
@Column(name = "quality_flag",tag = true)
|
@Column(name = "quality_flag",tag = true)
|
||||||
private String qualityFlag="0";
|
private String qualityFlag="0";
|
||||||
|
|
||||||
|
@Column(name = "cl_did", tag = true)
|
||||||
|
private String cldid;
|
||||||
|
|
||||||
|
@Column(name = "process", tag = true)
|
||||||
|
private String process;
|
||||||
|
|
||||||
//是否是异常指标数据,0否1是
|
//是否是异常指标数据,0否1是
|
||||||
@Column(name = "abnormal_flag")
|
@Column(name = "abnormal_flag")
|
||||||
private Integer abnormalFlag;
|
private Integer abnormalFlag;
|
||||||
|
|||||||
@@ -45,6 +45,13 @@ public class DataV {
|
|||||||
@Column(name = "quality_flag", tag = true)
|
@Column(name = "quality_flag", tag = true)
|
||||||
private String qualityFlag="0";
|
private String qualityFlag="0";
|
||||||
|
|
||||||
|
@Column(name = "cl_did", tag = true)
|
||||||
|
private String cldid;
|
||||||
|
|
||||||
|
@Column(name = "process", tag = true)
|
||||||
|
private String process;
|
||||||
|
|
||||||
|
|
||||||
//是否是异常指标数据,0否1是
|
//是否是异常指标数据,0否1是
|
||||||
@Column(name = "abnormal_flag")
|
@Column(name = "abnormal_flag")
|
||||||
private Integer abnormalFlag;
|
private Integer abnormalFlag;
|
||||||
|
|||||||
@@ -65,6 +65,8 @@ public class AbnormalData {
|
|||||||
@JSONField(ordinal = 4)
|
@JSONField(ordinal = 4)
|
||||||
private String value;
|
private String value;
|
||||||
|
|
||||||
|
@JSONField(ordinal = 5)
|
||||||
|
private float overLimitValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,6 +18,8 @@ public class PqsCommunicateDto {
|
|||||||
private String description;
|
private String description;
|
||||||
|
|
||||||
private Integer type;
|
private Integer type;
|
||||||
|
//是否更新updateTime标志;数据上送更新1,状态翻转不更新0
|
||||||
|
private Integer flag=0;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,62 @@
|
|||||||
|
package com.njcn.dataProcess.pojo.dto;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableField;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import com.github.jeffreyning.mybatisplus.anno.MppMultiId;
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.time.LocalDate;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* Description:
|
||||||
|
* 接口文档访问地址:http://serverIP:port/swagger-ui.html
|
||||||
|
* Date: 2022/10/10 19:59【需求编号】
|
||||||
|
*
|
||||||
|
* @author clam
|
||||||
|
* @version V1.0.0
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 谐波畸变率排名
|
||||||
|
*/
|
||||||
|
@ApiModel(value="com-njcn-harmonic-pojo-po-RMpVThd")
|
||||||
|
@Data
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
|
@TableName(value = "r_mp_v_thd")
|
||||||
|
public class RMpVThd implements Serializable {
|
||||||
|
/**
|
||||||
|
* 监测点ID
|
||||||
|
*/
|
||||||
|
@TableField(value = "measurement_point_id")
|
||||||
|
@MppMultiId
|
||||||
|
private String measurementPointId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 排名类型,字典表(1年 2季度 3月份 4周 5日)
|
||||||
|
*/
|
||||||
|
@TableField(value = "data_type")
|
||||||
|
@MppMultiId
|
||||||
|
private String dataType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 时间
|
||||||
|
*/
|
||||||
|
@TableField(value = "data_date")
|
||||||
|
@MppMultiId
|
||||||
|
private LocalDate dataDate;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 谐波畸变率
|
||||||
|
*/
|
||||||
|
@TableField(value = "v_thd")
|
||||||
|
private Double vThd;
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
}
|
||||||
@@ -53,126 +53,277 @@ public class PqDataVerifyBak implements Serializable {
|
|||||||
@TableField(value = "freq")
|
@TableField(value = "freq")
|
||||||
private Integer freq = 0;
|
private Integer freq = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 频率异常时间
|
||||||
|
*/
|
||||||
|
@TableField(value = "freq_time")
|
||||||
|
private Integer freqTime = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 频率偏差指标
|
* 频率偏差指标
|
||||||
*/
|
*/
|
||||||
@TableField(value = "freq_dev")
|
@TableField(value = "freq_dev")
|
||||||
private Integer freqDev = 0;
|
private Integer freqDev = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 频率偏差异常时间
|
||||||
|
*/
|
||||||
|
@TableField(value = "freq_dev_time")
|
||||||
|
private Integer freqDevTime = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 相电压有效值
|
* 相电压有效值
|
||||||
*/
|
*/
|
||||||
@TableField(value = "v_rms")
|
@TableField(value = "v_rms")
|
||||||
private Integer vRms = 0;
|
private Integer vRms = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 相电压有效值异常时间
|
||||||
|
*/
|
||||||
|
@TableField(value = "v_rms_time")
|
||||||
|
private Integer vRmsTime = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 正序电压
|
* 正序电压
|
||||||
*/
|
*/
|
||||||
@TableField(value = "v_pos")
|
@TableField(value = "v_pos")
|
||||||
private Integer vPos = 0;
|
private Integer vPos = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 正序电压异常时间
|
||||||
|
*/
|
||||||
|
@TableField(value = "v_pos_time")
|
||||||
|
private Integer vPosTime = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 负序电压
|
* 负序电压
|
||||||
*/
|
*/
|
||||||
@TableField(value = "v_neg")
|
@TableField(value = "v_neg")
|
||||||
private Integer vNeg = 0;
|
private Integer vNeg = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 负序电压异常时间
|
||||||
|
*/
|
||||||
|
@TableField(value = "v_neg_time")
|
||||||
|
private Integer vNegTime = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 零序电压
|
* 零序电压
|
||||||
*/
|
*/
|
||||||
@TableField(value = "v_zero")
|
@TableField(value = "v_zero")
|
||||||
private Integer vZero = 0;
|
private Integer vZero = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 零序电压异常时间
|
||||||
|
*/
|
||||||
|
@TableField(value = "v_zero_time")
|
||||||
|
private Integer vZeroTime = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 电压不平衡度
|
* 电压不平衡度
|
||||||
*/
|
*/
|
||||||
@TableField(value = "v_unbalance")
|
@TableField(value = "v_unbalance")
|
||||||
private Integer vUnbalance = 0;
|
private Integer vUnbalance = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 电压不平衡度异常时间
|
||||||
|
*/
|
||||||
|
@TableField(value = "v_unbalance_time")
|
||||||
|
private Integer vUnbalanceTime = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 线电压有效值
|
* 线电压有效值
|
||||||
*/
|
*/
|
||||||
@TableField(value = "rms_lvr")
|
@TableField(value = "rms_lvr")
|
||||||
private Integer rmsLvr = 0;
|
private Integer rmsLvr = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 线电压有效值异常时间
|
||||||
|
*/
|
||||||
|
@TableField(value = "rms_lvr_time")
|
||||||
|
private Integer rmsLvrTime = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 电压正偏差
|
* 电压正偏差
|
||||||
*/
|
*/
|
||||||
@TableField(value = "vu_dev")
|
@TableField(value = "vu_dev")
|
||||||
private Integer vuDev = 0;
|
private Integer vuDev = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 电压正偏差异常时间
|
||||||
|
*/
|
||||||
|
@TableField(value = "vu_dev_time")
|
||||||
|
private Integer vuDevTime = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 电压负偏差
|
* 电压负偏差
|
||||||
*/
|
*/
|
||||||
@TableField(value = "vl_Dev")
|
@TableField(value = "vl_Dev")
|
||||||
private Integer vlDev = 0;
|
private Integer vlDev = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 电压负偏差异常时间
|
||||||
|
*/
|
||||||
|
@TableField(value = "vl_Dev_time")
|
||||||
|
private Integer vlDevTime = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 电压总谐波畸变率
|
* 电压总谐波畸变率
|
||||||
*/
|
*/
|
||||||
@TableField(value = "v_thd")
|
@TableField(value = "v_thd")
|
||||||
private Integer vThd = 0;
|
private Integer vThd = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 电压总谐波畸变率异常时间
|
||||||
|
*/
|
||||||
|
@TableField(value = "v_thd_time")
|
||||||
|
private Integer vThdTime = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 相电压基波有效值
|
* 相电压基波有效值
|
||||||
*/
|
*/
|
||||||
@TableField(value = "v")
|
@TableField(value = "v")
|
||||||
private Integer v = 0;
|
private Integer v = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 相电压基波有效值异常时间
|
||||||
|
*/
|
||||||
|
@TableField(value = "v_time")
|
||||||
|
private Integer vTime = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 电流有效值
|
* 电流有效值
|
||||||
*/
|
*/
|
||||||
@TableField(value = "i_rms")
|
@TableField(value = "i_rms")
|
||||||
private Integer iRms = 0;
|
private Integer iRms = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 电流有效值异常时间
|
||||||
|
*/
|
||||||
|
@TableField(value = "i_rms_time")
|
||||||
|
private Integer iRmsTime = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 长时闪变
|
* 长时闪变
|
||||||
*/
|
*/
|
||||||
@TableField(value = "plt")
|
@TableField(value = "plt")
|
||||||
private Integer plt = 0;
|
private Integer plt = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 长时闪变异常时间
|
||||||
|
*/
|
||||||
|
@TableField(value = "plt_time")
|
||||||
|
private Integer pltTime = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 间谐波电压含有率
|
* 间谐波电压含有率
|
||||||
*/
|
*/
|
||||||
@TableField(value = "v_inharm")
|
@TableField(value = "v_inharm")
|
||||||
private Integer vInharm = 0;
|
private Integer vInharm = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 间谐波电压含有率异常时间
|
||||||
|
*/
|
||||||
|
@TableField(value = "v_Inharm_time")
|
||||||
|
private Integer vInharmTime = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 谐波电压含有率
|
* 谐波电压含有率
|
||||||
*/
|
*/
|
||||||
@TableField(value = "v_harm")
|
@TableField(value = "v_harm")
|
||||||
private Integer vHarm = 0;
|
private Integer vHarm = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 谐波电压含有率异常时间
|
||||||
|
*/
|
||||||
|
@TableField(value = "v_harm_time")
|
||||||
|
private Integer vHarmTime = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 功率因数
|
* 功率因数
|
||||||
*/
|
*/
|
||||||
@TableField(value = "pf")
|
@TableField(value = "pf")
|
||||||
private Integer pf = 0;
|
private Integer pf = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 功率因数异常时间
|
||||||
|
*/
|
||||||
|
@TableField(value = "pf_time")
|
||||||
|
private Integer pfTime = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 谐波电压相角
|
* 谐波电压相角
|
||||||
*/
|
*/
|
||||||
@TableField(value = "v_phasic")
|
@TableField(value = "v_phasic")
|
||||||
private Integer vPhasic = 0;
|
private Integer vPhasic = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 谐波电压相角异常时间
|
||||||
|
*/
|
||||||
|
@TableField(value = "v_phasic_time")
|
||||||
|
private Integer vPhasicTime = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 谐波电压基波相角
|
* 谐波电压基波相角
|
||||||
*/
|
*/
|
||||||
@TableField(value = "v1_phasic")
|
@TableField(value = "v1_phasic")
|
||||||
private Integer v1Phasic = 0;
|
private Integer v1Phasic = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 谐波电压基波相角异常时间
|
||||||
|
*/
|
||||||
|
@TableField(value = "v1_phasic_time")
|
||||||
|
private Integer v1PhasicTime = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 电压波动
|
* 电压波动
|
||||||
*/
|
*/
|
||||||
@TableField(value = "fluc")
|
@TableField(value = "fluc")
|
||||||
private Integer fluc = 0;
|
private Integer fluc = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 电压波动异常时间
|
||||||
|
*/
|
||||||
|
@TableField(value = "fluc_time")
|
||||||
|
private Integer flucTime = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 短时闪变
|
* 短时闪变
|
||||||
*/
|
*/
|
||||||
@TableField(value = "pst")
|
@TableField(value = "pst")
|
||||||
private Integer pst = 0;
|
private Integer pst = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 短时闪变异常时间
|
||||||
|
*/
|
||||||
|
@TableField(value = "pst_time")
|
||||||
|
private Integer pstTime = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 电压暂降(0:正常 1:异常)
|
||||||
|
*/
|
||||||
|
@TableField(value = "dip")
|
||||||
|
private Integer dip = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 电压暂降异常时间
|
||||||
|
*/
|
||||||
|
@TableField(value = "dip_time")
|
||||||
|
private Integer dipTime = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 电压暂升(0:正常 1:异常)
|
||||||
|
*/
|
||||||
|
@TableField(value = "rise")
|
||||||
|
private Integer rise = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 电压暂升异常时间
|
||||||
|
*/
|
||||||
|
@TableField(value = "rise_time")
|
||||||
|
private Integer riseTime = 0;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 文件路径
|
* 文件路径
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -0,0 +1,56 @@
|
|||||||
|
package com.njcn.dataProcess.pojo.po;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableField;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
|
import com.github.jeffreyning.mybatisplus.anno.MppMultiId;
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.Setter;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.time.LocalDate;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
*
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author xy
|
||||||
|
* @since 2025-02-17
|
||||||
|
*/
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
@TableName("pq_data_verify_count")
|
||||||
|
public class PqDataVerifyCount implements Serializable {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 监测点id
|
||||||
|
*/
|
||||||
|
@MppMultiId
|
||||||
|
@TableField(value = "line_id")
|
||||||
|
private String lineId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 数据时间
|
||||||
|
*/
|
||||||
|
@MppMultiId
|
||||||
|
@TableField(value = "time_id")
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
|
||||||
|
private LocalDate time;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 异常指标数量
|
||||||
|
*/
|
||||||
|
@TableField(value = "total")
|
||||||
|
private Integer total = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 总指标数量
|
||||||
|
*/
|
||||||
|
@TableField(value = "total_all")
|
||||||
|
private Integer totalAll = 0;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -16,6 +16,7 @@ import java.time.format.DateTimeFormatter;
|
|||||||
public class TimeUtils {
|
public class TimeUtils {
|
||||||
|
|
||||||
private static final DateTimeFormatter DATE_TIME_FORMATTER = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
|
private static final DateTimeFormatter DATE_TIME_FORMATTER = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
|
||||||
|
private static final DateTimeFormatter DATE_TIME_FORMATTER_SSS = DateTimeFormatter.ofPattern(DatePattern.NORM_DATETIME_MS_PATTERN);
|
||||||
private static final DateTimeFormatter DATE_FORMATTER = DateTimeFormatter.ofPattern("yyyy-MM-dd");
|
private static final DateTimeFormatter DATE_FORMATTER = DateTimeFormatter.ofPattern("yyyy-MM-dd");
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -37,6 +38,10 @@ public class TimeUtils {
|
|||||||
return LocalDateTime.parse(time, DATE_TIME_FORMATTER);
|
return LocalDateTime.parse(time, DATE_TIME_FORMATTER);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static LocalDateTime StringToLocalDateTimeSSS(String time) {
|
||||||
|
return LocalDateTime.parse(time, DATE_TIME_FORMATTER_SSS);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* LocalDataTime类型的yyyy-MM-dd HH:mm:ss转成String yyyy-MM-dd HH:mm:ss
|
* LocalDataTime类型的yyyy-MM-dd HH:mm:ss转成String yyyy-MM-dd HH:mm:ss
|
||||||
* @param time
|
* @param time
|
||||||
|
|||||||
@@ -73,12 +73,28 @@
|
|||||||
</exclusion>
|
</exclusion>
|
||||||
</exclusions>
|
</exclusions>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.njcn</groupId>
|
||||||
|
<artifactId>cs-device-api</artifactId>
|
||||||
|
<version>${project.version}</version>
|
||||||
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.njcn.platform</groupId>
|
<groupId>com.njcn.platform</groupId>
|
||||||
<artifactId>stat-api</artifactId>
|
<artifactId>stat-api</artifactId>
|
||||||
<version>1.0.0</version>
|
<version>1.0.0</version>
|
||||||
<scope>compile</scope>
|
<scope>compile</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-websocket</artifactId>
|
||||||
|
<version>2.7.12</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.njcn.platform</groupId>
|
||||||
|
<artifactId>algorithm-api</artifactId>
|
||||||
|
<version>1.0.0</version>
|
||||||
|
<scope>compile</scope>
|
||||||
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
<build>
|
<build>
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package com.njcn.dataProcess.controller;//package com.njcn.message.websocket;
|
package com.njcn.dataProcess.controller;//package com.njcn.message.websocket;
|
||||||
|
|
||||||
|
import cn.hutool.core.collection.CollUtil;
|
||||||
import cn.hutool.core.date.DatePattern;
|
import cn.hutool.core.date.DatePattern;
|
||||||
import cn.hutool.core.date.LocalDateTimeUtil;
|
import cn.hutool.core.date.LocalDateTimeUtil;
|
||||||
import cn.hutool.core.util.IdUtil;
|
import cn.hutool.core.util.IdUtil;
|
||||||
@@ -10,8 +11,12 @@ import com.njcn.common.pojo.exception.BusinessException;
|
|||||||
import com.njcn.common.pojo.response.HttpResult;
|
import com.njcn.common.pojo.response.HttpResult;
|
||||||
import com.njcn.common.utils.HttpResultUtil;
|
import com.njcn.common.utils.HttpResultUtil;
|
||||||
|
|
||||||
|
import com.njcn.dataProcess.annotation.InsertBean;
|
||||||
import com.njcn.dataProcess.annotation.QueryBean;
|
import com.njcn.dataProcess.annotation.QueryBean;
|
||||||
import com.njcn.dataProcess.param.FullRecallMessage;
|
import com.njcn.dataProcess.param.FullRecallMessage;
|
||||||
|
import com.njcn.dataProcess.param.LineCountEvaluateParam;
|
||||||
|
import com.njcn.dataProcess.pojo.dto.DataIntegrityDto;
|
||||||
|
import com.njcn.dataProcess.service.IDataIntegrity;
|
||||||
import com.njcn.dataProcess.service.IDataV;
|
import com.njcn.dataProcess.service.IDataV;
|
||||||
import com.njcn.device.biz.commApi.CommTerminalGeneralClient;
|
import com.njcn.device.biz.commApi.CommTerminalGeneralClient;
|
||||||
import com.njcn.device.biz.pojo.dto.LineDevGetDTO;
|
import com.njcn.device.biz.pojo.dto.LineDevGetDTO;
|
||||||
@@ -57,13 +62,14 @@ public class DataRecallController extends BaseController {
|
|||||||
private final ProduceFeignClient produceFeignClient;
|
private final ProduceFeignClient produceFeignClient;
|
||||||
private final DeviceFeignClient deviceFeignClient;
|
private final DeviceFeignClient deviceFeignClient;
|
||||||
|
|
||||||
|
@InsertBean
|
||||||
|
private IDataIntegrity iDataIntegrityInsert;
|
||||||
//页面补招按时间段带小时的全部补招不查datav数据去筛选
|
//页面补招按时间段带小时的全部补招不查datav数据去筛选
|
||||||
@PostMapping("/FullRecall")
|
@PostMapping("/FullRecall")
|
||||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||||
@ApiOperation("数据全量补招")
|
@ApiOperation("数据全量补招")
|
||||||
@ApiImplicitParam(name = "param", value = "参数", required = true)
|
@ApiImplicitParam(name = "param", value = "参数", required = true)
|
||||||
public HttpResult<List<String>> recall(@RequestBody FullRecallMessage param) {
|
public HttpResult<List<String>> FullRecall(@RequestBody FullRecallMessage param) {
|
||||||
String methodDescribe = getMethodDescribe("recall");
|
String methodDescribe = getMethodDescribe("recall");
|
||||||
List<String> guidList = new ArrayList<>();
|
List<String> guidList = new ArrayList<>();
|
||||||
List<String> runMonitorIds = new ArrayList<>();
|
List<String> runMonitorIds = new ArrayList<>();
|
||||||
@@ -80,17 +86,186 @@ public class DataRecallController extends BaseController {
|
|||||||
}else {
|
}else {
|
||||||
runMonitorIds = param.getMonitorId();
|
runMonitorIds = param.getMonitorId();
|
||||||
}
|
}
|
||||||
|
LineCountEvaluateParam lineParam = new LineCountEvaluateParam();
|
||||||
|
lineParam.setLineId(runMonitorIds);
|
||||||
|
//查看监测点的数据完整性
|
||||||
|
lineParam.setStartTime( LocalDateTimeUtil.format( param.getReCallStartTime(), DatePattern.NORM_DATETIME_FORMATTER));
|
||||||
|
lineParam.setEndTime(LocalDateTimeUtil.format( param.getReCallEndTime(), DatePattern.NORM_DATETIME_FORMATTER));
|
||||||
|
List<DataIntegrityDto> rawData = iDataIntegrityInsert.getRawData(lineParam);
|
||||||
|
Map<String, Map<String, List<DataIntegrityDto>>> collect1 = rawData.stream().collect(Collectors.groupingBy(DataIntegrityDto::getLineIndex, Collectors.groupingBy(DataIntegrityDto::getTimeId)));
|
||||||
|
|
||||||
runMonitorIds.forEach(temp->{
|
runMonitorIds.forEach(temp->{
|
||||||
LineDevGetDTO data = commTerminalGeneralClient.getMonitorDetail(temp).getData();
|
LineDevGetDTO data = commTerminalGeneralClient.getMonitorDetail(temp).getData();
|
||||||
//后续根据不同前置下的测点发送补招密令
|
//后续根据不同前置下的测点发送补招密令
|
||||||
DeviceDTO data2 = deviceFeignClient.getDeviceInfo(data.getDevId()).getData();
|
DeviceDTO data2 = deviceFeignClient.getDeviceInfo(data.getDevId()).getData();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
LocalDateTime currentDate = param.getReCallStartTime();
|
||||||
|
//循环每一天
|
||||||
|
while (!currentDate.isAfter(param.getReCallEndTime())) {
|
||||||
|
|
||||||
|
|
||||||
|
LocalDateTime tempTime = currentDate.toLocalDate().plusDays(1).atTime(0,0,0);
|
||||||
|
//查看数据完整性,根据数据完整性进行补招;
|
||||||
|
//校验数据完整性完整率>=98%不补招完整率80%~98%,差量补招,完整率<=80%,全量补招
|
||||||
|
Integer recallType = 1; //1全量补 2:差量补 3:不需要补招
|
||||||
|
String curDateString = LocalDateTimeUtil.format(currentDate.toLocalDate().atTime(0, 0, 0), DatePattern.NORM_DATETIME_FORMATTER);
|
||||||
|
if(collect1.containsKey(temp)&&collect1.get(temp).containsKey(curDateString)){
|
||||||
|
DataIntegrityDto dto = collect1.get(temp).get(curDateString).get(0);
|
||||||
|
if( dto.getDueTime()!=0){
|
||||||
|
double i =(double)dto.getRealTime() / dto.getDueTime();
|
||||||
|
if( i>=0.98){
|
||||||
|
recallType=3;
|
||||||
|
} else if(i<0.98&&i>0.8){
|
||||||
|
recallType=2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
if(recallType ==3){
|
||||||
|
currentDate = tempTime;
|
||||||
|
continue;
|
||||||
|
}else if(recallType ==2){
|
||||||
|
Integer timeInterval = data.getTimeInterval();
|
||||||
|
List<LocalDateTime> localDateTimeList = generateTimeIntervals( currentDate.toLocalDate(), timeInterval);
|
||||||
|
List<LocalDateTime> data1 = dataVQuery.monitoringTime(temp, LocalDateTimeUtil.format( currentDate.toLocalDate(), DatePattern.NORM_DATE_PATTERN));
|
||||||
|
localDateTimeList.removeAll(data1);
|
||||||
|
if(!CollectionUtils.isEmpty(localDateTimeList)){
|
||||||
|
List<String> timePeriod = mergeTimeIntervals(localDateTimeList, timeInterval);
|
||||||
|
//最大时间段为300
|
||||||
|
if(timePeriod.size()<300){
|
||||||
|
RecallMessage.RecallDTO recallDTO = new RecallMessage.RecallDTO();
|
||||||
|
recallDTO.setDataType("");
|
||||||
|
recallDTO.setMonitorId(Stream.of(temp).collect(Collectors.toList()));
|
||||||
|
recallDTO.setTimeInterval(timePeriod);
|
||||||
|
recallDTO.setNodeId(data2.getNodeId());
|
||||||
|
recallDTOList.add(recallDTO);
|
||||||
|
}else {
|
||||||
|
List<List<String>> timePeriods = CollUtil.split(timePeriod, 300);
|
||||||
|
timePeriods.forEach(period->{
|
||||||
|
RecallMessage.RecallDTO recallDTO = new RecallMessage.RecallDTO();
|
||||||
|
recallDTO.setDataType("");
|
||||||
|
recallDTO.setMonitorId(Stream.of(temp).collect(Collectors.toList()));
|
||||||
|
recallDTO.setTimeInterval(period);
|
||||||
|
recallDTO.setNodeId(data2.getNodeId());
|
||||||
|
recallDTOList.add(recallDTO);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}else {
|
||||||
//暂态补招
|
//暂态补招
|
||||||
RecallMessage.RecallDTO recallDTO = new RecallMessage.RecallDTO();
|
RecallMessage.RecallDTO recallDTO = new RecallMessage.RecallDTO();
|
||||||
//不设置dataType暂态稳态全部补招
|
//不设置dataType暂态稳态全部补招
|
||||||
recallDTO.setDataType("");
|
recallDTO.setDataType("");
|
||||||
recallDTO.setMonitorId(Stream.of(temp).collect(Collectors.toList()));
|
recallDTO.setMonitorId(Stream.of(temp).collect(Collectors.toList()));
|
||||||
|
if(tempTime.isAfter(param.getReCallEndTime())){
|
||||||
|
String eventTime = formatInterval(currentDate,param.getReCallEndTime());
|
||||||
|
recallDTO.setTimeInterval(Stream.of(eventTime).collect(Collectors.toList()));
|
||||||
|
recallDTO.setNodeId(data2.getNodeId());
|
||||||
|
recallDTOList.add(recallDTO);
|
||||||
|
}else {
|
||||||
|
String eventTime = formatInterval(currentDate,tempTime);
|
||||||
|
recallDTO.setTimeInterval(Stream.of(eventTime).collect(Collectors.toList()));
|
||||||
|
recallDTO.setNodeId(data2.getNodeId());
|
||||||
|
recallDTOList.add(recallDTO);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
currentDate = tempTime;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
});
|
||||||
|
if(!CollectionUtils.isEmpty(recallDTOList)){
|
||||||
|
Map<String, List<RecallMessage.RecallDTO>> collect = recallDTOList.stream().collect(Collectors.groupingBy(RecallMessage.RecallDTO::getNodeId));
|
||||||
|
|
||||||
|
collect.forEach((k,v)->{
|
||||||
|
RecallMessage message = new RecallMessage();
|
||||||
|
message.setNodeId(k);
|
||||||
|
message.setData(v);
|
||||||
|
String guid = IdUtil.simpleUUID();
|
||||||
|
message.setGuid(guid);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
produceFeignClient.recall(message);
|
||||||
|
guidList.add(guid);
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, guidList, methodDescribe);
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping("/fullHourRecall")
|
||||||
|
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||||
|
@ApiOperation("按小时数据补招")
|
||||||
|
@ApiImplicitParam(name = "param", value = "参数", required = true)
|
||||||
|
public HttpResult<List<String>> fullHourRecall(@RequestBody FullRecallMessage param){
|
||||||
|
String methodDescribe = getMethodDescribe("recall");
|
||||||
|
List<String> guidList = new ArrayList<>();
|
||||||
|
List<String> runMonitorIds = new ArrayList<>();
|
||||||
|
List<RecallMessage.RecallDTO> recallDTOList = new ArrayList<>();
|
||||||
|
// Duration duration = Duration.between(param.getReCallStartTime(), param.getReCallEndTime());
|
||||||
|
// // 获取剩余的分钟数,如果要精确到分钟可以这样做
|
||||||
|
// long minutes = duration.toMinutes() ;
|
||||||
|
// if(minutes>60){
|
||||||
|
// throw new BusinessException("全量补招时间区间不能超过一个小时");
|
||||||
|
//
|
||||||
|
// }
|
||||||
|
if(CollectionUtils.isEmpty(param.getMonitorId())){
|
||||||
|
runMonitorIds = commTerminalGeneralClient.getRunMonitorIds().getData();
|
||||||
|
}else {
|
||||||
|
runMonitorIds = param.getMonitorId();
|
||||||
|
}
|
||||||
|
|
||||||
|
runMonitorIds.forEach(temp->{
|
||||||
|
LineDevGetDTO data = commTerminalGeneralClient.getMonitorDetail(temp).getData();
|
||||||
|
//后续根据不同前置下的测点发送补招密令
|
||||||
|
DeviceDTO data2 = deviceFeignClient.getDeviceInfo(data.getDevId()).getData();
|
||||||
|
Integer timeInterval = data.getTimeInterval();
|
||||||
|
|
||||||
|
List<LocalDateTime> localDateTimeList = generateTimeIntervals(param.getReCallStartTime(),param.getReCallEndTime(), timeInterval);
|
||||||
|
List<LocalDateTime> data1 = dataVQuery.monitoringTime(temp, LocalDateTimeUtil.format(param.getReCallStartTime().toLocalDate(), DatePattern.NORM_DATE_PATTERN));
|
||||||
|
List<LocalDateTime> tempTime = data1.stream().filter(dateTime -> (!dateTime.isAfter(param.getReCallEndTime())) &&
|
||||||
|
(!dateTime.isBefore(param.getReCallStartTime()))).collect(Collectors.toList());
|
||||||
|
localDateTimeList.removeAll(tempTime);
|
||||||
|
if(!CollectionUtils.isEmpty(localDateTimeList)){
|
||||||
|
List<String> timePeriod = mergeTimeIntervals(localDateTimeList, timeInterval);
|
||||||
|
//最大时间段为300
|
||||||
|
if(timePeriod.size()<300){
|
||||||
|
RecallMessage.RecallDTO recallDTO = new RecallMessage.RecallDTO();
|
||||||
|
recallDTO.setDataType("0");
|
||||||
|
recallDTO.setMonitorId(Stream.of(temp).collect(Collectors.toList()));
|
||||||
|
recallDTO.setTimeInterval(timePeriod);
|
||||||
|
recallDTO.setNodeId(data2.getNodeId());
|
||||||
|
recallDTOList.add(recallDTO);
|
||||||
|
}else {
|
||||||
|
List<List<String>> timePeriods = CollUtil.split(timePeriod, 300);
|
||||||
|
timePeriods.forEach(period->{
|
||||||
|
RecallMessage.RecallDTO recallDTO = new RecallMessage.RecallDTO();
|
||||||
|
recallDTO.setDataType("0");
|
||||||
|
recallDTO.setMonitorId(Stream.of(temp).collect(Collectors.toList()));
|
||||||
|
recallDTO.setTimeInterval(period);
|
||||||
|
recallDTO.setNodeId(data2.getNodeId());
|
||||||
|
recallDTOList.add(recallDTO);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
//暂态补招
|
||||||
|
RecallMessage.RecallDTO recallDTO = new RecallMessage.RecallDTO();
|
||||||
|
//不设置dataType暂态稳态全部补招
|
||||||
|
recallDTO.setDataType("1");
|
||||||
|
recallDTO.setMonitorId(Stream.of(temp).collect(Collectors.toList()));
|
||||||
String eventTime = formatInterval(param.getReCallStartTime(),param.getReCallEndTime());
|
String eventTime = formatInterval(param.getReCallStartTime(),param.getReCallEndTime());
|
||||||
recallDTO.setTimeInterval(Stream.of(eventTime).collect(Collectors.toList()));
|
recallDTO.setTimeInterval(Stream.of(eventTime).collect(Collectors.toList()));
|
||||||
recallDTO.setNodeId(data2.getNodeId());
|
recallDTO.setNodeId(data2.getNodeId());
|
||||||
@@ -117,7 +292,6 @@ public class DataRecallController extends BaseController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@PostMapping("/recall")
|
@PostMapping("/recall")
|
||||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||||
@ApiOperation("数据补招")
|
@ApiOperation("数据补招")
|
||||||
@@ -134,6 +308,14 @@ public class DataRecallController extends BaseController {
|
|||||||
}else {
|
}else {
|
||||||
runMonitorIds = param.getMonitorId();
|
runMonitorIds = param.getMonitorId();
|
||||||
}
|
}
|
||||||
|
LineCountEvaluateParam lineParam = new LineCountEvaluateParam();
|
||||||
|
lineParam.setLineId(runMonitorIds);
|
||||||
|
//查看监测点的数据完整性
|
||||||
|
lineParam.setStartTime( LocalDateTimeUtil.format( param.getReCallStartTime(), DatePattern.NORM_DATETIME_FORMATTER));
|
||||||
|
lineParam.setEndTime(LocalDateTimeUtil.format( param.getReCallEndTime(), DatePattern.NORM_DATETIME_FORMATTER));
|
||||||
|
List<DataIntegrityDto> rawData = iDataIntegrityInsert.getRawData(lineParam);
|
||||||
|
Map<String, Map<String, List<DataIntegrityDto>>> collect1 = rawData.stream().collect(Collectors.groupingBy(DataIntegrityDto::getLineIndex, Collectors.groupingBy(DataIntegrityDto::getTimeId)));
|
||||||
|
|
||||||
LocalDate currentDate = param.getReCallStartTime();
|
LocalDate currentDate = param.getReCallStartTime();
|
||||||
//循环每一天
|
//循环每一天
|
||||||
while (!currentDate.isAfter(param.getReCallEndTime())) {
|
while (!currentDate.isAfter(param.getReCallEndTime())) {
|
||||||
@@ -143,19 +325,72 @@ public class DataRecallController extends BaseController {
|
|||||||
//后续根据不同前置下的测点发送补招密令
|
//后续根据不同前置下的测点发送补招密令
|
||||||
DeviceDTO data2 = deviceFeignClient.getDeviceInfo(data.getDevId()).getData();
|
DeviceDTO data2 = deviceFeignClient.getDeviceInfo(data.getDevId()).getData();
|
||||||
|
|
||||||
|
//查看数据完整性,根据数据完整性进行补招;
|
||||||
|
//校验数据完整性完整率>=98%不补招完整率80%~98%,差量补招,完整率<=80%,全量补招
|
||||||
|
Integer recallType = 1; //1全量补 2:差量补 3:不需要补招
|
||||||
|
String curDateString = LocalDateTimeUtil.format(finalCurrentDate.atTime(0, 0, 0), DatePattern.NORM_DATETIME_FORMATTER);
|
||||||
|
if(collect1.containsKey(temp)&&collect1.get(temp).containsKey(curDateString)){
|
||||||
|
DataIntegrityDto dto = collect1.get(temp).get(curDateString).get(0);
|
||||||
|
if( dto.getDueTime()!=0){
|
||||||
|
double i = (double)dto.getRealTime() / dto.getDueTime();
|
||||||
|
if( i>=0.98){
|
||||||
|
recallType=3;
|
||||||
|
} else if(i<0.98&&i>0.8){
|
||||||
|
recallType=2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
if(recallType ==3){
|
||||||
|
return;
|
||||||
|
}else if(recallType ==2){
|
||||||
Integer timeInterval = data.getTimeInterval();
|
Integer timeInterval = data.getTimeInterval();
|
||||||
List<LocalDateTime> localDateTimeList = generateTimeIntervals(finalCurrentDate, timeInterval);
|
List<LocalDateTime> localDateTimeList = generateTimeIntervals(finalCurrentDate, timeInterval);
|
||||||
List<LocalDateTime> data1 = dataVQuery.monitoringTime(temp, LocalDateTimeUtil.format(finalCurrentDate, DatePattern.NORM_DATE_PATTERN));
|
List<LocalDateTime> data1 = dataVQuery.monitoringTime(temp, LocalDateTimeUtil.format(finalCurrentDate, DatePattern.NORM_DATE_PATTERN));
|
||||||
localDateTimeList.removeAll(data1);
|
localDateTimeList.removeAll(data1);
|
||||||
if(!CollectionUtils.isEmpty(localDateTimeList)){
|
if(!CollectionUtils.isEmpty(localDateTimeList)){
|
||||||
List<String> timePeriod = mergeTimeIntervals(localDateTimeList, timeInterval);
|
List<String> timePeriod = mergeTimeIntervals(localDateTimeList, timeInterval);
|
||||||
|
//最大时间段为300
|
||||||
|
if(timePeriod.size()<300){
|
||||||
RecallMessage.RecallDTO recallDTO = new RecallMessage.RecallDTO();
|
RecallMessage.RecallDTO recallDTO = new RecallMessage.RecallDTO();
|
||||||
recallDTO.setDataType("0");
|
recallDTO.setDataType("0");
|
||||||
recallDTO.setMonitorId(Stream.of(temp).collect(Collectors.toList()));
|
recallDTO.setMonitorId(Stream.of(temp).collect(Collectors.toList()));
|
||||||
recallDTO.setTimeInterval(timePeriod);
|
recallDTO.setTimeInterval(timePeriod);
|
||||||
recallDTO.setNodeId(data2.getNodeId());
|
recallDTO.setNodeId(data2.getNodeId());
|
||||||
recallDTOList.add(recallDTO);
|
recallDTOList.add(recallDTO);
|
||||||
|
}else {
|
||||||
|
List<List<String>> timePeriods = CollUtil.split(timePeriod, 300);
|
||||||
|
timePeriods.forEach(period->{
|
||||||
|
RecallMessage.RecallDTO recallDTO = new RecallMessage.RecallDTO();
|
||||||
|
recallDTO.setDataType("0");
|
||||||
|
recallDTO.setMonitorId(Stream.of(temp).collect(Collectors.toList()));
|
||||||
|
recallDTO.setTimeInterval(period);
|
||||||
|
recallDTO.setNodeId(data2.getNodeId());
|
||||||
|
recallDTOList.add(recallDTO);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}else {
|
||||||
|
//暂态补招
|
||||||
|
RecallMessage.RecallDTO recallDTO = new RecallMessage.RecallDTO();
|
||||||
|
//不设置dataType暂态稳态全部补招
|
||||||
|
recallDTO.setDataType("0");
|
||||||
|
recallDTO.setMonitorId(Stream.of(temp).collect(Collectors.toList()));
|
||||||
|
|
||||||
|
String eventTime = formatInterval(finalCurrentDate.atTime(0,0,0),finalCurrentDate.atTime(23,59,0));
|
||||||
|
recallDTO.setTimeInterval(Stream.of(eventTime).collect(Collectors.toList()));
|
||||||
|
recallDTO.setNodeId(data2.getNodeId());
|
||||||
|
recallDTOList.add(recallDTO);
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//暂态补招
|
//暂态补招
|
||||||
RecallMessage.RecallDTO recallDTO2 = new RecallMessage.RecallDTO();
|
RecallMessage.RecallDTO recallDTO2 = new RecallMessage.RecallDTO();
|
||||||
recallDTO2.setDataType("1");
|
recallDTO2.setDataType("1");
|
||||||
@@ -225,6 +460,22 @@ public class DataRecallController extends BaseController {
|
|||||||
return dateTimeList;
|
return dateTimeList;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public List<LocalDateTime> generateTimeIntervals(LocalDateTime startDateTime,LocalDateTime endDateTime , int intervalMinutes) {
|
||||||
|
List<LocalDateTime> dateTimeList = new ArrayList<>();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// Generate LocalDateTime list with the given interval
|
||||||
|
LocalDateTime currentDateTime = startDateTime;
|
||||||
|
while (!currentDateTime.isAfter(endDateTime)) {
|
||||||
|
dateTimeList.add(currentDateTime);
|
||||||
|
currentDateTime = currentDateTime.plusMinutes(intervalMinutes);
|
||||||
|
}
|
||||||
|
|
||||||
|
return dateTimeList;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public static List<String> mergeTimeIntervals(List<LocalDateTime> times, int intervalMinutes) {
|
public static List<String> mergeTimeIntervals(List<LocalDateTime> times, int intervalMinutes) {
|
||||||
List<String> mergedIntervals = new ArrayList<>();
|
List<String> mergedIntervals = new ArrayList<>();
|
||||||
if (times == null || times.isEmpty()) {
|
if (times == null || times.isEmpty()) {
|
||||||
@@ -259,10 +510,18 @@ public class DataRecallController extends BaseController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
// 创建两个LocalDateTime对象
|
LocalDate localDate1 = LocalDate.now();
|
||||||
LocalDateTime dateTime1 = LocalDateTime.of(2023, 1, 1, 10, 0); // 例如:2023年1月1日 10:00
|
LocalDate localDate2 = LocalDate.now();
|
||||||
LocalDateTime dateTime2 = LocalDateTime.of(2023, 1, 2, 15, 30); // 例如:2023年1月1日 15:30
|
while (!localDate1.isAfter(localDate2)) {
|
||||||
|
LocalDate finalCurrentDate = localDate1;
|
||||||
|
System.out.println(finalCurrentDate);
|
||||||
|
localDate1 = localDate1.plusDays(1);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// 创建两个LocalDateTime对象
|
||||||
|
LocalDateTime dateTime1 = LocalDateTime.of(2023, 1, 1, 10, 0,11); // 例如:2023年1月1日 10:00
|
||||||
|
LocalDateTime dateTime2 = LocalDateTime.of(2023, 1, 1, 10, 30,22); // 例如:2023年1月1日 15:30
|
||||||
// 使用Duration计算两个时间之间的差异
|
// 使用Duration计算两个时间之间的差异
|
||||||
Duration duration = Duration.between(dateTime1, dateTime2);
|
Duration duration = Duration.between(dateTime1, dateTime2);
|
||||||
|
|
||||||
|
|||||||
@@ -166,6 +166,15 @@ public class DataVController extends BaseController {
|
|||||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, dataV, methodDescribe);
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, dataV, methodDescribe);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||||
|
@PostMapping("/excludeZeroData")
|
||||||
|
@ApiOperation("判断是否存在是零飘数据")
|
||||||
|
public HttpResult<Boolean> excludeZeroData(@RequestBody LineCountEvaluateParam lineParam) {
|
||||||
|
String methodDescribe = getMethodDescribe("excludeZeroData");
|
||||||
|
Boolean b = dataVQuery.excludeZeroData(lineParam);
|
||||||
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, b, methodDescribe);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,58 @@
|
|||||||
|
package com.njcn.dataProcess.controller;
|
||||||
|
|
||||||
|
|
||||||
|
import com.njcn.common.pojo.annotation.OperateInfo;
|
||||||
|
import com.njcn.common.pojo.constant.OperateType;
|
||||||
|
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.dataProcess.pojo.po.PqDataVerifyBak;
|
||||||
|
import com.njcn.dataProcess.pojo.po.PqDataVerifyCount;
|
||||||
|
import com.njcn.dataProcess.service.IPqDataVerifyCountService;
|
||||||
|
import com.njcn.dataProcess.service.IPqDataVerifyNewService;
|
||||||
|
import com.njcn.web.controller.BaseController;
|
||||||
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
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 javax.annotation.Resource;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* 前端控制器
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author xy
|
||||||
|
* @since 2025-02-17
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/pqDataVerifyCount")
|
||||||
|
public class PqDataVerifyCountController extends BaseController {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private IPqDataVerifyCountService pqDataVerifyNewService;
|
||||||
|
|
||||||
|
@OperateInfo(info = LogEnum.BUSINESS_COMMON,operateType = OperateType.ADD)
|
||||||
|
@PostMapping("/insertDataBatch")
|
||||||
|
@ApiOperation("存储清洗的异常数据数量")
|
||||||
|
public HttpResult<List<String>> insertDataBatch(@RequestBody List<PqDataVerifyCount> list) {
|
||||||
|
String methodDescribe = getMethodDescribe("insertDataBatch");
|
||||||
|
pqDataVerifyNewService.insertDataBatch(list);
|
||||||
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
||||||
|
}
|
||||||
|
|
||||||
|
@OperateInfo(info = LogEnum.BUSINESS_COMMON,operateType = OperateType.ADD)
|
||||||
|
@PostMapping("/insertData")
|
||||||
|
@ApiOperation("存储清洗的异常数据数量")
|
||||||
|
public HttpResult<List<String>> insertData(@RequestBody PqDataVerifyCount pqDataVerifyCount) {
|
||||||
|
String methodDescribe = getMethodDescribe("insertData");
|
||||||
|
pqDataVerifyNewService.insertData(pqDataVerifyCount);
|
||||||
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
@@ -0,0 +1,60 @@
|
|||||||
|
package com.njcn.dataProcess.controller;
|
||||||
|
|
||||||
|
import com.njcn.algorithm.pojo.bo.CalculatedParam;
|
||||||
|
import com.njcn.common.pojo.annotation.OperateInfo;
|
||||||
|
import com.njcn.common.pojo.constant.OperateType;
|
||||||
|
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.dataProcess.annotation.InsertBean;
|
||||||
|
import com.njcn.dataProcess.pojo.dto.RMpVThd;
|
||||||
|
import com.njcn.dataProcess.service.IRMpVThdService;
|
||||||
|
import com.njcn.web.controller.BaseController;
|
||||||
|
import io.swagger.annotations.Api;
|
||||||
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.stereotype.Controller;
|
||||||
|
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 java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author hongawen
|
||||||
|
* @version 1.0
|
||||||
|
* @data 2024/11/6 19:48
|
||||||
|
*/
|
||||||
|
@Validated
|
||||||
|
@Slf4j
|
||||||
|
@Controller
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/rmpvthd")
|
||||||
|
@Api(tags = "畸变率")
|
||||||
|
public class RMpVThdController extends BaseController {
|
||||||
|
|
||||||
|
@InsertBean
|
||||||
|
private IRMpVThdService irMpVThdService;
|
||||||
|
|
||||||
|
@OperateInfo(info = LogEnum.BUSINESS_COMMON,operateType = OperateType.ADD)
|
||||||
|
@PostMapping("/batchInsertionThd")
|
||||||
|
@ApiOperation("畸变率批量插入")
|
||||||
|
public HttpResult<String> batchInsertionThd(@RequestBody List<RMpVThd> result) {
|
||||||
|
String methodDescribe = getMethodDescribe("batchInsertionPower");
|
||||||
|
irMpVThdService.batchInsertionThd(result);
|
||||||
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
||||||
|
}
|
||||||
|
|
||||||
|
@OperateInfo(info = LogEnum.BUSINESS_COMMON,operateType = OperateType.ADD)
|
||||||
|
@PostMapping("/batchInsertionPower")
|
||||||
|
@ApiOperation("畸变率查询")
|
||||||
|
public HttpResult<List<RMpVThd>> queryThd(@RequestBody CalculatedParam calculatedParam) {
|
||||||
|
String methodDescribe = getMethodDescribe("batchInsertionPower");
|
||||||
|
List<RMpVThd> rMpVThdList = irMpVThdService.queryHarmonicVThd(calculatedParam);
|
||||||
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, rMpVThdList, methodDescribe);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
package com.njcn.dataProcess.dao.relation.mapper;
|
||||||
|
|
||||||
|
import com.github.jeffreyning.mybatisplus.base.MppBaseMapper;
|
||||||
|
import com.njcn.dataProcess.pojo.po.PqDataVerifyCount;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* Mapper 接口
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author xy
|
||||||
|
* @since 2025-02-17
|
||||||
|
*/
|
||||||
|
public interface PqDataVerifyCountMapper extends MppBaseMapper<PqDataVerifyCount> {
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,28 @@
|
|||||||
|
package com.njcn.dataProcess.dao.relation.mapper;
|
||||||
|
|
||||||
|
|
||||||
|
import com.github.jeffreyning.mybatisplus.base.MppBaseMapper;
|
||||||
|
import com.njcn.dataProcess.pojo.dto.RMpVThd;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* 谐波畸变率排名 Mapper 接口
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author xiaoyao
|
||||||
|
* @since 2022-11-07
|
||||||
|
*/
|
||||||
|
public interface RMpVThdMapper extends MppBaseMapper<RMpVThd> {
|
||||||
|
|
||||||
|
int insertRate(@Param("item") Map<String, Object> item);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 从r_stat_data_v_d中获取畸变率的最大值
|
||||||
|
* phasic_type = A、B、C && value_type = CP95
|
||||||
|
*/
|
||||||
|
List<RMpVThd> getVThdData(@Param("time") String time, @Param("lineList")List<String> lineList);
|
||||||
|
}
|
||||||
@@ -0,0 +1,31 @@
|
|||||||
|
<?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.dataProcess.dao.relation.mapper.RMpVThdMapper">
|
||||||
|
|
||||||
|
<insert id="insertRate">
|
||||||
|
INSERT INTO r_mp_v_thd ( measurement_point_id, data_type, data_date, v_thd) VALUES
|
||||||
|
( #{item.lineId}, #{item.dataType}, #{item.dataDate}, #{item.vThd} )
|
||||||
|
ON DUPLICATE KEY UPDATE v_thd = #{item.vThd}
|
||||||
|
</insert>
|
||||||
|
|
||||||
|
<select id="getVThdData" resultType="com.njcn.dataProcess.pojo.dto.RMpVThd">
|
||||||
|
select
|
||||||
|
line_id measurementPointId,
|
||||||
|
max(v_thd) vThd,
|
||||||
|
time dataDate,
|
||||||
|
'0' dataType
|
||||||
|
from
|
||||||
|
r_stat_data_v_d
|
||||||
|
where
|
||||||
|
time = #{time}
|
||||||
|
and phasic_type in ('A', 'B', 'C')
|
||||||
|
and value_type = 'CP95'
|
||||||
|
<if test="lineList != null and lineList.size() > 0">
|
||||||
|
and line_id in
|
||||||
|
<foreach collection="lineList" item="item" open="(" close=")" separator=",">
|
||||||
|
#{item}
|
||||||
|
</foreach>
|
||||||
|
</if>
|
||||||
|
group by line_id, time
|
||||||
|
</select>
|
||||||
|
</mapper>
|
||||||
@@ -81,4 +81,17 @@ public interface IDataV extends IMppService<RStatDataVD> {
|
|||||||
List<DataVDto> getDataV(LineCountEvaluateParam lineParam);
|
List<DataVDto> getDataV(LineCountEvaluateParam lineParam);
|
||||||
|
|
||||||
List<DataVDto> getGroupByTimeDataV(LineCountEvaluateParam lineParam);
|
List<DataVDto> getGroupByTimeDataV(LineCountEvaluateParam lineParam);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查看监测点的电压,判断是否存在是零飘数据
|
||||||
|
* 如果零飘数据占比一半多,则抛弃该监测点数据
|
||||||
|
* @param lineParam
|
||||||
|
* @return: java.lang.Boolean
|
||||||
|
* @Author: wr
|
||||||
|
* @Date: 2026/1/15 9:26
|
||||||
|
*/
|
||||||
|
Boolean excludeZeroData(LineCountEvaluateParam lineParam);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,28 @@
|
|||||||
|
package com.njcn.dataProcess.service;
|
||||||
|
|
||||||
|
import com.github.jeffreyning.mybatisplus.service.IMppService;
|
||||||
|
import com.njcn.dataProcess.pojo.po.PqDataVerifyCount;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* 服务类
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author xy
|
||||||
|
* @since 2025-02-17
|
||||||
|
*/
|
||||||
|
public interface IPqDataVerifyCountService extends IMppService<PqDataVerifyCount> {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 异常数据插入
|
||||||
|
* @param list
|
||||||
|
*/
|
||||||
|
void insertDataBatch(List<PqDataVerifyCount> list);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 异常数据插入
|
||||||
|
*/
|
||||||
|
void insertData(PqDataVerifyCount pqDataVerifyCount);
|
||||||
|
}
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
package com.njcn.dataProcess.service;
|
||||||
|
|
||||||
|
import com.njcn.algorithm.pojo.bo.CalculatedParam;
|
||||||
|
import com.njcn.dataProcess.param.LineCountEvaluateParam;
|
||||||
|
import com.njcn.dataProcess.pojo.dto.RMpVThd;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public interface IRMpVThdService {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 计算谐波畸变率表
|
||||||
|
* @param calculatedParam
|
||||||
|
*/
|
||||||
|
List<RMpVThd> queryHarmonicVThd(CalculatedParam calculatedParam);
|
||||||
|
|
||||||
|
void batchInsertionThd(List<RMpVThd> result);
|
||||||
|
}
|
||||||
@@ -97,7 +97,7 @@ public class LnDataDealServiceImpl implements LnDataDealService {
|
|||||||
pqsCommunicateDto.setTime(LocalDateTimeUtil.format(dataVDTO.getTimeid(), DatePattern.NORM_DATETIME_PATTERN));
|
pqsCommunicateDto.setTime(LocalDateTimeUtil.format(dataVDTO.getTimeid(), DatePattern.NORM_DATETIME_PATTERN));
|
||||||
pqsCommunicateDto.setDevId(temp);
|
pqsCommunicateDto.setDevId(temp);
|
||||||
pqsCommunicateDto.setType(1);
|
pqsCommunicateDto.setType(1);
|
||||||
|
pqsCommunicateDto.setFlag(1);
|
||||||
|
|
||||||
iPqsCommunicate.insertion(pqsCommunicateDto);
|
iPqsCommunicate.insertion(pqsCommunicateDto);
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -4,6 +4,10 @@ import cn.hutool.core.collection.CollUtil;
|
|||||||
import cn.hutool.core.collection.CollectionUtil;
|
import cn.hutool.core.collection.CollectionUtil;
|
||||||
import cn.hutool.core.util.ObjectUtil;
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
import com.github.jeffreyning.mybatisplus.service.MppServiceImpl;
|
import com.github.jeffreyning.mybatisplus.service.MppServiceImpl;
|
||||||
|
import com.njcn.csdevice.api.CsLineFeignClient;
|
||||||
|
import com.njcn.csdevice.api.EquipmentFeignClient;
|
||||||
|
import com.njcn.csdevice.pojo.dto.CsEquipmentDeliveryDTO;
|
||||||
|
import com.njcn.csdevice.pojo.po.CsLinePO;
|
||||||
import com.njcn.dataProcess.dao.imapper.DataFlickerMapper;
|
import com.njcn.dataProcess.dao.imapper.DataFlickerMapper;
|
||||||
import com.njcn.dataProcess.dao.relation.mapper.RStatDataFlickerRelationMapper;
|
import com.njcn.dataProcess.dao.relation.mapper.RStatDataFlickerRelationMapper;
|
||||||
import com.njcn.dataProcess.dto.DataFlickerDTO;
|
import com.njcn.dataProcess.dto.DataFlickerDTO;
|
||||||
@@ -20,10 +24,12 @@ import org.apache.commons.collections4.ListUtils;
|
|||||||
import org.springframework.beans.BeanUtils;
|
import org.springframework.beans.BeanUtils;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
import java.time.ZoneId;
|
import java.time.ZoneId;
|
||||||
import java.time.format.DateTimeFormatter;
|
import java.time.format.DateTimeFormatter;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
import java.util.function.Function;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -41,6 +47,17 @@ public class InfluxdbDataFlickerImpl extends MppServiceImpl<RStatDataFlickerRela
|
|||||||
|
|
||||||
private final DataFlickerMapper dataFlickerMapper;
|
private final DataFlickerMapper dataFlickerMapper;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private CsLineFeignClient csLineFeignClient;
|
||||||
|
@Resource
|
||||||
|
private EquipmentFeignClient equipmentFeignClient;
|
||||||
|
private static final Map<String, String> PHASE_MAPPING = new HashMap<String, String>() {{
|
||||||
|
put("AB", "A");
|
||||||
|
put("BC", "B");
|
||||||
|
put("CA", "C");
|
||||||
|
put("M", "T");
|
||||||
|
}};
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void batchInsertion(List<DataFlickerDTO> dataFlickerDTOList) {
|
public void batchInsertion(List<DataFlickerDTO> dataFlickerDTOList) {
|
||||||
@@ -50,9 +67,8 @@ public class InfluxdbDataFlickerImpl extends MppServiceImpl<RStatDataFlickerRela
|
|||||||
}
|
}
|
||||||
|
|
||||||
List<DataFlicker> collect = dataFlickerDTOList.stream().map(temp -> DataFlicker.relationToInfluxDB(temp)).collect(Collectors.toList());
|
List<DataFlicker> collect = dataFlickerDTOList.stream().map(temp -> DataFlicker.relationToInfluxDB(temp)).collect(Collectors.toList());
|
||||||
int minSize = Math.min(1200000, collect.size());
|
|
||||||
|
|
||||||
List<List<DataFlicker>> partition = ListUtils.partition(collect, minSize);
|
List<List<DataFlicker>> partition = ListUtils.partition(collect, 20000);
|
||||||
for (List<DataFlicker> dataFlickerList : partition) {
|
for (List<DataFlicker> dataFlickerList : partition) {
|
||||||
List<DataFlicker> sublistAsOriginalListType = new ArrayList<>(dataFlickerList);
|
List<DataFlicker> sublistAsOriginalListType = new ArrayList<>(dataFlickerList);
|
||||||
|
|
||||||
@@ -64,7 +80,12 @@ public class InfluxdbDataFlickerImpl extends MppServiceImpl<RStatDataFlickerRela
|
|||||||
@Override
|
@Override
|
||||||
public List<DataFlickerDto> getRawData(LineCountEvaluateParam lineParam) {
|
public List<DataFlickerDto> getRawData(LineCountEvaluateParam lineParam) {
|
||||||
List<DataFlickerDto> result = new ArrayList<>();
|
List<DataFlickerDto> result = new ArrayList<>();
|
||||||
List<DataFlicker> list = getMinuteData(lineParam);
|
List<DataFlicker> list;
|
||||||
|
if (Objects.equals(lineParam.getType(), 2)) {
|
||||||
|
list = getWlMinuteData(lineParam);
|
||||||
|
} else {
|
||||||
|
list = getMinuteData(lineParam);
|
||||||
|
}
|
||||||
list.forEach(item -> {
|
list.forEach(item -> {
|
||||||
DataFlickerDto dto = new DataFlickerDto();
|
DataFlickerDto dto = new DataFlickerDto();
|
||||||
BeanUtils.copyProperties(item, dto);
|
BeanUtils.copyProperties(item, dto);
|
||||||
@@ -77,7 +98,12 @@ public class InfluxdbDataFlickerImpl extends MppServiceImpl<RStatDataFlickerRela
|
|||||||
@Override
|
@Override
|
||||||
public List<CommonMinuteDto> getBaseData(LineCountEvaluateParam lineParam) {
|
public List<CommonMinuteDto> getBaseData(LineCountEvaluateParam lineParam) {
|
||||||
List<CommonMinuteDto> result = new ArrayList<>();
|
List<CommonMinuteDto> result = new ArrayList<>();
|
||||||
List<DataFlicker> dataIList = getMinuteData(lineParam);
|
List<DataFlicker> dataIList;
|
||||||
|
if (Objects.equals(lineParam.getType(), 2)) {
|
||||||
|
dataIList = getWlMinuteData(lineParam);
|
||||||
|
} else {
|
||||||
|
dataIList = getMinuteData(lineParam);
|
||||||
|
}
|
||||||
if (CollectionUtil.isNotEmpty(dataIList)) {
|
if (CollectionUtil.isNotEmpty(dataIList)) {
|
||||||
String time = TimeUtils.StringTimeToString(lineParam.getStartTime());
|
String time = TimeUtils.StringTimeToString(lineParam.getStartTime());
|
||||||
//以监测点分组
|
//以监测点分组
|
||||||
@@ -237,4 +263,63 @@ public class InfluxdbDataFlickerImpl extends MppServiceImpl<RStatDataFlickerRela
|
|||||||
quality(result, influxQueryWrapper, lineParam);
|
quality(result, influxQueryWrapper, lineParam);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public List<DataFlicker> getWlMinuteData(LineCountEvaluateParam lineParam) {
|
||||||
|
List<DataFlicker> result = new ArrayList<>();
|
||||||
|
if (CollectionUtil.isNotEmpty(lineParam.getLineId())) {
|
||||||
|
//获取监测点信息
|
||||||
|
List<CsLinePO> line = csLineFeignClient.queryLineById(lineParam.getLineId()).getData();
|
||||||
|
Map<String, CsLinePO> lineMap = line.stream().collect(Collectors.toMap(CsLinePO::getLineId, Function.identity()));
|
||||||
|
//获取设备信息
|
||||||
|
List<String> devList = line.stream().map(CsLinePO::getDeviceId).distinct().collect(Collectors.toList());
|
||||||
|
List<CsEquipmentDeliveryDTO> dev = equipmentFeignClient.queryDeviceById(devList).getData();
|
||||||
|
Map<String, CsEquipmentDeliveryDTO> devsMap = dev.stream().collect(Collectors.toMap(CsEquipmentDeliveryDTO::getId, Function.identity()));
|
||||||
|
|
||||||
|
lineParam.getLineId().forEach(lineId -> {
|
||||||
|
String devId = lineMap.get(lineId).getDeviceId();
|
||||||
|
CsLinePO po = lineMap.get(lineId);
|
||||||
|
InfluxQueryWrapper influxQueryWrapper = new InfluxQueryWrapper(DataFlicker.class);
|
||||||
|
influxQueryWrapper.eq(DataFlicker::getLineId, lineId)
|
||||||
|
.eq(DataFlicker::getProcess,Integer.toString(devsMap.get(devId).getProcess()))
|
||||||
|
.select(DataFlicker::getLineId)
|
||||||
|
.select(DataFlicker::getPhasicType)
|
||||||
|
.between(DataFlicker::getTime, lineParam.getStartTime(), lineParam.getEndTime())
|
||||||
|
.eq(DataFlicker::getQualityFlag, "0");
|
||||||
|
if (CollUtil.isNotEmpty(lineParam.getPhasicType())) {
|
||||||
|
influxQueryWrapper.regular(DataFlicker::getPhasicType, lineParam.getPhasicType());
|
||||||
|
}
|
||||||
|
if (Objects.isNull(po.getLineNo())) {
|
||||||
|
influxQueryWrapper.eq(DataFlicker::getCldid,Integer.toString(po.getClDid()));
|
||||||
|
} else {
|
||||||
|
influxQueryWrapper.eq(DataFlicker::getCldid,Integer.toString(po.getLineNo()));
|
||||||
|
}
|
||||||
|
//判断接线方式 (0-星型 1-角型 2-V型) 星型是相电压 角型或者v型是线电压
|
||||||
|
if (Objects.equals(po.getConType(),0)) {
|
||||||
|
//相电压电压变动幅度
|
||||||
|
influxQueryWrapper.select("Pq_Fluct","fluc");
|
||||||
|
//相电压长时闪变
|
||||||
|
influxQueryWrapper.select("Pq_Plt","plt");
|
||||||
|
//相电压短时闪变
|
||||||
|
influxQueryWrapper.select("Pq_Pst","pst");
|
||||||
|
} else {
|
||||||
|
//线电压电压变动幅度
|
||||||
|
influxQueryWrapper.select("Pq_LFluct","fluc");
|
||||||
|
//相电压长时闪变
|
||||||
|
influxQueryWrapper.select("Pq_LPlt","plt");
|
||||||
|
//相电压短时闪变
|
||||||
|
influxQueryWrapper.select("Pq_LPst","pst");
|
||||||
|
}
|
||||||
|
result.addAll(dataFlickerMapper.selectByQueryWrapper(influxQueryWrapper));
|
||||||
|
});
|
||||||
|
if (CollectionUtil.isNotEmpty(result)) {
|
||||||
|
result.forEach(item -> {
|
||||||
|
String newType = PHASE_MAPPING.get(item.getPhasicType());
|
||||||
|
if (newType != null) {
|
||||||
|
item.setPhasicType(newType);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,6 +2,10 @@ package com.njcn.dataProcess.service.impl.influxdb;
|
|||||||
|
|
||||||
import cn.hutool.core.collection.CollectionUtil;
|
import cn.hutool.core.collection.CollectionUtil;
|
||||||
import com.github.jeffreyning.mybatisplus.service.MppServiceImpl;
|
import com.github.jeffreyning.mybatisplus.service.MppServiceImpl;
|
||||||
|
import com.njcn.csdevice.api.CsLineFeignClient;
|
||||||
|
import com.njcn.csdevice.api.EquipmentFeignClient;
|
||||||
|
import com.njcn.csdevice.pojo.dto.CsEquipmentDeliveryDTO;
|
||||||
|
import com.njcn.csdevice.pojo.po.CsLinePO;
|
||||||
import com.njcn.dataProcess.dao.imapper.DataFlucMapper;
|
import com.njcn.dataProcess.dao.imapper.DataFlucMapper;
|
||||||
import com.njcn.dataProcess.dao.relation.mapper.RStatDataFlucRelationMapper;
|
import com.njcn.dataProcess.dao.relation.mapper.RStatDataFlucRelationMapper;
|
||||||
import com.njcn.dataProcess.dto.DataFlucDTO;
|
import com.njcn.dataProcess.dto.DataFlucDTO;
|
||||||
@@ -18,10 +22,12 @@ import org.apache.commons.collections4.ListUtils;
|
|||||||
import org.springframework.beans.BeanUtils;
|
import org.springframework.beans.BeanUtils;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
import java.time.ZoneId;
|
import java.time.ZoneId;
|
||||||
import java.time.format.DateTimeFormatter;
|
import java.time.format.DateTimeFormatter;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
import java.util.function.Function;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -39,6 +45,17 @@ public class InfluxdbDataFlucImpl extends MppServiceImpl<RStatDataFlucRelationMa
|
|||||||
|
|
||||||
private final DataFlucMapper dataFlucMapper;
|
private final DataFlucMapper dataFlucMapper;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private CsLineFeignClient csLineFeignClient;
|
||||||
|
@Resource
|
||||||
|
private EquipmentFeignClient equipmentFeignClient;
|
||||||
|
|
||||||
|
private static final Map<String, String> PHASE_MAPPING = new HashMap<String, String>() {{
|
||||||
|
put("AB", "A");
|
||||||
|
put("BC", "B");
|
||||||
|
put("CA", "C");
|
||||||
|
put("M", "T");
|
||||||
|
}};
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void batchInsertion(List<DataFlucDTO> dataFlucDTOList) {
|
public void batchInsertion(List<DataFlucDTO> dataFlucDTOList) {
|
||||||
@@ -48,9 +65,8 @@ public class InfluxdbDataFlucImpl extends MppServiceImpl<RStatDataFlucRelationMa
|
|||||||
}
|
}
|
||||||
|
|
||||||
List<DataFluc> collect = dataFlucDTOList.stream().map(temp -> DataFluc.relationToInfluxDB(temp)).collect(Collectors.toList());
|
List<DataFluc> collect = dataFlucDTOList.stream().map(temp -> DataFluc.relationToInfluxDB(temp)).collect(Collectors.toList());
|
||||||
int minSize = Math.min(1200000, collect.size());
|
|
||||||
|
|
||||||
List<List<DataFluc>> partition = ListUtils.partition(collect, minSize);
|
List<List<DataFluc>> partition = ListUtils.partition(collect, 20000);
|
||||||
for (List<DataFluc> dataFlucList : partition) {
|
for (List<DataFluc> dataFlucList : partition) {
|
||||||
List<DataFluc> sublistAsOriginalListType = new ArrayList<>(dataFlucList);
|
List<DataFluc> sublistAsOriginalListType = new ArrayList<>(dataFlucList);
|
||||||
|
|
||||||
@@ -62,7 +78,12 @@ public class InfluxdbDataFlucImpl extends MppServiceImpl<RStatDataFlucRelationMa
|
|||||||
@Override
|
@Override
|
||||||
public List<DataFlucDto> getRawData(LineCountEvaluateParam lineParam) {
|
public List<DataFlucDto> getRawData(LineCountEvaluateParam lineParam) {
|
||||||
List<DataFlucDto> result = new ArrayList<>();
|
List<DataFlucDto> result = new ArrayList<>();
|
||||||
List<DataFluc> list = getMinuteData(lineParam.getLineId(), lineParam.getStartTime(), lineParam.getEndTime(), lineParam.getAbnormalTime(),lineParam.getDataType());
|
List<DataFluc> list;
|
||||||
|
if (Objects.equals(lineParam.getType(), 2)) {
|
||||||
|
list = getWlMinuteData(lineParam.getLineId(), lineParam.getStartTime(), lineParam.getEndTime(), lineParam.getAbnormalTime(),lineParam.getDataType());
|
||||||
|
} else {
|
||||||
|
list = getMinuteData(lineParam.getLineId(), lineParam.getStartTime(), lineParam.getEndTime(), lineParam.getAbnormalTime(),lineParam.getDataType());
|
||||||
|
}
|
||||||
list.forEach(item->{
|
list.forEach(item->{
|
||||||
DataFlucDto dto = new DataFlucDto();
|
DataFlucDto dto = new DataFlucDto();
|
||||||
BeanUtils.copyProperties(item,dto);
|
BeanUtils.copyProperties(item,dto);
|
||||||
@@ -75,7 +96,12 @@ public class InfluxdbDataFlucImpl extends MppServiceImpl<RStatDataFlucRelationMa
|
|||||||
@Override
|
@Override
|
||||||
public List<CommonMinuteDto> getBaseData(LineCountEvaluateParam lineParam) {
|
public List<CommonMinuteDto> getBaseData(LineCountEvaluateParam lineParam) {
|
||||||
List<CommonMinuteDto> result = new ArrayList<>();
|
List<CommonMinuteDto> result = new ArrayList<>();
|
||||||
List<DataFluc> dataIList = getMinuteData(lineParam.getLineId(), lineParam.getStartTime(), lineParam.getEndTime(),lineParam.getAbnormalTime(),lineParam.getDataType());
|
List<DataFluc> dataIList;
|
||||||
|
if (Objects.equals(lineParam.getType(), 2)) {
|
||||||
|
dataIList = getWlMinuteData(lineParam.getLineId(), lineParam.getStartTime(), lineParam.getEndTime(), lineParam.getAbnormalTime(),lineParam.getDataType());
|
||||||
|
} else {
|
||||||
|
dataIList = getMinuteData(lineParam.getLineId(), lineParam.getStartTime(), lineParam.getEndTime(), lineParam.getAbnormalTime(),lineParam.getDataType());
|
||||||
|
}
|
||||||
if (CollectionUtil.isNotEmpty(dataIList)) {
|
if (CollectionUtil.isNotEmpty(dataIList)) {
|
||||||
String time = TimeUtils.StringTimeToString(lineParam.getStartTime());
|
String time = TimeUtils.StringTimeToString(lineParam.getStartTime());
|
||||||
//以监测点分组
|
//以监测点分组
|
||||||
@@ -191,4 +217,53 @@ public class InfluxdbDataFlucImpl extends MppServiceImpl<RStatDataFlucRelationMa
|
|||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public List<DataFluc> getWlMinuteData(List<String> lineList, String startTime, String endTime, Map<String,List<String>> timeMap, Boolean dataType) {
|
||||||
|
//todo FLUCCF电压波动频度原先oracle表存储的是0,写死的,这边暂不取值
|
||||||
|
List<DataFluc> result = new ArrayList<>();
|
||||||
|
if (CollectionUtil.isNotEmpty(lineList)) {
|
||||||
|
//获取监测点信息
|
||||||
|
List<CsLinePO> line = csLineFeignClient.queryLineById(lineList).getData();
|
||||||
|
Map<String, CsLinePO> lineMap = line.stream().collect(Collectors.toMap(CsLinePO::getLineId, Function.identity()));
|
||||||
|
//获取设备信息
|
||||||
|
List<String> devList = line.stream().map(CsLinePO::getDeviceId).distinct().collect(Collectors.toList());
|
||||||
|
List<CsEquipmentDeliveryDTO> dev = equipmentFeignClient.queryDeviceById(devList).getData();
|
||||||
|
Map<String, CsEquipmentDeliveryDTO> devsMap = dev.stream().collect(Collectors.toMap(CsEquipmentDeliveryDTO::getId, Function.identity()));
|
||||||
|
lineList.forEach(lineId -> {
|
||||||
|
String devId = lineMap.get(lineId).getDeviceId();
|
||||||
|
CsLinePO po = lineMap.get(lineId);
|
||||||
|
InfluxQueryWrapper influxQueryWrapper = new InfluxQueryWrapper(DataFluc.class);
|
||||||
|
influxQueryWrapper.eq(DataFluc::getLineId, lineId)
|
||||||
|
.eq(DataFluc::getProcess,Integer.toString(devsMap.get(devId).getProcess()))
|
||||||
|
.select(DataFluc::getLineId)
|
||||||
|
.select(DataFluc::getPhasicType)
|
||||||
|
.between(DataFluc::getTime, startTime, endTime)
|
||||||
|
.eq(DataFluc::getQualityFlag, "0");
|
||||||
|
if (Objects.isNull(po.getLineNo())) {
|
||||||
|
influxQueryWrapper.eq(DataFluc::getCldid,Integer.toString(po.getClDid()));
|
||||||
|
} else {
|
||||||
|
influxQueryWrapper.eq(DataFluc::getCldid,Integer.toString(po.getLineNo()));
|
||||||
|
}
|
||||||
|
//判断接线方式 (0-星型 1-角型 2-V型) 星型是相电压 角型或者v型是线电压
|
||||||
|
if (Objects.equals(po.getConType(),0)) {
|
||||||
|
//相电压电压变动幅度
|
||||||
|
influxQueryWrapper.select("Pq_Fluct","fluc");
|
||||||
|
} else {
|
||||||
|
//线电压电压变动幅度
|
||||||
|
influxQueryWrapper.select("Pq_LFluct","fluc");
|
||||||
|
}
|
||||||
|
result.addAll(dataFlucMapper.selectByQueryWrapper(influxQueryWrapper));
|
||||||
|
});
|
||||||
|
if (CollectionUtil.isNotEmpty(result)) {
|
||||||
|
result.forEach(item -> {
|
||||||
|
String newType = PHASE_MAPPING.get(item.getPhasicType());
|
||||||
|
if (newType != null) {
|
||||||
|
item.setPhasicType(newType);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,15 +4,17 @@ import cn.hutool.core.collection.CollUtil;
|
|||||||
import cn.hutool.core.collection.CollectionUtil;
|
import cn.hutool.core.collection.CollectionUtil;
|
||||||
import com.github.jeffreyning.mybatisplus.service.MppServiceImpl;
|
import com.github.jeffreyning.mybatisplus.service.MppServiceImpl;
|
||||||
import com.njcn.common.utils.HarmonicTimesUtil;
|
import com.njcn.common.utils.HarmonicTimesUtil;
|
||||||
|
import com.njcn.csdevice.api.CsLineFeignClient;
|
||||||
|
import com.njcn.csdevice.api.EquipmentFeignClient;
|
||||||
|
import com.njcn.csdevice.pojo.dto.CsEquipmentDeliveryDTO;
|
||||||
|
import com.njcn.csdevice.pojo.po.CsLinePO;
|
||||||
import com.njcn.dataProcess.dao.imapper.DataHarmRateIMapper;
|
import com.njcn.dataProcess.dao.imapper.DataHarmRateIMapper;
|
||||||
import com.njcn.dataProcess.dao.relation.mapper.RStatDataHarmRateIRelationMapper;
|
import com.njcn.dataProcess.dao.relation.mapper.RStatDataHarmRateIRelationMapper;
|
||||||
import com.njcn.dataProcess.param.LineCountEvaluateParam;
|
import com.njcn.dataProcess.param.LineCountEvaluateParam;
|
||||||
import com.njcn.dataProcess.po.influx.DataHarmrateI;
|
import com.njcn.dataProcess.po.influx.DataHarmrateI;
|
||||||
import com.njcn.dataProcess.po.influx.DataHarmrateV;
|
import com.njcn.dataProcess.po.influx.DataHarmrateV;
|
||||||
import com.njcn.dataProcess.po.influx.DataI;
|
|
||||||
import com.njcn.dataProcess.pojo.dto.CommonMinuteDto;
|
import com.njcn.dataProcess.pojo.dto.CommonMinuteDto;
|
||||||
import com.njcn.dataProcess.pojo.dto.DataHarmRateIDto;
|
import com.njcn.dataProcess.pojo.dto.DataHarmRateIDto;
|
||||||
import com.njcn.dataProcess.pojo.dto.DataIDto;
|
|
||||||
import com.njcn.dataProcess.pojo.po.RStatDataHarmRateID;
|
import com.njcn.dataProcess.pojo.po.RStatDataHarmRateID;
|
||||||
import com.njcn.dataProcess.service.IDataHarmRateI;
|
import com.njcn.dataProcess.service.IDataHarmRateI;
|
||||||
import com.njcn.dataProcess.util.TimeUtils;
|
import com.njcn.dataProcess.util.TimeUtils;
|
||||||
@@ -26,6 +28,7 @@ import java.time.LocalDateTime;
|
|||||||
import java.time.ZoneId;
|
import java.time.ZoneId;
|
||||||
import java.time.format.DateTimeFormatter;
|
import java.time.format.DateTimeFormatter;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
import java.util.function.Function;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -37,11 +40,27 @@ public class InfluxdbDataHarmRateIImpl extends MppServiceImpl<RStatDataHarmRateI
|
|||||||
private final DateTimeFormatter DATE_TIME_FORMATTER = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss").withZone(ZoneId.systemDefault());
|
private final DateTimeFormatter DATE_TIME_FORMATTER = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss").withZone(ZoneId.systemDefault());
|
||||||
@Resource
|
@Resource
|
||||||
private DataHarmRateIMapper dataHarmRateIMapper;
|
private DataHarmRateIMapper dataHarmRateIMapper;
|
||||||
|
@Resource
|
||||||
|
private CsLineFeignClient csLineFeignClient;
|
||||||
|
@Resource
|
||||||
|
private EquipmentFeignClient equipmentFeignClient;
|
||||||
|
|
||||||
|
private static final Map<String, String> PHASE_MAPPING = new HashMap<String, String>() {{
|
||||||
|
put("AB", "A");
|
||||||
|
put("BC", "B");
|
||||||
|
put("CA", "C");
|
||||||
|
put("M", "T");
|
||||||
|
}};
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<DataHarmRateIDto> getRawData(LineCountEvaluateParam lineParam) {
|
public List<DataHarmRateIDto> getRawData(LineCountEvaluateParam lineParam) {
|
||||||
List<DataHarmRateIDto> result = new ArrayList<>();
|
List<DataHarmRateIDto> result = new ArrayList<>();
|
||||||
List<DataHarmrateI> list = getMinuteData(lineParam.getLineId(), lineParam.getStartTime(), lineParam.getEndTime(),lineParam.getAbnormalTime(),lineParam.getDataType());
|
List<DataHarmrateI> list;
|
||||||
|
if (Objects.equals(lineParam.getType(), 2)) {
|
||||||
|
list = getWlMinuteData(lineParam.getLineId(), lineParam.getStartTime(), lineParam.getEndTime(), lineParam.getAbnormalTime(),lineParam.getDataType());
|
||||||
|
} else {
|
||||||
|
list = getMinuteData(lineParam.getLineId(), lineParam.getStartTime(), lineParam.getEndTime(), lineParam.getAbnormalTime(),lineParam.getDataType());
|
||||||
|
}
|
||||||
list.forEach(item->{
|
list.forEach(item->{
|
||||||
DataHarmRateIDto dto = new DataHarmRateIDto();
|
DataHarmRateIDto dto = new DataHarmRateIDto();
|
||||||
BeanUtils.copyProperties(item,dto);
|
BeanUtils.copyProperties(item,dto);
|
||||||
@@ -54,7 +73,12 @@ public class InfluxdbDataHarmRateIImpl extends MppServiceImpl<RStatDataHarmRateI
|
|||||||
@Override
|
@Override
|
||||||
public List<CommonMinuteDto> getBaseData(LineCountEvaluateParam lineParam) {
|
public List<CommonMinuteDto> getBaseData(LineCountEvaluateParam lineParam) {
|
||||||
List<CommonMinuteDto> result = new ArrayList<>();
|
List<CommonMinuteDto> result = new ArrayList<>();
|
||||||
List<DataHarmrateI> data = getMinuteData(lineParam.getLineId(), lineParam.getStartTime(), lineParam.getEndTime(),lineParam.getAbnormalTime(),lineParam.getDataType());
|
List<DataHarmrateI> data;
|
||||||
|
if (Objects.equals(lineParam.getType(), 2)) {
|
||||||
|
data = getWlMinuteData(lineParam.getLineId(), lineParam.getStartTime(), lineParam.getEndTime(), lineParam.getAbnormalTime(),lineParam.getDataType());
|
||||||
|
} else {
|
||||||
|
data = getMinuteData(lineParam.getLineId(), lineParam.getStartTime(), lineParam.getEndTime(), lineParam.getAbnormalTime(),lineParam.getDataType());
|
||||||
|
}
|
||||||
if (CollectionUtil.isNotEmpty(data)) {
|
if (CollectionUtil.isNotEmpty(data)) {
|
||||||
String time = TimeUtils.StringTimeToString(lineParam.getStartTime());
|
String time = TimeUtils.StringTimeToString(lineParam.getStartTime());
|
||||||
//以监测点分组
|
//以监测点分组
|
||||||
@@ -176,7 +200,7 @@ public class InfluxdbDataHarmRateIImpl extends MppServiceImpl<RStatDataHarmRateI
|
|||||||
List<DataHarmrateI> dataList;
|
List<DataHarmrateI> dataList;
|
||||||
List<DataHarmrateI> result = new ArrayList<>();
|
List<DataHarmrateI> result = new ArrayList<>();
|
||||||
InfluxQueryWrapper influxQueryWrapper = new InfluxQueryWrapper(DataHarmrateI.class);
|
InfluxQueryWrapper influxQueryWrapper = new InfluxQueryWrapper(DataHarmrateI.class);
|
||||||
influxQueryWrapper.samePrefixAndSuffix(InfluxDbSqlConstant.I, "", HarmonicTimesUtil.harmonicTimesList(1, 50, 1));
|
influxQueryWrapper.samePrefixAndSuffix(InfluxDbSqlConstant.I, InfluxDbSqlConstant.I, HarmonicTimesUtil.harmonicTimesList(1, 50, 1));
|
||||||
influxQueryWrapper.regular(DataHarmrateI::getLineId, lineList)
|
influxQueryWrapper.regular(DataHarmrateI::getLineId, lineList)
|
||||||
.select(DataHarmrateI::getLineId)
|
.select(DataHarmrateI::getLineId)
|
||||||
.select(DataHarmrateI::getPhasicType)
|
.select(DataHarmrateI::getPhasicType)
|
||||||
@@ -225,4 +249,47 @@ public class InfluxdbDataHarmRateIImpl extends MppServiceImpl<RStatDataHarmRateI
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public List<DataHarmrateI> getWlMinuteData(List<String> lineList, String startTime, String endTime, Map<String,List<String>> timeMap, Boolean dataType) {
|
||||||
|
List<DataHarmrateI> result = new ArrayList<>();
|
||||||
|
if (CollectionUtil.isNotEmpty(lineList)) {
|
||||||
|
//获取监测点信息
|
||||||
|
List<CsLinePO> line = csLineFeignClient.queryLineById(lineList).getData();
|
||||||
|
Map<String, CsLinePO> lineMap = line.stream().collect(Collectors.toMap(CsLinePO::getLineId, Function.identity()));
|
||||||
|
//获取设备信息
|
||||||
|
List<String> devList = line.stream().map(CsLinePO::getDeviceId).distinct().collect(Collectors.toList());
|
||||||
|
List<CsEquipmentDeliveryDTO> dev = equipmentFeignClient.queryDeviceById(devList).getData();
|
||||||
|
Map<String, CsEquipmentDeliveryDTO> devsMap = dev.stream().collect(Collectors.toMap(CsEquipmentDeliveryDTO::getId, Function.identity()));
|
||||||
|
lineList.forEach(lineId -> {
|
||||||
|
String devId = lineMap.get(lineId).getDeviceId();
|
||||||
|
CsLinePO po = lineMap.get(lineId);
|
||||||
|
InfluxQueryWrapper influxQueryWrapper = new InfluxQueryWrapper(DataHarmrateI.class);
|
||||||
|
influxQueryWrapper.samePrefixAndSuffix("Pq_HarmRI_", "i_", HarmonicTimesUtil.harmonicTimesList(2, 50, 1));
|
||||||
|
influxQueryWrapper.eq(DataHarmrateI::getLineId, lineId)
|
||||||
|
.eq(DataHarmrateI::getProcess,Integer.toString(devsMap.get(devId).getProcess()))
|
||||||
|
.select(DataHarmrateI::getLineId)
|
||||||
|
.select(DataHarmrateI::getPhasicType)
|
||||||
|
.select(DataHarmrateI::getValueType)
|
||||||
|
//电流基波有效值
|
||||||
|
.select("Pq_RmsFundI_","i_1")
|
||||||
|
.between(DataHarmrateI::getTime, startTime, endTime)
|
||||||
|
.eq(DataHarmrateI::getQualityFlag, "0");
|
||||||
|
if (Objects.isNull(po.getLineNo())) {
|
||||||
|
influxQueryWrapper.eq(DataHarmrateI::getCldid,Integer.toString(po.getClDid()));
|
||||||
|
} else {
|
||||||
|
influxQueryWrapper.eq(DataHarmrateI::getCldid,Integer.toString(po.getLineNo()));
|
||||||
|
}
|
||||||
|
result.addAll(dataHarmRateIMapper.selectByQueryWrapper(influxQueryWrapper));
|
||||||
|
});
|
||||||
|
if (CollectionUtil.isNotEmpty(result)) {
|
||||||
|
result.forEach(item -> {
|
||||||
|
String newType = PHASE_MAPPING.get(item.getPhasicType());
|
||||||
|
if (newType != null) {
|
||||||
|
item.setPhasicType(newType);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,6 +4,10 @@ import cn.hutool.core.collection.CollUtil;
|
|||||||
import cn.hutool.core.collection.CollectionUtil;
|
import cn.hutool.core.collection.CollectionUtil;
|
||||||
import com.github.jeffreyning.mybatisplus.service.MppServiceImpl;
|
import com.github.jeffreyning.mybatisplus.service.MppServiceImpl;
|
||||||
import com.njcn.common.utils.HarmonicTimesUtil;
|
import com.njcn.common.utils.HarmonicTimesUtil;
|
||||||
|
import com.njcn.csdevice.api.CsLineFeignClient;
|
||||||
|
import com.njcn.csdevice.api.EquipmentFeignClient;
|
||||||
|
import com.njcn.csdevice.pojo.dto.CsEquipmentDeliveryDTO;
|
||||||
|
import com.njcn.csdevice.pojo.po.CsLinePO;
|
||||||
import com.njcn.dataProcess.constant.InfluxDBTableConstant;
|
import com.njcn.dataProcess.constant.InfluxDBTableConstant;
|
||||||
import com.njcn.dataProcess.dao.imapper.DataHarmRateVMapper;
|
import com.njcn.dataProcess.dao.imapper.DataHarmRateVMapper;
|
||||||
import com.njcn.dataProcess.dao.relation.mapper.RStatDataHarmRateVRelationMapper;
|
import com.njcn.dataProcess.dao.relation.mapper.RStatDataHarmRateVRelationMapper;
|
||||||
@@ -14,7 +18,6 @@ import com.njcn.dataProcess.po.influx.DataV;
|
|||||||
import com.njcn.dataProcess.pojo.dto.CommonMinuteDto;
|
import com.njcn.dataProcess.pojo.dto.CommonMinuteDto;
|
||||||
import com.njcn.dataProcess.pojo.dto.DataHarmDto;
|
import com.njcn.dataProcess.pojo.dto.DataHarmDto;
|
||||||
import com.njcn.dataProcess.pojo.dto.DataHarmRateVDto;
|
import com.njcn.dataProcess.pojo.dto.DataHarmRateVDto;
|
||||||
import com.njcn.dataProcess.pojo.dto.DataVDto;
|
|
||||||
import com.njcn.dataProcess.pojo.po.RStatDataHarmRateVD;
|
import com.njcn.dataProcess.pojo.po.RStatDataHarmRateVD;
|
||||||
import com.njcn.dataProcess.service.IDataHarmRateV;
|
import com.njcn.dataProcess.service.IDataHarmRateV;
|
||||||
import com.njcn.dataProcess.util.TimeUtils;
|
import com.njcn.dataProcess.util.TimeUtils;
|
||||||
@@ -25,10 +28,12 @@ import org.apache.commons.collections4.ListUtils;
|
|||||||
import org.springframework.beans.BeanUtils;
|
import org.springframework.beans.BeanUtils;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
import java.time.ZoneId;
|
import java.time.ZoneId;
|
||||||
import java.time.format.DateTimeFormatter;
|
import java.time.format.DateTimeFormatter;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
import java.util.function.Function;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -41,11 +46,27 @@ public class InfluxdbDataHarmRateVImpl extends MppServiceImpl<RStatDataHarmRateV
|
|||||||
private final DateTimeFormatter DATE_TIME_FORMATTER = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss").withZone(ZoneId.systemDefault());
|
private final DateTimeFormatter DATE_TIME_FORMATTER = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss").withZone(ZoneId.systemDefault());
|
||||||
|
|
||||||
private final DataHarmRateVMapper dataHarmRateVMapper;
|
private final DataHarmRateVMapper dataHarmRateVMapper;
|
||||||
|
@Resource
|
||||||
|
private CsLineFeignClient csLineFeignClient;
|
||||||
|
@Resource
|
||||||
|
private EquipmentFeignClient equipmentFeignClient;
|
||||||
|
|
||||||
|
private static final Map<String, String> PHASE_MAPPING = new HashMap<String, String>() {{
|
||||||
|
put("AB", "A");
|
||||||
|
put("BC", "B");
|
||||||
|
put("CA", "C");
|
||||||
|
put("M", "T");
|
||||||
|
}};
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<DataHarmDto> getRawData(LineCountEvaluateParam lineParam) {
|
public List<DataHarmDto> getRawData(LineCountEvaluateParam lineParam) {
|
||||||
List<DataHarmDto> result = new ArrayList<>();
|
List<DataHarmDto> result = new ArrayList<>();
|
||||||
List<DataHarmrateV> list = getMinuteData(lineParam);
|
List<DataHarmrateV> list;
|
||||||
|
if (Objects.equals(lineParam.getType(), 2)) {
|
||||||
|
list = getWlMinuteData(lineParam);
|
||||||
|
} else {
|
||||||
|
list = getMinuteData(lineParam);;
|
||||||
|
}
|
||||||
list.forEach(item->{
|
list.forEach(item->{
|
||||||
DataHarmDto dto = new DataHarmDto();
|
DataHarmDto dto = new DataHarmDto();
|
||||||
BeanUtils.copyProperties(item,dto);
|
BeanUtils.copyProperties(item,dto);
|
||||||
@@ -63,9 +84,8 @@ public class InfluxdbDataHarmRateVImpl extends MppServiceImpl<RStatDataHarmRateV
|
|||||||
}
|
}
|
||||||
|
|
||||||
List<DataHarmrateV> collect = dataHarmrateVDTOList.stream().flatMap(temp -> DataHarmrateV.relationToInfluxDB(temp).stream()).collect(Collectors.toList());
|
List<DataHarmrateV> collect = dataHarmrateVDTOList.stream().flatMap(temp -> DataHarmrateV.relationToInfluxDB(temp).stream()).collect(Collectors.toList());
|
||||||
int minSize = Math.min(1200000, collect.size());
|
|
||||||
|
|
||||||
List<List<DataHarmrateV>> partition = ListUtils.partition(collect, minSize);
|
List<List<DataHarmrateV>> partition = ListUtils.partition(collect, 20000);
|
||||||
for (List<DataHarmrateV> dataHarmrateVList : partition) {
|
for (List<DataHarmrateV> dataHarmrateVList : partition) {
|
||||||
List<DataHarmrateV> sublistAsOriginalListType = new ArrayList<>(dataHarmrateVList);
|
List<DataHarmrateV> sublistAsOriginalListType = new ArrayList<>(dataHarmrateVList);
|
||||||
|
|
||||||
@@ -77,7 +97,12 @@ public class InfluxdbDataHarmRateVImpl extends MppServiceImpl<RStatDataHarmRateV
|
|||||||
@Override
|
@Override
|
||||||
public List<CommonMinuteDto> getBaseData(LineCountEvaluateParam lineParam) {
|
public List<CommonMinuteDto> getBaseData(LineCountEvaluateParam lineParam) {
|
||||||
List<CommonMinuteDto> result = new ArrayList<>();
|
List<CommonMinuteDto> result = new ArrayList<>();
|
||||||
List<DataHarmrateV> data = getMinuteData(lineParam);
|
List<DataHarmrateV> data;
|
||||||
|
if (Objects.equals(lineParam.getType(), 2)) {
|
||||||
|
data = getWlMinuteData(lineParam);
|
||||||
|
} else {
|
||||||
|
data = getMinuteData(lineParam);;
|
||||||
|
}
|
||||||
if (CollectionUtil.isNotEmpty(data)) {
|
if (CollectionUtil.isNotEmpty(data)) {
|
||||||
String time = TimeUtils.StringTimeToString(lineParam.getStartTime());
|
String time = TimeUtils.StringTimeToString(lineParam.getStartTime());
|
||||||
//以监测点分组
|
//以监测点分组
|
||||||
@@ -212,7 +237,7 @@ public class InfluxdbDataHarmRateVImpl extends MppServiceImpl<RStatDataHarmRateV
|
|||||||
@Override
|
@Override
|
||||||
public List<DataHarmDto> getGroupByTimeHarmRateV(LineCountEvaluateParam lineParam) {
|
public List<DataHarmDto> getGroupByTimeHarmRateV(LineCountEvaluateParam lineParam) {
|
||||||
InfluxQueryWrapper harmRateVQueryWrapper = new InfluxQueryWrapper(DataHarmrateV.class);
|
InfluxQueryWrapper harmRateVQueryWrapper = new InfluxQueryWrapper(DataHarmrateV.class);
|
||||||
harmRateVQueryWrapper.maxSamePrefixAndSuffix(InfluxDbSqlConstant.V, "", HarmonicTimesUtil.harmonicTimesList(2, 50, 1));
|
harmRateVQueryWrapper.maxSamePrefixAndSuffix(InfluxDbSqlConstant.V, InfluxDbSqlConstant.V, HarmonicTimesUtil.harmonicTimesList(2, 50, 1));
|
||||||
harmRateVQueryWrapper.regular(DataV::getLineId, lineParam.getLineId())
|
harmRateVQueryWrapper.regular(DataV::getLineId, lineParam.getLineId())
|
||||||
.eq(DataHarmrateV::getValueType, InfluxDbSqlConstant.CP95)
|
.eq(DataHarmrateV::getValueType, InfluxDbSqlConstant.CP95)
|
||||||
.ne(DataHarmrateV::getPhasicType, InfluxDBTableConstant.PHASE_TYPE_T)
|
.ne(DataHarmrateV::getPhasicType, InfluxDBTableConstant.PHASE_TYPE_T)
|
||||||
@@ -240,7 +265,7 @@ public class InfluxdbDataHarmRateVImpl extends MppServiceImpl<RStatDataHarmRateV
|
|||||||
List<DataHarmrateV> dataList;
|
List<DataHarmrateV> dataList;
|
||||||
List<DataHarmrateV> result = new ArrayList<>();
|
List<DataHarmrateV> result = new ArrayList<>();
|
||||||
InfluxQueryWrapper influxQueryWrapper = new InfluxQueryWrapper(DataHarmrateV.class);
|
InfluxQueryWrapper influxQueryWrapper = new InfluxQueryWrapper(DataHarmrateV.class);
|
||||||
influxQueryWrapper.samePrefixAndSuffix(InfluxDbSqlConstant.V, "", HarmonicTimesUtil.harmonicTimesList(1, 50, 1));
|
influxQueryWrapper.samePrefixAndSuffix(InfluxDbSqlConstant.V, InfluxDbSqlConstant.V, HarmonicTimesUtil.harmonicTimesList(1, 50, 1));
|
||||||
influxQueryWrapper.regular(DataHarmrateV::getLineId, lineParam.getLineId())
|
influxQueryWrapper.regular(DataHarmrateV::getLineId, lineParam.getLineId())
|
||||||
.select(DataHarmrateV::getLineId)
|
.select(DataHarmrateV::getLineId)
|
||||||
.select(DataHarmrateV::getPhasicType)
|
.select(DataHarmrateV::getPhasicType)
|
||||||
@@ -292,4 +317,56 @@ public class InfluxdbDataHarmRateVImpl extends MppServiceImpl<RStatDataHarmRateV
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public List<DataHarmrateV> getWlMinuteData(LineCountEvaluateParam lineParam) {
|
||||||
|
List<DataHarmrateV> result = new ArrayList<>();
|
||||||
|
if (CollectionUtil.isNotEmpty(lineParam.getLineId())) {
|
||||||
|
//获取监测点信息
|
||||||
|
List<CsLinePO> line = csLineFeignClient.queryLineById(lineParam.getLineId()).getData();
|
||||||
|
Map<String, CsLinePO> lineMap = line.stream().collect(Collectors.toMap(CsLinePO::getLineId, Function.identity()));
|
||||||
|
//获取设备信息
|
||||||
|
List<String> devList = line.stream().map(CsLinePO::getDeviceId).distinct().collect(Collectors.toList());
|
||||||
|
List<CsEquipmentDeliveryDTO> dev = equipmentFeignClient.queryDeviceById(devList).getData();
|
||||||
|
Map<String, CsEquipmentDeliveryDTO> devsMap = dev.stream().collect(Collectors.toMap(CsEquipmentDeliveryDTO::getId, Function.identity()));
|
||||||
|
lineParam.getLineId().forEach(lineId -> {
|
||||||
|
String devId = lineMap.get(lineId).getDeviceId();
|
||||||
|
CsLinePO po = lineMap.get(lineId);
|
||||||
|
InfluxQueryWrapper influxQueryWrapper = new InfluxQueryWrapper(DataHarmrateV.class);
|
||||||
|
influxQueryWrapper.eq(DataHarmrateV::getLineId, lineId)
|
||||||
|
.eq(DataHarmrateV::getProcess,Integer.toString(devsMap.get(devId).getProcess()))
|
||||||
|
.select(DataHarmrateV::getLineId)
|
||||||
|
.select(DataHarmrateV::getPhasicType)
|
||||||
|
.select(DataHarmrateV::getValueType)
|
||||||
|
.between(DataHarmrateV::getTime, lineParam.getStartTime(), lineParam.getEndTime())
|
||||||
|
.eq(DataHarmrateV::getQualityFlag, "0");
|
||||||
|
if (Objects.isNull(po.getLineNo())) {
|
||||||
|
influxQueryWrapper.eq(DataHarmrateV::getCldid,Integer.toString(po.getClDid()));
|
||||||
|
} else {
|
||||||
|
influxQueryWrapper.eq(DataHarmrateV::getCldid,Integer.toString(po.getLineNo()));
|
||||||
|
}
|
||||||
|
//判断接线方式 (0-星型 1-角型 2-V型) 星型是相电压 角型或者v型是线电压
|
||||||
|
if (Objects.equals(po.getConType(),0)) {
|
||||||
|
//相电压基波有效值
|
||||||
|
influxQueryWrapper.select("Pq_RmsFundU_","v_1");
|
||||||
|
//2-50次 相电压谐波含有率
|
||||||
|
influxQueryWrapper.samePrefixAndSuffix("Pq_HarmU_", "v_", HarmonicTimesUtil.harmonicTimesList(2, 50, 1));
|
||||||
|
} else {
|
||||||
|
//线电压基波有效值
|
||||||
|
influxQueryWrapper.select("Pq_RmsFundLU_","v_1");
|
||||||
|
//2-50次 线电压谐波含有率
|
||||||
|
influxQueryWrapper.samePrefixAndSuffix("Pq_HarmLU_", "v_", HarmonicTimesUtil.harmonicTimesList(2, 50, 1));
|
||||||
|
}
|
||||||
|
result.addAll(dataHarmRateVMapper.selectByQueryWrapper(influxQueryWrapper));
|
||||||
|
});
|
||||||
|
if (CollectionUtil.isNotEmpty(result)) {
|
||||||
|
result.forEach(item -> {
|
||||||
|
String newType = PHASE_MAPPING.get(item.getPhasicType());
|
||||||
|
if (newType != null) {
|
||||||
|
item.setPhasicType(newType);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,6 +4,10 @@ import cn.hutool.core.collection.CollUtil;
|
|||||||
import cn.hutool.core.collection.CollectionUtil;
|
import cn.hutool.core.collection.CollectionUtil;
|
||||||
import com.github.jeffreyning.mybatisplus.service.MppServiceImpl;
|
import com.github.jeffreyning.mybatisplus.service.MppServiceImpl;
|
||||||
import com.njcn.common.utils.HarmonicTimesUtil;
|
import com.njcn.common.utils.HarmonicTimesUtil;
|
||||||
|
import com.njcn.csdevice.api.CsLineFeignClient;
|
||||||
|
import com.njcn.csdevice.api.EquipmentFeignClient;
|
||||||
|
import com.njcn.csdevice.pojo.dto.CsEquipmentDeliveryDTO;
|
||||||
|
import com.njcn.csdevice.pojo.po.CsLinePO;
|
||||||
import com.njcn.dataProcess.dao.imapper.DataHarmphasicIMapper;
|
import com.njcn.dataProcess.dao.imapper.DataHarmphasicIMapper;
|
||||||
import com.njcn.dataProcess.dao.relation.mapper.RStatDataHarmPhasicIRelationMapper;
|
import com.njcn.dataProcess.dao.relation.mapper.RStatDataHarmPhasicIRelationMapper;
|
||||||
import com.njcn.dataProcess.dto.DataHarmphasicIDTO;
|
import com.njcn.dataProcess.dto.DataHarmphasicIDTO;
|
||||||
@@ -21,10 +25,12 @@ import org.apache.commons.collections4.ListUtils;
|
|||||||
import org.springframework.beans.BeanUtils;
|
import org.springframework.beans.BeanUtils;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
import java.time.ZoneId;
|
import java.time.ZoneId;
|
||||||
import java.time.format.DateTimeFormatter;
|
import java.time.format.DateTimeFormatter;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
import java.util.function.Function;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -40,6 +46,17 @@ public class InfluxdbDataHarmphasicIImpl extends MppServiceImpl<RStatDataHarmPha
|
|||||||
|
|
||||||
private final DateTimeFormatter DATE_TIME_FORMATTER = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss").withZone(ZoneId.systemDefault());
|
private final DateTimeFormatter DATE_TIME_FORMATTER = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss").withZone(ZoneId.systemDefault());
|
||||||
private final DataHarmphasicIMapper dataHarmphasicIMapper;
|
private final DataHarmphasicIMapper dataHarmphasicIMapper;
|
||||||
|
@Resource
|
||||||
|
private CsLineFeignClient csLineFeignClient;
|
||||||
|
@Resource
|
||||||
|
private EquipmentFeignClient equipmentFeignClient;
|
||||||
|
|
||||||
|
private static final Map<String, String> PHASE_MAPPING = new HashMap<String, String>() {{
|
||||||
|
put("AB", "A");
|
||||||
|
put("BC", "B");
|
||||||
|
put("CA", "C");
|
||||||
|
put("M", "T");
|
||||||
|
}};
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void batchInsertion(List<DataHarmphasicIDTO> dataHarmphasicIDTOList) {
|
public void batchInsertion(List<DataHarmphasicIDTO> dataHarmphasicIDTOList) {
|
||||||
@@ -49,9 +66,8 @@ public class InfluxdbDataHarmphasicIImpl extends MppServiceImpl<RStatDataHarmPha
|
|||||||
}
|
}
|
||||||
|
|
||||||
List<DataHarmphasicI> collect = dataHarmphasicIDTOList.stream().flatMap(temp -> DataHarmphasicI.relationToInfluxDB(temp).stream()).collect(Collectors.toList());
|
List<DataHarmphasicI> collect = dataHarmphasicIDTOList.stream().flatMap(temp -> DataHarmphasicI.relationToInfluxDB(temp).stream()).collect(Collectors.toList());
|
||||||
int minSize = Math.min(1200000, collect.size());
|
|
||||||
|
|
||||||
List<List<DataHarmphasicI>> partition = ListUtils.partition(collect, minSize);
|
List<List<DataHarmphasicI>> partition = ListUtils.partition(collect, 20000);
|
||||||
for (List<DataHarmphasicI> dataHarmphasicIList : partition) {
|
for (List<DataHarmphasicI> dataHarmphasicIList : partition) {
|
||||||
List<DataHarmphasicI> sublistAsOriginalListType = new ArrayList<>(dataHarmphasicIList);
|
List<DataHarmphasicI> sublistAsOriginalListType = new ArrayList<>(dataHarmphasicIList);
|
||||||
dataHarmphasicIMapper.insertBatch(sublistAsOriginalListType);
|
dataHarmphasicIMapper.insertBatch(sublistAsOriginalListType);
|
||||||
@@ -62,7 +78,12 @@ public class InfluxdbDataHarmphasicIImpl extends MppServiceImpl<RStatDataHarmPha
|
|||||||
@Override
|
@Override
|
||||||
public List<DataHarmPhasicIDto> getRawData(LineCountEvaluateParam lineParam) {
|
public List<DataHarmPhasicIDto> getRawData(LineCountEvaluateParam lineParam) {
|
||||||
List<DataHarmPhasicIDto> result = new ArrayList<>();
|
List<DataHarmPhasicIDto> result = new ArrayList<>();
|
||||||
List<DataHarmphasicI> list = getMinuteData(lineParam.getLineId(), lineParam.getStartTime(), lineParam.getEndTime(), lineParam.getAbnormalTime(),lineParam.getDataType());
|
List<DataHarmphasicI> list;
|
||||||
|
if (Objects.equals(lineParam.getType(), 2)) {
|
||||||
|
list = getWlMinuteData(lineParam.getLineId(), lineParam.getStartTime(), lineParam.getEndTime(), lineParam.getAbnormalTime(),lineParam.getDataType());
|
||||||
|
} else {
|
||||||
|
list = getMinuteData(lineParam.getLineId(), lineParam.getStartTime(), lineParam.getEndTime(), lineParam.getAbnormalTime(),lineParam.getDataType());
|
||||||
|
}
|
||||||
list.forEach(item->{
|
list.forEach(item->{
|
||||||
DataHarmPhasicIDto dto = new DataHarmPhasicIDto();
|
DataHarmPhasicIDto dto = new DataHarmPhasicIDto();
|
||||||
BeanUtils.copyProperties(item,dto);
|
BeanUtils.copyProperties(item,dto);
|
||||||
@@ -75,7 +96,12 @@ public class InfluxdbDataHarmphasicIImpl extends MppServiceImpl<RStatDataHarmPha
|
|||||||
@Override
|
@Override
|
||||||
public List<CommonMinuteDto> getBaseData(LineCountEvaluateParam lineParam) {
|
public List<CommonMinuteDto> getBaseData(LineCountEvaluateParam lineParam) {
|
||||||
List<CommonMinuteDto> result = new ArrayList<>();
|
List<CommonMinuteDto> result = new ArrayList<>();
|
||||||
List<DataHarmphasicI> data = getMinuteData(lineParam.getLineId(), lineParam.getStartTime(), lineParam.getEndTime(),lineParam.getAbnormalTime(),lineParam.getDataType());
|
List<DataHarmphasicI> data;
|
||||||
|
if (Objects.equals(lineParam.getType(), 2)) {
|
||||||
|
data = getWlMinuteData(lineParam.getLineId(), lineParam.getStartTime(), lineParam.getEndTime(), lineParam.getAbnormalTime(),lineParam.getDataType());
|
||||||
|
} else {
|
||||||
|
data = getMinuteData(lineParam.getLineId(), lineParam.getStartTime(), lineParam.getEndTime(), lineParam.getAbnormalTime(),lineParam.getDataType());
|
||||||
|
}
|
||||||
if (CollectionUtil.isNotEmpty(data)) {
|
if (CollectionUtil.isNotEmpty(data)) {
|
||||||
String time = TimeUtils.StringTimeToString(lineParam.getStartTime());
|
String time = TimeUtils.StringTimeToString(lineParam.getStartTime());
|
||||||
//以监测点分组
|
//以监测点分组
|
||||||
@@ -197,7 +223,7 @@ public class InfluxdbDataHarmphasicIImpl extends MppServiceImpl<RStatDataHarmPha
|
|||||||
List<DataHarmphasicI> dataList;
|
List<DataHarmphasicI> dataList;
|
||||||
List<DataHarmphasicI> result = new ArrayList<>();
|
List<DataHarmphasicI> result = new ArrayList<>();
|
||||||
InfluxQueryWrapper influxQueryWrapper = new InfluxQueryWrapper(DataHarmphasicI.class);
|
InfluxQueryWrapper influxQueryWrapper = new InfluxQueryWrapper(DataHarmphasicI.class);
|
||||||
influxQueryWrapper.samePrefixAndSuffix(InfluxDbSqlConstant.I, "", HarmonicTimesUtil.harmonicTimesList(1, 50, 1));
|
influxQueryWrapper.samePrefixAndSuffix(InfluxDbSqlConstant.I, InfluxDbSqlConstant.I, HarmonicTimesUtil.harmonicTimesList(1, 50, 1));
|
||||||
influxQueryWrapper.regular(DataHarmphasicI::getLineId, lineList)
|
influxQueryWrapper.regular(DataHarmphasicI::getLineId, lineList)
|
||||||
.select(DataHarmphasicI::getLineId)
|
.select(DataHarmphasicI::getLineId)
|
||||||
.select(DataHarmphasicI::getPhasicType)
|
.select(DataHarmphasicI::getPhasicType)
|
||||||
@@ -245,4 +271,48 @@ public class InfluxdbDataHarmphasicIImpl extends MppServiceImpl<RStatDataHarmPha
|
|||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public List<DataHarmphasicI> getWlMinuteData(List<String> lineList, String startTime, String endTime, Map<String,List<String>> timeMap,Boolean dataType) {
|
||||||
|
List<DataHarmphasicI> result = new ArrayList<>();
|
||||||
|
if (CollectionUtil.isNotEmpty(lineList)) {
|
||||||
|
//获取监测点信息
|
||||||
|
List<CsLinePO> line = csLineFeignClient.queryLineById(lineList).getData();
|
||||||
|
Map<String, CsLinePO> lineMap = line.stream().collect(Collectors.toMap(CsLinePO::getLineId, Function.identity()));
|
||||||
|
//获取设备信息
|
||||||
|
List<String> devList = line.stream().map(CsLinePO::getDeviceId).distinct().collect(Collectors.toList());
|
||||||
|
List<CsEquipmentDeliveryDTO> dev = equipmentFeignClient.queryDeviceById(devList).getData();
|
||||||
|
Map<String, CsEquipmentDeliveryDTO> devsMap = dev.stream().collect(Collectors.toMap(CsEquipmentDeliveryDTO::getId, Function.identity()));
|
||||||
|
lineList.forEach(lineId -> {
|
||||||
|
String devId = lineMap.get(lineId).getDeviceId();
|
||||||
|
CsLinePO po = lineMap.get(lineId);
|
||||||
|
InfluxQueryWrapper influxQueryWrapper = new InfluxQueryWrapper(DataHarmphasicI.class);
|
||||||
|
//谐波电流幅值相角
|
||||||
|
influxQueryWrapper.samePrefixAndSuffix("Pq_HarmIAng_", "i_", HarmonicTimesUtil.harmonicTimesList(2, 50, 1));
|
||||||
|
influxQueryWrapper.eq(DataHarmphasicI::getLineId, lineId)
|
||||||
|
.eq(DataHarmphasicI::getProcess,Integer.toString(devsMap.get(devId).getProcess()))
|
||||||
|
.select(DataHarmphasicI::getLineId)
|
||||||
|
.select(DataHarmphasicI::getPhasicType)
|
||||||
|
.select(DataHarmphasicI::getValueType)
|
||||||
|
//基波电流相角
|
||||||
|
.select("Pq_FundIAng","i_1")
|
||||||
|
.between(DataHarmphasicI::getTime, startTime, endTime)
|
||||||
|
.eq(DataHarmphasicI::getQualityFlag, "0");
|
||||||
|
if (Objects.isNull(po.getLineNo())) {
|
||||||
|
influxQueryWrapper.eq(DataHarmphasicI::getCldid,Integer.toString(po.getClDid()));
|
||||||
|
} else {
|
||||||
|
influxQueryWrapper.eq(DataHarmphasicI::getCldid,Integer.toString(po.getLineNo()));
|
||||||
|
}
|
||||||
|
result.addAll(dataHarmphasicIMapper.selectByQueryWrapper(influxQueryWrapper));
|
||||||
|
});
|
||||||
|
if (CollectionUtil.isNotEmpty(result)) {
|
||||||
|
result.forEach(item -> {
|
||||||
|
String newType = PHASE_MAPPING.get(item.getPhasicType());
|
||||||
|
if (newType != null) {
|
||||||
|
item.setPhasicType(newType);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,10 +4,15 @@ import cn.hutool.core.collection.CollUtil;
|
|||||||
import cn.hutool.core.collection.CollectionUtil;
|
import cn.hutool.core.collection.CollectionUtil;
|
||||||
import com.github.jeffreyning.mybatisplus.service.MppServiceImpl;
|
import com.github.jeffreyning.mybatisplus.service.MppServiceImpl;
|
||||||
import com.njcn.common.utils.HarmonicTimesUtil;
|
import com.njcn.common.utils.HarmonicTimesUtil;
|
||||||
|
import com.njcn.csdevice.api.CsLineFeignClient;
|
||||||
|
import com.njcn.csdevice.api.EquipmentFeignClient;
|
||||||
|
import com.njcn.csdevice.pojo.dto.CsEquipmentDeliveryDTO;
|
||||||
|
import com.njcn.csdevice.pojo.po.CsLinePO;
|
||||||
import com.njcn.dataProcess.dao.imapper.DataHarmphasicVMapper;
|
import com.njcn.dataProcess.dao.imapper.DataHarmphasicVMapper;
|
||||||
import com.njcn.dataProcess.dao.relation.mapper.RStatDataHarmPhasicVRelationMapper;
|
import com.njcn.dataProcess.dao.relation.mapper.RStatDataHarmPhasicVRelationMapper;
|
||||||
import com.njcn.dataProcess.dto.DataHarmphasicVDTO;
|
import com.njcn.dataProcess.dto.DataHarmphasicVDTO;
|
||||||
import com.njcn.dataProcess.param.LineCountEvaluateParam;
|
import com.njcn.dataProcess.param.LineCountEvaluateParam;
|
||||||
|
import com.njcn.dataProcess.po.influx.DataHarmphasicI;
|
||||||
import com.njcn.dataProcess.po.influx.DataHarmphasicV;
|
import com.njcn.dataProcess.po.influx.DataHarmphasicV;
|
||||||
import com.njcn.dataProcess.pojo.dto.CommonMinuteDto;
|
import com.njcn.dataProcess.pojo.dto.CommonMinuteDto;
|
||||||
import com.njcn.dataProcess.pojo.dto.DataHarmDto;
|
import com.njcn.dataProcess.pojo.dto.DataHarmDto;
|
||||||
@@ -22,10 +27,12 @@ import org.apache.commons.collections4.ListUtils;
|
|||||||
import org.springframework.beans.BeanUtils;
|
import org.springframework.beans.BeanUtils;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
import java.time.ZoneId;
|
import java.time.ZoneId;
|
||||||
import java.time.format.DateTimeFormatter;
|
import java.time.format.DateTimeFormatter;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
import java.util.function.Function;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -42,6 +49,17 @@ public class InfluxdbDataHarmphasicVImpl extends MppServiceImpl<RStatDataHarmPha
|
|||||||
private final DateTimeFormatter DATE_TIME_FORMATTER = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss").withZone(ZoneId.systemDefault());
|
private final DateTimeFormatter DATE_TIME_FORMATTER = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss").withZone(ZoneId.systemDefault());
|
||||||
|
|
||||||
private final DataHarmphasicVMapper dataHarmphasicVMapper;
|
private final DataHarmphasicVMapper dataHarmphasicVMapper;
|
||||||
|
@Resource
|
||||||
|
private CsLineFeignClient csLineFeignClient;
|
||||||
|
@Resource
|
||||||
|
private EquipmentFeignClient equipmentFeignClient;
|
||||||
|
|
||||||
|
private static final Map<String, String> PHASE_MAPPING = new HashMap<String, String>() {{
|
||||||
|
put("AB", "A");
|
||||||
|
put("BC", "B");
|
||||||
|
put("CA", "C");
|
||||||
|
put("M", "T");
|
||||||
|
}};
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -52,9 +70,8 @@ public class InfluxdbDataHarmphasicVImpl extends MppServiceImpl<RStatDataHarmPha
|
|||||||
}
|
}
|
||||||
|
|
||||||
List<DataHarmphasicV> collect = dataHarmphasicVDTOList.stream().flatMap(temp -> DataHarmphasicV.relationToInfluxDB(temp).stream()).collect(Collectors.toList());
|
List<DataHarmphasicV> collect = dataHarmphasicVDTOList.stream().flatMap(temp -> DataHarmphasicV.relationToInfluxDB(temp).stream()).collect(Collectors.toList());
|
||||||
int minSize = Math.min(1200000, collect.size());
|
|
||||||
|
|
||||||
List<List<DataHarmphasicV>> partition = ListUtils.partition(collect, minSize);
|
List<List<DataHarmphasicV>> partition = ListUtils.partition(collect, 20000);
|
||||||
for (List<DataHarmphasicV> dataHarmphasicVList : partition) {
|
for (List<DataHarmphasicV> dataHarmphasicVList : partition) {
|
||||||
List<DataHarmphasicV> sublistAsOriginalListType = new ArrayList<>(dataHarmphasicVList);
|
List<DataHarmphasicV> sublistAsOriginalListType = new ArrayList<>(dataHarmphasicVList);
|
||||||
|
|
||||||
@@ -66,7 +83,12 @@ public class InfluxdbDataHarmphasicVImpl extends MppServiceImpl<RStatDataHarmPha
|
|||||||
@Override
|
@Override
|
||||||
public List<DataHarmDto> getRawData(LineCountEvaluateParam lineParam) {
|
public List<DataHarmDto> getRawData(LineCountEvaluateParam lineParam) {
|
||||||
List<DataHarmDto> result = new ArrayList<>();
|
List<DataHarmDto> result = new ArrayList<>();
|
||||||
List<DataHarmphasicV> list = getMinuteData(lineParam.getLineId(), lineParam.getStartTime(), lineParam.getEndTime(), lineParam.getAbnormalTime(),lineParam.getDataType());
|
List<DataHarmphasicV> list;
|
||||||
|
if (Objects.equals(lineParam.getType(), 2)) {
|
||||||
|
list = getWlMinuteData(lineParam.getLineId(), lineParam.getStartTime(), lineParam.getEndTime(), lineParam.getAbnormalTime(),lineParam.getDataType());
|
||||||
|
} else {
|
||||||
|
list = getMinuteData(lineParam.getLineId(), lineParam.getStartTime(), lineParam.getEndTime(), lineParam.getAbnormalTime(),lineParam.getDataType());
|
||||||
|
}
|
||||||
list.forEach(item->{
|
list.forEach(item->{
|
||||||
DataHarmDto dto = new DataHarmDto();
|
DataHarmDto dto = new DataHarmDto();
|
||||||
BeanUtils.copyProperties(item,dto);
|
BeanUtils.copyProperties(item,dto);
|
||||||
@@ -79,7 +101,12 @@ public class InfluxdbDataHarmphasicVImpl extends MppServiceImpl<RStatDataHarmPha
|
|||||||
@Override
|
@Override
|
||||||
public List<CommonMinuteDto> getBaseData(LineCountEvaluateParam lineParam) {
|
public List<CommonMinuteDto> getBaseData(LineCountEvaluateParam lineParam) {
|
||||||
List<CommonMinuteDto> result = new ArrayList<>();
|
List<CommonMinuteDto> result = new ArrayList<>();
|
||||||
List<DataHarmphasicV> data = getMinuteData(lineParam.getLineId(), lineParam.getStartTime(), lineParam.getEndTime(),lineParam.getAbnormalTime(),lineParam.getDataType());
|
List<DataHarmphasicV> data;
|
||||||
|
if (Objects.equals(lineParam.getType(), 2)) {
|
||||||
|
data = getWlMinuteData(lineParam.getLineId(), lineParam.getStartTime(), lineParam.getEndTime(), lineParam.getAbnormalTime(),lineParam.getDataType());
|
||||||
|
} else {
|
||||||
|
data = getMinuteData(lineParam.getLineId(), lineParam.getStartTime(), lineParam.getEndTime(), lineParam.getAbnormalTime(),lineParam.getDataType());
|
||||||
|
}
|
||||||
if (CollectionUtil.isNotEmpty(data)) {
|
if (CollectionUtil.isNotEmpty(data)) {
|
||||||
String time = TimeUtils.StringTimeToString(lineParam.getStartTime());
|
String time = TimeUtils.StringTimeToString(lineParam.getStartTime());
|
||||||
//以监测点分组
|
//以监测点分组
|
||||||
@@ -201,7 +228,7 @@ public class InfluxdbDataHarmphasicVImpl extends MppServiceImpl<RStatDataHarmPha
|
|||||||
List<DataHarmphasicV> dataList;
|
List<DataHarmphasicV> dataList;
|
||||||
List<DataHarmphasicV> result = new ArrayList<>();
|
List<DataHarmphasicV> result = new ArrayList<>();
|
||||||
InfluxQueryWrapper influxQueryWrapper = new InfluxQueryWrapper(DataHarmphasicV.class);
|
InfluxQueryWrapper influxQueryWrapper = new InfluxQueryWrapper(DataHarmphasicV.class);
|
||||||
influxQueryWrapper.samePrefixAndSuffix(InfluxDbSqlConstant.V, "", HarmonicTimesUtil.harmonicTimesList(1, 50, 1));
|
influxQueryWrapper.samePrefixAndSuffix(InfluxDbSqlConstant.V, InfluxDbSqlConstant.V, HarmonicTimesUtil.harmonicTimesList(1, 50, 1));
|
||||||
influxQueryWrapper.regular(DataHarmphasicV::getLineId, lineList)
|
influxQueryWrapper.regular(DataHarmphasicV::getLineId, lineList)
|
||||||
.select(DataHarmphasicV::getLineId)
|
.select(DataHarmphasicV::getLineId)
|
||||||
.select(DataHarmphasicV::getPhasicType)
|
.select(DataHarmphasicV::getPhasicType)
|
||||||
@@ -249,4 +276,57 @@ public class InfluxdbDataHarmphasicVImpl extends MppServiceImpl<RStatDataHarmPha
|
|||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public List<DataHarmphasicV> getWlMinuteData(List<String> lineList, String startTime, String endTime, Map<String,List<String>> timeMap, Boolean dataType) {
|
||||||
|
List<DataHarmphasicV> result = new ArrayList<>();
|
||||||
|
if (CollectionUtil.isNotEmpty(lineList)) {
|
||||||
|
//获取监测点信息
|
||||||
|
List<CsLinePO> line = csLineFeignClient.queryLineById(lineList).getData();
|
||||||
|
Map<String, CsLinePO> lineMap = line.stream().collect(Collectors.toMap(CsLinePO::getLineId, Function.identity()));
|
||||||
|
//获取设备信息
|
||||||
|
List<String> devList = line.stream().map(CsLinePO::getDeviceId).distinct().collect(Collectors.toList());
|
||||||
|
List<CsEquipmentDeliveryDTO> dev = equipmentFeignClient.queryDeviceById(devList).getData();
|
||||||
|
Map<String, CsEquipmentDeliveryDTO> devsMap = dev.stream().collect(Collectors.toMap(CsEquipmentDeliveryDTO::getId, Function.identity()));
|
||||||
|
lineList.forEach(lineId -> {
|
||||||
|
String devId = lineMap.get(lineId).getDeviceId();
|
||||||
|
CsLinePO po = lineMap.get(lineId);
|
||||||
|
InfluxQueryWrapper influxQueryWrapper = new InfluxQueryWrapper(DataHarmphasicV.class);
|
||||||
|
influxQueryWrapper.eq(DataHarmphasicV::getLineId, lineId)
|
||||||
|
.eq(DataHarmphasicV::getProcess,Integer.toString(devsMap.get(devId).getProcess()))
|
||||||
|
.select(DataHarmphasicV::getLineId)
|
||||||
|
.select(DataHarmphasicV::getPhasicType)
|
||||||
|
.select(DataHarmphasicV::getValueType)
|
||||||
|
.between(DataHarmphasicV::getTime, startTime, endTime)
|
||||||
|
.eq(DataHarmphasicV::getQualityFlag, "0");
|
||||||
|
if (Objects.isNull(po.getLineNo())) {
|
||||||
|
influxQueryWrapper.eq(DataHarmphasicV::getCldid,Integer.toString(po.getClDid()));
|
||||||
|
} else {
|
||||||
|
influxQueryWrapper.eq(DataHarmphasicV::getCldid,Integer.toString(po.getLineNo()));
|
||||||
|
}
|
||||||
|
//判断接线方式 (0-星型 1-角型 2-V型) 星型是相电压 角型或者v型是线电压
|
||||||
|
if (Objects.equals(po.getConType(),0)) {
|
||||||
|
//相电压基波有效值相角
|
||||||
|
influxQueryWrapper.select("Pq_FundUAng","v_1");
|
||||||
|
//2-50次 相电压谐波相角
|
||||||
|
influxQueryWrapper.samePrefixAndSuffix("Pq_HarmUAng_", "v_", HarmonicTimesUtil.harmonicTimesList(2, 50, 1));
|
||||||
|
} else {
|
||||||
|
//线电压基波有效值相角
|
||||||
|
influxQueryWrapper.select("Pq_FundLUAng","v_1");
|
||||||
|
//2-50次 线电压谐波相角
|
||||||
|
influxQueryWrapper.samePrefixAndSuffix("Pq_HarmLUAng_", "v_", HarmonicTimesUtil.harmonicTimesList(2, 50, 1));
|
||||||
|
}
|
||||||
|
result.addAll(dataHarmphasicVMapper.selectByQueryWrapper(influxQueryWrapper));
|
||||||
|
});
|
||||||
|
if (CollectionUtil.isNotEmpty(result)) {
|
||||||
|
result.forEach(item -> {
|
||||||
|
String newType = PHASE_MAPPING.get(item.getPhasicType());
|
||||||
|
if (newType != null) {
|
||||||
|
item.setPhasicType(newType);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,6 +4,10 @@ import cn.hutool.core.collection.CollUtil;
|
|||||||
import cn.hutool.core.collection.CollectionUtil;
|
import cn.hutool.core.collection.CollectionUtil;
|
||||||
import com.github.jeffreyning.mybatisplus.service.MppServiceImpl;
|
import com.github.jeffreyning.mybatisplus.service.MppServiceImpl;
|
||||||
import com.njcn.common.utils.HarmonicTimesUtil;
|
import com.njcn.common.utils.HarmonicTimesUtil;
|
||||||
|
import com.njcn.csdevice.api.CsLineFeignClient;
|
||||||
|
import com.njcn.csdevice.api.EquipmentFeignClient;
|
||||||
|
import com.njcn.csdevice.pojo.dto.CsEquipmentDeliveryDTO;
|
||||||
|
import com.njcn.csdevice.pojo.po.CsLinePO;
|
||||||
import com.njcn.dataProcess.dao.imapper.DataHarmpowerPMapper;
|
import com.njcn.dataProcess.dao.imapper.DataHarmpowerPMapper;
|
||||||
import com.njcn.dataProcess.dao.relation.mapper.RStatDataHarmPowerPRelationMapper;
|
import com.njcn.dataProcess.dao.relation.mapper.RStatDataHarmPowerPRelationMapper;
|
||||||
import com.njcn.dataProcess.dto.DataHarmpowerPDTO;
|
import com.njcn.dataProcess.dto.DataHarmpowerPDTO;
|
||||||
@@ -22,10 +26,13 @@ import org.apache.commons.collections4.ListUtils;
|
|||||||
import org.springframework.beans.BeanUtils;
|
import org.springframework.beans.BeanUtils;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import java.lang.reflect.Method;
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
import java.time.ZoneId;
|
import java.time.ZoneId;
|
||||||
import java.time.format.DateTimeFormatter;
|
import java.time.format.DateTimeFormatter;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
import java.util.function.Function;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -42,6 +49,17 @@ public class InfluxdbDataHarmpowerPImpl extends MppServiceImpl<RStatDataHarmPowe
|
|||||||
private final DateTimeFormatter DATE_TIME_FORMATTER = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss").withZone(ZoneId.systemDefault());
|
private final DateTimeFormatter DATE_TIME_FORMATTER = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss").withZone(ZoneId.systemDefault());
|
||||||
|
|
||||||
private final DataHarmpowerPMapper dataHarmpowerPMapper;
|
private final DataHarmpowerPMapper dataHarmpowerPMapper;
|
||||||
|
@Resource
|
||||||
|
private CsLineFeignClient csLineFeignClient;
|
||||||
|
@Resource
|
||||||
|
private EquipmentFeignClient equipmentFeignClient;
|
||||||
|
|
||||||
|
private static final Map<String, String> PHASE_MAPPING = new HashMap<String, String>() {{
|
||||||
|
put("AB", "A");
|
||||||
|
put("BC", "B");
|
||||||
|
put("CA", "C");
|
||||||
|
put("M", "T");
|
||||||
|
}};
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -51,9 +69,8 @@ public class InfluxdbDataHarmpowerPImpl extends MppServiceImpl<RStatDataHarmPowe
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
List<DataHarmpowerP> collect = dataHarmpowerPDTOList.stream().flatMap(temp -> DataHarmpowerP.relationToInfluxDB(temp).stream()).collect(Collectors.toList());
|
List<DataHarmpowerP> collect = dataHarmpowerPDTOList.stream().flatMap(temp -> DataHarmpowerP.relationToInfluxDB(temp).stream()).collect(Collectors.toList());
|
||||||
int minSize = Math.min(1200000, collect.size());
|
|
||||||
|
|
||||||
List<List<DataHarmpowerP>> partition = ListUtils.partition(collect, minSize);
|
List<List<DataHarmpowerP>> partition = ListUtils.partition(collect, 20000);
|
||||||
for (List<DataHarmpowerP> dataHarmpowerPList : partition) {
|
for (List<DataHarmpowerP> dataHarmpowerPList : partition) {
|
||||||
List<DataHarmpowerP> sublistAsOriginalListType = new ArrayList<>(dataHarmpowerPList);
|
List<DataHarmpowerP> sublistAsOriginalListType = new ArrayList<>(dataHarmpowerPList);
|
||||||
|
|
||||||
@@ -65,7 +82,12 @@ public class InfluxdbDataHarmpowerPImpl extends MppServiceImpl<RStatDataHarmPowe
|
|||||||
@Override
|
@Override
|
||||||
public List<DataPowerPDto> getRawData(LineCountEvaluateParam lineParam) {
|
public List<DataPowerPDto> getRawData(LineCountEvaluateParam lineParam) {
|
||||||
List<DataPowerPDto> result = new ArrayList<>();
|
List<DataPowerPDto> result = new ArrayList<>();
|
||||||
List<DataHarmpowerP> list = getMinuteData(lineParam.getLineId(), lineParam.getStartTime(), lineParam.getEndTime(), lineParam.getAbnormalTime(), lineParam.getDataType());
|
List<DataHarmpowerP> list;
|
||||||
|
if (Objects.equals(lineParam.getType(), 2)) {
|
||||||
|
list = getWlMinuteData(lineParam.getLineId(), lineParam.getStartTime(), lineParam.getEndTime(), lineParam.getAbnormalTime(),lineParam.getDataType());
|
||||||
|
} else {
|
||||||
|
list = getMinuteData(lineParam.getLineId(), lineParam.getStartTime(), lineParam.getEndTime(), lineParam.getAbnormalTime(),lineParam.getDataType());
|
||||||
|
}
|
||||||
list.forEach(item->{
|
list.forEach(item->{
|
||||||
DataPowerPDto dto = new DataPowerPDto();
|
DataPowerPDto dto = new DataPowerPDto();
|
||||||
BeanUtils.copyProperties(item,dto);
|
BeanUtils.copyProperties(item,dto);
|
||||||
@@ -78,7 +100,12 @@ public class InfluxdbDataHarmpowerPImpl extends MppServiceImpl<RStatDataHarmPowe
|
|||||||
@Override
|
@Override
|
||||||
public List<CommonMinuteDto> getBaseData(LineCountEvaluateParam lineParam) {
|
public List<CommonMinuteDto> getBaseData(LineCountEvaluateParam lineParam) {
|
||||||
List<CommonMinuteDto> result = new ArrayList<>();
|
List<CommonMinuteDto> result = new ArrayList<>();
|
||||||
List<DataHarmpowerP> data = getMinuteData(lineParam.getLineId(), lineParam.getStartTime(), lineParam.getEndTime(),lineParam.getAbnormalTime(), lineParam.getDataType());
|
List<DataHarmpowerP> data;
|
||||||
|
if (Objects.equals(lineParam.getType(), 2)) {
|
||||||
|
data = getWlMinuteData(lineParam.getLineId(), lineParam.getStartTime(), lineParam.getEndTime(), lineParam.getAbnormalTime(),lineParam.getDataType());
|
||||||
|
} else {
|
||||||
|
data = getMinuteData(lineParam.getLineId(), lineParam.getStartTime(), lineParam.getEndTime(), lineParam.getAbnormalTime(),lineParam.getDataType());
|
||||||
|
}
|
||||||
if (CollectionUtil.isNotEmpty(data)) {
|
if (CollectionUtil.isNotEmpty(data)) {
|
||||||
String time = TimeUtils.StringTimeToString(lineParam.getStartTime());
|
String time = TimeUtils.StringTimeToString(lineParam.getStartTime());
|
||||||
//以监测点分组
|
//以监测点分组
|
||||||
@@ -100,68 +127,12 @@ public class InfluxdbDataHarmpowerPImpl extends MppServiceImpl<RStatDataHarmPowe
|
|||||||
valueTypeMap.forEach((valueType,valueTypeList)->{
|
valueTypeMap.forEach((valueType,valueTypeList)->{
|
||||||
CommonMinuteDto.ValueType value = new CommonMinuteDto.ValueType();
|
CommonMinuteDto.ValueType value = new CommonMinuteDto.ValueType();
|
||||||
value.setValueType(valueType);
|
value.setValueType(valueType);
|
||||||
//规定好集合指标参数
|
List<List<Double>> lists;
|
||||||
List<Double> data1 = valueTypeList.stream().map(DataHarmpowerP::getDf).collect(Collectors.toList());
|
if (Objects.equals(phasicType, "T") && Objects.equals(lineParam.getType(), 2)) {
|
||||||
List<Double> data2 = valueTypeList.stream().map(DataHarmpowerP::getPf).collect(Collectors.toList());
|
lists = extractDataLists(valueTypeList, "Tot");
|
||||||
List<Double> data3 = valueTypeList.stream().map(DataHarmpowerP::getP).collect(Collectors.toList());
|
} else {
|
||||||
|
lists = extractDataLists(valueTypeList, "");
|
||||||
List<Double> data12 = valueTypeList.stream().map(DataHarmpowerP::getP1).collect(Collectors.toList());
|
}
|
||||||
List<Double> data13 = valueTypeList.stream().map(DataHarmpowerP::getP2).collect(Collectors.toList());
|
|
||||||
List<Double> data14 = valueTypeList.stream().map(DataHarmpowerP::getP3).collect(Collectors.toList());
|
|
||||||
List<Double> data15 = valueTypeList.stream().map(DataHarmpowerP::getP4).collect(Collectors.toList());
|
|
||||||
List<Double> data16 = valueTypeList.stream().map(DataHarmpowerP::getP5).collect(Collectors.toList());
|
|
||||||
List<Double> data17 = valueTypeList.stream().map(DataHarmpowerP::getP6).collect(Collectors.toList());
|
|
||||||
List<Double> data18 = valueTypeList.stream().map(DataHarmpowerP::getP7).collect(Collectors.toList());
|
|
||||||
List<Double> data19 = valueTypeList.stream().map(DataHarmpowerP::getP8).collect(Collectors.toList());
|
|
||||||
List<Double> data20 = valueTypeList.stream().map(DataHarmpowerP::getP9).collect(Collectors.toList());
|
|
||||||
List<Double> data21 = valueTypeList.stream().map(DataHarmpowerP::getP10).collect(Collectors.toList());
|
|
||||||
List<Double> data22 = valueTypeList.stream().map(DataHarmpowerP::getP11).collect(Collectors.toList());
|
|
||||||
List<Double> data23 = valueTypeList.stream().map(DataHarmpowerP::getP12).collect(Collectors.toList());
|
|
||||||
List<Double> data24 = valueTypeList.stream().map(DataHarmpowerP::getP13).collect(Collectors.toList());
|
|
||||||
List<Double> data25 = valueTypeList.stream().map(DataHarmpowerP::getP14).collect(Collectors.toList());
|
|
||||||
List<Double> data26 = valueTypeList.stream().map(DataHarmpowerP::getP15).collect(Collectors.toList());
|
|
||||||
List<Double> data27 = valueTypeList.stream().map(DataHarmpowerP::getP16).collect(Collectors.toList());
|
|
||||||
List<Double> data28 = valueTypeList.stream().map(DataHarmpowerP::getP17).collect(Collectors.toList());
|
|
||||||
List<Double> data29 = valueTypeList.stream().map(DataHarmpowerP::getP18).collect(Collectors.toList());
|
|
||||||
List<Double> data30 = valueTypeList.stream().map(DataHarmpowerP::getP19).collect(Collectors.toList());
|
|
||||||
List<Double> data31 = valueTypeList.stream().map(DataHarmpowerP::getP20).collect(Collectors.toList());
|
|
||||||
List<Double> data32 = valueTypeList.stream().map(DataHarmpowerP::getP21).collect(Collectors.toList());
|
|
||||||
List<Double> data33 = valueTypeList.stream().map(DataHarmpowerP::getP22).collect(Collectors.toList());
|
|
||||||
List<Double> data34 = valueTypeList.stream().map(DataHarmpowerP::getP23).collect(Collectors.toList());
|
|
||||||
List<Double> data35 = valueTypeList.stream().map(DataHarmpowerP::getP24).collect(Collectors.toList());
|
|
||||||
List<Double> data36 = valueTypeList.stream().map(DataHarmpowerP::getP25).collect(Collectors.toList());
|
|
||||||
List<Double> data37 = valueTypeList.stream().map(DataHarmpowerP::getP26).collect(Collectors.toList());
|
|
||||||
List<Double> data38 = valueTypeList.stream().map(DataHarmpowerP::getP27).collect(Collectors.toList());
|
|
||||||
List<Double> data39 = valueTypeList.stream().map(DataHarmpowerP::getP28).collect(Collectors.toList());
|
|
||||||
List<Double> data40 = valueTypeList.stream().map(DataHarmpowerP::getP29).collect(Collectors.toList());
|
|
||||||
List<Double> data41 = valueTypeList.stream().map(DataHarmpowerP::getP30).collect(Collectors.toList());
|
|
||||||
List<Double> data42 = valueTypeList.stream().map(DataHarmpowerP::getP31).collect(Collectors.toList());
|
|
||||||
List<Double> data43 = valueTypeList.stream().map(DataHarmpowerP::getP32).collect(Collectors.toList());
|
|
||||||
List<Double> data44 = valueTypeList.stream().map(DataHarmpowerP::getP33).collect(Collectors.toList());
|
|
||||||
List<Double> data45 = valueTypeList.stream().map(DataHarmpowerP::getP34).collect(Collectors.toList());
|
|
||||||
List<Double> data46 = valueTypeList.stream().map(DataHarmpowerP::getP35).collect(Collectors.toList());
|
|
||||||
List<Double> data47 = valueTypeList.stream().map(DataHarmpowerP::getP36).collect(Collectors.toList());
|
|
||||||
List<Double> data48 = valueTypeList.stream().map(DataHarmpowerP::getP37).collect(Collectors.toList());
|
|
||||||
List<Double> data49 = valueTypeList.stream().map(DataHarmpowerP::getP38).collect(Collectors.toList());
|
|
||||||
List<Double> data50 = valueTypeList.stream().map(DataHarmpowerP::getP39).collect(Collectors.toList());
|
|
||||||
List<Double> data51 = valueTypeList.stream().map(DataHarmpowerP::getP40).collect(Collectors.toList());
|
|
||||||
List<Double> data52 = valueTypeList.stream().map(DataHarmpowerP::getP41).collect(Collectors.toList());
|
|
||||||
List<Double> data53 = valueTypeList.stream().map(DataHarmpowerP::getP42).collect(Collectors.toList());
|
|
||||||
List<Double> data54 = valueTypeList.stream().map(DataHarmpowerP::getP43).collect(Collectors.toList());
|
|
||||||
List<Double> data55 = valueTypeList.stream().map(DataHarmpowerP::getP44).collect(Collectors.toList());
|
|
||||||
List<Double> data56 = valueTypeList.stream().map(DataHarmpowerP::getP45).collect(Collectors.toList());
|
|
||||||
List<Double> data57 = valueTypeList.stream().map(DataHarmpowerP::getP46).collect(Collectors.toList());
|
|
||||||
List<Double> data58 = valueTypeList.stream().map(DataHarmpowerP::getP47).collect(Collectors.toList());
|
|
||||||
List<Double> data59 = valueTypeList.stream().map(DataHarmpowerP::getP48).collect(Collectors.toList());
|
|
||||||
List<Double> data60 = valueTypeList.stream().map(DataHarmpowerP::getP49).collect(Collectors.toList());
|
|
||||||
List<Double> data61 = valueTypeList.stream().map(DataHarmpowerP::getP50).collect(Collectors.toList());
|
|
||||||
|
|
||||||
List<List<Double>> lists = Arrays.asList(data1,data2,data3,data12,data13,data14
|
|
||||||
,data15,data16,data17,data18,data19,data20,data21,data22,data23,data24
|
|
||||||
,data25,data26,data27,data28,data29,data30,data31,data32,data33,data34
|
|
||||||
,data35,data36,data37,data38,data39,data40,data41,data42,data43,data44
|
|
||||||
,data45,data46,data47,data48,data49,data50,data51,data52,data53,data54
|
|
||||||
,data55,data56,data57,data58,data59,data60,data61);
|
|
||||||
value.setValueList(lists);
|
value.setValueList(lists);
|
||||||
valueTypes.add(value);
|
valueTypes.add(value);
|
||||||
});
|
});
|
||||||
@@ -175,6 +146,43 @@ public class InfluxdbDataHarmpowerPImpl extends MppServiceImpl<RStatDataHarmPowe
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private List<List<Double>> extractDataLists(List<DataHarmpowerP> dataList, String prefix) {
|
||||||
|
List<List<Double>> result = new ArrayList<>();
|
||||||
|
// 前三个特殊字段
|
||||||
|
result.add(extractField(dataList, prefix + "Df"));
|
||||||
|
result.add(extractField(dataList, prefix + "Pf"));
|
||||||
|
result.add(extractField(dataList, prefix + "P"));
|
||||||
|
// P1到P50
|
||||||
|
for (int i = 1; i <= 50; i++) {
|
||||||
|
String fieldName = prefix + (i == 1 ? "P1" : "P" + i);
|
||||||
|
result.add(extractField(dataList, fieldName));
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
private List<Double> extractField(List<DataHarmpowerP> dataList, String fieldName) {
|
||||||
|
try {
|
||||||
|
Method method = DataHarmpowerP.class.getMethod("get" + capitalize(fieldName));
|
||||||
|
return dataList.stream()
|
||||||
|
.map(data -> {
|
||||||
|
try {
|
||||||
|
return (Double) method.invoke(data);
|
||||||
|
} catch (Exception e) {
|
||||||
|
throw new RuntimeException("Failed to get field: " + fieldName, e);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
} catch (NoSuchMethodException e) {
|
||||||
|
throw new RuntimeException("Field not found: " + fieldName, e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private String capitalize(String str) {
|
||||||
|
if (str == null || str.isEmpty()) return str;
|
||||||
|
return str.substring(0, 1).toUpperCase() + str.substring(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void addList(List<DataHarmPowerPDto> list) {
|
public void addList(List<DataHarmPowerPDto> list) {
|
||||||
|
|
||||||
@@ -204,7 +212,7 @@ public class InfluxdbDataHarmpowerPImpl extends MppServiceImpl<RStatDataHarmPowe
|
|||||||
List<DataHarmpowerP> dataList;
|
List<DataHarmpowerP> dataList;
|
||||||
List<DataHarmpowerP> result = new ArrayList<>();
|
List<DataHarmpowerP> result = new ArrayList<>();
|
||||||
InfluxQueryWrapper influxQueryWrapper = new InfluxQueryWrapper(DataHarmpowerP.class);
|
InfluxQueryWrapper influxQueryWrapper = new InfluxQueryWrapper(DataHarmpowerP.class);
|
||||||
influxQueryWrapper.samePrefixAndSuffix(InfluxDbSqlConstant.P, "", HarmonicTimesUtil.harmonicTimesList(1, 50, 1));
|
influxQueryWrapper.samePrefixAndSuffix(InfluxDbSqlConstant.P, InfluxDbSqlConstant.P, HarmonicTimesUtil.harmonicTimesList(1, 50, 1));
|
||||||
influxQueryWrapper.regular(DataHarmpowerP::getLineId, lineList)
|
influxQueryWrapper.regular(DataHarmpowerP::getLineId, lineList)
|
||||||
.select(DataHarmpowerP::getLineId)
|
.select(DataHarmpowerP::getLineId)
|
||||||
.select(DataHarmpowerP::getPhasicType)
|
.select(DataHarmpowerP::getPhasicType)
|
||||||
@@ -255,4 +263,65 @@ public class InfluxdbDataHarmpowerPImpl extends MppServiceImpl<RStatDataHarmPowe
|
|||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public List<DataHarmpowerP> getWlMinuteData(List<String> lineList, String startTime, String endTime, Map<String,List<String>> timeMap, Boolean dataType) {
|
||||||
|
List<DataHarmpowerP> result = new ArrayList<>();
|
||||||
|
if (CollectionUtil.isNotEmpty(lineList)) {
|
||||||
|
//获取监测点信息
|
||||||
|
List<CsLinePO> line = csLineFeignClient.queryLineById(lineList).getData();
|
||||||
|
Map<String, CsLinePO> lineMap = line.stream().collect(Collectors.toMap(CsLinePO::getLineId, Function.identity()));
|
||||||
|
//获取设备信息
|
||||||
|
List<String> devList = line.stream().map(CsLinePO::getDeviceId).distinct().collect(Collectors.toList());
|
||||||
|
List<CsEquipmentDeliveryDTO> dev = equipmentFeignClient.queryDeviceById(devList).getData();
|
||||||
|
Map<String, CsEquipmentDeliveryDTO> devsMap = dev.stream().collect(Collectors.toMap(CsEquipmentDeliveryDTO::getId, Function.identity()));
|
||||||
|
lineList.forEach(lineId -> {
|
||||||
|
String devId = lineMap.get(lineId).getDeviceId();
|
||||||
|
CsLinePO po = lineMap.get(lineId);
|
||||||
|
InfluxQueryWrapper influxQueryWrapper = new InfluxQueryWrapper(DataHarmpowerP.class);
|
||||||
|
//A、B、C谐波有功功率有效值
|
||||||
|
influxQueryWrapper.samePrefixAndSuffix("Pq_HarmP_", "p_", HarmonicTimesUtil.harmonicTimesList(2, 50, 1));
|
||||||
|
//三相总 谐波有功功率有效值
|
||||||
|
influxQueryWrapper.samePrefixAndSuffix("Pq_HarmTP_", "totP_", HarmonicTimesUtil.harmonicTimesList(2, 50, 1));
|
||||||
|
InfluxQueryWrapper eq = influxQueryWrapper.eq(DataHarmpowerP::getLineId, lineId)
|
||||||
|
.eq(DataHarmpowerP::getProcess, Integer.toString(devsMap.get(devId).getProcess()))
|
||||||
|
.select(DataHarmpowerP::getLineId)
|
||||||
|
.select(DataHarmpowerP::getPhasicType)
|
||||||
|
.select(DataHarmpowerP::getValueType)
|
||||||
|
//位移功率因数
|
||||||
|
.select("Pq_DF", "df")
|
||||||
|
//视在功率因素
|
||||||
|
.select("Pq_PF", "pf")
|
||||||
|
//A、B、C三相有功功率
|
||||||
|
.select("Pq_P", "p")
|
||||||
|
//基波有功功率
|
||||||
|
.select("Pq_FundP", "p_1")
|
||||||
|
//三相总视在功率因数
|
||||||
|
.select("Pq_TotPF", "totPf")
|
||||||
|
//三相总位移功率因数
|
||||||
|
.select("Pq_TotDF", "totDf")
|
||||||
|
//三相总功率因数
|
||||||
|
.select("Pq_TotP", "totP")
|
||||||
|
//三相总基波有功功率
|
||||||
|
.select("Pq_TotHarmP", "totP1")
|
||||||
|
.between(DataHarmpowerP::getTime, startTime, endTime)
|
||||||
|
.eq(DataHarmpowerP::getQualityFlag, "0");
|
||||||
|
if (Objects.isNull(po.getLineNo())) {
|
||||||
|
influxQueryWrapper.eq(DataHarmpowerP::getCldid,Integer.toString(po.getClDid()));
|
||||||
|
} else {
|
||||||
|
influxQueryWrapper.eq(DataHarmpowerP::getCldid,Integer.toString(po.getLineNo()));
|
||||||
|
}
|
||||||
|
result.addAll(dataHarmpowerPMapper.selectByQueryWrapper(influxQueryWrapper));
|
||||||
|
});
|
||||||
|
if (CollectionUtil.isNotEmpty(result)) {
|
||||||
|
result.forEach(item -> {
|
||||||
|
String newType = PHASE_MAPPING.get(item.getPhasicType());
|
||||||
|
if (newType != null) {
|
||||||
|
item.setPhasicType(newType);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,6 +4,10 @@ import cn.hutool.core.collection.CollUtil;
|
|||||||
import cn.hutool.core.collection.CollectionUtil;
|
import cn.hutool.core.collection.CollectionUtil;
|
||||||
import com.github.jeffreyning.mybatisplus.service.MppServiceImpl;
|
import com.github.jeffreyning.mybatisplus.service.MppServiceImpl;
|
||||||
import com.njcn.common.utils.HarmonicTimesUtil;
|
import com.njcn.common.utils.HarmonicTimesUtil;
|
||||||
|
import com.njcn.csdevice.api.CsLineFeignClient;
|
||||||
|
import com.njcn.csdevice.api.EquipmentFeignClient;
|
||||||
|
import com.njcn.csdevice.pojo.dto.CsEquipmentDeliveryDTO;
|
||||||
|
import com.njcn.csdevice.pojo.po.CsLinePO;
|
||||||
import com.njcn.dataProcess.dao.imapper.DataHarmpowerQMapper;
|
import com.njcn.dataProcess.dao.imapper.DataHarmpowerQMapper;
|
||||||
import com.njcn.dataProcess.dao.relation.mapper.RStatDataHarmPowerQRelationMapper;
|
import com.njcn.dataProcess.dao.relation.mapper.RStatDataHarmPowerQRelationMapper;
|
||||||
import com.njcn.dataProcess.dto.DataHarmpowerQDTO;
|
import com.njcn.dataProcess.dto.DataHarmpowerQDTO;
|
||||||
@@ -21,10 +25,13 @@ import org.apache.commons.collections4.ListUtils;
|
|||||||
import org.springframework.beans.BeanUtils;
|
import org.springframework.beans.BeanUtils;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import java.lang.reflect.Method;
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
import java.time.ZoneId;
|
import java.time.ZoneId;
|
||||||
import java.time.format.DateTimeFormatter;
|
import java.time.format.DateTimeFormatter;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
import java.util.function.Function;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -40,6 +47,17 @@ public class InfluxdbDataHarmpowerQImpl extends MppServiceImpl<RStatDataHarmPowe
|
|||||||
|
|
||||||
private final DateTimeFormatter DATE_TIME_FORMATTER = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss").withZone(ZoneId.systemDefault());
|
private final DateTimeFormatter DATE_TIME_FORMATTER = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss").withZone(ZoneId.systemDefault());
|
||||||
private final DataHarmpowerQMapper dataHarmpowerQMapper;
|
private final DataHarmpowerQMapper dataHarmpowerQMapper;
|
||||||
|
@Resource
|
||||||
|
private CsLineFeignClient csLineFeignClient;
|
||||||
|
@Resource
|
||||||
|
private EquipmentFeignClient equipmentFeignClient;
|
||||||
|
|
||||||
|
private static final Map<String, String> PHASE_MAPPING = new HashMap<String, String>() {{
|
||||||
|
put("AB", "A");
|
||||||
|
put("BC", "B");
|
||||||
|
put("CA", "C");
|
||||||
|
put("M", "T");
|
||||||
|
}};
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -49,9 +67,8 @@ public class InfluxdbDataHarmpowerQImpl extends MppServiceImpl<RStatDataHarmPowe
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
List<DataHarmpowerQ> collect = dataHarmpowerQDTOList.stream().flatMap(temp -> DataHarmpowerQ.relationToInfluxDB(temp).stream()).collect(Collectors.toList());
|
List<DataHarmpowerQ> collect = dataHarmpowerQDTOList.stream().flatMap(temp -> DataHarmpowerQ.relationToInfluxDB(temp).stream()).collect(Collectors.toList());
|
||||||
int minSize = Math.min(1200000, collect.size());
|
|
||||||
|
|
||||||
List<List<DataHarmpowerQ>> partition = ListUtils.partition(collect, minSize);
|
List<List<DataHarmpowerQ>> partition = ListUtils.partition(collect, 20000);
|
||||||
for (List<DataHarmpowerQ> dataHarmpowerQList : partition) {
|
for (List<DataHarmpowerQ> dataHarmpowerQList : partition) {
|
||||||
List<DataHarmpowerQ> sublistAsOriginalListType = new ArrayList<>(dataHarmpowerQList);
|
List<DataHarmpowerQ> sublistAsOriginalListType = new ArrayList<>(dataHarmpowerQList);
|
||||||
|
|
||||||
@@ -63,7 +80,12 @@ public class InfluxdbDataHarmpowerQImpl extends MppServiceImpl<RStatDataHarmPowe
|
|||||||
@Override
|
@Override
|
||||||
public List<DataHarmPowerQDto> getRawData(LineCountEvaluateParam lineParam) {
|
public List<DataHarmPowerQDto> getRawData(LineCountEvaluateParam lineParam) {
|
||||||
List<DataHarmPowerQDto> result = new ArrayList<>();
|
List<DataHarmPowerQDto> result = new ArrayList<>();
|
||||||
List<DataHarmpowerQ> list = getMinuteData(lineParam.getLineId(), lineParam.getStartTime(), lineParam.getEndTime(), lineParam.getAbnormalTime(),lineParam.getDataType());
|
List<DataHarmpowerQ> list;
|
||||||
|
if (Objects.equals(lineParam.getType(), 2)) {
|
||||||
|
list = getWlMinuteData(lineParam.getLineId(), lineParam.getStartTime(), lineParam.getEndTime(), lineParam.getAbnormalTime(),lineParam.getDataType());
|
||||||
|
} else {
|
||||||
|
list = getMinuteData(lineParam.getLineId(), lineParam.getStartTime(), lineParam.getEndTime(), lineParam.getAbnormalTime(),lineParam.getDataType());
|
||||||
|
}
|
||||||
list.forEach(item->{
|
list.forEach(item->{
|
||||||
DataHarmPowerQDto dto = new DataHarmPowerQDto();
|
DataHarmPowerQDto dto = new DataHarmPowerQDto();
|
||||||
BeanUtils.copyProperties(item,dto);
|
BeanUtils.copyProperties(item,dto);
|
||||||
@@ -76,7 +98,12 @@ public class InfluxdbDataHarmpowerQImpl extends MppServiceImpl<RStatDataHarmPowe
|
|||||||
@Override
|
@Override
|
||||||
public List<CommonMinuteDto> getBaseData(LineCountEvaluateParam lineParam) {
|
public List<CommonMinuteDto> getBaseData(LineCountEvaluateParam lineParam) {
|
||||||
List<CommonMinuteDto> result = new ArrayList<>();
|
List<CommonMinuteDto> result = new ArrayList<>();
|
||||||
List<DataHarmpowerQ> data = getMinuteData(lineParam.getLineId(), lineParam.getStartTime(), lineParam.getEndTime(),lineParam.getAbnormalTime(),lineParam.getDataType());
|
List<DataHarmpowerQ> data;
|
||||||
|
if (Objects.equals(lineParam.getType(), 2)) {
|
||||||
|
data = getWlMinuteData(lineParam.getLineId(), lineParam.getStartTime(), lineParam.getEndTime(), lineParam.getAbnormalTime(),lineParam.getDataType());
|
||||||
|
} else {
|
||||||
|
data = getMinuteData(lineParam.getLineId(), lineParam.getStartTime(), lineParam.getEndTime(), lineParam.getAbnormalTime(),lineParam.getDataType());
|
||||||
|
}
|
||||||
if (CollectionUtil.isNotEmpty(data)) {
|
if (CollectionUtil.isNotEmpty(data)) {
|
||||||
String time = TimeUtils.StringTimeToString(lineParam.getStartTime());
|
String time = TimeUtils.StringTimeToString(lineParam.getStartTime());
|
||||||
//以监测点分组
|
//以监测点分组
|
||||||
@@ -98,66 +125,13 @@ public class InfluxdbDataHarmpowerQImpl extends MppServiceImpl<RStatDataHarmPowe
|
|||||||
valueTypeMap.forEach((valueType,valueTypeList)->{
|
valueTypeMap.forEach((valueType,valueTypeList)->{
|
||||||
CommonMinuteDto.ValueType value = new CommonMinuteDto.ValueType();
|
CommonMinuteDto.ValueType value = new CommonMinuteDto.ValueType();
|
||||||
value.setValueType(valueType);
|
value.setValueType(valueType);
|
||||||
//规定好集合指标参数
|
|
||||||
List<Double> data1 = valueTypeList.stream().map(DataHarmpowerQ::getQ).collect(Collectors.toList());
|
|
||||||
|
|
||||||
List<Double> data12 = valueTypeList.stream().map(DataHarmpowerQ::getQ1).collect(Collectors.toList());
|
List<List<Double>> lists;
|
||||||
List<Double> data13 = valueTypeList.stream().map(DataHarmpowerQ::getQ2).collect(Collectors.toList());
|
if (Objects.equals(phasicType, "T") && Objects.equals(lineParam.getType(), 2)) {
|
||||||
List<Double> data14 = valueTypeList.stream().map(DataHarmpowerQ::getQ3).collect(Collectors.toList());
|
lists = extractDataLists(valueTypeList, "Tot");
|
||||||
List<Double> data15 = valueTypeList.stream().map(DataHarmpowerQ::getQ4).collect(Collectors.toList());
|
} else {
|
||||||
List<Double> data16 = valueTypeList.stream().map(DataHarmpowerQ::getQ5).collect(Collectors.toList());
|
lists = extractDataLists(valueTypeList, "");
|
||||||
List<Double> data17 = valueTypeList.stream().map(DataHarmpowerQ::getQ6).collect(Collectors.toList());
|
}
|
||||||
List<Double> data18 = valueTypeList.stream().map(DataHarmpowerQ::getQ7).collect(Collectors.toList());
|
|
||||||
List<Double> data19 = valueTypeList.stream().map(DataHarmpowerQ::getQ8).collect(Collectors.toList());
|
|
||||||
List<Double> data20 = valueTypeList.stream().map(DataHarmpowerQ::getQ9).collect(Collectors.toList());
|
|
||||||
List<Double> data21 = valueTypeList.stream().map(DataHarmpowerQ::getQ10).collect(Collectors.toList());
|
|
||||||
List<Double> data22 = valueTypeList.stream().map(DataHarmpowerQ::getQ11).collect(Collectors.toList());
|
|
||||||
List<Double> data23 = valueTypeList.stream().map(DataHarmpowerQ::getQ12).collect(Collectors.toList());
|
|
||||||
List<Double> data24 = valueTypeList.stream().map(DataHarmpowerQ::getQ13).collect(Collectors.toList());
|
|
||||||
List<Double> data25 = valueTypeList.stream().map(DataHarmpowerQ::getQ14).collect(Collectors.toList());
|
|
||||||
List<Double> data26 = valueTypeList.stream().map(DataHarmpowerQ::getQ15).collect(Collectors.toList());
|
|
||||||
List<Double> data27 = valueTypeList.stream().map(DataHarmpowerQ::getQ16).collect(Collectors.toList());
|
|
||||||
List<Double> data28 = valueTypeList.stream().map(DataHarmpowerQ::getQ17).collect(Collectors.toList());
|
|
||||||
List<Double> data29 = valueTypeList.stream().map(DataHarmpowerQ::getQ18).collect(Collectors.toList());
|
|
||||||
List<Double> data30 = valueTypeList.stream().map(DataHarmpowerQ::getQ19).collect(Collectors.toList());
|
|
||||||
List<Double> data31 = valueTypeList.stream().map(DataHarmpowerQ::getQ20).collect(Collectors.toList());
|
|
||||||
List<Double> data32 = valueTypeList.stream().map(DataHarmpowerQ::getQ21).collect(Collectors.toList());
|
|
||||||
List<Double> data33 = valueTypeList.stream().map(DataHarmpowerQ::getQ22).collect(Collectors.toList());
|
|
||||||
List<Double> data34 = valueTypeList.stream().map(DataHarmpowerQ::getQ23).collect(Collectors.toList());
|
|
||||||
List<Double> data35 = valueTypeList.stream().map(DataHarmpowerQ::getQ24).collect(Collectors.toList());
|
|
||||||
List<Double> data36 = valueTypeList.stream().map(DataHarmpowerQ::getQ25).collect(Collectors.toList());
|
|
||||||
List<Double> data37 = valueTypeList.stream().map(DataHarmpowerQ::getQ26).collect(Collectors.toList());
|
|
||||||
List<Double> data38 = valueTypeList.stream().map(DataHarmpowerQ::getQ27).collect(Collectors.toList());
|
|
||||||
List<Double> data39 = valueTypeList.stream().map(DataHarmpowerQ::getQ28).collect(Collectors.toList());
|
|
||||||
List<Double> data40 = valueTypeList.stream().map(DataHarmpowerQ::getQ29).collect(Collectors.toList());
|
|
||||||
List<Double> data41 = valueTypeList.stream().map(DataHarmpowerQ::getQ30).collect(Collectors.toList());
|
|
||||||
List<Double> data42 = valueTypeList.stream().map(DataHarmpowerQ::getQ31).collect(Collectors.toList());
|
|
||||||
List<Double> data43 = valueTypeList.stream().map(DataHarmpowerQ::getQ32).collect(Collectors.toList());
|
|
||||||
List<Double> data44 = valueTypeList.stream().map(DataHarmpowerQ::getQ33).collect(Collectors.toList());
|
|
||||||
List<Double> data45 = valueTypeList.stream().map(DataHarmpowerQ::getQ34).collect(Collectors.toList());
|
|
||||||
List<Double> data46 = valueTypeList.stream().map(DataHarmpowerQ::getQ35).collect(Collectors.toList());
|
|
||||||
List<Double> data47 = valueTypeList.stream().map(DataHarmpowerQ::getQ36).collect(Collectors.toList());
|
|
||||||
List<Double> data48 = valueTypeList.stream().map(DataHarmpowerQ::getQ37).collect(Collectors.toList());
|
|
||||||
List<Double> data49 = valueTypeList.stream().map(DataHarmpowerQ::getQ38).collect(Collectors.toList());
|
|
||||||
List<Double> data50 = valueTypeList.stream().map(DataHarmpowerQ::getQ39).collect(Collectors.toList());
|
|
||||||
List<Double> data51 = valueTypeList.stream().map(DataHarmpowerQ::getQ40).collect(Collectors.toList());
|
|
||||||
List<Double> data52 = valueTypeList.stream().map(DataHarmpowerQ::getQ41).collect(Collectors.toList());
|
|
||||||
List<Double> data53 = valueTypeList.stream().map(DataHarmpowerQ::getQ42).collect(Collectors.toList());
|
|
||||||
List<Double> data54 = valueTypeList.stream().map(DataHarmpowerQ::getQ43).collect(Collectors.toList());
|
|
||||||
List<Double> data55 = valueTypeList.stream().map(DataHarmpowerQ::getQ44).collect(Collectors.toList());
|
|
||||||
List<Double> data56 = valueTypeList.stream().map(DataHarmpowerQ::getQ45).collect(Collectors.toList());
|
|
||||||
List<Double> data57 = valueTypeList.stream().map(DataHarmpowerQ::getQ46).collect(Collectors.toList());
|
|
||||||
List<Double> data58 = valueTypeList.stream().map(DataHarmpowerQ::getQ47).collect(Collectors.toList());
|
|
||||||
List<Double> data59 = valueTypeList.stream().map(DataHarmpowerQ::getQ48).collect(Collectors.toList());
|
|
||||||
List<Double> data60 = valueTypeList.stream().map(DataHarmpowerQ::getQ49).collect(Collectors.toList());
|
|
||||||
List<Double> data61 = valueTypeList.stream().map(DataHarmpowerQ::getQ50).collect(Collectors.toList());
|
|
||||||
|
|
||||||
List<List<Double>> lists = Arrays.asList(data1,data12,data13,data14
|
|
||||||
,data15,data16,data17,data18,data19,data20,data21,data22,data23,data24
|
|
||||||
,data25,data26,data27,data28,data29,data30,data31,data32,data33,data34
|
|
||||||
,data35,data36,data37,data38,data39,data40,data41,data42,data43,data44
|
|
||||||
,data45,data46,data47,data48,data49,data50,data51,data52,data53,data54
|
|
||||||
,data55,data56,data57,data58,data59,data60,data61);
|
|
||||||
value.setValueList(lists);
|
value.setValueList(lists);
|
||||||
valueTypes.add(value);
|
valueTypes.add(value);
|
||||||
});
|
});
|
||||||
@@ -171,6 +145,39 @@ public class InfluxdbDataHarmpowerQImpl extends MppServiceImpl<RStatDataHarmPowe
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private List<List<Double>> extractDataLists(List<DataHarmpowerQ> dataList, String prefix) {
|
||||||
|
List<List<Double>> result = new ArrayList<>();
|
||||||
|
result.add(extractField(dataList, prefix + "Q"));
|
||||||
|
// Q1到Q50
|
||||||
|
for (int i = 1; i <= 50; i++) {
|
||||||
|
String fieldName = prefix + (i == 1 ? "Q1" : "Q" + i);
|
||||||
|
result.add(extractField(dataList, fieldName));
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
private List<Double> extractField(List<DataHarmpowerQ> dataList, String fieldName) {
|
||||||
|
try {
|
||||||
|
Method method = DataHarmpowerQ.class.getMethod("get" + capitalize(fieldName));
|
||||||
|
return dataList.stream()
|
||||||
|
.map(data -> {
|
||||||
|
try {
|
||||||
|
return (Double) method.invoke(data);
|
||||||
|
} catch (Exception e) {
|
||||||
|
throw new RuntimeException("Failed to get field: " + fieldName, e);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
} catch (NoSuchMethodException e) {
|
||||||
|
throw new RuntimeException("Field not found: " + fieldName, e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private String capitalize(String str) {
|
||||||
|
if (str == null || str.isEmpty()) return str;
|
||||||
|
return str.substring(0, 1).toUpperCase() + str.substring(1);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void addList(List<DataHarmPowerQDto> list) {
|
public void addList(List<DataHarmPowerQDto> list) {
|
||||||
|
|
||||||
@@ -200,7 +207,7 @@ public class InfluxdbDataHarmpowerQImpl extends MppServiceImpl<RStatDataHarmPowe
|
|||||||
List<DataHarmpowerQ> dataList;
|
List<DataHarmpowerQ> dataList;
|
||||||
List<DataHarmpowerQ> result = new ArrayList<>();
|
List<DataHarmpowerQ> result = new ArrayList<>();
|
||||||
InfluxQueryWrapper influxQueryWrapper = new InfluxQueryWrapper(DataHarmpowerQ.class);
|
InfluxQueryWrapper influxQueryWrapper = new InfluxQueryWrapper(DataHarmpowerQ.class);
|
||||||
influxQueryWrapper.samePrefixAndSuffix(InfluxDbSqlConstant.Q, "", HarmonicTimesUtil.harmonicTimesList(1, 50, 1));
|
influxQueryWrapper.samePrefixAndSuffix(InfluxDbSqlConstant.Q, InfluxDbSqlConstant.Q, HarmonicTimesUtil.harmonicTimesList(1, 50, 1));
|
||||||
influxQueryWrapper.regular(DataHarmpowerQ::getLineId, lineList)
|
influxQueryWrapper.regular(DataHarmpowerQ::getLineId, lineList)
|
||||||
.select(DataHarmpowerQ::getLineId)
|
.select(DataHarmpowerQ::getLineId)
|
||||||
.select(DataHarmpowerQ::getPhasicType)
|
.select(DataHarmpowerQ::getPhasicType)
|
||||||
@@ -250,4 +257,56 @@ public class InfluxdbDataHarmpowerQImpl extends MppServiceImpl<RStatDataHarmPowe
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public List<DataHarmpowerQ> getWlMinuteData(List<String> lineList, String startTime, String endTime, Map<String,List<String>> timeMap, Boolean dataType) {
|
||||||
|
List<DataHarmpowerQ> result = new ArrayList<>();
|
||||||
|
if (CollectionUtil.isNotEmpty(lineList)) {
|
||||||
|
//获取监测点信息
|
||||||
|
List<CsLinePO> line = csLineFeignClient.queryLineById(lineList).getData();
|
||||||
|
Map<String, CsLinePO> lineMap = line.stream().collect(Collectors.toMap(CsLinePO::getLineId, Function.identity()));
|
||||||
|
//获取设备信息
|
||||||
|
List<String> devList = line.stream().map(CsLinePO::getDeviceId).distinct().collect(Collectors.toList());
|
||||||
|
List<CsEquipmentDeliveryDTO> dev = equipmentFeignClient.queryDeviceById(devList).getData();
|
||||||
|
Map<String, CsEquipmentDeliveryDTO> devsMap = dev.stream().collect(Collectors.toMap(CsEquipmentDeliveryDTO::getId, Function.identity()));
|
||||||
|
lineList.forEach(lineId -> {
|
||||||
|
String devId = lineMap.get(lineId).getDeviceId();
|
||||||
|
CsLinePO po = lineMap.get(lineId);
|
||||||
|
InfluxQueryWrapper influxQueryWrapper = new InfluxQueryWrapper(DataHarmpowerQ.class);
|
||||||
|
//A、B、C谐波无功功率有效值
|
||||||
|
influxQueryWrapper.samePrefixAndSuffix("Pq_HarmQ_", "q_", HarmonicTimesUtil.harmonicTimesList(2, 50, 1));
|
||||||
|
//三相总 谐波有功功率有效值
|
||||||
|
influxQueryWrapper.samePrefixAndSuffix("Pq_HarmTQ_", "totQ_", HarmonicTimesUtil.harmonicTimesList(2, 50, 1));
|
||||||
|
influxQueryWrapper.eq(DataHarmpowerQ::getLineId, lineId)
|
||||||
|
.eq(DataHarmpowerQ::getProcess,Integer.toString(devsMap.get(devId).getProcess()))
|
||||||
|
.select(DataHarmpowerQ::getLineId)
|
||||||
|
.select(DataHarmpowerQ::getPhasicType)
|
||||||
|
.select(DataHarmpowerQ::getValueType)
|
||||||
|
//A、B、C三相无功功率
|
||||||
|
.select("Pq_Q", "q")
|
||||||
|
//基波无功功率
|
||||||
|
.select("Pq_FundQ","q_1")
|
||||||
|
//总无功功率
|
||||||
|
.select("Pq_TotQ","totQ")
|
||||||
|
//基波无功功率(T)
|
||||||
|
.select("Pq_TotHarmQ","totQ1")
|
||||||
|
.between(DataHarmpowerQ::getTime, startTime, endTime)
|
||||||
|
.eq(DataHarmpowerQ::getQualityFlag, "0");
|
||||||
|
if (Objects.isNull(po.getLineNo())) {
|
||||||
|
influxQueryWrapper.eq(DataHarmpowerQ::getCldid,Integer.toString(po.getClDid()));
|
||||||
|
} else {
|
||||||
|
influxQueryWrapper.eq(DataHarmpowerQ::getCldid,Integer.toString(po.getLineNo()));
|
||||||
|
}
|
||||||
|
result.addAll(dataHarmpowerQMapper.selectByQueryWrapper(influxQueryWrapper));
|
||||||
|
});
|
||||||
|
if (CollectionUtil.isNotEmpty(result)) {
|
||||||
|
result.forEach(item -> {
|
||||||
|
String newType = PHASE_MAPPING.get(item.getPhasicType());
|
||||||
|
if (newType != null) {
|
||||||
|
item.setPhasicType(newType);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,6 +4,10 @@ import cn.hutool.core.collection.CollUtil;
|
|||||||
import cn.hutool.core.collection.CollectionUtil;
|
import cn.hutool.core.collection.CollectionUtil;
|
||||||
import com.github.jeffreyning.mybatisplus.service.MppServiceImpl;
|
import com.github.jeffreyning.mybatisplus.service.MppServiceImpl;
|
||||||
import com.njcn.common.utils.HarmonicTimesUtil;
|
import com.njcn.common.utils.HarmonicTimesUtil;
|
||||||
|
import com.njcn.csdevice.api.CsLineFeignClient;
|
||||||
|
import com.njcn.csdevice.api.EquipmentFeignClient;
|
||||||
|
import com.njcn.csdevice.pojo.dto.CsEquipmentDeliveryDTO;
|
||||||
|
import com.njcn.csdevice.pojo.po.CsLinePO;
|
||||||
import com.njcn.dataProcess.dao.imapper.DataHarmpowerSMapper;
|
import com.njcn.dataProcess.dao.imapper.DataHarmpowerSMapper;
|
||||||
import com.njcn.dataProcess.dao.relation.mapper.RStatDataHarmPowerSRelationMapper;
|
import com.njcn.dataProcess.dao.relation.mapper.RStatDataHarmPowerSRelationMapper;
|
||||||
import com.njcn.dataProcess.dto.DataHarmpowerSDTO;
|
import com.njcn.dataProcess.dto.DataHarmpowerSDTO;
|
||||||
@@ -21,10 +25,13 @@ import org.apache.commons.collections4.ListUtils;
|
|||||||
import org.springframework.beans.BeanUtils;
|
import org.springframework.beans.BeanUtils;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import java.lang.reflect.Method;
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
import java.time.ZoneId;
|
import java.time.ZoneId;
|
||||||
import java.time.format.DateTimeFormatter;
|
import java.time.format.DateTimeFormatter;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
import java.util.function.Function;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -40,6 +47,17 @@ public class InfluxdbDataHarmpowerSImpl extends MppServiceImpl<RStatDataHarmPowe
|
|||||||
|
|
||||||
private final DateTimeFormatter DATE_TIME_FORMATTER = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss").withZone(ZoneId.systemDefault());
|
private final DateTimeFormatter DATE_TIME_FORMATTER = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss").withZone(ZoneId.systemDefault());
|
||||||
private final DataHarmpowerSMapper dataHarmpowerSMapper;
|
private final DataHarmpowerSMapper dataHarmpowerSMapper;
|
||||||
|
@Resource
|
||||||
|
private CsLineFeignClient csLineFeignClient;
|
||||||
|
@Resource
|
||||||
|
private EquipmentFeignClient equipmentFeignClient;
|
||||||
|
|
||||||
|
private static final Map<String, String> PHASE_MAPPING = new HashMap<String, String>() {{
|
||||||
|
put("AB", "A");
|
||||||
|
put("BC", "B");
|
||||||
|
put("CA", "C");
|
||||||
|
put("M", "T");
|
||||||
|
}};
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -49,9 +67,8 @@ public class InfluxdbDataHarmpowerSImpl extends MppServiceImpl<RStatDataHarmPowe
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
List<DataHarmpowerS> collect = dataHarmpowerSDTOList.stream().flatMap(temp -> DataHarmpowerS.relationToInfluxDB(temp).stream()).collect(Collectors.toList());
|
List<DataHarmpowerS> collect = dataHarmpowerSDTOList.stream().flatMap(temp -> DataHarmpowerS.relationToInfluxDB(temp).stream()).collect(Collectors.toList());
|
||||||
int minSize = Math.min(1200000, collect.size());
|
|
||||||
|
|
||||||
List<List<DataHarmpowerS>> partition = ListUtils.partition(collect, minSize);
|
List<List<DataHarmpowerS>> partition = ListUtils.partition(collect, 20000);
|
||||||
for (List<DataHarmpowerS> dataHarmpowerSList : partition) {
|
for (List<DataHarmpowerS> dataHarmpowerSList : partition) {
|
||||||
List<DataHarmpowerS> sublistAsOriginalListType = new ArrayList<>(dataHarmpowerSList);
|
List<DataHarmpowerS> sublistAsOriginalListType = new ArrayList<>(dataHarmpowerSList);
|
||||||
|
|
||||||
@@ -63,7 +80,12 @@ public class InfluxdbDataHarmpowerSImpl extends MppServiceImpl<RStatDataHarmPowe
|
|||||||
@Override
|
@Override
|
||||||
public List<DataHarmPowerSDto> getRawData(LineCountEvaluateParam lineParam) {
|
public List<DataHarmPowerSDto> getRawData(LineCountEvaluateParam lineParam) {
|
||||||
List<DataHarmPowerSDto> result = new ArrayList<>();
|
List<DataHarmPowerSDto> result = new ArrayList<>();
|
||||||
List<DataHarmpowerS> list = getMinuteData(lineParam.getLineId(), lineParam.getStartTime(), lineParam.getEndTime(), lineParam.getAbnormalTime(),lineParam.getDataType());
|
List<DataHarmpowerS> list;
|
||||||
|
if (Objects.equals(lineParam.getType(), 2)) {
|
||||||
|
list = getWlMinuteData(lineParam.getLineId(), lineParam.getStartTime(), lineParam.getEndTime(), lineParam.getAbnormalTime(),lineParam.getDataType());
|
||||||
|
} else {
|
||||||
|
list = getMinuteData(lineParam.getLineId(), lineParam.getStartTime(), lineParam.getEndTime(), lineParam.getAbnormalTime(),lineParam.getDataType());
|
||||||
|
}
|
||||||
list.forEach(item->{
|
list.forEach(item->{
|
||||||
DataHarmPowerSDto dto = new DataHarmPowerSDto();
|
DataHarmPowerSDto dto = new DataHarmPowerSDto();
|
||||||
BeanUtils.copyProperties(item,dto);
|
BeanUtils.copyProperties(item,dto);
|
||||||
@@ -76,7 +98,12 @@ public class InfluxdbDataHarmpowerSImpl extends MppServiceImpl<RStatDataHarmPowe
|
|||||||
@Override
|
@Override
|
||||||
public List<CommonMinuteDto> getBaseData(LineCountEvaluateParam lineParam) {
|
public List<CommonMinuteDto> getBaseData(LineCountEvaluateParam lineParam) {
|
||||||
List<CommonMinuteDto> result = new ArrayList<>();
|
List<CommonMinuteDto> result = new ArrayList<>();
|
||||||
List<DataHarmpowerS> data = getMinuteData(lineParam.getLineId(), lineParam.getStartTime(), lineParam.getEndTime(),lineParam.getAbnormalTime(),lineParam.getDataType());
|
List<DataHarmpowerS> data;
|
||||||
|
if (Objects.equals(lineParam.getType(), 2)) {
|
||||||
|
data = getWlMinuteData(lineParam.getLineId(), lineParam.getStartTime(), lineParam.getEndTime(), lineParam.getAbnormalTime(),lineParam.getDataType());
|
||||||
|
} else {
|
||||||
|
data = getMinuteData(lineParam.getLineId(), lineParam.getStartTime(), lineParam.getEndTime(), lineParam.getAbnormalTime(),lineParam.getDataType());
|
||||||
|
}
|
||||||
if (CollectionUtil.isNotEmpty(data)) {
|
if (CollectionUtil.isNotEmpty(data)) {
|
||||||
String time = TimeUtils.StringTimeToString(lineParam.getStartTime());
|
String time = TimeUtils.StringTimeToString(lineParam.getStartTime());
|
||||||
//以监测点分组
|
//以监测点分组
|
||||||
@@ -98,66 +125,12 @@ public class InfluxdbDataHarmpowerSImpl extends MppServiceImpl<RStatDataHarmPowe
|
|||||||
valueTypeMap.forEach((valueType,valueTypeList)->{
|
valueTypeMap.forEach((valueType,valueTypeList)->{
|
||||||
CommonMinuteDto.ValueType value = new CommonMinuteDto.ValueType();
|
CommonMinuteDto.ValueType value = new CommonMinuteDto.ValueType();
|
||||||
value.setValueType(valueType);
|
value.setValueType(valueType);
|
||||||
//规定好集合指标参数
|
List<List<Double>> lists;
|
||||||
List<Double> data1 = valueTypeList.stream().map(DataHarmpowerS::getS).collect(Collectors.toList());
|
if (Objects.equals(phasicType, "T") && Objects.equals(lineParam.getType(), 2)) {
|
||||||
|
lists = extractDataLists(valueTypeList, "Tot");
|
||||||
List<Double> data12 = valueTypeList.stream().map(DataHarmpowerS::getS1).collect(Collectors.toList());
|
} else {
|
||||||
List<Double> data13 = valueTypeList.stream().map(DataHarmpowerS::getS2).collect(Collectors.toList());
|
lists = extractDataLists(valueTypeList, "");
|
||||||
List<Double> data14 = valueTypeList.stream().map(DataHarmpowerS::getS3).collect(Collectors.toList());
|
}
|
||||||
List<Double> data15 = valueTypeList.stream().map(DataHarmpowerS::getS4).collect(Collectors.toList());
|
|
||||||
List<Double> data16 = valueTypeList.stream().map(DataHarmpowerS::getS5).collect(Collectors.toList());
|
|
||||||
List<Double> data17 = valueTypeList.stream().map(DataHarmpowerS::getS6).collect(Collectors.toList());
|
|
||||||
List<Double> data18 = valueTypeList.stream().map(DataHarmpowerS::getS7).collect(Collectors.toList());
|
|
||||||
List<Double> data19 = valueTypeList.stream().map(DataHarmpowerS::getS8).collect(Collectors.toList());
|
|
||||||
List<Double> data20 = valueTypeList.stream().map(DataHarmpowerS::getS9).collect(Collectors.toList());
|
|
||||||
List<Double> data21 = valueTypeList.stream().map(DataHarmpowerS::getS10).collect(Collectors.toList());
|
|
||||||
List<Double> data22 = valueTypeList.stream().map(DataHarmpowerS::getS11).collect(Collectors.toList());
|
|
||||||
List<Double> data23 = valueTypeList.stream().map(DataHarmpowerS::getS12).collect(Collectors.toList());
|
|
||||||
List<Double> data24 = valueTypeList.stream().map(DataHarmpowerS::getS13).collect(Collectors.toList());
|
|
||||||
List<Double> data25 = valueTypeList.stream().map(DataHarmpowerS::getS14).collect(Collectors.toList());
|
|
||||||
List<Double> data26 = valueTypeList.stream().map(DataHarmpowerS::getS15).collect(Collectors.toList());
|
|
||||||
List<Double> data27 = valueTypeList.stream().map(DataHarmpowerS::getS16).collect(Collectors.toList());
|
|
||||||
List<Double> data28 = valueTypeList.stream().map(DataHarmpowerS::getS17).collect(Collectors.toList());
|
|
||||||
List<Double> data29 = valueTypeList.stream().map(DataHarmpowerS::getS18).collect(Collectors.toList());
|
|
||||||
List<Double> data30 = valueTypeList.stream().map(DataHarmpowerS::getS19).collect(Collectors.toList());
|
|
||||||
List<Double> data31 = valueTypeList.stream().map(DataHarmpowerS::getS20).collect(Collectors.toList());
|
|
||||||
List<Double> data32 = valueTypeList.stream().map(DataHarmpowerS::getS21).collect(Collectors.toList());
|
|
||||||
List<Double> data33 = valueTypeList.stream().map(DataHarmpowerS::getS22).collect(Collectors.toList());
|
|
||||||
List<Double> data34 = valueTypeList.stream().map(DataHarmpowerS::getS23).collect(Collectors.toList());
|
|
||||||
List<Double> data35 = valueTypeList.stream().map(DataHarmpowerS::getS24).collect(Collectors.toList());
|
|
||||||
List<Double> data36 = valueTypeList.stream().map(DataHarmpowerS::getS25).collect(Collectors.toList());
|
|
||||||
List<Double> data37 = valueTypeList.stream().map(DataHarmpowerS::getS26).collect(Collectors.toList());
|
|
||||||
List<Double> data38 = valueTypeList.stream().map(DataHarmpowerS::getS27).collect(Collectors.toList());
|
|
||||||
List<Double> data39 = valueTypeList.stream().map(DataHarmpowerS::getS28).collect(Collectors.toList());
|
|
||||||
List<Double> data40 = valueTypeList.stream().map(DataHarmpowerS::getS29).collect(Collectors.toList());
|
|
||||||
List<Double> data41 = valueTypeList.stream().map(DataHarmpowerS::getS30).collect(Collectors.toList());
|
|
||||||
List<Double> data42 = valueTypeList.stream().map(DataHarmpowerS::getS31).collect(Collectors.toList());
|
|
||||||
List<Double> data43 = valueTypeList.stream().map(DataHarmpowerS::getS32).collect(Collectors.toList());
|
|
||||||
List<Double> data44 = valueTypeList.stream().map(DataHarmpowerS::getS33).collect(Collectors.toList());
|
|
||||||
List<Double> data45 = valueTypeList.stream().map(DataHarmpowerS::getS34).collect(Collectors.toList());
|
|
||||||
List<Double> data46 = valueTypeList.stream().map(DataHarmpowerS::getS35).collect(Collectors.toList());
|
|
||||||
List<Double> data47 = valueTypeList.stream().map(DataHarmpowerS::getS36).collect(Collectors.toList());
|
|
||||||
List<Double> data48 = valueTypeList.stream().map(DataHarmpowerS::getS37).collect(Collectors.toList());
|
|
||||||
List<Double> data49 = valueTypeList.stream().map(DataHarmpowerS::getS38).collect(Collectors.toList());
|
|
||||||
List<Double> data50 = valueTypeList.stream().map(DataHarmpowerS::getS39).collect(Collectors.toList());
|
|
||||||
List<Double> data51 = valueTypeList.stream().map(DataHarmpowerS::getS40).collect(Collectors.toList());
|
|
||||||
List<Double> data52 = valueTypeList.stream().map(DataHarmpowerS::getS41).collect(Collectors.toList());
|
|
||||||
List<Double> data53 = valueTypeList.stream().map(DataHarmpowerS::getS42).collect(Collectors.toList());
|
|
||||||
List<Double> data54 = valueTypeList.stream().map(DataHarmpowerS::getS43).collect(Collectors.toList());
|
|
||||||
List<Double> data55 = valueTypeList.stream().map(DataHarmpowerS::getS44).collect(Collectors.toList());
|
|
||||||
List<Double> data56 = valueTypeList.stream().map(DataHarmpowerS::getS45).collect(Collectors.toList());
|
|
||||||
List<Double> data57 = valueTypeList.stream().map(DataHarmpowerS::getS46).collect(Collectors.toList());
|
|
||||||
List<Double> data58 = valueTypeList.stream().map(DataHarmpowerS::getS47).collect(Collectors.toList());
|
|
||||||
List<Double> data59 = valueTypeList.stream().map(DataHarmpowerS::getS48).collect(Collectors.toList());
|
|
||||||
List<Double> data60 = valueTypeList.stream().map(DataHarmpowerS::getS49).collect(Collectors.toList());
|
|
||||||
List<Double> data61 = valueTypeList.stream().map(DataHarmpowerS::getS50).collect(Collectors.toList());
|
|
||||||
|
|
||||||
List<List<Double>> lists = Arrays.asList(data1,data12,data13,data14
|
|
||||||
,data15,data16,data17,data18,data19,data20,data21,data22,data23,data24
|
|
||||||
,data25,data26,data27,data28,data29,data30,data31,data32,data33,data34
|
|
||||||
,data35,data36,data37,data38,data39,data40,data41,data42,data43,data44
|
|
||||||
,data45,data46,data47,data48,data49,data50,data51,data52,data53,data54
|
|
||||||
,data55,data56,data57,data58,data59,data60,data61);
|
|
||||||
value.setValueList(lists);
|
value.setValueList(lists);
|
||||||
valueTypes.add(value);
|
valueTypes.add(value);
|
||||||
});
|
});
|
||||||
@@ -171,6 +144,39 @@ public class InfluxdbDataHarmpowerSImpl extends MppServiceImpl<RStatDataHarmPowe
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private List<List<Double>> extractDataLists(List<DataHarmpowerS> dataList, String prefix) {
|
||||||
|
List<List<Double>> result = new ArrayList<>();
|
||||||
|
result.add(extractField(dataList, prefix + "S"));
|
||||||
|
// Q1到Q50
|
||||||
|
for (int i = 1; i <= 50; i++) {
|
||||||
|
String fieldName = prefix + (i == 1 ? "S1" : "S" + i);
|
||||||
|
result.add(extractField(dataList, fieldName));
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
private List<Double> extractField(List<DataHarmpowerS> dataList, String fieldName) {
|
||||||
|
try {
|
||||||
|
Method method = DataHarmpowerS.class.getMethod("get" + capitalize(fieldName));
|
||||||
|
return dataList.stream()
|
||||||
|
.map(data -> {
|
||||||
|
try {
|
||||||
|
return (Double) method.invoke(data);
|
||||||
|
} catch (Exception e) {
|
||||||
|
throw new RuntimeException("Failed to get field: " + fieldName, e);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
} catch (NoSuchMethodException e) {
|
||||||
|
throw new RuntimeException("Field not found: " + fieldName, e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private String capitalize(String str) {
|
||||||
|
if (str == null || str.isEmpty()) return str;
|
||||||
|
return str.substring(0, 1).toUpperCase() + str.substring(1);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void addList(List<DataHarmPowerSDto> list) {
|
public void addList(List<DataHarmPowerSDto> list) {
|
||||||
|
|
||||||
@@ -200,7 +206,7 @@ public class InfluxdbDataHarmpowerSImpl extends MppServiceImpl<RStatDataHarmPowe
|
|||||||
List<DataHarmpowerS> dataList;
|
List<DataHarmpowerS> dataList;
|
||||||
List<DataHarmpowerS> result = new ArrayList<>();
|
List<DataHarmpowerS> result = new ArrayList<>();
|
||||||
InfluxQueryWrapper influxQueryWrapper = new InfluxQueryWrapper(DataHarmpowerS.class);
|
InfluxQueryWrapper influxQueryWrapper = new InfluxQueryWrapper(DataHarmpowerS.class);
|
||||||
influxQueryWrapper.samePrefixAndSuffix(InfluxDbSqlConstant.S, "", HarmonicTimesUtil.harmonicTimesList(1, 50, 1));
|
influxQueryWrapper.samePrefixAndSuffix(InfluxDbSqlConstant.S, InfluxDbSqlConstant.S, HarmonicTimesUtil.harmonicTimesList(1, 50, 1));
|
||||||
influxQueryWrapper.regular(DataHarmpowerS::getLineId, lineList)
|
influxQueryWrapper.regular(DataHarmpowerS::getLineId, lineList)
|
||||||
.select(DataHarmpowerS::getLineId)
|
.select(DataHarmpowerS::getLineId)
|
||||||
.select(DataHarmpowerS::getPhasicType)
|
.select(DataHarmpowerS::getPhasicType)
|
||||||
@@ -250,4 +256,56 @@ public class InfluxdbDataHarmpowerSImpl extends MppServiceImpl<RStatDataHarmPowe
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public List<DataHarmpowerS> getWlMinuteData(List<String> lineList, String startTime, String endTime, Map<String,List<String>> timeMap,Boolean dataType) {
|
||||||
|
List<DataHarmpowerS> result = new ArrayList<>();
|
||||||
|
if (CollectionUtil.isNotEmpty(lineList)) {
|
||||||
|
//获取监测点信息
|
||||||
|
List<CsLinePO> line = csLineFeignClient.queryLineById(lineList).getData();
|
||||||
|
Map<String, CsLinePO> lineMap = line.stream().collect(Collectors.toMap(CsLinePO::getLineId, Function.identity()));
|
||||||
|
//获取设备信息
|
||||||
|
List<String> devList = line.stream().map(CsLinePO::getDeviceId).distinct().collect(Collectors.toList());
|
||||||
|
List<CsEquipmentDeliveryDTO> dev = equipmentFeignClient.queryDeviceById(devList).getData();
|
||||||
|
Map<String, CsEquipmentDeliveryDTO> devsMap = dev.stream().collect(Collectors.toMap(CsEquipmentDeliveryDTO::getId, Function.identity()));
|
||||||
|
lineList.forEach(lineId -> {
|
||||||
|
String devId = lineMap.get(lineId).getDeviceId();
|
||||||
|
CsLinePO po = lineMap.get(lineId);
|
||||||
|
InfluxQueryWrapper influxQueryWrapper = new InfluxQueryWrapper(DataHarmpowerS.class);
|
||||||
|
//A、B、C谐波视在功率有效值
|
||||||
|
influxQueryWrapper.samePrefixAndSuffix("Pq_HarmS_", "s_", HarmonicTimesUtil.harmonicTimesList(2, 50, 1));
|
||||||
|
//三相总 谐波视在功率有效值
|
||||||
|
influxQueryWrapper.samePrefixAndSuffix("Pq_HarmTS_", "totS_", HarmonicTimesUtil.harmonicTimesList(2, 50, 1));
|
||||||
|
influxQueryWrapper.eq(DataHarmpowerS::getLineId, lineId)
|
||||||
|
.eq(DataHarmpowerS::getProcess,Integer.toString(devsMap.get(devId).getProcess()))
|
||||||
|
.select(DataHarmpowerS::getLineId)
|
||||||
|
.select(DataHarmpowerS::getPhasicType)
|
||||||
|
.select(DataHarmpowerS::getValueType)
|
||||||
|
//A、B、C视在功率
|
||||||
|
.select("Pq_S","s")
|
||||||
|
//基波视在功率
|
||||||
|
.select("Pq_FundS","s_1")
|
||||||
|
//总视在功率
|
||||||
|
.select("Pq_TotS","totS")
|
||||||
|
//基波视在功率(T)
|
||||||
|
.select("Pq_TotHarmS","totS1")
|
||||||
|
.between(DataHarmpowerS::getTime, startTime, endTime)
|
||||||
|
.eq(DataHarmpowerS::getQualityFlag, "0");
|
||||||
|
if (Objects.isNull(po.getLineNo())) {
|
||||||
|
influxQueryWrapper.eq(DataHarmpowerS::getCldid,Integer.toString(po.getClDid()));
|
||||||
|
} else {
|
||||||
|
influxQueryWrapper.eq(DataHarmpowerS::getCldid,Integer.toString(po.getLineNo()));
|
||||||
|
}
|
||||||
|
result.addAll(dataHarmpowerSMapper.selectByQueryWrapper(influxQueryWrapper));
|
||||||
|
});
|
||||||
|
if (CollectionUtil.isNotEmpty(result)) {
|
||||||
|
result.forEach(item -> {
|
||||||
|
String newType = PHASE_MAPPING.get(item.getPhasicType());
|
||||||
|
if (newType != null) {
|
||||||
|
item.setPhasicType(newType);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,16 +4,17 @@ import cn.hutool.core.collection.CollUtil;
|
|||||||
import cn.hutool.core.collection.CollectionUtil;
|
import cn.hutool.core.collection.CollectionUtil;
|
||||||
import com.github.jeffreyning.mybatisplus.service.MppServiceImpl;
|
import com.github.jeffreyning.mybatisplus.service.MppServiceImpl;
|
||||||
import com.njcn.common.utils.HarmonicTimesUtil;
|
import com.njcn.common.utils.HarmonicTimesUtil;
|
||||||
|
import com.njcn.csdevice.api.CsLineFeignClient;
|
||||||
|
import com.njcn.csdevice.api.EquipmentFeignClient;
|
||||||
|
import com.njcn.csdevice.pojo.dto.CsEquipmentDeliveryDTO;
|
||||||
|
import com.njcn.csdevice.pojo.po.CsLinePO;
|
||||||
import com.njcn.dataProcess.constant.InfluxDBTableConstant;
|
import com.njcn.dataProcess.constant.InfluxDBTableConstant;
|
||||||
import com.njcn.dataProcess.dao.imapper.DataIMapper;
|
import com.njcn.dataProcess.dao.imapper.DataIMapper;
|
||||||
import com.njcn.dataProcess.dao.relation.mapper.RStatDataIRelationMapper;
|
import com.njcn.dataProcess.dao.relation.mapper.RStatDataIRelationMapper;
|
||||||
import com.njcn.dataProcess.dto.DataIDTO;
|
import com.njcn.dataProcess.dto.DataIDTO;
|
||||||
import com.njcn.dataProcess.param.LineCountEvaluateParam;
|
import com.njcn.dataProcess.param.LineCountEvaluateParam;
|
||||||
import com.njcn.dataProcess.po.influx.DataHarmrateV;
|
|
||||||
import com.njcn.dataProcess.po.influx.DataI;
|
import com.njcn.dataProcess.po.influx.DataI;
|
||||||
import com.njcn.dataProcess.po.influx.DataV;
|
|
||||||
import com.njcn.dataProcess.pojo.dto.CommonMinuteDto;
|
import com.njcn.dataProcess.pojo.dto.CommonMinuteDto;
|
||||||
import com.njcn.dataProcess.pojo.dto.DataHarmDto;
|
|
||||||
import com.njcn.dataProcess.pojo.dto.DataIDto;
|
import com.njcn.dataProcess.pojo.dto.DataIDto;
|
||||||
import com.njcn.dataProcess.pojo.po.RStatDataID;
|
import com.njcn.dataProcess.pojo.po.RStatDataID;
|
||||||
import com.njcn.dataProcess.service.IDataI;
|
import com.njcn.dataProcess.service.IDataI;
|
||||||
@@ -25,10 +26,12 @@ import org.apache.commons.collections4.ListUtils;
|
|||||||
import org.springframework.beans.BeanUtils;
|
import org.springframework.beans.BeanUtils;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
import java.time.ZoneId;
|
import java.time.ZoneId;
|
||||||
import java.time.format.DateTimeFormatter;
|
import java.time.format.DateTimeFormatter;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
import java.util.function.Function;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -46,6 +49,18 @@ public class InfluxdbDataIImpl extends MppServiceImpl<RStatDataIRelationMapper,
|
|||||||
|
|
||||||
private final DataIMapper dataIMapper;
|
private final DataIMapper dataIMapper;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private CsLineFeignClient csLineFeignClient;
|
||||||
|
@Resource
|
||||||
|
private EquipmentFeignClient equipmentFeignClient;
|
||||||
|
|
||||||
|
private static final Map<String, String> PHASE_MAPPING = new HashMap<String, String>() {{
|
||||||
|
put("AB", "A");
|
||||||
|
put("BC", "B");
|
||||||
|
put("CA", "C");
|
||||||
|
put("M", "T");
|
||||||
|
}};
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void batchInsertion(List<DataIDTO> dataIDTOList) {
|
public void batchInsertion(List<DataIDTO> dataIDTOList) {
|
||||||
@@ -54,9 +69,8 @@ public class InfluxdbDataIImpl extends MppServiceImpl<RStatDataIRelationMapper,
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
List<DataI> collect = dataIDTOList.stream().flatMap(temp -> DataI.relationToInfluxDB(temp).stream()).collect(Collectors.toList());
|
List<DataI> collect = dataIDTOList.stream().flatMap(temp -> DataI.relationToInfluxDB(temp).stream()).collect(Collectors.toList());
|
||||||
int minSize = Math.min(1200000, collect.size());
|
|
||||||
|
|
||||||
List<List<DataI>> partition = ListUtils.partition(collect, minSize);
|
List<List<DataI>> partition = ListUtils.partition(collect, 20000);
|
||||||
for (List<DataI> dataIList : partition) {
|
for (List<DataI> dataIList : partition) {
|
||||||
List<DataI> sublistAsOriginalListType = new ArrayList<>(dataIList);
|
List<DataI> sublistAsOriginalListType = new ArrayList<>(dataIList);
|
||||||
|
|
||||||
@@ -68,7 +82,12 @@ public class InfluxdbDataIImpl extends MppServiceImpl<RStatDataIRelationMapper,
|
|||||||
@Override
|
@Override
|
||||||
public List<DataIDto> getRawData(LineCountEvaluateParam lineParam) {
|
public List<DataIDto> getRawData(LineCountEvaluateParam lineParam) {
|
||||||
List<DataIDto> result = new ArrayList<>();
|
List<DataIDto> result = new ArrayList<>();
|
||||||
List<DataI> list = getMinuteDataI(lineParam);
|
List<DataI> list;
|
||||||
|
if (Objects.equals(lineParam.getType(), 2)) {
|
||||||
|
list = getWlMinuteDataI(lineParam);
|
||||||
|
} else {
|
||||||
|
list = getMinuteDataI(lineParam);
|
||||||
|
}
|
||||||
list.forEach(item->{
|
list.forEach(item->{
|
||||||
DataIDto dto = new DataIDto();
|
DataIDto dto = new DataIDto();
|
||||||
BeanUtils.copyProperties(item,dto);
|
BeanUtils.copyProperties(item,dto);
|
||||||
@@ -81,7 +100,12 @@ public class InfluxdbDataIImpl extends MppServiceImpl<RStatDataIRelationMapper,
|
|||||||
@Override
|
@Override
|
||||||
public List<CommonMinuteDto> getBaseData(LineCountEvaluateParam lineParam) {
|
public List<CommonMinuteDto> getBaseData(LineCountEvaluateParam lineParam) {
|
||||||
List<CommonMinuteDto> result = new ArrayList<>();
|
List<CommonMinuteDto> result = new ArrayList<>();
|
||||||
List<DataI> dataIList = getMinuteDataI(lineParam);
|
List<DataI> dataIList;
|
||||||
|
if (Objects.equals(lineParam.getType(), 2)) {
|
||||||
|
dataIList = getWlMinuteDataI(lineParam);
|
||||||
|
} else {
|
||||||
|
dataIList = getMinuteDataI(lineParam);
|
||||||
|
}
|
||||||
if (CollectionUtil.isNotEmpty(dataIList)) {
|
if (CollectionUtil.isNotEmpty(dataIList)) {
|
||||||
String time = TimeUtils.StringTimeToString(lineParam.getStartTime());
|
String time = TimeUtils.StringTimeToString(lineParam.getStartTime());
|
||||||
//以监测点分组
|
//以监测点分组
|
||||||
@@ -207,7 +231,7 @@ public class InfluxdbDataIImpl extends MppServiceImpl<RStatDataIRelationMapper,
|
|||||||
@Override
|
@Override
|
||||||
public List<DataIDto> getGroupByTimeDataI(LineCountEvaluateParam lineParam) {
|
public List<DataIDto> getGroupByTimeDataI(LineCountEvaluateParam lineParam) {
|
||||||
InfluxQueryWrapper influxQueryWrapper = new InfluxQueryWrapper(DataI.class);
|
InfluxQueryWrapper influxQueryWrapper = new InfluxQueryWrapper(DataI.class);
|
||||||
influxQueryWrapper.maxSamePrefixAndSuffix(InfluxDbSqlConstant.I, "", HarmonicTimesUtil.harmonicTimesList(2, 50, 1));
|
influxQueryWrapper.maxSamePrefixAndSuffix(InfluxDbSqlConstant.I, InfluxDbSqlConstant.I, HarmonicTimesUtil.harmonicTimesList(2, 50, 1));
|
||||||
influxQueryWrapper.regular(DataI::getLineId, lineParam.getLineId())
|
influxQueryWrapper.regular(DataI::getLineId, lineParam.getLineId())
|
||||||
.eq(DataI::getValueType, InfluxDbSqlConstant.CP95)
|
.eq(DataI::getValueType, InfluxDbSqlConstant.CP95)
|
||||||
.ne(DataI::getPhasicType, InfluxDBTableConstant.PHASE_TYPE_T)
|
.ne(DataI::getPhasicType, InfluxDBTableConstant.PHASE_TYPE_T)
|
||||||
@@ -235,7 +259,7 @@ public class InfluxdbDataIImpl extends MppServiceImpl<RStatDataIRelationMapper,
|
|||||||
List<DataI> dataList;
|
List<DataI> dataList;
|
||||||
List<DataI> result = new ArrayList<>();
|
List<DataI> result = new ArrayList<>();
|
||||||
InfluxQueryWrapper influxQueryWrapper = new InfluxQueryWrapper(DataI.class);
|
InfluxQueryWrapper influxQueryWrapper = new InfluxQueryWrapper(DataI.class);
|
||||||
influxQueryWrapper.samePrefixAndSuffix(InfluxDbSqlConstant.I, "", HarmonicTimesUtil.harmonicTimesList(1, 50, 1));
|
influxQueryWrapper.samePrefixAndSuffix(InfluxDbSqlConstant.I, InfluxDbSqlConstant.I, HarmonicTimesUtil.harmonicTimesList(1, 50, 1));
|
||||||
influxQueryWrapper.regular(DataI::getLineId, lineParam.getLineId())
|
influxQueryWrapper.regular(DataI::getLineId, lineParam.getLineId())
|
||||||
.select(DataI::getLineId)
|
.select(DataI::getLineId)
|
||||||
.select(DataI::getPhasicType)
|
.select(DataI::getPhasicType)
|
||||||
@@ -293,4 +317,64 @@ public class InfluxdbDataIImpl extends MppServiceImpl<RStatDataIRelationMapper,
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public List<DataI> getWlMinuteDataI(LineCountEvaluateParam lineParam) {
|
||||||
|
List<DataI> result = new ArrayList<>();
|
||||||
|
if (CollectionUtil.isNotEmpty(lineParam.getLineId())) {
|
||||||
|
//获取监测点信息
|
||||||
|
List<CsLinePO> line = csLineFeignClient.queryLineById(lineParam.getLineId()).getData();
|
||||||
|
Map<String, CsLinePO> lineMap = line.stream().collect(Collectors.toMap(CsLinePO::getLineId, Function.identity()));
|
||||||
|
//获取设备信息
|
||||||
|
List<String> devList = line.stream().map(CsLinePO::getDeviceId).distinct().collect(Collectors.toList());
|
||||||
|
List<CsEquipmentDeliveryDTO> dev = equipmentFeignClient.queryDeviceById(devList).getData();
|
||||||
|
Map<String, CsEquipmentDeliveryDTO> devsMap = dev.stream().collect(Collectors.toMap(CsEquipmentDeliveryDTO::getId, Function.identity()));
|
||||||
|
|
||||||
|
lineParam.getLineId().forEach(lineId -> {
|
||||||
|
String devId = lineMap.get(lineId).getDeviceId();
|
||||||
|
CsLinePO po = lineMap.get(lineId);
|
||||||
|
InfluxQueryWrapper influxQueryWrapper = new InfluxQueryWrapper(DataI.class);
|
||||||
|
//2-50次 谐波电流有效值
|
||||||
|
influxQueryWrapper.samePrefixAndSuffix("Pq_HarmI_", "i_", HarmonicTimesUtil.harmonicTimesList(2, 50, 1));
|
||||||
|
influxQueryWrapper.eq(DataI::getLineId, lineId)
|
||||||
|
.eq(DataI::getProcess,Integer.toString(devsMap.get(devId).getProcess()))
|
||||||
|
.select(DataI::getLineId)
|
||||||
|
.select(DataI::getPhasicType)
|
||||||
|
.select(DataI::getValueType)
|
||||||
|
//电流负序
|
||||||
|
.select("Pq_SeqNegI","i_neg")
|
||||||
|
//电流正序
|
||||||
|
.select("Pq_SeqPosI","i_pos")
|
||||||
|
//电流总谐波畸变率
|
||||||
|
.select("Pq_ThdI","i_thd")
|
||||||
|
//电流负序不平衡度
|
||||||
|
.select("Pq_UnbalNegI","i_unbalance")
|
||||||
|
//电流零序
|
||||||
|
.select("Pq_SeqZeroI","i_zero")
|
||||||
|
//电流总有效值
|
||||||
|
.select("Pq_RmsI","rms")
|
||||||
|
//电流基波有效值
|
||||||
|
.select("Pq_RmsFundI","i_1")
|
||||||
|
.between(DataI::getTime, lineParam.getStartTime(), lineParam.getEndTime())
|
||||||
|
.eq(DataI::getQualityFlag, "0");
|
||||||
|
if (CollUtil.isNotEmpty(lineParam.getPhasicType())) {
|
||||||
|
influxQueryWrapper.regular(DataI::getPhasicType, lineParam.getPhasicType());
|
||||||
|
}
|
||||||
|
if (Objects.isNull(po.getLineNo())) {
|
||||||
|
influxQueryWrapper.eq(DataI::getCldid,Integer.toString(po.getClDid()));
|
||||||
|
} else {
|
||||||
|
influxQueryWrapper.eq(DataI::getCldid,Integer.toString(po.getLineNo()));
|
||||||
|
}
|
||||||
|
result.addAll(dataIMapper.selectByQueryWrapper(influxQueryWrapper));
|
||||||
|
});
|
||||||
|
if (CollectionUtil.isNotEmpty(result)) {
|
||||||
|
result.forEach(item -> {
|
||||||
|
String newType = PHASE_MAPPING.get(item.getPhasicType());
|
||||||
|
if (newType != null) {
|
||||||
|
item.setPhasicType(newType);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,6 +4,10 @@ import cn.hutool.core.collection.CollUtil;
|
|||||||
import cn.hutool.core.collection.CollectionUtil;
|
import cn.hutool.core.collection.CollectionUtil;
|
||||||
import com.github.jeffreyning.mybatisplus.service.MppServiceImpl;
|
import com.github.jeffreyning.mybatisplus.service.MppServiceImpl;
|
||||||
import com.njcn.common.utils.HarmonicTimesUtil;
|
import com.njcn.common.utils.HarmonicTimesUtil;
|
||||||
|
import com.njcn.csdevice.api.CsLineFeignClient;
|
||||||
|
import com.njcn.csdevice.api.EquipmentFeignClient;
|
||||||
|
import com.njcn.csdevice.pojo.dto.CsEquipmentDeliveryDTO;
|
||||||
|
import com.njcn.csdevice.pojo.po.CsLinePO;
|
||||||
import com.njcn.dataProcess.dao.imapper.DataInharmIMapper;
|
import com.njcn.dataProcess.dao.imapper.DataInharmIMapper;
|
||||||
import com.njcn.dataProcess.dao.relation.mapper.RStatDataInHarmIRelationMapper;
|
import com.njcn.dataProcess.dao.relation.mapper.RStatDataInHarmIRelationMapper;
|
||||||
import com.njcn.dataProcess.dto.DataInharmIDTO;
|
import com.njcn.dataProcess.dto.DataInharmIDTO;
|
||||||
@@ -21,10 +25,12 @@ import org.apache.commons.collections4.ListUtils;
|
|||||||
import org.springframework.beans.BeanUtils;
|
import org.springframework.beans.BeanUtils;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
import java.time.ZoneId;
|
import java.time.ZoneId;
|
||||||
import java.time.format.DateTimeFormatter;
|
import java.time.format.DateTimeFormatter;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
import java.util.function.Function;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -40,7 +46,17 @@ public class InfluxdbDataInharmIImpl extends MppServiceImpl<RStatDataInHarmIRela
|
|||||||
|
|
||||||
private final DataInharmIMapper dataInharmIMapper;
|
private final DataInharmIMapper dataInharmIMapper;
|
||||||
private final DateTimeFormatter DATE_TIME_FORMATTER = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss").withZone(ZoneId.systemDefault());
|
private final DateTimeFormatter DATE_TIME_FORMATTER = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss").withZone(ZoneId.systemDefault());
|
||||||
|
@Resource
|
||||||
|
private CsLineFeignClient csLineFeignClient;
|
||||||
|
@Resource
|
||||||
|
private EquipmentFeignClient equipmentFeignClient;
|
||||||
|
|
||||||
|
private static final Map<String, String> PHASE_MAPPING = new HashMap<String, String>() {{
|
||||||
|
put("AB", "A");
|
||||||
|
put("BC", "B");
|
||||||
|
put("CA", "C");
|
||||||
|
put("M", "T");
|
||||||
|
}};
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void batchInsertion(List<DataInharmIDTO> dataInharmIDTOList) {
|
public void batchInsertion(List<DataInharmIDTO> dataInharmIDTOList) {
|
||||||
@@ -51,7 +67,7 @@ public class InfluxdbDataInharmIImpl extends MppServiceImpl<RStatDataInHarmIRela
|
|||||||
List<DataInharmI> collect = dataInharmIDTOList.stream().flatMap(temp -> DataInharmI.relationToInfluxDB(temp).stream()).collect(Collectors.toList());
|
List<DataInharmI> collect = dataInharmIDTOList.stream().flatMap(temp -> DataInharmI.relationToInfluxDB(temp).stream()).collect(Collectors.toList());
|
||||||
int minSize = Math.min(1200000, collect.size());
|
int minSize = Math.min(1200000, collect.size());
|
||||||
|
|
||||||
List<List<DataInharmI>> partition = ListUtils.partition(collect, minSize);
|
List<List<DataInharmI>> partition = ListUtils.partition(collect, 20000);
|
||||||
for (List<DataInharmI> dataInharmIList : partition) {
|
for (List<DataInharmI> dataInharmIList : partition) {
|
||||||
List<DataInharmI> sublistAsOriginalListType = new ArrayList<>(dataInharmIList);
|
List<DataInharmI> sublistAsOriginalListType = new ArrayList<>(dataInharmIList);
|
||||||
|
|
||||||
@@ -63,7 +79,12 @@ public class InfluxdbDataInharmIImpl extends MppServiceImpl<RStatDataInHarmIRela
|
|||||||
@Override
|
@Override
|
||||||
public List<DataInHarmIDto> getRawData(LineCountEvaluateParam lineParam) {
|
public List<DataInHarmIDto> getRawData(LineCountEvaluateParam lineParam) {
|
||||||
List<DataInHarmIDto> result = new ArrayList<>();
|
List<DataInHarmIDto> result = new ArrayList<>();
|
||||||
List<DataInharmI> list = getMinuteData(lineParam.getLineId(), lineParam.getStartTime(), lineParam.getEndTime(),lineParam.getAbnormalTime(),lineParam.getDataType());
|
List<DataInharmI> list;
|
||||||
|
if (Objects.equals(lineParam.getType(), 2)) {
|
||||||
|
list = getWlMinuteData(lineParam.getLineId(), lineParam.getStartTime(), lineParam.getEndTime(),lineParam.getAbnormalTime(),lineParam.getDataType());
|
||||||
|
} else {
|
||||||
|
list = getMinuteData(lineParam.getLineId(), lineParam.getStartTime(), lineParam.getEndTime(),lineParam.getAbnormalTime(),lineParam.getDataType());
|
||||||
|
}
|
||||||
list.forEach(item->{
|
list.forEach(item->{
|
||||||
DataInHarmIDto dto = new DataInHarmIDto();
|
DataInHarmIDto dto = new DataInHarmIDto();
|
||||||
BeanUtils.copyProperties(item,dto);
|
BeanUtils.copyProperties(item,dto);
|
||||||
@@ -76,7 +97,12 @@ public class InfluxdbDataInharmIImpl extends MppServiceImpl<RStatDataInHarmIRela
|
|||||||
@Override
|
@Override
|
||||||
public List<CommonMinuteDto> getBaseData(LineCountEvaluateParam lineParam) {
|
public List<CommonMinuteDto> getBaseData(LineCountEvaluateParam lineParam) {
|
||||||
List<CommonMinuteDto> result = new ArrayList<>();
|
List<CommonMinuteDto> result = new ArrayList<>();
|
||||||
List<DataInharmI> data = getMinuteData(lineParam.getLineId(), lineParam.getStartTime(), lineParam.getEndTime(),lineParam.getAbnormalTime(),lineParam.getDataType());
|
List<DataInharmI> data;
|
||||||
|
if (Objects.equals(lineParam.getType(), 2)) {
|
||||||
|
data = getWlMinuteData(lineParam.getLineId(), lineParam.getStartTime(), lineParam.getEndTime(),lineParam.getAbnormalTime(),lineParam.getDataType());
|
||||||
|
} else {
|
||||||
|
data = getMinuteData(lineParam.getLineId(), lineParam.getStartTime(), lineParam.getEndTime(),lineParam.getAbnormalTime(),lineParam.getDataType());
|
||||||
|
}
|
||||||
if (CollectionUtil.isNotEmpty(data)) {
|
if (CollectionUtil.isNotEmpty(data)) {
|
||||||
String time = TimeUtils.StringTimeToString(lineParam.getStartTime());
|
String time = TimeUtils.StringTimeToString(lineParam.getStartTime());
|
||||||
//以监测点分组
|
//以监测点分组
|
||||||
@@ -198,7 +224,7 @@ public class InfluxdbDataInharmIImpl extends MppServiceImpl<RStatDataInHarmIRela
|
|||||||
List<DataInharmI> dataList;
|
List<DataInharmI> dataList;
|
||||||
List<DataInharmI> result = new ArrayList<>();
|
List<DataInharmI> result = new ArrayList<>();
|
||||||
InfluxQueryWrapper influxQueryWrapper = new InfluxQueryWrapper(DataInharmI.class);
|
InfluxQueryWrapper influxQueryWrapper = new InfluxQueryWrapper(DataInharmI.class);
|
||||||
influxQueryWrapper.samePrefixAndSuffix(InfluxDbSqlConstant.I, "", HarmonicTimesUtil.harmonicTimesList(1, 50, 1));
|
influxQueryWrapper.samePrefixAndSuffix(InfluxDbSqlConstant.I, InfluxDbSqlConstant.I, HarmonicTimesUtil.harmonicTimesList(1, 50, 1));
|
||||||
influxQueryWrapper.regular(DataInharmI::getLineId, lineList)
|
influxQueryWrapper.regular(DataInharmI::getLineId, lineList)
|
||||||
.select(DataInharmI::getLineId)
|
.select(DataInharmI::getLineId)
|
||||||
.select(DataInharmI::getPhasicType)
|
.select(DataInharmI::getPhasicType)
|
||||||
@@ -247,4 +273,46 @@ public class InfluxdbDataInharmIImpl extends MppServiceImpl<RStatDataInHarmIRela
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public List<DataInharmI> getWlMinuteData(List<String> lineList, String startTime, String endTime, Map<String,List<String>> timeMap, Boolean dataType) {
|
||||||
|
List<DataInharmI> result = new ArrayList<>();
|
||||||
|
if (CollectionUtil.isNotEmpty(lineList)) {
|
||||||
|
//获取监测点信息
|
||||||
|
List<CsLinePO> line = csLineFeignClient.queryLineById(lineList).getData();
|
||||||
|
Map<String, CsLinePO> lineMap = line.stream().collect(Collectors.toMap(CsLinePO::getLineId, Function.identity()));
|
||||||
|
//获取设备信息
|
||||||
|
List<String> devList = line.stream().map(CsLinePO::getDeviceId).distinct().collect(Collectors.toList());
|
||||||
|
List<CsEquipmentDeliveryDTO> dev = equipmentFeignClient.queryDeviceById(devList).getData();
|
||||||
|
Map<String, CsEquipmentDeliveryDTO> devsMap = dev.stream().collect(Collectors.toMap(CsEquipmentDeliveryDTO::getId, Function.identity()));
|
||||||
|
lineList.forEach(lineId -> {
|
||||||
|
String devId = lineMap.get(lineId).getDeviceId();
|
||||||
|
CsLinePO po = lineMap.get(lineId);
|
||||||
|
InfluxQueryWrapper influxQueryWrapper = new InfluxQueryWrapper(DataInharmI.class);
|
||||||
|
//2-50次 间谐波电流有效值
|
||||||
|
influxQueryWrapper.samePrefixAndSuffix("Pq_InHarmIAmp_", "i_", HarmonicTimesUtil.harmonicTimesList(1, 50, 1));
|
||||||
|
influxQueryWrapper.eq(DataInharmI::getLineId, lineId)
|
||||||
|
.eq(DataInharmI::getProcess,Integer.toString(devsMap.get(devId).getProcess()))
|
||||||
|
.select(DataInharmI::getLineId)
|
||||||
|
.select(DataInharmI::getPhasicType)
|
||||||
|
.select(DataInharmI::getValueType)
|
||||||
|
.between(DataInharmI::getTime, startTime, endTime)
|
||||||
|
.eq(DataInharmI::getQualityFlag, "0");
|
||||||
|
if (Objects.isNull(po.getLineNo())) {
|
||||||
|
influxQueryWrapper.eq(DataInharmI::getCldid,Integer.toString(po.getClDid()));
|
||||||
|
} else {
|
||||||
|
influxQueryWrapper.eq(DataInharmI::getCldid,Integer.toString(po.getLineNo()));
|
||||||
|
}
|
||||||
|
result.addAll(dataInharmIMapper.selectByQueryWrapper(influxQueryWrapper));
|
||||||
|
});
|
||||||
|
if (CollectionUtil.isNotEmpty(result)) {
|
||||||
|
result.forEach(item -> {
|
||||||
|
String newType = PHASE_MAPPING.get(item.getPhasicType());
|
||||||
|
if (newType != null) {
|
||||||
|
item.setPhasicType(newType);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,6 +4,10 @@ import cn.hutool.core.collection.CollUtil;
|
|||||||
import cn.hutool.core.collection.CollectionUtil;
|
import cn.hutool.core.collection.CollectionUtil;
|
||||||
import com.github.jeffreyning.mybatisplus.service.MppServiceImpl;
|
import com.github.jeffreyning.mybatisplus.service.MppServiceImpl;
|
||||||
import com.njcn.common.utils.HarmonicTimesUtil;
|
import com.njcn.common.utils.HarmonicTimesUtil;
|
||||||
|
import com.njcn.csdevice.api.CsLineFeignClient;
|
||||||
|
import com.njcn.csdevice.api.EquipmentFeignClient;
|
||||||
|
import com.njcn.csdevice.pojo.dto.CsEquipmentDeliveryDTO;
|
||||||
|
import com.njcn.csdevice.pojo.po.CsLinePO;
|
||||||
import com.njcn.dataProcess.dao.imapper.DataInharmVMapper;
|
import com.njcn.dataProcess.dao.imapper.DataInharmVMapper;
|
||||||
import com.njcn.dataProcess.dao.relation.mapper.RStatDataInHarmVRelationMapper;
|
import com.njcn.dataProcess.dao.relation.mapper.RStatDataInHarmVRelationMapper;
|
||||||
import com.njcn.dataProcess.dto.DataInharmVDTO;
|
import com.njcn.dataProcess.dto.DataInharmVDTO;
|
||||||
@@ -22,10 +26,12 @@ import org.apache.commons.collections4.ListUtils;
|
|||||||
import org.springframework.beans.BeanUtils;
|
import org.springframework.beans.BeanUtils;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
import java.time.ZoneId;
|
import java.time.ZoneId;
|
||||||
import java.time.format.DateTimeFormatter;
|
import java.time.format.DateTimeFormatter;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
import java.util.function.Function;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
|
||||||
@@ -43,7 +49,17 @@ public class InfluxdbDataInharmVImpl extends MppServiceImpl<RStatDataInHarmVRela
|
|||||||
private final DateTimeFormatter DATE_TIME_FORMATTER = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss").withZone(ZoneId.systemDefault());
|
private final DateTimeFormatter DATE_TIME_FORMATTER = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss").withZone(ZoneId.systemDefault());
|
||||||
|
|
||||||
private final DataInharmVMapper dataInharmVMapper;
|
private final DataInharmVMapper dataInharmVMapper;
|
||||||
|
@Resource
|
||||||
|
private CsLineFeignClient csLineFeignClient;
|
||||||
|
@Resource
|
||||||
|
private EquipmentFeignClient equipmentFeignClient;
|
||||||
|
|
||||||
|
private static final Map<String, String> PHASE_MAPPING = new HashMap<String, String>() {{
|
||||||
|
put("AB", "A");
|
||||||
|
put("BC", "B");
|
||||||
|
put("CA", "C");
|
||||||
|
put("M", "T");
|
||||||
|
}};
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void batchInsertion(List<DataInharmVDTO> dataInharmVDTOList) {
|
public void batchInsertion(List<DataInharmVDTO> dataInharmVDTOList) {
|
||||||
@@ -52,9 +68,8 @@ public class InfluxdbDataInharmVImpl extends MppServiceImpl<RStatDataInHarmVRela
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
List<DataInharmV> collect = dataInharmVDTOList.stream().flatMap(temp -> DataInharmV.relationToInfluxDB(temp).stream()).collect(Collectors.toList());
|
List<DataInharmV> collect = dataInharmVDTOList.stream().flatMap(temp -> DataInharmV.relationToInfluxDB(temp).stream()).collect(Collectors.toList());
|
||||||
int minSize = Math.min(1200000, collect.size());
|
|
||||||
|
|
||||||
List<List<DataInharmV>> partition = ListUtils.partition(collect, minSize);
|
List<List<DataInharmV>> partition = ListUtils.partition(collect, 20000);
|
||||||
for (List<DataInharmV> dataInharmVList : partition) {
|
for (List<DataInharmV> dataInharmVList : partition) {
|
||||||
List<DataInharmV> sublistAsOriginalListType = new ArrayList<>(dataInharmVList);
|
List<DataInharmV> sublistAsOriginalListType = new ArrayList<>(dataInharmVList);
|
||||||
|
|
||||||
@@ -66,7 +81,12 @@ public class InfluxdbDataInharmVImpl extends MppServiceImpl<RStatDataInHarmVRela
|
|||||||
@Override
|
@Override
|
||||||
public List<DataHarmDto> getRawData(LineCountEvaluateParam lineParam) {
|
public List<DataHarmDto> getRawData(LineCountEvaluateParam lineParam) {
|
||||||
List<DataHarmDto> result = new ArrayList<>();
|
List<DataHarmDto> result = new ArrayList<>();
|
||||||
List<DataInharmV> list = getMinuteData(lineParam);
|
List<DataInharmV> list;
|
||||||
|
if (Objects.equals(lineParam.getType(), 2)) {
|
||||||
|
list = getWlMinuteData(lineParam);
|
||||||
|
} else {
|
||||||
|
list = getMinuteData(lineParam);
|
||||||
|
}
|
||||||
list.forEach(item->{
|
list.forEach(item->{
|
||||||
DataHarmDto dto = new DataHarmDto();
|
DataHarmDto dto = new DataHarmDto();
|
||||||
BeanUtils.copyProperties(item,dto);
|
BeanUtils.copyProperties(item,dto);
|
||||||
@@ -79,7 +99,12 @@ public class InfluxdbDataInharmVImpl extends MppServiceImpl<RStatDataInHarmVRela
|
|||||||
@Override
|
@Override
|
||||||
public List<CommonMinuteDto> getBaseData(LineCountEvaluateParam lineParam) {
|
public List<CommonMinuteDto> getBaseData(LineCountEvaluateParam lineParam) {
|
||||||
List<CommonMinuteDto> result = new ArrayList<>();
|
List<CommonMinuteDto> result = new ArrayList<>();
|
||||||
List<DataInharmV> data = getMinuteData(lineParam);
|
List<DataInharmV> data;
|
||||||
|
if (Objects.equals(lineParam.getType(), 2)) {
|
||||||
|
data = getWlMinuteData(lineParam);
|
||||||
|
} else {
|
||||||
|
data = getMinuteData(lineParam);
|
||||||
|
}
|
||||||
if (CollectionUtil.isNotEmpty(data)) {
|
if (CollectionUtil.isNotEmpty(data)) {
|
||||||
String time = TimeUtils.StringTimeToString(lineParam.getStartTime());
|
String time = TimeUtils.StringTimeToString(lineParam.getStartTime());
|
||||||
//以监测点分组
|
//以监测点分组
|
||||||
@@ -201,7 +226,7 @@ public class InfluxdbDataInharmVImpl extends MppServiceImpl<RStatDataInHarmVRela
|
|||||||
List<DataInharmV> dataList;
|
List<DataInharmV> dataList;
|
||||||
List<DataInharmV> result = new ArrayList<>();
|
List<DataInharmV> result = new ArrayList<>();
|
||||||
InfluxQueryWrapper influxQueryWrapper = new InfluxQueryWrapper(DataInharmV.class);
|
InfluxQueryWrapper influxQueryWrapper = new InfluxQueryWrapper(DataInharmV.class);
|
||||||
influxQueryWrapper.samePrefixAndSuffix(InfluxDbSqlConstant.V, "", HarmonicTimesUtil.harmonicTimesList(1, 50, 1));
|
influxQueryWrapper.samePrefixAndSuffix(InfluxDbSqlConstant.V, InfluxDbSqlConstant.V, HarmonicTimesUtil.harmonicTimesList(1, 50, 1));
|
||||||
influxQueryWrapper.regular(DataInharmV::getLineId, lineParam.getLineId())
|
influxQueryWrapper.regular(DataInharmV::getLineId, lineParam.getLineId())
|
||||||
.select(DataInharmV::getLineId)
|
.select(DataInharmV::getLineId)
|
||||||
.select(DataInharmV::getPhasicType)
|
.select(DataInharmV::getPhasicType)
|
||||||
@@ -252,4 +277,54 @@ public class InfluxdbDataInharmVImpl extends MppServiceImpl<RStatDataInHarmVRela
|
|||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public List<DataInharmV> getWlMinuteData(LineCountEvaluateParam lineParam) {
|
||||||
|
List<DataInharmV> result = new ArrayList<>();
|
||||||
|
if (CollectionUtil.isNotEmpty(lineParam.getLineId())) {
|
||||||
|
//获取监测点信息
|
||||||
|
List<CsLinePO> line = csLineFeignClient.queryLineById(lineParam.getLineId()).getData();
|
||||||
|
Map<String, CsLinePO> lineMap = line.stream().collect(Collectors.toMap(CsLinePO::getLineId, Function.identity()));
|
||||||
|
//获取设备信息
|
||||||
|
List<String> devList = line.stream().map(CsLinePO::getDeviceId).distinct().collect(Collectors.toList());
|
||||||
|
List<CsEquipmentDeliveryDTO> dev = equipmentFeignClient.queryDeviceById(devList).getData();
|
||||||
|
Map<String, CsEquipmentDeliveryDTO> devsMap = dev.stream().collect(Collectors.toMap(CsEquipmentDeliveryDTO::getId, Function.identity()));
|
||||||
|
lineParam.getLineId().forEach(lineId -> {
|
||||||
|
String devId = lineMap.get(lineId).getDeviceId();
|
||||||
|
CsLinePO po = lineMap.get(lineId);
|
||||||
|
InfluxQueryWrapper influxQueryWrapper = new InfluxQueryWrapper(DataInharmV.class);
|
||||||
|
//2-50次 间谐波电流有效值
|
||||||
|
influxQueryWrapper.eq(DataInharmV::getLineId, lineId)
|
||||||
|
.eq(DataInharmV::getProcess,Integer.toString(devsMap.get(devId).getProcess()))
|
||||||
|
.select(DataInharmV::getLineId)
|
||||||
|
.select(DataInharmV::getPhasicType)
|
||||||
|
.select(DataInharmV::getValueType)
|
||||||
|
.between(DataInharmV::getTime, lineParam.getStartTime(), lineParam.getEndTime())
|
||||||
|
.eq(DataInharmV::getQualityFlag, "0");
|
||||||
|
if (Objects.isNull(po.getLineNo())) {
|
||||||
|
influxQueryWrapper.eq(DataInharmV::getCldid,Integer.toString(po.getClDid()));
|
||||||
|
} else {
|
||||||
|
influxQueryWrapper.eq(DataInharmV::getCldid,Integer.toString(po.getLineNo()));
|
||||||
|
}
|
||||||
|
//判断接线方式 (0-星型 1-角型 2-V型) 星型是相电压 角型或者v型是线电压
|
||||||
|
if (Objects.equals(po.getConType(),0)) {
|
||||||
|
//0.5-49.5次 间谐波相电压有效值
|
||||||
|
influxQueryWrapper.samePrefixAndSuffix("Pq_InHarmURV_", "v_", HarmonicTimesUtil.harmonicTimesList(1, 50, 1));
|
||||||
|
} else {
|
||||||
|
//0.5-49.5次 间谐波线电压有效值
|
||||||
|
influxQueryWrapper.samePrefixAndSuffix("Pq_InHarmLURV_", "v_", HarmonicTimesUtil.harmonicTimesList(1, 50, 1));
|
||||||
|
}
|
||||||
|
result.addAll(dataInharmVMapper.selectByQueryWrapper(influxQueryWrapper));
|
||||||
|
});
|
||||||
|
if (CollectionUtil.isNotEmpty(result)) {
|
||||||
|
result.forEach(item -> {
|
||||||
|
String newType = PHASE_MAPPING.get(item.getPhasicType());
|
||||||
|
if (newType != null) {
|
||||||
|
item.setPhasicType(newType);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,6 +3,10 @@ package com.njcn.dataProcess.service.impl.influxdb;
|
|||||||
import cn.hutool.core.collection.CollUtil;
|
import cn.hutool.core.collection.CollUtil;
|
||||||
import cn.hutool.core.collection.CollectionUtil;
|
import cn.hutool.core.collection.CollectionUtil;
|
||||||
import com.github.jeffreyning.mybatisplus.service.MppServiceImpl;
|
import com.github.jeffreyning.mybatisplus.service.MppServiceImpl;
|
||||||
|
import com.njcn.csdevice.api.CsLineFeignClient;
|
||||||
|
import com.njcn.csdevice.api.EquipmentFeignClient;
|
||||||
|
import com.njcn.csdevice.pojo.dto.CsEquipmentDeliveryDTO;
|
||||||
|
import com.njcn.csdevice.pojo.po.CsLinePO;
|
||||||
import com.njcn.dataProcess.dao.imapper.DataPltMapper;
|
import com.njcn.dataProcess.dao.imapper.DataPltMapper;
|
||||||
import com.njcn.dataProcess.dao.relation.mapper.RStatDataPltRelationMapper;
|
import com.njcn.dataProcess.dao.relation.mapper.RStatDataPltRelationMapper;
|
||||||
import com.njcn.dataProcess.dto.DataPltDTO;
|
import com.njcn.dataProcess.dto.DataPltDTO;
|
||||||
@@ -20,10 +24,12 @@ import org.apache.commons.collections4.ListUtils;
|
|||||||
import org.springframework.beans.BeanUtils;
|
import org.springframework.beans.BeanUtils;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
import java.time.ZoneId;
|
import java.time.ZoneId;
|
||||||
import java.time.format.DateTimeFormatter;
|
import java.time.format.DateTimeFormatter;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
import java.util.function.Function;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -40,6 +46,17 @@ public class InfluxdbDataPltImpl extends MppServiceImpl<RStatDataPltRelationMapp
|
|||||||
private final DateTimeFormatter DATE_TIME_FORMATTER = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss").withZone(ZoneId.systemDefault());
|
private final DateTimeFormatter DATE_TIME_FORMATTER = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss").withZone(ZoneId.systemDefault());
|
||||||
|
|
||||||
private final DataPltMapper dataPltMapper;
|
private final DataPltMapper dataPltMapper;
|
||||||
|
@Resource
|
||||||
|
private CsLineFeignClient csLineFeignClient;
|
||||||
|
@Resource
|
||||||
|
private EquipmentFeignClient equipmentFeignClient;
|
||||||
|
|
||||||
|
private static final Map<String, String> PHASE_MAPPING = new HashMap<String, String>() {{
|
||||||
|
put("AB", "A");
|
||||||
|
put("BC", "B");
|
||||||
|
put("CA", "C");
|
||||||
|
put("M", "T");
|
||||||
|
}};
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void batchInsertion(List<DataPltDTO> dataPltDTOList) {
|
public void batchInsertion(List<DataPltDTO> dataPltDTOList) {
|
||||||
@@ -49,9 +66,8 @@ public class InfluxdbDataPltImpl extends MppServiceImpl<RStatDataPltRelationMapp
|
|||||||
}
|
}
|
||||||
|
|
||||||
List<DataPlt> collect = dataPltDTOList.stream().map(temp -> DataPlt.relationToInfluxDB(temp)).collect(Collectors.toList());
|
List<DataPlt> collect = dataPltDTOList.stream().map(temp -> DataPlt.relationToInfluxDB(temp)).collect(Collectors.toList());
|
||||||
int minSize = Math.min(1200000, collect.size());
|
|
||||||
|
|
||||||
List<List<DataPlt>> partition = ListUtils.partition(collect, minSize);
|
List<List<DataPlt>> partition = ListUtils.partition(collect, 20000);
|
||||||
for (List<DataPlt> dataPltList : partition) {
|
for (List<DataPlt> dataPltList : partition) {
|
||||||
List<DataPlt> sublistAsOriginalListType = new ArrayList<>(dataPltList);
|
List<DataPlt> sublistAsOriginalListType = new ArrayList<>(dataPltList);
|
||||||
|
|
||||||
@@ -63,7 +79,12 @@ public class InfluxdbDataPltImpl extends MppServiceImpl<RStatDataPltRelationMapp
|
|||||||
@Override
|
@Override
|
||||||
public List<DataPltDto> getRawData(LineCountEvaluateParam lineParam) {
|
public List<DataPltDto> getRawData(LineCountEvaluateParam lineParam) {
|
||||||
List<DataPltDto> result = new ArrayList<>();
|
List<DataPltDto> result = new ArrayList<>();
|
||||||
List<DataPlt> list = getMinuteDataPlt(lineParam);
|
List<DataPlt> list;
|
||||||
|
if (Objects.equals(lineParam.getType(), 2)) {
|
||||||
|
list = getWlMinuteDataPlt(lineParam);
|
||||||
|
} else {
|
||||||
|
list = getMinuteDataPlt(lineParam);
|
||||||
|
}
|
||||||
list.forEach(item->{
|
list.forEach(item->{
|
||||||
DataPltDto dto = new DataPltDto();
|
DataPltDto dto = new DataPltDto();
|
||||||
BeanUtils.copyProperties(item,dto);
|
BeanUtils.copyProperties(item,dto);
|
||||||
@@ -76,7 +97,12 @@ public class InfluxdbDataPltImpl extends MppServiceImpl<RStatDataPltRelationMapp
|
|||||||
@Override
|
@Override
|
||||||
public List<CommonMinuteDto> getBaseData(LineCountEvaluateParam lineParam) {
|
public List<CommonMinuteDto> getBaseData(LineCountEvaluateParam lineParam) {
|
||||||
List<CommonMinuteDto> result = new ArrayList<>();
|
List<CommonMinuteDto> result = new ArrayList<>();
|
||||||
List<DataPlt> data = getMinuteDataPlt(lineParam);
|
List<DataPlt> data;
|
||||||
|
if (Objects.equals(lineParam.getType(), 2)) {
|
||||||
|
data = getWlMinuteDataPlt(lineParam);
|
||||||
|
} else {
|
||||||
|
data = getMinuteDataPlt(lineParam);
|
||||||
|
}
|
||||||
if (CollectionUtil.isNotEmpty(data)) {
|
if (CollectionUtil.isNotEmpty(data)) {
|
||||||
String time = TimeUtils.StringTimeToString(lineParam.getStartTime());
|
String time = TimeUtils.StringTimeToString(lineParam.getStartTime());
|
||||||
//以监测点分组
|
//以监测点分组
|
||||||
@@ -199,4 +225,56 @@ public class InfluxdbDataPltImpl extends MppServiceImpl<RStatDataPltRelationMapp
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public List<DataPlt> getWlMinuteDataPlt(LineCountEvaluateParam lineParam) {
|
||||||
|
List<DataPlt> result = new ArrayList<>();
|
||||||
|
if (CollectionUtil.isNotEmpty(lineParam.getLineId())) {
|
||||||
|
//获取监测点信息
|
||||||
|
List<CsLinePO> line = csLineFeignClient.queryLineById(lineParam.getLineId()).getData();
|
||||||
|
Map<String, CsLinePO> lineMap = line.stream().collect(Collectors.toMap(CsLinePO::getLineId, Function.identity()));
|
||||||
|
//获取设备信息
|
||||||
|
List<String> devList = line.stream().map(CsLinePO::getDeviceId).distinct().collect(Collectors.toList());
|
||||||
|
List<CsEquipmentDeliveryDTO> dev = equipmentFeignClient.queryDeviceById(devList).getData();
|
||||||
|
Map<String, CsEquipmentDeliveryDTO> devsMap = dev.stream().collect(Collectors.toMap(CsEquipmentDeliveryDTO::getId, Function.identity()));
|
||||||
|
|
||||||
|
lineParam.getLineId().forEach(lineId -> {
|
||||||
|
String devId = lineMap.get(lineId).getDeviceId();
|
||||||
|
CsLinePO po = lineMap.get(lineId);
|
||||||
|
InfluxQueryWrapper influxQueryWrapper = new InfluxQueryWrapper(DataPlt.class);
|
||||||
|
influxQueryWrapper.eq(DataPlt::getLineId, lineId)
|
||||||
|
.eq(DataPlt::getProcess,Integer.toString(devsMap.get(devId).getProcess()))
|
||||||
|
.select(DataPlt::getLineId)
|
||||||
|
.select(DataPlt::getPhasicType)
|
||||||
|
.select(DataPlt::getValueType)
|
||||||
|
.between(DataPlt::getTime, lineParam.getStartTime(), lineParam.getEndTime())
|
||||||
|
.eq(DataPlt::getQualityFlag, "0");
|
||||||
|
if (CollUtil.isNotEmpty(lineParam.getPhasicType())) {
|
||||||
|
influxQueryWrapper.regular(DataPlt::getPhasicType, lineParam.getPhasicType());
|
||||||
|
}
|
||||||
|
if (Objects.isNull(po.getLineNo())) {
|
||||||
|
influxQueryWrapper.eq(DataPlt::getCldid,Integer.toString(po.getClDid()));
|
||||||
|
} else {
|
||||||
|
influxQueryWrapper.eq(DataPlt::getCldid,Integer.toString(po.getLineNo()));
|
||||||
|
}
|
||||||
|
//判断接线方式 (0-星型 1-角型 2-V型) 星型是相电压 角型或者v型是线电压
|
||||||
|
if (Objects.equals(po.getConType(),0)) {
|
||||||
|
//相电压长时闪变
|
||||||
|
influxQueryWrapper.select("Pq_Plt","plt");
|
||||||
|
} else {
|
||||||
|
//线电压长时闪变
|
||||||
|
influxQueryWrapper.select("Pq_LPlt","plt");
|
||||||
|
}
|
||||||
|
result.addAll(dataPltMapper.selectByQueryWrapper(influxQueryWrapper));
|
||||||
|
});
|
||||||
|
if (CollectionUtil.isNotEmpty(result)) {
|
||||||
|
result.forEach(item -> {
|
||||||
|
String newType = PHASE_MAPPING.get(item.getPhasicType());
|
||||||
|
if (newType != null) {
|
||||||
|
item.setPhasicType(newType);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,6 +6,10 @@ import cn.hutool.core.collection.ListUtil;
|
|||||||
import cn.hutool.core.util.ObjectUtil;
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
import com.github.jeffreyning.mybatisplus.service.MppServiceImpl;
|
import com.github.jeffreyning.mybatisplus.service.MppServiceImpl;
|
||||||
import com.njcn.common.utils.HarmonicTimesUtil;
|
import com.njcn.common.utils.HarmonicTimesUtil;
|
||||||
|
import com.njcn.csdevice.api.CsLineFeignClient;
|
||||||
|
import com.njcn.csdevice.api.EquipmentFeignClient;
|
||||||
|
import com.njcn.csdevice.pojo.dto.CsEquipmentDeliveryDTO;
|
||||||
|
import com.njcn.csdevice.pojo.po.CsLinePO;
|
||||||
import com.njcn.dataProcess.constant.InfluxDBTableConstant;
|
import com.njcn.dataProcess.constant.InfluxDBTableConstant;
|
||||||
import com.njcn.dataProcess.constant.PhaseType;
|
import com.njcn.dataProcess.constant.PhaseType;
|
||||||
import com.njcn.dataProcess.dao.imapper.DataVMapper;
|
import com.njcn.dataProcess.dao.imapper.DataVMapper;
|
||||||
@@ -34,6 +38,7 @@ import java.time.LocalDateTime;
|
|||||||
import java.time.ZoneId;
|
import java.time.ZoneId;
|
||||||
import java.time.format.DateTimeFormatter;
|
import java.time.format.DateTimeFormatter;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
import java.util.function.Function;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -46,6 +51,17 @@ import java.util.stream.Collectors;
|
|||||||
public class InfluxdbDataVImpl extends MppServiceImpl<RStatDataVRelationMapper, RStatDataVD> implements IDataV {
|
public class InfluxdbDataVImpl extends MppServiceImpl<RStatDataVRelationMapper, RStatDataVD> implements IDataV {
|
||||||
|
|
||||||
private final DateTimeFormatter DATE_TIME_FORMATTER = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss").withZone(ZoneId.systemDefault());
|
private final DateTimeFormatter DATE_TIME_FORMATTER = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss").withZone(ZoneId.systemDefault());
|
||||||
|
@Resource
|
||||||
|
private CsLineFeignClient csLineFeignClient;
|
||||||
|
@Resource
|
||||||
|
private EquipmentFeignClient equipmentFeignClient;
|
||||||
|
|
||||||
|
private static final Map<String, String> PHASE_MAPPING = new HashMap<String, String>() {{
|
||||||
|
put("AB", "A");
|
||||||
|
put("BC", "B");
|
||||||
|
put("CA", "C");
|
||||||
|
put("M", "T");
|
||||||
|
}};
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
private DataVMapper dataVMapper;
|
private DataVMapper dataVMapper;
|
||||||
@@ -95,9 +111,8 @@ public class InfluxdbDataVImpl extends MppServiceImpl<RStatDataVRelationMapper,
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
List<DataV> collect = dataVDTOList.stream().flatMap(temp -> DataV.relationToInfluxDB(temp).stream()).collect(Collectors.toList());
|
List<DataV> collect = dataVDTOList.stream().flatMap(temp -> DataV.relationToInfluxDB(temp).stream()).collect(Collectors.toList());
|
||||||
int minSize = Math.min(1200000, collect.size());
|
|
||||||
|
|
||||||
List<List<DataV>> partition = ListUtils.partition(collect, minSize);
|
List<List<DataV>> partition = ListUtils.partition(collect, 20000);
|
||||||
for (List<DataV> dataVList : partition) {
|
for (List<DataV> dataVList : partition) {
|
||||||
List<DataV> sublistAsOriginalListType = new ArrayList<>(dataVList);
|
List<DataV> sublistAsOriginalListType = new ArrayList<>(dataVList);
|
||||||
|
|
||||||
@@ -122,21 +137,27 @@ public class InfluxdbDataVImpl extends MppServiceImpl<RStatDataVRelationMapper,
|
|||||||
@Override
|
@Override
|
||||||
public List<DataVDto> getRawData(LineCountEvaluateParam lineParam) {
|
public List<DataVDto> getRawData(LineCountEvaluateParam lineParam) {
|
||||||
List<DataVDto> result = new ArrayList<>();
|
List<DataVDto> result = new ArrayList<>();
|
||||||
List<DataV> list = getMinuteDataV(lineParam);
|
List<DataV> list;
|
||||||
|
if (Objects.equals(lineParam.getType(), 2)) {
|
||||||
|
list = getWlMinuteDataV(lineParam);
|
||||||
|
} else {
|
||||||
|
list = getMinuteDataV(lineParam);
|
||||||
|
}
|
||||||
|
if (CollectionUtil.isNotEmpty(list)) {
|
||||||
list.forEach(item -> {
|
list.forEach(item -> {
|
||||||
DataVDto dto = new DataVDto();
|
DataVDto dto = new DataVDto();
|
||||||
BeanUtils.copyProperties(item, dto);
|
BeanUtils.copyProperties(item, dto);
|
||||||
dto.setMinTime(DATE_TIME_FORMATTER.format(item.getTime()));
|
dto.setMinTime(DATE_TIME_FORMATTER.format(item.getTime()));
|
||||||
result.add(dto);
|
result.add(dto);
|
||||||
});
|
});
|
||||||
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Integer getCountRawData(LineCountEvaluateParam lineParam) {
|
public Integer getCountRawData(LineCountEvaluateParam lineParam) {
|
||||||
InfluxQueryWrapper influxQueryWrapper = new InfluxQueryWrapper(DataV.class);
|
InfluxQueryWrapper influxQueryWrapper = new InfluxQueryWrapper(DataV.class);
|
||||||
influxQueryWrapper.samePrefixAndSuffix(InfluxDbSqlConstant.V, "", HarmonicTimesUtil.harmonicTimesList(1, 50, 1));
|
influxQueryWrapper.samePrefixAndSuffix(InfluxDbSqlConstant.V, InfluxDbSqlConstant.V, HarmonicTimesUtil.harmonicTimesList(1, 50, 1));
|
||||||
influxQueryWrapper.regular(DataV::getLineId, lineParam.getLineId())
|
influxQueryWrapper.regular(DataV::getLineId, lineParam.getLineId())
|
||||||
.select(DataV::getLineId)
|
.select(DataV::getLineId)
|
||||||
.select(DataV::getPhasicType)
|
.select(DataV::getPhasicType)
|
||||||
@@ -205,7 +226,12 @@ public class InfluxdbDataVImpl extends MppServiceImpl<RStatDataVRelationMapper,
|
|||||||
@Override
|
@Override
|
||||||
public List<CommonMinuteDto> getBaseData(LineCountEvaluateParam lineParam) {
|
public List<CommonMinuteDto> getBaseData(LineCountEvaluateParam lineParam) {
|
||||||
List<CommonMinuteDto> result = new ArrayList<>();
|
List<CommonMinuteDto> result = new ArrayList<>();
|
||||||
List<DataV> dataVList = getMinuteDataV(lineParam);
|
List<DataV> dataVList;
|
||||||
|
if (Objects.equals(lineParam.getType(), 2)) {
|
||||||
|
dataVList = getWlMinuteDataV(lineParam);
|
||||||
|
} else {
|
||||||
|
dataVList = getMinuteDataV(lineParam);
|
||||||
|
}
|
||||||
if (CollectionUtil.isNotEmpty(dataVList)) {
|
if (CollectionUtil.isNotEmpty(dataVList)) {
|
||||||
String time = TimeUtils.StringTimeToString(lineParam.getStartTime());
|
String time = TimeUtils.StringTimeToString(lineParam.getStartTime());
|
||||||
//以监测点分组
|
//以监测点分组
|
||||||
@@ -343,12 +369,10 @@ public class InfluxdbDataVImpl extends MppServiceImpl<RStatDataVRelationMapper,
|
|||||||
return dataV;
|
return dataV;
|
||||||
|
|
||||||
}).collect(Collectors.toList());
|
}).collect(Collectors.toList());
|
||||||
int minSize = Math.min(1200000, collect.size());
|
|
||||||
|
|
||||||
List<List<DataV>> partition = ListUtils.partition(collect, minSize);
|
List<List<DataV>> partition = ListUtils.partition(collect, 20000);
|
||||||
for (List<DataV> dataVList : partition) {
|
for (List<DataV> dataVList : partition) {
|
||||||
List<DataV> sublistAsOriginalListType = new ArrayList<>(dataVList);
|
List<DataV> sublistAsOriginalListType = new ArrayList<>(dataVList);
|
||||||
|
|
||||||
dataVMapper.insertBatch(sublistAsOriginalListType);
|
dataVMapper.insertBatch(sublistAsOriginalListType);
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -401,9 +425,30 @@ public class InfluxdbDataVImpl extends MppServiceImpl<RStatDataVRelationMapper,
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Boolean excludeZeroData(LineCountEvaluateParam lineParam) {
|
||||||
|
InfluxQueryWrapper dataVQueryWrapper = new InfluxQueryWrapper(DataV.class);
|
||||||
|
dataVQueryWrapper.eq(DataV::getLineId, lineParam.getLineId().get(0))
|
||||||
|
.eq(DataV::getValueType, InfluxDbSqlConstant.AVG_WEB)
|
||||||
|
.ne(DataV::getPhasicType, InfluxDBTableConstant.PHASE_TYPE_T)
|
||||||
|
.select(DataV::getRms)
|
||||||
|
.between(DataV::getTime, lineParam.getStartTime(), lineParam.getEndTime());
|
||||||
|
List<DataV> rmsResult = dataVMapper.selectByQueryWrapper(dataVQueryWrapper);
|
||||||
|
if (CollUtil.isNotEmpty(rmsResult)) {
|
||||||
|
List<DataV> exceptionData = rmsResult.stream().filter(dataV -> dataV.getRms() < 1.0).collect(Collectors.toList());
|
||||||
|
if (CollUtil.isNotEmpty(exceptionData)) {
|
||||||
|
if (exceptionData.size() * 2 >= rmsResult.size()) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 按监测点集合、时间条件获取dataV分钟数据
|
* 按监测点集合、时间条件获取dataV分钟数据
|
||||||
* timeMap参数来判断是否进行数据出来 timeMap为空则不进行数据处理
|
* timeMap参数来判断是否进行数据处理 timeMap为空则不进行数据处理
|
||||||
* 剔除异常数据,这里会有三种情况判断
|
* 剔除异常数据,这里会有三种情况判断
|
||||||
* 1.无异常数据,则直接返回集合;
|
* 1.无异常数据,则直接返回集合;
|
||||||
* 2.异常数据和无异常数据参杂,剔除异常数据,只计算正常数据;
|
* 2.异常数据和无异常数据参杂,剔除异常数据,只计算正常数据;
|
||||||
@@ -412,7 +457,7 @@ public class InfluxdbDataVImpl extends MppServiceImpl<RStatDataVRelationMapper,
|
|||||||
public List<DataV> getMinuteDataV(LineCountEvaluateParam lineParam) {
|
public List<DataV> getMinuteDataV(LineCountEvaluateParam lineParam) {
|
||||||
List<DataV> result = new ArrayList<>();
|
List<DataV> result = new ArrayList<>();
|
||||||
InfluxQueryWrapper influxQueryWrapper = new InfluxQueryWrapper(DataV.class);
|
InfluxQueryWrapper influxQueryWrapper = new InfluxQueryWrapper(DataV.class);
|
||||||
influxQueryWrapper.samePrefixAndSuffix(InfluxDbSqlConstant.V, "", HarmonicTimesUtil.harmonicTimesList(1, 50, 1));
|
influxQueryWrapper.samePrefixAndSuffix(InfluxDbSqlConstant.V, InfluxDbSqlConstant.V, HarmonicTimesUtil.harmonicTimesList(1, 50, 1));
|
||||||
influxQueryWrapper.regular(DataV::getLineId, lineParam.getLineId())
|
influxQueryWrapper.regular(DataV::getLineId, lineParam.getLineId())
|
||||||
.select(DataV::getLineId)
|
.select(DataV::getLineId)
|
||||||
.select(DataV::getPhasicType)
|
.select(DataV::getPhasicType)
|
||||||
@@ -439,6 +484,90 @@ public class InfluxdbDataVImpl extends MppServiceImpl<RStatDataVRelationMapper,
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 按监测点集合、时间条件获取dataV分钟数据
|
||||||
|
* timeMap参数来判断是否进行数据处理 timeMap为空则不进行数据处理
|
||||||
|
*/
|
||||||
|
public List<DataV> getWlMinuteDataV(LineCountEvaluateParam lineParam) {
|
||||||
|
List<DataV> result = new ArrayList<>();
|
||||||
|
if (CollectionUtil.isNotEmpty(lineParam.getLineId())) {
|
||||||
|
//fixme 这边查询的数据可以缓存起来,因为日表计算时可以使用
|
||||||
|
//获取监测点信息
|
||||||
|
List<CsLinePO> line = csLineFeignClient.queryLineById(lineParam.getLineId()).getData();
|
||||||
|
Map<String, CsLinePO> lineMap = line.stream().collect(Collectors.toMap(CsLinePO::getLineId, Function.identity()));
|
||||||
|
//获取设备信息
|
||||||
|
List<String> devList = line.stream().map(CsLinePO::getDeviceId).distinct().collect(Collectors.toList());
|
||||||
|
List<CsEquipmentDeliveryDTO> dev = equipmentFeignClient.queryDeviceById(devList).getData();
|
||||||
|
Map<String, CsEquipmentDeliveryDTO> devsMap = dev.stream().collect(Collectors.toMap(CsEquipmentDeliveryDTO::getId, Function.identity()));
|
||||||
|
lineParam.getLineId().forEach(lineId -> {
|
||||||
|
String devId = lineMap.get(lineId).getDeviceId();
|
||||||
|
CsLinePO po = lineMap.get(lineId);
|
||||||
|
InfluxQueryWrapper influxQueryWrapper = new InfluxQueryWrapper(DataV.class);
|
||||||
|
influxQueryWrapper.eq(DataV::getLineId, lineId)
|
||||||
|
.eq(DataV::getProcess, Integer.toString(devsMap.get(devId).getProcess()))
|
||||||
|
.select(DataV::getLineId)
|
||||||
|
.select(DataV::getPhasicType)
|
||||||
|
.select(DataV::getValueType)
|
||||||
|
//频率
|
||||||
|
.select("Pq_Freq", "freq")
|
||||||
|
//频率偏差
|
||||||
|
.select("Pq_FreqDev", "freq_dev")
|
||||||
|
//相电压有效值
|
||||||
|
.select("Pq_RmsU", "rms")
|
||||||
|
//线电压有效值
|
||||||
|
.select("Pq_RmsLU", "rms_lvr")
|
||||||
|
//电压负序
|
||||||
|
.select("Pq_SeqNegU", "v_neg")
|
||||||
|
//电压正序
|
||||||
|
.select("Pq_SeqPosU", "v_pos")
|
||||||
|
//电压零序
|
||||||
|
.select("Pq_SeqZeroU", "v_zero")
|
||||||
|
//电压负序不平衡度
|
||||||
|
.select("Pq_UnbalNegU", "v_unbalance")
|
||||||
|
.between(DataV::getTime, lineParam.getStartTime(), lineParam.getEndTime())
|
||||||
|
.eq(DataV::getQualityFlag, "0");
|
||||||
|
if (CollUtil.isNotEmpty(lineParam.getPhasicType())) {
|
||||||
|
influxQueryWrapper.regular(DataV::getPhasicType, lineParam.getPhasicType());
|
||||||
|
}
|
||||||
|
if (Objects.isNull(po.getLineNo())) {
|
||||||
|
influxQueryWrapper.eq(DataV::getCldid, Integer.toString(po.getClDid()));
|
||||||
|
} else {
|
||||||
|
influxQueryWrapper.eq(DataV::getCldid, Integer.toString(po.getLineNo()));
|
||||||
|
}
|
||||||
|
//判断接线方式 (0-星型 1-角型 2-V型) 星型是相电压 角型或者v型是线电压
|
||||||
|
if (Objects.equals(po.getConType(), 0)) {
|
||||||
|
//相电压偏差
|
||||||
|
influxQueryWrapper.select("Pq_UDev", "vu_dev");
|
||||||
|
//相电压谐波总畸变率
|
||||||
|
influxQueryWrapper.select("Pq_ThdU", "v_thd");
|
||||||
|
//相电压基波有效值
|
||||||
|
influxQueryWrapper.select("Pq_RmsFundU", "v_1");
|
||||||
|
//2-50次 相电压谐波有效值
|
||||||
|
influxQueryWrapper.samePrefixAndSuffix("Pq_HarmUV_", "v_", HarmonicTimesUtil.harmonicTimesList(2, 50, 1));
|
||||||
|
} else {
|
||||||
|
//线电压偏差
|
||||||
|
influxQueryWrapper.select("Pq_LUDev", "vu_dev");
|
||||||
|
//线电压谐波总畸变率
|
||||||
|
influxQueryWrapper.select("Pq_ThdLU", "v_thd");
|
||||||
|
//线电压基波有效值
|
||||||
|
influxQueryWrapper.select("Pq_RmsFundLU", "v_1");
|
||||||
|
//2-50次 线电压谐波有效值
|
||||||
|
influxQueryWrapper.samePrefixAndSuffix("Pq_HarmLUV_", "v_", HarmonicTimesUtil.harmonicTimesList(2, 50, 1));
|
||||||
|
}
|
||||||
|
result.addAll(dataVMapper.selectByQueryWrapper(influxQueryWrapper));
|
||||||
|
});
|
||||||
|
if (CollectionUtil.isNotEmpty(result)) {
|
||||||
|
result.forEach(item -> {
|
||||||
|
String newType = PHASE_MAPPING.get(item.getPhasicType());
|
||||||
|
if (newType != null) {
|
||||||
|
item.setPhasicType(newType);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
private void quality(List<DataV> result, InfluxQueryWrapper influxQueryWrapper, LineCountEvaluateParam lineParam) {
|
private void quality(List<DataV> result, InfluxQueryWrapper influxQueryWrapper, LineCountEvaluateParam lineParam) {
|
||||||
List<DataV> dataList;
|
List<DataV> dataList;
|
||||||
List<DataV> list = dataVMapper.selectByQueryWrapper(influxQueryWrapper);
|
List<DataV> list = dataVMapper.selectByQueryWrapper(influxQueryWrapper);
|
||||||
|
|||||||
@@ -129,7 +129,9 @@ public class InfluxdbPqsCommunicateImpl implements IPqsCommunicate {
|
|||||||
//更新mysql数据
|
//更新mysql数据
|
||||||
DevComFlagDTO devComFlagDTO = new DevComFlagDTO();
|
DevComFlagDTO devComFlagDTO = new DevComFlagDTO();
|
||||||
devComFlagDTO.setId(pqsCommunicateDto.getDevId());
|
devComFlagDTO.setId(pqsCommunicateDto.getDevId());
|
||||||
|
if(Objects.equals(pqsCommunicateDto.getFlag(),1)){
|
||||||
devComFlagDTO.setDate(LocalDateTime.parse(pqsCommunicateDto.getTime(), DATE_TIME_FORMATTER));
|
devComFlagDTO.setDate(LocalDateTime.parse(pqsCommunicateDto.getTime(), DATE_TIME_FORMATTER));
|
||||||
|
}
|
||||||
devComFlagDTO.setStatus(pqsCommunicateDto.getType());
|
devComFlagDTO.setStatus(pqsCommunicateDto.getType());
|
||||||
|
|
||||||
deviceFeignClient.updateDevComFlag(devComFlagDTO);
|
deviceFeignClient.updateDevComFlag(devComFlagDTO);
|
||||||
|
|||||||
@@ -0,0 +1,34 @@
|
|||||||
|
package com.njcn.dataProcess.service.impl.relation;
|
||||||
|
|
||||||
|
import com.github.jeffreyning.mybatisplus.service.MppServiceImpl;
|
||||||
|
import com.njcn.dataProcess.dao.relation.mapper.PqDataVerifyCountMapper;
|
||||||
|
import com.njcn.dataProcess.dao.relation.mapper.PqDataVerifyNewMapper;
|
||||||
|
import com.njcn.dataProcess.pojo.po.PqDataVerifyBak;
|
||||||
|
import com.njcn.dataProcess.pojo.po.PqDataVerifyCount;
|
||||||
|
import com.njcn.dataProcess.service.IPqDataVerifyCountService;
|
||||||
|
import com.njcn.dataProcess.service.IPqDataVerifyNewService;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* 服务实现类
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author xy
|
||||||
|
* @since 2025-02-17
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class PqDataVerifyCountServiceImpl extends MppServiceImpl<PqDataVerifyCountMapper, PqDataVerifyCount> implements IPqDataVerifyCountService {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void insertDataBatch(List<PqDataVerifyCount> list) {
|
||||||
|
this.saveOrUpdateBatchByMultiId(list,1000);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void insertData(PqDataVerifyCount pqDataVerifyCount) {
|
||||||
|
this.saveOrUpdateByMultiId(pqDataVerifyCount);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -11,6 +11,7 @@ import com.github.jeffreyning.mybatisplus.service.MppServiceImpl;
|
|||||||
import com.njcn.dataProcess.dao.relation.mapper.RStatLimitRateDetailRelationMapper;
|
import com.njcn.dataProcess.dao.relation.mapper.RStatLimitRateDetailRelationMapper;
|
||||||
import com.njcn.dataProcess.pojo.dto.*;
|
import com.njcn.dataProcess.pojo.dto.*;
|
||||||
import com.njcn.dataProcess.param.LineCountEvaluateParam;
|
import com.njcn.dataProcess.param.LineCountEvaluateParam;
|
||||||
|
import com.njcn.dataProcess.pojo.po.RStatLimitRateD;
|
||||||
import com.njcn.dataProcess.pojo.po.RStatLimitRateDetailD;
|
import com.njcn.dataProcess.pojo.po.RStatLimitRateDetailD;
|
||||||
import com.njcn.dataProcess.service.IDataLimitRateDetail;
|
import com.njcn.dataProcess.service.IDataLimitRateDetail;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
@@ -81,7 +82,9 @@ public class RelationDataLimitRateDetailImpl extends MppServiceImpl<RStatLimitRa
|
|||||||
LambdaQueryWrapper<RStatLimitRateDetailD> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
LambdaQueryWrapper<RStatLimitRateDetailD> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||||
lambdaQueryWrapper.in(CollUtil.isNotEmpty(lineParam.getLineId()), RStatLimitRateDetailD::getLineId, lineParam.getLineId())
|
lambdaQueryWrapper.in(CollUtil.isNotEmpty(lineParam.getLineId()), RStatLimitRateDetailD::getLineId, lineParam.getLineId())
|
||||||
.ge(RStatLimitRateDetailD::getTime, lineParam.getStartTime())
|
.ge(RStatLimitRateDetailD::getTime, lineParam.getStartTime())
|
||||||
.le(RStatLimitRateDetailD::getTime, lineParam.getEndTime());
|
.le(RStatLimitRateDetailD::getTime, lineParam.getEndTime())
|
||||||
|
.orderByAsc(RStatLimitRateDetailD::getTime)
|
||||||
|
;
|
||||||
|
|
||||||
List<RStatLimitRateDetailD> list = this.list(lambdaQueryWrapper);
|
List<RStatLimitRateDetailD> list = this.list(lambdaQueryWrapper);
|
||||||
DataLimitRateDetailTimeDto dto;
|
DataLimitRateDetailTimeDto dto;
|
||||||
@@ -111,7 +114,15 @@ public class RelationDataLimitRateDetailImpl extends MppServiceImpl<RStatLimitRa
|
|||||||
BeanUtils.copyProperties(item, limitRate);
|
BeanUtils.copyProperties(item, limitRate);
|
||||||
result.add(limitRate);
|
result.add(limitRate);
|
||||||
});
|
});
|
||||||
this.saveOrUpdateBatchByMultiId(result,1000);
|
if(CollUtil.isNotEmpty(result)){
|
||||||
|
List<String> ids = result.stream().map(RStatLimitRateDetailD::getLineId).collect(Collectors.toList());
|
||||||
|
this.remove(new LambdaQueryWrapper<RStatLimitRateDetailD>()
|
||||||
|
.eq(RStatLimitRateDetailD::getTime,result.get(0).getTime())
|
||||||
|
.in(RStatLimitRateDetailD::getLineId,ids)
|
||||||
|
);
|
||||||
|
this.saveBatch(result,500);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -49,7 +49,9 @@ public class RelationDataLimitRateImpl extends MppServiceImpl<RStatLimitRateRela
|
|||||||
lambdaQueryWrapper.in(CollUtil.isNotEmpty(lineParam.getLineId()),RStatLimitRateD::getLineId,lineParam.getLineId())
|
lambdaQueryWrapper.in(CollUtil.isNotEmpty(lineParam.getLineId()),RStatLimitRateD::getLineId,lineParam.getLineId())
|
||||||
.ge(RStatLimitRateD::getTime,lineParam.getStartTime())
|
.ge(RStatLimitRateD::getTime,lineParam.getStartTime())
|
||||||
.le(RStatLimitRateD::getTime,lineParam.getEndTime())
|
.le(RStatLimitRateD::getTime,lineParam.getEndTime())
|
||||||
.eq(RStatLimitRateD::getPhasicType, PhaseType.PHASE_T);
|
.eq(RStatLimitRateD::getPhasicType, PhaseType.PHASE_T)
|
||||||
|
.orderByAsc(RStatLimitRateD::getTime)
|
||||||
|
;
|
||||||
List<RStatLimitRateD> list = this.list(lambdaQueryWrapper);
|
List<RStatLimitRateD> list = this.list(lambdaQueryWrapper);
|
||||||
|
|
||||||
list.forEach(item->{
|
list.forEach(item->{
|
||||||
|
|||||||
@@ -167,6 +167,11 @@ public class RelationDataVImpl extends MppServiceImpl<RStatDataVRelationMapper,
|
|||||||
return Collections.emptyList();
|
return Collections.emptyList();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Boolean excludeZeroData(LineCountEvaluateParam lineParam) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
private List<DataVDto> quality(List<DataVDto> list, LineCountEvaluateParam lineParam) {
|
private List<DataVDto> quality(List<DataVDto> list, LineCountEvaluateParam lineParam) {
|
||||||
List<DataVDto> result = new ArrayList<>();
|
List<DataVDto> result = new ArrayList<>();
|
||||||
Map<String, List<DataVDto>> lineMap = list.stream().collect(Collectors.groupingBy(DataVDto::getLineId));
|
Map<String, List<DataVDto>> lineMap = list.stream().collect(Collectors.groupingBy(DataVDto::getLineId));
|
||||||
|
|||||||
@@ -0,0 +1,53 @@
|
|||||||
|
package com.njcn.dataProcess.service.impl.relation;
|
||||||
|
|
||||||
|
|
||||||
|
import cn.hutool.core.collection.CollectionUtil;
|
||||||
|
|
||||||
|
import com.github.jeffreyning.mybatisplus.service.MppServiceImpl;
|
||||||
|
import com.njcn.algorithm.pojo.bo.CalculatedParam;
|
||||||
|
import com.njcn.dataProcess.dao.relation.mapper.RMpVThdMapper;
|
||||||
|
import com.njcn.dataProcess.pojo.dto.RMpVThd;
|
||||||
|
import com.njcn.dataProcess.service.IRMpVThdService;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.apache.commons.collections4.ListUtils;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 类的介绍:
|
||||||
|
*
|
||||||
|
* @author xuyang
|
||||||
|
* @version 1.0.0
|
||||||
|
* @createTime 2023/4/24 17:58
|
||||||
|
*/
|
||||||
|
|
||||||
|
@Service("RelationRMpVThdServiceImpl")
|
||||||
|
@Slf4j
|
||||||
|
public class RelationRMpVThdServiceImpl extends MppServiceImpl<RMpVThdMapper, RMpVThd> implements IRMpVThdService {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Transactional(rollbackFor = {Exception.class})
|
||||||
|
public List<RMpVThd> queryHarmonicVThd(CalculatedParam calculatedParam) {
|
||||||
|
log.info(LocalDateTime.now()+"===>监测点谐波畸变率开始执行");
|
||||||
|
List<String> lineIds = calculatedParam.getIdList();
|
||||||
|
List<RMpVThd> rMpVThdList = new ArrayList<>();
|
||||||
|
//以尺寸100分片,查询数据
|
||||||
|
List<List<String>> pendingIds = ListUtils.partition(lineIds,5);
|
||||||
|
for (List<String> pendingId : pendingIds) {
|
||||||
|
List<RMpVThd> result = this.baseMapper.getVThdData(calculatedParam.getDataDate(),pendingId);
|
||||||
|
if (CollectionUtil.isNotEmpty(result)){
|
||||||
|
rMpVThdList.addAll(result);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return rMpVThdList;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void batchInsertionThd(List<RMpVThd> result) {
|
||||||
|
this.saveOrUpdateBatchByMultiId(result);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,592 @@
|
|||||||
|
package com.njcn.dataProcess.websocket;
|
||||||
|
|
||||||
|
import cn.hutool.core.collection.CollUtil;
|
||||||
|
import cn.hutool.core.date.DatePattern;
|
||||||
|
import cn.hutool.core.date.LocalDateTimeUtil;
|
||||||
|
import cn.hutool.core.util.IdUtil;
|
||||||
|
import cn.hutool.json.JSONUtil;
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import com.alibaba.nacos.shaded.com.google.gson.JsonObject;
|
||||||
|
import com.njcn.algorithm.pojo.bo.BaseParam;
|
||||||
|
import com.njcn.algorithm.pojo.liteflow.LiteFlowAlgorithmFeignClient;
|
||||||
|
import com.njcn.dataProcess.annotation.InsertBean;
|
||||||
|
import com.njcn.dataProcess.annotation.QueryBean;
|
||||||
|
import com.njcn.dataProcess.dto.RecallReplyDTO;
|
||||||
|
import com.njcn.dataProcess.param.FullRecallMessage;
|
||||||
|
import com.njcn.dataProcess.param.LineCountEvaluateParam;
|
||||||
|
import com.njcn.dataProcess.pojo.dto.DataIntegrityDto;
|
||||||
|
import com.njcn.dataProcess.service.IDataIntegrity;
|
||||||
|
import com.njcn.dataProcess.service.IDataV;
|
||||||
|
import com.njcn.device.biz.commApi.CommTerminalGeneralClient;
|
||||||
|
import com.njcn.device.biz.pojo.dto.LineDevGetDTO;
|
||||||
|
import com.njcn.device.pq.api.DeviceFeignClient;
|
||||||
|
import com.njcn.device.pq.pojo.dto.DeviceDTO;
|
||||||
|
import com.njcn.message.api.ProduceFeignClient;
|
||||||
|
import com.njcn.message.constant.RedisKeyPrefix;
|
||||||
|
import com.njcn.message.message.RecallMessage;
|
||||||
|
import com.njcn.message.messagedto.TopicReplyDTO;
|
||||||
|
import com.njcn.redis.utils.RedisUtil;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.beans.factory.annotation.Qualifier;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
import org.springframework.util.CollectionUtils;
|
||||||
|
|
||||||
|
import javax.websocket.*;
|
||||||
|
import javax.websocket.server.PathParam;
|
||||||
|
import javax.websocket.server.ServerEndpoint;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.time.Duration;
|
||||||
|
import java.time.LocalDate;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.time.LocalTime;
|
||||||
|
import java.time.format.DateTimeFormatter;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Objects;
|
||||||
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
import java.util.stream.Stream;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Description:
|
||||||
|
* Date: 2024/12/13 15:11【需求编号】
|
||||||
|
*
|
||||||
|
* @author clam
|
||||||
|
* @version V1.0.0
|
||||||
|
*/
|
||||||
|
@Slf4j
|
||||||
|
@Component
|
||||||
|
@ServerEndpoint(value ="/api/recell/{userId}")
|
||||||
|
public class RecallWebSocketServer {
|
||||||
|
@QueryBean
|
||||||
|
private static IDataV dataVQuery;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
@Qualifier("InfluxdbDataVImpl")
|
||||||
|
public void setDataVQuery( IDataV dataVQuery) {
|
||||||
|
RecallWebSocketServer.dataVQuery = dataVQuery;
|
||||||
|
}
|
||||||
|
private static CommTerminalGeneralClient commTerminalGeneralClient;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
public void setCommTerminalGeneralClient(CommTerminalGeneralClient commTerminalGeneralClient) {
|
||||||
|
RecallWebSocketServer.commTerminalGeneralClient = commTerminalGeneralClient;
|
||||||
|
}
|
||||||
|
private static ProduceFeignClient produceFeignClient;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
public void setProduceFeignClient(ProduceFeignClient produceFeignClient) {
|
||||||
|
RecallWebSocketServer.produceFeignClient = produceFeignClient;
|
||||||
|
}
|
||||||
|
|
||||||
|
@InsertBean
|
||||||
|
private static IDataIntegrity iDataIntegrityInsert;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
@Qualifier("RelationDataIntegrityImpl")
|
||||||
|
public void setiDataIntegrityInsert(IDataIntegrity iDataIntegrityInsert) {
|
||||||
|
RecallWebSocketServer.iDataIntegrityInsert = iDataIntegrityInsert;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static LiteFlowAlgorithmFeignClient liteFlowAlgorithmFeignClient;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
public void setLiteFlowAlgorithmFeignClient(LiteFlowAlgorithmFeignClient liteFlowAlgorithmFeignClient) {
|
||||||
|
RecallWebSocketServer.liteFlowAlgorithmFeignClient = liteFlowAlgorithmFeignClient;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static RedisUtil redisUtil;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
public void setRedisUtil( RedisUtil redisUtil) {
|
||||||
|
RecallWebSocketServer.redisUtil = redisUtil;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private static DeviceFeignClient deviceFeignClient;
|
||||||
|
|
||||||
|
// 注入的时候,给类的 service 注入
|
||||||
|
@Autowired
|
||||||
|
public void setLineFeignClient(DeviceFeignClient deviceFeignClient) {
|
||||||
|
RecallWebSocketServer.deviceFeignClient = deviceFeignClient;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 静态变量,用来记录当前在线连接数。应该把它设计成线程安全的。
|
||||||
|
*/
|
||||||
|
private static int onlineCount = 0;
|
||||||
|
/**
|
||||||
|
* concurrent包的线程安全Set,用来存放每个客户端对应的WebSocket对象。
|
||||||
|
*/
|
||||||
|
private static ConcurrentHashMap<String, RecallWebSocketServer> webSocketMap = new ConcurrentHashMap<>();
|
||||||
|
/**
|
||||||
|
* 与某个客户端的连接会话,需要通过它来给客户端发送数据
|
||||||
|
*/
|
||||||
|
private Session session;
|
||||||
|
/**
|
||||||
|
* 接收userId
|
||||||
|
*/
|
||||||
|
private String userId = "";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 连接建立成
|
||||||
|
* 功调用的方法
|
||||||
|
*/
|
||||||
|
@OnOpen
|
||||||
|
public void onOpen(Session session, @PathParam("userId") String userId) {
|
||||||
|
//lineId 是 userid+","+lineId+","+Devid
|
||||||
|
this.session = session;
|
||||||
|
this.userId = userId;
|
||||||
|
if (webSocketMap.containsKey(userId)) {
|
||||||
|
webSocketMap.remove(userId);
|
||||||
|
//加入set中
|
||||||
|
webSocketMap.put(userId, this);
|
||||||
|
} else {
|
||||||
|
//加入set中
|
||||||
|
webSocketMap.put(userId, this);
|
||||||
|
//在线数加1
|
||||||
|
addOnlineCount();
|
||||||
|
}
|
||||||
|
sendMessage("连接成功");
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 连接关闭
|
||||||
|
* 调用的方法
|
||||||
|
*/
|
||||||
|
@OnClose
|
||||||
|
public void onClose() {
|
||||||
|
if (webSocketMap.containsKey(userId)) {
|
||||||
|
webSocketMap.remove(userId);
|
||||||
|
//从set中删除
|
||||||
|
subOnlineCount();
|
||||||
|
}
|
||||||
|
log.info("用户退出:" + userId + ",当前在线监测点数为:" + getOnlineCount());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 收到客户端消
|
||||||
|
* 息后调用的方法
|
||||||
|
*
|
||||||
|
* @param message 客户端发送过来的消息
|
||||||
|
**/
|
||||||
|
@OnMessage
|
||||||
|
public void onMessage(String message, Session session) {
|
||||||
|
//会每30s发送请求1次
|
||||||
|
log.info("监测点消息:" + userId + ",报文:" + message);
|
||||||
|
if(Objects.equals(message,"alive")){
|
||||||
|
sendInfo("connect");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
FullRecallMessage param = JSONUtil.toBean(message,FullRecallMessage.class,true);
|
||||||
|
|
||||||
|
if(Objects.isNull(message)){
|
||||||
|
RecallReplyDTO recallReplyDTO = new RecallReplyDTO(500,"参数有误");
|
||||||
|
sendInfo(JSONObject.toJSONString(recallReplyDTO));
|
||||||
|
}else {
|
||||||
|
List<String> runMonitorIds = param.getMonitorId();
|
||||||
|
LineCountEvaluateParam lineParam = new LineCountEvaluateParam();
|
||||||
|
lineParam.setLineId(runMonitorIds);
|
||||||
|
//查看监测点的数据完整性
|
||||||
|
lineParam.setStartTime( LocalDateTimeUtil.format( param.getReCallStartTime(), DatePattern.NORM_DATETIME_FORMATTER));
|
||||||
|
lineParam.setEndTime(LocalDateTimeUtil.format( param.getReCallEndTime(), DatePattern.NORM_DATETIME_FORMATTER));
|
||||||
|
List<DataIntegrityDto> rawData = iDataIntegrityInsert.getRawData(lineParam);
|
||||||
|
Map<String, Map<String, List<DataIntegrityDto>>> collect1 = rawData.stream().collect(Collectors.groupingBy(DataIntegrityDto::getLineIndex, Collectors.groupingBy(DataIntegrityDto::getTimeId)));
|
||||||
|
List<BaseParam> bsParmList = new ArrayList<>();
|
||||||
|
runMonitorIds.forEach(temp->{
|
||||||
|
LineDevGetDTO data = commTerminalGeneralClient.getMonitorDetail(temp).getData();
|
||||||
|
//后续根据不同前置下的测点发送补招密令
|
||||||
|
DeviceDTO data2 = deviceFeignClient.getDeviceInfo(data.getDevId()).getData();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
LocalDateTime currentDate = param.getReCallStartTime();
|
||||||
|
//循环每一天
|
||||||
|
while (!currentDate.isAfter(param.getReCallEndTime())) {
|
||||||
|
|
||||||
|
String key ="";
|
||||||
|
LocalDateTime tempTime = currentDate.toLocalDate().plusDays(1).atTime(0,0,0);
|
||||||
|
//查看数据完整性,根据数据完整性进行补招;
|
||||||
|
//校验数据完整性完整率>=98%不补招完整率80%~98%,差量补招,完整率<=80%,全量补招
|
||||||
|
Integer recallType = 1; //1全量补 2:差量补 3:不需要补招
|
||||||
|
String curDateString = LocalDateTimeUtil.format(currentDate.toLocalDate().atTime(0, 0, 0), DatePattern.NORM_DATETIME_FORMATTER);
|
||||||
|
if(collect1.containsKey(temp)&&collect1.get(temp).containsKey(curDateString)){
|
||||||
|
DataIntegrityDto dto = collect1.get(temp).get(curDateString).get(0);
|
||||||
|
if( dto.getDueTime()!=0){
|
||||||
|
double i = (double)dto.getRealTime() / dto.getDueTime();
|
||||||
|
if( i>=0.98){
|
||||||
|
recallType=3;
|
||||||
|
} else if(i<0.98&&i>0.8){
|
||||||
|
recallType=2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
// 确定补招时间段
|
||||||
|
LocalDateTime toDayBeginTime,toDayEndTime;
|
||||||
|
if(tempTime.isAfter(param.getReCallEndTime())){
|
||||||
|
toDayBeginTime =currentDate;
|
||||||
|
toDayEndTime = param.getReCallEndTime();
|
||||||
|
|
||||||
|
}else {
|
||||||
|
toDayBeginTime =currentDate;
|
||||||
|
toDayEndTime = tempTime;
|
||||||
|
|
||||||
|
}
|
||||||
|
RecallReplyDTO recallReplyDTO = new RecallReplyDTO(300,"监测点:"+data.getPointName()+";日期:"+currentDate.toLocalDate()+"开始补招");
|
||||||
|
|
||||||
|
sendInfo(JSONObject.toJSONString(recallReplyDTO));
|
||||||
|
//暂态补招
|
||||||
|
RecallMessage.RecallDTO recallDTO2 = new RecallMessage.RecallDTO();
|
||||||
|
recallDTO2.setDataType("1");
|
||||||
|
recallDTO2.setMonitorId(Stream.of(temp).collect(Collectors.toList()));
|
||||||
|
String tempTimeInterval = formatInterval(toDayBeginTime, toDayEndTime);
|
||||||
|
recallDTO2.setTimeInterval(Stream.of(tempTimeInterval).collect(Collectors.toList()));
|
||||||
|
recallDTO2.setNodeId(data2.getNodeId());
|
||||||
|
|
||||||
|
RecallMessage eventMessage = new RecallMessage();
|
||||||
|
eventMessage.setNodeId(data2.getNodeId());
|
||||||
|
eventMessage.setData(Stream.of(recallDTO2).collect(Collectors.toList()));
|
||||||
|
String guid1 = IdUtil.simpleUUID();
|
||||||
|
eventMessage.setGuid(guid1);
|
||||||
|
produceFeignClient.recall(eventMessage);
|
||||||
|
|
||||||
|
if(recallType ==3){
|
||||||
|
|
||||||
|
}else if(recallType ==2){
|
||||||
|
Integer timeInterval = data.getTimeInterval();
|
||||||
|
List<LocalDateTime> localDateTimeList = generateTimeIntervals( toDayBeginTime,toDayBeginTime, timeInterval);
|
||||||
|
List<LocalDateTime> data1 = dataVQuery.monitoringTime(temp, LocalDateTimeUtil.format( currentDate.toLocalDate(), DatePattern.NORM_DATE_PATTERN));
|
||||||
|
localDateTimeList.removeAll(data1);
|
||||||
|
if(!CollectionUtils.isEmpty(localDateTimeList)){
|
||||||
|
List<String> timePeriod = mergeTimeIntervals(localDateTimeList, timeInterval);
|
||||||
|
RecallMessage.RecallDTO recallDTO = new RecallMessage.RecallDTO();
|
||||||
|
//
|
||||||
|
recallDTO.setDataType("0");
|
||||||
|
recallDTO.setMonitorId(Stream.of(temp).collect(Collectors.toList()));
|
||||||
|
recallDTO.setTimeInterval(timePeriod);
|
||||||
|
recallDTO.setNodeId(data2.getNodeId());
|
||||||
|
RecallMessage recallMessage = new RecallMessage();
|
||||||
|
recallMessage.setNodeId(data2.getNodeId());
|
||||||
|
recallMessage.setData(Stream.of(recallDTO).collect(Collectors.toList()));
|
||||||
|
String guid = IdUtil.simpleUUID();
|
||||||
|
recallMessage.setGuid(guid);
|
||||||
|
|
||||||
|
produceFeignClient.recall(recallMessage);
|
||||||
|
// boolean flag =true;
|
||||||
|
// LocalDateTime beginTaskTime = LocalDateTime.now();
|
||||||
|
// while (flag){
|
||||||
|
// if(Duration.between(beginTaskTime, LocalDateTime.now()).toMinutes()<=5){
|
||||||
|
// key =RedisKeyPrefix.TOPIC_REPLY.concat(temp).concat(currentDate.toLocalDate().format(DatePattern.NORM_DATE_FORMATTER));
|
||||||
|
//
|
||||||
|
// String jsonString =redisUtil.getStringByKey(key);
|
||||||
|
// if(Objects.nonNull(jsonString)){
|
||||||
|
// TopicReplyDTO bean = JSONUtil.toBean(jsonString, TopicReplyDTO.class, true);
|
||||||
|
// redisUtil.delete(key);
|
||||||
|
// flag =false;
|
||||||
|
// RecallReplyDTO recallReplyDTO2 = new RecallReplyDTO(300,bean.getResult());
|
||||||
|
//
|
||||||
|
// sendInfo(JSONObject.toJSONString(recallReplyDTO2));
|
||||||
|
//
|
||||||
|
// BaseParam baseParam = new BaseParam();
|
||||||
|
// baseParam.setFullChain(false);
|
||||||
|
// baseParam.setRepair(false);
|
||||||
|
// baseParam.setDataDate(currentDate.toLocalDate().format(DatePattern.NORM_DATE_FORMATTER));
|
||||||
|
// baseParam.setTagNames(Stream.of("dataIntegrity").collect(Collectors.toSet()));
|
||||||
|
// baseParam.setIdList(Stream.of(temp).collect(Collectors.toList()));
|
||||||
|
// bsParmList.add(baseParam);
|
||||||
|
// }
|
||||||
|
// }else {
|
||||||
|
// flag =false;
|
||||||
|
// RecallReplyDTO recallReplyDTO2 = new RecallReplyDTO(300,"监测点:"+data.getPointName()+";日期:"+currentDate.toLocalDate()+"执行补招程序超时");
|
||||||
|
//
|
||||||
|
// sendInfo(JSONObject.toJSONString(recallReplyDTO2));
|
||||||
|
//
|
||||||
|
// BaseParam baseParam = new BaseParam();
|
||||||
|
// baseParam.setFullChain(false);
|
||||||
|
// baseParam.setRepair(false);
|
||||||
|
// baseParam.setDataDate(currentDate.toLocalDate().format(DatePattern.NORM_DATE_FORMATTER));
|
||||||
|
// baseParam.setTagNames(Stream.of("dataIntegrity").collect(Collectors.toSet()));
|
||||||
|
// baseParam.setIdList(Stream.of(temp).collect(Collectors.toList()));
|
||||||
|
// bsParmList.add(baseParam);
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// }
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}else {
|
||||||
|
//暂态补招
|
||||||
|
RecallMessage.RecallDTO recallDTO = new RecallMessage.RecallDTO();
|
||||||
|
//不设置dataType暂态稳态全部补招
|
||||||
|
recallDTO.setDataType("0");
|
||||||
|
recallDTO.setMonitorId(Stream.of(temp).collect(Collectors.toList()));
|
||||||
|
|
||||||
|
String eventTime = formatInterval(toDayBeginTime,toDayEndTime);
|
||||||
|
recallDTO.setTimeInterval(Stream.of(eventTime).collect(Collectors.toList()));
|
||||||
|
recallDTO.setNodeId(data2.getNodeId());
|
||||||
|
|
||||||
|
RecallMessage recallMessage = new RecallMessage();
|
||||||
|
recallMessage.setNodeId(data2.getNodeId());
|
||||||
|
recallMessage.setData(Stream.of(recallDTO).collect(Collectors.toList()));
|
||||||
|
String guid = IdUtil.simpleUUID();
|
||||||
|
recallMessage.setGuid(guid);
|
||||||
|
produceFeignClient.recall(recallMessage);
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// boolean flag =true;
|
||||||
|
// LocalDateTime beginTaskTime = LocalDateTime.now();
|
||||||
|
// while (flag){
|
||||||
|
// if(Duration.between(beginTaskTime, LocalDateTime.now()).toMinutes()<=5){
|
||||||
|
// key =RedisKeyPrefix.TOPIC_REPLY.concat(temp).concat(currentDate.toLocalDate().format(DatePattern.NORM_DATE_FORMATTER));
|
||||||
|
//
|
||||||
|
// String jsonString =redisUtil.getStringByKey(key);
|
||||||
|
// if(Objects.nonNull(jsonString)){
|
||||||
|
// TopicReplyDTO bean = JSONUtil.toBean(jsonString, TopicReplyDTO.class, true);
|
||||||
|
// redisUtil.delete(key);
|
||||||
|
//
|
||||||
|
// flag =false;
|
||||||
|
// RecallReplyDTO recallReplyDTO2 = new RecallReplyDTO(300,bean.getResult());
|
||||||
|
//
|
||||||
|
// sendInfo(JSONObject.toJSONString(recallReplyDTO2));
|
||||||
|
//
|
||||||
|
// BaseParam baseParam = new BaseParam();
|
||||||
|
// baseParam.setFullChain(false);
|
||||||
|
// baseParam.setRepair(false);
|
||||||
|
// baseParam.setDataDate(currentDate.toLocalDate().format(DatePattern.NORM_DATE_FORMATTER));
|
||||||
|
// baseParam.setTagNames(Stream.of("dataIntegrity").collect(Collectors.toSet()));
|
||||||
|
// baseParam.setIdList(Stream.of(temp).collect(Collectors.toList()));
|
||||||
|
// bsParmList.add(baseParam);
|
||||||
|
// }
|
||||||
|
// }else {
|
||||||
|
// flag =false;
|
||||||
|
// RecallReplyDTO recallReplyDTO2 = new RecallReplyDTO(300,"监测点:"+data.getPointName()+";日期:"+currentDate.toLocalDate()+"超时");
|
||||||
|
//
|
||||||
|
// sendInfo(JSONObject.toJSONString(recallReplyDTO2));
|
||||||
|
// BaseParam baseParam = new BaseParam();
|
||||||
|
// baseParam.setFullChain(false);
|
||||||
|
// baseParam.setRepair(false);
|
||||||
|
// baseParam.setDataDate(currentDate.toLocalDate().format(DatePattern.NORM_DATE_FORMATTER));
|
||||||
|
// baseParam.setTagNames(Stream.of("dataIntegrity").collect(Collectors.toSet()));
|
||||||
|
// baseParam.setIdList(Stream.of(temp).collect(Collectors.toList()));
|
||||||
|
// bsParmList.add(baseParam);
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// }
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
boolean flag =true;
|
||||||
|
LocalDateTime beginTaskTime = LocalDateTime.now();
|
||||||
|
while (flag){
|
||||||
|
if(Duration.between(beginTaskTime, LocalDateTime.now()).toMinutes()<=10){
|
||||||
|
key =RedisKeyPrefix.TOPIC_REPLY.concat(temp).concat(currentDate.toLocalDate().format(DatePattern.NORM_DATE_FORMATTER));
|
||||||
|
|
||||||
|
String jsonString =redisUtil.getStringByKey(key);
|
||||||
|
if(Objects.nonNull(jsonString)){
|
||||||
|
TopicReplyDTO bean = JSONUtil.toBean(jsonString, TopicReplyDTO.class, true);
|
||||||
|
redisUtil.delete(key);
|
||||||
|
flag =false;
|
||||||
|
RecallReplyDTO recallReplyDTO2 = new RecallReplyDTO(300,bean.getResult());
|
||||||
|
|
||||||
|
sendInfo(JSONObject.toJSONString(recallReplyDTO2));
|
||||||
|
|
||||||
|
BaseParam baseParam = new BaseParam();
|
||||||
|
baseParam.setFullChain(false);
|
||||||
|
baseParam.setRepair(false);
|
||||||
|
baseParam.setDataDate(currentDate.toLocalDate().format(DatePattern.NORM_DATE_FORMATTER));
|
||||||
|
baseParam.setTagNames(Stream.of("dataIntegrity").collect(Collectors.toSet()));
|
||||||
|
baseParam.setIdList(Stream.of(temp).collect(Collectors.toList()));
|
||||||
|
bsParmList.add(baseParam);
|
||||||
|
}
|
||||||
|
}else {
|
||||||
|
flag =false;
|
||||||
|
RecallReplyDTO recallReplyDTO2 = new RecallReplyDTO(300,"监测点:"+data.getPointName()+";日期:"+currentDate.toLocalDate()+"执行补招程序超时");
|
||||||
|
|
||||||
|
sendInfo(JSONObject.toJSONString(recallReplyDTO2));
|
||||||
|
|
||||||
|
BaseParam baseParam = new BaseParam();
|
||||||
|
baseParam.setFullChain(false);
|
||||||
|
baseParam.setRepair(false);
|
||||||
|
baseParam.setDataDate(currentDate.toLocalDate().format(DatePattern.NORM_DATE_FORMATTER));
|
||||||
|
baseParam.setTagNames(Stream.of("dataIntegrity").collect(Collectors.toSet()));
|
||||||
|
baseParam.setIdList(Stream.of(temp).collect(Collectors.toList()));
|
||||||
|
bsParmList.add(baseParam);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
currentDate = tempTime;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
});
|
||||||
|
if(!CollectionUtils.isEmpty(bsParmList)){
|
||||||
|
RecallReplyDTO recallReplyDTO = new RecallReplyDTO(300,"开始执行数据完整性算法");
|
||||||
|
|
||||||
|
sendInfo(JSONObject.toJSONString(recallReplyDTO));
|
||||||
|
bsParmList.forEach(temp->{
|
||||||
|
liteFlowAlgorithmFeignClient.measurementPointExecutor(temp);
|
||||||
|
});
|
||||||
|
RecallReplyDTO recallReplyDTO2 = new RecallReplyDTO(300,"执行完成");
|
||||||
|
|
||||||
|
sendInfo(JSONObject.toJSONString(recallReplyDTO2));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
RecallReplyDTO recallReplyDTO2 = new RecallReplyDTO(200,"补招任务结束");
|
||||||
|
|
||||||
|
sendInfo(JSONObject.toJSONString(recallReplyDTO2));
|
||||||
|
}
|
||||||
|
public List<LocalDateTime> generateTimeIntervals(LocalDate date, int intervalMinutes) {
|
||||||
|
List<LocalDateTime> dateTimeList = new ArrayList<>();
|
||||||
|
|
||||||
|
// Create the starting LocalDateTime
|
||||||
|
LocalDateTime startDateTime = LocalDateTime.of(date, LocalTime.MIDNIGHT);
|
||||||
|
|
||||||
|
// Create the ending LocalDateTime
|
||||||
|
LocalDateTime endDateTime = LocalDateTime.of(date, LocalTime.MAX);
|
||||||
|
|
||||||
|
// Generate LocalDateTime list with the given interval
|
||||||
|
LocalDateTime currentDateTime = startDateTime;
|
||||||
|
while (!currentDateTime.isAfter(endDateTime)) {
|
||||||
|
dateTimeList.add(currentDateTime);
|
||||||
|
currentDateTime = currentDateTime.plusMinutes(intervalMinutes);
|
||||||
|
}
|
||||||
|
|
||||||
|
return dateTimeList;
|
||||||
|
}
|
||||||
|
public List<LocalDateTime> generateTimeIntervals(LocalDateTime startDateTime,LocalDateTime endDateTime , int intervalMinutes) {
|
||||||
|
List<LocalDateTime> dateTimeList = new ArrayList<>();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// Generate LocalDateTime list with the given interval
|
||||||
|
LocalDateTime currentDateTime = startDateTime;
|
||||||
|
while (!currentDateTime.isAfter(endDateTime)) {
|
||||||
|
dateTimeList.add(currentDateTime);
|
||||||
|
currentDateTime = currentDateTime.plusMinutes(intervalMinutes);
|
||||||
|
}
|
||||||
|
|
||||||
|
return dateTimeList;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static List<String> mergeTimeIntervals(List<LocalDateTime> times, int intervalMinutes) {
|
||||||
|
List<String> mergedIntervals = new ArrayList<>();
|
||||||
|
if (times == null || times.isEmpty()) {
|
||||||
|
return mergedIntervals;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Sort the list to ensure the times are in order
|
||||||
|
times.sort(LocalDateTime::compareTo);
|
||||||
|
|
||||||
|
LocalDateTime start = times.get(0);
|
||||||
|
LocalDateTime end = start;
|
||||||
|
|
||||||
|
for (int i = 1; i < times.size(); i++) {
|
||||||
|
LocalDateTime current = times.get(i);
|
||||||
|
if (current.isAfter(end.plusMinutes(intervalMinutes))) {
|
||||||
|
// If the current time is more than interval minutes after the end, close the current interval
|
||||||
|
mergedIntervals.add(formatInterval(start, end));
|
||||||
|
start = current; // Start a new interval
|
||||||
|
}
|
||||||
|
end = current; // Update the end of the current interval
|
||||||
|
}
|
||||||
|
|
||||||
|
// Add the last interval
|
||||||
|
mergedIntervals.add(formatInterval(start, end));
|
||||||
|
|
||||||
|
return mergedIntervals;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static String formatInterval(LocalDateTime start, LocalDateTime end) {
|
||||||
|
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
|
||||||
|
return start.format(formatter) + "~" + end.format(formatter);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param session
|
||||||
|
* @param error
|
||||||
|
*/
|
||||||
|
@OnError
|
||||||
|
public void onError(Session session, Throwable error) {
|
||||||
|
|
||||||
|
log.error("用户错误:" + this.userId + ",原因:" + error.getMessage());
|
||||||
|
error.printStackTrace();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 实现服务
|
||||||
|
* 器主动推送
|
||||||
|
*/
|
||||||
|
public void sendMessage(String message) {
|
||||||
|
try {
|
||||||
|
this.session.getBasicRemote().sendText(message);
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 发送自定
|
||||||
|
* 义消息
|
||||||
|
**/
|
||||||
|
public static void sendInfo(String message) {
|
||||||
|
|
||||||
|
|
||||||
|
webSocketMap.forEach((k,v)->{
|
||||||
|
webSocketMap.get(k).sendMessage(message);
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获得此时的
|
||||||
|
* 在线监测点
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public static synchronized int getOnlineCount() {
|
||||||
|
return onlineCount;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 在线监测点
|
||||||
|
* 数加1
|
||||||
|
*/
|
||||||
|
public static synchronized void addOnlineCount() {
|
||||||
|
RecallWebSocketServer.onlineCount++;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 在线监测点
|
||||||
|
* 数减1
|
||||||
|
*/
|
||||||
|
public static synchronized void subOnlineCount() {
|
||||||
|
RecallWebSocketServer.onlineCount--;
|
||||||
|
}
|
||||||
|
|
||||||
|
// /**
|
||||||
|
// * 过滤所有键包含指定字符串的条目
|
||||||
|
// * @param map 原始的Map
|
||||||
|
// * @param substring 要检查的子字符串
|
||||||
|
// * @return 过滤的Map
|
||||||
|
// */
|
||||||
|
// public static Map<String, String> filterMapByKey(ConcurrentHashMap<String, RecallWebSocketServer> map, String substring) {
|
||||||
|
// Map<String, String> result = new HashMap<>();
|
||||||
|
// for (Map.Entry<String, RecallWebSocketServer> entry : map.entrySet()) {
|
||||||
|
// if (entry.getKey().contains(substring)) {
|
||||||
|
// result.put(entry.getKey(), entry.getValue().toString());
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// return result;
|
||||||
|
// }
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,41 @@
|
|||||||
|
package com.njcn.dataProcess.websocket;
|
||||||
|
|
||||||
|
import org.springframework.context.annotation.Bean;
|
||||||
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
import org.springframework.web.socket.server.standard.ServerEndpointExporter;
|
||||||
|
import org.springframework.web.socket.server.standard.ServletServerContainerFactoryBean;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Description:
|
||||||
|
* Date: 2024/12/13 15:09【需求编号】
|
||||||
|
*
|
||||||
|
* @author clam
|
||||||
|
* @version V1.0.0
|
||||||
|
*/
|
||||||
|
@Configuration
|
||||||
|
public class WebSocketConfig {
|
||||||
|
|
||||||
|
@Bean
|
||||||
|
public ServerEndpointExporter serverEndpointExporter() {
|
||||||
|
return new ServerEndpointExporter();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 通信文本消息和二进制缓存区大小
|
||||||
|
* 避免对接 第三方 报文过大时,Websocket 1009 错误
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
|
||||||
|
@Bean
|
||||||
|
public ServletServerContainerFactoryBean createWebSocketContainer() {
|
||||||
|
ServletServerContainerFactoryBean container = new ServletServerContainerFactoryBean();
|
||||||
|
// 在此处设置bufferSize
|
||||||
|
container.setMaxTextMessageBufferSize(10240000);
|
||||||
|
container.setMaxBinaryMessageBufferSize(10240000);
|
||||||
|
container.setMaxSessionIdleTimeout(15 * 60000L);
|
||||||
|
return container;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,78 @@
|
|||||||
|
#当前服务的基本信息
|
||||||
|
microservice:
|
||||||
|
ename: @artifactId@
|
||||||
|
name: '@name@'
|
||||||
|
version: @version@
|
||||||
|
sentinel:
|
||||||
|
url: @sentinel.url@
|
||||||
|
gateway:
|
||||||
|
url: @gateway.url@
|
||||||
|
server:
|
||||||
|
port: 10405
|
||||||
|
compression:
|
||||||
|
enabled: true
|
||||||
|
mime-types: application/json,application/xml,text/html,text/xml,text/plain
|
||||||
|
min-response-size: 1024
|
||||||
|
#feign接口开启服务熔断降级处理
|
||||||
|
feign:
|
||||||
|
sentinel:
|
||||||
|
enabled: true
|
||||||
|
spring:
|
||||||
|
application:
|
||||||
|
name: @artifactId@
|
||||||
|
#nacos注册中心以及配置中心的指定
|
||||||
|
cloud:
|
||||||
|
nacos:
|
||||||
|
discovery:
|
||||||
|
server-addr: @nacos.url@
|
||||||
|
namespace: @nacos.namespace@
|
||||||
|
config:
|
||||||
|
username: @nacos.username@
|
||||||
|
password: @nacos.password@
|
||||||
|
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
|
||||||
|
servlet:
|
||||||
|
multipart:
|
||||||
|
max-file-size: 100MB
|
||||||
|
max-request-size: 100MB
|
||||||
|
jackson:
|
||||||
|
time-zone: GMT+8
|
||||||
|
|
||||||
|
|
||||||
|
#项目日志的配置
|
||||||
|
logging:
|
||||||
|
config: http://@nacos.url@/nacos/v1/cs/configs?tenant=@nacos.namespace@&group=DEFAULT_GROUP&dataId=logback.xml
|
||||||
|
level:
|
||||||
|
root: error
|
||||||
|
|
||||||
|
|
||||||
|
mqtt:
|
||||||
|
client-id: @artifactId@${random.value}
|
||||||
|
|
||||||
|
data:
|
||||||
|
source:
|
||||||
|
query: Influxdb
|
||||||
|
# insert: Influxdb
|
||||||
|
insert: Relation
|
||||||
|
#mybatis配置信息
|
||||||
|
mybatis-plus:
|
||||||
|
configuration:
|
||||||
|
#配置sql日志输出
|
||||||
|
log-impl: org.apache.ibatis.logging.nologging.NoLoggingImpl
|
||||||
|
|
||||||
|
|
||||||
|
# type-aliases-package: com.njcn.harmonic.pojo
|
||||||
|
# type-handlers-package: com.njcn.db.handler
|
||||||
|
# global-config:
|
||||||
|
# db-config:
|
||||||
|
# date-format: yyyy-MM-dd HH:mm:ss
|
||||||
|
# global-config:
|
||||||
|
# enable-sql-runner: true
|
||||||
@@ -0,0 +1,81 @@
|
|||||||
|
#当前服务的基本信息
|
||||||
|
microservice:
|
||||||
|
ename: @artifactId@
|
||||||
|
name: '@name@'
|
||||||
|
version: @version@
|
||||||
|
sentinel:
|
||||||
|
url: @sentinel.url@
|
||||||
|
gateway:
|
||||||
|
url: @gateway.url@
|
||||||
|
server:
|
||||||
|
port: 10405
|
||||||
|
compression:
|
||||||
|
enabled: true
|
||||||
|
mime-types: application/json,application/xml,text/html,text/xml,text/plain
|
||||||
|
min-response-size: 1024
|
||||||
|
#feign接口开启服务熔断降级处理
|
||||||
|
feign:
|
||||||
|
sentinel:
|
||||||
|
enabled: true
|
||||||
|
spring:
|
||||||
|
application:
|
||||||
|
name: @artifactId@
|
||||||
|
#nacos注册中心以及配置中心的指定
|
||||||
|
cloud:
|
||||||
|
nacos:
|
||||||
|
discovery:
|
||||||
|
ip: @service.server.url@
|
||||||
|
server-addr: @nacos.url@
|
||||||
|
namespace: @nacos.namespace@
|
||||||
|
username: @nacos.username@
|
||||||
|
password: @nacos.password@
|
||||||
|
config:
|
||||||
|
server-addr: @nacos.url@
|
||||||
|
namespace: @nacos.namespace@
|
||||||
|
username: @nacos.username@
|
||||||
|
password: @nacos.password@
|
||||||
|
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
|
||||||
|
servlet:
|
||||||
|
multipart:
|
||||||
|
max-file-size: 100MB
|
||||||
|
max-request-size: 100MB
|
||||||
|
jackson:
|
||||||
|
time-zone: GMT+8
|
||||||
|
|
||||||
|
|
||||||
|
#项目日志的配置
|
||||||
|
logging:
|
||||||
|
#config: http://@nacos.url@/nacos/v1/cs/configs?tenant=@nacos.namespace@&group=DEFAULT_GROUP&dataId=logback.xml
|
||||||
|
level:
|
||||||
|
root: error
|
||||||
|
|
||||||
|
|
||||||
|
#mqtt:
|
||||||
|
# client-id: @artifactId@${random.value}
|
||||||
|
|
||||||
|
data:
|
||||||
|
source:
|
||||||
|
query: Influxdb
|
||||||
|
# insert: Influxdb
|
||||||
|
insert: Relation
|
||||||
|
#mybatis配置信息
|
||||||
|
mybatis-plus:
|
||||||
|
configuration:
|
||||||
|
#配置sql日志输出
|
||||||
|
log-impl: org.apache.ibatis.logging.nologging.NoLoggingImpl
|
||||||
|
|
||||||
|
|
||||||
|
# type-aliases-package: com.njcn.harmonic.pojo
|
||||||
|
# type-handlers-package: com.njcn.db.handler
|
||||||
|
# global-config:
|
||||||
|
# db-config:
|
||||||
|
# date-format: yyyy-MM-dd HH:mm:ss
|
||||||
|
# global-config:
|
||||||
|
# enable-sql-runner: true
|
||||||
@@ -1,77 +1,3 @@
|
|||||||
#当前服务的基本信息
|
|
||||||
microservice:
|
|
||||||
ename: @artifactId@
|
|
||||||
name: '@name@'
|
|
||||||
version: @version@
|
|
||||||
sentinel:
|
|
||||||
url: @sentinel.url@
|
|
||||||
gateway:
|
|
||||||
url: @gateway.url@
|
|
||||||
server:
|
|
||||||
port: 10405
|
|
||||||
compression:
|
|
||||||
enabled: true
|
|
||||||
mime-types: application/json,application/xml,text/html,text/xml,text/plain
|
|
||||||
min-response-size: 1024
|
|
||||||
#feign接口开启服务熔断降级处理
|
|
||||||
feign:
|
|
||||||
sentinel:
|
|
||||||
enabled: true
|
|
||||||
spring:
|
spring:
|
||||||
application:
|
profiles:
|
||||||
name: @artifactId@
|
active: @spring.profiles.active@
|
||||||
#nacos注册中心以及配置中心的指定
|
|
||||||
cloud:
|
|
||||||
nacos:
|
|
||||||
discovery:
|
|
||||||
ip: @service.server.url@
|
|
||||||
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
|
|
||||||
servlet:
|
|
||||||
multipart:
|
|
||||||
max-file-size: 100MB
|
|
||||||
max-request-size: 100MB
|
|
||||||
jackson:
|
|
||||||
time-zone: GMT+8
|
|
||||||
|
|
||||||
|
|
||||||
#项目日志的配置
|
|
||||||
logging:
|
|
||||||
config: http://@nacos.url@/nacos/v1/cs/configs?tenant=@nacos.namespace@&group=DEFAULT_GROUP&dataId=logback.xml
|
|
||||||
level:
|
|
||||||
root: info
|
|
||||||
|
|
||||||
|
|
||||||
mqtt:
|
|
||||||
client-id: @artifactId@${random.value}
|
|
||||||
|
|
||||||
data:
|
|
||||||
source:
|
|
||||||
query: Influxdb
|
|
||||||
# insert: Influxdb
|
|
||||||
insert: Relation
|
|
||||||
#mybatis配置信息
|
|
||||||
mybatis-plus:
|
|
||||||
configuration:
|
|
||||||
#配置sql日志输出
|
|
||||||
log-impl: org.apache.ibatis.logging.nologging.NoLoggingImpl
|
|
||||||
|
|
||||||
|
|
||||||
# type-aliases-package: com.njcn.harmonic.pojo
|
|
||||||
# type-handlers-package: com.njcn.db.handler
|
|
||||||
# global-config:
|
|
||||||
# db-config:
|
|
||||||
# date-format: yyyy-MM-dd HH:mm:ss
|
|
||||||
# global-config:
|
|
||||||
# enable-sql-runner: true
|
|
||||||
@@ -49,6 +49,7 @@ public class DeviceRebootMessage {
|
|||||||
private String series;
|
private String series;
|
||||||
//终端识别码
|
//终端识别码
|
||||||
private String devKey;
|
private String devKey;
|
||||||
|
private Integer processNo;
|
||||||
//
|
//
|
||||||
private List<MonitorInfo> monitorData;
|
private List<MonitorInfo> monitorData;
|
||||||
|
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ import java.io.Serializable;
|
|||||||
public class FrontLogslMessage extends BaseMessage implements Serializable {
|
public class FrontLogslMessage extends BaseMessage implements Serializable {
|
||||||
private String nodeId;
|
private String nodeId;
|
||||||
private String processNo;
|
private String processNo;
|
||||||
|
private String code;
|
||||||
private String businessId;
|
private String businessId;
|
||||||
private String level;
|
private String level;
|
||||||
private String logType;
|
private String logType;
|
||||||
|
|||||||
@@ -1,9 +1,14 @@
|
|||||||
package com.njcn.message.messagedto;
|
package com.njcn.message.messagedto;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
|
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
|
||||||
|
import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateTimeDeserializer;
|
||||||
import com.njcn.middle.rocket.domain.BaseMessage;
|
import com.njcn.middle.rocket.domain.BaseMessage;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
import java.time.LocalDate;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Description:
|
* Description:
|
||||||
@@ -14,11 +19,22 @@ import java.io.Serializable;
|
|||||||
*/
|
*/
|
||||||
@Data
|
@Data
|
||||||
public class TopicReplyDTO extends BaseMessage implements Serializable {
|
public class TopicReplyDTO extends BaseMessage implements Serializable {
|
||||||
//消息id
|
//消息id guid="12345"是补招回复结果
|
||||||
private String guid;
|
private String guid;
|
||||||
|
|
||||||
private String step;
|
private String step;
|
||||||
|
//guid="12345"是补招回复结果
|
||||||
private String result;
|
private String result;
|
||||||
|
|
||||||
|
private String lineIndex;
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
|
@JsonDeserialize(using = LocalDateTimeDeserializer.class)
|
||||||
|
private LocalDateTime recallStartDate;
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
|
@JsonDeserialize(using = LocalDateTimeDeserializer.class)
|
||||||
|
private LocalDateTime recallEndDate;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ import com.njcn.stat.api.MessAnalysisFeignClient;
|
|||||||
import com.njcn.system.api.RocketMqLogFeignClient;
|
import com.njcn.system.api.RocketMqLogFeignClient;
|
||||||
import com.njcn.system.pojo.po.RocketmqMsgErrorLog;
|
import com.njcn.system.pojo.po.RocketmqMsgErrorLog;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.apache.rocketmq.spring.annotation.RocketMQMessageListener;
|
import org.apache.rocketmq.spring.annotation.RocketMQMessageListener;
|
||||||
import org.apache.rocketmq.spring.core.RocketMQListener;
|
import org.apache.rocketmq.spring.core.RocketMQListener;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
@@ -64,25 +65,34 @@ public class DeviceRunFlagDataConsumer extends EnhanceConsumerMessageHandler<Dev
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public boolean filter(DevComFlagDTO message) {
|
public boolean filter(DevComFlagDTO message) {
|
||||||
String keyStatus = redisUtil.getStringByKey(AppRedisKey.RMQ_CONSUME_KEY.concat(message.getKey()));
|
// String keyStatus = redisUtil.getStringByKey(AppRedisKey.RMQ_CONSUME_KEY.concat(message.getKey()));
|
||||||
if (Objects.isNull(keyStatus) || keyStatus.equalsIgnoreCase(MessageStatus.FAIL)) {
|
// if (Objects.isNull(keyStatus) || keyStatus.equalsIgnoreCase(MessageStatus.FAIL)) {
|
||||||
redisUtil.saveByKeyWithExpire(RedisKeyPrefix.DEVICE_RUN_FLAG.concat(message.getKey()), MessageStatus.BEING_PROCESSED, 30L);
|
// redisUtil.saveByKeyWithExpire(RedisKeyPrefix.DEVICE_RUN_FLAG.concat(message.getKey()), MessageStatus.BEING_PROCESSED, 30L);
|
||||||
|
// return false;
|
||||||
|
// }
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
|
||||||
}
|
|
||||||
/**
|
/**
|
||||||
* 消费成功,缓存到redis72小时,避免重复消费
|
* 消费成功,缓存到redis72小时,避免重复消费
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
protected void consumeSuccess(DevComFlagDTO message) {
|
protected void consumeSuccess(DevComFlagDTO message) {
|
||||||
redisUtil.saveByKeyWithExpire(RedisKeyPrefix.DEVICE_RUN_FLAG.concat(message.getKey()), MessageStatus.SUCCESS, 5*60L);
|
// redisUtil.saveByKeyWithExpire(RedisKeyPrefix.DEVICE_RUN_FLAG.concat(message.getKey()), MessageStatus.SUCCESS, 5*60L);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void handleMessage(DevComFlagDTO message) {
|
protected void handleMessage(DevComFlagDTO message) {
|
||||||
|
//获取之前设备状态
|
||||||
|
String devFalg =redisUtil.getStringByKey(RedisKeyPrefix.DEVICE_RUN_FLAG.concat(message.getId()));
|
||||||
|
|
||||||
|
if(StringUtils.isBlank(devFalg)||(!Objects.equals(Integer.valueOf(devFalg),message.getStatus()))){
|
||||||
|
//状态翻转
|
||||||
messAnalysisFeignClient.handleDevRunflag(message);
|
messAnalysisFeignClient.handleDevRunflag(message);
|
||||||
|
redisUtil.saveByKey(RedisKeyPrefix.DEVICE_RUN_FLAG.concat(message.getId()),message.getStatus()+"");
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -70,7 +70,7 @@ public class FrontHeartBeatConsumer extends EnhanceConsumerMessageHandler<FrontH
|
|||||||
// redisUtil.saveByKeyWithExpire(RedisKeyPrefix.HEART_BEAT.concat(message.getKey()), MessageStatus.BEING_PROCESSED, 30L);
|
// redisUtil.saveByKeyWithExpire(RedisKeyPrefix.HEART_BEAT.concat(message.getKey()), MessageStatus.BEING_PROCESSED, 30L);
|
||||||
// return false;
|
// return false;
|
||||||
// }
|
// }
|
||||||
return true;
|
return false;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* 消费成功,缓存到redis72小时,避免重复消费
|
* 消费成功,缓存到redis72小时,避免重复消费
|
||||||
|
|||||||
@@ -74,7 +74,7 @@ public class RealTimeDataConsumer extends EnhanceConsumerMessageHandler<MessageD
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
protected void consumeSuccess(MessageDataDTO message) {
|
protected void consumeSuccess(MessageDataDTO message) {
|
||||||
redisUtil.saveByKeyWithExpire(RedisKeyPrefix.REAL_TIME_DATA.concat(message.getKey()), MessageStatus.SUCCESS, 5*60L);
|
// redisUtil.saveByKeyWithExpire(RedisKeyPrefix.REAL_TIME_DATA.concat(message.getKey()), MessageStatus.SUCCESS, 5*60L);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user