Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
Toggle navigation
This project
Loading...
Sign in
platform
/
event_data_handle
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 7eb035d7
authored
Nov 27, 2019
by
熊付
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
【首页统计接口】
1 parent
92e3a415
Hide whitespace changes
Inline
Side-by-side
Showing
21 changed files
with
404 additions
and
45 deletions
src/main/java/com/viontech/config/WebSocketConfig.java
src/main/java/com/viontech/controller/BaseController.java
src/main/java/com/viontech/controller/BehaviorController.java
src/main/java/com/viontech/controller/BehaviorStatisticsController.java
src/main/java/com/viontech/controller/TimeCloseController.java
src/main/java/com/viontech/controller/websocket/WebsocketController.java
src/main/java/com/viontech/dao/BehaviorArchiveDaoImpl.java
src/main/java/com/viontech/entity/TimeCloseEntity.java
src/main/java/com/viontech/entity/archive/BehaviorArchiveEntity.java
src/main/java/com/viontech/repository/TimeCloseRepository.java
src/main/java/com/viontech/service/adapter/ITimeCloseService.java
src/main/java/com/viontech/service/adapter/behavior/IBehaviorService.java
src/main/java/com/viontech/service/adapter/behavior/IBehaviorStatisticsService.java
src/main/java/com/viontech/service/impl/TimecloseServiceImpl.java
src/main/java/com/viontech/service/impl/behavior/BehaviorServiceImpl.java
src/main/java/com/viontech/service/impl/behavior/BehaviorStatisticsServiceImpl.java
src/main/java/com/viontech/vo/BehaviorArchiveVo.java
src/main/java/com/viontech/vo/BehaviorStatisticsVo.java
src/main/java/com/viontech/vo/EventDataVo.java
src/main/java/com/viontech/vo/TimeCloseVo.java
src/main/java/com/viontech/vo/VehicleVo.java
src/main/java/com/viontech/config/WebSocketConfig.java
View file @
7eb035d
package
com
.
viontech
.
config
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.web.socket.server.standard.ServerEndpointExporter
;
/***
* 当使用springboot启动时打开即可 不然websocket不起作用 若是使用tomcat启动则必须关闭
*/
//
@Configuration
@Configuration
public
class
WebSocketConfig
{
@Bean
...
...
src/main/java/com/viontech/controller/BaseController.java
View file @
7eb035d
package
com
.
viontech
.
controller
;
import
org.springframework.web.bind.annotation.CrossOrigin
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
/**
* Created by Administrator
*/
@CrossOrigin
(
origins
=
"*"
,
allowCredentials
=
"true"
)
@RestController
@RequestMapping
(
"/api/v1/datahandle"
)
public
class
BaseController
{
...
...
src/main/java/com/viontech/controller/BehaviorController.java
View file @
7eb035d
package
com
.
viontech
.
controller
;
import
com.viontech.service.adapter.behavior.IBehaviorService
;
import
com.viontech.vo.EventDataVo
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.DeleteMapping
;
import
org.springframework.web.bind.annotation.PathVariable
;
import
org.springframework.web.bind.annotation.ResponseBody
;
import
org.springframework.web.bind.annotation.RestController
;
import
org.springframework.web.bind.annotation.*
;
@RestController
public
class
BehaviorController
extends
BaseController
{
...
...
@@ -19,4 +17,14 @@ public class BehaviorController extends BaseController{
return
iBehaviorService
.
deleteEventByUnid
(
event_unid
);
}
/****
* 批量删除
* @param eventDataVo
* @return
*/
@DeleteMapping
(
"/behavior/events/batch/delete"
)
@ResponseBody
public
Object
batchDelete
(
@RequestBody
EventDataVo
eventDataVo
){
return
iBehaviorService
.
batchDelete
(
eventDataVo
);
}
}
src/main/java/com/viontech/controller/BehaviorStatisticsController.java
0 → 100644
View file @
7eb035d
package
com
.
viontech
.
controller
;
import
com.viontech.service.adapter.behavior.IBehaviorStatisticsService
;
import
com.viontech.vo.BehaviorStatisticsVo
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.ResponseBody
;
import
org.springframework.web.bind.annotation.RestController
;
@RestController
public
class
BehaviorStatisticsController
extends
BaseController
{
@Autowired
IBehaviorStatisticsService
iBehaviorStatisticsService
;
@GetMapping
(
"/statistics/type"
)
@ResponseBody
public
Object
statisticsByType
(
BehaviorStatisticsVo
behaviorStatisticsVo
){
return
iBehaviorStatisticsService
.
statisticsByType
(
behaviorStatisticsVo
);
}
@GetMapping
(
"/statistics/hour"
)
@ResponseBody
public
Object
hourChart
(
BehaviorStatisticsVo
behaviorStatisticsVo
){
return
iBehaviorStatisticsService
.
hourChart
(
behaviorStatisticsVo
);
}
@GetMapping
(
"/statistics/handle"
)
@ResponseBody
Object
statisticsByEventHandle
(
BehaviorStatisticsVo
behaviorStatisticsVo
){
return
iBehaviorStatisticsService
.
statisticsByEventHandle
(
behaviorStatisticsVo
);
}
}
src/main/java/com/viontech/controller/TimeCloseController.java
0 → 100644
View file @
7eb035d
package
com
.
viontech
.
controller
;
import
com.viontech.service.adapter.ITimeCloseService
;
import
com.viontech.vo.TimeCloseVo
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.ResponseBody
;
import
org.springframework.web.bind.annotation.RestController
;
@RestController
public
class
TimeCloseController
extends
BaseController
{
@Autowired
ITimeCloseService
iTimeCloseService
;
@PostMapping
(
"/closetime"
)
@ResponseBody
public
Object
addTime
(
@RequestBody
TimeCloseVo
timeCloseVo
){
return
iTimeCloseService
.
add
(
timeCloseVo
);
}
}
src/main/java/com/viontech/controller/websocket/WebsocketController.java
View file @
7eb035d
...
...
@@ -20,7 +20,7 @@ import java.util.concurrent.ConcurrentHashMap;
*
*/
@Component
@ServerEndpoint
(
"/websocket/api/v1/handle/connects/{connection_unid}"
)
@ServerEndpoint
(
"/websocket/api/v1/
data
handle/connects/{connection_unid}"
)
@Slf4j
public
class
WebsocketController
{
...
...
src/main/java/com/viontech/dao/BehaviorArchiveDaoImpl.java
View file @
7eb035d
...
...
@@ -47,7 +47,7 @@ public class BehaviorArchiveDaoImpl implements IBehaviorArchiveDao {
query
.
distinct
(
true
);
List
<
Predicate
>
listP
=
new
ArrayList
<>();
Predicate
condition
=
null
;
ListJoin
<
BehaviorArchiveEntity
,
EventArchiveRelEntity
>
join
=
root
.
join
(
root
.
getModel
().
getList
(
"eventArchiveRelEntitys"
,
EventArchiveRelEntity
.
class
),
JoinType
.
INNER
);
ListJoin
<
BehaviorArchiveEntity
,
EventArchiveRelEntity
>
join
=
root
.
join
(
root
.
getModel
().
getList
(
"eventArchiveRelEntitys"
,
EventArchiveRelEntity
.
class
),
JoinType
.
LEFT
);
if
(
StringUtils
.
isNotBlank
(
behaviorArchiveVo
.
getEventType
()))
{
condition
=
criteriaBuilder
.
equal
(
root
.
get
(
"eventType"
),
behaviorArchiveVo
.
getEventType
());
listP
.
add
(
condition
);
...
...
@@ -67,7 +67,7 @@ public class BehaviorArchiveDaoImpl implements IBehaviorArchiveDao {
}
if
(
StringUtils
.
isNotBlank
(
behaviorArchiveVo
.
getEndDt
())){
condition
=
criteriaBuilder
.
lessThan
(
join
.
get
(
"eventDataEntity"
).
get
(
"eventDt"
).
as
(
Date
.
class
),
DateUtil
.
FORMAT_YYYY_MM_DD_HH_MM_SS
.
parse
(
behaviorArchiveVo
.
getEndDt
()));
condition
=
criteriaBuilder
.
lessThan
OrEqualTo
(
join
.
get
(
"eventDataEntity"
).
get
(
"eventDt"
).
as
(
Date
.
class
),
DateUtil
.
FORMAT_YYYY_MM_DD_HH_MM_SS
.
parse
(
behaviorArchiveVo
.
getEndDt
()));
listP
.
add
(
condition
);
}
}
catch
(
ParseException
e
)
{
...
...
@@ -81,7 +81,7 @@ public class BehaviorArchiveDaoImpl implements IBehaviorArchiveDao {
@Override
public
BehaviorArchiveVo
deleteByUnid
(
Integer
unid
)
{
jdbcTemplate
.
execute
(
"delete tb_event_archive_rel where archive_unid="
+
unid
);
jdbcTemplate
.
execute
(
"delete
from
tb_event_archive_rel where archive_unid="
+
unid
);
eventArchiveRepository
.
delete
(
unid
);
return
null
;
}
...
...
src/main/java/com/viontech/entity/TimeCloseEntity.java
0 → 100644
View file @
7eb035d
package
com
.
viontech
.
entity
;
import
com.fasterxml.jackson.annotation.JsonFormat
;
import
javax.persistence.*
;
import
java.util.Date
;
/***
* 系统定时关闭
*/
@Entity
@Table
(
name
=
"tb_time_close"
)
public
class
TimeCloseEntity
{
@Id
@GeneratedValue
(
strategy
=
GenerationType
.
IDENTITY
)
Integer
unid
;
@JsonFormat
(
pattern
=
"yyyy-MM-dd HH:mm:ss"
)
@Column
(
name
=
"start_dt"
,
nullable
=
true
)
Date
startDt
;
@JsonFormat
(
pattern
=
"yyyy-MM-dd HH:mm:ss"
)
@Column
(
name
=
"end_dt"
,
nullable
=
true
)
Date
endDt
;
public
Integer
getUnid
()
{
return
unid
;
}
public
void
setUnid
(
Integer
unid
)
{
this
.
unid
=
unid
;
}
public
Date
getStartDt
()
{
return
startDt
;
}
public
void
setStartDt
(
Date
startDt
)
{
this
.
startDt
=
startDt
;
}
public
Date
getEndDt
()
{
return
endDt
;
}
public
void
setEndDt
(
Date
endDt
)
{
this
.
endDt
=
endDt
;
}
}
src/main/java/com/viontech/entity/archive/BehaviorArchiveEntity.java
View file @
7eb035d
...
...
@@ -49,7 +49,7 @@ public class BehaviorArchiveEntity {
private
Integer
duty
;
/****
* 审核状态值为:0待审核、1审核通过、2审核不通过、
4事件结束、5
定时关闭
* 审核状态值为:0待审核、1审核通过、2审核不通过、
3事件结束、4
定时关闭
*/
@Column
(
name
=
"audit_status"
,
nullable
=
false
)
private
Integer
auditStatus
=
0
;
...
...
src/main/java/com/viontech/repository/TimeCloseRepository.java
0 → 100644
View file @
7eb035d
package
com
.
viontech
.
repository
;
import
com.viontech.entity.TimeCloseEntity
;
import
org.springframework.data.jpa.repository.JpaRepository
;
import
org.springframework.data.jpa.repository.JpaSpecificationExecutor
;
import
org.springframework.stereotype.Repository
;
@Repository
public
interface
TimeCloseRepository
extends
JpaRepository
<
TimeCloseEntity
,
Integer
>,
JpaSpecificationExecutor
<
TimeCloseEntity
>
{
}
src/main/java/com/viontech/service/adapter/ITimeCloseService.java
0 → 100644
View file @
7eb035d
package
com
.
viontech
.
service
.
adapter
;
import
com.viontech.vo.TimeCloseVo
;
public
interface
ITimeCloseService
{
Object
add
(
TimeCloseVo
timeCloseVo
);
}
src/main/java/com/viontech/service/adapter/behavior/IBehaviorService.java
View file @
7eb035d
...
...
@@ -15,4 +15,6 @@ public interface IBehaviorService {
List
<
EventDataEntity
>
selectAllByArchive
(
BehaviorArchiveVo
behaviorArchiveVo
);
Object
deleteEventByUnid
(
Integer
unid
);
Object
batchDelete
(
EventDataVo
eventDataVo
);
}
src/main/java/com/viontech/service/adapter/behavior/IBehaviorStatisticsService.java
0 → 100644
View file @
7eb035d
package
com
.
viontech
.
service
.
adapter
.
behavior
;
import
com.viontech.vo.BehaviorStatisticsVo
;
public
interface
IBehaviorStatisticsService
{
Object
statisticsByType
(
BehaviorStatisticsVo
behaviorStatisticsVo
);
Object
hourChart
(
BehaviorStatisticsVo
behaviorStatisticsVo
);
Object
statisticsByEventHandle
(
BehaviorStatisticsVo
behaviorStatisticsVo
);
}
src/main/java/com/viontech/service/impl/TimecloseServiceImpl.java
0 → 100644
View file @
7eb035d
package
com
.
viontech
.
service
.
impl
;
import
com.viontech.entity.TimeCloseEntity
;
import
com.viontech.repository.TimeCloseRepository
;
import
com.viontech.service.adapter.ITimeCloseService
;
import
com.viontech.util.DateUtil
;
import
com.viontech.vo.TimeCloseVo
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.data.jpa.domain.Specification
;
import
org.springframework.stereotype.Service
;
import
javax.persistence.criteria.CriteriaBuilder
;
import
javax.persistence.criteria.CriteriaQuery
;
import
javax.persistence.criteria.Predicate
;
import
javax.persistence.criteria.Root
;
import
java.text.ParseException
;
import
java.util.ArrayList
;
import
java.util.Date
;
import
java.util.List
;
@Service
public
class
TimecloseServiceImpl
implements
ITimeCloseService
{
@Autowired
TimeCloseRepository
timeCloseRepository
;
@Override
public
Object
add
(
TimeCloseVo
timeCloseVo
)
{
try
{
long
count
=
timeCloseRepository
.
count
(
new
Specification
<
TimeCloseEntity
>()
{
@Override
public
Predicate
toPredicate
(
Root
<
TimeCloseEntity
>
root
,
CriteriaQuery
<?>
query
,
CriteriaBuilder
cb
)
{
List
<
Predicate
>
listP
=
new
ArrayList
<>();
try
{
Predicate
start_startdt
=
cb
.
greaterThanOrEqualTo
(
root
.
get
(
"startDt"
).
as
(
Date
.
class
),
DateUtil
.
FORMAT_YYYY_MM_DD_HH_MM
.
parse
(
timeCloseVo
.
getStartDt
()));
Predicate
start_enddt
=
cb
.
lessThanOrEqualTo
(
root
.
get
(
"endDt"
).
as
(
Date
.
class
),
DateUtil
.
FORMAT_YYYY_MM_DD_HH_MM
.
parse
(
timeCloseVo
.
getStartDt
()));
Predicate
start
=
cb
.
and
(
start_startdt
,
start_enddt
);
Predicate
end_startdt
=
cb
.
greaterThanOrEqualTo
(
root
.
get
(
"startDt"
).
as
(
Date
.
class
),
DateUtil
.
FORMAT_YYYY_MM_DD_HH_MM
.
parse
(
timeCloseVo
.
getEndDt
()));
Predicate
end_enddt
=
cb
.
lessThanOrEqualTo
(
root
.
get
(
"endDt"
).
as
(
Date
.
class
),
DateUtil
.
FORMAT_YYYY_MM_DD_HH_MM
.
parse
(
timeCloseVo
.
getEndDt
()));
Predicate
end
=
cb
.
and
(
end_startdt
,
end_enddt
);
Predicate
or
=
cb
.
or
(
start
,
end
);
query
.
where
(
or
);
}
catch
(
ParseException
e
)
{
e
.
printStackTrace
();
}
return
null
;
}
});
if
(
count
>
0
){
return
"当前设置时间段已存在"
;
}
TimeCloseEntity
timeCloseEntity
=
new
TimeCloseEntity
();
timeCloseEntity
.
setEndDt
(
DateUtil
.
FORMAT_YYYY_MM_DD_HH_MM_SS
.
parse
(
timeCloseVo
.
getEndDt
()));
timeCloseEntity
.
setStartDt
(
DateUtil
.
FORMAT_YYYY_MM_DD_HH_MM_SS
.
parse
(
timeCloseVo
.
getStartDt
()));
timeCloseRepository
.
save
(
timeCloseEntity
);
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
return
null
;
}
}
src/main/java/com/viontech/service/impl/behavior/BehaviorServiceImpl.java
View file @
7eb035d
...
...
@@ -9,6 +9,8 @@ import com.viontech.util.JavaBean2Json;
import
com.viontech.vo.BehaviorArchiveVo
;
import
com.viontech.vo.EventDataVo
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.collections.CollectionUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.data.domain.PageRequest
;
import
org.springframework.data.domain.Pageable
;
...
...
@@ -59,7 +61,10 @@ public class BehaviorServiceImpl implements IBehaviorService {
eventDataEntity
.
setOriginalJson
(
JavaBean2Json
.
Json2JavaBean
(
JavaBean2Json
.
javaBean2Json
(
eventDataVo
),
Map
.
class
));
eventDataEntity
.
setArchive
(
false
);
eventDataRepository
.
save
(
eventDataEntity
);
jdbcTemplate
.
execute
(
"SELECT archive()"
);
String
sql
=
"SELECT automatic_archive("
+
eventDataEntity
.
getEvent_unid
()+
",'"
+
eventDataVo
.
getEvent_dt
()+
"','"
+
eventDataEntity
.
getEventType
()+
"','"
+(
StringUtils
.
isBlank
(
eventDataEntity
.
getLocationCode
())?
"-"
:
eventDataEntity
.
getLocationCode
())+
"','"
+(
StringUtils
.
isBlank
(
eventDataEntity
.
getLocationName
())?
"-"
:
eventDataEntity
.
getLocationName
())+
"')"
;
System
.
out
.
println
(
"sql="
+
sql
);
jdbcTemplate
.
execute
(
sql
);
//jdbcTemplate.execute("SELECT archive()");
}
catch
(
Exception
e
)
{
log
.
error
(
"新增behavior事件异常:"
+
e
.
getLocalizedMessage
(),
e
);
}
...
...
@@ -83,8 +88,18 @@ public class BehaviorServiceImpl implements IBehaviorService {
@Override
public
Object
deleteEventByUnid
(
Integer
unid
)
{
jdbcTemplate
.
execute
(
"delete tb_event_archive_rel where event_unid="
+
unid
);
jdbcTemplate
.
execute
(
"delete
from
tb_event_archive_rel where event_unid="
+
unid
);
eventDataRepository
.
delete
(
unid
);
return
null
;
}
@Override
public
Object
batchDelete
(
EventDataVo
eventDataVo
)
{
if
(!
CollectionUtils
.
isEmpty
(
eventDataVo
.
getEventUnids
())){
for
(
Integer
unid
:
eventDataVo
.
getEventUnids
()){
deleteEventByUnid
(
unid
);
}
}
return
null
;
}
}
src/main/java/com/viontech/service/impl/behavior/BehaviorStatisticsServiceImpl.java
0 → 100644
View file @
7eb035d
package
com
.
viontech
.
service
.
impl
.
behavior
;
import
com.viontech.entity.EventDataEntity
;
import
com.viontech.entity.archive.EventArchiveRelEntity
;
import
com.viontech.repository.EventDataRepository
;
import
com.viontech.service.adapter.behavior.IBehaviorStatisticsService
;
import
com.viontech.util.DateUtil
;
import
com.viontech.vo.BehaviorStatisticsVo
;
import
org.apache.commons.collections.CollectionUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.data.jpa.domain.Specification
;
import
org.springframework.jdbc.core.JdbcTemplate
;
import
org.springframework.stereotype.Service
;
import
javax.persistence.criteria.*
;
import
java.text.ParseException
;
import
java.util.*
;
@Service
public
class
BehaviorStatisticsServiceImpl
implements
IBehaviorStatisticsService
{
@Autowired
EventDataRepository
eventDataRepository
;
@Autowired
public
JdbcTemplate
jdbcTemplate
;
@Override
public
Object
statisticsByType
(
BehaviorStatisticsVo
behaviorStatisticsVo
)
{
StringBuilder
stringBuilder
=
new
StringBuilder
(
"select count(1) as total_num ,event_type from tb_event_data WHERE 1=1 "
);
if
(
StringUtils
.
isNotBlank
(
behaviorStatisticsVo
.
getStartDt
())){
stringBuilder
.
append
(
" and event_dt>='"
).
append
(
behaviorStatisticsVo
.
getStartDt
()).
append
(
"'"
);
}
if
(
StringUtils
.
isNotBlank
(
behaviorStatisticsVo
.
getEndDt
())){
stringBuilder
.
append
(
" and event_dt<='"
).
append
(
behaviorStatisticsVo
.
getEndDt
()).
append
(
"'"
);
}
stringBuilder
.
append
(
" group by event_type order by event_type"
);
Map
result
=
new
HashMap
(
2
);
List
<
Map
<
String
,
Object
>>
list_data
=
jdbcTemplate
.
queryForList
(
stringBuilder
.
toString
());
long
total_num
=
0L
;
if
(
!
CollectionUtils
.
isEmpty
(
list_data
)){
for
(
Map
<
String
,
Object
>
map:
list_data
){
total_num
=
total_num
+
Long
.
parseLong
(
String
.
valueOf
(
map
.
get
(
"total_num"
)));
}
}
result
.
put
(
"total_num"
,
total_num
);
result
.
put
(
"list_data"
,
list_data
);
return
result
;
}
@Override
public
Object
hourChart
(
BehaviorStatisticsVo
behaviorStatisticsVo
)
{
StringBuilder
stringBuilder
=
new
StringBuilder
(
"select count(1) as total_num ,event_type,to_char(event_dt,'HH24') as hour from tb_event_data WHERE 1=1 "
);
if
(
StringUtils
.
isNotBlank
(
behaviorStatisticsVo
.
getStartDt
())){
stringBuilder
.
append
(
" and event_dt>='"
).
append
(
behaviorStatisticsVo
.
getStartDt
()).
append
(
"'"
);
}
if
(
StringUtils
.
isNotBlank
(
behaviorStatisticsVo
.
getEndDt
())){
stringBuilder
.
append
(
" and event_dt<='"
).
append
(
behaviorStatisticsVo
.
getEndDt
()).
append
(
"'"
);
}
stringBuilder
.
append
(
" group by event_type,hour order by hour"
);
Map
result
=
new
HashMap
(
1
);
List
<
Map
<
String
,
Object
>>
list_data
=
jdbcTemplate
.
queryForList
(
stringBuilder
.
toString
());
result
.
put
(
"list_data"
,
list_data
);
return
result
;
}
@Override
public
Object
statisticsByEventHandle
(
BehaviorStatisticsVo
behaviorStatisticsVo
)
{
StringBuilder
stringBuilder
=
new
StringBuilder
(
"select event_unid from tb_event_data WHERE 1=1 "
);
if
(
StringUtils
.
isNotBlank
(
behaviorStatisticsVo
.
getStartDt
())){
stringBuilder
.
append
(
" and event_dt>='"
).
append
(
behaviorStatisticsVo
.
getStartDt
()).
append
(
"'"
);
}
if
(
StringUtils
.
isNotBlank
(
behaviorStatisticsVo
.
getEndDt
())){
stringBuilder
.
append
(
" and event_dt<='"
).
append
(
behaviorStatisticsVo
.
getEndDt
()).
append
(
"'"
);
}
Map
result
=
new
HashMap
(
2
);
List
<
Map
<
String
,
Object
>>
list_data
=
jdbcTemplate
.
queryForList
(
stringBuilder
.
toString
());
result
.
put
(
"snap_num"
,
list_data
.
size
());
result
.
put
(
"audit_num"
,
eventDataRepository
.
findAll
(
new
Specification
<
EventDataEntity
>()
{
@Override
public
Predicate
toPredicate
(
Root
<
EventDataEntity
>
root
,
CriteriaQuery
<?>
query
,
CriteriaBuilder
cb
)
{
List
<
Predicate
>
listP
=
new
ArrayList
<>();
Join
<
EventDataEntity
,
EventArchiveRelEntity
>
join
=
root
.
join
(
root
.
getModel
().
getSingularAttribute
(
"eventArchiveRelEntity"
,
EventArchiveRelEntity
.
class
),
JoinType
.
INNER
);
Path
<
Object
>
path
=
join
.
get
(
"behaviorArchiveEntity"
).
get
(
"auditStatus"
);
CriteriaBuilder
.
In
<
Object
>
in
=
cb
.
in
(
path
);
in
.
value
(
1
);
in
.
value
(
2
);
listP
.
add
(
in
);
Predicate
condition
=
null
;
try
{
if
(
StringUtils
.
isNotBlank
(
behaviorStatisticsVo
.
getStartDt
())){
condition
=
cb
.
greaterThanOrEqualTo
(
join
.
get
(
"eventDataEntity"
).
get
(
"eventDt"
).
as
(
Date
.
class
),
DateUtil
.
FORMAT_YYYY_MM_DD_HH_MM_SS
.
parse
(
behaviorStatisticsVo
.
getStartDt
()));
listP
.
add
(
condition
);
}
if
(
StringUtils
.
isNotBlank
(
behaviorStatisticsVo
.
getEndDt
())){
condition
=
cb
.
lessThanOrEqualTo
(
join
.
get
(
"eventDataEntity"
).
get
(
"eventDt"
).
as
(
Date
.
class
),
DateUtil
.
FORMAT_YYYY_MM_DD_HH_MM_SS
.
parse
(
behaviorStatisticsVo
.
getEndDt
()));
listP
.
add
(
condition
);
}
}
catch
(
ParseException
e
)
{
e
.
printStackTrace
();
}
query
.
where
(
listP
.
toArray
(
new
Predicate
[]{}));
//query.orderBy(cb.desc(root.get("eventDt").as(Date.class)));
return
null
;
}
}).
size
());
return
result
;
}
}
src/main/java/com/viontech/vo/BehaviorArchiveVo.java
View file @
7eb035d
...
...
@@ -14,7 +14,7 @@ public class BehaviorArchiveVo {
/****
* 审核状态值为:0待审核、1审核通过、2审核不通过、4事件结束、5定时关闭
*/
private
Integer
auditStatus
=
0
;
private
Integer
auditStatus
;
private
String
auditInfo
;
private
Integer
pageNum
=
0
;
...
...
@@ -97,7 +97,11 @@ public class BehaviorArchiveVo {
}
public
void
setPageNum
(
Integer
pageNum
)
{
this
.
pageNum
=
pageNum
;
if
(
pageNum
>=
1
){
this
.
pageNum
=
pageNum
-
1
;
}
else
{
this
.
pageNum
=
pageNum
;
}
}
public
Integer
getPageSize
()
{
...
...
src/main/java/com/viontech/vo/BehaviorStatisticsVo.java
0 → 100644
View file @
7eb035d
package
com
.
viontech
.
vo
;
public
class
BehaviorStatisticsVo
{
String
startDt
;
String
endDt
;
public
String
getStartDt
()
{
return
startDt
;
}
public
void
setStartDt
(
String
startDt
)
{
this
.
startDt
=
startDt
;
}
public
String
getEndDt
()
{
return
endDt
;
}
public
void
setEndDt
(
String
endDt
)
{
this
.
endDt
=
endDt
;
}
}
src/main/java/com/viontech/vo/EventDataVo.java
View file @
7eb035d
...
...
@@ -27,6 +27,7 @@ public class EventDataVo {
private
String
subtask_id
;
private
String
source_type
;
private
List
<
Integer
>
eventUnids
;
public
String
getTask_type
()
{
return
task_type
;
}
...
...
@@ -170,4 +171,12 @@ public class EventDataVo {
public
void
setSource_type
(
String
source_type
)
{
this
.
source_type
=
source_type
;
}
public
List
<
Integer
>
getEventUnids
()
{
return
eventUnids
;
}
public
void
setEventUnids
(
List
<
Integer
>
eventUnids
)
{
this
.
eventUnids
=
eventUnids
;
}
}
src/main/java/com/viontech/vo/TimeCloseVo.java
0 → 100644
View file @
7eb035d
package
com
.
viontech
.
vo
;
public
class
TimeCloseVo
{
private
String
startDt
;
private
String
endDt
;
public
String
getStartDt
()
{
return
startDt
;
}
public
void
setStartDt
(
String
startDt
)
{
this
.
startDt
=
startDt
;
}
public
String
getEndDt
()
{
return
endDt
;
}
public
void
setEndDt
(
String
endDt
)
{
this
.
endDt
=
endDt
;
}
}
src/main/java/com/viontech/vo/VehicleVo.java
deleted
100644 → 0
View file @
92e3a41
package
com
.
viontech
.
vo
;
import
lombok.Data
;
import
java.util.List
;
import
java.util.Map
;
/**
* Created by Administrator on 2019/3/26.
*/
@Data
public
class
VehicleVo
{
private
String
task_type
;
private
String
task_id
;
private
String
event_type
;
private
String
event_refid
;
private
String
event_dt
;
private
String
dev_unid
;
private
Map
aux_dev_info
;
private
Map
event_data
;
private
List
pics
;
private
String
event_cate
;
private
String
vdev_unid
;
private
String
vchan_duid
;
private
String
vchan_refid
;
private
List
video
;
private
String
test_pic_file
;
private
String
test_frame_no
;
private
String
subtask_id
;
private
String
source_type
;
}
Write
Preview
Markdown
is supported
Attach a file
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 post a comment