Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
eshiled-new
/
ne-shield-miniappserver
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 89c85255
authored
Jun 29, 2022
by
levphon
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
微信小程序C端账号体系
1 parent
2c3a9260
Hide whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
126 additions
and
36 deletions
pom.xml
src/main/java/cn/com/glsx/app/common/enums/MiniUserType.java
src/main/java/cn/com/glsx/app/config/WebConfig.java
src/main/java/cn/com/glsx/app/modules/LocalLoginController.java
src/main/java/cn/com/glsx/app/modules/ThirdLoginController.java
src/main/java/cn/com/glsx/app/modules/controller/DashboardController.java
src/main/java/cn/com/glsx/app/modules/controller/VehicleMonitorController.java
src/main/java/cn/com/glsx/app/modules/entity/User.java
src/main/java/cn/com/glsx/app/modules/model/AppUser.java
src/main/java/cn/com/glsx/app/modules/model/LoginByAccountBO.java
src/main/java/cn/com/glsx/app/modules/service/LoginService.java
src/main/java/cn/com/glsx/app/modules/service/UserService.java
src/main/resources/mapper/UserLocalAccountMapper.xml
src/main/resources/mapper/UserMapper.xml
src/main/resources/mapper/UserQQAccountMapper.xml
pom.xml
View file @
89c8525
...
@@ -2,9 +2,9 @@
...
@@ -2,9 +2,9 @@
<project
xmlns=
"http://maven.apache.org/POM/4.0.0"
xmlns:xsi=
"http://www.w3.org/2001/XMLSchema-instance"
<project
xmlns=
"http://maven.apache.org/POM/4.0.0"
xmlns:xsi=
"http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation=
"http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"
>
xsi:schemaLocation=
"http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"
>
<parent>
<parent>
<artifactId>
glsx-ne-shield
</artifactId>
<artifactId>
ne-shield-parent
</artifactId>
<groupId>
com.glsx
</groupId>
<groupId>
com.glsx
</groupId>
<version>
1.0-SNAPSHOT
</version>
<version>
1.
2.
0-SNAPSHOT
</version>
</parent>
</parent>
<modelVersion>
4.0.0
</modelVersion>
<modelVersion>
4.0.0
</modelVersion>
<packaging>
war
</packaging>
<packaging>
war
</packaging>
...
...
src/main/java/cn/com/glsx/app/common/enums/MiniUserType.java
0 → 100644
View file @
89c8525
package
cn
.
com
.
glsx
.
app
.
common
.
enums
;
import
lombok.Getter
;
@Getter
public
enum
MiniUserType
{
NORMAL
(
1
,
"normal"
),
SHARED
(
2
,
"shared"
);
private
Integer
flag
;
private
String
type
;
MiniUserType
(
Integer
flag
,
String
type
)
{
this
.
flag
=
flag
;
this
.
type
=
type
;
}
}
src/main/java/cn/com/glsx/app/config/WebConfig.java
View file @
89c8525
package
cn
.
com
.
glsx
.
app
.
config
;
package
cn
.
com
.
glsx
.
app
.
config
;
import
cn.com.glsx.auth.interceptor.WebRequestAuthorizeInterceptor
;
import
cn.com.glsx.auth.interceptor.WebRequestAuthorizeInterceptor
;
import
com.google.common.collect.Lists
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.web.servlet.config.annotation.InterceptorRegistry
;
import
org.springframework.web.servlet.config.annotation.InterceptorRegistry
;
import
org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry
;
import
org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry
;
import
org.springframework.web.servlet.config.annotation.WebMvcConfigurer
;
import
org.springframework.web.servlet.config.annotation.WebMvcConfigurer
;
import
java.util.List
;
/**
/**
* @author payu
* @author payu
*/
*/
...
@@ -35,9 +32,7 @@ public class WebConfig implements WebMvcConfigurer {
...
@@ -35,9 +32,7 @@ public class WebConfig implements WebMvcConfigurer {
.
excludePathPatterns
(
"/"
)
.
excludePathPatterns
(
"/"
)
.
excludePathPatterns
(
"/login"
)
.
excludePathPatterns
(
"/login"
)
.
excludePathPatterns
(
"/wechatAuth"
)
.
excludePathPatterns
(
"/wechatAuth"
)
.
excludePathPatterns
(
"/wechatLogin"
)
.
excludePathPatterns
(
"/qqAuth"
)
.
excludePathPatterns
(
"/qqAuth"
)
.
excludePathPatterns
(
"/qqLogin"
)
.
excludePathPatterns
(
"/xactuator/**"
)
.
excludePathPatterns
(
"/xactuator/**"
)
.
excludePathPatterns
(
"/api/**"
)
.
excludePathPatterns
(
"/api/**"
)
.
excludePathPatterns
(
"/swagger-resources/**"
,
"/webjars/**"
,
"/v2/**"
,
"/swagger-ui.html/**"
);
.
excludePathPatterns
(
"/swagger-resources/**"
,
"/webjars/**"
,
"/v2/**"
,
"/swagger-ui.html/**"
);
...
...
src/main/java/cn/com/glsx/app/modules/LocalLoginController.java
View file @
89c8525
...
@@ -5,6 +5,8 @@ import cn.com.glsx.app.modules.model.LoginByAccountBO;
...
@@ -5,6 +5,8 @@ import cn.com.glsx.app.modules.model.LoginByAccountBO;
import
cn.com.glsx.app.modules.service.LoginService
;
import
cn.com.glsx.app.modules.service.LoginService
;
import
cn.com.glsx.app.modules.service.UserService
;
import
cn.com.glsx.app.modules.service.UserService
;
import
com.glsx.plat.core.web.R
;
import
com.glsx.plat.core.web.R
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.validation.annotation.Validated
;
import
org.springframework.validation.annotation.Validated
;
...
@@ -22,6 +24,7 @@ import java.util.Map;
...
@@ -22,6 +24,7 @@ import java.util.Map;
* @author liuyf
* @author liuyf
*/
*/
@Slf4j
@Slf4j
@Api
(
value
=
"登录(本地)"
,
tags
=
{
"登录(本地)"
})
@RestController
@RestController
public
class
LocalLoginController
{
public
class
LocalLoginController
{
...
@@ -39,6 +42,7 @@ public class LocalLoginController {
...
@@ -39,6 +42,7 @@ public class LocalLoginController {
/**
/**
* 本地登录
* 本地登录
*/
*/
@ApiOperation
(
value
=
"登录系统"
)
@PostMapping
(
value
=
"/login"
)
@PostMapping
(
value
=
"/login"
)
public
R
login
(
@RequestBody
@Validated
LoginByAccountBO
loginBO
)
{
public
R
login
(
@RequestBody
@Validated
LoginByAccountBO
loginBO
)
{
...
@@ -52,6 +56,7 @@ public class LocalLoginController {
...
@@ -52,6 +56,7 @@ public class LocalLoginController {
return
R
.
ok
().
data
(
rtnMap
);
return
R
.
ok
().
data
(
rtnMap
);
}
}
@ApiOperation
(
value
=
"登出系统"
)
@GetMapping
(
value
=
"/logout"
)
@GetMapping
(
value
=
"/logout"
)
public
R
logout
()
{
public
R
logout
()
{
//todo 拉黑token
//todo 拉黑token
...
...
src/main/java/cn/com/glsx/app/modules/ThirdLoginController.java
View file @
89c8525
...
@@ -3,6 +3,7 @@ package cn.com.glsx.app.modules;
...
@@ -3,6 +3,7 @@ package cn.com.glsx.app.modules;
import
cn.binarywang.wx.miniapp.api.WxMaService
;
import
cn.binarywang.wx.miniapp.api.WxMaService
;
import
cn.binarywang.wx.miniapp.bean.WxMaJscode2SessionResult
;
import
cn.binarywang.wx.miniapp.bean.WxMaJscode2SessionResult
;
import
cn.com.glsx.app.common.enums.LoginType
;
import
cn.com.glsx.app.common.enums.LoginType
;
import
cn.com.glsx.app.common.enums.MiniUserType
;
import
cn.com.glsx.app.modules.entity.UserAuthRel
;
import
cn.com.glsx.app.modules.entity.UserAuthRel
;
import
cn.com.glsx.app.modules.model.AppUser
;
import
cn.com.glsx.app.modules.model.AppUser
;
import
cn.com.glsx.app.modules.model.QQOAuth2AccessToken
;
import
cn.com.glsx.app.modules.model.QQOAuth2AccessToken
;
...
@@ -11,6 +12,8 @@ import cn.com.glsx.app.modules.service.UserService;
...
@@ -11,6 +12,8 @@ import cn.com.glsx.app.modules.service.UserService;
import
cn.hutool.json.JSONUtil
;
import
cn.hutool.json.JSONUtil
;
import
com.glsx.plat.common.annotation.NoLogin
;
import
com.glsx.plat.common.annotation.NoLogin
;
import
com.glsx.plat.core.web.R
;
import
com.glsx.plat.core.web.R
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
import
me.chanjar.weixin.common.error.WxErrorException
;
import
me.chanjar.weixin.common.error.WxErrorException
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
...
@@ -29,6 +32,7 @@ import java.util.Optional;
...
@@ -29,6 +32,7 @@ import java.util.Optional;
* @author liuyf
* @author liuyf
*/
*/
@Slf4j
@Slf4j
@Api
(
value
=
"登录(第三方)"
,
tags
=
{
"登录(第三方)"
})
@RestController
@RestController
public
class
ThirdLoginController
{
public
class
ThirdLoginController
{
...
@@ -42,6 +46,7 @@ public class ThirdLoginController {
...
@@ -42,6 +46,7 @@ public class ThirdLoginController {
private
WxMaService
wxMaService
;
private
WxMaService
wxMaService
;
@NoLogin
@NoLogin
@ApiOperation
(
value
=
"QQ授权登录"
)
@GetMapping
(
value
=
"/qqAuth"
)
@GetMapping
(
value
=
"/qqAuth"
)
public
R
qqAuth
(
@RequestParam
String
code
)
{
public
R
qqAuth
(
@RequestParam
String
code
)
{
//获取openId、unionId等
//获取openId、unionId等
...
@@ -50,38 +55,71 @@ public class ThirdLoginController {
...
@@ -50,38 +55,71 @@ public class ThirdLoginController {
log
.
info
(
"QQ code[{}]获取的Session信息为{}"
,
code
,
JSONUtil
.
toJsonStr
(
accessToken
));
log
.
info
(
"QQ code[{}]获取的Session信息为{}"
,
code
,
JSONUtil
.
toJsonStr
(
accessToken
));
UserAuthRel
authRel
=
loginService
.
qqAuth
(
accessToken
);
UserAuthRel
authRel
=
loginService
.
qqAuth
(
accessToken
);
Map
<
String
,
Object
>
rtnMap
=
thirdLogin
(
LoginType
.
QQ
,
authRel
);
Map
<
String
,
Object
>
rtnMap
=
thirdLogin
(
LoginType
.
QQ
,
0
,
authRel
);
return
R
.
ok
().
data
(
rtnMap
);
return
R
.
ok
().
data
(
rtnMap
);
}
}
@NoLogin
@NoLogin
@ApiOperation
(
value
=
"微信授权登录"
)
@GetMapping
(
value
=
"/wechatAuth"
)
@GetMapping
(
value
=
"/wechatAuth"
)
public
R
wechatAuth
(
@RequestParam
String
code
)
throws
WxErrorException
{
public
R
wechatAuth
(
@RequestParam
String
code
,
@RequestParam
Integer
accessMode
)
throws
WxErrorException
{
//获取openId、unionid、session_key
//获取openId、unionid、session_key
WxMaJscode2SessionResult
sessionInfo
=
wxMaService
.
getUserService
().
getSessionInfo
(
code
);
WxMaJscode2SessionResult
sessionInfo
=
wxMaService
.
getUserService
().
getSessionInfo
(
code
);
log
.
info
(
"微信code[{}]获取的Session信息为{}"
,
code
,
JSONUtil
.
toJsonStr
(
sessionInfo
));
log
.
info
(
"微信code[{}]获取的Session信息为{}"
,
code
,
JSONUtil
.
toJsonStr
(
sessionInfo
));
UserAuthRel
authRel
=
loginService
.
wechatAuth
(
sessionInfo
);
UserAuthRel
authRel
=
loginService
.
wechatAuth
(
sessionInfo
);
Map
<
String
,
Object
>
rtnMap
=
thirdLogin
(
LoginType
.
WECHAT
,
authRel
);
Map
<
String
,
Object
>
rtnMap
=
thirdLogin
(
LoginType
.
WECHAT
,
a
ccessMode
,
a
uthRel
);
return
R
.
ok
().
data
(
rtnMap
);
return
R
.
ok
().
data
(
rtnMap
);
}
}
private
Map
<
String
,
Object
>
thirdLogin
(
LoginType
loginType
,
UserAuthRel
authRel
)
{
/**
* 第三方登录
*
* @param loginType
* @param accessMode 针对loginType而言更具体的访问模式,比如微信小程序登录,通过常规入口方式,还是分享链接方式
* @param authRel
* @return
*/
private
Map
<
String
,
Object
>
thirdLogin
(
LoginType
loginType
,
Integer
accessMode
,
UserAuthRel
authRel
)
{
Map
<
String
,
Object
>
rtnMap
=
new
HashMap
<>();
Map
<
String
,
Object
>
rtnMap
=
new
HashMap
<>();
Optional
<
Long
>
optUserId
=
Optional
.
ofNullable
(
authRel
.
getUserId
());
//分两种情况:
if
(
optUserId
.
isPresent
())
{
if
(
MiniUserType
.
NORMAL
.
getFlag
().
equals
(
accessMode
))
{
//已绑定本地账号
//1、常规免登录(通过小程序正常入口)
AppUser
user
=
userService
.
getAppUserByUserId
(
authRel
.
getUserId
());
Optional
<
Long
>
optUserId
=
Optional
.
ofNullable
(
authRel
.
getUserId
());
if
(
optUserId
.
isPresent
())
{
//已绑定本地账号
AppUser
user
=
userService
.
getAppUserByUserId
(
authRel
.
getUserId
());
user
.
setUserType
(
MiniUserType
.
NORMAL
.
getType
());
String
token
=
userService
.
createToken
(
user
);
rtnMap
.
put
(
"user"
,
user
);
rtnMap
.
put
(
"token"
,
token
);
}
else
{
//未绑定本地账号,跳转登录界面登录,回传此id
rtnMap
.
put
(
"authRelId"
,
authRel
.
getId
());
}
}
else
if
(
MiniUserType
.
SHARED
.
getFlag
().
equals
(
accessMode
))
{
//2、通过分享车辆地址登录,也分两种情况
//a、存在账号的openid发起免登录
//b、不存在账号的openid发起免登录
AppUser
user
=
userService
.
getAppUserByAuthId
(
loginType
,
authRel
.
getAuthId
());
if
(
user
!=
null
)
{
}
else
{
user
=
new
AppUser
();
// TODO: 2022/6/29 设置用户标识
}
user
.
setUserType
(
MiniUserType
.
SHARED
.
getType
());
String
token
=
userService
.
createToken
(
user
);
String
token
=
userService
.
createToken
(
user
);
rtnMap
.
put
(
"user"
,
user
);
rtnMap
.
put
(
"user"
,
user
);
rtnMap
.
put
(
"token"
,
token
);
rtnMap
.
put
(
"token"
,
token
);
}
else
{
}
else
{
//未绑定本地账号,跳转登录界面登录,回传此id
// TODO: 2022/6/29 抛出异常
rtnMap
.
put
(
"authRelId"
,
authRel
.
getId
());
}
}
return
rtnMap
;
return
rtnMap
;
}
}
...
...
src/main/java/cn/com/glsx/app/modules/controller/DashboardController.java
0 → 100644
View file @
89c8525
package
cn
.
com
.
glsx
.
app
.
modules
.
controller
;
import
io.swagger.annotations.Api
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
@Slf4j
@RestController
@RequestMapping
(
value
=
"/dashboard"
)
@Api
(
value
=
"看板"
,
tags
=
{
"看板"
})
public
class
DashboardController
{
}
src/main/java/cn/com/glsx/app/modules/controller/VehicleMonitorController.java
View file @
89c8525
...
@@ -35,6 +35,7 @@ public class VehicleMonitorController {
...
@@ -35,6 +35,7 @@ public class VehicleMonitorController {
return
R
.
ok
().
data
(
list
);
return
R
.
ok
().
data
(
list
);
}
}
@ApiOperation
(
value
=
"设备定位"
)
@GetMapping
(
"/location"
)
@GetMapping
(
"/location"
)
public
R
location
(
@RequestParam
(
"sns"
)
String
sns
)
{
public
R
location
(
@RequestParam
(
"sns"
)
String
sns
)
{
List
<
VehicleLocationDTO
>
vehicleLocations
=
vehicleMonitorService
.
getVehicleLocations
(
sns
);
List
<
VehicleLocationDTO
>
vehicleLocations
=
vehicleMonitorService
.
getVehicleLocations
(
sns
);
...
...
src/main/java/cn/com/glsx/app/modules/entity/User.java
View file @
89c8525
...
@@ -28,7 +28,13 @@ public class User extends BaseEntity {
...
@@ -28,7 +28,13 @@ public class User extends BaseEntity {
private
Integer
tryTimes
;
private
Integer
tryTimes
;
/**
/**
* 用户账号/手机号
* 关联人(账户)id
*/
@Column
(
name
=
"linker_id"
)
private
Long
linkerId
;
/**
* 用户账户/手机号
*/
*/
private
String
account
;
private
String
account
;
...
...
src/main/java/cn/com/glsx/app/modules/model/AppUser.java
View file @
89c8525
...
@@ -5,11 +5,23 @@ import lombok.Data;
...
@@ -5,11 +5,23 @@ import lombok.Data;
@Data
@Data
public
class
AppUser
{
public
class
AppUser
{
private
Long
id
;
/**
* 用户id(对应后台t_user表id)
*/
private
Long
userId
;
/**
* C端用户id(对应后台t_cust_user表id)
*/
private
Long
cuserId
;
private
String
account
;
private
String
account
;
private
String
username
;
private
String
username
;
private
String
avatar
;
private
String
avatar
;
private
Integer
gender
;
/**
* 用户类型:normal正常用户,shared被分享用户,见枚举MiniUserType
*/
private
String
userType
;
private
Integer
blacklist
;
private
Integer
blacklist
;
}
}
\ No newline at end of file
\ No newline at end of file
src/main/java/cn/com/glsx/app/modules/model/LoginByAccountBO.java
View file @
89c8525
...
@@ -20,12 +20,6 @@ public class LoginByAccountBO {
...
@@ -20,12 +20,6 @@ public class LoginByAccountBO {
@NotBlank
(
message
=
"验证码/密码不能为空"
)
@NotBlank
(
message
=
"验证码/密码不能为空"
)
private
String
code
;
private
String
code
;
/**
private
String
codeForWx
;
* 第三方授权关联id
*/
private
Long
authRelId
;
// @NotNull(message = "APP客户端ID不能为空")
// private String clientId;
}
}
src/main/java/cn/com/glsx/app/modules/service/LoginService.java
View file @
89c8525
...
@@ -67,6 +67,7 @@ public class LoginService {
...
@@ -67,6 +67,7 @@ public class LoginService {
}
}
User
user
=
Optional
.
ofNullable
(
userMapper
.
selectByAccount
(
simpleUser
.
getAccount
())).
orElse
(
new
User
());
User
user
=
Optional
.
ofNullable
(
userMapper
.
selectByAccount
(
simpleUser
.
getAccount
())).
orElse
(
new
User
());
user
.
setLinkerId
(
simpleUser
.
getId
());
user
.
setAccount
(
simpleUser
.
getAccount
());
user
.
setAccount
(
simpleUser
.
getAccount
());
user
.
setBlacklist
(
0
);
user
.
setBlacklist
(
0
);
userMapper
.
saveOrUpdate
(
user
);
userMapper
.
saveOrUpdate
(
user
);
...
@@ -159,6 +160,7 @@ public class LoginService {
...
@@ -159,6 +160,7 @@ public class LoginService {
UserAuthRel
authRel
=
userAuthRelMapper
.
selectByAuthTypeAndAuthId
(
AuthType
.
THIRD
.
getType
(),
thirdAuth
.
getId
());
UserAuthRel
authRel
=
userAuthRelMapper
.
selectByAuthTypeAndAuthId
(
AuthType
.
THIRD
.
getType
(),
thirdAuth
.
getId
());
if
(
authRel
==
null
)
{
if
(
authRel
==
null
)
{
authRel
=
new
UserAuthRel
();
authRel
=
new
UserAuthRel
();
//authRel.setUserId(null);
authRel
.
setAuthId
(
thirdAuth
.
getId
());
authRel
.
setAuthId
(
thirdAuth
.
getId
());
authRel
.
setAuthType
(
AuthType
.
THIRD
.
getType
());
authRel
.
setAuthType
(
AuthType
.
THIRD
.
getType
());
userAuthRelMapper
.
insertUseGeneratedKeys
(
authRel
);
userAuthRelMapper
.
insertUseGeneratedKeys
(
authRel
);
...
...
src/main/java/cn/com/glsx/app/modules/service/UserService.java
View file @
89c8525
...
@@ -43,12 +43,13 @@ public class UserService {
...
@@ -43,12 +43,13 @@ public class UserService {
public
String
createToken
(
AppUser
user
)
{
public
String
createToken
(
AppUser
user
)
{
Assert
.
notNull
(
user
,
"获取当前用户信息失败"
);
Assert
.
notNull
(
user
,
"获取当前用户信息失败"
);
String
uuid
=
UUID
.
randomUUID
().
toString
();
//JWT 随机ID,做为验证的key
String
uuid
=
UUID
.
randomUUID
().
toString
();
//JWT 随机ID,做为验证的key
String
jwtId
=
jwtUtils
.
getApplication
()
+
":"
+
uuid
+
"_"
+
jwtUtils
.
JWT_SESSION_PREFIX
+
user
.
getId
();
String
jwtId
=
jwtUtils
.
getApplication
()
+
":"
+
uuid
+
"_"
+
jwtUtils
.
JWT_SESSION_PREFIX
+
user
.
get
User
Id
();
ComJwtUser
jwtUser
=
new
ComJwtUser
();
ComJwtUser
jwtUser
=
new
ComJwtUser
();
jwtUser
.
setApplication
(
jwtUtils
.
getApplication
());
jwtUser
.
setApplication
(
jwtUtils
.
getApplication
());
jwtUser
.
setJwtId
(
jwtId
);
jwtUser
.
setJwtId
(
jwtId
);
jwtUser
.
setUserId
(
String
.
valueOf
(
user
.
getId
()));
jwtUser
.
setUserId
(
String
.
valueOf
(
user
.
get
User
Id
()));
jwtUser
.
setAccount
(
user
.
getAccount
());
jwtUser
.
setAccount
(
user
.
getAccount
());
jwtUser
.
setBelong
(
user
.
getUserType
());
Map
<
String
,
Object
>
userMap
=
(
Map
<
String
,
Object
>)
ObjectUtils
.
objectToMap
(
jwtUser
);
Map
<
String
,
Object
>
userMap
=
(
Map
<
String
,
Object
>)
ObjectUtils
.
objectToMap
(
jwtUser
);
return
jwtUtils
.
createToken
(
userMap
);
return
jwtUtils
.
createToken
(
userMap
);
}
}
...
...
src/main/resources/mapper/UserLocalAccountMapper.xml
View file @
89c8525
...
@@ -34,8 +34,9 @@
...
@@ -34,8 +34,9 @@
</select>
</select>
<select
id=
"selectAppUserByUserId"
resultType=
"cn.com.glsx.app.modules.model.AppUser"
>
<select
id=
"selectAppUserByUserId"
resultType=
"cn.com.glsx.app.modules.model.AppUser"
>
select tcula.user_id as id,
select tcu.linker_id as userId,
tcula.union_id unionId,
tcu.id as cuserId,
tcula.union_id as unionId,
tcu.account,
tcu.account,
tcula.username,
tcula.username,
tcu.blacklist
tcu.blacklist
...
...
src/main/resources/mapper/UserMapper.xml
View file @
89c8525
...
@@ -9,6 +9,7 @@
...
@@ -9,6 +9,7 @@
<result
column=
"token"
jdbcType=
"VARCHAR"
property=
"token"
/>
<result
column=
"token"
jdbcType=
"VARCHAR"
property=
"token"
/>
<result
column=
"expire_in"
jdbcType=
"INTEGER"
property=
"expireIn"
/>
<result
column=
"expire_in"
jdbcType=
"INTEGER"
property=
"expireIn"
/>
<result
column=
"try_times"
jdbcType=
"INTEGER"
property=
"tryTimes"
/>
<result
column=
"try_times"
jdbcType=
"INTEGER"
property=
"tryTimes"
/>
<result
column=
"linker_id"
jdbcType=
"INTEGER"
property=
"linkerId"
/>
<result
column=
"account"
jdbcType=
"VARCHAR"
property=
"account"
/>
<result
column=
"account"
jdbcType=
"VARCHAR"
property=
"account"
/>
<result
column=
"blacklist"
jdbcType=
"TINYINT"
property=
"blacklist"
/>
<result
column=
"blacklist"
jdbcType=
"TINYINT"
property=
"blacklist"
/>
<result
column=
"del_flag"
jdbcType=
"TINYINT"
property=
"delFlag"
/>
<result
column=
"del_flag"
jdbcType=
"TINYINT"
property=
"delFlag"
/>
...
@@ -21,7 +22,7 @@
...
@@ -21,7 +22,7 @@
<!--
<!--
WARNING - @mbg.generated
WARNING - @mbg.generated
-->
-->
id, token, expire_in, try_times, account, blacklist, del_flag, created_date, created_by, updated_date,
id, token, expire_in, try_times,
linker_id,
account, blacklist, del_flag, created_date, created_by, updated_date,
updated_by
updated_by
</sql>
</sql>
...
@@ -42,8 +43,8 @@
...
@@ -42,8 +43,8 @@
</select>
</select>
<insert
id=
"saveOrUpdate"
useGeneratedKeys=
"true"
keyProperty=
"id"
parameterType=
"cn.com.glsx.app.modules.entity.User"
>
<insert
id=
"saveOrUpdate"
useGeneratedKeys=
"true"
keyProperty=
"id"
parameterType=
"cn.com.glsx.app.modules.entity.User"
>
INSERT INTO t_cust_user (id, account, blacklist, del_flag, created_date)
INSERT INTO t_cust_user (id,
linker_id,
account, blacklist, del_flag, created_date)
VALUES (#{id}, #{account}, #{blacklist}, 0, sysdate()) ON DUPLICATE KEY
VALUES (#{id}, #{
linkerId}, #{
account}, #{blacklist}, 0, sysdate()) ON DUPLICATE KEY
UPDATE updated_date = sysdate()
UPDATE updated_date = sysdate()
</insert>
</insert>
</mapper>
</mapper>
\ No newline at end of file
\ No newline at end of file
src/main/resources/mapper/UserQQAccountMapper.xml
View file @
89c8525
...
@@ -8,7 +8,7 @@
...
@@ -8,7 +8,7 @@
<id
column=
"id"
jdbcType=
"INTEGER"
property=
"id"
/>
<id
column=
"id"
jdbcType=
"INTEGER"
property=
"id"
/>
<result
column=
"auth_id"
jdbcType=
"INTEGER"
property=
"authId"
/>
<result
column=
"auth_id"
jdbcType=
"INTEGER"
property=
"authId"
/>
<result
column=
"union_id"
jdbcType=
"VARCHAR"
property=
"unionId"
/>
<result
column=
"union_id"
jdbcType=
"VARCHAR"
property=
"unionId"
/>
<result
column=
"qq_avatar"
jdbcType=
"VARCHAR"
property=
"
qqA
vatar"
/>
<result
column=
"qq_avatar"
jdbcType=
"VARCHAR"
property=
"
a
vatar"
/>
<result
column=
"qq_name"
jdbcType=
"VARCHAR"
property=
"qqName"
/>
<result
column=
"qq_name"
jdbcType=
"VARCHAR"
property=
"qqName"
/>
<result
column=
"del_flag"
jdbcType=
"TINYINT"
property=
"delFlag"
/>
<result
column=
"del_flag"
jdbcType=
"TINYINT"
property=
"delFlag"
/>
<result
column=
"created_date"
jdbcType=
"TIMESTAMP"
property=
"createdDate"
/>
<result
column=
"created_date"
jdbcType=
"TIMESTAMP"
property=
"createdDate"
/>
...
...
Write
Preview
Markdown
is supported
Attach a file
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 post a comment