| | |
| | | import com.iailab.module.model.mcs.pre.vo.MmItemOutputRespVO; |
| | | 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.StScheduleModelEntity; |
| | | import com.iailab.module.model.mcs.sche.entity.StScheduleSuggestEntity; |
| | | import com.iailab.module.model.mcs.sche.service.StScheduleRecordService; |
| | | import com.iailab.module.model.mcs.sche.service.StScheduleSchemeService; |
| | | import com.iailab.module.model.mcs.sche.service.StScheduleSuggestService; |
| | | import com.iailab.module.model.mcs.sche.service.*; |
| | | import com.iailab.module.model.mcs.sche.vo.StScheduleSuggestSaveReqVO; |
| | | import com.iailab.module.model.mdk.vo.ItemVO; |
| | | import com.iailab.module.model.mpk.service.ChartParamService; |
| | |
| | | |
| | | @Autowired |
| | | private ElectricityPriceSegmentedService electricityPriceSegmentedService; |
| | | |
| | | @Autowired |
| | | private StScheduleModelService stScheduleModelService; |
| | | |
| | | @Autowired |
| | | private StScheduleModelSettingService stScheduleModelSettingService; |
| | | |
| | | |
| | | private int HOUR_MINS = 60; |
| | | |
| | |
| | | viewDto.setRealData(getHisData(output.getPointid(), startTime, endTime)); |
| | | viewDto.setPreDataN(mmItemResultService.getData(output.getId(), startTime, endTime, DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)); |
| | | viewDto.setPreDataL(mmItemResultLastPointService.getData(output.getId(), startTime, endTime, DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)); |
| | | |
| | | viewDto.setCurData(mmItemResultJsonService.getData(output.getId(), predictTime, DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)); |
| | | List<Double> values = new ArrayList<>(); |
| | | if (!CollectionUtils.isEmpty(viewDto.getRealData())) { |
| | | List<Double> hisValues = new ArrayList<>(); |
| | |
| | | }).collect(Collectors.toList()); |
| | | dataView.setPreMax(new BigDecimal(curList.stream().mapToDouble(Double::doubleValue).max().getAsDouble()).setScale(2, BigDecimal.ROUND_HALF_UP)); |
| | | dataView.setPreMin(new BigDecimal(curList.stream().mapToDouble(Double::doubleValue).min().getAsDouble()).setScale(2, BigDecimal.ROUND_HALF_UP)); |
| | | dataView.setPreLast(new BigDecimal(curList.get(curList.size() - 1))); |
| | | dataView.setPreCumulant(new BigDecimal(curList.stream().mapToDouble(Double::doubleValue).sum())); |
| | | dataView.setPreLast(new BigDecimal(curList.get(curList.size() - 1)).setScale(2, BigDecimal.ROUND_HALF_UP)); |
| | | dataView.setPreCumulant(new BigDecimal(curList.stream().mapToDouble(Double::doubleValue).sum()).setScale(2, BigDecimal.ROUND_HALF_UP)); |
| | | } |
| | | |
| | | String alarmObj = chartParams.get(CommonConstant.ALARM_OBJ); |
| | |
| | | } else { |
| | | dataView.setAlarmMessage(alarmList.get(0).getContent()); |
| | | } |
| | | } |
| | | |
| | | try { |
| | | String adjValuePoint = chartParams.get(CommonConstant.ADJ_VALUE_POINT); |
| | | if (StringUtils.isNotBlank(adjValuePoint)) { |
| | | List<String> pointNos = new ArrayList<>(); |
| | | pointNos.add(adjValuePoint); |
| | | Map<String, Object> adjValue = dataPointApi.queryPointsRealValue(pointNos); |
| | | dataView.setAdjValue(new BigDecimal(adjValue.get(adjValuePoint).toString())); |
| | | } |
| | | |
| | | String adjValueArrPoint = chartParams.get(CommonConstant.ADJ_VALUE_ARR_POINT); |
| | | if (StringUtils.isNotBlank(adjValueArrPoint)) { |
| | | String[] adjPointArr = adjValueArrPoint.split(","); |
| | | Map<String, Object> adjValue = dataPointApi.queryPointsRealValue(Arrays.asList(adjPointArr)); |
| | | BigDecimal[] adjValueArr = new BigDecimal[adjPointArr.length]; |
| | | for(int i = 0; i < adjPointArr.length; i++) { |
| | | adjValueArr[i] = new BigDecimal(adjValue.get(adjPointArr[i]).toString()); |
| | | } |
| | | dataView.setAdjValueArr(adjValueArr); |
| | | } |
| | | } catch (Exception ex) { |
| | | ex.printStackTrace(); |
| | | } |
| | | |
| | | result.setPredictTime(predictTime); |
| | |
| | | } |
| | | |
| | | @Override |
| | | public List<ScheduleSuggestRespDTO> listScheduleSuggest(Map<String, Object> params) { |
| | | return Collections.emptyList(); |
| | | public List<ScheduleSuggestRespDTO> listScheduleSuggest(ScheduleSuggestReqDTO vo) { |
| | | return stScheduleSuggestService.list(vo); |
| | | } |
| | | |
| | | @Override |
| | |
| | | } |
| | | |
| | | @Override |
| | | public List<ElectricityPriceSegmentedDTO> getElectricityPriceList() { |
| | | return electricityPriceSegmentedService.getElectricityPriceList(); |
| | | public List<ElectricityPriceSegmentedDTO> getElectricityPriceList(String year, String time) { |
| | | return electricityPriceSegmentedService.getElectricityPriceList(year, time); |
| | | } |
| | | |
| | | @Override |
| | | public Boolean createElectricityPrice(ElectricityPriceSegmentedDTO dto) { |
| | | electricityPriceSegmentedService.create(dto); |
| | | public Boolean createElectricityPrice(List<ElectricityPriceSegmentedDTO> list) { |
| | | electricityPriceSegmentedService.deleteByITimeId(list.get(0).getITimeId()); |
| | | list.forEach(dto -> electricityPriceSegmentedService.create(dto)); |
| | | return true; |
| | | } |
| | | |
| | | @Override |
| | | public Boolean updateScheduleModelSetting(String modelCode, String key, String value) { |
| | | StScheduleModelEntity model = stScheduleModelService.getByModelCode(modelCode); |
| | | stScheduleModelSettingService.updateByModelIdAndKey(model.getId(), key, value); |
| | | return true; |
| | | } |
| | | |