From 34ee4ccecae9f7698832cff3e514c8e0679cd55f Mon Sep 17 00:00:00 2001 From: chenyouting <514333061@qq.com> Date: Tue, 19 Aug 2025 13:58:48 +0800 Subject: [PATCH 1/4] =?UTF-8?q?web=E7=AB=AF=E6=8E=A7=E5=88=B6=E4=B8=AD?= =?UTF-8?q?=E5=BF=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../device/DeviceBJQController.java | 119 ++++++++++++++++++ .../device/WEBDeviceController.java | 80 +++++++++++- .../mapper/equipment/DeviceMapper.xml | 4 +- 3 files changed, 196 insertions(+), 7 deletions(-) create mode 100644 fys-admin/src/main/java/com/fuyuanshen/web/controller/device/DeviceBJQController.java 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 new file mode 100644 index 00000000..d42d5223 --- /dev/null +++ b/fys-admin/src/main/java/com/fuyuanshen/web/controller/device/DeviceBJQController.java @@ -0,0 +1,119 @@ +package com.fuyuanshen.web.controller.device; + +import com.fuyuanshen.app.domain.bo.AppPersonnelInfoBo; +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.validate.AddGroup; +import com.fuyuanshen.common.ratelimiter.annotation.FunctionAccessAnnotation; +import com.fuyuanshen.common.ratelimiter.annotation.FunctionAccessBatcAnnotation; +import com.fuyuanshen.common.web.core.BaseController; +import com.fuyuanshen.equipment.domain.dto.AppDeviceSendMsgBo; +import com.fuyuanshen.web.service.device.DeviceBJQBizService; +import jakarta.validation.constraints.NotNull; +import lombok.RequiredArgsConstructor; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; +import org.springframework.web.multipart.MultipartFile; + +/** + * BJQ6170设备控制类 + */ +@Validated +@RequiredArgsConstructor +@RestController +@RequestMapping("/api/bjq/device") +public class DeviceBJQController extends BaseController { + + private final DeviceBJQBizService appDeviceService; + + /** + * 获取设备详细信息 + * + * @param id 主键 + */ + @GetMapping("/{id}") + public R getInfo(@NotNull(message = "主键不能为空") + @PathVariable Long id) { + return R.ok(appDeviceService.getInfo(id)); + } + + /** + * 人员信息登记 + */ + @PostMapping(value = "/registerPersonInfo") +// @FunctionAccessAnnotation("registerPersonInfo") + public R registerPersonInfo(@Validated(AddGroup.class) @RequestBody AppPersonnelInfoBo bo) { + return toAjax(appDeviceService.registerPersonInfo(bo)); + } + + /** + * 发送信息 + */ + @PostMapping(value = "/sendMessage") + @FunctionAccessBatcAnnotation(value = "sendMessage", timeOut = 30, batchMaxTimeOut = 40) + public R sendMessage(@RequestBody AppDeviceSendMsgBo bo) { + return toAjax(appDeviceService.sendMessage(bo)); + } + + /** + * 发送报警信息 + */ + @PostMapping(value = "/sendAlarmMessage") + @FunctionAccessBatcAnnotation(value = "sendAlarmMessage", timeOut = 5, batchMaxTimeOut = 10) + public R sendAlarmMessage(@RequestBody AppDeviceSendMsgBo bo) { + return toAjax(appDeviceService.sendAlarmMessage(bo)); + } + + /** + * 上传设备logo图片 + */ + @PostMapping("/uploadLogo") + @FunctionAccessAnnotation("uploadLogo") + public R upload(@Validated @ModelAttribute AppDeviceLogoUploadDto bo) { + + MultipartFile file = bo.getFile(); + if(file.getSize()>1024*1024*2){ + return R.warn("图片不能大于2M"); + } + appDeviceService.uploadDeviceLogo(bo); + + return R.ok(); + } + + /** + * 灯光模式 + * 0(关灯),1(强光模式),2(弱光模式), 3(爆闪模式), 4(泛光模式) + */ +// @FunctionAccessAnnotation("lightModeSettings") + @PostMapping("/lightModeSettings") + public R lightModeSettings(@RequestBody DeviceInstructDto params) { + // params 转 JSONObject + appDeviceService.lightModeSettings(params); + return R.ok(); + } + + /** + * 灯光亮度设置 + * + */ +// @FunctionAccessAnnotation("lightBrightnessSettings") + @PostMapping("/lightBrightnessSettings") + public R lightBrightnessSettings(@RequestBody DeviceInstructDto params) { + appDeviceService.lightBrightnessSettings(params); + return R.ok(); + } + + /** + * 激光模式设置 + * + */ + @PostMapping("/laserModeSettings") +// @FunctionAccessAnnotation("laserModeSettings") + public R laserModeSettings(@RequestBody DeviceInstructDto params) { + appDeviceService.laserModeSettings(params); + return R.ok(); + } + +} diff --git a/fys-admin/src/main/java/com/fuyuanshen/web/controller/device/WEBDeviceController.java b/fys-admin/src/main/java/com/fuyuanshen/web/controller/device/WEBDeviceController.java index eadb1579..0d196762 100644 --- a/fys-admin/src/main/java/com/fuyuanshen/web/controller/device/WEBDeviceController.java +++ b/fys-admin/src/main/java/com/fuyuanshen/web/controller/device/WEBDeviceController.java @@ -1,16 +1,27 @@ package com.fuyuanshen.web.controller.device; +import com.fuyuanshen.app.domain.dto.APPReNameDTO; +import com.fuyuanshen.app.domain.dto.AppRealTimeStatusDto; +import com.fuyuanshen.app.domain.vo.APPDeviceTypeVo; import com.fuyuanshen.common.core.domain.R; +import com.fuyuanshen.common.mybatis.core.page.PageQuery; +import com.fuyuanshen.common.mybatis.core.page.TableDataInfo; import com.fuyuanshen.common.web.core.BaseController; +import com.fuyuanshen.equipment.domain.dto.AppDeviceBo; +import com.fuyuanshen.equipment.domain.query.DeviceQueryCriteria; +import com.fuyuanshen.equipment.domain.vo.AppDeviceVo; import com.fuyuanshen.web.service.WEBDeviceService; +import com.fuyuanshen.web.service.device.DeviceBizService; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.tags.Tag; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; -import org.springframework.web.bind.annotation.DeleteMapping; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; + +import java.util.List; +import java.util.Map; /** * @Description: @@ -25,7 +36,7 @@ import org.springframework.web.bind.annotation.RestController; public class WEBDeviceController extends BaseController { private final WEBDeviceService deviceService; - + private final DeviceBizService appDeviceService; /** * @param id @@ -41,6 +52,67 @@ public class WEBDeviceController extends BaseController { } + + + /** + * 查询设备列表 + */ + @GetMapping("/list") + public TableDataInfo list(DeviceQueryCriteria bo, PageQuery pageQuery) { + return appDeviceService.queryAppDeviceList(bo,pageQuery); + } + + /** + * 绑定设备 + */ + @PostMapping("/bind") + public R bind(@RequestBody AppDeviceBo bo) { + return toAjax(appDeviceService.bindDevice(bo)); + } + + + /** + * 解绑设备 + */ + @DeleteMapping("/unBind") + public R unBind(Long id) { + return toAjax(appDeviceService.unBindDevice(id)); + } + + /** + * 查询设备类型列表 + */ + @GetMapping(value = "/typeList") + public R> getTypeList() { + List typeList = appDeviceService.getTypeList(); + return R.ok(typeList); + } + + /** + * 重命名设备 + * @param reNameDTO + * @return + */ + @PostMapping(value = "/reName") + public R reName(@Validated @RequestBody APPReNameDTO reNameDTO) { + appDeviceService.reName(reNameDTO); + return R.ok("重命名成功!!!"); + } + + + @GetMapping("/realTimeStatus") + public R> getRealTimeStatus(AppRealTimeStatusDto statusDto) { + Map status = appDeviceService.getRealTimeStatus(statusDto); + return R.ok(status); + } + + /** + * 根据mac查询设备信息 + */ + @GetMapping("/getDeviceInfoByDeviceMac") + public R getDeviceInfo(String deviceMac) { + return R.ok(appDeviceService.getDeviceInfo(deviceMac)); + } } 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 615c86a6..e5c95a31 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 @@ -222,11 +222,9 @@ dt.type_name, dt.communication_mode, d.bluetooth_name, - dt.model_dictionary detailPageUrl, - c.binding_time + dt.model_dictionary detailPageUrl 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 where d.device_mac = #{deviceMac} From 7f65ebedc213a0014a02482e3de66fe61bc3496c Mon Sep 17 00:00:00 2001 From: daiyongfei <974332738@qq.com> Date: Wed, 20 Aug 2025 13:31:54 +0800 Subject: [PATCH 2/4] =?UTF-8?q?=E6=95=B0=E6=8D=AE=E5=AD=97=E5=85=B8?= =?UTF-8?q?=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../system/controller/system/SysDictDataController.java | 7 +++++++ .../fuyuanshen/system/service/ISysDictDataService.java | 5 +++++ .../fuyuanshen/system/service/ISysDictTypeService.java | 5 +++++ .../system/service/impl/SysDictDataServiceImpl.java | 9 +++++++++ .../system/service/impl/SysDictTypeServiceImpl.java | 8 ++++++++ 5 files changed, 34 insertions(+) diff --git a/fys-modules/fys-system/src/main/java/com/fuyuanshen/system/controller/system/SysDictDataController.java b/fys-modules/fys-system/src/main/java/com/fuyuanshen/system/controller/system/SysDictDataController.java index ff3b6dcc..4ba67de4 100644 --- a/fys-modules/fys-system/src/main/java/com/fuyuanshen/system/controller/system/SysDictDataController.java +++ b/fys-modules/fys-system/src/main/java/com/fuyuanshen/system/controller/system/SysDictDataController.java @@ -2,6 +2,7 @@ package com.fuyuanshen.system.controller.system; import cn.dev33.satoken.annotation.SaCheckPermission; import cn.hutool.core.util.ObjectUtil; +import com.fuyuanshen.common.core.constant.CacheNames; import com.fuyuanshen.common.log.annotation.Log; import com.fuyuanshen.common.web.core.BaseController; import com.fuyuanshen.common.mybatis.core.page.PageQuery; @@ -14,10 +15,12 @@ import com.fuyuanshen.system.domain.vo.SysDictDataVo; import com.fuyuanshen.system.service.ISysDictDataService; import com.fuyuanshen.system.service.ISysDictTypeService; import lombok.RequiredArgsConstructor; +import org.springframework.cache.annotation.CacheEvict; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.*; import jakarta.servlet.http.HttpServletResponse; + import java.util.ArrayList; import java.util.List; @@ -73,6 +76,8 @@ public class SysDictDataController extends BaseController { */ @GetMapping(value = "/type/{dictType}") public R> dictType(@PathVariable String dictType) { + // 使用时先清除缓存再查询 + dictTypeService.clearDictTypeCache(dictType); List data = dictTypeService.selectDictDataByType(dictType); if (ObjectUtil.isNull(data)) { data = new ArrayList<>(); @@ -94,6 +99,7 @@ public class SysDictDataController extends BaseController { return R.ok(); } + /** * 修改保存字典类型 */ @@ -105,6 +111,7 @@ public class SysDictDataController extends BaseController { return R.fail("修改字典数据'" + dict.getDictValue() + "'失败,字典键值已存在"); } dictDataService.updateDictData(dict); + return R.ok(); } diff --git a/fys-modules/fys-system/src/main/java/com/fuyuanshen/system/service/ISysDictDataService.java b/fys-modules/fys-system/src/main/java/com/fuyuanshen/system/service/ISysDictDataService.java index 1f8fc322..d5f03758 100644 --- a/fys-modules/fys-system/src/main/java/com/fuyuanshen/system/service/ISysDictDataService.java +++ b/fys-modules/fys-system/src/main/java/com/fuyuanshen/system/service/ISysDictDataService.java @@ -73,4 +73,9 @@ public interface ISysDictDataService { */ boolean checkDictDataUnique(SysDictDataBo dict); + /** + * 清空字典缓存 + */ + void clearDictTypeCache(String dictType); + } diff --git a/fys-modules/fys-system/src/main/java/com/fuyuanshen/system/service/ISysDictTypeService.java b/fys-modules/fys-system/src/main/java/com/fuyuanshen/system/service/ISysDictTypeService.java index 004b6e58..183ceb59 100644 --- a/fys-modules/fys-system/src/main/java/com/fuyuanshen/system/service/ISysDictTypeService.java +++ b/fys-modules/fys-system/src/main/java/com/fuyuanshen/system/service/ISysDictTypeService.java @@ -92,4 +92,9 @@ public interface ISysDictTypeService { * @return 结果 */ boolean checkDictTypeUnique(SysDictTypeBo dictType); + + /** + * 清空字典缓存 + */ + void clearDictTypeCache(String dictType); } diff --git a/fys-modules/fys-system/src/main/java/com/fuyuanshen/system/service/impl/SysDictDataServiceImpl.java b/fys-modules/fys-system/src/main/java/com/fuyuanshen/system/service/impl/SysDictDataServiceImpl.java index adcf47d1..19f55440 100644 --- a/fys-modules/fys-system/src/main/java/com/fuyuanshen/system/service/impl/SysDictDataServiceImpl.java +++ b/fys-modules/fys-system/src/main/java/com/fuyuanshen/system/service/impl/SysDictDataServiceImpl.java @@ -18,6 +18,7 @@ import com.fuyuanshen.system.domain.vo.SysDictDataVo; import com.fuyuanshen.system.mapper.SysDictDataMapper; import com.fuyuanshen.system.service.ISysDictDataService; import lombok.RequiredArgsConstructor; +import org.springframework.cache.annotation.CacheEvict; import org.springframework.cache.annotation.CachePut; import org.springframework.stereotype.Service; @@ -154,4 +155,12 @@ public class SysDictDataServiceImpl implements ISysDictDataService { return true; } + + // 清除指定dictType的缓存 + @CacheEvict(cacheNames = CacheNames.SYS_DICT, key = "#dictType") + public void clearDictTypeCache(String dictType) { + // 仅用于清除缓存 + } + + } diff --git a/fys-modules/fys-system/src/main/java/com/fuyuanshen/system/service/impl/SysDictTypeServiceImpl.java b/fys-modules/fys-system/src/main/java/com/fuyuanshen/system/service/impl/SysDictTypeServiceImpl.java index 822a2b87..692675c6 100644 --- a/fys-modules/fys-system/src/main/java/com/fuyuanshen/system/service/impl/SysDictTypeServiceImpl.java +++ b/fys-modules/fys-system/src/main/java/com/fuyuanshen/system/service/impl/SysDictTypeServiceImpl.java @@ -28,6 +28,7 @@ import com.fuyuanshen.system.domain.vo.SysDictTypeVo; import com.fuyuanshen.system.mapper.SysDictDataMapper; import com.fuyuanshen.system.mapper.SysDictTypeMapper; import com.fuyuanshen.system.service.ISysDictTypeService; +import org.springframework.cache.annotation.CacheEvict; import org.springframework.cache.annotation.CachePut; import org.springframework.cache.annotation.Cacheable; import org.springframework.stereotype.Service; @@ -294,4 +295,11 @@ public class SysDictTypeServiceImpl implements ISysDictTypeService, DictService return BeanUtil.copyToList(list, DictDataDTO.class); } + + // 清除指定dictType的缓存 + @CacheEvict(cacheNames = CacheNames.SYS_DICT, key = "#dictType") + public void clearDictTypeCache(String dictType) { + // 仅用于清除缓存 + } + } From bb11bc4dfa3824186f72bd6460aa873f261a5ad9 Mon Sep 17 00:00:00 2001 From: daiyongfei <974332738@qq.com> Date: Wed, 20 Aug 2025 15:13:43 +0800 Subject: [PATCH 3/4] =?UTF-8?q?WEB=E7=AB=AF=E8=A7=A3=E7=BB=91=E8=AE=BE?= =?UTF-8?q?=E5=A4=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../device/WEBDeviceController.java | 6 ++--- .../service/impl/WEBDeviceServiceImpl.java | 24 ++++++++++++++++++- 2 files changed, 26 insertions(+), 4 deletions(-) diff --git a/fys-admin/src/main/java/com/fuyuanshen/web/controller/device/WEBDeviceController.java b/fys-admin/src/main/java/com/fuyuanshen/web/controller/device/WEBDeviceController.java index 0d196762..71be5103 100644 --- a/fys-admin/src/main/java/com/fuyuanshen/web/controller/device/WEBDeviceController.java +++ b/fys-admin/src/main/java/com/fuyuanshen/web/controller/device/WEBDeviceController.java @@ -38,6 +38,7 @@ public class WEBDeviceController extends BaseController { private final WEBDeviceService deviceService; private final DeviceBizService appDeviceService; + /** * @param id * @return @@ -52,14 +53,12 @@ public class WEBDeviceController extends BaseController { } - - /** * 查询设备列表 */ @GetMapping("/list") public TableDataInfo list(DeviceQueryCriteria bo, PageQuery pageQuery) { - return appDeviceService.queryAppDeviceList(bo,pageQuery); + return appDeviceService.queryAppDeviceList(bo, pageQuery); } /** @@ -90,6 +89,7 @@ public class WEBDeviceController extends BaseController { /** * 重命名设备 + * * @param reNameDTO * @return */ diff --git a/fys-admin/src/main/java/com/fuyuanshen/web/service/impl/WEBDeviceServiceImpl.java b/fys-admin/src/main/java/com/fuyuanshen/web/service/impl/WEBDeviceServiceImpl.java index f38a2e88..7e328b8d 100644 --- a/fys-admin/src/main/java/com/fuyuanshen/web/service/impl/WEBDeviceServiceImpl.java +++ b/fys-admin/src/main/java/com/fuyuanshen/web/service/impl/WEBDeviceServiceImpl.java @@ -1,8 +1,13 @@ package com.fuyuanshen.web.service.impl; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.fuyuanshen.app.domain.AppDeviceBindRecord; +import com.fuyuanshen.app.mapper.AppDeviceBindRecordMapper; import com.fuyuanshen.equipment.domain.Device; import com.fuyuanshen.equipment.domain.DeviceAssignments; +import com.fuyuanshen.equipment.enums.BindingStatusEnum; import com.fuyuanshen.equipment.mapper.DeviceAssignmentsMapper; import com.fuyuanshen.equipment.mapper.DeviceMapper; import com.fuyuanshen.web.service.WEBDeviceService; @@ -10,6 +15,7 @@ import com.fuyuanshen.web.service.device.DeviceBizService; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; /** * @Description: @@ -25,6 +31,10 @@ public class WEBDeviceServiceImpl extends ServiceImpl impl private final DeviceAssignmentsMapper deviceAssignmentsMapper; + private final AppDeviceBindRecordMapper appDeviceBindRecordMapper; + + private final DeviceMapper deviceMapper; + /** * WEB端解绑设备 @@ -33,6 +43,7 @@ public class WEBDeviceServiceImpl extends ServiceImpl impl * @return */ @Override + @Transactional public int webUnBindDevice(Long id, Long userId) { // 设备端解绑 0:设备端解绑 1:web端解绑 int type = 1; @@ -44,7 +55,18 @@ public class WEBDeviceServiceImpl extends ServiceImpl impl id = deviceAssignments.getDeviceId(); type = 0; } - return appDeviceService.unBindDevice(id, userId, type); + + QueryWrapper deviceId = new QueryWrapper().eq("device_id", id); + + // appDeviceService.unBindDevice(id, userId, type); + UpdateWrapper deviceUpdateWrapper = new UpdateWrapper<>(); + deviceUpdateWrapper.eq("id", id) + .set("binding_user_id", null) + .set("binding_status", BindingStatusEnum.UNBOUND.getCode()) + .set("binding_time", null); + deviceMapper.update(null, deviceUpdateWrapper); + + return appDeviceBindRecordMapper.delete(deviceId); } From 5b6927729fec25386e9cc009ccc16a29918fe55e Mon Sep 17 00:00:00 2001 From: daiyongfei <974332738@qq.com> Date: Thu, 21 Aug 2025 15:17:11 +0800 Subject: [PATCH 4/4] =?UTF-8?q?WebApp=E7=94=A8=E6=88=B7=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../{AppUserController.java => WebAppUserController.java} | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) rename fys-modules/fys-app/src/main/java/com/fuyuanshen/app/controller/{AppUserController.java => WebAppUserController.java} (96%) diff --git a/fys-modules/fys-app/src/main/java/com/fuyuanshen/app/controller/AppUserController.java b/fys-modules/fys-app/src/main/java/com/fuyuanshen/app/controller/WebAppUserController.java similarity index 96% rename from fys-modules/fys-app/src/main/java/com/fuyuanshen/app/controller/AppUserController.java rename to fys-modules/fys-app/src/main/java/com/fuyuanshen/app/controller/WebAppUserController.java index 4c24feb5..34f6c959 100644 --- a/fys-modules/fys-app/src/main/java/com/fuyuanshen/app/controller/AppUserController.java +++ b/fys-modules/fys-app/src/main/java/com/fuyuanshen/app/controller/WebAppUserController.java @@ -24,7 +24,7 @@ import com.fuyuanshen.app.service.IAppUserService; import com.fuyuanshen.common.mybatis.core.page.TableDataInfo; /** - * APP用户信息 + * WebApp用户信息 * * @author Lion Li * @date 2025-06-27 @@ -32,8 +32,8 @@ import com.fuyuanshen.common.mybatis.core.page.TableDataInfo; @Validated @RequiredArgsConstructor @RestController -@RequestMapping("/app/user") -public class AppUserController extends BaseController { +@RequestMapping("/WebApp/user") +public class WebAppUserController extends BaseController { private final IAppUserService appUserService;