Browse Source

电价字段改造

learshaw 4 months ago
parent
commit
173ec27385

+ 0 - 1
ems/ems-cloud/ems-dev-adapter/src/main/java/com/ruoyi/ems/controller/CircuitBreakerController.java

@@ -10,7 +10,6 @@
  */
 package com.ruoyi.ems.controller;
 
-import com.huashe.common.exception.BusinessException;
 import com.ruoyi.ems.handle.MqttBaseHandler;
 import com.ruoyi.ems.model.AbilityPayload;
 import com.ruoyi.ems.model.CallResponse;

+ 0 - 13
ems/ems-core/src/main/java/com/ruoyi/ems/domain/ElecGwPriceConfig.java

@@ -45,10 +45,6 @@ public class ElecGwPriceConfig extends BaseEntity
     @Excel(name = "分时高峰时段价格")
     private Double fsHighDegreePrice;
 
-    /** 分时平峰时段价格 */
-    @Excel(name = "分时平峰时段价格")
-    private Double fsFlatDegreePrice;
-
     /** 分时低谷时段价格 */
     @Excel(name = "分时低谷时段价格")
     private Double fsLowDegreePrice;
@@ -131,14 +127,6 @@ public class ElecGwPriceConfig extends BaseEntity
         this.fsHighDegreePrice = fsHighDegreePrice;
     }
 
-    public Double getFsFlatDegreePrice() {
-        return fsFlatDegreePrice;
-    }
-
-    public void setFsFlatDegreePrice(Double fsFlatDegreePrice) {
-        this.fsFlatDegreePrice = fsFlatDegreePrice;
-    }
-
     public Double getFsLowDegreePrice() {
         return fsLowDegreePrice;
     }
@@ -173,7 +161,6 @@ public class ElecGwPriceConfig extends BaseEntity
             .append("degreePrice", getDegreePrice())
             .append("fsPeakDegreePrice", getFsPeakDegreePrice())
             .append("fsHighDegreePrice", getFsHighDegreePrice())
-            .append("fsFlatDegreePrice", getFsFlatDegreePrice())
             .append("fsLowDegreePrice", getFsLowDegreePrice())
             .append("maxReqPrice", getMaxReqPrice())
             .append("transCapacityPrice", getTransCapacityPrice())

+ 1 - 1
ems/ems-core/src/main/java/com/ruoyi/ems/service/impl/PriceServiceImpl.java

@@ -119,7 +119,7 @@ public class PriceServiceImpl implements IPriceService {
                 price = new Price(priceCode, strategyCode, hourType, priceConfig.getFsPeakDegreePrice());
                 break;
             default:
-                price = new Price(priceCode, strategyCode, hourType, priceConfig.getFsFlatDegreePrice());
+                price = new Price(priceCode, strategyCode, hourType, priceConfig.getDegreePrice());
                 break;
         }
 

+ 9 - 10
ems/ems-core/src/main/resources/mapper/ems/ElecGwPriceConfigMapper.xml

@@ -13,7 +13,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <result property="degreePrice"    column="degree_price"    />
         <result property="fsPeakDegreePrice"    column="fs_peak_degree_price"    />
         <result property="fsHighDegreePrice"    column="fs_high_degree_price"    />
-        <result property="fsFlatDegreePrice"    column="fs_flat_degree_price"    />
         <result property="fsLowDegreePrice"    column="fs_low_degree_price"    />
         <result property="maxReqPrice"    column="max_req_price"    />
         <result property="transCapacityPrice"    column="trans_capacity_price"    />
@@ -21,7 +20,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 
     <sql id="selectElecPriceConfigVo">
         select
-            v.id, v.cfg_code, v.elec_type, t.`name` as elec_type_name, v.voltage_level, v.degree_price, v.fs_peak_degree_price, v.fs_high_degree_price, v.fs_flat_degree_price, v.fs_low_degree_price, v.max_req_price, v.trans_capacity_price
+            v.id, v.cfg_code, v.elec_type, t.`name` as elec_type_name, v.voltage_level, v.degree_price, v.fs_peak_degree_price, v.fs_high_degree_price, v.fs_low_degree_price, v.max_req_price, v.trans_capacity_price
         from adm_gw_elecprice_config v
             LEFT JOIN dim_ems_elecprice_type t ON v.elec_type = t.`code`
     </sql>
@@ -53,7 +52,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="degreePrice != null">degree_price,</if>
             <if test="fsPeakDegreePrice != null">fs_peak_degree_price,</if>
             <if test="fsHighDegreePrice != null">fs_high_degree_price,</if>
-            <if test="fsFlatDegreePrice != null">fs_flat_degree_price,</if>
             <if test="fsLowDegreePrice != null">fs_low_degree_price,</if>
             <if test="maxReqPrice != null">max_req_price,</if>
             <if test="transCapacityPrice != null">trans_capacity_price,</if>
@@ -65,7 +63,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="degreePrice != null">#{degreePrice},</if>
             <if test="fsPeakDegreePrice != null">#{fsPeakDegreePrice},</if>
             <if test="fsHighDegreePrice != null">#{fsHighDegreePrice},</if>
-            <if test="fsFlatDegreePrice != null">#{fsFlatDegreePrice},</if>
             <if test="fsLowDegreePrice != null">#{fsLowDegreePrice},</if>
             <if test="maxReqPrice != null">#{maxReqPrice},</if>
             <if test="transCapacityPrice != null">#{transCapacityPrice},</if>
@@ -74,18 +71,20 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 
     <update id="updateElecPriceConfig" parameterType="com.ruoyi.ems.domain.ElecGwPriceConfig">
         update adm_gw_elecprice_config
-        <trim prefix="SET" suffixOverrides=",">
-            <if test="cfgCode != null and cfgCode != ''">cfg_code = #{cfgCode},</if>
-            <if test="elecType != null">elec_type = #{elecType},</if>
-            <if test="voltageLevel != null and voltageLevel != ''">voltage_level = #{voltageLevel},</if>
+        <set>
             <if test="degreePrice != null">degree_price = #{degreePrice},</if>
+            <if test="degreePrice == null">degree_price = NULL,</if>
             <if test="fsPeakDegreePrice != null">fs_peak_degree_price = #{fsPeakDegreePrice},</if>
+            <if test="fsPeakDegreePrice == null">fs_peak_degree_price = NULL,</if>
             <if test="fsHighDegreePrice != null">fs_high_degree_price = #{fsHighDegreePrice},</if>
-            <if test="fsFlatDegreePrice != null">fs_flat_degree_price = #{fsFlatDegreePrice},</if>
+            <if test="fsHighDegreePrice == null">fs_high_degree_price = NULL,</if>
             <if test="fsLowDegreePrice != null">fs_low_degree_price = #{fsLowDegreePrice},</if>
+            <if test="fsLowDegreePrice == null">fs_low_degree_price = NULL,</if>
             <if test="maxReqPrice != null">max_req_price = #{maxReqPrice},</if>
+            <if test="maxReqPrice == null">max_req_price = NULL,</if>
             <if test="transCapacityPrice != null">trans_capacity_price = #{transCapacityPrice},</if>
-        </trim>
+            <if test="transCapacityPrice == null">trans_capacity_price = NULL,</if>
+        </set>
         where id = #{id}
     </update>
 

+ 12 - 12
ems/sql/ems_init_data.sql

@@ -315,12 +315,12 @@ INSERT INTO `adm_ems_obj_attr_enum` (`model_code`, `attr_key`, `attr_value`, `at
 INSERT INTO `adm_ems_obj_attr_enum` (`model_code`, `attr_key`, `attr_value`, `attr_value_name`) VALUES ('M_W2_QF_GEEKOPEN', 'onState', '2', '通电');
 
 -- 对象能力DEMO数据
-INSERT INTO `adm_ems_obj_ability` (`model_code`, `ability_key`, `ability_name`, `ability_desc`, `ability_param`, `hidden_flag`) VALUES ('M_W2_QF_GEEKOPEN', 'event-0', '设备-断电', '控制设备通断', '{\"type\":\"event\",\"key\":0}', 1);
-INSERT INTO `adm_ems_obj_ability` (`model_code`, `ability_key`, `ability_name`, `ability_desc`, `ability_param`, `hidden_flag`) VALUES ('M_W2_QF_GEEKOPEN', 'event-1', '设备-通电', '控制设备通断', '{\"type\":\"event\",\"key\":1}', 1);
-INSERT INTO `adm_ems_obj_ability` (`model_code`, `ability_key`, `ability_name`, `ability_desc`, `ability_param`, `hidden_flag`) VALUES ('M_W2_QF_GEEKOPEN', 'keyLock-0', '按键锁定-关闭', '设置按键控制锁-关闭', '{\"type\":\"setting\",\"keyLock\":0}', 1);
-INSERT INTO `adm_ems_obj_ability` (`model_code`, `ability_key`, `ability_name`, `ability_desc`, `ability_param`, `hidden_flag`) VALUES ('M_W2_QF_GEEKOPEN', 'keyLock-1', '按键锁定-开启', '设置按键控制锁-开启', '{\"type\":\"setting\",\"keyLock\":1}', 1);
+INSERT INTO `adm_ems_obj_ability` (`model_code`, `ability_key`, `ability_name`, `ability_desc`, `ability_param`, `hidden_flag`) VALUES ('M_W2_QF_GEEKOPEN', 'Circuit-Closing', '分闸', '控制线路断电', '{\"type\":\"event\",\"key\":0}', 1);
+INSERT INTO `adm_ems_obj_ability` (`model_code`, `ability_key`, `ability_name`, `ability_desc`, `ability_param`, `hidden_flag`) VALUES ('M_W2_QF_GEEKOPEN', 'Circuit-Opening', '合闸', '控制线路通电', '{\"type\":\"event\",\"key\":1}', 1);
+INSERT INTO `adm_ems_obj_ability` (`model_code`, `ability_key`, `ability_name`, `ability_desc`, `ability_param`, `hidden_flag`) VALUES ('M_W2_QF_GEEKOPEN', 'Key-Lock', '按键解锁', '设置按键控制锁-关闭', '{\"type\":\"setting\",\"keyLock\":0}', 1);
+INSERT INTO `adm_ems_obj_ability` (`model_code`, `ability_key`, `ability_name`, `ability_desc`, `ability_param`, `hidden_flag`) VALUES ('M_W2_QF_GEEKOPEN', 'Key-Unlock', '按键锁定', '设置按键控制锁-开启', '{\"type\":\"setting\",\"keyLock\":1}', 1);
 INSERT INTO `adm_ems_obj_ability` (`model_code`, `ability_key`, `ability_name`, `ability_desc`, `ability_param`, `hidden_flag`) VALUES ('M_W2_QF_GEEKOPEN', 'restart', '软重启', '设备软重启', '{\"type\":\"setting\",\"system\":\"restart\"}', 0);
-INSERT INTO `adm_ems_obj_ability` (`model_code`, `ability_key`, `ability_name`, `ability_desc`, `ability_param`, `hidden_flag`) VALUES ('M_W2_QF_GEEKOPEN', 'settAutoReport', '设置电量信息定时上报', '设置电量信息定时上报(timerEnable:0:关闭上报 1:开启上报) timerInterval: 上报时间间隔单位秒', '{\"type\":\"setting\",\"timerEnable\":1,\"timerInterval\":3600}', 0);
+INSERT INTO `adm_ems_obj_ability` (`model_code`, `ability_key`, `ability_name`, `ability_desc`, `ability_param`, `hidden_flag`) VALUES ('M_W2_QF_GEEKOPEN', 'settAutoReport', '设置电量信息定时上报', '设置电量信息定时上报(timerEnable:0:关闭上报 1:开启上报) timerInterval: 上报时间间隔单位秒', '{\"type\":\"setting\",\"timerEnable\":1,\"timerInterval\":900}', 0);
 INSERT INTO `adm_ems_obj_ability` (`model_code`, `ability_key`, `ability_name`, `ability_desc`, `ability_param`, `hidden_flag`) VALUES ('M_W2_QF_GEEKOPEN', 'setReset', '重置/恢复出厂', '设备恢复出厂设置固定传\"reset\"', '{\"type\":\"setting\",\"system\":\"reset\"}', 0);
 INSERT INTO `adm_ems_obj_ability` (`model_code`, `ability_key`, `ability_name`, `ability_desc`, `ability_param`, `hidden_flag`) VALUES ('M_W2_QF_GEEKOPEN', 'setOnState', '设置默认上电状态', '0:记忆;1:关闭,即断开;2:开启,即通电,默认=1', '{\"type\":\"setting\",\"onState\":1}', 0);
 INSERT INTO `adm_ems_obj_ability` (`model_code`, `ability_key`, `ability_name`, `ability_desc`, `ability_param`, `hidden_flag`) VALUES ('M_W2_QF_GEEKOPEN', 'syncProtocol', '同步设备通讯信息', '获取设备通讯信息', '{\"type\":\"protocol\"}', 0);
@@ -522,15 +522,15 @@ INSERT INTO adm_area_elec_attr (`area_code`, `price_code`, `req_capacity_flag`,
 
 -- 国网电价数据
 -- 单一制初始电价数据
-INSERT INTO adm_gw_elecprice_config (`cfg_code`, `elec_type`, `voltage_level`, `degree_price`, `fs_peak_degree_price`, `fs_high_degree_price`, `fs_flat_degree_price`, `fs_low_degree_price`, `max_req_price`, `trans_capacity_price`) VALUES ('3001', 3, '不满1千伏', 0.7624, 1.5296, 1.2747, 0.7624, 0.3445, NULL, NULL);
-INSERT INTO adm_gw_elecprice_config (`cfg_code`, `elec_type`, `voltage_level`, `degree_price`, `fs_peak_degree_price`, `fs_high_degree_price`, `fs_flat_degree_price`, `fs_low_degree_price`, `max_req_price`, `trans_capacity_price`) VALUES ('3002', 3, '1-10(20)千伏', 0.7364, 1.4774, 1.2312, 0.7364, 0.3327, NULL, NULL);
-INSERT INTO adm_gw_elecprice_config (`cfg_code`, `elec_type`, `voltage_level`, `degree_price`, `fs_peak_degree_price`, `fs_high_degree_price`, `fs_flat_degree_price`, `fs_low_degree_price`, `max_req_price`, `trans_capacity_price`) VALUES ('3003', 3, '35千伏', 0.7114, 1.4273, 1.1894, 0.7114, 0.3214, NULL, NULL);
+INSERT INTO adm_gw_elecprice_config (`cfg_code`, `elec_type`, `voltage_level`, `degree_price`, `fs_peak_degree_price`, `fs_high_degree_price`, `fs_low_degree_price`, `max_req_price`, `trans_capacity_price`) VALUES ('3001', 3, '不满1千伏', 0.7624, 1.5296, 1.2747,  0.3445, NULL, NULL);
+INSERT INTO adm_gw_elecprice_config (`cfg_code`, `elec_type`, `voltage_level`, `degree_price`, `fs_peak_degree_price`, `fs_high_degree_price`, `fs_low_degree_price`, `max_req_price`, `trans_capacity_price`) VALUES ('3002', 3, '1-10(20)千伏', 0.7364, 1.4774, 1.2312,  0.3327, NULL, NULL);
+INSERT INTO adm_gw_elecprice_config (`cfg_code`, `elec_type`, `voltage_level`, `degree_price`, `fs_peak_degree_price`, `fs_high_degree_price`, `fs_low_degree_price`, `max_req_price`, `trans_capacity_price`) VALUES ('3003', 3, '35千伏', 0.7114, 1.4273, 1.1894,  0.3214, NULL, NULL);
 
 -- 两部制初始电价数据
-INSERT INTO adm_gw_elecprice_config (`cfg_code`, `elec_type`, `voltage_level`, `degree_price`, `fs_peak_degree_price`, `fs_high_degree_price`, `fs_flat_degree_price`, `fs_low_degree_price`, `max_req_price`, `trans_capacity_price`) VALUES ('4001', 4, '1-10(20)千伏', 0.6587, 1.3592, 1.1327, 0.6587, 0.2757, 51.2, 32);
-INSERT INTO adm_gw_elecprice_config (`cfg_code`, `elec_type`, `voltage_level`, `degree_price`, `fs_peak_degree_price`, `fs_high_degree_price`, `fs_flat_degree_price`, `fs_low_degree_price`, `max_req_price`, `trans_capacity_price`) VALUES ('4002', 4, '35千伏', 0.6337, 1.3076, 1.0897, 0.6337, 0.2652, 48, 30);
-INSERT INTO adm_gw_elecprice_config (`cfg_code`, `elec_type`, `voltage_level`, `degree_price`, `fs_peak_degree_price`, `fs_high_degree_price`, `fs_flat_degree_price`, `fs_low_degree_price`, `max_req_price`, `trans_capacity_price`) VALUES ('4003', 4, '110千伏', 0.6087, 1.256, 1.0467, 0.6087, 0.2547, 44.8, 28);
-INSERT INTO adm_gw_elecprice_config (`cfg_code`, `elec_type`, `voltage_level`, `degree_price`, `fs_peak_degree_price`, `fs_high_degree_price`, `fs_flat_degree_price`, `fs_low_degree_price`, `max_req_price`, `trans_capacity_price`) VALUES ('4004', 4, '220千伏及以上', 0.5827, 1.2024, 1.002, 0.5827, 0.2439, 41.6, 26);
+INSERT INTO adm_gw_elecprice_config (`cfg_code`, `elec_type`, `voltage_level`, `degree_price`, `fs_peak_degree_price`, `fs_high_degree_price`, `fs_low_degree_price`, `max_req_price`, `trans_capacity_price`) VALUES ('4001', 4, '1-10(20)千伏', 0.6587, 1.3592, 1.1327,  0.2757, 51.2, 32);
+INSERT INTO adm_gw_elecprice_config (`cfg_code`, `elec_type`, `voltage_level`, `degree_price`, `fs_peak_degree_price`, `fs_high_degree_price`, `fs_low_degree_price`, `max_req_price`, `trans_capacity_price`) VALUES ('4002', 4, '35千伏', 0.6337, 1.3076, 1.0897,  0.2652, 48, 30);
+INSERT INTO adm_gw_elecprice_config (`cfg_code`, `elec_type`, `voltage_level`, `degree_price`, `fs_peak_degree_price`, `fs_high_degree_price`, `fs_low_degree_price`, `max_req_price`, `trans_capacity_price`) VALUES ('4003', 4, '110千伏', 0.6087, 1.256, 1.0467,  0.2547, 44.8, 28);
+INSERT INTO adm_gw_elecprice_config (`cfg_code`, `elec_type`, `voltage_level`, `degree_price`, `fs_peak_degree_price`, `fs_high_degree_price`, `fs_low_degree_price`, `max_req_price`, `trans_capacity_price`) VALUES ('4004', 4, '220千伏及以上', 0.5827, 1.2024, 1.002,  0.2439, 41.6, 26);
 
 
 -- 峰谷电价策略数据

+ 1 - 2
ems/sql/ems_server.sql

@@ -987,10 +987,9 @@ create table adm_gw_elecprice_config (
   `cfg_code`              varchar(4)      not null                     comment '配置代码',
   `elec_type`             int             not null                     comment '用电分类 1-居民 2-农业 3-工业单一制 4-工业两部制',
   `voltage_level`         varchar(32)     not null                     comment '电压等级',
-  `degree_price`          double          not null                     comment '电度用电价格',
+  `degree_price`          double          not null                     comment '单位电价',
   `fs_peak_degree_price`  double          default null                 comment '分时尖峰时段价格',
   `fs_high_degree_price`  double          default null                 comment '分时高峰时段价格',
-  `fs_flat_degree_price`  double          default null                 comment '分时平峰时段价格',
   `fs_low_degree_price`   double          default null                 comment '分时低谷时段价格',
   `max_req_price`         double          default null                 comment '最大需量用电价格',
   `trans_capacity_price`  double          default null                 comment '变压器容量用电价格',