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
15ccb3f3
Commit
15ccb3f3
authored
Mar 24, 2020
by
杨钧
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改绑卡相关接口
parent
c9200409
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
179 additions
and
142 deletions
+179
-142
ICardService.java
...ain/java/cn/quantgroup/customer/service/ICardService.java
+28
-4
IXyqbService.java
...ain/java/cn/quantgroup/customer/service/IXyqbService.java
+26
-4
CardServiceImpl.java
.../cn/quantgroup/customer/service/impl/CardServiceImpl.java
+64
-95
XyqbServiceImpl.java
.../cn/quantgroup/customer/service/impl/XyqbServiceImpl.java
+61
-39
No files found.
src/main/java/cn/quantgroup/customer/service/ICardService.java
View file @
15ccb3f3
...
@@ -4,6 +4,10 @@ import cn.quantgroup.customer.rest.param.card.ModifyCardsQuery;
...
@@ -4,6 +4,10 @@ import cn.quantgroup.customer.rest.param.card.ModifyCardsQuery;
import
cn.quantgroup.customer.rest.param.card.ModifyReservePhone
;
import
cn.quantgroup.customer.rest.param.card.ModifyReservePhone
;
import
cn.quantgroup.customer.rest.param.card.UnBindCardModel
;
import
cn.quantgroup.customer.rest.param.card.UnBindCardModel
;
import
cn.quantgroup.customer.rest.vo.JsonResult
;
import
cn.quantgroup.customer.rest.vo.JsonResult
;
import
cn.quantgroup.customer.rest.vo.card.CardResult
;
import
cn.quantgroup.customer.rest.vo.card.XyqbCardRelation
;
import
java.util.List
;
/**
/**
* @author yangjun
* @author yangjun
...
@@ -11,11 +15,31 @@ import cn.quantgroup.customer.rest.vo.JsonResult;
...
@@ -11,11 +15,31 @@ import cn.quantgroup.customer.rest.vo.JsonResult;
* @Desc 银行卡相关
* @Desc 银行卡相关
*/
*/
public
interface
ICardService
{
public
interface
ICardService
{
JsonResult
queryCardLists
(
ModifyCardsQuery
cardsQuery
);
/**
* 查询绑卡信息
* @param cardsQuery
* @return
*/
JsonResult
<
CardResult
>
queryCardLists
(
ModifyCardsQuery
cardsQuery
);
JsonResult
queryCardRelation
(
Long
bankId
);
/**
* 查询卡关联信息
* @param bankId
* @return
*/
JsonResult
<
List
<
XyqbCardRelation
>>
queryCardRelation
(
Long
bankId
);
JsonResult
unBindCardRelation
(
UnBindCardModel
unBindCardModel
);
/**
* 解绑
* @param unBindCardModel
* @return
*/
JsonResult
<
String
>
unBindCardRelation
(
UnBindCardModel
unBindCardModel
);
JsonResult
modifyReservePhone
(
ModifyReservePhone
modifyReservePhone
);
/**
* 修改用户预留手机号
* @param modifyReservePhone
* @return
*/
JsonResult
<
String
>
modifyReservePhone
(
ModifyReservePhone
modifyReservePhone
);
}
}
src/main/java/cn/quantgroup/customer/service/IXyqbService.java
View file @
15ccb3f3
...
@@ -8,6 +8,8 @@ import cn.quantgroup.customer.rest.param.ordermapping.OrderQueryParam;
...
@@ -8,6 +8,8 @@ import cn.quantgroup.customer.rest.param.ordermapping.OrderQueryParam;
import
cn.quantgroup.customer.rest.param.repay.RepayOrderInfoQuery
;
import
cn.quantgroup.customer.rest.param.repay.RepayOrderInfoQuery
;
import
cn.quantgroup.customer.rest.param.repay.RepayOrderQuery
;
import
cn.quantgroup.customer.rest.param.repay.RepayOrderQuery
;
import
cn.quantgroup.customer.rest.vo.JsonResult
;
import
cn.quantgroup.customer.rest.vo.JsonResult
;
import
cn.quantgroup.customer.rest.vo.card.XyqbCardRelation
;
import
cn.quantgroup.customer.rest.vo.card.XyqbCardsInfo
;
import
java.util.List
;
import
java.util.List
;
...
@@ -44,13 +46,33 @@ public interface IXyqbService {
...
@@ -44,13 +46,33 @@ public interface IXyqbService {
*/
*/
JsonResult
<
OrderRepayment
>
repaymentPlanQuery
(
Long
loanId
);
JsonResult
<
OrderRepayment
>
repaymentPlanQuery
(
Long
loanId
);
String
queryCardLists
(
Long
userId
);
/**
* 查询信用钱包返回用户绑卡列表信息
* @param userId
* @return
*/
JsonResult
<
List
<
XyqbCardsInfo
>>
queryCardLists
(
Long
userId
);
String
queryCardRelation
(
Long
bankId
);
/**
* 查询信用钱包卡关联信息
* @param bankId
* @return
*/
JsonResult
<
List
<
XyqbCardRelation
>>
queryCardRelation
(
Long
bankId
);
String
unBindCardRelation
(
UnBindCardModel
unBindCardModel
);
/**
* 卡解绑
* @param unBindCardModel
* @return
*/
JsonResult
<
String
>
unBindCardRelation
(
UnBindCardModel
unBindCardModel
);
String
modifyReservePhone
(
ModifyReservePhone
modifyReservePhone
);
/**
* 修改预留手机号
* @param modifyReservePhone
* @return
*/
JsonResult
<
String
>
modifyReservePhone
(
ModifyReservePhone
modifyReservePhone
);
String
queryRepayInfo
(
RepayOrderInfoQuery
repayOrderQuery
);
String
queryRepayInfo
(
RepayOrderInfoQuery
repayOrderQuery
);
...
...
src/main/java/cn/quantgroup/customer/service/impl/CardServiceImpl.java
View file @
15ccb3f3
...
@@ -15,8 +15,10 @@ import cn.quantgroup.customer.rest.vo.card.XyqbCardsInfo;
...
@@ -15,8 +15,10 @@ import cn.quantgroup.customer.rest.vo.card.XyqbCardsInfo;
import
cn.quantgroup.customer.service.ICardService
;
import
cn.quantgroup.customer.service.ICardService
;
import
cn.quantgroup.customer.service.IUserService
;
import
cn.quantgroup.customer.service.IUserService
;
import
cn.quantgroup.customer.service.IXyqbService
;
import
cn.quantgroup.customer.service.IXyqbService
;
import
cn.quantgroup.customer.util.JSONTools
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.commons.lang3.exception.ExceptionUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
...
@@ -40,59 +42,44 @@ public class CardServiceImpl implements ICardService {
...
@@ -40,59 +42,44 @@ public class CardServiceImpl implements ICardService {
@Override
@Override
public
JsonResult
queryCardLists
(
ModifyCardsQuery
cardsQuery
)
{
public
JsonResult
<
CardResult
>
queryCardLists
(
ModifyCardsQuery
cardsQuery
)
{
final
String
logPre
=
"[queryCardLists] 查询用户绑卡信息"
;
if
(
Objects
.
isNull
(
cardsQuery
))
{
if
(
Objects
.
isNull
(
cardsQuery
))
{
log
.
error
(
"
请求参数 cardsQuery 为空"
);
log
.
error
(
"
{} 请求参数 cardsQuery 为空"
,
logPre
);
return
JsonResult
.
buildErrorStateResult
(
ErrorCodeEnum
.
PARAM_ERROR
.
getMessage
(),
ErrorCodeEnum
.
PARAM_ERROR
.
getCode
());
return
JsonResult
.
buildErrorStateResult
(
ErrorCodeEnum
.
PARAM_ERROR
.
getMessage
(),
ErrorCodeEnum
.
PARAM_ERROR
.
getCode
());
}
}
if
(
StringUtils
.
isBlank
(
cardsQuery
.
getPhoneNo
())
&&
Objects
.
isNull
(
cardsQuery
.
getUserId
()))
{
if
(
StringUtils
.
isBlank
(
cardsQuery
.
getPhoneNo
())
&&
Objects
.
isNull
(
cardsQuery
.
getUserId
()))
{
log
.
error
(
"
请求参数 phoneNo 和 userId 不能同时为空"
);
log
.
error
(
"
{} 请求参数 phoneNo 和 userId 同时为空 cardsQuery={}"
,
logPre
,
cardsQuery
);
return
JsonResult
.
buildErrorStateResult
(
"phoneNo 和 userId 不能同时为空"
,
ErrorCodeEnum
.
RETURN
_ERROR
.
getCode
());
return
JsonResult
.
buildErrorStateResult
(
"phoneNo 和 userId 不能同时为空"
,
ErrorCodeEnum
.
PARAM
_ERROR
.
getCode
());
}
}
Long
userId
=
cardsQuery
.
getUserId
();
CardResult
cardResult
=
new
CardResult
();
CardResult
cardResult
=
new
CardResult
();
if
(
Objects
.
isNull
(
userId
))
{
UserQueryParam
userQueryParam
=
JSONTools
.
convert
(
cardsQuery
,
UserQueryParam
.
class
);
UserQueryParam
userQueryParam
=
new
UserQueryParam
();
JsonResult
<
UserBasicInfo
>
userJsonResult
=
userService
.
findUserInfo
(
userQueryParam
);
userQueryParam
.
setPhoneNo
(
cardsQuery
.
getPhoneNo
());
log
.
info
(
"{} 查询用户信息 userJsonResult={} "
,
logPre
,
userJsonResult
);
JsonResult
userJsonResult
=
userService
.
findUserInfo
(
userQueryParam
);
if
(
Objects
.
isNull
(
userJsonResult
)
||
!
userJsonResult
.
isSuccess
())
{
if
(
Objects
.
isNull
(
userJsonResult
)
log
.
error
(
"{} 根据手机号查不到用户信息 phoneNo={},userJsonResult={}"
,
logPre
,
cardsQuery
.
getPhoneNo
(),
userJsonResult
);
||
!
userJsonResult
.
isSuccess
())
{
return
JsonResult
.
buildSuccessResult
(
"用户不存在"
,
null
);
log
.
error
(
"根据手机号查不到用户信息"
);
return
JsonResult
.
buildErrorStateResult
(
"根据手机号查不到用户信息"
,
ErrorCodeEnum
.
PARAM_ERROR
.
getCode
());
}
UserBasicInfo
userbasicinfo
=
(
UserBasicInfo
)
userJsonResult
.
getData
();
cardResult
.
setUserInfo
(
userbasicinfo
);
userId
=
userbasicinfo
.
getUserId
();
}
}
//发起xyqb查询
UserBasicInfo
userbasicinfo
=
userJsonResult
.
getData
();
String
cardXyqbStr
=
xyqbService
.
queryCardLists
(
userId
);
cardResult
.
setUserInfo
(
userbasicinfo
);
log
.
info
(
"[查询xyqb返回绑卡信息],cardXyqbStr={}"
,
cardXyqbStr
);
if
(
StringUtils
.
isBlank
(
cardXyqbStr
))
{
log
.
error
(
"[查询xyqb返回绑卡信息],返回结果为null"
);
return
JsonResult
.
buildErrorStateResult
(
ErrorCodeEnum
.
RETURN_ERROR
.
getMessage
(),
ErrorCodeEnum
.
RETURN_ERROR
.
getCode
());
}
JsonResult
<
List
<
XyqbCardsInfo
>>
xyqbCardsResult
;
//发起xyqb查询
try
{
JsonResult
<
List
<
XyqbCardsInfo
>>
xyqbCardInfoResult
=
xyqbService
.
queryCardLists
(
userbasicinfo
.
getUserId
());
Type
jsonType
=
new
com
.
google
.
gson
.
reflect
.
TypeToken
<
JsonResult
<
List
<
XyqbCardsInfo
>>>()
{
log
.
info
(
"{} 信用钱包返回信息 unBindCardResult:{}"
,
logPre
,
xyqbCardInfoResult
);
}.
getType
();
if
(
Objects
.
isNull
(
xyqbCardInfoResult
))
{
xyqbCardsResult
=
Constant
.
GSON
.
fromJson
(
cardXyqbStr
,
jsonType
);
log
.
error
(
"{} 返回为空 userId={}"
,
logPre
,
userbasicinfo
.
getUserId
());
}
catch
(
Exception
e
)
{
log
.
error
(
"[绑卡信息转换异常]"
,
e
);
return
JsonResult
.
buildErrorStateResult
(
ErrorCodeEnum
.
RETURN_ERROR
.
getMessage
(),
ErrorCodeEnum
.
RETURN_ERROR
.
getCode
());
return
JsonResult
.
buildErrorStateResult
(
ErrorCodeEnum
.
RETURN_ERROR
.
getMessage
(),
ErrorCodeEnum
.
RETURN_ERROR
.
getCode
());
}
}
if
(!
xyqbCardInfoResult
.
isSuccess
())
{
if
(!
xyqbCardsResult
.
isSuccess
())
{
log
.
error
(
"{} 信息异常 userId={},xyqbCardInfoResult={}"
,
logPre
,
userbasicinfo
.
getUserId
(),
xyqbCardInfoResult
);
return
JsonResult
.
buildErrorStateResult
(
ErrorCodeEnum
.
RETURN_ERROR
.
getMessage
(),
ErrorCodeEnum
.
RETURN_ERROR
.
getCode
());
return
JsonResult
.
buildErrorStateResult
(
xyqbCardInfoResult
.
getMsg
(),
xyqbCardInfoResult
.
getCode
());
}
}
cardResult
.
setBindCardInfo
(
xyqbCard
s
Result
.
getData
());
cardResult
.
setBindCardInfo
(
xyqbCard
Info
Result
.
getData
());
log
.
info
(
"
[查询绑卡信息],返回 cardResult={}"
,
cardResult
);
log
.
info
(
"
{} 返回cardResult={}"
,
logPre
,
cardResult
);
return
JsonResult
.
buildSuccessResult
(
"处理成功"
,
cardResult
);
return
JsonResult
.
buildSuccessResult
(
"处理成功"
,
cardResult
);
}
}
...
@@ -104,74 +91,63 @@ public class CardServiceImpl implements ICardService {
...
@@ -104,74 +91,63 @@ public class CardServiceImpl implements ICardService {
* @return
* @return
*/
*/
@Override
@Override
public
JsonResult
queryCardRelation
(
Long
bankId
)
{
public
JsonResult
<
List
<
XyqbCardRelation
>>
queryCardRelation
(
Long
bankId
)
{
final
String
logPre
=
"[queryCardRelation] 查询卡关联信息"
;
if
(
Objects
.
isNull
(
bankId
))
{
if
(
Objects
.
isNull
(
bankId
))
{
log
.
error
(
"
请求参数 bankId 为空"
);
log
.
error
(
"
{} 请求参数 bankId 为空"
,
logPre
);
return
JsonResult
.
buildErrorStateResult
(
ErrorCodeEnum
.
PARAM_ERROR
.
getMessage
(),
ErrorCodeEnum
.
PARAM_ERROR
.
getCode
());
return
JsonResult
.
buildErrorStateResult
(
ErrorCodeEnum
.
PARAM_ERROR
.
getMessage
(),
ErrorCodeEnum
.
PARAM_ERROR
.
getCode
());
}
}
//发起xyqb查询
//发起xyqb查询
String
cardRelationStr
=
xyqbService
.
queryCardRelation
(
bankId
);
JsonResult
<
List
<
XyqbCardRelation
>>
xyqbCardRelationResult
=
xyqbService
.
queryCardRelation
(
bankId
);
log
.
info
(
"
[查询xyqb返回卡关联信息],cardRelationStr={}"
,
cardRelationStr
);
log
.
info
(
"
{} 信用钱包返回信息 xyqbCardRelationResult:{}"
,
logPre
,
xyqbCardRelationResult
);
if
(
StringUtils
.
isBlank
(
cardRelationStr
))
{
if
(
Objects
.
isNull
(
xyqbCardRelationResult
))
{
log
.
error
(
"
[查询xyqb返回卡关联信息],返回结果为null"
);
log
.
error
(
"
{} 返回为空 bankId={}"
,
logPre
,
bankId
);
return
JsonResult
.
buildErrorStateResult
(
ErrorCodeEnum
.
RETURN_ERROR
.
getMessage
(),
ErrorCodeEnum
.
RETURN_ERROR
.
getCode
());
return
JsonResult
.
buildErrorStateResult
(
ErrorCodeEnum
.
RETURN_ERROR
.
getMessage
(),
ErrorCodeEnum
.
RETURN_ERROR
.
getCode
());
}
}
if
(!
xyqbCardRelationResult
.
isSuccess
())
{
JsonResult
<
List
<
XyqbCardRelation
>>
xyqbCardRelationResult
;
log
.
error
(
"{} 信息异常 bankId={},xyqbCardInfoResult={}"
,
logPre
,
bankId
,
xyqbCardRelationResult
);
try
{
return
JsonResult
.
buildErrorStateResult
(
xyqbCardRelationResult
.
getMsg
(),
xyqbCardRelationResult
.
getCode
());
Type
jsonType
=
new
com
.
google
.
gson
.
reflect
.
TypeToken
<
JsonResult
<
List
<
XyqbCardRelation
>>>()
{
}.
getType
();
xyqbCardRelationResult
=
Constant
.
GSON
.
fromJson
(
cardRelationStr
,
jsonType
);
}
catch
(
Exception
e
)
{
log
.
error
(
"[卡关联信息转换异常]"
,
e
);
return
JsonResult
.
buildErrorStateResult
(
ErrorCodeEnum
.
RETURN_ERROR
.
getMessage
(),
ErrorCodeEnum
.
RETURN_ERROR
.
getCode
());
}
}
log
.
info
(
"[查询卡关联信息],返回 xyqbCardRelationResult={}"
,
xyqbCardRelationResult
);
return
JsonResult
.
buildSuccessResult
(
"处理成功"
,
xyqbCardRelationResult
.
getData
());
return
xyqbCardRelationResult
;
}
}
@Override
@Override
public
JsonResult
unBindCardRelation
(
UnBindCardModel
unBindCardModel
)
{
public
JsonResult
<
String
>
unBindCardRelation
(
UnBindCardModel
unBindCardModel
)
{
final
String
logPre
=
"[unBindCardRelation] 解除绑卡"
;
if
(
Objects
.
isNull
(
unBindCardModel
))
{
if
(
Objects
.
isNull
(
unBindCardModel
))
{
log
.
error
(
"
请求参数 unBindCardModel 为空"
);
log
.
error
(
"
{} 请求参数 unBindCardModel 为空"
,
logPre
);
return
JsonResult
.
buildErrorStateResult
(
ErrorCodeEnum
.
PARAM_ERROR
.
getMessage
(),
ErrorCodeEnum
.
PARAM_ERROR
.
getCode
());
return
JsonResult
.
buildErrorStateResult
(
ErrorCodeEnum
.
PARAM_ERROR
.
getMessage
(),
ErrorCodeEnum
.
PARAM_ERROR
.
getCode
());
}
}
if
(
Objects
.
isNull
(
unBindCardModel
.
getBindCardRecordId
())
||
Objects
.
isNull
(
unBindCardModel
.
getUserId
()))
{
if
(
Objects
.
isNull
(
unBindCardModel
.
getBindCardRecordId
())
||
Objects
.
isNull
(
unBindCardModel
.
getUserId
()))
{
log
.
error
(
"
请求参数 bindCardRecordId 和 userId 不能为空"
);
log
.
error
(
"
{} 请求参数 bindCardRecordId 和 userId 为空 unBindCardModel:{}"
,
logPre
,
unBindCardModel
);
return
JsonResult
.
buildErrorStateResult
(
"
bindCardRecordId 和 userId 不能为空"
,
ErrorCodeEnum
.
RETURN
_ERROR
.
getCode
());
return
JsonResult
.
buildErrorStateResult
(
"
请求参数 bindCardRecordId 和 userId 不能为空"
,
ErrorCodeEnum
.
PARAM
_ERROR
.
getCode
());
}
}
//发起xyqb查询
//发起xyqb查询
String
unBindCardStr
=
xyqbService
.
unBindCardRelation
(
unBindCardModel
);
JsonResult
<
String
>
unBindCardResult
=
xyqbService
.
unBindCardRelation
(
unBindCardModel
);
log
.
info
(
"
[解除绑卡信息],unBindCardStr={}"
,
unBindCardStr
);
log
.
info
(
"
{} 信用钱包返回信息 unBindCardResult:{}"
,
logPre
,
unBindCardResult
);
if
(
StringUtils
.
isBlank
(
unBindCardStr
))
{
if
(
Objects
.
isNull
(
unBindCardResult
))
{
log
.
error
(
"
[解除绑卡信息],返回结果为null"
);
log
.
error
(
"
{} 返回为空 unBindCardModel={}"
,
logPre
,
unBindCardModel
);
return
JsonResult
.
buildErrorStateResult
(
ErrorCodeEnum
.
RETURN_ERROR
.
getMessage
(),
ErrorCodeEnum
.
RETURN_ERROR
.
getCode
());
return
JsonResult
.
buildErrorStateResult
(
ErrorCodeEnum
.
RETURN_ERROR
.
getMessage
(),
ErrorCodeEnum
.
RETURN_ERROR
.
getCode
());
}
}
if
(!
unBindCardResult
.
isSuccess
())
{
log
.
error
(
"{} 信息异常 unBindCardModel={},unBindCardModel={}"
,
logPre
,
unBindCardModel
,
unBindCardResult
);
JsonResult
<
String
>
modifyResult
;
return
JsonResult
.
buildErrorStateResult
(
unBindCardResult
.
getMsg
(),
unBindCardResult
.
getCode
());
try
{
Type
jsonType
=
new
com
.
google
.
gson
.
reflect
.
TypeToken
<
JsonResult
<
String
>>()
{
}.
getType
();
modifyResult
=
Constant
.
GSON
.
fromJson
(
unBindCardStr
,
jsonType
);
}
catch
(
Exception
e
)
{
log
.
error
(
"[解除绑卡信息转换异常]"
,
e
);
return
JsonResult
.
buildErrorStateResult
(
ErrorCodeEnum
.
RETURN_ERROR
.
getMessage
(),
ErrorCodeEnum
.
RETURN_ERROR
.
getCode
());
}
}
log
.
info
(
"[解除绑卡信息],返回 modifyResult={}"
,
modifyResult
);
return
JsonResult
.
buildSuccessResult
(
"处理成功"
,
unBindCardResult
.
getData
());
return
modifyResult
;
}
}
@Override
@Override
public
JsonResult
modifyReservePhone
(
ModifyReservePhone
modifyReservePhone
)
{
public
JsonResult
<
String
>
modifyReservePhone
(
ModifyReservePhone
modifyReservePhone
)
{
final
String
logPre
=
"[modifyReservePhone] 修改预留手机号"
;
if
(
Objects
.
isNull
(
modifyReservePhone
))
{
if
(
Objects
.
isNull
(
modifyReservePhone
))
{
log
.
error
(
"
请求参数 modifyReservePhone 为空"
);
log
.
error
(
"
{} 请求参数 modifyReservePhone 为空"
,
logPre
);
return
JsonResult
.
buildErrorStateResult
(
ErrorCodeEnum
.
PARAM_ERROR
.
getMessage
(),
ErrorCodeEnum
.
PARAM_ERROR
.
getCode
());
return
JsonResult
.
buildErrorStateResult
(
ErrorCodeEnum
.
PARAM_ERROR
.
getMessage
(),
ErrorCodeEnum
.
PARAM_ERROR
.
getCode
());
}
}
...
@@ -179,30 +155,23 @@ public class CardServiceImpl implements ICardService {
...
@@ -179,30 +155,23 @@ public class CardServiceImpl implements ICardService {
if
(
Objects
.
isNull
(
modifyReservePhone
.
getBankId
())
if
(
Objects
.
isNull
(
modifyReservePhone
.
getBankId
())
||
Objects
.
isNull
(
modifyReservePhone
.
getUserId
())
||
Objects
.
isNull
(
modifyReservePhone
.
getUserId
())
||
StringUtils
.
isBlank
(
modifyReservePhone
.
getPhoneNo
()))
{
||
StringUtils
.
isBlank
(
modifyReservePhone
.
getPhoneNo
()))
{
log
.
error
(
"
请求参数 bankId,userId,phoneNo 都不能为空"
);
log
.
error
(
"
{} 请求参数 bankId,userId,phoneNo 为空 modifyReservePhone:{}"
,
logPre
,
modifyReservePhone
);
return
JsonResult
.
buildErrorStateResult
(
"
bankId,userId,phoneNo 不能为空"
,
ErrorCodeEnum
.
RETURN
_ERROR
.
getCode
());
return
JsonResult
.
buildErrorStateResult
(
"
请求参数 cbankId,userId,phoneNo 不能为空"
,
ErrorCodeEnum
.
PARAM
_ERROR
.
getCode
());
}
}
//发起xyqb查询
//发起xyqb查询
String
modifyReservePhoneStr
=
xyqbService
.
modifyReservePhone
(
modifyReservePhone
);
JsonResult
<
String
>
modifyReservePhoneResult
=
xyqbService
.
modifyReservePhone
(
modifyReservePhone
);
log
.
info
(
"
[调用xyqb,修改预留手机号],modifyReservePhoneStr={}"
,
modifyReservePhoneStr
);
log
.
info
(
"
{} 信用钱包返回信息 modifyReservePhoneResult:{}"
,
logPre
,
modifyReservePhoneResult
);
if
(
StringUtils
.
isBlank
(
modifyReservePhoneStr
))
{
if
(
Objects
.
isNull
(
modifyReservePhoneResult
))
{
log
.
error
(
"
[调用xyqb,修改预留手机号],返回结果为null"
);
log
.
error
(
"
{} 返回为空 modifyReservePhone={}"
,
logPre
,
modifyReservePhone
);
return
JsonResult
.
buildErrorStateResult
(
ErrorCodeEnum
.
RETURN_ERROR
.
getMessage
(),
ErrorCodeEnum
.
RETURN_ERROR
.
getCode
());
return
JsonResult
.
buildErrorStateResult
(
ErrorCodeEnum
.
RETURN_ERROR
.
getMessage
(),
ErrorCodeEnum
.
RETURN_ERROR
.
getCode
());
}
}
if
(!
modifyReservePhoneResult
.
isSuccess
())
{
JsonResult
<
String
>
modifyResult
;
log
.
error
(
"{} 信息异常 modifyReservePhone={},modifyReservePhoneResult={}"
,
logPre
,
modifyReservePhone
,
modifyReservePhoneResult
);
try
{
return
JsonResult
.
buildErrorStateResult
(
modifyReservePhoneResult
.
getMsg
(),
modifyReservePhoneResult
.
getCode
());
Type
jsonType
=
new
com
.
google
.
gson
.
reflect
.
TypeToken
<
JsonResult
<
String
>>()
{
}.
getType
();
modifyResult
=
Constant
.
GSON
.
fromJson
(
modifyReservePhoneStr
,
jsonType
);
}
catch
(
Exception
e
)
{
log
.
error
(
"[修改预留手机号结果转换异常]"
,
e
);
return
JsonResult
.
buildErrorStateResult
(
ErrorCodeEnum
.
RETURN_ERROR
.
getMessage
(),
ErrorCodeEnum
.
RETURN_ERROR
.
getCode
());
}
}
log
.
info
(
"[修改预留手机号],返回 modifyResult={}"
,
modifyResult
);
return
JsonResult
.
buildSuccessResult
(
"处理成功"
,
modifyReservePhoneResult
.
getData
());
return
modifyResult
;
}
}
...
...
src/main/java/cn/quantgroup/customer/service/impl/XyqbServiceImpl.java
View file @
15ccb3f3
package
cn
.
quantgroup
.
customer
.
service
.
impl
;
package
cn
.
quantgroup
.
customer
.
service
.
impl
;
import
cn.quantgroup.customer.constant.Constant
;
import
cn.quantgroup.customer.enums.ErrorCodeEnum
;
import
cn.quantgroup.customer.enums.ErrorCodeEnum
;
import
cn.quantgroup.customer.model.order.*
;
import
cn.quantgroup.customer.model.order.*
;
import
cn.quantgroup.customer.rest.param.applyorder.ApplyOrderQuery
;
import
cn.quantgroup.customer.rest.param.applyorder.ApplyOrderQuery
;
...
@@ -9,6 +10,8 @@ import cn.quantgroup.customer.rest.param.ordermapping.OrderQueryParam;
...
@@ -9,6 +10,8 @@ import cn.quantgroup.customer.rest.param.ordermapping.OrderQueryParam;
import
cn.quantgroup.customer.rest.param.repay.RepayOrderInfoQuery
;
import
cn.quantgroup.customer.rest.param.repay.RepayOrderInfoQuery
;
import
cn.quantgroup.customer.rest.param.repay.RepayOrderQuery
;
import
cn.quantgroup.customer.rest.param.repay.RepayOrderQuery
;
import
cn.quantgroup.customer.rest.vo.JsonResult
;
import
cn.quantgroup.customer.rest.vo.JsonResult
;
import
cn.quantgroup.customer.rest.vo.card.XyqbCardRelation
;
import
cn.quantgroup.customer.rest.vo.card.XyqbCardsInfo
;
import
cn.quantgroup.customer.service.IXyqbService
;
import
cn.quantgroup.customer.service.IXyqbService
;
import
cn.quantgroup.customer.service.http.IHttpService
;
import
cn.quantgroup.customer.service.http.IHttpService
;
import
cn.quantgroup.customer.util.JSONTools
;
import
cn.quantgroup.customer.util.JSONTools
;
...
@@ -17,10 +20,12 @@ import com.fasterxml.jackson.core.type.TypeReference;
...
@@ -17,10 +20,12 @@ import com.fasterxml.jackson.core.type.TypeReference;
import
com.google.common.collect.Maps
;
import
com.google.common.collect.Maps
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.commons.lang3.exception.ExceptionUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
java.lang.reflect.Type
;
import
java.util.HashMap
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Map
;
...
@@ -194,7 +199,8 @@ public class XyqbServiceImpl implements IXyqbService {
...
@@ -194,7 +199,8 @@ public class XyqbServiceImpl implements IXyqbService {
* @return
* @return
*/
*/
@Override
@Override
public
String
queryCardLists
(
Long
userId
)
{
public
JsonResult
<
List
<
XyqbCardsInfo
>>
queryCardLists
(
Long
userId
)
{
final
String
logPre
=
"XyqbServiceImpl.queryCardLists 查询信用钱包用户绑卡信息"
;
String
url
=
xyqbSysUrl
+
"/ex/customer_sys/query/bankcard"
;
String
url
=
xyqbSysUrl
+
"/ex/customer_sys/query/bankcard"
;
Map
<
String
,
Object
>
param
=
new
HashMap
<>(
4
);
Map
<
String
,
Object
>
param
=
new
HashMap
<>(
4
);
if
(
Objects
.
nonNull
(
userId
))
{
if
(
Objects
.
nonNull
(
userId
))
{
...
@@ -203,15 +209,24 @@ public class XyqbServiceImpl implements IXyqbService {
...
@@ -203,15 +209,24 @@ public class XyqbServiceImpl implements IXyqbService {
String
response
=
null
;
String
response
=
null
;
try
{
try
{
response
=
httpService
.
post
(
url
,
param
);
response
=
httpService
.
post
(
url
,
param
);
log
.
info
(
"[queryCardLists] param:{},请求业务系统返回值:{}"
,
param
,
response
);
log
.
info
(
"{} response={}"
,
logPre
,
response
);
if
(
StringUtils
.
isBlank
(
response
))
{
log
.
error
(
"{} 返回结果为null"
,
logPre
);
return
JsonResult
.
buildErrorStateResult
(
ErrorCodeEnum
.
RETURN_ERROR
.
getMessage
(),
ErrorCodeEnum
.
RETURN_ERROR
.
getCode
());
}
Type
jsonType
=
new
com
.
google
.
gson
.
reflect
.
TypeToken
<
JsonResult
<
List
<
XyqbCardsInfo
>>>()
{
}.
getType
();
return
Constant
.
GSON
.
fromJson
(
response
,
jsonType
);
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
log
.
error
(
"[queryCardLists] param:{},请求业务系统异常:{}"
,
param
,
e
);
log
.
error
(
"{} 处理失败 param:{},response:{},异常信息:{}"
,
logPre
,
param
,
response
,
ExceptionUtils
.
getStackTrace
(
e
));
return
JsonResult
.
buildErrorStateResult
(
ErrorCodeEnum
.
RETURN_ERROR
.
getMessage
(),
ErrorCodeEnum
.
RETURN_ERROR
.
getCode
());
}
}
return
response
;
}
}
@Override
@Override
public
String
queryCardRelation
(
Long
bankId
)
{
public
JsonResult
<
List
<
XyqbCardRelation
>>
queryCardRelation
(
Long
bankId
)
{
final
String
logPre
=
"XyqbServiceImpl.queryCardRelation 查询信用钱包卡关联信息"
;
String
url
=
xyqbSysUrl
+
"/ex/customer_sys/query/cardrelation"
;
String
url
=
xyqbSysUrl
+
"/ex/customer_sys/query/cardrelation"
;
Map
<
String
,
Object
>
param
=
new
HashMap
<>(
4
);
Map
<
String
,
Object
>
param
=
new
HashMap
<>(
4
);
if
(
Objects
.
nonNull
(
bankId
))
{
if
(
Objects
.
nonNull
(
bankId
))
{
...
@@ -221,60 +236,67 @@ public class XyqbServiceImpl implements IXyqbService {
...
@@ -221,60 +236,67 @@ public class XyqbServiceImpl implements IXyqbService {
String
response
=
null
;
String
response
=
null
;
try
{
try
{
response
=
httpService
.
post
(
url
,
param
);
response
=
httpService
.
post
(
url
,
param
);
log
.
info
(
"[queryCardRelation] param:{},请求业务系统返回值:{}"
,
param
,
response
);
log
.
info
(
"{} response={}"
,
logPre
,
response
);
if
(
StringUtils
.
isBlank
(
response
))
{
log
.
error
(
"{} 返回结果为null"
,
logPre
);
return
JsonResult
.
buildErrorStateResult
(
ErrorCodeEnum
.
RETURN_ERROR
.
getMessage
(),
ErrorCodeEnum
.
RETURN_ERROR
.
getCode
());
}
Type
jsonType
=
new
com
.
google
.
gson
.
reflect
.
TypeToken
<
JsonResult
<
List
<
XyqbCardRelation
>>>()
{
}.
getType
();
return
Constant
.
GSON
.
fromJson
(
response
,
jsonType
);
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
log
.
error
(
"[queryCardRelation] param:{},请求业务系统异常:{}"
,
param
,
e
);
log
.
error
(
"{} 处理失败 param:{},response:{}, 异常信息:{}"
,
logPre
,
param
,
response
,
ExceptionUtils
.
getStackTrace
(
e
));
return
JsonResult
.
buildErrorStateResult
(
ErrorCodeEnum
.
RETURN_ERROR
.
getMessage
(),
ErrorCodeEnum
.
RETURN_ERROR
.
getCode
());
}
}
return
response
;
}
}
@Override
@Override
public
String
unBindCardRelation
(
UnBindCardModel
unBindCardModel
)
{
public
JsonResult
<
String
>
unBindCardRelation
(
UnBindCardModel
unBindCardModel
)
{
final
String
logPre
=
"XyqbServiceImpl.unBindCardRelation 银行卡解绑"
;
String
url
=
xyqbSysUrl
+
"/ex/customer_sys/unbundle/relation"
;
String
url
=
xyqbSysUrl
+
"/ex/customer_sys/unbundle/relation"
;
Map
<
String
,
Object
>
param
=
new
HashMap
<>(
4
);
Map
<
String
,
Object
>
param
=
JSONTools
.
toMap
(
unBindCardModel
);
Long
userId
=
unBindCardModel
.
getUserId
();
Long
bindCardRecordId
=
unBindCardModel
.
getBindCardRecordId
();
if
(
Objects
.
nonNull
(
bindCardRecordId
))
{
param
.
put
(
"bindCardRecordId"
,
bindCardRecordId
);
}
if
(
Objects
.
nonNull
(
userId
))
{
param
.
put
(
"userId"
,
userId
);
}
String
response
=
null
;
String
response
=
null
;
try
{
try
{
response
=
httpService
.
post
(
url
,
param
);
response
=
httpService
.
post
(
url
,
param
);
log
.
info
(
"[unBindCardRelation] param:{},请求业务系统返回值:{}"
,
param
,
response
);
log
.
info
(
"{} response={}"
,
logPre
,
response
);
if
(
StringUtils
.
isBlank
(
response
))
{
log
.
error
(
"{} 返回结果为null"
,
logPre
);
return
JsonResult
.
buildErrorStateResult
(
ErrorCodeEnum
.
RETURN_ERROR
.
getMessage
(),
ErrorCodeEnum
.
RETURN_ERROR
.
getCode
());
}
Type
jsonType
=
new
com
.
google
.
gson
.
reflect
.
TypeToken
<
JsonResult
<
String
>>()
{
}.
getType
();
return
Constant
.
GSON
.
fromJson
(
response
,
jsonType
);
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
log
.
error
(
"[unBindCardRelation] param:{},请求业务系统异常:{}"
,
param
,
e
);
log
.
error
(
"{} 处理失败 param:{},response:{}, 异常信息:{}"
,
logPre
,
param
,
response
,
ExceptionUtils
.
getStackTrace
(
e
));
return
JsonResult
.
buildErrorStateResult
(
ErrorCodeEnum
.
RETURN_ERROR
.
getMessage
(),
ErrorCodeEnum
.
RETURN_ERROR
.
getCode
());
}
}
return
response
;
}
}
@Override
@Override
public
String
modifyReservePhone
(
ModifyReservePhone
modifyReservePhone
)
{
public
JsonResult
<
String
>
modifyReservePhone
(
ModifyReservePhone
modifyReservePhone
)
{
final
String
logPre
=
"XyqbServiceImpl.modifyReservePhone 修改预留手机号"
;
String
url
=
xyqbSysUrl
+
"/ex/customer_sys/modify/reservedphone"
;
String
url
=
xyqbSysUrl
+
"/ex/customer_sys/modify/reservedphone"
;
Map
<
String
,
Object
>
param
=
new
HashMap
<>(
8
);
Map
<
String
,
Object
>
param
=
JSONTools
.
toMap
(
modifyReservePhone
);
Long
userId
=
modifyReservePhone
.
getUserId
();
Long
bankId
=
modifyReservePhone
.
getBankId
();
String
phoneNo
=
modifyReservePhone
.
getPhoneNo
();
if
(
Objects
.
nonNull
(
bankId
))
{
param
.
put
(
"bankId"
,
bankId
);
}
if
(
Objects
.
nonNull
(
userId
))
{
param
.
put
(
"userId"
,
userId
);
}
if
(
StringUtils
.
isNotBlank
(
phoneNo
))
{
param
.
put
(
"phoneNo"
,
phoneNo
);
}
String
response
=
null
;
String
response
=
null
;
try
{
try
{
response
=
httpService
.
post
(
url
,
param
);
response
=
httpService
.
post
(
url
,
param
);
log
.
info
(
"[modifyReservePhone] param:{},请求业务系统返回值:{}"
,
param
,
response
);
log
.
info
(
"{} response={}"
,
logPre
,
response
);
if
(
StringUtils
.
isBlank
(
response
))
{
log
.
error
(
"{} 返回结果为null"
,
logPre
);
return
JsonResult
.
buildErrorStateResult
(
ErrorCodeEnum
.
RETURN_ERROR
.
getMessage
(),
ErrorCodeEnum
.
RETURN_ERROR
.
getCode
());
}
Type
jsonType
=
new
com
.
google
.
gson
.
reflect
.
TypeToken
<
JsonResult
<
String
>>()
{
}.
getType
();
return
Constant
.
GSON
.
fromJson
(
response
,
jsonType
);
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
log
.
error
(
"[modifyReservePhone] param:{},请求业务系统异常:{}"
,
param
,
e
);
log
.
error
(
"{} 处理失败 param:{},response:{}, 异常信息:{}"
,
logPre
,
param
,
response
,
ExceptionUtils
.
getStackTrace
(
e
));
return
JsonResult
.
buildErrorStateResult
(
ErrorCodeEnum
.
RETURN_ERROR
.
getMessage
(),
ErrorCodeEnum
.
RETURN_ERROR
.
getCode
());
}
}
return
response
;
}
}
@Override
@Override
...
@@ -313,7 +335,7 @@ public class XyqbServiceImpl implements IXyqbService {
...
@@ -313,7 +335,7 @@ public class XyqbServiceImpl implements IXyqbService {
response
=
httpService
.
post
(
url
,
param
);
response
=
httpService
.
post
(
url
,
param
);
log
.
info
(
"[queryRepayOptRecords] param:{},请求业务系统返回值:{}"
,
param
,
response
);
log
.
info
(
"[queryRepayOptRecords] param:{},请求业务系统返回值:{}"
,
param
,
response
);
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
log
.
error
(
"[queryRepayOptRecords] param:{},请求业务系统异常:{}"
,
param
,
e
);
log
.
error
(
"[queryRepayOptRecords] param:{},请求业务系统异常:{}"
,
param
,
ExceptionUtils
.
getStackTrace
(
e
)
);
}
}
return
response
;
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