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
85d15817
Commit
85d15817
authored
Jun 19, 2019
by
Md Suleman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Updated response object for substatus
parent
c5b5d564
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
55 additions
and
20 deletions
+55
-20
gradle-wrapper.properties
gradle/wrapper/gradle-wrapper.properties
+2
-1
EmployeeController.java
.../java/com/nisum/myteam/controller/EmployeeController.java
+3
-2
LeaveNotificationScheduler.java
...om/nisum/myteam/schedular/LeaveNotificationScheduler.java
+7
-1
IEmployeeService.java
src/main/java/com/nisum/myteam/service/IEmployeeService.java
+2
-0
EmployeeService.java
...n/java/com/nisum/myteam/service/impl/EmployeeService.java
+41
-16
No files found.
gradle/wrapper/gradle-wrapper.properties
View file @
85d15817
#Tue Jun 18 14:38:29 IST 2019
distributionBase
=
GRADLE_USER_HOME
distributionPath
=
wrapper/dists
zipStoreBase
=
GRADLE_USER_HOME
zipStorePath
=
wrapper/dists
distributionUrl
=
https
\:
//services.gradle.org/distributions/gradle-3.5.1-
bin
.zip
distributionUrl
=
https
\:
//services.gradle.org/distributions/gradle-3.5.1-
all
.zip
src/main/java/com/nisum/myteam/controller/EmployeeController.java
View file @
85d15817
...
...
@@ -11,6 +11,7 @@ import javax.servlet.http.HttpServletRequest;
import
com.nisum.myteam.model.dao.EmployeeVisa
;
import
com.nisum.myteam.repository.EmployeeVisaRepo
;
import
com.nisum.myteam.service.impl.EmployeeService
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.http.HttpStatus
;
import
org.springframework.http.MediaType
;
...
...
@@ -36,7 +37,7 @@ import lombok.extern.slf4j.Slf4j;
public
class
EmployeeController
{
@Autowired
private
I
EmployeeService
empService
;
private
EmployeeService
empService
;
@Autowired
private
IEmployeeRoleService
employeeRoleService
;
...
...
@@ -71,7 +72,7 @@ public class EmployeeController {
if
(
empService
.
isEmployeeExistsById
(
loginEmpId
))
{
Employee
employeeUpdated
=
empService
.
updateEmployee
(
employeeReq
,
loginEmpId
);
ResponseDetails
updateRespDetails
=
new
ResponseDetails
(
new
Date
(),
906
,
"Employee has been updated"
,
ResponseDetails
updateRespDetails
=
new
ResponseDetails
(
new
Date
(),
906
,
empService
.
messege
,
"Employee Updation"
,
null
,
request
.
getRequestURI
(),
"Updation Employee details"
,
employeeUpdated
);
return
new
ResponseEntity
<
ResponseDetails
>(
updateRespDetails
,
HttpStatus
.
OK
);
...
...
src/main/java/com/nisum/myteam/schedular/LeaveNotificationScheduler.java
View file @
85d15817
...
...
@@ -6,10 +6,12 @@ import com.nisum.myteam.model.AttendenceData;
import
com.nisum.myteam.model.FunctionalGroup
;
import
com.nisum.myteam.model.Mail
;
import
com.nisum.myteam.model.dao.Employee
;
import
com.nisum.myteam.model.dao.EmployeeSubStatus
;
import
com.nisum.myteam.service.IFunctionalGroupService
;
import
com.nisum.myteam.service.IMailService
;
import
com.nisum.myteam.service.impl.AttendanceService
;
import
com.nisum.myteam.service.impl.EmployeeService
;
import
com.nisum.myteam.service.impl.SubStatusService
;
import
com.nisum.myteam.statuscodes.EmployeeStatus
;
import
com.nisum.myteam.utils.MyTeamDateUtils
;
import
com.nisum.myteam.utils.MyTeamUtils
;
...
...
@@ -52,6 +54,9 @@ public class LeaveNotificationScheduler {
@Autowired
private
IFunctionalGroupService
functionalGroupService
;
@Autowired
private
SubStatusService
subStatusService
;
// @Scheduled(cron = "${email.leave.notification.shift1.cron}")
public
void
scheduleLeaveMailForShift1Empls
()
throws
IOException
,
MessagingException
,
MyTeamException
{
...
...
@@ -118,7 +123,8 @@ public class LeaveNotificationScheduler {
mail
.
setSubject
(
mailSubject
);
employee
=
employeeService
.
getEmployeeById
(
absentee
.
getEmployeeId
());
empSubStatus
=
(
String
)
employee
.
getEmpSubStatus
();
EmployeeSubStatus
subStatus
=
subStatusService
.
getCurrentSubStatus
(
employee
.
getEmployeeId
());
empSubStatus
=
(
String
)
subStatus
.
getSubStatus
();
if
(
empSubStatus
==
null
)
empSubStatus
=
""
;
...
...
src/main/java/com/nisum/myteam/service/IEmployeeService.java
View file @
85d15817
...
...
@@ -13,6 +13,8 @@ import java.util.Set;
@Service
public
interface
IEmployeeService
{
public
String
messege
=
""
;
boolean
isEmployeeExistsById
(
String
employeeId
);
Employee
createEmployee
(
Employee
employeeRoles
,
String
empId
)
throws
MyTeamException
;
...
...
src/main/java/com/nisum/myteam/service/impl/EmployeeService.java
View file @
85d15817
...
...
@@ -9,6 +9,7 @@ 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.beans.factory.annotation.Qualifier
;
import
org.springframework.data.domain.Sort
;
import
org.springframework.data.mongodb.core.FindAndModifyOptions
;
import
org.springframework.data.mongodb.core.MongoTemplate
;
...
...
@@ -50,7 +51,7 @@ public class EmployeeService implements IEmployeeService {
private
IEmployeeRoleService
employeeRoleService
;
@Autowired
private
I
EmployeeLocationService
empLocationService
;
private
EmployeeLocationService
empLocationService
;
@Autowired
private
IResourceService
resourceService
;
...
...
@@ -58,6 +59,8 @@ public class EmployeeService implements IEmployeeService {
@Autowired
private
ISubStatusService
subStatusService
;
public
String
message
=
""
;
@Override
public
Employee
createEmployee
(
Employee
employee
,
String
loginEmpId
)
throws
MyTeamException
{
employee
.
setCreatedOn
(
new
Date
());
...
...
@@ -75,6 +78,7 @@ public class EmployeeService implements IEmployeeService {
@Override
public
Employee
updateEmployee
(
Employee
employeeReq
,
String
loginEmpId
)
throws
ParseException
{
message
=
"Employee has been updated"
;
// update all emp details to inactive if employee is inactive
Query
query
=
new
Query
(
Criteria
.
where
(
"employeeId"
).
is
(
employeeReq
.
getEmployeeId
()));
Update
update
=
new
Update
();
...
...
@@ -126,16 +130,16 @@ public class EmployeeService implements IEmployeeService {
latestSubStatus
.
setId
(
currentSubStatus
.
getId
());
subStatusService
.
updateExistingEmplyeeSubStatus
(
latestSubStatus
);
}
else
{
subStatusService
.
addEmployeeSubStatus
(
latestSubStatus
);
message
=
"Employee is already "
+
currentSubStatus
.
getSubStatus
()+
" from "
+
currentSubStatus
.
getFromDate
()+
" to "
+
currentSubStatus
.
getToDate
(
);
}
}
else
{
currentSubStatus
=
subStatusService
.
getLatestEmployeeSubStatus
(
employeeReq
.
getEmployeeId
());
if
(
currentSubStatus
==
null
)
//
currentSubStatus = subStatusService.getLatestEmployeeSubStatus(employeeReq.getEmployeeId());
//
if(currentSubStatus == null)
subStatusService
.
addEmployeeSubStatus
(
latestSubStatus
);
else
{
latestSubStatus
.
setId
(
currentSubStatus
.
getId
());
subStatusService
.
updateExistingEmplyeeSubStatus
(
latestSubStatus
);
}
//
else {
//
latestSubStatus.setId(currentSubStatus.getId());
//
subStatusService.updateExistingEmplyeeSubStatus(latestSubStatus);
//
}
}
}
...
...
@@ -241,17 +245,38 @@ public class EmployeeService implements IEmployeeService {
@Override
public
List
<
Employee
>
getEmployeesByStatus
(
String
status
)
{
// if (status.equals("all")) {
// return employeeRepo.findAll(new Sort(Sort.Direction.ASC, "employeeName"));
// } else if (status.equals("Vacation")) {
// Query query = new Query();
// query.addCriteria(Criteria.where("empSubStatus").ne("Resigned").andOperator(Criteria.where("empSubStatus").ne(null),Criteria.where("empSubStatus").ne("")));
// return mongoTemplate.find(query, Employee.class);
// } else if (status.equals("Resigned")) {
// return employeeRepo.findByEmpSubStatusOrderByEmployeeNameAsc("Resigned");
// } else {
// return employeeRepo.findByEmpStatus(status);
// }
List
<
Employee
>
employeesList
=
employeeRepo
.
findAll
(
new
Sort
(
Sort
.
Direction
.
ASC
,
"employeeName"
));
employeesList
.
stream
().
forEach
(
e
->
{
EmployeeSubStatus
subStatus
=
subStatusService
.
getCurrentSubStatus
(
e
.
getEmployeeId
());
if
(
subStatus
!=
null
)
e
.
setEmpSubStatus
((
EmployeeSubStatus
)
subStatus
);
else
e
.
setEmpSubStatus
(
null
);
});
if
(
status
.
equals
(
"all"
))
{
return
employee
Repo
.
findAll
(
new
Sort
(
Sort
.
Direction
.
ASC
,
"employeeName"
))
;
return
employee
sList
;
}
else
if
(
status
.
equals
(
"Vacation"
))
{
Query
query
=
new
Query
();
query
.
addCriteria
(
Criteria
.
where
(
"empSubStatus"
).
ne
(
"Resigned"
).
andOperator
(
Criteria
.
where
(
"empSubStatus"
).
ne
(
null
),
Criteria
.
where
(
"empSubStatus"
).
ne
(
""
)));
return
mongoTemplate
.
find
(
query
,
Employee
.
class
);
return
employeesList
.
stream
().
filter
(
e
->
e
.
getEmpSubStatus
()!=
null
||
(
e
.
getEmpSubStatus
()!=
null
&&
!
e
.
getEmpSubStatus
().
equals
(
"Resigned"
))
||
(
e
.
getEmpSubStatus
()!=
null
&&
!
e
.
getEmpSubStatus
().
equals
(
""
))).
collect
(
Collectors
.
toList
());
}
else
if
(
status
.
equals
(
"Resigned"
))
{
return
employeeRepo
.
findByEmpSubStatusOrderByEmployeeNameAsc
(
"Resigned"
);
}
else
{
return
employee
Repo
.
findByEmpStatus
(
status
);
return
employee
sList
.
stream
().
filter
(
e
->
e
.
getEmpStatus
().
equals
(
status
)).
collect
(
Collectors
.
toList
()
);
}
}
...
...
@@ -276,15 +301,15 @@ public class EmployeeService implements IEmployeeService {
public
List
<
String
>
getEmployeeDetailsForAutocomplete
()
{
List
<
Employee
>
employeeList
=
employeeRepo
.
findAll
();
List
<
String
>
resultList
=
new
ArrayList
<>();
employeeList
.
stream
().
sorted
(
java
.
util
.
Comparator
.
comparing
(
Employee:
:
getEmployeeId
))
employeeList
.
stream
().
sorted
(
Comparator
.
comparing
(
Employee:
:
getEmployeeId
))
.
collect
(
Collectors
.
toList
()).
forEach
(
employee
->
{
resultList
.
add
(
employee
.
getEmployeeId
());
});
employeeList
.
stream
().
sorted
(
java
.
util
.
Comparator
.
comparing
(
Employee:
:
getEmployeeName
))
employeeList
.
stream
().
sorted
(
Comparator
.
comparing
(
Employee:
:
getEmployeeName
))
.
collect
(
Collectors
.
toList
()).
forEach
(
employee
->
{
resultList
.
add
(
employee
.
getEmployeeName
());
});
employeeList
.
stream
().
sorted
(
java
.
util
.
Comparator
.
comparing
(
Employee:
:
getEmailId
)).
collect
(
Collectors
.
toList
())
employeeList
.
stream
().
sorted
(
Comparator
.
comparing
(
Employee:
:
getEmailId
)).
collect
(
Collectors
.
toList
())
.
forEach
(
employee
->
{
resultList
.
add
(
employee
.
getEmailId
());
});
...
...
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