|
@@ -9,8 +9,6 @@ import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
|
|
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
|
|
import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
|
|
|
import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils;
|
|
|
-import cn.iocoder.yudao.module.infra.api.file.FileApi;
|
|
|
-import cn.iocoder.yudao.module.infra.service.file.FileService;
|
|
|
import cn.iocoder.yudao.module.system.controller.admin.dept.vo.dept.DeptListReqVO;
|
|
|
import cn.iocoder.yudao.module.system.controller.admin.user.vo.user.*;
|
|
|
|
|
@@ -22,7 +20,6 @@ import cn.iocoder.yudao.module.system.service.dept.DeptService;
|
|
|
import cn.iocoder.yudao.module.system.service.permission.PermissionService;
|
|
|
import cn.iocoder.yudao.module.system.service.user.AdminUserService;
|
|
|
|
|
|
-import com.baomidou.mybatisplus.generator.IFill;
|
|
|
import io.swagger.v3.oas.annotations.Operation;
|
|
|
import io.swagger.v3.oas.annotations.Parameter;
|
|
|
import io.swagger.v3.oas.annotations.Parameters;
|
|
@@ -72,44 +69,11 @@ public class UserController {
|
|
|
}else if (reqVO.getUserType().equals("4")){
|
|
|
roleId.add(114L);
|
|
|
}
|
|
|
+ permissionService.assignUserRole(id,roleId);
|
|
|
}
|
|
|
- permissionService.assignUserRole(id,roleId);
|
|
|
return success(id);
|
|
|
}
|
|
|
|
|
|
-// @PostMapping("/createStudent")
|
|
|
-// @Operation(summary = "新增学生")
|
|
|
-// @PreAuthorize("@ss.hasPermission('system:user:createStudent')")
|
|
|
-// public CommonResult<Long> createStudent(@Valid @RequestBody UserSaveReqVO reqVO) {
|
|
|
-// reqVO.setUserType("1");
|
|
|
-// Long id = userService.createUser(reqVO);
|
|
|
-// Set<Long> roleId = new HashSet<>();
|
|
|
-// if (reqVO.getUserType()!=null){//添加权限
|
|
|
-// if (reqVO.getUserType().equals("1") ||reqVO.getUserType().equals("2")) {
|
|
|
-// roleId.add(112L);//学生
|
|
|
-// }
|
|
|
-// }
|
|
|
-// permissionService.assignUserRole(id,roleId);
|
|
|
-// return success(id);
|
|
|
-// }
|
|
|
-//
|
|
|
-// @PostMapping("/createTeacher")
|
|
|
-// @Operation(summary = "新增导师")
|
|
|
-// @PreAuthorize("@ss.hasPermission('system:user:createTeacher')")
|
|
|
-// public CommonResult<Long> createTeacher(@Valid @RequestBody UserSaveReqVO reqVO) {
|
|
|
-// reqVO.setUserType("2");
|
|
|
-// Long id = userService.createUser(reqVO);
|
|
|
-// Set<Long> roleId = new HashSet<>();
|
|
|
-// if (reqVO.getUserType()!=null){//添加权限
|
|
|
-// if (reqVO.getUserType().equals("3")) {
|
|
|
-// roleId.add(113L);//学生
|
|
|
-// }
|
|
|
-// }
|
|
|
-// permissionService.assignUserRole(id,roleId);
|
|
|
-// return success(id);
|
|
|
-// }
|
|
|
-
|
|
|
-
|
|
|
@PutMapping("update")
|
|
|
@Operation(summary = "修改用户")
|
|
|
@PreAuthorize("@ss.hasPermission('system:user:update')")
|
|
@@ -222,49 +186,13 @@ public class UserController {
|
|
|
pageResult.getTotal()));
|
|
|
}
|
|
|
|
|
|
-
|
|
|
- @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()));
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- @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();
|
|
|
+ UserPageReqVO reqVO =new UserPageReqVO();
|
|
|
+ List<AdminUserDO> deptUser = userService.getDeptUser(reqVO);
|
|
|
return success(deptUser);
|
|
|
}
|
|
|
|
|
@@ -275,19 +203,18 @@ public class UserController {
|
|
|
return success(deptUser);
|
|
|
}
|
|
|
|
|
|
+ //工作间详情
|
|
|
@GetMapping("/DeptSupervisor")
|
|
|
@Operation(summary = "获得工作间下的导师")
|
|
|
public CommonResult<List<AdminUserDO>> getDeptSupervisor(Long deptId) {
|
|
|
- if (deptId ==null){
|
|
|
- deptId =SecurityFrameworkUtils.getLoginUserDeptId();
|
|
|
- }
|
|
|
UserPageReqVO reqVO =new UserPageReqVO();
|
|
|
reqVO.setDeptId(deptId);
|
|
|
reqVO.setUserType("3");
|
|
|
- List<AdminUserDO> deptUser = userService.getUserPage(reqVO).getList();
|
|
|
+ List<AdminUserDO> deptUser = userService.getUserList(reqVO);
|
|
|
return success(deptUser);
|
|
|
}
|
|
|
|
|
|
+
|
|
|
//lsq学院和导师
|
|
|
@GetMapping("/graduateStudentPage")
|
|
|
@Operation(summary = "根据登录人获得毕业生分页列表")
|
|
@@ -338,6 +265,8 @@ public class UserController {
|
|
|
return success(UserConvert.INSTANCE.convert(user, dept));
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+
|
|
|
@GetMapping("/export")
|
|
|
@Operation(summary = "导出用户")
|
|
|
@PreAuthorize("@ss.hasPermission('system:user:export')")
|
|
@@ -353,8 +282,44 @@ public class UserController {
|
|
|
UserConvert.INSTANCE.convertList(list, deptMap));
|
|
|
}
|
|
|
|
|
|
+ @GetMapping("/exportTeacher")
|
|
|
+ @Operation(summary = "导出导师")
|
|
|
+ @PreAuthorize("@ss.hasPermission('system:user:ExportTeacher')")
|
|
|
+ @ApiAccessLog(operateType = EXPORT)
|
|
|
+ public void exportTeacherList(@Validated UserPageReqVO exportReqVO,
|
|
|
+ HttpServletResponse response) throws IOException {
|
|
|
+ exportReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
|
|
|
+ List<teacherImportExcelVO> list = BeanUtils.toBean(userService.getUserPage0(exportReqVO).getList(),teacherImportExcelVO.class) ;
|
|
|
+ // 输出 Excel
|
|
|
+ ExcelUtils.write(response, "导师数据.xls", "数据", teacherImportExcelVO.class, list);
|
|
|
+ }
|
|
|
+
|
|
|
+ @GetMapping("/exportStudent")
|
|
|
+ @Operation(summary = "导出在校生")
|
|
|
+ @PreAuthorize("@ss.hasPermission('system:user:exportStudent')")
|
|
|
+ @ApiAccessLog(operateType = EXPORT)
|
|
|
+ public void exportStudentList(@Validated UserPageReqVO exportReqVO,
|
|
|
+ HttpServletResponse response) throws IOException {
|
|
|
+ exportReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
|
|
|
+ List<teacherImportExcelVO> list = BeanUtils.toBean(userService.getUserPage1(exportReqVO).getList(),teacherImportExcelVO.class) ;
|
|
|
+ // 输出 Excel
|
|
|
+ ExcelUtils.write(response, "导师数据.xls", "数据", teacherImportExcelVO.class, list);
|
|
|
+ }
|
|
|
+ @GetMapping("/exportGraduate")
|
|
|
+ @Operation(summary = "导出毕业生")
|
|
|
+ @PreAuthorize("@ss.hasPermission('system:user:exportGraduate')")
|
|
|
+ @ApiAccessLog(operateType = EXPORT)
|
|
|
+ public void exportGraduateList(@Validated UserPageReqVO exportReqVO,
|
|
|
+ HttpServletResponse response) throws IOException {
|
|
|
+ exportReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
|
|
|
+ List<teacherImportExcelVO> list = BeanUtils.toBean(userService.getGraduateStudentPage(exportReqVO).getList(),teacherImportExcelVO.class) ;
|
|
|
+ // 输出 Excel
|
|
|
+ ExcelUtils.write(response, "导师数据.xls", "数据", teacherImportExcelVO.class, list);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
@GetMapping("/get-import-template")
|
|
|
- @Operation(summary = "获得在校生模板")
|
|
|
+ @Operation(summary = "获得用户模板")
|
|
|
public void importTemplate(HttpServletResponse response) throws IOException {
|
|
|
// 手动创建导出 demo
|
|
|
List<UserImportExcelVO> list = Arrays.asList(
|
|
@@ -366,15 +331,27 @@ public class UserController {
|
|
|
ExcelUtils.write(response, "用户导入模板.xls", "用户列表", UserImportExcelVO.class, list);
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+ @GetMapping("/get-import-SchoolTemplate")
|
|
|
+ @Operation(summary = "获得在校生模板")
|
|
|
+ public void importInSchoolTemplate(HttpServletResponse response) throws IOException {
|
|
|
+ List<StudentImportExcelVO> list = Arrays.asList(
|
|
|
+ StudentImportExcelVO.builder().username("Student").password("123456").email("2456125438@qq.com").mobile("15601691300")
|
|
|
+ .nickname("在校生").userType("在校生").status(CommonStatusEnum.ENABLE.getStatus()).sex(SexEnum.MALE.getSex())
|
|
|
+ .build()
|
|
|
+ );
|
|
|
+ ExcelUtils.write(response, "在校生导入模板.xls", "用户列表", StudentImportExcelVO.class, list);
|
|
|
+ }
|
|
|
+
|
|
|
@GetMapping("/get-import-graduateTemplate")
|
|
|
@Operation(summary = "获得毕业生模板")
|
|
|
public void importGraduateTemplate(HttpServletResponse response) throws IOException {
|
|
|
List<graduateStudentImportExcelVO> list = Arrays.asList(
|
|
|
graduateStudentImportExcelVO.builder().username("graduateStudent").password("123456").email("2456125438@qq.com").mobile("15601691300")
|
|
|
- .nickname("测试000").userType("毕业生").status(CommonStatusEnum.ENABLE.getStatus()).sex(SexEnum.MALE.getSex())
|
|
|
+ .nickname("毕业生").userType("毕业生").status(CommonStatusEnum.ENABLE.getStatus()).sex(SexEnum.MALE.getSex())
|
|
|
.build()
|
|
|
);
|
|
|
- ExcelUtils.write(response, "用户导入模板.xls", "用户列表", graduateStudentImportExcelVO.class, list);
|
|
|
+ ExcelUtils.write(response, "毕业生.xls", "用户列表", graduateStudentImportExcelVO.class, list);
|
|
|
}
|
|
|
|
|
|
@GetMapping("/get-import-teacherTemplate")
|
|
@@ -382,14 +359,58 @@ public class UserController {
|
|
|
public void importTeacherTemplate(HttpServletResponse response) throws IOException {
|
|
|
List<teacherImportExcelVO> list = Arrays.asList(
|
|
|
teacherImportExcelVO.builder().username("teacher").password("123456").email("2456125438@qq.com").mobile("15601691300").deptName("2#601")
|
|
|
- .nickname("测试000") .userType("导师").status(CommonStatusEnum.ENABLE.getStatus()).sex(SexEnum.MALE.getSex())
|
|
|
+ .nickname("导师") .userType("导师").status(CommonStatusEnum.ENABLE.getStatus()).sex(SexEnum.MALE.getSex())
|
|
|
.build()
|
|
|
);
|
|
|
- ExcelUtils.write(response, "用户导入模板.xls", "用户列表", teacherImportExcelVO.class, list);
|
|
|
+ ExcelUtils.write(response, "导师导入模板.xls", "用户列表", teacherImportExcelVO.class, list);
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
+ @PostMapping("/importTeacher")
|
|
|
+ @Operation(summary = "导入导师")
|
|
|
+ @Parameters({
|
|
|
+ @Parameter(name = "file", description = "Excel 文件", required = true),
|
|
|
+ @Parameter(name = "updateSupport", description = "是否支持更新,默认为 false", example = "true")
|
|
|
+ })
|
|
|
+ @PreAuthorize("@ss.hasPermission('system:user:importTeacher')")
|
|
|
+ public CommonResult<UserImportRespVO> importTeacherExcel(@RequestParam("file") MultipartFile file,
|
|
|
+ @RequestParam(value = "updateSupport", required = false, defaultValue = "false") Boolean updateSupport) throws Exception {
|
|
|
+ List<teacherImportExcelVO> list = ExcelUtils.read(file, teacherImportExcelVO.class);
|
|
|
+
|
|
|
+ return success(userService.importTeacherList(list, updateSupport));
|
|
|
+ }
|
|
|
+
|
|
|
+ @PostMapping("/importGraduateStudent")
|
|
|
+ @Operation(summary = "导入毕业生")
|
|
|
+ @Parameters({
|
|
|
+ @Parameter(name = "file", description = "Excel 文件", required = true),
|
|
|
+ @Parameter(name = "updateSupport", description = "是否支持更新,默认为 false", example = "true")
|
|
|
+ })
|
|
|
+ @PreAuthorize("@ss.hasPermission('system:user:importGraduateStudent')")
|
|
|
+ public CommonResult<UserImportRespVO> importGraduateExcel(@RequestParam("file") MultipartFile file,
|
|
|
+ @RequestParam(value = "updateSupport", required = false, defaultValue = "false") Boolean updateSupport) throws Exception {
|
|
|
+ List<graduateStudentImportExcelVO> list = ExcelUtils.read(file, graduateStudentImportExcelVO.class);
|
|
|
+
|
|
|
+ return success(userService.importGraduateList(list, updateSupport));
|
|
|
+ }
|
|
|
+
|
|
|
+ @PostMapping("/importSchoolStudent")
|
|
|
+ @Operation(summary = "导入在校生")
|
|
|
+ @Parameters({
|
|
|
+ @Parameter(name = "file", description = "Excel 文件", required = true),
|
|
|
+ @Parameter(name = "updateSupport", description = "是否支持更新,默认为 false", example = "true")
|
|
|
+ })
|
|
|
+ @PreAuthorize("@ss.hasPermission('system:user:importSchoolStudent')")
|
|
|
+ public CommonResult<UserImportRespVO> importSchoolStudentExcel(@RequestParam("file") MultipartFile file,
|
|
|
+ @RequestParam(value = "updateSupport", required = false, defaultValue = "false") Boolean updateSupport) throws Exception {
|
|
|
+ List<StudentImportExcelVO> list = ExcelUtils.read(file, StudentImportExcelVO.class);
|
|
|
+
|
|
|
+ return success(userService.importSchoolStudentList(list, updateSupport));
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
@PostMapping("/import")
|
|
|
@Operation(summary = "导入用户")
|
|
|
@Parameters({
|
|
@@ -425,8 +446,8 @@ public class UserController {
|
|
|
public CommonResult<Map<String,Integer>> getDetail() throws Exception {
|
|
|
UserPageReqVO reqVO= new UserPageReqVO();
|
|
|
DeptListReqVO deptVO =new DeptListReqVO();
|
|
|
- List<AdminUserDO> studnetList = userService.getUserPage(reqVO.setUserType("1")).getList();
|
|
|
- List<AdminUserDO> teacherList = userService.getUserPage(reqVO.setUserType("3")).getList();
|
|
|
+ List<AdminUserDO> studnetList = userService.getUserList(reqVO.setUserType("1"));
|
|
|
+ List<AdminUserDO> teacherList = userService.getUserList(reqVO.setUserType("3"));
|
|
|
|
|
|
Integer studentNum =studnetList.size();
|
|
|
Integer teacherNum =teacherList.size();
|