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
0219d4d3
Commit
0219d4d3
authored
Sep 07, 2018
by
Mahesh Mudrakola
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Export excel and pdf
parent
ea70b142
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
17 additions
and
10 deletions
+17
-10
AttendanceService.java
...main/java/com/nisum/mytime/service/AttendanceService.java
+1
-1
AttendanceServiceImpl.java
.../java/com/nisum/mytime/service/AttendanceServiceImpl.java
+2
-2
ProjectServiceImpl.java
...ain/java/com/nisum/mytime/service/ProjectServiceImpl.java
+2
-6
PdfReportGenerator.java
src/main/java/com/nisum/mytime/utils/PdfReportGenerator.java
+10
-0
AttendanceControllerTest.java
...nisum/mytime/controllertest/AttendanceControllerTest.java
+2
-1
No files found.
src/main/java/com/nisum/mytime/service/AttendanceService.java
View file @
0219d4d3
...
...
@@ -12,7 +12,7 @@ public interface AttendanceService {
List
<
AttendenceData
>
getAttendanciesReport
(
String
reportDate
,
String
shift
)
throws
MyTimeException
,
SQLException
;
String
generatePdfReport
(
long
id
,
String
fromDate
,
String
toDate
,
String
fromTime
,
String
toTime
)
throws
MyTimeException
;
List
generatePdfReport
(
long
id
,
String
fromDate
,
String
toDate
,
String
fromTime
,
String
toTime
)
throws
MyTimeException
;
List
<
EmpLoginData
>
employeeLoginReportBasedOnDateTime
(
long
id
,
String
fromDate
,
String
toDate
,
String
fromTime
,
String
toTime
)
throws
MyTimeException
,
ParseException
;
...
...
src/main/java/com/nisum/mytime/service/AttendanceServiceImpl.java
View file @
0219d4d3
...
...
@@ -61,7 +61,7 @@ public class AttendanceServiceImpl implements AttendanceService {
}
@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
{
return
pdfReportGenerator
.
generateEmployeeReport
(
id
,
fromDate
,
toDate
);
}
...
...
src/main/java/com/nisum/mytime/service/ProjectServiceImpl.java
View file @
0219d4d3
...
...
@@ -100,7 +100,7 @@ public class ProjectServiceImpl implements ProjectService {
@Override
public
String
generatePdfReport
(
long
id
,
String
fromDate
,
String
toDate
)
throws
MyTimeException
{
return
pdfReportGenerator
.
generate
Employe
eReport
(
id
,
fromDate
,
toDate
);
return
pdfReportGenerator
.
generateeReport
(
id
,
fromDate
,
toDate
);
}
@Override
...
...
@@ -771,7 +771,6 @@ public class ProjectServiceImpl implements ProjectService {
billingsSorted
=
(
billings
==
null
||
billings
.
size
()
==
0
)
?
billings
:
billings
.
stream
().
sorted
(
Comparator
.
comparing
(
BillingDetails:
:
getCreateDate
).
reversed
()).
collect
(
Collectors
.
toList
());
}
catch
(
Exception
e
)
{
// TODO: handle exception
}
return
billingsSorted
;
}
...
...
@@ -784,7 +783,6 @@ public class ProjectServiceImpl implements ProjectService {
billingsSorted
=
(
billings
==
null
||
billings
.
size
()
==
0
)
?
billings
:
billings
.
stream
().
sorted
(
Comparator
.
comparing
(
BillingDetails:
:
getCreateDate
).
reversed
()).
collect
(
Collectors
.
toList
());
}
catch
(
Exception
e
)
{
// TODO: handle exception
}
return
billingsSorted
;
}
...
...
@@ -801,7 +799,6 @@ public class ProjectServiceImpl implements ProjectService {
billingsSorted
=
(
billings
==
null
||
billings
.
size
()
==
0
)
?
billings
:
billings
.
stream
().
sorted
(
Comparator
.
comparing
(
BillingDetails:
:
getBillingStartDate
).
reversed
()).
collect
(
Collectors
.
toList
());
}
catch
(
Exception
e
)
{
// TODO: handle exception
}
return
billingsSorted
;
}
...
...
@@ -818,7 +815,6 @@ public class ProjectServiceImpl implements ProjectService {
billingsSorted
=
(
billings
==
null
||
billings
.
size
()
==
0
)
?
billings
:
billings
.
stream
().
sorted
(
Comparator
.
comparing
(
BillingDetails:
:
getBillingStartDate
).
reversed
()).
collect
(
Collectors
.
toList
());
}
catch
(
Exception
e
)
{
// TODO: handle exception
}
return
billingsSorted
;
}
...
...
src/main/java/com/nisum/mytime/utils/PdfReportGenerator.java
View file @
0219d4d3
...
...
@@ -56,6 +56,16 @@ public class PdfReportGenerator {
}
}
public
String
generateeReport
(
long
employeeId
,
String
startDate
,
String
endDate
)
throws
MyTimeException
{
String
fileName
=
employeeId
+
"_"
+
startDate
+
"_"
+
endDate
+
".pdf"
;
List
<
EmpLoginData
>
empLoginDetails
=
getEmployeeData
(
employeeId
,
startDate
,
endDate
);
if
(
empLoginDetails
.
isEmpty
())
{
String
message
=
"No data available"
;
return
message
;
}
else
{
return
fileName
;
}
}
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
);
...
...
src/test/java/com/nisum/mytime/controllertest/AttendanceControllerTest.java
View file @
0219d4d3
...
...
@@ -55,7 +55,8 @@ public class AttendanceControllerTest {
@Test
public
void
testgeneratePdfReport
()
throws
Exception
{
when
(
userService
.
generatePdfReport
(
12345
,
"2017-11-18"
,
"2017-12-18"
)).
thenReturn
(
"empLoginDetails"
);
List
list
=
new
ArrayList
();
when
(
userService
.
generatePdfReport
(
12345
,
"2017-11-18"
,
"2017-12-18"
)).
thenReturn
(
list
);
mockMvc
.
perform
(
get
(
"/attendance/generatePdfReport/12345/2017-11-18/2017-12-18"
)).
andExpect
(
MockMvcResultMatchers
.
status
().
isOk
());
verify
(
userService
).
generatePdfReport
(
12345
,
"2017-11-18"
,
"2017-12-18"
);
}
...
...
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