MemberController.java 7.82 KB
package com.subsidy.controller;

import com.subsidy.common.ResponseData;
import com.subsidy.common.ResponseVO;
import com.subsidy.common.interceptor.LoginRequired;
import com.subsidy.common.interceptor.TimeRequired;
import com.subsidy.dto.administer.VerifyCodeDTO;
import com.subsidy.dto.member.*;
import com.subsidy.model.ExerciseDoneResultDO;
import com.subsidy.model.MemberDO;
import com.subsidy.service.MemberService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 * 学生表 前端控制器
 * </p>
 *
 * @author DengMin
 * @since 2021-10-11
 */
@RestController
@Api(tags = "学生表")
@RequestMapping("/member")
public class MemberController {

    @Autowired
    private MemberService memberService;

    @PostMapping("getAll")
    @ApiOperation("查询某部门成员 pageNum pageSize departmentId userName status startDate endDate")
    @LoginRequired
    public ResponseVO getAll(@RequestBody GetAllDTO getAllDTO){
        return ResponseData.generateCreatedResponse(0,memberService.getAll(getAllDTO));
    }

    @PostMapping("deleteMember")
    @ApiOperation("删除成员 id ")
    @LoginRequired
    public ResponseVO deleteMember(@RequestBody MemberDO memberDO){
        return ResponseData.generateCreatedResponse(0,memberService.deleteMember(memberDO));
    }

    @PostMapping("addMember")
    @ApiOperation("新增成员 companyId userName accountName accountNameEn telephone gender image idCard departmentIds jobIds workNo inductionDate email")
    @LoginRequired
    public ResponseVO addMember(@RequestBody AddMemberDTO addMemberDTO){
        return ResponseData.generateCreatedResponse(0,memberService.addMember(addMemberDTO));
    }

    @PostMapping("updateMember")
    @ApiOperation("编辑成员 {id companyId userName accountName accountNameEn telephone gender image idCard status departmentIds jobIds}")
    @LoginRequired
    public ResponseVO updateMember(@RequestBody AddMemberDTO addMemberDTO){
        return ResponseData.generateCreatedResponse(0,memberService.updateMember(addMemberDTO));
    }

    @PostMapping(value = "/login")
    @ApiOperation("手机端:登录:telephone/手机号, verifyCode/验证码")
    public ResponseVO login(@RequestBody VerifyCodeDTO verifyCodeDTO) {
        return ResponseData.generateCreatedResponse(0, memberService.login(verifyCodeDTO));
    }

    @PostMapping("passwordLogin")
    @ApiOperation("手机端:密码登录 {  companyId accountName  password}")
    public ResponseVO passwordLogin(@RequestBody PasswordLoginDTO passwordLoginDTO){
        return ResponseData.generateCreatedResponse(0,memberService.passwordLogin(passwordLoginDTO));
    }

    @PostMapping("qingxuetangLogin")
    @ApiOperation("轻学堂登录 手机号mobile")
    @TimeRequired
    public ResponseVO qingxuetangLogin(@RequestBody QingxuetangLoginDTO qingxuetangLoginDTO){
        return ResponseData.generateCreatedResponse(0,memberService.qingxuetangLogin(qingxuetangLoginDTO));
    }

    @PostMapping("kunchiLogin")
    @ApiOperation("鲲驰登陆   authCorpName   手机号mobile  nickname  timestamp sign")
    @TimeRequired
    public ResponseVO kunchiLogin(@RequestBody QingxuetangLoginDTO qingxuetangLoginDTO){
        return ResponseData.generateCreatedResponse(0,memberService.kunchiLogin(qingxuetangLoginDTO));
    }

    @PostMapping("checkStatus")
    @ApiOperation("实名制验证状态   memberId")
    @TimeRequired
    public ResponseVO checkStatus(@RequestBody MemberDO memberDO){
        return ResponseData.generateCreatedResponse(0,memberService.checkStatus(memberDO));
    }

    @PostMapping("updatePassword")
    @ApiOperation("修改密码  {id  password}")
    @LoginRequired
    @TimeRequired
    public ResponseVO updatePassword(@RequestBody MemberDO memberDO){
        return ResponseData.generateCreatedResponse(0,memberService.updatePassword(memberDO));
    }

    @PostMapping("removeCheckImage")
    @ApiOperation("清除采集照片  id ")
    public ResponseVO removeCheckImage(@RequestBody MemberDO memberDO){
        return ResponseData.generateCreatedResponse(0,memberService.removeCheckImage(memberDO));
    }

    @PostMapping("myCourses")
    @ApiOperation("手机端:我的学习--课程  memberId 学员id  status 状态 0:全部 1:进行中 2:待开始 3:已完成 ")
//    @LoginRequired
    @TimeRequired
    public ResponseVO myCourses(@RequestBody MyCoursesDTO myCoursesDTO){
        return ResponseData.generateCreatedResponse(0,memberService.myCourses(myCoursesDTO));
    }

    @PostMapping("contentVod")
    @ApiOperation("手机端:目录+视频 classId 班级id courseId 课程  memberId 学员id")
//    @LoginRequired
    @TimeRequired
    public ResponseVO contentVod(@RequestBody ContentMemberDTO contentVodDTO){
        return ResponseData.generateCreatedResponse(0,memberService.contentVod(contentVodDTO));
    }

    @PostMapping("contentFiles")
    @ApiOperation("手机端:目录+课件 courseId 课程  memberId 学员id")
    @LoginRequired
    @TimeRequired
    public ResponseVO contentFiles(@RequestBody ContentMemberDTO contentMemberDTO){
        return ResponseData.generateCreatedResponse(0,memberService.contentFiles(contentMemberDTO));
    }

    @PostMapping("studyHistory")
    @ApiOperation("学习记录 memberId 成员id pageSize pageNum")
    @LoginRequired
    @TimeRequired
    public ResponseVO studyHistory(@RequestBody StudyHistoryDTO studyHistoryDTO){
        return ResponseData.generateCreatedResponse(0,memberService.studyHistory(studyHistoryDTO));
    }

    @PostMapping("getCourseTest")
    @ApiOperation("获取课程下的测试情况 {memberId 成员id  班级id  classId  courseId 课程id }")
    @LoginRequired
    @TimeRequired
    public ResponseVO getCourseTest(@RequestBody ContentMemberDTO contentMemberDTO){
        return ResponseData.generateCreatedResponse(0,memberService.getCourseTest(contentMemberDTO));
    }

    @PostMapping("getTestDoneDetail")
    @ApiOperation("获取某个测评学生的完成情况  paperId  memberId")
    @LoginRequired
    public ResponseVO getPaperDoneDetail(@RequestBody ExerciseDoneResultDO exerciseDoneResultDO){
        return ResponseData.generateCreatedResponse(0,memberService.getPaperDoneDetail(exerciseDoneResultDO));
    }

    @PostMapping("getStudyInfo")
    @ApiOperation("获取学生完成课程情况  id 学员id")
    @LoginRequired
    @TimeRequired
    public ResponseVO getStudyInfo(@RequestBody MemberDO memberDO){
        return ResponseData.generateCreatedResponse(0,memberService.getStudyInfo(memberDO));
    }

    @PostMapping("checkTimes")
    @ApiOperation("检测是否超过次数  memberId  paperId  classId")
    @LoginRequired
    public ResponseVO checkTimes(@RequestBody ExerciseDoneResultDO exerciseDoneResultDO){
        return ResponseData.generateCreatedResponse(0,memberService.checkTimes(exerciseDoneResultDO));
    }

    @PostMapping("importRedis")
    @ApiOperation("导入学生账号到redis")
    @LoginRequired
    public void importRedis(){
        memberService.importRedis();
    }

    @PostMapping("changeDepartments")
    @ApiOperation("修改部门   desDepId[] 目的部门 memberIds[] 成员id")
    @LoginRequired
    public ResponseVO changeDepartments(@RequestBody ChangeDepartmentsDTO changeDepartmentsDTO){
        return ResponseData.generateCreatedResponse(0,memberService.changeDepartments(changeDepartmentsDTO));
    }

    @PostMapping("qxy")
    @ApiOperation("Q学友授权  telephone 手机号")
    @TimeRequired
    public ResponseVO qxy(@RequestBody MemberDO memberDO){
        return ResponseData.generateCreatedResponse(0,memberService.qxy(memberDO));
    }

}