diff --git a/fys-admin/src/main/java/com/fuyuanshen/app/controller/AppVideoController.java b/fys-admin/src/main/java/com/fuyuanshen/app/controller/AppVideoController.java index ba6a5dc3..2c186f67 100644 --- a/fys-admin/src/main/java/com/fuyuanshen/app/controller/AppVideoController.java +++ b/fys-admin/src/main/java/com/fuyuanshen/app/controller/AppVideoController.java @@ -131,8 +131,8 @@ public class AppVideoController extends BaseController { * 删除语音文件 */ @GetMapping("/deleteAudioFile") - public R deleteAudioFile(Long fileId,Long deviceId) { - return audioProcessService.deleteAudioFile(fileId,deviceId); + public R deleteAudioFile(Long id) { + return audioProcessService.deleteAudioFile(id); } /** diff --git a/fys-admin/src/main/java/com/fuyuanshen/app/domain/dto/AppFileRenameDto.java b/fys-admin/src/main/java/com/fuyuanshen/app/domain/dto/AppFileRenameDto.java index a1cdd3ed..a9621a57 100644 --- a/fys-admin/src/main/java/com/fuyuanshen/app/domain/dto/AppFileRenameDto.java +++ b/fys-admin/src/main/java/com/fuyuanshen/app/domain/dto/AppFileRenameDto.java @@ -6,6 +6,8 @@ import org.springframework.web.multipart.MultipartFile; @Data public class AppFileRenameDto { + private Long id; + /** * 文件id */ diff --git a/fys-admin/src/main/java/com/fuyuanshen/app/service/AudioProcessService.java b/fys-admin/src/main/java/com/fuyuanshen/app/service/AudioProcessService.java index 832dd4d6..9b0916c2 100644 --- a/fys-admin/src/main/java/com/fuyuanshen/app/service/AudioProcessService.java +++ b/fys-admin/src/main/java/com/fuyuanshen/app/service/AudioProcessService.java @@ -414,19 +414,18 @@ public class AudioProcessService { } private Long getUserId(String source,Long deviceId){ - Long userId = null; if("app".equals( source)){ - userId = AppLoginHelper.getUserId(); + return AppLoginHelper.getUserId(); } else if ("web".equals( source)){ - AppDeviceBindRecordBo appDeviceBindRecordBo = new AppDeviceBindRecordBo(); - appDeviceBindRecordBo.setDeviceId(deviceId); - appDeviceBindRecordBo.setCommunicationMode(0); - List appDeviceBindRecordVos = appDeviceBindRecordService.queryList(appDeviceBindRecordBo); - if (appDeviceBindRecordVos != null && !appDeviceBindRecordVos.isEmpty()){ - userId = appDeviceBindRecordVos.get(0).getBindingUserId(); - } +// AppDeviceBindRecordBo appDeviceBindRecordBo = new AppDeviceBindRecordBo(); +// appDeviceBindRecordBo.setDeviceId(deviceId); +//// appDeviceBindRecordBo.setCommunicationMode(0); +// List appDeviceBindRecordVos = appDeviceBindRecordService.queryList(appDeviceBindRecordBo); +// if (appDeviceBindRecordVos != null && !appDeviceBindRecordVos.isEmpty()){ +// userId = appDeviceBindRecordVos.get(0).getBindingUserId(); +// } } - return userId; + return 0L; } /** * 校验音频文件格式 @@ -450,9 +449,10 @@ public class AudioProcessService { throw new IllegalArgumentException("只允许上传MP3、WAV、PCM格式的音频文件"); } + long fileSize = 256 * 1024; // 检查文件大小 - if (file.getSize() > MAX_AUDIO_SIZE) { - throw new IllegalArgumentException("音频大小不能超过5MB"); + if (file.getSize() > fileSize) { + throw new IllegalArgumentException("音频大小不能超过256kb"); } } @@ -571,26 +571,29 @@ public class AudioProcessService { if(deviceId == null){ return null; } + Long userId = getUserId(source, deviceId); AppBusinessFileBo bo = new AppBusinessFileBo(); bo.setBusinessId(deviceId); - bo.setCreateBy(userId); bo.setFileType(3L); + if("web".equals(source)){ + bo.setCreateBy(null); + }else{ + bo.setCreateBy(userId); + } return appBusinessFileService.queryAppFileList(bo); } - public R deleteAudioFile(Long fileId,Long deviceId) { + public R deleteAudioFile(Long id) { UpdateWrapper updateWrapper = new UpdateWrapper<>(); - updateWrapper.eq("file_id",fileId); - updateWrapper.eq("business_id",deviceId); + updateWrapper.eq("id",id); appBusinessFileMapper.delete(updateWrapper); return R.ok(); } public R renameAudioFile(AppFileRenameDto bo) { UpdateWrapper updateWrapper = new UpdateWrapper<>(); - updateWrapper.eq("file_id",bo.getFileId()); - updateWrapper.eq("business_id",bo.getDeviceId()); + updateWrapper.eq("id",bo.getId()); updateWrapper.set("re_name",bo.getFileName()); appBusinessFileMapper.update(updateWrapper); return R.ok(); diff --git a/fys-admin/src/main/java/com/fuyuanshen/web/controller/device/WebVideoController.java b/fys-admin/src/main/java/com/fuyuanshen/web/controller/device/WebVideoController.java index 2fc2493c..75eaeb82 100644 --- a/fys-admin/src/main/java/com/fuyuanshen/web/controller/device/WebVideoController.java +++ b/fys-admin/src/main/java/com/fuyuanshen/web/controller/device/WebVideoController.java @@ -123,8 +123,8 @@ public class WebVideoController extends BaseController { * 删除语音文件 */ @GetMapping("/deleteAudioFile") - public R deleteAudioFile(Long fileId,Long deviceId) { - return audioProcessService.deleteAudioFile(fileId,deviceId); + public R deleteAudioFile(Long id) { + return audioProcessService.deleteAudioFile(id); } /** diff --git a/fys-admin/src/main/java/com/fuyuanshen/web/controller/device/bjq/WebDeviceHBY100JController.java b/fys-admin/src/main/java/com/fuyuanshen/web/controller/device/bjq/WebDeviceHBY100JController.java index bb340f73..c95d10a7 100644 --- a/fys-admin/src/main/java/com/fuyuanshen/web/controller/device/bjq/WebDeviceHBY100JController.java +++ b/fys-admin/src/main/java/com/fuyuanshen/web/controller/device/bjq/WebDeviceHBY100JController.java @@ -38,6 +38,7 @@ public class WebDeviceHBY100JController extends BaseController { */ @PostMapping("/updateVoice") public R updateVoice(@RequestBody HBY100JUpdateVoiceDto dto) { + dto.setCommunicationMode(0); deviceHBY100JBizService.updateVoice(dto); return R.ok(); } diff --git a/fys-admin/src/main/java/com/fuyuanshen/web/controller/device/domain/dto/HBY100JUpdateVoiceDto.java b/fys-admin/src/main/java/com/fuyuanshen/web/controller/device/domain/dto/HBY100JUpdateVoiceDto.java index 43ff37f2..c7374143 100644 --- a/fys-admin/src/main/java/com/fuyuanshen/web/controller/device/domain/dto/HBY100JUpdateVoiceDto.java +++ b/fys-admin/src/main/java/com/fuyuanshen/web/controller/device/domain/dto/HBY100JUpdateVoiceDto.java @@ -7,4 +7,8 @@ public class HBY100JUpdateVoiceDto { private Long id; + /** + * 通讯方式 0:4G;1:蓝牙 + */ + private Integer communicationMode; } \ No newline at end of file diff --git a/fys-admin/src/main/java/com/fuyuanshen/web/service/device/DeviceBizService.java b/fys-admin/src/main/java/com/fuyuanshen/web/service/device/DeviceBizService.java index 5b1a0a1c..fbaf2ce7 100644 --- a/fys-admin/src/main/java/com/fuyuanshen/web/service/device/DeviceBizService.java +++ b/fys-admin/src/main/java/com/fuyuanshen/web/service/device/DeviceBizService.java @@ -271,12 +271,12 @@ public class DeviceBizService { if (type == 0) { QueryWrapper bindRecordQueryWrapper = new QueryWrapper<>(); bindRecordQueryWrapper.eq("device_id", device.getId()); - bindRecordQueryWrapper.eq("binding_user_id", userId); +// bindRecordQueryWrapper.eq("binding_user_id", userId); Long count = appDeviceBindRecordMapper.selectCount(bindRecordQueryWrapper); if (count == 0) { throw new RuntimeException("请先绑定设备!!!"); } - if (count < 2) { + if (count <= 1) { UpdateWrapper deviceUpdateWrapper = new UpdateWrapper<>(); deviceUpdateWrapper.eq("id", device.getId()) .set("binding_user_id", null) diff --git a/fys-admin/src/main/java/com/fuyuanshen/web/service/device/DeviceHBY100JBizService.java b/fys-admin/src/main/java/com/fuyuanshen/web/service/device/DeviceHBY100JBizService.java index aa4a13fb..b46c73b6 100644 --- a/fys-admin/src/main/java/com/fuyuanshen/web/service/device/DeviceHBY100JBizService.java +++ b/fys-admin/src/main/java/com/fuyuanshen/web/service/device/DeviceHBY100JBizService.java @@ -166,7 +166,7 @@ public class DeviceHBY100JBizService { if(StringUtils.isNotBlank(voicePlayStatus)){ FuncType6VoicePlayRequest funcType6VoicePlayRequest = JSONObject.parseObject(voicePlayStatus, FuncType6VoicePlayRequest.class); if(funcType6VoicePlayRequest.getData() != null){ - vo.setVolume(funcType6VoicePlayRequest.getData().getVoiceBroadcast()); + vo.setVoiceBroadcast(funcType6VoicePlayRequest.getData().getVoiceBroadcast()); } } @@ -285,21 +285,22 @@ public class DeviceHBY100JBizService { if (getDeviceStatus(deviceObj.getDeviceImei())) { throw new ServiceException(deviceObj.getDeviceName() + ",设备已断开连接"); } - AppLoginUser loginUser = AppLoginHelper.getLoginUser(); - SysOssVo sysOssVo = sysOssMapper.selectVoById(appBusinessFileVo.getFileId()); - FuncType5UpdateVoiceRequest request = new FuncType5UpdateVoiceRequest(); - request.setRequestId(GenerateIdUtil.generateNumericId()); - request.setImei(deviceObj.getDeviceImei()); - request.setFuncType("5"); - request.setTimestamp(System.currentTimeMillis()); - FuncType5UpdateVoiceRequest.Data data = new FuncType5UpdateVoiceRequest.Data(); - data.setVoiceResource(sysOssVo.getUrl()); - data.setVoiceType(0); - request.setData(data); - log.info("HBY100J更新语音,参数:{}", request); + if(dto.getCommunicationMode()!=null && dto.getCommunicationMode()==0){ + SysOssVo sysOssVo = sysOssMapper.selectVoById(appBusinessFileVo.getFileId()); + FuncType5UpdateVoiceRequest request = new FuncType5UpdateVoiceRequest(); + request.setRequestId(GenerateIdUtil.generateNumericId()); + request.setImei(deviceObj.getDeviceImei()); + request.setFuncType("5"); + request.setTimestamp(System.currentTimeMillis()); + FuncType5UpdateVoiceRequest.Data data = new FuncType5UpdateVoiceRequest.Data(); + data.setVoiceResource(sysOssVo.getUrl()); + data.setVoiceType(0); + 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 updateWrapper = new UpdateWrapper<>(); updateWrapper.eq("business_id", appBusinessFileVo.getBusinessId()); diff --git a/fys-admin/src/main/resources/application-prod.yml b/fys-admin/src/main/resources/application-prod.yml index ab3bd29c..0eac8033 100644 --- a/fys-admin/src/main/resources/application-prod.yml +++ b/fys-admin/src/main/resources/application-prod.yml @@ -16,7 +16,7 @@ spring.boot.admin.client: --- # snail-job 配置 snail-job: - enabled: false + enabled: true # 需要在 SnailJob 后台组管理创建对应名称的组,然后创建任务的时候选择对应的组,才能正确分派任务 group: "fys_group" # SnailJob 接入验证令牌 详见 script/sql/ry_job.sql `sj_group_config`表 diff --git a/fys-extend/fys-snailjob-server/src/main/resources/application-dev.yml b/fys-extend/fys-snailjob-server/src/main/resources/application-dev.yml index aaf47489..e051945b 100644 --- a/fys-extend/fys-snailjob-server/src/main/resources/application-dev.yml +++ b/fys-extend/fys-snailjob-server/src/main/resources/application-dev.yml @@ -4,7 +4,7 @@ spring: driver-class-name: com.mysql.cj.jdbc.Driver url: jdbc:mysql://localhost:3306/ry-vue?useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true username: root - password: root + password: Jq_123456# hikari: connection-timeout: 30000 validation-timeout: 5000 diff --git a/fys-extend/fys-snailjob-server/src/main/resources/application-prod.yml b/fys-extend/fys-snailjob-server/src/main/resources/application-prod.yml index aaf47489..2e8da04e 100644 --- a/fys-extend/fys-snailjob-server/src/main/resources/application-prod.yml +++ b/fys-extend/fys-snailjob-server/src/main/resources/application-prod.yml @@ -2,9 +2,9 @@ spring: datasource: type: com.zaxxer.hikari.HikariDataSource driver-class-name: com.mysql.cj.jdbc.Driver - url: jdbc:mysql://localhost:3306/ry-vue?useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true + url: jdbc:mysql://localhost:3306/fys-vue?useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true username: root - password: root + password: Jq_123456# hikari: connection-timeout: 30000 validation-timeout: 5000 @@ -29,7 +29,7 @@ snail-job: --- # 监控中心配置 spring.boot.admin.client: # 增加客户端开关 - enabled: true + enabled: false url: http://localhost:9090/admin instance: service-host-type: IP diff --git a/fys-modules/fys-equipment/src/main/java/com/fuyuanshen/equipment/mapper/AppBusinessFileMapper.java b/fys-modules/fys-equipment/src/main/java/com/fuyuanshen/equipment/mapper/AppBusinessFileMapper.java index fb2f1880..960af434 100644 --- a/fys-modules/fys-equipment/src/main/java/com/fuyuanshen/equipment/mapper/AppBusinessFileMapper.java +++ b/fys-modules/fys-equipment/src/main/java/com/fuyuanshen/equipment/mapper/AppBusinessFileMapper.java @@ -17,4 +17,5 @@ import java.util.List; public interface AppBusinessFileMapper extends BaseMapperPlus { List queryAppFileList(AppBusinessFileBo bo); + } diff --git a/fys-modules/fys-equipment/src/main/resources/mapper/equipment/AppBusinessFileMapper.xml b/fys-modules/fys-equipment/src/main/resources/mapper/equipment/AppBusinessFileMapper.xml index 01263506..5d39929a 100644 --- a/fys-modules/fys-equipment/src/main/resources/mapper/equipment/AppBusinessFileMapper.xml +++ b/fys-modules/fys-equipment/src/main/resources/mapper/equipment/AppBusinessFileMapper.xml @@ -23,8 +23,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" and a.file_type = #{fileType} - - and a.create_by = #{createBy} + + and (a.create_by = #{createBy} or a.create_by = 0) order by a.create_time desc diff --git a/fys-modules/fys-system/src/main/java/com/fuyuanshen/system/service/impl/SysOssServiceImpl.java b/fys-modules/fys-system/src/main/java/com/fuyuanshen/system/service/impl/SysOssServiceImpl.java index 125e5996..60bcd12f 100644 --- a/fys-modules/fys-system/src/main/java/com/fuyuanshen/system/service/impl/SysOssServiceImpl.java +++ b/fys-modules/fys-system/src/main/java/com/fuyuanshen/system/service/impl/SysOssServiceImpl.java @@ -213,11 +213,11 @@ public class SysOssServiceImpl implements ISysOssService, OssService { try { byte[] imageData = file.getBytes(); // 检查是否需要压缩 - if (ImageCompressUtil.needCompress(imageData)) { - // 压缩到100KB以内 - imageData = ImageCompressUtil.compressImage(imageData); - // 使用压缩后的数据 - } +// if (ImageCompressUtil.needCompress(imageData)) { +// // 压缩到100KB以内 +// imageData = ImageCompressUtil.compressImage(imageData); +// // 使用压缩后的数据 +// } uploadResult = storage.uploadSuffix(imageData, suffix, file.getContentType()); } catch (IOException e) { throw new ServiceException(e.getMessage());