From af59a427f1635a4d9d85be91f8c60488fb913e73 Mon Sep 17 00:00:00 2001 From: wr <1754607820@qq.com> Date: Thu, 3 Apr 2025 16:10:00 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E8=83=BD=E6=BA=90=E4=B8=93=E9=A1=B9?= =?UTF-8?q?=E5=88=86=E6=9E=90=E7=AE=97=E6=B3=95=E8=BF=81=E7=A7=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../LiteFlowAlgorithmFeignClient.java | 4 +- ...owAlgorithmFeignClientFallbackFactory.java | 6 + .../com/njcn/algorithm/ExecutionCenter.java | 46 +- .../algorithm/executor/DeviceExecutor.java | 4 +- .../executor/SpecialAnalysisExecutor.java | 58 +++ .../service/line/ISpecialAnalysisService.java | 31 ++ .../line/SpecialAnalysisServiceImpl.java | 477 ++++++++++++++++++ .../api/DataLimitRateDetailFeignClient.java | 8 +- .../dataProcess/api/SpThroughFeignClient.java | 30 ++ ...tRateDetailFeignClientFallbackFactory.java | 6 + .../SpThroughFeignClientFallbackFactory.java | 60 +++ .../pojo/dto/DataQualifiedDetail.java | 1 - .../pojo/dto/RActivePowerRangeDto.java | 180 +++++++ .../dataProcess/pojo/dto/SpThroughDto.java | 33 ++ .../pojo/po/RActivePowerRange.java | 225 +++++++++ .../njcn/dataProcess/pojo/po/SpThrough.java | 55 ++ .../DataLimitRateDetailController.java | 14 +- .../RActivePowerRangeController.java | 52 ++ .../controller/SpThroughController.java | 47 ++ .../mapper/RActivePowerRangeMapper.java | 13 + .../dao/relation/mapper/SpThroughMapper.java | 14 + .../service/IDataLimitRateDetail.java | 9 + .../service/IRActivePowerRangeService.java | 24 + .../service/ISpThroughService.java | 25 + .../InfluxdbDataLimitRateDetailImpl.java | 6 + .../RelationDataLimitRateDetailImpl.java | 51 +- .../RelationRActivePowerRangeServiceImpl.java | 37 ++ .../RelationSpThroughServiceImpl.java | 44 ++ 28 files changed, 1542 insertions(+), 18 deletions(-) create mode 100644 algorithm/algorithm-boot/src/main/java/com/njcn/algorithm/executor/SpecialAnalysisExecutor.java create mode 100644 algorithm/algorithm-boot/src/main/java/com/njcn/algorithm/service/line/ISpecialAnalysisService.java create mode 100644 algorithm/algorithm-boot/src/main/java/com/njcn/algorithm/serviceimpl/line/SpecialAnalysisServiceImpl.java create mode 100644 data-processing/data-processing-api/src/main/java/com/njcn/dataProcess/api/SpThroughFeignClient.java create mode 100644 data-processing/data-processing-api/src/main/java/com/njcn/dataProcess/api/fallback/SpThroughFeignClientFallbackFactory.java create mode 100644 data-processing/data-processing-api/src/main/java/com/njcn/dataProcess/pojo/dto/RActivePowerRangeDto.java create mode 100644 data-processing/data-processing-api/src/main/java/com/njcn/dataProcess/pojo/dto/SpThroughDto.java create mode 100644 data-processing/data-processing-api/src/main/java/com/njcn/dataProcess/pojo/po/RActivePowerRange.java create mode 100644 data-processing/data-processing-api/src/main/java/com/njcn/dataProcess/pojo/po/SpThrough.java create mode 100644 data-processing/data-processing-boot/src/main/java/com/njcn/dataProcess/controller/RActivePowerRangeController.java create mode 100644 data-processing/data-processing-boot/src/main/java/com/njcn/dataProcess/controller/SpThroughController.java create mode 100644 data-processing/data-processing-boot/src/main/java/com/njcn/dataProcess/dao/relation/mapper/RActivePowerRangeMapper.java create mode 100644 data-processing/data-processing-boot/src/main/java/com/njcn/dataProcess/dao/relation/mapper/SpThroughMapper.java create mode 100644 data-processing/data-processing-boot/src/main/java/com/njcn/dataProcess/service/IRActivePowerRangeService.java create mode 100644 data-processing/data-processing-boot/src/main/java/com/njcn/dataProcess/service/ISpThroughService.java create mode 100644 data-processing/data-processing-boot/src/main/java/com/njcn/dataProcess/service/impl/relation/RelationRActivePowerRangeServiceImpl.java create mode 100644 data-processing/data-processing-boot/src/main/java/com/njcn/dataProcess/service/impl/relation/RelationSpThroughServiceImpl.java diff --git a/algorithm/algorithm-api/src/main/java/com/njcn/algorithm/pojo/liteflow/LiteFlowAlgorithmFeignClient.java b/algorithm/algorithm-api/src/main/java/com/njcn/algorithm/pojo/liteflow/LiteFlowAlgorithmFeignClient.java index 035f719..7c337dd 100644 --- a/algorithm/algorithm-api/src/main/java/com/njcn/algorithm/pojo/liteflow/LiteFlowAlgorithmFeignClient.java +++ b/algorithm/algorithm-api/src/main/java/com/njcn/algorithm/pojo/liteflow/LiteFlowAlgorithmFeignClient.java @@ -39,5 +39,7 @@ public interface LiteFlowAlgorithmFeignClient { @PostMapping("/substationExecutor") void substationExecutor(@RequestBody BaseParam baseParam); - + @ApiOperation("新能源专项分析算法执行链") + @PostMapping("/specialAnalysis") + void specialAnalysisExecutor(@RequestBody BaseParam baseParam); } diff --git a/algorithm/algorithm-api/src/main/java/com/njcn/algorithm/pojo/liteflow/fallback/LiteFlowAlgorithmFeignClientFallbackFactory.java b/algorithm/algorithm-api/src/main/java/com/njcn/algorithm/pojo/liteflow/fallback/LiteFlowAlgorithmFeignClientFallbackFactory.java index f53f78b..c7b64da 100644 --- a/algorithm/algorithm-api/src/main/java/com/njcn/algorithm/pojo/liteflow/fallback/LiteFlowAlgorithmFeignClientFallbackFactory.java +++ b/algorithm/algorithm-api/src/main/java/com/njcn/algorithm/pojo/liteflow/fallback/LiteFlowAlgorithmFeignClientFallbackFactory.java @@ -46,6 +46,12 @@ public class LiteFlowAlgorithmFeignClientFallbackFactory implements FallbackFact throw new BusinessException(finalExceptionEnum); } + @Override + public void specialAnalysisExecutor(BaseParam baseParam) { + log.error("{}异常,降级处理,异常为:{}", "新能源专项分析算法执行链: ", throwable.toString()); + throw new BusinessException(finalExceptionEnum); + } + @Override public void deviceExecutor(BaseParam baseParam) { log.error("{}异常,降级处理,异常为:{}", "装置算法执行链: ", throwable.toString()); diff --git a/algorithm/algorithm-boot/src/main/java/com/njcn/algorithm/ExecutionCenter.java b/algorithm/algorithm-boot/src/main/java/com/njcn/algorithm/ExecutionCenter.java index d7fd39a..ce82f1c 100644 --- a/algorithm/algorithm-boot/src/main/java/com/njcn/algorithm/ExecutionCenter.java +++ b/algorithm/algorithm-boot/src/main/java/com/njcn/algorithm/ExecutionCenter.java @@ -18,6 +18,7 @@ import com.njcn.common.pojo.exception.BusinessException; import com.njcn.device.biz.commApi.CommTerminalGeneralClient; import com.njcn.device.biz.pojo.dto.*; import com.njcn.device.biz.pojo.param.DeptGetLineParam; +import com.njcn.device.pq.api.DeptLineFeignClient; import com.njcn.user.api.DeptFeignClient; import com.njcn.user.pojo.po.Dept; import com.njcn.web.controller.BaseController; @@ -26,7 +27,6 @@ import com.yomahub.liteflow.flow.LiteflowResponse; import com.yomahub.liteflow.flow.entity.CmpStep; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; -import lombok.Data; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.apache.commons.collections.CollectionUtils; @@ -62,7 +62,8 @@ public class ExecutionCenter extends BaseController { private DeptFeignClient deptFeignClient; @Resource private FlowExecutor flowExecutor; - + @Resource + private DeptLineFeignClient deptLineFeignClient; /*** * 1、校验非全链执行时,tagNames节点标签集合必须为非空,否则提示---无可执行节点 @@ -125,8 +126,6 @@ public class ExecutionCenter extends BaseController { CalculatedParam calculatedParam = judgeExecuteParam(baseParam); // 测点索引 if (CollectionUtils.isEmpty(calculatedParam.getIdList())) { -// calculatedParam.setIdList(Arrays.asList("c5f4925dbe333230810fe1a6afc51dfb","293178e56cd207e6e33586090f5034be","2df0cb6a87ef523b726c0a9ff6cfd288","43a1391b503bcd7f1b9a2f8f90e53e0f" -// )); calculatedParam.setIdList(commTerminalGeneralClient.getRunMonitorIds().getData()); } LiteflowResponse liteflowResponse; @@ -151,6 +150,40 @@ public class ExecutionCenter extends BaseController { } } + @OperateInfo(info = LogEnum.BUSINESS_COMMON) + @ApiOperation("新能源专项分析算法执行链") + @PostMapping("/specialAnalysis") + @Async("asyncExecutor") + public void specialAnalysisExecutor(@RequestBody BaseParam baseParam) { + String methodDescribe = getMethodDescribe("specialAnalysisExecutor"); + //手动判断参数是否合法, + CalculatedParam calculatedParam = judgeExecuteParam(baseParam); + // 测点索引 + if (CollectionUtils.isEmpty(calculatedParam.getIdList())) { + calculatedParam.setIdList(deptLineFeignClient.getLineByDeptIdAndNewStation(null).getData()); + } + LiteflowResponse liteflowResponse; + if (baseParam.isRepair()) { + //补招时,起始日期、截止日期必填 + DateTime startDate = DateUtil.parse(baseParam.getBeginTime(), DatePattern.NORM_DATE_FORMAT); + DateTime endDate = DateUtil.parse(baseParam.getEndTime(), DatePattern.NORM_DATE_FORMAT); + long betweenDay = DateUtil.betweenDay(startDate, endDate, true); + //递增日期执行算法链 + for (int i = 0; i < betweenDay; i++) { + if (i != 0) { + startDate = DateUtil.offsetDay(startDate, 1); + } + calculatedParam.setDataDate(DateUtil.format(startDate, DatePattern.NORM_DATE_PATTERN)); + liteflowResponse = flowExecutor.execute2Resp("special_analysis", calculatedParam); + dealResponse(calculatedParam, liteflowResponse, methodDescribe); + } + } else { + //非补招 + liteflowResponse = flowExecutor.execute2Resp("special_analysis", calculatedParam); + dealResponse(calculatedParam, liteflowResponse, methodDescribe); + } + } + @OperateInfo(info = LogEnum.BUSINESS_COMMON) @ApiOperation("监测点算法执行链(按小时执行的算法)") @PostMapping("/measurementPointExecutorByHour") @@ -188,7 +221,7 @@ public class ExecutionCenter extends BaseController { } } else { //非补招 - calculatedParam.setDataDate(DateUtil.format(DateUtil.offsetHour( DateUtil.parse(baseParam.getDataDate(), DatePattern.NORM_DATETIME_FORMAT),-1), DatePattern.NORM_DATETIME_FORMATTER)); + calculatedParam.setDataDate(DateUtil.format(DateUtil.offsetHour(DateUtil.parse(baseParam.getDataDate(), DatePattern.NORM_DATETIME_FORMAT), -1), DatePattern.NORM_DATETIME_FORMATTER)); liteflowResponse = flowExecutor.execute2Resp("measurement_point_hour", calculatedParam); dealResponse(calculatedParam, liteflowResponse, methodDescribe); } @@ -272,7 +305,8 @@ public class ExecutionCenter extends BaseController { } } -// + + // // @OperateInfo(info = LogEnum.BUSINESS_COMMON) // @ApiOperation("pms国网上送单位层级算法执行链") // @PostMapping("/uploadOrgExecutor") diff --git a/algorithm/algorithm-boot/src/main/java/com/njcn/algorithm/executor/DeviceExecutor.java b/algorithm/algorithm-boot/src/main/java/com/njcn/algorithm/executor/DeviceExecutor.java index 506d420..1ee53b6 100644 --- a/algorithm/algorithm-boot/src/main/java/com/njcn/algorithm/executor/DeviceExecutor.java +++ b/algorithm/algorithm-boot/src/main/java/com/njcn/algorithm/executor/DeviceExecutor.java @@ -21,7 +21,7 @@ import javax.annotation.Resource; public class DeviceExecutor extends BaseExecutor { @Resource - private IDataOnlineRateService onlineRateService; + private IDataOnlineRateService onlineRateService; /** @@ -34,6 +34,7 @@ public class DeviceExecutor extends BaseExecutor { public boolean deviceOnlineRateAccess(NodeComponent bindCmp) { return isAccess(bindCmp); } + @LiteflowMethod(value = LiteFlowMethodEnum.PROCESS, nodeId = "deviceOnlineRate", nodeType = NodeTypeEnum.COMMON) public void deviceOnlineRateProcess(NodeComponent bindCmp) { onlineRateService.dataOnlineRate(bindCmp.getRequestData()); @@ -43,6 +44,7 @@ public class DeviceExecutor extends BaseExecutor { public boolean dataOnlineRateMonthAccess(NodeComponent bindCmp) { return isAccess(bindCmp); } + @LiteflowMethod(value = LiteFlowMethodEnum.PROCESS, nodeId = "deviceOnlineRateMonth", nodeType = NodeTypeEnum.COMMON) public void deviceOnlineRateMonthProcess(NodeComponent bindCmp) { onlineRateService.dataOnlineRateMonth(bindCmp.getRequestData()); diff --git a/algorithm/algorithm-boot/src/main/java/com/njcn/algorithm/executor/SpecialAnalysisExecutor.java b/algorithm/algorithm-boot/src/main/java/com/njcn/algorithm/executor/SpecialAnalysisExecutor.java new file mode 100644 index 0000000..a177db4 --- /dev/null +++ b/algorithm/algorithm-boot/src/main/java/com/njcn/algorithm/executor/SpecialAnalysisExecutor.java @@ -0,0 +1,58 @@ +package com.njcn.algorithm.executor; + +import com.njcn.algorithm.service.line.ISpecialAnalysisService; +import com.yomahub.liteflow.annotation.LiteflowComponent; +import com.yomahub.liteflow.annotation.LiteflowMethod; +import com.yomahub.liteflow.core.NodeComponent; +import com.yomahub.liteflow.enums.LiteFlowMethodEnum; +import com.yomahub.liteflow.enums.NodeTypeEnum; +import lombok.RequiredArgsConstructor; + +import javax.annotation.Resource; + + +/** + * @author hongawen + * @version 1.0.0 + * @date 2023年11月06日 15:59 + */ +@LiteflowComponent +@RequiredArgsConstructor +public class SpecialAnalysisExecutor extends BaseExecutor { + + @Resource + private ISpecialAnalysisService specialAnalysisService; + + + /** + * 算法名: 高低压穿越算法(sp_through) + * + * @param bindCmp + * @return + */ + @LiteflowMethod(value = LiteFlowMethodEnum.IS_ACCESS, nodeId = "spThrough", nodeType = NodeTypeEnum.COMMON) + public boolean spThroughAccess(NodeComponent bindCmp) { + return isAccess(bindCmp); + } + + @LiteflowMethod(value = LiteFlowMethodEnum.PROCESS, nodeId = "spThrough", nodeType = NodeTypeEnum.COMMON) + public void spThroughProcess(NodeComponent bindCmp) { + specialAnalysisService.dataDaySpThroughHandle(bindCmp.getRequestData()); + } + /** + * 算法名: 有功功率趋势算法(r_active_power_range) + * + * @param bindCmp + * @return + */ + + @LiteflowMethod(value = LiteFlowMethodEnum.IS_ACCESS, nodeId = "activePower", nodeType = NodeTypeEnum.COMMON) + public boolean activePowerAccess(NodeComponent bindCmp) { + return isAccess(bindCmp); + } + + @LiteflowMethod(value = LiteFlowMethodEnum.PROCESS, nodeId = "activePower", nodeType = NodeTypeEnum.COMMON) + public void activePowerProcess(NodeComponent bindCmp) { + specialAnalysisService.dataDayActivePowerHandle(bindCmp.getRequestData()); + } +} diff --git a/algorithm/algorithm-boot/src/main/java/com/njcn/algorithm/service/line/ISpecialAnalysisService.java b/algorithm/algorithm-boot/src/main/java/com/njcn/algorithm/service/line/ISpecialAnalysisService.java new file mode 100644 index 0000000..70b45e6 --- /dev/null +++ b/algorithm/algorithm-boot/src/main/java/com/njcn/algorithm/service/line/ISpecialAnalysisService.java @@ -0,0 +1,31 @@ +package com.njcn.algorithm.service.line; + + +import com.njcn.algorithm.pojo.bo.CalculatedParam; + +/** + *@Author: wr + * @Description: 高低电压穿越记录 + * @Author: wr + * @Date: 2025/4/1 15:22 + */ +public interface ISpecialAnalysisService { + + /** + * 高低电压穿越记录 + * @param calculatedParam + * @Author: wr + * @Date: 2025/4/1 15:21 + */ + void dataDaySpThroughHandle(CalculatedParam calculatedParam); + + + /** + * 有功功率趋势 + * @param calculatedParam + * @Author: wr + * @Date: 2025/4/1 18:44 + */ + void dataDayActivePowerHandle(CalculatedParam calculatedParam); + +} diff --git a/algorithm/algorithm-boot/src/main/java/com/njcn/algorithm/serviceimpl/line/SpecialAnalysisServiceImpl.java b/algorithm/algorithm-boot/src/main/java/com/njcn/algorithm/serviceimpl/line/SpecialAnalysisServiceImpl.java new file mode 100644 index 0000000..1c20fd0 --- /dev/null +++ b/algorithm/algorithm-boot/src/main/java/com/njcn/algorithm/serviceimpl/line/SpecialAnalysisServiceImpl.java @@ -0,0 +1,477 @@ +package com.njcn.algorithm.serviceimpl.line; + + +import cn.hutool.core.collection.CollUtil; +import cn.hutool.core.date.DatePattern; +import cn.hutool.core.date.LocalDateTimeUtil; +import cn.hutool.core.util.BooleanUtil; +import cn.hutool.core.util.NumberUtil; +import cn.hutool.core.util.ObjectUtil; +import cn.hutool.core.util.StrUtil; +import com.alibaba.fastjson.JSON; +import com.njcn.algorithm.pojo.bo.CalculatedParam; +import com.njcn.algorithm.service.line.ISpecialAnalysisService; +import com.njcn.dataProcess.api.DataHarmpowerPFeignClient; +import com.njcn.dataProcess.api.DataLimitRateDetailFeignClient; +import com.njcn.dataProcess.api.SpThroughFeignClient; +import com.njcn.dataProcess.param.LineCountEvaluateParam; +import com.njcn.dataProcess.pojo.dto.*; +import com.njcn.dataProcess.util.TimeUtils; +import com.njcn.device.biz.commApi.CommLineClient; +import com.njcn.device.biz.pojo.dto.LineDTO; +import com.njcn.device.pms.pojo.param.MonitorTerminalParam; +import com.njcn.device.pq.api.LineFeignClient; +import com.njcn.device.pq.pojo.vo.LineDetailDataVO; +import com.njcn.event.api.EventDetailFeignClient; +import com.njcn.event.api.TransientFeignClient; +import com.njcn.event.file.pojo.dto.WaveDataDTO; +import com.njcn.event.pojo.param.EventCountParam; +import com.njcn.event.pojo.po.RmpEventDetailPO; +import com.njcn.supervision.api.UserLedgerFeignClient; +import com.njcn.supervision.pojo.vo.user.NewUserReportVO; +import com.njcn.system.api.DicDataFeignClient; +import com.njcn.system.api.DictTreeFeignClient; +import com.njcn.system.enums.DicDataEnum; +import com.njcn.system.enums.DicTreeEnum; +import com.njcn.system.pojo.po.DictData; +import com.njcn.system.pojo.vo.DictTreeVO; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.collections4.ListUtils; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.stereotype.Service; + +import javax.annotation.Resource; +import java.io.ByteArrayInputStream; +import java.io.ObjectInputStream; +import java.lang.reflect.Field; +import java.math.BigDecimal; +import java.math.RoundingMode; +import java.time.LocalDate; +import java.time.LocalDateTime; +import java.time.format.DateTimeFormatter; +import java.util.*; +import java.util.function.Function; +import java.util.stream.Collectors; + +/** + * 高低电压穿越 服务类 + * + * @author guofeihu + * @since 2024-08-22 + */ +@Service +@Slf4j +@RequiredArgsConstructor +public class SpecialAnalysisServiceImpl implements ISpecialAnalysisService { + + @Value("${line.num}") + private Integer NUM = 100; + @Resource + private EventDetailFeignClient eventDetailFeignClient; + @Resource + private TransientFeignClient transientFeignClient; + @Resource + private LineFeignClient lineFeignClient; + @Resource + private DictTreeFeignClient dictTreeFeignClient; + @Resource + private DicDataFeignClient dicDataFeignClient; + @Resource + private SpThroughFeignClient spThroughFeignClient; + @Resource + private DataHarmpowerPFeignClient dataHarmpowerPFeignClient; + @Resource + private CommLineClient commLineClient; + @Resource + private UserLedgerFeignClient userLedgerFeignClient; + @Resource + private DataLimitRateDetailFeignClient dataLimitRateDetailFeignClient; + + @Override + public void dataDaySpThroughHandle(CalculatedParam calculatedParam) { + List info = new ArrayList<>(); + List lineList = calculatedParam.getIdList(); + if (CollUtil.isNotEmpty(lineList)) { + DictData dip = dicDataFeignClient.getDicDataByCode(DicDataEnum.VOLTAGE_DIP.getCode()).getData(); + DictData rise = dicDataFeignClient.getDicDataByCode(DicDataEnum.VOLTAGE_RISE.getCode()).getData(); + DictTreeVO windFarms = dictTreeFeignClient.queryByCode(DicTreeEnum.Wind_Farms.getCode()).getData(); + DictTreeVO powerStation = dictTreeFeignClient.queryByCode(DicTreeEnum.Power_Station.getCode()).getData(); + LocalDateTime currentTime = LocalDateTime.now(); + List> pendingIds = ListUtils.partition(lineList, NUM); + MonitorTerminalParam monitorTerminalParam = new MonitorTerminalParam(); + monitorTerminalParam.setSystemType(0); + monitorTerminalParam.setType(0); + for (List pendingId : pendingIds) { + List lineDetailDataVOS = lineFeignClient.getLineDetailList(pendingId).getData(); + if (CollUtil.isNotEmpty(lineDetailDataVOS)) { + Map lineDetailDataMap = lineDetailDataVOS.stream().collect(Collectors.toMap(LineDetailDataVO::getLineId, Function.identity())); + EventCountParam param = new EventCountParam(); + param.setIds(new ArrayList<>(lineDetailDataMap.keySet())); + param.setStartTime(TimeUtils.getBeginOfDay(calculatedParam.getDataDate())); + param.setEndTime(currentTime.format(DateTimeFormatter.ofPattern(DatePattern.NORM_DATETIME_PATTERN))); + List evenStDetailPOS = eventDetailFeignClient.getNewEventDetailByTime(param).getData(); + for (RmpEventDetailPO rmpEventDetailPO : evenStDetailPOS) { + if (lineDetailDataMap.containsKey(rmpEventDetailPO.getMeasurementPointId())) { + LineDetailDataVO line = lineDetailDataMap.get(rmpEventDetailPO.getMeasurementPointId()); + //准备高低电压穿越实体bean + SpThroughDto spThroughPO = new SpThroughDto(); + spThroughPO.setEventId(rmpEventDetailPO.getEventId()); + spThroughPO.setEventType(rmpEventDetailPO.getEventType()); + spThroughPO.setStationType(line.getBigObjType()); + //默认该事件没有穿越 + spThroughPO.setIsOrNot(0); + //设置波形查询的条件:事件ID + monitorTerminalParam.setId(rmpEventDetailPO.getEventId()); + //获取RMS波形数据(由于WaveDataDTO为复杂对象所以转成byte数组在进行反序列化) + byte[] bytes = transientFeignClient.getTransientAnalyseWaveToByteArray(monitorTerminalParam).getData(); + WaveDataDTO waveDataDTO = null; + try { + ByteArrayInputStream bis = new ByteArrayInputStream(bytes); + ObjectInputStream ois = new ObjectInputStream(bis); + //强转成WaveDataDTO + waveDataDTO = (WaveDataDTO) ois.readObject(); + } catch (Exception e) { + e.printStackTrace(); + } + //标称电压 + if (line.getScale() != null) { + BigDecimal voltageLevel = BigDecimal.valueOf(Float.parseFloat(line.getScale())) + .divide(BigDecimal.valueOf(1.732), 2, RoundingMode.HALF_UP); + //格式化数据源 + List> newListRmsData = listRmsTimeDataFormat(waveDataDTO); + //暂升事件 + if (rmpEventDetailPO.getEventType().equals(rise.getId())) { + if (BooleanUtil.or(isRiseThrough(125, 130, 500, voltageLevel, newListRmsData), + isRiseThrough(120, 125, 1000, voltageLevel, newListRmsData), + isRiseThrough(110, 120, 10000, voltageLevel, newListRmsData))) { + spThroughPO.setIsOrNot(1); + } + + } + //暂降事件 + if (rmpEventDetailPO.getEventType().equals(dip.getId())) { + //风电场 + if (line.getBigObjType().equals(windFarms.getId())) { + if (BooleanUtil.or(isDipThrough(20, 625, 1, voltageLevel, newListRmsData), + isDipThrough(20, 2000, 2, voltageLevel, newListRmsData)) + ) { + spThroughPO.setIsOrNot(1); + } + } + //光伏电站 + if (line.getBigObjType().equals(powerStation.getId())) { + if (BooleanUtil.or(isDipThrough(0, 150, 1, voltageLevel, newListRmsData), + isDipThrough(20, 625, 1, voltageLevel, newListRmsData), + isDipThrough(20, 90, null, voltageLevel, newListRmsData))) { + spThroughPO.setIsOrNot(1); + } + } + } + info.add(spThroughPO); + } + } + } + } + } + } + if (CollUtil.isNotEmpty(info)) { + spThroughFeignClient.batchInsertionThrough(info); + } + + } + + @Override + public void dataDayActivePowerHandle(CalculatedParam calculatedParam) { + List info = new ArrayList<>(); + DictTreeVO windFarms = dictTreeFeignClient.queryByCode(DicTreeEnum.Wind_Farms.getCode()).getData(); + List lineList = calculatedParam.getIdList(); + if (CollUtil.isNotEmpty(lineList)) { + List data = commLineClient.getLineDetailBatch(lineList).getData(); + List windLine = data.stream() + .filter(x -> StrUtil.isNotBlank(x.getBigObjType())) + .filter(x -> x.getBigObjType().equals(windFarms.getId())).collect(Collectors.toList()); + LineCountEvaluateParam lineParam = new LineCountEvaluateParam(); + lineParam.setStartTime(TimeUtils.getBeginOfDay(calculatedParam.getDataDate())); + lineParam.setEndTime(TimeUtils.getEndOfDay(calculatedParam.getDataDate())); + LocalDate localDate = LocalDateTimeUtil.parseDate(calculatedParam.getDataDate(), DatePattern.NORM_DATE_PATTERN); + if (CollUtil.isNotEmpty(windLine)) { + List> pendingIds = ListUtils.partition(windLine, NUM); + for (List pendingId : pendingIds) { + //获取分钟有功功率数据 + Map objIdMap = pendingId.stream().collect(Collectors.toMap(LineDTO::getLineId, LineDTO::getObjId)); + lineParam.setLineId(new ArrayList<>(objIdMap.keySet())); + List dataPowerPList = dataHarmpowerPFeignClient.getRawData(lineParam).getData(); + + Map> lineP = dataPowerPList.stream().collect(Collectors.groupingBy(DataPowerPDto::getLineId)); + //获取用户信息 + List userPower = userLedgerFeignClient.getUserReportByIds(new ArrayList<>(objIdMap.values())).getData(); + Map userPowerMap = userPower.stream().collect(Collectors.toMap(NewUserReportVO::getId, NewUserReportVO::getRatePower)); + lineP.forEach((lineId, dtoList) -> { + if (objIdMap.containsKey(lineId)) { + //根据监测点找到用户,再根据用户找到额定有功功率 + String s = objIdMap.get(lineId); + if (userPowerMap.containsKey(s)) { + RActivePowerRangeDto dto = new RActivePowerRangeDto(); + dto.setLineId(lineId); + dto.setTimeId(localDate); + Double ratePower = userPowerMap.get(s); + //默认初始10个空集合 + List[] min = new List[10]; + for (int i = 0; i < 10; i++) { + min[i] = new ArrayList<>(); + } + for (DataPowerPDto dataPowerPDto : dtoList) { + String minTime = dataPowerPDto.getMinTime().substring(11, dataPowerPDto.getMinTime().length()); + double temp = BigDecimal.valueOf(ratePower) + .divide(BigDecimal.valueOf(dataPowerPDto.getP()), 4, RoundingMode.HALF_UP).doubleValue(); + Integer i = getInteger(temp); + if (ObjectUtil.isNotNull(i)) { + min[i].add(minTime); + } + } + for (int i = 0; i < 10; i++) { + try { + Field minTime = RActivePowerRangeDto.class.getDeclaredField("minsTime" + i); + Field minNum = RActivePowerRangeDto.class.getDeclaredField("minsNum" + i); + Field isOrNot = RActivePowerRangeDto.class.getDeclaredField("isOrNot" + i); + minTime.setAccessible(true); + minNum.setAccessible(true); + isOrNot.setAccessible(true); + if (CollUtil.isEmpty(min[i])) { + minTime.set(dto, "[]"); + } else { + List mins = min[i].stream().distinct().collect(Collectors.toList()); + minTime.set(dto, JSON.toJSONString(mins)); + List limitTime = dataLimitRateDetailFeignClient.getLimitRateDetailTime(lineId, calculatedParam.getDataDate()).getData(); + if (CollUtil.isNotEmpty(limitTime)) { + List collect = mins.stream().filter(x -> limitTime.contains(x)).collect(Collectors.toList()); + if (CollUtil.isNotEmpty(collect)) { + isOrNot.set(dto, 1); + } + } + } + minNum.set(dto, min[i].size()); + } catch (Exception e) { + e.printStackTrace(); + } + } + info.add(dto); + } + } + }); + } + } + } + if (CollUtil.isNotEmpty(info)) { + spThroughFeignClient.batchInsertionPower(info); + } + + } + + /** + * @param waveDataDTO + * @Description: 格式化RMS数据:将listRmsData中的电压数据取出在根据pt变比组成新的RMS数据 + * @return: java.util.List> + * @Author: wr + * @Date: 2025/3/26 19:49 + */ + private List> listRmsTimeDataFormat(WaveDataDTO waveDataDTO) { + //重新便利数据信息 + List> info = new ArrayList<>(); + List a = new ArrayList<>(); + List b = new ArrayList<>(); + List c = new ArrayList<>(); + List indexs = new ArrayList<>(); + //根据channelNames取出电压对应listRmsData数据中的数据索引 + for (int i = 0; i < waveDataDTO.getChannelNames().size(); i++) { + if (waveDataDTO.getChannelNames().get(i).indexOf("U") != -1) { + indexs.add(i); + } + } + //前端展示的波形图数据来源就是这个所以这边也跟前端保持一致 + for (int i = 0; i < waveDataDTO.getListRmsData().size(); i++) { + List cur = waveDataDTO.getListRmsData().get(i); + //数组第一个为时间 + Float time = cur.get(0); + if (time >= 0) { + //便利电压数据的索引 + for (Integer index : indexs) { + //根据PT变比算出新的数据(前端取的一次值,也是根据pt变比算出的,所以这边和前端保持一致)新增到新的数组中 + if (1 == index) { + a.add(time + "_" + cur.get(index)); + } + if (2 == index) { + b.add(time + "_" + cur.get(index)); + } + if (3 == index) { + c.add(time + "_" + cur.get(index)); + } + } + } + + } + info.add(a); + info.add(b); + info.add(c); + return info; + } + + /** + * 暂降 + * 风电场 + * a)风电场并网点电压跌至标称电压的20%时,风电场内的风电机组应保证不脱网连续运行625 ms。 + * b)风电场并网点电压在发生跌落后2s内能够恢复到标称电压的90%时,风电场内的风电机组应保证不脱网连续运行。 + * 光伏电站 + * a)光伏发电站并网点电压跌至0时,光伏发电站内的光伏逆变器和无功补偿装置应能够不脱网连续运行150 ms; + * b)光伏发电站并网点电压跌至标称电压的20%时,光伏发电站内的光伏逆变器和无功补偿装置n)应能够不脱网连续运行625ms; + * c)光伏发电站并网点电压跌至标称电压的20%以上至90%时,光伏发电站内的光伏逆变器和无功补偿装置应能在阴影区域内不脱网连续运行 + * + * @return + */ + private boolean isDipThrough(int start, int ms, Integer option, BigDecimal voltageLevel, List> newListRmsData) { + if (ObjectUtil.isNotNull(option)) { + for (List newListRmsDatum : newListRmsData) { + List temp = new ArrayList<>(); + Double anchorPoint = -1.0; + for (String num : newListRmsDatum) { + String[] split = num.split("_"); + Double time = Double.valueOf(split[0]); + Double v = Double.valueOf(split[1]); + //获得数据占比 (56.62/(220/1.732))*100 + BigDecimal curValue = BigDecimal.valueOf(v).multiply(BigDecimal.valueOf(100)) + .divide(voltageLevel, 2, RoundingMode.HALF_UP); + if (1 == option) { + //方案一:判断是否有跌落到20%的情况 + if (start == curValue.doubleValue()) { + temp.add(num); + } else { + if (CollUtil.isNotEmpty(temp)) { + Integer startRms = Integer.valueOf(temp.get(0).split("_")[0]); + Integer endRms = Integer.valueOf(temp.get(temp.size()).split("_")[0]); + if (endRms - startRms > ms) { + return true; + } + temp = new ArrayList<>(); + } + } + } + if (2 == option) { + //方案二:判断是否有跌落到90%的情况 + if (voltageLevel.doubleValue() > v && anchorPoint != -1.0) { + anchorPoint = time + ms; + } else if (anchorPoint.equals(time)) { + if (v < voltageLevel.doubleValue() * 0.9) { + return true; + } + anchorPoint = -1.0; + } + } + if (3 == option) { + //方案三:20%以上至90%时,需要判断上升信息 + +// if (voltageLevel > v && anchorPoint != -1.0) { +// anchorPoint = time + ms; +// } else if (anchorPoint.equals(time)) { +// if (v < voltageLevel*0.9) { +// return true; +// } +// anchorPoint = -1.0; +// } + } + } + } + } + return false; + } + + + /** + * 暂升 + * 风电场 + * a)风电场并网点电压升高至标称电压的 125%~130%之间时,风电场内的风电机组应保证不脱网连续运行 500 ms; + * b)风电场并网点电压升高至标称电压的 120%~125%之间时,风电场内的风电机组应保证不脱网连续运行1s; + * c)风电场并网点电压升高至标称电压的 110%~120%之间时,风电场内的风电机组应保证不脱网连续运行 10 s。 + * 光伏电站 + * a)光伏发电站并网点电压升高至标称电压的125%以上至130%时,光伏发电站内的光伏逆变器和无功补偿装置应能够不脱网连续运行500ms; + * b)光伏发电站并网点电压升高至标称电压的120%以上至125%时,光伏发电站内的光伏逆变器和无功补偿装置应能够不脱网连续运行1s; + * c)光伏发电站并网点电压升高至标称电压的110%以上至120%时,光伏发电站内的光伏逆变器和其他无功补偿装置应能够不脱网连续运行10s。 + * + * @Author: wr + * @Date: 2025/4/3 11:10 + */ + + private boolean isRiseThrough(int start, int end, int ms, BigDecimal voltageLevel, List> newListRmsData) { + //分别有abc三相电压值 [0]是毫秒 [1]A相值 [2]B相值 [3]C相值 + for (List newListRmsDatum : newListRmsData) { + List temp = new ArrayList<>(); + for (String num : newListRmsDatum) { + String[] split = num.split("_"); + Double v = Double.valueOf(split[1]); + //获得数据占比 (56.62/(220/1.732))*100 + BigDecimal curValue = BigDecimal.valueOf(v).multiply(BigDecimal.valueOf(100)) + .divide(voltageLevel + .divide(BigDecimal.valueOf(1.732), 2, RoundingMode.HALF_UP), 2, RoundingMode.HALF_UP); + if (NumberUtil.isIn(curValue, BigDecimal.valueOf(start), BigDecimal.valueOf(end))) { + temp.add(num); + } else { + if (CollUtil.isNotEmpty(temp)) { + int maxIndex = getMaxIndex(temp); + Integer startRms = Integer.valueOf(temp.get(maxIndex).split("_")[0]); + Integer endRms = Integer.valueOf(temp.get(temp.size()).split("_")[0]); + if (endRms - startRms > ms) { + return true; + } + temp = new ArrayList<>(); + } + } + } + } + return false; + } + + private int getMaxIndex(List temp) { + double maxValue = Double.MIN_VALUE; + int maxIndex = -1; + for (int i = 0; i < temp.size(); i++) { + String[] parts = temp.get(i).split("_"); + if (parts.length != 2) { + continue; // 跳过格式错误的元素 + } + double value = Double.parseDouble(parts[1]); + if (value > maxValue) { + maxValue = value; + maxIndex = i; + } + } + return maxIndex; + } + + + private Integer getInteger(double temp) { + Integer i = null; + if (temp <= 0.1) { + i = 0; + } else if (0.1 < temp && temp <= 0.2) { + i = 1; + } else if (0.2 < temp && temp <= 0.3) { + i = 2; + } else if (0.3 < temp && temp <= 0.4) { + i = 3; + } else if (0.4 < temp && temp <= 0.5) { + i = 4; + } else if (0.5 < temp && temp <= 0.6) { + i = 5; + } else if (0.6 < temp && temp <= 0.7) { + i = 6; + } else if (0.7 < temp && temp <= 0.8) { + i = 7; + } else if (0.8 < temp && temp <= 0.9) { + i = 8; + } else if (temp > 0.9) { + i = 9; + } + return i; + } + +} diff --git a/data-processing/data-processing-api/src/main/java/com/njcn/dataProcess/api/DataLimitRateDetailFeignClient.java b/data-processing/data-processing-api/src/main/java/com/njcn/dataProcess/api/DataLimitRateDetailFeignClient.java index 2c6c124..110744b 100644 --- a/data-processing/data-processing-api/src/main/java/com/njcn/dataProcess/api/DataLimitRateDetailFeignClient.java +++ b/data-processing/data-processing-api/src/main/java/com/njcn/dataProcess/api/DataLimitRateDetailFeignClient.java @@ -1,14 +1,18 @@ package com.njcn.dataProcess.api; +import com.njcn.common.pojo.annotation.OperateInfo; import com.njcn.common.pojo.constant.ServerInfo; +import com.njcn.common.pojo.enums.common.LogEnum; import com.njcn.common.pojo.response.HttpResult; import com.njcn.dataProcess.api.fallback.DataLimitRateDetailFeignClientFallbackFactory; import com.njcn.dataProcess.param.LineCountEvaluateParam; import com.njcn.dataProcess.pojo.dto.DataLimitRateDetailDto; import com.njcn.dataProcess.pojo.dto.DataLimitRateDto; +import io.swagger.annotations.ApiOperation; import org.springframework.cloud.openfeign.FeignClient; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestParam; import java.util.List; @@ -17,7 +21,7 @@ import java.util.List; * @Author: wr * @Date: 2025/3/7 9:30 */ -@FeignClient(value = ServerInfo.PLATFORM_DATA_PROCESSING_BOOT, path = "/dataLimitRateDetail", fallbackFactory = DataLimitRateDetailFeignClientFallbackFactory.class, contextId = "dataLimitRateDetail") +@FeignClient(value = ServerInfo.PLATFORM_DATA_PROCESSING_BOOT, path = "/dataLimitRateDetail", fallbackFactory = DataLimitRateDetailFeignClientFallbackFactory.class, contextId = "dataLimitRateDetail") public interface DataLimitRateDetailFeignClient { @PostMapping("/batchInsertion") @@ -26,4 +30,6 @@ public interface DataLimitRateDetailFeignClient { @PostMapping("/getRawData") HttpResult> getRawData(@RequestBody LineCountEvaluateParam lineParam); + @PostMapping("/getLimitRateDetailTime") + HttpResult> getLimitRateDetailTime(@RequestParam("id") String id, @RequestParam("time") String time); } diff --git a/data-processing/data-processing-api/src/main/java/com/njcn/dataProcess/api/SpThroughFeignClient.java b/data-processing/data-processing-api/src/main/java/com/njcn/dataProcess/api/SpThroughFeignClient.java new file mode 100644 index 0000000..d438d19 --- /dev/null +++ b/data-processing/data-processing-api/src/main/java/com/njcn/dataProcess/api/SpThroughFeignClient.java @@ -0,0 +1,30 @@ +package com.njcn.dataProcess.api; + +import com.njcn.common.pojo.constant.ServerInfo; +import com.njcn.common.pojo.response.HttpResult; +import com.njcn.dataProcess.api.fallback.RmpEventFeignClientFallbackFactory; +import com.njcn.dataProcess.api.fallback.SpThroughFeignClientFallbackFactory; +import com.njcn.dataProcess.dto.RmpEventDetailDTO; +import com.njcn.dataProcess.param.LineCountEvaluateParam; +import com.njcn.dataProcess.pojo.dto.RActivePowerRangeDto; +import com.njcn.dataProcess.pojo.dto.SpThroughDto; +import org.springframework.cloud.openfeign.FeignClient; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; + +import java.util.List; + +/** + * @author denghuajun + * @version 1.0.0 + * @date 2022年01月05日 15:11 + */ +@FeignClient(value = ServerInfo.PLATFORM_DATA_PROCESSING_BOOT, path = "/specialAnalysis", fallbackFactory = SpThroughFeignClientFallbackFactory.class, contextId = "specialAnalysis") +public interface SpThroughFeignClient { + + @PostMapping("/batchInsertionThrough") + HttpResult batchInsertionThrough(@RequestBody List dtoList); + + @PostMapping("/batchInsertionPower") + HttpResult batchInsertionPower(@RequestBody List dtoList); +} diff --git a/data-processing/data-processing-api/src/main/java/com/njcn/dataProcess/api/fallback/DataLimitRateDetailFeignClientFallbackFactory.java b/data-processing/data-processing-api/src/main/java/com/njcn/dataProcess/api/fallback/DataLimitRateDetailFeignClientFallbackFactory.java index 895567e..abdb0c5 100644 --- a/data-processing/data-processing-api/src/main/java/com/njcn/dataProcess/api/fallback/DataLimitRateDetailFeignClientFallbackFactory.java +++ b/data-processing/data-processing-api/src/main/java/com/njcn/dataProcess/api/fallback/DataLimitRateDetailFeignClientFallbackFactory.java @@ -50,6 +50,12 @@ public class DataLimitRateDetailFeignClientFallbackFactory implements FallbackFa log.error("{}异常,降级处理,异常为:{}","获取基础数据",cause.toString()); throw new BusinessException(finalExceptionEnum); } + + @Override + public HttpResult> getLimitRateDetailTime(String id, String time) { + log.error("{}异常,降级处理,异常为:{}","根据监测点id获取所有超标时间",cause.toString()); + throw new BusinessException(finalExceptionEnum); + } }; } } diff --git a/data-processing/data-processing-api/src/main/java/com/njcn/dataProcess/api/fallback/SpThroughFeignClientFallbackFactory.java b/data-processing/data-processing-api/src/main/java/com/njcn/dataProcess/api/fallback/SpThroughFeignClientFallbackFactory.java new file mode 100644 index 0000000..3025e2b --- /dev/null +++ b/data-processing/data-processing-api/src/main/java/com/njcn/dataProcess/api/fallback/SpThroughFeignClientFallbackFactory.java @@ -0,0 +1,60 @@ +package com.njcn.dataProcess.api.fallback; + +import com.njcn.common.pojo.enums.response.CommonResponseEnum; +import com.njcn.common.pojo.exception.BusinessException; +import com.njcn.common.pojo.response.HttpResult; +import com.njcn.dataProcess.api.RmpEventDetailFeignClient; +import com.njcn.dataProcess.api.SpThroughFeignClient; +import com.njcn.dataProcess.dto.RmpEventDetailDTO; +import com.njcn.dataProcess.param.LineCountEvaluateParam; +import com.njcn.dataProcess.pojo.dto.RActivePowerRangeDto; +import com.njcn.dataProcess.pojo.dto.SpThroughDto; +import com.njcn.dataProcess.util.DataProcessingEnumUtil; +import feign.hystrix.FallbackFactory; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Component; + +import java.util.List; + +/** + * @author denghuajun + * @version 1.0.0 + * @date 2022年01月05日 15:08 + */ +@Slf4j +@Component +public class SpThroughFeignClientFallbackFactory implements FallbackFactory { + + + /** + * 输出远程请求接口异常日志 + * @param cause RPC请求异常 + */ + @Override + public SpThroughFeignClient create(Throwable cause) { + //判断抛出异常是否为解码器抛出的业务异常 + Enum exceptionEnum = CommonResponseEnum.SERVICE_FALLBACK; + if(cause.getCause() instanceof BusinessException){ + BusinessException businessException = (BusinessException) cause.getCause(); + exceptionEnum = DataProcessingEnumUtil.getExceptionEnum(businessException.getResult()); + } + Enum finalExceptionEnum = exceptionEnum; + return new SpThroughFeignClient() { + + @Override + public HttpResult batchInsertionThrough(List dtoList) { + log.error("{}异常,降级处理,异常为:{}","高低电压穿越批量插入",cause.toString()); + throw new BusinessException(finalExceptionEnum); + } + + @Override + public HttpResult batchInsertionPower(List dtoList) { + log.error("{}异常,降级处理,异常为:{}","有功功率批量插入",cause.toString()); + throw new BusinessException(finalExceptionEnum); + } + + + + }; + } +} diff --git a/data-processing/data-processing-api/src/main/java/com/njcn/dataProcess/pojo/dto/DataQualifiedDetail.java b/data-processing/data-processing-api/src/main/java/com/njcn/dataProcess/pojo/dto/DataQualifiedDetail.java index e9d066b..880e06f 100644 --- a/data-processing/data-processing-api/src/main/java/com/njcn/dataProcess/pojo/dto/DataQualifiedDetail.java +++ b/data-processing/data-processing-api/src/main/java/com/njcn/dataProcess/pojo/dto/DataQualifiedDetail.java @@ -16,7 +16,6 @@ public class DataQualifiedDetail { */ private String lineId; - /** * 合格率时间 */ diff --git a/data-processing/data-processing-api/src/main/java/com/njcn/dataProcess/pojo/dto/RActivePowerRangeDto.java b/data-processing/data-processing-api/src/main/java/com/njcn/dataProcess/pojo/dto/RActivePowerRangeDto.java new file mode 100644 index 0000000..1b1216a --- /dev/null +++ b/data-processing/data-processing-api/src/main/java/com/njcn/dataProcess/pojo/dto/RActivePowerRangeDto.java @@ -0,0 +1,180 @@ +package com.njcn.dataProcess.pojo.dto; + +import lombok.Data; + +import java.time.LocalDate; + +/** + * 有功功率趋势 + * @Author: wr + * @Date: 2025/4/1 19:33 + */ +@Data +public class RActivePowerRangeDto { + + /** + * 监测点ID + */ + private String lineId; + + /** + * 日期(天) + */ + private LocalDate timeId; + + /** + * 0%~10%区间时间Json + */ + private String minsTime0; + + /** + * 0%~10%区间个数 + */ + private Integer minsNum0 = 0; + + /** + * 0%~10%区间是否越限 + */ + private Integer isOrNot0 = 0; + + /** + * 10%~20%区间时间Json + */ + private String minsTime1; + + /** + * 10%~20%区间个数 + */ + private Integer minsNum1 = 0; + + /** + * 10%~20%区间是否越限 + */ + private Integer isOrNot1 = 0; + + /** + * 20%~30%区间时间Json + */ + private String minsTime2; + + /** + * 20%~30%区间个数 + */ + private Integer minsNum2 = 0; + + /** + * 20%~30%区间是否越限 + */ + private Integer isOrNot2 = 0; + + /** + * 30%~40%区间时间Json + */ + private String minsTime3; + + /** + * 30%~40%区间个数 + */ + private Integer minsNum3 = 0; + + /** + * 30%~40%区间是否越限 + */ + private Integer isOrNot3 = 0; + + /** + * 40%~50%区间时间Json + */ + private String minsTime4; + + /** + * 40%~50%区间个数 + */ + private Integer minsNum4 = 0; + + /** + * 40%~50%区间是否越限 + */ + private Integer isOrNot4 = 0; + + /** + * 50%~60%区间时间Json + */ + private String minsTime5; + + /** + * 50%~60%区间个数 + */ + private Integer minsNum5 = 0; + + /** + * 50%~60%区间是否越限 + */ + private Integer isOrNot5 = 0; + + /** + * 60%~70%区间时间Json + */ + private String minsTime6; + + /** + * 60%~70%区间个数 + */ + private Integer minsNum6 = 0; + + /** + * 60%~70%区间是否越限 + */ + private Integer isOrNot6 = 0; + + /** + * 70%~80%区间时间Json + */ + private String minsTime7; + + /** + * 70%~80%区间个数 + */ + private Integer minsNum7 = 0; + + /** + * 70%~80%区间是否越限 + */ + private Integer isOrNot7 = 0; + + /** + * 80%~90%区间时间Json + */ + private String minsTime8; + + /** + * 80%~90%区间个数 + */ + private Integer minsNum8 = 0; + + /** + * 80%~90%区间是否越限 + */ + private Integer isOrNot8 = 0; + + /** + * 90%~100%区间时间Json + */ + private String minsTime9; + + /** + * 90%~100%区间个数 + */ + private Integer minsNum9 = 0; + + /** + * 90%~100%区间是否越限 + */ + private Integer isOrNot9 = 0; + + /** + * 状态:0-删除 1-正常 + */ + private Integer state; + +} diff --git a/data-processing/data-processing-api/src/main/java/com/njcn/dataProcess/pojo/dto/SpThroughDto.java b/data-processing/data-processing-api/src/main/java/com/njcn/dataProcess/pojo/dto/SpThroughDto.java new file mode 100644 index 0000000..0b1f5d3 --- /dev/null +++ b/data-processing/data-processing-api/src/main/java/com/njcn/dataProcess/pojo/dto/SpThroughDto.java @@ -0,0 +1,33 @@ +package com.njcn.dataProcess.pojo.dto; + +import lombok.Data; + +/** + * @Description: 高低电压穿越 实体类 + * @Author: wr + * @Date: 2025/4/1 15:55 + */ +@Data +public class SpThroughDto { + + /** + * 暂降事件ID + */ + private String eventId; + + /** + * 暂降类型(暂升、暂降) + */ + private String eventType; + + /** + * (关联Dic_tree表)变电站类型(风电场、光伏电站) + */ + private String stationType; + + /** + * 是否穿越 + */ + private Integer isOrNot; + +} diff --git a/data-processing/data-processing-api/src/main/java/com/njcn/dataProcess/pojo/po/RActivePowerRange.java b/data-processing/data-processing-api/src/main/java/com/njcn/dataProcess/pojo/po/RActivePowerRange.java new file mode 100644 index 0000000..c65ed12 --- /dev/null +++ b/data-processing/data-processing-api/src/main/java/com/njcn/dataProcess/pojo/po/RActivePowerRange.java @@ -0,0 +1,225 @@ +package com.njcn.dataProcess.pojo.po; + +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableName; +import com.github.jeffreyning.mybatisplus.anno.MppMultiId; +import com.njcn.db.bo.BaseEntity; +import lombok.Data; + +import java.time.LocalDate; + +/** + * 有功功率趋势 + * @Author: wr + * @Date: 2025/4/1 19:33 + */ +@Data +@TableName("r_active_power_range") +public class RActivePowerRange extends BaseEntity { + + private static final long serialVersionUID = 1L; + + /** + * 日期(天) + */ + @MppMultiId + @TableField(value = "time_id") + private LocalDate timeId; + + + /** + * 监测点ID + */ + @MppMultiId + @TableField(value = "line_id") + private String lineId; + + + + /** + * 0%~10%区间时间Json + */ + @TableField(value = "mins_time0") + private String minsTime0; + + /** + * 0%~10%区间个数 + */ + @TableField(value = "mins_num0") + private Integer minsNum0 = 0; + + /** + * 0%~10%区间是否越限 + */ + @TableField(value = "is_or_not0") + private Integer isOrNot0 = 0; + + /** + * 10%~20%区间时间Json + */ + @TableField(value = "mins_time1") + private String minsTime1; + + /** + * 10%~20%区间个数 + */ + @TableField(value = "mins_num1") + private Integer minsNum1 = 0;; + + /** + * 10%~20%区间是否越限 + */ + @TableField(value = "is_or_not1") + private Integer isOrNot1 = 0; + + /** + * 20%~30%区间时间Json + */ + @TableField(value = "mins_time2") + private String minsTime2; + + /** + * 20%~30%区间个数 + */ + @TableField(value = "mins_num2") + private Integer minsNum2 = 0;; + + /** + * 20%~30%区间是否越限 + */ + @TableField(value = "is_or_not2") + private Integer isOrNot2 = 0; + + /** + * 30%~40%区间时间Json + */ + @TableField(value = "mins_time3") + private String minsTime3; + + /** + * 30%~40%区间个数 + */ + @TableField(value = "mins_num3") + private Integer minsNum3 = 0;; + + /** + * 30%~40%区间是否越限 + */ + @TableField(value = "is_or_not3") + private Integer isOrNot3 = 0; + + /** + * 40%~50%区间时间Json + */ + @TableField(value = "mins_time4") + private String minsTime4; + + /** + * 40%~50%区间个数 + */ + @TableField(value = "mins_num4") + private Integer minsNum4 = 0;; + + /** + * 40%~50%区间是否越限 + */ + @TableField(value = "is_or_not4") + private Integer isOrNot4 = 0; + + /** + * 50%~60%区间时间Json + */ + @TableField(value = "mins_time5") + private String minsTime5; + + /** + * 50%~60%区间个数 + */ + @TableField(value = "mins_num5") + private Integer minsNum5 = 0;; + + /** + * 50%~60%区间是否越限 + */ + @TableField(value = "is_or_not5") + private Integer isOrNot5 = 0; + + /** + * 60%~70%区间时间Json + */ + @TableField(value = "mins_time6") + private String minsTime6; + + /** + * 60%~70%区间个数 + */ + @TableField(value = "mins_num6") + private Integer minsNum6 = 0;; + + /** + * 60%~70%区间是否越限 + */ + @TableField(value = "is_or_not6") + private Integer isOrNot6 = 0; + + /** + * 70%~80%区间时间Json + */ + @TableField(value = "mins_time7") + private String minsTime7; + + /** + * 70%~80%区间个数 + */ + @TableField(value = "mins_num7") + private Integer minsNum7 = 0;; + + /** + * 70%~80%区间是否越限 + */ + @TableField(value = "is_or_not7") + private Integer isOrNot7 = 0; + + /** + * 80%~90%区间时间Json + */ + @TableField(value = "mins_time8") + private String minsTime8; + + /** + * 80%~90%区间个数 + */ + @TableField(value = "mins_num8") + private Integer minsNum8 = 0;; + + /** + * 80%~90%区间是否越限 + */ + @TableField(value = "is_or_not8") + private Integer isOrNot8 = 0; + + /** + * 90%~100%区间时间Json + */ + @TableField(value = "mins_time9") + private String minsTime9; + + /** + * 90%~100%区间个数 + */ + @TableField(value = "mins_num9") + private Integer minsNum9 = 0;; + + /** + * 90%~100%区间是否越限 + */ + @TableField(value = "is_or_not9") + private Integer isOrNot9 = 0; + + /** + * 状态:0-删除 1-正常 + */ + @TableField(value = "state") + private Integer state; + +} diff --git a/data-processing/data-processing-api/src/main/java/com/njcn/dataProcess/pojo/po/SpThrough.java b/data-processing/data-processing-api/src/main/java/com/njcn/dataProcess/pojo/po/SpThrough.java new file mode 100644 index 0000000..100a4d8 --- /dev/null +++ b/data-processing/data-processing-api/src/main/java/com/njcn/dataProcess/pojo/po/SpThrough.java @@ -0,0 +1,55 @@ +package com.njcn.dataProcess.pojo.po; + +import com.baomidou.mybatisplus.annotation.TableName; +import com.njcn.db.bo.BaseEntity; +import lombok.Data; + +import java.time.LocalDateTime; + +/** + * @Description: 高低电压穿越 实体类 + * @Author: wr + * @Date: 2025/4/1 15:55 + */ +@Data +@TableName("sp_through") +public class SpThrough extends BaseEntity { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + private String id; + + /** + * 暂降事件ID + */ + private String eventId; + + /** + * 暂降类型(暂升、暂降) + */ + private String eventType; + + /** + * (关联PQS_Dictionary表)变电站类型(风电场、光伏电站) + */ + private String stationType; + + /** + * 是否穿越 + */ + private Integer isOrNot; + + /** + * 状态:0-删除 1-正常 + */ + private Boolean state; + + /** + * 创建时间(自定义) + */ + private LocalDateTime createTime; + +} diff --git a/data-processing/data-processing-boot/src/main/java/com/njcn/dataProcess/controller/DataLimitRateDetailController.java b/data-processing/data-processing-boot/src/main/java/com/njcn/dataProcess/controller/DataLimitRateDetailController.java index 8d9e845..2328d75 100644 --- a/data-processing/data-processing-boot/src/main/java/com/njcn/dataProcess/controller/DataLimitRateDetailController.java +++ b/data-processing/data-processing-boot/src/main/java/com/njcn/dataProcess/controller/DataLimitRateDetailController.java @@ -18,10 +18,7 @@ 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 org.springframework.web.bind.annotation.*; import java.util.List; @@ -54,7 +51,14 @@ public class DataLimitRateDetailController extends BaseController { return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe); } - + @OperateInfo(info = LogEnum.BUSINESS_COMMON) + @PostMapping("/getLimitRateDetailTime") + @ApiOperation("根据监测点id获取所有超标时间") + public HttpResult< List> getLimitRateDetailTime(@RequestParam("id") String id, @RequestParam("time") String time) { + String methodDescribe = getMethodDescribe("getLimitRateDetailTime"); + List limitRateDetailTime = limitRateDetailInsert.getLimitRateDetailTime(id, time); + return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, limitRateDetailTime, methodDescribe); + } @OperateInfo(info = LogEnum.BUSINESS_COMMON) @PostMapping("/getRawData") @ApiOperation("获取原始数据") diff --git a/data-processing/data-processing-boot/src/main/java/com/njcn/dataProcess/controller/RActivePowerRangeController.java b/data-processing/data-processing-boot/src/main/java/com/njcn/dataProcess/controller/RActivePowerRangeController.java new file mode 100644 index 0000000..898a9fb --- /dev/null +++ b/data-processing/data-processing-boot/src/main/java/com/njcn/dataProcess/controller/RActivePowerRangeController.java @@ -0,0 +1,52 @@ +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.annotation.InsertBean; +import com.njcn.dataProcess.pojo.dto.RActivePowerRangeDto; +import com.njcn.dataProcess.pojo.dto.SpThroughDto; +import com.njcn.dataProcess.service.IRActivePowerRangeService; +import com.njcn.dataProcess.service.ISpThroughService; +import com.njcn.web.controller.BaseController; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Controller; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import java.util.List; + +/** + * @author hongawen + * @version 1.0 + * @data 2024/11/6 19:48 + */ +@Validated +@Slf4j +@Controller +@RestController +@RequestMapping("/specialAnalysis") +@Api(tags = "有功功率数据获取") +public class RActivePowerRangeController extends BaseController { + + @InsertBean + private IRActivePowerRangeService irActivePowerRangeService; + + @OperateInfo(info = LogEnum.BUSINESS_COMMON,operateType = OperateType.ADD) + @PostMapping("/batchInsertionPower") + @ApiOperation("有功功率批量插入") + public HttpResult batchInsertionPower(@RequestBody List dtoList) { + String methodDescribe = getMethodDescribe("batchInsertionPower"); + irActivePowerRangeService.batchInsertion(dtoList); + return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe); + } + +} diff --git a/data-processing/data-processing-boot/src/main/java/com/njcn/dataProcess/controller/SpThroughController.java b/data-processing/data-processing-boot/src/main/java/com/njcn/dataProcess/controller/SpThroughController.java new file mode 100644 index 0000000..424d52b --- /dev/null +++ b/data-processing/data-processing-boot/src/main/java/com/njcn/dataProcess/controller/SpThroughController.java @@ -0,0 +1,47 @@ +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.annotation.InsertBean; +import com.njcn.dataProcess.pojo.dto.SpThroughDto; +import com.njcn.dataProcess.service.ISpThroughService; +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 java.util.List; + +/** + * @author hongawen + * @version 1.0 + * @data 2024/11/6 19:48 + */ +@Validated +@Slf4j +@Controller +@RestController +@RequestMapping("/specialAnalysis") +@Api(tags = "高低电压穿越数据获取") +public class SpThroughController extends BaseController { + + @InsertBean + private ISpThroughService spThroughService; + + @OperateInfo(info = LogEnum.BUSINESS_COMMON,operateType = OperateType.ADD) + @PostMapping("/batchInsertionThrough") + @ApiOperation("高低电压穿越批量插入") + public HttpResult batchInsertionThrough(@RequestBody List dtoList) { + String methodDescribe = getMethodDescribe("batchInsertionThrough"); + spThroughService.batchInsertion(dtoList); + return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe); + } + +} diff --git a/data-processing/data-processing-boot/src/main/java/com/njcn/dataProcess/dao/relation/mapper/RActivePowerRangeMapper.java b/data-processing/data-processing-boot/src/main/java/com/njcn/dataProcess/dao/relation/mapper/RActivePowerRangeMapper.java new file mode 100644 index 0000000..3fa465f --- /dev/null +++ b/data-processing/data-processing-boot/src/main/java/com/njcn/dataProcess/dao/relation/mapper/RActivePowerRangeMapper.java @@ -0,0 +1,13 @@ +package com.njcn.dataProcess.dao.relation.mapper; + +import com.github.jeffreyning.mybatisplus.base.MppBaseMapper; +import com.njcn.dataProcess.pojo.po.RActivePowerRange; + +/** + * 有功功率趋势 Mapper 接口 + * @author guofeihu + * @since 2024-08-20 + */ +public interface RActivePowerRangeMapper extends MppBaseMapper { + +} diff --git a/data-processing/data-processing-boot/src/main/java/com/njcn/dataProcess/dao/relation/mapper/SpThroughMapper.java b/data-processing/data-processing-boot/src/main/java/com/njcn/dataProcess/dao/relation/mapper/SpThroughMapper.java new file mode 100644 index 0000000..d71b24c --- /dev/null +++ b/data-processing/data-processing-boot/src/main/java/com/njcn/dataProcess/dao/relation/mapper/SpThroughMapper.java @@ -0,0 +1,14 @@ +package com.njcn.dataProcess.dao.relation.mapper; + + +import com.github.jeffreyning.mybatisplus.base.MppBaseMapper; +import com.njcn.dataProcess.pojo.po.SpThrough; + +/** + * @Description: 高低电压穿越 + * @Author: wr + * @Date: 2025/4/1 16:03 + */ +public interface SpThroughMapper extends MppBaseMapper { + +} diff --git a/data-processing/data-processing-boot/src/main/java/com/njcn/dataProcess/service/IDataLimitRateDetail.java b/data-processing/data-processing-boot/src/main/java/com/njcn/dataProcess/service/IDataLimitRateDetail.java index 830a0f4..3c7b3b9 100644 --- a/data-processing/data-processing-boot/src/main/java/com/njcn/dataProcess/service/IDataLimitRateDetail.java +++ b/data-processing/data-processing-boot/src/main/java/com/njcn/dataProcess/service/IDataLimitRateDetail.java @@ -15,6 +15,15 @@ import java.util.List; */ public interface IDataLimitRateDetail extends IMppService { + /** + * 根据监测点id获取所有超标时间 + * @param id + * @return: java.util.List + * @Author: wr + * @Date: 2025/4/2 10:49 + */ + List getLimitRateDetailTime(String id,String time); + /** * 批量插入数据 * @param limitRateDetailList diff --git a/data-processing/data-processing-boot/src/main/java/com/njcn/dataProcess/service/IRActivePowerRangeService.java b/data-processing/data-processing-boot/src/main/java/com/njcn/dataProcess/service/IRActivePowerRangeService.java new file mode 100644 index 0000000..b93aaf8 --- /dev/null +++ b/data-processing/data-processing-boot/src/main/java/com/njcn/dataProcess/service/IRActivePowerRangeService.java @@ -0,0 +1,24 @@ +package com.njcn.dataProcess.service; + +import com.github.jeffreyning.mybatisplus.service.IMppService; +import com.njcn.dataProcess.pojo.dto.RActivePowerRangeDto; +import com.njcn.dataProcess.pojo.po.RActivePowerRange; + +import java.util.List; + +/** + * 有功功率趋势 服务类 + * @author guofeihu + * @since 2024-08-22 + */ +public interface IRActivePowerRangeService extends IMppService { + + + /** + * 批量插入数据 + * @param dtoList + * @Author: wr + * @Date: 2025/3/14 14:03 + */ + void batchInsertion(List dtoList); +} diff --git a/data-processing/data-processing-boot/src/main/java/com/njcn/dataProcess/service/ISpThroughService.java b/data-processing/data-processing-boot/src/main/java/com/njcn/dataProcess/service/ISpThroughService.java new file mode 100644 index 0000000..d46ebf4 --- /dev/null +++ b/data-processing/data-processing-boot/src/main/java/com/njcn/dataProcess/service/ISpThroughService.java @@ -0,0 +1,25 @@ +package com.njcn.dataProcess.service; + +import com.github.jeffreyning.mybatisplus.service.IMppService; +import com.njcn.dataProcess.pojo.dto.SpThroughDto; +import com.njcn.dataProcess.pojo.po.SpThrough; + +import java.util.List; + + +/** + * @Description: 高低电压穿越 + * @Author: wr + * @Date: 2025/4/1 16:09 + */ +public interface ISpThroughService extends IMppService { + + /** + * 批量插入数据 + * @param dtoList + * @Author: wr + * @Date: 2025/3/14 14:03 + */ + void batchInsertion(List dtoList); + +} diff --git a/data-processing/data-processing-boot/src/main/java/com/njcn/dataProcess/service/impl/influxdb/InfluxdbDataLimitRateDetailImpl.java b/data-processing/data-processing-boot/src/main/java/com/njcn/dataProcess/service/impl/influxdb/InfluxdbDataLimitRateDetailImpl.java index 32cd24c..2e97533 100644 --- a/data-processing/data-processing-boot/src/main/java/com/njcn/dataProcess/service/impl/influxdb/InfluxdbDataLimitRateDetailImpl.java +++ b/data-processing/data-processing-boot/src/main/java/com/njcn/dataProcess/service/impl/influxdb/InfluxdbDataLimitRateDetailImpl.java @@ -9,6 +9,7 @@ import com.njcn.dataProcess.service.IDataLimitRateDetail; import lombok.RequiredArgsConstructor; import org.springframework.stereotype.Service; +import java.util.Collections; import java.util.List; /** @@ -20,6 +21,11 @@ import java.util.List; @RequiredArgsConstructor public class InfluxdbDataLimitRateDetailImpl extends MppServiceImpl implements IDataLimitRateDetail { + @Override + public List getLimitRateDetailTime(String id,String time) { + return Collections.emptyList(); + } + @Override public void batchInsertion(List limitRateList) { diff --git a/data-processing/data-processing-boot/src/main/java/com/njcn/dataProcess/service/impl/relation/RelationDataLimitRateDetailImpl.java b/data-processing/data-processing-boot/src/main/java/com/njcn/dataProcess/service/impl/relation/RelationDataLimitRateDetailImpl.java index 795ea24..e75cee7 100644 --- a/data-processing/data-processing-boot/src/main/java/com/njcn/dataProcess/service/impl/relation/RelationDataLimitRateDetailImpl.java +++ b/data-processing/data-processing-boot/src/main/java/com/njcn/dataProcess/service/impl/relation/RelationDataLimitRateDetailImpl.java @@ -2,20 +2,25 @@ package com.njcn.dataProcess.service.impl.relation; import cn.hutool.core.collection.CollUtil; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import cn.hutool.core.util.ObjectUtil; +import com.alibaba.fastjson.JSON; import com.github.jeffreyning.mybatisplus.service.MppServiceImpl; import com.njcn.dataProcess.dao.relation.mapper.RStatLimitRateDetailRelationMapper; +import com.njcn.dataProcess.pojo.dto.AbnormalData; import com.njcn.dataProcess.param.LineCountEvaluateParam; import com.njcn.dataProcess.pojo.dto.DataLimitRateDetailDto; -import com.njcn.dataProcess.pojo.dto.DataQualifiedDetail; -import com.njcn.dataProcess.pojo.po.RStatLimitQualifiedD; import com.njcn.dataProcess.pojo.po.RStatLimitRateDetailD; import com.njcn.dataProcess.service.IDataLimitRateDetail; import lombok.RequiredArgsConstructor; import org.springframework.beans.BeanUtils; import org.springframework.stereotype.Service; +import java.lang.reflect.Field; import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; import java.util.List; +import java.util.stream.Collectors; /** @@ -28,10 +33,50 @@ import java.util.List; public class RelationDataLimitRateDetailImpl extends MppServiceImpl implements IDataLimitRateDetail { + @Override + public List getLimitRateDetailTime(String id, String time) { + RStatLimitRateDetailD one = this.getOne(new LambdaQueryWrapper() + .eq(RStatLimitRateDetailD::getLineId, id) + .eq(RStatLimitRateDetailD::getTime, time) + ); + if (ObjectUtil.isNotNull(one)) { + List json = new ArrayList<>(); + try { + // 获取类的Class对象 + Class clazz = RStatLimitRateDetailD.class; + // 获取类中声明的所有字段 + Field[] fields = clazz.getDeclaredFields(); + // 遍历字段数组 + for (Field field : fields) { + if (!"lineId".equals(field.getName()) && !"time".equals(field.getName())) { + field.setAccessible(true); + Object o = field.get(one); + if (ObjectUtil.isNotNull(o)) { + String string = o.toString(); + json.addAll(JSON.parseArray(string, AbnormalData.Json.class)); + } + } + // 获取字段的类型 + Class fieldType = field.getType(); + System.out.println("Field name: " + field.getName() + ", Type: " + fieldType.getName()); + } + } catch (SecurityException |IllegalAccessException e) { + e.printStackTrace(); + } + if (CollUtil.isNotEmpty(json)){ + List times = json.stream().map(AbnormalData.Json::getTime).collect(Collectors.toList()); + String join = String.join(",", times); + String[] split = join.split(","); + return Arrays.stream(split).distinct().collect(Collectors.toList()); + } + } + return Collections.emptyList(); + } + @Override public void batchInsertion(List limitRateList) { List result = new ArrayList<>(); - limitRateList.forEach(item->{ + limitRateList.forEach(item -> { RStatLimitRateDetailD limitRate = new RStatLimitRateDetailD(); BeanUtils.copyProperties(item, limitRate); result.add(limitRate); diff --git a/data-processing/data-processing-boot/src/main/java/com/njcn/dataProcess/service/impl/relation/RelationRActivePowerRangeServiceImpl.java b/data-processing/data-processing-boot/src/main/java/com/njcn/dataProcess/service/impl/relation/RelationRActivePowerRangeServiceImpl.java new file mode 100644 index 0000000..160d53d --- /dev/null +++ b/data-processing/data-processing-boot/src/main/java/com/njcn/dataProcess/service/impl/relation/RelationRActivePowerRangeServiceImpl.java @@ -0,0 +1,37 @@ +package com.njcn.dataProcess.service.impl.relation; + +import com.github.jeffreyning.mybatisplus.service.MppServiceImpl; +import com.njcn.dataProcess.dao.relation.mapper.RActivePowerRangeMapper; +import com.njcn.dataProcess.pojo.dto.RActivePowerRangeDto; +import com.njcn.dataProcess.pojo.po.RActivePowerRange; +import com.njcn.dataProcess.service.IRActivePowerRangeService; +import lombok.RequiredArgsConstructor; +import org.springframework.beans.BeanUtils; +import org.springframework.stereotype.Service; + +import java.util.ArrayList; +import java.util.List; + + +/** + * @Description: 有功功率 + * @Author: wr + * @Date: 2025/4/1 16:03 + */ +@Service("RelationRActivePowerRangeServiceImpl") +@RequiredArgsConstructor +public class RelationRActivePowerRangeServiceImpl extends MppServiceImpl implements IRActivePowerRangeService { + + + @Override + public void batchInsertion(List dtoList) { + List result = new ArrayList<>(); + dtoList.forEach(item->{ + RActivePowerRange powerRange = new RActivePowerRange(); + BeanUtils.copyProperties(item, powerRange); + powerRange.setState(1); + result.add(powerRange); + }); + this.saveOrUpdateBatchByMultiId(result); + } +} diff --git a/data-processing/data-processing-boot/src/main/java/com/njcn/dataProcess/service/impl/relation/RelationSpThroughServiceImpl.java b/data-processing/data-processing-boot/src/main/java/com/njcn/dataProcess/service/impl/relation/RelationSpThroughServiceImpl.java new file mode 100644 index 0000000..06c3094 --- /dev/null +++ b/data-processing/data-processing-boot/src/main/java/com/njcn/dataProcess/service/impl/relation/RelationSpThroughServiceImpl.java @@ -0,0 +1,44 @@ +package com.njcn.dataProcess.service.impl.relation; + +import cn.hutool.core.util.IdUtil; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.github.jeffreyning.mybatisplus.service.MppServiceImpl; +import com.njcn.dataProcess.dao.relation.mapper.SpThroughMapper; +import com.njcn.dataProcess.pojo.dto.SpThroughDto; +import com.njcn.dataProcess.pojo.po.RStatPollutionSubstationY; +import com.njcn.dataProcess.pojo.po.SpThrough; +import com.njcn.dataProcess.service.ISpThroughService; +import lombok.RequiredArgsConstructor; +import org.springframework.beans.BeanUtils; +import org.springframework.stereotype.Service; + +import java.util.ArrayList; +import java.util.List; +import java.util.stream.Collectors; + + +/** + * @Description: 高低电压穿越 + * @Author: wr + * @Date: 2025/4/1 16:03 + */ +@Service("RelationSpThroughServiceImpl") +@RequiredArgsConstructor +public class RelationSpThroughServiceImpl extends MppServiceImpl implements ISpThroughService { + + + @Override + public void batchInsertion(List dtoList) { + List eventIds = dtoList.stream().map(SpThroughDto::getEventId).distinct().collect(Collectors.toList()); + List result = new ArrayList<>(); + dtoList.forEach(item->{ + SpThrough limitRate = new SpThrough(); + BeanUtils.copyProperties(item, limitRate); + limitRate.setId(IdUtil.simpleUUID()); + limitRate.setState(true); + result.add(limitRate); + }); + this.remove(new LambdaQueryWrapper().in(SpThrough::getEventId,eventIds)); + this.saveBatch(result); + } +}