|
|
@ -12,9 +12,7 @@ import com.storeroom.modules.system.repository.NoticeUsersRepository; |
|
|
|
import com.storeroom.modules.system.service.NoticeService; |
|
|
|
import com.storeroom.modules.system.service.dto.NoticeDto; |
|
|
|
import com.storeroom.modules.system.service.dto.NoticeQueryCriteria; |
|
|
|
import com.storeroom.utils.NanoIdUtils; |
|
|
|
import com.storeroom.utils.PageUtil; |
|
|
|
import com.storeroom.utils.QueryHelp; |
|
|
|
import com.storeroom.utils.*; |
|
|
|
import lombok.RequiredArgsConstructor; |
|
|
|
import lombok.SneakyThrows; |
|
|
|
import org.hibernate.validator.constraints.UniqueElements; |
|
|
@ -53,19 +51,23 @@ public class NoticeServiceImpl implements NoticeService { |
|
|
|
|
|
|
|
Set<Long> deviceInfos = noticeDto.getUserId(); |
|
|
|
|
|
|
|
|
|
|
|
String pushUser = SecurityUtils.getCurrentUsername(); |
|
|
|
for (Long userid : deviceInfos) { |
|
|
|
NoticeUsers noticeUsers = new NoticeUsers(); |
|
|
|
Set<NoticeUsers> noticeUsersList = new LinkedHashSet<>(); |
|
|
|
Notice notice = noticeRepository.findById(noticeDto.getId()).orElseGet(Notice::new); |
|
|
|
|
|
|
|
noticeUsers.setId(NanoIdUtils.randomNanoId()); |
|
|
|
noticeUsers.setIsRead(false); |
|
|
|
noticeUsers.setUserId(userid); |
|
|
|
noticeUsers.setNoticeId(noticeDto.getId()); |
|
|
|
if (!StringUtils.isEmpty(pushUser)) { |
|
|
|
noticeUsers.setPushUserName(pushUser); |
|
|
|
} |
|
|
|
noticeUsers.setPushUserName("admin"); |
|
|
|
noticeEntity.setNoticeUsers(noticeUsersList); |
|
|
|
noticeUsersList.add(noticeUsers); |
|
|
|
noticeEntity.setNoticeUsers(noticeUsersList); |
|
|
|
noticeUsersRepository.save(noticeUsers); |
|
|
|
noticeUsersRepository.save(noticeUsers); |
|
|
|
} |
|
|
|
noticeRepository.save(noticeEntity); |
|
|
|
} |
|
|
@ -82,7 +84,6 @@ public class NoticeServiceImpl implements NoticeService { |
|
|
|
noticeEntity.setNoticeTitle(noticeDto.getNoticeTitle()); |
|
|
|
noticeEntity.setStatus(false); |
|
|
|
noticeEntity.setPushType(noticeDto.getPushType()); |
|
|
|
|
|
|
|
Set<String> deviceInfos = noticeDto.getDeviceInfoId(); |
|
|
|
|
|
|
|
for (String d : deviceInfos) { |
|
|
|