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