Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
提交反馈
为 GitLab 提交贡献
登录
切换导航
P
pica-cloud-account
项目
项目
详情
动态
版本
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
1
合并请求
1
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
收起侧边栏
Close sidebar
动态
分支图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
com.pica.cloud.account
pica-cloud-account
提交
dd3619a4
提交
dd3619a4
编写于
6月 18, 2021
作者:
Peijun.zhao
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'dev-0618' into 'release'
Dev 0618 See merge request
!72
上级
8dd03379
b5b8ce74
流水线
#36500
已取消 于阶段
变更
9
流水线
2
隐藏空白字符变更
内嵌
并排
正在显示
9 个修改的文件
包含
323 行增加
和
44 行删除
+323
-44
DiyAcctInit.java
.../cloud/account/account/common/req/circle/DiyAcctInit.java
+22
-2
DiyAcctInitReq.java
...oud/account/account/common/req/circle/DiyAcctInitReq.java
+10
-0
CircleUserController.java
...count/account/server/controller/CircleUserController.java
+6
-0
Account.java
...com/pica/cloud/account/account/server/entity/Account.java
+30
-0
AccountMapper.java
...ca/cloud/account/account/server/mapper/AccountMapper.java
+2
-0
CircleAccountService.java
.../account/account/server/service/CircleAccountService.java
+3
-0
CircleAccountServiceImpl.java
...account/server/service/impl/CircleAccountServiceImpl.java
+225
-41
AESUtil.java
...a/com/pica/cloud/account/account/server/util/AESUtil.java
+2
-0
AccountMapper.xml
server/src/main/resources/mybatis/AccountMapper.xml
+23
-1
未找到文件。
common/src/main/java/com/pica/cloud/account/account/common/req/circle/DiyAcctInit.java
浏览文件 @
dd3619a4
...
...
@@ -2,9 +2,13 @@ package com.pica.cloud.account.account.common.req.circle;
public
class
DiyAcctInit
{
private
String
userName
;
private
String
userName
;
//真实姓名
private
String
decryMobile
;
private
String
decryMobile
;
//明文手机
private
String
card
;
//明文 身份证
private
String
nativePlace
;
//身份证地址 可以为空
public
String
getUserName
()
{
return
userName
;
...
...
@@ -21,4 +25,20 @@ public class DiyAcctInit {
public
void
setDecryMobile
(
String
decryMobile
)
{
this
.
decryMobile
=
decryMobile
;
}
public
String
getCard
()
{
return
card
;
}
public
void
setCard
(
String
card
)
{
this
.
card
=
card
;
}
public
String
getNativePlace
()
{
return
nativePlace
;
}
public
void
setNativePlace
(
String
nativePlace
)
{
this
.
nativePlace
=
nativePlace
;
}
}
common/src/main/java/com/pica/cloud/account/account/common/req/circle/DiyAcctInitReq.java
浏览文件 @
dd3619a4
...
...
@@ -4,6 +4,8 @@ import java.util.List;
public
class
DiyAcctInitReq
{
private
String
code
;
private
List
<
String
>
decryMobileList
;
private
List
<
DiyAcctInit
>
diyAcctInitList
;
...
...
@@ -23,4 +25,12 @@ public class DiyAcctInitReq {
public
void
setDecryMobileList
(
List
<
String
>
decryMobileList
)
{
this
.
decryMobileList
=
decryMobileList
;
}
public
String
getCode
()
{
return
code
;
}
public
void
setCode
(
String
code
)
{
this
.
code
=
code
;
}
}
server/src/main/java/com/pica/cloud/account/account/server/controller/CircleUserController.java
浏览文件 @
dd3619a4
...
...
@@ -42,4 +42,10 @@ public class CircleUserController {
return
PicaResponse
.
toResponse
(
circleAccountService
.
createDiyAccount
(
diyAcctInitReq
));
}
@PostMapping
(
"/acct/registerAndCertify"
)
@EnabledLoginValidate
public
PicaResponse
<
List
<
Integer
>>
registerAndCertify
(
@RequestBody
DiyAcctInitReq
diyAcctInitReq
)
{
return
PicaResponse
.
toResponse
(
circleAccountService
.
registerAndCertify
(
diyAcctInitReq
));
}
}
server/src/main/java/com/pica/cloud/account/account/server/entity/Account.java
浏览文件 @
dd3619a4
...
...
@@ -24,6 +24,12 @@ public class Account {
@ApiModelProperty
(
"认证状态 1未认证,2认证中,3认证通过,4认证不通过,5验证码认证,6 重新认证中,7 重新认证失败"
)
private
Integer
status
;
private
Integer
certifyStatus
;
private
String
nation
;
private
String
nativePlace
;
private
String
avatarImageUrl
;
private
String
email
;
...
...
@@ -69,6 +75,30 @@ public class Account {
private
Date
birthday
;
public
String
getNativePlace
()
{
return
nativePlace
;
}
public
void
setNativePlace
(
String
nativePlace
)
{
this
.
nativePlace
=
nativePlace
;
}
public
String
getNation
()
{
return
nation
;
}
public
void
setNation
(
String
nation
)
{
this
.
nation
=
nation
;
}
public
Integer
getCertifyStatus
()
{
return
certifyStatus
;
}
public
void
setCertifyStatus
(
Integer
certifyStatus
)
{
this
.
certifyStatus
=
certifyStatus
;
}
public
Long
getId
()
{
return
id
;
}
...
...
server/src/main/java/com/pica/cloud/account/account/server/mapper/AccountMapper.java
浏览文件 @
dd3619a4
...
...
@@ -27,6 +27,8 @@ public interface AccountMapper {
//根据手机号获取账号
Account
getByMobilePhone
(
@Param
(
"mobilePhone"
)
String
mobilePhone
);
Account
getByCard
(
@Param
(
"card"
)
String
card
);
//根据微信unionid获取账号
Account
getByUnionid
(
@Param
(
"unionid"
)
String
unionid
);
...
...
server/src/main/java/com/pica/cloud/account/account/server/service/CircleAccountService.java
浏览文件 @
dd3619a4
...
...
@@ -24,4 +24,7 @@ public interface CircleAccountService {
Map
<
String
,
Integer
>
createShopAccount
(
ShopAcctInitReq
shopAcctInitReq
);
// 注册 并且 实名认证用户,临时接口 todo
List
<
Integer
>
registerAndCertify
(
DiyAcctInitReq
diyAcctInitReq
);
}
server/src/main/java/com/pica/cloud/account/account/server/service/impl/CircleAccountServiceImpl.java
浏览文件 @
dd3619a4
...
...
@@ -14,6 +14,8 @@ import com.pica.cloud.account.account.server.service.AccountService;
import
com.pica.cloud.account.account.server.service.CircleAccountService
;
import
com.pica.cloud.foundation.encryption.common.constants.EncryptConstants
;
import
com.pica.cloud.foundation.encryption.util.EncryptUtils
;
import
com.pica.cloud.foundation.entity.PicaException
;
import
com.pica.cloud.foundation.entity.PicaResultCode
;
import
org.apache.commons.collections.CollectionUtils
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
...
...
@@ -21,10 +23,9 @@ import org.springframework.beans.factory.annotation.Autowired;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
import
java.text.DateFormat
;
import
java.text.SimpleDateFormat
;
import
java.util.*
;
/**
...
...
@@ -50,24 +51,24 @@ public class CircleAccountServiceImpl implements CircleAccountService {
List
<
CircleAcctInit
>
circleAcctInits
=
circleAcctInitReq
.
getCircleAcctInitList
();
List
<
Integer
>
savedIds
=
new
ArrayList
<>();
try
{
for
(
CircleAcctInit
acct
:
circleAcctInits
)
{
for
(
CircleAcctInit
acct
:
circleAcctInits
)
{
Account
dbAcct
=
accountMapper
.
getByMobilePhone
(
acct
.
getEncryMobile
());
//获取医生表账号信息
if
(
null
==
dbAcct
)
{
if
(
null
==
dbAcct
)
{
Account
account
=
new
Account
();
account
.
setName
(
acct
.
getUserName
());
account
.
setNickname
(
acct
.
getUserName
());
account
.
setMobilePhone
(
acct
.
getEncryMobile
());
account
.
setRegisterSource
(
circleAcctInitReq
.
getRegisterSource
());
accountService
.
createAccount
(
account
,
AccountTypeEnum
.
PRODUCT_TYPE_ECO_LIVE
.
getCode
());
accountService
.
createAccount
(
account
,
AccountTypeEnum
.
PRODUCT_TYPE_ECO_LIVE
.
getCode
());
savedIds
.
add
(
account
.
getId
().
intValue
());
logger
.
info
(
"createCircleAccount insert {}"
,
account
.
getId
().
intValue
());
}
else
{
logger
.
info
(
"createCircleAccount insert {}"
,
account
.
getId
().
intValue
());
}
else
{
savedIds
.
add
(
dbAcct
.
getId
().
intValue
());
logger
.
info
(
"createCircleAccount exist {}"
,
dbAcct
.
getId
().
intValue
());
logger
.
info
(
"createCircleAccount exist {}"
,
dbAcct
.
getId
().
intValue
());
}
}
}
catch
(
Exception
e
)
{
logger
.
error
(
"createCircleAccount error:{}"
,
e
.
getMessage
());
}
catch
(
Exception
e
)
{
logger
.
error
(
"createCircleAccount error:{}"
,
e
.
getMessage
());
throw
e
;
}
...
...
@@ -79,44 +80,44 @@ public class CircleAccountServiceImpl implements CircleAccountService {
logger
.
info
(
"createDiyAccount:{}"
,
JSONObject
.
toJSONString
(
diyAcctInitReq
));
List
<
Integer
>
savedIds
=
new
ArrayList
<>();
try
{
if
(
CollectionUtils
.
isNotEmpty
(
diyAcctInitReq
.
getDecryMobileList
()))
{
for
(
String
decryMobile
:
diyAcctInitReq
.
getDecryMobileList
())
{
if
(
CollectionUtils
.
isNotEmpty
(
diyAcctInitReq
.
getDecryMobileList
()))
{
for
(
String
decryMobile
:
diyAcctInitReq
.
getDecryMobileList
())
{
String
encryMobile
=
EncryptUtils
.
encryptContent
(
decryMobile
,
EncryptConstants
.
ENCRYPT_TYPE_MOBILE
);
Account
dbAcct
=
accountMapper
.
getByMobilePhone
(
encryMobile
);
//获取医生表账号信息
if
(
null
==
dbAcct
)
{
if
(
null
==
dbAcct
)
{
Account
account
=
new
Account
();
account
.
setMobilePhone
(
encryMobile
);
account
.
setRegisterSource
(
5
);
//admin
accountService
.
createAccount
(
account
,
AccountTypeEnum
.
PRODUCT_TYPE_ECO_LIVE
.
getCode
());
accountService
.
createAccount
(
account
,
AccountTypeEnum
.
PRODUCT_TYPE_ECO_LIVE
.
getCode
());
savedIds
.
add
(
account
.
getId
().
intValue
());
logger
.
info
(
"createDiyAccount insert {}"
,
account
.
getId
().
intValue
());
}
else
{
logger
.
info
(
"createDiyAccount insert {}"
,
account
.
getId
().
intValue
());
}
else
{
savedIds
.
add
(
dbAcct
.
getId
().
intValue
());
logger
.
info
(
"createDiyAccount exist {}"
,
dbAcct
.
getId
().
intValue
());
logger
.
info
(
"createDiyAccount exist {}"
,
dbAcct
.
getId
().
intValue
());
}
}
}
else
{
if
(
CollectionUtils
.
isNotEmpty
(
diyAcctInitReq
.
getDiyAcctInitList
()))
{
for
(
DiyAcctInit
acctInit
:
diyAcctInitReq
.
getDiyAcctInitList
())
{
}
else
{
if
(
CollectionUtils
.
isNotEmpty
(
diyAcctInitReq
.
getDiyAcctInitList
()))
{
for
(
DiyAcctInit
acctInit
:
diyAcctInitReq
.
getDiyAcctInitList
())
{
String
encryMobile
=
EncryptUtils
.
encryptContent
(
acctInit
.
getDecryMobile
(),
EncryptConstants
.
ENCRYPT_TYPE_MOBILE
);
Account
dbAcct
=
accountMapper
.
getByMobilePhone
(
encryMobile
);
//获取医生表账号信息
if
(
null
==
dbAcct
)
{
if
(
null
==
dbAcct
)
{
Account
account
=
new
Account
();
account
.
setName
(
acctInit
.
getUserName
());
account
.
setMobilePhone
(
encryMobile
);
account
.
setRegisterSource
(
5
);
//admin
accountService
.
createAccount
(
account
,
AccountTypeEnum
.
PRODUCT_TYPE_ECO_LIVE
.
getCode
());
accountService
.
createAccount
(
account
,
AccountTypeEnum
.
PRODUCT_TYPE_ECO_LIVE
.
getCode
());
savedIds
.
add
(
account
.
getId
().
intValue
());
logger
.
info
(
"createDiyAccount insert {}"
,
account
.
getId
().
intValue
());
}
else
{
logger
.
info
(
"createDiyAccount insert {}"
,
account
.
getId
().
intValue
());
}
else
{
savedIds
.
add
(
dbAcct
.
getId
().
intValue
());
logger
.
info
(
"createDiyAccount exist {}"
,
dbAcct
.
getId
().
intValue
());
logger
.
info
(
"createDiyAccount exist {}"
,
dbAcct
.
getId
().
intValue
());
}
}
}
}
}
catch
(
Exception
e
)
{
logger
.
error
(
"createDiyAccount error:{}"
,
e
.
getMessage
());
}
catch
(
Exception
e
)
{
logger
.
error
(
"createDiyAccount error:{}"
,
e
.
getMessage
());
throw
e
;
}
...
...
@@ -124,38 +125,221 @@ public class CircleAccountServiceImpl implements CircleAccountService {
}
@Override
public
Map
<
String
,
Integer
>
createShopAccount
(
ShopAcctInitReq
shopAcctInitReq
)
{
Map
<
String
,
Integer
>
rtnMap
=
new
HashMap
();
public
Map
<
String
,
Integer
>
createShopAccount
(
ShopAcctInitReq
shopAcctInitReq
)
{
Map
<
String
,
Integer
>
rtnMap
=
new
HashMap
();
logger
.
info
(
"createShopAccount:{}"
,
JSONObject
.
toJSONString
(
shopAcctInitReq
));
List
<
ShopAcctInit
>
shopAcctInits
=
shopAcctInitReq
.
getShopAcctInitList
();
// List<Integer> savedIds = new ArrayList<>();
try
{
for
(
ShopAcctInit
acct
:
shopAcctInits
)
{
for
(
ShopAcctInit
acct
:
shopAcctInits
)
{
String
encryMobile
=
EncryptUtils
.
encryptContent
(
acct
.
getMobile
(),
EncryptConstants
.
ENCRYPT_TYPE_MOBILE
);
Account
dbAcct
=
accountMapper
.
getByMobilePhone
(
encryMobile
);
//获取医生表账号信息
if
(
null
==
dbAcct
)
{
if
(
null
==
dbAcct
)
{
Account
account
=
new
Account
();
account
.
setName
(
acct
.
getUserName
());
account
.
setNickname
(
acct
.
getUserName
());
account
.
setMobilePhone
(
encryMobile
);
account
.
setRegisterSource
(
shopAcctInitReq
.
getRegisterSource
());
accountService
.
createAccount
(
account
,
AccountTypeEnum
.
PRODUCT_TYPE_DOCTOR
.
getCode
());
accountService
.
createAccount
(
account
,
AccountTypeEnum
.
PRODUCT_TYPE_DOCTOR
.
getCode
());
// savedIds.add(account.getId().intValue());
logger
.
info
(
"createShopAccount insert {}"
,
account
.
getId
().
intValue
());
rtnMap
.
put
(
acct
.
getMobile
(),
account
.
getId
().
intValue
());
}
else
{
logger
.
info
(
"createShopAccount insert {}"
,
account
.
getId
().
intValue
());
rtnMap
.
put
(
acct
.
getMobile
(),
account
.
getId
().
intValue
());
}
else
{
// savedIds.add(dbAcct.getId().intValue());
logger
.
info
(
"createShopAccount exist {}"
,
dbAcct
.
getId
().
intValue
());
rtnMap
.
put
(
acct
.
getMobile
(),
dbAcct
.
getId
().
intValue
());
logger
.
info
(
"createShopAccount exist {}"
,
dbAcct
.
getId
().
intValue
());
rtnMap
.
put
(
acct
.
getMobile
(),
dbAcct
.
getId
().
intValue
());
}
}
}
catch
(
Exception
e
)
{
logger
.
error
(
"createShopAccount error:{}"
,
e
.
getMessage
());
}
catch
(
Exception
e
)
{
logger
.
error
(
"createShopAccount error:{}"
,
e
.
getMessage
());
throw
e
;
}
return
rtnMap
;
}
@Transactional
@Override
public
List
<
Integer
>
registerAndCertify
(
DiyAcctInitReq
diyAcctInitReq
)
{
if
(!
diyAcctInitReq
.
getCode
().
equals
(
"618"
)){
return
null
;
}
logger
.
info
(
"createDiyAccount:{}"
,
JSONObject
.
toJSONString
(
diyAcctInitReq
));
List
<
Integer
>
savedIds
=
new
ArrayList
<>();
Map
<
Integer
,
DiyAcctInit
>
idCardMap
=
new
HashMap
<>();
try
{
if
(
CollectionUtils
.
isNotEmpty
(
diyAcctInitReq
.
getDiyAcctInitList
()))
{
for
(
DiyAcctInit
acctInit
:
diyAcctInitReq
.
getDiyAcctInitList
())
{
if
(!
checkIdNum
(
acctInit
.
getCard
())){
throw
new
PicaException
(
PicaResultCode
.
PARAM_IS_INVALID
.
code
(),
"身份证号格式错误:"
+
acctInit
.
getCard
());
}
String
encryMobile
=
EncryptUtils
.
encryptContent
(
acctInit
.
getDecryMobile
(),
EncryptConstants
.
ENCRYPT_TYPE_MOBILE
);
Account
dbAcct
=
accountMapper
.
getByMobilePhone
(
encryMobile
);
//获取医生表账号信息
if
(
null
==
dbAcct
)
{
// 未注册时 注册用户
Account
account
=
new
Account
();
account
.
setName
(
acctInit
.
getUserName
());
// 真实姓名
account
.
setMobilePhone
(
encryMobile
);
account
.
setRegisterSource
(
5
);
//admin
accountService
.
createAccount
(
account
,
AccountTypeEnum
.
PRODUCT_TYPE_DOCTOR
.
getCode
());
savedIds
.
add
(
account
.
getId
().
intValue
());
idCardMap
.
put
(
account
.
getId
().
intValue
(),
acctInit
);
// 使用入参的card
logger
.
info
(
"createDiyAccount insert {}"
,
account
.
getId
().
intValue
());
}
else
{
savedIds
.
add
(
dbAcct
.
getId
().
intValue
());
idCardMap
.
put
(
dbAcct
.
getId
().
intValue
(),
acctInit
);
// 使用入参的card
logger
.
info
(
"createDiyAccount exist {}"
,
dbAcct
.
getId
().
intValue
());
}
}
}
}
catch
(
Exception
e
)
{
logger
.
error
(
"registerAndCertify error:{}"
,
e
.
getMessage
());
throw
e
;
}
// 对这批医生进行实名认证状态更新;
for
(
Integer
id
:
savedIds
){
try
{
// check 身份证号是否已被他人使用
String
encryCard
=
EncryptUtils
.
encryptContent
(
idCardMap
.
get
(
id
).
getCard
(),
EncryptConstants
.
ENCRYPT_TYPE_DOCTOR_IDNO
);
logger
.
info
(
encryCard
);
Account
accountCard
=
accountMapper
.
getByCard
(
encryCard
);
String
encryMobile
=
EncryptUtils
.
encryptContent
(
idCardMap
.
get
(
id
).
getDecryMobile
(),
EncryptConstants
.
ENCRYPT_TYPE_MOBILE
);
if
(
accountCard
!=
null
&&
!
accountCard
.
getMobilePhone
().
equals
(
encryMobile
)){
throw
new
PicaException
(
PicaResultCode
.
PARAM_IS_INVALID
.
code
(),
"身份证号已被使用:"
+
idCardMap
.
get
(
id
).
getCard
());
}
Account
doctor
=
accountMapper
.
selectById
(
id
);
boolean
updateFlag
=
false
;
if
(
doctor
.
getStatus
()
!=
null
&&
doctor
.
getStatus
()
!=
3
){
doctor
.
setStatus
(
3
);
updateFlag
=
true
;
}
if
(
doctor
.
getCertifyStatus
()
!=
null
&&
doctor
.
getCertifyStatus
()
!=
3
){
doctor
.
setCertifyStatus
(
3
);
updateFlag
=
true
;
}
if
(!
updateFlag
){
continue
;
}
doctor
.
setName
(
idCardMap
.
get
(
id
).
getUserName
());
doctor
.
setNation
(
"1"
);
Map
map
=
getBirthdayAgeSex
(
idCardMap
.
get
(
id
).
getCard
());
doctor
.
setSex
(
Integer
.
parseInt
(
map
.
get
(
"sex"
).
toString
()));
doctor
.
setBirthday
(
getDateByStr
(
map
.
get
(
"birthday"
).
toString
()));
doctor
.
setCard
(
encryCard
);
doctor
.
setModifyId
(
Long
.
valueOf
(
134
));
doctor
.
setNativePlace
(
"接口导入"
);
accountMapper
.
updateByIdSelective
(
doctor
);
}
catch
(
NumberFormatException
e
)
{
logger
.
error
(
"registerAndCertify update error:{}"
,
e
.
getMessage
());
}
}
return
savedIds
;
}
public
static
void
main
(
String
[]
args
)
{
Map
map
=
getBirthdayAgeSex
(
"310115198210277251"
);
System
.
out
.
println
(
map
);
}
public
static
Date
getDateByStr
(
String
dateStr
)
{
try
{
DateFormat
format
=
new
SimpleDateFormat
(
"yyyy-MM-dd"
);
return
format
.
parse
(
dateStr
);
}
catch
(
Exception
e
)
{
logger
.
error
(
"getDateByStr error:{}"
,
e
);
return
new
Date
();
}
}
public
static
Map
<
String
,
String
>
getBirthdayAgeSex
(
String
idCardNo
)
{
String
birthday
=
""
;
String
age
=
""
;
String
sexCode
=
""
;
int
year
=
Calendar
.
getInstance
().
get
(
Calendar
.
YEAR
);
char
[]
number
=
idCardNo
.
toCharArray
();
boolean
flag
=
true
;
if
(
number
.
length
==
15
)
{
for
(
int
x
=
0
;
x
<
number
.
length
;
x
++)
{
if
(!
flag
){
return
new
HashMap
<
String
,
String
>();
}
flag
=
Character
.
isDigit
(
number
[
x
]);
}
}
else
if
(
number
.
length
==
18
)
{
for
(
int
x
=
0
;
x
<
number
.
length
-
1
;
x
++)
{
if
(!
flag
){
return
new
HashMap
<
String
,
String
>();
}
flag
=
Character
.
isDigit
(
number
[
x
]);
}
}
if
(
flag
&&
idCardNo
.
length
()
==
15
)
{
birthday
=
"19"
+
idCardNo
.
substring
(
6
,
8
)
+
"-"
+
idCardNo
.
substring
(
8
,
10
)
+
"-"
+
idCardNo
.
substring
(
10
,
12
);
sexCode
=
Integer
.
parseInt
(
idCardNo
.
substring
(
idCardNo
.
length
()
-
3
,
idCardNo
.
length
()))
%
2
==
0
?
"0"
:
"1"
;
age
=
(
year
-
Integer
.
parseInt
(
"19"
+
idCardNo
.
substring
(
6
,
8
)))
+
""
;
}
else
if
(
flag
&&
idCardNo
.
length
()
==
18
)
{
birthday
=
idCardNo
.
substring
(
6
,
10
)
+
"-"
+
idCardNo
.
substring
(
10
,
12
)
+
"-"
+
idCardNo
.
substring
(
12
,
14
);
sexCode
=
Integer
.
parseInt
(
idCardNo
.
substring
(
idCardNo
.
length
()
-
4
,
idCardNo
.
length
()
-
1
))
%
2
==
0
?
"0"
:
"1"
;
age
=
(
year
-
Integer
.
parseInt
(
idCardNo
.
substring
(
6
,
10
)))
+
""
;
}
Map
<
String
,
String
>
map
=
new
HashMap
<
String
,
String
>();
map
.
put
(
"birthday"
,
birthday
);
map
.
put
(
"age"
,
age
);
map
.
put
(
"sex"
,
sexCode
);
return
map
;
}
public
static
boolean
checkIdNum
(
String
cellValue
)
{
// 身份证校验
String
regularExpression
=
"(^[1-9]\\d{5}(18|19|20)\\d{2}((0[1-9])|(10|11|12))(([0-2][1-9])|10|20|30|31)\\d{3}[0-9Xx]$)|"
+
"(^[1-9]\\d{5}\\d{2}((0[1-9])|(10|11|12))(([0-2][1-9])|10|20|30|31)\\d{3}$)"
;
boolean
matches
=
cellValue
.
matches
(
regularExpression
);
if
(
matches
)
{
if
(
cellValue
.
length
()
==
18
)
{
try
{
char
[]
charArray
=
cellValue
.
toCharArray
();
//前十七位加权因子
int
[]
idCardWi
=
{
7
,
9
,
10
,
5
,
8
,
4
,
2
,
1
,
6
,
3
,
7
,
9
,
10
,
5
,
8
,
4
,
2
};
//这是除以11后,可能产生的11位余数对应的验证码
String
[]
idCardY
=
{
"1"
,
"0"
,
"X"
,
"9"
,
"8"
,
"7"
,
"6"
,
"5"
,
"4"
,
"3"
,
"2"
};
int
sum
=
0
;
for
(
int
i
=
0
;
i
<
idCardWi
.
length
;
i
++)
{
int
current
=
Integer
.
parseInt
(
String
.
valueOf
(
charArray
[
i
]));
int
count
=
current
*
idCardWi
[
i
];
sum
+=
count
;
}
char
idCardLast
=
charArray
[
17
];
int
idCardMod
=
sum
%
11
;
if
(
idCardY
[
idCardMod
].
toUpperCase
().
equals
(
String
.
valueOf
(
idCardLast
).
toUpperCase
()))
{
matches
=
true
;
}
else
{
System
.
out
.
println
(
"身份证最后一位:"
+
String
.
valueOf
(
idCardLast
).
toUpperCase
()
+
"错误,正确的应该是:"
+
idCardY
[
idCardMod
].
toUpperCase
());
matches
=
false
;
}
}
catch
(
Exception
e
)
{
logger
.
error
(
"checkIdNum"
,
e
);
}
}
}
return
matches
;
}
}
server/src/main/java/com/pica/cloud/account/account/server/util/AESUtil.java
浏览文件 @
dd3619a4
...
...
@@ -188,6 +188,8 @@ public class AESUtil {
public
static
void
main
(
String
[]
args
)
throws
Exception
{
// String content = AESUtil.aesDecrypt(encryptEntity.getContent(),decryptKey);
String
KEY
=
"111"
;
System
.
out
.
println
(
"-------------加密---------"
);
...
...
server/src/main/resources/mybatis/AccountMapper.xml
浏览文件 @
dd3619a4
...
...
@@ -9,6 +9,8 @@
<result
column=
"mobile_phone"
jdbcType=
"VARCHAR"
property=
"mobilePhone"
/>
<result
column=
"acct_id"
jdbcType=
"INTEGER"
property=
"acctId"
/>
<result
column=
"status"
jdbcType=
"INTEGER"
property=
"status"
/>
<result
column=
"certify_status"
jdbcType=
"INTEGER"
property=
"certifyStatus"
/>
<result
column=
"nation"
jdbcType=
"VARCHAR"
property=
"nation"
/>
<result
column=
"avatar_image_url"
jdbcType=
"VARCHAR"
property=
"avatarImageUrl"
/>
<result
column=
"email"
jdbcType=
"VARCHAR"
property=
"email"
/>
<result
column=
"qrcode"
jdbcType=
"VARCHAR"
property=
"qrcode"
/>
...
...
@@ -34,7 +36,7 @@
</resultMap>
<sql
id=
"Base_Column_List"
>
id, sex, name, mobile_phone, status, avatar_image_url, email, qrcode, nickname, personal_sign, delete_flag,
id, sex, name, mobile_phone, status,
certify_status, nation,
avatar_image_url, email, qrcode, nickname, personal_sign, delete_flag,
creat_id, creat_time, modify_id, modify_time, password, info, entire_flag, reg_time, last_login_time,
unionid, register_source, comment, register_type, first_login_time, card, birthday
</sql>
...
...
@@ -213,6 +215,18 @@
<update
id=
"updateByIdSelective"
parameterType=
"com.pica.cloud.account.account.server.entity.Account"
>
update p_doctor
<set>
<if
test=
"status != null"
>
status = #{status,jdbcType=INTEGER},
</if>
<if
test=
"certifyStatus != null"
>
certify_status = #{certifyStatus,jdbcType=INTEGER},
</if>
<if
test=
"nation != null"
>
nation = #{nation,jdbcType=VARCHAR},
</if>
<if
test=
"nativePlace != null"
>
native_place = #{nativePlace,jdbcType=VARCHAR},
</if>
<if
test=
"sex != null"
>
sex = #{sex,jdbcType=INTEGER},
</if>
...
...
@@ -307,6 +321,14 @@
limit 1
</select>
<select
id=
"getByCard"
resultMap=
"BaseResultMap"
>
select
<include
refid=
"Base_Column_List"
/>
from p_doctor
where card = #{card} and delete_flag = 1
limit 1
</select>
<select
id=
"getHospitalInfoByPage"
resultType=
"map"
>
select id, hospital_id, hospital,mobile_phone,name,
status, avatar_image_url, email,
...
...
写
预览
Markdown
格式
0%
请重试
or
附加一个文件
附加文件
取消
您添加了
0
人
到此讨论。请谨慎行事。
先完成此消息的编辑!
取消
想要评论请
注册
或
登录