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
d48f5545
Commit
d48f5545
authored
May 14, 2019
by
zjy
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
user/role/tright 5.14
个体用户还需要增加Token 准备企业用户注册
parent
1a5fe017
Changes
24
Show whitespace changes
Inline
Side-by-side
Showing
24 changed files
with
666 additions
and
73 deletions
+666
-73
ComputerRegisterUserReturnVo.java
...g/web/authority/cloudvo/ComputerRegisterUserReturnVo.java
+37
-0
MobileRegisterUserReturnVo.java
...ing/web/authority/cloudvo/MobileRegisterUserReturnVo.java
+5
-5
ComputerRegisterController.java
.../web/authority/controller/ComputerRegisterController.java
+141
-0
MobileRegisterController.java
...ng/web/authority/controller/MobileRegisterController.java
+86
-15
UserController.java
...com/pangding/web/authority/controller/UserController.java
+5
-0
ComputerRegisterDao.java
...a/com/pangding/web/authority/dao/ComputerRegisterDao.java
+10
-0
MobileRegisterDao.java
...ava/com/pangding/web/authority/dao/MobileRegisterDao.java
+7
-0
UserDao.java
src/main/java/com/pangding/web/authority/dao/UserDao.java
+17
-1
ComputerRegisterDaoImpl.java
...gding/web/authority/dao/impl/ComputerRegisterDaoImpl.java
+15
-0
MobileRegisterDaoImpl.java
...angding/web/authority/dao/impl/MobileRegisterDaoImpl.java
+11
-0
UserDaoImpl.java
...java/com/pangding/web/authority/dao/impl/UserDaoImpl.java
+13
-0
RegisterEnterpriceDto.java
...com/pangding/web/authority/dto/RegisterEnterpriceDto.java
+117
-0
RegisterIndividualDto.java
...com/pangding/web/authority/dto/RegisterIndividualDto.java
+1
-31
RegisterUserDto.java
.../java/com/pangding/web/authority/dto/RegisterUserDto.java
+4
-4
GetUserByAccountReqVo.java
...m/pangding/web/authority/reqvo/GetUserByAccountReqVo.java
+0
-10
GetUserByCompanyIdReqVo.java
...pangding/web/authority/reqvo/GetUserByCompanyIdReqVo.java
+17
-0
GetUserByPhoneReqVo.java
...com/pangding/web/authority/reqvo/GetUserByPhoneReqVo.java
+17
-0
ComputerRegisterService.java
...ngding/web/authority/service/ComputerRegisterService.java
+8
-0
MobileRegisterService.java
...pangding/web/authority/service/MobileRegisterService.java
+16
-1
UserService.java
.../java/com/pangding/web/authority/service/UserService.java
+40
-2
ComputerRegisterServiceImpl.java
...b/authority/service/impl/ComputerRegisterServiceImpl.java
+13
-0
MobileRegisterServiceImpl.java
...web/authority/service/impl/MobileRegisterServiceImpl.java
+21
-0
UserServiceImpl.java
.../pangding/web/authority/service/impl/UserServiceImpl.java
+37
-4
MobileLoginInfo.java
...n/java/com/pangding/web/authority/vo/MobileLoginInfo.java
+28
-0
No files found.
src/main/java/com/pangding/web/authority/cloudvo/ComputerRegisterUserReturnVo.java
0 → 100644
View file @
d48f5545
package
com
.
pangding
.
web
.
authority
.
cloudvo
;
/**
* @Author zhangjinyao
* @create 2019/5/14 17:48
*/
public
class
ComputerRegisterUserReturnVo
{
private
String
companyId
;
private
String
merchantId
;
private
int
companyType
;
public
int
getCompanyType
()
{
return
companyType
;
}
public
void
setCompanyType
(
int
companyType
)
{
this
.
companyType
=
companyType
;
}
public
String
getCompanyId
()
{
return
companyId
;
}
public
void
setCompanyId
(
String
companyId
)
{
this
.
companyId
=
companyId
;
}
public
String
getMerchantId
()
{
return
merchantId
;
}
public
void
setMerchantId
(
String
merchantId
)
{
this
.
merchantId
=
merchantId
;
}
}
src/main/java/com/pangding/web/authority/
dto/MobileRegisterUserReturnDt
o.java
→
src/main/java/com/pangding/web/authority/
cloudvo/MobileRegisterUserReturnV
o.java
View file @
d48f5545
package
com
.
pangding
.
web
.
authority
.
dt
o
;
package
com
.
pangding
.
web
.
authority
.
cloudv
o
;
/**
* @Author zhangjinyao
* @create 2019/5/13 16:15
*/
public
class
MobileRegisterUserReturn
Dt
o
{
public
class
MobileRegisterUserReturn
V
o
{
private
String
companyId
;
private
String
merchantId
;
private
String
companyType
;
private
int
companyType
;
public
String
getCompanyType
()
{
public
int
getCompanyType
()
{
return
companyType
;
}
public
void
setCompanyType
(
String
companyType
)
{
public
void
setCompanyType
(
int
companyType
)
{
this
.
companyType
=
companyType
;
}
...
...
src/main/java/com/pangding/web/authority/controller/ComputerRegisterController.java
0 → 100644
View file @
d48f5545
package
com
.
pangding
.
web
.
authority
.
controller
;
import
com.pangding.web.authority.cloudvo.ComputerRegisterUserReturnVo
;
import
com.pangding.web.authority.currency.Result
;
import
com.pangding.web.authority.dto.RegisterEnterpriceDto
;
import
com.pangding.web.authority.dto.RegisterIndividualDto
;
import
com.pangding.web.authority.dto.RegisterUserDto
;
import
com.pangding.web.authority.service.MobileRegisterService
;
import
com.pangding.web.authority.service.UserService
;
import
com.pangding.web.authority.utils.Md5AndSalt
;
import
com.pangding.web.authority.vo.CompanyVo
;
import
com.pangding.web.authority.vo.MobileLoginInfo
;
import
com.pangding.web.authority.vo.UserVo
;
import
com.yanzuoguang.token.TokenHelper
;
import
com.yanzuoguang.util.helper.StringHelper
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.http.MediaType
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestMethod
;
import
org.springframework.web.bind.annotation.RestController
;
/**
* @Author zhangjinyao
* @create 2019/5/14 16:28
*/
@RestController
@RequestMapping
(
value
=
"/computer"
)
public
class
ComputerRegisterController
{
@Autowired
MobileRegisterService
mobileRegisterServiceImpl
;
@Autowired
UserService
userServiceImpl
;
/**
* 验证注册第一页数据的合法性并保存
*
* @param registerUserDto
* @return
*/
@RequestMapping
(
value
=
"/user"
,
method
=
RequestMethod
.
POST
,
produces
=
MediaType
.
APPLICATION_JSON_UTF8_VALUE
)
public
Object
saveUser
(
@RequestBody
RegisterUserDto
registerUserDto
){
if
(!
userServiceImpl
.
isValid
(
registerUserDto
.
getAccount
())){
return
new
Result
(
4001
,
"用户名由字母与数字组成,且不能为纯数字"
,
registerUserDto
);
}
UserVo
userVo
=
new
UserVo
();
userVo
.
setAccount
(
registerUserDto
.
getAccount
());
userServiceImpl
.
checkAccount
(
userVo
);
String
merchantId
=
registerUserDto
.
getMerchantId
();
if
(!
mobileRegisterServiceImpl
.
checkMerchantId
(
merchantId
)){
return
new
Result
(
4001
,
"注册编码错误"
,
registerUserDto
);
}
String
companyId
=
StringHelper
.
getNewID
();
userVo
.
setPassword
(
Md5AndSalt
.
generate
(
registerUserDto
.
getPassword
()));
userVo
.
setId
(
StringHelper
.
getNewID
());
userVo
.
setRemark
(
registerUserDto
.
getPassword
());
userVo
.
setCompanyId
(
companyId
);
mobileRegisterServiceImpl
.
saveUser
(
userVo
);
ComputerRegisterUserReturnVo
returnVo
=
new
ComputerRegisterUserReturnVo
();
returnVo
.
setCompanyId
(
companyId
);
returnVo
.
setMerchantId
(
merchantId
);
returnVo
.
setCompanyType
(
registerUserDto
.
getCompanyType
());
/*token内容暂时不能用,以后要改动,需要存入用户及企业信息*/
String
token
=
StringHelper
.
getNewID
();
TokenHelper
.
write
(
token
,
returnVo
);
return
new
Result
(
0
,
"SUCCESS"
,
null
);
}
/**
* 当用户类型选择为“个体”时进入此方法
* 验证注册第二页数据的合法性并保存
*
* @param individualDto
* @return
*/
@RequestMapping
(
value
=
"/individual"
,
method
=
RequestMethod
.
POST
,
produces
=
MediaType
.
APPLICATION_JSON_UTF8_VALUE
)
public
Object
saveIndividual
(
@RequestBody
RegisterIndividualDto
individualDto
){
mobileRegisterServiceImpl
.
checkPhone
(
individualDto
);
CompanyVo
companyVo
=
new
CompanyVo
();
/*token内容暂时不能用,以后要改动*/
ComputerRegisterUserReturnVo
returnVo
=
TokenHelper
.
get
(
ComputerRegisterUserReturnVo
.
class
);
companyVo
.
setId
(
returnVo
.
getCompanyId
());
companyVo
.
setCompanyType
(
returnVo
.
getCompanyType
());
companyVo
.
setMerchantId
(
returnVo
.
getMerchantId
());
companyVo
.
setContactName
(
individualDto
.
getContactName
());
companyVo
.
setContactCode
(
individualDto
.
getContactCode
());
companyVo
.
setCompanyAttribute
(
individualDto
.
getCompanyAttribute
());
companyVo
.
setContactPhone
(
individualDto
.
getContactPhone
());
if
(
individualDto
.
getCompanyAttribute
().
equals
(
"5"
)){
companyVo
.
setCompanyName
(
individualDto
.
getExtraChoseOne
());
companyVo
.
setBusinessLicenseCode
(
individualDto
.
getExtraChoseTwo
());
}
else
{
companyVo
.
setCompanyName
(
individualDto
.
getExtraChoseOne
());
companyVo
.
setAddress
(
individualDto
.
getExtraChoseTwo
());
}
mobileRegisterServiceImpl
.
saveCompany
(
companyVo
);
return
new
Result
(
0
,
"SUCCESS"
,
null
);
}
@RequestMapping
(
value
=
"/enterprise"
,
method
=
RequestMethod
.
POST
,
produces
=
MediaType
.
APPLICATION_JSON_UTF8_VALUE
)
public
Object
saveEnterprise
(
@RequestBody
RegisterEnterpriceDto
enterpriceDto
){
return
null
;
}
@RequestMapping
(
value
=
"/login"
,
method
=
RequestMethod
.
POST
,
produces
=
MediaType
.
APPLICATION_JSON_UTF8_VALUE
)
public
Object
login
(
@RequestBody
MobileLoginInfo
info
){
String
accountOrPhone
=
info
.
getAccountOrPhone
();
UserVo
userVo
;
if
(
userServiceImpl
.
isNumeric
(
accountOrPhone
)){
userVo
=
userServiceImpl
.
getUserByPhone
(
accountOrPhone
);
}
else
{
userVo
=
userServiceImpl
.
getUserByAccount
(
accountOrPhone
);
}
if
(
userVo
==
null
){
return
new
Result
(
4001
,
"没有此用户"
,
info
);
}
if
(!
Md5AndSalt
.
verify
(
info
.
getPassword
(),
userVo
.
getPassword
())){
return
new
Result
(
4001
,
"用户名或密码错误"
,
info
);
}
/*token内容暂时不能用,以后要改动*/
String
token
=
StringHelper
.
getNewID
();
TokenHelper
.
write
(
token
,
userVo
);
return
new
Result
(
0
,
"SUCCESS"
,
null
);
}
}
src/main/java/com/pangding/web/authority/controller/MobileRegisterController.java
View file @
d48f5545
package
com
.
pangding
.
web
.
authority
.
controller
;
import
com.pangding.web.authority.currency.Result
;
import
com.pangding.web.authority.dto.
MobileRegisterCompany
Dto
;
import
com.pangding.web.authority.dto.
Mobile
RegisterUserDto
;
import
com.pangding.web.authority.
dto.MobileRegisterUserReturnDt
o
;
import
com.pangding.web.authority.dto.
RegisterIndividual
Dto
;
import
com.pangding.web.authority.dto.RegisterUserDto
;
import
com.pangding.web.authority.
cloudvo.MobileRegisterUserReturnV
o
;
import
com.pangding.web.authority.service.MobileRegisterService
;
import
com.pangding.web.authority.service.UserService
;
import
com.pangding.web.authority.utils.Md5AndSalt
;
import
com.pangding.web.authority.vo.CompanyVo
;
import
com.pangding.web.authority.vo.MobileLoginInfo
;
import
com.pangding.web.authority.vo.UserVo
;
import
com.yanzuoguang.token.TokenHelper
;
import
com.yanzuoguang.util.helper.StringHelper
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.http.MediaType
;
...
...
@@ -22,7 +24,7 @@ import org.springframework.web.bind.annotation.RestController;
* @create 2019/5/13 11:26
*/
@RestController
@RequestMapping
(
value
=
"/mobile
Register
"
)
@RequestMapping
(
value
=
"/mobile"
)
public
class
MobileRegisterController
{
@Autowired
...
...
@@ -30,13 +32,23 @@ public class MobileRegisterController {
@Autowired
UserService
userServiceImpl
;
/**
* 验证注册第一页数据的合法性并保存
*
* @param registerUserDto
* @return
*/
@RequestMapping
(
value
=
"/user"
,
method
=
RequestMethod
.
POST
,
produces
=
MediaType
.
APPLICATION_JSON_UTF8_VALUE
)
public
Object
saveUser
(
@RequestBody
Mobile
RegisterUserDto
registerUserDto
){
public
Object
saveUser
(
@RequestBody
RegisterUserDto
registerUserDto
){
if
(
!
registerUserDto
.
getCompanyType
().
equals
(
"个体"
)
){
if
(
registerUserDto
.
getCompanyType
()
!=
0
){
return
new
Result
(
4001
,
"目前仅支持个体用户"
,
registerUserDto
);
}
if
(!
userServiceImpl
.
isValid
(
registerUserDto
.
getAccount
())){
return
new
Result
(
4001
,
"用户名由字母与数字组成,且不能为纯数字"
,
registerUserDto
);
}
UserVo
userVo
=
new
UserVo
();
userVo
.
setAccount
(
registerUserDto
.
getAccount
());
userServiceImpl
.
checkAccount
(
userVo
);
...
...
@@ -52,19 +64,78 @@ public class MobileRegisterController {
userVo
.
setRemark
(
registerUserDto
.
getPassword
());
userVo
.
setCompanyId
(
companyId
);
mobileRegisterServiceImpl
.
saveUser
(
userVo
);
MobileRegisterUserReturnDto
returnDto
=
new
MobileRegisterUserReturnDto
();
returnDto
.
setCompanyId
(
companyId
);
returnDto
.
setMerchantId
(
merchantId
);
returnDto
.
setCompanyType
(
registerUserDto
.
getCompanyType
());
return
new
Result
(
0
,
"SUCCESS"
,
returnDto
);
MobileRegisterUserReturnVo
returnVo
=
new
MobileRegisterUserReturnVo
();
returnVo
.
setCompanyId
(
companyId
);
returnVo
.
setMerchantId
(
merchantId
);
returnVo
.
setCompanyType
(
registerUserDto
.
getCompanyType
());
/*token内容暂时不能用,以后要改动,需要存入用户及企业信息*/
String
token
=
StringHelper
.
getNewID
();
TokenHelper
.
write
(
token
,
returnVo
);
return
new
Result
(
0
,
"SUCCESS"
,
null
);
}
@RequestMapping
(
value
=
"company"
)
public
Object
saveCompany
(
@RequestBody
MobileRegisterCompanyDto
companyDto
){
/**
* 验证注册第二页数据的合法性并保存
*
* @param individualDto
* @return
*/
@RequestMapping
(
value
=
"/individual"
,
method
=
RequestMethod
.
POST
,
produces
=
MediaType
.
APPLICATION_JSON_UTF8_VALUE
)
public
Object
saveIndividual
(
@RequestBody
RegisterIndividualDto
individualDto
){
mobileRegisterServiceImpl
.
checkPhone
(
individualDto
);
CompanyVo
companyVo
=
new
CompanyVo
();
companyVo
.
setId
(
companyDto
.
getCompanyId
());
return
null
;
/*token内容暂时不能用,以后要改动*/
MobileRegisterUserReturnVo
returnVo
=
TokenHelper
.
get
(
MobileRegisterUserReturnVo
.
class
);
companyVo
.
setId
(
returnVo
.
getCompanyId
());
companyVo
.
setCompanyType
(
returnVo
.
getCompanyType
());
companyVo
.
setMerchantId
(
returnVo
.
getMerchantId
());
companyVo
.
setContactName
(
individualDto
.
getContactName
());
companyVo
.
setContactCode
(
individualDto
.
getContactCode
());
companyVo
.
setCompanyAttribute
(
individualDto
.
getCompanyAttribute
());
companyVo
.
setContactPhone
(
individualDto
.
getContactPhone
());
if
(
individualDto
.
getCompanyAttribute
().
equals
(
"5"
)){
companyVo
.
setCompanyName
(
individualDto
.
getExtraChoseOne
());
companyVo
.
setBusinessLicenseCode
(
individualDto
.
getExtraChoseTwo
());
}
else
{
companyVo
.
setCompanyName
(
individualDto
.
getExtraChoseOne
());
companyVo
.
setAddress
(
individualDto
.
getExtraChoseTwo
());
}
mobileRegisterServiceImpl
.
saveCompany
(
companyVo
);
return
new
Result
(
0
,
"SUCCESS"
,
null
);
}
@RequestMapping
(
value
=
"/login"
,
method
=
RequestMethod
.
POST
,
produces
=
MediaType
.
APPLICATION_JSON_UTF8_VALUE
)
public
Object
login
(
@RequestBody
MobileLoginInfo
info
){
String
accountOrPhone
=
info
.
getAccountOrPhone
();
UserVo
userVo
;
if
(
userServiceImpl
.
isNumeric
(
accountOrPhone
)){
userVo
=
userServiceImpl
.
getUserByPhone
(
accountOrPhone
);
}
else
{
userVo
=
userServiceImpl
.
getUserByAccount
(
accountOrPhone
);
}
if
(
userVo
==
null
){
return
new
Result
(
4001
,
"没有此用户"
,
info
);
}
if
(!
Md5AndSalt
.
verify
(
info
.
getPassword
(),
userVo
.
getPassword
())){
return
new
Result
(
4001
,
"用户名或密码错误"
,
info
);
}
/*token内容暂时不能用,以后要改动*/
String
token
=
StringHelper
.
getNewID
();
TokenHelper
.
write
(
token
,
userVo
);
return
new
Result
(
0
,
"SUCCESS"
,
null
);
}
}
src/main/java/com/pangding/web/authority/controller/UserController.java
View file @
d48f5545
...
...
@@ -33,7 +33,11 @@ public class UserController {
@RequestMapping
(
value
=
"/save"
,
method
=
RequestMethod
.
POST
,
produces
=
MediaType
.
APPLICATION_JSON_UTF8_VALUE
)
public
Object
saveUser
(
@RequestBody
UserDto
userDto
){
if
(!
userServiceImpl
.
isValid
(
userDto
.
getAccount
())){
return
new
Result
(
4001
,
"用户名由字母与数字组成,且不能为纯数字"
,
userDto
);
}
userServiceImpl
.
checkAccount
(
userDto
);
userServiceImpl
.
checkPhone
(
userDto
);
userDto
.
setRemark
(
userDto
.
getPassword
());
String
saltPassword
=
userServiceImpl
.
passwordEncoder
(
userDto
.
getPassword
());
userDto
.
setPassword
(
saltPassword
);
...
...
@@ -51,6 +55,7 @@ public class UserController {
@RequestMapping
(
value
=
"/update"
,
method
=
RequestMethod
.
POST
,
produces
=
MediaType
.
APPLICATION_JSON_UTF8_VALUE
)
public
Object
updateUser
(
@RequestBody
UserDto
userDto
){
userServiceImpl
.
checkAccount
(
userDto
);
userServiceImpl
.
checkPhone
(
userDto
);
userDto
.
setRemark
(
userDto
.
getPassword
());
userDto
.
setPassword
(
userServiceImpl
.
passwordEncoder
(
userDto
.
getPassword
()));
userServiceImpl
.
updateUser
(
userDto
);
...
...
src/main/java/com/pangding/web/authority/dao/ComputerRegisterDao.java
0 → 100644
View file @
d48f5545
package
com
.
pangding
.
web
.
authority
.
dao
;
import
com.yanzuoguang.dao.BaseDao
;
/**
* @Author zhangjinyao
* @create 2019/5/14 16:32
*/
public
interface
ComputerRegisterDao
extends
BaseDao
{
}
src/main/java/com/pangding/web/authority/dao/MobileRegisterDao.java
View file @
d48f5545
package
com
.
pangding
.
web
.
authority
.
dao
;
import
com.pangding.web.authority.vo.CompanyVo
;
import
com.yanzuoguang.dao.BaseDao
;
/**
...
...
@@ -7,4 +8,10 @@ import com.yanzuoguang.dao.BaseDao;
* @create 2019/5/13 14:24
*/
public
interface
MobileRegisterDao
extends
BaseDao
{
/**
* 检查电话号码是否已存在
*
* @param companyVo CompanyVo对象
*/
void
checkPhone
(
CompanyVo
companyVo
);
}
src/main/java/com/pangding/web/authority/dao/UserDao.java
View file @
d48f5545
package
com
.
pangding
.
web
.
authority
.
dao
;
import
com.pangding.web.authority.reqvo.GetUserByCompanyIdReqVo
;
import
com.pangding.web.authority.reqvo.GetUserByIdReqVo
;
import
com.pangding.web.authority.vo.UserVo
;
import
com.yanzuoguang.dao.BaseDao
;
...
...
@@ -13,13 +14,20 @@ public interface UserDao extends BaseDao {
/**
*
通过账户名获取相同的UserVo对象
*
检查用户名是否存在
*
* @param account 账户名
* @return UserVo对象
*/
void
checkAccount
(
UserVo
account
);
/**
* 检查电话号码是否存在
*
* @param phone 电话号码
*/
void
checkPhone
(
UserVo
phone
);
/**
* 获取UserVo对象列表
*
...
...
@@ -34,4 +42,12 @@ public interface UserDao extends BaseDao {
* @return UserVo对象
*/
UserVo
getUserById
(
GetUserByIdReqVo
id
);
/**
* 根据公司id获取UserVo对象
*
* @param companyId GetUserByCompanyIdReqVo请求对象,封装公司id
* @return UserVo对象
*/
UserVo
getUserByCompanyId
(
GetUserByCompanyIdReqVo
companyId
);
}
src/main/java/com/pangding/web/authority/dao/impl/ComputerRegisterDaoImpl.java
0 → 100644
View file @
d48f5545
package
com
.
pangding
.
web
.
authority
.
dao
.
impl
;
import
com.pangding.web.authority.dao.ComputerRegisterDao
;
import
com.yanzuoguang.dao.impl.BaseDaoImpl
;
/**
* @Author zhangjinyao
* @create 2019/5/14 16:33
*/
public
class
ComputerRegisterDaoImpl
extends
BaseDaoImpl
implements
ComputerRegisterDao
{
@Override
protected
void
init
()
{
}
}
src/main/java/com/pangding/web/authority/dao/impl/MobileRegisterDaoImpl.java
View file @
d48f5545
...
...
@@ -11,8 +11,19 @@ import org.springframework.stereotype.Component;
*/
@Component
public
class
MobileRegisterDaoImpl
extends
BaseDaoImpl
implements
MobileRegisterDao
{
private
static
final
String
CHECK_PHONE
=
"CHECK_PHONE"
;
@Override
protected
void
init
()
{
register
(
CompanyVo
.
class
);
table
.
addExist
(
CHECK_PHONE
,
"contact_phone"
);
}
@Override
public
void
checkPhone
(
CompanyVo
companyVo
)
{
this
.
checkExist
(
CHECK_PHONE
,
companyVo
,
"电话号码已存在"
);
}
}
src/main/java/com/pangding/web/authority/dao/impl/UserDaoImpl.java
View file @
d48f5545
package
com
.
pangding
.
web
.
authority
.
dao
.
impl
;
import
com.pangding.web.authority.dao.UserDao
;
import
com.pangding.web.authority.reqvo.GetUserByCompanyIdReqVo
;
import
com.pangding.web.authority.reqvo.GetUserByIdReqVo
;
import
com.pangding.web.authority.vo.UserVo
;
import
com.yanzuoguang.dao.impl.BaseDaoImpl
;
...
...
@@ -17,6 +18,7 @@ public class UserDaoImpl extends BaseDaoImpl implements UserDao {
private
static
final
String
SELECT
=
"SELECT"
;
private
static
final
String
CHECK_ACCOUNT
=
"CHECK_ACCOUNT"
;
private
static
final
String
CHECK_PHONE
=
"CHECK_PHONE"
;
@Override
protected
void
init
()
{
...
...
@@ -26,6 +28,8 @@ public class UserDaoImpl extends BaseDaoImpl implements UserDao {
table
.
addExist
(
CHECK_ACCOUNT
,
"account"
);
table
.
addExist
(
CHECK_PHONE
,
"phone"
);
}
@Override
...
...
@@ -33,6 +37,10 @@ public class UserDaoImpl extends BaseDaoImpl implements UserDao {
this
.
checkExist
(
CHECK_ACCOUNT
,
account
,
"用戶名已存在"
);
}
@Override
public
void
checkPhone
(
UserVo
phone
)
{
this
.
checkExist
(
CHECK_PHONE
,
phone
,
"手机号已存在"
);
}
@Override
public
List
<
UserVo
>
listUserVo
()
{
...
...
@@ -45,4 +53,9 @@ public class UserDaoImpl extends BaseDaoImpl implements UserDao {
public
UserVo
getUserById
(
GetUserByIdReqVo
id
)
{
return
this
.
load
(
id
,
UserVo
.
class
);
}
@Override
public
UserVo
getUserByCompanyId
(
GetUserByCompanyIdReqVo
companyId
)
{
return
this
.
load
(
companyId
,
UserVo
.
class
);
}
}
src/main/java/com/pangding/web/authority/dto/RegisterEnterpriceDto.java
0 → 100644
View file @
d48f5545
package
com
.
pangding
.
web
.
authority
.
dto
;
/**
* @Author zhangjinyao
* @create 2019/5/14 18:30
*/
public
class
RegisterEnterpriceDto
{
private
String
enterpriceName
;
private
String
companyAttribute
;
private
String
extraChoseOne
;
private
String
extraChoseTwo
;
private
String
enterpricePhone
;
private
String
contactName
;
private
String
contactCode
;
private
String
contactPhone
;
private
String
depositBank
;
private
String
depositAccount
;
private
String
depositAddress
;
public
String
getEnterpriceName
()
{
return
enterpriceName
;
}
public
void
setEnterpriceName
(
String
enterpriceName
)
{
this
.
enterpriceName
=
enterpriceName
;
}
public
String
getCompanyAttribute
()
{
return
companyAttribute
;
}
public
void
setCompanyAttribute
(
String
companyAttribute
)
{
this
.
companyAttribute
=
companyAttribute
;
}
public
String
getExtraChoseOne
()
{
return
extraChoseOne
;
}
public
void
setExtraChoseOne
(
String
extraChoseOne
)
{
this
.
extraChoseOne
=
extraChoseOne
;
}
public
String
getExtraChoseTwo
()
{
return
extraChoseTwo
;
}
public
void
setExtraChoseTwo
(
String
extraChoseTwo
)
{
this
.
extraChoseTwo
=
extraChoseTwo
;
}
public
String
getEnterpricePhone
()
{
return
enterpricePhone
;
}
public
void
setEnterpricePhone
(
String
enterpricePhone
)
{
this
.
enterpricePhone
=
enterpricePhone
;
}
public
String
getContactName
()
{
return
contactName
;
}
public
void
setContactName
(
String
contactName
)
{
this
.
contactName
=
contactName
;
}
public
String
getContactCode
()
{
return
contactCode
;
}
public
void
setContactCode
(
String
contactCode
)
{
this
.
contactCode
=
contactCode
;
}
public
String
getContactPhone
()
{
return
contactPhone
;
}
public
void
setContactPhone
(
String
contactPhone
)
{
this
.
contactPhone
=
contactPhone
;
}
public
String
getDepositBank
()
{
return
depositBank
;
}
public
void
setDepositBank
(
String
depositBank
)
{
this
.
depositBank
=
depositBank
;
}
public
String
getDepositAccount
()
{
return
depositAccount
;
}
public
void
setDepositAccount
(
String
depositAccount
)
{
this
.
depositAccount
=
depositAccount
;
}
public
String
getDepositAddress
()
{
return
depositAddress
;
}
public
void
setDepositAddress
(
String
depositAddress
)
{
this
.
depositAddress
=
depositAddress
;
}
}
src/main/java/com/pangding/web/authority/dto/
MobileRegisterCompany
Dto.java
→
src/main/java/com/pangding/web/authority/dto/
RegisterIndividual
Dto.java
View file @
d48f5545
...
...
@@ -4,13 +4,7 @@ package com.pangding.web.authority.dto;
* @Author zhangjinyao
* @create 2019/5/13 17:32
*/
public
class
MobileRegisterCompanyDto
{
private
String
companyId
;
private
String
merchantId
;
private
String
companyType
;
public
class
RegisterIndividualDto
{
private
String
contactName
;
...
...
@@ -40,30 +34,6 @@ public class MobileRegisterCompanyDto {
this
.
extraChoseTwo
=
extraChoseTwo
;
}
public
String
getCompanyId
()
{
return
companyId
;
}
public
void
setCompanyId
(
String
companyId
)
{
this
.
companyId
=
companyId
;
}
public
String
getMerchantId
()
{
return
merchantId
;
}
public
void
setMerchantId
(
String
merchantId
)
{
this
.
merchantId
=
merchantId
;
}
public
String
getCompanyType
()
{
return
companyType
;
}
public
void
setCompanyType
(
String
companyType
)
{
this
.
companyType
=
companyType
;
}
public
String
getContactName
()
{
return
contactName
;
}
...
...
src/main/java/com/pangding/web/authority/dto/
Mobile
RegisterUserDto.java
→
src/main/java/com/pangding/web/authority/dto/RegisterUserDto.java
View file @
d48f5545
...
...
@@ -6,13 +6,13 @@ import com.pangding.web.authority.vo.UserVo;
* @Author zhangjinyao
* @create 2019/5/13 15:17
*/
public
class
Mobile
RegisterUserDto
{
public
class
RegisterUserDto
{
private
String
account
;
private
String
password
;
private
String
companyType
;
private
int
companyType
;
private
String
merchantId
;
...
...
@@ -32,11 +32,11 @@ public class MobileRegisterUserDto {
this
.
password
=
password
;
}
public
String
getCompanyType
()
{
public
int
getCompanyType
()
{
return
companyType
;
}
public
void
setCompanyType
(
String
companyType
)
{
public
void
setCompanyType
(
int
companyType
)
{
this
.
companyType
=
companyType
;
}
...
...
src/main/java/com/pangding/web/authority/reqvo/GetUserByAccountReqVo.java
View file @
d48f5545
...
...
@@ -10,16 +10,6 @@ import org.springframework.context.annotation.Bean;
public
class
GetUserByAccountReqVo
{
private
String
account
;
private
String
id
;
public
String
getId
()
{
return
id
;
}
public
void
setId
(
String
id
)
{
this
.
id
=
id
;
}
public
String
getAccount
()
{
return
account
;
}
...
...
src/main/java/com/pangding/web/authority/reqvo/GetUserByCompanyIdReqVo.java
0 → 100644
View file @
d48f5545
package
com
.
pangding
.
web
.
authority
.
reqvo
;
/**
* @Author zhangjinyao
* @create 2019/5/14 11:24
*/
public
class
GetUserByCompanyIdReqVo
{
private
String
companyId
;
public
String
getCompanyId
()
{
return
companyId
;
}
public
void
setCompanyId
(
String
companyId
)
{
this
.
companyId
=
companyId
;
}
}
src/main/java/com/pangding/web/authority/reqvo/GetUserByPhoneReqVo.java
0 → 100644
View file @
d48f5545
package
com
.
pangding
.
web
.
authority
.
reqvo
;
/**
* @Author zhangjinyao
* @create 2019/5/14 15:48
*/
public
class
GetUserByPhoneReqVo
{
private
String
phone
;
public
String
getPhone
()
{
return
phone
;
}
public
void
setPhone
(
String
phone
)
{
this
.
phone
=
phone
;
}
}
src/main/java/com/pangding/web/authority/service/ComputerRegisterService.java
0 → 100644
View file @
d48f5545
package
com
.
pangding
.
web
.
authority
.
service
;
/**
* @Author zhangjinyao
* @create 2019/5/14 16:30
*/
public
interface
ComputerRegisterService
{
}
src/main/java/com/pangding/web/authority/service/MobileRegisterService.java
View file @
d48f5545
package
com
.
pangding
.
web
.
authority
.
service
;
import
com.pangding.web.authority.dto.UserDto
;
import
com.pangding.web.authority.dto.RegisterIndividualDto
;
import
com.pangding.web.authority.vo.CompanyVo
;
import
com.pangding.web.authority.vo.UserVo
;
/**
...
...
@@ -24,4 +25,18 @@ public interface MobileRegisterService {
* @param userVo UserVo对象
*/
void
saveUser
(
UserVo
userVo
);
/**
* 保存公司信息
*
* @param companyVo CompanyVo对象
*/
void
saveCompany
(
CompanyVo
companyVo
);
/**
* 检查电话号码是否已存在
*
* @param companyDto MobileRegisterCompanyDto对象
*/
void
checkPhone
(
RegisterIndividualDto
companyDto
);
}
src/main/java/com/pangding/web/authority/service/UserService.java
View file @
d48f5545
...
...
@@ -27,13 +27,19 @@ public interface UserService {
void
updateUser
(
UserDto
userDto
);
/**
*
通过UserVo对象获取相同的UserVo对象
*
检查用户名是否存在
*
* @param userVo UserVo对象
* @return UserVo对象
*/
void
checkAccount
(
UserVo
userVo
);
/**
* 检查电话号码是否存在
*
* @param userVo UserVo对象
*/
void
checkPhone
(
UserVo
userVo
);
/**
* 对密码进行MD5盐值加密
*
...
...
@@ -82,4 +88,36 @@ public interface UserService {
* @return RoleVo对象
*/
RoleVo
getRoleByRoleId
(
GetRoleByRoleIdReqVo
getRoleByRoleIdReqVo
);
/**
* 检查用户名是否合法
*
* @param account 用户名
* @return
*/
Boolean
isValid
(
String
account
);
/**
* 检查是否为纯数字,用来判断输入的是用户名还是手机号
*
* @param account 用户名
* @return
*/
Boolean
isNumeric
(
String
account
);
/**
* 通过电话号码获取用户信息
*
* @param phone 电话号码
* @return UserVo对象
*/
UserVo
getUserByPhone
(
String
phone
);
/**
* 通过用户名获取用户信息
*
* @param account 用户名
* @return UserVo对象
*/
UserVo
getUserByAccount
(
String
account
);
}
src/main/java/com/pangding/web/authority/service/impl/ComputerRegisterServiceImpl.java
0 → 100644
View file @
d48f5545
package
com
.
pangding
.
web
.
authority
.
service
.
impl
;
import
com.pangding.web.authority.service.ComputerRegisterService
;
import
org.springframework.stereotype.Service
;
/**
* @Author zhangjinyao
* @create 2019/5/14 16:31
*/
@Service
public
class
ComputerRegisterServiceImpl
implements
ComputerRegisterService
{
}
src/main/java/com/pangding/web/authority/service/impl/MobileRegisterServiceImpl.java
View file @
d48f5545
...
...
@@ -2,12 +2,15 @@ package com.pangding.web.authority.service.impl;
import
com.pangding.web.authority.dao.MobileRegisterDao
;
import
com.pangding.web.authority.dao.UserDao
;
import
com.pangding.web.authority.dto.RegisterIndividualDto
;
import
com.pangding.web.authority.reqvo.CheckMerchantIdReqVo
;
import
com.pangding.web.authority.reqvo.GetUserByCompanyIdReqVo
;
import
com.pangding.web.authority.service.MobileRegisterService
;
import
com.pangding.web.authority.vo.CompanyVo
;
import
com.pangding.web.authority.vo.UserVo
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
/**
* @Author zhangjinyao
...
...
@@ -34,4 +37,22 @@ public class MobileRegisterServiceImpl implements MobileRegisterService {
public
void
saveUser
(
UserVo
userVo
)
{
userDaoImpl
.
create
(
userVo
);
}
@Override
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
void
saveCompany
(
CompanyVo
companyVo
)
{
mobileRegisterDaoImpl
.
create
(
companyVo
);
GetUserByCompanyIdReqVo
companyId
=
new
GetUserByCompanyIdReqVo
();
companyId
.
setCompanyId
(
companyVo
.
getId
());
UserVo
userVo
=
userDaoImpl
.
getUserByCompanyId
(
companyId
);
userVo
.
setPhone
(
companyVo
.
getContactPhone
());
userDaoImpl
.
update
(
userVo
);
}
@Override
public
void
checkPhone
(
RegisterIndividualDto
companyDto
)
{
CompanyVo
companyVo
=
new
CompanyVo
();
companyVo
.
setContactPhone
(
companyDto
.
getContactPhone
());
mobileRegisterDaoImpl
.
checkPhone
(
companyVo
);
}
}
src/main/java/com/pangding/web/authority/service/impl/UserServiceImpl.java
View file @
d48f5545
...
...
@@ -4,10 +4,7 @@ import com.pangding.web.authority.dao.RoleDao;
import
com.pangding.web.authority.dao.UserDao
;
import
com.pangding.web.authority.dao.UserRoleDao
;
import
com.pangding.web.authority.dto.UserDto
;
import
com.pangding.web.authority.reqvo.GetRoleByRoleIdReqVo
;
import
com.pangding.web.authority.reqvo.GetUserByIdReqVo
;
import
com.pangding.web.authority.reqvo.GetUserRoleListByUserIdReqVo
;
import
com.pangding.web.authority.reqvo.UserRoleDaoRemoveReqVo
;
import
com.pangding.web.authority.reqvo.*
;
import
com.pangding.web.authority.service.UserService
;
import
com.pangding.web.authority.utils.Md5AndSalt
;
import
com.pangding.web.authority.vo.*
;
...
...
@@ -93,6 +90,11 @@ public class UserServiceImpl implements UserService {
userDao
.
checkAccount
(
userVo
);
}
@Override
public
void
checkPhone
(
UserVo
userVo
)
{
userDao
.
checkPhone
(
userVo
);
}
@Override
public
String
passwordEncoder
(
String
password
)
{
return
Md5AndSalt
.
generate
(
password
);
}
...
...
@@ -129,4 +131,35 @@ public class UserServiceImpl implements UserService {
public
RoleVo
getRoleByRoleId
(
GetRoleByRoleIdReqVo
getRoleByRoleIdReqVo
)
{
return
roleDao
.
getRoleById
(
getRoleByRoleIdReqVo
);
}
@Override
public
Boolean
isNumeric
(
String
account
)
{
for
(
int
i
=
0
;
i
<
account
.
length
();
i
++){
if
(!
Character
.
isDigit
(
account
.
charAt
(
i
))){
return
false
;
}
}
return
true
;
}
@Override
public
Boolean
isValid
(
String
account
)
{
String
regex
=
"^(?!\\d+$)[\\da-zA-Z]+$"
;
return
account
.
matches
(
regex
);
}
@Override
public
UserVo
getUserByPhone
(
String
phone
)
{
GetUserByPhoneReqVo
getUserByPhoneReqVo
=
new
GetUserByPhoneReqVo
();
getUserByPhoneReqVo
.
setPhone
(
phone
);
return
userDao
.
load
(
getUserByPhoneReqVo
,
UserVo
.
class
);
}
@Override
public
UserVo
getUserByAccount
(
String
account
)
{
GetUserByAccountReqVo
getUserByAccountReqVo
=
new
GetUserByAccountReqVo
();
getUserByAccountReqVo
.
setAccount
(
account
);
return
userDao
.
load
(
getUserByAccountReqVo
,
UserVo
.
class
);
}
}
src/main/java/com/pangding/web/authority/vo/MobileLoginInfo.java
0 → 100644
View file @
d48f5545
package
com
.
pangding
.
web
.
authority
.
vo
;
/**
* @Author zhangjinyao
* @create 2019/5/14 11:46
*/
public
class
MobileLoginInfo
{
private
String
accountOrPhone
;
private
String
password
;
public
String
getAccountOrPhone
()
{
return
accountOrPhone
;
}
public
void
setAccountOrPhone
(
String
accountOrPhone
)
{
this
.
accountOrPhone
=
accountOrPhone
;
}
public
String
getPassword
()
{
return
password
;
}
public
void
setPassword
(
String
password
)
{
this
.
password
=
password
;
}
}
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