23 Commits

Author SHA1 Message Date
hzj
f1eb4515da 在线率算法修改 2026-05-27 16:27:02 +08:00
xy
c02acfca4f fix(data): 修复数据清理参数系统类型为空时的查询异常
- 添加系统类型参数非空校验
- 避免空值导致数据库查询错误
- 保持原有数据源条件判断逻辑
2026-05-21 19:48:08 +08:00
hzj
221007b367 移动文件 2026-05-21 14:55:11 +08:00
xy
7f6172d0ad refactor(data-process): 重构数据处理服务依赖注入和数据获取逻辑
- 将 PqReasonableRangeFeignClient 替换为 IPqReasonableRangeService 接口
- 统一使用本地服务接口替代远程调用,优化性能
- 移除废弃的 WlMinuteData 方法和相关设备线路查询逻辑
- 标准化时间相关的导入包,只保留必要的类
- 清理未使用的资源注入和函数式编程相关导入
- 简化数据获取流程,统一使用 getMinuteData 方法
2026-05-20 14:08:49 +08:00
5d4e461ef0 Merge pull request '装置文件系统管理' (#1) from master-temp into master
Reviewed-on: #1
2026-05-15 09:17:30 +08:00
hzj
0c8b17d336 装置文件系统管理 2026-05-15 09:12:46 +08:00
hzj
88e0d71718 修改装置最新时间逻辑 2026-05-11 08:46:43 +08:00
wr
f6d8fe73f7 微调 2026-05-08 10:09:48 +08:00
hzj
e6ed7c655a 修改实时超时时间为25s 2026-04-22 14:49:18 +08:00
hzj
6cf56d6768 修改前置兼容性bug 2026-04-16 13:49:17 +08:00
hzj
61e67fc1c8 Merge remote-tracking branch 'origin/master' 2026-04-09 19:54:28 +08:00
hzj
234ba26bbe 修改实时数据超时时间 2026-04-09 19:54:07 +08:00
xy
3d59a3d058 微调 2026-04-09 11:22:07 +08:00
xy
1b9d736e55 三相电压不平衡度越限方法判断调整 2026-04-09 11:10:34 +08:00
hzj
c31d91074d 优化装置状态翻转 2026-04-09 08:58:09 +08:00
hzj
044f3c4d64 相角数据进行兼容处理,让相角保持在-180至180之间 2026-04-08 13:50:10 +08:00
wr
09fe5ca317 Merge remote-tracking branch 'origin/master' 2026-04-02 10:48:59 +08:00
wr
7412e2beda 微调 2026-04-02 10:48:12 +08:00
wr
90baa65b71 微调 2026-04-02 10:47:05 +08:00
xy
3f9e2076d2 辽宁算法兼容 2026-03-26 10:28:33 +08:00
cdf
1bda6b1156 算法模块整合nacos鉴权 2026-03-21 15:18:25 +08:00
xy
d3b4146674 修复bug。功率T项数据缺失 2026-03-18 10:22:57 +08:00
cdf
365448d8a0 修复算法运行报错bug 2026-03-11 11:19:12 +08:00
61 changed files with 1767 additions and 1902 deletions

View File

@@ -1,10 +1,18 @@
package com.njcn.dataProcess.api; package com.njcn.algorithm.pojo.api;
/**
* Description:
* Date: 2026/05/21 下午 2:41需求编号
*
* @author clam
* @version V1.0.0
*/
import com.njcn.algorithm.pojo.api.fallback.PqReasonableRangeFeignClientFallbackFactory;
import com.njcn.algorithm.pojo.dto.PqReasonableRangeDto;
import com.njcn.algorithm.pojo.param.DataCleanParam;
import com.njcn.common.pojo.constant.ServerInfo; import com.njcn.common.pojo.constant.ServerInfo;
import com.njcn.common.pojo.response.HttpResult; import com.njcn.common.pojo.response.HttpResult;
import com.njcn.dataProcess.api.fallback.PqReasonableRangeFeignClientFallbackFactory;
import com.njcn.dataProcess.param.DataCleanParam;
import com.njcn.dataProcess.pojo.dto.PqReasonableRangeDto;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import org.springframework.cloud.openfeign.FeignClient; import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PostMapping;
@@ -17,7 +25,7 @@ import java.util.List;
* @version 1.0.0 * @version 1.0.0
* @date 2025年02月13日 20:11 * @date 2025年02月13日 20:11
*/ */
@FeignClient(value = ServerInfo.PLATFORM_DATA_PROCESSING_BOOT, path = "/pqReasonableRange", fallbackFactory = PqReasonableRangeFeignClientFallbackFactory.class, contextId = "pqReasonableRange") @FeignClient(value = ServerInfo.ALGORITHM_BOOT, path = "/pqReasonableRange", fallbackFactory = PqReasonableRangeFeignClientFallbackFactory.class, contextId = "pqReasonableRange")
public interface PqReasonableRangeFeignClient { public interface PqReasonableRangeFeignClient {
@PostMapping("/getData") @PostMapping("/getData")
@@ -25,3 +33,4 @@ public interface PqReasonableRangeFeignClient {
HttpResult<List<PqReasonableRangeDto>> getData(@RequestBody DataCleanParam param); HttpResult<List<PqReasonableRangeDto>> getData(@RequestBody DataCleanParam param);
} }

View File

@@ -1,12 +1,12 @@
package com.njcn.dataProcess.api.fallback; package com.njcn.algorithm.pojo.api.fallback;
import com.njcn.algorithm.pojo.api.PqReasonableRangeFeignClient;
import com.njcn.algorithm.pojo.dto.PqReasonableRangeDto;
import com.njcn.algorithm.pojo.param.DataCleanParam;
import com.njcn.algorithm.pojo.util.PrepareEnumUtil;
import com.njcn.common.pojo.enums.response.CommonResponseEnum; import com.njcn.common.pojo.enums.response.CommonResponseEnum;
import com.njcn.common.pojo.exception.BusinessException; 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.PqReasonableRangeFeignClient;
import com.njcn.dataProcess.param.DataCleanParam;
import com.njcn.dataProcess.pojo.dto.PqReasonableRangeDto;
import com.njcn.dataProcess.util.DataProcessingEnumUtil;
import feign.hystrix.FallbackFactory; import feign.hystrix.FallbackFactory;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
@@ -14,9 +14,11 @@ import org.springframework.stereotype.Component;
import java.util.List; import java.util.List;
/** /**
* @author xy * Description:
* @version 1.0.0 * Date: 2026/05/21 下午 2:42需求编号
* @date 2025年02月13日 20:13 *
* @author clam
* @version V1.0.0
*/ */
@Slf4j @Slf4j
@Component @Component
@@ -32,7 +34,7 @@ public class PqReasonableRangeFeignClientFallbackFactory implements FallbackFact
Enum<?> exceptionEnum = CommonResponseEnum.SERVICE_FALLBACK; Enum<?> exceptionEnum = CommonResponseEnum.SERVICE_FALLBACK;
if(cause.getCause() instanceof BusinessException){ if(cause.getCause() instanceof BusinessException){
BusinessException businessException = (BusinessException) cause.getCause(); BusinessException businessException = (BusinessException) cause.getCause();
exceptionEnum = DataProcessingEnumUtil.getExceptionEnum(businessException.getResult()); exceptionEnum = PrepareEnumUtil.getExceptionEnum(businessException.getResult());
} }
Enum<?> finalExceptionEnum = exceptionEnum; Enum<?> finalExceptionEnum = exceptionEnum;
return new PqReasonableRangeFeignClient() { return new PqReasonableRangeFeignClient() {
@@ -45,3 +47,4 @@ public class PqReasonableRangeFeignClientFallbackFactory implements FallbackFact
}; };
} }
} }

View File

@@ -1,4 +1,4 @@
package com.njcn.dataProcess.pojo.dto; package com.njcn.algorithm.pojo.dto;
import lombok.Data; import lombok.Data;

View File

@@ -1,4 +1,4 @@
package com.njcn.dataProcess.param; package com.njcn.algorithm.pojo.param;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;

View File

@@ -1,4 +1,4 @@
package com.njcn.dataProcess.pojo.po; package com.njcn.algorithm.pojo.po;
import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.TableName;
import com.njcn.db.bo.BaseEntity; import com.njcn.db.bo.BaseEntity;

View File

@@ -0,0 +1,91 @@
package com.njcn.algorithm.controller;
import com.njcn.algorithm.pojo.dto.PqReasonableRangeDto;
import com.njcn.algorithm.pojo.param.DataCleanParam;
import com.njcn.algorithm.service.line.IPqReasonableRangeService;
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.csdevice.enums.DeviceOperate;
import com.njcn.web.advice.DeviceLog;
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.*;
import javax.annotation.Resource;
import java.util.List;
/**
* <p>
* 前端控制器
* </p>
*
* @author xy
* @since 2025-02-13
*/
@Validated
@Slf4j
@Controller
@RestController
@RequestMapping("/pqReasonableRange")
@Api(tags = "数据清洗标准库")
public class PqReasonableRangeController extends BaseController {
@Resource
private IPqReasonableRangeService pqReasonableRangeService;
@OperateInfo(info = LogEnum.BUSINESS_COMMON,operateType = OperateType.QUERY)
@PostMapping("/getData")
@ApiOperation("按条件获取数据合理范围")
public HttpResult<List<PqReasonableRangeDto>> getData(@RequestBody DataCleanParam param) {
String methodDescribe = getMethodDescribe("getData");
List<PqReasonableRangeDto> list = pqReasonableRangeService.getReasonableRangeList(param);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe);
}
@OperateInfo(info = LogEnum.BUSINESS_COMMON,operateType = OperateType.ADD)
@PostMapping("/save")
@ApiOperation("新增数据合理范围")
public HttpResult<String> save(@RequestBody @Validated PqReasonableRangeDto dto) {
String methodDescribe = getMethodDescribe("save");
boolean result = pqReasonableRangeService.savePqReasonableRange(dto);
if (result) {
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, "新增成功", methodDescribe);
}
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.FAIL, "新增失败", methodDescribe);
}
@OperateInfo(info = LogEnum.BUSINESS_COMMON,operateType = OperateType.UPDATE)
@PostMapping("/update")
@ApiOperation("更新数据合理范围")
public HttpResult<String> update(@RequestBody @Validated PqReasonableRangeDto dto) {
String methodDescribe = getMethodDescribe("update");
boolean result = pqReasonableRangeService.updatePqReasonableRange(dto);
if (result) {
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, "更新成功", methodDescribe);
}
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.FAIL, "更新失败", methodDescribe);
}
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
@PostMapping("/delete")
@ApiOperation("删除数据合理范围")
@DeviceLog(operateType = DeviceOperate.DELETE)
public HttpResult<String> delete(@RequestParam("id") String id) {
String methodDescribe = getMethodDescribe("delete");
boolean result = pqReasonableRangeService.deletePqReasonableRange(id);
if (result) {
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, "删除成功", methodDescribe);
}
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.FAIL, "删除失败", methodDescribe);
}
}

View File

@@ -1,10 +1,7 @@
package com.njcn.dataProcess.dao.relation.mapper; package com.njcn.algorithm.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.njcn.dataProcess.pojo.dto.PqReasonableRangeDto; import com.njcn.algorithm.pojo.po.PqReasonableRange;
import com.njcn.dataProcess.pojo.po.PqReasonableRange;
import java.util.List;
/** /**
* <p> * <p>

View File

@@ -1,7 +1,7 @@
package com.njcn.algorithm.service.line; package com.njcn.algorithm.service.line;
import com.njcn.algorithm.pojo.bo.CalculatedParam; import com.njcn.algorithm.pojo.bo.CalculatedParam;
import com.njcn.dataProcess.pojo.dto.PqReasonableRangeDto; import com.njcn.algorithm.pojo.dto.PqReasonableRangeDto;
import com.njcn.device.pq.pojo.vo.LineDetailVO; import com.njcn.device.pq.pojo.vo.LineDetailVO;
import com.njcn.system.pojo.po.DictData; import com.njcn.system.pojo.po.DictData;

View File

@@ -1,9 +1,9 @@
package com.njcn.dataProcess.service; package com.njcn.algorithm.service.line;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
import com.njcn.dataProcess.param.DataCleanParam; import com.njcn.algorithm.pojo.dto.PqReasonableRangeDto;
import com.njcn.dataProcess.pojo.dto.PqReasonableRangeDto; import com.njcn.algorithm.pojo.param.DataCleanParam;
import com.njcn.dataProcess.pojo.po.PqReasonableRange; import com.njcn.algorithm.pojo.po.PqReasonableRange;
import java.util.List; import java.util.List;
@@ -24,4 +24,10 @@ public interface IPqReasonableRangeService extends IService<PqReasonableRange> {
*/ */
List<PqReasonableRangeDto> getReasonableRangeList(DataCleanParam param); List<PqReasonableRangeDto> getReasonableRangeList(DataCleanParam param);
boolean savePqReasonableRange(PqReasonableRangeDto dto);
boolean updatePqReasonableRange(PqReasonableRangeDto dto);
boolean deletePqReasonableRange(String id);
} }

View File

@@ -3,13 +3,15 @@ package com.njcn.algorithm.serviceimpl.line;
import cn.hutool.core.collection.CollUtil; import cn.hutool.core.collection.CollUtil;
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.pojo.dto.PqReasonableRangeDto;
import com.njcn.algorithm.pojo.param.DataCleanParam;
import com.njcn.algorithm.service.line.FlowAsyncService; 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.service.line.IPqReasonableRangeService;
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.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.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;
@@ -33,7 +35,9 @@ import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.lang.reflect.Method; import java.lang.reflect.Method;
import java.time.*; import java.time.Instant;
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.function.Function; import java.util.function.Function;
@@ -80,7 +84,7 @@ public class DataCleanServiceImpl implements IDataCleanService {
@Resource @Resource
private PqDataVerifyFeignClient pqDataVerifyFeignClient; private PqDataVerifyFeignClient pqDataVerifyFeignClient;
@Resource @Resource
private PqReasonableRangeFeignClient pqReasonableRangeFeignClient; private IPqReasonableRangeService pqReasonableRangeService;
@Resource @Resource
private LineFeignClient lineFeignClient; private LineFeignClient lineFeignClient;
@Resource @Resource
@@ -644,7 +648,7 @@ public class DataCleanServiceImpl implements IDataCleanService {
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 = pqReasonableRangeService.getReasonableRangeList(param);
if (CollUtil.isNotEmpty(list)) { if (CollUtil.isNotEmpty(list)) {
pqReasonableRangeDtoMap = list.stream().collect(Collectors.groupingBy(PqReasonableRangeDto::getInfluxdbTableName)); pqReasonableRangeDtoMap = list.stream().collect(Collectors.groupingBy(PqReasonableRangeDto::getInfluxdbTableName));
} }
@@ -662,7 +666,7 @@ public class DataCleanServiceImpl implements IDataCleanService {
if (ObjectUtil.isNotNull(tableName)) { if (ObjectUtil.isNotNull(tableName)) {
param.setTableName(tableName); param.setTableName(tableName);
} }
List<PqReasonableRangeDto> list = pqReasonableRangeFeignClient.getData(param).getData(); List<PqReasonableRangeDto> list = pqReasonableRangeService.getReasonableRangeList(param);
if (CollUtil.isNotEmpty(list)) { if (CollUtil.isNotEmpty(list)) {
pqReasonableRangeDtoMap = list.stream().collect(Collectors.toMap(PqReasonableRangeDto::getIndexCode, Function.identity())); pqReasonableRangeDtoMap = list.stream().collect(Collectors.toMap(PqReasonableRangeDto::getIndexCode, Function.identity()));
} }

View File

@@ -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) {
@@ -102,7 +107,8 @@ public class DayDataServiceImpl implements IDayDataService {
dto.setPhasicType(item2.getPhasicType()); dto.setPhasicType(item2.getPhasicType());
dto.setValueType(item3.getValueType().toUpperCase()); 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);
}); });
}); });
@@ -150,7 +156,7 @@ public class DayDataServiceImpl implements IDayDataService {
dto.setPhasicType(item2.getPhasicType()); dto.setPhasicType(item2.getPhasicType());
dto.setValueType(item3.getValueType().toUpperCase()); 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);
}); });
}); });
@@ -198,7 +204,7 @@ public class DayDataServiceImpl implements IDayDataService {
dto.setPhasicType(item2.getPhasicType()); dto.setPhasicType(item2.getPhasicType());
dto.setValueType(item4.toUpperCase()); 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);
}); });
}); });
@@ -247,7 +253,7 @@ public class DayDataServiceImpl implements IDayDataService {
dto.setPhasicType(item2.getPhasicType()); dto.setPhasicType(item2.getPhasicType());
dto.setValueType(item4.toUpperCase()); 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);
}); });
}); });
@@ -296,7 +302,7 @@ public class DayDataServiceImpl implements IDayDataService {
dto.setPhasicType(item2.getPhasicType()); dto.setPhasicType(item2.getPhasicType());
dto.setValueType(item3.getValueType().toUpperCase()); 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);
}); });
}); });
@@ -344,7 +350,7 @@ public class DayDataServiceImpl implements IDayDataService {
dto.setPhasicType(item2.getPhasicType()); dto.setPhasicType(item2.getPhasicType());
dto.setValueType(item3.getValueType().toUpperCase()); 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);
}); });
}); });
@@ -392,7 +398,7 @@ public class DayDataServiceImpl implements IDayDataService {
dto.setPhasicType(item2.getPhasicType()); dto.setPhasicType(item2.getPhasicType());
dto.setValueType(item3.getValueType().toUpperCase()); 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);
}); });
}); });
@@ -440,7 +446,7 @@ public class DayDataServiceImpl implements IDayDataService {
dto.setPhasicType(item2.getPhasicType()); dto.setPhasicType(item2.getPhasicType());
dto.setValueType(item3.getValueType().toUpperCase()); 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);
}); });
}); });
@@ -488,7 +494,7 @@ public class DayDataServiceImpl implements IDayDataService {
dto.setPhasicType(item2.getPhasicType()); dto.setPhasicType(item2.getPhasicType());
dto.setValueType(item3.getValueType().toUpperCase()); 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);
}); });
}); });
@@ -536,7 +542,7 @@ public class DayDataServiceImpl implements IDayDataService {
dto.setPhasicType(item2.getPhasicType()); dto.setPhasicType(item2.getPhasicType());
dto.setValueType(item3.getValueType().toUpperCase()); 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);
}); });
}); });
@@ -584,7 +590,7 @@ public class DayDataServiceImpl implements IDayDataService {
dto.setPhasicType(item2.getPhasicType()); dto.setPhasicType(item2.getPhasicType());
dto.setValueType(item3.getValueType().toUpperCase()); 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);
}); });
}); });
@@ -632,7 +638,7 @@ public class DayDataServiceImpl implements IDayDataService {
dto.setPhasicType(item2.getPhasicType()); dto.setPhasicType(item2.getPhasicType());
dto.setValueType(item3.getValueType().toUpperCase()); 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);
}); });
}); });
@@ -680,7 +686,7 @@ public class DayDataServiceImpl implements IDayDataService {
dto.setPhasicType(item2.getPhasicType()); dto.setPhasicType(item2.getPhasicType());
dto.setValueType(item3.getValueType().toUpperCase()); 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);
}); });
}); });
@@ -728,7 +734,7 @@ public class DayDataServiceImpl implements IDayDataService {
dto.setPhasicType(item2.getPhasicType()); dto.setPhasicType(item2.getPhasicType());
dto.setValueType(item4.toUpperCase()); 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);
}); });
}); });
@@ -1549,23 +1555,20 @@ 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); 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); 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; result = average.isPresent() ? average.getAsDouble() : 0.0;
break; break;
default: default:
@@ -1573,29 +1576,42 @@ public class DayDataServiceImpl implements IDayDataService {
} }
} 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); 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); 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; 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); result = remainingList.isEmpty() ? 0.0 : remainingList.get(0);
break; break;
default: default:
@@ -1610,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);
}
});
});
});
}
} }

View File

@@ -7,6 +7,7 @@ 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.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.pojo.dto.PqReasonableRangeDto;
import com.njcn.algorithm.service.line.FlowAsyncService; import com.njcn.algorithm.service.line.FlowAsyncService;
import com.njcn.dataProcess.api.*; import com.njcn.dataProcess.api.*;
import com.njcn.dataProcess.dto.DataCleanJsonDTO; import com.njcn.dataProcess.dto.DataCleanJsonDTO;
@@ -92,7 +93,7 @@ public class FlowAsyncServiceImpl implements FlowAsyncService {
@Override @Override
@Async("asyncExecutor") @Async("asyncExecutor")
public void lineDataClean(LineDetailVO.Detail line, Map<String, List<PqReasonableRangeDto>> map, String dataDate,DictData dip,DictData rise,int size,int i) { public void lineDataClean(LineDetailVO.Detail line, Map<String, List<PqReasonableRangeDto>> map, String dataDate, DictData dip, DictData rise, int size, int i) {
LineDetailVO.Detail item = line; LineDetailVO.Detail item = line;
List<Map<String, Object>> resultData = new ArrayList<>(); List<Map<String, Object>> resultData = new ArrayList<>();
Set<String> allTimeSet = new HashSet<>(); Set<String> allTimeSet = new HashSet<>();

View File

@@ -18,6 +18,7 @@ import com.njcn.influx.pojo.constant.InfluxDBTableConstant;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.scheduling.annotation.Async; import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils; import org.springframework.util.CollectionUtils;
@@ -53,6 +54,11 @@ public class IDataLimitRateAsyncImpl implements IDataLimitRateAsync {
private DataLimitRateFeignClient dataLimitRateFeignClient; private DataLimitRateFeignClient dataLimitRateFeignClient;
@Resource @Resource
private DataLimitRateDetailFeignClient dataLimitRateDetailFeignClient; private DataLimitRateDetailFeignClient dataLimitRateDetailFeignClient;
/**
* 查询配置 辽宁版本比较特殊没有CP95值采用平均值进行判断
*/
@Value("${version.used:master}")
private String versionUsed;
@Override @Override
@@ -80,6 +86,7 @@ public class IDataLimitRateAsyncImpl implements IDataLimitRateAsync {
List<DataHarmDto> dataVInHarmList = dataInharmVFeignClient.getRawData(lineParam).getData(); List<DataHarmDto> dataVInHarmList = dataInharmVFeignClient.getRawData(lineParam).getData();
//电流数据 //电流数据
List<DataIDto> dataIList = dataIFeignClient.getRawData(lineParam).getData(); List<DataIDto> dataIList = dataIFeignClient.getRawData(lineParam).getData();
/** /**
* 功能描述:获取influxDB -> data_v -> * 功能描述:获取influxDB -> data_v ->
* 总计算次数(用data_v中phasic_type=A,value_type=avg,quality_flag=0来参与统计) * 总计算次数(用data_v中phasic_type=A,value_type=avg,quality_flag=0来参与统计)
@@ -122,53 +129,108 @@ public class IDataLimitRateAsyncImpl implements IDataLimitRateAsync {
*功能描述:获取influxDB -> data_harmrate_v -> *功能描述:获取influxDB -> data_harmrate_v ->
* 2-25次谐波电压含有率 -> A相||B相||C相的日95%概率值 * 2-25次谐波电压含有率 -> A相||B相||C相的日95%概率值
*/ */
Map<String, List<DataHarmDto>> harmRateV = dataVHarmList.stream() Map<String, List<DataHarmDto>> harmRateV;
.filter(x -> phase.contains(x.getPhasicType())) if (Objects.equals(versionUsed, "liaoning")) {
.filter(x -> InfluxDBTableConstant.CP95.equalsIgnoreCase(x.getValueType())) harmRateV = dataVHarmList.stream()
.collect(Collectors.groupingBy(DataHarmDto::getLineId)); .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%概率值 * 功能描述:获取influxDB -> data_i -> 2-25次谐波电流 -> 日95%概率值
*/ */
Map<String, List<DataIDto>> dataI = dataIList.stream() Map<String, List<DataIDto>> dataI;
.filter(x -> phase.contains(x.getPhasicType())) if (Objects.equals(versionUsed, "liaoning")) {
.filter(x -> InfluxDBTableConstant.CP95.equalsIgnoreCase(x.getValueType())) dataI = dataIList.stream()
.collect(Collectors.groupingBy(DataIDto::getLineId)); .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%概率值 * 功能描述:获取influxDB -> data_inharm_v -> 0.5-15.5次间谐波电压含有率 -> 日95%概率值
*/ */
Map<String, List<DataHarmDto>> inHarmV = dataVInHarmList.stream() Map<String, List<DataHarmDto>> inHarmV;
.filter(x -> phase.contains(x.getPhasicType())) if (Objects.equals(versionUsed, "liaoning")) {
.filter(x -> InfluxDBTableConstant.CP95.equalsIgnoreCase(x.getValueType())) inHarmV = dataVInHarmList.stream()
.collect(Collectors.groupingBy(DataHarmDto::getLineId)); .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%概率值 * 功能描述:获取influxDB -> data_v -> 电压总谐波畸变率 -> 日95%概率值
*/ */
Map<String, List<DataVDto>> dataVThd = dataVAllTime.stream() Map<String, List<DataVDto>> dataVThd;
.filter(x -> phase.contains(x.getPhasicType())) if (Objects.equals(versionUsed, "liaoning")) {
.filter(x -> InfluxDBTableConstant.CP95.equalsIgnoreCase(x.getValueType())) dataVThd = dataVAllTime.stream()
.collect(Collectors.groupingBy(DataVDto::getLineId)); .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%概率值 * 功能描述:获取influxDB -> data_v -> 负序电压不平衡度 -> 最大值 && 日95%概率值
*/ */
Map<String, List<DataVDto>> dataVUnbalance = dataVAllTime.stream() Map<String, List<DataVDto>> dataVUnbalance;
.filter(x -> InfluxDBTableConstant.PHASE_TYPE_T.equalsIgnoreCase(x.getPhasicType())) if (Objects.equals(versionUsed, "liaoning")) {
.filter(x -> InfluxDBTableConstant.CP95.equalsIgnoreCase(x.getValueType()) || dataVUnbalance = dataVAllTime.stream()
InfluxDBTableConstant.MAX.equalsIgnoreCase(x.getValueType())) .filter(x -> InfluxDBTableConstant.PHASE_TYPE_T.equalsIgnoreCase(x.getPhasicType()))
.collect(Collectors.groupingBy(DataVDto::getLineId)); .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%概率值 * 功能描述:获取influxDB -> data_i -> 负序电流 -> 最大值 && 日95%概率值
*/ */
Map<String, List<DataIDto>> dataINeg = dataIList.stream() Map<String, List<DataIDto>> dataINeg;
.filter(x -> InfluxDBTableConstant.PHASE_TYPE_T.equalsIgnoreCase(x.getPhasicType())) if (Objects.equals(versionUsed, "liaoning")) {
.filter(x -> InfluxDBTableConstant.CP95.equalsIgnoreCase(x.getValueType()) || dataINeg = dataIList.stream()
InfluxDBTableConstant.MAX.equalsIgnoreCase(x.getValueType())) .filter(x -> InfluxDBTableConstant.PHASE_TYPE_T.equalsIgnoreCase(x.getPhasicType()))
.collect(Collectors.groupingBy(DataIDto::getLineId)); .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 -> 频率偏差 -> 最大值 && 最小值 * 功能描述:获取influxDB -> data_v -> 频率偏差 -> 最大值 && 最小值
@@ -307,9 +369,6 @@ public class IDataLimitRateAsyncImpl implements IDataLimitRateAsync {
result.add(c); result.add(c);
result.add(t); result.add(t);
return result; return result;
} }
@@ -582,12 +641,20 @@ public class IDataLimitRateAsyncImpl implements IDataLimitRateAsync {
} }
} }
} }
//三相电压不平衡度 // 三相电压不平衡度
// 短时对应测量值日统计的最大值4%
// 一般对应测量值日统计的95%概率大值2%
if (!CollectionUtils.isEmpty(dataVPOUnbalanceList)) { if (!CollectionUtils.isEmpty(dataVPOUnbalanceList)) {
for (DataVDto item : dataVPOUnbalanceList) { for (DataVDto item : dataVPOUnbalanceList) {
if (ObjectUtil.isNotNull(item.getVUnbalance())) { if (ObjectUtil.isNotNull(item.getVUnbalance())) {
if (item.getVUnbalance() > overlimit.getUbalance()) { if (InfluxDBTableConstant.MAX.equalsIgnoreCase(item.getValueType())) {
addAbnormalData(sx, item.getPhasicType(), item.getValueType(), item.getMinTime(), item.getVUnbalance(), overlimit.getUbalance()); if (item.getVUnbalance() > 4.0) {
addAbnormalData(sx, item.getPhasicType(), item.getValueType(), item.getMinTime(), item.getVUnbalance(), 4.0f);
}
} else {
if (item.getVUnbalance() > 2.0) {
addAbnormalData(sx, item.getPhasicType(), "CP95", item.getMinTime(), item.getVUnbalance(), 2.0f);
}
} }
} }
} }

View File

@@ -247,6 +247,8 @@ public class IDataOnlineRateServiceImpl implements IDataOnlineRateService {
long differ = DateUtil.between(date, newDate, DateUnit.MINUTE); long differ = DateUtil.between(date, newDate, DateUnit.MINUTE);
if (online.equals(type)) { if (online.equals(type)) {
minute = InfluxDBPublicParam.DAY_MINUTE - (int) differ; minute = InfluxDBPublicParam.DAY_MINUTE - (int) differ;
}else{
minute = (int) differ;
} }
} else { } else {
List<PqsCommunicateDto> communicateDataOld = communicateFeignClient.getRawDataEnd(lineParam).getData(); List<PqsCommunicateDto> communicateDataOld = communicateFeignClient.getRawDataEnd(lineParam).getData();

View File

@@ -1,14 +1,16 @@
package com.njcn.dataProcess.service.impl.relation; package com.njcn.algorithm.serviceimpl.line;
import cn.hutool.core.collection.CollUtil; import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.util.StrUtil; import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.njcn.dataProcess.dao.relation.mapper.PqReasonableRangeMapper; import com.njcn.algorithm.mapper.PqReasonableRangeMapper;
import com.njcn.dataProcess.param.DataCleanParam; import com.njcn.algorithm.pojo.dto.PqReasonableRangeDto;
import com.njcn.dataProcess.pojo.dto.PqReasonableRangeDto; import com.njcn.algorithm.pojo.param.DataCleanParam;
import com.njcn.dataProcess.pojo.po.PqReasonableRange; import com.njcn.algorithm.pojo.po.PqReasonableRange;
import com.njcn.dataProcess.service.IPqReasonableRangeService; import com.njcn.algorithm.service.line.IPqReasonableRangeService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@@ -23,14 +25,18 @@ import java.util.List;
* @author xy * @author xy
* @since 2025-02-13 * @since 2025-02-13
*/ */
@Slf4j
@Service @Service
@RequiredArgsConstructor
public class PqReasonableRangeServiceImpl extends ServiceImpl<PqReasonableRangeMapper, PqReasonableRange> implements IPqReasonableRangeService { public class PqReasonableRangeServiceImpl extends ServiceImpl<PqReasonableRangeMapper, PqReasonableRange> implements IPqReasonableRangeService {
@Override @Override
public List<PqReasonableRangeDto> getReasonableRangeList(DataCleanParam param) { public List<PqReasonableRangeDto> getReasonableRangeList(DataCleanParam param) {
List<PqReasonableRangeDto> result = new ArrayList<>(); List<PqReasonableRangeDto> result = new ArrayList<>();
LambdaQueryWrapper<PqReasonableRange> queryWrapper = new LambdaQueryWrapper<>(); LambdaQueryWrapper<PqReasonableRange> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(PqReasonableRange::getBelongingSystem,param.getSystemType()); if (StrUtil.isNotBlank(param.getSystemType())) {
queryWrapper.eq(PqReasonableRange::getBelongingSystem,param.getSystemType());
}
if(StrUtil.isNotBlank(param.getDataSource())){ if(StrUtil.isNotBlank(param.getDataSource())){
queryWrapper.eq(PqReasonableRange::getDataSource,param.getDataSource()); queryWrapper.eq(PqReasonableRange::getDataSource,param.getDataSource());
} }
@@ -48,4 +54,29 @@ public class PqReasonableRangeServiceImpl extends ServiceImpl<PqReasonableRangeM
} }
return result; return result;
} }
@Override
public boolean savePqReasonableRange(PqReasonableRangeDto dto) {
PqReasonableRange entity = new PqReasonableRange();
BeanUtils.copyProperties(dto, entity);
entity.setState(1);
return this.save(entity);
}
@Override
public boolean updatePqReasonableRange(PqReasonableRangeDto dto) {
PqReasonableRange entity = new PqReasonableRange();
BeanUtils.copyProperties(dto, entity);
return this.updateById(entity);
}
@Override
public boolean deletePqReasonableRange(String id) {
PqReasonableRange entity = this.getById(id);
if (entity != null) {
entity.setState(0);
return this.updateById(entity);
}
return false;
}
} }

View File

@@ -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;

View 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}

View File

@@ -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}

View File

@@ -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: error
#mybatis配置信息
mybatis-plus:
#别名扫描
type-aliases-package: com.njcn.harmonic.pojo
line:
num: 10
mqtt:
client-id: @artifactId@${random.value}

View File

@@ -18,6 +18,28 @@ import java.util.Objects;
* @version V1.0.0 * @version V1.0.0
*/ */
public class BeanIConverter { public class BeanIConverter {
/**
* 角度相关常量
*/
private static final double ANGLE_180 = 180.0;
private static final double ANGLE_360 = 360.0;
private static final double ANGLE_MINUS_180 = -180.0;
public static Double adjustPhase(Double phase) {
if (phase == null) {
return null;
}
// 使用模运算将角度标准化到[-180, 180]范围
double normalizedPhase = phase % ANGLE_360;
// 处理超出[-180, 180]范围的情况
if (normalizedPhase > ANGLE_180) {
normalizedPhase -= ANGLE_360;
} else if (normalizedPhase < ANGLE_MINUS_180) {
normalizedPhase += ANGLE_360;
}
return normalizedPhase;
}
//A,B,C三项 //A,B,C三项
public static DataIDTO messageDataITODataI(MessageDataI messageDataI){ public static DataIDTO messageDataITODataI(MessageDataI messageDataI){
DataIDTO dataI = new DataIDTO(); DataIDTO dataI = new DataIDTO();
@@ -283,209 +305,209 @@ public class BeanIConverter {
public static DataHarmphasicIDTO messageDataITODataHarmphasicI(MessageDataI messageDataI){ public static DataHarmphasicIDTO messageDataITODataHarmphasicI(MessageDataI messageDataI){
DataHarmphasicIDTO dataHarmphasicI = new DataHarmphasicIDTO(); DataHarmphasicIDTO dataHarmphasicI = new DataHarmphasicIDTO();
if(Objects.nonNull(messageDataI)){ if(Objects.nonNull(messageDataI)){
dataHarmphasicI.setI1(messageDataI.getIfundAngle()); dataHarmphasicI.setI1(adjustPhase(messageDataI.getIfundAngle()));
dataHarmphasicI.setI2(messageDataI.getIa2()); dataHarmphasicI.setI2(adjustPhase(messageDataI.getIa2()));
dataHarmphasicI.setI3(messageDataI.getIa3()); dataHarmphasicI.setI3(adjustPhase(messageDataI.getIa3()));
dataHarmphasicI.setI4(messageDataI.getIa4()); dataHarmphasicI.setI4(adjustPhase(messageDataI.getIa4()));
dataHarmphasicI.setI5(messageDataI.getIa5()); dataHarmphasicI.setI5(adjustPhase(messageDataI.getIa5()));
dataHarmphasicI.setI6(messageDataI.getIa6()); dataHarmphasicI.setI6(adjustPhase(messageDataI.getIa6()));
dataHarmphasicI.setI7(messageDataI.getIa7()); dataHarmphasicI.setI7(adjustPhase(messageDataI.getIa7()));
dataHarmphasicI.setI8(messageDataI.getIa8()); dataHarmphasicI.setI8(adjustPhase(messageDataI.getIa8()));
dataHarmphasicI.setI9(messageDataI.getIa9()); dataHarmphasicI.setI9(adjustPhase(messageDataI.getIa9()));
dataHarmphasicI.setI10(messageDataI.getIa10()); dataHarmphasicI.setI10(adjustPhase(messageDataI.getIa10()));
dataHarmphasicI.setI11(messageDataI.getIa11()); dataHarmphasicI.setI11(adjustPhase(messageDataI.getIa11()));
dataHarmphasicI.setI12(messageDataI.getIa12()); dataHarmphasicI.setI12(adjustPhase(messageDataI.getIa12()));
dataHarmphasicI.setI13(messageDataI.getIa13()); dataHarmphasicI.setI13(adjustPhase(messageDataI.getIa13()));
dataHarmphasicI.setI14(messageDataI.getIa14()); dataHarmphasicI.setI14(adjustPhase(messageDataI.getIa14()));
dataHarmphasicI.setI15(messageDataI.getIa15()); dataHarmphasicI.setI15(adjustPhase(messageDataI.getIa15()));
dataHarmphasicI.setI16(messageDataI.getIa16()); dataHarmphasicI.setI16(adjustPhase(messageDataI.getIa16()));
dataHarmphasicI.setI17(messageDataI.getIa17()); dataHarmphasicI.setI17(adjustPhase(messageDataI.getIa17()));
dataHarmphasicI.setI18(messageDataI.getIa18()); dataHarmphasicI.setI18(adjustPhase(messageDataI.getIa18()));
dataHarmphasicI.setI19(messageDataI.getIa19()); dataHarmphasicI.setI19(adjustPhase(messageDataI.getIa19()));
dataHarmphasicI.setI20(messageDataI.getIa20()); dataHarmphasicI.setI20(adjustPhase(messageDataI.getIa20()));
dataHarmphasicI.setI21(messageDataI.getIa21()); dataHarmphasicI.setI21(adjustPhase(messageDataI.getIa21()));
dataHarmphasicI.setI22(messageDataI.getIa22()); dataHarmphasicI.setI22(adjustPhase(messageDataI.getIa22()));
dataHarmphasicI.setI23(messageDataI.getIa23()); dataHarmphasicI.setI23(adjustPhase(messageDataI.getIa23()));
dataHarmphasicI.setI24(messageDataI.getIa24()); dataHarmphasicI.setI24(adjustPhase(messageDataI.getIa24()));
dataHarmphasicI.setI25(messageDataI.getIa25()); dataHarmphasicI.setI25(adjustPhase(messageDataI.getIa25()));
dataHarmphasicI.setI26(messageDataI.getIa26()); dataHarmphasicI.setI26(adjustPhase(messageDataI.getIa26()));
dataHarmphasicI.setI27(messageDataI.getIa27()); dataHarmphasicI.setI27(adjustPhase(messageDataI.getIa27()));
dataHarmphasicI.setI28(messageDataI.getIa28()); dataHarmphasicI.setI28(adjustPhase(messageDataI.getIa28()));
dataHarmphasicI.setI29(messageDataI.getIa29()); dataHarmphasicI.setI29(adjustPhase(messageDataI.getIa29()));
dataHarmphasicI.setI30(messageDataI.getIa30()); dataHarmphasicI.setI30(adjustPhase(messageDataI.getIa30()));
dataHarmphasicI.setI31(messageDataI.getIa31()); dataHarmphasicI.setI31(adjustPhase(messageDataI.getIa31()));
dataHarmphasicI.setI32(messageDataI.getIa32()); dataHarmphasicI.setI32(adjustPhase(messageDataI.getIa32()));
dataHarmphasicI.setI33(messageDataI.getIa33()); dataHarmphasicI.setI33(adjustPhase(messageDataI.getIa33()));
dataHarmphasicI.setI34(messageDataI.getIa34()); dataHarmphasicI.setI34(adjustPhase(messageDataI.getIa34()));
dataHarmphasicI.setI35(messageDataI.getIa35()); dataHarmphasicI.setI35(adjustPhase(messageDataI.getIa35()));
dataHarmphasicI.setI36(messageDataI.getIa36()); dataHarmphasicI.setI36(adjustPhase(messageDataI.getIa36()));
dataHarmphasicI.setI37(messageDataI.getIa37()); dataHarmphasicI.setI37(adjustPhase(messageDataI.getIa37()));
dataHarmphasicI.setI38(messageDataI.getIa38()); dataHarmphasicI.setI38(adjustPhase(messageDataI.getIa38()));
dataHarmphasicI.setI39(messageDataI.getIa39()); dataHarmphasicI.setI39(adjustPhase(messageDataI.getIa39()));
dataHarmphasicI.setI40(messageDataI.getIa40()); dataHarmphasicI.setI40(adjustPhase(messageDataI.getIa40()));
dataHarmphasicI.setI41(messageDataI.getIa41()); dataHarmphasicI.setI41(adjustPhase(messageDataI.getIa41()));
dataHarmphasicI.setI42(messageDataI.getIa42()); dataHarmphasicI.setI42(adjustPhase(messageDataI.getIa42()));
dataHarmphasicI.setI43(messageDataI.getIa43()); dataHarmphasicI.setI43(adjustPhase(messageDataI.getIa43()));
dataHarmphasicI.setI44(messageDataI.getIa44()); dataHarmphasicI.setI44(adjustPhase(messageDataI.getIa44()));
dataHarmphasicI.setI45(messageDataI.getIa45()); dataHarmphasicI.setI45(adjustPhase(messageDataI.getIa45()));
dataHarmphasicI.setI46(messageDataI.getIa46()); dataHarmphasicI.setI46(adjustPhase(messageDataI.getIa46()));
dataHarmphasicI.setI47(messageDataI.getIa47()); dataHarmphasicI.setI47(adjustPhase(messageDataI.getIa47()));
dataHarmphasicI.setI48(messageDataI.getIa48()); dataHarmphasicI.setI48(adjustPhase(messageDataI.getIa48()));
dataHarmphasicI.setI49(messageDataI.getIa49()); dataHarmphasicI.setI49(adjustPhase(messageDataI.getIa49()));
dataHarmphasicI.setI50(messageDataI.getIa50()); dataHarmphasicI.setI50(adjustPhase(messageDataI.getIa50()));
dataHarmphasicI.setI1Max( messageDataI.getMaxIfundAngle()); dataHarmphasicI.setI1Max( adjustPhase(messageDataI.getMaxIfundAngle()));
dataHarmphasicI.setI2Max(messageDataI.getMaxIa2()); dataHarmphasicI.setI2Max(adjustPhase(messageDataI.getMaxIa2()));
dataHarmphasicI.setI3Max(messageDataI.getMaxIa3()); dataHarmphasicI.setI3Max(adjustPhase(messageDataI.getMaxIa3()));
dataHarmphasicI.setI4Max(messageDataI.getMaxIa4()); dataHarmphasicI.setI4Max(adjustPhase(messageDataI.getMaxIa4()));
dataHarmphasicI.setI5Max(messageDataI.getMaxIa5()); dataHarmphasicI.setI5Max(adjustPhase(messageDataI.getMaxIa5()));
dataHarmphasicI.setI6Max(messageDataI.getMaxIa6()); dataHarmphasicI.setI6Max(adjustPhase(messageDataI.getMaxIa6()));
dataHarmphasicI.setI7Max(messageDataI.getMaxIa7()); dataHarmphasicI.setI7Max(adjustPhase(messageDataI.getMaxIa7()));
dataHarmphasicI.setI8Max(messageDataI.getMaxIa8()); dataHarmphasicI.setI8Max(adjustPhase(messageDataI.getMaxIa8()));
dataHarmphasicI.setI9Max(messageDataI.getMaxIa9()); dataHarmphasicI.setI9Max(adjustPhase(messageDataI.getMaxIa9()));
dataHarmphasicI.setI10Max(messageDataI.getMaxIa10()); dataHarmphasicI.setI10Max(adjustPhase(messageDataI.getMaxIa10()));
dataHarmphasicI.setI11Max(messageDataI.getMaxIa11()); dataHarmphasicI.setI11Max(adjustPhase(messageDataI.getMaxIa11()));
dataHarmphasicI.setI12Max(messageDataI.getMaxIa12()); dataHarmphasicI.setI12Max(adjustPhase(messageDataI.getMaxIa12()));
dataHarmphasicI.setI13Max(messageDataI.getMaxIa13()); dataHarmphasicI.setI13Max(adjustPhase(messageDataI.getMaxIa13()));
dataHarmphasicI.setI14Max(messageDataI.getMaxIa14()); dataHarmphasicI.setI14Max(adjustPhase(messageDataI.getMaxIa14()));
dataHarmphasicI.setI15Max(messageDataI.getMaxIa15()); dataHarmphasicI.setI15Max(adjustPhase(messageDataI.getMaxIa15()));
dataHarmphasicI.setI16Max(messageDataI.getMaxIa16()); dataHarmphasicI.setI16Max(adjustPhase(messageDataI.getMaxIa16()));
dataHarmphasicI.setI17Max(messageDataI.getMaxIa17()); dataHarmphasicI.setI17Max(adjustPhase(messageDataI.getMaxIa17()));
dataHarmphasicI.setI18Max(messageDataI.getMaxIa18()); dataHarmphasicI.setI18Max(adjustPhase(messageDataI.getMaxIa18()));
dataHarmphasicI.setI19Max(messageDataI.getMaxIa19()); dataHarmphasicI.setI19Max(adjustPhase(messageDataI.getMaxIa19()));
dataHarmphasicI.setI20Max(messageDataI.getMaxIa20()); dataHarmphasicI.setI20Max(adjustPhase(messageDataI.getMaxIa20()));
dataHarmphasicI.setI21Max(messageDataI.getMaxIa21()); dataHarmphasicI.setI21Max(adjustPhase(messageDataI.getMaxIa21()));
dataHarmphasicI.setI22Max(messageDataI.getMaxIa22()); dataHarmphasicI.setI22Max(adjustPhase(messageDataI.getMaxIa22()));
dataHarmphasicI.setI23Max(messageDataI.getMaxIa23()); dataHarmphasicI.setI23Max(adjustPhase(messageDataI.getMaxIa23()));
dataHarmphasicI.setI24Max(messageDataI.getMaxIa24()); dataHarmphasicI.setI24Max(adjustPhase(messageDataI.getMaxIa24()));
dataHarmphasicI.setI25Max(messageDataI.getMaxIa25()); dataHarmphasicI.setI25Max(adjustPhase(messageDataI.getMaxIa25()));
dataHarmphasicI.setI26Max(messageDataI.getMaxIa26()); dataHarmphasicI.setI26Max(adjustPhase(messageDataI.getMaxIa26()));
dataHarmphasicI.setI27Max(messageDataI.getMaxIa27()); dataHarmphasicI.setI27Max(adjustPhase(messageDataI.getMaxIa27()));
dataHarmphasicI.setI28Max(messageDataI.getMaxIa28()); dataHarmphasicI.setI28Max(adjustPhase(messageDataI.getMaxIa28()));
dataHarmphasicI.setI29Max(messageDataI.getMaxIa29()); dataHarmphasicI.setI29Max(adjustPhase(messageDataI.getMaxIa29()));
dataHarmphasicI.setI30Max(messageDataI.getMaxIa30()); dataHarmphasicI.setI30Max(adjustPhase(messageDataI.getMaxIa30()));
dataHarmphasicI.setI31Max(messageDataI.getMaxIa31()); dataHarmphasicI.setI31Max(adjustPhase(messageDataI.getMaxIa31()));
dataHarmphasicI.setI32Max(messageDataI.getMaxIa32()); dataHarmphasicI.setI32Max(adjustPhase(messageDataI.getMaxIa32()));
dataHarmphasicI.setI33Max(messageDataI.getMaxIa33()); dataHarmphasicI.setI33Max(adjustPhase(messageDataI.getMaxIa33()));
dataHarmphasicI.setI34Max(messageDataI.getMaxIa34()); dataHarmphasicI.setI34Max(adjustPhase(messageDataI.getMaxIa34()));
dataHarmphasicI.setI35Max(messageDataI.getMaxIa35()); dataHarmphasicI.setI35Max(adjustPhase(messageDataI.getMaxIa35()));
dataHarmphasicI.setI36Max(messageDataI.getMaxIa36()); dataHarmphasicI.setI36Max(adjustPhase(messageDataI.getMaxIa36()));
dataHarmphasicI.setI37Max(messageDataI.getMaxIa37()); dataHarmphasicI.setI37Max(adjustPhase(messageDataI.getMaxIa37()));
dataHarmphasicI.setI38Max(messageDataI.getMaxIa38()); dataHarmphasicI.setI38Max(adjustPhase(messageDataI.getMaxIa38()));
dataHarmphasicI.setI39Max(messageDataI.getMaxIa39()); dataHarmphasicI.setI39Max(adjustPhase(messageDataI.getMaxIa39()));
dataHarmphasicI.setI40Max(messageDataI.getMaxIa40()); dataHarmphasicI.setI40Max(adjustPhase(messageDataI.getMaxIa40()));
dataHarmphasicI.setI41Max(messageDataI.getMaxIa41()); dataHarmphasicI.setI41Max(adjustPhase(messageDataI.getMaxIa41()));
dataHarmphasicI.setI42Max(messageDataI.getMaxIa42()); dataHarmphasicI.setI42Max(adjustPhase(messageDataI.getMaxIa42()));
dataHarmphasicI.setI43Max(messageDataI.getMaxIa43()); dataHarmphasicI.setI43Max(adjustPhase(messageDataI.getMaxIa43()));
dataHarmphasicI.setI44Max(messageDataI.getMaxIa44()); dataHarmphasicI.setI44Max(adjustPhase(messageDataI.getMaxIa44()));
dataHarmphasicI.setI45Max(messageDataI.getMaxIa45()); dataHarmphasicI.setI45Max(adjustPhase(messageDataI.getMaxIa45()));
dataHarmphasicI.setI46Max(messageDataI.getMaxIa46()); dataHarmphasicI.setI46Max(adjustPhase(messageDataI.getMaxIa46()));
dataHarmphasicI.setI47Max(messageDataI.getMaxIa47()); dataHarmphasicI.setI47Max(adjustPhase(messageDataI.getMaxIa47()));
dataHarmphasicI.setI48Max(messageDataI.getMaxIa48()); dataHarmphasicI.setI48Max(adjustPhase(messageDataI.getMaxIa48()));
dataHarmphasicI.setI49Max(messageDataI.getMaxIa49()); dataHarmphasicI.setI49Max(adjustPhase(messageDataI.getMaxIa49()));
dataHarmphasicI.setI50Max(messageDataI.getMaxIa50()); dataHarmphasicI.setI50Max(adjustPhase(messageDataI.getMaxIa50()));
dataHarmphasicI.setI1Min(messageDataI.getMinIfundAngle()); dataHarmphasicI.setI1Min(adjustPhase(messageDataI.getMinIfundAngle()));
dataHarmphasicI.setI2Min(messageDataI.getMinIa2()); dataHarmphasicI.setI2Min(adjustPhase(messageDataI.getMinIa2()));
dataHarmphasicI.setI3Min(messageDataI.getMinIa3()); dataHarmphasicI.setI3Min(adjustPhase(messageDataI.getMinIa3()));
dataHarmphasicI.setI4Min(messageDataI.getMinIa4()); dataHarmphasicI.setI4Min(adjustPhase(messageDataI.getMinIa4()));
dataHarmphasicI.setI5Min(messageDataI.getMinIa5()); dataHarmphasicI.setI5Min(adjustPhase(messageDataI.getMinIa5()));
dataHarmphasicI.setI6Min(messageDataI.getMinIa6()); dataHarmphasicI.setI6Min(adjustPhase(messageDataI.getMinIa6()));
dataHarmphasicI.setI7Min(messageDataI.getMinIa7()); dataHarmphasicI.setI7Min(adjustPhase(messageDataI.getMinIa7()));
dataHarmphasicI.setI8Min(messageDataI.getMinIa8()); dataHarmphasicI.setI8Min(adjustPhase(messageDataI.getMinIa8()));
dataHarmphasicI.setI9Min(messageDataI.getMinIa9()); dataHarmphasicI.setI9Min(adjustPhase(messageDataI.getMinIa9()));
dataHarmphasicI.setI10Min(messageDataI.getMinIa10()); dataHarmphasicI.setI10Min(adjustPhase(messageDataI.getMinIa10()));
dataHarmphasicI.setI11Min(messageDataI.getMinIa11()); dataHarmphasicI.setI11Min(adjustPhase(messageDataI.getMinIa11()));
dataHarmphasicI.setI12Min(messageDataI.getMinIa12()); dataHarmphasicI.setI12Min(adjustPhase(messageDataI.getMinIa12()));
dataHarmphasicI.setI13Min(messageDataI.getMinIa13()); dataHarmphasicI.setI13Min(adjustPhase(messageDataI.getMinIa13()));
dataHarmphasicI.setI14Min(messageDataI.getMinIa14()); dataHarmphasicI.setI14Min(adjustPhase(messageDataI.getMinIa14()));
dataHarmphasicI.setI15Min(messageDataI.getMinIa15()); dataHarmphasicI.setI15Min(adjustPhase(messageDataI.getMinIa15()));
dataHarmphasicI.setI16Min(messageDataI.getMinIa16()); dataHarmphasicI.setI16Min(adjustPhase(messageDataI.getMinIa16()));
dataHarmphasicI.setI17Min(messageDataI.getMinIa17()); dataHarmphasicI.setI17Min(adjustPhase(messageDataI.getMinIa17()));
dataHarmphasicI.setI18Min(messageDataI.getMinIa18()); dataHarmphasicI.setI18Min(adjustPhase(messageDataI.getMinIa18()));
dataHarmphasicI.setI19Min(messageDataI.getMinIa19()); dataHarmphasicI.setI19Min(adjustPhase(messageDataI.getMinIa19()));
dataHarmphasicI.setI20Min(messageDataI.getMinIa20()); dataHarmphasicI.setI20Min(adjustPhase(messageDataI.getMinIa20()));
dataHarmphasicI.setI21Min(messageDataI.getMinIa21()); dataHarmphasicI.setI21Min(adjustPhase(messageDataI.getMinIa21()));
dataHarmphasicI.setI22Min(messageDataI.getMinIa22()); dataHarmphasicI.setI22Min(adjustPhase(messageDataI.getMinIa22()));
dataHarmphasicI.setI23Min(messageDataI.getMinIa23()); dataHarmphasicI.setI23Min(adjustPhase(messageDataI.getMinIa23()));
dataHarmphasicI.setI24Min(messageDataI.getMinIa24()); dataHarmphasicI.setI24Min(adjustPhase(messageDataI.getMinIa24()));
dataHarmphasicI.setI25Min(messageDataI.getMinIa25()); dataHarmphasicI.setI25Min(adjustPhase(messageDataI.getMinIa25()));
dataHarmphasicI.setI26Min(messageDataI.getMinIa26()); dataHarmphasicI.setI26Min(adjustPhase(messageDataI.getMinIa26()));
dataHarmphasicI.setI27Min(messageDataI.getMinIa27()); dataHarmphasicI.setI27Min(adjustPhase(messageDataI.getMinIa27()));
dataHarmphasicI.setI28Min(messageDataI.getMinIa28()); dataHarmphasicI.setI28Min(adjustPhase(messageDataI.getMinIa28()));
dataHarmphasicI.setI29Min(messageDataI.getMinIa29()); dataHarmphasicI.setI29Min(adjustPhase(messageDataI.getMinIa29()));
dataHarmphasicI.setI30Min(messageDataI.getMinIa30()); dataHarmphasicI.setI30Min(adjustPhase(messageDataI.getMinIa30()));
dataHarmphasicI.setI31Min(messageDataI.getMinIa31()); dataHarmphasicI.setI31Min(adjustPhase(messageDataI.getMinIa31()));
dataHarmphasicI.setI32Min(messageDataI.getMinIa32()); dataHarmphasicI.setI32Min(adjustPhase(messageDataI.getMinIa32()));
dataHarmphasicI.setI33Min(messageDataI.getMinIa33()); dataHarmphasicI.setI33Min(adjustPhase(messageDataI.getMinIa33()));
dataHarmphasicI.setI34Min(messageDataI.getMinIa34()); dataHarmphasicI.setI34Min(adjustPhase(messageDataI.getMinIa34()));
dataHarmphasicI.setI35Min(messageDataI.getMinIa35()); dataHarmphasicI.setI35Min(adjustPhase(messageDataI.getMinIa35()));
dataHarmphasicI.setI36Min(messageDataI.getMinIa36()); dataHarmphasicI.setI36Min(adjustPhase(messageDataI.getMinIa36()));
dataHarmphasicI.setI37Min(messageDataI.getMinIa37()); dataHarmphasicI.setI37Min(adjustPhase(messageDataI.getMinIa37()));
dataHarmphasicI.setI38Min(messageDataI.getMinIa38()); dataHarmphasicI.setI38Min(adjustPhase(messageDataI.getMinIa38()));
dataHarmphasicI.setI39Min(messageDataI.getMinIa39()); dataHarmphasicI.setI39Min(adjustPhase(messageDataI.getMinIa39()));
dataHarmphasicI.setI40Min(messageDataI.getMinIa40()); dataHarmphasicI.setI40Min(adjustPhase(messageDataI.getMinIa40()));
dataHarmphasicI.setI41Min(messageDataI.getMinIa41()); dataHarmphasicI.setI41Min(adjustPhase(messageDataI.getMinIa41()));
dataHarmphasicI.setI42Min(messageDataI.getMinIa42()); dataHarmphasicI.setI42Min(adjustPhase(messageDataI.getMinIa42()));
dataHarmphasicI.setI43Min(messageDataI.getMinIa43()); dataHarmphasicI.setI43Min(adjustPhase(messageDataI.getMinIa43()));
dataHarmphasicI.setI44Min(messageDataI.getMinIa44()); dataHarmphasicI.setI44Min(adjustPhase(messageDataI.getMinIa44()));
dataHarmphasicI.setI45Min(messageDataI.getMinIa45()); dataHarmphasicI.setI45Min(adjustPhase(messageDataI.getMinIa45()));
dataHarmphasicI.setI46Min(messageDataI.getMinIa46()); dataHarmphasicI.setI46Min(adjustPhase(messageDataI.getMinIa46()));
dataHarmphasicI.setI47Min(messageDataI.getMinIa47()); dataHarmphasicI.setI47Min(adjustPhase(messageDataI.getMinIa47()));
dataHarmphasicI.setI48Min(messageDataI.getMinIa48()); dataHarmphasicI.setI48Min(adjustPhase(messageDataI.getMinIa48()));
dataHarmphasicI.setI49Min(messageDataI.getMinIa49()); dataHarmphasicI.setI49Min(adjustPhase(messageDataI.getMinIa49()));
dataHarmphasicI.setI50Min(messageDataI.getMinIa50()); dataHarmphasicI.setI50Min(adjustPhase(messageDataI.getMinIa50()));
dataHarmphasicI.setI1Cp95(messageDataI.getGIfundAngle()); dataHarmphasicI.setI1Cp95(adjustPhase(messageDataI.getGIfundAngle()));
dataHarmphasicI.setI2Cp95(messageDataI.getGIa2()); dataHarmphasicI.setI2Cp95(adjustPhase(messageDataI.getGIa2()));
dataHarmphasicI.setI3Cp95(messageDataI.getGIa3()); dataHarmphasicI.setI3Cp95(adjustPhase(messageDataI.getGIa3()));
dataHarmphasicI.setI4Cp95(messageDataI.getGIa4()); dataHarmphasicI.setI4Cp95(adjustPhase(messageDataI.getGIa4()));
dataHarmphasicI.setI5Cp95(messageDataI.getGIa5()); dataHarmphasicI.setI5Cp95(adjustPhase(messageDataI.getGIa5()));
dataHarmphasicI.setI6Cp95(messageDataI.getGIa6()); dataHarmphasicI.setI6Cp95(adjustPhase(messageDataI.getGIa6()));
dataHarmphasicI.setI7Cp95(messageDataI.getGIa7()); dataHarmphasicI.setI7Cp95(adjustPhase(messageDataI.getGIa7()));
dataHarmphasicI.setI8Cp95(messageDataI.getGIa8()); dataHarmphasicI.setI8Cp95(adjustPhase(messageDataI.getGIa8()));
dataHarmphasicI.setI9Cp95(messageDataI.getGIa9()); dataHarmphasicI.setI9Cp95(adjustPhase(messageDataI.getGIa9()));
dataHarmphasicI.setI10Cp95(messageDataI.getGIa10()); dataHarmphasicI.setI10Cp95(adjustPhase(messageDataI.getGIa10()));
dataHarmphasicI.setI11Cp95(messageDataI.getGIa11()); dataHarmphasicI.setI11Cp95(adjustPhase(messageDataI.getGIa11()));
dataHarmphasicI.setI12Cp95(messageDataI.getGIa12()); dataHarmphasicI.setI12Cp95(adjustPhase(messageDataI.getGIa12()));
dataHarmphasicI.setI13Cp95(messageDataI.getGIa13()); dataHarmphasicI.setI13Cp95(adjustPhase(messageDataI.getGIa13()));
dataHarmphasicI.setI14Cp95(messageDataI.getGIa14()); dataHarmphasicI.setI14Cp95(adjustPhase(messageDataI.getGIa14()));
dataHarmphasicI.setI15Cp95(messageDataI.getGIa15()); dataHarmphasicI.setI15Cp95(adjustPhase(messageDataI.getGIa15()));
dataHarmphasicI.setI16Cp95(messageDataI.getGIa16()); dataHarmphasicI.setI16Cp95(adjustPhase(messageDataI.getGIa16()));
dataHarmphasicI.setI17Cp95(messageDataI.getGIa17()); dataHarmphasicI.setI17Cp95(adjustPhase(messageDataI.getGIa17()));
dataHarmphasicI.setI18Cp95(messageDataI.getGIa18()); dataHarmphasicI.setI18Cp95(adjustPhase(messageDataI.getGIa18()));
dataHarmphasicI.setI19Cp95(messageDataI.getGIa19()); dataHarmphasicI.setI19Cp95(adjustPhase(messageDataI.getGIa19()));
dataHarmphasicI.setI20Cp95(messageDataI.getGIa20()); dataHarmphasicI.setI20Cp95(adjustPhase(messageDataI.getGIa20()));
dataHarmphasicI.setI21Cp95(messageDataI.getGIa21()); dataHarmphasicI.setI21Cp95(adjustPhase(messageDataI.getGIa21()));
dataHarmphasicI.setI22Cp95(messageDataI.getGIa22()); dataHarmphasicI.setI22Cp95(adjustPhase(messageDataI.getGIa22()));
dataHarmphasicI.setI23Cp95(messageDataI.getGIa23()); dataHarmphasicI.setI23Cp95(adjustPhase(messageDataI.getGIa23()));
dataHarmphasicI.setI24Cp95(messageDataI.getGIa24()); dataHarmphasicI.setI24Cp95(adjustPhase(messageDataI.getGIa24()));
dataHarmphasicI.setI25Cp95(messageDataI.getGIa25()); dataHarmphasicI.setI25Cp95(adjustPhase(messageDataI.getGIa25()));
dataHarmphasicI.setI26Cp95(messageDataI.getGIa26()); dataHarmphasicI.setI26Cp95(adjustPhase(messageDataI.getGIa26()));
dataHarmphasicI.setI27Cp95(messageDataI.getGIa27()); dataHarmphasicI.setI27Cp95(adjustPhase(messageDataI.getGIa27()));
dataHarmphasicI.setI28Cp95(messageDataI.getGIa28()); dataHarmphasicI.setI28Cp95(adjustPhase(messageDataI.getGIa28()));
dataHarmphasicI.setI29Cp95(messageDataI.getGIa29()); dataHarmphasicI.setI29Cp95(adjustPhase(messageDataI.getGIa29()));
dataHarmphasicI.setI30Cp95(messageDataI.getGIa30()); dataHarmphasicI.setI30Cp95(adjustPhase(messageDataI.getGIa30()));
dataHarmphasicI.setI31Cp95(messageDataI.getGIa31()); dataHarmphasicI.setI31Cp95(adjustPhase(messageDataI.getGIa31()));
dataHarmphasicI.setI32Cp95(messageDataI.getGIa32()); dataHarmphasicI.setI32Cp95(adjustPhase(messageDataI.getGIa32()));
dataHarmphasicI.setI33Cp95(messageDataI.getGIa33()); dataHarmphasicI.setI33Cp95(adjustPhase(messageDataI.getGIa33()));
dataHarmphasicI.setI34Cp95(messageDataI.getGIa34()); dataHarmphasicI.setI34Cp95(adjustPhase(messageDataI.getGIa34()));
dataHarmphasicI.setI35Cp95(messageDataI.getGIa35()); dataHarmphasicI.setI35Cp95(adjustPhase(messageDataI.getGIa35()));
dataHarmphasicI.setI36Cp95(messageDataI.getGIa36()); dataHarmphasicI.setI36Cp95(adjustPhase(messageDataI.getGIa36()));
dataHarmphasicI.setI37Cp95(messageDataI.getGIa37()); dataHarmphasicI.setI37Cp95(adjustPhase(messageDataI.getGIa37()));
dataHarmphasicI.setI38Cp95(messageDataI.getGIa38()); dataHarmphasicI.setI38Cp95(adjustPhase(messageDataI.getGIa38()));
dataHarmphasicI.setI39Cp95(messageDataI.getGIa39()); dataHarmphasicI.setI39Cp95(adjustPhase(messageDataI.getGIa39()));
dataHarmphasicI.setI40Cp95(messageDataI.getGIa40()); dataHarmphasicI.setI40Cp95(adjustPhase(messageDataI.getGIa40()));
dataHarmphasicI.setI41Cp95(messageDataI.getGIa41()); dataHarmphasicI.setI41Cp95(adjustPhase(messageDataI.getGIa41()));
dataHarmphasicI.setI42Cp95(messageDataI.getGIa42()); dataHarmphasicI.setI42Cp95(adjustPhase(messageDataI.getGIa42()));
dataHarmphasicI.setI43Cp95(messageDataI.getGIa43()); dataHarmphasicI.setI43Cp95(adjustPhase(messageDataI.getGIa43()));
dataHarmphasicI.setI44Cp95(messageDataI.getGIa44()); dataHarmphasicI.setI44Cp95(adjustPhase(messageDataI.getGIa44()));
dataHarmphasicI.setI45Cp95(messageDataI.getGIa45()); dataHarmphasicI.setI45Cp95(adjustPhase(messageDataI.getGIa45()));
dataHarmphasicI.setI46Cp95(messageDataI.getGIa46()); dataHarmphasicI.setI46Cp95(adjustPhase(messageDataI.getGIa46()));
dataHarmphasicI.setI47Cp95(messageDataI.getGIa47()); dataHarmphasicI.setI47Cp95(adjustPhase(messageDataI.getGIa47()));
dataHarmphasicI.setI48Cp95(messageDataI.getGIa48()); dataHarmphasicI.setI48Cp95(adjustPhase(messageDataI.getGIa48()));
dataHarmphasicI.setI49Cp95(messageDataI.getGIa49()); dataHarmphasicI.setI49Cp95(adjustPhase(messageDataI.getGIa49()));
dataHarmphasicI.setI50Cp95(messageDataI.getGIa50()); dataHarmphasicI.setI50Cp95(adjustPhase(messageDataI.getGIa50()));
} }
return dataHarmphasicI; return dataHarmphasicI;

View File

@@ -19,6 +19,28 @@ import java.util.Objects;
* @version V1.0.0 * @version V1.0.0
*/ */
public class BeanVConverter { public class BeanVConverter {
/**
* 角度相关常量
*/
private static final double ANGLE_180 = 180.0;
private static final double ANGLE_360 = 360.0;
private static final double ANGLE_MINUS_180 = -180.0;
public static Double adjustPhase(Double phase) {
if (phase == null) {
return null;
}
// 使用模运算将角度标准化到[-180, 180]范围
double normalizedPhase = phase % ANGLE_360;
// 处理超出[-180, 180]范围的情况
if (normalizedPhase > ANGLE_180) {
normalizedPhase -= ANGLE_360;
} else if (normalizedPhase < ANGLE_MINUS_180) {
normalizedPhase += ANGLE_360;
}
return normalizedPhase;
}
//A,B,C三项 //A,B,C三项
public static DataVDTO messageDataVTODataV(MessageDataV messageDataV){ public static DataVDTO messageDataVTODataV(MessageDataV messageDataV){
DataVDTO dataVRelation = new DataVDTO(); DataVDTO dataVRelation = new DataVDTO();
@@ -561,209 +583,209 @@ public class BeanVConverter {
public static DataHarmphasicVDTO messageDataVTODataHarmphasicV(MessageDataV messageDataV){ public static DataHarmphasicVDTO messageDataVTODataHarmphasicV(MessageDataV messageDataV){
DataHarmphasicVDTO dataHarmphasicV = new DataHarmphasicVDTO(); DataHarmphasicVDTO dataHarmphasicV = new DataHarmphasicVDTO();
if (Objects.nonNull(messageDataV)){ if (Objects.nonNull(messageDataV)){
dataHarmphasicV.setV1(messageDataV.getVfundAngle()); dataHarmphasicV.setV1(adjustPhase(messageDataV.getVfundAngle()));
dataHarmphasicV.setV2(messageDataV.getVa2()); dataHarmphasicV.setV2(adjustPhase(messageDataV.getVa2()));
dataHarmphasicV.setV3(messageDataV.getVa3()); dataHarmphasicV.setV3(adjustPhase(messageDataV.getVa3()));
dataHarmphasicV.setV4(messageDataV.getVa4()); dataHarmphasicV.setV4(adjustPhase(messageDataV.getVa4()));
dataHarmphasicV.setV5(messageDataV.getVa5()); dataHarmphasicV.setV5(adjustPhase(messageDataV.getVa5()));
dataHarmphasicV.setV6(messageDataV.getVa6()); dataHarmphasicV.setV6(adjustPhase(messageDataV.getVa6()));
dataHarmphasicV.setV7(messageDataV.getVa7()); dataHarmphasicV.setV7(adjustPhase(messageDataV.getVa7()));
dataHarmphasicV.setV8(messageDataV.getVa8()); dataHarmphasicV.setV8(adjustPhase(messageDataV.getVa8()));
dataHarmphasicV.setV9(messageDataV.getVa9()); dataHarmphasicV.setV9(adjustPhase(messageDataV.getVa9()));
dataHarmphasicV.setV10(messageDataV.getVa10()); dataHarmphasicV.setV10(adjustPhase(messageDataV.getVa10()));
dataHarmphasicV.setV11(messageDataV.getVa11()); dataHarmphasicV.setV11(adjustPhase(messageDataV.getVa11()));
dataHarmphasicV.setV12(messageDataV.getVa12()); dataHarmphasicV.setV12(adjustPhase(messageDataV.getVa12()));
dataHarmphasicV.setV13(messageDataV.getVa13()); dataHarmphasicV.setV13(adjustPhase(messageDataV.getVa13()));
dataHarmphasicV.setV14(messageDataV.getVa14()); dataHarmphasicV.setV14(adjustPhase(messageDataV.getVa14()));
dataHarmphasicV.setV15(messageDataV.getVa15()); dataHarmphasicV.setV15(adjustPhase(messageDataV.getVa15()));
dataHarmphasicV.setV16(messageDataV.getVa16()); dataHarmphasicV.setV16(adjustPhase(messageDataV.getVa16()));
dataHarmphasicV.setV17(messageDataV.getVa17()); dataHarmphasicV.setV17(adjustPhase(messageDataV.getVa17()));
dataHarmphasicV.setV18(messageDataV.getVa18()); dataHarmphasicV.setV18(adjustPhase(messageDataV.getVa18()));
dataHarmphasicV.setV19(messageDataV.getVa19()); dataHarmphasicV.setV19(adjustPhase(messageDataV.getVa19()));
dataHarmphasicV.setV20(messageDataV.getVa20()); dataHarmphasicV.setV20(adjustPhase(messageDataV.getVa20()));
dataHarmphasicV.setV21(messageDataV.getVa21()); dataHarmphasicV.setV21(adjustPhase(messageDataV.getVa21()));
dataHarmphasicV.setV22(messageDataV.getVa22()); dataHarmphasicV.setV22(adjustPhase(messageDataV.getVa22()));
dataHarmphasicV.setV23(messageDataV.getVa23()); dataHarmphasicV.setV23(adjustPhase(messageDataV.getVa23()));
dataHarmphasicV.setV24(messageDataV.getVa24()); dataHarmphasicV.setV24(adjustPhase(messageDataV.getVa24()));
dataHarmphasicV.setV25(messageDataV.getVa25()); dataHarmphasicV.setV25(adjustPhase(messageDataV.getVa25()));
dataHarmphasicV.setV26(messageDataV.getVa26()); dataHarmphasicV.setV26(adjustPhase(messageDataV.getVa26()));
dataHarmphasicV.setV27(messageDataV.getVa27()); dataHarmphasicV.setV27(adjustPhase(messageDataV.getVa27()));
dataHarmphasicV.setV28(messageDataV.getVa28()); dataHarmphasicV.setV28(adjustPhase(messageDataV.getVa28()));
dataHarmphasicV.setV29(messageDataV.getVa29()); dataHarmphasicV.setV29(adjustPhase(messageDataV.getVa29()));
dataHarmphasicV.setV30(messageDataV.getVa30()); dataHarmphasicV.setV30(adjustPhase(messageDataV.getVa30()));
dataHarmphasicV.setV31(messageDataV.getVa31()); dataHarmphasicV.setV31(adjustPhase(messageDataV.getVa31()));
dataHarmphasicV.setV32(messageDataV.getVa32()); dataHarmphasicV.setV32(adjustPhase(messageDataV.getVa32()));
dataHarmphasicV.setV33(messageDataV.getVa33()); dataHarmphasicV.setV33(adjustPhase(messageDataV.getVa33()));
dataHarmphasicV.setV34(messageDataV.getVa34()); dataHarmphasicV.setV34(adjustPhase(messageDataV.getVa34()));
dataHarmphasicV.setV35(messageDataV.getVa35()); dataHarmphasicV.setV35(adjustPhase(messageDataV.getVa35()));
dataHarmphasicV.setV36(messageDataV.getVa36()); dataHarmphasicV.setV36(adjustPhase(messageDataV.getVa36()));
dataHarmphasicV.setV37(messageDataV.getVa37()); dataHarmphasicV.setV37(adjustPhase(messageDataV.getVa37()));
dataHarmphasicV.setV38(messageDataV.getVa38()); dataHarmphasicV.setV38(adjustPhase(messageDataV.getVa38()));
dataHarmphasicV.setV39(messageDataV.getVa39()); dataHarmphasicV.setV39(adjustPhase(messageDataV.getVa39()));
dataHarmphasicV.setV40(messageDataV.getVa40()); dataHarmphasicV.setV40(adjustPhase(messageDataV.getVa40()));
dataHarmphasicV.setV41(messageDataV.getVa41()); dataHarmphasicV.setV41(adjustPhase(messageDataV.getVa41()));
dataHarmphasicV.setV42(messageDataV.getVa42()); dataHarmphasicV.setV42(adjustPhase(messageDataV.getVa42()));
dataHarmphasicV.setV43(messageDataV.getVa43()); dataHarmphasicV.setV43(adjustPhase(messageDataV.getVa43()));
dataHarmphasicV.setV44(messageDataV.getVa44()); dataHarmphasicV.setV44(adjustPhase(messageDataV.getVa44()));
dataHarmphasicV.setV45(messageDataV.getVa45()); dataHarmphasicV.setV45(adjustPhase(messageDataV.getVa45()));
dataHarmphasicV.setV46(messageDataV.getVa46()); dataHarmphasicV.setV46(adjustPhase(messageDataV.getVa46()));
dataHarmphasicV.setV47(messageDataV.getVa47()); dataHarmphasicV.setV47(adjustPhase(messageDataV.getVa47()));
dataHarmphasicV.setV48(messageDataV.getVa48()); dataHarmphasicV.setV48(adjustPhase(messageDataV.getVa48()));
dataHarmphasicV.setV49(messageDataV.getVa49()); dataHarmphasicV.setV49(adjustPhase(messageDataV.getVa49()));
dataHarmphasicV.setV50(messageDataV.getVa50()); dataHarmphasicV.setV50(adjustPhase(messageDataV.getVa50()));
dataHarmphasicV.setV1Max(messageDataV.getMaxVfundAngle()); dataHarmphasicV.setV1Max(adjustPhase(messageDataV.getMaxVfundAngle()));
dataHarmphasicV.setV2Max(messageDataV.getMaxVa2()); dataHarmphasicV.setV2Max(adjustPhase(messageDataV.getMaxVa2()));
dataHarmphasicV.setV3Max(messageDataV.getMaxVa3()); dataHarmphasicV.setV3Max(adjustPhase(messageDataV.getMaxVa3()));
dataHarmphasicV.setV4Max(messageDataV.getMaxVa4()); dataHarmphasicV.setV4Max(adjustPhase(messageDataV.getMaxVa4()));
dataHarmphasicV.setV5Max(messageDataV.getMaxVa5()); dataHarmphasicV.setV5Max(adjustPhase(messageDataV.getMaxVa5()));
dataHarmphasicV.setV6Max(messageDataV.getMaxVa6()); dataHarmphasicV.setV6Max(adjustPhase(messageDataV.getMaxVa6()));
dataHarmphasicV.setV7Max(messageDataV.getMaxVa7()); dataHarmphasicV.setV7Max(adjustPhase(messageDataV.getMaxVa7()));
dataHarmphasicV.setV8Max(messageDataV.getMaxVa8()); dataHarmphasicV.setV8Max(adjustPhase(messageDataV.getMaxVa8()));
dataHarmphasicV.setV9Max(messageDataV.getMaxVa9()); dataHarmphasicV.setV9Max(adjustPhase(messageDataV.getMaxVa9()));
dataHarmphasicV.setV10Max(messageDataV.getMaxVa10()); dataHarmphasicV.setV10Max(adjustPhase(messageDataV.getMaxVa10()));
dataHarmphasicV.setV11Max(messageDataV.getMaxVa11()); dataHarmphasicV.setV11Max(adjustPhase(messageDataV.getMaxVa11()));
dataHarmphasicV.setV12Max(messageDataV.getMaxVa12()); dataHarmphasicV.setV12Max(adjustPhase(messageDataV.getMaxVa12()));
dataHarmphasicV.setV13Max(messageDataV.getMaxVa13()); dataHarmphasicV.setV13Max(adjustPhase(messageDataV.getMaxVa13()));
dataHarmphasicV.setV14Max(messageDataV.getMaxVa14()); dataHarmphasicV.setV14Max(adjustPhase(messageDataV.getMaxVa14()));
dataHarmphasicV.setV15Max(messageDataV.getMaxVa15()); dataHarmphasicV.setV15Max(adjustPhase(messageDataV.getMaxVa15()));
dataHarmphasicV.setV16Max(messageDataV.getMaxVa16()); dataHarmphasicV.setV16Max(adjustPhase(messageDataV.getMaxVa16()));
dataHarmphasicV.setV17Max(messageDataV.getMaxVa17()); dataHarmphasicV.setV17Max(adjustPhase(messageDataV.getMaxVa17()));
dataHarmphasicV.setV18Max(messageDataV.getMaxVa18()); dataHarmphasicV.setV18Max(adjustPhase(messageDataV.getMaxVa18()));
dataHarmphasicV.setV19Max(messageDataV.getMaxVa19()); dataHarmphasicV.setV19Max(adjustPhase(messageDataV.getMaxVa19()));
dataHarmphasicV.setV20Max(messageDataV.getMaxVa20()); dataHarmphasicV.setV20Max(adjustPhase(messageDataV.getMaxVa20()));
dataHarmphasicV.setV21Max(messageDataV.getMaxVa21()); dataHarmphasicV.setV21Max(adjustPhase(messageDataV.getMaxVa21()));
dataHarmphasicV.setV22Max(messageDataV.getMaxVa22()); dataHarmphasicV.setV22Max(adjustPhase(messageDataV.getMaxVa22()));
dataHarmphasicV.setV23Max(messageDataV.getMaxVa23()); dataHarmphasicV.setV23Max(adjustPhase(messageDataV.getMaxVa23()));
dataHarmphasicV.setV24Max(messageDataV.getMaxVa24()); dataHarmphasicV.setV24Max(adjustPhase(messageDataV.getMaxVa24()));
dataHarmphasicV.setV25Max(messageDataV.getMaxVa25()); dataHarmphasicV.setV25Max(adjustPhase(messageDataV.getMaxVa25()));
dataHarmphasicV.setV26Max(messageDataV.getMaxVa26()); dataHarmphasicV.setV26Max(adjustPhase(messageDataV.getMaxVa26()));
dataHarmphasicV.setV27Max(messageDataV.getMaxVa27()); dataHarmphasicV.setV27Max(adjustPhase(messageDataV.getMaxVa27()));
dataHarmphasicV.setV28Max(messageDataV.getMaxVa28()); dataHarmphasicV.setV28Max(adjustPhase(messageDataV.getMaxVa28()));
dataHarmphasicV.setV29Max(messageDataV.getMaxVa29()); dataHarmphasicV.setV29Max(adjustPhase(messageDataV.getMaxVa29()));
dataHarmphasicV.setV30Max(messageDataV.getMaxVa30()); dataHarmphasicV.setV30Max(adjustPhase(messageDataV.getMaxVa30()));
dataHarmphasicV.setV31Max(messageDataV.getMaxVa31()); dataHarmphasicV.setV31Max(adjustPhase(messageDataV.getMaxVa31()));
dataHarmphasicV.setV32Max(messageDataV.getMaxVa32()); dataHarmphasicV.setV32Max(adjustPhase(messageDataV.getMaxVa32()));
dataHarmphasicV.setV33Max(messageDataV.getMaxVa33()); dataHarmphasicV.setV33Max(adjustPhase(messageDataV.getMaxVa33()));
dataHarmphasicV.setV34Max(messageDataV.getMaxVa34()); dataHarmphasicV.setV34Max(adjustPhase(messageDataV.getMaxVa34()));
dataHarmphasicV.setV35Max(messageDataV.getMaxVa35()); dataHarmphasicV.setV35Max(adjustPhase(messageDataV.getMaxVa35()));
dataHarmphasicV.setV36Max(messageDataV.getMaxVa36()); dataHarmphasicV.setV36Max(adjustPhase(messageDataV.getMaxVa36()));
dataHarmphasicV.setV37Max(messageDataV.getMaxVa37()); dataHarmphasicV.setV37Max(adjustPhase(messageDataV.getMaxVa37()));
dataHarmphasicV.setV38Max(messageDataV.getMaxVa38()); dataHarmphasicV.setV38Max(adjustPhase(messageDataV.getMaxVa38()));
dataHarmphasicV.setV39Max(messageDataV.getMaxVa39()); dataHarmphasicV.setV39Max(adjustPhase(messageDataV.getMaxVa39()));
dataHarmphasicV.setV40Max(messageDataV.getMaxVa40()); dataHarmphasicV.setV40Max(adjustPhase(messageDataV.getMaxVa40()));
dataHarmphasicV.setV41Max(messageDataV.getMaxVa41()); dataHarmphasicV.setV41Max(adjustPhase(messageDataV.getMaxVa41()));
dataHarmphasicV.setV42Max(messageDataV.getMaxVa42()); dataHarmphasicV.setV42Max(adjustPhase(messageDataV.getMaxVa42()));
dataHarmphasicV.setV43Max(messageDataV.getMaxVa43()); dataHarmphasicV.setV43Max(adjustPhase(messageDataV.getMaxVa43()));
dataHarmphasicV.setV44Max(messageDataV.getMaxVa44()); dataHarmphasicV.setV44Max(adjustPhase(messageDataV.getMaxVa44()));
dataHarmphasicV.setV45Max(messageDataV.getMaxVa45()); dataHarmphasicV.setV45Max(adjustPhase(messageDataV.getMaxVa45()));
dataHarmphasicV.setV46Max(messageDataV.getMaxVa46()); dataHarmphasicV.setV46Max(adjustPhase(messageDataV.getMaxVa46()));
dataHarmphasicV.setV47Max(messageDataV.getMaxVa47()); dataHarmphasicV.setV47Max(adjustPhase(messageDataV.getMaxVa47()));
dataHarmphasicV.setV48Max(messageDataV.getMaxVa48()); dataHarmphasicV.setV48Max(adjustPhase(messageDataV.getMaxVa48()));
dataHarmphasicV.setV49Max(messageDataV.getMaxVa49()); dataHarmphasicV.setV49Max(adjustPhase(messageDataV.getMaxVa49()));
dataHarmphasicV.setV50Max(messageDataV.getMaxVa50()); dataHarmphasicV.setV50Max(adjustPhase(messageDataV.getMaxVa50()));
dataHarmphasicV.setV1Min(messageDataV.getMinVfundAngle()); dataHarmphasicV.setV1Min(adjustPhase(messageDataV.getMinVfundAngle()));
dataHarmphasicV.setV2Min(messageDataV.getMinVa2()); dataHarmphasicV.setV2Min(adjustPhase(messageDataV.getMinVa2()));
dataHarmphasicV.setV3Min(messageDataV.getMinVa3()); dataHarmphasicV.setV3Min(adjustPhase(messageDataV.getMinVa3()));
dataHarmphasicV.setV4Min(messageDataV.getMinVa4()); dataHarmphasicV.setV4Min(adjustPhase(messageDataV.getMinVa4()));
dataHarmphasicV.setV5Min(messageDataV.getMinVa5()); dataHarmphasicV.setV5Min(adjustPhase(messageDataV.getMinVa5()));
dataHarmphasicV.setV6Min(messageDataV.getMinVa6()); dataHarmphasicV.setV6Min(adjustPhase(messageDataV.getMinVa6()));
dataHarmphasicV.setV7Min(messageDataV.getMinVa7()); dataHarmphasicV.setV7Min(adjustPhase(messageDataV.getMinVa7()));
dataHarmphasicV.setV8Min(messageDataV.getMinVa8()); dataHarmphasicV.setV8Min(adjustPhase(messageDataV.getMinVa8()));
dataHarmphasicV.setV9Min(messageDataV.getMinVa9()); dataHarmphasicV.setV9Min(adjustPhase(messageDataV.getMinVa9()));
dataHarmphasicV.setV10Min(messageDataV.getMinVa10()); dataHarmphasicV.setV10Min(adjustPhase(messageDataV.getMinVa10()));
dataHarmphasicV.setV11Min(messageDataV.getMinVa11()); dataHarmphasicV.setV11Min(adjustPhase(messageDataV.getMinVa11()));
dataHarmphasicV.setV12Min(messageDataV.getMinVa12()); dataHarmphasicV.setV12Min(adjustPhase(messageDataV.getMinVa12()));
dataHarmphasicV.setV13Min(messageDataV.getMinVa13()); dataHarmphasicV.setV13Min(adjustPhase(messageDataV.getMinVa13()));
dataHarmphasicV.setV14Min(messageDataV.getMinVa14()); dataHarmphasicV.setV14Min(adjustPhase(messageDataV.getMinVa14()));
dataHarmphasicV.setV15Min(messageDataV.getMinVa15()); dataHarmphasicV.setV15Min(adjustPhase(messageDataV.getMinVa15()));
dataHarmphasicV.setV16Min(messageDataV.getMinVa16()); dataHarmphasicV.setV16Min(adjustPhase(messageDataV.getMinVa16()));
dataHarmphasicV.setV17Min(messageDataV.getMinVa17()); dataHarmphasicV.setV17Min(adjustPhase(messageDataV.getMinVa17()));
dataHarmphasicV.setV18Min(messageDataV.getMinVa18()); dataHarmphasicV.setV18Min(adjustPhase(messageDataV.getMinVa18()));
dataHarmphasicV.setV19Min(messageDataV.getMinVa19()); dataHarmphasicV.setV19Min(adjustPhase(messageDataV.getMinVa19()));
dataHarmphasicV.setV20Min(messageDataV.getMinVa20()); dataHarmphasicV.setV20Min(adjustPhase(messageDataV.getMinVa20()));
dataHarmphasicV.setV21Min(messageDataV.getMinVa21()); dataHarmphasicV.setV21Min(adjustPhase(messageDataV.getMinVa21()));
dataHarmphasicV.setV22Min(messageDataV.getMinVa22()); dataHarmphasicV.setV22Min(adjustPhase(messageDataV.getMinVa22()));
dataHarmphasicV.setV23Min(messageDataV.getMinVa23()); dataHarmphasicV.setV23Min(adjustPhase(messageDataV.getMinVa23()));
dataHarmphasicV.setV24Min(messageDataV.getMinVa24()); dataHarmphasicV.setV24Min(adjustPhase(messageDataV.getMinVa24()));
dataHarmphasicV.setV25Min(messageDataV.getMinVa25()); dataHarmphasicV.setV25Min(adjustPhase(messageDataV.getMinVa25()));
dataHarmphasicV.setV26Min(messageDataV.getMinVa26()); dataHarmphasicV.setV26Min(adjustPhase(messageDataV.getMinVa26()));
dataHarmphasicV.setV27Min(messageDataV.getMinVa27()); dataHarmphasicV.setV27Min(adjustPhase(messageDataV.getMinVa27()));
dataHarmphasicV.setV28Min(messageDataV.getMinVa28()); dataHarmphasicV.setV28Min(adjustPhase(messageDataV.getMinVa28()));
dataHarmphasicV.setV29Min(messageDataV.getMinVa29()); dataHarmphasicV.setV29Min(adjustPhase(messageDataV.getMinVa29()));
dataHarmphasicV.setV30Min(messageDataV.getMinVa30()); dataHarmphasicV.setV30Min(adjustPhase(messageDataV.getMinVa30()));
dataHarmphasicV.setV31Min(messageDataV.getMinVa31()); dataHarmphasicV.setV31Min(adjustPhase(messageDataV.getMinVa31()));
dataHarmphasicV.setV32Min(messageDataV.getMinVa32()); dataHarmphasicV.setV32Min(adjustPhase(messageDataV.getMinVa32()));
dataHarmphasicV.setV33Min(messageDataV.getMinVa33()); dataHarmphasicV.setV33Min(adjustPhase(messageDataV.getMinVa33()));
dataHarmphasicV.setV34Min(messageDataV.getMinVa34()); dataHarmphasicV.setV34Min(adjustPhase(messageDataV.getMinVa34()));
dataHarmphasicV.setV35Min(messageDataV.getMinVa35()); dataHarmphasicV.setV35Min(adjustPhase(messageDataV.getMinVa35()));
dataHarmphasicV.setV36Min(messageDataV.getMinVa36()); dataHarmphasicV.setV36Min(adjustPhase(messageDataV.getMinVa36()));
dataHarmphasicV.setV37Min(messageDataV.getMinVa37()); dataHarmphasicV.setV37Min(adjustPhase(messageDataV.getMinVa37()));
dataHarmphasicV.setV38Min(messageDataV.getMinVa38()); dataHarmphasicV.setV38Min(adjustPhase(messageDataV.getMinVa38()));
dataHarmphasicV.setV39Min(messageDataV.getMinVa39()); dataHarmphasicV.setV39Min(adjustPhase(messageDataV.getMinVa39()));
dataHarmphasicV.setV40Min(messageDataV.getMinVa40()); dataHarmphasicV.setV40Min(adjustPhase(messageDataV.getMinVa40()));
dataHarmphasicV.setV41Min(messageDataV.getMinVa41()); dataHarmphasicV.setV41Min(adjustPhase(messageDataV.getMinVa41()));
dataHarmphasicV.setV42Min(messageDataV.getMinVa42()); dataHarmphasicV.setV42Min(adjustPhase(messageDataV.getMinVa42()));
dataHarmphasicV.setV43Min(messageDataV.getMinVa43()); dataHarmphasicV.setV43Min(adjustPhase(messageDataV.getMinVa43()));
dataHarmphasicV.setV44Min(messageDataV.getMinVa44()); dataHarmphasicV.setV44Min(adjustPhase(messageDataV.getMinVa44()));
dataHarmphasicV.setV45Min(messageDataV.getMinVa45()); dataHarmphasicV.setV45Min(adjustPhase(messageDataV.getMinVa45()));
dataHarmphasicV.setV46Min(messageDataV.getMinVa46()); dataHarmphasicV.setV46Min(adjustPhase(messageDataV.getMinVa46()));
dataHarmphasicV.setV47Min(messageDataV.getMinVa47()); dataHarmphasicV.setV47Min(adjustPhase(messageDataV.getMinVa47()));
dataHarmphasicV.setV48Min(messageDataV.getMinVa48()); dataHarmphasicV.setV48Min(adjustPhase(messageDataV.getMinVa48()));
dataHarmphasicV.setV49Min(messageDataV.getMinVa49()); dataHarmphasicV.setV49Min(adjustPhase(messageDataV.getMinVa49()));
dataHarmphasicV.setV50Min(messageDataV.getMinVa50()); dataHarmphasicV.setV50Min(adjustPhase(messageDataV.getMinVa50()));
dataHarmphasicV.setV1Cp95(messageDataV.getGVfundAngle()); dataHarmphasicV.setV1Cp95(adjustPhase(messageDataV.getGVfundAngle()));
dataHarmphasicV.setV2Cp95(messageDataV.getGVa2()); dataHarmphasicV.setV2Cp95(adjustPhase(messageDataV.getGVa2()));
dataHarmphasicV.setV3Cp95(messageDataV.getGVa3()); dataHarmphasicV.setV3Cp95(adjustPhase(messageDataV.getGVa3()));
dataHarmphasicV.setV4Cp95(messageDataV.getGVa4()); dataHarmphasicV.setV4Cp95(adjustPhase(messageDataV.getGVa4()));
dataHarmphasicV.setV5Cp95(messageDataV.getGVa5()); dataHarmphasicV.setV5Cp95(adjustPhase(messageDataV.getGVa5()));
dataHarmphasicV.setV6Cp95(messageDataV.getGVa6()); dataHarmphasicV.setV6Cp95(adjustPhase(messageDataV.getGVa6()));
dataHarmphasicV.setV7Cp95(messageDataV.getGVa7()); dataHarmphasicV.setV7Cp95(adjustPhase(messageDataV.getGVa7()));
dataHarmphasicV.setV8Cp95(messageDataV.getGVa8()); dataHarmphasicV.setV8Cp95(adjustPhase(messageDataV.getGVa8()));
dataHarmphasicV.setV9Cp95(messageDataV.getGVa9()); dataHarmphasicV.setV9Cp95(adjustPhase(messageDataV.getGVa9()));
dataHarmphasicV.setV10Cp95(messageDataV.getGVa10()); dataHarmphasicV.setV10Cp95(adjustPhase(messageDataV.getGVa10()));
dataHarmphasicV.setV11Cp95(messageDataV.getGVa11()); dataHarmphasicV.setV11Cp95(adjustPhase(messageDataV.getGVa11()));
dataHarmphasicV.setV12Cp95(messageDataV.getGVa12()); dataHarmphasicV.setV12Cp95(adjustPhase(messageDataV.getGVa12()));
dataHarmphasicV.setV13Cp95(messageDataV.getGVa13()); dataHarmphasicV.setV13Cp95(adjustPhase(messageDataV.getGVa13()));
dataHarmphasicV.setV14Cp95(messageDataV.getGVa14()); dataHarmphasicV.setV14Cp95(adjustPhase(messageDataV.getGVa14()));
dataHarmphasicV.setV15Cp95(messageDataV.getGVa15()); dataHarmphasicV.setV15Cp95(adjustPhase(messageDataV.getGVa15()));
dataHarmphasicV.setV16Cp95(messageDataV.getGVa16()); dataHarmphasicV.setV16Cp95(adjustPhase(messageDataV.getGVa16()));
dataHarmphasicV.setV17Cp95(messageDataV.getGVa17()); dataHarmphasicV.setV17Cp95(adjustPhase(messageDataV.getGVa17()));
dataHarmphasicV.setV18Cp95(messageDataV.getGVa18()); dataHarmphasicV.setV18Cp95(adjustPhase(messageDataV.getGVa18()));
dataHarmphasicV.setV19Cp95(messageDataV.getGVa19()); dataHarmphasicV.setV19Cp95(adjustPhase(messageDataV.getGVa19()));
dataHarmphasicV.setV20Cp95(messageDataV.getGVa20()); dataHarmphasicV.setV20Cp95(adjustPhase(messageDataV.getGVa20()));
dataHarmphasicV.setV21Cp95(messageDataV.getGVa21()); dataHarmphasicV.setV21Cp95(adjustPhase(messageDataV.getGVa21()));
dataHarmphasicV.setV22Cp95(messageDataV.getGVa22()); dataHarmphasicV.setV22Cp95(adjustPhase(messageDataV.getGVa22()));
dataHarmphasicV.setV23Cp95(messageDataV.getGVa23()); dataHarmphasicV.setV23Cp95(adjustPhase(messageDataV.getGVa23()));
dataHarmphasicV.setV24Cp95(messageDataV.getGVa24()); dataHarmphasicV.setV24Cp95(adjustPhase(messageDataV.getGVa24()));
dataHarmphasicV.setV25Cp95(messageDataV.getGVa25()); dataHarmphasicV.setV25Cp95(adjustPhase(messageDataV.getGVa25()));
dataHarmphasicV.setV26Cp95(messageDataV.getGVa26()); dataHarmphasicV.setV26Cp95(adjustPhase(messageDataV.getGVa26()));
dataHarmphasicV.setV27Cp95(messageDataV.getGVa27()); dataHarmphasicV.setV27Cp95(adjustPhase(messageDataV.getGVa27()));
dataHarmphasicV.setV28Cp95(messageDataV.getGVa28()); dataHarmphasicV.setV28Cp95(adjustPhase(messageDataV.getGVa28()));
dataHarmphasicV.setV29Cp95(messageDataV.getGVa29()); dataHarmphasicV.setV29Cp95(adjustPhase(messageDataV.getGVa29()));
dataHarmphasicV.setV30Cp95(messageDataV.getGVa30()); dataHarmphasicV.setV30Cp95(adjustPhase(messageDataV.getGVa30()));
dataHarmphasicV.setV31Cp95(messageDataV.getGVa31()); dataHarmphasicV.setV31Cp95(adjustPhase(messageDataV.getGVa31()));
dataHarmphasicV.setV32Cp95(messageDataV.getGVa32()); dataHarmphasicV.setV32Cp95(adjustPhase(messageDataV.getGVa32()));
dataHarmphasicV.setV33Cp95(messageDataV.getGVa33()); dataHarmphasicV.setV33Cp95(adjustPhase(messageDataV.getGVa33()));
dataHarmphasicV.setV34Cp95(messageDataV.getGVa34()); dataHarmphasicV.setV34Cp95(adjustPhase(messageDataV.getGVa34()));
dataHarmphasicV.setV35Cp95(messageDataV.getGVa35()); dataHarmphasicV.setV35Cp95(adjustPhase(messageDataV.getGVa35()));
dataHarmphasicV.setV36Cp95(messageDataV.getGVa36()); dataHarmphasicV.setV36Cp95(adjustPhase(messageDataV.getGVa36()));
dataHarmphasicV.setV37Cp95(messageDataV.getGVa37()); dataHarmphasicV.setV37Cp95(adjustPhase(messageDataV.getGVa37()));
dataHarmphasicV.setV38Cp95(messageDataV.getGVa38()); dataHarmphasicV.setV38Cp95(adjustPhase(messageDataV.getGVa38()));
dataHarmphasicV.setV39Cp95(messageDataV.getGVa39()); dataHarmphasicV.setV39Cp95(adjustPhase(messageDataV.getGVa39()));
dataHarmphasicV.setV40Cp95(messageDataV.getGVa40()); dataHarmphasicV.setV40Cp95(adjustPhase(messageDataV.getGVa40()));
dataHarmphasicV.setV41Cp95(messageDataV.getGVa41()); dataHarmphasicV.setV41Cp95(adjustPhase(messageDataV.getGVa41()));
dataHarmphasicV.setV42Cp95(messageDataV.getGVa42()); dataHarmphasicV.setV42Cp95(adjustPhase(messageDataV.getGVa42()));
dataHarmphasicV.setV43Cp95(messageDataV.getGVa43()); dataHarmphasicV.setV43Cp95(adjustPhase(messageDataV.getGVa43()));
dataHarmphasicV.setV44Cp95(messageDataV.getGVa44()); dataHarmphasicV.setV44Cp95(adjustPhase(messageDataV.getGVa44()));
dataHarmphasicV.setV45Cp95(messageDataV.getGVa45()); dataHarmphasicV.setV45Cp95(adjustPhase(messageDataV.getGVa45()));
dataHarmphasicV.setV46Cp95(messageDataV.getGVa46()); dataHarmphasicV.setV46Cp95(adjustPhase(messageDataV.getGVa46()));
dataHarmphasicV.setV47Cp95(messageDataV.getGVa47()); dataHarmphasicV.setV47Cp95(adjustPhase(messageDataV.getGVa47()));
dataHarmphasicV.setV48Cp95(messageDataV.getGVa48()); dataHarmphasicV.setV48Cp95(adjustPhase(messageDataV.getGVa48()));
dataHarmphasicV.setV49Cp95(messageDataV.getGVa49()); dataHarmphasicV.setV49Cp95(adjustPhase(messageDataV.getGVa49()));
dataHarmphasicV.setV50Cp95(messageDataV.getGVa50()); dataHarmphasicV.setV50Cp95(adjustPhase(messageDataV.getGVa50()));
} }
@@ -980,4 +1002,5 @@ public class BeanVConverter {
return dataHarmrateVDTO; return dataHarmrateVDTO;
} }
} }

View File

@@ -0,0 +1,52 @@
#当前服务的基本信息
microservice:
ename: @artifactId@
name: '@name@'
version: @version@
sentinel:
url: @sentinel.url@
gateway:
url: @gateway.url@
server:
port: 10404
#feign接口开启服务熔断降级处理
feign:
sentinel:
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
#项目日志的配置
logging:
#config: http://@nacos.url@/nacos/v1/cs/configs?tenant=@nacos.namespace@&group=DEFAULT_GROUP&dataId=logback.xml
level:
root: info
#mybatis配置信息
mybatis-plus:
#别名扫描
type-aliases-package: com.njcn.harmonic.pojo
mqtt:
client-id: @artifactId@${random.value}

View File

@@ -0,0 +1,57 @@
#当前服务的基本信息
microservice:
ename: @artifactId@
name: '@name@'
version: @version@
sentinel:
url: @sentinel.url@
gateway:
url: @gateway.url@
server:
port: 10404
#feign接口开启服务熔断降级处理
feign:
sentinel:
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
- data-id: data-platform.yaml
refresh: true
main:
allow-bean-definition-overriding: true
#项目日志的配置
logging:
#config: http://@nacos.url@/nacos/v1/cs/configs?tenant=@nacos.namespace@&group=DEFAULT_GROUP&dataId=logback.xml
level:
root: info
#mybatis配置信息
mybatis-plus:
#别名扫描
type-aliases-package: com.njcn.harmonic.pojo
mqtt:
client-id: @artifactId@${random.value}

View File

@@ -1,53 +1,3 @@
#当前服务的基本信息
microservice:
ename: @artifactId@
name: '@name@'
version: @version@
sentinel:
url: @sentinel.url@
gateway:
url: @gateway.url@
server:
port: 10404
#feign接口开启服务熔断降级处理
feign:
sentinel:
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
- data-Id: data-platform.yaml
refresh: true
main:
allow-bean-definition-overriding: true
#项目日志的配置
logging:
config: http://@nacos.url@/nacos/v1/cs/configs?tenant=@nacos.namespace@&group=DEFAULT_GROUP&dataId=logback.xml
level:
root: info
#mybatis配置信息
mybatis-plus:
#别名扫描
type-aliases-package: com.njcn.harmonic.pojo
mqtt:
client-id: @artifactId@${random.value}

View File

@@ -196,5 +196,8 @@ public interface InfluxDBTableConstant {
String NORMAL = "0"; String NORMAL = "0";
String UN_NORMAL = "1"; String UN_NORMAL = "1";
/**
* 数据清洗标志 0:正常 1:异常
*/
String ABNORMAL_FLAG = "abnormal_flag";
} }

View File

@@ -23,6 +23,7 @@ public class DataVDTO {
@JsonDeserialize(using = LocalDateTimeDeserializer.class) @JsonDeserialize(using = LocalDateTimeDeserializer.class)
@JsonSerialize(using = LocalDateTimeSerializer.class) @JsonSerialize(using = LocalDateTimeSerializer.class)
private LocalDateTime timeid; private LocalDateTime timeid;
private String devId;
private String lineid; private String lineid;
private String phasicType; private String phasicType;
private Double rms; private Double rms;

View File

@@ -343,7 +343,7 @@ public class DataRecallController extends BaseController {
} }
if(recallType ==3){ if(recallType ==3){
return; // return;
}else if(recallType ==2){ }else if(recallType ==2){
Integer timeInterval = data.getTimeInterval(); Integer timeInterval = data.getTimeInterval();
List<LocalDateTime> localDateTimeList = generateTimeIntervals(finalCurrentDate, timeInterval); List<LocalDateTime> localDateTimeList = generateTimeIntervals(finalCurrentDate, timeInterval);
@@ -353,7 +353,7 @@ public class DataRecallController extends BaseController {
List<String> timePeriod = mergeTimeIntervals(localDateTimeList, timeInterval); List<String> timePeriod = mergeTimeIntervals(localDateTimeList, timeInterval);
//最大时间段为300 //最大时间段为300
if(timePeriod.size()<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);

View File

@@ -1,56 +0,0 @@
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.param.DataCleanParam;
import com.njcn.dataProcess.pojo.dto.PqReasonableRangeDto;
import com.njcn.dataProcess.service.IPqReasonableRangeService;
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 javax.annotation.Resource;
import java.util.List;
/**
* <p>
* 前端控制器
* </p>
*
* @author xy
* @since 2025-02-13
*/
@Validated
@Slf4j
@Controller
@RestController
@RequestMapping("/pqReasonableRange")
@Api(tags = "数据清洗标准库")
public class PqReasonableRangeController extends BaseController {
@Resource
private IPqReasonableRangeService pqReasonableRangeService;
@OperateInfo(info = LogEnum.BUSINESS_COMMON,operateType = OperateType.QUERY)
@PostMapping("/getData")
@ApiOperation("按条件获取数据合理范围")
public HttpResult<List<PqReasonableRangeDto>> getData(@RequestBody DataCleanParam param) {
String methodDescribe = getMethodDescribe("getData");
List<PqReasonableRangeDto> list = pqReasonableRangeService.getReasonableRangeList(param);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe);
}
}

View File

@@ -19,6 +19,7 @@ import org.springframework.util.CollectionUtils;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.util.Comparator; import java.util.Comparator;
import java.util.List; import java.util.List;
import java.util.Map;
import java.util.stream.Collectors; import java.util.stream.Collectors;
/** /**
@@ -84,16 +85,18 @@ public class LnDataDealServiceImpl implements LnDataDealService {
//更新mysqldevice表最新数据时间 //更新mysqldevice表最新数据时间
if(!CollectionUtils.isEmpty(lnDataDTO.getDataVList())){ if(!CollectionUtils.isEmpty(lnDataDTO.getDataVList())){
DataVDTO dataVDTO =lnDataDTO.getDataVList().stream().max(Comparator.comparing(DataVDTO::getTimeid)).get();
List<String> lineIdList = lnDataDTO.getDataVList().stream().map(DataVDTO::getLineid).distinct().collect(Collectors.toList()); List<String> lineIdList = lnDataDTO.getDataVList().stream().map(DataVDTO::getLineid).distinct().collect(Collectors.toList());
List<LineDeviceStateVO> data = lineFeignClient.getAllLine(lineIdList).getData(); List<LineDeviceStateVO> data = lineFeignClient.getAllLine(lineIdList).getData();
//获取所有设备id并去重 Map<String, String> map = data.stream().collect(Collectors.toMap(LineDeviceStateVO::getId, temp -> temp.getPids().split(",")[4]));
List<String> devIds = data.stream().map(temp -> { lnDataDTO.getDataVList().forEach(temp->{
return temp.getPids().split(",")[4]; temp.setDevId(map.get(temp.getLineid()));
}).distinct().collect(Collectors.toList()); });
Map<String, List<DataVDTO>> collect = lnDataDTO.getDataVList().stream().collect(Collectors.groupingBy(DataVDTO::getDevId));
devIds.forEach(temp->{ collect.forEach((temp,dataVDTOList)->{
PqsCommunicateDto pqsCommunicateDto = new PqsCommunicateDto(); PqsCommunicateDto pqsCommunicateDto = new PqsCommunicateDto();
DataVDTO dataVDTO =dataVDTOList.stream().max(Comparator.comparing(DataVDTO::getTimeid)).get();
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);

View File

@@ -4,10 +4,6 @@ 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;
@@ -24,12 +20,10 @@ 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;
/** /**
@@ -47,10 +41,6 @@ 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>() {{ private static final Map<String, String> PHASE_MAPPING = new HashMap<String, String>() {{
put("AB", "A"); put("AB", "A");
put("BC", "B"); put("BC", "B");
@@ -80,12 +70,7 @@ 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; List<DataFlicker> list = getMinuteData(lineParam);
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);
@@ -98,12 +83,7 @@ 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; List<DataFlicker> dataIList = getMinuteData(lineParam);
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());
//以监测点分组 //以监测点分组
@@ -261,64 +241,13 @@ public class InfluxdbDataFlickerImpl extends MppServiceImpl<RStatDataFlickerRela
.between(DataFlicker::getTime, lineParam.getStartTime(), lineParam.getEndTime()) .between(DataFlicker::getTime, lineParam.getStartTime(), lineParam.getEndTime())
.eq(DataFlicker::getQualityFlag, "0"); .eq(DataFlicker::getQualityFlag, "0");
quality(result, influxQueryWrapper, lineParam); quality(result, influxQueryWrapper, lineParam);
return result; if (CollectionUtil.isNotEmpty(result)) {
} result.forEach(item -> {
String newType = PHASE_MAPPING.get(item.getPhasicType());
public List<DataFlicker> getWlMinuteData(LineCountEvaluateParam lineParam) { if (newType != null) {
List<DataFlicker> result = new ArrayList<>(); item.setPhasicType(newType);
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; return result;
} }

View File

@@ -2,10 +2,6 @@ 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;
@@ -22,12 +18,10 @@ 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;
/** /**
@@ -45,11 +39,6 @@ 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>() {{ private static final Map<String, String> PHASE_MAPPING = new HashMap<String, String>() {{
put("AB", "A"); put("AB", "A");
put("BC", "B"); put("BC", "B");
@@ -78,12 +67,7 @@ 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; List<DataFluc> list = getMinuteData(lineParam.getLineId(), lineParam.getStartTime(), lineParam.getEndTime(), lineParam.getAbnormalTime(),lineParam.getDataType());
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);
@@ -96,12 +80,7 @@ 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; List<DataFluc> dataIList = getMinuteData(lineParam.getLineId(), lineParam.getStartTime(), lineParam.getEndTime(), lineParam.getAbnormalTime(),lineParam.getDataType());
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());
//以监测点分组 //以监测点分组
@@ -215,53 +194,13 @@ public class InfluxdbDataFlucImpl extends MppServiceImpl<RStatDataFlucRelationMa
result.addAll(dataList); result.addAll(dataList);
} }
} }
return result; if (CollectionUtil.isNotEmpty(result)) {
} result.forEach(item -> {
String newType = PHASE_MAPPING.get(item.getPhasicType());
public List<DataFluc> getWlMinuteData(List<String> lineList, String startTime, String endTime, Map<String,List<String>> timeMap, Boolean dataType) { if (newType != null) {
//todo FLUCCF电压波动频度原先oracle表存储的是0写死的这边暂不取值 item.setPhasicType(newType);
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; return result;
} }

View File

@@ -4,10 +4,6 @@ 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;
@@ -28,7 +24,6 @@ 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,10 +35,6 @@ 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>() {{ private static final Map<String, String> PHASE_MAPPING = new HashMap<String, String>() {{
put("AB", "A"); put("AB", "A");
@@ -55,12 +46,7 @@ public class InfluxdbDataHarmRateIImpl extends MppServiceImpl<RStatDataHarmRateI
@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; List<DataHarmrateI> list = getMinuteData(lineParam.getLineId(), lineParam.getStartTime(), lineParam.getEndTime(), lineParam.getAbnormalTime(),lineParam.getDataType());
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);
@@ -73,12 +59,7 @@ 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; List<DataHarmrateI> data = getMinuteData(lineParam.getLineId(), lineParam.getStartTime(), lineParam.getEndTime(), lineParam.getAbnormalTime(),lineParam.getDataType());
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());
//以监测点分组 //以监测点分组
@@ -246,48 +227,13 @@ public class InfluxdbDataHarmRateIImpl extends MppServiceImpl<RStatDataHarmRateI
result.addAll(dataList); result.addAll(dataList);
} }
} }
return result; if (CollectionUtil.isNotEmpty(result)) {
} result.forEach(item -> {
String newType = PHASE_MAPPING.get(item.getPhasicType());
public List<DataHarmrateI> getWlMinuteData(List<String> lineList, String startTime, String endTime, Map<String,List<String>> timeMap, Boolean dataType) { if (newType != null) {
List<DataHarmrateI> result = new ArrayList<>(); item.setPhasicType(newType);
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; return result;
} }

View File

@@ -4,10 +4,6 @@ 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;
@@ -28,12 +24,10 @@ 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,10 +40,6 @@ 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>() {{ private static final Map<String, String> PHASE_MAPPING = new HashMap<String, String>() {{
put("AB", "A"); put("AB", "A");
@@ -61,12 +51,7 @@ public class InfluxdbDataHarmRateVImpl extends MppServiceImpl<RStatDataHarmRateV
@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; List<DataHarmrateV> list = getMinuteData(lineParam);
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);
@@ -97,12 +82,7 @@ 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; List<DataHarmrateV> data = getMinuteData(lineParam);
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());
//以监测点分组 //以监测点分组
@@ -314,59 +294,14 @@ public class InfluxdbDataHarmRateVImpl extends MppServiceImpl<RStatDataHarmRateV
result.addAll(dataList); result.addAll(dataList);
} }
} }
return result; if (CollectionUtil.isNotEmpty(result)) {
} result.forEach(item -> {
String newType = PHASE_MAPPING.get(item.getPhasicType());
public List<DataHarmrateV> getWlMinuteData(LineCountEvaluateParam lineParam) { if (newType != null) {
List<DataHarmrateV> result = new ArrayList<>(); item.setPhasicType(newType);
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; return result;
} }
} }

View File

@@ -4,10 +4,6 @@ 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;
@@ -25,12 +21,10 @@ 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,10 +40,6 @@ 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>() {{ private static final Map<String, String> PHASE_MAPPING = new HashMap<String, String>() {{
put("AB", "A"); put("AB", "A");
@@ -78,12 +68,7 @@ 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; List<DataHarmphasicI> list = getMinuteData(lineParam.getLineId(), lineParam.getStartTime(), lineParam.getEndTime(), lineParam.getAbnormalTime(),lineParam.getDataType());
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);
@@ -96,12 +81,7 @@ 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; List<DataHarmphasicI> data = getMinuteData(lineParam.getLineId(), lineParam.getStartTime(), lineParam.getEndTime(), lineParam.getAbnormalTime(),lineParam.getDataType());
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());
//以监测点分组 //以监测点分组
@@ -269,50 +249,15 @@ public class InfluxdbDataHarmphasicIImpl extends MppServiceImpl<RStatDataHarmPha
result.addAll(dataList); result.addAll(dataList);
} }
} }
return result; if (CollectionUtil.isNotEmpty(result)) {
} result.forEach(item -> {
String newType = PHASE_MAPPING.get(item.getPhasicType());
public List<DataHarmphasicI> getWlMinuteData(List<String> lineList, String startTime, String endTime, Map<String,List<String>> timeMap,Boolean dataType) { if (newType != null) {
List<DataHarmphasicI> result = new ArrayList<>(); item.setPhasicType(newType);
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; return result;
} }
} }

View File

@@ -4,15 +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.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;
@@ -27,12 +22,10 @@ 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;
/** /**
@@ -47,12 +40,7 @@ import java.util.stream.Collectors;
public class InfluxdbDataHarmphasicVImpl extends MppServiceImpl<RStatDataHarmPhasicVRelationMapper, RStatDataHarmPhasicVD> implements IDataHarmphasicV { public class InfluxdbDataHarmphasicVImpl extends MppServiceImpl<RStatDataHarmPhasicVRelationMapper, RStatDataHarmPhasicVD> implements IDataHarmphasicV {
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>() {{ private static final Map<String, String> PHASE_MAPPING = new HashMap<String, String>() {{
put("AB", "A"); put("AB", "A");
@@ -83,12 +71,7 @@ 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; List<DataHarmphasicV> list = getMinuteData(lineParam.getLineId(), lineParam.getStartTime(), lineParam.getEndTime(), lineParam.getAbnormalTime(),lineParam.getDataType());
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);
@@ -101,12 +84,7 @@ 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; List<DataHarmphasicV> data = getMinuteData(lineParam.getLineId(), lineParam.getStartTime(), lineParam.getEndTime(), lineParam.getAbnormalTime(),lineParam.getDataType());
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());
//以监测点分组 //以监测点分组
@@ -274,58 +252,13 @@ public class InfluxdbDataHarmphasicVImpl extends MppServiceImpl<RStatDataHarmPha
result.addAll(dataList); result.addAll(dataList);
} }
} }
return result; if (CollectionUtil.isNotEmpty(result)) {
} result.forEach(item -> {
String newType = PHASE_MAPPING.get(item.getPhasicType());
if (newType != null) {
public List<DataHarmphasicV> getWlMinuteData(List<String> lineList, String startTime, String endTime, Map<String,List<String>> timeMap, Boolean dataType) { item.setPhasicType(newType);
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; return result;
} }

View File

@@ -4,10 +4,6 @@ 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;
@@ -26,13 +22,11 @@ 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.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;
/** /**
@@ -47,12 +41,7 @@ import java.util.stream.Collectors;
public class InfluxdbDataHarmpowerPImpl extends MppServiceImpl<RStatDataHarmPowerPRelationMapper, RStatDataHarmPowerPD> implements IDataHarmpowerP { public class InfluxdbDataHarmpowerPImpl extends MppServiceImpl<RStatDataHarmPowerPRelationMapper, RStatDataHarmPowerPD> implements IDataHarmpowerP {
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>() {{ private static final Map<String, String> PHASE_MAPPING = new HashMap<String, String>() {{
put("AB", "A"); put("AB", "A");
@@ -82,12 +71,7 @@ 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; List<DataHarmpowerP> list = getMinuteData(lineParam.getLineId(), lineParam.getStartTime(), lineParam.getEndTime(), lineParam.getAbnormalTime(),lineParam.getDataType());
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);
@@ -100,12 +84,7 @@ 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; List<DataHarmpowerP> data = getMinuteData(lineParam.getLineId(), lineParam.getStartTime(), lineParam.getEndTime(), lineParam.getAbnormalTime(),lineParam.getDataType());
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());
//以监测点分组 //以监测点分组
@@ -128,7 +107,7 @@ public class InfluxdbDataHarmpowerPImpl extends MppServiceImpl<RStatDataHarmPowe
CommonMinuteDto.ValueType value = new CommonMinuteDto.ValueType(); CommonMinuteDto.ValueType value = new CommonMinuteDto.ValueType();
value.setValueType(valueType); value.setValueType(valueType);
List<List<Double>> lists; List<List<Double>> lists;
if (Objects.equals(phasicType, "T")) { if (Objects.equals(phasicType, "T") && Objects.equals(lineParam.getType(), 2)) {
lists = extractDataLists(valueTypeList, "Tot"); lists = extractDataLists(valueTypeList, "Tot");
} else { } else {
lists = extractDataLists(valueTypeList, ""); lists = extractDataLists(valueTypeList, "");
@@ -261,65 +240,13 @@ public class InfluxdbDataHarmpowerPImpl extends MppServiceImpl<RStatDataHarmPowe
result.addAll(dataList); result.addAll(dataList);
} }
} }
return result; if (CollectionUtil.isNotEmpty(result)) {
} result.forEach(item -> {
String newType = PHASE_MAPPING.get(item.getPhasicType());
public List<DataHarmpowerP> getWlMinuteData(List<String> lineList, String startTime, String endTime, Map<String,List<String>> timeMap, Boolean dataType) { if (newType != null) {
List<DataHarmpowerP> result = new ArrayList<>(); item.setPhasicType(newType);
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; return result;
} }

View File

@@ -4,10 +4,6 @@ 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;
@@ -25,13 +21,11 @@ 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.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;
/** /**
@@ -47,10 +41,6 @@ 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>() {{ private static final Map<String, String> PHASE_MAPPING = new HashMap<String, String>() {{
put("AB", "A"); put("AB", "A");
@@ -80,12 +70,7 @@ 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; List<DataHarmpowerQ> list = getMinuteData(lineParam.getLineId(), lineParam.getStartTime(), lineParam.getEndTime(), lineParam.getAbnormalTime(),lineParam.getDataType());
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);
@@ -98,12 +83,7 @@ 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; List<DataHarmpowerQ> data = getMinuteData(lineParam.getLineId(), lineParam.getStartTime(), lineParam.getEndTime(), lineParam.getAbnormalTime(),lineParam.getDataType());
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());
//以监测点分组 //以监测点分组
@@ -127,7 +107,7 @@ public class InfluxdbDataHarmpowerQImpl extends MppServiceImpl<RStatDataHarmPowe
value.setValueType(valueType); value.setValueType(valueType);
List<List<Double>> lists; List<List<Double>> lists;
if (Objects.equals(phasicType, "T")) { if (Objects.equals(phasicType, "T") && Objects.equals(lineParam.getType(), 2)) {
lists = extractDataLists(valueTypeList, "Tot"); lists = extractDataLists(valueTypeList, "Tot");
} else { } else {
lists = extractDataLists(valueTypeList, ""); lists = extractDataLists(valueTypeList, "");
@@ -254,57 +234,13 @@ public class InfluxdbDataHarmpowerQImpl extends MppServiceImpl<RStatDataHarmPowe
result.addAll(dataList); result.addAll(dataList);
} }
} }
return result; if (CollectionUtil.isNotEmpty(result)) {
} result.forEach(item -> {
String newType = PHASE_MAPPING.get(item.getPhasicType());
public List<DataHarmpowerQ> getWlMinuteData(List<String> lineList, String startTime, String endTime, Map<String,List<String>> timeMap, Boolean dataType) { if (newType != null) {
List<DataHarmpowerQ> result = new ArrayList<>(); item.setPhasicType(newType);
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; return result;
} }

View File

@@ -4,10 +4,6 @@ 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;
@@ -25,13 +21,11 @@ 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.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;
/** /**
@@ -47,10 +41,6 @@ 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>() {{ private static final Map<String, String> PHASE_MAPPING = new HashMap<String, String>() {{
put("AB", "A"); put("AB", "A");
@@ -80,12 +70,7 @@ 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; List<DataHarmpowerS> list = getMinuteData(lineParam.getLineId(), lineParam.getStartTime(), lineParam.getEndTime(), lineParam.getAbnormalTime(),lineParam.getDataType());
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);
@@ -98,12 +83,7 @@ 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; List<DataHarmpowerS> data = getMinuteData(lineParam.getLineId(), lineParam.getStartTime(), lineParam.getEndTime(), lineParam.getAbnormalTime(),lineParam.getDataType());
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());
//以监测点分组 //以监测点分组
@@ -126,7 +106,7 @@ public class InfluxdbDataHarmpowerSImpl extends MppServiceImpl<RStatDataHarmPowe
CommonMinuteDto.ValueType value = new CommonMinuteDto.ValueType(); CommonMinuteDto.ValueType value = new CommonMinuteDto.ValueType();
value.setValueType(valueType); value.setValueType(valueType);
List<List<Double>> lists; List<List<Double>> lists;
if (Objects.equals(phasicType, "T")) { if (Objects.equals(phasicType, "T") && Objects.equals(lineParam.getType(), 2)) {
lists = extractDataLists(valueTypeList, "Tot"); lists = extractDataLists(valueTypeList, "Tot");
} else { } else {
lists = extractDataLists(valueTypeList, ""); lists = extractDataLists(valueTypeList, "");
@@ -253,59 +233,14 @@ public class InfluxdbDataHarmpowerSImpl extends MppServiceImpl<RStatDataHarmPowe
result.addAll(dataList); result.addAll(dataList);
} }
} }
return result; if (CollectionUtil.isNotEmpty(result)) {
} result.forEach(item -> {
String newType = PHASE_MAPPING.get(item.getPhasicType());
public List<DataHarmpowerS> getWlMinuteData(List<String> lineList, String startTime, String endTime, Map<String,List<String>> timeMap,Boolean dataType) { if (newType != null) {
List<DataHarmpowerS> result = new ArrayList<>(); item.setPhasicType(newType);
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; return result;
} }
} }

View File

@@ -4,10 +4,6 @@ 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;
@@ -26,12 +22,10 @@ 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;
/** /**
@@ -49,11 +43,6 @@ 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>() {{ private static final Map<String, String> PHASE_MAPPING = new HashMap<String, String>() {{
put("AB", "A"); put("AB", "A");
put("BC", "B"); put("BC", "B");
@@ -82,12 +71,7 @@ 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; List<DataI> list = getMinuteDataI(lineParam);;
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);
@@ -100,12 +84,7 @@ 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; List<DataI> dataIList = getMinuteDataI(lineParam);
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());
//以监测点分组 //以监测点分组
@@ -314,65 +293,13 @@ public class InfluxdbDataIImpl extends MppServiceImpl<RStatDataIRelationMapper,
result.addAll(dataList); result.addAll(dataList);
} }
} }
return result; if (CollectionUtil.isNotEmpty(result)) {
} result.forEach(item -> {
String newType = PHASE_MAPPING.get(item.getPhasicType());
public List<DataI> getWlMinuteDataI(LineCountEvaluateParam lineParam) { if (newType != null) {
List<DataI> result = new ArrayList<>(); item.setPhasicType(newType);
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; return result;
} }

View File

@@ -4,10 +4,6 @@ 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;
@@ -25,12 +21,10 @@ 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,10 +40,6 @@ 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>() {{ private static final Map<String, String> PHASE_MAPPING = new HashMap<String, String>() {{
put("AB", "A"); put("AB", "A");
@@ -79,12 +69,7 @@ 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; List<DataInharmI> list = getMinuteData(lineParam.getLineId(), lineParam.getStartTime(), lineParam.getEndTime(),lineParam.getAbnormalTime(),lineParam.getDataType());
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);
@@ -97,12 +82,7 @@ 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; List<DataInharmI> data = getMinuteData(lineParam.getLineId(), lineParam.getStartTime(), lineParam.getEndTime(),lineParam.getAbnormalTime(),lineParam.getDataType());
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());
//以监测点分组 //以监测点分组
@@ -270,49 +250,14 @@ public class InfluxdbDataInharmIImpl extends MppServiceImpl<RStatDataInHarmIRela
result.addAll(dataList); result.addAll(dataList);
} }
} }
return result; if (CollectionUtil.isNotEmpty(result)) {
} result.forEach(item -> {
String newType = PHASE_MAPPING.get(item.getPhasicType());
public List<DataInharmI> getWlMinuteData(List<String> lineList, String startTime, String endTime, Map<String,List<String>> timeMap, Boolean dataType) { if (newType != null) {
List<DataInharmI> result = new ArrayList<>(); item.setPhasicType(newType);
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; return result;
} }
} }

View File

@@ -4,10 +4,6 @@ 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;
@@ -26,12 +22,10 @@ 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;
@@ -47,12 +41,7 @@ import java.util.stream.Collectors;
public class InfluxdbDataInharmVImpl extends MppServiceImpl<RStatDataInHarmVRelationMapper, RStatDataInHarmVD> implements IDataInharmV { public class InfluxdbDataInharmVImpl extends MppServiceImpl<RStatDataInHarmVRelationMapper, RStatDataInHarmVD> implements IDataInharmV {
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>() {{ private static final Map<String, String> PHASE_MAPPING = new HashMap<String, String>() {{
put("AB", "A"); put("AB", "A");
@@ -81,12 +70,7 @@ 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; List<DataInharmV> list = getMinuteData(lineParam);
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);
@@ -99,12 +83,7 @@ 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; List<DataInharmV> data = getMinuteData(lineParam);
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());
//以监测点分组 //以监测点分组
@@ -275,56 +254,14 @@ public class InfluxdbDataInharmVImpl extends MppServiceImpl<RStatDataInHarmVRela
result.addAll(dataList); result.addAll(dataList);
} }
} }
return result; if (CollectionUtil.isNotEmpty(result)) {
} result.forEach(item -> {
String newType = PHASE_MAPPING.get(item.getPhasicType());
public List<DataInharmV> getWlMinuteData(LineCountEvaluateParam lineParam) { if (newType != null) {
List<DataInharmV> result = new ArrayList<>(); item.setPhasicType(newType);
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; return result;
} }
} }

View File

@@ -3,10 +3,6 @@ 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;
@@ -24,12 +20,10 @@ 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;
/** /**
@@ -44,12 +38,7 @@ import java.util.stream.Collectors;
public class InfluxdbDataPltImpl extends MppServiceImpl<RStatDataPltRelationMapper, RStatDataPltD> implements IDataPlt { public class InfluxdbDataPltImpl extends MppServiceImpl<RStatDataPltRelationMapper, RStatDataPltD> implements IDataPlt {
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>() {{ private static final Map<String, String> PHASE_MAPPING = new HashMap<String, String>() {{
put("AB", "A"); put("AB", "A");
@@ -79,12 +68,7 @@ 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; List<DataPlt> list = getMinuteDataPlt(lineParam);
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);
@@ -97,12 +81,7 @@ 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; List<DataPlt> data = getMinuteDataPlt(lineParam);
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());
//以监测点分组 //以监测点分组
@@ -222,59 +201,14 @@ public class InfluxdbDataPltImpl extends MppServiceImpl<RStatDataPltRelationMapp
result.addAll(dataList); result.addAll(dataList);
} }
} }
return result; if (CollectionUtil.isNotEmpty(result)) {
} result.forEach(item -> {
String newType = PHASE_MAPPING.get(item.getPhasicType());
public List<DataPlt> getWlMinuteDataPlt(LineCountEvaluateParam lineParam) { if (newType != null) {
List<DataPlt> result = new ArrayList<>(); item.setPhasicType(newType);
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; return result;
} }
} }

View File

@@ -6,10 +6,6 @@ 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;
@@ -38,7 +34,6 @@ 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;
/** /**
@@ -51,10 +46,6 @@ 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>() {{ private static final Map<String, String> PHASE_MAPPING = new HashMap<String, String>() {{
put("AB", "A"); put("AB", "A");
@@ -137,12 +128,7 @@ 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; List<DataV> list = getMinuteDataV(lineParam);
if (Objects.equals(lineParam.getType(), 2)) {
list = getWlMinuteDataV(lineParam);
} else {
list = getMinuteDataV(lineParam);
}
if (CollectionUtil.isNotEmpty(list)) { if (CollectionUtil.isNotEmpty(list)) {
list.forEach(item -> { list.forEach(item -> {
DataVDto dto = new DataVDto(); DataVDto dto = new DataVDto();
@@ -226,12 +212,7 @@ 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; List<DataV> dataVList = getMinuteDataV(lineParam);
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());
//以监测点分组 //以监测点分组
@@ -481,89 +462,13 @@ public class InfluxdbDataVImpl extends MppServiceImpl<RStatDataVRelationMapper,
influxQueryWrapper.regular(DataV::getPhasicType, lineParam.getPhasicType()); influxQueryWrapper.regular(DataV::getPhasicType, lineParam.getPhasicType());
} }
quality(result, influxQueryWrapper, lineParam); quality(result, influxQueryWrapper, lineParam);
return result; if (CollectionUtil.isNotEmpty(result)) {
} result.forEach(item -> {
String newType = PHASE_MAPPING.get(item.getPhasicType());
/** if (newType != null) {
* 按监测点集合、时间条件获取dataV分钟数据 item.setPhasicType(newType);
* 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; return result;
} }

View File

@@ -122,7 +122,8 @@ public class InfluxdbPqsCommunicateImpl implements IPqsCommunicate {
pqsCommunicate.setDevId(pqsCommunicateDto.getDevId()); pqsCommunicate.setDevId(pqsCommunicateDto.getDevId());
pqsCommunicate.setType(pqsCommunicateDto.getType()); pqsCommunicate.setType(pqsCommunicateDto.getType());
//如果不存数据或者状态不一样则插入数据 //如果不存数据或者状态不一样则插入数据
if(CollectionUtils.isEmpty(pqsCommunicates)|| !Objects.equals( pqsCommunicates.get(0).getType(),pqsCommunicateDto.getType())){ //可能存在掉线后最后一组数据还未入库,添加时间判断
if(CollectionUtils.isEmpty(pqsCommunicates)|| (!Objects.equals( pqsCommunicates.get(0).getType(),pqsCommunicateDto.getType())&&pqsCommunicates.get(0).getTime().isBefore(pqsCommunicate.getTime()))){
pqsCommunicateMapper.insertOne(pqsCommunicate); pqsCommunicateMapper.insertOne(pqsCommunicate);
} }

View File

@@ -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

View File

@@ -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

View File

@@ -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: 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

View File

@@ -6,6 +6,7 @@ import com.njcn.common.pojo.enums.common.LogEnum;
import com.njcn.common.pojo.response.HttpResult; import com.njcn.common.pojo.response.HttpResult;
import com.njcn.message.api.fallback.ProduceFeignClientFallbackFactory; import com.njcn.message.api.fallback.ProduceFeignClientFallbackFactory;
import com.njcn.message.message.AskFileSysMessage;
import com.njcn.message.message.DeviceRebootMessage; import com.njcn.message.message.DeviceRebootMessage;
import com.njcn.message.message.ProcessRebootMessage; import com.njcn.message.message.ProcessRebootMessage;
import com.njcn.message.message.RecallMessage; import com.njcn.message.message.RecallMessage;
@@ -38,4 +39,7 @@ public interface ProduceFeignClient {
public HttpResult<Boolean> askRestartProcess(@RequestBody ProcessRebootMessage message); public HttpResult<Boolean> askRestartProcess(@RequestBody ProcessRebootMessage message);
@PostMapping("/askFileSys")
public HttpResult<String> askFileSys(@RequestBody AskFileSysMessage message);
} }

View File

@@ -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.message.api.ProduceFeignClient; import com.njcn.message.api.ProduceFeignClient;
import com.njcn.message.message.AskFileSysMessage;
import com.njcn.message.message.DeviceRebootMessage; import com.njcn.message.message.DeviceRebootMessage;
import com.njcn.message.message.ProcessRebootMessage; import com.njcn.message.message.ProcessRebootMessage;
import com.njcn.message.message.RecallMessage; import com.njcn.message.message.RecallMessage;
@@ -53,6 +54,12 @@ public class ProduceFeignClientFallbackFactory implements FallbackFactory<Produc
log.error("{}异常,降级处理,异常为:{}", "进程重启", throwable.toString()); log.error("{}异常,降级处理,异常为:{}", "进程重启", throwable.toString());
throw new BusinessException(finalExceptionEnum); throw new BusinessException(finalExceptionEnum);
} }
@Override
public HttpResult<String> askFileSys(AskFileSysMessage message) {
log.error("{}异常,降级处理,异常为:{}", "请求装置文件系统", throwable.toString());
throw new BusinessException(finalExceptionEnum);
}
}; };
} }
} }

View File

@@ -37,6 +37,9 @@ public interface BusinessTopic {
String ASK_REAL_DATA_TOPIC = "ask_real_data_topic"; String ASK_REAL_DATA_TOPIC = "ask_real_data_topic";
String RECALL_TOPIC = "recall_Topic"; String RECALL_TOPIC = "recall_Topic";
String FILE_TOPIC = "File_Topic";
/********************************数据中心*********************************/ /********************************数据中心*********************************/

View File

@@ -0,0 +1,36 @@
package com.njcn.message.message;
import lombok.Data;
/**
* Description:
* Date: 2024/12/13 10:15【需求编号】
*
* @author clam
* @version V1.0.0
*/
@Data
public class AskFileSysMessage {
/**
* guid : sdghsfdhfdhdfhdfghd234234534534
* frontid : dhdfhdfghd2342
* ProcessNo : 1
* devid : 167456737637374567
* type : 2
* Path : /remote/vol1_stat.txt
* DevPath : /etc/vol1_stat.txt
*/
private String guid;
private String nodeId;
private int processNo;
private String devId;
private int type;
private String path;
private String remotePath;
}

View File

@@ -0,0 +1,26 @@
package com.njcn.message.messagedto;
import com.njcn.middle.rocket.domain.BaseMessage;
import lombok.Data;
import java.io.Serializable;
/**
* Description:
* Date: 2026/04/29 下午 3:16【需求编号】
*
* @author clam
* @version V1.0.0
*/
@Data
public class FileSysDTO<T> extends BaseMessage implements Serializable {
private String guid;
private String nodeId;
private int processNo;
private String devId;
private int type;
private String path;
private String devPath;
private int result;
private T detail;
}

View File

@@ -84,15 +84,19 @@ public class DeviceRunFlagDataConsumer extends EnhanceConsumerMessageHandler<Dev
@Override @Override
protected void handleMessage(DevComFlagDTO message) { protected void handleMessage(DevComFlagDTO message) {
//获取之前设备状态 //获取之前设备状态
String devFalg =redisUtil.getStringByKey(RedisKeyPrefix.DEVICE_RUN_FLAG.concat(message.getId())); //删除设备时前置会在连接一次通道但是DevId为空所以添加
if(StringUtils.isNoneBlank(message.getId())){
String devFalg =redisUtil.getStringByKey(RedisKeyPrefix.DEVICE_RUN_FLAG.concat(message.getId()));
if(StringUtils.isBlank(devFalg)||(!Objects.equals(Integer.valueOf(devFalg),message.getStatus()))){ 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()+""); redisUtil.saveByKey(RedisKeyPrefix.DEVICE_RUN_FLAG.concat(message.getId()),message.getStatus()+"");
}
} }
} }

View File

@@ -0,0 +1,151 @@
package com.njcn.message.consumer;
import com.alibaba.fastjson.JSONObject;
import com.njcn.message.constant.MessageStatus;
import com.njcn.message.constant.RedisKeyPrefix;
import com.njcn.message.messagedto.FileSysDTO;
import com.njcn.message.messagedto.MessageDataDTO;
import com.njcn.message.websocket.WebSocketServer;
import com.njcn.middle.rocket.constant.EnhanceMessageConstant;
import com.njcn.middle.rocket.handler.EnhanceConsumerMessageHandler;
import com.njcn.redis.pojo.enums.RedisKeyEnum;
import com.njcn.redis.utils.RedisUtil;
import com.njcn.system.api.RocketMqLogFeignClient;
import com.njcn.system.pojo.po.RocketmqMsgErrorLog;
import lombok.extern.slf4j.Slf4j;
import org.apache.rocketmq.spring.annotation.RocketMQMessageListener;
import org.apache.rocketmq.spring.core.RocketMQListener;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.stereotype.Component;
import javax.annotation.Resource;
import java.util.Objects;
import java.util.concurrent.TimeUnit;
/**
* Description:
* Date: 2024/12/13 10:06【需求编号】
*
* @author clam
* @version V1.0.0
*/
@Component
@RocketMQMessageListener(
topic = "File_Reply_Topic",
consumerGroup = "file_sys_consumer",
consumeThreadNumber = 10,
enableMsgTrace = true
)
@Slf4j
public class FileSysDataConsumer extends EnhanceConsumerMessageHandler<FileSysDTO> implements RocketMQListener<String> {
@Resource
private RedisUtil redisUtil;
@Resource
private StringRedisTemplate stringRedisTemplate;
@Resource
private RocketMqLogFeignClient rocketMqLogFeignClient;
@Override
public void onMessage(String message) {
FileSysDTO messageDataDTO = JSONObject.parseObject(message, FileSysDTO.class);
super.dispatchMessage(messageDataDTO);
}
/***
* 通过redis分布式锁判断当前消息所处状态
* 1、null 查不到该key的数据属于第一次消费放行
* 2、fail 上次消息消费时发生异常,放行
* 3、being processed 正在处理,打回去
* 4、success 最近72小时消费成功避免重复消费打回去
*/
@Override
public boolean filter(FileSysDTO message) {
String keyStatus = redisUtil.getStringByKey(RedisKeyPrefix.REAL_TIME_DATA.concat(message.getKey()));
if (Objects.isNull(keyStatus) || keyStatus.equalsIgnoreCase(MessageStatus.FAIL)) {
redisUtil.saveByKeyWithExpire(RedisKeyPrefix.REAL_TIME_DATA.concat(message.getKey()), MessageStatus.BEING_PROCESSED, 30L);
return false;
}
return true;
}
/**
* 消费成功缓存到redis5分钟避免重复消费
*/
@Override
protected void consumeSuccess(FileSysDTO message) {
// redisUtil.saveByKeyWithExpire(RedisKeyPrefix.REAL_TIME_DATA.concat(message.getKey()), MessageStatus.SUCCESS, 5*60L);
}
@Override
protected void handleMessage(FileSysDTO message) {
String msgId = message.getGuid();
// 1. 将结果存入 Redis过期时间 60 秒(足够完成请求)
String key = "pending:" + msgId;
redisUtil.saveByKeyWithExpire(key, message, 60L);
// 2. 发布 Redis 通知,让等待的实例知道结果已就绪
stringRedisTemplate.convertAndSend("result_ready_channel", msgId);
}
/**
* 发生异常时,进行错误信息入库保存
* 默认没有实现类子类可以实现该方法调用feign接口进行入库保存
*/
@Override
protected void saveExceptionMsgLog(FileSysDTO message, String identity, Exception exception) {
redisUtil.saveByKeyWithExpire(RedisKeyPrefix.REAL_TIME_DATA.concat(message.getKey()), MessageStatus.FAIL, RedisKeyEnum.ROCKET_MQ_KEY.getTime());
RocketmqMsgErrorLog rocketmqMsgErrorLog = new RocketmqMsgErrorLog();
rocketmqMsgErrorLog.setMsgKey(message.getKey());
rocketmqMsgErrorLog.setResource(message.getSource());
if (identity.equalsIgnoreCase(EnhanceMessageConstant.IDENTITY_SINGLE)) {
//数据库字段配置长度200避免插入失败大致分析异常原因
String exceptionMsg = exception.getMessage();
if(exceptionMsg.length() > 200){
exceptionMsg = exceptionMsg.substring(0,180);
}
rocketmqMsgErrorLog.setRecord(exceptionMsg);
//如果是当前消息重试的则略过
if(!message.getSource().startsWith(EnhanceMessageConstant.RETRY_PREFIX)){
//单次消费异常
rocketMqLogFeignClient.add(rocketmqMsgErrorLog);
}
} else {
rocketmqMsgErrorLog.setRecord("重试消费" + super.getMaxRetryTimes() + "次,依旧消费失败。");
//重试N次后依然消费异常
rocketMqLogFeignClient.add(rocketmqMsgErrorLog);
}
}
/***
* 处理失败后,是否重试
* 一般开启
*/
@Override
protected boolean isRetry() {
return true;
}
/***
* 消费失败是否抛出异常,抛出异常后就不再消费了
*/
@Override
protected boolean throwException() {
return false;
}
}

View File

@@ -7,9 +7,11 @@ import com.njcn.common.pojo.enums.response.CommonResponseEnum;
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.message.message.AskFileSysMessage;
import com.njcn.message.message.DeviceRebootMessage; import com.njcn.message.message.DeviceRebootMessage;
import com.njcn.message.message.ProcessRebootMessage; import com.njcn.message.message.ProcessRebootMessage;
import com.njcn.message.message.RecallMessage; import com.njcn.message.message.RecallMessage;
import com.njcn.message.produce.template.AskFileSysMessaggeTemplate;
import com.njcn.message.produce.template.DeviceRebootMessageTemplate; import com.njcn.message.produce.template.DeviceRebootMessageTemplate;
import com.njcn.message.produce.template.ProcessRebootMessageTemplate; import com.njcn.message.produce.template.ProcessRebootMessageTemplate;
import com.njcn.message.produce.template.RecallMessaggeTemplate; import com.njcn.message.produce.template.RecallMessaggeTemplate;
@@ -40,6 +42,7 @@ public class ProduceController extends BaseController {
private final ProcessRebootMessageTemplate processRebootMessageTemplate; private final ProcessRebootMessageTemplate processRebootMessageTemplate;
private final AskFileSysMessaggeTemplate askFileSysMessaggeTemplate;
@PostMapping("/recall") @PostMapping("/recall")
@OperateInfo(info = LogEnum.BUSINESS_COMMON) @OperateInfo(info = LogEnum.BUSINESS_COMMON)
@@ -76,4 +79,14 @@ public class ProduceController extends BaseController {
processRebootMessageTemplate.sendMember(baseMessage,message.getNodeId()); processRebootMessageTemplate.sendMember(baseMessage,message.getNodeId());
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe); return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
} }
@PostMapping("/askFileSys")
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
@ApiOperation("请求文件系统")
@ApiImplicitParam(name = "message", value = "参数", required = true)
public HttpResult<String> askFileSys(@RequestBody AskFileSysMessage message){
String methodDescribe = getMethodDescribe("askFileSys");
SendResult sendResult = askFileSysMessaggeTemplate.sendMember(message);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS,message.getGuid() , methodDescribe);
}
} }

View File

@@ -0,0 +1,34 @@
package com.njcn.message.produce.template;
import com.alibaba.fastjson.JSONObject;
import com.njcn.message.constant.BusinessResource;
import com.njcn.message.constant.BusinessTopic;
import com.njcn.message.message.AskFileSysMessage;
import com.njcn.middle.rocket.domain.BaseMessage;
import com.njcn.middle.rocket.template.RocketMQEnhanceTemplate;
import org.apache.rocketmq.client.producer.SendResult;
import org.apache.rocketmq.spring.core.RocketMQTemplate;
import org.springframework.stereotype.Component;
/**
* Description:
* Date: 2024/12/13 15:15【需求编号】
*
* @author clam
* @version V1.0.0
*/
@Component
public class AskFileSysMessaggeTemplate extends RocketMQEnhanceTemplate {
public AskFileSysMessaggeTemplate(RocketMQTemplate template) {
super(template);
}
public SendResult sendMember(AskFileSysMessage askRealDataMessage) {
BaseMessage baseMessage = new BaseMessage();
baseMessage.setMessageBody(JSONObject.toJSONString(askRealDataMessage));
baseMessage.setSource(BusinessResource.WEB_RESOURCE);
baseMessage.setKey(askRealDataMessage.getGuid());
return send(BusinessTopic.FILE_TOPIC,askRealDataMessage.getNodeId() , baseMessage);
}
}

View File

@@ -132,7 +132,7 @@ public class WebSocketServer {
baseMessage.setMessageBody(JSONObject.toJSONString(askRealDataMessage)); baseMessage.setMessageBody(JSONObject.toJSONString(askRealDataMessage));
// 发送消息到topic1 // 发送消息到topic1
askRealDataMessaggeTemplate.sendMember(baseMessage,data.getNodeId()); askRealDataMessaggeTemplate.sendMember(baseMessage,data.getNodeId());
redisUtil.saveByKeyWithExpire(RedisKeyPrefix.ASK_REAL_DATA.concat(split[1]),RedisKeyPrefix.ASK_REAL_DATA.concat(split[1]),20L); redisUtil.saveByKeyWithExpire(RedisKeyPrefix.ASK_REAL_DATA.concat(split[1]),RedisKeyPrefix.ASK_REAL_DATA.concat(split[1]),25L);
log.info("监测点连接:" + userIdAndLineIdAndDevId + ",当前在线监测点数为:" + getOnlineCount()); log.info("监测点连接:" + userIdAndLineIdAndDevId + ",当前在线监测点数为:" + getOnlineCount());
} }

View File

@@ -0,0 +1,57 @@
#当前服务的基本信息
microservice:
ename: @artifactId@
name: '@name@'
version: @version@
sentinel:
url: @sentinel.url@
gateway:
url: @gateway.url@
server:
port: 10407
#feign接口开启服务熔断降级处理
feign:
sentinel:
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
- data-id: data-platform.yaml
refresh: true
main:
allow-bean-definition-overriding: true
#项目日志的配置
logging:
#config: http://@nacos.url@/nacos/v1/cs/configs?tenant=@nacos.namespace@&group=DEFAULT_GROUP&dataId=logback.xml
level:
root: info
#mybatis配置信息
mybatis-plus:
#别名扫描
type-aliases-package: com.njcn.harmonic.pojo
mqtt:
client-id: @artifactId@${random.value}

View File

@@ -0,0 +1,57 @@
#当前服务的基本信息
microservice:
ename: @artifactId@
name: '@name@'
version: @version@
sentinel:
url: @sentinel.url@
gateway:
url: @gateway.url@
server:
port: 10407
#feign接口开启服务熔断降级处理
feign:
sentinel:
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
- data-id: data-platform.yaml
refresh: true
main:
allow-bean-definition-overriding: true
#项目日志的配置
logging:
#config: http://@nacos.url@/nacos/v1/cs/configs?tenant=@nacos.namespace@&group=DEFAULT_GROUP&dataId=logback.xml
level:
root: info
#mybatis配置信息
mybatis-plus:
#别名扫描
type-aliases-package: com.njcn.harmonic.pojo
mqtt:
client-id: @artifactId@${random.value}

View File

@@ -1,53 +1,3 @@
#当前服务的基本信息
microservice:
ename: @artifactId@
name: '@name@'
version: @version@
sentinel:
url: @sentinel.url@
gateway:
url: @gateway.url@
server:
port: 10407
#feign接口开启服务熔断降级处理
feign:
sentinel:
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
- data-Id: data-platform.yaml
refresh: true
main:
allow-bean-definition-overriding: true
#项目日志的配置
logging:
config: http://@nacos.url@/nacos/v1/cs/configs?tenant=@nacos.namespace@&group=DEFAULT_GROUP&dataId=logback.xml
level:
root: info
#mybatis配置信息
mybatis-plus:
#别名扫描
type-aliases-package: com.njcn.harmonic.pojo
mqtt:
client-id: @artifactId@${random.value}

54
pom.xml
View File

@@ -15,7 +15,7 @@
<module>algorithm</module> <module>algorithm</module>
<module>log</module> <module>log</module>
<module>data-processing</module> <module>data-processing</module>
<module>migration-influxdb</module> <!--<module>migration-influxdb</module>-->
</modules> </modules>
<distributionManagement> <distributionManagement>
@@ -32,47 +32,13 @@
</distributionManagement> </distributionManagement>
<properties> <properties>
<spring.profiles.active>sjzx</spring.profiles.active>
<!--内网--> <!--内网-->
<!-- <middle.server.url>192.168.1.22</middle.server.url>--> <middle.server.url>192.168.1.65</middle.server.url>
<!-- <service.server.url>192.168.1.121</service.server.url>--> <service.server.url>192.168.1.65</service.server.url>
<!-- <docker.server.url>192.168.1.22</docker.server.url>--> <docker.server.url>192.168.1.22</docker.server.url>
<!-- <nacos.url>${middle.server.url}:18848</nacos.url>--> <nacos.url>${middle.server.url}:18848</nacos.url>
<!-- <nacos.namespace>07ec981d-1377-4920-8760-b5a98ff7e668</nacos.namespace>--> <nacos.namespace></nacos.namespace>
<!-- <middle.server.url>192.168.21.129</middle.server.url>-->
<!-- <service.server.url>192.168.21.1</service.server.url>-->
<!-- <docker.server.url>192.168.1.22</docker.server.url>-->
<!-- <nacos.url>${middle.server.url}:18848</nacos.url>-->
<!-- <nacos.namespace>0c19477c-444e-413c-9782-e6ebc2eedac1</nacos.namespace>-->
<!-- <middle.server.url>127.0.0.1</middle.server.url>-->
<!-- &lt;!&ndash;微服务模块发布地址&ndash;&gt;-->
<!-- <service.server.url>127.0.0.1</service.server.url>-->
<!-- &lt;!&ndash;docker仓库地址&ndash;&gt;-->
<!-- <docker.server.url>127.0.0.1</docker.server.url>-->
<!-- &lt;!&ndash;nacos的ip:port&ndash;&gt;-->
<!-- <nacos.url>${middle.server.url}:8848</nacos.url>-->
<!-- <nacos.namespace>37a0e99f-eb96-4d2f-9b47-75bffa765827</nacos.namespace>-->
<!-- <middle.server.url>24.43.102.139</middle.server.url>-->
<!-- <service.server.url>24.43.102.139</service.server.url>-->
<!-- <docker.server.url>24.43.102.139</docker.server.url>-->
<!-- <nacos.url>${middle.server.url}:18848</nacos.url>-->
<!-- <nacos.namespace></nacos.namespace>-->
<middle.server.url>127.0.0.1</middle.server.url>
<service.server.url>127.0.0.1</service.server.url>
<docker.server.url>127.0.0.1</docker.server.url>
<nacos.url>${middle.server.url}:8848</nacos.url>
<nacos.namespace>37a0e99f-eb96-4d2f-9b47-75bffa765827</nacos.namespace>
<!-- <middle.server.url>192.168.21.129</middle.server.url>-->
<!-- &lt;!&ndash;微服务模块发布地址&ndash;&gt;-->
<!-- <service.server.url>192.168.21.1</service.server.url>-->
<!-- &lt;!&ndash;docker仓库地址&ndash;&gt;-->
<!-- <docker.server.url>192.168.1.22</docker.server.url>-->
<!-- <nacos.url>${middle.server.url}:18848</nacos.url>-->
<!-- <nacos.namespace>0c19477c-444e-413c-9782-e6ebc2eedac1</nacos.namespace>-->
<!--sentinel:port--> <!--sentinel:port-->
<sentinel.url>${middle.server.url}:8080</sentinel.url> <sentinel.url>${middle.server.url}:8080</sentinel.url>
<!--网关地址主要用于配置swagger中认证token--> <!--网关地址主要用于配置swagger中认证token-->
@@ -87,6 +53,12 @@
<micro.sdk>common-microservice</micro.sdk> <micro.sdk>common-microservice</micro.sdk>
<!-- <micro.sdk>common-huawei</micro.sdk>--> <!-- <micro.sdk>common-huawei</micro.sdk>-->
<docker.operate>site</docker.operate> <docker.operate>site</docker.operate>
<!--nacos开启鉴权后的用户名-->
<nacos.username>nacos</nacos.username>
<!--nacos的ip:port-->
<nacos.password>njcnpqs</nacos.password>
<java.version>1.8</java.version> <java.version>1.8</java.version>
<maven.compiler.source>8</maven.compiler.source> <maven.compiler.source>8</maven.compiler.source>
<maven.compiler.target>8</maven.compiler.target> <maven.compiler.target>8</maven.compiler.target>