Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
H
hzjtpushdateService
Project overview
Project overview
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
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
建金
hzjtpushdateService
Commits
2c9a493f
Commit
2c9a493f
authored
Dec 11, 2020
by
高飞
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
车流量
parent
b5e557db
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
100 additions
and
99 deletions
+100
-99
src/main/java/com/hzjt/config/ScheduleTaskConfig.java
src/main/java/com/hzjt/config/ScheduleTaskConfig.java
+0
-3
src/main/java/com/hzjt/controller/TraffController.java
src/main/java/com/hzjt/controller/TraffController.java
+32
-38
src/main/java/com/hzjt/domain/Vehicle.java
src/main/java/com/hzjt/domain/Vehicle.java
+17
-0
src/main/java/com/hzjt/mapper/TraffFlowMapper.java
src/main/java/com/hzjt/mapper/TraffFlowMapper.java
+2
-2
src/main/java/com/hzjt/service/TraffFlowService.java
src/main/java/com/hzjt/service/TraffFlowService.java
+3
-3
src/main/resources/application.properties
src/main/resources/application.properties
+10
-8
src/main/resources/mapper/TraffFlow.xml
src/main/resources/mapper/TraffFlow.xml
+36
-45
No files found.
src/main/java/com/hzjt/config/ScheduleTaskConfig.java
View file @
2c9a493f
...
@@ -45,9 +45,6 @@ public class ScheduleTaskConfig {
...
@@ -45,9 +45,6 @@ public class ScheduleTaskConfig {
log
.
info
(
"每个月最后一天执行删除前2个月车流量数据操作start"
);
log
.
info
(
"每个月最后一天执行删除前2个月车流量数据操作start"
);
//删除2个月之前车流量详情的数据
//删除2个月之前车流量详情的数据
traffFlowService
.
deleteBeforeTwoMonthVehicles
(
DateUtils
.
getlastMonth
(-
2
));
traffFlowService
.
deleteBeforeTwoMonthVehicles
(
DateUtils
.
getlastMonth
(-
2
));
//删除2个月之前的车流量数据
traffFlowService
.
deleteBeforeTwoMonthVehicles
(
DateUtils
.
getlastMonth
(-
2
));
log
.
info
(
"每个月最后一天执行删除前2个月车流量数据操作end"
);
}
}
}
}
...
...
src/main/java/com/hzjt/controller/TraffController.java
View file @
2c9a493f
...
@@ -8,6 +8,7 @@ import com.hzjt.service.ImportService;
...
@@ -8,6 +8,7 @@ import com.hzjt.service.ImportService;
import
com.hzjt.service.TraffFlowService
;
import
com.hzjt.service.TraffFlowService
;
import
com.hzjt.util.DateUtils
;
import
com.hzjt.util.DateUtils
;
import
com.hzjt.util.JsonUtil
;
import
com.hzjt.util.JsonUtil
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.slf4j.Logger
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.slf4j.LoggerFactory
;
...
@@ -21,6 +22,7 @@ import java.util.concurrent.ConcurrentHashMap;
...
@@ -21,6 +22,7 @@ import java.util.concurrent.ConcurrentHashMap;
@RestController
@RestController
@Slf4j
public
class
TraffController
{
public
class
TraffController
{
@Autowired
@Autowired
ImportService
importService
;
ImportService
importService
;
...
@@ -45,7 +47,6 @@ public class TraffController {
...
@@ -45,7 +47,6 @@ public class TraffController {
private
static
final
String
TYPE
=
"TRAFFIC_INCIDENT_ALARM"
;
private
static
final
String
TYPE
=
"TRAFFIC_INCIDENT_ALARM"
;
private
static
final
Logger
log
=
LoggerFactory
.
getLogger
(
TraffController
.
class
);
@Autowired
@Autowired
public
TraffController
(
public
TraffController
(
...
@@ -147,8 +148,8 @@ public class TraffController {
...
@@ -147,8 +148,8 @@ public class TraffController {
public
ResultObj
traffflow
(
@RequestBody
Vehicles
vehicles
)
{
public
ResultObj
traffflow
(
@RequestBody
Vehicles
vehicles
)
{
if
(
"TRAFFIC_STATISTICS_VEHICLES"
.
equalsIgnoreCase
(
vehicles
.
getType
()))
{
if
(
"TRAFFIC_STATISTICS_VEHICLES"
.
equalsIgnoreCase
(
vehicles
.
getType
()))
{
String
time
=
DateUtils
.
formatDate
(
new
Date
(
Long
.
valueOf
(
vehicles
.
getTs
())));
//
String time=DateUtils.formatDate(new Date(Long.valueOf(vehicles.getTs())));
vehicles
.
setTs
(
time
);
//
vehicles.setTs(time);
String
[]
sbAndTd
=
vehicles
.
getVideo_id
().
split
(
"_"
);
String
[]
sbAndTd
=
vehicles
.
getVideo_id
().
split
(
"_"
);
String
sbbh
=
sbAndTd
[
0
];
String
sbbh
=
sbAndTd
[
0
];
int
tdbh
=
Integer
.
valueOf
(
sbAndTd
[
1
])
+
1
;
int
tdbh
=
Integer
.
valueOf
(
sbAndTd
[
1
])
+
1
;
...
@@ -156,14 +157,25 @@ public class TraffController {
...
@@ -156,14 +157,25 @@ public class TraffController {
vehicles
.
setVideo_id
(
sbbh
+
"_"
+
tdbh
);
vehicles
.
setVideo_id
(
sbbh
+
"_"
+
tdbh
);
log
.
debug
(
"/event/receive接收到数据:"
+
vehicles
.
toString
());
log
.
debug
(
"/event/receive接收到数据:"
+
vehicles
.
toString
());
//直接放入表中
//直接放入表中
traffFlowService
.
saveTraffFlow
(
vehicles
);
//
traffFlowService.saveTraffFlow(vehicles);
List
<
Vehiclesdetail
>
vels
=
vehicles
.
getObjs
()
;
List
<
Vehiclesdetail
>
vels
=
vehicles
.
getObjs
()
;
for
(
Vehiclesdetail
detail
:
vels
){
int
result
=
0
;
log
.
info
(
detail
.
toString
());
for
(
Vehiclesdetail
detail
:
vels
){
detail
.
setObj_id
(
UUID
.
randomUUID
().
toString
());
log
.
info
(
detail
.
toString
());
detail
.
setVehiclesid
(
vehicles
.
getId
());
Vehicle
v
=
new
Vehicle
();
traffFlowService
.
saveTraffFlowDetail
(
detail
);
v
.
setId
(
UUID
.
randomUUID
().
toString
());
}
v
.
setCreate_time
(
new
Date
(
Long
.
valueOf
(
vehicles
.
getTs
())));
v
.
setType
(
detail
.
getType
());
v
.
setDirection
(
detail
.
getDirection
());
v
.
setRuleTag
(
detail
.
getRuleTag
());
v
.
setClassification_confidence
(
detail
.
getClassification_confidence
());
v
.
setVideo_id
(
vehicles
.
getVideo_id
());
log
.
info
(
v
.
toString
());
result
=
traffFlowService
.
saveTraffFlowDetail
(
v
);
log
.
info
(
"insertvel="
+
result
);
}
//查询近五分钟的车流量,当天车流量websocket 直接推送过去
//查询近五分钟的车流量,当天车流量websocket 直接推送过去
log
.
info
(
"schedule >>>>>>>>>> WebSocket"
);
log
.
info
(
"schedule >>>>>>>>>> WebSocket"
);
...
@@ -187,34 +199,16 @@ public class TraffController {
...
@@ -187,34 +199,16 @@ public class TraffController {
//获取自动规则
//获取自动规则
@GetMapping
(
"/test"
)
@GetMapping
(
"/test"
)
public
ResultObj
autoRule
()
{
public
void
autoRule
()
{
AutoRule
rule
=
new
AutoRule
();
Vehicle
v
=
new
Vehicle
();
Map
<
String
,
BigDecimal
>
v
=
new
HashMap
<>();
v
.
setId
(
UUID
.
randomUUID
().
toString
());
v
.
put
(
"x"
,
BigDecimal
.
valueOf
(
111.2
));
v
.
setCreate_time
(
DateUtils
.
parseDate
(
"2020-12-10 23:59:00"
));
v
.
put
(
"y"
,
BigDecimal
.
valueOf
(
64.09232
));
v
.
setType
(
"SEDAN1"
);
Map
<
String
,
BigDecimal
>
v1
=
new
HashMap
();
v
.
setDirection
(
Long
.
valueOf
(
"0"
));
v1
.
put
(
"x"
,
BigDecimal
.
valueOf
(
111.2
));
v
.
setRuleTag
(
"1"
);
v1
.
put
(
"y"
,
BigDecimal
.
valueOf
(
64.09232
));
v
.
setClassification_confidence
(
Long
.
valueOf
(
"0"
));
v
.
setVideo_id
(
"20200603135925971_1"
);
Map
<
String
,
BigDecimal
>
v2
=
new
HashMap
();
traffFlowService
.
saveTraffFlowDetail
(
v
);
v2
.
put
(
"x"
,(
BigDecimal
.
valueOf
(
111.2
)));
v2
.
put
(
"y"
,
BigDecimal
.
valueOf
(
64.000923232
));
List
<
Map
<
String
,
BigDecimal
>
>
list
=
new
ArrayList
<>();
list
.
add
(
v
);
list
.
add
(
v1
);
list
.
add
(
v2
);
List
<
Map
<
String
,
BigDecimal
>>
list2
=
new
ArrayList
<>();
list2
.
add
(
v
);
list2
.
add
(
v1
);
list2
.
add
(
v2
);
List
list3
=
new
ArrayList
();
list3
.
add
(
list
);
list3
.
add
(
list3
);
rule
.
setRule_area
(
list3
);
//webSocket.AppointSending(rules.getVideo_id(),JsonUtil.beanToString(map));
return
ResultObj
.
ok
();
}
}
...
...
src/main/java/com/hzjt/domain/Vehicle.java
0 → 100644
View file @
2c9a493f
package
com
.
hzjt
.
domain
;
import
lombok.Data
;
import
java.util.Date
;
@Data
public
class
Vehicle
{
private
String
id
;
private
String
type
;
private
String
video_id
;
private
Date
create_time
;
private
Long
direction
;
private
Long
classification_confidence
;
private
String
ruleTag
;
}
src/main/java/com/hzjt/mapper/TraffFlowMapper.java
View file @
2c9a493f
package
com
.
hzjt
.
mapper
;
package
com
.
hzjt
.
mapper
;
import
com.hzjt.domain.Vehicle
;
import
com.hzjt.domain.Vehicles
;
import
com.hzjt.domain.Vehicles
;
import
com.hzjt.domain.Vehiclesdetail
;
import
com.hzjt.domain.Vehiclesdetail
;
import
org.apache.ibatis.annotations.Mapper
;
import
org.apache.ibatis.annotations.Mapper
;
...
@@ -11,13 +12,12 @@ import java.util.Map;
...
@@ -11,13 +12,12 @@ import java.util.Map;
public
interface
TraffFlowMapper
{
public
interface
TraffFlowMapper
{
int
add
(
Vehicles
excelModel
);
int
add
(
Vehicles
excelModel
);
int
insertlist
(
Vehicle
sdetail
vehiclesdetail
);
int
insertlist
(
Vehicle
vehiclesdetail
);
List
<
Map
>
selectFiveAndDayFlow
(
String
videoid
);
List
<
Map
>
selectFiveAndDayFlow
(
String
videoid
);
List
<
Map
>
selectFiveAndTypeDayFlow
(
String
videoid
);
List
<
Map
>
selectFiveAndTypeDayFlow
(
String
videoid
);
Integer
statisVehiclesByDay
(
String
startime
);
Integer
statisVehiclesByDay
(
String
startime
);
Integer
deleteBeforeTwoMonthVehicles
(
String
startime
);
Integer
deleteBeforeTwoMonthVehiclesDetails
(
String
startime
);
Integer
deleteBeforeTwoMonthVehiclesDetails
(
String
startime
);
}
}
src/main/java/com/hzjt/service/TraffFlowService.java
View file @
2c9a493f
package
com
.
hzjt
.
service
;
package
com
.
hzjt
.
service
;
import
com.hzjt.domain.Vehicle
;
import
com.hzjt.domain.Vehicles
;
import
com.hzjt.domain.Vehicles
;
import
com.hzjt.domain.Vehiclesdetail
;
import
com.hzjt.domain.Vehiclesdetail
;
import
com.hzjt.mapper.TraffFlowMapper
;
import
com.hzjt.mapper.TraffFlowMapper
;
...
@@ -20,8 +21,8 @@ public class TraffFlowService {
...
@@ -20,8 +21,8 @@ public class TraffFlowService {
public
void
saveTraffFlow
(
Vehicles
vehicles
)
{
public
void
saveTraffFlow
(
Vehicles
vehicles
)
{
traffFlowMapper
.
add
(
vehicles
);
traffFlowMapper
.
add
(
vehicles
);
}
}
public
void
saveTraffFlowDetail
(
Vehiclesdetail
vehiclesdetail
)
{
public
int
saveTraffFlowDetail
(
Vehicle
vehiclesdetail
)
{
traffFlowMapper
.
insertlist
(
vehiclesdetail
);
return
traffFlowMapper
.
insertlist
(
vehiclesdetail
);
}
}
public
List
<
Map
>
selectFiveAndDayFlow
(
String
videoid
)
{
public
List
<
Map
>
selectFiveAndDayFlow
(
String
videoid
)
{
...
@@ -37,7 +38,6 @@ public class TraffFlowService {
...
@@ -37,7 +38,6 @@ public class TraffFlowService {
@Transactional
(
rollbackFor
=
Exception
.
class
)
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
void
deleteBeforeTwoMonthVehicles
(
String
starttime
)
{
public
void
deleteBeforeTwoMonthVehicles
(
String
starttime
)
{
traffFlowMapper
.
deleteBeforeTwoMonthVehiclesDetails
(
starttime
);
traffFlowMapper
.
deleteBeforeTwoMonthVehiclesDetails
(
starttime
);
traffFlowMapper
.
deleteBeforeTwoMonthVehicles
(
starttime
);
}
}
...
...
src/main/resources/application.properties
View file @
2c9a493f
...
@@ -13,6 +13,7 @@ mybatis.configuration.map-underscore-to-camel-case=true
...
@@ -13,6 +13,7 @@ mybatis.configuration.map-underscore-to-camel-case=true
mybatis.configuration.default-fetch-size
=
100
mybatis.configuration.default-fetch-size
=
100
mybatis.configuration.default-statement-timeout
=
3000
mybatis.configuration.default-statement-timeout
=
3000
#mybatis.mapperLocations = classpath:xxx.xml
#mybatis.mapperLocations = classpath:xxx.xml
logging.level.com.hzjt
=
debug
## �������ݿ�-����Դ����
## �������ݿ�-����Դ����
#spring.datasource.url=jdbc:dm://127.0.0.1:12345/auditlocal_cq
#spring.datasource.url=jdbc:dm://127.0.0.1:12345/auditlocal_cq
...
@@ -28,13 +29,13 @@ mybatis.configuration.default-statement-timeout=3000
...
@@ -28,13 +29,13 @@ mybatis.configuration.default-statement-timeout=3000
#spring.datasource.dbcp2.connection-properties=characterEncoding=utf8
#spring.datasource.dbcp2.connection-properties=characterEncoding=utf8
# Mysql���ݿ�-����Դ����
# Mysql���ݿ�-����Դ����
#
spring.datasource.username=test
spring.datasource.username
=
test
#
spring.datasource.password=test
spring.datasource.password
=
test
#spring.datasource.url=jdbc:oracle:thin:@192.168.168.212:1521
:helowin
spring.datasource.url
=
jdbc:oracle:thin:@192.168.168.212:1522
:helowin
spring.datasource.username
=
hzjt
#
spring.datasource.username=hzjt
spring.datasource.password
=
hzjt
#
spring.datasource.password=hzjt
spring.datasource.url
=
jdbc:oracle:thin:@33.50.1.22:1521:orcl
#
spring.datasource.url=jdbc:oracle:thin:@33.50.1.22:1521:orcl
spring.datasource.driverClassName
=
oracle.jdbc.OracleDriver
#
spring.datasource.driverClassName=oracle.jdbc.OracleDriver
# druid
# druid
spring.datasource.type
=
com.alibaba.druid.pool.DruidDataSource
spring.datasource.type
=
com.alibaba.druid.pool.DruidDataSource
# ��ʼ����С����С�����
# ��ʼ����С����С�����
...
@@ -92,7 +93,8 @@ alarm.subscribe.data.key=gs:traff:alarmlist
...
@@ -92,7 +93,8 @@ alarm.subscribe.data.key=gs:traff:alarmlist
# 免审标记 0需审核 1免审
# 免审标记 0需审核 1免审
alarmrecord.check.enable
=
1
alarmrecord.check.enable
=
1
spring.profiles.path
=
D:/imp/config/im/hzjt.properties
#spring.profiles.path= D:/imp/config/im/hzjt.properties
spring.profiles.path
=
D:/hzjt_service/imp/config/im/hzjt.properties
spring.redis.cachekey.ftplist
=
gs:traff:global:cache:ftplist
spring.redis.cachekey.ftplist
=
gs:traff:global:cache:ftplist
qingzhi.redis.token
=
gs:traff:qingzhi:token
qingzhi.redis.token
=
gs:traff:qingzhi:token
qingzhi.devicewrite.url
=
http://33.50.1.213:38080/api/jtldpt/impld/deviceWrite
qingzhi.devicewrite.url
=
http://33.50.1.213:38080/api/jtldpt/impld/deviceWrite
...
...
src/main/resources/mapper/TraffFlow.xml
View file @
2c9a493f
...
@@ -3,14 +3,15 @@
...
@@ -3,14 +3,15 @@
<mapper
namespace=
"com.hzjt.mapper.TraffFlowMapper"
>
<mapper
namespace=
"com.hzjt.mapper.TraffFlowMapper"
>
<insert
id=
"insertlist"
parameterType=
"com.hzjt.domain.Vehiclesdetail"
>
<insert
id=
"insertlist"
parameterType=
"com.hzjt.domain.Vehicle"
>
INSERT INTO vehiclesdetail (obj_id, vehiclesid, type, direction,classification_confidence,ruletag,create_time)
INSERT INTO vehicle (id, video_id, type,
values( #{obj_id,jdbcType=VARCHAR},
direction,classification_confidence,ruletag,create_time)
#{vehiclesid,jdbcType=VARCHAR},
values( #{id,jdbcType=VARCHAR},
#{video_id,jdbcType=VARCHAR},
#{type,jdbcType=VARCHAR},
#{type,jdbcType=VARCHAR},
#{direction,jdbcType=NUMERIC},
#{direction,jdbcType=NUMERIC},
#{classification_confidence,jdbcType=NUMERIC},
#{classification_confidence,jdbcType=NUMERIC},
#{ruleTag,jdbcType=VARCHAR},
sysdate
)
#{ruleTag,jdbcType=VARCHAR},
#{create_time,jdbcType=TIMESTAMP}
)
</insert>
</insert>
<insert
id=
"add"
parameterType=
"com.hzjt.domain.Vehicles"
>
<insert
id=
"add"
parameterType=
"com.hzjt.domain.Vehicles"
>
...
@@ -20,31 +21,28 @@
...
@@ -20,31 +21,28 @@
</insert>
</insert>
<select
id=
"selectFiveAndDayFlow"
resultType=
"java.util.HashMap"
>
<select
id=
"selectFiveAndDayFlow"
resultType=
"java.util.HashMap"
>
select
select
NVL(sum(case when
ts>=to_char( (SYSDATE-1-5/1440),'yyyy-MM-dd HH24:mi:ss') and ts
<![CDATA[ <= ]]>
to_char (SYSDATE-1,'yyyy-MM-dd HH24:mi:ss'
) then 1 else 0 end),0)tbfiveflow,
NVL(sum(case when
CREATE_TIME>=(SYSDATE-1-5/1440) and CREATE_TIME
<![CDATA[ <= ]]>
(SYSDATE-1
) then 1 else 0 end),0)tbfiveflow,
NVL(sum(case when
ts>=to_char( (SYSDATE-10/1440),'yyyy-MM-dd HH24:mi:ss') and ts
<![CDATA[ <= ]]>
to_char( (SYSDATE-5/1440),'yyyy-MM-dd HH24:mi:ss'
) then 1 else 0 end),0)hbfiveflow,
NVL(sum(case when
CREATE_TIME>= (SYSDATE-10/1440) and CREATE_TIME
<![CDATA[ <= ]]>
(SYSDATE-5/1440
) then 1 else 0 end),0)hbfiveflow,
NVL(sum(case when
ts>=to_char( (SYSDATE-5/1440),'yyyy-MM-dd HH24:mi:ss'
) then 1 else 0 end),0)fiveflow,
NVL(sum(case when
CREATE_TIME>= (SYSDATE-5/1440
) then 1 else 0 end),0)fiveflow,
NVL(sum(case when
ts>=To_char(Trunc(SYSDATE), 'yyyy-mm-dd hh24:mi:ss'
) then 1 else 0 end),0)dayflow,
NVL(sum(case when
CREATE_TIME>=Trunc(SYSDATE
) then 1 else 0 end),0)dayflow,
'all' name
'all' name
from vehicles a,vehiclesdetail b where a.id = b.vehiclesid
from vehicle b where b.video_id=#{videoid}
and a.video_id=#{videoid}
union all
union all
select
select
NVL(sum(case when
ts>=to_char( (SYSDATE-1-5/1440),'yyyy-MM-dd HH24:mi:ss') and ts
<![CDATA[ <= ]]>
to_char (SYSDATE-1,'yyyy-MM-dd HH24:mi:ss'
) then 1 else 0 end),0)tbfiveflow,
NVL(sum(case when
CREATE_TIME>=(SYSDATE-1-5/1440) and CREATE_TIME
<![CDATA[ <= ]]>
(SYSDATE-1
) then 1 else 0 end),0)tbfiveflow,
NVL(sum(case when
ts>=to_char( (SYSDATE-10/1440),'yyyy-MM-dd HH24:mi:ss') and ts
<![CDATA[ <= ]]>
to_char( (SYSDATE-5/1440),'yyyy-MM-dd HH24:mi:ss'
) then 1 else 0 end),0)hbfiveflow,
NVL(sum(case when
CREATE_TIME>= (SYSDATE-10/1440) and CREATE_TIME
<![CDATA[ <= ]]>
(SYSDATE-5/1440
) then 1 else 0 end),0)hbfiveflow,
NVL(sum(case when
ts>=to_char( (SYSDATE-5/1440),'yyyy-MM-dd HH24:mi:ss'
) then 1 else 0 end),0)fiveflow,
NVL(sum(case when
CREATE_TIME>= (SYSDATE-5/1440
) then 1 else 0 end),0)fiveflow,
NVL( sum(case when
ts>=To_char(Trunc(SYSDATE), 'yyyy-mm-dd hh24:mi:ss'
) then 1 else 0 end),0)dayflow,
NVL( sum(case when
CREATE_TIME>=Trunc(SYSDATE
) then 1 else 0 end),0)dayflow,
'up' name
'up' name
from vehicles a,vehiclesdetail b where a.id = b.vehiclesid
from vehicle b where b.video_id=#{videoid} and ruletag ='1'
and a.video_id=#{videoid} and ruletag ='1'
union all
union all
select
select
NVL(sum(case when
ts>=to_char( (SYSDATE-1-5/1440),'yyyy-MM-dd HH24:mi:ss') and ts
<![CDATA[ <= ]]>
to_char (SYSDATE-1,'yyyy-MM-dd HH24:mi:ss'
) then 1 else 0 end),0)tbfiveflow,
NVL(sum(case when
CREATE_TIME>= (SYSDATE-1-5/1440) and CREATE_TIME
<![CDATA[ <= ]]>
(SYSDATE-1
) then 1 else 0 end),0)tbfiveflow,
NVL(sum(case when
ts>=to_char( (SYSDATE-10/1440),'yyyy-MM-dd HH24:mi:ss') and ts
<![CDATA[ <= ]]>
to_char( (SYSDATE-5/1440),'yyyy-MM-dd HH24:mi:ss'
) then 1 else 0 end),0)hbfiveflow,
NVL(sum(case when
CREATE_TIME>= (SYSDATE-10/1440) and CREATE_TIME
<![CDATA[ <= ]]>
(SYSDATE-5/1440
) then 1 else 0 end),0)hbfiveflow,
NVL(sum(case when
ts>=to_char( (SYSDATE-5/1440),'yyyy-MM-dd HH24:mi:ss')
then 1 else 0 end),0)fiveflow,
NVL(sum(case when
CREATE_TIME>= (SYSDATE-5/1440)
then 1 else 0 end),0)fiveflow,
NVL(sum(case when
ts>=To_char(Trunc(SYSDATE), 'yyyy-mm-dd hh24:mi:ss'
) then 1 else 0 end),0)dayflow,
NVL(sum(case when
CREATE_TIME>=Trunc(SYSDATE
) then 1 else 0 end),0)dayflow,
'down' name
'down' name
from vehicles a,vehiclesdetail b where a.id = b.vehiclesid
from vehicle b where b.video_id=#{videoid} and ruletag ='2'
and a.video_id=#{videoid} and ruletag ='2'
</select>
</select>
...
@@ -54,9 +52,8 @@
...
@@ -54,9 +52,8 @@
NVL(sum(case when b.type='COACH'or b.type='MEDIUM_COACH' then 1 else 0 end),0)coach,
NVL(sum(case when b.type='COACH'or b.type='MEDIUM_COACH' then 1 else 0 end),0)coach,
NVL( sum(case when b.type!='COACH'and b.type!='MEDIUM_COACH'
NVL( sum(case when b.type!='COACH'and b.type!='MEDIUM_COACH'
and b.type!='SEDAN'and b.type!='HEAVY_GOODS_VAN' and b.type!='LIGHT_GOODS_VAN' then 1 else 0 end),0)other
and b.type!='SEDAN'and b.type!='HEAVY_GOODS_VAN' and b.type!='LIGHT_GOODS_VAN' then 1 else 0 end),0)other
from vehicles a,vehiclesdetail b where a.id = b.vehiclesid
from vehicle b where video_id=#{videoid}
and a.video_id=#{videoid}
and CREATE_TIME>=Trunc(SYSDATE)
and ts>=To_char(Trunc(SYSDATE), 'yyyy-mm-dd hh24:mi:ss')
union all
union all
...
@@ -65,9 +62,8 @@
...
@@ -65,9 +62,8 @@
NVL(sum(case when b.type='COACH'or b.type='MEDIUM_COACH' then 1 else 0 end),0)coach,
NVL(sum(case when b.type='COACH'or b.type='MEDIUM_COACH' then 1 else 0 end),0)coach,
NVL( sum(case when b.type!='COACH'and b.type!='MEDIUM_COACH'
NVL( sum(case when b.type!='COACH'and b.type!='MEDIUM_COACH'
and b.type!='SEDAN'and b.type!='HEAVY_GOODS_VAN' and b.type!='LIGHT_GOODS_VAN' then 1 else 0 end),0)other
and b.type!='SEDAN'and b.type!='HEAVY_GOODS_VAN' and b.type!='LIGHT_GOODS_VAN' then 1 else 0 end),0)other
from vehicles a,vehiclesdetail b where a.id = b.vehiclesid
from vehicle b where b.video_id=#{videoid}
and a.video_id=#{videoid}
and CREATE_TIME>=Trunc(SYSDATE) and ruletag ='1'
and ts>=To_char(Trunc(SYSDATE), 'yyyy-mm-dd hh24:mi:ss') and ruletag ='1'
union all
union all
...
@@ -76,34 +72,29 @@
...
@@ -76,34 +72,29 @@
NVL(sum(case when b.type='COACH'or b.type='MEDIUM_COACH' then 1 else 0 end),0)coach,
NVL(sum(case when b.type='COACH'or b.type='MEDIUM_COACH' then 1 else 0 end),0)coach,
NVL( sum(case when b.type!='COACH'and b.type!='MEDIUM_COACH'
NVL( sum(case when b.type!='COACH'and b.type!='MEDIUM_COACH'
and b.type!='SEDAN'and b.type!='HEAVY_GOODS_VAN' and b.type!='LIGHT_GOODS_VAN' then 1 else 0 end),0)other
and b.type!='SEDAN'and b.type!='HEAVY_GOODS_VAN' and b.type!='LIGHT_GOODS_VAN' then 1 else 0 end),0)other
from vehicles a,vehiclesdetail b where a.id = b.vehiclesid
from vehicle b where b.video_id=#{videoid}
and a.video_id=#{videoid}
and CREATE_TIME>=Trunc(SYSDATE) and ruletag ='2'
and ts>=To_char(Trunc(SYSDATE), 'yyyy-mm-dd hh24:mi:ss') and ruletag ='2'
</select>
</select>
<insert
id=
"statisVehiclesByDay"
>
<insert
id=
"statisVehiclesByDay"
>
insert into vehiclestatistic
insert into vehiclestatistic
select
b.
video_id ,
select video_id ,
to_char(
to_date(ts, 'yyyy-mm-dd hh24:mi:ss')
, 'yyyy-mm-dd') ts,
to_char(
CREATE_TIME
, 'yyyy-mm-dd') ts,
t
.t
ype,
type,
ruletag,
ruletag,
count(*) total
count(*) total
from VEHICLESDETAIL t, vehicles b
from vehicle b
where t.vehiclesid = b.id
where CREATE_TIME>= to_date( #{starttime}|| ' 00:00:00','yyyy-mm-dd hh24:mi:ss')
and ts>=#{starttime}|| ' 00:00:00'
and CREATE_TIME
<![CDATA[ <= ]]>
to_date(#{starttime}||' 23:59:59','yyyy-mm-dd hh24:mi:ss')
and ts
<![CDATA[ <= ]]>
#{starttime}||' 23:59:59'
group by to_char(CREATE_TIME, 'yyyy-mm-dd'),
group by to_char(to_date(ts, 'yyyy-mm-dd hh24:mi:ss'), 'yyyy-mm-dd'),
type,
t.type,
ruletag,
ruletag,
b.video_id
b.video_id
</insert>
</insert>
<delete
id=
"deleteBeforeTwoMonthVehiclesDetails"
>
<delete
id=
"deleteBeforeTwoMonthVehiclesDetails"
>
delete from vehicle
sdetail
WHERE create_time
<![CDATA[ <= ]]>
to_date( #{starttime}||' 23:59:59','yyyy-mm-dd hh24:mi:ss')
delete from vehicle WHERE create_time
<![CDATA[ <= ]]>
to_date( #{starttime}||' 23:59:59','yyyy-mm-dd hh24:mi:ss')
</delete>
</delete>
<delete
id=
"deleteBeforeTwoMonthVehicles"
>
delete from vehicles where ts
<![CDATA[ <= ]]>
#{starttime}||' 23:59:59'
</delete>
</mapper>
</mapper>
\ No newline at end of file
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