ClassDictController.java 4.88 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.classDict.AddClassDTO;
import com.subsidy.dto.classDict.AddMemberToClassDTO;
import com.subsidy.dto.classDict.GetClassBaseInfoDTO;
import com.subsidy.dto.classDict.GetSpareMembersDTO;
import com.subsidy.model.ClassDictDO;
import com.subsidy.model.ClassMemberMappingDO;
import com.subsidy.service.ClassDictService;
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>
 * 班级id 前端控制器
 * </p>
 *
 * @author DengMin
 * @since 2021-10-12
 */
@RestController
@Api(tags = "班级")
@RequestMapping("/classDict")
public class ClassDictController {

    @Autowired
    private ClassDictService classDictService;

    @PostMapping("getAllClasses")
    @ApiOperation("获取某公司下的所有班级 companyId 所选企业id className 班级名称 openStatus 开放状态 startDate 开始时间 endDate 结束时间")
    @LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE})
    public ResponseVO getAllClasses(@RequestBody ClassDictDO classDictDO)throws Exception{
        return ResponseData.generateCreatedResponse(0,classDictService.getAllClasses(classDictDO));
    }

    @PostMapping("deleteClasses")
    @ApiOperation(" 删除班级 id")
    @LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE})
    public ResponseVO deleteClasses(@RequestBody ClassDictDO classDictDO){
        return ResponseData.generateCreatedResponse(0,classDictService.deleteClasses(classDictDO));
    }

    @PostMapping("addClass")
    @ApiOperation("添加班级 userId:登录人id  companyId courseId classTypeId className startDate endDate testRule 是否视频看完再做测试 isOrder 是否按照顺序播放 isFastPlay 是否快进 memberIds [] 班级学员 classNoticeDOS[noticeType  noticeTime]")
    @LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE})
    public ResponseVO addClass(@RequestBody AddClassDTO addClassDTO){
        return ResponseData.generateCreatedResponse(0,classDictService.addClass(addClassDTO));
    }

    @PostMapping("updateClass")
    @ApiOperation("修改班级 id  companyId className classTypeId startDate endDate")
    @LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE})
    public ResponseVO updateClass(@RequestBody ClassDictDO classDictDO){
        return ResponseData.generateCreatedResponse(0,classDictService.updateClass(classDictDO));
    }

    @PostMapping("classDetail")
    @ApiOperation("获取一个班级详情  id")
    //@LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE})
    public ResponseVO classDetail(@RequestBody ClassDictDO classDictDO){
        return ResponseData.generateCreatedResponse(0,classDictService.classDetail(classDictDO));
    }

    @PostMapping("removeMember")
    @ApiOperation("移除班级  classId  班级id  memberId人员id")
    @LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE})
    public ResponseVO removeMember(@RequestBody ClassMemberMappingDO classMemberMappingDO){
        return ResponseData.generateCreatedResponse(0,classDictService.removeMember(classMemberMappingDO));
    }

    @PostMapping("getSpareMembers")
    @ApiOperation("获取不在某班级的某企业里所有成员   companyId 企业id  classId 班级id")
    @LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE})
    public ResponseVO getSpareMembers(@RequestBody GetSpareMembersDTO getSpareMembersDTO){
        return ResponseData.generateCreatedResponse(0,classDictService.getSpareMembers(getSpareMembersDTO));
    }

    @PostMapping("addMemberToClass")
    @ApiOperation("将多个成员加入到某个班级里   classId  memberIds []")
    @LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE})
    public ResponseVO addMemberToClass(@RequestBody AddMemberToClassDTO addMemberToClassDTO){
        return ResponseData.generateCreatedResponse(0,classDictService.addMemberToClass(addMemberToClassDTO));
    }

    @PostMapping("batchSms")
    @ApiOperation(" 批量发送班级短信通知  {id 班级id   }")
    public ResponseVO batchSms(@RequestBody ClassDictDO classDictDO){
        return ResponseData.generateCreatedResponse(0,classDictService.batchSms(classDictDO));
    }

    @PostMapping("getClassBaseInfo")
    @ApiOperation("班级详情--获取课程基本信息  id")
    public ResponseVO getClassBaseInfo(@RequestBody GetClassBaseInfoDTO getClassBaseInfoDTO){
        return ResponseData.generateCreatedResponse(0,classDictService.getClassBaseInfo(getClassBaseInfoDTO));
    }



}