forked from dyf/fys-Multi-tenant
hby100japp功能3
This commit is contained in:
@ -97,6 +97,7 @@ public class DeviceBizService {
|
||||
} else {
|
||||
item.setOnlineStatus(0);
|
||||
}
|
||||
|
||||
String deviceStatus = RedisUtils.getCacheObject(GLOBAL_REDIS_KEY + DEVICE_KEY_PREFIX + item.getDeviceImei() + DEVICE_STATUS_KEY_PREFIX);
|
||||
// 获取电量
|
||||
if (StringUtils.isNotBlank(deviceStatus)) {
|
||||
|
||||
@ -130,17 +130,21 @@ public class DeviceHBY100JBizService {
|
||||
} else {
|
||||
vo.setOnlineStatus(0);
|
||||
}
|
||||
|
||||
String deviceStatus = RedisUtils.getCacheObject(GLOBAL_REDIS_KEY + DEVICE_KEY_PREFIX + device.getDeviceImei() + DeviceRedisKeyConstants.DEVICE_STATUS_KEY_PREFIX);
|
||||
// 获取电量
|
||||
if (StringUtils.isNotBlank(deviceStatus)) {
|
||||
JSONObject jsonObject = JSONObject.parseObject(deviceStatus);
|
||||
vo.setBatteryPercentage(jsonObject.getString("level"));
|
||||
vo.setChargeState(jsonObject.getString("charge"));
|
||||
vo.setBatteryPercentage(jsonObject.getInteger("batteryPercentage"));
|
||||
vo.setChargeState(jsonObject.getInteger("chargeState"));
|
||||
vo.setBatteryRemainingTime(jsonObject.getInteger("batteryRemainingTime"));
|
||||
} else {
|
||||
vo.setBatteryPercentage("0");
|
||||
vo.setBatteryPercentage(0);
|
||||
vo.setBatteryRemainingTime(0);
|
||||
}
|
||||
|
||||
|
||||
|
||||
String reportStatus = RedisUtils.getCacheObject(GLOBAL_REDIS_KEY + DEVICE_KEY_PREFIX + device.getDeviceImei() + ":report");
|
||||
if (StringUtils.isNotBlank(reportStatus)) {
|
||||
FuncType14StatusReport report = JSONObject.parseObject(reportStatus,FuncType14StatusReport.class);
|
||||
@ -160,33 +164,26 @@ public class DeviceHBY100JBizService {
|
||||
|
||||
|
||||
Integer voiceBroadcast = data.getVoiceBroadcast();
|
||||
if(voiceBroadcast != null && voiceBroadcast == 1){
|
||||
vo.setAlarmMode(9);
|
||||
vo.setVoiceStrobeAlarm(1);
|
||||
}else {
|
||||
FuncType14StatusReport.SirenAlarm sirenAlarm = data.getSirenAlarm();
|
||||
if(sirenAlarm != null){
|
||||
vo.setVoiceStrobeAlarm(sirenAlarm.getEnable());
|
||||
vo.setAlarmMode(sirenAlarm.getMode());
|
||||
}
|
||||
if(voiceBroadcast != null){
|
||||
vo.setVoiceBroadcast(voiceBroadcast);
|
||||
}
|
||||
FuncType14StatusReport.SirenAlarm sirenAlarm = data.getSirenAlarm();
|
||||
if(sirenAlarm != null){
|
||||
vo.setVoiceStrobeAlarm(sirenAlarm.getEnable());
|
||||
vo.setAlarmMode(sirenAlarm.getMode());
|
||||
}
|
||||
}
|
||||
|
||||
// 获取经度纬度
|
||||
String locationKey = GlobalConstants.GLOBAL_REDIS_KEY + DEVICE_KEY_PREFIX + device.getDeviceImei() + DeviceRedisKeyConstants.DEVICE_LOCATION_KEY_PREFIX;
|
||||
String locationInfo = RedisUtils.getCacheObject(locationKey);
|
||||
if (StringUtils.isNotBlank(locationInfo)) {
|
||||
FunctionType3LocationReport locationReport = JSONObject.parseObject(locationInfo,FunctionType3LocationReport.class);
|
||||
if(locationReport != null){
|
||||
FunctionType3LocationReport.Data data = locationReport.getData();
|
||||
if(data != null){
|
||||
vo.setLongitude(data.getLongitude().toString());
|
||||
vo.setLatitude(data.getLatitude().toString());
|
||||
vo.setAddress(data.getAddress());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
String location = RedisUtils.getCacheObject(GLOBAL_REDIS_KEY + DEVICE_KEY_PREFIX + device.getDeviceImei() + DEVICE_LOCATION_KEY_PREFIX);
|
||||
if (StringUtils.isNotBlank(location)) {
|
||||
JSONObject jsonObject = JSONObject.parseObject(location);
|
||||
vo.setLatitude(jsonObject.getString("latitude"));
|
||||
vo.setLongitude(jsonObject.getString("longitude"));
|
||||
vo.setAddress(jsonObject.getString("address"));
|
||||
}
|
||||
|
||||
QueryWrapper<AppBusinessFile> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.eq("business_id", device.getId());
|
||||
queryWrapper.eq("file_type", 3);
|
||||
@ -217,9 +214,9 @@ public class DeviceHBY100JBizService {
|
||||
LoginUser loginUser = LoginHelper.getLoginUser();
|
||||
bo.getDeviceIds().forEach(deviceId -> {
|
||||
Device deviceObj = deviceMapper.selectById(deviceId);
|
||||
// if (getDeviceStatus(deviceObj.getDeviceImei())) {
|
||||
// throw new ServiceException(deviceObj.getDeviceName() + ",设备已断开连接");
|
||||
// }
|
||||
if (getDeviceStatus(deviceObj.getDeviceImei())) {
|
||||
throw new ServiceException(deviceObj.getDeviceName() + ",设备已断开连接");
|
||||
}
|
||||
|
||||
FuncType12ForceAudioRequest request = new FuncType12ForceAudioRequest();
|
||||
request.setRequestId(GenerateIdUtil.generateNumericId());
|
||||
@ -245,9 +242,9 @@ public class DeviceHBY100JBizService {
|
||||
throw new ServiceException("文件不存在");
|
||||
}
|
||||
Device deviceObj = deviceMapper.selectById(appBusinessFileVo.getBusinessId());
|
||||
// if (getDeviceStatus(deviceObj.getDeviceImei())) {
|
||||
// throw new ServiceException(deviceObj.getDeviceName() + ",设备已断开连接");
|
||||
// }
|
||||
if (getDeviceStatus(deviceObj.getDeviceImei())) {
|
||||
throw new ServiceException(deviceObj.getDeviceName() + ",设备已断开连接");
|
||||
}
|
||||
|
||||
LoginUser loginUser = LoginHelper.getLoginUser();
|
||||
SysOssVo sysOssVo = sysOssMapper.selectVoById(appBusinessFileVo.getFileId());
|
||||
@ -282,9 +279,9 @@ public class DeviceHBY100JBizService {
|
||||
|
||||
public void strobeMode(AppDeviceHBY100JController.HBY100JStrobeModeDto params) {
|
||||
Device deviceObj = deviceMapper.selectById(params.getDeviceId());
|
||||
// if (getDeviceStatus(deviceObj.getDeviceImei())) {
|
||||
// throw new ServiceException(deviceObj.getDeviceName() + ",设备已断开连接");
|
||||
// }
|
||||
if (getDeviceStatus(deviceObj.getDeviceImei())) {
|
||||
throw new ServiceException(deviceObj.getDeviceName() + ",设备已断开连接");
|
||||
}
|
||||
FuncType10StrobeModeRequest request = new FuncType10StrobeModeRequest();
|
||||
request.setRequestId(GenerateIdUtil.generateNumericId());
|
||||
request.setImei(deviceObj.getDeviceImei());
|
||||
@ -301,9 +298,12 @@ public class DeviceHBY100JBizService {
|
||||
public void lightAdjustment(AppDeviceHBY100JController.HBY100JLightAdjustmentDto params) {
|
||||
log.info("HBY100J灯光调节,请求参数:{}", params);
|
||||
Device deviceObj = deviceMapper.selectById(params.getDeviceId());
|
||||
// if (getDeviceStatus(deviceObj.getDeviceImei())) {
|
||||
// throw new ServiceException(deviceObj.getDeviceName() + ",设备已断开连接");
|
||||
// }
|
||||
if (deviceObj == null) {
|
||||
throw new ServiceException("设备不存在");
|
||||
}
|
||||
if (getDeviceStatus(deviceObj.getDeviceImei())) {
|
||||
throw new ServiceException(deviceObj.getDeviceName() + ",设备已断开连接");
|
||||
}
|
||||
FuncType13BrightnessRequest request = new FuncType13BrightnessRequest();
|
||||
request.setRequestId(GenerateIdUtil.generateNumericId());
|
||||
request.setImei(deviceObj.getDeviceImei());
|
||||
@ -320,9 +320,12 @@ public class DeviceHBY100JBizService {
|
||||
|
||||
public void strobeFrequency(AppDeviceHBY100JController.HBY100JStrobeFrequencyDto params) {
|
||||
Device deviceObj = deviceMapper.selectById(params.getDeviceId());
|
||||
// if (getDeviceStatus(deviceObj.getDeviceImei())) {
|
||||
// throw new ServiceException(deviceObj.getDeviceName() + ",设备已断开连接");
|
||||
// }
|
||||
if (deviceObj == null) {
|
||||
throw new ServiceException("设备不存在");
|
||||
}
|
||||
if (getDeviceStatus(deviceObj.getDeviceImei())) {
|
||||
throw new ServiceException(deviceObj.getDeviceName() + ",设备已断开连接");
|
||||
}
|
||||
FuncType11FrequencyRequest request = new FuncType11FrequencyRequest();
|
||||
request.setRequestId(GenerateIdUtil.generateNumericId());
|
||||
request.setImei(deviceObj.getDeviceImei());
|
||||
@ -337,9 +340,12 @@ public class DeviceHBY100JBizService {
|
||||
|
||||
public void updateVolume(AppDeviceHBY100JController.HBY100JUpdateVolumeDto params) {
|
||||
Device deviceObj = deviceMapper.selectById(params.getDeviceId());
|
||||
// if (getDeviceStatus(deviceObj.getDeviceImei())) {
|
||||
// throw new ServiceException(deviceObj.getDeviceName() + ",设备已断开连接");
|
||||
// }
|
||||
if (deviceObj == null) {
|
||||
throw new ServiceException("设备不存在");
|
||||
}
|
||||
if (getDeviceStatus(deviceObj.getDeviceImei())) {
|
||||
throw new ServiceException(deviceObj.getDeviceName() + ",设备已断开连接");
|
||||
}
|
||||
FuncType9UpdateVolumeRequest request = new FuncType9UpdateVolumeRequest();
|
||||
request.setRequestId(GenerateIdUtil.generateNumericId());
|
||||
request.setImei(deviceObj.getDeviceImei());
|
||||
@ -354,6 +360,12 @@ public class DeviceHBY100JBizService {
|
||||
|
||||
public void voiceBroadcast(AppDeviceHBY100JController.HBY100JVoiceBroadcastDto params) {
|
||||
Device deviceObj = deviceMapper.selectById(params.getDeviceId());
|
||||
if (deviceObj == null) {
|
||||
throw new ServiceException("设备不存在");
|
||||
}
|
||||
if (getDeviceStatus(deviceObj.getDeviceImei())) {
|
||||
throw new ServiceException(deviceObj.getDeviceName() + ",设备已断开连接");
|
||||
}
|
||||
FuncType6VoicePlayRequest request = new FuncType6VoicePlayRequest();
|
||||
request.setRequestId(GenerateIdUtil.generateNumericId());
|
||||
request.setImei(deviceObj.getDeviceImei());
|
||||
|
||||
Reference in New Issue
Block a user