|
|
|
@ -64,7 +64,6 @@ public class UserMessageServiceImpl implements UserMessageService {
|
|
|
|
|
private final WebSocketServer webSocketServer;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public Map<String, Object> queryAll(UserMessageQueryCriteria criteria, Pageable pageable) {
|
|
|
|
|
|
|
|
|
@ -78,17 +77,17 @@ public class UserMessageServiceImpl implements UserMessageService {
|
|
|
|
|
Sort sort =
|
|
|
|
|
Sort.by(Sort.Direction.DESC, "updateTime");
|
|
|
|
|
if (criteria.getStatus() != null &&
|
|
|
|
|
criteria.getStatus() != DefaultNumberConstants.MINUS_ONE_NUMBER){
|
|
|
|
|
sort = Sort.by(Sort.Direction.ASC, "messageType").
|
|
|
|
|
and(Sort.by(Sort.Direction.ASC, "level")).
|
|
|
|
|
and(Sort.by(Sort.Direction.DESC, "isTop")).
|
|
|
|
|
and(Sort.by(Sort.Direction.ASC, "isRead")).
|
|
|
|
|
and(Sort.by(Sort.Direction.DESC, "updateTime")).
|
|
|
|
|
and(Sort.by(Sort.Direction.DESC, "id"));
|
|
|
|
|
criteria.getStatus() != DefaultNumberConstants.MINUS_ONE_NUMBER) {
|
|
|
|
|
sort = Sort.by(Sort.Direction.ASC, "messageType").
|
|
|
|
|
and(Sort.by(Sort.Direction.ASC, "level")).
|
|
|
|
|
and(Sort.by(Sort.Direction.DESC, "isTop")).
|
|
|
|
|
and(Sort.by(Sort.Direction.ASC, "isRead")).
|
|
|
|
|
and(Sort.by(Sort.Direction.DESC, "updateTime")).
|
|
|
|
|
and(Sort.by(Sort.Direction.DESC, "id"));
|
|
|
|
|
}
|
|
|
|
|
PageRequest pageRequest = PageRequest.of(page, size, sort);
|
|
|
|
|
Page<UserMessage> pageAll = userMessageRepository.findAll(
|
|
|
|
|
(root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root, criteria, criteriaBuilder),pageRequest);
|
|
|
|
|
(root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root, criteria, criteriaBuilder), pageRequest);
|
|
|
|
|
return PageUtil.toPage(pageAll.map(userMessageMapper::toDto));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -117,7 +116,7 @@ public class UserMessageServiceImpl implements UserMessageService {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void deleteAll(Long[] ids) {
|
|
|
|
|
public void deleteAll(List<Long> ids) {
|
|
|
|
|
for (Long id : ids) {
|
|
|
|
|
userMessageRepository.deleteById(id);
|
|
|
|
|
}
|
|
|
|
@ -145,11 +144,11 @@ public class UserMessageServiceImpl implements UserMessageService {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public Boolean createUserMessage(List<Long> longList, MessageNotification messageNotification,Integer type) {
|
|
|
|
|
public Boolean createUserMessage(List<Long> longList, MessageNotification messageNotification, Integer type) {
|
|
|
|
|
Map<Long, Object> hashMap = new HashMap<>(DefaultNumberConstants.FIFTEEN_NUMBER);
|
|
|
|
|
if (CollUtil.isNotEmpty(longList)) {
|
|
|
|
|
// 自提醒保存任务
|
|
|
|
|
if (messageNotification.getMessageType() != null &&
|
|
|
|
|
if (messageNotification.getMessageType() != null &&
|
|
|
|
|
messageNotification.getMessageType() == DefaultNumberConstants.TWO_NUMBER
|
|
|
|
|
&& type == DefaultNumberConstants.ONE_NUMBER) {
|
|
|
|
|
autoReminderService.addTimeTask(messageNotification, longList.get(DefaultNumberConstants.ZERO_NUMBER));
|
|
|
|
@ -179,7 +178,7 @@ public class UserMessageServiceImpl implements UserMessageService {
|
|
|
|
|
public Boolean deleteAllByMessageId(Integer num, Long messageId) {
|
|
|
|
|
return userMessageRepository.
|
|
|
|
|
deleteUserMessageByMessageId(num, messageId) >
|
|
|
|
|
DefaultNumberConstants.ZERO_NUMBER;
|
|
|
|
|
DefaultNumberConstants.ZERO_NUMBER;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -227,7 +226,7 @@ public class UserMessageServiceImpl implements UserMessageService {
|
|
|
|
|
case DefaultNumberConstants.TWO_NUMBER:
|
|
|
|
|
userMessage.setStatus(DefaultNumberConstants.MINUS_ONE_NUMBER);
|
|
|
|
|
userMessageRepository.deleteUserMessageByMessageId
|
|
|
|
|
(DefaultNumberConstants.MINUS_TWO_NUMBER,userMessage.getMessageId());
|
|
|
|
|
(DefaultNumberConstants.MINUS_TWO_NUMBER, userMessage.getMessageId());
|
|
|
|
|
break;
|
|
|
|
|
case DefaultNumberConstants.THREE_NUMBER:
|
|
|
|
|
userMessage.setIsRead(Boolean.TRUE);
|
|
|
|
@ -242,5 +241,20 @@ public class UserMessageServiceImpl implements UserMessageService {
|
|
|
|
|
return userMessageMapper.toDto(new UserMessage());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public List<UserMessage> selectByTimeAndStatus(String time, Integer status, Boolean isTop) {
|
|
|
|
|
return userMessageRepository.selectByTimeAndStatus(time, status, isTop);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public List<UserMessage> selectByStatus(Integer status) {
|
|
|
|
|
return userMessageRepository.selectByStatus(status);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void saveAll(List<UserMessage> userMessages) {
|
|
|
|
|
userMessageRepository.saveAll(userMessages);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|