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
f9413568
Commit
f9413568
authored
Jan 03, 2017
by
zhouqian
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
first login
parent
1fe14fd0
Changes
17
Hide whitespace changes
Inline
Side-by-side
Showing
17 changed files
with
422 additions
and
4 deletions
+422
-4
PlatformAPIController.java
...b/controller/internal/platform/PlatformAPIController.java
+71
-0
Merchant.java
src/main/java/cn/quantgroup/xyqb/entity/Merchant.java
+2
-2
RequestFilter.java
src/main/java/cn/quantgroup/xyqb/filter/RequestFilter.java
+1
-1
IAddressRepository.java
...ava/cn/quantgroup/xyqb/repository/IAddressRepository.java
+1
-0
IContactRepository.java
...ava/cn/quantgroup/xyqb/repository/IContactRepository.java
+3
-0
IUserExtInfoRepository.java
...cn/quantgroup/xyqb/repository/IUserExtInfoRepository.java
+3
-1
IMerchantService.java
...cn/quantgroup/xyqb/service/merchant/IMerchantService.java
+15
-0
MerchantServiceImpl.java
...group/xyqb/service/merchant/impl/MerchantServiceImpl.java
+59
-0
IPageService.java
...in/java/cn/quantgroup/xyqb/service/page/IPageService.java
+11
-0
PageType.java
...n/java/cn/quantgroup/xyqb/service/page/bean/PageType.java
+35
-0
PageServiceImpl.java
...cn/quantgroup/xyqb/service/page/impl/PageServiceImpl.java
+106
-0
IAddressService.java
...java/cn/quantgroup/xyqb/service/user/IAddressService.java
+11
-0
IContactService.java
...java/cn/quantgroup/xyqb/service/user/IContactService.java
+12
-0
IUserExtInfoService.java
.../cn/quantgroup/xyqb/service/user/IUserExtInfoService.java
+11
-0
AddressServiceImpl.java
...quantgroup/xyqb/service/user/impl/AddressServiceImpl.java
+28
-0
ContactServiceImpl.java
...quantgroup/xyqb/service/user/impl/ContactServiceImpl.java
+28
-0
UserExtInfoServiceImpl.java
...tgroup/xyqb/service/user/impl/UserExtInfoServiceImpl.java
+25
-0
No files found.
src/main/java/cn/quantgroup/xyqb/controller/internal/platform/PlatformAPIController.java
0 → 100644
View file @
f9413568
package
cn
.
quantgroup
.
xyqb
.
controller
.
internal
.
platform
;
import
cn.quantgroup.xyqb.controller.IBaseController
;
import
cn.quantgroup.xyqb.entity.Merchant
;
import
cn.quantgroup.xyqb.entity.MerchantConfig
;
import
cn.quantgroup.xyqb.entity.User
;
import
cn.quantgroup.xyqb.model.JsonResult
;
import
cn.quantgroup.xyqb.model.Tuple
;
import
cn.quantgroup.xyqb.service.merchant.IMerchantService
;
import
cn.quantgroup.xyqb.service.page.IPageService
;
import
com.google.common.collect.ImmutableMap
;
import
org.apache.commons.lang.StringUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestParam
;
import
org.springframework.web.bind.annotation.RestController
;
/**
* Created by Miraculous on 2017/1/3.
*/
@RestController
@RequestMapping
(
"/platform/api"
)
public
class
PlatformAPIController
implements
IBaseController
{
@Autowired
private
IPageService
pageService
;
@Autowired
private
IMerchantService
merchantService
;
@RequestMapping
(
"/page/return_url"
)
public
JsonResult
returnUrl
(
String
key
)
{
Merchant
merchant
=
merchantService
.
findMerchantByName
(
key
);
if
(
null
==
merchant
)
{
return
JsonResult
.
buildErrorStateResult
(
""
,
null
);
}
MerchantConfig
config
=
merchantService
.
findConfigByMerchantIdAndConfigName
(
merchant
.
getId
(),
"returnUrl"
);
if
(
null
==
config
)
{
return
JsonResult
.
buildSuccessResult
(
""
,
null
);
}
return
JsonResult
.
buildSuccessResult
(
""
,
config
.
getConfigValue
());
}
@RequestMapping
(
"/page/next"
)
public
JsonResult
nextPage
(
String
key
,
String
target
,
@RequestParam
(
required
=
false
,
defaultValue
=
""
)
String
currentPage
)
{
User
user
=
getCurrentUser
();
if
(
null
==
user
)
{
return
JsonResult
.
buildErrorStateResult
(
"未找到用户"
,
null
);
}
Tuple
<
String
,
Boolean
>
nextPageTuple
=
pageService
.
nextPage
(
user
,
target
,
currentPage
);
Boolean
isFinal
=
nextPageTuple
.
getValue
();
String
nextPage
=
nextPageTuple
.
getKey
();
if
(
isFinal
)
{
Merchant
merchant
=
merchantService
.
findMerchantByName
(
key
);
if
(
merchant
==
null
)
{
return
JsonResult
.
buildSuccessResult
(
""
,
null
);
}
MerchantConfig
merchantConfig
=
merchantService
.
findConfigByMerchantIdAndConfigName
(
merchant
.
getId
(),
"returnUrl"
);
if
(
merchantConfig
==
null
)
{
return
JsonResult
.
buildSuccessResult
(
""
,
null
);
}
return
JsonResult
.
buildSuccessResult
(
""
,
ImmutableMap
.
of
(
"type"
,
"external"
,
"transition"
,
merchantConfig
.
getConfigValue
()));
}
if
(
StringUtils
.
isEmpty
(
nextPage
))
{
return
JsonResult
.
buildErrorStateResult
(
""
,
null
);
}
return
JsonResult
.
buildSuccessResult
(
""
,
ImmutableMap
.
of
(
"type"
,
"user"
,
"transition"
,
nextPage
));
}
}
src/main/java/cn/quantgroup/xyqb/entity/Merchant.java
View file @
f9413568
...
@@ -25,8 +25,8 @@ public class Merchant implements Serializable{
...
@@ -25,8 +25,8 @@ public class Merchant implements Serializable{
private
String
name
;
private
String
name
;
@Column
(
name
=
"enable"
)
@Column
(
name
=
"enable"
)
private
boolean
enable
;
private
boolean
enable
;
@Column
(
name
=
"create_at"
)
@Column
(
name
=
"create
d
_at"
)
private
Timestamp
createAt
;
private
Timestamp
createAt
;
@Column
(
name
=
"update_at"
)
@Column
(
name
=
"update
d
_at"
)
private
Timestamp
updateAt
;
private
Timestamp
updateAt
;
}
}
src/main/java/cn/quantgroup/xyqb/filter/RequestFilter.java
View file @
f9413568
...
@@ -32,7 +32,7 @@ public class RequestFilter implements Filter {
...
@@ -32,7 +32,7 @@ public class RequestFilter implements Filter {
private
static
final
String
[]
ALLOWED_PATTERNS
=
{
private
static
final
String
[]
ALLOWED_PATTERNS
=
{
"/innerapi/**"
,
"/user/exist"
,
"/user/register"
,
"/user/login"
,
"/user/register/fast"
,
"/innerapi/**"
,
"/user/exist"
,
"/user/register"
,
"/user/login"
,
"/user/register/fast"
,
"/user/login/fast"
,
"/user/reset_password"
,
"/user/exist_check"
,
"/user/login/fast"
,
"/user/reset_password"
,
"/user/exist_check"
,
"/jr58/**"
,
"/app/login"
,
"/config/**"
,
"/api/**"
,
"/user/exists_token"
"/jr58/**"
,
"/app/login"
,
"/config/**"
,
"/api/**"
,
"/user/exists_token"
,
"platform/api/page/return_url"
};
};
private
static
final
String
UNAUTH_RESULT
=
JSONObject
.
toJSONString
(
JsonResult
.
buildErrorStateResult
(
"登录失败"
,
null
));
private
static
final
String
UNAUTH_RESULT
=
JSONObject
.
toJSONString
(
JsonResult
.
buildErrorStateResult
(
"登录失败"
,
null
));
...
...
src/main/java/cn/quantgroup/xyqb/repository/IAddressRepository.java
View file @
f9413568
...
@@ -7,4 +7,5 @@ import org.springframework.data.jpa.repository.JpaRepository;
...
@@ -7,4 +7,5 @@ import org.springframework.data.jpa.repository.JpaRepository;
* Created by 11 on 2016/12/30.
* Created by 11 on 2016/12/30.
*/
*/
public
interface
IAddressRepository
extends
JpaRepository
<
Address
,
Long
>
{
public
interface
IAddressRepository
extends
JpaRepository
<
Address
,
Long
>
{
Address
findByUserId
(
Long
userId
);
}
}
src/main/java/cn/quantgroup/xyqb/repository/IContactRepository.java
View file @
f9413568
...
@@ -3,8 +3,11 @@ package cn.quantgroup.xyqb.repository;
...
@@ -3,8 +3,11 @@ package cn.quantgroup.xyqb.repository;
import
cn.quantgroup.xyqb.entity.Contact
;
import
cn.quantgroup.xyqb.entity.Contact
;
import
org.springframework.data.jpa.repository.JpaRepository
;
import
org.springframework.data.jpa.repository.JpaRepository
;
import
java.util.List
;
/**
/**
* Created by 11 on 2016/12/30.
* Created by 11 on 2016/12/30.
*/
*/
public
interface
IContactRepository
extends
JpaRepository
<
Contact
,
Long
>
{
public
interface
IContactRepository
extends
JpaRepository
<
Contact
,
Long
>
{
List
<
Contact
>
findByUserId
(
Long
userId
);
}
}
src/main/java/cn/quantgroup/xyqb/repository/IUserExtInfo.java
→
src/main/java/cn/quantgroup/xyqb/repository/IUserExtInfo
Repository
.java
View file @
f9413568
...
@@ -6,5 +6,7 @@ import org.springframework.data.jpa.repository.JpaRepository;
...
@@ -6,5 +6,7 @@ import org.springframework.data.jpa.repository.JpaRepository;
/**
/**
* Created by 11 on 2016/12/30.
* Created by 11 on 2016/12/30.
*/
*/
public
interface
IUserExtInfo
extends
JpaRepository
<
UserExtInfo
,
Long
>
{
public
interface
IUserExtInfoRepository
extends
JpaRepository
<
UserExtInfo
,
Long
>
{
UserExtInfo
findByUserId
(
Long
userId
);
}
}
src/main/java/cn/quantgroup/xyqb/service/merchant/IMerchantService.java
0 → 100644
View file @
f9413568
package
cn
.
quantgroup
.
xyqb
.
service
.
merchant
;
import
cn.quantgroup.xyqb.entity.Merchant
;
import
cn.quantgroup.xyqb.entity.MerchantConfig
;
/**
* Created by Miraculous on 2017/1/3.
*/
public
interface
IMerchantService
{
MerchantConfig
findConfigByMerchantIdAndConfigName
(
Long
merchantId
,
String
configName
);
Merchant
findMerchantById
(
Long
merchantId
);
Merchant
findMerchantByName
(
String
name
);
}
src/main/java/cn/quantgroup/xyqb/service/merchant/impl/MerchantServiceImpl.java
0 → 100644
View file @
f9413568
package
cn
.
quantgroup
.
xyqb
.
service
.
merchant
.
impl
;
import
cn.quantgroup.xyqb.entity.Merchant
;
import
cn.quantgroup.xyqb.entity.MerchantConfig
;
import
cn.quantgroup.xyqb.repository.IMerchantConfigRepository
;
import
cn.quantgroup.xyqb.repository.IMerchantRepository
;
import
cn.quantgroup.xyqb.service.merchant.IMerchantService
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
javax.annotation.PostConstruct
;
import
java.util.List
;
import
java.util.concurrent.ConcurrentHashMap
;
/**
* Created by Miraculous on 2017/1/3.
*/
@Service
public
class
MerchantServiceImpl
implements
IMerchantService
{
private
static
final
ConcurrentHashMap
<
String
,
Merchant
>
MERCHANT_NAME_MAP
=
new
ConcurrentHashMap
<>();
private
static
final
ConcurrentHashMap
<
Long
,
Merchant
>
MERCHANT_ID_MAP
=
new
ConcurrentHashMap
<>();
private
static
final
ConcurrentHashMap
<
String
,
MerchantConfig
>
MERCHANT_ID_CONFIG_MAP
=
new
ConcurrentHashMap
<>();
@Autowired
private
IMerchantRepository
merchantRepository
;
@Autowired
private
IMerchantConfigRepository
merchantConfigRepository
;
@PostConstruct
private
void
init
()
{
List
<
Merchant
>
merchantList
=
merchantRepository
.
findAll
();
List
<
MerchantConfig
>
merchantConfigList
=
merchantConfigRepository
.
findAll
();
merchantList
.
forEach
(
m
->
{
MERCHANT_NAME_MAP
.
put
(
m
.
getName
(),
m
);
MERCHANT_ID_MAP
.
put
(
m
.
getId
(),
m
);
});
merchantConfigList
.
forEach
(
m
->
MERCHANT_ID_CONFIG_MAP
.
put
(
m
.
getMerchantId
()
+
"_"
+
m
.
getConfigName
(),
m
));
}
@Override
public
MerchantConfig
findConfigByMerchantIdAndConfigName
(
Long
merchantId
,
String
configName
)
{
String
key
=
merchantId
+
"_"
+
configName
;
return
MERCHANT_ID_CONFIG_MAP
.
containsKey
(
key
)
?
MERCHANT_ID_CONFIG_MAP
.
get
(
key
)
:
null
;
}
@Override
public
Merchant
findMerchantById
(
Long
merchantId
)
{
return
MERCHANT_ID_MAP
.
containsKey
(
merchantId
)
?
MERCHANT_ID_MAP
.
get
(
merchantId
)
:
null
;
}
@Override
public
Merchant
findMerchantByName
(
String
name
)
{
return
MERCHANT_NAME_MAP
.
containsKey
(
name
)
?
MERCHANT_NAME_MAP
.
get
(
name
)
:
null
;
}
}
src/main/java/cn/quantgroup/xyqb/service/page/IPageService.java
0 → 100644
View file @
f9413568
package
cn
.
quantgroup
.
xyqb
.
service
.
page
;
import
cn.quantgroup.xyqb.entity.User
;
import
cn.quantgroup.xyqb.model.Tuple
;
/**
* Created by Miraculous on 2017/1/3.
*/
public
interface
IPageService
{
Tuple
<
String
,
Boolean
>
nextPage
(
User
user
,
String
target
,
String
currentPage
);
}
src/main/java/cn/quantgroup/xyqb/service/page/bean/PageType.java
0 → 100644
View file @
f9413568
package
cn
.
quantgroup
.
xyqb
.
service
.
page
.
bean
;
import
cn.quantgroup.xyqb.entity.User
;
import
cn.quantgroup.xyqb.model.Tuple
;
/**
* Created by Miraculous on 2017/1/3.
*/
public
abstract
class
PageType
{
protected
String
name
;
protected
Boolean
needShow
;
public
PageType
(
String
name
,
Boolean
needShow
)
{
this
.
name
=
name
;
this
.
needShow
=
needShow
;
}
public
abstract
boolean
canPass
(
User
user
);
public
String
getName
()
{
return
name
;
}
public
void
setName
(
String
name
)
{
this
.
name
=
name
;
}
public
Boolean
getNeedShow
()
{
return
needShow
;
}
public
void
setNeedShow
(
Boolean
needShow
)
{
this
.
needShow
=
needShow
;
}
}
src/main/java/cn/quantgroup/xyqb/service/page/impl/PageServiceImpl.java
0 → 100644
View file @
f9413568
package
cn
.
quantgroup
.
xyqb
.
service
.
page
.
impl
;
import
cn.quantgroup.xyqb.entity.*
;
import
cn.quantgroup.xyqb.model.Tuple
;
import
cn.quantgroup.xyqb.repository.IUserExtInfoRepository
;
import
cn.quantgroup.xyqb.service.page.IPageService
;
import
cn.quantgroup.xyqb.service.page.bean.PageType
;
import
cn.quantgroup.xyqb.service.user.IAddressService
;
import
cn.quantgroup.xyqb.service.user.IContactService
;
import
cn.quantgroup.xyqb.service.user.IUserDetailService
;
import
cn.quantgroup.xyqb.service.user.IUserExtInfoService
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
javax.annotation.PostConstruct
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
/**
* Created by Miraculous on 2017/1/3.
*/
@Service
public
class
PageServiceImpl
implements
IPageService
{
private
Map
<
String
,
PageType
[]>
routerDefinetion
;
private
PageType
pageIdNo
=
new
PageType
(
"name"
,
false
)
{
@Override
public
boolean
canPass
(
User
user
)
{
UserDetail
userDetail
=
userDetailService
.
findByUserId
(
user
.
getId
());
return
userDetail
!=
null
;
}
};
private
PageType
pageUserFinance
=
new
PageType
(
"info"
,
false
)
{
@Override
public
boolean
canPass
(
User
user
)
{
UserExtInfo
extInfo
=
userExtInfoService
.
findByUserId
(
user
.
getId
());
return
null
!=
extInfo
;
}
};
private
PageType
pageAddress
=
new
PageType
(
"address"
,
false
)
{
@Override
public
boolean
canPass
(
User
user
)
{
Address
address
=
addressService
.
findByUserId
(
user
.
getId
());
return
null
!=
address
;
}
};
private
PageType
pageContacts
=
new
PageType
(
"contacts"
,
false
)
{
@Override
public
boolean
canPass
(
User
user
)
{
List
<
Contact
>
contacts
=
contactService
.
findByUserId
(
user
.
getId
());
return
contacts
!=
null
&&
contacts
.
size
()
!=
0
;
}
};
@Autowired
private
IUserDetailService
userDetailService
;
@Autowired
private
IUserExtInfoService
userExtInfoService
;
@Autowired
private
IAddressService
addressService
;
@Autowired
private
IContactService
contactService
;
@PostConstruct
private
void
init
()
{
routerDefinetion
=
new
HashMap
<>();
routerDefinetion
.
put
(
"cashTarget1"
,
new
PageType
[]
{
pageIdNo
,
pageUserFinance
});
routerDefinetion
.
put
(
"cashTarget2"
,
new
PageType
[]
{
pageIdNo
,
pageAddress
});
routerDefinetion
.
put
(
"cashTarget3"
,
new
PageType
[]
{
pageIdNo
,
pageContacts
});
routerDefinetion
.
put
(
"cashTarget4"
,
new
PageType
[]
{
pageIdNo
});
}
@Override
public
Tuple
<
String
,
Boolean
>
nextPage
(
User
user
,
String
target
,
String
currentPage
)
{
if
(
user
==
null
)
{
return
new
Tuple
<>(
""
,
false
);
}
PageType
[]
processLists
=
routerDefinetion
.
containsKey
(
target
)
?
routerDefinetion
.
get
(
target
):
null
;
if
(
processLists
==
null
)
{
return
new
Tuple
<>(
""
,
false
);
}
boolean
isBeforeCurrentPage
=
true
;
for
(
PageType
page
:
processLists
)
{
if
(!
page
.
canPass
(
user
))
{
return
new
Tuple
<>(
page
.
getName
(),
false
);
}
if
(!
isBeforeCurrentPage
&&
page
.
getNeedShow
())
{
return
new
Tuple
<>(
page
.
getName
(),
false
);
}
if
(
page
.
getName
().
equals
(
currentPage
))
{
isBeforeCurrentPage
=
false
;
}
}
return
new
Tuple
<>(
""
,
true
);
}
}
src/main/java/cn/quantgroup/xyqb/service/user/IAddressService.java
0 → 100644
View file @
f9413568
package
cn
.
quantgroup
.
xyqb
.
service
.
user
;
import
cn.quantgroup.xyqb.entity.Address
;
/**
* Created by Miraculous on 2017/1/3.
*/
public
interface
IAddressService
{
Address
findByUserId
(
Long
userId
);
}
src/main/java/cn/quantgroup/xyqb/service/user/IContactService.java
0 → 100644
View file @
f9413568
package
cn
.
quantgroup
.
xyqb
.
service
.
user
;
import
cn.quantgroup.xyqb.entity.Contact
;
import
java.util.List
;
/**
* Created by Miraculous on 2017/1/3.
*/
public
interface
IContactService
{
List
<
Contact
>
findByUserId
(
Long
userId
);
}
src/main/java/cn/quantgroup/xyqb/service/user/IUserExtInfoService.java
0 → 100644
View file @
f9413568
package
cn
.
quantgroup
.
xyqb
.
service
.
user
;
import
cn.quantgroup.xyqb.entity.UserExtInfo
;
/**
* Created by Miraculous on 2017/1/3.
*/
public
interface
IUserExtInfoService
{
UserExtInfo
findByUserId
(
Long
userId
);
}
src/main/java/cn/quantgroup/xyqb/service/user/impl/AddressServiceImpl.java
0 → 100644
View file @
f9413568
package
cn
.
quantgroup
.
xyqb
.
service
.
user
.
impl
;
import
cn.quantgroup.xyqb.entity.Address
;
import
cn.quantgroup.xyqb.entity.UserExtInfo
;
import
cn.quantgroup.xyqb.repository.IAddressRepository
;
import
cn.quantgroup.xyqb.repository.IUserExtInfoRepository
;
import
cn.quantgroup.xyqb.service.user.IAddressService
;
import
cn.quantgroup.xyqb.service.user.IUserExtInfoService
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.cache.annotation.Cacheable
;
import
org.springframework.stereotype.Service
;
/**
* Created by Miraculous on 2017/1/3.
*/
@Service
public
class
AddressServiceImpl
implements
IAddressService
{
@Autowired
private
IAddressRepository
addressRepository
;
@Override
@Cacheable
(
value
=
"addresscache"
,
key
=
"'address' + #userId"
,
unless
=
"#result == null"
,
cacheManager
=
"cacheManager"
)
public
Address
findByUserId
(
Long
userId
)
{
return
addressRepository
.
findByUserId
(
userId
);
}
}
src/main/java/cn/quantgroup/xyqb/service/user/impl/ContactServiceImpl.java
0 → 100644
View file @
f9413568
package
cn
.
quantgroup
.
xyqb
.
service
.
user
.
impl
;
import
cn.quantgroup.xyqb.entity.Contact
;
import
cn.quantgroup.xyqb.repository.IContactRepository
;
import
cn.quantgroup.xyqb.service.user.IContactService
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.cache.annotation.Cacheable
;
import
org.springframework.stereotype.Service
;
import
java.util.List
;
/**
* Created by Miraculous on 2017/1/3.
*/
@Service
public
class
ContactServiceImpl
implements
IContactService
{
@Autowired
private
IContactRepository
contactRepository
;
@Override
@Cacheable
(
value
=
"contact"
,
key
=
"'contact' + #userId"
,
unless
=
"#result == null or #result.size() == 0"
,
cacheManager
=
"cacheManager"
)
public
List
<
Contact
>
findByUserId
(
Long
userId
)
{
return
contactRepository
.
findByUserId
(
userId
);
}
}
src/main/java/cn/quantgroup/xyqb/service/user/impl/UserExtInfoServiceImpl.java
0 → 100644
View file @
f9413568
package
cn
.
quantgroup
.
xyqb
.
service
.
user
.
impl
;
import
cn.quantgroup.xyqb.entity.UserExtInfo
;
import
cn.quantgroup.xyqb.repository.IUserExtInfoRepository
;
import
cn.quantgroup.xyqb.service.user.IUserExtInfoService
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.cache.annotation.Cacheable
;
import
org.springframework.stereotype.Service
;
/**
* Created by Miraculous on 2017/1/3.
*/
@Service
public
class
UserExtInfoServiceImpl
implements
IUserExtInfoService
{
@Autowired
private
IUserExtInfoRepository
userExtInfoRepository
;
@Override
@Cacheable
(
value
=
"userextinfocache"
,
key
=
"'extinfo' + #userId"
,
unless
=
"#result == null"
,
cacheManager
=
"cacheManager"
)
public
UserExtInfo
findByUserId
(
Long
userId
)
{
return
userExtInfoRepository
.
findByUserId
(
userId
);
}
}
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