filter dashboard papers
This commit is contained in:
parent
779bc3eafc
commit
c00390a17b
@ -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")
|
||||||
|
@ -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));
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user