Browse Source

新区域模型业务适配改造

lv.wenbin 8 months ago
parent
commit
cf365d9dfb
45 changed files with 572 additions and 3173 deletions
  1. 0 113
      ems-cloud/ems-modules/ems-server/src/main/java/com/ruoyi/ems/controller/AreaBuildingController.java
  2. 0 107
      ems-cloud/ems-modules/ems-server/src/main/java/com/ruoyi/ems/controller/AreaBuildingZoningController.java
  3. 77 64
      ems-cloud/ems-modules/ems-server/src/main/java/com/ruoyi/ems/controller/AreaController.java
  4. 0 185
      ems-cloud/ems-modules/ems-server/src/main/java/com/ruoyi/ems/controller/AreaOldController.java
  5. 19 44
      ems-cloud/ems-modules/ems-server/src/main/java/com/ruoyi/ems/controller/DeviceController.java
  6. 0 182
      ems-cloud/ems-modules/ems-server/src/main/java/com/ruoyi/ems/domain/AreaBuilding.java
  7. 0 198
      ems-cloud/ems-modules/ems-server/src/main/java/com/ruoyi/ems/domain/AreaBuildingZoning.java
  8. 0 249
      ems-cloud/ems-modules/ems-server/src/main/java/com/ruoyi/ems/domain/AreaOld.java
  9. 0 14
      ems-cloud/ems-modules/ems-server/src/main/java/com/ruoyi/ems/domain/EmsDevice.java
  10. 49 33
      ems-cloud/ems-modules/ems-server/src/main/java/com/ruoyi/ems/domain/MeterDevice.java
  11. 13 13
      ems-cloud/ems-modules/ems-server/src/main/java/com/ruoyi/ems/mapper/AreaAttrMapper.java
  12. 0 69
      ems-cloud/ems-modules/ems-server/src/main/java/com/ruoyi/ems/mapper/AreaBuildingMapper.java
  13. 0 86
      ems-cloud/ems-modules/ems-server/src/main/java/com/ruoyi/ems/mapper/AreaBuildingZoningMapper.java
  14. 11 12
      ems-cloud/ems-modules/ems-server/src/main/java/com/ruoyi/ems/mapper/AreaMapper.java
  15. 0 79
      ems-cloud/ems-modules/ems-server/src/main/java/com/ruoyi/ems/mapper/AreaOldMapper.java
  16. 0 2
      ems-cloud/ems-modules/ems-server/src/main/java/com/ruoyi/ems/mapper/EmsDeviceMapper.java
  17. 1 2
      ems-cloud/ems-modules/ems-server/src/main/java/com/ruoyi/ems/mapper/MeterDeviceMapper.java
  18. 1 25
      ems-cloud/ems-modules/ems-server/src/main/java/com/ruoyi/ems/model/QueryChargingBill.java
  19. 0 86
      ems-cloud/ems-modules/ems-server/src/main/java/com/ruoyi/ems/service/IAreaBuildingService.java
  20. 0 95
      ems-cloud/ems-modules/ems-server/src/main/java/com/ruoyi/ems/service/IAreaBuildingZoningService.java
  21. 0 105
      ems-cloud/ems-modules/ems-server/src/main/java/com/ruoyi/ems/service/IAreaOldService.java
  22. 8 10
      ems-cloud/ems-modules/ems-server/src/main/java/com/ruoyi/ems/service/IAreaService.java
  23. 7 28
      ems-cloud/ems-modules/ems-server/src/main/java/com/ruoyi/ems/service/impl/AdmOpAlarmServiceImpl.java
  24. 2 1
      ems-cloud/ems-modules/ems-server/src/main/java/com/ruoyi/ems/service/impl/AreaAttrServiceImpl.java
  25. 0 134
      ems-cloud/ems-modules/ems-server/src/main/java/com/ruoyi/ems/service/impl/AreaBuildingServiceImpl.java
  26. 0 215
      ems-cloud/ems-modules/ems-server/src/main/java/com/ruoyi/ems/service/impl/AreaBuildingZoningServiceImpl.java
  27. 0 282
      ems-cloud/ems-modules/ems-server/src/main/java/com/ruoyi/ems/service/impl/AreaOldServiceImpl.java
  28. 6 6
      ems-cloud/ems-modules/ems-server/src/main/java/com/ruoyi/ems/service/impl/AreaServiceImpl.java
  29. 38 46
      ems-cloud/ems-modules/ems-server/src/main/java/com/ruoyi/ems/service/impl/ChargingBillServiceImpl.java
  30. 3 22
      ems-cloud/ems-modules/ems-server/src/main/java/com/ruoyi/ems/service/impl/EmsDeviceServiceImpl.java
  31. 73 67
      ems-cloud/ems-modules/ems-server/src/main/java/com/ruoyi/ems/service/impl/EmsFacsServiceImpl.java
  32. 33 56
      ems-cloud/ems-modules/ems-server/src/main/java/com/ruoyi/ems/service/impl/MeterDeviceServiceImpl.java
  33. 176 0
      ems-cloud/ems-modules/ems-server/src/main/java/com/ruoyi/ems/util/AreaUtils.java
  34. 0 103
      ems-cloud/ems-modules/ems-server/src/main/resources/mapper/ems/AreaBuildingMapper.xml
  35. 0 131
      ems-cloud/ems-modules/ems-server/src/main/resources/mapper/ems/AreaBuildingZoningMapper.xml
  36. 9 10
      ems-cloud/ems-modules/ems-server/src/main/resources/mapper/ems/AreaMapper.xml
  37. 0 143
      ems-cloud/ems-modules/ems-server/src/main/resources/mapper/ems/AreaOldMapper.xml
  38. 7 39
      ems-cloud/ems-modules/ems-server/src/main/resources/mapper/ems/EmsDeviceMapper.xml
  39. 4 9
      ems-cloud/ems-modules/ems-server/src/main/resources/mapper/ems/MeterDeviceMapper.xml
  40. 2 10
      ems-cloud/ruoyi-common/ruoyi-common-core/src/main/java/com/ruoyi/common/core/enums/AlarmObjType.java
  41. 0 62
      ems-cloud/ruoyi-common/ruoyi-common-core/src/main/java/com/ruoyi/common/core/enums/MeterObjSubType.java
  42. 8 3
      ems-cloud/ruoyi-common/ruoyi-common-core/src/main/java/com/ruoyi/common/core/enums/MeterObjType.java
  43. 24 24
      ems-cloud/sql/ems_init_data.sql
  44. 0 1
      ems-cloud/sql/ems_server.sql
  45. 1 8
      ems-cloud/sql/ems_sys.sql

+ 0 - 113
ems-cloud/ems-modules/ems-server/src/main/java/com/ruoyi/ems/controller/AreaBuildingController.java

@@ -1,113 +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.AreaBuilding;
-import com.ruoyi.ems.service.IAreaBuildingService;
-import io.swagger.annotations.Api;
-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.RequestParam;
-import org.springframework.web.bind.annotation.RestController;
-
-import javax.servlet.http.HttpServletResponse;
-import java.util.List;
-
-/**
- * 建筑基本信息Controller
- *
- * @author ruoyi
- * @date 2024-07-09
- */
-@RestController
-@RequestMapping("/basecfg/area/building")
-@Api(value = "AreaBuildingController", description = "建筑管理")
-public class AreaBuildingController extends BaseController {
-    @Autowired
-    private IAreaBuildingService buildingService;
-
-    /**
-     * 查询建筑基本信息列表
-     */
-    @RequiresPermissions("basecfg:building:list")
-    @GetMapping("/list")
-    public TableDataInfo list(AreaBuilding areaBuilding) {
-        startPage();
-        List<AreaBuilding> list = buildingService.selectAreaBuildingList(areaBuilding);
-        return getDataTable(list);
-    }
-
-    /**
-     * 查询建筑基本信息列表
-     */
-    @RequiresPermissions("basecfg:building:list")
-    @GetMapping("/listByArea")
-    public AjaxResult listByArea(@RequestParam(name = "areaCode", required = false) String areaCode) {
-        AreaBuilding param = new AreaBuilding();
-        param.setAreaCode(areaCode);
-        List<AreaBuilding> list = buildingService.selectAreaBuildingList(param);
-        return success(list);
-    }
-
-    /**
-     * 导出建筑基本信息列表
-     */
-    @RequiresPermissions("basecfg:building:export")
-    @Log(title = "建筑基本信息", businessType = BusinessType.EXPORT)
-    @PostMapping("/export")
-    public void export(HttpServletResponse response, AreaBuilding areaBuilding) {
-        List<AreaBuilding> list = buildingService.selectAreaBuildingList(areaBuilding);
-        ExcelUtil<AreaBuilding> util = new ExcelUtil<AreaBuilding>(AreaBuilding.class);
-        util.exportExcel(response, list, "建筑基本信息数据");
-    }
-
-    /**
-     * 获取建筑基本信息详细信息
-     */
-    @RequiresPermissions("basecfg:building:query")
-    @GetMapping(value = "/{id}")
-    public AjaxResult getInfo(@PathVariable("id") Long id) {
-        return success(buildingService.selectAreaBuildingById(id));
-    }
-
-    /**
-     * 新增建筑基本信息
-     */
-    @RequiresPermissions("basecfg:building:add")
-    @Log(title = "建筑基本信息", businessType = BusinessType.INSERT)
-    @PostMapping
-    public AjaxResult add(@RequestBody AreaBuilding areaBuilding) {
-        return toAjax(buildingService.insertAreaBuilding(areaBuilding));
-    }
-
-    /**
-     * 修改建筑基本信息
-     */
-    @RequiresPermissions("basecfg:building:edit")
-    @Log(title = "建筑基本信息", businessType = BusinessType.UPDATE)
-    @PutMapping
-    public AjaxResult edit(@RequestBody AreaBuilding areaBuilding) {
-        return toAjax(buildingService.updateAreaBuilding(areaBuilding));
-    }
-
-    /**
-     * 删除建筑基本信息
-     */
-    @RequiresPermissions("basecfg:building:remove")
-    @Log(title = "建筑基本信息", businessType = BusinessType.DELETE)
-    @DeleteMapping("/{ids}")
-    public AjaxResult remove(@PathVariable Long[] ids) {
-        return toAjax(buildingService.deleteAreaBuildingByIds(ids));
-    }
-}

+ 0 - 107
ems-cloud/ems-modules/ems-server/src/main/java/com/ruoyi/ems/controller/AreaBuildingZoningController.java

@@ -1,107 +0,0 @@
-package com.ruoyi.ems.controller;
-
-import java.util.List;
-import javax.servlet.http.HttpServletResponse;
-
-import io.swagger.annotations.Api;
-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.ems.domain.AreaBuildingZoning;
-import com.ruoyi.ems.service.IAreaBuildingZoningService;
-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-09
- */
-@RestController
-@RequestMapping("/basecfg/area/building/zoning")
-@Api(value = "AreaBuildingZoningController", description = "建筑功能分区管理")
-public class AreaBuildingZoningController extends BaseController
-{
-    @Autowired
-    private IAreaBuildingZoningService areaBuildingZoningService;
-
-    /**
-     * 查询建筑区域划分列表
-     */
-    @RequiresPermissions("basecfg:zoning:list")
-    @GetMapping("/list")
-    public TableDataInfo list(AreaBuildingZoning areaBuildingZoning)
-    {
-        startPage();
-        List<AreaBuildingZoning> list = areaBuildingZoningService.selectAreaBuildingZoningList(areaBuildingZoning);
-        return getDataTable(list);
-    }
-
-    /**
-     * 导出建筑区域划分列表
-     */
-    @RequiresPermissions("basecfg:zoning:export")
-    @Log(title = "建筑区域划分", businessType = BusinessType.EXPORT)
-    @PostMapping("/export")
-    public void export(HttpServletResponse response, AreaBuildingZoning areaBuildingZoning)
-    {
-        List<AreaBuildingZoning> list = areaBuildingZoningService.selectAreaBuildingZoningList(areaBuildingZoning);
-        ExcelUtil<AreaBuildingZoning> util = new ExcelUtil<AreaBuildingZoning>(AreaBuildingZoning.class);
-        util.exportExcel(response, list, "建筑区域划分数据");
-    }
-
-    /**
-     * 获取建筑区域划分详细信息
-     */
-    @RequiresPermissions("basecfg:zoning:query")
-    @GetMapping(value = "/{id}")
-    public AjaxResult getInfo(@PathVariable("id") Long id)
-    {
-        return success(areaBuildingZoningService.selectAreaBuildingZoningById(id));
-    }
-
-    /**
-     * 新增建筑区域划分
-     */
-    @RequiresPermissions("basecfg:zoning:add")
-    @Log(title = "建筑区域划分", businessType = BusinessType.INSERT)
-    @PostMapping
-    public AjaxResult add(@RequestBody AreaBuildingZoning areaBuildingZoning)
-    {
-        return toAjax(areaBuildingZoningService.insertAreaBuildingZoning(areaBuildingZoning));
-    }
-
-    /**
-     * 修改建筑区域划分
-     */
-    @RequiresPermissions("basecfg:zoning:edit")
-    @Log(title = "建筑区域划分", businessType = BusinessType.UPDATE)
-    @PutMapping
-    public AjaxResult edit(@RequestBody AreaBuildingZoning areaBuildingZoning)
-    {
-        return toAjax(areaBuildingZoningService.updateAreaBuildingZoning(areaBuildingZoning));
-    }
-
-    /**
-     * 删除建筑区域划分
-     */
-    @RequiresPermissions("basecfg:zoning:remove")
-    @Log(title = "建筑区域划分", businessType = BusinessType.DELETE)
-	@DeleteMapping("/{ids}")
-    public AjaxResult remove(@PathVariable Long[] ids)
-    {
-        return toAjax(areaBuildingZoningService.deleteAreaBuildingZoningByIds(ids));
-    }
-}

+ 77 - 64
ems-cloud/ems-modules/ems-server/src/main/java/com/ruoyi/ems/controller/AreaController.java

@@ -1,30 +1,32 @@
 package com.ruoyi.ems.controller;
 
-import java.util.ArrayList;
-import java.util.List;
-import javax.servlet.http.HttpServletResponse;
-
-import com.ruoyi.ems.domain.AreaOld;
+import com.ruoyi.common.core.web.controller.BaseController;
+import com.ruoyi.common.core.web.domain.AjaxResult;
+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.Area;
+import com.ruoyi.ems.domain.EmsFacs;
+import com.ruoyi.ems.domain.ObjTagRel;
 import com.ruoyi.ems.model.TreeEntity;
-import org.apache.commons.collections4.CollectionUtils;
+import com.ruoyi.ems.service.IAreaService;
+import com.ruoyi.ems.service.IEmsFacsService;
+import com.ruoyi.ems.service.IObjTagRelService;
+import com.ruoyi.ems.util.AreaUtils;
 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.RequestParam;
 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.ems.domain.Area;
-import com.ruoyi.ems.service.IAreaService;
-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 java.util.List;
+import java.util.Set;
+import java.util.stream.Collectors;
 
 /**
  * 区域对象Controller
@@ -38,6 +40,12 @@ public class AreaController extends BaseController {
     @Autowired
     private IAreaService areaService;
 
+    @Autowired
+    private IEmsFacsService facsService;
+
+    @Autowired
+    private IObjTagRelService objTagRelService;
+
     /**
      * 查询区域对象列表
      */
@@ -54,28 +62,66 @@ public class AreaController extends BaseController {
      * @param rootCode 根节点编码
      * @return 区域位置树
      */
-    @GetMapping(value = "/areaTree")
-    public AjaxResult getAreaTree(@RequestParam(name = "recursion", required = false) boolean recursion,
-        @RequestParam(name = "rootCode") String rootCode) {
-        List<Area> areas = areaService.selectAreaTree(recursion, rootCode);
-        List<TreeEntity> ret = convertAreaTree(areas);
+    @GetMapping(value = "/getAreaTree")
+    public AjaxResult getAreaTree(@RequestParam(name = "rootCode") String rootCode,
+        @RequestParam(name = "recursion", required = false) boolean recursion) {
+        List<Area> areas = areaService.selectAreaTree(rootCode, recursion);
+        List<TreeEntity> ret = AreaUtils.convertAreaTree(areas);
         return success(ret);
     }
 
     /**
-     * 查询服务区列表 (根据下挂设施)
+     * 查询区域树 (根据设施类型过滤)
      *
      * @param facsCategory    设施类别
      * @param facsSubCategory 设施子类别
      */
-    @GetMapping("/listWithFacsCategoryAsTree")
-    public AjaxResult listWithFacsCategoryAsTree(
+    @GetMapping("/getAreaTreeByFacsCategory")
+    public AjaxResult getAreaTreeByFacsCategory(
         @RequestParam(name = "parentCode", required = false, defaultValue = "0") String parentCode,
         @RequestParam(name = "facsCategory") String facsCategory,
         @RequestParam(name = "facsSubCategory", required = false) String facsSubCategory,
         @RequestParam(name = "recursion", required = false) boolean recursion) {
 
-        List<TreeEntity> retList = recursionAreaWithCategory(parentCode, facsCategory, facsSubCategory, recursion);
+        // 查询区域树
+        List<Area> areaTree = areaService.selectAreaTree(parentCode, recursion);
+
+        // 查询设施列表
+        EmsFacs facsParam = new EmsFacs();
+        facsParam.setFacsCategory(facsCategory);
+        facsParam.setFacsSubCategory(facsSubCategory);
+        List<EmsFacs> facsList = facsService.selectEmsFacsList(facsParam);
+        Set<String> facsAreaCodes = facsList.stream().map(EmsFacs::getRefArea).collect(Collectors.toSet());
+
+        // 过滤树节点
+        areaTree = AreaUtils.filterTree(areaTree, facsAreaCodes);
+        List<TreeEntity> retList = AreaUtils.convertAreaTree(areaTree);
+        return success(retList);
+    }
+
+    /**
+     * 查询区域树 (根据对象标签过滤)
+     *
+     * @param parentCode 区域父节点
+     * @param recursion  低谷查询
+     * @param tagCode    标签
+     * @return 区域位置树
+     */
+    @GetMapping(value = "/getAreaTreeByTag")
+    public AjaxResult getAreaTreeByTag(@RequestParam(name = "parentCode", required = false, defaultValue = "0") String parentCode,
+        @RequestParam(name = "recursion", required = false, defaultValue = "true") boolean recursion,
+        @RequestParam(name = "tagCode") String tagCode) {
+        // 查询区域树
+        List<Area> areaTree = areaService.selectAreaTree(parentCode, recursion);
+
+        // 查询b列表
+        List<ObjTagRel> tagRels = objTagRelService.selectListByTagCode(1, tagCode);
+        Set<String> facsAreaCodes = tagRels.stream().map(ObjTagRel::getObjCode).collect(Collectors.toSet());
+
+        // 过滤树节点
+        areaTree = AreaUtils.filterTree(areaTree, facsAreaCodes);
+        List<TreeEntity> retList = AreaUtils.convertAreaTree(areaTree);
+
         return success(retList);
     }
 
@@ -88,6 +134,12 @@ public class AreaController extends BaseController {
         return success(areaService.selectAreaById(id));
     }
 
+    @RequiresPermissions("ems:area:query")
+    @GetMapping(value = "/getByCode")
+    public AjaxResult getByCode(@RequestParam("areaCode") String areaCode) {
+        return success(areaService.selectAreaByCode(areaCode));
+    }
+
     /**
      * 新增区域对象
      */
@@ -118,43 +170,4 @@ public class AreaController extends BaseController {
         return toAjax(areaService.deleteAreaByIds(ids));
     }
 
-    public List<TreeEntity> recursionAreaWithCategory(String parentCode, String facsCategory, String facsSubCategory,
-        boolean recursion) {
-        List<TreeEntity> retList = new ArrayList<>();
-        List<Area> areas = areaService.selectWithFacsCategory(parentCode, facsCategory, facsSubCategory);
-
-        for (Area area : areas) {
-            TreeEntity tree = new TreeEntity();
-            tree.setId(area.getAreaCode());
-            tree.setLabel(area.getAreaName());
-
-            if (recursion) {
-                tree.setChildren(
-                    recursionAreaWithCategory(area.getAreaCode(), facsCategory, facsSubCategory, recursion));
-            }
-
-            retList.add(tree);
-        }
-
-        return retList;
-    }
-
-    public List<TreeEntity> convertAreaTree(List<?> areas) {
-        List<TreeEntity> retList = new ArrayList<>();
-
-        for (Object obj : areas) {
-            Area area = (Area) obj;
-            TreeEntity tree = new TreeEntity();
-            tree.setId(area.getAreaCode());
-            tree.setLabel(area.getAreaName());
-
-            if (CollectionUtils.isNotEmpty(area.getChildren())) {
-                tree.setChildren(convertAreaTree(area.getChildren()));
-            }
-
-            retList.add(tree);
-        }
-
-        return retList;
-    }
 }

+ 0 - 185
ems-cloud/ems-modules/ems-server/src/main/java/com/ruoyi/ems/controller/AreaOldController.java

@@ -1,185 +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.AreaOld;
-import com.ruoyi.ems.model.TreeEntity;
-import com.ruoyi.ems.service.IAreaOldService;
-import io.swagger.annotations.Api;
-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.RequestParam;
-import org.springframework.web.bind.annotation.RestController;
-
-import javax.servlet.http.HttpServletResponse;
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * 服务区Controller
- *
- * @author ruoyi
- * @date 2024-07-09
- */
-@RestController
-@RequestMapping("/basecfg/areaold")
-@Api(value = "AreaController", description = "地块管理")
-public class AreaOldController extends BaseController {
-    @Autowired
-    private IAreaOldService areaService;
-
-    /**
-     * 查询服务区列表
-     */
-    @RequiresPermissions("basecfg:area:list")
-    @GetMapping("/list")
-    public TableDataInfo list(AreaOld area) {
-        startPage();
-        List<AreaOld> list = areaService.selectAreaList(area);
-        return getDataTable(list);
-    }
-
-    /**
-     * 查询服务区列表 (根据下挂设施)
-     *
-     * @param facsCategory    设施类别
-     * @param facsSubCategory 设施子类别
-     */
-    @GetMapping("/listWithFacsCategory")
-    public AjaxResult listWithFacsCategory(@RequestParam(name = "facsCategory") String facsCategory,
-        @RequestParam(name = "facsSubCategory", required = false) String facsSubCategory) {
-        List<AreaOld> list = areaService.selectWithFacsCategory(facsCategory, facsSubCategory);
-        return success(list);
-    }
-
-    /**
-     * 查询服务区列表 (根据下挂设施)
-     *
-     * @param facsCategory    设施类别
-     * @param facsSubCategory 设施子类别
-     */
-    @GetMapping("/listWithFacsCategoryAsTree")
-    public AjaxResult listWithFacsCategoryAsTree(@RequestParam(name = "facsCategory") String facsCategory,
-        @RequestParam(name = "facsSubCategory", required = false) String facsSubCategory) {
-        List<AreaOld> areas = areaService.selectWithFacsCategory(facsCategory, facsSubCategory);
-        List<TreeEntity> retList = new ArrayList<>();
-
-        for (AreaOld area : areas) {
-            TreeEntity tree = new TreeEntity();
-            tree.setId(area.getAreaCode());
-            tree.setLabel(area.getAreaName());
-            retList.add(tree);
-        }
-
-        return success(retList);
-    }
-
-    /**
-     * 查询服务区基本信息列表
-     */
-    @RequiresPermissions("basecfg:area:list")
-    @GetMapping("/listTotal")
-    public AjaxResult listTotal() {
-        List<AreaOld> list = areaService.selectAreaList(new AreaOld());
-        return success(list);
-    }
-
-    /**
-     * 导出服务区列表
-     */
-    @RequiresPermissions("basecfg:area:export")
-    @Log(title = "区块划分", businessType = BusinessType.EXPORT)
-    @PostMapping("/export")
-    public void export(HttpServletResponse response, AreaOld area) {
-        List<AreaOld> list = areaService.selectAreaList(area);
-        ExcelUtil<AreaOld> util = new ExcelUtil<AreaOld>(AreaOld.class);
-        util.exportExcel(response, list, "服务区数据");
-    }
-
-    /**
-     * 获取服务区详细信息
-     */
-    @RequiresPermissions("basecfg:area:query")
-    @GetMapping(value = "/{id}")
-    public AjaxResult getInfo(@PathVariable("id") Long id) {
-        return success(areaService.selectAreaById(id));
-    }
-
-    /**
-     * 获取服务区树
-     *
-     * @param tier 层级 Area、Building、Zoning
-     * @return 区域位置树
-     */
-    @GetMapping(value = "/areaTree")
-    public AjaxResult getAreaTree(@RequestParam(name = "tier") String tier) {
-        return success(areaService.selectAreaTreeList(tier));
-    }
-
-    /**
-     * 获取服务区树
-     *
-     * @param tier    层级 Area、Building、Zoning
-     * @param tagCode 标签
-     * @return 区域位置树
-     */
-    @GetMapping(value = "/areaTreeByTag")
-    public AjaxResult getCoTree(@RequestParam(name = "tier") String tier,
-        @RequestParam(name = "tagCode") String tagCode) {
-        return success(areaService.selectAreaTreeByTag(tier, tagCode));
-    }
-
-    /**
-     * 获取服务区树
-     *
-     * @param tier 层级 Area、Building、Zoning
-     * @param code 代码
-     * @return 区域位置树
-     */
-    @GetMapping(value = "/areaTreeByCode")
-    public AjaxResult getAreaTreeByCode(@RequestParam(name = "tier") String tier,
-        @RequestParam(name = "code") String code) {
-        return success(areaService.selectAreaTreeByCode(tier, code));
-    }
-
-    /**
-     * 新增服务区
-     */
-    @RequiresPermissions("basecfg:area:add")
-    @Log(title = "区块划分", businessType = BusinessType.INSERT)
-    @PostMapping
-    public AjaxResult add(@RequestBody AreaOld area) {
-        return toAjax(areaService.insertArea(area));
-    }
-
-    /**
-     * 修改服务区
-     */
-    @RequiresPermissions("basecfg:area:edit")
-    @Log(title = "区块划分", businessType = BusinessType.UPDATE)
-    @PutMapping
-    public AjaxResult edit(@RequestBody AreaOld area) {
-        return toAjax(areaService.updateArea(area));
-    }
-
-    /**
-     * 删除服务区
-     */
-    @RequiresPermissions("basecfg:area:remove")
-    @Log(title = "区块划分", businessType = BusinessType.DELETE)
-    @DeleteMapping("/{ids}")
-    public AjaxResult remove(@PathVariable Long[] ids) {
-        return toAjax(areaService.deleteAreaByIds(ids));
-    }
-}

+ 19 - 44
ems-cloud/ems-modules/ems-server/src/main/java/com/ruoyi/ems/controller/DeviceController.java

@@ -1,20 +1,21 @@
 package com.ruoyi.ems.controller;
 
-import java.util.ArrayList;
-import java.util.List;
-import java.util.stream.Collectors;
-
-import javax.servlet.http.HttpServletResponse;
-
-import com.github.pagehelper.PageInfo;
-import com.ruoyi.common.core.constant.HttpStatus;
-import com.ruoyi.common.core.exception.Assert;
 import com.ruoyi.common.core.exception.BusinessException;
+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.Area;
-import com.ruoyi.ems.model.TreeEntity;
+import com.ruoyi.ems.domain.EmsDevice;
+import com.ruoyi.ems.model.QueryDevice;
 import com.ruoyi.ems.service.IAreaService;
+import com.ruoyi.ems.service.IEmsDeviceService;
 import com.ruoyi.ems.service.IEmsFacsService;
-import org.apache.commons.collections4.CollectionUtils;
+import com.ruoyi.ems.util.AreaUtils;
+import io.swagger.annotations.Api;
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.DeleteMapping;
@@ -27,23 +28,9 @@ 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.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.AreaBuilding;
-import com.ruoyi.ems.domain.AreaBuildingZoning;
-import com.ruoyi.ems.domain.EmsDevice;
-import com.ruoyi.common.core.enums.AreaTier;
-import com.ruoyi.ems.model.QueryDevice;
-import com.ruoyi.ems.service.IAreaBuildingService;
-import com.ruoyi.ems.service.IAreaBuildingZoningService;
-import com.ruoyi.ems.service.IEmsDeviceService;
-
-import io.swagger.annotations.Api;
+import javax.servlet.http.HttpServletResponse;
+import java.util.ArrayList;
+import java.util.List;
 
 /**
  * 能源设备Controller
@@ -112,11 +99,11 @@ public class DeviceController extends BaseController {
 
         try {
             if (StringUtils.isNotEmpty(queryDevice.getLocationRef())) {
-                List<Area> areaTree = areaService.selectAreaTree(true, queryDevice.getLocationRef());
+                List<Area> areaTree = areaService.selectAreaTree(queryDevice.getLocationRef(), true);
                 List<String> areaCodes = new ArrayList<>();
                 areaCodes.add(queryDevice.getLocationRef());
-                // 递归添加区域子节点(子节点关联设备一并取出)
-                fillCodeRecursion(areaTree, areaCodes);
+                // 递归取出区域子节点code做查询条件(需要将子节点区域关联设备一并取出)
+                AreaUtils.getCodeRecursion(areaTree, areaCodes);
                 queryDevice.setAreaCodes(areaCodes);
             }
 
@@ -221,16 +208,4 @@ public class DeviceController extends BaseController {
     public AjaxResult getDeviceOnlineSummary(@RequestParam("areaCode") String areaCode) {
         return success(deviceService.calcDeviceOnlineSummary(areaCode));
     }
-
-    private <T> void fillCodeRecursion(List<T> areaTree, List<String> areaCodes) {
-        if (CollectionUtils.isNotEmpty(areaTree)) {
-            for (T t : areaTree) {
-                Area area = (Area) t;
-                areaCodes.add(area.getAreaCode());
-                if (CollectionUtils.isNotEmpty(area.getChildren())) {
-                    fillCodeRecursion(area.getChildren(), areaCodes);
-                }
-            }
-        }
-    }
-}
+}

+ 0 - 182
ems-cloud/ems-modules/ems-server/src/main/java/com/ruoyi/ems/domain/AreaBuilding.java

@@ -1,182 +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;
-
-/**
- * 建筑基本信息对象 adm_area_building
- * 
- * @author ruoyi
- * @date 2024-07-09
- */
-public class AreaBuilding extends BaseEntity
-{
-    private static final long serialVersionUID = 1L;
-
-    /** 序号 */
-    private Long id;
-
-    /** 建筑编码 */
-    private String bldgCode;
-
-    /** 建筑名称 */
-    @Excel(name = "建筑名称")
-    private String bldgName;
-
-    /** 详细地址 */
-    @Excel(name = "详细地址")
-    private String address;
-
-    /** 建筑层数(地上) */
-    @Excel(name = "建筑层数(地上)")
-    private Long upBldgFloor;
-
-    /** 建筑层数(地下) */
-    @Excel(name = "建筑层数(地下)")
-    private Long downBldgFloor;
-
-    /** 建筑高度 */
-    @Excel(name = "建筑高度")
-    private Long bldgHeight;
-
-    /** 建筑面积(平方米 m²) */
-    @Excel(name = "建筑面积(平方米,m=²)")
-    private Long floorArea;
-
-    /** 主要用途 */
-    @Excel(name = "主要用途")
-    private String bldgUsage;
-
-    /** 所属园区code */
-    private String areaCode;
-
-    /** 所属园区名称 */
-    @Excel(name = "园区")
-    private String areaName;
-
-    private String areaShortName;
-
-    public void setId(Long id) 
-    {
-        this.id = id;
-    }
-
-    public Long getId() 
-    {
-        return id;
-    }
-    public void setBldgCode(String bldgCode) 
-    {
-        this.bldgCode = bldgCode;
-    }
-
-    public String getBldgCode() 
-    {
-        return bldgCode;
-    }
-    public void setBldgName(String bldgName) 
-    {
-        this.bldgName = bldgName;
-    }
-
-    public String getBldgName() 
-    {
-        return bldgName;
-    }
-    public void setAddress(String address) 
-    {
-        this.address = address;
-    }
-
-    public String getAddress() 
-    {
-        return address;
-    }
-    public void setUpBldgFloor(Long upBldgFloor) 
-    {
-        this.upBldgFloor = upBldgFloor;
-    }
-
-    public Long getUpBldgFloor() 
-    {
-        return upBldgFloor;
-    }
-    public void setDownBldgFloor(Long downBldgFloor) 
-    {
-        this.downBldgFloor = downBldgFloor;
-    }
-
-    public Long getDownBldgFloor() 
-    {
-        return downBldgFloor;
-    }
-    public void setBldgHeight(Long bldgHeight) 
-    {
-        this.bldgHeight = bldgHeight;
-    }
-
-    public Long getBldgHeight() 
-    {
-        return bldgHeight;
-    }
-    public void setFloorArea(Long floorArea) 
-    {
-        this.floorArea = floorArea;
-    }
-
-    public Long getFloorArea() 
-    {
-        return floorArea;
-    }
-    public void setBldgUsage(String bldgUsage) 
-    {
-        this.bldgUsage = bldgUsage;
-    }
-
-    public String getBldgUsage() 
-    {
-        return bldgUsage;
-    }
-
-    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 String getAreaShortName() {
-        return areaShortName;
-    }
-
-    public void setAreaShortName(String areaShortName) {
-        this.areaShortName = areaShortName;
-    }
-
-    @Override
-    public String toString() {
-        return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
-            .append("id", getId())
-            .append("bldgCode", getBldgCode())
-            .append("bldgName", getBldgName())
-            .append("address", getAddress())
-            .append("upBldgFloor", getUpBldgFloor())
-            .append("downBldgFloor", getDownBldgFloor())
-            .append("bldgHeight", getBldgHeight())
-            .append("floorArea", getFloorArea())
-            .append("bldgUsage", getBldgUsage())
-            .append("areaCode", getAreaCode())
-            .toString();
-    }
-}

+ 0 - 198
ems-cloud/ems-modules/ems-server/src/main/java/com/ruoyi/ems/domain/AreaBuildingZoning.java

@@ -1,198 +0,0 @@
-package com.ruoyi.ems.domain;
-
-import com.ruoyi.common.core.annotation.Excel;
-import com.ruoyi.common.core.web.domain.BaseEntity;
-import org.apache.commons.lang3.builder.ToStringBuilder;
-import org.apache.commons.lang3.builder.ToStringStyle;
-
-import java.util.List;
-
-/**
- * 建筑区域划分对象 adm_area_building_zoning
- *
- * @author ruoyi
- * @date 2024-07-09
- */
-public class AreaBuildingZoning extends BaseEntity {
-    private static final long serialVersionUID = 1L;
-
-    /**
-     * 序号
-     */
-    private Long id;
-
-    /**
-     * 建筑编码
-     */
-    @Excel(name = "建筑编码")
-    private String bldgCode;
-
-    @Excel(name = "建筑名称")
-    private String bldgName;
-
-    /**
-     * 分区编码
-     */
-    @Excel(name = "分区编码")
-    private String zoningCode;
-
-    /**
-     * 分区名称
-     */
-    @Excel(name = "分区名称")
-    private String zoningName;
-
-    /**
-     * 楼层
-     */
-    @Excel(name = "楼层")
-    private Long floor;
-
-    /**
-     * 建筑划分面积
-     */
-    @Excel(name = "建筑划分面积")
-    private Long bldgLdArea;
-
-    /**
-     * 使用详情
-     */
-    @Excel(name = "使用详情")
-    private String usageDetail;
-
-    /** 区域编码 */
-    private String areaCode;
-
-    /**
-     * 标签代码
-     */
-    private List<String> tagCodeList;
-
-    /**
-     * 标签名称
-     */
-    private String tagCodes;
-
-    /**
-     * 标签名称
-     */
-    private String tagNames;
-
-    /**
-     * 区域路径
-     **/
-    private String areaPath;
-
-    public void setId(Long id) {
-        this.id = id;
-    }
-
-    public Long getId() {
-        return id;
-    }
-
-    public void setBldgCode(String bldgCode) {
-        this.bldgCode = bldgCode;
-    }
-
-    public String getBldgCode() {
-        return bldgCode;
-    }
-
-    public String getBldgName() {
-        return bldgName;
-    }
-
-    public void setBldgName(String bldgName) {
-        this.bldgName = bldgName;
-    }
-
-    public String getZoningCode() {
-        return zoningCode;
-    }
-
-    public void setZoningCode(String zoningCode) {
-        this.zoningCode = zoningCode;
-    }
-
-    public String getZoningName() {
-        return zoningName;
-    }
-
-    public void setZoningName(String zoningName) {
-        this.zoningName = zoningName;
-    }
-
-    public void setFloor(Long floor) {
-        this.floor = floor;
-    }
-
-    public Long getFloor() {
-        return floor;
-    }
-
-    public void setBldgLdArea(Long bldgLdArea) {
-        this.bldgLdArea = bldgLdArea;
-    }
-
-    public Long getBldgLdArea() {
-        return bldgLdArea;
-    }
-
-    public void setUsageDetail(String usageDetail) {
-        this.usageDetail = usageDetail;
-    }
-
-    public String getUsageDetail() {
-        return usageDetail;
-    }
-
-    public List<String> getTagCodeList() {
-        return tagCodeList;
-    }
-
-    public void setTagCodeList(List<String> tagCodeList) {
-        this.tagCodeList = tagCodeList;
-    }
-
-    public String getTagCodes() {
-        return tagCodes;
-    }
-
-    public void setTagCodes(String tagCodes) {
-        this.tagCodes = tagCodes;
-    }
-
-    public String getTagNames() {
-        return tagNames;
-    }
-
-    public void setTagNames(String tagNames) {
-        this.tagNames = tagNames;
-    }
-
-    public String getAreaCode() {
-        return areaCode;
-    }
-
-    public void setAreaCode(String areaCode) {
-        this.areaCode = areaCode;
-    }
-
-    public String getAreaPath() {
-        return areaPath;
-    }
-
-    public void setAreaPath(String areaPath) {
-        this.areaPath = areaPath;
-    }
-
-    @Override
-    public String toString() {
-        return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE).append("id", getId())
-            .append("bldgCode", getBldgCode()).append("zoningCode", getZoningCode())
-            .append("zoningName", getZoningName()).append("floor", getFloor()).append("bldgLdArea", getBldgLdArea())
-            .append("usageDetail", getUsageDetail()).append("tagCodes", getTagCodes()).append("tagNames", getTagNames())
-            .toString();
-    }
-}

+ 0 - 249
ems-cloud/ems-modules/ems-server/src/main/java/com/ruoyi/ems/domain/AreaOld.java

@@ -1,249 +0,0 @@
-package com.ruoyi.ems.domain;
-
-import java.util.Date;
-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;
-
-/**
- * 服务区对象 adm_service_area
- * 
- * @author ruoyi
- * @date 2024-07-09
- */
-public class AreaOld extends BaseEntity
-{
-    private static final long serialVersionUID = 1L;
-
-    /** 序号 */
-    private Long id;
-
-    /** 服务区代码 */
-    @Excel(name = "服务区代码")
-    private String areaCode;
-
-    /** 服务区名称 */
-    @Excel(name = "服务区名称")
-    private String areaName;
-
-    @Excel(name = "服务区简称")
-    private String shortName;
-
-    /** 服务星级 */
-    @Excel(name = "服务星级")
-    private Long serviceStar;
-
-    /** 所在城市 */
-    @Excel(name = "所在城市")
-    private String city;
-
-    /** 所在高速 */
-    @Excel(name = "所在高速")
-    private String highway;
-
-    /** 方向 */
-    @Excel(name = "方向")
-    private String direction;
-
-    /** 地址 */
-    @Excel(name = "地址")
-    private String address;
-
-    /** 所有单位 */
-    @Excel(name = "所有单位")
-    private String attrOrg;
-
-    /** 所有单位 */
-    @Excel(name = "管理单位")
-    private String mgrOrg;
-
-    /** 开业时间 */
-    @JsonFormat(pattern = "yyyy-MM-dd")
-    @Excel(name = "开业时间", width = 30, dateFormat = "yyyy-MM-dd")
-    private Date openDate;
-
-    /** 占地面积(亩) */
-    @Excel(name = "占地面积(亩)")
-    private Long landArea;
-
-    /** 建筑面积(平方米) */
-    @Excel(name = "建筑面积(平方米)")
-    private Long floorArea;
-
-    /** 经度 */
-    @Excel(name = "经度")
-    private Double longitude;
-
-    /** 纬度 */
-    @Excel(name = "纬度")
-    private Double latitude;
-
-    public void setId(Long id) 
-    {
-        this.id = id;
-    }
-
-    public Long getId() 
-    {
-        return id;
-    }
-    public void setAreaCode(String areaCode) 
-    {
-        this.areaCode = areaCode;
-    }
-
-    public String getAreaCode() 
-    {
-        return areaCode;
-    }
-    public void setAreaName(String areaName) 
-    {
-        this.areaName = areaName;
-    }
-
-    public String getAreaName() 
-    {
-        return areaName;
-    }
-
-    public String getShortName() {
-        return shortName;
-    }
-
-    public void setShortName(String shortName) {
-        this.shortName = shortName;
-    }
-
-    public void setServiceStar(Long serviceStar)
-    {
-        this.serviceStar = serviceStar;
-    }
-
-    public Long getServiceStar() 
-    {
-        return serviceStar;
-    }
-    public void setCity(String city) 
-    {
-        this.city = city;
-    }
-
-    public String getCity() 
-    {
-        return city;
-    }
-    public void setHighway(String highway) 
-    {
-        this.highway = highway;
-    }
-
-    public String getHighway() 
-    {
-        return highway;
-    }
-    public void setDirection(String direction) 
-    {
-        this.direction = direction;
-    }
-
-    public String getDirection() 
-    {
-        return direction;
-    }
-    public void setAddress(String address) 
-    {
-        this.address = address;
-    }
-
-    public String getAddress() 
-    {
-        return address;
-    }
-    public void setAttrOrg(String attrOrg) 
-    {
-        this.attrOrg = attrOrg;
-    }
-
-    public String getAttrOrg() 
-    {
-        return attrOrg;
-    }
-    public void setMgrOrg(String mgrOrg) 
-    {
-        this.mgrOrg = mgrOrg;
-    }
-
-    public String getMgrOrg() 
-    {
-        return mgrOrg;
-    }
-    public void setOpenDate(Date openDate) 
-    {
-        this.openDate = openDate;
-    }
-
-    public Date getOpenDate() 
-    {
-        return openDate;
-    }
-    public void setLandArea(Long landArea) 
-    {
-        this.landArea = landArea;
-    }
-
-    public Long getLandArea() 
-    {
-        return landArea;
-    }
-    public void setFloorArea(Long floorArea) 
-    {
-        this.floorArea = floorArea;
-    }
-
-    public Long getFloorArea() 
-    {
-        return floorArea;
-    }
-    public void setLongitude(Double longitude)
-    {
-        this.longitude = longitude;
-    }
-
-    public Double getLongitude()
-    {
-        return longitude;
-    }
-    public void setLatitude(Double latitude)
-    {
-        this.latitude = latitude;
-    }
-
-    public Double getLatitude()
-    {
-        return latitude;
-    }
-
-    @Override
-    public String toString() {
-        return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
-            .append("id", getId())
-            .append("areaCode", getAreaCode())
-            .append("areaName", getAreaName())
-            .append("shortName", getShortName())
-            .append("serviceStar", getServiceStar())
-            .append("city", getCity())
-            .append("highway", getHighway())
-            .append("direction", getDirection())
-            .append("address", getAddress())
-            .append("attrOrg", getAttrOrg())
-            .append("mgrOrg", getMgrOrg())
-            .append("openDate", getOpenDate())
-            .append("landArea", getLandArea())
-            .append("floorArea", getFloorArea())
-            .append("longitude", getLongitude())
-            .append("latitude", getLatitude())
-            .toString();
-    }
-}

+ 0 - 14
ems-cloud/ems-modules/ems-server/src/main/java/com/ruoyi/ems/domain/EmsDevice.java

@@ -88,11 +88,6 @@ public class EmsDevice extends BaseEntity {
     private String areaCode;
 
     /**
-     * 区域祖级
-     */
-    private String areaAncestors;
-
-    /**
      * 归属区域路径
      */
     private String areaPath;
@@ -244,14 +239,6 @@ public class EmsDevice extends BaseEntity {
         this.areaCode = areaCode;
     }
 
-    public String getAreaAncestors() {
-        return areaAncestors;
-    }
-
-    public void setAreaAncestors(String areaAncestors) {
-        this.areaAncestors = areaAncestors;
-    }
-
     public String getAreaPath() {
         return areaPath;
     }
@@ -340,7 +327,6 @@ public class EmsDevice extends BaseEntity {
             .append("locationRef", getLocationRef())
             .append("locationRefName", getLocationRefName())
             .append("areaCode", getAreaCode())
-            .append("areaAncestors", getAreaAncestors())
             .append("deviceModel", getDeviceModel())
             .append("deviceModelName", getDeviceModelName())
             .append("refFacs", getRefFacs())

+ 49 - 33
ems-cloud/ems-modules/ems-server/src/main/java/com/ruoyi/ems/domain/MeterDevice.java

@@ -4,57 +4,73 @@ import com.ruoyi.common.core.web.domain.BaseEntity;
 
 /**
  * 计量设备对象 adm_meter_device
- * 
+ *
  * @author ruoyi
  * @date 2024-08-08
  */
-public class MeterDevice extends BaseEntity
-{
+public class MeterDevice extends BaseEntity {
     private static final long serialVersionUID = 1L;
 
-    /** 序号 */
+    /**
+     * 序号
+     */
     private Long id;
 
-    /** 设备代码 */
+    /**
+     * 设备代码
+     */
     private String deviceCode;
 
-    /** 服务区代码 */
+    /**
+     * 服务区代码
+     */
     private String areaCode;
 
-    /** 计量类别 */
+    private String areaName;
+
+    /**
+     * 计量类别
+     */
     private Long meterCls;
 
-    /** 计量对象类型 1-区块 2-设备 */
+    /**
+     * 计量对象类型 1-区块 2-设备
+     */
     private Long objType;
 
     /**
-     * 计量对象类型
-     * obj_type=1
-     *  - 1: 园区  2: 建筑  3:区块
-     * obj_type =2
-     *    1: 设施  2:设备
+     * 计量对象编码
      */
-    private Long objSubType;
-
-    /** 计量对象编码 */
     private String objCode;
 
-    /** 计量对象名称 */
+    /**
+     * 计量对象名称
+     */
     private String objName;
 
-    /** 计量对象标记 */
+    /**
+     * 计量对象标记
+     */
     private Integer objTag;
 
-    /** 采集周期 */
+    /**
+     * 采集周期
+     */
     private Long colCycle;
 
-    /** 采集方式 */
+    /**
+     * 采集方式
+     */
     private Long colMode;
 
-    /** 倍率 */
+    /**
+     * 倍率
+     */
     private Integer magnification;
 
-    /** 规格描述 */
+    /**
+     * 规格描述
+     */
     private String specDesc;
 
     public Long getId() {
@@ -81,6 +97,14 @@ public class MeterDevice extends BaseEntity
         this.areaCode = areaCode;
     }
 
+    public String getAreaName() {
+        return areaName;
+    }
+
+    public void setAreaName(String areaName) {
+        this.areaName = areaName;
+    }
+
     public Long getMeterCls() {
         return meterCls;
     }
@@ -97,14 +121,6 @@ public class MeterDevice extends BaseEntity
         this.objType = objType;
     }
 
-    public Long getObjSubType() {
-        return objSubType;
-    }
-
-    public void setObjSubType(Long objSubType) {
-        this.objSubType = objSubType;
-    }
-
     public String getObjCode() {
         return objCode;
     }
@@ -164,8 +180,8 @@ public class MeterDevice extends BaseEntity
     @Override
     public String toString() {
         return "MeterDevice{" + "id=" + id + ", deviceCode='" + deviceCode + '\'' + ", areaCode='" + areaCode + '\''
-            + ", meterCls=" + meterCls + ", objType=" + objType + ", objSubType=" + objSubType + ", objCode='" + objCode
-            + '\'' + ", objName='" + objName + '\'' + ", objTag='" + objTag + '\'' + ", colCycle=" + colCycle
-            + ", colMode=" + colMode + ", magnification=" + magnification + ", specDesc='" + specDesc + '\'' + '}';
+            + ", meterCls=" + meterCls + ", objType=" + objType + ", objCode='" + objCode + '\'' + ", objName='"
+            + objName + '\'' + ", objTag='" + objTag + '\'' + ", colCycle=" + colCycle + ", colMode=" + colMode
+            + ", magnification=" + magnification + ", specDesc='" + specDesc + '\'' + '}';
     }
 }

+ 13 - 13
ems-cloud/ems-modules/ems-server/src/main/java/com/ruoyi/ems/mapper/AreaAttrMapper.java

@@ -3,52 +3,52 @@ package com.ruoyi.ems.mapper;
 import com.ruoyi.ems.domain.AreaAttr;
 
 import java.util.List;
+import java.util.Set;
 
 /**
  * 区域对象属性Mapper接口
- * 
+ *
  * @author ruoyi
  * @date 2024-11-01
  */
-public interface AreaAttrMapper
-{
+public interface AreaAttrMapper {
     /**
      * 查询区域对象属性
-     * 
+     *
      * @param areaCode 区域对象代码
      * @return 区域对象属性
      */
-     AreaAttr selectAreaAttrByCode(String areaCode);
+    AreaAttr selectAreaAttrByCode(String areaCode);
 
     /**
      * 查询区域对象属性列表
-     * 
+     *
      * @param list 区域对象代码集合
      * @return 区域对象属性集合
      */
-     List<AreaAttr> selectAreaAttrList(List<String> list);
+    List<AreaAttr> selectAreaAttrList(Set<String> list);
 
     /**
      * 新增区域对象属性
-     * 
+     *
      * @param areaAttr 区域对象属性
      * @return 结果
      */
-     int insertAreaAttr(AreaAttr areaAttr);
+    int insertAreaAttr(AreaAttr areaAttr);
 
     /**
      * 修改区域对象属性
-     * 
+     *
      * @param areaAttr 区域对象属性
      * @return 结果
      */
-     int updateAreaAttr(AreaAttr areaAttr);
+    int updateAreaAttr(AreaAttr areaAttr);
 
     /**
      * 删除区域对象属性
-     * 
+     *
      * @param areaCode 区域对象代码
      * @return 结果
      */
-     int deleteAreaAttrByCode(String areaCode);
+    int deleteAreaAttrByCode(String areaCode);
 }

+ 0 - 69
ems-cloud/ems-modules/ems-server/src/main/java/com/ruoyi/ems/mapper/AreaBuildingMapper.java

@@ -1,69 +0,0 @@
-package com.ruoyi.ems.mapper;
-
-import java.util.List;
-
-import com.ruoyi.ems.domain.AreaBuilding;
-
-/**
- * 建筑基本信息Mapper接口
- *
- * @author ruoyi
- * @date 2024-07-09
- */
-public interface AreaBuildingMapper {
-    /**
-     * 查询建筑基本信息
-     *
-     * @param id 建筑基本信息主键
-     * @return 建筑基本信息
-     */
-    AreaBuilding selectAreaBuildingById(Long id);
-
-    /**
-     * 查询建筑基本信息
-     *
-     * @param code 建筑基本信息主键
-     * @return 建筑基本信息
-     */
-    AreaBuilding selectAreaBuildingByCode(String code);
-
-    /**
-     * 查询建筑基本信息列表
-     *
-     * @param areaBuilding 建筑基本信息
-     * @return 建筑基本信息集合
-     */
-    List<AreaBuilding> selectAreaBuildingList(AreaBuilding areaBuilding);
-
-    /**
-     * 新增建筑基本信息
-     *
-     * @param areaBuilding 建筑基本信息
-     * @return 结果
-     */
-    int insertAreaBuilding(AreaBuilding areaBuilding);
-
-    /**
-     * 修改建筑基本信息
-     *
-     * @param areaBuilding 建筑基本信息
-     * @return 结果
-     */
-    int updateAreaBuilding(AreaBuilding areaBuilding);
-
-    /**
-     * 删除建筑基本信息
-     *
-     * @param id 建筑基本信息主键
-     * @return 结果
-     */
-    int deleteAreaBuildingById(Long id);
-
-    /**
-     * 批量删除建筑基本信息
-     *
-     * @param ids 需要删除的数据主键集合
-     * @return 结果
-     */
-    int deleteAreaBuildingByIds(Long[] ids);
-}

+ 0 - 86
ems-cloud/ems-modules/ems-server/src/main/java/com/ruoyi/ems/mapper/AreaBuildingZoningMapper.java

@@ -1,86 +0,0 @@
-package com.ruoyi.ems.mapper;
-
-import java.util.List;
-import java.util.Set;
-
-import com.ruoyi.ems.domain.AreaBuildingZoning;
-
-/**
- * 建筑区域划分Mapper接口
- *
- * @author ruoyi
- * @date 2024-07-09
- */
-public interface AreaBuildingZoningMapper {
-    /**
-     * 查询建筑区域划分
-     *
-     * @param id 建筑区域划分主键
-     * @return 建筑区域划分
-     */
-    AreaBuildingZoning selectAreaBuildingZoningById(Long id);
-
-    /**
-     * 查询建筑区域code
-     *
-     * @param code 建筑区域划分主键
-     * @return 建筑区域划分
-     */
-    AreaBuildingZoning selectAreaBuildingZoningByCode(String code);
-
-    /**
-     * 根据code集合查询
-     *
-     * @param codes code集合
-     * @return 建筑区域划分
-     */
-    List<AreaBuildingZoning> selectByCodes(Set<String> codes);
-
-    /**
-     * 查询建筑区域划分列表
-     *
-     * @param areaBuildingZoning 建筑区域划分
-     * @return 建筑区域划分集合
-     */
-    List<AreaBuildingZoning> selectAreaBuildingZoningList(AreaBuildingZoning areaBuildingZoning);
-
-    /**
-     * 新增建筑区域划分
-     *
-     * @param areaBuildingZoning 建筑区域划分
-     * @return 结果
-     */
-    int insertAreaBuildingZoning(AreaBuildingZoning areaBuildingZoning);
-
-    /**
-     * 修改建筑区域划分
-     *
-     * @param areaBuildingZoning 建筑区域划分
-     * @return 结果
-     */
-    int updateAreaBuildingZoning(AreaBuildingZoning areaBuildingZoning);
-
-    /**
-     * 删除建筑区域划分
-     *
-     * @param id 建筑区域划分主键
-     * @return 结果
-     */
-    int deleteAreaBuildingZoningById(Long id);
-
-    /**
-     * 删除建筑区域划分
-     *
-     * @param code 建筑code
-     * @return 结果
-     */
-    int deleteAreaBuildingZoningByBuilding(String code);
-
-    /**
-     * 批量删除建筑区域划分
-     *
-     * @param ids 需要删除的数据主键集合
-     * @return 结果
-     */
-    int deleteAreaBuildingZoningByIds(Long[] ids);
-}

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

@@ -4,6 +4,7 @@ import com.ruoyi.ems.domain.Area;
 import org.apache.ibatis.annotations.Param;
 
 import java.util.List;
+import java.util.Set;
 
 /**
  * 区域对象Mapper接口
@@ -31,35 +32,33 @@ public interface AreaMapper {
     /**
      * 查询区域对象列表
      *
-     * @param admArea 区域对象
+     * @param area 区域对象
      * @return 区域对象集合
      */
-    List<Area> selectAreaList(Area admArea);
+    List<Area> selectAreaList(Area area);
 
     /**
-     * 查询服务区列表(根据下挂设施)
-     *
-     * @param facsCategory    设施类别
-     * @param facsSubCategory 设施子类别
+     * 查询区域对象列表
+     * @param areaCodes 对象编码
+     * @return 区域对象集合
      */
-    List<Area> selectWithFacsCategory(@Param("parentCode") String parentCode,
-        @Param("facsCategory") String facsCategory, @Param("facsSubCategory") String facsSubCategory);
+    List<Area> selectByCodes(@Param("set") Set<String> areaCodes);
 
     /**
      * 新增区域对象
      *
-     * @param admArea 区域对象
+     * @param area 区域对象
      * @return 结果
      */
-    int insertArea(Area admArea);
+    int insertArea(Area area);
 
     /**
      * 修改区域对象
      *
-     * @param admArea 区域对象
+     * @param area 区域对象
      * @return 结果
      */
-    int updateArea(Area admArea);
+    int updateArea(Area area);
 
     /**
      * 删除区域对象

+ 0 - 79
ems-cloud/ems-modules/ems-server/src/main/java/com/ruoyi/ems/mapper/AreaOldMapper.java

@@ -1,79 +0,0 @@
-package com.ruoyi.ems.mapper;
-
-import java.util.List;
-
-import com.ruoyi.ems.domain.AreaOld;
-import org.apache.ibatis.annotations.Param;
-
-/**
- * 服务区Mapper接口
- *
- * @author ruoyi
- * @date 2024-07-09
- */
-public interface AreaOldMapper {
-    /**
-     * 查询服务区
-     *
-     * @param id 服务区主键
-     * @return 服务区
-     */
-    AreaOld selectAreaById(Long id);
-
-    /**
-     * 查询服务区
-     *
-     * @param code 服务区主键
-     * @return 服务区
-     */
-    AreaOld selectAreaByCode(String code);
-
-    /**
-     * 查询服务区列表
-     *
-     * @param admServiceArea 服务区
-     * @return 服务区集合
-     */
-    List<AreaOld> selectAreaList(AreaOld admServiceArea);
-
-    /**
-     * 查询服务区列表(根据下挂设施)
-     *
-     * @param facsCategory    设施类别
-     * @param facsSubCategory 设施子类别
-     */
-    List<AreaOld> selectWithFacsCategory(@Param("facsCategory") String facsCategory,
-        @Param("facsSubCategory") String facsSubCategory);
-
-    /**
-     * 新增服务区
-     *
-     * @param admServiceArea 服务区
-     * @return 结果
-     */
-    int insertArea(AreaOld admServiceArea);
-
-    /**
-     * 修改服务区
-     *
-     * @param admServiceArea 服务区
-     * @return 结果
-     */
-    int updateArea(AreaOld admServiceArea);
-
-    /**
-     * 删除服务区
-     *
-     * @param id 服务区主键
-     * @return 结果
-     */
-    int deleteAreaById(Long id);
-
-    /**
-     * 批量删除服务区
-     *
-     * @param ids 需要删除的数据主键集合
-     * @return 结果
-     */
-    int deleteAreaByIds(Long[] ids);
-}

+ 0 - 2
ems-cloud/ems-modules/ems-server/src/main/java/com/ruoyi/ems/mapper/EmsDeviceMapper.java

@@ -103,8 +103,6 @@ public interface EmsDeviceMapper {
      */
     int deleteEmsDeviceByIds(Long[] ids);
 
-    String selectDevicePath(@Param("locationType") String locationType, @Param("locationRef") String locationRef);
-
     List<Map<String, Object>> cntDeviceStatus(@Param("areaCode") String areaCode);
 
     List<Map<String, Object>> calcDeviceOnlineSummary(@Param("areaCode") String areaCode);

+ 1 - 2
ems-cloud/ems-modules/ems-server/src/main/java/com/ruoyi/ems/mapper/MeterDeviceMapper.java

@@ -29,8 +29,7 @@ public interface MeterDeviceMapper {
      */
     MeterDevice selectMeterDeviceByCode(@Param("areaCode") String areaCode, @Param("deviceCode") String deviceCode);
 
-    MeterDevice selectMeterDeviceByObj(@Param("objType") int objType, @Param("objSubType") int objSubType,
-        @Param("objCode") String objCode, @Param("meterCls") int meterCls);
+    MeterDevice selectMeterDeviceByObj(@Param("objType") int objType, @Param("objCode") String objCode, @Param("meterCls") int meterCls);
 
     /**
      * 查询计量设备列表

+ 1 - 25
ems-cloud/ems-modules/ems-server/src/main/java/com/ruoyi/ems/model/QueryChargingBill.java

@@ -29,11 +29,6 @@ public class QueryChargingBill {
     private String areaPath;
 
     /**
-     * 区域层级
-     */
-    private String tier;
-
-    /**
      * 计量类型 45:电,70:水
      */
     private Integer meterCls;
@@ -56,14 +51,6 @@ public class QueryChargingBill {
         this.areaPath = areaPath;
     }
 
-    public String getTier() {
-        return tier;
-    }
-
-    public void setTier(String tier) {
-        this.tier = tier;
-    }
-
     public Integer getMeterCls() {
         return meterCls;
     }
@@ -94,17 +81,6 @@ public class QueryChargingBill {
 
     public String getObjArea() {
         String[] pathArray = StringUtils.split(areaPath, "/");
-
-        if (AreaTier.Area.name().equals(this.tier)) {
-            return pathArray[0];
-        }
-        else if (AreaTier.Building.name().equals(this.tier)) {
-            return pathArray[1];
-        }
-        else if (AreaTier.Zoning.name().equals(this.tier)) {
-            return pathArray[2];
-        }
-
-        return null;
+        return pathArray[pathArray.length -1];
     }
 }

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

@@ -1,86 +0,0 @@
-package com.ruoyi.ems.service;
-
-import com.ruoyi.ems.domain.AreaBuilding;
-
-import java.util.List;
-
-/**
- * 建筑基本信息Service接口
- *
- * @author ruoyi
- * @date 2024-07-09
- */
-@Deprecated
-public interface IAreaBuildingService {
-    /**
-     * 查询建筑基本信息
-     *
-     * @param id 建筑基本信息主键
-     * @return 建筑基本信息
-     */
-    AreaBuilding selectAreaBuildingById(Long id);
-
-    /**
-     * 查询建筑基本信息
-     *
-     * @param code 建筑基本信息主键
-     * @return 建筑基本信息
-     */
-    AreaBuilding selectAreaBuildingByCode(String code);
-
-    /**
-     * 查询建筑基本信息列表
-     *
-     * @param areaBuilding 建筑基本信息
-     * @return 建筑基本信息集合
-     */
-    List<AreaBuilding> selectAreaBuildingList(AreaBuilding areaBuilding);
-
-    /**
-     * 查询区域下的建筑
-     *
-     * @param areaCode 区域编码
-     * @return 建筑列表
-     */
-    List<AreaBuilding> selectBuildingByAreaCode(String areaCode);
-
-    /**
-     * 新增建筑基本信息
-     *
-     * @param areaBuilding 建筑基本信息
-     * @return 结果
-     */
-    int insertAreaBuilding(AreaBuilding areaBuilding);
-
-    /**
-     * 修改建筑基本信息
-     *
-     * @param areaBuilding 建筑基本信息
-     * @return 结果
-     */
-    int updateAreaBuilding(AreaBuilding areaBuilding);
-
-    /**
-     * 批量删除建筑基本信息
-     *
-     * @param ids 需要删除的建筑基本信息主键集合
-     * @return 结果
-     */
-    int deleteAreaBuildingByIds(Long[] ids);
-
-    /**
-     * 删除建筑基本信息信息
-     *
-     * @param id 建筑基本信息主键
-     * @return 结果
-     */
-    int deleteAreaBuildingById(Long id);
-
-    /**
-     * 删除建筑基本信息信息
-     *
-     * @param areaBuilding 建筑基本信息对象
-     * @return 结果
-     */
-    int deleteAreaBuilding(AreaBuilding areaBuilding);
-}

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

@@ -1,95 +0,0 @@
-package com.ruoyi.ems.service;
-
-import java.util.List;
-import java.util.Set;
-
-import com.ruoyi.ems.domain.AreaBuildingZoning;
-
-/**
- * 建筑区域划分Service接口
- *
- * @author ruoyi
- * @date 2024-07-09
- */
-@Deprecated
-public interface IAreaBuildingZoningService {
-    /**
-     * 查询建筑区域划分
-     *
-     * @param id 建筑区域划分主键
-     * @return 建筑区域划分
-     */
-    AreaBuildingZoning selectAreaBuildingZoningById(Long id);
-
-    /**
-     * 查询建筑区域划分
-     *
-     * @param code 建筑区域划分code
-     * @return 建筑区域划分
-     */
-    AreaBuildingZoning selectAreaBuildingZoningByCode(String code);
-
-    /**
-     * 查询建筑区域划分
-     *
-     * @param codes 建筑区域划分code list
-     * @return 建筑区域划分
-     */
-    List<AreaBuildingZoning> selectByCodes(Set<String> codes);
-
-    /**
-     * 查询建筑区域划分列表
-     *
-     * @param areaBuildingZoning 建筑区域划分
-     * @return 建筑区域划分集合
-     */
-    List<AreaBuildingZoning> selectAreaBuildingZoningList(AreaBuildingZoning areaBuildingZoning);
-
-    /**
-     * 查询建筑区域下的分区
-     *
-     * @param buildingCode 建筑code集合
-     * @return 建筑区域划分集合
-     */
-    List<AreaBuildingZoning> selectZoningByBuilding(String buildingCode);
-
-    /**
-     * 查询建筑区域下的分区
-     *
-     * @param buildingCodes 建筑code集合
-     * @return 建筑区域划分集合
-     */
-    List<AreaBuildingZoning> selectZoningByBuildings(List<String> buildingCodes);
-
-    /**
-     * 新增建筑区域划分
-     *
-     * @param areaBuildingZoning 建筑区域划分
-     * @return 结果
-     */
-    int insertAreaBuildingZoning(AreaBuildingZoning areaBuildingZoning);
-
-    /**
-     * 修改建筑区域划分
-     *
-     * @param areaBuildingZoning 建筑区域划分
-     * @return 结果
-     */
-    int updateAreaBuildingZoning(AreaBuildingZoning areaBuildingZoning);
-
-    /**
-     * 批量删除建筑区域划分
-     *
-     * @param ids 需要删除的建筑区域划分主键集合
-     * @return 结果
-     */
-    int deleteAreaBuildingZoningByIds(Long[] ids);
-
-    /**
-     * 删除建筑区域划分信息
-     *
-     * @param id 建筑区域划分主键
-     * @return 结果
-     */
-    int deleteAreaBuildingZoningById(Long id);
-}

+ 0 - 105
ems-cloud/ems-modules/ems-server/src/main/java/com/ruoyi/ems/service/IAreaOldService.java

@@ -1,105 +0,0 @@
-package com.ruoyi.ems.service;
-
-import java.util.List;
-
-import com.ruoyi.ems.domain.AreaOld;
-import com.ruoyi.ems.model.TreeEntity;
-
-/**
- * 服务区Service接口
- *
- * @author ruoyi
- * @date 2024-07-09
- */
-@Deprecated
-public interface IAreaOldService {
-    /**
-     * 查询服务区
-     *
-     * @param id 服务区主键
-     * @return 服务区
-     */
-    AreaOld selectAreaById(Long id);
-
-    /**
-     * 查询服务区
-     *
-     * @param code 区域编码
-     * @return 服务区
-     */
-    AreaOld selectAreaByCode(String code);
-
-    /**
-     * 查询服务区列表
-     *
-     * @param area 服务区
-     * @return 服务区集合
-     */
-    List<AreaOld> selectAreaList(AreaOld area);
-
-    /**
-     * 查询服务区列表(根据下挂设施)
-     *
-     * @param facsCategory    设施类型
-     * @param facsSubCategory 设施子类型
-     */
-    List<AreaOld> selectWithFacsCategory(String facsCategory, String facsSubCategory);
-
-    /**
-     * 查询区域位置树
-     *
-     * @param tier 层级
-     * @return 区域位置树
-     */
-    List<TreeEntity> selectAreaTreeList(String tier);
-
-    /**
-     * 查询区域位置树byCode
-     *
-     * @param tier 层级
-     * @param code 编码
-     * @return 区域位置树
-     */
-    List<TreeEntity> selectAreaTreeByCode(String tier, String code);
-
-    /**
-     * 查询区域位置树by标签
-     *
-     * @param tier 层级
-     * @param code 编码
-     * @return 区域位置树
-     */
-    List<TreeEntity> selectAreaTreeByTag(String tier, String code);
-
-    /**
-     * 新增服务区
-     *
-     * @param area 服务区
-     * @return 结果
-     */
-    int insertArea(AreaOld area);
-
-    /**
-     * 修改服务区
-     *
-     * @param area 服务区
-     * @return 结果
-     */
-    int updateArea(AreaOld area);
-
-    /**
-     * 批量删除服务区
-     *
-     * @param ids 需要删除的服务区主键集合
-     * @return 结果
-     */
-    int deleteAreaByIds(Long[] ids);
-
-    /**
-     * 删除服务区信息
-     *
-     * @param id 服务区主键
-     * @return 结果
-     */
-    int deleteAreaById(Long id);
-}

+ 8 - 10
ems-cloud/ems-modules/ems-server/src/main/java/com/ruoyi/ems/service/IAreaService.java

@@ -1,9 +1,8 @@
 package com.ruoyi.ems.service;
 
-import java.util.List;
-
 import com.ruoyi.ems.domain.Area;
-import com.ruoyi.ems.model.TreeEntity;
+
+import java.util.List;
 
 /**
  * 区域对象Service接口
@@ -21,22 +20,21 @@ public interface IAreaService {
     Area selectAreaById(Long id);
 
     /**
-     * 查询服务区列表(根据下挂设施)
+     * 查询区域对象
      *
-     * @param parentCode      上级区域
-     * @param facsCategory    设施类型
-     * @param facsSubCategory 设施子类型
+     * @param areaCode 区域对象编码
+     * @return 区域对象
      */
-    List<Area> selectWithFacsCategory(String parentCode, String facsCategory, String facsSubCategory);
+    Area selectAreaByCode(String areaCode);
 
     /**
      * 查询区域位置树
      *
-     * @param recursion 是否递归
+     * @param recursion  是否递归
      * @param parentCode 上级代码
      * @return 区域位置树
      */
-    List<Area> selectAreaTree(boolean recursion, String parentCode);
+    List<Area> selectAreaTree(String parentCode, boolean recursion);
 
     /**
      * 查询区域对象列表

+ 7 - 28
ems-cloud/ems-modules/ems-server/src/main/java/com/ruoyi/ems/service/impl/AdmOpAlarmServiceImpl.java

@@ -3,13 +3,11 @@ package com.ruoyi.ems.service.impl;
 import com.ruoyi.common.core.enums.AlarmObjType;
 import com.ruoyi.common.core.utils.DateTimeUtil;
 import com.ruoyi.ems.domain.AdmOpAlarm;
-import com.ruoyi.ems.domain.AreaOld;
-import com.ruoyi.ems.domain.AreaBuildingZoning;
+import com.ruoyi.ems.domain.Area;
 import com.ruoyi.ems.domain.EmsDevice;
 import com.ruoyi.ems.domain.EmsFacs;
 import com.ruoyi.ems.mapper.AdmOpAlarmMapper;
-import com.ruoyi.ems.mapper.AreaBuildingZoningMapper;
-import com.ruoyi.ems.mapper.AreaOldMapper;
+import com.ruoyi.ems.mapper.AreaMapper;
 import com.ruoyi.ems.mapper.EmsDeviceMapper;
 import com.ruoyi.ems.mapper.EmsFacsMapper;
 import com.ruoyi.ems.service.IAdmOpAlarmService;
@@ -33,10 +31,7 @@ public class AdmOpAlarmServiceImpl implements IAdmOpAlarmService {
     private AdmOpAlarmMapper admOpAlarmMapper;
 
     @Autowired
-    private AreaOldMapper areaMapper;
-
-    @Autowired
-    private AreaBuildingZoningMapper areaBuildingZoningMapper;
+    private AreaMapper areaMapper;
 
     @Autowired
     private EmsFacsMapper emsFacsMapper;
@@ -155,32 +150,16 @@ public class AdmOpAlarmServiceImpl implements IAdmOpAlarmService {
 
     private String getObjInfo(Integer objType, String objCode) {
         if (AlarmObjType.AREA.getCode().equals(objType)) {
-            AreaOld area = areaMapper.selectAreaByCode(objCode);
-            if (ObjectUtils.isEmpty(area)) {
-                return StringUtils.EMPTY;
-            }
-            return area.getAreaName();
-        }
-        if (AlarmObjType.ZONE.getCode().equals(objType)) {
-            AreaBuildingZoning areaBuildingZoning = areaBuildingZoningMapper.selectAreaBuildingZoningByCode(objCode);
-            if (ObjectUtils.isEmpty(areaBuildingZoning)) {
-                return StringUtils.EMPTY;
-            }
-            return areaBuildingZoning.getZoningName();
+            Area area = areaMapper.selectAreaByCode(objCode);
+            return ObjectUtils.isEmpty(area) ? StringUtils.EMPTY : area.getAreaName();
         }
         if (AlarmObjType.FACS.getCode().equals(objType)) {
             EmsFacs emsFacs = emsFacsMapper.selectEmsFacsByCode(objCode);
-            if (ObjectUtils.isEmpty(emsFacs)) {
-                return StringUtils.EMPTY;
-            }
-            return emsFacs.getFacsName();
+            return ObjectUtils.isEmpty(emsFacs) ? StringUtils.EMPTY : emsFacs.getFacsName();
         }
         if (AlarmObjType.DEVICE.getCode().equals(objType)) {
             EmsDevice emsDevice = emsDeviceMapper.selectDeviceByCode(objCode);
-            if (ObjectUtils.isEmpty(emsDevice)) {
-                return StringUtils.EMPTY;
-            }
-            return emsDevice.getDeviceName();
+            return ObjectUtils.isEmpty(emsDevice) ? StringUtils.EMPTY : emsDevice.getDeviceName();
         }
 
         return StringUtils.EMPTY;

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

@@ -11,6 +11,7 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
 import java.util.ArrayList;
+import java.util.HashSet;
 import java.util.List;
 import java.util.Map;
 import java.util.stream.Collectors;
@@ -42,7 +43,7 @@ public class AreaAttrServiceImpl implements IAreaAttrService {
 
     @Override
     public List<AreaAttr> selectAreaAttrList(List<String> areaCodes) {
-        List<AreaAttr> list = areaAttrMapper.selectAreaAttrList(areaCodes);
+        List<AreaAttr> list = areaAttrMapper.selectAreaAttrList(new HashSet<>(areaCodes));
         fillExtBatch(list);
         return list;
     }

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

@@ -1,134 +0,0 @@
-package com.ruoyi.ems.service.impl;
-
-import com.ruoyi.ems.domain.AreaBuilding;
-import com.ruoyi.ems.mapper.AreaBuildingMapper;
-import com.ruoyi.ems.mapper.AreaBuildingZoningMapper;
-import com.ruoyi.ems.service.IAreaBuildingService;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Service;
-
-import java.util.List;
-
-/**
- * 建筑基本信息Service业务层处理
- *
- * @author ruoyi
- * @date 2024-07-09
- */
-@Deprecated
-@Service
-public class AreaBuildingServiceImpl implements IAreaBuildingService {
-    @Autowired
-    private AreaBuildingMapper areaBuildingMapper;
-
-    @Autowired
-    private AreaBuildingZoningMapper areaBuildingZoningMapper;
-
-    /**
-     * 查询建筑基本信息
-     *
-     * @param id 建筑基本信息主键
-     * @return 建筑基本信息
-     */
-    @Override
-    public AreaBuilding selectAreaBuildingById(Long id) {
-        return areaBuildingMapper.selectAreaBuildingById(id);
-    }
-
-    /**
-     * 查询建筑基本信息
-     *
-     * @param code 建筑基本信息code
-     * @return 建筑基本信息
-     */
-    @Override
-    public AreaBuilding selectAreaBuildingByCode(String code) {
-        return areaBuildingMapper.selectAreaBuildingByCode(code);
-    }
-
-    /**
-     * 查询建筑基本信息列表
-     *
-     * @param areaBuilding 建筑基本信息
-     * @return 建筑基本信息
-     */
-    @Override
-    public List<AreaBuilding> selectAreaBuildingList(AreaBuilding areaBuilding) {
-        return areaBuildingMapper.selectAreaBuildingList(areaBuilding);
-    }
-
-    @Override
-    public List<AreaBuilding> selectBuildingByAreaCode(String areaCode) {
-        AreaBuilding param = new AreaBuilding();
-        param.setAreaCode(areaCode);
-        return areaBuildingMapper.selectAreaBuildingList(param);
-    }
-
-    /**
-     * 新增建筑基本信息
-     *
-     * @param areaBuilding 建筑基本信息
-     * @return 结果
-     */
-    @Override
-    public int insertAreaBuilding(AreaBuilding areaBuilding) {
-        return areaBuildingMapper.insertAreaBuilding(areaBuilding);
-    }
-
-    /**
-     * 修改建筑基本信息
-     *
-     * @param areaBuilding 建筑基本信息
-     * @return 结果
-     */
-    @Override
-    public int updateAreaBuilding(AreaBuilding areaBuilding) {
-        return areaBuildingMapper.updateAreaBuilding(areaBuilding);
-    }
-
-    /**
-     * 批量删除建筑基本信息
-     *
-     * @param ids 需要删除的建筑基本信息主键
-     * @return 结果
-     */
-    @Override
-    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) {
-        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) {
-        areaBuildingZoningMapper.deleteAreaBuildingZoningByBuilding(bldgCode);
-    }
-}

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

@@ -1,215 +0,0 @@
-package com.ruoyi.ems.service.impl;
-
-import com.ruoyi.ems.domain.AreaBuilding;
-import com.ruoyi.ems.domain.AreaBuildingZoning;
-import com.ruoyi.ems.domain.ObjTagRel;
-import com.ruoyi.ems.mapper.AreaBuildingMapper;
-import com.ruoyi.ems.mapper.AreaBuildingZoningMapper;
-import com.ruoyi.ems.service.IAreaBuildingZoningService;
-import com.ruoyi.ems.service.IObjTagRelService;
-import org.apache.commons.collections4.CollectionUtils;
-import org.apache.commons.lang3.StringUtils;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Service;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.function.Function;
-import java.util.stream.Collectors;
-
-/**
- * 建筑区域划分Service业务层处理
- *
- * @author ruoyi
- * @date 2024-07-09
- */
-@Deprecated
-@Service
-public class AreaBuildingZoningServiceImpl implements IAreaBuildingZoningService {
-    @Autowired
-    private AreaBuildingZoningMapper areaBuildingZoningMapper;
-
-    @Autowired
-    private AreaBuildingMapper areaBuildingMapper;
-
-    @Autowired
-    private IObjTagRelService tagRelService;
-
-    /**
-     * 查询建筑区域划分
-     *
-     * @param id 建筑区域划分主键
-     * @return 建筑区域划分
-     */
-    @Override
-    public AreaBuildingZoning selectAreaBuildingZoningById(Long id) {
-        AreaBuildingZoning zoning = areaBuildingZoningMapper.selectAreaBuildingZoningById(id);
-        zoning.setTagCodeList(Arrays.asList(StringUtils.split(zoning.getTagCodes(), ",")));
-        return zoning;
-    }
-
-    /**
-     * 查询建筑区域划分
-     *
-     * @param code 建筑区域划分主键
-     * @return 建筑区域划分
-     */
-    @Override
-    public AreaBuildingZoning selectAreaBuildingZoningByCode(String code) {
-        return areaBuildingZoningMapper.selectAreaBuildingZoningByCode(code);
-    }
-
-    @Override
-    public List<AreaBuildingZoning> selectByCodes(Set<String> codes) {
-        return areaBuildingZoningMapper.selectByCodes(codes);
-    }
-
-    /**
-     * 查询建筑区域划分列表
-     *
-     * @param areaBuildingZoning 建筑区域划分
-     * @return 建筑区域划分
-     */
-    @Override
-    public List<AreaBuildingZoning> selectAreaBuildingZoningList(AreaBuildingZoning areaBuildingZoning) {
-        List<AreaBuildingZoning> list = areaBuildingZoningMapper.selectAreaBuildingZoningList(areaBuildingZoning);
-        fillFields(list);
-        return list;
-    }
-
-    @Override
-    public List<AreaBuildingZoning> selectZoningByBuilding(String buildingCode) {
-        AreaBuildingZoning zParam = new AreaBuildingZoning();
-        zParam.setBldgCode(buildingCode);
-        List<AreaBuildingZoning> list = areaBuildingZoningMapper.selectAreaBuildingZoningList(zParam);
-        fillFields(list);
-        return list;
-    }
-
-    @Override
-    public List<AreaBuildingZoning> selectZoningByBuildings(List<String> buildingCodes) {
-        List<AreaBuildingZoning> retList = new ArrayList<>();
-
-        for (String buildCode : buildingCodes) {
-            AreaBuildingZoning zParam = new AreaBuildingZoning();
-            zParam.setBldgCode(buildCode);
-            List<AreaBuildingZoning> list = areaBuildingZoningMapper.selectAreaBuildingZoningList(zParam);
-            fillFields(list);
-
-            retList.addAll(list);
-        }
-
-        return retList;
-    }
-
-    /**
-     * 新增建筑区域划分
-     *
-     * @param areaBuildingZoning 建筑区域划分
-     * @return 结果
-     */
-    @Override
-    public int insertAreaBuildingZoning(AreaBuildingZoning areaBuildingZoning) {
-        int count = areaBuildingZoningMapper.insertAreaBuildingZoning(areaBuildingZoning);
-
-        if (CollectionUtils.isNotEmpty(areaBuildingZoning.getTagCodeList())) {
-            List<String> tagArray = areaBuildingZoning.getTagCodeList();
-            List<ObjTagRel> tagRelList = new ArrayList<>();
-
-            for (String tagCode : tagArray) {
-                ObjTagRel tagRel = new ObjTagRel(3, tagCode, areaBuildingZoning.getZoningCode());
-                tagRelList.add(tagRel);
-            }
-
-            tagRelService.insertBatch(tagRelList);
-        }
-
-        return count;
-    }
-
-    /**
-     * 修改建筑区域划分
-     *
-     * @param areaBuildingZoning 建筑区域划分
-     * @return 结果
-     */
-    @Override
-    public int updateAreaBuildingZoning(AreaBuildingZoning areaBuildingZoning) {
-        int count = areaBuildingZoningMapper.updateAreaBuildingZoning(areaBuildingZoning);
-        if (CollectionUtils.isNotEmpty(areaBuildingZoning.getTagCodeList())) {
-            List<String> tagArray = areaBuildingZoning.getTagCodeList();
-            List<ObjTagRel> tagRelList = new ArrayList<>();
-
-            for (String tagCode : tagArray) {
-                ObjTagRel tagRel = new ObjTagRel(3, tagCode, areaBuildingZoning.getZoningCode());
-                tagRelList.add(tagRel);
-            }
-
-            tagRelService.deleteByObjCode(3, areaBuildingZoning.getZoningCode());
-            tagRelService.insertBatch(tagRelList);
-        }
-        else {
-            tagRelService.deleteByObjCode(3, areaBuildingZoning.getZoningCode());
-        }
-
-        return count;
-    }
-
-    /**
-     * 批量删除建筑区域划分
-     *
-     * @param ids 需要删除的建筑区域划分主键
-     * @return 结果
-     */
-    @Override
-    public int deleteAreaBuildingZoningByIds(Long[] ids) {
-        for (Long id : ids) {
-            AreaBuildingZoning zoning = areaBuildingZoningMapper.selectAreaBuildingZoningById(id);
-            if (null != zoning) {
-                tagRelService.deleteByObjCode(3, zoning.getZoningCode());
-            }
-        }
-
-        return areaBuildingZoningMapper.deleteAreaBuildingZoningByIds(ids);
-    }
-
-    /**
-     * 删除建筑区域划分信息
-     *
-     * @param id 建筑区域划分主键
-     * @return 结果
-     */
-    @Override
-    public int deleteAreaBuildingZoningById(Long id) {
-        AreaBuildingZoning zoning = areaBuildingZoningMapper.selectAreaBuildingZoningById(id);
-
-        if (null != zoning) {
-            tagRelService.deleteByObjCode(3, zoning.getZoningCode());
-        }
-
-        return areaBuildingZoningMapper.deleteAreaBuildingZoningById(id);
-    }
-
-    private void fillFields(List<AreaBuildingZoning> list) {
-        if (CollectionUtils.isNotEmpty(list)) {
-            List<AreaBuilding> areaBuildings = areaBuildingMapper.selectAreaBuildingList(new AreaBuilding());
-            Map<String, AreaBuilding> areaBuildingsMap = areaBuildings.stream()
-                .collect(Collectors.toMap(AreaBuilding::getBldgCode, Function.identity()));
-
-            for (AreaBuildingZoning zoning : list) {
-                String areaName = null;
-                String buildingName = null;
-
-                AreaBuilding areaBuilding = areaBuildingsMap.get(zoning.getBldgCode());
-                areaName = areaBuilding != null ? areaBuilding.getAreaShortName() + "/" : "*/";
-                buildingName = zoning.getBldgName() != null ? zoning.getBldgName() : "*";
-
-                zoning.setAreaPath(areaName + buildingName);
-                zoning.setTagCodeList(Arrays.asList(StringUtils.split(zoning.getTagCodes(), ",")));
-            }
-        }
-    }
-}

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

@@ -1,282 +0,0 @@
-package com.ruoyi.ems.service.impl;
-
-import com.alibaba.druid.util.StringUtils;
-import com.ruoyi.common.core.enums.AreaTier;
-import com.ruoyi.ems.domain.AreaOld;
-import com.ruoyi.ems.domain.AreaBuilding;
-import com.ruoyi.ems.domain.AreaBuildingZoning;
-import com.ruoyi.ems.model.TreeEntity;
-import com.ruoyi.ems.mapper.AreaOldMapper;
-import com.ruoyi.ems.service.IAreaBuildingService;
-import com.ruoyi.ems.service.IAreaBuildingZoningService;
-import com.ruoyi.ems.service.IAreaOldService;
-import org.apache.commons.collections4.CollectionUtils;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Service;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-import java.util.stream.Collectors;
-
-/**
- * 服务区Service业务层处理
- *
- * @author ruoyi
- * @date 2024-07-09
- */
-@Deprecated
-@Service
-public class AreaOldServiceImpl implements IAreaOldService {
-    @Autowired
-    private AreaOldMapper areaMapper;
-
-    @Autowired
-    private IAreaBuildingService buildingService;
-
-    @Autowired
-    private IAreaBuildingZoningService zoningService;
-
-    /**
-     * 查询服务区
-     *
-     * @param id 服务区主键
-     * @return 服务区
-     */
-    @Override
-    public AreaOld selectAreaById(Long id) {
-        return areaMapper.selectAreaById(id);
-    }
-
-    /**
-     * 查询服务区
-     *
-     * @param code 服务区代码
-     * @return 服务区
-     */
-    @Override
-    public AreaOld selectAreaByCode(String code) {
-        return areaMapper.selectAreaByCode(code);
-    }
-
-    /**
-     * 查询服务区列表
-     *
-     * @param area 服务区
-     * @return 服务区
-     */
-    @Override
-    public List<AreaOld> selectAreaList(AreaOld area) {
-        return areaMapper.selectAreaList(area);
-    }
-
-    /**
-     * 查询服务区列表(根据下挂设施)
-     *
-     * @param facsCategory    设施类别
-     * @param facsSubCategory 设施子类别
-     */
-    @Override
-    public List<AreaOld> selectWithFacsCategory(String facsCategory, String facsSubCategory) {
-        return areaMapper.selectWithFacsCategory(facsCategory, facsSubCategory);
-    }
-
-    /**
-     * 新增服务区
-     *
-     * @param area 服务区
-     * @return 结果
-     */
-    @Override
-    public int insertArea(AreaOld area) {
-        return areaMapper.insertArea(area);
-    }
-
-    /**
-     * 修改服务区
-     *
-     * @param area 服务区
-     * @return 结果
-     */
-    @Override
-    public int updateArea(AreaOld area) {
-        return areaMapper.updateArea(area);
-    }
-
-    /**
-     * 批量删除服务区
-     *
-     * @param ids 需要删除的服务区主键
-     * @return 结果
-     */
-    @Override
-    public int deleteAreaByIds(Long[] ids) {
-        for (Long id : ids) {
-            deleteRel(id);
-        }
-
-        return areaMapper.deleteAreaByIds(ids);
-    }
-
-    /**
-     * 删除服务区信息
-     *
-     * @param id 服务区主键
-     * @return 结果
-     */
-    @Override
-    public int deleteAreaById(Long id) {
-        deleteRel(id);
-        return areaMapper.deleteAreaById(id);
-    }
-
-    @Override
-    public List<TreeEntity> selectAreaTreeList(String tier) {
-        List<TreeEntity> entities = null;
-
-//        if (StringUtils.equals(AreaTier.Area.name(), tier)) {
-//            List<AreaOld> areas = areaMapper.selectAreaList(new AreaOld());
-//            entities = areas.stream().map(TreeEntity::new).collect(Collectors.toList());
-//        }
-//        else if (StringUtils.equals(AreaTier.Building.name(), tier)) {
-//            List<AreaOld> areas = areaMapper.selectAreaList(new AreaOld());
-//            entities = areas.stream().map(TreeEntity::new).collect(Collectors.toList());
-//            entities.forEach(area -> area.setChildren(getAreaBuilding(area.getId())));
-//        }
-//        else if (StringUtils.equals(AreaTier.Zoning.name(), tier)) {
-//            List<AreaOld> areas = areaMapper.selectAreaList(new AreaOld());
-//            entities = areas.stream().map(TreeEntity::new).collect(Collectors.toList());
-//            entities.forEach(area -> {
-//                List<TreeEntity> buildings = getAreaBuilding(area.getId());
-//                buildings.forEach(building -> building.setChildren(getBuildingZoning(building.getId(), null)));
-//                area.setChildren(buildings);
-//            });
-//        }
-
-        return entities;
-    }
-
-    @Override
-    public List<TreeEntity> selectAreaTreeByCode(String tier, String code) {
-        List<TreeEntity> retList = new ArrayList<>();
-
-//        if (StringUtils.equals(AreaTier.Area.name(), tier)) {
-//            AreaOld area = areaMapper.selectAreaByCode(code);
-//
-//            if (null != area) {
-//                TreeEntity entity = new TreeEntity(area);
-//                entity.setChildren(getAreaBuilding(code));
-//                entity.getChildren().forEach(building -> {
-//                    building.setChildren(getBuildingZoning(building.getId(), null));
-//                });
-//
-//                retList.add(entity);
-//            }
-//        }
-//        else if (StringUtils.equals(AreaTier.Building.name(), tier)) {
-//            AreaBuilding building = buildingService.selectAreaBuildingByCode(code);
-//
-//            if (null != building) {
-//                TreeEntity entity = new TreeEntity(building);
-//                entity.setChildren(getBuildingZoning(building.getBldgCode(), null));
-//                retList.add(entity);
-//            }
-//        }
-//        else if (StringUtils.equals(AreaTier.Zoning.name(), tier)) {
-//            AreaBuildingZoning zoning = zoningService.selectAreaBuildingZoningByCode(code);
-//
-//            if (null != zoning) {
-//                TreeEntity entity = new TreeEntity(zoning);
-//                retList.add(entity);
-//            }
-//        }
-
-        return retList;
-    }
-
-    @Override
-    public List<TreeEntity> selectAreaTreeByTag(String tier, String tagCode) {
-        List<TreeEntity> retList = new ArrayList<>();
-        List<String> tagCodes = Arrays.asList(tagCode);
-
-//        if (StringUtils.equals(AreaTier.Area.name(), tier)) {
-//            List<AreaOld> areas = areaMapper.selectAreaList(new AreaOld());
-//            List<TreeEntity> entities = areas.stream().map(TreeEntity::new).collect(Collectors.toList());
-//
-//            for (TreeEntity area : entities) {
-//                List<TreeEntity> dbBuildings = getAreaBuilding(area.getId());
-//                boolean flag = false;
-//
-//                for (TreeEntity building : dbBuildings) {
-//                    List<TreeEntity> zonings = getBuildingZoning(building.getId(), tagCodes);
-//
-//                    if (CollectionUtils.isNotEmpty(zonings)) {
-//                        flag = true;
-//                        break;
-//                    }
-//                }
-//
-//                if (flag) {
-//                    retList.add(area);
-//                }
-//            }
-//        }
-//        else if (StringUtils.equals(AreaTier.Zoning.name(), tier)) {
-//            List<AreaOld> areas = areaMapper.selectAreaList(new AreaOld());
-//            List<TreeEntity> entities = areas.stream().map(TreeEntity::new).collect(Collectors.toList());
-//
-//            for (TreeEntity area : entities) {
-//                List<TreeEntity> dbBuildings = getAreaBuilding(area.getId());
-//                List<TreeEntity> buildings = new ArrayList<>();
-//
-//                for (TreeEntity building : dbBuildings) {
-//                    List<TreeEntity> zonings = getBuildingZoning(building.getId(), tagCodes);
-//
-//                    if (CollectionUtils.isNotEmpty(zonings)) {
-//                        building.setChildren(zonings);
-//                        buildings.add(building);
-//                    }
-//                }
-//
-//                if (CollectionUtils.isNotEmpty(buildings)) {
-//                    area.setChildren(buildings);
-//                    retList.add(area);
-//                }
-//            }
-//        }
-
-        return retList;
-    }
-
-    private void deleteRel(long id) {
-        AreaOld 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) {
-                buildingService.deleteAreaBuilding(building);
-            }
-        }
-    }
-
-    private List<TreeEntity> getAreaBuilding(String areaCode) {
-//        AreaBuilding param = new AreaBuilding();
-//        param.setAreaCode(areaCode);
-//        List<AreaBuilding> areaBuildings = buildingService.selectAreaBuildingList(param);
-//        return areaBuildings.stream().map(TreeEntity::new).collect(Collectors.toList());
-        return null;
-    }
-
-    private List<TreeEntity> getBuildingZoning(String buildingCode, List<String> tagCodes) {
-//        AreaBuildingZoning param = new AreaBuildingZoning();
-//        param.setBldgCode(buildingCode);
-//        param.setTagCodeList(tagCodes);
-//        List<AreaBuildingZoning> zonings = zoningService.selectAreaBuildingZoningList(param);
-//        return zonings.stream().map(TreeEntity::new).collect(Collectors.toList());
-        return null;
-    }
-}

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

@@ -49,6 +49,11 @@ public class AreaServiceImpl implements IAreaService {
         return area;
     }
 
+    @Override
+    public Area selectAreaByCode(String areaCode) {
+        return areaMapper.selectAreaByCode(areaCode);
+    }
+
     /**
      * 查询区域对象列表
      *
@@ -81,7 +86,7 @@ public class AreaServiceImpl implements IAreaService {
     }
 
     @Override
-    public List<Area> selectAreaTree(boolean recursion, String parentCode) {
+    public List<Area> selectAreaTree(String parentCode, boolean recursion) {
         List<Area> dbAreas = areaMapper.selectAreaList(new Area());
         Map<String, List<Area>> areaMap = dbAreas.stream()
             .collect(Collectors.groupingBy(Area::getParentCode, Collectors.toList()));
@@ -161,11 +166,6 @@ public class AreaServiceImpl implements IAreaService {
         return areaMapper.deleteAreaById(id);
     }
 
-    @Override
-    public List<Area> selectWithFacsCategory(String parentCode, String facsCategory, String facsSubCategory) {
-        return areaMapper.selectWithFacsCategory(parentCode, facsCategory, facsSubCategory);
-    }
-
     private void fillAncestors(Area area) {
         Area parent = areaMapper.selectAreaByCode(area.getParentCode());
 

+ 38 - 46
ems-cloud/ems-modules/ems-server/src/main/java/com/ruoyi/ems/service/impl/ChargingBillServiceImpl.java

@@ -10,36 +10,33 @@
  */
 package com.ruoyi.ems.service.impl;
 
-import com.ruoyi.common.core.enums.AreaTier;
-import com.ruoyi.common.core.enums.MeterObjSubType;
 import com.ruoyi.common.core.enums.MeterObjTag;
 import com.ruoyi.common.core.enums.MeterObjType;
 import com.ruoyi.common.core.utils.DateUtils;
-import com.ruoyi.common.core.utils.StringUtils;
-import com.ruoyi.ems.domain.AreaOld;
-import com.ruoyi.ems.domain.AreaBuilding;
-import com.ruoyi.ems.domain.AreaBuildingZoning;
+import com.ruoyi.ems.domain.Area;
+import com.ruoyi.ems.domain.AreaAttr;
 import com.ruoyi.ems.domain.ChargingBill;
 import com.ruoyi.ems.domain.CoChargingConfig;
 import com.ruoyi.ems.domain.CoChargingConfigRel;
 import com.ruoyi.ems.domain.MeterDevice;
 import com.ruoyi.ems.domain.MeterReading;
-import com.ruoyi.ems.model.QueryChargingBill;
-import com.ruoyi.ems.model.QueryMeterReading;
+import com.ruoyi.ems.mapper.AreaAttrMapper;
+import com.ruoyi.ems.mapper.AreaMapper;
 import com.ruoyi.ems.mapper.MeterDeviceMapper;
 import com.ruoyi.ems.mapper.MeterReadingMapper;
-import com.ruoyi.ems.service.IAreaBuildingService;
-import com.ruoyi.ems.service.IAreaBuildingZoningService;
-import com.ruoyi.ems.service.IAreaOldService;
+import com.ruoyi.ems.model.QueryChargingBill;
+import com.ruoyi.ems.model.QueryMeterReading;
 import com.ruoyi.ems.service.IChargingBillService;
 import com.ruoyi.ems.service.ICoChargingConfigService;
 import org.apache.commons.collections4.MapUtils;
+import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
 import java.math.BigDecimal;
 import java.math.RoundingMode;
 import java.util.ArrayList;
+import java.util.Arrays;
 import java.util.Date;
 import java.util.HashMap;
 import java.util.HashSet;
@@ -68,13 +65,10 @@ public class ChargingBillServiceImpl implements IChargingBillService {
     private MeterDeviceMapper meterDeviceMapper;
 
     @Autowired
-    private IAreaOldService areaService;
-
-    @Autowired
-    private IAreaBuildingService buildingService;
+    private AreaMapper areaMapper;
 
     @Autowired
-    private IAreaBuildingZoningService zoningService;
+    private AreaAttrMapper areaAttrMapper;
 
     @Autowired
     private ICoChargingConfigService coChargingConfigService;
@@ -87,6 +81,7 @@ public class ChargingBillServiceImpl implements IChargingBillService {
      */
     @Override
     public List<ChargingBill> selectCoChargingBill(QueryChargingBill queryParam) {
+        // TODO 查询计费配置待改造,支持每个区域不同的计费方式,目前只支持园区级统一计费
         // 查询园区内部计费配置
         CoChargingConfig chargingCfg = coChargingConfigService.selectByArea(queryParam.getAreaCode());
 
@@ -184,10 +179,9 @@ public class ChargingBillServiceImpl implements IChargingBillService {
         Map<String, ChargingBill> retMap = null;
 
         // 查询计量设备
-        int objType = MeterObjType.METER_ABZ.getType();
-        int objSubType = MeterObjSubType.getByTier(queryParam.getTier()).getType();
+        int objType = MeterObjType.METER_AREA.getType();
 
-        MeterDevice meterDevice = meterDeviceMapper.selectMeterDeviceByObj(objType, objSubType, queryParam.getObjArea(),
+        MeterDevice meterDevice = meterDeviceMapper.selectMeterDeviceByObj(objType, queryParam.getObjArea(),
             queryParam.getMeterCls());
 
         if (null != meterDevice) {
@@ -365,16 +359,17 @@ public class ChargingBillServiceImpl implements IChargingBillService {
     }
 
     private double sharedPriceByArea(Double sharedPriceSum, String objCode, Set<String> coSet) {
-        List<AreaBuildingZoning> zonings = zoningService.selectByCodes(coSet);
-        Map<String, AreaBuildingZoning> map = zonings.stream()
-            .collect(Collectors.toMap(AreaBuildingZoning::getZoningCode, Function.identity()));
-        AreaBuildingZoning zoning = map.get(objCode);
+        List<AreaAttr> attrObjs = areaAttrMapper.selectAreaAttrList(coSet);
+        Map<String, AreaAttr> map = attrObjs.stream()
+            .collect(Collectors.toMap(AreaAttr::getAreaCode, Function.identity()));
+        AreaAttr attr = map.get(objCode);
 
-        Long areas = sumSharedAreas(zonings);
+        // 计算总面积
+        Long areas = sumSharedAreas(attrObjs);
 
         BigDecimal bd1 = new BigDecimal(sharedPriceSum.toString());
         BigDecimal bd2 = new BigDecimal(areas.toString());
-        BigDecimal bd3 = new BigDecimal(zoning.getBldgLdArea().toString());
+        BigDecimal bd3 = new BigDecimal(attr.getUsableArea().toString());
 
         // 计算当前区块面积占总建筑面积的比例
         BigDecimal bl = bd3.divide(bd2, 3, RoundingMode.HALF_UP);
@@ -390,10 +385,10 @@ public class ChargingBillServiceImpl implements IChargingBillService {
         return sum;
     }
 
-    private Long sumSharedAreas(List<AreaBuildingZoning> zonings) {
+    private Long sumSharedAreas(List<AreaAttr> attrObjs) {
         long sum = 0;
-        for (AreaBuildingZoning zo : zonings) {
-            sum += zo.getBldgLdArea();
+        for (AreaAttr attr : attrObjs) {
+            sum += attr.getUsableArea();
         }
         return sum;
     }
@@ -463,27 +458,24 @@ public class ChargingBillServiceImpl implements IChargingBillService {
     }
 
     private String getObjName(QueryChargingBill queryParam) {
-        String objName = "未知";
+        String areaPath = queryParam.getAreaPath();
+        List<String> areaCodes = Arrays.asList(StringUtils.split(areaPath, "/"));
+        List<Area> areaList = areaMapper.selectByCodes(new HashSet<>(areaCodes));
+        Map<String, Area> map = areaList.stream().collect(Collectors.toMap(Area::getAreaCode, Function.identity()));
 
-        if (StringUtils.equals(AreaTier.Area.name(), queryParam.getTier())) {
-            AreaOld area = areaService.selectAreaByCode(queryParam.getObjArea());
-            objName = area != null ? area.getShortName() : "未知";
-        }
-        else if (StringUtils.equals(AreaTier.Building.name(), queryParam.getTier())) {
-            AreaBuilding building = buildingService.selectAreaBuildingByCode(queryParam.getObjArea());
-            objName = (building != null) ? (building.getAreaShortName() + "/" + building.getBldgName()) : "未知";
-        }
-        else if (StringUtils.equals(AreaTier.Zoning.name(), queryParam.getTier())) {
-            AreaBuildingZoning zoning = zoningService.selectAreaBuildingZoningByCode(queryParam.getObjArea());
-
-            if (null != zoning) {
-                AreaBuilding building = buildingService.selectAreaBuildingByCode(zoning.getBldgCode());
-                objName = (building != null) ?
-                    (building.getAreaShortName() + "/" + building.getBldgName() + "/" + zoning.getZoningName()) :
-                    "未知";
+        List<String> names = new ArrayList<>();
+
+        for (String areaCode : areaCodes) {
+            Area area = map.get(areaCode);
+
+            if (null != area) {
+                names.add(StringUtils.isNotBlank(area.getShortName()) ? area.getShortName() : area.getAreaName());
+            }
+            else {
+                names.add("未知");
             }
         }
 
-        return objName;
+        return StringUtils.join(names, "/");
     }
 }

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

@@ -1,18 +1,16 @@
 package com.ruoyi.ems.service.impl;
 
-import com.ruoyi.common.core.utils.DateUtils;
 import com.ruoyi.ems.domain.Area;
 import com.ruoyi.ems.domain.EmsDevice;
 import com.ruoyi.ems.mapper.EmsDeviceMapper;
 import com.ruoyi.ems.model.QueryDevice;
 import com.ruoyi.ems.service.IAreaService;
 import com.ruoyi.ems.service.IEmsDeviceService;
+import com.ruoyi.ems.util.AreaUtils;
 import org.apache.commons.collections4.CollectionUtils;
-import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
-import java.util.LinkedList;
 import java.util.List;
 import java.util.Map;
 import java.util.function.Function;
@@ -103,9 +101,6 @@ public class EmsDeviceServiceImpl implements IEmsDeviceService {
      */
     @Override
     public int insertEmsDevice(EmsDevice emsDevice) {
-        emsDevice.setCreateTime(DateUtils.getNowDate());
-        String codePath = emsDeviceMapper.selectDevicePath(emsDevice.getLocationType(), emsDevice.getLocationRef());
-        emsDevice.setAreaAncestors(codePath);
         return emsDeviceMapper.insertEmsDevice(emsDevice);
     }
 
@@ -117,9 +112,6 @@ public class EmsDeviceServiceImpl implements IEmsDeviceService {
      */
     @Override
     public int updateEmsDevice(EmsDevice emsDevice) {
-        emsDevice.setUpdateTime(DateUtils.getNowDate());
-        String codePath = emsDeviceMapper.selectDevicePath(emsDevice.getLocationType(), emsDevice.getLocationRef());
-        emsDevice.setAreaAncestors(codePath);
         return emsDeviceMapper.updateEmsDevice(emsDevice);
     }
 
@@ -174,22 +166,11 @@ public class EmsDeviceServiceImpl implements IEmsDeviceService {
 
     private void fillAreaName(EmsDevice emsDevice, Map<String, Area> areaMap) {
         String areaCode = emsDevice.getLocationRef();
+        String areaNamePath = AreaUtils.getAreaNamePath(areaCode, areaMap);
 
         Area area = areaMap.get(areaCode);
         emsDevice.setLocationRefName(null != area ? area.getAreaName() : "未知");
-
-        LinkedList<String> pathItems = new LinkedList<>();
-
-        do{
-            if (null != area) {
-                pathItems.addFirst(area.getShortName());
-                area = areaMap.get(area.getParentCode());
-            } else {
-                pathItems.add("未知");
-            }
-        } while(null != area);
-
-        emsDevice.setAreaPath(StringUtils.join(pathItems,"/"));
+        emsDevice.setAreaPath(areaNamePath);
     }
 
     private void fillAreaName(EmsDevice emsDevice) {

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

@@ -3,29 +3,26 @@ package com.ruoyi.ems.service.impl;
 import cn.hutool.core.date.DateUnit;
 import cn.hutool.core.date.DateUtil;
 import cn.hutool.core.map.MapUtil;
-import com.ruoyi.common.core.enums.AreaTier;
 import com.ruoyi.common.core.enums.FacTypes;
 import com.ruoyi.common.core.utils.DateTimeUtil;
 import com.ruoyi.common.core.utils.DateUtils;
 import com.ruoyi.common.core.utils.ExpressUtil;
 import com.ruoyi.common.core.utils.StreamUtils;
-import com.ruoyi.ems.domain.AreaOld;
-import com.ruoyi.ems.domain.AreaBuilding;
-import com.ruoyi.ems.domain.AreaBuildingZoning;
+import com.ruoyi.ems.domain.Area;
 import com.ruoyi.ems.domain.EmsDevice;
 import com.ruoyi.ems.domain.EmsFacs;
-import com.ruoyi.ems.model.QueryDevice;
-import com.ruoyi.ems.model.TreeEntity;
 import com.ruoyi.ems.mapper.AdmEmsElecPgIndexMapper;
 import com.ruoyi.ems.mapper.AdmEmsIndexRangeMapper;
 import com.ruoyi.ems.mapper.EmsFacsMapper;
-import com.ruoyi.ems.service.IAreaBuildingService;
-import com.ruoyi.ems.service.IAreaBuildingZoningService;
-import com.ruoyi.ems.service.IAreaOldService;
+import com.ruoyi.ems.model.QueryDevice;
+import com.ruoyi.ems.model.TreeEntity;
+import com.ruoyi.ems.service.IAreaService;
 import com.ruoyi.ems.service.IEmsDeviceService;
 import com.ruoyi.ems.service.IEmsFacsService;
+import com.ruoyi.ems.util.AreaUtils;
 import org.apache.commons.collections4.CollectionUtils;
 import org.apache.commons.lang3.StringUtils;
+import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
@@ -55,13 +52,7 @@ public class EmsFacsServiceImpl implements IEmsFacsService {
     private IEmsDeviceService deviceService;
 
     @Autowired
-    private IAreaOldService areaService;
-
-    @Autowired
-    private IAreaBuildingService buildingService;
-
-    @Autowired
-    private IAreaBuildingZoningService zoningService;
+    private IAreaService areaService;
 
     @Autowired
     private AdmEmsIndexRangeMapper admEmsIndexRangeMapper;
@@ -107,43 +98,56 @@ public class EmsFacsServiceImpl implements IEmsFacsService {
     public List<TreeEntity> getFacsDevTree(QueryDevice queryDevice) {
         List<TreeEntity> retList = new ArrayList<>();
 
-        List<AreaOld> areas = areaService.selectAreaList(new AreaOld());
-        List<AreaBuilding> buildings = buildingService.selectAreaBuildingList(new AreaBuilding());
-        List<AreaBuildingZoning> zonings = zoningService.selectAreaBuildingZoningList(new AreaBuildingZoning());
-
         if (StringUtils.isEmpty(queryDevice.getAreaCode())) {
-            if (CollectionUtils.isNotEmpty(areas)) {
-                for (AreaOld area : areas) {
-                    EmsFacs facsParam = new EmsFacs();
-                    facsParam.setRefArea(area.getAreaCode());
-                    facsParam.setFacsCategory(queryDevice.getDeviceCategory());
+            List<Area> areaTree = areaService.selectAreaTree("0", true);
+            List<Area> areaList = compressTree(areaTree);
+            Map<String, Area> areaMap = areaList.stream().collect(Collectors.toMap(Area::getAreaCode, Function.identity()));
 
-                    List<EmsFacs> facsList = selectEmsFacsList(facsParam);
+            if (CollectionUtils.isNotEmpty(areaTree)) {
+                EmsFacs facsParam = new EmsFacs();
+                facsParam.setFacsCategory(queryDevice.getDeviceCategory());
+                List<EmsFacs> facsList = selectEmsFacsList(facsParam);
+
+                for (Area area : areaTree) {
+                    QueryDevice param = new QueryDevice();
+                    BeanUtils.copyProperties(queryDevice, param);
+                    param.setAreaCode(area.getAreaCode());
+
+                    List<EmsDevice> devices = deviceService.selectList(param);
+                    Map<String, List<EmsDevice>> deviceMap = devices.stream().collect(Collectors.groupingBy(EmsDevice::getRefFacs));
 
                     TreeEntity entity = new TreeEntity();
                     entity.setId(area.getAreaCode());
                     entity.setLabel(area.getAreaName());
-                    entity.setChildren(buildFacsDevSub(queryDevice, facsList, areas, buildings, zonings));
-                    //entity.setTier("Area");
+                    entity.setChildren(buildFacsDevSub(facsList, deviceMap, areaMap));
                     retList.add(entity);
                 }
             }
         }
         else {
-            AreaOld area = areaService.selectAreaByCode(queryDevice.getAreaCode());
+            Area area = areaService.selectAreaByCode(queryDevice.getAreaCode());
+            List<Area> areaTree = areaService.selectAreaTree(queryDevice.getAreaCode(), true);
+            List<Area> areaList = compressTree(areaTree);
+            Map<String, Area> areaMap = areaList.stream().collect(Collectors.toMap(Area::getAreaCode, Function.identity()));
 
             if (null != area) {
                 EmsFacs facsParam = new EmsFacs();
                 facsParam.setRefArea(area.getAreaCode());
                 facsParam.setFacsCategory(queryDevice.getDeviceCategory());
-
                 List<EmsFacs> facsList = selectEmsFacsList(facsParam);
 
+                QueryDevice param = new QueryDevice();
+                BeanUtils.copyProperties(queryDevice, param);
+                param.setAreaCode(queryDevice.getAreaCode());
+
+                List<EmsDevice> devices = deviceService.selectList(param);
+                Map<String, List<EmsDevice>> deviceMap = devices.stream().collect(Collectors.groupingBy(EmsDevice::getRefFacs));
+
                 TreeEntity entity = new TreeEntity();
                 entity.setId(area.getAreaCode());
                 entity.setLabel(area.getAreaName());
-                entity.setChildren(buildFacsDevSub(queryDevice, facsList, areas, buildings, zonings));
-                //entity.setTier("Area");
+                entity.setChildren(buildFacsDevSub(facsList, deviceMap, areaMap));
+
                 retList.add(entity);
             }
         }
@@ -151,54 +155,56 @@ public class EmsFacsServiceImpl implements IEmsFacsService {
         return retList;
     }
 
-    private List<TreeEntity> buildFacsDevSub(QueryDevice queryParam, List<EmsFacs> facsList, List<AreaOld> areas,
-        List<AreaBuilding> buildings, List<AreaBuildingZoning> zonings) {
+    private List<Area> compressTree(List<Area> areas) {
+        List<Area> retList = new ArrayList<>();
+
+        for (Area area : areas) {
+            retList.add(area);
+            compressTreeChild(area.getChildren(), retList);
+        }
+
+        return retList;
+    }
+
+    private void compressTreeChild(List<?> child, List<Area> retList) {
+        if (CollectionUtils.isNotEmpty(child)) {
+            for (Object o : child) {
+                Area area = (Area)o;
+                retList.add(area);
+                compressTreeChild(area.getChildren(), retList);
+            }
+        }
+    }
+
+    private List<TreeEntity> buildFacsDevSub(List<EmsFacs> facsList, Map<String, List<EmsDevice>> deviceMap, Map<String, Area> areaMap) {
         List<TreeEntity> retList = new ArrayList<>();
-        Map<String, AreaOld> areaMap = areas.stream().collect(Collectors.toMap(AreaOld::getAreaCode, Function.identity()));
-        Map<String, AreaBuilding> buildingMap = buildings.stream()
-            .collect(Collectors.toMap(AreaBuilding::getBldgCode, Function.identity()));
-        Map<String, AreaBuildingZoning> zoningMap = zonings.stream()
-            .collect(Collectors.toMap(AreaBuildingZoning::getZoningCode, Function.identity()));
 
         for (EmsFacs facs : facsList) {
             boolean hasSub = false;
-            List<TreeEntity> subList = new ArrayList<>();
+            List<TreeEntity> subList = null;
+            List<EmsDevice> devices = deviceMap.get(facs.getFacsCode());
 
-            queryParam.setRefFacs(facs.getFacsCode());
-            List<EmsDevice> devices = deviceService.selectList(queryParam);
+            if (CollectionUtils.isNotEmpty(devices)){
+                subList = new ArrayList<>();
 
-            for (EmsDevice device : devices) {
-                hasSub = true;
-                String namePrefix = "";
-                if (StringUtils.equals(AreaTier.Area.name(), device.getLocationType())) {
-                    namePrefix = areaMap.get(device.getLocationRef()).getShortName();
-                }
-                else if (StringUtils.equals(AreaTier.Building.name(), device.getLocationType())) {
-                    namePrefix = buildingMap.get(device.getLocationRef()).getBldgName();
-                }
-                else if (StringUtils.equals(AreaTier.Zoning.name(), device.getLocationType())) {
-                    AreaBuildingZoning zoning = zoningMap.get(device.getLocationRef());
-                    AreaBuilding building = zoning != null ? buildingMap.get(zoning.getBldgCode()) : null;
-                    namePrefix = (building != null ? building.getBldgName() : "") + "/" + (zoning != null ?
-                        zoning.getZoningName() :
-                        "");
-                }
+                for (EmsDevice device : devices) {
+                    hasSub = true;
+                    String namePrefix = AreaUtils.getAreaNamePath(device.getLocationRef(), areaMap);
 
-                String label = StringUtils.isNotBlank(namePrefix) ?
-                    namePrefix + " - " + device.getDeviceName() :
-                    device.getDeviceName();
+                    String label = StringUtils.isNotBlank(namePrefix) ?
+                        namePrefix + " - " + device.getDeviceName() :
+                        device.getDeviceName();
 
-                TreeEntity entity = new TreeEntity();
-                entity.setId(device.getDeviceCode());
-                entity.setLabel(label);
-                //entity.setTier("Device");
-                subList.add(entity);
+                    TreeEntity entity = new TreeEntity();
+                    entity.setId(device.getDeviceCode());
+                    entity.setLabel(label);
+                    subList.add(entity);
+                }
             }
 
             TreeEntity entity = new TreeEntity();
             entity.setId(facs.getFacsCode());
             entity.setLabel(facs.getFacsName());
-            //entity.setTier("Facs");
             entity.setChildren(subList);
 
             if (hasSub) {

+ 33 - 56
ems-cloud/ems-modules/ems-server/src/main/java/com/ruoyi/ems/service/impl/MeterDeviceServiceImpl.java

@@ -1,24 +1,23 @@
 package com.ruoyi.ems.service.impl;
 
-import com.ruoyi.common.core.enums.MeterObjSubType;
 import com.ruoyi.common.core.enums.MeterObjType;
-import com.ruoyi.ems.domain.AreaOld;
-import com.ruoyi.ems.domain.AreaBuilding;
-import com.ruoyi.ems.domain.AreaBuildingZoning;
+import com.ruoyi.ems.domain.Area;
 import com.ruoyi.ems.domain.EmsDevice;
 import com.ruoyi.ems.domain.EmsFacs;
 import com.ruoyi.ems.domain.MeterDevice;
 import com.ruoyi.ems.mapper.MeterDeviceMapper;
-import com.ruoyi.ems.service.IAreaBuildingService;
-import com.ruoyi.ems.service.IAreaBuildingZoningService;
-import com.ruoyi.ems.service.IAreaOldService;
+import com.ruoyi.ems.service.IAreaService;
 import com.ruoyi.ems.service.IEmsDeviceService;
 import com.ruoyi.ems.service.IEmsFacsService;
 import com.ruoyi.ems.service.IMeterDeviceService;
+import com.ruoyi.ems.util.AreaUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
 import java.util.List;
+import java.util.Map;
+import java.util.function.Function;
+import java.util.stream.Collectors;
 
 /**
  * 计量设备Service业务层处理
@@ -32,13 +31,7 @@ public class MeterDeviceServiceImpl implements IMeterDeviceService {
     private MeterDeviceMapper meterDeviceMapper;
 
     @Autowired
-    private IAreaOldService areaService;
-
-    @Autowired
-    private IAreaBuildingService buildingService;
-
-    @Autowired
-    private IAreaBuildingZoningService zoningService;
+    private IAreaService areaService;
 
     @Autowired
     private IEmsDeviceService deviceService;
@@ -129,52 +122,36 @@ public class MeterDeviceServiceImpl implements IMeterDeviceService {
 
     private void fillObjName(MeterDevice meterDevice) {
         // 计量区块
-        if (MeterObjType.METER_ABZ.getType() == meterDevice.getObjType()) {
-            if (MeterObjSubType.METER_AREA.getType() == meterDevice.getObjSubType()) {
-                AreaOld area = areaService.selectAreaByCode(meterDevice.getObjCode());
-                meterDevice.setObjName(area != null ? area.getShortName() : "未知");
-            }
-            else if (MeterObjSubType.METER_BUILDING.getType() == meterDevice.getObjSubType()) {
-                AreaBuilding building = buildingService.selectAreaBuildingByCode(meterDevice.getObjCode());
-                meterDevice.setObjName(
-                    building != null ? building.getAreaShortName() + "/" + building.getBldgName() : "未知");
+        if (MeterObjType.METER_AREA.getType() == meterDevice.getObjType()) {
+            List<Area> areas = areaService.selectArea(new Area());
+            Map<String, Area> areaMap = areas.stream()
+                .collect(Collectors.toMap(Area::getAreaCode, Function.identity()));
+            String areaPath = AreaUtils.getAreaNamePath(meterDevice.getObjCode(), areaMap);
+            meterDevice.setObjName(areaPath);
+        }
+        // 计量设备设施
+        else if (MeterObjType.METER_FACS.getType() == meterDevice.getObjType()) {
+            EmsFacs facs = facsService.selectEmsFacsByCode(meterDevice.getObjCode());
+
+            if (facs != null) {
+                List<Area> areas = areaService.selectArea(new Area());
+                Map<String, Area> areaMap = areas.stream()
+                    .collect(Collectors.toMap(Area::getAreaCode, Function.identity()));
+                String areaPath = AreaUtils.getAreaNamePath(facs.getRefArea(), areaMap);
+
+                meterDevice.setObjName(areaPath != null ? areaPath + "/" + facs.getFacsName() : facs.getFacsName());
             }
-            else if (MeterObjSubType.METER_ZONING.getType() == meterDevice.getObjSubType()) {
-                AreaBuildingZoning zoning = zoningService.selectAreaBuildingZoningByCode(meterDevice.getObjCode());
-
-                if (null != zoning) {
-                    AreaBuilding building = buildingService.selectAreaBuildingByCode(zoning.getBldgCode());
-                    meterDevice.setObjName(building != null ?
-                        building.getAreaShortName() + "/" + building.getBldgName() + "/" + zoning.getZoningName() :
-                        "未知");
-                }
-                else {
-                    meterDevice.setObjName("未知");
-                }
+            else {
+                meterDevice.setObjName("未知");
             }
         }
-        // 计量设备设施
-        else if (MeterObjType.METER_FD.getType() == meterDevice.getObjType()) {
-            if (MeterObjSubType.METER_FACS.getType() == meterDevice.getObjSubType()) {
-                EmsFacs facs = facsService.selectEmsFacsByCode(meterDevice.getObjCode());
-
-                if (facs != null) {
-                    AreaOld area = areaService.selectAreaByCode(facs.getRefArea());
-                    meterDevice.setObjName(
-                        area != null ? area.getShortName() + "/" + facs.getFacsName() : facs.getFacsName());
-                }
-                else {
-                    meterDevice.setObjName("未知");
-                }
+        else if (MeterObjType.METER_DEVC.getType() == meterDevice.getObjType()) {
+            EmsDevice device = deviceService.selectDetailByCode(meterDevice.getObjCode());
+            if (device != null) {
+                meterDevice.setObjName(device.getAreaPath() + "/" + device.getDeviceName());
             }
-            else if (MeterObjSubType.METER_DEVICE.getType() == meterDevice.getObjSubType()) {
-                EmsDevice device = deviceService.selectDetailByCode(meterDevice.getObjCode());
-                if (device != null) {
-                    meterDevice.setObjName(device.getAreaPath() + "/" + device.getDeviceName());
-                }
-                else {
-                    meterDevice.setObjName("未知");
-                }
+            else {
+                meterDevice.setObjName("未知");
             }
         }
     }

+ 176 - 0
ems-cloud/ems-modules/ems-server/src/main/java/com/ruoyi/ems/util/AreaUtils.java

@@ -0,0 +1,176 @@
+/*
+ * 文 件 名:  AreaUtils
+ * 版    权:  浩鲸云计算科技股份有限公司
+ * 描    述:  <描述>
+ * 修 改 人:  lvwenbin
+ * 修改时间:  2024/11/6
+ * 跟踪单号:  <跟踪单号>
+ * 修改单号:  <修改单号>
+ * 修改内容:  <修改内容>
+ */
+package com.ruoyi.ems.util;
+
+import com.ruoyi.ems.domain.Area;
+import com.ruoyi.ems.domain.EmsDevice;
+import com.ruoyi.ems.model.TreeEntity;
+import org.apache.commons.collections4.CollectionUtils;
+import org.apache.commons.lang3.StringUtils;
+
+import java.util.ArrayList;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+/**
+ * 区域工具
+ * <功能详细描述>
+ *
+ * @author lvwenbin
+ * @version [版本号, 2024/11/6]
+ * @see [相关类/方法]
+ * @since [产品/模块版本]
+ */
+public abstract class AreaUtils {
+    /**
+     * 对象转换List<Area> -> List<TreeEntity>
+     *
+     * @param areas 区域树结构
+     * @return TreeEntity 树结构
+     */
+    public static List<TreeEntity> convertAreaTree(List<?> areas) {
+        List<TreeEntity> retList = new ArrayList<>();
+
+        for (Object obj : areas) {
+            Area area = (Area) obj;
+            TreeEntity tree = new TreeEntity();
+            tree.setId(area.getAreaCode());
+            tree.setLabel(area.getAreaName());
+
+            if (CollectionUtils.isNotEmpty(area.getChildren())) {
+                tree.setChildren(convertAreaTree(area.getChildren()));
+            }
+
+            retList.add(tree);
+        }
+
+        return retList;
+    }
+
+    /**
+     * 过滤区域树
+     * · 遍历树中的每个节点,并调用 filterNode 方法来检查每个节点是否应该被保留。
+     * · 如果节点被保留,则将其添加到结果列表中
+     *
+     * @param tree      区域树
+     * @param areaCodes 需保留的区域编码
+     * @return 区域树
+     */
+    public static List<Area> filterTree(List<Area> tree, Set<String> areaCodes) {
+        List<Area> filteredTree = new ArrayList<>();
+        for (Area node : tree) {
+            Area filteredNode = filterNode(node, areaCodes);
+            if (filteredNode != null) {
+                filteredTree.add(filteredNode);
+            }
+        }
+        return filteredTree;
+    }
+
+    /**
+     * 过滤区域节点
+     * 如果当前节点的 ID 在 ID 列表中,则保留该节点并递归过滤其子节点。
+     * 如果当前节点的 ID 不在 ID 列表中,则检查其子节点是否有匹配的。如果有,则保留该节点并递归过滤其子节点;否则,丢弃该节点。
+     *
+     * @param node 区域节点对象
+     * @param ids  需保留的区域编码
+     * @return 区域节点
+     */
+    public static Area filterNode(Area node, Set<String> ids) {
+        if (ids.contains(node.getAreaCode())) {
+            if (CollectionUtils.isNotEmpty(node.getChildren())) {
+                // Node matches, keep it and filter its children
+                List<Area> filteredChildren = new ArrayList<>();
+                for (Object child : node.getChildren()) {
+                    Area filteredChild = filterNode((Area) child, ids);
+                    if (filteredChild != null) {
+                        filteredChildren.add(filteredChild);
+                    }
+                }
+                node.setChildren(filteredChildren);
+            }
+
+            return node;
+        }
+        else {
+            // Node does not match, check if any of its children match
+            boolean hasMatchingChild = false;
+
+            if (CollectionUtils.isNotEmpty(node.getChildren())) {
+                List<Area> filteredChildren = new ArrayList<>();
+                for (Object child : node.getChildren()) {
+                    Area filteredChild = filterNode((Area) child, ids);
+                    if (filteredChild != null) {
+                        filteredChildren.add(filteredChild);
+                        hasMatchingChild = true;
+                    }
+                }
+
+                if (hasMatchingChild) {
+                    // Parent node should be kept because it has matching children
+                    node.setChildren(filteredChildren);
+                    return node;
+                }
+                else {
+                    // No matching children, discard this node
+                    return null;
+                }
+            }
+
+            return null;
+        }
+    }
+
+    /**
+     * 递归从树获取区域编码
+     *
+     * @param areaTree  树结构
+     * @param areaCodes 结果列表
+     */
+    public static <T> void getCodeRecursion(List<T> areaTree, List<String> areaCodes) {
+        if (CollectionUtils.isNotEmpty(areaTree)) {
+            for (T t : areaTree) {
+                Area area = (Area) t;
+                areaCodes.add(area.getAreaCode());
+                if (CollectionUtils.isNotEmpty(area.getChildren())) {
+                    getCodeRecursion(area.getChildren(), areaCodes);
+                }
+            }
+        }
+    }
+
+    /**
+     * 获取区域名称全路径
+     * @param areaCode 区域编码
+     * @param areaMap 区域集合
+     * @return
+     */
+    public static String getAreaNamePath(String areaCode, Map<String, Area> areaMap) {
+        Area area = areaMap.get(areaCode);
+        LinkedList<String> pathItems = new LinkedList<>();
+
+        do {
+            if (null != area) {
+                pathItems.addFirst(
+                    StringUtils.isNotEmpty(area.getShortName()) ? area.getShortName() : area.getAreaName());
+                area = areaMap.get(area.getParentCode());
+            }
+            else {
+                pathItems.add("未知");
+            }
+        }
+        while (null != area);
+
+        return StringUtils.join(pathItems, "/");
+    }
+}

+ 0 - 103
ems-cloud/ems-modules/ems-server/src/main/resources/mapper/ems/AreaBuildingMapper.xml

@@ -1,103 +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.AreaBuildingMapper">
-    
-    <resultMap type="com.ruoyi.ems.domain.AreaBuilding" id="AreaBuildingResult">
-        <result property="id"    column="id"    />
-        <result property="bldgCode"    column="bldg_code"    />
-        <result property="bldgName"    column="bldg_name"    />
-        <result property="address"    column="address"    />
-        <result property="upBldgFloor"    column="up_bldg_floor"    />
-        <result property="downBldgFloor"    column="down_bldg_floor"    />
-        <result property="bldgHeight"    column="bldg_height"    />
-        <result property="floorArea"    column="floor_area"    />
-        <result property="bldgUsage"    column="bldg_usage"    />
-        <result property="areaCode"    column="area_code"    />
-        <result property="areaName"    column="area_name"    />
-        <result property="areaShortName"  column="area_short_name"    />
-    </resultMap>
-
-    <sql id="selectAreaBuildingVo">
-        select b.`id`, b.`bldg_code`, b.`bldg_name`, b.`address`, b.`up_bldg_floor`, b.`down_bldg_floor`, b.`bldg_height`, b.`floor_area`, b.`bldg_usage`, b.`area_code`, a.`area_name`, a.`short_name` as area_short_name from adm_area_building b LEFT JOIN adm_service_area a ON b.`area_code` = a.`area_code`
-    </sql>
-
-    <select id="selectAreaBuildingList" parameterType="com.ruoyi.ems.domain.AreaBuilding" resultMap="AreaBuildingResult">
-        <include refid="selectAreaBuildingVo"/>
-        <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>
-            <if test="upBldgFloor != null "> and b.`up_bldg_floor` = #{upBldgFloor}</if>
-            <if test="downBldgFloor != null "> and b.`down_bldg_floor` = #{downBldgFloor}</if>
-            <if test="bldgHeight != null "> and b.`bldg_height` = #{bldgHeight}</if>
-            <if test="floorArea != null "> and b.`floor_area` = #{floorArea}</if>
-            <if test="bldgUsage != null  and bldgUsage != ''"> and b.`bldg_usage` = #{bldgUsage}</if>
-        </where>
-    </select>
-    
-    <select id="selectAreaBuildingById" parameterType="Long" resultMap="AreaBuildingResult">
-        <include refid="selectAreaBuildingVo"/>
-        where b.`id` = #{id}
-    </select>
-
-    <select id="selectAreaBuildingByCode" parameterType="String" resultMap="AreaBuildingResult">
-        <include refid="selectAreaBuildingVo"/>
-        where b.`bldg_code` = #{code}
-    </select>
-
-    <insert id="insertAreaBuilding" parameterType="com.ruoyi.ems.domain.AreaBuilding" useGeneratedKeys="true" keyProperty="id">
-        insert into adm_area_building
-        <trim prefix="(" suffix=")" suffixOverrides=",">
-            <if test="bldgCode != null and bldgCode != ''">bldg_code,</if>
-            <if test="bldgName != null and bldgName != ''">bldg_name,</if>
-            <if test="address != null">address,</if>
-            <if test="upBldgFloor != null">up_bldg_floor,</if>
-            <if test="downBldgFloor != null">down_bldg_floor,</if>
-            <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>
-            <if test="bldgName != null and bldgName != ''">#{bldgName},</if>
-            <if test="address != null">#{address},</if>
-            <if test="upBldgFloor != null">#{upBldgFloor},</if>
-            <if test="downBldgFloor != null">#{downBldgFloor},</if>
-            <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>
-
-    <update id="updateAreaBuilding" parameterType="com.ruoyi.ems.domain.AreaBuilding">
-        update adm_area_building
-        <trim prefix="SET" suffixOverrides=",">
-            <if test="bldgCode != null and bldgCode != ''">bldg_code = #{bldgCode},</if>
-            <if test="bldgName != null and bldgName != ''">bldg_name = #{bldgName},</if>
-            <if test="address != null">address = #{address},</if>
-            <if test="upBldgFloor != null">up_bldg_floor = #{upBldgFloor},</if>
-            <if test="downBldgFloor != null">down_bldg_floor = #{downBldgFloor},</if>
-            <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>
-
-    <delete id="deleteAreaBuildingById" parameterType="Long">
-        delete from adm_area_building where id = #{id}
-    </delete>
-
-    <delete id="deleteAreaBuildingByIds" parameterType="String">
-        delete from adm_area_building where id in
-        <foreach item="id" collection="array" open="(" separator="," close=")">
-            #{id}
-        </foreach>
-    </delete>
-</mapper>

+ 0 - 131
ems-cloud/ems-modules/ems-server/src/main/resources/mapper/ems/AreaBuildingZoningMapper.xml

@@ -1,131 +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.AreaBuildingZoningMapper">
-    
-    <resultMap type="com.ruoyi.ems.domain.AreaBuildingZoning" id="AreaBuildingZoningResult">
-        <result property="id"    column="id"    />
-        <result property="bldgCode"    column="bldg_code"    />
-        <result property="bldgName"    column="bldg_name"    />
-        <result property="zoningCode"    column="zoning_code"    />
-        <result property="zoningName"    column="zoning_name"    />
-        <result property="floor"    column="floor"    />
-        <result property="bldgLdArea"    column="bldg_ld_area"    />
-        <result property="usageDetail"    column="usage_detail"    />
-        <result property="tagCodes"    column="tag_codes"    />
-        <result property="tagNames"    column="tag_names"    />
-    </resultMap>
-
-    <sql id="selectAreaBuildingZoningVo">
-        select
-            z.`id`,
-            z.`bldg_code`,
-            b.`bldg_name`,
-            z.`zoning_code`,
-            z.`zoning_name`,
-            z.`floor`,
-            z.`bldg_ld_area`,
-            z.`usage_detail`,
-            COALESCE(GROUP_CONCAT(r.tag_code SEPARATOR ','), '') AS tag_codes,
-            COALESCE(GROUP_CONCAT(t.tag_name SEPARATOR ','), '') AS tag_names
-        from adm_area_building_zoning z
-            LEFT JOIN adm_area_building b ON z.bldg_code = b.bldg_code
-            LEFT JOIN adm_obj_tag_rel r ON z.zoning_code = r.obj_code
-            LEFT JOIN dim_ems_tag t ON t.tag_code = r.tag_code
-    </sql>
-
-    <select id="selectAreaBuildingZoningList" parameterType="com.ruoyi.ems.domain.AreaBuildingZoning" resultMap="AreaBuildingZoningResult">
-        <include refid="selectAreaBuildingZoningVo"/>
-        <where>
-            <if test="areaCode != null  and areaCode != ''"> and b.`area_code` = #{areaCode}</if>
-            <if test="bldgCode != null  and bldgCode != ''"> and z.`bldg_code` = #{bldgCode}</if>
-            <if test="zoningCode != null  and zoningCode != ''"> and z.`zoning_code` = #{zoningCode}</if>
-            <if test="zoningName != null  and zoningName != ''"> and z.`zoning_name` like concat('%', #{zoningName}, '%')</if>
-            <if test="floor != null "> and z.`floor` = #{floor}</if>
-            <if test="bldgLdArea != null "> and z.`bldg_ld_area` = #{bldgLdArea}</if>
-            <if test="usageDetail != null  and usageDetail != ''"> and z.`usage_detail` = #{usageDetail}</if>
-            <if test="tagCodeList != null"> and r.tag_code in
-              <foreach item="code" collection="tagCodeList" open="(" separator="," close=")">
-                #{code}
-              </foreach>
-             </if>
-        </where>
-        GROUP BY z.zoning_code
-        ORDER BY bldg_code,zoning_code
-    </select>
-    
-    <select id="selectAreaBuildingZoningById" parameterType="Long" resultMap="AreaBuildingZoningResult">
-        <include refid="selectAreaBuildingZoningVo"/>
-        where z.`id` = #{id}
-    </select>
-
-    <select id="selectAreaBuildingZoningByCode" parameterType="String" resultMap="AreaBuildingZoningResult">
-        <include refid="selectAreaBuildingZoningVo"/>
-        where z.`zoning_code` = #{code}
-    </select>
-
-    <select id="selectByCodes"  resultMap="AreaBuildingZoningResult">
-        select
-            z.`id`,
-            z.`bldg_code`,
-            z.`zoning_code`,
-            z.`zoning_name`,
-            z.`floor`,
-            z.`bldg_ld_area`,
-            z.`usage_detail`
-        from adm_area_building_zoning z
-        where z.`zoning_code` = in
-        <foreach item="code" collection="codes" open="(" separator="," close=")">
-            #{code}
-        </foreach>
-    </select>
-
-    <insert id="insertAreaBuildingZoning" parameterType="com.ruoyi.ems.domain.AreaBuildingZoning" useGeneratedKeys="true" keyProperty="id">
-        insert into adm_area_building_zoning
-        <trim prefix="(" suffix=")" suffixOverrides=",">
-            <if test="bldgCode != null and bldgCode != ''">bldg_code,</if>
-            <if test="zoningCode != null and zoningCode != ''">zoning_code,</if>
-            <if test="zoningName != null and zoningName != ''">zoning_name,</if>
-            <if test="floor != null">floor,</if>
-            <if test="bldgLdArea != null">bldg_ld_area,</if>
-            <if test="usageDetail != null">usage_detail,</if>
-         </trim>
-        <trim prefix="values (" suffix=")" suffixOverrides=",">
-            <if test="bldgCode != null and bldgCode != ''">#{bldgCode},</if>
-            <if test="zoningCode != null and zoningCode != ''">#{zoningCode},</if>
-            <if test="zoningName != null and zoningName != ''">#{zoningName},</if>
-            <if test="floor != null">#{floor},</if>
-            <if test="bldgLdArea != null">#{bldgLdArea},</if>
-            <if test="usageDetail != null">#{usageDetail},</if>
-         </trim>
-    </insert>
-
-    <update id="updateAreaBuildingZoning" parameterType="com.ruoyi.ems.domain.AreaBuildingZoning">
-        update adm_area_building_zoning
-        <trim prefix="SET" suffixOverrides=",">
-            <if test="bldgCode != null and bldgCode != ''">bldg_code = #{bldgCode},</if>
-            <if test="zoningCode != null and zoningCode != ''">zoning_code = #{zoningCode},</if>
-            <if test="zoningName != null and zoningName != ''">zoning_name = #{zoningName},</if>
-            <if test="floor != null">floor = #{floor},</if>
-            <if test="bldgLdArea != null">bldg_ld_area = #{bldgLdArea},</if>
-            <if test="usageDetail != null">usage_detail = #{usageDetail},</if>
-        </trim>
-        where id = #{id}
-    </update>
-
-    <delete id="deleteAreaBuildingZoningById" parameterType="Long">
-        delete from adm_area_building_zoning where id = #{id}
-    </delete>
-
-    <delete id="deleteAreaBuildingZoningByBuilding" parameterType="java.lang.String">
-        delete from adm_area_building_zoning where bldg_code = #{code}
-    </delete>
-
-    <delete id="deleteAreaBuildingZoningByIds" parameterType="String">
-        delete from adm_area_building_zoning where id in
-        <foreach item="id" collection="array" open="(" separator="," close=")">
-            #{id}
-        </foreach>
-    </delete>
-</mapper>

+ 9 - 10
ems-cloud/ems-modules/ems-server/src/main/resources/mapper/ems/AreaMapper.xml

@@ -34,19 +34,18 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         </where>
     </select>
 
-    <select id="selectWithFacsCategory"  resultMap="areaResult">
-        SELECT
-          a.id, a.area_code, a.parent_code, a.ancestors, a.area_name, a.short_name, a.`desc`, a.order_num, a.status
-        FROM adm_area a
-        INNER JOIN adm_ems_facs f ON f.ref_area = a.area_code
+    <select id="selectByCodes" resultMap="areaResult">
+        select id, area_code, parent_code, ancestors, area_name, short_name, `desc`, order_num, status from adm_area
         <where>
-            <if test="parentCode != null  and parentCode != ''"> and a.parent_code = #{parentCode}</if>
-            <if test="facsCategory != null  and facsCategory != ''"> and f.facs_category = #{facsCategory}</if>
-            <if test="facsSubCategory != null  and facsSubCategory != ''"> and f.facs_subcategory = #{facsSubCategory}</if>
+            area_code in
+            (
+            <foreach collection="set" item="areaCode" index="index" separator=",">
+                #{areaCode}
+            </foreach>
+            )
         </where>
-        GROUP BY a.area_code
     </select>
-    
+
     <select id="selectAreaById" parameterType="Long" resultMap="areaResult">
         <include refid="selectAreaVo"/>
         where id = #{id}

+ 0 - 143
ems-cloud/ems-modules/ems-server/src/main/resources/mapper/ems/AreaOldMapper.xml

@@ -1,143 +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.AreaOldMapper">
-    
-    <resultMap type="com.ruoyi.ems.domain.AreaOld" id="AdmServiceAreaResult">
-        <result property="id"    column="id"    />
-        <result property="areaCode"    column="area_code"    />
-        <result property="areaName"    column="area_name"    />
-        <result property="shortName"    column="short_name"    />
-        <result property="serviceStar"    column="service_star"    />
-        <result property="city"    column="city"    />
-        <result property="highway"    column="highway"    />
-        <result property="direction"    column="direction"    />
-        <result property="address"    column="address"    />
-        <result property="attrOrg"    column="attr_org"    />
-        <result property="mgrOrg"    column="mgr_org"    />
-        <result property="openDate"    column="open_date"    />
-        <result property="landArea"    column="land_area"    />
-        <result property="floorArea"    column="floor_area"    />
-        <result property="longitude"    column="longitude"    />
-        <result property="latitude"    column="latitude"    />
-    </resultMap>
-
-    <sql id="selectAreaVo">
-        select id, area_code, area_name, short_name, service_star, city, highway, direction, address, attr_org, mgr_org, open_date, land_area, floor_area, longitude, latitude from adm_service_area
-    </sql>
-
-    <select id="selectAreaList" parameterType="com.ruoyi.ems.domain.AreaOld" resultMap="AdmServiceAreaResult">
-        <include refid="selectAreaVo"/>
-        <where>  
-            <if test="areaCode != null  and areaCode != ''"> and area_code = #{areaCode}</if>
-            <if test="areaName != null  and areaName != ''"> and area_name like concat('%', #{areaName}, '%')</if>
-            <if test="shortName != null  and shortName != ''"> and short_name like concat('%', #{shortName}, '%')</if>
-            <if test="serviceStar != null "> and service_star = #{serviceStar}</if>
-            <if test="city != null  and city != ''"> and city = #{city}</if>
-            <if test="highway != null  and highway != ''"> and highway = #{highway}</if>
-            <if test="direction != null  and direction != ''"> and direction = #{direction}</if>
-            <if test="address != null  and address != ''"> and address = #{address}</if>
-            <if test="attrOrg != null  and attrOrg != ''"> and attr_org = #{attrOrg}</if>
-            <if test="mgrOrg != null  and mgrOrg != ''"> and mgr_org = #{mgrOrg}</if>
-            <if test="openDate != null "> and open_date = #{openDate}</if>
-            <if test="landArea != null "> and land_area = #{landArea}</if>
-            <if test="floorArea != null "> and floor_area = #{floorArea}</if>
-            <if test="longitude != null "> and longitude = #{longitude}</if>
-            <if test="latitude != null "> and latitude = #{latitude}</if>
-        </where>
-    </select>
-
-    <select id="selectWithFacsCategory"  resultMap="AdmServiceAreaResult">
-        SELECT
-            a.id, a.area_code, a.area_name, a.short_name, a.service_star, a.city, a.highway, a.direction, a.address, a.attr_org, a.mgr_org, a.open_date, a.land_area, a.floor_area, a.longitude, a.latitude
-        FROM adm_service_area a
-        INNER JOIN adm_ems_facs f ON f.ref_area = a.area_code
-        <where>
-            <if test="facsCategory != null  and facsCategory != ''"> and f.facs_category = #{facsCategory}</if>
-            <if test="facsSubCategory != null  and facsSubCategory != ''"> and f.facs_subcategory = #{facsSubCategory}</if>
-        </where>
-        GROUP BY a.area_code
-    </select>
-    
-    <select id="selectAreaById" parameterType="Long" resultMap="AdmServiceAreaResult">
-        <include refid="selectAreaVo"/>
-        where `id` = #{id}
-    </select>
-
-    <select id="selectAreaByCode" parameterType="String" resultMap="AdmServiceAreaResult">
-        <include refid="selectAreaVo"/>
-        where area_code = #{code}
-    </select>
-        
-    <insert id="insertArea" parameterType="com.ruoyi.ems.domain.AreaOld" useGeneratedKeys="true" keyProperty="id">
-        insert into adm_service_area
-        <trim prefix="(" suffix=")" suffixOverrides=",">
-            <if test="areaCode != null and areaCode != ''">area_code,</if>
-            <if test="areaName != null and areaName != ''">area_name,</if>
-            <if test="shortName != null and shortName != ''">short_name,</if>
-            <if test="serviceStar != null">service_star,</if>
-            <if test="city != null">city,</if>
-            <if test="highway != null">highway,</if>
-            <if test="direction != null">direction,</if>
-            <if test="address != null">address,</if>
-            <if test="attrOrg != null">attr_org,</if>
-            <if test="mgrOrg != null">mgr_org,</if>
-            <if test="openDate != null">open_date,</if>
-            <if test="landArea != null">land_area,</if>
-            <if test="floorArea != null">floor_area,</if>
-            <if test="longitude != null">longitude,</if>
-            <if test="latitude != null">latitude,</if>
-         </trim>
-        <trim prefix="values (" suffix=")" suffixOverrides=",">
-            <if test="areaCode != null and areaCode != ''">#{areaCode},</if>
-            <if test="areaName != null and areaName != ''">#{areaName},</if>
-            <if test="shortName != null and shortName != ''">#{shortName},</if>
-            <if test="serviceStar != null">#{serviceStar},</if>
-            <if test="city != null">#{city},</if>
-            <if test="highway != null">#{highway},</if>
-            <if test="direction != null">#{direction},</if>
-            <if test="address != null">#{address},</if>
-            <if test="attrOrg != null">#{attrOrg},</if>
-            <if test="mgrOrg != null">#{mgrOrg},</if>
-            <if test="openDate != null">#{openDate},</if>
-            <if test="landArea != null">#{landArea},</if>
-            <if test="floorArea != null">#{floorArea},</if>
-            <if test="longitude != null">#{longitude},</if>
-            <if test="latitude != null">#{latitude},</if>
-         </trim>
-    </insert>
-
-    <update id="updateArea" parameterType="com.ruoyi.ems.domain.AreaOld">
-        update adm_service_area
-        <trim prefix="SET" suffixOverrides=",">
-            <if test="areaCode != null and areaCode != ''">area_code = #{areaCode},</if>
-            <if test="areaName != null and areaName != ''">area_name = #{areaName},</if>
-            <if test="shortName != null and shortName != ''">short_name = #{shortName},</if>
-            <if test="serviceStar != null">service_star = #{serviceStar},</if>
-            <if test="city != null">city = #{city},</if>
-            <if test="highway != null">highway = #{highway},</if>
-            <if test="direction != null">direction = #{direction},</if>
-            <if test="address != null">address = #{address},</if>
-            <if test="attrOrg != null">attr_org = #{attrOrg},</if>
-            <if test="mgrOrg != null">mgr_org = #{mgrOrg},</if>
-            <if test="openDate != null">open_date = #{openDate},</if>
-            <if test="landArea != null">land_area = #{landArea},</if>
-            <if test="floorArea != null">floor_area = #{floorArea},</if>
-            <if test="longitude != null">longitude = #{longitude},</if>
-            <if test="latitude != null">latitude = #{latitude},</if>
-        </trim>
-        where id = #{id}
-    </update>
-
-    <delete id="deleteAreaById" parameterType="Long">
-        delete from adm_service_area where id = #{id}
-    </delete>
-
-    <delete id="deleteAreaByIds" parameterType="String">
-        delete from adm_service_area where id in 
-        <foreach item="id" collection="array" open="(" separator="," close=")">
-            #{id}
-        </foreach>
-    </delete>
-</mapper>

+ 7 - 39
ems-cloud/ems-modules/ems-server/src/main/resources/mapper/ems/EmsDeviceMapper.xml

@@ -16,7 +16,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <result property="location"            column="location"    />
         <result property="locationRef"         column="location_ref"    />
         <result property="areaCode"            column="area_code"    />
-        <result property="areaAncestors"       column="area_ancestors"    />
         <result property="deviceModel"         column="device_model"    />
         <result property="psCode"              column="ps_code"    />
         <result property="psName"              column="ps_name"    />
@@ -30,13 +29,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 
     <sql id="selectDeviceVo">
         select
-            d.`id`, d.`device_code`, d.`device_name`, d.`device_category`, d.`device_brand`, d.`device_spec`, d.`device_status`, d.`location`, d.`location_ref`, d.`area_code`, d.`area_ancestors`, d.`device_model`, d.`ref_facs`, d.`subsystem_code`, d.`ps_code`, d.`create_time`, d.`update_time`
+            d.`id`, d.`device_code`, d.`device_name`, d.`device_category`, d.`device_brand`, d.`device_spec`, d.`device_status`, d.`location`, d.`location_ref`, d.`area_code`, d.`device_model`, d.`ref_facs`, d.`subsystem_code`, d.`ps_code`, d.`create_time`, d.`update_time`
         from adm_ems_device d
     </sql>
 
     <sql id="selectDetailDeviceVo">
         select
-            d.`id`, d.`device_code`, d.`device_name`, d.`device_category`, d.`device_brand`, d.`device_spec`, d.`device_status`, d.`location`, d.`location_ref`, d.`area_code`, d.`area_ancestors`, d.`device_model`, d.`ref_facs`, d.`subsystem_code`, d.`ps_code`, d.`create_time`, d.`update_time`,
+            d.`id`, d.`device_code`, d.`device_name`, d.`device_category`, d.`device_brand`, d.`device_spec`, d.`device_status`, d.`location`, d.`location_ref`, d.`area_code`, d.`device_model`, d.`ref_facs`, d.`subsystem_code`, d.`ps_code`, d.`create_time`, d.`update_time`,
             sc.`name` as device_category_name,
             dp.`ps_name`,
             s.`system_name` as subsystem_name,
@@ -153,7 +152,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="locationType != null">location_type,</if>
             <if test="locationRef != null">location_ref,</if>
             <if test="areaCode != null">area_code,</if>
-            <if test="areaAncestors !=null">area_ancestors,</if>
             <if test="deviceModel !=null">device_model,</if>
             <if test="refFacs != null">ref_facs,</if>
             <if test="psCode != null">ps_code,</if>
@@ -191,7 +189,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="locationType != null">location_type = #{locationType},</if>
             <if test="locationRef != null">location_ref = #{locationRef},</if>
             <if test="areaCode != null">area_code = #{areaCode},</if>
-            <if test="areaAncestors !=null">area_ancestors = #{areaAncestors},</if>
             <if test="deviceModel !=null">device_model = #{deviceModel},</if>
             <if test="refFacs != null">ref_facs = #{refFacs},</if>
             <if test="psCode != null">ps_code = #{psCode},</if>
@@ -211,38 +208,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         </foreach>
     </delete>
 
-    <select id="selectDevicePath" resultType="String">
-        SELECT
-        <if test="locationType == 'Area'">
-            area.area_code path
-        </if>
-        <if test="locationType == 'Building'">
-            CONCAT( area.area_code, ',', building.bldg_code) path
-        </if>
-        <if test="locationType == 'Zoning'">
-            CONCAT( area.area_code, ',', building.bldg_code, ',', zone.zoning_code ) path
-        </if>
-        FROM
-        adm_service_area area
-        <if test="locationType == 'Building' or locationType == 'Zoning'">
-            INNER JOIN adm_area_building building ON area.area_code = building.area_code
-        </if>
-        <if test="locationType == 'Zoning'">
-            INNER JOIN adm_area_building_zoning zone ON building.bldg_code = zone.bldg_code
-        </if>
-        <where>
-            <if test="areaType == 'Area'">
-                area.area_code = #{locationRef}
-            </if>
-            <if test="areaType == 'Building'">
-                building.bldg_code = #{locationRef}
-            </if>
-            <if test="areaType == 'Zoning'">
-                zone.zoning_code = #{locationRef}
-            </if>
-        </where>
-        limit 1
-    </select>
     <select id="cntDeviceStatus">
         SELECT
         device_status deviceStatus,
@@ -266,10 +231,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             SUM( CASE WHEN device_status = '0' THEN 1 ELSE 0 END ) AS onlineCount
         FROM
             adm_ems_device devc
-                INNER JOIN dim_ems_facs_subcategory sc ON devc.device_category = sc.`code`
+            INNER JOIN dim_ems_facs_subcategory sc ON devc.device_category = sc.`code`
+            <if test="areaCode !=null and areaCode!=''">
+                LEFT JOIN adm_service_area area ON devc.location_ref = area.area_code
+            </if>
         <where>
             <if test="areaCode !=null and areaCode!=''">
-                area_ancestors like CONCAT('%',#{areaCode},'%')
+                area.ancestors like CONCAT('%/',#{areaCode},'/%')
             </if>
         </where>
         GROUP BY

+ 4 - 9
ems-cloud/ems-modules/ems-server/src/main/resources/mapper/ems/MeterDeviceMapper.xml

@@ -10,7 +10,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <result property="areaCode"    column="area_code"    />
         <result property="meterCls"    column="meter_cls"    />
         <result property="objType"     column="obj_type"    />
-        <result property="objSubType"  column="obj_sub_type"    />
         <result property="objCode"     column="obj_code"    />
         <result property="objName"     column="obj_name"    />
         <result property="objTag"      column="obj_tag"    />
@@ -21,23 +20,22 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     </resultMap>
 
     <sql id="selectMeterDeviceVo">
-        select id, device_code, area_code, meter_cls, obj_type, obj_sub_type, obj_code, obj_tag, col_cycle, col_mode, magnification, spec_desc from adm_meter_device
+        select id, device_code, area_code, meter_cls, obj_type, obj_code, obj_tag, col_cycle, col_mode, magnification, spec_desc from adm_meter_device
     </sql>
 
     <select id="selectMeterDeviceList" parameterType="com.ruoyi.ems.domain.MeterDevice" resultMap="meterDeviceResult">
         <include refid="selectMeterDeviceVo"/>
-        <where>  
+        <where>
             <if test="deviceCode != null  and deviceCode != ''"> and device_code = #{deviceCode}</if>
             <if test="areaCode != null  and areaCode != ''"> and area_code = #{areaCode}</if>
             <if test="meterCls != null  and meterCls != ''"> and meter_cls = #{meterCls}</if>
             <if test="objType != null "> and obj_type = #{objType}</if>
-            <if test="objSubType != null "> and obj_sub_type = #{objSubType}</if>
             <if test="objCode != null  and objCode != ''"> and obj_code = #{objCode}</if>
             <if test="objTag != null  and objTag != ''"> and obj_tag = #{objTag}</if>
             <if test="colCycle != null "> and col_cycle = #{colCycle}</if>
             <if test="colMode != null "> and col_mode = #{colMode}</if>
         </where>
-        ORDER BY obj_type, obj_sub_type
+        ORDER BY obj_type
     </select>
     
     <select id="selectMeterDeviceById" parameterType="Long" resultMap="meterDeviceResult">
@@ -52,7 +50,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 
     <select id="selectMeterDeviceByObj"  resultMap="meterDeviceResult">
         <include refid="selectMeterDeviceVo"/>
-        where obj_type = #{objType} and obj_sub_type = #{objSubType} and obj_code = #{objCode} and meter_cls = #{meterCls}
+        where obj_type = #{objType} and obj_code = #{objCode} and meter_cls = #{meterCls}
     </select>
         
     <insert id="insertMeterDevice" parameterType="com.ruoyi.ems.domain.MeterDevice" useGeneratedKeys="true" keyProperty="id">
@@ -62,7 +60,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="areaCode != null and areaCode != ''">area_code,</if>
             <if test="meterCls != null and meterCls != ''">meter_cls,</if>
             <if test="objType != null">obj_type,</if>
-            <if test="objSubType != null ">obj_sub_type,</if>
             <if test="objCode != null and objCode != ''">obj_code,</if>
             <if test="objTag != null and objTag != ''">obj_tag,</if>
             <if test="colCycle != null">col_cycle,</if>
@@ -75,7 +72,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="areaCode != null and areaCode != ''">#{areaCode},</if>
             <if test="meterCls != null and meterCls != ''">#{meterCls},</if>
             <if test="objType != null">#{objType},</if>
-            <if test="objSubType != null">#{objSubType},</if>
             <if test="objCode != null and objCode != ''">#{objCode},</if>
             <if test="objTag != null and objTag != ''">#{objTag}</if>
             <if test="colCycle != null">#{colCycle},</if>
@@ -92,7 +88,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="areaCode != null and areaCode != ''">area_code = #{areaCode},</if>
             <if test="meterCls != null and meterCls != ''">meter_cls = #{meterCls},</if>
             <if test="objType != null">obj_type = #{objType},</if>
-            <if test="objSubType != null">obj_sub_type = #{objSubType},</if>
             <if test="objCode != null and objCode != ''">obj_code = #{objCode},</if>
             <if test="objTag != null and objTag != ''">obj_tag = #{objTag},</if>
             <if test="colCycle != null">col_cycle = #{colCycle},</if>

+ 2 - 10
ems-cloud/ruoyi-common/ruoyi-common-core/src/main/java/com/ruoyi/common/core/enums/AlarmObjType.java

@@ -6,16 +6,8 @@ package com.ruoyi.common.core.enums;
  * @author ruoyi
  */
 public enum AlarmObjType {
-    /**
-     * 0:园区,1:区块,2:设施,3:设备,4:配电柜
-     */
-    AREA(0, "园区"),
-    /**
-     * Zone obj type.
-     *
-     * @author chen.cheng
-     */
-    ZONE(1, "区块"),
+    // 1:区域,2:设施,3:设备,4:配电柜
+    AREA(1, "区块"),
     /**
      * Facs obj type.
      *

+ 0 - 62
ems-cloud/ruoyi-common/ruoyi-common-core/src/main/java/com/ruoyi/common/core/enums/MeterObjSubType.java

@@ -1,62 +0,0 @@
-/*
- * 文 件 名:  MeterObjSubType
- * 版    权:  浩鲸云计算科技股份有限公司
- * 描    述:  <描述>
- * 修 改 人:  lvwenbin
- * 修改时间:  2024/8/14
- * 跟踪单号:  <跟踪单号>
- * 修改单号:  <修改单号>
- * 修改内容:  <修改内容>
- */
-package com.ruoyi.common.core.enums;
-
-import org.apache.commons.lang3.StringUtils;
-
-/**
- * 计量对象
- * <功能详细描述>
- *
- * @author lvwenbin
- * @version [版本号, 2024/8/14]
- * @see [相关类/方法]
- * @since [产品/模块版本]
- */
-public enum MeterObjSubType {
-    METER_AREA(1),
-
-    METER_BUILDING(2),
-
-    METER_ZONING(3),
-
-    METER_FACS(1),
-
-    METER_DEVICE(2);
-
-    private int type;
-
-    MeterObjSubType(int type) {
-        this.type = type;
-    }
-
-    public int getType() {
-        return type;
-    }
-
-    public void setType(int type) {
-        this.type = type;
-    }
-
-    public static MeterObjSubType getByTier(String tier) {
-        if (StringUtils.equals(tier, AreaTier.Area.name())) {
-            return METER_AREA;
-        }
-        else if (StringUtils.equals(tier, AreaTier.Building.name())) {
-            return METER_BUILDING;
-        }
-        else if (StringUtils.equals(tier, AreaTier.Zoning.name())) {
-            return METER_ZONING;
-        }
-
-        return null;
-    }
-}

+ 8 - 3
ems-cloud/ruoyi-common/ruoyi-common-core/src/main/java/com/ruoyi/common/core/enums/MeterObjType.java

@@ -21,14 +21,19 @@ package com.ruoyi.common.core.enums;
  */
 public enum MeterObjType {
     /**
-     * 区域-建筑-区块
+     * 区域
      */
-    METER_ABZ(1),
+    METER_AREA(1),
+
+    /**
+     * 设施
+     */
+    METER_FACS(2),
 
     /**
      * 设备
      */
-    METER_FD(2);
+    METER_DEVC(3);
 
     private int type;
 

+ 24 - 24
ems-cloud/sql/ems_init_data.sql

@@ -607,32 +607,32 @@ INSERT INTO `adm_ems_subsystem` (`system_code`, `system_name`, `short_name`, `ma
 
 -- 能源计量设备DEMO数据
 -- 电表
-INSERT INTO `adm_meter_device` (`device_code`, `area_code`, `meter_cls`, `obj_type`, `obj_sub_type`, `obj_code`, `obj_tag`, `col_cycle`, `col_mode`, `magnification`, `spec_desc`) VALUES ('J-D-B-102', '321283124S3001', 45, 1, 3, 'B-102', 1, 4, 1, 1, '直采表');
-INSERT INTO `adm_meter_device` (`device_code`, `area_code`, `meter_cls`, `obj_type`, `obj_sub_type`, `obj_code`, `obj_tag`, `col_cycle`, `col_mode`, `magnification`, `spec_desc`) VALUES ('J-D-B-103', '321283124S3001', 45, 1, 3, 'B-103', 1, 4, 1, 1, '直采表');
-INSERT INTO `adm_meter_device` (`device_code`, `area_code`, `meter_cls`, `obj_type`, `obj_sub_type`, `obj_code`, `obj_tag`, `col_cycle`, `col_mode`, `magnification`, `spec_desc`) VALUES ('J-D-B-104', '321283124S3001', 45, 1, 3, 'B-104', 1, 4, 1, 1, '直采表');
-INSERT INTO `adm_meter_device` (`device_code`, `area_code`, `meter_cls`, `obj_type`, `obj_sub_type`, `obj_code`, `obj_tag`, `col_cycle`, `col_mode`, `magnification`, `spec_desc`) VALUES ('J-D-B-105', '321283124S3001', 45, 1, 3, 'B-105', 1, 4, 1, 1, '直采表');
-INSERT INTO `adm_meter_device` (`device_code`, `area_code`, `meter_cls`, `obj_type`, `obj_sub_type`, `obj_code`, `obj_tag`, `col_cycle`, `col_mode`, `magnification`, `spec_desc`) VALUES ('J-D-B-106', '321283124S3001', 45, 1, 3, 'B-106', 1, 4, 1, 1, '直采表');
-INSERT INTO `adm_meter_device` (`device_code`, `area_code`, `meter_cls`, `obj_type`, `obj_sub_type`, `obj_code`, `obj_tag`, `col_cycle`, `col_mode`, `magnification`, `spec_desc`) VALUES ('J-D-B-107', '321283124S3001', 45, 1, 3, 'B-107', 1, 4, 1, 1, '直采表');
-INSERT INTO `adm_meter_device` (`device_code`, `area_code`, `meter_cls`, `obj_type`, `obj_sub_type`, `obj_code`, `obj_tag`, `col_cycle`, `col_mode`, `magnification`, `spec_desc`) VALUES ('J-D-B-108', '321283124S3001', 45, 1, 3, 'B-108', 1, 4, 1, 1, '直采表');
-INSERT INTO `adm_meter_device` (`device_code`, `area_code`, `meter_cls`, `obj_type`, `obj_sub_type`, `obj_code`, `obj_tag`, `col_cycle`, `col_mode`, `magnification`, `spec_desc`) VALUES ('J-D-B-109', '321283124S3001', 45, 1, 3, 'B-109', 1, 4, 1, 1, '直采表');
-INSERT INTO `adm_meter_device` (`device_code`, `area_code`, `meter_cls`, `obj_type`, `obj_sub_type`, `obj_code`, `obj_tag`, `col_cycle`, `col_mode`, `magnification`, `spec_desc`) VALUES ('J-D-B-110', '321283124S3001', 45, 1, 3, 'B-110', 1, 4, 1, 1, '直采表');
-INSERT INTO `adm_meter_device` (`device_code`, `area_code`, `meter_cls`, `obj_type`, `obj_sub_type`, `obj_code`, `obj_tag`, `col_cycle`, `col_mode`, `magnification`, `spec_desc`) VALUES ('J-D-B-Z101', '321283124S3001', 45, 2, 1, 'Z101', 0, 4, 1, 1, '直采表');
-INSERT INTO `adm_meter_device` (`device_code`, `area_code`, `meter_cls`, `obj_type`, `obj_sub_type`, `obj_code`, `obj_tag`, `col_cycle`, `col_mode`, `magnification`, `spec_desc`) VALUES ('J-D-B-Z120', '321283124S3001', 45, 2, 1, 'Z120', 0, 4, 1, 50, '互感器表');
-
-INSERT INTO `adm_meter_device` (`device_code`, `area_code`, `meter_cls`, `obj_type`, `obj_sub_type`, `obj_code`, `obj_tag`, `col_cycle`, `col_mode`, `magnification`, `spec_desc`) VALUES ('J-D-N-101', '321283124S3002', 45, 1, 3, 'N-101', 1, 4, 1, 1, '直采表');
-INSERT INTO `adm_meter_device` (`device_code`, `area_code`, `meter_cls`, `obj_type`, `obj_sub_type`, `obj_code`, `obj_tag`, `col_cycle`, `col_mode`, `magnification`, `spec_desc`) VALUES ('J-D-N-102', '321283124S3002', 45, 1, 3, 'N-103', 1, 4, 1, 1, '直采表');
-INSERT INTO `adm_meter_device` (`device_code`, `area_code`, `meter_cls`, `obj_type`, `obj_sub_type`, `obj_code`, `obj_tag`, `col_cycle`, `col_mode`, `magnification`, `spec_desc`) VALUES ('J-D-N-103', '321283124S3002', 45, 1, 3, 'N-105', 1, 4, 1, 1, '直采表');
-INSERT INTO `adm_meter_device` (`device_code`, `area_code`, `meter_cls`, `obj_type`, `obj_sub_type`, `obj_code`, `obj_tag`, `col_cycle`, `col_mode`, `magnification`, `spec_desc`) VALUES ('J-D-N-104', '321283124S3002', 45, 1, 3, 'N-107', 1, 4, 1, 1, '直采表');
-INSERT INTO `adm_meter_device` (`device_code`, `area_code`, `meter_cls`, `obj_type`, `obj_sub_type`, `obj_code`, `obj_tag`, `col_cycle`, `col_mode`, `magnification`, `spec_desc`) VALUES ('J-D-N-105', '321283124S3002', 45, 1, 3, 'N-109', 1, 4, 1, 1, '直采表');
-INSERT INTO `adm_meter_device` (`device_code`, `area_code`, `meter_cls`, `obj_type`, `obj_sub_type`, `obj_code`, `obj_tag`, `col_cycle`, `col_mode`, `magnification`, `spec_desc`) VALUES ('J-D-N-106', '321283124S3002', 45, 1, 3, 'N-110', 1, 4, 1, 1, '直采表');
-INSERT INTO `adm_meter_device` (`device_code`, `area_code`, `meter_cls`, `obj_type`, `obj_sub_type`, `obj_code`, `obj_tag`, `col_cycle`, `col_mode`, `magnification`, `spec_desc`) VALUES ('J-D-N-107', '321283124S3002', 45, 1, 3, 'N-112', 1, 4, 1, 1, '直采表');
-INSERT INTO `adm_meter_device` (`device_code`, `area_code`, `meter_cls`, `obj_type`, `obj_sub_type`, `obj_code`, `obj_tag`, `col_cycle`, `col_mode`, `magnification`, `spec_desc`) VALUES ('J-D-N-108', '321283124S3002', 45, 1, 3, 'N-113', 1, 4, 1, 1, '直采表');
-INSERT INTO `adm_meter_device` (`device_code`, `area_code`, `meter_cls`, `obj_type`, `obj_sub_type`, `obj_code`, `obj_tag`, `col_cycle`, `col_mode`, `magnification`, `spec_desc`) VALUES ('J-D-N-109', '321283124S3002', 45, 1, 3, 'N-114', 1, 4, 1, 1, '直采表');
-INSERT INTO `adm_meter_device` (`device_code`, `area_code`, `meter_cls`, `obj_type`, `obj_sub_type`, `obj_code`, `obj_tag`, `col_cycle`, `col_mode`, `magnification`, `spec_desc`) VALUES ('J-D-N-110', '321283124S3002', 45, 1, 3, 'N-115', 0, 4, 1, 1, '直采表');
-INSERT INTO `adm_meter_device` (`device_code`, `area_code`, `meter_cls`, `obj_type`, `obj_sub_type`, `obj_code`, `obj_tag`, `col_cycle`, `col_mode`, `magnification`, `spec_desc`) VALUES ('J-D-Z010-R105-101', '321283124S3002', 45, 2, 2, 'Z010-R105-101', 0, 4, 1, 20, '互感器表');
+INSERT INTO `adm_meter_device` (`device_code`, `area_code`, `meter_cls`, `obj_type`, `obj_code`, `obj_tag`, `col_cycle`, `col_mode`, `magnification`, `spec_desc`) VALUES ('J-D-B-102', '321283124S3001', 45, 1, 'B-102', 1, 4, 1, 1, '直采表');
+INSERT INTO `adm_meter_device` (`device_code`, `area_code`, `meter_cls`, `obj_type`, `obj_code`, `obj_tag`, `col_cycle`, `col_mode`, `magnification`, `spec_desc`) VALUES ('J-D-B-103', '321283124S3001', 45, 1, 'B-103', 1, 4, 1, 1, '直采表');
+INSERT INTO `adm_meter_device` (`device_code`, `area_code`, `meter_cls`, `obj_type`, `obj_code`, `obj_tag`, `col_cycle`, `col_mode`, `magnification`, `spec_desc`) VALUES ('J-D-B-104', '321283124S3001', 45, 1, 'B-104', 1, 4, 1, 1, '直采表');
+INSERT INTO `adm_meter_device` (`device_code`, `area_code`, `meter_cls`, `obj_type`, `obj_code`, `obj_tag`, `col_cycle`, `col_mode`, `magnification`, `spec_desc`) VALUES ('J-D-B-105', '321283124S3001', 45, 1, 'B-105', 1, 4, 1, 1, '直采表');
+INSERT INTO `adm_meter_device` (`device_code`, `area_code`, `meter_cls`, `obj_type`, `obj_code`, `obj_tag`, `col_cycle`, `col_mode`, `magnification`, `spec_desc`) VALUES ('J-D-B-106', '321283124S3001', 45, 1, 'B-106', 1, 4, 1, 1, '直采表');
+INSERT INTO `adm_meter_device` (`device_code`, `area_code`, `meter_cls`, `obj_type`, `obj_code`, `obj_tag`, `col_cycle`, `col_mode`, `magnification`, `spec_desc`) VALUES ('J-D-B-107', '321283124S3001', 45, 1, 'B-107', 1, 4, 1, 1, '直采表');
+INSERT INTO `adm_meter_device` (`device_code`, `area_code`, `meter_cls`, `obj_type`, `obj_code`, `obj_tag`, `col_cycle`, `col_mode`, `magnification`, `spec_desc`) VALUES ('J-D-B-108', '321283124S3001', 45, 1, 'B-108', 1, 4, 1, 1, '直采表');
+INSERT INTO `adm_meter_device` (`device_code`, `area_code`, `meter_cls`, `obj_type`, `obj_code`, `obj_tag`, `col_cycle`, `col_mode`, `magnification`, `spec_desc`) VALUES ('J-D-B-109', '321283124S3001', 45, 1, 'B-109', 1, 4, 1, 1, '直采表');
+INSERT INTO `adm_meter_device` (`device_code`, `area_code`, `meter_cls`, `obj_type`, `obj_code`, `obj_tag`, `col_cycle`, `col_mode`, `magnification`, `spec_desc`) VALUES ('J-D-B-110', '321283124S3001', 45, 1, 'B-110', 1, 4, 1, 1, '直采表');
+INSERT INTO `adm_meter_device` (`device_code`, `area_code`, `meter_cls`, `obj_type`, `obj_code`, `obj_tag`, `col_cycle`, `col_mode`, `magnification`, `spec_desc`) VALUES ('J-D-B-Z101', '321283124S3001', 45, 3, 'Z101', 0, 4, 1, 1, '直采表');
+INSERT INTO `adm_meter_device` (`device_code`, `area_code`, `meter_cls`, `obj_type`, `obj_code`, `obj_tag`, `col_cycle`, `col_mode`, `magnification`, `spec_desc`) VALUES ('J-D-B-Z120', '321283124S3001', 45, 3, 'Z120', 0, 4, 1, 50, '互感器表');
+
+INSERT INTO `adm_meter_device` (`device_code`, `area_code`, `meter_cls`, `obj_type`, `obj_code`, `obj_tag`, `col_cycle`, `col_mode`, `magnification`, `spec_desc`) VALUES ('J-D-N-101', '321283124S3002', 45, 1, 'N-101', 1, 4, 1, 1, '直采表');
+INSERT INTO `adm_meter_device` (`device_code`, `area_code`, `meter_cls`, `obj_type`, `obj_code`, `obj_tag`, `col_cycle`, `col_mode`, `magnification`, `spec_desc`) VALUES ('J-D-N-102', '321283124S3002', 45, 1, 'N-103', 1, 4, 1, 1, '直采表');
+INSERT INTO `adm_meter_device` (`device_code`, `area_code`, `meter_cls`, `obj_type`, `obj_code`, `obj_tag`, `col_cycle`, `col_mode`, `magnification`, `spec_desc`) VALUES ('J-D-N-103', '321283124S3002', 45, 1, 'N-105', 1, 4, 1, 1, '直采表');
+INSERT INTO `adm_meter_device` (`device_code`, `area_code`, `meter_cls`, `obj_type`, `obj_code`, `obj_tag`, `col_cycle`, `col_mode`, `magnification`, `spec_desc`) VALUES ('J-D-N-104', '321283124S3002', 45, 1, 'N-107', 1, 4, 1, 1, '直采表');
+INSERT INTO `adm_meter_device` (`device_code`, `area_code`, `meter_cls`, `obj_type`, `obj_code`, `obj_tag`, `col_cycle`, `col_mode`, `magnification`, `spec_desc`) VALUES ('J-D-N-105', '321283124S3002', 45, 1, 'N-109', 1, 4, 1, 1, '直采表');
+INSERT INTO `adm_meter_device` (`device_code`, `area_code`, `meter_cls`, `obj_type`, `obj_code`, `obj_tag`, `col_cycle`, `col_mode`, `magnification`, `spec_desc`) VALUES ('J-D-N-106', '321283124S3002', 45, 1, 'N-110', 1, 4, 1, 1, '直采表');
+INSERT INTO `adm_meter_device` (`device_code`, `area_code`, `meter_cls`, `obj_type`, `obj_code`, `obj_tag`, `col_cycle`, `col_mode`, `magnification`, `spec_desc`) VALUES ('J-D-N-107', '321283124S3002', 45, 1, 'N-112', 1, 4, 1, 1, '直采表');
+INSERT INTO `adm_meter_device` (`device_code`, `area_code`, `meter_cls`, `obj_type`, `obj_code`, `obj_tag`, `col_cycle`, `col_mode`, `magnification`, `spec_desc`) VALUES ('J-D-N-108', '321283124S3002', 45, 1, 'N-113', 1, 4, 1, 1, '直采表');
+INSERT INTO `adm_meter_device` (`device_code`, `area_code`, `meter_cls`, `obj_type`, `obj_code`, `obj_tag`, `col_cycle`, `col_mode`, `magnification`, `spec_desc`) VALUES ('J-D-N-109', '321283124S3002', 45, 1, 'N-114', 1, 4, 1, 1, '直采表');
+INSERT INTO `adm_meter_device` (`device_code`, `area_code`, `meter_cls`, `obj_type`, `obj_code`, `obj_tag`, `col_cycle`, `col_mode`, `magnification`, `spec_desc`) VALUES ('J-D-N-110', '321283124S3002', 45, 1, 'N-115', 0, 4, 1, 1, '直采表');
+INSERT INTO `adm_meter_device` (`device_code`, `area_code`, `meter_cls`, `obj_type`, `obj_code`, `obj_tag`, `col_cycle`, `col_mode`, `magnification`, `spec_desc`) VALUES ('J-D-Z010-R105-101', '321283124S3002', 45, 3, 'Z010-R105-101', 0, 4, 1, 20, '互感器表');
 
 -- 水表
-INSERT INTO `adm_meter_device` (`device_code`, `area_code`, `meter_cls`, `obj_type`, `obj_sub_type`, `obj_code`, `obj_tag`, `col_cycle`, `col_mode`, `magnification`, `spec_desc`) VALUES ('J-D-B-01', '321283124S3001', 70, 1, 2, '321283124S300101', 0, 4, 1, 1, '直采表');
+INSERT INTO `adm_meter_device` (`device_code`, `area_code`, `meter_cls`, `obj_type`, `obj_code`, `obj_tag`, `col_cycle`, `col_mode`, `magnification`, `spec_desc`) VALUES ('J-D-B-01', '321283124S3001', 70, 1, 2, '321283124S300101', 0, 4, 1, 1, '直采表');
 
 -- 抄表demo数据
 INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`, `last_reading`, `last_time`, `meter_reading`, `meter_time`, `increase`, `create_time`, `update_time`) VALUES ('J-D-B-102', '321283124S3001', '2024', '202401', 0, '2024-02-29', 100, '2024-01-31', 100, NULL, NULL);

+ 0 - 1
ems-cloud/sql/ems_server.sql

@@ -553,7 +553,6 @@ create table adm_meter_device  (
   `area_code`       varchar(32)     default null                 comment '区域代码',
   `meter_cls`       int             not null                     comment '计量类别25-天然气 45-电 70-水',
   `obj_type`        int             not null                     comment '计量对象类型 1-区域 2-设备',
-  `obj_sub_type`    int             not null                     comment '计量对象子类型',
   `obj_code`        varchar(32)     not null                     comment '计量对象编码',
   `obj_tag`         int             default null                 comment '对象标记',
   `col_cycle`       int             default null                 comment '采集周期',

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

@@ -199,8 +199,7 @@ INSERT INTO sys_menu VALUES ('152',  '告警列表',       '6',    '2',  'warn-l
 INSERT INTO sys_menu VALUES ('153',  '巡检任务',       '6',    '3',  'oper-task',           'task/index',             '', 1, 0, 'C', '0', '0',    'oper-mgr:task', 'task', 'admin', '2024-08-29 15:40:27', 'admin', '2024-08-29 16:02:38', '巡检任务');
 insert into sys_menu values ('154',  '巡检报告',       '6',    '4',  'oper-report',         'task/report/index',      '', 1, 0, 'C', '0', '0',    'oper-mgr:report',        'note',           'admin', sysdate(), '', null, '巡检报告');
 
-insert into sys_menu values ('160',  '区域配置',       '7',    '1',  'areacfg',            'basecfg/area1/index',    '', 1, 0, 'C', '0', '0',   'basecfg:area:list',      'cfgwrite',       'admin', sysdate(), '', null, '区域配置');
-insert into sys_menu values ('161',  '建筑区块',       '7',    '1',  'buildingcfg',        '',                       '', 1, 0, 'M', '0', '0',   'basecfg:building',       'building',       'admin', sysdate(), '', null, '用户管理菜单');
+insert into sys_menu values ('161',  '区域配置',       '7',    '1',  'areacfg',            'basecfg/area/index',    '', 1, 0, 'C', '0', '0',   'basecfg:area:list',      'cfgwrite',       'admin', sysdate(), '', null, '区域配置');
 insert into sys_menu values ('162',  '设备设施',       '7',    '2',  'devicecfg',          '',                       '', 1, 0, 'M', '0', '0',   'basecfg:device',         'devicemgr',      'admin', sysdate(), '', null, '用户管理菜单');
 insert into sys_menu values ('163',  '能源计量',       '7',    '3',  'energycfg',          '',                       '', 1, 0, 'M', '0', '0',   'basecfg:energy',         'energy',         'admin', sysdate(), '', null, '用户管理菜单');
 insert into sys_menu values ('164',  '标签管理',       '7',    '4',  'emstag',             'basecfg/tag',            '', 1, 0, 'C', '0', '0',   'basecfg:tag:list',       'tree',           'admin', sysdate(), '', null, '标签菜单');
@@ -244,9 +243,6 @@ insert into sys_menu values ('1211',  '用能报表',   '121', '2',  'statement-
 insert into sys_menu values ('1212',  '告警报表',   '121', '3',  'statement-warn',    'analysis/statement/warn',     '', 1, 0, 'C', '0', '0',    'analysis:statement:warn',      'warn',     'admin', sysdate(), '', null, '告警报表');
 insert into sys_menu values ('1213',  '自定义',     '121', '4',  'statement-warn',    'analysis/statement/custom',   '', 1, 0, 'C', '0', '0',   'analysis:statement:custom',    'statement-zdy',   'admin', sysdate(), '', null, '自定义报表');
 -- 业务配置菜单
-insert into sys_menu values ('1610',  '地块划分',   '161', '1',  'basecfg-servicearea',    'basecfg/area/index',         '', 1, 0, 'C', '0', '0',   'basecfg:area:list',            'cfgwrite',   'admin', sysdate(), '', null, '服务区配置');
-insert into sys_menu values ('1611',  '建筑配置',   '161', '2',  'basecfg-building',       'basecfg/building/index',     '', 1, 0, 'C', '0', '0',   'basecfg:building:list',        'cfgwrite',   'admin', sysdate(), '', null, '楼宇建筑配置');
-insert into sys_menu values ('1612',  '功能分区',   '161', '3',  'basecfg-zoning',         'basecfg/zoning/index',       '', 1, 0, 'C', '0', '0',   'basecfg:zoning:list',          'cfgwrite',   'admin', sysdate(), '', null, '区块配置');
 insert into sys_menu values ('1620',  '设备模型',   '162', '1',  'basecfg-devmode',        'basecfg/device/model',      '', 1, 0, 'C', '0', '0',   'ems:devmode:list',             'cfgwrite',   'admin', sysdate(), '', null, '设备模型');
 insert into sys_menu values ('1621',  '设施分类',   '162', '2',  'basecfg-facscategory',   'basecfg/facscategory/index', '', 1, 0, 'C', '0', '0',   'basecfg:facscategory:list',    'cfgwrite',   'admin', sysdate(), '', null, '设施配置');
 insert into sys_menu values ('1622',  '能流关系',   '162', '3',  'basecfg-flowrel',        'basecfg/flowrel/index',      '', 1, 0, 'C', '0', '0',   'basecfg:flowrel:list',         'cfgwrite',   'admin', sysdate(), '', null, '设备配置');
@@ -616,9 +612,6 @@ INSERT INTO sys_role_menu (`role_id`, `menu_id`) VALUES (2, 1543);
 INSERT INTO sys_role_menu (`role_id`, `menu_id`) VALUES (2, 1544);
 INSERT INTO sys_role_menu (`role_id`, `menu_id`) VALUES (2, 1545);
 INSERT INTO sys_role_menu (`role_id`, `menu_id`) VALUES (2, 1546);
-INSERT INTO sys_role_menu (`role_id`, `menu_id`) VALUES (2, 1610);
-INSERT INTO sys_role_menu (`role_id`, `menu_id`) VALUES (2, 1611);
-INSERT INTO sys_role_menu (`role_id`, `menu_id`) VALUES (2, 1612);
 INSERT INTO sys_role_menu (`role_id`, `menu_id`) VALUES (2, 1620);
 INSERT INTO sys_role_menu (`role_id`, `menu_id`) VALUES (2, 1621);
 INSERT INTO sys_role_menu (`role_id`, `menu_id`) VALUES (2, 1622);