Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
X
xyqb-user2
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
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
head_group
xyqb-user2
Commits
30485d11
Commit
30485d11
authored
Apr 28, 2018
by
技术部-任文超
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
实现内部免密调用接口:包括:重置用户敏感信息,激活、禁用、重置密码、重置账号、重置身份证号、姓名
parent
1aa38b5d
Changes
8
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
276 additions
and
148 deletions
+276
-148
UserQueryLogController.java
.../controller/external/queryLog/UserQueryLogController.java
+2
-4
InnerController.java
...tgroup/xyqb/controller/external/user/InnerController.java
+212
-119
IUserDetailRepository.java
.../cn/quantgroup/xyqb/repository/IUserDetailRepository.java
+7
-0
IUserRepository.java
...n/java/cn/quantgroup/xyqb/repository/IUserRepository.java
+7
-0
IUserService.java
...in/java/cn/quantgroup/xyqb/service/user/IUserService.java
+11
-0
UserDetailServiceImpl.java
...ntgroup/xyqb/service/user/impl/UserDetailServiceImpl.java
+2
-2
UserServiceImpl.java
...cn/quantgroup/xyqb/service/user/impl/UserServiceImpl.java
+18
-6
IdcardValidator.java
src/main/java/cn/quantgroup/xyqb/util/IdcardValidator.java
+17
-17
No files found.
src/main/java/cn/quantgroup/xyqb/controller/external/queryLog/UserQueryLogController.java
View file @
30485d11
...
@@ -194,9 +194,8 @@ public class UserQueryLogController {
...
@@ -194,9 +194,8 @@ public class UserQueryLogController {
}
}
userDetailPage
=
userDetailService
.
getUserDetailsPage
(
null
,
queryV
,
null
,
pageId
,
pageSize
,
"auto"
);
userDetailPage
=
userDetailService
.
getUserDetailsPage
(
null
,
queryV
,
null
,
pageId
,
pageSize
,
"auto"
);
}
else
if
(
Objects
.
equals
(
key
,
"idNo"
)){
}
else
if
(
Objects
.
equals
(
key
,
"idNo"
)){
IdcardValidator
iv
=
new
IdcardValidator
();
for
(
String
idno:
queryV
){
for
(
String
idno:
queryV
){
if
(!
iv
.
is18Idcard
(
idno
)&&!
iv
.
is15Idcard
(
idno
)){
if
(!
IdcardValidator
.
is18Idcard
(
idno
)&&!
IdcardValidator
.
is15Idcard
(
idno
)){
return
JsonResult
.
buildErrorStateResult
(
"查询的身份证号"
+
idno
+
"格式有误"
,
null
);
return
JsonResult
.
buildErrorStateResult
(
"查询的身份证号"
+
idno
+
"格式有误"
,
null
);
}
}
}
}
...
@@ -405,9 +404,8 @@ public class UserQueryLogController {
...
@@ -405,9 +404,8 @@ public class UserQueryLogController {
userDetails
=
userDetailService
.
findByPhoneNos
(
queryV
);
userDetails
=
userDetailService
.
findByPhoneNos
(
queryV
);
}
else
if
(
Objects
.
equals
(
key
,
"idNo"
)){
}
else
if
(
Objects
.
equals
(
key
,
"idNo"
)){
IdcardValidator
iv
=
new
IdcardValidator
();
for
(
String
idno:
queryV
){
for
(
String
idno:
queryV
){
if
(!
iv
.
is18Idcard
(
idno
)&&!
iv
.
is15Idcard
(
idno
)){
if
(!
IdcardValidator
.
is18Idcard
(
idno
)&&!
IdcardValidator
.
is15Idcard
(
idno
)){
return
JsonResult
.
buildErrorStateResult
(
"查询的身份证号"
+
idno
+
"格式有误"
,
idno
);
return
JsonResult
.
buildErrorStateResult
(
"查询的身份证号"
+
idno
+
"格式有误"
,
idno
);
}
}
}
}
...
...
src/main/java/cn/quantgroup/xyqb/controller/external/user/InnerController.java
View file @
30485d11
This diff is collapsed.
Click to expand it.
src/main/java/cn/quantgroup/xyqb/repository/IUserDetailRepository.java
View file @
30485d11
...
@@ -10,6 +10,8 @@ import org.springframework.transaction.annotation.Transactional;
...
@@ -10,6 +10,8 @@ import org.springframework.transaction.annotation.Transactional;
import
java.util.List
;
import
java.util.List
;
import
static
org
.
springframework
.
transaction
.
annotation
.
Propagation
.
MANDATORY
;
/**
/**
* @author mengfan.feng
* @author mengfan.feng
* @time 2015-09-11 11:22
* @time 2015-09-11 11:22
...
@@ -54,4 +56,9 @@ public interface IUserDetailRepository extends JpaRepository<UserDetail, Long>,J
...
@@ -54,4 +56,9 @@ public interface IUserDetailRepository extends JpaRepository<UserDetail, Long>,J
@Modifying
@Modifying
@Query
(
value
=
"update user_detail set name=?1 where phone_no=?2"
,
nativeQuery
=
true
)
@Query
(
value
=
"update user_detail set name=?1 where phone_no=?2"
,
nativeQuery
=
true
)
int
updateNameByPhoneNo
(
String
name
,
String
phoneNo
);
int
updateNameByPhoneNo
(
String
name
,
String
phoneNo
);
@Transactional
(
propagation
=
MANDATORY
)
@Modifying
@Query
(
value
=
"update user_detail set phone_no=?2 where user_id=?1"
,
nativeQuery
=
true
)
int
resetPhoneNo
(
Long
userId
,
String
phoneNo
);
}
}
src/main/java/cn/quantgroup/xyqb/repository/IUserRepository.java
View file @
30485d11
...
@@ -9,6 +9,8 @@ import org.springframework.transaction.annotation.Transactional;
...
@@ -9,6 +9,8 @@ import org.springframework.transaction.annotation.Transactional;
import
java.util.List
;
import
java.util.List
;
import
static
org
.
springframework
.
transaction
.
annotation
.
Propagation
.
MANDATORY
;
/**
/**
* Created by Miraculous on 15/7/4.
* Created by Miraculous on 15/7/4.
*/
*/
...
@@ -30,4 +32,9 @@ public interface IUserRepository extends JpaRepository<User, Long>, JpaSpecifica
...
@@ -30,4 +32,9 @@ public interface IUserRepository extends JpaRepository<User, Long>, JpaSpecifica
@Query
(
value
=
"update user set enable=?1 where phone_no=?2"
,
nativeQuery
=
true
)
@Query
(
value
=
"update user set enable=?1 where phone_no=?2"
,
nativeQuery
=
true
)
int
forbiddenUser
(
Boolean
enable
,
String
phoneNo
);
int
forbiddenUser
(
Boolean
enable
,
String
phoneNo
);
@Transactional
(
propagation
=
MANDATORY
)
@Modifying
@Query
(
value
=
"update user set phone_no=?3 where id=?1 and phone_no=?2"
,
nativeQuery
=
true
)
int
resetAccount
(
Long
userId
,
String
account
,
String
phoneNo
);
}
}
src/main/java/cn/quantgroup/xyqb/service/user/IUserService.java
View file @
30485d11
...
@@ -18,6 +18,17 @@ public interface IUserService {
...
@@ -18,6 +18,17 @@ public interface IUserService {
boolean
resetPassword
(
String
phoneNo
,
String
password
);
boolean
resetPassword
(
String
phoneNo
,
String
password
);
/**
* 重置账号
* 注意:此操作会级联更新UserDetail的phoneNo
*
* @param userId - 用户主键
* @param account - 旧账号
* @param phoneNo - 新账号
* @return
*/
boolean
resetAccount
(
Long
userId
,
String
account
,
String
phoneNo
);
User
findByPhoneInDb
(
String
phone
);
User
findByPhoneInDb
(
String
phone
);
User
findByUuidInDb
(
String
uuid
);
User
findByUuidInDb
(
String
uuid
);
...
...
src/main/java/cn/quantgroup/xyqb/service/user/impl/UserDetailServiceImpl.java
View file @
30485d11
...
@@ -215,7 +215,7 @@ public class UserDetailServiceImpl implements IUserDetailService {
...
@@ -215,7 +215,7 @@ public class UserDetailServiceImpl implements IUserDetailService {
public
int
updateIdCard
(
String
name
,
String
idNo
,
String
phoneNo
)
{
public
int
updateIdCard
(
String
name
,
String
idNo
,
String
phoneNo
)
{
UserDetail
userDetail
=
userDetailRepository
.
findByPhoneNo
(
phoneNo
);
UserDetail
userDetail
=
userDetailRepository
.
findByPhoneNo
(
phoneNo
);
if
(
null
!=
userDetail
)
{
if
(
null
!=
userDetail
)
{
if
(
!
StringUtils
.
is
Blank
(
idNo
))
{
if
(
StringUtils
.
isNot
Blank
(
idNo
))
{
try
{
try
{
IdCardInfo
idCardInfo
=
idCardService
.
getIdCardInfo
(
idNo
);
IdCardInfo
idCardInfo
=
idCardService
.
getIdCardInfo
(
idNo
);
return
userDetailRepository
.
updateIdNoByPhoneNo
(
idCardInfo
.
getIdNo
(),
Optional
.
ofNullable
(
idCardInfo
.
getGender
()).
orElse
(
Gender
.
UNKNOWN
).
ordinal
(),
phoneNo
);
return
userDetailRepository
.
updateIdNoByPhoneNo
(
idCardInfo
.
getIdNo
(),
Optional
.
ofNullable
(
idCardInfo
.
getGender
()).
orElse
(
Gender
.
UNKNOWN
).
ordinal
(),
phoneNo
);
...
@@ -224,7 +224,7 @@ public class UserDetailServiceImpl implements IUserDetailService {
...
@@ -224,7 +224,7 @@ public class UserDetailServiceImpl implements IUserDetailService {
return
0
;
return
0
;
}
}
}
}
if
(
!
StringUtils
.
is
Blank
(
name
)
&&
ValidationUtil
.
validateChinese
(
name
))
{
if
(
StringUtils
.
isNot
Blank
(
name
)
&&
ValidationUtil
.
validateChinese
(
name
))
{
return
userDetailRepository
.
updateNameByPhoneNo
(
name
,
phoneNo
);
return
userDetailRepository
.
updateNameByPhoneNo
(
name
,
phoneNo
);
}
}
}
}
...
...
src/main/java/cn/quantgroup/xyqb/service/user/impl/UserServiceImpl.java
View file @
30485d11
...
@@ -2,15 +2,11 @@ package cn.quantgroup.xyqb.service.user.impl;
...
@@ -2,15 +2,11 @@ package cn.quantgroup.xyqb.service.user.impl;
import
cn.quantgroup.xyqb.Constants
;
import
cn.quantgroup.xyqb.Constants
;
import
cn.quantgroup.xyqb.entity.User
;
import
cn.quantgroup.xyqb.entity.User
;
import
cn.quantgroup.xyqb.repository.IAddressRepository
;
import
cn.quantgroup.xyqb.repository.*
;
import
cn.quantgroup.xyqb.repository.IContactRepository
;
import
cn.quantgroup.xyqb.repository.IUserBtRegisterRepository
;
import
cn.quantgroup.xyqb.repository.IUserRepository
;
import
cn.quantgroup.xyqb.service.auth.IIdCardService
;
import
cn.quantgroup.xyqb.service.auth.IIdCardService
;
import
cn.quantgroup.xyqb.service.sms.ISmsService
;
import
cn.quantgroup.xyqb.service.sms.ISmsService
;
import
cn.quantgroup.xyqb.service.user.ILkbUserService
;
import
cn.quantgroup.xyqb.service.user.ILkbUserService
;
import
cn.quantgroup.xyqb.service.user.IUserBtRegisterService
;
import
cn.quantgroup.xyqb.service.user.IUserBtRegisterService
;
import
cn.quantgroup.xyqb.service.user.IUserDetailService
;
import
cn.quantgroup.xyqb.service.user.IUserService
;
import
cn.quantgroup.xyqb.service.user.IUserService
;
import
cn.quantgroup.xyqb.util.PasswordUtil
;
import
cn.quantgroup.xyqb.util.PasswordUtil
;
import
com.google.common.collect.Maps
;
import
com.google.common.collect.Maps
;
...
@@ -21,6 +17,7 @@ import org.springframework.cache.annotation.CacheEvict;
...
@@ -21,6 +17,7 @@ import org.springframework.cache.annotation.CacheEvict;
import
org.springframework.cache.annotation.Cacheable
;
import
org.springframework.cache.annotation.Cacheable
;
import
org.springframework.data.redis.core.RedisTemplate
;
import
org.springframework.data.redis.core.RedisTemplate
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.util.CollectionUtils
;
import
org.springframework.util.CollectionUtils
;
import
java.sql.Timestamp
;
import
java.sql.Timestamp
;
...
@@ -64,7 +61,7 @@ public class UserServiceImpl implements IUserService {
...
@@ -64,7 +61,7 @@ public class UserServiceImpl implements IUserService {
private
IIdCardService
idCardService
;
private
IIdCardService
idCardService
;
@Autowired
@Autowired
private
IUserDetail
Service
userDetailRepository
;
private
IUserDetail
Repository
userDetailRepository
;
private
Long
BAITIAO_CHANNEL
=
222L
;
private
Long
BAITIAO_CHANNEL
=
222L
;
...
@@ -166,6 +163,21 @@ public class UserServiceImpl implements IUserService {
...
@@ -166,6 +163,21 @@ public class UserServiceImpl implements IUserService {
}
}
@Override
@Transactional
(
rollbackFor
=
Exception
.
class
)
@CacheEvict
(
value
=
"usercache"
,
key
=
"'xyqbuser' + #account"
,
cacheManager
=
"cacheManager"
)
public
boolean
resetAccount
(
Long
userId
,
String
account
,
String
phoneNo
){
int
rowUser
=
userRepository
.
resetAccount
(
userId
,
account
,
phoneNo
);
if
(
rowUser
!=
1
){
throw
new
RuntimeException
(
"重置账号失败!"
);
}
int
rowUserDetail
=
userDetailRepository
.
resetPhoneNo
(
userId
,
phoneNo
);
if
(
rowUserDetail
!=
1
){
throw
new
RuntimeException
(
"重置账号失败!"
);
}
return
true
;
}
@Override
@Override
public
List
<
User
>
findRegisterUserByTime
(
String
beginTime
,
String
endTime
)
{
public
List
<
User
>
findRegisterUserByTime
(
String
beginTime
,
String
endTime
)
{
return
userRepository
.
findRegisterUserByTime
(
beginTime
,
endTime
);
return
userRepository
.
findRegisterUserByTime
(
beginTime
,
endTime
);
...
...
src/main/java/cn/quantgroup/xyqb/util/IdcardValidator.java
View file @
30485d11
...
@@ -49,7 +49,7 @@ public class IdcardValidator {
...
@@ -49,7 +49,7 @@ public class IdcardValidator {
* 51:"四川",52:"贵州",53:"云南",54:"西藏",61:"陕西",62:"甘肃",
* 51:"四川",52:"贵州",53:"云南",54:"西藏",61:"陕西",62:"甘肃",
* 63:"青海",64:"宁夏",65:"新疆",71:"台湾",81:"香港",82:"澳门",91:"国外"}
* 63:"青海",64:"宁夏",65:"新疆",71:"台湾",81:"香港",82:"澳门",91:"国外"}
*/
*/
protected
String
codeAndCity
[][]
=
{
{
"11"
,
"北京"
},
{
"12"
,
"天津"
},
protected
final
static
String
codeAndCity
[][]
=
{
{
"11"
,
"北京"
},
{
"12"
,
"天津"
},
{
"13"
,
"河北"
},
{
"14"
,
"山西"
},
{
"15"
,
"内蒙古"
},
{
"21"
,
"辽宁"
},
{
"13"
,
"河北"
},
{
"14"
,
"山西"
},
{
"15"
,
"内蒙古"
},
{
"21"
,
"辽宁"
},
{
"22"
,
"吉林"
},
{
"23"
,
"黑龙江"
},
{
"31"
,
"上海"
},
{
"32"
,
"江苏"
},
{
"22"
,
"吉林"
},
{
"23"
,
"黑龙江"
},
{
"31"
,
"上海"
},
{
"32"
,
"江苏"
},
{
"33"
,
"浙江"
},
{
"34"
,
"安徽"
},
{
"35"
,
"福建"
},
{
"36"
,
"江西"
},
{
"33"
,
"浙江"
},
{
"34"
,
"安徽"
},
{
"35"
,
"福建"
},
{
"36"
,
"江西"
},
...
@@ -60,16 +60,16 @@ public class IdcardValidator {
...
@@ -60,16 +60,16 @@ public class IdcardValidator {
{
"65"
,
"新疆"
},
{
"71"
,
"台湾"
},
{
"81"
,
"香港"
},
{
"82"
,
"澳门"
},
{
"65"
,
"新疆"
},
{
"71"
,
"台湾"
},
{
"81"
,
"香港"
},
{
"82"
,
"澳门"
},
{
"91"
,
"国外"
}
};
{
"91"
,
"国外"
}
};
private
String
cityCode
[]
=
{
"11"
,
"12"
,
"13"
,
"14"
,
"15"
,
"21"
,
"22"
,
private
final
static
String
cityCode
[]
=
{
"11"
,
"12"
,
"13"
,
"14"
,
"15"
,
"21"
,
"22"
,
"23"
,
"31"
,
"32"
,
"33"
,
"34"
,
"35"
,
"36"
,
"37"
,
"41"
,
"42"
,
"43"
,
"23"
,
"31"
,
"32"
,
"33"
,
"34"
,
"35"
,
"36"
,
"37"
,
"41"
,
"42"
,
"43"
,
"44"
,
"45"
,
"46"
,
"50"
,
"51"
,
"52"
,
"53"
,
"54"
,
"61"
,
"62"
,
"63"
,
"44"
,
"45"
,
"46"
,
"50"
,
"51"
,
"52"
,
"53"
,
"54"
,
"61"
,
"62"
,
"63"
,
"64"
,
"65"
,
"71"
,
"81"
,
"82"
,
"91"
};
"64"
,
"65"
,
"71"
,
"81"
,
"82"
,
"91"
};
// 每位加权因子
// 每位加权因子
private
int
power
[]
=
{
7
,
9
,
10
,
5
,
8
,
4
,
2
,
1
,
6
,
3
,
7
,
9
,
10
,
5
,
8
,
4
,
2
};
private
final
static
int
power
[]
=
{
7
,
9
,
10
,
5
,
8
,
4
,
2
,
1
,
6
,
3
,
7
,
9
,
10
,
5
,
8
,
4
,
2
};
// 第18位校检码
// 第18位校检码
private
String
verifyCode
[]
=
{
"1"
,
"0"
,
"X"
,
"9"
,
"8"
,
"7"
,
"6"
,
"5"
,
private
final
static
String
verifyCode
[]
=
{
"1"
,
"0"
,
"X"
,
"9"
,
"8"
,
"7"
,
"6"
,
"5"
,
"4"
,
"3"
,
"2"
};
"4"
,
"3"
,
"2"
};
/**
/**
...
@@ -78,11 +78,11 @@ public class IdcardValidator {
...
@@ -78,11 +78,11 @@ public class IdcardValidator {
* @param idcard
* @param idcard
* @return
* @return
*/
*/
public
boolean
isValidatedAllIdcard
(
String
idcard
)
{
public
final
static
boolean
isValidatedAllIdcard
(
String
idcard
)
{
if
(
idcard
.
length
()
==
15
)
{
if
(
idcard
.
length
()
==
15
)
{
idcard
=
this
.
convertIdcarBy15bit
(
idcard
);
idcard
=
convertIdcarBy15bit
(
idcard
);
}
}
return
this
.
isValidate18Idcard
(
idcard
);
return
isValidate18Idcard
(
idcard
);
}
}
/**
/**
...
@@ -119,7 +119,7 @@ public class IdcardValidator {
...
@@ -119,7 +119,7 @@ public class IdcardValidator {
* @param idcard
* @param idcard
* @return
* @return
*/
*/
public
boolean
isValidate18Idcard
(
String
idcard
)
{
public
final
static
boolean
isValidate18Idcard
(
String
idcard
)
{
// 非18位为假
// 非18位为假
if
(
idcard
.
length
()
!=
18
)
{
if
(
idcard
.
length
()
!=
18
)
{
return
false
;
return
false
;
...
@@ -165,7 +165,7 @@ public class IdcardValidator {
...
@@ -165,7 +165,7 @@ public class IdcardValidator {
* @param idcard
* @param idcard
* @return
* @return
*/
*/
public
boolean
isValidate15Idcard
(
String
idcard
)
{
public
final
static
boolean
isValidate15Idcard
(
String
idcard
)
{
// 非15位为假
// 非15位为假
if
(
idcard
.
length
()
!=
15
)
{
if
(
idcard
.
length
()
!=
15
)
{
return
false
;
return
false
;
...
@@ -259,7 +259,7 @@ public class IdcardValidator {
...
@@ -259,7 +259,7 @@ public class IdcardValidator {
* @param idcard
* @param idcard
* @return
* @return
*/
*/
public
String
convertIdcarBy15bit
(
String
idcard
)
{
public
final
static
String
convertIdcarBy15bit
(
String
idcard
)
{
String
idcard17
=
null
;
String
idcard17
=
null
;
// 非15位身份证
// 非15位身份证
if
(
idcard
.
length
()
!=
15
)
{
if
(
idcard
.
length
()
!=
15
)
{
...
@@ -314,7 +314,7 @@ public class IdcardValidator {
...
@@ -314,7 +314,7 @@ public class IdcardValidator {
* @param idcard
* @param idcard
* @return
* @return
*/
*/
public
boolean
isIdcard
(
String
idcard
)
{
public
final
static
boolean
isIdcard
(
String
idcard
)
{
return
idcard
==
null
||
""
.
equals
(
idcard
)
?
false
:
Pattern
.
matches
(
return
idcard
==
null
||
""
.
equals
(
idcard
)
?
false
:
Pattern
.
matches
(
"(^\\d{15}$)|(\\d{17}(?:\\d|x|X)$)"
,
idcard
);
"(^\\d{15}$)|(\\d{17}(?:\\d|x|X)$)"
,
idcard
);
}
}
...
@@ -325,7 +325,7 @@ public class IdcardValidator {
...
@@ -325,7 +325,7 @@ public class IdcardValidator {
* @param idcard
* @param idcard
* @return
* @return
*/
*/
public
boolean
is15Idcard
(
String
idcard
)
{
public
final
static
boolean
is15Idcard
(
String
idcard
)
{
return
idcard
==
null
||
""
.
equals
(
idcard
)
?
false
:
Pattern
.
matches
(
return
idcard
==
null
||
""
.
equals
(
idcard
)
?
false
:
Pattern
.
matches
(
"^[1-9]\\d{7}((0\\d)|(1[0-2]))(([0|1|2]\\d)|3[0-1])\\d{3}$"
,
"^[1-9]\\d{7}((0\\d)|(1[0-2]))(([0|1|2]\\d)|3[0-1])\\d{3}$"
,
idcard
);
idcard
);
...
@@ -337,7 +337,7 @@ public class IdcardValidator {
...
@@ -337,7 +337,7 @@ public class IdcardValidator {
* @param idcard
* @param idcard
* @return
* @return
*/
*/
public
boolean
is18Idcard
(
String
idcard
)
{
public
final
static
boolean
is18Idcard
(
String
idcard
)
{
return
Pattern
return
Pattern
.
matches
(
.
matches
(
"^[1-9]\\d{5}[1-9]\\d{3}((0\\d)|(1[0-2]))(([0|1|2]\\d)|3[0-1])\\d{3}([\\d|x|X]{1})$"
,
"^[1-9]\\d{5}[1-9]\\d{3}((0\\d)|(1[0-2]))(([0|1|2]\\d)|3[0-1])\\d{3}([\\d|x|X]{1})$"
,
...
@@ -350,7 +350,7 @@ public class IdcardValidator {
...
@@ -350,7 +350,7 @@ public class IdcardValidator {
* @param str
* @param str
* @return
* @return
*/
*/
public
boolean
isDigital
(
String
str
)
{
public
final
static
boolean
isDigital
(
String
str
)
{
return
str
==
null
||
""
.
equals
(
str
)
?
false
:
str
.
matches
(
"^[0-9]*$"
);
return
str
==
null
||
""
.
equals
(
str
)
?
false
:
str
.
matches
(
"^[0-9]*$"
);
}
}
...
@@ -360,7 +360,7 @@ public class IdcardValidator {
...
@@ -360,7 +360,7 @@ public class IdcardValidator {
* @param bit
* @param bit
* @return
* @return
*/
*/
public
int
getPowerSum
(
int
[]
bit
)
{
public
final
static
int
getPowerSum
(
int
[]
bit
)
{
int
sum
=
0
;
int
sum
=
0
;
...
@@ -385,7 +385,7 @@ public class IdcardValidator {
...
@@ -385,7 +385,7 @@ public class IdcardValidator {
* @param sum17
* @param sum17
* @return 校验位
* @return 校验位
*/
*/
public
String
getCheckCodeBySum
(
int
sum17
)
{
public
final
static
String
getCheckCodeBySum
(
int
sum17
)
{
String
checkCode
=
null
;
String
checkCode
=
null
;
switch
(
sum17
%
11
)
{
switch
(
sum17
%
11
)
{
case
10
:
case
10
:
...
@@ -432,7 +432,7 @@ public class IdcardValidator {
...
@@ -432,7 +432,7 @@ public class IdcardValidator {
* @return
* @return
* @throws NumberFormatException
* @throws NumberFormatException
*/
*/
public
int
[]
converCharToInt
(
char
[]
c
)
throws
NumberFormatException
{
public
final
static
int
[]
converCharToInt
(
char
[]
c
)
throws
NumberFormatException
{
int
[]
a
=
new
int
[
c
.
length
];
int
[]
a
=
new
int
[
c
.
length
];
int
k
=
0
;
int
k
=
0
;
for
(
char
temp
:
c
)
{
for
(
char
temp
:
c
)
{
...
...
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