Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
mytime
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Narendar Vakiti
mytime
Commits
ea70b142
Commit
ea70b142
authored
Sep 07, 2018
by
Mahesh Mudrakola
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Export Excel and Pdf Feature enabled
parent
337099ad
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
31 additions
and
18 deletions
+31
-18
AttendanceController.java
...ava/com/nisum/mytime/controller/AttendanceController.java
+6
-6
UserService.java
src/main/java/com/nisum/mytime/service/UserService.java
+2
-2
UserServiceImpl.java
src/main/java/com/nisum/mytime/service/UserServiceImpl.java
+2
-2
PdfReportGenerator.java
src/main/java/com/nisum/mytime/utils/PdfReportGenerator.java
+21
-8
No files found.
src/main/java/com/nisum/mytime/controller/AttendanceController.java
View file @
ea70b142
...
...
@@ -48,22 +48,22 @@ public class AttendanceController {
}
@RequestMapping
(
value
=
"generatePdfReport/{id}/{fromDate}/{toDate}"
,
method
=
RequestMethod
.
GET
,
produces
=
MediaType
.
TEXT_PLAI
N_VALUE
)
public
ResponseEntity
<
String
>
generatePdfReport
(
@PathVariable
(
"id"
)
long
id
,
method
=
RequestMethod
.
GET
,
produces
=
MediaType
.
APPLICATION_JSO
N_VALUE
)
public
ResponseEntity
<
List
>
generatePdfReport
(
@PathVariable
(
"id"
)
long
id
,
@PathVariable
(
"fromDate"
)
String
fromDate
,
@PathVariable
(
"toDate"
)
String
toDate
)
throws
MyTimeException
{
String
result
=
userService
.
generatePdfReport
(
id
,
fromDate
,
toDate
);
List
result
=
userService
.
generatePdfReport
(
id
,
fromDate
,
toDate
);
return
new
ResponseEntity
<>(
result
,
HttpStatus
.
OK
);
}
@RequestMapping
(
value
=
"generatePdfReport/{id}/{fromDate}/{toDate}/{fromTime}/{toTime}"
,
method
=
RequestMethod
.
GET
,
produces
=
MediaType
.
TEXT_PLAI
N_VALUE
)
public
ResponseEntity
<
String
>
generatePdfReport
(
@PathVariable
(
"id"
)
long
id
,
method
=
RequestMethod
.
GET
,
produces
=
MediaType
.
APPLICATION_JSO
N_VALUE
)
public
ResponseEntity
<
List
>
generatePdfReport
(
@PathVariable
(
"id"
)
long
id
,
@PathVariable
(
"fromDate"
)
String
fromDate
,
@PathVariable
(
"toDate"
)
String
toDate
,
@PathVariable
(
"fromTime"
)
String
fromTime
,
@PathVariable
(
"toTime"
)
String
toTime
)
throws
MyTimeException
,
ParseException
{
String
result
=
userService
.
generatePdfReport
(
id
,
fromDate
,
toDate
,
fromTime
,
toTime
);
List
result
=
userService
.
generatePdfReport
(
id
,
fromDate
,
toDate
,
fromTime
,
toTime
);
return
new
ResponseEntity
<>(
result
,
HttpStatus
.
OK
);
}
...
...
src/main/java/com/nisum/mytime/service/UserService.java
View file @
ea70b142
...
...
@@ -33,10 +33,10 @@ public interface UserService {
EmployeeRoles
assigingEmployeeRole
(
EmployeeRoles
employeeRoles
,
String
empId
)
throws
MyTimeException
;
String
generatePdfReport
(
long
id
,
String
fromDate
,
String
toDate
)
List
generatePdfReport
(
long
id
,
String
fromDate
,
String
toDate
)
throws
MyTimeException
;
String
generatePdfReport
(
long
id
,
String
fromDate
,
String
toDate
,
String
fromTime
,
String
toTime
)
List
generatePdfReport
(
long
id
,
String
fromDate
,
String
toDate
,
String
fromTime
,
String
toTime
)
throws
MyTimeException
,
ParseException
;
EmployeeRoles
getEmployeesRole
(
String
emailId
);
...
...
src/main/java/com/nisum/mytime/service/UserServiceImpl.java
View file @
ea70b142
...
...
@@ -128,13 +128,13 @@ public class UserServiceImpl implements UserService {
}
@Override
public
String
generatePdfReport
(
long
id
,
String
fromDate
,
String
toDate
)
public
List
generatePdfReport
(
long
id
,
String
fromDate
,
String
toDate
)
throws
MyTimeException
{
return
pdfReportGenerator
.
generateEmployeeReport
(
id
,
fromDate
,
toDate
);
}
@Override
public
String
generatePdfReport
(
long
id
,
String
fromDate
,
String
toDate
,
String
fromTime
,
String
toTime
)
public
List
generatePdfReport
(
long
id
,
String
fromDate
,
String
toDate
,
String
fromTime
,
String
toTime
)
throws
MyTimeException
,
ParseException
{
return
pdfReportGenerator
.
generateEmployeeReport
(
id
,
fromDate
,
toDate
,
fromTime
,
toTime
);
}
...
...
src/main/java/com/nisum/mytime/utils/PdfReportGenerator.java
View file @
ea70b142
...
...
@@ -3,6 +3,7 @@ package com.nisum.mytime.utils;
import
java.io.File
;
import
java.io.FileOutputStream
;
import
java.text.ParseException
;
import
java.util.ArrayList
;
import
java.util.List
;
import
org.springframework.beans.factory.annotation.Autowired
;
...
...
@@ -39,23 +40,35 @@ public class PdfReportGenerator {
@Autowired
private
AttendanceService
attendanceService
;
public
String
generateEmployeeReport
(
long
employeeId
,
String
startDate
,
String
endDate
)
throws
MyTimeException
{
public
List
generateEmployeeReport
(
long
employeeId
,
String
startDate
,
String
endDate
)
throws
MyTimeException
{
String
fileName
=
employeeId
+
"_"
+
startDate
+
"_"
+
endDate
+
".pdf"
;
List
<
EmpLoginData
>
empLoginDetails
=
getEmployeeData
(
employeeId
,
startDate
,
endDate
);
List
filenameData
=
new
ArrayList
<>();
if
(
empLoginDetails
.
isEmpty
())
{
return
"No data available"
;
}
else
{
return
createPDF
(
fileName
,
empLoginDetails
,
employeeId
);
}
String
message
=
"No data available"
;
filenameData
.
add
(
message
);
return
filenameData
;
}
else
{
String
file
=
createPDF
(
fileName
,
empLoginDetails
,
employeeId
);
filenameData
.
add
(
file
);
filenameData
.
add
(
empLoginDetails
);
return
filenameData
;
}
}
public
String
generateEmployeeReport
(
long
employeeId
,
String
startDate
,
String
endDate
,
String
fromTime
,
String
toTime
)
throws
MyTimeException
,
ParseException
{
public
List
generateEmployeeReport
(
long
employeeId
,
String
startDate
,
String
endDate
,
String
fromTime
,
String
toTime
)
throws
MyTimeException
,
ParseException
{
String
fileName
=
employeeId
+
"_"
+
startDate
+
"_"
+
endDate
+
".pdf"
;
List
<
EmpLoginData
>
empLoginDetails
=
getEmployeeData
(
employeeId
,
startDate
,
endDate
,
fromTime
,
toTime
);
List
filenameData
=
new
ArrayList
<>();
if
(
empLoginDetails
.
isEmpty
())
{
return
"No data available"
;
String
message
=
"No data available"
;
filenameData
.
add
(
message
);
return
filenameData
;
}
else
{
return
createPDF
(
fileName
,
empLoginDetails
,
employeeId
);
String
file
=
createPDF
(
fileName
,
empLoginDetails
,
employeeId
);
filenameData
.
add
(
file
);
filenameData
.
add
(
empLoginDetails
);
return
filenameData
;
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment