Blame view

CollegesDictController.java 13.1 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 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278
package com.zhongzhi.controller;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.zhongzhi.common.constant.Platform;
import com.zhongzhi.common.utils.LoginRequired;
import com.zhongzhi.common.utils.ResponseData;
import com.zhongzhi.dto.college.*;
import com.zhongzhi.dto.project.EditStatusDTO;
import com.zhongzhi.model.*;
import com.zhongzhi.service.CollegesDictService;
import com.zhongzhi.vo.ResponseVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.commons.lang3.StringUtils;
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;

import java.net.ResponseCache;

/**
 * <p>
 * 院校字典表 前端控制器
 * </p>
 *
 * @author DengMin
 * @since 2021-04-28
 */
@RestController
@Api(tags = "就读院校")
@RequestMapping("/collegesDict")
public class CollegesDictController {

    @Autowired
    public CollegesDictService collegesDictService;

    @PostMapping(value = "/getCollegesList")
    @ApiOperation("查询所有就读院校: name/院校名称, education/学历")
    public ResponseVO getCollegesList(@RequestBody CollegesDictDTO collegesDictDTO) {
        QueryWrapper<CollegesDictDO> queryWrapper = new QueryWrapper();
        if (StringUtils.isNotBlank(collegesDictDTO.getEducation())) {
            if ("中职".equals(collegesDictDTO.getEducation())){
                queryWrapper.lambda().eq(CollegesDictDO::getEducation, collegesDictDTO.getEducation());
            }else {
                queryWrapper.lambda().like(CollegesDictDO::getEducation, collegesDictDTO.getEducation());
            }
        }

        if (StringUtils.isNotBlank(collegesDictDTO.getName())) {
            queryWrapper.lambda().like(CollegesDictDO::getName, collegesDictDTO.getName());
        }
        queryWrapper.lambda().eq(CollegesDictDO::getLoginStatus,1);
        return ResponseData.generateCreatedResponse(0, collegesDictService.list(queryWrapper));
    }

    @PostMapping(value = "/login")
    @ApiOperation("院校端 --- 登录: account/账户, password/密码")
    public ResponseVO login(@RequestBody LoginDTO loginDTO) {
        return ResponseData.generateCreatedResponse(0, collegesDictService.login(loginDTO));
    }

    @PostMapping(value = "updateCollegeById")
    @LoginRequired({Platform.center})
    @ApiOperation("院校端 --- 更新院校信息: id/ID, account/账户,code/代码, name/名称, password/密码")
    public ResponseVO updateCollegeById(@RequestBody CollegesDictDO collegesDictDO) {
        collegesDictService.updateById(collegesDictDO);
        return ResponseData.generateCreatedResponse(0);
    }

    @PostMapping(value = "addContact")
    @LoginRequired({Platform.school})
    @ApiOperation("院校端 --- 新增联系人:leaderName/领导姓名、leaderPost/领导职务、leaderPhone/领导手机号、contactName/联系人姓名、contactPost/联系人职务、contactPhone/联系人手机号")
    public ResponseVO addContact(@RequestBody CollegesDictDO collegesDictDO) {
        collegesDictService.addContact(collegesDictDO);
        return ResponseData.generateCreatedResponse(0);
    }

    @PostMapping(value = "/updatePwd")
    @LoginRequired(Platform.school)
    @ApiOperation("院校端 --- 修改密码: password/密码")
    public ResponseVO updatePwd(@RequestBody UpdatePwdDTO updatePwdDTO) {
        collegesDictService.updatePwd(updatePwdDTO);
        return ResponseData.generateCreatedResponse(0);
    }

    @PostMapping(value = "/projects")
    @LoginRequired(Platform.school)
    @ApiOperation("##院校端 --- 查看某个院校进决赛的项目(除去已经登记过的) matchId ")
    public ResponseVO projects(@RequestBody ProjectDO projectDO) {
        return ResponseData.generateCreatedResponse(0,collegesDictService.projects(projectDO));
    }

    @PostMapping("projectLeader")
    @LoginRequired(Platform.school)
    @ApiOperation("##院校端---自动带出负责人  projectId ")
    public ResponseVO projectLeader(@RequestBody ProjectMemberDO projectMemberDO){
        return ResponseData.generateCreatedResponse(0,collegesDictService.projectLeader(projectMemberDO));
    }

    @PostMapping("projectMembers")
    @LoginRequired(Platform.school)
    @ApiOperation("##院校端---进决赛的项目下的成员  projectId ")
    public ResponseVO projectMembers(@RequestBody ProjectMemberDO projectMemberDO){
        return ResponseData.generateCreatedResponse(0,collegesDictService.projectMembers(projectMemberDO));
    }

    @PostMapping("addProjectMember")
    @LoginRequired({Platform.school})
    @ApiOperation("##院校端---添加参赛人员  matchId studentIds[] 人员id projectId  matchId")
    public ResponseVO addProjectMember(@RequestBody AddProjectMemberDTO addProjectMemberDTO)throws Exception{
        collegesDictService.addProjectMember(addProjectMemberDTO);
        return ResponseData.generateCreatedResponse(0);
    }

    @PostMapping("removeProject")
    @LoginRequired({Platform.school,Platform.center})
    @ApiOperation("##院校端---移除参赛人员  projectId  matchId")
    public ResponseVO removeProject(@RequestBody AddProjectMemberDTO addProjectMemberDTO)throws Exception{
        collegesDictService.removeProject(addProjectMemberDTO);
        return ResponseData.generateCreatedResponse(0);
    }

    @PostMapping("addObservations")
    @LoginRequired(Platform.school)
    @ApiOperation("##院校端---添加观摩人员/学校领队 matchId  memberType 观摩人员/学校领队/车 userName 人名/车牌号  telephone  idCardType  idCard")
    public ResponseVO addObservations(@RequestBody FinalMatchMemberDO finalMatchMemberDO)throws Exception {
        collegesDictService.addObservations(finalMatchMemberDO);
        return ResponseData.generateCreatedResponse(0);
    }

    @PostMapping("updateObservations")
    @LoginRequired({Platform.school,Platform.center})
    @ApiOperation("##院校端---修改观摩人员 matchId  id  userName  telephone  idCardType  idCard")
    public ResponseVO updateObservations(@RequestBody FinalMatchMemberDO finalMatchMemberDO)throws Exception{
        collegesDictService.updateObservations(finalMatchMemberDO);
        return ResponseData.generateCreatedResponse(0);
    }

    @PostMapping("deleteObservations")
    @LoginRequired({Platform.school,Platform.center})
    @ApiOperation("##院校端---删除观摩人员 id matchId ")
    public ResponseVO deleteObservations(@RequestBody FinalMatchMemberDO finalMatchMemberDO)throws Exception{
        collegesDictService.deleteObservations(finalMatchMemberDO);
        return ResponseData.generateCreatedResponse(0);
    }

    @PostMapping("registerMembers")
    @LoginRequired({Platform.school,Platform.center})
    @ApiOperation("##查看已登记的参赛人员  collegeId matchId ")
    public ResponseVO registerMembers(@RequestBody RegisterMembersDTO registerMembersDTO){
        return ResponseData.generateCreatedResponse(0,collegesDictService.registerMembers(registerMembersDTO));
    }

    @PostMapping("otherMembers")
    @LoginRequired({Platform.school,Platform.center})
    @ApiOperation("##查看已登记的其他人员  collegeId matchId")
    public ResponseVO otherMembers(@RequestBody RegisterMembersDTO registerMembersDTO){
        return ResponseData.generateCreatedResponse(0,collegesDictService.otherMembers(registerMembersDTO));
    }

    @PostMapping("cars")
    @LoginRequired({Platform.school,Platform.center})
    @ApiOperation("##查看已登记的车辆  collegeId matchId")
    public ResponseVO cars(@RequestBody RegisterMembersDTO registerMembersDTO){
        return ResponseData.generateCreatedResponse(0,collegesDictService.cars(registerMembersDTO));
    }

    @PostMapping("details")
    @LoginRequired({Platform.school,Platform.center})
    @ApiOperation("##截至时间+最近一次更新时间  id  matchId ")
    public ResponseVO details(@RequestBody RegisterMembersDTO registerMembersDTO){
        return ResponseData.generateCreatedResponse(0,collegesDictService.detail(registerMembersDTO));
    }

    @PostMapping("schools")
    @LoginRequired(Platform.center)
    @ApiOperation("##这届登记的院校+人员数 matchId name")
    public ResponseVO schools(@RequestBody RegisterMembersDTO registerMembersDTO){
        return ResponseData.generateCreatedResponse(0,collegesDictService.schools(registerMembersDTO));
    }

    @PostMapping("exportList")
    @LoginRequired(Platform.center)
    @ApiOperation("##导出总名单  id 届数id collegeId")
    public ResponseVO exportList(@RequestBody FinalMatchMemberDO finalMatchMemberDO){
        collegesDictService.exportList(finalMatchMemberDO);
        return ResponseData.generateCreatedResponse(0);
    }

    @PostMapping(value = "/getCollegesPage")
    @LoginRequired(Platform.center)
    @ApiOperation("中心端 --- 院校名录分页查询: name/搜索名称, pageNo/当前页数, pageSize/每页显示条数")
    public ResponseVO getCollegesPage(@RequestBody CollegesPageDTO collegesPageDTO) {
        return ResponseData.generateCreatedResponse(0, collegesDictService.getCollegesPage(collegesPageDTO));
    }

    @PostMapping(value = "/createColleges")
    @LoginRequired(Platform.center)
    @ApiOperation("中心端 --- 新建院校: name/搜索名称, code/院校代码、 phone/手机号")
    public ResponseVO createColleges(@RequestBody CollegesDictDO collegesDictDO) {
        collegesDictService.createColleges(collegesDictDO);
        return ResponseData.generateCreatedResponse(0);
    }

    @PostMapping(value = "/delete")
    @LoginRequired(Platform.center)
    @ApiOperation("中心端 --- 删除院校: id/院校ID")
    public ResponseVO delete(@RequestBody CollegesDictDO collegesDictDO) {
        collegesDictService.removeById(collegesDictDO.getId());
        return ResponseData.generateCreatedResponse(0);
    }

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

    @PostMapping(value = "/downloadErrorData")
    @LoginRequired(Platform.center)
    @ApiOperation("中心端 --- 下载导入失败院校数据:errorData/失败数据")
    public ResponseVO downloadErrorData(@RequestBody DownloadErrorDataDTO downloadErrorDataDTO) {
        collegesDictService.downloadErrorData(downloadErrorDataDTO);
        return ResponseData.generateCreatedResponse(0);
    }

    @PostMapping(value = "/getAwardedListPage")
    @LoginRequired(Platform.center)
    @ApiOperation("中心端 --- 查询获奖情况:matchId/赛事年份ID、projectGroup/项目组别(科技创新、红色文创、高职、中职)、name/搜索名称、pageNo/当前页数、pageSize/每页显示条数")
    public ResponseVO getAwardedList(@RequestBody AwardedListDTO awardedListDTO) {
        return ResponseData.generateCreatedResponse(0, collegesDictService.getAwardedList(awardedListDTO));
    }

    @PostMapping(value = "/exportAwardedList")
    @LoginRequired(Platform.center)
    @ApiOperation("中心端 --- 导出获奖情况:matchId/赛事年份ID")
    public void exportAwardedList(@RequestBody AwardedListDTO awardedListDTO) {
        collegesDictService.exportAwardedList(awardedListDTO);
    }

    @PostMapping(value = "/exportCollege")
    @LoginRequired(Platform.center)
    @ApiOperation("导出院校名录")
    public ResponseVO exportCollege() {
        collegesDictService.exportCollege();
        return ResponseData.generateCreatedResponse(0);
    }

    @PostMapping(value = "updateAllLoginStatus")
    @LoginRequired(Platform.center)
    @ApiOperation("中心端 --- 更新所有登录状态:loginStatus/状态(0:关闭,1:开启)")
    public ResponseVO updateAllLoginStatus(@RequestBody LoginStatusDTO loginStatusDTO) {
        collegesDictService.updateAllLoginStatus(loginStatusDTO);
        return ResponseData.generateCreatedResponse(0);
    }

    @PostMapping(value = "batchUpdateLoginStatus")
    @LoginRequired(Platform.center)
    @ApiOperation("中心端 --- 批量更新登录状态:ids/院校ID(数组)、loginStatus/状态(0:关闭,1:开启)")
    public ResponseVO batchUpdateLoginStatus(@RequestBody LoginStatusDTO loginStatusDTO) {
        collegesDictService.batchUpdateLoginStatus(loginStatusDTO);
        return ResponseData.generateCreatedResponse(0);
    }

    @PostMapping(value = "updateLoginStatus")
    @LoginRequired(Platform.center)
    @ApiOperation("中心端 --- 更新登录状态:id/院校ID、loginStatus/状态(0:关闭,1:开启)")
    public ResponseVO updateLoginStatus(@RequestBody LoginStatusDTO loginStatusDTO) {
        collegesDictService.updateLoginStatus(loginStatusDTO);
        return ResponseData.generateCreatedResponse(0);
    }
}