From 926cd02096ebb358765be277e677189b057f3abf Mon Sep 17 00:00:00 2001 From: Nightblade73 Date: Sat, 6 Apr 2019 11:05:30 +0400 Subject: [PATCH] #55 fixed adding to DB --- src/main/java/ru/ulstu/conference/model/ConferenceDto.java | 7 +++++++ .../ru/ulstu/conference/service/ConferenceService.java | 4 ++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/main/java/ru/ulstu/conference/model/ConferenceDto.java b/src/main/java/ru/ulstu/conference/model/ConferenceDto.java index d5c586f..a9414c1 100644 --- a/src/main/java/ru/ulstu/conference/model/ConferenceDto.java +++ b/src/main/java/ru/ulstu/conference/model/ConferenceDto.java @@ -3,10 +3,13 @@ package ru.ulstu.conference.model; import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonProperty; import org.hibernate.validator.constraints.NotEmpty; +import org.springframework.format.annotation.DateTimeFormat; import ru.ulstu.deadline.model.Deadline; import ru.ulstu.paper.model.PaperDto; import ru.ulstu.user.model.UserDto; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; import javax.validation.constraints.Size; import java.util.ArrayList; import java.util.Date; @@ -26,7 +29,11 @@ public class ConferenceDto { @Size(max = 255) private String url; private int ping; + @Temporal(TemporalType.TIMESTAMP) + @DateTimeFormat(pattern = "yyyy-MM-dd") private Date beginDate; + @Temporal(TemporalType.TIMESTAMP) + @DateTimeFormat(pattern = "yyyy-MM-dd") private Date endDate; @NotEmpty private List deadlines = new ArrayList<>(); diff --git a/src/main/java/ru/ulstu/conference/service/ConferenceService.java b/src/main/java/ru/ulstu/conference/service/ConferenceService.java index e5afd0f..c28c637 100644 --- a/src/main/java/ru/ulstu/conference/service/ConferenceService.java +++ b/src/main/java/ru/ulstu/conference/service/ConferenceService.java @@ -72,8 +72,8 @@ public class ConferenceService { conference.setDescription(conferenceDto.getDescription()); conference.setUrl(conferenceDto.getUrl()); conference.setPing(0); - conference.setBeginDate(conference.getBeginDate()); - conference.setEndDate(conference.getEndDate()); + conference.setBeginDate(conferenceDto.getBeginDate()); + conference.setEndDate(conferenceDto.getEndDate()); conference.setDeadlines(deadlineService.saveOrCreate(conferenceDto.getDeadlines()));