Browse Source

策略参数&步骤管理

lv.wenbin 9 months ago
parent
commit
a930045f72
22 changed files with 996 additions and 93 deletions
  1. 15 15
      ems-cloud/ems-modules/ems-server/src/main/java/com/ruoyi/ems/controller/ElecPvSupplyHController.java
  2. 210 15
      ems-cloud/ems-modules/ems-server/src/main/java/com/ruoyi/ems/controller/OpEnergyStrategyController.java
  3. 1 1
      ems-cloud/ems-modules/ems-server/src/main/java/com/ruoyi/ems/domain/ElecPvSupplyH.java
  4. 6 0
      ems-cloud/ems-modules/ems-server/src/main/java/com/ruoyi/ems/domain/OpEnergyStrategy.java
  5. 113 0
      ems-cloud/ems-modules/ems-server/src/main/java/com/ruoyi/ems/domain/OpEnergyStrategyParam.java
  6. 140 0
      ems-cloud/ems-modules/ems-server/src/main/java/com/ruoyi/ems/domain/OpEnergyStrategyStep.java
  7. 71 0
      ems-cloud/ems-modules/ems-server/src/main/java/com/ruoyi/ems/domain/vo/ParamOption.java
  8. 7 7
      ems-cloud/ems-modules/ems-server/src/main/java/com/ruoyi/ems/mapper/ElecPvSupplyHMapper.java
  9. 34 0
      ems-cloud/ems-modules/ems-server/src/main/java/com/ruoyi/ems/mapper/OpEnergyStrategyParamMapper.java
  10. 54 0
      ems-cloud/ems-modules/ems-server/src/main/java/com/ruoyi/ems/mapper/OpEnergyStrategyStepMapper.java
  11. 6 6
      ems-cloud/ems-modules/ems-server/src/main/java/com/ruoyi/ems/service/IElecPvSupplyHService.java
  12. 29 0
      ems-cloud/ems-modules/ems-server/src/main/java/com/ruoyi/ems/service/IOpEnergyStrategyParamService.java
  13. 54 0
      ems-cloud/ems-modules/ems-server/src/main/java/com/ruoyi/ems/service/IOpEnergyStrategyStepService.java
  14. 6 6
      ems-cloud/ems-modules/ems-server/src/main/java/com/ruoyi/ems/service/impl/ElecPvSupplyHServiceImpl.java
  15. 37 0
      ems-cloud/ems-modules/ems-server/src/main/java/com/ruoyi/ems/service/impl/OpEnergyStrategyParamServiceImpl.java
  16. 14 21
      ems-cloud/ems-modules/ems-server/src/main/java/com/ruoyi/ems/service/impl/OpEnergyStrategyServiceImpl.java
  17. 47 0
      ems-cloud/ems-modules/ems-server/src/main/java/com/ruoyi/ems/service/impl/OpEnergyStrategyStepServiceImpl.java
  18. 6 6
      ems-cloud/ems-modules/ems-server/src/main/resources/mapper/ems/ElecPvSupplyHMapper.xml
  19. 31 0
      ems-cloud/ems-modules/ems-server/src/main/resources/mapper/ems/OpEnergyStrategyParamMapper.xml
  20. 79 0
      ems-cloud/ems-modules/ems-server/src/main/resources/mapper/ems/OpEnergyStrategyStepMapper.xml
  21. 25 0
      ems-cloud/sql/ems_init_data.sql
  22. 11 16
      ems-cloud/sql/ems_server.sql

+ 15 - 15
ems-cloud/ems-modules/ems-server/src/main/java/com/ruoyi/ems/controller/ElecPvSupplyHController.java

@@ -19,7 +19,7 @@ import com.ruoyi.common.core.web.page.TableDataInfo;
 import com.ruoyi.common.log.annotation.Log;
 import com.ruoyi.common.log.enums.BusinessType;
 import com.ruoyi.common.security.annotation.RequiresPermissions;
-import com.ruoyi.ems.domain.PvSupplyH;
+import com.ruoyi.ems.domain.ElecPvSupplyH;
 import com.ruoyi.ems.service.IElecPvSupplyHService;
 
 import io.swagger.annotations.Api;
@@ -42,36 +42,36 @@ public class ElecPvSupplyHController extends BaseController {
      */
     @RequiresPermissions("ems:prod:list")
     @GetMapping("/list")
-    public TableDataInfo list(PvSupplyH pvSupplyH) {
+    public TableDataInfo list(ElecPvSupplyH pvSupplyH) {
         startPage();
-        List<PvSupplyH> list = pvSupplyHService.selectPvSupplyHList(pvSupplyH);
+        List<ElecPvSupplyH> list = pvSupplyHService.selectPvSupplyHList(pvSupplyH);
         return getDataTable(list);
     }
     @RequiresPermissions("ems:prod:list")
     @GetMapping("/list/prod/this/day/index")
-    public AjaxResult listProdIndex(PvSupplyH pvSupplyH) {
+    public AjaxResult listProdIndex(ElecPvSupplyH pvSupplyH) {
         pvSupplyH.setDate(DateUtils.getNowDate());
-        List<PvSupplyH> list = pvSupplyHService.selectAreaSupplyH(pvSupplyH);
+        List<ElecPvSupplyH> list = pvSupplyHService.selectAreaSupplyH(pvSupplyH);
         return success(list);
     }
 
     @RequiresPermissions("ems:prod:list")
     @GetMapping("/list/prod/this/month/index")
-    public AjaxResult listProdMonthIndex(PvSupplyH pvSupplyH) {
-        List<PvSupplyH> list = pvSupplyHService.selectAreaSupplyH(pvSupplyH);
+    public AjaxResult listProdMonthIndex(ElecPvSupplyH pvSupplyH) {
+        List<ElecPvSupplyH> list = pvSupplyHService.selectAreaSupplyH(pvSupplyH);
         return success(list);
     }
 
     @RequiresPermissions("ems:prod:list")
     @GetMapping("/list/prod/this/year/index")
-    public AjaxResult listProdYearIndex(PvSupplyH pvSupplyH) {
-        List<PvSupplyH> list = pvSupplyHService.selectAreaSupplyH(pvSupplyH);
+    public AjaxResult listProdYearIndex(ElecPvSupplyH pvSupplyH) {
+        List<ElecPvSupplyH> list = pvSupplyHService.selectAreaSupplyH(pvSupplyH);
         return success(list);
     }
 
     @RequiresPermissions("ems:prod:list")
     @GetMapping("/list/prod/this/day/total")
-    public AjaxResult listProdThisDayTotalIndex(PvSupplyH pvSupplyH) {
+    public AjaxResult listProdThisDayTotalIndex(ElecPvSupplyH pvSupplyH) {
         List<Map<String, Object>> list = pvSupplyHService
             .selectAreaSupplyHByThisDay(pvSupplyH.getAreaCode());
         return success(list);
@@ -79,7 +79,7 @@ public class ElecPvSupplyHController extends BaseController {
 
     @RequiresPermissions("ems:prod:list")
     @GetMapping("/list/prod/this/month/total")
-    public AjaxResult listProdThisMonthTotalIndex(PvSupplyH pvSupplyH) {
+    public AjaxResult listProdThisMonthTotalIndex(ElecPvSupplyH pvSupplyH) {
         List<Map<String, Object>> list = pvSupplyHService
             .selectAreaSupplyHByRefMonth(pvSupplyH.getAreaCode());
         return success(list);
@@ -87,7 +87,7 @@ public class ElecPvSupplyHController extends BaseController {
 
     @RequiresPermissions("ems:prod:list")
     @GetMapping("/list/prod/this/year/total")
-    public AjaxResult listProdThisYearTotalIndex(PvSupplyH pvSupplyH) {
+    public AjaxResult listProdThisYearTotalIndex(ElecPvSupplyH pvSupplyH) {
         List<Map<String, Object>> list = pvSupplyHService.selectAreaSupplyHByYear(pvSupplyH.getAreaCode());
         return success(list);
     }
@@ -98,9 +98,9 @@ public class ElecPvSupplyHController extends BaseController {
     @RequiresPermissions("ems:prod:export")
     @Log(title = "光伏并网计量光伏并网计量-小时", businessType = BusinessType.EXPORT)
     @PostMapping("/export")
-    public void export(HttpServletResponse response, PvSupplyH pvSupplyH) {
-        List<PvSupplyH> list = pvSupplyHService.selectPvSupplyHList(pvSupplyH);
-        ExcelUtil<PvSupplyH> util = new ExcelUtil<PvSupplyH>(PvSupplyH.class);
+    public void export(HttpServletResponse response, ElecPvSupplyH pvSupplyH) {
+        List<ElecPvSupplyH> list = pvSupplyHService.selectPvSupplyHList(pvSupplyH);
+        ExcelUtil<ElecPvSupplyH> util = new ExcelUtil<ElecPvSupplyH>(ElecPvSupplyH.class);
         util.exportExcel(response, list, "光伏并网计量光伏并网计量-小时数据");
     }
 }

+ 210 - 15
ems-cloud/ems-modules/ems-server/src/main/java/com/ruoyi/ems/controller/OpEnergyStrategyController.java

@@ -1,5 +1,6 @@
 package com.ruoyi.ems.controller;
 
+import com.alibaba.fastjson2.JSONObject;
 import com.ruoyi.common.core.web.controller.BaseController;
 import com.ruoyi.common.core.web.domain.AjaxResult;
 import com.ruoyi.common.core.web.page.TableDataInfo;
@@ -7,8 +8,15 @@ import com.ruoyi.common.log.annotation.Log;
 import com.ruoyi.common.log.enums.BusinessType;
 import com.ruoyi.common.security.annotation.RequiresPermissions;
 import com.ruoyi.ems.domain.OpEnergyStrategy;
+import com.ruoyi.ems.domain.OpEnergyStrategyParam;
+import com.ruoyi.ems.domain.OpEnergyStrategyStep;
+import com.ruoyi.ems.domain.vo.ParamOption;
+import com.ruoyi.ems.service.IOpEnergyStrategyParamService;
 import com.ruoyi.ems.service.IOpEnergyStrategyService;
+import com.ruoyi.ems.service.IOpEnergyStrategyStepService;
+import com.ruoyi.ems.util.exception.BusinessException;
 import io.swagger.annotations.Api;
+import org.apache.commons.collections4.CollectionUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.DeleteMapping;
 import org.springframework.web.bind.annotation.GetMapping;
@@ -17,9 +25,15 @@ import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.PutMapping;
 import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestParam;
 import org.springframework.web.bind.annotation.RestController;
 
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashMap;
 import java.util.List;
+import java.util.Map;
+import java.util.stream.Collectors;
 
 /**
  * 能源策略Controller
@@ -30,18 +44,37 @@ import java.util.List;
 @RestController
 @RequestMapping("/energyStrategy")
 @Api(value = "OpEnergyStrategyController", description = "能源策略管理接口")
-public class OpEnergyStrategyController extends BaseController
-{
+public class OpEnergyStrategyController extends BaseController {
     @Autowired
     private IOpEnergyStrategyService strategyService;
 
+    @Autowired
+    private IOpEnergyStrategyParamService paramService;
+
+    @Autowired
+    private IOpEnergyStrategyStepService stepService;
+
+    private static final Map<String, List<ParamOption>> PARAM_OPTIONS = new HashMap<>();
+
+    static {
+        List<ParamOption> dcList = Arrays.asList(new ParamOption("maxPowerTrack", "最大功率点跟踪(MPPT)", "通过实时调整光伏阵列的工作状态,使光伏系统始终运行在最大功率点"),
+            new ParamOption("inverterControl", "逆变器控制", "通过光伏逆变器实施控制"),
+            new ParamOption("powerAndVoltage", "无功功率及电压控制", "根据电网需求,通过调节光伏系统输出的无功功率和电压,实现电压稳定和电力因素的优化"));
+
+        PARAM_OPTIONS.put("default.controlMode", dcList);
+
+        List<ParamOption> diList = Arrays.asList(
+            new ParamOption("svpwm", "空间矢量控制(SVPWM)", "通过对逆变器开关状态的优化控制,实现并网电流的高精度控制"),
+            new ParamOption("dtc", "直流转矩控制", "以控制逆变器输出转矩和磁链为目标,快速响应"));
+
+        PARAM_OPTIONS.put("inverterControl.controlMode", diList);
+    }
+
     /**
      * 查询能源策略列表
      */
-    @RequiresPermissions("power-mgr:strategy:list")
     @GetMapping("/list")
-    public TableDataInfo list(OpEnergyStrategy strategy)
-    {
+    public TableDataInfo list(OpEnergyStrategy strategy) {
         startPage();
         List<OpEnergyStrategy> list = strategyService.selectStrategyList(strategy);
         return getDataTable(list);
@@ -50,10 +83,8 @@ public class OpEnergyStrategyController extends BaseController
     /**
      * 获取能源策略详细信息
      */
-    @RequiresPermissions("power-mgr:strategy:query")
     @GetMapping(value = "/{id}")
-    public AjaxResult getInfo(@PathVariable("id") Long id)
-    {
+    public AjaxResult getInfo(@PathVariable("id") Long id) {
         return success(strategyService.selectStrategyById(id));
     }
 
@@ -63,8 +94,7 @@ public class OpEnergyStrategyController extends BaseController
     @RequiresPermissions("power-mgr:strategy:add")
     @Log(title = "能源策略", businessType = BusinessType.INSERT)
     @PostMapping
-    public AjaxResult add(@RequestBody OpEnergyStrategy strategy)
-    {
+    public AjaxResult add(@RequestBody OpEnergyStrategy strategy) {
         return toAjax(strategyService.insertStrategy(strategy));
     }
 
@@ -74,8 +104,7 @@ public class OpEnergyStrategyController extends BaseController
     @RequiresPermissions("power-mgr:strategy:edit")
     @Log(title = "能源策略", businessType = BusinessType.UPDATE)
     @PutMapping
-    public AjaxResult edit(@RequestBody OpEnergyStrategy strategy)
-    {
+    public AjaxResult edit(@RequestBody OpEnergyStrategy strategy) {
         return toAjax(strategyService.updateStrategy(strategy));
     }
 
@@ -84,9 +113,175 @@ public class OpEnergyStrategyController extends BaseController
      */
     @RequiresPermissions("power-mgr:strategy:remove")
     @Log(title = "能源策略", businessType = BusinessType.DELETE)
-	@DeleteMapping("/{ids}")
-    public AjaxResult remove(@PathVariable Long[] ids)
-    {
+    @DeleteMapping("/{ids}")
+    public AjaxResult remove(@PathVariable Long[] ids) {
         return toAjax(strategyService.deleteStrategyByIds(ids));
     }
+
+    /**
+     * 获取能源策略参数
+     *
+     * @param strategyCode 策略编码
+     * @return 参数集合
+     */
+    @GetMapping(value = "/param")
+    public AjaxResult getStrategyParam(@RequestParam(name = "strategyCode") String strategyCode) {
+        // 补充策略参数
+        List<OpEnergyStrategyParam> paramList = paramService.selectParamByStrategyCode(strategyCode);
+        return success(buildStrategyParams(paramList));
+    }
+
+    /**
+     * 修改能源策略
+     */
+    @RequiresPermissions("power-mgr:strategy:edit")
+    @Log(title = "能源策略参数", businessType = BusinessType.UPDATE)
+    @PutMapping("/param")
+    public AjaxResult editParam(@RequestBody OpEnergyStrategyParam strategyParam) {
+        AjaxResult result = null;
+
+        try {
+            int updateCnt = paramService.updateParamValue(strategyParam);
+            result = toAjax(updateCnt);
+        }
+        catch (BusinessException e) {
+            result = error(e.getMessage());
+        }
+
+        return result;
+    }
+
+    /**
+     * 获取能源策略执行步骤
+     *
+     * @param strategyCode 策略编码
+     * @return 步骤列表
+     */
+    @GetMapping(value = "/step")
+    public AjaxResult getStrategyStep(@RequestParam(name = "strategyCode") String strategyCode) {
+        return success(stepService.selectStepByStrategyCode(strategyCode));
+    }
+
+    /**
+     * 新增能源策略执行步骤
+     *
+     * @param strategyStep 策略步骤
+     * @return 步骤列表
+     */
+    @PostMapping(value = "/step")
+    public AjaxResult addStrategyStep(OpEnergyStrategyStep strategyStep) {
+        return toAjax(stepService.insertStep(strategyStep));
+    }
+
+    /**
+     * 删除能源策略执行步骤
+     *
+     * @param strategyCode 策略代码
+     * @return 步骤列表
+     */
+    @DeleteMapping(value = "/step")
+    public AjaxResult delStrategyStep(@RequestParam(name = "strategyCode") String strategyCode) {
+        return toAjax(stepService.deleteStepByStrategyCode(strategyCode));
+    }
+
+    /**
+     * 修改能源策略执行步骤
+     *
+     * @param strategyStep 策略步骤
+     * @return 步骤列表
+     */
+    @PutMapping(value = "/step")
+    public AjaxResult editStrategyStep(OpEnergyStrategyStep strategyStep) {
+        return toAjax(stepService.updateStep(strategyStep));
+    }
+
+    /**
+     * 修改能源策略执行步骤
+     *
+     * @param strategySteps 策略步骤
+     * @return 步骤列表
+     */
+    @PutMapping(value = "/step/batch")
+    public AjaxResult editStrategyStep(List<OpEnergyStrategyStep> strategySteps) {
+        stepService.deleteStepByStrategyCode(strategySteps.get(0).getStrategyCode());
+        return toAjax(stepService.insertStepBatch(strategySteps));
+    }
+
+    /**
+     * 获取能源策略参数选项
+     *
+     * @param strategyType 策略类型
+     * @param paramKey     参数键
+     * @return 选项
+     */
+    @GetMapping(value = "/param/option")
+    public AjaxResult getStrategyParamOption(@RequestParam(name = "strategyType") int strategyType,
+        @RequestParam(name = "paramKey") String paramKey) {
+        List<ParamOption> options = null;
+
+        switch (strategyType) {
+            case 1:
+                options = getYwParamOption(paramKey);
+                break;
+            case 2:
+                options = getYhParamOption(paramKey);
+                break;
+            case 3:
+                options = getWcParamOption(paramKey);
+                break;
+        }
+
+        return CollectionUtils.isNotEmpty(options) ? success(options) : success(new ArrayList<>());
+    }
+
+    private List<ParamOption> getYwParamOption(String paramKey) {
+        return PARAM_OPTIONS.get(paramKey);
+    }
+
+    private List<ParamOption> getYhParamOption(String paramKey) {
+        return null;
+    }
+
+    private List<ParamOption> getWcParamOption(String paramKey) {
+        return null;
+    }
+
+    private Map<String, Map<String, JSONObject>> buildStrategyParams(List<OpEnergyStrategyParam> paramList) {
+        Map<String, Map<String, JSONObject>> params = new HashMap<>();
+
+        Map<String, List<OpEnergyStrategyParam>> groupedMap = paramList.stream()
+            .collect(Collectors.groupingBy(OpEnergyStrategyParam::getParamGroup, Collectors.toList()));
+
+        for (Map.Entry<String, List<OpEnergyStrategyParam>> entry : groupedMap.entrySet()) {
+            String groupName = entry.getKey();
+            List<OpEnergyStrategyParam> groupParams = entry.getValue();
+
+            if (params.containsKey(groupName)) {
+                Map<String, JSONObject> groupParamMap = params.get(groupName);
+
+                for (OpEnergyStrategyParam param : groupParams) {
+                    JSONObject option = new JSONObject();
+                    option.put("paramName", param.getParamName());
+                    option.put("paramValue", param.getParamValue());
+                    option.put("editEnable", param.getEditEnable());
+                    groupParamMap.put(param.getParamKey(), option);
+                }
+            }
+            else {
+                Map<String, JSONObject> groupParamMap = new HashMap<>();
+
+                for (OpEnergyStrategyParam param : groupParams) {
+                    JSONObject option = new JSONObject();
+                    option.put("paramName", param.getParamName());
+                    option.put("paramValue", param.getParamValue());
+                    option.put("editEnable", param.getEditEnable());
+                    groupParamMap.put(param.getParamKey(), option);
+                }
+
+                params.put(groupName, groupParamMap);
+            }
+        }
+
+        return params;
+    }
 }

+ 1 - 1
ems-cloud/ems-modules/ems-server/src/main/java/com/ruoyi/ems/domain/PvSupplyH.java → ems-cloud/ems-modules/ems-server/src/main/java/com/ruoyi/ems/domain/ElecPvSupplyH.java

@@ -13,7 +13,7 @@ import java.util.Date;
  * @author ruoyi
  * @date 2024-08-02
  */
-public class PvSupplyH extends BaseEntity {
+public class ElecPvSupplyH extends BaseEntity {
     private static final long serialVersionUID = 1L;
 
     /**

+ 6 - 0
ems-cloud/ems-modules/ems-server/src/main/java/com/ruoyi/ems/domain/OpEnergyStrategy.java

@@ -1,9 +1,15 @@
 package com.ruoyi.ems.domain;
 
+import com.alibaba.fastjson2.JSONObject;
 import com.ruoyi.common.core.web.domain.BaseEntity;
 import org.apache.commons.lang3.builder.ToStringBuilder;
 import org.apache.commons.lang3.builder.ToStringStyle;
 
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
 /**
  * 能源策略对象 adm_op_energy_strategy
  *

+ 113 - 0
ems-cloud/ems-modules/ems-server/src/main/java/com/ruoyi/ems/domain/OpEnergyStrategyParam.java

@@ -0,0 +1,113 @@
+package com.ruoyi.ems.domain;
+
+import org.apache.commons.lang3.builder.ToStringBuilder;
+import org.apache.commons.lang3.builder.ToStringStyle;
+import com.ruoyi.common.core.annotation.Excel;
+import com.ruoyi.common.core.web.domain.BaseEntity;
+
+/**
+ * 能源策略参数对象 adm_op_energy_strategy_param
+ * 
+ * @author ruoyi
+ * @date 2024-10-14
+ */
+public class OpEnergyStrategyParam
+{
+    /** 序号 */
+    private Long id;
+
+    /** 策略代码 */
+    private String strategyCode;
+
+    /** 策略分组 */
+    private String paramGroup;
+
+    /** 参数键值 */
+    private String paramKey;
+
+    /** 参数名称 */
+    private String paramName;
+
+    /** 参数值 */
+    private String paramValue;
+
+    /** 可编辑 */
+    private Long editEnable;
+
+    public void setId(Long id) 
+    {
+        this.id = id;
+    }
+
+    public Long getId() 
+    {
+        return id;
+    }
+    public void setStrategyCode(String strategyCode) 
+    {
+        this.strategyCode = strategyCode;
+    }
+
+    public String getStrategyCode() 
+    {
+        return strategyCode;
+    }
+    public void setParamGroup(String paramGroup) 
+    {
+        this.paramGroup = paramGroup;
+    }
+
+    public String getParamGroup() 
+    {
+        return paramGroup;
+    }
+    public void setParamKey(String paramKey) 
+    {
+        this.paramKey = paramKey;
+    }
+
+    public String getParamKey() 
+    {
+        return paramKey;
+    }
+    public void setParamName(String paramName) 
+    {
+        this.paramName = paramName;
+    }
+
+    public String getParamName() 
+    {
+        return paramName;
+    }
+    public void setParamValue(String paramValue) 
+    {
+        this.paramValue = paramValue;
+    }
+
+    public String getParamValue() 
+    {
+        return paramValue;
+    }
+    public void setEditEnable(Long editEnable) 
+    {
+        this.editEnable = editEnable;
+    }
+
+    public Long getEditEnable() 
+    {
+        return editEnable;
+    }
+
+    @Override
+    public String toString() {
+        return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
+            .append("id", getId())
+            .append("strategyCode", getStrategyCode())
+            .append("paramGroup", getParamGroup())
+            .append("paramKey", getParamKey())
+            .append("paramName", getParamName())
+            .append("paramValue", getParamValue())
+            .append("editEnable", getEditEnable())
+            .toString();
+    }
+}

+ 140 - 0
ems-cloud/ems-modules/ems-server/src/main/java/com/ruoyi/ems/domain/OpEnergyStrategyStep.java

@@ -0,0 +1,140 @@
+package com.ruoyi.ems.domain;
+
+import org.apache.commons.lang3.builder.ToStringBuilder;
+import org.apache.commons.lang3.builder.ToStringStyle;
+import com.ruoyi.common.core.annotation.Excel;
+import com.ruoyi.common.core.web.domain.BaseEntity;
+
+/**
+ * 能源策略步骤对象 adm_op_energy_strategy_step
+ * 
+ * @author ruoyi
+ * @date 2024-10-14
+ */
+public class OpEnergyStrategyStep
+{
+    /** 序号 */
+    private Long id;
+
+    /** 策略代码 */
+    private String strategyCode;
+
+    /** 步骤代码 */
+    private String stepCode;
+
+    /** 步骤名称 */
+    private String stepName;
+
+    /** 步骤顺序 */
+    private Long stepIndex;
+
+    /** 步骤处理 */
+    private String stepHandler;
+
+    /** 步骤参数 */
+    private String stepParam;
+
+    /** 目标设施 */
+    private String targetFacs;
+
+    /** 目标设备 */
+    private String targetDevice;
+
+    public void setId(Long id) 
+    {
+        this.id = id;
+    }
+
+    public Long getId() 
+    {
+        return id;
+    }
+
+    public void setStrategyCode(String strategyCode) 
+    {
+        this.strategyCode = strategyCode;
+    }
+
+    public String getStrategyCode() 
+    {
+        return strategyCode;
+    }
+    public void setStepCode(String stepCode) 
+    {
+        this.stepCode = stepCode;
+    }
+
+    public String getStepCode() 
+    {
+        return stepCode;
+    }
+    public void setStepName(String stepName) 
+    {
+        this.stepName = stepName;
+    }
+
+    public String getStepName() 
+    {
+        return stepName;
+    }
+    public void setStepIndex(Long stepIndex) 
+    {
+        this.stepIndex = stepIndex;
+    }
+
+    public Long getStepIndex() 
+    {
+        return stepIndex;
+    }
+    public void setStepHandler(String stepHandler) 
+    {
+        this.stepHandler = stepHandler;
+    }
+
+    public String getStepHandler() 
+    {
+        return stepHandler;
+    }
+    public void setStepParam(String stepParam) 
+    {
+        this.stepParam = stepParam;
+    }
+
+    public String getStepParam() 
+    {
+        return stepParam;
+    }
+    public void setTargetFacs(String targetFacs) 
+    {
+        this.targetFacs = targetFacs;
+    }
+
+    public String getTargetFacs() 
+    {
+        return targetFacs;
+    }
+    public void setTargetDevice(String targetDevice) 
+    {
+        this.targetDevice = targetDevice;
+    }
+
+    public String getTargetDevice() 
+    {
+        return targetDevice;
+    }
+
+    @Override
+    public String toString() {
+        return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
+            .append("id", getId())
+            .append("strategyCode", getStrategyCode())
+            .append("stepCode", getStepCode())
+            .append("stepName", getStepName())
+            .append("stepIndex", getStepIndex())
+            .append("stepHandler", getStepHandler())
+            .append("stepParam", getStepParam())
+            .append("targetFacs", getTargetFacs())
+            .append("targetDevice", getTargetDevice())
+            .toString();
+    }
+}

+ 71 - 0
ems-cloud/ems-modules/ems-server/src/main/java/com/ruoyi/ems/domain/vo/ParamOption.java

@@ -0,0 +1,71 @@
+/*
+ * 文 件 名:  ParamOption
+ * 版    权:  浩鲸云计算科技股份有限公司
+ * 描    述:  <描述>
+ * 修 改 人:  lvwenbin
+ * 修改时间:  2024/10/14
+ * 跟踪单号:  <跟踪单号>
+ * 修改单号:  <修改单号>
+ * 修改内容:  <修改内容>
+ */
+package com.ruoyi.ems.domain.vo;
+
+/**
+ * 参数选项
+ * <功能详细描述>
+ *
+ * @author lvwenbin
+ * @version [版本号, 2024/10/14]
+ * @see [相关类/方法]
+ * @since [产品/模块版本]
+ */
+public class ParamOption {
+    public ParamOption() {
+    }
+
+    public ParamOption(String key, String name, String desc) {
+        this.key = key;
+        this.name = name;
+        this.desc = desc;
+    }
+
+    private String key;
+
+    private String name;
+
+    private String value;
+
+    private String desc;
+
+    public String getKey() {
+        return key;
+    }
+
+    public void setKey(String key) {
+        this.key = key;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    public String getValue() {
+        return value;
+    }
+
+    public void setValue(String value) {
+        this.value = value;
+    }
+
+    public String getDesc() {
+        return desc;
+    }
+
+    public void setDesc(String desc) {
+        this.desc = desc;
+    }
+}

+ 7 - 7
ems-cloud/ems-modules/ems-server/src/main/java/com/ruoyi/ems/mapper/ElecPvSupplyHMapper.java

@@ -6,7 +6,7 @@ import java.util.Map;
 import org.apache.ibatis.annotations.MapKey;
 import org.apache.ibatis.annotations.Param;
 
-import com.ruoyi.ems.domain.PvSupplyH;
+import com.ruoyi.ems.domain.ElecPvSupplyH;
 
 /**
  * 光伏并网计量光伏并网计量-小时Mapper接口
@@ -22,7 +22,7 @@ public interface ElecPvSupplyHMapper
      * @param id 光伏并网计量光伏并网计量-小时主键
      * @return 光伏并网计量光伏并网计量-小时
      */
-     PvSupplyH selectPvSupplyHById(Long id);
+     ElecPvSupplyH selectPvSupplyHById(Long id);
 
     /**
      * 查询光伏并网计量光伏并网计量-小时列表
@@ -30,16 +30,16 @@ public interface ElecPvSupplyHMapper
      * @param pvSupplyH 光伏并网计量光伏并网计量-小时
      * @return 光伏并网计量光伏并网计量-小时集合
      */
-     List<PvSupplyH> selectPvSupplyHList(PvSupplyH pvSupplyH);
+     List<ElecPvSupplyH> selectPvSupplyHList(ElecPvSupplyH pvSupplyH);
 
-    List<PvSupplyH> selectPvSupplyHAll(PvSupplyH pvSupplyH);
+    List<ElecPvSupplyH> selectPvSupplyHAll(ElecPvSupplyH pvSupplyH);
 
     Map<String, Object> calThisDayPv(@Param("thisDay") String thisDay);
 
     @MapKey("timeIndex")
     Map<String, Map<String, Object>> calThisDayPvByH(@Param("thisDay") String thisDay);
 
-     List<PvSupplyH> selectAreaSupplyH(PvSupplyH pvSupplyH);
+     List<ElecPvSupplyH> selectAreaSupplyH(ElecPvSupplyH pvSupplyH);
 
 
     List<Map<String,Object>> selectAreaSupplyByDate(@Param("areaCode")String areaCode, @Param("date")String date);
@@ -54,7 +54,7 @@ public interface ElecPvSupplyHMapper
      * @param pvSupplyH 光伏并网计量光伏并网计量-小时
      * @return 结果
      */
-     int insertPvSupplyH(PvSupplyH pvSupplyH);
+     int insertPvSupplyH(ElecPvSupplyH pvSupplyH);
 
     /**
      * 修改光伏并网计量光伏并网计量-小时
@@ -62,7 +62,7 @@ public interface ElecPvSupplyHMapper
      * @param pvSupplyH 光伏并网计量光伏并网计量-小时
      * @return 结果
      */
-     int updatePvSupplyH(PvSupplyH pvSupplyH);
+     int updatePvSupplyH(ElecPvSupplyH pvSupplyH);
 
     /**
      * 删除光伏并网计量光伏并网计量-小时

+ 34 - 0
ems-cloud/ems-modules/ems-server/src/main/java/com/ruoyi/ems/mapper/OpEnergyStrategyParamMapper.java

@@ -0,0 +1,34 @@
+package com.ruoyi.ems.mapper;
+
+import java.util.List;
+
+import com.ruoyi.ems.domain.OpEnergyStrategyParam;
+import org.apache.ibatis.annotations.Param;
+
+/**
+ * 能源策略参数Mapper接口
+ *
+ * @author ruoyi
+ * @date 2024-10-14
+ */
+public interface OpEnergyStrategyParamMapper {
+
+    /**
+     * 查询能源策略参数列表
+     *
+     * @param strategyCode 能源策略编码
+     * @return 能源策略参数集合
+     */
+    List<OpEnergyStrategyParam> selectParamByStrategyCode(@Param("strategyCode") String strategyCode);
+
+    /**
+     * 修改能源策略参数
+     * @param strategyCode 策略编码
+     * @param paramGroup 参数分组
+     * @param paramKey 参数key
+     * @param paramValue 参数value
+     * @return 修改记录数
+     */
+    int updateParamValue(@Param("strategyCode") String strategyCode, @Param("paramGroup") String paramGroup,
+        @Param("paramKey") String paramKey, @Param("paramValue") String paramValue);
+}

+ 54 - 0
ems-cloud/ems-modules/ems-server/src/main/java/com/ruoyi/ems/mapper/OpEnergyStrategyStepMapper.java

@@ -0,0 +1,54 @@
+package com.ruoyi.ems.mapper;
+
+import java.util.List;
+import com.ruoyi.ems.domain.OpEnergyStrategyStep;
+import org.apache.ibatis.annotations.Param;
+
+/**
+ * 能源策略步骤Mapper接口
+ * 
+ * @author ruoyi
+ * @date 2024-10-14
+ */
+public interface OpEnergyStrategyStepMapper
+{
+    /**
+     * 查询能源策略步骤列表
+     * 
+     * @param strategyCode 能源策略步骤code
+     * @return 能源策略步骤集合
+     */
+     List<OpEnergyStrategyStep> selectStepByStrategyCode(@Param("strategyCode") String strategyCode);
+
+    /**
+     * 新增能源策略步骤
+     * 
+     * @param strategyStep 能源策略步骤
+     * @return 结果
+     */
+     int insertStep(OpEnergyStrategyStep strategyStep);
+
+    /**
+     * 新增能源策略步骤
+     *
+     * @param list 能源策略步骤列表
+     * @return 结果
+     */
+    int insertStepBatch(List<OpEnergyStrategyStep> list);
+
+    /**
+     * 修改能源策略步骤
+     * 
+     * @param Step 能源策略步骤
+     * @return 结果
+     */
+     int updateStep(OpEnergyStrategyStep Step);
+
+    /**
+     * 删除能源策略步骤
+     * 
+     * @param strategyCode 能源策略步骤code
+     * @return 结果
+     */
+     int deleteStepByStrategyCode(@Param("strategyCode") String strategyCode);
+}

+ 6 - 6
ems-cloud/ems-modules/ems-server/src/main/java/com/ruoyi/ems/service/IElecPvSupplyHService.java

@@ -3,7 +3,7 @@ package com.ruoyi.ems.service;
 import java.util.List;
 import java.util.Map;
 
-import com.ruoyi.ems.domain.PvSupplyH;
+import com.ruoyi.ems.domain.ElecPvSupplyH;
 
 /**
  * 光伏并网计量-小时Service接口
@@ -19,7 +19,7 @@ public interface IElecPvSupplyHService
      * @param id 光伏并网计量-小时主键
      * @return 光伏并网计量-小时
      */
-     PvSupplyH selectPvSupplyHById(Long id);
+     ElecPvSupplyH selectPvSupplyHById(Long id);
 
     /**
      * 查询光伏并网计量-小时列表
@@ -27,10 +27,10 @@ public interface IElecPvSupplyHService
      * @param pvSupplyH 光伏并网计量-小时
      * @return 光伏并网计量-小时集合
      */
-     List<PvSupplyH> selectPvSupplyHList(PvSupplyH pvSupplyH);
+     List<ElecPvSupplyH> selectPvSupplyHList(ElecPvSupplyH pvSupplyH);
 
 
-     List<PvSupplyH> selectAreaSupplyH(PvSupplyH pvSupplyH);
+     List<ElecPvSupplyH> selectAreaSupplyH(ElecPvSupplyH pvSupplyH);
 
     List<Map<String, Object>> selectAreaSupplyHByThisDay(String areaCode);
 
@@ -43,7 +43,7 @@ public interface IElecPvSupplyHService
      * @param pvSupplyH 光伏并网计量-小时
      * @return 结果
      */
-     int insertPvSupplyH(PvSupplyH pvSupplyH);
+     int insertPvSupplyH(ElecPvSupplyH pvSupplyH);
 
     /**
      * 修改光伏并网计量-小时
@@ -51,7 +51,7 @@ public interface IElecPvSupplyHService
      * @param pvSupplyH 光伏并网计量-小时
      * @return 结果
      */
-     int updatePvSupplyH(PvSupplyH pvSupplyH);
+     int updatePvSupplyH(ElecPvSupplyH pvSupplyH);
 
     /**
      * 批量删除光伏并网计量-小时

+ 29 - 0
ems-cloud/ems-modules/ems-server/src/main/java/com/ruoyi/ems/service/IOpEnergyStrategyParamService.java

@@ -0,0 +1,29 @@
+package com.ruoyi.ems.service;
+
+import com.ruoyi.ems.domain.OpEnergyStrategyParam;
+
+import java.util.List;
+
+/**
+ * 能源策略参数Service接口
+ *
+ * @author ruoyi
+ * @date 2024-10-14
+ */
+public interface IOpEnergyStrategyParamService {
+    /**
+     * 查询能源策略参数列表
+     *
+     * @param strategyCode 能源策略编码
+     * @return 能源策略参数集合
+     */
+    List<OpEnergyStrategyParam> selectParamByStrategyCode(String strategyCode);
+
+    /**
+     * 修改能源策略参数
+     *
+     * @param strategyParam 策略参数
+     * @return 修改记录数
+     */
+    int updateParamValue(OpEnergyStrategyParam strategyParam);
+}

+ 54 - 0
ems-cloud/ems-modules/ems-server/src/main/java/com/ruoyi/ems/service/IOpEnergyStrategyStepService.java

@@ -0,0 +1,54 @@
+package com.ruoyi.ems.service;
+
+import com.ruoyi.ems.domain.OpEnergyStrategyStep;
+
+import java.util.List;
+
+/**
+ * 能源策略步骤Service接口
+ * 
+ * @author ruoyi
+ * @date 2024-10-14
+ */
+public interface IOpEnergyStrategyStepService
+{
+    /**
+     * 查询能源策略步骤列表
+     * 
+     * @param strategyCode 能源策略步骤
+     * @return 能源策略步骤集合
+     */
+     List<OpEnergyStrategyStep> selectStepByStrategyCode(String strategyCode);
+
+    /**
+     * 新增能源策略步骤
+     * 
+     * @param strategyStep 能源策略步骤
+     * @return 结果
+     */
+     int insertStep(OpEnergyStrategyStep strategyStep);
+
+    /**
+     * 新增能源策略步骤
+     *
+     * @param strategySteps 能源策略步骤列表
+     * @return 结果
+     */
+    int insertStepBatch(List<OpEnergyStrategyStep> strategySteps);
+
+    /**
+     * 修改能源策略步骤
+     * 
+     * @param strategyStep 能源策略步骤
+     * @return 结果
+     */
+     int updateStep(OpEnergyStrategyStep strategyStep);
+
+    /**
+     * 删除能源策略步骤信息
+     * 
+     * @param strategyCode 能源策略步骤code
+     * @return 结果
+     */
+     int deleteStepByStrategyCode(String strategyCode);
+}

+ 6 - 6
ems-cloud/ems-modules/ems-server/src/main/java/com/ruoyi/ems/service/impl/ElecPvSupplyHServiceImpl.java

@@ -8,7 +8,7 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
 import com.ruoyi.common.core.utils.DateTimeUtil;
-import com.ruoyi.ems.domain.PvSupplyH;
+import com.ruoyi.ems.domain.ElecPvSupplyH;
 import com.ruoyi.ems.mapper.ElecPvSupplyHMapper;
 import com.ruoyi.ems.service.IElecPvSupplyHService;
 
@@ -30,7 +30,7 @@ public class ElecPvSupplyHServiceImpl implements IElecPvSupplyHService {
      * @return 光伏并网计量光伏并网计量-小时
      */
     @Override
-    public PvSupplyH selectPvSupplyHById(Long id) {
+    public ElecPvSupplyH selectPvSupplyHById(Long id) {
         return pvSupplyHMapper.selectPvSupplyHById(id);
     }
 
@@ -41,7 +41,7 @@ public class ElecPvSupplyHServiceImpl implements IElecPvSupplyHService {
      * @return 光伏并网计量光伏并网计量-小时
      */
     @Override
-    public List<PvSupplyH> selectPvSupplyHList(PvSupplyH pvSupplyH) {
+    public List<ElecPvSupplyH> selectPvSupplyHList(ElecPvSupplyH pvSupplyH) {
         if (StringUtils.equals("-1", pvSupplyH.getAreaCode())) {
             return pvSupplyHMapper.selectPvSupplyHAll(pvSupplyH);
         }
@@ -51,7 +51,7 @@ public class ElecPvSupplyHServiceImpl implements IElecPvSupplyHService {
     }
 
     @Override
-    public List<PvSupplyH> selectAreaSupplyH(PvSupplyH PvSupplyH) {
+    public List<ElecPvSupplyH> selectAreaSupplyH(ElecPvSupplyH PvSupplyH) {
         return pvSupplyHMapper.selectAreaSupplyH(PvSupplyH);
     }
 
@@ -80,7 +80,7 @@ public class ElecPvSupplyHServiceImpl implements IElecPvSupplyHService {
      * @return 结果
      */
     @Override
-    public int insertPvSupplyH(PvSupplyH pvSupplyH) {
+    public int insertPvSupplyH(ElecPvSupplyH pvSupplyH) {
         return pvSupplyHMapper.insertPvSupplyH(pvSupplyH);
     }
 
@@ -91,7 +91,7 @@ public class ElecPvSupplyHServiceImpl implements IElecPvSupplyHService {
      * @return 结果
      */
     @Override
-    public int updatePvSupplyH(PvSupplyH pvSupplyH) {
+    public int updatePvSupplyH(ElecPvSupplyH pvSupplyH) {
         return pvSupplyHMapper.updatePvSupplyH(pvSupplyH);
     }
 

+ 37 - 0
ems-cloud/ems-modules/ems-server/src/main/java/com/ruoyi/ems/service/impl/OpEnergyStrategyParamServiceImpl.java

@@ -0,0 +1,37 @@
+package com.ruoyi.ems.service.impl;
+
+import java.util.List;
+
+import com.ruoyi.ems.domain.OpEnergyStrategyParam;
+import com.ruoyi.ems.mapper.OpEnergyStrategyParamMapper;
+import com.ruoyi.ems.service.IOpEnergyStrategyParamService;
+import com.ruoyi.ems.util.exception.Assert;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+/**
+ * 能源策略参数Service业务层处理
+ *
+ * @author ruoyi
+ * @date 2024-10-14
+ */
+@Service
+public class OpEnergyStrategyParamServiceImpl implements IOpEnergyStrategyParamService {
+    @Autowired
+    private OpEnergyStrategyParamMapper paramMapper;
+
+    @Override
+    public List<OpEnergyStrategyParam> selectParamByStrategyCode(String strategyCode) {
+        return paramMapper.selectParamByStrategyCode(strategyCode);
+    }
+
+    @Override
+    public int updateParamValue(OpEnergyStrategyParam param) {
+        Assert.notNull(param.getStrategyCode(), -1, "策略编码不能为空");
+        Assert.notNull(param.getParamGroup(), -1, "策略分组不能为空");
+        Assert.notNull(param.getParamKey(), -1, "策略参数键不能为空");
+
+        return paramMapper.updateParamValue(param.getStrategyCode(), param.getParamGroup(), param.getParamKey(),
+            param.getParamValue());
+    }
+}

+ 14 - 21
ems-cloud/ems-modules/ems-server/src/main/java/com/ruoyi/ems/service/impl/OpEnergyStrategyServiceImpl.java

@@ -10,85 +10,78 @@ import java.util.List;
 
 /**
  * 能源策略Service业务层处理
- * 
+ *
  * @author ruoyi
  * @date 2024-08-08
  */
 @Service
-public class OpEnergyStrategyServiceImpl implements IOpEnergyStrategyService
-{
+public class OpEnergyStrategyServiceImpl implements IOpEnergyStrategyService {
     @Autowired
     private OpEnergyStrategyMapper strategyMapper;
 
     /**
      * 查询能源策略
-     * 
+     *
      * @param id 能源策略主键
      * @return 能源策略
      */
     @Override
-    public OpEnergyStrategy selectStrategyById(Long id)
-    {
+    public OpEnergyStrategy selectStrategyById(Long id) {
         return strategyMapper.selectStrategyById(id);
     }
 
     /**
      * 查询能源策略列表
-     * 
+     *
      * @param admOpEnergyStrategy 能源策略
      * @return 能源策略
      */
     @Override
-    public List<OpEnergyStrategy> selectStrategyList(OpEnergyStrategy admOpEnergyStrategy)
-    {
+    public List<OpEnergyStrategy> selectStrategyList(OpEnergyStrategy admOpEnergyStrategy) {
         return strategyMapper.selectStrategyList(admOpEnergyStrategy);
     }
 
     /**
      * 新增能源策略
-     * 
+     *
      * @param admOpEnergyStrategy 能源策略
      * @return 结果
      */
     @Override
-    public int insertStrategy(OpEnergyStrategy admOpEnergyStrategy)
-    {
+    public int insertStrategy(OpEnergyStrategy admOpEnergyStrategy) {
         return strategyMapper.insertStrategy(admOpEnergyStrategy);
     }
 
     /**
      * 修改能源策略
-     * 
+     *
      * @param admOpEnergyStrategy 能源策略
      * @return 结果
      */
     @Override
-    public int updateStrategy(OpEnergyStrategy admOpEnergyStrategy)
-    {
+    public int updateStrategy(OpEnergyStrategy admOpEnergyStrategy) {
         return strategyMapper.updateStrategy(admOpEnergyStrategy);
     }
 
     /**
      * 批量删除能源策略
-     * 
+     *
      * @param ids 需要删除的能源策略主键
      * @return 结果
      */
     @Override
-    public int deleteStrategyByIds(Long[] ids)
-    {
+    public int deleteStrategyByIds(Long[] ids) {
         return strategyMapper.deleteStrategyByIds(ids);
     }
 
     /**
      * 删除能源策略信息
-     * 
+     *
      * @param id 能源策略主键
      * @return 结果
      */
     @Override
-    public int deleteStrategyById(Long id)
-    {
+    public int deleteStrategyById(Long id) {
         return strategyMapper.deleteStrategyById(id);
     }
 }

+ 47 - 0
ems-cloud/ems-modules/ems-server/src/main/java/com/ruoyi/ems/service/impl/OpEnergyStrategyStepServiceImpl.java

@@ -0,0 +1,47 @@
+package com.ruoyi.ems.service.impl;
+
+import com.ruoyi.ems.domain.OpEnergyStrategyStep;
+import com.ruoyi.ems.mapper.OpEnergyStrategyStepMapper;
+import com.ruoyi.ems.service.IOpEnergyStrategyStepService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+
+/**
+ * 能源策略步骤Service业务层处理
+ * 
+ * @author ruoyi
+ * @date 2024-10-14
+ */
+@Service
+public class OpEnergyStrategyStepServiceImpl implements IOpEnergyStrategyStepService
+{
+    @Autowired
+    private OpEnergyStrategyStepMapper stepMapper;
+
+    @Override
+    public List<OpEnergyStrategyStep> selectStepByStrategyCode(String strategyCode) {
+        return stepMapper.selectStepByStrategyCode(strategyCode);
+    }
+
+    @Override
+    public int insertStep(OpEnergyStrategyStep strategyStep) {
+        return stepMapper.insertStep(strategyStep);
+    }
+
+    @Override
+    public int insertStepBatch(List<OpEnergyStrategyStep> strategySteps) {
+        return stepMapper.insertStepBatch(strategySteps);
+    }
+
+    @Override
+    public int updateStep(OpEnergyStrategyStep strategyStep) {
+        return stepMapper.updateStep(strategyStep);
+    }
+
+    @Override
+    public int deleteStepByStrategyCode(String strategyCode) {
+        return stepMapper.deleteStepByStrategyCode(strategyCode);
+    }
+}

+ 6 - 6
ems-cloud/ems-modules/ems-server/src/main/resources/mapper/ems/ElecPvSupplyHMapper.xml

@@ -3,7 +3,7 @@
         PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="com.ruoyi.ems.mapper.ElecPvSupplyHMapper">
-    <resultMap type="com.ruoyi.ems.domain.PvSupplyH" id="PvSupplyHResult">
+    <resultMap type="com.ruoyi.ems.domain.ElecPvSupplyH" id="PvSupplyHResult">
         <result property="id" column="id"/>
         <result property="areaCode" column="area_code"/>
         <result property="areaName" column="area_name"/>
@@ -42,7 +42,7 @@
                  LEFT JOIN adm_ems_facs f ON pv.`facs_code` = f.`facs_code`
     </sql>
 
-    <select id="selectPvSupplyHList" parameterType="com.ruoyi.ems.domain.PvSupplyH" resultMap="PvSupplyHResult">
+    <select id="selectPvSupplyHList" parameterType="com.ruoyi.ems.domain.ElecPvSupplyH" resultMap="PvSupplyHResult">
         <include refid="selectPvSupplyHVo"/>
         <where>
             <if test="areaCode != null  and areaCode != ''">and pv.area_code = #{areaCode}</if>
@@ -65,7 +65,7 @@
         pv.`time_index`
     </select>
 
-    <select id="selectPvSupplyHAll" parameterType="com.ruoyi.ems.domain.PvSupplyH" resultMap="PvSupplyHResult">
+    <select id="selectPvSupplyHAll" parameterType="com.ruoyi.ems.domain.ElecPvSupplyH" resultMap="PvSupplyHResult">
         SELECT
             facCategory.`name` facs_name,
             pv.`record_time`,
@@ -131,7 +131,7 @@
             DATE, time_index;
     </select>
 
-    <select id="selectAreaSupplyH" parameterType="com.ruoyi.ems.domain.PvSupplyH" resultMap="PvSupplyHResult">
+    <select id="selectAreaSupplyH" parameterType="com.ruoyi.ems.domain.ElecPvSupplyH" resultMap="PvSupplyHResult">
         SELECT area_code,
                `date`,
                time_index,
@@ -199,7 +199,7 @@
         where id = #{id}
     </select>
 
-    <insert id="insertPvSupplyH" parameterType="com.ruoyi.ems.domain.PvSupplyH" useGeneratedKeys="true"
+    <insert id="insertPvSupplyH" parameterType="com.ruoyi.ems.domain.ElecPvSupplyH" useGeneratedKeys="true"
             keyProperty="id">
         insert into adm_ems_pv_supply_h
         <trim prefix="(" suffix=")" suffixOverrides=",">
@@ -230,7 +230,7 @@
         </trim>
     </insert>
 
-    <update id="updatePvSupplyH" parameterType="com.ruoyi.ems.domain.PvSupplyH">
+    <update id="updatePvSupplyH" parameterType="com.ruoyi.ems.domain.ElecPvSupplyH">
         update adm_ems_pv_supply_h
         <trim prefix="SET" suffixOverrides=",">
             <if test="areaCode != null and areaCode != ''">area_code = #{areaCode},</if>

+ 31 - 0
ems-cloud/ems-modules/ems-server/src/main/resources/mapper/ems/OpEnergyStrategyParamMapper.xml

@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE mapper
+PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
+"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.ruoyi.ems.mapper.OpEnergyStrategyParamMapper">
+    
+    <resultMap type="com.ruoyi.ems.domain.OpEnergyStrategyParam" id="opEnergyStrategyParamResult">
+        <result property="id"    column="id"    />
+        <result property="strategyCode"    column="strategy_code"    />
+        <result property="paramGroup"    column="param_group"    />
+        <result property="paramKey"    column="param_key"    />
+        <result property="paramName"    column="param_name"    />
+        <result property="paramValue"    column="param_value"    />
+        <result property="editEnable"    column="edit_enable"    />
+    </resultMap>
+
+    <sql id="selectAdmOpEnergyStrategyParamVo">
+        select id, strategy_code, param_group, param_key, param_name, param_value, edit_enable from adm_op_energy_strategy_param
+    </sql>
+
+    <select id="selectParamByStrategyCode" parameterType="java.lang.String" resultMap="opEnergyStrategyParamResult">
+        <include refid="selectAdmOpEnergyStrategyParamVo"/>
+        where strategy_code = #{strategyCode}
+    </select>
+
+    <update id="updateParamValue">
+        update adm_op_energy_strategy_param
+        set param_value = #{paramValue}
+        where strategy_code = #{strategyCode} and param_group = #{paramGroup} and param_key = #{paramKey}
+    </update>
+</mapper>

+ 79 - 0
ems-cloud/ems-modules/ems-server/src/main/resources/mapper/ems/OpEnergyStrategyStepMapper.xml

@@ -0,0 +1,79 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE mapper
+PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
+"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.ruoyi.ems.mapper.OpEnergyStrategyStepMapper">
+    
+    <resultMap type="com.ruoyi.ems.domain.OpEnergyStrategyStep" id="opEnergyStrategyStepResult">
+        <result property="id"    column="id"    />
+        <result property="strategyCode"    column="strategy_code"    />
+        <result property="stepCode"    column="step_code"    />
+        <result property="stepName"    column="step_name"    />
+        <result property="stepIndex"    column="step_index"    />
+        <result property="stepHandler"    column="step_handler"    />
+        <result property="stepParam"    column="step_param"    />
+        <result property="targetFacs"    column="target_facs"    />
+        <result property="targetDevice"    column="target_device"    />
+    </resultMap>
+
+    <sql id="selectStepVo">
+        select id, strategy_code, step_code, step_name, step_index, step_handler, step_param, target_facs, target_device from adm_op_energy_strategy_step
+    </sql>
+
+    <select id="selectStepByStrategyCode" parameterType="java.lang.String" resultMap="opEnergyStrategyStepResult">
+        <include refid="selectStepVo"/>
+        where strategy_code = #{strategyCode}
+    </select>
+        
+    <insert id="insertStep" parameterType="com.ruoyi.ems.domain.OpEnergyStrategyStep" useGeneratedKeys="true" keyProperty="id">
+        insert into adm_op_energy_strategy_step
+        <trim prefix="(" suffix=")" suffixOverrides=",">
+            <if test="strategyCode != null and strategyCode != ''">strategy_code,</if>
+            <if test="stepCode != null and stepCode != ''">step_code,</if>
+            <if test="stepName != null and stepName != ''">step_name,</if>
+            <if test="stepIndex != null">step_index,</if>
+            <if test="stepHandler != null and stepHandler != ''">step_handler,</if>
+            <if test="stepParam != null">step_param,</if>
+            <if test="targetFacs != null">target_facs,</if>
+            <if test="targetDevice != null">target_device,</if>
+         </trim>
+        <trim prefix="values (" suffix=")" suffixOverrides=",">
+            <if test="strategyCode != null and strategyCode != ''">#{strategyCode},</if>
+            <if test="stepCode != null and stepCode != ''">#{stepCode},</if>
+            <if test="stepName != null and stepName != ''">#{stepName},</if>
+            <if test="stepIndex != null">#{stepIndex},</if>
+            <if test="stepHandler != null and stepHandler != ''">#{stepHandler},</if>
+            <if test="stepParam != null">#{stepParam},</if>
+            <if test="targetFacs != null">#{targetFacs},</if>
+            <if test="targetDevice != null">#{targetDevice},</if>
+         </trim>
+    </insert>
+
+    <insert id="insertStepBatch" parameterType="java.util.List">
+        insert into adm_op_energy_strategy_step (strategy_code, step_code, step_name, step_index, step_handler, step_param, target_facs, target_device)
+        values
+        <foreach collection="list" item="item" index="index" separator=",">
+            (#{item.strategyCode}, #{item.stepCode}, #{item.stepName}, #{item.stepIndex}, #{item.stepHandler}, #{item.stepParam}, #{item.targetFacs}, #{item.targetDevice})
+        </foreach>
+    </insert>
+
+
+    <update id="updateStep" parameterType="com.ruoyi.ems.domain.OpEnergyStrategyStep">
+        update adm_op_energy_strategy_step
+        <trim prefix="SET" suffixOverrides=",">
+            <if test="strategyCode != null and strategyCode != ''">strategy_code = #{strategyCode},</if>
+            <if test="stepCode != null and stepCode != ''">step_code = #{stepCode},</if>
+            <if test="stepName != null and stepName != ''">step_name = #{stepName},</if>
+            <if test="stepIndex != null">step_index = #{stepIndex},</if>
+            <if test="stepHandler != null and stepHandler != ''">step_handler = #{stepHandler},</if>
+            <if test="stepParam != null">step_param = #{stepParam},</if>
+            <if test="targetFacs != null">target_facs = #{targetFacs},</if>
+            <if test="targetDevice != null">target_device = #{targetDevice},</if>
+        </trim>
+        where id = #{id}
+    </update>
+
+    <delete id="deleteStepByStrategyCode" parameterType="java.lang.String">
+        delete from adm_op_energy_strategy_step where strategy_code = #{strategyCode}
+    </delete>
+</mapper>

+ 25 - 0
ems-cloud/sql/ems_init_data.sql

@@ -127,6 +127,31 @@ INSERT INTO `adm_ems_facs` (`facs_code`, `facs_name`, `facs_category`, `facs_sub
 INSERT INTO `adm_ems_facs` (`facs_code`, `facs_name`, `facs_category`, `facs_subcategory`, `enable`, `ref_area`, `facs_model`) VALUES ('Z220', '南区-空调设施', 'Z', 'Z020', 1, '321283124S3002', null);
 
 
+-- 策略初始数据
+INSERT INTO `adm_op_energy_strategy` (`area_code`, `strategy_code`, `strategy_name`, `strategy_type`, `strategy_state`, `strategy_desc`, `exec_mode`, `exec_rule`) VALUES ('321283124S3001', 'CL_YW_01', '北区-默认策略', 1, 1, '默认执行', 0, NULL);
+INSERT INTO `adm_op_energy_strategy` (`area_code`, `strategy_code`, `strategy_name`, `strategy_type`, `strategy_state`, `strategy_desc`, `exec_mode`, `exec_rule`) VALUES ('321283124S3002', 'CL_YW_02', '南区-默认策略', 1, 1, '默认执行', 0, NULL);
+INSERT INTO `adm_op_energy_strategy` (`area_code`, `strategy_code`, `strategy_name`, `strategy_type`, `strategy_state`, `strategy_desc`, `exec_mode`, `exec_rule`) VALUES ('321283124S3001', 'CL_YH_01', '北区-默认策略', 2, 1, '默认执行', 0, NULL);
+INSERT INTO `adm_op_energy_strategy` (`area_code`, `strategy_code`, `strategy_name`, `strategy_type`, `strategy_state`, `strategy_desc`, `exec_mode`, `exec_rule`) VALUES ('321283124S3002', 'CL_YH_02', '南区-默认策略', 2, 1, '默认执行', 0, NULL);
+INSERT INTO `adm_op_energy_strategy` (`area_code`, `strategy_code`, `strategy_name`, `strategy_type`, `strategy_state`, `strategy_desc`, `exec_mode`, `exec_rule`) VALUES ('321283124S3001', 'CL_WC_01', '北区-默认策略', 3, 1, '默认执行', 0, NULL);
+INSERT INTO `adm_op_energy_strategy` (`area_code`, `strategy_code`, `strategy_name`, `strategy_type`, `strategy_state`, `strategy_desc`, `exec_mode`, `exec_rule`) VALUES ('321283124S3002', 'CL_WC_02', '南区-默认策略', 3, 1, '默认执行', 0, NULL);
+
+-- 策略参数数据
+-- 源网 控制模式:
+-- default.controlMode [{"code":"maxPowerTrack", "name":"最大功率点跟踪(MPPT)", "desc":"通过实时调整光伏阵列的工作状态,使光伏系统始终运行在最大功率点"},{"code":"inverterControl", "name":"逆变器控制", "desc":"通过光伏逆变器实施控制"},{"code":"powerAndVoltage", "name":"无功功率及电压控制", "desc":"根据电网需求,通过调节光伏系统输出的无功功率和电压,实现电压稳定和电力因素的优化"}]
+-- 源网 控制模式 逆变器控制 策略
+-- inverterControl.inverterControl:[{"code":"svpwm", "name":"空间矢量控制(SVPWM)", "desc":"通过对逆变器开关状态的优化控制,实现并网电流的高精度控制"},{"code":"dtc", "name":"直流转矩控制", "desc":"以控制逆变器输出转矩和磁链为目标,快速响应"}]
+
+INSERT INTO `adm_op_energy_strategy_param` (`strategy_code`, `param_group`, `param_key`, `param_name`, `param_value`, `edit_enable`) VALUES ('CL_YW_01', 'default', 'controlMode', '控制模式', 'maxPowerTrack', 1);
+INSERT INTO `adm_op_energy_strategy_param` (`strategy_code`, `param_group`, `param_key`, `param_name`, `param_value`, `edit_enable`) VALUES ('CL_YW_01', 'inverterControl', 'controlMode', '逆变器控制策略', null, 1);
+INSERT INTO `adm_op_energy_strategy_param` (`strategy_code`, `param_group`, `param_key`, `param_name`, `param_value`, `edit_enable`) VALUES ('CL_YW_01', 'powerAndVoltage', 'reactivePower', '无功功率', null, 1);
+INSERT INTO `adm_op_energy_strategy_param` (`strategy_code`, `param_group`, `param_key`, `param_name`, `param_value`, `edit_enable`) VALUES ('CL_YW_01', 'powerAndVoltage', 'voltage', '电压', null, 1);
+
+INSERT INTO `adm_op_energy_strategy_param` (`strategy_code`, `param_group`, `param_key`, `param_name`, `param_value`, `edit_enable`) VALUES ('CL_YW_02', 'default', 'controlMode', '控制模式', 'maxPowerTrack', 1);
+INSERT INTO `adm_op_energy_strategy_param` (`strategy_code`, `param_group`, `param_key`, `param_name`, `param_value`, `edit_enable`) VALUES ('CL_YW_02', 'inverterControl', 'controlMode', '逆变器控制策略', null, 1);
+INSERT INTO `adm_op_energy_strategy_param` (`strategy_code`, `param_group`, `param_key`, `param_name`, `param_value`, `edit_enable`) VALUES ('CL_YW_02', 'powerAndVoltage', 'reactivePower', '无功功率', null, 1);
+INSERT INTO `adm_op_energy_strategy_param` (`strategy_code`, `param_group`, `param_key`, `param_name`, `param_value`, `edit_enable`) VALUES ('CL_YW_02', 'powerAndVoltage', 'voltage', '电压', null, 1);
+
+
 -- 对象模型表
 INSERT INTO `adm_ems_obj_model` (`model_code`, `model_name`, `obj_type`) VALUES ('M_Z010', '照明设备模型', 2);
 

+ 11 - 16
ems-cloud/sql/ems_server.sql

@@ -697,24 +697,21 @@ create table adm_op_energy_strategy  (
 
 
 -- ----------------------------
--- 能源策略步骤
+-- 能源策略参数表
 -- ----------------------------
-drop table if exists adm_op_energy_strategy_step;
-create table adm_op_energy_strategy_step  (
+drop table if exists adm_op_energy_strategy_param;
+create table adm_op_energy_strategy_param  (
   `id`                bigint(20)      not null auto_increment      comment '序号',
   `strategy_code`     varchar(16)     not null                     comment '策略代码',
-  `step_code`         varchar(16)     not null                     comment '步骤代码',
-  `step_name`         varchar(32)     not null                     comment '步骤名称',
-  `step_index`        int             not null                     comment '步骤顺序',
-  `step_handler`      varchar(128)    not null                     comment '步骤处理',
-  `step_param`        varchar(256)    default null                 comment '步骤参数',
-  `target_facs`       varchar(16)     default null                 comment '目标设施',
-  `target_device`     varchar(16)     default null                 comment '目标设备',
-  `create_time`       datetime        default CURRENT_TIMESTAMP    comment '创建时间',
-  `update_time`       datetime        default CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP comment '更新时间',
+  `param_group`       varchar(128)    not null                     comment '策略分组',
+  `param_key`         varchar(128)    not null                     comment '参数键值',
+  `param_name`        varchar(256)    not null                     comment '参数名称',
+  `param_value`       varchar(1024)   default null                 comment '参数值',
+  `param_value_desc`  varchar(1024)   default null                 comment '参数值描述',
+  `edit_enable`       int             default 0                    comment '可编辑',
   primary key (`id`),
-  unique key ux_op_energy_strategy_step_key(`strategy_code`,`step_code`,`step_index`)
-) engine=innodb auto_increment=1 comment = '能源策略步骤';
+  unique key ux_op_energy_strategy_param(`strategy_code`, `param_group`, `param_key`)
+) engine=innodb auto_increment=1 comment = '能源策略参数表';
 
 
 -- ----------------------------
@@ -731,8 +728,6 @@ create table adm_op_energy_strategy_step  (
   `step_param`        varchar(256)    default null                 comment '步骤参数',
   `target_facs`       varchar(16)     default null                 comment '目标设施',
   `target_device`     varchar(16)     default null                 comment '目标设备',
-  `create_time`       datetime        default CURRENT_TIMESTAMP    comment '创建时间',
-  `update_time`       datetime        default CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP comment '更新时间',
   primary key (`id`),
   unique key ux_op_energy_strategy_step_key(`strategy_code`,`step_code`,`step_index`)
 ) engine=innodb auto_increment=1 comment = '能源策略步骤';