Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
T
tcm-system
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
TCM
tcm-system
Commits
b0d0dfcb
Commit
b0d0dfcb
authored
Jan 21, 2025
by
dmy
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改密码短信发送
parent
48821548
Changes
7
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
127 additions
and
45 deletions
+127
-45
pom.xml
pom.xml
+5
-0
UserApp.java
src/main/java/com/pangding/web/UserApp.java
+14
-0
UserController.java
...com/pangding/web/authority/controller/UserController.java
+52
-32
UserService.java
.../java/com/pangding/web/authority/service/UserService.java
+6
-2
UserServiceImpl.java
.../pangding/web/authority/service/impl/UserServiceImpl.java
+39
-10
WebUserReqVo.java
...ava/com/pangding/web/authority/vo/reqvo/WebUserReqVo.java
+10
-0
bootstrap.yml
src/main/resources/bootstrap.yml
+1
-1
No files found.
pom.xml
View file @
b0d0dfcb
...
@@ -47,6 +47,11 @@
...
@@ -47,6 +47,11 @@
<groupId>
com.pangding.web
</groupId>
<groupId>
com.pangding.web
</groupId>
<artifactId>
pd-partner-ref
</artifactId>
<artifactId>
pd-partner-ref
</artifactId>
</dependency>
</dependency>
<dependency>
<groupId>
com.yanzuoguang
</groupId>
<artifactId>
yzg-util-redis
</artifactId>
<version>
1.2-SNAPSHOT
</version>
</dependency>
<dependency>
<dependency>
<groupId>
org.freemarker
</groupId>
<groupId>
org.freemarker
</groupId>
<artifactId>
freemarker
</artifactId>
<artifactId>
freemarker
</artifactId>
...
...
src/main/java/com/pangding/web/UserApp.java
View file @
b0d0dfcb
package
com
.
pangding
.
web
;
package
com
.
pangding
.
web
;
import
com.alicp.jetcache.anno.config.EnableCreateCacheAnnotation
;
import
com.alicp.jetcache.anno.config.EnableMethodCache
;
import
org.springframework.boot.CommandLineRunner
;
import
org.springframework.boot.CommandLineRunner
;
import
org.springframework.boot.SpringApplication
;
import
org.springframework.boot.SpringApplication
;
import
org.springframework.boot.autoconfigure.SpringBootApplication
;
import
org.springframework.boot.autoconfigure.SpringBootApplication
;
import
org.springframework.cache.annotation.EnableCaching
;
import
org.springframework.cloud.netflix.eureka.EnableEurekaClient
;
import
org.springframework.cloud.netflix.eureka.EnableEurekaClient
;
import
org.springframework.cloud.openfeign.EnableFeignClients
;
import
org.springframework.cloud.openfeign.EnableFeignClients
;
import
org.springframework.scheduling.annotation.EnableAsync
;
import
org.springframework.scheduling.annotation.EnableScheduling
;
/**
/**
* 日志自动启动服务
* 日志自动启动服务
...
@@ -20,6 +25,15 @@ import org.springframework.cloud.openfeign.EnableFeignClients;
...
@@ -20,6 +25,15 @@ import org.springframework.cloud.openfeign.EnableFeignClients;
"com.pangding.*"
,
"com.pangding.*"
,
"com.yanzuoguang.*"
"com.yanzuoguang.*"
})
})
@EnableMethodCache
(
basePackages
=
{
"com.pangding.*"
,
"com.tourbida"
,
"com.yanzuoguang"
})
@EnableCreateCacheAnnotation
@EnableScheduling
@EnableCaching
@EnableAsync
public
class
UserApp
implements
CommandLineRunner
{
public
class
UserApp
implements
CommandLineRunner
{
public
static
void
main
(
String
[]
args
)
{
public
static
void
main
(
String
[]
args
)
{
...
...
src/main/java/com/pangding/web/authority/controller/UserController.java
View file @
b0d0dfcb
...
@@ -36,18 +36,19 @@ public class UserController {
...
@@ -36,18 +36,19 @@ public class UserController {
/**
/**
* 新增用户
* 新增用户
* 返回用户id
* 返回用户id
*
* @param webUserReqVo
* @param webUserReqVo
* @return
* @return
*/
*/
@RequestMapping
(
value
=
"/save"
,
method
=
RequestMethod
.
POST
,
produces
=
MediaType
.
APPLICATION_JSON_UTF8_VALUE
)
@RequestMapping
(
value
=
"/save"
,
method
=
RequestMethod
.
POST
,
produces
=
MediaType
.
APPLICATION_JSON_UTF8_VALUE
)
public
ResponseResult
<
String
>
saveUser
(
@RequestBody
WebUserReqVo
webUserReqVo
)
throws
Exception
{
public
ResponseResult
<
String
>
saveUser
(
@RequestBody
WebUserReqVo
webUserReqVo
)
throws
Exception
{
CheckerHelper
.
newInstance
()
CheckerHelper
.
newInstance
()
.
notBlankCheck
(
"account"
,
webUserReqVo
.
getAccount
())
.
notBlankCheck
(
"account"
,
webUserReqVo
.
getAccount
())
.
notBlankCheck
(
"password"
,
webUserReqVo
.
getPassword
())
.
notBlankCheck
(
"password"
,
webUserReqVo
.
getPassword
())
.
notBlankCheck
(
"confirmPassword"
,
webUserReqVo
.
getConfirmPassword
())
.
notBlankCheck
(
"confirmPassword"
,
webUserReqVo
.
getConfirmPassword
())
.
checkPhoneNo
(
"phone"
,
webUserReqVo
.
getPhone
())
.
checkPhoneNo
(
"phone"
,
webUserReqVo
.
getPhone
())
.
notBlankCheck
(
"companyId"
,
webUserReqVo
.
getCompanyId
())
.
notBlankCheck
(
"companyId"
,
webUserReqVo
.
getCompanyId
())
.
notBlankCheck
(
"email"
,
webUserReqVo
.
getEmail
())
.
notBlankCheck
(
"email"
,
webUserReqVo
.
getEmail
())
.
checkException
();
.
checkException
();
return
ResponseResult
.
result
(
userServiceImpl
.
saveUser
(
webUserReqVo
));
return
ResponseResult
.
result
(
userServiceImpl
.
saveUser
(
webUserReqVo
));
}
}
...
@@ -55,91 +56,97 @@ public class UserController {
...
@@ -55,91 +56,97 @@ public class UserController {
/**
/**
* 修改用户信息
* 修改用户信息
* 返回用户id
* 返回用户id
*
* @param
* @param
* @return
* @return
*/
*/
@RequestMapping
(
value
=
"/update"
,
method
=
RequestMethod
.
POST
,
produces
=
MediaType
.
APPLICATION_JSON_UTF8_VALUE
)
@RequestMapping
(
value
=
"/update"
,
method
=
RequestMethod
.
POST
,
produces
=
MediaType
.
APPLICATION_JSON_UTF8_VALUE
)
public
ResponseResult
<
String
>
updateUser
(
@RequestBody
WebUserReqVo
webUserReqVo
){
public
ResponseResult
<
String
>
updateUser
(
@RequestBody
WebUserReqVo
webUserReqVo
)
{
try
{
try
{
if
(!
StringHelper
.
isEmpty
(
webUserReqVo
.
getUpdateType
())
&&
1
==
webUserReqVo
.
getUpdateType
())
{
if
(!
StringHelper
.
isEmpty
(
webUserReqVo
.
getUpdateType
())
&&
1
==
webUserReqVo
.
getUpdateType
())
{
// 修改密码
// 修改密码
CheckerHelper
.
newInstance
()
CheckerHelper
.
newInstance
()
.
notBlankCheck
(
"id"
,
webUserReqVo
.
getId
())
.
notBlankCheck
(
"id"
,
webUserReqVo
.
getId
())
.
notBlankCheck
(
"password"
,
webUserReqVo
.
getPassword
())
.
notBlankCheck
(
"password"
,
webUserReqVo
.
getPassword
())
.
notBlankCheck
(
"confirmPassword"
,
webUserReqVo
.
getConfirmPassword
())
.
notBlankCheck
(
"confirmPassword"
,
webUserReqVo
.
getConfirmPassword
())
.
notBlankCheck
(
"verifyCode"
,
webUserReqVo
.
getVerifyCode
())
.
checkException
();
.
checkException
();
String
password
=
RSAUtils
.
decryptionByPrivateKey
(
webUserReqVo
.
getPassword
(),
RsaConstant
.
privateKey
);
String
password
=
RSAUtils
.
decryptionByPrivateKey
(
webUserReqVo
.
getPassword
(),
RsaConstant
.
privateKey
);
String
confirmPassword
=
RSAUtils
.
decryptionByPrivateKey
(
webUserReqVo
.
getConfirmPassword
(),
RsaConstant
.
privateKey
);
String
confirmPassword
=
RSAUtils
.
decryptionByPrivateKey
(
webUserReqVo
.
getConfirmPassword
(),
RsaConstant
.
privateKey
);
if
(!
StringHelper
.
compare
(
password
,
confirmPassword
))
{
if
(!
StringHelper
.
compare
(
password
,
confirmPassword
))
{
throw
new
CodeException
(
"两次密码输入不一致"
);
throw
new
CodeException
(
"两次密码输入不一致"
);
}
}
webUserReqVo
.
setPassword
(
password
);
webUserReqVo
.
setPassword
(
password
);
webUserReqVo
.
setConfirmPassword
(
confirmPassword
);
webUserReqVo
.
setConfirmPassword
(
confirmPassword
);
}
else
{
}
else
{
CheckerHelper
.
newInstance
()
CheckerHelper
.
newInstance
()
.
notBlankCheck
(
"account"
,
webUserReqVo
.
getAccount
())
.
notBlankCheck
(
"account"
,
webUserReqVo
.
getAccount
())
.
notBlankCheck
(
"password"
,
webUserReqVo
.
getPassword
())
.
notBlankCheck
(
"password"
,
webUserReqVo
.
getPassword
())
.
checkPhoneNo
(
"phone"
,
webUserReqVo
.
getPhone
())
.
checkPhoneNo
(
"phone"
,
webUserReqVo
.
getPhone
())
.
notBlankCheck
(
"companyId"
,
webUserReqVo
.
getCompanyId
())
.
notBlankCheck
(
"companyId"
,
webUserReqVo
.
getCompanyId
())
.
checkException
();
.
checkException
();
}
}
return
ResponseResult
.
result
(
userServiceImpl
.
updateUser
(
webUserReqVo
));
return
ResponseResult
.
result
(
userServiceImpl
.
updateUser
(
webUserReqVo
));
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
return
(
ResponseResult
)
ResponseResult
.
error
(
"99"
,
e
.
getMessage
());
return
(
ResponseResult
)
ResponseResult
.
error
(
"99"
,
e
.
getMessage
());
}
}
}
}
/**
/**
* 查询用户列表
* 查询用户列表
*
* @return
* @return
*/
*/
@RequestMapping
(
value
=
"/list"
,
method
=
RequestMethod
.
POST
,
produces
=
MediaType
.
APPLICATION_JSON_UTF8_VALUE
)
@RequestMapping
(
value
=
"/list"
,
method
=
RequestMethod
.
POST
,
produces
=
MediaType
.
APPLICATION_JSON_UTF8_VALUE
)
public
ResponseResult
<
PageSizeData
<
WebUserResVo
>>
listUsers
(
@RequestBody
QueryUserReqVo
reqVo
){
public
ResponseResult
<
PageSizeData
<
WebUserResVo
>>
listUsers
(
@RequestBody
QueryUserReqVo
reqVo
)
{
return
ResponseResult
.
result
(
userServiceImpl
.
getWebUserResVoList
(
reqVo
));
return
ResponseResult
.
result
(
userServiceImpl
.
getWebUserResVoList
(
reqVo
));
}
}
/**
/**
* 查询公司用户列表(新)
* 查询公司用户列表(新)
*
* @return
* @return
*/
*/
@RequestMapping
(
value
=
"/userList"
,
method
=
RequestMethod
.
POST
,
produces
=
MediaType
.
APPLICATION_JSON_UTF8_VALUE
)
@RequestMapping
(
value
=
"/userList"
,
method
=
RequestMethod
.
POST
,
produces
=
MediaType
.
APPLICATION_JSON_UTF8_VALUE
)
@ApiOperation
(
value
=
"查询用户列表"
,
notes
=
"返回用户列表信息."
)
@ApiOperation
(
value
=
"查询用户列表"
,
notes
=
"返回用户列表信息."
)
public
ResponseResult
<
PageSizeData
<
UserVo
>>
userList
(
@RequestBody
QueryUserReqVo
reqVo
){
public
ResponseResult
<
PageSizeData
<
UserVo
>>
userList
(
@RequestBody
QueryUserReqVo
reqVo
)
{
return
ResponseResult
.
result
(
userServiceImpl
.
getUserVoList
(
reqVo
));
return
ResponseResult
.
result
(
userServiceImpl
.
getUserVoList
(
reqVo
));
}
}
@RequestMapping
(
value
=
"/updateUserInfo"
,
method
=
RequestMethod
.
POST
,
produces
=
MediaType
.
APPLICATION_JSON_UTF8_VALUE
)
@RequestMapping
(
value
=
"/updateUserInfo"
,
method
=
RequestMethod
.
POST
,
produces
=
MediaType
.
APPLICATION_JSON_UTF8_VALUE
)
@ApiOperation
(
value
=
"只修改用户信息"
,
notes
=
"返回修改结果."
)
@ApiOperation
(
value
=
"只修改用户信息"
,
notes
=
"返回修改结果."
)
public
ResponseResult
updateUserInfo
(
@RequestBody
UserReqVo
req
){
public
ResponseResult
updateUserInfo
(
@RequestBody
UserReqVo
req
)
{
CheckerHelper
.
newInstance
().
notBlankCheck
(
"id"
,
req
.
getId
()).
checkException
();
CheckerHelper
.
newInstance
().
notBlankCheck
(
"id"
,
req
.
getId
()).
checkException
();
return
ResponseResult
.
result
(
userServiceImpl
.
updateUserInfo
(
req
));
return
ResponseResult
.
result
(
userServiceImpl
.
updateUserInfo
(
req
));
}
}
/**
/**
* 根据ID查询用户
* 根据ID查询用户
*
* @param //id
* @param //id
* @return
* @return
*/
*/
@RequestMapping
(
value
=
"/user"
,
method
=
RequestMethod
.
POST
,
produces
=
MediaType
.
APPLICATION_JSON_UTF8_VALUE
)
@RequestMapping
(
value
=
"/user"
,
method
=
RequestMethod
.
POST
,
produces
=
MediaType
.
APPLICATION_JSON_UTF8_VALUE
)
public
ResponseResult
<
WebUserResVo
>
user
(
@RequestBody
WebUserReqVo
webUserReqVo
){
public
ResponseResult
<
WebUserResVo
>
user
(
@RequestBody
WebUserReqVo
webUserReqVo
)
{
CheckerHelper
.
newInstance
()
CheckerHelper
.
newInstance
()
.
notBlankCheck
(
"userId"
,
webUserReqVo
.
getId
())
.
notBlankCheck
(
"userId"
,
webUserReqVo
.
getId
())
.
checkException
();
.
checkException
();
return
ResponseResult
.
result
(
userServiceImpl
.
getUserById
(
webUserReqVo
.
getId
()));
return
ResponseResult
.
result
(
userServiceImpl
.
getUserById
(
webUserReqVo
.
getId
()));
}
}
/**
/**
* 注册用户(新)
* 注册用户(新)
*
* @param //id
* @param //id
* @return
* @return
*/
*/
@ApiOperation
(
value
=
"注册"
,
notes
=
"返回注册信息"
)
@ApiOperation
(
value
=
"注册"
,
notes
=
"返回注册信息"
)
@RequestMapping
(
value
=
"/registerUser"
,
method
=
RequestMethod
.
POST
,
produces
=
MediaType
.
APPLICATION_JSON_UTF8_VALUE
)
@RequestMapping
(
value
=
"/registerUser"
,
method
=
RequestMethod
.
POST
,
produces
=
MediaType
.
APPLICATION_JSON_UTF8_VALUE
)
public
ResponseResult
<
String
>
registerUser
(
@RequestBody
SaveUserReqVo
saveUserReqVo
){
public
ResponseResult
<
String
>
registerUser
(
@RequestBody
SaveUserReqVo
saveUserReqVo
)
{
CheckerHelper
.
newInstance
()
CheckerHelper
.
newInstance
()
.
notBlankCheck
(
"account"
,
saveUserReqVo
.
getAccount
())
.
notBlankCheck
(
"account"
,
saveUserReqVo
.
getAccount
())
.
notBlankCheck
(
"password"
,
saveUserReqVo
.
getPassword
())
.
notBlankCheck
(
"password"
,
saveUserReqVo
.
getPassword
())
.
notBlankCheck
(
"confirmPassword"
,
saveUserReqVo
.
getConfirmPassword
())
.
notBlankCheck
(
"confirmPassword"
,
saveUserReqVo
.
getConfirmPassword
())
.
notBlankCheck
(
"companyType"
,
saveUserReqVo
.
getCompanyType
())
.
notBlankCheck
(
"companyType"
,
saveUserReqVo
.
getCompanyType
())
...
@@ -151,15 +158,16 @@ public class UserController {
...
@@ -151,15 +158,16 @@ public class UserController {
/**
/**
* 分销客户端 注册用户(新)
* 分销客户端 注册用户(新)
*
* @param //id
* @param //id
* @return
* @return
*/
*/
@ApiOperation
(
value
=
"注册"
,
notes
=
"返回注册信息"
)
@ApiOperation
(
value
=
"注册"
,
notes
=
"返回注册信息"
)
@RequestMapping
(
value
=
"/registerUserByDistribution"
,
method
=
RequestMethod
.
POST
,
produces
=
MediaType
.
APPLICATION_JSON_UTF8_VALUE
)
@RequestMapping
(
value
=
"/registerUserByDistribution"
,
method
=
RequestMethod
.
POST
,
produces
=
MediaType
.
APPLICATION_JSON_UTF8_VALUE
)
public
ResponseResult
<
String
>
registerUserByDistribution
(
@RequestBody
SaveUserReqVo
saveUserReqVo
){
public
ResponseResult
<
String
>
registerUserByDistribution
(
@RequestBody
SaveUserReqVo
saveUserReqVo
)
{
CheckerHelper
.
newInstance
()
CheckerHelper
.
newInstance
()
.
notBlankCheck
(
"registerFrom"
,
saveUserReqVo
.
getRegisterFrom
())
.
notBlankCheck
(
"registerFrom"
,
saveUserReqVo
.
getRegisterFrom
())
.
notBlankCheck
(
"account"
,
saveUserReqVo
.
getAccount
())
.
notBlankCheck
(
"account"
,
saveUserReqVo
.
getAccount
())
.
notBlankCheck
(
"password"
,
saveUserReqVo
.
getPassword
())
.
notBlankCheck
(
"password"
,
saveUserReqVo
.
getPassword
())
.
notBlankCheck
(
"confirmPassword"
,
saveUserReqVo
.
getConfirmPassword
())
.
notBlankCheck
(
"confirmPassword"
,
saveUserReqVo
.
getConfirmPassword
())
.
notBlankCheck
(
"companyType"
,
saveUserReqVo
.
getCompanyType
())
.
notBlankCheck
(
"companyType"
,
saveUserReqVo
.
getCompanyType
())
...
@@ -167,4 +175,16 @@ public class UserController {
...
@@ -167,4 +175,16 @@ public class UserController {
return
userServiceImpl
.
registerSaveUser
(
saveUserReqVo
);
return
userServiceImpl
.
registerSaveUser
(
saveUserReqVo
);
}
}
/**
* 发送短信验证码
*/
@ApiOperation
(
value
=
"发送短信验证码"
,
notes
=
"发送短信验证码"
)
@RequestMapping
(
value
=
"/sendCode"
,
method
=
RequestMethod
.
POST
,
produces
=
MediaType
.
APPLICATION_JSON_UTF8_VALUE
)
public
ResponseResult
<
String
>
sendCode
(
@RequestBody
SaveUserReqVo
req
)
{
CheckerHelper
.
newInstance
()
.
notBlankCheck
(
"phone"
,
req
.
getPhone
())
.
checkException
();
return
ResponseResult
.
result
(
userServiceImpl
.
verifyCodeSend
(
req
));
}
}
}
src/main/java/com/pangding/web/authority/service/UserService.java
View file @
b0d0dfcb
...
@@ -177,6 +177,10 @@ public interface UserService {
...
@@ -177,6 +177,10 @@ public interface UserService {
void
checkEmail
(
String
email
);
void
checkEmail
(
String
email
);
/**
* 验证码发送
* @param req
* @return
*/
String
verifyCodeSend
(
SaveUserReqVo
req
);
}
}
src/main/java/com/pangding/web/authority/service/impl/UserServiceImpl.java
View file @
b0d0dfcb
...
@@ -10,9 +10,10 @@ import com.pangding.web.authority.util.TokenUtil;
...
@@ -10,9 +10,10 @@ import com.pangding.web.authority.util.TokenUtil;
import
com.pangding.web.authority.vo.reqvo.*
;
import
com.pangding.web.authority.vo.reqvo.*
;
import
com.pangding.web.authority.service.UserService
;
import
com.pangding.web.authority.service.UserService
;
import
com.pangding.web.authority.vo.resvo.WebUserResVo
;
import
com.pangding.web.authority.vo.resvo.WebUserResVo
;
import
com.pangding.web.cache.CacheName
;
import
com.pangding.web.constant.AuthorityConstant
;
import
com.pangding.web.constant.AuthorityConstant
;
import
com.pangding.web.constant.CompanyConstant
;
import
com.pangding.web.constant.CompanyConstant
;
import
com.pangding.web.
constant.PangdConstant
;
import
com.pangding.web.
mq.DistributionProducer
;
import
com.pangding.web.util.RSAUtils
;
import
com.pangding.web.util.RSAUtils
;
import
com.pangding.web.vo.product.pd.merchant.MerchantVo
;
import
com.pangding.web.vo.product.pd.merchant.MerchantVo
;
import
com.pangding.web.vo.system.pd.LoginTokenVo
;
import
com.pangding.web.vo.system.pd.LoginTokenVo
;
...
@@ -40,9 +41,12 @@ import com.yanzuoguang.util.vo.ResponseResult;
...
@@ -40,9 +41,12 @@ import com.yanzuoguang.util.vo.ResponseResult;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.transaction.annotation.Transactional
;
import
com.alicp.jetcache.Cache
;
import
com.alicp.jetcache.anno.CreateCache
;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Random
;
/**
/**
* @author zhangjinyao
* @author zhangjinyao
...
@@ -77,6 +81,14 @@ public class UserServiceImpl implements UserService {
...
@@ -77,6 +81,14 @@ public class UserServiceImpl implements UserService {
@Autowired
@Autowired
private
StoreFeign
storeFeign
;
private
StoreFeign
storeFeign
;
@CreateCache
(
name
=
CacheName
.
USER_VERIFY_CODE
,
expire
=
300
)
private
Cache
<
String
,
String
>
verifyCodeCache
;
private
final
DistributionProducer
distributionProducer
;
public
UserServiceImpl
(
DistributionProducer
distributionProducer
)
{
this
.
distributionProducer
=
distributionProducer
;
}
/**
/**
* 登陆,验证用户名或手机号,密码是否正确
* 登陆,验证用户名或手机号,密码是否正确
...
@@ -198,25 +210,25 @@ public class UserServiceImpl implements UserService {
...
@@ -198,25 +210,25 @@ public class UserServiceImpl implements UserService {
UserVo
userVo
=
userDao
.
load
(
userReqVo
,
UserVo
.
class
);
UserVo
userVo
=
userDao
.
load
(
userReqVo
,
UserVo
.
class
);
if
(!
StringHelper
.
isEmpty
(
userVo
))
{
if
(!
StringHelper
.
isEmpty
(
userVo
))
{
// 用户名已存在
// 用户名已存在
return
(
ResponseResult
)
ResponseResult
.
error
(
"99"
,
"该用户名已存在"
);
return
(
ResponseResult
)
ResponseResult
.
error
(
"99"
,
"该用户名已存在"
);
}
}
try
{
try
{
/*将RSA加密后的密码解密*/
/*将RSA加密后的密码解密*/
String
password
=
saveUserReqVo
.
getPassword
();
//RSAUtils.decryptionByPrivateKey(saveUserReqVo.getPassword(), RsaConstant.privateKey);
String
password
=
saveUserReqVo
.
getPassword
();
//RSAUtils.decryptionByPrivateKey(saveUserReqVo.getPassword(), RsaConstant.privateKey);
String
confirmPassword
=
saveUserReqVo
.
getConfirmPassword
();
//RSAUtils.decryptionByPrivateKey(saveUserReqVo.getConfirmPassword(), RsaConstant.privateKey);
String
confirmPassword
=
saveUserReqVo
.
getConfirmPassword
();
//RSAUtils.decryptionByPrivateKey(saveUserReqVo.getConfirmPassword(), RsaConstant.privateKey);
if
(!
StringHelper
.
compare
(
password
,
confirmPassword
))
{
if
(!
StringHelper
.
compare
(
password
,
confirmPassword
))
{
return
(
ResponseResult
)
ResponseResult
.
error
(
"99"
,
"两次填写的密码不相等"
);
return
(
ResponseResult
)
ResponseResult
.
error
(
"99"
,
"两次填写的密码不相等"
);
}
}
String
invitationCompanyId
=
""
;
String
invitationCompanyId
=
""
;
String
invitationCompanyName
=
""
;
String
invitationCompanyName
=
""
;
int
invitationCodeType
=
0
;
int
invitationCodeType
=
0
;
// 分销客户端注册 不需要邀请码
// 分销客户端注册 不需要邀请码
if
(
StringHelper
.
isEmpty
(
saveUserReqVo
.
getRegisterFrom
())
if
(
StringHelper
.
isEmpty
(
saveUserReqVo
.
getRegisterFrom
())
||
CompanyConstant
.
REGISTER_FROM_SALE
!=
saveUserReqVo
.
getRegisterFrom
()){
||
CompanyConstant
.
REGISTER_FROM_SALE
!=
saveUserReqVo
.
getRegisterFrom
())
{
// 验证邀请码是否正确 todo 关联码怎么判断
// 验证邀请码是否正确 todo 关联码怎么判断
CompanyResVo
companyResVo
=
newCompanyService
.
checkInvitationCode
(
saveUserReqVo
.
getInvitationCode
());
CompanyResVo
companyResVo
=
newCompanyService
.
checkInvitationCode
(
saveUserReqVo
.
getInvitationCode
());
if
(!
StringHelper
.
isEmpty
(
companyResVo
))
{
if
(!
StringHelper
.
isEmpty
(
companyResVo
))
{
invitationCompanyId
=
companyResVo
.
getId
();
invitationCompanyId
=
companyResVo
.
getId
();
invitationCompanyName
=
companyResVo
.
getCompanyName
();
invitationCompanyName
=
companyResVo
.
getCompanyName
();
invitationCodeType
=
companyResVo
.
getInvitationCodeType
();
invitationCodeType
=
companyResVo
.
getInvitationCodeType
();
...
@@ -246,7 +258,7 @@ public class UserServiceImpl implements UserService {
...
@@ -246,7 +258,7 @@ public class UserServiceImpl implements UserService {
companyVo
.
setInvitationCompanyId
(
invitationCompanyId
);
companyVo
.
setInvitationCompanyId
(
invitationCompanyId
);
companyVo
.
setInvitationCompanyName
(
invitationCompanyName
);
companyVo
.
setInvitationCompanyName
(
invitationCompanyName
);
companyVo
.
setInvitationCodeType
(
invitationCodeType
);
companyVo
.
setInvitationCodeType
(
invitationCodeType
);
if
(
CompanyConstant
.
RELATION_CODE
==
invitationCodeType
)
{
if
(
CompanyConstant
.
RELATION_CODE
==
invitationCodeType
)
{
// 邀请码为关联码 需关联父级
// 邀请码为关联码 需关联父级
companyVo
.
setPid
(
invitationCompanyId
);
companyVo
.
setPid
(
invitationCompanyId
);
companyVo
.
setPcompanyName
(
invitationCompanyName
);
companyVo
.
setPcompanyName
(
invitationCompanyName
);
...
@@ -269,8 +281,8 @@ public class UserServiceImpl implements UserService {
...
@@ -269,8 +281,8 @@ public class UserServiceImpl implements UserService {
companyExtendDao
.
create
(
companyExtendVo
);
companyExtendDao
.
create
(
companyExtendVo
);
// 分销客户端 需保存公司关联表
// 分销客户端 需保存公司关联表
if
(!
StringHelper
.
isEmpty
(
saveUserReqVo
.
getRegisterFrom
())
&&
if
(!
StringHelper
.
isEmpty
(
saveUserReqVo
.
getRegisterFrom
())
&&
CompanyConstant
.
REGISTER_FROM_SALE
==
saveUserReqVo
.
getRegisterFrom
()){
CompanyConstant
.
REGISTER_FROM_SALE
==
saveUserReqVo
.
getRegisterFrom
())
{
CompanyRelationVo
companyRelationVo
=
new
CompanyRelationVo
();
CompanyRelationVo
companyRelationVo
=
new
CompanyRelationVo
();
companyRelationVo
.
setCompanyId
(
companyId
);
companyRelationVo
.
setCompanyId
(
companyId
);
companyRelationVo
.
setRelationId
(
saveUserReqVo
.
getRelationId
());
companyRelationVo
.
setRelationId
(
saveUserReqVo
.
getRelationId
());
...
@@ -307,7 +319,7 @@ public class UserServiceImpl implements UserService {
...
@@ -307,7 +319,7 @@ public class UserServiceImpl implements UserService {
}
}
return
ResponseResult
.
result
(
"注册成功"
);
return
ResponseResult
.
result
(
"注册成功"
);
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
return
(
ResponseResult
)
ResponseResult
.
error
(
"99"
,
e
.
getMessage
());
return
(
ResponseResult
)
ResponseResult
.
error
(
"99"
,
e
.
getMessage
());
}
}
}
}
...
@@ -400,6 +412,11 @@ public class UserServiceImpl implements UserService {
...
@@ -400,6 +412,11 @@ public class UserServiceImpl implements UserService {
userVo
.
setRemark
(
webUserReqVo
.
getPassword
());
userVo
.
setRemark
(
webUserReqVo
.
getPassword
());
userVo
.
setPassword
(
this
.
passwordEncoder
(
webUserReqVo
.
getPassword
()));
userVo
.
setPassword
(
this
.
passwordEncoder
(
webUserReqVo
.
getPassword
()));
}
}
//短信验证,通过后才可以
String
verifyCode
=
verifyCodeCache
.
get
(
webUserReqVo
.
getPhone
());
if
(!
webUserReqVo
.
getVerifyCode
().
equals
(
verifyCode
))
{
throw
new
CodeException
(
"验证码错误"
);
}
userDao
.
update
(
userVo
);
userDao
.
update
(
userVo
);
if
(
StringHelper
.
isEmpty
(
webUserReqVo
.
getUpdateType
()))
{
if
(
StringHelper
.
isEmpty
(
webUserReqVo
.
getUpdateType
()))
{
UserRoleGetReqVo
reqVo
=
new
UserRoleGetReqVo
();
UserRoleGetReqVo
reqVo
=
new
UserRoleGetReqVo
();
...
@@ -532,6 +549,18 @@ public class UserServiceImpl implements UserService {
...
@@ -532,6 +549,18 @@ public class UserServiceImpl implements UserService {
}
}
}
}
@Override
public
String
verifyCodeSend
(
SaveUserReqVo
req
)
{
String
verifyCode
=
String
.
valueOf
(
new
Random
().
nextInt
(
899999
)
+
100000
);
SaveUserReqVo
verifySave
=
new
SaveUserReqVo
();
verifySave
.
setCompanyId
(
"system"
);
verifySave
.
setSmsContent
(
"【胖丁】您的验证码为:"
+
verifyCode
+
"。五分钟内有效"
);
verifySave
.
setPhone
(
req
.
getPhone
());
verifyCodeCache
.
put
(
req
.
getPhone
(),
verifyCode
);
distributionProducer
.
userVerifyCodeSms
(
verifySave
);
return
"已发送"
;
}
@Override
@Override
public
UserVo
getUserByPhone
(
String
phone
)
{
public
UserVo
getUserByPhone
(
String
phone
)
{
UserGetReqVo
reqVo
=
new
UserGetReqVo
();
UserGetReqVo
reqVo
=
new
UserGetReqVo
();
...
...
src/main/java/com/pangding/web/authority/vo/reqvo/WebUserReqVo.java
View file @
b0d0dfcb
...
@@ -17,6 +17,8 @@ public class WebUserReqVo extends UserVo {
...
@@ -17,6 +17,8 @@ public class WebUserReqVo extends UserVo {
private
List
<
String
>
roleIds
;
private
List
<
String
>
roleIds
;
private
String
verifyCode
;
public
String
getConfirmPassword
()
{
public
String
getConfirmPassword
()
{
return
confirmPassword
;
return
confirmPassword
;
}
}
...
@@ -48,4 +50,12 @@ public class WebUserReqVo extends UserVo {
...
@@ -48,4 +50,12 @@ public class WebUserReqVo extends UserVo {
public
void
setUpdateType
(
Integer
updateType
)
{
public
void
setUpdateType
(
Integer
updateType
)
{
this
.
updateType
=
updateType
;
this
.
updateType
=
updateType
;
}
}
public
String
getVerifyCode
()
{
return
verifyCode
;
}
public
void
setVerifyCode
(
String
verifyCode
)
{
this
.
verifyCode
=
verifyCode
;
}
}
}
src/main/resources/bootstrap.yml
View file @
b0d0dfcb
...
@@ -6,7 +6,7 @@ spring:
...
@@ -6,7 +6,7 @@ spring:
cloud
:
cloud
:
config
:
config
:
# base为所有服务的公共配置,pd-db-system为需要连接的数据库配置,${spring.application.name}为当前程序的配置,3个配置组合才为当前程序的启动配置
# base为所有服务的公共配置,pd-db-system为需要连接的数据库配置,${spring.application.name}为当前程序的配置,3个配置组合才为当前程序的启动配置
name
:
base,pd-db-user,pd-mq-mq,${spring.application.name}
name
:
base,pd-db-user,pd-
redis,pd-
mq-mq,${spring.application.name}
label
:
master
label
:
master
fail-fast
:
true
fail-fast
:
true
# 设置从服务中拿取配置
# 设置从服务中拿取配置
...
...
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