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
ad377da2
Commit
ad377da2
authored
May 26, 2020
by
王向伟
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
添加路由策略
parent
ec93d31f
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
83 additions
and
7 deletions
+83
-7
OrderController.java
...ashloanflowboss/api/order/controller/OrderController.java
+18
-7
ServiceRoute.java
...tgroup/cashloanflowboss/component/route/ServiceRoute.java
+65
-0
No files found.
src/main/java/cn/quantgroup/cashloanflowboss/api/order/controller/OrderController.java
View file @
ad377da2
...
@@ -3,6 +3,7 @@ package cn.quantgroup.cashloanflowboss.api.order.controller;
...
@@ -3,6 +3,7 @@ package cn.quantgroup.cashloanflowboss.api.order.controller;
import
cn.quantgroup.cashloanflowboss.api.order.model.ApproveVo
;
import
cn.quantgroup.cashloanflowboss.api.order.model.ApproveVo
;
import
cn.quantgroup.cashloanflowboss.api.order.model.LendingFormModel
;
import
cn.quantgroup.cashloanflowboss.api.order.model.LendingFormModel
;
import
cn.quantgroup.cashloanflowboss.api.order.service.OrderService
;
import
cn.quantgroup.cashloanflowboss.api.order.service.OrderService
;
import
cn.quantgroup.cashloanflowboss.component.route.ServiceRoute
;
import
cn.quantgroup.cashloanflowboss.component.security.annotiation.Security
;
import
cn.quantgroup.cashloanflowboss.component.security.annotiation.Security
;
import
cn.quantgroup.cashloanflowboss.core.Application
;
import
cn.quantgroup.cashloanflowboss.core.Application
;
import
cn.quantgroup.cashloanflowboss.core.annotation.channelrole.ChannelIdInit
;
import
cn.quantgroup.cashloanflowboss.core.annotation.channelrole.ChannelIdInit
;
...
@@ -32,8 +33,7 @@ public class OrderController {
...
@@ -32,8 +33,7 @@ public class OrderController {
@Autowired
@Autowired
@Qualifier
(
"moOrderServiceImpl"
)
private
ServiceRoute
serviceRoute
;
private
OrderService
orderService
;
/**
/**
...
@@ -54,6 +54,7 @@ public class OrderController {
...
@@ -54,6 +54,7 @@ public class OrderController {
if
(
pageNumber
==
null
||
pageSize
==
null
)
{
if
(
pageNumber
==
null
||
pageSize
==
null
)
{
return
Result
.
buildFail
(
"page信息不对"
);
return
Result
.
buildFail
(
"page信息不对"
);
}
}
OrderService
orderService
=
serviceRoute
.
routeOrderService
(
channelId
,
channelOrderNumber
,
loanId
);
return
Result
.
buildSuccess
(
orderService
.
orderList
(
channelId
,
channelOrderNumber
,
applyNo
,
loanId
,
pageNumber
,
pageSize
));
return
Result
.
buildSuccess
(
orderService
.
orderList
(
channelId
,
channelOrderNumber
,
applyNo
,
loanId
,
pageNumber
,
pageSize
));
}
}
...
@@ -71,6 +72,7 @@ public class OrderController {
...
@@ -71,6 +72,7 @@ public class OrderController {
@PostMapping
(
"/approve"
)
@PostMapping
(
"/approve"
)
public
Result
approveOpt
(
@RequestBody
@Valid
ApproveVo
approveVo
)
{
public
Result
approveOpt
(
@RequestBody
@Valid
ApproveVo
approveVo
)
{
if
(
Application
.
isDebug
())
{
if
(
Application
.
isDebug
())
{
OrderService
orderService
=
serviceRoute
.
routeOrderService
(
null
,
approveVo
.
getChannelOrderNumber
(),
null
);
final
Tuple
<
Boolean
,
String
>
approveOptTuple
=
orderService
.
approveOpt
(
approveVo
);
final
Tuple
<
Boolean
,
String
>
approveOptTuple
=
orderService
.
approveOpt
(
approveVo
);
return
Result
.
buildSuccess
(
approveOptTuple
.
getKey
(),
approveOptTuple
.
getValue
());
return
Result
.
buildSuccess
(
approveOptTuple
.
getKey
(),
approveOptTuple
.
getValue
());
}
else
{
}
else
{
...
@@ -88,7 +90,8 @@ public class OrderController {
...
@@ -88,7 +90,8 @@ public class OrderController {
@PostMapping
(
"/lending"
)
@PostMapping
(
"/lending"
)
public
Result
<
Boolean
>
lending
(
@RequestBody
@Valid
LendingFormModel
lendingFormModel
)
{
public
Result
<
Boolean
>
lending
(
@RequestBody
@Valid
LendingFormModel
lendingFormModel
)
{
if
(
Application
.
isDebug
())
{
if
(
Application
.
isDebug
())
{
final
Tuple
<
Boolean
,
String
>
lending
=
this
.
orderService
.
lending
(
lendingFormModel
);
OrderService
orderService
=
serviceRoute
.
routeOrderService
(
lendingFormModel
.
getChannelId
(),
lendingFormModel
.
getChannelOrderNumber
(),
null
);
final
Tuple
<
Boolean
,
String
>
lending
=
orderService
.
lending
(
lendingFormModel
);
return
Result
.
buildSuccess
(
lending
.
getKey
(),
lending
.
getValue
());
return
Result
.
buildSuccess
(
lending
.
getKey
(),
lending
.
getValue
());
}
else
{
}
else
{
return
Result
.
buildSuccess
(
false
,
"无此操作"
);
return
Result
.
buildSuccess
(
false
,
"无此操作"
);
...
@@ -105,7 +108,8 @@ public class OrderController {
...
@@ -105,7 +108,8 @@ public class OrderController {
@GetMapping
(
"/secondAudit"
)
@GetMapping
(
"/secondAudit"
)
public
Result
<
Boolean
>
secondAudit
(
String
channelOrderNumber
)
{
public
Result
<
Boolean
>
secondAudit
(
String
channelOrderNumber
)
{
if
(
Application
.
isDebug
())
{
if
(
Application
.
isDebug
())
{
final
Tuple
<
Boolean
,
String
>
booleanStringTuple
=
this
.
orderService
.
secondAudit
(
channelOrderNumber
);
OrderService
orderService
=
serviceRoute
.
routeOrderService
(
null
,
channelOrderNumber
,
null
);
final
Tuple
<
Boolean
,
String
>
booleanStringTuple
=
orderService
.
secondAudit
(
channelOrderNumber
);
return
Result
.
buildSuccess
(
booleanStringTuple
.
getKey
(),
booleanStringTuple
.
getValue
());
return
Result
.
buildSuccess
(
booleanStringTuple
.
getKey
(),
booleanStringTuple
.
getValue
());
}
else
{
}
else
{
return
Result
.
buildSuccess
(
false
,
"无此操作"
);
return
Result
.
buildSuccess
(
false
,
"无此操作"
);
...
@@ -122,7 +126,8 @@ public class OrderController {
...
@@ -122,7 +126,8 @@ public class OrderController {
@GetMapping
(
"/loadSecondAuditJob"
)
@GetMapping
(
"/loadSecondAuditJob"
)
public
Result
<
Boolean
>
loadSecondAuditJob
()
{
public
Result
<
Boolean
>
loadSecondAuditJob
()
{
if
(
Application
.
isDebug
())
{
if
(
Application
.
isDebug
())
{
this
.
orderService
.
loadSecondAuditJob
();
OrderService
orderService
=
serviceRoute
.
routeOrderService
(
null
,
null
,
null
);
orderService
.
loadSecondAuditJob
();
return
Result
.
buildSuccess
(
true
,
"success"
);
return
Result
.
buildSuccess
(
true
,
"success"
);
}
else
{
}
else
{
return
Result
.
buildSuccess
(
false
,
"无此操作"
);
return
Result
.
buildSuccess
(
false
,
"无此操作"
);
...
@@ -140,7 +145,8 @@ public class OrderController {
...
@@ -140,7 +145,8 @@ public class OrderController {
@PostMapping
(
"/cancel/loan"
)
@PostMapping
(
"/cancel/loan"
)
public
Result
<
Boolean
>
cancelPreLoan
(
@RequestParam
@Valid
String
channelOrderNumber
)
{
public
Result
<
Boolean
>
cancelPreLoan
(
@RequestParam
@Valid
String
channelOrderNumber
)
{
if
(
Application
.
isDebug
())
{
if
(
Application
.
isDebug
())
{
final
Tuple
<
Boolean
,
String
>
preLoan
=
this
.
orderService
.
cancelPreLoan
(
channelOrderNumber
);
OrderService
orderService
=
serviceRoute
.
routeOrderService
(
null
,
channelOrderNumber
,
null
);
final
Tuple
<
Boolean
,
String
>
preLoan
=
orderService
.
cancelPreLoan
(
channelOrderNumber
);
return
Result
.
buildSuccess
(
preLoan
.
getKey
(),
preLoan
.
getValue
());
return
Result
.
buildSuccess
(
preLoan
.
getKey
(),
preLoan
.
getValue
());
}
else
{
}
else
{
return
Result
.
buildSuccess
(
false
,
"无此操作"
);
return
Result
.
buildSuccess
(
false
,
"无此操作"
);
...
@@ -157,7 +163,8 @@ public class OrderController {
...
@@ -157,7 +163,8 @@ public class OrderController {
@PostMapping
(
"/cancel/after/loan"
)
@PostMapping
(
"/cancel/after/loan"
)
public
Result
<
Boolean
>
cancelAfterLoan
(
@RequestParam
@Valid
String
channelOrderNumber
)
{
public
Result
<
Boolean
>
cancelAfterLoan
(
@RequestParam
@Valid
String
channelOrderNumber
)
{
if
(
Application
.
isDebug
())
{
if
(
Application
.
isDebug
())
{
final
Tuple
<
Boolean
,
String
>
afterLoan
=
this
.
orderService
.
cancelAfterLoan
(
channelOrderNumber
);
OrderService
orderService
=
serviceRoute
.
routeOrderService
(
null
,
channelOrderNumber
,
null
);
final
Tuple
<
Boolean
,
String
>
afterLoan
=
orderService
.
cancelAfterLoan
(
channelOrderNumber
);
return
Result
.
buildSuccess
(
afterLoan
.
getKey
(),
afterLoan
.
getValue
());
return
Result
.
buildSuccess
(
afterLoan
.
getKey
(),
afterLoan
.
getValue
());
}
else
{
}
else
{
return
Result
.
buildSuccess
(
false
,
"无此操作"
);
return
Result
.
buildSuccess
(
false
,
"无此操作"
);
...
@@ -174,6 +181,7 @@ public class OrderController {
...
@@ -174,6 +181,7 @@ public class OrderController {
@CheckChannelRole
(
channelOrderNumberSPEL
=
"#this[0]"
)
@CheckChannelRole
(
channelOrderNumberSPEL
=
"#this[0]"
)
@GetMapping
(
"/history/status"
)
@GetMapping
(
"/history/status"
)
public
Result
getOrderHistoryStatus
(
String
channelOrderNumber
)
{
public
Result
getOrderHistoryStatus
(
String
channelOrderNumber
)
{
OrderService
orderService
=
serviceRoute
.
routeOrderService
(
null
,
channelOrderNumber
,
null
);
return
Result
.
buildSuccess
(
orderService
.
getOrderHistoryStatus
(
channelOrderNumber
));
return
Result
.
buildSuccess
(
orderService
.
getOrderHistoryStatus
(
channelOrderNumber
));
}
}
...
@@ -187,6 +195,7 @@ public class OrderController {
...
@@ -187,6 +195,7 @@ public class OrderController {
@CheckChannelRole
(
channelOrderNumberSPEL
=
"#this[0]"
)
@CheckChannelRole
(
channelOrderNumberSPEL
=
"#this[0]"
)
@GetMapping
(
"/orderCallbackRecordList"
)
@GetMapping
(
"/orderCallbackRecordList"
)
public
Result
orderCallbackRecordList
(
String
channelOrderNumber
)
{
public
Result
orderCallbackRecordList
(
String
channelOrderNumber
)
{
OrderService
orderService
=
serviceRoute
.
routeOrderService
(
null
,
channelOrderNumber
,
null
);
return
Result
.
buildSuccess
(
orderService
.
getOrderCallbackRecordList
(
channelOrderNumber
));
return
Result
.
buildSuccess
(
orderService
.
getOrderCallbackRecordList
(
channelOrderNumber
));
}
}
...
@@ -205,6 +214,7 @@ public class OrderController {
...
@@ -205,6 +214,7 @@ public class OrderController {
log
.
error
(
"还款计划查询 channelOrderNumber 和 loanId 不能同时为空 "
);
log
.
error
(
"还款计划查询 channelOrderNumber 和 loanId 不能同时为空 "
);
return
Result
.
buildFail
(
"channelOrderNumber 和 loanId 不能同时为空"
);
return
Result
.
buildFail
(
"channelOrderNumber 和 loanId 不能同时为空"
);
}
}
OrderService
orderService
=
serviceRoute
.
routeOrderService
(
null
,
channelOrderNumber
,
loanId
);
return
Result
.
buildSuccess
(
orderService
.
findRepaymentPlan
(
channelOrderNumber
,
loanId
));
return
Result
.
buildSuccess
(
orderService
.
findRepaymentPlan
(
channelOrderNumber
,
loanId
));
}
}
...
@@ -219,6 +229,7 @@ public class OrderController {
...
@@ -219,6 +229,7 @@ public class OrderController {
@CheckChannelRole
(
channelOrderNumberSPEL
=
"#this[0]"
)
@CheckChannelRole
(
channelOrderNumberSPEL
=
"#this[0]"
)
@GetMapping
(
"/settle"
)
@GetMapping
(
"/settle"
)
public
Result
settle
(
String
channelOrderNumber
)
{
public
Result
settle
(
String
channelOrderNumber
)
{
OrderService
orderService
=
serviceRoute
.
routeOrderService
(
null
,
channelOrderNumber
,
null
);
final
Tuple
<
Boolean
,
String
>
settle
=
orderService
.
settle
(
channelOrderNumber
);
final
Tuple
<
Boolean
,
String
>
settle
=
orderService
.
settle
(
channelOrderNumber
);
return
Result
.
buildSuccess
(
settle
.
getKey
(),
settle
.
getValue
());
return
Result
.
buildSuccess
(
settle
.
getKey
(),
settle
.
getValue
());
}
}
...
...
src/main/java/cn/quantgroup/cashloanflowboss/component/route/ServiceRoute.java
0 → 100644
View file @
ad377da2
package
cn
.
quantgroup
.
cashloanflowboss
.
component
.
route
;
import
cn.quantgroup.cashloanflowboss.api.order.service.MoOrderServiceImpl
;
import
cn.quantgroup.cashloanflowboss.api.order.service.OrderService
;
import
cn.quantgroup.cashloanflowboss.api.order.service.OrderServiceImpl
;
import
cn.quantgroup.cashloanflowboss.core.Application
;
import
cn.quantgroup.cashloanflowboss.spi.clf.entity.ClfOrderMapping
;
import
cn.quantgroup.cashloanflowboss.spi.clf.repository.ClfOrderMappingRepository
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.stereotype.Component
;
import
javax.annotation.PostConstruct
;
import
java.util.Arrays
;
import
java.util.List
;
import
java.util.Objects
;
/**
* 接口实现类路由
*
* @author Wang Xiangwei
* @version 2020/5/26
*/
@Component
public
class
ServiceRoute
{
@Value
(
"${middle.stage.channel}"
)
String
channelStr
;
List
<
String
>
middleStageChannel
;
@PostConstruct
public
void
init
()
{
middleStageChannel
=
Arrays
.
asList
(
channelStr
.
split
(
","
));
}
@Autowired
private
ClfOrderMappingRepository
orderMappingRepository
;
public
OrderService
routeOrderService
(
Long
channelId
,
String
channelOrderNumber
,
Long
loanId
)
{
if
(
channelId
!=
null
&&
middleStageChannel
.
contains
(
channelId
.
toString
()))
{
return
Application
.
getBean
(
MoOrderServiceImpl
.
class
);
}
if
(
StringUtils
.
isNotBlank
(
channelOrderNumber
))
{
ClfOrderMapping
orderMapping
=
orderMappingRepository
.
findByChannelOrderNoLastOne
(
channelOrderNumber
);
if
(
Objects
.
nonNull
(
orderMapping
)
&&
middleStageChannel
.
contains
(
orderMapping
.
getRegisteredFrom
().
toString
()))
{
return
Application
.
getBean
(
MoOrderServiceImpl
.
class
);
}
}
if
(
Objects
.
nonNull
(
loanId
))
{
ClfOrderMapping
orderMapping
=
orderMappingRepository
.
findByLoanId
(
loanId
);
if
(
Objects
.
nonNull
(
orderMapping
)
&&
middleStageChannel
.
contains
(
orderMapping
.
getRegisteredFrom
().
toString
()))
{
return
Application
.
getBean
(
MoOrderServiceImpl
.
class
);
}
}
//默认返回
return
Application
.
getBean
(
OrderServiceImpl
.
class
);
}
}
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