From 645e5448919612d5772d74d29fb2f2bb2f9bf951 Mon Sep 17 00:00:00 2001 From: yaowanxin <3588231647@qq.com> Date: 星期一, 04 八月 2025 16:11:06 +0800 Subject: [PATCH] 调整数据存储 --- cnas-device/src/main/java/com/ruoyi/device/controller/WeightController.java | 10 +++++++++- 1 files changed, 9 insertions(+), 1 deletions(-) diff --git a/cnas-device/src/main/java/com/ruoyi/device/controller/WeightController.java b/cnas-device/src/main/java/com/ruoyi/device/controller/WeightController.java index 6e51c4c..763ac61 100644 --- a/cnas-device/src/main/java/com/ruoyi/device/controller/WeightController.java +++ b/cnas-device/src/main/java/com/ruoyi/device/controller/WeightController.java @@ -39,7 +39,15 @@ // return ResponseEntity.internalServerError().body("鏁版嵁澶勭悊澶辫触: " + e.getMessage()); // } if(Objects.nonNull(weightRequest) && CollectionUtil.isNotEmpty(weightRequest.getWeights())){ - RedisUtil.lSet(WeightRequestDto.DENSITY,weightRequest.getWeights()); + List<?> objectList = RedisUtil.lGet(WeightRequestDto.DENSITY, 0, -1); + if(CollectionUtil.isNotEmpty(objectList)){ + // 鍒犻櫎 Redis 涓棫鐨勫垪琛ㄦ暟鎹� + RedisUtil.del(WeightRequestDto.DENSITY); + // 瀛樺叆鏂扮殑鏁版嵁 + RedisUtil.lSet(WeightRequestDto.DENSITY, weightRequest.getWeights()); + }else { + RedisUtil.lSet(WeightRequestDto.DENSITY,weightRequest.getWeights()); + } return Result.success(null,"淇濆瓨鎴愬姛"); } return Result.fail(); -- Gitblit v1.9.3