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
7f3bd5e9
Commit
7f3bd5e9
authored
Jun 19, 2019
by
Md Suleman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
implemented substatus service and new collection operations while updating substatus
parent
1b2ad8af
Changes
9
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
130 additions
and
29 deletions
+130
-29
EmployeeController.java
.../java/com/nisum/myteam/controller/EmployeeController.java
+2
-1
Employee.java
src/main/java/com/nisum/myteam/model/dao/Employee.java
+1
-1
EmployeeSubStatusRepo.java
...va/com/nisum/myteam/repository/EmployeeSubStatusRepo.java
+11
-0
LeaveNotificationScheduler.java
...om/nisum/myteam/schedular/LeaveNotificationScheduler.java
+1
-1
IEmployeeService.java
src/main/java/com/nisum/myteam/service/IEmployeeService.java
+2
-1
ISubStatusService.java
...main/java/com/nisum/myteam/service/ISubStatusService.java
+10
-0
EmployeeService.java
...n/java/com/nisum/myteam/service/impl/EmployeeService.java
+39
-23
SubStatusService.java
.../java/com/nisum/myteam/service/impl/SubStatusService.java
+55
-0
AssignRolesController.js
src/main/webapp/WEB-INF/controllers/AssignRolesController.js
+9
-2
No files found.
src/main/java/com/nisum/myteam/controller/EmployeeController.java
View file @
7f3bd5e9
package
com
.
nisum
.
myteam
.
controller
;
import
java.text.ParseException
;
import
java.util.ArrayList
;
import
java.util.Date
;
import
java.util.HashMap
;
...
...
@@ -66,7 +67,7 @@ public class EmployeeController {
@RequestMapping
(
value
=
"/employees/{empId}"
,
method
=
RequestMethod
.
PUT
,
produces
=
MediaType
.
APPLICATION_JSON_VALUE
,
consumes
=
MediaType
.
APPLICATION_JSON_VALUE
)
public
ResponseEntity
<?>
updateEmployee
(
@RequestBody
Employee
employeeReq
,
@PathVariable
(
value
=
"empId"
)
String
loginEmpId
,
HttpServletRequest
request
)
throws
MyTeamException
{
@PathVariable
(
value
=
"empId"
)
String
loginEmpId
,
HttpServletRequest
request
)
throws
MyTeamException
,
ParseException
{
if
(
empService
.
isEmployeeExistsById
(
loginEmpId
))
{
Employee
employeeUpdated
=
empService
.
updateEmployee
(
employeeReq
,
loginEmpId
);
...
...
src/main/java/com/nisum/myteam/model/dao/Employee.java
View file @
7f3bd5e9
...
...
@@ -94,7 +94,7 @@ public class Employee implements Serializable {
private
String
empStatus
;
@ExcelCellName
(
"Employment Sub Status"
)
private
String
empSubStatus
;
private
Object
empSubStatus
;
@ExcelCellName
(
"Employment Type"
)
private
String
employmentType
;
...
...
src/main/java/com/nisum/myteam/repository/EmployeeSubStatusRepo.java
0 → 100644
View file @
7f3bd5e9
package
com
.
nisum
.
myteam
.
repository
;
import
com.nisum.myteam.model.dao.EmployeeSubStatus
;
import
org.springframework.data.mongodb.repository.MongoRepository
;
import
java.util.List
;
public
interface
EmployeeSubStatusRepo
extends
MongoRepository
<
EmployeeSubStatus
,
String
>
{
public
List
<
EmployeeSubStatus
>
findByEmployeeID
(
String
employeeId
);
}
src/main/java/com/nisum/myteam/schedular/LeaveNotificationScheduler.java
View file @
7f3bd5e9
...
...
@@ -113,7 +113,7 @@ public class LeaveNotificationScheduler {
for
(
AttendenceData
absentee
:
absentiesList
)
{
//model.put("employeeName", );//mail.setModel(model);
employee
=
employeeService
.
getEmployeeById
(
absentee
.
getEmployeeId
());
empSubStatus
=
employee
.
getEmpSubStatus
();
empSubStatus
=
(
String
)
employee
.
getEmpSubStatus
();
if
(
empSubStatus
==
null
)
empSubStatus
=
""
;
...
...
src/main/java/com/nisum/myteam/service/IEmployeeService.java
View file @
7f3bd5e9
...
...
@@ -5,6 +5,7 @@ import com.nisum.myteam.model.dao.Account;
import
com.nisum.myteam.model.dao.Employee
;
import
org.springframework.stereotype.Service
;
import
java.text.ParseException
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Set
;
...
...
@@ -16,7 +17,7 @@ public interface IEmployeeService {
Employee
createEmployee
(
Employee
employeeRoles
,
String
empId
)
throws
MyTeamException
;
Employee
updateEmployee
(
Employee
employeeRoles
,
String
empId
);
Employee
updateEmployee
(
Employee
employeeRoles
,
String
empId
)
throws
ParseException
;
Employee
deleteEmployee
(
String
empId
);
...
...
src/main/java/com/nisum/myteam/service/ISubStatusService.java
0 → 100644
View file @
7f3bd5e9
package
com
.
nisum
.
myteam
.
service
;
import
com.nisum.myteam.model.dao.EmployeeSubStatus
;
public
interface
ISubStatusService
{
public
EmployeeSubStatus
getLatestEmployeeSubStatus
(
String
empId
);
public
EmployeeSubStatus
updateExistingEmplyeeSubStatus
(
EmployeeSubStatus
employeeSubStatusReq
);
public
EmployeeSubStatus
addEmployeeSubStatus
(
EmployeeSubStatus
employeeSubStatus
);
public
EmployeeSubStatus
getCurrentSubStatus
(
String
employeeId
);
}
src/main/java/com/nisum/myteam/service/impl/EmployeeService.java
View file @
7f3bd5e9
package
com
.
nisum
.
myteam
.
service
.
impl
;
import
java.util.ArrayList
;
import
java.util.Comparator
;
import
java.util.Date
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Set
;
import
java.text.ParseException
;
import
java.text.SimpleDateFormat
;
import
java.util.*
;
import
java.util.stream.Collectors
;
import
com.nisum.myteam.model.dao.*
;
import
com.nisum.myteam.service.*
;
import
org.apache.commons.lang.StringUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.data.domain.Sort
;
...
...
@@ -20,19 +18,7 @@ import org.springframework.data.mongodb.core.query.Update;
import
org.springframework.stereotype.Service
;
import
com.nisum.myteam.exception.handler.MyTeamException
;
import
com.nisum.myteam.model.dao.Account
;
import
com.nisum.myteam.model.dao.Domain
;
import
com.nisum.myteam.model.dao.Employee
;
import
com.nisum.myteam.model.dao.Project
;
import
com.nisum.myteam.model.dao.Resource
;
import
com.nisum.myteam.repository.EmployeeRepo
;
import
com.nisum.myteam.service.IAccountService
;
import
com.nisum.myteam.service.IDomainService
;
import
com.nisum.myteam.service.IEmployeeLocationService
;
import
com.nisum.myteam.service.IEmployeeRoleService
;
import
com.nisum.myteam.service.IEmployeeService
;
import
com.nisum.myteam.service.IProjectService
;
import
com.nisum.myteam.service.IResourceService
;
import
com.nisum.myteam.statuscodes.ResourceStatus
;
import
com.nisum.myteam.utils.MyTeamUtils
;
import
com.nisum.myteam.utils.constants.ApplicationRole
;
...
...
@@ -69,6 +55,9 @@ public class EmployeeService implements IEmployeeService {
@Autowired
private
IResourceService
resourceService
;
@Autowired
private
ISubStatusService
subStatusService
;
@Override
public
Employee
createEmployee
(
Employee
employee
,
String
loginEmpId
)
throws
MyTeamException
{
employee
.
setCreatedOn
(
new
Date
());
...
...
@@ -85,7 +74,7 @@ public class EmployeeService implements IEmployeeService {
}
@Override
public
Employee
updateEmployee
(
Employee
employeeReq
,
String
loginEmpId
)
{
public
Employee
updateEmployee
(
Employee
employeeReq
,
String
loginEmpId
)
throws
ParseException
{
// update all emp details to inactive if employee is inactive
Query
query
=
new
Query
(
Criteria
.
where
(
"employeeId"
).
is
(
employeeReq
.
getEmployeeId
()));
Update
update
=
new
Update
();
...
...
@@ -95,7 +84,7 @@ public class EmployeeService implements IEmployeeService {
update
.
set
(
"gender"
,
employeeReq
.
getGender
());
update
.
set
(
"functionalGroup"
,
employeeReq
.
getFunctionalGroup
());
update
.
set
(
"empStatus"
,
employeeReq
.
getEmpStatus
());
update
.
set
(
"empSubStatus"
,
employeeReq
.
getEmpSubStatus
());
//
update.set("empSubStatus", employeeReq.getEmpSubStatus());
update
.
set
(
"employmentType"
,
employeeReq
.
getEmploymentType
());
update
.
set
(
"empLocation"
,
employeeReq
.
getEmpLocation
());
// update.set("domain", employeeReq.getDomain());
...
...
@@ -112,8 +101,7 @@ public class EmployeeService implements IEmployeeService {
if
(
employeeReq
.
getEmpStatus
().
equalsIgnoreCase
(
MyTeamUtils
.
IN_ACTIVE_SPACE
))
{
update
.
set
(
"endDate"
,
employeeReq
.
getEndDate
());
update
.
set
(
"empSubStatus"
,
null
);
// update.set("empSubStatus", null);
}
// update employee location
if
(
employeeReq
.
getEmpLocation
()
!=
null
&&
!
employeeReq
.
getEmpLocation
().
equals
(
""
))
{
...
...
@@ -124,6 +112,34 @@ public class EmployeeService implements IEmployeeService {
}
//update substatus
if
(
employeeReq
.
getEmpSubStatus
()!=
null
)
{
HashMap
<
String
,
Object
>
substatus
=
(
LinkedHashMap
)
employeeReq
.
getEmpSubStatus
();
EmployeeSubStatus
latestSubStatus
=
new
EmployeeSubStatus
();
latestSubStatus
.
setEmployeeID
(
substatus
.
get
(
"employeeID"
).
toString
());
latestSubStatus
.
setSubStatus
(
substatus
.
get
(
"subStatus"
).
toString
());
latestSubStatus
.
setFromDate
(
new
SimpleDateFormat
(
"yyyy-MM-dd'T'HH:mm:ss.SSS'Z'"
).
parse
(
substatus
.
get
(
"fromDate"
).
toString
()));
latestSubStatus
.
setToDate
(
new
SimpleDateFormat
(
"yyyy-MM-dd'T'HH:mm:ss.SSS'Z'"
).
parse
(
substatus
.
get
(
"toDate"
).
toString
()));
EmployeeSubStatus
currentSubStatus
=
subStatusService
.
getCurrentSubStatus
(
employeeReq
.
getEmployeeId
());
if
(
currentSubStatus
!=
null
){
if
(
currentSubStatus
.
getSubStatus
().
equals
(
latestSubStatus
.
getSubStatus
()))
{
latestSubStatus
.
setId
(
currentSubStatus
.
getId
());
subStatusService
.
updateExistingEmplyeeSubStatus
(
latestSubStatus
);
}
else
{
subStatusService
.
addEmployeeSubStatus
(
latestSubStatus
);
}
}
else
{
currentSubStatus
=
subStatusService
.
getLatestEmployeeSubStatus
(
employeeReq
.
getEmployeeId
());
if
(
currentSubStatus
==
null
)
subStatusService
.
addEmployeeSubStatus
(
latestSubStatus
);
else
{
latestSubStatus
.
setId
(
currentSubStatus
.
getId
());
subStatusService
.
updateExistingEmplyeeSubStatus
(
latestSubStatus
);
}
}
}
// update employee details
FindAndModifyOptions
options
=
new
FindAndModifyOptions
();
options
.
returnNew
(
true
);
...
...
src/main/java/com/nisum/myteam/service/impl/SubStatusService.java
0 → 100644
View file @
7f3bd5e9
package
com
.
nisum
.
myteam
.
service
.
impl
;
import
com.nisum.myteam.model.dao.EmployeeSubStatus
;
import
com.nisum.myteam.repository.EmployeeSubStatusRepo
;
import
com.nisum.myteam.service.ISubStatusService
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.stream.Collectors
;
@Service
public
class
SubStatusService
implements
ISubStatusService
{
@Autowired
private
EmployeeSubStatusRepo
employeeSubStatusRepo
;
@Override
public
EmployeeSubStatus
getLatestEmployeeSubStatus
(
String
empId
)
{
List
<
EmployeeSubStatus
>
employeeSubStatusList
=
employeeSubStatusRepo
.
findByEmployeeID
(
empId
);
EmployeeSubStatus
latestSubStatus
=
null
;
if
(!
employeeSubStatusList
.
isEmpty
()){
latestSubStatus
=
employeeSubStatusList
.
get
(
0
);
for
(
EmployeeSubStatus
s:
employeeSubStatusList
)
{
if
(
s
.
getToDate
().
after
(
latestSubStatus
.
getToDate
())){
latestSubStatus
=
s
;
}
}
}
return
latestSubStatus
;
}
@Override
public
EmployeeSubStatus
updateExistingEmplyeeSubStatus
(
EmployeeSubStatus
employeeSubStatusReq
)
{
return
employeeSubStatusRepo
.
save
(
employeeSubStatusReq
);
}
@Override
public
EmployeeSubStatus
addEmployeeSubStatus
(
EmployeeSubStatus
employeeSubStatus
)
{
return
employeeSubStatusRepo
.
insert
(
employeeSubStatus
);
}
@Override
public
EmployeeSubStatus
getCurrentSubStatus
(
String
employeeId
){
List
<
EmployeeSubStatus
>
currentEmployeeSubStatusList
=
employeeSubStatusRepo
.
findByEmployeeID
(
employeeId
).
stream
().
filter
(
s
->
s
.
getFromDate
().
compareTo
(
new
Date
())<=
0
&&
s
.
getToDate
().
compareTo
(
new
Date
())>=
0
).
collect
(
Collectors
.
toList
());
if
(!
currentEmployeeSubStatusList
.
isEmpty
()){
return
currentEmployeeSubStatusList
.
get
(
0
);
}
else
return
null
;
}
}
src/main/webapp/WEB-INF/controllers/AssignRolesController.js
View file @
7f3bd5e9
...
...
@@ -465,6 +465,13 @@ myApp.controller("assignRoleController",function($scope, myFactory, $mdDialog, $
var
passportExpiryDate
=
$scope
.
passportExpiryDate
;
var
subStatusStartDate
=
$scope
.
subStatusStartDate
;
var
subStatusEndDate
=
$scope
.
subStatusEndDate
;
var
empSubStatusObj
=
{
id
:
null
,
employeeID
:
$scope
.
empId
,
subStatus
:
empSubStatus
,
fromDate
:
subStatusStartDate
,
toDate
:
subStatusEndDate
};
if
(
searchId
==
""
){
$scope
.
alertMsg
=
"Employee Id is mandatory"
;
document
.
getElementById
(
'empId'
).
focus
();
...
...
@@ -561,9 +568,9 @@ myApp.controller("assignRoleController",function($scope, myFactory, $mdDialog, $
$scope
.
alertMsg
=
""
;
var
record
=
{
"employeeId"
:
$scope
.
empId
,
"employeeName"
:
$scope
.
empName
,
"gender"
:
$scope
.
gender
,
"emailId"
:
$scope
.
empEmail
,
"role"
:
$scope
.
empRole
,
"empLocation"
:
$scope
.
empLocation
,
"designation"
:
$scope
.
designation
,
"functionalGroup"
:
$scope
.
functionalGroup
,
"empStatus"
:
$scope
.
empStatus
,
"emp
SubStatus"
:
$scope
.
empSubStatus
,
"emp
loymentType"
:
$scope
.
employmentType
,
"dateOfJoining"
:
$scope
.
dateOfJoining
,
"empStatus"
:
$scope
.
empStatus
,
"employmentType"
:
$scope
.
employmentType
,
"dateOfJoining"
:
$scope
.
dateOfJoining
,
"dateOfBirth"
:
$scope
.
dateOfBirth
,
"hasPassort"
:
$scope
.
hasPassort
,
"hasB1"
:
$scope
.
hasB1
,
"passportExpiryDate"
:
$scope
.
passportExpiryDate
,
"b1ExpiryDate"
:
$scope
.
b1ExpiryDate
,
"endDate"
:
$scope
.
exitDate
,
"subStatusStartDate"
:
$scope
.
subStatusStartDate
,
"subStatusEndDate"
:
$scope
.
subStatusEndDate
"b1ExpiryDate"
:
$scope
.
b1ExpiryDate
,
"endDate"
:
$scope
.
exitDate
,
"empSubStatus"
:
empSubStatusObj
};
if
(
$scope
.
templateTitle
==
"Add"
){
addOrUpdateRole
(
record
,
$scope
.
templateTitle
);
...
...
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