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
99c88358
Commit
99c88358
authored
Aug 03, 2018
by
Sridhar Sathu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
CheckingBillingstatusServiceANDAddEnddateValidation
parent
ede7fbd1
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
111 additions
and
30 deletions
+111
-30
ProjectTeamController.java
...va/com/nisum/mytime/controller/ProjectTeamController.java
+14
-2
ProjectService.java
src/main/java/com/nisum/mytime/service/ProjectService.java
+4
-1
ProjectServiceImpl.java
...ain/java/com/nisum/mytime/service/ProjectServiceImpl.java
+90
-26
MyTimeUtils.java
src/main/java/com/nisum/mytime/utils/MyTimeUtils.java
+3
-1
No files found.
src/main/java/com/nisum/mytime/controller/ProjectTeamController.java
View file @
99c88358
...
...
@@ -215,10 +215,10 @@ public class ProjectTeamController {
@RequestMapping
(
value
=
"/getProjectDetails"
,
method
=
RequestMethod
.
GET
,
produces
=
MediaType
.
APPLICATION_JSON_VALUE
)
public
ResponseEntity
<
List
<
ProjectTeamMate
>>
getProjectDetails
(
@RequestParam
(
"projectId"
)
String
projectId
)
@RequestParam
(
"projectId"
)
String
projectId
,
@RequestParam
(
"status"
)
String
status
)
throws
MyTimeException
{
List
<
ProjectTeamMate
>
employeesRoles
=
projectService
.
getProjectDetails
(
projectId
);
.
getProjectDetails
(
projectId
,
status
);
return
new
ResponseEntity
<>(
employeesRoles
,
HttpStatus
.
OK
);
}
...
...
@@ -334,4 +334,16 @@ public class ProjectTeamController {
}
}
@RequestMapping
(
value
=
"/addEmployeeToTeamWithCheck"
,
method
=
RequestMethod
.
POST
,
produces
=
MediaType
.
TEXT_PLAIN_VALUE
,
consumes
=
MediaType
.
APPLICATION_JSON_VALUE
)
public
ResponseEntity
<
String
>
addEmployeeToTeamWithCheck
(
@RequestBody
ProjectTeamMate
teamMate
)
throws
MyTimeException
{
String
response
=
null
;
response
=
projectService
.
addProjectTeamMateWithCheck
(
teamMate
);
return
new
ResponseEntity
<>(
response
,
HttpStatus
.
OK
);
}
}
\ No newline at end of file
src/main/java/com/nisum/mytime/service/ProjectService.java
View file @
99c88358
...
...
@@ -55,7 +55,7 @@ public interface ProjectService {
List
<
ProjectTeamMate
>
getAllProjectDetails
();
List
<
ProjectTeamMate
>
getProjectDetails
(
String
projectId
);
List
<
ProjectTeamMate
>
getProjectDetails
(
String
projectId
,
String
status
);
public
List
<
ProjectTeamMate
>
getMyProjectAllocations
(
String
empId
);
...
...
@@ -84,4 +84,7 @@ public interface ProjectService {
List
<
ProjectTeamMate
>
findByAccountAndActiveAndBillableStatus
(
String
account
,
boolean
status
,
String
billableStatus
);
public
String
addProjectTeamMateWithCheck
(
ProjectTeamMate
projectTeamMate
)
throws
MyTimeException
;
}
src/main/java/com/nisum/mytime/service/ProjectServiceImpl.java
View file @
99c88358
...
...
@@ -111,7 +111,6 @@ public class ProjectServiceImpl implements ProjectService {
List
<
HashMap
<
String
,
String
>>
managerList
=
null
;
List
<
Project
>
projects
=
projectRepo
.
findAll
();
for
(
Project
p
:
projects
)
{
System
.
out
.
println
(
"==========================="
+
p
);
HashMap
<
Object
,
Object
>
projectMap
=
new
HashMap
<>();
projectMap
.
put
(
"id"
,
p
.
getId
());
projectMap
.
put
(
"projectId"
,
p
.
getProjectId
());
...
...
@@ -401,6 +400,51 @@ public class ProjectServiceImpl implements ProjectService {
.
findByEmployeeId
(
teamMate
.
getEmployeeId
());
employeeDB
.
setShift
(
teamMate
.
getShift
());
employeeRolesRepo
.
save
(
employeeDB
);
if
(
projectTeamMate
.
getEndDate
().
compareTo
(
new
Date
())
<
0
)
{
ProjectTeamMate
existingTeammate1
=
projectTeamMatesRepo
.
findById
(
projectTeamMate
.
getId
());
existingTeammate1
.
setActive
(
false
);
existingTeammate1
.
setEndDate
(
new
Date
());
BillingDetails
billingDetails
=
new
BillingDetails
();
billingDetails
.
setBillableStatus
(
"Non-Billable"
);
billingDetails
.
setBillingStartDate
(
new
Date
());
billingDetails
.
setAccount
(
"Nisum"
);
billingDetails
.
setActive
(
true
);
billingDetails
.
setEmployeeId
(
existingTeammate1
.
getEmployeeId
());
billingDetails
.
setEmployeeName
(
existingTeammate1
.
getEmployeeName
());
billingDetails
.
setCreateDate
(
new
Date
());
billingDetails
.
setProjectId
(
"Nisum0000"
);
billingDetails
.
setProjectName
(
MyTimeUtils
.
FREE_POLL
);
addEmployeeBillingDetails
(
billingDetails
);
List
<
BillingDetails
>
listBD
=
getEmployeeActiveBillingDetails
(
projectTeamMate
.
getEmployeeId
(),
projectTeamMate
.
getProjectId
());
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
(
existingTeammate1
);
ProjectTeamMate
newBenchAllocation
=
new
ProjectTeamMate
();
newBenchAllocation
.
setAccount
(
"Nisum"
);
newBenchAllocation
.
setBillableStatus
(
"Non-Billable"
);
newBenchAllocation
.
setDesignation
(
existingTeammate1
.
getDesignation
());
newBenchAllocation
.
setEmailId
(
existingTeammate1
.
getEmailId
());
newBenchAllocation
.
setEmployeeId
(
existingTeammate1
.
getEmployeeId
());
newBenchAllocation
.
setActive
(
true
);
newBenchAllocation
.
setEmployeeName
(
existingTeammate1
.
getEmployeeName
());
newBenchAllocation
.
setProjectId
(
"Nisum0000"
);
newBenchAllocation
.
setStartDate
(
new
Date
());
Project
p
=
projectRepo
.
findByProjectId
(
"Nisum0000"
);
newBenchAllocation
.
setProjectName
(
p
.
getProjectName
());
// newBenchAllocation.setManagerId(p.getManagerId());
// newBenchAllocation.setManagerName(p.getManagerName());
projectTeamMatesRepo
.
save
(
newBenchAllocation
);
updateShiftDetails
(
existingTeammate1
);
}
return
teamMate
;
}
...
...
@@ -444,7 +488,7 @@ public class ProjectServiceImpl implements ProjectService {
billingDetails
.
setEmployeeName
(
existingTeammate
.
getEmployeeName
());
billingDetails
.
setCreateDate
(
new
Date
());
billingDetails
.
setProjectId
(
"Nisum0000"
);
billingDetails
.
setProjectName
(
"Free Pool"
);
billingDetails
.
setProjectName
(
MyTimeUtils
.
FREE_POLL
);
addEmployeeBillingDetails
(
billingDetails
);
List
<
BillingDetails
>
listBD
=
getEmployeeActiveBillingDetails
(
empId
,
projectId
);
...
...
@@ -568,30 +612,22 @@ public class ProjectServiceImpl implements ProjectService {
}
@Override
public
List
<
ProjectTeamMate
>
getProjectDetails
(
String
projectId
)
{
// return projectTeamMatesRepo.findByProjectId(projectId);
// MT-79: adding the existing managerIds in List and sending them as
// response
List
<
ProjectTeamMate
>
teamMatesList
=
new
ArrayList
<>();
List
<
ProjectTeamMate
>
teamMates
=
projectTeamMatesRepo
.
findByProjectId
(
projectId
);
System
.
out
.
println
(
"=================from details id"
+
teamMates
);
/*
* for(ProjectTeamMate pt:teamMates) { if(pt.getManagerIds()== null &&
* pt.getManagerId()!= null)
* pt.setManagerIds(Arrays.asList(pt.getManagerId())); }
*/
/* for(ProjectTeamMate projectTeamMate:teamMates)
{
//Active
if(statusFlag.equals("1") && projectTeamMate.getEndDate().compareTo(new Date())>=0)
public
List
<
ProjectTeamMate
>
getProjectDetails
(
String
projectId
,
String
statusFlag
)
{
List
<
ProjectTeamMate
>
teamMatesList
=
new
ArrayList
<>();
List
<
ProjectTeamMate
>
teamMates
=
projectTeamMatesRepo
.
findByProjectId
(
projectId
);
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("2")&& projectTeamMate.getEndDate().compareTo(new Date())<0)
else
if
(
statusFlag
.
equals
(
MyTimeUtils
.
IN_ACTIVE
)
&&
projectTeamMate
.
getEndDate
().
compareTo
(
new
Date
())
<
0
)
teamMatesList
.
add
(
projectTeamMate
);
else if(statusFlag.equals("3"
))
else
if
(
statusFlag
.
equals
(
MyTimeUtils
.
BOTH
))
teamMatesList
.
add
(
projectTeamMate
);
}*/
return
teamMates
;
}
}
return
teamMatesList
;
}
...
...
@@ -897,4 +933,32 @@ public class ProjectServiceImpl implements ProjectService {
}
return
EmployeeList
;
}
@Override
public
String
addProjectTeamMateWithCheck
(
ProjectTeamMate
projectTeamMate
)
throws
MyTimeException
{
int
count
=
0
;
String
projectName
=
null
;
String
fromDate
=
null
;
String
toDate
=
null
;
List
<
ProjectTeamMate
>
teamMateList
=
projectTeamMatesRepo
.
findAll
();
for
(
ProjectTeamMate
projectMate
:
teamMateList
)
{
if
(
projectTeamMate
.
getEmployeeId
().
equals
(
projectMate
.
getEmployeeId
())
&&
projectMate
.
isActive
()
&&
!
projectMate
.
getProjectId
().
equals
(
"Nisum0000"
))
{
if
(++
count
==
1
)
{
projectName
=
projectMate
.
getProjectName
();
fromDate
=
projectMate
.
getStartDate
().
toString
();
toDate
=
projectMate
.
getEndDate
().
toString
();
}
break
;
}
}
if
(
count
>
0
)
return
"Resource "
+
projectTeamMate
.
getEmployeeId
()
+
" already Assigned to the "
+
projectName
+
" Project"
+
" from "
+
fromDate
+
"to "
+
toDate
;
else
addProjectTeamMate
(
projectTeamMate
);
return
"TeamMate added successfuly"
;
}
}
src/main/java/com/nisum/mytime/utils/MyTimeUtils.java
View file @
99c88358
...
...
@@ -62,7 +62,7 @@ public class MyTimeUtils {
public
final
static
String
SET
=
"$set"
;
public
final
static
int
MINUS_ONE
=
-
1
;
public
final
static
String
FREE_POLL
=
"
Free Pool
"
;
public
final
static
String
FREE_POLL
=
"
Bench
"
;
public
final
static
String
START_DATE
=
"startDate"
;
//Domain Constants
...
...
@@ -103,4 +103,6 @@ public class MyTimeUtils {
public
static
final
String
LEAD
=
"Lead"
;
public
static
final
String
IS_ACTIVE
=
"isActive"
;
public
final
static
String
BOTH
=
"Both"
;
}
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