Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
A
asset-distribution
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
data-spider
asset-distribution
Commits
95a08bcd
Commit
95a08bcd
authored
Jan 17, 2020
by
liwenbin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
通知业务流系统订单状态增加下次操作时间
parent
7e0f8ccc
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
84 additions
and
30 deletions
+84
-30
ConsumerConfig.java
...up/asset/distribution/config/rabbitmq/ConsumerConfig.java
+20
-7
IAssetDistributeService.java
...tribution/service/distribute/IAssetDistributeService.java
+1
-1
AssetDistributeServiceImpl.java
...n/service/distribute/impl/AssetDistributeServiceImpl.java
+2
-2
INotifyService.java
...oup/asset/distribution/service/notify/INotifyService.java
+2
-1
NotifyServiceImpl.java
...t/distribution/service/notify/impl/NotifyServiceImpl.java
+29
-9
DistributeTest.java
...ntgroup/asset/distribution/distribute/DistributeTest.java
+13
-9
NotifyTest.java
.../com/quantgroup/asset/distribution/notify/NotifyTest.java
+17
-1
No files found.
src/main/java/com/quantgroup/asset/distribution/config/rabbitmq/ConsumerConfig.java
View file @
95a08bcd
...
...
@@ -71,13 +71,14 @@ public class ConsumerConfig implements RabbitListenerConfigurer {
JSONObject
jo
=
JSONObject
.
parseObject
(
ms
);
String
noticeType
=
jo
.
getString
(
"noticeType"
);
if
(
FundingResult
.
REJECT
.
getCode
().
equals
(
noticeType
)
//
|| FundingResult.HANG_UP.getCode().equals(noticeType)
||
FundingResult
.
HANG_UP
.
getCode
().
equals
(
noticeType
)
||
FundingResult
.
CANCEL_LOAN
.
getCode
().
equals
(
noticeType
)
||
FundingResult
.
FUAD_ASSIGN_SUCC
.
getCode
().
equals
(
noticeType
)){
log
.
info
(
"资金路由有效MQ消息接收, 消息内容 : {} "
,
ms
);
String
applyNo
=
jo
.
getJSONObject
(
"data"
).
getString
(
"applyNo"
);
String
nextOperateDate
=
getNextOperateDate
(
jo
,
noticeType
);
iAidFundRouteRecordService
.
fundingResultNotity
(
applyNo
,
FundingResult
.
fromCode
(
noticeType
));
distributeService
.
receiveFundingResult
(
applyNo
,
FundingResult
.
fromCode
(
noticeType
));
distributeService
.
receiveFundingResult
(
applyNo
,
FundingResult
.
fromCode
(
noticeType
)
,
nextOperateDate
);
log
.
info
(
"资金路由有效MQ消息处理结束, bizNo : {} ,noticeType : {} , 耗时 : {} "
,
applyNo
,
noticeType
,
stopwatch
.
stop
().
elapsed
(
TimeUnit
.
MILLISECONDS
));
}
// 采用手动应答模式, 手动确认应答更为安全稳定
...
...
@@ -94,10 +95,22 @@ public class ConsumerConfig implements RabbitListenerConfigurer {
}
/**
* 获取下次可操作之间, 只有拒绝才有
* @param jo
* @return
*/
private
String
getNextOperateDate
(
JSONObject
jo
,
String
noticeType
)
{
try
{
if
(
FundingResult
.
REJECT
.
getCode
().
equals
(
noticeType
))
{
return
jo
.
getJSONObject
(
"extraData"
).
getString
(
"nextOperateDate"
);
}
return
null
;
}
catch
(
Exception
e
)
{
log
.
error
(
"资金路由结果消息解析下次可操作时间异常!"
,
e
);
return
null
;
}
}
}
src/main/java/com/quantgroup/asset/distribution/service/distribute/IAssetDistributeService.java
View file @
95a08bcd
...
...
@@ -27,5 +27,5 @@ public interface IAssetDistributeService {
* @param bizNo
* @param fundingResult
*/
public
void
receiveFundingResult
(
String
bizNo
,
FundingResult
fundingResult
);
public
void
receiveFundingResult
(
String
bizNo
,
FundingResult
fundingResult
,
String
nextOperateDate
);
}
src/main/java/com/quantgroup/asset/distribution/service/distribute/impl/AssetDistributeServiceImpl.java
View file @
95a08bcd
...
...
@@ -206,13 +206,13 @@ public class AssetDistributeServiceImpl implements IAssetDistributeService{
* 接收fundingResult消息
*/
@Override
public
void
receiveFundingResult
(
String
bizNo
,
FundingResult
fundingResult
)
{
public
void
receiveFundingResult
(
String
bizNo
,
FundingResult
fundingResult
,
String
nextOperateDate
)
{
try
{
Stopwatch
stopwatch
=
Stopwatch
.
createStarted
();
// 1、更改分配记录状态
assetDistributeRecordService
.
updateAssetDistributeStatus
(
bizNo
,
fundingResult
==
FundingResult
.
FUAD_ASSIGN_SUCC
?
StatusConstants
.
SUCCESS
:
StatusConstants
.
FAIL
);
// 2、通知业务流系统
notifyService
.
notifyBusinessFlow
(
bizNo
,
fundingResult
==
FundingResult
.
FUAD_ASSIGN_SUCC
?
StatusConstants
.
SUCCESS
:
StatusConstants
.
FAIL
);
notifyService
.
notifyBusinessFlow
(
bizNo
,
fundingResult
,
nextOperateDate
);
// 3、重新进行分发, 目前还没有,等接了助贷资金路由以后再增加
log
.
info
(
"资产分发接收资金结果处理结束, bizNo : {}, fundingResult : {}, 耗时 : {}"
,
bizNo
,
fundingResult
.
getCode
(),
stopwatch
.
stop
().
elapsed
(
TimeUnit
.
MILLISECONDS
));
}
catch
(
QGException
qe
)
{
...
...
src/main/java/com/quantgroup/asset/distribution/service/notify/INotifyService.java
View file @
95a08bcd
...
...
@@ -2,6 +2,7 @@ package com.quantgroup.asset.distribution.service.notify;
import
java.util.Map
;
import
com.quantgroup.asset.distribution.enums.funding.FundingResult
;
import
com.quantgroup.asset.distribution.model.form.AssetForm
;
/**
...
...
@@ -20,5 +21,5 @@ public interface INotifyService {
/**
* 通知业务流系统
*/
public
void
notifyBusinessFlow
(
String
bizNo
,
Integer
status
);
public
void
notifyBusinessFlow
(
String
bizNo
,
FundingResult
fundResult
,
String
nextOperateDate
);
}
src/main/java/com/quantgroup/asset/distribution/service/notify/impl/NotifyServiceImpl.java
View file @
95a08bcd
...
...
@@ -10,6 +10,7 @@ import org.springframework.stereotype.Service;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSONObject
;
import
com.quantgroup.asset.distribution.enums.funding.FundingResult
;
import
com.quantgroup.asset.distribution.exception.QGException
;
import
com.quantgroup.asset.distribution.exception.QGExceptionType
;
import
com.quantgroup.asset.distribution.model.form.AssetForm
;
...
...
@@ -50,26 +51,45 @@ public class NotifyServiceImpl implements INotifyService{
}
@Override
public
void
notifyBusinessFlow
(
String
bizNo
,
Integer
status
)
{
public
void
notifyBusinessFlow
(
String
bizNo
,
FundingResult
fundingResult
,
String
nextOperateDate
)
{
try
{
if
(
isDebug
)
{
return
;
}
log
.
info
(
"通知业务流系统订单终态开始, bizNo : {},
status : {}"
,
bizNo
,
status
);
log
.
info
(
"通知业务流系统订单终态开始, bizNo : {},
fundingResult : {}, nextOperateDate : {}"
,
bizNo
,
fundingResult
.
name
(),
nextOperateDate
);
String
response
=
httpService
.
post
(
businessFlowURL
+
"/ex/inner/accept_info"
,
new
HashMap
<
String
,
String
>(){{
put
(
"applyNo"
,
bizNo
);
put
(
"status"
,
status
+
""
);
put
(
"status"
,
getNotifyBusinessFlowStatusByFundingResult
(
fundingResult
)
+
""
);
put
(
"type"
,
"5"
);
put
(
"auditValidTime"
,
nextOperateDate
);
}});
log
.
info
(
"通知业务流系统订单终态结束, bizNo : {},
status : {}, response : {}"
,
bizNo
,
status
,
response
);
log
.
info
(
"通知业务流系统订单终态结束, bizNo : {},
fundingResult : {}, nextOperateDate, response : {}"
,
bizNo
,
fundingResult
.
name
(),
nextOperateDate
,
response
);
JSONObject
data
=
null
;
if
(
StringUtils
.
isEmpty
(
response
)
||
(
data
=
JSON
.
parseObject
(
response
)).
getInteger
(
"code"
)
!=
0
)
{
throw
new
QGException
(
QGExceptionType
.
NOTIFY_BUSINESS_FLOW_ERROR
,
bizNo
,
status
);
throw
new
QGException
(
QGExceptionType
.
NOTIFY_BUSINESS_FLOW_ERROR
,
bizNo
,
fundingResult
.
name
()
);
}
}
catch
(
QGException
qe
)
{
log
.
error
(
"资产分发订单终态通知业务流系统出现错误, 错误信息 : {}, bizNo : {},
status : {}"
,
qe
.
qgExceptionType
.
code
+
"->"
+
qe
.
detail
,
bizNo
,
status
);
alarmService
.
dingtalkAlarm
(
"Warn"
,
"通知业务流系统订单终态出现错误"
,
"错误信息 : "
+
qe
.
qgExceptionType
.
code
+
"->"
+
qe
.
detail
+
" , bizNo : "
+
bizNo
+
" , "
+
"status : "
+
status
);
log
.
error
(
"资产分发订单终态通知业务流系统出现错误, 错误信息 : {}, bizNo : {},
fundingResult : {}"
,
qe
.
qgExceptionType
.
code
+
"->"
+
qe
.
detail
,
bizNo
,
fundingResult
.
name
()
);
alarmService
.
dingtalkAlarm
(
"Warn"
,
"通知业务流系统订单终态出现错误"
,
"错误信息 : "
+
qe
.
qgExceptionType
.
code
+
"->"
+
qe
.
detail
+
" , bizNo : "
+
bizNo
+
" , "
+
"status : "
+
fundingResult
.
name
()
);
}
catch
(
Exception
e
)
{
log
.
error
(
"资产分发订单终态通知业务流系统异常, bizNo : {}, status : {}"
,
bizNo
,
status
);
alarmService
.
dingtalkAlarm
(
"Warn"
,
"通知业务流系统订单终态异常"
,
"bizNo : "
+
bizNo
+
" , "
+
"status : "
+
status
);
log
.
error
(
"资产分发订单终态通知业务流系统异常, bizNo : {}, fundingResult : {}"
,
bizNo
,
fundingResult
.
name
());
alarmService
.
dingtalkAlarm
(
"Warn"
,
"通知业务流系统订单终态异常"
,
"bizNo : "
+
bizNo
+
" , "
+
"status : "
+
fundingResult
.
name
());
}
}
/**
* @return
* @param fundingResult
*/
private
int
getNotifyBusinessFlowStatusByFundingResult
(
FundingResult
fundingResult
)
{
if
(
fundingResult
==
FundingResult
.
FUAD_ASSIGN_SUCC
)
{
return
1
;
}
else
if
(
fundingResult
==
FundingResult
.
REJECT
)
{
return
0
;
}
else
if
(
fundingResult
==
FundingResult
.
CANCEL_LOAN
)
{
return
2
;
}
else
if
(
fundingResult
==
FundingResult
.
HANG_UP
)
{
return
3
;
}
else
{
return
-
1
;
}
}
}
src/test/java/com/quantgroup/asset/distribution/distribute/DistributeTest.java
View file @
95a08bcd
...
...
@@ -19,6 +19,7 @@ import com.quantgroup.asset.distribution.AssetDistributionBootstrap;
import
com.quantgroup.asset.distribution.constant.StatusConstants
;
import
com.quantgroup.asset.distribution.enums.funding.FundingResult
;
import
com.quantgroup.asset.distribution.model.entity.DistributeRecord
;
import
com.quantgroup.asset.distribution.service.asset.IAssetAttributeExtendConfigService
;
import
com.quantgroup.asset.distribution.service.distribute.IAssetDistributeRecordService
;
import
com.quantgroup.asset.distribution.service.distribute.IAssetDistributeService
;
import
com.quantgroup.asset.distribution.service.httpclient.IHttpService
;
...
...
@@ -37,6 +38,8 @@ public class DistributeTest {
private
IHttpService
httpService
;
@Autowired
private
IAssetDistributeService
distributeService
;
@Autowired
private
IAssetAttributeExtendConfigService
service
;
@Test
public
void
testEn
()
{
...
...
@@ -63,14 +66,15 @@ public class DistributeTest {
@Test
public
void
testHttp
()
{
String
result
=
httpService
.
post
(
"http://localhost:9050"
+
"/feature/get"
,
new
HashMap
<
String
,
String
>(){{
put
(
"uuid"
,
"123213"
);
put
(
"bizChannel"
,
"123213"
);
put
(
"bizNo"
,
"1232131"
);
put
(
"bizType"
,
"123213131"
);
put
(
"keys"
,
"12321321"
);
put
(
"method"
,
"0"
);
}});
// String result = httpService.post("http://localhost:9050" + "/feature/get", new HashMap<String, String>(){{
// put("uuid", "123213");
// put("bizChannel", "123213");
// put("bizNo", "1232131");
// put("bizType", "123213131");
// put("keys", "12321321");
// put("method", "0");
// }});
service
.
clearAllExtendConfigCache
();
}
@Test
...
...
@@ -78,7 +82,7 @@ public class DistributeTest {
// AssetDistributeRecord record = assetDistributeRecordRepository.findByBizNoOrderByCreatedAtDescLimitOne("1231231231231");
// record.setAssetDistributeStatus(StatusConstants.SUCCESS);
// assetDistributeRecordRepository.save(record);
distributeService
.
receiveFundingResult
(
"SP499997499085250626417877"
,
FundingResult
.
FUAD_ASSIGN_SUCC
);
distributeService
.
receiveFundingResult
(
"SP499997499085250626417877"
,
FundingResult
.
FUAD_ASSIGN_SUCC
,
System
.
currentTimeMillis
()
+
""
);
}
public
static
void
main
(
String
[]
args
)
{
...
...
src/test/java/com/quantgroup/asset/distribution/notify/NotifyTest.java
View file @
95a08bcd
...
...
@@ -7,6 +7,8 @@ import org.springframework.boot.test.context.SpringBootTest;
import
org.springframework.test.context.junit4.SpringRunner
;
import
com.quantgroup.asset.distribution.AssetDistributionBootstrap
;
import
com.quantgroup.asset.distribution.enums.funding.FundingResult
;
import
com.quantgroup.asset.distribution.service.httpclient.IHttpService
;
import
com.quantgroup.asset.distribution.service.notify.INotifyService
;
@RunWith
(
SpringRunner
.
class
)
...
...
@@ -15,9 +17,23 @@ public class NotifyTest {
@Autowired
private
INotifyService
notifyService
;
@Autowired
private
IHttpService
httpService
;
@Test
public
void
testBusinessFlow
()
{
notifyService
.
notifyBusinessFlow
(
"SP527400898415178843596841"
,
0
);
notifyService
.
notifyBusinessFlow
(
"SP527400898415178843596841"
,
FundingResult
.
REJECT
,
System
.
currentTimeMillis
()
+
""
);
}
@Test
public
void
test
()
{
httpService
.
get
(
"https://www.baidu.com"
);
}
public
static
void
main
(
String
[]
args
)
{
String
a
=
"2019-11-12 01:20:30"
;
String
b
=
"2019-11-12 01:20:30"
;
System
.
out
.
println
(
a
.
length
());
}
}
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