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
22239759
Commit
22239759
authored
May 13, 2019
by
Vijay Akula
Browse files
Options
Browse Files
Download
Plain Diff
Resolved merge conflicts
parents
5592d335
6d94ee50
Changes
36
Show whitespace changes
Inline
Side-by-side
Showing
36 changed files
with
2165 additions
and
1209 deletions
+2165
-1209
MyTeamApplication.java
src/main/java/com/nisum/myteam/MyTeamApplication.java
+3
-3
BillingController.java
...n/java/com/nisum/myteam/controller/BillingController.java
+68
-69
DashboardController.java
...java/com/nisum/myteam/controller/DashboardController.java
+38
-0
DomainController.java
...in/java/com/nisum/myteam/controller/DomainController.java
+63
-75
EmployeeController.java
.../java/com/nisum/myteam/controller/EmployeeController.java
+45
-2
ProjectController.java
...n/java/com/nisum/myteam/controller/ProjectController.java
+27
-99
ResourceAllocationController.java
...nisum/myteam/controller/ResourceAllocationController.java
+292
-0
ResourceController.java
.../java/com/nisum/myteam/controller/ResourceController.java
+231
-266
Employee.java
src/main/java/com/nisum/myteam/model/dao/Employee.java
+2
-1
Project.java
src/main/java/com/nisum/myteam/model/dao/Project.java
+0
-1
ResourceAllocation.java
...n/java/com/nisum/myteam/model/dao/ResourceAllocation.java
+43
-0
MyProjectAllocationVO.java
...java/com/nisum/myteam/model/vo/MyProjectAllocationVO.java
+34
-0
ResourceVO.java
src/main/java/com/nisum/myteam/model/vo/ResourceVO.java
+38
-0
ResourceAllocationRepo.java
...a/com/nisum/myteam/repository/ResourceAllocationRepo.java
+28
-0
ResourceRepo.java
src/main/java/com/nisum/myteam/repository/ResourceRepo.java
+1
-1
IDashboardService.java
...main/java/com/nisum/myteam/service/IDashboardService.java
+9
-0
IEmployeeService.java
src/main/java/com/nisum/myteam/service/IEmployeeService.java
+26
-26
IEmployeeVisaService.java
...n/java/com/nisum/myteam/service/IEmployeeVisaService.java
+6
-0
IProjectService.java
src/main/java/com/nisum/myteam/service/IProjectService.java
+34
-29
IResourceAllocationService.java
.../com/nisum/myteam/service/IResourceAllocationService.java
+66
-0
IResourceService.java
src/main/java/com/nisum/myteam/service/IResourceService.java
+25
-22
DashboardService.java
.../java/com/nisum/myteam/service/impl/DashboardService.java
+98
-0
DomainService.java
...ain/java/com/nisum/myteam/service/impl/DomainService.java
+17
-15
EmployeeService.java
...n/java/com/nisum/myteam/service/impl/EmployeeService.java
+14
-6
EmployeeVisaService.java
...va/com/nisum/myteam/service/impl/EmployeeVisaService.java
+14
-0
ProjectService.java
...in/java/com/nisum/myteam/service/impl/ProjectService.java
+356
-545
ResourceAllocationService.java
.../nisum/myteam/service/impl/ResourceAllocationService.java
+385
-0
ResourceService.java
...n/java/com/nisum/myteam/service/impl/ResourceService.java
+86
-27
DomainStatus.java
src/main/java/com/nisum/myteam/statuscodes/DomainStatus.java
+5
-2
ProjectStatus.java
...main/java/com/nisum/myteam/statuscodes/ProjectStatus.java
+28
-1
ResourceCodes.java
...main/java/com/nisum/myteam/statuscodes/ResourceCodes.java
+25
-0
ResourceStatus.java
...ain/java/com/nisum/myteam/statuscodes/ResourceStatus.java
+13
-1
MyTeamDateUtils.java
src/main/java/com/nisum/myteam/utils/MyTeamDateUtils.java
+13
-0
MyTeamUtils.java
src/main/java/com/nisum/myteam/utils/MyTeamUtils.java
+7
-0
ApplicationRole.java
...ava/com/nisum/myteam/utils/constants/ApplicationRole.java
+25
-0
RoleEnum.java
src/main/java/com/nisum/myteam/utils/constants/RoleEnum.java
+0
-18
No files found.
src/main/java/com/nisum/myteam/MyT
ime
Application.java
→
src/main/java/com/nisum/myteam/MyT
eam
Application.java
View file @
22239759
...
@@ -16,15 +16,15 @@ import org.springframework.web.filter.CorsFilter;
...
@@ -16,15 +16,15 @@ import org.springframework.web.filter.CorsFilter;
@SpringBootApplication
@SpringBootApplication
@EnableAutoConfiguration
@EnableAutoConfiguration
@EnableMongoRepositories
(
basePackages
=
{
"com.nisum.myteam.repository"
})
@EnableMongoRepositories
(
basePackages
=
{
"com.nisum.myteam.repository"
})
public
class
MyT
ime
Application
extends
SpringBootServletInitializer
{
public
class
MyT
eam
Application
extends
SpringBootServletInitializer
{
@Override
@Override
protected
SpringApplicationBuilder
configure
(
SpringApplicationBuilder
application
)
{
protected
SpringApplicationBuilder
configure
(
SpringApplicationBuilder
application
)
{
return
application
.
sources
(
MyT
ime
Application
.
class
);
return
application
.
sources
(
MyT
eam
Application
.
class
);
}
}
public
static
void
main
(
String
[]
args
)
{
public
static
void
main
(
String
[]
args
)
{
SpringApplication
.
run
(
MyT
ime
Application
.
class
,
args
);
SpringApplication
.
run
(
MyT
eam
Application
.
class
,
args
);
}
}
@Bean
@Bean
...
...
src/main/java/com/nisum/myteam/controller/BillingController.java
View file @
22239759
package
com
.
nisum
.
myteam
.
controller
;
//package com.nisum.myteam.controller;
//
import
java.util.List
;
//import java.util.List;
//import org.springframework.beans.factory.annotation.Autowired;
import
org.springframework.beans.factory.annotation.Autowired
;
//import org.springframework.http.HttpStatus;
import
org.springframework.http.HttpStatus
;
//import org.springframework.http.MediaType;
import
org.springframework.http.MediaType
;
//import org.springframework.http.ResponseEntity;
import
org.springframework.http.ResponseEntity
;
//import org.springframework.web.bind.annotation.PathVariable;
import
org.springframework.web.bind.annotation.PathVariable
;
//import org.springframework.web.bind.annotation.RequestBody;
import
org.springframework.web.bind.annotation.RequestBody
;
//import org.springframework.web.bind.annotation.RequestMapping;
import
org.springframework.web.bind.annotation.RequestMapping
;
//import org.springframework.web.bind.annotation.RequestMethod;
import
org.springframework.web.bind.annotation.RequestMethod
;
//import org.springframework.web.bind.annotation.RequestParam;
import
org.springframework.web.bind.annotation.RequestParam
;
//import org.springframework.web.bind.annotation.RestController;
import
org.springframework.web.bind.annotation.RestController
;
//import com.nisum.myteam.exception.handler.MyTeamException;
//import com.nisum.myteam.model.dao.Billing;
import
com.nisum.myteam.exception.handler.MyTeamException
;
//import com.nisum.myteam.service.IBillingService;
import
com.nisum.myteam.model.dao.Billing
;
//import lombok.extern.slf4j.Slf4j;
import
com.nisum.myteam.service.IBillingService
;
//
//@RestController
import
lombok.extern.slf4j.Slf4j
;
//@Slf4j
//public class BillingController {
@RestController
//
@Slf4j
// @Autowired
public
class
BillingController
{
// private IBillingService billingService;
//
@Autowired
// // @RequestMapping(value = "/addEmployeeBilling"
private
IBillingService
billingService
;
// @RequestMapping(value = "/billing", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
// public ResponseEntity<Billing> addEmployeeBilling(@RequestBody Billing billing,
// @RequestMapping(value = "/addEmployeeBilling"
// @RequestParam(value = "loginEmpId") String loginEmpId) throws MyTeamException {
@RequestMapping
(
value
=
"/billing"
,
method
=
RequestMethod
.
POST
,
produces
=
MediaType
.
APPLICATION_JSON_VALUE
,
consumes
=
MediaType
.
APPLICATION_JSON_VALUE
)
// Billing billingList = billingService.addBilling(billing, loginEmpId);
public
ResponseEntity
<
Billing
>
addEmployeeBilling
(
@RequestBody
Billing
billing
,
//
@RequestParam
(
value
=
"loginEmpId"
)
String
loginEmpId
)
throws
MyTeamException
{
// return new ResponseEntity<>(billingList, HttpStatus.OK);
Billing
billingList
=
billingService
.
addBilling
(
billing
,
loginEmpId
);
// }
//
return
new
ResponseEntity
<>(
billingList
,
HttpStatus
.
OK
);
// // @RequestMapping(value = "/updateEmployeeBilling",
}
// @RequestMapping(value = "/billing", method = RequestMethod.PUT, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
// public ResponseEntity<Billing> updateEmployeeBilling(@RequestBody Billing billing,
// @RequestMapping(value = "/updateEmployeeBilling",
// @RequestParam(value = "loginEmpId") String loginEmpId) throws MyTeamException {
@RequestMapping
(
value
=
"/billing"
,
method
=
RequestMethod
.
PUT
,
produces
=
MediaType
.
APPLICATION_JSON_VALUE
,
consumes
=
MediaType
.
APPLICATION_JSON_VALUE
)
// Billing billingList = billingService.updateBilling(billing, loginEmpId);
public
ResponseEntity
<
Billing
>
updateEmployeeBilling
(
@RequestBody
Billing
billing
,
// return new ResponseEntity<>(billingList, HttpStatus.OK);
@RequestParam
(
value
=
"loginEmpId"
)
String
loginEmpId
)
throws
MyTeamException
{
// }
Billing
billingList
=
billingService
.
updateBilling
(
billing
,
loginEmpId
);
//
return
new
ResponseEntity
<>(
billingList
,
HttpStatus
.
OK
);
// // @RequestMapping(value = "/deleteEmployeeBilling"
}
// @RequestMapping(value = "/billing", method = RequestMethod.DELETE, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
// public ResponseEntity<Billing> deleteEmployeeBilling(@RequestBody Billing billing) throws MyTeamException {
// @RequestMapping(value = "/deleteEmployeeBilling"
// billingService.deleteBilling(billing);
@RequestMapping
(
value
=
"/billing"
,
method
=
RequestMethod
.
DELETE
,
produces
=
MediaType
.
APPLICATION_JSON_VALUE
,
consumes
=
MediaType
.
APPLICATION_JSON_VALUE
)
// return new ResponseEntity<>(null, HttpStatus.OK);
public
ResponseEntity
<
Billing
>
deleteEmployeeBilling
(
@RequestBody
Billing
billing
)
throws
MyTeamException
{
// }
billingService
.
deleteBilling
(
billing
);
//
return
new
ResponseEntity
<>(
null
,
HttpStatus
.
OK
);
//
}
//
// // @RequestMapping(value = "/getEmployeeBillingDetailsAll"
// @RequestMapping(value = "/getEmployeeBillingDetailsAll"
// @RequestMapping(value = "/billing", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
@RequestMapping
(
value
=
"/billing"
,
method
=
RequestMethod
.
GET
,
produces
=
MediaType
.
APPLICATION_JSON_VALUE
)
// public ResponseEntity<List<Billing>> getAllBillingsForEmployee(@RequestParam("employeeId") String employeeId)
public
ResponseEntity
<
List
<
Billing
>>
getAllBillingsForEmployee
(
@RequestParam
(
"employeeId"
)
String
employeeId
)
// throws MyTeamException {
throws
MyTeamException
{
// List<Billing> billingList = billingService.getBillingsForEmployee(employeeId);
List
<
Billing
>
billingList
=
billingService
.
getBillingsForEmployee
(
employeeId
);
// return new ResponseEntity<>(billingList, HttpStatus.OK);
return
new
ResponseEntity
<>(
billingList
,
HttpStatus
.
OK
);
// }
}
//
// // @RequestMapping(value = "/getEmployeeBillingDetails"
// @RequestMapping(value = "/getEmployeeBillingDetails"
// @RequestMapping(value = "/billing/project/{projectId}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
@RequestMapping
(
value
=
"/billing/project/{projectId}"
,
method
=
RequestMethod
.
GET
,
produces
=
MediaType
.
APPLICATION_JSON_VALUE
)
// public ResponseEntity<List<Billing>> getBillingsForProject(@PathVariable("projectId") String projectId,
public
ResponseEntity
<
List
<
Billing
>>
getBillingsForProject
(
@PathVariable
(
"projectId"
)
String
projectId
,
// @RequestParam("employeeId") String employeeId) throws MyTeamException {
@RequestParam
(
"employeeId"
)
String
employeeId
)
throws
MyTeamException
{
// List<Billing> billingList = billingService.getBillingsForProject(employeeId, projectId);
List
<
Billing
>
billingList
=
billingService
.
getBillingsForProject
(
employeeId
,
projectId
);
// return new ResponseEntity<>(billingList, HttpStatus.OK);
return
new
ResponseEntity
<>(
billingList
,
HttpStatus
.
OK
);
// }
}
//
//}
}
src/main/java/com/nisum/myteam/controller/DashboardController.java
0 → 100644
View file @
22239759
package
com
.
nisum
.
myteam
.
controller
;
import
com.nisum.myteam.exception.handler.MyTeamException
;
import
com.nisum.myteam.exception.handler.ResponseDetails
;
import
com.nisum.myteam.model.vo.EmployeeDashboardVO
;
import
com.nisum.myteam.service.IDashboardService
;
import
com.nisum.myteam.service.impl.DashboardService
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.http.HttpStatus
;
import
org.springframework.http.MediaType
;
import
org.springframework.http.ResponseEntity
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestMethod
;
import
org.springframework.web.bind.annotation.RestController
;
import
javax.servlet.http.HttpServletRequest
;
import
java.util.Date
;
import
java.util.List
;
@RestController
@RequestMapping
public
class
DashboardController
{
@Autowired
private
IDashboardService
dashboardService
;
@RequestMapping
(
value
=
"/resources/getEmployeesDashBoard"
,
method
=
RequestMethod
.
GET
,
produces
=
MediaType
.
APPLICATION_JSON_VALUE
)
public
ResponseEntity
<?>
getEmployeesDashBoard
(
HttpServletRequest
request
)
throws
MyTeamException
{
List
<
EmployeeDashboardVO
>
employeeDashBoardList
=
dashboardService
.
getEmployeesDashBoard
();
ResponseDetails
responseDetails
=
new
ResponseDetails
(
new
Date
(),
602
,
"Resources have been retrieved successfully"
,
"List of Resources for dashboard"
,
employeeDashBoardList
,
request
.
getRequestURI
(),
"Resource details"
,
null
);
return
new
ResponseEntity
<
ResponseDetails
>(
responseDetails
,
HttpStatus
.
OK
);
}
}
src/main/java/com/nisum/myteam/controller/DomainController.java
View file @
22239759
package
com
.
nisum
.
myteam
.
controller
;
package
com
.
nisum
.
myteam
.
controller
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.stream.Collectors
;
import
javax.servlet.http.HttpServletRequest
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.http.HttpStatus
;
import
org.springframework.http.MediaType
;
import
org.springframework.http.ResponseEntity
;
import
org.springframework.web.bind.annotation.PathVariable
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestMethod
;
import
org.springframework.web.bind.annotation.RestController
;
import
com.nisum.myteam.exception.handler.MyTeamException
;
import
com.nisum.myteam.exception.handler.MyTeamException
;
import
com.nisum.myteam.exception.handler.ResponseDetails
;
import
com.nisum.myteam.exception.handler.ResponseDetails
;
import
com.nisum.myteam.model.dao.Domain
;
import
com.nisum.myteam.model.dao.Domain
;
import
com.nisum.myteam.service.IDomainService
;
import
com.nisum.myteam.service.IDomainService
;
import
com.nisum.myteam.statuscodes.DomainStatus
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.http.HttpStatus
;
import
org.springframework.http.MediaType
;
import
org.springframework.http.ResponseEntity
;
import
org.springframework.web.bind.annotation.*
;
import
javax.servlet.http.HttpServletRequest
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.stream.Collectors
;
/**
/**
* @author Vijay
* @author Vijay
*
*/
*/
@RestController
@RestController
@Slf4j
@Slf4j
...
@@ -45,13 +36,13 @@ public class DomainController {
...
@@ -45,13 +36,13 @@ public class DomainController {
if
(!
domainService
.
isDomainExists
(
domain
))
{
if
(!
domainService
.
isDomainExists
(
domain
))
{
Domain
domainPeristed
=
domainService
.
create
(
domain
);
Domain
domainPeristed
=
domainService
.
create
(
domain
);
ResponseDetails
createRespDetails
=
new
ResponseDetails
(
new
Date
(),
801
,
"Domain has been created"
,
ResponseDetails
createRespDetails
=
new
ResponseDetails
(
new
Date
(),
DomainStatus
.
CREATE
.
getCode
(),
DomainStatus
.
CREATE
.
getMessage
()
,
"Domain Creation"
,
null
,
""
,
"details"
,
domainPeristed
);
"Domain Creation"
,
null
,
""
,
"details"
,
domainPeristed
);
return
new
ResponseEntity
<
ResponseDetails
>(
createRespDetails
,
HttpStatus
.
OK
);
return
new
ResponseEntity
<
ResponseDetails
>(
createRespDetails
,
HttpStatus
.
OK
);
}
}
log
.
info
(
"A domain is already existed with the requested name"
+
domain
.
getDomainName
());
log
.
info
(
"A domain is already existed with the requested name"
+
domain
.
getDomainName
());
ResponseDetails
responseDetails
=
new
ResponseDetails
(
new
Date
(),
802
,
"Domain is already existed"
,
ResponseDetails
responseDetails
=
new
ResponseDetails
(
new
Date
(),
DomainStatus
.
ALREADY_EXISTED
.
getCode
(),
DomainStatus
.
ALREADY_EXISTED
.
getMessage
()
,
"Choose the different domain name"
,
null
,
request
.
getRequestURI
(),
"Domain details"
,
domain
);
"Choose the different domain name"
,
null
,
request
.
getRequestURI
(),
"Domain details"
,
domain
);
return
new
ResponseEntity
<
ResponseDetails
>(
responseDetails
,
HttpStatus
.
OK
);
return
new
ResponseEntity
<
ResponseDetails
>(
responseDetails
,
HttpStatus
.
OK
);
...
@@ -66,7 +57,7 @@ public class DomainController {
...
@@ -66,7 +57,7 @@ public class DomainController {
boolean
isDomainExists
=
domainService
.
isDomainExists
(
domain
);
boolean
isDomainExists
=
domainService
.
isDomainExists
(
domain
);
if
(
isDomainExists
==
true
)
{
if
(
isDomainExists
==
true
)
{
Domain
domainPersisted
=
domainService
.
update
(
domain
);
Domain
domainPersisted
=
domainService
.
update
(
domain
);
ResponseDetails
updateRespDetails
=
new
ResponseDetails
(
new
Date
(),
802
,
"Domain has been updated"
,
ResponseDetails
updateRespDetails
=
new
ResponseDetails
(
new
Date
(),
DomainStatus
.
UPDATE
.
getCode
(),
DomainStatus
.
UPDATE
.
getMessage
()
,
"Domain Updation"
,
null
,
request
.
getRequestURI
(),
"Updation Domain details"
,
domainPersisted
);
"Domain Updation"
,
null
,
request
.
getRequestURI
(),
"Updation Domain details"
,
domainPersisted
);
return
new
ResponseEntity
<
ResponseDetails
>(
updateRespDetails
,
HttpStatus
.
OK
);
return
new
ResponseEntity
<
ResponseDetails
>(
updateRespDetails
,
HttpStatus
.
OK
);
...
@@ -90,11 +81,10 @@ public class DomainController {
...
@@ -90,11 +81,10 @@ public class DomainController {
}
}
@RequestMapping
(
value
=
"/domains"
,
method
=
RequestMethod
.
GET
,
produces
=
MediaType
.
APPLICATION_JSON_VALUE
)
@RequestMapping
(
value
=
"/domains"
,
method
=
RequestMethod
.
GET
,
produces
=
MediaType
.
APPLICATION_JSON_VALUE
)
public
ResponseEntity
<?>
getDomains
(
HttpServletRequest
request
)
throws
MyTeamException
{
public
ResponseEntity
<?>
getDomains
(
HttpServletRequest
request
)
throws
MyTeamException
{
ResponseDetails
getRespDetails
=
new
ResponseDetails
(
new
Date
(),
804
,
"Retrieved the domains successfully"
,
ResponseDetails
getRespDetails
=
new
ResponseDetails
(
new
Date
(),
DomainStatus
.
GET_DOMIAINS
.
getCode
(),
DomainStatus
.
GET_DOMIAINS
.
getMessage
()
,
"Domains list"
,
domainService
.
getDomainsList
(),
request
.
getRequestURI
(),
"details"
,
null
);
"Domains list"
,
domainService
.
getDomainsList
(),
request
.
getRequestURI
(),
"details"
,
null
);
return
new
ResponseEntity
<
ResponseDetails
>(
getRespDetails
,
HttpStatus
.
OK
);
return
new
ResponseEntity
<
ResponseDetails
>(
getRespDetails
,
HttpStatus
.
OK
);
...
@@ -109,6 +99,4 @@ public class DomainController {
...
@@ -109,6 +99,4 @@ public class DomainController {
}
}
}
}
\ No newline at end of file
src/main/java/com/nisum/myteam/controller/EmployeeController.java
View file @
22239759
...
@@ -8,6 +8,8 @@ import java.util.stream.Collectors;
...
@@ -8,6 +8,8 @@ import java.util.stream.Collectors;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletRequest
;
import
com.nisum.myteam.model.dao.EmployeeVisa
;
import
com.nisum.myteam.repository.EmployeeVisaRepo
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.http.HttpStatus
;
import
org.springframework.http.HttpStatus
;
import
org.springframework.http.MediaType
;
import
org.springframework.http.MediaType
;
...
@@ -38,11 +40,15 @@ public class EmployeeController {
...
@@ -38,11 +40,15 @@ public class EmployeeController {
@Autowired
@Autowired
private
IEmployeeRoleService
employeeRoleService
;
private
IEmployeeRoleService
employeeRoleService
;
@Autowired
private
EmployeeVisaRepo
employeeVisaRepo
;
@RequestMapping
(
value
=
"/employees/{empId}"
,
method
=
RequestMethod
.
POST
,
produces
=
MediaType
.
APPLICATION_JSON_VALUE
,
consumes
=
MediaType
.
APPLICATION_JSON_VALUE
)
@RequestMapping
(
value
=
"/employees/{empId}"
,
method
=
RequestMethod
.
POST
,
produces
=
MediaType
.
APPLICATION_JSON_VALUE
,
consumes
=
MediaType
.
APPLICATION_JSON_VALUE
)
public
ResponseEntity
<?>
createEmployee
(
@RequestBody
Employee
employeeReq
,
public
ResponseEntity
<?>
createEmployee
(
@RequestBody
Employee
employeeReq
,
@PathVariable
(
value
=
"empId"
)
String
loginEmpId
,
HttpServletRequest
request
)
throws
MyTeamException
{
@PathVariable
(
value
=
"empId"
)
String
loginEmpId
,
HttpServletRequest
request
)
throws
MyTeamException
{
if
(
empService
.
isEmployeeExistsById
(
loginEmpId
))
{
if
(
!
empService
.
isEmployeeExistsById
(
loginEmpId
))
{
Employee
employeePersisted
=
empService
.
createEmployee
(
employeeReq
,
loginEmpId
);
Employee
employeePersisted
=
empService
.
createEmployee
(
employeeReq
,
loginEmpId
);
ResponseDetails
createRespDetails
=
new
ResponseDetails
(
new
Date
(),
901
,
"Employee has been created"
,
ResponseDetails
createRespDetails
=
new
ResponseDetails
(
new
Date
(),
901
,
"Employee has been created"
,
...
@@ -228,5 +234,42 @@ public class EmployeeController {
...
@@ -228,5 +234,42 @@ public class EmployeeController {
}
}
@RequestMapping
(
value
=
"/getEmployeesHavingVisa"
,
method
=
RequestMethod
.
GET
,
produces
=
MediaType
.
APPLICATION_JSON_VALUE
)
public
ResponseEntity
<?>
getEmployeesHavingVisa
(
@RequestParam
(
"visa"
)
String
passport
,
HttpServletRequest
request
)
throws
MyTeamException
{
List
<
Employee
>
employees
=
new
ArrayList
<>();
if
(
passport
!=
null
&&
!
"passport"
.
equalsIgnoreCase
(
passport
))
{
List
<
EmployeeVisa
>
employeeVisas
=
employeeVisaRepo
.
findByVisaName
(
passport
);
List
<
String
>
employeeIds
=
null
;
if
(
employeeVisas
!=
null
)
{
employeeIds
=
employeeVisas
.
stream
().
map
(
EmployeeVisa:
:
getEmployeeId
).
collect
(
Collectors
.
toList
());
}
if
(
employeeIds
!=
null
&&
!
employeeIds
.
isEmpty
())
{
List
<
Employee
>
emps
=
empService
.
getActiveEmployees
();
for
(
Employee
emp
:
emps
)
{
if
(
employeeIds
.
contains
(
emp
.
getEmployeeId
()))
{
employees
.
add
(
emp
);
}
}
}
}
else
{
if
(
empService
.
getActiveEmployees
()
!=
null
)
{
employees
=
empService
.
getActiveEmployees
().
stream
()
.
sorted
((
o1
,
o2
)
->
o1
.
getEmployeeName
().
compareTo
(
o2
.
getEmployeeName
()))
.
collect
(
Collectors
.
toList
());
}
}
ResponseDetails
responseDetails
=
new
ResponseDetails
(
new
Date
(),
602
,
"Resources have been retrieved successfully"
,
"List of Resources who has visa"
,
employees
,
request
.
getRequestURI
(),
"Resource details"
,
null
);
return
new
ResponseEntity
<
ResponseDetails
>(
responseDetails
,
HttpStatus
.
OK
);
}
}
}
\ No newline at end of file
src/main/java/com/nisum/myteam/controller/ProjectController.java
View file @
22239759
...
@@ -6,7 +6,8 @@ import com.nisum.myteam.model.dao.Account;
...
@@ -6,7 +6,8 @@ import com.nisum.myteam.model.dao.Account;
import
com.nisum.myteam.model.dao.Project
;
import
com.nisum.myteam.model.dao.Project
;
import
com.nisum.myteam.service.IEmployeeService
;
import
com.nisum.myteam.service.IEmployeeService
;
import
com.nisum.myteam.service.IProjectService
;
import
com.nisum.myteam.service.IProjectService
;
import
com.nisum.myteam.utils.MyTeamUtils
;
import
com.nisum.myteam.statuscodes.ProjectStatus
;
import
com.nisum.myteam.utils.constants.ApplicationRole
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.http.HttpStatus
;
import
org.springframework.http.HttpStatus
;
...
@@ -36,7 +37,7 @@ public class ProjectController {
...
@@ -36,7 +37,7 @@ public class ProjectController {
public
ResponseEntity
<?>
createProject
(
@Valid
@RequestBody
Project
projectReq
,
public
ResponseEntity
<?>
createProject
(
@Valid
@RequestBody
Project
projectReq
,
@RequestParam
(
value
=
"loginEmpId"
)
String
loginEmpId
,
HttpServletRequest
request
)
throws
MyTeamException
{
@RequestParam
(
value
=
"loginEmpId"
)
String
loginEmpId
,
HttpServletRequest
request
)
throws
MyTeamException
{
if
(!
projectService
.
isProjectExists
(
projectReq
.
getProjectName
()))
{
if
(!
projectService
.
isProjectExists
ByName
(
projectReq
.
getProjectName
()))
{
String
accountName
=
""
;
String
accountName
=
""
;
Account
account
=
projectService
.
getProjectAccount
(
projectReq
.
getAccountId
());
Account
account
=
projectService
.
getProjectAccount
(
projectReq
.
getAccountId
());
...
@@ -53,8 +54,8 @@ public class ProjectController {
...
@@ -53,8 +54,8 @@ public class ProjectController {
Project
projectPersisted
=
projectService
.
createProject
(
projectReq
,
loginEmpId
);
Project
projectPersisted
=
projectService
.
createProject
(
projectReq
,
loginEmpId
);
if
(
projectPersisted
!=
null
)
{
if
(
projectPersisted
!=
null
)
{
ResponseDetails
getRespDetails
=
new
ResponseDetails
(
new
Date
(),
800
,
ResponseDetails
getRespDetails
=
new
ResponseDetails
(
new
Date
(),
ProjectStatus
.
CREATE
.
getCode
()
,
"Project has been created"
,
"Project description"
,
null
,
ProjectStatus
.
CREATE
.
getMessage
()
,
"Project description"
,
null
,
request
.
getRequestURI
(),
"details"
,
projectPersisted
);
request
.
getRequestURI
(),
"details"
,
projectPersisted
);
return
new
ResponseEntity
<
ResponseDetails
>(
getRespDetails
,
HttpStatus
.
OK
);
return
new
ResponseEntity
<
ResponseDetails
>(
getRespDetails
,
HttpStatus
.
OK
);
...
@@ -63,8 +64,8 @@ public class ProjectController {
...
@@ -63,8 +64,8 @@ public class ProjectController {
}
}
}
}
ResponseDetails
getRespDetails
=
new
ResponseDetails
(
new
Date
(),
801
,
ResponseDetails
getRespDetails
=
new
ResponseDetails
(
new
Date
(),
ProjectStatus
.
ALREADY_EXISTED
.
getCode
()
,
"Project is already existed"
,
"Choose the different project name"
,
null
,
ProjectStatus
.
ALREADY_EXISTED
.
getMessage
()
,
"Choose the different project name"
,
null
,
request
.
getRequestURI
(),
"details"
,
projectReq
);
request
.
getRequestURI
(),
"details"
,
projectReq
);
return
new
ResponseEntity
<
ResponseDetails
>(
getRespDetails
,
HttpStatus
.
OK
);
return
new
ResponseEntity
<
ResponseDetails
>(
getRespDetails
,
HttpStatus
.
OK
);
...
@@ -78,23 +79,23 @@ public class ProjectController {
...
@@ -78,23 +79,23 @@ public class ProjectController {
@RequestParam
(
value
=
"loginEmpId"
)
String
loginEmpId
,
HttpServletRequest
request
)
throws
MyTeamException
{
@RequestParam
(
value
=
"loginEmpId"
)
String
loginEmpId
,
HttpServletRequest
request
)
throws
MyTeamException
{
if
(
projectService
.
isProjectExistsById
(
projectId
))
{
if
(
projectService
.
isProjectExistsById
(
projectId
))
{
if
(
projectService
.
isProjectExists
(
project
.
getProjectName
()))
{
if
(
projectService
.
isProjectExists
ByName
(
project
.
getProjectName
()))
{
Project
updatedProject
=
projectService
.
updateProject
(
project
,
loginEmpId
);
Project
updatedProject
=
projectService
.
updateProject
(
project
,
loginEmpId
);
ResponseDetails
getRespDetails
=
new
ResponseDetails
(
new
Date
(),
801
,
ResponseDetails
getRespDetails
=
new
ResponseDetails
(
new
Date
(),
ProjectStatus
.
UPDATE
.
getCode
()
,
"Project has been updated"
,
"Project Updation Description"
,
null
,
ProjectStatus
.
UPDATE
.
getMessage
()
,
"Project Updation Description"
,
null
,
request
.
getRequestURI
(),
"Project Updation details"
,
updatedProject
);
request
.
getRequestURI
(),
"Project Updation details"
,
updatedProject
);
return
new
ResponseEntity
<
ResponseDetails
>(
getRespDetails
,
HttpStatus
.
OK
);
return
new
ResponseEntity
<
ResponseDetails
>(
getRespDetails
,
HttpStatus
.
OK
);
}
}
ResponseDetails
getRespDetails
=
new
ResponseDetails
(
new
Date
(),
801
,
ResponseDetails
getRespDetails
=
new
ResponseDetails
(
new
Date
(),
ProjectStatus
.
PROJECT_NAME_IS_NOT_EXISTS
.
getCode
()
,
"Project is not existed"
,
"Please provide the valid project name"
,
null
,
ProjectStatus
.
PROJECT_NAME_IS_NOT_EXISTS
.
getMessage
()
,
"Please provide the valid project name"
,
null
,
request
.
getRequestURI
(),
"details"
,
project
);
request
.
getRequestURI
(),
"details"
,
project
);
return
new
ResponseEntity
<
ResponseDetails
>(
getRespDetails
,
HttpStatus
.
OK
);
return
new
ResponseEntity
<
ResponseDetails
>(
getRespDetails
,
HttpStatus
.
OK
);
}
}
ResponseDetails
getRespDetails
=
new
ResponseDetails
(
new
Date
(),
801
,
ResponseDetails
getRespDetails
=
new
ResponseDetails
(
new
Date
(),
ProjectStatus
.
PROJECTID_IS_NOT_EXISTS
.
getCode
()
,
"Project Id is not existed"
,
"Please provide the valid project Id"
,
null
,
ProjectStatus
.
PROJECTID_IS_NOT_EXISTS
.
getMessage
()
,
"Please provide the valid project Id"
,
null
,
request
.
getRequestURI
(),
"details"
,
project
);
request
.
getRequestURI
(),
"details"
,
project
);
return
new
ResponseEntity
<
ResponseDetails
>(
getRespDetails
,
HttpStatus
.
OK
);
return
new
ResponseEntity
<
ResponseDetails
>(
getRespDetails
,
HttpStatus
.
OK
);
...
@@ -106,21 +107,20 @@ public class ProjectController {
...
@@ -106,21 +107,20 @@ public class ProjectController {
if
(
projectService
.
isProjectExistsById
(
projectId
))
{
if
(
projectService
.
isProjectExistsById
(
projectId
))
{
projectService
.
deleteProject
(
projectId
);
projectService
.
deleteProject
(
projectId
);
ResponseDetails
deleteRespDetails
=
new
ResponseDetails
(
new
Date
(),
604
,
ResponseDetails
deleteRespDetails
=
new
ResponseDetails
(
new
Date
(),
ProjectStatus
.
DELETE
.
getCode
()
,
"Project has been deleted successfully"
,
"Project Deletion description"
,
null
,
request
.
getRequestURI
(),
"Project Deletion details"
,
ProjectStatus
.
DELETE
.
getMessage
()
,
"Project Deletion description"
,
null
,
request
.
getRequestURI
(),
"Project Deletion details"
,
projectId
);
projectId
);
return
new
ResponseEntity
<
ResponseDetails
>(
deleteRespDetails
,
HttpStatus
.
OK
);
return
new
ResponseEntity
<
ResponseDetails
>(
deleteRespDetails
,
HttpStatus
.
OK
);
}
}
ResponseDetails
deleteRespDetails
=
new
ResponseDetails
(
new
Date
(),
604
,
ResponseDetails
deleteRespDetails
=
new
ResponseDetails
(
new
Date
(),
ProjectStatus
.
PROJECTID_IS_NOT_EXISTS
.
getCode
()
,
"Project does not exists"
,
"Please provide valid project id"
,
null
,
request
.
getRequestURI
(),
"Project Deletion details"
,
ProjectStatus
.
PROJECTID_IS_NOT_EXISTS
.
getMessage
()
,
"Please provide valid project id"
,
null
,
request
.
getRequestURI
(),
"Project Deletion details"
,
projectId
);
projectId
);
return
new
ResponseEntity
<
ResponseDetails
>(
deleteRespDetails
,
HttpStatus
.
OK
);
return
new
ResponseEntity
<
ResponseDetails
>(
deleteRespDetails
,
HttpStatus
.
OK
);
}
}
// @RequestMapping(value = "/getProjects" //get projects only for DL
// @RequestMapping(value = "/getProjects" //get projects only for DL
@RequestMapping
(
value
=
"/projects/employeeId/{employeeId}"
,
method
=
RequestMethod
.
GET
,
produces
=
MediaType
.
APPLICATION_JSON_VALUE
)
@RequestMapping
(
value
=
"/projects/employeeId/{employeeId}"
,
method
=
RequestMethod
.
GET
,
produces
=
MediaType
.
APPLICATION_JSON_VALUE
)
public
ResponseEntity
<?>
getProjectsOnRoleBasis
(
public
ResponseEntity
<?>
getProjectsOnRoleBasis
(
...
@@ -128,23 +128,21 @@ public class ProjectController {
...
@@ -128,23 +128,21 @@ public class ProjectController {
throws
MyTeamException
{
throws
MyTeamException
{
List
<
HashMap
<
Object
,
Object
>>
projects
=
null
;
List
<
HashMap
<
Object
,
Object
>>
projects
=
null
;
if
(
employeeId
!=
null
&&
!
""
.
equalsIgnoreCase
(
employeeId
)
)
{
if
(
employeeId
!=
null
&&
!
""
.
equalsIgnoreCase
(
employeeId
))
{
boolean
isEmployeeHaveAccess
=
employeeService
.
verifyEmployeeRole
(
employeeId
,
MyTeamUtils
.
DL
);
boolean
isEmployeeHaveAccess
=
employeeService
.
verifyEmployeeRole
(
employeeId
,
ApplicationRole
.
DELIVERY_LEAD
.
getRoleId
()
);
if
(
isEmployeeHaveAccess
)
{
if
(
isEmployeeHaveAccess
)
{
//projects = projectService.deliveryLeadProjects(employeeId);
//projects = projectService.deliveryLeadProjects(employeeId);
projects
=
projectService
.
getRoleBasedProjects
(
employeeId
);
projects
=
projectService
.
getRoleBasedProjects
(
employeeId
);
ResponseDetails
getRespDetails
=
new
ResponseDetails
(
new
Date
(),
604
,
"Retrieved the projects successfully"
,
ResponseDetails
getRespDetails
=
new
ResponseDetails
(
new
Date
(),
ProjectStatus
.
GET_PROJECTS
.
getCode
(),
ProjectStatus
.
GET_PROJECTS
.
getMessage
()
,
"Projects list"
,
projects
,
request
.
getRequestURI
(),
"Project details"
,
null
);
"Projects list"
,
projects
,
request
.
getRequestURI
(),
"Project details"
,
null
);
return
new
ResponseEntity
<
ResponseDetails
>(
getRespDetails
,
HttpStatus
.
OK
);
return
new
ResponseEntity
<
ResponseDetails
>(
getRespDetails
,
HttpStatus
.
OK
);
}
}
else
{
else
projects
=
projectService
.
getProjectsInsteadOfRole
();
{
ResponseDetails
getRespDetails
=
new
ResponseDetails
(
new
Date
(),
ProjectStatus
.
GET_PROJECTS
.
getCode
(),
ProjectStatus
.
GET_PROJECTS
.
getMessage
(),
projects
=
projectService
.
getProjectsInsteadOfRole
();
ResponseDetails
getRespDetails
=
new
ResponseDetails
(
new
Date
(),
604
,
"Retrieved the projects successfully"
,
"Projects list"
,
projects
,
request
.
getRequestURI
(),
"Project details"
,
null
);
"Projects list"
,
projects
,
request
.
getRequestURI
(),
"Project details"
,
null
);
return
new
ResponseEntity
<
ResponseDetails
>(
getRespDetails
,
HttpStatus
.
OK
);
return
new
ResponseEntity
<
ResponseDetails
>(
getRespDetails
,
HttpStatus
.
OK
);
...
@@ -158,7 +156,7 @@ public class ProjectController {
...
@@ -158,7 +156,7 @@ public class ProjectController {
}
}
ResponseDetails
getRespDetails
=
new
ResponseDetails
(
new
Date
(),
606
,
"Please Provide valid employee id"
,
ResponseDetails
getRespDetails
=
new
ResponseDetails
(
new
Date
(),
ProjectStatus
.
EMPLOYEE_NOT_EXISTS
.
getCode
(),
ProjectStatus
.
EMPLOYEE_NOT_EXISTS
.
getMessage
()
,
"Projects list"
,
null
,
request
.
getRequestURI
(),
"Project details"
,
null
);
"Projects list"
,
null
,
request
.
getRequestURI
(),
"Project details"
,
null
);
return
new
ResponseEntity
<
ResponseDetails
>(
getRespDetails
,
HttpStatus
.
OK
);
return
new
ResponseEntity
<
ResponseDetails
>(
getRespDetails
,
HttpStatus
.
OK
);
...
@@ -172,87 +170,17 @@ public class ProjectController {
...
@@ -172,87 +170,17 @@ public class ProjectController {
if
(
deliveryLeadId
!=
null
&&
!
""
.
equalsIgnoreCase
(
deliveryLeadId
))
{
if
(
deliveryLeadId
!=
null
&&
!
""
.
equalsIgnoreCase
(
deliveryLeadId
))
{
ResponseDetails
getRespDetails
=
new
ResponseDetails
(
new
Date
(),
604
,
"Retrieved the projects successfully"
,
ResponseDetails
getRespDetails
=
new
ResponseDetails
(
new
Date
(),
ProjectStatus
.
GET_PROJECTS
.
getCode
(),
ProjectStatus
.
GET_PROJECTS
.
getMessage
()
,
"Projects list under delivery lead"
,
projectService
.
getProjectsUnderDeliveryLead
(
deliveryLeadId
),
request
.
getRequestURI
(),
"Project details"
,
null
);
"Projects list under delivery lead"
,
projectService
.
getProjectsUnderDeliveryLead
(
deliveryLeadId
),
request
.
getRequestURI
(),
"Project details"
,
null
);
return
new
ResponseEntity
<
ResponseDetails
>(
getRespDetails
,
HttpStatus
.
OK
);
return
new
ResponseEntity
<
ResponseDetails
>(
getRespDetails
,
HttpStatus
.
OK
);
}
}
ResponseDetails
getRespDetails
=
new
ResponseDetails
(
new
Date
(),
606
,
"Please Provide valid Delivery lead id"
,
ResponseDetails
getRespDetails
=
new
ResponseDetails
(
new
Date
(),
ProjectStatus
.
DELIVERYLEAD_NOT_EXISTS
.
getCode
(),
ProjectStatus
.
DELIVERYLEAD_NOT_EXISTS
.
getMessage
()
,
"Projects list under delivery lead"
,
null
,
request
.
getRequestURI
(),
"Project details"
,
null
);
"Projects list under delivery lead"
,
null
,
request
.
getRequestURI
(),
"Project details"
,
null
);
return
new
ResponseEntity
<
ResponseDetails
>(
getRespDetails
,
HttpStatus
.
OK
);
return
new
ResponseEntity
<
ResponseDetails
>(
getRespDetails
,
HttpStatus
.
OK
);
}
}
@RequestMapping
(
value
=
"/getMyProjectAllocations"
,
method
=
RequestMethod
.
GET
,
produces
=
MediaType
.
APPLICATION_JSON_VALUE
)
public
ResponseEntity
<?>
getMyProjectAllocations
(
@RequestParam
(
"employeeId"
)
String
employeeId
,
HttpServletRequest
request
)
throws
MyTeamException
{
if
(
employeeId
!=
null
&&
!
""
.
equalsIgnoreCase
(
employeeId
))
{
ResponseDetails
getRespDetails
=
new
ResponseDetails
(
new
Date
(),
604
,
"Retrieved the project allocations successfully"
,
"Projects allocations for an employee"
,
projectService
.
getProjectsForEmployee
(
employeeId
),
request
.
getRequestURI
(),
"Project details"
,
null
);
return
new
ResponseEntity
<
ResponseDetails
>(
getRespDetails
,
HttpStatus
.
OK
);
}
ResponseDetails
getRespDetails
=
new
ResponseDetails
(
new
Date
(),
606
,
"Please Provide valid employee id"
,
"Project allocations for an employee"
,
null
,
request
.
getRequestURI
(),
"Project details"
,
null
);
return
new
ResponseEntity
<
ResponseDetails
>(
getRespDetails
,
HttpStatus
.
OK
);
}
}
}
// checking project duplicateName
// int projectNameCount = 0;
// if (projectReq.getAccountId() != null) {
//
// List<Project> projects=projectService.getProjectsUnderDomain(projectReq.getDomainId());
//
// for (Project existproject : projects) {
// if (projectReq.getProjectName().equalsIgnoreCase(existproject.getProjectName()))
// projectNameCount++;
// }
// }
// if (projectNameCount > MyTeamUtils.INT_ZERO) {
// MyTeamException myTimeException = new MyTeamException("Project name already exist !!! try with new");
// return new ResponseEntity<>(myTimeException, HttpStatus.OK);
// } else {
//
// }
// @RequestMapping(value = "/getProjects" //get projects only for DL
// @RequestMapping(value = "/projects/employeeId/{employeeId}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
// public ResponseEntity<?> getProjects(
// @PathVariable(value = "employeeId") String employeeId, HttpServletRequest request)
// throws MyTeamException {
// List<HashMap<Object, Object>> projects = null;
//
// if (employeeId != null && !"".equalsIgnoreCase(employeeId) && !"undefined".equalsIgnoreCase(employeeId)) {
// boolean isDl = employeeService.verifyEmployeeRole(employeeId, MyTeamUtils.DL);
// if (isDl) {
// projects = projectService.deliveryLeadProjects(employeeId);
//
// ResponseDetails getRespDetails = new ResponseDetails(new Date(), 604, "Retrieved the projects successfully",
// "Projects list", projects, request.getRequestURI(), "Project details", null);
//
// return new ResponseEntity<ResponseDetails>(getRespDetails, HttpStatus.OK);
// }
//
// ResponseDetails getRespDetails = new ResponseDetails(new Date(), 605, "You are not authorized to view Projects.",
// "Only Delivery leads can get the project details", projects, request.getRequestURI(), "Project details", null);
//
// return new ResponseEntity<ResponseDetails>(getRespDetails, HttpStatus.OK);
//
// }
//
// ResponseDetails getRespDetails = new ResponseDetails(new Date(), 606, "Please Provide valid employee id",
// "Projects list", null, request.getRequestURI(), "Project details", null);
//
// return new ResponseEntity<ResponseDetails>(getRespDetails, HttpStatus.OK);
// }
\ No newline at end of file
src/main/java/com/nisum/myteam/controller/ResourceAllocationController.java
0 → 100644
View file @
22239759
package
com
.
nisum
.
myteam
.
controller
;
import
com.nisum.myteam.exception.handler.MyTeamException
;
import
com.nisum.myteam.exception.handler.ResponseDetails
;
import
com.nisum.myteam.model.dao.Employee
;
import
com.nisum.myteam.model.dao.ResourceAllocation
;
import
com.nisum.myteam.model.vo.ResourceVO
;
import
com.nisum.myteam.repository.EmployeeVisaRepo
;
import
com.nisum.myteam.service.IEmployeeService
;
import
com.nisum.myteam.service.IProjectService
;
import
com.nisum.myteam.service.impl.ResourceAllocationService
;
import
com.nisum.myteam.utils.MyTeamUtils
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.http.HttpStatus
;
import
org.springframework.http.MediaType
;
import
org.springframework.http.ResponseEntity
;
import
org.springframework.web.bind.annotation.*
;
import
javax.servlet.http.HttpServletRequest
;
import
java.util.Date
;
import
java.util.List
;
@RestController
@RequestMapping
@Slf4j
public
class
ResourceAllocationController
{
@Autowired
private
IEmployeeService
employeeService
;
@Autowired
private
IProjectService
projectService
;
@Autowired
private
EmployeeVisaRepo
employeeVisaRepo
;
@Autowired
private
ResourceAllocationService
resourceAllocService
;
//tested in all the cases.ok
@RequestMapping
(
value
=
"/resources"
,
method
=
RequestMethod
.
POST
,
produces
=
MediaType
.
APPLICATION_JSON_VALUE
,
consumes
=
MediaType
.
APPLICATION_JSON_VALUE
)
public
ResponseEntity
<?>
createResource
(
@RequestBody
ResourceAllocation
resourceAllocationReq
,
@RequestParam
(
value
=
"loginEmpId"
,
required
=
true
)
String
loginEmpId
,
HttpServletRequest
request
)
throws
MyTeamException
{
if
(
StringUtils
.
isNotBlank
(
loginEmpId
))
{
resourceAllocationReq
.
setAuditFields
(
loginEmpId
,
MyTeamUtils
.
CREATE
);
if
(
resourceAllocService
.
validateBillingStartEndDateAgainstProjectStartEndDate
(
resourceAllocationReq
,
loginEmpId
))
{
if
(
resourceAllocService
.
validateBillingStartDateAgainstDOJ
(
resourceAllocationReq
))
{
if
(!
resourceAllocService
.
isResourceAssignedToAnyProject
(
resourceAllocationReq
))
{
ResourceAllocation
resourcePersisted
=
resourceAllocService
.
addResourceAllocation
(
resourceAllocationReq
,
loginEmpId
);
ResponseDetails
createResponseDetails
=
new
ResponseDetails
(
new
Date
(),
601
,
"Resource has been created"
,
"Resource description"
,
null
,
request
.
getContextPath
(),
"details"
,
resourcePersisted
);
return
new
ResponseEntity
<
ResponseDetails
>(
createResponseDetails
,
HttpStatus
.
OK
);
}
}
}
ResponseDetails
responseDetails
=
new
ResponseDetails
(
new
Date
(),
602
,
resourceAllocService
.
respMap
.
get
(
"message"
).
toString
(),
"Error message desc"
,
null
,
request
.
getRequestURI
(),
"Resource details"
,
resourceAllocationReq
);
return
new
ResponseEntity
<
ResponseDetails
>(
responseDetails
,
HttpStatus
.
OK
);
}
ResponseDetails
responseDetails
=
new
ResponseDetails
(
new
Date
(),
602
,
"Please provide the valid Employee Id"
,
"Employee Id is not valid"
,
null
,
request
.
getRequestURI
(),
"Resource details"
,
resourceAllocationReq
);
return
new
ResponseEntity
<
ResponseDetails
>(
responseDetails
,
HttpStatus
.
OK
);
}
//tested in all the cases.ok
@RequestMapping
(
value
=
"/resources"
,
method
=
RequestMethod
.
PUT
,
produces
=
MediaType
.
APPLICATION_JSON_VALUE
,
consumes
=
MediaType
.
APPLICATION_JSON_VALUE
)
public
ResponseEntity
<?>
updateResource
(
@RequestBody
ResourceAllocation
resourceAllocationReq
,
@RequestParam
(
value
=
"loginEmpId"
)
String
loginEmpId
,
HttpServletRequest
request
)
throws
MyTeamException
{
if
(
StringUtils
.
isNotBlank
(
loginEmpId
))
{
resourceAllocationReq
.
setAuditFields
(
loginEmpId
,
MyTeamUtils
.
UPDATE
);
if
(
resourceAllocService
.
isResourceExistsForProject
(
resourceAllocationReq
.
getEmployeeId
(),
resourceAllocationReq
.
getProjectId
()))
{
resourceAllocService
.
updatePreviousResource
(
resourceAllocationReq
,
loginEmpId
);
resourceAllocService
.
updateResource
(
resourceAllocationReq
,
loginEmpId
);
}
ResponseDetails
createResponseDetails
=
new
ResponseDetails
(
new
Date
(),
601
,
resourceAllocService
.
respMap
.
get
(
"message"
).
toString
(),
"Resource description"
,
null
,
request
.
getContextPath
(),
"Resource details"
,
resourceAllocationReq
);
return
new
ResponseEntity
<
ResponseDetails
>(
createResponseDetails
,
HttpStatus
.
OK
);
}
ResponseDetails
responseDetails
=
new
ResponseDetails
(
new
Date
(),
602
,
"Please provide the valid Employee Id"
,
"Employee Id is not valid"
,
null
,
request
.
getRequestURI
(),
"Resource details"
,
resourceAllocationReq
);
return
new
ResponseEntity
<
ResponseDetails
>(
responseDetails
,
HttpStatus
.
OK
);
}
//Tested Ok
@RequestMapping
(
value
=
"/resources"
,
method
=
RequestMethod
.
DELETE
,
produces
=
MediaType
.
APPLICATION_JSON_VALUE
,
consumes
=
MediaType
.
APPLICATION_JSON_VALUE
)
public
ResponseEntity
<?>
deleteResource
(
@RequestBody
ResourceAllocation
resourceReq
,
@RequestParam
(
value
=
"loginEmpId"
,
required
=
true
)
String
loginEmpId
,
HttpServletRequest
request
)
throws
MyTeamException
{
if
(
StringUtils
.
isNotBlank
(
loginEmpId
))
{
resourceAllocService
.
deleteResource
(
resourceReq
,
loginEmpId
);
ResponseDetails
createResponseDetails
=
new
ResponseDetails
(
new
Date
(),
601
,
"Resource has been deleted"
,
"Resource description"
,
null
,
request
.
getContextPath
(),
"Resource details"
,
resourceReq
);
return
new
ResponseEntity
<
ResponseDetails
>(
createResponseDetails
,
HttpStatus
.
OK
);
}
ResponseDetails
responseDetails
=
new
ResponseDetails
(
new
Date
(),
602
,
"Please provide the valid Employee Id"
,
"Employee Id is not valid"
,
null
,
request
.
getRequestURI
(),
"Resource details"
,
resourceReq
);
return
new
ResponseEntity
<
ResponseDetails
>(
responseDetails
,
HttpStatus
.
OK
);
}
//Ok Tested in all of the cases
@RequestMapping
(
value
=
"/resources/project/{projectId}"
,
method
=
RequestMethod
.
GET
,
produces
=
MediaType
.
APPLICATION_JSON_VALUE
)
public
ResponseEntity
<?>
getResourcesForProject
(
@PathVariable
(
value
=
"projectId"
,
required
=
true
)
String
projectId
,
@RequestParam
(
value
=
"status"
,
required
=
false
,
defaultValue
=
MyTeamUtils
.
ACTIVE
)
String
status
,
HttpServletRequest
request
)
throws
MyTeamException
{
if
(
StringUtils
.
isNotBlank
(
projectId
))
{
List
<
ResourceVO
>
resourcesList
=
resourceAllocService
.
getResourcesForProject
(
projectId
,
status
);
ResponseDetails
responseDetails
=
new
ResponseDetails
(
new
Date
(),
602
,
"Resources have been retrieved successfully"
,
"List of Resources for a project"
,
resourcesList
,
request
.
getRequestURI
(),
"Resource details"
,
null
);
return
new
ResponseEntity
<
ResponseDetails
>(
responseDetails
,
HttpStatus
.
OK
);
}
ResponseDetails
responseDetails
=
new
ResponseDetails
(
new
Date
(),
602
,
"Please provide ProjectId"
,
"List of Resources for a project"
,
null
,
request
.
getRequestURI
(),
"Resource details"
,
null
);
return
new
ResponseEntity
<
ResponseDetails
>(
responseDetails
,
HttpStatus
.
OK
);
}
//ok
///getMyProjectAllocations
@RequestMapping
(
value
=
"/resources/getMyProjectAllocations"
,
method
=
RequestMethod
.
GET
,
produces
=
MediaType
.
APPLICATION_JSON_VALUE
)
public
ResponseEntity
<?>
getMyProjectAllocations
(
@RequestParam
(
"employeeId"
)
String
employeeId
,
HttpServletRequest
request
)
throws
MyTeamException
{
if
(
employeeId
!=
null
&&
!
""
.
equalsIgnoreCase
(
employeeId
))
{
ResponseDetails
getRespDetails
=
new
ResponseDetails
(
new
Date
(),
604
,
"Retrieved the project allocations successfully"
,
"Projects allocations for an employee"
,
resourceAllocService
.
getWorkedProjectsForResource
(
employeeId
),
request
.
getRequestURI
(),
"Project details"
,
null
);
return
new
ResponseEntity
<
ResponseDetails
>(
getRespDetails
,
HttpStatus
.
OK
);
}
ResponseDetails
getRespDetails
=
new
ResponseDetails
(
new
Date
(),
606
,
"Please Provide valid employee id"
,
"Project allocations for an employee"
,
null
,
request
.
getRequestURI
(),
"Project details"
,
null
);
return
new
ResponseEntity
<
ResponseDetails
>(
getRespDetails
,
HttpStatus
.
OK
);
}
//ok
///resourceAllocation/projects has to be changed to /resourceAllocation/activeProjects
@RequestMapping
(
value
=
"/resources/projects"
,
method
=
RequestMethod
.
GET
,
produces
=
MediaType
.
APPLICATION_JSON_VALUE
)
public
ResponseEntity
<?>
getResourcesAllocatedForAllProjects
(
HttpServletRequest
request
)
throws
MyTeamException
{
List
<
ResourceAllocation
>
resourcesList
=
resourceAllocService
.
getAllResourcesForAllActiveProjects
();
ResponseDetails
responseDetails
=
new
ResponseDetails
(
new
Date
(),
602
,
"Resources have been retrieved successfully"
,
"List of Resources for the projects"
,
resourcesList
,
request
.
getRequestURI
(),
"Resource details"
,
null
);
return
new
ResponseEntity
<
ResponseDetails
>(
responseDetails
,
HttpStatus
.
OK
);
}
//ok //Getting Current active resource record
@RequestMapping
(
value
=
"/resources/employeeId/{employeeId}"
,
method
=
RequestMethod
.
GET
,
produces
=
MediaType
.
APPLICATION_JSON_VALUE
)
public
ResponseEntity
<?>
getResourcesSortByProjectStartDate
(
@PathVariable
(
value
=
"employeeId"
,
required
=
true
)
String
employeeId
,
HttpServletRequest
request
)
throws
MyTeamException
{
if
(
StringUtils
.
isNotBlank
(
employeeId
))
{
List
<
ResourceAllocation
>
resourcesList
=
resourceAllocService
.
getResourcesSortByBillingStartDate
(
employeeId
);
ResponseDetails
responseDetails
=
new
ResponseDetails
(
new
Date
(),
602
,
"Resources have been retrieved successfully"
,
"List of Resources for an employee"
,
resourcesList
,
request
.
getRequestURI
(),
"Resource List details"
,
null
);
return
new
ResponseEntity
<
ResponseDetails
>(
responseDetails
,
HttpStatus
.
OK
);
}
ResponseDetails
responseDetails
=
new
ResponseDetails
(
new
Date
(),
602
,
"Please provide the valid Employee Id"
,
"Employee Id is not valid"
,
null
,
request
.
getRequestURI
(),
"Resource details"
,
null
);
return
new
ResponseEntity
<
ResponseDetails
>(
responseDetails
,
HttpStatus
.
OK
);
}
//ok tested
@RequestMapping
(
value
=
"/resources/active"
,
method
=
RequestMethod
.
GET
,
produces
=
MediaType
.
APPLICATION_JSON_VALUE
)
public
ResponseEntity
<?>
getActiveResources
(
@RequestParam
(
value
=
"employeeId"
,
required
=
false
)
String
employeeId
,
HttpServletRequest
request
)
throws
MyTeamException
{
if
(
StringUtils
.
isNotBlank
(
employeeId
))
{
List
<
ResourceAllocation
>
employeesRoles
=
resourceAllocService
.
getActiveResources
(
employeeId
);
ResponseDetails
responseDetails
=
new
ResponseDetails
(
new
Date
(),
602
,
"Resources have been retrieved successfully"
,
"List of Resources who are active in the projects"
,
employeesRoles
,
request
.
getRequestURI
(),
"Resource List details"
,
null
);
return
new
ResponseEntity
<
ResponseDetails
>(
responseDetails
,
HttpStatus
.
OK
);
}
ResponseDetails
responseDetails
=
new
ResponseDetails
(
new
Date
(),
602
,
"Please provide the valid Employee Id"
,
"Employee Id is not valid"
,
null
,
request
.
getRequestURI
(),
"Resource details"
,
null
);
return
new
ResponseEntity
<
ResponseDetails
>(
responseDetails
,
HttpStatus
.
OK
);
}
//ok working
@RequestMapping
(
value
=
"/resources/deliverylead/{deliveryLeadId}"
,
method
=
RequestMethod
.
GET
,
produces
=
MediaType
.
APPLICATION_JSON_VALUE
)
public
ResponseEntity
<?>
getTeamDetails
(
@PathVariable
(
value
=
"deliveryLeadId"
,
required
=
true
)
String
deliveryLeadId
,
HttpServletRequest
request
)
throws
MyTeamException
{
if
(
StringUtils
.
isNotBlank
(
deliveryLeadId
))
{
List
<
ResourceAllocation
>
resourcesList
=
resourceAllocService
.
getResourcesUnderDeliveryLead
(
deliveryLeadId
);
ResponseDetails
responseDetails
=
new
ResponseDetails
(
new
Date
(),
602
,
"Resources have been retrieved successfully"
,
"List of Resources for a Delivery Lead"
,
resourcesList
,
request
.
getRequestURI
(),
"Resource details"
,
null
);
return
new
ResponseEntity
<
ResponseDetails
>(
responseDetails
,
HttpStatus
.
OK
);
}
ResponseDetails
responseDetails
=
new
ResponseDetails
(
new
Date
(),
602
,
"Please provide Valid Delivery Lead Id"
,
"List of Resources for DeliveryLead"
,
null
,
request
.
getRequestURI
(),
"Resource details"
,
null
);
return
new
ResponseEntity
<
ResponseDetails
>(
responseDetails
,
HttpStatus
.
OK
);
}
//ok tested working
@RequestMapping
(
value
=
"/resources/unAssignedEmployees"
,
method
=
RequestMethod
.
GET
,
produces
=
MediaType
.
APPLICATION_JSON_VALUE
)
public
ResponseEntity
<?>
getUnAssignedEmployees
(
HttpServletRequest
request
)
throws
MyTeamException
{
List
<
Employee
>
employeesList
=
resourceAllocService
.
getUnAssignedEmployees
();
ResponseDetails
responseDetails
=
new
ResponseDetails
(
new
Date
(),
602
,
"Resources have been retrieved successfully"
,
"List of Resources who are not assigned to project"
,
employeesList
,
request
.
getRequestURI
(),
"Resource details"
,
null
);
return
new
ResponseEntity
<
ResponseDetails
>(
responseDetails
,
HttpStatus
.
OK
);
}
//@RequestMapping(value = "/getEmployeeBillingDetailsAll"
@RequestMapping
(
value
=
"/resources/billing"
,
method
=
RequestMethod
.
GET
,
produces
=
MediaType
.
APPLICATION_JSON_VALUE
)
public
ResponseEntity
<
List
<
ResourceAllocation
>>
getAllBillingsForEmployee
(
@RequestParam
(
"employeeId"
)
String
employeeId
)
throws
MyTeamException
{
List
<
ResourceAllocation
>
resourceAllocList
=
resourceAllocService
.
getBillingsForEmployee
(
employeeId
);
return
new
ResponseEntity
<>(
resourceAllocList
,
HttpStatus
.
OK
);
}
// @RequestMapping(value = "/getEmployeeBillingDetails"
@RequestMapping
(
value
=
"/resources/billing/project/{projectId}"
,
method
=
RequestMethod
.
GET
,
produces
=
MediaType
.
APPLICATION_JSON_VALUE
)
public
ResponseEntity
<
List
<
ResourceAllocation
>>
getBillingsForProject
(
@PathVariable
(
"projectId"
)
String
projectId
,
@RequestParam
(
"employeeId"
)
String
employeeId
)
throws
MyTeamException
{
List
<
ResourceAllocation
>
resourceAllocList
=
resourceAllocService
.
getBillingsForProject
(
employeeId
,
projectId
);
return
new
ResponseEntity
<>(
resourceAllocList
,
HttpStatus
.
OK
);
}
// @RequestMapping(value = "/resources/shifts/{shift}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
// public ResponseEntity<?> getResourcesForShift(@PathVariable(value = "shift", required = true) String shift, HttpServletRequest request)
// throws MyTeamException {
//
// if (StringUtils.isNotBlank(shift)) {
// List<Resource> resourcesList = resourceService.getResourcesForShift(shift);
// ResponseDetails responseDetails = new ResponseDetails(new Date(), 602, "Resources have been retrieved successfully",
// "List of Resources for the provided shift", resourcesList, request.getRequestURI(), "Resource List for shift", null);
// return new ResponseEntity<ResponseDetails>(responseDetails, HttpStatus.OK);
// }
// ResponseDetails responseDetails = new ResponseDetails(new Date(), 602, "Please provide the valid Shift value",
// "List of Resources for the provided shift", null, request.getRequestURI(), "Resource details", null);
// return new ResponseEntity<ResponseDetails>(responseDetails, HttpStatus.OK);
//
// }
// @RequestMapping(value = "/resourceAllocation/addEmployeeToTeamWithCheck", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
// public ResponseEntity<?> addEmployeeToTeamWithCheck(@RequestBody ResourceAllocation resourceReq,
// @RequestParam(value = "loginEmpId") String loginEmpId, HttpServletRequest request) throws MyTeamException {
//
// if (StringUtils.isNotBlank(loginEmpId)) {
// HashMap<String, Object> responseMap = resourceAllocService.verifyResourceAssignedToAnyProject(resourceReq, loginEmpId);
//
// ResponseDetails responseDetails = new ResponseDetails(new Date(), 602, responseMap.get("message").toString(),
// "List of Resources for dashboard", responseMap.get("resourceObj"), request.getRequestURI(), "Resource details", null);
// return new ResponseEntity<ResponseDetails>(responseDetails, HttpStatus.OK);
// }
// ResponseDetails responseDetails = new ResponseDetails(new Date(), 602, "Please provide Valid Employee Id",
// "Verification of resource in Bench Project", null, request.getRequestURI(), "Resource details", resourceReq);
// return new ResponseEntity<ResponseDetails>(responseDetails, HttpStatus.OK);
//
// }
}
src/main/java/com/nisum/myteam/controller/ResourceController.java
View file @
22239759
package
com
.
nisum
.
myteam
.
controller
;
//package com.nisum.myteam.controller;
//
import
com.nisum.myteam.exception.handler.MyTeamException
;
//import com.nisum.myteam.exception.handler.MyTeamException;
import
com.nisum.myteam.exception.handler.ResponseDetails
;
//import com.nisum.myteam.exception.handler.ResponseDetails;
import
com.nisum.myteam.model.dao.Employee
;
//import com.nisum.myteam.model.dao.Employee;
import
com.nisum.myteam.model.dao.EmployeeVisa
;
//import com.nisum.myteam.model.dao.EmployeeVisa;
import
com.nisum.myteam.model.dao.Resource
;
//import com.nisum.myteam.model.dao.Resource;
import
com.nisum.myteam.model.vo.EmployeeDashboardVO
;
//import com.nisum.myteam.model.vo.EmployeeDashboardVO;
import
com.nisum.myteam.repository.EmployeeVisaRepo
;
//import com.nisum.myteam.repository.EmployeeVisaRepo;
import
com.nisum.myteam.service.IEmployeeService
;
//import com.nisum.myteam.service.IEmployeeService;
import
com.nisum.myteam.service.IProjectService
;
//import com.nisum.myteam.service.IProjectService;
import
com.nisum.myteam.service.IResourceService
;
//import com.nisum.myteam.service.IResourceService;
import
com.nisum.myteam.utils.MyTeamUtils
;
//import com.nisum.myteam.utils.MyTeamUtils;
import
org.apache.commons.lang3.StringUtils
;
//import org.apache.commons.lang3.StringUtils;
import
org.springframework.beans.factory.annotation.Autowired
;
//import org.springframework.beans.factory.annotation.Autowired;
import
org.springframework.http.HttpStatus
;
//import org.springframework.http.HttpStatus;
import
org.springframework.http.MediaType
;
//import org.springframework.http.MediaType;
import
org.springframework.http.ResponseEntity
;
//import org.springframework.http.ResponseEntity;
import
org.springframework.web.bind.annotation.*
;
//import org.springframework.web.bind.annotation.*;
//
import
javax.servlet.http.HttpServletRequest
;
//import javax.servlet.http.HttpServletRequest;
import
java.util.ArrayList
;
//import java.util.ArrayList;
import
java.util.Date
;
//import java.util.Date;
import
java.util.HashMap
;
//import java.util.HashMap;
import
java.util.List
;
//import java.util.List;
import
java.util.stream.Collectors
;
//import java.util.stream.Collectors;
//
@RestController
//@RestController
@RequestMapping
//@RequestMapping
public
class
ResourceController
{
//public class ResourceController {
//
@Autowired
// @Autowired
private
IEmployeeService
employeeService
;
// private IEmployeeService employeeService;
//
@Autowired
// @Autowired
private
IProjectService
projectService
;
// private IProjectService projectService;
//
@Autowired
// @Autowired
private
EmployeeVisaRepo
employeeVisaRepo
;
// private EmployeeVisaRepo employeeVisaRepo;
//
@Autowired
// @Autowired
private
IResourceService
resourceService
;
// private IResourceService resourceService;
//
//
@RequestMapping
(
value
=
"/resources"
,
method
=
RequestMethod
.
POST
,
produces
=
MediaType
.
APPLICATION_JSON_VALUE
,
consumes
=
MediaType
.
APPLICATION_JSON_VALUE
)
//
public
ResponseEntity
<?>
createResource
(
@RequestBody
Resource
resourceReq
,
// @RequestMapping(value = "/resources", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
@RequestParam
(
value
=
"loginEmpId"
,
required
=
true
)
String
loginEmpId
,
HttpServletRequest
request
)
throws
MyTeamException
{
// public ResponseEntity<?> createResource(@RequestBody Resource resourceReq,
if
(
StringUtils
.
isNotBlank
(
loginEmpId
))
{
// @RequestParam(value = "loginEmpId", required = true) String loginEmpId, HttpServletRequest request) throws MyTeamException {
resourceReq
.
setActive
(
true
);
// if (StringUtils.isNotBlank(loginEmpId)) {
resourceReq
.
setAuditFields
(
loginEmpId
,
MyTeamUtils
.
CREATE
);
// resourceReq.setActive(true);
Resource
resourcePersisted
=
resourceService
.
addResource
(
resourceReq
,
loginEmpId
);
// resourceReq.setAuditFields(loginEmpId, MyTeamUtils.CREATE);
// Resource resourcePersisted = resourceService.addResource(resourceReq, loginEmpId);
ResponseDetails
createResponseDetails
=
new
ResponseDetails
(
new
Date
(),
601
,
"Resource has been created"
,
//
"Resource description"
,
null
,
request
.
getContextPath
(),
"details"
,
resourcePersisted
);
// ResponseDetails createResponseDetails = new ResponseDetails(new Date(), 601, "Resource has been created",
return
new
ResponseEntity
<
ResponseDetails
>(
createResponseDetails
,
HttpStatus
.
OK
);
// "Resource description", null, request.getContextPath(), "details", resourcePersisted);
}
// return new ResponseEntity<ResponseDetails>(createResponseDetails, HttpStatus.OK);
// }
ResponseDetails
responseDetails
=
new
ResponseDetails
(
new
Date
(),
602
,
"Please provide the valid Employee Id"
,
//
"Employee Id is not valid"
,
null
,
request
.
getRequestURI
(),
"Resource details"
,
resourceReq
);
// ResponseDetails responseDetails = new ResponseDetails(new Date(), 602, "Please provide the valid Employee Id",
return
new
ResponseEntity
<
ResponseDetails
>(
responseDetails
,
HttpStatus
.
OK
);
// "Employee Id is not valid", null, request.getRequestURI(), "Resource details", resourceReq);
// return new ResponseEntity<ResponseDetails>(responseDetails, HttpStatus.OK);
}
//
// }
@RequestMapping
(
value
=
"/resources"
,
method
=
RequestMethod
.
PUT
,
produces
=
MediaType
.
APPLICATION_JSON_VALUE
,
consumes
=
MediaType
.
APPLICATION_JSON_VALUE
)
//
public
ResponseEntity
<?>
updateResource
(
@RequestBody
Resource
resourceReq
,
// @RequestMapping(value = "/resources", method = RequestMethod.PUT, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
@RequestParam
(
value
=
"loginEmpId"
)
String
loginEmpId
,
HttpServletRequest
request
)
throws
MyTeamException
{
// public ResponseEntity<?> updateResource(@RequestBody Resource resourceReq,
// @RequestParam(value = "loginEmpId") String loginEmpId, HttpServletRequest request) throws MyTeamException {
if
(
StringUtils
.
isNotBlank
(
loginEmpId
))
{
//
resourceReq
.
setAuditFields
(
loginEmpId
,
MyTeamUtils
.
UPDATE
);
// if (StringUtils.isNotBlank(loginEmpId)) {
String
responseMessage
=
resourceService
.
updateResource
(
resourceReq
,
loginEmpId
);
// resourceReq.setAuditFields(loginEmpId, MyTeamUtils.UPDATE);
ResponseDetails
createResponseDetails
=
new
ResponseDetails
(
new
Date
(),
601
,
responseMessage
,
// String responseMessage = resourceService.updateResource(resourceReq, loginEmpId);
"Resource description"
,
null
,
request
.
getContextPath
(),
"Resource details"
,
resourceReq
);
// ResponseDetails createResponseDetails = new ResponseDetails(new Date(), 601, responseMessage,
return
new
ResponseEntity
<
ResponseDetails
>(
createResponseDetails
,
HttpStatus
.
OK
);
// "Resource description", null, request.getContextPath(), "Resource details", resourceReq);
}
// return new ResponseEntity<ResponseDetails>(createResponseDetails, HttpStatus.OK);
ResponseDetails
responseDetails
=
new
ResponseDetails
(
new
Date
(),
602
,
"Please provide the valid Employee Id"
,
// }
"Employee Id is not valid"
,
null
,
request
.
getRequestURI
(),
"Resource details"
,
resourceReq
);
// ResponseDetails responseDetails = new ResponseDetails(new Date(), 602, "Please provide the valid Employee Id",
return
new
ResponseEntity
<
ResponseDetails
>(
responseDetails
,
HttpStatus
.
OK
);
// "Employee Id is not valid", null, request.getRequestURI(), "Resource details", resourceReq);
}
// return new ResponseEntity<ResponseDetails>(responseDetails, HttpStatus.OK);
// }
@RequestMapping
(
value
=
"/resources"
,
method
=
RequestMethod
.
DELETE
,
produces
=
MediaType
.
APPLICATION_JSON_VALUE
,
consumes
=
MediaType
.
APPLICATION_JSON_VALUE
)
//
public
ResponseEntity
<?>
deleteResource
(
@RequestBody
Resource
resourceReq
,
// @RequestMapping(value = "/resources", method = RequestMethod.DELETE, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
@RequestParam
(
value
=
"loginEmpId"
,
required
=
true
)
String
loginEmpId
,
HttpServletRequest
request
)
throws
MyTeamException
{
// public ResponseEntity<?> deleteResource(@RequestBody Resource resourceReq,
if
(
StringUtils
.
isNotBlank
(
loginEmpId
))
{
// @RequestParam(value = "loginEmpId", required = true) String loginEmpId, HttpServletRequest request) throws MyTeamException {
Resource
resourceDeleted
=
resourceService
.
deleteResource
(
resourceReq
.
getEmployeeId
(),
resourceReq
.
getProjectId
(),
resourceReq
.
getId
(),
loginEmpId
);
// if (StringUtils.isNotBlank(loginEmpId)) {
// Resource resourceDeleted = resourceService.deleteResource(resourceReq.getEmployeeId(), resourceReq.getProjectId(), resourceReq.getId(), loginEmpId);
ResponseDetails
createResponseDetails
=
new
ResponseDetails
(
new
Date
(),
601
,
"Resource has been deleted"
,
//
"Resource description"
,
null
,
request
.
getContextPath
(),
"Resource details"
,
resourceDeleted
);
// ResponseDetails createResponseDetails = new ResponseDetails(new Date(), 601, "Resource has been deleted",
return
new
ResponseEntity
<
ResponseDetails
>(
createResponseDetails
,
HttpStatus
.
OK
);
// "Resource description", null, request.getContextPath(), "Resource details", resourceDeleted);
}
// return new ResponseEntity<ResponseDetails>(createResponseDetails, HttpStatus.OK);
// }
ResponseDetails
responseDetails
=
new
ResponseDetails
(
new
Date
(),
602
,
"Please provide the valid Employee Id"
,
//
"Employee Id is not valid"
,
null
,
request
.
getRequestURI
(),
"Resource details"
,
resourceReq
);
// ResponseDetails responseDetails = new ResponseDetails(new Date(), 602, "Please provide the valid Employee Id",
return
new
ResponseEntity
<
ResponseDetails
>(
responseDetails
,
HttpStatus
.
OK
);
// "Employee Id is not valid", null, request.getRequestURI(), "Resource details", resourceReq);
}
// return new ResponseEntity<ResponseDetails>(responseDetails, HttpStatus.OK);
// }
@RequestMapping
(
value
=
"/resources/employeeId/{employeeId}"
,
method
=
RequestMethod
.
GET
,
produces
=
MediaType
.
APPLICATION_JSON_VALUE
)
//
public
ResponseEntity
<?>
getResourcesSortByStartDate
(
@PathVariable
(
value
=
"employeeId"
,
required
=
true
)
String
employeeId
,
HttpServletRequest
request
)
// @RequestMapping(value = "/resources/employeeId/{employeeId}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
throws
MyTeamException
{
// public ResponseEntity<?> getResourcesSortByStartDate(@PathVariable(value = "employeeId", required = true) String employeeId, HttpServletRequest request)
// throws MyTeamException {
if
(
StringUtils
.
isNotBlank
(
employeeId
))
{
//
List
<
Resource
>
resourcesList
=
resourceService
.
getResourcesSortByStartDate
(
employeeId
);
// if (StringUtils.isNotBlank(employeeId)) {
ResponseDetails
responseDetails
=
new
ResponseDetails
(
new
Date
(),
602
,
"Resources have been retrieved successfully"
,
// List<Resource> resourcesList = resourceService.getResourcesSortByStartDate(employeeId);
"List of Resources for an employee"
,
resourcesList
,
request
.
getRequestURI
(),
"Resource List details"
,
null
);
// ResponseDetails responseDetails = new ResponseDetails(new Date(), 602, "Resources have been retrieved successfully",
return
new
ResponseEntity
<
ResponseDetails
>(
responseDetails
,
HttpStatus
.
OK
);
// "List of Resources for an employee", resourcesList, request.getRequestURI(), "Resource List details", null);
}
// return new ResponseEntity<ResponseDetails>(responseDetails, HttpStatus.OK);
// }
ResponseDetails
responseDetails
=
new
ResponseDetails
(
new
Date
(),
602
,
"Please provide the valid Employee Id"
,
//
"Employee Id is not valid"
,
null
,
request
.
getRequestURI
(),
"Resource details"
,
null
);
// ResponseDetails responseDetails = new ResponseDetails(new Date(), 602, "Please provide the valid Employee Id",
return
new
ResponseEntity
<
ResponseDetails
>(
responseDetails
,
HttpStatus
.
OK
);
// "Employee Id is not valid", null, request.getRequestURI(), "Resource details", null);
// return new ResponseEntity<ResponseDetails>(responseDetails, HttpStatus.OK);
}
//
// }
@RequestMapping
(
value
=
"/resources/active"
,
method
=
RequestMethod
.
GET
,
produces
=
MediaType
.
APPLICATION_JSON_VALUE
)
//
public
ResponseEntity
<?>
getActiveResources
(
@RequestParam
(
value
=
"employeeId"
,
required
=
false
)
String
employeeId
,
HttpServletRequest
request
)
// @RequestMapping(value = "/resources/active", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
throws
MyTeamException
{
// public ResponseEntity<?> getActiveResources(@RequestParam(value = "employeeId", required = false) String employeeId, HttpServletRequest request)
if
(
StringUtils
.
isNotBlank
(
employeeId
))
{
// throws MyTeamException {
List
<
Resource
>
employeesRoles
=
resourceService
.
getActiveResources
(
employeeId
);
// if (StringUtils.isNotBlank(employeeId)) {
// List<Resource> employeesRoles = resourceService.getActiveResources(employeeId);
ResponseDetails
responseDetails
=
new
ResponseDetails
(
new
Date
(),
602
,
"Resources have been retrieved successfully"
,
//
"List of Resources who are active in the projects"
,
employeesRoles
,
request
.
getRequestURI
(),
"Resource List details"
,
null
);
// ResponseDetails responseDetails = new ResponseDetails(new Date(), 602, "Resources have been retrieved successfully",
return
new
ResponseEntity
<
ResponseDetails
>(
responseDetails
,
HttpStatus
.
OK
);
// "List of Resources who are active in the projects", employeesRoles, request.getRequestURI(), "Resource List details", null);
// return new ResponseEntity<ResponseDetails>(responseDetails, HttpStatus.OK);
}
//
ResponseDetails
responseDetails
=
new
ResponseDetails
(
new
Date
(),
602
,
"Please provide the valid Employee Id"
,
// }
"Employee Id is not valid"
,
null
,
request
.
getRequestURI
(),
"Resource details"
,
null
);
// ResponseDetails responseDetails = new ResponseDetails(new Date(), 602, "Please provide the valid Employee Id",
return
new
ResponseEntity
<
ResponseDetails
>(
responseDetails
,
HttpStatus
.
OK
);
// "Employee Id is not valid", null, request.getRequestURI(), "Resource details", null);
}
// return new ResponseEntity<ResponseDetails>(responseDetails, HttpStatus.OK);
// }
//
@RequestMapping
(
value
=
"/resources/shifts/{shift}"
,
method
=
RequestMethod
.
GET
,
produces
=
MediaType
.
APPLICATION_JSON_VALUE
)
//
public
ResponseEntity
<?>
getResourcesForShift
(
@PathVariable
(
value
=
"shift"
,
required
=
true
)
String
shift
,
HttpServletRequest
request
)
// @RequestMapping(value = "/resources/shifts/{shift}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
throws
MyTeamException
{
// public ResponseEntity<?> getResourcesForShift(@PathVariable(value = "shift", required = true) String shift, HttpServletRequest request)
// throws MyTeamException {
if
(
StringUtils
.
isNotBlank
(
shift
))
{
//
List
<
Resource
>
resourcesList
=
resourceService
.
getResourcesForShift
(
shift
);
// if (StringUtils.isNotBlank(shift)) {
ResponseDetails
responseDetails
=
new
ResponseDetails
(
new
Date
(),
602
,
"Resources have been retrieved successfully"
,
// List<Resource> resourcesList = resourceService.getResourcesForShift(shift);
"List of Resources for the provided shift"
,
resourcesList
,
request
.
getRequestURI
(),
"Resource List for shift"
,
null
);
// ResponseDetails responseDetails = new ResponseDetails(new Date(), 602, "Resources have been retrieved successfully",
return
new
ResponseEntity
<
ResponseDetails
>(
responseDetails
,
HttpStatus
.
OK
);
// "List of Resources for the provided shift", resourcesList, request.getRequestURI(), "Resource List for shift", null);
}
// return new ResponseEntity<ResponseDetails>(responseDetails, HttpStatus.OK);
ResponseDetails
responseDetails
=
new
ResponseDetails
(
new
Date
(),
602
,
"Please provide the valid Shift value"
,
// }
"List of Resources for the provided shift"
,
null
,
request
.
getRequestURI
(),
"Resource details"
,
null
);
// ResponseDetails responseDetails = new ResponseDetails(new Date(), 602, "Please provide the valid Shift value",
return
new
ResponseEntity
<
ResponseDetails
>(
responseDetails
,
HttpStatus
.
OK
);
// "List of Resources for the provided shift", null, request.getRequestURI(), "Resource details", null);
// return new ResponseEntity<ResponseDetails>(responseDetails, HttpStatus.OK);
}
//
// }
@RequestMapping
(
value
=
"/resources/projects"
,
method
=
RequestMethod
.
GET
,
produces
=
MediaType
.
APPLICATION_JSON_VALUE
)
//
public
ResponseEntity
<?>
getResourcesAllocatedForAllProjects
(
HttpServletRequest
request
)
throws
MyTeamException
{
// @RequestMapping(value = "/resources/projects", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
// public ResponseEntity<?> getResourcesAllocatedForAllProjects(HttpServletRequest request) throws MyTeamException {
List
<
Resource
>
resourcesList
=
resourceService
.
getResourcesForActiveProjects
();
//
ResponseDetails
responseDetails
=
new
ResponseDetails
(
new
Date
(),
602
,
"Resources have been retrieved successfully"
,
// List<Resource> resourcesList = resourceService.getResourcesForActiveProjects();
"List of Resources for the projects"
,
resourcesList
,
request
.
getRequestURI
(),
"Resource details"
,
null
);
// ResponseDetails responseDetails = new ResponseDetails(new Date(), 602, "Resources have been retrieved successfully",
return
new
ResponseEntity
<
ResponseDetails
>(
responseDetails
,
HttpStatus
.
OK
);
// "List of Resources for the projects", resourcesList, request.getRequestURI(), "Resource details", null);
// return new ResponseEntity<ResponseDetails>(responseDetails, HttpStatus.OK);
}
//
// }
@RequestMapping
(
value
=
"/resources/project/{projectId}"
,
method
=
RequestMethod
.
GET
,
produces
=
MediaType
.
APPLICATION_JSON_VALUE
)
//
public
ResponseEntity
<?>
getResourcesForProject
(
@PathVariable
(
value
=
"projectId"
,
required
=
true
)
String
projectId
,
// @RequestMapping(value = "/resources/project/{projectId}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
@RequestParam
(
value
=
"status"
,
required
=
false
,
defaultValue
=
MyTeamUtils
.
ACTIVE
)
String
status
,
// public ResponseEntity<?> getResourcesForProject(@PathVariable(value = "projectId", required = true) String projectId,
HttpServletRequest
request
)
// @RequestParam(value = "status", required = false, defaultValue = MyTeamUtils.ACTIVE) String status,
throws
MyTeamException
{
// HttpServletRequest request)
// throws MyTeamException {
if
(
StringUtils
.
isNotBlank
(
projectId
))
{
//
List
<
Resource
>
resourcesList
=
resourceService
.
getResourcesForProject
(
projectId
,
status
);
// if (StringUtils.isNotBlank(projectId)) {
ResponseDetails
responseDetails
=
new
ResponseDetails
(
new
Date
(),
602
,
"Resources have been retrieved successfully"
,
// List<Resource> resourcesList = resourceService.getResourcesForProject(projectId, status);
"List of Resources for a project"
,
resourcesList
,
request
.
getRequestURI
(),
"Resource details"
,
null
);
// ResponseDetails responseDetails = new ResponseDetails(new Date(), 602, "Resources have been retrieved successfully",
return
new
ResponseEntity
<
ResponseDetails
>(
responseDetails
,
HttpStatus
.
OK
);
// "List of Resources for a project", resourcesList, request.getRequestURI(), "Resource details", null);
// return new ResponseEntity<ResponseDetails>(responseDetails, HttpStatus.OK);
}
//
ResponseDetails
responseDetails
=
new
ResponseDetails
(
new
Date
(),
602
,
"Please provide ProjectId"
,
// }
"List of Resources for a project"
,
null
,
request
.
getRequestURI
(),
"Resource details"
,
null
);
// ResponseDetails responseDetails = new ResponseDetails(new Date(), 602, "Please provide ProjectId",
return
new
ResponseEntity
<
ResponseDetails
>(
responseDetails
,
HttpStatus
.
OK
);
// "List of Resources for a project", null, request.getRequestURI(), "Resource details", null);
}
// return new ResponseEntity<ResponseDetails>(responseDetails, HttpStatus.OK);
// }
//
@RequestMapping
(
value
=
"/resources/deliverylead/{deliveryLeadId}"
,
method
=
RequestMethod
.
GET
,
produces
=
MediaType
.
APPLICATION_JSON_VALUE
)
//
public
ResponseEntity
<?>
getTeamDetails
(
@PathVariable
(
value
=
"deliveryLeadId"
,
required
=
true
)
String
deliveryLeadId
,
HttpServletRequest
request
)
// @RequestMapping(value = "/resources/deliverylead/{deliveryLeadId}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
throws
MyTeamException
{
// public ResponseEntity<?> getTeamDetails(@PathVariable(value = "deliveryLeadId", required = true) String deliveryLeadId, HttpServletRequest request)
// throws MyTeamException {
if
(
StringUtils
.
isNotBlank
(
deliveryLeadId
))
{
//
List
<
Resource
>
resourcesList
=
resourceService
.
getResourcesUnderDeliveryLead
(
deliveryLeadId
);
// if (StringUtils.isNotBlank(deliveryLeadId)) {
// List<Resource> resourcesList = resourceService.getResourcesUnderDeliveryLead(deliveryLeadId);
ResponseDetails
responseDetails
=
new
ResponseDetails
(
new
Date
(),
602
,
"Resources have been retrieved successfully"
,
//
"List of Resources for a project"
,
resourcesList
,
request
.
getRequestURI
(),
"Resource details"
,
null
);
// ResponseDetails responseDetails = new ResponseDetails(new Date(), 602, "Resources have been retrieved successfully",
}
// "List of Resources for a project", resourcesList, request.getRequestURI(), "Resource details", null);
// }
ResponseDetails
responseDetails
=
new
ResponseDetails
(
new
Date
(),
602
,
"Please provide Valid Delivery Lead Id"
,
//
"List of Resources for DeliveryLead"
,
null
,
request
.
getRequestURI
(),
"Resource details"
,
null
);
// ResponseDetails responseDetails = new ResponseDetails(new Date(), 602, "Please provide Valid Delivery Lead Id",
return
new
ResponseEntity
<
ResponseDetails
>(
responseDetails
,
HttpStatus
.
OK
);
// "List of Resources for DeliveryLead", null, request.getRequestURI(), "Resource details", null);
// return new ResponseEntity<ResponseDetails>(responseDetails, HttpStatus.OK);
}
//
// }
//
@RequestMapping
(
value
=
"resources/unAssignedEmployees"
,
method
=
RequestMethod
.
GET
,
produces
=
MediaType
.
APPLICATION_JSON_VALUE
)
//
public
ResponseEntity
<?>
getUnAssignedEmployees
(
HttpServletRequest
request
)
throws
MyTeamException
{
//// @RequestMapping(value = "resources/unAssignedEmployees", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
List
<
Employee
>
employeesList
=
projectService
.
getUnAssignedEmployees
();
//// public ResponseEntity<?> getUnAssignedEmployees(HttpServletRequest request) throws MyTeamException {
//// List<Employee> employeesList = projectService.getUnAssignedEmployees();
ResponseDetails
responseDetails
=
new
ResponseDetails
(
new
Date
(),
602
,
"Resources have been retrieved successfully"
,
////
"List of Resources who are not assigned to project"
,
employeesList
,
request
.
getRequestURI
(),
"Resource details"
,
null
);
//// ResponseDetails responseDetails = new ResponseDetails(new Date(), 602, "Resources have been retrieved successfully",
return
new
ResponseEntity
<
ResponseDetails
>(
responseDetails
,
HttpStatus
.
OK
);
//// "List of Resources who are not assigned to project", employeesList, request.getRequestURI(), "Resource details", null);
}
//// return new ResponseEntity<ResponseDetails>(responseDetails, HttpStatus.OK);
//// }
////
@RequestMapping
(
value
=
"/getEmployeesDashBoard"
,
method
=
RequestMethod
.
GET
,
produces
=
MediaType
.
APPLICATION_JSON_VALUE
)
////
public
ResponseEntity
<?>
getEmployeesDashBoard
(
HttpServletRequest
request
)
throws
MyTeamException
{
//// @RequestMapping(value = "/resources/getEmployeesDashBoard", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
List
<
EmployeeDashboardVO
>
employeeDashBoardList
=
projectService
.
getEmployeesDashBoard
();
//// public ResponseEntity<?> getEmployeesDashBoard(HttpServletRequest request) throws MyTeamException {
//// List<EmployeeDashboardVO> employeeDashBoardList = projectService.getEmployeesDashBoard();
ResponseDetails
responseDetails
=
new
ResponseDetails
(
new
Date
(),
602
,
"Resources have been retrieved successfully"
,
////
"List of Resources for dashboard"
,
employeeDashBoardList
,
request
.
getRequestURI
(),
"Resource details"
,
null
);
//// ResponseDetails responseDetails = new ResponseDetails(new Date(), 602, "Resources have been retrieved successfully",
return
new
ResponseEntity
<
ResponseDetails
>(
responseDetails
,
HttpStatus
.
OK
);
//// "List of Resources for dashboard", employeeDashBoardList, request.getRequestURI(), "Resource details", null);
}
//// return new ResponseEntity<ResponseDetails>(responseDetails, HttpStatus.OK);
//// }
@RequestMapping
(
value
=
"/getEmployeesHavingVisa"
,
method
=
RequestMethod
.
GET
,
produces
=
MediaType
.
APPLICATION_JSON_VALUE
)
//
public
ResponseEntity
<?>
getEmployeesHavingVisa
(
@RequestParam
(
"visa"
)
String
passport
,
HttpServletRequest
request
)
//
throws
MyTeamException
{
// @RequestMapping(value = "resources/addEmployeeToTeamWithCheck", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
List
<
Employee
>
employees
=
new
ArrayList
<>();
// public ResponseEntity<?> addEmployeeToTeamWithCheck(@RequestBody Resource resourceReq,
// @RequestParam(value = "loginEmpId") String loginEmpId, HttpServletRequest request) throws MyTeamException {
if
(
passport
!=
null
&&
!
"passport"
.
equalsIgnoreCase
(
passport
))
{
//
// if (StringUtils.isNotBlank(loginEmpId)) {
List
<
EmployeeVisa
>
employeeVisas
=
employeeVisaRepo
.
findByVisaName
(
passport
);
// HashMap<String, Object> responseMap = resourceService.verifyResourceAssignedToAnyProject(resourceReq, loginEmpId);
//
List
<
String
>
employeeIds
=
null
;
// ResponseDetails responseDetails = new ResponseDetails(new Date(), 602, responseMap.get("message").toString(),
if
(
employeeVisas
!=
null
)
{
// "List of Resources for dashboard", responseMap.get("resourceObj"), request.getRequestURI(), "Resource details", null);
employeeIds
=
employeeVisas
.
stream
().
map
(
EmployeeVisa:
:
getEmployeeId
).
collect
(
Collectors
.
toList
());
// return new ResponseEntity<ResponseDetails>(responseDetails, HttpStatus.OK);
}
// }
if
(
employeeIds
!=
null
&&
!
employeeIds
.
isEmpty
())
{
// ResponseDetails responseDetails = new ResponseDetails(new Date(), 602, "Please provide Valid Employee Id",
List
<
Employee
>
emps
=
employeeService
.
getActiveEmployees
();
// "Verification of resource in Bench Project", null, request.getRequestURI(), "Resource details", resourceReq);
for
(
Employee
emp
:
emps
)
{
// return new ResponseEntity<ResponseDetails>(responseDetails, HttpStatus.OK);
if
(
employeeIds
.
contains
(
emp
.
getEmployeeId
()))
{
//
employees
.
add
(
emp
);
// }
}
//
}
//}
}
}
else
{
if
(
employeeService
.
getActiveEmployees
()
!=
null
)
{
employees
=
employeeService
.
getActiveEmployees
().
stream
()
.
sorted
((
o1
,
o2
)
->
o1
.
getEmployeeName
().
compareTo
(
o2
.
getEmployeeName
()))
.
collect
(
Collectors
.
toList
());
}
}
ResponseDetails
responseDetails
=
new
ResponseDetails
(
new
Date
(),
602
,
"Resources have been retrieved successfully"
,
"List of Resources who has visa"
,
employees
,
request
.
getRequestURI
(),
"Resource details"
,
null
);
return
new
ResponseEntity
<
ResponseDetails
>(
responseDetails
,
HttpStatus
.
OK
);
}
@RequestMapping
(
value
=
"/addEmployeeToTeamWithCheck"
,
method
=
RequestMethod
.
POST
,
produces
=
MediaType
.
APPLICATION_JSON_VALUE
,
consumes
=
MediaType
.
APPLICATION_JSON_VALUE
)
public
ResponseEntity
<?>
addEmployeeToTeamWithCheck
(
@RequestBody
Resource
resourceReq
,
@RequestParam
(
value
=
"loginEmpId"
)
String
loginEmpId
,
HttpServletRequest
request
)
throws
MyTeamException
{
if
(
StringUtils
.
isNotBlank
(
loginEmpId
))
{
HashMap
<
String
,
Object
>
responseMap
=
projectService
.
addProjectTeamMateWithCheck
(
resourceReq
,
loginEmpId
);
ResponseDetails
responseDetails
=
new
ResponseDetails
(
new
Date
(),
602
,
responseMap
.
get
(
"message"
).
toString
(),
"List of Resources for dashboard"
,
responseMap
.
get
(
"resourceObj"
),
request
.
getRequestURI
(),
"Resource details"
,
null
);
return
new
ResponseEntity
<
ResponseDetails
>(
responseDetails
,
HttpStatus
.
OK
);
}
ResponseDetails
responseDetails
=
new
ResponseDetails
(
new
Date
(),
602
,
"Please provide Valid Employee Id"
,
"Verification of resource in Bench Project"
,
null
,
request
.
getRequestURI
(),
"Resource details"
,
resourceReq
);
return
new
ResponseEntity
<
ResponseDetails
>(
responseDetails
,
HttpStatus
.
OK
);
}
}
src/main/java/com/nisum/myteam/model/dao/Employee.java
View file @
22239759
...
@@ -7,6 +7,7 @@ import javax.validation.constraints.NotNull;
...
@@ -7,6 +7,7 @@ import javax.validation.constraints.NotNull;
import
javax.validation.constraints.Pattern
;
import
javax.validation.constraints.Pattern
;
import
javax.validation.constraints.Size
;
import
javax.validation.constraints.Size
;
import
org.bson.types.ObjectId
;
import
org.hibernate.validator.constraints.Email
;
import
org.hibernate.validator.constraints.Email
;
import
org.hibernate.validator.constraints.NotBlank
;
import
org.hibernate.validator.constraints.NotBlank
;
import
org.springframework.data.annotation.Id
;
import
org.springframework.data.annotation.Id
;
...
@@ -31,7 +32,7 @@ public class Employee implements Serializable {
...
@@ -31,7 +32,7 @@ public class Employee implements Serializable {
private
static
final
long
serialVersionUID
=
1L
;
private
static
final
long
serialVersionUID
=
1L
;
@Id
@Id
private
String
id
;
private
ObjectId
id
;
@NotBlank
(
message
=
"Employee Id cannot be blank"
)
@NotBlank
(
message
=
"Employee Id cannot be blank"
)
...
...
src/main/java/com/nisum/myteam/model/dao/Project.java
View file @
22239759
...
@@ -32,7 +32,6 @@ public class Project extends AuditFields implements Serializable {
...
@@ -32,7 +32,6 @@ public class Project extends AuditFields implements Serializable {
private
String
projectId
;
private
String
projectId
;
private
String
projectName
;
private
String
projectName
;
private
String
domainId
;
private
String
domainId
;
private
String
domain
;
private
String
accountId
;
private
String
accountId
;
private
String
status
;
private
String
status
;
private
List
<
String
>
employeeIds
;
private
List
<
String
>
employeeIds
;
...
...
src/main/java/com/nisum/myteam/model/dao/ResourceAllocation.java
0 → 100644
View file @
22239759
package
com
.
nisum
.
myteam
.
model
.
dao
;
import
com.nisum.myteam.model.AuditFields
;
import
lombok.*
;
import
org.bson.types.ObjectId
;
import
org.springframework.data.annotation.Id
;
import
org.springframework.data.mongodb.core.mapping.Document
;
import
org.springframework.format.annotation.DateTimeFormat
;
import
org.springframework.format.annotation.DateTimeFormat.ISO
;
import
java.io.Serializable
;
import
java.util.Date
;
@Setter
@Getter
@AllArgsConstructor
@NoArgsConstructor
@ToString
@Document
(
collection
=
"resourceAllocation"
)
public
class
ResourceAllocation
extends
AuditFields
implements
Serializable
{
private
static
final
long
serialVersionUID
=
1L
;
@Id
private
ObjectId
id
;
private
String
employeeId
;
private
String
projectId
;
@DateTimeFormat
(
iso
=
ISO
.
DATE
)
private
String
billableStatus
;
@DateTimeFormat
(
iso
=
ISO
.
DATE
,
pattern
=
"yyyy-MM-dd'T'HH:mm:ss.SSSX"
)
private
Date
billingStartDate
;
@DateTimeFormat
(
iso
=
ISO
.
DATE
,
pattern
=
"yyyy-MM-dd'T'HH:mm:ss.SSSX"
)
private
Date
billingEndDate
;
private
String
resourceRole
;
}
src/main/java/com/nisum/myteam/model/vo/MyProjectAllocationVO.java
0 → 100644
View file @
22239759
package
com
.
nisum
.
myteam
.
model
.
vo
;
import
lombok.*
;
import
org.springframework.format.annotation.DateTimeFormat
;
import
java.util.Date
;
import
java.util.HashMap
;
import
java.util.List
;
@Getter
@Setter
@ToString
@AllArgsConstructor
@NoArgsConstructor
public
class
MyProjectAllocationVO
{
private
String
projectId
;
private
String
projectName
;
private
String
accountName
;
private
String
billableStatus
;
@DateTimeFormat
(
iso
=
DateTimeFormat
.
ISO
.
DATE
)
private
Date
billingStartDate
;
@DateTimeFormat
(
iso
=
DateTimeFormat
.
ISO
.
DATE
)
private
Date
billingEndDate
;
private
String
shift
;
private
String
resourceStatus
;
private
List
<
HashMap
<
String
,
String
>>
deliveryLeadIds
;
}
src/main/java/com/nisum/myteam/model/vo/ResourceVO.java
0 → 100644
View file @
22239759
package
com
.
nisum
.
myteam
.
model
.
vo
;
import
lombok.*
;
import
org.bson.types.ObjectId
;
import
org.springframework.data.annotation.Id
;
import
org.springframework.format.annotation.DateTimeFormat
;
import
java.util.Date
;
@Getter
@Setter
@ToString
@AllArgsConstructor
@NoArgsConstructor
public
class
ResourceVO
{
@Id
private
ObjectId
id
;
private
String
employeeId
;
private
String
employeeName
;
private
String
designation
;
private
String
emailId
;
private
String
projectId
;
private
String
projectName
;
@DateTimeFormat
(
iso
=
DateTimeFormat
.
ISO
.
DATE
)
private
String
billableStatus
;
@DateTimeFormat
(
iso
=
DateTimeFormat
.
ISO
.
DATE
,
pattern
=
"yyyy-MM-dd'T'HH:mm:ss.SSSX"
)
private
Date
billingStartDate
;
@DateTimeFormat
(
iso
=
DateTimeFormat
.
ISO
.
DATE
,
pattern
=
"yyyy-MM-dd'T'HH:mm:ss.SSSX"
)
private
Date
billingEndDate
;
private
String
resourceStatus
;
private
String
resourceRole
;
}
src/main/java/com/nisum/myteam/repository/ResourceAllocationRepo.java
0 → 100644
View file @
22239759
package
com
.
nisum
.
myteam
.
repository
;
import
com.nisum.myteam.model.dao.Resource
;
import
com.nisum.myteam.model.dao.ResourceAllocation
;
import
org.bson.types.ObjectId
;
import
org.springframework.data.mongodb.repository.MongoRepository
;
import
java.util.List
;
public
interface
ResourceAllocationRepo
extends
MongoRepository
<
ResourceAllocation
,
String
>
{
List
<
ResourceAllocation
>
findByProjectId
(
String
projectId
);
List
<
ResourceAllocation
>
findByEmployeeId
(
String
employeeId
);
ResourceAllocation
findById
(
ObjectId
id
);
List
<
ResourceAllocation
>
findByEmployeeIdAndProjectId
(
String
employeeId
,
String
projectId
);
// List<Resource> findByEmployeeIdAndActive(String employeeId, boolean status);
// List<Resource> findByEmployeeIdAndProjectIdAndActive(String employeeId, String projectId, boolean status);
// List<Resource> findByAccountAndActiveAndBillableStatus(String account, boolean status, String billableStatus);
}
src/main/java/com/nisum/myteam/repository/ResourceRepo.java
View file @
22239759
src/main/java/com/nisum/myteam/service/IDashboardService.java
0 → 100644
View file @
22239759
package
com
.
nisum
.
myteam
.
service
;
import
com.nisum.myteam.model.vo.EmployeeDashboardVO
;
import
java.util.List
;
public
interface
IDashboardService
{
public
List
<
EmployeeDashboardVO
>
getEmployeesDashBoard
();
}
src/main/java/com/nisum/myteam/service/IEmployeeService.java
View file @
22239759
package
com
.
nisum
.
myteam
.
service
;
package
com
.
nisum
.
myteam
.
service
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Set
;
import
org.springframework.stereotype.Service
;
import
com.nisum.myteam.exception.handler.MyTeamException
;
import
com.nisum.myteam.exception.handler.MyTeamException
;
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
org.springframework.stereotype.Service
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Set
;
@Service
@Service
public
interface
IEmployeeService
{
public
interface
IEmployeeService
{
...
...
src/main/java/com/nisum/myteam/service/IEmployeeVisaService.java
0 → 100644
View file @
22239759
package
com
.
nisum
.
myteam
.
service
;
public
interface
IEmployeeVisaService
{
}
src/main/java/com/nisum/myteam/service/IProjectService.java
View file @
22239759
package
com
.
nisum
.
myteam
.
service
;
package
com
.
nisum
.
myteam
.
service
;
import
com.nisum.myteam.exception.handler.MyTeamException
;
import
com.nisum.myteam.model.dao.*
;
import
java.util.HashMap
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Set
;
import
java.util.Set
;
import
com.nisum.myteam.exception.handler.MyTeamException
;
import
com.nisum.myteam.model.dao.*
;
import
com.nisum.myteam.model.vo.EmployeeDashboardVO
;
public
interface
IProjectService
{
public
interface
IProjectService
{
Project
createProject
(
Project
project
,
String
loginEmpId
)
throws
MyTeamException
;
Project
createProject
(
Project
project
,
String
loginEmpId
)
throws
MyTeamException
;
...
@@ -16,10 +15,22 @@ public interface IProjectService {
...
@@ -16,10 +15,22 @@ public interface IProjectService {
void
deleteProject
(
String
projectId
);
void
deleteProject
(
String
projectId
);
List
<
Project
>
getProjectsUnderDomain
(
String
domainId
);
public
boolean
isProjectExistsByName
(
String
projectName
);
public
boolean
isProjectExistsById
(
String
projectId
);
public
Project
getProjectByProjectId
(
String
projectId
);
public
long
getProjectsCount
();
public
List
<
Project
>
getAllProjects
();
List
<
HashMap
<
Object
,
Object
>>
getProjects
()
throws
MyTeamException
;
List
<
HashMap
<
Object
,
Object
>>
getProjects
()
throws
MyTeamException
;
public
List
<
Project
>
getOnlyActiveProjects
();
List
<
Project
>
getProjectsUnderDomain
(
String
domainId
);
List
<
Project
>
getProjectsUnderDeliveryLead
(
String
managerId
)
throws
MyTeamException
;
List
<
Project
>
getProjectsUnderDeliveryLead
(
String
managerId
)
throws
MyTeamException
;
public
Resource
addNewBeanchAllocation
(
Employee
employee
,
String
loginEmpId
);
public
Resource
addNewBeanchAllocation
(
Employee
employee
,
String
loginEmpId
);
...
@@ -28,34 +39,28 @@ public interface IProjectService {
...
@@ -28,34 +39,28 @@ public interface IProjectService {
String
generatePdfReport
(
long
id
,
String
fromDate
,
String
toDate
)
throws
MyTeamException
;
String
generatePdfReport
(
long
id
,
String
fromDate
,
String
toDate
)
throws
MyTeamException
;
List
<
Resource
>
getResourcesUnderProject
(
String
empId
);
List
<
Employee
>
getUnAssignedEmployees
();
public
List
<
EmployeeDashboardVO
>
getEmployeesDashBoard
();
public
HashMap
<
String
,
Object
>
addProjectTeamMateWithCheck
(
Resource
projectTeamMate
,
String
loginEmpId
)
throws
MyTeamException
;
public
List
<
HashMap
<
Object
,
Object
>>
getProjectsForEmployee
(
String
empId
);
//
public List<HashMap<Object, Object>> getProjectsForEmployee(String empId);
public
Set
<
String
>
accountsAssignedToDl
(
String
empId
);
public
Set
<
String
>
accountsAssignedToDl
(
String
empId
);
public
List
<
HashMap
<
Object
,
Object
>>
deliveryLeadProjects
(
String
empId
)
throws
MyTeamException
;
public
List
<
HashMap
<
Object
,
Object
>>
deliveryLeadProjects
(
String
empId
)
throws
MyTeamException
;
public
List
<
Project
>
getAllProjects
();
public
boolean
isProjectExists
(
String
projectName
);
public
boolean
isProjectExistsById
(
String
projectId
);
public
long
getProjectsCount
();
public
Account
getProjectAccount
(
String
accountId
);
public
Account
getProjectAccount
(
String
accountId
);
public
Account
updateProjSeqinAccount
(
Account
account
)
throws
MyTeamException
;
public
Account
updateProjSeqinAccount
(
Account
account
)
throws
MyTeamException
;
public
List
<
HashMap
<
Object
,
Object
>>
getRoleBasedProjects
(
String
empId
)
throws
MyTeamException
;
public
List
<
HashMap
<
Object
,
Object
>>
getRoleBasedProjects
(
String
empId
)
throws
MyTeamException
;
public
List
<
HashMap
<
Object
,
Object
>>
getProjectsInsteadOfRole
()
throws
MyTeamException
;
public
List
<
HashMap
<
Object
,
Object
>>
getProjectsInsteadOfRole
()
throws
MyTeamException
;
public
List
<
Project
>
getActiveProjects
()
throws
MyTeamException
;
public
List
<
Project
>
getActiveProjects
()
throws
MyTeamException
;
public
List
<
Project
>
getProjectsForDeliveryLead
(
String
deliveryLeadId
);
List
<
Resource
>
getResourcesUnderProject
(
String
empId
);
}
}
src/main/java/com/nisum/myteam/service/IResourceAllocationService.java
0 → 100644
View file @
22239759
package
com
.
nisum
.
myteam
.
service
;
import
com.nisum.myteam.exception.handler.MyTeamException
;
import
com.nisum.myteam.model.dao.Employee
;
import
com.nisum.myteam.model.dao.Resource
;
import
com.nisum.myteam.model.dao.ResourceAllocation
;
import
com.nisum.myteam.model.vo.MyProjectAllocationVO
;
import
com.nisum.myteam.model.vo.ResourceVO
;
import
org.bson.types.ObjectId
;
import
java.util.HashMap
;
import
java.util.List
;
public
interface
IResourceAllocationService
{
ResourceAllocation
addResourceAllocation
(
ResourceAllocation
resourceAllocation
,
String
loginEmpId
)
throws
MyTeamException
;
void
updateResource
(
ResourceAllocation
resourceAllocation
,
String
loginEmpId
)
throws
MyTeamException
;
void
deleteResource
(
ResourceAllocation
resource
,
String
loginEmpId
);
List
<
ResourceAllocation
>
getAllResourcesForAllActiveProjects
();
// Resource save(Resource resource);
// void addResources(Employee employee, String loginEmpId);
// void inactivateResource(Employee employeeReq, Employee employeeUpdated, String loginEmpId);
List
<
ResourceAllocation
>
getResourcesSortByBillingStartDate
(
String
employeeId
);
// List<Resource> getAllResourcesForProject(String projectId, String status);
// List<Resource> getResourcesForEmployee(String empId);
// List<Resource> getAllResourcesForProject(String projectId);
List
<
ResourceAllocation
>
getActiveResources
(
String
empId
);
// List<Resource> getResourcesForShift(String shift);
public
List
<
ResourceVO
>
getResourcesForProject
(
String
projectId
,
String
statusFlag
);
public
List
<
ResourceAllocation
>
getResourcesUnderDeliveryLead
(
String
empId
);
public
List
<
ResourceAllocation
>
getBillingsForEmployee
(
String
empId
);
public
List
<
ResourceAllocation
>
getBillingsForProject
(
String
empId
,
String
projectId
);
public
List
<
MyProjectAllocationVO
>
getWorkedProjectsForResource
(
String
empId
);
public
List
<
Employee
>
getUnAssignedEmployees
();
public
List
<
ResourceAllocation
>
getAllResources
();
}
src/main/java/com/nisum/myteam/service/IResourceService.java
View file @
22239759
package
com
.
nisum
.
myteam
.
service
;
package
com
.
nisum
.
myteam
.
service
;
import
java.util.List
;
import
org.bson.types.ObjectId
;
import
org.springframework.stereotype.Service
;
import
com.nisum.myteam.exception.handler.MyTeamException
;
import
com.nisum.myteam.exception.handler.MyTeamException
;
import
com.nisum.myteam.model.dao.Employee
;
import
com.nisum.myteam.model.dao.Employee
;
import
com.nisum.myteam.model.dao.Resource
;
import
com.nisum.myteam.model.dao.Resource
;
import
org.bson.types.ObjectId
;
import
org.springframework.stereotype.Service
;
import
java.util.HashMap
;
import
java.util.List
;
@Service
@Service
public
interface
IResourceService
{
public
interface
IResourceService
{
...
@@ -42,4 +42,7 @@ public interface IResourceService {
...
@@ -42,4 +42,7 @@ public interface IResourceService {
public
List
<
Resource
>
getResourcesUnderDeliveryLead
(
String
empId
);
public
List
<
Resource
>
getResourcesUnderDeliveryLead
(
String
empId
);
public
HashMap
<
String
,
Object
>
verifyResourceAssignedToAnyProject
(
Resource
projectTeamMate
,
String
loginEmpId
)
throws
MyTeamException
;
}
}
src/main/java/com/nisum/myteam/service/impl/DashboardService.java
0 → 100644
View file @
22239759
package
com
.
nisum
.
myteam
.
service
.
impl
;
import
com.nisum.myteam.model.dao.Employee
;
import
com.nisum.myteam.model.dao.Project
;
import
com.nisum.myteam.model.dao.ResourceAllocation
;
import
com.nisum.myteam.model.vo.EmployeeDashboardVO
;
import
com.nisum.myteam.service.IDashboardService
;
import
com.nisum.myteam.service.IEmployeeService
;
import
com.nisum.myteam.service.IProjectService
;
import
com.nisum.myteam.service.IResourceAllocationService
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
java.util.*
;
@Service
@Slf4j
public
class
DashboardService
implements
IDashboardService
{
@Autowired
private
IEmployeeService
employeeService
;
@Autowired
private
IResourceAllocationService
resourceService
;
@Autowired
private
IProjectService
projectService
;
@Override
public
List
<
EmployeeDashboardVO
>
getEmployeesDashBoard
()
{
//List<Employee> allEmployees = employeeRepo.findAll();
List
<
Employee
>
allEmployees
=
employeeService
.
getAllEmployees
();
List
<
EmployeeDashboardVO
>
employeeDashboard
=
new
ArrayList
<>();
Map
<
String
,
Object
>
teamMatesMap
=
new
HashMap
();
Map
<
String
,
Object
>
teamMatesStatusMap
=
new
HashMap
();
// Find all active employees
List
<
ResourceAllocation
>
resources
=
resourceService
.
getAllResources
();
for
(
ResourceAllocation
resource
:
resources
)
{
//if (resource.isActive()) {
if
(
resource
.
getBillingEndDate
().
compareTo
(
new
Date
())>
0
)
{
Project
project
=
projectService
.
getProjectByProjectId
(
resource
.
getProjectId
());
if
(
project
!=
null
&&
project
.
getStatus
()
!=
null
&&
!
"Completed"
.
equalsIgnoreCase
(
project
.
getStatus
()))
{
Object
projectTeamMate
=
teamMatesMap
.
get
(
resource
.
getEmployeeId
());
if
(
projectTeamMate
==
null
)
{
List
listOfObjects
=
new
ArrayList
<>();
listOfObjects
.
add
(
resource
);
// A person can have multiple active projects with billability
teamMatesMap
.
put
(
resource
.
getEmployeeId
(),
listOfObjects
);
}
else
{
List
existingRecordsInMap
=
(
List
)
teamMatesMap
.
get
(
resource
.
getEmployeeId
());
existingRecordsInMap
.
add
(
resource
);
teamMatesMap
.
put
(
resource
.
getEmployeeId
(),
existingRecordsInMap
);
}
}
}
}
for
(
Employee
emp
:
allEmployees
)
{
if
(
teamMatesMap
.
containsKey
(
emp
.
getEmployeeId
()))
{
Object
value
=
teamMatesMap
.
get
(
emp
.
getEmployeeId
());
if
(
value
instanceof
List
)
{
List
listOfTeamMates
=
(
List
)
value
;
String
billableStatus
=
"NA"
;
for
(
Object
obj
:
listOfTeamMates
)
{
ResourceAllocation
projectTeamMate
=
(
ResourceAllocation
)
obj
;
String
status
=
projectTeamMate
.
getBillableStatus
();
if
(
status
==
null
)
{
status
=
"NA"
;
}
EmployeeDashboardVO
empVo
=
new
EmployeeDashboardVO
();
BeanUtils
.
copyProperties
(
emp
,
empVo
);
BeanUtils
.
copyProperties
(
projectTeamMate
,
empVo
,
"employeeId"
,
"employeeName"
,
"emailId"
,
"role"
,
"designation"
,
"mobileNumber"
);
employeeDashboard
.
add
(
empVo
);
}
}
}
else
{
EmployeeDashboardVO
empVo
=
new
EmployeeDashboardVO
();
BeanUtils
.
copyProperties
(
emp
,
empVo
);
empVo
.
setBillableStatus
(
"UA"
);
empVo
.
setProjectAssigned
(
false
);
employeeDashboard
.
add
(
empVo
);
}
}
return
employeeDashboard
;
}
}
src/main/java/com/nisum/myteam/service/impl/DomainService.java
View file @
22239759
...
@@ -158,6 +158,23 @@ public class DomainService implements IDomainService {
...
@@ -158,6 +158,23 @@ public class DomainService implements IDomainService {
return
domainVOS
;
return
domainVOS
;
}
}
public
Domain
getDomainById
(
String
domainId
)
{
Domain
domain
=
null
;
if
(
domainId
!=
null
&&
domainId
.
length
()
>
0
)
{
domain
=
domainRepo
.
findByDomainId
(
domainId
);
}
return
domain
;
}
@Override
public
List
<
Domain
>
getDomainsUnderAccount
(
String
accountId
)
throws
MyTeamException
{
List
<
Domain
>
domains
=
domainRepo
.
findByAccountId
(
accountId
);
return
domains
;
}
@Override
@Override
public
WriteResult
delete
(
String
domainId
)
throws
MyTeamException
{
public
WriteResult
delete
(
String
domainId
)
throws
MyTeamException
{
List
<
String
>
domEmpIds
=
new
ArrayList
<
String
>();
List
<
String
>
domEmpIds
=
new
ArrayList
<
String
>();
...
@@ -243,21 +260,6 @@ public class DomainService implements IDomainService {
...
@@ -243,21 +260,6 @@ public class DomainService implements IDomainService {
return
accIdsSet
;
return
accIdsSet
;
}
}
public
Domain
getDomainById
(
String
domainId
)
{
Domain
domain
=
null
;
if
(
domainId
!=
null
&&
domainId
.
length
()
>
0
)
{
domain
=
domainRepo
.
findByDomainId
(
domainId
);
}
return
domain
;
}
@Override
public
List
<
Domain
>
getDomainsUnderAccount
(
String
accountId
)
throws
MyTeamException
{
List
<
Domain
>
domains
=
domainRepo
.
findByAccountId
(
accountId
);
return
domains
;
}
...
...
src/main/java/com/nisum/myteam/service/impl/EmployeeService.java
View file @
22239759
...
@@ -8,7 +8,9 @@ import com.nisum.myteam.model.dao.Resource;
...
@@ -8,7 +8,9 @@ import com.nisum.myteam.model.dao.Resource;
import
com.nisum.myteam.repository.EmployeeRepo
;
import
com.nisum.myteam.repository.EmployeeRepo
;
import
com.nisum.myteam.service.*
;
import
com.nisum.myteam.service.*
;
import
com.nisum.myteam.utils.MyTeamUtils
;
import
com.nisum.myteam.utils.MyTeamUtils
;
import
com.nisum.myteam.utils.constants.ApplicationRole
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.lang.StringUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.data.domain.Sort
;
import
org.springframework.data.domain.Sort
;
import
org.springframework.data.mongodb.core.FindAndModifyOptions
;
import
org.springframework.data.mongodb.core.FindAndModifyOptions
;
...
@@ -297,7 +299,7 @@ public class EmployeeService implements IEmployeeService {
...
@@ -297,7 +299,7 @@ public class EmployeeService implements IEmployeeService {
}
}
@Override
@Override
public
boolean
verifyEmployeeRole
(
String
empId
,
String
role
Name
)
{
public
boolean
verifyEmployeeRole
(
String
empId
,
String
role
IdReq
)
{
boolean
flag
=
false
;
boolean
flag
=
false
;
log
.
info
(
"The employeeId::"
+
empId
);
log
.
info
(
"The employeeId::"
+
empId
);
...
@@ -305,23 +307,29 @@ public class EmployeeService implements IEmployeeService {
...
@@ -305,23 +307,29 @@ public class EmployeeService implements IEmployeeService {
Employee
employee
=
getEmployeeById
(
empId
);
Employee
employee
=
getEmployeeById
(
empId
);
log
.
info
(
"Employee::::in EmployeeService::"
+
employee
);
log
.
info
(
"Employee::::in EmployeeService::"
+
employee
);
String
role
=
employee
.
getRole
();
String
role
Name
=
employee
.
getRole
();
log
.
info
(
"The employee role::"
+
role
);
log
.
info
(
"The employee role::"
+
role
Name
);
if
(
null
!=
role
&&
""
!=
role
&&
!
"Admin"
.
equalsIgnoreCase
(
rol
e
))
{
if
(
StringUtils
.
isNotBlank
(
roleName
)
&&
!
ApplicationRole
.
ADMIN
.
getRoleName
().
equalsIgnoreCase
(
roleNam
e
))
{
if
(
"FM"
.
equalsIgnoreCase
(
role
)
||
"Delivery Lead"
.
equalsIgnoreCase
(
role
))
{
if
(
ApplicationRole
.
FUNCTIONAL_MANAGER
.
getRoleName
().
equalsIgnoreCase
(
roleName
)
||
ApplicationRole
.
DELIVERY_LEAD
.
getRoleName
().
equalsIgnoreCase
(
roleName
))
{
flag
=
true
;
flag
=
true
;
log
.
info
(
"in if block"
);
}
else
{
}
else
{
log
.
info
(
"in else block"
);
Set
<
String
>
roleSet
=
employeeRoleService
.
empRolesMapInfoByEmpId
(
empId
);
Set
<
String
>
roleSet
=
employeeRoleService
.
empRolesMapInfoByEmpId
(
empId
);
if
(
null
!=
roleSet
&&
!
roleSet
.
isEmpty
()
&&
MyTeamUtils
.
INT_ZERO
<
roleSet
.
size
())
{
if
(
null
!=
roleSet
&&
!
roleSet
.
isEmpty
()
&&
MyTeamUtils
.
INT_ZERO
<
roleSet
.
size
())
{
if
(
roleSet
.
contains
(
role
Name
))
{
if
(
roleSet
.
contains
(
role
IdReq
))
{
flag
=
true
;
flag
=
true
;
}
}
}
}
}
}
}
}
log
.
info
(
"before return flag::"
+
flag
);
return
flag
;
return
flag
;
}
}
...
...
src/main/java/com/nisum/myteam/service/impl/EmployeeVisaService.java
0 → 100644
View file @
22239759
package
com
.
nisum
.
myteam
.
service
.
impl
;
import
com.nisum.myteam.service.IEmployeeVisaService
;
import
org.springframework.stereotype.Service
;
@Service
public
class
EmployeeVisaService
implements
IEmployeeVisaService
{
//
// public getEmployeeVisaByName(String passport)
//
// employeeVisaRepo.findByVisaName(passport);
}
src/main/java/com/nisum/myteam/service/impl/ProjectService.java
View file @
22239759
package
com
.
nisum
.
myteam
.
service
.
impl
;
package
com
.
nisum
.
myteam
.
service
.
impl
;
import
com.nisum.myteam.exception.handler.MyTeamException
;
import
com.nisum.myteam.exception.handler.MyTeamException
;
import
com.nisum.myteam.model.dao.EmpLoginData
;
import
com.nisum.myteam.model.dao.*
;
import
com.nisum.myteam.model.dao.*
;
import
com.nisum.myteam.model.vo.EmployeeDashboardVO
;
import
com.nisum.myteam.model.vo.EmployeeDashboardVO
;
import
com.nisum.myteam.repository.*
;
import
com.nisum.myteam.repository.ProjectRepo
;
import
com.nisum.myteam.repository.ResourceRepo
;
import
com.nisum.myteam.service.IAccountService
;
import
com.nisum.myteam.service.IAccountService
;
import
com.nisum.myteam.service.IDomainService
;
import
com.nisum.myteam.service.IDomainService
;
import
com.nisum.myteam.service.IEmployeeService
;
import
com.nisum.myteam.service.IEmployeeService
;
...
@@ -12,6 +12,7 @@ import com.nisum.myteam.service.IProjectService;
...
@@ -12,6 +12,7 @@ import com.nisum.myteam.service.IProjectService;
import
com.nisum.myteam.utils.MyTeamUtils
;
import
com.nisum.myteam.utils.MyTeamUtils
;
import
com.nisum.myteam.utils.PdfReportGenerator
;
import
com.nisum.myteam.utils.PdfReportGenerator
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.lang.StringUtils
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.data.mongodb.core.FindAndModifyOptions
;
import
org.springframework.data.mongodb.core.FindAndModifyOptions
;
...
@@ -28,13 +29,10 @@ import java.util.stream.Collectors;
...
@@ -28,13 +29,10 @@ import java.util.stream.Collectors;
@Slf4j
@Slf4j
public
class
ProjectService
implements
IProjectService
{
public
class
ProjectService
implements
IProjectService
{
@Autowired
private
EmployeeRepo
employeeRepo
;
@Autowired
@Autowired
private
ProjectRepo
projectRepo
;
private
ProjectRepo
projectRepo
;
@Autowired
@Autowired
private
ResourceRepo
resourceRepo
;
private
ResourceRepo
resourceRepo
;
...
@@ -47,11 +45,6 @@ public class ProjectService implements IProjectService {
...
@@ -47,11 +45,6 @@ public class ProjectService implements IProjectService {
@Autowired
@Autowired
private
MongoTemplate
mongoTemplate
;
private
MongoTemplate
mongoTemplate
;
@Autowired
private
AccountRepo
accountRepo
;
@Autowired
private
DomainRepo
domainRepo
;
@Autowired
@Autowired
private
IDomainService
domainService
;
private
IDomainService
domainService
;
...
@@ -77,14 +70,13 @@ public class ProjectService implements IProjectService {
...
@@ -77,14 +70,13 @@ public class ProjectService implements IProjectService {
private
IAccountService
accountService
;
private
IAccountService
accountService
;
@Override
@Override
public
List
<
Project
>
getProjectsUnderDomain
(
String
domainId
)
{
public
List
<
Project
>
getProjectsUnderDomain
(
String
domainId
)
{
return
projectRepo
.
findByDomainId
(
domainId
);
return
projectRepo
.
findByDomainId
(
domainId
);
}
}
public
boolean
isProjectExists
(
String
projectName
)
{
public
boolean
isProjectExistsByName
(
String
projectName
)
{
boolean
isProjectExists
=
false
;
boolean
isProjectExists
=
false
;
if
(
projectName
!=
null
&&
!
""
.
equalsIgnoreCase
(
projectName
))
{
if
(
projectName
!=
null
&&
!
""
.
equalsIgnoreCase
(
projectName
))
{
Project
project
=
projectRepo
.
findByProjectName
(
projectName
);
Project
project
=
projectRepo
.
findByProjectName
(
projectName
);
...
@@ -123,18 +115,17 @@ public class ProjectService implements IProjectService {
...
@@ -123,18 +115,17 @@ public class ProjectService implements IProjectService {
@Override
@Override
public
Project
createProject
(
Project
project
,
String
loginEmpId
)
throws
MyTeamException
{
public
Project
createProject
(
Project
project
,
String
loginEmpId
)
throws
MyTeamException
{
if
(
project
.
getDomainId
()
==
null
)
{
if
(
project
.
getDomainId
()
==
null
)
{
List
<
Domain
>
domainsList
=
domainRepo
//List<Domain> domainsList = domainRepo.findByAccountId(project.getAccountId());
.
findByAccountId
(
project
.
getAccountId
());
List
<
Domain
>
domainsList
=
domainService
.
getDomainsUnderAccount
(
project
.
getAccountId
());
Domain
savedDomain
=
domainsList
.
get
(
0
);
Domain
savedDomain
=
domainsList
.
get
(
0
);
project
.
setDomainId
(
savedDomain
.
getDomainId
());
project
.
setDomainId
(
savedDomain
.
getDomainId
());
project
.
setDomain
(
savedDomain
.
getDomainName
());
//
project.setDomain(savedDomain.getDomainName());
}
}
project
.
setAuditFields
(
loginEmpId
,
MyTeamUtils
.
CREATE
);
project
.
setAuditFields
(
loginEmpId
,
MyTeamUtils
.
CREATE
);
return
projectRepo
.
save
(
project
);
return
projectRepo
.
save
(
project
);
}
}
@Override
@Override
public
Project
updateProject
(
Project
project
,
String
loginEmpId
)
throws
MyTeamException
{
public
Project
updateProject
(
Project
project
,
String
loginEmpId
)
throws
MyTeamException
{
//Inactivate the Project based on endDate
//Inactivate the Project based on endDate
...
@@ -199,13 +190,11 @@ public class ProjectService implements IProjectService {
...
@@ -199,13 +190,11 @@ public class ProjectService implements IProjectService {
newBenchAllocation
.
setAuditFields
(
loginEmpId
,
MyTeamUtils
.
CREATE
);
newBenchAllocation
.
setAuditFields
(
loginEmpId
,
MyTeamUtils
.
CREATE
);
resourceRepo
.
save
(
newBenchAllocation
);
resourceRepo
.
save
(
newBenchAllocation
);
empShiftService
.
updateEmployeeShift
(
existingTeammate
,
loginEmpId
);
empShiftService
.
updateEmployeeShift
(
existingTeammate
,
loginEmpId
);
}
}
return
existingProject
;
return
existingProject
;
}
}
else
{
else
{
Query
query
=
new
Query
(
Query
query
=
new
Query
(
Criteria
.
where
(
"projectId"
).
is
(
project
.
getProjectId
()));
Criteria
.
where
(
"projectId"
).
is
(
project
.
getProjectId
()));
Update
update
=
new
Update
();
Update
update
=
new
Update
();
...
@@ -220,7 +209,9 @@ public class ProjectService implements IProjectService {
...
@@ -220,7 +209,9 @@ public class ProjectService implements IProjectService {
* else{
* else{
* update.set("managerIds",Arrays.asList(project.getManagerId())); }
* update.set("managerIds",Arrays.asList(project.getManagerId())); }
*/
*/
update
.
set
(
"domain"
,
project
.
getDomain
());
//update.set("domain", project.getDomain());
update
.
set
(
"domain"
,
domainService
.
getDomainById
(
project
.
getDomainId
()).
getDomainName
());
update
.
set
(
"domainId"
,
project
.
getDomainId
());
update
.
set
(
"domainId"
,
project
.
getDomainId
());
update
.
set
(
"accountId"
,
project
.
getAccountId
());
update
.
set
(
"accountId"
,
project
.
getAccountId
());
update
.
set
(
"status"
,
project
.
getStatus
());
update
.
set
(
"status"
,
project
.
getStatus
());
...
@@ -281,8 +272,12 @@ public class ProjectService implements IProjectService {
...
@@ -281,8 +272,12 @@ public class ProjectService implements IProjectService {
projectMap
.
put
(
"id"
,
project
.
getId
());
projectMap
.
put
(
"id"
,
project
.
getId
());
projectMap
.
put
(
"projectId"
,
project
.
getProjectId
());
projectMap
.
put
(
"projectId"
,
project
.
getProjectId
());
projectMap
.
put
(
"projectName"
,
project
.
getProjectName
());
projectMap
.
put
(
"projectName"
,
project
.
getProjectName
());
Account
account
=
accountRepo
.
findByAccountId
(
project
.
getAccountId
());
Domain
domain
=
domainRepo
.
findByDomainId
(
project
.
getDomainId
());
Account
account
=
accountService
.
getAccountById
(
project
.
getAccountId
());
//Domain domain = domainRepo.findByDomainId(project.getDomainId());
Domain
domain
=
domainService
.
getDomainById
(
project
.
getDomainId
());
if
(
domain
!=
null
)
if
(
domain
!=
null
)
projectMap
.
put
(
"domain"
,
domain
.
getDomainName
());
projectMap
.
put
(
"domain"
,
domain
.
getDomainName
());
if
(
account
!=
null
)
if
(
account
!=
null
)
...
@@ -312,11 +307,8 @@ public class ProjectService implements IProjectService {
...
@@ -312,11 +307,8 @@ public class ProjectService implements IProjectService {
}
}
public
Resource
addNewBeanchAllocation
(
Employee
employee
,
String
loginEmpId
)
{
Resource
resourcePersisted
=
null
;
public
Resource
addNewBeanchAllocation
(
Employee
employee
,
String
loginEmpId
)
{
Resource
resourcePersisted
=
null
;
Resource
resourceBench
=
new
Resource
();
Resource
resourceBench
=
new
Resource
();
resourceBench
.
setAccount
(
MyTeamUtils
.
BENCH_ACCOUNT
);
resourceBench
.
setAccount
(
MyTeamUtils
.
BENCH_ACCOUNT
);
resourceBench
.
setBillableStatus
(
MyTeamUtils
.
BENCH_BILLABILITY_STATUS
);
resourceBench
.
setBillableStatus
(
MyTeamUtils
.
BENCH_BILLABILITY_STATUS
);
...
@@ -336,7 +328,7 @@ public class ProjectService implements IProjectService {
...
@@ -336,7 +328,7 @@ public class ProjectService implements IProjectService {
resourceBench
.
setShift
(
employee
.
getShift
());
resourceBench
.
setShift
(
employee
.
getShift
());
resourceBench
.
setRole
(
employee
.
getRole
());
resourceBench
.
setRole
(
employee
.
getRole
());
if
(
null
!=
employee
.
getEmpStatus
()
&&
employee
.
getEmpStatus
().
trim
().
equalsIgnoreCase
(
MyTeamUtils
.
IN_ACTIVE_SPACE
))
{
if
(
null
!=
employee
.
getEmpStatus
()
&&
employee
.
getEmpStatus
().
trim
().
equalsIgnoreCase
(
MyTeamUtils
.
IN_ACTIVE_SPACE
))
{
resourceBench
.
setEndDate
(
employee
.
getEndDate
());
resourceBench
.
setEndDate
(
employee
.
getEndDate
());
resourceBench
.
setActive
(
false
);
resourceBench
.
setActive
(
false
);
}
else
{
}
else
{
...
@@ -346,7 +338,7 @@ public class ProjectService implements IProjectService {
...
@@ -346,7 +338,7 @@ public class ProjectService implements IProjectService {
}
}
try
{
try
{
resourcePersisted
=
resourceService
.
addResource
(
resourceBench
,
loginEmpId
);
resourcePersisted
=
resourceService
.
addResource
(
resourceBench
,
loginEmpId
);
}
catch
(
MyTeamException
e
)
{
}
catch
(
MyTeamException
e
)
{
e
.
printStackTrace
();
e
.
printStackTrace
();
}
}
...
@@ -355,7 +347,6 @@ public class ProjectService implements IProjectService {
...
@@ -355,7 +347,6 @@ public class ProjectService implements IProjectService {
}
}
@Override
@Override
public
List
<
EmpLoginData
>
employeeLoginsBasedOnDate
(
long
id
,
public
List
<
EmpLoginData
>
employeeLoginsBasedOnDate
(
long
id
,
String
fromDate
,
String
toDate
)
throws
MyTeamException
{
String
fromDate
,
String
toDate
)
throws
MyTeamException
{
...
@@ -367,18 +358,11 @@ public class ProjectService implements IProjectService {
...
@@ -367,18 +358,11 @@ public class ProjectService implements IProjectService {
return
pdfReportGenerator
.
generateeReport
(
id
,
fromDate
,
toDate
);
return
pdfReportGenerator
.
generateeReport
(
id
,
fromDate
,
toDate
);
}
}
@Override
@Override
public
List
<
Resource
>
getResourcesUnderProject
(
String
empId
)
{
public
List
<
Resource
>
getResourcesUnderProject
(
String
empId
)
{
List
<
String
>
projectsIdsList
=
new
ArrayList
<>();
List
<
String
>
projectsIdsList
=
new
ArrayList
<>();
List
<
Resource
>
resourcesList
=
new
ArrayList
<>();
List
<
Resource
>
resourcesList
=
new
ArrayList
<>();
List
<
Project
>
projectsList
=
projectRepo
.
findByDeliveryLeadIds
(
empId
);
List
<
Project
>
projectsList
=
projectRepo
.
findByDeliveryLeadIds
(
empId
);
for
(
Project
project
:
projectsList
)
for
(
Project
project
:
projectsList
)
projectsIdsList
.
add
(
project
.
getProjectId
());
projectsIdsList
.
add
(
project
.
getProjectId
());
...
@@ -396,7 +380,6 @@ public class ProjectService implements IProjectService {
...
@@ -396,7 +380,6 @@ public class ProjectService implements IProjectService {
}
}
@Override
@Override
public
List
<
Project
>
getProjectsUnderDeliveryLead
(
String
deliveryLeadId
)
throws
MyTeamException
{
public
List
<
Project
>
getProjectsUnderDeliveryLead
(
String
deliveryLeadId
)
throws
MyTeamException
{
...
@@ -413,233 +396,44 @@ public class ProjectService implements IProjectService {
...
@@ -413,233 +396,44 @@ public class ProjectService implements IProjectService {
return
projectList
;
return
projectList
;
}
}
@Override
public
List
<
Employee
>
getUnAssignedEmployees
()
{
List
<
Employee
>
employeesList
=
employeeService
.
getAllEmployees
();
List
<
Employee
>
notAssignedEmployees
=
new
ArrayList
<>();
List
<
String
>
resourceIdsList
=
new
ArrayList
<>();
List
<
Resource
>
resourceListPersisted
=
resourceService
.
getAllResources
();
for
(
Resource
resource
:
resourceListPersisted
)
{
Project
project
=
projectRepo
.
findByProjectId
(
resource
.
getProjectId
());
if
(
project
!=
null
&&
project
.
getStatus
()
!=
null
&&
!
"Completed"
.
equalsIgnoreCase
(
project
.
getStatus
()))
{
resourceIdsList
.
add
(
resource
.
getEmployeeId
());
}
}
for
(
Employee
employee
:
employeesList
)
{
if
(!
resourceIdsList
.
contains
(
employee
.
getEmployeeId
()))
{
notAssignedEmployees
.
add
(
employee
);
}
}
return
notAssignedEmployees
;
}
@Override
@Override
public
List
<
Project
>
getAllProjects
()
{
public
List
<
Project
>
getAllProjects
()
{
return
projectRepo
.
findAll
();
return
projectRepo
.
findAll
();
}
}
@Override
public
List
<
EmployeeDashboardVO
>
getEmployeesDashBoard
()
{
List
<
Employee
>
allEmployees
=
employeeRepo
.
findAll
();
List
<
EmployeeDashboardVO
>
employeeDashboard
=
new
ArrayList
<>();
Map
<
String
,
Object
>
teamMatesMap
=
new
HashMap
();
Map
<
String
,
Object
>
teamMatesStatusMap
=
new
HashMap
();
// Find all active employees
List
<
Resource
>
teamMates
=
resourceRepo
.
findAll
();
for
(
Resource
teamMate
:
teamMates
)
{
if
(
teamMate
.
isActive
())
{
Project
project
=
projectRepo
.
findByProjectId
(
teamMate
.
getProjectId
());
if
(
project
!=
null
&&
project
.
getStatus
()
!=
null
&&
!
"Completed"
.
equalsIgnoreCase
(
project
.
getStatus
()))
{
Object
projectTeamMate
=
teamMatesMap
.
get
(
teamMate
.
getEmployeeId
());
if
(
projectTeamMate
==
null
)
{
List
listOfObjects
=
new
ArrayList
<>();
listOfObjects
.
add
(
teamMate
);
// A person can have multiple active projects with billability
teamMatesMap
.
put
(
teamMate
.
getEmployeeId
(),
listOfObjects
);
}
else
{
List
existingRecordsInMap
=
(
List
)
teamMatesMap
.
get
(
teamMate
.
getEmployeeId
());
existingRecordsInMap
.
add
(
teamMate
);
teamMatesMap
.
put
(
teamMate
.
getEmployeeId
(),
existingRecordsInMap
);
}
}
}
}
for
(
Employee
emp
:
allEmployees
)
{
if
(
teamMatesMap
.
containsKey
(
emp
.
getEmployeeId
()))
{
Object
value
=
teamMatesMap
.
get
(
emp
.
getEmployeeId
());
if
(
value
instanceof
List
)
{
List
listOfTeamMates
=
(
List
)
value
;
String
billableStatus
=
"NA"
;
for
(
Object
obj
:
listOfTeamMates
)
{
Resource
projectTeamMate
=
(
Resource
)
obj
;
String
status
=
projectTeamMate
.
getBillableStatus
();
if
(
status
==
null
)
{
status
=
"NA"
;
}
EmployeeDashboardVO
empVo
=
new
EmployeeDashboardVO
();
BeanUtils
.
copyProperties
(
emp
,
empVo
);
BeanUtils
.
copyProperties
(
projectTeamMate
,
empVo
,
"employeeId"
,
"employeeName"
,
"emailId"
,
"role"
,
"designation"
,
"mobileNumber"
);
employeeDashboard
.
add
(
empVo
);
}
}
}
else
{
EmployeeDashboardVO
empVo
=
new
EmployeeDashboardVO
();
BeanUtils
.
copyProperties
(
emp
,
empVo
);
empVo
.
setBillableStatus
(
"UA"
);
empVo
.
setProjectAssigned
(
false
);
employeeDashboard
.
add
(
empVo
);
}
}
return
employeeDashboard
;
}
@Override
@Override
public
HashMap
<
String
,
Object
>
addProjectTeamMateWithCheck
(
Resource
resource
,
String
loginEmpId
)
throws
MyTeamException
{
public
List
<
Project
>
getOnlyActiveProjects
()
{
boolean
flag
=
false
;
String
projectName
=
null
;
String
fromDate
=
null
;
String
toDate
=
null
;
String
result
=
null
;
HashMap
<
String
,
Object
>
responseMap
=
new
HashMap
<>();
Resource
resourcePersisted
=
null
;
List
<
Resource
>
teamMateList
=
resourceRepo
.
findByEmployeeId
(
resource
.
getEmployeeId
()).
stream
()
return
getAllProjects
().
stream
()
.
filter
(
e
->
!(
"Nisum0000"
.
equalsIgnoreCase
(
e
.
getProjectId
())))
.
filter
(
project
->
!
project
.
getStatus
().
equalsIgnoreCase
(
"Completed"
))
.
sorted
(
Comparator
.
comparing
(
Resource:
:
getEndDate
).
reversed
())
.
collect
(
Collectors
.
toList
());
.
collect
(
Collectors
.
toList
());
// Checking, if resource has existing project assignment.
for
(
Resource
projectMate
:
teamMateList
)
{
if
(
projectMate
.
getEndDate
()
!=
null
&&
(
projectMate
.
getEndDate
().
compareTo
(
new
Date
())
>
0
))
{
flag
=
true
;
projectName
=
projectMate
.
getProjectName
();
fromDate
=
projectMate
.
getStartDate
().
toString
();
toDate
=
projectMate
.
getEndDate
().
toString
();
break
;
}
}
if
(
flag
)
{
// If yes, error thrown to user.
result
=
"Resource "
+
resource
.
getEmployeeId
()
+
" already Assigned to the "
+
projectName
+
" Project"
+
" from "
+
fromDate
+
"to "
+
toDate
;
}
else
{
// If no, validating new project assignment start date against previous project end date.
result
=
validateNewProjectAssignmentStartDate
(
teamMateList
,
resource
);
if
(
result
==
null
)
{
resourcePersisted
=
resourceService
.
addResource
(
resource
,
loginEmpId
);
result
=
"TeamMate added successfuly"
;
}
}
}
responseMap
.
put
(
"message"
,
result
);
responseMap
.
put
(
"resourceObj"
,
resourcePersisted
);
return
responseMap
;
}
private
String
validateNewProjectAssignmentStartDate
(
List
<
Resource
>
teamMateList
,
Resource
projectTeamMate
)
{
String
response
=
null
;
if
(
teamMateList
!=
null
&&
teamMateList
.
size
()
>
0
)
{
Resource
ptMate
=
teamMateList
.
get
(
0
);
if
(
projectTeamMate
.
getNewBillingStartDate
().
compareTo
(
ptMate
.
getEndDate
())
<=
0
)
{
response
=
"Resource Start Date ("
+
projectTeamMate
.
getNewBillingStartDate
()
+
" ) in "
+
projectTeamMate
.
getProjectName
()
+
" project should be after "
+
ptMate
.
getProjectName
()
+
" project End Date ( "
+
ptMate
.
getEndDate
()
+
")."
;
}
}
else
{
response
=
validateAgainstDOJ
(
projectTeamMate
);
}
return
response
;
}
private
String
validateAgainstDOJ
(
Resource
projectTeamMate
)
{
private
String
validateAgainstDOJ
(
Resource
projectTeamMate
)
{
String
response
=
null
;
String
response
=
null
;
Date
empDoj
=
employeeRepo
.
findByEmployeeId
(
projectTeamMate
.
getEmployeeId
()).
getDateOfJoining
();
//Date empDoj = employeeRepo.findByEmployeeId(projectTeamMate.getEmployeeId()).getDateOfJoining();
if
(
projectTeamMate
.
getNewBillingStartDate
().
compareTo
(
empDoj
)
<
0
)
{
Date
empDoj
=
employeeService
.
getEmployeeById
(
projectTeamMate
.
getEmployeeId
()).
getDateOfJoining
();
response
=
"Resource Start Date ("
+
projectTeamMate
.
getNewBillingStartDate
()
+
" ) in "
+
projectTeamMate
.
getProjectName
()
+
" project should not be before Date of Joining ( "
+
empDoj
+
")."
;
}
return
response
;
}
@Override
public
List
<
HashMap
<
Object
,
Object
>>
getProjectsForEmployee
(
String
empId
){
HashMap
<
Object
,
Object
>
projectMap
=
null
;
List
<
HashMap
<
Object
,
Object
>>
projectList
=
new
ArrayList
<>();
Project
project
=
null
;
Account
account
=
null
;
Domain
domain
=
null
;
List
<
Resource
>
resourcesAllocatedList
=
resourceService
.
getResourcesForEmployee
(
empId
);
if
(
null
!=
resourcesAllocatedList
&&
!
resourcesAllocatedList
.
isEmpty
()
&&
MyTeamUtils
.
INT_ZERO
<
resourcesAllocatedList
.
size
())
{
for
(
Resource
resource
:
resourcesAllocatedList
)
{
projectMap
=
new
HashMap
<>();
project
=
projectRepo
.
findByProjectId
(
resource
.
getProjectId
());
account
=
accountRepo
.
findByAccountId
(
resource
.
getAccountId
());
if
(
projectTeamMate
.
getNewBillingStartDate
().
compareTo
(
empDoj
)
<
0
)
{
domain
=
domainRepo
.
findByDomainId
(
resource
.
getDomainId
());
response
=
"Resource Start Date ("
+
projectTeamMate
.
getNewBillingStartDate
()
+
" ) in "
+
projectTeamMate
.
getProjectName
()
+
" project should not be before Date of Joining ( "
+
empDoj
+
")."
;
projectMap
.
put
(
"id"
,
project
.
getId
());
projectMap
.
put
(
"projectId"
,
project
.
getProjectId
());
projectMap
.
put
(
"projectName"
,
project
.
getProjectName
());
if
(
domain
!=
null
)
projectMap
.
put
(
"domain"
,
domain
.
getDomainName
());
if
(
account
!=
null
)
projectMap
.
put
(
"account"
,
account
.
getAccountName
());
projectMap
.
put
(
"accountId"
,
account
!=
null
?
account
.
getAccountId
():
resource
.
getAccountId
());
projectMap
.
put
(
"domainId"
,
domain
!=
null
?
domain
.
getDomainId
()
:
resource
.
getDomainId
()
);
projectMap
.
put
(
"status"
,
resource
.
isActive
());
projectMap
.
put
(
"projectStartDate"
,
resource
.
getStartDate
());
projectMap
.
put
(
"projectEndDate"
,
resource
.
getEndDate
());
projectMap
.
put
(
"employeeIds"
,
resource
.
getEmployeeId
());
projectMap
.
put
(
"shift"
,
resource
.
getShift
());
projectMap
.
put
(
"billableStatus"
,
resource
.
getBillableStatus
());
if
(
project
.
getDeliveryLeadIds
()
!=
null
)
{
projectMap
.
put
(
"deliveryLeadIds"
,
employeeService
.
getDeliveryManagerMap
(
project
.
getDeliveryLeadIds
()));
}
if
(
project
.
getManagerIds
()
!=
null
)
{
projectMap
.
put
(
"managerIds"
,
employeeService
.
getDeliveryManagerMap
(
project
.
getManagerIds
()));
}
projectList
.
add
(
projectMap
);
}
}
}
return
projectList
;
return
response
;
}
}
@Override
@Override
public
Set
<
String
>
accountsAssignedToDl
(
String
empId
)
{
public
Set
<
String
>
accountsAssignedToDl
(
String
empId
)
{
Set
<
String
>
accIdsSet
=
new
HashSet
<
String
>()
;
Set
<
String
>
accIdsSet
=
new
HashSet
<
String
>()
;
List
<
Project
>
prjtsList
=
projectRepo
.
findByDeliveryLeadIds
(
empId
);
List
<
Project
>
prjtsList
=
projectRepo
.
findByDeliveryLeadIds
(
empId
);
if
(
null
!=
prjtsList
&&
!
prjtsList
.
isEmpty
()
&&
MyTeamUtils
.
INT_ZERO
<
prjtsList
.
size
())
{
if
(
null
!=
prjtsList
&&
!
prjtsList
.
isEmpty
()
&&
MyTeamUtils
.
INT_ZERO
<
prjtsList
.
size
())
{
for
(
Project
obj
:
prjtsList
)
{
for
(
Project
obj
:
prjtsList
)
{
accIdsSet
.
add
(
obj
.
getAccountId
());
accIdsSet
.
add
(
obj
.
getAccountId
());
}
}
}
}
...
@@ -649,30 +443,30 @@ public class ProjectService implements IProjectService {
...
@@ -649,30 +443,30 @@ public class ProjectService implements IProjectService {
@Override
@Override
public
List
<
HashMap
<
Object
,
Object
>>
deliveryLeadProjects
(
String
empId
)
throws
MyTeamException
{
public
List
<
HashMap
<
Object
,
Object
>>
deliveryLeadProjects
(
String
empId
)
throws
MyTeamException
{
List
<
HashMap
<
Object
,
Object
>>
projectsList
=
new
ArrayList
<
HashMap
<
Object
,
Object
>>
();
List
<
HashMap
<
Object
,
Object
>>
projectsList
=
new
ArrayList
<
HashMap
<
Object
,
Object
>>
();
Set
<
String
>
accIdsSet
=
domainService
.
accountsAssignedToDeliveryLead
(
empId
);
Set
<
String
>
accIdsSet
=
domainService
.
accountsAssignedToDeliveryLead
(
empId
);
List
<
Project
>
prjts
=
projectRepo
.
findByAccountIdIn
(
accIdsSet
);
List
<
Project
>
prjts
=
projectRepo
.
findByAccountIdIn
(
accIdsSet
);
if
(
null
!=
prjts
&&
!
prjts
.
isEmpty
()
&&
MyTeamUtils
.
INT_ZERO
<
prjts
.
size
())
{
if
(
null
!=
prjts
&&
!
prjts
.
isEmpty
()
&&
MyTeamUtils
.
INT_ZERO
<
prjts
.
size
())
{
Account
account
=
null
;
Account
account
=
null
;
Domain
domain
=
null
;
Domain
domain
=
null
;
HashMap
<
Object
,
Object
>
projectMap
=
null
;
HashMap
<
Object
,
Object
>
projectMap
=
null
;
for
(
Project
obj
:
prjts
)
{
for
(
Project
obj
:
prjts
)
{
projectMap
=
new
HashMap
<>();
projectMap
=
new
HashMap
<>();
account
=
accountRepo
.
findByAccount
Id
(
obj
.
getAccountId
());
account
=
accountService
.
getAccountBy
Id
(
obj
.
getAccountId
());
domain
=
domainRepo
.
findByDomain
Id
(
obj
.
getDomainId
());
domain
=
domainService
.
getDomainBy
Id
(
obj
.
getDomainId
());
projectMap
.
put
(
"projectId"
,
obj
.
getProjectId
());
projectMap
.
put
(
"projectId"
,
obj
.
getProjectId
());
projectMap
.
put
(
"projectName"
,
obj
.
getProjectName
());
projectMap
.
put
(
"projectName"
,
obj
.
getProjectName
());
projectMap
.
put
(
"accountId"
,
obj
.
getAccountId
());
projectMap
.
put
(
"accountId"
,
obj
.
getAccountId
());
projectMap
.
put
(
"domainId"
,
obj
.
getDomainId
());
projectMap
.
put
(
"domainId"
,
obj
.
getDomainId
());
projectMap
.
put
(
"account"
,
null
!=
account
?
account
.
getAccountName
():
""
);
projectMap
.
put
(
"account"
,
null
!=
account
?
account
.
getAccountName
()
:
""
);
projectMap
.
put
(
"domain"
,
null
!=
domain
?
domain
.
getDomainName
()
:
""
);
projectMap
.
put
(
"domain"
,
null
!=
domain
?
domain
.
getDomainName
()
:
""
);
projectMap
.
put
(
"status"
,
obj
.
getStatus
());
projectMap
.
put
(
"status"
,
obj
.
getStatus
());
...
@@ -689,14 +483,13 @@ public class ProjectService implements IProjectService {
...
@@ -689,14 +483,13 @@ public class ProjectService implements IProjectService {
/*
/*
Need to refactor the following code
Need to refactor the following code
*/
*/
@Override
@Override
public
List
<
HashMap
<
Object
,
Object
>>
getRoleBasedProjects
(
String
empId
)
throws
MyTeamException
{
public
List
<
HashMap
<
Object
,
Object
>>
getRoleBasedProjects
(
String
empId
)
throws
MyTeamException
{
List
<
HashMap
<
Object
,
Object
>>
projectsList
=
new
ArrayList
<
HashMap
<
Object
,
Object
>>();
List
<
HashMap
<
Object
,
Object
>>
projectsList
=
new
ArrayList
<
HashMap
<
Object
,
Object
>>();
Set
<
String
>
accountIdSet
=
domainService
.
accountsAssignedToDeliveryLead
(
empId
);
Set
<
String
>
accountIdSet
=
domainService
.
accountsAssignedToDeliveryLead
(
empId
);
List
<
Project
>
projectList
=
projectRepo
.
findByAccountIdIn
(
accountIdSet
);
List
<
Project
>
projectList
=
projectRepo
.
findByAccountIdIn
(
accountIdSet
);
...
@@ -732,8 +525,8 @@ public class ProjectService implements IProjectService {
...
@@ -732,8 +525,8 @@ public class ProjectService implements IProjectService {
projectMap
.
put
(
"projectId"
,
proj
.
getProjectId
());
projectMap
.
put
(
"projectId"
,
proj
.
getProjectId
());
projectMap
.
put
(
"projectName"
,
proj
.
getProjectName
());
projectMap
.
put
(
"projectName"
,
proj
.
getProjectName
());
Account
account
=
accountService
.
getAccountById
(
proj
.
getAccountId
());
Account
account
=
accountService
.
getAccountById
(
proj
.
getAccountId
());
Domain
domain
=
domainService
.
getDomainById
(
proj
.
getDomainId
());
Domain
domain
=
domainService
.
getDomainById
(
proj
.
getDomainId
());
if
(
domain
!=
null
)
if
(
domain
!=
null
)
projectMap
.
put
(
"domain"
,
domain
.
getDomainName
());
projectMap
.
put
(
"domain"
,
domain
.
getDomainName
());
...
@@ -741,11 +534,10 @@ public class ProjectService implements IProjectService {
...
@@ -741,11 +534,10 @@ public class ProjectService implements IProjectService {
projectMap
.
put
(
"account"
,
account
.
getAccountName
());
projectMap
.
put
(
"account"
,
account
.
getAccountName
());
projectMap
.
put
(
"accountId"
,
proj
.
getAccountId
());
projectMap
.
put
(
"accountId"
,
proj
.
getAccountId
());
projectMap
.
put
(
"domainId"
,
proj
.
getDomainId
());
projectMap
.
put
(
"domainId"
,
proj
.
getDomainId
());
projectMap
.
put
(
"domain"
,
proj
.
getDomain
());
projectMap
.
put
(
"employeeIds"
,
proj
.
getEmployeeIds
());
projectMap
.
put
(
"employeeIds"
,
proj
.
getEmployeeIds
());
if
(
proj
.
getDeliveryLeadIds
()
!=
null
)
{
if
(
proj
.
getDeliveryLeadIds
()
!=
null
)
{
//employeeService.getDeliveryManagerMap(proj.getDeliveryLeadIds()).stream().map(mapObj->mapObj.get("employeeId")).collect(Collectors.toList());
//employeeService.getDeliveryManagerMap(proj.getDeliveryLeadIds()).stream().map(mapObj->mapObj.get("employeeId")).collect(Collectors.toList());
projectMap
.
put
(
"deliveryLeadIds"
,
employeeService
.
getDeliveryManagerMap
(
proj
.
getDeliveryLeadIds
()));
projectMap
.
put
(
"deliveryLeadIds"
,
employeeService
.
getDeliveryManagerMap
(
proj
.
getDeliveryLeadIds
()));
}
}
if
(
proj
.
getManagerIds
()
!=
null
)
{
if
(
proj
.
getManagerIds
()
!=
null
)
{
projectMap
.
put
(
"managerIds"
,
employeeService
.
getDeliveryManagerMap
(
proj
.
getManagerIds
()));
projectMap
.
put
(
"managerIds"
,
employeeService
.
getDeliveryManagerMap
(
proj
.
getManagerIds
()));
...
@@ -755,6 +547,7 @@ public class ProjectService implements IProjectService {
...
@@ -755,6 +547,7 @@ public class ProjectService implements IProjectService {
}
}
public
List
<
Project
>
getActiveProjects
()
throws
MyTeamException
{
public
List
<
Project
>
getActiveProjects
()
throws
MyTeamException
{
List
<
Project
>
projects
=
projectRepo
.
findAll
();
List
<
Project
>
projects
=
projectRepo
.
findAll
();
return
projects
.
stream
().
filter
(
project
->
project
.
getStatus
().
equalsIgnoreCase
(
MyTeamUtils
.
ACTIVE
)).
collect
(
Collectors
.
toList
());
return
projects
.
stream
().
filter
(
project
->
project
.
getStatus
().
equalsIgnoreCase
(
MyTeamUtils
.
ACTIVE
)).
collect
(
Collectors
.
toList
());
...
@@ -762,4 +555,22 @@ public class ProjectService implements IProjectService {
...
@@ -762,4 +555,22 @@ public class ProjectService implements IProjectService {
}
}
public
Project
getProjectByProjectId
(
String
projectId
)
{
Project
project
=
null
;
if
(
StringUtils
.
isNotBlank
(
projectId
))
{
project
=
projectRepo
.
findByProjectId
(
projectId
);
}
return
project
;
}
public
List
<
Project
>
getProjectsForDeliveryLead
(
String
deliveryLeadId
)
{
List
<
Project
>
projectsList
=
projectRepo
.
findByDeliveryLeadIds
(
deliveryLeadId
);
return
projectsList
;
}
}
}
src/main/java/com/nisum/myteam/service/impl/ResourceAllocationService.java
0 → 100644
View file @
22239759
package
com
.
nisum
.
myteam
.
service
.
impl
;
import
com.nisum.myteam.exception.handler.MyTeamException
;
import
com.nisum.myteam.model.dao.*
;
import
com.nisum.myteam.model.vo.MyProjectAllocationVO
;
import
com.nisum.myteam.model.vo.ResourceVO
;
import
com.nisum.myteam.repository.ResourceAllocationRepo
;
import
com.nisum.myteam.service.*
;
import
com.nisum.myteam.statuscodes.ResourceStatus
;
import
com.nisum.myteam.utils.MyTeamDateUtils
;
import
com.nisum.myteam.utils.MyTeamUtils
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.data.domain.Sort
;
import
org.springframework.data.mongodb.core.MongoTemplate
;
import
org.springframework.data.mongodb.core.query.Criteria
;
import
org.springframework.data.mongodb.core.query.Query
;
import
org.springframework.stereotype.Service
;
import
java.util.*
;
import
java.util.stream.Collectors
;
@Service
@Slf4j
public
class
ResourceAllocationService
implements
IResourceAllocationService
{
@Autowired
private
MongoTemplate
mongoTemplate
;
@Autowired
private
ResourceAllocationRepo
resourceAllocationRepo
;
@Autowired
private
IAccountService
accountService
;
@Autowired
private
IDomainService
domainService
;
@Autowired
private
IProjectService
projectService
;
@Autowired
private
IEmployeeService
employeeService
;
public
HashMap
<
String
,
Object
>
respMap
=
new
HashMap
<>();
public
ResourceAllocation
addResourceAllocation
(
ResourceAllocation
resourceAllocation
,
String
loginEmpId
)
throws
MyTeamException
{
return
resourceAllocationRepo
.
save
(
resourceAllocation
);
}
public
boolean
isResourceExistsForProject
(
String
employeeId
,
String
projectId
)
{
boolean
isExists
=
false
;
List
<
ResourceAllocation
>
resourceList
=
resourceAllocationRepo
.
findByEmployeeIdAndProjectId
(
employeeId
,
projectId
);
if
(
resourceList
!=
null
&&
resourceList
.
size
()
>
0
)
{
isExists
=
true
;
}
respMap
.
put
(
"message"
,
"Resource Not Found"
);
return
isExists
;
}
public
void
updateResourceAlloc
(
ResourceAllocation
resourceAlloc
)
{
if
(
resourceAlloc
!=
null
)
{
ResourceAllocation
resourcePers
=
resourceAllocationRepo
.
save
(
resourceAlloc
);
respMap
.
put
(
"message"
,
"resource has been updated"
);
respMap
.
put
(
"resourceObj"
,
resourcePers
);
}
}
public
void
updatePreviousResource
(
ResourceAllocation
resourceAllocReq
,
String
loginEmpId
)
throws
MyTeamException
{
List
<
ResourceAllocation
>
resourceAllocList
=
resourceAllocationRepo
.
findByEmployeeIdAndProjectId
(
resourceAllocReq
.
getEmployeeId
(),
resourceAllocReq
.
getProjectId
());
List
<
ResourceAllocation
>
resourceListWithLatestRecord
=
resourceAllocList
.
stream
().
filter
(
resource
->
resource
.
getBillingEndDate
().
compareTo
(
new
Date
())
>=
0
).
collect
(
Collectors
.
toList
());
if
(
resourceListWithLatestRecord
!=
null
&&
resourceListWithLatestRecord
.
size
()
>
0
)
{
ResourceAllocation
resourceAllocPrev
=
resourceListWithLatestRecord
.
get
(
0
);
//latest resource record.
log
.
info
(
"The before date is::"
+
MyTeamDateUtils
.
getYesterdayDate
());
resourceAllocPrev
.
setBillingEndDate
(
MyTeamDateUtils
.
getYesterdayDate
());
//adding resource.
//resourceAllocPrev.setBillingEndDate(); //adding resource.
log
.
info
(
"After setting the date:::before saving the Resource::"
+
resourceAllocPrev
);
this
.
updateResourceAlloc
(
resourceAllocPrev
);
}
}
public
boolean
validateBillingStartEndDateAgainstProjectStartEndDate
(
ResourceAllocation
resourceAllocation
,
String
loginEmpId
)
throws
MyTeamException
{
boolean
isValid
=
true
;
Project
project
=
projectService
.
getProjectByProjectId
(
resourceAllocation
.
getProjectId
());
log
.
info
(
"Project::"
+
project
);
if
(!
resourceAllocation
.
getBillingStartDate
().
after
(
project
.
getProjectStartDate
()))
{
log
.
info
(
"Billing start date should be after Project start date"
);
respMap
.
put
(
"message"
,
"Billing start date should be after Project start date"
);
isValid
=
false
;
}
if
(!
resourceAllocation
.
getBillingStartDate
().
before
(
resourceAllocation
.
getBillingEndDate
()))
{
log
.
info
(
"Billing start date should be before Billing End Date."
);
respMap
.
put
(
"message"
,
"Billing start date should be before Billing End Date."
);
isValid
=
false
;
}
log
.
info
(
"ResourceALloc Req::"
+
resourceAllocation
);
log
.
info
(
""
+
project
.
getProjectEndDate
().
toString
());
if
(!
resourceAllocation
.
getBillingEndDate
().
before
(
project
.
getProjectEndDate
()))
{
log
.
info
(
"Billing end date should be before Project End Date."
);
respMap
.
put
(
"message"
,
"Billing end date should be before Project End Date."
);
isValid
=
false
;
}
respMap
.
put
(
"resourceObj"
,
resourceAllocation
);
return
isValid
;
}
public
boolean
validateBillingStartDateAgainstDOJ
(
ResourceAllocation
resource
)
{
String
message
=
""
;
boolean
isValid
=
true
;
Employee
employee
=
employeeService
.
getEmployeeById
(
resource
.
getEmployeeId
());
Date
empDoj
=
employeeService
.
getEmployeeById
(
resource
.
getEmployeeId
()).
getDateOfJoining
();
if
(
resource
.
getBillingStartDate
().
compareTo
(
empDoj
)
<
0
)
{
message
=
"Resource Billing Start Date ("
+
resource
.
getBillingStartDate
()
+
" ) in "
+
projectService
.
getProjectByProjectId
(
resource
.
getProjectId
()).
getProjectName
()
+
" project should not be before Date of Joining ( "
+
empDoj
+
")."
;
isValid
=
false
;
respMap
.
put
(
"message"
,
message
);
}
return
isValid
;
}
public
boolean
isResourceAssignedToAnyProject
(
ResourceAllocation
resourceAllocReq
)
{
boolean
isAssigned
=
false
;
String
message
=
""
;
//List<ResourceAllocation> resourceAllocList = resourceAllocationRepo.findByEmployeeIdAndProjectId(resourceAllocReq.getEmployeeId(), resourceAllocReq.getProjectId());
List
<
ResourceAllocation
>
resourceAllocList
=
resourceAllocationRepo
.
findByEmployeeId
(
resourceAllocReq
.
getEmployeeId
());
List
<
ResourceAllocation
>
resourceListWithLatestRecord
=
resourceAllocList
.
stream
().
filter
(
resource
->
resource
.
getBillingEndDate
().
compareTo
(
new
Date
())
>=
0
).
collect
(
Collectors
.
toList
());
if
(
resourceListWithLatestRecord
!=
null
&&
resourceListWithLatestRecord
.
size
()
>
0
)
{
ResourceAllocation
resourceAllocPrev
=
resourceListWithLatestRecord
.
get
(
0
);
//latest resource record.
message
=
"Resource "
+
resourceAllocPrev
.
getEmployeeId
()
+
" already Assigned to the "
+
projectService
.
getProjectByProjectId
(
resourceAllocPrev
.
getProjectId
()).
getProjectName
()
+
" Project"
+
" from "
+
resourceAllocPrev
.
getBillingStartDate
()
+
"to "
+
resourceAllocPrev
.
getBillingEndDate
();
isAssigned
=
true
;
respMap
.
put
(
"message"
,
message
);
}
return
isAssigned
;
}
public
void
updateResource
(
ResourceAllocation
resourceAllocReq
,
String
loginEmpId
)
throws
MyTeamException
{
ResourceAllocation
resourceAllocationPers
=
resourceAllocationRepo
.
save
(
resourceAllocReq
);
respMap
.
put
(
"message"
,
"Resource updated successfully"
);
respMap
.
put
(
"resourceObj"
,
resourceAllocationPers
);
}
public
void
deleteResource
(
ResourceAllocation
resourceReq
,
String
loginEmpId
)
{
List
<
ResourceAllocation
>
resourcesList
=
resourceAllocationRepo
.
findByEmployeeIdAndProjectId
(
resourceReq
.
getEmployeeId
(),
resourceReq
.
getProjectId
());
resourcesList
.
forEach
(
resource
->
resourceAllocationRepo
.
delete
(
resource
));
}
@Override
public
List
<
ResourceAllocation
>
getAllResources
()
{
return
resourceAllocationRepo
.
findAll
();
}
public
List
<
ResourceAllocation
>
getResourcesSortByBillingStartDate
(
String
employeeId
)
{
Query
query
=
prepareQuery
(
employeeId
,
MyTeamUtils
.
BILLING_START_DATE
);
return
mongoTemplate
.
find
(
query
,
ResourceAllocation
.
class
);
}
private
Query
prepareQuery
(
String
employeeId
,
String
dateColumn
)
{
Query
query
=
new
Query
();
query
.
addCriteria
(
Criteria
.
where
(
MyTeamUtils
.
EMPLOYEE_ID
).
is
(
employeeId
));
query
.
limit
(
MyTeamUtils
.
ONE
);
query
.
with
(
new
Sort
(
Sort
.
Direction
.
DESC
,
dateColumn
));
return
query
;
}
@Override
public
List
<
ResourceAllocation
>
getActiveResources
(
String
empId
)
{
List
<
ResourceAllocation
>
resourcesList
=
new
ArrayList
<>();
for
(
ResourceAllocation
resource
:
resourceAllocationRepo
.
findByEmployeeId
(
empId
))
{
//if (resource.isActive()) {
if
(
resource
.
getBillingEndDate
().
compareTo
(
new
Date
())
>
0
)
{
resourcesList
.
addAll
(
getAllResourcesForProject
(
resource
.
getProjectId
()));
}
}
return
resourcesList
;
}
public
List
<
ResourceAllocation
>
getAllResourcesForProject
(
String
projectId
)
{
return
resourceAllocationRepo
.
findByProjectId
(
projectId
);
}
@Override
public
List
<
ResourceAllocation
>
getAllResourcesForAllActiveProjects
()
{
List
<
ResourceAllocation
>
resourceList
=
new
ArrayList
<>();
for
(
Project
activeProject
:
projectService
.
getOnlyActiveProjects
())
{
resourceList
.
addAll
(
getAllResourcesForProject
(
activeProject
.
getProjectId
()));
}
return
resourceList
;
}
@Override
public
List
<
ResourceVO
>
getResourcesForProject
(
String
projectId
,
String
statusFlag
)
{
List
<
ResourceVO
>
resourcesList
=
new
ArrayList
<>();
for
(
ResourceAllocation
resource
:
resourceAllocationRepo
.
findByProjectId
(
projectId
))
{
Date
billingEndDate
=
resource
.
getBillingEndDate
();
if
(
billingEndDate
!=
null
)
{
ResourceVO
resourceVO
=
new
ResourceVO
();
resourceVO
.
setId
(
resource
.
getId
());
resourceVO
.
setProjectId
(
resource
.
getProjectId
());
resourceVO
.
setProjectName
(
projectService
.
getProjectByProjectId
(
resource
.
getProjectId
()).
getProjectName
());
resourceVO
.
setResourceRole
(
resource
.
getResourceRole
());
resourceVO
.
setBillingStartDate
(
resource
.
getBillingStartDate
());
resourceVO
.
setBillingEndDate
(
resource
.
getBillingEndDate
());
resourceVO
.
setBillableStatus
(
resource
.
getBillableStatus
());
resourceVO
.
setEmployeeId
(
resource
.
getEmployeeId
());
Employee
employee
=
employeeService
.
getEmployeeById
(
resource
.
getEmployeeId
());
resourceVO
.
setEmailId
(
employee
.
getEmailId
());
resourceVO
.
setEmployeeName
(
employee
.
getEmployeeName
());
resourceVO
.
setDesignation
(
employee
.
getDesignation
());
// Active
if
(
statusFlag
.
equals
(
ResourceStatus
.
ACTIVE
.
getStatus
())
&&
billingEndDate
.
compareTo
(
new
Date
())
>=
0
)
{
resourceVO
.
setResourceStatus
(
ResourceStatus
.
ACTIVE
.
getStatus
());
resourcesList
.
add
(
resourceVO
);
}
else
if
(
statusFlag
.
equals
(
ResourceStatus
.
IN_ACTIVE
.
getStatus
())
&&
billingEndDate
.
compareTo
(
new
Date
())
<
0
)
{
resourceVO
.
setResourceStatus
(
ResourceStatus
.
IN_ACTIVE
.
getStatus
());
resourcesList
.
add
(
resourceVO
);
}
else
if
(
statusFlag
.
equals
(
MyTeamUtils
.
BOTH
))
resourcesList
.
add
(
resourceVO
);
}
}
return
resourcesList
;
}
@Override
public
List
<
MyProjectAllocationVO
>
getWorkedProjectsForResource
(
String
empId
)
{
Project
project
=
null
;
Account
account
=
null
;
Domain
domain
=
null
;
Employee
employee
=
null
;
List
<
MyProjectAllocationVO
>
myProjectList
=
new
ArrayList
<>();
List
<
ResourceAllocation
>
resourcesAllocatedList
=
resourceAllocationRepo
.
findByEmployeeId
(
empId
);
if
(
null
!=
resourcesAllocatedList
&&
!
resourcesAllocatedList
.
isEmpty
()
&&
MyTeamUtils
.
INT_ZERO
<
resourcesAllocatedList
.
size
())
{
for
(
ResourceAllocation
resourceAlloc
:
resourcesAllocatedList
)
{
project
=
projectService
.
getProjectByProjectId
(
resourceAlloc
.
getProjectId
());
account
=
accountService
.
getAccountById
(
project
.
getAccountId
());
domain
=
domainService
.
getDomainById
(
project
.
getDomainId
());
employee
=
employeeService
.
getEmployeeById
(
resourceAlloc
.
getEmployeeId
());
MyProjectAllocationVO
myProject
=
new
MyProjectAllocationVO
();
myProject
.
setProjectId
(
project
.
getProjectId
());
myProject
.
setProjectName
(
project
.
getProjectName
());
myProject
.
setAccountName
(
account
.
getAccountName
());
myProject
.
setBillableStatus
(
resourceAlloc
.
getBillableStatus
());
myProject
.
setBillingStartDate
(
resourceAlloc
.
getBillingStartDate
());
myProject
.
setBillingEndDate
(
resourceAlloc
.
getBillingEndDate
());
myProject
.
setShift
(
employee
.
getShift
());
if
(
resourceAlloc
.
getBillingEndDate
().
compareTo
(
new
Date
())
>
0
)
{
myProject
.
setResourceStatus
(
ResourceStatus
.
ACTIVE
.
getStatus
());
}
else
{
myProject
.
setResourceStatus
(
ResourceStatus
.
IN_ACTIVE
.
getStatus
());
}
if
(
project
.
getDeliveryLeadIds
()
!=
null
)
{
myProject
.
setDeliveryLeadIds
(
employeeService
.
getDeliveryManagerMap
(
project
.
getDeliveryLeadIds
()));
}
myProjectList
.
add
(
myProject
);
}
}
return
myProjectList
;
}
@Override
public
List
<
ResourceAllocation
>
getResourcesUnderDeliveryLead
(
String
deliveryLeadId
)
{
List
<
String
>
projectIdsList
=
new
ArrayList
<>();
List
<
ResourceAllocation
>
resourcesList
=
new
ArrayList
<>();
for
(
Project
project
:
projectService
.
getProjectsForDeliveryLead
(
deliveryLeadId
))
projectIdsList
.
add
(
project
.
getProjectId
());
Query
query
=
new
Query
(
Criteria
.
where
(
"projectId"
).
in
(
projectIdsList
));
List
<
ResourceAllocation
>
resourcesListPersisted
=
mongoTemplate
.
find
(
query
,
ResourceAllocation
.
class
);
for
(
ResourceAllocation
resourceAlloc
:
resourcesListPersisted
)
{
if
(!
resourceAlloc
.
getEmployeeId
().
equals
(
deliveryLeadId
))
resourcesList
.
add
(
resourceAlloc
);
}
return
resourcesList
;
}
@Override
public
List
<
ResourceAllocation
>
getBillingsForEmployee
(
String
empId
)
{
// List<Billing> billingsList = billingRepo.findByEmployeeId(empId);
List
<
ResourceAllocation
>
resourcesList
=
resourceAllocationRepo
.
findByEmployeeId
(
empId
);
if
(
resourcesList
==
null
||
resourcesList
.
size
()
==
0
)
{
return
resourcesList
;
}
else
{
log
.
info
(
"The resources billing list before sorting::"
+
resourcesList
);
//return billingsList.stream().sorted(Comparator.comparing(Billing::getCreatedOn).reversed()).collect(Collectors.toList());
return
resourcesList
.
stream
().
sorted
(
Comparator
.
comparing
(
ResourceAllocation:
:
getBillingStartDate
).
reversed
()).
collect
(
Collectors
.
toList
());
}
}
@Override
public
List
<
ResourceAllocation
>
getBillingsForProject
(
String
empId
,
String
projectId
)
{
List
<
ResourceAllocation
>
resourcesList
=
resourceAllocationRepo
.
findByEmployeeIdAndProjectId
(
empId
,
projectId
);
if
(
resourcesList
==
null
||
resourcesList
.
size
()
==
0
)
{
return
resourcesList
;
}
else
{
//return billingsList.stream().sorted(Comparator.comparing(Billing::getCreatedOn).reversed()).collect(Collectors.toList());
return
resourcesList
.
stream
().
sorted
(
Comparator
.
comparing
(
ResourceAllocation:
:
getBillingStartDate
).
reversed
()).
collect
(
Collectors
.
toList
());
}
}
@Override
public
List
<
Employee
>
getUnAssignedEmployees
()
{
List
<
Employee
>
notAssignedEmployees
=
new
ArrayList
<>();
List
<
String
>
resourceIdsList
=
new
ArrayList
<>();
for
(
ResourceAllocation
resource
:
this
.
getAllResources
())
{
Project
project
=
projectService
.
getProjectByProjectId
(
resource
.
getProjectId
());
if
(
project
!=
null
&&
project
.
getStatus
()
!=
null
&&
!
"Completed"
.
equalsIgnoreCase
(
project
.
getStatus
()))
{
resourceIdsList
.
add
(
resource
.
getEmployeeId
());
}
}
for
(
Employee
employee
:
employeeService
.
getAllEmployees
())
{
if
(!
resourceIdsList
.
contains
(
employee
.
getEmployeeId
()))
{
notAssignedEmployees
.
add
(
employee
);
}
}
return
notAssignedEmployees
;
}
}
src/main/java/com/nisum/myteam/service/impl/ResourceService.java
View file @
22239759
package
com
.
nisum
.
myteam
.
service
.
impl
;
package
com
.
nisum
.
myteam
.
service
.
impl
;
import
java.util.ArrayList
;
import
java.util.*
;
import
java.util.Arrays
;
import
java.util.Calendar
;
import
java.util.Comparator
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.stream.Collectors
;
import
java.util.stream.Collectors
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.data.domain.Sort
;
import
org.springframework.data.domain.Sort
;
...
@@ -66,7 +61,7 @@ public class ResourceService implements IResourceService {
...
@@ -66,7 +61,7 @@ public class ResourceService implements IResourceService {
private
ProjectService
projectService
;
private
ProjectService
projectService
;
@Autowired
@Autowired
private
EmployeeRepo
employeeR
oleR
epo
;
private
EmployeeRepo
employeeRepo
;
public
Resource
save
(
Resource
resource
)
{
public
Resource
save
(
Resource
resource
)
{
return
resourceRepo
.
save
(
resource
);
return
resourceRepo
.
save
(
resource
);
...
@@ -311,11 +306,11 @@ public class ResourceService implements IResourceService {
...
@@ -311,11 +306,11 @@ public class ResourceService implements IResourceService {
empShiftService
.
updateEmployeeShift
(
existingResource
,
loginEmpId
);
empShiftService
.
updateEmployeeShift
(
existingResource
,
loginEmpId
);
existingResource
.
setShift
(
resourceReq
.
getShift
());
existingResource
.
setShift
(
resourceReq
.
getShift
());
Employee
employeeDB
=
employeeR
oleR
epo
.
findByEmployeeId
(
resourceReq
.
getEmployeeId
());
Employee
employeeDB
=
employeeRepo
.
findByEmployeeId
(
resourceReq
.
getEmployeeId
());
employeeDB
.
setShift
(
resourceReq
.
getShift
());
employeeDB
.
setShift
(
resourceReq
.
getShift
());
employeeDB
.
setModifiedBy
(
loginEmpId
);
employeeDB
.
setModifiedBy
(
loginEmpId
);
employeeDB
.
setLastModifiedOn
(
new
Date
());
employeeDB
.
setLastModifiedOn
(
new
Date
());
employeeR
oleR
epo
.
save
(
employeeDB
);
employeeRepo
.
save
(
employeeDB
);
}
}
existingResource
.
setAuditFields
(
loginEmpId
,
MyTeamUtils
.
UPDATE
);
// Setting
existingResource
.
setAuditFields
(
loginEmpId
,
MyTeamUtils
.
UPDATE
);
// Setting
// audit
// audit
...
@@ -340,15 +335,6 @@ public class ResourceService implements IResourceService {
...
@@ -340,15 +335,6 @@ public class ResourceService implements IResourceService {
return
response
;
return
response
;
}
}
private
String
validateAgainstDOJ
(
Resource
resource
)
{
String
response
=
null
;
Date
empDoj
=
employeeRoleRepo
.
findByEmployeeId
(
resource
.
getEmployeeId
()).
getDateOfJoining
();
if
(
resource
.
getNewBillingStartDate
().
compareTo
(
empDoj
)
<
0
)
{
response
=
"Resource Start Date ("
+
resource
.
getNewBillingStartDate
()
+
" ) in "
+
resource
.
getProjectName
()
+
" project should not be before Date of Joining ( "
+
empDoj
+
")."
;
}
return
response
;
}
@Override
@Override
public
Resource
deleteResource
(
String
empId
,
String
projectId
,
ObjectId
id
,
String
loginEmpId
)
{
public
Resource
deleteResource
(
String
empId
,
String
projectId
,
ObjectId
id
,
String
loginEmpId
)
{
...
@@ -624,4 +610,77 @@ public class ResourceService implements IResourceService {
...
@@ -624,4 +610,77 @@ public class ResourceService implements IResourceService {
return
resourcesList
;
return
resourcesList
;
}
}
@Override
public
HashMap
<
String
,
Object
>
verifyResourceAssignedToAnyProject
(
Resource
resourceReq
,
String
loginEmpId
)
throws
MyTeamException
{
boolean
flag
=
false
;
String
projectName
=
null
;
String
fromDate
=
null
;
String
toDate
=
null
;
String
result
=
null
;
HashMap
<
String
,
Object
>
responseMap
=
new
HashMap
<>();
Resource
resourcePersisted
=
null
;
List
<
Resource
>
resourceList
=
resourceRepo
.
findByEmployeeId
(
resourceReq
.
getEmployeeId
()).
stream
()
.
filter
(
e
->
!(
"Nisum0000"
.
equalsIgnoreCase
(
e
.
getProjectId
())))
.
sorted
(
Comparator
.
comparing
(
Resource:
:
getEndDate
).
reversed
())
.
collect
(
Collectors
.
toList
());
// Checking, if resource has existing project assignment.
for
(
Resource
resource
:
resourceList
)
{
log
.
info
(
"Resource::"
+
resource
);
if
(
resource
.
getEndDate
()
!=
null
&&
(
resource
.
getEndDate
().
compareTo
(
new
Date
())
>
0
))
{
flag
=
true
;
projectName
=
resource
.
getProjectName
();
fromDate
=
resource
.
getStartDate
().
toString
();
toDate
=
resource
.
getEndDate
().
toString
();
break
;
}
}
if
(
flag
)
{
// If yes, error thrown to user.
result
=
"Resource "
+
resourceReq
.
getEmployeeId
()
+
" already Assigned to the "
+
projectName
+
" Project"
+
" from "
+
fromDate
+
"to "
+
toDate
;
}
else
{
// If no, validating new project assignment start date against previous project end date.
result
=
validateNewProjectAssignmentStartDate
(
resourceList
,
resourceReq
);
if
(
result
==
null
)
{
resourcePersisted
=
this
.
addResource
(
resourceReq
,
loginEmpId
);
result
=
"TeamMate added successfuly"
;
}
}
responseMap
.
put
(
"message"
,
result
);
responseMap
.
put
(
"resourceObj"
,
resourcePersisted
);
return
responseMap
;
}
private
String
validateNewProjectAssignmentStartDate
(
List
<
Resource
>
resourceList
,
Resource
resourceReq
)
{
String
response
=
null
;
if
(
resourceList
!=
null
&&
resourceList
.
size
()
>
0
)
{
Resource
resource
=
resourceList
.
get
(
0
);
if
(
resourceReq
.
getNewBillingStartDate
().
compareTo
(
resource
.
getEndDate
())
<=
0
)
{
response
=
"Resource Start Date ("
+
resourceReq
.
getNewBillingStartDate
()
+
" ) in "
+
resourceReq
.
getProjectName
()
+
" project should be after "
+
resource
.
getProjectName
()
+
" project End Date ( "
+
resource
.
getEndDate
()
+
")."
;
}
}
else
{
response
=
validateAgainstDOJ
(
resourceReq
);
}
return
response
;
}
private
String
validateAgainstDOJ
(
Resource
resource
)
{
String
response
=
null
;
Date
empDoj
=
employeeRepo
.
findByEmployeeId
(
resource
.
getEmployeeId
()).
getDateOfJoining
();
if
(
resource
.
getNewBillingStartDate
().
compareTo
(
empDoj
)
<
0
)
{
response
=
"Resource Start Date ("
+
resource
.
getNewBillingStartDate
()
+
" ) in "
+
resource
.
getProjectName
()
+
" project should not be before Date of Joining ( "
+
empDoj
+
")."
;
}
return
response
;
}
}
}
src/main/java/com/nisum/myteam/statuscodes/DomainStatus.java
View file @
22239759
...
@@ -2,8 +2,11 @@ package com.nisum.myteam.statuscodes;
...
@@ -2,8 +2,11 @@ package com.nisum.myteam.statuscodes;
public
enum
DomainStatus
{
public
enum
DomainStatus
{
CREATE
(
600
,
"Account has been created"
),
CREATE
(
610
,
"Domain has been created"
),
UPDATE
(
601
,
"Account has been updated"
);
UPDATE
(
611
,
"Domain has been updated"
),
ALREADY_EXISTED
(
612
,
"Domain is already existed"
),
IS_NOT_FOUND
(
613
,
"Domain is Not found"
),
GET_DOMIAINS
(
614
,
"Retrieved the domains successfully"
);
private
int
code
;
private
int
code
;
private
String
message
;
private
String
message
;
...
...
src/main/java/com/nisum/myteam/statuscodes/ProjectStatus.java
View file @
22239759
package
com
.
nisum
.
myteam
.
statuscodes
;
package
com
.
nisum
.
myteam
.
statuscodes
;
public
class
ProjectStatus
{
public
enum
ProjectStatus
{
CREATE
(
700
,
"Project has been created"
),
UPDATE
(
701
,
"Project has been updated"
),
DELETE
(
702
,
"Project has been deleted successfully"
),
ALREADY_EXISTED
(
703
,
"Project is already existed"
),
PROJECTID_IS_NOT_EXISTS
(
704
,
"Project Id is not existed"
),
PROJECT_NAME_IS_NOT_EXISTS
(
705
,
"Project is not existed"
),
IS_NOT_FOUND
(
706
,
"Project is Not found"
),
GET_PROJECTS
(
707
,
"Retrieved the projects successfully"
),
EMPLOYEE_NOT_EXISTS
(
708
,
"Please Provide valid employee id"
),
DELIVERYLEAD_NOT_EXISTS
(
709
,
"Please Provide valid Delivery lead id"
);
private
int
code
;
private
String
message
;
private
ProjectStatus
(
int
code
,
String
message
)
{
this
.
code
=
code
;
this
.
message
=
message
;
}
public
int
getCode
()
{
return
this
.
code
;
}
public
String
getMessage
()
{
return
this
.
message
;
}
}
}
src/main/java/com/nisum/myteam/statuscodes/ResourceCodes.java
0 → 100644
View file @
22239759
package
com
.
nisum
.
myteam
.
statuscodes
;
public
enum
ResourceCodes
{
CREATE
(
800
,
""
);
private
int
code
;
private
String
message
;
private
ResourceCodes
(
int
code
,
String
message
){
this
.
code
=
code
;
this
.
message
=
message
;
}
public
int
getCode
()
{
return
this
.
code
;
}
public
String
getMessage
()
{
return
this
.
message
;
}
}
src/main/java/com/nisum/myteam/statuscodes/ResourceStatus.java
View file @
22239759
package
com
.
nisum
.
myteam
.
statuscodes
;
package
com
.
nisum
.
myteam
.
statuscodes
;
public
class
ResourceStatus
{
public
enum
ResourceStatus
{
ACTIVE
(
"Active"
),
IN_ACTIVE
(
"InActive"
);
private
String
status
;
private
ResourceStatus
(
String
status
)
{
this
.
status
=
status
;
}
public
String
getStatus
()
{
return
this
.
status
;
}
}
}
src/main/java/com/nisum/myteam/utils/MyTeamDateUtils.java
0 → 100644
View file @
22239759
package
com
.
nisum
.
myteam
.
utils
;
import
java.util.Calendar
;
import
java.util.Date
;
public
class
MyTeamDateUtils
{
public
static
Date
getYesterdayDate
()
{
final
Calendar
cal
=
Calendar
.
getInstance
();
cal
.
add
(
Calendar
.
DATE
,
-
1
);
return
cal
.
getTime
();
}
}
src/main/java/com/nisum/myteam/utils/MyTeamUtils.java
View file @
22239759
...
@@ -156,11 +156,18 @@ public class MyTeamUtils {
...
@@ -156,11 +156,18 @@ public class MyTeamUtils {
public
final
static
String
UPDATE
=
"UPDATE"
;
public
final
static
String
UPDATE
=
"UPDATE"
;
public
static
final
String
SHIFT1
=
"Shift 1(9:00 AM - 6:00 PM)"
;
public
static
final
String
SHIFT1
=
"Shift 1(9:00 AM - 6:00 PM)"
;
public
static
final
String
SHIFT2
=
"Shift-2(2:00 PM - 11:00 PM)"
;
public
static
final
String
SHIFT2
=
"Shift-2(2:00 PM - 11:00 PM)"
;
public
static
final
String
SHIFT3
=
"Shift 3(10:00 PM - 6:00 AM)"
;
public
static
final
String
SHIFT3
=
"Shift 3(10:00 PM - 6:00 AM)"
;
public
static
final
String
SHIFT4
=
"Shift 4(7:30 AM - 3:30 PM)"
;
public
static
final
String
SHIFT4
=
"Shift 4(7:30 AM - 3:30 PM)"
;
public
static
final
String
SHIFT5
=
"Shift 5(11:30 AM - 7:30 PM)"
;
public
static
final
String
SHIFT5
=
"Shift 5(11:30 AM - 7:30 PM)"
;
public
final
static
String
PROJECT_START_DATE
=
"ProjectStartDate"
;
public
final
static
String
PROJECT_END_DATE
=
"ProjectEndDate"
;
public
final
static
String
BILLING_START_DATE
=
"billingStartDate"
;
public
final
static
String
BILLING_END_DATE
=
"billingEndDate"
;
}
}
src/main/java/com/nisum/myteam/utils/constants/ApplicationRole.java
0 → 100644
View file @
22239759
package
com
.
nisum
.
myteam
.
utils
.
constants
;
public
enum
ApplicationRole
{
FUNCTIONAL_MANAGER
(
""
,
"FM"
),
ADMIN
(
""
,
"Admin"
),
DIRECTOR
(
""
,
"Director"
),
DELIVERY_MANAGER
(
"DM"
,
"Delivery Manager"
),
DELIVERY_LEAD
(
"DL"
,
"Delivery Lead"
),
LEAD
(
"L"
,
"Lead"
),
EMPLOYEE
(
""
,
"Employee"
),
HR
(
""
,
"Hr"
);
private
String
roleId
;
private
String
roleName
;
private
ApplicationRole
(
String
roleId
,
String
roleName
)
{
this
.
roleId
=
roleId
;
this
.
roleName
=
roleName
;
}
public
String
getRoleId
()
{
return
this
.
roleId
;
}
public
String
getRoleName
()
{
return
this
.
roleName
;
}
}
src/main/java/com/nisum/myteam/utils/constants/RoleEnum.java
deleted
100644 → 0
View file @
5592d335
package
com
.
nisum
.
myteam
.
utils
.
constants
;
public
enum
RoleEnum
{
ADMIN
(
"admin"
),
DIRECTOR
(
"Director"
),
DELIVERY_MANAGER
(
"Delivery Manager"
),
DELIVERY_LEAD
(
"Delivery Lead"
),
LEAD
(
"Lead"
),
EMPLOYEE
(
"Employee"
),
HR
(
"hr"
);
private
String
role
;
private
RoleEnum
(
String
role
)
{
this
.
role
=
role
;
}
public
String
getRole
()
{
return
this
.
role
;
}
}
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