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
9b26ceb9
Commit
9b26ceb9
authored
Nov 08, 2017
by
Java—红包—徐 然
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改增加日志和异步日志线程池和内部调用方法
parent
b290d05e
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
130 additions
and
18 deletions
+130
-18
LogCallHttpAspect.java
...n/quantgroup/xyqb/aspect/logcaller/LogCallHttpAspect.java
+1
-1
AsyncConfig.java
...in/java/cn/quantgroup/xyqb/config/thread/AsyncConfig.java
+50
-0
AppController.java
...antgroup/xyqb/controller/external/user/AppController.java
+4
-6
InnerController.java
...tgroup/xyqb/controller/external/user/InnerController.java
+48
-2
UserController.java
...ntgroup/xyqb/controller/internal/user/UserController.java
+11
-7
SessionServiceImpl.java
...ntgroup/xyqb/service/session/impl/SessionServiceImpl.java
+2
-2
IContactService.java
...java/cn/quantgroup/xyqb/service/user/IContactService.java
+3
-0
ContactServiceImpl.java
...quantgroup/xyqb/service/user/impl/ContactServiceImpl.java
+11
-0
No files found.
src/main/java/cn/quantgroup/xyqb/aspect/logcaller/LogCallHttpAspect.java
View file @
9b26ceb9
...
...
@@ -51,7 +51,7 @@ public class LogCallHttpAspect {
}
return
result
;
}
@Async
(
"logExecutor"
)
public
void
asyncRecordIt
(
ProceedingJoinPoint
pjp
,
Object
result
,
String
remoteIP
){
Object
[]
args
=
pjp
.
getArgs
();
String
methodName
=
pjp
.
getSignature
().
getName
();
...
...
src/main/java/cn/quantgroup/xyqb/config/thread/AsyncConfig.java
0 → 100644
View file @
9b26ceb9
package
cn
.
quantgroup
.
xyqb
.
config
.
thread
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.scheduling.annotation.EnableAsync
;
import
org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor
;
import
java.util.concurrent.Executor
;
/**
* Created by xuran on 2017/11/8.
*/
@Configuration
@EnableAsync
public
class
AsyncConfig
{
/**
* 生成线程池
* @param corePoolSize
* @param maxPoolSize
* @param queueCapacity
* @param waitForCompleteOnShutdown
* @param prefix
* @return
*/
private
ThreadPoolTaskExecutor
generateThreadPoolTaskExecutor
(
int
corePoolSize
,
int
maxPoolSize
,
int
queueCapacity
,
boolean
waitForCompleteOnShutdown
,
int
keepAliveSeconds
,
boolean
allowCoreThreadTimeOut
,
String
prefix
)
{
ThreadPoolTaskExecutor
executor
=
new
ThreadPoolTaskExecutor
();
executor
.
setCorePoolSize
(
corePoolSize
);
executor
.
setMaxPoolSize
(
maxPoolSize
);
executor
.
setQueueCapacity
(
queueCapacity
);
executor
.
setKeepAliveSeconds
(
keepAliveSeconds
);
executor
.
setAllowCoreThreadTimeOut
(
allowCoreThreadTimeOut
);
executor
.
setWaitForTasksToCompleteOnShutdown
(
waitForCompleteOnShutdown
);
executor
.
setThreadNamePrefix
(
prefix
);
executor
.
initialize
();
return
executor
;
}
/**
* 日志线程池
* @return
*/
@Bean
(
name
=
"logExecutor"
)
public
Executor
loanMqExecutor
(){
return
generateThreadPoolTaskExecutor
(
100
,
2000
,
2000
,
true
,
30
,
true
,
"loanMqExecutor-"
);
}
}
src/main/java/cn/quantgroup/xyqb/controller/external/user/AppController.java
View file @
9b26ceb9
...
...
@@ -71,7 +71,6 @@ public class AppController implements IBaseController {
* 第三方用户登录
*/
@RequestMapping
(
"/login"
)
@LogHttpCaller
public
JsonResult
login
(
String
phoneNo
,
@RequestParam
(
required
=
false
,
defaultValue
=
"1"
)
Long
registerFrom
,
...
...
@@ -83,7 +82,7 @@ public class AppController implements IBaseController {
}
String
requestIp
=
IPUtil
.
getRemoteIP
(
request
);
LOGGER
.
info
(
"
第三方用户登录, loginFrom:{}, requestIp:{}"
,
registerFrom
,
requestIp
);
LOGGER
.
info
(
"
app/login第三方用户登录, loginFrom:{},channelId:{},btRegisterChannelId:{} requestIp:{},idNo:{},name:{}"
,
registerFrom
,
channelId
,
btRegisterChannelId
,
requestIp
,
idNo
,
name
);
User
user
=
userService
.
findByPhoneInDb
(
phoneNo
);
if
(
user
==
null
)
{
user
=
register
(
registerFrom
,
phoneNo
,
idNo
,
name
,
channelId
,
btRegisterChannelId
);
...
...
@@ -116,7 +115,6 @@ public class AppController implements IBaseController {
/**
* 给app用
*/
@LogHttpCaller
@RequestMapping
(
"/login2"
)
public
JsonResult
login2
(
String
phoneNo
,
...
...
@@ -130,7 +128,7 @@ public class AppController implements IBaseController {
}
String
requestIp
=
IPUtil
.
getRemoteIP
(
request
);
LOGGER
.
info
(
"第三方用户登录, loginFrom:{},
requestIp:{}"
,
registerFrom
,
requestIp
);
LOGGER
.
info
(
"第三方用户登录, loginFrom:{},
channelId:{}, requestIp:{}"
,
registerFrom
,
channelId
,
requestIp
);
User
user
=
userService
.
findByPhoneInDb
(
phoneNo
);
if
(
user
==
null
)
{
...
...
@@ -169,7 +167,7 @@ public class AppController implements IBaseController {
}
String
requestIp
=
IPUtil
.
getRemoteIP
(
request
);
LOGGER
.
info
(
"
第三方用户登录, loginFrom:{}, requestIp:{}"
,
registerFrom
,
requestIp
);
LOGGER
.
info
(
"
app/login_super第三方用户登录, loginFrom:{},channelId:{},btRegisterChannelId:{} requestIp:{},idNo:{},name:{}"
,
registerFrom
,
channelId
,
btRegisterChannelId
,
requestIp
,
idNo
,
name
);
User
user
=
userService
.
findByPhoneInDb
(
phoneNo
);
if
(
user
==
null
)
{
user
=
register
(
registerFrom
,
phoneNo
,
idNo
,
name
,
channelId
,
btRegisterChannelId
);
...
...
@@ -200,7 +198,7 @@ public class AppController implements IBaseController {
context
.
setAppChannel
(
appChannel
);
loginInfo
.
setLoginContext
(
context
);
LOGGER
.
info
(
"第三方用户获取信息登录成功, loginFrom:{}, phoneNo:{},appChannel:{}
"
,
registerFrom
,
phoneNo
,
appChannel
);
LOGGER
.
info
(
"第三方用户获取信息登录成功, loginFrom:{}, phoneNo:{},appChannel:{}
,channelId:{}"
,
registerFrom
,
phoneNo
,
appChannel
,
channelId
);
return
JsonResult
.
buildSuccessResult
(
""
,
loginInfo
);
...
...
src/main/java/cn/quantgroup/xyqb/controller/external/user/InnerController.java
View file @
9b26ceb9
package
cn
.
quantgroup
.
xyqb
.
controller
.
external
.
user
;
import
cn.quantgroup.user.enums.Relation
;
import
cn.quantgroup.xyqb.aspect.logcaller.LogHttpCaller
;
import
cn.quantgroup.xyqb.controller.IBaseController
;
import
cn.quantgroup.xyqb.entity.Address
;
...
...
@@ -210,6 +211,7 @@ public class InnerController implements IBaseController {
public
JsonResult
saveUser
(
String
phoneNo
,
Long
registeredFrom
,
Long
createdAt
,
Long
updatedAt
,
String
password
,
String
uuid
)
{
LOGGER
.
info
(
"保存用户,phoneNo:{},registeredFrom;{},uuid:{}"
,
phoneNo
,
registeredFrom
,
uuid
);
//参数验证
if
(
StringUtils
.
isBlank
(
phoneNo
))
{
return
JsonResult
.
buildErrorStateResult
(
"用户手机号不能为空."
,
null
);
...
...
@@ -231,6 +233,7 @@ public class InnerController implements IBaseController {
if
(
user
==
null
)
{
user
=
new
User
();
}
else
if
(!
user
.
getEnable
())
{
LOGGER
.
info
(
"用户已经注销,phoneNo:{},"
,
phoneNo
);
return
JsonResult
.
buildErrorStateResult
(
"用户已经注销"
,
null
);
}
if
(
org
.
apache
.
commons
.
lang
.
StringUtils
.
isEmpty
(
user
.
getUuid
()))
{
...
...
@@ -262,6 +265,7 @@ public class InnerController implements IBaseController {
@RequestMapping
(
"/user_detail/save"
)
public
JsonResult
saveUserDetail
(
Long
userId
,
String
phoneNo
,
String
name
,
String
idNo
,
String
email
,
Long
id
)
{
LOGGER
.
info
(
"保存用户详细信息,phoneNo:{},userId;{},name:{},idNo:{},email;{}"
,
phoneNo
,
userId
,
name
,
idNo
,
email
);
//参数验证
if
(
userId
==
null
||
userId
==
0L
)
{
return
JsonResult
.
buildErrorStateResult
(
"用户id为空."
,
null
);
...
...
@@ -364,7 +368,7 @@ public class InnerController implements IBaseController {
@RequestMapping
(
"/contact/save/contacts"
)
public
JsonResult
save2Contact
(
Long
userId
,
@RequestParam
(
value
=
"contacts"
)
String
contactsStr
)
{
LOGGER
.
info
(
"保存用户联系人:userId:{}, contacts:
"
+
contactsStr
);
LOGGER
.
info
(
"保存用户联系人:userId:{}, contacts:
{}"
,
userId
,
contactsStr
);
if
(
StringUtils
.
isEmpty
(
contactsStr
))
{
return
JsonResult
.
buildErrorStateResult
(
null
,
null
);
}
...
...
@@ -398,6 +402,46 @@ public class InnerController implements IBaseController {
return
JsonResult
.
buildSuccessResult
(
null
,
ContactRet
.
contacts2ContactRets
(
result
));
}
@RequestMapping
(
"/contact/update/contact"
)
public
JsonResult
updateContact
(
@RequestParam
Long
contactId
,
@RequestParam
(
required
=
false
)
String
name
,
@RequestParam
(
required
=
false
)
String
phoneNo
,
@RequestParam
(
required
=
false
)
Relation
relation
,
String
key
)
{
if
(!
"@qwsdedad131323213w!"
.
equals
(
key
))
{
return
JsonResult
.
buildErrorStateResult
(
"参数不合法"
,
null
);
}
Contact
contact
=
contactService
.
findById
(
contactId
);
if
(
null
==
contact
)
{
return
JsonResult
.
buildErrorStateResult
(
"修改联系人不存在"
,
null
);
}
if
(
null
==
name
&&
null
==
phoneNo
)
{
return
JsonResult
.
buildErrorStateResult
(
"修改联系人修改条件不能都为空"
,
null
);
}
if
(!
ValidationUtil
.
validatePhoneNo
(
contact
.
getPhoneNo
()))
{
return
JsonResult
.
buildErrorStateResult
(
"用户手机号错误"
,
null
);
}
if
(!
ValidationUtil
.
validateChinese
(
contact
.
getName
()))
{
return
JsonResult
.
buildErrorStateResult
(
"用户姓名错误"
,
null
);
}
if
(
null
!=
name
)
{
contact
.
setName
(
name
);
}
if
(
null
!=
phoneNo
)
{
contact
.
setPhoneNo
(
phoneNo
);
}
if
(
null
!=
relation
)
{
contact
.
setRelation
(
relation
);
}
Timestamp
now
=
new
Timestamp
(
System
.
currentTimeMillis
());
contact
.
setUpdateAt
(
now
);
contact
=
contactService
.
save
(
contact
);
return
JsonResult
.
buildSuccessResult
(
"修改联系人成功"
,
contact
);
}
private
void
convertContactList
(
Long
userId
,
List
<
Contact
>
contacts
,
Timestamp
now
)
{
for
(
Contact
c
:
contacts
)
{
c
.
setId
(
null
);
...
...
@@ -424,7 +468,7 @@ public class InnerController implements IBaseController {
public
JsonResult
saveAddress
(
Long
userId
,
Long
provinceCode
,
Long
cityCode
,
String
city
,
Long
districtCode
,
String
district
,
String
address
,
String
province
)
{
LOGGER
.
info
(
"保存地址详情:city:{},province:{}
"
+
city
,
province
);
LOGGER
.
info
(
"保存地址详情:city:{},province:{}
,userId:{}"
+
city
,
province
,
userId
);
if
(
userId
==
null
||
provinceCode
==
null
||
cityCode
==
null
)
{
return
JsonResult
.
buildErrorStateResult
(
null
,
null
);
}
...
...
@@ -448,6 +492,7 @@ public class InnerController implements IBaseController {
}
@RequestMapping
(
"/user_ext_info/update"
)
@LogHttpCaller
public
JsonResult
updateMarryStatus
(
Long
userId
,
IncomeEnum
incomeEnum
,
IncomeRangeEnum
incomeRangeEnum
,
OccupationEnum
occupationEnum
,
EducationEnum
educationEnum
,
Boolean
hasCar
,
...
...
@@ -798,6 +843,7 @@ public class InnerController implements IBaseController {
* 保存用户信息,地址信息,联系人信息
*/
@RequestMapping
(
"/user/save_multi"
)
@LogHttpCaller
public
JsonResult
saveMulti
(
String
registeredFrom
,
String
channelId
,
...
...
src/main/java/cn/quantgroup/xyqb/controller/internal/user/UserController.java
View file @
9b26ceb9
...
...
@@ -18,6 +18,7 @@ import cn.quantgroup.xyqb.service.sms.ISmsService;
import
cn.quantgroup.xyqb.service.user.IUserDetailService
;
import
cn.quantgroup.xyqb.service.user.IUserService
;
import
cn.quantgroup.xyqb.service.wechat.IWechatService
;
import
cn.quantgroup.xyqb.util.DateUtils
;
import
cn.quantgroup.xyqb.util.MqUtils
;
import
cn.quantgroup.xyqb.util.PasswordUtil
;
import
cn.quantgroup.xyqb.util.ValidationUtil
;
...
...
@@ -37,6 +38,7 @@ import java.io.UnsupportedEncodingException;
import
java.util.HashMap
;
import
java.util.Map
;
import
java.util.Random
;
import
java.util.concurrent.TimeUnit
;
/**
* Created by FrankChow on 15/7/5.
...
...
@@ -75,12 +77,11 @@ public class UserController implements IBaseController {
'x'
,
'y'
,
'z'
,
'0'
,
'1'
,
'2'
,
'3'
,
'4'
,
'5'
,
'6'
,
'7'
,
'8'
,
'9'
};
@RequestMapping
(
"/login"
)
@LogHttpCaller
public
JsonResult
login
(
@RequestParam
(
required
=
false
,
defaultValue
=
"1"
)
Long
channelId
,
String
appChannel
,
@RequestParam
(
required
=
false
,
defaultValue
=
"1"
)
Long
createdFrom
,
@RequestParam
(
required
=
false
,
defaultValue
=
""
)
String
userId
,
@RequestParam
(
required
=
false
,
defaultValue
=
"xyqb"
)
String
key
,
HttpServletRequest
request
,
String
openId
,
@RequestParam
(
required
=
false
)
String
dimension
)
{
LOGGER
.
info
(
"user/login,请求参数channelId:{},appChannel:{},createdFrom:{},userId:{},key:{},openId:{},dimension:{},"
,
channelId
,
appChannel
,
createdFrom
,
userId
,
key
,
openId
,
dimension
);
Merchant
merchant
=
merchantService
.
findMerchantByName
(
key
);
if
(
merchant
==
null
)
{
return
JsonResult
.
buildErrorStateResult
(
"未知的连接"
,
null
);
...
...
@@ -113,11 +114,12 @@ public class UserController implements IBaseController {
}
@RequestMapping
(
"/login/fast"
)
@LogHttpCaller
public
JsonResult
loginFast
(
@RequestParam
(
required
=
false
,
defaultValue
=
"1"
)
Long
channelId
,
String
appChannel
,
@RequestParam
(
required
=
false
,
defaultValue
=
"1"
)
Long
createdFrom
,
@RequestParam
(
required
=
false
,
defaultValue
=
"xyqb"
)
String
key
,
@RequestParam
(
required
=
false
)
Long
btRegisterChannelId
,
@RequestParam
(
required
=
false
)
String
dimension
,
HttpServletRequest
request
)
{
Map
<
String
,
JsonResult
>
validMap
=
getHeaderParam
(
request
);
LOGGER
.
info
(
"user/login/fast,请求参数channelId:{},appChannel:{},createdFrom:{},btRegisterChannelId:{},key:{},dimension:{},"
,
channelId
,
appChannel
,
createdFrom
,
btRegisterChannelId
,
key
,
dimension
);
if
(
null
!=
validMap
.
get
(
"fail"
))
{
return
validMap
.
get
(
"fail"
);
}
...
...
@@ -129,6 +131,7 @@ public class UserController implements IBaseController {
String
phoneNo
=
successResult
.
getData
().
toString
();
User
user
=
userService
.
findByPhoneWithCache
(
phoneNo
);
if
(
user
!=
null
&&
!
user
.
getEnable
())
{
LOGGER
.
error
(
"用户不存在,或者已经注销,phoneNo:{}"
,
phoneNo
);
return
JsonResult
.
buildErrorStateResult
(
"登录失败"
,
null
);
}
if
(
user
==
null
)
{
...
...
@@ -218,12 +221,11 @@ public class UserController implements IBaseController {
* @return
*/
@RequestMapping
(
"/register/fast"
)
@LogHttpCaller
public
JsonResult
registerFast
(
@RequestParam
String
phoneNo
,
@RequestParam
String
verificationCode
,
@RequestParam
(
required
=
false
)
Long
channelId
,
@RequestParam
(
required
=
false
)
Long
registerFrom
,
@RequestParam
(
required
=
false
,
defaultValue
=
""
)
String
appChannel
,
@RequestParam
(
required
=
false
)
Long
btRegisterChannelId
,
@RequestParam
(
required
=
false
)
String
dimension
)
{
String
password
=
genRandomPwd
();
LOGGER
.
info
(
"用户快速注册, phoneNo:{}, verificationCode:{}, channelId:{}, registerFrom:{},appChannel:{}
"
,
phoneNo
,
verificationCode
,
channelId
,
registerFrom
,
appChannel
);
LOGGER
.
info
(
"用户快速注册, phoneNo:{}, verificationCode:{}, channelId:{}, registerFrom:{},appChannel:{}
,btRegisterChannelId:{},dimension:{}"
,
phoneNo
,
verificationCode
,
channelId
,
registerFrom
,
appChannel
,
btRegisterChannelId
,
dimension
);
if
(!
ValidationUtil
.
validatePhoneNo
(
phoneNo
))
{
LOGGER
.
info
(
"用户快速注册失败,手机号错误, registerFrom:{}, phoneNo:{}"
,
registerFrom
,
phoneNo
);
return
JsonResult
.
buildErrorStateResult
(
"手机号错误"
,
null
);
...
...
@@ -267,13 +269,12 @@ public class UserController implements IBaseController {
* @param channelId
* @return
*/
@LogHttpCaller
@RequestMapping
(
"/register"
)
public
JsonResult
register
(
@RequestParam
String
phoneNo
,
@RequestParam
String
password
,
@RequestParam
String
verificationCode
,
@RequestParam
(
required
=
false
)
Long
channelId
,
@RequestParam
(
required
=
false
)
Long
registerFrom
,
@RequestParam
(
required
=
false
)
Long
btRegisterChannelId
,
@RequestParam
(
required
=
false
)
String
dimension
)
{
LOGGER
.
info
(
"用户注册, phoneNo:{}, verificationCode:{}, channelId:{}, registerFrom:{},btRegisterChannelId:{}
"
,
phoneNo
,
verificationCode
,
channelId
,
registerFrom
,
btRegisterChannelId
);
LOGGER
.
info
(
"用户注册, phoneNo:{}, verificationCode:{}, channelId:{}, registerFrom:{},btRegisterChannelId:{}
,dimension:{}"
,
phoneNo
,
verificationCode
,
channelId
,
registerFrom
,
btRegisterChannelId
,
dimension
);
if
(!
ValidationUtil
.
validatePhoneNo
(
phoneNo
))
{
LOGGER
.
info
(
"用户注册失败,手机号错误, registerFrom:{}, phoneNo:{}"
,
registerFrom
,
phoneNo
);
return
JsonResult
.
buildErrorStateResult
(
"手机号错误"
,
null
);
...
...
@@ -385,6 +386,8 @@ public class UserController implements IBaseController {
boolean
needRetSend
=
false
;
String
verificationCountKey
=
Constants
.
REDIS_VERIFICATION_COUNT
+
phoneNo
;
Long
getVerificationCount
=
stringRedisTemplate
.
opsForHash
().
increment
(
verificationCountKey
,
Constants
.
REDIS_VERIFICATION_COUNT
,
1
);
//已经存在删除操作增加过期时间防止意外
stringRedisTemplate
.
expire
(
verificationCountKey
,
DateUtils
.
getSeconds
(),
TimeUnit
.
SECONDS
);
if
(
getVerificationCount
>
5
){
return
needRetSend
=
true
;
}
...
...
@@ -505,6 +508,7 @@ public class UserController implements IBaseController {
MqUtils
.
sendLoanVest
(
statistics
);
return
new
JsonResult
(
sessionService
.
createSession
(
channelId
,
createdFrom
,
appChannel
,
user
,
merchant
));
}
else
{
LOGGER
.
error
(
"用户不存在,或者已经注销,userId:{}"
,
userId
);
return
JsonResult
.
buildErrorStateResult
(
"登录失败"
,
null
);
}
}
...
...
src/main/java/cn/quantgroup/xyqb/service/session/impl/SessionServiceImpl.java
View file @
9b26ceb9
...
...
@@ -65,13 +65,13 @@ public class SessionServiceImpl implements ISessionService {
authBean
.
setPhoneNo
(
user
.
getPhoneNo
());
authBean
.
setToken
(
sessionStruct
.
getSid
());
persistSession
(
sessionStruct
.
getSid
(),
sessionStruct
.
getValues
());
log
.
info
(
"用户登录成功, loginFrom:{}, phoneNo:{},appChannel:{}
"
,
createdFrom
,
user
.
getPhoneNo
(),
appChannel
);
log
.
info
(
"用户登录成功, loginFrom:{}, phoneNo:{},appChannel:{}
,channelId:{}"
,
createdFrom
,
user
.
getPhoneNo
(),
appChannel
,
channelId
);
return
authBean
;
}
SessionStruct
sessionStruct
=
createSessionAndPersist
(
user
,
properties
);
authBean
.
setPhoneNo
(
user
.
getPhoneNo
());
authBean
.
setToken
(
sessionStruct
.
getSid
());
log
.
info
(
"用户登录成功, loginFrom:{}, phoneNo:{},appChannel:{}
"
,
createdFrom
,
user
.
getPhoneNo
(),
appChannel
);
log
.
info
(
"用户登录成功, loginFrom:{}, phoneNo:{},appChannel:{}
,channelId:{}"
,
createdFrom
,
user
.
getPhoneNo
(),
appChannel
,
channelId
);
return
authBean
;
}
...
...
src/main/java/cn/quantgroup/xyqb/service/user/IContactService.java
View file @
9b26ceb9
...
...
@@ -10,5 +10,8 @@ import java.util.List;
public
interface
IContactService
{
List
<
Contact
>
findByUserId
(
Long
userId
);
Contact
findById
(
Long
id
);
List
<
Contact
>
save
(
List
<
Contact
>
contacts
);
Contact
save
(
Contact
contact
);
}
src/main/java/cn/quantgroup/xyqb/service/user/impl/ContactServiceImpl.java
View file @
9b26ceb9
...
...
@@ -25,11 +25,22 @@ public class ContactServiceImpl implements IContactService {
return
contactRepository
.
findByUserId
(
userId
);
}
@Override
public
Contact
findById
(
Long
id
)
{
return
contactRepository
.
findOne
(
id
);
}
@Override
@CacheEvict
(
value
=
"contact"
,
key
=
"'contact' + #contacts.get(0).userId"
,
cacheManager
=
"cacheManager"
)
public
List
<
Contact
>
save
(
List
<
Contact
>
contacts
)
{
return
contactRepository
.
save
(
contacts
);
}
@Override
@CacheEvict
(
value
=
"contact"
,
key
=
"'contact' + #contact.userId"
,
cacheManager
=
"cacheManager"
)
public
Contact
save
(
Contact
contact
)
{
return
contactRepository
.
save
(
contact
);
}
}
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