Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
customer-service
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
QG
customer-service
Commits
935a1e78
Commit
935a1e78
authored
Jun 03, 2020
by
xiaozhe.chen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
运营系统替换中台接口
parent
8b390cbc
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
143 additions
and
8 deletions
+143
-8
ISidecarService.java
.../java/cn/quantgroup/customer/service/ISidecarService.java
+26
-0
OrderServiceImpl.java
...cn/quantgroup/customer/service/impl/OrderServiceImpl.java
+6
-1
RepayServiceImpl.java
...cn/quantgroup/customer/service/impl/RepayServiceImpl.java
+11
-7
SidecarServiceImpl.java
.../quantgroup/customer/service/impl/SidecarServiceImpl.java
+100
-0
No files found.
src/main/java/cn/quantgroup/customer/service/ISidecarService.java
0 → 100644
View file @
935a1e78
package
cn
.
quantgroup
.
customer
.
service
;
import
cn.quantgroup.customer.model.order.OrderRepayment
;
import
cn.quantgroup.customer.rest.param.repay.RepayOrderInfoQuery
;
import
cn.quantgroup.customer.rest.vo.JsonResult
;
import
cn.quantgroup.customer.service.http.IHttpService
;
import
cn.quantgroup.customer.util.JSONTools
;
import
com.fasterxml.jackson.core.type.TypeReference
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.stereotype.Service
;
import
java.util.HashMap
;
import
java.util.Map
;
public
interface
ISidecarService
{
JsonResult
<
OrderRepayment
>
repaymentPlanQuery
(
Long
loanId
);
String
queryRepayInfo
(
RepayOrderInfoQuery
repayOrderQuery
);
String
queryRepayOptRecords
(
String
businessFlowNo
);
}
src/main/java/cn/quantgroup/customer/service/impl/OrderServiceImpl.java
View file @
935a1e78
...
...
@@ -41,6 +41,9 @@ public class OrderServiceImpl implements IOrderService {
@Autowired
private
IUserService
userService
;
@Autowired
private
ISidecarService
sidecarService
;
@Override
public
JsonResult
<
List
<
FlowNode
>>
findFlowChart
(
String
applyOrderNo
)
{
...
...
@@ -99,7 +102,9 @@ public class OrderServiceImpl implements IOrderService {
}
//还款计划查询
JsonResult
<
OrderRepayment
>
orderRepaymentJsonResult
=
xyqbService
.
repaymentPlanQuery
(
loanId
);
//JsonResult<OrderRepayment> orderRepaymentJsonResult = xyqbService.repaymentPlanQuery(loanId);
//todo 替换中台接口
JsonResult
<
OrderRepayment
>
orderRepaymentJsonResult
=
sidecarService
.
repaymentPlanQuery
(
loanId
);
if
(!
orderRepaymentJsonResult
.
isSuccess
())
{
log
.
error
(
"{} 还款计划查询失败 result={}"
,
logPre
,
orderRepaymentJsonResult
);
return
JsonResult
.
buildErrorStateResult
(
orderRepaymentJsonResult
.
getMsg
(),
orderRepaymentJsonResult
.
getData
());
...
...
src/main/java/cn/quantgroup/customer/service/impl/RepayServiceImpl.java
View file @
935a1e78
...
...
@@ -3,16 +3,14 @@ package cn.quantgroup.customer.service.impl;
import
cn.quantgroup.customer.constant.Constant
;
import
cn.quantgroup.customer.enums.ErrorCodeEnum
;
import
cn.quantgroup.customer.exception.BusinessException
;
import
cn.quantgroup.customer.model.xyqbuser.UserBasicInfo
;
import
cn.quantgroup.customer.rest.param.ordermapping.OrderQueryParam
;
import
cn.quantgroup.customer.rest.param.repay.RepayOrderInfoQuery
;
import
cn.quantgroup.customer.rest.param.repay.RepayOrderQuery
;
import
cn.quantgroup.customer.rest.param.user.UserCombinationParam
;
import
cn.quantgroup.customer.rest.vo.JsonResult
;
import
cn.quantgroup.customer.rest.vo.repay.RepayInfoResult
;
import
cn.quantgroup.customer.rest.vo.repay.RepayOptRecord
;
import
cn.quantgroup.customer.rest.vo.repay.XyqbRepayInfo
;
import
cn.quantgroup.customer.service.IRepayService
;
import
cn.quantgroup.customer.service.ISidecarService
;
import
cn.quantgroup.customer.service.IUserService
;
import
cn.quantgroup.customer.service.IXyqbService
;
import
cn.quantgroup.user.retbean.XUser
;
...
...
@@ -33,12 +31,14 @@ public class RepayServiceImpl implements IRepayService {
private
final
IUserService
userService
;
private
final
UserSdkImpl
userSdk
;
private
final
IXyqbService
xyqbService
;
private
final
ISidecarService
sidecarService
;
@Autowired
public
RepayServiceImpl
(
IUserService
userService
,
UserSdkImpl
userSdk
,
IXyqbService
xyqbService
)
{
public
RepayServiceImpl
(
IUserService
userService
,
UserSdkImpl
userSdk
,
IXyqbService
xyqbService
,
ISidecarService
sidecarService
)
{
this
.
userService
=
userService
;
this
.
userSdk
=
userSdk
;
this
.
xyqbService
=
xyqbService
;
this
.
sidecarService
=
sidecarService
;
}
@Override
...
...
@@ -93,7 +93,9 @@ public class RepayServiceImpl implements IRepayService {
//处理还款信息
String
repayInfoStr
=
xyqbService
.
queryRepayInfo
(
repayOrderQuery
);
//String repayInfoStr = xyqbService.queryRepayInfo(repayOrderQuery);
//todo 替换中台接口
String
repayInfoStr
=
sidecarService
.
queryRepayInfo
(
repayOrderQuery
);
log
.
info
(
"[查询xyqb返回还款信息],repayInfoStr={}"
,
repayInfoStr
);
if
(
StringUtils
.
isBlank
(
repayInfoStr
))
{
log
.
error
(
"[查询xyqb返回还款信息],返回结果为null"
);
...
...
@@ -129,8 +131,10 @@ public class RepayServiceImpl implements IRepayService {
}
//发起xyqb查询
String
optRecordsStr
=
xyqbService
.
queryRepayOptRecords
(
businessFlowNo
);
log
.
info
(
"[查询xyqb还款操作记录],optRecordsStr={}"
,
optRecordsStr
);
//String optRecordsStr = xyqbService.queryRepayOptRecords(businessFlowNo);
//todo 替换中台接口
String
optRecordsStr
=
sidecarService
.
queryRepayOptRecords
(
businessFlowNo
);
log
.
info
(
"[查询xyqb还款操作记录],optRecordsStr={}"
,
optRecordsStr
);
if
(
StringUtils
.
isBlank
(
optRecordsStr
))
{
log
.
error
(
"[查询xyqb还款操作记录],返回结果为null"
);
return
JsonResult
.
buildErrorStateResult
(
ErrorCodeEnum
.
RETURN_ERROR
.
getMessage
(),
ErrorCodeEnum
.
RETURN_ERROR
.
getCode
());
...
...
src/main/java/cn/quantgroup/customer/service/impl/SidecarServiceImpl.java
0 → 100644
View file @
935a1e78
package
cn
.
quantgroup
.
customer
.
service
.
impl
;
import
cn.quantgroup.customer.model.order.OrderRepayment
;
import
cn.quantgroup.customer.rest.param.repay.RepayOrderInfoQuery
;
import
cn.quantgroup.customer.rest.vo.JsonResult
;
import
cn.quantgroup.customer.service.ISidecarService
;
import
cn.quantgroup.customer.service.http.IHttpService
;
import
cn.quantgroup.customer.util.JSONTools
;
import
com.fasterxml.jackson.core.type.TypeReference
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.stereotype.Service
;
import
java.util.HashMap
;
import
java.util.Map
;
import
java.util.Objects
;
@Slf4j
@Service
(
"sidecarService"
)
public
class
SidecarServiceImpl
implements
ISidecarService
{
@Value
(
"${mo-sidecar.http}"
)
private
String
sidecarUrl
;
private
final
IHttpService
httpService
;
@Autowired
public
SidecarServiceImpl
(
IHttpService
httpService
)
{
this
.
httpService
=
httpService
;
}
@Override
public
JsonResult
<
OrderRepayment
>
repaymentPlanQuery
(
Long
loanId
)
{
String
logPre
=
"sidecarService.repaymentPlanQuery"
;
log
.
info
(
"{} 查询还款计划loanId={}"
,
logPre
,
loanId
);
String
url
=
sidecarUrl
+
"/middle_office/repayment/plan_view"
;
Map
<
String
,
String
>
queryParam
=
new
HashMap
<>(
2
);
queryParam
.
put
(
"loanId"
,
loanId
.
toString
());
String
result
=
httpService
.
get
(
url
,
queryParam
);
if
(
StringUtils
.
isBlank
(
result
))
{
log
.
error
(
"{} 查询还款计划失败 loanId={} result={}"
,
logPre
,
loanId
,
result
);
return
JsonResult
.
buildErrorStateResult
(
"查询还款计划失败"
,
null
);
}
else
{
TypeReference
<
JsonResult
<
OrderRepayment
>>
typeToken
=
new
TypeReference
<
JsonResult
<
OrderRepayment
>>()
{
};
JsonResult
<
OrderRepayment
>
result1
=
JSONTools
.
deserialize
(
result
,
typeToken
);
if
(
result1
!=
null
)
{
return
result1
;
}
else
{
return
JsonResult
.
buildErrorStateResult
(
"还款计划查询失败"
,
null
);
}
}
}
@Override
public
String
queryRepayInfo
(
RepayOrderInfoQuery
repayOrderQuery
)
{
String
url
=
sidecarUrl
+
"/middle_office/repayment/plan_info"
;
Map
<
String
,
Object
>
param
=
new
HashMap
<>(
4
);
Long
loanId
=
repayOrderQuery
.
getLoanId
();
Integer
termNo
=
repayOrderQuery
.
getTermNo
();
if
(
Objects
.
nonNull
(
loanId
))
{
param
.
put
(
"loanId"
,
loanId
);
}
if
(
Objects
.
nonNull
(
termNo
))
{
param
.
put
(
"termNo"
,
termNo
);
}
String
response
=
null
;
try
{
response
=
httpService
.
post
(
url
,
param
);
log
.
info
(
"[queryRepayInfo] param:{},请求业务系统返回值:{}"
,
param
,
response
);
}
catch
(
Exception
e
)
{
log
.
error
(
"[queryRepayInfo] param:{},请求业务系统异常:{}"
,
param
,
e
);
}
return
response
;
}
@Override
public
String
queryRepayOptRecords
(
String
businessFlowNo
)
{
String
url
=
sidecarUrl
+
"/middle_office/repayment/repay_result"
;
Map
<
String
,
Object
>
param
=
new
HashMap
<>(
4
);
if
(
StringUtils
.
isNotBlank
(
businessFlowNo
))
{
param
.
put
(
"businessFlowNo"
,
businessFlowNo
);
}
String
response
=
null
;
try
{
response
=
httpService
.
post
(
url
,
param
);
log
.
info
(
"[queryRepayOptRecords] param:{},请求业务系统返回值:{}"
,
param
,
response
);
}
catch
(
Exception
e
)
{
log
.
error
(
"[queryRepayOptRecords] param:{},请求业务系统异常:{}"
,
param
,
e
);
}
return
response
;
}
}
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