diff --git a/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/controller/HwDeviceController.java b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/controller/HwDeviceController.java index 2c9a3a2..4c7b2a1 100644 --- a/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/controller/HwDeviceController.java +++ b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/controller/HwDeviceController.java @@ -4,8 +4,11 @@ import java.util.List; import java.util.Map; import javax.servlet.http.HttpServletResponse; +import com.ruoyi.business.domain.HwMonitorUnit; import com.ruoyi.business.domain.VO.DeviceModeVo; import com.ruoyi.business.domain.VO.HwMonitorUnitVo; +import com.ruoyi.business.service.IHwMonitorUnitService; +import com.ruoyi.system.api.domain.SysDept; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PostMapping; @@ -38,6 +41,8 @@ public class HwDeviceController extends BaseController @Autowired private IHwDeviceService hwDeviceService; + @Autowired + private IHwMonitorUnitService hwMonitorUnitService; /** * 查询设备信息列表 */ @@ -108,4 +113,16 @@ public class HwDeviceController extends BaseController { return toAjax(hwDeviceService.deleteHwDeviceByDeviceIds(deviceIds)); } + + + /** + * 获取部门树列表 + */ + @RequiresPermissions("business:device:list") + @GetMapping("/monitorUnitTree") + public AjaxResult monitorUnitTree(HwMonitorUnit monitorUnit) + { + return success(hwMonitorUnitService.selectMonitorTreeList(monitorUnit)); + } + } diff --git a/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/controller/HwElectronicFenceController.java b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/controller/HwElectronicFenceController.java index 0068f1a..8173367 100644 --- a/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/controller/HwElectronicFenceController.java +++ b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/controller/HwElectronicFenceController.java @@ -26,7 +26,7 @@ import com.ruoyi.common.core.web.page.TableDataInfo; * 电子围栏Controller * * @author xins - * @date 2023-09-04 + * @date 2023-09-15 */ @RestController @RequestMapping("/electronicFence") diff --git a/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/controller/HwMonitorPlatformController.java b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/controller/HwMonitorPlatformController.java index e825b7f..4481fa6 100644 --- a/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/controller/HwMonitorPlatformController.java +++ b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/controller/HwMonitorPlatformController.java @@ -1,34 +1,20 @@ package com.ruoyi.business.controller; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import javax.annotation.Resource; -import javax.servlet.http.HttpServletResponse; - -import com.ruoyi.business.domain.HwScene; +import com.alibaba.fastjson.JSONObject; +import com.ruoyi.business.domain.*; import com.ruoyi.business.domain.VO.*; -import com.ruoyi.business.mapper.HwSceneMapper; -import com.ruoyi.business.service.IHwDeviceService; -import com.ruoyi.business.service.IHwElectronicFenceService; -import com.ruoyi.business.service.IHwSceneService; -import com.ruoyi.common.core.domain.R; -import com.ruoyi.common.security.utils.SecurityUtils; -import com.ruoyi.system.api.domain.SysUser; -import com.ruoyi.system.api.model.LoginUser; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.*; -import com.ruoyi.common.log.annotation.Log; -import com.ruoyi.common.log.enums.BusinessType; -import com.ruoyi.common.security.annotation.RequiresPermissions; -import com.ruoyi.business.domain.HwMonitorUnit; -import com.ruoyi.business.service.IHwMonitorUnitService; +import com.ruoyi.business.service.*; +import com.ruoyi.common.core.constant.TdEngineConstants; import com.ruoyi.common.core.web.controller.BaseController; import com.ruoyi.common.core.web.domain.AjaxResult; -import com.ruoyi.common.core.utils.poi.ExcelUtil; import com.ruoyi.common.core.web.page.TableDataInfo; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; -import static com.ruoyi.common.core.utils.PageUtils.startPage; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; @RestController @RequestMapping("/monitorPlatform") @@ -39,197 +25,294 @@ public class HwMonitorPlatformController extends BaseController { @Autowired private IHwDeviceService hwDeviceService; @Autowired + private IHwDeviceModeService hwDeviceModeService; + @Autowired private IHwSceneService hwSceneService; @Autowired private IHwElectronicFenceService hwElectronicFenceService; + @Autowired + private IHwAlarmInfoService hwAlarmInfoService; - + @Autowired + private IHwMonitorPlatformService hwMonitorPlatformService; /** - * 树状获取监控单元列表 - * @param hwMonitorUnits 监控单元对象 - * @return list - * @throws - * */ - @GetMapping("/treeList") - public TableDataInfo treeList(){ - HwMonitorUnit hwMonitorUnit = new HwMonitorUnit(); - List hwMonitorUnits = hwMonitorUnitService.selectHwMonitorUnitList(hwMonitorUnit); - List list = hwMonitorUnitService.selectTreeList(hwMonitorUnits); - return getDataTable(list); - - } -// /** -// * -// * 选择场景 -// * @param sceneModeId 场景id -// * @return -// */ -// -// @PostMapping("/selectHwSceneBySceneModeId") -// public TableDataInfo selectHwSceneBySceneModeId(Long sceneModeId){ -// List hwScenes = hwSceneService.selectHwSceneBySceneModeId(sceneModeId); -// return getDataTable(hwScenes); -// } - /** - * 查询3. 设备各类型占所有设备数量百分比饼状图(左下角) - * */ + * 查询3. 设备各类型占所有设备数量百分比饼状图(首页左下角) + */ @GetMapping("/monitorUnitPercentage") - public TableDataInfo monitorUnitPercentage(){ + public TableDataInfo monitorUnitPercentage() { List maps = hwDeviceService.selectDeviceModeNameVo(); return getDataTable(maps); } - // - /** - * 获取有开关属性的设备 - * @param monitorUnitId 监控单元id - * */ - @PostMapping("/selectDeviceByDeviceModeByMonitorUnitId") - public Map> selectDeviceByDeviceModeByMonitorUnitId(Long monitorUnitId){ - startPage(); - Map> maps = hwDeviceService.selectDeviceByDeviceModeByMonitorUnitId(monitorUnitId); - return maps; + /** + * 各场景监控单元数量占监控单元总数量百分比图(首页左上) + */ + @GetMapping("/monitorPercentage") + public TableDataInfo monitorPercentage() { + List maps = hwMonitorUnitService.selectMonitorPercentage(); + return getDataTable(maps); } /** - * 获取直采变量的设备 - * @param monitorUnitId 监控单元id + *  展示总的设备数量和总的监控单元数量(首页中间上方) */ - @PostMapping("/selectDeviceModeFunctionByFunctionType") - public Map> selectDeviceModeFunctionByFunctionType(Long monitorUnitId){ - startPage(); + @GetMapping("/allNums") + public AllNumsVo allNums() { + AllNumsVo allNumsVos = hwMonitorUnitService.selectAllNums(null); - Map> maps = hwDeviceService.selectDeviceModeFunctionByFunctionType(monitorUnitId); - return maps; + return allNumsVos; } - // + /** - * 设备历史数据 - * @param deviceId 设备id - * */ - @PostMapping("/getHistoryData") - public TableDataInfo getHistoryData(Long deviceId){ + * @return TableDataInfo + * @param: hwAlarmInfo + * @description 获取报警信息(首页右下角,定位场景首页,标准场景首页) + * @author xins + * @date 2023-09-15 11:03 + */ + @GetMapping("/getAlarmInfos") + public TableDataInfo getAlarmInfos(HwAlarmInfo hwAlarmInfo) { startPage(); - List> historyData = hwDeviceService.getHistoryData(deviceId); - return getDataTable(historyData); - } - /** - * 查询区域数量站场景区总数百分比 - * 1-左上 - * */ - @GetMapping("/monitorPercentage") - public TableDataInfo monitorPercentage(){ - List maps = hwMonitorUnitService.selectMonitorPercentage(); - return getDataTable(maps); + List alarmInfos = hwAlarmInfoService.selectHwAlarmInfoList(hwAlarmInfo); + return getDataTable(alarmInfos); } + /** - *  展示总的设备数量和总的监控单元数量 - * */ - @GetMapping("/allNums") - public AllNumsVo allNums(){ - AllNumsVo allNumsVos = hwMonitorUnitService.selectAllNums(); + * 2. 设备实时在运数量曲线图(首页右上角) + * + * @param sceneId 场景id + */ + @GetMapping("/getDeviceOperations/{sceneId}") + public AjaxResult selectDeviceStatus(@PathVariable("sceneId") Long sceneId) { + JSONObject data = new JSONObject(); + data.put("10-01", 10); + data.put("10-02", 20); + data.put("10-03", 30); + data.put("10-04", 40); + data.put("10-05", 16); - return allNumsVos; + return AjaxResult.success(data); } + + /** *  按场景展示总的设备数量和总的监控单元数量 - * */ - @GetMapping("/sceneAllNums") - public TableDataInfo sceneAllNums(){ - List allNumsVos = hwMonitorUnitService.selectSenceAllNums(); - - return getDataTable(allNumsVos); + */ + @GetMapping("/sceneAllNums/{sceneId}") + public AllNumsVo sceneAllNums(@PathVariable("sceneId") Long sceneId) { + AllNumsVo allNumsVos = hwMonitorUnitService.selectAllNums(sceneId); + return allNumsVos; } + /** - * 分页获取最子集监控单元列表 - * */ - @PostMapping("/limitSubMonitorUnit") - public TableDataInfo limitSubMonitorUnit(){ + * 分页获取最子集监控单元列表(标准场景右侧) + */ + @GetMapping("/limitSubMonitorUnit/{sceneId}") + public TableDataInfo limitSubMonitorUnit(@PathVariable("sceneId") Long sceneId) { + //todo sceneid should be startPage(); List hwMonitorUnits = hwMonitorUnitService.selectLimitSubMonitorUnit(); return getDataTable(hwMonitorUnits); } + + @GetMapping("/getAlarmCountGroupAlarmType/{sceneId}") + public AjaxResult getAlarmCountGroupAlarmType(@PathVariable("sceneId") Long sceneId) { + return success(hwAlarmInfoService.selectAlarmsByAlarmType(sceneId)); + } + + /** + * 按电子围栏定位显示其下设备数量,以及报警的设备数量(定位场景地图气泡图) + * + * @param sceneId + */ + @GetMapping("/ElectronicNumVo/{sceneId}") + public AjaxResult ElectronicNumVo(@PathVariable("sceneId") Long sceneId) { + +// { +// type:'多边形', +// children:[{ +// latitude:'', +// longtitude:'' +// }] +// } + +// { +// type:'圆形', +// centerpoint:{ +// 'lantitude':, +// 'longtitude':, +// } +// } +// } + return success(hwElectronicFenceService.selectEleTypeNums(sceneId)); + } + + /** * 监控单元报警统计 */ - @GetMapping("/alarmStats") - public TableDataInfo alarmStats(){ - List alarmStatsVos = hwMonitorUnitService.selectAlarmStats(); - return getDataTable(alarmStatsVos); + @GetMapping("/alarmStats/{sceneId}") + public AjaxResult alarmStats(@PathVariable("sceneId") Long sceneId) { + List alarmStatsVos = hwMonitorUnitService.selectAlarmStats(sceneId); + return success(alarmStatsVos); } + /** * 获取最子级监控单元数量、设备数量和在线设备数量 + * * @param sceneId 场景id - * */ - @PostMapping("/SubDevice") - public SubDeviceSumVo subDevice(Long sceneId){ + */ + @GetMapping("/subDevice/{sceneId}") + public SubDeviceSumVo subDevice(@PathVariable("sceneId") Long sceneId) { SubDeviceSumVo subDeviceSumVos = hwMonitorUnitService.selectSubDeviceSum(sceneId); return subDeviceSumVos; } + + /** - * 按电子围栏定位显示其下设备数量,以及报警的设备数量。 - * @param sceneId - * */ - @PostMapping("/ElectronicNumVo") - public TableDataInfo ElectronicNumVo(Long sceneId){ + * 树状获取监控单元列表(设备监测左侧树) + * + * @param sceneId 场景ID + * @return list + * @throws + */ + @GetMapping("/treeList{sceneId}") + public TableDataInfo treeList(@PathVariable("sceneId") Long sceneId) { + HwMonitorUnit hwMonitorUnit = new HwMonitorUnit(); + hwMonitorUnit.setSceneId(sceneId); + List hwMonitorUnits = hwMonitorUnitService.selectHwMonitorUnitList(hwMonitorUnit); + List list = hwMonitorUnitService.selectTreeList(hwMonitorUnits); + return getDataTable(list); - List eleMonitorDeviceSumVos = hwElectronicFenceService.selectEleTypeNums(sceneId); - return getDataTable(eleMonitorDeviceSumVos); } +// /** +// * +// * 选择场景 +// * @param sceneModeId 场景id +// * @return +// */ +// +// @PostMapping("/selectHwSceneBySceneModeId") +// public TableDataInfo selectHwSceneBySceneModeId(Long sceneModeId){ +// List hwScenes = hwSceneService.selectHwSceneBySceneModeId(sceneModeId); +// return getDataTable(hwScenes); +// } + + // + + /** * 获取监控单元详细信息 - * @param monitorUnitId - * */ - @PostMapping("/selectMonitorUnitSub") - //ok - public AjaxResult selectMonitorUnitSub(Long monitorUnitId){ + */ +// @RequiresPermissions("business:monitorUnit:query") + @GetMapping(value = "/getMonitorById/{monitorUnitId}") + public AjaxResult getMonitorById(@PathVariable("monitorUnitId") Long monitorUnitId) { + return success(hwMonitorUnitService.selectHwMonitorUnitByMonitorUnitId(monitorUnitId)); + } - HwMonitorUnit hwMonitorUnits = hwMonitorUnitService.selectHwMonitorUnitByMonitorUnitId(monitorUnitId); + /** + * 根据监控单元ID获取设备信息,分可控制设备和上传数据设备 + * + * @param monitorUnitId 监控单元id + */ + @GetMapping("/selectDevicesByMonitorUnitId/{monitorUnitId}/{sceneId}") + public AjaxResult selectDeviceByDeviceModeByMonitorUnitId(@PathVariable("monitorUnitId") Long monitorUnitId, + @PathVariable("sceneId") Long sceneId) { + HwDevice queryHwDevice = new HwDevice(); + queryHwDevice.setMonitorUnitId(monitorUnitId); + queryHwDevice.setSceneId(sceneId); - return AjaxResult.success(monitorUnitId); + return success(hwDeviceService.getDevicesByMonitor(queryHwDevice)); } + + /** - * 2. 设备实时在运数量曲线图 - * @param beginTime 开始时间 - * @param endTime 结束时间 - * @param sceneId 场景id - * */ - @PostMapping("/getDeviceOperations") - public R> selectTdengine(String beginTime,String endTime,Long sceneId){ + * @description 根据场景ID获取设备模型列表 + * @author xins + * @date 2023-09-16 12:44 + */ + @PostMapping("/getDeviceModesBySceneId") + public AjaxResult getDeviceModesBySceneId(@RequestBody HwDeviceMode queryHwDeviceMode) { + return success(hwDeviceModeService.selectHwDeviceModeList(queryHwDeviceMode)); + } - Map objectIntegerMap = hwMonitorUnitService.selectTdengine(beginTime, endTime, sceneId); - return R.ok(objectIntegerMap); + /** + * @return AjaxResult + * @param: monitorUnitId + * @description 根据设备模型获取最新数据 + * @author xins + * @date 2023-09-16 12:45 + */ + @PostMapping("/selectLatestDataByDeviceMode") + public AjaxResult selectLatestDataByDeviceMode(@Validated @RequestBody DeviceLatestDataVo deviceLatestData) { + JSONObject returnObj = new JSONObject(); + List> latestDataMaps = hwMonitorPlatformService.selectLatestDataByTags(deviceLatestData); + List deviceDataColumnVos = this.getDeviceDataColumns(latestDataMaps); + TableDataInfo tableDataInfo = getDataTable(latestDataMaps); + returnObj.put("deviceDataColumns", deviceDataColumnVos); + returnObj.put("latestData", tableDataInfo); + return success(returnObj); } + + + @GetMapping("/getDeviceInfo/{deviceId}") + public AjaxResult getDeviceInfo(@PathVariable("deviceId") Long deviceId){ + HwDevice device = hwDeviceService.selectHwDeviceJoinByDeviceId(deviceId); + return success(device); + } + + @GetMapping("/getLinkDevices/{deviceId}") + public AjaxResult getLinkDevices(@PathVariable("deviceId")Long deviceId){ + return success(hwDeviceService.selectLinkDeviceList(deviceId)); + } + /** - * 设备汇总 - * */ - @PostMapping("/selectLatestDataByTags") - public R>>selectLatestDataByTags(Long monitorUnitId){ + * @return AjaxResult + * @param: deviceHistoryData + * @description 获取设备历史数据 + * @author xins + * @date 2023-09-16 15:15 + */ + @PostMapping("/getHistoryData") + public AjaxResult getHistoryData(@Validated @RequestBody DeviceHistoryDataVo deviceHistoryData) { +// startPage(); + JSONObject returnObj = new JSONObject(); + List> historyDataMaps = hwMonitorPlatformService.getHistoryData(deviceHistoryData); + List deviceDataColumnVos = this.getDeviceDataColumns(historyDataMaps); + TableDataInfo tableDataInfo = getDataTable(historyDataMaps); + returnObj.put("deviceDataColumns", deviceDataColumnVos); + returnObj.put("historyData", tableDataInfo); + return success(returnObj); + + } - R>> mapR = hwMonitorUnitService.selectLatestDataByTags(monitorUnitId); - return mapR; + private List getDeviceDataColumns(List> latestDataMaps){ + List deviceDataColumnVos = new ArrayList(); + if (latestDataMaps != null && latestDataMaps.size() > 0) { + Map latestDataMap = latestDataMaps.get(0); + for (Map.Entry entry : latestDataMap.entrySet()) { + DeviceDataColumnVo deviceDataColumnVo = new DeviceDataColumnVo(); + String columnKey = entry.getKey(); + deviceDataColumnVo.setColumnKey(columnKey); + deviceDataColumnVo.setColumnName(TdEngineConstants.DEVICE_DATA_COLUMN_MAP.get(columnKey) == null + ? columnKey : TdEngineConstants.DEVICE_DATA_COLUMN_MAP.get(columnKey)); + deviceDataColumnVos.add(deviceDataColumnVo); + } + } + return deviceDataColumnVos; } + /** * 场景选择 * ,id=0 可以返回所有,其他根据id过滤,默认标识 - * - * */ - @PostMapping("/SelectSecne") - public TableDataInfo SelectSecneByUser(){ - LoginUser loginUser = SecurityUtils.getLoginUser(); - SysUser sysUser = loginUser.getSysUser(); - Long tenantId = sysUser.getTenantId(); - List hwScenes = hwSceneService.selectHwSceneByTenantId(tenantId); - if (hwScenes.size()!=0){ - hwScenes.get(0).setDefaultFlag("1");} - return getDataTable(hwScenes); - } - /** - * 报警列表 - * 无alarminfo表 - * */ + */ + @GetMapping("/selectSecnes") + public AjaxResult selectSecnes(HwScene scene) { + List hwScenes = hwSceneService.selectHwSceneList(scene); + return success(hwScenes); + } } diff --git a/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/controller/HwMonitorUnitController.java b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/controller/HwMonitorUnitController.java index bcca3ba..fd44112 100644 --- a/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/controller/HwMonitorUnitController.java +++ b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/controller/HwMonitorUnitController.java @@ -1,21 +1,8 @@ package com.ruoyi.business.controller; -import java.util.ArrayList; import java.util.List; -import java.util.Map; -import javax.annotation.Resource; +import java.io.IOException; import javax.servlet.http.HttpServletResponse; - -import com.ruoyi.business.domain.HwScene; -import com.ruoyi.business.domain.VO.*; -import com.ruoyi.business.mapper.HwSceneMapper; -import com.ruoyi.business.service.IHwDeviceService; -import com.ruoyi.business.service.IHwElectronicFenceService; -import com.ruoyi.business.service.IHwSceneService; -import com.ruoyi.common.core.domain.R; -import com.ruoyi.common.security.utils.SecurityUtils; -import com.ruoyi.system.api.domain.SysUser; -import com.ruoyi.system.api.model.LoginUser; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PostMapping; @@ -33,13 +20,12 @@ import com.ruoyi.business.service.IHwMonitorUnitService; 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 YINQ - * @date 2023-08-31 + * + * @author xins + * @date 2023-09-14 */ @RestController @RequestMapping("/monitorUnit") @@ -47,28 +33,18 @@ public class HwMonitorUnitController extends BaseController { @Autowired private IHwMonitorUnitService hwMonitorUnitService; - @Autowired - private IHwDeviceService hwDeviceService; - @Autowired - private IHwSceneService hwSceneService; - @Autowired - private IHwElectronicFenceService hwElectronicFenceService; - - /** * 查询监控单元列表 */ @RequiresPermissions("business:monitorUnit:list") @GetMapping("/list") - public TableDataInfo list(HwMonitorUnit hwMonitorUnit) + public AjaxResult list(HwMonitorUnit hwMonitorUnit) { - startPage(); List list = hwMonitorUnitService.selectHwMonitorUnitList(hwMonitorUnit); - return getDataTable(list); + return success(list); } - /** * 导出监控单元列表 */ @@ -92,7 +68,6 @@ public class HwMonitorUnitController extends BaseController return success(hwMonitorUnitService.selectHwMonitorUnitByMonitorUnitId(monitorUnitId)); } - /** * 新增监控单元 */ @@ -125,9 +100,4 @@ public class HwMonitorUnitController extends BaseController { return toAjax(hwMonitorUnitService.deleteHwMonitorUnitByMonitorUnitIds(monitorUnitIds)); } - - - - - } diff --git a/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/controller/HwSceneController.java b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/controller/HwSceneController.java index 80e8d0a..5536b50 100644 --- a/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/controller/HwSceneController.java +++ b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/controller/HwSceneController.java @@ -140,7 +140,13 @@ public class HwSceneController extends BaseController } } - + /** + * 查询场景信息列表供选择使用(例如下拉列表) + */ + @GetMapping("/getScenes") + public AjaxResult getScenes(HwScene hwScene) { + return success(hwSceneService.selectHwSceneList(hwScene)); + } } diff --git a/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/domain/HwAlarmInfo.java b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/domain/HwAlarmInfo.java new file mode 100644 index 0000000..bf8da07 --- /dev/null +++ b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/domain/HwAlarmInfo.java @@ -0,0 +1,316 @@ +package com.ruoyi.business.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; + +/** + * 报警信息对象 hw_alarm_info + * + * @author xins + * @date 2023-09-15 + */ +public class HwAlarmInfo extends BaseEntity { + private static final long serialVersionUID = 1L; + + /** + * 报警信息ID + */ + private Long alarmInfoId; + + /** + * 报警信息类型(1、设备报警,2、监控单元报警,3、离线报警,4、电子围栏) + */ + @Excel(name = "报警信息类型", readConverterExp = "1=、设备报警,2、监控单元报警,3、离线报警,4、电子围栏") + private String alarmInfoType; + + /** + * 报警信息类型是1关联表alarm_rule的字段alarm_rule_id; + * 报警信息类型是3关联表hw_offline_rule的字段offline_rule_id; + * 报警信息类型是4关联表hw_electronic_fence的字段electronic_fence_id。 + */ + @Excel(name = "报警信息类型") + private Long alarmReleatedId; + + /** + * 报警设备ID,关联hw_device表的device_id字段 + */ + @Excel(name = "报警设备ID,关联hw_device表的device_id字段") + private Long deviceId; + + /** + * 所属监控单元Id,关联表hw_monitor_unit字段monitor_unit_id + */ + @Excel(name = "所属监控单元Id,关联表hw_monitor_unit字段monitor_unit_id") + private Long monitorUnitId; + + /** + * 租户ID,关联hw_tenant的tenant_id + */ + @Excel(name = "租户ID,关联hw_tenant的tenant_id") + private Long tenantId; + + /** + * 所属场景ID,关联hw_scene的scene_id + */ + @Excel(name = "所属场景ID,关联hw_scene的scene_id") + private Long sceneId; + + /** + * 报警级别,关联hw_alarm_level的字段alarm_level_id,报警信息类型为1、2和3时保存 + */ + @Excel(name = "报警级别,关联hw_alarm_level的字段alarm_level_id,报警信息类型为1、2和3时保存") + private Long alarmLevelId; + + /** + * 报警类型,关联hw_alarm_type的字段alarm_type_id,报警信息类型为1和2时保存 + */ + @Excel(name = "报警类型,关联hw_alarm_type的字段alarm_type_id,报警信息类型为1和2时保存") + private Long alarmTypeId; + + /** + * 设备模型功能ID + */ + @Excel(name = "设备模型功能ID") + private Long modeFunctionId; + + /** + * 功能名称 + */ + @Excel(name = "功能名称") + private String functionName; + + /** + * 标识符 + */ + @Excel(name = "标识符") + private String functionIdentifier; + + /** + * 最新的值,如果是电子围栏则存经度,纬度 + */ + @Excel(name = "最新的值,如果是电子围栏则存经度,纬度") + private String functionValue; + + /** + * 触发状态(1、出界,2、入界,3、双向),报警信息类型为4时保存 + */ + @Excel(name = "触发状态", readConverterExp = "1=、出界,2、入界,3、双向") + private String triggerStatus; + + /** + * 处理状态(0、未处理 1、已处理) + */ + @Excel(name = "处理状态", readConverterExp = "0=、未处理,1=、已处理") + private String handleStatus; + + /** + * 实际报警时间 + */ + @JsonFormat(pattern = "yyyy-MM-dd") + @Excel(name = "实际报警时间", width = 30, dateFormat = "yyyy-MM-dd") + private Date alarmTime; + + /** + * 预留字段 + */ + @Excel(name = "预留字段") + private String alarmInfoField; + + private String monitorUnitName; + private String alarmLevelName; + private String alarmTypeName; + + public void setAlarmInfoId(Long alarmInfoId) { + this.alarmInfoId = alarmInfoId; + } + + public Long getAlarmInfoId() { + return alarmInfoId; + } + + public void setAlarmInfoType(String alarmInfoType) { + this.alarmInfoType = alarmInfoType; + } + + public String getAlarmInfoType() { + return alarmInfoType; + } + + public void setAlarmReleatedId(Long alarmReleatedId) { + this.alarmReleatedId = alarmReleatedId; + } + + public Long getAlarmReleatedId() { + return alarmReleatedId; + } + + public void setDeviceId(Long deviceId) { + this.deviceId = deviceId; + } + + public Long getDeviceId() { + return deviceId; + } + + public void setMonitorUnitId(Long monitorUnitId) { + this.monitorUnitId = monitorUnitId; + } + + public Long getMonitorUnitId() { + return monitorUnitId; + } + + public void setTenantId(Long tenantId) { + this.tenantId = tenantId; + } + + public Long getTenantId() { + return tenantId; + } + + public void setSceneId(Long sceneId) { + this.sceneId = sceneId; + } + + public Long getSceneId() { + return sceneId; + } + + public void setAlarmLevelId(Long alarmLevelId) { + this.alarmLevelId = alarmLevelId; + } + + public Long getAlarmLevelId() { + return alarmLevelId; + } + + public void setAlarmTypeId(Long alarmTypeId) { + this.alarmTypeId = alarmTypeId; + } + + public Long getAlarmTypeId() { + return alarmTypeId; + } + + public void setModeFunctionId(Long modeFunctionId) { + this.modeFunctionId = modeFunctionId; + } + + public Long getModeFunctionId() { + return modeFunctionId; + } + + public void setFunctionName(String functionName) { + this.functionName = functionName; + } + + public String getFunctionName() { + return functionName; + } + + public void setFunctionIdentifier(String functionIdentifier) { + this.functionIdentifier = functionIdentifier; + } + + public String getFunctionIdentifier() { + return functionIdentifier; + } + + public void setFunctionValue(String functionValue) { + this.functionValue = functionValue; + } + + public String getFunctionValue() { + return functionValue; + } + + public void setTriggerStatus(String triggerStatus) { + this.triggerStatus = triggerStatus; + } + + public String getTriggerStatus() { + return triggerStatus; + } + + public void setHandleStatus(String handleStatus) { + this.handleStatus = handleStatus; + } + + public String getHandleStatus() { + return handleStatus; + } + + public void setAlarmTime(Date alarmTime) { + this.alarmTime = alarmTime; + } + + public Date getAlarmTime() { + return alarmTime; + } + + public void setAlarmInfoField(String alarmInfoField) { + this.alarmInfoField = alarmInfoField; + } + + public String getAlarmInfoField() { + return alarmInfoField; + } + + public String getMonitorUnitName() { + return monitorUnitName; + } + + public void setMonitorUnitName(String monitorUnitName) { + this.monitorUnitName = monitorUnitName; + } + + public String getAlarmLevelName() { + return alarmLevelName; + } + + public void setAlarmLevelName(String alarmLevelName) { + this.alarmLevelName = alarmLevelName; + } + + public String getAlarmTypeName() { + return alarmTypeName; + } + + public void setAlarmTypeName(String alarmTypeName) { + this.alarmTypeName = alarmTypeName; + } + + @Override + public String toString() { + return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE) + .append("alarmInfoId", getAlarmInfoId()) + .append("alarmInfoType", getAlarmInfoType()) + .append("alarmReleatedId", getAlarmReleatedId()) + .append("deviceId", getDeviceId()) + .append("monitorUnitId", getMonitorUnitId()) + .append("tenantId", getTenantId()) + .append("sceneId", getSceneId()) + .append("alarmLevelId", getAlarmLevelId()) + .append("alarmTypeId", getAlarmTypeId()) + .append("modeFunctionId", getModeFunctionId()) + .append("functionName", getFunctionName()) + .append("functionIdentifier", getFunctionIdentifier()) + .append("functionValue", getFunctionValue()) + .append("triggerStatus", getTriggerStatus()) + .append("handleStatus", getHandleStatus()) + .append("alarmTime", getAlarmTime()) + .append("createTime", getCreateTime()) + .append("updateBy", getUpdateBy()) + .append("updateTime", getUpdateTime()) + .append("alarmInfoField", getAlarmInfoField()) + .append("monitorUnitName", getMonitorUnitName()) + .append("alarmLevelName", getAlarmLevelName()) + .append("alarmTypeName", getAlarmTypeName()) + .toString(); + } +} diff --git a/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/domain/HwAlarmLevel.java b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/domain/HwAlarmLevel.java new file mode 100644 index 0000000..a7d11b9 --- /dev/null +++ b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/domain/HwAlarmLevel.java @@ -0,0 +1,168 @@ +package com.ruoyi.business.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; + +/** + * 报警级别对象 hw_alarm_level + * + * @author xins + * @date 2023-09-15 + */ +public class HwAlarmLevel extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + /** 报警级别ID */ + private Long alarmLevelId; + + /** 报警级别名称 */ + @Excel(name = "报警级别名称") + private String alarmLevelName; + + /** 租户ID,关联hw_tenant的tenant_id */ + @Excel(name = "租户ID,关联hw_tenant的tenant_id") + private Long tenantId; + + /** 所属场景,关联hw_scene表的scene_id字段 */ + @Excel(name = "所属场景,关联hw_scene表的scene_id字段") + private Long sceneId; + + /** 语言code,关联表hw_language的language_code字段 */ + @Excel(name = "语言code,关联表hw_language的language_code字段") + private String languageCode; + + /** 通用标识(1:是,0:否) */ + @Excel(name = "通用标识", readConverterExp = "1=:是,0:否") + private String commonFlag; + + /** 严重程度(数字越大,级别越高) */ + @Excel(name = "严重程度", readConverterExp = "数=字越大,级别越高") + private Long levelNumber; + + /** 状态(1、正常,9、删除) */ + @Excel(name = "状态", readConverterExp = "1=、正常,9、删除") + private String levelStatus; + + /** 默认通知方式(1、邮箱,2、短信,3、钉钉,4、微信公众号,5、企业微信),多个保存用,隔开。 */ + @Excel(name = "默认通知方式", readConverterExp = "1=、邮箱,2、短信,3、钉钉,4、微信公众号,5、企业微信") + private String defaultNotifyMode; + + /** 预留字段 */ + @Excel(name = "预留字段") + private String alarmLevelField; + + public void setAlarmLevelId(Long alarmLevelId) + { + this.alarmLevelId = alarmLevelId; + } + + public Long getAlarmLevelId() + { + return alarmLevelId; + } + public void setAlarmLevelName(String alarmLevelName) + { + this.alarmLevelName = alarmLevelName; + } + + public String getAlarmLevelName() + { + return alarmLevelName; + } + public void setTenantId(Long tenantId) + { + this.tenantId = tenantId; + } + + public Long getTenantId() + { + return tenantId; + } + public void setSceneId(Long sceneId) + { + this.sceneId = sceneId; + } + + public Long getSceneId() + { + return sceneId; + } + public void setLanguageCode(String languageCode) + { + this.languageCode = languageCode; + } + + public String getLanguageCode() + { + return languageCode; + } + public void setCommonFlag(String commonFlag) + { + this.commonFlag = commonFlag; + } + + public String getCommonFlag() + { + return commonFlag; + } + public void setLevelNumber(Long levelNumber) + { + this.levelNumber = levelNumber; + } + + public Long getLevelNumber() + { + return levelNumber; + } + public void setLevelStatus(String levelStatus) + { + this.levelStatus = levelStatus; + } + + public String getLevelStatus() + { + return levelStatus; + } + public void setDefaultNotifyMode(String defaultNotifyMode) + { + this.defaultNotifyMode = defaultNotifyMode; + } + + public String getDefaultNotifyMode() + { + return defaultNotifyMode; + } + public void setAlarmLevelField(String alarmLevelField) + { + this.alarmLevelField = alarmLevelField; + } + + public String getAlarmLevelField() + { + return alarmLevelField; + } + + @Override + public String toString() { + return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) + .append("alarmLevelId", getAlarmLevelId()) + .append("alarmLevelName", getAlarmLevelName()) + .append("tenantId", getTenantId()) + .append("sceneId", getSceneId()) + .append("languageCode", getLanguageCode()) + .append("commonFlag", getCommonFlag()) + .append("levelNumber", getLevelNumber()) + .append("levelStatus", getLevelStatus()) + .append("defaultNotifyMode", getDefaultNotifyMode()) + .append("remark", getRemark()) + .append("createBy", getCreateBy()) + .append("createTime", getCreateTime()) + .append("updateBy", getUpdateBy()) + .append("updateTime", getUpdateTime()) + .append("alarmLevelField", getAlarmLevelField()) + .toString(); + } +} diff --git a/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/domain/HwAlarmType.java b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/domain/HwAlarmType.java new file mode 100644 index 0000000..61c07c4 --- /dev/null +++ b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/domain/HwAlarmType.java @@ -0,0 +1,154 @@ +package com.ruoyi.business.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; + +/** + * 报警类型对象 hw_alarm_type + * + * @author xins + * @date 2023-09-15 + */ +public class HwAlarmType extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + /** 报警类型ID */ + private Long alarmTypeId; + + /** 报警类型名称 */ + @Excel(name = "报警类型名称") + private String alarmTypeName; + + /** 租户ID,关联hw_tenant的tenant_id */ + @Excel(name = "租户ID,关联hw_tenant的tenant_id") + private Long tenantId; + + /** 所属场景,关联hw_scene表的scene_id字段 */ + @Excel(name = "所属场景,关联hw_scene表的scene_id字段") + private Long sceneId; + + /** 语言code,关联表hw_language的language_code字段 */ + @Excel(name = "语言code,关联表hw_language的language_code字段") + private String languageCode; + + /** 通用标识(1:是,0:否) */ + @Excel(name = "通用标识", readConverterExp = "1=:是,0:否") + private String commonFlag; + + /** 处理方式(1、云端处理,2:终端上报) */ + @Excel(name = "处理方式", readConverterExp = "1=、云端处理,2:终端上报") + private String handleMode; + + /** 状态(1、正常,9、删除) */ + @Excel(name = "状态", readConverterExp = "1=、正常,9、删除") + private String typeStatus; + + /** 预留字段 */ + @Excel(name = "预留字段") + private String alarmTypeField; + + public void setAlarmTypeId(Long alarmTypeId) + { + this.alarmTypeId = alarmTypeId; + } + + public Long getAlarmTypeId() + { + return alarmTypeId; + } + public void setAlarmTypeName(String alarmTypeName) + { + this.alarmTypeName = alarmTypeName; + } + + public String getAlarmTypeName() + { + return alarmTypeName; + } + public void setTenantId(Long tenantId) + { + this.tenantId = tenantId; + } + + public Long getTenantId() + { + return tenantId; + } + public void setSceneId(Long sceneId) + { + this.sceneId = sceneId; + } + + public Long getSceneId() + { + return sceneId; + } + public void setLanguageCode(String languageCode) + { + this.languageCode = languageCode; + } + + public String getLanguageCode() + { + return languageCode; + } + public void setCommonFlag(String commonFlag) + { + this.commonFlag = commonFlag; + } + + public String getCommonFlag() + { + return commonFlag; + } + public void setHandleMode(String handleMode) + { + this.handleMode = handleMode; + } + + public String getHandleMode() + { + return handleMode; + } + public void setTypeStatus(String typeStatus) + { + this.typeStatus = typeStatus; + } + + public String getTypeStatus() + { + return typeStatus; + } + public void setAlarmTypeField(String alarmTypeField) + { + this.alarmTypeField = alarmTypeField; + } + + public String getAlarmTypeField() + { + return alarmTypeField; + } + + @Override + public String toString() { + return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) + .append("alarmTypeId", getAlarmTypeId()) + .append("alarmTypeName", getAlarmTypeName()) + .append("tenantId", getTenantId()) + .append("sceneId", getSceneId()) + .append("languageCode", getLanguageCode()) + .append("commonFlag", getCommonFlag()) + .append("handleMode", getHandleMode()) + .append("typeStatus", getTypeStatus()) + .append("remark", getRemark()) + .append("createBy", getCreateBy()) + .append("createTime", getCreateTime()) + .append("updateBy", getUpdateBy()) + .append("updateTime", getUpdateTime()) + .append("alarmTypeField", getAlarmTypeField()) + .toString(); + } +} diff --git a/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/domain/HwDevice.java b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/domain/HwDevice.java index d3f4e65..3c2890d 100644 --- a/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/domain/HwDevice.java +++ b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/domain/HwDevice.java @@ -114,6 +114,8 @@ public class HwDevice extends BaseEntity @Excel(name = "在线状态", readConverterExp = "1=、在线,0、离线") private String onlineStatus; + private String monitorUnitName; + public void setDeviceId(Long deviceId) { this.deviceId = deviceId; @@ -331,6 +333,14 @@ public class HwDevice extends BaseEntity return onlineStatus; } + public String getMonitorUnitName() { + return monitorUnitName; + } + + public void setMonitorUnitName(String monitorUnitName) { + this.monitorUnitName = monitorUnitName; + } + @Override public String toString() { return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) diff --git a/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/domain/HwElectronicFence.java b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/domain/HwElectronicFence.java index 9fe3f33..d26c35f 100644 --- a/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/domain/HwElectronicFence.java +++ b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/domain/HwElectronicFence.java @@ -1,5 +1,6 @@ package com.ruoyi.business.domain; +import java.util.List; import org.apache.commons.lang3.builder.ToStringBuilder; import org.apache.commons.lang3.builder.ToStringStyle; import com.ruoyi.common.core.annotation.Excel; @@ -9,7 +10,7 @@ import com.ruoyi.common.core.web.domain.BaseEntity; * 电子围栏对象 hw_electronic_fence * * @author xins - * @date 2023-09-04 + * @date 2023-09-15 */ public class HwElectronicFence extends BaseEntity { @@ -70,6 +71,9 @@ public class HwElectronicFence extends BaseEntity @Excel(name = "预留字段") private String fenceField; + /** 电子围栏目标信息 */ + private List hwFenceTargetList; + public void setElectronicFenceId(Long electronicFenceId) { this.electronicFenceId = electronicFenceId; @@ -197,6 +201,16 @@ public class HwElectronicFence extends BaseEntity return fenceField; } + public List getHwFenceTargetList() + { + return hwFenceTargetList; + } + + public void setHwFenceTargetList(List hwFenceTargetList) + { + this.hwFenceTargetList = hwFenceTargetList; + } + @Override public String toString() { return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) @@ -219,6 +233,7 @@ public class HwElectronicFence extends BaseEntity .append("updateBy", getUpdateBy()) .append("updateTime", getUpdateTime()) .append("fenceField", getFenceField()) + .append("hwFenceTargetList", getHwFenceTargetList()) .toString(); } } diff --git a/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/domain/HwFenceTarget.java b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/domain/HwFenceTarget.java index 0088e75..beeb66a 100644 --- a/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/domain/HwFenceTarget.java +++ b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/domain/HwFenceTarget.java @@ -9,7 +9,7 @@ import com.ruoyi.common.core.web.domain.BaseEntity; * 电子围栏目标对象 hw_fence_target * * @author xins - * @date 2023-09-04 + * @date 2023-09-15 */ public class HwFenceTarget extends BaseEntity { diff --git a/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/domain/HwMonitorUnit.java b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/domain/HwMonitorUnit.java index 6772942..4552fa9 100644 --- a/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/domain/HwMonitorUnit.java +++ b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/domain/HwMonitorUnit.java @@ -4,6 +4,7 @@ import java.math.BigDecimal; import java.util.ArrayList; import java.util.List; +import com.ruoyi.system.api.domain.SysDept; import org.apache.commons.lang3.builder.ToStringBuilder; import org.apache.commons.lang3.builder.ToStringStyle; import com.ruoyi.common.core.annotation.Excel; @@ -63,6 +64,9 @@ public class HwMonitorUnit extends BaseEntity private String monitorUnitField; private List child = new ArrayList(); + /** 子部门 */ + private List children = new ArrayList(); + public List getChild() { return child; } @@ -71,6 +75,14 @@ public class HwMonitorUnit extends BaseEntity this.child = child; } + public List getChildren() { + return children; + } + + public void setChildren(List children) { + this.children = children; + } + public void setMonitorUnitId(Long monitorUnitId) { this.monitorUnitId = monitorUnitId; @@ -174,22 +186,22 @@ public class HwMonitorUnit extends BaseEntity @Override public String toString() { return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) - .append("monitorUnitId", getMonitorUnitId()) - .append("monitorUnitName", getMonitorUnitName()) - .append("sceneId", getSceneId()) - .append("parentId", getParentId()) - .append("monitorUnitTypeId", getMonitorUnitTypeId()) - .append("areaId", getAreaId()) - .append("monitorAddress", getMonitorAddress()) - .append("monitorPic", getMonitorPic()) - .append("preserveTime", getPreserveTime()) - .append("remark", getRemark()) - .append("monitorUnitStatus", getMonitorUnitStatus()) - .append("createBy", getCreateBy()) - .append("createTime", getCreateTime()) - .append("updateBy", getUpdateBy()) - .append("updateTime", getUpdateTime()) - .append("monitorUnitField", getMonitorUnitField()) - .toString(); - } -} + .append("monitorUnitId", getMonitorUnitId()) + .append("monitorUnitName", getMonitorUnitName()) + .append("sceneId", getSceneId()) + .append("parentId", getParentId()) + .append("monitorUnitTypeId", getMonitorUnitTypeId()) + .append("areaId", getAreaId()) + .append("monitorAddress", getMonitorAddress()) + .append("monitorPic", getMonitorPic()) + .append("preserveTime", getPreserveTime()) + .append("remark", getRemark()) + .append("monitorUnitStatus", getMonitorUnitStatus()) + .append("createBy", getCreateBy()) + .append("createTime", getCreateTime()) + .append("updateBy", getUpdateBy()) + .append("updateTime", getUpdateTime()) + .append("monitorUnitField", getMonitorUnitField()) + .toString(); + } +} \ No newline at end of file diff --git a/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/domain/VO/AlarmTypeVo.java b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/domain/VO/AlarmTypeVo.java new file mode 100644 index 0000000..86b8935 --- /dev/null +++ b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/domain/VO/AlarmTypeVo.java @@ -0,0 +1,39 @@ +package com.ruoyi.business.domain.VO; + +/** + * @Description: 报警信息VO + * @ClassName: AlarmTypeVo + * @Author : xins + * @Date :2023-09-15 13:10 + * @Version :1.0 + */ +public class AlarmTypeVo { + + private Long alarmTypeId; + private String alarmTypeName; + private Integer alarmCount; + + public Long getAlarmTypeId() { + return alarmTypeId; + } + + public void setAlarmTypeId(Long alarmTypeId) { + this.alarmTypeId = alarmTypeId; + } + + public String getAlarmTypeName() { + return alarmTypeName; + } + + public void setAlarmTypeName(String alarmTypeName) { + this.alarmTypeName = alarmTypeName; + } + + public Integer getAlarmCount() { + return alarmCount; + } + + public void setAlarmCount(Integer alarmCount) { + this.alarmCount = alarmCount; + } +} diff --git a/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/domain/VO/DeviceDataColumnVo.java b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/domain/VO/DeviceDataColumnVo.java new file mode 100644 index 0000000..696de6b --- /dev/null +++ b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/domain/VO/DeviceDataColumnVo.java @@ -0,0 +1,18 @@ +package com.ruoyi.business.domain.VO; + +import lombok.Data; + +/** + * @Description: 设备数据动态字段实体对象 + * @ClassName: DeviceDataColumnVo + * @Author : xins + * @Date :2023-09-16 16:20 + * @Version :1.0 + */ +@Data +public class DeviceDataColumnVo { + + private String columnName; + + private String columnKey; +} diff --git a/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/domain/VO/DeviceHistoryDataVo.java b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/domain/VO/DeviceHistoryDataVo.java new file mode 100644 index 0000000..2484b19 --- /dev/null +++ b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/domain/VO/DeviceHistoryDataVo.java @@ -0,0 +1,37 @@ +package com.ruoyi.business.domain.VO; + +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; + +/** + * @Description:历史数据实体对象 + * @ClassName: DeviceLatestDataVo + * @Author : xins + * @Date :2023-09-16 14:46 + * @Version :1.0 + */ +@Data +public class DeviceHistoryDataVo { + + @NotNull(message="sceneId cannot be null") + private Long sceneId; + + @NotNull(message="deviceId cannot be null") + private Long deviceId; + + private int limit; + + //指定从第几条之后输出(例如:limit 2,5,输出第3行到第7行的数据) + private int offset; + + + //过滤条件:开始时间 + private long startTime; + + //过滤条件:结束时间 + private long endTime; + + +} diff --git a/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/domain/VO/DeviceLatestDataVo.java b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/domain/VO/DeviceLatestDataVo.java new file mode 100644 index 0000000..068fdb4 --- /dev/null +++ b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/domain/VO/DeviceLatestDataVo.java @@ -0,0 +1,43 @@ +package com.ruoyi.business.domain.VO; + +import lombok.Data; + +import javax.validation.constraints.NotNull; + +/** + * @Description:最新数据实体对象 + * @ClassName: DeviceLatestDataVo + * @Author : xins + * @Date :2023-09-16 14:46 + * @Version :1.0 + */ +@Data +public class DeviceLatestDataVo { + + @NotNull(message="sceneId cannot be null") + private Long sceneId; + + @NotNull(message="deviceModeId cannot be null") + private Long deviceModeId; + + private int limit; + + //指定从第几条之后输出(例如:limit 2,5,输出第3行到第7行的数据) + private int offset; + + /** + * 第一个字段,数据类型必须是timestamp + */ + private String firstFieldName; + + //过滤条件:开始时间 + private long startTime; + + //过滤条件:结束时间 + private long endTime; + + private String deviceCode; + + private String deviceName; + +} diff --git a/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/domain/VO/DeviceModeVo.java b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/domain/VO/DeviceModeVo.java index 597d10b..c023b79 100644 --- a/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/domain/VO/DeviceModeVo.java +++ b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/domain/VO/DeviceModeVo.java @@ -15,9 +15,9 @@ public class DeviceModeVo { public Integer err; - public Double percentage; + public String percentage; - public Double getPercentage() { + public String getPercentage() { return percentage; } @@ -45,7 +45,7 @@ public class DeviceModeVo { this.err = err; } - public void setPercentage(Double percentage) { + public void setPercentage(String percentage) { this.percentage = percentage; } diff --git a/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/domain/VO/ElectronicFenceVo.java b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/domain/VO/ElectronicFenceVo.java new file mode 100644 index 0000000..34cb17a --- /dev/null +++ b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/domain/VO/ElectronicFenceVo.java @@ -0,0 +1,89 @@ +package com.ruoyi.business.domain.VO; + +import java.util.List; + +public class ElectronicFenceVo { + + public Integer deviceCount; + + public Integer abnormalCount; + + public String areaShapeFlag;//1,多边形,2,圆形 + + public AreaPoint centerPoint;//圆形中心点 + + public List areaPoints;//多边型点 + public Double radius; + + public Integer getDeviceCount() { + return deviceCount; + } + + public void setDeviceCount(Integer deviceCount) { + this.deviceCount = deviceCount; + } + + public Integer getAbnormalCount() { + return abnormalCount; + } + + public void setAbnormalCount(Integer abnormalCount) { + this.abnormalCount = abnormalCount; + } + + public String getAreaShapeFlag() { + return areaShapeFlag; + } + + public void setAreaShapeFlag(String areaShapeFlag) { + this.areaShapeFlag = areaShapeFlag; + } + + public AreaPoint getCenterPoint() { + return centerPoint; + } + + public void setCenterPoint(AreaPoint centerPoint) { + this.centerPoint = centerPoint; + } + + public List getAreaPoints() { + return areaPoints; + } + + public void setAreaPoints(List areaPoints) { + this.areaPoints = areaPoints; + } + + public Double getRadius() { + return radius; + } + + public void setRadius(Double radius) { + this.radius = radius; + } + + public static class AreaPoint{ + private Double longitude; + private Double latitude; + + public Double getLongitude() { + return longitude; + } + + public void setLongitude(Double longitude) { + this.longitude = longitude; + } + + public Double getLatitude() { + return latitude; + } + + public void setLatitude(Double latitude) { + this.latitude = latitude; + } + + + } + +} diff --git a/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/domain/VO/HwDeviceVo.java b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/domain/VO/HwDeviceVo.java new file mode 100644 index 0000000..644f9d3 --- /dev/null +++ b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/domain/VO/HwDeviceVo.java @@ -0,0 +1,37 @@ +package com.ruoyi.business.domain.VO; + +import java.util.List; +import java.util.Map; + +public class HwDeviceVo { + + private String deviceType;//1、开关属性(控制属性),2、只有采集属性 + private String deviceName; + + private List> deviceDataMaps; + + + public String getDeviceType() { + return deviceType; + } + + public void setDeviceType(String deviceType) { + this.deviceType = deviceType; + } + + public String getDeviceName() { + return deviceName; + } + + public void setDeviceName(String deviceName) { + this.deviceName = deviceName; + } + + public List> getDeviceDataMaps() { + return deviceDataMaps; + } + + public void setDeviceDataMaps(List> deviceDataMaps) { + this.deviceDataMaps = deviceDataMaps; + } +} diff --git a/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/domain/VO/HwMonitorUnitVo.java b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/domain/VO/HwMonitorUnitVo.java index 43ba2f8..e5467bf 100644 --- a/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/domain/VO/HwMonitorUnitVo.java +++ b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/domain/VO/HwMonitorUnitVo.java @@ -9,26 +9,26 @@ package com.ruoyi.business.domain.VO; public class HwMonitorUnitVo { public String sceneName; - public String sceneId; + public Long sceneId; public Integer sum; public Integer err; - public Double percentage; + public String percentage; - public Double getPercentage() { + public String getPercentage() { return percentage; } - public void setPercentage(Double percentage) { + public void setPercentage(String percentage) { this.percentage = percentage; } - public String getSceneId() { + public Long getSceneId() { return sceneId; } - public void setSceneId(String sceneId) { + public void setSceneId(Long sceneId) { this.sceneId = sceneId; } diff --git a/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/domain/VO/SubDeviceSumVo.java b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/domain/VO/SubDeviceSumVo.java index 6e601ec..dd26dc8 100644 --- a/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/domain/VO/SubDeviceSumVo.java +++ b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/domain/VO/SubDeviceSumVo.java @@ -7,42 +7,33 @@ package com.ruoyi.business.domain.VO; * @Date: 2023-09-04 13:42 */ public class SubDeviceSumVo { - private String SubSum; + private Integer SubSum; - private String DeviceNum; + private Integer DeviceNum; - private String OnlineDeviceNum; + private Integer OnlineDeviceNum; - public String getSubSum() { + public Integer getSubSum() { return SubSum; } - public void setSubSum(String subSum) { + public void setSubSum(Integer subSum) { SubSum = subSum; } - public String getDeviceNum() { + public Integer getDeviceNum() { return DeviceNum; } - public void setDeviceNum(String deviceNum) { + public void setDeviceNum(Integer deviceNum) { DeviceNum = deviceNum; } - public String getOnlineDeviceNum() { + public Integer getOnlineDeviceNum() { return OnlineDeviceNum; } - public void setOnlineDeviceNum(String onlineDeviceNum) { + public void setOnlineDeviceNum(Integer onlineDeviceNum) { OnlineDeviceNum = onlineDeviceNum; } - - @Override - public String toString() { - return "SubDeviceSumVo{" + - "SubSum='" + SubSum + '\'' + - ", DeviceNum='" + DeviceNum + '\'' + - ", OnlineDeviceNum='" + OnlineDeviceNum + '\'' + - '}'; - } } diff --git a/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/domain/VO/TreeSelectVo.java b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/domain/VO/TreeSelectVo.java new file mode 100644 index 0000000..a31d339 --- /dev/null +++ b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/domain/VO/TreeSelectVo.java @@ -0,0 +1,70 @@ +package com.ruoyi.business.domain.VO; + +import java.io.Serializable; +import java.util.List; +import java.util.stream.Collectors; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.ruoyi.business.domain.HwMonitorUnit; + + +/** + * Treeselect树结构实体类 + * + * @author ruoyi + */ +public class TreeSelectVo implements Serializable { + private static final long serialVersionUID = 1L; + + /** + * 节点ID + */ + private Long id; + + /** + * 节点名称 + */ + private String label; + + /** + * 子节点 + */ + @JsonInclude(JsonInclude.Include.NON_EMPTY) + private List children; + + public TreeSelectVo() { + + } + + public TreeSelectVo(HwMonitorUnit monitorUnit) { + this.id = monitorUnit.getMonitorUnitId(); + this.label = monitorUnit.getMonitorUnitName(); +// this.children = monitorUnit.getChildren().stream().map(TreeSelectVo::new).collect(Collectors.toList()); + } + + + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + public String getLabel() { + return label; + } + + public void setLabel(String label) { + this.label = label; + } + + public List getChildren() { + return children; + } + + public void setChildren(List children) { + this.children = children; + } +} + diff --git a/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/mapper/HwAlarmInfoMapper.java b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/mapper/HwAlarmInfoMapper.java new file mode 100644 index 0000000..bc7d488 --- /dev/null +++ b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/mapper/HwAlarmInfoMapper.java @@ -0,0 +1,65 @@ +package com.ruoyi.business.mapper; + +import java.util.List; +import com.ruoyi.business.domain.HwAlarmInfo; +import com.ruoyi.business.domain.VO.AlarmTypeVo; + +/** + * 报警信息Mapper接口 + * + * @author xins + * @date 2023-09-15 + */ +public interface HwAlarmInfoMapper +{ + /** + * 查询报警信息 + * + * @param alarmInfoId 报警信息主键 + * @return 报警信息 + */ + public HwAlarmInfo selectHwAlarmInfoByAlarmInfoId(Long alarmInfoId); + + /** + * 查询报警信息列表 + * + * @param hwAlarmInfo 报警信息 + * @return 报警信息集合 + */ + public List selectHwAlarmInfoList(HwAlarmInfo hwAlarmInfo); + + /** + * 新增报警信息 + * + * @param hwAlarmInfo 报警信息 + * @return 结果 + */ + public int insertHwAlarmInfo(HwAlarmInfo hwAlarmInfo); + + /** + * 修改报警信息 + * + * @param hwAlarmInfo 报警信息 + * @return 结果 + */ + public int updateHwAlarmInfo(HwAlarmInfo hwAlarmInfo); + + /** + * 删除报警信息 + * + * @param alarmInfoId 报警信息主键 + * @return 结果 + */ + public int deleteHwAlarmInfoByAlarmInfoId(Long alarmInfoId); + + /** + * 批量删除报警信息 + * + * @param alarmInfoIds 需要删除的数据主键集合 + * @return 结果 + */ + public int deleteHwAlarmInfoByAlarmInfoIds(Long[] alarmInfoIds); + + + public List selectAlarmsByAlarmType(Long sceneId); +} diff --git a/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/mapper/HwAlarmLevelMapper.java b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/mapper/HwAlarmLevelMapper.java new file mode 100644 index 0000000..900e477 --- /dev/null +++ b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/mapper/HwAlarmLevelMapper.java @@ -0,0 +1,61 @@ +package com.ruoyi.business.mapper; + +import java.util.List; +import com.ruoyi.business.domain.HwAlarmLevel; + +/** + * 报警级别Mapper接口 + * + * @author xins + * @date 2023-09-15 + */ +public interface HwAlarmLevelMapper +{ + /** + * 查询报警级别 + * + * @param alarmLevelId 报警级别主键 + * @return 报警级别 + */ + public HwAlarmLevel selectHwAlarmLevelByAlarmLevelId(Long alarmLevelId); + + /** + * 查询报警级别列表 + * + * @param hwAlarmLevel 报警级别 + * @return 报警级别集合 + */ + public List selectHwAlarmLevelList(HwAlarmLevel hwAlarmLevel); + + /** + * 新增报警级别 + * + * @param hwAlarmLevel 报警级别 + * @return 结果 + */ + public int insertHwAlarmLevel(HwAlarmLevel hwAlarmLevel); + + /** + * 修改报警级别 + * + * @param hwAlarmLevel 报警级别 + * @return 结果 + */ + public int updateHwAlarmLevel(HwAlarmLevel hwAlarmLevel); + + /** + * 删除报警级别 + * + * @param alarmLevelId 报警级别主键 + * @return 结果 + */ + public int deleteHwAlarmLevelByAlarmLevelId(Long alarmLevelId); + + /** + * 批量删除报警级别 + * + * @param alarmLevelIds 需要删除的数据主键集合 + * @return 结果 + */ + public int deleteHwAlarmLevelByAlarmLevelIds(Long[] alarmLevelIds); +} diff --git a/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/mapper/HwAlarmTypeMapper.java b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/mapper/HwAlarmTypeMapper.java new file mode 100644 index 0000000..6e07a0d --- /dev/null +++ b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/mapper/HwAlarmTypeMapper.java @@ -0,0 +1,61 @@ +package com.ruoyi.business.mapper; + +import java.util.List; +import com.ruoyi.business.domain.HwAlarmType; + +/** + * 报警类型Mapper接口 + * + * @author xins + * @date 2023-09-15 + */ +public interface HwAlarmTypeMapper +{ + /** + * 查询报警类型 + * + * @param alarmTypeId 报警类型主键 + * @return 报警类型 + */ + public HwAlarmType selectHwAlarmTypeByAlarmTypeId(Long alarmTypeId); + + /** + * 查询报警类型列表 + * + * @param hwAlarmType 报警类型 + * @return 报警类型集合 + */ + public List selectHwAlarmTypeList(HwAlarmType hwAlarmType); + + /** + * 新增报警类型 + * + * @param hwAlarmType 报警类型 + * @return 结果 + */ + public int insertHwAlarmType(HwAlarmType hwAlarmType); + + /** + * 修改报警类型 + * + * @param hwAlarmType 报警类型 + * @return 结果 + */ + public int updateHwAlarmType(HwAlarmType hwAlarmType); + + /** + * 删除报警类型 + * + * @param alarmTypeId 报警类型主键 + * @return 结果 + */ + public int deleteHwAlarmTypeByAlarmTypeId(Long alarmTypeId); + + /** + * 批量删除报警类型 + * + * @param alarmTypeIds 需要删除的数据主键集合 + * @return 结果 + */ + public int deleteHwAlarmTypeByAlarmTypeIds(Long[] alarmTypeIds); +} diff --git a/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/mapper/HwDeviceMapper.java b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/mapper/HwDeviceMapper.java index 40a40af..e9dbf24 100644 --- a/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/mapper/HwDeviceMapper.java +++ b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/mapper/HwDeviceMapper.java @@ -72,4 +72,12 @@ public interface HwDeviceMapper * @return 结果 */ public int deleteHwDeviceByDeviceIds(Long[] deviceIds); + + + public int getOnlineDeviceNum(Long sceneId); + + public HwDevice selectHwDeviceJoinByDeviceId(Long deviceId); + + public List selectLinkedDevices(Long deviceId); + } diff --git a/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/mapper/HwElectronicFenceMapper.java b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/mapper/HwElectronicFenceMapper.java index 393e87d..9c3d1b4 100644 --- a/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/mapper/HwElectronicFenceMapper.java +++ b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/mapper/HwElectronicFenceMapper.java @@ -75,4 +75,10 @@ public interface HwElectronicFenceMapper * @return 结果 */ public int deleteHwElectronicFenceByElectronicFenceIds(Long[] electronicFenceIds); + + public int selectDeviceCount(Long electronicFenceId); + + public int selectDeviceCountByMonitorUnit(Long electronicFenceId); + + public int selectDeviceCountByScene(Long sceneId); } diff --git a/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/mapper/HwMonitorUnitMapper.java b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/mapper/HwMonitorUnitMapper.java index 44186c2..5bb4228 100644 --- a/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/mapper/HwMonitorUnitMapper.java +++ b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/mapper/HwMonitorUnitMapper.java @@ -33,20 +33,20 @@ public interface HwMonitorUnitMapper public List selectsum(); //查询id与name的结果集 List selectSceneNameById(); - String selectSubSetNums(); + Integer selectSubSetNums(Long sceneId); /** * 分页获取最子集监控单元列表 * */ public List selectLimitSubMonitorUnit(); Integer selectReleatedDeviceIdNums(Long deviceCode); - String selectDeviceNums(); + Integer selectDeviceNums(Long sceneId); Integer selectSubDeviceSum(Long sceneId); /** * 监控单元报警统计 * */ - public List selectAlarmStats(); + public List selectAlarmStats(Long sceneId); /** * 获取最子级监控单元数量、设备数量和在线设备数量 * */ @@ -112,4 +112,13 @@ public interface HwMonitorUnitMapper * @return 结果 */ public int deleteHwMonitorUnitByMonitorUnitIds(Long[] monitorUnitIds); -} + + /** + * 查询监控单元列表join场景 + * + * @param hwMonitorUnit 监控单元 + * @return 监控单元集合 + */ + public List selectHwMonitorUnitListJoinScene(HwMonitorUnit hwMonitorUnit); + +} \ No newline at end of file diff --git a/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/service/IHwAlarmInfoService.java b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/service/IHwAlarmInfoService.java new file mode 100644 index 0000000..d5f150b --- /dev/null +++ b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/service/IHwAlarmInfoService.java @@ -0,0 +1,71 @@ +package com.ruoyi.business.service; + +import java.util.List; +import com.ruoyi.business.domain.HwAlarmInfo; +import com.ruoyi.business.domain.VO.AlarmTypeVo; + +/** + * 报警信息Service接口 + * + * @author xins + * @date 2023-09-15 + */ +public interface IHwAlarmInfoService +{ + /** + * 查询报警信息 + * + * @param alarmInfoId 报警信息主键 + * @return 报警信息 + */ + public HwAlarmInfo selectHwAlarmInfoByAlarmInfoId(Long alarmInfoId); + + /** + * 查询报警信息列表 + * + * @param hwAlarmInfo 报警信息 + * @return 报警信息集合 + */ + public List selectHwAlarmInfoList(HwAlarmInfo hwAlarmInfo); + + /** + * 新增报警信息 + * + * @param hwAlarmInfo 报警信息 + * @return 结果 + */ + public int insertHwAlarmInfo(HwAlarmInfo hwAlarmInfo); + + /** + * 修改报警信息 + * + * @param hwAlarmInfo 报警信息 + * @return 结果 + */ + public int updateHwAlarmInfo(HwAlarmInfo hwAlarmInfo); + + /** + * 批量删除报警信息 + * + * @param alarmInfoIds 需要删除的报警信息主键集合 + * @return 结果 + */ + public int deleteHwAlarmInfoByAlarmInfoIds(Long[] alarmInfoIds); + + /** + * 删除报警信息信息 + * + * @param alarmInfoId 报警信息主键 + * @return 结果 + */ + public int deleteHwAlarmInfoByAlarmInfoId(Long alarmInfoId); + + /** + * @param: sceneId + * @description 根据报警类型获取报警数量 + * @author xins + * @date 2023-09-15 13:20 + * @return List + */ + public List selectAlarmsByAlarmType(Long sceneId); +} diff --git a/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/service/IHwDeviceService.java b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/service/IHwDeviceService.java index 488869e..4c1d0d8 100644 --- a/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/service/IHwDeviceService.java +++ b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/service/IHwDeviceService.java @@ -5,6 +5,7 @@ import java.util.Map; import com.ruoyi.business.domain.HwDevice; import com.ruoyi.business.domain.VO.DeviceModeVo; +import com.ruoyi.business.domain.VO.HwDeviceVo; import com.ruoyi.business.domain.VO.HwMonitorUnitVo; @@ -24,14 +25,19 @@ public interface IHwDeviceService */ public HwDevice selectHwDeviceByDeviceId(Long deviceId); + /** + * 查询设备信息,返回监控单元名称 + * + * @param deviceId 设备信息主键 + * @return 设备信息 + */ + public HwDevice selectHwDeviceJoinByDeviceId(Long deviceId); + /** * 查询3. 设备各类型占所有设备数量百分比饼状图(左下角) * */ public List selectDeviceModeNameVo(); - public Map> selectDeviceByDeviceModeByMonitorUnitId(Long monitorUnitId); - public Map> selectDeviceModeFunctionByFunctionType(Long monitorUnitId); - public List> getHistoryData(Long deviceId); /** * 查询设备信息列表 * @@ -40,6 +46,14 @@ public interface IHwDeviceService */ public List selectHwDeviceList(HwDevice hwDevice); + /** + * 查询关联设备信息列表 + * + * @param deviceId 设备信息主键 + * @return 设备信息 + */ + public List selectLinkDeviceList(Long deviceId); + /** * 新增设备信息 * @@ -71,4 +85,14 @@ public interface IHwDeviceService * @return 结果 */ public int deleteHwDeviceByDeviceId(Long deviceId); + + + /** + * @return Map> + * @description 设备监测页面,根据监控单元获取设备监控信息 + * @author xins + * @date 2023-09-15 16:59 + */ + public Map> getDevicesByMonitor(HwDevice queryHwDevice); + } diff --git a/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/service/IHwElectronicFenceService.java b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/service/IHwElectronicFenceService.java index caf311a..99cb8ea 100644 --- a/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/service/IHwElectronicFenceService.java +++ b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/service/IHwElectronicFenceService.java @@ -3,6 +3,7 @@ package com.ruoyi.business.service; import java.util.List; import com.ruoyi.business.domain.HwElectronicFence; import com.ruoyi.business.domain.VO.EleMonitorDeviceSumVo; +import com.ruoyi.business.domain.VO.ElectronicFenceVo; import com.ruoyi.business.domain.VO.ElectronicNumVo; /** @@ -24,7 +25,7 @@ public interface IHwElectronicFenceService * 根据场景查询电子围栏信息 * */ public List selectElectronicByScene(Long sceneId); - List selectEleTypeNums(Long sceneId); + public List selectEleTypeNums(Long sceneId); /** * 查询电子围栏列表 * diff --git a/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/service/IHwMonitorPlatformService.java b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/service/IHwMonitorPlatformService.java new file mode 100644 index 0000000..8f6dd6d --- /dev/null +++ b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/service/IHwMonitorPlatformService.java @@ -0,0 +1,35 @@ +package com.ruoyi.business.service; + +import com.ruoyi.business.domain.VO.DeviceHistoryDataVo; +import com.ruoyi.business.domain.VO.DeviceLatestDataVo; + +import java.util.List; +import java.util.Map; + +/** + * @Description: 监控平台数据处理接口 + * @ClassName: IHwMonitorPlatformService + * @Author : xins + * @Date :2023-09-16 14:49 + * @Version :1.0 + */ +public interface IHwMonitorPlatformService { + + /** + * @param: deviceLatestDataVo + * @description 根据设备模型获取最新数据 + * @author xins + * @date 2023-09-16 14:49 + * @return List> + */ + public List> selectLatestDataByTags(DeviceLatestDataVo deviceLatestDataVo); + + /** + * @param: deviceHistoryDataVo + * @description 获取设备历史数据 + * @author xins + * @date 2023-09-16 15:14 + * @return List> + */ + public List> getHistoryData(DeviceHistoryDataVo deviceHistoryDataVo); +} diff --git a/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/service/IHwMonitorUnitService.java b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/service/IHwMonitorUnitService.java index 5c6fdd4..f22467a 100644 --- a/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/service/IHwMonitorUnitService.java +++ b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/service/IHwMonitorUnitService.java @@ -2,6 +2,7 @@ package com.ruoyi.business.service; import java.util.List; import java.util.Map; +import java.util.stream.Collectors; import com.ruoyi.business.domain.HwMonitorUnit; import com.ruoyi.business.domain.VO.*; @@ -30,8 +31,8 @@ public interface IHwMonitorUnitService /** *  展示总的设备数量和总的监控单元数量(最低级的监控单元) * */ - public AllNumsVo selectAllNums(); - public List selectSenceAllNums(); + public AllNumsVo selectAllNums(Long sceneId); +// public List selectSenceAllNums(); /** * 分页获取最子集监控单元列表 @@ -48,7 +49,7 @@ public interface IHwMonitorUnitService /** * 监控单元报警统计 * */ - public List selectAlarmStats(); + public List selectAlarmStats(Long sceneId); /** * 查询监控单元列表 * @@ -61,10 +62,7 @@ public interface IHwMonitorUnitService * 获取最子级监控单元数量、设备数量和在线设备数量 * */ public SubDeviceSumVo selectSubDeviceSum(Long sceneId); - /** - * 按电子围栏定位显示其下设备数量,以及报警的设备数量。 - * */ - public Integer selectElectronicNum(Long sceneId); + /** * 树状获取监控单元列表 * */ @@ -73,19 +71,9 @@ public interface IHwMonitorUnitService * 获取监控单元详细信息 * */ public HwMonitorUnit selectHwmonitorUnitSub(Long monitorUnitId); - /** - * 通过tdengine获取设备运行情况 - * - * @return*/ - public Map selectTdengine(String beginTime, String endTime, Long sceneId); - /** - * 设备汇总 - * - * @return*/ - public R>> selectLatestDataByTags(Long monitorUnitId); - /** + /** * 新增监控单元 * * @param hwMonitorUnit 监控单元 @@ -116,4 +104,29 @@ public interface IHwMonitorUnitService * @return 结果 */ public int deleteHwMonitorUnitByMonitorUnitId(Long monitorUnitId); -} + + + /** + * 查询监控单元树结构信息 + * + * @param hwMonitorUnit 监控单元信息 + * @return 监控单元树信息集合 + */ + public List selectMonitorTreeList(HwMonitorUnit hwMonitorUnit); + + /** + * 构建前端所需要下拉树结构 + * + * @param hwMonitorUnits 监控单元列表 + * @return 下拉树结构列表 + */ + public List buildMonitorUnitTreeSelect(List hwMonitorUnits); + + /** + * 构建前端所需要树结构 + * + * @param hwMonitorUnits 监控单元列表 + * @return 树结构列表 + */ + public List buildMonitorUnitTree(List hwMonitorUnits); +} \ No newline at end of file diff --git a/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/service/impl/HwAlarmInfoServiceImpl.java b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/service/impl/HwAlarmInfoServiceImpl.java new file mode 100644 index 0000000..97e611a --- /dev/null +++ b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/service/impl/HwAlarmInfoServiceImpl.java @@ -0,0 +1,136 @@ +package com.ruoyi.business.service.impl; + +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.stream.Collectors; + +import com.ruoyi.business.domain.HwAlarmType; +import com.ruoyi.business.domain.VO.AlarmTypeVo; +import com.ruoyi.business.mapper.HwAlarmTypeMapper; +import com.ruoyi.common.core.utils.DateUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import com.ruoyi.business.mapper.HwAlarmInfoMapper; +import com.ruoyi.business.domain.HwAlarmInfo; +import com.ruoyi.business.service.IHwAlarmInfoService; + +/** + * 报警信息Service业务层处理 + * + * @author xins + * @date 2023-09-15 + */ +@Service +public class HwAlarmInfoServiceImpl implements IHwAlarmInfoService { + @Autowired + private HwAlarmInfoMapper hwAlarmInfoMapper; + + @Autowired + private HwAlarmTypeMapper hwAlarmTypeMapper; + + /** + * 查询报警信息 + * + * @param alarmInfoId 报警信息主键 + * @return 报警信息 + */ + @Override + public HwAlarmInfo selectHwAlarmInfoByAlarmInfoId(Long alarmInfoId) { + return hwAlarmInfoMapper.selectHwAlarmInfoByAlarmInfoId(alarmInfoId); + } + + /** + * 查询报警信息列表 + * + * @param hwAlarmInfo 报警信息 + * @return 报警信息 + */ + @Override + public List selectHwAlarmInfoList(HwAlarmInfo hwAlarmInfo) { + return hwAlarmInfoMapper.selectHwAlarmInfoList(hwAlarmInfo); + } + + /** + * 新增报警信息 + * + * @param hwAlarmInfo 报警信息 + * @return 结果 + */ + @Override + public int insertHwAlarmInfo(HwAlarmInfo hwAlarmInfo) { + hwAlarmInfo.setCreateTime(DateUtils.getNowDate()); + return hwAlarmInfoMapper.insertHwAlarmInfo(hwAlarmInfo); + } + + /** + * 修改报警信息 + * + * @param hwAlarmInfo 报警信息 + * @return 结果 + */ + @Override + public int updateHwAlarmInfo(HwAlarmInfo hwAlarmInfo) { + hwAlarmInfo.setUpdateTime(DateUtils.getNowDate()); + return hwAlarmInfoMapper.updateHwAlarmInfo(hwAlarmInfo); + } + + /** + * 批量删除报警信息 + * + * @param alarmInfoIds 需要删除的报警信息主键 + * @return 结果 + */ + @Override + public int deleteHwAlarmInfoByAlarmInfoIds(Long[] alarmInfoIds) { + return hwAlarmInfoMapper.deleteHwAlarmInfoByAlarmInfoIds(alarmInfoIds); + } + + /** + * 删除报警信息信息 + * + * @param alarmInfoId 报警信息主键 + * @return 结果 + */ + @Override + public int deleteHwAlarmInfoByAlarmInfoId(Long alarmInfoId) { + return hwAlarmInfoMapper.deleteHwAlarmInfoByAlarmInfoId(alarmInfoId); + } + + + /** + * @return List + * @param: sceneId + * @description 根据报警类型获取报警数量 + * @author xins + * @date 2023-09-15 13:20 + */ + @Override + public List selectAlarmsByAlarmType(Long sceneId) { + List list = hwAlarmInfoMapper.selectAlarmsByAlarmType(sceneId); + HwAlarmType queryAlarmType = new HwAlarmType(); + queryAlarmType.setSceneId(sceneId); + List alarmTypes = hwAlarmTypeMapper.selectHwAlarmTypeList(queryAlarmType); + Map alarmTypeMap = alarmTypes.stream() + .collect(Collectors.toMap(HwAlarmType::getAlarmTypeId, alarmType -> alarmType)); + list.stream().forEach(alarmType -> { + alarmType.setAlarmTypeName(alarmTypeMap.get(alarmType.getAlarmTypeId()) == null ? "" + : alarmTypeMap.get(alarmType.getAlarmTypeId()).getAlarmTypeName()); + alarmTypeMap.remove(alarmType.getAlarmTypeId()); + }); + + + Set alarmTypeIds = alarmTypeMap.keySet(); + for (Long alarmTypeId : alarmTypeIds) { + HwAlarmType alarmType = alarmTypeMap.get(alarmTypeId); + AlarmTypeVo alarmTypeVo = new AlarmTypeVo(); + alarmTypeVo.setAlarmTypeId(alarmType.getAlarmTypeId()); + alarmTypeVo.setAlarmTypeName(alarmType.getAlarmTypeName()); + alarmTypeVo.setAlarmCount(0); + list.add(alarmTypeVo); + } + + return list; + + } +} diff --git a/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/service/impl/HwDeviceModeServiceImpl.java b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/service/impl/HwDeviceModeServiceImpl.java index c77642c..ebd0089 100644 --- a/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/service/impl/HwDeviceModeServiceImpl.java +++ b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/service/impl/HwDeviceModeServiceImpl.java @@ -8,6 +8,7 @@ import com.ruoyi.business.mapper.HwDeviceMapper; import com.ruoyi.business.mapper.HwDeviceModeFunctionMapper; import com.ruoyi.business.mapper.HwDeviceModeMapper; import com.ruoyi.business.service.IHwDeviceModeService; +import com.ruoyi.common.core.constant.Constants; import com.ruoyi.common.core.constant.HwDictConstants; import com.ruoyi.common.core.constant.TdEngineConstants; import com.ruoyi.common.core.domain.R; @@ -146,6 +147,14 @@ public class HwDeviceModeServiceImpl implements IHwDeviceModeService { @Transactional @Override public int deleteHwDeviceModeByDeviceModeIds(Long[] deviceModeIds) { + for (Long deviceModeId : deviceModeIds) { + HwDevice queryDevice = new HwDevice(); + queryDevice.setDeviceModeId(deviceModeId); + List deviceList = hwDeviceMapper.selectHwDeviceList(queryDevice); + if (deviceList != null && !deviceList.isEmpty()) { + throw new ServiceException("该设备模型下存在设备,不能删除"); + } + } hwDeviceModeMapper.deleteHwDeviceModeFunctionByDeviceModeIds(deviceModeIds); return hwDeviceModeMapper.deleteHwDeviceModeByDeviceModeIds(deviceModeIds); } @@ -408,7 +417,11 @@ public class HwDeviceModeServiceImpl implements IHwDeviceModeService { tdSuperTableVo.setFirstFieldName(TdEngineConstants.DEFAULT_FIRST_FIELD_NAME); tdSuperTableVo.setSchemaFields(schemaFields); tdSuperTableVo.setTagsFields(tagFields); - this.remoteTdEngineService.createSuperTable(tdSuperTableVo); + + R tdReturnMsg = this.remoteTdEngineService.createSuperTable(tdSuperTableVo); + if(tdReturnMsg.getCode() != Constants.SUCCESS){//抛出异常,回滚事务 + throw new RuntimeException(tdReturnMsg.getMsg()); + } } private void addTdSuperTableColumn(HwDeviceModeFunction hwDeviceModeFunction) { @@ -430,7 +443,10 @@ public class HwDeviceModeServiceImpl implements IHwDeviceModeService { tdSuperTableVo.setDatabaseName(dbName); tdSuperTableVo.setSuperTableName(superTableName); tdSuperTableVo.setField(schemaField); - this.remoteTdEngineService.addSuperTableColumn(tdSuperTableVo); + R tdReturnMsg = this.remoteTdEngineService.addSuperTableColumn(tdSuperTableVo); + if(tdReturnMsg.getCode() != Constants.SUCCESS){//抛出异常,回滚事务 + throw new RuntimeException(tdReturnMsg.getMsg()); + } } } @@ -448,7 +464,10 @@ public class HwDeviceModeServiceImpl implements IHwDeviceModeService { tdSuperTableVo.setSuperTableName(superTableName); tdSuperTableVo.setField(schemaField); - this.remoteTdEngineService.dropColumnForSuperTable(tdSuperTableVo); + R tdReturnMsg =this.remoteTdEngineService.dropColumnForSuperTable(tdSuperTableVo); + if(tdReturnMsg.getCode() != Constants.SUCCESS){//抛出异常,回滚事务 + throw new RuntimeException(tdReturnMsg.getMsg()); + } } } diff --git a/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/service/impl/HwDeviceServiceImpl.java b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/service/impl/HwDeviceServiceImpl.java index deed73f..baf9f35 100644 --- a/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/service/impl/HwDeviceServiceImpl.java +++ b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/service/impl/HwDeviceServiceImpl.java @@ -4,11 +4,18 @@ import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; +import java.util.concurrent.atomic.AtomicReference; +import java.util.stream.Collectors; +import com.ruoyi.business.domain.HwDeviceModeFunction; import com.ruoyi.business.domain.VO.DeviceModeVo; +import com.ruoyi.business.domain.VO.HwDeviceVo; +import com.ruoyi.business.mapper.HwDeviceModeFunctionMapper; +import com.ruoyi.common.core.constant.HwDictConstants; import com.ruoyi.common.core.constant.TdEngineConstants; -import com.ruoyi.common.core.domain.R; +import com.ruoyi.common.core.enums.DataTypeEnums; import com.ruoyi.common.core.utils.DateUtils; +import com.ruoyi.common.core.utils.NumberUtils; import com.ruoyi.tdengine.api.RemoteTdEngineService; import com.ruoyi.tdengine.api.domain.TdHistorySelectDto; import com.ruoyi.tdengine.api.domain.TdSelectDto; @@ -25,11 +32,12 @@ import com.ruoyi.business.service.IHwDeviceService; * @date 2023-08-24 */ @Service -public class HwDeviceServiceImpl implements IHwDeviceService -{ +public class HwDeviceServiceImpl implements IHwDeviceService { @Autowired private HwDeviceMapper hwDeviceMapper; @Autowired + private HwDeviceModeFunctionMapper hwDevieModeFunctionMapper; + @Autowired private RemoteTdEngineService remoteTdEgineService; /** @@ -39,11 +47,21 @@ public class HwDeviceServiceImpl implements IHwDeviceService * @return 设备信息 */ @Override - public HwDevice selectHwDeviceByDeviceId(Long deviceId) - { + public HwDevice selectHwDeviceByDeviceId(Long deviceId) { return hwDeviceMapper.selectHwDeviceByDeviceId(deviceId); } + /** + * 查询设备信息,返回监控单元名称 + * + * @param deviceId 设备信息主键 + * @return 设备信息 + */ + + @Override + public HwDevice selectHwDeviceJoinByDeviceId(Long deviceId) { + return hwDeviceMapper.selectHwDeviceJoinByDeviceId(deviceId); + } /** * 查询设备信息列表 * @@ -51,11 +69,21 @@ public class HwDeviceServiceImpl implements IHwDeviceService * @return 设备信息 */ @Override - public List selectHwDeviceList(HwDevice hwDevice) - { + public List selectHwDeviceList(HwDevice hwDevice) { return hwDeviceMapper.selectHwDeviceList(hwDevice); } + /** + * 查询关联设备信息列表 + * + * @param deviceId 设备信息主键 + * @return 设备信息 + */ + @Override + public List selectLinkDeviceList(Long deviceId) { + return hwDeviceMapper.selectLinkedDevices(deviceId); + } + /** * 新增设备信息 * @@ -63,94 +91,52 @@ public class HwDeviceServiceImpl implements IHwDeviceService * @return 结果 */ @Override - public int insertHwDevice(HwDevice hwDevice) - { + public int insertHwDevice(HwDevice hwDevice) { hwDevice.setCreateTime(DateUtils.getNowDate()); return hwDeviceMapper.insertHwDevice(hwDevice); } + /** * 查询3. 设备各类型占所有设备数量百分比饼状图(左下角) - * */ + */ @Override public List selectDeviceModeNameVo() { List list = hwDeviceMapper.selectDeviceModeNameVo(); Integer value = 0; if (list.size() > 10) { for (int i = 9; i < list.size(); i++) { - if (list.get(i).sum==null){ + if (list.get(i).sum == null) { list.get(i).sum = 0; } value = value + list.get(i).sum; } } - DeviceModeVo hwMonitorUnitTypeVo = new DeviceModeVo(); - hwMonitorUnitTypeVo.setDeviceModeName("其他"); - hwMonitorUnitTypeVo.setSum(value); +// DeviceModeVo hwMonitorUnitTypeVo = new DeviceModeVo(); +// hwMonitorUnitTypeVo.setDeviceModeName("其他"); +// hwMonitorUnitTypeVo.setSum(value); Integer sums = 0; - for (int i = 0; i < list.size();i++){ - if (list.get(i).sum==null){ + for (int i = 0; i < list.size(); i++) { + if (list.get(i).sum == null) { list.get(i).sum = 0; } - sums = sums+list.get(i).sum; - } - for (int i=0;i 10) { - list.add(10, hwMonitorUnitTypeVo); - return list.subList(0, 10); - } else { - return list; + for (int i = 0; i < list.size(); i++) { + list.get(i).setPercentage(NumberUtils.getPercentage(list.get(i).getSum(), sums)); + System.out.println(list.get(i).toString()); } - } - //获取有开关属性的设备 - @Override - public Map> selectDeviceByDeviceModeByMonitorUnitId(Long monitorUnitId){ - List hwDevices = hwDeviceMapper.selectDeviceByDeviceModeByMonitorUnitId(monitorUnitId);//todo 根据监控单元(已解决) - TdSelectDto tdSelectDto = new TdSelectDto(); - Map> latestDataByTags = new HashMap>(); - for (int i = 0; i < hwDevices.size(); i++){ - String s = hwDeviceMapper.selectDeviceByDeviceModeByDeviceModeFunction(hwDevices.get(i).getDeviceId()); - if (s!=null&&s!=""){ - tdSelectDto.setDatabaseName(TdEngineConstants.PLATFORM_DB_NAME); - tdSelectDto.setSuperTableName(TdEngineConstants.DEFAULT_DEVICE_STATUS_SUPER_TABLE_NAME); - tdSelectDto.setTagsName(hwDevices.get(i).getDeviceCode()); - latestDataByTags = (Map>) remoteTdEgineService.getLatestDataByTags(tdSelectDto); - } - //todo 根据获取的device,通过devicemodeid获取devicemode,再根据devicemodeid获取devicemodefunction,(已解决) - // todo 然后根据devicemodefunction中的datatype为8的(是bool的)(以解决) - } - return latestDataByTags; - } - //查询直采变量属性的设备 - @Override - public Map> selectDeviceModeFunctionByFunctionType(Long monitorUnitId) { - List hwDevices = hwDeviceMapper.selectDeviceByDeviceModeByMonitorUnitId(monitorUnitId);//todo 根据监控单元(已解决) - TdSelectDto tdSelectDto = new TdSelectDto(); - Map> latestDataByTags = new HashMap>(); - for (int i = 0; i < hwDevices.size(); i++){ - String s = hwDeviceMapper.selectDeviceModeFunctionByFunctionType(hwDevices.get(i).getDeviceId()); - if (s!=null&&s!=""){ - tdSelectDto.setDatabaseName(TdEngineConstants.PLATFORM_DB_NAME); - tdSelectDto.setSuperTableName(TdEngineConstants.DEFAULT_DEVICE_STATUS_SUPER_TABLE_NAME); - tdSelectDto.setTagsName(hwDevices.get(i).getDeviceCode()); - latestDataByTags = (Map>) remoteTdEgineService.getLatestDataByTags(tdSelectDto); - }} - return latestDataByTags; - } - @Override - public List> getHistoryData(Long deviceId) { - TdHistorySelectDto tdHistorySelectDto = new TdHistorySelectDto(); - tdHistorySelectDto.setDatabaseName(TdEngineConstants.PLATFORM_DB_NAME); - tdHistorySelectDto.setTableName(TdEngineConstants.getDeviceDataTableName(deviceId)); - tdHistorySelectDto.setOrderByFieldName(tdHistorySelectDto.getFirstFieldName()); - tdHistorySelectDto.setSort(TdEngineConstants.DEFAULT_ORDER_BY_MODE); - List> historyData = (List>) remoteTdEgineService.getHistoryData(tdHistorySelectDto); - return historyData; + return list; +// if (list.size() > 10) { +// list.add(10, hwMonitorUnitTypeVo); +// return list.subList(0, 10); +// } else { +// return list; +// } } + /** * 修改设备信息 * @@ -158,8 +144,7 @@ public class HwDeviceServiceImpl implements IHwDeviceService * @return 结果 */ @Override - public int updateHwDevice(HwDevice hwDevice) - { + public int updateHwDevice(HwDevice hwDevice) { hwDevice.setUpdateTime(DateUtils.getNowDate()); return hwDeviceMapper.updateHwDevice(hwDevice); } @@ -171,8 +156,7 @@ public class HwDeviceServiceImpl implements IHwDeviceService * @return 结果 */ @Override - public int deleteHwDeviceByDeviceIds(Long[] deviceIds) - { + public int deleteHwDeviceByDeviceIds(Long[] deviceIds) { return hwDeviceMapper.deleteHwDeviceByDeviceIds(deviceIds); } @@ -183,8 +167,70 @@ public class HwDeviceServiceImpl implements IHwDeviceService * @return 结果 */ @Override - public int deleteHwDeviceByDeviceId(Long deviceId) - { + public int deleteHwDeviceByDeviceId(Long deviceId) { return hwDeviceMapper.deleteHwDeviceByDeviceId(deviceId); } + + + /** + * @return Map> + * @description 设备监测页面,根据监控单元获取设备监控信息 + * @author xins + * @date 2023-09-15 16:59 + */ + @Override + public Map> getDevicesByMonitor(HwDevice queryHwDevice) { + Map> devicesMap = new HashMap>(); + List controlDeviceVos = new ArrayList(); + List acquisitionDeviceVos = new ArrayList(); + Long sceneId = queryHwDevice.getSceneId(); + String databaseName = TdEngineConstants.getDatabaseName(sceneId); + + List hwDevices = hwDeviceMapper.selectHwDeviceList(queryHwDevice); + hwDevices.forEach(hwDevice -> { + + Long deviceId = hwDevice.getDeviceId(); + String tableName = TdEngineConstants.getDeviceDataTableName(deviceId); + TdSelectDto tdSelectDto = new TdSelectDto(); + tdSelectDto.setDatabaseName(databaseName); + tdSelectDto.setTableName(tableName); + List> deviceLatestDataMapList = (List>) this.remoteTdEgineService.getLatestData(tdSelectDto).getData(); + + HwDeviceModeFunction queryDeviceModeFunction = new HwDeviceModeFunction(); + queryDeviceModeFunction.setDeviceModeId(hwDevice.getDeviceModeId()); + List deviceModeFunctions = hwDevieModeFunctionMapper.selectHwDeviceModeFunctionList(queryDeviceModeFunction); + List dds = deviceModeFunctions.stream() + .filter(dmf -> dmf.getFunctionMode().equals(HwDictConstants.FUNCTION_MODE_ATTRIBUTE) + && dmf.getDataType() != null && String.valueOf(dmf.getDataType()).equals(String.valueOf(DataTypeEnums.TINYINT.getDataCode()))).collect(Collectors.toList()); + + HwDeviceVo hwDeviceVo = new HwDeviceVo(); + hwDeviceVo.setDeviceName(hwDevice.getDeviceName()); + if (dds != null && dds.size() > 0) { + hwDeviceVo.setDeviceType(HwDictConstants.CONTROL_DEVICE); + HwDeviceModeFunction dd = dds.get(0); + List> ddValueMapList = new ArrayList>(); + Map ddValueMap = new HashMap(); + + deviceLatestDataMapList.forEach(deviceLatestDataMap -> { + ddValueMap.put(dd.getFunctionIdentifier(), deviceLatestDataMap.get(dd.getFunctionIdentifier()) == null + ? 0 : deviceLatestDataMap.get(dd.getFunctionIdentifier())); + }); + ddValueMapList.add(ddValueMap); + + hwDeviceVo.setDeviceDataMaps(ddValueMapList); + controlDeviceVos.add(hwDeviceVo); + } else { + hwDeviceVo.setDeviceType(HwDictConstants.ACQUISITION_DEVICE); + hwDeviceVo.setDeviceDataMaps(deviceLatestDataMapList); + acquisitionDeviceVos.add(hwDeviceVo); + } + + }); + + devicesMap.put(HwDictConstants.CONTROL_DEVICE_NAME, controlDeviceVos); + devicesMap.put(HwDictConstants.ACQUISITION_DEVICE_NAME, acquisitionDeviceVos); + + return devicesMap; + } + } diff --git a/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/service/impl/HwElectronicFenceServiceImpl.java b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/service/impl/HwElectronicFenceServiceImpl.java index c8133e1..0af93d0 100644 --- a/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/service/impl/HwElectronicFenceServiceImpl.java +++ b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/service/impl/HwElectronicFenceServiceImpl.java @@ -3,7 +3,13 @@ package com.ruoyi.business.service.impl; import java.util.ArrayList; import java.util.List; +import com.alibaba.fastjson.JSONArray; +import com.alibaba.fastjson.JSONObject; +import com.ruoyi.business.domain.HwFenceTarget; import com.ruoyi.business.domain.VO.EleMonitorDeviceSumVo; +import com.ruoyi.business.domain.VO.ElectronicFenceVo; +import com.ruoyi.business.mapper.HwFenceTargetMapper; +import com.ruoyi.common.core.constant.HwDictConstants; import com.ruoyi.common.core.utils.DateUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -18,11 +24,13 @@ import com.ruoyi.business.service.IHwElectronicFenceService; * @date 2023-09-04 */ @Service -public class HwElectronicFenceServiceImpl implements IHwElectronicFenceService -{ +public class HwElectronicFenceServiceImpl implements IHwElectronicFenceService { @Autowired private HwElectronicFenceMapper hwElectronicFenceMapper; + @Autowired + private HwFenceTargetMapper hwFenceTargetMapper; + /** * 查询电子围栏 * @@ -30,8 +38,7 @@ public class HwElectronicFenceServiceImpl implements IHwElectronicFenceService * @return 电子围栏 */ @Override - public HwElectronicFence selectHwElectronicFenceByElectronicFenceId(Long electronicFenceId) - { + public HwElectronicFence selectHwElectronicFenceByElectronicFenceId(Long electronicFenceId) { return hwElectronicFenceMapper.selectHwElectronicFenceByElectronicFenceId(electronicFenceId); } @@ -41,114 +48,58 @@ public class HwElectronicFenceServiceImpl implements IHwElectronicFenceService } @Override - public List selectEleTypeNums(Long sceneId) { - List list = hwElectronicFenceMapper.selectEleTypeBySceneId(sceneId); - list.stream().forEach(v->{}); - List voList = new ArrayList(); - if (list.size()==1){ - if (list.get(0)==1){ - //电子围栏下只有设备 - voList = hwElectronicFenceMapper.selectSumsFromMonitorByElectronicFence(sceneId); - - return voList; - } - else if (list.get(0)==2){ - //电子围栏下只有监控单元 - voList = hwElectronicFenceMapper.selectEleOnlyMonitorBySceneId(sceneId); - return voList; - } - else if (list.get(0)==3){ - //电子围栏下只有场景 - Integer integer = hwElectronicFenceMapper.selectEleOnlyScene(sceneId); - EleMonitorDeviceSumVo eleMonitorDeviceSumVo = new EleMonitorDeviceSumVo(); - eleMonitorDeviceSumVo.setSceneId(sceneId); - eleMonitorDeviceSumVo.setSum(integer); - voList.add(eleMonitorDeviceSumVo); - return voList; - } - } - else if (list.size()==2){ - if (list.get(0)+list.get(1)==3){ - //设备与监控单元 - List devices = new ArrayList<>(); - List monitor = new ArrayList<>(); - //查询场景下的所有设备根据电子围栏分组,在查询场景下的所有监控单元以及下面的设备按电子围栏分组 - //shebei - devices = hwElectronicFenceMapper.selectSumsFromMonitorByElectronicFence(sceneId); - //jiankongdanyuan - monitor = hwElectronicFenceMapper.selectEleOnlyMonitorBySceneId(sceneId); - for (int i=0; i devices = new ArrayList<>(); - - devices = hwElectronicFenceMapper.selectSumsFromMonitorByElectronicFence(sceneId); - Integer aLong = hwElectronicFenceMapper.selectEleOnlyScene(sceneId); - for (int i = 0; i < devices.size();i++){ - aLong = aLong-devices.get(i).getSum(); - } - EleMonitorDeviceSumVo eleMonitorDeviceSumVo = new EleMonitorDeviceSumVo(); - eleMonitorDeviceSumVo.setSceneId(sceneId); - eleMonitorDeviceSumVo.setSum(aLong); - voList.add(eleMonitorDeviceSumVo); - voList.addAll(devices); - return voList; - } - else if (list.get(0)+list.get(1)==5){ - //场景与监控单元 - List monitor = new ArrayList<>(); - monitor=hwElectronicFenceMapper.selectEleOnlyMonitorBySceneId(sceneId); - Integer aLong = hwElectronicFenceMapper.selectEleOnlyScene(sceneId); - for (int i = 0;i selectEleTypeNums(Long sceneId) { + List electronicFenceVos = new ArrayList(); + HwElectronicFence queryElectronicFence = new HwElectronicFence(); + queryElectronicFence.setSceneId(sceneId); + List electronicFenceList = hwElectronicFenceMapper.selectHwElectronicFenceList(queryElectronicFence); + electronicFenceList.forEach(electronicFence -> { + ElectronicFenceVo e = new ElectronicFenceVo(); + String fenceType = electronicFence.getFenceType(); + String areaShapeFlag = electronicFence.getAreaShapeFlag(); + String areaRange = electronicFence.getAreaRange(); + Integer deviceCount = 0; + if (fenceType.equals(HwDictConstants.FENCE_TYPE_DEVICE) + || fenceType.equals(HwDictConstants.FENCE_TYPE_MONITOR_UNIT)) { + deviceCount = hwElectronicFenceMapper.selectDeviceCount(electronicFence.getElectronicFenceId()); + } + + if (fenceType.equals(HwDictConstants.FENCE_TYPE_MONITOR_UNIT)) { + deviceCount = hwElectronicFenceMapper.selectDeviceCountByMonitorUnit(electronicFence.getElectronicFenceId()); + + } else if (fenceType.equals(HwDictConstants.FENCE_TYPE_SCENE)) { + deviceCount = hwElectronicFenceMapper.selectDeviceCountByScene(electronicFence.getSceneId()); + } + + if (areaShapeFlag.equals(HwDictConstants.AREA_SHAPE_FLAG_POLYGN)) { + String[] areaRangeArr = areaRange.split("_"); + List points = new ArrayList(); + for (String areaR : areaRangeArr) { + String[] areaRArr = areaR.split(","); + ElectronicFenceVo.AreaPoint p = new ElectronicFenceVo.AreaPoint(); + p.setLongitude(Double.valueOf(areaRArr[0])); + p.setLatitude(Double.valueOf(areaRArr[1])); + points.add(p); } - EleMonitorDeviceSumVo eleMonitorDeviceSumVo = new EleMonitorDeviceSumVo(); - eleMonitorDeviceSumVo.setSceneId(sceneId); - eleMonitorDeviceSumVo.setSum(aLong); - voList.add(eleMonitorDeviceSumVo); - voList.addAll(monitor); - return voList; - } - - }else if (list.size()==3){ - List devices = new ArrayList<>(); - List monitor = new ArrayList<>(); - //shebei - devices = hwElectronicFenceMapper.selectSumsFromMonitorByElectronicFence(sceneId); - //jiankongdanyuan - monitor = hwElectronicFenceMapper.selectEleOnlyMonitorBySceneId(sceneId); - Integer aLong = hwElectronicFenceMapper.selectEleOnlyScene(sceneId); - for (int i=0; i selectHwElectronicFenceList(HwElectronicFence hwElectronicFence) - { + public List selectHwElectronicFenceList(HwElectronicFence hwElectronicFence) { return hwElectronicFenceMapper.selectHwElectronicFenceList(hwElectronicFence); } @@ -170,8 +120,7 @@ public class HwElectronicFenceServiceImpl implements IHwElectronicFenceService * @return 结果 */ @Override - public int insertHwElectronicFence(HwElectronicFence hwElectronicFence) - { + public int insertHwElectronicFence(HwElectronicFence hwElectronicFence) { hwElectronicFence.setCreateTime(DateUtils.getNowDate()); return hwElectronicFenceMapper.insertHwElectronicFence(hwElectronicFence); } @@ -183,8 +132,7 @@ public class HwElectronicFenceServiceImpl implements IHwElectronicFenceService * @return 结果 */ @Override - public int updateHwElectronicFence(HwElectronicFence hwElectronicFence) - { + public int updateHwElectronicFence(HwElectronicFence hwElectronicFence) { hwElectronicFence.setUpdateTime(DateUtils.getNowDate()); return hwElectronicFenceMapper.updateHwElectronicFence(hwElectronicFence); } @@ -196,8 +144,7 @@ public class HwElectronicFenceServiceImpl implements IHwElectronicFenceService * @return 结果 */ @Override - public int deleteHwElectronicFenceByElectronicFenceIds(Long[] electronicFenceIds) - { + public int deleteHwElectronicFenceByElectronicFenceIds(Long[] electronicFenceIds) { return hwElectronicFenceMapper.deleteHwElectronicFenceByElectronicFenceIds(electronicFenceIds); } @@ -208,8 +155,7 @@ public class HwElectronicFenceServiceImpl implements IHwElectronicFenceService * @return 结果 */ @Override - public int deleteHwElectronicFenceByElectronicFenceId(Long electronicFenceId) - { + public int deleteHwElectronicFenceByElectronicFenceId(Long electronicFenceId) { return hwElectronicFenceMapper.deleteHwElectronicFenceByElectronicFenceId(electronicFenceId); } } diff --git a/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/service/impl/HwMonitorPlatformServiceImpl.java b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/service/impl/HwMonitorPlatformServiceImpl.java new file mode 100644 index 0000000..135aaff --- /dev/null +++ b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/service/impl/HwMonitorPlatformServiceImpl.java @@ -0,0 +1,86 @@ +package com.ruoyi.business.service.impl; + +import com.ruoyi.business.domain.VO.DeviceDataColumnVo; +import com.ruoyi.business.domain.VO.DeviceHistoryDataVo; +import com.ruoyi.business.domain.VO.DeviceLatestDataVo; +import com.ruoyi.business.service.IHwMonitorPlatformService; +import com.ruoyi.common.core.constant.HwDictConstants; +import com.ruoyi.common.core.constant.TdEngineConstants; +import com.ruoyi.tdengine.api.RemoteTdEngineService; +import com.ruoyi.tdengine.api.domain.TdHistorySelectDto; +import com.ruoyi.tdengine.api.domain.TdSuperTableSelectVo; +import org.springframework.stereotype.Service; + +import javax.annotation.Resource; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +/** + * @Description: 监控平台数据处理接口 + * @ClassName: HwMonitorPlatformServiceImpl + * @Author : xins + * @Date :2023-09-16 14:50 + * @Version :1.0 + */ +@Service +public class HwMonitorPlatformServiceImpl implements IHwMonitorPlatformService { + @Resource + private RemoteTdEngineService remoteTdEngineService; + + /** + * @return List> + * @param: deviceLatestDataVo + * @description 根据设备模型获取最新数据 + * @author xins + * @date 2023-09-16 14:49 + */ + @Override + public List> selectLatestDataByTags(DeviceLatestDataVo deviceLatestDataVo) { + TdSuperTableSelectVo tdSuperTableSelectVo = new TdSuperTableSelectVo(); + String databaseName = TdEngineConstants.getDatabaseName(deviceLatestDataVo.getSceneId()); + String superTableName = TdEngineConstants.getSupertTableName(deviceLatestDataVo.getDeviceModeId()); + tdSuperTableSelectVo.setDatabaseName(databaseName); + tdSuperTableSelectVo.setSuperTableName(superTableName); + tdSuperTableSelectVo.setGroupByTagsName(TdEngineConstants.ST_TAG_DEVICEID); + if (deviceLatestDataVo.getStartTime() != 0 || deviceLatestDataVo.getEndTime() != 0) { + tdSuperTableSelectVo.setFirstFieldName(TdEngineConstants.DEFAULT_FIRST_FIELD_NAME); + } + tdSuperTableSelectVo.setDeviceCode(deviceLatestDataVo.getDeviceCode()); + tdSuperTableSelectVo.setDeviceName(deviceLatestDataVo.getDeviceName()); + tdSuperTableSelectVo.setStartTime(deviceLatestDataVo.getStartTime()); + tdSuperTableSelectVo.setEndTime(deviceLatestDataVo.getEndTime()); + tdSuperTableSelectVo.setOffset(deviceLatestDataVo.getOffset()); + tdSuperTableSelectVo.setLimit(deviceLatestDataVo.getLimit()); + return this.remoteTdEngineService.getLatestDataByTags(tdSuperTableSelectVo).getData(); + + } + + + /** + * @param: deviceHistoryDataVo + * @description 获取设备历史数据 + * @author xins + * @date 2023-09-16 15:14 + * @return List> + */ + @Override + public List> getHistoryData(DeviceHistoryDataVo deviceHistoryDataVo) { + TdHistorySelectDto tdHistorySelectDto = new TdHistorySelectDto(); + tdHistorySelectDto.setDatabaseName(TdEngineConstants.getDatabaseName(deviceHistoryDataVo.getSceneId())); + tdHistorySelectDto.setTableName(TdEngineConstants.getDeviceDataTableName(deviceHistoryDataVo.getDeviceId())); + tdHistorySelectDto.setOrderByFieldName(TdEngineConstants.DEFAULT_FIRST_FIELD_NAME); + tdHistorySelectDto.setSort(TdEngineConstants.DEFAULT_ORDER_BY_MODE); + if (deviceHistoryDataVo.getStartTime() != 0 || deviceHistoryDataVo.getEndTime() != 0) { + tdHistorySelectDto.setFirstFieldName(TdEngineConstants.DEFAULT_FIRST_FIELD_NAME); + } + tdHistorySelectDto.setStartTime(deviceHistoryDataVo.getStartTime()); + tdHistorySelectDto.setEndTime(deviceHistoryDataVo.getEndTime()); + tdHistorySelectDto.setOffset(deviceHistoryDataVo.getOffset()); + tdHistorySelectDto.setLimit(deviceHistoryDataVo.getLimit()); + + return this.remoteTdEngineService.getHistoryData(tdHistorySelectDto).getData(); + + } + +} diff --git a/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/service/impl/HwMonitorUnitServiceImpl.java b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/service/impl/HwMonitorUnitServiceImpl.java index be57e45..289e03d 100644 --- a/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/service/impl/HwMonitorUnitServiceImpl.java +++ b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/service/impl/HwMonitorUnitServiceImpl.java @@ -1,29 +1,33 @@ package com.ruoyi.business.service.impl; -import java.time.LocalDate; -import java.time.LocalDateTime; -import java.time.LocalTime; -import java.time.ZoneOffset; -import java.time.format.DateTimeFormatter; -import java.util.*; -import java.util.stream.Collectors; - +import com.ruoyi.business.domain.HwAlarmInfo; import com.ruoyi.business.domain.HwDevice; +import com.ruoyi.business.domain.HwMonitorUnit; import com.ruoyi.business.domain.VO.*; +import com.ruoyi.business.mapper.HwAlarmInfoMapper; import com.ruoyi.business.mapper.HwDeviceMapper; import com.ruoyi.business.mapper.HwElectronicFenceMapper; +import com.ruoyi.business.mapper.HwMonitorUnitMapper; +import com.ruoyi.business.service.IHwMonitorUnitService; import com.ruoyi.common.core.constant.TdEngineConstants; import com.ruoyi.common.core.domain.R; import com.ruoyi.common.core.utils.DateUtils; +import com.ruoyi.common.core.utils.NumberUtils; import com.ruoyi.common.core.utils.StringUtils; import com.ruoyi.tdengine.api.RemoteTdEngineService; import com.ruoyi.tdengine.api.domain.DeviceStatus; import com.ruoyi.tdengine.api.domain.TdSelectDto; +import com.ruoyi.tdengine.api.domain.TdSuperTableSelectVo; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; -import com.ruoyi.business.mapper.HwMonitorUnitMapper; -import com.ruoyi.business.domain.HwMonitorUnit; -import com.ruoyi.business.service.IHwMonitorUnitService; + +import java.time.LocalDate; +import java.time.LocalDateTime; +import java.time.LocalTime; +import java.time.ZoneOffset; +import java.time.format.DateTimeFormatter; +import java.util.*; +import java.util.stream.Collectors; /** * 监控单元Service业务层处理 @@ -32,8 +36,7 @@ import com.ruoyi.business.service.IHwMonitorUnitService; * @date 2023-08-31 */ @Service -public class HwMonitorUnitServiceImpl implements IHwMonitorUnitService -{ +public class HwMonitorUnitServiceImpl implements IHwMonitorUnitService { @Autowired private HwMonitorUnitMapper hwMonitorUnitMapper; @Autowired @@ -42,8 +45,8 @@ public class HwMonitorUnitServiceImpl implements IHwMonitorUnitService private RemoteTdEngineService remoteTdEgineService; @Autowired private HwDeviceMapper hwDeviceMapper; - - + @Autowired + private HwAlarmInfoMapper hwAlarmInfoMapper; /** * 查询监控单元 @@ -52,106 +55,106 @@ public class HwMonitorUnitServiceImpl implements IHwMonitorUnitService * @return 监控单元 */ @Override - public HwMonitorUnit selectHwMonitorUnitByMonitorUnitId(Long monitorUnitId) - { + public HwMonitorUnit selectHwMonitorUnitByMonitorUnitId(Long monitorUnitId) { return hwMonitorUnitMapper.selectHwMonitorUnitByMonitorUnitId(monitorUnitId); } + /** * 查询区域数量站场景区总数百分比 - * */ + */ @Override public List selectMonitorPercentage() { +// HwMonitorUnit queryMonitorUnit = new HwMonitorUnit(); +// List list = hwMonitorUnitMapper.selectHwMonitorUnitListJoinScene(queryMonitorUnit); +// Map> monitorUnitMap = list.stream() +// .collect(Collectors.groupingBy(HwMonitorUnit::getSceneId)); +// List monitorUnitVoList = new ArrayList<>(); +// +// +// Set keys = monitorUnitMap.keySet(); +// for(Long key:keys){ +// Integer value = monitorUnitMap.get(key); +// System.out.println(key+"\t"+value); +// } List list = hwMonitorUnitMapper.selectMonitorPercentage(); List hwScenes = hwMonitorUnitMapper.selectSceneNameById(); - int count = hwScenes.size(); - if (list.size()<=hwScenes.size()) { - count = list.size(); - } - for (int i = 0; i < count; i++) { - for (int j = 0;j { + for (int i = 0; i < hwScenes.size(); i++) { + if (l.getSceneId().equals(hwScenes.get(i).getSceneId())) { + l.setSceneName(hwScenes.get(i).getSceneName()); } } - } + }); + Integer value = 0; // Integer sums = 0; - if (list.size()>5){ - for (int i = 4; i < list.size(); i++){ - if (list.get(i).sum==null){ - list.get(i).sum = 0; - } - value = value+list.get(i).sum; - } - } - for (int i = 0; i < list.size();i++){ - if (list.get(i).sum==null){ +// if (list.size() > 5) { +// for (int i = 4; i < list.size(); i++) {//这是剩下的总数 +// if (list.get(i).sum == null) { +// list.get(i).sum = 0; +// } +// value = value + list.get(i).sum; +// } +// } + for (int i = 0; i < list.size(); i++) { + if (list.get(i).sum == null) { list.get(i).sum = 0; } - sums = sums+list.get(i).sum; + sums = sums + list.get(i).sum; } - for (int i=0;i alarmInfos = hwAlarmInfoMapper.selectHwAlarmInfoList(queryAlarmInfo); + Integer alarmInfoSize = alarmInfos == null ? 0 : alarmInfos.size(); + hwMonitorUnitVo.setErr(alarmInfoSize); } - HwMonitorUnitVo hwMonitorUnitVo = new HwMonitorUnitVo(); - hwMonitorUnitVo.setSceneName("其他"); - hwMonitorUnitVo.setSum(value); - if (list.size()>5){ - list.add(5,hwMonitorUnitVo); - return list.subList(0,5); - } - else { - return list; - } +// HwMonitorUnitVo hwMonitorUnitVo = new HwMonitorUnitVo(); +// hwMonitorUnitVo.setSceneName("其他"); +// hwMonitorUnitVo.setSum(value); + +// if (list.size() > 5) { +// list.add(5, hwMonitorUnitVo); +// return list.subList(0, 5); +// } else { +// return list; +// } + return list; } //获取总的设备数量与监控单元数量 @Override - public AllNumsVo selectAllNums() { + public AllNumsVo selectAllNums(Long sceneId) { //监控单元 - String monitor = hwMonitorUnitMapper.selectSubSetNums(); - String integer = hwMonitorUnitMapper.selectDeviceNums(); - System.out.println(monitor+" dsaas "+integer); - Integer monitor1 = 0; - Integer monitor2 = 0; - + Integer monitor = hwMonitorUnitMapper.selectSubSetNums(sceneId) == null ? 0 + : hwMonitorUnitMapper.selectSubSetNums(sceneId); + Integer integer = hwMonitorUnitMapper.selectDeviceNums(sceneId) == null ? 0 + : hwMonitorUnitMapper.selectDeviceNums(sceneId); AllNumsVo vo = new AllNumsVo(); - if (monitor == null){ - monitor1 = 0; - } - else { - monitor1 = Integer.valueOf(monitor); - } - if (integer == null){ - monitor2 = 0; - } - else { - monitor2 = Integer.valueOf(integer); - } - vo.setSubSum(monitor1); - vo.setSum(monitor2); - - + vo.setSubSum(monitor); + vo.setSum(integer); return vo; } - - @Override - public List selectSenceAllNums() { - List allNumsVos = hwMonitorUnitMapper.selectAllNums(); - List allNums = hwMonitorUnitMapper.selectsum(); - for (int i=0;i< allNums.size();i++){ - for (int j=0;j< allNums.size();j++){ - if (allNums.get(i).getSceneId().equals(allNumsVos.get(i).getSceneId())){ - allNums.get(i).setSubSum(allNumsVos.get(i).getSubSum()); - } - } - } - return allNums; - } +// @Override +// public List selectSenceAllNums() { +// List allNumsVos = hwMonitorUnitMapper.selectAllNums(); +// List allNums = hwMonitorUnitMapper.selectsum(); +// for (int i = 0; i < allNums.size(); i++) { +// for (int j = 0; j < allNums.size(); j++) { +// if (allNums.get(i).getSceneId().equals(allNumsVos.get(i).getSceneId())) { +// allNums.get(i).setSubSum(allNumsVos.get(i).getSubSum()); +// } +// } +// } +// return allNums; +// } @Override public List selectLimitSubMonitorUnit() { @@ -161,8 +164,8 @@ public class HwMonitorUnitServiceImpl implements IHwMonitorUnitService } @Override - public List selectAlarmStats() { - return hwMonitorUnitMapper.selectAlarmStats(); + public List selectAlarmStats(Long sceneId) { + return hwMonitorUnitMapper.selectAlarmStats(sceneId); } @@ -173,155 +176,72 @@ public class HwMonitorUnitServiceImpl implements IHwMonitorUnitService * @return 监控单元 */ @Override - public List selectHwMonitorUnitList(HwMonitorUnit hwMonitorUnit) - { + public List selectHwMonitorUnitList(HwMonitorUnit hwMonitorUnit) { return hwMonitorUnitMapper.selectHwMonitorUnitList(hwMonitorUnit); } @Override public SubDeviceSumVo selectSubDeviceSum(Long sceneId) { - int SubSum = hwMonitorUnitMapper.selectSubDeviceSum(sceneId); - List hwDevices = hwDeviceMapper.selectDeviceNum(sceneId); - int onlineDevice = 0; - for (int i = 0;i longs = hwMonitorUnitMapper.selectEleInScene(sceneId); - return null; - } - @Override public HwMonitorUnit selectHwmonitorUnitSub(Long monitorUnitId) { - return hwMonitorUnitMapper.selectHwMonitorUnitByMonitorUnitId(monitorUnitId); + return hwMonitorUnitMapper.selectHwMonitorUnitByMonitorUnitId(monitorUnitId); } + //todo SysDeptServiceImpl类中的递归方法recursionFn(以实现) @Override - // 加一个begintime参数,endtime参数 stream时间戳 从开始时间0点开始,结束时间23.59.59结束 - public Map selectTdengine(String beginTime, String endTime, Long sceneId) { - DeviceStatus queryDeviceStatus = new DeviceStatus(); - - Map params = queryDeviceStatus.getParams(); - DateTimeFormatter ofPattern = DateTimeFormatter.ofPattern("yyyy-MM-dd", Locale.CHINA); - System.out.println(ofPattern); - LocalDate parse = LocalDate.parse(beginTime, ofPattern); - long begintime = parse.atStartOfDay().toInstant(ZoneOffset.of("+8")).toEpochMilli(); - - DateTimeFormatter ofPattern1 = DateTimeFormatter.ofPattern("yyyy-MM-dd", Locale.CHINA); - LocalDate parse1 = LocalDate.parse(endTime, ofPattern); - long endtime = LocalDateTime.of(parse1, LocalTime.MAX).toInstant(ZoneOffset.of("+8")).toEpochMilli(); - - params.put("beginTime",begintime); - params.put("endTime", endtime); - queryDeviceStatus.setParams(params); - if (sceneId != null) { - queryDeviceStatus.setSceneId(sceneId); + public List selectTreeList(List hwMonitorUnits) { + List returnList = new ArrayList<>(); + List tempList = hwMonitorUnits.stream().map(HwMonitorUnit::getMonitorUnitId).collect(Collectors.toList()); + List treeList = new ArrayList<>(); + for (HwMonitorUnit hwMonitorUnit : hwMonitorUnits) { + if (!tempList.contains(hwMonitorUnit.getParentId())) + recursionFn(hwMonitorUnits, hwMonitorUnit); + returnList.add(hwMonitorUnit); } - - int sum = 0; - int values[] = new int[10]; - Map valuesMap = new HashMap<>(); - //todo 使用id(以解决) - //map key时间戳,value List 对象 - R r = remoteTdEgineService.getOnlineDevicesGroupByDay(queryDeviceStatus); - Map> deviceStatusMap = (Map>) r.getData(); - List list = (List) remoteTdEgineService.getOnlineDevicesGroupByDay(queryDeviceStatus); - Set longs = deviceStatusMap.keySet(); - for (Object key:longs){ - List deviceStatuses = deviceStatusMap.get(key); - for (int i=0;i>> selectLatestDataByTags(Long monitorUnitId) { -// - R>> latestDataByTags = new R>>(); - List hwDevices = hwDeviceMapper.selectDeviceByMonitorId(monitorUnitId); - TdSelectDto tdSelectDto = new TdSelectDto(); - for (int i = 0; i < hwDevices.size(); i++){ - tdSelectDto.setDatabaseName(TdEngineConstants.PLATFORM_DB_NAME); - tdSelectDto.setTableName(TdEngineConstants.getDeviceDataTableName(hwDevices.get(i).getDeviceId())); - tdSelectDto.setTagsName(hwDevices.get(i).getDeviceCode()); - - latestDataByTags = remoteTdEgineService.getLatestDataByTags(tdSelectDto); - } - return latestDataByTags; - } - -//todo SysDeptServiceImpl类中的递归方法recursionFn(以实现) -@Override -public List selectTreeList(List hwMonitorUnits) { - List returnList = new ArrayList<>(); - List tempList = hwMonitorUnits.stream().map(HwMonitorUnit::getMonitorUnitId).collect(Collectors.toList()); - List treeList = new ArrayList<>(); - for (HwMonitorUnit hwMonitorUnit:hwMonitorUnits){ - if (!tempList.contains(hwMonitorUnit.getParentId())) - recursionFn(hwMonitorUnits,hwMonitorUnit); - returnList.add(hwMonitorUnit); - } - for (int i = 0; i < returnList.size(); i++){ - if (returnList.get(i).getParentId()==null){ - treeList.add(returnList.get(i)); - } - } - return treeList; -} - private void recursionFn(List list, HwMonitorUnit t) - { + private void recursionFn(List list, HwMonitorUnit t) { // 得到子节点列表 List childList = getChildList(list, t); t.setChild(childList); - for (HwMonitorUnit tChild : childList) - { - if (hasChild(list, tChild)) - { + for (HwMonitorUnit tChild : childList) { + if (hasChild(list, tChild)) { recursionFn(list, tChild); } } } - private List getChildList(List list, HwMonitorUnit t) - { + + private List getChildList(List list, HwMonitorUnit t) { List tlist = new ArrayList(); Iterator it = list.iterator(); - while (it.hasNext()) - { + while (it.hasNext()) { HwMonitorUnit n = (HwMonitorUnit) it.next(); - if (StringUtils.isNotNull(n.getParentId()) && n.getParentId().longValue() == t.getMonitorUnitId().longValue()) - { + if (StringUtils.isNotNull(n.getParentId()) && n.getParentId().longValue() == t.getMonitorUnitId().longValue()) { tlist.add(n); } } return tlist; } - private boolean hasChild(List list, HwMonitorUnit t) - { + + private boolean hasChild(List list, HwMonitorUnit t) { return getChildList(list, t).size() > 0 ? true : false; } @@ -332,8 +252,7 @@ public List selectTreeList(List hwMonitorUnits) { * @return 结果 */ @Override - public int insertHwMonitorUnit(HwMonitorUnit hwMonitorUnit) - { + public int insertHwMonitorUnit(HwMonitorUnit hwMonitorUnit) { hwMonitorUnit.setCreateTime(DateUtils.getNowDate()); return hwMonitorUnitMapper.insertHwMonitorUnit(hwMonitorUnit); } @@ -345,8 +264,7 @@ public List selectTreeList(List hwMonitorUnits) { * @return 结果 */ @Override - public int updateHwMonitorUnit(HwMonitorUnit hwMonitorUnit) - { + public int updateHwMonitorUnit(HwMonitorUnit hwMonitorUnit) { hwMonitorUnit.setUpdateTime(DateUtils.getNowDate()); return hwMonitorUnitMapper.updateHwMonitorUnit(hwMonitorUnit); } @@ -358,8 +276,7 @@ public List selectTreeList(List hwMonitorUnits) { * @return 结果 */ @Override - public int deleteHwMonitorUnitByMonitorUnitIds(Long[] monitorUnitIds) - { + public int deleteHwMonitorUnitByMonitorUnitIds(Long[] monitorUnitIds) { return hwMonitorUnitMapper.deleteHwMonitorUnitByMonitorUnitIds(monitorUnitIds); } @@ -370,28 +287,91 @@ public List selectTreeList(List hwMonitorUnits) { * @return 结果 */ @Override - public int deleteHwMonitorUnitByMonitorUnitId(Long monitorUnitId) - { + public int deleteHwMonitorUnitByMonitorUnitId(Long monitorUnitId) { return hwMonitorUnitMapper.deleteHwMonitorUnitByMonitorUnitId(monitorUnitId); } -} -//remoteTdEngineSevice.getOnlineDevicesGroupByDay方法获取 -// 参数实例: -// // params.put("beginTime", beginTime); -//// params.put("endTime", endTime); -//// queryDeviceStatus.setParams(params); -//// if (sceneId != null) { -//// queryDeviceStatus.setSceneId(sceneId); -//// } -// -// 这是IDEA参数传的参数Content-Type: application/json -// { -// "params": { "beginTime":1666666666666,"endTime":1766666666666 } -// -// } -// -// 如果在IDEA测试可以{ -// "params": {"databaseName":"db_scene_1","superTableName":"st_ds_1", -// "beginTime":1666666666666,"endTime":1766666666666 } -// } + + /** + * 查询监控单元树结构信息 + * + * @param hwMonitorUnit 监控单元信息 + * @return 监控单元树信息集合 + */ + @Override + public List selectMonitorTreeList(HwMonitorUnit hwMonitorUnit) { + List hwMonitorUnits = this.selectHwMonitorUnitList(hwMonitorUnit); + return buildMonitorUnitTreeSelect(hwMonitorUnits); + } + + /** + * 构建前端所需要下拉树结构 + * + * @param hwMonitorUnits 监控单元列表 + * @return 下拉树结构列表 + */ + @Override + public List buildMonitorUnitTreeSelect(List hwMonitorUnits) { + List monitorUnitTrees = buildMonitorUnitTree(hwMonitorUnits); + return monitorUnitTrees.stream().map(TreeSelectVo::new).collect(Collectors.toList()); + } + + /** + * 构建前端所需要树结构 + * + * @param hwMonitorUnits 监控单元列表 + * @return 树结构列表 + */ + @Override + public List buildMonitorUnitTree(List hwMonitorUnits) { + List returnList = new ArrayList(); + List tempList = hwMonitorUnits.stream().map(HwMonitorUnit::getMonitorUnitId).collect(Collectors.toList()); + for (HwMonitorUnit monitorUnit : hwMonitorUnits) { + // 如果是顶级节点, 遍历该父节点的所有子节点 + if (!tempList.contains(monitorUnit.getParentId())) { + recursionFn1(hwMonitorUnits, monitorUnit); + returnList.add(monitorUnit); + } + } + if (returnList.isEmpty()) { + returnList = hwMonitorUnits; + } + return returnList; + } + + /** + * 递归列表 + */ + private void recursionFn1(List list, HwMonitorUnit t) { + // 得到子节点列表 + List childList = getChildList1(list, t); + t.setChildren(childList); + for (HwMonitorUnit tChild : childList) { + if (hasChild1(list, tChild)) { + recursionFn1(list, tChild); + } + } + } + + /** + * 得到子节点列表 + */ + private List getChildList1(List list, HwMonitorUnit t) { + List tlist = new ArrayList(); + Iterator it = list.iterator(); + while (it.hasNext()) { + HwMonitorUnit n = (HwMonitorUnit) it.next(); + if (StringUtils.isNotNull(n.getParentId()) && n.getParentId().longValue() == t.getMonitorUnitId().longValue()) { + tlist.add(n); + } + } + return tlist; + } + + /** + * 判断是否有子节点 + */ + private boolean hasChild1(List list, HwMonitorUnit t) { + return getChildList1(list, t).size() > 0 ? true : false; + } +} diff --git a/ruoyi-modules/hw-business/src/main/resources/mapper/business/HwAlarmInfoMapper.xml b/ruoyi-modules/hw-business/src/main/resources/mapper/business/HwAlarmInfoMapper.xml new file mode 100644 index 0000000..43a69d5 --- /dev/null +++ b/ruoyi-modules/hw-business/src/main/resources/mapper/business/HwAlarmInfoMapper.xml @@ -0,0 +1,168 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + select hai.alarm_info_id, hai.alarm_info_type, hai.alarm_releated_id, hai.device_id, + hai.monitor_unit_id, hai.tenant_id, hai.scene_id, hai.alarm_level_id, + hai.alarm_type_id, hai.mode_function_id, hai.function_name, hai.function_identifier, + hai.function_value, hai.trigger_status, hai.handle_status, hai.alarm_time, + hai.create_time, hai.update_by, hai.update_time, hai.alarm_info_field, + hmu.monitor_unit_name,hal.alarm_level_name,hat.alarm_type_name + from hw_alarm_info hai left join hw_monitor_unit hmu on hai.monitor_unit_id = hmu.monitor_unit_id + left join hw_alarm_level hal on hai.alarm_level_id=hal.alarm_level_id + left join hw_alarm_type hat on hai.alarm_type_id=hat.alarm_type_id + + + + + + + + insert into hw_alarm_info + + alarm_info_type, + alarm_releated_id, + device_id, + monitor_unit_id, + tenant_id, + scene_id, + alarm_level_id, + alarm_type_id, + mode_function_id, + function_name, + function_identifier, + function_value, + trigger_status, + handle_status, + alarm_time, + create_time, + update_by, + update_time, + alarm_info_field, + + + #{alarmInfoType}, + #{alarmReleatedId}, + #{deviceId}, + #{monitorUnitId}, + #{tenantId}, + #{sceneId}, + #{alarmLevelId}, + #{alarmTypeId}, + #{modeFunctionId}, + #{functionName}, + #{functionIdentifier}, + #{functionValue}, + #{triggerStatus}, + #{handleStatus}, + #{alarmTime}, + #{createTime}, + #{updateBy}, + #{updateTime}, + #{alarmInfoField}, + + + + + update hw_alarm_info + + alarm_info_type = #{alarmInfoType}, + alarm_releated_id = #{alarmReleatedId}, + device_id = #{deviceId}, + monitor_unit_id = #{monitorUnitId}, + tenant_id = #{tenantId}, + scene_id = #{sceneId}, + alarm_level_id = #{alarmLevelId}, + alarm_type_id = #{alarmTypeId}, + mode_function_id = #{modeFunctionId}, + function_name = #{functionName}, + function_identifier = #{functionIdentifier}, + function_value = #{functionValue}, + trigger_status = #{triggerStatus}, + handle_status = #{handleStatus}, + alarm_time = #{alarmTime}, + create_time = #{createTime}, + update_by = #{updateBy}, + update_time = #{updateTime}, + alarm_info_field = #{alarmInfoField}, + + where alarm_info_id = #{alarmInfoId} + + + + delete from hw_alarm_info where alarm_info_id = #{alarmInfoId} + + + + delete from hw_alarm_info where alarm_info_id in + + #{alarmInfoId} + + + + + + + \ No newline at end of file diff --git a/ruoyi-modules/hw-business/src/main/resources/mapper/business/HwAlarmLevelMapper.xml b/ruoyi-modules/hw-business/src/main/resources/mapper/business/HwAlarmLevelMapper.xml new file mode 100644 index 0000000..8f7ccd7 --- /dev/null +++ b/ruoyi-modules/hw-business/src/main/resources/mapper/business/HwAlarmLevelMapper.xml @@ -0,0 +1,116 @@ + + + + + + + + + + + + + + + + + + + + + + + + select alarm_level_id, alarm_level_name, tenant_id, scene_id, language_code, common_flag, level_number, level_status, default_notify_mode, remark, create_by, create_time, update_by, update_time, alarm_level_field from hw_alarm_level + + + + + + + + insert into hw_alarm_level + + alarm_level_name, + tenant_id, + scene_id, + language_code, + common_flag, + level_number, + level_status, + default_notify_mode, + remark, + create_by, + create_time, + update_by, + update_time, + alarm_level_field, + + + #{alarmLevelName}, + #{tenantId}, + #{sceneId}, + #{languageCode}, + #{commonFlag}, + #{levelNumber}, + #{levelStatus}, + #{defaultNotifyMode}, + #{remark}, + #{createBy}, + #{createTime}, + #{updateBy}, + #{updateTime}, + #{alarmLevelField}, + + + + + update hw_alarm_level + + alarm_level_name = #{alarmLevelName}, + tenant_id = #{tenantId}, + scene_id = #{sceneId}, + language_code = #{languageCode}, + common_flag = #{commonFlag}, + level_number = #{levelNumber}, + level_status = #{levelStatus}, + default_notify_mode = #{defaultNotifyMode}, + remark = #{remark}, + create_by = #{createBy}, + create_time = #{createTime}, + update_by = #{updateBy}, + update_time = #{updateTime}, + alarm_level_field = #{alarmLevelField}, + + where alarm_level_id = #{alarmLevelId} + + + + delete from hw_alarm_level where alarm_level_id = #{alarmLevelId} + + + + delete from hw_alarm_level where alarm_level_id in + + #{alarmLevelId} + + + \ No newline at end of file diff --git a/ruoyi-modules/hw-business/src/main/resources/mapper/business/HwAlarmTypeMapper.xml b/ruoyi-modules/hw-business/src/main/resources/mapper/business/HwAlarmTypeMapper.xml new file mode 100644 index 0000000..9028571 --- /dev/null +++ b/ruoyi-modules/hw-business/src/main/resources/mapper/business/HwAlarmTypeMapper.xml @@ -0,0 +1,111 @@ + + + + + + + + + + + + + + + + + + + + + + + select alarm_type_id, alarm_type_name, tenant_id, scene_id, language_code, common_flag, handle_mode, type_status, remark, create_by, create_time, update_by, update_time, alarm_type_field from hw_alarm_type + + + + + + + + insert into hw_alarm_type + + alarm_type_name, + tenant_id, + scene_id, + language_code, + common_flag, + handle_mode, + type_status, + remark, + create_by, + create_time, + update_by, + update_time, + alarm_type_field, + + + #{alarmTypeName}, + #{tenantId}, + #{sceneId}, + #{languageCode}, + #{commonFlag}, + #{handleMode}, + #{typeStatus}, + #{remark}, + #{createBy}, + #{createTime}, + #{updateBy}, + #{updateTime}, + #{alarmTypeField}, + + + + + update hw_alarm_type + + alarm_type_name = #{alarmTypeName}, + tenant_id = #{tenantId}, + scene_id = #{sceneId}, + language_code = #{languageCode}, + common_flag = #{commonFlag}, + handle_mode = #{handleMode}, + type_status = #{typeStatus}, + remark = #{remark}, + create_by = #{createBy}, + create_time = #{createTime}, + update_by = #{updateBy}, + update_time = #{updateTime}, + alarm_type_field = #{alarmTypeField}, + + where alarm_type_id = #{alarmTypeId} + + + + delete from hw_alarm_type where alarm_type_id = #{alarmTypeId} + + + + delete from hw_alarm_type where alarm_type_id in + + #{alarmTypeId} + + + \ No newline at end of file diff --git a/ruoyi-modules/hw-business/src/main/resources/mapper/business/HwDeviceMapper.xml b/ruoyi-modules/hw-business/src/main/resources/mapper/business/HwDeviceMapper.xml index 0dee03a..3072448 100644 --- a/ruoyi-modules/hw-business/src/main/resources/mapper/business/HwDeviceMapper.xml +++ b/ruoyi-modules/hw-business/src/main/resources/mapper/business/HwDeviceMapper.xml @@ -34,6 +34,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + @@ -219,4 +220,26 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" #{deviceId} + + + + + select hd.device_code,hd.device_name, hd.device_status,hd.online_status, hd.device_pic,hd.active_time, + hmu.monitor_unit_name + from hw_device hd left join hw_monitor_unit hmu on hd.monitor_unit_id = hmu.monitor_unit_id + + + + + \ No newline at end of file diff --git a/ruoyi-modules/hw-business/src/main/resources/mapper/business/HwElectronicFenceMapper.xml b/ruoyi-modules/hw-business/src/main/resources/mapper/business/HwElectronicFenceMapper.xml index 723e9cb..d5abd95 100644 --- a/ruoyi-modules/hw-business/src/main/resources/mapper/business/HwElectronicFenceMapper.xml +++ b/ruoyi-modules/hw-business/src/main/resources/mapper/business/HwElectronicFenceMapper.xml @@ -32,6 +32,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + + + + + + + + + + select electronic_fence_id, electronic_fence_name, scene_id, fence_type, effective_time_flag, time_zone, effective_time, trigger_status, area_shape_flag, area_range, fence_push_flag, fence_push_content, fence_recover_content, remark, create_by, create_time, update_by, update_time, fence_field from hw_electronic_fence @@ -130,9 +140,12 @@ GROUP BY - + select a.electronic_fence_id, a.electronic_fence_name, a.scene_id, a.fence_type, a.effective_time_flag, a.time_zone, a.effective_time, a.trigger_status, a.area_shape_flag, a.area_range, a.fence_push_flag, a.fence_push_content, a.fence_recover_content, a.remark, a.create_by, a.create_time, a.update_by, a.update_time, a.fence_field, + b.electronic_fence_id as sub_electronic_fence_id, b.target_type as sub_target_type, b.target_id as sub_target_id + from hw_electronic_fence a + left join hw_fence_target b on b.electronic_fence_id = a.electronic_fence_id + where a.electronic_fence_id = #{electronicFenceId} @@ -214,4 +227,25 @@ GROUP BY #{electronicFenceId} + + + + + + + + + + diff --git a/ruoyi-modules/hw-business/src/main/resources/mapper/business/HwMonitorUnitMapper.xml b/ruoyi-modules/hw-business/src/main/resources/mapper/business/HwMonitorUnitMapper.xml index 33d5e7e..67aa83a 100644 --- a/ruoyi-modules/hw-business/src/main/resources/mapper/business/HwMonitorUnitMapper.xml +++ b/ruoyi-modules/hw-business/src/main/resources/mapper/business/HwMonitorUnitMapper.xml @@ -1,7 +1,7 @@ + PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> @@ -20,6 +20,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + @@ -59,18 +60,27 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" select monitor_unit_id, monitor_unit_name, scene_id, parent_id, monitor_unit_type_id, area_id, monitor_address, monitor_pic, preserve_time, remark, monitor_unit_status, create_by, create_time, update_by, update_time, monitor_unit_field from hw_monitor_unit + + + select hmu.monitor_unit_id, hmu.monitor_unit_name, hmu.scene_id, hmu.parent_id, + hmu.monitor_unit_type_id, hmu.area_id, hmu.monitor_address, hmu.monitor_pic, + hmu.preserve_time, hmu.monitor_unit_status, hc.scene_name + from hw_monitor_unit hmu left join hw_scene hc on hmu.scene_id = hc.scene_id + + + select scene_id,count(*) as sub_sum from - (select monitor_unit_id,scene_id from hw_monitor_unit - where monitor_unit_id not in (select parent_id from hw_monitor_unit where parent_id is not null))as temp + (select monitor_unit_id,scene_id from hw_monitor_unit + where monitor_unit_id not in (select parent_id from hw_monitor_unit where parent_id is not null))as temp GROUP BY scene_id - - select count(*)from hw_monitor_unit - where monitor_unit_id not in (select parent_id from hw_monitor_unit where parent_id is not null) + select count(*)from hw_monitor_unit + where monitor_unit_id not in (select parent_id from hw_monitor_unit where parent_id is not null) + and scene_id = #{sceneId} - select count(*) as sum from hw_device -where device_status = '1' + where device_status = '1' + and scene_id = #{sceneId} - + - + - + - + select scene_id,scene_name from hw_scene - + - + - + - + - + + select count(*) from hw_device where monitor_unit_id = (select target_id from hw_fence_target where target_type='2' and electronic_fence_id = #{electronicFenceId}) + insert into hw_monitor_unit @@ -199,7 +211,7 @@ select count(*) from hw_device where monitor_unit_id = (select target_id from hw update_by, update_time, monitor_unit_field, - + #{monitorUnitName}, #{sceneId}, @@ -216,7 +228,7 @@ select count(*) from hw_device where monitor_unit_id = (select target_id from hw #{updateBy}, #{updateTime}, #{monitorUnitField}, - + @@ -251,4 +263,23 @@ select count(*) from hw_device where monitor_unit_id = (select target_id from hw #{monitorUnitId} - + + + + + \ No newline at end of file