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
781dcd7e
Commit
781dcd7e
authored
Sep 20, 2017
by
Java-金吉宝
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修复录音重复记录bug
parent
6b00ddb1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
485 additions
and
470 deletions
+485
-470
CallDao.java
src/com/ejweb/modules/call/dao/CallDao.java
+63
-59
CallService.java
src/com/ejweb/modules/call/service/CallService.java
+422
-411
No files found.
src/com/ejweb/modules/call/dao/CallDao.java
View file @
781dcd7e
package
com
.
ejweb
.
modules
.
call
.
dao
;
package
com
.
ejweb
.
modules
.
call
.
dao
;
import
java.util.List
;
import
java.util.List
;
import
com.ejweb.core.base.BaseDao
;
import
com.ejweb.core.base.BaseDao
;
import
com.ejweb.modules.call.bean.CallFindPhoneInfoBean
;
import
com.ejweb.modules.call.bean.CallFindPhoneInfoBean
;
import
com.ejweb.modules.call.bean.CallPhoneBean
;
import
com.ejweb.modules.call.bean.CallPhoneBean
;
import
com.ejweb.modules.call.bean.CallRecordListBean
;
import
com.ejweb.modules.call.bean.CallRecordListBean
;
import
com.ejweb.modules.call.entity.CallPhoneAreaEntity
;
import
com.ejweb.modules.call.entity.CallPhoneAreaEntity
;
import
com.ejweb.modules.call.entity.CallPhoneInfoListEntity
;
import
com.ejweb.modules.call.entity.CallPhoneInfoListEntity
;
import
com.ejweb.modules.call.entity.CallRecordEntity
;
import
com.ejweb.modules.call.entity.CallRecordEntity
;
import
com.ejweb.modules.call.entity.CallRecordListEntity
;
import
com.ejweb.modules.call.entity.CallRecordListEntity
;
import
com.ejweb.modules.call.entity.CallSoundRecordBean
;
import
com.ejweb.modules.call.entity.CallSoundRecordBean
;
import
com.ejweb.modules.call.entity.HuaweiNumListEntity
;
import
com.ejweb.modules.call.entity.HuaweiNumListEntity
;
import
com.ejweb.modules.call.entity.MemberEntity
;
import
com.ejweb.modules.call.entity.MemberEntity
;
public
interface
CallDao
extends
BaseDao
{
public
interface
CallDao
extends
BaseDao
{
public
Integer
createCallRecord
(
CallRecordEntity
entity
);
public
Integer
createCallRecord
(
CallRecordEntity
entity
);
public
Integer
updateCallRecord
(
CallRecordEntity
entity
);
public
Integer
updateCallRecord
(
CallRecordEntity
entity
);
public
Integer
addCallPhoneList
(
List
<
CallPhoneBean
>
phoneList
);
public
Integer
addCallPhoneList
(
List
<
CallPhoneBean
>
phoneList
);
public
List
<
CallRecordListEntity
>
getCallRecordList
(
CallRecordListBean
bean
);
public
List
<
CallRecordListEntity
>
getCallRecordList
(
CallRecordListBean
bean
);
public
List
<
CallRecordListEntity
>
getCallSoundList
(
CallRecordListBean
bean
);
public
List
<
CallRecordListEntity
>
getCallSoundList
(
CallRecordListBean
bean
);
public
List
<
CallPhoneInfoListEntity
>
findUserByCallPhone
(
CallFindPhoneInfoBean
bean
);
public
List
<
CallPhoneInfoListEntity
>
findUserByCallPhone
(
CallFindPhoneInfoBean
bean
);
public
List
<
CallPhoneInfoListEntity
>
findUserByCallRecord
(
CallFindPhoneInfoBean
bean
);
public
List
<
CallPhoneInfoListEntity
>
findUserByCallRecord
(
CallFindPhoneInfoBean
bean
);
public
List
<
CallPhoneInfoListEntity
>
findSeatListByCallPhone
(
CallFindPhoneInfoBean
bean
);
public
List
<
CallPhoneInfoListEntity
>
findSeatListByCallPhone
(
CallFindPhoneInfoBean
bean
);
public
CallPhoneInfoListEntity
findUserInfoByNumOrId
(
CallFindPhoneInfoBean
bean
);
public
CallPhoneInfoListEntity
findUserInfoByNumOrId
(
CallFindPhoneInfoBean
bean
);
public
CallPhoneAreaEntity
getPhoneAreaByAreaCode
(
CallPhoneAreaEntity
areaCode
);
public
CallPhoneAreaEntity
getPhoneAreaByAreaCode
(
CallPhoneAreaEntity
areaCode
);
public
CallPhoneAreaEntity
getPhoneAreaByMobile
(
CallPhoneAreaEntity
mobile
);
public
CallPhoneAreaEntity
getPhoneAreaByMobile
(
CallPhoneAreaEntity
mobile
);
public
Integer
addPhoneAreaRecord
(
CallPhoneAreaEntity
entity
);
public
Integer
addPhoneAreaRecord
(
CallPhoneAreaEntity
entity
);
public
Integer
addPhoneAreaCode
(
CallPhoneAreaEntity
entity
);
public
Integer
addPhoneAreaCode
(
CallPhoneAreaEntity
entity
);
public
Integer
addSoundRecord
(
CallSoundRecordBean
entity
);
public
Integer
addSoundRecord
(
CallSoundRecordBean
entity
);
public
List
<
CallPhoneInfoListEntity
>
findPhneListByHuaweiNum
(
HuaweiNumListEntity
entity
);
public
List
<
CallPhoneInfoListEntity
>
findPhneListByHuaweiNum
(
HuaweiNumListEntity
entity
);
public
String
GetPhoneById
(
String
id
);
public
String
GetPhoneById
(
String
id
);
public
List
<
MemberEntity
>
getMemberList
(
String
recordId
);
public
List
<
MemberEntity
>
getMemberList
(
String
recordId
);
public
String
getNameByPhone
(
String
mobileNubmer
);
public
String
getNameByPhone
(
String
mobileNubmer
);
public
String
getNameByPhoneFromSeat
(
String
createPhone
);
public
String
getNameByPhoneFromSeat
(
String
createPhone
);
public
String
getIdByPhoneFromSeat
(
String
createPhone
);
public
String
getIdByPhoneFromSeat
(
String
createPhone
);
public
String
getIdByPhone
(
String
mobileNubmer
);
public
String
getIdByPhone
(
String
mobileNubmer
);
}
public
CallRecordListEntity
get
(
CallRecordListEntity
callRecordListEntity
);
public
List
<
CallRecordListEntity
>
getList
(
CallRecordListEntity
callRecordListEntity
);
}
src/com/ejweb/modules/call/service/CallService.java
View file @
781dcd7e
package
com
.
ejweb
.
modules
.
call
.
service
;
package
com
.
ejweb
.
modules
.
call
.
service
;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
import
java.util.Date
;
import
java.util.Date
;
import
java.util.HashMap
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Map
;
import
javax.sound.midi.VoiceStatus
;
import
javax.sound.midi.VoiceStatus
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.commons.lang3.time.DateFormatUtils
;
import
org.apache.commons.lang3.time.DateFormatUtils
;
import
org.apache.commons.lang3.time.DateUtils
;
import
org.apache.commons.lang3.time.DateUtils
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.transaction.annotation.Transactional
;
import
com.ejweb.core.base.BaseService
;
import
com.ejweb.core.base.BaseService
;
import
com.ejweb.core.base.PageEntity
;
import
com.ejweb.core.base.PageEntity
;
import
com.ejweb.core.util.IdWorker
;
import
com.ejweb.core.util.IdWorker
;
import
com.ejweb.core.util.Util
;
import
com.ejweb.core.util.Util
;
import
com.ejweb.modules.call.bean.CallFindPhoneInfoBean
;
import
com.ejweb.modules.call.bean.CallFindPhoneInfoBean
;
import
com.ejweb.modules.call.bean.CallPhoneBean
;
import
com.ejweb.modules.call.bean.CallPhoneBean
;
import
com.ejweb.modules.call.bean.CallRecordListBean
;
import
com.ejweb.modules.call.bean.CallRecordListBean
;
import
com.ejweb.modules.call.dao.CallDao
;
import
com.ejweb.modules.call.dao.CallDao
;
import
com.ejweb.modules.call.entity.CallPhoneAreaEntity
;
import
com.ejweb.modules.call.entity.CallPhoneAreaEntity
;
import
com.ejweb.modules.call.entity.CallPhoneInfoListEntity
;
import
com.ejweb.modules.call.entity.CallPhoneInfoListEntity
;
import
com.ejweb.modules.call.entity.CallRecordEntity
;
import
com.ejweb.modules.call.entity.CallRecordEntity
;
import
com.ejweb.modules.call.entity.CallRecordListEntity
;
import
com.ejweb.modules.call.entity.CallRecordListEntity
;
import
com.ejweb.modules.call.entity.CallSoundRecordBean
;
import
com.ejweb.modules.call.entity.CallSoundRecordBean
;
import
com.ejweb.modules.call.entity.HuaweiNumListEntity
;
import
com.ejweb.modules.call.entity.HuaweiNumListEntity
;
import
com.ejweb.modules.call.entity.MemberEntity
;
import
com.ejweb.modules.call.entity.MemberEntity
;
import
com.ejweb.modules.call.util.PhoneAreaEntity
;
import
com.ejweb.modules.call.util.PhoneAreaEntity
;
import
com.ejweb.modules.call.util.PhoneAreaUtil
;
import
com.ejweb.modules.call.util.PhoneAreaUtil
;
import
com.github.pagehelper.PageHelper
;
import
com.github.pagehelper.PageHelper
;
import
com.github.pagehelper.PageInfo
;
import
com.github.pagehelper.PageInfo
;
@Service
@Service
@Transactional
(
readOnly
=
true
)
@Transactional
(
readOnly
=
true
)
public
class
CallService
extends
BaseService
<
CallDao
>
{
public
class
CallService
extends
BaseService
<
CallDao
>
{
public
void
createCallRecord
(
CallRecordEntity
entity
){
public
void
createCallRecord
(
CallRecordEntity
entity
){
dao
.
createCallRecord
(
entity
);
dao
.
createCallRecord
(
entity
);
}
}
public
void
updateCallRecord
(
CallRecordEntity
entity
){
public
void
updateCallRecord
(
CallRecordEntity
entity
){
dao
.
updateCallRecord
(
entity
);
dao
.
updateCallRecord
(
entity
);
}
}
public
Integer
addCallPhoneList
(
List
<
CallPhoneBean
>
phoneList
){
public
Integer
addCallPhoneList
(
List
<
CallPhoneBean
>
phoneList
){
return
dao
.
addCallPhoneList
(
phoneList
);
return
dao
.
addCallPhoneList
(
phoneList
);
}
}
/**
/**
* 获取通话记录列表
* 获取通话记录列表
*
*
* @author renmb
* @author renmb
* @time 2016年12月6日
* @time 2016年12月6日
* @param bean
* @param bean
* @return
* @return
*/
*/
public
PageEntity
<
CallRecordListEntity
>
getCallRecordList
(
CallRecordListBean
bean
){
public
PageEntity
<
CallRecordListEntity
>
getCallRecordList
(
CallRecordListBean
bean
){
// return dao.getCallRecordList(bean);
// return dao.getCallRecordList(bean);
PageInfo
<
CallRecordListEntity
>
pageInfo
=
null
;
PageInfo
<
CallRecordListEntity
>
pageInfo
=
null
;
Date
current
=
new
Date
();
Date
current
=
new
Date
();
Date
startTime
=
DateUtils
.
addDays
(
current
,
-
3
);
Date
startTime
=
DateUtils
.
addDays
(
current
,
-
3
);
bean
.
setStartTime
(
DateFormatUtils
.
format
(
startTime
,
"yyyy-MM-dd 00:00:00"
));
bean
.
setStartTime
(
DateFormatUtils
.
format
(
startTime
,
"yyyy-MM-dd 00:00:00"
));
bean
.
setEndTime
(
DateFormatUtils
.
format
(
current
,
"yyyy-MM-dd 23:59:59"
));
bean
.
setEndTime
(
DateFormatUtils
.
format
(
current
,
"yyyy-MM-dd 23:59:59"
));
// 必须紧贴dao的查询方法
// 必须紧贴dao的查询方法
PageHelper
.
startPage
(
bean
.
getPageNo
(),
bean
.
getPageSize
());
PageHelper
.
startPage
(
bean
.
getPageNo
(),
bean
.
getPageSize
());
pageInfo
=
new
PageInfo
<
CallRecordListEntity
>(
dao
.
getCallRecordList
(
bean
));
pageInfo
=
new
PageInfo
<
CallRecordListEntity
>(
dao
.
getCallRecordList
(
bean
));
if
(
pageInfo
.
getPages
()<
bean
.
getPageNo
()){
// 页码大于总页数,则返回NULL
if
(
pageInfo
.
getPages
()<
bean
.
getPageNo
()){
// 页码大于总页数,则返回NULL
return
null
;
return
null
;
}
}
List
<
CallRecordListEntity
>
list
=
pageInfo
.
getList
();
List
<
CallRecordListEntity
>
list
=
pageInfo
.
getList
();
if
(
list
==
null
||
list
.
size
()
==
0
)
{
// 如果没有数据则返回NULL
if
(
list
==
null
||
list
.
size
()
==
0
)
{
// 如果没有数据则返回NULL
return
null
;
return
null
;
}
}
PageEntity
<
CallRecordListEntity
>
page
=
new
PageEntity
<
CallRecordListEntity
>();
//过滤重复记录
page
.
setPageNo
(
pageInfo
.
getPageNum
());
List
<
CallRecordListEntity
>
templist
=
new
ArrayList
<
CallRecordListEntity
>();
page
.
setPageSize
(
pageInfo
.
getPageSize
());
for
(
CallRecordListEntity
callRecordListEntity
:
list
)
{
page
.
setCount
(
pageInfo
.
getTotal
());
CallRecordListEntity
entity
=
dao
.
get
(
callRecordListEntity
);
page
.
setTotalPage
(
pageInfo
.
getPages
());
if
(
entity
!=
null
){
page
.
setList
(
pageInfo
.
getList
());
templist
.
add
(
callRecordListEntity
);
}
return
page
;
}
}
if
(
templist
.
size
()>
0
){
public
PageEntity
<
CallRecordListEntity
>
getCallSoundList
(
CallRecordListBean
bean
){
list
.
removeAll
(
templist
);
}
// return dao.getCallRecordList(bean);
PageEntity
<
CallRecordListEntity
>
page
=
new
PageEntity
<
CallRecordListEntity
>();
page
.
setPageNo
(
pageInfo
.
getPageNum
());
PageInfo
<
CallRecordListEntity
>
pageInfo
=
null
;
page
.
setPageSize
(
pageInfo
.
getPageSize
());
Date
current
=
new
Date
();
page
.
setCount
(
pageInfo
.
getTotal
());
Date
startTime
=
DateUtils
.
addDays
(
current
,
-
6
);
page
.
setTotalPage
(
pageInfo
.
getPages
());
bean
.
setStartTime
(
DateFormatUtils
.
format
(
startTime
,
"yyyy-MM-dd 00:00:00"
));
page
.
setList
(
pageInfo
.
getList
());
bean
.
setEndTime
(
DateFormatUtils
.
format
(
current
,
"yyyy-MM-dd 23:59:59"
));
// 必须紧贴dao的查询方法
return
page
;
PageHelper
.
startPage
(
bean
.
getPageNo
(),
bean
.
getPageSize
());
}
pageInfo
=
new
PageInfo
<
CallRecordListEntity
>(
dao
.
getCallSoundList
(
bean
));
public
PageEntity
<
CallRecordListEntity
>
getCallSoundList
(
CallRecordListBean
bean
){
if
(
pageInfo
.
getPages
()<
bean
.
getPageNo
()){
// 页码大于总页数,则返回NULL
// return dao.getCallRecordList(bean);
return
null
;
PageInfo
<
CallRecordListEntity
>
pageInfo
=
null
;
}
Date
current
=
new
Date
();
List
<
CallRecordListEntity
>
list
=
pageInfo
.
getList
();
Date
startTime
=
DateUtils
.
addDays
(
current
,
-
6
);
if
(
list
==
null
||
list
.
size
()
==
0
)
{
// 如果没有数据则返回NULL
bean
.
setStartTime
(
DateFormatUtils
.
format
(
startTime
,
"yyyy-MM-dd 00:00:00"
));
return
null
;
bean
.
setEndTime
(
DateFormatUtils
.
format
(
current
,
"yyyy-MM-dd 23:59:59"
));
}
// 必须紧贴dao的查询方法
PageEntity
<
CallRecordListEntity
>
page
=
new
PageEntity
<
CallRecordListEntity
>();
PageHelper
.
startPage
(
bean
.
getPageNo
(),
bean
.
getPageSize
());
page
.
setPageNo
(
pageInfo
.
getPageNum
());
pageInfo
=
new
PageInfo
<
CallRecordListEntity
>(
dao
.
getCallSoundList
(
bean
));
page
.
setPageSize
(
pageInfo
.
getPageSize
());
page
.
setCount
(
pageInfo
.
getTotal
());
if
(
pageInfo
.
getPages
()<
bean
.
getPageNo
()){
// 页码大于总页数,则返回NULL
page
.
setTotalPage
(
pageInfo
.
getPages
());
page
.
setList
(
pageInfo
.
getList
());
return
null
;
}
return
page
;
List
<
CallRecordListEntity
>
list
=
pageInfo
.
getList
();
}
if
(
list
==
null
||
list
.
size
()
==
0
)
{
// 如果没有数据则返回NULL
/**
return
null
;
* 根据电话号码查询,通话来电号码查询用户信息
}
*
PageEntity
<
CallRecordListEntity
>
page
=
new
PageEntity
<
CallRecordListEntity
>();
* 1、席位优先
page
.
setPageNo
(
pageInfo
.
getPageNum
());
* 2、查询最近通话记录
page
.
setPageSize
(
pageInfo
.
getPageSize
());
* 3、查询用户表,如果有多个用户就展示用户手机号或者座机号
page
.
setCount
(
pageInfo
.
getTotal
());
*
page
.
setTotalPage
(
pageInfo
.
getPages
());
* @author renmb
page
.
setList
(
pageInfo
.
getList
());
* @time 2017年1月5日
* @param bean
return
page
;
* @return
}
*/
/**
public
List
<
CallPhoneInfoListEntity
>
findUserByCallPhone
(
CallFindPhoneInfoBean
bean
,
boolean
isOnlySearch
){
* 根据电话号码查询,通话来电号码查询用户信息
*
// CallFindPhoneInfoBean bean = new CallFindPhoneInfoBean();
* 1、席位优先
// bean.setPhoneNumer(phoneNumer);
* 2、查询最近通话记录
bean
.
setMobileNubmer0
(
"0"
+
bean
.
getPhoneNumer
());
* 3、查询用户表,如果有多个用户就展示用户手机号或者座机号
bean
.
setMobileNubmer00
(
"00"
+
bean
.
getPhoneNumer
());
*
List
<
CallPhoneInfoListEntity
>
callList
=
dao
.
findUserByCallRecord
(
bean
);
* @author renmb
// List<CallPhoneInfoListEntity> seatList = dao.findSeatListByCallPhone(bean);
* @time 2017年1月5日
if
(
callList
==
null
||
callList
.
size
()
==
0
){
// 没有匹配到席位信息
* @param bean
* @return
// List<CallPhoneInfoListEntity> callList = dao.findUserByCallRecord(bean);
*/
List
<
CallPhoneInfoListEntity
>
seatList
=
dao
.
findSeatListByCallPhone
(
bean
);
public
List
<
CallPhoneInfoListEntity
>
findUserByCallPhone
(
CallFindPhoneInfoBean
bean
,
boolean
isOnlySearch
){
if
(
seatList
==
null
||
seatList
.
size
()
==
0
){
// 没有匹配到通话记录信息
// CallFindPhoneInfoBean bean = new CallFindPhoneInfoBean();
List
<
CallPhoneInfoListEntity
>
userList
=
dao
.
findUserByCallPhone
(
bean
);
// bean.setPhoneNumer(phoneNumer);
if
(
userList
==
null
||
userList
.
size
()
==
0
||
userList
.
size
()
>
1
){
// 没有匹配到用户信息,或者匹配个数大于1
bean
.
setMobileNubmer0
(
"0"
+
bean
.
getPhoneNumer
());
CallPhoneInfoListEntity
entity
=
new
CallPhoneInfoListEntity
();
bean
.
setMobileNubmer00
(
"00"
+
bean
.
getPhoneNumer
());
entity
.
setType
(
"PHONE"
);
List
<
CallPhoneInfoListEntity
>
callList
=
dao
.
findUserByCallRecord
(
bean
);
entity
.
setUserId
(
""
);
// List<CallPhoneInfoListEntity> seatList = dao.findSeatListByCallPhone(bean);
entity
.
setName
(
bean
.
getPhoneNumer
());
if
(
callList
==
null
||
callList
.
size
()
==
0
){
// 没有匹配到席位信息
entity
.
setPhone
(
bean
.
getPhoneNumer
());
List
<
CallPhoneInfoListEntity
>
phoneList
=
new
ArrayList
<
CallPhoneInfoListEntity
>(
1
);
// List<CallPhoneInfoListEntity> callList = dao.findUserByCallRecord(bean);
phoneList
.
add
(
entity
);
List
<
CallPhoneInfoListEntity
>
seatList
=
dao
.
findSeatListByCallPhone
(
bean
);
return
phoneList
;
if
(
seatList
==
null
||
seatList
.
size
()
==
0
){
// 没有匹配到通话记录信息
}
else
{
// 有用户信息直接返回
List
<
CallPhoneInfoListEntity
>
userList
=
dao
.
findUserByCallPhone
(
bean
);
return
userList
;
if
(
userList
==
null
||
userList
.
size
()
==
0
||
userList
.
size
()
>
1
){
// 没有匹配到用户信息,或者匹配个数大于1
}
CallPhoneInfoListEntity
entity
=
new
CallPhoneInfoListEntity
();
}
else
{
// 有通话记录信息,直接返回
entity
.
setType
(
"PHONE"
);
entity
.
setUserId
(
""
);
return
seatList
;
entity
.
setName
(
bean
.
getPhoneNumer
());
}
entity
.
setPhone
(
bean
.
getPhoneNumer
());
}
else
{
// 有席位信息直接返回
List
<
CallPhoneInfoListEntity
>
phoneList
=
new
ArrayList
<
CallPhoneInfoListEntity
>(
1
);
phoneList
.
add
(
entity
);
return
callList
;
return
phoneList
;
}
}
else
{
// 有用户信息直接返回
}
/**
return
userList
;
* 被叫方添加通话记录
}
*
}
else
{
// 有通话记录信息,直接返回
* @author renmb
* @time 2017年3月17日
return
seatList
;
* @param bean
}
* @param fromUser
}
else
{
// 有席位信息直接返回
*/
public
void
addCallRecordByCalled
(
CallFindPhoneInfoBean
bean
,
CallPhoneInfoListEntity
fromUser
){
return
callList
;
if
(
"RECORD"
.
equals
(
fromUser
.
getFromType
())){
// 记录是从通话记录里面获取的
}
}
return
;
/**
}
* 被叫方添加通话记录
CallPhoneInfoListEntity
calledUser
=
dao
.
findUserInfoByNumOrId
(
bean
);
// 被拨打方用户信息
*
if
(
calledUser
==
null
){
* @author renmb
* @time 2017年3月17日
return
;
* @param bean
}
* @param fromUser
CallRecordEntity
record
=
new
CallRecordEntity
();
*/
record
.
setCallType
(
"USER"
);
public
void
addCallRecordByCalled
(
CallFindPhoneInfoBean
bean
,
CallPhoneInfoListEntity
fromUser
){
record
.
setEndStatus
(
"CALLING"
);
if
(
"RECORD"
.
equals
(
fromUser
.
getFromType
())){
// 记录是从通话记录里面获取的
record
.
setId
(
IdWorker
.
getNextId
());
record
.
setChannelType
(
"APP"
);
return
;
record
.
setStartTime
(
new
Date
());
}
record
.
setAppCode
(
bean
.
getAppCode
());
CallPhoneInfoListEntity
calledUser
=
dao
.
findUserInfoByNumOrId
(
bean
);
// 被拨打方用户信息
record
.
setPlatform
(
bean
.
getPlatform
());
if
(
calledUser
==
null
){
record
.
setVersionName
(
bean
.
getVersionName
());
record
.
setUserCount
(
1
);
return
;
if
(
StringUtils
.
isEmpty
(
fromUser
.
getUserId
())){
}
record
.
setCreateBy
(
""
);
CallRecordEntity
record
=
new
CallRecordEntity
();
record
.
setCreateName
(
bean
.
getPhoneNumer
());
record
.
setCallType
(
"USER"
);
record
.
setCreatePhone
(
bean
.
getPhoneNumer
());
record
.
setEndStatus
(
"CALLING"
);
record
.
setCreateShowPhone
(
bean
.
getPhoneNumer
());
record
.
setId
(
IdWorker
.
getNextId
());
record
.
setPhoneType
(
Util
.
getPhoneType
(
bean
.
getPhoneNumer
()));
record
.
setChannelType
(
"APP"
);
}
else
{
record
.
setStartTime
(
new
Date
());
record
.
setAppCode
(
bean
.
getAppCode
());
record
.
setCreateBy
(
fromUser
.
getUserId
());
record
.
setPlatform
(
bean
.
getPlatform
());
record
.
setCreateName
(
fromUser
.
getName
());
record
.
setVersionName
(
bean
.
getVersionName
());
record
.
setCreatePhone
(
fromUser
.
getHuaweiNum
());
record
.
setUserCount
(
1
);
record
.
setCreateShowPhone
(
bean
.
getPhoneNumer
());
if
(
StringUtils
.
isEmpty
(
fromUser
.
getUserId
())){
record
.
setPhoneType
(
Util
.
getPhoneType
(
fromUser
.
getHuaweiNum
()));
record
.
setCreateBy
(
""
);
}
record
.
setCreateName
(
bean
.
getPhoneNumer
());
this
.
createCallRecord
(
record
);
// 添加主记录
record
.
setCreatePhone
(
bean
.
getPhoneNumer
());
record
.
setCreateShowPhone
(
bean
.
getPhoneNumer
());
CallPhoneBean
calledPhone
=
new
CallPhoneBean
();
record
.
setPhoneType
(
Util
.
getPhoneType
(
bean
.
getPhoneNumer
()));
calledPhone
.
setId
(
IdWorker
.
getNextId
());
}
else
{
calledPhone
.
setPhoneType
(
Util
.
getPhoneType
(
bean
.
getPhoneNumer
()));
calledPhone
.
setRecordId
(
record
.
getId
());
record
.
setCreateBy
(
fromUser
.
getUserId
());
calledPhone
.
setTitle
(
bean
.
getPhoneNumer
());
record
.
setCreateName
(
fromUser
.
getName
());
calledPhone
.
setFlow
(
"CALLED"
);
record
.
setCreatePhone
(
fromUser
.
getHuaweiNum
());
calledPhone
.
setUsername
(
calledUser
.
getName
());
record
.
setCreateShowPhone
(
bean
.
getPhoneNumer
());
calledPhone
.
setUserId
(
calledUser
.
getUserId
());
record
.
setPhoneType
(
Util
.
getPhoneType
(
fromUser
.
getHuaweiNum
()));
}
List
<
CallPhoneBean
>
phoneList
=
new
ArrayList
<
CallPhoneBean
>(
1
);
this
.
createCallRecord
(
record
);
// 添加主记录
phoneList
.
add
(
calledPhone
);
this
.
addCallPhoneList
(
phoneList
);
// 添加电话列表
CallPhoneBean
calledPhone
=
new
CallPhoneBean
();
}
calledPhone
.
setId
(
IdWorker
.
getNextId
());
/**
calledPhone
.
setPhoneType
(
Util
.
getPhoneType
(
bean
.
getPhoneNumer
()));
* 综合查询手机号的归属地信息
calledPhone
.
setRecordId
(
record
.
getId
());
*
calledPhone
.
setTitle
(
bean
.
getPhoneNumer
());
* @author renmb
calledPhone
.
setFlow
(
"CALLED"
);
* @time 2017年1月22日
calledPhone
.
setUsername
(
calledUser
.
getName
());
* @param mobile
calledPhone
.
setUserId
(
calledUser
.
getUserId
());
* @return
*/
List
<
CallPhoneBean
>
phoneList
=
new
ArrayList
<
CallPhoneBean
>(
1
);
@Transactional
(
readOnly
=
false
)
phoneList
.
add
(
calledPhone
);
public
CallPhoneAreaEntity
addPhoneArea
(
String
mobile
){
this
.
addCallPhoneList
(
phoneList
);
// 添加电话列表
if
(
StringUtils
.
isEmpty
(
mobile
)
||
mobile
.
length
()<
7
){
}
/**
return
null
;
* 综合查询手机号的归属地信息
}
*
String
src
=
new
String
(
mobile
);
* @author renmb
CallPhoneAreaEntity
phoneArea
=
null
;
* @time 2017年1月22日
mobile
=
mobile
.
replaceAll
(
"^0+"
,
""
);
// 去掉手机号前面的0
* @param mobile
if
(
mobile
.
length
()>
7
){
* @return
CallPhoneAreaEntity
searchMobile
=
new
CallPhoneAreaEntity
();
*/
// 第一步:通过查询记录获取手机归属地信息,暂时注释掉不适用,主要用于控制特殊号码的归宿地查询
@Transactional
(
readOnly
=
false
)
/*
public
CallPhoneAreaEntity
addPhoneArea
(
String
mobile
){
searchMobile.setMobileNubmer0("0"+mobile);
if
(
StringUtils
.
isEmpty
(
mobile
)
||
mobile
.
length
()<
7
){
searchMobile.setMobileNubmer00("00"+mobile);
searchMobile.setMobileNubmer000("000"+mobile);
return
null
;
phoneArea = dao.getPhoneAreaByMobile(searchMobile);// 到记录表里面查询
}
if(phoneArea != null && StringUtils.isNotEmpty(phoneArea.getPremobile())){
String
src
=
new
String
(
mobile
);
phoneArea.setMobileNubmer(phoneArea.getPremobile()+mobile);
CallPhoneAreaEntity
phoneArea
=
null
;
return phoneArea;
mobile
=
mobile
.
replaceAll
(
"^0+"
,
""
);
// 去掉手机号前面的0
}
if
(
mobile
.
length
()>
7
){
*/
CallPhoneAreaEntity
searchMobile
=
new
CallPhoneAreaEntity
();
// 第二步: 通过地区码查询手机归宿地信息
// 第一步:通过查询记录获取手机归属地信息,暂时注释掉不适用,主要用于控制特殊号码的归宿地查询
searchMobile
.
setAreaCode
(
mobile
.
substring
(
0
,
7
));
/*
searchMobile
.
setMobile
(
mobile
);
searchMobile.setMobileNubmer0("0"+mobile);
phoneArea
=
dao
.
getPhoneAreaByAreaCode
(
searchMobile
);
searchMobile.setMobileNubmer00("00"+mobile);
if
(
phoneArea
!=
null
&&
StringUtils
.
isNotEmpty
(
phoneArea
.
getPremobile
())){
searchMobile.setMobileNubmer000("000"+mobile);
phoneArea
.
setMobileNubmer
(
phoneArea
.
getPremobile
()+
mobile
);
phoneArea = dao.getPhoneAreaByMobile(searchMobile);// 到记录表里面查询
return
phoneArea
;
if(phoneArea != null && StringUtils.isNotEmpty(phoneArea.getPremobile())){
}
phoneArea.setMobileNubmer(phoneArea.getPremobile()+mobile);
// 第三步:通过360接口获取归属地信息
return phoneArea;
phoneArea
=
this
.
getCallPhoneAreaBy360
(
mobile
);
}
if
(
phoneArea
!=
null
){
*/
if
(
StringUtils
.
isNotEmpty
(
phoneArea
.
getPremobile
())){
// 手机类型进行缓存数据库
// 第二步: 通过地区码查询手机归宿地信息
searchMobile
.
setAreaCode
(
mobile
.
substring
(
0
,
7
));
phoneArea
.
setId
(
IdWorker
.
getNextId
());
searchMobile
.
setMobile
(
mobile
);
phoneArea
.
setUpdateDate
(
new
Date
());
phoneArea
=
dao
.
getPhoneAreaByAreaCode
(
searchMobile
);
if
(
phoneArea
.
getMobile
().
length
()>=
7
){
if
(
phoneArea
!=
null
&&
StringUtils
.
isNotEmpty
(
phoneArea
.
getPremobile
())){
phoneArea
.
setMobileNubmer
(
phoneArea
.
getPremobile
()+
mobile
);
phoneArea
.
setAreaCode
(
phoneArea
.
getMobile
().
substring
(
0
,
7
));
return
phoneArea
;
dao
.
addPhoneAreaCode
(
phoneArea
);
}
}
// 第三步:通过360接口获取归属地信息
dao
.
addPhoneAreaRecord
(
phoneArea
);
phoneArea
=
this
.
getCallPhoneAreaBy360
(
mobile
);
}
else
{
// 非手机号,按座机号处理
if
(
phoneArea
!=
null
){
if
(
StringUtils
.
isNotEmpty
(
phoneArea
.
getPremobile
())){
// 手机类型进行缓存数据库
phoneArea
.
setShowPhone
(
src
);
phoneArea
.
setPhone
(
Util
.
formatedWorkPhone
(
src
));
phoneArea
.
setId
(
IdWorker
.
getNextId
());
phoneArea
.
setType
(
"PHONE"
);
phoneArea
.
setUpdateDate
(
new
Date
());
}
if
(
phoneArea
.
getMobile
().
length
()>=
7
){
return
phoneArea
;
}
phoneArea
.
setAreaCode
(
phoneArea
.
getMobile
().
substring
(
0
,
7
));
}
dao
.
addPhoneAreaCode
(
phoneArea
);
phoneArea
=
new
CallPhoneAreaEntity
();
}
phoneArea
.
setShowPhone
(
src
);
dao
.
addPhoneAreaRecord
(
phoneArea
);
phoneArea
.
setPhone
(
Util
.
formatedWorkPhone
(
src
));
}
else
{
// 非手机号,按座机号处理
phoneArea
.
setType
(
"PHONE"
);
return
phoneArea
;
phoneArea
.
setShowPhone
(
src
);
}
phoneArea
.
setPhone
(
Util
.
formatedWorkPhone
(
src
));
@Transactional
(
readOnly
=
false
)
phoneArea
.
setType
(
"PHONE"
);
public
CallPhoneAreaEntity
getCallPhoneAreaBy360
(
String
mobile
){
}
CallPhoneAreaEntity
callPhone
=
new
CallPhoneAreaEntity
();
return
phoneArea
;
callPhone
.
setMobile
(
mobile
);
}
if
(
StringUtils
.
isNotBlank
(
mobile
)){
// 格式化手机号
}
phoneArea
=
new
CallPhoneAreaEntity
();
if
(
mobile
.
startsWith
(
"+"
)){
// 国外手机号,前面加拨3个0
phoneArea
.
setShowPhone
(
src
);
phoneArea
.
setPhone
(
Util
.
formatedWorkPhone
(
src
));
callPhone
.
setType
(
"MOBILE"
);
phoneArea
.
setType
(
"PHONE"
);
callPhone
.
setPremobile
(
"000"
);
return
phoneArea
;
callPhone
.
setMobileNubmer
(
"000"
+
mobile
.
replace
(
"+"
,
""
));
}
return
callPhone
;
@Transactional
(
readOnly
=
false
)
}
else
if
(
mobile
.
startsWith
(
"0"
)
==
false
){
// 可能是手机号
public
CallPhoneAreaEntity
getCallPhoneAreaBy360
(
String
mobile
){
PhoneAreaEntity
area
=
PhoneAreaUtil
.
get360PhoneArea
(
mobile
);
CallPhoneAreaEntity
callPhone
=
new
CallPhoneAreaEntity
();
if
(
area
==
null
){
callPhone
.
setMobile
(
mobile
);
if
(
StringUtils
.
isNotBlank
(
mobile
)){
// 格式化手机号
area
=
PhoneAreaUtil
.
get360PhoneArea
(
mobile
);
}
if
(
mobile
.
startsWith
(
"+"
)){
// 国外手机号,前面加拨3个0
if
(
area
!=
null
&&
StringUtils
.
isNotBlank
(
area
.
getProvince
())){
// 能够查到省份信息
callPhone
.
setType
(
"MOBILE"
);
if
(
area
.
getProvince
().
contains
(
"北京"
)
callPhone
.
setPremobile
(
"000"
);
||
(
StringUtils
.
isNotBlank
(
area
.
getCity
())
&&
area
.
getCity
().
contains
(
"北京"
))){
// 北京前面加拨一个0
callPhone
.
setMobileNubmer
(
"000"
+
mobile
.
replace
(
"+"
,
""
));
return
callPhone
;
callPhone
.
setType
(
"MOBILE"
);
}
else
if
(
mobile
.
startsWith
(
"0"
)
==
false
){
// 可能是手机号
callPhone
.
setMobileNubmer
(
"0"
+
mobile
);
// 加拨1个0
PhoneAreaEntity
area
=
PhoneAreaUtil
.
get360PhoneArea
(
mobile
);
callPhone
.
setPremobile
(
"0"
);
if
(
area
==
null
){
callPhone
.
setMobileProvince
(
"北京"
);
callPhone
.
setMobileCity
(
"北京"
);
area
=
PhoneAreaUtil
.
get360PhoneArea
(
mobile
);
callPhone
.
setMobileSp
(
StringUtils
.
isBlank
(
area
.
getSp
())
?
""
:
area
.
getSp
());
}
return
callPhone
;
if
(
area
!=
null
&&
StringUtils
.
isNotBlank
(
area
.
getProvince
())){
// 能够查到省份信息
}
else
{
// 非北京号码加拨两个0
if
(
area
.
getProvince
().
contains
(
"北京"
)
callPhone
.
setType
(
"MOBILE"
);
||
(
StringUtils
.
isNotBlank
(
area
.
getCity
())
&&
area
.
getCity
().
contains
(
"北京"
))){
// 北京前面加拨一个0
callPhone
.
setMobileNubmer
(
"00"
+
mobile
);
// 加拨2个0
callPhone
.
setPremobile
(
"00"
);
callPhone
.
setType
(
"MOBILE"
);
callPhone
.
setMobileProvince
(
area
.
getProvince
());
callPhone
.
setMobileNubmer
(
"0"
+
mobile
);
// 加拨1个0
callPhone
.
setMobileCity
(
StringUtils
.
isBlank
(
area
.
getCity
())
?
""
:
area
.
getCity
());
callPhone
.
setPremobile
(
"0"
);
callPhone
.
setMobileSp
(
StringUtils
.
isBlank
(
area
.
getSp
())
?
""
:
area
.
getSp
());
callPhone
.
setMobileProvince
(
"北京"
);
return
callPhone
;
callPhone
.
setMobileCity
(
"北京"
);
}
callPhone
.
setMobileSp
(
StringUtils
.
isBlank
(
area
.
getSp
())
?
""
:
area
.
getSp
());
}
return
callPhone
;
}
}
else
{
// 非北京号码加拨两个0
}
// 非手机号,按座机号处理
callPhone
.
setType
(
"MOBILE"
);
callPhone
.
setShowPhone
(
mobile
);
callPhone
.
setMobileNubmer
(
"00"
+
mobile
);
// 加拨2个0
callPhone
.
setPhone
(
Util
.
formatedWorkPhone
(
mobile
));
callPhone
.
setPremobile
(
"00"
);
callPhone
.
setType
(
"PHONE"
);
callPhone
.
setMobileProvince
(
area
.
getProvince
());
return
callPhone
;
callPhone
.
setMobileCity
(
StringUtils
.
isBlank
(
area
.
getCity
())
?
""
:
area
.
getCity
());
}
callPhone
.
setMobileSp
(
StringUtils
.
isBlank
(
area
.
getSp
())
?
""
:
area
.
getSp
());
/**
return
callPhone
;
* 添加安科同步过来的数据
}
*
}
* @author renmb
}
* @time 2017年2月28日
}
* @param entity
// 非手机号,按座机号处理
* @return
callPhone
.
setShowPhone
(
mobile
);
*/
callPhone
.
setPhone
(
Util
.
formatedWorkPhone
(
mobile
));
public
boolean
addSoundRecord
(
CallSoundRecordBean
entity
,
List
<
CallPhoneBean
>
phoneList
,
CallRecordEntity
record
){
callPhone
.
setType
(
"PHONE"
);
dao
.
createCallRecord
(
record
);
return
callPhone
;
dao
.
addCallPhoneList
(
phoneList
);
}
Integer
count
=
dao
.
addSoundRecord
(
entity
);
/**
return
count
!=
null
&&
count
>
0
;
* 添加安科同步过来的数据
}
*
* @author renmb
public
Map
<
String
,
String
>
findPhneByHuaweiNum
(
List
<
String
>
huweiNumList
){
* @time 2017年2月28日
* @param entity
HuaweiNumListEntity
entity
=
new
HuaweiNumListEntity
();
* @return
entity
.
setHuweiNumList
(
huweiNumList
);
*/
public
boolean
addSoundRecord
(
CallSoundRecordBean
entity
,
List
<
CallPhoneBean
>
phoneList
,
CallRecordEntity
record
){
List
<
CallPhoneInfoListEntity
>
list
=
dao
.
findPhneListByHuaweiNum
(
entity
);
dao
.
createCallRecord
(
record
);
if
(
list
==
null
||
list
.
size
()
==
0
){
dao
.
addCallPhoneList
(
phoneList
);
Integer
count
=
dao
.
addSoundRecord
(
entity
);
return
null
;
return
count
!=
null
&&
count
>
0
;
}
}
Map
<
String
,
String
>
map
=
new
HashMap
<
String
,
String
>();
for
(
CallPhoneInfoListEntity
p:
list
){
public
Map
<
String
,
String
>
findPhneByHuaweiNum
(
List
<
String
>
huweiNumList
){
map
.
put
(
p
.
getHuaweiNum
(),
p
.
getPhone
());
HuaweiNumListEntity
entity
=
new
HuaweiNumListEntity
();
}
entity
.
setHuweiNumList
(
huweiNumList
);
return
map
;
}
List
<
CallPhoneInfoListEntity
>
list
=
dao
.
findPhneListByHuaweiNum
(
entity
);
public
String
GetPhoneById
(
String
id
){
if
(
list
==
null
||
list
.
size
()
==
0
){
return
dao
.
GetPhoneById
(
id
);
}
return
null
;
}
Map
<
String
,
String
>
map
=
new
HashMap
<
String
,
String
>();
for
(
CallPhoneInfoListEntity
p:
list
){
public
List
<
MemberEntity
>
getMemberList
(
String
id
)
{
return
dao
.
getMemberList
(
id
);
map
.
put
(
p
.
getHuaweiNum
(),
p
.
getPhone
());
}
}
// public static void main(String[] args){
return
map
;
// Date current = new Date();
}
// Date startTime = DateUtils.addDays(current, -6);
public
String
GetPhoneById
(
String
id
){
// System.out.println(DateFormatUtils.format(startTime, "yyyy-MM-dd 00:00:00"));
return
dao
.
GetPhoneById
(
id
);
// System.out.println(DateFormatUtils.format(current, "yyyy-MM-dd 23:59:59"));
}
// }
public
String
getNameByPhone
(
String
createPhone
)
{
// TODO Auto-generated method stub
public
List
<
MemberEntity
>
getMemberList
(
String
id
)
{
return
dao
.
getNameByPhone
(
createPhone
);
return
dao
.
getMemberList
(
id
);
}
}
// public static void main(String[] args){
public
String
getNameByPhoneFromSeat
(
String
createPhone
)
{
// Date current = new Date();
// TODO Auto-generated method stub
// Date startTime = DateUtils.addDays(current, -6);
return
dao
.
getNameByPhoneFromSeat
(
createPhone
);
// System.out.println(DateFormatUtils.format(startTime, "yyyy-MM-dd 00:00:00"));
}
// System.out.println(DateFormatUtils.format(current, "yyyy-MM-dd 23:59:59"));
// }
public
String
getIdByPhoneFromSeat
(
String
callNo
)
{
// TODO Auto-generated method stub
public
String
getNameByPhone
(
String
createPhone
)
{
return
dao
.
getIdByPhoneFromSeat
(
callNo
);
// TODO Auto-generated method stub
}
return
dao
.
getNameByPhone
(
createPhone
);
}
public
String
getIdByPhone
(
String
callNo
)
{
// TODO Auto-generated method stub
public
String
getNameByPhoneFromSeat
(
String
createPhone
)
{
return
dao
.
getIdByPhone
(
callNo
);
// TODO Auto-generated method stub
}
return
dao
.
getNameByPhoneFromSeat
(
createPhone
);
}
}
public
String
getIdByPhoneFromSeat
(
String
callNo
)
{
// TODO Auto-generated method stub
return
dao
.
getIdByPhoneFromSeat
(
callNo
);
}
public
String
getIdByPhone
(
String
callNo
)
{
// TODO Auto-generated method stub
return
dao
.
getIdByPhone
(
callNo
);
}
}
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