Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
X
xyqb-user2
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
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
head_group
xyqb-user2
Commits
4c80cacd
Commit
4c80cacd
authored
Jun 15, 2023
by
王亮
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
remove unused code.
parent
9a424b9a
Changes
13
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
98 additions
and
154 deletions
+98
-154
pom.xml
pom.xml
+6
-16
UserQueryLogController.java
.../controller/internal/querylog/UserQueryLogController.java
+2
-1
InnerController.java
...tgroup/xyqb/controller/internal/user/InnerController.java
+2
-3
UserCenterController.java
...controller/internal/user/center/UserCenterController.java
+5
-3
WxController.java
...ntgroup/xyqb/controller/middleoffice/wx/WxController.java
+22
-26
IProductLoginService.java
...cn/quantgroup/xyqb/service/user/IProductLoginService.java
+1
-1
OauthClientDetailsServiceImpl.java
...xyqb/service/user/impl/OauthClientDetailsServiceImpl.java
+1
-3
OauthLoginInfoServiceImpl.java
...oup/xyqb/service/user/impl/OauthLoginInfoServiceImpl.java
+0
-2
ProductLoginServiceImpl.java
...group/xyqb/service/user/impl/ProductLoginServiceImpl.java
+3
-5
TenantServiceImpl.java
.../quantgroup/xyqb/service/user/impl/TenantServiceImpl.java
+30
-47
UserCenterServiceImpl.java
...ntgroup/xyqb/service/user/impl/UserCenterServiceImpl.java
+21
-34
XyqbSessionContextHolder.java
.../cn/quantgroup/xyqb/session/XyqbSessionContextHolder.java
+3
-9
JsonTest.java
src/test/java/common/JsonTest.java
+2
-4
No files found.
pom.xml
View file @
4c80cacd
...
@@ -46,11 +46,6 @@
...
@@ -46,11 +46,6 @@
<artifactId>
SensorsAnalyticsSDK
</artifactId>
<artifactId>
SensorsAnalyticsSDK
</artifactId>
<version>
3.2.0
</version>
<version>
3.2.0
</version>
</dependency>
</dependency>
<dependency>
<groupId>
com.google.code.gson
</groupId>
<artifactId>
gson
</artifactId>
<version>
2.3.1
</version>
</dependency>
<dependency>
<dependency>
<groupId>
org.springframework.amqp
</groupId>
<groupId>
org.springframework.amqp
</groupId>
<artifactId>
spring-rabbit
</artifactId>
<artifactId>
spring-rabbit
</artifactId>
...
@@ -224,11 +219,7 @@
...
@@ -224,11 +219,7 @@
<artifactId>
commons-codec
</artifactId>
<artifactId>
commons-codec
</artifactId>
<version>
1.10
</version>
<version>
1.10
</version>
</dependency>
</dependency>
<dependency>
<groupId>
com.rabbitmq
</groupId>
<artifactId>
amqp-client
</artifactId>
<version>
4.0.3
</version>
</dependency>
<dependency>
<dependency>
<groupId>
com.zaxxer
</groupId>
<groupId>
com.zaxxer
</groupId>
<artifactId>
HikariCP
</artifactId>
<artifactId>
HikariCP
</artifactId>
...
@@ -325,12 +316,6 @@
...
@@ -325,12 +316,6 @@
<groupId>
com.xuxueli
</groupId>
<groupId>
com.xuxueli
</groupId>
<artifactId>
xxl-job-core
</artifactId>
<artifactId>
xxl-job-core
</artifactId>
<version>
2.1.0
</version>
<version>
2.1.0
</version>
<exclusions>
<exclusion>
<groupId>
io.netty
</groupId>
<artifactId>
netty-all
</artifactId>
</exclusion>
</exclusions>
</dependency>
</dependency>
<dependency>
<dependency>
<groupId>
cn.quantgroup
</groupId>
<groupId>
cn.quantgroup
</groupId>
...
@@ -353,6 +338,11 @@
...
@@ -353,6 +338,11 @@
</exclusion>
</exclusion>
</exclusions>
</exclusions>
</dependency>
</dependency>
<dependency>
<groupId>
com.github.ben-manes.caffeine
</groupId>
<artifactId>
caffeine
</artifactId>
<version>
3.1.6
</version>
</dependency>
</dependencies>
</dependencies>
<build>
<build>
...
...
src/main/java/cn/quantgroup/xyqb/controller/internal/querylog/UserQueryLogController.java
View file @
4c80cacd
...
@@ -15,6 +15,7 @@ import cn.quantgroup.xyqb.util.IdcardValidator;
...
@@ -15,6 +15,7 @@ import cn.quantgroup.xyqb.util.IdcardValidator;
import
cn.quantgroup.xyqb.util.ValidationUtil
;
import
cn.quantgroup.xyqb.util.ValidationUtil
;
import
cn.quantgroup.xyqb.util.encrypt.Md5Util
;
import
cn.quantgroup.xyqb.util.encrypt.Md5Util
;
import
cn.quantgroup.xyqb.util.encrypt.Rsa
;
import
cn.quantgroup.xyqb.util.encrypt.Rsa
;
import
com.alibaba.fastjson.JSON
;
import
com.google.gson.*
;
import
com.google.gson.*
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.poi.hssf.usermodel.*
;
import
org.apache.poi.hssf.usermodel.*
;
...
@@ -206,7 +207,7 @@ public class UserQueryLogController {
...
@@ -206,7 +207,7 @@ public class UserQueryLogController {
HashMap
<
String
,
Object
>
ha
=
new
HashMap
<>();
HashMap
<
String
,
Object
>
ha
=
new
HashMap
<>();
ha
.
put
(
"type"
,
"1"
);
ha
.
put
(
"type"
,
"1"
);
ha
.
put
(
"phones"
,
phoneNos
);
ha
.
put
(
"phones"
,
phoneNos
);
String
phoneNoStr
=
new
Gson
().
toJson
(
ha
);
String
phoneNoStr
=
JSON
.
toJSONString
(
ha
);
String
data
=
""
;
String
data
=
""
;
String
sign
=
""
;
String
sign
=
""
;
...
...
src/main/java/cn/quantgroup/xyqb/controller/internal/user/InnerController.java
View file @
4c80cacd
...
@@ -439,11 +439,10 @@ public class InnerController implements IBaseController {
...
@@ -439,11 +439,10 @@ public class InnerController implements IBaseController {
if
(
tenantId
!=
null
&&
!
TenantUtil
.
TENANT_DEFAULT
.
equals
(
tenantId
))
{
if
(
tenantId
!=
null
&&
!
TenantUtil
.
TENANT_DEFAULT
.
equals
(
tenantId
))
{
// userId 查询对应productLogin 获取手机号和customerId
// userId 查询对应productLogin 获取手机号和customerId
user
=
tenantService
.
getTenantUser
(
user
,
tenantId
);
user
=
tenantService
.
getTenantUser
(
user
,
tenantId
);
if
(
user
=
=
null
)
{
if
(
user
!
=
null
)
{
return
JsonResult
.
build
ErrorStateResult
(
"查无此人"
,
null
);
return
JsonResult
.
build
SuccessResult
(
null
,
new
UserRet
(
user
)
);
}
}
}
}
return
JsonResult
.
buildSuccessResult
(
null
,
new
UserRet
(
user
));
}
}
return
JsonResult
.
buildErrorStateResult
(
"查无此人"
,
null
);
return
JsonResult
.
buildErrorStateResult
(
"查无此人"
,
null
);
...
...
src/main/java/cn/quantgroup/xyqb/controller/internal/user/center/UserCenterController.java
View file @
4c80cacd
...
@@ -62,9 +62,6 @@ public class UserCenterController {
...
@@ -62,9 +62,6 @@ public class UserCenterController {
@PostMapping
(
"/attach/list"
)
@PostMapping
(
"/attach/list"
)
public
JsonResult
queryUserAttachList
(
@RequestBody
List
<
Long
>
userIds
,
@RequestParam
(
required
=
false
)
Integer
tenantId
)
{
public
JsonResult
queryUserAttachList
(
@RequestBody
List
<
Long
>
userIds
,
@RequestParam
(
required
=
false
)
Integer
tenantId
)
{
//默认羊小咩租户
//默认羊小咩租户
if
(
TenantUtil
.
validationTenantIdIsNullOrZero
(
tenantId
))
{
tenantId
=
TenantUtil
.
TENANT_DEFAULT
;
}
if
(
CollectionUtils
.
isEmpty
(
userIds
))
{
if
(
CollectionUtils
.
isEmpty
(
userIds
))
{
return
JsonResult
.
buildErrorStateResult
(
"用户 ID 不能为空"
,
null
);
return
JsonResult
.
buildErrorStateResult
(
"用户 ID 不能为空"
,
null
);
}
}
...
@@ -72,6 +69,11 @@ public class UserCenterController {
...
@@ -72,6 +69,11 @@ public class UserCenterController {
if
(
userIds
.
size
()
>
size
)
{
if
(
userIds
.
size
()
>
size
)
{
return
JsonResult
.
buildErrorStateResult
(
"超出最大条数限制"
+
size
,
null
);
return
JsonResult
.
buildErrorStateResult
(
"超出最大条数限制"
+
size
,
null
);
}
}
if
(
TenantUtil
.
validationTenantIdIsNullOrZero
(
tenantId
))
{
tenantId
=
TenantUtil
.
TENANT_DEFAULT
;
}
List
<
UserAttached
>
userAttachedList
=
userCenterService
.
searchUserAttachedListByUserId
(
userIds
,
tenantId
);
List
<
UserAttached
>
userAttachedList
=
userCenterService
.
searchUserAttachedListByUserId
(
userIds
,
tenantId
);
return
JsonResult
.
buildSuccessResultGeneric
(
userAttachedList
);
return
JsonResult
.
buildSuccessResultGeneric
(
userAttachedList
);
}
}
...
...
src/main/java/cn/quantgroup/xyqb/controller/middleoffice/wx/WxController.java
View file @
4c80cacd
...
@@ -35,56 +35,51 @@ public class WxController {
...
@@ -35,56 +35,51 @@ public class WxController {
private
IUserService
userService
;
private
IUserService
userService
;
/**
/**
* @ yapi http://open.quantgroups.com/project/59/interface/api/693
* @ yapi http://yapi.quantgroups.com/project/17/interface/api/30122
* @param userId
* @param userId
* @return
* @return
* @ yapi http://open.quantgroups.com/project/59/interface/api/693
* @ yapi http://yapi.quantgroups.com/project/17/interface/api/30122
*/
*/
@GetMapping
(
"/userId/{userId}"
)
@GetMapping
(
"/userId/{userId}"
)
public
JsonResult
openId
(
@PathVariable
Long
userId
,
@RequestParam
(
required
=
false
)
Integer
tenantId
)
{
public
JsonResult
openId
(
@PathVariable
Long
userId
,
@RequestParam
(
required
=
false
)
Integer
tenantId
)
{
//默认羊小咩租户
String
openId
=
null
;
if
(
TenantUtil
.
validationTenantIdIsNullOrZero
(
tenantId
))
{
if
(
TenantUtil
.
validationTenantIdIsNullOrZero
(
tenantId
)
||
tenantId
.
equals
(
TenantUtil
.
TENANT_DEFAULT
))
{
tenantId
=
TenantUtil
.
TENANT_DEFAULT
;
}
if
(
tenantId
.
equals
(
TenantUtil
.
TENANT_DEFAULT
))
{
WechatUserInfo
wechatUserInfo
=
wechatService
.
queryByUserId
(
userId
);
WechatUserInfo
wechatUserInfo
=
wechatService
.
queryByUserId
(
userId
);
if
(
wechatUserInfo
=
=
null
)
{
if
(
wechatUserInfo
!
=
null
)
{
return
JsonResult
.
buildSuccessResult
();
openId
=
wechatUserInfo
.
getOpenId
();
}
}
return
JsonResult
.
buildSuccessResultGeneric
(
wechatUserInfo
.
getOpenId
());
}
else
{
}
else
{
User
user
=
userService
.
findById
(
userId
);
User
user
=
userService
.
findById
(
userId
);
if
(
user
==
null
)
{
if
(
user
!=
null
)
{
return
JsonResult
.
buildSuccessResult
();
CustomerInfoEntity
tenantCustomerInfo
=
tenantService
.
getTenantCustomerInfo
(
user
,
tenantId
);
}
if
(
tenantCustomerInfo
!=
null
)
{
CustomerInfoEntity
tenantCustomerInfo
=
tenantService
.
getTenantCustomerInfo
(
user
,
tenantId
);
openId
=
tenantCustomerInfo
.
getSourceOpenId
();
if
(
tenantCustomerInfo
==
null
)
{
}
return
JsonResult
.
buildSuccessResult
();
}
}
return
JsonResult
.
buildSuccessResultGeneric
(
tenantCustomerInfo
.
getSourceOpenId
());
}
}
return
JsonResult
.
buildSuccessResultGeneric
(
openId
);
}
}
/**
/**
* @ yapi http://yapi.quantgroups.com/project/17/interface/api/30122
* @param userId
* @param userId
* @param appName
* @param appName
* @param tenantId
* @param tenantId
* @return
* @return
* @ yapi http://yapi.quantgroups.com/project/17/interface/api/30122
*/
*/
@GetMapping
(
"/userId/{userId}/{appName}"
)
@GetMapping
(
"/userId/{userId}/{appName}"
)
public
JsonResult
openId
(
@PathVariable
Long
userId
,
@PathVariable
String
appName
,
@RequestParam
(
required
=
false
)
Integer
tenantId
)
{
public
JsonResult
openId
(
@PathVariable
Long
userId
,
@PathVariable
String
appName
,
@RequestParam
(
required
=
false
)
Integer
tenantId
)
{
//默认羊小咩租户
//默认羊小咩租户
if
(
TenantUtil
.
validationTenantIdIsNullOrZero
(
tenantId
))
{
if
(
TenantUtil
.
validationTenantIdIsNullOrZero
(
tenantId
))
{
tenantId
=
TenantUtil
.
TENANT_DEFAULT
;
tenantId
=
TenantUtil
.
TENANT_DEFAULT
;
}
}
if
(
tenantId
.
equals
(
TenantUtil
.
TENANT_DEFAULT
))
{
if
(
tenantId
.
equals
(
TenantUtil
.
TENANT_DEFAULT
))
{
WechatUserInfo
wechatUserInfo
=
wechatService
.
queryByUserId
(
userId
,
appName
);
WechatUserInfo
wechatUserInfo
=
wechatService
.
queryByUserId
(
userId
,
appName
);
if
(
wechatUserInfo
==
null
)
{
if
(
wechatUserInfo
==
null
)
{
return
JsonResult
.
buildSuccessResult
();
return
JsonResult
.
buildSuccessResult
();
}
}
return
JsonResult
.
buildSuccessResultGeneric
(
wechatUserInfo
.
getOpenId
());
return
JsonResult
.
buildSuccessResultGeneric
(
wechatUserInfo
.
getOpenId
());
}
else
{
}
else
{
User
user
=
userService
.
findById
(
userId
);
User
user
=
userService
.
findById
(
userId
);
if
(
user
==
null
)
{
if
(
user
==
null
)
{
return
JsonResult
.
buildSuccessResult
();
return
JsonResult
.
buildSuccessResult
();
...
@@ -99,10 +94,10 @@ public class WxController {
...
@@ -99,10 +94,10 @@ public class WxController {
}
}
/**
/**
* @yapi http://open.quantgroups.com/project/59/interface/api/693
* @yapi http://yapi.quantgroups.com/project/17/interface/api/30122
* @param phoneNo
* @param phoneNo
* @return
* @return
* @yapi http://open.quantgroups.com/project/59/interface/api/693
* @yapi http://yapi.quantgroups.com/project/17/interface/api/30122
*/
*/
@GetMapping
(
"/phoneNo/{phoneNo}"
)
@GetMapping
(
"/phoneNo/{phoneNo}"
)
public
JsonResult
openId
(
@PathVariable
String
phoneNo
,
@RequestParam
(
required
=
false
)
Integer
tenantId
)
{
public
JsonResult
openId
(
@PathVariable
String
phoneNo
,
@RequestParam
(
required
=
false
)
Integer
tenantId
)
{
...
@@ -115,7 +110,7 @@ public class WxController {
...
@@ -115,7 +110,7 @@ public class WxController {
return
JsonResult
.
buildSuccessResult
();
return
JsonResult
.
buildSuccessResult
();
}
}
return
JsonResult
.
buildSuccessResultGeneric
(
wechatUserInfo
.
getOpenId
());
return
JsonResult
.
buildSuccessResultGeneric
(
wechatUserInfo
.
getOpenId
());
}
else
{
}
else
{
User
user
=
userService
.
findByPhoneInDb
(
phoneNo
);
User
user
=
userService
.
findByPhoneInDb
(
phoneNo
);
if
(
user
==
null
)
{
if
(
user
==
null
)
{
return
JsonResult
.
buildSuccessResult
();
return
JsonResult
.
buildSuccessResult
();
...
@@ -141,6 +136,7 @@ public class WxController {
...
@@ -141,6 +136,7 @@ public class WxController {
}
}
/**
/**
*
*/
*/
@PostMapping
(
"/v1/getByOpenIdToUserIds"
)
@PostMapping
(
"/v1/getByOpenIdToUserIds"
)
public
JsonResult
getByOpenIdToUserIds
(
@RequestBody
Map
<
String
,
Object
>
params
,
@RequestParam
(
required
=
false
,
defaultValue
=
"wuxi"
)
String
appName
)
{
public
JsonResult
getByOpenIdToUserIds
(
@RequestBody
Map
<
String
,
Object
>
params
,
@RequestParam
(
required
=
false
,
defaultValue
=
"wuxi"
)
String
appName
)
{
...
@@ -150,7 +146,7 @@ public class WxController {
...
@@ -150,7 +146,7 @@ public class WxController {
return
JsonResult
.
buildErrorStateResult
(
"用户Id不能为空"
,
null
);
return
JsonResult
.
buildErrorStateResult
(
"用户Id不能为空"
,
null
);
}
}
if
(
userIds
.
size
()
>
500
)
{
if
(
userIds
.
size
()
>
500
)
{
userIds
=
userIds
.
subList
(
0
,
500
);
userIds
=
userIds
.
subList
(
0
,
500
);
}
}
List
<
Long
>
userIdList
=
userIds
.
stream
().
map
(
userId
->
Long
.
parseLong
(
userId
.
toString
())).
collect
(
Collectors
.
toList
());
List
<
Long
>
userIdList
=
userIds
.
stream
().
map
(
userId
->
Long
.
parseLong
(
userId
.
toString
())).
collect
(
Collectors
.
toList
());
...
...
src/main/java/cn/quantgroup/xyqb/service/user/IProductLoginService.java
View file @
4c80cacd
...
@@ -9,7 +9,7 @@ import java.util.List;
...
@@ -9,7 +9,7 @@ import java.util.List;
*/
*/
public
interface
IProductLoginService
{
public
interface
IProductLoginService
{
ProductLoginEntity
findSlaveByPloginInfo
(
String
institutionId
,
String
productId
,
Long
userId
);
ProductLoginEntity
findSlaveByPloginInfo
(
String
institutionId
,
String
productId
,
Long
userId
);
List
<
ProductLoginEntity
>
findSlaveByP
loginInfos
(
String
institutionId
,
String
productId
,
List
<
Long
>
userId
);
List
<
ProductLoginEntity
>
findSlaveByP
roductLoginInfoList
(
String
institutionId
,
String
productId
,
List
<
Long
>
userId
);
List
<
ProductLoginEntity
>
findSlaveByUserId
(
Long
userId
);
List
<
ProductLoginEntity
>
findSlaveByUserId
(
Long
userId
);
List
<
ProductLoginEntity
>
findSlaveByUserIds
(
List
<
Long
>
userIds
);
List
<
ProductLoginEntity
>
findSlaveByUserIds
(
List
<
Long
>
userIds
);
...
...
src/main/java/cn/quantgroup/xyqb/service/user/impl/OauthClientDetailsServiceImpl.java
View file @
4c80cacd
...
@@ -23,8 +23,7 @@ public class OauthClientDetailsServiceImpl implements IOauthClientDetailsService
...
@@ -23,8 +23,7 @@ public class OauthClientDetailsServiceImpl implements IOauthClientDetailsService
@Override
@Override
public
OauthClientDetailsEntity
findFirstByClientId
(
Integer
clientId
)
{
public
OauthClientDetailsEntity
findFirstByClientId
(
Integer
clientId
)
{
OauthClientDetailsEntity
oauthClientDetailsEntity
=
oauthClientDetailsRepository
.
findFirstByClientId
(
clientId
);
return
oauthClientDetailsRepository
.
findFirstByClientId
(
clientId
);
return
oauthClientDetailsEntity
;
}
}
@Override
@Override
...
@@ -40,5 +39,4 @@ public class OauthClientDetailsServiceImpl implements IOauthClientDetailsService
...
@@ -40,5 +39,4 @@ public class OauthClientDetailsServiceImpl implements IOauthClientDetailsService
}
}
}
}
src/main/java/cn/quantgroup/xyqb/service/user/impl/OauthLoginInfoServiceImpl.java
View file @
4c80cacd
...
@@ -61,7 +61,6 @@ public class OauthLoginInfoServiceImpl implements IOauthLoginInfoService {
...
@@ -61,7 +61,6 @@ public class OauthLoginInfoServiceImpl implements IOauthLoginInfoService {
long
id
=
atomicSequencer
.
nextId
();
long
id
=
atomicSequencer
.
nextId
();
String
customerName
=
customerId
+
""
;
String
customerName
=
customerId
+
""
;
uuid
=
RandomSequencer
.
randomUUID
(
customerId
);
uuid
=
RandomSequencer
.
randomUUID
(
customerId
);
ProductLoginEntity
entity
=
new
ProductLoginEntity
();
Integer
partitionKey
=
atomicSequencer
.
partitionKey
(
customerId
);
Integer
partitionKey
=
atomicSequencer
.
partitionKey
(
customerId
);
ProductLoginEntity
productLoginEntity
=
EntityBuilder
.
productLogin
(
productId
,
institutionId
,
phoneNo
,
customerId
,
customerName
,
partitionKey
,
id
);
ProductLoginEntity
productLoginEntity
=
EntityBuilder
.
productLogin
(
productId
,
institutionId
,
phoneNo
,
customerId
,
customerName
,
partitionKey
,
id
);
productLoginEntity
.
setExtensionAccountId
(
userId
);
productLoginEntity
.
setExtensionAccountId
(
userId
);
...
@@ -120,7 +119,6 @@ public class OauthLoginInfoServiceImpl implements IOauthLoginInfoService {
...
@@ -120,7 +119,6 @@ public class OauthLoginInfoServiceImpl implements IOauthLoginInfoService {
long
id
=
atomicSequencer
.
nextId
();
long
id
=
atomicSequencer
.
nextId
();
String
customerName
=
customerId
+
""
;
String
customerName
=
customerId
+
""
;
uuid
=
RandomSequencer
.
randomUUID
(
customerId
);
uuid
=
RandomSequencer
.
randomUUID
(
customerId
);
ProductLoginEntity
entity
=
new
ProductLoginEntity
();
Integer
partitionKey
=
atomicSequencer
.
partitionKey
(
customerId
);
Integer
partitionKey
=
atomicSequencer
.
partitionKey
(
customerId
);
productLoginEntity
=
EntityBuilder
.
productLogin
(
productId
,
institutionId
,
phoneNo
,
customerId
,
customerName
,
partitionKey
,
id
);
productLoginEntity
=
EntityBuilder
.
productLogin
(
productId
,
institutionId
,
phoneNo
,
customerId
,
customerName
,
partitionKey
,
id
);
productLoginEntity
.
setExtensionAccountId
(
userId
);
productLoginEntity
.
setExtensionAccountId
(
userId
);
...
...
src/main/java/cn/quantgroup/xyqb/service/user/impl/ProductLoginServiceImpl.java
View file @
4c80cacd
...
@@ -25,9 +25,8 @@ public class ProductLoginServiceImpl implements IProductLoginService {
...
@@ -25,9 +25,8 @@ public class ProductLoginServiceImpl implements IProductLoginService {
}
}
@Override
@Override
public
List
<
ProductLoginEntity
>
findSlaveByPloginInfos
(
String
institutionId
,
String
productId
,
List
<
Long
>
userIds
)
{
public
List
<
ProductLoginEntity
>
findSlaveByProductLoginInfoList
(
String
institutionId
,
String
productId
,
List
<
Long
>
userIds
)
{
List
<
ProductLoginEntity
>
list
=
productLoginRepository
.
findByInstitutionIdAndProductIdAndExtensionAccountIdIn
(
institutionId
,
productId
,
userIds
);
return
productLoginRepository
.
findByInstitutionIdAndProductIdAndExtensionAccountIdIn
(
institutionId
,
productId
,
userIds
);
return
list
;
}
}
@Override
@Override
...
@@ -38,8 +37,7 @@ public class ProductLoginServiceImpl implements IProductLoginService {
...
@@ -38,8 +37,7 @@ public class ProductLoginServiceImpl implements IProductLoginService {
@Override
@Override
public
List
<
ProductLoginEntity
>
findSlaveByUserIds
(
List
<
Long
>
userIds
)
{
public
List
<
ProductLoginEntity
>
findSlaveByUserIds
(
List
<
Long
>
userIds
)
{
List
<
ProductLoginEntity
>
productLoginEntityList
=
productLoginRepository
.
findAllByExtensionAccountIdIn
(
userIds
);
return
productLoginRepository
.
findAllByExtensionAccountIdIn
(
userIds
);
return
productLoginEntityList
;
}
}
@Override
@Override
...
...
src/main/java/cn/quantgroup/xyqb/service/user/impl/TenantServiceImpl.java
View file @
4c80cacd
...
@@ -7,6 +7,7 @@ import cn.quantgroup.xyqb.service.user.IOauthClientDetailsService;
...
@@ -7,6 +7,7 @@ import cn.quantgroup.xyqb.service.user.IOauthClientDetailsService;
import
cn.quantgroup.xyqb.service.user.IProductLoginService
;
import
cn.quantgroup.xyqb.service.user.IProductLoginService
;
import
cn.quantgroup.xyqb.service.user.ITenantService
;
import
cn.quantgroup.xyqb.service.user.ITenantService
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.collections.CollectionUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
...
@@ -37,11 +38,10 @@ public class TenantServiceImpl implements ITenantService {
...
@@ -37,11 +38,10 @@ public class TenantServiceImpl implements ITenantService {
if
(
oauthClientDetails
!=
null
)
{
if
(
oauthClientDetails
!=
null
)
{
ProductLoginEntity
productLogin
=
productLoginService
.
findSlaveByPloginInfo
(
oauthClientDetails
.
getInstitutionId
(),
oauthClientDetails
.
getProductId
(),
user
.
getId
());
ProductLoginEntity
productLogin
=
productLoginService
.
findSlaveByPloginInfo
(
oauthClientDetails
.
getInstitutionId
(),
oauthClientDetails
.
getProductId
(),
user
.
getId
());
if
(
productLogin
!=
null
)
{
if
(
productLogin
!=
null
)
{
if
(!
user
.
getEncryptedPhoneNo
().
equals
(
productLogin
.
getEncryptedPhoneNo
()))
{
if
(
user
.
getEncryptedPhoneNo
().
equals
(
productLogin
.
getEncryptedPhoneNo
()))
{
return
null
;
user
.
setPassword
(
productLogin
.
getPassword
());
return
user
;
}
}
user
.
setPassword
(
productLogin
.
getPassword
());
return
user
;
}
}
}
}
return
null
;
return
null
;
...
@@ -107,15 +107,9 @@ public class TenantServiceImpl implements ITenantService {
...
@@ -107,15 +107,9 @@ public class TenantServiceImpl implements ITenantService {
if
(
oauthClientDetails
!=
null
)
{
if
(
oauthClientDetails
!=
null
)
{
ProductLoginEntity
productLogin
=
productLoginService
.
findSlaveByPloginInfo
(
oauthClientDetails
.
getInstitutionId
(),
oauthClientDetails
.
getProductId
(),
user
.
getId
());
ProductLoginEntity
productLogin
=
productLoginService
.
findSlaveByPloginInfo
(
oauthClientDetails
.
getInstitutionId
(),
oauthClientDetails
.
getProductId
(),
user
.
getId
());
if
(
productLogin
!=
null
)
{
if
(
productLogin
!=
null
)
{
if
(!
user
.
getPhoneNo
().
equals
(
productLogin
.
getPhoneNo
()))
{
if
(
user
.
getPhoneNo
().
equals
(
productLogin
.
getPhoneNo
()))
{
return
null
;
return
customerInfoService
.
findSlaveByCustomerId
(
productLogin
.
getCustomerId
());
}
CustomerInfoEntity
customerInfo
=
customerInfoService
.
findSlaveByCustomerId
(
productLogin
.
getCustomerId
());
if
(
customerInfo
==
null
)
{
return
null
;
}
}
return
customerInfo
;
}
}
}
}
return
null
;
return
null
;
...
@@ -124,18 +118,14 @@ public class TenantServiceImpl implements ITenantService {
...
@@ -124,18 +118,14 @@ public class TenantServiceImpl implements ITenantService {
@Override
@Override
public
List
<
User
>
selectUsersByTenantId
(
List
<
User
>
users
,
Integer
tenantId
)
{
public
List
<
User
>
selectUsersByTenantId
(
List
<
User
>
users
,
Integer
tenantId
)
{
List
<
User
>
result
=
new
ArrayList
<>();
List
<
User
>
result
=
new
ArrayList
<>();
if
(
users
!=
null
)
{
if
(
CollectionUtils
.
isNotEmpty
(
users
)
)
{
OauthClientDetailsEntity
oauthClientDetails
=
oauthClientDetailsService
.
findFirstByClientId
(
tenantId
);
OauthClientDetailsEntity
oauthClientDetails
=
oauthClientDetailsService
.
findFirstByClientId
(
tenantId
);
if
(
oauthClientDetails
!=
null
)
{
if
(
oauthClientDetails
!=
null
)
{
List
<
Long
>
userIds
=
users
.
stream
().
map
(
User:
:
getId
).
collect
(
Collectors
.
toList
());
List
<
Long
>
userIds
=
users
.
stream
().
map
(
User:
:
getId
).
collect
(
Collectors
.
toList
());
List
<
ProductLoginEntity
>
productLoginEntities
=
productLoginService
.
findSlaveByP
loginInfos
(
oauthClientDetails
.
getInstitutionId
(),
oauthClientDetails
.
getProductId
(),
userIds
);
List
<
ProductLoginEntity
>
productLoginEntities
=
productLoginService
.
findSlaveByP
roductLoginInfoList
(
oauthClientDetails
.
getInstitutionId
(),
oauthClientDetails
.
getProductId
(),
userIds
);
if
(
productLoginEntities
!=
null
&&
productLoginEntities
.
size
()>
0
)
{
if
(
CollectionUtils
.
isNotEmpty
(
productLoginEntities
)
)
{
List
<
String
>
phoneNos
=
productLoginEntities
.
stream
().
map
(
ProductLoginEntity:
:
getPhoneNo
).
collect
(
Collectors
.
toList
());
List
<
String
>
phoneNos
=
productLoginEntities
.
stream
().
map
(
ProductLoginEntity:
:
getPhoneNo
).
collect
(
Collectors
.
toList
());
users
.
forEach
(
a
->{
result
=
users
.
stream
().
filter
(
i
->
phoneNos
.
contains
(
i
.
getPhoneNo
())).
collect
(
Collectors
.
toList
());
if
(
phoneNos
.
contains
(
a
.
getPhoneNo
()))
{
result
.
add
(
a
);
}
});
}
}
}
}
}
}
...
@@ -148,11 +138,11 @@ public class TenantServiceImpl implements ITenantService {
...
@@ -148,11 +138,11 @@ public class TenantServiceImpl implements ITenantService {
OauthClientDetailsEntity
oauthClientDetails
=
oauthClientDetailsService
.
findFirstByClientId
(
tenantId
);
OauthClientDetailsEntity
oauthClientDetails
=
oauthClientDetailsService
.
findFirstByClientId
(
tenantId
);
if
(
oauthClientDetails
!=
null
)
{
if
(
oauthClientDetails
!=
null
)
{
CustomerInfoEntity
customerInfo
=
customerInfoService
.
findSlaveByOpenId
(
openId
,
oauthClientDetails
.
getInstitutionId
(),
oauthClientDetails
.
getProductId
());
CustomerInfoEntity
customerInfo
=
customerInfoService
.
findSlaveByOpenId
(
openId
,
oauthClientDetails
.
getInstitutionId
(),
oauthClientDetails
.
getProductId
());
if
(
customerInfo
!=
null
)
{
if
(
customerInfo
!=
null
)
{
ProductLoginEntity
productLogin
=
productLoginService
.
findSlaveByCustomerInfo
(
customerInfo
.
getCustomerId
(),
oauthClientDetails
.
getInstitutionId
(),
oauthClientDetails
.
getProductId
());
ProductLoginEntity
productLogin
=
productLoginService
.
findSlaveByCustomerInfo
(
customerInfo
.
getCustomerId
(),
oauthClientDetails
.
getInstitutionId
(),
oauthClientDetails
.
getProductId
());
if
(
productLogin
!=
null
)
{
if
(
productLogin
!=
null
)
{
return
productLogin
.
getExtensionAccountId
();
return
productLogin
.
getExtensionAccountId
();
}
}
}
}
}
}
return
null
;
return
null
;
...
@@ -161,31 +151,24 @@ public class TenantServiceImpl implements ITenantService {
...
@@ -161,31 +151,24 @@ public class TenantServiceImpl implements ITenantService {
@Override
@Override
public
List
<
User
>
validationTentIdByTentId
(
List
<
User
>
users
,
Integer
tenantId
)
{
public
List
<
User
>
validationTentIdByTentId
(
List
<
User
>
users
,
Integer
tenantId
)
{
List
<
User
>
result
=
new
ArrayList
<>();
List
<
User
>
result
=
new
ArrayList
<>();
if
(
users
!=
null
)
{
if
(
CollectionUtils
.
isNotEmpty
(
users
))
{
List
<
Long
>
userIds
=
users
.
stream
().
map
(
User:
:
getId
).
collect
(
Collectors
.
toList
());
OauthClientDetailsEntity
oauthClientDetails
=
oauthClientDetailsService
.
findFirstByClientId
(
tenantId
);
OauthClientDetailsEntity
oauthClientDetails
=
oauthClientDetailsService
.
findFirstByClientId
(
tenantId
);
List
<
Long
>
userIds
=
users
.
stream
().
map
(
User:
:
getId
).
collect
(
Collectors
.
toList
());
if
(
oauthClientDetails
!=
null
)
{
if
(
oauthClientDetails
!=
null
)
{
List
<
ProductLoginEntity
>
slaveByPloginInfos
=
productLoginService
.
findSlaveByPloginInfos
(
oauthClientDetails
.
getInstitutionId
(),
oauthClientDetails
.
getProductId
(),
userIds
);
//1、查询出在product_login手机号码相同的用户
users
.
forEach
(
a
->{
List
<
ProductLoginEntity
>
productLoginEntities
=
productLoginService
.
findSlaveByProductLoginInfoList
(
oauthClientDetails
.
getInstitutionId
(),
oauthClientDetails
.
getProductId
(),
userIds
);
if
(
slaveByPloginInfos
!=
null
&&
slaveByPloginInfos
.
size
()>
0
)
{
List
<
String
>
phoneNos
=
productLoginEntities
.
stream
().
map
(
ProductLoginEntity:
:
getPhoneNo
).
collect
(
Collectors
.
toList
());
List
<
String
>
phoneNos
=
slaveByPloginInfos
.
stream
().
map
(
ProductLoginEntity:
:
getPhoneNo
).
collect
(
Collectors
.
toList
());
if
(
CollectionUtils
.
isNotEmpty
(
productLoginEntities
))
{
if
(
phoneNos
.
contains
(
a
.
getPhoneNo
()))
{
result
=
users
.
stream
().
filter
(
i
->
phoneNos
.
contains
(
i
.
getPhoneNo
())).
collect
(
Collectors
.
toList
());
result
.
add
(
a
);
}
}
}
else
{
}
//2、查询用户id不在product_login的扩展账户ID的用户
}
);
List
<
ProductLoginEntity
>
slaveByUserIds
=
productLoginService
.
findSlaveByUserIds
(
userIds
);
}
List
<
Long
>
extensionAccountIds
=
slaveByUserIds
.
stream
().
map
(
ProductLoginEntity:
:
getExtensionAccountId
).
collect
(
Collectors
.
toList
());
List
<
ProductLoginEntity
>
slaveByUserIds
=
productLoginService
.
findSlaveByUserIds
(
userIds
);
if
(
CollectionUtils
.
isNotEmpty
(
slaveByUserIds
))
{
if
(
slaveByUserIds
!=
null
)
{
result
=
users
.
stream
().
filter
(
i
->
extensionAccountIds
.
contains
(
i
.
getId
())).
collect
(
Collectors
.
toList
());
List
<
Long
>
collect
=
slaveByUserIds
.
stream
().
map
(
ProductLoginEntity:
:
getExtensionAccountId
).
collect
(
Collectors
.
toList
());
}
users
.
forEach
(
a
->{
if
(
collect
!=
null
)
{
if
(!
collect
.
contains
(
a
.
getId
()))
{
result
.
add
(
a
);
}
}
});
}
}
}
}
return
result
;
return
result
;
...
...
src/main/java/cn/quantgroup/xyqb/service/user/impl/UserCenterServiceImpl.java
View file @
4c80cacd
...
@@ -9,6 +9,7 @@ import cn.quantgroup.xyqb.service.user.UserCenterService;
...
@@ -9,6 +9,7 @@ import cn.quantgroup.xyqb.service.user.UserCenterService;
import
cn.quantgroup.xyqb.util.EmojiUtil
;
import
cn.quantgroup.xyqb.util.EmojiUtil
;
import
cn.quantgroup.xyqb.util.TenantUtil
;
import
cn.quantgroup.xyqb.util.TenantUtil
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.collections.CollectionUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.hibernate.exception.ConstraintViolationException
;
import
org.hibernate.exception.ConstraintViolationException
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
...
@@ -41,37 +42,23 @@ public class UserCenterServiceImpl implements UserCenterService {
...
@@ -41,37 +42,23 @@ public class UserCenterServiceImpl implements UserCenterService {
// @Cacheable(value = "userAttachedCache", key = "'xyqbUserAttached' + #userId", unless = "#result == null", cacheManager = "cacheManager")
// @Cacheable(value = "userAttachedCache", key = "'xyqbUserAttached' + #userId", unless = "#result == null", cacheManager = "cacheManager")
public
UserAttached
searchUserAttachedByUserId
(
long
userId
)
{
public
UserAttached
searchUserAttachedByUserId
(
long
userId
)
{
return
userAttachedRepository
.
findByUserId
(
userId
);
return
userAttachedRepository
.
findByUserId
(
userId
);
}
}
@Override
@Override
public
List
<
UserAttached
>
searchUserAttachedListByUserId
(
List
<
Long
>
userIds
,
Integer
tenantId
)
{
public
List
<
UserAttached
>
searchUserAttachedListByUserId
(
List
<
Long
>
userIds
,
Integer
tenantId
)
{
List
<
UserAttached
>
resultProductUsers
=
new
ArrayList
<>();
List
<
UserAttached
>
resultProductUsers
=
new
ArrayList
<>();
List
<
UserAttached
>
userAttacheds
=
userAttachedRepository
.
findByUserIdIn
(
userIds
);
List
<
UserAttached
>
userAttachedList
=
userAttachedRepository
.
findByUserIdIn
(
userIds
);
List
<
User
>
users
=
userRepository
.
findByIdIn
(
userIds
);
List
<
User
>
productUsers
;
if
(!
tenantId
.
equals
(
TenantUtil
.
TENANT_DEFAULT
))
{
if
(!
tenantId
.
equals
(
TenantUtil
.
TENANT_DEFAULT
))
{
if
(
userAttacheds
!=
null
)
{
productUsers
=
tenantService
.
selectUsersByTenantId
(
users
,
tenantId
);
List
<
User
>
users
=
userRepository
.
findByIdIn
(
userIds
);
}
else
{
List
<
User
>
productUsers
=
tenantService
.
selectUsersByTenantId
(
users
,
tenantId
);
productUsers
=
tenantService
.
validationTentIdByTentId
(
users
,
tenantId
);
if
(
productUsers
!=
null
)
{
}
List
<
Long
>
collect
=
productUsers
.
stream
().
map
(
User:
:
getId
).
collect
(
Collectors
.
toList
());
userAttacheds
.
forEach
(
a
->{
if
(
CollectionUtils
.
isNotEmpty
(
userAttachedList
)
&&
CollectionUtils
.
isNotEmpty
(
productUsers
))
{
if
(
collect
.
contains
(
a
.
getUserId
()))
{
List
<
Long
>
productUserIds
=
productUsers
.
stream
().
map
(
User:
:
getId
).
collect
(
Collectors
.
toList
());
resultProductUsers
.
add
(
a
);
resultProductUsers
=
userAttachedList
.
stream
().
filter
(
i
->
productUserIds
.
contains
(
i
.
getUserId
())).
collect
(
Collectors
.
toList
());
}
});
}
return
resultProductUsers
;
}
}
else
{
List
<
User
>
users
=
userRepository
.
findByIdIn
(
userIds
);
List
<
User
>
productUsers
=
tenantService
.
validationTentIdByTentId
(
users
,
tenantId
);
if
(
productUsers
!=
null
)
{
List
<
Long
>
collect
=
productUsers
.
stream
().
map
(
User:
:
getId
).
collect
(
Collectors
.
toList
());
userAttacheds
.
forEach
(
a
->{
if
(
collect
.
contains
(
a
.
getUserId
()))
{
resultProductUsers
.
add
(
a
);
}
});
}
}
}
return
resultProductUsers
;
return
resultProductUsers
;
}
}
...
@@ -80,10 +67,10 @@ public class UserCenterServiceImpl implements UserCenterService {
...
@@ -80,10 +67,10 @@ public class UserCenterServiceImpl implements UserCenterService {
@CacheEvict
(
value
=
"userAttachedCache"
,
key
=
"'xyqbUserAttached' + #userId"
,
cacheManager
=
"cacheManager"
)
@CacheEvict
(
value
=
"userAttachedCache"
,
key
=
"'xyqbUserAttached' + #userId"
,
cacheManager
=
"cacheManager"
)
public
UserAttached
saveUserAvatar
(
long
userId
,
String
avatar
)
{
public
UserAttached
saveUserAvatar
(
long
userId
,
String
avatar
)
{
UserAttached
userAttached
=
userAttachedRepository
.
findByUserId
(
userId
);
UserAttached
userAttached
=
userAttachedRepository
.
findByUserId
(
userId
);
if
(
Objects
.
isNull
(
userAttached
))
{
if
(
Objects
.
isNull
(
userAttached
))
{
userAttached
=
createUserAttached
(
userId
,
avatar
,
null
);
userAttached
=
createUserAttached
(
userId
,
avatar
,
null
);
}
}
if
(!
Objects
.
equals
(
avatar
,
userAttached
.
getAvatar
()))
{
if
(!
Objects
.
equals
(
avatar
,
userAttached
.
getAvatar
()))
{
userAttached
.
setAvatar
(
avatar
);
userAttached
.
setAvatar
(
avatar
);
userAttached
=
userAttachedRepository
.
save
(
userAttached
);
userAttached
=
userAttachedRepository
.
save
(
userAttached
);
}
}
...
@@ -96,14 +83,14 @@ public class UserCenterServiceImpl implements UserCenterService {
...
@@ -96,14 +83,14 @@ public class UserCenterServiceImpl implements UserCenterService {
UserAttached
userAttached
=
userAttachedRepository
.
findByUserId
(
userId
);
UserAttached
userAttached
=
userAttachedRepository
.
findByUserId
(
userId
);
// 替换所有,UTF-8编码时4字节的Emoji表情字符
// 替换所有,UTF-8编码时4字节的Emoji表情字符
nick
=
EmojiUtil
.
filterUnicode4
(
nick
);
nick
=
EmojiUtil
.
filterUnicode4
(
nick
);
if
(
Objects
.
isNull
(
userAttached
))
{
if
(
Objects
.
isNull
(
userAttached
))
{
userAttached
=
createUserAttached
(
userId
,
null
,
nick
);
userAttached
=
createUserAttached
(
userId
,
null
,
nick
);
}
}
if
(!
Objects
.
equals
(
nick
,
userAttached
.
getNick
()))
{
if
(!
Objects
.
equals
(
nick
,
userAttached
.
getNick
()))
{
userAttached
.
setNick
(
nick
);
userAttached
.
setNick
(
nick
);
try
{
try
{
userAttached
=
userAttachedRepository
.
save
(
userAttached
);
userAttached
=
userAttachedRepository
.
save
(
userAttached
);
}
catch
(
ConstraintViolationException
e
)
{
}
catch
(
ConstraintViolationException
e
)
{
// Sql唯一约束异常(诱因是Form重复提交,因为该操作是幂等的,故此不需额外处理,可返回成功)
// Sql唯一约束异常(诱因是Form重复提交,因为该操作是幂等的,故此不需额外处理,可返回成功)
log
.
error
(
"Sql约束异常[uni_idx_user_id]重复提交Form是幂等操作,不影响处理结果"
,
e
);
log
.
error
(
"Sql约束异常[uni_idx_user_id]重复提交Form是幂等操作,不影响处理结果"
,
e
);
}
}
...
@@ -121,7 +108,7 @@ public class UserCenterServiceImpl implements UserCenterService {
...
@@ -121,7 +108,7 @@ public class UserCenterServiceImpl implements UserCenterService {
*
*
* @param userId - 用户主键
* @param userId - 用户主键
* @param avatar - 头像url地址
* @param avatar - 头像url地址
* @param nick - 昵称
* @param nick
- 昵称
* @return
* @return
*/
*/
private
synchronized
UserAttached
createUserAttached
(
Long
userId
,
String
avatar
,
String
nick
)
{
private
synchronized
UserAttached
createUserAttached
(
Long
userId
,
String
avatar
,
String
nick
)
{
...
@@ -129,10 +116,10 @@ public class UserCenterServiceImpl implements UserCenterService {
...
@@ -129,10 +116,10 @@ public class UserCenterServiceImpl implements UserCenterService {
// 更新实例
// 更新实例
userAttached
=
Optional
.
ofNullable
(
userAttached
).
orElse
(
new
UserAttached
());
userAttached
=
Optional
.
ofNullable
(
userAttached
).
orElse
(
new
UserAttached
());
userAttached
.
setUserId
(
userId
);
userAttached
.
setUserId
(
userId
);
if
(
StringUtils
.
isBlank
(
userAttached
.
getAvatar
()))
{
if
(
StringUtils
.
isBlank
(
userAttached
.
getAvatar
()))
{
userAttached
.
setAvatar
(
avatar
);
userAttached
.
setAvatar
(
avatar
);
}
}
if
(
StringUtils
.
isBlank
(
userAttached
.
getNick
()))
{
if
(
StringUtils
.
isBlank
(
userAttached
.
getNick
()))
{
userAttached
.
setNick
(
nick
);
userAttached
.
setNick
(
nick
);
}
}
return
userAttachedRepository
.
save
(
userAttached
);
return
userAttachedRepository
.
save
(
userAttached
);
...
...
src/main/java/cn/quantgroup/xyqb/session/XyqbSessionContextHolder.java
View file @
4c80cacd
...
@@ -52,21 +52,16 @@ public class XyqbSessionContextHolder {
...
@@ -52,21 +52,16 @@ public class XyqbSessionContextHolder {
}
}
public
static
SessionStruct
getXSessionFromRedis
(
String
token
)
{
public
static
SessionStruct
getXSessionFromRedis
(
String
token
)
{
if
(
Objects
.
isNull
(
redisTemplate
))
{
return
null
;
}
String
linkToken
=
Constants
.
Session
.
USER_SESSION_CACHE
+
token
;
String
linkToken
=
Constants
.
Session
.
USER_SESSION_CACHE
+
token
;
String
result
=
redisTemplate
.
opsForValue
().
get
(
linkToken
);
String
result
=
redisTemplate
.
opsForValue
().
get
(
linkToken
);
if
(
StringUtils
.
isEmpty
(
result
))
{
if
(
StringUtils
.
isEmpty
(
result
))
{
log
.
warn
(
"[XyqbSessionContextHolder][getXSessionFromRedis] Tokekn:{},linkTokekn:{}"
,
token
,
linkToken
);
log
.
warn
(
"[XyqbSessionContextHolder][getXSessionFromRedis] session data 未找到:Tokekn:{},linkTokekn:{},sessionValue:{}"
,
token
,
linkToken
,
result
);
log
.
warn
(
"[XyqbSessionContextHolder][getXSessionFromRedis] session data 未找到:sid:{},sessionValue:{}"
,
token
,
result
);
return
null
;
return
null
;
}
}
try
{
try
{
SessionValue
values
=
JSON
.
parseObject
(
result
,
SessionValue
.
class
);
SessionValue
values
=
JSON
.
parseObject
(
result
,
SessionValue
.
class
);
if
(
values
==
null
)
{
if
(
values
==
null
)
{
log
.
warn
(
"[XyqbSessionContextHolder][getXSessionFromRedis] Tokekn:{},linkTokekn:{}"
,
token
,
linkToken
);
log
.
warn
(
"[XyqbSessionContextHolder][getXSessionFromRedis] session data 序列化失败:token:{},linkTokekn:{},sessionValue:{}"
,
token
,
linkToken
,
result
);
log
.
warn
(
"[XyqbSessionContextHolder][getXSessionFromRedis] session data 序列化失败:sid:{},sessionValue:{}"
,
token
,
result
);
return
null
;
return
null
;
}
}
SessionStruct
sessionStruct
=
new
SessionStruct
();
SessionStruct
sessionStruct
=
new
SessionStruct
();
...
@@ -75,8 +70,7 @@ public class XyqbSessionContextHolder {
...
@@ -75,8 +70,7 @@ public class XyqbSessionContextHolder {
sessionStruct
.
setExpire
(
redisTemplate
.
getExpire
(
Constants
.
Session
.
USER_SESSION_CACHE
+
token
));
sessionStruct
.
setExpire
(
redisTemplate
.
getExpire
(
Constants
.
Session
.
USER_SESSION_CACHE
+
token
));
return
sessionStruct
;
return
sessionStruct
;
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
log
.
warn
(
"[XyqbSessionContextHolder][getXSessionFromRedis] Tokekn:{},linkTokekn:{}"
,
token
,
linkToken
);
log
.
warn
(
"[XyqbSessionContextHolder][getXSessionFromRedis] 序列化SessionValue出错:Tokekn:{},linkTokekn:{},sessionValue:{}"
,
token
,
linkToken
,
result
,
e
);
log
.
warn
(
"[XyqbSessionContextHolder][getXSessionFromRedis] 序列化SessionValue出错:sid:{},sessionValue:{}"
,
token
,
result
,
e
);
return
null
;
return
null
;
}
}
}
}
...
...
src/test/java/common/JsonTest.java
View file @
4c80cacd
...
@@ -8,7 +8,6 @@ import com.alibaba.fastjson.serializer.SerializerFeature;
...
@@ -8,7 +8,6 @@ import com.alibaba.fastjson.serializer.SerializerFeature;
import
com.fasterxml.jackson.databind.DeserializationFeature
;
import
com.fasterxml.jackson.databind.DeserializationFeature
;
import
com.fasterxml.jackson.databind.ObjectMapper
;
import
com.fasterxml.jackson.databind.ObjectMapper
;
import
com.fasterxml.jackson.databind.SerializationFeature
;
import
com.fasterxml.jackson.databind.SerializationFeature
;
import
com.google.gson.Gson
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.codec.binary.Base64
;
import
org.apache.commons.codec.binary.Base64
;
import
org.junit.Test
;
import
org.junit.Test
;
...
@@ -20,7 +19,6 @@ import java.sql.Timestamp;
...
@@ -20,7 +19,6 @@ import java.sql.Timestamp;
@Slf4j
@Slf4j
@RunWith
(
JUnit4
.
class
)
@RunWith
(
JUnit4
.
class
)
public
class
JsonTest
{
public
class
JsonTest
{
private
static
final
Gson
GSON
=
new
Gson
();
private
static
final
ObjectMapper
MAPPER
=
new
ObjectMapper
()
private
static
final
ObjectMapper
MAPPER
=
new
ObjectMapper
()
.
configure
(
DeserializationFeature
.
FAIL_ON_UNKNOWN_PROPERTIES
,
false
)
.
configure
(
DeserializationFeature
.
FAIL_ON_UNKNOWN_PROPERTIES
,
false
)
.
configure
(
SerializationFeature
.
WRITE_ENUMS_USING_INDEX
,
true
)
.
configure
(
SerializationFeature
.
WRITE_ENUMS_USING_INDEX
,
true
)
...
@@ -34,7 +32,7 @@ public class JsonTest {
...
@@ -34,7 +32,7 @@ public class JsonTest {
userData
.
setId
(
131L
);
userData
.
setId
(
131L
);
userData
.
setUserId
(
119L
);
userData
.
setUserId
(
119L
);
userData
.
setCreatedAt
(
new
Timestamp
(
1
));
userData
.
setCreatedAt
(
new
Timestamp
(
1
));
log
.
info
(
"序列化--GSON--成功!data:{}"
,
GSON
.
toJson
(
userData
));
log
.
info
(
"序列化--GSON--成功!data:{}"
,
JSON
.
toJSONString
(
userData
));
log
.
info
(
"序列化--MAPPER--成功!data:{}"
,
MAPPER
.
writeValueAsString
(
userData
));
log
.
info
(
"序列化--MAPPER--成功!data:{}"
,
MAPPER
.
writeValueAsString
(
userData
));
log
.
info
(
"序列化--JSON--成功!data:{}"
,
JSON
.
toJSONString
(
userData
,
SerializerFeature
.
config
(
JSON
.
DEFAULT_GENERATE_FEATURE
,
SerializerFeature
.
WriteEnumUsingName
,
false
)));
log
.
info
(
"序列化--JSON--成功!data:{}"
,
JSON
.
toJSONString
(
userData
,
SerializerFeature
.
config
(
JSON
.
DEFAULT_GENERATE_FEATURE
,
SerializerFeature
.
WriteEnumUsingName
,
false
)));
log
.
info
(
"序列化--JSONObject--成功!data:{}"
,
JSONObject
.
toJSONString
(
userData
));
log
.
info
(
"序列化--JSONObject--成功!data:{}"
,
JSONObject
.
toJSONString
(
userData
));
...
@@ -46,7 +44,7 @@ public class JsonTest {
...
@@ -46,7 +44,7 @@ public class JsonTest {
@Test
@Test
public
void
gsonGson
(){
public
void
gsonGson
(){
try
{
try
{
UserDetail
userData
=
GSON
.
fromJson
(
body
,
UserDetail
.
class
);
UserDetail
userData
=
JSON
.
parseObject
(
body
,
UserDetail
.
class
);
log
.
info
(
"GSON--成功!data:{}"
,
userData
);
log
.
info
(
"GSON--成功!data:{}"
,
userData
);
}
catch
(
Exception
e
){
}
catch
(
Exception
e
){
log
.
error
(
"GSON--失败!"
,
e
);
log
.
error
(
"GSON--失败!"
,
e
);
...
...
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