|
@@ -51,15 +51,13 @@ public class NoticeController extends ControllerSupport {
|
|
@GetMapping("getPagedNoticeList/{curPage}/{pageSize}")
|
|
@GetMapping("getPagedNoticeList/{curPage}/{pageSize}")
|
|
public PageInfo<NoticeDomain> getPagedNoticeList(@PathVariable Integer curPage,
|
|
public PageInfo<NoticeDomain> getPagedNoticeList(@PathVariable Integer curPage,
|
|
@PathVariable Integer pageSize, NoticeDomainQuery query) {
|
|
@PathVariable Integer pageSize, NoticeDomainQuery query) {
|
|
- PageInfo<NoticeDomain> resultPageInfo = new PageInfo<>();
|
|
|
|
User accessUser = this.getAccessUser();
|
|
User accessUser = this.getAccessUser();
|
|
NoticeInfoQuery infoQuery = new NoticeInfoQuery();
|
|
NoticeInfoQuery infoQuery = new NoticeInfoQuery();
|
|
infoQuery.setTitle(query.getTitle());
|
|
infoQuery.setTitle(query.getTitle());
|
|
infoQuery.setRootOrgId(accessUser.getRootOrgId());
|
|
infoQuery.setRootOrgId(accessUser.getRootOrgId());
|
|
infoQuery.setUserId(accessUser.getUserId());
|
|
infoQuery.setUserId(accessUser.getUserId());
|
|
PageInfo<NoticeInfo> pagedNoticeInfo = noticeService.getPagedNoticeList(curPage, pageSize, infoQuery);
|
|
PageInfo<NoticeInfo> pagedNoticeInfo = noticeService.getPagedNoticeList(curPage, pageSize, infoQuery);
|
|
- resultPageInfo = getPageInfoFrom(pagedNoticeInfo);
|
|
|
|
- return resultPageInfo;
|
|
|
|
|
|
+ return getPageInfoFrom(pagedNoticeInfo);
|
|
}
|
|
}
|
|
|
|
|
|
@ApiOperation(value = "修改通知信息")
|
|
@ApiOperation(value = "修改通知信息")
|
|
@@ -94,10 +92,7 @@ public class NoticeController extends ControllerSupport {
|
|
@DeleteMapping("/{noticeId}")
|
|
@DeleteMapping("/{noticeId}")
|
|
public void deleteNotice(@Validated @ApiParam(value = "通知id,多个以逗号分隔") @PathVariable(required = true) String noticeId) {
|
|
public void deleteNotice(@Validated @ApiParam(value = "通知id,多个以逗号分隔") @PathVariable(required = true) String noticeId) {
|
|
List<Long> noticeIdList= validateDeleteNotice(noticeId);
|
|
List<Long> noticeIdList= validateDeleteNotice(noticeId);
|
|
- int result = noticeService.deleteNotice(getRootOrgId(),noticeIdList);
|
|
|
|
- if (result==0){
|
|
|
|
- throw new StatusException("500006","删除失败");
|
|
|
|
- }
|
|
|
|
|
|
+ noticeService.deleteNotice(getRootOrgId(),noticeIdList);
|
|
}
|
|
}
|
|
|
|
|
|
@GetMapping("getUserNoticeList")
|
|
@GetMapping("getUserNoticeList")
|
|
@@ -213,10 +208,11 @@ public class NoticeController extends ControllerSupport {
|
|
}
|
|
}
|
|
String content = addNoticeDomain.getContent();
|
|
String content = addNoticeDomain.getContent();
|
|
String simpleText = Jsoup.clean(content, Whitelist.simpleText());
|
|
String simpleText = Jsoup.clean(content, Whitelist.simpleText());
|
|
- //普通文本内容不允许超过500个字 TODO 该方法待校验,因为不确定富文本框中图片的保存格式
|
|
|
|
|
|
+ //普通文本内容不允许超过500个字
|
|
if (simpleText.length()>500){
|
|
if (simpleText.length()>500){
|
|
throw new StatusException("500010","通知内容不得超过500个字符");
|
|
throw new StatusException("500010","通知内容不得超过500个字符");
|
|
}
|
|
}
|
|
|
|
+ //TODO 加上总长度校验(5M,找张莹确定)
|
|
}
|
|
}
|
|
private void validateUpdateNotice(UpdateNoticeDomain updateNoticeDomain) {
|
|
private void validateUpdateNotice(UpdateNoticeDomain updateNoticeDomain) {
|
|
if (updateNoticeDomain.getRuleType()== NoticeReceiverRuleType.STUDENTS_OF_EXAM
|
|
if (updateNoticeDomain.getRuleType()== NoticeReceiverRuleType.STUDENTS_OF_EXAM
|
|
@@ -231,6 +227,7 @@ public class NoticeController extends ControllerSupport {
|
|
if (simpleText.length()>500){
|
|
if (simpleText.length()>500){
|
|
throw new StatusException("500012","通知内容不得超过500个字符");
|
|
throw new StatusException("500012","通知内容不得超过500个字符");
|
|
}
|
|
}
|
|
|
|
+ //TODO 校验总大小
|
|
NoticeEntity notice = GlobalHelper.getEntity(noticeRepo, updateNoticeDomain.getId(), NoticeEntity.class);
|
|
NoticeEntity notice = GlobalHelper.getEntity(noticeRepo, updateNoticeDomain.getId(), NoticeEntity.class);
|
|
if (notice==null){
|
|
if (notice==null){
|
|
throw new StatusException("500013","该通知已不存在,请刷新后重试");
|
|
throw new StatusException("500013","该通知已不存在,请刷新后重试");
|