若依微服务1.6.2

1、设备监测页面,右侧设备信息展示,如果有拍摄的照片则展示照片,else如果有设备照片则展示设备照片,else展示默认设备照片
2、手机app接口权限设置,增加了获取设备模型和获取网关设备接口
3、监控平台首页监控单元数量和设备数量写反了
dev 1.6.2
xins 1 year ago
parent 7a62384750
commit 572f5ef8d6

@ -1,14 +1,8 @@
package com.ruoyi.business.controller;
import com.ruoyi.business.domain.HwAlarmInfo;
import com.ruoyi.business.domain.HwDevice;
import com.ruoyi.business.domain.HwMonitorUnit;
import com.ruoyi.business.domain.HwScene;
import com.ruoyi.business.domain.*;
import com.ruoyi.business.domain.VO.AllNumsVo;
import com.ruoyi.business.service.IHwAlarmInfoService;
import com.ruoyi.business.service.IHwDeviceService;
import com.ruoyi.business.service.IHwMonitorUnitService;
import com.ruoyi.business.service.IHwSceneService;
import com.ruoyi.business.service.*;
import com.ruoyi.common.core.constant.HwDictConstants;
import com.ruoyi.common.core.web.controller.BaseController;
import com.ruoyi.common.core.web.domain.AjaxResult;
@ -46,9 +40,13 @@ public class HwAppController extends BaseController {
@Autowired
private IHwDeviceService hwDeviceService;
@Autowired
private IHwDeviceModeService hwDeviceModeService;
/**
*
*/
@RequiresPermissions("business:app:index")
@GetMapping("/selectSecnes")
public AjaxResult selectSecnes(HwScene scene) {
List<HwScene> hwScenes = hwSceneService.selectHwSceneList(scene);
@ -58,7 +56,7 @@ public class HwAppController extends BaseController {
/**
* app
*/
@RequiresPermissions("business:monitor:standard")
@RequiresPermissions("business:app:index")
@GetMapping("/sceneAllNums/{sceneId}")
public AllNumsVo sceneAllNums(@PathVariable("sceneId") Long sceneId) {
return hwMonitorUnitService.selectAllNums(sceneId);
@ -67,7 +65,7 @@ public class HwAppController extends BaseController {
/**
* ()
*/
@RequiresPermissions("business:monitor:standard")
@RequiresPermissions("business:app:index")
@GetMapping("/limitSubMonitorUnit/{sceneId}")
public TableDataInfo limitSubMonitorUnit(@PathVariable("sceneId") Long sceneId) {
HwMonitorUnit hwMonitorUnit = new HwMonitorUnit();
@ -85,7 +83,7 @@ public class HwAppController extends BaseController {
* @date 2023-09-15 11:03
*/
@GetMapping("/getAlarmInfos")
@RequiresPermissions("business:monitor:alarm")
@RequiresPermissions("business:app:index")
public TableDataInfo getAlarmInfos(HwAlarmInfo hwAlarmInfo) {
hwAlarmInfo.setHandleStatus(HwDictConstants.ALARM_HANDLE_STATUS_NO);
List<HwAlarmInfo> alarmInfos = hwAlarmInfoService.selectHwAlarmInfoList(hwAlarmInfo);
@ -100,7 +98,7 @@ public class HwAppController extends BaseController {
* @return AjaxResult
*/
@PutMapping("/handleAlarmInfo")
@RequiresPermissions("business:monitor:alarm")
@RequiresPermissions("business:app:index")
public AjaxResult handleAlarmInfo(@RequestBody HwAlarmInfo hwAlarmInfo) {
hwAlarmInfo.setUpdateBy(SecurityUtils.getUsername());
return toAjax(hwAlarmInfoService.updateHwAlarmInfo(hwAlarmInfo));
@ -114,7 +112,7 @@ public class HwAppController extends BaseController {
* @return list
* @throws
*/
@RequiresPermissions("business:monitor:deviceMonitor")
@RequiresPermissions("business:app:monitorUnit")
@GetMapping("/treeList/{sceneId}")
public AjaxResult monitorUnitTree(@PathVariable("sceneId") Long sceneId) {
HwMonitorUnit queryMonitorUnit = new HwMonitorUnit();
@ -129,11 +127,12 @@ public class HwAppController extends BaseController {
* @date 2023-09-28 13:31
* @return AjaxResult
*/
@RequiresPermissions("business:monitor:deviceMonitor")
@RequiresPermissions("business:app:monitorUnit")
@GetMapping("/getDevicesInfoByMonitorUnitId/{monitorUnitId}")
public AjaxResult getDevicesInfoByMonitorUnitId(@PathVariable("monitorUnitId") Long monitorUnitId){
return success();
HwDevice queryDevice = new HwDevice();
queryDevice.setMonitorUnitId(monitorUnitId);
return success(hwDeviceService.selectDeviceNum(queryDevice));
}
/**
@ -141,7 +140,7 @@ public class HwAppController extends BaseController {
*
* @param monitorUnitId id
*/
@RequiresPermissions("business:monitor:deviceMonitor")
@RequiresPermissions("business:app:monitorUnit")
@GetMapping("/selectDevicesByMonitorUnitId/{monitorUnitId}/{sceneId}")
public AjaxResult selectDeviceByDeviceModeByMonitorUnitId(@PathVariable("monitorUnitId") Long monitorUnitId,
@PathVariable("sceneId") Long sceneId) {
@ -156,7 +155,7 @@ public class HwAppController extends BaseController {
/**
*
*/
@RequiresPermissions("business:device:add")
@RequiresPermissions("business:app:deviceAdd")
@Log(title = "设备信息(手机端)", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody HwDevice hwDevice) {
@ -172,11 +171,38 @@ public class HwAppController extends BaseController {
*
* @param deviceCode
*/
@RequiresPermissions("business:monitor:deviceMonitor")
@RequiresPermissions("business:app:device")
@GetMapping("/getDeviceByDeviceCode/{deviceCode}")
public AjaxResult getDeviceByDeviceCode(@PathVariable("deviceCode") String deviceCode){
return success(hwDeviceService.selectHwDeviceByDeviceCode(deviceCode));
}
/**
*
*
* @param sceneId ID
*/
@RequiresPermissions("business:app:deviceAdd")
@GetMapping("/getDeviceModesBySceneId/{sceneId}")
public AjaxResult getDeviceModesBySceneId(@PathVariable("sceneId") Long sceneId){
HwDeviceMode queryDeviceMode = new HwDeviceMode();
queryDeviceMode.setSceneId(sceneId);
queryDeviceMode.setDeviceModeStatus(HwDictConstants.DEVICE_MODE_STATUS_NORMAL);
return success(hwDeviceModeService.selectHwDeviceModeList(queryDeviceMode));
}
/**
*
*
* @param sceneId ID
*/
@RequiresPermissions("business:app:deviceAdd")
@GetMapping("/getGatewayDevicesBySceneId/{sceneId}")
public AjaxResult getGatewayDevicesBySceneId(@PathVariable("sceneId") Long sceneId){
HwDevice queryDevice = new HwDevice();
queryDevice.setSceneId(sceneId);
queryDevice.setDeviceType(HwDictConstants.DEVICE_TYPE_GATEWAY_DEVICE);
return success(hwDeviceService.selectHwDeviceList(queryDevice));
}
}

@ -108,4 +108,9 @@ public interface HwDeviceMapper
* @return HwDevice
*/
public HwDevice selectHwDeviceByDeviceCode(String deviceCode);
public int selectDeviceNumCount(HwDevice hwDevice);
public int selectAbnormalDeviceNumCount(HwDevice hwDevice);
}

@ -169,4 +169,13 @@ public interface IHwDeviceService
* @date 2023-10-10 20:05
*/
public void rebuildTdTables();
/**
* @param: device
* @description
* @author xins
* @date 2023-10-20 10:08
* @return JSONObject
*/
public JSONObject selectDeviceNum(HwDevice device);
}

@ -486,6 +486,7 @@ public class HwDeviceServiceImpl implements IHwDeviceService {
hwDeviceVo.setDeviceModeId(hwDevice.getDeviceModeId());
hwDeviceVo.setDeviceCode(hwDevice.getDeviceCode());
hwDeviceVo.setDeviceName(hwDevice.getDeviceName());
hwDeviceVo.setDevicePic(hwDevice.getDevicePic());
hwDeviceVo.setDeviceType(HwDictConstants.ACQUISITION_DEVICE);
hwDeviceVo.setDeviceDataMap(ddValueMap);
acquisitionDeviceVos.add(hwDeviceVo);
@ -689,6 +690,24 @@ public class HwDeviceServiceImpl implements IHwDeviceService {
}
/**
* @param: device
* @description
* @author xins
* @date 2023-10-20 10:08
* @return JSONObject
*/
@Override
public JSONObject selectDeviceNum(HwDevice device) {
JSONObject result = new JSONObject();
int deviceNum = hwDeviceMapper.selectDeviceNumCount(device);
int abnormalDeviceNum = hwDeviceMapper.selectAbnormalDeviceNumCount(device);
result.put("normalDeviceNum", deviceNum - abnormalDeviceNum);
result.put("abnormalDeviceNum", abnormalDeviceNum);
return result;
}
/**
* @param: hwDevice
* @param: dbDevice

@ -125,10 +125,10 @@ public class HwMonitorUnitServiceImpl implements IHwMonitorUnitService {
//获取总的设备数量与监控单元数量(标准场景使用)
@Override
public AllNumsVo selectAllNums(Long sceneId) {
//监控单元
//查询设备数量包括网关
//监控单元数量
Integer monitor = hwMonitorUnitMapper.selectSubSetNums(sceneId) == null ? 0
: hwMonitorUnitMapper.selectSubSetNums(sceneId);
//查询设备数量(子设备和直连设备),不包括网关
Integer integer = hwMonitorUnitMapper.selectDeviceNums(sceneId) == null ? 0
: hwMonitorUnitMapper.selectDeviceNums(sceneId);
AllNumsVo vo = new AllNumsVo();

@ -292,4 +292,21 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
where device_code = #{deviceCode} limit 1
</select>
<select id="selectDeviceNumCount" parameterType="HwDevice">
select count(1) as sum from hw_device
where device_status = '1' and (device_type='2' or device_type='3')
<if test="sceneId != null and sceneId!=0"> and scene_id = #{sceneId}</if>
<if test="monitorUnitId != null and monitorUnitId!=0"> and monitor_unit_id = #{monitorUnitId}</if>
</select>
<select id="selectAbnormalDeviceNumCount" parameterType="HwDevice">
select count(1) as sum from hw_device hd
where hd.device_status = '1' and (hd.device_type='2' or hd.device_type='3')
and exists (select 1 from hw_alarm_info hai where hd.device_id=hai.device_id and hai.handle_status='0')
<if test="sceneId != null and sceneId!=0"> and hd.scene_id = #{sceneId}</if>
<if test="monitorUnitId != null and monitorUnitId!=0"> and hd.monitor_unit_id = #{monitorUnitId}</if>
</select>
</mapper>

@ -112,14 +112,13 @@
GROUP BY scene_id
</select>
<select id="selectSubSetNums" resultType="Integer">
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)
where monitor_unit_status='1' and monitor_unit_id not in (select parent_id from hw_monitor_unit where parent_id is not null)
<if test="sceneId != null "> and scene_id = #{sceneId}</if>
</select>
<select id="selectDeviceNums" resultType="Integer">
select count(*) as sum from hw_device
where device_status = '1'
where device_status = '1' and (device_type='2' or device_type='3')
<if test="sceneId != null and sceneId!=0"> and scene_id = #{sceneId}</if>
</select>
<!-- 通过场景分组,查询设备数量 todo 已解决 -->

@ -75,9 +75,14 @@
:src="i.deviceDataMap[Object.keys(i.deviceDataMap).find(e=> i.deviceDataMap[e].toString().includes('http'))]"
style="width: 100%; height: 100%">
</el-image>
<el-image
v-else-if="i.devicePic"
:src="i.devicePic"
style="width: 100%; height: 100%">
</el-image>
<el-image
v-else
:src="defaultImg2"
:src="defaultImg1"
style="width: 100%; height: 100%">
</el-image>
</div>

@ -81,11 +81,11 @@
<div>
<div class="centerInfo">传感器数量</div>
<div class="centerInfo" style="font-weight:bold;top:19.3%;left: 42.5%;font-size: 2vw;">{{
centerNum.subSum
centerNum.sum
}}
</div>
<div class="centerInfo" style="left: 56%">监控单元数量</div>
<div class="centerInfo" style="font-weight:bold;top:19.3%;left: 66%;font-size: 2vw;">{{ centerNum.sum }}</div>
<div class="centerInfo" style="font-weight:bold;top:19.3%;left: 66%;font-size: 2vw;">{{ centerNum.subSum }}</div>
</div>
<div class="inTransit">在运 <span style="color: #00f6ff">{{ inTransitNum }}</span></div>
<Chart ref="chart3" class="chart3"></Chart>

@ -309,7 +309,7 @@ export default {
{required: true, message: "请输入标识符", trigger: "blur"},
{
pattern: /^[a-zA-Z][a-z0-9_]+$/,
message: "2-20个字符由大小写字母、数字或下划线组成开头必须为小写字母",
message: "2-30个字符由大小写字母、数字或下划线组成开头必须为字母",
trigger: "blur"
}
],

Loading…
Cancel
Save