|
@@ -46,7 +46,7 @@ import cn.com.qmth.examcloud.core.examwork.dao.NoticeRepo;
|
|
|
import cn.com.qmth.examcloud.core.examwork.dao.UserNoticeRepo;
|
|
|
import cn.com.qmth.examcloud.core.examwork.dao.entity.ExamEntity;
|
|
|
import cn.com.qmth.examcloud.core.examwork.dao.entity.NoticeEntity;
|
|
|
-import cn.com.qmth.examcloud.core.examwork.dao.entity.NoticePublishScheduleEntity;
|
|
|
+import cn.com.qmth.examcloud.core.examwork.dao.entity.NoticeRulePublishProgressEntity;
|
|
|
import cn.com.qmth.examcloud.core.examwork.dao.entity.NoticeReceiverRuleEntity;
|
|
|
import cn.com.qmth.examcloud.core.examwork.dao.entity.UserNoticeEntity;
|
|
|
import cn.com.qmth.examcloud.core.examwork.service.NoticeService;
|
|
@@ -162,7 +162,7 @@ public class NoticeServiceImpl implements NoticeService {
|
|
|
DBUtil.toSqlSearchPattern(infoQuery.getTitle())));
|
|
|
}
|
|
|
if (null != infoQuery.getPublishStatus()) {
|
|
|
- List<NoticePublishScheduleEntity> byPublishStatusNoticeScheduleList = noticePublishScheduleRepo
|
|
|
+ List<NoticeRulePublishProgressEntity> byPublishStatusNoticeScheduleList = noticePublishScheduleRepo
|
|
|
.findByRootOrgIdAndPublishStatus(rootOrgId, infoQuery.getPublishStatus());
|
|
|
if (null == byPublishStatusNoticeScheduleList
|
|
|
|| byPublishStatusNoticeScheduleList.isEmpty()) {
|
|
@@ -170,7 +170,7 @@ public class NoticeServiceImpl implements NoticeService {
|
|
|
}
|
|
|
// 获取相应发布状态的通知id集合
|
|
|
List<Long> noticeIdList = byPublishStatusNoticeScheduleList.stream()
|
|
|
- .map(NoticePublishScheduleEntity::getNoticeId).collect(Collectors.toList());
|
|
|
+ .map(NoticeRulePublishProgressEntity::getNoticeId).collect(Collectors.toList());
|
|
|
CriteriaBuilder.In<Object> inCriteriaBuilder = cb.in(root.get("id"));
|
|
|
for (Long nid : noticeIdList) {
|
|
|
inCriteriaBuilder.value(nid);
|
|
@@ -233,7 +233,7 @@ public class NoticeServiceImpl implements NoticeService {
|
|
|
noticeReceiverRuleRepo.saveAll(ruleList);
|
|
|
|
|
|
// 保存公告发布进度
|
|
|
- NoticePublishScheduleEntity publishScheduleEntity = getNoticePublishScheduleEntityFrom(
|
|
|
+ NoticeRulePublishProgressEntity publishScheduleEntity = getNoticePublishScheduleEntityFrom(
|
|
|
addNoticeInfo, noticeId);
|
|
|
noticePublishScheduleRepo.save(publishScheduleEntity);
|
|
|
|
|
@@ -243,11 +243,11 @@ public class NoticeServiceImpl implements NoticeService {
|
|
|
|
|
|
@Transactional
|
|
|
@Override
|
|
|
- public NoticePublishScheduleEntity updateNotice(UpdateNoticeInfo info) {
|
|
|
+ public NoticeRulePublishProgressEntity updateNotice(UpdateNoticeInfo info) {
|
|
|
Long rootOrgId = info.getRootOrgId();
|
|
|
List<Long> noticeIdList = Collections.singletonList(info.getId());
|
|
|
// 校验通知状态,正在发送的通知不允许修改
|
|
|
- NoticePublishScheduleEntity publishSchedule = noticePublishScheduleRepo
|
|
|
+ NoticeRulePublishProgressEntity publishSchedule = noticePublishScheduleRepo
|
|
|
.findByRootOrgIdAndNoticeId(info.getRootOrgId(), info.getId());
|
|
|
if (publishSchedule == null) {
|
|
|
throw new StatusException("501007", "找不到通知id为:" + info.getId() + "的通知进度数据");
|
|
@@ -279,16 +279,16 @@ public class NoticeServiceImpl implements NoticeService {
|
|
|
|
|
|
// 更新公告发布进度实体
|
|
|
noticePublishScheduleRepo.deleteByRootOrgIdAndNoticeIdIn(rootOrgId, noticeIdList);
|
|
|
- NoticePublishScheduleEntity publishScheduleEntity = getNoticePublishScheduleEntityFrom(
|
|
|
+ NoticeRulePublishProgressEntity publishScheduleEntity = getNoticePublishScheduleEntityFrom(
|
|
|
info);
|
|
|
- NoticePublishScheduleEntity saved = noticePublishScheduleRepo.save(publishScheduleEntity);
|
|
|
+ NoticeRulePublishProgressEntity saved = noticePublishScheduleRepo.save(publishScheduleEntity);
|
|
|
|
|
|
return saved;
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
public void disposePublishingUserNotice() {
|
|
|
- List<NoticePublishScheduleEntity> publishingScheduleList = noticePublishScheduleRepo
|
|
|
+ List<NoticeRulePublishProgressEntity> publishingScheduleList = noticePublishScheduleRepo
|
|
|
.findByPublishStatus(NoticePublishStatus.PUBLISHING);
|
|
|
// 如果没有状态为发布中的数据,则直接返回
|
|
|
if (publishingScheduleList == null || publishingScheduleList.isEmpty()) {
|
|
@@ -296,7 +296,7 @@ public class NoticeServiceImpl implements NoticeService {
|
|
|
}
|
|
|
// 发布通知每次处理的用户id数量 // TODO: 2019/7/10 需要将参数放到配置文件
|
|
|
int rowNumber = PropertyHolder.getInt("notice.dispose.userId.size", 100);
|
|
|
- for (NoticePublishScheduleEntity publishSchedule : publishingScheduleList) {
|
|
|
+ for (NoticeRulePublishProgressEntity publishSchedule : publishingScheduleList) {
|
|
|
Long rootOrgId = publishSchedule.getRootOrgId();
|
|
|
Long noticeId = publishSchedule.getNoticeId();
|
|
|
List<NoticeReceiverRuleEntity> ruleList = getReceiverRuleList(rootOrgId, noticeId);
|
|
@@ -369,7 +369,7 @@ public class NoticeServiceImpl implements NoticeService {
|
|
|
*/
|
|
|
private void batchAddUserNotice(Long rootOrgId, Long noticeId, int rowNumber, Long startUserId,
|
|
|
NoticeReceiverRuleType ruleType, List<NoticeReceiverRuleEntity> ruleList,
|
|
|
- NoticePublishScheduleEntity publishSchedule) {
|
|
|
+ NoticeRulePublishProgressEntity publishSchedule) {
|
|
|
if (rowNumber < 1) {
|
|
|
throw new StatusException("501010", "读取的数据行数不得少于1行");
|
|
|
}
|
|
@@ -399,7 +399,7 @@ public class NoticeServiceImpl implements NoticeService {
|
|
|
*/
|
|
|
@Transactional
|
|
|
void saveUserNoticeAndUpdatePublishSchedule(Long rootOrgId, Long noticeId,
|
|
|
- NoticeReceiverRuleType ruleType, NoticePublishScheduleEntity publishSchedule,
|
|
|
+ NoticeReceiverRuleType ruleType, NoticeRulePublishProgressEntity publishSchedule,
|
|
|
List<Long> limitStudentIdList, Long maxUserId) {
|
|
|
// 保存并更新发布状态为发布完成
|
|
|
List<UserNoticeEntity> userNoticeList = new ArrayList<>();
|
|
@@ -422,7 +422,7 @@ public class NoticeServiceImpl implements NoticeService {
|
|
|
* @param publishSchedule
|
|
|
* @param limitStudentIdList
|
|
|
*/
|
|
|
- private void finishNoticePublishSchedule(NoticePublishScheduleEntity publishSchedule) {
|
|
|
+ private void finishNoticePublishSchedule(NoticeRulePublishProgressEntity publishSchedule) {
|
|
|
publishSchedule.setPublishStatus(NoticePublishStatus.PUBLISHED);
|
|
|
noticePublishScheduleRepo.save(publishSchedule);
|
|
|
}
|
|
@@ -572,7 +572,7 @@ public class NoticeServiceImpl implements NoticeService {
|
|
|
* @return
|
|
|
*/
|
|
|
private Long getLastMaxUserId(NoticeReceiverRuleType ruleType,
|
|
|
- NoticePublishScheduleEntity publishSchedule) {
|
|
|
+ NoticeRulePublishProgressEntity publishSchedule) {
|
|
|
if (ruleType == NoticeReceiverRuleType.ALL_STUDENTS_OF_ROOT_ORG
|
|
|
|| ruleType == NoticeReceiverRuleType.STUDENTS_OF_EXAM) {
|
|
|
return publishSchedule.getMaxStudentId();
|
|
@@ -589,7 +589,7 @@ public class NoticeServiceImpl implements NoticeService {
|
|
|
* @return 发布状态枚举
|
|
|
*/
|
|
|
private NoticePublishStatus getNoticePublishStatus(Long rootOrgId, NoticeEntity ne) {
|
|
|
- NoticePublishScheduleEntity publishSchedule = noticePublishScheduleRepo
|
|
|
+ NoticeRulePublishProgressEntity publishSchedule = noticePublishScheduleRepo
|
|
|
.findByRootOrgIdAndNoticeId(rootOrgId, ne.getId());
|
|
|
|
|
|
if (publishSchedule == null) {
|
|
@@ -705,9 +705,9 @@ public class NoticeServiceImpl implements NoticeService {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- private NoticePublishScheduleEntity getNoticePublishScheduleEntityFrom(
|
|
|
+ private NoticeRulePublishProgressEntity getNoticePublishScheduleEntityFrom(
|
|
|
AddNoticeInfo addNoticeInfo, Long noticeId) {
|
|
|
- NoticePublishScheduleEntity publishScheduleEntity = new NoticePublishScheduleEntity();
|
|
|
+ NoticeRulePublishProgressEntity publishScheduleEntity = new NoticeRulePublishProgressEntity();
|
|
|
publishScheduleEntity.setRootOrgId(addNoticeInfo.getRootOrgId());
|
|
|
publishScheduleEntity.setNoticeId(noticeId);
|
|
|
if (addNoticeInfo.getNoticeStatus() == NoticeStatus.PUBLISH) {
|
|
@@ -778,8 +778,8 @@ public class NoticeServiceImpl implements NoticeService {
|
|
|
return strIds;
|
|
|
}
|
|
|
|
|
|
- private NoticePublishScheduleEntity getNoticePublishScheduleEntityFrom(UpdateNoticeInfo info) {
|
|
|
- NoticePublishScheduleEntity publishScheduleEntity = new NoticePublishScheduleEntity();
|
|
|
+ private NoticeRulePublishProgressEntity getNoticePublishScheduleEntityFrom(UpdateNoticeInfo info) {
|
|
|
+ NoticeRulePublishProgressEntity publishScheduleEntity = new NoticeRulePublishProgressEntity();
|
|
|
publishScheduleEntity.setRootOrgId(info.getRootOrgId());
|
|
|
publishScheduleEntity.setNoticeId(info.getId());
|
|
|
if (info.getNoticeStatus() == NoticeStatus.PUBLISH) {
|