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
35fe87d0
Commit
35fe87d0
authored
Aug 10, 2018
by
bsatyanarayana-nisum-com
Committed by
tdutta-nisum-com
Aug 10, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
MT-152 :SNS :: Add_createdBy_modifiedBy_fileds_to_EmployeeDetails (#145)
parent
3cf1654e
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
32 additions
and
17 deletions
+32
-17
ProjectController.java
...n/java/com/nisum/mytime/controller/ProjectController.java
+1
-1
UserController.java
...main/java/com/nisum/mytime/controller/UserController.java
+5
-4
VisaController.java
...main/java/com/nisum/mytime/controller/VisaController.java
+3
-2
EmployeeRoles.java
src/main/java/com/nisum/mytime/model/EmployeeRoles.java
+4
-0
UserService.java
src/main/java/com/nisum/mytime/service/UserService.java
+2
-2
UserServiceImpl.java
src/main/java/com/nisum/mytime/service/UserServiceImpl.java
+9
-2
VisaService.java
src/main/java/com/nisum/mytime/service/VisaService.java
+1
-1
VisaServiceImpl.java
src/main/java/com/nisum/mytime/service/VisaServiceImpl.java
+5
-4
ExportDataController.js
src/main/webapp/WEB-INF/controllers/ExportDataController.js
+2
-1
No files found.
src/main/java/com/nisum/mytime/controller/ProjectController.java
View file @
35fe87d0
...
@@ -75,7 +75,7 @@ public class ProjectController {
...
@@ -75,7 +75,7 @@ public class ProjectController {
public
ResponseEntity
<
List
<
HashMap
<
Object
,
Object
>>>
getProjects
(
@RequestParam
(
value
=
"empId"
,
required
=
false
,
defaultValue
=
MyTimeUtils
.
ZERO
)
String
empId
)
throws
MyTimeException
{
public
ResponseEntity
<
List
<
HashMap
<
Object
,
Object
>>>
getProjects
(
@RequestParam
(
value
=
"empId"
,
required
=
false
,
defaultValue
=
MyTimeUtils
.
ZERO
)
String
empId
)
throws
MyTimeException
{
List
<
HashMap
<
Object
,
Object
>>
projects
=
null
;
List
<
HashMap
<
Object
,
Object
>>
projects
=
null
;
if
(!
MyTimeUtils
.
ZERO
.
equals
(
empId
)
)
{
if
(!
"undefined"
.
equalsIgnoreCase
(
empId
)
)
{
boolean
isDl
=
userService
.
verifyRole
(
empId
,
MyTimeUtils
.
DL
)
;
boolean
isDl
=
userService
.
verifyRole
(
empId
,
MyTimeUtils
.
DL
)
;
if
(
isDl
){
if
(
isDl
){
projects
=
projectService
.
deliveryLeadProjects
(
empId
);
projects
=
projectService
.
deliveryLeadProjects
(
empId
);
...
...
src/main/java/com/nisum/mytime/controller/UserController.java
View file @
35fe87d0
...
@@ -65,9 +65,9 @@ public class UserController {
...
@@ -65,9 +65,9 @@ public class UserController {
produces
=
MediaType
.
APPLICATION_JSON_VALUE
,
produces
=
MediaType
.
APPLICATION_JSON_VALUE
,
consumes
=
MediaType
.
APPLICATION_JSON_VALUE
)
consumes
=
MediaType
.
APPLICATION_JSON_VALUE
)
public
ResponseEntity
<
EmployeeRoles
>
assigingEmployeeRole
(
public
ResponseEntity
<
EmployeeRoles
>
assigingEmployeeRole
(
@RequestBody
EmployeeRoles
employeeRoles
)
throws
MyTimeException
{
@RequestBody
EmployeeRoles
employeeRoles
,
@RequestParam
(
value
=
"empId"
)
String
loginEmpId
)
throws
MyTimeException
{
EmployeeRoles
employeeRole
=
userService
EmployeeRoles
employeeRole
=
userService
.
assigingEmployeeRole
(
employeeRoles
);
.
assigingEmployeeRole
(
employeeRoles
,
loginEmpId
);
return
new
ResponseEntity
<>(
employeeRole
,
HttpStatus
.
OK
);
return
new
ResponseEntity
<>(
employeeRole
,
HttpStatus
.
OK
);
}
}
...
@@ -75,9 +75,10 @@ public class UserController {
...
@@ -75,9 +75,10 @@ public class UserController {
produces
=
MediaType
.
APPLICATION_JSON_VALUE
,
produces
=
MediaType
.
APPLICATION_JSON_VALUE
,
consumes
=
MediaType
.
APPLICATION_JSON_VALUE
)
consumes
=
MediaType
.
APPLICATION_JSON_VALUE
)
public
ResponseEntity
<
EmployeeRoles
>
updateEmployeeRole
(
public
ResponseEntity
<
EmployeeRoles
>
updateEmployeeRole
(
@RequestBody
EmployeeRoles
employeeRoles
)
throws
MyTimeException
{
@RequestBody
EmployeeRoles
employeeRoles
,
@RequestParam
(
value
=
"empId"
)
String
loginEmpId
)
throws
MyTimeException
{
EmployeeRoles
employeeRole
=
userService
EmployeeRoles
employeeRole
=
userService
.
updateEmployeeRole
(
employeeRoles
);
.
updateEmployeeRole
(
employeeRoles
,
loginEmpId
);
return
new
ResponseEntity
<>(
employeeRole
,
HttpStatus
.
OK
);
return
new
ResponseEntity
<>(
employeeRole
,
HttpStatus
.
OK
);
}
}
...
...
src/main/java/com/nisum/mytime/controller/VisaController.java
View file @
35fe87d0
...
@@ -18,6 +18,7 @@ import com.nisum.mytime.model.EmployeeVisa;
...
@@ -18,6 +18,7 @@ import com.nisum.mytime.model.EmployeeVisa;
import
com.nisum.mytime.model.TravelRequest
;
import
com.nisum.mytime.model.TravelRequest
;
import
com.nisum.mytime.model.Visa
;
import
com.nisum.mytime.model.Visa
;
import
com.nisum.mytime.service.VisaService
;
import
com.nisum.mytime.service.VisaService
;
import
com.nisum.mytime.utils.MyTimeUtils
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
...
@@ -86,10 +87,10 @@ public class VisaController {
...
@@ -86,10 +87,10 @@ public class VisaController {
}
}
@RequestMapping
(
value
=
"/fileUpload"
,
method
=
RequestMethod
.
POST
,
produces
=
MediaType
.
APPLICATION_JSON_VALUE
,
consumes
=
MediaType
.
MULTIPART_FORM_DATA_VALUE
)
@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
)
public
ResponseEntity
<
String
>
exportDataFromFile
(
@RequestParam
(
value
=
"file"
)
MultipartFile
file
,
@RequestParam
(
value
=
"empId"
)
String
loginEmpId
)
throws
MyTimeException
{
throws
MyTimeException
{
log
.
info
(
"Uploaded file: {} with size: {}"
,
file
.
getOriginalFilename
(),
file
.
getSize
());
log
.
info
(
"Uploaded file: {} with size: {}"
,
file
.
getOriginalFilename
(),
file
.
getSize
());
String
result
=
visaService
.
exportDataFromExcelFile
(
file
);
String
result
=
visaService
.
exportDataFromExcelFile
(
file
,
loginEmpId
);
return
new
ResponseEntity
<>(
result
,
HttpStatus
.
OK
);
return
new
ResponseEntity
<>(
result
,
HttpStatus
.
OK
);
}
}
...
...
src/main/java/com/nisum/mytime/model/EmployeeRoles.java
View file @
35fe87d0
...
@@ -104,5 +104,9 @@ public class EmployeeRoles implements Serializable {
...
@@ -104,5 +104,9 @@ public class EmployeeRoles implements Serializable {
@ExcelCellName
(
"Exit Date"
)
@ExcelCellName
(
"Exit Date"
)
private
Date
endDate
;
private
Date
endDate
;
private
String
createdBy
;
private
String
modifiedBy
;
}
}
src/main/java/com/nisum/mytime/service/UserService.java
View file @
35fe87d0
...
@@ -26,7 +26,7 @@ public interface UserService {
...
@@ -26,7 +26,7 @@ public interface UserService {
List
<
EmployeeRoles
>
getEmployeeRoles
()
throws
MyTimeException
;
List
<
EmployeeRoles
>
getEmployeeRoles
()
throws
MyTimeException
;
EmployeeRoles
assigingEmployeeRole
(
EmployeeRoles
employeeRoles
)
EmployeeRoles
assigingEmployeeRole
(
EmployeeRoles
employeeRoles
,
String
empId
)
throws
MyTimeException
;
throws
MyTimeException
;
String
generatePdfReport
(
long
id
,
String
fromDate
,
String
toDate
)
String
generatePdfReport
(
long
id
,
String
fromDate
,
String
toDate
)
...
@@ -36,7 +36,7 @@ public interface UserService {
...
@@ -36,7 +36,7 @@ public interface UserService {
void
deleteEmployee
(
String
empId
);
void
deleteEmployee
(
String
empId
);
EmployeeRoles
updateEmployeeRole
(
EmployeeRoles
employeeRoles
);
EmployeeRoles
updateEmployeeRole
(
EmployeeRoles
employeeRoles
,
String
empId
);
void
updateEmployeeLocationDetails
(
EmployeeRoles
employeeRoles
,
void
updateEmployeeLocationDetails
(
EmployeeRoles
employeeRoles
,
boolean
delete
);
boolean
delete
);
...
...
src/main/java/com/nisum/mytime/service/UserServiceImpl.java
View file @
35fe87d0
...
@@ -133,9 +133,13 @@ public class UserServiceImpl implements UserService {
...
@@ -133,9 +133,13 @@ public class UserServiceImpl implements UserService {
}
}
@Override
@Override
public
EmployeeRoles
assigingEmployeeRole
(
EmployeeRoles
employeeRoles
)
public
EmployeeRoles
assigingEmployeeRole
(
EmployeeRoles
employeeRoles
,
String
empId
)
throws
MyTimeException
{
throws
MyTimeException
{
employeeRoles
.
setCreatedOn
(
new
Date
());
employeeRoles
.
setCreatedOn
(
new
Date
());
employeeRoles
.
setCreatedBy
(
empId
);
employeeRoles
.
setModifiedBy
(
empId
);
if
(
employeeRoles
.
getEmploymentType
()
!=
null
if
(
employeeRoles
.
getEmploymentType
()
!=
null
&&
!
employeeRoles
.
getEmploymentType
().
isEmpty
()
&&
!
employeeRoles
.
getEmploymentType
().
isEmpty
()
&&
!
employeeRoles
.
getEmploymentType
()
&&
!
employeeRoles
.
getEmploymentType
()
...
@@ -204,7 +208,7 @@ public class UserServiceImpl implements UserService {
...
@@ -204,7 +208,7 @@ public class UserServiceImpl implements UserService {
}
}
@Override
@Override
public
EmployeeRoles
updateEmployeeRole
(
EmployeeRoles
employeeRoles
)
{
public
EmployeeRoles
updateEmployeeRole
(
EmployeeRoles
employeeRoles
,
String
empId
)
{
// TODO update all emp details to inactive if employee is inactive
// TODO update all emp details to inactive if employee is inactive
Query
query
=
new
Query
(
Query
query
=
new
Query
(
Criteria
.
where
(
"employeeId"
).
is
(
employeeRoles
.
getEmployeeId
()));
Criteria
.
where
(
"employeeId"
).
is
(
employeeRoles
.
getEmployeeId
()));
...
@@ -226,6 +230,9 @@ public class UserServiceImpl implements UserService {
...
@@ -226,6 +230,9 @@ public class UserServiceImpl implements UserService {
update
.
set
(
"hasB1"
,
employeeRoles
.
getHasB1
());
update
.
set
(
"hasB1"
,
employeeRoles
.
getHasB1
());
update
.
set
(
"passportExpiryDate"
,
employeeRoles
.
getPassportExpiryDate
());
update
.
set
(
"passportExpiryDate"
,
employeeRoles
.
getPassportExpiryDate
());
update
.
set
(
"b1ExpiryDate"
,
employeeRoles
.
getB1ExpiryDate
());
update
.
set
(
"b1ExpiryDate"
,
employeeRoles
.
getB1ExpiryDate
());
update
.
set
(
"modifiedBy"
,
empId
);
if
(
employeeRoles
.
getEmpStatus
().
equalsIgnoreCase
(
MyTimeUtils
.
IN_ACTIVE_SPACE
))
{
if
(
employeeRoles
.
getEmpStatus
().
equalsIgnoreCase
(
MyTimeUtils
.
IN_ACTIVE_SPACE
))
{
update
.
set
(
"endDate"
,
employeeRoles
.
getEndDate
());
update
.
set
(
"endDate"
,
employeeRoles
.
getEndDate
());
}
}
...
...
src/main/java/com/nisum/mytime/service/VisaService.java
View file @
35fe87d0
...
@@ -36,5 +36,5 @@ public interface VisaService {
...
@@ -36,5 +36,5 @@ public interface VisaService {
void
deleteEmployeeVisas
(
TravelRequest
e
);
void
deleteEmployeeVisas
(
TravelRequest
e
);
String
exportDataFromExcelFile
(
MultipartFile
file
)
throws
MyTimeException
;
String
exportDataFromExcelFile
(
MultipartFile
file
,
String
empId
)
throws
MyTimeException
;
}
}
src/main/java/com/nisum/mytime/service/VisaServiceImpl.java
View file @
35fe87d0
...
@@ -88,7 +88,7 @@ public class VisaServiceImpl implements VisaService {
...
@@ -88,7 +88,7 @@ public class VisaServiceImpl implements VisaService {
}
}
@Override
@Override
public
String
exportDataFromExcelFile
(
MultipartFile
file
)
public
String
exportDataFromExcelFile
(
MultipartFile
file
,
String
empId
)
throws
MyTimeException
{
throws
MyTimeException
{
String
result
=
"Failure"
;
String
result
=
"Failure"
;
int
counter
=
0
;
int
counter
=
0
;
...
@@ -104,7 +104,7 @@ public class VisaServiceImpl implements VisaService {
...
@@ -104,7 +104,7 @@ public class VisaServiceImpl implements VisaService {
for
(
EmployeeRoles
employee
:
employees
)
{
for
(
EmployeeRoles
employee
:
employees
)
{
System
.
out
.
println
(
"test employee"
+
employee
);
System
.
out
.
println
(
"test employee"
+
employee
);
if
(
null
!=
employee
.
getEmployeeId
())
if
(
null
!=
employee
.
getEmployeeId
())
findAndModifyEmployeeRole
(
employee
);
findAndModifyEmployeeRole
(
employee
,
empId
);
else
else
counter
++;
counter
++;
}
}
...
@@ -127,7 +127,7 @@ public class VisaServiceImpl implements VisaService {
...
@@ -127,7 +127,7 @@ public class VisaServiceImpl implements VisaService {
return
result
;
return
result
;
}
}
private
void
findAndModifyEmployeeRole
(
EmployeeRoles
employee
)
{
private
void
findAndModifyEmployeeRole
(
EmployeeRoles
employee
,
String
empId
)
{
/*
/*
* Query query = new
* Query query = new
* Query(Criteria.where("employeeId").is(employee.getEmployeeId()))
* Query(Criteria.where("employeeId").is(employee.getEmployeeId()))
...
@@ -158,11 +158,12 @@ public class VisaServiceImpl implements VisaService {
...
@@ -158,11 +158,12 @@ public class VisaServiceImpl implements VisaService {
* employee.getEmployeeId());
* employee.getEmployeeId());
*/
*/
employee
.
setRole
(
"Employee"
);
employee
.
setRole
(
"Employee"
);
EmployeeRoles
emp
=
userService
EmployeeRoles
emp
=
userService
.
getEmployeesRoleData
(
employee
.
getEmployeeId
());
.
getEmployeesRoleData
(
employee
.
getEmployeeId
());
if
(
emp
==
null
)
{
if
(
emp
==
null
)
{
try
{
try
{
userService
.
assigingEmployeeRole
(
employee
);
userService
.
assigingEmployeeRole
(
employee
,
empId
);
}
catch
(
MyTimeException
e
)
{
}
catch
(
MyTimeException
e
)
{
// TODO Auto-generated catch block
// TODO Auto-generated catch block
e
.
printStackTrace
();
e
.
printStackTrace
();
...
...
src/main/webapp/WEB-INF/controllers/ExportDataController.js
View file @
35fe87d0
...
@@ -27,6 +27,7 @@ myApp
...
@@ -27,6 +27,7 @@ myApp
$scope
.
uploadFiles
=
function
()
{
$scope
.
uploadFiles
=
function
()
{
var
file
=
$scope
.
file
;
var
file
=
$scope
.
file
;
var
empId
=
myFactory
.
getEmpId
();
if
(
file
==
""
||
file
.
length
==
0
)
{
if
(
file
==
""
||
file
.
length
==
0
)
{
showAlert
(
'Please choose a file to import data...'
);
showAlert
(
'Please choose a file to import data...'
);
$scope
.
refreshPage
();
$scope
.
refreshPage
();
...
@@ -41,7 +42,7 @@ myApp
...
@@ -41,7 +42,7 @@ myApp
$http
$http
.
post
(
.
post
(
appConfig
.
appUri
appConfig
.
appUri
+
"visa/fileUpload
"
,
+
"visa/fileUpload
?empId="
+
empId
,
formData
,
formData
,
{
{
transformRequest
:
angular
.
identity
,
transformRequest
:
angular
.
identity
,
...
...
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