Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Q
qa-platform
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
QA
qa-platform
Commits
638ad886
Commit
638ad886
authored
Aug 19, 2020
by
黎博
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
更新造数据接口
parent
1a6b9fba
Changes
8
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
111 additions
and
24 deletions
+111
-24
GenLoanUserDataController.java
...n/qg/qaplatform/controller/GenLoanUserDataController.java
+3
-4
QueryBasicLoanStatusDataMapper.java
.../cn/qg/qaplatform/dao/QueryBasicLoanStatusDataMapper.java
+8
-0
GenLoanUser.java
src/main/java/cn/qg/qaplatform/domain/GenLoanUser.java
+43
-0
GenUserDataService.java
...ain/java/cn/qg/qaplatform/service/GenUserDataService.java
+2
-1
QueryBasicLoanStatusDataService.java
...g/qaplatform/service/QueryBasicLoanStatusDataService.java
+2
-1
GenUserDataServiceImpl.java
...cn/qg/qaplatform/service/impl/GenUserDataServiceImpl.java
+43
-15
QueryBasicLoanStatusDataServiceImpl.java
...orm/service/impl/QueryBasicLoanStatusDataServiceImpl.java
+4
-3
QueryBasicLoanStatusDataMapper.xml
src/main/resources/mapper/QueryBasicLoanStatusDataMapper.xml
+6
-0
No files found.
src/main/java/cn/qg/qaplatform/controller/GenLoanUserDataController.java
View file @
638ad886
...
...
@@ -4,6 +4,7 @@ import cn.qg.qaplatform.common.JsonResult;
import
cn.qg.qaplatform.common.enums.ChannelEnum
;
import
cn.qg.qaplatform.common.enums.FundEnum
;
import
cn.qg.qaplatform.domain.ApplyLoanInfo
;
import
cn.qg.qaplatform.domain.GenLoanUser
;
import
cn.qg.qaplatform.service.GenUserDataService
;
import
cn.qg.qaplatform.service.QueryBasicLoanStatusDataService
;
import
cn.qg.qaplatform.utils.EnumUtils
;
...
...
@@ -81,10 +82,8 @@ public class GenLoanUserDataController {
@GetMapping
(
"/userStatus"
)
public
JsonResult
queryUserStatus
(
@RequestParam
String
namespace
,
@RequestParam
String
phoneNo
)
{
Integer
status
=
genUserDataService
.
queryUserStatus
(
namespace
,
phoneNo
);
Map
map
=
new
HashMap
();
map
.
put
(
"status"
,
status
);
return
JsonResult
.
success
(
map
);
GenLoanUser
genLoanUser
=
genUserDataService
.
queryUserStatus
(
namespace
,
phoneNo
);
return
JsonResult
.
success
(
genLoanUser
);
}
}
src/main/java/cn/qg/qaplatform/dao/QueryBasicLoanStatusDataMapper.java
View file @
638ad886
package
cn
.
qg
.
qaplatform
.
dao
;
import
cn.qg.qaplatform.domain.GenLoanUser
;
import
cn.qg.qaplatform.domain.LoanUser
;
import
org.apache.ibatis.annotations.Param
;
...
...
@@ -61,5 +62,12 @@ public interface QueryBasicLoanStatusDataMapper {
*/
List
<
String
>
getMultiOrderuuidList
();
/**
* 根据userId获取资方id
* @param userId
* @return
*/
Integer
getAssignFundIdByUserId
(
String
userId
);
GenLoanUser
getUserInfoByPhoneNo
(
String
phoneNo
);
}
src/main/java/cn/qg/qaplatform/domain/GenLoanUser.java
0 → 100644
View file @
638ad886
package
cn
.
qg
.
qaplatform
.
domain
;
import
lombok.Data
;
import
java.util.Date
;
@Data
public
class
GenLoanUser
{
/**
* 手机号
*/
private
String
phoneNo
;
/**
* 用户id
*/
private
String
userId
;
/**
* uuid
*/
private
String
uuid
;
/**
* 创建渠道
*/
private
Long
registeredFrom
;
/**
* 分配的资方
*/
private
Integer
fundId
;
/**
* 创建日期
*/
private
Date
createdAt
;
/**
* 当前状态
*/
private
String
status
;
}
src/main/java/cn/qg/qaplatform/service/GenUserDataService.java
View file @
638ad886
package
cn
.
qg
.
qaplatform
.
service
;
import
cn.qg.qaplatform.domain.ApplyLoanInfo
;
import
cn.qg.qaplatform.domain.GenLoanUser
;
import
java.sql.SQLException
;
...
...
@@ -41,5 +42,5 @@ public interface GenUserDataService {
* @param phoneNo
* @return
*/
Integ
er
queryUserStatus
(
String
namespace
,
String
phoneNo
);
GenLoanUs
er
queryUserStatus
(
String
namespace
,
String
phoneNo
);
}
src/main/java/cn/qg/qaplatform/service/QueryBasicLoanStatusDataService.java
View file @
638ad886
package
cn
.
qg
.
qaplatform
.
service
;
import
cn.qg.qaplatform.domain.GenLoanUser
;
import
cn.qg.qaplatform.domain.LoanUser
;
import
java.util.List
;
...
...
@@ -68,5 +69,5 @@ public interface QueryBasicLoanStatusDataService {
/**
* 根据手机号查询用户信息
*/
LoanUser
getUserInfoByPhoneNo
(
String
namespace
,
String
phoneNo
);
Gen
LoanUser
getUserInfoByPhoneNo
(
String
namespace
,
String
phoneNo
);
}
src/main/java/cn/qg/qaplatform/service/impl/GenUserDataServiceImpl.java
View file @
638ad886
package
cn
.
qg
.
qaplatform
.
service
.
impl
;
import
cn.qg.qaplatform.domain.ApplyLoanInfo
;
import
cn.qg.qaplatform.domain.GenLoanUser
;
import
cn.qg.qaplatform.process.xyqb.MainProcess
;
import
cn.qg.qaplatform.service.GenUserDataService
;
import
cn.qg.qaplatform.service.QueryBasicLoanStatusDataService
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.data.redis.core.RedisTemplate
;
...
...
@@ -20,6 +22,8 @@ public class GenUserDataServiceImpl implements GenUserDataService {
@Resource
RedisTemplate
redisTemplate
;
@Autowired
QueryBasicLoanStatusDataService
queryBasicLoanStatusDataService
;
/**
* 授信
...
...
@@ -68,10 +72,13 @@ public class GenUserDataServiceImpl implements GenUserDataService {
String
productId
=
authResult
.
get
(
"product_id"
).
toString
();
// 风控授信回调
boolean
result
=
MainProcess
.
creditAuthNotify
(
namespace
,
token
,
uuid
,
channelId
,
fundId
,
orderNo
,
0
,
auditResult
,
amount
,
term
);
String
redisKey
=
namespace
+
"_"
+
phoneNo
;
if
(
result
)
{
redisTemplate
.
opsForValue
().
set
(
namespace
+
"_"
+
phoneNo
,
0
);
log
.
info
(
"风控授信回调接口返回成功,设置redis缓存:"
+
namespace
+
"-"
+
phoneNo
+
": 0"
);
redisTemplate
.
expire
(
phoneNo
,
86400
,
TimeUnit
.
SECONDS
);
redisTemplate
.
opsForValue
().
set
(
redisKey
,
0
);
log
.
info
(
"风控授信回调接口返回成功,设置redis缓存:"
+
redisKey
+
": 0"
);
}
else
{
redisTemplate
.
opsForValue
().
set
(
redisKey
,
1
);
log
.
info
(
"风控授信回调接口返回失败,设置redis缓存:"
+
redisKey
+
": 1"
);
}
return
result
;
}
...
...
@@ -122,9 +129,13 @@ public class GenUserDataServiceImpl implements GenUserDataService {
boolean
result
=
MainProcess
.
externalQuotaOrderAuditNotify
(
namespace
,
token
,
uuid
,
loanId
,
0
);
// 修改合同状态
MainProcess
.
modifyContactStatus
(
namespace
,
userId
);
String
redisKey
=
namespace
+
"_"
+
phoneNo
;
if
(
result
)
{
redisTemplate
.
opsForValue
().
set
(
namespace
+
"_"
+
phoneNo
,
1
);
log
.
info
(
"提现接口返回正常,设置redis缓存:"
+
namespace
+
"_"
+
phoneNo
+
": 1"
);
redisTemplate
.
opsForValue
().
set
(
redisKey
,
2
);
log
.
info
(
"提现成功,设置redis缓存:"
+
redisKey
+
": 2"
);
}
else
{
redisTemplate
.
opsForValue
().
set
(
redisKey
,
3
);
log
.
info
(
"提现失败,设置redis缓存:"
+
redisKey
+
": 3"
);
}
return
result
;
}
...
...
@@ -166,8 +177,11 @@ public class GenUserDataServiceImpl implements GenUserDataService {
// 放款结果通知
boolean
result
=
MainProcess
.
payNotify
(
namespace
,
loanId
,
payStatus
);
if
(
result
)
{
redisTemplate
.
opsForValue
().
set
(
namespace
+
"_"
+
phoneNo
,
2
);
log
.
info
(
"提现成功,设置redis缓存:"
+
namespace
+
"-"
+
phoneNo
+
": 2"
);
redisTemplate
.
opsForValue
().
set
(
namespace
+
"_"
+
phoneNo
,
4
);
log
.
info
(
"放款成功,设置redis缓存:"
+
namespace
+
"-"
+
phoneNo
+
": 4"
);
}
else
{
redisTemplate
.
opsForValue
().
set
(
namespace
+
"_"
+
phoneNo
,
5
);
log
.
info
(
"放款失败,设置redis缓存:"
+
namespace
+
"-"
+
phoneNo
+
": 5"
);
}
return
result
;
}
...
...
@@ -239,22 +253,36 @@ public class GenUserDataServiceImpl implements GenUserDataService {
}
@Override
public
Integ
er
queryUserStatus
(
String
namespace
,
String
phoneNo
)
{
public
GenLoanUs
er
queryUserStatus
(
String
namespace
,
String
phoneNo
)
{
String
redisResult
=
redisTemplate
.
opsForValue
().
get
(
namespace
+
"_"
+
phoneNo
).
toString
();
log
.
info
(
"获取redis key结果为:"
+
redisResult
);
// 授信成功未提现
GenLoanUser
genLoanUser
=
new
GenLoanUser
();
genLoanUser
=
queryBasicLoanStatusDataService
.
getUserInfoByPhoneNo
(
namespace
,
phoneNo
);
// 资方审核中
if
(
redisResult
.
equals
(
"0"
))
{
return
0
;
genLoanUser
.
setStatus
(
"资方审核中..."
)
;
}
//
提现成功未放款
//
资方审核失败
if
(
redisResult
.
equals
(
"1"
))
{
return
1
;
genLoanUser
.
setStatus
(
"资方审核失败"
)
;
}
//
放款
成功
//
提现
成功
if
(
redisResult
.
equals
(
"2"
))
{
return
2
;
genLoanUser
.
setStatus
(
"提现成功"
);
}
// 提现失败
if
(
redisResult
.
equals
(
"3"
))
{
genLoanUser
.
setStatus
(
"提现失败"
);
}
// 放款成功
if
(
redisResult
.
equals
(
"4"
))
{
genLoanUser
.
setStatus
(
"放款成功"
);
}
// 放款失败
if
(
redisResult
.
equals
(
"5"
))
{
genLoanUser
.
setStatus
(
"放款失败"
);
}
return
null
;
return
genLoanUser
;
}
...
...
src/main/java/cn/qg/qaplatform/service/impl/QueryBasicLoanStatusDataServiceImpl.java
View file @
638ad886
...
...
@@ -3,6 +3,7 @@ package cn.qg.qaplatform.service.impl;
import
cn.qg.qaplatform.common.enums.LoanStatus
;
import
cn.qg.qaplatform.common.enums.Namespace
;
import
cn.qg.qaplatform.dao.QueryBasicLoanStatusDataMapper
;
import
cn.qg.qaplatform.domain.GenLoanUser
;
import
cn.qg.qaplatform.domain.LoanUser
;
import
cn.qg.qaplatform.common.SwitchDataSource
;
import
cn.qg.qaplatform.service.QueryBasicLoanStatusDataService
;
...
...
@@ -171,8 +172,8 @@ public class QueryBasicLoanStatusDataServiceImpl implements QueryBasicLoanStatus
}
@Override
public
LoanUser
getUserInfoByPhoneNo
(
String
namespace
,
String
phoneNo
)
{
SwitchDataSource
.
dataSourceSwitch
(
namespace
,
"xyqb"
);
return
null
;
public
Gen
LoanUser
getUserInfoByPhoneNo
(
String
namespace
,
String
phoneNo
)
{
SwitchDataSource
.
dataSourceSwitch
(
namespace
,
"xyqb
_user
"
);
return
basicLoanStatusDataMapper
.
getUserInfoByPhoneNo
(
phoneNo
)
;
}
}
src/main/resources/mapper/QueryBasicLoanStatusDataMapper.xml
View file @
638ad886
...
...
@@ -93,4 +93,10 @@
WHERE `user_id` = #{userId} order by id desc limit 0,1
</select>
<!-- 根据手机号获取用户信息-->
<select
id=
"getUserInfoByPhoneNo"
resultType=
"cn.qg.qaplatform.domain.GenLoanUser"
>
SELECT `id` as userId, `phone_no` as phoneNo, `uuid`, `registered_from` as registeredFrom, `created_at` as createdAt FROM `user`
WHERE `phone_no` = #{phoneNo}
</select>
</mapper>
\ No newline at end of file
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