ソースを参照

Merge branch 'master' of http://git.qmth.com.cn/ExamCloud-3/examcloud-core-examwork.git

WANG 5 年 前
コミット
73d8154435

+ 276 - 276
examcloud-core-examwork-api-provider/src/main/java/cn/com/qmth/examcloud/core/examwork/api/controller/NoticeController.java

@@ -63,305 +63,305 @@ import io.swagger.annotations.ApiParam;
 @Api(tags = "公告类")
 @RequestMapping("${$rmp.ctr.examwork}/notice")
 public class NoticeController extends ControllerSupport {
-	@Autowired
-	private NoticeService noticeService;
+    @Autowired
+    private NoticeService noticeService;
 
-	@Autowired
-	private NoticeRepo noticeRepo;
+    @Autowired
+    private NoticeRepo noticeRepo;
 
-	@ApiOperation(value = "分页查询消息列表", notes = "带条件带分页")
-	@GetMapping("getPagedNoticeList/{curPage}/{pageSize}")
-	public PageInfo<NoticeDomain> getPagedNoticeList(@PathVariable Integer curPage,
-			@PathVariable Integer pageSize, NoticeDomainQuery query) {
-		User accessUser = this.getAccessUser();
-		NoticeInfoQuery infoQuery = new NoticeInfoQuery();
-		infoQuery.setTitle(query.getTitle());
-		infoQuery.setRootOrgId(accessUser.getRootOrgId());
-		infoQuery.setUserId(accessUser.getUserId());
-		PageInfo<NoticeInfo> pagedNoticeInfo = noticeService.getPagedNoticeList(curPage, pageSize,
-				infoQuery);
-		return getPageInfoFrom(pagedNoticeInfo);
-	}
+    @ApiOperation(value = "分页查询消息列表", notes = "带条件带分页")
+    @GetMapping("getPagedNoticeList/{curPage}/{pageSize}")
+    public PageInfo<NoticeDomain> getPagedNoticeList(@PathVariable Integer curPage,
+                                                     @PathVariable Integer pageSize, NoticeDomainQuery query) {
+        User accessUser = this.getAccessUser();
+        NoticeInfoQuery infoQuery = new NoticeInfoQuery();
+        infoQuery.setTitle(query.getTitle());
+        infoQuery.setRootOrgId(accessUser.getRootOrgId());
+        infoQuery.setUserId(accessUser.getUserId());
+        PageInfo<NoticeInfo> pagedNoticeInfo = noticeService.getPagedNoticeList(curPage, pageSize,
+                infoQuery);
+        return getPageInfoFrom(pagedNoticeInfo);
+    }
 
-	@ApiOperation(value = "添加新通知")
-	@PostMapping("addNotice")
-	public void addNotice(@Validated @RequestBody AddNoticeDomain addNoticeDomain) {
-		validateAddNotice(addNoticeDomain);
+    @ApiOperation(value = "添加新通知")
+    @PostMapping("addNotice")
+    public void addNotice(@Validated @RequestBody AddNoticeDomain addNoticeDomain) {
+        validateAddNotice(addNoticeDomain);
 
-		AddNoticeInfo info = getAddNoticeInfoFrom(addNoticeDomain);
-		int result = noticeService.addNotice(info);
-		if (result == 0) {
-			throw new StatusException("500008", "添加新通知失败");
-		}
-	}
+        AddNoticeInfo info = getAddNoticeInfoFrom(addNoticeDomain);
+        int result = noticeService.addNotice(info);
+        if (result == 0) {
+            throw new StatusException("500008", "添加新通知失败");
+        }
+    }
 
-	@ApiOperation(value = "修改通知信息")
-	@PostMapping("updateNotice")
-	public void updateNotice(@Validated @RequestBody UpdateNoticeDomain updateNoticeDomain) {
-		validateUpdateNotice(updateNoticeDomain);
+    @ApiOperation(value = "修改通知信息")
+    @PostMapping("updateNotice")
+    public void updateNotice(@Validated @RequestBody UpdateNoticeDomain updateNoticeDomain) {
+        validateUpdateNotice(updateNoticeDomain);
 
-		UpdateNoticeInfo info = getUpdateNoticeInfoFrom(updateNoticeDomain);
-		noticeService.updateNotice(info);
-	}
+        UpdateNoticeInfo info = getUpdateNoticeInfoFrom(updateNoticeDomain);
+        noticeService.updateNotice(info);
+    }
 
-	@ApiOperation(value = "删除通知信息")
-	@DeleteMapping("/{noticeId}")
-	public void deleteNotice(
-			@Validated @ApiParam(value = "通知id,多个以逗号分隔") @PathVariable(required = true) String noticeId) {
-		List<Long> noticeIdList = validateDeleteNotice(noticeId);
-		noticeService.deleteNotice(getRootOrgId(), noticeIdList);
-	}
+    @ApiOperation(value = "删除通知信息")
+    @DeleteMapping("/{noticeId}")
+    public void deleteNotice(
+            @Validated @ApiParam(value = "通知id,多个以逗号分隔") @PathVariable(required = true) String noticeId) {
+        List<Long> noticeIdList = validateDeleteNotice(noticeId);
+        noticeService.deleteNotice(getRootOrgId(), noticeIdList);
+    }
 
-	@GetMapping("getUserNoticeList")
-	@ApiOperation(value = "获取用户公告列表")
-	public List<UserNoticeDomain> getUserNoticeList(UserNoticeDomainQuery query) {
-		List<UserNoticeDomain> resultList = new ArrayList<>();
-		UserNoticeInfoQuery noticeQuery = getNoticeInfoQueryFrom(query);
+    @GetMapping("getUserNoticeList")
+    @ApiOperation(value = "获取用户公告列表")
+    public List<UserNoticeDomain> getUserNoticeList(UserNoticeDomainQuery query) {
+        List<UserNoticeDomain> resultList = new ArrayList<>();
+        UserNoticeInfoQuery noticeQuery = getNoticeInfoQueryFrom(query);
 
-		List<UserNoticeInfo> noticeInfoList = noticeService.getNoticeList(noticeQuery);
+        List<UserNoticeInfo> noticeInfoList = noticeService.getNoticeList(noticeQuery);
 
-		if (null != noticeInfoList && !noticeInfoList.isEmpty()) {
-			resultList = getNoticeDomainListFrom(noticeInfoList);
-		}
-		return resultList;
-	}
+        if (null != noticeInfoList && !noticeInfoList.isEmpty()) {
+            resultList = getNoticeDomainListFrom(noticeInfoList);
+        }
+        return resultList;
+    }
 
-	@PostMapping("updateNoticeReadStatus")
-	@ApiOperation(value = "更新通知状态为已读")
-	public void updateNoticeReadStatus(
-			@ApiParam(value = "通知id,多个以逗号分隔") @RequestParam(required = true) String noticeId) {
-		if (StringUtils.isNullOrEmpty(noticeId)) {
-			throw new StatusException("500001", "通知id不允许为空");
-		}
-		User user = this.getAccessUser();
-		noticeService.updateNoticeReadStatus(noticeId, user.getUserType(), user.getUserId());
-	}
+    @PostMapping("updateNoticeReadStatus")
+    @ApiOperation(value = "更新通知状态为已读")
+    public void updateNoticeReadStatus(
+            @ApiParam(value = "通知id,多个以逗号分隔") @RequestParam(required = true) String noticeId) {
+        if (StringUtils.isNullOrEmpty(noticeId)) {
+            throw new StatusException("500001", "通知id不允许为空");
+        }
+        User user = this.getAccessUser();
+        noticeService.updateNoticeReadStatus(noticeId, user.getUserType(), user.getUserId());
+    }
 
-	@ApiOperation(value = "获取消息")
-	@GetMapping("{noticeId}")
-	public NoticeDomain getNotice(@PathVariable Long noticeId) {
-		NoticeEntity ni = GlobalHelper.getEntity(noticeRepo, noticeId, NoticeEntity.class);
-		if (ni == null) {
-			throw new StatusException("600001", "该通知已不存在,请刷新后重试");
-		}
-		NoticeDomain domain = new NoticeDomain();
-		domain.setId(ni.getId());
-		domain.setPublisher(ni.getPublisher());
-		domain.setPublishStatus(ni.getNoticeStatus());
-		domain.setPublishTime(ni.getPublishTime());
-		domain.setTitle(ni.getTitle());
-		domain.setContent(ni.getContent());
-		return domain;
-	}
+    @ApiOperation(value = "获取消息")
+    @GetMapping("{noticeId}")
+    public NoticeDomain getNotice(@PathVariable Long noticeId) {
+        NoticeEntity ni = GlobalHelper.getEntity(noticeRepo, noticeId, NoticeEntity.class);
+        if (ni == null) {
+            throw new StatusException("600001", "该通知已不存在,请刷新后重试");
+        }
+        NoticeDomain domain = new NoticeDomain();
+        domain.setId(ni.getId());
+        domain.setPublisher(ni.getPublisher());
+        domain.setPublishStatus(ni.getNoticeStatus());
+        domain.setPublishTime(ni.getPublishTime());
+        domain.setTitle(ni.getTitle());
+        domain.setContent(ni.getContent());
+        return domain;
+    }
 
-	private UserNoticeInfoQuery getNoticeInfoQueryFrom(UserNoticeDomainQuery query) {
-		User user = this.getAccessUser();
-		UserNoticeInfoQuery noticeQuery = new UserNoticeInfoQuery();
-		noticeQuery.setHasRead(query.getHasRead());
-		noticeQuery.setRootOrgId(user.getRootOrgId());
-		noticeQuery.setUserId(user.getUserId());
-		noticeQuery.setUserType(user.getUserType());
-		return noticeQuery;
-	}
+    private UserNoticeInfoQuery getNoticeInfoQueryFrom(UserNoticeDomainQuery query) {
+        User user = this.getAccessUser();
+        UserNoticeInfoQuery noticeQuery = new UserNoticeInfoQuery();
+        noticeQuery.setHasRead(query.getHasRead());
+        noticeQuery.setRootOrgId(user.getRootOrgId());
+        noticeQuery.setUserId(user.getUserId());
+        noticeQuery.setUserType(user.getUserType());
+        return noticeQuery;
+    }
 
-	private AddNoticeInfo getAddNoticeInfoFrom(AddNoticeDomain addNoticeDomain) {
-		AddNoticeInfo info = new AddNoticeInfo();
-		User accessUser = this.getAccessUser();
-		info.setContent(addNoticeDomain.getContent());
-		info.setPublisher(addNoticeDomain.getPublisher());
-		info.setPublishObjectId(addNoticeDomain.getPublishObjectId());
-		info.setRootOrgId(accessUser.getRootOrgId());
-		info.setRuleType(addNoticeDomain.getRuleType());
-		info.setUserId(accessUser.getUserId());
-		info.setNoticeStatus(addNoticeDomain.getNoticeStatus());
-		info.setTitle(addNoticeDomain.getTitle());
-		return info;
-	}
+    private AddNoticeInfo getAddNoticeInfoFrom(AddNoticeDomain addNoticeDomain) {
+        AddNoticeInfo info = new AddNoticeInfo();
+        User accessUser = this.getAccessUser();
+        info.setContent(addNoticeDomain.getContent());
+        info.setPublisher(addNoticeDomain.getPublisher());
+        info.setPublishObjectId(addNoticeDomain.getPublishObjectId());
+        info.setRootOrgId(accessUser.getRootOrgId());
+        info.setRuleType(addNoticeDomain.getRuleType());
+        info.setUserId(accessUser.getUserId());
+        info.setNoticeStatus(addNoticeDomain.getNoticeStatus());
+        info.setTitle(addNoticeDomain.getTitle());
+        return info;
+    }
 
-	private UpdateNoticeInfo getUpdateNoticeInfoFrom(UpdateNoticeDomain updateNoticeDomain) {
-		UpdateNoticeInfo info = new UpdateNoticeInfo();
-		User accessUser = this.getAccessUser();
-		info.setId(updateNoticeDomain.getId());
-		info.setTitle(updateNoticeDomain.getTitle());
-		info.setContent(updateNoticeDomain.getContent());
-		info.setPublisher(updateNoticeDomain.getPublisher());
-		info.setPublishObjectId(updateNoticeDomain.getPublishObjectId());
-		info.setRootOrgId(accessUser.getRootOrgId());
-		info.setRuleType(updateNoticeDomain.getRuleType());
-		info.setUserId(accessUser.getUserId());
-		info.setNoticeStatus(updateNoticeDomain.getNoticeStatus());
-		return info;
-	}
+    private UpdateNoticeInfo getUpdateNoticeInfoFrom(UpdateNoticeDomain updateNoticeDomain) {
+        UpdateNoticeInfo info = new UpdateNoticeInfo();
+        User accessUser = this.getAccessUser();
+        info.setId(updateNoticeDomain.getId());
+        info.setTitle(updateNoticeDomain.getTitle());
+        info.setContent(updateNoticeDomain.getContent());
+        info.setPublisher(updateNoticeDomain.getPublisher());
+        info.setPublishObjectId(updateNoticeDomain.getPublishObjectId());
+        info.setRootOrgId(accessUser.getRootOrgId());
+        info.setRuleType(updateNoticeDomain.getRuleType());
+        info.setUserId(accessUser.getUserId());
+        info.setNoticeStatus(updateNoticeDomain.getNoticeStatus());
+        return info;
+    }
 
-	private List<UserNoticeDomain> getNoticeDomainListFrom(List<UserNoticeInfo> noticeInfoList) {
-		List<UserNoticeDomain> resultList = new ArrayList<>();
-		for (UserNoticeInfo info : noticeInfoList) {
-			UserNoticeDomain domain = new UserNoticeDomain();
-			domain.setContent(info.getContent());
-			domain.setId(info.getId());
-			domain.setPublisher(info.getPublisher());
-			domain.setPublishTime(info.getPublishTime());
-			domain.setHasRead(info.getHasRead());
-			domain.setTitle(info.getTitle());
-			resultList.add(domain);
-		}
-		return resultList;
-	}
+    private List<UserNoticeDomain> getNoticeDomainListFrom(List<UserNoticeInfo> noticeInfoList) {
+        List<UserNoticeDomain> resultList = new ArrayList<>();
+        for (UserNoticeInfo info : noticeInfoList) {
+            UserNoticeDomain domain = new UserNoticeDomain();
+            domain.setContent(info.getContent());
+            domain.setId(info.getId());
+            domain.setPublisher(info.getPublisher());
+            domain.setPublishTime(info.getPublishTime());
+            domain.setHasRead(info.getHasRead());
+            domain.setTitle(info.getTitle());
+            resultList.add(domain);
+        }
+        return resultList;
+    }
 
-	private PageInfo<NoticeDomain> getPageInfoFrom(PageInfo<NoticeInfo> pagedNoticeInfo) {
-		PageInfo<NoticeDomain> resultPageInfo = new PageInfo<>();
-		resultPageInfo.setTotal(pagedNoticeInfo.getTotal());
-		resultPageInfo.setIndex(pagedNoticeInfo.getIndex());
-		resultPageInfo.setLimit(pagedNoticeInfo.getLimit());
-		resultPageInfo.setPages(pagedNoticeInfo.getPages());
-		resultPageInfo.setSize(pagedNoticeInfo.getSize());
-		List<NoticeInfo> infoList = pagedNoticeInfo.getList();
-		List<NoticeDomain> domainList = new ArrayList<>();
-		if (infoList != null && !infoList.isEmpty()) {
-			for (NoticeInfo ni : infoList) {
-				NoticeDomain domain = new NoticeDomain();
-				domain.setId(ni.getId());
-				domain.setPublisher(ni.getPublisher());
-				domain.setPublishStatus(ni.getPublishStatus());
-				domain.setPublishTime(ni.getPublishTime());
-				domain.setTitle(ni.getTitle());
-				domain.setPublishObject(ni.getPublishObject());
-				domain.setRuleType(ni.getRuleType());
-				domain.setContent(ni.getContent());
-				domainList.add(domain);
-			}
-		}
-		resultPageInfo.setList(domainList);
-		return resultPageInfo;
-	}
+    private PageInfo<NoticeDomain> getPageInfoFrom(PageInfo<NoticeInfo> pagedNoticeInfo) {
+        PageInfo<NoticeDomain> resultPageInfo = new PageInfo<>();
+        resultPageInfo.setTotal(pagedNoticeInfo.getTotal());
+        resultPageInfo.setIndex(pagedNoticeInfo.getIndex());
+        resultPageInfo.setLimit(pagedNoticeInfo.getLimit());
+        resultPageInfo.setPages(pagedNoticeInfo.getPages());
+        resultPageInfo.setSize(pagedNoticeInfo.getSize());
+        List<NoticeInfo> infoList = pagedNoticeInfo.getList();
+        List<NoticeDomain> domainList = new ArrayList<>();
+        if (infoList != null && !infoList.isEmpty()) {
+            for (NoticeInfo ni : infoList) {
+                NoticeDomain domain = new NoticeDomain();
+                domain.setId(ni.getId());
+                domain.setPublisher(ni.getPublisher());
+                domain.setPublishStatus(ni.getPublishStatus());
+                domain.setPublishTime(ni.getPublishTime());
+                domain.setTitle(ni.getTitle());
+                domain.setPublishObject(ni.getPublishObject());
+                domain.setRuleType(ni.getRuleType());
+                domain.setContent(ni.getContent());
+                domainList.add(domain);
+            }
+        }
+        resultPageInfo.setList(domainList);
+        return resultPageInfo;
+    }
 
-	private void validateAddNotice(AddNoticeDomain addNoticeDomain) {
-		if (addNoticeDomain.getRuleType() == NoticeReceiverRuleType.STUDENTS_OF_EXAM
-				|| addNoticeDomain.getRuleType() == NoticeReceiverRuleType.TEACHER_OF_MARK_WORK) {
-			if (StringUtils.isNullOrEmpty(addNoticeDomain.getPublishObjectId())) {
-				throw new StatusException("500009", "发送对象不允许为空");
-			}
-		}
-		String content = addNoticeDomain.getContent();
-		String simpleText = Jsoup.clean(content, Whitelist.simpleText());
-		// 普通文本内容不允许超过500个字
-		if (simpleText.length() > 500) {
-			throw new StatusException("500010", "通知内容不得超过500个字符");
-		}
-		// 总大小不得超过5M
-		if (content.getBytes().length > 5 * 1024) {
-			DecimalFormat decimalFormat = new DecimalFormat("#.##");
-			String currentLength = decimalFormat
-					.format(((double) content.getBytes().length / (double) 1024)/(double)1000);
-			throw new StatusException("500010", "通知内容总大小不得超过5MB,当前大小为:" + currentLength + "MB");
-		}
-	}
+    private void validateAddNotice(AddNoticeDomain addNoticeDomain) {
+        if (addNoticeDomain.getRuleType() == NoticeReceiverRuleType.STUDENTS_OF_EXAM
+                || addNoticeDomain.getRuleType() == NoticeReceiverRuleType.TEACHER_OF_MARK_WORK) {
+            if (StringUtils.isNullOrEmpty(addNoticeDomain.getPublishObjectId())) {
+                throw new StatusException("500009", "发送对象不允许为空");
+            }
+        }
+        String content = addNoticeDomain.getContent();
+        String simpleText = Jsoup.clean(content, Whitelist.simpleText());
+        // 普通文本内容不允许超过500个字
+        if (simpleText.length() > 500) {
+            throw new StatusException("500010", "通知内容不得超过500个字符");
+        }
+        // 总大小不得超过5M
+        if (content.getBytes().length > 5 * 1024 * 1024) {
+            DecimalFormat decimalFormat = new DecimalFormat("#.##");
+            String currentLength = decimalFormat
+                    .format(((double) content.getBytes().length / (double) 1024) / (double) 1024);
+            throw new StatusException("500010", "通知内容总大小不得超过5MB,当前大小为:" + currentLength + "MB");
+        }
+    }
 
-	private void validateUpdateNotice(UpdateNoticeDomain updateNoticeDomain) {
-		if (updateNoticeDomain.getRuleType() == NoticeReceiverRuleType.STUDENTS_OF_EXAM
-				|| updateNoticeDomain
-						.getRuleType() == NoticeReceiverRuleType.TEACHER_OF_MARK_WORK) {
-			if (StringUtils.isNullOrEmpty(updateNoticeDomain.getPublishObjectId())) {
-				throw new StatusException("500011", "发送对象不允许为空");
-			}
-		}
-		String content = updateNoticeDomain.getContent();
-		String simpleText = Jsoup.clean(content, Whitelist.simpleText());
-		// 普通文本内容不允许超过500个字 TODO 该方法待校验,因为不确定富文本框中图片的保存格式
-		if (simpleText.length() > 500) {
-			throw new StatusException("500012", "通知内容不得超过500个字符");
-		}
-		// 总大小不得超过5M
-		if (content.getBytes().length > 5 * 1024) {
-			DecimalFormat decimalFormat = new DecimalFormat("#.##");
-			String currentLength = decimalFormat
-					.format(((double) content.getBytes().length / (double) 1024)/(double)1000);
-			throw new StatusException("500010", "通知内容总大小不得超过5MB,当前大小为:" + currentLength + "MB");
-		}
+    private void validateUpdateNotice(UpdateNoticeDomain updateNoticeDomain) {
+        if (updateNoticeDomain.getRuleType() == NoticeReceiverRuleType.STUDENTS_OF_EXAM
+                || updateNoticeDomain
+                .getRuleType() == NoticeReceiverRuleType.TEACHER_OF_MARK_WORK) {
+            if (StringUtils.isNullOrEmpty(updateNoticeDomain.getPublishObjectId())) {
+                throw new StatusException("500011", "发送对象不允许为空");
+            }
+        }
+        String content = updateNoticeDomain.getContent();
+        String simpleText = Jsoup.clean(content, Whitelist.simpleText());
+        // 普通文本内容不允许超过500个字 TODO 该方法待校验,因为不确定富文本框中图片的保存格式
+        if (simpleText.length() > 500) {
+            throw new StatusException("500012", "通知内容不得超过500个字符");
+        }
+        // 总大小不得超过5M
+        if (content.getBytes().length > 5 * 1024 * 1024) {
+            DecimalFormat decimalFormat = new DecimalFormat("#.##");
+            String currentLength = decimalFormat
+                    .format(((double) content.getBytes().length / (double) 1024) / (double) 1024);
+            throw new StatusException("500010", "通知内容总大小不得超过5MB,当前大小为:" + currentLength + "MB");
+        }
 
-		NoticeEntity notice = GlobalHelper.getEntity(noticeRepo, updateNoticeDomain.getId(),
-				NoticeEntity.class);
-		if (notice == null) {
-			throw new StatusException("500013", "该通知已不存在,请刷新后重试");
-		}
-		if (notice.getNoticeStatus() != NoticeStatus.DRAFT) {
-			throw new StatusException("500014", "该通知状态已变更,请刷新后重试");
-		}
-	}
+        NoticeEntity notice = GlobalHelper.getEntity(noticeRepo, updateNoticeDomain.getId(),
+                NoticeEntity.class);
+        if (notice == null) {
+            throw new StatusException("500013", "该通知已不存在,请刷新后重试");
+        }
+        if (notice.getNoticeStatus() != NoticeStatus.DRAFT) {
+            throw new StatusException("500014", "该通知状态已变更,请刷新后重试");
+        }
+    }
 
-	private List<Long> validateDeleteNotice(String noticeId) {
-		if (noticeId.indexOf(",") > -1 && noticeId.lastIndexOf(",") == noticeId.length() - 1) {
-			noticeId = noticeId.substring(0, noticeId.length() - 1);
-		}
-		String[] noticeIdArr = noticeId.split(",");
-		List<Long> noticeIdList = null;
-		try {
-			noticeIdList = Arrays.asList(noticeIdArr).stream().map(p -> Long.parseLong(p))
-					.collect(Collectors.toList());
-		} catch (Exception e) {
-			throw new StatusException("500015", "通知id格式不正确", e);
-		}
-		List<NoticeEntity> noticeList = noticeRepo.findByIdIn(noticeIdList);
-		boolean existPublishingData = noticeList.stream()
-				.anyMatch(p -> p.getNoticeStatus() != NoticeStatus.DRAFT);
-		if (existPublishingData) {
-			throw new StatusException("500016", "通知状态已改变,不允许删除");
-		}
-		return noticeIdList;
-	}
+    private List<Long> validateDeleteNotice(String noticeId) {
+        if (noticeId.indexOf(",") > -1 && noticeId.lastIndexOf(",") == noticeId.length() - 1) {
+            noticeId = noticeId.substring(0, noticeId.length() - 1);
+        }
+        String[] noticeIdArr = noticeId.split(",");
+        List<Long> noticeIdList = null;
+        try {
+            noticeIdList = Arrays.asList(noticeIdArr).stream().map(p -> Long.parseLong(p))
+                    .collect(Collectors.toList());
+        } catch (Exception e) {
+            throw new StatusException("500015", "通知id格式不正确", e);
+        }
+        List<NoticeEntity> noticeList = noticeRepo.findByIdIn(noticeIdList);
+        boolean existPublishingData = noticeList.stream()
+                .anyMatch(p -> p.getNoticeStatus() != NoticeStatus.DRAFT);
+        if (existPublishingData) {
+            throw new StatusException("500016", "通知状态已改变,不允许删除");
+        }
+        return noticeIdList;
+    }
 
-	@Naked
-	@GetMapping("disposetest")
-	@ApiOperation(value = "获取用户公告列表")
-	public void disposetest() {
-		// 获取待处理的通知进度数据
-		List<NoticeRulePublishProgressEntity> progressList = noticeService
-				.getToBeDisposedNoticeRulePublishProgressList();
-		if (progressList == null || progressList.isEmpty()) {
-			return;
-		}
+    @Naked
+    @GetMapping("disposetest")
+    @ApiOperation(value = "获取用户公告列表")
+    public void disposetest() {
+        // 获取待处理的通知进度数据
+        List<NoticeRulePublishProgressEntity> progressList = noticeService
+                .getToBeDisposedNoticeRulePublishProgressList();
+        if (progressList == null || progressList.isEmpty()) {
+            return;
+        }
 
-		for (NoticeRulePublishProgressEntity progress : progressList) {
-			Long startUserId = 0L;
-			int loopTimes = 0;
-			Long lastMaxUserId = getLastMaxUserId(progress.getNoticeReceiverRuleType(), progress);
-			if (lastMaxUserId != null) {
-				startUserId = lastMaxUserId + 1;
-			}
-			while (true) {
-				Long nextUserId = noticeService.disposePublishingUserNotice(startUserId, progress);
+        for (NoticeRulePublishProgressEntity progress : progressList) {
+            Long startUserId = 0L;
+            int loopTimes = 0;
+            Long lastMaxUserId = getLastMaxUserId(progress.getNoticeReceiverRuleType(), progress);
+            if (lastMaxUserId != null) {
+                startUserId = lastMaxUserId + 1;
+            }
+            while (true) {
+                Long nextUserId = noticeService.disposePublishingUserNotice(startUserId, progress);
 
-				if (nextUserId.equals(startUserId)) {
-					noticeService.updateNoticeStatus(progress.getNoticeId(),
-							NoticeStatus.PUBLISHED);
-					break;
-				} else {
-					startUserId = nextUserId;
-					// 处理中的状态只需更新一次
-					if (loopTimes == 1) {
-						noticeService.updateNoticeStatus(progress.getNoticeId(),
-								NoticeStatus.PUBLISHING);
-					}
-				}
-				loopTimes++;
-			}
-		}
-	}
+                if (nextUserId.equals(startUserId)) {
+                    noticeService.updateNoticeStatus(progress.getNoticeId(),
+                            NoticeStatus.PUBLISHED);
+                    break;
+                } else {
+                    startUserId = nextUserId;
+                    // 处理中的状态只需更新一次
+                    if (loopTimes == 1) {
+                        noticeService.updateNoticeStatus(progress.getNoticeId(),
+                                NoticeStatus.PUBLISHING);
+                    }
+                }
+                loopTimes++;
+            }
+        }
+    }
 
-	/**
-	 * 获取上次更新的最大用户id
-	 *
-	 * @param ruleType
-	 * @param process
-	 * @return
-	 */
-	private Long getLastMaxUserId(NoticeReceiverRuleType ruleType,
-			NoticeRulePublishProgressEntity process) {
-		if (ruleType == NoticeReceiverRuleType.ALL_STUDENTS_OF_ROOT_ORG
-				|| ruleType == NoticeReceiverRuleType.STUDENTS_OF_EXAM) {
-			return process.getMaxStudentId();
-		} else {
-			return process.getMaxCommonUserId();
-		}
-	}
+    /**
+     * 获取上次更新的最大用户id
+     *
+     * @param ruleType
+     * @param process
+     * @return
+     */
+    private Long getLastMaxUserId(NoticeReceiverRuleType ruleType,
+                                  NoticeRulePublishProgressEntity process) {
+        if (ruleType == NoticeReceiverRuleType.ALL_STUDENTS_OF_ROOT_ORG
+                || ruleType == NoticeReceiverRuleType.STUDENTS_OF_EXAM) {
+            return process.getMaxStudentId();
+        } else {
+            return process.getMaxCommonUserId();
+        }
+    }
 }