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
9b203e2a
Commit
9b203e2a
authored
Jul 25, 2018
by
ssathu-nisum-com
Committed by
tdutta-nisum-com
Jul 25, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
MT-106_Add_role_option_in_addteammate_screen (#57)
parent
b46b0f61
Changes
10
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
97 additions
and
29 deletions
+97
-29
ProjectController.java
...n/java/com/nisum/mytime/controller/ProjectController.java
+4
-2
ProjectTeamController.java
...va/com/nisum/mytime/controller/ProjectTeamController.java
+14
-0
Project.java
src/main/java/com/nisum/mytime/model/Project.java
+9
-4
ProjectTeamMate.java
src/main/java/com/nisum/mytime/model/ProjectTeamMate.java
+3
-1
AccountRepo.java
src/main/java/com/nisum/mytime/repository/AccountRepo.java
+2
-1
ProjectRepo.java
src/main/java/com/nisum/mytime/repository/ProjectRepo.java
+1
-1
ProjectTeamMatesRepo.java
...ava/com/nisum/mytime/repository/ProjectTeamMatesRepo.java
+2
-2
ProjectServiceImpl.java
...ain/java/com/nisum/mytime/service/ProjectServiceImpl.java
+59
-16
UserServiceImpl.java
src/main/java/com/nisum/mytime/service/UserServiceImpl.java
+2
-2
MyTimeUtils.java
src/main/java/com/nisum/mytime/utils/MyTimeUtils.java
+1
-0
No files found.
src/main/java/com/nisum/mytime/controller/ProjectController.java
View file @
9b203e2a
...
...
@@ -40,8 +40,10 @@ public class ProjectController {
@RequestMapping
(
value
=
"/addProject"
,
method
=
RequestMethod
.
POST
,
produces
=
MediaType
.
APPLICATION_JSON_VALUE
,
consumes
=
MediaType
.
APPLICATION_JSON_VALUE
)
public
ResponseEntity
<
Project
>
addProject
(
@RequestBody
Project
projectAdded
)
throws
MyTimeException
{
String
accountName
=
projectAdded
.
getAccount
();
Account
account
=
accountRepo
.
findByAccountName
(
accountName
);
String
accountId
=
projectAdded
.
getAccountId
();
// String accountName=projectAdded.getAccount();
Account
account
=
accountRepo
.
findByAccountId
(
accountId
);
String
accountName
=
account
.
getAccountName
();
int
sequenceNumber
=
account
.
getAccountProjectSequence
();
account
.
setAccountProjectSequence
(
sequenceNumber
+
1
);
accountRepo
.
save
(
account
);
...
...
src/main/java/com/nisum/mytime/controller/ProjectTeamController.java
View file @
9b203e2a
package
com
.
nisum
.
mytime
.
controller
;
import
java.util.ArrayList
;
import
java.util.Arrays
;
import
java.util.List
;
import
java.util.stream.Collectors
;
...
...
@@ -37,6 +38,9 @@ public class ProjectTeamController {
@Autowired
private
EmployeeVisaRepo
employeeVisaRepo
;
@Autowired
private
ProjectController
projectController
;
@RequestMapping
(
value
=
"/employee"
,
method
=
RequestMethod
.
GET
,
produces
=
MediaType
.
APPLICATION_JSON_VALUE
)
...
...
@@ -123,6 +127,16 @@ public class ProjectTeamController {
@RequestBody
ProjectTeamMate
teamMate
)
throws
MyTimeException
{
teamMate
.
setActive
(
true
);
// teamMate.setStartDate(new Date());
if
(
teamMate
.
getRole
().
equals
(
"Lead"
))
{
Project
project
=
new
Project
();
project
.
setProjectName
(
teamMate
.
getProjectName
());
project
.
setManagerIds
(
Arrays
.
asList
(
teamMate
.
getEmployeeId
()));
project
.
setAccountId
(
teamMate
.
getAccountId
());
project
.
setDomainId
(
teamMate
.
getDomainId
());
project
.
setStatus
(
"Active"
);
projectController
.
addProject
(
project
);
}
ProjectTeamMate
teamMateDB
=
projectService
.
addProjectTeamMate
(
teamMate
);
return
new
ResponseEntity
<>(
teamMateDB
,
HttpStatus
.
OK
);
...
...
src/main/java/com/nisum/mytime/model/Project.java
View file @
9b203e2a
...
...
@@ -27,12 +27,17 @@ public class Project implements Serializable {
private
ObjectId
id
;
private
String
projectId
;
private
String
projectName
;
private
String
managerId
;
private
String
managerName
;
private
String
account
;
private
String
domain
;
/*
* After Ui Integration this below commented code will be removed
*/
//private String managerId;
// private String managerName;
// private String account;
// private String domain;
private
String
status
;
private
List
<
String
>
employeeIds
;
private
List
<
String
>
managerIds
;
private
String
accountId
;
private
String
domainId
;
}
src/main/java/com/nisum/mytime/model/ProjectTeamMate.java
View file @
9b203e2a
...
...
@@ -49,6 +49,8 @@ public class ProjectTeamMate implements Serializable {
@DateTimeFormat
(
iso
=
ISO
.
DATE
)
private
Date
newBillingStartDate
;
private
boolean
active
;
private
List
<
String
>
managerIds
;
//private List<String> managerIds;
private
String
accountId
;
private
String
domainId
;
}
src/main/java/com/nisum/mytime/repository/AccountRepo.java
View file @
9b203e2a
...
...
@@ -7,5 +7,6 @@ import com.nisum.mytime.model.Account;
public
interface
AccountRepo
extends
MongoRepository
<
Account
,
String
>
{
Account
findByAccountName
(
String
accontName
);
Account
findByAccountId
(
String
accountId
);
Account
findByAccountId
(
String
accountId
);
}
\ No newline at end of file
src/main/java/com/nisum/mytime/repository/ProjectRepo.java
View file @
9b203e2a
...
...
@@ -10,5 +10,5 @@ public interface ProjectRepo extends MongoRepository<Project, String> {
Project
findByProjectId
(
String
projectId
);
List
<
Project
>
findByManagerId
(
String
managerId
);
//
List<Project> findByManagerId(String managerId);
}
\ No newline at end of file
src/main/java/com/nisum/mytime/repository/ProjectTeamMatesRepo.java
View file @
9b203e2a
...
...
@@ -12,9 +12,9 @@ public interface ProjectTeamMatesRepo
List
<
ProjectTeamMate
>
findByProjectId
(
String
projectId
);
List
<
ProjectTeamMate
>
findByManagerId
(
String
projectId
);
//
List<ProjectTeamMate> findByManagerId(String projectId);
List
<
ProjectTeamMate
>
findByManagerIds
(
String
managerId
);
//
List<ProjectTeamMate> findByManagerIds(String managerId);
List
<
ProjectTeamMate
>
findByEmployeeId
(
String
employeeId
);
...
...
src/main/java/com/nisum/mytime/service/ProjectServiceImpl.java
View file @
9b203e2a
...
...
@@ -25,14 +25,18 @@ import org.springframework.util.CollectionUtils;
import
com.mongodb.BasicDBObject
;
import
com.mongodb.DBCollection
;
import
com.nisum.mytime.controller.DomainController
;
import
com.nisum.mytime.exception.handler.MyTimeException
;
import
com.nisum.mytime.model.Account
;
import
com.nisum.mytime.model.BillingDetails
;
import
com.nisum.mytime.model.Domains
;
import
com.nisum.mytime.model.EmpLoginData
;
import
com.nisum.mytime.model.EmpShiftDetails
;
import
com.nisum.mytime.model.EmployeeDashboardVO
;
import
com.nisum.mytime.model.EmployeeRoles
;
import
com.nisum.mytime.model.Project
;
import
com.nisum.mytime.model.ProjectTeamMate
;
import
com.nisum.mytime.repository.AccountRepo
;
import
com.nisum.mytime.repository.EmpShiftDetailsRepo
;
import
com.nisum.mytime.repository.EmployeeRolesRepo
;
import
com.nisum.mytime.repository.ProjectRepo
;
...
...
@@ -64,6 +68,18 @@ public class ProjectServiceImpl implements ProjectService {
private
MongoTemplate
mongoTemplate
;
@Autowired
private
EmpShiftDetailsRepo
empShiftDetailsRepo
;
@Autowired
private
DomainController
domainController
;
@Autowired
private
RoleInfoService
roleInfoService
;
@Autowired
private
RoleMappingService
roleMappingService
;
@Autowired
private
AccountRepo
accountRepo
;
@Override
public
List
<
EmpLoginData
>
employeeLoginsBasedOnDate
(
long
id
,
...
...
@@ -93,14 +109,16 @@ public class ProjectServiceImpl implements ProjectService {
projectMap
.
put
(
"id"
,
p
.
getId
());
projectMap
.
put
(
"projectId"
,
p
.
getProjectId
());
projectMap
.
put
(
"projectName"
,
p
.
getProjectName
());
projectMap
.
put
(
"account"
,
p
.
getAccount
());
projectMap
.
put
(
"domain"
,
p
.
getDomain
());
Account
account
=
accountRepo
.
findByAccountId
(
p
.
getAccountId
());
projectMap
.
put
(
"account"
,
account
);
projectMap
.
put
(
"accountId"
,
p
.
getAccountId
());
projectMap
.
put
(
"domainId"
,
p
.
getDomainId
());
projectMap
.
put
(
"status"
,
p
.
getStatus
());
projectMap
.
put
(
"employeeIds"
,
p
.
getEmployeeIds
());
if
(
p
.
getManagerIds
()
==
null
&&
p
.
getManagerId
()
!=
null
)
{
/*
if (p.getManagerIds() == null && p.getManagerId() != null) {
EmployeeList = getEmployeeData(Arrays.asList(p.getManagerId()));
}
else
if
(
p
.
getManagerIds
()
!=
null
)
{
} else
*/
if
(
p
.
getManagerIds
()
!=
null
)
{
List
<
String
>
managerIds
=
p
.
getManagerIds
();
EmployeeList
=
getEmployeeData
(
managerIds
);
...
...
@@ -113,6 +131,14 @@ public class ProjectServiceImpl implements ProjectService {
@Override
public
Project
addProject
(
Project
project
)
throws
MyTimeException
{
if
(
project
.
getDomainId
()==
null
)
{
Domains
domain
=
new
Domains
();
domain
.
setAccountId
(
project
.
getAccountId
());
domain
.
setDomainId
(
project
.
getDomainId
());
domain
.
setDeliveryManagers
(
project
.
getManagerIds
());
domainController
.
addDomain
(
domain
);
}
return
projectRepo
.
save
(
project
);
}
...
...
@@ -141,10 +167,10 @@ public class ProjectServiceImpl implements ProjectService {
if
(
project
.
getManagerIds
()!=
null
)
{
update
.
set
(
"managerIds"
,
project
.
getManagerIds
());
}
else
{
}
/*
else{
update.set("managerIds",Arrays.asList(project.getManagerId()));
}
update
.
set
(
"account
"
,
project
.
getAccount
());
}
*/
update
.
set
(
"account
Id"
,
project
.
getAccountId
());
update
.
set
(
"status"
,
project
.
getStatus
());
FindAndModifyOptions
options
=
new
FindAndModifyOptions
();
options
.
returnNew
(
true
);
...
...
@@ -157,10 +183,10 @@ public class ProjectServiceImpl implements ProjectService {
for
(
ProjectTeamMate
emp
:
employeeDetails
)
{
//emp.setManagerId(projectDB.getManagerId());
//emp.setManagerName(projectDB.getManagerName());
emp
.
set
Account
(
projectDB
.
getAccount
());
emp
.
set
accountId
(
projectDB
.
getAccountId
());
emp
.
setProjectName
(
projectDB
.
getProjectName
());
//MT-79:Maintatin the managerids in List
emp
.
setManagerIds
(
projectDB
.
getManagerIds
());
//
emp.setManagerIds(projectDB.getManagerIds());
projectTeamMatesRepo
.
save
(
emp
);
}
}
...
...
@@ -174,9 +200,17 @@ public class ProjectServiceImpl implements ProjectService {
@Override
public
List
<
ProjectTeamMate
>
getTeamDetails
(
String
empId
)
{
// return projectTeamMatesRepo.findByManagerId(empId);
// MT-79:maintain the ManagerIds in List
return
projectTeamMatesRepo
.
findByManagerIds
(
empId
);
// return projectTeamMatesRepo.findByManagerId(empId);
// MT-79:maintain the ManagerIds in List
List
<
String
>
projectsId
=
new
ArrayList
<>();
Query
query
=
new
Query
(
Criteria
.
where
(
"employeeId"
).
is
(
empId
).
and
(
"role"
).
is
(
"Lead"
));
List
<
ProjectTeamMate
>
projectMatesList
=
mongoTemplate
.
find
(
query
,
ProjectTeamMate
.
class
);
for
(
ProjectTeamMate
projectMate
:
projectMatesList
)
projectsId
.
add
(
projectMate
.
getProjectId
());
Query
query1
=
new
Query
(
Criteria
.
where
(
"projectId"
).
in
(
projectsId
));
List
<
ProjectTeamMate
>
projectMateList
=
mongoTemplate
.
find
(
query1
,
ProjectTeamMate
.
class
);
// return projectTeamMatesRepo.findByManagerIds(empId);
return
projectMateList
;
}
...
...
@@ -235,6 +269,15 @@ public class ProjectServiceImpl implements ProjectService {
}
}
}
if
(
projectTeamMate
.
getRole
().
equals
(
"Lead"
))
{
Query
query
=
new
Query
(
Criteria
.
where
(
"employeeId"
).
is
(
projectTeamMate
.
getEmployeeId
()).
and
(
"role"
).
ne
(
"Lead"
));
List
<
ProjectTeamMate
>
projectMates
=
mongoTemplate
.
find
(
query
,
ProjectTeamMate
.
class
);
if
(
projectMates
.
size
()
==
0
)
{
String
roleId
=
roleInfoService
.
getRole
(
MyTimeUtils
.
LEAD
);
roleMappingService
.
saveUniqueEmployeeAndRole
(
Arrays
.
asList
(
projectTeamMate
.
getEmployeeId
()),
roleId
);
}
}
return
pT
;
}
...
...
@@ -359,8 +402,8 @@ public class ProjectServiceImpl implements ProjectService {
newBenchAllocation
.
setStartDate
(
new
Date
());
Project
p
=
projectRepo
.
findByProjectId
(
"Nisum0000"
);
newBenchAllocation
.
setProjectName
(
p
.
getProjectName
());
newBenchAllocation
.
setManagerId
(
p
.
getManagerId
());
newBenchAllocation
.
setManagerName
(
p
.
getManagerName
());
//
newBenchAllocation.setManagerId(p.getManagerId());
//
newBenchAllocation.setManagerName(p.getManagerName());
projectTeamMatesRepo
.
save
(
newBenchAllocation
);
updateShiftDetails
(
existingTeammate
);
}
...
...
@@ -451,11 +494,11 @@ public class ProjectServiceImpl implements ProjectService {
//return projectTeamMatesRepo.findByProjectId(projectId);
//MT-79: adding the existing managerIds in List and sending them as response
List
<
ProjectTeamMate
>
teamMates
=
projectTeamMatesRepo
.
findByProjectId
(
projectId
);
for
(
ProjectTeamMate
pt:
teamMates
)
/*
for(ProjectTeamMate pt:teamMates)
{
if(pt.getManagerIds()== null && pt.getManagerId()!= null)
pt.setManagerIds(Arrays.asList(pt.getManagerId()));
}
}
*/
return
teamMates
;
}
...
...
src/main/java/com/nisum/mytime/service/UserServiceImpl.java
View file @
9b203e2a
...
...
@@ -152,8 +152,8 @@ public class UserServiceImpl implements UserService {
:
new
Date
());
Project
p
=
projectRepo
.
findByProjectId
(
"Nisum0000"
);
newBenchAllocation
.
setProjectName
(
p
.
getProjectName
());
newBenchAllocation
.
setManagerId
(
p
.
getManagerId
());
newBenchAllocation
.
setManagerName
(
p
.
getManagerName
());
//
newBenchAllocation.setManagerId(p.getManagerId());
//
newBenchAllocation.setManagerName(p.getManagerName());
try
{
projectService
.
addProjectTeamMate
(
newBenchAllocation
);
}
catch
(
MyTimeException
e
)
{
...
...
src/main/java/com/nisum/mytime/utils/MyTimeUtils.java
View file @
9b203e2a
...
...
@@ -96,5 +96,6 @@ public class MyTimeUtils {
public
static
final
String
PROJECT
=
"Delivery Lead"
;
public
static
final
String
DOMAIN
=
"Delivery Manager"
;
public
static
final
String
IS_ACTIVE
=
"isActive"
;
public
static
final
String
LEAD
=
"Lead"
;
}
\ No newline at end of file
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