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
fed165ca
Commit
fed165ca
authored
May 12, 2019
by
Vijay Akula
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Modified code for all operations in resources as per new db design
parent
3ff7c67b
Changes
18
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
18 changed files
with
1079 additions
and
868 deletions
+1079
-868
BillingController.java
...n/java/com/nisum/myteam/controller/BillingController.java
+2
-3
EmployeeController.java
.../java/com/nisum/myteam/controller/EmployeeController.java
+44
-1
ProjectController.java
...n/java/com/nisum/myteam/controller/ProjectController.java
+2
-17
ResourceAllocationController.java
...nisum/myteam/controller/ResourceAllocationController.java
+176
-147
ResourceController.java
.../java/com/nisum/myteam/controller/ResourceController.java
+22
-57
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
+6
-14
ResourceAllocationRepo.java
...a/com/nisum/myteam/repository/ResourceAllocationRepo.java
+4
-4
IDashboardService.java
...main/java/com/nisum/myteam/service/IDashboardService.java
+6
-1
IEmployeeService.java
src/main/java/com/nisum/myteam/service/IEmployeeService.java
+26
-26
IProjectService.java
src/main/java/com/nisum/myteam/service/IProjectService.java
+16
-18
IResourceAllocationService.java
.../com/nisum/myteam/service/IResourceAllocationService.java
+38
-13
ProjectService.java
...in/java/com/nisum/myteam/service/impl/ProjectService.java
+374
-524
ResourceAllocationService.java
.../nisum/myteam/service/impl/ResourceAllocationService.java
+325
-19
ResourceService.java
...n/java/com/nisum/myteam/service/impl/ResourceService.java
+21
-19
ResourceStatus.java
...ain/java/com/nisum/myteam/statuscodes/ResourceStatus.java
+13
-1
MyTeamUtils.java
src/main/java/com/nisum/myteam/utils/MyTeamUtils.java
+2
-2
No files found.
src/main/java/com/nisum/myteam/controller/BillingController.java
View file @
fed165ca
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
;
...
@@ -12,11 +11,9 @@ import org.springframework.web.bind.annotation.RequestMapping;
...
@@ -12,11 +11,9 @@ 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.exception.handler.MyTeamException
;
import
com.nisum.myteam.model.dao.Billing
;
import
com.nisum.myteam.model.dao.Billing
;
import
com.nisum.myteam.service.IBillingService
;
import
com.nisum.myteam.service.IBillingService
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
@RestController
@RestController
...
@@ -50,6 +47,8 @@ public class BillingController {
...
@@ -50,6 +47,8 @@ public class BillingController {
return
new
ResponseEntity
<>(
null
,
HttpStatus
.
OK
);
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
)
...
...
src/main/java/com/nisum/myteam/controller/EmployeeController.java
View file @
fed165ca
...
@@ -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,6 +40,10 @@ public class EmployeeController {
...
@@ -38,6 +40,10 @@ 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
{
...
@@ -227,6 +233,43 @@ public class EmployeeController {
...
@@ -227,6 +233,43 @@ public class EmployeeController {
return
new
ResponseEntity
<>(
employeesList
,
HttpStatus
.
OK
);
return
new
ResponseEntity
<>(
employeesList
,
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
=
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 @
fed165ca
...
@@ -7,7 +7,6 @@ import com.nisum.myteam.model.dao.Project;
...
@@ -7,7 +7,6 @@ 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.statuscodes.ProjectStatus
;
import
com.nisum.myteam.statuscodes.ProjectStatus
;
import
com.nisum.myteam.utils.MyTeamUtils
;
import
com.nisum.myteam.utils.constants.ApplicationRole
;
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
;
...
@@ -38,7 +37,7 @@ public class ProjectController {
...
@@ -38,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
());
...
@@ -80,7 +79,7 @@ public class ProjectController {
...
@@ -80,7 +79,7 @@ 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
(),
ProjectStatus
.
UPDATE
.
getCode
(),
ResponseDetails
getRespDetails
=
new
ResponseDetails
(
new
Date
(),
ProjectStatus
.
UPDATE
.
getCode
(),
ProjectStatus
.
UPDATE
.
getMessage
(),
"Project Updation Description"
,
null
,
ProjectStatus
.
UPDATE
.
getMessage
(),
"Project Updation Description"
,
null
,
...
@@ -183,21 +182,7 @@ public class ProjectController {
...
@@ -183,21 +182,7 @@ public class ProjectController {
}
}
@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
);
}
}
}
...
...
src/main/java/com/nisum/myteam/controller/ResourceAllocationController.java
View file @
fed165ca
This diff is collapsed.
Click to expand it.
src/main/java/com/nisum/myteam/controller/ResourceController.java
View file @
fed165ca
...
@@ -42,6 +42,7 @@ public class ResourceController {
...
@@ -42,6 +42,7 @@ public class ResourceController {
private
IResourceService
resourceService
;
private
IResourceService
resourceService
;
@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
<?>
createResource
(
@RequestBody
Resource
resourceReq
,
public
ResponseEntity
<?>
createResource
(
@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
{
...
@@ -190,63 +191,27 @@ public class ResourceController {
...
@@ -190,63 +191,27 @@ public class ResourceController {
}
}
@RequestMapping
(
value
=
"resources/unAssignedEmployees"
,
method
=
RequestMethod
.
GET
,
produces
=
MediaType
.
APPLICATION_JSON_VALUE
)
// @RequestMapping(value = "resources/unAssignedEmployees", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public
ResponseEntity
<?>
getUnAssignedEmployees
(
HttpServletRequest
request
)
throws
MyTeamException
{
// public ResponseEntity<?> getUnAssignedEmployees(HttpServletRequest request) throws MyTeamException {
List
<
Employee
>
employeesList
=
projectService
.
getUnAssignedEmployees
();
// List<Employee> employeesList = projectService.getUnAssignedEmployees();
//
ResponseDetails
responseDetails
=
new
ResponseDetails
(
new
Date
(),
602
,
"Resources have been retrieved successfully"
,
// 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
);
// "List of Resources who are not assigned to project", employeesList, request.getRequestURI(), "Resource details", null);
return
new
ResponseEntity
<
ResponseDetails
>(
responseDetails
,
HttpStatus
.
OK
);
// return new ResponseEntity<ResponseDetails>(responseDetails, HttpStatus.OK);
}
// }
//
//
@RequestMapping
(
value
=
"/getEmployeesDashBoard"
,
method
=
RequestMethod
.
GET
,
produces
=
MediaType
.
APPLICATION_JSON_VALUE
)
// @RequestMapping(value = "/resources/getEmployeesDashBoard", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public
ResponseEntity
<?>
getEmployeesDashBoard
(
HttpServletRequest
request
)
throws
MyTeamException
{
// public ResponseEntity<?> getEmployeesDashBoard(HttpServletRequest request) throws MyTeamException {
List
<
EmployeeDashboardVO
>
employeeDashBoardList
=
projectService
.
getEmployeesDashBoard
();
// List<EmployeeDashboardVO> employeeDashBoardList = projectService.getEmployeesDashBoard();
//
ResponseDetails
responseDetails
=
new
ResponseDetails
(
new
Date
(),
602
,
"Resources have been retrieved successfully"
,
// 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 dashboard", employeeDashBoardList, request.getRequestURI(), "Resource details", null);
return
new
ResponseEntity
<
ResponseDetails
>(
responseDetails
,
HttpStatus
.
OK
);
// 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
)
@RequestMapping
(
value
=
"resources/addEmployeeToTeamWithCheck"
,
method
=
RequestMethod
.
POST
,
produces
=
MediaType
.
APPLICATION_JSON_VALUE
,
consumes
=
MediaType
.
APPLICATION_JSON_VALUE
)
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
.
APPLICATION_JSON_VALUE
,
consumes
=
MediaType
.
APPLICATION_JSON_VALUE
)
public
ResponseEntity
<?>
addEmployeeToTeamWithCheck
(
@RequestBody
Resource
resourceReq
,
public
ResponseEntity
<?>
addEmployeeToTeamWithCheck
(
@RequestBody
Resource
resourceReq
,
@RequestParam
(
value
=
"loginEmpId"
)
String
loginEmpId
,
HttpServletRequest
request
)
throws
MyTeamException
{
@RequestParam
(
value
=
"loginEmpId"
)
String
loginEmpId
,
HttpServletRequest
request
)
throws
MyTeamException
{
...
...
src/main/java/com/nisum/myteam/model/dao/Employee.java
View file @
fed165ca
...
@@ -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 @
fed165ca
...
@@ -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
View file @
fed165ca
...
@@ -27,28 +27,20 @@ public class ResourceAllocation extends AuditFields implements Serializable {
...
@@ -27,28 +27,20 @@ public class ResourceAllocation extends AuditFields implements Serializable {
private
String
employeeId
;
private
String
employeeId
;
private
String
projectId
;
private
String
projectId
;
private
String
projectName
;
//
private String projectName;
@DateTimeFormat
(
iso
=
ISO
.
DATE
)
@DateTimeFormat
(
iso
=
ISO
.
DATE
)
private
String
billableStatus
;
private
String
billableStatus
;
@DateTimeFormat
(
iso
=
ISO
.
DATE
)
@DateTimeFormat
(
iso
=
ISO
.
DATE
,
pattern
=
"yyyy-MM-dd'T'HH:mm:ss.SSSX"
)
private
Date
billingStartDate
;
private
Date
billingStartDate
;
@DateTimeFormat
(
iso
=
ISO
.
DATE
)
@DateTimeFormat
(
iso
=
ISO
.
DATE
,
pattern
=
"yyyy-MM-dd'T'HH:mm:ss.SSSX"
)
private
Date
billingEndDate
;
private
Date
billingEndDate
;
// private boolean active;
//private boolean active;
private
String
resourceRole
;
// private String role;
// @DateTimeFormat(iso = ISO.DATE)
// private Date projectStartDate;
//
// @DateTimeFormat(iso = ISO.DATE)
// private Date projectEndDate;
}
}
src/main/java/com/nisum/myteam/repository/ResourceAllocationRepo.java
View file @
fed165ca
...
@@ -11,13 +11,13 @@ import java.util.List;
...
@@ -11,13 +11,13 @@ import java.util.List;
public
interface
ResourceAllocationRepo
public
interface
ResourceAllocationRepo
extends
MongoRepository
<
ResourceAllocation
,
String
>
{
extends
MongoRepository
<
ResourceAllocation
,
String
>
{
List
<
Resource
>
findByProjectId
(
String
projectId
);
List
<
Resource
Allocation
>
findByProjectId
(
String
projectId
);
List
<
Resource
>
findByEmployeeId
(
String
employeeId
);
List
<
Resource
Allocation
>
findByEmployeeId
(
String
employeeId
);
Resource
findById
(
ObjectId
id
);
Resource
Allocation
findById
(
ObjectId
id
);
Resource
findByEmployeeIdAndProjectId
(
String
employeeId
,
String
projectId
);
List
<
ResourceAllocation
>
findByEmployeeIdAndProjectId
(
String
employeeId
,
String
projectId
);
// List<Resource> findByEmployeeIdAndActive(String employeeId, boolean status);
// List<Resource> findByEmployeeIdAndActive(String employeeId, boolean status);
...
...
src/main/java/com/nisum/myteam/service/IDashboardService.java
View file @
fed165ca
package
com
.
nisum
.
myteam
.
service
;
package
com
.
nisum
.
myteam
.
service
;
public
class
IDashboardService
{
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 @
fed165ca
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
{
boolean
isEmployeeExistsById
(
String
employeeId
);
boolean
isEmployeeExistsById
(
String
employeeId
);
Employee
createEmployee
(
Employee
employeeRoles
,
String
empId
)
throws
MyTeamException
;
Employee
updateEmployee
(
Employee
employeeRoles
,
String
empId
);
Employee
createEmployee
(
Employee
employeeRoles
,
String
empId
)
throws
MyTeamException
;
Employee
deleteEmployee
(
String
empId
)
;
Employee
updateEmployee
(
Employee
employeeRoles
,
String
empId
)
;
Employee
updateProfile
(
Employee
employeeRoles
)
throws
MyTeamException
;
Employee
deleteEmployee
(
String
empId
);
Employee
getEmployeeById
(
String
empId
);
Employee
updateProfile
(
Employee
employeeRoles
)
throws
MyTeamException
;
Employee
getEmployeeByEmaillId
(
String
emailId
)
;
Employee
getEmployeeById
(
String
empId
)
;
List
<
Employee
>
getManagers
()
throws
MyTeamException
;
Employee
getEmployeeByEmaillId
(
String
emailId
)
;
List
<
Employee
>
getActiveEmployees
()
throws
MyTeamException
;
List
<
Employee
>
getManagers
()
throws
MyTeamException
;
List
<
Employee
>
getEmployeesByStatus
(
String
status
)
;
List
<
Employee
>
getActiveEmployee
s
()
throws
MyTeamException
;
List
<
Account
>
getAccount
s
()
throws
MyTeamException
;
List
<
Employee
>
getEmployeesByStatus
(
String
status
);
Employee
getEmployeeRoleDataForSearchCriteria
(
String
searchId
,
String
searchAttribute
);
List
<
Account
>
getAccounts
()
throws
MyTeamException
;
List
<
String
>
getEmployeeDetailsForAutocomplete
()
;
Employee
getEmployeeRoleDataForSearchCriteria
(
String
searchId
,
String
searchAttribute
);
List
<
HashMap
<
String
,
String
>>
getDeliveryLeads
(
String
domainId
);
List
<
String
>
getEmployeeDetailsForAutocomplete
(
);
List
<
Employee
>
getEmployeesByFunctionalGrp
(
String
functionalGrp
);
List
<
HashMap
<
String
,
String
>>
getDeliveryLeads
(
String
domainId
);
boolean
verifyEmployeeRole
(
String
empId
,
String
roleName
);
List
<
Employee
>
getEmployeesByFunctionalGrp
(
String
functionalGrp
);
List
<
Employee
>
getEmployeesFromList
(
Set
<
String
>
empIdsSet
);
boolean
verifyEmployeeRole
(
String
empId
,
String
roleName
);
List
<
HashMap
<
String
,
String
>>
getDeliveryManagerMap
(
List
deliveryManagerIdsList
);
List
<
Employee
>
getEmployeesFromList
(
Set
<
String
>
empIdsSet
);
public
List
<
Employee
>
getAllEmployees
();
List
<
HashMap
<
String
,
String
>>
getDeliveryManagerMap
(
List
deliveryManagerIdsList
);
public
List
<
Employee
>
getAllEmployees
();
}
}
src/main/java/com/nisum/myteam/service/IProjectService.java
View file @
fed165ca
...
@@ -16,10 +16,22 @@ public interface IProjectService {
...
@@ -16,10 +16,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,37 +40,23 @@ public interface IProjectService {
...
@@ -28,37 +40,23 @@ 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
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
>
getProjectsForDeliveryLead
(
String
deliveryLeadId
);
public
Project
getProjectByProjectId
(
String
project
Id
);
List
<
Resource
>
getResourcesUnderProject
(
String
emp
Id
);
}
}
src/main/java/com/nisum/myteam/service/IResourceAllocationService.java
View file @
fed165ca
...
@@ -4,6 +4,8 @@ import com.nisum.myteam.exception.handler.MyTeamException;
...
@@ -4,6 +4,8 @@ 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
com.nisum.myteam.model.dao.ResourceAllocation
;
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
org.bson.types.ObjectId
;
import
java.util.HashMap
;
import
java.util.HashMap
;
...
@@ -11,31 +13,54 @@ import java.util.List;
...
@@ -11,31 +13,54 @@ import java.util.List;
public
interface
IResourceAllocationService
{
public
interface
IResourceAllocationService
{
ResourceAllocation
addResourceAllocation
(
ResourceAllocation
resourceAllocation
,
String
loginEmpId
)
throws
MyTeamException
;
ResourceAllocation
addResourceAllocation
(
ResourceAllocation
resourceAllocation
,
String
loginEmpId
)
throws
MyTeamException
;
HashMap
<
String
,
Object
>
updateResource
(
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
);
Resource
deleteResource
(
String
empId
,
String
projectId
,
ObjectId
id
,
String
loginEmpId
);
// Resource save(Resource resource
);
public
List
<
ResourceAllocation
>
getBillingsForEmployee
(
String
empId
);
// void addResources(Employee employee, String loginEmpId);
// void inactivateResource(Employee employeeReq, Employee employeeUpdated, String loginEmp
Id);
public
List
<
ResourceAllocation
>
getBillingsForProject
(
String
empId
,
String
project
Id
);
List
<
ResourceAllocation
>
getResourcesSortByProjectStartDate
(
String
employeeId
);
// List<Resource> getResourcesForProject(String projectId, String status);
// List<Resource> getResourcesForEmploye
e(String empId);
public
List
<
MyProjectAllocationVO
>
getWorkedProjectsForResourc
e
(
String
empId
);
// List<Resource> getResourcesForProject(String projectId);
// List<Resource> getActiveResources(String empId
);
public
List
<
Employee
>
getUnAssignedEmployees
(
);
// List<Resource> getResourcesForActiveProject
s();
public
List
<
ResourceAllocation
>
getAllResource
s
();
// List<Resource> getResourcesForShift(String shift);
// public List<Resource> getResourcesUnderDeliveryLead(String empId);
}
}
src/main/java/com/nisum/myteam/service/impl/ProjectService.java
View file @
fed165ca
This diff is collapsed.
Click to expand it.
src/main/java/com/nisum/myteam/service/impl/ResourceAllocationService.java
View file @
fed165ca
This diff is collapsed.
Click to expand it.
src/main/java/com/nisum/myteam/service/impl/ResourceService.java
View file @
fed165ca
...
@@ -61,7 +61,7 @@ public class ResourceService implements IResourceService {
...
@@ -61,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
);
...
@@ -306,11 +306,11 @@ public class ResourceService implements IResourceService {
...
@@ -306,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
...
@@ -335,15 +335,6 @@ public class ResourceService implements IResourceService {
...
@@ -335,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
)
{
...
@@ -668,17 +659,28 @@ public class ResourceService implements IResourceService {
...
@@ -668,17 +659,28 @@ public class ResourceService implements IResourceService {
}
}
private
String
validateNewProjectAssignmentStartDate
(
List
<
Resource
>
teamMateList
,
Resource
projectTeamMate
)
{
private
String
validateNewProjectAssignmentStartDate
(
List
<
Resource
>
resourceList
,
Resource
resourceReq
)
{
String
response
=
null
;
String
response
=
null
;
if
(
teamMateList
!=
null
&&
teamMat
eList
.
size
()
>
0
)
{
if
(
resourceList
!=
null
&&
resourc
eList
.
size
()
>
0
)
{
Resource
ptMate
=
teamMat
eList
.
get
(
0
);
Resource
resource
=
resourc
eList
.
get
(
0
);
if
(
projectTeamMate
.
getNewBillingStartDate
().
compareTo
(
ptMat
e
.
getEndDate
())
<=
0
)
{
if
(
resourceReq
.
getNewBillingStartDate
().
compareTo
(
resourc
e
.
getEndDate
())
<=
0
)
{
response
=
"Resource Start Date ("
+
projectTeamMate
.
getNewBillingStartDate
()
+
" ) in "
+
projectTeamMate
.
getProjectName
()
response
=
"Resource Start Date ("
+
resourceReq
.
getNewBillingStartDate
()
+
" ) in "
+
resourceReq
.
getProjectName
()
+
" project should be after "
+
ptMate
.
getProjectName
()
+
" project End Date ( "
+
ptMat
e
.
getEndDate
()
+
")."
;
+
" project should be after "
+
resource
.
getProjectName
()
+
" project End Date ( "
+
resourc
e
.
getEndDate
()
+
")."
;
}
}
}
else
{
}
else
{
response
=
validateAgainstDOJ
(
projectTeamMate
);
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
;
return
response
;
}
}
}
}
src/main/java/com/nisum/myteam/statuscodes/ResourceStatus.java
View file @
fed165ca
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/MyTeamUtils.java
View file @
fed165ca
...
@@ -155,8 +155,8 @@ public class MyTeamUtils {
...
@@ -155,8 +155,8 @@ public class MyTeamUtils {
public
final
static
String
PROJECT_START_DATE
=
"ProjectStartDate"
;
public
final
static
String
PROJECT_START_DATE
=
"ProjectStartDate"
;
public
final
static
String
PROJECT_END_DATE
=
"ProjectEndDate"
;
public
final
static
String
PROJECT_END_DATE
=
"ProjectEndDate"
;
public
final
static
String
BILLING_START_DATE
=
"
B
illingStartDate"
;
public
final
static
String
BILLING_START_DATE
=
"
b
illingStartDate"
;
public
final
static
String
BILLING_END_DATE
=
"
B
illingEndDate"
;
public
final
static
String
BILLING_END_DATE
=
"
b
illingEndDate"
;
}
}
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