From 82e98b24e0871366a5fc8bddab07bbabfc321eb3 Mon Sep 17 00:00:00 2001 From: 潘志宝 <979469083@qq.com> Date: 星期一, 17 三月 2025 14:54:29 +0800 Subject: [PATCH] 构造样本优化 --- iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/api/McsApiImpl.java | 43 +++++++++++++++++++++++++------------------ 1 files changed, 25 insertions(+), 18 deletions(-) diff --git a/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/api/McsApiImpl.java b/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/api/McsApiImpl.java index 3856993..159aabd 100644 --- a/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/api/McsApiImpl.java +++ b/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/api/McsApiImpl.java @@ -25,6 +25,7 @@ import com.iailab.module.model.mcs.pre.entity.MmPredictAlarmMessageEntity; import com.iailab.module.model.mcs.pre.service.*; import com.iailab.module.model.mcs.pre.vo.MmItemOutputRespVO; +import com.iailab.module.model.mcs.pre.vo.MmPredictAlarmConfigSaveReqVO; import com.iailab.module.model.mcs.pre.vo.MmPredictAlarmMessageSaveReqVO; import com.iailab.module.model.mcs.pre.vo.MmPredictItemRespVO; import com.iailab.module.model.mcs.sche.entity.StAdjustConfigDetEntity; @@ -119,7 +120,6 @@ @Autowired private StAdjustConfigService stAdjustConfigService; - private int HOUR_MINS = 60; @Override @@ -722,9 +722,11 @@ } MmItemOutputEntity outPut = mmItemOutputService.getByItemid(predictItem.getId(), itemNo[1], itemNo[2]); String outputId = outPut.getId(); - // 如果第5个参数为1,则取累计值 - if ("1".equals(itemNo[4])){ - outputId = outPut.getId() + CommonDict.CUMULANT_SUFFIX; + // 判断是否有第五个参数,如果有第5个参数为1,则取累计值 + if (itemNo.length >= 5){ + if (StringUtils.isNotBlank(itemNo[4]) && "1".equals(itemNo[4])){ + outputId = outPut.getId() + CommonDict.CUMULANT_SUFFIX; + } } Date predictTime = predictItem.getLastTime(); List<Object[]> curData = mmItemResultJsonService.getData(outputId, predictTime, DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND); @@ -824,20 +826,25 @@ return ConvertUtils.sourceToTarget(list, StAdjustConfigDetDTO.class); } - /** - * 计算功率因数 p²/(根号:p²+Q²) - **/ - public Double calculateCos(Double PValue,Double QValue) { - // 绝对值 - PValue = Math.abs(PValue); - QValue = Math.abs(QValue); - //PValue [0,0.001] 直接判断为关闭返回0 - if (PValue >= 0 && PValue <= 0.001) { - return 0.0; - }else { - BigDecimal result = new BigDecimal(PValue).divide(BigDecimal.valueOf(Math.sqrt(Math.pow(PValue, 2) + Math.pow(QValue, 2))), 2, BigDecimal.ROUND_HALF_UP); - return result.doubleValue(); - } + @Override + public Boolean updateAlarmConfig(String alarmObj,String upperLimit,String lowerLimit) { + MmPredictAlarmConfigSaveReqVO reqVO = new MmPredictAlarmConfigSaveReqVO(); + reqVO.setAlarmObj(alarmObj); + reqVO.setUpperLimit(BigDecimal.valueOf(Double.parseDouble(upperLimit))); + reqVO.setLowerLimit(BigDecimal.valueOf(Double.parseDouble(lowerLimit))); + mmPredictAlarmConfigService.updateByAlarmObj(reqVO); + return true; + } + + @Override + public Boolean updateChartParam(ChartDTO chartDTO) { + ChartDTO oldChartDTO = chartService.getChartByChartCode(chartDTO.getChartCode()); + List<ChartParamDTO> chartParams = chartDTO.getChartParams(); + chartParams.forEach(item -> { + item.setChartId(oldChartDTO.getId()); + }); + chartParamService.updateByChartIdAndParamCode(chartParams); + return true; } private Date[] calResultTime(ItemVO predictItem, Date startTimeReq, Date endTimeReq, int lengthLeft, int lengthRight) { -- Gitblit v1.9.3