MemberController.java 5.03 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.StudyHistoryDTO;
import com.subsidy.model.MemberDO;
import com.subsidy.service.MemberService;
import com.subsidy.util.ConstantUtils;
import com.subsidy.vo.member.ContentVodVO;
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;
import io.swagger.annotations.Api;

/**
 * <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("新增成员 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 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("手机端:密码登录 {accountName  password}")
    public ResponseVO passwordLogin(@RequestBody MemberDO memberDO){
        return ResponseData.generateCreatedResponse(0,memberService.passwordLogin(memberDO));
    }

    @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("学习记录 id 成员id pageSize pageNum")
    public ResponseVO studyHistory(@RequestBody StudyHistoryDTO studyHistoryDTO){
        return ResponseData.generateCreatedResponse(0,memberService.studyHistory(studyHistoryDTO));
    }

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

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


}