1
0

设备mqtt收发数据

This commit is contained in:
2025-07-30 17:13:57 +08:00
parent ac353b1078
commit a119ccc8d6
13 changed files with 238 additions and 115 deletions

View File

@ -10,6 +10,7 @@ import com.fuyuanshen.app.domain.AppPersonnelInfo;
import com.fuyuanshen.app.domain.bo.AppPersonnelInfoBo;
import com.fuyuanshen.app.domain.dto.APPReNameDTO;
import com.fuyuanshen.app.domain.dto.AppDeviceLogoUploadDto;
import com.fuyuanshen.app.domain.dto.DeviceInstructDto;
import com.fuyuanshen.app.domain.vo.APPDeviceTypeVo;
import com.fuyuanshen.app.domain.vo.AppDeviceBindRecordVo;
import com.fuyuanshen.app.domain.vo.AppDeviceDetailVo;
@ -17,7 +18,6 @@ import com.fuyuanshen.app.domain.vo.AppPersonnelInfoVo;
import com.fuyuanshen.app.mapper.AppDeviceBindRecordMapper;
import com.fuyuanshen.app.mapper.AppPersonnelInfoMapper;
import com.fuyuanshen.app.mapper.equipment.APPDeviceMapper;
import com.fuyuanshen.common.core.domain.R;
import com.fuyuanshen.common.core.exception.ServiceException;
import com.fuyuanshen.common.core.utils.ImageToCArrayConverter;
import com.fuyuanshen.common.core.utils.MapstructUtils;
@ -384,14 +384,14 @@ public class AppDeviceBizService {
* 灯光模式
* 0关灯1强光模式2弱光模式, 3爆闪模式, 4泛光模式
*/
public void lightModeSettings(JSONObject params) {
public void lightModeSettings(DeviceInstructDto params) {
try {
Long deviceId = params.getLong("deviceId");
Long deviceId = params.getDeviceId();
Device device = deviceMapper.selectById(deviceId);
if(device == null){
throw new ServiceException("设备不存在");
}
Integer instructValue = params.getInteger("instructValue");
Integer instructValue = (Integer) params.getInstructValue();
ArrayList<Integer> intData = new ArrayList<>();
intData.add(1);
intData.add(instructValue);
@ -408,14 +408,14 @@ public class AppDeviceBizService {
}
//灯光亮度设置
public void lightBrightnessSettings(JSONObject params) {
public void lightBrightnessSettings(DeviceInstructDto params) {
try {
Long deviceId = params.getLong("deviceId");
Long deviceId = params.getDeviceId();
Device device = deviceMapper.selectById(deviceId);
if(device == null){
throw new ServiceException("设备不存在");
}
String instructValue = params.getString("instructValue");
String instructValue = (String)params.getInstructValue();
ArrayList<Integer> intData = new ArrayList<>();
intData.add(5);
String[] values = instructValue.split("\\.");
@ -440,14 +440,14 @@ public class AppDeviceBizService {
}
//激光模式设置
public void laserModeSettings(JSONObject params) {
public void laserModeSettings(DeviceInstructDto params) {
try {
Long deviceId = params.getLong("deviceId");
Long deviceId = params.getDeviceId();
Device device = deviceMapper.selectById(deviceId);
if(device == null){
throw new ServiceException("设备不存在");
}
Integer instructValue = params.getInteger("instructValue");
Integer instructValue = (Integer) params.getInstructValue();
ArrayList<Integer> intData = new ArrayList<>();
intData.add(4);
intData.add(instructValue);
@ -463,12 +463,15 @@ public class AppDeviceBizService {
}
}
public String mapReverseGeocoding(JSONObject params) {
Long deviceId = params.getLong("deviceId");
Device device = deviceMapper.selectById(deviceId);
if(device == null){
public String mapReverseGeocoding(DeviceInstructDto params) {
// Long deviceId = params.getDeviceId();
// Device device = deviceMapper.selectById(deviceId);
QueryWrapper<Device> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("device_imei", params.getDeviceImei());
List<Device> devices = deviceMapper.selectList(queryWrapper);
if(ObjectUtils.length( devices) ==0){
throw new ServiceException("设备不存在");
}
return RedisUtils.getCacheObject("device:location:" + device.getDeviceImei());
return RedisUtils.getCacheObject("device:location:" + devices.get(0).getDeviceImei());
}
}