ProjectJudgeController.java 4.28 KB
package com.zhongzhi.controller;

import com.zhongzhi.common.constant.Platform;
import com.zhongzhi.common.utils.LoginRequired;
import com.zhongzhi.common.utils.ResponseData;
import com.zhongzhi.dto.administer.LoginDTO;
import com.zhongzhi.dto.judge.ProjectJudgePageDTO;
import com.zhongzhi.model.ProjectJudgeDO;
import com.zhongzhi.service.ProjectJudgeService;
import com.zhongzhi.vo.ResponseVO;
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;
import org.springframework.web.multipart.MultipartFile;

/**
 * <p>
 * 项目评审员 前端控制器
 * </p>
 *
 * @author DengMin
 * @since 2021-05-28
 */
@RestController
@Api(tags = "评委")
@RequestMapping("/projectJudge")
public class ProjectJudgeController {

    @Autowired
    private ProjectJudgeService projectJudgeService;

    @PostMapping(value = "/login")
    @ApiOperation("评审端 --- 登录:telephone/手机号、code/验证码")
    public ResponseVO login(@RequestBody LoginDTO loginDTO) {
        return ResponseData.generateCreatedResponse(0, projectJudgeService.login(loginDTO));
    }

    @PostMapping(value = "/getProjectJudgePage")
    @LoginRequired({Platform.center})
    @ApiOperation("中心端 ---评委列表:username/姓名、status/状态、pageNo/当前页数、 pageSize/每页显示条数")
    public ResponseVO getProjectJudgePage(@RequestBody ProjectJudgePageDTO projectJudgePageDTO) {
        return ResponseData.generateCreatedResponse(0, projectJudgeService.getProjectJudgePage(projectJudgePageDTO));
    }

    @PostMapping(value = "/createProjectJudge")
    @LoginRequired({Platform.center})
    @ApiOperation("中心端 ---添加评委:username/姓名、telephone/手机号、 position/职位、unit/单位")
    public ResponseVO createProjectJudge(@RequestBody ProjectJudgeDO projectJudgeDO) {
        projectJudgeService.createProjectJudge(projectJudgeDO);
        return ResponseData.generateCreatedResponse(0);
    }

    @PostMapping(value = "/updateProjectJudge")
    @LoginRequired({Platform.center})
    @ApiOperation("中心端 ---编辑评委:id/ID、username/姓名、telephone/手机号、 position/职位、unit/单位, status/状态(1:启用,0:禁用)")
    public ResponseVO updateProjectJudge(@RequestBody ProjectJudgeDO projectJudgeDO) {
        projectJudgeService.updateProjectJudge(projectJudgeDO);
        return ResponseData.generateCreatedResponse(0);
    }

    @PostMapping(value = "/delete")
    @LoginRequired({Platform.center})
    @ApiOperation("中心端 ---删除评委:id/ID")
    public ResponseVO delete(@RequestBody ProjectJudgeDO projectJudgeDO) {
        projectJudgeService.removeById(projectJudgeDO.getId());
        return ResponseData.generateCreatedResponse(0);
    }

    @PostMapping(value = "/projectJudgesAssigned")
    @LoginRequired({Platform.center})
    @ApiOperation("中心端 ---已分配项目评委列表: matchId/赛事ID、projectGroup/组别、projectSchedule/进度")
    public ResponseVO projectJudgesAssigned(@RequestBody ProjectJudgePageDTO projectJudgePageDTO) {
        return ResponseData.generateCreatedResponse(0, projectJudgeService.projectJudgesAssigned(projectJudgePageDTO));
    }

    @PostMapping(value = "/downloadJudgeTemplate")
    @LoginRequired({Platform.center})
    @ApiOperation("中心端 ---下载导入评委模板")
    public ResponseVO downloadJudgeTemplate() {
        projectJudgeService.downloadTemplate();
        return ResponseData.generateCreatedResponse(0);
    }

    @PostMapping(value = "/importJudge")
    @LoginRequired({Platform.center})
    @ApiOperation("中心端 ---导入评委:file/文件(数据格式:Form-Data)")
    public ResponseVO importJudge(MultipartFile file) {
        projectJudgeService.importJudge(file);
        return ResponseData.generateCreatedResponse(0);
    }

    @PostMapping(value = "/exportProjectJudge")
    @LoginRequired({Platform.center})
    @ApiOperation("中心端 ---导出评委")
    public void exportProjectJudge() {
        projectJudgeService.exportProjectJudge();
    }

}