| | |
| | | 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); |