Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wecloud_im_server
Overview
Overview
Details
Activity
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
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
hewei
wecloud_im_server
Commits
9bfab0bf
Commit
9bfab0bf
authored
Sep 30, 2020
by
giaogiao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
优化app注册登陆;
parent
a0cbabe1
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
53 additions
and
34 deletions
+53
-34
api-app/src/main/java/com/jumeirah/api/app/controller/AppSmsController.java
+3
-4
api-app/src/main/java/com/jumeirah/api/app/controller/AppUserController.java
+3
-11
api-app/src/main/java/com/jumeirah/api/app/service/AppSmsService.java
+1
-1
api-app/src/main/java/com/jumeirah/api/app/service/impl/AppSmsServiceImpl.java
+1
-1
api-app/src/main/java/com/jumeirah/api/app/service/impl/AppUserApiServiceImpl.java
+2
-2
common/src/main/java/com/jumeirah/common/param/app/AppSmsRegisterParam.java
+1
-1
common/src/main/java/com/jumeirah/common/service/AppUserService.java
+1
-1
common/src/main/java/com/jumeirah/common/service/impl/AppUserServiceImpl.java
+8
-5
common/src/main/java/com/jumeirah/common/vo/app/LoginAppUserTokenVo.java
+33
-8
No files found.
api-app/src/main/java/com/jumeirah/api/app/controller/AppSmsController.java
View file @
9bfab0bf
package
com
.
jumeirah
.
api
.
app
.
controller
;
package
com
.
jumeirah
.
api
.
app
.
controller
;
import
com.jumeirah.api.app.service.AppSmsService
;
import
com.jumeirah.api.app.service.AppSmsService
;
import
com.jumeirah.api.app.vo.SmsCode
;
import
io.geekidea.springbootplus.framework.common.api.ApiResult
;
import
io.geekidea.springbootplus.framework.common.api.ApiResult
;
import
io.geekidea.springbootplus.framework.common.controller.BaseController
;
import
io.geekidea.springbootplus.framework.common.controller.BaseController
;
import
io.geekidea.springbootplus.framework.log.annotation.OperationLog
;
import
io.geekidea.springbootplus.framework.log.annotation.OperationLog
;
...
@@ -36,10 +35,10 @@ public class AppSmsController extends BaseController {
...
@@ -36,10 +35,10 @@ public class AppSmsController extends BaseController {
*/
*/
@GetMapping
(
"/registerOrLoginCode"
)
@GetMapping
(
"/registerOrLoginCode"
)
@OperationLog
(
name
=
"获取注册或登陆的验证码"
,
type
=
OperationLogType
.
INFO
)
@OperationLog
(
name
=
"获取注册或登陆的验证码"
,
type
=
OperationLogType
.
INFO
)
@ApiOperation
(
value
=
"获取注册或登陆的验证码"
,
response
=
SmsCode
.
class
,
notes
=
"本地环境默认666666"
)
@ApiOperation
(
value
=
"获取注册或登陆的验证码"
,
response
=
Object
.
class
,
notes
=
"本地环境默认666666"
)
public
ApiResult
<
Object
>
register
(
@RequestParam
String
phoneArea
,
@RequestParam
String
phone
)
throws
Exception
{
public
ApiResult
<
Object
>
register
OrLoginCode
(
@RequestParam
String
phoneArea
,
@RequestParam
String
phone
)
throws
Exception
{
return
appSmsService
.
register
Typ
e
(
phoneArea
,
phone
);
return
appSmsService
.
register
OrLoginCod
e
(
phoneArea
,
phone
);
}
}
}
}
...
...
api-app/src/main/java/com/jumeirah/api/app/controller/AppUserController.java
View file @
9bfab0bf
...
@@ -7,7 +7,6 @@ import com.jumeirah.common.param.app.AppSmsRegisterParam;
...
@@ -7,7 +7,6 @@ import com.jumeirah.common.param.app.AppSmsRegisterParam;
import
com.jumeirah.common.param.app.AppUserInfoParam
;
import
com.jumeirah.common.param.app.AppUserInfoParam
;
import
com.jumeirah.common.service.AppUserService
;
import
com.jumeirah.common.service.AppUserService
;
import
com.jumeirah.common.vo.AppUserQueryVo
;
import
com.jumeirah.common.vo.AppUserQueryVo
;
import
com.jumeirah.common.vo.LoginSysUserTokenVo
;
import
com.jumeirah.common.vo.app.LoginAppUserTokenVo
;
import
com.jumeirah.common.vo.app.LoginAppUserTokenVo
;
import
io.geekidea.springbootplus.framework.common.api.ApiResult
;
import
io.geekidea.springbootplus.framework.common.api.ApiResult
;
import
io.geekidea.springbootplus.framework.common.controller.BaseController
;
import
io.geekidea.springbootplus.framework.common.controller.BaseController
;
...
@@ -54,8 +53,8 @@ public class AppUserController extends BaseController {
...
@@ -54,8 +53,8 @@ public class AppUserController extends BaseController {
* 添加APP用户
* 添加APP用户
*/
*/
@PostMapping
(
"/updateAppUserInfo"
)
@PostMapping
(
"/updateAppUserInfo"
)
//
@OperationLog(name = "补充或修改APP用户信息", type = OperationLogType.ADD)
@OperationLog
(
name
=
"补充或修改APP用户信息"
,
type
=
OperationLogType
.
ADD
)
@ApiOperation
(
value
=
"补充或修改APP用户信息"
,
notes
=
"不需要修改的字段传入null"
,
response
=
ApiResult
.
class
)
@ApiOperation
(
value
=
"补充或修改APP用户信息"
,
notes
=
"不需要修改的字段传入null
或直接不传入该字段,如果传入空双引号的话会将数据置为空
"
,
response
=
ApiResult
.
class
)
public
ApiResult
<
Boolean
>
updateAppUserInfo
(
@RequestBody
AppUserInfoParam
appUserInfoParam
)
throws
Exception
{
public
ApiResult
<
Boolean
>
updateAppUserInfo
(
@RequestBody
AppUserInfoParam
appUserInfoParam
)
throws
Exception
{
boolean
flag
=
appUserApiService
.
updateAppUser
(
appUserInfoParam
);
boolean
flag
=
appUserApiService
.
updateAppUser
(
appUserInfoParam
);
return
ApiResult
.
result
(
flag
);
return
ApiResult
.
result
(
flag
);
...
@@ -122,17 +121,10 @@ public class AppUserController extends BaseController {
...
@@ -122,17 +121,10 @@ public class AppUserController extends BaseController {
}
}
@PostMapping
(
"/registerOrLogin"
)
@PostMapping
(
"/registerOrLogin"
)
@ApiOperation
(
value
=
"手机号注册+登陆"
,
notes
=
"app用户注册+登陆"
,
response
=
Login
Sys
UserTokenVo
.
class
)
@ApiOperation
(
value
=
"手机号注册+登陆"
,
notes
=
"app用户注册+登陆"
,
response
=
Login
App
UserTokenVo
.
class
)
public
ApiResult
<
LoginAppUserTokenVo
>
registerOrLogin
(
@Validated
@RequestBody
AppSmsRegisterParam
appSmsRegisterParam
,
@RequestHeader
(
required
=
false
)
String
language
)
throws
Exception
{
public
ApiResult
<
LoginAppUserTokenVo
>
registerOrLogin
(
@Validated
@RequestBody
AppSmsRegisterParam
appSmsRegisterParam
,
@RequestHeader
(
required
=
false
)
String
language
)
throws
Exception
{
return
appUserApiService
.
register
(
appSmsRegisterParam
,
language
);
return
appUserApiService
.
register
(
appSmsRegisterParam
,
language
);
}
}
// @PostMapping("/login")
// @ApiOperation(value = "手机号登陆", notes = "app用户登录", response = LoginSysUserTokenVo.class)
// public ApiResult<LoginAppUserTokenVo> login(@Validated @RequestBody AppSmsRegisterParam loginParam, @RequestHeader(required = false) String language) throws Exception {
//// return appRegisterService.login(loginParam, language);
// return null;
// }
}
}
api-app/src/main/java/com/jumeirah/api/app/service/AppSmsService.java
View file @
9bfab0bf
...
@@ -9,7 +9,7 @@ public interface AppSmsService {
...
@@ -9,7 +9,7 @@ public interface AppSmsService {
/**
/**
* 获取注册验证码
* 获取注册验证码
*/
*/
ApiResult
<
Object
>
register
Typ
e
(
String
phoneArea
,
String
phone
);
ApiResult
<
Object
>
register
OrLoginCod
e
(
String
phoneArea
,
String
phone
);
/**
/**
* 获取注册验证码
* 获取注册验证码
...
...
api-app/src/main/java/com/jumeirah/api/app/service/impl/AppSmsServiceImpl.java
View file @
9bfab0bf
...
@@ -52,7 +52,7 @@ public class AppSmsServiceImpl implements AppSmsService {
...
@@ -52,7 +52,7 @@ public class AppSmsServiceImpl implements AppSmsService {
}
}
@Override
@Override
public
ApiResult
<
Object
>
register
Typ
e
(
String
area
,
String
number
)
{
public
ApiResult
<
Object
>
register
OrLoginCod
e
(
String
area
,
String
number
)
{
return
getSmsCodeApiResult
(
String
.
format
(
SMS_REGIEST
,
area
,
number
),
area
,
number
);
return
getSmsCodeApiResult
(
String
.
format
(
SMS_REGIEST
,
area
,
number
),
area
,
number
);
}
}
...
...
api-app/src/main/java/com/jumeirah/api/app/service/impl/AppUserApiServiceImpl.java
View file @
9bfab0bf
...
@@ -36,7 +36,7 @@ public class AppUserApiServiceImpl implements AppUserApiService {
...
@@ -36,7 +36,7 @@ public class AppUserApiServiceImpl implements AppUserApiService {
// 判断是否已经注册
// 判断是否已经注册
if
(
appUserService
.
hasUserByPhoneNumer
(
loginParam
.
getPhoneArea
(),
loginParam
.
getPhone
()))
{
if
(
appUserService
.
hasUserByPhoneNumer
(
loginParam
.
getPhoneArea
(),
loginParam
.
getPhone
()))
{
// 如果已经注册直接走登陆的代码
// 如果已经注册直接走登陆的代码
return
appUserService
.
login
(
loginParam
,
language
);
return
appUserService
.
login
(
loginParam
,
language
,
true
);
}
}
// 没注册则先保存到数据库
// 没注册则先保存到数据库
...
@@ -49,7 +49,7 @@ public class AppUserApiServiceImpl implements AppUserApiService {
...
@@ -49,7 +49,7 @@ public class AppUserApiServiceImpl implements AppUserApiService {
}
}
// 走登陆的代码
// 走登陆的代码
return
appUserService
.
login
(
loginParam
,
language
);
return
appUserService
.
login
(
loginParam
,
language
,
false
);
}
}
@Override
@Override
...
...
common/src/main/java/com/jumeirah/common/param/app/AppSmsRegisterParam.java
View file @
9bfab0bf
...
@@ -30,7 +30,7 @@ import java.io.Serializable;
...
@@ -30,7 +30,7 @@ import java.io.Serializable;
* @date 2019-05-15
* @date 2019-05-15
**/
**/
@Data
@Data
@ApiModel
(
"app手机验证码注册参数"
)
@ApiModel
(
"app手机验证码注册参数
AppSmsRegisterParam
"
)
public
class
AppSmsRegisterParam
implements
Serializable
{
public
class
AppSmsRegisterParam
implements
Serializable
{
@NotBlank
(
message
=
"请输入手机区号"
)
@NotBlank
(
message
=
"请输入手机区号"
)
...
...
common/src/main/java/com/jumeirah/common/service/AppUserService.java
View file @
9bfab0bf
...
@@ -41,7 +41,7 @@ public interface AppUserService extends BaseService<AppUser> {
...
@@ -41,7 +41,7 @@ public interface AppUserService extends BaseService<AppUser> {
* @param language
* @param language
* @return
* @return
*/
*/
ApiResult
<
LoginAppUserTokenVo
>
login
(
AppSmsRegisterParam
loginParam
,
String
language
);
ApiResult
<
LoginAppUserTokenVo
>
login
(
AppSmsRegisterParam
loginParam
,
String
language
,
Boolean
hasRegister
);
/**
/**
...
...
common/src/main/java/com/jumeirah/common/service/impl/AppUserServiceImpl.java
View file @
9bfab0bf
...
@@ -29,6 +29,7 @@ import org.apache.commons.codec.digest.DigestUtils;
...
@@ -29,6 +29,7 @@ import org.apache.commons.codec.digest.DigestUtils;
import
org.apache.shiro.SecurityUtils
;
import
org.apache.shiro.SecurityUtils
;
import
org.apache.shiro.authc.AuthenticationException
;
import
org.apache.shiro.authc.AuthenticationException
;
import
org.apache.shiro.subject.Subject
;
import
org.apache.shiro.subject.Subject
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.context.annotation.Lazy
;
import
org.springframework.context.annotation.Lazy
;
import
org.springframework.data.redis.core.RedisTemplate
;
import
org.springframework.data.redis.core.RedisTemplate
;
...
@@ -83,7 +84,7 @@ public class AppUserServiceImpl extends BaseServiceImpl<AppUserMapper, AppUser>
...
@@ -83,7 +84,7 @@ public class AppUserServiceImpl extends BaseServiceImpl<AppUserMapper, AppUser>
// }
// }
@Override
@Override
public
ApiResult
<
LoginAppUserTokenVo
>
login
(
AppSmsRegisterParam
loginParam
,
String
language
)
{
public
ApiResult
<
LoginAppUserTokenVo
>
login
(
AppSmsRegisterParam
loginParam
,
String
language
,
Boolean
hasRegister
)
{
// 从数据库中获取登录用户信息
// 从数据库中获取登录用户信息
AppUser
appUser
=
appUserMapper
.
selectOne
(
new
QueryWrapper
<>(
AppUser
appUser
=
appUserMapper
.
selectOne
(
new
QueryWrapper
<>(
...
@@ -134,10 +135,12 @@ public class AppUserServiceImpl extends BaseServiceImpl<AppUserMapper, AppUser>
...
@@ -134,10 +135,12 @@ public class AppUserServiceImpl extends BaseServiceImpl<AppUserMapper, AppUser>
redisTemplate
.
opsForValue
().
set
(
tokenSha256
,
loginSysUserVo
,
1
,
TimeUnit
.
DAYS
);
redisTemplate
.
opsForValue
().
set
(
tokenSha256
,
loginSysUserVo
,
1
,
TimeUnit
.
DAYS
);
// 返回token和登录用户信息对象
// 返回token和登录用户信息对象
LoginAppUserTokenVo
loginSysUserTokenVo
=
new
LoginAppUserTokenVo
();
LoginAppUserTokenVo
loginAppUserTokenVo
=
new
LoginAppUserTokenVo
();
loginSysUserTokenVo
.
setToken
(
token
);
BeanUtils
.
copyProperties
(
appUser
,
loginAppUserTokenVo
);
loginSysUserTokenVo
.
setUserId
(
appUser
.
getId
());
loginAppUserTokenVo
.
setToken
(
token
);
return
ApiResult
.
ok
(
loginSysUserTokenVo
,
language
);
loginAppUserTokenVo
.
setId
(
appUser
.
getId
());
loginAppUserTokenVo
.
setHasRegister
(
hasRegister
);
return
ApiResult
.
ok
(
loginAppUserTokenVo
,
language
);
}
}
...
...
common/src/main/java/com/jumeirah/common/vo/app/LoginAppUserTokenVo.java
View file @
9bfab0bf
...
@@ -28,23 +28,48 @@ import lombok.experimental.Accessors;
...
@@ -28,23 +28,48 @@ import lombok.experimental.Accessors;
**/
**/
@Data
@Data
@Accessors
(
chain
=
true
)
@Accessors
(
chain
=
true
)
@ApiModel
(
"登录用户信息
TokenVO
"
)
@ApiModel
(
"登录用户信息
LoginAppUserTokenVo
"
)
public
class
LoginAppUserTokenVo
implements
LoginToken
{
public
class
LoginAppUserTokenVo
implements
LoginToken
{
@ApiModelProperty
(
"token"
)
@ApiModelProperty
(
"token"
)
private
String
token
;
private
String
token
;
@ApiModelProperty
(
"主键"
)
@ApiModelProperty
(
"主键"
)
private
Long
userI
d
;
private
Long
i
d
;
@ApiModelProperty
(
"用户名"
)
@ApiModelProperty
(
"用户名"
)
private
String
username
;
private
String
username
;
// @ApiModelProperty("昵称
")
@ApiModelProperty
(
"是否已经注册, true = 已经注册
"
)
// private String nickname
;
private
Boolean
hasRegister
;
// /**
@ApiModelProperty
(
"姓"
)
// * 登录用户对象
private
String
surname
;
// */
// private LoginUserVo loginSysUserVo;
@ApiModelProperty
(
"名"
)
private
String
name
;
@ApiModelProperty
(
"公司名"
)
private
String
companyName
;
@ApiModelProperty
(
"微信号"
)
private
String
wechat
;
@ApiModelProperty
(
"出生日期"
)
private
String
dateOfBirth
;
@ApiModelProperty
(
"昵称"
)
private
String
nickname
;
@ApiModelProperty
(
"手机号码"
)
private
String
phone
;
@ApiModelProperty
(
"手机区号"
)
private
String
phoneArea
;
@ApiModelProperty
(
"性别,0:女,1:男,默认1"
)
private
Integer
gender
;
@ApiModelProperty
(
"头像"
)
private
String
head
;
}
}
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