|
@@ -98,7 +98,13 @@ public class NoticeServiceImpl implements NoticeService {
|
|
|
|
|
|
@Override
|
|
|
public int updateNoticeReadStatus(String noticeId, UserType userType, Long userId) {
|
|
|
- return userNoticeRepo.updateNoticeReadStatus(noticeId, userType, userId);
|
|
|
+ List<Long> noticeIdList = new ArrayList<>();
|
|
|
+ if (noticeId.indexOf(",")>-1){
|
|
|
+ noticeIdList=Arrays.asList(noticeId.split(",")).stream().map(p->Long.parseLong(p)).collect(Collectors.toList());
|
|
|
+ }else {
|
|
|
+ noticeIdList=Arrays.asList(noticeId).stream().map(p->Long.parseLong(p)).collect(Collectors.toList());
|
|
|
+ }
|
|
|
+ return userNoticeRepo.updateNoticeReadStatus(noticeIdList, userType.toString(), userId);
|
|
|
}
|
|
|
|
|
|
@Override
|
|
@@ -312,10 +318,10 @@ public class NoticeServiceImpl implements NoticeService {
|
|
|
|
|
|
//如果起始id和方法返回的下次查询id相同,说明数据已经取完,否则继续查询
|
|
|
if (startUserId.equals(nextId)) {
|
|
|
- finishNoticePublishSchedule(rootOrgId, noticeId, ruleType, publishSchedule, limitStudentIdList);
|
|
|
+ finishNoticePublishSchedule(publishSchedule);
|
|
|
} else {
|
|
|
- updateNoticePublishSchedule(publishSchedule, maxUserId);
|
|
|
- batchAddUserNotice(rootOrgId, noticeId, rowNumber, startUserId, ruleType, ruleList, publishSchedule);
|
|
|
+ saveUserNoticeAndUpdatePublishSchedule(rootOrgId, noticeId, ruleType, publishSchedule, limitStudentIdList, maxUserId);
|
|
|
+ batchAddUserNotice(rootOrgId, noticeId, rowNumber, nextId, ruleType, ruleList, publishSchedule);
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -325,7 +331,15 @@ public class NoticeServiceImpl implements NoticeService {
|
|
|
* @param publishSchedule
|
|
|
* @param maxUserId
|
|
|
*/
|
|
|
- private void updateNoticePublishSchedule(NoticePublishScheduleEntity publishSchedule, Long maxUserId) {
|
|
|
+ @Transactional
|
|
|
+ void saveUserNoticeAndUpdatePublishSchedule(Long rootOrgId, Long noticeId, NoticeReceiverRuleType ruleType, NoticePublishScheduleEntity publishSchedule, List<Long> limitStudentIdList, Long maxUserId) {
|
|
|
+ //保存并更新发布状态为发布完成
|
|
|
+ List<UserNoticeEntity> userNoticeList = new ArrayList<>();
|
|
|
+ for (Long userId : limitStudentIdList) {
|
|
|
+ UserNoticeEntity userNotice = initUserNoticeEntity(rootOrgId, userId, noticeId, ruleType);
|
|
|
+ userNoticeList.add(userNotice);
|
|
|
+ }
|
|
|
+ userNoticeRepo.saveAll(userNoticeList);
|
|
|
publishSchedule.setMaxStudentId(maxUserId);
|
|
|
noticePublishScheduleRepo.save(publishSchedule);
|
|
|
}
|
|
@@ -339,15 +353,7 @@ public class NoticeServiceImpl implements NoticeService {
|
|
|
* @param publishSchedule
|
|
|
* @param limitStudentIdList
|
|
|
*/
|
|
|
- @Transactional
|
|
|
- public void finishNoticePublishSchedule(Long rootOrgId, Long noticeId, NoticeReceiverRuleType ruleType, NoticePublishScheduleEntity publishSchedule, List<Long> limitStudentIdList) {
|
|
|
- //保存并更新发布状态为发布完成
|
|
|
- List<UserNoticeEntity> userNoticeList = new ArrayList<>();
|
|
|
- for (Long userId : limitStudentIdList) {
|
|
|
- UserNoticeEntity userNotice = initUserNoticeEntity(rootOrgId, userId, noticeId, ruleType);
|
|
|
- userNoticeList.add(userNotice);
|
|
|
- }
|
|
|
- userNoticeRepo.saveAll(userNoticeList);
|
|
|
+ private void finishNoticePublishSchedule( NoticePublishScheduleEntity publishSchedule) {
|
|
|
publishSchedule.setPublishStatus(NoticePublishStatus.PUBLISHED);
|
|
|
noticePublishScheduleRepo.save(publishSchedule);
|
|
|
}
|