|
|
|
@ -54,6 +54,9 @@ public class PaperService extends AbstractActivityService<Paper, PaperDto, Paper
|
|
|
|
|
private final EventService eventService;
|
|
|
|
|
private final PingService pingService;
|
|
|
|
|
|
|
|
|
|
private Paper.PaperStatus oldStatus;
|
|
|
|
|
private Set<User> oldAuthors;
|
|
|
|
|
|
|
|
|
|
public PaperService(PaperRepository paperRepository,
|
|
|
|
|
FileService fileService,
|
|
|
|
|
PaperNotificationService paperNotificationService,
|
|
|
|
@ -99,8 +102,6 @@ public class PaperService extends AbstractActivityService<Paper, PaperDto, Paper
|
|
|
|
|
|
|
|
|
|
@Transactional
|
|
|
|
|
public Paper update(Paper paper) {
|
|
|
|
|
Paper.PaperStatus oldStatus = paper.getStatus();
|
|
|
|
|
Set<User> oldAuthors = new HashSet<>(paper.getAuthors());
|
|
|
|
|
paperRepository.save(paper);
|
|
|
|
|
paperNotificationService.sendCreateNotification(paper, oldAuthors);
|
|
|
|
|
paperNotificationService.statusChangeNotification(paper, oldStatus);
|
|
|
|
@ -116,6 +117,8 @@ public class PaperService extends AbstractActivityService<Paper, PaperDto, Paper
|
|
|
|
|
public PaperDto update(PaperDto paperDto) {
|
|
|
|
|
Paper paper = paperRepository.findById(paperDto.getId())
|
|
|
|
|
.orElseThrow(() -> new EntityNotFoundException("Paper with id=" + paperDto.getId() + " not found"));
|
|
|
|
|
oldStatus = paper.getStatus();
|
|
|
|
|
oldAuthors = new HashSet<>(paper.getAuthors());
|
|
|
|
|
|
|
|
|
|
//TODO: move to service
|
|
|
|
|
if (paperDto.getFiles() != null) {
|
|
|
|
|