Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
cash-loan-flow-boss
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
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
QG
cash-loan-flow-boss
Commits
7917df49
Commit
7917df49
authored
Aug 06, 2019
by
suntao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
渠道配置 查询 做切面处理
parent
e5fda3e4
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
124 additions
and
9 deletions
+124
-9
ChannelConfController.java
...lowboss/api/channel/controller/ChannelConfController.java
+6
-6
ChannelListModel.java
.../cashloanflowboss/api/channel/model/ChannelListModel.java
+22
-0
ChannelConfService.java
...hloanflowboss/api/channel/service/ChannelConfService.java
+14
-3
RoleDataLoad.java
...tgroup/cashloanflowboss/core/annotation/RoleDataLoad.java
+18
-0
RoleDataLoadAspect.java
...roup/cashloanflowboss/core/aspect/RoleDataLoadAspect.java
+59
-0
Result.java
...java/cn/quantgroup/cashloanflowboss/core/base/Result.java
+5
-0
No files found.
src/main/java/cn/quantgroup/cashloanflowboss/api/channel/controller/ChannelConfController.java
View file @
7917df49
package
cn
.
quantgroup
.
cashloanflowboss
.
api
.
channel
.
controller
;
import
cn.quantgroup.cashloanflowboss.api.channel.model.ChannelListModel
;
import
cn.quantgroup.cashloanflowboss.core.annotation.RoleDataLoad
;
import
cn.quantgroup.cashloanflowboss.spi.clf.entity.ChannelConfiguration
;
import
cn.quantgroup.cashloanflowboss.api.channel.service.ChannelConfService
;
import
cn.quantgroup.cashloanflowboss.api.user.model.Pagination
;
import
cn.quantgroup.cashloanflowboss.core.base.Result
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.data.domain.Page
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestParam
;
import
org.springframework.web.bind.annotation.RestController
;
import
org.springframework.web.bind.annotation.*
;
import
javax.validation.Valid
;
...
...
@@ -26,8 +25,9 @@ public class ChannelConfController {
private
ChannelConfService
channelConfService
;
@GetMapping
(
"/info"
)
public
Page
<
ChannelConfiguration
>
channelInfo
(
Integer
pageNumber
,
Integer
pageSize
,
Integer
channelId
)
{
@RoleDataLoad
@PostMapping
(
"/info"
)
public
Page
<
ChannelListModel
>
channelInfo
(
Integer
channelId
,
Integer
pageNumber
,
Integer
pageSize
)
{
return
channelConfService
.
getChannelInfo
(
pageNumber
,
pageSize
,
channelId
);
}
...
...
src/main/java/cn/quantgroup/cashloanflowboss/api/channel/model/ChannelListModel.java
0 → 100644
View file @
7917df49
package
cn
.
quantgroup
.
cashloanflowboss
.
api
.
channel
.
model
;
import
lombok.Data
;
import
java.util.Date
;
/**
* function:
* date: 2019/8/6
*
* @author: suntao
*/
@Data
public
class
ChannelListModel
{
private
Long
channelId
;
private
String
channelName
;
private
String
channelCode
;
private
Integer
bizType
;
private
Date
createdAt
;
}
src/main/java/cn/quantgroup/cashloanflowboss/api/channel/service/ChannelConfService.java
View file @
7917df49
package
cn
.
quantgroup
.
cashloanflowboss
.
api
.
channel
.
service
;
import
java.util.Date
;
import
cn.quantgroup.cashloanflowboss.api.channel.entity.boss.ChannelConf
;
import
cn.quantgroup.cashloanflowboss.api.channel.model.ChannelListModel
;
import
cn.quantgroup.cashloanflowboss.spi.clf.entity.ChannelConfiguration
;
import
cn.quantgroup.cashloanflowboss.api.channel.repository.boss.ChannelConfRepository
;
import
cn.quantgroup.cashloanflowboss.spi.clf.repository.ChannelConfigurationRepository
;
...
...
@@ -35,7 +37,7 @@ public class ChannelConfService {
public
Page
<
Channel
Configuration
>
getChannelInfo
(
Integer
pageNumber
,
Integer
pageSize
,
Integer
channelId
)
{
public
Page
<
Channel
ListModel
>
getChannelInfo
(
Integer
pageNumber
,
Integer
pageSize
,
Integer
channelId
)
{
Page
<
ChannelConfiguration
>
page
=
this
.
clfChannelConfigurationRepository
.
findAll
((
root
,
criteriaQuery
,
criteriaBuilder
)
->
{
...
...
@@ -53,8 +55,17 @@ public class ChannelConfService {
},
new
PageRequest
(
pageNumber
,
pageSize
));
return
page
;
Page
<
ChannelListModel
>
channelListModelPage
=
page
.
map
(
it
->
{
ChannelListModel
channelListModel
=
new
ChannelListModel
();
channelListModel
.
setChannelId
(
it
.
getRegisteredFrom
());
channelListModel
.
setChannelName
(
it
.
getChannelName
());
channelListModel
.
setChannelCode
(
it
.
getChannelCode
());
channelListModel
.
setBizType
(
1
);
channelListModel
.
setCreatedAt
(
it
.
getCreatedAt
());
return
channelListModel
;
});
return
channelListModelPage
;
}
...
...
src/main/java/cn/quantgroup/cashloanflowboss/core/annotation/RoleDataLoad.java
0 → 100644
View file @
7917df49
package
cn
.
quantgroup
.
cashloanflowboss
.
core
.
annotation
;
import
java.lang.annotation.Retention
;
import
java.lang.annotation.Target
;
import
static
java
.
lang
.
annotation
.
ElementType
.
METHOD
;
import
static
java
.
lang
.
annotation
.
RetentionPolicy
.
RUNTIME
;
/**
* function:
* date: 2019/8/6
*
* @author: suntao
*/
@Target
({
METHOD
})
@Retention
(
RUNTIME
)
public
@interface
RoleDataLoad
{
}
src/main/java/cn/quantgroup/cashloanflowboss/core/aspect/RoleDataLoadAspect.java
0 → 100644
View file @
7917df49
package
cn
.
quantgroup
.
cashloanflowboss
.
core
.
aspect
;
import
cn.quantgroup.cashloanflowboss.api.user.model.UserSessionInfo
;
import
cn.quantgroup.cashloanflowboss.api.user.service.UserSessionService
;
import
cn.quantgroup.cashloanflowboss.core.annotation.RoleDataLoad
;
import
cn.quantgroup.cashloanflowboss.core.base.Result
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.lang3.exception.ExceptionUtils
;
import
org.aspectj.lang.ProceedingJoinPoint
;
import
org.aspectj.lang.annotation.Around
;
import
org.aspectj.lang.annotation.Aspect
;
import
org.aspectj.lang.annotation.Pointcut
;
import
org.aspectj.lang.reflect.MethodSignature
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.core.Ordered
;
import
org.springframework.core.annotation.Order
;
import
org.springframework.stereotype.Component
;
import
java.lang.reflect.Method
;
/**
* function:
* date: 2019/8/6
*
* @author: suntao
*/
@Slf4j
@Component
@Aspect
@Order
(
Ordered
.
HIGHEST_PRECEDENCE
)
public
class
RoleDataLoadAspect
{
@Autowired
private
UserSessionService
userSessionService
;
@Pointcut
(
"execution(* cn.quantgroup.cashloanflowboss.api.channel.controller.*.*(..))"
)
private
void
channelRoleInit
()
{}
@Around
(
value
=
"channelRoleInit()"
)
public
Object
around
(
ProceedingJoinPoint
pjp
)
{
Object
[]
args
=
pjp
.
getArgs
();
MethodSignature
methodSignature
=
(
MethodSignature
)
pjp
.
getSignature
();
Method
method
=
methodSignature
.
getMethod
();
RoleDataLoad
annotation
=
method
.
getAnnotation
(
RoleDataLoad
.
class
);
UserSessionInfo
userSessionInfo
=
userSessionService
.
findUserSessionInfo
();
if
(
annotation
!=
null
&&
"channel_role"
.
equals
(
userSessionInfo
.
getRoleInfo
().
getRoleName
()))
{
System
.
out
.
println
(
userSessionInfo
.
getChannelId
());
}
try
{
return
pjp
.
proceed
(
args
);
}
catch
(
Throwable
throwable
)
{
return
Result
.
buildFial
(
ExceptionUtils
.
getMessage
(
throwable
));
}
}
}
src/main/java/cn/quantgroup/cashloanflowboss/core/base/Result.java
View file @
7917df49
...
...
@@ -68,6 +68,11 @@ public class Result<T> {
return
new
Result
(
ApplicationStatus
.
FAILURE
,
data
);
}
@SuppressWarnings
(
"unchecked"
)
public
static
<
T
>
Result
buildFial
(
String
message
)
{
return
new
Result
(
ApplicationStatus
.
FAILURE
,
null
,
message
);
}
@SuppressWarnings
(
"unchecked"
)
public
static
<
T
>
Result
buildFial
(
T
data
,
String
message
)
{
return
new
Result
(
ApplicationStatus
.
FAILURE
,
data
,
message
);
...
...
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