| | |
| | | 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; |
| | |
| | | |
| | | @Autowired |
| | | private StAdjustConfigService stAdjustConfigService; |
| | | |
| | | private int HOUR_MINS = 60; |
| | | |
| | | @Override |
| | |
| | | valueDTOS.forEach(item -> { |
| | | Object[] values = new Object[2]; |
| | | values[0] = DateUtils.format(item.getT(), timeFormat); |
| | | values[1] = new BigDecimal(item.getV()).setScale(2, BigDecimal.ROUND_HALF_UP); |
| | | values[1] = new BigDecimal(item.getV()).setScale(3, BigDecimal.ROUND_HALF_UP); |
| | | result.add(values); |
| | | }); |
| | | return result; |
| | |
| | | result.put(key, BigDecimal.ZERO); |
| | | } |
| | | 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; |
| | | } |
| | | Date predictTime = predictItem.getLastTime(); |
| | | List<Object[]> curData = mmItemResultJsonService.getData(outPut.getId(), predictTime, DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND); |
| | | List<Object[]> curData = mmItemResultJsonService.getData(outputId, predictTime, DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND); |
| | | if(CollectionUtils.isEmpty(curData)) { |
| | | result.put(key, BigDecimal.ZERO); |
| | | } else { |
| | |
| | | return ConvertUtils.sourceToTarget(list, StAdjustConfigDetDTO.class); |
| | | } |
| | | |
| | | @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; |
| | | } |
| | | |
| | | /** |
| | | * 计算功率因数 p²/(根号:p²+Q²) |
| | | **/ |