Explorar o código

电价配置功能修改

lv.wenbin hai 1 ano
pai
achega
acd533818d
Modificáronse 15 ficheiros con 599 adicións e 92 borrados
  1. 124 0
      ems-cloud/ems-modules/ems-server/src/main/java/com/ruoyi/ems/controller/ElecValencyController.java
  2. 40 43
      ems-cloud/ems-modules/ems-server/src/main/java/com/ruoyi/ems/controller/ElectricityController.java
  3. 15 3
      ems-cloud/ems-modules/ems-server/src/main/java/com/ruoyi/ems/domain/ElecValencyConfig.java
  4. 65 0
      ems-cloud/ems-modules/ems-server/src/main/java/com/ruoyi/ems/domain/ElecValencyType.java
  5. 63 0
      ems-cloud/ems-modules/ems-server/src/main/java/com/ruoyi/ems/mapper/ElecValencyTypeMapper.java
  6. 8 0
      ems-cloud/ems-modules/ems-server/src/main/java/com/ruoyi/ems/service/IAreaBuildingService.java
  7. 60 0
      ems-cloud/ems-modules/ems-server/src/main/java/com/ruoyi/ems/service/IElecValencyTypeService.java
  8. 49 21
      ems-cloud/ems-modules/ems-server/src/main/java/com/ruoyi/ems/service/impl/AreaBuildingServiceImpl.java
  9. 2 9
      ems-cloud/ems-modules/ems-server/src/main/java/com/ruoyi/ems/service/impl/AreaServiceImpl.java
  10. 94 0
      ems-cloud/ems-modules/ems-server/src/main/java/com/ruoyi/ems/service/impl/ElecValencyTypeServiceImpl.java
  11. 1 1
      ems-cloud/ems-modules/ems-server/src/main/resources/mapper/ems/AreaElectricityAttrMapper.xml
  12. 14 12
      ems-cloud/ems-modules/ems-server/src/main/resources/mapper/ems/ElecValencyConfigMapper.xml
  13. 61 0
      ems-cloud/ems-modules/ems-server/src/main/resources/mapper/ems/ElecValencyTypeMapper.xml
  14. 2 2
      ems-cloud/sql/ems_server.sql
  15. 1 1
      ems-cloud/sql/ems_sys.sql

+ 124 - 0
ems-cloud/ems-modules/ems-server/src/main/java/com/ruoyi/ems/controller/ElecValencyController.java

@@ -0,0 +1,124 @@
+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.ElecValencyConfig;
+import com.ruoyi.ems.domain.ElecValencyType;
+import com.ruoyi.ems.service.IElecValencyConfigService;
+import com.ruoyi.ems.service.IElecValencyTypeService;
+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-23
+ */
+@RestController
+@RequestMapping("/basecfg/elecvalency")
+public class ElecValencyController extends BaseController {
+    @Autowired
+    private IElecValencyConfigService configService;
+
+    @Autowired
+    private IElecValencyTypeService valencyTypeService;
+
+    /**
+     * 查询电价配置列表
+     */
+    @RequiresPermissions("basecfg:electricity:list")
+    @GetMapping("/list")
+    public TableDataInfo list(ElecValencyConfig elecValencyConfig) {
+        startPage();
+        List<ElecValencyConfig> list = configService.selectElecValencyConfigList(elecValencyConfig);
+        return getDataTable(list);
+    }
+
+    /**
+     * 导出电价配置列表
+     */
+    @RequiresPermissions("basecfg:electricity:export")
+    @Log(title = "电价配置", businessType = BusinessType.EXPORT)
+    @PostMapping("/export")
+    public void export(HttpServletResponse response, ElecValencyConfig elecValencyConfig) {
+        List<ElecValencyConfig> list = configService.selectElecValencyConfigList(elecValencyConfig);
+        ExcelUtil<ElecValencyConfig> util = new ExcelUtil<>(ElecValencyConfig.class);
+        util.exportExcel(response, list, "电价配置数据");
+    }
+
+    /**
+     * 获取电价配置详细信息
+     */
+    @RequiresPermissions("basecfg:electricity:query")
+    @GetMapping(value = "/{id}")
+    public AjaxResult getInfo(@PathVariable("id") Long id) {
+        return success(configService.selectElecValencyConfigById(id));
+    }
+
+    /**
+     * 新增电价配置
+     */
+    @RequiresPermissions("basecfg:electricity:add")
+    @Log(title = "电价配置", businessType = BusinessType.INSERT)
+    @PostMapping
+    public AjaxResult add(@RequestBody ElecValencyConfig elecValencyConfig) {
+        return toAjax(configService.insertElecValencyConfig(elecValencyConfig));
+    }
+
+    /**
+     * 修改电价配置
+     */
+    @RequiresPermissions("basecfg:electricity:edit")
+    @Log(title = "电价配置", businessType = BusinessType.UPDATE)
+    @PutMapping
+    public AjaxResult edit(@RequestBody ElecValencyConfig elecValencyConfig) {
+        return toAjax(configService.updateElecValencyConfig(elecValencyConfig));
+    }
+
+    /**
+     * 删除电价配置
+     */
+    @RequiresPermissions("basecfg:electricity:remove")
+    @Log(title = "电价配置", businessType = BusinessType.DELETE)
+    @DeleteMapping("/{ids}")
+    public AjaxResult remove(@PathVariable Long[] ids) {
+        return toAjax(configService.deleteElecValencyConfigByIds(ids));
+    }
+
+    /**
+     * 列出价格列表
+     * @return 价格列表
+     */
+    @GetMapping("/listall")
+    public AjaxResult listAll() {
+        List<ElecValencyConfig> list = configService.selectElecValencyConfigList(new ElecValencyConfig());
+        return success(list);
+    }
+
+    /**
+     * 电价分类
+     *
+     * @return 分类列表
+     */
+    @GetMapping(value = "/type")
+    public AjaxResult getElecValencyType() {
+        List<ElecValencyType> types = valencyTypeService.selectElecValencyTypeList(new ElecValencyType());
+        return success(types);
+    }
+}

+ 40 - 43
ems-cloud/ems-modules/ems-server/src/main/java/com/ruoyi/ems/controller/ElectricityController.java

@@ -1,64 +1,65 @@
 package com.ruoyi.ems.controller;
 
-import java.util.List;
-import javax.servlet.http.HttpServletResponse;
-
+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.AreaElectricityAttr;
 import com.ruoyi.ems.service.IAreaElectricityAttrService;
+import com.ruoyi.ems.service.IElecValencyConfigService;
 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.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;
+
+import javax.servlet.http.HttpServletResponse;
+import java.util.List;
 
 /**
- * 电价Controller
- * 
+ * 用电业务Controller
+ *
  * @author ruoyi
  * @date 2024-07-23
  */
 @RestController
-@RequestMapping("/basecfg/electrovalency")
-public class ElectricityController extends BaseController
-{
+@RequestMapping("/basecfg/electricity")
+public class ElectricityController extends BaseController {
     /**
      * 用电属性服务
      */
     @Autowired
-    private IAreaElectricityAttrService areaElectricityAttrService;
+    private IAreaElectricityAttrService attrService;
+
+    @Autowired
+    private IElecValencyConfigService configService;
 
     /**
      * 查询服务区用电属性列表
      */
-    @RequiresPermissions("basecfg:electrovalency:list")
+    @RequiresPermissions("basecfg:electricity:list")
     @GetMapping("/attr/list")
-    public TableDataInfo list(AreaElectricityAttr areaElectricityAttr)
-    {
+    public TableDataInfo list(AreaElectricityAttr areaElectricityAttr) {
         startPage();
-        List<AreaElectricityAttr> list = areaElectricityAttrService.selectAreaElectricityAttrList(areaElectricityAttr);
+        List<AreaElectricityAttr> list = attrService.selectAreaElectricityAttrList(areaElectricityAttr);
         return getDataTable(list);
     }
 
     /**
      * 导出服务区用电属性列表
      */
-    @RequiresPermissions("basecfg:electrovalency:export")
+    @RequiresPermissions("basecfg:electricity:export")
     @Log(title = "服务区用电属性", businessType = BusinessType.EXPORT)
     @PostMapping("/attr/export")
-    public void export(HttpServletResponse response, AreaElectricityAttr areaElectricityAttr)
-    {
-        List<AreaElectricityAttr> list = areaElectricityAttrService.selectAreaElectricityAttrList(areaElectricityAttr);
+    public void export(HttpServletResponse response, AreaElectricityAttr areaElectricityAttr) {
+        List<AreaElectricityAttr> list = attrService.selectAreaElectricityAttrList(areaElectricityAttr);
         ExcelUtil<AreaElectricityAttr> util = new ExcelUtil<AreaElectricityAttr>(AreaElectricityAttr.class);
         util.exportExcel(response, list, "服务区用电属性数据");
     }
@@ -66,43 +67,39 @@ public class ElectricityController extends BaseController
     /**
      * 获取服务区用电属性详细信息
      */
-    @RequiresPermissions("basecfg:electrovalency:query")
+    @RequiresPermissions("basecfg:electricity:query")
     @GetMapping(value = "/attr/{id}")
-    public AjaxResult getInfo(@PathVariable("id") Long id)
-    {
-        return success(areaElectricityAttrService.selectAreaElectricityAttrById(id));
+    public AjaxResult getInfo(@PathVariable("id") Long id) {
+        return success(attrService.selectAreaElectricityAttrById(id));
     }
 
     /**
      * 新增服务区用电属性
      */
-    @RequiresPermissions("basecfg:electrovalency:add")
+    @RequiresPermissions("basecfg:electricity:add")
     @Log(title = "服务区用电属性", businessType = BusinessType.INSERT)
     @PostMapping(value = "/attr")
-    public AjaxResult add(@RequestBody AreaElectricityAttr areaElectricityAttr)
-    {
-        return toAjax(areaElectricityAttrService.insertAreaElectricityAttr(areaElectricityAttr));
+    public AjaxResult add(@RequestBody AreaElectricityAttr areaElectricityAttr) {
+        return toAjax(attrService.insertAreaElectricityAttr(areaElectricityAttr));
     }
 
     /**
      * 修改服务区用电属性
      */
-    @RequiresPermissions("basecfg:electrovalency:edit")
+    @RequiresPermissions("basecfg:electricity:edit")
     @Log(title = "服务区用电属性", businessType = BusinessType.UPDATE)
     @PutMapping(value = "/attr")
-    public AjaxResult edit(@RequestBody AreaElectricityAttr areaElectricityAttr)
-    {
-        return toAjax(areaElectricityAttrService.updateAreaElectricityAttr(areaElectricityAttr));
+    public AjaxResult edit(@RequestBody AreaElectricityAttr areaElectricityAttr) {
+        return toAjax(attrService.updateAreaElectricityAttr(areaElectricityAttr));
     }
 
     /**
      * 删除服务区用电属性
      */
-    @RequiresPermissions("basecfg:electrovalency:remove")
+    @RequiresPermissions("basecfg:electricity:remove")
     @Log(title = "服务区用电属性", businessType = BusinessType.DELETE)
-	@DeleteMapping("/attr/{ids}")
-    public AjaxResult remove(@PathVariable Long[] ids)
-    {
-        return toAjax(areaElectricityAttrService.deleteAreaElectricityAttrByIds(ids));
+    @DeleteMapping("/attr/{ids}")
+    public AjaxResult remove(@PathVariable Long[] ids) {
+        return toAjax(attrService.deleteAreaElectricityAttrByIds(ids));
     }
 }

+ 15 - 3
ems-cloud/ems-modules/ems-server/src/main/java/com/ruoyi/ems/domain/ElecValencyConfig.java

@@ -22,10 +22,13 @@ public class ElecValencyConfig extends BaseEntity
     @Excel(name = "配置代码")
     private String cfgCode;
 
-    /** 用电分类 1-单一制 2-两部制 */
-    @Excel(name = "用电分类")
+    /** 用电分类 */
     private Long elecType;
 
+    /** 用电分类*/
+    @Excel(name = "用电分类")
+    private String elecTypeName;
+
     /** 电压等级 */
     @Excel(name = "电压等级")
     private String voltageLevel;
@@ -85,7 +88,16 @@ public class ElecValencyConfig extends BaseEntity
     {
         return elecType;
     }
-    public void setVoltageLevel(String voltageLevel) 
+
+    public String getElecTypeName() {
+        return elecTypeName;
+    }
+
+    public void setElecTypeName(String elecTypeName) {
+        this.elecTypeName = elecTypeName;
+    }
+
+    public void setVoltageLevel(String voltageLevel)
     {
         this.voltageLevel = voltageLevel;
     }

+ 65 - 0
ems-cloud/ems-modules/ems-server/src/main/java/com/ruoyi/ems/domain/ElecValencyType.java

@@ -0,0 +1,65 @@
+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;
+
+/**
+ * 电价计量分类对象 dim_ems_electrovalency_type
+ * 
+ * @author ruoyi
+ * @date 2024-07-29
+ */
+public class ElecValencyType extends BaseEntity
+{
+    private static final long serialVersionUID = 1L;
+
+    /** 序号 */
+    private Long id;
+
+    /** 分类类型 */
+    @Excel(name = "分类类型")
+    private Long code;
+
+    /** 分类名称 */
+    @Excel(name = "分类名称")
+    private String name;
+
+    public void setId(Long id) 
+    {
+        this.id = id;
+    }
+
+    public Long getId() 
+    {
+        return id;
+    }
+    public void setCode(Long code) 
+    {
+        this.code = code;
+    }
+
+    public Long getCode() 
+    {
+        return code;
+    }
+    public void setName(String name) 
+    {
+        this.name = name;
+    }
+
+    public String getName() 
+    {
+        return name;
+    }
+
+    @Override
+    public String toString() {
+        return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
+            .append("id", getId())
+            .append("code", getCode())
+            .append("name", getName())
+            .toString();
+    }
+}

+ 63 - 0
ems-cloud/ems-modules/ems-server/src/main/java/com/ruoyi/ems/mapper/ElecValencyTypeMapper.java

@@ -0,0 +1,63 @@
+package com.ruoyi.ems.mapper;
+
+import com.ruoyi.ems.domain.ElecValencyType;
+
+import java.util.List;
+
+
+/**
+ * 电价计量分类Mapper接口
+ * 
+ * @author ruoyi
+ * @date 2024-07-29
+ */
+public interface ElecValencyTypeMapper
+{
+    /**
+     * 查询电价计量分类
+     * 
+     * @param id 电价计量分类主键
+     * @return 电价计量分类
+     */
+     ElecValencyType selectElecValencyTypeById(Long id);
+
+    /**
+     * 查询电价计量分类列表
+     * 
+     * @param elecValencyType 电价计量分类
+     * @return 电价计量分类集合
+     */
+     List<ElecValencyType> selectElecValencyTypeList(ElecValencyType elecValencyType);
+
+    /**
+     * 新增电价计量分类
+     * 
+     * @param elecValencyType 电价计量分类
+     * @return 结果
+     */
+     int insertElecValencyType(ElecValencyType elecValencyType);
+
+    /**
+     * 修改电价计量分类
+     * 
+     * @param elecValencyType 电价计量分类
+     * @return 结果
+     */
+     int updateElecValencyType(ElecValencyType elecValencyType);
+
+    /**
+     * 删除电价计量分类
+     * 
+     * @param id 电价计量分类主键
+     * @return 结果
+     */
+     int deleteElecValencyTypeById(Long id);
+
+    /**
+     * 批量删除电价计量分类
+     * 
+     * @param ids 需要删除的数据主键集合
+     * @return 结果
+     */
+     int deleteElecValencyTypeByIds(Long[] ids);
+}

+ 8 - 0
ems-cloud/ems-modules/ems-server/src/main/java/com/ruoyi/ems/service/IAreaBuildingService.java

@@ -58,4 +58,12 @@ public interface IAreaBuildingService {
      * @return 结果
      */
     int deleteAreaBuildingById(Long id);
+
+    /**
+     * 删除建筑基本信息信息
+     *
+     * @param areaBuilding 建筑基本信息对象
+     * @return 结果
+     */
+    int deleteAreaBuilding(AreaBuilding areaBuilding);
 }

+ 60 - 0
ems-cloud/ems-modules/ems-server/src/main/java/com/ruoyi/ems/service/IElecValencyTypeService.java

@@ -0,0 +1,60 @@
+package com.ruoyi.ems.service;
+
+import java.util.List;
+import com.ruoyi.ems.domain.ElecValencyType;
+
+/**
+ * 电价计量分类Service接口
+ *
+ * @author ruoyi
+ * @date 2024-07-29
+ */
+public interface IElecValencyTypeService {
+    /**
+     * 查询电价计量分类
+     *
+     * @param id 电价计量分类主键
+     * @return 电价计量分类
+     */
+    ElecValencyType selectElecValencyTypeById(Long id);
+
+    /**
+     * 查询电价计量分类列表
+     *
+     * @param elecValencyType 电价计量分类
+     * @return 电价计量分类集合
+     */
+    List<ElecValencyType> selectElecValencyTypeList(ElecValencyType elecValencyType);
+
+    /**
+     * 新增电价计量分类
+     *
+     * @param elecValencyType 电价计量分类
+     * @return 结果
+     */
+    int insertElecValencyType(ElecValencyType elecValencyType);
+
+    /**
+     * 修改电价计量分类
+     *
+     * @param elecValencyType 电价计量分类
+     * @return 结果
+     */
+    int updateElecValencyType(ElecValencyType elecValencyType);
+
+    /**
+     * 批量删除电价计量分类
+     *
+     * @param ids 需要删除的电价计量分类主键集合
+     * @return 结果
+     */
+    int deleteElecValencyTypeByIds(Long[] ids);
+
+    /**
+     * 删除电价计量分类信息
+     *
+     * @param id 电价计量分类主键
+     * @return 结果
+     */
+    int deleteElecValencyTypeById(Long id);
+}

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

@@ -2,7 +2,9 @@ package com.ruoyi.ems.service.impl;
 
 import java.util.List;
 
+import com.ruoyi.ems.domain.AreaBuildingZoning;
 import com.ruoyi.ems.service.IAreaBuildingService;
+import com.ruoyi.ems.service.IAreaBuildingZoningService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import com.ruoyi.ems.mapper.AreaBuildingMapper;
@@ -10,85 +12,111 @@ import com.ruoyi.ems.domain.AreaBuilding;
 
 /**
  * 建筑基本信息Service业务层处理
- * 
+ *
  * @author ruoyi
  * @date 2024-07-09
  */
 @Service
-public class AreaBuildingServiceImpl implements IAreaBuildingService
-{
+public class AreaBuildingServiceImpl implements IAreaBuildingService {
     @Autowired
     private AreaBuildingMapper areaBuildingMapper;
 
+    @Autowired
+    private IAreaBuildingZoningService zoningService;
+
     /**
      * 查询建筑基本信息
-     * 
+     *
      * @param id 建筑基本信息主键
      * @return 建筑基本信息
      */
     @Override
-    public AreaBuilding selectAreaBuildingById(Long id)
-    {
+    public AreaBuilding selectAreaBuildingById(Long id) {
         return areaBuildingMapper.selectAreaBuildingById(id);
     }
 
     /**
      * 查询建筑基本信息列表
-     * 
+     *
      * @param areaBuilding 建筑基本信息
      * @return 建筑基本信息
      */
     @Override
-    public List<AreaBuilding> selectAreaBuildingList(AreaBuilding areaBuilding)
-    {
+    public List<AreaBuilding> selectAreaBuildingList(AreaBuilding areaBuilding) {
         return areaBuildingMapper.selectAreaBuildingList(areaBuilding);
     }
 
     /**
      * 新增建筑基本信息
-     * 
+     *
      * @param areaBuilding 建筑基本信息
      * @return 结果
      */
     @Override
-    public int insertAreaBuilding(AreaBuilding areaBuilding)
-    {
+    public int insertAreaBuilding(AreaBuilding areaBuilding) {
         return areaBuildingMapper.insertAreaBuilding(areaBuilding);
     }
 
     /**
      * 修改建筑基本信息
-     * 
+     *
      * @param areaBuilding 建筑基本信息
      * @return 结果
      */
     @Override
-    public int updateAreaBuilding(AreaBuilding areaBuilding)
-    {
+    public int updateAreaBuilding(AreaBuilding areaBuilding) {
         return areaBuildingMapper.updateAreaBuilding(areaBuilding);
     }
 
     /**
      * 批量删除建筑基本信息
-     * 
+     *
      * @param ids 需要删除的建筑基本信息主键
      * @return 结果
      */
     @Override
-    public int deleteAreaBuildingByIds(Long[] ids)
-    {
+    public int deleteAreaBuildingByIds(Long[] ids) {
+        for (Long id : ids) {
+            AreaBuilding building = selectAreaBuildingById(id);
+
+            if (null != building) {
+                deleteRel(building.getBldgCode());
+            }
+        }
+
         return areaBuildingMapper.deleteAreaBuildingByIds(ids);
     }
 
     /**
      * 删除建筑基本信息信息
-     * 
+     *
      * @param id 建筑基本信息主键
      * @return 结果
      */
     @Override
-    public int deleteAreaBuildingById(Long id)
-    {
+    public int deleteAreaBuildingById(Long id) {
+        AreaBuilding building = selectAreaBuildingById(id);
+
+        if (null != building) {
+            deleteRel(building.getBldgCode());
+        }
+
         return areaBuildingMapper.deleteAreaBuildingById(id);
     }
+
+    @Override
+    public int deleteAreaBuilding(AreaBuilding building) {
+        deleteRel(building.getBldgCode());
+        return deleteAreaBuildingById(building.getId());
+    }
+
+    public void deleteRel(String bldgCode) {
+        AreaBuildingZoning zoningParam = new AreaBuildingZoning();
+        zoningParam.setBldgCode(bldgCode);
+        List<AreaBuildingZoning> zonings = zoningService.selectAreaBuildingZoningList(zoningParam);
+
+        for (AreaBuildingZoning zoning : zonings) {
+            zoningService.deleteAreaBuildingZoningById(zoning.getId());
+        }
+    }
 }

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

@@ -100,6 +100,7 @@ public class AreaServiceImpl implements IAreaService {
      */
     @Override
     public int deleteAreaById(Long id) {
+        deleteRel(id);
         return areaMapper.deleteAreaById(id);
     }
 
@@ -141,15 +142,7 @@ public class AreaServiceImpl implements IAreaService {
             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());
+                buildingService.deleteAreaBuilding(building);
             }
         }
     }

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

@@ -0,0 +1,94 @@
+package com.ruoyi.ems.service.impl;
+
+import com.ruoyi.ems.domain.ElecValencyType;
+import com.ruoyi.ems.mapper.ElecValencyTypeMapper;
+import com.ruoyi.ems.service.IElecValencyTypeService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+
+/**
+ * 电价计量分类Service业务层处理
+ * 
+ * @author ruoyi
+ * @date 2024-07-29
+ */
+@Service
+public class ElecValencyTypeServiceImpl implements IElecValencyTypeService
+{
+    @Autowired
+    private ElecValencyTypeMapper elecValencyTypeMapper;
+
+    /**
+     * 查询电价计量分类
+     * 
+     * @param id 电价计量分类主键
+     * @return 电价计量分类
+     */
+    @Override
+    public ElecValencyType selectElecValencyTypeById(Long id)
+    {
+        return elecValencyTypeMapper.selectElecValencyTypeById(id);
+    }
+
+    /**
+     * 查询电价计量分类列表
+     * 
+     * @param elecValencyType 电价计量分类
+     * @return 电价计量分类
+     */
+    @Override
+    public List<ElecValencyType> selectElecValencyTypeList(ElecValencyType elecValencyType)
+    {
+        return elecValencyTypeMapper.selectElecValencyTypeList(elecValencyType);
+    }
+
+    /**
+     * 新增电价计量分类
+     * 
+     * @param elecValencyType 电价计量分类
+     * @return 结果
+     */
+    @Override
+    public int insertElecValencyType(ElecValencyType elecValencyType)
+    {
+        return elecValencyTypeMapper.insertElecValencyType(elecValencyType);
+    }
+
+    /**
+     * 修改电价计量分类
+     * 
+     * @param elecValencyType 电价计量分类
+     * @return 结果
+     */
+    @Override
+    public int updateElecValencyType(ElecValencyType elecValencyType)
+    {
+        return elecValencyTypeMapper.updateElecValencyType(elecValencyType);
+    }
+
+    /**
+     * 批量删除电价计量分类
+     * 
+     * @param ids 需要删除的电价计量分类主键
+     * @return 结果
+     */
+    @Override
+    public int deleteElecValencyTypeByIds(Long[] ids)
+    {
+        return elecValencyTypeMapper.deleteElecValencyTypeByIds(ids);
+    }
+
+    /**
+     * 删除电价计量分类信息
+     * 
+     * @param id 电价计量分类主键
+     * @return 结果
+     */
+    @Override
+    public int deleteElecValencyTypeById(Long id)
+    {
+        return elecValencyTypeMapper.deleteElecValencyTypeById(id);
+    }
+}

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

@@ -83,7 +83,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         delete from sys_area_electricity_attr where id = #{id}
     </delete>
 
-    <delete id="deleteSysAreaElectricityAttrByIds" parameterType="String">
+    <delete id="deleteAreaElectricityAttrByIds" parameterType="String">
         delete from sys_area_electricity_attr where id in 
         <foreach item="id" collection="array" open="(" separator="," close=")">
             #{id}

+ 14 - 12
ems-cloud/ems-modules/ems-server/src/main/resources/mapper/ems/ElecValencyConfigMapper.xml

@@ -8,6 +8,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <result property="id"    column="id"    />
         <result property="cfgCode"    column="cfg_code"    />
         <result property="elecType"    column="elec_type"    />
+        <result property="elecTypeName"    column="elec_type_name"    />
         <result property="voltageLevel"    column="voltage_level"    />
         <result property="degreePrice"    column="degree_price"    />
         <result property="fsPeakDegreePrice"    column="fs_peak_degree_price"    />
@@ -19,28 +20,29 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     </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
+        select v.id, v.cfg_code, v.elec_type, t.`name` as elec_type_name, v.voltage_level, v.degree_price, v.fs_peak_degree_price, v.fs_high_degree_price, v.fs_flat_degree_price, v.fs_low_degree_price, v.max_req_price, v.trans_capacity_price from sys_electrovalency_config v
+            LEFT JOIN dim_ems_electrovalency_type t ON v.elec_type = t.`code`
     </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>
+            <if test="cfgCode != null  and cfgCode != ''"> and v.cfg_code = #{cfgCode}</if>
+            <if test="elecType != null "> and v.elec_type = #{elecType}</if>
+            <if test="voltageLevel != null  and voltageLevel != ''"> and v.voltage_level = #{voltageLevel}</if>
+            <if test="degreePrice != null "> and v.degree_price = #{degreePrice}</if>
+            <if test="fsPeakDegreePrice != null "> and v.fs_peak_degree_price = #{fsPeakDegreePrice}</if>
+            <if test="fsHighDegreePrice != null "> and v.fs_high_degree_price = #{fsHighDegreePrice}</if>
+            <if test="fsFlatDegreePrice != null "> and v.fs_flat_degree_price = #{fsFlatDegreePrice}</if>
+            <if test="fsLowDegreePrice != null "> and v.fs_low_degree_price = #{fsLowDegreePrice}</if>
+            <if test="maxReqPrice != null "> and v.max_req_price = #{maxReqPrice}</if>
+            <if test="transCapacityPrice != null "> and v.trans_capacity_price = #{transCapacityPrice}</if>
         </where>
     </select>
     
     <select id="selectElecValencyConfigById" parameterType="Long" resultMap="elecValencyConfigResult">
         <include refid="selectElecValencyConfigVo"/>
-        where id = #{id}
+        where v.id = #{id}
     </select>
         
     <insert id="insertElecValencyConfig" parameterType="com.ruoyi.ems.domain.ElecValencyConfig" useGeneratedKeys="true" keyProperty="id">

+ 61 - 0
ems-cloud/ems-modules/ems-server/src/main/resources/mapper/ems/ElecValencyTypeMapper.xml

@@ -0,0 +1,61 @@
+<?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.ElecValencyTypeMapper">
+    
+    <resultMap type="com.ruoyi.ems.domain.ElecValencyType" id="ElecValencyTypeResult">
+        <result property="id"    column="id"    />
+        <result property="code"    column="code"    />
+        <result property="name"    column="name"    />
+    </resultMap>
+
+    <sql id="selectElecValencyTypeVo">
+        select id, code, name from dim_ems_electrovalency_type
+    </sql>
+
+    <select id="selectElecValencyTypeList" parameterType="com.ruoyi.ems.domain.ElecValencyType" resultMap="ElecValencyTypeResult">
+        <include refid="selectElecValencyTypeVo"/>
+        <where>  
+            <if test="code != null "> and code = #{code}</if>
+            <if test="name != null  and name != ''"> and name like concat('%', #{name}, '%')</if>
+        </where>
+    </select>
+    
+    <select id="selectElecValencyTypeById" parameterType="Long" resultMap="ElecValencyTypeResult">
+        <include refid="selectElecValencyTypeVo"/>
+        where id = #{id}
+    </select>
+        
+    <insert id="insertElecValencyType" parameterType="com.ruoyi.ems.domain.ElecValencyType" useGeneratedKeys="true" keyProperty="id">
+        insert into dim_ems_electrovalency_type
+        <trim prefix="(" suffix=")" suffixOverrides=",">
+            <if test="code != null">code,</if>
+            <if test="name != null and name != ''">name,</if>
+         </trim>
+        <trim prefix="values (" suffix=")" suffixOverrides=",">
+            <if test="code != null">#{code},</if>
+            <if test="name != null and name != ''">#{name},</if>
+         </trim>
+    </insert>
+
+    <update id="updateElecValencyType" parameterType="com.ruoyi.ems.domain.ElecValencyType">
+        update dim_ems_electrovalency_type
+        <trim prefix="SET" suffixOverrides=",">
+            <if test="code != null">code = #{code},</if>
+            <if test="name != null and name != ''">name = #{name},</if>
+        </trim>
+        where id = #{id}
+    </update>
+
+    <delete id="deleteElecValencyTypeById" parameterType="Long">
+        delete from dim_ems_electrovalency_type where id = #{id}
+    </delete>
+
+    <delete id="deleteElecValencyTypeByIds" parameterType="String">
+        delete from dim_ems_electrovalency_type where id in 
+        <foreach item="id" collection="array" open="(" separator="," close=")">
+            #{id}
+        </foreach>
+    </delete>
+</mapper>

+ 2 - 2
ems-cloud/sql/ems_server.sql

@@ -369,14 +369,14 @@ 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 ('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, 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 ('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, 50000, '车位', '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');
 
 
 -- ----------------------------

+ 1 - 1
ems-cloud/sql/ems_sys.sql

@@ -230,7 +230,7 @@ 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 ('541',  '国网电价',   '125', '1',  'basecfg-electricity',    'basecfg/electricity/index',   '', 1, 0, 'C', '0', '0',   'basecfg:electricity: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, '碳排因子');