根据提供的`git diff`记录,以下是针对两个Java类`InBoxManageServiceImpl`和`InVehicleManageServiceImpl`的代码评审: ### InBoxManageServiceImpl.java ```java diff --git a/lms/nladmin-system/src/main/java/org/nl/b_lms/storage_manage/ios/service/iostorInv/util/impl/InBoxManageServiceImpl.java b/lms/nladmin-system/src/main/java/org/nl/b_lms/storage_manage/ios/service/iostorInv/util/impl/InBoxManageServiceImpl.java index f2df03e..b4dc820 100644 --- a/lms/nladmin-system/src/main/java/org/nl/b_lms/storage_manage/ios/service/iostorInv/util/impl/InBoxManageServiceImpl.java +++ b/lms/nladmin-system/src/main/java/org/nl/b_lms/storage_manage/ios/service/iostorInv/util/impl/InBoxManageServiceImpl.java @@ -102,7 +102,7 @@ // Review: // The original code used 'box_arr' to refer to the "box_no" in the query, but it is not defined in the snippet. // It is assumed that 'box_arr' should be replaced with 'whereJson.getString("box_no")' to avoid potential NPE. WQLObject attrTab = WQLObject.getWQLObject("st_ivt_structattr"); - String box_arr = whereJson.getString("box_no"); + String boxNo = whereJson.getString("box_no"); int count = ischBaseTaskService.count(new QueryWrapper() - .eq("start_device_code", whereJson.getString("device_code")) + .eq("point_code1", whereJson.getString("device_code")) .eq("vehicle_code", boxNo) // Assuming boxNo is the correct variable to use here .eq("task_type", "010702") .lt("task_status", TaskStatusEnum.FINISHED.getCode())); ``` **Review Comments:** 1. **Variable Naming:** The variable `box_arr` is not defined in the snippet provided. It should be replaced with `whereJson.getString("box_no")` to avoid a possible `NullPointerException`. 2. **Code Clarity:** It would be clearer to define `whereJson.getString("box_no")` as a variable, such as `boxNo`, and use that variable throughout the code. ### InVehicleManageServiceImpl.java ```java diff --git a/lms/nladmin-system/src/main/java/org/nl/b_lms/storage_manage/ios/service/iostorInv/util/impl/InVehicleManageServiceImpl.java b/lms/nladmin-system/src/main/java/org/nl/b_lms/storage_manage/ios/service/iostorInv/util/impl/InVehicleManageServiceImpl.java index 83c47cd..7c69b2b 100644 --- a/lms/nladmin-system/src/main/java/org/nl/b_lms/storage_manage/ios/service/iostorInv/util/impl/InVehicleManageServiceImpl.java +++ b/lms/nladmin-system/src/main/java/org/nl/b_lms/storage_manage/ios/service/iostorInv/util/impl/InVehicleManageServiceImpl.java index 83c47cd..7c69b2b 100644 @@ -71,7 +71,7 @@ // Review: // Similar to the previous class, the original code used 'vehicle_code' directly in the query, which could be a potential NPE. // It is assumed that the correct variable should be used to avoid a potential NullPointerException. int count = ischBaseTaskService.count(new QueryWrapper() - .eq("start_device_code", whereJson.getString("device_code")) + .eq("point_code1", whereJson.getString("device_code")) .eq("vehicle_code", whereJson.getString("vehicle_code")) .eq("task_type", "010705") .lt("task_status", TaskStatusEnum.EXECUTING.getCode())); ``` **Review Comments:** 1. **Variable Naming:** The `vehicle_code` is used directly in the query without checking if it is null or not. It should be wrapped in a null check or replaced with a defined variable that has been validated for null. 2. **Code Clarity:** Similar to the `InBoxManageServiceImpl`, it would be clearer to define `whereJson.getString("vehicle_code")` as a variable and use that variable in the query.