| | |
| | | import javax.annotation.Resource; |
| | | import java.math.BigDecimal; |
| | | import java.util.*; |
| | | import java.util.function.Function; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | |
| | | |
| | | 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.ZERO)) { |
| | | 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") && resultCodeMap.containsKey("main_glmqxh") && resultCodeMap.containsKey("main_jlmqxh")) { |
| | | // 高炉煤气消耗 |
| | | BigDecimal mainGlmqxh = resultCodeMap.get("main_glmqxh").getRealValue(); |
| | | // 焦炉煤气消耗 |
| | | BigDecimal mainJlmqxh = resultCodeMap.get("main_jlmqxh").getRealValue(); |
| | | e.setRealValue(mainGlmqxh.add(mainJlmqxh).divide(jtcl,2,BigDecimal.ROUND_HALF_UP)); |
| | | } |
| | | }); |
| | | } |
| | | } |
| | | cokingProcessMainService.save(processMainEntities); |
| | | } |
| | | } catch (Exception ex) { |