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
915cf08e
Commit
915cf08e
authored
Sep 24, 2021
by
王业雄
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
手机号区域限制存中文名
parent
ec0ffa58
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
60 additions
and
2 deletions
+60
-2
FundProductServiceImpl.java
...stribution/service/route/impl/FundProductServiceImpl.java
+60
-2
No files found.
src/main/java/com/quantgroup/asset/distribution/service/route/impl/FundProductServiceImpl.java
View file @
915cf08e
...
@@ -211,7 +211,12 @@ public class FundProductServiceImpl implements IFundProductService {
...
@@ -211,7 +211,12 @@ public class FundProductServiceImpl implements IFundProductService {
case
"tel_area_list"
:
case
"tel_area_list"
:
//手机号区域限制
//手机号区域限制
if
(
Objects
.
nonNull
(
areaRuleConcrete
)){
if
(
Objects
.
nonNull
(
areaRuleConcrete
)){
map
.
put
(
productRuleEntity
.
getId
(),
areaRuleConcrete
.
getTelAreaNameList
());
try
{
String
telAreaCodeListByName
=
getTelAreaCodeListByName
(
areaRuleConcrete
.
getTelAreaNameList
());
map
.
put
(
productRuleEntity
.
getId
(),
telAreaCodeListByName
);
}
catch
(
Exception
e
){
log
.
error
(
"获取手机号区域限制异常"
,
e
);
}
}
}
break
;
break
;
case
"residence_list"
:
case
"residence_list"
:
...
@@ -292,7 +297,12 @@ public class FundProductServiceImpl implements IFundProductService {
...
@@ -292,7 +297,12 @@ public class FundProductServiceImpl implements IFundProductService {
one
.
setCardLimit
(
Integer
.
valueOf
(
value
));
one
.
setCardLimit
(
Integer
.
valueOf
(
value
));
break
;
break
;
case
"tel_area_list"
:
case
"tel_area_list"
:
areaRuleConcrete
.
setTelAreaNameList
(
value
);
try
{
String
telAreaNameListByCode
=
getTelAreaNameListByCode
(
value
);
areaRuleConcrete
.
setTelAreaNameList
(
telAreaNameListByCode
);
}
catch
(
Exception
e
){
log
.
error
(
"资金产品保存手机号区域限制异常"
,
e
);
}
break
;
break
;
case
"residence_list"
:
case
"residence_list"
:
areaRuleConcrete
.
setResidenceList
(
value
);
areaRuleConcrete
.
setResidenceList
(
value
);
...
@@ -310,6 +320,54 @@ public class FundProductServiceImpl implements IFundProductService {
...
@@ -310,6 +320,54 @@ public class FundProductServiceImpl implements IFundProductService {
return
GlobalResponse
.
success
();
return
GlobalResponse
.
success
();
}
}
//通过地区code获取对应的name
private
String
getTelAreaNameListByCode
(
String
value
)
throws
IOException
{
if
(
StringUtils
.
isEmpty
(
value
)){
return
""
;
}
InputStream
in
=
this
.
getClass
().
getResourceAsStream
(
"/phone/gbt.txt"
);
String
var4
=
InitAreaCode
.
getString
(
in
);
List
<
AreaCode
>
list
=
new
ArrayList
<
AreaCode
>();
list
=
JSONObject
.
parseArray
(
var4
,
AreaCode
.
class
);
String
replace
=
value
.
replace
(
"["
,
""
).
replace
(
"]"
,
""
);
String
[]
split
=
replace
.
split
(
","
);
List
<
String
>
telAreaNameList
=
new
ArrayList
<>();
for
(
int
i
=
0
;
i
<
split
.
length
;
i
++){
for
(
AreaCode
areaCode:
list
){
if
(
areaCode
.
getAdcode
().
equals
(
split
[
i
])){
telAreaNameList
.
add
(
areaCode
.
getName
());
break
;
}
}
}
return
telAreaNameList
.
toString
();
}
//通过地区name获取对应的code
private
String
getTelAreaCodeListByName
(
String
value
)
throws
IOException
{
if
(
StringUtils
.
isEmpty
(
value
)){
return
""
;
}
InputStream
in
=
this
.
getClass
().
getResourceAsStream
(
"/phone/gbt.txt"
);
String
var4
=
InitAreaCode
.
getString
(
in
);
List
<
AreaCode
>
list
=
new
ArrayList
<
AreaCode
>();
list
=
JSONObject
.
parseArray
(
var4
,
AreaCode
.
class
);
String
replace
=
value
.
replace
(
"["
,
""
).
replace
(
"]"
,
""
);
String
[]
split
=
replace
.
split
(
","
);
List
<
String
>
telAreaCodeList
=
new
ArrayList
<>();
for
(
int
i
=
0
;
i
<
split
.
length
;
i
++){
for
(
AreaCode
areaCode:
list
){
if
(
areaCode
.
getName
().
equals
(
split
[
i
])){
telAreaCodeList
.
add
(
areaCode
.
getAdcode
());
break
;
}
}
}
return
telAreaCodeList
.
toString
();
}
@Override
@Override
public
GlobalResponse
getArea
()
throws
IOException
{
public
GlobalResponse
getArea
()
throws
IOException
{
AreaCodeVo
areaCodeVo
=
new
AreaCodeVo
();
AreaCodeVo
areaCodeVo
=
new
AreaCodeVo
();
...
...
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