From 65d788512beb022a765933e13b140b1587839f72 Mon Sep 17 00:00:00 2001 From: Elena Date: Fri, 9 Nov 2018 13:42:28 +0400 Subject: [PATCH 1/4] =?UTF-8?q?=D0=97=D0=B0=D0=B4=D0=B0=D1=87=D0=B0=20?= =?UTF-8?q?=E2=84=9610?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/resources/public/js/papers.js | 8 ++++++-- src/main/resources/templates/papers/paper.html | 4 +++- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/src/main/resources/public/js/papers.js b/src/main/resources/public/js/papers.js index bab27a7..9035221 100644 --- a/src/main/resources/public/js/papers.js +++ b/src/main/resources/public/js/papers.js @@ -17,12 +17,16 @@ function showPapers(papersElement) { }); } -function addPaper(title, status, comment, locked) { +function addPaper(title, status, comment, locked, deadline, file, dateCreate, dateUpdate) { var paperData = JSON.stringify({ "title": title, "status": status, "comment": comment, - "locked": locked + "deadline":deadline, + "locked": locked, + "file":file, + "dateCreate":dateUpdate, + "dateUpdate":dateUpdate }); postToRest(urlPapers, paperData, function (data) { alert(data); diff --git a/src/main/resources/templates/papers/paper.html b/src/main/resources/templates/papers/paper.html index 8cc9161..eee175d 100644 --- a/src/main/resources/templates/papers/paper.html +++ b/src/main/resources/templates/papers/paper.html @@ -149,7 +149,7 @@
From 8fc6d3b569bf7b857c99ab6ed44b8652fbe44d7d Mon Sep 17 00:00:00 2001 From: Elena Date: Fri, 23 Nov 2018 14:05:23 +0400 Subject: [PATCH 4/4] =?UTF-8?q?=D0=B7=D0=B0=D0=B4=D0=B0=D1=87=D0=B0=2010(n?= =?UTF-8?q?ew)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/ru/ulstu/paper/controller/PaperController.java | 5 +++++ src/main/java/ru/ulstu/paper/service/PaperService.java | 4 ++++ 2 files changed, 9 insertions(+) diff --git a/src/main/java/ru/ulstu/paper/controller/PaperController.java b/src/main/java/ru/ulstu/paper/controller/PaperController.java index c5cbf4f..b004b18 100644 --- a/src/main/java/ru/ulstu/paper/controller/PaperController.java +++ b/src/main/java/ru/ulstu/paper/controller/PaperController.java @@ -37,6 +37,11 @@ public class PaperController { return new Response<>(paperService.findAllDto()); } + @GetMapping("/{paper-id}") + public Response getPaper(@PathVariable("paper-id") Integer paperId){ + return new Response(paperService.findPaper(paperId)); + } + @PostMapping public Response createPaper(@RequestBody @Valid PaperDto paperDto) throws IOException { return new Response<>(paperService.create(paperDto)); diff --git a/src/main/java/ru/ulstu/paper/service/PaperService.java b/src/main/java/ru/ulstu/paper/service/PaperService.java index 0e1abbc..83b975b 100644 --- a/src/main/java/ru/ulstu/paper/service/PaperService.java +++ b/src/main/java/ru/ulstu/paper/service/PaperService.java @@ -130,6 +130,10 @@ public class PaperService { return convert(paperRepository.filter(userService.findById(filterDto.getAuthorId()), filterDto.getYear()), PaperDto::new); } + public PaperDto findPaper(int id){ + return new PaperDto(paperRepository.getOne(id)); + } + public void closeFailedPapers() { List papers = paperRepository.findAll() .stream()