| | |
| | | package com.iailab.module.ansteel.api.controller.admin; |
| | | |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.iailab.framework.common.exception.enums.GlobalErrorCodeConstants; |
| | | import com.iailab.framework.common.pojo.CommonResult; |
| | | import com.iailab.framework.common.util.object.ConvertUtils; |
| | |
| | | calendar.set(Calendar.HOUR_OF_DAY, 0); |
| | | |
| | | for (PowerNetFactorDTO dto : result) { |
| | | List<String> points = new ArrayList<>(); |
| | | if (StringUtils.isNotBlank(dto.getCurP())) { |
| | | points.add(dto.getCurP()); |
| | | } |
| | | if (StringUtils.isNotBlank(dto.getCurQ())) { |
| | | points.add(dto.getCurQ()); |
| | | } |
| | | if (!CollectionUtils.isEmpty(points)) { |
| | | Map<String, Object> pointsRealValue = dataPointApi.queryPointsRealValue(points); |
| | | if (pointsRealValue.get(dto.getCurP()) != null) { |
| | | dto.setCurP(pointsRealValue.get(dto.getCurP()).toString()); |
| | | try { |
| | | List<String> points = new ArrayList<>(); |
| | | if (StringUtils.isNotBlank(dto.getCurP())) { |
| | | points.add(dto.getCurP()); |
| | | } |
| | | if (pointsRealValue.get(dto.getCurQ()) != null) { |
| | | dto.setCurQ(pointsRealValue.get(dto.getCurQ()).toString()); |
| | | if (StringUtils.isNotBlank(dto.getCurQ())) { |
| | | points.add(dto.getCurQ()); |
| | | } |
| | | if (!CollectionUtils.isEmpty(points)) { |
| | | Map<String, Object> pointsRealValue = dataPointApi.queryPointsRealValue(points); |
| | | if (pointsRealValue.get(dto.getCurP()) != null) { |
| | | dto.setCurP(pointsRealValue.get(dto.getCurP()).toString()); |
| | | } |
| | | if (pointsRealValue.get(dto.getCurQ()) != null) { |
| | | dto.setCurQ(pointsRealValue.get(dto.getCurQ()).toString()); |
| | | } |
| | | if (pointsRealValue.get(dto.getCurCos()) != null) { |
| | | dto.setCurCos(pointsRealValue.get(dto.getCurCos()).toString()); |
| | | } |
| | | } |
| | | } catch (Exception ex) { |
| | | log.info(dto.getNodeName() + "获取当前值异常" + ex.getMessage()); |
| | | } |
| | | |
| | | PredictLastValueReqVO reqVO = new PredictLastValueReqVO(); |
| | | reqVO.setPredictTime(calendar.getTime()); |
| | | List<String[]> itemNos = new ArrayList<>(); |
| | | if (StringUtils.isNotBlank(dto.getPreP())) { |
| | | itemNos.add(dto.getPreP().split(",")); |
| | | } |
| | | if (StringUtils.isNotBlank(dto.getPreQ())) { |
| | | itemNos.add(dto.getPreQ().split(",")); |
| | | } |
| | | if (StringUtils.isNotBlank(dto.getPreCos())) { |
| | | itemNos.add(dto.getPreCos().split(",")); |
| | | } |
| | | if (!CollectionUtils.isEmpty(itemNos)) { |
| | | reqVO.setItemNos(itemNos); |
| | | Map<String, BigDecimal> preValues = mcsApi.getPredictValueByTime(reqVO); |
| | | if (StringUtils.isNotBlank(dto.getPreP()) && preValues.get(dto.getPreP()) != null) { |
| | | dto.setPreP(preValues.get(dto.getPreP()).toString()); |
| | | try { |
| | | PredictLastValueReqVO reqVO = new PredictLastValueReqVO(); |
| | | reqVO.setPredictTime(calendar.getTime()); |
| | | List<String[]> itemNos = new ArrayList<>(); |
| | | if (StringUtils.isNotBlank(dto.getPreP())) { |
| | | itemNos.add(dto.getPreP().split(",")); |
| | | } |
| | | if (StringUtils.isNotBlank(dto.getPreQ()) && preValues.get(dto.getPreQ()) != null) { |
| | | dto.setPreQ(preValues.get(dto.getPreQ()).toString()); |
| | | if (StringUtils.isNotBlank(dto.getPreQ())) { |
| | | itemNos.add(dto.getPreQ().split(",")); |
| | | } |
| | | if (StringUtils.isNotBlank(dto.getPreCos()) && preValues.get(dto.getPreCos()) != null) { |
| | | dto.setPreCos(preValues.get(dto.getPreCos()).toString()); |
| | | if (StringUtils.isNotBlank(dto.getPreCos())) { |
| | | itemNos.add(dto.getPreCos().split(",")); |
| | | } |
| | | if (!CollectionUtils.isEmpty(itemNos)) { |
| | | reqVO.setItemNos(itemNos); |
| | | log.info("reqVO=" + JSONObject.toJSONString(reqVO)); |
| | | Map<String, BigDecimal> preValues = mcsApi.getPredictValueByTime(reqVO); |
| | | if (StringUtils.isNotBlank(dto.getPreP()) && preValues.get(dto.getPreP()) != null) { |
| | | dto.setPreP(preValues.get(dto.getPreP()).toString()); |
| | | } |
| | | if (StringUtils.isNotBlank(dto.getPreQ()) && preValues.get(dto.getPreQ()) != null) { |
| | | dto.setPreQ(preValues.get(dto.getPreQ()).toString()); |
| | | } |
| | | if (StringUtils.isNotBlank(dto.getPreCos()) && preValues.get(dto.getPreCos()) != null) { |
| | | dto.setPreCos(preValues.get(dto.getPreCos()).toString()); |
| | | } |
| | | } |
| | | } catch (Exception ex) { |
| | | log.info(dto.getNodeName() + "获取预测值异常," + ex.getMessage()); |
| | | } |
| | | |
| | | } |
| | | return success(result); |
| | | } |