瀏覽代碼

支持统一电价设置

skyline 2 年之前
父節點
當前提交
0fe16ca57a
共有 1 個文件被更改,包括 6 次插入1 次删除
  1. 6 1
      entity/src/main/java/com/kym/entity/enplus/response/EnBusinessPolicy.java

+ 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();
+        }
     }