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