Crazy 7 月之前
父節點
當前提交
b5f82d1411

+ 19 - 22
yudao-module-md/yudao-module-md-biz/src/main/java/cn/iocoder/yudao/module/md/service/AcsService.java

@@ -301,11 +301,9 @@ public class AcsService {
                     if (msg.contains("下发人脸成功") && msg.contains("但是有异常情况")) {
                         return "更新人脸失败,请检查照片大小和";
                     } else {
-                        if (user != null) {
-                            user.setPhotoUpdateTime(LocalDateTime.now());
-                            user.setPhotoUrl(photoUrl);
-                            userService.updateUser((BeanUtils.toBean(user, UserSaveReqVO.class)));
-                        }
+                        user.setPhotoUpdateTime(LocalDateTime.now());
+                        user.setPhotoUrl(photoUrl);
+                        userService.updateUser((BeanUtils.toBean(user, UserSaveReqVO.class)));
                         return "更新人脸成功";
                     }
                 } else {//考勤及里面没用户
@@ -326,11 +324,9 @@ public class AcsService {
                             String msg = addFaceByUrl(userNumber, photoUrl);
                             if (msg.contains("下发人脸成功") && msg.contains("但是有异常情况")) {
                             } else {
-                                if (user != null) {
-                                    user.setPhotoUpdateTime(LocalDateTime.now());
-                                    user.setPhotoUrl(photoUrl);
-                                    userService.updateUser((BeanUtils.toBean(user, UserSaveReqVO.class)));
-                                }
+                                user.setPhotoUpdateTime(LocalDateTime.now());
+                                user.setPhotoUrl(photoUrl);
+                                userService.updateUser((BeanUtils.toBean(user, UserSaveReqVO.class)));
                             }
                         } catch (JSONException e) {
                             throw new RuntimeException(e);
@@ -415,20 +411,21 @@ public class AcsService {
         attendanceImportRespVO respVO = attendanceImportRespVO.builder().createUsernames(new ArrayList<>())
                 .existUsernames(new ArrayList<>()).failureUsernames(new LinkedHashMap<>()).build();
         importUsers.forEach(importUser -> {
-
                 try {
-                    String result = getUser(importUser.getEmployeeNo());
+                    if (importUser.getEmployeeNo()!=null&&importUser.getName()!=null) {
+                        String result = getUser(importUser.getEmployeeNo());
                         Gson gson = new Gson();
-                            JsonObject jsonObject = gson.fromJson(result, JsonObject.class);
-                            JsonArray userInfoArray = jsonObject
-                                    .getAsJsonObject("UserInfoSearch")
-                                    .getAsJsonArray("UserInfo");
-                            if (userInfoArray==null) {//没有userInfo
-                                UserManage.addUserInfo(lUserID, importUser.getEmployeeNo(), importUser.getName());
-                                respVO.getCreateUsernames().add(importUser.getName());
-                            }else{
-                                respVO.getExistUsernames().add(importUser.getName());
-                            }
+                        JsonObject jsonObject = gson.fromJson(result, JsonObject.class);
+                        JsonArray userInfoArray = jsonObject
+                                .getAsJsonObject("UserInfoSearch")
+                                .getAsJsonArray("UserInfo");
+                        if (userInfoArray == null) {//没有userInfo
+                            UserManage.addUserInfo(lUserID, importUser.getEmployeeNo(), importUser.getName());
+                            respVO.getCreateUsernames().add(importUser.getName());
+                        } else {
+                            respVO.getExistUsernames().add(importUser.getName());
+                        }
+                    }
                 } catch (UnsupportedEncodingException | InterruptedException | JSONException e) {
                     throw new RuntimeException("添加用户信息失败: " + e.getMessage(), e);
                 }

+ 4 - 2
yudao-module-system/yudao-module-system-biz/src/main/resources/Mapper/AdminUserMapper/AdminUserMapper.xml

@@ -44,9 +44,11 @@
         <if test="reqVO.userType != null">
             AND a.user_type = #{reqVO.userType}
         </if>
+
         <if test="reqVO.grade != null and reqVO.grade != ''">
-            AND a.grade LIKE CONCAT('%', #{reqVO.grade}, '%')
+            AND a.grade LIKE CONCAT('%', #{reqVO.grade.substring(0, 4)}, '%')
         </if>
+
         <if test="reqVO.supervisorId != null">
             AND a.supervisor_id = #{reqVO.supervisorId}
         </if>
@@ -130,7 +132,7 @@
             AND a.user_type = #{reqVO.userType}
         </if>
         <if test="reqVO.grade != null and reqVO.grade != ''">
-            AND a.grade LIKE CONCAT('%', #{reqVO.grade}, '%')
+            AND a.grade LIKE CONCAT('%', #{reqVO.grade.substring(0, 4)}, '%')
         </if>
         <if test="reqVO.supervisorId != null">
             AND a.supervisor_id = #{reqVO.supervisorId}