Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
Y
yifu-mvp
Project
Project
Details
Activity
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
fangxinjiang
yifu-mvp
Commits
6c81db5d
Commit
6c81db5d
authored
Mar 01, 2023
by
hongguangwu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
MVP1.5.1-收入证明等
parent
22761e50
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
122 additions
and
15 deletions
+122
-15
ChecksUtil.java
...n/java/com/yifu/cloud/plus/v1/check/utils/ChecksUtil.java
+1
-1
TCheckBankNoServiceImpl.java
...d/plus/v1/check/service/impl/TCheckBankNoServiceImpl.java
+121
-14
No files found.
yifu-check/yifu-check-api/src/main/java/com/yifu/cloud/plus/v1/check/utils/ChecksUtil.java
View file @
6c81db5d
...
...
@@ -97,7 +97,7 @@ public class ChecksUtil {
}
}
p
rivate
static
R
<
TCheckBankNo
>
checkBankNoTwoMethod
(
String
name
,
String
cardNo
)
{
p
ublic
static
R
<
TCheckBankNo
>
checkBankNoTwoMethod
(
String
name
,
String
cardNo
)
{
final
JsonObject
jsonObject
=
ChecksUtil
.
invokeBankNoTwoAuth
(
name
,
cardNo
);
TCheckBankNo
checkBankNo
=
new
TCheckBankNo
();
// 2.处理返回结果
...
...
yifu-check/yifu-check-biz/src/main/java/com/yifu/cloud/plus/v1/check/service/impl/TCheckBankNoServiceImpl.java
View file @
6c81db5d
...
...
@@ -18,6 +18,7 @@ package com.yifu.cloud.plus.v1.check.service.impl;
import
com.baomidou.mybatisplus.core.toolkit.Wrappers
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
com.yifu.cloud.plus.v1.check.constant.ChecksConstants
;
import
com.yifu.cloud.plus.v1.check.entity.TCheckBankNo
;
import
com.yifu.cloud.plus.v1.check.mapper.TCheckBankNoMapper
;
import
com.yifu.cloud.plus.v1.check.service.TCanCheckService
;
...
...
@@ -30,13 +31,14 @@ import com.yifu.cloud.plus.v1.yifu.common.core.exception.ErrorCodes;
import
com.yifu.cloud.plus.v1.yifu.common.core.util.Common
;
import
com.yifu.cloud.plus.v1.yifu.common.core.util.MsgUtils
;
import
com.yifu.cloud.plus.v1.yifu.common.core.util.R
;
import
com.yifu.cloud.plus.v1.yifu.social.vo.TPaymentInfoVo
;
import
lombok.Data
;
import
lombok.RequiredArgsConstructor
;
import
org.springframework.stereotype.Service
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.*
;
import
static
java
.
lang
.
Thread
.
sleep
;
/**
* 银行卡卡号 校验
...
...
@@ -137,27 +139,132 @@ public class TCheckBankNoServiceImpl extends ServiceImpl<TCheckBankNoMapper, TCh
List
<
TCheckBankNo
>
saveList
=
new
ArrayList
<>();
if
(!
noCurlist
.
isEmpty
())
{
synchronized
(
this
)
{
TCheckBankNo
newNo
;
R
<
TCheckBankNo
>
resR
;
boolean
canCheck
=
canCheckService
.
getCanCheck
();
for
(
TCheckBankNo
no
:
noCurlist
)
{
resR
=
ChecksUtil
.
checkBankNoTwo
(
no
.
getName
(),
no
.
getBankNo
(),
canCheck
);
if
(
noCurlist
.
size
()>=
50
)
{
int
l
=
4
;
for
(
int
k
=
0
;
k
<
l
;
k
++)
{
if
((
k
+
1
)==
l
)
{
final
List
<
TCheckBankNo
>
finalList
=
noCurlist
.
subList
(
k
*
(
noCurlist
.
size
()
/
l
),
noCurlist
.
size
());
if
(
canCheck
)
{
doThread
(
bankMap
,
saveList
,
finalList
);
}
else
{
doNomal
(
bankMap
,
saveList
,
finalList
);
}
}
else
{
final
List
<
TCheckBankNo
>
finalList
=
noCurlist
.
subList
(
k
*
(
noCurlist
.
size
()
/
l
),
(
k
+
1
)
*
(
noCurlist
.
size
()
/
l
));
if
(
canCheck
)
{
doThread
(
bankMap
,
saveList
,
finalList
);
}
else
{
doNomal
(
bankMap
,
saveList
,
finalList
);
}
}
}
}
else
{
if
(
canCheck
)
{
doThread
(
bankMap
,
saveList
,
noCurlist
);
}
else
{
doNomal
(
bankMap
,
saveList
,
noCurlist
);
}
}
while
(
Thread
.
activeCount
()
>
4
)
{
Thread
.
yield
();
}
//fo (TCheckBankNo no : noCurlist)
// 原代码
/*resR = ChecksUtil.checkBankNoTwo(no.getName(), no.getBankNo(), canCheck)
f (Common.isNotNull(resR) && resR.getCode() == CommonConstants.SUCCESS
&& Common.isNotNull(resR.getData()))
newNo = resR.getData()
bankMap.put(no.getBankNo(), CommonConstants.ZERO_ONE.equals(newNo.getResult()))
saveList.add(newNo)
else
bankMap.put(no.getBankNo(), false)
*/
if
(!
saveList
.
isEmpty
())
{
this
.
saveBatch
(
saveList
);
}
}
}
vo
.
setCheckMap
(
bankMap
);
return
vo
;
}
private
void
doThread
(
Map
<
String
,
Boolean
>
bankMap
,
List
<
TCheckBankNo
>
saveList
,
List
<
TCheckBankNo
>
finalList
)
{
new
Thread
(()
->
{
for
(
int
i
=
0
;
i
<
finalList
.
size
();
i
++)
{
final
TCheckBankNo
no
=
finalList
.
get
(
i
);
setBankMap
(
bankMap
,
no
,
saveList
);
}
}).
start
();
}
private
void
doNomal
(
Map
<
String
,
Boolean
>
bankMap
,
List
<
TCheckBankNo
>
saveList
,
List
<
TCheckBankNo
>
finalList
)
{
TCheckBankNo
no
;
for
(
int
i
=
0
;
i
<
finalList
.
size
();
i
++)
{
no
=
finalList
.
get
(
i
);
final
TCheckBankNo
newNo
=
new
TCheckBankNo
();
newNo
.
setBankNo
(
no
.
getBankNo
());
newNo
.
setName
(
no
.
getName
());
newNo
.
setMessage
(
ChecksConstants
.
CHECK_CONFIG_ACCESS
);
newNo
.
setResult
(
"01"
);
newNo
.
setType
(
CommonConstants
.
ONE_STRING
);
newNo
.
setRemark
(
ChecksConstants
.
CHECK_CONFIG_ACCESS
);
saveList
.
add
(
newNo
);
bankMap
.
put
(
no
.
getBankNo
(),
true
);
}
}
public
void
setBankMap
(
Map
<
String
,
Boolean
>
bankMap
,
TCheckBankNo
no
,
List
<
TCheckBankNo
>
saveList
)
{
// 1.调用银行卡信息校验api
R
<
TCheckBankNo
>
resR
=
ChecksUtil
.
checkBankNoTwoMethod
(
no
.
getName
(),
no
.
getBankNo
());
if
(
Common
.
isNotNull
(
resR
)
&&
resR
.
getCode
()
==
CommonConstants
.
SUCCESS
&&
Common
.
isNotNull
(
resR
.
getData
()))
{
newNo
=
resR
.
getData
();
TCheckBankNo
newNo
=
resR
.
getData
();
bankMap
.
put
(
no
.
getBankNo
(),
CommonConstants
.
ZERO_ONE
.
equals
(
newNo
.
getResult
()));
saveList
.
add
(
newNo
);
}
else
{
bankMap
.
put
(
no
.
getBankNo
(),
false
);
}
}
if
(!
saveList
.
isEmpty
())
{
this
.
saveBatch
(
saveList
);
/*public static void mai(String[] args) {
Map<Integer, Boolean> bankMap = new HashMap<>();
int j=100;
List<Integer> aList = new ArrayList<>();
for (int k=0;k<229;k++) {
aList.add(k);
}
if (j>=100) {
int l = 4;
for (int k=0;k<l;k++) {
if ((k+1)==l) {
final List<Integer> finalList = aList.subList(k * (aList.size() / l), aList.size());
new Thread(() -> {
for (int i=0;i<finalList.size();i++) {
final Integer finalI = finalList.get(i);
setBankMapByi(bankMap, finalI);
}
}).start();
} else {
final List<Integer> finalList = aList.subList(k * (aList.size() / l), (k + 1) * (aList.size() / l));
new Thread(() -> {
for (int i=0;i<finalList.size();i++) {
final Integer finalI = finalList.get(i);
setBankMapByi(bankMap, finalI);
}
vo
.
setCheckMap
(
bankMap
);
return
vo
;
}).start();
}
}
} else {
for (int i=0;i<aList.size();i++) {
setBankMapByi(bankMap, aList.get(i));
}
}
while (Thread.activeCount() > 4) {
Thread.yield();
}
}*/
}
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