|
|
|
@ -1,6 +1,7 @@
|
|
|
|
|
package ru.ulstu.conference.service;
|
|
|
|
|
|
|
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
|
|
import org.springframework.data.domain.Sort;
|
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
import ru.ulstu.conference.model.Conference;
|
|
|
|
@ -17,6 +18,7 @@ import ru.ulstu.user.service.UserService;
|
|
|
|
|
import java.io.IOException;
|
|
|
|
|
import java.util.ArrayList;
|
|
|
|
|
import java.util.Arrays;
|
|
|
|
|
import java.util.Date;
|
|
|
|
|
import java.util.List;
|
|
|
|
|
|
|
|
|
|
import static org.springframework.util.ObjectUtils.isEmpty;
|
|
|
|
@ -59,7 +61,7 @@ public class ConferenceService {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public List<Conference> findAll() {
|
|
|
|
|
return conferenceRepository.findAll();
|
|
|
|
|
return conferenceRepository.findAll(new Sort(Sort.Direction.DESC, "beginDate"));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public List<ConferenceDto> findAllDto() {
|
|
|
|
@ -158,9 +160,17 @@ public class ConferenceService {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public List<ConferenceDto> filter(ConferenceFilterDto conferenceFilterDto) {
|
|
|
|
|
return convert(conferenceRepository.filter(
|
|
|
|
|
return convert(conferenceRepository.findByUserAndYear(
|
|
|
|
|
conferenceFilterDto.getFilterUserId() == null ? null : userService.findById(conferenceFilterDto.getFilterUserId()),
|
|
|
|
|
conferenceFilterDto.getYear()), ConferenceDto::new);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public List<ConferenceDto> findAllActiveDto() {
|
|
|
|
|
return convert(findAllActive(), ConferenceDto::new);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public List<Conference> findAllActive() {
|
|
|
|
|
return conferenceRepository.findAllActive(new Date());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|