Blame view

ProjectJudgeController.java 4.28 KB
涂亚平 committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103
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();
    }

}