Przeglądaj źródła

支持统一电价设置

skyline 2 lat temu
rodzic
commit
0fe16ca57a

+ 6 - 1
entity/src/main/java/com/kym/entity/enplus/response/EnBusinessPolicy.java

@@ -55,7 +55,12 @@ public class EnBusinessPolicy {
         this.policyInfos = array.toJavaList(EnPolicyInfo.class);
         // 将尖峰平谷信息填入EnPolicyInfo中
         var elecPriceSet = policyInfos.stream().map(EnPolicyInfo::getElecPrice).collect(Collectors.toSet()).stream().sorted().toList();
-        policyInfos = policyInfos.stream().peek(price -> price.setPricePeriod(EnPolicyInfo.PRICE_PERIOD[elecPriceSet.indexOf(price.getElecPrice())])).toList();
+        if (elecPriceSet.size() > 1) {
+            policyInfos = policyInfos.stream().peek(price -> price.setPricePeriod(EnPolicyInfo.PRICE_PERIOD[elecPriceSet.indexOf(price.getElecPrice())])).toList();
+        } else {
+            // 统一电价
+            policyInfos = policyInfos.stream().peek(price -> price.setPricePeriod("统")).toList();
+        }
     }