Merge branch '106-papers-bug' into 'dev'
Resolve "Bug: не отображается список статей" Closes #106 See merge request romanov73/ng-tracker!62
This commit is contained in:
commit
21ba06170a
@ -100,7 +100,7 @@
|
|||||||
|
|
||||||
<!-- Checks for imports -->
|
<!-- Checks for imports -->
|
||||||
<!-- See http://checkstyle.sf.net/config_import.html -->
|
<!-- See http://checkstyle.sf.net/config_import.html -->
|
||||||
<!--<module name="AvoidStarImport"/>-->
|
<module name="AvoidStarImport"/>
|
||||||
<module name="IllegalImport"/> <!-- defaults to sun.* packages -->
|
<module name="IllegalImport"/> <!-- defaults to sun.* packages -->
|
||||||
<module name="RedundantImport"/>
|
<module name="RedundantImport"/>
|
||||||
<!--module name="UnusedImports">
|
<!--module name="UnusedImports">
|
||||||
@ -136,7 +136,7 @@
|
|||||||
<module name="AvoidNestedBlocks"/>
|
<module name="AvoidNestedBlocks"/>
|
||||||
<module name="EmptyBlock"/>
|
<module name="EmptyBlock"/>
|
||||||
<module name="LeftCurly"/>
|
<module name="LeftCurly"/>
|
||||||
<!--<module name="NeedBraces"/>-->
|
<module name="NeedBraces"/>
|
||||||
<module name="RightCurly"/>
|
<module name="RightCurly"/>
|
||||||
|
|
||||||
<!-- Checks for common coding problems -->
|
<!-- Checks for common coding problems -->
|
||||||
|
@ -1,6 +1,10 @@
|
|||||||
package ru.ulstu.core.model;
|
package ru.ulstu.core.model;
|
||||||
|
|
||||||
import javax.persistence.*;
|
import javax.persistence.GeneratedValue;
|
||||||
|
import javax.persistence.GenerationType;
|
||||||
|
import javax.persistence.Id;
|
||||||
|
import javax.persistence.MappedSuperclass;
|
||||||
|
import javax.persistence.Version;
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
|
||||||
@MappedSuperclass
|
@MappedSuperclass
|
||||||
|
@ -1,6 +1,11 @@
|
|||||||
package ru.ulstu.core.util;
|
package ru.ulstu.core.util;
|
||||||
|
|
||||||
import java.time.*;
|
import java.time.Instant;
|
||||||
|
import java.time.LocalDate;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.time.LocalTime;
|
||||||
|
import java.time.Month;
|
||||||
|
import java.time.ZoneId;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Calendar;
|
import java.util.Calendar;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
@ -20,7 +20,7 @@ public class FileData extends BaseEntity {
|
|||||||
private byte[] data;
|
private byte[] data;
|
||||||
|
|
||||||
@Column(name = "is_latex_attach")
|
@Column(name = "is_latex_attach")
|
||||||
private boolean isLatexAttach;
|
private Boolean isLatexAttach;
|
||||||
|
|
||||||
public String getName() {
|
public String getName() {
|
||||||
return name;
|
return name;
|
||||||
@ -54,11 +54,11 @@ public class FileData extends BaseEntity {
|
|||||||
this.data = data;
|
this.data = data;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isLatexAttach() {
|
public Boolean isLatexAttach() {
|
||||||
return isLatexAttach;
|
return isLatexAttach;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setLatexAttach(boolean latexAttach) {
|
public void setLatexAttach(Boolean latexAttach) {
|
||||||
isLatexAttach = latexAttach;
|
isLatexAttach = latexAttach;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -9,7 +9,7 @@ public class FileDataDto {
|
|||||||
private String fileName;
|
private String fileName;
|
||||||
private String tmpFileName;
|
private String tmpFileName;
|
||||||
private boolean deleted;
|
private boolean deleted;
|
||||||
private boolean isLatexAttach;
|
private Boolean isLatexAttach;
|
||||||
|
|
||||||
public FileDataDto() {
|
public FileDataDto() {
|
||||||
}
|
}
|
||||||
@ -17,7 +17,7 @@ public class FileDataDto {
|
|||||||
@JsonCreator
|
@JsonCreator
|
||||||
public FileDataDto(@JsonProperty("id") Integer id,
|
public FileDataDto(@JsonProperty("id") Integer id,
|
||||||
@JsonProperty("name") String name,
|
@JsonProperty("name") String name,
|
||||||
@JsonProperty("isLatexAttach") boolean isLatexAttach,
|
@JsonProperty("isLatexAttach") Boolean isLatexAttach,
|
||||||
@JsonProperty("fileName") String fileName,
|
@JsonProperty("fileName") String fileName,
|
||||||
@JsonProperty("tmpFileName") String tmpFileName) {
|
@JsonProperty("tmpFileName") String tmpFileName) {
|
||||||
this.id = id;
|
this.id = id;
|
||||||
@ -77,19 +77,19 @@ public class FileDataDto {
|
|||||||
this.deleted = deleted;
|
this.deleted = deleted;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isLatexAttach() {
|
public Boolean isLatexAttach() {
|
||||||
return isLatexAttach;
|
return isLatexAttach;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean getIsLatexAttach() {
|
public Boolean getIsLatexAttach() {
|
||||||
return isLatexAttach;
|
return isLatexAttach;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setLatexAttach(boolean latexAttach) {
|
public void setLatexAttach(Boolean latexAttach) {
|
||||||
isLatexAttach = latexAttach;
|
isLatexAttach = latexAttach;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setIsLatexAttach(boolean latexAttach) {
|
public void setIsLatexAttach(Boolean latexAttach) {
|
||||||
isLatexAttach = latexAttach;
|
isLatexAttach = latexAttach;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -127,7 +127,7 @@ public class FileService {
|
|||||||
public void createLatexAttachs(PaperDto paper) throws IOException {
|
public void createLatexAttachs(PaperDto paper) throws IOException {
|
||||||
for (FileDataDto fileDataDto : paper.getFiles()
|
for (FileDataDto fileDataDto : paper.getFiles()
|
||||||
.stream()
|
.stream()
|
||||||
.filter(f -> f.isLatexAttach() && !f.isDeleted())
|
.filter(f -> (f.isLatexAttach() != null && f.isLatexAttach()) && !f.isDeleted())
|
||||||
.collect(Collectors.toList())) {
|
.collect(Collectors.toList())) {
|
||||||
if (fileDataDto.getId() == null) {
|
if (fileDataDto.getId() == null) {
|
||||||
File oldFile = getTmpFilePath(fileDataDto.getTmpFileName()).toFile();
|
File oldFile = getTmpFilePath(fileDataDto.getTmpFileName()).toFile();
|
||||||
|
@ -31,14 +31,13 @@ public abstract class OdinField implements Comparable {
|
|||||||
return this.name().toLowerCase();
|
return this.name().toLowerCase();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private Field field;
|
|
||||||
protected final OdinFieldType fieldType;
|
protected final OdinFieldType fieldType;
|
||||||
protected final String fieldName;
|
protected final String fieldName;
|
||||||
protected final String caption;
|
protected final String caption;
|
||||||
protected final OdinVisible.OdinVisibleType visible;
|
protected final OdinVisible.OdinVisibleType visible;
|
||||||
protected final boolean readOnly;
|
protected final boolean readOnly;
|
||||||
protected final boolean notEmpty;
|
protected final boolean notEmpty;
|
||||||
|
private Field field;
|
||||||
|
|
||||||
public OdinField(Field field, OdinFieldType fieldType) {
|
public OdinField(Field field, OdinFieldType fieldType) {
|
||||||
this.field = field;
|
this.field = field;
|
||||||
@ -126,8 +125,12 @@ public abstract class OdinField implements Comparable {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(Object o) {
|
public boolean equals(Object o) {
|
||||||
if (this == o) return true;
|
if (this == o) {
|
||||||
if (o == null || getClass() != o.getClass()) return false;
|
return true;
|
||||||
|
}
|
||||||
|
if (o == null || getClass() != o.getClass()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
OdinField odinField = (OdinField) o;
|
OdinField odinField = (OdinField) o;
|
||||||
return Objects.equals(fieldName, odinField.fieldName);
|
return Objects.equals(fieldName, odinField.fieldName);
|
||||||
}
|
}
|
||||||
|
@ -12,11 +12,11 @@ import java.nio.file.Files;
|
|||||||
|
|
||||||
@Service
|
@Service
|
||||||
public class LatexService {
|
public class LatexService {
|
||||||
|
private final String pdfLatexError = "Errors occurred while executing pdfLaTeX.";
|
||||||
|
private final String bibtexError = "Errors occurred while executing bibtex.";
|
||||||
private String errorMessage;
|
private String errorMessage;
|
||||||
private File pdfFile;
|
private File pdfFile;
|
||||||
private FileService fileService;
|
private FileService fileService;
|
||||||
private final String pdfLatexError = "Errors occurred while executing pdfLaTeX.";
|
|
||||||
private final String bibtexError = "Errors occurred while executing bibtex.";
|
|
||||||
|
|
||||||
public LatexService(FileService fileService) {
|
public LatexService(FileService fileService) {
|
||||||
this.fileService = fileService;
|
this.fileService = fileService;
|
||||||
@ -42,7 +42,9 @@ public class LatexService {
|
|||||||
InputStreamReader inputStreamReader = new InputStreamReader(process.getInputStream());
|
InputStreamReader inputStreamReader = new InputStreamReader(process.getInputStream());
|
||||||
|
|
||||||
try (BufferedReader bufferedReader = new BufferedReader(inputStreamReader)) {
|
try (BufferedReader bufferedReader = new BufferedReader(inputStreamReader)) {
|
||||||
while ((bufferedReader.readLine()) != null) ;
|
while ((bufferedReader.readLine()) != null) {
|
||||||
|
//
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int exitCode = process.waitFor();
|
int exitCode = process.waitFor();
|
||||||
@ -55,16 +57,18 @@ public class LatexService {
|
|||||||
private boolean generate(String filename, File dir) throws IOException, InterruptedException {
|
private boolean generate(String filename, File dir) throws IOException, InterruptedException {
|
||||||
startProcess(new String[]{"pdflatex", filename, "--interaction=nonstopmode"}, dir, pdfLatexError);
|
startProcess(new String[]{"pdflatex", filename, "--interaction=nonstopmode"}, dir, pdfLatexError);
|
||||||
startProcess(new String[]{"bibtex", filename}, dir, bibtexError);
|
startProcess(new String[]{"bibtex", filename}, dir, bibtexError);
|
||||||
if (startProcess(new String[]{"pdflatex", filename, "--interaction=nonstopmode"}, dir, pdfLatexError) != 0)
|
if (startProcess(new String[]{"pdflatex", filename, "--interaction=nonstopmode"}, dir, pdfLatexError) != 0) {
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
return checkPdf(filename, dir);
|
return checkPdf(filename, dir);
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean checkPdf(String filename, File dir) {
|
private boolean checkPdf(String filename, File dir) {
|
||||||
pdfFile = new File(dir.getAbsolutePath() + File.separator + filename + ".pdf");
|
pdfFile = new File(dir.getAbsolutePath() + File.separator + filename + ".pdf");
|
||||||
|
|
||||||
if (pdfFile.isFile()) return true;
|
if (pdfFile.isFile()) {
|
||||||
else {
|
return true;
|
||||||
|
} else {
|
||||||
errorMessage = "The pdf file could not be created.";
|
errorMessage = "The pdf file could not be created.";
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -3,7 +3,11 @@ package ru.ulstu.students.controller;
|
|||||||
import org.springframework.stereotype.Controller;
|
import org.springframework.stereotype.Controller;
|
||||||
import org.springframework.ui.ModelMap;
|
import org.springframework.ui.ModelMap;
|
||||||
import org.springframework.validation.Errors;
|
import org.springframework.validation.Errors;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.ModelAttribute;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestParam;
|
||||||
import ru.ulstu.deadline.model.Deadline;
|
import ru.ulstu.deadline.model.Deadline;
|
||||||
import ru.ulstu.students.model.Task;
|
import ru.ulstu.students.model.Task;
|
||||||
import ru.ulstu.students.model.TaskDto;
|
import ru.ulstu.students.model.TaskDto;
|
||||||
@ -16,7 +20,9 @@ import java.util.List;
|
|||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
import static org.springframework.util.StringUtils.isEmpty;
|
import static org.springframework.util.StringUtils.isEmpty;
|
||||||
import static ru.ulstu.students.controller.Navigation.*;
|
import static ru.ulstu.students.controller.Navigation.REDIRECT_TO;
|
||||||
|
import static ru.ulstu.students.controller.Navigation.TASKS_PAGE;
|
||||||
|
import static ru.ulstu.students.controller.Navigation.TASK_PAGE;
|
||||||
|
|
||||||
@Controller()
|
@Controller()
|
||||||
@RequestMapping(value = "/students")
|
@RequestMapping(value = "/students")
|
||||||
|
@ -7,7 +7,19 @@ import ru.ulstu.core.model.BaseEntity;
|
|||||||
import ru.ulstu.deadline.model.Deadline;
|
import ru.ulstu.deadline.model.Deadline;
|
||||||
import ru.ulstu.tags.model.Tag;
|
import ru.ulstu.tags.model.Tag;
|
||||||
|
|
||||||
import javax.persistence.*;
|
import javax.persistence.CascadeType;
|
||||||
|
import javax.persistence.Column;
|
||||||
|
import javax.persistence.Entity;
|
||||||
|
import javax.persistence.EnumType;
|
||||||
|
import javax.persistence.Enumerated;
|
||||||
|
import javax.persistence.FetchType;
|
||||||
|
import javax.persistence.JoinColumn;
|
||||||
|
import javax.persistence.JoinTable;
|
||||||
|
import javax.persistence.ManyToMany;
|
||||||
|
import javax.persistence.OneToMany;
|
||||||
|
import javax.persistence.OrderBy;
|
||||||
|
import javax.persistence.Temporal;
|
||||||
|
import javax.persistence.TemporalType;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
@ -2,7 +2,13 @@ package ru.ulstu.user.model;
|
|||||||
|
|
||||||
import ru.ulstu.core.model.BaseEntity;
|
import ru.ulstu.core.model.BaseEntity;
|
||||||
|
|
||||||
import javax.persistence.*;
|
import javax.persistence.Column;
|
||||||
|
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 javax.validation.constraints.NotNull;
|
import javax.validation.constraints.NotNull;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
<div th:fragment="filesList (isLatexAttach)" th:remove="tag">
|
<div th:fragment="filesList (isLatexAttach)" th:remove="tag">
|
||||||
<th:block th:each="file, rowStat : *{files}">
|
<th:block th:each="file, rowStat : *{files}">
|
||||||
|
|
||||||
<span th:if="${file.isLatexAttach == isLatexAttach}" th:remove="tag">
|
<span th:if="${(!isLatexAttach and file.isLatexAttach == null) or file.isLatexAttach == isLatexAttach}" th:remove="tag">
|
||||||
|
|
||||||
<div class="row" th:id="|files${rowStat.index}|"
|
<div class="row" th:id="|files${rowStat.index}|"
|
||||||
th:style="${file.deleted} ? 'display: none;' :''">
|
th:style="${file.deleted} ? 'display: none;' :''">
|
||||||
|
Loading…
Reference in New Issue
Block a user