Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
W
windows
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
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
zhanhai
windows
Commits
19a5ace1
Commit
19a5ace1
authored
Oct 30, 2023
by
BlackJokerCJ
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
xiyi
parent
b918d2f8
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
73 additions
and
28 deletions
+73
-28
CreditThirdDataListener.java
...a/com/jqtx/windows/common/mq/CreditThirdDataListener.java
+29
-4
CreditThirdDataJob.java
src/main/java/com/jqtx/windows/job/CreditThirdDataJob.java
+44
-24
No files found.
src/main/java/com/jqtx/windows/common/mq/CreditThirdDataListener.java
View file @
19a5ace1
...
...
@@ -16,6 +16,7 @@ import com.jqtx.windows.component.model.LoanModel;
import
com.jqtx.windows.utils.AbcHttpClient
;
import
com.jqtx.windows.web.response.WithdrawDetailResponse
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
java.time.LocalDateTime
;
...
...
@@ -43,17 +44,41 @@ public class CreditThirdDataListener extends AbstractMQConsumerHandler<JSONObjec
@Override
public
void
run
(
JSONObject
req
)
throws
Exception
{
CreditModel
creditModel
=
creditComponent
.
getByOrderNo
(
req
.
getString
(
"orderNo"
));
String
orderNo
=
req
.
getString
(
"orderNo"
);
String
loanNo
=
req
.
getString
(
"loanNo"
);
if
(
StringUtils
.
isNotEmpty
(
orderNo
)&&
StringUtils
.
isEmpty
(
loanNo
)){
credit
(
orderNo
);
}
else
{
withdraw
(
orderNo
,
loanNo
);
}
}
private
void
credit
(
String
orderNo
)
{
CreditModel
creditModel
=
creditComponent
.
getByOrderNo
(
orderNo
);
if
(
creditModel
!=
null
&&
creditModel
.
getCreditThirdStatus
()!=
"INIT"
){
log
.
info
(
"req:[{}]"
,
req
.
toJSONString
());
JSONObject
thirdCredit
=
new
JSONObject
();
thirdCredit
.
put
(
"reqNo"
,
req
.
getString
(
"orderNo"
)
);
thirdCredit
.
put
(
"reqNo"
,
orderNo
);
thirdCredit
.
put
(
"type"
,
"01"
);
abcHttpClient
.
postRequest
(
thirdCredit
.
toJSONString
(),
ZNPostUrlEnum
.
CREDIT_APPLY
.
getCode
());
CreditModel
creditModel1
=
new
CreditModel
();
creditModel1
.
setCreditThirdStatus
(
"INIT"
);
creditModel1
.
setCreditThirdUrl
(
""
);
creditComponent
.
updateByOrderNo
(
req
.
getString
(
"orderNo"
),
creditModel1
);
creditComponent
.
updateByOrderNo
(
orderNo
,
creditModel1
);
}
}
private
void
withdraw
(
String
orderNo
,
String
loanNo
)
{
CreditModel
creditModel
=
creditComponent
.
getByOrderNo
(
orderNo
);
if
(
creditModel
!=
null
&&
creditModel
.
getCreditThirdStatus
()!=
"INIT-WITHDRAW"
){
JSONObject
thirdCredit
=
new
JSONObject
();
thirdCredit
.
put
(
"reqNo"
,
loanNo
);
thirdCredit
.
put
(
"type"
,
"02"
);
abcHttpClient
.
postRequest
(
thirdCredit
.
toJSONString
(),
ZNPostUrlEnum
.
CREDIT_APPLY
.
getCode
());
CreditModel
creditModel1
=
new
CreditModel
();
creditModel1
.
setCreditThirdStatus
(
"INIT-WITHDRAW"
);
creditModel1
.
setCreditThirdUrl
(
""
);
creditComponent
.
updateByOrderNo
(
orderNo
,
creditModel1
);
}
}
}
...
...
src/main/java/com/jqtx/windows/job/CreditThirdDataJob.java
View file @
19a5ace1
...
...
@@ -5,8 +5,10 @@ import com.alibaba.fastjson.JSONArray;
import
com.alibaba.fastjson.JSONObject
;
import
com.jqtx.infrastructure.oss.starter.config.OssUtils
;
import
com.jqtx.windows.component.CreditComponent
;
import
com.jqtx.windows.component.LoanComponent
;
import
com.jqtx.windows.component.enums.ZNPostUrlEnum
;
import
com.jqtx.windows.component.model.CreditModel
;
import
com.jqtx.windows.component.model.LoanModel
;
import
com.jqtx.windows.component.model.ZyJsonResult
;
import
com.jqtx.windows.utils.AbcHttpClient
;
import
com.xxl.job.core.handler.annotation.XxlJob
;
...
...
@@ -28,6 +30,9 @@ public class CreditThirdDataJob {
@Autowired
private
AbcHttpClient
abcHttpClient
;
@Autowired
private
LoanComponent
loanComponent
;
@Autowired
private
OssUtils
ossUtils
;
...
...
@@ -40,33 +45,48 @@ public class CreditThirdDataJob {
thirdCredit
.
put
(
"type"
,
"01"
);
ZyJsonResult
zyJsonResult
=
abcHttpClient
.
postRequest
(
thirdCredit
.
toJSONString
(),
ZNPostUrlEnum
.
CREDIT_QUERY
.
getCode
());
JSONArray
jsonArray
=
zyJsonResult
.
getExternalInfo
();
JSONObject
thirdData
=
new
JSONObject
();
for
(
int
i
=
0
;
i
<
jsonArray
.
size
();
i
++)
{
JSONObject
jsonObject
=
(
JSONObject
)
jsonArray
.
get
(
i
);
log
.
info
(
"dataSource:[{}],data:[{}]"
,
jsonObject
.
getString
(
"dataSource"
),
jsonObject
.
getJSONObject
(
"data"
));
if
(
"TENCENT_FRAUD_VIP"
.
equals
(
jsonObject
.
getString
(
"dataSource"
))){
thirdData
.
put
(
"PD_TENCENT_FRAUD"
,
jsonObject
.
getJSONObject
(
"data"
));
}
else
if
(
"TENCENT_FRAUD_SUMMIT"
.
equals
(
jsonObject
.
getString
(
"dataSource"
))){
thirdData
.
put
(
"PD_TENCENT_FRAUD_VIP"
,
jsonObject
.
getJSONObject
(
"data"
));
}
else
if
(
"RONG360_BLACK_LIST"
.
equals
(
jsonObject
.
getString
(
"dataSource"
))){
thirdData
.
put
(
"PD_R360_ZHDZPF_V2"
,
jsonObject
.
getJSONObject
(
"data"
));
}
else
if
(
"RONG360_ZXFV3_SCORE"
.
equals
(
jsonObject
.
getString
(
"dataSource"
))){
thirdData
.
put
(
"PD_R360_ZHDZPF"
,
jsonObject
.
getJSONObject
(
"data"
));
}
else
{
thirdData
.
put
(
jsonObject
.
getString
(
"dataSource"
),
jsonObject
.
getJSONObject
(
"data"
));
}
processThirdData
(
c
.
getClientCell
(),
c
.
getOrderNo
(),
jsonArray
);
});
List
<
CreditModel
>
withdraw
=
creditComponent
.
getListModelByCreditThirdStatus
(
"INIT-WITHDRAW"
);
withdraw
.
parallelStream
().
forEach
(
w
->{
LoanModel
loanModel
=
loanComponent
.
getByOrderNo
(
w
.
getOrderNo
());
JSONObject
thirdCredit
=
new
JSONObject
();
thirdCredit
.
put
(
"reqNo"
,
loanModel
.
getLoanNo
());
thirdCredit
.
put
(
"type"
,
"01"
);
ZyJsonResult
zyJsonResult
=
abcHttpClient
.
postRequest
(
thirdCredit
.
toJSONString
(),
ZNPostUrlEnum
.
CREDIT_QUERY
.
getCode
());
JSONArray
jsonArray
=
zyJsonResult
.
getExternalInfo
();
processThirdData
(
w
.
getClientCell
(),
w
.
getOrderNo
(),
jsonArray
);
});
}
private
void
processThirdData
(
String
clientCell
,
String
orderNo
,
JSONArray
jsonArray
)
{
JSONObject
thirdData
=
new
JSONObject
();
for
(
int
i
=
0
;
i
<
jsonArray
.
size
();
i
++)
{
JSONObject
jsonObject
=
(
JSONObject
)
jsonArray
.
get
(
i
);
log
.
info
(
"dataSource:[{}],data:[{}]"
,
jsonObject
.
getString
(
"dataSource"
),
jsonObject
.
getJSONObject
(
"data"
));
if
(
"TENCENT_FRAUD_VIP"
.
equals
(
jsonObject
.
getString
(
"dataSource"
)))
{
thirdData
.
put
(
"PD_TENCENT_FRAUD"
,
jsonObject
.
getJSONObject
(
"data"
));
}
else
if
(
"TENCENT_FRAUD_SUMMIT"
.
equals
(
jsonObject
.
getString
(
"dataSource"
)))
{
thirdData
.
put
(
"PD_TENCENT_FRAUD_VIP"
,
jsonObject
.
getJSONObject
(
"data"
));
}
else
if
(
"RONG360_BLACK_LIST"
.
equals
(
jsonObject
.
getString
(
"dataSource"
)))
{
thirdData
.
put
(
"PD_R360_ZHDZPF_V2"
,
jsonObject
.
getJSONObject
(
"data"
));
}
else
if
(
"RONG360_ZXFV3_SCORE"
.
equals
(
jsonObject
.
getString
(
"dataSource"
)))
{
thirdData
.
put
(
"PD_R360_ZHDZPF"
,
jsonObject
.
getJSONObject
(
"data"
));
}
else
{
thirdData
.
put
(
jsonObject
.
getString
(
"dataSource"
),
jsonObject
.
getJSONObject
(
"data"
));
}
StringBuffer
filePath
=
new
StringBuffer
();
filePath
.
append
(
"zhenong"
).
append
(
"/"
).
append
(
DateFormatUtils
.
format
(
new
Date
(),
"yyyyMMdd"
)).
append
(
"/"
).
append
(
c
.
getOrderNo
()).
append
(
"/"
);
String
pdfFileName
=
c
.
getClientCell
()+
UUID
.
randomUUID
();
ossUtils
.
upStringObject
(
filePath
+
pdfFileName
,
thirdData
.
toString
());
CreditModel
creditModel
=
new
CreditModel
();
creditModel
.
setCreditThirdStatus
(
"FINISHED"
);
creditModel
.
setCreditThirdUrl
(
filePath
+
pdfFileName
);
creditComponent
.
updateByOrderNo
(
c
.
getOrderNo
(),
creditModel
);
});
}
StringBuffer
filePath
=
new
StringBuffer
();
filePath
.
append
(
"zhenong"
).
append
(
"/"
).
append
(
DateFormatUtils
.
format
(
new
Date
(),
"yyyyMMdd"
)).
append
(
"/"
).
append
(
orderNo
).
append
(
"/"
);
String
pdfFileName
=
clientCell
+
UUID
.
randomUUID
();
ossUtils
.
upStringObject
(
filePath
+
pdfFileName
,
thirdData
.
toString
());
CreditModel
creditModel
=
new
CreditModel
();
creditModel
.
setCreditThirdStatus
(
"FINISHED"
);
creditModel
.
setCreditThirdUrl
(
filePath
+
pdfFileName
);
creditComponent
.
updateByOrderNo
(
orderNo
,
creditModel
);
}
...
...
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