Browse Source

info增加name字段

dzx 1 year ago
parent
commit
b8013b78bd

+ 19 - 0
src/main/java/com/xjrsoft/module/attendance/controller/AttendanceRuleCategoryController.java

@@ -20,6 +20,12 @@ import com.xjrsoft.module.attendance.entity.AttendanceRuleCategory;
 import com.xjrsoft.module.attendance.service.IAttendanceRuleCategoryService;
 import com.xjrsoft.module.attendance.vo.AttendanceRuleCategoryPageVo;
 import com.xjrsoft.module.attendance.vo.AttendanceRuleCategoryVo;
+import com.xjrsoft.module.base.entity.BaseClass;
+import com.xjrsoft.module.base.service.IBaseClassService;
+import com.xjrsoft.module.concat.service.IXjrUserService;
+import com.xjrsoft.module.organization.entity.Department;
+import com.xjrsoft.module.organization.service.IDepartmentService;
+import com.xjrsoft.module.teacher.entity.XjrUser;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import lombok.AllArgsConstructor;
@@ -50,6 +56,9 @@ public class AttendanceRuleCategoryController {
 
 
     private final IAttendanceRuleCategoryService attendanceRuleCategoryService;
+    private final IBaseClassService classService;
+    private final IDepartmentService departmentService;
+    private final IXjrUserService xjrUserService;
 
     @GetMapping(value = "/page")
     @ApiOperation(value="考勤规则列表(分页)")
@@ -80,6 +89,16 @@ public class AttendanceRuleCategoryController {
             List<AddAttendanceUserRelationDto> attendanceUserRelationList = new ArrayList<>();
             for (JsonElement jsonElement : asJsonArray) {
                 AddAttendanceUserRelationDto relationDto = JSONUtil.toBean(jsonElement.getAsJsonObject().toString(), AddAttendanceUserRelationDto.class);
+                if(relationDto.getUserId() != null){
+                    XjrUser xjrUser = xjrUserService.getById(relationDto.getUserId());
+                    relationDto.setName(xjrUser.getName());
+                }else if(relationDto.getDeptId() != null){
+                    Department department = departmentService.getById(relationDto.getDeptId());
+                    relationDto.setName(department.getName());
+                }else if(relationDto.getClassId() != null){
+                    BaseClass aClass = classService.getById(relationDto.getClassId());
+                    relationDto.setName(aClass.getName());
+                }
                 attendanceUserRelationList.add(relationDto);
             }
             categoryVo.setAttendanceUserRelationList(attendanceUserRelationList);

+ 3 - 5
src/main/java/com/xjrsoft/module/attendance/dto/AddAttendanceUserRelationDto.java

@@ -33,10 +33,8 @@ public class AddAttendanceUserRelationDto implements Serializable {
     */
     @ApiModelProperty("用id")
     private Long userId;
-    /**
-    * 考勤规则(attendance_rule_category)
-    */
-    @ApiModelProperty("考勤规则(attendance_rule_category)")
-    private Long attendanceRuleCategoryId;
+
+    @ApiModelProperty("名称")
+    private String name;
 
 }