Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
open-source
/
chejia-smart-service
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 0a6eb0e7
authored
Apr 20, 2021
by
wnb0128
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
车家智能数据服务 用户数据重复请求加锁--think.wang
1 parent
c80df7ec
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
0 deletions
src/main/java/com/glsx/smart/constant/Constants.java
src/main/java/com/glsx/smart/controller/UserRelationController.java
src/main/java/com/glsx/smart/constant/Constants.java
View file @
0a6eb0e
...
@@ -17,4 +17,6 @@ public class Constants {
...
@@ -17,4 +17,6 @@ public class Constants {
public
final
static
String
SCENE_CONTENT_DEVICE
=
"scene_content_device"
;
public
final
static
String
SCENE_CONTENT_DEVICE
=
"scene_content_device"
;
public
final
static
int
REDIS_CACHE_TIME
=
3
;
//redis缓存时间
}
}
src/main/java/com/glsx/smart/controller/UserRelationController.java
View file @
0a6eb0e
...
@@ -6,6 +6,8 @@ import com.alibaba.nacos.common.utils.MD5Utils;
...
@@ -6,6 +6,8 @@ import com.alibaba.nacos.common.utils.MD5Utils;
import
com.glsx.plat.common.utils.HttpUtils
;
import
com.glsx.plat.common.utils.HttpUtils
;
import
com.glsx.plat.common.utils.StringUtils
;
import
com.glsx.plat.common.utils.StringUtils
;
import
com.glsx.plat.core.web.R
;
import
com.glsx.plat.core.web.R
;
import
com.glsx.plat.redis.utils.RedisUtils
;
import
com.glsx.smart.constant.Constants
;
import
com.glsx.smart.dao.entity.SmartUserRelation
;
import
com.glsx.smart.dao.entity.SmartUserRelation
;
import
com.glsx.smart.service.SmartUserRelationService
;
import
com.glsx.smart.service.SmartUserRelationService
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
...
@@ -37,6 +39,9 @@ public class UserRelationController {
...
@@ -37,6 +39,9 @@ public class UserRelationController {
private
String
syncUser
;
private
String
syncUser
;
@Autowired
@Autowired
private
RedisUtils
redisUtils
;
@Autowired
private
SmartUserRelationService
userRelationService
;
private
SmartUserRelationService
userRelationService
;
@ResponseBody
@ResponseBody
...
@@ -63,6 +68,12 @@ public class UserRelationController {
...
@@ -63,6 +68,12 @@ public class UserRelationController {
@RequestMapping
(
value
=
"/login"
,
method
=
{
RequestMethod
.
POST
})
@RequestMapping
(
value
=
"/login"
,
method
=
{
RequestMethod
.
POST
})
public
R
login
(
@RequestBody
SmartUserRelation
userRelation
){
public
R
login
(
@RequestBody
SmartUserRelation
userRelation
){
log
.
info
(
"/user/login保存数据参数:{}"
,
JSON
.
toJSONString
(
userRelation
));
log
.
info
(
"/user/login保存数据参数:{}"
,
JSON
.
toJSONString
(
userRelation
));
String
key
=
new
StringBuffer
(
userRelation
.
getPhone
())
.
append
(
userRelation
.
getChannel
()).
toString
();
if
(
redisUtils
.
hasKey
(
key
)){
return
R
.
ok
();
}
redisUtils
.
setex
(
key
,
key
,
Constants
.
REDIS_CACHE_TIME
);
SmartUserRelation
request
=
new
SmartUserRelation
();
SmartUserRelation
request
=
new
SmartUserRelation
();
request
.
setPhone
(
userRelation
.
getPhone
());
request
.
setPhone
(
userRelation
.
getPhone
());
request
.
setChannel
(
userRelation
.
getChannel
());
//涂鸦
request
.
setChannel
(
userRelation
.
getChannel
());
//涂鸦
...
...
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