Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
T
task3.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
首航-临时账号
task3.0
Commits
d91c74b8
Commit
d91c74b8
authored
May 05, 2019
by
zt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
添加检测功能
parent
9007fe44
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
180 additions
and
23 deletions
+180
-23
pom.xml
pom.xml
+13
-1
SoundsMaxIdDao.java
src/main/java/com/foc/dao/SoundsMaxIdDao.java
+11
-0
SoundInfo.java
src/main/java/com/foc/entity/SoundInfo.java
+64
-0
SoundMonitorService.java
src/main/java/com/foc/service/SoundMonitorService.java
+47
-7
SoundsMaxIdMapper.xml
src/main/resources/mapper/SoundsMaxIdMapper.xml
+29
-2
mybatis-config.xml
src/main/resources/mybatis-config.xml
+16
-13
No files found.
pom.xml
View file @
d91c74b8
...
@@ -14,7 +14,6 @@
...
@@ -14,7 +14,6 @@
<log4j.version>
1.2.12
</log4j.version>
<log4j.version>
1.2.12
</log4j.version>
</properties>
</properties>
<dependencies>
<dependencies>
<dependency>
<dependency>
<groupId>
mysql
</groupId>
<groupId>
mysql
</groupId>
...
@@ -57,6 +56,19 @@
...
@@ -57,6 +56,19 @@
<version>
1.2.7
</version>
<version>
1.2.7
</version>
</dependency>
</dependency>
<dependency>
<groupId>
com.google.guava
</groupId>
<artifactId>
guava
</artifactId>
<version>
20.0
</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.springframework/spring-core -->
<dependency>
<groupId>
org.springframework
</groupId>
<artifactId>
spring-core
</artifactId>
<version>
5.1.4.RELEASE
</version>
</dependency>
<!-- 封装实体依赖 -->
<!-- 封装实体依赖 -->
<dependency>
<dependency>
<groupId>
org.projectlombok
</groupId>
<groupId>
org.projectlombok
</groupId>
...
...
src/main/java/com/foc/dao/SoundsMaxIdDao.java
View file @
d91c74b8
package
com
.
foc
.
dao
;
package
com
.
foc
.
dao
;
import
com.foc.entity.SoundInfo
;
import
com.foc.entity.SoundsMaxId
;
import
com.foc.entity.SoundsMaxId
;
import
org.apache.ibatis.annotations.Param
;
import
java.util.List
;
/**
/**
* @Author: lisu
* @Author: lisu
...
@@ -16,4 +19,12 @@ public interface SoundsMaxIdDao {
...
@@ -16,4 +19,12 @@ public interface SoundsMaxIdDao {
*/
*/
SoundsMaxId
getMaxId
();
SoundsMaxId
getMaxId
();
/**
* 获取信息
*
* @param date
* @return
*/
List
<
SoundInfo
>
getInfo
(
@Param
(
"date"
)
String
date
);
}
}
src/main/java/com/foc/entity/SoundInfo.java
0 → 100644
View file @
d91c74b8
package
com
.
foc
.
entity
;
import
lombok.Data
;
import
java.util.Date
;
/**
*
*
* @author zangtao
* @create 2019 - 04 -30 13:55
*/
@Data
public
class
SoundInfo
{
/**
* create_phone 发起人手机号
*/
private
String
callNo
;
/**
* ac.create_name 呼出电话号码 自己
*/
private
String
callName
;
/**
* ap.phone 手机 被拨的电话号码
*/
private
String
acceptNo
;
/**
* username 用户名
*/
private
String
acceptName
;
/**
* ac.start_time 拨打电话开始时间
*/
private
Date
beginTime
;
/**
* 拨打电话结束时间
*/
private
Date
endTime
;
/**
* 地址
*/
private
String
downloadUrl
;
/**
* duration 通话时长
*/
private
String
duration
;
/**
* end_status
* 通话最终状态 CALLING 通话中 FAILD 失败 SUCCESS 成功 INIT初始值
*/
private
String
result
;
}
src/main/java/com/foc/service/SoundMonitorService.java
View file @
d91c74b8
package
com
.
foc
.
service
;
package
com
.
foc
.
service
;
import
com.foc.dao.SoundsMaxIdDao
;
import
com.foc.dao.SoundsMaxIdDao
;
import
com.foc.entity.SoundInfo
;
import
com.foc.entity.SoundsMaxId
;
import
com.foc.entity.SoundsMaxId
;
import
com.foc.util.StringUtils
;
import
lombok.extern.log4j.Log4j
;
import
lombok.extern.log4j.Log4j
;
import
org.apache.ibatis.io.Resources
;
import
org.apache.ibatis.io.Resources
;
import
org.apache.ibatis.session.SqlSession
;
import
org.apache.ibatis.session.SqlSession
;
...
@@ -11,6 +13,7 @@ import org.apache.ibatis.session.SqlSessionFactoryBuilder;
...
@@ -11,6 +13,7 @@ import org.apache.ibatis.session.SqlSessionFactoryBuilder;
import
java.io.IOException
;
import
java.io.IOException
;
import
java.io.Reader
;
import
java.io.Reader
;
import
java.util.Date
;
import
java.util.Date
;
import
java.util.List
;
/**
/**
* @Author: lisu
* @Author: lisu
...
@@ -19,11 +22,14 @@ import java.util.Date;
...
@@ -19,11 +22,14 @@ import java.util.Date;
*/
*/
@Log4j
@Log4j
public
class
SoundMonitorService
{
public
class
SoundMonitorService
{
private
Reader
reader
;
private
SqlSessionFactory
sqlSessionFactory
;
private
SqlSession
session
;
public
void
init
()
{
private
static
Reader
reader
;
private
static
SqlSessionFactory
sqlSessionFactory
;
private
static
SqlSession
session
;
public
static
void
init
()
{
try
{
try
{
reader
=
Resources
.
getResourceAsReader
(
"mybatis-config.xml"
);
reader
=
Resources
.
getResourceAsReader
(
"mybatis-config.xml"
);
sqlSessionFactory
=
new
SqlSessionFactoryBuilder
().
build
(
reader
);
sqlSessionFactory
=
new
SqlSessionFactoryBuilder
().
build
(
reader
);
...
@@ -31,16 +37,50 @@ public class SoundMonitorService {
...
@@ -31,16 +37,50 @@ public class SoundMonitorService {
}
catch
(
IOException
e
)
{
}
catch
(
IOException
e
)
{
log
.
error
(
"连接数据库异常"
);
log
.
error
(
"连接数据库异常"
);
e
.
printStackTrace
();
e
.
printStackTrace
();
}
finally
{
session
.
close
();
}
}
// finally {
// //session.close();
// }
}
}
public
void
test
()
{
public
static
Integer
test
()
{
SoundsMaxIdDao
soundsMaxIdDao
=
session
.
getMapper
(
SoundsMaxIdDao
.
class
);
SoundsMaxIdDao
soundsMaxIdDao
=
session
.
getMapper
(
SoundsMaxIdDao
.
class
);
SoundsMaxId
maxId
=
soundsMaxIdDao
.
getMaxId
();
SoundsMaxId
maxId
=
soundsMaxIdDao
.
getMaxId
();
String
updateTime
=
maxId
.
getUpdateDate
();
String
updateTime
=
maxId
.
getUpdateDate
();
log
.
info
(
"当前系统时间:"
+
new
Date
());
log
.
info
(
"当前系统时间:"
+
new
Date
());
//比较时间,如果相差20分钟没有执行
//比较时间,如果相差20分钟没有执行
//计数
int
i
=
0
;
List
<
SoundInfo
>
list
=
soundsMaxIdDao
.
getInfo
(
updateTime
);
for
(
SoundInfo
soundInfo
:
list
){
//成功且没有url的
if
(
soundInfo
.
getResult
().
equals
(
"SUCCESS"
)
&&
StringUtils
.
isEmpty
(
soundInfo
.
getDownloadUrl
()
)
){
i
++;
}
}
if
(
i
!=
0
&&
list
!=
null
){
double
d
=
i
/
list
.
size
();
if
(
d
>
0.8
){
log
.
info
(
"成功率不足80%"
);
return
1
;
}
}
else
{
log
.
info
(
"全部成功"
);
return
2
;
}
return
null
;
}
}
public
static
void
main
(
String
[]
args
)
{
init
();
System
.
out
.
println
(
test
());
}
}
}
src/main/resources/mapper/SoundsMaxIdMapper.xml
View file @
d91c74b8
...
@@ -3,8 +3,34 @@
...
@@ -3,8 +3,34 @@
<mapper
namespace=
"com.foc.dao.SoundsMaxIdDao"
>
<mapper
namespace=
"com.foc.dao.SoundsMaxIdDao"
>
<select
id=
"getMaxId"
resultType=
"com.foc.entity.SoundsMaxId"
>
<select
id=
"getMaxId"
resultType=
"com.foc.entity.SoundsMaxId"
>
SELECT MAX(id),update_date
FROM `foc_soundmax_id`
SELECT MAX(id),update_date
FROM foc_soundmax_id where 1 = 1
</select>
</select>
<select
id=
"getInfo"
resultType=
"com.foc.entity.SoundInfo"
>
SELECT
create_phone AS callNo,
ac.create_name AS callName,
ap.phone AS acceptNo,
ap.username AS acceptName,
ac.start_time AS beginTime,
ac.end_time AS endTime,
ac.download_url,
ac.duration,
end_status AS result
FROM
foc_sound_records ac
LEFT JOIN foc_sound_phones ap ON ac.id = ap.record_id
WHERE
ac.end_status != 'INIT'
AND ac.start_time
<
= #{date}
AND (
ac.end_time
<
#{date}
OR ac.end_time IS NULL
)
ORDER BY
beginTime DESC
LIMIT 20
</select>
</mapper>
</mapper>
\ No newline at end of file
src/main/resources/mybatis-config.xml
View file @
d91c74b8
...
@@ -40,26 +40,29 @@
...
@@ -40,26 +40,29 @@
</settings>
</settings>
<environments
default=
"dev"
>
<environments
default=
"dev"
>
<environment
id=
"dev"
>
<environment
id=
"dev"
>
<transactionManager
type=
"JDBC"
/>
<transactionManager
type=
"JDBC"
/>
<!-- 配置数据库连接信息 -->
<!-- 配置数据库连接信息 -->
<dataSource
type=
"POOLED"
>
<dataSource
type=
"POOLED"
>
<property
name=
"driver"
value=
"com.mysql.jdbc.Driver"
/>
<property
name=
"driver"
value=
"com.mysql.jdbc.Driver"
/>
<property
name=
"url"
value=
"jdbc:mysql://localhost:3306/sms"
/>
<property
name=
"url"
value=
"jdbc:mysql://106.75.97.50:3306/jd_foc"
/>
<property
name=
"username"
value=
"sms_develop"
/>
<property
name=
"username"
value=
"focuser"
/>
<property
name=
"password"
value=
"Develop2018!@#"
/>
<property
name=
"password"
value=
"FOC@2016"
/>
</dataSource>
</environment>
<environment
id=
"prod"
>
<transactionManager
type=
"JDBC"
/>
<!-- 配置数据库连接信息 -->
<dataSource
type=
"POOLED"
>
<property
name=
"driver"
value=
"com.mysql.jdbc.Driver"
/>
<property
name=
"url"
value=
"jdbc:mysql://sms.db.com:3306/sms"
/>
<property
name=
"username"
value=
"sms_develop"
/>
<property
name=
"password"
value=
"Develop2018!@#"
/>
</dataSource>
</dataSource>
</environment>
</environment>
<!--<environment id="prod">-->
<!--<transactionManager type="JDBC"/>-->
<!--<!– 配置数据库连接信息 –>-->
<!--<dataSource type="POOLED">-->
<!--<property name="driver" value="com.mysql.jdbc.Driver"/>-->
<!--<property name="url" value="jdbc:mysql://sms.db.com:3306/sms"/>-->
<!--<property name="username" value="sms_develop"/>-->
<!--<property name="password" value="Develop2018!@#"/>-->
<!--</dataSource>-->
<!--</environment>-->
</environments>
</environments>
<mappers>
<mappers>
...
...
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