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
b89c156d
Commit
b89c156d
authored
Jun 01, 2018
by
Rajeshekar
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
MT-51[Rajeshekar]: Capture the project team mate status with dates
parent
20b455e3
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
77 additions
and
1 deletion
+77
-1
ProjectService.java
src/main/java/com/nisum/mytime/service/ProjectService.java
+2
-0
ProjectServiceImpl.java
...ain/java/com/nisum/mytime/service/ProjectServiceImpl.java
+59
-1
UserServiceImpl.java
src/main/java/com/nisum/mytime/service/UserServiceImpl.java
+16
-0
No files found.
src/main/java/com/nisum/mytime/service/ProjectService.java
View file @
b89c156d
...
...
@@ -68,4 +68,6 @@ public interface ProjectService {
List
<
BillingDetails
>
getEmployeeActiveBillingDetails
(
String
empId
,
String
projectId
);
List
<
BillingDetails
>
getEmployeeActiveNisumBench
(
String
empId
);
}
src/main/java/com/nisum/mytime/service/ProjectServiceImpl.java
View file @
b89c156d
...
...
@@ -136,6 +136,15 @@ public class ProjectServiceImpl implements ProjectService {
public
ProjectTeamMate
addProjectTeamMate
(
ProjectTeamMate
projectTeamMate
)
throws
MyTimeException
{
ProjectTeamMate
pT
=
projectTeamMatesRepo
.
save
(
projectTeamMate
);
List
<
BillingDetails
>
listBD
=
getEmployeeActiveNisumBench
(
pT
.
getEmployeeId
());
for
(
BillingDetails
b
:
listBD
)
{
Date
d
=
new
Date
();
d
.
setDate
(
d
.
getDate
()
-
1
);
b
.
setBillingEndDate
(
d
);
b
.
setActive
(
false
);
updateEmployeeBilling
(
b
);
}
BillingDetails
billings
=
new
BillingDetails
();
billings
.
setEmployeeId
(
pT
.
getEmployeeId
());
billings
.
setEmployeeName
(
pT
.
getEmployeeName
());
...
...
@@ -146,6 +155,7 @@ public class ProjectServiceImpl implements ProjectService {
billings
.
setBillingStartDate
(
pT
.
getStartDate
());
billings
.
setBillingEndDate
(
pT
.
getEndDate
());
billings
.
setCreateDate
(
new
Date
());
addEmployeeBillingDetails
(
billings
);
return
pT
;
}
...
...
@@ -169,7 +179,9 @@ public class ProjectServiceImpl implements ProjectService {
projectTeamMate
.
getProjectId
());
if
(
listBD
!=
null
&&
!
listBD
.
isEmpty
())
{
BillingDetails
billingDetails
=
listBD
.
get
(
0
);
billingDetails
.
setBillingEndDate
(
new
Date
());
Date
d
=
new
Date
();
d
.
setDate
(
d
.
getDate
()
-
1
);
billingDetails
.
setBillingEndDate
(
d
);
billingDetails
.
setActive
(
false
);
updateEmployeeBilling
(
billingDetails
);
}
...
...
@@ -203,6 +215,26 @@ public class ProjectServiceImpl implements ProjectService {
ProjectTeamMate
existingTeammate
=
projectTeamMatesRepo
.
findById
(
id
);
existingTeammate
.
setActive
(
false
);
existingTeammate
.
setEndDate
(
new
Date
());
BillingDetails
billingDetails
=
new
BillingDetails
();
billingDetails
.
setBillableStatus
(
"Bench"
);
billingDetails
.
setBillingStartDate
(
new
Date
());
billingDetails
.
setActive
(
true
);
billingDetails
.
setEmployeeId
(
existingTeammate
.
getEmployeeId
());
billingDetails
.
setEmployeeName
(
existingTeammate
.
getEmployeeName
());
billingDetails
.
setCreateDate
(
new
Date
());
billingDetails
.
setProjectId
(
"Nisum0000"
);
billingDetails
.
setProjectName
(
"Free Pool"
);
addEmployeeBillingDetails
(
billingDetails
);
List
<
BillingDetails
>
listBD
=
getEmployeeActiveBillingDetails
(
empId
,
projectId
);
if
(
listBD
!=
null
&&
!
listBD
.
isEmpty
())
{
BillingDetails
billingDetailsExisting
=
listBD
.
get
(
0
);
Date
d
=
new
Date
();
d
.
setDate
(
d
.
getDate
()
-
1
);
billingDetailsExisting
.
setBillingEndDate
(
d
);
billingDetailsExisting
.
setActive
(
false
);
updateEmployeeBilling
(
billingDetailsExisting
);
}
projectTeamMatesRepo
.
save
(
existingTeammate
);
}
...
...
@@ -324,6 +356,32 @@ public class ProjectServiceImpl implements ProjectService {
String
projectId
)
{
Query
query4
=
new
Query
();
query4
.
addCriteria
(
Criteria
.
where
(
"active"
).
is
(
new
Boolean
(
true
)));
query4
.
addCriteria
(
Criteria
.
where
(
"employeeId"
).
is
(
empId
));
query4
.
addCriteria
(
Criteria
.
where
(
"projectId"
).
is
(
projectId
));
List
<
BillingDetails
>
billings
=
mongoTemplate
.
find
(
query4
,
BillingDetails
.
class
);
List
<
BillingDetails
>
billingsSorted
=
billings
;
try
{
billingsSorted
=
(
billings
==
null
||
billings
.
size
()
==
0
)
?
billings
:
billings
.
stream
()
.
sorted
(
Comparator
.
comparing
(
BillingDetails:
:
getBillingStartDate
)
.
reversed
())
.
collect
(
Collectors
.
toList
());
}
catch
(
Exception
e
)
{
// TODO: handle exception
}
return
billingsSorted
;
}
@Override
public
List
<
BillingDetails
>
getEmployeeActiveNisumBench
(
String
empId
)
{
Query
query4
=
new
Query
();
query4
.
addCriteria
(
Criteria
.
where
(
"active"
).
is
(
new
Boolean
(
true
)));
query4
.
addCriteria
(
Criteria
.
where
(
"projectId"
).
is
(
"Nisum0000"
));
query4
.
addCriteria
(
Criteria
.
where
(
"employeeId"
).
is
(
empId
));
List
<
BillingDetails
>
billings
=
mongoTemplate
.
find
(
query4
,
BillingDetails
.
class
);
List
<
BillingDetails
>
billingsSorted
=
billings
;
...
...
src/main/java/com/nisum/mytime/service/UserServiceImpl.java
View file @
b89c156d
...
...
@@ -15,6 +15,7 @@ import org.springframework.stereotype.Service;
import
com.nisum.mytime.exception.handler.MyTimeException
;
import
com.nisum.mytime.model.Account
;
import
com.nisum.mytime.model.BillingDetails
;
import
com.nisum.mytime.model.Designation
;
import
com.nisum.mytime.model.EmpLoginData
;
import
com.nisum.mytime.model.EmployeeRoles
;
...
...
@@ -42,6 +43,8 @@ public class UserServiceImpl implements UserService {
@Autowired
private
ProjectTeamMatesRepo
projectTeamMatesRepo
;
@Autowired
private
ProjectService
projectService
;
@Autowired
private
ShiftRepo
shiftRepo
;
...
...
@@ -100,6 +103,19 @@ public class UserServiceImpl implements UserService {
employeeRoles
.
setCreatedOn
(
new
Date
());
employeeRoles
.
setEmpStatus
(
"Active"
);
employeeRoles
.
setEmploymentType
(
"Full Time"
);
BillingDetails
billingDetails
=
new
BillingDetails
();
billingDetails
.
setBillableStatus
(
"Bench"
);
billingDetails
.
setBillingStartDate
(
employeeRoles
.
getDateOfJoining
()
!=
null
?
employeeRoles
.
getDateOfJoining
()
:
new
Date
());
billingDetails
.
setActive
(
true
);
billingDetails
.
setEmployeeId
(
employeeRoles
.
getEmployeeId
());
billingDetails
.
setEmployeeName
(
employeeRoles
.
getEmployeeName
());
billingDetails
.
setCreateDate
(
new
Date
());
billingDetails
.
setProjectId
(
"Nisum0000"
);
billingDetails
.
setProjectName
(
"Free Pool"
);
projectService
.
addEmployeeBillingDetails
(
billingDetails
);
return
employeeRolesRepo
.
save
(
employeeRoles
);
}
...
...
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