沙钢智慧能源系统后端代码
潘志宝
8 天以前 caed99f9e64880b9036f5ca8828af764ae13b76f
shasteel-biz/src/main/java/com/iailab/module/shasteel/mq/consumer/ModelPredictFinishConsumer.java
@@ -118,8 +118,17 @@
                    log.info("AlarmPreData: " + JSONArray.toJSONString(result));
                    // 对比预测值是否超限
                    int fromIndex = 0;
                    int toIndex = result.size();
                    int fromIndex = result.size() - configItem.getCompLength();
                    if (!configItem.getCompLength().contains(",")) {
                        fromIndex = result.size() - Integer.parseInt(configItem.getCompLength().trim());
                    } else {
                        String[] cpArr = configItem.getCompLength().split(",");
                        fromIndex = Integer.parseInt(cpArr[0]);
                        toIndex = Integer.parseInt(cpArr[1]);
                    }
                    log.info("fromIndex:" + fromIndex);
                    log.info("toIndex:" + toIndex);
                    List<Object[]> predictList = result.subList(fromIndex, toIndex);
                    for (Object[] data : predictList) {
                        BigDecimal dataValue = new BigDecimal(Double.parseDouble(data[1].toString())).setScale(2, BigDecimal.ROUND_HALF_UP);