| | |
| | | QueryWrapper<CokingOverviewEntity> queryWrapperMonth = new QueryWrapper<>(); |
| | | queryWrapperMonth.eq("process_type", processType); |
| | | queryWrapperMonth.between("clock", monthStartClock,clock); |
| | | queryWrapperMonth.select("sub_process_type","SUM(steam_p) as steam_p","SUM(dj_steam_p) as dj_steam_p","SUM(steam_c) as steam_c","SUM(steam_only_c) as steam_only_c","SUM(steam_v) as steam_v","SUM(gas_p) as gas_p","SUM(gas_c) as gas_c","SUM(power_c) as power_c","SUM(power_only_c) as power_only_c","SUM(power_c_standard) as power_c_standard","SUM(idle_time) as idle_time","SUM(bfg_c) as bfg_c","SUM(cog_p) as cog_p","SUM(cog_c) as cog_c","SUM(bfg_only_c) as bfg_only_c","SUM(cog_only_c) as cog_only_c","SUM(gxls) as gxls") |
| | | queryWrapperMonth.select("sub_process_type","SUM(steam_p)*30/count(*) as steam_p","SUM(dj_steam_p)*30/count(*) as dj_steam_p","SUM(steam_c)*30/count(*) as steam_c","SUM(steam_only_c)*30/count(*) as steam_only_c","SUM(steam_v)*30/count(*) as steam_v","SUM(gas_p)*30/count(*) as gas_p","SUM(gas_c)*30/count(*) as gas_c","SUM(power_c)*30/count(*) as power_c","SUM(power_only_c)*30/count(*) as power_only_c","SUM(power_c_standard)*30/count(*) as power_c_standard","SUM(idle_time)*30/count(*) as idle_time","SUM(bfg_c)*30/count(*) as bfg_c","SUM(cog_p)*30/count(*) as cog_p","SUM(cog_c)*30/count(*) as cog_c","SUM(bfg_only_c)*30/count(*) as bfg_only_c","SUM(cog_only_c)*30/count(*) as cog_only_c","SUM(gxls)*30/count(*) as gxls") |
| | | .groupBy("sub_process_type"); |
| | | |
| | | List<CokingOverviewEntity> monthList = cokingOverviewDao.selectList(queryWrapperMonth); |
| | |
| | | // 计算 统计值 |
| | | processMainEntities.forEach(processMainEntity -> { |
| | | // 计算 月累计 |
| | | calendar.add(Calendar.DAY_OF_YEAR, -29); |
| | | calendar.add(Calendar.DAY_OF_YEAR, -28); |
| | | String clock_30 = DateUtils.format(calendar.getTime(), DateUtils.FORMAT_YEAR_MONTH_DAY); |
| | | List<CokingProcessMainEntity> historyList_30 = cokingProcessMainService.historyList(clock_30, clock, "day",processMainEntity.getIndCode()); |
| | | historyList_30.add(processMainEntity); |
| | | double monthValue = historyList_30.stream().mapToDouble(e -> e.getRealValue().doubleValue()).sum(); |
| | | double monthValue = historyList_30.stream().mapToDouble(e -> e.getRealValue().doubleValue()).average().orElse(0.0) * 30; |
| | | processMainEntity.setMonthValue(BigDecimal.valueOf(monthValue)); |
| | | |
| | | // 计算 历史平均 |