|
@@ -30,6 +30,7 @@ import java.io.IOException;
|
|
|
import java.util.Arrays;
|
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
|
+import java.util.Objects;
|
|
|
|
|
|
import static cn.iocoder.yudao.framework.apilog.core.enums.OperateTypeEnum.EXPORT;
|
|
|
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
|
@@ -53,6 +54,13 @@ public class UserController {
|
|
|
Long id = userService.createUser(reqVO);
|
|
|
return success(id);
|
|
|
}
|
|
|
+ @PostMapping("/create_teacher")
|
|
|
+ @Operation(summary = "新增教师")
|
|
|
+ @PreAuthorize("@ss.hasPermission('system:teacher:create')")
|
|
|
+ public CommonResult<Long> createStudent(@Valid @RequestBody UserSaveReqVO reqVO) {
|
|
|
+ Long id = userService.createUser(reqVO);
|
|
|
+ return success(id);
|
|
|
+ }
|
|
|
|
|
|
@PutMapping("update")
|
|
|
@Operation(summary = "修改用户")
|
|
@@ -102,6 +110,143 @@ public class UserController {
|
|
|
return success(new PageResult<>(UserConvert.INSTANCE.convertList(pageResult.getList(), deptMap),
|
|
|
pageResult.getTotal()));
|
|
|
}
|
|
|
+ //lsq
|
|
|
+ @GetMapping("/page0")
|
|
|
+ @Operation(summary = "获得老师分页列表")
|
|
|
+ @PreAuthorize("@ss.hasPermission('system:user:teacherList')")
|
|
|
+ public CommonResult<PageResult<UserRespVO>> getUserPage0(@Valid UserPageReqVO pageReqVO) {
|
|
|
+ // 获得用户分页列表
|
|
|
+ PageResult<AdminUserDO> pageResult = userService.getUserPage0(pageReqVO);
|
|
|
+ if (CollUtil.isEmpty(pageResult.getList())) {
|
|
|
+ return success(new PageResult<>(pageResult.getTotal()));
|
|
|
+ }
|
|
|
+ // 拼接数据
|
|
|
+ Map<Long, DeptDO> deptMap = deptService.getDeptMap(
|
|
|
+ convertList(pageResult.getList(), AdminUserDO::getDeptId));
|
|
|
+ return success(new PageResult<>(UserConvert.INSTANCE.convertList(pageResult.getList(), deptMap),
|
|
|
+ pageResult.getTotal()));
|
|
|
+ }
|
|
|
+
|
|
|
+ //lsq
|
|
|
+ @GetMapping("/page1")
|
|
|
+ @Operation(summary = "获得学生分页列表")
|
|
|
+ @PreAuthorize("@ss.hasPermission('system:user:studentList')")
|
|
|
+ public CommonResult<PageResult<UserRespVO>> getUserPage1(@Valid UserPageReqVO pageReqVO) {
|
|
|
+ // 获得用户分页列表
|
|
|
+ PageResult<AdminUserDO> pageResult = userService.getUserPage1(pageReqVO);
|
|
|
+ if (CollUtil.isEmpty(pageResult.getList())) {
|
|
|
+ return success(new PageResult<>(pageResult.getTotal()));
|
|
|
+ }
|
|
|
+ // 拼接数据
|
|
|
+ Map<Long, DeptDO> deptMap = deptService.getDeptMap(
|
|
|
+ convertList(pageResult.getList(), AdminUserDO::getDeptId));
|
|
|
+ return success(new PageResult<>(UserConvert.INSTANCE.convertList(pageResult.getList(), deptMap),
|
|
|
+ pageResult.getTotal()));
|
|
|
+ }
|
|
|
+ //lsq
|
|
|
+ @GetMapping("/DeptTeacherPage")
|
|
|
+ @Operation(summary = "获得工作间教师分页列表")
|
|
|
+ @PreAuthorize("@ss.hasPermission('system:workroom:teacherList')")
|
|
|
+ public CommonResult<PageResult<UserRespVO>> getDeptTeacherPage(@Valid UserPageReqVO pageReqVO) {
|
|
|
+ // 获得用户分页列表
|
|
|
+ PageResult<AdminUserDO> pageResult = userService.getDeptTeacherPage(pageReqVO);
|
|
|
+ if (CollUtil.isEmpty(pageResult.getList())) {
|
|
|
+ return success(new PageResult<>(pageResult.getTotal()));
|
|
|
+ }
|
|
|
+ // 拼接数据
|
|
|
+ Map<Long, DeptDO> deptMap = deptService.getDeptMap(
|
|
|
+ convertList(pageResult.getList(), AdminUserDO::getDeptId));
|
|
|
+ return success(new PageResult<>(UserConvert.INSTANCE.convertList(pageResult.getList(), deptMap),
|
|
|
+ pageResult.getTotal()));
|
|
|
+ }
|
|
|
+
|
|
|
+ //lsq
|
|
|
+ @GetMapping("/DeptStudentPage")
|
|
|
+ @Operation(summary = "获得工作间学生分页列表")
|
|
|
+ @PreAuthorize("@ss.hasPermission('system:workroom:studentlist')")
|
|
|
+ public CommonResult<PageResult<UserRespVO>> getDeptStudentPage(@Valid UserPageReqVO pageReqVO) {
|
|
|
+ // 获得用户分页列表
|
|
|
+ PageResult<AdminUserDO> pageResult = userService.getDeptStudentPage(pageReqVO);
|
|
|
+ if (CollUtil.isEmpty(pageResult.getList())) {
|
|
|
+ return success(new PageResult<>(pageResult.getTotal()));
|
|
|
+ }
|
|
|
+ // 拼接数据
|
|
|
+ Map<Long, DeptDO> deptMap = deptService.getDeptMap(
|
|
|
+ convertList(pageResult.getList(), AdminUserDO::getDeptId));
|
|
|
+ return success(new PageResult<>(UserConvert.INSTANCE.convertList(pageResult.getList(), deptMap),
|
|
|
+ pageResult.getTotal()));
|
|
|
+ }
|
|
|
+
|
|
|
+ //lsq
|
|
|
+ @GetMapping("/DeptUser")
|
|
|
+ @Operation(summary = "获得工作间人员")
|
|
|
+ public CommonResult<List<AdminUserDO>> getDeptUser() {
|
|
|
+ // 获得用户分页列表
|
|
|
+ List<AdminUserDO> deptUser = userService.getDeptUser();
|
|
|
+ return success(deptUser);
|
|
|
+ }
|
|
|
+ @GetMapping("/supervisor")
|
|
|
+ @Operation(summary = "获得所有导师")
|
|
|
+ public CommonResult<List<AdminUserDO>> getSupervisor() {
|
|
|
+ List<AdminUserDO> deptUser = userService.getSupervisor();
|
|
|
+ return success(deptUser);
|
|
|
+ }
|
|
|
+
|
|
|
+ //lsq学院
|
|
|
+ @GetMapping("/graduateStudentPage")
|
|
|
+ @Operation(summary = "学院获得毕业生分页列表")
|
|
|
+ @PreAuthorize("@ss.hasPermission('system:user:graduateStudentList')")
|
|
|
+ public CommonResult<PageResult<UserRespVO>> getGraduateStudentPage(@Valid UserPageReqVO pageReqVO) {
|
|
|
+ // 获得用户分页列表
|
|
|
+ PageResult<AdminUserDO> pageResult = userService.getGraduateStudentPage(pageReqVO);
|
|
|
+
|
|
|
+ // 循环处理每个毕业生
|
|
|
+ for (AdminUserDO student : pageResult.getList()) {
|
|
|
+ // 根据 supervisorId 查询导师信息
|
|
|
+ if (student.getSupervisorId()!=null) {
|
|
|
+ AdminUserDO supervisorUser = userService.getUser(student.getSupervisorId());
|
|
|
+ String supervisor = supervisorUser.getNickname();
|
|
|
+ String mobile =supervisorUser.getMobile();
|
|
|
+ // 赋值给 对应 字段
|
|
|
+ student.setSupervisor(supervisor);
|
|
|
+ student.setSupervisorMobile(mobile);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (CollUtil.isEmpty(pageResult.getList())) {
|
|
|
+ return success(new PageResult<>(pageResult.getTotal()));
|
|
|
+ }
|
|
|
+ // 拼接数据
|
|
|
+ Map<Long, DeptDO> deptMap = deptService.getDeptMap(
|
|
|
+ convertList(pageResult.getList(), AdminUserDO::getDeptId));
|
|
|
+ return success(new PageResult<>(UserConvert.INSTANCE.convertList(pageResult.getList(), deptMap),
|
|
|
+ pageResult.getTotal()));
|
|
|
+ }
|
|
|
+
|
|
|
+ //lsq导师
|
|
|
+ @GetMapping("/graduateStudentTPage")
|
|
|
+ @Operation(summary = "导师获得毕业生分页列表")
|
|
|
+ @PreAuthorize("@ss.hasPermission('system:user:graduateStudentTList')")
|
|
|
+ public CommonResult<PageResult<UserRespVO>> getGraduateStudentTPage(@Valid UserPageReqVO pageReqVO) {
|
|
|
+ PageResult<AdminUserDO> pageResult = userService.getGraduateStudentTPage(pageReqVO);
|
|
|
+ for (AdminUserDO student : pageResult.getList()) {
|
|
|
+ if (student.getSupervisorId()!=null) {
|
|
|
+ AdminUserDO supervisorUser = userService.getUser(student.getSupervisorId());
|
|
|
+ String supervisor = supervisorUser.getNickname();
|
|
|
+ String mobile =supervisorUser.getMobile();
|
|
|
+
|
|
|
+ student.setSupervisor(supervisor);
|
|
|
+ student.setSupervisorMobile(mobile);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (CollUtil.isEmpty(pageResult.getList())) {
|
|
|
+ return success(new PageResult<>(pageResult.getTotal()));
|
|
|
+ }
|
|
|
+ // 拼接数据
|
|
|
+ Map<Long, DeptDO> deptMap = deptService.getDeptMap(
|
|
|
+ convertList(pageResult.getList(), AdminUserDO::getDeptId));
|
|
|
+ return success(new PageResult<>(UserConvert.INSTANCE.convertList(pageResult.getList(), deptMap),
|
|
|
+ pageResult.getTotal()));
|
|
|
+ }
|
|
|
|
|
|
@GetMapping({"/list-all-simple", "/simple-list"})
|
|
|
@Operation(summary = "获取用户精简信息列表", description = "只包含被开启的用户,主要用于前端的下拉选项")
|
|
@@ -119,6 +264,12 @@ public class UserController {
|
|
|
@PreAuthorize("@ss.hasPermission('system:user:query')")
|
|
|
public CommonResult<UserRespVO> getUser(@RequestParam("id") Long id) {
|
|
|
AdminUserDO user = userService.getUser(id);
|
|
|
+ //毕业生专属
|
|
|
+ if (user.getSupervisorId()!=null && Objects.equals(user.getUserType(), "2")) {
|
|
|
+ AdminUserDO supervisorUser = userService.getUser(user.getSupervisorId());
|
|
|
+ String supervisor = supervisorUser.getNickname();
|
|
|
+ user.setSupervisor(supervisor);
|
|
|
+ }
|
|
|
if (user == null) {
|
|
|
return success(null);
|
|
|
}
|
|
@@ -169,4 +320,28 @@ public class UserController {
|
|
|
return success(userService.importUserList(list, updateSupport));
|
|
|
}
|
|
|
|
|
|
-}
|
|
|
+
|
|
|
+
|
|
|
+ //毕业生
|
|
|
+ @GetMapping("/get-import-GraduateStudentTemplate")
|
|
|
+ @Operation(summary = "获得导入用户模板")
|
|
|
+ public void importGraduateStudentTemplate(HttpServletResponse response) throws IOException {
|
|
|
+ // 手动创建导出 demo
|
|
|
+ List<graduateStudentImportExcelVO> list = Arrays.asList(
|
|
|
+ graduateStudentImportExcelVO.builder().username("zhang").email("yunai@iocoder.cn").mobile("15601691300")
|
|
|
+ .nickname("张三").sex(SexEnum.MALE.getSex()).grade("2020").major("遥感科学与技术")
|
|
|
+ .userNumber("33333333").email("").mobile("").workPlace("").supervisor("").supervisorMobile("")
|
|
|
+ .build(),
|
|
|
+
|
|
|
+
|
|
|
+ graduateStudentImportExcelVO.builder().username("").email("yunai@iocoder.cn").mobile("15601691300")
|
|
|
+ .nickname("李四").sex(SexEnum.MALE.getSex()).grade("2020").major("遥感科学与技术")
|
|
|
+ .userNumber("33333333").email("").mobile("").workPlace("").supervisor("").supervisorMobile("")
|
|
|
+ .build()
|
|
|
+ );
|
|
|
+ // 输出
|
|
|
+ ExcelUtils.write(response, "用户导入模板.xls", "用户列表", graduateStudentImportExcelVO.class, list);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+}
|