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
a209b575
Commit
a209b575
authored
Aug 13, 2018
by
Muneer Alam
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Import Employee details defect fixing
parent
2688c5b8
Changes
8
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
86 additions
and
146 deletions
+86
-146
ProjectController.java
...n/java/com/nisum/mytime/controller/ProjectController.java
+6
-3
ProjectTeamController.java
...va/com/nisum/mytime/controller/ProjectTeamController.java
+4
-6
UserController.java
...main/java/com/nisum/mytime/controller/UserController.java
+1
-0
VisaController.java
...main/java/com/nisum/mytime/controller/VisaController.java
+0
-1
ProjectTeamMate.java
src/main/java/com/nisum/mytime/model/ProjectTeamMate.java
+0
-1
ProjectServiceImpl.java
...ain/java/com/nisum/mytime/service/ProjectServiceImpl.java
+22
-52
UserServiceImpl.java
src/main/java/com/nisum/mytime/service/UserServiceImpl.java
+48
-77
VisaServiceImpl.java
src/main/java/com/nisum/mytime/service/VisaServiceImpl.java
+5
-6
No files found.
src/main/java/com/nisum/mytime/controller/ProjectController.java
View file @
a209b575
...
@@ -84,10 +84,13 @@ public class ProjectController {
...
@@ -84,10 +84,13 @@ public class ProjectController {
if
(
project
.
getAccountId
()
!=
null
)
{
if
(
project
.
getAccountId
()
!=
null
)
{
List
<
Project
>
projects
=
projectRepo
.
findByAccountId
(
project
.
getAccountId
());
List
<
Project
>
projects
=
projectRepo
.
findByAccountId
(
project
.
getAccountId
());
for
(
Project
existproject
:
projects
)
{
for
(
Project
existproject
:
projects
)
{
if
(
project
.
getProjectName
().
equalsIgnoreCase
(
existproject
.
getProjectName
()))
if
(
project
.
getProjectName
().
equalsIgnoreCase
(
existproject
.
getProjectName
())
projectNameCount
++;
}
&&
project
.
getProjectId
()
!=
existproject
.
getProjectId
())
{
projectNameCount
++;
}
}
}
if
(
projectNameCount
>
1
)
}
if
(
projectNameCount
>
0
)
{
{
MyTimeException
myTimeException
=
new
MyTimeException
(
"Project name already exist !!! try with new"
);
MyTimeException
myTimeException
=
new
MyTimeException
(
"Project name already exist !!! try with new"
);
return
new
ResponseEntity
<>(
myTimeException
,
HttpStatus
.
OK
);
return
new
ResponseEntity
<>(
myTimeException
,
HttpStatus
.
OK
);
...
...
src/main/java/com/nisum/mytime/controller/ProjectTeamController.java
View file @
a209b575
...
@@ -63,10 +63,9 @@ public class ProjectTeamController {
...
@@ -63,10 +63,9 @@ public class ProjectTeamController {
@RequestMapping
(
value
=
"/updateEmployeeRole"
,
method
=
RequestMethod
.
POST
,
@RequestMapping
(
value
=
"/updateEmployeeRole"
,
method
=
RequestMethod
.
POST
,
produces
=
MediaType
.
APPLICATION_JSON_VALUE
,
produces
=
MediaType
.
APPLICATION_JSON_VALUE
,
consumes
=
MediaType
.
APPLICATION_JSON_VALUE
)
consumes
=
MediaType
.
APPLICATION_JSON_VALUE
)
public
ResponseEntity
<
EmployeeRoles
>
updateEmployeeRole
(
public
ResponseEntity
<
EmployeeRoles
>
updateEmployeeRole
(
@RequestBody
EmployeeRoles
employeeRoles
,
@RequestBody
EmployeeRoles
employeeRoles
)
throws
MyTimeException
{
@RequestParam
(
value
=
"empId"
)
String
loginEmpId
)
throws
MyTimeException
{
EmployeeRoles
employeeRole
=
userService
EmployeeRoles
employeeRole
=
userService
.
updateEmployeeRole
(
employeeRoles
,
loginEmpId
);
.
updateEmployeeRole
(
employeeRoles
);
return
new
ResponseEntity
<>(
employeeRole
,
HttpStatus
.
OK
);
return
new
ResponseEntity
<>(
employeeRole
,
HttpStatus
.
OK
);
}
}
...
@@ -138,8 +137,7 @@ public class ProjectTeamController {
...
@@ -138,8 +137,7 @@ public class ProjectTeamController {
projectController.addProject(project);
projectController.addProject(project);
}*/
}*/
ProjectTeamMate
teamMateDB
=
projectService
ProjectTeamMate
teamMateDB
=
projectService
.
addProjectTeamMate
(
teamMate
);
.
addProjectTeamMate
(
teamMate
);
return
new
ResponseEntity
<>(
teamMateDB
,
HttpStatus
.
OK
);
return
new
ResponseEntity
<>(
teamMateDB
,
HttpStatus
.
OK
);
}
}
...
...
src/main/java/com/nisum/mytime/controller/UserController.java
View file @
a209b575
...
@@ -190,6 +190,7 @@ public class UserController {
...
@@ -190,6 +190,7 @@ public class UserController {
public
ResponseEntity
<
List
<
Account
>>
getAccounts
()
throws
MyTimeException
{
public
ResponseEntity
<
List
<
Account
>>
getAccounts
()
throws
MyTimeException
{
List
<
Account
>
technologies
=
userService
.
getAccounts
().
stream
()
List
<
Account
>
technologies
=
userService
.
getAccounts
().
stream
()
.
filter
(
e
->
"Y"
.
equalsIgnoreCase
(
e
.
getStatus
()))
.
filter
(
e
->
"Y"
.
equalsIgnoreCase
(
e
.
getStatus
()))
.
filter
(
a
->
!(
"Nisum India"
.
equalsIgnoreCase
(
a
.
getAccountName
())))
// .map(Account::getAccountName).sorted()
// .map(Account::getAccountName).sorted()
.
collect
(
Collectors
.
toList
());
.
collect
(
Collectors
.
toList
());
return
new
ResponseEntity
<>(
technologies
,
HttpStatus
.
OK
);
return
new
ResponseEntity
<>(
technologies
,
HttpStatus
.
OK
);
...
...
src/main/java/com/nisum/mytime/controller/VisaController.java
View file @
a209b575
...
@@ -18,7 +18,6 @@ import com.nisum.mytime.model.EmployeeVisa;
...
@@ -18,7 +18,6 @@ import com.nisum.mytime.model.EmployeeVisa;
import
com.nisum.mytime.model.TravelRequest
;
import
com.nisum.mytime.model.TravelRequest
;
import
com.nisum.mytime.model.Visa
;
import
com.nisum.mytime.model.Visa
;
import
com.nisum.mytime.service.VisaService
;
import
com.nisum.mytime.service.VisaService
;
import
com.nisum.mytime.utils.MyTimeUtils
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
...
...
src/main/java/com/nisum/mytime/model/ProjectTeamMate.java
View file @
a209b575
...
@@ -2,7 +2,6 @@ package com.nisum.mytime.model;
...
@@ -2,7 +2,6 @@ package com.nisum.mytime.model;
import
java.io.Serializable
;
import
java.io.Serializable
;
import
java.util.Date
;
import
java.util.Date
;
import
java.util.List
;
import
org.bson.types.ObjectId
;
import
org.bson.types.ObjectId
;
import
org.springframework.data.annotation.Id
;
import
org.springframework.data.annotation.Id
;
...
...
src/main/java/com/nisum/mytime/service/ProjectServiceImpl.java
View file @
a209b575
...
@@ -328,23 +328,19 @@ public class ProjectServiceImpl implements ProjectService {
...
@@ -328,23 +328,19 @@ public class ProjectServiceImpl implements ProjectService {
@Override
@Override
public
ProjectTeamMate
addProjectTeamMate
(
ProjectTeamMate
projectTeamMate
)
public
ProjectTeamMate
addProjectTeamMate
(
ProjectTeamMate
projectTeamMate
)
throws
MyTimeException
{
throws
MyTimeException
{
if
(
projectTeamMate
.
getRole
()
!=
null
if
(
projectTeamMate
.
getRole
()
!=
null
&&
projectTeamMate
.
getRole
().
equals
(
"Lead"
))
{
&&
projectTeamMate
.
getRole
().
equals
(
"Lead"
))
{
Project
project
=
projectRepo
.
findByProjectId
(
projectTeamMate
.
getProjectId
());
Project
project
=
projectRepo
.
findByProjectId
(
projectTeamMate
.
getProjectId
());
// project.getManagerIds().add(projectTeamMate.getEmployeeId());
// project.getManagerIds().add(projectTeamMate.getEmployeeId());
if
(
project
.
getManagerIds
()
!=
null
)
if
(
project
.
getManagerIds
()
!=
null
)
project
.
getManagerIds
().
add
(
projectTeamMate
.
getEmployeeId
());
project
.
getManagerIds
().
add
(
projectTeamMate
.
getEmployeeId
());
else
else
project
.
setManagerIds
(
project
.
setManagerIds
(
Arrays
.
asList
(
projectTeamMate
.
getEmployeeId
()));
Arrays
.
asList
(
projectTeamMate
.
getEmployeeId
()));
projectRepo
.
save
(
project
);
projectRepo
.
save
(
project
);
}
}
updateProjectEndDateInProjectTeamMate
(
projectTeamMate
);
updateProjectEndDateInProjectTeamMate
(
projectTeamMate
);
ProjectTeamMate
pT
=
projectTeamMatesRepo
.
save
(
projectTeamMate
);
ProjectTeamMate
pT
=
projectTeamMatesRepo
.
save
(
projectTeamMate
);
List
<
BillingDetails
>
listBD
=
getEmployeeActiveNisumBench
(
List
<
BillingDetails
>
listBD
=
getEmployeeActiveNisumBench
(
pT
.
getEmployeeId
());
pT
.
getEmployeeId
());
for
(
BillingDetails
b
:
listBD
)
{
for
(
BillingDetails
b
:
listBD
)
{
Date
d
=
pT
.
getStartDate
()
!=
null
?
pT
.
getStartDate
()
:
new
Date
();
Date
d
=
pT
.
getStartDate
()
!=
null
?
pT
.
getStartDate
()
:
new
Date
();
b
.
setBillingEndDate
(
DateUtils
.
truncate
(
DateUtils
.
addDays
(
d
,
-
1
),
b
.
setBillingEndDate
(
DateUtils
.
truncate
(
DateUtils
.
addDays
(
d
,
-
1
),
...
@@ -359,7 +355,7 @@ public class ProjectServiceImpl implements ProjectService {
...
@@ -359,7 +355,7 @@ public class ProjectServiceImpl implements ProjectService {
billings
.
setProjectName
(
pT
.
getProjectName
());
billings
.
setProjectName
(
pT
.
getProjectName
());
billings
.
setBillableStatus
(
pT
.
getBillableStatus
());
billings
.
setBillableStatus
(
pT
.
getBillableStatus
());
billings
.
setAccount
(
pT
.
getAccount
());
billings
.
setAccount
(
pT
.
getAccount
());
billings
.
setActive
(
true
);
billings
.
setActive
(
pT
.
isActive
()
);
if
(
pT
.
getProjectId
().
equals
(
MyTimeUtils
.
BENCH_PROJECT_ID
))
if
(
pT
.
getProjectId
().
equals
(
MyTimeUtils
.
BENCH_PROJECT_ID
))
{
{
billings
.
setBillingStartDate
(
pT
.
getStartDate
()
==
null
billings
.
setBillingStartDate
(
pT
.
getStartDate
()
==
null
...
@@ -556,11 +552,12 @@ public class ProjectServiceImpl implements ProjectService {
...
@@ -556,11 +552,12 @@ public class ProjectServiceImpl implements ProjectService {
public
void
addShiftDetails
(
ProjectTeamMate
projectTeamMate
)
{
public
void
addShiftDetails
(
ProjectTeamMate
projectTeamMate
)
{
EmpShiftDetails
empShiftDetails
=
new
EmpShiftDetails
();
EmpShiftDetails
empShiftDetails
=
new
EmpShiftDetails
();
empShiftDetails
.
setCreateDate
(
new
Date
());
empShiftDetails
.
setUpdatedDate
(
new
Date
());
empShiftDetails
.
setUpdatedDate
(
new
Date
());
empShiftDetails
.
setEmployeeName
(
projectTeamMate
.
getEmployeeName
());
empShiftDetails
.
setEmployeeName
(
projectTeamMate
.
getEmployeeName
());
empShiftDetails
.
setEmployeeId
(
projectTeamMate
.
getEmployeeId
());
empShiftDetails
.
setEmployeeId
(
projectTeamMate
.
getEmployeeId
());
empShiftDetails
.
setShift
(
projectTeamMate
.
getShift
());
empShiftDetails
.
setShift
(
projectTeamMate
.
getShift
());
empShiftDetails
.
setActive
(
true
);
empShiftDetails
.
setActive
(
projectTeamMate
.
isActive
()
);
empShiftDetailsRepo
.
save
(
empShiftDetails
);
empShiftDetailsRepo
.
save
(
empShiftDetails
);
}
}
...
@@ -705,20 +702,6 @@ public class ProjectServiceImpl implements ProjectService {
...
@@ -705,20 +702,6 @@ public class ProjectServiceImpl implements ProjectService {
public
List
<
ProjectTeamMate
>
getProjectDetails
(
String
projectId
,
String
statusFlag
)
{
public
List
<
ProjectTeamMate
>
getProjectDetails
(
String
projectId
,
String
statusFlag
)
{
List
<
ProjectTeamMate
>
teamMatesList
=
new
ArrayList
<>();
List
<
ProjectTeamMate
>
teamMatesList
=
new
ArrayList
<>();
List
<
ProjectTeamMate
>
teamMates
=
projectTeamMatesRepo
.
findByProjectId
(
projectId
);
List
<
ProjectTeamMate
>
teamMates
=
projectTeamMatesRepo
.
findByProjectId
(
projectId
);
if
(
projectId
.
equals
(
MyTimeUtils
.
BENCH_PROJECT_ID
))
{
for
(
ProjectTeamMate
projectTeamMate
:
teamMates
)
{
if
(
statusFlag
.
equals
(
MyTimeUtils
.
ACTIVE
)
&&
projectTeamMate
.
getEndDate
()==
null
)
teamMatesList
.
add
(
projectTeamMate
);
else
if
(
statusFlag
.
equals
(
MyTimeUtils
.
IN_ACTIVE
)
&&
projectTeamMate
.
getEndDate
()!=
null
)
teamMatesList
.
add
(
projectTeamMate
);
else
if
(
statusFlag
.
equals
(
MyTimeUtils
.
BOTH
))
teamMatesList
.
add
(
projectTeamMate
);
}
}
else
{
for
(
ProjectTeamMate
projectTeamMate
:
teamMates
)
{
for
(
ProjectTeamMate
projectTeamMate
:
teamMates
)
{
if
(
projectTeamMate
.
getEndDate
()
!=
null
)
{
if
(
projectTeamMate
.
getEndDate
()
!=
null
)
{
// Active
// Active
...
@@ -731,9 +714,7 @@ public class ProjectServiceImpl implements ProjectService {
...
@@ -731,9 +714,7 @@ public class ProjectServiceImpl implements ProjectService {
teamMatesList
.
add
(
projectTeamMate
);
teamMatesList
.
add
(
projectTeamMate
);
}
}
}
}
}
return
teamMatesList
;
return
teamMatesList
;
}
}
@Override
@Override
...
@@ -929,10 +910,8 @@ public class ProjectServiceImpl implements ProjectService {
...
@@ -929,10 +910,8 @@ public class ProjectServiceImpl implements ProjectService {
Map
<
String
,
Object
>
teamMatesMap
=
new
HashMap
();
Map
<
String
,
Object
>
teamMatesMap
=
new
HashMap
();
Map
<
String
,
Object
>
teamMatesStatusMap
=
new
HashMap
();
Map
<
String
,
Object
>
teamMatesStatusMap
=
new
HashMap
();
List
<
ProjectTeamMate
>
empRecords
=
projectTeamMatesRepo
.
findAll
();
// find
// Find all active employees
// all
List
<
ProjectTeamMate
>
empRecords
=
projectTeamMatesRepo
.
findAll
();
// active
// employees
for
(
ProjectTeamMate
pt
:
empRecords
)
{
for
(
ProjectTeamMate
pt
:
empRecords
)
{
if
(
pt
.
isActive
())
{
if
(
pt
.
isActive
())
{
Project
project
=
projectRepo
Project
project
=
projectRepo
...
@@ -945,16 +924,8 @@ public class ProjectServiceImpl implements ProjectService {
...
@@ -945,16 +924,8 @@ public class ProjectServiceImpl implements ProjectService {
if
(
projectTeamMate
==
null
)
{
if
(
projectTeamMate
==
null
)
{
List
listOfObjects
=
new
ArrayList
<>();
List
listOfObjects
=
new
ArrayList
<>();
listOfObjects
.
add
(
pt
);
listOfObjects
.
add
(
pt
);
teamMatesMap
.
put
(
pt
.
getEmployeeId
(),
listOfObjects
);
// TODO
// A person can have multiple active projects with billability
// a
teamMatesMap
.
put
(
pt
.
getEmployeeId
(),
listOfObjects
);
// person
// can
// have
// multiple
// active
// projects
// with
// billability
}
else
{
}
else
{
List
existingRecordsInMap
=
(
List
)
teamMatesMap
List
existingRecordsInMap
=
(
List
)
teamMatesMap
.
get
(
pt
.
getEmployeeId
());
.
get
(
pt
.
getEmployeeId
());
...
@@ -1098,11 +1069,10 @@ public class ProjectServiceImpl implements ProjectService {
...
@@ -1098,11 +1069,10 @@ public class ProjectServiceImpl implements ProjectService {
projectMap
.
put
(
"accountId"
,
account
!=
null
?
account
.
getAccountId
():
ptm
.
getAccountId
());
projectMap
.
put
(
"accountId"
,
account
!=
null
?
account
.
getAccountId
():
ptm
.
getAccountId
());
projectMap
.
put
(
"domainId"
,
domain
!=
null
?
domain
.
getDomainId
()
:
ptm
.
getDomainId
()
);
projectMap
.
put
(
"domainId"
,
domain
!=
null
?
domain
.
getDomainId
()
:
ptm
.
getDomainId
()
);
projectMap
.
put
(
"status"
,
ptm
.
isActive
());
projectMap
.
put
(
"status"
,
project
.
getStatus
()!=
null
?
project
.
getStatus
():
""
);
projectMap
.
put
(
"projectStartDate"
,
ptm
.
getStartDate
());
projectMap
.
put
(
"projectEndDate"
,
ptm
.
getEndDate
());
projectMap
.
put
(
"employeeIds"
,
ptm
.
getEmployeeId
());
projectMap
.
put
(
"employeeIds"
,
ptm
.
getEmployeeId
());
projectMap
.
put
(
"projectStartDate"
,
project
.
getProjectStartDate
());
projectMap
.
put
(
"projectEndDate"
,
project
.
getProjectEndDate
());
projectMap
.
put
(
"shift"
,
ptm
.
getShift
());
projectMap
.
put
(
"shift"
,
ptm
.
getShift
());
projectMap
.
put
(
"billableStatus"
,
ptm
.
getBillableStatus
());
projectMap
.
put
(
"billableStatus"
,
ptm
.
getBillableStatus
());
...
...
src/main/java/com/nisum/mytime/service/UserServiceImpl.java
View file @
a209b575
...
@@ -136,24 +136,11 @@ public class UserServiceImpl implements UserService {
...
@@ -136,24 +136,11 @@ public class UserServiceImpl implements UserService {
public
EmployeeRoles
assigingEmployeeRole
(
EmployeeRoles
employeeRoles
,
String
empId
)
public
EmployeeRoles
assigingEmployeeRole
(
EmployeeRoles
employeeRoles
,
String
empId
)
throws
MyTimeException
{
throws
MyTimeException
{
employeeRoles
.
setCreatedOn
(
new
Date
());
employeeRoles
.
setCreatedOn
(
new
Date
());
employeeRoles
.
setCreatedBy
(
empId
);
employeeRoles
.
setCreatedBy
(
empId
);
employeeRoles
.
setModifiedBy
(
empId
);
employeeRoles
.
setModifiedBy
(
empId
);
if
(
employeeRoles
.
getEmploymentType
()
==
null
||
employeeRoles
.
getEmploymentType
().
isEmpty
())
{
if
(
employeeRoles
.
getEmploymentType
()
!=
null
&&
!
employeeRoles
.
getEmploymentType
().
isEmpty
()
&&
!
employeeRoles
.
getEmploymentType
()
.
equalsIgnoreCase
(
"Full Time"
))
{
employeeRoles
.
setEmploymentType
(
employeeRoles
.
getEmploymentType
());
}
else
{
employeeRoles
.
setEmploymentType
(
"Full Time"
);
employeeRoles
.
setEmploymentType
(
"Full Time"
);
}
}
if
(
employeeRoles
.
getEmpStatus
()
!=
null
&&
employeeRoles
.
getEmpStatus
().
equalsIgnoreCase
(
"In Active"
))
{
employeeRoles
.
setEmpStatus
(
"In Active"
);
}
else
{
employeeRoles
.
setEmpStatus
(
"Active"
);
}
ProjectTeamMate
newBenchAllocation
=
new
ProjectTeamMate
();
ProjectTeamMate
newBenchAllocation
=
new
ProjectTeamMate
();
newBenchAllocation
.
setAccount
(
MyTimeUtils
.
BENCH_ACCOUNT
);
newBenchAllocation
.
setAccount
(
MyTimeUtils
.
BENCH_ACCOUNT
);
...
@@ -162,7 +149,7 @@ public class UserServiceImpl implements UserService {
...
@@ -162,7 +149,7 @@ public class UserServiceImpl implements UserService {
newBenchAllocation
.
setEmailId
(
employeeRoles
.
getEmailId
());
newBenchAllocation
.
setEmailId
(
employeeRoles
.
getEmailId
());
newBenchAllocation
.
setEmployeeId
(
employeeRoles
.
getEmployeeId
());
newBenchAllocation
.
setEmployeeId
(
employeeRoles
.
getEmployeeId
());
newBenchAllocation
.
setMobileNumber
(
employeeRoles
.
getMobileNumber
());
newBenchAllocation
.
setMobileNumber
(
employeeRoles
.
getMobileNumber
());
newBenchAllocation
.
setActive
(
true
);
newBenchAllocation
.
setEmployeeName
(
employeeRoles
.
getEmployeeName
());
newBenchAllocation
.
setEmployeeName
(
employeeRoles
.
getEmployeeName
());
newBenchAllocation
.
setProjectId
(
MyTimeUtils
.
BENCH_PROJECT_ID
);
newBenchAllocation
.
setProjectId
(
MyTimeUtils
.
BENCH_PROJECT_ID
);
newBenchAllocation
.
setStartDate
(
employeeRoles
.
getDateOfJoining
()
!=
null
newBenchAllocation
.
setStartDate
(
employeeRoles
.
getDateOfJoining
()
!=
null
...
@@ -172,14 +159,27 @@ public class UserServiceImpl implements UserService {
...
@@ -172,14 +159,27 @@ public class UserServiceImpl implements UserService {
newBenchAllocation
.
setProjectName
(
p
.
getProjectName
());
newBenchAllocation
.
setProjectName
(
p
.
getProjectName
());
newBenchAllocation
.
setAccountId
(
p
.
getAccountId
());
newBenchAllocation
.
setAccountId
(
p
.
getAccountId
());
newBenchAllocation
.
setDomainId
(
p
.
getDomainId
());
newBenchAllocation
.
setDomainId
(
p
.
getDomainId
());
newBenchAllocation
.
set
EndDate
(
employeeRoles
.
getEndDate
());
newBenchAllocation
.
set
Shift
(
employeeRoles
.
getShift
());
newBenchAllocation
.
setRole
(
employeeRoles
.
getRole
());
newBenchAllocation
.
setRole
(
employeeRoles
.
getRole
());
// newBenchAllocation.setManagerId(p.getManagerId());
// newBenchAllocation.setManagerId(p.getManagerId());
//newBenchAllocation.setManagerName(p.getManagerName());
//newBenchAllocation.setManagerName(p.getManagerName());
if
(
employeeRoles
.
getEmpStatus
()
!=
null
&&
(
employeeRoles
.
getEmpStatus
().
trim
().
equalsIgnoreCase
(
"InActive"
)
||
employeeRoles
.
getEmpStatus
().
trim
().
equalsIgnoreCase
(
"In Active"
)))
{
employeeRoles
.
setEmpStatus
(
"In Active"
);
newBenchAllocation
.
setEndDate
(
employeeRoles
.
getEndDate
());
newBenchAllocation
.
setActive
(
false
);
}
else
{
employeeRoles
.
setEmpStatus
(
"Active"
);
newBenchAllocation
.
setEndDate
(
p
.
getProjectEndDate
());
newBenchAllocation
.
setActive
(
true
);
}
try
{
try
{
projectService
.
addProjectTeamMate
(
newBenchAllocation
);
projectService
.
addProjectTeamMate
(
newBenchAllocation
);
}
catch
(
MyTimeException
e
)
{
}
catch
(
MyTimeException
e
)
{
// TODO Auto-generated catch block
e
.
printStackTrace
();
e
.
printStackTrace
();
}
}
...
@@ -213,10 +213,9 @@ public class UserServiceImpl implements UserService {
...
@@ -213,10 +213,9 @@ public class UserServiceImpl implements UserService {
}
}
@Override
@Override
public
EmployeeRoles
updateEmployeeRole
(
EmployeeRoles
employeeRoles
,
String
empId
)
{
public
EmployeeRoles
updateEmployeeRole
(
EmployeeRoles
employeeRoles
,
String
empId
)
{
// TODO update all emp details to inactive if employee is inactive
// update all emp details to inactive if employee is inactive
Query
query
=
new
Query
(
Query
query
=
new
Query
(
Criteria
.
where
(
"employeeId"
).
is
(
employeeRoles
.
getEmployeeId
()));
Criteria
.
where
(
"employeeId"
).
is
(
employeeRoles
.
getEmployeeId
()));
Update
update
=
new
Update
();
Update
update
=
new
Update
();
update
.
set
(
"employeeName"
,
employeeRoles
.
getEmployeeName
());
update
.
set
(
"employeeName"
,
employeeRoles
.
getEmployeeName
());
update
.
set
(
"emailId"
,
employeeRoles
.
getEmailId
());
update
.
set
(
"emailId"
,
employeeRoles
.
getEmailId
());
...
@@ -236,19 +235,15 @@ public class UserServiceImpl implements UserService {
...
@@ -236,19 +235,15 @@ public class UserServiceImpl implements UserService {
update
.
set
(
"passportExpiryDate"
,
employeeRoles
.
getPassportExpiryDate
());
update
.
set
(
"passportExpiryDate"
,
employeeRoles
.
getPassportExpiryDate
());
update
.
set
(
"b1ExpiryDate"
,
employeeRoles
.
getB1ExpiryDate
());
update
.
set
(
"b1ExpiryDate"
,
employeeRoles
.
getB1ExpiryDate
());
update
.
set
(
"modifiedBy"
,
empId
);
update
.
set
(
"modifiedBy"
,
empId
);
if
(
employeeRoles
.
getEmpStatus
().
equalsIgnoreCase
(
MyTimeUtils
.
IN_ACTIVE_SPACE
))
{
if
(
employeeRoles
.
getEmpStatus
().
equalsIgnoreCase
(
MyTimeUtils
.
IN_ACTIVE_SPACE
))
{
update
.
set
(
"endDate"
,
employeeRoles
.
getEndDate
());
update
.
set
(
"endDate"
,
employeeRoles
.
getEndDate
());
}
}
// update employee location
// update employee location
if
(
employeeRoles
.
getEmpLocation
()
!=
null
if
(
employeeRoles
.
getEmpLocation
()
!=
null
&&
!
employeeRoles
.
getEmpLocation
().
equals
(
""
))
{
&&
!
employeeRoles
.
getEmpLocation
().
equals
(
""
))
{
EmployeeRoles
existingEmployee
=
employeeRolesRepo
.
findByEmployeeId
(
employeeRoles
.
getEmployeeId
());
if
(!
existingEmployee
.
getEmpLocation
().
equals
(
employeeRoles
.
getEmpLocation
()))
{
EmployeeRoles
existingEmployee
=
employeeRolesRepo
.
findByEmployeeId
(
employeeRoles
.
getEmployeeId
());
if
(!
existingEmployee
.
getEmpLocation
()
.
equals
(
employeeRoles
.
getEmpLocation
()))
{
updateEmployeeLocationDetails
(
employeeRoles
,
false
);
updateEmployeeLocationDetails
(
employeeRoles
,
false
);
}
}
...
@@ -258,21 +253,14 @@ public class UserServiceImpl implements UserService {
...
@@ -258,21 +253,14 @@ public class UserServiceImpl implements UserService {
FindAndModifyOptions
options
=
new
FindAndModifyOptions
();
FindAndModifyOptions
options
=
new
FindAndModifyOptions
();
options
.
returnNew
(
true
);
options
.
returnNew
(
true
);
options
.
upsert
(
true
);
options
.
upsert
(
true
);
EmployeeRoles
emp
=
mongoTemplate
.
findAndModify
(
query
,
update
,
options
,
EmployeeRoles
emp
=
mongoTemplate
.
findAndModify
(
query
,
update
,
options
,
EmployeeRoles
.
class
);
EmployeeRoles
.
class
);
try
{
try
{
// update employee location
// update employee location
if
(
employeeRoles
.
getEmpLocation
()
!=
null
if
(
employeeRoles
.
getEmpLocation
()
!=
null
&&
!
employeeRoles
.
getEmpLocation
().
equals
(
""
))
{
&&
!
employeeRoles
.
getEmpLocation
().
equals
(
""
))
{
EmployeeRoles
existingEmployee
=
employeeRolesRepo
.
findByEmployeeId
(
employeeRoles
.
getEmployeeId
());
if
(!
existingEmployee
.
getEmpLocation
().
equals
(
employeeRoles
.
getEmpLocation
()))
{
EmployeeRoles
existingEmployee
=
employeeRolesRepo
.
findByEmployeeId
(
employeeRoles
.
getEmployeeId
());
if
(!
existingEmployee
.
getEmpLocation
()
.
equals
(
employeeRoles
.
getEmpLocation
()))
{
updateEmployeeLocationDetails
(
employeeRoles
,
false
);
updateEmployeeLocationDetails
(
employeeRoles
,
false
);
}
}
}
}
// update employee details
// update employee details
...
@@ -281,7 +269,6 @@ public class UserServiceImpl implements UserService {
...
@@ -281,7 +269,6 @@ public class UserServiceImpl implements UserService {
if
(
employeeProfiles
!=
null
&&
!
employeeProfiles
.
isEmpty
())
{
if
(
employeeProfiles
!=
null
&&
!
employeeProfiles
.
isEmpty
())
{
for
(
ProjectTeamMate
profile
:
employeeProfiles
)
{
for
(
ProjectTeamMate
profile
:
employeeProfiles
)
{
profile
.
setRole
(
emp
.
getRole
());
profile
.
setRole
(
emp
.
getRole
());
;
projectTeamMatesRepo
.
save
(
profile
);
projectTeamMatesRepo
.
save
(
profile
);
}
}
}
}
...
@@ -345,7 +332,7 @@ public class UserServiceImpl implements UserService {
...
@@ -345,7 +332,7 @@ public class UserServiceImpl implements UserService {
@Override
@Override
public
EmployeeRoles
updateProfile
(
EmployeeRoles
employeeRoles
)
public
EmployeeRoles
updateProfile
(
EmployeeRoles
employeeRoles
)
throws
MyTimeException
{
throws
MyTimeException
{
boolean
mobileNumberCh
na
ged
=
false
;
boolean
mobileNumberCh
an
ged
=
false
;
employeeRoles
.
setLastModifiedOn
(
new
Date
());
employeeRoles
.
setLastModifiedOn
(
new
Date
());
EmployeeRoles
existingEmployee
=
employeeRolesRepo
EmployeeRoles
existingEmployee
=
employeeRolesRepo
.
findByEmployeeId
(
employeeRoles
.
getEmployeeId
());
.
findByEmployeeId
(
employeeRoles
.
getEmployeeId
());
...
@@ -356,26 +343,22 @@ public class UserServiceImpl implements UserService {
...
@@ -356,26 +343,22 @@ public class UserServiceImpl implements UserService {
&&
!
existingEmployee
.
getMobileNumber
()
&&
!
existingEmployee
.
getMobileNumber
()
.
equalsIgnoreCase
(
newMobileNumber
))
.
equalsIgnoreCase
(
newMobileNumber
))
||
(
existingEmployee
.
getMobileNumber
()
==
null
))
{
||
(
existingEmployee
.
getMobileNumber
()
==
null
))
{
mobileNumberCh
na
ged
=
true
;
mobileNumberCh
an
ged
=
true
;
}
}
}
}
existingEmployee
.
setMobileNumber
(
employeeRoles
.
getMobileNumber
());
existingEmployee
.
setMobileNumber
(
employeeRoles
.
getMobileNumber
());
existingEmployee
.
setAlternateMobileNumber
(
existingEmployee
.
setAlternateMobileNumber
(
employeeRoles
.
getAlternateMobileNumber
());
employeeRoles
.
getAlternateMobileNumber
());
existingEmployee
.
setPersonalEmailId
(
employeeRoles
.
getPersonalEmailId
());
existingEmployee
.
setPersonalEmailId
(
employeeRoles
.
getPersonalEmailId
());
existingEmployee
.
setBaseTechnology
(
employeeRoles
.
getBaseTechnology
());
existingEmployee
.
setBaseTechnology
(
employeeRoles
.
getBaseTechnology
());
existingEmployee
.
setTechnologyKnown
(
employeeRoles
.
getTechnologyKnown
());
existingEmployee
.
setTechnologyKnown
(
employeeRoles
.
getTechnologyKnown
());
EmployeeRoles
employeeRolesDB
=
employeeRolesRepo
EmployeeRoles
employeeRolesDB
=
employeeRolesRepo
.
save
(
existingEmployee
);
.
save
(
existingEmployee
);
if
(
mobileNumberChanged
)
{
if
(
mobileNumberChnaged
)
{
try
{
try
{
List
<
ProjectTeamMate
>
employeeProfiles
=
projectTeamMatesRepo
List
<
ProjectTeamMate
>
employeeProfiles
=
projectTeamMatesRepo
.
findByEmployeeId
(
employeeRoles
.
getEmployeeId
());
.
findByEmployeeId
(
employeeRoles
.
getEmployeeId
());
if
(
employeeProfiles
!=
null
&&
!
employeeProfiles
.
isEmpty
())
{
if
(
employeeProfiles
!=
null
&&
!
employeeProfiles
.
isEmpty
())
{
for
(
ProjectTeamMate
profile
:
employeeProfiles
)
{
for
(
ProjectTeamMate
profile
:
employeeProfiles
)
{
profile
.
setMobileNumber
(
profile
.
setMobileNumber
(
employeeRolesDB
.
getMobileNumber
());
employeeRolesDB
.
getMobileNumber
());
projectTeamMatesRepo
.
save
(
profile
);
projectTeamMatesRepo
.
save
(
profile
);
}
}
}
}
...
@@ -438,7 +421,6 @@ public class UserServiceImpl implements UserService {
...
@@ -438,7 +421,6 @@ public class UserServiceImpl implements UserService {
@Override
@Override
public
List
<
MasterData
>
getMasterData
()
throws
MyTimeException
{
public
List
<
MasterData
>
getMasterData
()
throws
MyTimeException
{
// TODO Auto-generated method stub
return
masterDataRepo
.
findAll
();
return
masterDataRepo
.
findAll
();
}
}
...
@@ -471,43 +453,35 @@ public class UserServiceImpl implements UserService {
...
@@ -471,43 +453,35 @@ public class UserServiceImpl implements UserService {
@Override
@Override
public
void
saveEmployeeLocationDetails
(
EmployeeRoles
employeeRoles
)
{
public
void
saveEmployeeLocationDetails
(
EmployeeRoles
employeeRoles
)
{
EmployeeLocationDetails
employeeLocationDetails
=
new
EmployeeLocationDetails
();
EmployeeLocationDetails
employeeLocationDetails
=
new
EmployeeLocationDetails
();
employeeLocationDetails
.
setActive
(
true
);
employeeLocationDetails
.
setActive
(
employeeRoles
.
getEmpStatus
().
equalsIgnoreCase
(
"Active"
)
);
employeeLocationDetails
.
setEmployeeId
(
employeeRoles
.
getEmployeeId
());
employeeLocationDetails
.
setEmployeeId
(
employeeRoles
.
getEmployeeId
());
employeeLocationDetails
employeeLocationDetails
.
setEmployeeName
(
employeeRoles
.
getEmployeeName
());
.
setEmployeeName
(
employeeRoles
.
getEmployeeName
());
employeeLocationDetails
.
setCreateDate
(
new
Date
());
employeeLocationDetails
.
setCreateDate
(
new
Date
());
employeeLocationDetails
.
setEndDate
(
new
Date
());
employeeLocationDetails
.
setEndDate
(
new
Date
());
employeeLocationDetails
.
setUpdatedDate
(
new
Date
());
employeeLocationDetails
.
setUpdatedDate
(
new
Date
());
employeeLocationDetails
.
setStartDate
(
new
Date
());
employeeLocationDetails
.
setStartDate
(
new
Date
());
employeeLocationDetails
.
setEmpLocation
(
employeeRoles
.
getEmpLocation
());
employeeLocationDetails
.
setEmpLocation
(
employeeRoles
.
getEmpLocation
());
employeeLocationDetailsRepo
.
save
(
employeeLocationDetails
);
employeeLocationDetailsRepo
.
save
(
employeeLocationDetails
);
}
}
@Override
@Override
public
List
<
EmployeeLocationDetails
>
getEmployeeLocationDetails
(
public
List
<
EmployeeLocationDetails
>
getEmployeeLocationDetails
(
String
empId
)
{
String
empId
)
{
// TODO Auto-generated method stub
return
employeeLocationDetailsRepo
.
findByEmployeeId
(
empId
);
return
employeeLocationDetailsRepo
.
findByEmployeeId
(
empId
);
}
}
@Override
@Override
public
List
<
EmployeeRoles
>
getEmployeesByFunctionalGrp
(
public
List
<
EmployeeRoles
>
getEmployeesByFunctionalGrp
(
String
functionalGrp
)
{
String
functionalGrp
)
{
return
employeeRolesRepo
.
findByEmpStatusAndFunctionalGroup
(
"Active"
,
return
employeeRolesRepo
.
findByEmpStatusAndFunctionalGroup
(
"Active"
,
functionalGrp
);
functionalGrp
);
}
}
@Override
@Override
public
List
<
EmployeeRoles
>
getEmployeesByStatus
(
String
status
)
{
public
List
<
EmployeeRoles
>
getEmployeesByStatus
(
String
status
)
{
if
(
status
.
equals
(
"both"
))
{
if
(
status
.
equals
(
"both"
))
{
return
employeeRolesRepo
return
employeeRolesRepo
.
findAll
(
new
Sort
(
Sort
.
Direction
.
ASC
,
"employeeName"
));
.
findAll
(
new
Sort
(
Sort
.
Direction
.
ASC
,
"employeeName"
));
}
else
{
}
else
{
return
employeeRolesRepo
return
employeeRolesRepo
.
findByEmpStatusOrderByEmployeeNameAsc
(
status
);
.
findByEmpStatusOrderByEmployeeNameAsc
(
status
);
}
}
}
}
...
@@ -555,7 +529,7 @@ public class UserServiceImpl implements UserService {
...
@@ -555,7 +529,7 @@ public class UserServiceImpl implements UserService {
:
billings
.
stream
().
sorted
(
Comparator
.
comparing
(
BillingDetails:
:
getBillingStartDate
).
reversed
())
:
billings
.
stream
().
sorted
(
Comparator
.
comparing
(
BillingDetails:
:
getBillingStartDate
).
reversed
())
.
collect
(
Collectors
.
toList
());
.
collect
(
Collectors
.
toList
());
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
// TODO: handle exception
e
.
printStackTrace
();
}
}
return
billingsSorted
;
return
billingsSorted
;
}
}
...
@@ -577,12 +551,9 @@ public class UserServiceImpl implements UserService {
...
@@ -577,12 +551,9 @@ public class UserServiceImpl implements UserService {
@Override
@Override
public
boolean
verifyRole
(
String
empId
,
String
roleName
)
{
public
boolean
verifyRole
(
String
empId
,
String
roleName
)
{
boolean
flag
=
false
;
boolean
flag
=
false
;
String
role
=
getEmployeesRoleData
(
empId
).
getRole
();
String
role
=
getEmployeesRoleData
(
empId
).
getRole
();
if
(
null
!=
role
&&
""
!=
role
&&
!
"Admin"
.
equalsIgnoreCase
(
role
)
)
{
if
(
null
!=
role
&&
""
!=
role
&&
!
"Admin"
.
equalsIgnoreCase
(
role
)
)
{
Set
<
String
>
roleSet
=
roleMappingService
.
empRolesMapInfoByEmpId
(
empId
);
Set
<
String
>
roleSet
=
roleMappingService
.
empRolesMapInfoByEmpId
(
empId
);
if
(
null
!=
roleSet
&&
!
roleSet
.
isEmpty
()
&&
MyTimeUtils
.
INT_ZERO
<
roleSet
.
size
()
)
{
if
(
null
!=
roleSet
&&
!
roleSet
.
isEmpty
()
&&
MyTimeUtils
.
INT_ZERO
<
roleSet
.
size
()
)
{
if
(
roleSet
.
contains
(
roleName
)
)
{
if
(
roleSet
.
contains
(
roleName
)
)
{
flag
=
true
;
flag
=
true
;
...
...
src/main/java/com/nisum/mytime/service/VisaServiceImpl.java
View file @
a209b575
...
@@ -88,7 +88,7 @@ public class VisaServiceImpl implements VisaService {
...
@@ -88,7 +88,7 @@ public class VisaServiceImpl implements VisaService {
}
}
@Override
@Override
public
String
exportDataFromExcelFile
(
MultipartFile
file
,
String
empId
)
public
String
exportDataFromExcelFile
(
MultipartFile
file
,
String
empId
)
throws
MyTimeException
{
throws
MyTimeException
{
String
result
=
"Failure"
;
String
result
=
"Failure"
;
int
counter
=
0
;
int
counter
=
0
;
...
@@ -157,16 +157,15 @@ public class VisaServiceImpl implements VisaService {
...
@@ -157,16 +157,15 @@ public class VisaServiceImpl implements VisaService {
* log.info("Inserted Employee record with Id: {}",
* log.info("Inserted Employee record with Id: {}",
* employee.getEmployeeId());
* employee.getEmployeeId());
*/
*/
if
(
employee
.
getRole
()!=
null
)
employee
.
setRole
(
"Employee"
);
EmployeeRoles
emp
=
userService
EmployeeRoles
emp
=
userService
.
getEmployeesRoleData
(
employee
.
getEmployeeId
());
.
getEmployeesRoleData
(
employee
.
getEmployeeId
());
if
(
emp
==
null
)
{
if
(
emp
==
null
)
{
try
{
try
{
if
(
employee
.
getRole
()==
null
||
employee
.
getRole
().
isEmpty
())
{
employee
.
setRole
(
"Employee"
);
}
userService
.
assigingEmployeeRole
(
employee
,
empId
);
userService
.
assigingEmployeeRole
(
employee
,
empId
);
}
catch
(
MyTimeException
e
)
{
}
catch
(
MyTimeException
e
)
{
// TODO Auto-generated catch block
e
.
printStackTrace
();
e
.
printStackTrace
();
}
}
}
}
...
...
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