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
f939b0ea
Commit
f939b0ea
authored
Aug 16, 2020
by
黎博
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
新增查询状态接口
parent
d4b72a43
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
66 additions
and
126 deletions
+66
-126
QaPlatformApplication.java
src/main/java/cn/qg/qaplatform/QaPlatformApplication.java
+0
-1
GenLoanUserDataController.java
...n/qg/qaplatform/controller/GenLoanUserDataController.java
+9
-0
MainProcess.java
src/main/java/cn/qg/qaplatform/process/xyqb/MainProcess.java
+0
-1
GenUserDataService.java
...ain/java/cn/qg/qaplatform/service/GenUserDataService.java
+14
-0
GenUserDataServiceImpl.java
...cn/qg/qaplatform/service/impl/GenUserDataServiceImpl.java
+43
-0
RedisUtils.java
src/main/java/cn/qg/qaplatform/utils/RedisUtils.java
+0
-124
No files found.
src/main/java/cn/qg/qaplatform/QaPlatformApplication.java
View file @
f939b0ea
...
...
@@ -3,7 +3,6 @@ package cn.qg.qaplatform;
import
org.mybatis.spring.annotation.MapperScan
;
import
org.springframework.boot.SpringApplication
;
import
org.springframework.boot.autoconfigure.SpringBootApplication
;
import
org.springframework.scheduling.annotation.EnableAsync
;
@SpringBootApplication
@MapperScan
(
value
=
"cn.qg.qaplatform.dao"
)
...
...
src/main/java/cn/qg/qaplatform/controller/GenLoanUserDataController.java
View file @
f939b0ea
...
...
@@ -67,4 +67,13 @@ public class GenLoanUserDataController {
return
JsonResult
.
success
(
map
);
}
@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
);
}
}
src/main/java/cn/qg/qaplatform/process/xyqb/MainProcess.java
View file @
f939b0ea
...
...
@@ -3,7 +3,6 @@ package cn.qg.qaplatform.process.xyqb;
import
cn.qg.qaplatform.utils.DBUtils
;
import
cn.qg.qaplatform.utils.EncryptUtils
;
import
cn.qg.qaplatform.utils.HttpClientUtils
;
import
cn.qg.qaplatform.utils.RedisUtils
;
import
com.alibaba.fastjson.JSONArray
;
import
com.alibaba.fastjson.JSONObject
;
import
lombok.extern.slf4j.Slf4j
;
...
...
src/main/java/cn/qg/qaplatform/service/GenUserDataService.java
View file @
f939b0ea
...
...
@@ -27,5 +27,19 @@ public interface GenUserDataService {
*/
boolean
makeLoan
(
ApplyLoanInfo
applyLoanInfo
,
boolean
payStatus
)
throws
Exception
;
/**
* 造数据
* @param applyLoanInfo
* @return
* @throws Exception
*/
boolean
genLoanUser
(
ApplyLoanInfo
applyLoanInfo
)
throws
Exception
;
/**
* 获取用户状态
* @param namespace
* @param phoneNo
* @return
*/
Integer
queryUserStatus
(
String
namespace
,
String
phoneNo
);
}
src/main/java/cn/qg/qaplatform/service/impl/GenUserDataServiceImpl.java
View file @
f939b0ea
...
...
@@ -3,13 +3,24 @@ package cn.qg.qaplatform.service.impl;
import
cn.qg.qaplatform.domain.ApplyLoanInfo
;
import
cn.qg.qaplatform.process.xyqb.MainProcess
;
import
cn.qg.qaplatform.service.GenUserDataService
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.data.redis.core.RedisTemplate
;
import
org.springframework.stereotype.Service
;
import
javax.annotation.Resource
;
import
java.util.Map
;
import
java.util.concurrent.TimeUnit
;
@Service
@Slf4j
public
class
GenUserDataServiceImpl
implements
GenUserDataService
{
@Resource
RedisTemplate
redisTemplate
;
/**
* 授信
* @param applyLoanInfo 造数据的相关信息
...
...
@@ -57,6 +68,11 @@ 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
);
if
(
result
)
{
redisTemplate
.
opsForValue
().
set
(
namespace
+
"_"
+
phoneNo
,
0
);
log
.
info
(
"风控授信回调接口返回成功,设置redis缓存:"
+
namespace
+
"-"
+
phoneNo
+
": 0"
);
redisTemplate
.
expire
(
phoneNo
,
86400
,
TimeUnit
.
SECONDS
);
}
return
result
;
}
...
...
@@ -106,6 +122,10 @@ public class GenUserDataServiceImpl implements GenUserDataService {
boolean
result
=
MainProcess
.
externalQuotaOrderAuditNotify
(
namespace
,
token
,
uuid
,
loanId
,
0
);
// 修改合同状态
MainProcess
.
modifyContactStatus
(
namespace
,
userId
);
if
(
result
)
{
redisTemplate
.
opsForValue
().
set
(
namespace
+
"_"
+
phoneNo
,
1
);
log
.
info
(
"提现接口返回正常,设置redis缓存:"
+
namespace
+
"_"
+
phoneNo
+
": 1"
);
}
return
result
;
}
...
...
@@ -145,6 +165,10 @@ public class GenUserDataServiceImpl implements GenUserDataService {
Thread
.
sleep
(
30000
);
// 放款结果通知
boolean
result
=
MainProcess
.
payNotify
(
namespace
,
loanId
,
payStatus
);
if
(
result
)
{
redisTemplate
.
opsForValue
().
set
(
namespace
+
"_"
+
phoneNo
,
2
);
log
.
info
(
"提现成功,设置redis缓存:"
+
namespace
+
"-"
+
phoneNo
+
": 2"
);
}
return
result
;
}
...
...
@@ -214,5 +238,24 @@ public class GenUserDataServiceImpl implements GenUserDataService {
return
false
;
}
@Override
public
Integer
queryUserStatus
(
String
namespace
,
String
phoneNo
)
{
String
redisResult
=
redisTemplate
.
opsForValue
().
get
(
namespace
+
"_"
+
phoneNo
).
toString
();
log
.
info
(
"获取redis key结果为:"
+
redisResult
);
// 授信成功未提现
if
(
redisResult
.
equals
(
"0"
))
{
return
0
;
}
// 提现成功未放款
if
(
redisResult
.
equals
(
"1"
))
{
return
1
;
}
// 放款成功
if
(
redisResult
.
equals
(
"2"
))
{
return
2
;
}
return
null
;
}
}
src/main/java/cn/qg/qaplatform/utils/RedisUtils.java
deleted
100644 → 0
View file @
d4b72a43
package
cn
.
qg
.
qaplatform
.
utils
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.data.redis.core.RedisTemplate
;
import
org.springframework.stereotype.Component
;
import
org.springframework.util.CollectionUtils
;
import
javax.annotation.Resource
;
import
java.util.concurrent.TimeUnit
;
/**
* redis 工具类
*/
@Component
@Slf4j
public
class
RedisUtils
{
@Resource
private
RedisTemplate
<
String
,
Object
>
redisTemplate
;
/**
* 指定缓存失效时间
* @param key 键
* @param time 失效时间
* @return
*/
public
boolean
expire
(
String
key
,
long
time
)
{
try
{
if
(
time
>
0
)
{
redisTemplate
.
expire
(
key
,
time
,
TimeUnit
.
SECONDS
);
}
return
true
;
}
catch
(
Exception
e
)
{
log
.
error
(
key
,
e
);
return
false
;
}
}
/**
* 获取过期时间
* @param key 键
* @return
*/
public
long
getExpire
(
String
key
)
{
return
redisTemplate
.
getExpire
(
key
,
TimeUnit
.
SECONDS
);
}
/**
* 判断key是否存在
* @param key
* @return
*/
public
boolean
hasKey
(
String
key
)
{
try
{
return
redisTemplate
.
hasKey
(
key
);
}
catch
(
Exception
e
)
{
log
.
error
(
key
,
e
);
return
false
;
}
}
/**
* 删除缓存
* @param key
*/
@SuppressWarnings
(
"unchecked"
)
public
void
del
(
String
...
key
)
{
if
(
key
!=
null
&&
key
.
length
>
0
)
{
if
(
key
.
length
==
1
)
{
redisTemplate
.
delete
(
key
[
0
]);
}
else
{
redisTemplate
.
delete
(
CollectionUtils
.
arrayToList
(
key
));
}
}
}
/**
* 普通缓存获取
* @param key 键
* @return
*/
public
Object
get
(
String
key
)
{
return
key
==
null
?
null
:
redisTemplate
.
opsForValue
().
get
(
key
);
}
/**
* 普通缓存放入
* @param key 键
* @param value 值
* @return
*/
public
boolean
set
(
String
key
,
Object
value
)
{
try
{
redisTemplate
.
opsForValue
().
set
(
key
,
value
);
return
true
;
}
catch
(
Exception
e
)
{
log
.
error
(
key
,
e
);
return
false
;
}
}
/**
* 普通缓存放入并设置时间
* @param key 键
* @param value 值
* @param time 过期时间
* @return
*/
public
boolean
set
(
String
key
,
Object
value
,
long
time
)
{
try
{
if
(
time
>
0
)
{
redisTemplate
.
opsForValue
().
set
(
key
,
value
,
time
,
TimeUnit
.
SECONDS
);
}
else
{
set
(
key
,
value
);
}
return
true
;
}
catch
(
Exception
e
)
{
log
.
error
(
key
,
e
);
return
false
;
}
}
}
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