Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
api
Overview
Overview
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
首航-临时账号
api
Commits
73e97be4
Commit
73e97be4
authored
Mar 28, 2018
by
java-李谡
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
删除冗余代码
parent
808489c4
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
14 additions
and
63 deletions
+14
-63
CallController.java
src/com/ejweb/modules/call/api/CallController.java
+7
-42
CallService.java
src/com/ejweb/modules/call/service/CallService.java
+7
-16
PhoneAreaUtil.java
src/com/ejweb/modules/call/util/PhoneAreaUtil.java
+0
-5
No files found.
src/com/ejweb/modules/call/api/CallController.java
View file @
73e97be4
...
@@ -123,62 +123,27 @@ public class CallController {
...
@@ -123,62 +123,27 @@ public class CallController {
callPhone
.
setPhone
(
bean
.
getPhone
());
callPhone
.
setPhone
(
bean
.
getPhone
());
callPhone
.
setMobile
(
bean
.
getMobile
());
callPhone
.
setMobile
(
bean
.
getMobile
());
if
(
StringUtils
.
isNotBlank
(
bean
.
getMobile
())){
// 格式化手机号
// 格式化手机号
if
(
StringUtils
.
isNotBlank
(
bean
.
getMobile
())){
String
mobile
=
bean
.
getMobile
();
String
mobile
=
bean
.
getMobile
();
String
[]
species
=
mobile
.
split
(
"\\s+"
);
// 只使用第一个手机号
// 只使用第一个手机号
String
[]
species
=
mobile
.
split
(
"\\s+"
);
if
(
species
.
length
>
1
&&
species
[
0
].
matches
(
"1\\d+"
)
&&
species
[
1
].
matches
(
"1\\d+"
)){
if
(
species
.
length
>
1
&&
species
[
0
].
matches
(
"1\\d+"
)
&&
species
[
1
].
matches
(
"1\\d+"
)){
mobile
=
species
[
0
];
mobile
=
species
[
0
];
}
}
callPhone
=
callService
.
addPhoneArea
(
mobile
);
callPhone
=
callService
.
addPhoneArea
(
mobile
);
if
(
callPhone
==
null
){
// 未查询到相关数据
// 未查询到相关数据
if
(
callPhone
==
null
){
callPhone
=
new
CallPhoneAreaEntity
();
callPhone
=
new
CallPhoneAreaEntity
();
}
}
callPhone
.
setMobile
(
bean
.
getMobile
());
callPhone
.
setMobile
(
bean
.
getMobile
());
/*
if(mobile.startsWith("+")){// 国外手机号,前面加拨3个0
callPhone.setType("MOBILE");
callPhone.setPremobile("000");
callPhone.setMobileNubmer("000"+mobile.replace("+", ""));
} else if(mobile.matches("\\d+") && 11 == mobile.length()){
PhoneAreaEntity area = PhoneAreaUtil.get360PhoneArea(mobile);
if(area != null && StringUtils.isNotBlank(area.getProvince())){// 能够查到省份信息
if(area.getProvince().contains("北京")
|| (StringUtils.isNotBlank(area.getCity()) && area.getCity().contains("北京"))){// 北京前面加拨一个0
callPhone.setType("MOBILE");
callPhone.setMobileNubmer("0"+mobile);// 加拨1个0
callPhone.setPremobile("0");
callPhone.setMobileProvince("北京");
callPhone.setMobileCity("北京");
callPhone.setMobileSp(StringUtils.isBlank(area.getSp()) ? "" : area.getSp());
} else {// 非北京号码加拨两个0
callPhone.setType("MOBILE");
callPhone.setMobileNubmer("00"+mobile);// 加拨2个0
callPhone.setPremobile("00");
callPhone.setMobileProvince(area.getProvince());
callPhone.setMobileCity(StringUtils.isBlank(area.getCity()) ? "" : area.getCity());
callPhone.setMobileSp(StringUtils.isBlank(area.getSp()) ? "" : area.getSp());
}
}
} else{// 非手机号,按座机号处理
// String workPhone = bean.getPhone();
callPhone.setShowPhone(bean.getPhone());
// workPhone = Util.formatedWorkPhone(workPhone);
callPhone.setPhone(Util.formatedWorkPhone(bean.getPhone()));
callPhone.setType("PHONE");
}
*/
}
}
if
(
StringUtils
.
isNotBlank
(
bean
.
getPhone
())){
if
(
StringUtils
.
isNotBlank
(
bean
.
getPhone
())){
// String workPhone = bean.getPhone();
callPhone
.
setShowPhone
(
bean
.
getPhone
());
callPhone
.
setShowPhone
(
bean
.
getPhone
());
// workPhone = Util.formatedWorkPhone(bean.getPhone());
callPhone
.
setPhone
(
Util
.
formatedWorkPhone
(
bean
.
getPhone
()));
callPhone
.
setPhone
(
Util
.
formatedWorkPhone
(
bean
.
getPhone
()));
callPhone
.
setType
(
"PHONE"
);
callPhone
.
setType
(
"PHONE"
);
}
}
...
...
src/com/ejweb/modules/call/service/CallService.java
View file @
73e97be4
...
@@ -243,17 +243,7 @@ public class CallService extends BaseService<CallDao> {
...
@@ -243,17 +243,7 @@ public class CallService extends BaseService<CallDao> {
mobile
=
mobile
.
replaceAll
(
"^0+"
,
""
);
// 去掉手机号前面的0
mobile
=
mobile
.
replaceAll
(
"^0+"
,
""
);
// 去掉手机号前面的0
if
(
mobile
.
length
()>
7
){
if
(
mobile
.
length
()>
7
){
CallPhoneAreaEntity
searchMobile
=
new
CallPhoneAreaEntity
();
CallPhoneAreaEntity
searchMobile
=
new
CallPhoneAreaEntity
();
// 第一步:通过查询记录获取手机归属地信息,暂时注释掉不适用,主要用于控制特殊号码的归宿地查询
/*
searchMobile.setMobileNubmer0("0"+mobile);
searchMobile.setMobileNubmer00("00"+mobile);
searchMobile.setMobileNubmer000("000"+mobile);
phoneArea = dao.getPhoneAreaByMobile(searchMobile);// 到记录表里面查询
if(phoneArea != null && StringUtils.isNotEmpty(phoneArea.getPremobile())){
phoneArea.setMobileNubmer(phoneArea.getPremobile()+mobile);
return phoneArea;
}
*/
// 第二步: 通过地区码查询手机归宿地信息
// 第二步: 通过地区码查询手机归宿地信息
searchMobile
.
setAreaCode
(
mobile
.
substring
(
0
,
7
));
searchMobile
.
setAreaCode
(
mobile
.
substring
(
0
,
7
));
searchMobile
.
setMobile
(
mobile
);
searchMobile
.
setMobile
(
mobile
);
...
@@ -294,15 +284,16 @@ public class CallService extends BaseService<CallDao> {
...
@@ -294,15 +284,16 @@ public class CallService extends BaseService<CallDao> {
public
CallPhoneAreaEntity
getCallPhoneAreaBy360
(
String
mobile
){
public
CallPhoneAreaEntity
getCallPhoneAreaBy360
(
String
mobile
){
CallPhoneAreaEntity
callPhone
=
new
CallPhoneAreaEntity
();
CallPhoneAreaEntity
callPhone
=
new
CallPhoneAreaEntity
();
callPhone
.
setMobile
(
mobile
);
callPhone
.
setMobile
(
mobile
);
if
(
StringUtils
.
isNotBlank
(
mobile
)){
// 格式化手机号
// 格式化手机号
if
(
StringUtils
.
isNotBlank
(
mobile
)){
if
(
mobile
.
startsWith
(
"+"
)){
// 国外手机号,前面加拨3个0
// 国外手机号,前面加拨3个0
if
(
mobile
.
startsWith
(
"+"
)){
callPhone
.
setType
(
"MOBILE"
);
callPhone
.
setType
(
"MOBILE"
);
callPhone
.
setPremobile
(
"000"
);
callPhone
.
setPremobile
(
"000"
);
callPhone
.
setMobileNubmer
(
"000"
+
mobile
.
replace
(
"+"
,
""
));
callPhone
.
setMobileNubmer
(
"000"
+
mobile
.
replace
(
"+"
,
""
));
return
callPhone
;
return
callPhone
;
}
else
if
(
mobile
.
startsWith
(
"0"
)
==
false
){
// 可能是手机号
// 可能是手机号
}
else
if
(
mobile
.
startsWith
(
"0"
)
==
false
){
PhoneAreaEntity
area
=
PhoneAreaUtil
.
get360PhoneArea
(
mobile
);
PhoneAreaEntity
area
=
PhoneAreaUtil
.
get360PhoneArea
(
mobile
);
if
(
area
==
null
){
if
(
area
==
null
){
...
...
src/com/ejweb/modules/call/util/PhoneAreaUtil.java
View file @
73e97be4
...
@@ -38,11 +38,6 @@ public class PhoneAreaUtil {
...
@@ -38,11 +38,6 @@ public class PhoneAreaUtil {
if
(
entity
!=
null
&&
entity
.
isSuccess
()){
if
(
entity
!=
null
&&
entity
.
isSuccess
()){
String
txt
=
entity
.
getContent
(
"UTF-8"
);
String
txt
=
entity
.
getContent
(
"UTF-8"
);
// if(GConstants.DEBUG){
//
// System.out.println("http://cx.shouji.360.cn/phonearea.php?number="+mobile);
// System.out.println("返回: "+txt);
// }
JSONObject
object
=
JSON
.
parseObject
(
txt
);
JSONObject
object
=
JSON
.
parseObject
(
txt
);
JSONObject
data
=
object
.
getJSONObject
(
"data"
);
JSONObject
data
=
object
.
getJSONObject
(
"data"
);
...
...
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