鞍钢鲅鱼圈能源管控系统后端代码
潘志宝
9 天以前 2f5864f98743fcc1b32d1eb94015adf70c1a9bf5
ansteel-biz/src/main/java/com/iailab/module/ansteel/job/task/RunPeakValleyFlatTask.java
@@ -65,26 +65,28 @@
                dto.setValue(value/totalValue*100);
                dataPointApi.writePointRealValue(dto);
                //计算前三十日累积量
                double value30 = 0;
                for (int i = 1; i < 31; i++) {
                if(entry.getValue().get(0).getPointNoMonth()!=null){
                    //计算前三十日累积量
                    value30 = value30 + getSumValue(entry.getValue(), i, calendar);
                    double value30 = 0;
                    for (int i = 1; i < 31; i++) {
                        //计算前三十日累积量
                        value30 = value30 + getSumValue(entry.getValue(), i, calendar);
                    }
                    //计算前三十日总电耗
                    calendar.set(Calendar.MILLISECOND, 0);
                    calendar.set(Calendar.MINUTE, 0);
                    calendar.set(Calendar.HOUR_OF_DAY, 0);
                    calendar.add(Calendar.DAY_OF_YEAR, -30);
                    Date startTimeMonth = calendar.getTime();
                    double totalValueMonth = getSumValueTotal(entry.getValue().get(0).getPowerNo(), startTimeMonth,endTime);
                    //下发前三十日占比
                    ApiPointValueWriteDTO monthDto = new ApiPointValueWriteDTO();
                    monthDto.setPointNo(entry.getValue().get(0).getPointNoMonth());
                    monthDto.setValue(value30/totalValueMonth*100);
                    dataPointApi.writePointRealValue(monthDto);
                }
                //计算前三十日总电耗
                calendar.set(Calendar.MILLISECOND, 0);
                calendar.set(Calendar.MINUTE, 0);
                calendar.set(Calendar.HOUR_OF_DAY, 0);
                calendar.add(Calendar.DAY_OF_YEAR, -30);
                Date startTimeMonth = calendar.getTime();
                double totalValueMonth = getSumValueTotal(entry.getValue().get(0).getPowerNo(), startTimeMonth,endTime);
                //下发前三十日占比
                ApiPointValueWriteDTO monthDto = new ApiPointValueWriteDTO();
                monthDto.setPointNo(entry.getValue().get(0).getPointNoMonth());
                monthDto.setValue(value30/totalValueMonth*100);
                dataPointApi.writePointRealValue(monthDto);
            });
        } catch (Exception ex) {
            logger.error("runPeakValleyFlatTask运行异常");