AdministerController.java 6.79 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.ClassDetailDTO;
import com.subsidy.dto.administer.OperatorsDTO;
import com.subsidy.model.AdministerDO;
import com.subsidy.model.ClassDictDO;
import com.subsidy.service.AdministerService;
import com.subsidy.util.ConstantUtils;
import com.subsidy.util.excel.ExcelUtil;
import com.subsidy.vo.administer.ExerciseTestVO;
import com.subsidy.vo.classdict.ClassDetailVO;
import com.subsidy.vo.member.ClassSignVO;
import com.subsidy.vo.sign.AnswerRecordVO;
import com.subsidy.vo.sign.ClassSignInfoVO;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import io.swagger.annotations.Api;
import org.springframework.web.multipart.MultipartFile;

import javax.servlet.http.HttpServletResponse;
import java.util.Arrays;
import java.util.List;

/**
 * <p>
 * 管理平台用户 前端控制器
 * </p>
 *
 * @author DengMin
 * @since 2021-10-11
 */
@RestController
@Api(tags = "管理平台用户")
@RequestMapping("/administer")
public class AdministerController {

    @Autowired
    private AdministerService administerService;

    @PostMapping("/login")
    @ApiOperation("登录接口 accountName password")
    public ResponseVO login(@RequestBody AdministerDO administerDO){
        return ResponseData.generateCreatedResponse(0,administerService.login(administerDO));
    }

    @PostMapping("/getPermissions")
    @ApiOperation("权限查询")
    @LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE})
    public ResponseVO getPermissions() {
        return ResponseData.generateCreatedResponse(0, administerService.getPermissions());
    }

    @PostMapping("/administers")
    @ApiOperation("查询所有运营者  { userName pageNum  pageSize }")
    @LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE})
    public ResponseVO operators(@RequestBody OperatorsDTO operatorsDTO){
        return ResponseData.generateCreatedResponse(0,administerService.operators(operatorsDTO));
    }

    @PostMapping("addAdminister")
    @ApiOperation("添加运营者 id userName 名称  accountName 账号 ")
    public ResponseVO addAdminister(@RequestBody AdministerDO administerDO){
        return ResponseData.generateCreatedResponse(0,administerService.addAdminister(administerDO));
    }

    @PostMapping("deleteAdminister")
    @ApiOperation("添加运营者 id ")
    public ResponseVO deleteAdminister(@RequestBody AdministerDO administerDO){
        return ResponseData.generateCreatedResponse(0,administerService.deleteAdminister(administerDO));
    }

    @PostMapping("updateAdminister")
    @ApiOperation("编辑运营者 id userName 名称  accountName 账号 password")
    public ResponseVO updateAdminister(@RequestBody AdministerDO administerDO){
        return ResponseData.generateCreatedResponse(0,administerService.updateAdminister(administerDO));
    }


    @PostMapping("classSummary")
    @ApiOperation("课程汇总  id 班级id  ")
    //@LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE})
    public ResponseVO classSummary(@RequestBody ClassDetailDTO classDetailDTO){
        return ResponseData.generateCreatedResponse(0,administerService.classSummary(classDetailDTO));
    }

    @PostMapping("classDetail")
    @ApiOperation("班级管理--班级成员  id 班级id  userName")
    @LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE})
    public ResponseVO classDetail(@RequestBody ClassDetailDTO classDetailDTO){
        return ResponseData.generateCreatedResponse(0,administerService.classDetail(classDetailDTO));
    }

    @PostMapping("exportClassDetail")
    @ApiOperation("班级管理--班级成员--导出  id 班级id  userName")
    @LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE})
    public void exportClassDetail(@RequestBody ClassDetailDTO classDetailDTO)throws Exception{
        classDetailDTO.setFlag(true);
       administerService.exportClassDetail(classDetailDTO);
    }

    @PostMapping("signDetail")
    @ApiOperation("班级管理--注册签到  id 班级id  userName")
    @LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE})
    public ResponseVO signDetail(@RequestBody ClassDetailDTO classDetailDTO){
        return ResponseData.generateCreatedResponse(0,administerService.signDetail(classDetailDTO));
    }

    @PostMapping("exportSignDetail")
    @ApiOperation("班级管理--注册签到  id 班级id  userName")
    @LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE})
    public void exportSignDetail(@RequestBody ClassDetailDTO classDetailDTO)throws Exception{
        classDetailDTO.setFlag(true);
        administerService.exportSignDetail(classDetailDTO);
    }

    @PostMapping("exerciseTest")
    @ApiOperation("班级管理--测评成绩  id 班级id  userName")
    @LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE})
    public ResponseVO exerciseTest(@RequestBody ClassDetailDTO classDetailDTO){
        return ResponseData.generateCreatedResponse(0,administerService.exerciseTest(classDetailDTO));
    }

    @PostMapping("exportExerciseTest")
    @ApiOperation("班级管理--测评成绩  id 班级id  userName")
    @LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE})
    public void exportExerciseTest(@RequestBody ClassDetailDTO classDetailDTO)throws Exception{
        classDetailDTO.setFlag(true);
        administerService.exportExerciseTest(classDetailDTO);
    }

    @PostMapping("answerRecord")
    @ApiOperation("班级管理--答疑  id 班级id  userName")
    @LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE})
    public ResponseVO answerRecord(@RequestBody ClassDetailDTO classDetailDTO){
        return ResponseData.generateCreatedResponse(0,administerService.answerRecord(classDetailDTO));
    }

    @PostMapping("exportAnswerRecord")
    @ApiOperation("班级管理--答疑  id 班级id  userName")
    @LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE})
    public void exportAnswerRecord(@RequestBody ClassDetailDTO classDetailDTO)throws Exception{
        classDetailDTO.setFlag(true);
        administerService.exportAnswerRecord(classDetailDTO);
    }

    @PostMapping("exportZip")
    @ApiOperation("下载压缩包 id 班级id")
    @CrossOrigin
    @LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE})
    public void exportZip(@RequestBody ClassDetailDTO classDetailDTO)throws Exception{
        administerService.export(classDetailDTO);
    }

    @PostMapping("importMember")
    @ApiOperation("导入学生  {companyId 公司id  file}")
    public ResponseVO importMember(Long companyId,@RequestParam("file") MultipartFile file){
        return ResponseData.generateCreatedResponse(0,administerService.importMember(companyId,file));
    }

}