From 40946aa2d6a10ee78755a06d29af901e3fc2004e Mon Sep 17 00:00:00 2001 From: liyongde <1419499670@qq.com> Date: Wed, 16 Aug 2023 17:12:04 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E5=BC=82=E5=B8=B8=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/org/nl/common/utils/RedisUtils.java | 2 +- .../service/secutiry/impl/OnlineUserService.java | 15 +++------------ .../acs/service/impl/AcsToWmsServiceImpl.java | 16 ++++------------ 3 files changed, 8 insertions(+), 25 deletions(-) diff --git a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/common/utils/RedisUtils.java b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/common/utils/RedisUtils.java index ec2d2bb..e70d42d 100644 --- a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/common/utils/RedisUtils.java +++ b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/common/utils/RedisUtils.java @@ -94,7 +94,7 @@ public class RedisUtils { /** * 查找匹配key - * + * 例如:online-* : 就会选择key是online-开头的数据 * @param pattern key * @return / */ diff --git a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/system/service/secutiry/impl/OnlineUserService.java b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/system/service/secutiry/impl/OnlineUserService.java index 24be8e2..ec0188a 100644 --- a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/system/service/secutiry/impl/OnlineUserService.java +++ b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/system/service/secutiry/impl/OnlineUserService.java @@ -118,21 +118,12 @@ public class OnlineUserService { * @return / */ public List getAll(String filter){ - List keys = redisUtils.scan("*"); + List keys = redisUtils.scan("oline-*"); Collections.reverse(keys); List onlineUserDtos = new ArrayList<>(); for (String key : keys) { - if (key.startsWith("oline-")) { - OnlineUserDto onlineUserDto = (OnlineUserDto) redisUtils.get(key); - if(StrUtil.isNotEmpty(filter)){ - if(onlineUserDto.toString().contains(filter)){ - onlineUserDtos.add(onlineUserDto); - } - } else { - onlineUserDtos.add(onlineUserDto); - } - } - + OnlineUserDto onlineUserDto = (OnlineUserDto) redisUtils.get(key); + onlineUserDtos.add(onlineUserDto); } onlineUserDtos.sort((o1, o2) -> o2.getLoginTime().compareTo(o1.getLoginTime())); return onlineUserDtos; diff --git a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/acs/service/impl/AcsToWmsServiceImpl.java b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/acs/service/impl/AcsToWmsServiceImpl.java index 7cabdb5..c112a73 100644 --- a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/acs/service/impl/AcsToWmsServiceImpl.java +++ b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/acs/service/impl/AcsToWmsServiceImpl.java @@ -499,9 +499,7 @@ public class AcsToWmsServiceImpl implements AcsToWmsService { ApplyTaskResponse taskResponse = ApplyTaskResponse.responseOk(requestNo); SchBasePoint basePoint = pointService.getById(baseRequest.getDevice_code()); if (ObjectUtil.isEmpty(baseRequest.getVehicle_code())) { - taskResponse.setCode(HttpStatus.HTTP_BAD_REQUEST); - taskResponse.setMessage("载具编码不能为空!"); - return taskResponse; + throw new BadRequestException("载具编码不能为空!"); } if (ObjectUtil.isEmpty(baseRequest.getVehicle_type())) { baseRequest.setVehicle_type(GeneralDefinition.MATERIAL_CUP); @@ -511,24 +509,18 @@ public class AcsToWmsServiceImpl implements AcsToWmsService { baseRequest.getVehicle_type(), GroupBindMaterialStatusEnum.BOUND.getValue()); if (ObjectUtil.isEmpty(one)) { // 返回400,物料不存在 - taskResponse.setCode(HttpStatus.HTTP_BAD_REQUEST); - taskResponse.setMessage("组盘不存在或已静置完成!"); - return taskResponse; + throw new BadRequestException("组盘不存在或已静置完成!"); } String yjDeviceCode = basePoint.getParent_point_code(); // 压机设备编码 // 获取当前工单 PdmBdWorkorder productionTask = workorderService.getDeviceProductionTask(yjDeviceCode); // 校验物料是否正确 if (ObjectUtil.isEmpty(productionTask)) { - taskResponse.setCode(HttpStatus.HTTP_BAD_REQUEST); - taskResponse.setMessage("压机" + yjDeviceCode + "工单不存在!"); - return taskResponse; + throw new BadRequestException("压机" + yjDeviceCode + "工单不存在!"); } String rawMaterialCode = productionTask.getRaw_material_code(); if (!rawMaterialCode.equals(one.getRedundance_material_code())) { - taskResponse.setCode(HttpStatus.HTTP_BAD_REQUEST); - taskResponse.setMessage("物料不一样!"); - return taskResponse; + throw new BadRequestException("物料不一样!"); } // 判断是否静置完成