Merge branch 'dev' into 'master'
Dev to master See merge request romanov73/ng-tracker!25
This commit is contained in:
commit
f7bbf4d746
@ -1,4 +1,4 @@
|
|||||||
# NG-Tracker
|
# ![NG](http://193.110.3.124:8080/favicon.ico) NG-Tracker
|
||||||
|
|
||||||
Информационная система для автоматизации деятельности научной группы.
|
Информационная система для автоматизации деятельности научной группы.
|
||||||
|
|
||||||
|
@ -49,7 +49,7 @@ public class PaperController {
|
|||||||
|
|
||||||
@GetMapping("/dashboard")
|
@GetMapping("/dashboard")
|
||||||
public void getDashboard(ModelMap modelMap) {
|
public void getDashboard(ModelMap modelMap) {
|
||||||
modelMap.put("papers", paperService.findAllDto());
|
modelMap.put("papers", paperService.findAllActive());
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/paper")
|
@GetMapping("/paper")
|
||||||
|
@ -169,4 +169,13 @@ public class Paper extends BaseEntity implements UserContainer {
|
|||||||
.filter(d -> d.getDate().after(new Date()))
|
.filter(d -> d.getDate().after(new Date()))
|
||||||
.findFirst();
|
.findFirst();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean lastDeadlineFailed() {
|
||||||
|
return !deadlines
|
||||||
|
.stream()
|
||||||
|
.filter(deadline -> deadline.getDate() != null)
|
||||||
|
.filter(d -> d.getDate().after(new Date()))
|
||||||
|
.findAny()
|
||||||
|
.isPresent();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -24,7 +24,9 @@ import java.util.stream.Collectors;
|
|||||||
import static org.springframework.util.ObjectUtils.isEmpty;
|
import static org.springframework.util.ObjectUtils.isEmpty;
|
||||||
import static ru.ulstu.core.util.StreamApiUtils.convert;
|
import static ru.ulstu.core.util.StreamApiUtils.convert;
|
||||||
import static ru.ulstu.paper.model.Paper.PaperStatus.ATTENTION;
|
import static ru.ulstu.paper.model.Paper.PaperStatus.ATTENTION;
|
||||||
|
import static ru.ulstu.paper.model.Paper.PaperStatus.COMPLETED;
|
||||||
import static ru.ulstu.paper.model.Paper.PaperStatus.DRAFT;
|
import static ru.ulstu.paper.model.Paper.PaperStatus.DRAFT;
|
||||||
|
import static ru.ulstu.paper.model.Paper.PaperStatus.FAILED;
|
||||||
import static ru.ulstu.paper.model.Paper.PaperStatus.ON_PREPARATION;
|
import static ru.ulstu.paper.model.Paper.PaperStatus.ON_PREPARATION;
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
@ -59,6 +61,13 @@ public class PaperService {
|
|||||||
return papers;
|
return papers;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public List<PaperDto> findAllActive() {
|
||||||
|
return findAllDto()
|
||||||
|
.stream()
|
||||||
|
.filter(paper -> paper.getStatus() != COMPLETED && paper.getStatus() != FAILED)
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
}
|
||||||
|
|
||||||
public PaperDto findOneDto(Integer id) {
|
public PaperDto findOneDto(Integer id) {
|
||||||
return new PaperDto(paperRepository.findOne(id));
|
return new PaperDto(paperRepository.findOne(id));
|
||||||
}
|
}
|
||||||
@ -166,11 +175,10 @@ public class PaperService {
|
|||||||
public void closeFailedPapers() {
|
public void closeFailedPapers() {
|
||||||
List<Paper> papers = paperRepository.findAll()
|
List<Paper> papers = paperRepository.findAll()
|
||||||
.stream()
|
.stream()
|
||||||
.filter(paper -> paper.getNextDeadline().isPresent()
|
.filter(paper -> paper.lastDeadlineFailed()
|
||||||
&& (paper.getStatus() == ON_PREPARATION
|
&& (paper.getStatus() == ON_PREPARATION
|
||||||
|| paper.getStatus() == DRAFT
|
|| paper.getStatus() == DRAFT
|
||||||
|| paper.getStatus() == ATTENTION)
|
|| paper.getStatus() == ATTENTION))
|
||||||
&& paper.getNextDeadline().get().getDate().before(new Date()))
|
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
papers.forEach(paper -> {
|
papers.forEach(paper -> {
|
||||||
Paper.PaperStatus oldStatus = paper.getStatus();
|
Paper.PaperStatus oldStatus = paper.getStatus();
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
</p>
|
</p>
|
||||||
<p>
|
<p>
|
||||||
Статья "<span th:text="${paper.title}">Title</span>" провалена.
|
Статья "<span th:text="${paper.title}">Title</span>" провалена.
|
||||||
Предыдущий статус - "<span th:text="${oldStatus.name}">oldStatus</span>".
|
Предыдущий статус - "<span th:text="${oldStatus.statusName}">oldStatus</span>".
|
||||||
</p>
|
</p>
|
||||||
<p>
|
<p>
|
||||||
Regards,
|
Regards,
|
||||||
|
Loading…
Reference in New Issue
Block a user