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
提交
1a89708f
提交
1a89708f
编写于
8月 21, 2019
作者:
rushui.chen
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
20190821 注册接口
上级
af92ebe1
流水线
#13564
已失败 于阶段
in 3 second
变更
33
流水线
1
显示空白字符变更
内嵌
并排
正在显示
33 个修改的文件
包含
1249 行增加
和
63 行删除
+1249
-63
AccountBaseController.java
...ount/account/server/controller/AccountBaseController.java
+36
-3
PasswordController.java
...account/account/server/controller/PasswordController.java
+4
-1
RegisterController.java
...account/account/server/controller/RegisterController.java
+154
-0
SysCodeController.java
.../account/account/server/controller/SysCodeController.java
+103
-0
Account.java
...com/pica/cloud/account/account/server/entity/Account.java
+10
-0
AccountInfo.java
...pica/cloud/account/account/server/entity/AccountInfo.java
+12
-13
AccountProduct.java
...a/cloud/account/account/server/entity/AccountProduct.java
+85
-0
AccountUnion.java
...ica/cloud/account/account/server/entity/AccountUnion.java
+115
-0
AccountUser.java
...pica/cloud/account/account/server/entity/AccountUser.java
+9
-9
AccountContactMapper.java
...d/account/account/server/mapper/AccountContactMapper.java
+8
-2
AccountDetailsMapper.java
...d/account/account/server/mapper/AccountDetailsMapper.java
+16
-2
AccountProductMapper.java
...d/account/account/server/mapper/AccountProductMapper.java
+18
-0
AccountUnionMapper.java
...oud/account/account/server/mapper/AccountUnionMapper.java
+30
-0
AcctUserInfoMapper.java
...oud/account/account/server/mapper/AcctUserInfoMapper.java
+9
-2
RegisterReq.java
...om/pica/cloud/account/account/server/req/RegisterReq.java
+62
-0
SysCodeReq.java
...com/pica/cloud/account/account/server/req/SysCodeReq.java
+49
-0
AccountContactServer.java
.../account/account/server/service/AccountContactServer.java
+2
-0
AccountDetailsService.java
...account/account/server/service/AccountDetailsService.java
+12
-0
AccountProductService.java
...account/account/server/service/AccountProductService.java
+8
-0
AccountUnionServer.java
...ud/account/account/server/service/AccountUnionServer.java
+10
-0
AccountUserInfoService.java
...ccount/account/server/service/AccountUserInfoService.java
+8
-1
AccountContactServerImpl.java
...account/server/service/impl/AccountContactServerImpl.java
+16
-0
AccountDetailsServiceImpl.java
...ccount/server/service/impl/AccountDetailsServiceImpl.java
+37
-0
AccountInfoServiceImpl.java
...t/account/server/service/impl/AccountInfoServiceImpl.java
+3
-0
AccountProductServiceImpl.java
...ccount/server/service/impl/AccountProductServiceImpl.java
+30
-0
AccountUnionServerImpl.java
...t/account/server/service/impl/AccountUnionServerImpl.java
+20
-0
AccountUserInfoServiceImpl.java
...count/server/service/impl/AccountUserInfoServiceImpl.java
+16
-1
ModifyMobileServiceImpl.java
.../account/server/service/impl/ModifyMobileServiceImpl.java
+2
-1
PasswordServiceImpl.java
...ount/account/server/service/impl/PasswordServiceImpl.java
+6
-5
AccountUtils.java
.../pica/cloud/account/account/server/util/AccountUtils.java
+26
-0
AccountDetailsMapper.xml
server/src/main/resources/mybatis/AccountDetailsMapper.xml
+31
-23
AccountProductMapper.xml
server/src/main/resources/mybatis/AccountProductMapper.xml
+128
-0
AccountUnionMapper.xml
server/src/main/resources/mybatis/AccountUnionMapper.xml
+174
-0
未找到文件。
server/src/main/java/com/pica/cloud/account/account/server/controller/AccountBaseController.java
浏览文件 @
1a89708f
...
...
@@ -19,6 +19,7 @@ import org.slf4j.Logger;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
javax.servlet.http.HttpServletRequest
;
import
java.util.*
;
/**
...
...
@@ -50,10 +51,42 @@ public abstract class AccountBaseController extends BaseController {
* @return
*/
public
AccountUser
getAccountUser
()
{
// TODO: 2019/8/20 未实现
//无论是否登录,当前对象都应该存在。
//无论是否登录,当前对象都应该存在
//把所有请求头信息都封装到当前模型中
String
token
=
this
.
getToken
();
AccountUser
accountUser
=
super
.
getRedisClient
().
getToken
(
token
,
AccountUser
.
class
);
accountUser
.
setLoginFrom
(
this
.
getSourceType
());
accountUser
.
setLoginPlatform
(
this
.
getProductType
());
accountUser
.
setLoginIp
(
super
.
getIpAddr
());
return
accountUser
;
}
return
new
AccountUser
();
/**
* 产品线类型:productType: 1.云鹊医(默认值) 2云鹊健康
*
* @return
*/
public
Integer
getProductType
()
{
HttpServletRequest
request
=
super
.
getRequest
();
String
str
=
request
.
getHeader
(
"productType"
);
if
(
StringUtils
.
isNotEmpty
(
str
))
{
return
Integer
.
parseInt
(
str
);
}
return
null
;
}
/**
* 终端来源 sourceType:1.android 2.ios 3.web 4.wechat(例如微信小程序) 5.h5
*
* @return
*/
public
Integer
getSourceType
()
{
HttpServletRequest
request
=
super
.
getRequest
();
String
str
=
request
.
getHeader
(
"sourceType"
);
if
(
StringUtils
.
isNotEmpty
(
str
))
{
return
Integer
.
parseInt
(
str
);
}
return
null
;
}
//获取deviceInfo信息
...
...
server/src/main/java/com/pica/cloud/account/account/server/controller/PasswordController.java
浏览文件 @
1a89708f
...
...
@@ -72,7 +72,6 @@ public class PasswordController extends AccountBaseController {
@ApiOperation
(
value
=
"忘记密码操作"
)
@PostMapping
(
value
=
"/reset"
)
public
PicaResponse
forwardPassword
(
@RequestBody
String
params
)
throws
Exception
{
//TODO: 2019/8/20 当前手机号是否注册过,如果没有注册,请先注册
String
json
=
RSAUtils
.
decrypt
(
params
,
RSAUtils
.
getPrivateKey
());
ForgetPasswordReq
forwardPasswordReq
=
JSONObject
.
parseObject
(
json
,
ForgetPasswordReq
.
class
);
forwardPasswordReq
.
setFlag
(
"4"
);
...
...
@@ -106,11 +105,15 @@ public class PasswordController extends AccountBaseController {
*/
private
void
checkAuthCode
(
ForgetPasswordReq
req
)
{
String
flag
=
StringUtils
.
isBlank
(
req
.
getFlag
())
?
"0"
:
req
.
getFlag
();
if
(
StringUtils
.
isBlank
(
req
.
getAuthCode
()))
{
throw
new
PicaException
(
PicaResultCode
.
PARAM_IS_INVALID
.
code
(),
"短信验证码错误"
);
}
String
authCodeKey
=
AccountUtils
.
getAuthCodeKey
(
req
.
getMobile
(),
flag
);
String
cacheCode
=
cacheClient
.
get
(
authCodeKey
);
//从redis获取验证码
if
(
StringUtils
.
isBlank
(
cacheCode
))
{
throw
new
PicaException
(
PicaResultCode
.
RESULE_DATA_NONE
.
code
(),
"短信验证码已过期,请重新获取"
);
}
...
...
server/src/main/java/com/pica/cloud/account/account/server/controller/RegisterController.java
0 → 100644
浏览文件 @
1a89708f
package
com
.
pica
.
cloud
.
account
.
account
.
server
.
controller
;
import
com.alibaba.fastjson.JSONObject
;
import
com.pica.cloud.account.account.server.entity.Account
;
import
com.pica.cloud.account.account.server.entity.AccountContact
;
import
com.pica.cloud.account.account.server.entity.AccountInfo
;
import
com.pica.cloud.account.account.server.entity.AccountUser
;
import
com.pica.cloud.account.account.server.req.RegisterReq
;
import
com.pica.cloud.account.account.server.service.*
;
import
com.pica.cloud.account.account.server.util.AccountUtils
;
import
com.pica.cloud.account.account.server.util.RSAUtils
;
import
com.pica.cloud.foundation.entity.PicaException
;
import
com.pica.cloud.foundation.entity.PicaResponse
;
import
com.pica.cloud.foundation.redis.CacheClient
;
import
com.pica.cloud.foundation.utils.utils.EncryptCreateUtil
;
import
com.pica.cloud.foundation.utils.utils.json.Object2Map
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
java.util.Date
;
import
java.util.Map
;
import
java.util.UUID
;
@Api
(
"注册资源"
)
@RestController
@RequestMapping
(
"/register"
)
public
class
RegisterController
extends
AccountBaseController
{
private
Logger
logger
=
LoggerFactory
.
getLogger
(
this
.
getClass
());
@Autowired
private
AccountUtils
accountUtils
;
@Autowired
private
AccountContactServer
accountContactServer
;
@Autowired
private
AccountDetailsService
accountDetailsService
;
@Autowired
private
AccountProductService
accountProductService
;
@Autowired
private
AccountUserInfoService
accountUserInfoService
;
@Autowired
private
AccountLoginOutService
accountLoginOutService
;
@Autowired
private
CacheClient
cacheClient
;
@ApiOperation
(
"注册接口"
)
@PostMapping
(
value
=
""
)
public
PicaResponse
<
String
>
register
(
@RequestBody
String
params
)
throws
Exception
{
String
json
=
RSAUtils
.
decrypt
(
params
,
RSAUtils
.
getPrivateKey
());
RegisterReq
registerReq
=
JSONObject
.
parseObject
(
json
,
RegisterReq
.
class
);
String
mobile
=
registerReq
.
getMobile
();
String
authCode
=
registerReq
.
getAuthCode
();
AccountUtils
.
checkMobilePhone
(
mobile
);
accountUtils
.
checkAuthCode
(
mobile
,
"1"
,
authCode
);
//校验用户用户是否已经存在
AccountContact
accountContact
=
accountContactServer
.
selectByMobile
(
mobile
);
if
(
accountContact
==
null
)
{
//账号信息表
AccountInfo
accountInfo
=
new
AccountInfo
();
accountInfo
.
setPassword
(
EncryptCreateUtil
.
encrypt
(
registerReq
.
getPassword
()));
Integer
acctId
=
accountDetailsService
.
insertAccountInfo
(
accountInfo
);
accountDetailsService
.
updateAccountInfo
(
acctId
);
//账号产品线表
accountProductService
.
insertSelective
(
acctId
,
super
.
getProductType
());
//账号联系人表
accountContactServer
.
insertSelective
(
mobile
,
acctId
);
//用户信息表
Integer
userId
=
accountUserInfoService
.
insertUserInfo
(
acctId
);
//保存用户登陆成功状态
AccountUser
accountUser
=
super
.
getAccountUser
();
accountLoginOutService
.
insertLoginLog
(
accountUser
);
Account
account
=
new
Account
();
account
.
setId
(
userId
.
longValue
());
account
.
setAcctId
(
acctId
);
account
.
setCreatTime
(
new
Date
());
account
.
setMobilePhone
(
mobile
);
account
.
setRegisterSource
(
super
.
getSourceType
());
String
newToken
=
this
.
generateToken
(
account
);
JSONObject
jsonObject
=
new
JSONObject
();
jsonObject
.
put
(
"token"
,
newToken
);
jsonObject
.
put
(
"userId"
,
userId
);
return
PicaResponse
.
toResponse
(
jsonObject
.
toJSONString
());
}
else
{
throw
new
PicaException
(
"您已注册,请直接登录"
);
}
}
//生成token
private
String
generateToken
(
Account
account
)
{
String
sourceType
=
null
;
Integer
registerSource
=
account
.
getRegisterSource
();
if
(
registerSource
.
intValue
()
==
5
)
{
sourceType
=
"h5"
;
}
else
if
(
registerSource
.
intValue
()
==
3
)
{
sourceType
=
"saas"
;
}
else
{
sourceType
=
"app"
;
}
String
newToken
=
org
.
apache
.
commons
.
lang3
.
StringUtils
.
EMPTY
;
try
{
//先清除旧token
String
tokenValue
=
"token-doctor-"
+
account
.
getId
().
toString
();
//String oldToken = cacheClient.get(tokenValue + "-h5");
//if (org.apache.commons.lang3.StringUtils.isNotBlank(oldToken)) {
// cacheClient.del(oldToken);
//}
//生成新token
int
expiredSeconds
=
30
*
24
*
60
*
60
;
//token有效期30天
newToken
=
UUID
.
randomUUID
().
toString
().
replace
(
"-"
,
""
).
toUpperCase
();
String
tokenKey
=
"token-"
+
newToken
;
cacheClient
.
set
(
tokenKey
,
tokenValue
,
expiredSeconds
);
cacheClient
.
set
(
tokenValue
+
sourceType
,
tokenKey
,
expiredSeconds
);
//用户数据放入缓存
String
userData
=
cacheClient
.
hget
(
tokenValue
,
"id"
);
if
(
org
.
apache
.
commons
.
lang3
.
StringUtils
.
isEmpty
(
userData
))
{
AccountUser
picaUser
=
new
AccountUser
();
picaUser
.
setToken
(
newToken
);
//用户id
picaUser
.
setId
(
account
.
getId
().
intValue
());
//
picaUser
.
setAcctId
(
account
.
getAcctId
());
picaUser
.
setMobile
(
account
.
getMobilePhone
());
picaUser
.
setName
(
EncryptCreateUtil
.
dencrypt
(
account
.
getMobilePhone
()).
replaceAll
(
"(\\d{3})\\d{4}(\\w{4})"
,
"$1****$2"
));
picaUser
.
setCreated_time
(
account
.
getCreatTime
());
Map
<
String
,
String
>
data
=
Object2Map
.
objectToMapString
(
"yyyy-MM-dd HH:mm:ss"
,
picaUser
,
new
String
[
0
]);
data
.
put
(
"sysCode"
,
sourceType
);
data
.
forEach
((
key
,
value
)
->
{
value
=
value
==
null
?
""
:
value
;
cacheClient
.
hset
(
tokenValue
,
key
,
value
);
});
}
}
catch
(
Exception
ex
)
{
logger
.
error
(
"生成H5 token异常:{}"
+
ex
.
getMessage
(),
ex
);
}
return
newToken
;
}
}
server/src/main/java/com/pica/cloud/account/account/server/controller/SysCodeController.java
0 → 100644
浏览文件 @
1a89708f
package
com
.
pica
.
cloud
.
account
.
account
.
server
.
controller
;
import
com.alibaba.fastjson.JSONObject
;
import
com.pica.cloud.account.account.server.entity.Account
;
import
com.pica.cloud.account.account.server.entity.AccountUnion
;
import
com.pica.cloud.account.account.server.entity.AccountUser
;
import
com.pica.cloud.account.account.server.req.SysCodeReq
;
import
com.pica.cloud.account.account.server.service.AccountService
;
import
com.pica.cloud.account.account.server.service.AccountUnionServer
;
import
com.pica.cloud.account.account.server.util.AccountUtils
;
import
com.pica.cloud.account.account.server.util.RSAUtils
;
import
com.pica.cloud.foundation.entity.PicaException
;
import
com.pica.cloud.foundation.entity.PicaResponse
;
import
com.pica.cloud.foundation.redis.CacheClient
;
import
com.pica.cloud.foundation.utils.utils.CommonUtil
;
import
com.pica.cloud.foundation.utils.utils.EncryptCreateUtil
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
@Api
(
"短信验证码"
)
@RestController
@RequestMapping
(
value
=
"/authCode"
)
public
class
SysCodeController
extends
AccountBaseController
{
private
final
String
AUTH_CODE_PREFIX
=
"authCode-"
;
@Autowired
private
AccountService
accountService
;
@Autowired
private
AccountUnionServer
accountUnionServer
;
@Autowired
private
CacheClient
cacheClient
;
@ApiOperation
(
"获取短信验证码"
)
@GetMapping
(
value
=
""
)
public
PicaResponse
getSysCode
(
@RequestBody
String
params
)
throws
Exception
{
String
json
=
RSAUtils
.
decrypt
(
params
,
RSAUtils
.
getPrivateKey
());
SysCodeReq
sysCodeReq
=
JSONObject
.
parseObject
(
json
,
SysCodeReq
.
class
);
AccountUtils
.
checkMobilePhone
(
sysCodeReq
.
getMobilePhone
());
processSysCode
(
sysCodeReq
.
getMobilePhone
(),
sysCodeReq
.
getFlag
());
return
PicaResponse
.
toResponse
(
StringUtils
.
EMPTY
);
}
@ApiOperation
(
"微信获取短信验证码"
)
@GetMapping
(
value
=
"/wechat"
)
public
PicaResponse
getWeChatSysCode
(
String
params
)
throws
Exception
{
AccountUser
accountUser
=
super
.
getAccountUser
();
String
token
=
accountUser
.
getToken
();
if
(
StringUtils
.
isNotEmpty
(
token
))
{
String
json
=
RSAUtils
.
decrypt
(
params
,
RSAUtils
.
getPrivateKey
());
SysCodeReq
sysCodeReq
=
JSONObject
.
parseObject
(
json
,
SysCodeReq
.
class
);
AccountUtils
.
checkMobilePhone
(
sysCodeReq
.
getMobilePhone
());
//联合登录表查询是否存在记录
sysCodeReq
.
setAcctId
(
accountUser
.
getAcctId
());
sysCodeReq
.
setUnionId
(
sysCodeReq
.
getUnionId
());
AccountUnion
accountUnion
=
accountUnionServer
.
selectByUnionIdAndAcctId
(
sysCodeReq
);
if
(
accountUnion
==
null
)
{
processSysCode
(
sysCodeReq
.
getMobilePhone
(),
sysCodeReq
.
getFlag
());
return
PicaResponse
.
toResponse
(
StringUtils
.
EMPTY
);
}
else
{
throw
new
PicaException
(
"您已绑定过微信"
);
}
}
else
{
throw
new
PicaException
(
"请重新登陆"
);
}
}
/**
* 验证码发送逻辑
*
* @param mobilePhone
* @param flag
*/
private
void
processSysCode
(
String
mobilePhone
,
Integer
flag
)
{
//随机生成验证码
String
authCode
=
CommonUtil
.
createValidateCode
();
String
message
=
"您的验证码是"
+
authCode
+
",在10分钟内有效。如非本人操作,请忽略本短信!"
;
//判断账号是否已经存在
Account
account
=
accountService
.
getByMobilePhone
(
mobilePhone
);
long
senderId
=
account
==
null
?
0L
:
account
.
getId
();
//验证码保存到redis,失效时间10分钟
cacheClient
.
set
(
this
.
getAuthCodeKey
(
mobilePhone
,
flag
+
""
),
authCode
,
600
);
//发送短信
super
.
sendMobileMessage
(
mobilePhone
,
message
,
senderId
);
}
//获取验证码redis key
private
String
getAuthCodeKey
(
String
mobilePhone
,
String
flag
)
{
return
AUTH_CODE_PREFIX
+
flag
+
"-"
+
EncryptCreateUtil
.
encrypt
(
mobilePhone
);
}
}
server/src/main/java/com/pica/cloud/account/account/server/entity/Account.java
浏览文件 @
1a89708f
...
...
@@ -13,6 +13,8 @@ public class Account {
private
Long
id
;
private
Integer
acctId
;
private
Integer
sex
;
private
String
name
;
...
...
@@ -67,6 +69,14 @@ public class Account {
private
Date
birthday
;
public
Integer
getAcctId
()
{
return
acctId
;
}
public
void
setAcctId
(
Integer
acctId
)
{
this
.
acctId
=
acctId
;
}
public
Long
getId
()
{
return
id
;
}
...
...
server/src/main/java/com/pica/cloud/account/account/server/entity/AccountInfo.java
浏览文件 @
1a89708f
...
...
@@ -13,7 +13,7 @@ public class AccountInfo {
private
Date
birthday
;
private
Byte
sex
;
private
int
sex
;
private
String
idCard
;
...
...
@@ -31,13 +31,6 @@ public class AccountInfo {
private
Date
modifiedTime
;
public
int
getAge
()
{
return
age
;
}
public
void
setAge
(
int
age
)
{
this
.
age
=
age
;
}
public
Long
getId
()
{
return
id
;
...
...
@@ -52,7 +45,7 @@ public class AccountInfo {
}
public
void
setPassword
(
String
password
)
{
this
.
password
=
password
==
null
?
null
:
password
.
trim
()
;
this
.
password
=
password
;
}
public
String
getName
()
{
...
...
@@ -60,10 +53,16 @@ public class AccountInfo {
}
public
void
setName
(
String
name
)
{
this
.
name
=
name
==
null
?
null
:
name
.
trim
()
;
this
.
name
=
name
;
}
public
int
getAge
()
{
return
age
;
}
public
void
setAge
(
int
age
)
{
this
.
age
=
age
;
}
public
Date
getBirthday
()
{
return
birthday
;
...
...
@@ -73,11 +72,11 @@ public class AccountInfo {
this
.
birthday
=
birthday
;
}
public
Byte
getSex
()
{
public
int
getSex
()
{
return
sex
;
}
public
void
setSex
(
Byte
sex
)
{
public
void
setSex
(
int
sex
)
{
this
.
sex
=
sex
;
}
...
...
@@ -86,7 +85,7 @@ public class AccountInfo {
}
public
void
setIdCard
(
String
idCard
)
{
this
.
idCard
=
idCard
==
null
?
null
:
idCard
.
trim
()
;
this
.
idCard
=
idCard
;
}
public
Date
getRegTime
()
{
...
...
server/src/main/java/com/pica/cloud/account/account/server/entity/AccountProduct.java
0 → 100644
浏览文件 @
1a89708f
package
com
.
pica
.
cloud
.
account
.
account
.
server
.
entity
;
import
java.util.Date
;
public
class
AccountProduct
{
private
Long
id
;
private
Long
acctId
;
private
Integer
productType
;
private
Integer
deleteFlag
;
private
Long
createdId
;
private
Date
createdTime
;
private
Long
modifiedId
;
private
Date
modifiedTime
;
public
Long
getId
()
{
return
id
;
}
public
void
setId
(
Long
id
)
{
this
.
id
=
id
;
}
public
Long
getAcctId
()
{
return
acctId
;
}
public
void
setAcctId
(
Long
acctId
)
{
this
.
acctId
=
acctId
;
}
public
Integer
getProductType
()
{
return
productType
;
}
public
void
setProductType
(
Integer
productType
)
{
this
.
productType
=
productType
;
}
public
Integer
getDeleteFlag
()
{
return
deleteFlag
;
}
public
void
setDeleteFlag
(
Integer
deleteFlag
)
{
this
.
deleteFlag
=
deleteFlag
;
}
public
Long
getCreatedId
()
{
return
createdId
;
}
public
void
setCreatedId
(
Long
createdId
)
{
this
.
createdId
=
createdId
;
}
public
Date
getCreatedTime
()
{
return
createdTime
;
}
public
void
setCreatedTime
(
Date
createdTime
)
{
this
.
createdTime
=
createdTime
;
}
public
Long
getModifiedId
()
{
return
modifiedId
;
}
public
void
setModifiedId
(
Long
modifiedId
)
{
this
.
modifiedId
=
modifiedId
;
}
public
Date
getModifiedTime
()
{
return
modifiedTime
;
}
public
void
setModifiedTime
(
Date
modifiedTime
)
{
this
.
modifiedTime
=
modifiedTime
;
}
}
\ No newline at end of file
server/src/main/java/com/pica/cloud/account/account/server/entity/AccountUnion.java
0 → 100644
浏览文件 @
1a89708f
package
com
.
pica
.
cloud
.
account
.
account
.
server
.
entity
;
import
java.util.Date
;
public
class
AccountUnion
{
private
Long
id
;
private
Long
acctId
;
private
Integer
unionType
;
private
String
unionId
;
private
String
nickname
;
private
String
headImgUrl
;
private
Integer
deleteFlag
;
private
Long
createdId
;
private
Date
createdTime
;
private
Long
modifiedId
;
private
Date
modifiedTime
;
public
Long
getId
()
{
return
id
;
}
public
void
setId
(
Long
id
)
{
this
.
id
=
id
;
}
public
Long
getAcctId
()
{
return
acctId
;
}
public
void
setAcctId
(
Long
acctId
)
{
this
.
acctId
=
acctId
;
}
public
Integer
getUnionType
()
{
return
unionType
;
}
public
void
setUnionType
(
Integer
unionType
)
{
this
.
unionType
=
unionType
;
}
public
String
getUnionId
()
{
return
unionId
;
}
public
void
setUnionId
(
String
unionId
)
{
this
.
unionId
=
unionId
==
null
?
null
:
unionId
.
trim
();
}
public
String
getNickname
()
{
return
nickname
;
}
public
void
setNickname
(
String
nickname
)
{
this
.
nickname
=
nickname
==
null
?
null
:
nickname
.
trim
();
}
public
String
getHeadImgUrl
()
{
return
headImgUrl
;
}
public
void
setHeadImgUrl
(
String
headImgUrl
)
{
this
.
headImgUrl
=
headImgUrl
==
null
?
null
:
headImgUrl
.
trim
();
}
public
Integer
getDeleteFlag
()
{
return
deleteFlag
;
}
public
void
setDeleteFlag
(
Integer
deleteFlag
)
{
this
.
deleteFlag
=
deleteFlag
;
}
public
Long
getCreatedId
()
{
return
createdId
;
}
public
void
setCreatedId
(
Long
createdId
)
{
this
.
createdId
=
createdId
;
}
public
Date
getCreatedTime
()
{
return
createdTime
;
}
public
void
setCreatedTime
(
Date
createdTime
)
{
this
.
createdTime
=
createdTime
;
}
public
Long
getModifiedId
()
{
return
modifiedId
;
}
public
void
setModifiedId
(
Long
modifiedId
)
{
this
.
modifiedId
=
modifiedId
;
}
public
Date
getModifiedTime
()
{
return
modifiedTime
;
}
public
void
setModifiedTime
(
Date
modifiedTime
)
{
this
.
modifiedTime
=
modifiedTime
;
}
}
\ No newline at end of file
server/src/main/java/com/pica/cloud/account/account/server/entity/AccountUser.java
浏览文件 @
1a89708f
...
...
@@ -4,37 +4,37 @@ import com.pica.cloud.foundation.utils.entity.PicaUser;
public
class
AccountUser
extends
PicaUser
{
//账户id
private
int
acctId
;
private
Integer
acctId
;
//渠道来源
private
int
loginFrom
;
private
Integer
loginFrom
;
//平台来源
private
int
loginPlatform
;
private
Integer
loginPlatform
;
//账户名
private
String
acctName
;
//登录ip
private
String
loginIp
;
public
int
getAcctId
()
{
public
Integer
getAcctId
()
{
return
acctId
;
}
public
void
setAcctId
(
int
acctId
)
{
public
void
setAcctId
(
Integer
acctId
)
{
this
.
acctId
=
acctId
;
}
public
int
getLoginFrom
()
{
public
Integer
getLoginFrom
()
{
return
loginFrom
;
}
public
void
setLoginFrom
(
int
loginFrom
)
{
public
void
setLoginFrom
(
Integer
loginFrom
)
{
this
.
loginFrom
=
loginFrom
;
}
public
int
getLoginPlatform
()
{
public
Integer
getLoginPlatform
()
{
return
loginPlatform
;
}
public
void
setLoginPlatform
(
int
loginPlatform
)
{
public
void
setLoginPlatform
(
Integer
loginPlatform
)
{
this
.
loginPlatform
=
loginPlatform
;
}
...
...
server/src/main/java/com/pica/cloud/account/account/server/mapper/AccountContactMapper.java
浏览文件 @
1a89708f
...
...
@@ -21,14 +21,20 @@ public interface AccountContactMapper {
*/
AccountContact
selectByPrimaryKey
(
Long
id
);
/**
* 通过手机号获取账户信息
*
* @param mobile
* @param mobile
mobile
* @return
*/
AccountContact
selectByMobile
(
String
mobile
);
/**
* 插入账户联系人记录
*
* @param accountContact accountContact
*/
void
insertSelective
(
AccountContact
accountContact
);
}
\ No newline at end of file
server/src/main/java/com/pica/cloud/account/account/server/mapper/AccountDetailsMapper.java
浏览文件 @
1a89708f
...
...
@@ -8,11 +8,9 @@ public interface AccountDetailsMapper {
int
insert
(
AccountInfo
record
);
int
insertSelective
(
AccountInfo
record
);
AccountInfo
selectByPrimaryKey
(
Long
id
);
int
updateByPrimaryKeySelective
(
AccountInfo
record
);
int
updateByPrimaryKey
(
AccountInfo
record
);
...
...
@@ -24,4 +22,20 @@ public interface AccountDetailsMapper {
*/
int
updatePasswordById
(
AccountInfo
record
);
/**
* 插入新的用户记录
*
* @param record
* @return
*/
int
insertSelective
(
AccountInfo
record
);
/**
* 更新用户信息
* @param record
* @return
*/
int
updateByPrimaryKeySelective
(
AccountInfo
record
);
}
\ No newline at end of file
server/src/main/java/com/pica/cloud/account/account/server/mapper/AccountProductMapper.java
0 → 100644
浏览文件 @
1a89708f
package
com
.
pica
.
cloud
.
account
.
account
.
server
.
mapper
;
import
com.pica.cloud.account.account.server.entity.AccountProduct
;
public
interface
AccountProductMapper
{
int
deleteByPrimaryKey
(
Long
id
);
int
insert
(
AccountProduct
record
);
int
insertSelective
(
AccountProduct
record
);
AccountProduct
selectByPrimaryKey
(
Long
id
);
int
updateByPrimaryKeySelective
(
AccountProduct
record
);
int
updateByPrimaryKey
(
AccountProduct
record
);
}
\ No newline at end of file
server/src/main/java/com/pica/cloud/account/account/server/mapper/AccountUnionMapper.java
0 → 100644
浏览文件 @
1a89708f
package
com
.
pica
.
cloud
.
account
.
account
.
server
.
mapper
;
import
com.pica.cloud.account.account.server.entity.AccountUnion
;
import
com.pica.cloud.account.account.server.req.SysCodeReq
;
public
interface
AccountUnionMapper
{
/**
* 查询是否绑定过微信
* @param sysCodeReq
* @return
*/
AccountUnion
selectByUnionIdAndAcctId
(
SysCodeReq
sysCodeReq
);
int
insert
(
AccountUnion
record
);
int
insertSelective
(
AccountUnion
record
);
AccountUnion
selectByPrimaryKey
(
Long
id
);
int
updateByPrimaryKeySelective
(
AccountUnion
record
);
int
updateByPrimaryKey
(
AccountUnion
record
);
}
\ No newline at end of file
server/src/main/java/com/pica/cloud/account/account/server/mapper/AcctUserInfoMapper.java
浏览文件 @
1a89708f
...
...
@@ -5,15 +5,22 @@ import com.pica.cloud.account.account.server.entity.AcctUserInfo;
public
interface
AcctUserInfoMapper
{
int
deleteByPrimaryKey
(
Integer
id
);
int
insert
(
AcctUserInfo
record
);
int
insertSelective
(
AcctUserInfo
record
);
AcctUserInfo
selectByPrimaryKey
(
Integer
id
);
int
updateByPrimaryKeySelective
(
AcctUserInfo
record
);
int
updateByPrimaryKey
(
AcctUserInfo
record
);
/**
* 插入用户信息
*
* @param record
* @return
*/
int
insertSelective
(
AcctUserInfo
record
);
}
\ No newline at end of file
server/src/main/java/com/pica/cloud/account/account/server/req/RegisterReq.java
0 → 100644
浏览文件 @
1a89708f
package
com
.
pica
.
cloud
.
account
.
account
.
server
.
req
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
@ApiModel
public
class
RegisterReq
{
@ApiModelProperty
(
"手机号"
)
private
String
mobile
;
@ApiModelProperty
(
"密码"
)
private
String
password
;
@ApiModelProperty
(
"验证码"
)
private
String
authCode
;
@ApiModelProperty
(
"邀请码"
)
private
String
inviteCode
;
@ApiModelProperty
(
"验证码标记"
)
private
String
flag
;
public
String
getFlag
()
{
return
flag
;
}
public
void
setFlag
(
String
flag
)
{
this
.
flag
=
flag
;
}
public
String
getMobile
()
{
return
mobile
;
}
public
void
setMobile
(
String
mobile
)
{
this
.
mobile
=
mobile
;
}
public
String
getPassword
()
{
return
password
;
}
public
void
setPassword
(
String
password
)
{
this
.
password
=
password
;
}
public
String
getAuthCode
()
{
return
authCode
;
}
public
void
setAuthCode
(
String
authCode
)
{
this
.
authCode
=
authCode
;
}
public
String
getInviteCode
()
{
return
inviteCode
;
}
public
void
setInviteCode
(
String
inviteCode
)
{
this
.
inviteCode
=
inviteCode
;
}
}
server/src/main/java/com/pica/cloud/account/account/server/req/SysCodeReq.java
0 → 100644
浏览文件 @
1a89708f
package
com
.
pica
.
cloud
.
account
.
account
.
server
.
req
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
@ApiModel
public
class
SysCodeReq
{
@ApiModelProperty
(
"账户id"
)
private
Integer
acctId
;
@ApiModelProperty
(
"手机号"
)
private
String
mobilePhone
;
@ApiModelProperty
(
"验证码类型"
)
private
Integer
flag
;
@ApiModelProperty
(
"unionId"
)
private
String
unionId
;
public
Integer
getAcctId
()
{
return
acctId
;
}
public
void
setAcctId
(
Integer
acctId
)
{
this
.
acctId
=
acctId
;
}
public
String
getMobilePhone
()
{
return
mobilePhone
;
}
public
void
setMobilePhone
(
String
mobilePhone
)
{
this
.
mobilePhone
=
mobilePhone
;
}
public
Integer
getFlag
()
{
return
flag
;
}
public
void
setFlag
(
Integer
flag
)
{
this
.
flag
=
flag
;
}
public
String
getUnionId
()
{
return
unionId
;
}
public
void
setUnionId
(
String
unionId
)
{
this
.
unionId
=
unionId
;
}
}
server/src/main/java/com/pica/cloud/account/account/server/service/AccountContactServer.java
浏览文件 @
1a89708f
...
...
@@ -6,4 +6,6 @@ public interface AccountContactServer {
AccountContact
selectByMobile
(
String
mobile
);
void
insertSelective
(
String
mobile
,
Integer
acctId
);
}
server/src/main/java/com/pica/cloud/account/account/server/service/AccountDetailsService.java
0 → 100644
浏览文件 @
1a89708f
package
com
.
pica
.
cloud
.
account
.
account
.
server
.
service
;
import
com.pica.cloud.account.account.server.entity.AccountInfo
;
public
interface
AccountDetailsService
{
int
insertAccountInfo
(
AccountInfo
accountInfo
);
int
updateAccountInfo
(
Integer
id
);
}
server/src/main/java/com/pica/cloud/account/account/server/service/AccountProductService.java
0 → 100644
浏览文件 @
1a89708f
package
com
.
pica
.
cloud
.
account
.
account
.
server
.
service
;
public
interface
AccountProductService
{
int
insertSelective
(
Integer
acctId
,
Integer
productType
);
}
server/src/main/java/com/pica/cloud/account/account/server/service/AccountUnionServer.java
0 → 100644
浏览文件 @
1a89708f
package
com
.
pica
.
cloud
.
account
.
account
.
server
.
service
;
import
com.pica.cloud.account.account.server.entity.AccountUnion
;
import
com.pica.cloud.account.account.server.req.SysCodeReq
;
public
interface
AccountUnionServer
{
AccountUnion
selectByUnionIdAndAcctId
(
SysCodeReq
sysCodeReq
);
}
server/src/main/java/com/pica/cloud/account/account/server/service/AccountUserInfoService.java
浏览文件 @
1a89708f
...
...
@@ -14,12 +14,19 @@ public interface AccountUserInfoService {
/**
* 获取用户信息
*
* @param id
* @return
*/
AcctUserInfo
getUserInfo
(
Integer
id
);
/**
* 插入新的记录
*
* @param acctId acctId
* @return
*/
int
insertUserInfo
(
Integer
acctId
);
}
server/src/main/java/com/pica/cloud/account/account/server/service/impl/AccountContactServerImpl.java
浏览文件 @
1a89708f
...
...
@@ -3,9 +3,12 @@ package com.pica.cloud.account.account.server.service.impl;
import
com.pica.cloud.account.account.server.entity.AccountContact
;
import
com.pica.cloud.account.account.server.mapper.AccountContactMapper
;
import
com.pica.cloud.account.account.server.service.AccountContactServer
;
import
com.pica.cloud.foundation.utils.utils.EncryptCreateUtil
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
java.util.Date
;
@Service
public
class
AccountContactServerImpl
implements
AccountContactServer
{
...
...
@@ -16,4 +19,17 @@ public class AccountContactServerImpl implements AccountContactServer {
public
AccountContact
selectByMobile
(
String
mobile
)
{
return
accountContactMapper
.
selectByMobile
(
mobile
);
}
@Override
public
void
insertSelective
(
String
mobile
,
Integer
acctId
)
{
AccountContact
accountContact
=
new
AccountContact
();
accountContact
.
setModifiedId
(
acctId
.
longValue
());
accountContact
.
setCreatedId
(
acctId
.
longValue
());
accountContact
.
setMobilePhone
(
EncryptCreateUtil
.
encrypt
(
mobile
));
accountContact
.
setAcctId
(
acctId
);
accountContact
.
setCreatedTime
(
new
Date
());
accountContact
.
setModifiedTime
(
new
Date
());
accountContact
.
setDeleteFlag
(
1
);
}
}
server/src/main/java/com/pica/cloud/account/account/server/service/impl/AccountDetailsServiceImpl.java
0 → 100644
浏览文件 @
1a89708f
package
com
.
pica
.
cloud
.
account
.
account
.
server
.
service
.
impl
;
import
com.pica.cloud.account.account.server.entity.AccountInfo
;
import
com.pica.cloud.account.account.server.mapper.AccountDetailsMapper
;
import
com.pica.cloud.account.account.server.service.AccountDetailsService
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
java.util.Date
;
@Service
public
class
AccountDetailsServiceImpl
implements
AccountDetailsService
{
@Autowired
private
AccountDetailsMapper
accountDetailsMapper
;
@Override
public
int
insertAccountInfo
(
AccountInfo
accountInfo
)
{
accountInfo
.
setSex
(
0
);
accountInfo
.
setCreatedId
(
0
);
accountInfo
.
setModifiedId
(
0L
);
accountInfo
.
setCreatedTime
(
new
Date
());
accountInfo
.
setRegTime
(
new
Date
());
accountInfo
.
setModifiedTime
(
new
Date
());
accountInfo
.
setDeleteFlag
(
1
);
return
accountDetailsMapper
.
insertSelective
(
accountInfo
);
}
@Override
public
int
updateAccountInfo
(
Integer
id
)
{
AccountInfo
accountInfo
=
new
AccountInfo
();
accountInfo
.
setId
(
id
.
longValue
());
accountInfo
.
setCreatedId
(
id
);
accountInfo
.
setModifiedId
(
id
.
longValue
());
return
accountDetailsMapper
.
updateByPrimaryKeySelective
(
accountInfo
);
}
}
server/src/main/java/com/pica/cloud/account/account/server/service/impl/AccountInfoServiceImpl.java
浏览文件 @
1a89708f
...
...
@@ -5,6 +5,7 @@ import com.pica.cloud.account.account.server.mapper.AccountInfoMapper;
import
com.pica.cloud.account.account.server.service.AccountInfoService
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
java.util.List
;
/**
...
...
@@ -31,4 +32,6 @@ public class AccountInfoServiceImpl implements AccountInfoService {
public
List
<
Integer
>
getDoctorIds
(
AccountInfoReq
req
)
{
return
accountInfoMapper
.
getDoctorIds
(
req
);
}
}
server/src/main/java/com/pica/cloud/account/account/server/service/impl/AccountProductServiceImpl.java
0 → 100644
浏览文件 @
1a89708f
package
com
.
pica
.
cloud
.
account
.
account
.
server
.
service
.
impl
;
import
com.pica.cloud.account.account.server.entity.AccountProduct
;
import
com.pica.cloud.account.account.server.mapper.AccountProductMapper
;
import
com.pica.cloud.account.account.server.service.AccountProductService
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
java.util.Date
;
@Service
public
class
AccountProductServiceImpl
implements
AccountProductService
{
@Autowired
private
AccountProductMapper
accountProductMapper
;
@Override
public
int
insertSelective
(
Integer
acctId
,
Integer
productType
)
{
AccountProduct
accountProduct
=
new
AccountProduct
();
accountProduct
.
setAcctId
(
acctId
.
longValue
());
accountProduct
.
setCreatedId
(
acctId
.
longValue
());
accountProduct
.
setModifiedId
(
acctId
.
longValue
());
accountProduct
.
setCreatedTime
(
new
Date
());
accountProduct
.
setModifiedTime
(
new
Date
());
accountProduct
.
setDeleteFlag
(
1
);
accountProduct
.
setProductType
(
productType
);
return
accountProductMapper
.
insertSelective
(
accountProduct
);
}
}
server/src/main/java/com/pica/cloud/account/account/server/service/impl/AccountUnionServerImpl.java
0 → 100644
浏览文件 @
1a89708f
package
com
.
pica
.
cloud
.
account
.
account
.
server
.
service
.
impl
;
import
com.pica.cloud.account.account.server.entity.AccountUnion
;
import
com.pica.cloud.account.account.server.mapper.AccountUnionMapper
;
import
com.pica.cloud.account.account.server.req.SysCodeReq
;
import
com.pica.cloud.account.account.server.service.AccountUnionServer
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
@Service
public
class
AccountUnionServerImpl
implements
AccountUnionServer
{
@Autowired
private
AccountUnionMapper
accountUnionMapper
;
@Override
public
AccountUnion
selectByUnionIdAndAcctId
(
SysCodeReq
sysCodeReq
)
{
return
accountUnionMapper
.
selectByUnionIdAndAcctId
(
sysCodeReq
);
}
}
server/src/main/java/com/pica/cloud/account/account/server/service/impl/AccountUserInfoServiceImpl.java
浏览文件 @
1a89708f
...
...
@@ -6,6 +6,8 @@ import com.pica.cloud.account.account.server.service.AccountUserInfoService;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
java.util.Date
;
@Service
public
class
AccountUserInfoServiceImpl
implements
AccountUserInfoService
{
...
...
@@ -20,7 +22,6 @@ public class AccountUserInfoServiceImpl implements AccountUserInfoService {
int
result
=
acctUserInfoMapper
.
updateByPrimaryKeySelective
(
acctUserInfo
);
//把更新日志插入到记录表中
Integer
acctId
=
acctUserInfo
.
getAcctId
();
//todo:两个实体怎么转化? 不可能把数据全部取出来赋值吧
AcctUserInfo
newAcctUserInfo
=
acctUserInfoMapper
.
selectByPrimaryKey
(
acctId
);
acctUserInfoMapper
.
insert
(
newAcctUserInfo
);
...
...
@@ -31,4 +32,18 @@ public class AccountUserInfoServiceImpl implements AccountUserInfoService {
public
AcctUserInfo
getUserInfo
(
Integer
id
)
{
return
acctUserInfoMapper
.
selectByPrimaryKey
(
id
);
}
@Override
public
int
insertUserInfo
(
Integer
acctId
)
{
AcctUserInfo
acctUserInfo
=
new
AcctUserInfo
();
acctUserInfo
.
setAcctId
(
acctId
);
acctUserInfo
.
setCreateId
(
acctId
);
acctUserInfo
.
setCreateTime
(
new
Date
());
acctUserInfo
.
setModifyId
(
acctId
);
acctUserInfo
.
setModifyTime
(
new
Date
());
acctUserInfo
.
setDeleteFlag
(
1
);
int
userId
=
acctUserInfoMapper
.
insertSelective
(
acctUserInfo
);
return
userId
;
}
}
server/src/main/java/com/pica/cloud/account/account/server/service/ModifyMobileServiceImpl.java
→
server/src/main/java/com/pica/cloud/account/account/server/service/
impl/
ModifyMobileServiceImpl.java
浏览文件 @
1a89708f
package
com
.
pica
.
cloud
.
account
.
account
.
server
.
service
;
package
com
.
pica
.
cloud
.
account
.
account
.
server
.
service
.
impl
;
import
com.pica.cloud.account.account.server.entity.AccountContact
;
import
com.pica.cloud.account.account.server.mapper.AccountContactMapper
;
import
com.pica.cloud.account.account.server.service.ModifyMobileService
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
...
...
server/src/main/java/com/pica/cloud/account/account/server/service/impl/PasswordServiceImpl.java
浏览文件 @
1a89708f
...
...
@@ -10,6 +10,7 @@ import com.pica.cloud.account.account.server.mapper.LogPasswordModifyMapper;
import
com.pica.cloud.account.account.server.req.ForgetPasswordReq
;
import
com.pica.cloud.account.account.server.req.PasswordReq
;
import
com.pica.cloud.account.account.server.service.PasswordService
;
import
com.pica.cloud.foundation.utils.utils.EncryptCreateUtil
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
...
...
@@ -33,14 +34,14 @@ public class PasswordServiceImpl implements PasswordService {
//更新密码
AccountInfo
accountInfo
=
new
AccountInfo
();
accountInfo
.
setId
(
id
.
longValue
());
accountInfo
.
setPassword
(
modifyPasswordReq
.
getOldPsw
(
));
accountInfo
.
setPassword
(
EncryptCreateUtil
.
encrypt
(
modifyPasswordReq
.
getOldPsw
()
));
accountDetailsMapper
.
updatePasswordById
(
accountInfo
);
//记录密码更新日志
LogPasswordModify
logPasswordModify
=
new
LogPasswordModify
();
logPasswordModify
.
setCreatedId
(
id
.
longValue
());
logPasswordModify
.
setModifiedId
(
id
);
logPasswordModify
.
setNewPwd
(
modifyPasswordReq
.
getNewPsw
(
));
logPasswordModify
.
setOldPwd
(
AccountInfoEntity
.
getPassword
(
));
logPasswordModify
.
setNewPwd
(
EncryptCreateUtil
.
encrypt
(
modifyPasswordReq
.
getNewPsw
()
));
logPasswordModify
.
setOldPwd
(
EncryptCreateUtil
.
encrypt
(
AccountInfoEntity
.
getPassword
()
));
AccountContact
accountContact
=
accountContactMapper
.
selectByPrimaryKey
(
id
.
longValue
());
logPasswordModify
.
setMobilePhone
(
accountContact
.
getMobilePhone
());
logPasswordModifyMapper
.
insertSelective
(
logPasswordModify
);
...
...
@@ -51,13 +52,13 @@ public class PasswordServiceImpl implements PasswordService {
AccountContact
accountContact
=
accountContactMapper
.
selectByMobile
(
forgetPasswordReq
.
getMobile
());
AccountInfo
accountInfo
=
new
AccountInfo
();
accountInfo
.
setId
(
accountContact
.
getAcctId
().
longValue
());
accountInfo
.
setPassword
(
forgetPasswordReq
.
getNewPsw
(
));
accountInfo
.
setPassword
(
EncryptCreateUtil
.
encrypt
(
forgetPasswordReq
.
getNewPsw
()
));
accountDetailsMapper
.
updatePasswordById
(
accountInfo
);
//记录更新日志
LogPasswordModify
logPasswordModify
=
new
LogPasswordModify
();
logPasswordModify
.
setCreatedId
(
accountContact
.
getAcctId
().
longValue
());
logPasswordModify
.
setModifiedId
(
accountContact
.
getAcctId
());
logPasswordModify
.
setNewPwd
(
forgetPasswordReq
.
getNewPsw
(
));
logPasswordModify
.
setNewPwd
(
EncryptCreateUtil
.
encrypt
(
forgetPasswordReq
.
getNewPsw
()
));
logPasswordModify
.
setOldPwd
(
""
);
logPasswordModify
.
setMobilePhone
(
forgetPasswordReq
.
getMobile
());
logPasswordModifyMapper
.
insertSelective
(
logPasswordModify
);
...
...
server/src/main/java/com/pica/cloud/account/account/server/util/AccountUtils.java
浏览文件 @
1a89708f
...
...
@@ -2,15 +2,22 @@ package com.pica.cloud.account.account.server.util;
import
com.pica.cloud.foundation.entity.PicaException
;
import
com.pica.cloud.foundation.entity.PicaResultCode
;
import
com.pica.cloud.foundation.redis.CacheClient
;
import
com.pica.cloud.foundation.utils.utils.EncryptCreateUtil
;
import
com.pica.cloud.foundation.utils.utils.ValidateUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Component
;
/**
* 账户工具类
*/
@Component
public
class
AccountUtils
{
@Autowired
private
CacheClient
cacheClient
;
private
static
final
String
AUTH_CODE_PREFIX
=
"authCode-"
;
//手机格式校验
...
...
@@ -25,4 +32,23 @@ public class AccountUtils {
return
AUTH_CODE_PREFIX
+
flag
+
"-"
+
EncryptCreateUtil
.
encrypt
(
mobilePhone
);
}
//校验验证码
public
void
checkAuthCode
(
String
mobile
,
String
type
,
String
sysCode
)
{
String
flag
=
org
.
apache
.
commons
.
lang
.
StringUtils
.
isBlank
(
type
)
?
"0"
:
type
;
if
(
org
.
apache
.
commons
.
lang
.
StringUtils
.
isBlank
(
sysCode
))
{
throw
new
PicaException
(
PicaResultCode
.
PARAM_IS_INVALID
.
code
(),
"短信验证码错误"
);
}
String
authCodeKey
=
AccountUtils
.
getAuthCodeKey
(
mobile
,
flag
);
String
cacheCode
=
cacheClient
.
get
(
authCodeKey
);
//从redis获取验证码
if
(
org
.
apache
.
commons
.
lang
.
StringUtils
.
isBlank
(
cacheCode
))
{
throw
new
PicaException
(
PicaResultCode
.
RESULE_DATA_NONE
.
code
(),
"短信验证码已过期,请重新获取"
);
}
if
(!
org
.
apache
.
commons
.
lang
.
StringUtils
.
equals
(
sysCode
,
cacheCode
))
{
throw
new
PicaException
(
PicaResultCode
.
PARAM_IS_INVALID
.
code
(),
"短信验证码错误"
);
}
//清除验证码
cacheClient
.
del
(
authCodeKey
);
}
}
server/src/main/resources/mybatis/AccountDetailsMapper.xml
浏览文件 @
1a89708f
...
...
@@ -27,22 +27,13 @@
from accout_info
where id = #{id,jdbcType=BIGINT}
</select>
<delete
id=
"deleteByPrimaryKey"
parameterType=
"java.lang.Long"
>
delete from accout_info
where id = #{id,jdbcType=BIGINT}
</delete>
<insert
id=
"insert"
parameterType=
"com.pica.cloud.account.account.server.entity.AccountInfo"
>
insert into accout_info (id, password, name,
age, birthday, sex, id_card,
reg_time, register_source, delete_flag,
created_id, created_time, modified_id,
modified_time)
values (#{id,jdbcType=BIGINT}, #{password,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR},
#{age,jdbcType=TINYINT}, #{birthday,jdbcType=DATE}, #{sex,jdbcType=TINYINT}, #{idCard,jdbcType=VARCHAR},
#{regTime,jdbcType=TIMESTAMP}, #{registerSource,jdbcType=INTEGER}, #{deleteFlag,jdbcType=INTEGER},
#{createdId,jdbcType=INTEGER}, #{createdTime,jdbcType=TIMESTAMP}, #{modifiedId,jdbcType=BIGINT},
#{modifiedTime,jdbcType=TIMESTAMP})
</insert>
<!--通过id更新密码-->
<update
id=
"updatePasswordById"
parameterType=
"com.pica.cloud.account.account.server.entity.AccountInfo"
>
update accout_info set password=#{password,jdbcType=VARCHAR} where id=#{id}
</update>
<!--插入用户信息-->
<insert
id=
"insertSelective"
parameterType=
"com.pica.cloud.account.account.server.entity.AccountInfo"
>
insert into accout_info
<trim
prefix=
"("
suffix=
")"
suffixOverrides=
","
>
...
...
@@ -135,13 +126,7 @@
</trim>
</insert>
<!--通过id更新密码-->
<update
id=
"updatePasswordById"
parameterType=
"com.pica.cloud.account.account.server.entity.AccountInfo"
>
update accout_info set password=#{password,jdbcType=VARCHAR} where id=#{id}
</update>
<!--更新用户信息-->
<update
id=
"updateByPrimaryKeySelective"
parameterType=
"com.pica.cloud.account.account.server.entity.AccountInfo"
>
update accout_info
<set>
...
...
@@ -187,6 +172,29 @@
</set>
where id = #{id,jdbcType=BIGINT}
</update>
<insert
id=
"insert"
parameterType=
"com.pica.cloud.account.account.server.entity.AccountInfo"
>
insert into accout_info (id, password, name,
age, birthday, sex, id_card,
reg_time, register_source, delete_flag,
created_id, created_time, modified_id,
modified_time)
values (#{id,jdbcType=BIGINT}, #{password,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR},
#{age,jdbcType=TINYINT}, #{birthday,jdbcType=DATE}, #{sex,jdbcType=TINYINT}, #{idCard,jdbcType=VARCHAR},
#{regTime,jdbcType=TIMESTAMP}, #{registerSource,jdbcType=INTEGER}, #{deleteFlag,jdbcType=INTEGER},
#{createdId,jdbcType=INTEGER}, #{createdTime,jdbcType=TIMESTAMP}, #{modifiedId,jdbcType=BIGINT},
#{modifiedTime,jdbcType=TIMESTAMP})
</insert>
<update
id=
"updateByPrimaryKey"
parameterType=
"com.pica.cloud.account.account.server.entity.AccountInfo"
>
update accout_info
set password = #{password,jdbcType=VARCHAR},
...
...
server/src/main/resources/mybatis/AccountProductMapper.xml
0 → 100644
浏览文件 @
1a89708f
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper
namespace=
"com.pica.cloud.account.account.server.mapper.AccountProductMapper"
>
<resultMap
id=
"BaseResultMap"
type=
"com.pica.cloud.account.account.server.entity.AccountProduct"
>
<id
column=
"id"
property=
"id"
jdbcType=
"BIGINT"
/>
<result
column=
"acct_id"
property=
"acctId"
jdbcType=
"BIGINT"
/>
<result
column=
"product_type"
property=
"productType"
jdbcType=
"INTEGER"
/>
<result
column=
"delete_flag"
property=
"deleteFlag"
jdbcType=
"INTEGER"
/>
<result
column=
"created_id"
property=
"createdId"
jdbcType=
"BIGINT"
/>
<result
column=
"created_time"
property=
"createdTime"
jdbcType=
"TIMESTAMP"
/>
<result
column=
"modified_id"
property=
"modifiedId"
jdbcType=
"BIGINT"
/>
<result
column=
"modified_time"
property=
"modifiedTime"
jdbcType=
"TIMESTAMP"
/>
</resultMap>
<sql
id=
"Base_Column_List"
>
id, acct_id, product_type, delete_flag, created_id, created_time, modified_id, modified_time
</sql>
<select
id=
"selectByPrimaryKey"
resultMap=
"BaseResultMap"
parameterType=
"java.lang.Long"
>
select
<include
refid=
"Base_Column_List"
/>
from account_product
where id = #{id,jdbcType=BIGINT}
</select>
<delete
id=
"deleteByPrimaryKey"
parameterType=
"java.lang.Long"
>
delete from account_product
where id = #{id,jdbcType=BIGINT}
</delete>
<insert
id=
"insert"
parameterType=
"com.pica.cloud.account.account.server.entity.AccountProduct"
>
insert into account_product (id, acct_id, product_type,
delete_flag, created_id, created_time,
modified_id, modified_time)
values (#{id,jdbcType=BIGINT}, #{acctId,jdbcType=BIGINT}, #{productType,jdbcType=INTEGER},
#{deleteFlag,jdbcType=INTEGER}, #{createdId,jdbcType=BIGINT}, #{createdTime,jdbcType=TIMESTAMP},
#{modifiedId,jdbcType=BIGINT}, #{modifiedTime,jdbcType=TIMESTAMP})
</insert>
<insert
id=
"insertSelective"
parameterType=
"com.pica.cloud.account.account.server.entity.AccountProduct"
>
insert into account_product
<trim
prefix=
"("
suffix=
")"
suffixOverrides=
","
>
<if
test=
"id != null"
>
id,
</if>
<if
test=
"acctId != null"
>
acct_id,
</if>
<if
test=
"productType != null"
>
product_type,
</if>
<if
test=
"deleteFlag != null"
>
delete_flag,
</if>
<if
test=
"createdId != null"
>
created_id,
</if>
<if
test=
"createdTime != null"
>
created_time,
</if>
<if
test=
"modifiedId != null"
>
modified_id,
</if>
<if
test=
"modifiedTime != null"
>
modified_time,
</if>
</trim>
<trim
prefix=
"values ("
suffix=
")"
suffixOverrides=
","
>
<if
test=
"id != null"
>
#{id,jdbcType=BIGINT},
</if>
<if
test=
"acctId != null"
>
#{acctId,jdbcType=BIGINT},
</if>
<if
test=
"productType != null"
>
#{productType,jdbcType=INTEGER},
</if>
<if
test=
"deleteFlag != null"
>
#{deleteFlag,jdbcType=INTEGER},
</if>
<if
test=
"createdId != null"
>
#{createdId,jdbcType=BIGINT},
</if>
<if
test=
"createdTime != null"
>
#{createdTime,jdbcType=TIMESTAMP},
</if>
<if
test=
"modifiedId != null"
>
#{modifiedId,jdbcType=BIGINT},
</if>
<if
test=
"modifiedTime != null"
>
#{modifiedTime,jdbcType=TIMESTAMP},
</if>
</trim>
</insert>
<update
id=
"updateByPrimaryKeySelective"
parameterType=
"com.pica.cloud.account.account.server.entity.AccountProduct"
>
update account_product
<set
>
<if
test=
"acctId != null"
>
acct_id = #{acctId,jdbcType=BIGINT},
</if>
<if
test=
"productType != null"
>
product_type = #{productType,jdbcType=INTEGER},
</if>
<if
test=
"deleteFlag != null"
>
delete_flag = #{deleteFlag,jdbcType=INTEGER},
</if>
<if
test=
"createdId != null"
>
created_id = #{createdId,jdbcType=BIGINT},
</if>
<if
test=
"createdTime != null"
>
created_time = #{createdTime,jdbcType=TIMESTAMP},
</if>
<if
test=
"modifiedId != null"
>
modified_id = #{modifiedId,jdbcType=BIGINT},
</if>
<if
test=
"modifiedTime != null"
>
modified_time = #{modifiedTime,jdbcType=TIMESTAMP},
</if>
</set>
where id = #{id,jdbcType=BIGINT}
</update>
<update
id=
"updateByPrimaryKey"
parameterType=
"com.pica.cloud.account.account.server.entity.AccountProduct"
>
update account_product
set acct_id = #{acctId,jdbcType=BIGINT},
product_type = #{productType,jdbcType=INTEGER},
delete_flag = #{deleteFlag,jdbcType=INTEGER},
created_id = #{createdId,jdbcType=BIGINT},
created_time = #{createdTime,jdbcType=TIMESTAMP},
modified_id = #{modifiedId,jdbcType=BIGINT},
modified_time = #{modifiedTime,jdbcType=TIMESTAMP}
where id = #{id,jdbcType=BIGINT}
</update>
</mapper>
\ No newline at end of file
server/src/main/resources/mybatis/AccountUnionMapper.xml
0 → 100644
浏览文件 @
1a89708f
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper
namespace=
"com.pica.cloud.account.account.server.mapper.AccountUnionMapper"
>
<resultMap
id=
"BaseResultMap"
type=
"com.pica.cloud.account.account.server.entity.AccountUnion"
>
<id
column=
"id"
property=
"id"
jdbcType=
"BIGINT"
/>
<result
column=
"acct_id"
property=
"acctId"
jdbcType=
"BIGINT"
/>
<result
column=
"union_type"
property=
"unionType"
jdbcType=
"INTEGER"
/>
<result
column=
"union_id"
property=
"unionId"
jdbcType=
"VARCHAR"
/>
<result
column=
"nickname"
property=
"nickname"
jdbcType=
"VARCHAR"
/>
<result
column=
"head_img_url"
property=
"headImgUrl"
jdbcType=
"VARCHAR"
/>
<result
column=
"delete_flag"
property=
"deleteFlag"
jdbcType=
"INTEGER"
/>
<result
column=
"created_id"
property=
"createdId"
jdbcType=
"BIGINT"
/>
<result
column=
"created_time"
property=
"createdTime"
jdbcType=
"TIMESTAMP"
/>
<result
column=
"modified_id"
property=
"modifiedId"
jdbcType=
"BIGINT"
/>
<result
column=
"modified_time"
property=
"modifiedTime"
jdbcType=
"TIMESTAMP"
/>
</resultMap>
<sql
id=
"Base_Column_List"
>
id, acct_id, union_type, union_id, nickname, head_img_url, delete_flag, created_id,
created_time, modified_id, modified_time
</sql>
<!--查询是否绑定过微信-->
<select
id=
"selectByUnionIdAndAcctId"
parameterType=
"com.pica.cloud.account.account.server.req.SysCodeReq"
resultMap=
"BaseResultMap"
>
select
<include
refid=
"Base_Column_List"
/>
from account_union
where acct_id=#{acctId} and union_id =#{unionId}
</select>
<select
id=
"selectByPrimaryKey"
resultMap=
"BaseResultMap"
parameterType=
"java.lang.Long"
>
select
<include
refid=
"Base_Column_List"
/>
from account_union
where id = #{id,jdbcType=BIGINT}
</select>
<delete
id=
"deleteByPrimaryKey"
parameterType=
"java.lang.Long"
>
delete from account_union
where id = #{id,jdbcType=BIGINT}
</delete>
<insert
id=
"insert"
parameterType=
"com.pica.cloud.account.account.server.entity.AccountUnion"
>
insert into account_union (id, acct_id, union_type,
union_id, nickname, head_img_url,
delete_flag, created_id, created_time,
modified_id, modified_time)
values (#{id,jdbcType=BIGINT}, #{acctId,jdbcType=BIGINT}, #{unionType,jdbcType=INTEGER},
#{unionId,jdbcType=VARCHAR}, #{nickname,jdbcType=VARCHAR}, #{headImgUrl,jdbcType=VARCHAR},
#{deleteFlag,jdbcType=INTEGER}, #{createdId,jdbcType=BIGINT}, #{createdTime,jdbcType=TIMESTAMP},
#{modifiedId,jdbcType=BIGINT}, #{modifiedTime,jdbcType=TIMESTAMP})
</insert>
<insert
id=
"insertSelective"
parameterType=
"com.pica.cloud.account.account.server.entity.AccountUnion"
>
insert into account_union
<trim
prefix=
"("
suffix=
")"
suffixOverrides=
","
>
<if
test=
"id != null"
>
id,
</if>
<if
test=
"acctId != null"
>
acct_id,
</if>
<if
test=
"unionType != null"
>
union_type,
</if>
<if
test=
"unionId != null"
>
union_id,
</if>
<if
test=
"nickname != null"
>
nickname,
</if>
<if
test=
"headImgUrl != null"
>
head_img_url,
</if>
<if
test=
"deleteFlag != null"
>
delete_flag,
</if>
<if
test=
"createdId != null"
>
created_id,
</if>
<if
test=
"createdTime != null"
>
created_time,
</if>
<if
test=
"modifiedId != null"
>
modified_id,
</if>
<if
test=
"modifiedTime != null"
>
modified_time,
</if>
</trim>
<trim
prefix=
"values ("
suffix=
")"
suffixOverrides=
","
>
<if
test=
"id != null"
>
#{id,jdbcType=BIGINT},
</if>
<if
test=
"acctId != null"
>
#{acctId,jdbcType=BIGINT},
</if>
<if
test=
"unionType != null"
>
#{unionType,jdbcType=INTEGER},
</if>
<if
test=
"unionId != null"
>
#{unionId,jdbcType=VARCHAR},
</if>
<if
test=
"nickname != null"
>
#{nickname,jdbcType=VARCHAR},
</if>
<if
test=
"headImgUrl != null"
>
#{headImgUrl,jdbcType=VARCHAR},
</if>
<if
test=
"deleteFlag != null"
>
#{deleteFlag,jdbcType=INTEGER},
</if>
<if
test=
"createdId != null"
>
#{createdId,jdbcType=BIGINT},
</if>
<if
test=
"createdTime != null"
>
#{createdTime,jdbcType=TIMESTAMP},
</if>
<if
test=
"modifiedId != null"
>
#{modifiedId,jdbcType=BIGINT},
</if>
<if
test=
"modifiedTime != null"
>
#{modifiedTime,jdbcType=TIMESTAMP},
</if>
</trim>
</insert>
<update
id=
"updateByPrimaryKeySelective"
parameterType=
"com.pica.cloud.account.account.server.entity.AccountUnion"
>
update account_union
<set>
<if
test=
"acctId != null"
>
acct_id = #{acctId,jdbcType=BIGINT},
</if>
<if
test=
"unionType != null"
>
union_type = #{unionType,jdbcType=INTEGER},
</if>
<if
test=
"unionId != null"
>
union_id = #{unionId,jdbcType=VARCHAR},
</if>
<if
test=
"nickname != null"
>
nickname = #{nickname,jdbcType=VARCHAR},
</if>
<if
test=
"headImgUrl != null"
>
head_img_url = #{headImgUrl,jdbcType=VARCHAR},
</if>
<if
test=
"deleteFlag != null"
>
delete_flag = #{deleteFlag,jdbcType=INTEGER},
</if>
<if
test=
"createdId != null"
>
created_id = #{createdId,jdbcType=BIGINT},
</if>
<if
test=
"createdTime != null"
>
created_time = #{createdTime,jdbcType=TIMESTAMP},
</if>
<if
test=
"modifiedId != null"
>
modified_id = #{modifiedId,jdbcType=BIGINT},
</if>
<if
test=
"modifiedTime != null"
>
modified_time = #{modifiedTime,jdbcType=TIMESTAMP},
</if>
</set>
where id = #{id,jdbcType=BIGINT}
</update>
<update
id=
"updateByPrimaryKey"
parameterType=
"com.pica.cloud.account.account.server.entity.AccountUnion"
>
update account_union
set acct_id = #{acctId,jdbcType=BIGINT},
union_type = #{unionType,jdbcType=INTEGER},
union_id = #{unionId,jdbcType=VARCHAR},
nickname = #{nickname,jdbcType=VARCHAR},
head_img_url = #{headImgUrl,jdbcType=VARCHAR},
delete_flag = #{deleteFlag,jdbcType=INTEGER},
created_id = #{createdId,jdbcType=BIGINT},
created_time = #{createdTime,jdbcType=TIMESTAMP},
modified_id = #{modifiedId,jdbcType=BIGINT},
modified_time = #{modifiedTime,jdbcType=TIMESTAMP}
where id = #{id,jdbcType=BIGINT}
</update>
</mapper>
\ No newline at end of file
写
预览
Markdown
格式
0%
请重试
or
附加一个文件
附加文件
取消
您添加了
0
人
到此讨论。请谨慎行事。
先完成此消息的编辑!
取消
想要评论请
注册
或
登录