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
0861416c
Commit
0861416c
authored
May 04, 2019
by
Vijay Akula
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added response format for the get methods of resource controller
parent
97c144c6
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
298 additions
and
233 deletions
+298
-233
ResourceController.java
.../java/com/nisum/myteam/controller/ResourceController.java
+230
-174
ResourceService.java
...n/java/com/nisum/myteam/service/impl/ResourceService.java
+68
-59
No files found.
src/main/java/com/nisum/myteam/controller/ResourceController.java
View file @
0861416c
...
@@ -28,180 +28,236 @@ import java.util.stream.Collectors;
...
@@ -28,180 +28,236 @@ import java.util.stream.Collectors;
@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 = "/addEmployeeToTeam"
// @RequestMapping(value = "/addEmployeeToTeam"
@RequestMapping
(
value
=
"/resources"
,
method
=
RequestMethod
.
POST
,
produces
=
MediaType
.
APPLICATION_JSON_VALUE
,
consumes
=
MediaType
.
APPLICATION_JSON_VALUE
)
@RequestMapping
(
value
=
"/resources"
,
method
=
RequestMethod
.
POST
,
produces
=
MediaType
.
APPLICATION_JSON_VALUE
,
consumes
=
MediaType
.
APPLICATION_JSON_VALUE
)
public
ResponseEntity
<?>
addResourceToTeam
(
@RequestBody
Resource
resourceReq
,
public
ResponseEntity
<?>
addResourceToTeam
(
@RequestBody
Resource
resourceReq
,
@RequestParam
(
value
=
"loginEmpId"
,
required
=
true
)
String
loginEmpId
,
HttpServletRequest
request
)
throws
MyTeamException
{
@RequestParam
(
value
=
"loginEmpId"
,
required
=
true
)
String
loginEmpId
,
HttpServletRequest
request
)
throws
MyTeamException
{
if
(
StringUtils
.
isNotBlank
(
loginEmpId
))
{
if
(
StringUtils
.
isNotBlank
(
loginEmpId
))
{
resourceReq
.
setActive
(
true
);
resourceReq
.
setActive
(
true
);
resourceReq
.
setAuditFields
(
loginEmpId
,
MyTeamUtils
.
CREATE
);
resourceReq
.
setAuditFields
(
loginEmpId
,
MyTeamUtils
.
CREATE
);
Resource
resourcePersisted
=
resourceService
.
addResource
(
resourceReq
,
loginEmpId
);
Resource
resourcePersisted
=
resourceService
.
addResource
(
resourceReq
,
loginEmpId
);
ResponseDetails
createResponseDetails
=
new
ResponseDetails
(
new
Date
(),
601
,
"Resource has been created"
,
ResponseDetails
createResponseDetails
=
new
ResponseDetails
(
new
Date
(),
601
,
"Resource has been created"
,
"Resource description"
,
null
,
request
.
getContextPath
(),
"details"
,
resourcePersisted
);
"Resource description"
,
null
,
request
.
getContextPath
(),
"details"
,
resourcePersisted
);
return
new
ResponseEntity
<
ResponseDetails
>(
createResponseDetails
,
HttpStatus
.
OK
);
return
new
ResponseEntity
<
ResponseDetails
>(
createResponseDetails
,
HttpStatus
.
OK
);
}
}
ResponseDetails
responseDetails
=
new
ResponseDetails
(
new
Date
(),
602
,
"Please provide the valid Employee Id"
,
ResponseDetails
responseDetails
=
new
ResponseDetails
(
new
Date
(),
602
,
"Please provide the valid Employee Id"
,
"Employee Id is not valid"
,
null
,
request
.
getRequestURI
(),
"Resource details"
,
resourceReq
);
"Employee Id is not valid"
,
null
,
request
.
getRequestURI
(),
"Resource details"
,
resourceReq
);
return
new
ResponseEntity
<
ResponseDetails
>(
responseDetails
,
HttpStatus
.
OK
);
return
new
ResponseEntity
<
ResponseDetails
>(
responseDetails
,
HttpStatus
.
OK
);
}
}
// @RequestMapping(value = "/updateTeammate"
// @RequestMapping(value = "/updateTeammate"
@RequestMapping
(
value
=
"/resources"
,
method
=
RequestMethod
.
PUT
,
produces
=
MediaType
.
APPLICATION_JSON_VALUE
,
consumes
=
MediaType
.
APPLICATION_JSON_VALUE
)
@RequestMapping
(
value
=
"/resources"
,
method
=
RequestMethod
.
PUT
,
produces
=
MediaType
.
APPLICATION_JSON_VALUE
,
consumes
=
MediaType
.
APPLICATION_JSON_VALUE
)
public
ResponseEntity
<?>
updateResource
(
@RequestBody
Resource
resourceReq
,
public
ResponseEntity
<?>
updateResource
(
@RequestBody
Resource
resourceReq
,
@RequestParam
(
value
=
"loginEmpId"
)
String
loginEmpId
,
HttpServletRequest
request
)
throws
MyTeamException
{
@RequestParam
(
value
=
"loginEmpId"
)
String
loginEmpId
,
HttpServletRequest
request
)
throws
MyTeamException
{
if
(
StringUtils
.
isNotBlank
(
loginEmpId
))
{
if
(
StringUtils
.
isNotBlank
(
loginEmpId
))
{
resourceReq
.
setAuditFields
(
loginEmpId
,
MyTeamUtils
.
UPDATE
);
resourceReq
.
setAuditFields
(
loginEmpId
,
MyTeamUtils
.
UPDATE
);
String
responseMessage
=
resourceService
.
updateResource
(
resourceReq
,
loginEmpId
);
String
responseMessage
=
resourceService
.
updateResource
(
resourceReq
,
loginEmpId
);
ResponseDetails
createResponseDetails
=
new
ResponseDetails
(
new
Date
(),
601
,
responseMessage
,
ResponseDetails
createResponseDetails
=
new
ResponseDetails
(
new
Date
(),
601
,
responseMessage
,
"Resource description"
,
null
,
request
.
getContextPath
(),
"Resource details"
,
resourceReq
);
"Resource description"
,
null
,
request
.
getContextPath
(),
"Resource details"
,
resourceReq
);
return
new
ResponseEntity
<
ResponseDetails
>(
createResponseDetails
,
HttpStatus
.
OK
);
return
new
ResponseEntity
<
ResponseDetails
>(
createResponseDetails
,
HttpStatus
.
OK
);
}
}
ResponseDetails
responseDetails
=
new
ResponseDetails
(
new
Date
(),
602
,
"Please provide the valid Employee Id"
,
ResponseDetails
responseDetails
=
new
ResponseDetails
(
new
Date
(),
602
,
"Please provide the valid Employee Id"
,
"Employee Id is not valid"
,
null
,
request
.
getRequestURI
(),
"Resource details"
,
resourceReq
);
"Employee Id is not valid"
,
null
,
request
.
getRequestURI
(),
"Resource details"
,
resourceReq
);
return
new
ResponseEntity
<
ResponseDetails
>(
responseDetails
,
HttpStatus
.
OK
);
return
new
ResponseEntity
<
ResponseDetails
>(
responseDetails
,
HttpStatus
.
OK
);
}
}
// @RequestMapping(value = "/deleteTeammate"
// @RequestMapping(value = "/deleteTeammate"
@RequestMapping
(
value
=
"/resources"
,
method
=
RequestMethod
.
DELETE
,
produces
=
MediaType
.
APPLICATION_JSON_VALUE
,
consumes
=
MediaType
.
APPLICATION_JSON_VALUE
)
@RequestMapping
(
value
=
"/resources"
,
method
=
RequestMethod
.
DELETE
,
produces
=
MediaType
.
APPLICATION_JSON_VALUE
,
consumes
=
MediaType
.
APPLICATION_JSON_VALUE
)
public
ResponseEntity
<?>
deleteResource
(
@RequestBody
Resource
resourceReq
,
public
ResponseEntity
<?>
deleteResource
(
@RequestBody
Resource
resourceReq
,
@RequestParam
(
value
=
"loginEmpId"
,
required
=
true
)
String
loginEmpId
,
HttpServletRequest
request
)
throws
MyTeamException
{
@RequestParam
(
value
=
"loginEmpId"
,
required
=
true
)
String
loginEmpId
,
HttpServletRequest
request
)
throws
MyTeamException
{
if
(
StringUtils
.
isNotBlank
(
loginEmpId
))
{
if
(
StringUtils
.
isNotBlank
(
loginEmpId
))
{
Resource
resourceDeleted
=
resourceService
.
deleteResource
(
resourceReq
.
getEmployeeId
(),
resourceReq
.
getProjectId
(),
resourceReq
.
getId
(),
loginEmpId
);
Resource
resourceDeleted
=
resourceService
.
deleteResource
(
resourceReq
.
getEmployeeId
(),
resourceReq
.
getProjectId
(),
resourceReq
.
getId
(),
loginEmpId
);
ResponseDetails
createResponseDetails
=
new
ResponseDetails
(
new
Date
(),
601
,
"Resource has been deleted"
,
ResponseDetails
createResponseDetails
=
new
ResponseDetails
(
new
Date
(),
601
,
"Resource has been deleted"
,
"Resource description"
,
null
,
request
.
getContextPath
(),
"Resource details"
,
resourceDeleted
);
"Resource description"
,
null
,
request
.
getContextPath
(),
"Resource details"
,
resourceDeleted
);
return
new
ResponseEntity
<
ResponseDetails
>(
createResponseDetails
,
HttpStatus
.
OK
);
return
new
ResponseEntity
<
ResponseDetails
>(
createResponseDetails
,
HttpStatus
.
OK
);
}
}
ResponseDetails
responseDetails
=
new
ResponseDetails
(
new
Date
(),
602
,
"Please provide the valid Employee Id"
,
ResponseDetails
responseDetails
=
new
ResponseDetails
(
new
Date
(),
602
,
"Please provide the valid Employee Id"
,
"Employee Id is not valid"
,
null
,
request
.
getRequestURI
(),
"Resource details"
,
resourceReq
);
"Employee Id is not valid"
,
null
,
request
.
getRequestURI
(),
"Resource details"
,
resourceReq
);
return
new
ResponseEntity
<
ResponseDetails
>(
responseDetails
,
HttpStatus
.
OK
);
return
new
ResponseEntity
<
ResponseDetails
>(
responseDetails
,
HttpStatus
.
OK
);
}
}
// @RequestMapping(value = "/getEmployeeProjectInfo"
// @RequestMapping(value = "/getEmployeeProjectInfo"
@RequestMapping
(
value
=
"/resources/employeeId/{employeeId}"
,
method
=
RequestMethod
.
GET
,
produces
=
MediaType
.
APPLICATION_JSON_VALUE
)
@RequestMapping
(
value
=
"/resources/employeeId/{employeeId}"
,
method
=
RequestMethod
.
GET
,
produces
=
MediaType
.
APPLICATION_JSON_VALUE
)
public
ResponseEntity
<
List
<
Resource
>>
getResourcesSortByStartDate
(
@PathVariable
(
value
=
"employeeId"
,
required
=
true
)
String
employeeId
)
public
ResponseEntity
<?>
getResourcesSortByStartDate
(
@PathVariable
(
value
=
"employeeId"
,
required
=
true
)
String
employeeId
,
HttpServletRequest
request
)
throws
MyTeamException
{
throws
MyTeamException
{
List
<
Resource
>
projectInfo
=
resourceService
.
getResourcesSortByStartDate
(
employeeId
);
return
new
ResponseEntity
<>(
projectInfo
,
HttpStatus
.
OK
);
if
(
StringUtils
.
isNotBlank
(
employeeId
))
{
}
List
<
Resource
>
resourcesList
=
resourceService
.
getResourcesSortByStartDate
(
employeeId
);
ResponseDetails
responseDetails
=
new
ResponseDetails
(
new
Date
(),
602
,
"Resources have been retrieved successfully"
,
//@RequestMapping(value = "/getMyTeamDetails"
"List of Resources for an employee"
,
resourcesList
,
request
.
getRequestURI
(),
"Resource List details"
,
null
);
@RequestMapping
(
value
=
"/resources/active"
,
method
=
RequestMethod
.
GET
,
produces
=
MediaType
.
APPLICATION_JSON_VALUE
)
return
new
ResponseEntity
<
ResponseDetails
>(
responseDetails
,
HttpStatus
.
OK
);
public
ResponseEntity
<
List
<
Resource
>>
getActiveResources
(
@RequestParam
(
"employeeId"
)
String
employeeId
)
}
throws
MyTeamException
{
List
<
Resource
>
employeesRoles
=
resourceService
.
getActiveResources
(
employeeId
);
ResponseDetails
responseDetails
=
new
ResponseDetails
(
new
Date
(),
602
,
"Please provide the valid Employee Id"
,
return
new
ResponseEntity
<>(
employeesRoles
,
HttpStatus
.
OK
);
"Employee Id is not valid"
,
null
,
request
.
getRequestURI
(),
"Resource details"
,
null
);
}
return
new
ResponseEntity
<
ResponseDetails
>(
responseDetails
,
HttpStatus
.
OK
);
}
// @RequestMapping(value = "/getShiftDetails"
//@RequestMapping(value = "/getMyTeamDetails"
@RequestMapping
(
value
=
"/resources/shifts/{shift}"
,
method
=
RequestMethod
.
GET
,
produces
=
MediaType
.
APPLICATION_JSON_VALUE
)
@RequestMapping
(
value
=
"/resources/active"
,
method
=
RequestMethod
.
GET
,
produces
=
MediaType
.
APPLICATION_JSON_VALUE
)
public
ResponseEntity
<
List
<
Resource
>>
getResourcesForShift
(
@PathVariable
(
"shift"
)
String
shift
)
public
ResponseEntity
<?>
getActiveResources
(
@RequestParam
(
value
=
"employeeId"
,
required
=
false
)
String
employeeId
,
HttpServletRequest
request
)
throws
MyTeamException
{
throws
MyTeamException
{
List
<
Resource
>
resourcesList
=
resourceService
.
getResourcesForShift
(
shift
);
if
(
StringUtils
.
isNotBlank
(
employeeId
))
{
return
new
ResponseEntity
<>(
resourcesList
,
HttpStatus
.
OK
);
List
<
Resource
>
employeesRoles
=
resourceService
.
getActiveResources
(
employeeId
);
}
ResponseDetails
responseDetails
=
new
ResponseDetails
(
new
Date
(),
602
,
"Resources have been retrieved successfully"
,
// @RequestMapping(value = "/getProjectAllocations"
"List of Resources who are active in the projects"
,
employeesRoles
,
request
.
getRequestURI
(),
"Resource List details"
,
null
);
@RequestMapping
(
value
=
"/resources/projects"
,
method
=
RequestMethod
.
GET
,
produces
=
MediaType
.
APPLICATION_JSON_VALUE
)
return
new
ResponseEntity
<
ResponseDetails
>(
responseDetails
,
HttpStatus
.
OK
);
public
ResponseEntity
<
List
<
Resource
>>
getResourcesAllocatedForAllProjects
()
throws
MyTeamException
{
List
<
Resource
>
resourcesList
=
resourceService
.
getResourcesForActiveProjects
();
}
return
new
ResponseEntity
<>(
resourcesList
,
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
);
// @RequestMapping(value = "/getProjectDetails"
}
@RequestMapping
(
value
=
"/resources/project/{projectId}"
,
method
=
RequestMethod
.
GET
,
produces
=
MediaType
.
APPLICATION_JSON_VALUE
)
public
ResponseEntity
<
List
<
Resource
>>
getResourcesForProject
(
@PathVariable
(
"projectId"
)
String
projectId
,
@RequestParam
(
value
=
"status"
,
required
=
false
,
defaultValue
=
MyTeamUtils
.
ACTIVE
)
String
status
)
// @RequestMapping(value = "/getShiftDetails"
throws
MyTeamException
{
@RequestMapping
(
value
=
"/resources/shifts/{shift}"
,
method
=
RequestMethod
.
GET
,
produces
=
MediaType
.
APPLICATION_JSON_VALUE
)
List
<
Resource
>
resourcesList
=
resourceService
.
getResourcesForProject
(
projectId
,
status
);
public
ResponseEntity
<?>
getResourcesForShift
(
@PathVariable
(
value
=
"shift"
,
required
=
true
)
String
shift
,
HttpServletRequest
request
)
return
new
ResponseEntity
<>(
resourcesList
,
HttpStatus
.
OK
);
throws
MyTeamException
{
}
if
(
StringUtils
.
isNotBlank
(
shift
))
{
List
<
Resource
>
resourcesList
=
resourceService
.
getResourcesForShift
(
shift
);
//@RequestMapping(value = "/getTeamDetails"
ResponseDetails
responseDetails
=
new
ResponseDetails
(
new
Date
(),
602
,
"Resources have been retrieved successfully"
,
@RequestMapping
(
value
=
"/resources/deliverylead/{deliveryLeadId}"
,
method
=
RequestMethod
.
GET
,
produces
=
MediaType
.
APPLICATION_JSON_VALUE
)
"List of Resources for the provided shift"
,
resourcesList
,
request
.
getRequestURI
(),
"Resource List for shift"
,
null
);
public
ResponseEntity
<
List
<
Resource
>>
getTeamDetails
(
@PathVariable
(
"deliveryLeadId"
)
String
deliveryLeadId
)
return
new
ResponseEntity
<
ResponseDetails
>(
responseDetails
,
HttpStatus
.
OK
);
throws
MyTeamException
{
}
List
<
Resource
>
resourcesList
=
resourceService
.
getResourcesUnderDeliveryLead
(
deliveryLeadId
);
ResponseDetails
responseDetails
=
new
ResponseDetails
(
new
Date
(),
602
,
"Please provide the valid Shift value"
,
return
new
ResponseEntity
<>(
resourcesList
,
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/unAssignedEmployees"
,
method
=
RequestMethod
.
GET
,
produces
=
MediaType
.
APPLICATION_JSON_VALUE
)
// @RequestMapping(value = "/getProjectAllocations"
public
ResponseEntity
<
List
<
Employee
>>
getUnAssignedEmployees
()
throws
MyTeamException
{
@RequestMapping
(
value
=
"/resources/projects"
,
method
=
RequestMethod
.
GET
,
produces
=
MediaType
.
APPLICATION_JSON_VALUE
)
List
<
Employee
>
employeesList
=
projectService
.
getUnAssignedEmployees
();
public
ResponseEntity
<?>
getResourcesAllocatedForAllProjects
(
HttpServletRequest
request
)
throws
MyTeamException
{
return
new
ResponseEntity
<>(
employeesList
,
HttpStatus
.
OK
);
}
List
<
Resource
>
resourcesList
=
resourceService
.
getResourcesForActiveProjects
();
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
);
@RequestMapping
(
value
=
"/getEmployeesDashBoard"
,
method
=
RequestMethod
.
GET
,
produces
=
MediaType
.
APPLICATION_JSON_VALUE
)
public
ResponseEntity
<
List
<
EmployeeDashboardVO
>>
getEmployeesDashBoard
()
throws
MyTeamException
{
}
List
<
EmployeeDashboardVO
>
employeeDashBoardList
=
projectService
.
getEmployeesDashBoard
();
return
new
ResponseEntity
<>(
employeeDashBoardList
,
HttpStatus
.
OK
);
// @RequestMapping(value = "/getProjectDetails"
}
@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
=
"/getEmployeesHavingVisa"
,
method
=
RequestMethod
.
GET
,
produces
=
MediaType
.
APPLICATION_JSON_VALUE
)
@RequestParam
(
value
=
"status"
,
required
=
false
,
defaultValue
=
MyTeamUtils
.
ACTIVE
)
String
status
,
public
ResponseEntity
<
List
<
Employee
>>
getEmployeesHavingVisa
(
@RequestParam
(
"visa"
)
String
passport
)
HttpServletRequest
request
)
throws
MyTeamException
{
throws
MyTeamException
{
List
<
Employee
>
employees
=
new
ArrayList
<>();
if
(
passport
!=
null
&&
!
"passport"
.
equalsIgnoreCase
(
passport
))
{
if
(
StringUtils
.
isNotBlank
(
projectId
))
{
List
<
EmployeeVisa
>
employeeVisas
=
employeeVisaRepo
.
findByVisaName
(
passport
);
List
<
Resource
>
resourcesList
=
resourceService
.
getResourcesForProject
(
projectId
,
status
);
List
<
String
>
employeeIds
=
null
;
ResponseDetails
responseDetails
=
new
ResponseDetails
(
new
Date
(),
602
,
"Resources have been retrieved successfully"
,
if
(
employeeVisas
!=
null
)
{
"List of Resources for a project"
,
resourcesList
,
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
())
{
}
List
<
Employee
>
emps
=
employeeService
.
getActiveEmployees
();
ResponseDetails
responseDetails
=
new
ResponseDetails
(
new
Date
(),
602
,
"Please provide ProjectId"
,
for
(
Employee
emp
:
emps
)
{
"List of Resources for a project"
,
null
,
request
.
getRequestURI
(),
"Resource details"
,
null
);
if
(
employeeIds
.
contains
(
emp
.
getEmployeeId
()))
{
return
new
ResponseEntity
<
ResponseDetails
>(
responseDetails
,
HttpStatus
.
OK
);
employees
.
add
(
emp
);
}
}
}
}
//@RequestMapping(value = "/getTeamDetails"
return
new
ResponseEntity
<>(
employees
,
HttpStatus
.
OK
);
@RequestMapping
(
value
=
"/resources/deliverylead/{deliveryLeadId}"
,
method
=
RequestMethod
.
GET
,
produces
=
MediaType
.
APPLICATION_JSON_VALUE
)
}
else
{
public
ResponseEntity
<?>
getTeamDetails
(
@PathVariable
(
value
=
"deliveryLeadId"
,
required
=
true
)
String
deliveryLeadId
,
HttpServletRequest
request
)
// List<EmployeeRoles> employees = new ArrayList<>();
throws
MyTeamException
{
if
(
employeeService
.
getActiveEmployees
()
!=
null
)
{
employees
=
employeeService
.
getActiveEmployees
().
stream
()
if
(
StringUtils
.
isNotBlank
(
deliveryLeadId
))
{
.
sorted
((
o1
,
o2
)
->
o1
.
getEmployeeName
().
compareTo
(
o2
.
getEmployeeName
()))
List
<
Resource
>
resourcesList
=
resourceService
.
getResourcesUnderDeliveryLead
(
deliveryLeadId
);
.
collect
(
Collectors
.
toList
());
}
ResponseDetails
responseDetails
=
new
ResponseDetails
(
new
Date
(),
602
,
"Resources have been retrieved successfully"
,
return
new
ResponseEntity
<>(
employees
,
HttpStatus
.
OK
);
"List of Resources for a project"
,
resourcesList
,
request
.
getRequestURI
(),
"Resource details"
,
null
);
}
}
}
ResponseDetails
responseDetails
=
new
ResponseDetails
(
new
Date
(),
602
,
"Please provide ProjectId"
,
"List of Resources for DeliveryLead"
,
null
,
request
.
getRequestURI
(),
"Resource details"
,
null
);
return
new
ResponseEntity
<
ResponseDetails
>(
responseDetails
,
HttpStatus
.
OK
);
}
@RequestMapping
(
value
=
"/addEmployeeToTeamWithCheck"
,
method
=
RequestMethod
.
POST
,
produces
=
MediaType
.
TEXT_PLAIN_VALUE
,
consumes
=
MediaType
.
APPLICATION_JSON_VALUE
)
public
ResponseEntity
<
String
>
addEmployeeToTeamWithCheck
(
@RequestBody
Resource
resource
,
@RequestParam
(
value
=
"loginEmpId"
)
String
loginEmpId
)
throws
MyTeamException
{
@RequestMapping
(
value
=
"resources/unAssignedEmployees"
,
method
=
RequestMethod
.
GET
,
produces
=
MediaType
.
APPLICATION_JSON_VALUE
)
String
response
=
projectService
.
addProjectTeamMateWithCheck
(
resource
,
loginEmpId
);
public
ResponseEntity
<?>
getUnAssignedEmployees
(
HttpServletRequest
request
)
throws
MyTeamException
{
return
new
ResponseEntity
<>(
response
,
HttpStatus
.
OK
);
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
);
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
{
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
);
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
{
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
=
employeeService
.
getActiveEmployees
();
for
(
Employee
emp
:
emps
)
{
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
.
TEXT_PLAIN_VALUE
,
consumes
=
MediaType
.
APPLICATION_JSON_VALUE
)
public
ResponseEntity
<
String
>
addEmployeeToTeamWithCheck
(
@RequestBody
Resource
resource
,
@RequestParam
(
value
=
"loginEmpId"
)
String
loginEmpId
)
throws
MyTeamException
{
String
response
=
projectService
.
addProjectTeamMateWithCheck
(
resource
,
loginEmpId
);
return
new
ResponseEntity
<>(
response
,
HttpStatus
.
OK
);
}
}
}
...
...
src/main/java/com/nisum/myteam/service/impl/ResourceService.java
View file @
0861416c
...
@@ -127,22 +127,25 @@ public class ResourceService implements IResourceService {
...
@@ -127,22 +127,25 @@ public class ResourceService implements IResourceService {
}
}
@Override
@Override
public
String
updateResource
(
Resource
resource
,
String
loginEmpId
)
throws
MyTeamException
{
public
String
updateResource
(
Resource
resource
Req
,
String
loginEmpId
)
throws
MyTeamException
{
// String result = null;
// String result = null;
MyTeamResultDTO
myResultDto
=
new
MyTeamResultDTO
();
MyTeamResultDTO
myResultDto
=
new
MyTeamResultDTO
();
myResultDto
.
setResultCode
(
MyTeamResultDTO
.
SUCCESS_CODE
);
myResultDto
.
setResultCode
(
MyTeamResultDTO
.
SUCCESS_CODE
);
myResultDto
.
setResultData
(
"TeamMate updated successfuly"
);
myResultDto
.
setResultData
(
"TeamMate updated successfuly"
);
Resource
existingTeammate
=
resourceRepo
.
findById
(
resource
.
getId
());
Resource
existingResource
=
resourceRepo
.
findById
(
resourceReq
.
getId
());
log
.
info
(
"From database: Resource Details::"
+
existingResource
);
List
<
Billing
>
listBD
=
billingService
.
getActiveBillings
(
resource
.
getEmployeeId
(),
resource
.
getProjectId
());
Date
resEndDate
=
resource
.
getEndDate
();
Date
resEndDate
=
resourceReq
.
getEndDate
();
log
.
info
(
"ResEndDate::"
+
resEndDate
);
List
<
Billing
>
listBD
=
billingService
.
getActiveBillings
(
resourceReq
.
getEmployeeId
(),
resourceReq
.
getProjectId
());
// Handling past or present endDate (To "Inactive" the Resource)
// Handling past or present endDate (To "Inactive" the Resource)
if
(
resEndDate
.
compareTo
(
new
Date
())
<=
0
&&
resEndDate
.
compareTo
(
existing
Teammat
e
.
getEndDate
())
!=
0
)
{
if
(
resEndDate
.
compareTo
(
new
Date
())
<=
0
&&
resEndDate
.
compareTo
(
existing
Resourc
e
.
getEndDate
())
!=
0
)
{
existing
Teammat
e
.
setActive
(
false
);
existing
Resourc
e
.
setActive
(
false
);
existing
Teammat
e
.
setEndDate
(
resEndDate
);
existing
Resourc
e
.
setEndDate
(
resEndDate
);
if
(
listBD
!=
null
&&
!
listBD
.
isEmpty
())
{
if
(
listBD
!=
null
&&
!
listBD
.
isEmpty
())
{
Billing
billingDetailsExisting
=
listBD
.
get
(
0
);
Billing
billingDetailsExisting
=
listBD
.
get
(
0
);
Date
actualEndDate
=
resEndDate
;
Date
actualEndDate
=
resEndDate
;
...
@@ -159,8 +162,8 @@ public class ResourceService implements IResourceService {
...
@@ -159,8 +162,8 @@ public class ResourceService implements IResourceService {
billingDetails
.
setBillingStartDate
(
resEndDate
);
billingDetails
.
setBillingStartDate
(
resEndDate
);
billingDetails
.
setAccount
(
MyTeamUtils
.
BENCH_ACCOUNT
);
billingDetails
.
setAccount
(
MyTeamUtils
.
BENCH_ACCOUNT
);
billingDetails
.
setActive
(
true
);
billingDetails
.
setActive
(
true
);
billingDetails
.
setEmployeeId
(
existing
Teammat
e
.
getEmployeeId
());
billingDetails
.
setEmployeeId
(
existing
Resourc
e
.
getEmployeeId
());
billingDetails
.
setEmployeeName
(
existing
Teammat
e
.
getEmployeeName
());
billingDetails
.
setEmployeeName
(
existing
Resourc
e
.
getEmployeeName
());
// billingDetails.setCreateDate(new Date());// Commented as added
// billingDetails.setCreateDate(new Date());// Commented as added
// common audit fields
// common audit fields
billingDetails
.
setProjectId
(
MyTeamUtils
.
BENCH_PROJECT_ID
);
billingDetails
.
setProjectId
(
MyTeamUtils
.
BENCH_PROJECT_ID
);
...
@@ -175,14 +178,14 @@ public class ResourceService implements IResourceService {
...
@@ -175,14 +178,14 @@ public class ResourceService implements IResourceService {
billingService
.
addBilling
(
billingDetails
,
loginEmpId
);
billingService
.
addBilling
(
billingDetails
,
loginEmpId
);
newBenchAllocation
.
setBillableStatus
(
MyTeamUtils
.
BENCH_BILLABILITY_STATUS
);
newBenchAllocation
.
setBillableStatus
(
MyTeamUtils
.
BENCH_BILLABILITY_STATUS
);
newBenchAllocation
.
setDesignation
(
existing
Teammat
e
.
getDesignation
());
newBenchAllocation
.
setDesignation
(
existing
Resourc
e
.
getDesignation
());
newBenchAllocation
.
setEmailId
(
existing
Teammat
e
.
getEmailId
());
newBenchAllocation
.
setEmailId
(
existing
Resourc
e
.
getEmailId
());
newBenchAllocation
.
setEmployeeId
(
existing
Teammat
e
.
getEmployeeId
());
newBenchAllocation
.
setEmployeeId
(
existing
Resourc
e
.
getEmployeeId
());
newBenchAllocation
.
setActive
(
true
);
newBenchAllocation
.
setActive
(
true
);
newBenchAllocation
.
setEmployeeName
(
existing
Teammat
e
.
getEmployeeName
());
newBenchAllocation
.
setEmployeeName
(
existing
Resourc
e
.
getEmployeeName
());
newBenchAllocation
.
setProjectId
(
MyTeamUtils
.
BENCH_PROJECT_ID
);
newBenchAllocation
.
setProjectId
(
MyTeamUtils
.
BENCH_PROJECT_ID
);
newBenchAllocation
.
setShift
(
existing
Teammat
e
.
getShift
());
newBenchAllocation
.
setShift
(
existing
Resourc
e
.
getShift
());
newBenchAllocation
.
setRole
(
existing
Teammat
e
.
getRole
());
newBenchAllocation
.
setRole
(
existing
Resourc
e
.
getRole
());
Calendar
cal
=
Calendar
.
getInstance
();
Calendar
cal
=
Calendar
.
getInstance
();
cal
.
setTime
(
resEndDate
);
cal
.
setTime
(
resEndDate
);
...
@@ -197,11 +200,17 @@ public class ResourceService implements IResourceService {
...
@@ -197,11 +200,17 @@ public class ResourceService implements IResourceService {
myResultDto
.
setResultCode
(
MyTeamResultDTO
.
SUCCESS_CODE
);
myResultDto
.
setResultCode
(
MyTeamResultDTO
.
SUCCESS_CODE
);
myResultDto
.
setResultData
(
myResultDto
.
setResultData
(
"Resource Successfully moved from "
+
resource
.
getProjectName
()
+
" project to Bench."
);
"Resource Successfully moved from "
+
resource
Req
.
getProjectName
()
+
" project to Bench."
);
}
else
{
}
else
{
log
.
info
(
"Before compare billable status::"
);
log
.
info
(
"Existing Resource:::"
+
existingResource
);
log
.
info
(
"Resource Request Details::"
+
resourceReq
);
// Handling Resource Project Billability Status change
// Handling Resource Project Billability Status change
if
(
resource
.
getBillableStatus
()
!=
null
&&
existingTeammat
e
.
getBillableStatus
()
!=
null
if
(
resource
Req
.
getBillableStatus
()
!=
null
&&
existingResourc
e
.
getBillableStatus
()
!=
null
&&
!
existing
Teammate
.
getBillableStatus
().
equalsIgnoreCase
(
resource
.
getBillableStatus
()))
{
&&
!
existing
Resource
.
getBillableStatus
().
equalsIgnoreCase
(
resourceReq
.
getBillableStatus
()))
{
/*
/*
* List<BillingDetails> bDetailsList =
* List<BillingDetails> bDetailsList =
* teamMatesBillingRepo.findByEmployeeId(projectTeamMate.
* teamMatesBillingRepo.findByEmployeeId(projectTeamMate.
...
@@ -209,20 +218,20 @@ public class ResourceService implements IResourceService {
...
@@ -209,20 +218,20 @@ public class ResourceService implements IResourceService {
* (!e.isActive())).sorted(Comparator.comparing(BillingDetails::
* (!e.isActive())).sorted(Comparator.comparing(BillingDetails::
* getBillingEndDate).reversed()) .collect(Collectors.toList());
* getBillingEndDate).reversed()) .collect(Collectors.toList());
*/
*/
String
result
=
validateBillabilityStartDate
(
listBD
,
resource
);
String
result
=
validateBillabilityStartDate
(
listBD
,
resource
Req
);
if
(
result
!=
null
)
{
// Invalid Billability Start date
if
(
result
!=
null
)
{
// Invalid Billability Start date
return
result
;
return
result
;
}
}
if
(
listBD
!=
null
&&
!
listBD
.
isEmpty
())
{
if
(
listBD
!=
null
&&
!
listBD
.
isEmpty
())
{
Billing
billingDetails
=
listBD
.
get
(
0
);
Billing
billingDetails
=
listBD
.
get
(
0
);
Calendar
cal
=
Calendar
.
getInstance
();
Calendar
cal
=
Calendar
.
getInstance
();
cal
.
setTime
(
resource
.
getNewBillingStartDate
());
cal
.
setTime
(
resource
Req
.
getNewBillingStartDate
());
cal
.
add
(
Calendar
.
DAY_OF_MONTH
,
-
1
);
cal
.
add
(
Calendar
.
DAY_OF_MONTH
,
-
1
);
Date
startDate
=
existing
Teammat
e
.
getNewBillingStartDate
()
!=
null
Date
startDate
=
existing
Resourc
e
.
getNewBillingStartDate
()
!=
null
?
existing
Teammate
.
getNewBillingStartDate
()
:
existingTeammat
e
.
getStartDate
();
?
existing
Resource
.
getNewBillingStartDate
()
:
existingResourc
e
.
getStartDate
();
if
(
startDate
.
getDate
()
==
resource
.
getNewBillingStartDate
().
getDate
())
{
if
(
startDate
.
getDate
()
==
resource
Req
.
getNewBillingStartDate
().
getDate
())
{
billingDetails
.
setBillingEndDate
(
billingDetails
.
setBillingEndDate
(
DateUtils
.
truncate
(
resource
.
getNewBillingStartDate
(),
Calendar
.
DATE
));
DateUtils
.
truncate
(
resource
Req
.
getNewBillingStartDate
(),
Calendar
.
DATE
));
}
else
{
}
else
{
billingDetails
.
setBillingEndDate
(
DateUtils
.
truncate
(
cal
.
getTime
(),
Calendar
.
DATE
));
billingDetails
.
setBillingEndDate
(
DateUtils
.
truncate
(
cal
.
getTime
(),
Calendar
.
DATE
));
}
}
...
@@ -230,41 +239,41 @@ public class ResourceService implements IResourceService {
...
@@ -230,41 +239,41 @@ public class ResourceService implements IResourceService {
billingService
.
updateBilling
(
billingDetails
,
loginEmpId
);
billingService
.
updateBilling
(
billingDetails
,
loginEmpId
);
}
}
Billing
billings
=
new
Billing
();
Billing
billings
=
new
Billing
();
billings
.
setEmployeeId
(
resource
.
getEmployeeId
());
billings
.
setEmployeeId
(
resource
Req
.
getEmployeeId
());
billings
.
setEmployeeName
(
resource
.
getEmployeeName
());
billings
.
setEmployeeName
(
resource
Req
.
getEmployeeName
());
billings
.
setProjectId
(
resource
.
getProjectId
());
billings
.
setProjectId
(
resource
Req
.
getProjectId
());
billings
.
setAccount
(
existing
Teammat
e
.
getAccount
());
billings
.
setAccount
(
existing
Resourc
e
.
getAccount
());
billings
.
setProjectName
(
resource
.
getProjectName
());
billings
.
setProjectName
(
resource
Req
.
getProjectName
());
billings
.
setBillableStatus
(
resource
.
getBillableStatus
());
billings
.
setBillableStatus
(
resource
Req
.
getBillableStatus
());
billings
.
setActive
(
true
);
billings
.
setActive
(
true
);
billings
.
setBillingStartDate
(
DateUtils
.
truncate
(
resource
.
getNewBillingStartDate
(),
Calendar
.
DATE
));
billings
.
setBillingStartDate
(
DateUtils
.
truncate
(
resource
Req
.
getNewBillingStartDate
(),
Calendar
.
DATE
));
billings
.
setBillingEndDate
(
DateUtils
.
truncate
(
resEndDate
,
Calendar
.
DATE
));
billings
.
setBillingEndDate
(
DateUtils
.
truncate
(
resEndDate
,
Calendar
.
DATE
));
// billings.setCreateDate(new Date());// Commented as added
// billings.setCreateDate(new Date());// Commented as added
// common audit fields
// common audit fields
billingService
.
addBilling
(
billings
,
loginEmpId
);
billingService
.
addBilling
(
billings
,
loginEmpId
);
existing
Teammate
.
setBillableStatus
(
resource
.
getBillableStatus
());
existing
Resource
.
setBillableStatus
(
resourceReq
.
getBillableStatus
());
existing
Teammat
e
existing
Resourc
e
.
setNewBillingStartDate
(
DateUtils
.
truncate
(
resource
.
getNewBillingStartDate
(),
Calendar
.
DATE
));
.
setNewBillingStartDate
(
DateUtils
.
truncate
(
resource
Req
.
getNewBillingStartDate
(),
Calendar
.
DATE
));
}
else
{
// Handling Billability Start Date change
}
else
{
// Handling Billability Start Date change
List
<
Billing
>
bDetailsList
=
billingRepo
.
findByEmployeeId
(
resource
.
getEmployeeId
()).
stream
()
List
<
Billing
>
bDetailsList
=
billingRepo
.
findByEmployeeId
(
resource
Req
.
getEmployeeId
()).
stream
()
.
filter
(
e
->
(!
e
.
isActive
()))
.
filter
(
e
->
(!
e
.
isActive
()))
.
sorted
(
Comparator
.
comparing
(
Billing:
:
getBillingEndDate
).
reversed
())
.
sorted
(
Comparator
.
comparing
(
Billing:
:
getBillingEndDate
).
reversed
())
.
collect
(
Collectors
.
toList
());
.
collect
(
Collectors
.
toList
());
String
result
=
validateBillabilityStartDate
(
bDetailsList
,
resource
);
String
result
=
validateBillabilityStartDate
(
bDetailsList
,
resource
Req
);
if
(
result
!=
null
)
{
// Invalid Billability Start date
if
(
result
!=
null
)
{
// Invalid Billability Start date
return
result
;
return
result
;
}
}
if
(
bDetailsList
!=
null
&&
!
bDetailsList
.
isEmpty
())
{
if
(
bDetailsList
!=
null
&&
!
bDetailsList
.
isEmpty
())
{
Calendar
cal
=
Calendar
.
getInstance
();
Calendar
cal
=
Calendar
.
getInstance
();
cal
.
setTime
(
resource
.
getNewBillingStartDate
());
cal
.
setTime
(
resource
Req
.
getNewBillingStartDate
());
cal
.
add
(
Calendar
.
DAY_OF_MONTH
,
-
1
);
cal
.
add
(
Calendar
.
DAY_OF_MONTH
,
-
1
);
Billing
preBillingDetails
=
bDetailsList
.
get
(
0
);
Billing
preBillingDetails
=
bDetailsList
.
get
(
0
);
if
(
preBillingDetails
.
getBillingStartDate
().
getDate
()
==
resource
.
getNewBillingStartDate
()
if
(
preBillingDetails
.
getBillingStartDate
().
getDate
()
==
resource
Req
.
getNewBillingStartDate
()
.
getDate
())
{
.
getDate
())
{
preBillingDetails
.
setBillingEndDate
(
preBillingDetails
.
setBillingEndDate
(
DateUtils
.
truncate
(
resource
.
getNewBillingStartDate
(),
Calendar
.
DATE
));
DateUtils
.
truncate
(
resource
Req
.
getNewBillingStartDate
(),
Calendar
.
DATE
));
}
else
{
}
else
{
preBillingDetails
.
setBillingEndDate
(
DateUtils
.
truncate
(
cal
.
getTime
(),
Calendar
.
DATE
));
preBillingDetails
.
setBillingEndDate
(
DateUtils
.
truncate
(
cal
.
getTime
(),
Calendar
.
DATE
));
}
}
...
@@ -273,46 +282,46 @@ public class ResourceService implements IResourceService {
...
@@ -273,46 +282,46 @@ public class ResourceService implements IResourceService {
if
(
listBD
!=
null
&&
!
listBD
.
isEmpty
())
{
if
(
listBD
!=
null
&&
!
listBD
.
isEmpty
())
{
Billing
billingDetails
=
listBD
.
get
(
0
);
Billing
billingDetails
=
listBD
.
get
(
0
);
billingDetails
billingDetails
.
setBillingStartDate
(
DateUtils
.
truncate
(
resource
.
getNewBillingStartDate
(),
Calendar
.
DATE
));
.
setBillingStartDate
(
DateUtils
.
truncate
(
resource
Req
.
getNewBillingStartDate
(),
Calendar
.
DATE
));
billingDetails
.
setBillingEndDate
(
DateUtils
.
truncate
(
resEndDate
,
Calendar
.
DATE
));
billingDetails
.
setBillingEndDate
(
DateUtils
.
truncate
(
resEndDate
,
Calendar
.
DATE
));
billingService
.
addBilling
(
billingDetails
,
loginEmpId
);
billingService
.
addBilling
(
billingDetails
,
loginEmpId
);
}
}
existing
Teammat
e
existing
Resourc
e
.
setNewBillingStartDate
(
DateUtils
.
truncate
(
resource
.
getNewBillingStartDate
(),
Calendar
.
DATE
));
.
setNewBillingStartDate
(
DateUtils
.
truncate
(
resource
Req
.
getNewBillingStartDate
(),
Calendar
.
DATE
));
}
}
if
(
resEndDate
.
compareTo
(
existing
Teammat
e
.
getEndDate
())
!=
0
)
{
if
(
resEndDate
.
compareTo
(
existing
Resourc
e
.
getEndDate
())
!=
0
)
{
existing
Teammat
e
.
setEndDate
(
resEndDate
);
existing
Resourc
e
.
setEndDate
(
resEndDate
);
}
}
}
}
if
(
MyTeamResultDTO
.
SUCCESS_CODE
.
equals
(
myResultDto
.
getResultCode
()))
{
if
(
MyTeamResultDTO
.
SUCCESS_CODE
.
equals
(
myResultDto
.
getResultCode
()))
{
// Handling Role change
// Handling Role change
if
((
existing
Teammate
.
getRole
()
!=
null
&&
!
existingTeammate
.
getRole
().
equalsIgnoreCase
(
resource
.
getRole
()))
if
((
existing
Resource
.
getRole
()
!=
null
&&
!
existingResource
.
getRole
().
equalsIgnoreCase
(
resourceReq
.
getRole
()))
||
(
resource
.
getRole
()
!=
null
)
||
(
resource
Req
.
getRole
()
!=
null
)
&&
!
resource
.
getRole
().
equalsIgnoreCase
(
existingTeammat
e
.
getRole
()))
{
&&
!
resource
Req
.
getRole
().
equalsIgnoreCase
(
existingResourc
e
.
getRole
()))
{
existing
Teammate
.
setRole
(
resource
.
getRole
());
existing
Resource
.
setRole
(
resourceReq
.
getRole
());
addOrUpdateTeamMateRole
(
resource
.
getRole
(),
resource
.
getProjectId
(),
resource
.
getEmployeeId
(),
true
,
addOrUpdateTeamMateRole
(
resource
Req
.
getRole
(),
resourceReq
.
getProjectId
(),
resourceReq
.
getEmployeeId
(),
true
,
loginEmpId
);
loginEmpId
);
}
}
// Handling Shift change
// Handling Shift change
if
((
existing
Teammat
e
.
getShift
()
!=
null
if
((
existing
Resourc
e
.
getShift
()
!=
null
&&
!
existing
Teammate
.
getShift
().
equalsIgnoreCase
(
resource
.
getShift
()))
&&
!
existing
Resource
.
getShift
().
equalsIgnoreCase
(
resourceReq
.
getShift
()))
||
(
resource
.
getShift
()
!=
null
)
||
(
resource
Req
.
getShift
()
!=
null
)
&&
!
resource
.
getShift
().
equalsIgnoreCase
(
existingTeammat
e
.
getShift
()))
{
&&
!
resource
Req
.
getShift
().
equalsIgnoreCase
(
existingResourc
e
.
getShift
()))
{
empShiftService
.
updateEmployeeShift
(
existing
Teammat
e
,
loginEmpId
);
empShiftService
.
updateEmployeeShift
(
existing
Resourc
e
,
loginEmpId
);
existing
Teammate
.
setShift
(
resource
.
getShift
());
existing
Resource
.
setShift
(
resourceReq
.
getShift
());
Employee
employeeDB
=
employeeRoleRepo
.
findByEmployeeId
(
resource
.
getEmployeeId
());
Employee
employeeDB
=
employeeRoleRepo
.
findByEmployeeId
(
resource
Req
.
getEmployeeId
());
employeeDB
.
setShift
(
resource
.
getShift
());
employeeDB
.
setShift
(
resource
Req
.
getShift
());
employeeDB
.
setModifiedBy
(
loginEmpId
);
employeeDB
.
setModifiedBy
(
loginEmpId
);
employeeDB
.
setLastModifiedOn
(
new
Date
());
employeeDB
.
setLastModifiedOn
(
new
Date
());
employeeRoleRepo
.
save
(
employeeDB
);
employeeRoleRepo
.
save
(
employeeDB
);
}
}
existing
Teammat
e
.
setAuditFields
(
loginEmpId
,
MyTeamUtils
.
UPDATE
);
// Setting
existing
Resourc
e
.
setAuditFields
(
loginEmpId
,
MyTeamUtils
.
UPDATE
);
// Setting
// audit
// audit
// fields
// fields
resourceRepo
.
save
(
existing
Teammat
e
);
resourceRepo
.
save
(
existing
Resourc
e
);
}
}
return
myResultDto
.
getResultData
()[
myResultDto
.
getDataArrayCounter
()];
return
myResultDto
.
getResultData
()[
myResultDto
.
getDataArrayCounter
()];
}
}
...
...
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