From 9afc0222d5b05e65225d86102392fef44f24fc5f Mon Sep 17 00:00:00 2001 From: chenyouting <514333061@qq.com> Date: Tue, 30 Sep 2025 17:53:28 +0800 Subject: [PATCH 1/3] =?UTF-8?q?app=E6=89=B9=E9=87=8F=E4=B8=8A=E4=BC=A0logo?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../device/AppDeviceBJQController.java | 23 +++++++++++++++++++ .../domain/dto/AppDeviceLogoUploadDto.java | 10 ++++++++ .../service/device/DeviceBJQBizService.java | 16 +++++++++++++ 3 files changed, 49 insertions(+) diff --git a/fys-admin/src/main/java/com/fuyuanshen/app/controller/device/AppDeviceBJQController.java b/fys-admin/src/main/java/com/fuyuanshen/app/controller/device/AppDeviceBJQController.java index 3cc71f8c..95d33231 100644 --- a/fys-admin/src/main/java/com/fuyuanshen/app/controller/device/AppDeviceBJQController.java +++ b/fys-admin/src/main/java/com/fuyuanshen/app/controller/device/AppDeviceBJQController.java @@ -5,6 +5,7 @@ import com.fuyuanshen.app.domain.dto.AppDeviceLogoUploadDto; import com.fuyuanshen.app.domain.dto.DeviceInstructDto; import com.fuyuanshen.app.domain.vo.AppDeviceDetailVo; import com.fuyuanshen.common.core.domain.R; +import com.fuyuanshen.common.core.exception.ServiceException; import com.fuyuanshen.common.core.validate.AddGroup; import com.fuyuanshen.common.ratelimiter.annotation.FunctionAccessAnnotation; import com.fuyuanshen.common.ratelimiter.annotation.FunctionAccessBatcAnnotation; @@ -17,6 +18,8 @@ import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.*; import org.springframework.web.multipart.MultipartFile; +import java.util.List; + /** * BJQ6170设备控制类 */ @@ -82,6 +85,26 @@ public class AppDeviceBJQController extends BaseController { return R.ok(); } + /** + * 批量上传设备logo图片 + */ + @PostMapping("/batchUploadLogo") + @FunctionAccessAnnotation("batchUploadLogo") + public R batchUploadLogo(@Validated @ModelAttribute AppDeviceLogoUploadDto bo) { + + List files = bo.getFiles(); + if(files == null || files.isEmpty()){ + return R.warn("文件不能为空"); + } + MultipartFile file = files.get(0); + if(file.getSize()>1024*1024*2){ + throw new ServiceException("图片不能大于2M"); + } + appDeviceService.batchUploadLogo(bo); + + return R.ok(); + } + /** * 灯光模式 * 0(关灯),1(强光模式),2(弱光模式), 3(爆闪模式), 4(泛光模式) diff --git a/fys-admin/src/main/java/com/fuyuanshen/app/domain/dto/AppDeviceLogoUploadDto.java b/fys-admin/src/main/java/com/fuyuanshen/app/domain/dto/AppDeviceLogoUploadDto.java index 1841dadb..7f644f49 100644 --- a/fys-admin/src/main/java/com/fuyuanshen/app/domain/dto/AppDeviceLogoUploadDto.java +++ b/fys-admin/src/main/java/com/fuyuanshen/app/domain/dto/AppDeviceLogoUploadDto.java @@ -3,6 +3,8 @@ package com.fuyuanshen.app.domain.dto; import lombok.Data; import org.springframework.web.multipart.MultipartFile; +import java.util.List; + @Data public class AppDeviceLogoUploadDto { @@ -14,5 +16,13 @@ public class AppDeviceLogoUploadDto { */ private MultipartFile file; + /** + * 文件 + */ + private List files; + + + private List deviceIds; + private Integer chunkSize; } diff --git a/fys-admin/src/main/java/com/fuyuanshen/web/service/device/DeviceBJQBizService.java b/fys-admin/src/main/java/com/fuyuanshen/web/service/device/DeviceBJQBizService.java index aec329a1..bc197d20 100644 --- a/fys-admin/src/main/java/com/fuyuanshen/web/service/device/DeviceBJQBizService.java +++ b/fys-admin/src/main/java/com/fuyuanshen/web/service/device/DeviceBJQBizService.java @@ -15,6 +15,7 @@ import com.fuyuanshen.app.domain.vo.AppPersonnelInfoVo; import com.fuyuanshen.app.mapper.AppPersonnelInfoMapper; import com.fuyuanshen.app.mapper.AppPersonnelInfoRecordsMapper; import com.fuyuanshen.common.core.constant.GlobalConstants; +import com.fuyuanshen.common.core.domain.R; import com.fuyuanshen.common.core.exception.ServiceException; import com.fuyuanshen.common.core.utils.*; import com.fuyuanshen.common.redis.utils.RedisUtils; @@ -546,4 +547,19 @@ public class DeviceBJQBizService { String deviceOnlineStatusRedisKey = GlobalConstants.GLOBAL_REDIS_KEY+ DEVICE_KEY_PREFIX+ deviceImei + DeviceRedisKeyConstants.DEVICE_ONLINE_STATUS_KEY_PREFIX ; return RedisUtils.getCacheObject(deviceOnlineStatusRedisKey) == null; } + + public void batchUploadLogo(AppDeviceLogoUploadDto bo) { + + List deviceIds = bo.getDeviceIds(); + List files = bo.getFiles(); + if (deviceIds == null || deviceIds.isEmpty()) { + throw new ServiceException("请选择设备"); + } + for (int i = 0; i < deviceIds.size(); i++) { + AppDeviceLogoUploadDto dto = new AppDeviceLogoUploadDto(); + dto.setDeviceId(deviceIds.get(i)); + dto.setFile(files.get(i)); + uploadDeviceLogo(bo); + } + } } From dfa5b446f9ffe824fc507f4b2d2f47d4605f4480 Mon Sep 17 00:00:00 2001 From: chenyouting <514333061@qq.com> Date: Tue, 7 Oct 2025 09:50:49 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=E6=8E=A7=E5=88=B6=E4=B8=AD=E5=BF=83?= =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../listener/RedisKeyExpirationListener.java | 21 +++++++++++++------ .../equipment/domain/vo/WebDeviceVo.java | 7 +++++++ .../mapper/equipment/DeviceMapper.xml | 3 ++- 3 files changed, 24 insertions(+), 7 deletions(-) diff --git a/fys-admin/src/main/java/com/fuyuanshen/global/mqtt/listener/RedisKeyExpirationListener.java b/fys-admin/src/main/java/com/fuyuanshen/global/mqtt/listener/RedisKeyExpirationListener.java index 13f190fa..8996609e 100644 --- a/fys-admin/src/main/java/com/fuyuanshen/global/mqtt/listener/RedisKeyExpirationListener.java +++ b/fys-admin/src/main/java/com/fuyuanshen/global/mqtt/listener/RedisKeyExpirationListener.java @@ -65,13 +65,22 @@ public class RedisKeyExpirationListener implements MessageListener { if (lockInfo != null) { try { String deviceOnlineStatusRedisKey = GlobalConstants.GLOBAL_REDIS_KEY+ DEVICE_KEY_PREFIX+ message + DeviceRedisKeyConstants.DEVICE_ONLINE_STATUS_KEY_PREFIX ; +// String deviceOnlineStatusRedis = RedisUtils.getCacheObject(deviceOnlineStatusRedisKey); +// if(StringUtils.isBlank(deviceOnlineStatusRedis)){ +// UpdateWrapper deviceUpdateWrapper = new UpdateWrapper<>(); +// deviceUpdateWrapper.eq("device_imei", element); +// deviceUpdateWrapper.set("online_status", 0); +// deviceMapper.update(deviceUpdateWrapper); +// }else{ +// RedisUtils.deleteObject(deviceOnlineStatusRedisKey); +// } + + UpdateWrapper deviceUpdateWrapper = new UpdateWrapper<>(); + deviceUpdateWrapper.eq("device_imei", element); + deviceUpdateWrapper.set("online_status", 0); + deviceMapper.update(deviceUpdateWrapper); String deviceOnlineStatusRedis = RedisUtils.getCacheObject(deviceOnlineStatusRedisKey); - if(StringUtils.isBlank(deviceOnlineStatusRedis)){ - UpdateWrapper deviceUpdateWrapper = new UpdateWrapper<>(); - deviceUpdateWrapper.eq("device_imei", element); - deviceUpdateWrapper.set("online_status", 0); - deviceMapper.update(deviceUpdateWrapper); - }else{ + if(StringUtils.isNotBlank(deviceOnlineStatusRedis)){ RedisUtils.deleteObject(deviceOnlineStatusRedisKey); } } finally { diff --git a/fys-modules/fys-equipment/src/main/java/com/fuyuanshen/equipment/domain/vo/WebDeviceVo.java b/fys-modules/fys-equipment/src/main/java/com/fuyuanshen/equipment/domain/vo/WebDeviceVo.java index f1d0879f..c257d38e 100644 --- a/fys-modules/fys-equipment/src/main/java/com/fuyuanshen/equipment/domain/vo/WebDeviceVo.java +++ b/fys-modules/fys-equipment/src/main/java/com/fuyuanshen/equipment/domain/vo/WebDeviceVo.java @@ -58,6 +58,13 @@ public class WebDeviceVo implements Serializable { */ private Integer deviceStatus; + + /**绑定状态 + * 0 未绑定 + * 1 已绑定 + */ + private Integer binding_status; + /** * 绑定时间 */ diff --git a/fys-modules/fys-equipment/src/main/resources/mapper/equipment/DeviceMapper.xml b/fys-modules/fys-equipment/src/main/resources/mapper/equipment/DeviceMapper.xml index 856516b2..7330179d 100644 --- a/fys-modules/fys-equipment/src/main/resources/mapper/equipment/DeviceMapper.xml +++ b/fys-modules/fys-equipment/src/main/resources/mapper/equipment/DeviceMapper.xml @@ -252,12 +252,13 @@ dt.pc_model_dictionary detailPageUrl, ap.name personnelBy, d.device_status, + d.binding_status, d.online_status, c.binding_time, ROW_NUMBER() OVER (PARTITION BY d.id ORDER BY c.binding_time) AS row_num from device d inner join device_type dt on d.device_type = dt.id - inner join app_device_bind_record c on d.id = c.device_id + left join app_device_bind_record c on d.id = c.device_id left join app_personnel_info ap on ap.device_id = d.id where dt.communication_mode in (0, 2) ) a where a.row_num = 1 From 37e07d2706d78b9cd06bb3ad9fb4e9cf4d8d1165 Mon Sep 17 00:00:00 2001 From: chenyouting <514333061@qq.com> Date: Tue, 7 Oct 2025 15:50:16 +0800 Subject: [PATCH 3/3] =?UTF-8?q?=E6=8E=A7=E5=88=B6=E4=B8=AD=E5=BF=83?= =?UTF-8?q?=E4=BC=98=E5=8C=962?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../device/AppDeviceBJQController.java | 18 ------------- .../domain/dto/AppDeviceLogoUploadDto.java | 8 +++--- .../mqtt/receiver/ReceiverMessageHandler.java | 2 +- .../global/queue/MqttMessageConsumer.java | 26 ++++++++++++------- .../device/DeviceBJQController.java | 16 ++++++++++++ .../service/device/DeviceBJQBizService.java | 24 ++++++++++------- .../equipment/domain/vo/WebDeviceVo.java | 2 +- 7 files changed, 53 insertions(+), 43 deletions(-) diff --git a/fys-admin/src/main/java/com/fuyuanshen/app/controller/device/AppDeviceBJQController.java b/fys-admin/src/main/java/com/fuyuanshen/app/controller/device/AppDeviceBJQController.java index 95d33231..ce855489 100644 --- a/fys-admin/src/main/java/com/fuyuanshen/app/controller/device/AppDeviceBJQController.java +++ b/fys-admin/src/main/java/com/fuyuanshen/app/controller/device/AppDeviceBJQController.java @@ -85,25 +85,7 @@ public class AppDeviceBJQController extends BaseController { return R.ok(); } - /** - * 批量上传设备logo图片 - */ - @PostMapping("/batchUploadLogo") - @FunctionAccessAnnotation("batchUploadLogo") - public R batchUploadLogo(@Validated @ModelAttribute AppDeviceLogoUploadDto bo) { - List files = bo.getFiles(); - if(files == null || files.isEmpty()){ - return R.warn("文件不能为空"); - } - MultipartFile file = files.get(0); - if(file.getSize()>1024*1024*2){ - throw new ServiceException("图片不能大于2M"); - } - appDeviceService.batchUploadLogo(bo); - - return R.ok(); - } /** * 灯光模式 diff --git a/fys-admin/src/main/java/com/fuyuanshen/app/domain/dto/AppDeviceLogoUploadDto.java b/fys-admin/src/main/java/com/fuyuanshen/app/domain/dto/AppDeviceLogoUploadDto.java index 7f644f49..00ca2d25 100644 --- a/fys-admin/src/main/java/com/fuyuanshen/app/domain/dto/AppDeviceLogoUploadDto.java +++ b/fys-admin/src/main/java/com/fuyuanshen/app/domain/dto/AppDeviceLogoUploadDto.java @@ -16,10 +16,10 @@ public class AppDeviceLogoUploadDto { */ private MultipartFile file; - /** - * 文件 - */ - private List files; +// /** +// * 文件 +// */ +// private List files; private List deviceIds; diff --git a/fys-admin/src/main/java/com/fuyuanshen/global/mqtt/receiver/ReceiverMessageHandler.java b/fys-admin/src/main/java/com/fuyuanshen/global/mqtt/receiver/ReceiverMessageHandler.java index 6e1054c1..c6ea5654 100644 --- a/fys-admin/src/main/java/com/fuyuanshen/global/mqtt/receiver/ReceiverMessageHandler.java +++ b/fys-admin/src/main/java/com/fuyuanshen/global/mqtt/receiver/ReceiverMessageHandler.java @@ -56,7 +56,7 @@ public class ReceiverMessageHandler implements MessageHandler { RedisUtils.offerDeduplicated(queueKey,dedupKey,deviceImei, Duration.ofHours(24)); //在线状态 String deviceOnlineStatusRedisKey = GlobalConstants.GLOBAL_REDIS_KEY+ DEVICE_KEY_PREFIX+ deviceImei + DeviceRedisKeyConstants.DEVICE_ONLINE_STATUS_KEY_PREFIX ; - RedisUtils.setCacheObject(deviceOnlineStatusRedisKey, "1", Duration.ofSeconds(303)); + RedisUtils.setCacheObject(deviceOnlineStatusRedisKey, "1", Duration.ofSeconds(360)); } diff --git a/fys-admin/src/main/java/com/fuyuanshen/global/queue/MqttMessageConsumer.java b/fys-admin/src/main/java/com/fuyuanshen/global/queue/MqttMessageConsumer.java index 4a28b63f..ca5bdda7 100644 --- a/fys-admin/src/main/java/com/fuyuanshen/global/queue/MqttMessageConsumer.java +++ b/fys-admin/src/main/java/com/fuyuanshen/global/queue/MqttMessageConsumer.java @@ -106,16 +106,22 @@ public class MqttMessageConsumer { // .set("online_status", 1); // deviceMapper.update(updateWrapper); // } - QueryWrapper queryWrapper = new QueryWrapper<>(); - queryWrapper.eq("device_imei", message); - queryWrapper.eq("online_status", 1); - Long count = deviceMapper.selectCount(queryWrapper); - if(count == 0){ - UpdateWrapper updateWrapper = new UpdateWrapper<>(); - updateWrapper.eq("device_imei", message) - .set("online_status", 1); - deviceMapper.update(updateWrapper); - } +// QueryWrapper queryWrapper = new QueryWrapper<>(); +// queryWrapper.eq("device_imei", message); +// queryWrapper.eq("online_status", 1); +// Long count = deviceMapper.selectCount(queryWrapper); +// if(count == 0){ +// UpdateWrapper updateWrapper = new UpdateWrapper<>(); +// updateWrapper.eq("device_imei", message) +// .eq("online_status", 0) +// .set("online_status", 1); +// deviceMapper.update(updateWrapper); +// } + UpdateWrapper updateWrapper = new UpdateWrapper<>(); + updateWrapper.eq("device_imei", message) + .eq("online_status", 0) + .set("online_status", 1); + int update = deviceMapper.update(updateWrapper); // 模拟业务处理耗时 // Thread.sleep(200); diff --git a/fys-admin/src/main/java/com/fuyuanshen/web/controller/device/DeviceBJQController.java b/fys-admin/src/main/java/com/fuyuanshen/web/controller/device/DeviceBJQController.java index e0536306..610c317d 100644 --- a/fys-admin/src/main/java/com/fuyuanshen/web/controller/device/DeviceBJQController.java +++ b/fys-admin/src/main/java/com/fuyuanshen/web/controller/device/DeviceBJQController.java @@ -82,6 +82,22 @@ public class DeviceBJQController extends BaseController { return R.ok(); } + /** + * 批量上传设备logo图片 + */ + @PostMapping("/batchUploadLogo") + @FunctionAccessAnnotation("batchUploadLogo") + public R batchUploadLogo(@Validated @ModelAttribute AppDeviceLogoUploadDto bo) { + + MultipartFile file = bo.getFile(); + if(file.getSize()>1024*1024*2){ + return R.warn("图片不能大于2M"); + } + appDeviceService.batchUploadLogo(bo); + + return R.ok(); + } + /** * 灯光模式 * 0(关灯),1(强光模式),2(弱光模式), 3(爆闪模式), 4(泛光模式) diff --git a/fys-admin/src/main/java/com/fuyuanshen/web/service/device/DeviceBJQBizService.java b/fys-admin/src/main/java/com/fuyuanshen/web/service/device/DeviceBJQBizService.java index bc197d20..5fcd5c8f 100644 --- a/fys-admin/src/main/java/com/fuyuanshen/web/service/device/DeviceBJQBizService.java +++ b/fys-admin/src/main/java/com/fuyuanshen/web/service/device/DeviceBJQBizService.java @@ -173,10 +173,13 @@ public class DeviceBJQBizService { } //设备在线状态 String onlineStatus = RedisUtils.getCacheObject(GLOBAL_REDIS_KEY+ DEVICE_KEY_PREFIX + device.getDeviceImei()+ DeviceRedisKeyConstants.DEVICE_ONLINE_STATUS_KEY_PREFIX); - if(StringUtils.isNotBlank(onlineStatus)){ - vo.setOnlineStatus(1); + //设备在线状态 + if("1".equals(onlineStatus)){ + vo.setOnlineStatus(1); + }else if("2".equals(onlineStatus)){ + vo.setOnlineStatus(2); }else{ - vo.setOnlineStatus(0); + vo.setOnlineStatus(0); } String deviceStatus = RedisUtils.getCacheObject(GLOBAL_REDIS_KEY+ DEVICE_KEY_PREFIX + device.getDeviceImei() + DeviceRedisKeyConstants.DEVICE_STATUS_KEY_PREFIX); // 获取电量 @@ -335,7 +338,10 @@ public class DeviceBJQBizService { throw new ServiceException("设备不存在"); } if(getDeviceStatus(device.getDeviceImei())){ - throw new ServiceException(device.getDeviceName()+",设备已断开连接"); +// throw new ServiceException(device.getDeviceName()+",设备已断开连接"); + log.info(device.getDeviceName()+",设备已断开连接"); + recordDeviceLog(device.getId(), device.getDeviceName(), "上传开机画面", device.getDeviceName()+",设备已断开连接", AppLoginHelper.getUserId()); + return; } MultipartFile file = bo.getFile(); @@ -551,15 +557,15 @@ public class DeviceBJQBizService { public void batchUploadLogo(AppDeviceLogoUploadDto bo) { List deviceIds = bo.getDeviceIds(); - List files = bo.getFiles(); + MultipartFile file = bo.getFile(); if (deviceIds == null || deviceIds.isEmpty()) { throw new ServiceException("请选择设备"); } - for (int i = 0; i < deviceIds.size(); i++) { + for (Long deviceId : deviceIds) { AppDeviceLogoUploadDto dto = new AppDeviceLogoUploadDto(); - dto.setDeviceId(deviceIds.get(i)); - dto.setFile(files.get(i)); - uploadDeviceLogo(bo); + dto.setDeviceId(deviceId); + dto.setFile(file); + uploadDeviceLogo(dto); } } } diff --git a/fys-modules/fys-equipment/src/main/java/com/fuyuanshen/equipment/domain/vo/WebDeviceVo.java b/fys-modules/fys-equipment/src/main/java/com/fuyuanshen/equipment/domain/vo/WebDeviceVo.java index c257d38e..5aaa405e 100644 --- a/fys-modules/fys-equipment/src/main/java/com/fuyuanshen/equipment/domain/vo/WebDeviceVo.java +++ b/fys-modules/fys-equipment/src/main/java/com/fuyuanshen/equipment/domain/vo/WebDeviceVo.java @@ -63,7 +63,7 @@ public class WebDeviceVo implements Serializable { * 0 未绑定 * 1 已绑定 */ - private Integer binding_status; + private Integer bindingStatus; /** * 绑定时间