|
|
|
package com.yipin.liuwanr.controller;
|
|
|
|
|
|
|
|
import com.yipin.liuwanr.entity.*;
|
|
|
|
import com.yipin.liuwanr.service.ProjectManagementService;
|
|
|
|
import com.yipin.liuwanr.util.R;
|
|
|
|
import io.swagger.annotations.Api;
|
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
|
import io.swagger.annotations.ApiParam;
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
import org.springframework.util.StringUtils;
|
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
|
|
import java.util.HashMap;
|
|
|
|
import java.util.List;
|
|
|
|
|
|
|
|
@Api(value = "项目管理", tags = "项目管理相关方法")
|
|
|
|
@RestController
|
|
|
|
@RequestMapping("/ProjectManagement")
|
|
|
|
@CrossOrigin
|
|
|
|
public class ProjectManagementController {
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
private ProjectManagementService service;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 查询用户角色
|
|
|
|
*
|
|
|
|
* @param userId
|
|
|
|
* @return
|
|
|
|
*/
|
|
|
|
@ApiOperation(value = "查询用户角色信息", notes = "查询用户角色信息")
|
|
|
|
@GetMapping("/queryRole")
|
|
|
|
Response queryRole(@ApiParam(name = "userId", value = "用户id", required = true) @RequestParam Integer userId) {
|
|
|
|
Response resp = new Response();
|
|
|
|
HashMap<String, Object> ret = service.queryRole(userId);
|
|
|
|
int status = (int) ret.get("retcode");
|
|
|
|
if (status == 200) {
|
|
|
|
resp.setStatus(status);
|
|
|
|
resp.setMessage(ret.get("retvalue"));
|
|
|
|
} else {
|
|
|
|
resp.setStatus(status);
|
|
|
|
resp.setErrmessage(ret.get("retvalue").toString());
|
|
|
|
}
|
|
|
|
return resp;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 首页面查询
|
|
|
|
* <p>updateProjectManagement
|
|
|
|
*
|
|
|
|
* @param projectPermissions:权限
|
|
|
|
* @param founder:创建人
|
|
|
|
* @param state:状态
|
|
|
|
* @param projectName:项目名称
|
|
|
|
* @param systemId
|
|
|
|
* @return
|
|
|
|
*/
|
|
|
|
@ApiOperation(value = "项目管理列表", notes = "项目管理列表")
|
|
|
|
@GetMapping("/queryAllManagements")
|
|
|
|
R queryAllManagements(
|
|
|
|
@ApiParam(name = "projectPermissions", value = "项目权限(0、练习 1、考核 2、竞赛)", required = false) @RequestParam(required = false) Integer projectPermissions,
|
|
|
|
@ApiParam(name = "founder", value = "项目创建人(0、系统 1、老师)", required = false) @RequestParam(required = false) String founder,
|
|
|
|
@ApiParam(name = "state", value = "项目状态(0、草稿箱 1、已发布)", required = false) @RequestParam(required = false) Integer state,
|
|
|
|
@ApiParam(name = "projectName", value = "项目名称", required = false) @RequestParam(required = false) String projectName,
|
|
|
|
@ApiParam(name = "systemId", value = "系统id", required = true) @RequestParam Integer systemId,
|
|
|
|
@ApiParam(name = "userId", value = "用户id", required = true) @RequestParam Integer userId,
|
|
|
|
@ApiParam(name = "pageNo", value = "起始页数", required = true) @RequestParam Integer pageNo,
|
|
|
|
@ApiParam(name = "pageSize", value = "页数", required = true) @RequestParam Integer pageSize) {
|
|
|
|
R r = new R();
|
|
|
|
ProjectManagement vo = new ProjectManagement();
|
|
|
|
if (null != projectPermissions) {
|
|
|
|
vo.setProjectPermissions(projectPermissions);
|
|
|
|
}
|
|
|
|
if (null != founder && founder != "") {
|
|
|
|
vo.setFounder(founder);
|
|
|
|
}
|
|
|
|
if (null != state) {
|
|
|
|
vo.setState(state);
|
|
|
|
}
|
|
|
|
if (null != systemId) {
|
|
|
|
vo.setSystemId(systemId);
|
|
|
|
}
|
|
|
|
if (null != projectName && projectName != "") {
|
|
|
|
vo.setProjectName(projectName);
|
|
|
|
}
|
|
|
|
if (null != userId) {
|
|
|
|
vo.setUserId(userId);
|
|
|
|
}
|
|
|
|
if (null != pageNo) {
|
|
|
|
vo.setPageNo(pageNo);
|
|
|
|
}
|
|
|
|
if (null != pageSize) {
|
|
|
|
vo.setPageSize(pageSize);
|
|
|
|
}
|
|
|
|
HashMap<String, Object> ret = service.queryAllManagements(vo);
|
|
|
|
int status = (int) ret.get("retcode");
|
|
|
|
if (status == 200) {
|
|
|
|
r.put("status", 200);
|
|
|
|
r.put("pageInfo", ret.get("pageInfo"));
|
|
|
|
} else {
|
|
|
|
R.error(500, ret.get("retvalue").toString());
|
|
|
|
}
|
|
|
|
return r;
|
|
|
|
}
|
|
|
|
// /**
|
|
|
|
// * 首页面查询
|
|
|
|
// * <p>
|
|
|
|
// *
|
|
|
|
// * @param projectPermissions:权限
|
|
|
|
// * @param founder:创建人
|
|
|
|
// * @param state:状态
|
|
|
|
// * @param projectName:项目名称
|
|
|
|
// * @param systemId
|
|
|
|
// * @return
|
|
|
|
// */
|
|
|
|
// @ApiOperation(value = "项目管理列表", notes = "项目管理列表")
|
|
|
|
// @GetMapping("/queryAllManagements")
|
|
|
|
// Response queryAllManagements(
|
|
|
|
// @ApiParam(name = "projectPermissions", value = "项目权限(0、练习 1、考核 2、竞赛)", required = false) @RequestParam(required = false) Integer projectPermissions,
|
|
|
|
// @ApiParam(name = "founder", value = "项目创建人(0、系统 1、老师)", required = false) @RequestParam(required = false) Integer founder,
|
|
|
|
// @ApiParam(name = "state", value = "项目状态(0、草稿箱 1、已发布)", required = false) @RequestParam(required = false) Integer state,
|
|
|
|
// @ApiParam(name = "projectName", value = "项目名称", required = false) @RequestParam(required = false) String projectName,
|
|
|
|
// @ApiParam(name = "systemId", value = "系统id", required = true) @RequestParam Integer systemId,
|
|
|
|
// @ApiParam(name = "userId", value = "用户id", required = true) @RequestParam Integer userId,
|
|
|
|
// @ApiParam(name = "pageNo", value = "第几页,页码", required = true) @RequestParam Integer pageNo,
|
|
|
|
// @ApiParam(name = "pageSize", value = "每页展示的数据条数", required = true) @RequestParam Integer pageSize) {
|
|
|
|
// Response resp = new Response();
|
|
|
|
// ProjectManagement vo = new ProjectManagement();
|
|
|
|
// if (null != projectPermissions) {
|
|
|
|
// vo.setProjectPermissions(projectPermissions);
|
|
|
|
// }
|
|
|
|
// if (null != founder) {
|
|
|
|
// vo.setFounder(founder);
|
|
|
|
// }
|
|
|
|
// if (null != state) {
|
|
|
|
// vo.setState(state);
|
|
|
|
// }
|
|
|
|
// if (null != systemId) {
|
|
|
|
// vo.setSystemId(systemId);
|
|
|
|
// }
|
|
|
|
// if (null != projectName && projectName != "") {
|
|
|
|
// vo.setProjectName(projectName);
|
|
|
|
// }
|
|
|
|
// if (null != userId) {
|
|
|
|
// vo.setUserId(userId);
|
|
|
|
// }
|
|
|
|
// HashMap<String, Object> ret = service.queryAllManagements(vo, pageNo, pageSize);
|
|
|
|
// int status = (int) ret.get("retcode");
|
|
|
|
// if (status == 200) {
|
|
|
|
// resp.setStatus(status);
|
|
|
|
// resp.setMessage(ret.get("retvalue"));
|
|
|
|
// } else {
|
|
|
|
// resp.setStatus(status);
|
|
|
|
// resp.setErrmessage(ret.get("retvalue").toString());
|
|
|
|
// }
|
|
|
|
// return resp;
|
|
|
|
// }
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 页面查询,排除练习
|
|
|
|
* <p>
|
|
|
|
*
|
|
|
|
* @param systemId
|
|
|
|
* @return
|
|
|
|
*/
|
|
|
|
@ApiOperation(value = "项目列表(排除练习)", notes = "项目列表(用于创建实验,排除练习项目)")
|
|
|
|
@GetMapping("/queryManagements")
|
|
|
|
Response queryManagements(
|
|
|
|
@ApiParam(name = "systemId", value = "系统id", required = true) @RequestParam(required = false) Integer systemId,
|
|
|
|
@ApiParam(name = "userId", value = "用户id", required = true) @RequestParam(required = false) Integer userId,
|
|
|
|
@ApiParam(name = "pageNo", value = "第几页,页码", required = true) @RequestParam Integer pageNo,
|
|
|
|
@ApiParam(name = "pageSize", value = "每页展示的数据条数", required = true) @RequestParam Integer pageSize,
|
|
|
|
@ApiParam(name = "projectName", value = "项目名称", required = false) @RequestParam(required = false) String projectName) {
|
|
|
|
Response resp = new Response();
|
|
|
|
ProjectManagement vo = new ProjectManagement();
|
|
|
|
if (null != systemId) {
|
|
|
|
vo.setSystemId(systemId);
|
|
|
|
}
|
|
|
|
if (null != userId) {
|
|
|
|
vo.setUserId(userId);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*if (null != projectName) {
|
|
|
|
vo.setQueryName(projectName);
|
|
|
|
}*/
|
|
|
|
|
|
|
|
if (org.apache.commons.lang3.StringUtils.equals("", projectName)) {
|
|
|
|
projectName = null;
|
|
|
|
}
|
|
|
|
HashMap<String, Object> ret = service.queryManagements(vo, pageNo, pageSize);
|
|
|
|
int status = (int) ret.get("retcode");
|
|
|
|
if (status == 200) {
|
|
|
|
resp.setStatus(status);
|
|
|
|
resp.setMessage(ret.get("retvalue"));
|
|
|
|
} else {
|
|
|
|
resp.setStatus(status);
|
|
|
|
resp.setErrmessage(ret.get("retvalue").toString());
|
|
|
|
}
|
|
|
|
return resp;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 批量删除
|
|
|
|
*
|
|
|
|
* @param projectId 项目id集合
|
|
|
|
* @return
|
|
|
|
*/
|
|
|
|
@ApiOperation(value = "批量删除", notes = "批量删除")
|
|
|
|
@PostMapping("/removeProjectManagement")
|
|
|
|
Response removeProjectManagement(@ApiParam(name = "projectId", value = "项目主键Id", required = true) @RequestBody List<Integer> projectId) {
|
|
|
|
Response resp = new Response();
|
|
|
|
HashMap<String, Object> ret = service.deleteProjectManagement(projectId);
|
|
|
|
int status = (int) ret.get("retcode");
|
|
|
|
if (status == 200) {
|
|
|
|
resp.setStatus(status);
|
|
|
|
resp.setMessage(ret.get("retvalue"));
|
|
|
|
} else {
|
|
|
|
resp.setStatus(status);
|
|
|
|
resp.setErrmessage(ret.get("retvalue").toString());
|
|
|
|
}
|
|
|
|
return resp;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 根据项目管理id查询对应信息
|
|
|
|
*
|
|
|
|
* @param projectId
|
|
|
|
* @return
|
|
|
|
*/
|
|
|
|
@ApiOperation(value = "获取点击编辑的对应信息", notes = "获取点击编辑的对应信息")
|
|
|
|
@GetMapping("/getProjectId")
|
|
|
|
Response getProjectId(@ApiParam(name = "projectId", value = "项目主键ID", required = true) @RequestParam Integer projectId) {
|
|
|
|
Response resp = new Response();
|
|
|
|
HashMap<String, Object> ret = service.getProjectId(projectId);
|
|
|
|
int status = (int) ret.get("retcode");
|
|
|
|
if (status == 200) {
|
|
|
|
resp.setStatus(status);
|
|
|
|
resp.setMessage(ret.get("retvalue"));
|
|
|
|
} else {
|
|
|
|
resp.setStatus(status);
|
|
|
|
resp.setErrmessage(ret.get("retvalue").toString());
|
|
|
|
}
|
|
|
|
return resp;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 根据项目管理id查询对应交易类判分点信息
|
|
|
|
*
|
|
|
|
* @param projectId
|
|
|
|
* @return
|
|
|
|
*/
|
|
|
|
@ApiOperation(value = "根据项目管理id查询对应交易类判分点信息", notes = "根据项目管理id查询对应交易类判分点信息")
|
|
|
|
@GetMapping("/getTrdingJudgmentPoints")
|
|
|
|
Response getTrdingJudgmentPoints(@ApiParam(name = "projectId", value = "项目主键ID", required = true) @RequestParam Integer projectId) {
|
|
|
|
Response resp = new Response();
|
|
|
|
HashMap<String, Object> ret = service.getTrdingJudgmentPoints(projectId);
|
|
|
|
int status = (int) ret.get("retcode");
|
|
|
|
if (status == 200) {
|
|
|
|
resp.setStatus(status);
|
|
|
|
resp.setMessage(ret.get("retvalue"));
|
|
|
|
} else {
|
|
|
|
resp.setStatus(status);
|
|
|
|
resp.setErrmessage(ret.get("retvalue").toString());
|
|
|
|
}
|
|
|
|
return resp;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 根据项目管理id查询对应交易类判分点信息
|
|
|
|
*
|
|
|
|
* @param projectId
|
|
|
|
* @return
|
|
|
|
*/
|
|
|
|
@ApiOperation(value = "根据项目管理id查询项目管理信息", notes = "根据项目管理id查询项目管理信息")
|
|
|
|
@GetMapping("/getProject")
|
|
|
|
Response getProject(@ApiParam(name = "projectId", value = "项目主键ID", required = true) @RequestParam Integer projectId) {
|
|
|
|
Response resp = new Response();
|
|
|
|
HashMap<String, Object> ret = service.getProject(projectId);
|
|
|
|
int status = (int) ret.get("retcode");
|
|
|
|
if (status == 200) {
|
|
|
|
resp.setStatus(status);
|
|
|
|
resp.setMessage(ret.get("retvalue"));
|
|
|
|
} else {
|
|
|
|
resp.setStatus(status);
|
|
|
|
resp.setErrmessage(ret.get("retvalue").toString());
|
|
|
|
}
|
|
|
|
return resp;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 添加点面板的数据展示+条件筛选
|
|
|
|
*
|
|
|
|
* @param judgmentPointsName 判分点名称
|
|
|
|
* @return
|
|
|
|
*/
|
|
|
|
@ApiOperation(value = "判分点列表", notes = "判分点列表")
|
|
|
|
@GetMapping("/queryAllJudgmentPoints")
|
|
|
|
Response queryAllJudgmentPoints(@ApiParam(name = "judgmentPointsName", value = "判分点名称", required = false) @RequestParam(required = false) String judgmentPointsName,
|
|
|
|
@ApiParam(name = "systemId", value = "系统id", required = true) @RequestParam Integer systemId) {
|
|
|
|
Response resp = new Response();
|
|
|
|
JudgmentPoints points = new JudgmentPoints();
|
|
|
|
if (StringUtils.isEmpty(systemId)) {
|
|
|
|
resp.setStatus(300);
|
|
|
|
resp.setMessage("systemId cannot be empty");
|
|
|
|
} else {
|
|
|
|
if (!StringUtils.isEmpty(judgmentPointsName)) {
|
|
|
|
points.setJudgmentPointsName(judgmentPointsName);
|
|
|
|
}
|
|
|
|
points.setSystemId(systemId);
|
|
|
|
|
|
|
|
HashMap<String, Object> ret = service.queryAllJudgmentPoints(points);
|
|
|
|
int status = (int) ret.get("retcode");
|
|
|
|
if (status == 200) {
|
|
|
|
resp.setStatus(status);
|
|
|
|
resp.setMessage(ret.get("retvalue"));
|
|
|
|
} else {
|
|
|
|
resp.setStatus(status);
|
|
|
|
resp.setErrmessage(ret.get("retvalue").toString());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return resp;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 实验任务表格信息的展示,根据判分点id和项目
|
|
|
|
*
|
|
|
|
* @param judgmentPointsIds 判分点id
|
|
|
|
* @return
|
|
|
|
*/
|
|
|
|
@ApiOperation(value = "实验任务列表", notes = "实验任务列表")
|
|
|
|
@GetMapping("/getByjudgmentPointsId")
|
|
|
|
Response getByjudgmentPointsId(@ApiParam(name = "judgmentPointsIds", value = "判分点主键id", required = true) @RequestParam List<Integer> judgmentPointsIds,
|
|
|
|
@ApiParam(name = "projectId", value = "项目主键ID", required = false) @RequestParam(required = false) Integer projectId,
|
|
|
|
@ApiParam(name = "userId", value = "用户主键ID", required = false) @RequestParam(required = false) Integer userId) {
|
|
|
|
Response resp = new Response();
|
|
|
|
HashMap<String, Object> ret = service.getByjudgmentPointsId(judgmentPointsIds, projectId, userId);
|
|
|
|
int status = (int) ret.get("retcode");
|
|
|
|
if (status == 200) {
|
|
|
|
resp.setStatus(status);
|
|
|
|
resp.setMessage(ret.get("retvalue"));
|
|
|
|
} else {
|
|
|
|
resp.setStatus(status);
|
|
|
|
resp.setErrmessage(ret.get("retvalue").toString());
|
|
|
|
}
|
|
|
|
return resp;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 平均分配分值
|
|
|
|
*
|
|
|
|
* @param number 判分点数量
|
|
|
|
* @return
|
|
|
|
*/
|
|
|
|
@ApiOperation(value = "平均分配分值", notes = "平均分配分值")
|
|
|
|
@GetMapping("/avgValues")
|
|
|
|
Response avgValues(@ApiParam(name = "number", value = "判分点数量", required = true) @RequestParam Integer number) {
|
|
|
|
Response resp = new Response();
|
|
|
|
HashMap<String, Object> ret = service.avgValues(number);
|
|
|
|
int status = (int) ret.get("retcode");
|
|
|
|
if (status == 200) {
|
|
|
|
resp.setStatus(status);
|
|
|
|
resp.setMessage(ret.get("retvalue"));
|
|
|
|
} else {
|
|
|
|
resp.setStatus(status);
|
|
|
|
resp.setErrmessage(ret.get("retvalue").toString());
|
|
|
|
}
|
|
|
|
return resp;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 添加角色
|
|
|
|
* {
|
|
|
|
* "roleNumber": "1",
|
|
|
|
* "roleType": "0",
|
|
|
|
* "roleAttribute": "0"
|
|
|
|
* }
|
|
|
|
*
|
|
|
|
* @param role 角色
|
|
|
|
* @return
|
|
|
|
*/
|
|
|
|
@ApiOperation(value = " 新增案例数据对象", notes = " 新增案例数据对象")
|
|
|
|
@PostMapping("/addRole")
|
|
|
|
Response addRole(@ApiParam(name = "Role", value = "角色对象,传入json格式", required = true) @RequestBody Role role) {
|
|
|
|
Response resp = new Response();
|
|
|
|
HashMap<String, Object> ret = service.insertRole(role);
|
|
|
|
int status = (int) ret.get("retcode");
|
|
|
|
if (status == 200) {
|
|
|
|
resp.setStatus(status);
|
|
|
|
resp.setMessage(ret.get("retvalue"));
|
|
|
|
} else {
|
|
|
|
resp.setStatus(status);
|
|
|
|
resp.setErrmessage(ret.get("retvalue").toString());
|
|
|
|
}
|
|
|
|
return resp;
|
|
|
|
}
|
|
|
|
|
|
|
|
@ApiOperation(value = "修改角色", notes = "修改角色")
|
|
|
|
@PostMapping("/updateRole")
|
|
|
|
Response updateRole(@ApiParam(name = "Role", value = "角色对象,传入json格式", required = true) @RequestBody Role role) {
|
|
|
|
Response resp = new Response();
|
|
|
|
HashMap<String, Object> ret = service.updateRole(role);
|
|
|
|
int status = (int) ret.get("retcode");
|
|
|
|
if (status == 200) {
|
|
|
|
resp.setStatus(status);
|
|
|
|
resp.setMessage(ret.get("retvalue"));
|
|
|
|
} else {
|
|
|
|
resp.setStatus(status);
|
|
|
|
resp.setErrmessage(ret.get("retvalue").toString());
|
|
|
|
}
|
|
|
|
return resp;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 实验数据表格信息的展示,根据角色id
|
|
|
|
*
|
|
|
|
* @param roleId 角色Id
|
|
|
|
* @return
|
|
|
|
*/
|
|
|
|
@ApiOperation(value = "实验数据列表", notes = "实验数据列表")
|
|
|
|
@GetMapping("/getByRoleId")
|
|
|
|
Response getByRoleId(@ApiParam(name = "roleId", value = "角色id", required = true) @RequestParam List<Integer> roleId) {
|
|
|
|
Response resp = new Response();
|
|
|
|
HashMap<String, Object> ret = service.getByRoleId(roleId);
|
|
|
|
int status = (int) ret.get("retcode");
|
|
|
|
if (status == 200) {
|
|
|
|
resp.setStatus(status);
|
|
|
|
resp.setMessage(ret.get("retvalue"));
|
|
|
|
} else {
|
|
|
|
resp.setStatus(status);
|
|
|
|
resp.setErrmessage(ret.get("retvalue").toString());
|
|
|
|
}
|
|
|
|
return resp;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 添加创建项目管理信息
|
|
|
|
*
|
|
|
|
* @param vo 项目管理信息
|
|
|
|
* @return
|
|
|
|
*/
|
|
|
|
@ApiOperation(value = "创建项目", notes = "创建项目")
|
|
|
|
@PostMapping("/addProjectManagement")
|
|
|
|
Response addProjectManagement(@RequestBody @ApiParam(name = "新建项目管理所需类", value = "传入json格式", required = true) ManagementAndPointVo vo) {
|
|
|
|
Response resp = new Response();
|
|
|
|
ProjectManagement pro = vo.getManagement();
|
|
|
|
List<JudgmentPoints> points = vo.getPooints();
|
|
|
|
List<Integer> roles = vo.getRoleId();
|
|
|
|
if (StringUtils.isEmpty(pro)) {
|
|
|
|
resp.setStatus(300);
|
|
|
|
resp.setMessage("management cannot be empty");
|
|
|
|
return resp;
|
|
|
|
}
|
|
|
|
if (points.isEmpty() || points.size() <= 0) {
|
|
|
|
resp.setStatus(300);
|
|
|
|
resp.setMessage("pooints cannot be empty");
|
|
|
|
return resp;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (pro.getIsstartexperimental() == 0) {//开启实验数据
|
|
|
|
if (roles.isEmpty() || roles.size() <= 0) {
|
|
|
|
resp.setStatus(300);
|
|
|
|
resp.setMessage("roleId cannot be empty");
|
|
|
|
return resp;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
HashMap<String, Object> ret = service.insertProjectManagement(pro, points, roles);
|
|
|
|
int status = (int) ret.get("retcode");
|
|
|
|
if (status == 200) {
|
|
|
|
resp.setStatus(status);
|
|
|
|
resp.setMessage(ret.get("retvalue"));
|
|
|
|
} else {
|
|
|
|
resp.setStatus(status);
|
|
|
|
resp.setErrmessage(ret.get("retvalue").toString());
|
|
|
|
}
|
|
|
|
return resp;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 添加创建项目管理信息
|
|
|
|
*
|
|
|
|
* @param vo 项目管理信息
|
|
|
|
* @return
|
|
|
|
*/
|
|
|
|
@ApiOperation(value = "创建项目", notes = "创建项目")
|
|
|
|
@PostMapping("/newAddProjectManagement")
|
|
|
|
Response newAddProjectManagement(@RequestBody @ApiParam(name = "新建项目管理所需类", value = "传入json格式", required = true) ManagementAndPointVo vo) {
|
|
|
|
Response resp = new Response();
|
|
|
|
ProjectManagement pro = vo.getManagement();
|
|
|
|
List<JudgmentPoints> points = vo.getPooints();
|
|
|
|
List<Integer> roles = vo.getRoleId();
|
|
|
|
if (StringUtils.isEmpty(pro)) {
|
|
|
|
resp.setStatus(300);
|
|
|
|
resp.setMessage("management cannot be empty");
|
|
|
|
return resp;
|
|
|
|
}
|
|
|
|
if (points.isEmpty() || points.size() <= 0) {
|
|
|
|
resp.setStatus(300);
|
|
|
|
resp.setMessage("pooints cannot be empty");
|
|
|
|
return resp;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (pro.getIsstartexperimental() == 0) {//开启实验数据
|
|
|
|
if (roles.isEmpty() || roles.size() <= 0) {
|
|
|
|
resp.setStatus(300);
|
|
|
|
resp.setMessage("roleId cannot be empty");
|
|
|
|
return resp;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
HashMap<String, Object> ret = service.newAddProjectManagement(pro, points, roles);
|
|
|
|
int status = (int) ret.get("retcode");
|
|
|
|
if (status == 200) {
|
|
|
|
resp.setStatus(status);
|
|
|
|
resp.setMessage(ret.get("retvalue"));
|
|
|
|
} else {
|
|
|
|
resp.setStatus(status);
|
|
|
|
resp.setErrmessage(ret.get("retvalue").toString());
|
|
|
|
}
|
|
|
|
return resp;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 添加交易类判分点项目管理信息
|
|
|
|
*
|
|
|
|
* @param vo 项目管理信息
|
|
|
|
* @return
|
|
|
|
*/
|
|
|
|
@ApiOperation(value = "添加交易类判分点项目", notes = "添加交易类判分点项目")
|
|
|
|
@PostMapping("/add")
|
|
|
|
Response add(@RequestBody @ApiParam(name = "新建项目管理所需类", value = "传入json格式", required = true) ManagementAndPointVo vo) {
|
|
|
|
Response resp = new Response();
|
|
|
|
ProjectManagement pro = vo.getManagement();
|
|
|
|
List<JudgmentPoints> points = vo.getPooints();
|
|
|
|
List<Integer> roles = vo.getRoleId();
|
|
|
|
if (StringUtils.isEmpty(pro)) {
|
|
|
|
resp.setStatus(300);
|
|
|
|
resp.setMessage("management cannot be empty");
|
|
|
|
return resp;
|
|
|
|
}
|
|
|
|
if (points.isEmpty() || points.size() <= 0) {
|
|
|
|
resp.setStatus(300);
|
|
|
|
resp.setMessage("pooints cannot be empty");
|
|
|
|
return resp;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (pro.getIsstartexperimental() == 0) {//开启实验数据
|
|
|
|
if (roles.isEmpty() || roles.size() <= 0) {
|
|
|
|
resp.setStatus(300);
|
|
|
|
resp.setMessage("roleId cannot be empty");
|
|
|
|
return resp;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
HashMap<String, Object> ret = service.insertProjectManagement(pro, points, roles);
|
|
|
|
int status = (int) ret.get("retcode");
|
|
|
|
if (status == 200) {
|
|
|
|
resp.setStatus(status);
|
|
|
|
resp.setMessage(ret.get("retvalue"));
|
|
|
|
} else {
|
|
|
|
resp.setStatus(status);
|
|
|
|
resp.setErrmessage(ret.get("retvalue").toString());
|
|
|
|
}
|
|
|
|
return resp;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 职站查询单个项目判分点信息,根据项目id
|
|
|
|
*
|
|
|
|
* @param projectId 项目id
|
|
|
|
* @return
|
|
|
|
*/
|
|
|
|
@ApiOperation(value = "查询单个项目判分点信息", notes = "查询单个项目判分点信息")
|
|
|
|
@GetMapping("/getJudgmentPoints")
|
|
|
|
Response getJudgmentPoints(@ApiParam(name = "projectId", value = "项目id", required = true) @RequestParam Integer projectId) {
|
|
|
|
Response resp = new Response();
|
|
|
|
HashMap<String, Object> ret = service.getJudgmentPoints(projectId);
|
|
|
|
int status = (int) ret.get("retcode");
|
|
|
|
if (status == 200) {
|
|
|
|
resp.setStatus(status);
|
|
|
|
resp.setMessage(ret.get("retvalue"));
|
|
|
|
} else {
|
|
|
|
resp.setStatus(status);
|
|
|
|
resp.setErrmessage(ret.get("retvalue").toString());
|
|
|
|
}
|
|
|
|
return resp;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 职站查询单个项目判分点信息,根据项目id
|
|
|
|
*
|
|
|
|
* @param projectId 项目id
|
|
|
|
* @return
|
|
|
|
*/
|
|
|
|
@ApiOperation(value = "查询职站单个项目判分点信息", notes = "查询职站单个项目判分点信息")
|
|
|
|
@GetMapping("/getZZJudgmentPoints")
|
|
|
|
Response getZZJudgmentPoints(@ApiParam(name = "projectId", value = "项目id", required = true) @RequestParam Integer projectId) {
|
|
|
|
Response resp = new Response();
|
|
|
|
HashMap<String, Object> ret = service.getZZJudgmentPoints(projectId);
|
|
|
|
int status = (int) ret.get("retcode");
|
|
|
|
if (status == 200) {
|
|
|
|
resp.setStatus(status);
|
|
|
|
resp.setMessage(ret.get("retvalue"));
|
|
|
|
} else {
|
|
|
|
resp.setStatus(status);
|
|
|
|
resp.setErrmessage(ret.get("retvalue").toString());
|
|
|
|
}
|
|
|
|
return resp;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 修改项目管理信息
|
|
|
|
*
|
|
|
|
* @param vo
|
|
|
|
* @return
|
|
|
|
*/
|
|
|
|
@ApiOperation(value = "编辑项目", notes = "编辑项目")
|
|
|
|
@PostMapping("/updateProjectManagement")
|
|
|
|
Response updateProjectManagement(@ApiParam(name = "新建项目管理所需类", value = "传入json格式", required = true) @RequestBody ManagementAndPointVo vo) {
|
|
|
|
Response resp = new Response();
|
|
|
|
ProjectManagement pro = vo.getManagement();
|
|
|
|
List<JudgmentPoints> points = vo.getPooints();
|
|
|
|
List<Integer> roles = vo.getRoleId();
|
|
|
|
if (StringUtils.isEmpty(pro)) {
|
|
|
|
resp.setStatus(300);
|
|
|
|
resp.setMessage("项目管理为空,修改失败!");
|
|
|
|
return resp;
|
|
|
|
}
|
|
|
|
if (points.isEmpty() || points.size() <= 0) {
|
|
|
|
resp.setStatus(300);
|
|
|
|
resp.setMessage("判分点为空,修改失败!");
|
|
|
|
return resp;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (pro.getIsstartexperimental() == 0) {//开启实验数据
|
|
|
|
if (roles.isEmpty() || roles.size() <= 0) {
|
|
|
|
resp.setStatus(300);
|
|
|
|
resp.setMessage("角色id为空,修改失败!");
|
|
|
|
return resp;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
HashMap<String, Object> ret = service.updateProjectManagement(pro, points, roles);
|
|
|
|
int status = (int) ret.get("retcode");
|
|
|
|
if (status == 200) {
|
|
|
|
resp.setStatus(status);
|
|
|
|
resp.setMessage(ret.get("retvalue"));
|
|
|
|
} else {
|
|
|
|
resp.setStatus(status);
|
|
|
|
resp.setErrmessage(ret.get("retvalue").toString());
|
|
|
|
}
|
|
|
|
return resp;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 判断项目名称是否存在
|
|
|
|
*
|
|
|
|
* @param projectName
|
|
|
|
* @return
|
|
|
|
*/
|
|
|
|
@GetMapping("/isNameExistis")
|
|
|
|
Response isNameExistis(@RequestParam String projectName) {
|
|
|
|
Response resp = new Response();
|
|
|
|
if (StringUtils.isEmpty(projectName)) {
|
|
|
|
resp.setStatus(300);
|
|
|
|
resp.setMessage("项目名称为空");
|
|
|
|
} else {
|
|
|
|
HashMap<String, Object> ret = service.getByName(projectName);
|
|
|
|
int status = (int) ret.get("retcode");
|
|
|
|
if (status == 200) {
|
|
|
|
resp.setStatus(status);
|
|
|
|
resp.setMessage(ret.get("retvalue"));
|
|
|
|
} else {
|
|
|
|
resp.setStatus(status);
|
|
|
|
resp.setErrmessage(ret.get("retvalue").toString());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return resp;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 修改项目管理信息
|
|
|
|
*
|
|
|
|
* @param vo
|
|
|
|
* @return
|
|
|
|
*/
|
|
|
|
@ApiOperation(value = "编辑项目", notes = "编辑项目")
|
|
|
|
@PostMapping("/newUpdateProjectManagement")
|
|
|
|
Response newUpdateProjectManagement(@ApiParam(name = "新建项目管理所需类", value = "传入json格式", required = true) @RequestBody ManagementAndPointVo vo) {
|
|
|
|
Response resp = new Response();
|
|
|
|
ProjectManagement pro = vo.getManagement();
|
|
|
|
List<JudgmentPoints> points = vo.getPooints();
|
|
|
|
List<Integer> roles = vo.getRoleId();
|
|
|
|
if (StringUtils.isEmpty(pro)) {
|
|
|
|
resp.setStatus(300);
|
|
|
|
resp.setMessage("项目管理为空,修改失败!");
|
|
|
|
return resp;
|
|
|
|
}
|
|
|
|
if (points.isEmpty() || points.size() <= 0) {
|
|
|
|
resp.setStatus(300);
|
|
|
|
resp.setMessage("判分点为空,修改失败!");
|
|
|
|
return resp;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (pro.getIsstartexperimental() == 0) {//开启实验数据
|
|
|
|
if (roles.isEmpty() || roles.size() <= 0) {
|
|
|
|
resp.setStatus(300);
|
|
|
|
resp.setMessage("角色id为空,修改失败!");
|
|
|
|
return resp;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
HashMap<String, Object> ret = service.newUpdateProjectManagement(pro, points, roles);
|
|
|
|
int status = (int) ret.get("retcode");
|
|
|
|
if (status == 200) {
|
|
|
|
resp.setStatus(status);
|
|
|
|
resp.setMessage(ret.get("retvalue"));
|
|
|
|
} else {
|
|
|
|
resp.setStatus(status);
|
|
|
|
resp.setErrmessage(ret.get("retvalue").toString());
|
|
|
|
}
|
|
|
|
return resp;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 川大查询项目管理
|
|
|
|
* <p>
|
|
|
|
*
|
|
|
|
* @param projectPermissions:权限
|
|
|
|
* @return
|
|
|
|
*/
|
|
|
|
@ApiOperation(value = "川大查询项目管理列表", notes = "川大查询项目管理列表")
|
|
|
|
@GetMapping("/getManagements")
|
|
|
|
Response getManagements(
|
|
|
|
@ApiParam(name = "projectPermissions", value = "项目权限(0、练习 1、考核 2、竞赛)", required = true) @RequestParam(required = true) Integer projectPermissions) {
|
|
|
|
Response resp = new Response();
|
|
|
|
ProjectManagement vo = new ProjectManagement();
|
|
|
|
if (null == projectPermissions) {
|
|
|
|
resp.setStatus(300);
|
|
|
|
resp.setErrmessage("项目权限不能为空!");
|
|
|
|
} else {
|
|
|
|
HashMap<String, Object> ret = service.getManagements(projectPermissions);
|
|
|
|
int status = (int) ret.get("retcode");
|
|
|
|
if (status == 200) {
|
|
|
|
resp.setStatus(status);
|
|
|
|
resp.setMessage(ret.get("retvalue"));
|
|
|
|
} else {
|
|
|
|
resp.setStatus(status);
|
|
|
|
resp.setErrmessage(ret.get("retvalue").toString());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return resp;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 是否启用
|
|
|
|
*
|
|
|
|
* @param enable 0:启用,1:禁用
|
|
|
|
* @param id 项目id
|
|
|
|
*/
|
|
|
|
@ApiOperation(value = "启用/禁用", notes = "启用/禁用")
|
|
|
|
@GetMapping("/enable")
|
|
|
|
public Response enable(@ApiParam(name = "enable", value = "0:启用,1:禁用") @RequestParam("enable") Integer enable,
|
|
|
|
@ApiParam(name = "id", value = "项目id") @RequestParam("id") Integer id) {
|
|
|
|
Response resp = new Response();
|
|
|
|
if (enable == null || id == null || (enable != 0 && enable != 1)) {
|
|
|
|
resp.setStatus(406);
|
|
|
|
resp.setErrmessage("参数错误!");
|
|
|
|
} else {
|
|
|
|
HashMap<String, Object> ret = service.enable(id, enable);
|
|
|
|
int status = (int) ret.get("retcode");
|
|
|
|
if (status == 200) {
|
|
|
|
resp.setStatus(status);
|
|
|
|
resp.setMessage(ret.get("retvalue"));
|
|
|
|
} else {
|
|
|
|
resp.setStatus(status);
|
|
|
|
resp.setErrmessage(ret.get("retvalue").toString());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return resp;
|
|
|
|
}
|
|
|
|
}
|