瀏覽代碼

解决查看考勤规则接口报错问题

dzx 1 年之前
父節點
當前提交
2debc9f005

+ 10 - 3
src/main/java/com/xjrsoft/module/attendance/controller/AttendanceRuleCategoryController.java

@@ -91,13 +91,20 @@ public class AttendanceRuleCategoryController {
                 AddAttendanceUserRelationDto relationDto = JSONUtil.toBean(jsonElement.getAsJsonObject().toString(), AddAttendanceUserRelationDto.class);
                 if(relationDto.getUserId() != null){
                     XjrUser xjrUser = xjrUserService.getById(relationDto.getUserId());
-                    relationDto.setName(xjrUser.getName());
+                    if(xjrUser != null){
+                        relationDto.setName(xjrUser.getName());
+                    }
                 }else if(relationDto.getDeptId() != null){
                     Department department = departmentService.getById(relationDto.getDeptId());
-                    relationDto.setName(department.getName());
+                    if(department != null){
+                        relationDto.setName(department.getName());
+                    }
+
                 }else if(relationDto.getClassId() != null){
                     BaseClass aClass = classService.getById(relationDto.getClassId());
-                    relationDto.setName(aClass.getName());
+                    if(aClass != null){
+                        relationDto.setName(aClass.getName());
+                    }
                 }
                 attendanceUserRelationList.add(relationDto);
             }