Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
T
task2.0
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
首航-临时账号
task2.0
Commits
fe67d18c
Commit
fe67d18c
authored
Nov 08, 2017
by
Java - 段鹏举
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
通话记录同步过滤重复
parent
95104e86
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
65 additions
and
35 deletions
+65
-35
SoundService.java
src/com/foc/sound/service/SoundService.java
+65
-35
No files found.
src/com/foc/sound/service/SoundService.java
View file @
fe67d18c
...
@@ -3,24 +3,6 @@
...
@@ -3,24 +3,6 @@
*/
*/
package
com
.
foc
.
sound
.
service
;
package
com
.
foc
.
sound
.
service
;
import
java.io.File
;
import
java.sql.ResultSet
;
import
java.sql.SQLException
;
import
java.text.ParseException
;
import
java.text.SimpleDateFormat
;
import
java.util.ArrayList
;
import
java.util.Date
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.TreeMap
;
import
org.apache.commons.codec.digest.DigestUtils
;
import
org.apache.commons.dbutils.QueryRunner
;
import
org.apache.commons.dbutils.ResultSetHandler
;
import
org.apache.commons.dbutils.handlers.BeanListHandler
;
import
org.apache.commons.lang3.StringUtils
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSONArray
;
import
com.alibaba.fastjson.JSONArray
;
import
com.alibaba.fastjson.JSONObject
;
import
com.alibaba.fastjson.JSONObject
;
...
@@ -30,13 +12,19 @@ import com.foc.sound.entity.CallPhoneInfoListEntity;
...
@@ -30,13 +12,19 @@ import com.foc.sound.entity.CallPhoneInfoListEntity;
import
com.foc.sound.entity.CallRecordsEntity
;
import
com.foc.sound.entity.CallRecordsEntity
;
import
com.foc.sound.entity.SoundRecordingEntity
;
import
com.foc.sound.entity.SoundRecordingEntity
;
import
com.foc.sound.entity.UserInfo
;
import
com.foc.sound.entity.UserInfo
;
import
com.foc.util.DBHandler
;
import
com.foc.util.*
;
import
com.foc.util.DBHelper
;
import
org.apache.commons.codec.digest.DigestUtils
;
import
com.foc.util.IdWorker
;
import
org.apache.commons.dbutils.QueryRunner
;
import
com.foc.util.MapCounter
;
import
org.apache.commons.dbutils.ResultSetHandler
;
import
com.foc.util.Util
;
import
org.apache.commons.dbutils.handlers.BeanListHandler
;
import
com.foc.util.PathFormatUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
com.foc.util.WavToMp3
;
import
java.io.File
;
import
java.sql.ResultSet
;
import
java.sql.SQLException
;
import
java.text.ParseException
;
import
java.text.SimpleDateFormat
;
import
java.util.*
;
/**
/**
*
*
...
@@ -204,9 +192,9 @@ public class SoundService {
...
@@ -204,9 +192,9 @@ public class SoundService {
*
*
* @author zhanglg
* @author zhanglg
* @time 2017年2月24日
* @time 2017年2月24日
* @param
callNo
* @param
start
* @param
acceptNo
* @param
end
* @param
beginTime
* @param
flag
* @return
* @return
*/
*/
...
@@ -409,9 +397,10 @@ public class SoundService {
...
@@ -409,9 +397,10 @@ public class SoundService {
*
*
* @author zhanglg
* @author zhanglg
* @time 2017年2月27日
* @time 2017年2月27日
* @param
resul
t
* @param
lis
t
* @param end
* @param end
* @param start
* @param start
* @param flag
*/
*/
public
void
insertData
(
List
<
SoundRecordingEntity
>
list
,
String
start
,
String
end
,
String
flag
)
{
public
void
insertData
(
List
<
SoundRecordingEntity
>
list
,
String
start
,
String
end
,
String
flag
)
{
...
@@ -545,6 +534,36 @@ public class SoundService {
...
@@ -545,6 +534,36 @@ public class SoundService {
String
recordId
=
IdWorker
.
getNextId
();
String
recordId
=
IdWorker
.
getNextId
();
insertCallRECORDS
(
entity
,
callUser
,
recordId
,
flag
);
insertCallRECORDS
(
entity
,
callUser
,
recordId
,
flag
);
insertCallPHONE
(
entity
,
acceptUser
,
recordId
,
flag
,
callUser
.
getName
());
insertCallPHONE
(
entity
,
acceptUser
,
recordId
,
flag
,
callUser
.
getName
());
// 查询是否有重复记录(create_name,username,start_time)
StringBuilder
stringBuilder
=
new
StringBuilder
();
stringBuilder
.
append
(
"SELECT id,\n"
+
"\t create_by,\n"
+
"\t create_name,\n"
+
"\t create_phone,\n"
+
"\t call_type,\n"
+
"\t end_status,\n"
+
"\t user_count,\n"
+
"\t start_time,\n"
+
"\t end_time\n"
);
String
tableName
=
Constants
.
FOC_CALL_RECORDS
;
if
(
GConstants
.
NO
.
equals
(
flag
))
{
tableName
=
Constants
.
FOC_SOUND_RECORDS
;
}
stringBuilder
.
append
(
"FROM "
).
append
(
tableName
).
append
(
"\n"
)
.
append
(
"WHERE end_status != 'INIT'\n"
)
.
append
(
"AND create_name = '"
).
append
(
callUser
.
getName
()).
append
(
"'\n"
)
.
append
(
"AND start_time <= '"
).
append
(
entity
.
getEndTime
()).
append
(
"'\n"
)
.
append
(
"AND id != '"
).
append
(
recordId
).
append
(
"'\n"
)
.
append
(
"ORDER BY start_time DESC"
);
List
<
Map
<
String
,
Object
>>
soundRecordsList
=
DBHelper
.
fetch
(
"foc"
,
stringBuilder
.
toString
());
// 过滤掉了id,所以查出的数据就是重复的
if
(
soundRecordsList
!=
null
&&
soundRecordsList
.
size
()
>
0
)
{
for
(
Map
<
String
,
Object
>
map
:
soundRecordsList
)
{
// 将重复数据复制到备份表,并将原表数据删除
}
}
}
}
public
UserInfo
GetIdByPhone
(
String
phone
)
{
public
UserInfo
GetIdByPhone
(
String
phone
)
{
...
@@ -552,8 +571,9 @@ public class SoundService {
...
@@ -552,8 +571,9 @@ public class SoundService {
contents
.
put
(
"phoneNumer"
,
phone
);
contents
.
put
(
"phoneNumer"
,
phone
);
List
<
CallPhoneInfoListEntity
>
list
=
Util
.
arrayApi
(
"/api/call/findPhoneInfo"
,
contents
,
CallPhoneInfoListEntity
.
class
);
List
<
CallPhoneInfoListEntity
>
list
=
Util
.
arrayApi
(
"/api/call/findPhoneInfo"
,
contents
,
CallPhoneInfoListEntity
.
class
);
if
(
list
==
null
||
list
.
size
()
==
0
)
if
(
list
==
null
||
list
.
size
()
==
0
)
{
return
null
;
return
null
;
}
CallPhoneInfoListEntity
info
=
list
.
get
(
0
);
CallPhoneInfoListEntity
info
=
list
.
get
(
0
);
if
(
info
!=
null
&&
StringUtils
.
isNotEmpty
(
info
.
getName
())){
if
(
info
!=
null
&&
StringUtils
.
isNotEmpty
(
info
.
getName
())){
if
(
StringUtils
.
isEmpty
(
info
.
getUserId
())){
if
(
StringUtils
.
isEmpty
(
info
.
getUserId
())){
...
@@ -680,16 +700,26 @@ public class SoundService {
...
@@ -680,16 +700,26 @@ public class SoundService {
}
}
private
String
getPhoneType
(
String
phone
)
{
private
String
getPhoneType
(
String
phone
)
{
if
(
StringUtils
.
isEmpty
(
phone
))
// 未知
// 未知
if
(
StringUtils
.
isEmpty
(
phone
))
{
return
"UNKNOWN"
;
return
"UNKNOWN"
;
if
(
phone
.
startsWith
(
"1"
)
&&
phone
.
length
()
==
11
)
// 手机号
}
// 手机号
if
(
phone
.
startsWith
(
"1"
)
&&
phone
.
length
()
==
11
)
{
return
"MOBILE"
;
return
"MOBILE"
;
if
(
phone
.
startsWith
(
"01"
)
&&
phone
.
length
()
==
12
)
// 手机号
}
// 手机号
if
(
phone
.
startsWith
(
"01"
)
&&
phone
.
length
()
==
12
)
{
return
"MOBILE"
;
return
"MOBILE"
;
if
(
phone
.
startsWith
(
"001"
)
&&
phone
.
length
()
==
13
)
// 手机号
}
// 手机号
if
(
phone
.
startsWith
(
"001"
)
&&
phone
.
length
()
==
13
)
{
return
"MOBILE"
;
return
"MOBILE"
;
if
(
phone
.
startsWith
(
"6"
)
&&
phone
.
length
()
==
4
)
// 华为短号
}
// 华为短号
if
(
phone
.
startsWith
(
"6"
)
&&
phone
.
length
()
==
4
)
{
return
"HWNUBMER"
;
return
"HWNUBMER"
;
}
return
"PHONE"
;
// 座机
return
"PHONE"
;
// 座机
}
}
private
String
targetPath
(
String
downloadUrl
){
private
String
targetPath
(
String
downloadUrl
){
...
...
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