|
@@ -0,0 +1,138 @@
|
|
|
+package com.citu.module.menduner.system.controller.admin.person;
|
|
|
+
|
|
|
+import cn.hutool.core.collection.CollUtil;
|
|
|
+import com.citu.framework.common.pojo.CommonResult;
|
|
|
+import com.citu.framework.common.pojo.PageResult;
|
|
|
+import com.citu.framework.common.util.object.BeanUtils;
|
|
|
+import com.citu.framework.idempotent.core.annotation.Idempotent;
|
|
|
+import com.citu.framework.idempotent.core.keyresolver.impl.UserIdempotentKeyResolver;
|
|
|
+import com.citu.framework.security.core.annotations.PreAuthenticated;
|
|
|
+import com.citu.module.menduner.common.util.LoginUserContext;
|
|
|
+import com.citu.module.menduner.system.controller.app.jobhunt.person.student.AppStudentSaveReqVO;
|
|
|
+import com.citu.module.menduner.system.controller.base.enterprise.vo.EnterpriseBaseSimpleRespVO;
|
|
|
+import com.citu.module.menduner.system.controller.base.major.MajorRespVO;
|
|
|
+import com.citu.module.menduner.system.controller.base.person.student.StudentRespVO;
|
|
|
+import com.citu.module.menduner.system.controller.base.person.student.evaluate.StudentPracticeEvaluateSaveReqVO;
|
|
|
+import com.citu.module.menduner.system.controller.base.person.student.record.StudentPracticeRecordDetailRespVO;
|
|
|
+import com.citu.module.menduner.system.controller.base.person.student.record.StudentPracticeRecordPageReqVO;
|
|
|
+import com.citu.module.menduner.system.controller.base.person.student.report.StudentPracticeReportRespVO;
|
|
|
+import com.citu.module.menduner.system.controller.base.person.student.report.StudentPracticeReportSaveReqVO;
|
|
|
+import com.citu.module.menduner.system.controller.base.school.SchoolOrganizationRespVO;
|
|
|
+import com.citu.module.menduner.system.dal.dataobject.enterprise.EnterpriseDO;
|
|
|
+import com.citu.module.menduner.system.dal.dataobject.person.StudentDO;
|
|
|
+import com.citu.module.menduner.system.dal.dataobject.school.SchoolOrganizationDO;
|
|
|
+import com.citu.module.menduner.system.service.enterprise.EnterpriseService;
|
|
|
+import com.citu.module.menduner.system.service.major.MajorService;
|
|
|
+import com.citu.module.menduner.system.service.person.info.PersonInfoService;
|
|
|
+import com.citu.module.menduner.system.service.person.student.StudentPracticeEvaluateService;
|
|
|
+import com.citu.module.menduner.system.service.person.student.StudentPracticeRecordService;
|
|
|
+import com.citu.module.menduner.system.service.person.student.StudentPracticeReportService;
|
|
|
+import com.citu.module.menduner.system.service.person.student.StudentService;
|
|
|
+import com.citu.module.menduner.system.service.school.SchoolInfoService;
|
|
|
+import com.citu.module.menduner.system.service.school.SchoolOrganizationService;
|
|
|
+import io.swagger.v3.oas.annotations.Operation;
|
|
|
+import io.swagger.v3.oas.annotations.tags.Tag;
|
|
|
+import org.springframework.security.access.prepost.PreAuthorize;
|
|
|
+import org.springframework.validation.annotation.Validated;
|
|
|
+import org.springframework.web.bind.annotation.*;
|
|
|
+
|
|
|
+import javax.annotation.Resource;
|
|
|
+import javax.validation.Valid;
|
|
|
+import java.util.List;
|
|
|
+import java.util.Map;
|
|
|
+
|
|
|
+import static com.citu.framework.common.exception.util.ServiceExceptionUtil.exception;
|
|
|
+import static com.citu.framework.common.pojo.CommonResult.success;
|
|
|
+import static com.citu.module.menduner.system.enums.ErrorCodeConstants.MDE_COMMON_USER_ID_NOT_NULL;
|
|
|
+
|
|
|
+@Tag(name = "管理后台 - 学生信息")
|
|
|
+@RestController
|
|
|
+@RequestMapping("/menduner/system/student")
|
|
|
+@Validated
|
|
|
+public class StudentController {
|
|
|
+
|
|
|
+ @Resource
|
|
|
+ private StudentPracticeRecordService studentPracticeRecordService;
|
|
|
+ @Resource
|
|
|
+ private StudentPracticeEvaluateService evaluateService;
|
|
|
+ @Resource
|
|
|
+ private StudentPracticeReportService reportService;
|
|
|
+ @Resource
|
|
|
+ private EnterpriseService enterpriseService;
|
|
|
+ @Resource
|
|
|
+ private StudentService studentService;
|
|
|
+ @Resource
|
|
|
+ private PersonInfoService personInfoService;
|
|
|
+
|
|
|
+ @Resource
|
|
|
+ private SchoolInfoService schoolInfoService;
|
|
|
+ @Resource
|
|
|
+ private SchoolOrganizationService schoolOrganizationService;
|
|
|
+ @Resource
|
|
|
+ private MajorService majorService;
|
|
|
+
|
|
|
+
|
|
|
+ @PostMapping("/save")
|
|
|
+ @Operation(summary = "保存学生基本信息")
|
|
|
+ @PreAuthorize("@ss.hasPermission('menduner:system:person-info:update')")
|
|
|
+ public CommonResult<Boolean> saveStudentInfo(@Valid @RequestBody AppStudentSaveReqVO reqVO) {
|
|
|
+ if(null == reqVO.getUserId()) {
|
|
|
+ throw exception(MDE_COMMON_USER_ID_NOT_NULL);
|
|
|
+ }
|
|
|
+ personInfoService.saveStudentInfo(reqVO.getUserId(),reqVO);
|
|
|
+ return success(true);
|
|
|
+ }
|
|
|
+
|
|
|
+ @PostMapping("/get")
|
|
|
+ @Operation(summary = "获取学生基本信息")
|
|
|
+ @PreAuthorize("@ss.hasPermission('menduner:system:person-info:query')")
|
|
|
+ public CommonResult<StudentRespVO> get(@RequestParam("userId") Long userId) {
|
|
|
+ StudentDO student =
|
|
|
+ studentService.getStudentInfo(userId);
|
|
|
+ StudentRespVO resp = BeanUtils.toBean(student, StudentRespVO.class);
|
|
|
+ if (null != resp) {
|
|
|
+ resp.setSchoolInfo(schoolInfoService.getBySchoolId(resp.getSchoolId()));
|
|
|
+ SchoolOrganizationDO dept = schoolOrganizationService.getSchoolOrganization(resp.getSchoolDeptId());
|
|
|
+ resp.setSchoolDept(BeanUtils.toBean(dept, SchoolOrganizationRespVO.class));
|
|
|
+ SchoolOrganizationDO schoolClass = schoolOrganizationService.getSchoolOrganization(resp.getSchoolClassId());
|
|
|
+ resp.setSchoolClass(BeanUtils.toBean(schoolClass, SchoolOrganizationRespVO.class));
|
|
|
+ resp.setMajor(BeanUtils.toBean(majorService.getMajor(resp.getMajorId()), MajorRespVO.class));
|
|
|
+
|
|
|
+ }
|
|
|
+ return success(resp);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ @GetMapping("/record/page")
|
|
|
+ @Operation(summary = "获得学生实习记录分页")
|
|
|
+ @PreAuthorize("@ss.hasPermission('menduner:system:person-info:query')")
|
|
|
+ public CommonResult<PageResult<StudentPracticeRecordDetailRespVO>> page
|
|
|
+ (StudentPracticeRecordPageReqVO reqVO) {
|
|
|
+ return success(studentPracticeRecordService.page(reqVO.getUserId(), reqVO));
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ @GetMapping("/get/report/list")
|
|
|
+ @Operation(summary = "获取学生实习报告列表")
|
|
|
+ @PreAuthorize("@ss.hasPermission('menduner:system:person-info:query')")
|
|
|
+ public CommonResult<Map<String, List<StudentPracticeReportRespVO>>> getReportList
|
|
|
+ (@RequestParam(value = "userId") Long userId) {
|
|
|
+ return success(reportService.getReportList(null,userId));
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ @GetMapping("/record-enterprise/list")
|
|
|
+ @Operation(summary = "获取学生实习的企业列表")
|
|
|
+ @PreAuthorize("@ss.hasPermission('menduner:system:person-info:query')")
|
|
|
+ public CommonResult<List<EnterpriseBaseSimpleRespVO>> getRecordEnterpriseId(@RequestParam(value = "userId") Long userId) {
|
|
|
+ List<Long> enterpriseIds = studentPracticeRecordService.getRecordEnterpriseId(userId);
|
|
|
+ if (CollUtil.isNotEmpty(enterpriseIds)) {
|
|
|
+ List<EnterpriseDO> enterpriseList = enterpriseService.getByIdList(enterpriseIds);
|
|
|
+ return success(BeanUtils.toBean(enterpriseList, EnterpriseBaseSimpleRespVO.class));
|
|
|
+ }
|
|
|
+ return success(null);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+}
|