Browse Source

业务配置优化

lv.wenbin 1 year ago
parent
commit
9823c1aa16
44 changed files with 2333 additions and 1208 deletions
  1. 24 16
      ems-cloud/ems-modules/ems-server/src/main/java/com/ruoyi/ems/controller/AreaController.java
  2. 108 0
      ems-cloud/ems-modules/ems-server/src/main/java/com/ruoyi/ems/controller/ElectricityController.java
  3. 0 105
      ems-cloud/ems-modules/ems-server/src/main/java/com/ruoyi/ems/controller/ElectrovalencyConfigController.java
  4. 0 101
      ems-cloud/ems-modules/ems-server/src/main/java/com/ruoyi/ems/controller/ElectrovalencyPeakValleyController.java
  5. 150 0
      ems-cloud/ems-modules/ems-server/src/main/java/com/ruoyi/ems/domain/AreaElectricityAttr.java
  6. 170 0
      ems-cloud/ems-modules/ems-server/src/main/java/com/ruoyi/ems/domain/ElecValencyConfig.java
  7. 28 48
      ems-cloud/ems-modules/ems-server/src/main/java/com/ruoyi/ems/domain/ElecValencyHourStrategy.java
  8. 113 0
      ems-cloud/ems-modules/ems-server/src/main/java/com/ruoyi/ems/domain/ElecValencyStrategy.java
  9. 0 185
      ems-cloud/ems-modules/ems-server/src/main/java/com/ruoyi/ems/domain/ElectrovalencyConfig.java
  10. 9 0
      ems-cloud/ems-modules/ems-server/src/main/java/com/ruoyi/ems/domain/EmsFacsAttr.java
  11. 28 0
      ems-cloud/ems-modules/ems-server/src/main/java/com/ruoyi/ems/domain/common/AreaTier.java
  12. 108 0
      ems-cloud/ems-modules/ems-server/src/main/java/com/ruoyi/ems/domain/vo/TreeEntity.java
  13. 61 0
      ems-cloud/ems-modules/ems-server/src/main/java/com/ruoyi/ems/mapper/AreaElectricityAttrMapper.java
  14. 15 15
      ems-cloud/ems-modules/ems-server/src/main/java/com/ruoyi/ems/mapper/AreaMapper.java
  15. 61 0
      ems-cloud/ems-modules/ems-server/src/main/java/com/ruoyi/ems/mapper/ElecValencyConfigMapper.java
  16. 77 0
      ems-cloud/ems-modules/ems-server/src/main/java/com/ruoyi/ems/mapper/ElecValencyHourStrategyMapper.java
  17. 61 0
      ems-cloud/ems-modules/ems-server/src/main/java/com/ruoyi/ems/mapper/ElecValencyStrategyMapper.java
  18. 0 62
      ems-cloud/ems-modules/ems-server/src/main/java/com/ruoyi/ems/mapper/ElectrovalencyConfigMapper.java
  19. 0 62
      ems-cloud/ems-modules/ems-server/src/main/java/com/ruoyi/ems/mapper/ElectrovalencyPeakValleyMapper.java
  20. 62 0
      ems-cloud/ems-modules/ems-server/src/main/java/com/ruoyi/ems/service/IAreaElectricityAttrService.java
  21. 9 0
      ems-cloud/ems-modules/ems-server/src/main/java/com/ruoyi/ems/service/IAreaService.java
  22. 62 0
      ems-cloud/ems-modules/ems-server/src/main/java/com/ruoyi/ems/service/IElecValencyConfigService.java
  23. 78 0
      ems-cloud/ems-modules/ems-server/src/main/java/com/ruoyi/ems/service/IElecValencyHourStrategyService.java
  24. 62 0
      ems-cloud/ems-modules/ems-server/src/main/java/com/ruoyi/ems/service/IElecValencyStrategyService.java
  25. 0 61
      ems-cloud/ems-modules/ems-server/src/main/java/com/ruoyi/ems/service/IElectrovalencyConfigService.java
  26. 0 62
      ems-cloud/ems-modules/ems-server/src/main/java/com/ruoyi/ems/service/IElectrovalencyPeakValleyService.java
  27. 90 0
      ems-cloud/ems-modules/ems-server/src/main/java/com/ruoyi/ems/service/impl/AreaElectricityAttrServiceImpl.java
  28. 104 25
      ems-cloud/ems-modules/ems-server/src/main/java/com/ruoyi/ems/service/impl/AreaServiceImpl.java
  29. 94 0
      ems-cloud/ems-modules/ems-server/src/main/java/com/ruoyi/ems/service/impl/ElecValencyConfigServiceImpl.java
  30. 110 0
      ems-cloud/ems-modules/ems-server/src/main/java/com/ruoyi/ems/service/impl/ElecValencyHourStrategyServiceImpl.java
  31. 147 0
      ems-cloud/ems-modules/ems-server/src/main/java/com/ruoyi/ems/service/impl/ElecValencyStrategyServiceImpl.java
  32. 0 94
      ems-cloud/ems-modules/ems-server/src/main/java/com/ruoyi/ems/service/impl/ElectrovalencyConfigServiceImpl.java
  33. 0 95
      ems-cloud/ems-modules/ems-server/src/main/java/com/ruoyi/ems/service/impl/ElectrovalencyPeakValleyServiceImpl.java
  34. 1 3
      ems-cloud/ems-modules/ems-server/src/main/java/com/ruoyi/ems/service/impl/EmsFacsServiceImpl.java
  35. 5 1
      ems-cloud/ems-modules/ems-server/src/main/resources/mapper/ems/AreaBuildingMapper.xml
  36. 92 0
      ems-cloud/ems-modules/ems-server/src/main/resources/mapper/ems/AreaElectricityAttrMapper.xml
  37. 101 0
      ems-cloud/ems-modules/ems-server/src/main/resources/mapper/ems/ElecValencyConfigMapper.xml
  38. 85 0
      ems-cloud/ems-modules/ems-server/src/main/resources/mapper/ems/ElecValencyHourStrategyMapper.xml
  39. 79 0
      ems-cloud/ems-modules/ems-server/src/main/resources/mapper/ems/ElecValencyStrategyMapper.xml
  40. 0 106
      ems-cloud/ems-modules/ems-server/src/main/resources/mapper/ems/ElectrovalencyConfigMapper.xml
  41. 0 81
      ems-cloud/ems-modules/ems-server/src/main/resources/mapper/ems/ElectrovalencyPeakValleyMapper.xml
  42. 5 1
      ems-cloud/ems-modules/ems-server/src/main/resources/mapper/ems/EmsDeviceMapper.xml
  43. 127 76
      ems-cloud/sql/ems_server.sql
  44. 7 9
      ems-cloud/sql/ems_sys.sql

+ 24 - 16
ems-cloud/ems-modules/ems-server/src/main/java/com/ruoyi/ems/controller/AreaController.java

@@ -2,6 +2,7 @@ package com.ruoyi.ems.controller;
 
 import java.util.List;
 import javax.servlet.http.HttpServletResponse;
+
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.GetMapping;
 import org.springframework.web.bind.annotation.PostMapping;
@@ -10,6 +11,7 @@ import org.springframework.web.bind.annotation.DeleteMapping;
 import org.springframework.web.bind.annotation.PathVariable;
 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 com.ruoyi.common.log.annotation.Log;
 import com.ruoyi.common.log.enums.BusinessType;
@@ -23,14 +25,13 @@ import com.ruoyi.common.core.web.page.TableDataInfo;
 
 /**
  * 服务区Controller
- * 
+ *
  * @author ruoyi
  * @date 2024-07-09
  */
 @RestController
 @RequestMapping("/basecfg/area")
-public class AreaController extends BaseController
-{
+public class AreaController extends BaseController {
     @Autowired
     private IAreaService areaService;
 
@@ -39,8 +40,7 @@ public class AreaController extends BaseController
      */
     @RequiresPermissions("basecfg:area:list")
     @GetMapping("/list")
-    public TableDataInfo list(Area area)
-    {
+    public TableDataInfo list(Area area) {
         startPage();
         List<Area> list = areaService.selectAreaList(area);
         return getDataTable(list);
@@ -52,8 +52,7 @@ public class AreaController extends BaseController
     @RequiresPermissions("basecfg:area:export")
     @Log(title = "服务区", businessType = BusinessType.EXPORT)
     @PostMapping("/export")
-    public void export(HttpServletResponse response, Area area)
-    {
+    public void export(HttpServletResponse response, Area area) {
         List<Area> list = areaService.selectAreaList(area);
         ExcelUtil<Area> util = new ExcelUtil<Area>(Area.class);
         util.exportExcel(response, list, "服务区数据");
@@ -64,19 +63,30 @@ public class AreaController extends BaseController
      */
     @RequiresPermissions("basecfg:area:query")
     @GetMapping(value = "/{id}")
-    public AjaxResult getInfo(@PathVariable("id") Long id)
-    {
+    public AjaxResult getInfo(@PathVariable("id") Long id) {
         return success(areaService.selectAreaById(id));
     }
 
     /**
+     * 获取服务区树
+     *
+     * @param tier 层级 Area、Building、Zoning
+     * @param name 名称
+     * @return 区域位置树
+     */
+    @GetMapping(value = "/areaTree")
+    public AjaxResult getAreaTree(@RequestParam(name = "tier") String tier,
+        @RequestParam(name = "name", required = false) String name) {
+        return success(areaService.selectAreaTreeList(tier, name));
+    }
+
+    /**
      * 新增服务区
      */
     @RequiresPermissions("basecfg:area:add")
     @Log(title = "服务区", businessType = BusinessType.INSERT)
     @PostMapping
-    public AjaxResult add(@RequestBody Area area)
-    {
+    public AjaxResult add(@RequestBody Area area) {
         return toAjax(areaService.insertArea(area));
     }
 
@@ -86,8 +96,7 @@ public class AreaController extends BaseController
     @RequiresPermissions("basecfg:area:edit")
     @Log(title = "服务区", businessType = BusinessType.UPDATE)
     @PutMapping
-    public AjaxResult edit(@RequestBody Area area)
-    {
+    public AjaxResult edit(@RequestBody Area area) {
         return toAjax(areaService.updateArea(area));
     }
 
@@ -96,9 +105,8 @@ public class AreaController extends BaseController
      */
     @RequiresPermissions("basecfg:area:remove")
     @Log(title = "服务区", businessType = BusinessType.DELETE)
-	@DeleteMapping("/{ids}")
-    public AjaxResult remove(@PathVariable Long[] ids)
-    {
+    @DeleteMapping("/{ids}")
+    public AjaxResult remove(@PathVariable Long[] ids) {
         return toAjax(areaService.deleteAreaByIds(ids));
     }
 }

+ 108 - 0
ems-cloud/ems-modules/ems-server/src/main/java/com/ruoyi/ems/controller/ElectricityController.java

@@ -0,0 +1,108 @@
+package com.ruoyi.ems.controller;
+
+import java.util.List;
+import javax.servlet.http.HttpServletResponse;
+
+import com.ruoyi.ems.domain.AreaElectricityAttr;
+import com.ruoyi.ems.service.IAreaElectricityAttrService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.PutMapping;
+import org.springframework.web.bind.annotation.DeleteMapping;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+import com.ruoyi.common.log.annotation.Log;
+import com.ruoyi.common.log.enums.BusinessType;
+import com.ruoyi.common.security.annotation.RequiresPermissions;
+import com.ruoyi.common.core.web.controller.BaseController;
+import com.ruoyi.common.core.web.domain.AjaxResult;
+import com.ruoyi.common.core.utils.poi.ExcelUtil;
+import com.ruoyi.common.core.web.page.TableDataInfo;
+
+/**
+ * 电价Controller
+ * 
+ * @author ruoyi
+ * @date 2024-07-23
+ */
+@RestController
+@RequestMapping("/basecfg/electrovalency")
+public class ElectricityController extends BaseController
+{
+    /**
+     * 用电属性服务
+     */
+    @Autowired
+    private IAreaElectricityAttrService areaElectricityAttrService;
+
+    /**
+     * 查询服务区用电属性列表
+     */
+    @RequiresPermissions("basecfg:electrovalency:list")
+    @GetMapping("/attr/list")
+    public TableDataInfo list(AreaElectricityAttr areaElectricityAttr)
+    {
+        startPage();
+        List<AreaElectricityAttr> list = areaElectricityAttrService.selectAreaElectricityAttrList(areaElectricityAttr);
+        return getDataTable(list);
+    }
+
+    /**
+     * 导出服务区用电属性列表
+     */
+    @RequiresPermissions("basecfg:electrovalency:export")
+    @Log(title = "服务区用电属性", businessType = BusinessType.EXPORT)
+    @PostMapping("/attr/export")
+    public void export(HttpServletResponse response, AreaElectricityAttr areaElectricityAttr)
+    {
+        List<AreaElectricityAttr> list = areaElectricityAttrService.selectAreaElectricityAttrList(areaElectricityAttr);
+        ExcelUtil<AreaElectricityAttr> util = new ExcelUtil<AreaElectricityAttr>(AreaElectricityAttr.class);
+        util.exportExcel(response, list, "服务区用电属性数据");
+    }
+
+    /**
+     * 获取服务区用电属性详细信息
+     */
+    @RequiresPermissions("basecfg:electrovalency:query")
+    @GetMapping(value = "/attr/{id}")
+    public AjaxResult getInfo(@PathVariable("id") Long id)
+    {
+        return success(areaElectricityAttrService.selectAreaElectricityAttrById(id));
+    }
+
+    /**
+     * 新增服务区用电属性
+     */
+    @RequiresPermissions("basecfg:electrovalency:add")
+    @Log(title = "服务区用电属性", businessType = BusinessType.INSERT)
+    @PostMapping(value = "/attr")
+    public AjaxResult add(@RequestBody AreaElectricityAttr areaElectricityAttr)
+    {
+        return toAjax(areaElectricityAttrService.insertAreaElectricityAttr(areaElectricityAttr));
+    }
+
+    /**
+     * 修改服务区用电属性
+     */
+    @RequiresPermissions("basecfg:electrovalency:edit")
+    @Log(title = "服务区用电属性", businessType = BusinessType.UPDATE)
+    @PutMapping(value = "/attr")
+    public AjaxResult edit(@RequestBody AreaElectricityAttr areaElectricityAttr)
+    {
+        return toAjax(areaElectricityAttrService.updateAreaElectricityAttr(areaElectricityAttr));
+    }
+
+    /**
+     * 删除服务区用电属性
+     */
+    @RequiresPermissions("basecfg:electrovalency:remove")
+    @Log(title = "服务区用电属性", businessType = BusinessType.DELETE)
+	@DeleteMapping("/attr/{ids}")
+    public AjaxResult remove(@PathVariable Long[] ids)
+    {
+        return toAjax(areaElectricityAttrService.deleteAreaElectricityAttrByIds(ids));
+    }
+}

+ 0 - 105
ems-cloud/ems-modules/ems-server/src/main/java/com/ruoyi/ems/controller/ElectrovalencyConfigController.java

@@ -1,105 +0,0 @@
-package com.ruoyi.ems.controller;
-
-import com.ruoyi.common.core.utils.poi.ExcelUtil;
-import com.ruoyi.common.core.web.controller.BaseController;
-import com.ruoyi.common.core.web.domain.AjaxResult;
-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.ElectrovalencyConfig;
-import com.ruoyi.ems.service.IElectrovalencyConfigService;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.DeleteMapping;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.PathVariable;
-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.RestController;
-
-import javax.servlet.http.HttpServletResponse;
-import java.util.List;
-
-/**
- * 电价配置Controller
- * 
- * @author ruoyi
- * @date 2024-07-12
- */
-@RestController
-@RequestMapping("/basecfg/electrovalency")
-public class ElectrovalencyConfigController extends BaseController
-{
-    @Autowired
-    private IElectrovalencyConfigService electrovalencyConfigService;
-
-    /**
-     * 查询电价配置列表
-     */
-    @RequiresPermissions("basecfg:electrovalency:list")
-    @GetMapping("/list")
-    public TableDataInfo list(ElectrovalencyConfig electrovalencyConfig)
-    {
-        startPage();
-        List<ElectrovalencyConfig> list = electrovalencyConfigService.selectElectrovalencyConfigList(electrovalencyConfig);
-        return getDataTable(list);
-    }
-
-    /**
-     * 导出电价配置列表
-     */
-    @RequiresPermissions("basecfg:electrovalency:export")
-    @Log(title = "电价配置", businessType = BusinessType.EXPORT)
-    @PostMapping("/export")
-    public void export(HttpServletResponse response, ElectrovalencyConfig electrovalencyConfig)
-    {
-        List<ElectrovalencyConfig> list = electrovalencyConfigService.selectElectrovalencyConfigList(electrovalencyConfig);
-        ExcelUtil<ElectrovalencyConfig> util = new ExcelUtil<ElectrovalencyConfig>(ElectrovalencyConfig.class);
-        util.exportExcel(response, list, "电价配置数据");
-    }
-
-    /**
-     * 获取电价配置详细信息
-     */
-    @RequiresPermissions("basecfg:electrovalency:query")
-    @GetMapping(value = "/{id}")
-    public AjaxResult getInfo(@PathVariable("id") Long id)
-    {
-        return success(electrovalencyConfigService.selectElectrovalencyConfigById(id));
-    }
-
-    /**
-     * 新增电价配置
-     */
-    @RequiresPermissions("basecfg:electrovalency:add")
-    @Log(title = "电价配置", businessType = BusinessType.INSERT)
-    @PostMapping
-    public AjaxResult add(@RequestBody ElectrovalencyConfig electrovalencyConfig)
-    {
-        return toAjax(electrovalencyConfigService.insertElectrovalencyConfig(electrovalencyConfig));
-    }
-
-    /**
-     * 修改电价配置
-     */
-    @RequiresPermissions("basecfg:electrovalency:edit")
-    @Log(title = "电价配置", businessType = BusinessType.UPDATE)
-    @PutMapping
-    public AjaxResult edit(@RequestBody ElectrovalencyConfig electrovalencyConfig)
-    {
-        return toAjax(electrovalencyConfigService.updateElectrovalencyConfig(electrovalencyConfig));
-    }
-
-    /**
-     * 删除电价配置
-     */
-    @RequiresPermissions("basecfg:electrovalency:remove")
-    @Log(title = "电价配置", businessType = BusinessType.DELETE)
-	@DeleteMapping("/{ids}")
-    public AjaxResult remove(@PathVariable Long[] ids)
-    {
-        return toAjax(electrovalencyConfigService.deleteElectrovalencyConfigByIds(ids));
-    }
-}

+ 0 - 101
ems-cloud/ems-modules/ems-server/src/main/java/com/ruoyi/ems/controller/ElectrovalencyPeakValleyController.java

@@ -1,101 +0,0 @@
-package com.ruoyi.ems.controller;
-
-import java.util.List;
-import javax.servlet.http.HttpServletResponse;
-
-import com.ruoyi.ems.domain.ElectrovalencyPeakValley;
-import com.ruoyi.ems.service.IElectrovalencyPeakValleyService;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.PutMapping;
-import org.springframework.web.bind.annotation.DeleteMapping;
-import org.springframework.web.bind.annotation.PathVariable;
-import org.springframework.web.bind.annotation.RequestBody;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
-import com.ruoyi.common.log.annotation.Log;
-import com.ruoyi.common.log.enums.BusinessType;
-import com.ruoyi.common.security.annotation.RequiresPermissions;
-import com.ruoyi.common.core.web.controller.BaseController;
-import com.ruoyi.common.core.web.domain.AjaxResult;
-import com.ruoyi.common.core.utils.poi.ExcelUtil;
-import com.ruoyi.common.core.web.page.TableDataInfo;
-
-/**
- * 电价峰谷Controller
- *
- * @author ruoyi
- * @date 2024-07-12
- */
-@RestController
-@RequestMapping("/basecfg/peakvalley")
-public class ElectrovalencyPeakValleyController extends BaseController {
-    @Autowired
-    private IElectrovalencyPeakValleyService electrovalencyPeakValleyService;
-
-    /**
-     * 查询电价峰谷列表
-     */
-    @RequiresPermissions("basecfg:peakvalley:list")
-    @GetMapping("/list")
-    public TableDataInfo list(ElectrovalencyPeakValley electrovalencyPeakValley) {
-        startPage();
-        List<ElectrovalencyPeakValley> list = electrovalencyPeakValleyService.selectElectrovalencyPeakValleyList(
-            electrovalencyPeakValley);
-        return getDataTable(list);
-    }
-
-    /**
-     * 导出电价峰谷列表
-     */
-    @RequiresPermissions("basecfg:peakvalley:export")
-    @Log(title = "电价峰谷", businessType = BusinessType.EXPORT)
-    @PostMapping("/export")
-    public void export(HttpServletResponse response, ElectrovalencyPeakValley electrovalencyPeakValley) {
-        List<ElectrovalencyPeakValley> list = electrovalencyPeakValleyService.selectElectrovalencyPeakValleyList(
-            electrovalencyPeakValley);
-        ExcelUtil<ElectrovalencyPeakValley> util = new ExcelUtil<ElectrovalencyPeakValley>(
-            ElectrovalencyPeakValley.class);
-        util.exportExcel(response, list, "电价峰谷数据");
-    }
-
-    /**
-     * 获取电价峰谷详细信息
-     */
-    @RequiresPermissions("basecfg:peakvalley:query")
-    @GetMapping(value = "/{id}")
-    public AjaxResult getInfo(@PathVariable("id") Long id) {
-        return success(electrovalencyPeakValleyService.selectElectrovalencyPeakValleyById(id));
-    }
-
-    /**
-     * 新增电价峰谷
-     */
-    @RequiresPermissions("basecfg:peakvalley:add")
-    @Log(title = "电价峰谷", businessType = BusinessType.INSERT)
-    @PostMapping
-    public AjaxResult add(@RequestBody ElectrovalencyPeakValley electrovalencyPeakValley) {
-        return toAjax(electrovalencyPeakValleyService.insertElectrovalencyPeakValley(electrovalencyPeakValley));
-    }
-
-    /**
-     * 修改电价峰谷
-     */
-    @RequiresPermissions("basecfg:peakvalley:edit")
-    @Log(title = "电价峰谷", businessType = BusinessType.UPDATE)
-    @PutMapping
-    public AjaxResult edit(@RequestBody ElectrovalencyPeakValley electrovalencyPeakValley) {
-        return toAjax(electrovalencyPeakValleyService.updateElectrovalencyPeakValley(electrovalencyPeakValley));
-    }
-
-    /**
-     * 删除电价峰谷
-     */
-    @RequiresPermissions("basecfg:peakvalley:remove")
-    @Log(title = "电价峰谷", businessType = BusinessType.DELETE)
-    @DeleteMapping("/{ids}")
-    public AjaxResult remove(@PathVariable Long[] ids) {
-        return toAjax(electrovalencyPeakValleyService.deleteElectrovalencyPeakValleyByIds(ids));
-    }
-}

+ 150 - 0
ems-cloud/ems-modules/ems-server/src/main/java/com/ruoyi/ems/domain/AreaElectricityAttr.java

@@ -0,0 +1,150 @@
+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;
+
+/**
+ * 服务区用电属性对象 sys_area_electricity_attr
+ * 
+ * @author ruoyi
+ * @date 2024-07-23
+ */
+public class AreaElectricityAttr extends BaseEntity
+{
+    private static final long serialVersionUID = 1L;
+
+    /** 序号 */
+    private Long id;
+
+    /** 园区代码 */
+    private String areaCode;
+
+    /** 园区名称 */
+    @Excel(name = "园区")
+    private String areaName;
+
+    /** 用电分类 */
+    private Long elecType;
+
+    /** 用电分类名称 */
+    @Excel(name = "用电分类")
+    private String elecTypeName;
+
+    /** 价格编码 */
+    private String priceCode;
+
+    /** 价格描述 */
+    @Excel(name = "电压等级")
+    private String voltageLevel;
+
+    /** 容(需)量标识 */
+    @Excel(name = "容(需)量标识")
+    private Long reqCapacityFlag;
+
+    /** 变压器容量(千伏安·月) */
+    @Excel(name = "变压器容量(千伏安·月)")
+    private Long transCapacity;
+
+    /** 最大需量(千瓦·月) */
+    @Excel(name = "最大需量(千瓦·月)")
+    private Long reqQuantity;
+
+    public Long getId() {
+        return id;
+    }
+
+    public void setId(Long id) {
+        this.id = id;
+    }
+
+    public String getAreaCode() {
+        return areaCode;
+    }
+
+    public void setAreaCode(String areaCode) {
+        this.areaCode = areaCode;
+    }
+
+    public String getAreaName() {
+        return areaName;
+    }
+
+    public void setAreaName(String areaName) {
+        this.areaName = areaName;
+    }
+
+    public Long getElecType() {
+        return elecType;
+    }
+
+    public void setElecType(Long elecType) {
+        this.elecType = elecType;
+    }
+
+    public String getElecTypeName() {
+        return elecTypeName;
+    }
+
+    public void setElecTypeName(String elecTypeName) {
+        this.elecTypeName = elecTypeName;
+    }
+
+    public String getPriceCode() {
+        return priceCode;
+    }
+
+    public void setPriceCode(String priceCode) {
+        this.priceCode = priceCode;
+    }
+
+    public String getVoltageLevel() {
+        return voltageLevel;
+    }
+
+    public void setVoltageLevel(String voltageLevel) {
+        this.voltageLevel = voltageLevel;
+    }
+
+    public Long getReqCapacityFlag() {
+        return reqCapacityFlag;
+    }
+
+    public void setReqCapacityFlag(Long reqCapacityFlag) {
+        this.reqCapacityFlag = reqCapacityFlag;
+    }
+
+    public Long getTransCapacity() {
+        return transCapacity;
+    }
+
+    public void setTransCapacity(Long transCapacity) {
+        this.transCapacity = transCapacity;
+    }
+
+    public Long getReqQuantity() {
+        return reqQuantity;
+    }
+
+    public void setReqQuantity(Long reqQuantity) {
+        this.reqQuantity = reqQuantity;
+    }
+
+    @Override
+    public String toString() {
+        return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
+            .append("id", getId())
+            .append("areaCode", getAreaCode())
+            .append("areaName", getAreaName())
+            .append("elecType", getElecType())
+            .append("priceCode", getPriceCode())
+            .append("voltageLevel", getVoltageLevel())
+            .append("reqCapacityFlag", getReqCapacityFlag())
+            .append("transCapacity", getTransCapacity())
+            .append("reqQuantity", getReqQuantity())
+            .append("createTime", getCreateTime())
+            .append("updateTime", getUpdateTime())
+            .toString();
+    }
+}

+ 170 - 0
ems-cloud/ems-modules/ems-server/src/main/java/com/ruoyi/ems/domain/ElecValencyConfig.java

@@ -0,0 +1,170 @@
+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;
+
+/**
+ * 电价配置对象 sys_electrovalency_config
+ * 
+ * @author ruoyi
+ * @date 2024-07-23
+ */
+public class ElecValencyConfig extends BaseEntity
+{
+    private static final long serialVersionUID = 1L;
+
+    /** 序号 */
+    private Long id;
+
+    /** 配置代码 */
+    @Excel(name = "配置代码")
+    private String cfgCode;
+
+    /** 用电分类 1-单一制 2-两部制 */
+    @Excel(name = "用电分类")
+    private Long elecType;
+
+    /** 电压等级 */
+    @Excel(name = "电压等级")
+    private String voltageLevel;
+
+    /** 电度用电价格 */
+    @Excel(name = "电度用电价格")
+    private Double degreePrice;
+
+    /** 分时尖峰时段价格 */
+    @Excel(name = "分时尖峰时段价格")
+    private Double fsPeakDegreePrice;
+
+    /** 分时高峰时段价格 */
+    @Excel(name = "分时高峰时段价格")
+    private Double fsHighDegreePrice;
+
+    /** 分时平峰时段价格 */
+    @Excel(name = "分时平峰时段价格")
+    private Double fsFlatDegreePrice;
+
+    /** 分时低谷时段价格 */
+    @Excel(name = "分时低谷时段价格")
+    private Double fsLowDegreePrice;
+
+    /** 最大需量用电价格 */
+    @Excel(name = "最大需量用电价格")
+    private Double maxReqPrice;
+
+    /** 变压器容量用电价格 */
+    @Excel(name = "变压器容量用电价格")
+    private Double transCapacityPrice;
+
+    public void setId(Long id) 
+    {
+        this.id = id;
+    }
+
+    public Long getId() 
+    {
+        return id;
+    }
+    public void setCfgCode(String cfgCode) 
+    {
+        this.cfgCode = cfgCode;
+    }
+
+    public String getCfgCode() 
+    {
+        return cfgCode;
+    }
+    public void setElecType(Long elecType) 
+    {
+        this.elecType = elecType;
+    }
+
+    public Long getElecType() 
+    {
+        return elecType;
+    }
+    public void setVoltageLevel(String voltageLevel) 
+    {
+        this.voltageLevel = voltageLevel;
+    }
+
+    public String getVoltageLevel() 
+    {
+        return voltageLevel;
+    }
+
+    public Double getDegreePrice() {
+        return degreePrice;
+    }
+
+    public void setDegreePrice(Double degreePrice) {
+        this.degreePrice = degreePrice;
+    }
+
+    public Double getFsPeakDegreePrice() {
+        return fsPeakDegreePrice;
+    }
+
+    public void setFsPeakDegreePrice(Double fsPeakDegreePrice) {
+        this.fsPeakDegreePrice = fsPeakDegreePrice;
+    }
+
+    public Double getFsHighDegreePrice() {
+        return fsHighDegreePrice;
+    }
+
+    public void setFsHighDegreePrice(Double fsHighDegreePrice) {
+        this.fsHighDegreePrice = fsHighDegreePrice;
+    }
+
+    public Double getFsFlatDegreePrice() {
+        return fsFlatDegreePrice;
+    }
+
+    public void setFsFlatDegreePrice(Double fsFlatDegreePrice) {
+        this.fsFlatDegreePrice = fsFlatDegreePrice;
+    }
+
+    public Double getFsLowDegreePrice() {
+        return fsLowDegreePrice;
+    }
+
+    public void setFsLowDegreePrice(Double fsLowDegreePrice) {
+        this.fsLowDegreePrice = fsLowDegreePrice;
+    }
+
+    public Double getMaxReqPrice() {
+        return maxReqPrice;
+    }
+
+    public void setMaxReqPrice(Double maxReqPrice) {
+        this.maxReqPrice = maxReqPrice;
+    }
+
+    public Double getTransCapacityPrice() {
+        return transCapacityPrice;
+    }
+
+    public void setTransCapacityPrice(Double transCapacityPrice) {
+        this.transCapacityPrice = transCapacityPrice;
+    }
+
+    @Override
+    public String toString() {
+        return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
+            .append("id", getId())
+            .append("cfgCode", getCfgCode())
+            .append("elecType", getElecType())
+            .append("voltageLevel", getVoltageLevel())
+            .append("degreePrice", getDegreePrice())
+            .append("fsPeakDegreePrice", getFsPeakDegreePrice())
+            .append("fsHighDegreePrice", getFsHighDegreePrice())
+            .append("fsFlatDegreePrice", getFsFlatDegreePrice())
+            .append("fsLowDegreePrice", getFsLowDegreePrice())
+            .append("maxReqPrice", getMaxReqPrice())
+            .append("transCapacityPrice", getTransCapacityPrice())
+            .toString();
+    }
+}

+ 28 - 48
ems-cloud/ems-modules/ems-server/src/main/java/com/ruoyi/ems/domain/ElectrovalencyPeakValley.java → ems-cloud/ems-modules/ems-server/src/main/java/com/ruoyi/ems/domain/ElecValencyHourStrategy.java

@@ -1,6 +1,5 @@
 package com.ruoyi.ems.domain;
 
-import java.sql.Time;
 import java.util.Date;
 import com.fasterxml.jackson.annotation.JsonFormat;
 import org.apache.commons.lang3.builder.ToStringBuilder;
@@ -9,44 +8,45 @@ import com.ruoyi.common.core.annotation.Excel;
 import com.ruoyi.common.core.web.domain.BaseEntity;
 
 /**
- * 电价峰谷对象 sys_electrovalency_peak_valley
+ * 电价策略小时对象 sys_electrovalency_strategy_hour
  * 
  * @author ruoyi
- * @date 2024-07-12
+ * @date 2024-07-23
  */
-public class ElectrovalencyPeakValley extends BaseEntity
+public class ElecValencyHourStrategy extends BaseEntity
 {
     private static final long serialVersionUID = 1L;
 
+    public ElecValencyHourStrategy(){
+        super();
+    }
+
+    public ElecValencyHourStrategy(String strategyCode){
+        super();
+        this.strategyCode = strategyCode;
+    }
+
     /** 序号 */
     private Long id;
 
-    /** 时间标识 */
-    @Excel(name = "时间标识")
-    private String timeKey;
+    /** 策略代码 */
+    @Excel(name = "策略代码")
+    private String strategyCode;
 
-    /** 时间序列 */
-    @Excel(name = "时间序列")
-    private Long timeIndex;
-
-    /** 开始时间HH:mm:ss */
-    @JsonFormat(pattern = "HH:mm:ss")
-    @Excel(name = "开始时间", width = 30, dateFormat = "HH:mm:ss")
+    /** 开始时间 */
+    @JsonFormat(pattern = "yyyy-MM-dd")
+    @Excel(name = "开始时间", width = 30, dateFormat = "yyyy-MM-dd")
     private Date startTime;
 
-    /** 结束时间HH:mm:ss */
-    @JsonFormat(pattern = "HH:mm:ss")
-    @Excel(name = "结束时间", width = 30, dateFormat = "HH:mm:ss")
+    /** 结束时间 */
+    @JsonFormat(pattern = "yyyy-MM-dd")
+    @Excel(name = "结束时间", width = 30, dateFormat = "yyyy-MM-dd")
     private Date endTime;
 
     /** 计量类型 */
     @Excel(name = "计量类型")
     private Long type;
 
-    /** 浮动值 */
-    @Excel(name = "浮动值")
-    private Double floatingValue;
-
     public void setId(Long id) 
     {
         this.id = id;
@@ -56,25 +56,16 @@ public class ElectrovalencyPeakValley extends BaseEntity
     {
         return id;
     }
-    public void setTimeKey(String timeKey) 
-    {
-        this.timeKey = timeKey;
-    }
-
-    public String getTimeKey() 
-    {
-        return timeKey;
-    }
-    public void setTimeIndex(Long timeIndex) 
+    public void setStrategyCode(String strategyCode) 
     {
-        this.timeIndex = timeIndex;
+        this.strategyCode = strategyCode;
     }
 
-    public Long getTimeIndex() 
+    public String getStrategyCode() 
     {
-        return timeIndex;
+        return strategyCode;
     }
-    public void setStartTime(Time startTime)
+    public void setStartTime(Date startTime) 
     {
         this.startTime = startTime;
     }
@@ -83,7 +74,7 @@ public class ElectrovalencyPeakValley extends BaseEntity
     {
         return startTime;
     }
-    public void setEndTime(Time endTime)
+    public void setEndTime(Date endTime) 
     {
         this.endTime = endTime;
     }
@@ -101,26 +92,15 @@ public class ElectrovalencyPeakValley extends BaseEntity
     {
         return type;
     }
-    public void setFloatingValue(Double floatingValue)
-    {
-        this.floatingValue = floatingValue;
-    }
-
-    public Double getFloatingValue()
-    {
-        return floatingValue;
-    }
 
     @Override
     public String toString() {
         return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
             .append("id", getId())
-            .append("timeKey", getTimeKey())
-            .append("timeIndex", getTimeIndex())
+            .append("strategyCode", getStrategyCode())
             .append("startTime", getStartTime())
             .append("endTime", getEndTime())
             .append("type", getType())
-            .append("floatingValue", getFloatingValue())
             .toString();
     }
 }

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

@@ -0,0 +1,113 @@
+package com.ruoyi.ems.domain;
+
+import java.util.Date;
+import java.util.List;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+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;
+
+/**
+ * 电价策略对象 sys_electrovalency_strategy
+ * 
+ * @author ruoyi
+ * @date 2024-07-23
+ */
+public class ElecValencyStrategy extends BaseEntity
+{
+    private static final long serialVersionUID = 1L;
+
+    /** 序号 */
+    private Long id;
+
+    /** 策略代码 */
+    @Excel(name = "策略代码")
+    private String strategyCode;
+
+    /** 策略名称 */
+    @Excel(name = "策略名称")
+    private String strategyName;
+
+    /** 执行日期 */
+    @JsonFormat(pattern = "yyyy-MM-dd")
+    @Excel(name = "执行日期", width = 30, dateFormat = "yyyy-MM-dd")
+    private Date date;
+
+    /** 优先级 */
+    @Excel(name = "优先级")
+    private Long priority;
+
+    /**
+     * 小时策略
+     */
+    private List<ElecValencyHourStrategy> hourStrategys;
+
+    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 setStrategyName(String strategyName) 
+    {
+        this.strategyName = strategyName;
+    }
+
+    public String getStrategyName() 
+    {
+        return strategyName;
+    }
+    public void setDate(Date date) 
+    {
+        this.date = date;
+    }
+
+    public Date getDate() 
+    {
+        return date;
+    }
+    public void setPriority(Long priority) 
+    {
+        this.priority = priority;
+    }
+
+    public Long getPriority() 
+    {
+        return priority;
+    }
+
+    public List<ElecValencyHourStrategy> getHourStrategys() {
+        return hourStrategys;
+    }
+
+    public void setHourStrategys(List<ElecValencyHourStrategy> hourStrategys) {
+        this.hourStrategys = hourStrategys;
+    }
+
+    @Override
+    public String toString() {
+        return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
+            .append("id", getId())
+            .append("strategyCode", getStrategyCode())
+            .append("strategyName", getStrategyName())
+            .append("date", getDate())
+            .append("priority", getPriority())
+            .append("createTime", getCreateTime())
+            .append("updateTime", getUpdateTime())
+            .toString();
+    }
+}

+ 0 - 185
ems-cloud/ems-modules/ems-server/src/main/java/com/ruoyi/ems/domain/ElectrovalencyConfig.java

@@ -1,185 +0,0 @@
-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;
-
-/**
- * 电价配置对象 sys_electrovalency_config
- * 
- * @author ruoyi
- * @date 2024-07-12
- */
-public class ElectrovalencyConfig extends BaseEntity
-{
-    private static final long serialVersionUID = 1L;
-
-    /** 序号 */
-    private Long id;
-
-    /** 配置代码 */
-    @Excel(name = "配置代码")
-    private String cfgCode;
-
-    /** 用电分类 */
-    @Excel(name = "用电分类")
-    private Long elecClass;
-
-    /** 价格类型 */
-    @Excel(name = "价格类型")
-    private Long priceType;
-
-    /** 年用电量下限 */
-    @Excel(name = "年用电量下限")
-    private Long quantityLowerLimit;
-
-    /** 年用电量上限 */
-    @Excel(name = "年用电量上限")
-    private Long quantityUpperLimit;
-
-    /** 不满1千伏(价格) */
-    @Excel(name = "不满1千伏")
-    private Double priceLess1kv;
-
-    /** 不满10千伏(价格) */
-    @Excel(name = "不满10千伏")
-    private Double price1kv10kv;
-
-    /** 20-30千伏(价格) */
-    @Excel(name = "20-30千伏")
-    private Double price20kv35kv;
-
-    /** 35-110千伏(价格) */
-    @Excel(name = "35-110千伏")
-    private Double price35kv110kv;
-
-    /** 110千伏(价格) */
-    @Excel(name = "110千伏")
-    private Double price110kv;
-
-    /** 220千伏(价格) */
-    @Excel(name = "220千伏")
-    private Double price220kv;
-
-    public void setId(Long id) 
-    {
-        this.id = id;
-    }
-
-    public Long getId() 
-    {
-        return id;
-    }
-    public void setCfgCode(String cfgCode) 
-    {
-        this.cfgCode = cfgCode;
-    }
-
-    public String getCfgCode() 
-    {
-        return cfgCode;
-    }
-    public void setElecClass(Long elecClass) 
-    {
-        this.elecClass = elecClass;
-    }
-
-    public Long getElecClass() 
-    {
-        return elecClass;
-    }
-    public void setPriceType(Long priceType) 
-    {
-        this.priceType = priceType;
-    }
-
-    public Long getPriceType() 
-    {
-        return priceType;
-    }
-    public void setQuantityLowerLimit(Long quantityLowerLimit) 
-    {
-        this.quantityLowerLimit = quantityLowerLimit;
-    }
-
-    public Long getQuantityLowerLimit() 
-    {
-        return quantityLowerLimit;
-    }
-    public void setQuantityUpperLimit(Long quantityUpperLimit) 
-    {
-        this.quantityUpperLimit = quantityUpperLimit;
-    }
-
-    public Long getQuantityUpperLimit() 
-    {
-        return quantityUpperLimit;
-    }
-
-    public Double getPriceLess1kv() {
-        return priceLess1kv;
-    }
-
-    public void setPriceLess1kv(Double priceLess1kv) {
-        this.priceLess1kv = priceLess1kv;
-    }
-
-    public Double getPrice1kv10kv() {
-        return price1kv10kv;
-    }
-
-    public void setPrice1kv10kv(Double price1kv10kv) {
-        this.price1kv10kv = price1kv10kv;
-    }
-
-    public Double getPrice20kv35kv() {
-        return price20kv35kv;
-    }
-
-    public void setPrice20kv35kv(Double price20kv35kv) {
-        this.price20kv35kv = price20kv35kv;
-    }
-
-    public Double getPrice35kv110kv() {
-        return price35kv110kv;
-    }
-
-    public void setPrice35kv110kv(Double price35kv110kv) {
-        this.price35kv110kv = price35kv110kv;
-    }
-
-    public Double getPrice110kv() {
-        return price110kv;
-    }
-
-    public void setPrice110kv(Double price110kv) {
-        this.price110kv = price110kv;
-    }
-
-    public Double getPrice220kv() {
-        return price220kv;
-    }
-
-    public void setPrice220kv(Double price220kv) {
-        this.price220kv = price220kv;
-    }
-
-    @Override
-    public String toString() {
-        return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
-            .append("id", getId())
-            .append("cfgCode", getCfgCode())
-            .append("elecClass", getElecClass())
-            .append("priceType", getPriceType())
-            .append("quantityLowerLimit", getQuantityLowerLimit())
-            .append("quantityUpperLimit", getQuantityUpperLimit())
-            .append("priceLess1kv", getPriceLess1kv())
-            .append("price1kv10kv", getPrice1kv10kv())
-            .append("price20kv35kv", getPrice20kv35kv())
-            .append("price35kv110kv", getPrice35kv110kv())
-            .append("price110kv", getPrice110kv())
-            .append("price220kv", getPrice220kv())
-            .toString();
-    }
-}

+ 9 - 0
ems-cloud/ems-modules/ems-server/src/main/java/com/ruoyi/ems/domain/EmsFacsAttr.java

@@ -15,6 +15,15 @@ public class EmsFacsAttr extends BaseEntity
 {
     private static final long serialVersionUID = 1L;
 
+    public EmsFacsAttr(){
+        super();
+    }
+
+    public EmsFacsAttr(String facsCode){
+        super();
+        this.facsCode = facsCode;
+    }
+
     /** 序号 */
     private Long id;
 

+ 28 - 0
ems-cloud/ems-modules/ems-server/src/main/java/com/ruoyi/ems/domain/common/AreaTier.java

@@ -0,0 +1,28 @@
+/*
+ * 文 件 名:  AreaTier
+ * 版    权:  浩鲸云计算科技股份有限公司
+ * 描    述:  <描述>
+ * 修 改 人:  lvwenbin
+ * 修改时间:  2024/7/25
+ * 跟踪单号:  <跟踪单号>
+ * 修改单号:  <修改单号>
+ * 修改内容:  <修改内容>
+ */
+package com.ruoyi.ems.domain.common;
+
+/**
+ * 区域层级枚举
+ * <功能详细描述>
+ *
+ * @author lvwenbin
+ * @version [版本号, 2024/7/25]
+ * @see [相关类/方法]
+ * @since [产品/模块版本]
+ */
+public enum AreaTier {
+    Area,
+
+    Building,
+
+    Zoning;
+}

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

@@ -0,0 +1,108 @@
+/*
+ * 文 件 名:  TreeEntity
+ * 版    权:  浩鲸云计算科技股份有限公司
+ * 描    述:  <描述>
+ * 修 改 人:  lvwenbin
+ * 修改时间:  2024/7/24
+ * 跟踪单号:  <跟踪单号>
+ * 修改单号:  <修改单号>
+ * 修改内容:  <修改内容>
+ */
+package com.ruoyi.ems.domain.vo;
+
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.ruoyi.ems.domain.Area;
+import com.ruoyi.ems.domain.AreaBuilding;
+import com.ruoyi.ems.domain.AreaBuildingZoning;
+import com.ruoyi.ems.domain.common.AreaTier;
+import com.ruoyi.system.api.domain.SysDept;
+
+import java.util.List;
+import java.util.stream.Collectors;
+
+/**
+ * <一句话功能简述>
+ * <功能详细描述>
+ *
+ * @author lvwenbin
+ * @version [版本号, 2024/7/24]
+ * @see [相关类/方法]
+ * @since [产品/模块版本]
+ */
+public class TreeEntity {
+    /** 节点ID */
+    private String id;
+
+    /** 节点名称 */
+    private String label;
+
+    private String tier;
+
+    /** 子节点 */
+    @JsonInclude(JsonInclude.Include.NON_EMPTY)
+    private List<TreeEntity> children;
+
+    public TreeEntity()
+    {
+
+    }
+
+    public TreeEntity(Area area)
+    {
+        this.id = area.getAreaCode();
+        this.label = area.getAreaName();
+        this.tier = AreaTier.Area.name();
+    }
+
+    public TreeEntity(AreaBuilding building)
+    {
+        this.id = building.getBldgCode();
+        this.label = building.getBldgName();
+        this.tier = AreaTier.Building.name();
+    }
+
+    public TreeEntity(AreaBuildingZoning buildingZoning)
+    {
+        this.id = buildingZoning.getZoningCode();
+        this.label = buildingZoning.getZoningName();
+        this.tier = AreaTier.Zoning.name();
+    }
+
+    public String getId()
+    {
+        return id;
+    }
+
+    public void setId(String id)
+    {
+        this.id = id;
+    }
+
+    public String getLabel()
+    {
+        return label;
+    }
+
+    public void setLabel(String label)
+    {
+        this.label = label;
+    }
+
+    public String getTier() {
+        return tier;
+    }
+
+    public void setTier(String tier) {
+        this.tier = tier;
+    }
+
+    public List<TreeEntity> getChildren()
+    {
+        return children;
+    }
+
+    public void setChildren(List<TreeEntity> children)
+    {
+        this.children = children;
+    }
+}

+ 61 - 0
ems-cloud/ems-modules/ems-server/src/main/java/com/ruoyi/ems/mapper/AreaElectricityAttrMapper.java

@@ -0,0 +1,61 @@
+package com.ruoyi.ems.mapper;
+
+import java.util.List;
+
+import com.ruoyi.ems.domain.AreaElectricityAttr;
+
+/**
+ * 服务区用电属性Mapper接口
+ *
+ * @author ruoyi
+ * @date 2024-07-23
+ */
+public interface AreaElectricityAttrMapper {
+    /**
+     * 查询服务区用电属性
+     *
+     * @param id 服务区用电属性主键
+     * @return 服务区用电属性
+     */
+    AreaElectricityAttr selectAreaElectricityAttrById(Long id);
+
+    /**
+     * 查询服务区用电属性列表
+     *
+     * @param areaElectricityAttr 服务区用电属性
+     * @return 服务区用电属性集合
+     */
+    List<AreaElectricityAttr> selectAreaElectricityAttrList(AreaElectricityAttr areaElectricityAttr);
+
+    /**
+     * 新增服务区用电属性
+     *
+     * @param areaElectricityAttr 服务区用电属性
+     * @return 结果
+     */
+    int insertAreaElectricityAttr(AreaElectricityAttr areaElectricityAttr);
+
+    /**
+     * 修改服务区用电属性
+     *
+     * @param areaElectricityAttr 服务区用电属性
+     * @return 结果
+     */
+    int updateAreaElectricityAttr(AreaElectricityAttr areaElectricityAttr);
+
+    /**
+     * 删除服务区用电属性
+     *
+     * @param id 服务区用电属性主键
+     * @return 结果
+     */
+    int deleteAreaElectricityAttrById(Long id);
+
+    /**
+     * 批量删除服务区用电属性
+     *
+     * @param ids 需要删除的数据主键集合
+     * @return 结果
+     */
+    int deleteAreaElectricityAttrByIds(Long[] ids);
+}

+ 15 - 15
ems-cloud/ems-modules/ems-server/src/main/java/com/ruoyi/ems/mapper/AreaMapper.java

@@ -1,61 +1,61 @@
 package com.ruoyi.ems.mapper;
 
 import java.util.List;
+
 import com.ruoyi.ems.domain.Area;
 
 /**
  * 服务区Mapper接口
- * 
+ *
  * @author ruoyi
  * @date 2024-07-09
  */
-public interface AreaMapper
-{
+public interface AreaMapper {
     /**
      * 查询服务区
-     * 
+     *
      * @param id 服务区主键
      * @return 服务区
      */
-    public Area selectAreaById(Long id);
+    Area selectAreaById(Long id);
 
     /**
      * 查询服务区列表
-     * 
+     *
      * @param admServiceArea 服务区
      * @return 服务区集合
      */
-    public List<Area> selectAreaList(Area admServiceArea);
+    List<Area> selectAreaList(Area admServiceArea);
 
     /**
      * 新增服务区
-     * 
+     *
      * @param admServiceArea 服务区
      * @return 结果
      */
-    public int insertArea(Area admServiceArea);
+    int insertArea(Area admServiceArea);
 
     /**
      * 修改服务区
-     * 
+     *
      * @param admServiceArea 服务区
      * @return 结果
      */
-    public int updateArea(Area admServiceArea);
+    int updateArea(Area admServiceArea);
 
     /**
      * 删除服务区
-     * 
+     *
      * @param id 服务区主键
      * @return 结果
      */
-    public int deleteAreaById(Long id);
+    int deleteAreaById(Long id);
 
     /**
      * 批量删除服务区
-     * 
+     *
      * @param ids 需要删除的数据主键集合
      * @return 结果
      */
-    public int deleteAreaByIds(Long[] ids);
+    int deleteAreaByIds(Long[] ids);
 }

+ 61 - 0
ems-cloud/ems-modules/ems-server/src/main/java/com/ruoyi/ems/mapper/ElecValencyConfigMapper.java

@@ -0,0 +1,61 @@
+package com.ruoyi.ems.mapper;
+
+import com.ruoyi.ems.domain.ElecValencyConfig;
+
+import java.util.List;
+
+/**
+ * 电价配置Mapper接口
+ *
+ * @author ruoyi
+ * @date 2024-07-23
+ */
+public interface ElecValencyConfigMapper {
+    /**
+     * 查询电价配置
+     *
+     * @param id 电价配置主键
+     * @return 电价配置
+     */
+    ElecValencyConfig selectElecValencyConfigById(Long id);
+
+    /**
+     * 查询电价配置列表
+     *
+     * @param elecValencyConfig 电价配置
+     * @return 电价配置集合
+     */
+    List<ElecValencyConfig> selectElecValencyConfigList(ElecValencyConfig elecValencyConfig);
+
+    /**
+     * 新增电价配置
+     *
+     * @param elecValencyConfig 电价配置
+     * @return 结果
+     */
+    int insertElecValencyConfig(ElecValencyConfig elecValencyConfig);
+
+    /**
+     * 修改电价配置
+     *
+     * @param elecValencyConfig 电价配置
+     * @return 结果
+     */
+    int updateElecValencyConfig(ElecValencyConfig elecValencyConfig);
+
+    /**
+     * 删除电价配置
+     *
+     * @param id 电价配置主键
+     * @return 结果
+     */
+    int deleteElecValencyConfigById(Long id);
+
+    /**
+     * 批量删除电价配置
+     *
+     * @param ids 需要删除的数据主键集合
+     * @return 结果
+     */
+    int deleteElecValencyConfigByIds(Long[] ids);
+}

+ 77 - 0
ems-cloud/ems-modules/ems-server/src/main/java/com/ruoyi/ems/mapper/ElecValencyHourStrategyMapper.java

@@ -0,0 +1,77 @@
+package com.ruoyi.ems.mapper;
+
+import java.util.List;
+
+import com.ruoyi.ems.domain.ElecValencyHourStrategy;
+
+/**
+ * 电价策略小时Mapper接口
+ *
+ * @author ruoyi
+ * @date 2024-07-23
+ */
+public interface ElecValencyHourStrategyMapper {
+    /**
+     * 查询电价策略小时
+     *
+     * @param id 电价策略小时主键
+     * @return 电价策略小时
+     */
+    ElecValencyHourStrategy selectElecValencyStrategyHourById(Long id);
+
+    /**
+     * 查询电价策略小时列表
+     *
+     * @param elecValencyStrategyHour 电价策略小时
+     * @return 电价策略小时集合
+     */
+    List<ElecValencyHourStrategy> selectElecValencyStrategyHourList(ElecValencyHourStrategy elecValencyStrategyHour);
+
+    /**
+     * 新增电价策略小时
+     *
+     * @param elecValencyStrategyHour 电价策略小时
+     * @return 结果
+     */
+    int insertElecValencyStrategyHour(ElecValencyHourStrategy elecValencyStrategyHour);
+
+    /**
+     * 批量新增电价策略小时
+     *
+     * @param elecValencyStrategyHours 电价策略小时列表
+     * @return 结果
+     */
+    int insertElecValencyStrategyHourBatch(List<ElecValencyHourStrategy> elecValencyStrategyHours);
+
+    /**
+     * 修改电价策略小时
+     *
+     * @param elecValencyStrategyHour 电价策略小时
+     * @return 结果
+     */
+    int updateElecValencyStrategyHour(ElecValencyHourStrategy elecValencyStrategyHour);
+
+    /**
+     * 删除电价策略小时
+     *
+     * @param id 电价策略小时主键
+     * @return 结果
+     */
+    int deleteElecValencyStrategyHourById(Long id);
+
+    /**
+     * 删除电价策略小时
+     *
+     * @param strategyCode 策略编码
+     * @return 结果
+     */
+    int deleteElecValencyStrategyHourByStrategy(String strategyCode);
+
+    /**
+     * 批量删除电价策略小时
+     *
+     * @param ids 需要删除的数据主键集合
+     * @return 结果
+     */
+    int deleteElecValencyStrategyHourByIds(Long[] ids);
+}

+ 61 - 0
ems-cloud/ems-modules/ems-server/src/main/java/com/ruoyi/ems/mapper/ElecValencyStrategyMapper.java

@@ -0,0 +1,61 @@
+package com.ruoyi.ems.mapper;
+
+import com.ruoyi.ems.domain.ElecValencyStrategy;
+
+import java.util.List;
+
+/**
+ * 电价策略Mapper接口
+ *
+ * @author ruoyi
+ * @date 2024-07-23
+ */
+public interface ElecValencyStrategyMapper {
+    /**
+     * 查询电价策略
+     *
+     * @param id 电价策略主键
+     * @return 电价策略
+     */
+    ElecValencyStrategy selectElecValencyStrategyById(Long id);
+
+    /**
+     * 查询电价策略列表
+     *
+     * @param sysElectrovalencyStrategy 电价策略
+     * @return 电价策略集合
+     */
+    List<ElecValencyStrategy> selectElecValencyStrategyList(ElecValencyStrategy sysElectrovalencyStrategy);
+
+    /**
+     * 新增电价策略
+     *
+     * @param sysElectrovalencyStrategy 电价策略
+     * @return 结果
+     */
+    int insertElecValencyStrategy(ElecValencyStrategy sysElectrovalencyStrategy);
+
+    /**
+     * 修改电价策略
+     *
+     * @param sysElectrovalencyStrategy 电价策略
+     * @return 结果
+     */
+    int updateElecValencyStrategy(ElecValencyStrategy sysElectrovalencyStrategy);
+
+    /**
+     * 删除电价策略
+     *
+     * @param id 电价策略主键
+     * @return 结果
+     */
+    int deleteElecValencyStrategyById(Long id);
+
+    /**
+     * 批量删除电价策略
+     *
+     * @param ids 需要删除的数据主键集合
+     * @return 结果
+     */
+    int deleteElecValencyStrategyByIds(Long[] ids);
+}

+ 0 - 62
ems-cloud/ems-modules/ems-server/src/main/java/com/ruoyi/ems/mapper/ElectrovalencyConfigMapper.java

@@ -1,62 +0,0 @@
-package com.ruoyi.ems.mapper;
-
-import java.util.List;
-
-import com.ruoyi.ems.domain.ElectrovalencyConfig;
-
-/**
- * 电价配置Mapper接口
- * 
- * @author ruoyi
- * @date 2024-07-12
- */
-public interface ElectrovalencyConfigMapper
-{
-    /**
-     * 查询电价配置
-     * 
-     * @param id 电价配置主键
-     * @return 电价配置
-     */
-    ElectrovalencyConfig selectElectrovalencyConfigById(Long id);
-
-    /**
-     * 查询电价配置列表
-     * 
-     * @param electrovalencyConfig 电价配置
-     * @return 电价配置集合
-     */
-    List<ElectrovalencyConfig> selectElectrovalencyConfigList(ElectrovalencyConfig electrovalencyConfig);
-
-    /**
-     * 新增电价配置
-     * 
-     * @param electrovalencyConfig 电价配置
-     * @return 结果
-     */
-     int insertElectrovalencyConfig(ElectrovalencyConfig electrovalencyConfig);
-
-    /**
-     * 修改电价配置
-     * 
-     * @param electrovalencyConfig 电价配置
-     * @return 结果
-     */
-     int updateElectrovalencyConfig(ElectrovalencyConfig electrovalencyConfig);
-
-    /**
-     * 删除电价配置
-     * 
-     * @param id 电价配置主键
-     * @return 结果
-     */
-     int deleteElectrovalencyConfigById(Long id);
-
-    /**
-     * 批量删除电价配置
-     * 
-     * @param ids 需要删除的数据主键集合
-     * @return 结果
-     */
-     int deleteElectrovalencyConfigByIds(Long[] ids);
-}

+ 0 - 62
ems-cloud/ems-modules/ems-server/src/main/java/com/ruoyi/ems/mapper/ElectrovalencyPeakValleyMapper.java

@@ -1,62 +0,0 @@
-package com.ruoyi.ems.mapper;
-
-import java.util.List;
-
-import com.ruoyi.ems.domain.ElectrovalencyPeakValley;
-
-/**
- * 电价峰谷Mapper接口
- * 
- * @author ruoyi
- * @date 2024-07-12
- */
-public interface ElectrovalencyPeakValleyMapper
-{
-    /**
-     * 查询电价峰谷
-     * 
-     * @param id 电价峰谷主键
-     * @return 电价峰谷
-     */
-    ElectrovalencyPeakValley selectElectrovalencyPeakValleyById(Long id);
-
-    /**
-     * 查询电价峰谷列表
-     * 
-     * @param electrovalencyPeakValley 电价峰谷
-     * @return 电价峰谷集合
-     */
-     List<ElectrovalencyPeakValley> selectElectrovalencyPeakValleyList(ElectrovalencyPeakValley electrovalencyPeakValley);
-
-    /**
-     * 新增电价峰谷
-     * 
-     * @param electrovalencyPeakValley 电价峰谷
-     * @return 结果
-     */
-     int insertElectrovalencyPeakValley(ElectrovalencyPeakValley electrovalencyPeakValley);
-
-    /**
-     * 修改电价峰谷
-     * 
-     * @param electrovalencyPeakValley 电价峰谷
-     * @return 结果
-     */
-     int updateElectrovalencyPeakValley(ElectrovalencyPeakValley electrovalencyPeakValley);
-
-    /**
-     * 删除电价峰谷
-     * 
-     * @param id 电价峰谷主键
-     * @return 结果
-     */
-     int deleteElectrovalencyPeakValleyById(Long id);
-
-    /**
-     * 批量删除电价峰谷
-     * 
-     * @param ids 需要删除的数据主键集合
-     * @return 结果
-     */
-     int deleteElectrovalencyPeakValleyByIds(Long[] ids);
-}

+ 62 - 0
ems-cloud/ems-modules/ems-server/src/main/java/com/ruoyi/ems/service/IAreaElectricityAttrService.java

@@ -0,0 +1,62 @@
+package com.ruoyi.ems.service;
+
+import java.util.List;
+
+import com.ruoyi.ems.domain.AreaElectricityAttr;
+
+/**
+ * 服务区用电属性Service接口
+ * 
+ * @author ruoyi
+ * @date 2024-07-23
+ */
+public interface IAreaElectricityAttrService
+{
+    /**
+     * 查询服务区用电属性
+     * 
+     * @param id 服务区用电属性主键
+     * @return 服务区用电属性
+     */
+     AreaElectricityAttr selectAreaElectricityAttrById(Long id);
+
+    /**
+     * 查询服务区用电属性列表
+     * 
+     * @param areaElectricityAttr 服务区用电属性
+     * @return 服务区用电属性集合
+     */
+     List<AreaElectricityAttr> selectAreaElectricityAttrList(AreaElectricityAttr areaElectricityAttr);
+
+    /**
+     * 新增服务区用电属性
+     * 
+     * @param areaElectricityAttr 服务区用电属性
+     * @return 结果
+     */
+     int insertAreaElectricityAttr(AreaElectricityAttr areaElectricityAttr);
+
+    /**
+     * 修改服务区用电属性
+     * 
+     * @param areaElectricityAttr 服务区用电属性
+     * @return 结果
+     */
+     int updateAreaElectricityAttr(AreaElectricityAttr areaElectricityAttr);
+
+    /**
+     * 批量删除服务区用电属性
+     * 
+     * @param ids 需要删除的服务区用电属性主键集合
+     * @return 结果
+     */
+     int deleteAreaElectricityAttrByIds(Long[] ids);
+
+    /**
+     * 删除服务区用电属性信息
+     * 
+     * @param id 服务区用电属性主键
+     * @return 结果
+     */
+     int deleteAreaElectricityAttrById(Long id);
+}

+ 9 - 0
ems-cloud/ems-modules/ems-server/src/main/java/com/ruoyi/ems/service/IAreaService.java

@@ -3,6 +3,7 @@ package com.ruoyi.ems.service;
 import java.util.List;
 
 import com.ruoyi.ems.domain.Area;
+import com.ruoyi.ems.domain.vo.TreeEntity;
 
 /**
  * 服务区Service接口
@@ -28,6 +29,14 @@ public interface IAreaService {
     List<Area> selectAreaList(Area area);
 
     /**
+     * 查询区域位置树
+     * @param tier 层级
+     * @param name 名称
+     * @return 区域区域位置树
+     */
+    List<TreeEntity> selectAreaTreeList(String tier, String name);
+
+    /**
      * 新增服务区
      *
      * @param area 服务区

+ 62 - 0
ems-cloud/ems-modules/ems-server/src/main/java/com/ruoyi/ems/service/IElecValencyConfigService.java

@@ -0,0 +1,62 @@
+package com.ruoyi.ems.service;
+
+import java.util.List;
+
+import com.ruoyi.ems.domain.ElecValencyConfig;
+
+/**
+ * 电价配置Service接口
+ * 
+ * @author ruoyi
+ * @date 2024-07-23
+ */
+public interface IElecValencyConfigService
+{
+    /**
+     * 查询电价配置
+     * 
+     * @param id 电价配置主键
+     * @return 电价配置
+     */
+     ElecValencyConfig selectElecValencyConfigById(Long id);
+
+    /**
+     * 查询电价配置列表
+     * 
+     * @param elecValencyConfig 电价配置
+     * @return 电价配置集合
+     */
+     List<ElecValencyConfig> selectElecValencyConfigList(ElecValencyConfig elecValencyConfig);
+
+    /**
+     * 新增电价配置
+     * 
+     * @param elecValencyConfig 电价配置
+     * @return 结果
+     */
+     int insertElecValencyConfig(ElecValencyConfig elecValencyConfig);
+
+    /**
+     * 修改电价配置
+     * 
+     * @param elecValencyConfig 电价配置
+     * @return 结果
+     */
+     int updateElecValencyConfig(ElecValencyConfig elecValencyConfig);
+
+    /**
+     * 批量删除电价配置
+     * 
+     * @param ids 需要删除的电价配置主键集合
+     * @return 结果
+     */
+     int deleteElecValencyConfigByIds(Long[] ids);
+
+    /**
+     * 删除电价配置信息
+     * 
+     * @param id 电价配置主键
+     * @return 结果
+     */
+     int deleteElecValencyConfigById(Long id);
+}

+ 78 - 0
ems-cloud/ems-modules/ems-server/src/main/java/com/ruoyi/ems/service/IElecValencyHourStrategyService.java

@@ -0,0 +1,78 @@
+package com.ruoyi.ems.service;
+
+import com.ruoyi.ems.domain.ElecValencyHourStrategy;
+
+import java.util.List;
+
+/**
+ * 电价策略小时Service接口
+ * 
+ * @author ruoyi
+ * @date 2024-07-23
+ */
+public interface IElecValencyHourStrategyService
+{
+    /**
+     * 查询电价策略小时
+     * 
+     * @param id 电价策略小时主键
+     * @return 电价策略小时
+     */
+     ElecValencyHourStrategy selectHourStrategyById(Long id);
+
+    /**
+     * 查询电价策略小时列表
+     * 
+     * @param HourStrategy 电价策略小时
+     * @return 电价策略小时集合
+     */
+     List<ElecValencyHourStrategy> selectHourStrategyList(ElecValencyHourStrategy HourStrategy);
+
+    /**
+     * 新增电价策略小时
+     * 
+     * @param HourStrategy 电价策略小时
+     * @return 结果
+     */
+     int insertHourStrategy(ElecValencyHourStrategy HourStrategy);
+
+    /**
+     * 批量新增电价策略小时
+     *
+     * @param hourStrategys 电价策略小时列表
+     * @return 结果
+     */
+     int insertHourStrategyList(List<ElecValencyHourStrategy> hourStrategys);
+
+    /**
+     * 修改电价策略小时
+     * 
+     * @param hourStrategy 电价策略小时
+     * @return 结果
+     */
+     int updateHourStrategy(ElecValencyHourStrategy hourStrategy);
+
+    /**
+     * 批量删除电价策略小时
+     * 
+     * @param ids 需要删除的电价策略小时主键集合
+     * @return 结果
+     */
+     int deleteHourStrategyByIds(Long[] ids);
+
+    /**
+     * 删除电价策略小时信息
+     * 
+     * @param id 电价策略小时主键
+     * @return 结果
+     */
+     int deleteHourStrategyById(Long id);
+
+    /**
+     * 删除电价策略小时信息
+     *
+     * @param strategyCode 策略编码
+     * @return 结果
+     */
+    int deleteHourStrategyByStrategy(String strategyCode);
+}

+ 62 - 0
ems-cloud/ems-modules/ems-server/src/main/java/com/ruoyi/ems/service/IElecValencyStrategyService.java

@@ -0,0 +1,62 @@
+package com.ruoyi.ems.service;
+
+import java.util.List;
+
+import com.ruoyi.ems.domain.ElecValencyStrategy;
+
+/**
+ * 电价策略Service接口
+ * 
+ * @author ruoyi
+ * @date 2024-07-23
+ */
+public interface IElecValencyStrategyService
+{
+    /**
+     * 查询电价策略
+     * 
+     * @param id 电价策略主键
+     * @return 电价策略
+     */
+     ElecValencyStrategy selectStrategyById(Long id);
+
+    /**
+     * 查询电价策略列表
+     * 
+     * @param strategy 电价策略
+     * @return 电价策略集合
+     */
+     List<ElecValencyStrategy> selectStrategyList(ElecValencyStrategy strategy);
+
+    /**
+     * 新增电价策略
+     * 
+     * @param elecValencyStrategy 电价策略
+     * @return 结果
+     */
+     int insertStrategy(ElecValencyStrategy strategy);
+
+    /**
+     * 修改电价策略
+     * 
+     * @param strategy 电价策略
+     * @return 结果
+     */
+     int updateStrategy(ElecValencyStrategy strategy);
+
+    /**
+     * 批量删除电价策略
+     * 
+     * @param ids 需要删除的电价策略主键集合
+     * @return 结果
+     */
+     int deleteStrategyByIds(Long[] ids);
+
+    /**
+     * 删除电价策略信息
+     * 
+     * @param id 电价策略主键
+     * @return 结果
+     */
+     int deleteStrategyById(Long id);
+}

+ 0 - 61
ems-cloud/ems-modules/ems-server/src/main/java/com/ruoyi/ems/service/IElectrovalencyConfigService.java

@@ -1,61 +0,0 @@
-package com.ruoyi.ems.service;
-
-import java.util.List;
-
-import com.ruoyi.ems.domain.ElectrovalencyConfig;
-
-/**
- * 电价配置Service接口
- *
- * @author ruoyi
- * @date 2024-07-12
- */
-public interface IElectrovalencyConfigService {
-    /**
-     * 查询电价配置
-     *
-     * @param id 电价配置主键
-     * @return 电价配置
-     */
-    ElectrovalencyConfig selectElectrovalencyConfigById(Long id);
-
-    /**
-     * 查询电价配置列表
-     *
-     * @param electrovalencyConfig 电价配置
-     * @return 电价配置集合
-     */
-    List<ElectrovalencyConfig> selectElectrovalencyConfigList(ElectrovalencyConfig electrovalencyConfig);
-
-    /**
-     * 新增电价配置
-     *
-     * @param electrovalencyConfig 电价配置
-     * @return 结果
-     */
-    int insertElectrovalencyConfig(ElectrovalencyConfig electrovalencyConfig);
-
-    /**
-     * 修改电价配置
-     *
-     * @param electrovalencyConfig 电价配置
-     * @return 结果
-     */
-    int updateElectrovalencyConfig(ElectrovalencyConfig electrovalencyConfig);
-
-    /**
-     * 批量删除电价配置
-     *
-     * @param ids 需要删除的电价配置主键集合
-     * @return 结果
-     */
-    int deleteElectrovalencyConfigByIds(Long[] ids);
-
-    /**
-     * 删除电价配置信息
-     *
-     * @param id 电价配置主键
-     * @return 结果
-     */
-    int deleteElectrovalencyConfigById(Long id);
-}

+ 0 - 62
ems-cloud/ems-modules/ems-server/src/main/java/com/ruoyi/ems/service/IElectrovalencyPeakValleyService.java

@@ -1,62 +0,0 @@
-package com.ruoyi.ems.service;
-
-import com.ruoyi.ems.domain.ElectrovalencyPeakValley;
-
-import java.util.List;
-
-/**
- * 电价峰谷Service接口
- *
- * @author ruoyi
- * @date 2024-07-12
- */
-public interface IElectrovalencyPeakValleyService {
-    /**
-     * 查询电价峰谷
-     *
-     * @param id 电价峰谷主键
-     * @return 电价峰谷
-     */
-    ElectrovalencyPeakValley selectElectrovalencyPeakValleyById(Long id);
-
-    /**
-     * 查询电价峰谷列表
-     *
-     * @param electrovalencyPeakValley 电价峰谷
-     * @return 电价峰谷集合
-     */
-    List<ElectrovalencyPeakValley> selectElectrovalencyPeakValleyList(
-        ElectrovalencyPeakValley electrovalencyPeakValley);
-
-    /**
-     * 新增电价峰谷
-     *
-     * @param electrovalencyPeakValley 电价峰谷
-     * @return 结果
-     */
-    int insertElectrovalencyPeakValley(ElectrovalencyPeakValley electrovalencyPeakValley);
-
-    /**
-     * 修改电价峰谷
-     *
-     * @param electrovalencyPeakValley 电价峰谷
-     * @return 结果
-     */
-    int updateElectrovalencyPeakValley(ElectrovalencyPeakValley electrovalencyPeakValley);
-
-    /**
-     * 批量删除电价峰谷
-     *
-     * @param ids 需要删除的电价峰谷主键集合
-     * @return 结果
-     */
-    int deleteElectrovalencyPeakValleyByIds(Long[] ids);
-
-    /**
-     * 删除电价峰谷信息
-     *
-     * @param id 电价峰谷主键
-     * @return 结果
-     */
-    int deleteElectrovalencyPeakValleyById(Long id);
-}

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

@@ -0,0 +1,90 @@
+package com.ruoyi.ems.service.impl;
+
+import java.util.List;
+
+import com.ruoyi.common.core.utils.DateUtils;
+import com.ruoyi.ems.domain.AreaElectricityAttr;
+import com.ruoyi.ems.mapper.AreaElectricityAttrMapper;
+import com.ruoyi.ems.service.IAreaElectricityAttrService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+/**
+ * 服务区用电属性Service业务层处理
+ *
+ * @author ruoyi
+ * @date 2024-07-23
+ */
+@Service
+public class AreaElectricityAttrServiceImpl implements IAreaElectricityAttrService {
+    @Autowired
+    private AreaElectricityAttrMapper areaElectricityAttrMapper;
+
+    /**
+     * 查询服务区用电属性
+     *
+     * @param id 服务区用电属性主键
+     * @return 服务区用电属性
+     */
+    @Override
+    public AreaElectricityAttr selectAreaElectricityAttrById(Long id) {
+        return areaElectricityAttrMapper.selectAreaElectricityAttrById(id);
+    }
+
+    /**
+     * 查询服务区用电属性列表
+     *
+     * @param areaElectricityAttr 服务区用电属性
+     * @return 服务区用电属性
+     */
+    @Override
+    public List<AreaElectricityAttr> selectAreaElectricityAttrList(AreaElectricityAttr areaElectricityAttr) {
+        return areaElectricityAttrMapper.selectAreaElectricityAttrList(areaElectricityAttr);
+    }
+
+    /**
+     * 新增服务区用电属性
+     *
+     * @param areaElectricityAttr 服务区用电属性
+     * @return 结果
+     */
+    @Override
+    public int insertAreaElectricityAttr(AreaElectricityAttr areaElectricityAttr) {
+        areaElectricityAttr.setCreateTime(DateUtils.getNowDate());
+        return areaElectricityAttrMapper.insertAreaElectricityAttr(areaElectricityAttr);
+    }
+
+    /**
+     * 修改服务区用电属性
+     *
+     * @param areaElectricityAttr 服务区用电属性
+     * @return 结果
+     */
+    @Override
+    public int updateAreaElectricityAttr(AreaElectricityAttr areaElectricityAttr) {
+        areaElectricityAttr.setUpdateTime(DateUtils.getNowDate());
+        return areaElectricityAttrMapper.updateAreaElectricityAttr(areaElectricityAttr);
+    }
+
+    /**
+     * 批量删除服务区用电属性
+     *
+     * @param ids 需要删除的服务区用电属性主键
+     * @return 结果
+     */
+    @Override
+    public int deleteAreaElectricityAttrByIds(Long[] ids) {
+        return areaElectricityAttrMapper.deleteAreaElectricityAttrByIds(ids);
+    }
+
+    /**
+     * 删除服务区用电属性信息
+     *
+     * @param id 服务区用电属性主键
+     * @return 结果
+     */
+    @Override
+    public int deleteAreaElectricityAttrById(Long id) {
+        return areaElectricityAttrMapper.deleteAreaElectricityAttrById(id);
+    }
+}

+ 104 - 25
ems-cloud/ems-modules/ems-server/src/main/java/com/ruoyi/ems/service/impl/AreaServiceImpl.java

@@ -1,93 +1,172 @@
 package com.ruoyi.ems.service.impl;
 
-import java.util.List;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Service;
-import com.ruoyi.ems.mapper.AreaMapper;
+import com.alibaba.druid.util.StringUtils;
 import com.ruoyi.ems.domain.Area;
+import com.ruoyi.ems.domain.AreaBuilding;
+import com.ruoyi.ems.domain.AreaBuildingZoning;
+import com.ruoyi.ems.domain.common.AreaTier;
+import com.ruoyi.ems.domain.vo.TreeEntity;
+import com.ruoyi.ems.mapper.AreaMapper;
+import com.ruoyi.ems.service.IAreaBuildingService;
+import com.ruoyi.ems.service.IAreaBuildingZoningService;
 import com.ruoyi.ems.service.IAreaService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+import java.util.stream.Collectors;
 
 /**
  * 服务区Service业务层处理
- * 
+ *
  * @author ruoyi
  * @date 2024-07-09
  */
 @Service
-public class AreaServiceImpl implements IAreaService
-{
+public class AreaServiceImpl implements IAreaService {
     @Autowired
     private AreaMapper areaMapper;
 
+    @Autowired
+    private IAreaBuildingService buildingService;
+
+    @Autowired
+    private IAreaBuildingZoningService zoningService;
+
     /**
      * 查询服务区
-     * 
+     *
      * @param id 服务区主键
      * @return 服务区
      */
     @Override
-    public Area selectAreaById(Long id)
-    {
+    public Area selectAreaById(Long id) {
         return areaMapper.selectAreaById(id);
     }
 
     /**
      * 查询服务区列表
-     * 
+     *
      * @param area 服务区
      * @return 服务区
      */
     @Override
-    public List<Area> selectAreaList(Area area)
-    {
+    public List<Area> selectAreaList(Area area) {
         return areaMapper.selectAreaList(area);
     }
 
     /**
      * 新增服务区
-     * 
+     *
      * @param area 服务区
      * @return 结果
      */
     @Override
-    public int insertArea(Area area)
-    {
+    public int insertArea(Area area) {
         return areaMapper.insertArea(area);
     }
 
     /**
      * 修改服务区
-     * 
+     *
      * @param area 服务区
      * @return 结果
      */
     @Override
-    public int updateArea(Area area)
-    {
+    public int updateArea(Area area) {
         return areaMapper.updateArea(area);
     }
 
     /**
      * 批量删除服务区
-     * 
+     *
      * @param ids 需要删除的服务区主键
      * @return 结果
      */
     @Override
-    public int deleteAreaByIds(Long[] ids)
-    {
+    public int deleteAreaByIds(Long[] ids) {
+        for (Long id : ids) {
+            deleteRel(id);
+        }
+
         return areaMapper.deleteAreaByIds(ids);
     }
 
     /**
      * 删除服务区信息
-     * 
+     *
      * @param id 服务区主键
      * @return 结果
      */
     @Override
-    public int deleteAreaById(Long id)
-    {
+    public int deleteAreaById(Long id) {
         return areaMapper.deleteAreaById(id);
     }
+
+    @Override
+    public List<TreeEntity> selectAreaTreeList(String tier, String name) {
+        List<TreeEntity> entities = null;
+
+        if (StringUtils.equals(AreaTier.Area.name(), tier)) {
+            Area param = new Area();
+            param.setAreaName(name);
+            List<Area> areas = areaMapper.selectAreaList(param);
+            entities = areas.stream().map(TreeEntity::new).collect(Collectors.toList());
+        }
+        else if (StringUtils.equals(AreaTier.Building.name(), tier)) {
+            List<Area> areas = areaMapper.selectAreaList(new Area());
+            entities = areas.stream().map(TreeEntity::new).collect(Collectors.toList());
+            entities.forEach(area -> area.setChildren(getAreaBuilding(area.getId(), name)));
+        }
+        else if (StringUtils.equals(AreaTier.Zoning.name(), tier)) {
+            List<Area> areas = areaMapper.selectAreaList(new Area());
+            entities = areas.stream().map(TreeEntity::new).collect(Collectors.toList());
+            entities.forEach(area -> {
+                List<TreeEntity> buildings = getAreaBuilding(area.getId(), null);
+                buildings.forEach(building -> building.setChildren(getBuildingZoning(building.getId(), name)));
+                area.setChildren(buildings);
+            });
+        }
+
+        return entities;
+    }
+
+    private void deleteRel(long id) {
+        Area area = areaMapper.selectAreaById(id);
+
+        if (null != area) {
+            AreaBuilding buildingParam = new AreaBuilding();
+            buildingParam.setAreaCode(area.getAreaCode());
+
+            List<AreaBuilding> buildings = buildingService.selectAreaBuildingList(buildingParam);
+
+            for (AreaBuilding building : buildings) {
+                AreaBuildingZoning zoningParam = new AreaBuildingZoning();
+                zoningParam.setBldgCode(building.getBldgCode());
+                List<AreaBuildingZoning> zonings = zoningService.selectAreaBuildingZoningList(zoningParam);
+
+                for (AreaBuildingZoning zoning : zonings) {
+                    zoningService.deleteAreaBuildingZoningById(zoning.getId());
+                }
+
+                buildingService.deleteAreaBuildingById(building.getId());
+            }
+        }
+    }
+
+    private List<TreeEntity> getAreaBuilding(String areaCode, String name) {
+        AreaBuilding param = new AreaBuilding();
+        param.setAreaCode(areaCode);
+        param.setBldgName(name);
+        List<AreaBuilding> areaBuildings = buildingService.selectAreaBuildingList(param);
+        return areaBuildings.stream().map(TreeEntity::new).collect(Collectors.toList());
+    }
+
+    private List<TreeEntity> getBuildingZoning(String buildingCode, String name) {
+        AreaBuildingZoning param = new AreaBuildingZoning();
+        param.setBldgCode(buildingCode);
+        param.setZoningName(name);
+        List<AreaBuildingZoning> zonings = zoningService.selectAreaBuildingZoningList(param);
+        return zonings.stream().map(TreeEntity::new).collect(Collectors.toList());
+    }
 }

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

@@ -0,0 +1,94 @@
+package com.ruoyi.ems.service.impl;
+
+import java.util.List;
+
+import com.ruoyi.ems.domain.ElecValencyConfig;
+import com.ruoyi.ems.mapper.ElecValencyConfigMapper;
+import com.ruoyi.ems.service.IElecValencyConfigService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+/**
+ * 电价配置Service业务层处理
+ * 
+ * @author ruoyi
+ * @date 2024-07-23
+ */
+@Service
+public class ElecValencyConfigServiceImpl implements IElecValencyConfigService
+{
+    @Autowired
+    private ElecValencyConfigMapper elecValencyConfigMapper;
+
+    /**
+     * 查询电价配置
+     * 
+     * @param id 电价配置主键
+     * @return 电价配置
+     */
+    @Override
+    public ElecValencyConfig selectElecValencyConfigById(Long id)
+    {
+        return elecValencyConfigMapper.selectElecValencyConfigById(id);
+    }
+
+    /**
+     * 查询电价配置列表
+     * 
+     * @param elecValencyConfig 电价配置
+     * @return 电价配置
+     */
+    @Override
+    public List<ElecValencyConfig> selectElecValencyConfigList(ElecValencyConfig elecValencyConfig)
+    {
+        return elecValencyConfigMapper.selectElecValencyConfigList(elecValencyConfig);
+    }
+
+    /**
+     * 新增电价配置
+     * 
+     * @param elecValencyConfig 电价配置
+     * @return 结果
+     */
+    @Override
+    public int insertElecValencyConfig(ElecValencyConfig elecValencyConfig)
+    {
+        return elecValencyConfigMapper.insertElecValencyConfig(elecValencyConfig);
+    }
+
+    /**
+     * 修改电价配置
+     * 
+     * @param elecValencyConfig 电价配置
+     * @return 结果
+     */
+    @Override
+    public int updateElecValencyConfig(ElecValencyConfig elecValencyConfig)
+    {
+        return elecValencyConfigMapper.updateElecValencyConfig(elecValencyConfig);
+    }
+
+    /**
+     * 批量删除电价配置
+     * 
+     * @param ids 需要删除的电价配置主键
+     * @return 结果
+     */
+    @Override
+    public int deleteElecValencyConfigByIds(Long[] ids)
+    {
+        return elecValencyConfigMapper.deleteElecValencyConfigByIds(ids);
+    }
+
+    /**
+     * 删除电价配置信息
+     * 
+     * @param id 电价配置主键
+     * @return 结果
+     */
+    @Override
+    public int deleteElecValencyConfigById(Long id)
+    {
+        return elecValencyConfigMapper.deleteElecValencyConfigById(id);
+    }
+}

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

@@ -0,0 +1,110 @@
+package com.ruoyi.ems.service.impl;
+
+import java.util.List;
+
+import com.ruoyi.ems.domain.ElecValencyHourStrategy;
+import com.ruoyi.ems.mapper.ElecValencyHourStrategyMapper;
+import com.ruoyi.ems.service.IElecValencyHourStrategyService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+/**
+ * 电价策略小时Service业务层处理
+ *
+ * @author ruoyi
+ * @date 2024-07-23
+ */
+@Service
+public class ElecValencyHourStrategyServiceImpl implements IElecValencyHourStrategyService {
+    @Autowired
+    private ElecValencyHourStrategyMapper hourStrategyMapper;
+
+    /**
+     * 查询电价策略小时
+     *
+     * @param id 电价策略小时主键
+     * @return 电价策略小时
+     */
+    @Override
+    public ElecValencyHourStrategy selectHourStrategyById(Long id) {
+        return hourStrategyMapper.selectElecValencyStrategyHourById(id);
+    }
+
+    /**
+     * 查询电价策略小时列表
+     *
+     * @param hourStrategy 电价策略小时
+     * @return 电价策略小时
+     */
+    @Override
+    public List<ElecValencyHourStrategy> selectHourStrategyList(
+        ElecValencyHourStrategy hourStrategy) {
+        return hourStrategyMapper.selectElecValencyStrategyHourList(hourStrategy);
+    }
+
+    /**
+     * 新增电价策略小时
+     *
+     * @param hourStrategy 电价策略小时
+     * @return 结果
+     */
+    @Override
+    public int insertHourStrategy(ElecValencyHourStrategy hourStrategy) {
+        return hourStrategyMapper.insertElecValencyStrategyHour(hourStrategy);
+    }
+
+    /**
+     * 批量插入小时电价策略列表
+     *
+     * @param hourStrategys 小时电价策略列表
+     * @return 插入成功的小时电价策略数量
+     */
+    @Override
+    public int insertHourStrategyList(List<ElecValencyHourStrategy> hourStrategys) {
+        return hourStrategyMapper.insertElecValencyStrategyHourBatch(hourStrategys);
+    }
+
+    /**
+     * 修改电价策略小时
+     *
+     * @param hourStrategys 电价策略小时
+     * @return 结果
+     */
+    @Override
+    public int updateHourStrategy(ElecValencyHourStrategy hourStrategys) {
+        return hourStrategyMapper.updateElecValencyStrategyHour(hourStrategys);
+    }
+
+    /**
+     * 批量删除电价策略小时
+     *
+     * @param ids 需要删除的电价策略小时主键
+     * @return 结果
+     */
+    @Override
+    public int deleteHourStrategyByIds(Long[] ids) {
+        return hourStrategyMapper.deleteElecValencyStrategyHourByIds(ids);
+    }
+
+    /**
+     * 删除电价策略小时信息
+     *
+     * @param id 电价策略小时主键
+     * @return 结果
+     */
+    @Override
+    public int deleteHourStrategyById(Long id) {
+        return hourStrategyMapper.deleteElecValencyStrategyHourById(id);
+    }
+
+    /**
+     * 根据策略代码删除小时策略
+     *
+     * @param strategyCode 策略代码
+     * @return 删除的小时策略数量
+     */
+    @Override
+    public int deleteHourStrategyByStrategy(String strategyCode) {
+        return hourStrategyMapper.deleteElecValencyStrategyHourByStrategy(strategyCode);
+    }
+}

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

@@ -0,0 +1,147 @@
+package com.ruoyi.ems.service.impl;
+
+import java.util.List;
+import java.util.UUID;
+
+import com.ruoyi.common.core.utils.DateUtils;
+import com.ruoyi.ems.domain.ElecValencyHourStrategy;
+import com.ruoyi.ems.domain.ElecValencyStrategy;
+import com.ruoyi.ems.mapper.ElecValencyStrategyMapper;
+import com.ruoyi.ems.service.IElecValencyHourStrategyService;
+import com.ruoyi.ems.service.IElecValencyStrategyService;
+import org.apache.commons.collections4.CollectionUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+/**
+ * 电价策略Service业务层处理
+ *
+ * @author ruoyi
+ * @date 2024-07-23
+ */
+@Service
+public class ElecValencyStrategyServiceImpl implements IElecValencyStrategyService {
+    @Autowired
+    private ElecValencyStrategyMapper strategyMapper;
+
+    @Autowired
+    private IElecValencyHourStrategyService strategyHourService;
+
+    /**
+     * 查询电价策略
+     *
+     * @param id 电价策略主键
+     * @return 电价策略
+     */
+    @Override
+    public ElecValencyStrategy selectStrategyById(Long id) {
+        ElecValencyStrategy strategy = strategyMapper.selectElecValencyStrategyById(id);
+
+        if (null != strategy) {
+            strategy.setHourStrategys(strategyHourService.selectHourStrategyList(new ElecValencyHourStrategy(strategy.getStrategyCode())));
+        }
+
+        return strategy;
+    }
+
+    /**
+     * 查询电价策略列表
+     *
+     * @param strategy 电价策略
+     * @return 电价策略
+     */
+    @Override
+    public List<ElecValencyStrategy> selectStrategyList(ElecValencyStrategy strategy) {
+        List<ElecValencyStrategy> strategies = strategyMapper.selectElecValencyStrategyList(strategy);
+
+        if (CollectionUtils.isNotEmpty(strategies)) {
+            for (ElecValencyStrategy strategyItem : strategies) {
+                strategyItem.setHourStrategys(strategyHourService.selectHourStrategyList(new ElecValencyHourStrategy(strategyItem.getStrategyCode())));
+            }
+        }
+
+        return strategies;
+    }
+
+    /**
+     * 新增电价策略
+     *
+     * @param strategy 电价策略
+     * @return 结果
+     */
+    @Override
+    public int insertStrategy(ElecValencyStrategy strategy) {
+        strategy.setStrategyCode(UUID.randomUUID().toString());
+        strategy.setCreateTime(DateUtils.getNowDate());
+        int rows = strategyMapper.insertElecValencyStrategy(strategy);
+
+        for (ElecValencyHourStrategy hourStrategy : strategy.getHourStrategys()) {
+            hourStrategy.setStrategyCode(strategy.getStrategyCode());
+        }
+
+        strategyHourService.insertHourStrategyList(strategy.getHourStrategys());
+
+        return rows;
+    }
+
+    /**
+     * 修改电价策略
+     *
+     * @param strategy 电价策略
+     * @return 结果
+     */
+    @Override
+    public int updateStrategy(ElecValencyStrategy strategy) {
+        strategy.setUpdateTime(DateUtils.getNowDate());
+        int rows = strategyMapper.updateElecValencyStrategy(strategy);
+
+        if (CollectionUtils.isNotEmpty(strategy.getHourStrategys())) {
+            for (ElecValencyHourStrategy hourStrategy : strategy.getHourStrategys()) {
+                hourStrategy.setStrategyCode(strategy.getStrategyCode());
+            }
+
+            strategyHourService.deleteHourStrategyByStrategy(strategy.getStrategyCode());
+            strategyHourService.insertHourStrategyList(strategy.getHourStrategys());
+        } else {
+            strategyHourService.deleteHourStrategyByStrategy(strategy.getStrategyCode());
+        }
+
+        return rows;
+    }
+
+    /**
+     * 批量删除电价策略
+     *
+     * @param ids 需要删除的电价策略主键
+     * @return 结果
+     */
+    @Override
+    public int deleteStrategyByIds(Long[] ids) {
+        for (Long id : ids) {
+            ElecValencyStrategy strategy = strategyMapper.selectElecValencyStrategyById(id);
+
+            if (null != strategy) {
+                strategyHourService.deleteHourStrategyByStrategy(strategy.getStrategyCode());
+            }
+        }
+
+        return strategyMapper.deleteElecValencyStrategyByIds(ids);
+    }
+
+    /**
+     * 删除电价策略信息
+     *
+     * @param id 电价策略主键
+     * @return 结果
+     */
+    @Override
+    public int deleteStrategyById(Long id) {
+        ElecValencyStrategy strategy = strategyMapper.selectElecValencyStrategyById(id);
+
+        if (null != strategy) {
+            strategyHourService.deleteHourStrategyByStrategy(strategy.getStrategyCode());
+        }
+
+        return strategyMapper.deleteElecValencyStrategyById(id);
+    }
+}

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

@@ -1,94 +0,0 @@
-package com.ruoyi.ems.service.impl;
-
-import com.ruoyi.ems.domain.ElectrovalencyConfig;
-import com.ruoyi.ems.mapper.ElectrovalencyConfigMapper;
-import com.ruoyi.ems.service.IElectrovalencyConfigService;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Service;
-
-import java.util.List;
-
-/**
- * 电价配置Service业务层处理
- * 
- * @author ruoyi
- * @date 2024-07-12
- */
-@Service
-public class ElectrovalencyConfigServiceImpl implements IElectrovalencyConfigService
-{
-    @Autowired
-    private ElectrovalencyConfigMapper electrovalencyConfigMapper;
-
-    /**
-     * 查询电价配置
-     * 
-     * @param id 电价配置主键
-     * @return 电价配置
-     */
-    @Override
-    public ElectrovalencyConfig selectElectrovalencyConfigById(Long id)
-    {
-        return electrovalencyConfigMapper.selectElectrovalencyConfigById(id);
-    }
-
-    /**
-     * 查询电价配置列表
-     * 
-     * @param electrovalencyConfig 电价配置
-     * @return 电价配置
-     */
-    @Override
-    public List<ElectrovalencyConfig> selectElectrovalencyConfigList(ElectrovalencyConfig electrovalencyConfig)
-    {
-        return electrovalencyConfigMapper.selectElectrovalencyConfigList(electrovalencyConfig);
-    }
-
-    /**
-     * 新增电价配置
-     * 
-     * @param electrovalencyConfig 电价配置
-     * @return 结果
-     */
-    @Override
-    public int insertElectrovalencyConfig(ElectrovalencyConfig electrovalencyConfig)
-    {
-        return electrovalencyConfigMapper.insertElectrovalencyConfig(electrovalencyConfig);
-    }
-
-    /**
-     * 修改电价配置
-     * 
-     * @param electrovalencyConfig 电价配置
-     * @return 结果
-     */
-    @Override
-    public int updateElectrovalencyConfig(ElectrovalencyConfig electrovalencyConfig)
-    {
-        return electrovalencyConfigMapper.updateElectrovalencyConfig(electrovalencyConfig);
-    }
-
-    /**
-     * 批量删除电价配置
-     * 
-     * @param ids 需要删除的电价配置主键
-     * @return 结果
-     */
-    @Override
-    public int deleteElectrovalencyConfigByIds(Long[] ids)
-    {
-        return electrovalencyConfigMapper.deleteElectrovalencyConfigByIds(ids);
-    }
-
-    /**
-     * 删除电价配置信息
-     * 
-     * @param id 电价配置主键
-     * @return 结果
-     */
-    @Override
-    public int deleteElectrovalencyConfigById(Long id)
-    {
-        return electrovalencyConfigMapper.deleteElectrovalencyConfigById(id);
-    }
-}

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

@@ -1,95 +0,0 @@
-package com.ruoyi.ems.service.impl;
-
-import com.ruoyi.ems.domain.ElectrovalencyPeakValley;
-import com.ruoyi.ems.mapper.ElectrovalencyPeakValleyMapper;
-import com.ruoyi.ems.service.IElectrovalencyPeakValleyService;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Service;
-
-import java.util.List;
-
-
-/**
- * 电价峰谷Service业务层处理
- * 
- * @author ruoyi
- * @date 2024-07-12
- */
-@Service
-public class ElectrovalencyPeakValleyServiceImpl implements IElectrovalencyPeakValleyService
-{
-    @Autowired
-    private ElectrovalencyPeakValleyMapper electrovalencyPeakValleyMapper;
-
-    /**
-     * 查询电价峰谷
-     * 
-     * @param id 电价峰谷主键
-     * @return 电价峰谷
-     */
-    @Override
-    public ElectrovalencyPeakValley selectElectrovalencyPeakValleyById(Long id)
-    {
-        return electrovalencyPeakValleyMapper.selectElectrovalencyPeakValleyById(id);
-    }
-
-    /**
-     * 查询电价峰谷列表
-     * 
-     * @param electrovalencyPeakValley 电价峰谷
-     * @return 电价峰谷
-     */
-    @Override
-    public List<ElectrovalencyPeakValley> selectElectrovalencyPeakValleyList(ElectrovalencyPeakValley electrovalencyPeakValley)
-    {
-        return electrovalencyPeakValleyMapper.selectElectrovalencyPeakValleyList(electrovalencyPeakValley);
-    }
-
-    /**
-     * 新增电价峰谷
-     * 
-     * @param electrovalencyPeakValley 电价峰谷
-     * @return 结果
-     */
-    @Override
-    public int insertElectrovalencyPeakValley(ElectrovalencyPeakValley electrovalencyPeakValley)
-    {
-        return electrovalencyPeakValleyMapper.insertElectrovalencyPeakValley(electrovalencyPeakValley);
-    }
-
-    /**
-     * 修改电价峰谷
-     * 
-     * @param electrovalencyPeakValley 电价峰谷
-     * @return 结果
-     */
-    @Override
-    public int updateElectrovalencyPeakValley(ElectrovalencyPeakValley electrovalencyPeakValley)
-    {
-        return electrovalencyPeakValleyMapper.updateElectrovalencyPeakValley(electrovalencyPeakValley);
-    }
-
-    /**
-     * 批量删除电价峰谷
-     * 
-     * @param ids 需要删除的电价峰谷主键
-     * @return 结果
-     */
-    @Override
-    public int deleteElectrovalencyPeakValleyByIds(Long[] ids)
-    {
-        return electrovalencyPeakValleyMapper.deleteElectrovalencyPeakValleyByIds(ids);
-    }
-
-    /**
-     * 删除电价峰谷信息
-     * 
-     * @param id 电价峰谷主键
-     * @return 结果
-     */
-    @Override
-    public int deleteElectrovalencyPeakValleyById(Long id)
-    {
-        return electrovalencyPeakValleyMapper.deleteElectrovalencyPeakValleyById(id);
-    }
-}

+ 1 - 3
ems-cloud/ems-modules/ems-server/src/main/java/com/ruoyi/ems/service/impl/EmsFacsServiceImpl.java

@@ -149,9 +149,7 @@ public class EmsFacsServiceImpl implements IEmsFacsService {
     }
 
     private List<EmsFacsAttr> getFacsAttrs(EmsFacs emsFacs) {
-        EmsFacsAttr param = new EmsFacsAttr();
-        param.setFacsCode(emsFacs.getFacsCode());
-
+        EmsFacsAttr param = new EmsFacsAttr(emsFacs.getFacsCode());
         return facsAttrService.selectEmsFacsAttrList(param);
     }
 }

+ 5 - 1
ems-cloud/ems-modules/ems-server/src/main/resources/mapper/ems/AreaBuildingMapper.xml

@@ -24,7 +24,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 
     <select id="selectAreaBuildingList" parameterType="com.ruoyi.ems.domain.AreaBuilding" resultMap="AreaBuildingResult">
         <include refid="selectAreaBuildingVo"/>
-        <where>  
+        <where>
+            <if test="areaCode != null  and areaCode != ''"> and a.`area_code` = #{areaCode}</if>
             <if test="bldgCode != null  and bldgCode != ''"> and b.`bldg_code` = #{bldgCode}</if>
             <if test="bldgName != null  and bldgName != ''"> and b.`bldg_name` like concat('%', #{bldgName}, '%')</if>
             <if test="address != null  and address != ''"> and b.`address` = #{address}</if>
@@ -52,6 +53,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="bldgHeight != null">bldg_height,</if>
             <if test="floorArea != null">floor_area,</if>
             <if test="bldgUsage != null">bldg_usage,</if>
+            <if test="areaCode != null">area_code,</if>
          </trim>
         <trim prefix="values (" suffix=")" suffixOverrides=",">
             <if test="bldgCode != null and bldgCode != ''">#{bldgCode},</if>
@@ -62,6 +64,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="bldgHeight != null">#{bldgHeight},</if>
             <if test="floorArea != null">#{floorArea},</if>
             <if test="bldgUsage != null">#{bldgUsage},</if>
+            <if test="areaCode != null">#{areaCode},</if>
          </trim>
     </insert>
 
@@ -76,6 +79,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="bldgHeight != null">bldg_height = #{bldgHeight},</if>
             <if test="floorArea != null">floor_area = #{floorArea},</if>
             <if test="bldgUsage != null">bldg_usage = #{bldgUsage},</if>
+            <if test="areaCode != null">area_code = #{areaCode},</if>
         </trim>
         where id = #{id}
     </update>

+ 92 - 0
ems-cloud/ems-modules/ems-server/src/main/resources/mapper/ems/AreaElectricityAttrMapper.xml

@@ -0,0 +1,92 @@
+<?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.AreaElectricityAttrMapper">
+    
+    <resultMap type="com.ruoyi.ems.domain.AreaElectricityAttr" id="areaElectricityAttrResult">
+        <result property="id"    column="id"    />
+        <result property="areaCode"    column="area_code"    />
+        <result property="areaName"    column="area_name"    />
+        <result property="elecType"    column="elec_type"    />
+        <result property="elecTypeName"    column="elec_type_name"    />
+        <result property="priceCode"    column="price_code"    />
+        <result property="voltageLevel"    column="voltage_level"    />
+        <result property="reqCapacityFlag"    column="req_capacity_flag"    />
+        <result property="transCapacity"    column="trans_capacity"    />
+        <result property="reqQuantity"    column="req_quantity"    />
+        <result property="createTime"    column="create_time"    />
+        <result property="updateTime"    column="update_time"    />
+    </resultMap>
+
+    <sql id="selectAreaElectricityAttrVo">
+        SELECT attr.id, attr.area_code, area.area_name, price.elec_type, attr.price_code, t.`name` as elec_type_name, price.voltage_level, attr.req_capacity_flag, attr.trans_capacity, attr.req_quantity, attr.create_time, attr.update_time
+          FROM sys_area_electricity_attr attr
+            LEFT JOIN adm_service_area area ON attr.area_code = area.area_code
+            LEFT JOIN sys_electrovalency_config price ON attr.price_code = price.cfg_code
+            LEFT JOIN dim_ems_electrovalency_type t ON t.`code` = price.elec_type
+    </sql>
+
+    <select id="selectAreaElectricityAttrList" parameterType="com.ruoyi.ems.domain.AreaElectricityAttr" resultMap="areaElectricityAttrResult">
+        <include refid="selectAreaElectricityAttrVo"/>
+        <where>  
+            <if test="areaCode != null  and areaCode != ''"> and attr.area_code = #{areaCode}</if>
+            <if test="priceCode != null  and priceCode != ''"> and attr.price_code = #{priceCode}</if>
+            <if test="reqCapacityFlag != null "> and attr.req_capacity_flag = #{reqCapacityFlag}</if>
+            <if test="transCapacity != null "> and attr.trans_capacity = #{transCapacity}</if>
+            <if test="reqQuantity != null "> and attr.req_quantity = #{reqQuantity}</if>
+        </where>
+    </select>
+    
+    <select id="selectAreaElectricityAttrById" parameterType="Long" resultMap="areaElectricityAttrResult">
+        <include refid="selectAreaElectricityAttrVo"/>
+        where attr.id = #{id}
+    </select>
+        
+    <insert id="insertAreaElectricityAttr" parameterType="com.ruoyi.ems.domain.AreaElectricityAttr" useGeneratedKeys="true" keyProperty="id">
+        insert into sys_area_electricity_attr
+        <trim prefix="(" suffix=")" suffixOverrides=",">
+            <if test="areaCode != null and areaCode != ''">area_code,</if>
+            <if test="priceCode != null and priceCode != ''">price_code,</if>
+            <if test="reqCapacityFlag != null">req_capacity_flag,</if>
+            <if test="transCapacity != null">trans_capacity,</if>
+            <if test="reqQuantity != null">req_quantity,</if>
+            <if test="createTime != null">create_time,</if>
+            <if test="updateTime != null">update_time,</if>
+         </trim>
+        <trim prefix="values (" suffix=")" suffixOverrides=",">
+            <if test="areaCode != null and areaCode != ''">#{areaCode},</if>
+            <if test="priceCode != null and priceCode != ''">#{priceCode},</if>
+            <if test="reqCapacityFlag != null">#{reqCapacityFlag},</if>
+            <if test="transCapacity != null">#{transCapacity},</if>
+            <if test="reqQuantity != null">#{reqQuantity},</if>
+            <if test="createTime != null">#{createTime},</if>
+            <if test="updateTime != null">#{updateTime},</if>
+         </trim>
+    </insert>
+
+    <update id="updateAreaElectricityAttr" parameterType="com.ruoyi.ems.domain.AreaElectricityAttr">
+        update sys_area_electricity_attr
+        <trim prefix="SET" suffixOverrides=",">
+            area_code = #{areaCode},
+            price_code = #{priceCode},
+            req_capacity_flag = #{reqCapacityFlag},
+            trans_capacity = #{transCapacity},
+            req_quantity = #{reqQuantity},
+            create_time = #{createTime},
+            update_time = #{updateTime},
+        </trim>
+        where id = #{id}
+    </update>
+
+    <delete id="deleteAreaElectricityAttrById" parameterType="Long">
+        delete from sys_area_electricity_attr where id = #{id}
+    </delete>
+
+    <delete id="deleteSysAreaElectricityAttrByIds" parameterType="String">
+        delete from sys_area_electricity_attr where id in 
+        <foreach item="id" collection="array" open="(" separator="," close=")">
+            #{id}
+        </foreach>
+    </delete>
+</mapper>

+ 101 - 0
ems-cloud/ems-modules/ems-server/src/main/resources/mapper/ems/ElecValencyConfigMapper.xml

@@ -0,0 +1,101 @@
+<?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.ElecValencyConfigMapper">
+    
+    <resultMap type="com.ruoyi.ems.domain.ElecValencyConfig" id="elecValencyConfigResult">
+        <result property="id"    column="id"    />
+        <result property="cfgCode"    column="cfg_code"    />
+        <result property="elecType"    column="elec_type"    />
+        <result property="voltageLevel"    column="voltage_level"    />
+        <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"    />
+    </resultMap>
+
+    <sql id="selectElecValencyConfigVo">
+        select id, 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 from sys_electrovalency_config
+    </sql>
+
+    <select id="selectElecValencyConfigList" parameterType="com.ruoyi.ems.domain.ElecValencyConfig" resultMap="elecValencyConfigResult">
+        <include refid="selectElecValencyConfigVo"/>
+        <where>  
+            <if test="cfgCode != null  and cfgCode != ''"> and cfg_code = #{cfgCode}</if>
+            <if test="elecType != null "> and elec_type = #{elecType}</if>
+            <if test="voltageLevel != null  and voltageLevel != ''"> and voltage_level = #{voltageLevel}</if>
+            <if test="degreePrice != null "> and degree_price = #{degreePrice}</if>
+            <if test="fsPeakDegreePrice != null "> and fs_peak_degree_price = #{fsPeakDegreePrice}</if>
+            <if test="fsHighDegreePrice != null "> and fs_high_degree_price = #{fsHighDegreePrice}</if>
+            <if test="fsFlatDegreePrice != null "> and fs_flat_degree_price = #{fsFlatDegreePrice}</if>
+            <if test="fsLowDegreePrice != null "> and fs_low_degree_price = #{fsLowDegreePrice}</if>
+            <if test="maxReqPrice != null "> and max_req_price = #{maxReqPrice}</if>
+            <if test="transCapacityPrice != null "> and trans_capacity_price = #{transCapacityPrice}</if>
+        </where>
+    </select>
+    
+    <select id="selectElecValencyConfigById" parameterType="Long" resultMap="elecValencyConfigResult">
+        <include refid="selectElecValencyConfigVo"/>
+        where id = #{id}
+    </select>
+        
+    <insert id="insertElecValencyConfig" parameterType="com.ruoyi.ems.domain.ElecValencyConfig" useGeneratedKeys="true" keyProperty="id">
+        insert into sys_electrovalency_config
+        <trim prefix="(" suffix=")" suffixOverrides=",">
+            <if test="cfgCode != null and cfgCode != ''">cfg_code,</if>
+            <if test="elecType != null">elec_type,</if>
+            <if test="voltageLevel != null and voltageLevel != ''">voltage_level,</if>
+            <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>
+         </trim>
+        <trim prefix="values (" suffix=")" suffixOverrides=",">
+            <if test="cfgCode != null and cfgCode != ''">#{cfgCode},</if>
+            <if test="elecType != null">#{elecType},</if>
+            <if test="voltageLevel != null and voltageLevel != ''">#{voltageLevel},</if>
+            <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>
+         </trim>
+    </insert>
+
+    <update id="updateElecValencyConfig" parameterType="com.ruoyi.ems.domain.ElecValencyConfig">
+        update sys_electrovalency_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>
+            <if test="degreePrice != null">degree_price = #{degreePrice},</if>
+            <if test="fsPeakDegreePrice != null">fs_peak_degree_price = #{fsPeakDegreePrice},</if>
+            <if test="fsHighDegreePrice != null">fs_high_degree_price = #{fsHighDegreePrice},</if>
+            <if test="fsFlatDegreePrice != null">fs_flat_degree_price = #{fsFlatDegreePrice},</if>
+            <if test="fsLowDegreePrice != null">fs_low_degree_price = #{fsLowDegreePrice},</if>
+            <if test="maxReqPrice != null">max_req_price = #{maxReqPrice},</if>
+            <if test="transCapacityPrice != null">trans_capacity_price = #{transCapacityPrice},</if>
+        </trim>
+        where id = #{id}
+    </update>
+
+    <delete id="deleteElecValencyConfigById" parameterType="Long">
+        delete from sys_electrovalency_config where id = #{id}
+    </delete>
+
+    <delete id="deleteElecValencyConfigByIds" parameterType="String">
+        delete from sys_electrovalency_config where id in 
+        <foreach item="id" collection="array" open="(" separator="," close=")">
+            #{id}
+        </foreach>
+    </delete>
+</mapper>

+ 85 - 0
ems-cloud/ems-modules/ems-server/src/main/resources/mapper/ems/ElecValencyHourStrategyMapper.xml

@@ -0,0 +1,85 @@
+<?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.ElecValencyHourStrategyMapper">
+    
+    <resultMap type="com.ruoyi.ems.domain.ElecValencyHourStrategy" id="elecValencyStrategyHourResult">
+        <result property="id"    column="id"    />
+        <result property="strategyCode"    column="strategy_code"    />
+        <result property="startTime"    column="start_time"    />
+        <result property="endTime"    column="end_time"    />
+        <result property="type"    column="type"    />
+    </resultMap>
+
+    <sql id="selectElecValencyStrategyHourVo">
+        select id, strategy_code, start_time, end_time, type from sys_electrovalency_strategy_hour
+    </sql>
+
+    <select id="selectElecValencyStrategyHourList" parameterType="com.ruoyi.ems.domain.ElecValencyHourStrategy" resultMap="elecValencyStrategyHourResult">
+        <include refid="selectElecValencyStrategyHourVo"/>
+        <where>  
+            <if test="strategyCode != null  and strategyCode != ''"> and strategy_code = #{strategyCode}</if>
+            <if test="startTime != null "> and start_time = #{startTime}</if>
+            <if test="endTime != null "> and end_time = #{endTime}</if>
+            <if test="type != null "> and type = #{type}</if>
+        </where>
+    </select>
+    
+    <select id="selectElecValencyStrategyHourById" parameterType="Long" resultMap="elecValencyStrategyHourResult">
+        <include refid="selectElecValencyStrategyHourVo"/>
+        where id = #{id}
+    </select>
+        
+    <insert id="insertElecValencyStrategyHour" parameterType="com.ruoyi.ems.domain.ElecValencyHourStrategy" useGeneratedKeys="true" keyProperty="id">
+        insert into sys_electrovalency_strategy_hour
+        <trim prefix="(" suffix=")" suffixOverrides=",">
+            <if test="strategyCode != null and strategyCode != ''">strategy_code,</if>
+            <if test="startTime != null">start_time,</if>
+            <if test="endTime != null">end_time,</if>
+            <if test="type != null">type,</if>
+         </trim>
+        <trim prefix="values (" suffix=")" suffixOverrides=",">
+            <if test="strategyCode != null and strategyCode != ''">#{strategyCode},</if>
+            <if test="startTime != null">#{startTime},</if>
+            <if test="endTime != null">#{endTime},</if>
+            <if test="type != null">#{type},</if>
+         </trim>
+    </insert>
+
+    <insert id="insertElecValencyStrategyHourBatch" parameterType="java.util.List">
+        insert into sys_electrovalency_strategy_hour (strategy_code, start_time, end_time, type) values
+        <foreach collection="elecValencyStrategyHours" item="elecValencyStrategyHour" index="index" separator=",">
+            (#{elecValencyStrategyHour.strategyCode},
+             #{elecValencyStrategyHour.startTime},
+             #{elecValencyStrategyHour.endTime},
+             #{elecValencyStrategyHour.type})
+        </foreach>
+    </insert>
+
+    <update id="updateElecValencyStrategyHour" parameterType="com.ruoyi.ems.domain.ElecValencyHourStrategy">
+        update sys_electrovalency_strategy_hour
+        <trim prefix="SET" suffixOverrides=",">
+            <if test="strategyCode != null and strategyCode != ''">strategy_code = #{strategyCode},</if>
+            <if test="startTime != null">start_time = #{startTime},</if>
+            <if test="endTime != null">end_time = #{endTime},</if>
+            <if test="type != null">type = #{type},</if>
+        </trim>
+        where id = #{id}
+    </update>
+
+    <delete id="deleteElecValencyStrategyHourById" parameterType="Long">
+        delete from sys_electrovalency_strategy_hour where id = #{id}
+    </delete>
+
+    <delete id="deleteElecValencyStrategyHourByStrategy" parameterType="String">
+        delete from sys_electrovalency_strategy_hour where strategy_code = #{strategyCode}
+    </delete>
+
+    <delete id="deleteElecValencyStrategyHourByIds" parameterType="String">
+        delete from sys_electrovalency_strategy_hour where id in 
+        <foreach item="id" collection="array" open="(" separator="," close=")">
+            #{id}
+        </foreach>
+    </delete>
+</mapper>

+ 79 - 0
ems-cloud/ems-modules/ems-server/src/main/resources/mapper/ems/ElecValencyStrategyMapper.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.ElecValencyStrategyMapper">
+    
+    <resultMap type="com.ruoyi.ems.domain.ElecValencyStrategy" id="elecValencyStrategyResult">
+        <result property="id"    column="id"    />
+        <result property="strategyCode"    column="strategy_code"    />
+        <result property="strategyName"    column="strategy_name"    />
+        <result property="date"    column="date"    />
+        <result property="priority"    column="priority"    />
+        <result property="createTime"    column="create_time"    />
+        <result property="updateTime"    column="update_time"    />
+    </resultMap>
+
+    <sql id="selectElecValencyStrategyVo">
+        select id, strategy_code, strategy_name, date, priority, create_time, update_time from sys_electrovalency_strategy
+    </sql>
+
+    <select id="selectElecValencyStrategyList" parameterType="com.ruoyi.ems.domain.ElecValencyStrategy" resultMap="elecValencyStrategyResult">
+        <include refid="selectElecValencyStrategyVo"/>
+        <where>  
+            <if test="strategyCode != null  and strategyCode != ''"> and strategy_code = #{strategyCode}</if>
+            <if test="strategyName != null  and strategyName != ''"> and strategy_name like concat('%', #{strategyName}, '%')</if>
+            <if test="date != null "> and date = #{date}</if>
+            <if test="priority != null "> and priority = #{priority}</if>
+        </where>
+    </select>
+    
+    <select id="selectElecValencyStrategyById" parameterType="Long" resultMap="elecValencyStrategyResult">
+        <include refid="selectElecValencyStrategyVo"/>
+        where id = #{id}
+    </select>
+        
+    <insert id="insertElecValencyStrategy" parameterType="com.ruoyi.ems.domain.ElecValencyStrategy" useGeneratedKeys="true" keyProperty="id">
+        insert into sys_electrovalency_strategy
+        <trim prefix="(" suffix=")" suffixOverrides=",">
+            <if test="strategyCode != null and strategyCode != ''">strategy_code,</if>
+            <if test="strategyName != null and strategyName != ''">strategy_name,</if>
+            <if test="date != null">date,</if>
+            <if test="priority != null">priority,</if>
+            <if test="createTime != null">create_time,</if>
+            <if test="updateTime != null">update_time,</if>
+         </trim>
+        <trim prefix="values (" suffix=")" suffixOverrides=",">
+            <if test="strategyCode != null and strategyCode != ''">#{strategyCode},</if>
+            <if test="strategyName != null and strategyName != ''">#{strategyName},</if>
+            <if test="date != null">#{date},</if>
+            <if test="priority != null">#{priority},</if>
+            <if test="createTime != null">#{createTime},</if>
+            <if test="updateTime != null">#{updateTime},</if>
+         </trim>
+    </insert>
+
+    <update id="updateElecValencyStrategy" parameterType="com.ruoyi.ems.domain.ElecValencyStrategy">
+        update sys_electrovalency_strategy
+        <trim prefix="SET" suffixOverrides=",">
+            <if test="strategyCode != null and strategyCode != ''">strategy_code = #{strategyCode},</if>
+            <if test="strategyName != null and strategyName != ''">strategy_name = #{strategyName},</if>
+            <if test="date != null">date = #{date},</if>
+            <if test="priority != null">priority = #{priority},</if>
+            <if test="createTime != null">create_time = #{createTime},</if>
+            <if test="updateTime != null">update_time = #{updateTime},</if>
+        </trim>
+        where id = #{id}
+    </update>
+
+    <delete id="deleteElecValencyStrategyById" parameterType="Long">
+        delete from sys_electrovalency_strategy where id = #{id}
+    </delete>
+
+    <delete id="deleteElecValencyStrategyByIds" parameterType="String">
+        delete from sys_electrovalency_strategy where id in 
+        <foreach item="id" collection="array" open="(" separator="," close=")">
+            #{id}
+        </foreach>
+    </delete>
+</mapper>

+ 0 - 106
ems-cloud/ems-modules/ems-server/src/main/resources/mapper/ems/ElectrovalencyConfigMapper.xml

@@ -1,106 +0,0 @@
-<?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.ElectrovalencyConfigMapper">
-    
-    <resultMap type="com.ruoyi.ems.domain.ElectrovalencyConfig" id="ElectrovalencyConfigResult">
-        <result property="id"    column="id"    />
-        <result property="cfgCode"    column="cfg_code"    />
-        <result property="elecClass"    column="elec_class"    />
-        <result property="priceType"    column="price_type"    />
-        <result property="quantityLowerLimit"    column="quantity_lower_limit"    />
-        <result property="quantityUpperLimit"    column="quantity_upper_limit"    />
-        <result property="priceLess1kv"    column="price_less_1kv"    />
-        <result property="price1kv10kv"    column="price_1kv_10kv"    />
-        <result property="price20kv35kv"    column="price_20kv_35kv"    />
-        <result property="price35kv110kv"    column="price_35kv_110kv"    />
-        <result property="price110kv"    column="price_110kv"    />
-        <result property="price220kv"    column="price_220kv"    />
-    </resultMap>
-
-    <sql id="selectElectrovalencyConfigVo">
-        select id, cfg_code, elec_class, price_type, quantity_lower_limit, quantity_upper_limit, price_less_1kv, price_1kv_10kv, price_20kv_35kv, price_35kv_110kv, price_110kv, price_220kv from sys_electrovalency_config
-    </sql>
-
-    <select id="selectElectrovalencyConfigList" parameterType="com.ruoyi.ems.domain.ElectrovalencyConfig" resultMap="ElectrovalencyConfigResult">
-        <include refid="selectElectrovalencyConfigVo"/>
-        <where>  
-            <if test="cfgCode != null  and cfgCode != ''"> and cfg_code = #{cfgCode}</if>
-            <if test="elecClass != null "> and elec_class = #{elecClass}</if>
-            <if test="priceType != null "> and price_type = #{priceType}</if>
-            <if test="quantityLowerLimit != null "> and quantity_lower_limit = #{quantityLowerLimit}</if>
-            <if test="quantityUpperLimit != null "> and quantity_upper_limit = #{quantityUpperLimit}</if>
-            <if test="priceLess1kv != null "> and price_less_1kv = #{priceLess1kv}</if>
-            <if test="price1kv10kv != null "> and price_1kv_10kv = #{price1kv10kv}</if>
-            <if test="price20kv35kv != null "> and price_20kv_35kv = #{price20kv35kv}</if>
-            <if test="price35kv110kv != null "> and price_35kv_110kv = #{price35kv110kv}</if>
-            <if test="price110kv != null "> and price_110kv = #{price110kv}</if>
-            <if test="price220kv != null "> and price_220kv = #{price220kv}</if>
-        </where>
-    </select>
-    
-    <select id="selectElectrovalencyConfigById" parameterType="Long" resultMap="ElectrovalencyConfigResult">
-        <include refid="selectElectrovalencyConfigVo"/>
-        where id = #{id}
-    </select>
-        
-    <insert id="insertElectrovalencyConfig" parameterType="com.ruoyi.ems.domain.ElectrovalencyConfig" useGeneratedKeys="true" keyProperty="id">
-        insert into sys_electrovalency_config
-        <trim prefix="(" suffix=")" suffixOverrides=",">
-            <if test="cfgCode != null and cfgCode != ''">cfg_code,</if>
-            <if test="elecClass != null">elec_class,</if>
-            <if test="priceType != null">price_type,</if>
-            <if test="quantityLowerLimit != null">quantity_lower_limit,</if>
-            <if test="quantityUpperLimit != null">quantity_upper_limit,</if>
-            <if test="priceLess1kv != null">price_less_1kv,</if>
-            <if test="price1kv10kv != null">price_1kv_10kv,</if>
-            <if test="price20kv35kv != null">price_20kv_35kv,</if>
-            <if test="price35kv110kv != null">price_35kv_110kv,</if>
-            <if test="price110kv != null">price_110kv,</if>
-            <if test="price220kv != null">price_220kv,</if>
-         </trim>
-        <trim prefix="values (" suffix=")" suffixOverrides=",">
-            <if test="cfgCode != null and cfgCode != ''">#{cfgCode},</if>
-            <if test="elecClass != null">#{elecClass},</if>
-            <if test="priceType != null">#{priceType},</if>
-            <if test="quantityLowerLimit != null">#{quantityLowerLimit},</if>
-            <if test="quantityUpperLimit != null">#{quantityUpperLimit},</if>
-            <if test="priceLess1kv != null">#{priceLess1kv},</if>
-            <if test="price1kv10kv != null">#{price1kv10kv},</if>
-            <if test="price20kv35kv != null">#{price20kv35kv},</if>
-            <if test="price35kv110kv != null">#{price35kv110kv},</if>
-            <if test="price110kv != null">#{price110kv},</if>
-            <if test="price220kv != null">#{price220kv},</if>
-         </trim>
-    </insert>
-
-    <update id="updateElectrovalencyConfig" parameterType="com.ruoyi.ems.domain.ElectrovalencyConfig">
-        update sys_electrovalency_config
-        <trim prefix="SET" suffixOverrides=",">
-            <if test="cfgCode != null and cfgCode != ''">cfg_code = #{cfgCode},</if>
-            <if test="elecClass != null">elec_class = #{elecClass},</if>
-            <if test="priceType != null">price_type = #{priceType},</if>
-            <if test="quantityLowerLimit != null">quantity_lower_limit = #{quantityLowerLimit},</if>
-            <if test="quantityUpperLimit != null">quantity_upper_limit = #{quantityUpperLimit},</if>
-            <if test="priceLess1kv != null">price_less_1kv = #{priceLess1kv},</if>
-            <if test="price1kv10kv != null">price_1kv_10kv = #{price1kv10kv},</if>
-            <if test="price20kv35kv != null">price_20kv_35kv = #{price20kv35kv},</if>
-            <if test="price35kv110kv != null">price_35kv_110kv = #{price35kv110kv},</if>
-            <if test="price110kv != null">price_110kv = #{price110kv},</if>
-            <if test="price220kv != null">price_220kv = #{price220kv},</if>
-        </trim>
-        where id = #{id}
-    </update>
-
-    <delete id="deleteElectrovalencyConfigById" parameterType="Long">
-        delete from sys_electrovalency_config where id = #{id}
-    </delete>
-
-    <delete id="deleteElectrovalencyConfigByIds" parameterType="String">
-        delete from sys_electrovalency_config where id in 
-        <foreach item="id" collection="array" open="(" separator="," close=")">
-            #{id}
-        </foreach>
-    </delete>
-</mapper>

+ 0 - 81
ems-cloud/ems-modules/ems-server/src/main/resources/mapper/ems/ElectrovalencyPeakValleyMapper.xml

@@ -1,81 +0,0 @@
-<?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.ElectrovalencyPeakValleyMapper">
-    
-    <resultMap type="com.ruoyi.ems.domain.ElectrovalencyPeakValley" id="electrovalencyPeakValleyResult">
-        <result property="id"    column="id"    />
-        <result property="timeKey"    column="time_key"    />
-        <result property="timeIndex"    column="time_index"    />
-        <result property="startTime"    column="start_time"    />
-        <result property="endTime"    column="end_time"    />
-        <result property="type"    column="type"    />
-        <result property="floatingValue"    column="floating_value"    />
-    </resultMap>
-
-    <sql id="selectElectrovalencyPeakValleyVo">
-        select id, time_key, time_index, start_time, end_time, type, floating_value from sys_electrovalency_peak_valley
-    </sql>
-
-    <select id="selectElectrovalencyPeakValleyList" parameterType="com.ruoyi.ems.domain.ElectrovalencyPeakValley" resultMap="electrovalencyPeakValleyResult">
-        <include refid="selectElectrovalencyPeakValleyVo"/>
-        <where>  
-            <if test="timeKey != null  and timeKey != ''"> and time_key = #{timeKey}</if>
-            <if test="timeIndex != null "> and time_index = #{timeIndex}</if>
-            <if test="startTime != null "> and start_time = #{startTime}</if>
-            <if test="endTime != null "> and end_time = #{endTime}</if>
-            <if test="type != null "> and type = #{type}</if>
-            <if test="floatingValue != null "> and floating_value = #{floatingValue}</if>
-        </where>
-    </select>
-    
-    <select id="selectElectrovalencyPeakValleyById" parameterType="Long" resultMap="electrovalencyPeakValleyResult">
-        <include refid="selectElectrovalencyPeakValleyVo"/>
-        where id = #{id}
-    </select>
-        
-    <insert id="insertElectrovalencyPeakValley" parameterType="com.ruoyi.ems.domain.ElectrovalencyPeakValley" useGeneratedKeys="true" keyProperty="id">
-        insert into sys_electrovalency_peak_valley
-        <trim prefix="(" suffix=")" suffixOverrides=",">
-            <if test="timeKey != null and timeKey != ''">time_key,</if>
-            <if test="timeIndex != null">time_index,</if>
-            <if test="startTime != null">start_time,</if>
-            <if test="endTime != null">end_time,</if>
-            <if test="type != null">type,</if>
-            <if test="floatingValue != null">floating_value,</if>
-         </trim>
-        <trim prefix="values (" suffix=")" suffixOverrides=",">
-            <if test="timeKey != null and timeKey != ''">#{timeKey},</if>
-            <if test="timeIndex != null">#{timeIndex},</if>
-            <if test="startTime != null">#{startTime},</if>
-            <if test="endTime != null">#{endTime},</if>
-            <if test="type != null">#{type},</if>
-            <if test="floatingValue != null">#{floatingValue},</if>
-         </trim>
-    </insert>
-
-    <update id="updateElectrovalencyPeakValley" parameterType="com.ruoyi.ems.domain.ElectrovalencyPeakValley">
-        update sys_electrovalency_peak_valley
-        <trim prefix="SET" suffixOverrides=",">
-            <if test="timeKey != null and timeKey != ''">time_key = #{timeKey},</if>
-            <if test="timeIndex != null">time_index = #{timeIndex},</if>
-            <if test="startTime != null">start_time = #{startTime},</if>
-            <if test="endTime != null">end_time = #{endTime},</if>
-            <if test="type != null">type = #{type},</if>
-            <if test="floatingValue != null">floating_value = #{floatingValue},</if>
-        </trim>
-        where id = #{id}
-    </update>
-
-    <delete id="deleteElectrovalencyPeakValleyById" parameterType="Long">
-        delete from sys_electrovalency_peak_valley where id = #{id}
-    </delete>
-
-    <delete id="deleteElectrovalencyPeakValleyByIds" parameterType="String">
-        delete from sys_electrovalency_peak_valley where id in 
-        <foreach item="id" collection="array" open="(" separator="," close=")">
-            #{id}
-        </foreach>
-    </delete>
-</mapper>

+ 5 - 1
ems-cloud/ems-modules/ems-server/src/main/resources/mapper/ems/EmsDeviceMapper.xml

@@ -19,7 +19,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     </resultMap>
 
     <sql id="selectEmsDeviceVo">
-        select d.`id`, d.`device_code`, d.`device_name`, d.`device_type`, d.`device_status`, d.`ref_area`, z.`zoning_name` as ref_area_name, d.`ref_facs`, f.`facs_name` as ref_facs_name, d.`create_time`, d.`update_time` from adm_ems_device d LEFT JOIN adm_area_building_zoning z ON d.`ref_area` = z.`zoning_code` LEFT JOIN adm_ems_facs f ON d.`ref_facs` = f.`facs_code`
+        select
+            d.`id`, d.`device_code`, d.`device_name`, d.`device_type`, d.`device_status`, d.`ref_area`, z.`zoning_name` as ref_area_name, d.`ref_facs`, f.`facs_name` as ref_facs_name, d.`create_time`, d.`update_time`
+        from adm_ems_device d
+            LEFT JOIN adm_area_building_zoning z ON d.`ref_area` = z.`zoning_code`
+            LEFT JOIN adm_ems_facs f ON d.`ref_facs` = f.`facs_code`
     </sql>
 
     <select id="selectEmsDeviceList" parameterType="com.ruoyi.ems.domain.EmsDevice" resultMap="EmsDeviceResult">

+ 127 - 76
ems-cloud/sql/ems_server.sql

@@ -241,6 +241,23 @@ INSERT INTO `dim_ems_facs_subtype` (`code`, `name`, `parent_code`, `desc`, `vers
 
 
 -- ----------------------------
+-- 电价计量分类
+-- ----------------------------
+drop table if exists dim_ems_electrovalency_type;
+create table dim_ems_electrovalency_type (
+  `id`            bigint(20)      not null auto_increment    comment '序号',
+  `code`          int             not null                   comment '分类类型',
+  `name`          varchar(16)     not null                   comment '分类名称',
+   primary key (`id`),
+   unique key ux_electrovalency_type_code(`code`)
+) engine=innodb auto_increment=1 comment = '电价计量分类';
+
+INSERT INTO `dim_ems_electrovalency_type` (`code`, `name`) VALUES ('1', '居民生活用电');
+INSERT INTO `dim_ems_electrovalency_type` (`code`, `name`) VALUES ('2', '农业用电');
+INSERT INTO `dim_ems_electrovalency_type` (`code`, `name`) VALUES ('3', '单一制');
+INSERT INTO `dim_ems_electrovalency_type` (`code`, `name`) VALUES ('3', '两部制');
+
+-- ----------------------------
 -- 排放因子维表
 -- ----------------------------
 drop table if exists dim_ems_emission_factor;
@@ -351,25 +368,15 @@ INSERT INTO `adm_area_building` (`bldg_code`, `bldg_name`, `address`, `up_bldg_f
 INSERT INTO `adm_area_building` (`bldg_code`, `bldg_name`, `address`, `up_bldg_floor`, `down_bldg_floor`, `bldg_height`, `floor_area`, `bldg_usage`, `area_code`) VALUES ('321283124S300102', '配电泵房', '北区西北角', 1, 0, null, 300, '配电设施,水泵设施工作区', '321283124S3001');
 INSERT INTO `adm_area_building` (`bldg_code`, `bldg_name`, `address`, `up_bldg_floor`, `down_bldg_floor`, `bldg_height`, `floor_area`, `bldg_usage`, `area_code`) VALUES ('321283124S300103', '维修间&货车之家', '北区东侧', 2, 0, null, 300, '提供车辆维修服务', '321283124S3001');
 INSERT INTO `adm_area_building` (`bldg_code`, `bldg_name`, `address`, `up_bldg_floor`, `down_bldg_floor`, `bldg_height`, `floor_area`, `bldg_usage`, `area_code`) VALUES ('321283124S300104', '加油站', '北区西南角', 1, 0, null, 200, '提供加油服务', '321283124S3001');
-INSERT INTO `adm_area_building` (`bldg_code`, `bldg_name`, `address`, `up_bldg_floor`, `down_bldg_floor`, `bldg_height`, `floor_area`, `bldg_usage`, `area_code`) VALUES ('321283124S300105', '警务站', '北区东北角', 1, 0, null, 70, '警务办公场地', '321283124S3001');
-INSERT INTO `adm_area_building` (`bldg_code`, `bldg_name`, `address`, `up_bldg_floor`, `down_bldg_floor`, `bldg_height`, `floor_area`, `bldg_usage`, `area_code`) VALUES ('321283124S300106', '小客停车位', '北区前广场', 1, 0, null, null, '小客车停车位', '321283124S3001');
-INSERT INTO `adm_area_building` (`bldg_code`, `bldg_name`, `address`, `up_bldg_floor`, `down_bldg_floor`, `bldg_height`, `floor_area`, `bldg_usage`, `area_code`) VALUES ('321283124S300107', '充电车位', '北区前广场', 1, 0, null, null, '充电停车位', '321283124S3001');
-INSERT INTO `adm_area_building` (`bldg_code`, `bldg_name`, `address`, `up_bldg_floor`, `down_bldg_floor`, `bldg_height`, `floor_area`, `bldg_usage`, `area_code`) VALUES ('321283124S300108', '无障碍车位', '北区前广场', 1, 0, null, null, '无障碍车位', '321283124S3001');
-INSERT INTO `adm_area_building` (`bldg_code`, `bldg_name`, `address`, `up_bldg_floor`, `down_bldg_floor`, `bldg_height`, `floor_area`, `bldg_usage`, `area_code`) VALUES ('321283124S300109', '大客车停车位', '北区后广场', 1, 0, null, null, '大客车车位', '321283124S3001');
-INSERT INTO `adm_area_building` (`bldg_code`, `bldg_name`, `address`, `up_bldg_floor`, `down_bldg_floor`, `bldg_height`, `floor_area`, `bldg_usage`, `area_code`) VALUES ('321283124S300110', '货车车位', '北区后广场', 1, 0, null, null, '货车车位', '321283124S3001');
-INSERT INTO `adm_area_building` (`bldg_code`, `bldg_name`, `address`, `up_bldg_floor`, `down_bldg_floor`, `bldg_height`, `floor_area`, `bldg_usage`, `area_code`) VALUES ('321283124S300111', '危险品车位', '北区后广场', 1, 0, null, null, '危险品车位', '321283124S3001');
+INSERT INTO `adm_area_building` (`bldg_code`, `bldg_name`, `address`, `up_bldg_floor`, `down_bldg_floor`, `bldg_height`, `floor_area`, `bldg_usage`, `area_code`) VALUES ('321283124S300105', '警务站', '北区东北角', 1, 0, null, 50000, '警务办公场地', '321283124S3001');
+INSERT INTO `adm_area_building` (`bldg_code`, `bldg_name`, `address`, `up_bldg_floor`, `down_bldg_floor`, `bldg_height`, `floor_area`, `bldg_usage`, `area_code`) VALUES ('321283124S300106', '车位', '北区广场', 1, 0, null, 50000, '车位', '321283124S3001');
 
 INSERT INTO `adm_area_building` (`bldg_code`, `bldg_name`, `address`, `up_bldg_floor`, `down_bldg_floor`, `bldg_height`, `floor_area`, `bldg_usage`, `area_code`) VALUES ('321283124S300201', '综合楼', '南区中部', 2, 1, 14.2, 4788.2, '一层提供商业、餐饮、卫生间、开水服务,二层为员工餐厅、展厅', '321283124S3002');
 INSERT INTO `adm_area_building` (`bldg_code`, `bldg_name`, `address`, `up_bldg_floor`, `down_bldg_floor`, `bldg_height`, `floor_area`, `bldg_usage`, `area_code`) VALUES ('321283124S300202', '配电泵房', '南区东南角', 1, 0, null, 300, '配电设施,水泵设施工作区', '321283124S3002');
 INSERT INTO `adm_area_building` (`bldg_code`, `bldg_name`, `address`, `up_bldg_floor`, `down_bldg_floor`, `bldg_height`, `floor_area`, `bldg_usage`, `area_code`) VALUES ('321283124S300203', '维修间&货车之家', '南区西侧', 2, 0, null, 300, '提供车辆维修服务', '321283124S3002');
 INSERT INTO `adm_area_building` (`bldg_code`, `bldg_name`, `address`, `up_bldg_floor`, `down_bldg_floor`, `bldg_height`, `floor_area`, `bldg_usage`, `area_code`) VALUES ('321283124S300204', '加油站', '南区东北角', 1, 0, null, 200, '提供加油服务', '321283124S3002');
 INSERT INTO `adm_area_building` (`bldg_code`, `bldg_name`, `address`, `up_bldg_floor`, `down_bldg_floor`, `bldg_height`, `floor_area`, `bldg_usage`, `area_code`) VALUES ('321283124S300205', '宿舍楼', '南区西南角', 2, 0, null, 920, '提供员工住宿服务', '321283124S3002');
-INSERT INTO `adm_area_building` (`bldg_code`, `bldg_name`, `address`, `up_bldg_floor`, `down_bldg_floor`, `bldg_height`, `floor_area`, `bldg_usage`, `area_code`) VALUES ('321283124S300206', '小客停车位', '南区前广场', 1, 0, null, null, '小客车停车位', '321283124S3002');
-INSERT INTO `adm_area_building` (`bldg_code`, `bldg_name`, `address`, `up_bldg_floor`, `down_bldg_floor`, `bldg_height`, `floor_area`, `bldg_usage`, `area_code`) VALUES ('321283124S300207', '充电车位', '南区前广场', 1, 0, null, null, '充电停车位', '321283124S3002');
-INSERT INTO `adm_area_building` (`bldg_code`, `bldg_name`, `address`, `up_bldg_floor`, `down_bldg_floor`, `bldg_height`, `floor_area`, `bldg_usage`, `area_code`) VALUES ('321283124S300208', '无障碍车位', '南区前广场', 1, 0, null, null, '无障碍车位', '321283124S3002');
-INSERT INTO `adm_area_building` (`bldg_code`, `bldg_name`, `address`, `up_bldg_floor`, `down_bldg_floor`, `bldg_height`, `floor_area`, `bldg_usage`, `area_code`) VALUES ('321283124S300209', '大客车停车位', '南区后广场', 1, 0, null, null, '大客车车位', '321283124S3002');
-INSERT INTO `adm_area_building` (`bldg_code`, `bldg_name`, `address`, `up_bldg_floor`, `down_bldg_floor`, `bldg_height`, `floor_area`, `bldg_usage`, `area_code`) VALUES ('321283124S300210', '货车车位', '南区后广场', 1, 0, null, null, '货车车位', '321283124S3002');
-INSERT INTO `adm_area_building` (`bldg_code`, `bldg_name`, `address`, `up_bldg_floor`, `down_bldg_floor`, `bldg_height`, `floor_area`, `bldg_usage`, `area_code`) VALUES ('321283124S300211', '危险品车位', '南区后广场', 1, 0, null, null, '危险品车位', '321283124S3002');
+INSERT INTO `adm_area_building` (`bldg_code`, `bldg_name`, `address`, `up_bldg_floor`, `down_bldg_floor`, `bldg_height`, `floor_area`, `bldg_usage`, `area_code`) VALUES ('321283124S300206', '车位', '南区广场', 1, 0, null, 50000, '车位', '321283124S3002');
 
 
 -- ----------------------------
@@ -379,8 +386,8 @@ drop table if exists adm_area_building_zoning;
 create table adm_area_building_zoning (
   `id`               bigint(20)      not null auto_increment    comment '序号',
   `bldg_code`        varchar(64)     not null                   comment '建筑编码',
-  `zoning_code`    varchar(64)     not null                     comment '分区编码',
-  `zoning_name`    varchar(64)     not null                     comment '分区名称',
+  `zoning_code`      varchar(64)     not null                   comment '分区编码',
+  `zoning_name`      varchar(64)     not null                   comment '分区名称',
   `floor`            int             default null               comment '楼层',
   `room_no`          varchar(16)     default null               comment '房间号',
   `bldg_ld_area`     double          default null               comment '建筑划分面积',
@@ -389,6 +396,40 @@ create table adm_area_building_zoning (
     unique key ux_building_zoning_code(`bldg_code`, `zoning_code`)
 ) engine=innodb auto_increment=1 comment = '建筑区域划分表';
 
+INSERT INTO adm_area_building_zoning (`bldg_code`, `zoning_code`, `zoning_name`, `floor`, `room_no`, `bldg_ld_area`, `usage_detail`) VALUES ('321283124S300101', 'B-101', '开水泡面间', 1, '101', 100, '使用中');
+INSERT INTO adm_area_building_zoning (`bldg_code`, `zoning_code`, `zoning_name`, `floor`, `room_no`, `bldg_ld_area`, `usage_detail`) VALUES ('321283124S300101', 'B-102', '超市', 1, '102', 200, '使用中');
+INSERT INTO adm_area_building_zoning (`bldg_code`, `zoning_code`, `zoning_name`, `floor`, `room_no`, `bldg_ld_area`, `usage_detail`) VALUES ('321283124S300101', 'B-103', '中式糕点', 1, '103', 150, '使用中');
+INSERT INTO adm_area_building_zoning (`bldg_code`, `zoning_code`, `zoning_name`, `floor`, `room_no`, `bldg_ld_area`, `usage_detail`) VALUES ('321283124S300101', 'B-104', '特色产品市集', 1, '104', 200, '使用中');
+INSERT INTO adm_area_building_zoning (`bldg_code`, `zoning_code`, `zoning_name`, `floor`, `room_no`, `bldg_ld_area`, `usage_detail`) VALUES ('321283124S300101', 'B-105', '奶茶/咖啡', 1, '105', 100, '使用中');
+INSERT INTO adm_area_building_zoning (`bldg_code`, `zoning_code`, `zoning_name`, `floor`, `room_no`, `bldg_ld_area`, `usage_detail`) VALUES ('321283124S300101', 'B-106', '中式套餐', 1, '106', 200, '使用中');
+INSERT INTO adm_area_building_zoning (`bldg_code`, `zoning_code`, `zoning_name`, `floor`, `room_no`, `bldg_ld_area`, `usage_detail`) VALUES ('321283124S300101', 'B-107', '特色小吃', 1, '107', 100, '使用中');
+INSERT INTO adm_area_building_zoning (`bldg_code`, `zoning_code`, `zoning_name`, `floor`, `room_no`, `bldg_ld_area`, `usage_detail`) VALUES ('321283124S300101', 'B-108', '串串/卤味', 1, '108', 100, '使用中');
+INSERT INTO adm_area_building_zoning (`bldg_code`, `zoning_code`, `zoning_name`, `floor`, `room_no`, `bldg_ld_area`, `usage_detail`) VALUES ('321283124S300101', 'B-109', '糖葫芦/水果', 1, '109', 100, '使用中');
+INSERT INTO adm_area_building_zoning (`bldg_code`, `zoning_code`, `zoning_name`, `floor`, `room_no`, `bldg_ld_area`, `usage_detail`) VALUES ('321283124S300101', 'B-110', '美食广场', 1, '110', 300, '使用中');
+INSERT INTO adm_area_building_zoning (`bldg_code`, `zoning_code`, `zoning_name`, `floor`, `room_no`, `bldg_ld_area`, `usage_detail`) VALUES ('321283124S300101', 'B-111', '男卫', 1, '111', 200, '使用中');
+INSERT INTO adm_area_building_zoning (`bldg_code`, `zoning_code`, `zoning_name`, `floor`, `room_no`, `bldg_ld_area`, `usage_detail`) VALUES ('321283124S300101', 'B-112', '男盥洗室', 1, '112', 150, '使用中');
+INSERT INTO adm_area_building_zoning (`bldg_code`, `zoning_code`, `zoning_name`, `floor`, `room_no`, `bldg_ld_area`, `usage_detail`) VALUES ('321283124S300101', 'B-113', '女卫', 1, '113', 200, '使用中');
+INSERT INTO adm_area_building_zoning (`bldg_code`, `zoning_code`, `zoning_name`, `floor`, `room_no`, `bldg_ld_area`, `usage_detail`) VALUES ('321283124S300101', 'B-114', '女盥洗室', 1, '114', 150, '使用中');
+INSERT INTO adm_area_building_zoning (`bldg_code`, `zoning_code`, `zoning_name`, `floor`, `room_no`, `bldg_ld_area`, `usage_detail`) VALUES ('321283124S300101', 'B-115', '工具间1', 1, '115', 50, '使用中');
+INSERT INTO adm_area_building_zoning (`bldg_code`, `zoning_code`, `zoning_name`, `floor`, `room_no`, `bldg_ld_area`, `usage_detail`) VALUES ('321283124S300101', 'B-116', '工具间2', 1, '116', 50, '使用中');
+INSERT INTO adm_area_building_zoning (`bldg_code`, `zoning_code`, `zoning_name`, `floor`, `room_no`, `bldg_ld_area`, `usage_detail`) VALUES ('321283124S300101', 'B-117', '工具间3', 1, '117', 50, '使用中');
+INSERT INTO adm_area_building_zoning (`bldg_code`, `zoning_code`, `zoning_name`, `floor`, `room_no`, `bldg_ld_area`, `usage_detail`) VALUES ('321283124S300101', 'B-118', '工具间4', 1, '118', 50, '使用中');
+INSERT INTO adm_area_building_zoning (`bldg_code`, `zoning_code`, `zoning_name`, `floor`, `room_no`, `bldg_ld_area`, `usage_detail`) VALUES ('321283124S300101', 'B-119', '货车服务空间', 1, '119', 50, '使用中');
+
+INSERT INTO adm_area_building_zoning (`bldg_code`, `zoning_code`, `zoning_name`, `floor`, `room_no`, `bldg_ld_area`, `usage_detail`) VALUES ('321283124S300106', '321283124S3001_CW-XK', '小客停车位', 1, 'CW-XK', 100, '使用中');
+INSERT INTO adm_area_building_zoning (`bldg_code`, `zoning_code`, `zoning_name`, `floor`, `room_no`, `bldg_ld_area`, `usage_detail`) VALUES ('321283124S300106', '321283124S3001_CW-CD', '充电车位', 1, 'CW-CD', 100, '使用中');
+INSERT INTO adm_area_building_zoning (`bldg_code`, `zoning_code`, `zoning_name`, `floor`, `room_no`, `bldg_ld_area`, `usage_detail`) VALUES ('321283124S300106', '321283124S3001_CW-WZA', '无障碍车位', 1, 'CW-WZA', 100, '使用中');
+INSERT INTO adm_area_building_zoning (`bldg_code`, `zoning_code`, `zoning_name`, `floor`, `room_no`, `bldg_ld_area`, `usage_detail`) VALUES ('321283124S300106', '321283124S3001_CW-DKC', '大客车停车位', 1, 'CW-DKC', 100, '使用中');
+INSERT INTO adm_area_building_zoning (`bldg_code`, `zoning_code`, `zoning_name`, `floor`, `room_no`, `bldg_ld_area`, `usage_detail`) VALUES ('321283124S300106', '321283124S3001_CW-HC', '货车车位', 1, 'CW-HC', 100, '使用中');
+INSERT INTO adm_area_building_zoning (`bldg_code`, `zoning_code`, `zoning_name`, `floor`, `room_no`, `bldg_ld_area`, `usage_detail`) VALUES ('321283124S300106', '321283124S3001_CW-WXP', '危险品车位', 1, 'CW-WXP', 100, '使用中');
+
+INSERT INTO adm_area_building_zoning (`bldg_code`, `zoning_code`, `zoning_name`, `floor`, `room_no`, `bldg_ld_area`, `usage_detail`) VALUES ('321283124S300206', '321283124S3002_CW-XK', '小客停车位', 1, 'CW-XK', 100, '使用中');
+INSERT INTO adm_area_building_zoning (`bldg_code`, `zoning_code`, `zoning_name`, `floor`, `room_no`, `bldg_ld_area`, `usage_detail`) VALUES ('321283124S300206', '321283124S3002_CW-CD', '充电车位', 1, 'CW-XK', 100, '使用中');
+INSERT INTO adm_area_building_zoning (`bldg_code`, `zoning_code`, `zoning_name`, `floor`, `room_no`, `bldg_ld_area`, `usage_detail`) VALUES ('321283124S300206', '321283124S3002_CW-WZA', '无障碍车位', 1, 'CW-XK', 100, '使用中');
+INSERT INTO adm_area_building_zoning (`bldg_code`, `zoning_code`, `zoning_name`, `floor`, `room_no`, `bldg_ld_area`, `usage_detail`) VALUES ('321283124S300206', '321283124S3002_CW-DKC', '大客车停车位', 1, 'CW-XK', 100, '使用中');
+INSERT INTO adm_area_building_zoning (`bldg_code`, `zoning_code`, `zoning_name`, `floor`, `room_no`, `bldg_ld_area`, `usage_detail`) VALUES ('321283124S300206', '321283124S3002_CW-HC', '货车车位', 1, 'CW-XK', 100, '使用中');
+INSERT INTO adm_area_building_zoning (`bldg_code`, `zoning_code`, `zoning_name`, `floor`, `room_no`, `bldg_ld_area`, `usage_detail`) VALUES ('321283124S300206', '321283124S3002_CW-WXP','危险品车位', 1, 'CW-XK', 100, '使用中');
+
 -- ----------------------------
 -- 能源设施/系统表
 -- ----------------------------
@@ -400,7 +441,7 @@ create table adm_ems_facs  (
   `facs_type`       varchar(32)     not null                     comment '设施分类',
   `facs_subtype`    varchar(32)     not null                     comment '设施子类',
   `enable`          int             default '0'                  comment '启用状态0-停用,1-启用',
-  `ref_area`        varchar(32)      not null                    comment '归属区域代码',
+  `ref_area`        varchar(32)     not null                    comment '归属区域代码',
   `manufacturer`    varchar(64)     default null                 comment '厂商',
   `create_time`     datetime        default CURRENT_TIMESTAMP    comment '创建时间',
   `update_time`     datetime        default CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP comment '更新时间',
@@ -474,8 +515,8 @@ create table adm_ems_device  (
   `device_name`     varchar(32)     not null                     comment '设备名称',
   `device_type`     int             default null                 comment '设备类型',
   `device_status`   int             default null                 comment '设备状态',
-  `ref_area`        varchar(8)      default null                 comment '归属区域代码',
-  `ref_facs`        varchar(16)     default null                 comment '归属设施代码',
+  `ref_area`        varchar(64)     default null                 comment '归属区域代码',
+  `ref_facs`        varchar(64)     default null                 comment '归属设施代码',
   `create_time`     datetime        default CURRENT_TIMESTAMP    comment '创建时间',
   `update_time`     datetime        default CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP comment '更新时间',
   primary key (`id`),
@@ -645,79 +686,89 @@ create table adm_op_inspection_report (
 
 
 -- ----------------------------
+-- 服务区用电属性表
+-- ----------------------------
+drop table if exists sys_area_electricity_attr;
+create table sys_area_electricity_attr (
+  `id`                   bigint(20)      not null auto_increment       comment '序号',
+  `area_code`            varchar(32)     not null                      comment '园区代码',
+  `price_code`           varchar(16)     not null                      comment '价格编码',
+  `req_capacity_flag`    int             default 0                     comment '容(需)量标识',
+  `trans_capacity`       double          default null                  comment '变压器容量(千伏安·月)',
+  `req_quantity`         double          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_area_electricity_attr(`area_code`)
+) engine=innodb auto_increment=1 comment = '服务区用电属性表';
+
+INSERT INTO sys_area_electricity_attr (`area_code`, `price_code`, `req_capacity_flag`, `trans_capacity`, `req_quantity`) VALUES ('321283124S3001', '4001', 1, 630, NULL);
+INSERT INTO sys_area_electricity_attr (`area_code`, `price_code`, `req_capacity_flag`, `trans_capacity`, `req_quantity`) VALUES ('321283124S3002', '4001', 1, 630, NULL);
+
+-- ----------------------------
 -- 电价配置表
 -- ----------------------------
 drop table if exists sys_electrovalency_config;
 create table sys_electrovalency_config (
-  `id`                   bigint(20)      not null auto_increment      comment '序号',
-  `cfg_code`             varchar(4)      not null                     comment '配置代码',
-  `elec_class`           int             not null                     comment '用电分类',
-  `price_type`           int             not null                     comment '价格类型',
-  `quantity_lower_limit` int             default null                 comment '年用电量下限',
-  `quantity_upper_limit` int             default null                 comment '年用电量上限',
-  `price_less_1kv`       double          default null                 comment '不满1千伏(价格)',
-  `price_1kv_10kv`       double          default null                 comment '不满10千伏(价格)',
-  `price_20kv_35kv`      double          default null                 comment '20-30千伏(价格)',
-  `price_35kv_110kv`     double          default null                 comment '35-110千伏(价格)',
-  `price_110kv`          double          default null                 comment '110千伏(价格)',
-  `price_220kv`          double          default null                 comment '220千伏(价格)',
+  `id`                    bigint(20)      not null auto_increment      comment '序号',
+  `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 '电度用电价格',
+  `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 '变压器容量用电价格',
   primary key (`id`),
   unique key ux_electrovalency_config(`cfg_code`)
 ) engine=innodb auto_increment=1 comment = '电价配置表';
 
--- 电价初始数据(江苏省电网销售电价表 2018年4.1日执行)
--- 1.居民生活用电
-INSERT INTO sys_electrovalency_config (`cfg_code`, `elec_class`, `price_type`, `quantity_lower_limit`, `quantity_upper_limit`, `price_less_1kv`, `price_1kv_10kv`, `price_20kv_35kv`, `price_35kv_110kv`, `price_110kv`, `price_220kv`) VALUES ('1001', 1, 1, 0, 2760, 0.5283, 0.5183, NULL, NULL, NULL, NULL);
-INSERT INTO sys_electrovalency_config (`cfg_code`, `elec_class`, `price_type`, `quantity_lower_limit`, `quantity_upper_limit`, `price_less_1kv`, `price_1kv_10kv`, `price_20kv_35kv`, `price_35kv_110kv`, `price_110kv`, `price_220kv`) VALUES ('1002', 1, 1, 2760, 4800, 0.5783, 0.5683, NULL, NULL, NULL, NULL);
-INSERT INTO sys_electrovalency_config (`cfg_code`, `elec_class`, `price_type`, `quantity_lower_limit`, `quantity_upper_limit`, `price_less_1kv`, `price_1kv_10kv`, `price_20kv_35kv`, `price_35kv_110kv`, `price_110kv`, `price_220kv`) VALUES ('1003', 1, 1, 4800, NULL, 0.8283, 0.8183, NULL, NULL, NULL, NULL);
-INSERT INTO sys_electrovalency_config (`cfg_code`, `elec_class`, `price_type`, `quantity_lower_limit`, `quantity_upper_limit`, `price_less_1kv`, `price_1kv_10kv`, `price_20kv_35kv`, `price_35kv_110kv`, `price_110kv`, `price_220kv`) VALUES ('1004', 1, 0, NULL, NULL, 0.5483, 0.5383, NULL, NULL, NULL, NULL);
--- 工商业、大工业、农业
-INSERT INTO sys_electrovalency_config (`cfg_code`, `elec_class`, `price_type`, `quantity_lower_limit`, `quantity_upper_limit`, `price_less_1kv`, `price_1kv_10kv`, `price_20kv_35kv`, `price_35kv_110kv`, `price_110kv`, `price_220kv`) VALUES ('2001', 2, 0, NULL, NULL, 0.7954, 0.7804, 0.7744, 0.7654, NULL, NULL);
-INSERT INTO sys_electrovalency_config (`cfg_code`, `elec_class`, `price_type`, `quantity_lower_limit`, `quantity_upper_limit`, `price_less_1kv`, `price_1kv_10kv`, `price_20kv_35kv`, `price_35kv_110kv`, `price_110kv`, `price_220kv`) VALUES ('3001', 3, 0, NULL, NULL, NULL, 0.6418, 0.6358, 0.6268, 0.6118, 0.5968);
-INSERT INTO sys_electrovalency_config (`cfg_code`, `elec_class`, `price_type`, `quantity_lower_limit`, `quantity_upper_limit`, `price_less_1kv`, `price_1kv_10kv`, `price_20kv_35kv`, `price_35kv_110kv`, `price_110kv`, `price_220kv`) VALUES ('4001', 4, 0, NULL, NULL, 0.5090, 0.4990, 0.4930, 0.4840, NULL, NULL);
+-- 单一制初始电价数据
+INSERT INTO sys_electrovalency_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 sys_electrovalency_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 sys_electrovalency_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 sys_electrovalency_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 sys_electrovalency_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 sys_electrovalency_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 sys_electrovalency_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);
+
+-- ----------------------------
+-- 电价策略表
+-- ----------------------------
+drop table if exists sys_electrovalency_strategy;
+create table sys_electrovalency_strategy (
+  `id`                   bigint(20)      not null auto_increment      comment '序号',
+  `strategy_code`        varchar(32)     not null                     comment '策略代码',
+  `strategy_name`        varchar(16)     not null                     comment '策略名称',
+  `date`                 date            default null                 comment '执行日期',
+  `priority`             int             default 0                    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_electrovalency_strategy(`strategy_code`)
+) engine=innodb auto_increment=1 comment = '电价策略表';
 
+-- 默认策略
+INSERT INTO sys_electrovalency_strategy (`strategy_code`, `strategy_name`, `date`, `priority`) VALUES ('-1', '默认策略', NULL, 0);
 
 -- ----------------------------
--- 电价峰谷表
+-- 电价策略小时
 -- ----------------------------
-drop table if exists sys_electrovalency_peak_valley;
-create table sys_electrovalency_peak_valley (
+drop table if exists sys_electrovalency_strategy_hour;
+create table sys_electrovalency_strategy_hour (
   `id`                   bigint(20)      not null auto_increment      comment '序号',
-  `time_key`             varchar(2)      not null                     comment '时间标识',
-  `time_index`           int             not null                     comment '时间序列',
-  `start_time`           time            not null                     comment '开始时间HH:mm:ss',
-  `end_time`             time            not null                     comment '结束时间HH:mm:ss',
+  `strategy_code`        varchar(16)     not null                     comment '策略代码',
+  `start_time`           time            not null                     comment '开始时间',
+  `end_time`             time            not null                     comment '结束时间',
   `type`                 int             not null                     comment '计量类型',
-  `floating_value`       double          default null                 comment '浮动值',
-   primary key (`id`),
-   unique key ux_electrovalency_config(`time_index`)
-) engine=innodb auto_increment=1 comment = '电价峰谷表';
-
-INSERT INTO sys_electrovalency_peak_valley (`time_key`, `time_index`, `start_time`, `end_time`, `type`, `floating_value`) VALUES ('00', 1, '00:00:00', '01:00:00', 2, -0.17);
-INSERT INTO sys_electrovalency_peak_valley (`time_key`, `time_index`, `start_time`, `end_time`, `type`, `floating_value`) VALUES ('01', 2, '01:00:00', '02:00:00', 2, -0.17);
-INSERT INTO sys_electrovalency_peak_valley (`time_key`, `time_index`, `start_time`, `end_time`, `type`, `floating_value`) VALUES ('02', 3, '02:00:00', '03:00:00', 2, -0.17);
-INSERT INTO sys_electrovalency_peak_valley (`time_key`, `time_index`, `start_time`, `end_time`, `type`, `floating_value`) VALUES ('03', 4, '03:00:00', '04:00:00', 2, -0.17);
-INSERT INTO sys_electrovalency_peak_valley (`time_key`, `time_index`, `start_time`, `end_time`, `type`, `floating_value`) VALUES ('04', 5, '04:00:00', '05:00:00', 2, -0.17);
-INSERT INTO sys_electrovalency_peak_valley (`time_key`, `time_index`, `start_time`, `end_time`, `type`, `floating_value`) VALUES ('05', 6, '05:00:00', '06:00:00', 2, -0.17);
-INSERT INTO sys_electrovalency_peak_valley (`time_key`, `time_index`, `start_time`, `end_time`, `type`, `floating_value`) VALUES ('06', 7, '06:00:00', '07:00:00', 2, -0.17);
-INSERT INTO sys_electrovalency_peak_valley (`time_key`, `time_index`, `start_time`, `end_time`, `type`, `floating_value`) VALUES ('07', 8, '07:00:00', '08:00:00', 1, 0.03);
-INSERT INTO sys_electrovalency_peak_valley (`time_key`, `time_index`, `start_time`, `end_time`, `type`, `floating_value`) VALUES ('08', 9, '08:00:00', '09:00:00', 1, 0.03);
-INSERT INTO sys_electrovalency_peak_valley (`time_key`, `time_index`, `start_time`, `end_time`, `type`, `floating_value`) VALUES ('09', 10, '09:00:00', '10:00:00', 1, 0.03);
-INSERT INTO sys_electrovalency_peak_valley (`time_key`, `time_index`, `start_time`, `end_time`, `type`, `floating_value`) VALUES ('10', 11, '10:00:00', '11:00:00', 1, 0.03);
-INSERT INTO sys_electrovalency_peak_valley (`time_key`, `time_index`, `start_time`, `end_time`, `type`, `floating_value`) VALUES ('11', 12, '11:00:00', '12:00:00', 2, -0.17);
-INSERT INTO sys_electrovalency_peak_valley (`time_key`, `time_index`, `start_time`, `end_time`, `type`, `floating_value`) VALUES ('12', 13, '12:00:00', '13:00:00', 2, -0.17);
-INSERT INTO sys_electrovalency_peak_valley (`time_key`, `time_index`, `start_time`, `end_time`, `type`, `floating_value`) VALUES ('13', 14, '13:00:00', '14:00:00', 1, 0.03);
-INSERT INTO sys_electrovalency_peak_valley (`time_key`, `time_index`, `start_time`, `end_time`, `type`, `floating_value`) VALUES ('14', 15, '14:00:00', '15:00:00', 1, 0.03);
-INSERT INTO sys_electrovalency_peak_valley (`time_key`, `time_index`, `start_time`, `end_time`, `type`, `floating_value`) VALUES ('15', 16, '15:00:00', '16:00:00', 1, 0.03);
-INSERT INTO sys_electrovalency_peak_valley (`time_key`, `time_index`, `start_time`, `end_time`, `type`, `floating_value`) VALUES ('16', 17, '16:00:00', '17:00:00', 1, 0.03);
-INSERT INTO sys_electrovalency_peak_valley (`time_key`, `time_index`, `start_time`, `end_time`, `type`, `floating_value`) VALUES ('17', 18, '17:00:00', '18:00:00', 1, 0.03);
-INSERT INTO sys_electrovalency_peak_valley (`time_key`, `time_index`, `start_time`, `end_time`, `type`, `floating_value`) VALUES ('18', 19, '18:00:00', '19:00:00', 1, 0.03);
-INSERT INTO sys_electrovalency_peak_valley (`time_key`, `time_index`, `start_time`, `end_time`, `type`, `floating_value`) VALUES ('19', 20, '19:00:00', '20:00:00', 1, 0.03);
-INSERT INTO sys_electrovalency_peak_valley (`time_key`, `time_index`, `start_time`, `end_time`, `type`, `floating_value`) VALUES ('20', 21, '20:00:00', '21:00:00', 1, 0.03);
-INSERT INTO sys_electrovalency_peak_valley (`time_key`, `time_index`, `start_time`, `end_time`, `type`, `floating_value`) VALUES ('21', 22, '21:00:00', '22:00:00', 1, 0.03);
-INSERT INTO sys_electrovalency_peak_valley (`time_key`, `time_index`, `start_time`, `end_time`, `type`, `floating_value`) VALUES ('22', 23, '22:00:00', '23:00:00', 2, -0.17);
-INSERT INTO sys_electrovalency_peak_valley (`time_key`, `time_index`, `start_time`, `end_time`, `type`, `floating_value`) VALUES ('23', 24, '23:00:00', '00:00:00', 2, -0.17);
+  primary key (`id`)
+) engine=innodb auto_increment=1 comment = '电价策略小时表';
 
+INSERT INTO sys_electrovalency_strategy_hour (`strategy_code`, `start_time`, `end_time`, `type`) VALUES (1, '-1', '00:00:00', '23:59:59', 0);
 
 -- ----------------------------
 -- 电网供应计量表

+ 7 - 9
ems-cloud/sql/ems_sys.sql

@@ -230,10 +230,9 @@ insert into sys_menu values ('537',  '设施分类',   '124', '1',  'basecfg-fac
 insert into sys_menu values ('538',  '能源设施',   '124', '2',  'basecfg-facscfg',        'basecfg/emsfacs/index',          '', 1, 0, 'C', '0', '0',   'basecfg:emsfacs:list',         'cfgwrite',   'admin', sysdate(), '', null, '设施配置');
 insert into sys_menu values ('539',  '能流关系',   '124', '3',  'basecfg-flowrel',        'basecfg/flowrel/index',          '', 1, 0, 'C', '0', '0',   'basecfg:flowrel:list',         'cfgwrite',   'admin', sysdate(), '', null, '设备配置');
 insert into sys_menu values ('540',  '能源设备',   '124', '4',  'basecfg-devccfg',        'basecfg/device/index',           '', 1, 0, 'C', '0', '0',   'basecfg:device:list',          'cfgwrite',   'admin', sysdate(), '', null, '设备配置');
-insert into sys_menu values ('541',  '电价配置',   '125', '1',  'basecfg-electrovalency', 'basecfg/electrovalency/index',   '', 1, 0, 'C', '0', '0',   'basecfg:electrovalency:list',  'cfgwrite',   'admin', sysdate(), '', null, '电价配置');
-insert into sys_menu values ('542',  '峰谷配置',   '125', '2',  'basecfg-peakvalley',     'basecfg/peakvalley/index',       '', 1, 0, 'C', '0', '0',   'basecfg:peakvalley:list',      'cfgwrite',   'admin', sysdate(), '', null, '峰谷配置');
-insert into sys_menu values ('543',  '碳核算',     '125', '3',  'basecfg-carbon',          'basecfg/carbon/index',          '', 1, 0, 'C', '0', '0',   'basecfg:carbon:list',          'cfgwrite',   'admin', sysdate(), '', null, '核算配置');
-insert into sys_menu values ('544',  '排放因子',   '125', '4',  'basecfg-emissionFactor',  'basecfg/emissionfactor/index',  '', 1, 0, 'C', '0', '0',   'basecfg:emissionFactor:list',  'cfgwrite',   'admin', sysdate(), '', null, '碳排因子');
+insert into sys_menu values ('541',  '国网电价',   '125', '1',  'basecfg-electrovalency',  'basecfg/electrovalency/index',   '', 1, 0, 'C', '0', '0',   'basecfg:electrovalency:list',  'cfgwrite',   'admin', sysdate(), '', null, '电价属性');
+insert into sys_menu values ('542',  '碳核算',     '125', '2',  'basecfg-carbon',          'basecfg/carbon/index',          '', 1, 0, 'C', '0', '0',   'basecfg:carbon:list',          'cfgwrite',   'admin', sysdate(), '', null, '核算配置');
+insert into sys_menu values ('543',  '排放因子',   '125', '3',  'basecfg-emissionFactor',  'basecfg/emissionfactor/index',  '', 1, 0, 'C', '0', '0',   'basecfg:emissionFactor:list',  'cfgwrite',   'admin', sysdate(), '', null, '碳排因子');
 
 
 -- 用户管理按钮
@@ -330,10 +329,10 @@ insert into sys_menu values ('1072', '设备修改', '540', '2', '#', '', '', 1,
 insert into sys_menu values ('1073', '设备删除', '540', '3', '#', '', '', 1, 0, 'F', '0', '0', 'basecfg:flowrel:remove','#', 'admin', sysdate(), '', null, '');
 insert into sys_menu values ('1074', '设备导出', '540', '4', '#', '', '', 1, 0, 'F', '0', '0', 'basecfg:flowrel:export','#', 'admin', sysdate(), '', null, '');
 -- 碳排因子配置按钮
-insert into sys_menu values ('1075', '新增因子', '544', '1', '#', '', '', 1, 0, 'F', '0', '0', 'basecfg:emissionFactor:add',   '#', 'admin', sysdate(), '', null, '');
-insert into sys_menu values ('1076', '修改因子', '544', '2', '#', '', '', 1, 0, 'F', '0', '0', 'basecfg:emissionFactor:edit',  '#', 'admin', sysdate(), '', null, '');
-insert into sys_menu values ('1077', '删除因子', '544', '3', '#', '', '', 1, 0, 'F', '0', '0', 'basecfg:emissionFactor:remove','#', 'admin', sysdate(), '', null, '');
-insert into sys_menu values ('1078', '因子导出', '544', '4', '#', '', '', 1, 0, 'F', '0', '0', 'basecfg:emissionFactor:export','#', 'admin', sysdate(), '', null, '');
+insert into sys_menu values ('1075', '新增因子', '543', '1', '#', '', '', 1, 0, 'F', '0', '0', 'basecfg:emissionFactor:add',   '#', 'admin', sysdate(), '', null, '');
+insert into sys_menu values ('1076', '修改因子', '543', '2', '#', '', '', 1, 0, 'F', '0', '0', 'basecfg:emissionFactor:edit',  '#', 'admin', sysdate(), '', null, '');
+insert into sys_menu values ('1077', '删除因子', '543', '3', '#', '', '', 1, 0, 'F', '0', '0', 'basecfg:emissionFactor:remove','#', 'admin', sysdate(), '', null, '');
+insert into sys_menu values ('1078', '因子导出', '543', '4', '#', '', '', 1, 0, 'F', '0', '0', 'basecfg:emissionFactor:export','#', 'admin', sysdate(), '', null, '');
 
 
 -- ----------------------------
@@ -437,7 +436,6 @@ insert into sys_role_menu values ('2', '540');
 insert into sys_role_menu values ('2', '541');
 insert into sys_role_menu values ('2', '542');
 insert into sys_role_menu values ('2', '543');
-insert into sys_role_menu values ('2', '544');
 insert into sys_role_menu values ('2', '1000');
 insert into sys_role_menu values ('2', '1001');
 insert into sys_role_menu values ('2', '1002');