鞍钢鲅鱼圈能源管控系统后端代码
潘志宝
8 天以前 4565dd1660ace1311267b4b89fa893489d7ce02f
ansteel-biz/src/main/java/com/iailab/module/ansteel/api/controller/admin/PowerController.java
@@ -1,5 +1,6 @@
package com.iailab.module.ansteel.api.controller.admin;
import cn.hutool.core.util.NumberUtil;
import com.alibaba.fastjson.JSONObject;
import com.iailab.framework.common.exception.enums.GlobalErrorCodeConstants;
import com.iailab.framework.common.pojo.CommonResult;
@@ -71,6 +72,7 @@
        calendar.set(Calendar.HOUR_OF_DAY, 0);
        for (PowerNetFactorDTO dto : result) {
            boolean cosFlag = false;
            try {
                List<String> points = new ArrayList<>();
                if (StringUtils.isNotBlank(dto.getCurP())) {
@@ -89,6 +91,7 @@
                    }
                    if (pointsRealValue.get(dto.getCurCos()) != null) {
                        dto.setCurCos(pointsRealValue.get(dto.getCurCos()).toString());
                        cosFlag = true;
                    }
                }
            } catch (Exception ex) {
@@ -125,6 +128,17 @@
            } catch (Exception ex) {
                log.info(dto.getNodeName() + "获取预测值异常," + ex.getMessage());
            }
            // 设置状态
            if (cosFlag && StringUtils.isNotBlank(dto.getCurCos()) && NumberUtil.isNumber(dto.getCurCos())) {
                BigDecimal curCos = new BigDecimal(dto.getCurCos());
                if (dto.getLimitL() != null && dto.getLimitH() != null &&
                        curCos.compareTo(dto.getLimitL()) < 0 || curCos.compareTo(dto.getLimitH()) > 0) {
                    dto.setStatus(1);
                } else {
                    dto.setStatus(0);
                }
            }
        }
        return success(result);
    }