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
01fb8bfb
Commit
01fb8bfb
authored
May 13, 2019
by
Vijay Akula
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Commented the ResourceController in order to take requests from new controller
parent
fed165ca
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
313 additions
and
313 deletions
+313
-313
BillingController.java
...n/java/com/nisum/myteam/controller/BillingController.java
+68
-68
DashboardController.java
...java/com/nisum/myteam/controller/DashboardController.java
+1
-1
ResourceAllocationController.java
...nisum/myteam/controller/ResourceAllocationController.java
+12
-12
ResourceController.java
.../java/com/nisum/myteam/controller/ResourceController.java
+222
-222
ResourceRepo.java
src/main/java/com/nisum/myteam/repository/ResourceRepo.java
+1
-1
ResourceService.java
...n/java/com/nisum/myteam/service/impl/ResourceService.java
+9
-9
No files found.
src/main/java/com/nisum/myteam/controller/BillingController.java
View file @
01fb8bfb
package
com
.
nisum
.
myteam
.
controller
;
import
java.util.List
;
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.RequestParam
;
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.service.IBillingService
;
import
lombok.extern.slf4j.Slf4j
;
@RestController
@Slf4j
public
class
BillingController
{
@Autowired
private
IBillingService
billingService
;
// @RequestMapping(value = "/addEmployeeBilling"
@RequestMapping
(
value
=
"/billing"
,
method
=
RequestMethod
.
POST
,
produces
=
MediaType
.
APPLICATION_JSON_VALUE
,
consumes
=
MediaType
.
APPLICATION_JSON_VALUE
)
public
ResponseEntity
<
Billing
>
addEmployeeBilling
(
@RequestBody
Billing
billing
,
@RequestParam
(
value
=
"loginEmpId"
)
String
loginEmpId
)
throws
MyTeamException
{
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
,
@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
{
billingService
.
deleteBilling
(
billing
);
return
new
ResponseEntity
<>(
null
,
HttpStatus
.
OK
);
}
// @RequestMapping(value = "/getEmployeeBillingDetailsAll"
@RequestMapping
(
value
=
"/billing"
,
method
=
RequestMethod
.
GET
,
produces
=
MediaType
.
APPLICATION_JSON_VALUE
)
public
ResponseEntity
<
List
<
Billing
>>
getAllBillingsForEmployee
(
@RequestParam
(
"employeeId"
)
String
employeeId
)
throws
MyTeamException
{
List
<
Billing
>
billingList
=
billingService
.
getBillingsForEmployee
(
employeeId
);
return
new
ResponseEntity
<>(
billingList
,
HttpStatus
.
OK
);
}
// @RequestMapping(value = "/getEmployeeBillingDetails"
@RequestMapping
(
value
=
"/billing/project/{projectId}"
,
method
=
RequestMethod
.
GET
,
produces
=
MediaType
.
APPLICATION_JSON_VALUE
)
public
ResponseEntity
<
List
<
Billing
>>
getBillingsForProject
(
@PathVariable
(
"projectId"
)
String
projectId
,
@RequestParam
(
"employeeId"
)
String
employeeId
)
throws
MyTeamException
{
List
<
Billing
>
billingList
=
billingService
.
getBillingsForProject
(
employeeId
,
projectId
);
return
new
ResponseEntity
<>(
billingList
,
HttpStatus
.
OK
);
}
}
//
package com.nisum.myteam.controller;
//
//
import java.util.List;
//
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.RequestParam;
//
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.service.IBillingService;
//
import lombok.extern.slf4j.Slf4j;
//
//
@RestController
//
@Slf4j
//
public class BillingController {
//
//
@Autowired
//
private IBillingService billingService;
//
//
// @RequestMapping(value = "/addEmployeeBilling"
//
@RequestMapping(value = "/billing", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
//
public ResponseEntity<Billing> addEmployeeBilling(@RequestBody Billing billing,
//
@RequestParam(value = "loginEmpId") String loginEmpId) throws MyTeamException {
//
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,
//
@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 {
//
billingService.deleteBilling(billing);
//
return new ResponseEntity<>(null, HttpStatus.OK);
//
}
//
//
//
//
// @RequestMapping(value = "/getEmployeeBillingDetailsAll"
//
@RequestMapping(value = "/billing", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
//
public ResponseEntity<List<Billing>> getAllBillingsForEmployee(@RequestParam("employeeId") String employeeId)
//
throws MyTeamException {
//
List<Billing> billingList = billingService.getBillingsForEmployee(employeeId);
//
return new ResponseEntity<>(billingList, HttpStatus.OK);
//
}
//
//
// @RequestMapping(value = "/getEmployeeBillingDetails"
//
@RequestMapping(value = "/billing/project/{projectId}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
//
public ResponseEntity<List<Billing>> getBillingsForProject(@PathVariable("projectId") String projectId,
//
@RequestParam("employeeId") String employeeId) throws MyTeamException {
//
List<Billing> billingList = billingService.getBillingsForProject(employeeId, projectId);
//
return new ResponseEntity<>(billingList, HttpStatus.OK);
//
}
//
//
}
src/main/java/com/nisum/myteam/controller/DashboardController.java
View file @
01fb8bfb
...
...
@@ -25,7 +25,7 @@ public class DashboardController {
@Autowired
private
IDashboardService
dashboardService
;
@RequestMapping
(
value
=
"/resource
Allocation
/getEmployeesDashBoard"
,
method
=
RequestMethod
.
GET
,
produces
=
MediaType
.
APPLICATION_JSON_VALUE
)
@RequestMapping
(
value
=
"/resource
s
/getEmployeesDashBoard"
,
method
=
RequestMethod
.
GET
,
produces
=
MediaType
.
APPLICATION_JSON_VALUE
)
public
ResponseEntity
<?>
getEmployeesDashBoard
(
HttpServletRequest
request
)
throws
MyTeamException
{
List
<
EmployeeDashboardVO
>
employeeDashBoardList
=
dashboardService
.
getEmployeesDashBoard
();
...
...
src/main/java/com/nisum/myteam/controller/ResourceAllocationController.java
View file @
01fb8bfb
...
...
@@ -41,7 +41,7 @@ public class ResourceAllocationController {
private
ResourceAllocationService
resourceAllocService
;
//tested in all the cases.ok
@RequestMapping
(
value
=
"/resource
Allocation
"
,
method
=
RequestMethod
.
POST
,
produces
=
MediaType
.
APPLICATION_JSON_VALUE
,
consumes
=
MediaType
.
APPLICATION_JSON_VALUE
)
@RequestMapping
(
value
=
"/resource
s
"
,
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
))
{
...
...
@@ -73,7 +73,7 @@ public class ResourceAllocationController {
}
//tested in all the cases.ok
@RequestMapping
(
value
=
"/resource
Allocation
"
,
method
=
RequestMethod
.
PUT
,
produces
=
MediaType
.
APPLICATION_JSON_VALUE
,
consumes
=
MediaType
.
APPLICATION_JSON_VALUE
)
@RequestMapping
(
value
=
"/resource
s
"
,
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
{
...
...
@@ -95,7 +95,7 @@ public class ResourceAllocationController {
}
//Tested Ok
@RequestMapping
(
value
=
"/resource
Allocation
"
,
method
=
RequestMethod
.
DELETE
,
produces
=
MediaType
.
APPLICATION_JSON_VALUE
,
consumes
=
MediaType
.
APPLICATION_JSON_VALUE
)
@RequestMapping
(
value
=
"/resource
s
"
,
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
))
{
...
...
@@ -115,7 +115,7 @@ public class ResourceAllocationController {
//Ok Tested in all of the cases
@RequestMapping
(
value
=
"/resource
Allocation
/project/{projectId}"
,
method
=
RequestMethod
.
GET
,
produces
=
MediaType
.
APPLICATION_JSON_VALUE
)
@RequestMapping
(
value
=
"/resource
s
/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
)
...
...
@@ -135,7 +135,7 @@ public class ResourceAllocationController {
//ok
///getMyProjectAllocations
@RequestMapping
(
value
=
"/resource
Allocation
/getMyProjectAllocations"
,
method
=
RequestMethod
.
GET
,
produces
=
MediaType
.
APPLICATION_JSON_VALUE
)
@RequestMapping
(
value
=
"/resource
s
/getMyProjectAllocations"
,
method
=
RequestMethod
.
GET
,
produces
=
MediaType
.
APPLICATION_JSON_VALUE
)
public
ResponseEntity
<?>
getMyProjectAllocations
(
@RequestParam
(
"employeeId"
)
String
employeeId
,
HttpServletRequest
request
)
throws
MyTeamException
{
...
...
@@ -155,7 +155,7 @@ public class ResourceAllocationController {
//ok
///resourceAllocation/projects has to be changed to /resourceAllocation/activeProjects
@RequestMapping
(
value
=
"/resource
Allocation
/projects"
,
method
=
RequestMethod
.
GET
,
produces
=
MediaType
.
APPLICATION_JSON_VALUE
)
@RequestMapping
(
value
=
"/resource
s
/projects"
,
method
=
RequestMethod
.
GET
,
produces
=
MediaType
.
APPLICATION_JSON_VALUE
)
public
ResponseEntity
<?>
getResourcesAllocatedForAllProjects
(
HttpServletRequest
request
)
throws
MyTeamException
{
List
<
ResourceAllocation
>
resourcesList
=
resourceAllocService
.
getAllResourcesForAllActiveProjects
();
...
...
@@ -167,7 +167,7 @@ public class ResourceAllocationController {
//ok //Getting Current active resource record
@RequestMapping
(
value
=
"/resource
Allocation
/employeeId/{employeeId}"
,
method
=
RequestMethod
.
GET
,
produces
=
MediaType
.
APPLICATION_JSON_VALUE
)
@RequestMapping
(
value
=
"/resource
s
/employeeId/{employeeId}"
,
method
=
RequestMethod
.
GET
,
produces
=
MediaType
.
APPLICATION_JSON_VALUE
)
public
ResponseEntity
<?>
getResourcesSortByProjectStartDate
(
@PathVariable
(
value
=
"employeeId"
,
required
=
true
)
String
employeeId
,
HttpServletRequest
request
)
throws
MyTeamException
{
...
...
@@ -186,7 +186,7 @@ public class ResourceAllocationController {
//ok tested
@RequestMapping
(
value
=
"/resource
Allocation
/active"
,
method
=
RequestMethod
.
GET
,
produces
=
MediaType
.
APPLICATION_JSON_VALUE
)
@RequestMapping
(
value
=
"/resource
s
/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
))
{
...
...
@@ -205,7 +205,7 @@ public class ResourceAllocationController {
//ok working
@RequestMapping
(
value
=
"/resource
Allocation
/deliverylead/{deliveryLeadId}"
,
method
=
RequestMethod
.
GET
,
produces
=
MediaType
.
APPLICATION_JSON_VALUE
)
@RequestMapping
(
value
=
"/resource
s
/deliverylead/{deliveryLeadId}"
,
method
=
RequestMethod
.
GET
,
produces
=
MediaType
.
APPLICATION_JSON_VALUE
)
public
ResponseEntity
<?>
getTeamDetails
(
@PathVariable
(
value
=
"deliveryLeadId"
,
required
=
true
)
String
deliveryLeadId
,
HttpServletRequest
request
)
throws
MyTeamException
{
...
...
@@ -224,7 +224,7 @@ public class ResourceAllocationController {
}
//ok tested working
@RequestMapping
(
value
=
"/resource
Allocation
/unAssignedEmployees"
,
method
=
RequestMethod
.
GET
,
produces
=
MediaType
.
APPLICATION_JSON_VALUE
)
@RequestMapping
(
value
=
"/resource
s
/unAssignedEmployees"
,
method
=
RequestMethod
.
GET
,
produces
=
MediaType
.
APPLICATION_JSON_VALUE
)
public
ResponseEntity
<?>
getUnAssignedEmployees
(
HttpServletRequest
request
)
throws
MyTeamException
{
List
<
Employee
>
employeesList
=
resourceAllocService
.
getUnAssignedEmployees
();
...
...
@@ -235,7 +235,7 @@ public class ResourceAllocationController {
//@RequestMapping(value = "/getEmployeeBillingDetailsAll"
@RequestMapping
(
value
=
"/resource
Allocation
/billing"
,
method
=
RequestMethod
.
GET
,
produces
=
MediaType
.
APPLICATION_JSON_VALUE
)
@RequestMapping
(
value
=
"/resource
s
/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
);
...
...
@@ -243,7 +243,7 @@ public class ResourceAllocationController {
}
// @RequestMapping(value = "/getEmployeeBillingDetails"
@RequestMapping
(
value
=
"/resource
Allocation
/billing/project/{projectId}"
,
method
=
RequestMethod
.
GET
,
produces
=
MediaType
.
APPLICATION_JSON_VALUE
)
@RequestMapping
(
value
=
"/resource
s
/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
);
...
...
src/main/java/com/nisum/myteam/controller/ResourceController.java
View file @
01fb8bfb
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.EmployeeVisa
;
import
com.nisum.myteam.model.dao.Resource
;
import
com.nisum.myteam.model.vo.EmployeeDashboardVO
;
import
com.nisum.myteam.repository.EmployeeVisaRepo
;
import
com.nisum.myteam.service.IEmployeeService
;
import
com.nisum.myteam.service.IProjectService
;
import
com.nisum.myteam.service.IResourceService
;
import
com.nisum.myteam.utils.MyTeamUtils
;
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.ArrayList
;
import
java.util.Date
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.stream.Collectors
;
@RestController
@RequestMapping
public
class
ResourceController
{
@Autowired
private
IEmployeeService
employeeService
;
@Autowired
private
IProjectService
projectService
;
@Autowired
private
EmployeeVisaRepo
employeeVisaRepo
;
@Autowired
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
,
@RequestParam
(
value
=
"loginEmpId"
,
required
=
true
)
String
loginEmpId
,
HttpServletRequest
request
)
throws
MyTeamException
{
if
(
StringUtils
.
isNotBlank
(
loginEmpId
))
{
resourceReq
.
setActive
(
true
);
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
);
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
);
}
@RequestMapping
(
value
=
"/resources"
,
method
=
RequestMethod
.
PUT
,
produces
=
MediaType
.
APPLICATION_JSON_VALUE
,
consumes
=
MediaType
.
APPLICATION_JSON_VALUE
)
public
ResponseEntity
<?>
updateResource
(
@RequestBody
Resource
resourceReq
,
@RequestParam
(
value
=
"loginEmpId"
)
String
loginEmpId
,
HttpServletRequest
request
)
throws
MyTeamException
{
if
(
StringUtils
.
isNotBlank
(
loginEmpId
))
{
resourceReq
.
setAuditFields
(
loginEmpId
,
MyTeamUtils
.
UPDATE
);
String
responseMessage
=
resourceService
.
updateResource
(
resourceReq
,
loginEmpId
);
ResponseDetails
createResponseDetails
=
new
ResponseDetails
(
new
Date
(),
601
,
responseMessage
,
"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
);
}
@RequestMapping
(
value
=
"/resources"
,
method
=
RequestMethod
.
DELETE
,
produces
=
MediaType
.
APPLICATION_JSON_VALUE
,
consumes
=
MediaType
.
APPLICATION_JSON_VALUE
)
public
ResponseEntity
<?>
deleteResource
(
@RequestBody
Resource
resourceReq
,
@RequestParam
(
value
=
"loginEmpId"
,
required
=
true
)
String
loginEmpId
,
HttpServletRequest
request
)
throws
MyTeamException
{
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
);
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
);
}
@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
)
throws
MyTeamException
{
if
(
StringUtils
.
isNotBlank
(
employeeId
))
{
List
<
Resource
>
resourcesList
=
resourceService
.
getResourcesSortByStartDate
(
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
);
}
@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
<
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
);
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
);
}
@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
=
"/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 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
,
@RequestParam
(
value
=
"status"
,
required
=
false
,
defaultValue
=
MyTeamUtils
.
ACTIVE
)
String
status
,
HttpServletRequest
request
)
throws
MyTeamException
{
if
(
StringUtils
.
isNotBlank
(
projectId
))
{
List
<
Resource
>
resourcesList
=
resourceService
.
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
);
}
@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
<
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
,
"Please provide Valid Delivery Lead Id"
,
"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 {
// List<Employee> employeesList = projectService.getUnAssignedEmployees();
//package com.nisum.myteam.controller;
//
// 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);
//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.EmployeeVisa;
//import com.nisum.myteam.model.dao.Resource;
//import com.nisum.myteam.model.vo.EmployeeDashboardVO;
//import com.nisum.myteam.repository.EmployeeVisaRepo;
//import com.nisum.myteam.service.IEmployeeService;
//import com.nisum.myteam.service.IProjectService;
//import com.nisum.myteam.service.IResourceService;
//import com.nisum.myteam.utils.MyTeamUtils;
//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.ArrayList;
//import java.util.Date;
//import java.util.HashMap;
//import java.util.List;
//import java.util.stream.Collectors;
//
//@RestController
//@RequestMapping
//public class ResourceController {
//
// @Autowired
// private IEmployeeService employeeService;
//
// @Autowired
// private IProjectService projectService;
//
// @Autowired
// private EmployeeVisaRepo employeeVisaRepo;
//
// @Autowired
// 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,
// @RequestParam(value = "loginEmpId", required = true) String loginEmpId, HttpServletRequest request) throws MyTeamException {
// if (StringUtils.isNotBlank(loginEmpId)) {
// resourceReq.setActive(true);
// 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);
// 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);
//
// }
//
// @RequestMapping(value = "/resources", method = RequestMethod.PUT, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
// public ResponseEntity<?> updateResource(@RequestBody Resource resourceReq,
// @RequestParam(value = "loginEmpId") String loginEmpId, HttpServletRequest request) throws MyTeamException {
//
// if (StringUtils.isNotBlank(loginEmpId)) {
// resourceReq.setAuditFields(loginEmpId, MyTeamUtils.UPDATE);
// String responseMessage = resourceService.updateResource(resourceReq, loginEmpId);
// ResponseDetails createResponseDetails = new ResponseDetails(new Date(), 601, responseMessage,
// "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);
// }
//
// @RequestMapping(value = "/resources", method = RequestMethod.DELETE, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
// public ResponseEntity<?> deleteResource(@RequestBody Resource resourceReq,
// @RequestParam(value = "loginEmpId", required = true) String loginEmpId, HttpServletRequest request) throws MyTeamException {
// 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);
// 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);
// }
//
// @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)
// throws MyTeamException {
//
// if (StringUtils.isNotBlank(employeeId)) {
// List<Resource> resourcesList = resourceService.getResourcesSortByStartDate(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);
//
// }
//
// @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<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);
// 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);
// }
//
//
// @RequestMapping(value = "/resources/getEmployeesDashBoard", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
// public ResponseEntity<?> getEmployeesDashBoard(HttpServletRequest request) throws MyTeamException {
// List<EmployeeDashboardVO> employeeDashBoardList = projectService.getEmployeesDashBoard();
// @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 = "/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 of Resources for dashboard", employeeDashBoardList, request.getRequestURI(), "Resource details", null);
// "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,
// @RequestParam(value = "status", required = false, defaultValue = MyTeamUtils.ACTIVE) String status,
// HttpServletRequest request)
// throws MyTeamException {
//
// if (StringUtils.isNotBlank(projectId)) {
// List<Resource> resourcesList = resourceService.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);
// }
@RequestMapping
(
value
=
"resources/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
=
resourceService
.
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
);
}
}
//
//
// @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<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, "Please provide Valid Delivery Lead Id",
// "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 {
//// 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 = "/resources/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 = "resources/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 = resourceService.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/repository/ResourceRepo.java
View file @
01fb8bfb
...
...
@@ -24,6 +24,6 @@ public interface ResourceRepo
List
<
Resource
>
findByEmployeeIdAndProjectIdAndActive
(
String
employeeId
,
String
projectId
,
boolean
status
);
List
<
Resource
>
findByAccountAndActiveAndBillableStatus
(
String
account
,
boolean
status
,
String
billableStatus
);
Optional
<
List
<
Resource
>>
findByActiveAndShiftLikeOrderByEmployeeIdDesc
(
boolean
active
,
String
shift
);
}
src/main/java/com/nisum/myteam/service/impl/ResourceService.java
View file @
01fb8bfb
...
...
@@ -76,7 +76,7 @@ public class ResourceService implements IResourceService {
resourceReq
.
setAuditFields
(
loginEmpId
,
MyTeamUtils
.
CREATE
);
Resource
resourcePersisted
=
resourceRepo
.
save
(
resourceReq
);
// Get Active billings for Nisum Bench Project.
List
<
Billing
>
listBD
=
billingService
.
getActiveBillings
(
resourcePersisted
.
getEmployeeId
(),
"Nisum0000"
);
...
...
@@ -586,23 +586,23 @@ public class ResourceService implements IResourceService {
return
resourcesList
;
}
@Override
public
List
<
Resource
>
getResourcesUnderDeliveryLead
(
String
deliveryLeadId
)
{
List
<
String
>
projectIdsList
=
new
ArrayList
<>();
List
<
Resource
>
resourcesList
=
new
ArrayList
<>();
List
<
Project
>
projectsList
=
projectRepo
.
findByDeliveryLeadIds
(
deliveryLeadId
);
for
(
Project
project
:
projectsList
)
projectIdsList
.
add
(
project
.
getProjectId
());
Query
query
=
new
Query
(
Criteria
.
where
(
"projectId"
).
in
(
projectIdsList
));
List
<
Resource
>
resourcesListPersisted
=
mongoTemplate
.
find
(
query
,
Resource
.
class
);
for
(
Resource
resource
:
resourcesListPersisted
)
{
if
(!
resource
.
getEmployeeId
().
equals
(
deliveryLeadId
))
resourcesList
.
add
(
resource
);
...
...
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