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
9b56e06d
Commit
9b56e06d
authored
May 27, 2019
by
Vijay Akula
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Issue fixed for uploading employee xl file
parent
acbc9140
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
40 additions
and
25 deletions
+40
-25
UploadXLService.java
...n/java/com/nisum/myteam/service/impl/UploadXLService.java
+21
-15
DataValidations.java
src/main/java/com/nisum/myteam/utils/DataValidations.java
+19
-10
No files found.
src/main/java/com/nisum/myteam/service/impl/UploadXLService.java
View file @
9b56e06d
...
@@ -27,6 +27,9 @@ public class UploadXLService implements IUploadXLService {
...
@@ -27,6 +27,9 @@ public class UploadXLService implements IUploadXLService {
@Autowired
@Autowired
EmployeeService
employeeService
;
EmployeeService
employeeService
;
@Autowired
DataValidations
dataValidations
;
@Override
@Override
public
String
importDataFromExcelFile
(
MultipartFile
file
,
String
logInEmpId
)
throws
MyTeamException
{
public
String
importDataFromExcelFile
(
MultipartFile
file
,
String
logInEmpId
)
throws
MyTeamException
{
String
result
=
""
;
String
result
=
""
;
...
@@ -190,31 +193,32 @@ public class UploadXLService implements IUploadXLService {
...
@@ -190,31 +193,32 @@ public class UploadXLService implements IUploadXLService {
private
boolean
importExcelMandatoryColumnsValidation
(
Employee
emp
)
{
private
boolean
importExcelMandatoryColumnsValidation
(
Employee
emp
)
{
boolean
mandatoryFlag
=
true
;
boolean
mandatoryFlag
=
true
;
if
(!
D
ataValidations
.
validateNumber
(
emp
.
getEmployeeId
()))
{
if
(!
d
ataValidations
.
validateNumber
(
emp
.
getEmployeeId
()))
{
mandatoryFlag
=
false
;
mandatoryFlag
=
false
;
}
else
if
(!
D
ataValidations
.
validateName
(
emp
.
getEmployeeName
()))
{
}
else
if
(!
d
ataValidations
.
validateName
(
emp
.
getEmployeeName
()))
{
mandatoryFlag
=
false
;
mandatoryFlag
=
false
;
}
else
if
(!
D
ataValidations
.
isValidGender
(
emp
.
getGender
()))
{
}
else
if
(!
d
ataValidations
.
isValidGender
(
emp
.
getGender
()))
{
mandatoryFlag
=
false
;
mandatoryFlag
=
false
;
}
else
if
(!
D
ataValidations
.
isValidDate
(
emp
.
getDateOfJoining
()))
{
}
else
if
(!
d
ataValidations
.
isValidDate
(
emp
.
getDateOfJoining
()))
{
mandatoryFlag
=
false
;
mandatoryFlag
=
false
;
}
else
if
(!
D
ataValidations
.
isValidFunctionalGroup
(
emp
.
getFunctionalGroup
()))
{
}
else
if
(!
d
ataValidations
.
isValidFunctionalGroup
(
emp
.
getFunctionalGroup
()))
{
mandatoryFlag
=
false
;
mandatoryFlag
=
false
;
}
else
if
(!
D
ataValidations
.
isValidDesignation
(
emp
.
getDesignation
()))
{
}
else
if
(!
d
ataValidations
.
isValidDesignation
(
emp
.
getDesignation
()))
{
mandatoryFlag
=
false
;
mandatoryFlag
=
false
;
}
else
if
(!
D
ataValidations
.
isValidWorkLocation
(
emp
.
getEmpLocation
()))
{
}
else
if
(!
d
ataValidations
.
isValidWorkLocation
(
emp
.
getEmpLocation
()))
{
mandatoryFlag
=
false
;
mandatoryFlag
=
false
;
}
else
if
(!
D
ataValidations
.
isValidEmploymentType
(
emp
.
getEmploymentType
()))
{
}
else
if
(!
d
ataValidations
.
isValidEmploymentType
(
emp
.
getEmploymentType
()))
{
mandatoryFlag
=
false
;
mandatoryFlag
=
false
;
}
else
if
(!
D
ataValidations
.
isValidRole
(
emp
.
getRole
()))
{
}
else
if
(!
d
ataValidations
.
isValidRole
(
emp
.
getRole
()))
{
mandatoryFlag
=
false
;
mandatoryFlag
=
false
;
}
else
if
(!
D
ataValidations
.
isYesOrNo
(
emp
.
getHasPassort
()))
{
}
else
if
(!
d
ataValidations
.
isYesOrNo
(
emp
.
getHasPassort
()))
{
mandatoryFlag
=
false
;
mandatoryFlag
=
false
;
}
else
if
(!
D
ataValidations
.
isYesOrNo
(
emp
.
getHasB1
()))
{
}
else
if
(!
d
ataValidations
.
isYesOrNo
(
emp
.
getHasB1
()))
{
mandatoryFlag
=
false
;
mandatoryFlag
=
false
;
}
else
if
(!
D
ataValidations
.
isValidEmail
(
emp
.
getEmailId
()))
{
}
else
if
(!
d
ataValidations
.
isValidEmail
(
emp
.
getEmailId
()))
{
mandatoryFlag
=
false
;
mandatoryFlag
=
false
;
}
}
return
mandatoryFlag
;
return
mandatoryFlag
;
}
}
...
@@ -226,20 +230,22 @@ public class UploadXLService implements IUploadXLService {
...
@@ -226,20 +230,22 @@ public class UploadXLService implements IUploadXLService {
}
}
if
(
MyTeamUtils
.
YES
.
equalsIgnoreCase
(
emp
.
getHasPassort
().
trim
())
if
(
MyTeamUtils
.
YES
.
equalsIgnoreCase
(
emp
.
getHasPassort
().
trim
())
||
MyTeamUtils
.
STRING_Y
.
equalsIgnoreCase
(
emp
.
getHasPassort
().
trim
()))
{
||
MyTeamUtils
.
STRING_Y
.
equalsIgnoreCase
(
emp
.
getHasPassort
().
trim
()))
{
if
(!
D
ataValidations
.
isFutureDate
(
emp
.
getPassportExpiryDate
()))
{
if
(!
d
ataValidations
.
isFutureDate
(
emp
.
getPassportExpiryDate
()))
{
addInValidRecord
(
inValidEmpRecList
,
invalidEmpRecs
,
emp
,
rowNumber
);
addInValidRecord
(
inValidEmpRecList
,
invalidEmpRecs
,
emp
,
rowNumber
);
return
;
return
;
}
}
}
}
if
(
emp
.
getHasPassort
().
trim
().
isEmpty
()
||
MyTeamUtils
.
NO
.
equalsIgnoreCase
(
emp
.
getHasPassort
().
trim
())
if
(
emp
.
getHasPassort
().
trim
().
isEmpty
()
||
MyTeamUtils
.
NO
.
equalsIgnoreCase
(
emp
.
getHasPassort
().
trim
())
||
MyTeamUtils
.
STRING_N
.
equalsIgnoreCase
(
emp
.
getHasPassort
().
trim
()))
{
||
MyTeamUtils
.
STRING_N
.
equalsIgnoreCase
(
emp
.
getHasPassort
().
trim
()))
{
if
(
null
!=
emp
.
getPassportExpiryDate
()
||
null
!=
emp
.
getHasB1
().
trim
()
||
null
!=
emp
.
getB1ExpiryDate
()
)
{
if
(
null
!=
emp
.
getPassportExpiryDate
())
{
addInValidRecord
(
inValidEmpRecList
,
invalidEmpRecs
,
emp
,
rowNumber
);
addInValidRecord
(
inValidEmpRecList
,
invalidEmpRecs
,
emp
,
rowNumber
);
return
;
return
;
}
}
}
}
if
((
MyTeamUtils
.
YES
.
equals
(
emp
.
getHasB1
())
||
MyTeamUtils
.
STRING_Y
.
equals
(
emp
.
getHasB1
()))
if
((
MyTeamUtils
.
YES
.
equals
(
emp
.
getHasB1
())
||
MyTeamUtils
.
STRING_Y
.
equals
(
emp
.
getHasB1
()))
&&
!
D
ataValidations
.
isFutureDate
(
emp
.
getB1ExpiryDate
()))
{
&&
!
d
ataValidations
.
isFutureDate
(
emp
.
getB1ExpiryDate
()))
{
addInValidRecord
(
inValidEmpRecList
,
invalidEmpRecs
,
emp
,
rowNumber
);
addInValidRecord
(
inValidEmpRecList
,
invalidEmpRecs
,
emp
,
rowNumber
);
return
;
return
;
}
}
...
...
src/main/java/com/nisum/myteam/utils/DataValidations.java
View file @
9b56e06d
...
@@ -5,6 +5,7 @@ import java.util.Date;
...
@@ -5,6 +5,7 @@ import java.util.Date;
import
java.util.List
;
import
java.util.List
;
import
java.util.regex.Matcher
;
import
java.util.regex.Matcher
;
import
java.util.regex.Pattern
;
import
java.util.regex.Pattern
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
...
@@ -13,13 +14,14 @@ import com.nisum.myteam.service.IMasterDataService;
...
@@ -13,13 +14,14 @@ import com.nisum.myteam.service.IMasterDataService;
import
com.nisum.myteam.service.impl.OrgLocationService
;
import
com.nisum.myteam.service.impl.OrgLocationService
;
@Service
@Service
@Slf4j
public
class
DataValidations
{
public
class
DataValidations
{
@Autowired
@Autowired
static
IMasterDataService
masterDataService
;
IMasterDataService
masterDataService
;
@Autowired
@Autowired
static
OrgLocationService
orgLocationService
;
OrgLocationService
orgLocationService
;
public
static
boolean
validateNumber
(
String
number
)
{
public
static
boolean
validateNumber
(
String
number
)
{
boolean
flag
=
false
;
boolean
flag
=
false
;
...
@@ -39,16 +41,17 @@ public class DataValidations {
...
@@ -39,16 +41,17 @@ public class DataValidations {
boolean
flag
=
false
;
boolean
flag
=
false
;
name
=
name
.
trim
();
name
=
name
.
trim
();
if
(!
MyTeamUtils
.
EMPTY_STRING
.
equals
(
name
))
{
if
(!
MyTeamUtils
.
EMPTY_STRING
.
equals
(
name
))
{
String
regx
=
"^[\\p{L}]+$"
;
String
regx
=
"^[\\p{L}
]+$"
;
Pattern
pattern
=
Pattern
.
compile
(
regx
,
Pattern
.
CASE_INSENSITIVE
);
Pattern
pattern
=
Pattern
.
compile
(
regx
,
Pattern
.
CASE_INSENSITIVE
);
Matcher
matcher
=
pattern
.
matcher
(
name
);
Matcher
matcher
=
pattern
.
matcher
(
name
);
flag
=
matcher
.
find
();
flag
=
matcher
.
find
();
log
.
info
(
"flag:"
+
flag
);
}
}
return
flag
;
return
flag
;
}
}
public
static
boolean
isValidGender
(
String
gender
)
{
public
static
boolean
isValidGender
(
String
gender
)
{
boolean
flag
=
false
;
boolean
flag
=
false
;
gender
=
gender
.
trim
();
gender
=
gender
.
trim
();
if
(
!
MyTeamUtils
.
EMPTY_STRING
.
equals
(
gender
))
{
if
(
!
MyTeamUtils
.
EMPTY_STRING
.
equals
(
gender
))
{
...
@@ -79,17 +82,23 @@ public class DataValidations {
...
@@ -79,17 +82,23 @@ public class DataValidations {
return
flag
;
return
flag
;
}
}
public
static
boolean
isValidFunctionalGroup
(
String
functionalGroup
)
{
public
boolean
isValidFunctionalGroup
(
String
functionalGroup
)
{
boolean
flag
=
false
;
boolean
flag
=
false
;
functionalGroup
=
functionalGroup
.
trim
();
functionalGroup
=
functionalGroup
.
trim
();
if
(!
MyTeamUtils
.
EMPTY_STRING
.
equals
(
functionalGroup
))
{
if
(!
MyTeamUtils
.
EMPTY_STRING
.
equals
(
functionalGroup
))
{
List
<
MasterData
>
fsData
=
masterDataService
.
findByMasterDataTypeAndMasterDataNameAndActiveStatus
(
MyTeamUtils
.
MASTERDATA_FG
,
functionalGroup
,
true
);
List
<
MasterData
>
fsData
=
masterDataService
.
findByMasterDataTypeAndMasterDataNameAndActiveStatus
(
MyTeamUtils
.
MASTERDATA_FG
,
functionalGroup
,
true
);
flag
=
fsData
.
size
()
>
MyTeamUtils
.
INT_ZERO
;
log
.
info
(
"FunctionalGroup Data::"
+
fsData
);
if
(
fsData
!=
null
)
{
flag
=
fsData
.
size
()
>
MyTeamUtils
.
INT_ZERO
;
log
.
info
(
"flag value::"
+
flag
);
}
}
}
return
flag
;
return
flag
;
}
}
public
static
boolean
isValidDesignation
(
String
designation
)
{
public
boolean
isValidDesignation
(
String
designation
)
{
boolean
flag
=
false
;
boolean
flag
=
false
;
designation
=
designation
.
trim
();
designation
=
designation
.
trim
();
if
(
!
MyTeamUtils
.
EMPTY_STRING
.
equals
(
designation
))
{
if
(
!
MyTeamUtils
.
EMPTY_STRING
.
equals
(
designation
))
{
...
@@ -100,7 +109,7 @@ public class DataValidations {
...
@@ -100,7 +109,7 @@ public class DataValidations {
}
}
public
static
boolean
isValidEmploymentType
(
String
employmentType
)
{
public
boolean
isValidEmploymentType
(
String
employmentType
)
{
boolean
flag
=
false
;
boolean
flag
=
false
;
employmentType
=
employmentType
.
trim
();
employmentType
=
employmentType
.
trim
();
if
(
MyTeamUtils
.
EMPTY_STRING
.
equals
(
employmentType
)){
if
(
MyTeamUtils
.
EMPTY_STRING
.
equals
(
employmentType
)){
...
@@ -112,7 +121,7 @@ public class DataValidations {
...
@@ -112,7 +121,7 @@ public class DataValidations {
return
flag
;
return
flag
;
}
}
public
static
boolean
isValidRole
(
String
role
)
{
public
boolean
isValidRole
(
String
role
)
{
boolean
flag
=
false
;
boolean
flag
=
false
;
role
=
role
.
trim
();
role
=
role
.
trim
();
if
(
MyTeamUtils
.
EMPTY_STRING
.
equals
(
role
)){
if
(
MyTeamUtils
.
EMPTY_STRING
.
equals
(
role
)){
...
@@ -151,7 +160,7 @@ public class DataValidations {
...
@@ -151,7 +160,7 @@ public class DataValidations {
}
}
public
static
boolean
isValidWorkLocation
(
String
workLocation
)
{
public
boolean
isValidWorkLocation
(
String
workLocation
)
{
boolean
flag
=
false
;
boolean
flag
=
false
;
workLocation
=
workLocation
.
trim
();
workLocation
=
workLocation
.
trim
();
if
(!
MyTeamUtils
.
EMPTY_STRING
.
equals
(
workLocation
))
{
if
(!
MyTeamUtils
.
EMPTY_STRING
.
equals
(
workLocation
))
{
...
...
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