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
5e029af6
Commit
5e029af6
authored
Jun 11, 2019
by
vikram singh
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Completed the code for monthly reports(showing data in grid)
parent
1d60a1f5
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
98 additions
and
38 deletions
+98
-38
ReportsController.java
...n/java/com/nisum/myteam/controller/ReportsController.java
+89
-37
IReportService.java
src/main/java/com/nisum/myteam/service/IReportService.java
+3
-0
ReportService.java
...ain/java/com/nisum/myteam/service/impl/ReportService.java
+6
-1
No files found.
src/main/java/com/nisum/myteam/controller/ReportsController.java
View file @
5e029af6
...
@@ -41,6 +41,7 @@ import com.nisum.myteam.model.GroupByCount;
...
@@ -41,6 +41,7 @@ import com.nisum.myteam.model.GroupByCount;
import
com.nisum.myteam.model.ReportSeriesRecord
;
import
com.nisum.myteam.model.ReportSeriesRecord
;
import
com.nisum.myteam.model.dao.Account
;
import
com.nisum.myteam.model.dao.Account
;
import
com.nisum.myteam.model.dao.Employee
;
import
com.nisum.myteam.model.dao.Employee
;
import
com.nisum.myteam.model.dao.Project
;
import
com.nisum.myteam.model.dao.Resource
;
import
com.nisum.myteam.model.dao.Resource
;
import
com.nisum.myteam.model.vo.ReportVo
;
import
com.nisum.myteam.model.vo.ReportVo
;
import
com.nisum.myteam.model.vo.ResourceVO
;
import
com.nisum.myteam.model.vo.ResourceVO
;
...
@@ -288,41 +289,40 @@ public class ReportsController {
...
@@ -288,41 +289,40 @@ public class ReportsController {
// return new ResponseEntity<>(resourcesList, HttpStatus.OK);
// return new ResponseEntity<>(resourcesList, HttpStatus.OK);
// }
// }
// @RequestMapping(value = "/fetchEmployeeDetailsByDateBillability",
@RequestMapping
(
value
=
"/fetchEmployeeDetailsByDateBillability"
,
// method = RequestMethod.GET,
method
=
RequestMethod
.
GET
,
// produces = MediaType.APPLICATION_JSON_VALUE)
produces
=
MediaType
.
APPLICATION_JSON_VALUE
)
// public ResponseEntity<List<Resource>> fetchEmployeeDetailsByDateBillability(
public
ResponseEntity
<
List
<
Resource
>>
fetchEmployeeDetailsByDateBillability
(
// @RequestParam("billabilityStatus") String billabilityStatus,
@RequestParam
(
"billabilityStatus"
)
String
billabilityStatus
,
// @RequestParam("reportDate") String reportDateString)
@RequestParam
(
"reportDate"
)
String
reportDateString
)
// throws MyTeamException {
throws
MyTeamException
{
// List<Resource> empList = new ArrayList<>();
List
<
Resource
>
empList
=
new
ArrayList
<>();
// if (reportDateString != null && !reportDateString.isEmpty()) {
if
(
reportDateString
!=
null
&&
!
reportDateString
.
isEmpty
())
{
// String pattern = "MM-dd-yyyy";
String
pattern
=
"MM-dd-yyyy"
;
// SimpleDateFormat simpleDateFormat = new SimpleDateFormat(pattern);
SimpleDateFormat
simpleDateFormat
=
new
SimpleDateFormat
(
pattern
);
// Date reportDateValue = new Date();
Date
reportDateValue
=
new
Date
();
// try {
try
{
// reportDateValue = simpleDateFormat.parse(reportDateString);
reportDateValue
=
simpleDateFormat
.
parse
(
reportDateString
);
// } catch (ParseException e) {
}
catch
(
ParseException
e
)
{
// // TODO Auto-generated catch block
// TODO Auto-generated catch block
// e.printStackTrace();
e
.
printStackTrace
();
// }
}
//
// Criteria status = Criteria.where("billableStatus")
Criteria
status
=
Criteria
.
where
(
"billableStatus"
)
// .is(billabilityStatus);
.
is
(
billabilityStatus
);
// Criteria criteriaV1 = Criteria.where("billingStartDate")
Criteria
criteriaV1
=
Criteria
.
where
(
"billingStartDate"
)
// .lt(reportDateValue);
.
lt
(
reportDateValue
);
// Criteria criteriaV21 = Criteria.where("billingEndDate").is(null);
Criteria
criteriaV21
=
Criteria
.
where
(
"billingEndDate"
).
is
(
null
);
// Criteria criteriaV22 = Criteria.where("billingEndDate")
Criteria
criteriaV22
=
Criteria
.
where
(
"billingEndDate"
)
// .gt(reportDateValue);
.
gt
(
reportDateValue
);
// Criteria criteriaV221 = status.andOperator(
Criteria
criteriaV221
=
status
.
andOperator
(
// criteriaV1.orOperator(criteriaV21, criteriaV22));
criteriaV1
.
orOperator
(
criteriaV21
,
criteriaV22
));
// Query query = new Query();
Query
query
=
new
Query
();
// query.addCriteria(criteriaV221);
query
.
addCriteria
(
criteriaV221
);
// empList = mongoTemplate.find(query, Resource.class);
empList
=
mongoTemplate
.
find
(
query
,
Resource
.
class
);
// }
}
// return new ResponseEntity<>(empList, HttpStatus.OK);
return
new
ResponseEntity
<>(
empList
,
HttpStatus
.
OK
);
// }
}
@RequestMapping
(
value
=
"/getBarChartReport"
,
@RequestMapping
(
value
=
"/getBarChartReport"
,
method
=
RequestMethod
.
GET
,
method
=
RequestMethod
.
GET
,
...
@@ -417,10 +417,62 @@ public class ReportsController {
...
@@ -417,10 +417,62 @@ public class ReportsController {
List
<
Reports
>
resourcesList
=
new
ArrayList
<>();
List
<
Reports
>
resourcesList
=
new
ArrayList
<>();
if
(
account
!=
null
&&
!
account
.
isEmpty
())
{
if
(
account
!=
null
&&
!
account
.
isEmpty
())
{
resourcesList
=
reportService
.
getEmployeeDetailsByAccountBillability
(
account
,
billabilityStatus
);
resourcesList
=
reportService
.
getEmployeeDetailsByAccountBillability
(
account
,
billabilityStatus
);
}
}
return
new
ResponseEntity
<>(
resourcesList
,
HttpStatus
.
OK
);
return
new
ResponseEntity
<>(
resourcesList
,
HttpStatus
.
OK
);
}
}
@RequestMapping
(
value
=
"/fetchEmployeeDetailsByDateBillability"
,
method
=
RequestMethod
.
GET
,
produces
=
MediaType
.
APPLICATION_JSON_VALUE
)
public
ResponseEntity
<
List
<
Reports
>>
fetchEmployeeDetailsByDateBillability
(
@RequestParam
(
"billabilityStatus"
)
String
billabilityStatus
,
@RequestParam
(
"reportDate"
)
String
reportDateString
)
throws
MyTeamException
{
List
<
Resource
>
empList
=
new
ArrayList
<>();
List
<
Reports
>
reports
=
new
ArrayList
<>();
if
(
reportDateString
!=
null
&&
!
reportDateString
.
isEmpty
())
{
String
pattern
=
"MM-dd-yyyy"
;
SimpleDateFormat
simpleDateFormat
=
new
SimpleDateFormat
(
pattern
);
Date
reportDateValue
=
new
Date
();
try
{
reportDateValue
=
simpleDateFormat
.
parse
(
reportDateString
);
}
catch
(
ParseException
e
)
{
// TODO Auto-generated catch block
e
.
printStackTrace
();
}
Criteria
status
=
Criteria
.
where
(
"billableStatus"
)
.
is
(
billabilityStatus
);
Criteria
criteriaV1
=
Criteria
.
where
(
"billingStartDate"
)
.
lt
(
reportDateValue
);
Criteria
criteriaV21
=
Criteria
.
where
(
"billingEndDate"
).
is
(
null
);
Criteria
criteriaV22
=
Criteria
.
where
(
"billingEndDate"
)
.
gt
(
reportDateValue
);
Criteria
criteriaV221
=
status
.
andOperator
(
criteriaV1
.
orOperator
(
criteriaV21
,
criteriaV22
));
Query
query
=
new
Query
();
query
.
addCriteria
(
criteriaV221
);
empList
=
mongoTemplate
.
find
(
query
,
Resource
.
class
);
empList
.
stream
().
forEach
(
e
->{
Employee
employee
=
employeeService
.
getEmployeeById
(
e
.
getEmployeeId
());
Project
project
=
reportService
.
getProjectById
(
e
.
getProjectId
());
Reports
report
=
new
Reports
();
report
.
setEmployeeName
(
employee
.
getEmployeeName
());
report
.
setEmployeeId
(
employee
.
getEmployeeId
());
report
.
setEmailId
(
employee
.
getEmailId
());
report
.
setProjectName
(
project
.
getProjectName
());
report
.
setFunctionalGroup
(
employee
.
getFunctionalGroup
());
report
.
setBillableStatus
(
e
.
getBillableStatus
());
report
.
setBillingStartDate
(
e
.
getBillingStartDate
());
report
.
setBillingEndDate
(
e
.
getBillingEndDate
());
reports
.
add
(
report
);
});
}
return
new
ResponseEntity
<>(
reports
,
HttpStatus
.
OK
);
}
}
}
src/main/java/com/nisum/myteam/service/IReportService.java
View file @
5e029af6
...
@@ -4,6 +4,7 @@ import java.util.List;
...
@@ -4,6 +4,7 @@ import java.util.List;
import
com.nisum.myteam.exception.handler.MyTeamException
;
import
com.nisum.myteam.exception.handler.MyTeamException
;
import
com.nisum.myteam.model.Reports
;
import
com.nisum.myteam.model.Reports
;
import
com.nisum.myteam.model.dao.Project
;
import
com.nisum.myteam.model.vo.ReportVo
;
import
com.nisum.myteam.model.vo.ReportVo
;
import
com.nisum.myteam.model.vo.ResourceVO
;
import
com.nisum.myteam.model.vo.ResourceVO
;
...
@@ -14,5 +15,7 @@ public interface IReportService {
...
@@ -14,5 +15,7 @@ public interface IReportService {
public
List
<
Reports
>
getEmployeeDetailsByFGAndBillability
(
String
fGroup
,
String
billableStatus
)
throws
MyTeamException
;
public
List
<
Reports
>
getEmployeeDetailsByFGAndBillability
(
String
fGroup
,
String
billableStatus
)
throws
MyTeamException
;
public
List
<
Reports
>
getEmployeeDetailsByAccountBillability
(
String
account
,
String
billabilityStatus
)
throws
MyTeamException
;
public
List
<
Reports
>
getEmployeeDetailsByAccountBillability
(
String
account
,
String
billabilityStatus
)
throws
MyTeamException
;
public
Project
getProjectById
(
String
employeeId
);
}
}
\ No newline at end of file
src/main/java/com/nisum/myteam/service/impl/ReportService.java
View file @
5e029af6
...
@@ -141,7 +141,7 @@ public class ReportService implements IReportService {
...
@@ -141,7 +141,7 @@ public class ReportService implements IReportService {
for
(
Employee
employee:
employees
)
{
for
(
Employee
employee:
employees
)
{
Resource
resourceObj
=
resourceService
.
getLatestResourceByEmpId
(
employee
.
getEmployeeId
());
Resource
resourceObj
=
resourceService
.
getLatestResourceByEmpId
(
employee
.
getEmployeeId
());
if
(
resourceObj
.
getBillableStatus
().
equals
(
billableStatus
)
||(
billableStatus
.
equals
(
"Non-Billable"
)
&&
(
resourceObj
.
getBillableStatus
().
equals
(
Shadow
)||
resourceObj
.
getBillableStatus
().
equals
(
Reserved
))))
{
if
(
resourceObj
.
getBillableStatus
().
equals
(
billableStatus
)
||(
billableStatus
.
equals
(
"Non-Billable"
)
&&
(
resourceObj
.
getBillableStatus
().
equals
(
Shadow
)||
resourceObj
.
getBillableStatus
().
equals
(
Reserved
))))
{
resultantEmployees
.
add
(
mappingReports
(
employee
,
resourceObj
)
);
resultantEmployees
.
add
(
mappingReports
(
employee
,
resourceObj
));
}
}
}
}
return
resultantEmployees
;
return
resultantEmployees
;
...
@@ -161,4 +161,9 @@ public class ReportService implements IReportService {
...
@@ -161,4 +161,9 @@ public class ReportService implements IReportService {
return
Reports
;
return
Reports
;
}
}
@Override
public
Project
getProjectById
(
String
projectId
)
{
return
projectService
.
getProjectByProjectId
(
projectId
);
}
}
}
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