From a3bbdda8997fd00c11be57d0868c0a41dbef6e40 Mon Sep 17 00:00:00 2001 From: mh Date: Wed, 19 Feb 2025 19:03:09 +0800 Subject: [PATCH] =?UTF-8?q?1=E3=80=81=E6=B7=BB=E5=8A=A0=E5=8C=BA=E5=9F=9F?= =?UTF-8?q?=E3=80=81=E6=A5=BC=E6=A0=8B=E3=80=81=E6=A5=BC=E5=B1=82=E3=80=81?= =?UTF-8?q?=E6=88=BF=E9=97=B4=E4=BF=A1=E6=81=AF=E7=AE=A1=E7=90=86=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3=EF=BC=9B=202=E3=80=81=E4=BC=98=E5=8C=96=E9=87=87?= =?UTF-8?q?=E9=9B=86=E5=8F=82=E6=95=B0=EF=BC=9B=203=E3=80=81=E6=B7=BB?= =?UTF-8?q?=E5=8A=A0=E6=8A=A5=E8=AD=A6=E8=AE=B0=E5=BD=95=E4=BF=A1=E6=81=AF?= =?UTF-8?q?=E5=AE=9E=E4=BD=93=E7=B1=BB=EF=BC=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../monitor/HotWaterMonitorController.java | 52 +++++ .../monitor/IndoorTempMonitorController.java | 17 ++ .../controller/space/AreaInfoController.java | 88 ++++++++ .../space/BuildingInfoController.java | 88 ++++++++ .../controller/space/FloorInfoController.java | 88 ++++++++ .../controller/space/HouseInfoController.java | 88 ++++++++ .../src/main/resources/application-dev.yml | 2 +- .../src/main/resources/application-prod.yml | 2 +- .../src/main/resources/application-test.yml | 2 +- .../common/core/domain/dto/PumpInfoDTO.java | 75 +++++++ .../core/domain/entity/AlarmRecords.java | 165 +++++++++++++++ .../common/core/domain/entity/AlarmRules.java | 44 ++++ .../common/core/domain/entity/AreaInfo.java | 112 ++++++++++ .../core/domain/entity/BuildingInfo.java | 191 ++++++++++++++++++ .../domain/entity/CollectionParamsManage.java | 14 ++ .../common/core/domain/entity/FloorInfo.java | 95 +++++++++ .../common/core/domain/entity/HouseInfo.java | 108 ++++++++++ .../device/CollectionParamsManageMapper.java | 4 + .../mapper/device/DataProcessMapper.java | 4 + .../system/mapper/space/AreaInfoMapper.java | 16 ++ .../mapper/space/BuildingInfoMapper.java | 16 ++ .../system/mapper/space/FloorInfoMapper.java | 16 ++ .../system/mapper/space/HouseInfoMapper.java | 17 ++ .../ICollectionParamsManageService.java | 7 + .../CollectionParamsManageServiceImpl.java | 56 +++++ .../service/space/IAreaInfoService.java | 26 +++ .../service/space/IBuildingInfoService.java | 26 +++ .../service/space/IFloorInfoService.java | 26 +++ .../service/space/IHouseInfoService.java | 26 +++ .../space/impl/AreaInfoServiceImpl.java | 70 +++++++ .../space/impl/BuildingInfoServiceImpl.java | 80 ++++++++ .../space/impl/FloorInfoServiceImpl.java | 89 ++++++++ .../space/impl/HouseInfoServiceImpl.java | 99 +++++++++ sql/区域/楼栋/楼层/房间信息表.sql | 162 +++++++++++++++ sql/表结构设计.sql | 37 +++- 35 files changed, 2004 insertions(+), 4 deletions(-) create mode 100644 mh-admin/src/main/java/com/mh/web/controller/monitor/HotWaterMonitorController.java create mode 100644 mh-admin/src/main/java/com/mh/web/controller/monitor/IndoorTempMonitorController.java create mode 100644 mh-admin/src/main/java/com/mh/web/controller/space/AreaInfoController.java create mode 100644 mh-admin/src/main/java/com/mh/web/controller/space/BuildingInfoController.java create mode 100644 mh-admin/src/main/java/com/mh/web/controller/space/FloorInfoController.java create mode 100644 mh-admin/src/main/java/com/mh/web/controller/space/HouseInfoController.java create mode 100644 mh-common/src/main/java/com/mh/common/core/domain/dto/PumpInfoDTO.java create mode 100644 mh-common/src/main/java/com/mh/common/core/domain/entity/AlarmRecords.java create mode 100644 mh-common/src/main/java/com/mh/common/core/domain/entity/AreaInfo.java create mode 100644 mh-common/src/main/java/com/mh/common/core/domain/entity/BuildingInfo.java create mode 100644 mh-common/src/main/java/com/mh/common/core/domain/entity/FloorInfo.java create mode 100644 mh-common/src/main/java/com/mh/common/core/domain/entity/HouseInfo.java create mode 100644 mh-system/src/main/java/com/mh/system/mapper/space/AreaInfoMapper.java create mode 100644 mh-system/src/main/java/com/mh/system/mapper/space/BuildingInfoMapper.java create mode 100644 mh-system/src/main/java/com/mh/system/mapper/space/FloorInfoMapper.java create mode 100644 mh-system/src/main/java/com/mh/system/mapper/space/HouseInfoMapper.java create mode 100644 mh-system/src/main/java/com/mh/system/service/space/IAreaInfoService.java create mode 100644 mh-system/src/main/java/com/mh/system/service/space/IBuildingInfoService.java create mode 100644 mh-system/src/main/java/com/mh/system/service/space/IFloorInfoService.java create mode 100644 mh-system/src/main/java/com/mh/system/service/space/IHouseInfoService.java create mode 100644 mh-system/src/main/java/com/mh/system/service/space/impl/AreaInfoServiceImpl.java create mode 100644 mh-system/src/main/java/com/mh/system/service/space/impl/BuildingInfoServiceImpl.java create mode 100644 mh-system/src/main/java/com/mh/system/service/space/impl/FloorInfoServiceImpl.java create mode 100644 mh-system/src/main/java/com/mh/system/service/space/impl/HouseInfoServiceImpl.java create mode 100644 sql/区域/楼栋/楼层/房间信息表.sql diff --git a/mh-admin/src/main/java/com/mh/web/controller/monitor/HotWaterMonitorController.java b/mh-admin/src/main/java/com/mh/web/controller/monitor/HotWaterMonitorController.java new file mode 100644 index 0000000..5c000ad --- /dev/null +++ b/mh-admin/src/main/java/com/mh/web/controller/monitor/HotWaterMonitorController.java @@ -0,0 +1,52 @@ +package com.mh.web.controller.monitor; + +import com.mh.common.core.controller.BaseController; +import com.mh.common.core.domain.dto.PumpInfoDTO; +import com.mh.common.core.domain.entity.ChillersEntity; +import com.mh.common.core.page.TableDataInfo; +import com.mh.system.service.device.ICollectionParamsManageService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.RestController; + +import java.util.List; + +/** + * @author LJF + * @version 1.0 + * @project EEMCS + * @description 生活热水监控 + * @date 2025-02-17 14:23:33 + */ +@RestController +@RequestMapping("/device/hotWater") +public class HotWaterMonitorController extends BaseController { + + private final ICollectionParamsManageService iCollectionParamsManageService; + + @Autowired + public HotWaterMonitorController(ICollectionParamsManageService iCollectionParamsManageService) { + this.iCollectionParamsManageService = iCollectionParamsManageService; + } + + @GetMapping("/pumpListInfo") + public TableDataInfo list(@RequestParam("registerAddr") String registerAddr, + @RequestParam("mtType") String mtType) { + List list = iCollectionParamsManageService.selectPumpListInfo(registerAddr, mtType); + return getDataTable(list); + } + + /** + * 获取水温,压力曲线数据 + * @return + */ + @GetMapping("/lineData") + public TableDataInfo lineData(@RequestParam("registerAddr") String registerAddr, + @RequestParam("mtType") String mtType) { + List list = iCollectionParamsManageService.lineData(registerAddr, mtType); + return getDataTable(list); + } + +} diff --git a/mh-admin/src/main/java/com/mh/web/controller/monitor/IndoorTempMonitorController.java b/mh-admin/src/main/java/com/mh/web/controller/monitor/IndoorTempMonitorController.java new file mode 100644 index 0000000..684cfd6 --- /dev/null +++ b/mh-admin/src/main/java/com/mh/web/controller/monitor/IndoorTempMonitorController.java @@ -0,0 +1,17 @@ +package com.mh.web.controller.monitor; + +import com.mh.common.core.controller.BaseController; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +/** + * @author LJF + * @version 1.0 + * @project EEMCS + * @description 室内温度监测 + * @date 2025-02-18 15:43:47 + */ +@RestController +@RequestMapping("/device/indoorTemp") +public class IndoorTempMonitorController extends BaseController { +} diff --git a/mh-admin/src/main/java/com/mh/web/controller/space/AreaInfoController.java b/mh-admin/src/main/java/com/mh/web/controller/space/AreaInfoController.java new file mode 100644 index 0000000..fcda235 --- /dev/null +++ b/mh-admin/src/main/java/com/mh/web/controller/space/AreaInfoController.java @@ -0,0 +1,88 @@ +package com.mh.web.controller.space; + +import com.mh.common.annotation.Log; +import com.mh.common.core.controller.BaseController; +import com.mh.common.core.domain.AjaxResult; +import com.mh.common.core.domain.entity.AreaInfo; +import com.mh.common.core.page.TableDataInfo; +import com.mh.common.enums.BusinessType; +import com.mh.system.service.space.IAreaInfoService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; + +import java.util.List; + +/** + * @author LJF + * @version 1.0 + * @project EEMCS + * @description 区域管理 + * @date 2025-02-19 16:35:22 + */ +@RestController +@RequestMapping("/space/area") +public class AreaInfoController extends BaseController { + + @Autowired + private IAreaInfoService areaInfoService; + + /** + * 获取区域管理列表内容数据 + */ + @PreAuthorize("@ss.hasPermi('system:area:list')") + @GetMapping("/list") + public TableDataInfo list(AreaInfo areaInfo) + { + startPage(); + List list = areaInfoService.selectAreaInfoList(areaInfo); + return getDataTable(list); + } + + /** + * 根据区域管理id获取详细信息 + */ + @PreAuthorize("@ss.hasPermi('system:area:query')") + @GetMapping(value = "/{areaId}") + public AjaxResult getInfo(@PathVariable String areaId) + { + return success(areaInfoService.selectAreaInfoById(areaId)); + } + + /** + * 新增区域管理 + */ + @PreAuthorize("@ss.hasPermi('system:area:add')") + @Log(title = "区域管理管理", businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@Validated @RequestBody AreaInfo AreaInfo) + { + AreaInfo.setCreateBy(getUsername()); + return toAjax(areaInfoService.insertAreaInfo(AreaInfo)); + } + + /** + * 修改区域管理信息 + */ + @PreAuthorize("@ss.hasPermi('system:area:edit')") + @Log(title = "区域管理管理", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult edit(@Validated @RequestBody AreaInfo AreaInfo) + { + AreaInfo.setUpdateBy(getUsername()); + return toAjax(areaInfoService.updateAreaInfo(AreaInfo)); + } + + /** + * 删除区域管理管理 + */ + @PreAuthorize("@ss.hasPermi('system:area:remove')") + @Log(title = "区域管理管理", businessType = BusinessType.DELETE) + @DeleteMapping("/{areaIds}") + public AjaxResult remove(@PathVariable String[] areaIds) + { + return toAjax(areaInfoService.deleteAreaInfoByIds(areaIds)); + } + +} diff --git a/mh-admin/src/main/java/com/mh/web/controller/space/BuildingInfoController.java b/mh-admin/src/main/java/com/mh/web/controller/space/BuildingInfoController.java new file mode 100644 index 0000000..0ce7cd1 --- /dev/null +++ b/mh-admin/src/main/java/com/mh/web/controller/space/BuildingInfoController.java @@ -0,0 +1,88 @@ +package com.mh.web.controller.space; + +import com.mh.common.annotation.Log; +import com.mh.common.core.controller.BaseController; +import com.mh.common.core.domain.AjaxResult; +import com.mh.common.core.domain.entity.BuildingInfo; +import com.mh.common.core.page.TableDataInfo; +import com.mh.common.enums.BusinessType; +import com.mh.system.service.space.IBuildingInfoService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; + +import java.util.List; + +/** + * @author LJF + * @version 1.0 + * @project EEMCS + * @description 楼栋管理 + * @date 2025-02-19 16:35:22 + */ +@RestController +@RequestMapping("/space/building") +public class BuildingInfoController extends BaseController { + + @Autowired + private IBuildingInfoService buildingInfoService; + + /** + * 获取楼栋管理列表内容数据 + */ + @PreAuthorize("@ss.hasPermi('system:building:list')") + @GetMapping("/list") + public TableDataInfo list(BuildingInfo buildingInfo) + { + startPage(); + List list = buildingInfoService.selectBuildingInfoList(buildingInfo); + return getDataTable(list); + } + + /** + * 根据楼栋管理id获取详细信息 + */ + @PreAuthorize("@ss.hasPermi('system:building:query')") + @GetMapping(value = "/{buildingId}") + public AjaxResult getInfo(@PathVariable String buildingId) + { + return success(buildingInfoService.selectBuildingInfoById(buildingId)); + } + + /** + * 新增楼栋管理 + */ + @PreAuthorize("@ss.hasPermi('system:building:add')") + @Log(title = "楼栋管理管理", businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@Validated @RequestBody BuildingInfo BuildingInfo) + { + BuildingInfo.setCreateBy(getUsername()); + return toAjax(buildingInfoService.insertBuildingInfo(BuildingInfo)); + } + + /** + * 修改楼栋管理信息 + */ + @PreAuthorize("@ss.hasPermi('system:building:edit')") + @Log(title = "楼栋管理管理", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult edit(@Validated @RequestBody BuildingInfo BuildingInfo) + { + BuildingInfo.setUpdateBy(getUsername()); + return toAjax(buildingInfoService.updateBuildingInfo(BuildingInfo)); + } + + /** + * 删除楼栋管理管理 + */ + @PreAuthorize("@ss.hasPermi('system:building:remove')") + @Log(title = "楼栋管理管理", businessType = BusinessType.DELETE) + @DeleteMapping("/{buildingIds}") + public AjaxResult remove(@PathVariable String[] buildingIds) + { + return toAjax(buildingInfoService.deleteBuildingInfoByIds(buildingIds)); + } + +} diff --git a/mh-admin/src/main/java/com/mh/web/controller/space/FloorInfoController.java b/mh-admin/src/main/java/com/mh/web/controller/space/FloorInfoController.java new file mode 100644 index 0000000..fd58d5c --- /dev/null +++ b/mh-admin/src/main/java/com/mh/web/controller/space/FloorInfoController.java @@ -0,0 +1,88 @@ +package com.mh.web.controller.space; + +import com.mh.common.annotation.Log; +import com.mh.common.core.controller.BaseController; +import com.mh.common.core.domain.AjaxResult; +import com.mh.common.core.domain.entity.FloorInfo; +import com.mh.common.core.page.TableDataInfo; +import com.mh.common.enums.BusinessType; +import com.mh.system.service.space.IFloorInfoService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; + +import java.util.List; + +/** + * @author LJF + * @version 1.0 + * @project EEMCS + * @description 楼层管理 + * @date 2025-02-19 16:35:22 + */ +@RestController +@RequestMapping("/space/floor") +public class FloorInfoController extends BaseController { + + @Autowired + private IFloorInfoService floorInfoService; + + /** + * 获取楼层管理列表内容数据 + */ + @PreAuthorize("@ss.hasPermi('system:floor:list')") + @GetMapping("/list") + public TableDataInfo list(FloorInfo floorInfo) + { + startPage(); + List list = floorInfoService.selectFloorInfoList(floorInfo); + return getDataTable(list); + } + + /** + * 根据楼层管理id获取详细信息 + */ + @PreAuthorize("@ss.hasPermi('system:floor:query')") + @GetMapping(value = "/{floorId}") + public AjaxResult getInfo(@PathVariable String floorId) + { + return success(floorInfoService.selectFloorInfoById(floorId)); + } + + /** + * 新增楼层管理 + */ + @PreAuthorize("@ss.hasPermi('system:floor:add')") + @Log(title = "楼层管理管理", businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@Validated @RequestBody FloorInfo FloorInfo) + { + FloorInfo.setCreateBy(getUsername()); + return toAjax(floorInfoService.insertFloorInfo(FloorInfo)); + } + + /** + * 修改楼层管理信息 + */ + @PreAuthorize("@ss.hasPermi('system:floor:edit')") + @Log(title = "楼层管理管理", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult edit(@Validated @RequestBody FloorInfo FloorInfo) + { + FloorInfo.setUpdateBy(getUsername()); + return toAjax(floorInfoService.updateFloorInfo(FloorInfo)); + } + + /** + * 删除楼层管理管理 + */ + @PreAuthorize("@ss.hasPermi('system:floor:remove')") + @Log(title = "楼层管理管理", businessType = BusinessType.DELETE) + @DeleteMapping("/{floorIds}") + public AjaxResult remove(@PathVariable String[] floorIds) + { + return toAjax(floorInfoService.deleteFloorInfoByIds(floorIds)); + } + +} diff --git a/mh-admin/src/main/java/com/mh/web/controller/space/HouseInfoController.java b/mh-admin/src/main/java/com/mh/web/controller/space/HouseInfoController.java new file mode 100644 index 0000000..5b1840f --- /dev/null +++ b/mh-admin/src/main/java/com/mh/web/controller/space/HouseInfoController.java @@ -0,0 +1,88 @@ +package com.mh.web.controller.space; + +import com.mh.common.annotation.Log; +import com.mh.common.core.controller.BaseController; +import com.mh.common.core.domain.AjaxResult; +import com.mh.common.core.domain.entity.HouseInfo; +import com.mh.common.core.page.TableDataInfo; +import com.mh.common.enums.BusinessType; +import com.mh.system.service.space.IHouseInfoService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; + +import java.util.List; + +/** + * @author LJF + * @version 1.0 + * @project EEMCS + * @description 房间管理 + * @date 2025-02-19 16:35:22 + */ +@RestController +@RequestMapping("/space/house") +public class HouseInfoController extends BaseController { + + @Autowired + private IHouseInfoService houseInfoService; + + /** + * 获取房间列表内容数据 + */ + @PreAuthorize("@ss.hasPermi('system:house:list')") + @GetMapping("/list") + public TableDataInfo list(HouseInfo houseInfo) + { + startPage(); + List list = houseInfoService.selectHouseInfoList(houseInfo); + return getDataTable(list); + } + + /** + * 根据房间id获取详细信息 + */ + @PreAuthorize("@ss.hasPermi('system:house:query')") + @GetMapping(value = "/{houseId}") + public AjaxResult getInfo(@PathVariable String houseId) + { + return success(houseInfoService.selectHouseInfoById(houseId)); + } + + /** + * 新增房间 + */ + @PreAuthorize("@ss.hasPermi('system:house:add')") + @Log(title = "房间信息管理", businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@Validated @RequestBody HouseInfo HouseInfo) + { + HouseInfo.setCreateBy(getUsername()); + return toAjax(houseInfoService.insertHouseInfo(HouseInfo)); + } + + /** + * 修改房间信息 + */ + @PreAuthorize("@ss.hasPermi('system:house:edit')") + @Log(title = "房间信息管理", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult edit(@Validated @RequestBody HouseInfo HouseInfo) + { + HouseInfo.setUpdateBy(getUsername()); + return toAjax(houseInfoService.updateHouseInfo(HouseInfo)); + } + + /** + * 删除房间信息管理 + */ + @PreAuthorize("@ss.hasPermi('system:house:remove')") + @Log(title = "房间信息管理", businessType = BusinessType.DELETE) + @DeleteMapping("/{houseIds}") + public AjaxResult remove(@PathVariable String[] houseIds) + { + return toAjax(houseInfoService.deleteHouseInfoByIds(houseIds)); + } + +} diff --git a/mh-admin/src/main/resources/application-dev.yml b/mh-admin/src/main/resources/application-dev.yml index 0b7c6f7..c9f729d 100644 --- a/mh-admin/src/main/resources/application-dev.yml +++ b/mh-admin/src/main/resources/application-dev.yml @@ -54,7 +54,7 @@ spring: devtools: restart: # 热部署开关 - enabled: true + enabled: false data: # redis 配置 redis: diff --git a/mh-admin/src/main/resources/application-prod.yml b/mh-admin/src/main/resources/application-prod.yml index 0b7c6f7..c9f729d 100644 --- a/mh-admin/src/main/resources/application-prod.yml +++ b/mh-admin/src/main/resources/application-prod.yml @@ -54,7 +54,7 @@ spring: devtools: restart: # 热部署开关 - enabled: true + enabled: false data: # redis 配置 redis: diff --git a/mh-admin/src/main/resources/application-test.yml b/mh-admin/src/main/resources/application-test.yml index 0b7c6f7..c9f729d 100644 --- a/mh-admin/src/main/resources/application-test.yml +++ b/mh-admin/src/main/resources/application-test.yml @@ -54,7 +54,7 @@ spring: devtools: restart: # 热部署开关 - enabled: true + enabled: false data: # redis 配置 redis: diff --git a/mh-common/src/main/java/com/mh/common/core/domain/dto/PumpInfoDTO.java b/mh-common/src/main/java/com/mh/common/core/domain/dto/PumpInfoDTO.java new file mode 100644 index 0000000..ee5399a --- /dev/null +++ b/mh-common/src/main/java/com/mh/common/core/domain/dto/PumpInfoDTO.java @@ -0,0 +1,75 @@ +package com.mh.common.core.domain.dto; + +import org.apache.commons.lang3.builder.ToStringBuilder; + +/** + * @author LJF + * @version 1.0 + * @project EEMCS + * @description 返回热泵信息内容 + * @date 2025-02-17 14:39:44 + */ +public class PumpInfoDTO { + + /** + * 名称 + */ + private String name; + + /** + * 开关状态 + */ + private String switchStatus; + + /** + * 控制状态 + */ + private String controlStatus; + + /** + * 报警状态 + */ + private String alertStatus; + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getSwitchStatus() { + return switchStatus; + } + + public void setSwitchStatus(String switchStatus) { + this.switchStatus = switchStatus; + } + + public String getControlStatus() { + return controlStatus; + } + + public void setControlStatus(String controlStatus) { + this.controlStatus = controlStatus; + } + + public String getAlertStatus() { + return alertStatus; + } + + public void setAlertStatus(String alertStatus) { + this.alertStatus = alertStatus; + } + + @Override + public String toString() { + return new ToStringBuilder(this) + .append("name", name) + .append("switchStatus", switchStatus) + .append("controlStatus", controlStatus) + .append("alertStatus", alertStatus) + .toString(); + } +} diff --git a/mh-common/src/main/java/com/mh/common/core/domain/entity/AlarmRecords.java b/mh-common/src/main/java/com/mh/common/core/domain/entity/AlarmRecords.java new file mode 100644 index 0000000..7618aa8 --- /dev/null +++ b/mh-common/src/main/java/com/mh/common/core/domain/entity/AlarmRecords.java @@ -0,0 +1,165 @@ +package com.mh.common.core.domain.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import org.apache.commons.lang3.builder.ToStringBuilder; + +import java.io.Serializable; + +/** + * @author LJF + * @version 1.0 + * @project EEMCS + * @description 报警实时记录表 + * @date 2025-02-18 11:45:49 + */ +@TableName("alarm_records") +public class AlarmRecords implements Serializable { + + private static final long serialVersionUID = 100L; + + @TableId(value = "id", type = IdType.ASSIGN_UUID) + private String id; + + /** + * 报警内容 + */ + private String content; + + /** + * 创建时间 + */ + private String createTime; + + /** + * 报警类型 + */ + private String alarmType; + + /** + * 事件类型 + */ + private String eventType; + + /** + * 报警级别 + */ + private String alarmLevel; + + /** + * 设备编号 + */ + private String ledgerId; + + /** + * 设备名称 + */ + private String deviceName; + + /** + * 通讯参数id + */ + private String cpmId; + + /** + * 通讯参数名称 + */ + private String cpmName; + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getContent() { + return content; + } + + public void setContent(String content) { + this.content = content; + } + + public String getCreateTime() { + return createTime; + } + + public void setCreateTime(String createTime) { + this.createTime = createTime; + } + + public String getAlarmType() { + return alarmType; + } + + public void setAlarmType(String alarmType) { + this.alarmType = alarmType; + } + + public String getEventType() { + return eventType; + } + + public void setEventType(String eventType) { + this.eventType = eventType; + } + + public String getAlarmLevel() { + return alarmLevel; + } + + public void setAlarmLevel(String alarmLevel) { + this.alarmLevel = alarmLevel; + } + + public String getLedgerId() { + return ledgerId; + } + + public void setLedgerId(String ledgerId) { + this.ledgerId = ledgerId; + } + + public String getDeviceName() { + return deviceName; + } + + public void setDeviceName(String deviceName) { + this.deviceName = deviceName; + } + + public String getCpmId() { + return cpmId; + } + + public void setCpmId(String cpmId) { + this.cpmId = cpmId; + } + + public String getCpmName() { + return cpmName; + } + + public void setCpmName(String cpmName) { + this.cpmName = cpmName; + } + + @Override + public String toString() { + return new ToStringBuilder(this) + .append("id", id) + .append("content", content) + .append("createTime", createTime) + .append("alarmType", alarmType) + .append("eventType", eventType) + .append("alarmLevel", alarmLevel) + .append("ledgerId", ledgerId) + .append("deviceName", deviceName) + .append("cpmId", cpmId) + .append("cpmName", cpmName) + .toString(); + } +} diff --git a/mh-common/src/main/java/com/mh/common/core/domain/entity/AlarmRules.java b/mh-common/src/main/java/com/mh/common/core/domain/entity/AlarmRules.java index 9c84761..6daae6a 100644 --- a/mh-common/src/main/java/com/mh/common/core/domain/entity/AlarmRules.java +++ b/mh-common/src/main/java/com/mh/common/core/domain/entity/AlarmRules.java @@ -1,12 +1,15 @@ package com.mh.common.core.domain.entity; import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableName; +import com.fasterxml.jackson.annotation.JsonInclude; import com.mh.common.core.domain.BaseEntity; import org.apache.commons.lang3.builder.ToStringBuilder; import java.util.Date; +import java.util.Map; /** * @author LJF @@ -116,6 +119,47 @@ public class AlarmRules extends BaseEntity { */ private String energyType; + /** + * 状态:0:已启用,1:未启用 + */ + private Integer status; + + @TableField(exist = false) + private String searchValue; + + /** 请求参数 */ + @TableField(exist = false) + @JsonInclude(JsonInclude.Include.NON_EMPTY) + private Map params; + + public Integer getStatus() { + return status; + } + + public void setStatus(Integer status) { + this.status = status; + } + + @Override + public String getSearchValue() { + return searchValue; + } + + @Override + public void setSearchValue(String searchValue) { + this.searchValue = searchValue; + } + + @Override + public Map getParams() { + return params; + } + + @Override + public void setParams(Map params) { + this.params = params; + } + public String getId() { return id; } diff --git a/mh-common/src/main/java/com/mh/common/core/domain/entity/AreaInfo.java b/mh-common/src/main/java/com/mh/common/core/domain/entity/AreaInfo.java new file mode 100644 index 0000000..c387e46 --- /dev/null +++ b/mh-common/src/main/java/com/mh/common/core/domain/entity/AreaInfo.java @@ -0,0 +1,112 @@ +package com.mh.common.core.domain.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.mh.common.core.domain.BaseEntity; +import org.apache.commons.lang3.builder.ToStringBuilder; + +import java.util.Map; + +/** + * @author LJF + * @version 1.0 + * @project EEMCS + * @description 区域表 + * @date 2025-02-19 15:40:10 + */ +@TableName("area_info") +public class AreaInfo extends BaseEntity { + + @TableId(value = "id", type = IdType.ASSIGN_UUID) + private String id; + + /** + * 区域名称 + */ + private String areaName; + + /** + * 排序 + */ + private Integer orderNum; + + /** + * 父级区域ID + */ + private String parentId; + + @TableField(exist = false) + private String searchValue; + + /** 请求参数 */ + @TableField(exist = false) + @JsonInclude(JsonInclude.Include.NON_EMPTY) + private Map params; + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getAreaName() { + return areaName; + } + + public void setAreaName(String areaName) { + this.areaName = areaName; + } + + public Integer getOrderNum() { + return orderNum; + } + + public void setOrderNum(Integer orderNum) { + this.orderNum = orderNum; + } + + public String getParentId() { + return parentId; + } + + public void setParentId(String parentId) { + this.parentId = parentId; + } + + @Override + public String getSearchValue() { + return searchValue; + } + + @Override + public void setSearchValue(String searchValue) { + this.searchValue = searchValue; + } + + @Override + public Map getParams() { + return params; + } + + @Override + public void setParams(Map params) { + this.params = params; + } + + @Override + public String toString() { + return new ToStringBuilder(this) + .append("id", id) + .append("areaName", areaName) + .append("orderNum", orderNum) + .append("parentId", parentId) + .append("searchValue", searchValue) + .append("params", params) + .toString(); + } +} diff --git a/mh-common/src/main/java/com/mh/common/core/domain/entity/BuildingInfo.java b/mh-common/src/main/java/com/mh/common/core/domain/entity/BuildingInfo.java new file mode 100644 index 0000000..ac00daf --- /dev/null +++ b/mh-common/src/main/java/com/mh/common/core/domain/entity/BuildingInfo.java @@ -0,0 +1,191 @@ +package com.mh.common.core.domain.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.mh.common.core.domain.BaseEntity; +import org.apache.commons.lang3.builder.ToStringBuilder; + +import java.math.BigDecimal; +import java.util.Map; + +/** + * @author LJF + * @version 1.0 + * @project EEMCS + * @description 楼栋信息 + * @date 2025-02-19 15:49:33 + */ +@TableName("building_info") +public class BuildingInfo extends BaseEntity { + + @TableId(value = "id", type = IdType.ASSIGN_UUID) + private String id; // 楼栋唯一标识符,作为主键使用。 + private String buildingName; // 楼栋名称,用于标识具体的楼栋。 + private String parentId; // 父级楼栋id,默认值为"0",表示顶级楼栋。 + private Integer levelsCount; // 楼层数量,表示该楼栋有多少层。 + private Integer beginLevel; // 起始楼层号,表示楼栋的第一层编号。 + private Integer houseCount; // 每层房间数,记录每层楼有多少个房间。 + private Integer bedCount; // 床位总数,记录楼栋内的总床位数量。 + private Integer checkInCount; // 实际入住数,记录当前已入住的人数或床位数。 + private String areaId; // 区域id,标识楼栋所属的地理或管理区域。 + private Integer orderNum; // 排序号,用于定义楼栋显示顺序。 + private BigDecimal tankHeight; // 水箱高度,记录楼栋内水箱的高度信息。 + private Integer pumpCount; // 水泵数量,记录楼栋内安装的水泵数量。 + private BigDecimal lowTankHeight; // 低区水箱高度,记录低区水箱的具体高度。 + + @TableField(exist = false) + private String searchValue; + + /** 请求参数 */ + @TableField(exist = false) + @JsonInclude(JsonInclude.Include.NON_EMPTY) + private Map params; + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getBuildingName() { + return buildingName; + } + + public void setBuildingName(String buildingName) { + this.buildingName = buildingName; + } + + public String getParentId() { + return parentId; + } + + public void setParentId(String parentId) { + this.parentId = parentId; + } + + public Integer getLevelsCount() { + return levelsCount; + } + + public void setLevelsCount(Integer levelsCount) { + this.levelsCount = levelsCount; + } + + public Integer getBeginLevel() { + return beginLevel; + } + + public void setBeginLevel(Integer beginLevel) { + this.beginLevel = beginLevel; + } + + public Integer getHouseCount() { + return houseCount; + } + + public void setHouseCount(Integer houseCount) { + this.houseCount = houseCount; + } + + public Integer getBedCount() { + return bedCount; + } + + public void setBedCount(Integer bedCount) { + this.bedCount = bedCount; + } + + public Integer getCheckInCount() { + return checkInCount; + } + + public void setCheckInCount(Integer checkInCount) { + this.checkInCount = checkInCount; + } + + public String getAreaId() { + return areaId; + } + + public void setAreaId(String areaId) { + this.areaId = areaId; + } + + public Integer getOrderNum() { + return orderNum; + } + + public void setOrderNum(Integer orderNum) { + this.orderNum = orderNum; + } + + public BigDecimal getTankHeight() { + return tankHeight; + } + + public void setTankHeight(BigDecimal tankHeight) { + this.tankHeight = tankHeight; + } + + public Integer getPumpCount() { + return pumpCount; + } + + public void setPumpCount(Integer pumpCount) { + this.pumpCount = pumpCount; + } + + public BigDecimal getLowTankHeight() { + return lowTankHeight; + } + + public void setLowTankHeight(BigDecimal lowTankHeight) { + this.lowTankHeight = lowTankHeight; + } + + @Override + public String getSearchValue() { + return searchValue; + } + + @Override + public void setSearchValue(String searchValue) { + this.searchValue = searchValue; + } + + @Override + public Map getParams() { + return params; + } + + @Override + public void setParams(Map params) { + this.params = params; + } + + @Override + public String toString() { + return new ToStringBuilder(this) + .append("id", id) + .append("buildingName", buildingName) + .append("parentId", parentId) + .append("levelsCount", levelsCount) + .append("beginLevel", beginLevel) + .append("houseCount", houseCount) + .append("bedCount", bedCount) + .append("checkInCount", checkInCount) + .append("areaId", areaId) + .append("orderNum", orderNum) + .append("tankHeight", tankHeight) + .append("pumpCount", pumpCount) + .append("lowTankHeight", lowTankHeight) + .append("searchValue", searchValue) + .append("params", params) + .toString(); + } +} diff --git a/mh-common/src/main/java/com/mh/common/core/domain/entity/CollectionParamsManage.java b/mh-common/src/main/java/com/mh/common/core/domain/entity/CollectionParamsManage.java index aac07fe..12500f2 100644 --- a/mh-common/src/main/java/com/mh/common/core/domain/entity/CollectionParamsManage.java +++ b/mh-common/src/main/java/com/mh/common/core/domain/entity/CollectionParamsManage.java @@ -171,6 +171,19 @@ public class CollectionParamsManage extends BaseEntity { */ private String systemType; + /** + * 采集类别:0:遥测(连续变化参数),1:遥信(离散开关状态) + */ + private String collectionType; + + public String getCollectionType() { + return collectionType; + } + + public void setCollectionType(String collectionType) { + this.collectionType = collectionType; + } + public String getParamType() { return paramType; } @@ -457,6 +470,7 @@ public class CollectionParamsManage extends BaseEntity { .append("params", params) .append("paramType", paramType) .append("systemType", systemType) + .append("collectionType", collectionType) .toString(); } } diff --git a/mh-common/src/main/java/com/mh/common/core/domain/entity/FloorInfo.java b/mh-common/src/main/java/com/mh/common/core/domain/entity/FloorInfo.java new file mode 100644 index 0000000..7a68b54 --- /dev/null +++ b/mh-common/src/main/java/com/mh/common/core/domain/entity/FloorInfo.java @@ -0,0 +1,95 @@ +package com.mh.common.core.domain.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.mh.common.core.domain.BaseEntity; +import lombok.Getter; +import lombok.Setter; +import org.apache.commons.lang3.builder.ToStringBuilder; + +import java.math.BigDecimal; +import java.util.Map; + +/** + * @author LJF + * @version 1.0 + * @project EEMCS + * @description 楼层信息表 + * @date 2025-02-19 16:00:57 + */ +@Setter +@Getter +@TableName("floor_info") +public class FloorInfo extends BaseEntity { + + @TableId(value = "id", type = IdType.ASSIGN_UUID) + private String id; + + /** + * 区域id + */ + private String areaId; + + /** + * 楼栋id + */ + private String buildingId; + + /** + * 楼层名称 + */ + private String floorName; + + /** + * 楼层编号 + */ + private Integer floorNum; + + /** + * 楼层用处 + */ + private String floorPurpose; + + /** + * 楼层面积 + */ + private BigDecimal floorArea; + + /** + * 排序 + */ + private Integer orderNum; + + /** + * 父id + */ + private String parentId = "0"; + + @TableField(exist = false) + private String searchValue; + + /** 请求参数 */ + @TableField(exist = false) + @JsonInclude(JsonInclude.Include.NON_EMPTY) + private Map params; + + @Override + public String toString() { + return new ToStringBuilder(this) + .append("id", id) + .append("areaId", areaId) + .append("buildingId", buildingId) + .append("floorName", floorName) + .append("floorNum", floorNum) + .append("floorPurpose", floorPurpose) + .append("floorArea", floorArea) + .append("orderNum", orderNum) + .append("parentId", parentId) + .append("searchValue", searchValue) + .append("params", params) + .toString(); + } +} diff --git a/mh-common/src/main/java/com/mh/common/core/domain/entity/HouseInfo.java b/mh-common/src/main/java/com/mh/common/core/domain/entity/HouseInfo.java new file mode 100644 index 0000000..1781852 --- /dev/null +++ b/mh-common/src/main/java/com/mh/common/core/domain/entity/HouseInfo.java @@ -0,0 +1,108 @@ +package com.mh.common.core.domain.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.mh.common.core.domain.BaseEntity; +import lombok.Getter; +import lombok.Setter; +import org.apache.commons.lang3.builder.ToStringBuilder; + +import java.math.BigDecimal; +import java.util.Map; + +/** + * @author LJF + * @version 1.0 + * @project EEMCS + * @description 房间信息表 + * @date 2025-02-19 16:13:15 + */ +@Setter +@Getter +@TableName("house_info") +public class HouseInfo extends BaseEntity { + + @TableId(value = "id", type = IdType.ASSIGN_UUID) + private String id; + + /** + * 区域id + */ + private String areaId; + + /** + * 楼栋id + */ + private String buildingId; + + /** + * 楼层id + */ + private String floorId; + + /** + * 房间名称 + */ + private String houseName; + + /** + * 房屋详细地址 + */ + private String address; + + /** + * 房屋价格,保留两位小数 + */ + private BigDecimal price; + + /** + * 房屋总面积 + */ + private BigDecimal totalArea; + + /** + * 房屋使用面积(可居住部分) + */ + private BigDecimal usableArea; + + /** + *建造年份 + */ + private String builtYear; + + /** + * 0:正常,1:禁用 + */ + private Integer status; + + @TableField(exist = false) + private String searchValue; + + /** 请求参数 */ + @TableField(exist = false) + @JsonInclude(JsonInclude.Include.NON_EMPTY) + private Map params; + + @Override + public String toString() { + return new ToStringBuilder(this) + .append("id", id) + .append("areaId", areaId) + .append("buildingId", buildingId) + .append("floorId", floorId) + .append("houseName", houseName) + .append("address", address) + .append("price", price) + .append("totalArea", totalArea) + .append("usableArea", usableArea) + .append("builtYear", builtYear) + .append("status", status) + .append("searchValue", searchValue) + .append("params", params) + .toString(); + } + +} diff --git a/mh-system/src/main/java/com/mh/system/mapper/device/CollectionParamsManageMapper.java b/mh-system/src/main/java/com/mh/system/mapper/device/CollectionParamsManageMapper.java index eabaeca..ca3c898 100644 --- a/mh-system/src/main/java/com/mh/system/mapper/device/CollectionParamsManageMapper.java +++ b/mh-system/src/main/java/com/mh/system/mapper/device/CollectionParamsManageMapper.java @@ -50,4 +50,8 @@ public interface CollectionParamsManageMapper extends BaseMapper= #{grade} and grade < #{grade}+20 and mt_type like concat('%',#{mtType},'%') ") int selectSummary(@Param("grade") int grade, @Param("mtType") String deviceType); + + @Select("select id from collection_params_manage where mt_code = #{registerAddr} and mt_type = #{mtType} limit 1 ") + String selectIdByMtCodeAndType(@Param("registerAddr") String registerAddr, + @Param("mtType") String mtType); } diff --git a/mh-system/src/main/java/com/mh/system/mapper/device/DataProcessMapper.java b/mh-system/src/main/java/com/mh/system/mapper/device/DataProcessMapper.java index 2d15fe7..25fb657 100644 --- a/mh-system/src/main/java/com/mh/system/mapper/device/DataProcessMapper.java +++ b/mh-system/src/main/java/com/mh/system/mapper/device/DataProcessMapper.java @@ -1,5 +1,6 @@ package com.mh.system.mapper.device; +import com.mh.common.core.domain.entity.ChillersEntity; import com.mh.common.core.domain.entity.CollectionParamsManage; import com.mh.common.core.domain.entity.DeviceReport; import org.apache.ibatis.annotations.*; @@ -170,4 +171,7 @@ public interface DataProcessMapper { @Select("select mt_init_value from collection_params_manage where mt_num = #{deviceNum}") String queryInitValue(String deviceNum); + @Select("select * from ${tableName} where register_id = #{registerId} and cur_time >= CURRENT_TIMESTAMP - INTERVAL '24 hours' ") + List selectLineDataByCodeAndRegisterAddr(@Param("tableName") String tableName, + @Param("registerId") String registerId); } diff --git a/mh-system/src/main/java/com/mh/system/mapper/space/AreaInfoMapper.java b/mh-system/src/main/java/com/mh/system/mapper/space/AreaInfoMapper.java new file mode 100644 index 0000000..d702504 --- /dev/null +++ b/mh-system/src/main/java/com/mh/system/mapper/space/AreaInfoMapper.java @@ -0,0 +1,16 @@ +package com.mh.system.mapper.space; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.mh.common.core.domain.entity.AreaInfo; +import org.apache.ibatis.annotations.Mapper; + +/** + * @author LJF + * @version 1.0 + * @project EEMCS + * @description 区域管理 + * @date 2025-02-19 18:41:31 + */ +@Mapper +public interface AreaInfoMapper extends BaseMapper { +} diff --git a/mh-system/src/main/java/com/mh/system/mapper/space/BuildingInfoMapper.java b/mh-system/src/main/java/com/mh/system/mapper/space/BuildingInfoMapper.java new file mode 100644 index 0000000..02b49f0 --- /dev/null +++ b/mh-system/src/main/java/com/mh/system/mapper/space/BuildingInfoMapper.java @@ -0,0 +1,16 @@ +package com.mh.system.mapper.space; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.mh.common.core.domain.entity.BuildingInfo; +import org.apache.ibatis.annotations.Mapper; + +/** + * @author LJF + * @version 1.0 + * @project EEMCS + * @description 楼栋管理 + * @date 2025-02-19 18:41:31 + */ +@Mapper +public interface BuildingInfoMapper extends BaseMapper { +} diff --git a/mh-system/src/main/java/com/mh/system/mapper/space/FloorInfoMapper.java b/mh-system/src/main/java/com/mh/system/mapper/space/FloorInfoMapper.java new file mode 100644 index 0000000..9791fd8 --- /dev/null +++ b/mh-system/src/main/java/com/mh/system/mapper/space/FloorInfoMapper.java @@ -0,0 +1,16 @@ +package com.mh.system.mapper.space; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.mh.common.core.domain.entity.FloorInfo; +import org.apache.ibatis.annotations.Mapper; + +/** + * @author LJF + * @version 1.0 + * @project EEMCS + * @description 楼层管理 + * @date 2025-02-19 18:41:31 + */ +@Mapper +public interface FloorInfoMapper extends BaseMapper { +} diff --git a/mh-system/src/main/java/com/mh/system/mapper/space/HouseInfoMapper.java b/mh-system/src/main/java/com/mh/system/mapper/space/HouseInfoMapper.java new file mode 100644 index 0000000..988eb1b --- /dev/null +++ b/mh-system/src/main/java/com/mh/system/mapper/space/HouseInfoMapper.java @@ -0,0 +1,17 @@ +package com.mh.system.mapper.space; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.mh.common.core.domain.entity.FloorInfo; +import com.mh.common.core.domain.entity.HouseInfo; +import org.apache.ibatis.annotations.Mapper; + +/** + * @author LJF + * @version 1.0 + * @project EEMCS + * @description 房间管理 + * @date 2025-02-19 18:41:31 + */ +@Mapper +public interface HouseInfoMapper extends BaseMapper { +} diff --git a/mh-system/src/main/java/com/mh/system/service/device/ICollectionParamsManageService.java b/mh-system/src/main/java/com/mh/system/service/device/ICollectionParamsManageService.java index 230db69..620e14b 100644 --- a/mh-system/src/main/java/com/mh/system/service/device/ICollectionParamsManageService.java +++ b/mh-system/src/main/java/com/mh/system/service/device/ICollectionParamsManageService.java @@ -1,9 +1,12 @@ package com.mh.system.service.device; +import com.mh.common.core.domain.dto.PumpInfoDTO; +import com.mh.common.core.domain.entity.ChillersEntity; import com.mh.common.core.domain.entity.CollectionParamsManage; import java.util.ArrayList; import java.util.List; +import java.util.Map; /** * @author LJF @@ -29,4 +32,8 @@ public interface ICollectionParamsManageService { List queryCollectionParamsByMtType(String mtType); void updateCollectionParamsManages(ArrayList chillersEntities); + + List selectPumpListInfo(String registerAddr, String mtType); + + List lineData(String registerAddr, String mtType); } diff --git a/mh-system/src/main/java/com/mh/system/service/device/impl/CollectionParamsManageServiceImpl.java b/mh-system/src/main/java/com/mh/system/service/device/impl/CollectionParamsManageServiceImpl.java index 1e4ff72..30958e8 100644 --- a/mh-system/src/main/java/com/mh/system/service/device/impl/CollectionParamsManageServiceImpl.java +++ b/mh-system/src/main/java/com/mh/system/service/device/impl/CollectionParamsManageServiceImpl.java @@ -1,9 +1,14 @@ package com.mh.system.service.device.impl; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.mh.common.core.domain.dto.PumpInfoDTO; +import com.mh.common.core.domain.entity.ChillersEntity; import com.mh.common.core.domain.entity.CollectionParamsManage; +import com.mh.common.core.domain.entity.DeviceLedger; +import com.mh.common.utils.DateUtils; import com.mh.common.utils.StringUtils; import com.mh.system.mapper.device.CollectionParamsManageMapper; +import com.mh.system.mapper.device.DataProcessMapper; import com.mh.system.mapper.device.DeviceLedgerMapper; import com.mh.system.mapper.device.GatewayManageMapper; import com.mh.system.service.device.ICollectionParamsManageService; @@ -12,6 +17,7 @@ import org.springframework.stereotype.Service; import java.util.ArrayList; import java.util.List; +import java.util.Map; /** * @author LJF @@ -32,6 +38,9 @@ public class CollectionParamsManageServiceImpl implements ICollectionParamsManag @Resource private GatewayManageMapper gatewayManageMapper; + @Resource + private DataProcessMapper dataProcessMapper; + @Override public List selectCollectionParamsManageList(CollectionParamsManage communicationParams) { if (communicationParams == null) { @@ -58,6 +67,10 @@ public class CollectionParamsManageServiceImpl implements ICollectionParamsManag if (!StringUtils.isEmpty(communicationParams.getParamType())) { queryWrapper.eq("param_type", communicationParams.getParamType()); } + // 根据备注查询 + if (!StringUtils.isEmpty(communicationParams.getRemark())) { + queryWrapper.like("remark", communicationParams.getRemark()); + } queryWrapper.orderByDesc("cur_time"); return collectionParamsManageMapper.selectList(queryWrapper); } @@ -128,4 +141,47 @@ public class CollectionParamsManageServiceImpl implements ICollectionParamsManag gatewayManageMapper.updateOnlineStatus(gatewayId); }); } + + @Override + public List selectPumpListInfo(String registerAddr, String mtType) { + CollectionParamsManage collectionParamsManage = new CollectionParamsManage(); + collectionParamsManage.setRemark(registerAddr); + collectionParamsManage.setMtType(mtType); + List collectionParamsManages = selectCollectionParamsManageList(collectionParamsManage); + // 根据设备台账id,分离出对应的设备信息 + List pumpInfoDTOS = collectionParamsManages.stream().map(collectionParamsManage1 -> { + PumpInfoDTO pumpInfoDTO = new PumpInfoDTO(); + // 根据设备台账id,获取设备名称 + DeviceLedger deviceLedger = deviceLedgerMapper.selectById(collectionParamsManage1.getDeviceLedgerId()); + pumpInfoDTO.setName(deviceLedger.getDeviceName()); + // 根据别称进行赋值 + String otherName = collectionParamsManage1.getOtherName(); + if (otherName.contains("开关状态")) { + pumpInfoDTO.setSwitchStatus(collectionParamsManage1.getCurValue().toString()); + } else if (otherName.contains("控制状态")) { + pumpInfoDTO.setControlStatus(collectionParamsManage1.getCurValue().toString()); + } else if (otherName.contains("报警状态")) { + pumpInfoDTO.setAlertStatus(collectionParamsManage1.getCurValue().toString()); + } + return pumpInfoDTO; + }).toList(); + if (!pumpInfoDTOS.isEmpty()) { + return pumpInfoDTOS; + } + return List.of(); + } + + @Override + public List lineData(String registerAddr, String mtType) { + // 根据device_code, register_ address 查询出对应的官网压力,水温 + // 截取当前时间yyyy + String now = DateUtils.getTime(); + String tableName = "chillers_data_min" + now.substring(0, 4); + String registerId = collectionParamsManageMapper.selectIdByMtCodeAndType(registerAddr, mtType); + List chillersEntities = dataProcessMapper.selectLineDataByCodeAndRegisterAddr(tableName, registerId); + if (chillersEntities.isEmpty()) { + return List.of(); + } + return chillersEntities; + } } diff --git a/mh-system/src/main/java/com/mh/system/service/space/IAreaInfoService.java b/mh-system/src/main/java/com/mh/system/service/space/IAreaInfoService.java new file mode 100644 index 0000000..e9b9df2 --- /dev/null +++ b/mh-system/src/main/java/com/mh/system/service/space/IAreaInfoService.java @@ -0,0 +1,26 @@ +package com.mh.system.service.space; + +import com.mh.common.core.domain.entity.AreaInfo; + +import java.util.List; + +/** + * @author LJF + * @version 1.0 + * @project EEMCS + * @description 区域管理 + * @date 2025-02-19 16:37:19 + */ +public interface IAreaInfoService { + + List selectAreaInfoList(AreaInfo ledgerInfo); + + AreaInfo selectAreaInfoById(String ledgerId); + + int insertAreaInfo(AreaInfo gatewayManage); + + int updateAreaInfo(AreaInfo gatewayManage); + + int deleteAreaInfoByIds(String[] ledgerIds); + +} diff --git a/mh-system/src/main/java/com/mh/system/service/space/IBuildingInfoService.java b/mh-system/src/main/java/com/mh/system/service/space/IBuildingInfoService.java new file mode 100644 index 0000000..8a8204c --- /dev/null +++ b/mh-system/src/main/java/com/mh/system/service/space/IBuildingInfoService.java @@ -0,0 +1,26 @@ +package com.mh.system.service.space; + +import com.mh.common.core.domain.entity.BuildingInfo; + +import java.util.List; + +/** + * @author LJF + * @version 1.0 + * @project EEMCS + * @description 楼栋管理管理 + * @date 2025-02-19 16:37:19 + */ +public interface IBuildingInfoService { + + List selectBuildingInfoList(BuildingInfo buildingInfo); + + BuildingInfo selectBuildingInfoById(String buildingId); + + int insertBuildingInfo(BuildingInfo buildingInfo); + + int updateBuildingInfo(BuildingInfo buildingInfo); + + int deleteBuildingInfoByIds(String[] buildingIds); + +} diff --git a/mh-system/src/main/java/com/mh/system/service/space/IFloorInfoService.java b/mh-system/src/main/java/com/mh/system/service/space/IFloorInfoService.java new file mode 100644 index 0000000..ea28be0 --- /dev/null +++ b/mh-system/src/main/java/com/mh/system/service/space/IFloorInfoService.java @@ -0,0 +1,26 @@ +package com.mh.system.service.space; + +import com.mh.common.core.domain.entity.FloorInfo; + +import java.util.List; + +/** + * @author LJF + * @version 1.0 + * @project EEMCS + * @description 楼栋管理管理 + * @date 2025-02-19 16:37:19 + */ +public interface IFloorInfoService { + + List selectFloorInfoList(FloorInfo floorInfo); + + FloorInfo selectFloorInfoById(String buildingId); + + int insertFloorInfo(FloorInfo floorInfo); + + int updateFloorInfo(FloorInfo floorInfo); + + int deleteFloorInfoByIds(String[] buildingIds); + +} diff --git a/mh-system/src/main/java/com/mh/system/service/space/IHouseInfoService.java b/mh-system/src/main/java/com/mh/system/service/space/IHouseInfoService.java new file mode 100644 index 0000000..e0ae89f --- /dev/null +++ b/mh-system/src/main/java/com/mh/system/service/space/IHouseInfoService.java @@ -0,0 +1,26 @@ +package com.mh.system.service.space; + +import com.mh.common.core.domain.entity.HouseInfo; + +import java.util.List; + +/** + * @author LJF + * @version 1.0 + * @project EEMCS + * @description 房间管理管理 + * @date 2025-02-19 16:37:19 + */ +public interface IHouseInfoService { + + List selectHouseInfoList(HouseInfo houseInfo); + + HouseInfo selectHouseInfoById(String buildingId); + + int insertHouseInfo(HouseInfo houseInfo); + + int updateHouseInfo(HouseInfo houseInfo); + + int deleteHouseInfoByIds(String[] buildingIds); + +} diff --git a/mh-system/src/main/java/com/mh/system/service/space/impl/AreaInfoServiceImpl.java b/mh-system/src/main/java/com/mh/system/service/space/impl/AreaInfoServiceImpl.java new file mode 100644 index 0000000..a515743 --- /dev/null +++ b/mh-system/src/main/java/com/mh/system/service/space/impl/AreaInfoServiceImpl.java @@ -0,0 +1,70 @@ +package com.mh.system.service.space.impl; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.mh.common.core.domain.entity.AreaInfo; +import com.mh.common.core.domain.entity.DeviceLedger; +import com.mh.common.utils.StringUtils; +import com.mh.system.mapper.space.AreaInfoMapper; +import com.mh.system.service.space.IAreaInfoService; +import jakarta.annotation.Resource; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + * @author LJF + * @version 1.0 + * @project EEMCS + * @description 区域管理实现类 + * @date 2025-02-19 16:46:38 + */ +@Service +public class AreaInfoServiceImpl implements IAreaInfoService { + + @Resource + private AreaInfoMapper areaInfoMapper; + + @Override + public List selectAreaInfoList(AreaInfo areaInfo) { + if (areaInfo == null) { + return List.of(); + } + QueryWrapper queryWrapper = new QueryWrapper<>(); + // 区域名称 + if (!StringUtils.isEmpty(areaInfo.getAreaName())) { + queryWrapper.like("area_name", areaInfo.getAreaName()); + } + // 备注 + if (!StringUtils.isEmpty(areaInfo.getRemark())) { + queryWrapper.like("remark", areaInfo.getRemark()); + } + queryWrapper.orderByAsc("order_num"); + return areaInfoMapper.selectList(queryWrapper); + } + + @Override + public AreaInfo selectAreaInfoById(String areaInfo) { + return areaInfoMapper.selectById(areaInfo); + } + + @Override + public int insertAreaInfo(AreaInfo areaInfo) { + return areaInfoMapper.insert(areaInfo); + } + + @Override + public int updateAreaInfo(AreaInfo areaInfo) { + return areaInfoMapper.updateById(areaInfo); + } + + @Override + public int deleteAreaInfoByIds(String[] areaInfos) { + if (areaInfos != null && areaInfos.length > 0) { + for (String areaInfo : areaInfos) { + areaInfoMapper.deleteById(areaInfo); + } + return areaInfos.length; + } + return 0; + } +} diff --git a/mh-system/src/main/java/com/mh/system/service/space/impl/BuildingInfoServiceImpl.java b/mh-system/src/main/java/com/mh/system/service/space/impl/BuildingInfoServiceImpl.java new file mode 100644 index 0000000..82af985 --- /dev/null +++ b/mh-system/src/main/java/com/mh/system/service/space/impl/BuildingInfoServiceImpl.java @@ -0,0 +1,80 @@ +package com.mh.system.service.space.impl; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.mh.common.core.domain.entity.AreaInfo; +import com.mh.common.core.domain.entity.BuildingInfo; +import com.mh.common.utils.StringUtils; +import com.mh.system.mapper.space.BuildingInfoMapper; +import com.mh.system.service.space.IBuildingInfoService; +import jakarta.annotation.Resource; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + * @author LJF + * @version 1.0 + * @project EEMCS + * @description 区域管理实现类 + * @date 2025-02-19 16:46:38 + */ +@Service +public class BuildingInfoServiceImpl implements IBuildingInfoService { + + @Resource + private BuildingInfoMapper buildingInfoMapper; + + @Override + public List selectBuildingInfoList(BuildingInfo buildingInfo) { + if (buildingInfo == null) { + return List.of(); + } + QueryWrapper queryWrapper = new QueryWrapper<>(); + // 区域id + if (!StringUtils.isEmpty(buildingInfo.getAreaId())) { + queryWrapper.eq("area_id", buildingInfo.getAreaId()); + } + // 楼栋名称 + if (!StringUtils.isEmpty(buildingInfo.getBuildingName())) { + queryWrapper.like("building_name", buildingInfo.getBuildingName()); + } + // 备注 + if (!StringUtils.isEmpty(buildingInfo.getRemark())) { + queryWrapper.like("remark", buildingInfo.getRemark()); + } + queryWrapper.orderByAsc("order_num"); + return buildingInfoMapper.selectList(queryWrapper); + } + + @Override + public BuildingInfo selectBuildingInfoById(String buildingId) { + return buildingInfoMapper.selectById(buildingId); + } + + @Override + public int insertBuildingInfo(BuildingInfo buildingInfo) { + if (StringUtils.isEmpty(buildingInfo.getAreaId())) { + throw new RuntimeException("没有对应的区域id"); + } + return buildingInfoMapper.insert(buildingInfo); + } + + @Override + public int updateBuildingInfo(BuildingInfo buildingInfo) { + if (StringUtils.isEmpty(buildingInfo.getAreaId())) { + throw new RuntimeException("没有对应的区域id"); + } + return buildingInfoMapper.updateById(buildingInfo); + } + + @Override + public int deleteBuildingInfoByIds(String[] buildingIds) { + if (buildingIds != null && buildingIds.length > 0) { + for (String buildingId : buildingIds) { + buildingInfoMapper.deleteById(buildingId); + } + return buildingIds.length; + } + return 0; + } +} diff --git a/mh-system/src/main/java/com/mh/system/service/space/impl/FloorInfoServiceImpl.java b/mh-system/src/main/java/com/mh/system/service/space/impl/FloorInfoServiceImpl.java new file mode 100644 index 0000000..0da3f47 --- /dev/null +++ b/mh-system/src/main/java/com/mh/system/service/space/impl/FloorInfoServiceImpl.java @@ -0,0 +1,89 @@ +package com.mh.system.service.space.impl; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.mh.common.core.domain.entity.FloorInfo; +import com.mh.common.utils.StringUtils; +import com.mh.system.mapper.space.FloorInfoMapper; +import com.mh.system.service.space.IFloorInfoService; +import jakarta.annotation.Resource; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + * @author LJF + * @version 1.0 + * @project EEMCS + * @description 楼层实现类 + * @date 2025-02-19 17:28:13 + */ +@Service +public class FloorInfoServiceImpl implements IFloorInfoService { + + @Resource + private FloorInfoMapper floorInfoMapper; + + @Override + public List selectFloorInfoList(FloorInfo floorInfo) { + if (floorInfo == null) { + return List.of(); + } + QueryWrapper queryWrapper = new QueryWrapper<>(); + // 区域id + if (!StringUtils.isEmpty(floorInfo.getAreaId())) { + queryWrapper.eq("area_id", floorInfo.getAreaId()); + } + // 楼栋id + if (!StringUtils.isEmpty(floorInfo.getBuildingId())) { + queryWrapper.like("building_id", floorInfo.getBuildingId()); + } + // 楼层名称 + if (!StringUtils.isEmpty(floorInfo.getFloorName())) { + queryWrapper.like("floor_name", floorInfo.getFloorName()); + } + // 备注 + if (!StringUtils.isEmpty(floorInfo.getRemark())) { + queryWrapper.like("remark", floorInfo.getRemark()); + } + queryWrapper.orderByAsc("order_num"); + return floorInfoMapper.selectList(queryWrapper); + } + + @Override + public FloorInfo selectFloorInfoById(String floorId) { + return floorInfoMapper.selectById(floorId); + } + + @Override + public int insertFloorInfo(FloorInfo floorInfo) { + if(StringUtils.isEmpty(floorInfo.getAreaId())) { + throw new RuntimeException("没有对应的区域id"); + } + if(StringUtils.isEmpty(floorInfo.getBuildingId())) { + throw new RuntimeException("没有对应的楼栋id"); + } + return floorInfoMapper.insert(floorInfo); + } + + @Override + public int updateFloorInfo(FloorInfo floorInfo) { + if(StringUtils.isEmpty(floorInfo.getAreaId())) { + throw new RuntimeException("没有对应的区域id"); + } + if(StringUtils.isEmpty(floorInfo.getBuildingId())) { + throw new RuntimeException("没有对应的楼栋id"); + } + return floorInfoMapper.updateById(floorInfo); + } + + @Override + public int deleteFloorInfoByIds(String[] floorIds) { + if (floorIds != null && floorIds.length > 0) { + for (String floorId : floorIds) { + floorInfoMapper.deleteById(floorId); + } + return floorIds.length; + } + return 0; + } +} diff --git a/mh-system/src/main/java/com/mh/system/service/space/impl/HouseInfoServiceImpl.java b/mh-system/src/main/java/com/mh/system/service/space/impl/HouseInfoServiceImpl.java new file mode 100644 index 0000000..5f0a249 --- /dev/null +++ b/mh-system/src/main/java/com/mh/system/service/space/impl/HouseInfoServiceImpl.java @@ -0,0 +1,99 @@ +package com.mh.system.service.space.impl; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.mh.common.core.domain.entity.HouseInfo; +import com.mh.common.utils.StringUtils; +import com.mh.system.mapper.space.HouseInfoMapper; +import com.mh.system.service.space.IHouseInfoService; +import jakarta.annotation.Resource; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + * @author LJF + * @version 1.0 + * @project EEMCS + * @description 房间管理 + * @date 2025-02-19 18:34:42 + */ +@Service +public class HouseInfoServiceImpl implements IHouseInfoService { + + @Resource + private HouseInfoMapper houseInfoMapper; + + @Override + public List selectHouseInfoList(HouseInfo houseInfo) { + if (houseInfo == null) { + return List.of(); + } + QueryWrapper queryWrapper = new QueryWrapper<>(); + // 区域id + if (!StringUtils.isEmpty(houseInfo.getAreaId())) { + queryWrapper.eq("area_id", houseInfo.getAreaId()); + } + // 楼栋id + if (!StringUtils.isEmpty(houseInfo.getBuildingId())) { + queryWrapper.eq("building_id", houseInfo.getBuildingId()); + } + // 楼层id + if (!StringUtils.isEmpty(houseInfo.getFloorId())) { + queryWrapper.eq("floor_id", houseInfo.getFloorId()); + } + // 房间名称 + if (!StringUtils.isEmpty(houseInfo.getHouseName())) { + queryWrapper.like("house_name", houseInfo.getHouseName()); + } + // 备注 + if (!StringUtils.isEmpty(houseInfo.getRemark())) { + queryWrapper.like("remark", houseInfo.getRemark()); + } + queryWrapper.orderByAsc("order_num"); + return houseInfoMapper.selectList(queryWrapper); + } + + @Override + public HouseInfo selectHouseInfoById(String buildingId) { + return houseInfoMapper.selectById(buildingId); + } + + @Override + public int insertHouseInfo(HouseInfo houseInfo) { + if (StringUtils.isEmpty(houseInfo.getAreaId())) { + throw new RuntimeException("没有对应的区域id"); + } + if (StringUtils.isEmpty(houseInfo.getBuildingId())) { + throw new RuntimeException("没有对应的楼栋id"); + } + if (StringUtils.isEmpty(houseInfo.getFloorId())) { + throw new RuntimeException("没有对应的楼层id"); + } + return houseInfoMapper.insert(houseInfo); + } + + @Override + public int updateHouseInfo(HouseInfo houseInfo) { + if (StringUtils.isEmpty(houseInfo.getAreaId())) { + throw new RuntimeException("没有对应的区域id"); + } + if (StringUtils.isEmpty(houseInfo.getBuildingId())) { + throw new RuntimeException("没有对应的楼栋id"); + } + if (StringUtils.isEmpty(houseInfo.getFloorId())) { + throw new RuntimeException("没有对应的楼层id"); + } + return houseInfoMapper.updateById(houseInfo); + } + + @Override + public int deleteHouseInfoByIds(String[] buildingIds) { + if (buildingIds != null && buildingIds.length > 0) { + for (String buildingId : buildingIds) { + houseInfoMapper.deleteById(buildingId); + } + return buildingIds.length; + } + return 0; + } +} diff --git a/sql/区域/楼栋/楼层/房间信息表.sql b/sql/区域/楼栋/楼层/房间信息表.sql new file mode 100644 index 0000000..9d2b31b --- /dev/null +++ b/sql/区域/楼栋/楼层/房间信息表.sql @@ -0,0 +1,162 @@ +-- 区域表 +create table area_info ( + id varchar(36) not null primary key, + area_name varchar(200) not null, + order_num int4, + parent_id varchar(36) default 0, + remark varchar(500), + create_by varchar(200), + update_by varchar(200), + created_time timestamp default current_timestamp, + updated_time timestamp default current_timestamp +); +comment on table area_info is '区域信息表,用于存储系统中的所有区域数据'; +comment on column area_info.id is '区域唯一标识符,使用uuid格式确保全局唯一性[ty-reference](2)'; +comment on column area_info.area_name is '区域名称,最长支持200个字符'; +comment on column area_info.order_num is '排序号,用于定义区域显示顺序'; +comment on column area_info.parent_id is '父级区域id,默认值为0表示顶级区域'; +comment on column area_info.remark is '备注信息,允许存储长达500个字符的额外说明'; +comment on column area_info.create_by is '创建者,记录创建该区域的用户信息'; +comment on column area_info.update_by is '最后更新者,记录最近一次修改该区域的用户信息'; +comment on column area_info.created_time is '创建时间,默认值为当前时间戳'; +comment on column area_info.updated_time is '最后更新时间,默认值为当前时间戳'; +create index idx_area_name on area_info (area_name); +create index idx_area_parent_id on area_info (parent_id); +create index idx_area_parent_order on area_info (parent_id, order_num); +create index idx_area_remark_fulltext on area_info using gin(to_tsvector('english', remark)); +create index idx_area_created_time on area_info (created_time); +create index idx_area_updated_time on area_info (updated_time); + +-- 楼栋表 +create table building_info ( + id varchar(36) not null, + building_name varchar(100) null, + parent_id varchar(36) default 0, + levels_count int null, + begin_level int null, + house_count int null, + bed_count int null, + check_in_count int null, + area_id varchar(36) null, + remark varchar(128) null, + order_num int4, + tank_height numeric(24,2) null, + pump_count int null, + low_tank_height numeric(24,2) null, + create_by varchar(200), + update_by varchar(200), + created_time timestamp default current_timestamp, + updated_time timestamp default current_timestamp, + constraint pk_building primary key (id) +); +-- 表的注释 +comment on table building_info is '楼栋信息表,记录了每个楼栋的基本信息及关联数据。'; + +-- 列的注释 +comment on column building_info.id is '楼栋唯一标识符,作为主键使用。'; +comment on column building_info.building_name is '楼栋名称,用于标识具体的楼栋。'; +comment on column building_info.parent_id is '父级楼栋id,默认值为"0",表示顶级楼栋。'; +comment on column building_info.levels_count is '楼层数量,表示该楼栋有多少层。'; +comment on column building_info.begin_level is '起始楼层号,表示楼栋的第一层编号。'; +comment on column building_info.house_count is '每层房间数,记录每层楼有多少个房间。'; +comment on column building_info.bed_count is '床位总数,记录楼栋内的总床位数量。'; +comment on column building_info.check_in_count is '实际入住数,记录当前已入住的人数或床位数。'; +comment on column building_info.area_id is '区域id,标识楼栋所属的地理或管理区域。'; +comment on column building_info.remark is '备注信息,用于存储额外的说明或注释。'; +comment on column building_info.order_num is '排序号,用于定义楼栋显示顺序。'; +comment on column building_info.tank_height is '水箱高度,记录楼栋内水箱的高度信息。'; +comment on column building_info.pump_count is '水泵数量,记录楼栋内安装的水泵数量。'; +comment on column building_info.low_tank_height is '低区水箱高度,记录低区水箱的具体高度。'; +comment on column building_info.create_by is '创建者,记录谁创建了这条记录。'; +comment on column building_info.update_by is '更新者,记录最近一次修改该记录的用户。'; +comment on column building_info.created_time is '创建时间,自动设置为记录创建时的时间戳。'; +comment on column building_info.updated_time is '更新时间,自动设置为记录最后一次修改的时间戳。'; + +create index idx_building_name on building_info (building_name); +create index idx_area_id on building_info (area_id); +create index idx_order_num on building_info (order_num); +create index idx_area_building on building_info (area_id, building_name); + +-- 楼层表 +create table floor_info ( + id varchar(36) not null primary key, + area_id varchar(36) not null, + building_id varchar(36) not null, + floor_name varchar(200) null, + floor_num int4 null, + floor_purpose varchar(100) null, + floor_area numeric(24, 2) null, + order_num int4, + parent_id varchar(36) default '0', + remark varchar(500), + create_by varchar(200), + update_by varchar(200), + created_time timestamp default current_timestamp, + updated_time timestamp default current_timestamp +); + +-- 添加表注释 +comment on table floor_info is '楼层信息表,用于记录建筑物内各楼层的基本信息和属性'; + +-- 为每个字段添加注释 +comment on column floor_info.id is '楼层唯一标识符,作为主键使用'; +comment on column floor_info.area_id is '所属区域id,关联到区域表'; +comment on column floor_info.building_id is '所属建筑物id,关联到建筑物表'; +comment on column floor_info.floor_name is '楼层名称,如“ground floor”或“basement”'; +comment on column floor_info.floor_num is '楼层编号,在同一建筑物内必须唯一'; +comment on column floor_info.floor_purpose is '楼层用途,例如办公、住宅、停车场等'; +comment on column floor_info.floor_area is '楼层总面积,单位为平方米'; +comment on column floor_info.order_num is '楼层排序号,用于定义楼层显示顺序'; +comment on column floor_info.parent_id is '父级楼层id,默认值为“0”,表示无父级楼层'; +comment on column floor_info.remark is '备注信息,用于记录额外说明'; +comment on column floor_info.create_by is '创建者,记录谁创建了这条记录'; +comment on column floor_info.update_by is '更新者,记录最近一次修改该记录的用户'; +comment on column floor_info.created_time is '创建时间,自动设置为记录创建时的时间戳'; +comment on column floor_info.updated_time is '更新时间,自动设置为记录最后一次修改的时间戳'; +create index idx_floor_info_area_id on floor_info (area_id); +create index idx_floor_info_building_id on floor_info (building_id); +create index idx_floor_info_floor_purpose on floor_info (floor_purpose); +create index idx_floor_info_building_floor on floor_info (building_id, floor_num); +create index idx_floor_info_area_purpose on floor_info (area_id, floor_purpose); + +create table house_info ( + id varchar(36) primary key not null, -- 房屋唯一标识符,自增主键 + area_id varchar(36) not null, -- 所属区域id,外键关联到area表 + building_id varchar(36) not null, -- 所属建筑物id,外键关联到building表 + floor_id varchar(36) not null, -- 所属楼层id,外键关联到floor_info表 + house_name varchar(100) null, -- 房间名称 + address varchar(200) null, -- 房屋详细地址 + price decimal(10, 2), -- 房屋价格,保留两位小数 + total_area numeric(24, 2), -- 房屋总面积 + usable_area numeric(24, 2), -- 房屋使用面积(可居住部分) + built_year varchar(20), -- 建造年份 + status int default 0, -- 0:正常,1:禁用 + remark varchar(500) null, -- 备注信息 + create_by varchar(200) null, -- 创建者 + update_by varchar(200) null, -- 更新者 + created_time timestamp default current_timestamp, -- 创建时间 + updated_time timestamp default current_timestamp -- 更新时间 +); +comment on table house_info is '房屋信息表,用于存储房屋的基本信息及属性'; + +comment on column house_info.id is '房屋唯一标识符'; +comment on column house_info.area_id is '所属区域id,外键关联到area表'; +comment on column house_info.building_id is '所属建筑物id,外键关联到building表'; +comment on column house_info.floor_id is '所属楼层id,外键关联到floor_info表'; +comment on column house_info.house_name is '房间名称'; +comment on column house_info.address is '房屋详细地址'; +comment on column house_info.price is '房屋价格,保留两位小数'; +comment on column house_info.total_area is '房屋总面积'; +comment on column house_info.usable_area is '房屋使用面积(可居住部分)'; +comment on column house_info.built_year is '建造年份'; +comment on column house_info.status is '状态:0:正常,1:禁用'; +comment on column house_info.remark is '备注信息'; +comment on column house_info.create_by is '创建者'; +comment on column house_info.update_by is '更新者'; +comment on column house_info.created_time is '创建时间'; +comment on column house_info.updated_time is '更新时间'; +create index idx_house_info_area_id on house_info (area_id); +create index idx_house_info_building_id on house_info (building_id); +create index idx_house_info_floor_id on house_info (floor_id); +create index idx_house_info_area_building on house_info (area_id, building_id); +create index idx_house_info_building_floor on house_info (building_id, floor_id); \ No newline at end of file diff --git a/sql/表结构设计.sql b/sql/表结构设计.sql index e27a356..a954cf2 100644 --- a/sql/表结构设计.sql +++ b/sql/表结构设计.sql @@ -529,4 +529,39 @@ COMMENT ON COLUMN mqtt_subscriptions.remark IS '备注'; COMMENT ON COLUMN mqtt_subscriptions.create_time IS '创建时间'; COMMENT ON COLUMN mqtt_subscriptions.update_time IS '更新时间'; COMMENT ON COLUMN mqtt_subscriptions.create_by IS '创建者'; -COMMENT ON COLUMN mqtt_subscriptions.update_by IS '更新者'; \ No newline at end of file +COMMENT ON COLUMN mqtt_subscriptions.update_by IS '更新者'; + +ALTER TABLE public.collection_params_manage ADD collection_type varchar(10) NULL; +COMMENT ON COLUMN public.collection_params_manage.collection_type IS '采集类别:0:遥测(连续变化参数),1:遥信(离散开关状态)'; + +-- 2025-02-18 创建报警记录 +CREATE TABLE alarm_records ( + id VARCHAR(36) PRIMARY KEY, -- 报警记录唯一标识符 + content TEXT NOT NULL, -- 报警内容 + alarm_type VARCHAR(50) NOT NULL, -- 报警类型 + event_type VARCHAR(50) NOT NULL, -- 事件类型 + alarm_level VARCHAR(20) NOT NULL, -- 报警等级 + ledger_id VARCHAR(36) NOT NULL, -- 设备台账ID + device_name VARCHAR(100) NOT NULL, -- 设备名称 + cpm_id VARCHAR(36) NOT NULL, -- 仪表参数ID + cpm_name VARCHAR(100) NOT NULL, -- 仪表名称 + create_time TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, -- 报警时间,默认当前时间 +); +COMMENT ON TABLE alarm_records IS '用于记录系统中的各种报警信息'; + +COMMENT ON COLUMN alarm_records.id IS '报警记录的唯一标识符'; +COMMENT ON COLUMN alarm_records.content IS '详细描述报警的具体内容'; +COMMENT ON COLUMN alarm_records.create_time IS '报警发生的时间戳'; +COMMENT ON COLUMN alarm_records.event_type IS '触发报警的事件类型'; +COMMENT ON COLUMN alarm_records.alarm_level IS '表示报警的重要程度或紧急程度'; +COMMENT ON COLUMN alarm_records.ledger_id IS '关联到设备台账的唯一标识符'; +COMMENT ON COLUMN alarm_records.device_name IS '涉及报警的设备名称'; +COMMENT ON COLUMN alarm_records.cpm_id IS '关联到仪表参数的唯一标识符'; +COMMENT ON COLUMN alarm_records.cpm_name IS '涉及报警的仪表名称'; + +CREATE INDEX idx_alarm_records_ledger_id ON alarm_records(ledger_id); +CREATE INDEX idx_alarm_records_create_time ON alarm_records(create_time); + +ALTER TABLE public.alarm_rules ADD status int4 NULL; +COMMENT ON COLUMN public.alarm_rules.status IS '状态:0:已启用,1:未启用'; +