| | |
| | | import io.swagger.annotations.ApiImplicitParams; |
| | | import io.swagger.annotations.ApiOperation; |
| | | |
| | | @Api(tags = "公告接口-教师端") |
| | | @Api(tags = "公告接口-教师端") |
| | | @RestController |
| | | @RequestMapping(value = "/admin/notice") |
| | | public class NoticeController { |
| | |
| | | ClassDAO classDao; |
| | | |
| | | /** |
| | | * 显示 公告列表 |
| | | * 显示 公告列表 |
| | | * |
| | | * @param keyword |
| | | * @param pageNum |
| | | * @param pageSize |
| | | * @return |
| | | */ |
| | | @ApiOperation(value = "公告列表", notes = "获取班级列表及班级所在公告列表") |
| | | @ApiOperation(value = "公告列表", notes = "获取班级列表及班级所在公告列表") |
| | | @GetMapping(value = "list") |
| | | public Result list(String keyword, Integer pageNum, Integer pageSize) { |
| | | if (!ClientUtils.isAdmin()) { |
| | | // 获取班级列表及班级所在公告列表 |
| | | // 获取班级列表及班级所在公告列表 |
| | | List<String> noticeIds = new ArrayList<String>(10); |
| | | List<ClsClass> clsLst = classService.getClassLstByTeacherId(); |
| | | for (ClsClass cls : clsLst) { |
| | |
| | | } |
| | | |
| | | /** |
| | | * 显示 公告管理列表 |
| | | * 显示 公告管理列表 |
| | | * @param keyword |
| | | * @param pageNum |
| | | * @param pageSize |
| | | * @return |
| | | */ |
| | | @ApiOperation(value = "公告管理列表", notes = "") |
| | | @ApiOperation(value = "公告管理列表", notes = "") |
| | | @GetMapping(value = "managerLst") |
| | | public Result managerLst(String keyword, Pager pager, @RequestParam(defaultValue = "desc") String sort) { |
| | | String keyword_ = StringUtils.isBlank(keyword) ? "" : keyword; |
| | |
| | | |
| | | private String getTypeName(String key) { |
| | | Map<String, String> typeMap = new HashMap<>(); |
| | | typeMap.put("homework", "作业公告"); |
| | | typeMap.put("exam", "考试公告"); |
| | | typeMap.put("other", "其他公告"); |
| | | typeMap.put("class", "上课公告"); |
| | | typeMap.put("homework", "作业公告"); |
| | | typeMap.put("exam", "考试公告"); |
| | | typeMap.put("other", "其他公告"); |
| | | typeMap.put("class", "上课公告"); |
| | | |
| | | return typeMap.get(key); |
| | | } |
| | | |
| | | /** |
| | | * 发布公告/多个id已逗号隔开 |
| | | * 发布公告/多个id已逗号隔开 |
| | | * |
| | | * @param noticeIds 公告ids |
| | | * @param noticeIds 公告ids |
| | | * @return |
| | | */ |
| | | @ApiOperation(value = "发布公告", notes = "多个id已逗号隔开") |
| | | @ApiOperation(value = "发布公告", notes = "多个id已逗号隔开") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "noticeIds", value = "多个id已逗号隔开", required = true, paramType="query", dataType = "String") |
| | | @ApiImplicitParam(name = "noticeIds", value = "多个id已逗号隔开", required = true, paramType="query", dataType = "String") |
| | | }) |
| | | @PostMapping(value = "release") |
| | | public Result release(String noticeIds) { |
| | |
| | | } |
| | | |
| | | /** |
| | | * 取消发布/多个id已逗号隔开 |
| | | * 取消发布/多个id已逗号隔开 |
| | | * |
| | | * @param noticeIds 公告ids |
| | | * @param noticeIds 公告ids |
| | | * @return |
| | | */ |
| | | @ApiOperation(value = "取消发布", notes = "多个id已逗号隔开") |
| | | @ApiOperation(value = "取消发布", notes = "多个id已逗号隔开") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "noticeIds", value = "多个id已逗号隔开", required = true, paramType="query", dataType = "String"), |
| | | @ApiImplicitParam(name = "noticeIds", value = "多个id已逗号隔开", required = true, paramType="query", dataType = "String"), |
| | | }) |
| | | @PostMapping(value = "cancel") |
| | | public Result cancel(String noticeIds) { |
| | |
| | | } |
| | | |
| | | /** |
| | | * 删除 公告/多个id已逗号隔开 |
| | | * 删除 公告/多个id已逗号隔开 |
| | | * |
| | | * @param noticeIds 公告ids |
| | | * @param noticeIds 公告ids |
| | | * @return |
| | | */ |
| | | @ApiOperation(value = "删除公告", notes = "多个id已逗号隔开") |
| | | @ApiOperation(value = "删除公告", notes = "多个id已逗号隔开") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "noticeIds", value = "多个id已逗号隔开", required = true, paramType="query", dataType = "String"), |
| | | @ApiImplicitParam(name = "noticeIds", value = "多个id已逗号隔开", required = true, paramType="query", dataType = "String"), |
| | | }) |
| | | @PostMapping(value = "delete") |
| | | public Result delete(String noticeIds) { |
| | |
| | | } |
| | | |
| | | /** |
| | | * 新增/更新 |
| | | * 新增/更新 |
| | | * |
| | | * @param noticeId |
| | | * @param name |
| | |
| | | * @param pathUrl |
| | | * @return |
| | | */ |
| | | @ApiOperation(value = "新增/更新公告", notes = "noticeId存在则更新,否则新增") |
| | | @ApiOperation(value = "新增/更新公告", notes = "noticeId存在则更新,否则新增") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "name", value = "公告标题", required = true, paramType = "query", dataType = "String"), |
| | | @ApiImplicitParam(name = "content", value = "公告内容", required = true, paramType = "query", dataType = "String"), |
| | | @ApiImplicitParam(name = "type", value = "公告类型名称", required = true, paramType = "query", dataType = "String"), |
| | | @ApiImplicitParam(name = "classIds", value = "关联的班级id,逗号组装", required = true, paramType = "query", dataType = "String") }) |
| | | @ApiImplicitParam(name = "name", value = "公告标题", required = true, paramType = "query", dataType = "String"), |
| | | @ApiImplicitParam(name = "content", value = "公告内容", required = true, paramType = "query", dataType = "String"), |
| | | @ApiImplicitParam(name = "type", value = "公告类型名称", required = true, paramType = "query", dataType = "String"), |
| | | @ApiImplicitParam(name = "classIds", value = "关联的班级id,逗号组装", required = true, paramType = "query", dataType = "String") }) |
| | | @PostMapping(value = "addOrUpdate") |
| | | public Result addOrUpdate(String noticeId, String name, String content, String type, String classIds, |
| | | String pathUrl) { |
| | |
| | | } |
| | | |
| | | /** |
| | | * 获取公告详情 |
| | | * 获取公告详情 |
| | | * |
| | | * @param noticeId |
| | | * @return |
| | | */ |
| | | @ApiOperation(value = "获取公告详情", notes = "") |
| | | @ApiOperation(value = "获取公告详情", notes = "") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "noticeId", value = "公告id", required = true, paramType = "query", dataType = "String") |
| | | @ApiImplicitParam(name = "noticeId", value = "公告id", required = true, paramType = "query", dataType = "String") |
| | | }) |
| | | @GetMapping(value = "detail") |
| | | public Result detail(String noticeId) { |
| | |
| | | )); |
| | | } |
| | | |
| | | @ApiOperation(value = "获取班级列表", notes = "") |
| | | @ApiOperation(value = "获取班级列表", notes = "") |
| | | @GetMapping(value = "findClassLst") |
| | | public Result findClassLst() { |
| | | if (ClientUtils.isAdmin()) { |
| | | List<Map<String, Object>> clsLst = classService.getAllClassLst().getDataT("classLst"); |
| | | return new Result(true, "操作成功", QBeanUtils.listBean2ListMap(clsLst, CollectionUtils.newStringMap( |
| | | return new Result(true, "操作成功", QBeanUtils.listBean2ListMap(clsLst, CollectionUtils.newStringMap( |
| | | "classId", "classId", |
| | | "className", "className" |
| | | ))); |
| | | } else { |
| | | List<ClsClass> clsLst = classService.getClassLstByTeacherId(); |
| | | return new Result(true, "操作成功", QBeanUtils.listBean2ListMap(clsLst, CollectionUtils.newStringMap( |
| | | return new Result(true, "操作成功", QBeanUtils.listBean2ListMap(clsLst, CollectionUtils.newStringMap( |
| | | "classId", "classId", |
| | | "name", "className" |
| | | ))); |
| | | } |
| | | } |
| | | |
| | | @ApiOperation(value = "更新公告查看次数", notes = "") |
| | | @ApiOperation(value = "更新公告查看次数", notes = "") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "noticeId", value = "公告id", required = false, paramType = "query", dataType = "String") |
| | | @ApiImplicitParam(name = "noticeId", value = "公告id", required = false, paramType = "query", dataType = "String") |
| | | }) |
| | | @GetMapping(value = "view") |
| | | public Result view(String noticeId) { |