#70 remove conflicts
This commit is contained in:
commit
6820c617f3
@ -12,6 +12,7 @@ import ru.ulstu.configuration.Constants;
|
||||
import ru.ulstu.core.model.response.Response;
|
||||
import ru.ulstu.paper.model.PaperDto;
|
||||
import ru.ulstu.paper.model.PaperListDto;
|
||||
import ru.ulstu.paper.model.ReferenceDto;
|
||||
import ru.ulstu.paper.service.PaperService;
|
||||
|
||||
import javax.validation.Valid;
|
||||
@ -66,4 +67,9 @@ public class PaperRestController {
|
||||
public Response<List<String>> getFormattedPaperList() {
|
||||
return new Response<>(paperService.getFormattedPaperList());
|
||||
}
|
||||
|
||||
@PostMapping("/getFormattedReference")
|
||||
public Response<String> getFormattedReference(@RequestBody @Valid ReferenceDto referenceDto) {
|
||||
return new Response<>(paperService.getFormattedReference(referenceDto));
|
||||
}
|
||||
}
|
||||
|
129
src/main/java/ru/ulstu/paper/model/ReferenceDto.java
Normal file
129
src/main/java/ru/ulstu/paper/model/ReferenceDto.java
Normal file
@ -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;
|
||||
}
|
||||
}
|
@ -10,12 +10,14 @@ import ru.ulstu.file.service.FileService;
|
||||
import ru.ulstu.paper.model.Paper;
|
||||
import ru.ulstu.paper.model.PaperDto;
|
||||
import ru.ulstu.paper.model.PaperListDto;
|
||||
import ru.ulstu.paper.model.ReferenceDto;
|
||||
import ru.ulstu.paper.repository.PaperRepository;
|
||||
import ru.ulstu.timeline.service.EventService;
|
||||
import ru.ulstu.user.model.User;
|
||||
import ru.ulstu.user.service.UserService;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.text.MessageFormat;
|
||||
import java.util.Arrays;
|
||||
import java.util.Date;
|
||||
import java.util.HashSet;
|
||||
@ -32,6 +34,9 @@ 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.PaperType.OTHER;
|
||||
import static ru.ulstu.paper.model.ReferenceDto.FormatStandard.GOST;
|
||||
import static ru.ulstu.paper.model.ReferenceDto.ReferenceType.ARTICLE;
|
||||
import static ru.ulstu.paper.model.ReferenceDto.ReferenceType.BOOK;
|
||||
|
||||
@Service
|
||||
public class PaperService {
|
||||
@ -272,4 +277,30 @@ public class PaperService {
|
||||
.map(User::getUserAbbreviate)
|
||||
.collect(Collectors.joining(", "));
|
||||
}
|
||||
|
||||
public String getFormattedReference(ReferenceDto referenceDto) {
|
||||
return referenceDto.getFormatStandard() == GOST
|
||||
? getGostReference(referenceDto)
|
||||
: getSpringerReference(referenceDto);
|
||||
}
|
||||
|
||||
public String getGostReference(ReferenceDto referenceDto) {
|
||||
return MessageFormat.format(referenceDto.getReferenceType() == BOOK ? "{0} {1} - {2}{3}. - {4}с." : "{0} {1}{5} {2}{3}. С. {4}.",
|
||||
referenceDto.getAuthors(),
|
||||
referenceDto.getPublicationTitle(),
|
||||
StringUtils.isEmpty(referenceDto.getPublisher()) ? "" : referenceDto.getPublisher() + ", ",
|
||||
referenceDto.getPublicationYear().toString(),
|
||||
referenceDto.getPages(),
|
||||
StringUtils.isEmpty(referenceDto.getJournalOrCollectionTitle()) ? "." : " // " + referenceDto.getJournalOrCollectionTitle() + ".");
|
||||
}
|
||||
|
||||
public String getSpringerReference(ReferenceDto referenceDto) {
|
||||
return MessageFormat.format("{0} ({1}) {2}.{3} {4}pp {5}",
|
||||
referenceDto.getAuthors(),
|
||||
referenceDto.getPublicationYear().toString(),
|
||||
referenceDto.getPublicationTitle(),
|
||||
referenceDto.getReferenceType() == ARTICLE ? " " + referenceDto.getJournalOrCollectionTitle() + "," : "",
|
||||
StringUtils.isEmpty(referenceDto.getPublisher()) ? "" : referenceDto.getPublisher() + ", ",
|
||||
referenceDto.getPages());
|
||||
}
|
||||
}
|
||||
|
10
src/main/resources/db/changelog-20190428_000000-schema.xml
Normal file
10
src/main/resources/db/changelog-20190428_000000-schema.xml
Normal file
@ -0,0 +1,10 @@
|
||||
<?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="anton" id="20190428_000000-1">
|
||||
<update tableName="project">
|
||||
<column name="status" value="APPLICATION"/>
|
||||
</update>
|
||||
</changeSet>
|
||||
</databaseChangeLog>
|
@ -35,4 +35,5 @@
|
||||
<include file="db/changelog-20190422_000000-schema.xml"/>
|
||||
<include file="db/changelog-20190424_000000-schema.xml"/>
|
||||
<include file="db/changelog-20190426_000000-schema.xml"/>
|
||||
<include file="db/changelog-20190428_000000-schema.xml"/>
|
||||
</databaseChangeLog>
|
@ -12,9 +12,11 @@
|
||||
<p>
|
||||
Вам нужно поработать над статьей "<a th:href="@{|${baseUrl}/papers/paper?id=${paper.id}|}"><span th:text="${paper.title}">Title</span></a>".
|
||||
</p>
|
||||
<p>
|
||||
<div th:with="nextDeadline=${paper.nextDeadline}" th:remove="tag">
|
||||
<p th:if="${nextDeadline.isPresent()}">
|
||||
Срок исполнения: <span th:text="${#dates.format(paper.nextDeadline.get().date, 'dd.MM.yyyy HH:mm')}"></span>.
|
||||
</p>
|
||||
</p>
|
||||
</div>
|
||||
<p>
|
||||
Regards,
|
||||
<br/>
|
||||
|
Loading…
Reference in New Issue
Block a user