Revize e081ca32
Přidáno uživatelem Lukas Cerny před téměř 6 roky(ů)
server/init.sql | ||
---|---|---|
117 | 117 |
-- Insert table end_user |
118 | 118 |
-- ----------------------------------------------------- |
119 | 119 |
INSERT INTO end_user (first_name, last_name, no_vacations, no_sick_days, taken_sick_days, alert, token, email, photo, user_role, status) VALUES ('admin', 'admin', 0, NULL, 0, NULL, '', '', 'https://st2.depositphotos.com/9223672/12056/v/950/depositphotos_120568236-stock-illustration-male-face-avatar-logo-template.jpg', 'EMPLOYER', 'ACCEPTED'); |
120 |
INSERT INTO end_user (first_name, last_name, no_vacations, no_sick_days, taken_sick_days, alert, token, email, photo, user_role, status) VALUES ('Jan', 'Novák', 0, 10, 0, '2019-12-6 16:30:00.000', '', '', 'https://st2.depositphotos.com/9223672/12056/v/950/depositphotos_120568236-stock-illustration-male-face-avatar-logo-template.jpg', 'EMPLOYEE', 'PENDING'); |
|
121 |
INSERT INTO end_user (first_name, last_name, no_vacations, no_sick_days, taken_sick_days, alert, token, email, photo, user_role, status) VALUES ('Josef', 'Svoboda', 2, NULL, 3, NULL, '', '', 'https://st2.depositphotos.com/9223672/12056/v/950/depositphotos_120568236-stock-illustration-male-face-avatar-logo-template.jpg', 'EMPLOYEE', 'REJECTED'); |
|
122 | 120 |
|
123 | 121 |
-- ----------------------------------------------------- |
124 | 122 |
-- Insert table vacation_day |
server/src/main/java/cz/zcu/yamanager/business/ApiManager.java | ||
---|---|---|
188 | 188 |
} |
189 | 189 |
|
190 | 190 |
if (settings.getSickDayCount() != null) { |
191 |
|
|
192 |
if (user.getTakenSickDayCount() > settings.getSickDayCount()) { |
|
193 |
throw new IllegalArgumentException("settings.sick.day.lt.taken.error"); |
|
194 |
} |
|
195 |
|
|
191 | 196 |
if (settings.getSickDayCount().equals(defaultSettings.getSickDayCount())) { |
192 | 197 |
user.setTotalSickDayCount(null); |
193 | 198 |
} else { |
server/src/main/java/cz/zcu/yamanager/business/FileServiceImpl.java | ||
---|---|---|
2 | 2 |
|
3 | 3 |
import cz.zcu.yamanager.business.file.excel.*; |
4 | 4 |
import cz.zcu.yamanager.ws.rest.RESTFullException; |
5 |
import org.apache.pdfbox.pdmodel.PDDocument; |
|
6 |
import org.apache.pdfbox.pdmodel.PDPage; |
|
7 |
import org.apache.pdfbox.pdmodel.PDPageContentStream; |
|
8 |
import org.apache.pdfbox.pdmodel.common.PDRectangle; |
|
9 |
import org.apache.pdfbox.pdmodel.font.PDType1Font; |
|
10 |
import org.springframework.stereotype.Component; |
|
5 | 11 |
|
6 | 12 |
import java.io.ByteArrayInputStream; |
13 |
import java.io.ByteArrayOutputStream; |
|
7 | 14 |
import java.io.IOException; |
8 | 15 |
import java.util.*; |
9 | 16 |
|
10 | 17 |
import static cz.zcu.yamanager.business.file.excel.ExcelParser.parseXLSX; |
11 | 18 |
|
19 |
@Component |
|
12 | 20 |
public class FileServiceImpl implements FileService { |
13 | 21 |
|
14 | 22 |
private class Content { |
... | ... | |
55 | 63 |
|
56 | 64 |
@Override |
57 | 65 |
public FileExportResult createPDFFile() throws RESTFullException { |
58 |
return new FileExportResult("unknown", new byte[0]); |
|
66 |
|
|
67 |
PDDocument document = new PDDocument(); |
|
68 |
PDPage page1 = new PDPage(PDRectangle.A4); |
|
69 |
document.addPage(page1); |
|
70 |
|
|
71 |
try { |
|
72 |
PDPageContentStream cos = new PDPageContentStream(document, page1); |
|
73 |
|
|
74 |
cos.beginText(); |
|
75 |
cos.setFont(PDType1Font.HELVETICA, 12); |
|
76 |
cos.newLineAtOffset(100, 10); |
|
77 |
cos.showText("Test"); |
|
78 |
cos.endText(); |
|
79 |
|
|
80 |
cos.close(); |
|
81 |
|
|
82 |
ByteArrayOutputStream output = new ByteArrayOutputStream(); |
|
83 |
|
|
84 |
document.save(output); |
|
85 |
document.close(); |
|
86 |
|
|
87 |
return new FileExportResult("export.pdf", output.toByteArray()); |
|
88 |
|
|
89 |
} catch (IOException e) { |
|
90 |
throw new RESTFullException("", ""); |
|
91 |
} |
|
59 | 92 |
} |
60 | 93 |
} |
server/src/main/java/cz/zcu/yamanager/business/mock/FileServiceMock.java | ||
---|---|---|
17 | 17 |
import org.apache.poi.xssf.usermodel.XSSFRow; |
18 | 18 |
import org.apache.poi.xssf.usermodel.XSSFSheet; |
19 | 19 |
import org.apache.poi.xssf.usermodel.XSSFWorkbook; |
20 |
import org.springframework.stereotype.Component; |
|
21 | 20 |
|
22 | 21 |
import java.io.ByteArrayInputStream; |
23 | 22 |
import java.io.ByteArrayOutputStream; |
... | ... | |
27 | 26 |
import java.util.Iterator; |
28 | 27 |
import java.util.List; |
29 | 28 |
|
30 |
@Component |
|
29 |
|
|
31 | 30 |
public class FileServiceMock implements FileService { |
32 | 31 |
|
33 | 32 |
private List<String> content = new ArrayList<>(); |
server/src/main/resources/Message_cs.properties | ||
---|---|---|
24 | 24 |
role.null.error = Role mus\u00ED b\u00FDt zad\u00E1n. |
25 | 25 |
database.error = Vyskytl se probl\u00E9m s datab\u00E1z\u00ED. |
26 | 26 |
vacation.past.error = Nelze vybrat volno v minulosti. |
27 |
vacation.double.error = Nelze vybrat v\u00EDce voln pro stejn\u00FD den. |
|
27 |
vacation.double.error = Nelze vybrat v\u00EDce voln pro stejn\u00FD den. |
|
28 |
settings.sick.day.lt.taken.error = Nelze nastavit po\u010Det sick day men\u0161\u00ED ne\u017E je je aktu\u00E1ln\u011B vybr\u00E1no. |
server/src/main/resources/Message_en.properties | ||
---|---|---|
24 | 24 |
role.null.error = The role has to be filled in. |
25 | 25 |
database.error = There was a problem with the database. |
26 | 26 |
vacation.past.error = You cannot take a vacation in past. |
27 |
vacation.double.error = You cannot take a vacation at the same day. |
|
27 |
vacation.double.error = You cannot take a vacation at the same day. |
|
28 |
settings.sick.day.lt.taken.error = You cannot set a number of sick day lower than is taken at this moment. |
Také k dispozici: Unified diff
Fixed is not able to set lower number of sick day than is already taken