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
deb28aca
Commit
deb28aca
authored
Sep 19, 2018
by
Vijay Akula
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Refactored the code related to UserController,UserService and UserRepo.
parent
65c9aaa9
Changes
64
Hide whitespace changes
Inline
Side-by-side
Showing
64 changed files
with
1120 additions
and
589 deletions
+1120
-589
AttendanceController.java
...ava/com/nisum/mytime/controller/AttendanceController.java
+4
-4
DesignationController.java
...va/com/nisum/mytime/controller/DesignationController.java
+34
-0
EmailController.java
...ain/java/com/nisum/mytime/controller/EmailController.java
+2
-2
EmployeeController.java
.../java/com/nisum/mytime/controller/EmployeeController.java
+247
-0
EmployeeLocationController.java
...m/nisum/mytime/controller/EmployeeLocationController.java
+30
-0
MasterDataController.java
...ava/com/nisum/mytime/controller/MasterDataController.java
+41
-0
OrgLocationController.java
...va/com/nisum/mytime/controller/OrgLocationController.java
+39
-0
ProjectController.java
...n/java/com/nisum/mytime/controller/ProjectController.java
+5
-5
ProjectTeamController.java
...va/com/nisum/mytime/controller/ProjectTeamController.java
+10
-10
ReportsController.java
...n/java/com/nisum/mytime/controller/ReportsController.java
+4
-4
ShiftController.java
...ain/java/com/nisum/mytime/controller/ShiftController.java
+34
-0
SkillController.java
...ain/java/com/nisum/mytime/controller/SkillController.java
+34
-0
UserController.java
...main/java/com/nisum/mytime/controller/UserController.java
+0
-293
VisaController.java
...main/java/com/nisum/mytime/controller/VisaController.java
+2
-2
Account.java
src/main/java/com/nisum/mytime/model/Account.java
+1
-1
Designation.java
src/main/java/com/nisum/mytime/model/Designation.java
+1
-1
Domain.java
src/main/java/com/nisum/mytime/model/Domain.java
+1
-1
Employee.java
src/main/java/com/nisum/mytime/model/Employee.java
+1
-1
MasterData.java
src/main/java/com/nisum/mytime/model/MasterData.java
+1
-1
Project.java
src/main/java/com/nisum/mytime/model/Project.java
+1
-1
Role.java
src/main/java/com/nisum/mytime/model/Role.java
+2
-2
Shift.java
src/main/java/com/nisum/mytime/model/Shift.java
+1
-1
Skill.java
src/main/java/com/nisum/mytime/model/Skill.java
+1
-1
EmployeeRepo.java
src/main/java/com/nisum/mytime/repository/EmployeeRepo.java
+1
-1
RoleInfoRepo.java
src/main/java/com/nisum/mytime/repository/RoleInfoRepo.java
+4
-4
SkillRepo.java
src/main/java/com/nisum/mytime/repository/SkillRepo.java
+1
-1
MyTimeCronSchedularJob.java
...va/com/nisum/mytime/schedular/MyTimeCronSchedularJob.java
+1
-1
IAccountService.java
src/main/java/com/nisum/mytime/service/IAccountService.java
+0
-2
IAttendanceService.java
...ain/java/com/nisum/mytime/service/IAttendanceService.java
+1
-1
IDesignationService.java
...in/java/com/nisum/mytime/service/IDesignationService.java
+14
-0
IDomainService.java
src/main/java/com/nisum/mytime/service/IDomainService.java
+2
-0
IEmployeeLocationService.java
...va/com/nisum/mytime/service/IEmployeeLocationService.java
+17
-0
IEmployeeService.java
src/main/java/com/nisum/mytime/service/IEmployeeService.java
+16
-11
IMailService.java
src/main/java/com/nisum/mytime/service/IMailService.java
+1
-1
IMasterDataService.java
...ain/java/com/nisum/mytime/service/IMasterDataService.java
+14
-0
IOrgLocationService.java
...in/java/com/nisum/mytime/service/IOrgLocationService.java
+14
-0
IProjectService.java
src/main/java/com/nisum/mytime/service/IProjectService.java
+4
-1
IRoleInfoService.java
src/main/java/com/nisum/mytime/service/IRoleInfoService.java
+3
-3
IRoleMappingService.java
...in/java/com/nisum/mytime/service/IRoleMappingService.java
+1
-1
IShiftService.java
src/main/java/com/nisum/mytime/service/IShiftService.java
+14
-0
ISkillService.java
src/main/java/com/nisum/mytime/service/ISkillService.java
+13
-0
IVisaService.java
src/main/java/com/nisum/mytime/service/IVisaService.java
+1
-1
AccountService.java
...in/java/com/nisum/mytime/service/impl/AccountService.java
+6
-3
AttendanceService.java
...java/com/nisum/mytime/service/impl/AttendanceService.java
+3
-2
DesignationService.java
...ava/com/nisum/mytime/service/impl/DesignationService.java
+22
-0
DomainService.java
...ain/java/com/nisum/mytime/service/impl/DomainService.java
+28
-6
EmployeeDataService.java
...va/com/nisum/mytime/service/impl/EmployeeDataService.java
+2
-1
EmployeeLocationService.java
...om/nisum/mytime/service/impl/EmployeeLocationService.java
+42
-0
EmployeeService.java
...n/java/com/nisum/mytime/service/impl/EmployeeService.java
+134
-120
MailService.java
src/main/java/com/nisum/mytime/service/impl/MailService.java
+4
-3
MasterDataService.java
...java/com/nisum/mytime/service/impl/MasterDataService.java
+22
-0
OrgLocationService.java
...ava/com/nisum/mytime/service/impl/OrgLocationService.java
+23
-0
ProjectService.java
...in/java/com/nisum/mytime/service/impl/ProjectService.java
+52
-6
RoleInfoService.java
...n/java/com/nisum/mytime/service/impl/RoleInfoService.java
+5
-4
RoleMappingService.java
...ava/com/nisum/mytime/service/impl/RoleMappingService.java
+18
-17
ShiftService.java
...main/java/com/nisum/mytime/service/impl/ShiftService.java
+23
-0
SkillService.java
...main/java/com/nisum/mytime/service/impl/SkillService.java
+23
-0
VisaService.java
src/main/java/com/nisum/mytime/service/impl/VisaService.java
+7
-5
PdfReportGenerator.java
src/main/java/com/nisum/mytime/utils/PdfReportGenerator.java
+3
-3
assignAccountsController.js
...in/webapp/WEB-INF/controllers/assignAccountsController.js
+2
-2
AccountControllerTest.java
...om/nisum/mytime/controllertest/AccountControllerTest.java
+1
-1
AttendanceControllerTest.java
...nisum/mytime/controllertest/AttendanceControllerTest.java
+4
-4
EmailControllerTest.java
.../com/nisum/mytime/controllertest/EmailControllerTest.java
+2
-2
EmployeeControllerTest.java
...m/nisum/mytime/controllertest/EmployeeControllerTest.java
+76
-52
No files found.
src/main/java/com/nisum/mytime/controller/AttendanceController.java
View file @
deb28aca
...
...
@@ -18,18 +18,18 @@ import org.springframework.web.bind.annotation.RestController;
import
com.nisum.mytime.exception.handler.MyTimeException
;
import
com.nisum.mytime.model.AttendenceData
;
import
com.nisum.mytime.model.EmpLoginData
;
import
com.nisum.mytime.service.AttendanceService
;
import
com.nisum.mytime.service.
User
Service
;
import
com.nisum.mytime.service.
I
AttendanceService
;
import
com.nisum.mytime.service.
IEmployee
Service
;
@RestController
@RequestMapping
(
"/attendance"
)
public
class
AttendanceController
{
@Autowired
private
User
Service
userService
;
private
IEmployee
Service
userService
;
@Autowired
private
AttendanceService
attendanceService
;
private
I
AttendanceService
attendanceService
;
@RequestMapping
(
value
=
"employeeLoginsBasedOnDate"
,
method
=
RequestMethod
.
GET
,
...
...
src/main/java/com/nisum/mytime/controller/DesignationController.java
0 → 100644
View file @
deb28aca
package
com
.
nisum
.
mytime
.
controller
;
import
java.util.List
;
import
java.util.stream.Collectors
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.http.HttpStatus
;
import
org.springframework.http.MediaType
;
import
org.springframework.http.ResponseEntity
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestMethod
;
import
org.springframework.web.bind.annotation.RestController
;
import
com.nisum.mytime.exception.handler.MyTimeException
;
import
com.nisum.mytime.model.Designation
;
import
com.nisum.mytime.service.impl.DesignationService
;
@RestController
public
class
DesignationController
{
@Autowired
DesignationService
designationService
;
// @RequestMapping(value = "/getAllDesignations", method =
// RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
@RequestMapping
(
value
=
"/employees/designations/"
,
method
=
RequestMethod
.
GET
,
produces
=
MediaType
.
APPLICATION_JSON_VALUE
)
public
ResponseEntity
<
List
<
String
>>
getAllDesignations
()
throws
MyTimeException
{
List
<
String
>
designations
=
designationService
.
getAllDesignations
().
stream
()
.
filter
(
e
->
"Y"
.
equalsIgnoreCase
(
e
.
getActiveStatus
())).
map
(
Designation:
:
getDesignationName
).
sorted
()
.
collect
(
Collectors
.
toList
());
return
new
ResponseEntity
<>(
designations
,
HttpStatus
.
OK
);
}
}
src/main/java/com/nisum/mytime/controller/EmailController.java
View file @
deb28aca
...
...
@@ -11,13 +11,13 @@ import org.springframework.web.bind.annotation.RequestMethod;
import
org.springframework.web.bind.annotation.RestController
;
import
com.nisum.mytime.model.EmailDomain
;
import
com.nisum.mytime.service.MailService
;
import
com.nisum.mytime.service.
I
MailService
;
@RestController
public
class
EmailController
{
@Autowired
private
MailService
mailService
;
private
I
MailService
mailService
;
@RequestMapping
(
value
=
"/sendEmail"
,
method
=
RequestMethod
.
POST
,
produces
=
MediaType
.
TEXT_PLAIN_VALUE
)
public
ResponseEntity
<
String
>
sendAttachmentMail
(
@RequestBody
EmailDomain
emailObj
)
{
...
...
src/main/java/com/nisum/mytime/controller/EmployeeController.java
0 → 100755
View file @
deb28aca
package
com
.
nisum
.
mytime
.
controller
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.stream.Collectors
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.http.HttpStatus
;
import
org.springframework.http.MediaType
;
import
org.springframework.http.ResponseEntity
;
import
org.springframework.web.bind.annotation.PathVariable
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestMethod
;
import
org.springframework.web.bind.annotation.RequestParam
;
import
org.springframework.web.bind.annotation.RestController
;
import
org.springframework.web.multipart.MultipartFile
;
import
com.nisum.mytime.exception.handler.MyTimeException
;
import
com.nisum.mytime.model.Account
;
import
com.nisum.mytime.model.AccountInfo
;
import
com.nisum.mytime.model.Domain
;
import
com.nisum.mytime.model.Employee
;
import
com.nisum.mytime.model.MasterData
;
import
com.nisum.mytime.service.IEmployeeService
;
import
com.nisum.mytime.service.IRoleMappingService
;
import
lombok.extern.slf4j.Slf4j
;
@RestController
@Slf4j
public
class
EmployeeController
{
@Autowired
private
IEmployeeService
empService
;
@Autowired
private
IRoleMappingService
roleMappingService
;
private
static
final
Logger
logger
=
LoggerFactory
.
getLogger
(
EmployeeController
.
class
);
@RequestMapping
(
value
=
"/employees"
,
method
=
RequestMethod
.
GET
,
produces
=
MediaType
.
APPLICATION_JSON_VALUE
)
public
ResponseEntity
<
Employee
>
getEmployee
(
@RequestParam
(
"emailId"
)
String
emailId
)
throws
MyTimeException
{
Employee
employee
=
empService
.
getEmployeeByEmaillId
(
emailId
);
if
(
employee
!=
null
)
{
if
(
employee
.
getRole
()
!=
null
&&
employee
.
getRole
().
equalsIgnoreCase
(
"Admin"
))
{
employee
.
setRole
(
"Admin"
);
}
else
{
String
roleName
=
roleMappingService
.
getEmployeeRole
(
employee
.
getEmployeeId
());
if
(
roleName
!=
null
)
{
employee
.
setRole
(
roleName
);
}
}
}
System
.
out
.
println
(
"emailId"
+
emailId
+
"result"
+
employee
);
return
new
ResponseEntity
<>(
employee
,
HttpStatus
.
OK
);
}
@RequestMapping
(
value
=
"/employees/{empId}"
,
method
=
RequestMethod
.
POST
,
produces
=
MediaType
.
APPLICATION_JSON_VALUE
,
consumes
=
MediaType
.
APPLICATION_JSON_VALUE
)
public
ResponseEntity
<
Employee
>
createEmployee
(
@RequestBody
Employee
employeeReq
,
@PathVariable
(
value
=
"empId"
)
String
loginEmpId
)
throws
MyTimeException
{
Employee
employeePersisted
=
empService
.
createEmployee
(
employeeReq
,
loginEmpId
);
return
new
ResponseEntity
<>(
employeePersisted
,
HttpStatus
.
OK
);
}
@RequestMapping
(
value
=
"/employees/{empId}"
,
method
=
RequestMethod
.
PUT
,
produces
=
MediaType
.
APPLICATION_JSON_VALUE
,
consumes
=
MediaType
.
APPLICATION_JSON_VALUE
)
public
ResponseEntity
<
Employee
>
updateEmployee
(
@RequestBody
Employee
employeeRoles
,
@PathVariable
(
value
=
"empId"
)
String
loginEmpId
)
throws
MyTimeException
{
Employee
employeeRole
=
empService
.
updateEmployeeRole
(
employeeRoles
,
loginEmpId
);
return
new
ResponseEntity
<>(
employeeRole
,
HttpStatus
.
OK
);
}
@RequestMapping
(
value
=
"/employees/{empId}"
,
method
=
RequestMethod
.
DELETE
,
produces
=
MediaType
.
APPLICATION_JSON_VALUE
)
public
ResponseEntity
<
String
>
deleteEmployee
(
@PathVariable
(
"empId"
)
String
empId
)
throws
MyTimeException
{
empService
.
deleteEmployee
(
empId
);
return
new
ResponseEntity
<>(
"Success"
,
HttpStatus
.
OK
);
}
//@RequestMapping(value = "/getUserRoles", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
@RequestMapping
(
value
=
"/employees/active"
,
method
=
RequestMethod
.
GET
,
produces
=
MediaType
.
APPLICATION_JSON_VALUE
)
public
ResponseEntity
<
List
<
Employee
>>
getUserRoles
()
throws
MyTimeException
{
List
<
Employee
>
employeesRoles
=
empService
.
getActiveEmployees
();
return
new
ResponseEntity
<>(
employeesRoles
,
HttpStatus
.
OK
);
}
//@RequestMapping(value = "/getEmployeeRoleData", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
@RequestMapping
(
value
=
"/employees/{empId}"
,
method
=
RequestMethod
.
GET
,
produces
=
MediaType
.
APPLICATION_JSON_VALUE
)
public
ResponseEntity
<
Employee
>
getEmployeeRoleData
(
@PathVariable
(
"empId"
)
String
empId
)
throws
MyTimeException
{
Employee
employeesRole
=
empService
.
getEmployeesRoleData
(
empId
);
return
new
ResponseEntity
<>(
employeesRole
,
HttpStatus
.
OK
);
}
/*
@RequestMapping(value = "/getEmployeeLocations", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<List<EmployeeLocationDetails>> getEmployeeLocations(@RequestParam("employeeId") String empId)
throws MyTimeException {
List<EmployeeLocationDetails> employeeLocationDetails = empService.getEmployeeLocationDetails(empId);
return new ResponseEntity<>(employeeLocationDetails, HttpStatus.OK);
}
*/
// @RequestMapping(value = "/getManagers"
@RequestMapping
(
value
=
"/employees/managers/"
,
method
=
RequestMethod
.
GET
,
produces
=
MediaType
.
APPLICATION_JSON_VALUE
)
public
ResponseEntity
<
List
<
Employee
>>
getManagers
()
throws
MyTimeException
{
List
<
Employee
>
managersList
=
empService
.
getManagers
();
return
new
ResponseEntity
<>(
managersList
,
HttpStatus
.
OK
);
}
/*
// @RequestMapping(value = "/getAllShifts", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
@RequestMapping(value = "/employees/shifts/", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<List<String>> getAllShifts() throws MyTimeException {
List<String> shifts = empService.getAllShifts().stream().filter(e -> "Y".equalsIgnoreCase(e.getActiveStatus()))
.map(Shift::getShiftName).sorted().collect(Collectors.toList());
return new ResponseEntity<>(shifts, HttpStatus.OK);
}
*/
/*
// @RequestMapping(value = "/getAllDesignations", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
@RequestMapping(value = "/employees/designations/", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<List<String>> getAllDesignations() throws MyTimeException {
List<String> designations = empService.getAllDesignations().stream()
.filter(e -> "Y".equalsIgnoreCase(e.getActiveStatus())).map(Designation::getDesignationName).sorted()
.collect(Collectors.toList());
return new ResponseEntity<>(designations, HttpStatus.OK);
}
*/
/*
// @RequestMapping(value = "/getSkills", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
@RequestMapping(value = "/employees/skills/", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<List<String>> getTechnologies() throws MyTimeException {
List<String> technologies = empService.getTechnologies().stream()
.filter(e -> "Y".equalsIgnoreCase(e.getActiveStatus())).map(Skill::getSkillName).sorted()
.collect(Collectors.toList());
return new ResponseEntity<>(technologies, HttpStatus.OK);
}
*/
/*
//@RequestMapping(value = "/getLocations", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
@RequestMapping(value = "/employees/locations/", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<List<String>> getLocations() throws MyTimeException {
System.out.println(" userService.getLocations()" + empService.getLocations());
List<String> locations = empService.getLocations().stream().filter(e -> (e.isActiveStatus() == true))
.map(Location::getLocation).sorted().collect(Collectors.toList());
logger.info("getLocations " + locations);
return new ResponseEntity<>(locations, HttpStatus.OK);
}
*/
@RequestMapping
(
value
=
"/updateProfile"
,
method
=
RequestMethod
.
POST
,
produces
=
MediaType
.
APPLICATION_JSON_VALUE
,
consumes
=
MediaType
.
APPLICATION_JSON_VALUE
)
public
ResponseEntity
<
Employee
>
updateProfile
(
@RequestBody
Employee
employeeRoles
)
throws
MyTimeException
{
Employee
employeeRole
=
empService
.
updateProfile
(
employeeRoles
);
return
new
ResponseEntity
<>(
employeeRole
,
HttpStatus
.
OK
);
}
//@RequestMapping(value = "/getAccounts", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
@RequestMapping
(
value
=
"/employee/accounts/"
,
method
=
RequestMethod
.
GET
,
produces
=
MediaType
.
APPLICATION_JSON_VALUE
)
public
ResponseEntity
<
List
<
Account
>>
getAccounts
()
throws
MyTimeException
{
List
<
Account
>
technologies
=
empService
.
getAccounts
().
stream
().
filter
(
e
->
"Y"
.
equalsIgnoreCase
(
e
.
getStatus
()))
// .filter(a -> !("Nisum
// India".equalsIgnoreCase(a.getAccountName())))
// .map(Account::getAccountName).sorted()
.
collect
(
Collectors
.
toList
());
return
new
ResponseEntity
<>(
technologies
,
HttpStatus
.
OK
);
}
@RequestMapping
(
value
=
"/getEmployeeRoleDataForSearchCriteria"
,
method
=
RequestMethod
.
GET
,
produces
=
MediaType
.
APPLICATION_JSON_VALUE
)
public
ResponseEntity
<
Employee
>
getEmployeeRoleDataForSearchCriteria
(
@RequestParam
(
"searchId"
)
String
searchId
,
@RequestParam
(
"searchAttribute"
)
String
searchAttribute
)
throws
MyTimeException
{
Employee
employeesRole
=
empService
.
getEmployeeRoleDataForSearchCriteria
(
searchId
,
searchAttribute
);
return
new
ResponseEntity
<>(
employeesRole
,
HttpStatus
.
OK
);
}
@RequestMapping
(
value
=
"/getEmployeeDetailsForAutocomplete"
,
method
=
RequestMethod
.
GET
,
produces
=
MediaType
.
APPLICATION_JSON_VALUE
)
public
ResponseEntity
<
List
<
String
>>
getEmployeeDetailsForAutocomplete
()
throws
MyTimeException
{
List
<
String
>
details
=
empService
.
getEmployeeDetailsForAutocomplete
();
return
new
ResponseEntity
<>(
details
,
HttpStatus
.
OK
);
}
/*@RequestMapping(value = "/getMasterData", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Map<String, List<String>>> getMasterData() throws MyTimeException {
Map<String, List<String>> masterDataMap = new HashMap<>();
Map<String, List<MasterData>> result = empService.getMasterData().stream()
.filter(e -> (e.isActiveStatus() == true))
.collect(Collectors.groupingBy(MasterData::getMasterDataType));
for (String key : result.keySet()) {
List<MasterData> valueList = result.get(key);
List<String> technologies = valueList.stream().map(MasterData::getMasterDataName).sorted()
.collect(Collectors.toList());
masterDataMap.put(key, technologies);
}
return new ResponseEntity<>(masterDataMap, HttpStatus.OK);
}
*/
//@RequestMapping(value = "/getEmployeeByStatus", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
@RequestMapping
(
value
=
"/employees/status/"
,
method
=
RequestMethod
.
GET
,
produces
=
MediaType
.
APPLICATION_JSON_VALUE
)
public
ResponseEntity
<
List
<
Employee
>>
getEmployeeByStatus
(
@RequestParam
(
"status"
)
String
status
)
{
List
<
Employee
>
employeesRoles
=
empService
.
getEmployeesByStatus
(
status
);
return
new
ResponseEntity
<>(
employeesRoles
,
HttpStatus
.
OK
);
}
//@RequestMapping(value = "/getDeliveryLeads", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
@RequestMapping
(
value
=
"/employees/deliveryLeads/{domainId}"
,
method
=
RequestMethod
.
GET
,
produces
=
MediaType
.
APPLICATION_JSON_VALUE
)
public
ResponseEntity
<
List
<
HashMap
<
String
,
String
>>>
getDeliveryLeads
(
@PathVariable
(
"domainId"
)
String
domainId
)
throws
MyTimeException
{
List
<
HashMap
<
String
,
String
>>
managers
=
empService
.
getDeliveryLeads
(
domainId
);
return
new
ResponseEntity
<>(
managers
,
HttpStatus
.
OK
);
}
@RequestMapping
(
value
=
"/getAccountsInfo"
,
method
=
RequestMethod
.
GET
,
produces
=
MediaType
.
APPLICATION_JSON_VALUE
)
public
ResponseEntity
<
List
<
AccountInfo
>>
getAccountsInfo
()
throws
MyTimeException
{
List
<
AccountInfo
>
technologies
=
empService
.
getAccountsInfo
().
stream
()
.
filter
(
e
->
"Active"
.
equalsIgnoreCase
(
e
.
getStatus
())).
collect
(
Collectors
.
toList
());
return
new
ResponseEntity
<>(
technologies
,
HttpStatus
.
OK
);
}
@RequestMapping
(
value
=
"/getDomains"
,
method
=
RequestMethod
.
GET
,
produces
=
MediaType
.
APPLICATION_JSON_VALUE
)
public
ResponseEntity
<
List
<
Domain
>>
getDomains
(
@RequestParam
(
"accountId"
)
String
accountId
)
throws
MyTimeException
{
List
<
Domain
>
domains
=
empService
.
getDomains
(
accountId
).
stream
()
.
filter
(
e
->
"Active"
.
equalsIgnoreCase
(
e
.
getStatus
())).
collect
(
Collectors
.
toList
());
return
new
ResponseEntity
<>(
domains
,
HttpStatus
.
OK
);
}
@RequestMapping
(
value
=
"/fileUpload"
,
method
=
RequestMethod
.
POST
,
produces
=
MediaType
.
APPLICATION_JSON_VALUE
,
consumes
=
MediaType
.
MULTIPART_FORM_DATA_VALUE
)
public
ResponseEntity
<
String
>
exportDataFromFile
(
@RequestParam
(
value
=
"file"
)
MultipartFile
file
,
@RequestParam
(
value
=
"empId"
)
String
loginEmpId
)
throws
MyTimeException
{
log
.
info
(
"Uploaded file: {} with size: {}"
,
file
.
getOriginalFilename
(),
file
.
getSize
());
String
result
=
empService
.
importDataFromExcelFile
(
file
,
loginEmpId
);
return
new
ResponseEntity
<>(
result
,
HttpStatus
.
OK
);
}
}
\ No newline at end of file
src/main/java/com/nisum/mytime/controller/EmployeeLocationController.java
0 → 100644
View file @
deb28aca
package
com
.
nisum
.
mytime
.
controller
;
import
java.util.List
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.http.HttpStatus
;
import
org.springframework.http.MediaType
;
import
org.springframework.http.ResponseEntity
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestMethod
;
import
org.springframework.web.bind.annotation.RequestParam
;
import
org.springframework.web.bind.annotation.RestController
;
import
com.nisum.mytime.exception.handler.MyTimeException
;
import
com.nisum.mytime.model.EmployeeLocationDetails
;
import
com.nisum.mytime.service.impl.EmployeeLocationService
;
@RestController
public
class
EmployeeLocationController
{
@Autowired
EmployeeLocationService
empLocationService
;
@RequestMapping
(
value
=
"/getEmployeeLocations"
,
method
=
RequestMethod
.
GET
,
produces
=
MediaType
.
APPLICATION_JSON_VALUE
)
public
ResponseEntity
<
List
<
EmployeeLocationDetails
>>
getEmployeeLocations
(
@RequestParam
(
"employeeId"
)
String
empId
)
throws
MyTimeException
{
List
<
EmployeeLocationDetails
>
employeeLocationDetails
=
empLocationService
.
getEmployeeLocationDetails
(
empId
);
return
new
ResponseEntity
<>(
employeeLocationDetails
,
HttpStatus
.
OK
);
}
}
src/main/java/com/nisum/mytime/controller/MasterDataController.java
0 → 100644
View file @
deb28aca
package
com
.
nisum
.
mytime
.
controller
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.stream.Collectors
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.http.HttpStatus
;
import
org.springframework.http.MediaType
;
import
org.springframework.http.ResponseEntity
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestMethod
;
import
org.springframework.web.bind.annotation.RestController
;
import
com.nisum.mytime.exception.handler.MyTimeException
;
import
com.nisum.mytime.model.MasterData
;
import
com.nisum.mytime.service.impl.MasterDataService
;
@RestController
public
class
MasterDataController
{
@Autowired
MasterDataService
masterDataService
;
@RequestMapping
(
value
=
"/getMasterData"
,
method
=
RequestMethod
.
GET
,
produces
=
MediaType
.
APPLICATION_JSON_VALUE
)
public
ResponseEntity
<
Map
<
String
,
List
<
String
>>>
getMasterData
()
throws
MyTimeException
{
Map
<
String
,
List
<
String
>>
masterDataMap
=
new
HashMap
<>();
Map
<
String
,
List
<
MasterData
>>
result
=
masterDataService
.
getMasterData
().
stream
()
.
filter
(
e
->
(
e
.
isActiveStatus
()
==
true
))
.
collect
(
Collectors
.
groupingBy
(
MasterData:
:
getMasterDataType
));
for
(
String
key
:
result
.
keySet
())
{
List
<
MasterData
>
valueList
=
result
.
get
(
key
);
List
<
String
>
technologies
=
valueList
.
stream
().
map
(
MasterData:
:
getMasterDataName
).
sorted
()
.
collect
(
Collectors
.
toList
());
masterDataMap
.
put
(
key
,
technologies
);
}
return
new
ResponseEntity
<>(
masterDataMap
,
HttpStatus
.
OK
);
}
}
src/main/java/com/nisum/mytime/controller/OrgLocationController.java
0 → 100644
View file @
deb28aca
package
com
.
nisum
.
mytime
.
controller
;
import
java.util.List
;
import
java.util.stream.Collectors
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.http.HttpStatus
;
import
org.springframework.http.MediaType
;
import
org.springframework.http.ResponseEntity
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestMethod
;
import
org.springframework.web.bind.annotation.RestController
;
import
com.nisum.mytime.exception.handler.MyTimeException
;
import
com.nisum.mytime.model.Location
;
import
com.nisum.mytime.service.impl.OrgLocationService
;
@RestController
public
class
OrgLocationController
{
@Autowired
OrgLocationService
orgLocationService
;
private
static
final
Logger
logger
=
LoggerFactory
.
getLogger
(
OrgLocationController
.
class
);
// @RequestMapping(value = "/getLocations", method = RequestMethod.GET,
// produces = MediaType.APPLICATION_JSON_VALUE)
@RequestMapping
(
value
=
"/employees/locations/"
,
method
=
RequestMethod
.
GET
,
produces
=
MediaType
.
APPLICATION_JSON_VALUE
)
public
ResponseEntity
<
List
<
String
>>
getLocations
()
throws
MyTimeException
{
// System.out.println(" userService.getLocations()" +
// orgLocationService.getLocations());
List
<
String
>
locations
=
orgLocationService
.
getLocations
().
stream
().
filter
(
e
->
(
e
.
isActiveStatus
()
==
true
))
.
map
(
Location:
:
getLocation
).
sorted
().
collect
(
Collectors
.
toList
());
logger
.
info
(
"getLocations "
+
locations
);
return
new
ResponseEntity
<>(
locations
,
HttpStatus
.
OK
);
}
}
src/main/java/com/nisum/mytime/controller/ProjectController.java
View file @
deb28aca
...
...
@@ -19,8 +19,8 @@ import com.nisum.mytime.model.Employee;
import
com.nisum.mytime.model.Project
;
import
com.nisum.mytime.repository.AccountRepo
;
import
com.nisum.mytime.repository.ProjectRepo
;
import
com.nisum.mytime.service.ProjectService
;
import
com.nisum.mytime.service.
User
Service
;
import
com.nisum.mytime.service.
I
ProjectService
;
import
com.nisum.mytime.service.
IEmployee
Service
;
import
com.nisum.mytime.utils.MyTimeUtils
;
@RestController
...
...
@@ -28,10 +28,10 @@ import com.nisum.mytime.utils.MyTimeUtils;
public
class
ProjectController
{
@Autowired
private
User
Service
userService
;
private
IEmployee
Service
userService
;
@Autowired
private
ProjectService
projectService
;
private
I
ProjectService
projectService
;
@Autowired
private
AccountRepo
accountRepo
;
...
...
@@ -42,7 +42,7 @@ public class ProjectController {
@RequestMapping
(
value
=
"/employee"
,
method
=
RequestMethod
.
GET
,
produces
=
MediaType
.
APPLICATION_JSON_VALUE
)
public
ResponseEntity
<
Employee
>
getEmployeeRole
(
@RequestParam
(
"emailId"
)
String
emailId
)
throws
MyTimeException
{
Employee
employeesRole
=
userService
.
getEmployee
sRole
(
emailId
);
Employee
employeesRole
=
userService
.
getEmployee
ByEmaillId
(
emailId
);
return
new
ResponseEntity
<>(
employeesRole
,
HttpStatus
.
OK
);
}
...
...
src/main/java/com/nisum/mytime/controller/ProjectTeamController.java
View file @
deb28aca
...
...
@@ -23,8 +23,8 @@ import com.nisum.mytime.model.EmployeeVisa;
import
com.nisum.mytime.model.Project
;
import
com.nisum.mytime.model.ProjectTeamMate
;
import
com.nisum.mytime.repository.EmployeeVisaRepo
;
import
com.nisum.mytime.service.ProjectService
;
import
com.nisum.mytime.service.
User
Service
;
import
com.nisum.mytime.service.
I
ProjectService
;
import
com.nisum.mytime.service.
IEmployee
Service
;
import
com.nisum.mytime.utils.MyTimeUtils
;
@RestController
...
...
@@ -32,10 +32,10 @@ import com.nisum.mytime.utils.MyTimeUtils;
public
class
ProjectTeamController
{
@Autowired
private
User
Service
userService
;
private
IEmployee
Service
userService
;
@Autowired
private
ProjectService
projectService
;
private
I
ProjectService
projectService
;
@Autowired
private
EmployeeVisaRepo
employeeVisaRepo
;
...
...
@@ -44,7 +44,7 @@ public class ProjectTeamController {
produces
=
MediaType
.
APPLICATION_JSON_VALUE
)
public
ResponseEntity
<
Employee
>
getEmployeeRole
(
@RequestParam
(
"emailId"
)
String
emailId
)
throws
MyTimeException
{
Employee
employeesRole
=
userService
.
getEmployee
sRole
(
emailId
);
Employee
employeesRole
=
userService
.
getEmployee
ByEmaillId
(
emailId
);
return
new
ResponseEntity
<>(
employeesRole
,
HttpStatus
.
OK
);
}
...
...
@@ -98,8 +98,8 @@ public class ProjectTeamController {
public
ResponseEntity
<
List
<
Employee
>>
getManagers
()
throws
MyTimeException
{
List
<
Employee
>
employeesRoles
=
new
ArrayList
<>();
if
(
userService
.
get
EmployeeRol
es
()
!=
null
)
{
employeesRoles
=
userService
.
get
EmployeeRol
es
().
stream
()
if
(
userService
.
get
ActiveEmploye
es
()
!=
null
)
{
employeesRoles
=
userService
.
get
ActiveEmploye
es
().
stream
()
.
sorted
((
o1
,
o2
)
->
o1
.
getEmployeeName
()
.
compareTo
(
o2
.
getEmployeeName
()))
.
collect
(
Collectors
.
toList
());
...
...
@@ -301,7 +301,7 @@ public class ProjectTeamController {
.
collect
(
Collectors
.
toList
());
}
if
(
employeeIds
!=
null
&&
!
employeeIds
.
isEmpty
())
{
List
<
Employee
>
emps
=
userService
.
get
EmployeeRol
es
();
List
<
Employee
>
emps
=
userService
.
get
ActiveEmploye
es
();
for
(
Employee
emp
:
emps
)
{
if
(
employeeIds
.
contains
(
emp
.
getEmployeeId
()))
{
employees
.
add
(
emp
);
...
...
@@ -311,8 +311,8 @@ public class ProjectTeamController {
return
new
ResponseEntity
<>(
employees
,
HttpStatus
.
OK
);
}
else
{
//List<EmployeeRoles> employees = new ArrayList<>();
if
(
userService
.
get
EmployeeRol
es
()
!=
null
)
{
employees
=
userService
.
get
EmployeeRol
es
().
stream
()
if
(
userService
.
get
ActiveEmploye
es
()
!=
null
)
{
employees
=
userService
.
get
ActiveEmploye
es
().
stream
()
.
sorted
((
o1
,
o2
)
->
o1
.
getEmployeeName
()
.
compareTo
(
o2
.
getEmployeeName
()))
.
collect
(
Collectors
.
toList
());
...
...
src/main/java/com/nisum/mytime/controller/ReportsController.java
View file @
deb28aca
...
...
@@ -41,18 +41,18 @@ import com.nisum.mytime.model.ProjectTeamMate;
import
com.nisum.mytime.model.ReportSeriesRecord
;
import
com.nisum.mytime.repository.EmployeeVisaRepo
;
import
com.nisum.mytime.repository.TeamMatesBillingRepo
;
import
com.nisum.mytime.service.ProjectService
;
import
com.nisum.mytime.service.
User
Service
;
import
com.nisum.mytime.service.
I
ProjectService
;
import
com.nisum.mytime.service.
IEmployee
Service
;
@RestController
@RequestMapping
(
"/reports"
)
public
class
ReportsController
{
@Autowired
private
User
Service
userService
;
private
IEmployee
Service
userService
;
@Autowired
private
ProjectService
projectService
;
private
I
ProjectService
projectService
;
@Autowired
private
EmployeeVisaRepo
employeeVisaRepo
;
...
...
src/main/java/com/nisum/mytime/controller/ShiftController.java
0 → 100644
View file @
deb28aca
package
com
.
nisum
.
mytime
.
controller
;
import
java.util.List
;
import
java.util.stream.Collectors
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.http.HttpStatus
;
import
org.springframework.http.MediaType
;
import
org.springframework.http.ResponseEntity
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestMethod
;
import
org.springframework.web.bind.annotation.RestController
;
import
com.nisum.mytime.exception.handler.MyTimeException
;
import
com.nisum.mytime.model.Shift
;
import
com.nisum.mytime.service.impl.ShiftService
;
@RestController
public
class
ShiftController
{
@Autowired
ShiftService
shiftService
;
// @RequestMapping(value = "/getAllShifts", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
@RequestMapping
(
value
=
"/employees/shifts/"
,
method
=
RequestMethod
.
GET
,
produces
=
MediaType
.
APPLICATION_JSON_VALUE
)
public
ResponseEntity
<
List
<
String
>>
getAllShifts
()
throws
MyTimeException
{
List
<
String
>
shifts
=
shiftService
.
getAllShifts
().
stream
().
filter
(
e
->
"Y"
.
equalsIgnoreCase
(
e
.
getActiveStatus
()))
.
map
(
Shift:
:
getShiftName
).
sorted
().
collect
(
Collectors
.
toList
());
return
new
ResponseEntity
<>(
shifts
,
HttpStatus
.
OK
);
}
}
src/main/java/com/nisum/mytime/controller/SkillController.java
0 → 100644
View file @
deb28aca
package
com
.
nisum
.
mytime
.
controller
;
import
java.util.List
;
import
java.util.stream.Collectors
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.http.HttpStatus
;
import
org.springframework.http.MediaType
;
import
org.springframework.http.ResponseEntity
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestMethod
;
import
org.springframework.web.bind.annotation.RestController
;
import
com.nisum.mytime.exception.handler.MyTimeException
;
import
com.nisum.mytime.model.Skill
;
import
com.nisum.mytime.service.impl.SkillService
;
@RestController
public
class
SkillController
{
@Autowired
SkillService
skillService
;
// @RequestMapping(value = "/getSkills", method = RequestMethod.GET,
// produces = MediaType.APPLICATION_JSON_VALUE)
@RequestMapping
(
value
=
"/employees/skills/"
,
method
=
RequestMethod
.
GET
,
produces
=
MediaType
.
APPLICATION_JSON_VALUE
)
public
ResponseEntity
<
List
<
String
>>
getTechnologies
()
throws
MyTimeException
{
List
<
String
>
technologies
=
skillService
.
getTechnologies
().
stream
()
.
filter
(
e
->
"Y"
.
equalsIgnoreCase
(
e
.
getActiveStatus
())).
map
(
Skill:
:
getSkillName
).
sorted
()
.
collect
(
Collectors
.
toList
());
return
new
ResponseEntity
<>(
technologies
,
HttpStatus
.
OK
);
}
}
src/main/java/com/nisum/mytime/controller/UserController.java
deleted
100755 → 0
View file @
65c9aaa9
package
com
.
nisum
.
mytime
.
controller
;
import
java.util.Comparator
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.stream.Collectors
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.http.HttpStatus
;
import
org.springframework.http.MediaType
;
import
org.springframework.http.ResponseEntity
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestMethod
;
import
org.springframework.web.bind.annotation.RequestParam
;
import
org.springframework.web.bind.annotation.RestController
;
import
org.springframework.web.multipart.MultipartFile
;
import
com.nisum.mytime.exception.handler.MyTimeException
;
import
com.nisum.mytime.model.Account
;
import
com.nisum.mytime.model.AccountInfo
;
import
com.nisum.mytime.model.Designation
;
import
com.nisum.mytime.model.Domain
;
import
com.nisum.mytime.model.EmployeeLocationDetails
;
import
com.nisum.mytime.model.Employee
;
import
com.nisum.mytime.model.Location
;
import
com.nisum.mytime.model.MasterData
;
import
com.nisum.mytime.model.Shift
;
import
com.nisum.mytime.model.Skill
;
import
com.nisum.mytime.service.RoleMappingService
;
import
com.nisum.mytime.service.UserService
;
import
lombok.extern.slf4j.Slf4j
;
@RestController
@RequestMapping
(
"/user"
)
@Slf4j
public
class
UserController
{
@Autowired
private
UserService
userService
;
@Autowired
private
RoleMappingService
roleMappingService
;
@RequestMapping
(
value
=
"/employee"
,
method
=
RequestMethod
.
GET
,
produces
=
MediaType
.
APPLICATION_JSON_VALUE
)
public
ResponseEntity
<
Employee
>
getEmployeeRole
(
@RequestParam
(
"emailId"
)
String
emailId
)
throws
MyTimeException
{
Employee
employeesRole
=
userService
.
getEmployeesRole
(
emailId
);
if
(
employeesRole
!=
null
)
{
if
(
employeesRole
.
getRole
()
!=
null
&&
employeesRole
.
getRole
().
equalsIgnoreCase
(
"Admin"
))
{
employeesRole
.
setRole
(
"Admin"
);
}
else
{
String
roleName
=
roleMappingService
.
getEmployeeRole
(
employeesRole
.
getEmployeeId
());
if
(
roleName
!=
null
)
{
employeesRole
.
setRole
(
roleName
);
}
}
}
System
.
out
.
println
(
"emailId"
+
emailId
+
"result"
+
employeesRole
);
return
new
ResponseEntity
<>(
employeesRole
,
HttpStatus
.
OK
);
}
@RequestMapping
(
value
=
"/assignEmployeeRole"
,
method
=
RequestMethod
.
POST
,
produces
=
MediaType
.
APPLICATION_JSON_VALUE
,
consumes
=
MediaType
.
APPLICATION_JSON_VALUE
)
public
ResponseEntity
<
Employee
>
assigingEmployeeRole
(
@RequestBody
Employee
employeeRoles
,
@RequestParam
(
value
=
"empId"
)
String
loginEmpId
)
throws
MyTimeException
{
Employee
employeeRole
=
userService
.
assigingEmployeeRole
(
employeeRoles
,
loginEmpId
);
return
new
ResponseEntity
<>(
employeeRole
,
HttpStatus
.
OK
);
}
@RequestMapping
(
value
=
"/updateEmployeeRole"
,
method
=
RequestMethod
.
POST
,
produces
=
MediaType
.
APPLICATION_JSON_VALUE
,
consumes
=
MediaType
.
APPLICATION_JSON_VALUE
)
public
ResponseEntity
<
Employee
>
updateEmployeeRole
(
@RequestBody
Employee
employeeRoles
,
@RequestParam
(
value
=
"empId"
)
String
loginEmpId
)
throws
MyTimeException
{
Employee
employeeRole
=
userService
.
updateEmployeeRole
(
employeeRoles
,
loginEmpId
);
return
new
ResponseEntity
<>(
employeeRole
,
HttpStatus
.
OK
);
}
@RequestMapping
(
value
=
"/deleteEmployee"
,
method
=
RequestMethod
.
DELETE
,
produces
=
MediaType
.
TEXT_PLAIN_VALUE
)
public
ResponseEntity
<
String
>
deleteEmployee
(
@RequestParam
(
"empId"
)
String
empId
)
throws
MyTimeException
{
userService
.
deleteEmployee
(
empId
);
return
new
ResponseEntity
<>(
"Success"
,
HttpStatus
.
OK
);
}
@RequestMapping
(
value
=
"/getUserRoles"
,
method
=
RequestMethod
.
GET
,
produces
=
MediaType
.
APPLICATION_JSON_VALUE
)
public
ResponseEntity
<
List
<
Employee
>>
getUserRoles
()
throws
MyTimeException
{
List
<
Employee
>
employeesRoles
=
userService
.
getEmployeeRoles
();
return
new
ResponseEntity
<>(
employeesRoles
,
HttpStatus
.
OK
);
}
@RequestMapping
(
value
=
"/getEmployeeRoleData"
,
method
=
RequestMethod
.
GET
,
produces
=
MediaType
.
APPLICATION_JSON_VALUE
)
public
ResponseEntity
<
Employee
>
getEmployeeRoleData
(
@RequestParam
(
"empId"
)
String
empId
)
throws
MyTimeException
{
Employee
employeesRole
=
userService
.
getEmployeesRoleData
(
empId
);
return
new
ResponseEntity
<>(
employeesRole
,
HttpStatus
.
OK
);
}
@RequestMapping
(
value
=
"/getEmployeeLocations"
,
method
=
RequestMethod
.
GET
,
produces
=
MediaType
.
APPLICATION_JSON_VALUE
)
public
ResponseEntity
<
List
<
EmployeeLocationDetails
>>
getEmployeeLocations
(
@RequestParam
(
"employeeId"
)
String
empId
)
throws
MyTimeException
{
List
<
EmployeeLocationDetails
>
employeeLocationDetails
=
userService
.
getEmployeeLocationDetails
(
empId
);
return
new
ResponseEntity
<>(
employeeLocationDetails
,
HttpStatus
.
OK
);
}
@RequestMapping
(
value
=
"/getManagers"
,
method
=
RequestMethod
.
GET
,
produces
=
MediaType
.
APPLICATION_JSON_VALUE
)
public
ResponseEntity
<
List
<
Employee
>>
getManagers
()
throws
MyTimeException
{
List
<
Employee
>
employeesRoles
=
userService
.
getEmployeeRoles
();
List
<
Employee
>
managers
=
employeesRoles
.
stream
()
.
filter
(
e
->
(
"Director"
.
equalsIgnoreCase
(
e
.
getRole
())
||
"Delivery Manager"
.
equalsIgnoreCase
(
e
.
getRole
())
||
"Manager"
.
equalsIgnoreCase
(
e
.
getRole
())
||
"HR Manager"
.
equalsIgnoreCase
(
e
.
getRole
())
||
"Lead"
.
equalsIgnoreCase
(
e
.
getRole
())))
.
sorted
(
Comparator
.
comparing
(
Employee:
:
getEmployeeName
))
.
collect
(
Collectors
.
toList
());
return
new
ResponseEntity
<>(
managers
,
HttpStatus
.
OK
);
}
@RequestMapping
(
value
=
"/getAllShifts"
,
method
=
RequestMethod
.
GET
,
produces
=
MediaType
.
APPLICATION_JSON_VALUE
)
public
ResponseEntity
<
List
<
String
>>
getAllShifts
()
throws
MyTimeException
{
List
<
String
>
shifts
=
userService
.
getAllShifts
().
stream
()
.
filter
(
e
->
"Y"
.
equalsIgnoreCase
(
e
.
getActiveStatus
()))
.
map
(
Shift:
:
getShiftName
).
sorted
().
collect
(
Collectors
.
toList
());
return
new
ResponseEntity
<>(
shifts
,
HttpStatus
.
OK
);
}
@RequestMapping
(
value
=
"/getAllDesignations"
,
method
=
RequestMethod
.
GET
,
produces
=
MediaType
.
APPLICATION_JSON_VALUE
)
public
ResponseEntity
<
List
<
String
>>
getAllDesignations
()
throws
MyTimeException
{
List
<
String
>
designations
=
userService
.
getAllDesignations
().
stream
()
.
filter
(
e
->
"Y"
.
equalsIgnoreCase
(
e
.
getActiveStatus
()))
.
map
(
Designation:
:
getDesignationName
).
sorted
()
.
collect
(
Collectors
.
toList
());
return
new
ResponseEntity
<>(
designations
,
HttpStatus
.
OK
);
}
@RequestMapping
(
value
=
"/getSkills"
,
method
=
RequestMethod
.
GET
,
produces
=
MediaType
.
APPLICATION_JSON_VALUE
)
public
ResponseEntity
<
List
<
String
>>
getTechnologies
()
throws
MyTimeException
{
List
<
String
>
technologies
=
userService
.
getTechnologies
().
stream
()
.
filter
(
e
->
"Y"
.
equalsIgnoreCase
(
e
.
getActiveStatus
()))
.
map
(
Skill:
:
getSkillName
).
sorted
().
collect
(
Collectors
.
toList
());
return
new
ResponseEntity
<>(
technologies
,
HttpStatus
.
OK
);
}
@RequestMapping
(
value
=
"/getLocations"
,
method
=
RequestMethod
.
GET
,
produces
=
MediaType
.
APPLICATION_JSON_VALUE
)
public
ResponseEntity
<
List
<
String
>>
getLocations
()
throws
MyTimeException
{
System
.
out
.
println
(
" userService.getLocations()"
+
userService
.
getLocations
());
List
<
String
>
locations
=
userService
.
getLocations
().
stream
()
.
filter
(
e
->
(
e
.
isActiveStatus
()
==
true
))
.
map
(
Location:
:
getLocation
).
sorted
()
.
collect
(
Collectors
.
toList
());
System
.
out
.
println
(
"getLocations################ "
+
locations
);
return
new
ResponseEntity
<>(
locations
,
HttpStatus
.
OK
);
}
@RequestMapping
(
value
=
"/updateProfile"
,
method
=
RequestMethod
.
POST
,
produces
=
MediaType
.
APPLICATION_JSON_VALUE
,
consumes
=
MediaType
.
APPLICATION_JSON_VALUE
)
public
ResponseEntity
<
Employee
>
updateProfile
(
@RequestBody
Employee
employeeRoles
)
throws
MyTimeException
{
Employee
employeeRole
=
userService
.
updateProfile
(
employeeRoles
);
return
new
ResponseEntity
<>(
employeeRole
,
HttpStatus
.
OK
);
}
@RequestMapping
(
value
=
"/getAccounts"
,
method
=
RequestMethod
.
GET
,
produces
=
MediaType
.
APPLICATION_JSON_VALUE
)
public
ResponseEntity
<
List
<
Account
>>
getAccounts
()
throws
MyTimeException
{
List
<
Account
>
technologies
=
userService
.
getAccounts
().
stream
()
.
filter
(
e
->
"Y"
.
equalsIgnoreCase
(
e
.
getStatus
()))
//.filter(a -> !("Nisum India".equalsIgnoreCase(a.getAccountName())))
// .map(Account::getAccountName).sorted()
.
collect
(
Collectors
.
toList
());
return
new
ResponseEntity
<>(
technologies
,
HttpStatus
.
OK
);
}
@RequestMapping
(
value
=
"/getEmployeeRoleDataForSearchCriteria"
,
method
=
RequestMethod
.
GET
,
produces
=
MediaType
.
APPLICATION_JSON_VALUE
)
public
ResponseEntity
<
Employee
>
getEmployeeRoleDataForSearchCriteria
(
@RequestParam
(
"searchId"
)
String
searchId
,
@RequestParam
(
"searchAttribute"
)
String
searchAttribute
)
throws
MyTimeException
{
Employee
employeesRole
=
userService
.
getEmployeeRoleDataForSearchCriteria
(
searchId
,
searchAttribute
);
return
new
ResponseEntity
<>(
employeesRole
,
HttpStatus
.
OK
);
}
@RequestMapping
(
value
=
"/getEmployeeDetailsForAutocomplete"
,
method
=
RequestMethod
.
GET
,
produces
=
MediaType
.
APPLICATION_JSON_VALUE
)
public
ResponseEntity
<
List
<
String
>>
getEmployeeDetailsForAutocomplete
()
throws
MyTimeException
{
List
<
String
>
details
=
userService
.
getEmployeeDetailsForAutocomplete
();
return
new
ResponseEntity
<>(
details
,
HttpStatus
.
OK
);
}
@RequestMapping
(
value
=
"/getMasterData"
,
method
=
RequestMethod
.
GET
,
produces
=
MediaType
.
APPLICATION_JSON_VALUE
)
public
ResponseEntity
<
Map
<
String
,
List
<
String
>>>
getMasterData
()
throws
MyTimeException
{
Map
<
String
,
List
<
String
>>
masterDataMap
=
new
HashMap
<>();
Map
<
String
,
List
<
MasterData
>>
result
=
userService
.
getMasterData
()
.
stream
().
filter
(
e
->
(
e
.
isActiveStatus
()
==
true
))
.
collect
(
Collectors
.
groupingBy
(
MasterData:
:
getMasterDataType
));
for
(
String
key
:
result
.
keySet
())
{
List
<
MasterData
>
valueList
=
result
.
get
(
key
);
List
<
String
>
technologies
=
valueList
.
stream
()
.
map
(
MasterData:
:
getMasterDataName
).
sorted
()
.
collect
(
Collectors
.
toList
());
masterDataMap
.
put
(
key
,
technologies
);
}
return
new
ResponseEntity
<>(
masterDataMap
,
HttpStatus
.
OK
);
}
@RequestMapping
(
value
=
"/getEmployeeByStatus"
,
method
=
RequestMethod
.
GET
,
produces
=
MediaType
.
APPLICATION_JSON_VALUE
)
public
ResponseEntity
<
List
<
Employee
>>
getEmployeeByStatus
(
@RequestParam
(
"status"
)
String
status
)
{
List
<
Employee
>
employeesRoles
=
userService
.
getEmployeesByStatus
(
status
);
return
new
ResponseEntity
<>(
employeesRoles
,
HttpStatus
.
OK
);
}
@RequestMapping
(
value
=
"/getDeliveryLeads"
,
method
=
RequestMethod
.
GET
,
produces
=
MediaType
.
APPLICATION_JSON_VALUE
)
public
ResponseEntity
<
List
<
HashMap
<
String
,
String
>>>
getDeliveryLeads
(
@RequestParam
(
"domainId"
)
String
domainId
)
throws
MyTimeException
{
List
<
HashMap
<
String
,
String
>>
managers
=
userService
.
getDeliveryLeads
(
domainId
);
return
new
ResponseEntity
<>(
managers
,
HttpStatus
.
OK
);
}
@RequestMapping
(
value
=
"/getAccountsInfo"
,
method
=
RequestMethod
.
GET
,
produces
=
MediaType
.
APPLICATION_JSON_VALUE
)
public
ResponseEntity
<
List
<
AccountInfo
>>
getAccountsInfo
()
throws
MyTimeException
{
List
<
AccountInfo
>
technologies
=
userService
.
getAccountsInfo
().
stream
()
.
filter
(
e
->
"Active"
.
equalsIgnoreCase
(
e
.
getStatus
()))
.
collect
(
Collectors
.
toList
());
return
new
ResponseEntity
<>(
technologies
,
HttpStatus
.
OK
);
}
@RequestMapping
(
value
=
"/getDomains"
,
method
=
RequestMethod
.
GET
,
produces
=
MediaType
.
APPLICATION_JSON_VALUE
)
public
ResponseEntity
<
List
<
Domain
>>
getDomains
(
@RequestParam
(
"accountId"
)
String
accountId
)
throws
MyTimeException
{
List
<
Domain
>
domains
=
userService
.
getDomains
(
accountId
).
stream
()
.
filter
(
e
->
"Active"
.
equalsIgnoreCase
(
e
.
getStatus
()))
.
collect
(
Collectors
.
toList
());
return
new
ResponseEntity
<>(
domains
,
HttpStatus
.
OK
);
}
@RequestMapping
(
value
=
"/fileUpload"
,
method
=
RequestMethod
.
POST
,
produces
=
MediaType
.
APPLICATION_JSON_VALUE
,
consumes
=
MediaType
.
MULTIPART_FORM_DATA_VALUE
)
public
ResponseEntity
<
String
>
exportDataFromFile
(
@RequestParam
(
value
=
"file"
)
MultipartFile
file
,
@RequestParam
(
value
=
"empId"
)
String
loginEmpId
)
throws
MyTimeException
{
log
.
info
(
"Uploaded file: {} with size: {}"
,
file
.
getOriginalFilename
(),
file
.
getSize
());
String
result
=
userService
.
importDataFromExcelFile
(
file
,
loginEmpId
);
return
new
ResponseEntity
<>(
result
,
HttpStatus
.
OK
);
}
}
\ No newline at end of file
src/main/java/com/nisum/mytime/controller/VisaController.java
View file @
deb28aca
...
...
@@ -15,14 +15,14 @@ import com.nisum.mytime.exception.handler.MyTimeException;
import
com.nisum.mytime.model.EmployeeVisa
;
import
com.nisum.mytime.model.TravelRequest
;
import
com.nisum.mytime.model.Visa
;
import
com.nisum.mytime.service.VisaService
;
import
com.nisum.mytime.service.
I
VisaService
;
@RestController
@RequestMapping
(
"/visa"
)
public
class
VisaController
{
@Autowired
private
VisaService
visaService
;
private
I
VisaService
visaService
;
@RequestMapping
(
value
=
"/getAllVisas"
,
method
=
RequestMethod
.
GET
,
produces
=
MediaType
.
APPLICATION_JSON_VALUE
)
public
ResponseEntity
<
List
<
Visa
>>
getAllVisas
()
throws
MyTimeException
{
...
...
src/main/java/com/nisum/mytime/model/Account.java
View file @
deb28aca
...
...
@@ -23,7 +23,7 @@ import lombok.ToString;
@AllArgsConstructor
@NoArgsConstructor
@ToString
@Document
(
collection
=
"
A
ccounts"
)
@Document
(
collection
=
"
a
ccounts"
)
public
class
Account
implements
Serializable
{
private
static
final
long
serialVersionUID
=
1L
;
...
...
src/main/java/com/nisum/mytime/model/Designation.java
View file @
deb28aca
...
...
@@ -17,7 +17,7 @@ import lombok.ToString;
@AllArgsConstructor
@NoArgsConstructor
@ToString
@Document
(
collection
=
"
D
esignations"
)
@Document
(
collection
=
"
d
esignations"
)
public
class
Designation
implements
Serializable
{
private
static
final
long
serialVersionUID
=
1L
;
...
...
src/main/java/com/nisum/mytime/model/Domain.java
View file @
deb28aca
...
...
@@ -22,7 +22,7 @@ import lombok.ToString;
@AllArgsConstructor
@NoArgsConstructor
@ToString
@Document
(
collection
=
"
D
omains"
)
@Document
(
collection
=
"
d
omains"
)
public
class
Domain
implements
Serializable
{
private
static
final
long
serialVersionUID
=
1L
;
...
...
src/main/java/com/nisum/mytime/model/Employee.java
View file @
deb28aca
...
...
@@ -19,7 +19,7 @@ import lombok.ToString;
@AllArgsConstructor
@NoArgsConstructor
@ToString
@Document
(
collection
=
"
EmployeeDetail
s"
)
@Document
(
collection
=
"
employee
s"
)
public
class
Employee
implements
Serializable
{
private
static
final
long
serialVersionUID
=
1L
;
...
...
src/main/java/com/nisum/mytime/model/MasterData.java
View file @
deb28aca
...
...
@@ -17,7 +17,7 @@ import lombok.ToString;
@AllArgsConstructor
@NoArgsConstructor
@ToString
@Document
(
collection
=
"
M
asterData"
)
@Document
(
collection
=
"
m
asterData"
)
public
class
MasterData
implements
Serializable
{
private
static
final
long
serialVersionUID
=
1L
;
...
...
src/main/java/com/nisum/mytime/model/Project.java
View file @
deb28aca
...
...
@@ -21,7 +21,7 @@ import lombok.ToString;
@AllArgsConstructor
@NoArgsConstructor
@ToString
@Document
(
collection
=
"
Team
s"
)
@Document
(
collection
=
"
project
s"
)
public
class
Project
extends
AuditFields
implements
Serializable
{
private
static
final
long
serialVersionUID
=
1L
;
...
...
src/main/java/com/nisum/mytime/model/Role
Info
.java
→
src/main/java/com/nisum/mytime/model/Role.java
View file @
deb28aca
...
...
@@ -17,8 +17,8 @@ import lombok.ToString;
@AllArgsConstructor
@NoArgsConstructor
@ToString
@Document
(
collection
=
"
Role
"
)
public
class
Role
Info
implements
Serializable
{
@Document
(
collection
=
"
roles
"
)
public
class
Role
implements
Serializable
{
private
static
final
long
serialVersionUID
=
1L
;
...
...
src/main/java/com/nisum/mytime/model/Shift.java
View file @
deb28aca
...
...
@@ -17,7 +17,7 @@ import lombok.ToString;
@AllArgsConstructor
@NoArgsConstructor
@ToString
@Document
(
collection
=
"
S
hifts"
)
@Document
(
collection
=
"
s
hifts"
)
public
class
Shift
implements
Serializable
{
private
static
final
long
serialVersionUID
=
1L
;
...
...
src/main/java/com/nisum/mytime/model/Skill.java
View file @
deb28aca
...
...
@@ -17,7 +17,7 @@ import lombok.ToString;
@AllArgsConstructor
@NoArgsConstructor
@ToString
@Document
(
collection
=
"
S
kills"
)
@Document
(
collection
=
"
s
kills"
)
public
class
Skill
implements
Serializable
{
private
static
final
long
serialVersionUID
=
1L
;
...
...
src/main/java/com/nisum/mytime/repository/EmployeeR
olesR
epo.java
→
src/main/java/com/nisum/mytime/repository/EmployeeRepo.java
View file @
deb28aca
...
...
@@ -7,7 +7,7 @@ import org.springframework.data.mongodb.repository.MongoRepository;
import
com.nisum.mytime.model.Employee
;
public
interface
EmployeeR
olesR
epo
public
interface
EmployeeRepo
extends
MongoRepository
<
Employee
,
String
>
{
Employee
findByEmailId
(
String
emailId
);
...
...
src/main/java/com/nisum/mytime/repository/RoleInfoRepo.java
View file @
deb28aca
...
...
@@ -2,11 +2,11 @@ package com.nisum.mytime.repository;
import
org.springframework.data.mongodb.repository.MongoRepository
;
import
com.nisum.mytime.model.Role
Info
;
import
com.nisum.mytime.model.Role
;
public
interface
RoleInfoRepo
extends
MongoRepository
<
Role
Info
,
String
>
{
public
interface
RoleInfoRepo
extends
MongoRepository
<
Role
,
String
>
{
Role
Info
findByRoleName
(
String
roleName
);
Role
findByRoleName
(
String
roleName
);
Role
Info
findByRoleId
(
String
roleId
);
Role
findByRoleId
(
String
roleId
);
}
\ No newline at end of file
src/main/java/com/nisum/mytime/repository/
Technology
Repo.java
→
src/main/java/com/nisum/mytime/repository/
Skill
Repo.java
View file @
deb28aca
...
...
@@ -5,6 +5,6 @@ import org.springframework.data.mongodb.repository.MongoRepository;
import
com.nisum.mytime.model.Skill
;
public
interface
Technology
Repo
extends
MongoRepository
<
Skill
,
String
>
{
public
interface
Skill
Repo
extends
MongoRepository
<
Skill
,
String
>
{
}
\ No newline at end of file
src/main/java/com/nisum/mytime/schedular/MyTimeCronSchedularJob.java
View file @
deb28aca
...
...
@@ -8,7 +8,7 @@ import org.quartz.JobExecutionContext;
import
org.springframework.beans.factory.annotation.Autowired
;
import
com.nisum.mytime.exception.handler.MyTimeException
;
import
com.nisum.mytime.service.EmployeeDataService
;
import
com.nisum.mytime.service.
impl.
EmployeeDataService
;
import
com.nisum.mytime.utils.MyTimeLogger
;
@DisallowConcurrentExecution
...
...
src/main/java/com/nisum/mytime/service/IAccountService.java
View file @
deb28aca
...
...
@@ -11,8 +11,6 @@ import com.nisum.mytime.model.Account;
@Service
public
interface
IAccountService
{
Account
createAccount
(
Account
account
)
throws
MyTimeException
;
Account
updateAccount
(
Account
account
)
throws
MyTimeException
;
...
...
src/main/java/com/nisum/mytime/service/AttendanceService.java
→
src/main/java/com/nisum/mytime/service/
I
AttendanceService.java
View file @
deb28aca
...
...
@@ -8,7 +8,7 @@ import com.nisum.mytime.exception.handler.MyTimeException;
import
com.nisum.mytime.model.AttendenceData
;
import
com.nisum.mytime.model.EmpLoginData
;
public
interface
AttendanceService
{
public
interface
I
AttendanceService
{
List
<
AttendenceData
>
getAttendanciesReport
(
String
reportDate
,
String
shift
)
throws
MyTimeException
,
SQLException
;
...
...
src/main/java/com/nisum/mytime/service/IDesignationService.java
0 → 100644
View file @
deb28aca
package
com
.
nisum
.
mytime
.
service
;
import
java.util.List
;
import
org.springframework.stereotype.Service
;
import
com.nisum.mytime.exception.handler.MyTimeException
;
import
com.nisum.mytime.model.Designation
;
@Service
public
interface
IDesignationService
{
List
<
Designation
>
getAllDesignations
()
throws
MyTimeException
;
}
src/main/java/com/nisum/mytime/service/IDomainService.java
View file @
deb28aca
...
...
@@ -30,4 +30,6 @@ public interface IDomainService {
List
<
Domain
>
getDomainsList
()
throws
MyTimeException
;
Set
<
String
>
accountsAssignedToDeliveryLead
(
String
empId
)
throws
MyTimeException
;
List
<
Domain
>
getDomainsUnderAccount
(
String
accountId
)
throws
MyTimeException
;
}
src/main/java/com/nisum/mytime/service/IEmployeeLocationService.java
0 → 100644
View file @
deb28aca
package
com
.
nisum
.
mytime
.
service
;
import
java.util.List
;
import
org.springframework.stereotype.Service
;
import
com.nisum.mytime.model.Employee
;
import
com.nisum.mytime.model.EmployeeLocationDetails
;
@Service
public
interface
IEmployeeLocationService
{
public
void
saveEmployeeLocationDetails
(
Employee
employee
)
;
public
List
<
EmployeeLocationDetails
>
getEmployeeLocationDetails
(
String
empId
);
}
src/main/java/com/nisum/mytime/service/
User
Service.java
→
src/main/java/com/nisum/mytime/service/
IEmployee
Service.java
View file @
deb28aca
...
...
@@ -4,6 +4,8 @@ import java.text.ParseException;
import
java.util.HashMap
;
import
java.util.List
;
import
org.springframework.http.ResponseEntity
;
import
org.springframework.stereotype.Service
;
import
org.springframework.web.multipart.MultipartFile
;
import
com.nisum.mytime.exception.handler.MyTimeException
;
...
...
@@ -19,17 +21,20 @@ import com.nisum.mytime.model.MasterData;
import
com.nisum.mytime.model.Shift
;
import
com.nisum.mytime.model.Skill
;
public
interface
UserService
{
@Service
public
interface
IEmployeeService
{
List
<
Employee
>
getManagers
()
throws
MyTimeException
;
Boolean
fetchEmployeesData
(
String
perticularDate
,
boolean
resynchFlag
)
throws
MyTimeException
;
List
<
EmpLoginData
>
employeeLoginsBasedOnDate
(
long
id
,
String
fromDate
,
String
toDate
)
throws
MyTimeException
;
List
<
Employee
>
get
EmployeeRol
es
()
throws
MyTimeException
;
List
<
Employee
>
get
ActiveEmploye
es
()
throws
MyTimeException
;
Employee
assigingEmployeeRol
e
(
Employee
employeeRoles
,
String
empId
)
Employee
createEmploye
e
(
Employee
employeeRoles
,
String
empId
)
throws
MyTimeException
;
List
generatePdfReport
(
long
id
,
String
fromDate
,
String
toDate
)
...
...
@@ -38,7 +43,7 @@ public interface UserService {
List
generatePdfReport
(
long
id
,
String
fromDate
,
String
toDate
,
String
fromTime
,
String
toTime
)
throws
MyTimeException
,
ParseException
;
Employee
getEmployee
sRole
(
String
emailId
);
Employee
getEmployee
ByEmaillId
(
String
emailId
);
void
deleteEmployee
(
String
empId
);
...
...
@@ -47,31 +52,31 @@ public interface UserService {
void
updateEmployeeLocationDetails
(
Employee
employeeRoles
,
boolean
delete
);
void
saveEmployeeLocationDetails
(
Employee
employeeRoles
);
//
void saveEmployeeLocationDetails(Employee employeeRoles);
Employee
getEmployeesRoleData
(
String
empId
);
List
<
EmployeeLocationDetails
>
getEmployeeLocationDetails
(
String
empId
);
//
List<EmployeeLocationDetails> getEmployeeLocationDetails(String empId);
List
<
Shift
>
getAllShifts
()
throws
MyTimeException
;
//
List<Shift> getAllShifts() throws MyTimeException;
List
<
Designation
>
getAllDesignations
()
throws
MyTimeException
;
//
List<Designation> getAllDesignations() throws MyTimeException;
List
<
Skill
>
getTechnologies
()
throws
MyTimeException
;
//
List<Skill> getTechnologies() throws MyTimeException;
public
Employee
updateProfile
(
Employee
employeeRoles
)
throws
MyTimeException
;
public
List
<
Account
>
getAccounts
()
throws
MyTimeException
;
List
<
Location
>
getLocations
()
throws
MyTimeException
;
//
List<Location> getLocations() throws MyTimeException;
Employee
getEmployeeRoleDataForSearchCriteria
(
String
searchId
,
String
searchAttribute
);
List
<
String
>
getEmployeeDetailsForAutocomplete
();
List
<
MasterData
>
getMasterData
()
throws
MyTimeException
;
//
List<MasterData> getMasterData() throws MyTimeException;
List
<
Employee
>
getEmployeesByFunctionalGrp
(
String
functionalGrp
);
...
...
src/main/java/com/nisum/mytime/service/MailService.java
→
src/main/java/com/nisum/mytime/service/
I
MailService.java
View file @
deb28aca
...
...
@@ -9,7 +9,7 @@ import com.nisum.mytime.model.EmailDomain;
* @author nisum
*
*/
public
interface
MailService
{
public
interface
I
MailService
{
public
String
sendEmailWithAttachment
(
EmailDomain
emailObj
);
...
...
src/main/java/com/nisum/mytime/service/IMasterDataService.java
0 → 100644
View file @
deb28aca
package
com
.
nisum
.
mytime
.
service
;
import
java.util.List
;
import
org.springframework.stereotype.Service
;
import
com.nisum.mytime.exception.handler.MyTimeException
;
import
com.nisum.mytime.model.MasterData
;
@Service
public
interface
IMasterDataService
{
List
<
MasterData
>
getMasterData
()
throws
MyTimeException
;
}
src/main/java/com/nisum/mytime/service/IOrgLocationService.java
0 → 100644
View file @
deb28aca
package
com
.
nisum
.
mytime
.
service
;
import
java.util.List
;
import
org.springframework.stereotype.Service
;
import
com.nisum.mytime.exception.handler.MyTimeException
;
import
com.nisum.mytime.model.Location
;
@Service
public
interface
IOrgLocationService
{
List
<
Location
>
getLocations
()
throws
MyTimeException
;
}
src/main/java/com/nisum/mytime/service/ProjectService.java
→
src/main/java/com/nisum/mytime/service/
I
ProjectService.java
View file @
deb28aca
...
...
@@ -14,8 +14,11 @@ import com.nisum.mytime.model.Employee;
import
com.nisum.mytime.model.Project
;
import
com.nisum.mytime.model.ProjectTeamMate
;
public
interface
ProjectService
{
public
interface
I
ProjectService
{
public
ProjectTeamMate
addNewBeanchAllocation
(
Employee
employee
,
String
loginEmpId
);
List
<
EmpLoginData
>
employeeLoginsBasedOnDate
(
long
id
,
String
fromDate
,
String
toDate
)
throws
MyTimeException
;
...
...
src/main/java/com/nisum/mytime/service/RoleInfoService.java
→
src/main/java/com/nisum/mytime/service/
I
RoleInfoService.java
View file @
deb28aca
package
com
.
nisum
.
mytime
.
service
;
import
com.nisum.mytime.exception.handler.MyTimeException
;
import
com.nisum.mytime.model.Role
Info
;
import
com.nisum.mytime.model.Role
;
public
interface
RoleInfoService
{
public
interface
I
RoleInfoService
{
public
Role
Info
addRole
(
RoleInfo
roleInfo
)
throws
MyTimeException
;
public
Role
addRole
(
Role
roleInfo
)
throws
MyTimeException
;
public
String
getRole
(
String
roleName
)
throws
MyTimeException
;
}
src/main/java/com/nisum/mytime/service/RoleMappingService.java
→
src/main/java/com/nisum/mytime/service/
I
RoleMappingService.java
View file @
deb28aca
...
...
@@ -6,7 +6,7 @@ import java.util.Set;
import
com.mongodb.WriteResult
;
import
com.nisum.mytime.exception.handler.MyTimeException
;
public
interface
RoleMappingService
{
public
interface
I
RoleMappingService
{
void
addEmployeeRole
(
String
employeeId
,
String
roleId
)
throws
MyTimeException
;
...
...
src/main/java/com/nisum/mytime/service/IShiftService.java
0 → 100644
View file @
deb28aca
package
com
.
nisum
.
mytime
.
service
;
import
java.util.List
;
import
org.springframework.stereotype.Service
;
import
com.nisum.mytime.exception.handler.MyTimeException
;
import
com.nisum.mytime.model.Shift
;
@Service
public
interface
IShiftService
{
List
<
Shift
>
getAllShifts
()
throws
MyTimeException
;
}
src/main/java/com/nisum/mytime/service/ISkillService.java
0 → 100644
View file @
deb28aca
package
com
.
nisum
.
mytime
.
service
;
import
java.util.List
;
import
org.springframework.stereotype.Service
;
import
com.nisum.mytime.exception.handler.MyTimeException
;
import
com.nisum.mytime.model.Skill
;
@Service
public
interface
ISkillService
{
List
<
Skill
>
getTechnologies
()
throws
MyTimeException
;
}
src/main/java/com/nisum/mytime/service/VisaService.java
→
src/main/java/com/nisum/mytime/service/
I
VisaService.java
View file @
deb28aca
...
...
@@ -16,7 +16,7 @@ import com.nisum.mytime.model.Visa;
* @author nisum
*
*/
public
interface
VisaService
{
public
interface
I
VisaService
{
List
<
Visa
>
getAllVisas
();
...
...
src/main/java/com/nisum/mytime/service/AccountService.java
→
src/main/java/com/nisum/mytime/service/
impl/
AccountService.java
View file @
deb28aca
package
com
.
nisum
.
mytime
.
service
;
package
com
.
nisum
.
mytime
.
service
.
impl
;
import
java.util.ArrayList
;
import
java.util.Collections
;
...
...
@@ -21,6 +21,9 @@ import com.nisum.mytime.exception.handler.MyTimeException;
import
com.nisum.mytime.model.Account
;
import
com.nisum.mytime.model.Employee
;
import
com.nisum.mytime.repository.AccountRepo
;
import
com.nisum.mytime.service.IAccountService
;
import
com.nisum.mytime.service.IRoleInfoService
;
import
com.nisum.mytime.service.IRoleMappingService
;
import
com.nisum.mytime.utils.CommomUtil
;
import
com.nisum.mytime.utils.MyTimeUtils
;
...
...
@@ -34,10 +37,10 @@ public class AccountService implements IAccountService {
private
MongoTemplate
mongoTemplate
;
@Autowired
private
RoleInfoService
roleInfoService
;
private
I
RoleInfoService
roleInfoService
;
@Autowired
private
RoleMappingService
roleMappingService
;
private
I
RoleMappingService
roleMappingService
;
private
static
final
Logger
logger
=
LoggerFactory
.
getLogger
(
AccountService
.
class
);
...
...
src/main/java/com/nisum/mytime/service/
AttendanceServiceImpl
.java
→
src/main/java/com/nisum/mytime/service/
impl/AttendanceService
.java
View file @
deb28aca
package
com
.
nisum
.
mytime
.
service
;
package
com
.
nisum
.
mytime
.
service
.
impl
;
import
java.sql.Connection
;
import
java.sql.ResultSet
;
...
...
@@ -23,13 +23,14 @@ import com.nisum.mytime.model.AttendenceData;
import
com.nisum.mytime.model.EmpLoginData
;
import
com.nisum.mytime.model.ProjectTeamMate
;
import
com.nisum.mytime.repository.ProjectTeamMatesRepo
;
import
com.nisum.mytime.service.IAttendanceService
;
import
com.nisum.mytime.utils.CommomUtil
;
import
com.nisum.mytime.utils.MyTimeLogger
;
import
com.nisum.mytime.utils.MyTimeUtils
;
import
com.nisum.mytime.utils.PdfReportGenerator
;
@Service
public
class
AttendanceService
Impl
implements
AttendanceService
{
public
class
AttendanceService
implements
I
AttendanceService
{
@Autowired
private
EmployeeDataService
employeeDataBaseService
;
...
...
src/main/java/com/nisum/mytime/service/impl/DesignationService.java
0 → 100644
View file @
deb28aca
package
com
.
nisum
.
mytime
.
service
.
impl
;
import
java.util.List
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
com.nisum.mytime.exception.handler.MyTimeException
;
import
com.nisum.mytime.model.Designation
;
import
com.nisum.mytime.repository.DesignationRepo
;
import
com.nisum.mytime.service.IDesignationService
;
@Service
public
class
DesignationService
implements
IDesignationService
{
@Autowired
private
DesignationRepo
designationRepo
;
@Override
public
List
<
Designation
>
getAllDesignations
()
throws
MyTimeException
{
return
designationRepo
.
findAll
();
}
}
src/main/java/com/nisum/mytime/service/DomainService.java
→
src/main/java/com/nisum/mytime/service/
impl/
DomainService.java
View file @
deb28aca
package
com
.
nisum
.
mytime
.
service
;
package
com
.
nisum
.
mytime
.
service
.
impl
;
import
java.util.ArrayList
;
import
java.util.Collections
;
...
...
@@ -21,6 +21,9 @@ import com.nisum.mytime.exception.handler.MyTimeException;
import
com.nisum.mytime.model.Domain
;
import
com.nisum.mytime.model.Employee
;
import
com.nisum.mytime.repository.DomainRepo
;
import
com.nisum.mytime.service.IDomainService
;
import
com.nisum.mytime.service.IRoleInfoService
;
import
com.nisum.mytime.service.IRoleMappingService
;
import
com.nisum.mytime.utils.CommomUtil
;
import
com.nisum.mytime.utils.MyTimeUtils
;
...
...
@@ -38,10 +41,10 @@ public class DomainService implements IDomainService {
private
MongoTemplate
mongoTemplate
;
@Autowired
private
RoleInfoService
roleInfoService
;
private
I
RoleInfoService
roleInfoService
;
@Autowired
private
RoleMappingService
roleMappingService
;
private
I
RoleMappingService
roleMappingService
;
private
static
final
Logger
logger
=
LoggerFactory
.
getLogger
(
DomainService
.
class
);
...
...
@@ -96,7 +99,7 @@ public class DomainService implements IDomainService {
private
void
updateRoleIdsForDMs
(
Domain
domainReq
,
String
roleId
)
throws
MyTimeException
{
Domain
domainDAO
=
getDomainBy
Id
(
domainReq
.
getDomainId
());
Domain
domainDAO
=
getDomainBy
StatusActive
(
domainReq
.
getDomainId
());
List
dmssListDAO
=
domainDAO
.
getDeliveryManagers
();
List
dmsListReq
=
domainReq
.
getDeliveryManagers
();
List
<
String
>
managersAddedByUser
=
managersAddedByUser
=
CommomUtil
.
getAddedManagersListForDM
(
dmssListDAO
,
...
...
@@ -108,7 +111,7 @@ public class DomainService implements IDomainService {
private
void
deleteRoleIdsForDMs
(
Domain
domainUpdating
,
String
roleId
)
throws
MyTimeException
{
Map
<
String
,
Integer
>
managersDomainCount
=
new
HashMap
<
String
,
Integer
>();
Domain
domainDAO
=
getDomainBy
Id
(
domainUpdating
.
getDomainId
());
Domain
domainDAO
=
getDomainBy
StatusActive
(
domainUpdating
.
getDomainId
());
List
dmsListDAO
=
domainDAO
.
getDeliveryManagers
();
List
dmsListReq
=
domainUpdating
.
getDeliveryManagers
();
...
...
@@ -191,7 +194,7 @@ public class DomainService implements IDomainService {
}
// Custom methods
private
Domain
getDomainBy
Id
(
String
domainId
)
{
private
Domain
getDomainBy
StatusActive
(
String
domainId
)
{
Query
selectedDomainQuery
=
new
Query
(
Criteria
.
where
(
MyTimeUtils
.
DOMAIN_ID
).
in
(
domainId
).
and
(
MyTimeUtils
.
STATUS
).
in
(
MyTimeUtils
.
ACTIVE
));
List
<
Domain
>
selectedDomain
=
mongoTemplate
.
find
(
selectedDomainQuery
,
Domain
.
class
);
...
...
@@ -200,6 +203,7 @@ public class DomainService implements IDomainService {
return
null
;
}
private
boolean
duplicateCheck
(
String
domainName
,
String
accountId
,
List
<
String
>
fromDB
,
List
fromUser
)
{
boolean
check
=
false
;
int
count
=
0
;
...
...
@@ -226,5 +230,23 @@ public class DomainService implements IDomainService {
}
return
accIdsSet
;
}
public
Domain
getDomainById
(
String
domainId
)
{
Domain
domain
=
null
;
if
(
domainId
!=
null
&&
domainId
.
length
()
>
0
)
{
domain
=
domainRepo
.
findByDomainId
(
domainId
);
}
return
domain
;
}
@Override
public
List
<
Domain
>
getDomainsUnderAccount
(
String
accountId
)
throws
MyTimeException
{
List
<
Domain
>
domains
=
domainRepo
.
findByAccountId
(
accountId
);
return
domains
;
}
}
\ No newline at end of file
src/main/java/com/nisum/mytime/service/EmployeeDataService.java
→
src/main/java/com/nisum/mytime/service/
impl/
EmployeeDataService.java
View file @
deb28aca
package
com
.
nisum
.
mytime
.
service
;
package
com
.
nisum
.
mytime
.
service
.
impl
;
import
java.sql.Connection
;
import
java.sql.ResultSet
;
...
...
@@ -20,6 +20,7 @@ import org.springframework.stereotype.Component;
import
com.nisum.mytime.configuration.DbConnection
;
import
com.nisum.mytime.exception.handler.MyTimeException
;
import
com.nisum.mytime.model.EmpLoginData
;
import
com.nisum.mytime.service.IEmployeeDataService
;
import
com.nisum.mytime.utils.CommomUtil
;
import
com.nisum.mytime.utils.MyTimeLogger
;
import
com.nisum.mytime.utils.MyTimeUtils
;
...
...
src/main/java/com/nisum/mytime/service/impl/EmployeeLocationService.java
0 → 100644
View file @
deb28aca
package
com
.
nisum
.
mytime
.
service
.
impl
;
import
java.util.Date
;
import
java.util.List
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
com.nisum.mytime.model.Employee
;
import
com.nisum.mytime.model.EmployeeLocationDetails
;
import
com.nisum.mytime.repository.EmployeeLocationDetailsRepo
;
import
com.nisum.mytime.service.IEmployeeLocationService
;
@Service
public
class
EmployeeLocationService
implements
IEmployeeLocationService
{
@Autowired
private
EmployeeLocationDetailsRepo
employeeLocationDetailsRepo
;
@Override
public
void
saveEmployeeLocationDetails
(
Employee
employee
)
{
EmployeeLocationDetails
employeeLocationDetails
=
new
EmployeeLocationDetails
();
employeeLocationDetails
.
setActive
(
employee
.
getEmpStatus
().
equalsIgnoreCase
(
"Active"
));
employeeLocationDetails
.
setEmployeeId
(
employee
.
getEmployeeId
());
employeeLocationDetails
.
setEmployeeName
(
employee
.
getEmployeeName
());
employeeLocationDetails
.
setCreateDate
(
new
Date
());
employeeLocationDetails
.
setEndDate
(
new
Date
());
employeeLocationDetails
.
setUpdatedDate
(
new
Date
());
employeeLocationDetails
.
setStartDate
(
new
Date
());
employeeLocationDetails
.
setEmpLocation
(
employee
.
getEmpLocation
());
employeeLocationDetailsRepo
.
save
(
employeeLocationDetails
);
}
@Override
public
List
<
EmployeeLocationDetails
>
getEmployeeLocationDetails
(
String
empId
)
{
return
employeeLocationDetailsRepo
.
findByEmployeeId
(
empId
);
}
}
src/main/java/com/nisum/mytime/service/
UserServiceImpl
.java
→
src/main/java/com/nisum/mytime/service/
impl/EmployeeService
.java
View file @
deb28aca
package
com
.
nisum
.
mytime
.
service
;
package
com
.
nisum
.
mytime
.
service
.
impl
;
import
java.lang.reflect.InvocationTargetException
;
import
java.lang.reflect.Method
;
...
...
@@ -43,14 +43,17 @@ import com.nisum.mytime.repository.AccountRepo;
import
com.nisum.mytime.repository.DesignationRepo
;
import
com.nisum.mytime.repository.DomainRepo
;
import
com.nisum.mytime.repository.EmployeeLocationDetailsRepo
;
import
com.nisum.mytime.repository.EmployeeR
olesR
epo
;
import
com.nisum.mytime.repository.EmployeeRepo
;
import
com.nisum.mytime.repository.LocationRepo
;
import
com.nisum.mytime.repository.MasterDataRepo
;
import
com.nisum.mytime.repository.ProjectRepo
;
import
com.nisum.mytime.repository.ProjectTeamMatesRepo
;
import
com.nisum.mytime.repository.ShiftRepo
;
import
com.nisum.mytime.repository.TeamMatesBillingRepo
;
import
com.nisum.mytime.repository.TechnologyRepo
;
import
com.nisum.mytime.service.IEmployeeService
;
import
com.nisum.mytime.service.IProjectService
;
import
com.nisum.mytime.service.IRoleMappingService
;
import
com.nisum.mytime.repository.SkillRepo
;
import
com.nisum.mytime.utils.DataValidations
;
import
com.nisum.mytime.utils.MyTimeUtils
;
import
com.nisum.mytime.utils.PdfReportGenerator
;
...
...
@@ -62,34 +65,34 @@ import lombok.extern.slf4j.Slf4j;
@Service
(
"userService"
)
@Slf4j
public
class
UserServiceImpl
implements
User
Service
{
public
class
EmployeeService
implements
IEmployee
Service
{
@Autowired
private
EmployeeR
olesRepo
employeeRoles
Repo
;
private
EmployeeR
epo
employee
Repo
;
@Autowired
private
ProjectRepo
projectRepo
;
@Autowired
private
ProjectTeamMatesRepo
projectTeamMatesRepo
;
@Autowired
private
ProjectService
projectService
;
@Autowired
private
ShiftRepo
shiftRepo
;
@Autowired
private
DesignationRepo
designationRepo
;
private
IProjectService
projectService
;
// @Autowired
// private AccountRepo accountRepo;
@Autowired
private
AccountRepo
accountRepo
;
@Autowired
private
MasterDataRepo
masterDataRepo
;
DomainService
domainService
;
//@Autowired
//private MasterDataRepo masterDataRepo;
@Autowired
private
TechnologyRepo
technologyRepo
;
//
@Autowired
//
private TechnologyRepo technologyRepo;
@Autowired
private
LocationRepo
locationRepo
;
//@Autowired
// private LocationRepo locationRepo;
@Autowired
private
EmployeeDataService
employeeDataBaseService
;
...
...
@@ -100,11 +103,11 @@ public class UserServiceImpl implements UserService {
@Autowired
private
MongoTemplate
mongoTemplate
;
@Autowired
private
EmployeeLocationDetailsRepo
employeeLocationDetailsRepo
;
//
@Autowired
//
private EmployeeLocationDetailsRepo employeeLocationDetailsRepo;
@Autowired
private
DomainRepo
domainRepo
;
//
@Autowired
//
private DomainRepo domainRepo;
@Autowired
private
AccountInfoRepo
accountInfoRepo
;
...
...
@@ -113,8 +116,16 @@ public class UserServiceImpl implements UserService {
private
TeamMatesBillingRepo
teamMatesBillingRepo
;
@Autowired
private
RoleMappingService
roleMappingService
;
private
I
RoleMappingService
roleMappingService
;
@Autowired
EmployeeLocationService
empLocationService
;
@Autowired
AccountService
accountService
;
@Override
public
Boolean
fetchEmployeesData
(
String
perticularDate
,
...
...
@@ -140,64 +151,47 @@ public class UserServiceImpl implements UserService {
}
@Override
public
List
<
Employee
>
get
EmployeeRol
es
()
throws
MyTimeException
{
public
List
<
Employee
>
get
ActiveEmploye
es
()
throws
MyTimeException
{
//return employeeRolesRepo.findAll();
return
employeeR
olesR
epo
.
findByEmpStatus
(
MyTimeUtils
.
ACTIVE
);
return
employeeRepo
.
findByEmpStatus
(
MyTimeUtils
.
ACTIVE
);
}
public
List
<
Employee
>
getManagers
()
throws
MyTimeException
{
List
<
Employee
>
employeesList
=
getActiveEmployees
();
List
<
Employee
>
managers
=
employeesList
.
stream
()
.
filter
(
e
->
(
"Director"
.
equalsIgnoreCase
(
e
.
getRole
())
||
"Delivery Manager"
.
equalsIgnoreCase
(
e
.
getRole
())
||
"Manager"
.
equalsIgnoreCase
(
e
.
getRole
())
||
"HR Manager"
.
equalsIgnoreCase
(
e
.
getRole
())
||
"Lead"
.
equalsIgnoreCase
(
e
.
getRole
())))
.
sorted
(
Comparator
.
comparing
(
Employee:
:
getEmployeeName
)).
collect
(
Collectors
.
toList
());
return
managers
;
}
@Override
public
Employee
assigingEmployeeRole
(
Employee
employeeRoles
,
String
loginEmpId
)
public
Employee
createEmployee
(
Employee
employeeReq
,
String
loginEmpId
)
throws
MyTimeException
{
employeeRoles
.
setCreatedOn
(
new
Date
());
employeeRoles
.
setCreatedBy
(
loginEmpId
);
employeeRoles
.
setModifiedBy
(
loginEmpId
);
ProjectTeamMate
newBenchAllocation
=
new
ProjectTeamMate
();
newBenchAllocation
.
setAccount
(
MyTimeUtils
.
BENCH_ACCOUNT
);
newBenchAllocation
.
setBillableStatus
(
MyTimeUtils
.
BENCH_BILLABILITY_STATUS
);
newBenchAllocation
.
setDesignation
(
employeeRoles
.
getDesignation
());
newBenchAllocation
.
setEmailId
(
employeeRoles
.
getEmailId
());
newBenchAllocation
.
setEmployeeId
(
employeeRoles
.
getEmployeeId
());
newBenchAllocation
.
setMobileNumber
(
employeeRoles
.
getMobileNumber
());
employeeReq
.
setCreatedOn
(
new
Date
());
employeeReq
.
setCreatedBy
(
loginEmpId
);
employeeReq
.
setModifiedBy
(
loginEmpId
);
newBenchAllocation
.
setEmployeeName
(
employeeRoles
.
getEmployeeName
());
newBenchAllocation
.
setProjectId
(
MyTimeUtils
.
BENCH_PROJECT_ID
);
newBenchAllocation
.
setStartDate
(
employeeRoles
.
getDateOfJoining
()
!=
null
?
employeeRoles
.
getDateOfJoining
()
:
new
Date
());
Project
p
=
projectRepo
.
findByProjectId
(
MyTimeUtils
.
BENCH_PROJECT_ID
);
newBenchAllocation
.
setProjectName
(
p
.
getProjectName
());
newBenchAllocation
.
setAccountId
(
p
.
getAccountId
());
newBenchAllocation
.
setDomainId
(
p
.
getDomainId
());
newBenchAllocation
.
setShift
(
employeeRoles
.
getShift
());
newBenchAllocation
.
setRole
(
employeeRoles
.
getRole
());
if
(
null
!=
employeeRoles
.
getEmpStatus
()
&&
employeeRoles
.
getEmpStatus
().
trim
().
equalsIgnoreCase
(
MyTimeUtils
.
IN_ACTIVE_SPACE
))
{
newBenchAllocation
.
setEndDate
(
employeeRoles
.
getEndDate
());
newBenchAllocation
.
setActive
(
false
);
}
else
{
employeeRoles
.
setEmpStatus
(
MyTimeUtils
.
ACTIVE
);
newBenchAllocation
.
setEndDate
(
p
.
getProjectEndDate
());
newBenchAllocation
.
setActive
(
true
);
}
//adding new Bench Allocation
projectService
.
addNewBeanchAllocation
(
employeeReq
,
loginEmpId
);
//Saving Location Details.
empLocationService
.
saveEmployeeLocationDetails
(
employeeReq
);
try
{
projectService
.
addProjectTeamMate
(
newBenchAllocation
,
loginEmpId
);
}
catch
(
MyTimeException
e
)
{
e
.
printStackTrace
();
}
saveEmployeeLocationDetails
(
employeeRoles
);
return
employeeRolesRepo
.
save
(
employeeRoles
);
return
employeeRepo
.
save
(
employeeReq
);
}
@Override
public
Employee
getEmployee
sRole
(
String
emailId
)
{
return
employeeR
olesR
epo
.
findByEmailId
(
emailId
);
public
Employee
getEmployee
ByEmaillId
(
String
emailId
)
{
return
employeeRepo
.
findByEmailId
(
emailId
);
}
@Override
public
void
deleteEmployee
(
String
employeeId
)
{
Employee
role
=
employeeR
olesR
epo
.
findByEmployeeId
(
employeeId
);
employeeR
olesR
epo
.
delete
(
role
);
Employee
role
=
employeeRepo
.
findByEmployeeId
(
employeeId
);
employeeRepo
.
delete
(
role
);
}
@Override
...
...
@@ -230,7 +224,7 @@ public class UserServiceImpl implements UserService {
}
// update employee location
if
(
employeeRoles
.
getEmpLocation
()
!=
null
&&
!
employeeRoles
.
getEmpLocation
().
equals
(
""
))
{
Employee
existingEmployee
=
employeeR
olesR
epo
.
findByEmployeeId
(
employeeRoles
.
getEmployeeId
());
Employee
existingEmployee
=
employeeRepo
.
findByEmployeeId
(
employeeRoles
.
getEmployeeId
());
if
(!
existingEmployee
.
getEmpLocation
().
equals
(
employeeRoles
.
getEmpLocation
()))
{
updateEmployeeLocationDetails
(
employeeRoles
,
false
);
}
...
...
@@ -245,7 +239,7 @@ public class UserServiceImpl implements UserService {
try
{
// update employee location
if
(
employeeRoles
.
getEmpLocation
()
!=
null
&&
!
employeeRoles
.
getEmpLocation
().
equals
(
""
))
{
Employee
existingEmployee
=
employeeR
olesR
epo
.
findByEmployeeId
(
employeeRoles
.
getEmployeeId
());
Employee
existingEmployee
=
employeeRepo
.
findByEmployeeId
(
employeeRoles
.
getEmployeeId
());
if
(!
existingEmployee
.
getEmpLocation
().
equals
(
employeeRoles
.
getEmpLocation
()))
{
updateEmployeeLocationDetails
(
employeeRoles
,
false
);
}
...
...
@@ -257,6 +251,7 @@ public class UserServiceImpl implements UserService {
if
(
employeeProfiles
!=
null
&&
!
employeeProfiles
.
isEmpty
())
{
for
(
ProjectTeamMate
profile
:
employeeProfiles
)
{
profile
.
setRole
(
emp
.
getRole
());
profile
.
setAuditFields
(
loginEmpId
,
MyTimeUtils
.
UPDATE
);
projectTeamMatesRepo
.
save
(
profile
);
}
}
...
...
@@ -291,40 +286,48 @@ public class UserServiceImpl implements UserService {
@Override
public
Employee
getEmployeesRoleData
(
String
employeeId
)
{
return
employeeR
olesR
epo
.
findByEmployeeId
(
employeeId
);
return
employeeRepo
.
findByEmployeeId
(
employeeId
);
}
@Override
/*
@Override
public List<Shift> getAllShifts() throws MyTimeException {
return shiftRepo.findAll();
}
*/
@Override
/*
@Override
public List<Designation> getAllDesignations() throws MyTimeException {
return designationRepo.findAll();
}
*/
@Override
public
List
<
Account
>
getAccounts
()
throws
MyTimeException
{
return
accountRepo
.
findAll
();
return
accountService
.
getAccounts
();
}
/*
@Override
public List<Skill> getTechnologies() throws MyTimeException {
return technologyRepo.findAll();
}
*/
/*
@Override
public List<Location> getLocations() throws MyTimeException {
return locationRepo.findAll();
}
*/
@Override
public
Employee
updateProfile
(
Employee
employeeRoles
)
throws
MyTimeException
{
boolean
mobileNumberChanged
=
false
;
employeeRoles
.
setLastModifiedOn
(
new
Date
());
Employee
existingEmployee
=
employeeR
olesR
epo
Employee
existingEmployee
=
employeeRepo
.
findByEmployeeId
(
employeeRoles
.
getEmployeeId
());
String
newMobileNumber
=
employeeRoles
.
getMobileNumber
();
if
(
newMobileNumber
!=
null
&&
!
newMobileNumber
.
equalsIgnoreCase
(
""
))
{
...
...
@@ -341,7 +344,7 @@ public class UserServiceImpl implements UserService {
existingEmployee
.
setPersonalEmailId
(
employeeRoles
.
getPersonalEmailId
());
existingEmployee
.
setBaseTechnology
(
employeeRoles
.
getBaseTechnology
());
existingEmployee
.
setTechnologyKnown
(
employeeRoles
.
getTechnologyKnown
());
Employee
employeeRolesDB
=
employeeR
olesR
epo
.
save
(
existingEmployee
);
Employee
employeeRolesDB
=
employeeRepo
.
save
(
existingEmployee
);
if
(
mobileNumberChanged
)
{
try
{
List
<
ProjectTeamMate
>
employeeProfiles
=
projectTeamMatesRepo
...
...
@@ -370,9 +373,9 @@ public class UserServiceImpl implements UserService {
public
Employee
getEmployeeRoleDataForSearchCriteria
(
String
searchId
,
String
searchAttribute
)
{
if
(
MyTimeUtils
.
EMPLOYEE_NAME
.
equals
(
searchAttribute
))
{
return
employeeR
olesR
epo
.
findByEmployeeName
(
searchId
);
return
employeeRepo
.
findByEmployeeName
(
searchId
);
}
else
if
(
MyTimeUtils
.
EMAIL_ID
.
equals
(
searchAttribute
))
{
return
employeeR
olesR
epo
.
findByEmailId
(
searchId
);
return
employeeRepo
.
findByEmailId
(
searchId
);
}
return
null
;
...
...
@@ -386,7 +389,7 @@ public class UserServiceImpl implements UserService {
*/
@Override
public
List
<
String
>
getEmployeeDetailsForAutocomplete
()
{
List
<
Employee
>
roles
=
employeeR
olesR
epo
.
findAll
();
List
<
Employee
>
roles
=
employeeRepo
.
findAll
();
List
<
String
>
details
=
new
ArrayList
<>();
roles
.
stream
()
.
sorted
(
java
.
util
.
Comparator
...
...
@@ -409,11 +412,13 @@ public class UserServiceImpl implements UserService {
return
details
;
}
/*
@Override
public List<MasterData> getMasterData() throws MyTimeException {
return masterDataRepo.findAll();
}
*/
@Override
public
void
updateEmployeeLocationDetails
(
Employee
employeeRoles
,
boolean
delete
)
{
...
...
@@ -434,51 +439,59 @@ public class UserServiceImpl implements UserService {
mongoTemplate
.
save
(
existingLocation
);
}
if
(!
delete
)
saveEmployeeLocationDetails
(
employeeRoles
);
empLocationService
.
saveEmployeeLocationDetails
(
employeeRoles
);
}
catch
(
Exception
ex
)
{
System
.
out
.
println
(
ex
);
}
}
/*
@Override
public
void
saveEmployeeLocationDetails
(
Employee
employee
Roles
)
{
public void saveEmployeeLocationDetails(Employee employee) {
EmployeeLocationDetails employeeLocationDetails = new EmployeeLocationDetails();
employeeLocationDetails
.
setActive
(
employee
Roles
.
getEmpStatus
().
equalsIgnoreCase
(
"Active"
));
employeeLocationDetails
.
setEmployeeId
(
employee
Roles
.
getEmployeeId
());
employeeLocationDetails
.
setEmployeeName
(
employee
Roles
.
getEmployeeName
());
employeeLocationDetails.setActive(employee.getEmpStatus().equalsIgnoreCase("Active"));
employeeLocationDetails.setEmployeeId(employee.getEmployeeId());
employeeLocationDetails.setEmployeeName(employee.getEmployeeName());
employeeLocationDetails.setCreateDate(new Date());
employeeLocationDetails.setEndDate(new Date());
employeeLocationDetails.setUpdatedDate(new Date());
employeeLocationDetails.setStartDate(new Date());
employeeLocationDetails
.
setEmpLocation
(
employee
Roles
.
getEmpLocation
());
employeeLocationDetails.setEmpLocation(employee.getEmpLocation());
employeeLocationDetailsRepo.save(employeeLocationDetails);
}
*/
/*
@Override
public List<EmployeeLocationDetails> getEmployeeLocationDetails(String empId) {
return employeeLocationDetailsRepo.findByEmployeeId(empId);
}
*/
@Override
public
List
<
Employee
>
getEmployeesByFunctionalGrp
(
String
functionalGrp
)
{
return
employeeR
olesR
epo
.
findByEmpStatusAndFunctionalGroup
(
"Active"
,
functionalGrp
);
return
employeeRepo
.
findByEmpStatusAndFunctionalGroup
(
"Active"
,
functionalGrp
);
}
@Override
public
List
<
Employee
>
getEmployeesByStatus
(
String
status
)
{
if
(
status
.
equals
(
"both"
))
{
return
employeeR
olesR
epo
.
findAll
(
new
Sort
(
Sort
.
Direction
.
ASC
,
"employeeName"
));
return
employeeRepo
.
findAll
(
new
Sort
(
Sort
.
Direction
.
ASC
,
"employeeName"
));
}
else
{
return
employeeR
olesR
epo
.
findByEmpStatusOrderByEmployeeNameAsc
(
status
);
return
employeeRepo
.
findByEmpStatusOrderByEmployeeNameAsc
(
status
);
}
}
@Override
public
List
<
HashMap
<
String
,
String
>>
getDeliveryLeads
(
String
domainId
)
{
List
<
HashMap
<
String
,
String
>>
EmployeeList
=
null
;
Domain
domains
=
domainRepo
.
findByDomain
Id
(
domainId
);
Domain
domains
=
domainService
.
getDomainBy
Id
(
domainId
);
EmployeeList
=
getEmployeeData
(
domains
.
getDeliveryManagers
());
return
EmployeeList
;
}
...
...
@@ -501,9 +514,8 @@ public class UserServiceImpl implements UserService {
}
@Override
public
List
<
Domain
>
getDomains
(
String
accountId
)
throws
MyTimeException
{
List
<
Domain
>
domains
=
domainRepo
.
findByAccountId
(
accountId
);
return
domains
;
public
List
<
Domain
>
getDomains
(
String
accountId
)
throws
MyTimeException
{
return
domainService
.
getDomainsUnderAccount
(
accountId
);
}
...
...
@@ -614,7 +626,7 @@ public class UserServiceImpl implements UserService {
employee
.
setGender
(
MyTimeUtils
.
FEMALE
);
}
}
assigingEmployeeRol
e
(
employee
,
empId
);
createEmploye
e
(
employee
,
empId
);
}
catch
(
MyTimeException
e
)
{
e
.
printStackTrace
();
}
...
...
@@ -629,7 +641,7 @@ public class UserServiceImpl implements UserService {
Set
<
String
>
empIdsSet
=
employees
.
stream
().
map
(
Employee
::
getEmployeeId
).
collect
(
Collectors
.
toSet
());
List
<
Employee
>
existingEmployess
=
employeeR
olesR
epo
.
findByEmployeeIdIn
(
empIdsSet
);
List
<
Employee
>
existingEmployess
=
employeeRepo
.
findByEmployeeIdIn
(
empIdsSet
);
if
(
existingEmployess
.
size
()
>
MyTimeUtils
.
INT_ZERO
)
{
result
=
"Below employee records already existed : \n"
+
existingEmployess
.
stream
().
map
(
Employee
::
getEmployeeId
).
collect
(
Collectors
.
toSet
()).
toString
();
employees
.
removeAll
(
existingEmployess
);
...
...
@@ -720,31 +732,33 @@ public class UserServiceImpl implements UserService {
private
boolean
importExcelMandatoryColumnsValidation
(
Employee
emp
)
{
boolean
mandatoryFlag
=
true
;
if
(!
DataValidations
.
validateNumber
(
emp
.
getEmployeeId
()))
{
mandatoryFlag
=
false
;
}
else
if
(!
DataValidations
.
validateName
(
emp
.
getEmployeeName
()))
{
mandatoryFlag
=
false
;
}
else
if
(!
DataValidations
.
isValidGender
(
emp
.
getGender
()))
{
mandatoryFlag
=
false
;
}
else
if
(!
DataValidations
.
isValidDate
(
emp
.
getDateOfJoining
()))
{
mandatoryFlag
=
false
;
}
else
if
(!
DataValidations
.
isValidFunctionalGroup
(
emp
.
getFunctionalGroup
(),
masterDataRepo
))
{
mandatoryFlag
=
false
;
}
else
if
(!
DataValidations
.
isValidDesignation
(
emp
.
getDesignation
(),
masterDataRepo
))
{
mandatoryFlag
=
false
;
}
else
if
(!
DataValidations
.
isValidWorkLocation
(
emp
.
getEmpLocation
(),
locationRepo
))
{
mandatoryFlag
=
false
;
}
else
if
(!
DataValidations
.
isValidEmploymentType
(
emp
.
getEmploymentType
(),
masterDataRepo
))
{
mandatoryFlag
=
false
;
}
else
if
(!
DataValidations
.
isValidRole
(
emp
.
getRole
(),
masterDataRepo
))
{
mandatoryFlag
=
false
;
}
else
if
(!
DataValidations
.
isYesOrNo
(
emp
.
getHasPassort
()))
{
mandatoryFlag
=
false
;
}
else
if
(!
DataValidations
.
isYesOrNo
(
emp
.
getHasB1
()))
{
mandatoryFlag
=
false
;
}
else
if
(!
DataValidations
.
isValidEmail
(
emp
.
getEmailId
()))
{
mandatoryFlag
=
false
;
}
// if(! DataValidations.validateNumber(emp.getEmployeeId())) {
// mandatoryFlag = false;
// }else if(! DataValidations.validateName(emp.getEmployeeName())) {
// mandatoryFlag = false;
// }else if(! DataValidations.isValidGender(emp.getGender())) {
// mandatoryFlag = false;
// }else if(! DataValidations.isValidDate(emp.getDateOfJoining())) {
// mandatoryFlag = false;
// }else if(! DataValidations.isValidFunctionalGroup(emp.getFunctionalGroup(),masterDataRepo)) {
// mandatoryFlag = false;
// }else if(! DataValidations.isValidDesignation(emp.getDesignation(),masterDataRepo)) {
// mandatoryFlag = false;
// }
// //else if(! DataValidations.isValidWorkLocation(emp.getEmpLocation(), locationRepo)) {
// //mandatoryFlag = false;
// // }
// else if(! DataValidations.isValidEmploymentType(emp.getEmploymentType(),masterDataRepo)) {
// mandatoryFlag = false;
// }else if(! DataValidations.isValidRole(emp.getRole(),masterDataRepo)) {
// mandatoryFlag = false;
// }else if(! DataValidations.isYesOrNo(emp.getHasPassort())) {
// mandatoryFlag = false;
// }else if(! DataValidations.isYesOrNo(emp.getHasB1())) {
// mandatoryFlag = false;
// }else if(!DataValidations.isValidEmail(emp.getEmailId())) {
// mandatoryFlag = false;
// }
return
mandatoryFlag
;
}
...
...
src/main/java/com/nisum/mytime/service/
MailServiceImpl
.java
→
src/main/java/com/nisum/mytime/service/
impl/MailService
.java
View file @
deb28aca
/**
*
*/
package
com
.
nisum
.
mytime
.
service
;
package
com
.
nisum
.
mytime
.
service
.
impl
;
import
java.io.File
;
import
java.io.IOException
;
...
...
@@ -20,15 +20,16 @@ import org.springframework.mail.javamail.MimeMessageHelper;
import
org.springframework.stereotype.Service
;
import
com.nisum.mytime.model.EmailDomain
;
import
com.nisum.mytime.service.IMailService
;
/**
* @author nisum
*
*/
@Service
public
class
MailService
Impl
implements
MailService
{
public
class
MailService
implements
I
MailService
{
private
static
final
Logger
logger
=
LoggerFactory
.
getLogger
(
MailService
Impl
.
class
);
private
static
final
Logger
logger
=
LoggerFactory
.
getLogger
(
MailService
.
class
);
@Autowired
JavaMailSender
emailSender
;
...
...
src/main/java/com/nisum/mytime/service/impl/MasterDataService.java
0 → 100644
View file @
deb28aca
package
com
.
nisum
.
mytime
.
service
.
impl
;
import
java.util.List
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
com.nisum.mytime.exception.handler.MyTimeException
;
import
com.nisum.mytime.model.MasterData
;
import
com.nisum.mytime.repository.MasterDataRepo
;
import
com.nisum.mytime.service.IMasterDataService
;
public
class
MasterDataService
implements
IMasterDataService
{
@Autowired
private
MasterDataRepo
masterDataRepo
;
@Override
public
List
<
MasterData
>
getMasterData
()
throws
MyTimeException
{
return
masterDataRepo
.
findAll
();
}
}
src/main/java/com/nisum/mytime/service/impl/OrgLocationService.java
0 → 100644
View file @
deb28aca
package
com
.
nisum
.
mytime
.
service
.
impl
;
import
java.util.List
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
com.nisum.mytime.exception.handler.MyTimeException
;
import
com.nisum.mytime.model.Location
;
import
com.nisum.mytime.repository.LocationRepo
;
import
com.nisum.mytime.service.IOrgLocationService
;
@Service
public
class
OrgLocationService
implements
IOrgLocationService
{
@Autowired
private
LocationRepo
locationRepo
;
@Override
public
List
<
Location
>
getLocations
()
throws
MyTimeException
{
return
locationRepo
.
findAll
();
}
}
src/main/java/com/nisum/mytime/service/
ProjectServiceImpl
.java
→
src/main/java/com/nisum/mytime/service/
impl/ProjectService
.java
View file @
deb28aca
package
com
.
nisum
.
mytime
.
service
;
package
com
.
nisum
.
mytime
.
service
.
impl
;
import
java.util.ArrayList
;
import
java.util.Arrays
;
...
...
@@ -39,19 +39,23 @@ import com.nisum.mytime.model.ProjectTeamMate;
import
com.nisum.mytime.repository.AccountRepo
;
import
com.nisum.mytime.repository.DomainRepo
;
import
com.nisum.mytime.repository.EmpShiftDetailsRepo
;
import
com.nisum.mytime.repository.EmployeeR
olesR
epo
;
import
com.nisum.mytime.repository.EmployeeRepo
;
import
com.nisum.mytime.repository.ProjectRepo
;
import
com.nisum.mytime.repository.ProjectTeamMatesRepo
;
import
com.nisum.mytime.repository.TeamMatesBillingRepo
;
import
com.nisum.mytime.service.IDomainService
;
import
com.nisum.mytime.service.IProjectService
;
import
com.nisum.mytime.service.IRoleInfoService
;
import
com.nisum.mytime.service.IRoleMappingService
;
import
com.nisum.mytime.utils.MyTeamResultDTO
;
import
com.nisum.mytime.utils.MyTimeUtils
;
import
com.nisum.mytime.utils.PdfReportGenerator
;
@Service
(
"projectService"
)
public
class
ProjectService
Impl
implements
ProjectService
{
public
class
ProjectService
implements
I
ProjectService
{
@Autowired
private
EmployeeR
olesR
epo
employeeRolesRepo
;
private
EmployeeRepo
employeeRolesRepo
;
@Autowired
private
ProjectRepo
projectRepo
;
...
...
@@ -78,10 +82,10 @@ public class ProjectServiceImpl implements ProjectService {
private
DomainController
domainController
;
@Autowired
private
RoleInfoService
roleInfoService
;
private
I
RoleInfoService
roleInfoService
;
@Autowired
private
RoleMappingService
roleMappingService
;
private
I
RoleMappingService
roleMappingService
;
@Autowired
private
AccountRepo
accountRepo
;
...
...
@@ -92,6 +96,48 @@ public class ProjectServiceImpl implements ProjectService {
@Autowired
private
IDomainService
domainService
;
public
ProjectTeamMate
addNewBeanchAllocation
(
Employee
employee
,
String
loginEmpId
)
{
ProjectTeamMate
teamatePersisted
=
null
;
ProjectTeamMate
newBenchAllocation
=
new
ProjectTeamMate
();
newBenchAllocation
.
setAccount
(
MyTimeUtils
.
BENCH_ACCOUNT
);
newBenchAllocation
.
setBillableStatus
(
MyTimeUtils
.
BENCH_BILLABILITY_STATUS
);
newBenchAllocation
.
setDesignation
(
employee
.
getDesignation
());
newBenchAllocation
.
setEmailId
(
employee
.
getEmailId
());
newBenchAllocation
.
setEmployeeId
(
employee
.
getEmployeeId
());
newBenchAllocation
.
setMobileNumber
(
employee
.
getMobileNumber
());
newBenchAllocation
.
setEmployeeName
(
employee
.
getEmployeeName
());
newBenchAllocation
.
setProjectId
(
MyTimeUtils
.
BENCH_PROJECT_ID
);
newBenchAllocation
.
setStartDate
(
employee
.
getDateOfJoining
()
!=
null
?
employee
.
getDateOfJoining
()
:
new
Date
());
Project
p
=
projectRepo
.
findByProjectId
(
MyTimeUtils
.
BENCH_PROJECT_ID
);
newBenchAllocation
.
setProjectName
(
p
.
getProjectName
());
newBenchAllocation
.
setAccountId
(
p
.
getAccountId
());
newBenchAllocation
.
setDomainId
(
p
.
getDomainId
());
newBenchAllocation
.
setShift
(
employee
.
getShift
());
newBenchAllocation
.
setRole
(
employee
.
getRole
());
if
(
null
!=
employee
.
getEmpStatus
()
&&
employee
.
getEmpStatus
().
trim
().
equalsIgnoreCase
(
MyTimeUtils
.
IN_ACTIVE_SPACE
))
{
newBenchAllocation
.
setEndDate
(
employee
.
getEndDate
());
newBenchAllocation
.
setActive
(
false
);
}
else
{
employee
.
setEmpStatus
(
MyTimeUtils
.
ACTIVE
);
newBenchAllocation
.
setEndDate
(
p
.
getProjectEndDate
());
newBenchAllocation
.
setActive
(
true
);
}
try
{
teamatePersisted
=
addProjectTeamMate
(
newBenchAllocation
,
loginEmpId
);
}
catch
(
MyTimeException
e
)
{
e
.
printStackTrace
();
}
return
teamatePersisted
;
}
@Override
public
List
<
EmpLoginData
>
employeeLoginsBasedOnDate
(
long
id
,
String
fromDate
,
String
toDate
)
throws
MyTimeException
{
...
...
src/main/java/com/nisum/mytime/service/
RoleInfoServiceImpl
.java
→
src/main/java/com/nisum/mytime/service/
impl/RoleInfoService
.java
View file @
deb28aca
package
com
.
nisum
.
mytime
.
service
;
package
com
.
nisum
.
mytime
.
service
.
impl
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
com.nisum.mytime.exception.handler.MyTimeException
;
import
com.nisum.mytime.model.Role
Info
;
import
com.nisum.mytime.model.Role
;
import
com.nisum.mytime.repository.RoleInfoRepo
;
import
com.nisum.mytime.service.IRoleInfoService
;
@Service
public
class
RoleInfoService
Impl
implements
RoleInfoService
{
public
class
RoleInfoService
implements
I
RoleInfoService
{
@Autowired
RoleInfoRepo
roleInfoRepo
;
@Override
public
Role
Info
addRole
(
RoleInfo
roleInfo
)
throws
MyTimeException
{
public
Role
addRole
(
Role
roleInfo
)
throws
MyTimeException
{
return
roleInfoRepo
.
save
(
roleInfo
);
}
...
...
src/main/java/com/nisum/mytime/service/
RoleMappingServiceImpl
.java
→
src/main/java/com/nisum/mytime/service/
impl/RoleMappingService
.java
View file @
deb28aca
package
com
.
nisum
.
mytime
.
service
;
package
com
.
nisum
.
mytime
.
service
.
impl
;
import
java.util.HashSet
;
import
java.util.LinkedHashMap
;
...
...
@@ -19,10 +19,11 @@ import com.nisum.mytime.exception.handler.MyTimeException;
import
com.nisum.mytime.model.RoleMappingInfo
;
import
com.nisum.mytime.repository.RoleInfoRepo
;
import
com.nisum.mytime.repository.RoleMappingInfoRepo
;
import
com.nisum.mytime.service.IRoleMappingService
;
import
com.nisum.mytime.utils.MyTimeUtils
;
@Service
public
class
RoleMappingService
Impl
implements
RoleMappingService
{
public
class
RoleMappingService
implements
I
RoleMappingService
{
@Autowired
private
RoleMappingInfoRepo
roleMappingInfoRepo
;
...
...
@@ -69,21 +70,20 @@ public class RoleMappingServiceImpl implements RoleMappingService {
@Override
public
String
getEmployeeRole
(
String
employeeId
)
{
Map
<
Integer
,
String
>
roleInfoMap
=
new
LinkedHashMap
<
Integer
,
String
>();
List
<
RoleMappingInfo
>
listOfEmployeeRoles
=
roleMappingInfoRepo
.
findByEmployeeId
(
employeeId
);
for
(
RoleMappingInfo
employee
:
listOfEmployeeRoles
)
{
roleInfoMap
.
put
((
roleInfoRepo
.
findByRoleId
(
employee
.
getRoleId
())).
getPriority
(),
employee
.
getRoleId
());
}
roleInfoMap
=
roleInfoMap
.
entrySet
().
stream
().
sorted
(
Map
.
Entry
.
comparingByKey
()).
collect
(
Collectors
.
toMap
(
Map
.
Entry
::
getKey
,
Map
.
Entry
::
getValue
,
(
oldValue
,
newValue
)
->
oldValue
,
LinkedHashMap:
:
new
));
String
roleName
=
null
;
if
(!
roleInfoMap
.
isEmpty
())
{
Map
.
Entry
<
Integer
,
String
>
entry
=
roleInfoMap
.
entrySet
().
iterator
().
next
();
roleName
=
roleInfoRepo
.
findByRoleId
(
entry
.
getValue
()).
getRoleName
();
}
else
{
roleName
=
null
;
List
<
RoleMappingInfo
>
listOfEmployeeRoles
=
roleMappingInfoRepo
.
findByEmployeeId
(
employeeId
).
stream
()
.
filter
(
e
->
(
"N"
.
equalsIgnoreCase
(
e
.
getIsActive
()))).
collect
(
Collectors
.
toList
());
if
(
listOfEmployeeRoles
!=
null
&&
listOfEmployeeRoles
.
size
()
>
0
)
{
for
(
RoleMappingInfo
employee
:
listOfEmployeeRoles
)
{
roleInfoMap
.
put
((
roleInfoRepo
.
findByRoleId
(
employee
.
getRoleId
())).
getPriority
(),
employee
.
getRoleId
());
}
roleInfoMap
=
roleInfoMap
.
entrySet
().
stream
().
sorted
(
Map
.
Entry
.
comparingByKey
()).
collect
(
Collectors
.
toMap
(
Map
.
Entry
::
getKey
,
Map
.
Entry
::
getValue
,
(
oldValue
,
newValue
)
->
oldValue
,
LinkedHashMap:
:
new
));
if
(!
roleInfoMap
.
isEmpty
())
{
Map
.
Entry
<
Integer
,
String
>
entry
=
roleInfoMap
.
entrySet
().
iterator
().
next
();
roleName
=
roleInfoRepo
.
findByRoleId
(
entry
.
getValue
()).
getRoleName
();
}
}
return
roleName
;
}
...
...
@@ -92,7 +92,8 @@ public class RoleMappingServiceImpl implements RoleMappingService {
@Override
public
Set
<
String
>
empRolesMapInfoByEmpId
(
String
employeeId
)
{
Set
<
String
>
roleSet
=
new
HashSet
<
String
>();
List
<
RoleMappingInfo
>
listOfEmployeeRoles
=
roleMappingInfoRepo
.
findByEmployeeId
(
employeeId
);
List
<
RoleMappingInfo
>
listOfEmployeeRoles
=
roleMappingInfoRepo
.
findByEmployeeId
(
employeeId
).
stream
().
filter
(
e
->(
"N"
.
equalsIgnoreCase
(
e
.
getIsActive
()))).
collect
(
Collectors
.
toList
());
if
(
null
!=
listOfEmployeeRoles
&&
!
listOfEmployeeRoles
.
isEmpty
()
&&
MyTimeUtils
.
INT_ZERO
<
listOfEmployeeRoles
.
size
())
{
for
(
RoleMappingInfo
obj
:
listOfEmployeeRoles
)
{
...
...
src/main/java/com/nisum/mytime/service/impl/ShiftService.java
0 → 100644
View file @
deb28aca
package
com
.
nisum
.
mytime
.
service
.
impl
;
import
java.util.List
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
com.nisum.mytime.exception.handler.MyTimeException
;
import
com.nisum.mytime.model.Shift
;
import
com.nisum.mytime.repository.ShiftRepo
;
import
com.nisum.mytime.service.IShiftService
;
@Service
public
class
ShiftService
implements
IShiftService
{
@Autowired
private
ShiftRepo
shiftRepo
;
// @Override
public
List
<
Shift
>
getAllShifts
()
throws
MyTimeException
{
return
shiftRepo
.
findAll
();
}
}
src/main/java/com/nisum/mytime/service/impl/SkillService.java
0 → 100644
View file @
deb28aca
package
com
.
nisum
.
mytime
.
service
.
impl
;
import
java.util.List
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
com.nisum.mytime.exception.handler.MyTimeException
;
import
com.nisum.mytime.model.Skill
;
import
com.nisum.mytime.repository.SkillRepo
;
import
com.nisum.mytime.service.ISkillService
;
@Service
public
class
SkillService
implements
ISkillService
{
@Autowired
private
SkillRepo
technologyRepo
;
@Override
public
List
<
Skill
>
getTechnologies
()
throws
MyTimeException
{
return
technologyRepo
.
findAll
();
}
}
src/main/java/com/nisum/mytime/service/
VisaServiceImpl
.java
→
src/main/java/com/nisum/mytime/service/
impl/VisaService
.java
View file @
deb28aca
/**
*
*/
package
com
.
nisum
.
mytime
.
service
;
package
com
.
nisum
.
mytime
.
service
.
impl
;
import
java.util.List
;
...
...
@@ -11,17 +11,19 @@ import org.springframework.stereotype.Service;
import
com.nisum.mytime.model.EmployeeVisa
;
import
com.nisum.mytime.model.TravelRequest
;
import
com.nisum.mytime.model.Visa
;
import
com.nisum.mytime.repository.EmployeeR
olesR
epo
;
import
com.nisum.mytime.repository.EmployeeRepo
;
import
com.nisum.mytime.repository.EmployeeVisaRepo
;
import
com.nisum.mytime.repository.TravelRepo
;
import
com.nisum.mytime.repository.VisaRepo
;
import
com.nisum.mytime.service.IEmployeeService
;
import
com.nisum.mytime.service.IVisaService
;
/**
* @author nisum
*
*/
@Service
public
class
VisaService
Impl
implements
VisaService
{
public
class
VisaService
implements
I
VisaService
{
@Autowired
private
VisaRepo
visaRepo
;
...
...
@@ -32,10 +34,10 @@ public class VisaServiceImpl implements VisaService {
private
EmployeeVisaRepo
employeeVisaRepo
;
@Autowired
private
User
Service
userService
;
private
IEmployee
Service
userService
;
@Autowired
private
EmployeeR
olesR
epo
employeeRolesRepo
;
private
EmployeeRepo
employeeRolesRepo
;
@Override
...
...
src/main/java/com/nisum/mytime/utils/PdfReportGenerator.java
View file @
deb28aca
...
...
@@ -25,8 +25,8 @@ import com.itextpdf.text.pdf.PdfPTable;
import
com.itextpdf.text.pdf.PdfWriter
;
import
com.nisum.mytime.exception.handler.MyTimeException
;
import
com.nisum.mytime.model.EmpLoginData
;
import
com.nisum.mytime.service.AttendanceService
;
import
com.nisum.mytime.service.EmployeeDataService
;
import
com.nisum.mytime.service.
I
AttendanceService
;
import
com.nisum.mytime.service.
impl.
EmployeeDataService
;
@Component
public
class
PdfReportGenerator
{
...
...
@@ -38,7 +38,7 @@ public class PdfReportGenerator {
private
EmployeeDataService
employeeDataBaseService
;
@Autowired
private
AttendanceService
attendanceService
;
private
I
AttendanceService
attendanceService
;
public
List
generateEmployeeReport
(
long
employeeId
,
String
startDate
,
String
endDate
)
throws
MyTimeException
{
String
fileName
=
employeeId
+
"_"
+
startDate
+
"_"
+
endDate
+
".pdf"
;
...
...
src/main/webapp/WEB-INF/controllers/assignAccountsController.js
View file @
deb28aca
...
...
@@ -48,7 +48,7 @@ myApp.controller("assignAccountsController",function($scope, myFactory, $mdDialo
$scope
.
getAccountDetails
=
function
(){
$http
({
method
:
"GET"
,
url
:
appConfig
.
appUri
+
"account
/account
s"
url
:
appConfig
.
appUri
+
"accounts"
}).
then
(
function
mySuccess
(
response
)
{
if
(
response
.
data
.
length
>
10
){
$scope
.
gridOptions
.
enablePaginationControls
=
true
;
...
...
@@ -112,7 +112,7 @@ myApp.controller("assignAccountsController",function($scope, myFactory, $mdDialo
function
deleteAccountRole
(
accountId
){
var
req
=
{
method
:
'DELETE'
,
url
:
appConfig
.
appUri
+
"account
/account
s?accountId="
+
accountId
url
:
appConfig
.
appUri
+
"accounts?accountId="
+
accountId
}
$http
(
req
).
then
(
function
mySuccess
(
response
)
{
$scope
.
result
=
"Success"
;
...
...
src/test/java/com/nisum/mytime/controllertest/AccountControllerTest.java
View file @
deb28aca
...
...
@@ -28,7 +28,7 @@ import com.fasterxml.jackson.databind.ObjectMapper;
import
com.nisum.mytime.controller.AccountController
;
import
com.nisum.mytime.model.Account
;
import
com.nisum.mytime.service.IAccountService
;
import
com.nisum.mytime.service.AccountService
;
import
com.nisum.mytime.service.
impl.
AccountService
;
public
class
AccountControllerTest
{
...
...
src/test/java/com/nisum/mytime/controllertest/AttendanceControllerTest.java
View file @
deb28aca
...
...
@@ -20,16 +20,16 @@ import org.springframework.test.web.servlet.setup.MockMvcBuilders;
import
com.nisum.mytime.controller.AttendanceController
;
import
com.nisum.mytime.model.AttendenceData
;
import
com.nisum.mytime.model.EmpLoginData
;
import
com.nisum.mytime.service.AttendanceService
;
import
com.nisum.mytime.service.
User
Service
;
import
com.nisum.mytime.service.
I
AttendanceService
;
import
com.nisum.mytime.service.
IEmployee
Service
;
public
class
AttendanceControllerTest
{
@Mock
User
Service
userService
;
IEmployee
Service
userService
;
@Mock
AttendanceService
attendanceService
;
I
AttendanceService
attendanceService
;
@InjectMocks
AttendanceController
attendanceController
;
...
...
src/test/java/com/nisum/mytime/controllertest/EmailControllerTest.java
View file @
deb28aca
...
...
@@ -17,12 +17,12 @@ import org.springframework.test.web.servlet.setup.MockMvcBuilders;
import
com.fasterxml.jackson.databind.ObjectMapper
;
import
com.nisum.mytime.controller.EmailController
;
import
com.nisum.mytime.model.EmailDomain
;
import
com.nisum.mytime.service.MailService
;
import
com.nisum.mytime.service.
I
MailService
;
public
class
EmailControllerTest
{
@Mock
MailService
mailService
;
I
MailService
mailService
;
@InjectMocks
EmailController
emailController
;
...
...
src/test/java/com/nisum/mytime/controllertest/
User
ControllerTest.java
→
src/test/java/com/nisum/mytime/controllertest/
Employee
ControllerTest.java
View file @
deb28aca
...
...
@@ -29,7 +29,7 @@ import org.springframework.test.web.servlet.result.MockMvcResultMatchers;
import
org.springframework.test.web.servlet.setup.MockMvcBuilders
;
import
com.fasterxml.jackson.databind.ObjectMapper
;
import
com.nisum.mytime.controller.
User
Controller
;
import
com.nisum.mytime.controller.
Employee
Controller
;
import
com.nisum.mytime.model.Account
;
import
com.nisum.mytime.model.Designation
;
import
com.nisum.mytime.model.Domain
;
...
...
@@ -39,26 +39,50 @@ import com.nisum.mytime.model.Location;
import
com.nisum.mytime.model.MasterData
;
import
com.nisum.mytime.model.Shift
;
import
com.nisum.mytime.model.Skill
;
import
com.nisum.mytime.service.RoleMappingService
;
import
com.nisum.mytime.service.UserService
;
import
com.nisum.mytime.service.IRoleMappingService
;
import
com.nisum.mytime.service.impl.DesignationService
;
import
com.nisum.mytime.service.impl.EmployeeLocationService
;
import
com.nisum.mytime.service.impl.MasterDataService
;
import
com.nisum.mytime.service.impl.OrgLocationService
;
import
com.nisum.mytime.service.impl.ShiftService
;
import
com.nisum.mytime.service.impl.SkillService
;
import
com.nisum.mytime.service.IEmployeeService
;
public
class
User
ControllerTest
{
public
class
Employee
ControllerTest
{
@Mock
UserService
user
Service
;
IEmployeeService
employee
Service
;
@Mock
RoleMappingService
roleMappingService
;
I
RoleMappingService
roleMappingService
;
@InjectMocks
UserController
userController
;
EmployeeController
employeeController
;
@InjectMocks
EmployeeLocationService
empLocationService
;
@InjectMocks
ShiftService
shiftService
;
@InjectMocks
DesignationService
designationService
;
@InjectMocks
SkillService
skillService
;
@InjectMocks
OrgLocationService
orgLocationService
;
@InjectMocks
MasterDataService
masterDataService
;
private
MockMvc
mockMvc
;
@Before
public
void
setup
()
{
MockitoAnnotations
.
initMocks
(
this
);
mockMvc
=
MockMvcBuilders
.
standaloneSetup
(
user
Controller
).
build
();
mockMvc
=
MockMvcBuilders
.
standaloneSetup
(
employee
Controller
).
build
();
}
@Test
...
...
@@ -69,10 +93,10 @@ public class UserControllerTest {
"Male"
,
null
,
new
Date
(
2020
-
01
-
01
),
null
,
new
Date
(
2018
-
01
-
01
),
new
Date
(
2018
-
02
-
15
),
new
Date
(
2018
-
02
-
15
),
null
,
"Mahesh"
,
"Mahesh"
);
;
when
(
userService
.
getEmployeesRole
(
"mdeekonda@nisum.com"
)).
thenReturn
(
employeesRole
);
when
(
employeeService
.
getEmployeeByEmaillId
(
"mdeekonda@nisum.com"
)).
thenReturn
(
employeesRole
);
mockMvc
.
perform
(
get
(
"/user/employee"
).
param
(
"emailId"
,
"mdeekonda@nisum.com"
))
.
andExpect
(
MockMvcResultMatchers
.
status
().
isOk
());
verify
(
userService
).
getEmployeesRole
(
"mdeekonda@nisum.com"
);
verify
(
employeeService
).
getEmployeeByEmaillId
(
"mdeekonda@nisum.com"
);
}
@Test
...
...
@@ -82,11 +106,11 @@ public class UserControllerTest {
null
,
null
,
null
,
"ACI - Support"
,
"Active"
,
null
,
new
Date
(
2017
-
11
-
20
),
new
Date
(
2107
-
12
-
23
),
"Male"
,
null
,
new
Date
(
2020
-
01
-
01
),
null
,
new
Date
(
2018
-
01
-
01
),
new
Date
(
2018
-
02
-
15
),
new
Date
(
2018
-
02
-
15
),
null
,
"Mahesh"
,
"Mahesh"
);
when
(
userService
.
getEmployeesRole
(
"mdeekonda@nisum.com"
)).
thenReturn
(
employeesRole
);
when
(
employeeService
.
getEmployeeByEmaillId
(
"mdeekonda@nisum.com"
)).
thenReturn
(
employeesRole
);
when
(
roleMappingService
.
getEmployeeRole
(
employeesRole
.
getEmployeeId
())).
thenReturn
(
"Delivery Lead"
);
mockMvc
.
perform
(
get
(
"/user/employee"
).
param
(
"emailId"
,
"mdeekonda@nisum.com"
))
.
andExpect
(
MockMvcResultMatchers
.
status
().
isOk
());
verify
(
userService
).
getEmployeesRole
(
"mdeekonda@nisum.com"
);
verify
(
employeeService
).
getEmployeeByEmaillId
(
"mdeekonda@nisum.com"
);
verify
(
roleMappingService
).
getEmployeeRole
(
"16694"
);
}
...
...
@@ -98,11 +122,11 @@ public class UserControllerTest {
new
Date
(
2018
-
02
-
15
),
new
Date
(
2018
-
02
-
15
),
"Mahesh"
,
"Mahesh"
);
ObjectMapper
mapper
=
new
ObjectMapper
();
String
jsonString
=
mapper
.
writeValueAsString
(
employeeRole
);
when
(
userService
.
assigingEmployeeRol
e
(
anyObject
(),
anyObject
())).
thenReturn
(
employeeRole
);
when
(
employeeService
.
createEmploye
e
(
anyObject
(),
anyObject
())).
thenReturn
(
employeeRole
);
mockMvc
.
perform
(
post
(
"/user/assignEmployeeRole"
).
param
(
"empId"
,
"16999"
)
.
contentType
(
MediaType
.
APPLICATION_JSON_VALUE
).
content
(
jsonString
))
.
andExpect
(
MockMvcResultMatchers
.
status
().
isOk
());
verify
(
userService
).
assigingEmployeeRol
e
(
anyObject
(),
anyObject
());
verify
(
employeeService
).
createEmploye
e
(
anyObject
(),
anyObject
());
}
@Test
...
...
@@ -113,27 +137,27 @@ public class UserControllerTest {
new
Date
(
2018
-
02
-
15
),
new
Date
(
2018
-
02
-
15
),
"Mahesh"
,
"Mahesh"
);
ObjectMapper
mapper
=
new
ObjectMapper
();
String
jsonString
=
mapper
.
writeValueAsString
(
employeeRole2
);
when
(
user
Service
.
updateEmployeeRole
(
anyObject
(),
anyObject
())).
thenReturn
(
employeeRole2
);
when
(
employee
Service
.
updateEmployeeRole
(
anyObject
(),
anyObject
())).
thenReturn
(
employeeRole2
);
mockMvc
.
perform
(
post
(
"/user/updateEmployeeRole"
).
param
(
"empId"
,
"16999"
)
.
contentType
(
MediaType
.
APPLICATION_JSON_VALUE
).
content
(
jsonString
))
.
andExpect
(
MockMvcResultMatchers
.
status
().
isOk
());
verify
(
user
Service
).
updateEmployeeRole
(
anyObject
(),
anyObject
());
verify
(
employee
Service
).
updateEmployeeRole
(
anyObject
(),
anyObject
());
}
@Test
public
void
testdeleteEmployee
()
throws
Exception
{
mockMvc
.
perform
(
delete
(
"/user/deleteEmployee"
).
param
(
"empId"
,
"16127"
))
.
andExpect
(
MockMvcResultMatchers
.
status
().
isOk
());
verify
(
user
Service
).
deleteEmployee
(
"16127"
);
verify
(
employee
Service
).
deleteEmployee
(
"16127"
);
}
@Test
public
void
testgetUserRoles
()
throws
Exception
{
List
<
Employee
>
employeesRole3
=
CreateUserRoles
();
when
(
userService
.
getEmployeeRol
es
()).
thenReturn
(
employeesRole3
);
when
(
employeeService
.
getActiveEmploye
es
()).
thenReturn
(
employeesRole3
);
mockMvc
.
perform
(
get
(
"/user/getUserRoles"
).
contentType
(
MediaType
.
APPLICATION_JSON_VALUE
))
.
andExpect
(
MockMvcResultMatchers
.
status
().
isOk
());
verify
(
userService
).
getEmployeeRol
es
();
verify
(
employeeService
).
getActiveEmploye
es
();
}
@Test
...
...
@@ -143,12 +167,12 @@ public class UserControllerTest {
null
,
null
,
null
,
"ACI - Support"
,
"Active"
,
null
,
new
Date
(
2017
-
11
-
20
),
new
Date
(
2107
-
12
-
23
),
"Male"
,
null
,
new
Date
(
2020
-
01
-
01
),
null
,
new
Date
(
2018
-
01
-
01
),
new
Date
(
2018
-
02
-
15
),
new
Date
(
2018
-
02
-
15
),
null
,
"Mahesh"
,
"Mahesh"
);
when
(
user
Service
.
getEmployeesRoleData
(
"16694"
)).
thenReturn
(
employeesRole
);
when
(
employee
Service
.
getEmployeesRoleData
(
"16694"
)).
thenReturn
(
employeesRole
);
mockMvc
.
perform
(
get
(
"/user/getEmployeeRoleData"
).
param
(
"empId"
,
"16694"
).
contentType
(
MediaType
.
APPLICATION_JSON_VALUE
))
.
andExpect
(
MockMvcResultMatchers
.
status
().
isOk
()).
andExpect
(
jsonPath
(
"$.employeeId"
,
is
(
"16694"
)))
.
andDo
(
print
());
verify
(
user
Service
).
getEmployeesRoleData
(
"16694"
);
verify
(
employee
Service
).
getEmployeesRoleData
(
"16694"
);
}
@Test
...
...
@@ -159,11 +183,11 @@ public class UserControllerTest {
"16090"
,
"Dharmendra Kumar Jampana"
,
"Hyderabad"
,
new
Date
(
2020
-
01
-
01
),
new
Date
(
2018
-
01
-
01
),
new
Date
(
2018
-
02
-
15
),
new
Date
(
2018
-
02
-
15
),
true
);
empLocList
.
add
(
empLocation
);
when
(
user
Service
.
getEmployeeLocationDetails
(
"16090"
)).
thenReturn
(
empLocList
);
when
(
empLocation
Service
.
getEmployeeLocationDetails
(
"16090"
)).
thenReturn
(
empLocList
);
mockMvc
.
perform
(
get
(
"/user/getEmployeeLocations"
).
param
(
"employeeId"
,
"16090"
)
.
contentType
(
MediaType
.
APPLICATION_JSON_VALUE
)).
andExpect
(
MockMvcResultMatchers
.
status
().
isOk
());
verify
(
user
Service
).
getEmployeeLocationDetails
(
"16090"
);
verify
(
empLocation
Service
).
getEmployeeLocationDetails
(
"16090"
);
}
@Test
...
...
@@ -173,12 +197,12 @@ public class UserControllerTest {
null
,
"APPS"
,
"Active"
,
"Full Time"
,
new
Date
(
2017
-
11
-
20
),
new
Date
(
2107
-
12
-
23
),
"Male"
,
null
,
null
,
null
,
new
Date
(
2020
-
01
-
01
),
new
Date
(
2018
-
01
-
01
),
new
Date
(
2018
-
02
-
15
),
new
Date
(
2018
-
02
-
15
),
"Mahesh"
,
"Mahesh"
);
when
(
user
Service
.
getEmployeeRoleDataForSearchCriteria
(
"dummy@nisum.com"
,
"emailId"
)).
thenReturn
(
employeesRole
);
when
(
employee
Service
.
getEmployeeRoleDataForSearchCriteria
(
"dummy@nisum.com"
,
"emailId"
)).
thenReturn
(
employeesRole
);
mockMvc
.
perform
(
get
(
"/user/getEmployeeRoleDataForSearchCriteria"
).
param
(
"searchId"
,
"dummy@nisum.com"
)
.
param
(
"searchAttribute"
,
"emailId"
).
contentType
(
MediaType
.
APPLICATION_JSON_VALUE
))
.
andExpect
(
MockMvcResultMatchers
.
status
().
isOk
()).
andExpect
(
jsonPath
(
"$.employeeId"
,
is
(
"16209"
)))
.
andDo
(
print
());
verify
(
user
Service
).
getEmployeeRoleDataForSearchCriteria
(
"dummy@nisum.com"
,
"emailId"
);
verify
(
employee
Service
).
getEmployeeRoleDataForSearchCriteria
(
"dummy@nisum.com"
,
"emailId"
);
}
@Test
...
...
@@ -189,13 +213,13 @@ public class UserControllerTest {
null
,
null
,
new
Date
(
2020
-
01
-
01
),
new
Date
(
2018
-
01
-
01
),
new
Date
(
2018
-
02
-
15
),
new
Date
(
2018
-
02
-
15
),
"Mahesh"
,
"Mahesh"
);
when
(
user
Service
.
getEmployeeRoleDataForSearchCriteria
(
"Mahesh Kumar Gutam"
,
"employeeName"
))
when
(
employee
Service
.
getEmployeeRoleDataForSearchCriteria
(
"Mahesh Kumar Gutam"
,
"employeeName"
))
.
thenReturn
(
employeesRole
);
mockMvc
.
perform
(
get
(
"/user/getEmployeeRoleDataForSearchCriteria"
).
param
(
"searchId"
,
"Mahesh Kumar Gutam"
)
.
param
(
"searchAttribute"
,
"employeeName"
).
contentType
(
MediaType
.
APPLICATION_JSON_VALUE
))
.
andExpect
(
MockMvcResultMatchers
.
status
().
isOk
()).
andExpect
(
jsonPath
(
"$.employeeId"
,
is
(
"16209"
)))
.
andDo
(
print
());
verify
(
user
Service
).
getEmployeeRoleDataForSearchCriteria
(
"Mahesh Kumar Gutam"
,
"employeeName"
);
verify
(
employee
Service
).
getEmployeeRoleDataForSearchCriteria
(
"Mahesh Kumar Gutam"
,
"employeeName"
);
}
@Test
...
...
@@ -216,51 +240,51 @@ public class UserControllerTest {
details
.
add
(
"16111"
);
details
.
add
(
"Mahesh Mudrakolu"
);
details
.
add
(
"mmahesh@nisum.com"
);
when
(
user
Service
.
getEmployeeDetailsForAutocomplete
()).
thenReturn
(
details
);
when
(
employee
Service
.
getEmployeeDetailsForAutocomplete
()).
thenReturn
(
details
);
mockMvc
.
perform
(
get
(
"/user/getEmployeeDetailsForAutocomplete"
).
contentType
(
MediaType
.
APPLICATION_JSON_VALUE
))
.
andExpect
(
MockMvcResultMatchers
.
status
().
isOk
()).
andDo
(
print
());
verify
(
user
Service
).
getEmployeeDetailsForAutocomplete
();
verify
(
employee
Service
).
getEmployeeDetailsForAutocomplete
();
}
@Test
public
void
testgetManagers
()
throws
Exception
{
List
<
Employee
>
employeesRole4
=
CreateUserRoles
();
System
.
out
.
println
(
employeesRole4
);
when
(
userService
.
getEmployeeRol
es
()).
thenReturn
(
employeesRole4
);
when
(
employeeService
.
getActiveEmploye
es
()).
thenReturn
(
employeesRole4
);
mockMvc
.
perform
(
get
(
"/user/getManagers"
)).
andExpect
(
MockMvcResultMatchers
.
status
().
isOk
());
verify
(
userService
).
getEmployeeRol
es
();
verify
(
employeeService
).
getActiveEmploye
es
();
}
@Test
public
void
testgetAllShifts
()
throws
Exception
{
List
<
Shift
>
shifts
=
CreateShifts
();
when
(
user
Service
.
getAllShifts
()).
thenReturn
(
shifts
);
when
(
shift
Service
.
getAllShifts
()).
thenReturn
(
shifts
);
mockMvc
.
perform
(
get
(
"/user/getAllShifts"
)).
andExpect
(
MockMvcResultMatchers
.
status
().
isOk
());
verify
(
user
Service
).
getAllShifts
();
verify
(
shift
Service
).
getAllShifts
();
}
@Test
public
void
testgetAllDesignations
()
throws
Exception
{
List
<
Designation
>
designation
=
CreateDesignations
();
when
(
user
Service
.
getAllDesignations
()).
thenReturn
(
designation
);
when
(
designation
Service
.
getAllDesignations
()).
thenReturn
(
designation
);
mockMvc
.
perform
(
get
(
"/user/getAllDesignations"
)).
andExpect
(
MockMvcResultMatchers
.
status
().
isOk
());
verify
(
user
Service
).
getAllDesignations
();
verify
(
designation
Service
).
getAllDesignations
();
}
@Test
public
void
testgetTechnologies
()
throws
Exception
{
List
<
Skill
>
skills
=
CreateSkill
();
System
.
out
.
println
(
skills
);
when
(
user
Service
.
getTechnologies
()).
thenReturn
(
skills
);
when
(
skill
Service
.
getTechnologies
()).
thenReturn
(
skills
);
mockMvc
.
perform
(
get
(
"/user/getSkills"
)).
andExpect
(
MockMvcResultMatchers
.
status
().
isOk
());
verify
(
user
Service
).
getTechnologies
();
verify
(
skill
Service
).
getTechnologies
();
}
@Test
public
void
testgetLocations
()
throws
Exception
{
when
(
user
Service
.
getLocations
()).
thenReturn
(
locations
());
when
(
orgLocation
Service
.
getLocations
()).
thenReturn
(
locations
());
mockMvc
.
perform
(
get
(
"/user/getLocations"
)).
andExpect
(
MockMvcResultMatchers
.
status
().
isOk
());
verify
(
user
Service
,
atLeastOnce
()).
getLocations
();
verify
(
orgLocation
Service
,
atLeastOnce
()).
getLocations
();
}
@Test
...
...
@@ -273,45 +297,45 @@ public class UserControllerTest {
ObjectMapper
mapper
=
new
ObjectMapper
();
String
jsonString
=
mapper
.
writeValueAsString
(
employeeRole
);
System
.
out
.
println
(
jsonString
);
when
(
user
Service
.
updateProfile
(
anyObject
())).
thenReturn
(
employeeRole
);
when
(
employee
Service
.
updateProfile
(
anyObject
())).
thenReturn
(
employeeRole
);
mockMvc
.
perform
(
post
(
"/user/updateProfile"
).
contentType
(
MediaType
.
APPLICATION_JSON_VALUE
).
content
(
jsonString
))
.
andExpect
(
MockMvcResultMatchers
.
status
().
isOk
());
verify
(
user
Service
).
updateProfile
(
anyObject
());
verify
(
employee
Service
).
updateProfile
(
anyObject
());
}
@Test
public
void
getAccounts
()
throws
Exception
{
List
<
Account
>
account
=
CreateAccount
();
System
.
out
.
println
(
account
);
when
(
user
Service
.
getAccounts
()).
thenReturn
(
account
);
when
(
employee
Service
.
getAccounts
()).
thenReturn
(
account
);
mockMvc
.
perform
(
get
(
"/user/getAccounts"
)).
andExpect
(
MockMvcResultMatchers
.
status
().
isOk
());
verify
(
user
Service
).
getAccounts
();
verify
(
employee
Service
).
getAccounts
();
}
@Test
public
void
testGetMasterData
()
throws
Exception
{
List
<
MasterData
>
masterDataMap
=
masterData
();
when
(
user
Service
.
getMasterData
()).
thenReturn
(
masterDataMap
);
when
(
masterData
Service
.
getMasterData
()).
thenReturn
(
masterDataMap
);
mockMvc
.
perform
(
get
(
"/user/getMasterData"
)).
andExpect
(
MockMvcResultMatchers
.
status
().
isOk
());
verify
(
user
Service
).
getMasterData
();
verify
(
masterData
Service
).
getMasterData
();
}
@Test
public
void
testGetEmployeeByStatus
()
throws
Exception
{
List
<
Employee
>
empRolesList
=
employeeRoles
();
when
(
user
Service
.
getEmployeesByStatus
(
"Active"
)).
thenReturn
(
empRolesList
);
when
(
employee
Service
.
getEmployeesByStatus
(
"Active"
)).
thenReturn
(
empRolesList
);
mockMvc
.
perform
(
get
(
"/user/getEmployeeByStatus"
).
param
(
"status"
,
"Active"
))
.
andExpect
(
MockMvcResultMatchers
.
status
().
isOk
());
verify
(
user
Service
).
getEmployeesByStatus
(
"Active"
);
verify
(
employee
Service
).
getEmployeesByStatus
(
"Active"
);
}
@Test
public
void
testgetdomains
()
throws
Exception
{
when
(
user
Service
.
getDomains
(
"Acc001"
)).
thenReturn
(
domains
());
when
(
employee
Service
.
getDomains
(
"Acc001"
)).
thenReturn
(
domains
());
mockMvc
.
perform
(
get
(
"/user/getDomains"
).
param
(
"accountId"
,
"Acc001"
))
.
andExpect
(
MockMvcResultMatchers
.
status
().
isOk
());
verify
(
user
Service
).
getDomains
(
"Acc001"
);
verify
(
employee
Service
).
getDomains
(
"Acc001"
);
}
...
...
@@ -331,10 +355,10 @@ public class UserControllerTest {
dlList
.
add
(
dl1
);
dlList
.
add
(
dl2
);
when
(
user
Service
.
getDeliveryLeads
(
"DOM001"
)).
thenReturn
(
dlList
);
when
(
employee
Service
.
getDeliveryLeads
(
"DOM001"
)).
thenReturn
(
dlList
);
mockMvc
.
perform
(
get
(
"/user/getDeliveryLeads"
).
param
(
"domainId"
,
"DOM001"
))
.
andExpect
(
MockMvcResultMatchers
.
status
().
isOk
());
verify
(
user
Service
).
getDeliveryLeads
(
"DOM001"
);
verify
(
employee
Service
).
getDeliveryLeads
(
"DOM001"
);
}
...
...
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