| | |
| | | continue; |
| | | } |
| | | List<CokingProcessMainEntity> processMainEntities = new ArrayList<>(list.size()); |
| | | // 历史最优计算方向,正数取最大值,负数取最小值 |
| | | Map<String,Double> directionMap = new HashMap<>(list.size()); |
| | | for (CokingProcessConfEntity conf : list) { |
| | | if (StringUtils.isBlank(conf.getDataType())) { |
| | | logger.info("DataType is Empty"); |
| | |
| | | processMainEntity.setStandValue(standValue == null ? BigDecimal.valueOf(-2) : BigDecimal.valueOf(standValue)); |
| | | Double theoryValue = getConfValue("DATAPOINT",conf.getExt2()); |
| | | processMainEntity.setTheoryValue(theoryValue == null ? BigDecimal.valueOf(-2) : BigDecimal.valueOf(theoryValue)); |
| | | // 历史最优计算方向 |
| | | if (conf.getExt3() != null) { |
| | | directionMap.put(conf.getIndCode(),Double.valueOf(conf.getExt3())); |
| | | } |
| | | processMainEntities.add(processMainEntity); |
| | | } |
| | | // 计算吨焦产煤气,吨焦产蒸汽,吨焦耗煤气 |
| | | Map<String, CokingProcessMainEntity> resultCodeMap = processMainEntities.stream().collect(Collectors.toMap(CokingProcessMainEntity::getIndCode, Function.identity(), (e1, e2) -> e1)); |
| | | // 有焦炭产量 |
| | | if (resultCodeMap.containsKey("main_jcmq")) { |
| | | // 焦炭产量 |
| | | BigDecimal jtcl = resultCodeMap.get("main_jcmq").getRealValue(); |
| | | if (jtcl != null && !jtcl.equals(BigDecimal.valueOf(-2))) { |
| | | processMainEntities.forEach(e -> { |
| | | // 吨焦产煤气 |
| | | if (e.getIndCode().equals("main_jcmq") && resultCodeMap.containsKey("main_jlmqfs")) { |
| | | // 焦炉煤气发生 |
| | | BigDecimal mainJlmqfs = resultCodeMap.get("main_jlmqfs").getRealValue(); |
| | | e.setRealValue(mainJlmqfs.divide(jtcl,2,BigDecimal.ROUND_HALF_UP)); |
| | | } |
| | | // 吨焦产蒸汽 |
| | | if (e.getIndCode().equals("main_djczq") && resultCodeMap.containsKey("main_gxjzqcs")) { |
| | | // 干熄焦蒸汽产生 |
| | | BigDecimal mainGxjzqcs = resultCodeMap.get("main_gxjzqcs").getRealValue(); |
| | | e.setRealValue(mainGxjzqcs.divide(jtcl,2,BigDecimal.ROUND_HALF_UP)); |
| | | } |
| | | // 吨焦耗热量 |
| | | if (e.getIndCode().equals("main_djhmq")) { |
| | | // 焦化耗热量 |
| | | BigDecimal mainHrl = e.getRealValue(); |
| | | e.setRealValue(mainHrl.divide(jtcl,2,BigDecimal.ROUND_HALF_UP)); |
| | | } |
| | | // 吨焦耗蒸汽 |
| | | if (e.getIndCode().equals("main_djhzq") && resultCodeMap.containsKey("main_zqxh")) { |
| | | // 干熄焦蒸汽产生 |
| | | BigDecimal mainZqxh = resultCodeMap.get("main_zqxh").getRealValue(); |
| | | e.setRealValue(mainZqxh.divide(jtcl,2,BigDecimal.ROUND_HALF_UP)); |
| | | } |
| | | // 吨焦耗电 |
| | | if (e.getIndCode().equals("main_djhd") && resultCodeMap.containsKey("main_dlxh")) { |
| | | // 干熄焦蒸汽产生 |
| | | BigDecimal mainDlxh = resultCodeMap.get("main_dlxh").getRealValue(); |
| | | e.setRealValue(mainDlxh.divide(jtcl,2,BigDecimal.ROUND_HALF_UP)); |
| | | } |
| | | |
| | | }); |
| | | } |
| | | } |
| | | |
| | | // 计算 统计值 |
| | | processMainEntities.forEach(processMainEntity -> { |
| | | // 计算 月累计 |
| | | calendar.add(Calendar.DAY_OF_YEAR, -28); |
| | | // 计算 月累计 当前自然月 |
| | | calendar.set(Calendar.DAY_OF_MONTH,1); |
| | | 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); |
| | |
| | | processMainEntity.setAvgValue(BigDecimal.valueOf(avgValue)); |
| | | // 历史最优 |
| | | double baseValue = 0.0; |
| | | if (!directionMap.containsKey(processMainEntity.getIndCode()) || directionMap.get(processMainEntity.getIndCode()) > 0.0) { |
| | | if (StringUtils.isNotBlank(conf.getExt3()) && Double.valueOf(conf.getExt3()) > 0.0) { |
| | | baseValue = historyList_90.stream().mapToDouble(e -> e.getRealValue().doubleValue()).max().orElse(0.0); |
| | | }else { |
| | | baseValue = historyList_90.stream().mapToDouble(e -> e.getRealValue().doubleValue()).min().orElse(0.0); |
| | | } |
| | | processMainEntity.setBaseValue(BigDecimal.valueOf(baseValue)); |
| | | }); |
| | | |
| | | |
| | | |
| | | processMainEntities.add(processMainEntity); |
| | | } |
| | | |
| | | cokingProcessMainService.save(processMainEntities); |
| | | } |