try to fix grants kias

This commit is contained in:
Anton Romanov 2020-04-25 22:46:35 +04:00
parent e20fb468f9
commit 54b992a7f3

View File

@ -197,6 +197,7 @@ public class GrantService extends BaseService {
private boolean saveFromKias(GrantDto grantDto) throws IOException {
grantDto.setName(grantDto.getTitle());
String title = checkUniqueName(grantDto, grantDto.getId()); //проверка уникальности имени
System.out.println(title);
if (title != null) {
Grant grantFromDB = grantRepository.findFirstByTitle(title); //грант с таким же названием из бд
if (checkSameDeadline(grantDto, grantFromDB.getId())) { //если дедайны тоже совпадают
@ -225,7 +226,9 @@ public class GrantService extends BaseService {
private boolean checkSameDeadline(GrantDto grantDto, Integer id) {
Date date = DateUtils.clearTime(grantDto.getDeadlines().get(0).getDate()); //дата с сайта киас
System.out.println(date);
Date foundGrantDate = DateUtils.clearTime(deadlineService.findByGrantIdAndDate(id, date));
System.out.println(foundGrantDate);
return foundGrantDate != null && foundGrantDate.compareTo(date) == 0;
}