| | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | @Api(tags = "考场管理") |
| | | @Api(tags = "考场管理") |
| | | @RestController |
| | | @RequestMapping(value = "admin/examroom") |
| | | public class ExamRoomController { |
| | | //日志 |
| | | //日志 |
| | | private final Logger log = LogManager.getLogger(ExamRoomController.class); |
| | | |
| | | // 分页查询中,默认记录条数和页数 |
| | | // 分页查询中,默认记录条数和页数 |
| | | private static final int DEFAULT_PAGE_SIZE = 10; |
| | | private static final int DEFAULT_PAGE_NUM = 1; |
| | | |
| | |
| | | private CommonDAO commonDAO; |
| | | |
| | | /** |
| | | * 考场列表 |
| | | * 考场列表 |
| | | */ |
| | | @ApiOperation(value = "获取考场列表") |
| | | @ApiOperation(value = "获取考场列表") |
| | | @RequestMapping(value = "list", method = RequestMethod.GET) |
| | | public @ResponseBody Result list(String roomId,String keyword,Short status,Integer pageSize,Integer pageNum) { |
| | | pageSize = pageSize != null && pageSize > 0 ? pageSize : DEFAULT_PAGE_SIZE; |
| | | pageNum = pageNum != null && pageNum > 0 ? pageNum : DEFAULT_PAGE_NUM; |
| | | |
| | | //总考试数量 |
| | | //总考试数量 |
| | | int totalCount = examRoomService.listCount(roomId,keyword, status); |
| | | Pager pager = new Pager(pageSize,pageNum); |
| | | pager.setTotalCount(totalCount); |
| | |
| | | } |
| | | |
| | | /** |
| | | * 保存 |
| | | * 保存 |
| | | * |
| | | * @param examRoom |
| | | * @return |
| | | */ |
| | | @ApiOperation(value = "保存考场") |
| | | @ApiOperation(value = "保存考场") |
| | | @RequestMapping(value = "/save", method = RequestMethod.POST) |
| | | public @ResponseBody Result save(@RequestBody ExamRoom examRoom) { |
| | | |
| | | |
| | | if (StringUtils.isEmpty(examRoom.getExamroomId())) { |
| | | if(checkIsDumplicate(examRoom.getExamroomId(),examRoom.getExamroomName())){ |
| | | return new Result(false, "添加失败!重复的考场信息"); |
| | | return new Result(false, "添加失败!重复的考场信息"); |
| | | } |
| | | return new Result(true,"",CollectionUtils.newObjectMap("examroomId", examRoomService.add(examRoom))); |
| | | } else { |
| | |
| | | |
| | | |
| | | /** |
| | | * 删除 |
| | | * 删除 |
| | | * |
| | | * @param examroomIds |
| | | * @return |
| | | */ |
| | | @ApiOperation(value = "删除考场", httpMethod = "GET") |
| | | @ApiImplicitParam(name = "examroomIds", value = "考场ID字符串", required = true, dataType = "String", paramType = "body") |
| | | @ApiOperation(value = "删除考场", httpMethod = "GET") |
| | | @ApiImplicitParam(name = "examroomIds", value = "考场ID字符串", required = true, dataType = "String", paramType = "body") |
| | | @RequestMapping(value = "delete", method = RequestMethod.GET) |
| | | public @ResponseBody Result delete(String examroomIds) { |
| | | Result result = new Result(true); |
| | |
| | | } |
| | | |
| | | /** |
| | | * 发布考场 |
| | | * 发布考场 |
| | | * |
| | | * @param roomIds |
| | | * @return |
| | | */ |
| | | @ApiOperation(value = "发布考场", httpMethod = "GET") |
| | | @ApiOperation(value = "发布考场", httpMethod = "GET") |
| | | @RequestMapping(value = "/publish", method = RequestMethod.GET) |
| | | public @ResponseBody Result publish(String roomIds) { |
| | | if (StringUtils.isEmpty(roomIds)) { |
| | | return new Result(false, "参数错误"); |
| | | return new Result(false, "参数错误"); |
| | | } |
| | | |
| | | return this.examRoomService.doRelease(roomIds.split(",")); |
| | | } |
| | | |
| | | /** |
| | | * 撤回发布的考场 |
| | | * 撤回发布的考场 |
| | | * |
| | | * @param roomIds |
| | | * @return |
| | | */ |
| | | @ApiOperation(value = "撤回考场", httpMethod = "GET") |
| | | @ApiOperation(value = "撤回考场", httpMethod = "GET") |
| | | @RequestMapping(value = "/cancel", method = RequestMethod.GET) |
| | | public @ResponseBody Result cancel(String roomIds) { |
| | | if (StringUtils.isEmpty(roomIds)) { |
| | | return new Result(false, "参数错误"); |
| | | return new Result(false, "参数错误"); |
| | | } |
| | | |
| | | return this.examRoomService.doCancel(roomIds.split(",")); |
| | |
| | | |
| | | |
| | | /** |
| | | * 详情页面数据 |
| | | * 详情页面数据 |
| | | * |
| | | * @param examroomId |
| | | * @return |
| | | */ |
| | | @ApiOperation(value = "详情页面数据") |
| | | @ApiOperation(value = "详情页面数据") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name="roomId", dataType="String", paramType="query", value="考场ID", required=true), |
| | | @ApiImplicitParam(name="roomId", dataType="String", paramType="query", value="考场ID", required=true), |
| | | }) |
| | | @RequestMapping(value = "/detail", method = RequestMethod.GET) |
| | | public @ResponseBody Result detail(String examroomId) { |
| | |
| | | } |
| | | |
| | | /** |
| | | * 查询所有考场的ID和名称 |
| | | * 查询所有考场的ID和名称 |
| | | * @return |
| | | */ |
| | | @ApiOperation(value = "可选择考场ID和名称") |
| | | @ApiOperation(value = "可选择考场ID和名称") |
| | | @RequestMapping(value = "/allExamRoomIdAndNames", method = RequestMethod.GET) |
| | | public @ResponseBody Result listClassRoomIdAndNames() { |
| | | List<Map<String,Object>> listResult = this.examRoomService.queryAllRoomIdAndNames(); |