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


import com.subsidy.common.ResponseData;
import com.subsidy.common.ResponseVO;
import com.subsidy.common.interceptor.LoginRequired;
import com.subsidy.dto.administer.VerifyCodeDTO;
import com.subsidy.dto.member.AddMemberDTO;
import com.subsidy.dto.member.ContentMemberDTO;
import com.subsidy.dto.member.GetAllDTO;
import com.subsidy.dto.member.PasswordLoginDTO;
import com.subsidy.dto.member.StudyHistoryDTO;
import com.subsidy.model.ExerciseDoneResultDO;
import com.subsidy.model.MemberDO;
import com.subsidy.service.MemberService;
import com.subsidy.util.ConstantUtils;
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")
    @LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE})
    public ResponseVO getAll(@RequestBody GetAllDTO getAllDTO){
        return ResponseData.generateCreatedResponse(0,memberService.getAll(getAllDTO));
    }

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

    @PostMapping("addMember")
    @ApiOperation("新增成员 companyId departmentId userName accountName telephone gender image idCard")
    @LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE})
    public ResponseVO addMember(@RequestBody AddMemberDTO addMemberDTO){
        return ResponseData.generateCreatedResponse(0,memberService.addMember(addMemberDTO));
    }

    @PostMapping("updateMember")
    @ApiOperation("编辑成员 {id companyId departmentId userName accountName telephone gender image idCard status}")
    @LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE})
    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("updatePassword")
    @ApiOperation("修改密码  {id  password}")
    public ResponseVO updatePassword(@RequestBody MemberDO memberDO){
        return ResponseData.generateCreatedResponse(0,memberService.updatePassword(memberDO));
    }

    @PostMapping("studyPage")
    @ApiOperation("手机端:学习主页  id 学员id")
    public ResponseVO studyPage(@RequestBody MemberDO memberDO){
        return ResponseData.generateCreatedResponse(0,memberService.studyPage(memberDO));
    }

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

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

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

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

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

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

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

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


}