Merge remote-tracking branch 'origin/dev' into dev
commit
b2d4d52675
@ -0,0 +1,7 @@
|
|||||||
|
package ru.ulstu.paper.error;
|
||||||
|
|
||||||
|
public class PaperConferenceRelationExistException extends RuntimeException {
|
||||||
|
public PaperConferenceRelationExistException(String message) {
|
||||||
|
super(message);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,129 @@
|
|||||||
|
package ru.ulstu.paper.model;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonCreator;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
|
|
||||||
|
public class ReferenceDto {
|
||||||
|
public enum ReferenceType {
|
||||||
|
ARTICLE("Статья"),
|
||||||
|
BOOK("Книга");
|
||||||
|
|
||||||
|
private String typeName;
|
||||||
|
|
||||||
|
ReferenceType(String name) {
|
||||||
|
this.typeName = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getTypeName() {
|
||||||
|
return typeName;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public enum FormatStandard {
|
||||||
|
GOST("ГОСТ"),
|
||||||
|
SPRINGER("Springer");
|
||||||
|
|
||||||
|
private String standardName;
|
||||||
|
|
||||||
|
FormatStandard(String name) {
|
||||||
|
this.standardName = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getStandardName() {
|
||||||
|
return standardName;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private String authors;
|
||||||
|
private String publicationTitle;
|
||||||
|
private Integer publicationYear;
|
||||||
|
private String publisher;
|
||||||
|
private String pages;
|
||||||
|
private String journalOrCollectionTitle;
|
||||||
|
private ReferenceType referenceType;
|
||||||
|
private FormatStandard formatStandard;
|
||||||
|
|
||||||
|
@JsonCreator
|
||||||
|
public ReferenceDto(
|
||||||
|
@JsonProperty("authors") String authors,
|
||||||
|
@JsonProperty("publicationTitle") String publicationTitle,
|
||||||
|
@JsonProperty("publicationYear") Integer publicationYear,
|
||||||
|
@JsonProperty("publisher") String publisher,
|
||||||
|
@JsonProperty("pages") String pages,
|
||||||
|
@JsonProperty("journalOrCollectionTitle") String journalOrCollectionTitle,
|
||||||
|
@JsonProperty("referenceType") ReferenceType referenceType,
|
||||||
|
@JsonProperty("formatStandard") FormatStandard formatStandard) {
|
||||||
|
this.authors = authors;
|
||||||
|
this.publicationTitle = publicationTitle;
|
||||||
|
this.publicationYear = publicationYear;
|
||||||
|
this.publisher = publisher;
|
||||||
|
this.pages = pages;
|
||||||
|
this.journalOrCollectionTitle = journalOrCollectionTitle;
|
||||||
|
this.referenceType = referenceType;
|
||||||
|
this.formatStandard = formatStandard;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getAuthors() {
|
||||||
|
return authors;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAuthors(String authors) {
|
||||||
|
this.authors = authors;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getPublicationTitle() {
|
||||||
|
return publicationTitle;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPublicationTitle(String publicationTitle) {
|
||||||
|
this.publicationTitle = publicationTitle;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getPublicationYear() {
|
||||||
|
return publicationYear;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPublicationYear(Integer publicationYear) {
|
||||||
|
this.publicationYear = publicationYear;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getPublisher() {
|
||||||
|
return publisher;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPublisher(String publisher) {
|
||||||
|
this.publisher = publisher;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getPages() {
|
||||||
|
return pages;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPages(String pages) {
|
||||||
|
this.pages = pages;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getJournalOrCollectionTitle() {
|
||||||
|
return journalOrCollectionTitle;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setJournalOrCollectionTitle(String journalOrCollectionTitle) {
|
||||||
|
this.journalOrCollectionTitle = journalOrCollectionTitle;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ReferenceType getReferenceType() {
|
||||||
|
return referenceType;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setReferenceType(ReferenceType referenceType) {
|
||||||
|
this.referenceType = referenceType;
|
||||||
|
}
|
||||||
|
|
||||||
|
public FormatStandard getFormatStandard() {
|
||||||
|
return formatStandard;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setFormatStandard(FormatStandard formatStandard) {
|
||||||
|
this.formatStandard = formatStandard;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,73 @@
|
|||||||
|
package ru.ulstu.ping.model;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
|
import org.springframework.format.annotation.DateTimeFormat;
|
||||||
|
import ru.ulstu.conference.model.Conference;
|
||||||
|
import ru.ulstu.core.model.BaseEntity;
|
||||||
|
import ru.ulstu.user.model.User;
|
||||||
|
|
||||||
|
import javax.persistence.Entity;
|
||||||
|
import javax.persistence.JoinColumn;
|
||||||
|
import javax.persistence.ManyToOne;
|
||||||
|
import javax.persistence.Table;
|
||||||
|
import javax.persistence.Temporal;
|
||||||
|
import javax.persistence.TemporalType;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
@Entity
|
||||||
|
@Table(name = "ping")
|
||||||
|
public class Ping extends BaseEntity {
|
||||||
|
@Temporal(value = TemporalType.TIMESTAMP)
|
||||||
|
@DateTimeFormat(pattern = "yyyy-MM-dd")
|
||||||
|
private Date date;
|
||||||
|
|
||||||
|
@ManyToOne(optional = false)
|
||||||
|
@JoinColumn(name = "users_id")
|
||||||
|
private User user;
|
||||||
|
|
||||||
|
@ManyToOne(optional = false)
|
||||||
|
@JoinColumn(name = "conference_id")
|
||||||
|
private Conference conference;
|
||||||
|
|
||||||
|
public Ping() {
|
||||||
|
}
|
||||||
|
|
||||||
|
public Ping(Date date, User user) {
|
||||||
|
this.date = date;
|
||||||
|
this.user = user;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Ping(@JsonProperty("id") Integer id,
|
||||||
|
@JsonProperty("date") Date date,
|
||||||
|
@JsonProperty("user") User user,
|
||||||
|
@JsonProperty("conference") Conference conference) {
|
||||||
|
setId(id);
|
||||||
|
this.date = date;
|
||||||
|
this.user = user;
|
||||||
|
this.conference = conference;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Date getDate() {
|
||||||
|
return date;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDate(Date date) {
|
||||||
|
this.date = date;
|
||||||
|
}
|
||||||
|
|
||||||
|
public User getUser() {
|
||||||
|
return user;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUser(User user) {
|
||||||
|
this.user = user;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Conference getConference() {
|
||||||
|
return conference;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setConference(Conference conference) {
|
||||||
|
this.conference = conference;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,7 @@
|
|||||||
|
package ru.ulstu.ping.repository;
|
||||||
|
|
||||||
|
import org.springframework.data.jpa.repository.JpaRepository;
|
||||||
|
import ru.ulstu.ping.model.Ping;
|
||||||
|
|
||||||
|
public interface PingRepository extends JpaRepository<Ping, Integer> {
|
||||||
|
}
|
@ -0,0 +1,30 @@
|
|||||||
|
package ru.ulstu.ping.service;
|
||||||
|
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
import ru.ulstu.conference.model.Conference;
|
||||||
|
import ru.ulstu.ping.model.Ping;
|
||||||
|
import ru.ulstu.ping.repository.PingRepository;
|
||||||
|
import ru.ulstu.user.service.UserService;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
public class PingService {
|
||||||
|
private final PingRepository pingRepository;
|
||||||
|
private final UserService userService;
|
||||||
|
|
||||||
|
public PingService(PingRepository pingRepository,
|
||||||
|
UserService userService) {
|
||||||
|
this.pingRepository = pingRepository;
|
||||||
|
this.userService = userService;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Transactional
|
||||||
|
public void addPing(Conference conference) throws IOException {
|
||||||
|
Ping newPing = new Ping(new Date(), userService.getCurrentUser());
|
||||||
|
newPing.setConference(conference);
|
||||||
|
pingRepository.save(newPing);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,54 @@
|
|||||||
|
package ru.ulstu.students.model;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class TaskFilterDto {
|
||||||
|
|
||||||
|
private List<TaskDto> tasks;
|
||||||
|
private Task.TaskStatus status;
|
||||||
|
private Integer tagId;
|
||||||
|
private String order;
|
||||||
|
|
||||||
|
public TaskFilterDto(List<TaskDto> tasks, Task.TaskStatus status, Integer tagId, String order) {
|
||||||
|
this.tasks = tasks;
|
||||||
|
this.status = status;
|
||||||
|
this.tagId = tagId;
|
||||||
|
this.order = order;
|
||||||
|
}
|
||||||
|
|
||||||
|
public TaskFilterDto() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<TaskDto> getTasks() {
|
||||||
|
return tasks;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTasks(List<TaskDto> tasks) {
|
||||||
|
this.tasks = tasks;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Task.TaskStatus getStatus() {
|
||||||
|
return status;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setStatus(Task.TaskStatus status) {
|
||||||
|
this.status = status;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getTag() {
|
||||||
|
return tagId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTag(Integer tagId) {
|
||||||
|
this.tagId = tagId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getOrder() {
|
||||||
|
return order;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setOrder(String order) {
|
||||||
|
this.order = order;
|
||||||
|
}
|
||||||
|
}
|
@ -1,7 +1,18 @@
|
|||||||
package ru.ulstu.students.repository;
|
package ru.ulstu.students.repository;
|
||||||
|
|
||||||
import org.springframework.data.jpa.repository.JpaRepository;
|
import org.springframework.data.jpa.repository.JpaRepository;
|
||||||
|
import org.springframework.data.jpa.repository.Query;
|
||||||
|
import org.springframework.data.repository.query.Param;
|
||||||
import ru.ulstu.students.model.Task;
|
import ru.ulstu.students.model.Task;
|
||||||
|
import ru.ulstu.tags.model.Tag;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
public interface TaskRepository extends JpaRepository<Task, Integer> {
|
public interface TaskRepository extends JpaRepository<Task, Integer> {
|
||||||
|
|
||||||
|
@Query("SELECT t FROM Task t WHERE (t.status = :status OR :status IS NULL) AND (:tag IS NULL OR :tag MEMBER OF t.tags) ORDER BY create_date DESC")
|
||||||
|
List<Task> filterNew(@Param("status") Task.TaskStatus status, @Param("tag") Tag tag);
|
||||||
|
|
||||||
|
@Query("SELECT t FROM Task t WHERE (t.status = :status OR :status IS NULL) AND (:tag IS NULL OR :tag MEMBER OF t.tags) ORDER BY create_date ASC")
|
||||||
|
List<Task> filterOld(@Param("status") Task.TaskStatus status, @Param("tag") Tag tag);
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,17 @@
|
|||||||
|
<?xml version="1.1" encoding="UTF-8" standalone="no"?>
|
||||||
|
<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
|
||||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.1.xsd">
|
||||||
|
<changeSet author="tanya" id="20190419_000000-1">
|
||||||
|
<createTable tableName="grants_papers">
|
||||||
|
<column name="grant_id" type="integer"/>
|
||||||
|
<column name="paper_id" type="integer"/>
|
||||||
|
</createTable>
|
||||||
|
<addForeignKeyConstraint baseTableName="grants_papers" baseColumnNames="grant_id"
|
||||||
|
constraintName="fk_grants_grants_papers" referencedTableName="grants"
|
||||||
|
referencedColumnNames="id"/>
|
||||||
|
<addForeignKeyConstraint baseTableName="grants_papers" baseColumnNames="paper_id"
|
||||||
|
constraintName="fk_paper_grants_papers" referencedTableName="paper"
|
||||||
|
referencedColumnNames="id"/>
|
||||||
|
</changeSet>
|
||||||
|
</databaseChangeLog>
|
@ -0,0 +1,28 @@
|
|||||||
|
<?xml version="1.1" encoding="UTF-8" standalone="no"?>
|
||||||
|
<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
|
||||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.1.xsd">
|
||||||
|
<changeSet author="vova" id="20190424_000000-1">
|
||||||
|
<createTable tableName="ping">
|
||||||
|
<column name="id" type="integer">
|
||||||
|
<constraints nullable="false"/>
|
||||||
|
</column>
|
||||||
|
<column name="date" type="timestamp">
|
||||||
|
<constraints nullable="false"/>
|
||||||
|
</column>
|
||||||
|
<column name="users_id" type="integer">
|
||||||
|
<constraints nullable="false"/>
|
||||||
|
</column>
|
||||||
|
<column name="conference_id" type="integer"/>
|
||||||
|
<column name="version" type="integer"/>
|
||||||
|
</createTable>
|
||||||
|
<addPrimaryKey columnNames="id" constraintName="pk_ping" tableName="ping"/>
|
||||||
|
<addForeignKeyConstraint baseTableName="ping" baseColumnNames="users_id"
|
||||||
|
constraintName="fk_ping_users_id" referencedTableName="users"
|
||||||
|
referencedColumnNames="id"/>
|
||||||
|
<addForeignKeyConstraint baseTableName="ping" baseColumnNames="conference_id"
|
||||||
|
constraintName="fk_ping_conference_id" referencedTableName="conference"
|
||||||
|
referencedColumnNames="id"/>
|
||||||
|
</changeSet>
|
||||||
|
|
||||||
|
</databaseChangeLog>
|
@ -0,0 +1,42 @@
|
|||||||
|
/*<![CDATA[*/
|
||||||
|
$(document).ready(function () {
|
||||||
|
$(".project-row").mouseenter(function (event) {
|
||||||
|
var projectRow = $(event.target).closest(".project-row");
|
||||||
|
$(projectRow).css("background-color", "#f8f9fa");
|
||||||
|
$(projectRow).find(".remove-paper").removeClass("d-none");
|
||||||
|
|
||||||
|
});
|
||||||
|
$(".project-row").mouseleave(function (event) {
|
||||||
|
var projectRow = $(event.target).closest(".project-row");
|
||||||
|
$(projectRow).css("background-color", "white");
|
||||||
|
$(projectRow).find(".remove-paper").addClass("d-none");
|
||||||
|
});
|
||||||
|
|
||||||
|
$('a[data-confirm]').click(function(ev) {
|
||||||
|
var href = $(this).attr('href');
|
||||||
|
if (!$('#dataConfirmModal').length) {
|
||||||
|
$('#modalDelete').append('<div class="modal fade" id="dataConfirmModal" tabindex="-1" role="dialog" aria-labelledby="mySmallModalLabel" aria-hidden="true"\n' +
|
||||||
|
' >\n' +
|
||||||
|
' <div class="modal-dialog modal-sm">\n' +
|
||||||
|
' <div class="modal-content">\n' +
|
||||||
|
' <div class="modal-header">\n' +
|
||||||
|
' <h8 class="modal-title" id="myModalLabel">Удалить проект?</h8>\n' +
|
||||||
|
' <button type="button" class="close" data-dismiss="modal" aria-label="Закрыть"><span\n' +
|
||||||
|
' aria-hidden="true">×</span></button>\n' +
|
||||||
|
' </div>\n' +
|
||||||
|
|
||||||
|
' <div class="modal-footer">\n' +
|
||||||
|
' <a class="btn btn-primary" id="dataConfirmOK">Да</a>'+
|
||||||
|
' <button class="btn primary" data-dismiss="modal" aria-hidden="true">Нет</button>'+
|
||||||
|
' </div>\n' +
|
||||||
|
' </div>\n' +
|
||||||
|
' </div>\n' +
|
||||||
|
' </div>');
|
||||||
|
}
|
||||||
|
$('#dataConfirmModal').find('#myModalLabel').text($(this).attr('data-confirm'));
|
||||||
|
$('#dataConfirmOK').attr('href', href);
|
||||||
|
$('#dataConfirmModal').modal({show:true});
|
||||||
|
return false;
|
||||||
|
});
|
||||||
|
});
|
||||||
|
/*]]>*/
|
Loading…
Reference in New Issue