package com.yipin.liuwanr.controller; import java.util.HashMap; import java.util.List; import com.yipin.liuwanr.entity.*; 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.CrossOrigin; import org.springframework.web.bind.annotation.GetMapping; 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.RequestParam; import org.springframework.web.bind.annotation.RestController; import com.yipin.liuwanr.entity.ProjectManagement; import com.yipin.liuwanr.service.ProjectManagementService; @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 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; } /** * 首页面查询 *

updateProjectManagement * * @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) { 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 ret = service.queryAllManagements(vo); 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 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 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; // } /** * 页面查询,排除练习 *

* * @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) { Response resp = new Response(); ProjectManagement vo = new ProjectManagement(); if (null != systemId) { vo.setSystemId(systemId); } if (null != userId) { vo.setUserId(userId); } HashMap 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 projectId) { Response resp = new Response(); HashMap 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 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 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 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 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 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 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 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 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 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 roleId) { Response resp = new Response(); HashMap 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 points = vo.getPooints(); List 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 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 points = vo.getPooints(); List 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 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 points = vo.getPooints(); List 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 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 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 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 points = vo.getPooints(); List 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 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 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 points = vo.getPooints(); List 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 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; } /** * 川大查询项目管理 *

* * @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 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; } }