修复bug
This commit is contained in:
@ -450,8 +450,9 @@ public class AudioProcessService {
|
|||||||
throw new IllegalArgumentException("只允许上传MP3、WAV、PCM格式的音频文件");
|
throw new IllegalArgumentException("只允许上传MP3、WAV、PCM格式的音频文件");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
long fileSize = 256 * 1024;
|
||||||
// 检查文件大小
|
// 检查文件大小
|
||||||
if (file.getSize() > MAX_AUDIO_SIZE) {
|
if (file.getSize() > fileSize) {
|
||||||
throw new IllegalArgumentException("音频大小不能超过5MB");
|
throw new IllegalArgumentException("音频大小不能超过5MB");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -7,4 +7,8 @@ public class HBY100JUpdateVoiceDto {
|
|||||||
|
|
||||||
private Long id;
|
private Long id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 通讯方式 0:4G;1:蓝牙
|
||||||
|
*/
|
||||||
|
private Integer communicationMode;
|
||||||
}
|
}
|
||||||
@ -271,12 +271,12 @@ public class DeviceBizService {
|
|||||||
if (type == 0) {
|
if (type == 0) {
|
||||||
QueryWrapper<AppDeviceBindRecord> bindRecordQueryWrapper = new QueryWrapper<>();
|
QueryWrapper<AppDeviceBindRecord> bindRecordQueryWrapper = new QueryWrapper<>();
|
||||||
bindRecordQueryWrapper.eq("device_id", device.getId());
|
bindRecordQueryWrapper.eq("device_id", device.getId());
|
||||||
bindRecordQueryWrapper.eq("binding_user_id", userId);
|
// bindRecordQueryWrapper.eq("binding_user_id", userId);
|
||||||
Long count = appDeviceBindRecordMapper.selectCount(bindRecordQueryWrapper);
|
Long count = appDeviceBindRecordMapper.selectCount(bindRecordQueryWrapper);
|
||||||
if (count == 0) {
|
if (count == 0) {
|
||||||
throw new RuntimeException("请先绑定设备!!!");
|
throw new RuntimeException("请先绑定设备!!!");
|
||||||
}
|
}
|
||||||
if (count < 2) {
|
if (count <= 1) {
|
||||||
UpdateWrapper<Device> deviceUpdateWrapper = new UpdateWrapper<>();
|
UpdateWrapper<Device> deviceUpdateWrapper = new UpdateWrapper<>();
|
||||||
deviceUpdateWrapper.eq("id", device.getId())
|
deviceUpdateWrapper.eq("id", device.getId())
|
||||||
.set("binding_user_id", null)
|
.set("binding_user_id", null)
|
||||||
|
|||||||
@ -285,21 +285,22 @@ public class DeviceHBY100JBizService {
|
|||||||
if (getDeviceStatus(deviceObj.getDeviceImei())) {
|
if (getDeviceStatus(deviceObj.getDeviceImei())) {
|
||||||
throw new ServiceException(deviceObj.getDeviceName() + ",设备已断开连接");
|
throw new ServiceException(deviceObj.getDeviceName() + ",设备已断开连接");
|
||||||
}
|
}
|
||||||
|
|
||||||
AppLoginUser loginUser = AppLoginHelper.getLoginUser();
|
AppLoginUser loginUser = AppLoginHelper.getLoginUser();
|
||||||
SysOssVo sysOssVo = sysOssMapper.selectVoById(appBusinessFileVo.getFileId());
|
if(dto.getCommunicationMode()!=null && dto.getCommunicationMode()==0){
|
||||||
FuncType5UpdateVoiceRequest request = new FuncType5UpdateVoiceRequest();
|
SysOssVo sysOssVo = sysOssMapper.selectVoById(appBusinessFileVo.getFileId());
|
||||||
request.setRequestId(GenerateIdUtil.generateNumericId());
|
FuncType5UpdateVoiceRequest request = new FuncType5UpdateVoiceRequest();
|
||||||
request.setImei(deviceObj.getDeviceImei());
|
request.setRequestId(GenerateIdUtil.generateNumericId());
|
||||||
request.setFuncType("5");
|
request.setImei(deviceObj.getDeviceImei());
|
||||||
request.setTimestamp(System.currentTimeMillis());
|
request.setFuncType("5");
|
||||||
FuncType5UpdateVoiceRequest.Data data = new FuncType5UpdateVoiceRequest.Data();
|
request.setTimestamp(System.currentTimeMillis());
|
||||||
data.setVoiceResource(sysOssVo.getUrl());
|
FuncType5UpdateVoiceRequest.Data data = new FuncType5UpdateVoiceRequest.Data();
|
||||||
data.setVoiceType(0);
|
data.setVoiceResource(sysOssVo.getUrl());
|
||||||
request.setData(data);
|
data.setVoiceType(0);
|
||||||
log.info("HBY100J更新语音,参数:{}", request);
|
request.setData(data);
|
||||||
|
log.info("HBY100J更新语音,参数:{}", request);
|
||||||
|
|
||||||
mqttGateway.sendMsgToMqtt(buildMqttTopic(deviceObj.getDeviceImei()), 1, JSON.toJSONString(request));
|
mqttGateway.sendMsgToMqtt(buildMqttTopic(deviceObj.getDeviceImei()), 1, JSON.toJSONString(request));
|
||||||
|
}
|
||||||
|
|
||||||
UpdateWrapper<AppBusinessFile> updateWrapper = new UpdateWrapper<>();
|
UpdateWrapper<AppBusinessFile> updateWrapper = new UpdateWrapper<>();
|
||||||
updateWrapper.eq("business_id", appBusinessFileVo.getBusinessId());
|
updateWrapper.eq("business_id", appBusinessFileVo.getBusinessId());
|
||||||
|
|||||||
Reference in New Issue
Block a user