|
|
@@ -13,9 +13,11 @@ import com.usky.common.core.exception.BusinessException;
|
|
|
import com.usky.common.core.util.UUIDUtils;
|
|
|
import com.usky.common.security.utils.SecurityUtils;
|
|
|
import com.usky.eg.domain.EgDevice;
|
|
|
+import com.usky.eg.domain.EgDeviceHeartbeat;
|
|
|
import com.usky.eg.domain.MeetingFace;
|
|
|
import com.usky.eg.domain.MeetingFaceDevice;
|
|
|
import com.usky.eg.mapper.EgDeviceMapper;
|
|
|
+import com.usky.eg.mapper.EgDeviceHeartbeatMapper;
|
|
|
import com.usky.eg.mapper.MeetingFaceDeviceMapper;
|
|
|
import com.usky.eg.mapper.MeetingFaceMapper;
|
|
|
import com.usky.eg.service.EgDeviceService;
|
|
|
@@ -29,6 +31,7 @@ import org.springframework.stereotype.Service;
|
|
|
|
|
|
import java.time.LocalDateTime;
|
|
|
import java.util.*;
|
|
|
+import java.util.concurrent.CompletableFuture;
|
|
|
|
|
|
/**
|
|
|
* <p>
|
|
|
@@ -47,6 +50,8 @@ public class EgDeviceServiceImpl extends AbstractCrudService<EgDeviceMapper, EgD
|
|
|
@Autowired
|
|
|
private EgDeviceMapper egDeviceMapper;
|
|
|
@Autowired
|
|
|
+ private EgDeviceHeartbeatMapper egDeviceHeartbeatMapper;
|
|
|
+ @Autowired
|
|
|
private RemoteIotTaskService remoteIotTaskService;
|
|
|
|
|
|
@Autowired
|
|
|
@@ -55,10 +60,17 @@ public class EgDeviceServiceImpl extends AbstractCrudService<EgDeviceMapper, EgD
|
|
|
@Override
|
|
|
public CommonPage<EgDevice> page(EgDeviceRequestVO requestVO){
|
|
|
IPage<EgDevice> page = new Page<>(requestVO.getCurrent(),requestVO.getSize());
|
|
|
- Integer tenantId ;
|
|
|
+ Integer tenantId;
|
|
|
|
|
|
- if(StringUtils.isNotBlank(requestVO.getDomain())){
|
|
|
- tenantId = egDeviceMapper.sysTenantId(requestVO.getDomain());
|
|
|
+ if(StringUtils.isNotBlank(requestVO.getDeviceCode())){
|
|
|
+ LambdaQueryWrapper<EgDevice> tempQueryWrapper = new LambdaQueryWrapper<>();
|
|
|
+ tempQueryWrapper.eq(EgDevice::getDeviceCode, requestVO.getDeviceCode());
|
|
|
+ EgDevice tempDevice = egDeviceMapper.selectOne(tempQueryWrapper);
|
|
|
+ if(tempDevice == null){
|
|
|
+ // 未查询到数据,返回空数组
|
|
|
+ return new CommonPage<>(new ArrayList<>(), 0L, requestVO.getSize(), requestVO.getCurrent());
|
|
|
+ }
|
|
|
+ tenantId = tempDevice.getTenantId();
|
|
|
}else{
|
|
|
tenantId = SecurityUtils.getTenantId();
|
|
|
}
|
|
|
@@ -69,10 +81,61 @@ public class EgDeviceServiceImpl extends AbstractCrudService<EgDeviceMapper, EgD
|
|
|
.eq(null != requestVO.getServiceStatus(),EgDevice::getServiceStatus,requestVO.getServiceStatus())
|
|
|
.eq(null != requestVO.getId(),EgDevice::getId,requestVO.getId())
|
|
|
.eq(null != requestVO.getDeviceUuid(),EgDevice::getDeviceUuid, requestVO.getDeviceUuid())
|
|
|
+ .eq(StringUtils.isNotBlank(requestVO.getDeviceCode()),EgDevice::getDeviceCode, requestVO.getDeviceCode())
|
|
|
.eq(EgDevice::getTenantId,tenantId)
|
|
|
.orderByDesc(EgDevice::getId);
|
|
|
page = this.page(page,queryWrapper);
|
|
|
+
|
|
|
if(!page.getRecords().isEmpty()){
|
|
|
+ // 检查设备心跳
|
|
|
+ List<String> validDeviceCodes = new ArrayList<>();
|
|
|
+ Map<String, EgDevice> deviceCodeMap = new HashMap<>();
|
|
|
+ for (EgDevice device : page.getRecords()) {
|
|
|
+ String deviceCode = device.getDeviceCode();
|
|
|
+ if (StringUtils.isNotBlank(deviceCode)) {
|
|
|
+ validDeviceCodes.add(deviceCode);
|
|
|
+ deviceCodeMap.put(deviceCode, device);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ // 批量查询心跳数据
|
|
|
+ if (!validDeviceCodes.isEmpty()) {
|
|
|
+ LambdaQueryWrapper<EgDeviceHeartbeat> heartbeatQueryWrapper = Wrappers.lambdaQuery();
|
|
|
+ heartbeatQueryWrapper.in(EgDeviceHeartbeat::getDeviceCode, validDeviceCodes)
|
|
|
+ .orderByDesc(EgDeviceHeartbeat::getCreateTime);
|
|
|
+ List<EgDeviceHeartbeat> heartbeatList = egDeviceHeartbeatMapper.selectList(heartbeatQueryWrapper);
|
|
|
+
|
|
|
+ // 构建deviceCode到最新心跳记录的映射,并同时设置deviceStatus
|
|
|
+ Map<String, EgDeviceHeartbeat> deviceHeartbeatMap = new HashMap<>();
|
|
|
+ for (EgDeviceHeartbeat heartbeat : heartbeatList) {
|
|
|
+ String deviceCode = heartbeat.getDeviceCode();
|
|
|
+ if (StringUtils.isNotBlank(deviceCode)) {
|
|
|
+ // 如果已存在,保留最新的(因为已按createTime降序排列)
|
|
|
+ if (deviceHeartbeatMap.putIfAbsent(deviceCode, heartbeat) == null) {
|
|
|
+ // 首次遇到该deviceCode,从心跳表直接获取deviceStatus并设置到EgDevice
|
|
|
+ EgDevice device = deviceCodeMap.get(deviceCode);
|
|
|
+ if (device != null && heartbeat.getDeviceStatus() != null) {
|
|
|
+ device.setDeviceStatus(heartbeat.getDeviceStatus());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ // 如果未找到对应的设备心跳记录,则设置DeviceStatus为0(离线)
|
|
|
+ for (String deviceCode : validDeviceCodes) {
|
|
|
+ if (!deviceHeartbeatMap.containsKey(deviceCode)) {
|
|
|
+ EgDevice device = deviceCodeMap.get(deviceCode);
|
|
|
+ if (device != null) {
|
|
|
+ device.setDeviceStatus(0);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ // 如果没有有效的deviceCode,将所有设备的deviceStatus设置为0
|
|
|
+ for (EgDevice device : page.getRecords()) {
|
|
|
+ device.setDeviceStatus(0);
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
LambdaQueryWrapper<MeetingFace> meetingFaceQuery = Wrappers.lambdaQuery();
|
|
|
meetingFaceQuery.select(MeetingFace::getFid,MeetingFace::getCreateTime,MeetingFace::getVefNum,MeetingFace::getFaceName,MeetingFace::getRemark,MeetingFace::getFaceStatus,MeetingFace::getCardNum,MeetingFace::getBindDevice,MeetingFace::getDeptId,MeetingFace::getTenantId,MeetingFace::getUserId)
|
|
|
@@ -95,7 +158,6 @@ public class EgDeviceServiceImpl extends AbstractCrudService<EgDeviceMapper, EgD
|
|
|
}
|
|
|
page.getRecords().get(i).setMeetingFaceList(meetingFaceList);
|
|
|
}
|
|
|
-
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -122,7 +184,7 @@ public class EgDeviceServiceImpl extends AbstractCrudService<EgDeviceMapper, EgD
|
|
|
.like(StringUtils.isNotBlank(requestVO.getInstallAddress()),EgDevice::getInstallAddress,requestVO.getInstallAddress())
|
|
|
.eq(null != requestVO.getServiceStatus(),EgDevice::getServiceStatus,requestVO.getServiceStatus())
|
|
|
.eq(null != requestVO.getId(),EgDevice::getId,requestVO.getId())
|
|
|
- .in(EgDevice::getId,deviceFid)
|
|
|
+ .in(EgDevice::getId, (Object[]) deviceFid)
|
|
|
.eq(EgDevice::getTenantId,SecurityUtils.getTenantId())
|
|
|
.orderByDesc(EgDevice::getId);
|
|
|
page = this.page(page,queryWrapper);
|
|
|
@@ -133,32 +195,87 @@ public class EgDeviceServiceImpl extends AbstractCrudService<EgDeviceMapper, EgD
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public void add(EgDevice egDevice){
|
|
|
- if(checkNameUnique(egDevice)){
|
|
|
- throw new BusinessException("新增门禁门号设备'"+egDevice.getDeviceId()+","+egDevice.getEgNumber()+"'失败,设备已存在");
|
|
|
+ public void add(EgDevice egDevice) {
|
|
|
+ LocalDateTime now = LocalDateTime.now();
|
|
|
+
|
|
|
+ // 1. 校验设备名称唯一性
|
|
|
+ if (checkDeviceNameUnique(egDevice)) {
|
|
|
+ throw new BusinessException("新增门禁设备'" + egDevice.getDeviceName() + "'失败,设备已存在");
|
|
|
}
|
|
|
- if(checkDeviceNameUnique(egDevice)){
|
|
|
- throw new BusinessException("新增门禁设备'"+egDevice.getDeviceName()+"'失败,设备已存在");
|
|
|
+
|
|
|
+ // 2. 通过IP校验心跳表,确保设备在线且心跳时间在5分钟内
|
|
|
+ String deviceIp = egDevice.getDeviceIp();
|
|
|
+ if (StringUtils.isNotBlank(deviceIp)) {
|
|
|
+ LambdaQueryWrapper<EgDeviceHeartbeat> heartbeatWrapper = Wrappers.lambdaQuery();
|
|
|
+ heartbeatWrapper.eq(EgDeviceHeartbeat::getIpAddr, deviceIp)
|
|
|
+ .orderByDesc(EgDeviceHeartbeat::getCreateTime)
|
|
|
+ .last("LIMIT 1");
|
|
|
+ EgDeviceHeartbeat heartbeat = egDeviceHeartbeatMapper.selectOne(heartbeatWrapper);
|
|
|
+
|
|
|
+ // 校验心跳记录存在且时间在5分钟内
|
|
|
+ if (heartbeat == null || heartbeat.getCreateTime() == null
|
|
|
+ || !heartbeat.getCreateTime().isAfter(now.minusMinutes(5))) {
|
|
|
+ throw new BusinessException("设备不在线,请检查设备网络是否正常!");
|
|
|
+ }
|
|
|
+
|
|
|
+ // 设置设备编码并校验唯一性
|
|
|
+ String deviceCode = heartbeat.getDeviceCode();
|
|
|
+ egDevice.setDeviceCode(deviceCode);
|
|
|
+
|
|
|
+ if (StringUtils.isNotBlank(deviceCode)) {
|
|
|
+ LambdaQueryWrapper<EgDevice> codeCheckWrapper = Wrappers.lambdaQuery();
|
|
|
+ codeCheckWrapper.eq(EgDevice::getDeviceCode, deviceCode)
|
|
|
+ .eq(EgDevice::getTenantId, SecurityUtils.getTenantId());
|
|
|
+ EgDevice existingDevice = this.getOne(codeCheckWrapper);
|
|
|
+ if (existingDevice != null) {
|
|
|
+ throw new BusinessException("设备已被设备'" + existingDevice.getDeviceName()
|
|
|
+ + "'注册使用,请检查设备配置或更换设备IP!");
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
+ // 3. 设置设备基本信息
|
|
|
egDevice.setDeviceUuid(UUIDUtils.uuid());
|
|
|
egDevice.setCreateBy(SecurityUtils.getUsername());
|
|
|
- egDevice.setCreateTime(LocalDateTime.now());
|
|
|
+ egDevice.setCreateTime(now);
|
|
|
egDevice.setTenantId(SecurityUtils.getTenantId());
|
|
|
+ egDevice.setOpenMode("人脸");
|
|
|
+ egDevice.setWorkStatus("4");
|
|
|
|
|
|
+ // 4. 保存设备
|
|
|
this.save(egDevice);
|
|
|
|
|
|
- String[] fids = new String[0];
|
|
|
- if(Objects.nonNull(egDevice.getBindFace()) || StringUtils.isNotBlank(egDevice.getBindFace())){
|
|
|
- fids = egDevice.getBindFace().split(",");
|
|
|
- }
|
|
|
- if(fids.length > 0){
|
|
|
- for (int i = 0; i < fids.length; i++) {
|
|
|
- egDeviceMapper.insertMeetingFaceDevice(Integer.parseInt(fids[i]),egDevice.getId());
|
|
|
+ // 5. 处理绑定人脸信息
|
|
|
+ String bindFace = egDevice.getBindFace();
|
|
|
+ if (StringUtils.isNotBlank(bindFace)) {
|
|
|
+ String[] fids = bindFace.split(",");
|
|
|
+ for (String fid : fids) {
|
|
|
+ if (StringUtils.isNotBlank(fid)) {
|
|
|
+ egDeviceMapper.insertMeetingFaceDevice(Integer.parseInt(fid.trim()), egDevice.getId());
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- remoteIotTaskService.addDeviceInfo("502_USKY", egDevice.getDeviceUuid(),egDevice.getDeviceId()+egDevice.getEgNumber(),egDevice.getDeviceName(),egDevice.getInstallAddress(),egDevice.getServiceStatus());
|
|
|
+ // 6. 异步调用远程服务添加设备信息,静默处理异常,不影响设备保存成功
|
|
|
+ String deviceUuid = egDevice.getDeviceUuid();
|
|
|
+ String deviceName = egDevice.getDeviceName();
|
|
|
+ if (StringUtils.isNotBlank(deviceUuid) && StringUtils.isNotBlank(deviceName)) {
|
|
|
+ String installAddress = StringUtils.isNotBlank(egDevice.getInstallAddress())
|
|
|
+ ? egDevice.getInstallAddress()
|
|
|
+ : "";
|
|
|
+ Integer serviceStatus = egDevice.getServiceStatus() != null
|
|
|
+ ? egDevice.getServiceStatus()
|
|
|
+ : 1;
|
|
|
+
|
|
|
+ CompletableFuture.runAsync(() -> {
|
|
|
+ try {
|
|
|
+ remoteIotTaskService.addDeviceInfo("502_USKY", deviceUuid, deviceUuid,
|
|
|
+ deviceName, installAddress, serviceStatus);
|
|
|
+ } catch (Exception e) {
|
|
|
+ // 远程服务调用失败,静默处理,不影响设备保存成功
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
@@ -179,14 +296,46 @@ public class EgDeviceServiceImpl extends AbstractCrudService<EgDeviceMapper, EgD
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-
|
|
|
- if(checkNameUnique(egDevice)){
|
|
|
- throw new BusinessException("修改门禁门号设备'"+egDevice.getDeviceId()+","+egDevice.getEgNumber()+"'失败,设备已存在");
|
|
|
- }
|
|
|
if(checkDeviceNameUnique(egDevice)){
|
|
|
throw new BusinessException("新增门禁设备'"+egDevice.getDeviceName()+"'失败,设备已存在");
|
|
|
}
|
|
|
|
|
|
+ // 通过IP校验心跳表中的IP是否一致并且心跳时间必须在五分钟之内
|
|
|
+ if(StringUtils.isNotBlank(egDevice.getDeviceIp())){
|
|
|
+ LambdaQueryWrapper<EgDeviceHeartbeat> heartbeatQueryWrapper = Wrappers.lambdaQuery();
|
|
|
+ heartbeatQueryWrapper.eq(EgDeviceHeartbeat::getIpAddr, egDevice.getDeviceIp())
|
|
|
+ .orderByDesc(EgDeviceHeartbeat::getCreateTime)
|
|
|
+ .last("LIMIT 1");
|
|
|
+ EgDeviceHeartbeat heartbeat = egDeviceHeartbeatMapper.selectOne(heartbeatQueryWrapper);
|
|
|
+
|
|
|
+ // 如果找不到心跳记录,抛出异常
|
|
|
+ if(heartbeat == null){
|
|
|
+ throw new BusinessException("设备不在线,请检查设备网络是否正常!");
|
|
|
+ }
|
|
|
+
|
|
|
+ // 检查心跳时间是否在5分钟内
|
|
|
+ LocalDateTime now = LocalDateTime.now();
|
|
|
+ LocalDateTime heartbeatTime = heartbeat.getCreateTime();
|
|
|
+ if(heartbeatTime == null || !heartbeatTime.isAfter(now.minusMinutes(5))){
|
|
|
+ throw new BusinessException("设备不在线,请检查设备网络是否正常!");
|
|
|
+ }
|
|
|
+
|
|
|
+ // 校验通过
|
|
|
+ egDevice.setDeviceCode(heartbeat.getDeviceCode());
|
|
|
+
|
|
|
+ // 校验DeviceCode是否已经被其他设备使用(排除当前设备自己)
|
|
|
+ if(StringUtils.isNotBlank(egDevice.getDeviceCode())){
|
|
|
+ LambdaQueryWrapper<EgDevice> deviceCodeCheckQueryWrapper = Wrappers.lambdaQuery();
|
|
|
+ deviceCodeCheckQueryWrapper.eq(EgDevice::getDeviceCode, egDevice.getDeviceCode())
|
|
|
+ .eq(EgDevice::getTenantId, SecurityUtils.getTenantId())
|
|
|
+ .ne(EgDevice::getId, egDevice.getId());
|
|
|
+ EgDevice existingDevice = this.getOne(deviceCodeCheckQueryWrapper);
|
|
|
+ if(existingDevice != null){
|
|
|
+ throw new BusinessException("设备编码'" + egDevice.getDeviceCode() + "'已被设备'" + existingDevice.getDeviceName() + "'使用,请检查设备配置");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
egDevice.setUpdateBy(SecurityUtils.getUsername());
|
|
|
egDevice.setUpdateTime(LocalDateTime.now());
|
|
|
|
|
|
@@ -199,9 +348,7 @@ public class EgDeviceServiceImpl extends AbstractCrudService<EgDeviceMapper, EgD
|
|
|
EgDevice one = this.getById(egDevice.getId());
|
|
|
egDevice.setBindFace(one.getBindFace());
|
|
|
|
|
|
- if(checkNameUnique(egDevice)){
|
|
|
- throw new BusinessException("更新门禁设备附加功能'"+egDevice.getDeviceId()+"'失败,设备已存在");
|
|
|
- }
|
|
|
+
|
|
|
if(checkDeviceNameUnique(egDevice)){
|
|
|
throw new BusinessException("新增门禁设备'"+egDevice.getDeviceName()+"'失败,设备已存在");
|
|
|
}
|
|
|
@@ -226,7 +373,17 @@ public class EgDeviceServiceImpl extends AbstractCrudService<EgDeviceMapper, EgD
|
|
|
|
|
|
this.removeById(id);
|
|
|
|
|
|
- remoteIotTaskService.deleteDeviceInfo(egDevice.getDeviceUuid());
|
|
|
+ // 异步调用远程服务删除设备信息,静默处理异常,不影响设备删除
|
|
|
+ String deviceUuid = egDevice.getDeviceUuid();
|
|
|
+ if (StringUtils.isNotBlank(deviceUuid)) {
|
|
|
+ CompletableFuture.runAsync(() -> {
|
|
|
+ try {
|
|
|
+ remoteIotTaskService.deleteDeviceInfo(deviceUuid);
|
|
|
+ } catch (Exception e) {
|
|
|
+ // 远程服务调用失败,静默处理,不影响设备删除
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
@@ -234,7 +391,6 @@ public class EgDeviceServiceImpl extends AbstractCrudService<EgDeviceMapper, EgD
|
|
|
Integer id = null == egDevice.getId() ? -1 : egDevice.getId();
|
|
|
LambdaQueryWrapper<EgDevice> queryWrapper = Wrappers.lambdaQuery();
|
|
|
queryWrapper.eq(EgDevice::getDeviceId,egDevice.getDeviceId())
|
|
|
- .eq(EgDevice::getEgNumber,egDevice.getEgNumber())
|
|
|
.eq(EgDevice::getTenantId, SecurityUtils.getTenantId());
|
|
|
EgDevice one = this.getOne(queryWrapper);
|
|
|
return null != one && !Objects.equals(one.getId(),id);
|
|
|
@@ -255,10 +411,21 @@ public class EgDeviceServiceImpl extends AbstractCrudService<EgDeviceMapper, EgD
|
|
|
Integer tenantId;
|
|
|
long commandUserId;
|
|
|
String commandUserName;
|
|
|
- if(StringUtils.isNotBlank(domain)){
|
|
|
- tenantId = baseMapper.sysTenantId(domain);
|
|
|
- commandUserId = userId;
|
|
|
- commandUserName = userName;
|
|
|
+ EgDevice device = null;
|
|
|
+
|
|
|
+ // 通过deviceUuid查询设备获取tenantId
|
|
|
+ if(StringUtils.isNotBlank(deviceUuid)){
|
|
|
+ LambdaQueryWrapper<EgDevice> deviceQueryWrapper = Wrappers.lambdaQuery();
|
|
|
+ deviceQueryWrapper.select(EgDevice::getId, EgDevice::getTenantId)
|
|
|
+ .eq(EgDevice::getDeviceUuid, deviceUuid);
|
|
|
+ device = this.getOne(deviceQueryWrapper);
|
|
|
+ if(device != null){
|
|
|
+ tenantId = device.getTenantId();
|
|
|
+ commandUserId = userId;
|
|
|
+ commandUserName = userName;
|
|
|
+ }else{
|
|
|
+ throw new BusinessException("设备未注册,请先注册");
|
|
|
+ }
|
|
|
}else{
|
|
|
tenantId = SecurityUtils.getTenantId();
|
|
|
commandUserId = SecurityUtils.getUserId();
|
|
|
@@ -266,29 +433,22 @@ public class EgDeviceServiceImpl extends AbstractCrudService<EgDeviceMapper, EgD
|
|
|
}
|
|
|
|
|
|
//人员设备权限校验,校验通过,可以下发命令控制设备
|
|
|
- Integer fid = baseMapper.getMeetingFaceData(commandUserId);
|
|
|
- if(fid == null){
|
|
|
- throw new BusinessException("人脸卡号信息未注册");
|
|
|
- }
|
|
|
- Integer[] deviceFid = baseMapper.getMeetingFaceDeviceList(fid);
|
|
|
- if(deviceFid.length == 0){
|
|
|
- throw new BusinessException("人员未绑定设备,请检查");
|
|
|
- }
|
|
|
-
|
|
|
- LambdaQueryWrapper<EgDevice> queryWrapper = Wrappers.lambdaQuery();
|
|
|
- queryWrapper.select(EgDevice::getId)
|
|
|
- .eq(EgDevice::getDeviceUuid,deviceUuid);
|
|
|
- EgDevice one = this.getOne(queryWrapper);
|
|
|
- if(one != null){
|
|
|
- boolean exist = Arrays.asList(deviceFid).contains(one.getId());
|
|
|
+ if(device != null){
|
|
|
+ Integer fid = baseMapper.getMeetingFaceData(commandUserId);
|
|
|
+ if(fid == null){
|
|
|
+ throw new BusinessException("人脸卡号信息未注册");
|
|
|
+ }
|
|
|
+ Integer[] deviceFid = baseMapper.getMeetingFaceDeviceList(fid);
|
|
|
+ if(deviceFid.length == 0){
|
|
|
+ throw new BusinessException("人员未绑定设备,请检查");
|
|
|
+ }
|
|
|
+
|
|
|
+ boolean exist = Arrays.asList(deviceFid).contains(device.getId());
|
|
|
if(!exist){
|
|
|
throw new BusinessException("暂无权限");
|
|
|
}
|
|
|
- }else{
|
|
|
- throw new BusinessException("设备未注册,请先注册");
|
|
|
}
|
|
|
|
|
|
-
|
|
|
Map<String,Object> map = new HashMap<>();
|
|
|
map.put("method","control");
|
|
|
map.put("deviceUuid", deviceUuid);
|