Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
V
VideoAIBatchTaskConsumerService
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
VideoAIService
VideoAIBatchTaskConsumerService
Commits
56a562b4
Commit
56a562b4
authored
May 21, 2021
by
yzm
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dx界面完善
parent
37a7ec1c
Changes
20
Hide whitespace changes
Inline
Side-by-side
Showing
20 changed files
with
1115 additions
and
638 deletions
+1115
-638
pom.xml
pom.xml
+1
-0
src/main/java/com/cx/cn/cxquartz/controller/ExtController.java
...ain/java/com/cx/cn/cxquartz/controller/ExtController.java
+158
-127
src/main/java/com/cx/cn/cxquartz/controller/QuartzController.java
.../java/com/cx/cn/cxquartz/controller/QuartzController.java
+43
-24
src/main/java/com/cx/cn/cxquartz/controller/SbtdspsrController.java
...ava/com/cx/cn/cxquartz/controller/SbtdspsrController.java
+6
-123
src/main/java/com/cx/cn/cxquartz/dao/SbtdspsrMapper.java
src/main/java/com/cx/cn/cxquartz/dao/SbtdspsrMapper.java
+1
-1
src/main/java/com/cx/cn/cxquartz/service/quartz/SbtdspsrService.java
...va/com/cx/cn/cxquartz/service/quartz/SbtdspsrService.java
+2
-0
src/main/java/com/cx/cn/cxquartz/service/quartz/impl/SbtdspsrImpl.java
.../com/cx/cn/cxquartz/service/quartz/impl/SbtdspsrImpl.java
+5
-0
src/main/java/com/cx/cn/cxquartz/util/FileTransferManager.java
...ain/java/com/cx/cn/cxquartz/util/FileTransferManager.java
+31
-1
src/main/java/com/cx/cn/cxquartz/util/RestTemplateConfig.java
...main/java/com/cx/cn/cxquartz/util/RestTemplateConfig.java
+2
-2
src/main/java/com/cx/cn/cxquartz/vo/ImageList.java
src/main/java/com/cx/cn/cxquartz/vo/ImageList.java
+10
-9
src/main/java/com/cx/cn/cxquartz/vo/Output.java
src/main/java/com/cx/cn/cxquartz/vo/Output.java
+40
-40
src/main/java/com/cx/cn/cxquartz/vo/TraffpictureParam.java
src/main/java/com/cx/cn/cxquartz/vo/TraffpictureParam.java
+10
-0
src/main/resources/application.yml
src/main/resources/application.yml
+8
-4
src/main/resources/file.properties
src/main/resources/file.properties
+1
-0
src/main/resources/mapper/QuartzTaskInformationsMapper.xml
src/main/resources/mapper/QuartzTaskInformationsMapper.xml
+3
-2
src/main/resources/mapper/SbtdspsrMapper.xml
src/main/resources/mapper/SbtdspsrMapper.xml
+28
-3
src/main/resources/mapper/TraffPictureMapper.xml
src/main/resources/mapper/TraffPictureMapper.xml
+1
-1
src/main/resources/templates/addtask.html
src/main/resources/templates/addtask.html
+398
-12
src/main/resources/templates/index.html
src/main/resources/templates/index.html
+32
-13
src/main/resources/templates/updatetask.html
src/main/resources/templates/updatetask.html
+335
-276
No files found.
pom.xml
View file @
56a562b4
...
@@ -136,6 +136,7 @@
...
@@ -136,6 +136,7 @@
<groupId>
org.springframework.boot
</groupId>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-starter-data-redis
</artifactId>
<artifactId>
spring-boot-starter-data-redis
</artifactId>
</dependency>
</dependency>
<!--kafka依赖-->
<!--kafka依赖-->
<dependency>
<dependency>
<groupId>
org.springframework.kafka
</groupId>
<groupId>
org.springframework.kafka
</groupId>
...
...
src/main/java/com/cx/cn/cxquartz/controller/ExtController.java
View file @
56a562b4
...
@@ -12,6 +12,8 @@ import com.cx.cn.cxquartz.job.WebSocket;
...
@@ -12,6 +12,8 @@ import com.cx.cn.cxquartz.job.WebSocket;
import
com.cx.cn.cxquartz.service.quartz.*
;
import
com.cx.cn.cxquartz.service.quartz.*
;
import
com.cx.cn.cxquartz.util.*
;
import
com.cx.cn.cxquartz.util.*
;
import
com.cx.cn.cxquartz.vo.*
;
import
com.cx.cn.cxquartz.vo.*
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.tomcat.util.http.fileupload.IOUtils
;
import
org.slf4j.Logger
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
...
@@ -22,15 +24,17 @@ import org.springframework.web.bind.annotation.*;
...
@@ -22,15 +24,17 @@ import org.springframework.web.bind.annotation.*;
import
org.springframework.web.client.RestTemplate
;
import
org.springframework.web.client.RestTemplate
;
import
sun.misc.BASE64Decoder
;
import
sun.misc.BASE64Decoder
;
import
sun.misc.BASE64Encoder
;
import
sun.misc.BASE64Encoder
;
import
sun.net.www.protocol.ftp.FtpURLConnection
;
import
javax.imageio.ImageIO
;
import
javax.imageio.ImageIO
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletResponse
;
import
javax.servlet.http.HttpSession
;
import
javax.servlet.http.HttpSession
;
import
java.awt.*
;
import
java.awt.*
;
import
java.awt.image.BufferedImage
;
import
java.awt.image.BufferedImage
;
import
java.io.
ByteArrayInputStream
;
import
java.io.
*
;
import
java.
io.ByteArrayOutputStream
;
import
java.
net.HttpURLConnection
;
import
java.
io.File
;
import
java.
net.URL
;
import
java.text.SimpleDateFormat
;
import
java.text.SimpleDateFormat
;
import
java.util.*
;
import
java.util.*
;
import
java.util.List
;
import
java.util.List
;
...
@@ -226,8 +230,11 @@ public class ExtController {
...
@@ -226,8 +230,11 @@ public class ExtController {
String
body
=
exchange
.
getBody
();
String
body
=
exchange
.
getBody
();
if
(
null
==
body
||
""
.
equals
(
body
)){
if
(
null
==
body
||
""
.
equals
(
body
)){
//rtsp地址可能改变,重新获取
//rtsp地址可能改变,重新获取
String
rtsp
=
getnewRtspVlue
(
sbtdspsr
.
getSbbh
());
if
(!
videoid
.
contains
(
"rtsp"
))
{
maps
.
put
(
"rtspvalue"
,
rtsp
);
String
rtsp
=
getnewRtspVlue
(
sbtdspsr
.
getSbbh
());
maps
.
put
(
"rtspvalue"
,
rtsp
);
}
}
}
else
{
else
{
JSONObject
json
=
JSONObject
.
parseObject
(
exchange
.
getBody
());
JSONObject
json
=
JSONObject
.
parseObject
(
exchange
.
getBody
());
...
@@ -244,13 +251,7 @@ public class ExtController {
...
@@ -244,13 +251,7 @@ public class ExtController {
}
}
try
{
try
{
//根据rtsp 进行图片获取及存储
TraffAlarmRecord
record
=
new
TraffAlarmRecord
();
Map
<
String
,
Object
>
transferRecordMap
=
new
HashMap
<>();
TraffAlarmRecord
traffAlarmRecord
=
new
TraffAlarmRecord
();
traffAlarmRecord
.
setFdid
(
sbtdspsr
.
getSbbh
());
traffAlarmRecord
.
setChannelid
(
Integer
.
parseInt
(
String
.
valueOf
(
sbtdspsr
.
getTdbh
())));
traffAlarmRecord
.
setAreaid
(
Long
.
parseLong
(
sbtdspsr
.
getXzbh
()));
int
i
=
0
;
int
i
=
0
;
if
(
imgUrls
.
size
()>
0
)
{
if
(
imgUrls
.
size
()>
0
)
{
i
=
1
;
i
=
1
;
...
@@ -271,6 +272,17 @@ public class ExtController {
...
@@ -271,6 +272,17 @@ public class ExtController {
}
}
}
}
}
}
if
(
imgUrls
.
size
()==
0
){
logger
.
info
(
"no picture data "
);
return
ResultUtil
.
success
();
}
//根据rtsp 进行图片获取及存储
TraffAlarmRecord
record
=
new
TraffAlarmRecord
();
Map
<
String
,
Object
>
transferRecordMap
=
new
HashMap
<>();
TraffAlarmRecord
traffAlarmRecord
=
new
TraffAlarmRecord
();
traffAlarmRecord
.
setFdid
(
sbtdspsr
.
getSbbh
());
traffAlarmRecord
.
setChannelid
(
Integer
.
parseInt
(
String
.
valueOf
(
sbtdspsr
.
getTdbh
())));
traffAlarmRecord
.
setAreaid
(
Long
.
parseLong
(
sbtdspsr
.
getXzbh
()));
traffAlarmRecord
.
setCreatetime
(
new
Date
());
traffAlarmRecord
.
setCreatetime
(
new
Date
());
traffAlarmRecord
.
setPushstatus
(
9
);
traffAlarmRecord
.
setPushstatus
(
9
);
//免审
//免审
...
@@ -315,19 +327,25 @@ public String getnewRtspVlue(String devicecode ){
...
@@ -315,19 +327,25 @@ public String getnewRtspVlue(String devicecode ){
//返回rtsp 地址
//返回rtsp 地址
if
(
null
!=
json
.
get
(
"obj"
)
&&
!
""
.
equals
(
json
.
get
(
"obj"
)))
{
if
(
null
!=
json
.
get
(
"obj"
)
&&
!
""
.
equals
(
json
.
get
(
"obj"
)))
{
rtspnewvalue
=
String
.
valueOf
(
json
.
get
(
"obj"
));
rtspnewvalue
=
String
.
valueOf
(
json
.
get
(
"obj"
));
//更新sbtdspsr 地址
if
(
rtspnewvalue
.
contains
(
"rtsp"
))
{
int
result
=
sbtdspsrService
.
updateRecogByRtsp
(
rtspnewvalue
,
devicecode
);
//更新sbtdspsr 地址
if
(
result
>
0
)
{
int
result
=
sbtdspsrService
.
updateRecogByRtsp
(
rtspnewvalue
,
devicecode
);
logger
.
info
(
"更新rtsp success"
);
if
(
result
>
0
)
{
}
else
{
logger
.
info
(
"更新rtsp success"
);
logger
.
info
(
"设备"
+
devicecode
+
"不存在"
);
}
else
{
logger
.
info
(
"设备"
+
devicecode
+
"不存在"
);
}
}
else
{
logger
.
info
(
"获取失败"
);
}
}
}
}
}
}
return
rtspnewvalue
;
return
rtspnewvalue
;
}
}
@RequestMapping
(
value
=
"/getRecog"
,
method
=
RequestMethod
.
POST
)
@RequestMapping
(
value
=
"/getRecog"
,
method
=
RequestMethod
.
POST
)
public
String
getRecog
(
HttpServletRequest
request
,
@RequestBody
String
videoid
)
{
public
String
getRecog
(
@RequestBody
String
videoid
)
{
//根据判断监控是否存在,该监控检测的事件是什么
//根据判断监控是否存在,该监控检测的事件是什么
List
<
Map
>
mapList
=
sbtdspsrService
.
selectRecogByRtsp
(
videoid
);
List
<
Map
>
mapList
=
sbtdspsrService
.
selectRecogByRtsp
(
videoid
);
String
model
=
"1"
;
String
model
=
"1"
;
...
@@ -340,7 +358,10 @@ public String getnewRtspVlue(String devicecode ){
...
@@ -340,7 +358,10 @@ public String getnewRtspVlue(String devicecode ){
//获得该监控的检测业务与检测范围
//获得该监控的检测业务与检测范围
for
(
Map
<
String
,
Object
>
map:
mapList
)
{
for
(
Map
<
String
,
Object
>
map:
mapList
)
{
for
(
Map
.
Entry
<
String
,
Object
>
maps:
map
.
entrySet
())
{
for
(
Map
.
Entry
<
String
,
Object
>
maps:
map
.
entrySet
())
{
if
(
"metatype"
.
equals
(
maps
.
getKey
())){
if
(
"videoid"
.
equals
(
maps
.
getKey
())){
videoid
=
String
.
valueOf
(
maps
.
getValue
());
}
else
if
(
"metatype"
.
equals
(
maps
.
getKey
())){
model
=
String
.
valueOf
(
maps
.
getValue
());
model
=
String
.
valueOf
(
maps
.
getValue
());
}
}
else
if
(
"recordtype"
.
equals
(
maps
.
getKey
())){
else
if
(
"recordtype"
.
equals
(
maps
.
getKey
())){
...
@@ -365,8 +386,16 @@ public String getnewRtspVlue(String devicecode ){
...
@@ -365,8 +386,16 @@ public String getnewRtspVlue(String devicecode ){
String
basepath
=
"gstraff/"
+
videoid
+
"/"
+
DateUtils
.
formatCurrDayNoSign
();
String
basepath
=
"gstraff/"
+
videoid
+
"/"
+
DateUtils
.
formatCurrDayNoSign
();
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
if
(
videoid
.
indexOf
(
"_"
)<
0
){
videoid
=
videoid
+
"_0"
;
}
if
(
videoid
.
split
(
"_"
).
length
<
2
){
logger
.
info
(
"监控不存在"
);
return
ResultUtil
.
success
();
}
map
.
put
(
"sbbh"
,
videoid
.
split
(
"_"
)[
0
]);
map
.
put
(
"sbbh"
,
videoid
.
split
(
"_"
)[
0
]);
map
.
put
(
"tdbh"
,
0
);
map
.
put
(
"tdbh"
,
videoid
.
split
(
"_"
)[
1
]
);
List
<
TraffAlarmRecord
>
traffalarmrecordlist
=
traffAlarmRecordService
.
getTraffAlarmRecordByProgress
(
map
);
List
<
TraffAlarmRecord
>
traffalarmrecordlist
=
traffAlarmRecordService
.
getTraffAlarmRecordByProgress
(
map
);
if
(
traffalarmrecordlist
.
size
()<
1
)
{
if
(
traffalarmrecordlist
.
size
()<
1
)
{
return
ResultUtil
.
success
();
return
ResultUtil
.
success
();
...
@@ -387,120 +416,122 @@ public String getnewRtspVlue(String devicecode ){
...
@@ -387,120 +416,122 @@ public String getnewRtspVlue(String devicecode ){
continue
;
continue
;
}
}
requestEntity
=
new
HttpEntity
<>(
JSONObject
.
toJSONString
(
param
),
headers
);
requestEntity
=
new
HttpEntity
<>(
JSONObject
.
toJSONString
(
param
),
headers
);
ResponseEntity
<
String
>
response
=
restTemplate
.
exchange
(
recogurl
,
HttpMethod
.
POST
,
requestEntity
,
String
.
class
);
try
{
String
body
=
response
.
getBody
();
ResponseEntity
<
String
>
response
=
restTemplate
.
exchange
(
recogurl
,
HttpMethod
.
POST
,
requestEntity
,
String
.
class
);
JSONObject
result
=
JSONObject
.
parseObject
(
body
);
if
(
null
!=
result
.
get
(
"ret"
)
&&
result
.
get
(
"ret"
).
equals
(
"200"
))
{
String
body
=
response
.
getBody
();
//获得返回结果,根据 Metadata.type 判断是人,车,人骑车,并将详细信息入对应的表
JSONObject
result
=
JSONObject
.
parseObject
(
body
);
List
<
TraffpictureParam
>
objectList
=
(
List
<
TraffpictureParam
>)
JSONArray
.
parseArray
(
String
.
valueOf
(
result
.
get
(
"ObjectList"
)),
TraffpictureParam
.
class
);
if
(
null
!=
result
.
get
(
"ret"
)
&&
result
.
get
(
"ret"
).
equals
(
"200"
))
{
//获得 type
//获得返回结果,根据 Metadata.type 判断是人,车,人骑车,并将详细信息入对应的表
//更新 recordalarm 为一分析
List
<
TraffpictureParam
>
objectList
=
(
List
<
TraffpictureParam
>)
JSONArray
.
parseArray
(
String
.
valueOf
(
result
.
get
(
"ObjectList"
)),
TraffpictureParam
.
class
);
traffAlarmRecordService
.
updateTraffAlarmRecordProcess
(
transferRecord
);
//获得 type
if
(
objectList
.
size
()<
1
){
//更新 recordalarm 为一分析
logger
.
info
(
" no picturedata "
);
traffAlarmRecordService
.
updateTraffAlarmRecordProcess
(
transferRecord
);
continue
;
if
(
objectList
.
size
()
<
1
)
{
}
logger
.
info
(
" no picturedata "
);
//根据结构化统计查询是否超过密度,超过则预警
continue
;
Code
code
=
codeservice
.
selectalarmNum
(
recordtype
);
}
//判断是否统计结构化数据
//根据结构化统计查询是否超过密度,超过则预警
if
((
"6"
.
equals
(
recordtype
)||
"2"
.
equals
(
recordtype
)))
Code
code
=
codeservice
.
selectalarmNum
(
recordtype
);
{
//判断是否统计结构化数据
if
(
null
!=
code
&&
null
!=
code
.
getAlarmnum
()&&
code
.
getAlarmnum
()>
objectList
.
size
())
if
((
"6"
.
equals
(
recordtype
)
||
"2"
.
equals
(
recordtype
)))
{
{
if
(
null
!=
code
&&
null
!=
code
.
getAlarmnum
()
&&
code
.
getAlarmnum
()
>
objectList
.
size
())
{
TraffpictureParam
traffpictureParam
=
new
TraffpictureParam
();
TraffpictureParam
traffpictureParam
=
new
TraffpictureParam
();
setTraffpictureParam
(
recordtype
,
base64Encoder
,
transferRecord
,
traffpictureParam
);
setTraffpictureParam
(
recordtype
,
base64Encoder
,
transferRecord
,
traffpictureParam
);
traffpictureParam
.
setTargetnum
(
objectList
.
size
());
traffpictureParam
.
setTargetnum
(
objectList
.
size
());
//超过则预警
//超过则预警
traffpictureParam
.
setRecordtype
(
recordtype
);
traffpictureParam
.
setRecordtype
(
recordtype
);
//图片重叠?
traffpictureParam
.
setImagedata
(
transferRecord
.
getImg1path
());
traffpictureParam
.
setImagedata
(
transferRecord
.
getImg1path
());
traffPictureService
.
updateTraffpicture
(
traffpictureParam
);
traffPictureService
.
updateTraffpicture
(
traffpictureParam
);
WebSocket
.
GroupSending
(
JSONObject
.
toJSONString
(
traffpictureParam
));
WebSocket
.
GroupSending
(
JSONObject
.
toJSONString
(
traffpictureParam
));
}
}
else
{
for
(
TraffpictureParam
traffpictureParam
:
objectList
)
{
//根据imageid 获得 base64图片
JSONObject
metadata
=
JSONObject
.
parseObject
(
String
.
valueOf
(
traffpictureParam
.
getMetadata
()));
JSONObject
ObjectBoundingBox
=
metadata
.
getJSONObject
(
"ObjectBoundingBox"
);
if
(
null
==
ObjectBoundingBox
)
{
traffpictureParam
.
setObjx
(
metadata
.
getIntValue
(
"LeftTopX"
));
traffpictureParam
.
setObjy
(
metadata
.
getIntValue
(
"LeftTopY"
));
traffpictureParam
.
setObjw
(
metadata
.
getIntValue
(
"RightBtmX"
)
-
metadata
.
getIntValue
(
"LeftTopX"
));
traffpictureParam
.
setObjh
(
metadata
.
getIntValue
(
"RightBtmY"
)
-
metadata
.
getIntValue
(
"LeftTopY"
));
}
else
{
traffpictureParam
.
setObjx
(
ObjectBoundingBox
.
getIntValue
(
"X"
));
traffpictureParam
.
setObjy
(
ObjectBoundingBox
.
getIntValue
(
"Y"
));
traffpictureParam
.
setObjw
(
ObjectBoundingBox
.
getIntValue
(
"W"
));
traffpictureParam
.
setObjh
(
ObjectBoundingBox
.
getIntValue
(
"H"
));
}
}
}
else
{
for
(
TraffpictureParam
traffpictureParam
:
objectList
)
{
//根据imageid 获得 base64图片
JSONObject
metadata
=
JSONObject
.
parseObject
(
String
.
valueOf
(
traffpictureParam
.
getMetadata
()));
JSONObject
ObjectBoundingBox
=
metadata
.
getJSONObject
(
"ObjectBoundingBox"
);
if
(
null
==
ObjectBoundingBox
)
{
traffpictureParam
.
setObjx
(
metadata
.
getIntValue
(
"LeftTopX"
)+
roiarray
[
0
].
intValue
());
traffpictureParam
.
setObjy
(
metadata
.
getIntValue
(
"LeftTopY"
)+
roiarray
[
1
].
intValue
());
traffpictureParam
.
setObjw
(
metadata
.
getIntValue
(
"RightBtmX"
)
-
metadata
.
getIntValue
(
"LeftTopX"
));
traffpictureParam
.
setObjh
(
metadata
.
getIntValue
(
"RightBtmY"
)
-
metadata
.
getIntValue
(
"LeftTopY"
));
}
else
{
traffpictureParam
.
setObjx
(
ObjectBoundingBox
.
getIntValue
(
"X"
)+
roiarray
[
0
].
intValue
());
traffpictureParam
.
setObjy
(
ObjectBoundingBox
.
getIntValue
(
"Y"
)+
roiarray
[
1
].
intValue
());
traffpictureParam
.
setObjw
(
ObjectBoundingBox
.
getIntValue
(
"W"
));
traffpictureParam
.
setObjh
(
ObjectBoundingBox
.
getIntValue
(
"H"
));
}
if
(
null
!=
metadata
&&
metadata
.
get
(
"Type"
).
equals
(
model
))
{
traffpictureParam
.
setMetatype
(
String
.
valueOf
(
metadata
.
get
(
"Type"
)));
//规定区域内出现告警对象
setTraffpictureParam
(
recordtype
,
base64Encoder
,
transferRecord
,
traffpictureParam
);
if
(
"1"
.
equals
(
metadata
.
get
(
"Type"
)))
{
//规定范围内检测到人
Pedestrian
meta
=
JSON
.
toJavaObject
(
metadata
,
Pedestrian
.
class
);
meta
.
setId
(
traffpictureParam
.
getId
());
pedestrianService
.
insertpedestrian
(
meta
);
//新增到事件详情表返回主键
}
else
if
(
null
!=
metadata
&&
"2"
.
equals
(
metadata
.
get
(
"Type"
)))
{
//车辆
Traffic
meta
=
JSON
.
toJavaObject
(
metadata
,
Traffic
.
class
);
meta
.
setId
(
traffpictureParam
.
getId
());
//新增到车辆详情表
trafficService
.
insertTraffic
(
meta
);
}
else
if
(
null
!=
metadata
&&
"3"
.
equals
(
metadata
.
get
(
"Type"
)))
{
Face
meta
=
JSON
.
toJavaObject
(
metadata
,
Face
.
class
);
meta
.
setId
(
traffpictureParam
.
getId
());
faceService
.
insertFace
(
meta
);
if
(
null
!=
meta
.
getFaceBoundingBox
())
{
traffpictureParam
.
setObjx
(
meta
.
getFaceBoundingBox
().
getX
()+
roiarray
[
0
].
intValue
());
traffpictureParam
.
setObjy
(
meta
.
getFaceBoundingBox
().
getY
()+
roiarray
[
1
].
intValue
());
traffpictureParam
.
setObjw
(
meta
.
getFaceBoundingBox
().
getW
());
traffpictureParam
.
setObjh
(
meta
.
getFaceBoundingBox
().
getH
());
}
if
(
null
!=
metadata
&&
metadata
.
get
(
"Type"
).
equals
(
model
))
{
//人骑车
//规定区域内出现告警对象
}
else
if
(
null
!=
metadata
&&
"4"
.
equals
(
metadata
.
get
(
"Type"
)))
{
setTraffpictureParam
(
recordtype
,
base64Encoder
,
transferRecord
,
traffpictureParam
);
PeopleRideBicyc
meta
=
JSON
.
toJavaObject
(
metadata
,
PeopleRideBicyc
.
class
);
if
(
"1"
.
equals
(
metadata
.
get
(
"Type"
)))
{
meta
.
setId
(
traffpictureParam
.
getId
());
//规定范围内检测到人
peopleridebicycService
.
insertPeopleRideBicyc
(
meta
);
Pedestrian
meta
=
JSON
.
toJavaObject
(
metadata
,
Pedestrian
.
class
);
meta
.
setId
(
traffpictureParam
.
getId
());
pedestrianService
.
insertpedestrian
(
meta
);
//新增到事件详情表返回主键
}
else
if
(
null
!=
metadata
&&
"2"
.
equals
(
metadata
.
get
(
"Type"
)))
{
//车辆
Traffic
meta
=
JSON
.
toJavaObject
(
metadata
,
Traffic
.
class
);
meta
.
setId
(
traffpictureParam
.
getId
());
//新增到车辆详情表
trafficService
.
insertTraffic
(
meta
);
}
else
if
(
null
!=
metadata
&&
"3"
.
equals
(
metadata
.
get
(
"Type"
)))
{
Face
meta
=
JSON
.
toJavaObject
(
metadata
,
Face
.
class
);
meta
.
setId
(
traffpictureParam
.
getId
());
faceService
.
insertFace
(
meta
);
if
(
null
!=
meta
.
getFaceBoundingBox
())
{
traffpictureParam
.
setObjx
(
meta
.
getFaceBoundingBox
().
getX
());
traffpictureParam
.
setObjy
(
meta
.
getFaceBoundingBox
().
getY
());
traffpictureParam
.
setObjw
(
meta
.
getFaceBoundingBox
().
getW
());
traffpictureParam
.
setObjh
(
meta
.
getFaceBoundingBox
().
getH
());
}
//人骑车
}
else
if
(
null
!=
metadata
&&
"4"
.
equals
(
metadata
.
get
(
"Type"
)))
{
PeopleRideBicyc
meta
=
JSON
.
toJavaObject
(
metadata
,
PeopleRideBicyc
.
class
);
meta
.
setId
(
traffpictureParam
.
getId
());
peopleridebicycService
.
insertPeopleRideBicyc
(
meta
);
}
//更新 traffpicture特征值
try
{
ByteArrayInputStream
bais
=
new
ByteArrayInputStream
(
base64Decoder
.
decodeBuffer
(
traffpictureParam
.
getImagedata
()));
BufferedImage
image
=
ImageIO
.
read
(
bais
);
Graphics
g
=
image
.
getGraphics
();
g
.
setColor
(
Color
.
RED
);
if
(
null
!=
traffpictureParam
.
getObjx
()
&&
null
!=
traffpictureParam
.
getObjy
()
&&
null
!=
traffpictureParam
.
getObjw
()
&&
null
!=
traffpictureParam
.
getObjh
())
g
.
drawRect
(
traffpictureParam
.
getObjx
(),
traffpictureParam
.
getObjy
(),
traffpictureParam
.
getObjw
(),
traffpictureParam
.
getObjh
());
ByteArrayOutputStream
stream
=
new
ByteArrayOutputStream
();
ImageIO
.
write
(
image
,
"png"
,
stream
);
//上传ftp
Ftp
ftp
=
ftpService
.
reloadFtp
();
String
ftputl
=
FTPUtil
.
getFtpUrl
(
ftp
)
+
basepath
+
"/"
+
traffpictureParam
.
getId
()
+
"/imgdata.png"
;
traffpictureParam
.
setImagedata
(
ftputl
);
FTPUtil
.
uploadFile
(
ftp
,
basepath
+
"/"
+
traffpictureParam
.
getId
(),
"imgdata.png"
,
base64Encoder
.
encode
(
stream
.
toByteArray
()));
}
catch
(
Exception
ex
)
{
logger
.
info
(
"base64画框异常:"
+
ex
.
toString
());
}
traffPictureService
.
updateTraffpicture
(
traffpictureParam
);
}
}
//更新 traffpicture特征值
try
{
ByteArrayInputStream
bais
=
new
ByteArrayInputStream
(
base64Decoder
.
decodeBuffer
(
traffpictureParam
.
getImagedata
()));
BufferedImage
image
=
ImageIO
.
read
(
bais
);
Graphics
g
=
image
.
getGraphics
();
g
.
setColor
(
Color
.
RED
);
if
(
null
!=
traffpictureParam
.
getObjx
()
&&
null
!=
traffpictureParam
.
getObjy
()
&&
null
!=
traffpictureParam
.
getObjw
()
&&
null
!=
traffpictureParam
.
getObjh
())
g
.
drawRect
(
traffpictureParam
.
getObjx
(),
traffpictureParam
.
getObjy
(),
traffpictureParam
.
getObjw
(),
traffpictureParam
.
getObjh
());
ByteArrayOutputStream
stream
=
new
ByteArrayOutputStream
();
ImageIO
.
write
(
image
,
"png"
,
stream
);
//上传ftp
Ftp
ftp
=
ftpService
.
reloadFtp
();
String
ftputl
=
FTPUtil
.
getFtpUrl
(
ftp
)
+
basepath
+
"/"
+
traffpictureParam
.
getId
()
+
"/imgdata.png"
;
traffpictureParam
.
setImagedata
(
ftputl
);
FTPUtil
.
uploadFile
(
ftp
,
basepath
+
"/"
+
traffpictureParam
.
getId
(),
"imgdata.png"
,
base64Encoder
.
encode
(
stream
.
toByteArray
()));
}
catch
(
Exception
ex
)
{
logger
.
info
(
"base64画框异常:"
+
ex
.
toString
());
}
traffPictureService
.
updateTraffpicture
(
traffpictureParam
);
}
//推送告警
//推送告警
WebSocket
.
GroupSending
(
JSONObject
.
toJSONString
(
traffpictureParam
));
WebSocket
.
GroupSending
(
JSONObject
.
toJSONString
(
traffpictureParam
));
}
}
}
}
}
}
catch
(
Exception
ex
)
{
//推送失败
transferRecord
.
setProcessstatus
(
"-3"
);
traffAlarmRecordService
.
updateTraffAlarmRecordProcess
(
transferRecord
);
}
}
}
}
return
ResultUtil
.
success
();
return
ResultUtil
.
success
();
}
else
{
}
else
{
...
...
src/main/java/com/cx/cn/cxquartz/controller/QuartzController.java
View file @
56a562b4
...
@@ -4,10 +4,14 @@ package com.cx.cn.cxquartz.controller;
...
@@ -4,10 +4,14 @@ package com.cx.cn.cxquartz.controller;
import
com.alibaba.fastjson.JSONObject
;
import
com.alibaba.fastjson.JSONObject
;
import
com.cx.cn.cxquartz.bean.QuartzTaskErrors
;
import
com.cx.cn.cxquartz.bean.QuartzTaskErrors
;
import
com.cx.cn.cxquartz.bean.QuartzTaskInformations
;
import
com.cx.cn.cxquartz.bean.QuartzTaskInformations
;
import
com.cx.cn.cxquartz.service.quartz.FtpService
;
import
com.cx.cn.cxquartz.service.quartz.QuartzService
;
import
com.cx.cn.cxquartz.service.quartz.QuartzService
;
import
com.cx.cn.cxquartz.service.quartz.SbtdspsrService
;
import
com.cx.cn.cxquartz.service.quartz.SbtdspsrService
;
import
com.cx.cn.cxquartz.util.FTPUtil
;
import
com.cx.cn.cxquartz.util.FileTransferManager
;
import
com.cx.cn.cxquartz.util.ResultEnum
;
import
com.cx.cn.cxquartz.util.ResultEnum
;
import
com.cx.cn.cxquartz.util.ResultUtil
;
import
com.cx.cn.cxquartz.util.ResultUtil
;
import
com.cx.cn.cxquartz.vo.Ftp
;
import
com.cx.cn.cxquartz.vo.QuartzTaskRecordsVo
;
import
com.cx.cn.cxquartz.vo.QuartzTaskRecordsVo
;
import
org.apache.commons.lang.StringUtils
;
import
org.apache.commons.lang.StringUtils
;
import
org.slf4j.Logger
;
import
org.slf4j.Logger
;
...
@@ -46,6 +50,9 @@ public class QuartzController {
...
@@ -46,6 +50,9 @@ public class QuartzController {
@Autowired
@Autowired
private
RestTemplate
restTemplate
;
private
RestTemplate
restTemplate
;
@Autowired
FtpService
ftpService
;
@RequestMapping
(
value
=
"/add/taskpage"
,
method
=
RequestMethod
.
GET
)
@RequestMapping
(
value
=
"/add/taskpage"
,
method
=
RequestMethod
.
GET
)
public
String
addTaskpage
()
{
public
String
addTaskpage
()
{
return
"addtask"
;
return
"addtask"
;
...
@@ -55,7 +62,7 @@ public class QuartzController {
...
@@ -55,7 +62,7 @@ public class QuartzController {
@RequestMapping
(
value
=
"/add/task"
,
method
=
RequestMethod
.
POST
)
@RequestMapping
(
value
=
"/add/task"
,
method
=
RequestMethod
.
POST
)
public
String
addTask
(
QuartzTaskInformations
taskInformations
)
{
public
String
addTask
(
QuartzTaskInformations
taskInformations
)
{
try
{
try
{
taskInformations
.
setSchedulerrule
(
"*/"
+
taskInformations
.
getSchedulerrule
()+
" * * * * ?"
);
taskInformations
.
setSchedulerrule
(
"*/"
+
taskInformations
.
getSchedulerrule
()
+
" * * * * ?"
);
String
result
=
quartzService
.
addTask
(
taskInformations
);
String
result
=
quartzService
.
addTask
(
taskInformations
);
return
result
;
return
result
;
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
...
@@ -67,7 +74,7 @@ public class QuartzController {
...
@@ -67,7 +74,7 @@ public class QuartzController {
@RequestMapping
(
value
=
"/edit/taskpage"
,
method
=
RequestMethod
.
GET
)
@RequestMapping
(
value
=
"/edit/taskpage"
,
method
=
RequestMethod
.
GET
)
public
String
editTaskpage
(
Model
model
,
String
id
)
{
public
String
editTaskpage
(
Model
model
,
String
id
)
{
QuartzTaskInformations
taskInformation
=
quartzService
.
getTaskById
(
id
);
QuartzTaskInformations
taskInformation
=
quartzService
.
getTaskById
(
id
);
taskInformation
.
setSchedulerrule
(
taskInformation
.
getSchedulerrule
().
replaceAll
(
"\\?"
,
""
).
replaceAll
(
"\\*"
,
""
).
replaceAll
(
"\\/"
,
""
));
taskInformation
.
setSchedulerrule
(
taskInformation
.
getSchedulerrule
().
replaceAll
(
"\\?"
,
""
).
replaceAll
(
"\\*"
,
""
).
replaceAll
(
"\\/"
,
""
));
model
.
addAttribute
(
"taskInformation"
,
taskInformation
);
model
.
addAttribute
(
"taskInformation"
,
taskInformation
);
return
"updatetask"
;
return
"updatetask"
;
}
}
...
@@ -76,11 +83,14 @@ public class QuartzController {
...
@@ -76,11 +83,14 @@ public class QuartzController {
@RequestMapping
(
value
=
"/edit/task"
,
method
=
RequestMethod
.
POST
)
@RequestMapping
(
value
=
"/edit/task"
,
method
=
RequestMethod
.
POST
)
public
String
editTask
(
QuartzTaskInformations
taskInformations
)
{
public
String
editTask
(
QuartzTaskInformations
taskInformations
)
{
try
{
try
{
taskInformations
.
setSchedulerrule
(
"*/"
+
taskInformations
.
getSchedulerrule
()+
" * * * * ?"
);
taskInformations
.
setSchedulerrule
(
"*/"
+
taskInformations
.
getSchedulerrule
()
+
" * * * * ?"
);
String
result
=
quartzService
.
updateTask
(
taskInformations
);
String
result
=
quartzService
.
updateTask
(
taskInformations
);
int
upresult
=
sbtdspsrService
.
updateRecogByRtsp
(
taskInformations
.
getRtsp
(),
taskInformations
.
getVideoid
());
if
(
null
!=
taskInformations
.
getExecuteparamter
()
&&
!
taskInformations
.
getExecuteparamter
().
contains
(
"rtsp:"
))
{
int
upresult
=
sbtdspsrService
.
updateRecogByRtsp
(
taskInformations
.
getRtsp
(),
taskInformations
.
getVideoid
());
if
(
upresult
>
0
)
{
if
(
upresult
>
0
)
{
logger
.
info
(
"更新sbtddspsr squrllj 的值为:"
+
taskInformations
.
getExecuteparamter
());
logger
.
info
(
"更新sbtddspsr squrllj 的值为:"
+
taskInformations
.
getExecuteparamter
());
}
}
}
return
result
;
return
result
;
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
...
@@ -177,33 +187,42 @@ public class QuartzController {
...
@@ -177,33 +187,42 @@ public class QuartzController {
return
"redirect:/"
;
return
"redirect:/"
;
}
}
}
}
@RequestMapping
(
value
=
"/getRtsp/{devicecode}"
,
method
=
RequestMethod
.
GET
)
@RequestMapping
(
value
=
"/getRtsp"
,
method
=
RequestMethod
.
POST
)
@ResponseBody
@ResponseBody
public
String
getRTSP
(
@
PathVariable
(
"devicecode"
)
String
devicecode
)
{
public
String
getRTSP
(
@
RequestBody
JSONObject
devicecode
)
{
//判断rtsp 是否过期http://212.129.142.17:8281/gh/device/test?deviceCode=3YSCA44445TFCPX
//判断rtsp 是否过期http://212.129.142.17:8281/gh/device/test?deviceCode=3YSCA44445TFCPX
//判断是否是rtsp 地址
String
rtspValue
=
devicecode
.
getString
(
"data"
);
if
(!
rtspValue
.
contains
(
"rtsp://"
))
{
Map
<
String
,
String
>
map
=
new
HashMap
<>();
map
.
put
(
"deviceCode"
,
rtspValue
);
ResponseEntity
<
String
>
responseEntity
=
restTemplate
.
getForEntity
(
getrtspbyurl
+
"?deviceCode={deviceCode}"
,
String
.
class
,
map
);
JSONObject
json
=
JSONObject
.
parseObject
(
responseEntity
.
getBody
());
if
(
null
!=
json
.
getString
(
"code"
)
&&
json
.
getString
(
"code"
).
equals
(
"0"
))
{
//返回rtsp 地址,更新 sbtdspsr 地址
rtspValue
=
String
.
valueOf
(
json
.
get
(
"obj"
));
}
}
Map
<
String
,
String
>
map
=
new
HashMap
<>();
//获得抽帧图片
map
.
put
(
"deviceCode"
,
devicecode
);
Map
maps
=
new
HashMap
<>();
ResponseEntity
<
String
>
responseEntity
=
restTemplate
.
getForEntity
(
getrtspbyurl
+
"?deviceCode={deviceCode}"
,
String
.
class
,
map
);
maps
.
put
(
"rtspvalue"
,
rtspValue
);
JSONObject
json
=
JSONObject
.
parseObject
(
responseEntity
.
getBody
());
maps
.
put
(
"refresh"
,
1
);
if
(
null
!=
json
.
getString
(
"code"
)
&&
json
.
getString
(
"code"
).
equals
(
"0"
))
{
try
{
//返回rtsp 地址,更新 sbtdspsr 地址
String
rtspValue
=
String
.
valueOf
(
json
.
get
(
"obj"
));
//获得抽帧图片
Map
maps
=
new
HashMap
<>();
maps
.
put
(
"rtspvalue"
,
rtspValue
);
maps
.
put
(
"refresh"
,
1
);
ResponseEntity
<
String
>
result
=
restTemplate
.
exchange
(
rtspurl
+
"?url={rtspvalue}&refresh={refresh}"
,
ResponseEntity
<
String
>
result
=
restTemplate
.
exchange
(
rtspurl
+
"?url={rtspvalue}&refresh={refresh}"
,
HttpMethod
.
GET
,
null
,
String
.
class
,
maps
);
HttpMethod
.
GET
,
null
,
String
.
class
,
maps
);
JSONObject
jsonresult
=
JSONObject
.
parseObject
(
result
.
getBody
());
JSONObject
jsonresult
=
JSONObject
.
parseObject
(
result
.
getBody
());
if
(
null
!=
jsonresult
.
getString
(
"ret"
)
&&
jsonresult
.
getString
(
"ret"
).
equals
(
"0"
))
{
if
(
null
!=
jsonresult
.
getString
(
"ret"
)
&&
jsonresult
.
getString
(
"ret"
).
equals
(
"0"
)
&&
!
""
.
equals
(
jsonresult
.
getString
(
"url"
))
)
{
//获得图片地址,存放到ftp上面
//获得图片地址,存放到ftp上面
return
ResultUtil
.
success
(
ResultEnum
.
SUCCESS
.
getCode
(),
jsonresult
.
getString
(
"url"
)+
","
+
json
.
get
(
"obj"
));
//将图片存储到ftp 上去,jsonresult.getString("url")
Ftp
ftp
=
ftpService
.
reloadFtp
();
String
ftpfilepath
=
FileTransferManager
.
urlTransToFtp
(
jsonresult
.
getString
(
"url"
),
ftp
,
"gstraff/picturedemo/"
);
return
ResultUtil
.
success
(
ResultEnum
.
SUCCESS
.
getCode
(),
jsonresult
.
getString
(
"url"
)+
","
+
rtspValue
);
}
}
}
else
{
return
ResultUtil
.
fail
();
logger
.
info
(
"未获取到监控rtsp"
);
}
catch
(
Exception
ex
)
{
return
ResultUtil
.
fail
();
}
}
return
ResultUtil
.
success
();
}
}
}
}
src/main/java/com/cx/cn/cxquartz/controller/SbtdspsrController.java
View file @
56a562b4
...
@@ -5,9 +5,11 @@ import com.cx.cn.cxquartz.bean.QuartzTaskErrors;
...
@@ -5,9 +5,11 @@ import com.cx.cn.cxquartz.bean.QuartzTaskErrors;
import
com.cx.cn.cxquartz.bean.QuartzTaskInformations
;
import
com.cx.cn.cxquartz.bean.QuartzTaskInformations
;
import
com.cx.cn.cxquartz.service.quartz.QuartzService
;
import
com.cx.cn.cxquartz.service.quartz.QuartzService
;
import
com.cx.cn.cxquartz.service.quartz.QuartzTaskRecordsService
;
import
com.cx.cn.cxquartz.service.quartz.QuartzTaskRecordsService
;
import
com.cx.cn.cxquartz.service.quartz.SbtdspsrService
;
import
com.cx.cn.cxquartz.util.ResultEnum
;
import
com.cx.cn.cxquartz.util.ResultEnum
;
import
com.cx.cn.cxquartz.util.ResultUtil
;
import
com.cx.cn.cxquartz.util.ResultUtil
;
import
com.cx.cn.cxquartz.vo.QuartzTaskRecordsVo
;
import
com.cx.cn.cxquartz.vo.QuartzTaskRecordsVo
;
import
com.cx.cn.cxquartz.vo.Sbtdspsr
;
import
org.apache.commons.lang.StringUtils
;
import
org.apache.commons.lang.StringUtils
;
import
org.slf4j.Logger
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.slf4j.LoggerFactory
;
...
@@ -28,7 +30,7 @@ public class SbtdspsrController {
...
@@ -28,7 +30,7 @@ public class SbtdspsrController {
private
static
final
Logger
logger
=
LoggerFactory
.
getLogger
(
SbtdspsrController
.
class
);
private
static
final
Logger
logger
=
LoggerFactory
.
getLogger
(
SbtdspsrController
.
class
);
@Autowired
@Autowired
private
QuartzService
quartz
Service
;
private
SbtdspsrService
sbtdspsr
Service
;
...
@@ -37,130 +39,11 @@ public class SbtdspsrController {
...
@@ -37,130 +39,11 @@ public class SbtdspsrController {
return
"addtask"
;
return
"addtask"
;
}
}
@ResponseBody
@RequestMapping
(
value
=
"/add/task"
,
method
=
RequestMethod
.
POST
)
public
String
addTask
(
QuartzTaskInformations
taskInformations
)
{
try
{
String
result
=
quartzService
.
addTask
(
taskInformations
);
return
result
;
}
catch
(
Exception
e
)
{
logger
.
error
(
"/add/task exception={}"
,
e
);
return
ResultUtil
.
fail
();
}
}
@RequestMapping
(
value
=
"/edit/taskpage"
,
method
=
RequestMethod
.
GET
)
public
String
editTaskpage
(
Model
model
,
String
id
)
{
QuartzTaskInformations
taskInformation
=
quartzService
.
getTaskById
(
id
);
model
.
addAttribute
(
"taskInformation"
,
taskInformation
);
return
"updatetask"
;
}
@ResponseBody
@RequestMapping
(
value
=
"/edit/task"
,
method
=
RequestMethod
.
POST
)
public
String
editTask
(
QuartzTaskInformations
taskInformations
)
{
try
{
QuartzTaskInformations
resultTaskInformations
=
quartzService
.
getTaskById
(
taskInformations
.
getTaskno
());
String
result
=
quartzService
.
updateTask
(
taskInformations
);
//判断corn 是否改变,改变重新生成任务
if
(!
resultTaskInformations
.
getSchedulerrule
().
equals
(
taskInformations
.
getSchedulerrule
()))
{
//重新启动,重新发布新的任务
quartzService
.
startJob
(
taskInformations
.
getTaskno
());
}
return
result
;
}
catch
(
Exception
e
)
{
logger
.
error
(
"/edit/task exception={}"
,
e
);
return
ResultUtil
.
fail
();
}
}
/**
@RequestMapping
(
value
=
"/list"
,
method
=
RequestMethod
.
GET
)
* 启动 或者 暂定定时任务
*
* @param taskNo
* @return
*/
@ResponseBody
@ResponseBody
@RequestMapping
(
value
=
"/list/optionjob"
,
method
=
RequestMethod
.
GET
)
public
List
<
Sbtdspsr
>
list
()
{
public
String
optionJob
(
String
taskNo
)
{
return
sbtdspsrService
.
list
();
logger
.
info
(
""
);
if
(
StringUtils
.
isEmpty
(
taskNo
))
{
return
ResultUtil
.
success
(
ResultEnum
.
PARAM_EMPTY
.
getCode
(),
ResultEnum
.
PARAM_EMPTY
.
getMessage
());
}
try
{
return
quartzService
.
startJob
(
taskNo
);
}
catch
(
Exception
e
)
{
logger
.
error
(
"/list/optionjob exception={}"
,
e
);
return
ResultUtil
.
fail
();
}
}
/**
* 定时任务执行情况
*
* @param taskNo
* @param model
* @return
*/
@RequestMapping
(
value
=
"/taskrecords"
,
method
=
RequestMethod
.
GET
)
public
String
taskRecordsPage
(
@RequestParam
(
value
=
"taskno"
,
required
=
false
)
String
taskNo
,
Model
model
)
{
logger
.
info
(
""
);
try
{
if
(
StringUtils
.
isEmpty
(
taskNo
))
{
return
"redirect:/"
;
}
List
<
QuartzTaskRecordsVo
>
quartzTaskRecords
=
quartzService
.
taskRecords
(
taskNo
);
model
.
addAttribute
(
"quartzTaskRecords"
,
quartzTaskRecords
);
}
catch
(
Exception
e
)
{
logger
.
error
(
""
);
return
"redirect:/"
;
}
return
"taskrecords"
;
}
/**
* 立即运行一次定时任务
*
* @param taskNo
* @param model
* @return
*/
@ResponseBody
@RequestMapping
(
value
=
"/runtask/rightnow"
,
method
=
RequestMethod
.
GET
)
public
String
runTaskRightNow
(
@RequestParam
(
value
=
"taskno"
,
required
=
false
)
String
taskNo
,
Model
model
)
{
logger
.
info
(
""
);
try
{
if
(
StringUtils
.
isEmpty
(
taskNo
))
{
return
ResultUtil
.
success
(
ResultEnum
.
PARAM_EMPTY
.
getCode
(),
ResultEnum
.
PARAM_EMPTY
.
getMessage
());
}
return
quartzService
.
runTaskRightNow
(
taskNo
);
}
catch
(
Exception
e
)
{
logger
.
error
(
""
);
return
ResultUtil
.
success
(
ResultEnum
.
FAIL
.
getCode
(),
ResultEnum
.
FAIL
.
getMessage
());
}
}
}
/**
* 定时任务失败详情
*
* @param recordId
* @param model
* @return
*/
@RequestMapping
(
value
=
"/task/errors"
,
method
=
RequestMethod
.
GET
)
public
String
detailTaskErrors
(
@RequestParam
(
value
=
"recordid"
,
required
=
false
)
String
recordId
,
Model
model
)
{
logger
.
info
(
""
);
try
{
if
(
StringUtils
.
isEmpty
(
recordId
))
{
return
ResultUtil
.
success
(
ResultEnum
.
PARAM_EMPTY
.
getCode
(),
ResultEnum
.
PARAM_EMPTY
.
getMessage
());
}
QuartzTaskErrors
taskErrors
=
quartzService
.
detailTaskErrors
(
recordId
);
model
.
addAttribute
(
"taskErrors"
,
taskErrors
);
return
"taskerrors"
;
}
catch
(
Exception
e
)
{
logger
.
error
(
""
);
return
"redirect:/"
;
}
}
}
}
src/main/java/com/cx/cn/cxquartz/dao/SbtdspsrMapper.java
View file @
56a562b4
...
@@ -11,7 +11,7 @@ import java.util.Map;
...
@@ -11,7 +11,7 @@ import java.util.Map;
@Mapper
@Mapper
public
interface
SbtdspsrMapper
{
public
interface
SbtdspsrMapper
{
List
<
Sbtdspsr
>
selectByRtsp
(
String
rtsp
);
List
<
Sbtdspsr
>
selectByRtsp
(
String
rtsp
);
List
<
Sbtdspsr
>
list
(
);
List
<
Map
>
selectRecogByRtsp
(
String
rtsp
);
List
<
Map
>
selectRecogByRtsp
(
String
rtsp
);
int
updateRecogByRtsp
(
Map
map
);
int
updateRecogByRtsp
(
Map
map
);
}
}
src/main/java/com/cx/cn/cxquartz/service/quartz/SbtdspsrService.java
View file @
56a562b4
...
@@ -9,4 +9,6 @@ public interface SbtdspsrService {
...
@@ -9,4 +9,6 @@ public interface SbtdspsrService {
List
<
Sbtdspsr
>
selectByRtsp
(
String
videoid
);
List
<
Sbtdspsr
>
selectByRtsp
(
String
videoid
);
List
<
Map
>
selectRecogByRtsp
(
String
rtsp
);
List
<
Map
>
selectRecogByRtsp
(
String
rtsp
);
int
updateRecogByRtsp
(
String
rtsp
,
String
devicecode
);
int
updateRecogByRtsp
(
String
rtsp
,
String
devicecode
);
List
<
Sbtdspsr
>
list
();
}
}
src/main/java/com/cx/cn/cxquartz/service/quartz/impl/SbtdspsrImpl.java
View file @
56a562b4
...
@@ -35,4 +35,9 @@ public class SbtdspsrImpl implements SbtdspsrService {
...
@@ -35,4 +35,9 @@ public class SbtdspsrImpl implements SbtdspsrService {
return
sbtdspsrMapper
.
updateRecogByRtsp
(
map
);
return
sbtdspsrMapper
.
updateRecogByRtsp
(
map
);
}
}
@Override
public
List
<
Sbtdspsr
>
list
()
{
return
sbtdspsrMapper
.
list
();
}
}
}
src/main/java/com/cx/cn/cxquartz/util/FileTransferManager.java
View file @
56a562b4
...
@@ -20,7 +20,7 @@ import java.util.concurrent.TimeUnit;
...
@@ -20,7 +20,7 @@ import java.util.concurrent.TimeUnit;
public
class
FileTransferManager
{
public
class
FileTransferManager
{
private
static
CompletionService
<
TransferResult
>
completionService
=
new
ExecutorCompletionService
<
TransferResult
>(
ThreadPoolUtil
.
getPool
());
private
static
CompletionService
<
TransferResult
>
completionService
=
new
ExecutorCompletionService
<
TransferResult
>(
ThreadPoolUtil
.
getPool
());
private
static
CompletionService
<
PictureResult
>
threadService
=
new
ExecutorCompletionService
<
PictureResult
>(
ThreadPoolUtil
.
getPool
());
private
static
CompletionService
<
String
>
threadService
=
new
ExecutorCompletionService
<
String
>(
ThreadPoolUtil
.
getPool
());
private
static
final
Logger
log
=
LoggerFactory
.
getLogger
(
ExtController
.
class
);
private
static
final
Logger
log
=
LoggerFactory
.
getLogger
(
ExtController
.
class
);
/**
/**
* @param transferRecord
* @param transferRecord
...
@@ -168,6 +168,36 @@ public class FileTransferManager {
...
@@ -168,6 +168,36 @@ public class FileTransferManager {
}
}
}
}
public
static
String
urlTransToFtp
(
String
url
,
final
Ftp
ftp
,
final
String
basePath
){
threadService
.
submit
(()
->
{
try
{
HttpURLConnection
connection
=
(
HttpURLConnection
)
new
URL
(
url
).
openConnection
();
connection
.
setReadTimeout
(
2000
);
//延迟连接
connection
.
setConnectTimeout
(
3000
);
connection
.
setRequestMethod
(
"GET"
);
if
(
connection
.
getResponseCode
()
==
HttpURLConnection
.
HTTP_OK
||
connection
.
getResponseCode
()==
HttpURLConnection
.
HTTP_NOT_MODIFIED
)
{
InputStream
inputStream
=
connection
.
getInputStream
();
String
pname
=
DateUtils
.
formatCurrDayNoSign
()
+
".jpg"
;
String
ftputl
=
FTPUtil
.
getFtpUrl
(
ftp
)
+
basePath
+
pname
;
boolean
r
=
FTPUtil
.
uploadFile
(
ftp
,
basePath
,
pname
,
inputStream
);
if
(
r
)
{
return
ftputl
;
}
}
else
{
log
.
error
(
"connection code: "
+
connection
.
getResponseCode
());
}
}
catch
(
IOException
e
)
{
System
.
out
.
println
(
e
.
toString
());
log
.
error
(
e
.
toString
());
}
return
url
;
});
try
{
return
threadService
.
poll
(
10
,
TimeUnit
.
SECONDS
).
get
();
}
catch
(
Exception
ex
){
return
url
;
}
}
}
}
src/main/java/com/cx/cn/cxquartz/util/RestTemplateConfig.java
View file @
56a562b4
...
@@ -16,8 +16,8 @@ public class RestTemplateConfig {
...
@@ -16,8 +16,8 @@ public class RestTemplateConfig {
@Bean
@Bean
public
ClientHttpRequestFactory
simpleClientHttpRequestFactory
(){
public
ClientHttpRequestFactory
simpleClientHttpRequestFactory
(){
SimpleClientHttpRequestFactory
factory
=
new
SimpleClientHttpRequestFactory
();
SimpleClientHttpRequestFactory
factory
=
new
SimpleClientHttpRequestFactory
();
factory
.
setConnectTimeout
(
15000
);
factory
.
setConnectTimeout
(
15000
0
);
factory
.
setReadTimeout
(
5
000
);
factory
.
setReadTimeout
(
150
000
);
return
factory
;
return
factory
;
}
}
}
}
src/main/java/com/cx/cn/cxquartz/vo/ImageList.java
View file @
56a562b4
...
@@ -10,11 +10,12 @@ public class ImageList {
...
@@ -10,11 +10,12 @@ public class ImageList {
private
Long
[]
Roi
;
private
Long
[]
Roi
;
private
Integer
RoiPadding
;
//
private Integer RoiPadding;
private
Integer
CropObjectImage
;
private
Integer
CropObjectImage
;
private
Integer
CropObjectImagePadding
;
private
Integer
CropObjectImagePadding
;
private
Integer
CropObjectImageQuality
;
private
Integer
CropObjectImageQuality
;
@JSONField
(
name
=
"Roi"
)
public
Long
[]
getRoi
()
{
public
Long
[]
getRoi
()
{
return
Roi
;
return
Roi
;
}
}
...
@@ -23,13 +24,13 @@ public class ImageList {
...
@@ -23,13 +24,13 @@ public class ImageList {
Roi
=
roi
;
Roi
=
roi
;
}
}
public
Integer
getRoiPadding
()
{
//
public Integer getRoiPadding() {
return
RoiPadding
;
//
return RoiPadding;
}
//
}
//
public
void
setRoiPadding
(
Integer
roiPadding
)
{
//
public void setRoiPadding(Integer roiPadding) {
RoiPadding
=
roiPadding
;
//
RoiPadding = roiPadding;
}
//
}
public
Integer
getCropObjectImage
()
{
public
Integer
getCropObjectImage
()
{
return
CropObjectImage
;
return
CropObjectImage
;
...
@@ -68,7 +69,7 @@ public class ImageList {
...
@@ -68,7 +69,7 @@ public class ImageList {
public
ImageList
(
String
imageID
,
Long
[]
roi
,
Integer
roiPadding
,
Integer
cropObjectImage
,
Integer
cropObjectImagePadding
,
Integer
cropObjectImageQuality
,
String
data
)
{
public
ImageList
(
String
imageID
,
Long
[]
roi
,
Integer
roiPadding
,
Integer
cropObjectImage
,
Integer
cropObjectImagePadding
,
Integer
cropObjectImageQuality
,
String
data
)
{
ImageID
=
imageID
;
ImageID
=
imageID
;
Roi
=
roi
;
Roi
=
roi
;
RoiPadding
=
roiPadding
;
//
RoiPadding = roiPadding;
CropObjectImage
=
cropObjectImage
;
CropObjectImage
=
cropObjectImage
;
CropObjectImagePadding
=
cropObjectImagePadding
;
CropObjectImagePadding
=
cropObjectImagePadding
;
CropObjectImageQuality
=
cropObjectImageQuality
;
CropObjectImageQuality
=
cropObjectImageQuality
;
...
...
src/main/java/com/cx/cn/cxquartz/vo/Output.java
View file @
56a562b4
...
@@ -6,22 +6,22 @@ import com.fasterxml.jackson.annotation.JsonIgnore;
...
@@ -6,22 +6,22 @@ import com.fasterxml.jackson.annotation.JsonIgnore;
public
class
Output
{
public
class
Output
{
private
int
SubClass
;
private
int
SubClass
;
//最大行人细类输出个数为1
//
//最大行人细类输出个数为1
@JsonIgnore
//
@JsonIgnore
private
int
MaxHumanSubClassNum
;
//
private int MaxHumanSubClassNum;
//
//最大车辆细类输出个数为输出全部
//
//最大车辆细类输出个数为输出全部
@JsonIgnore
//
@JsonIgnore
private
int
MaxVehicleSubClassNum
;
//
private int MaxVehicleSubClassNum;
//最大骑行细类输出个数为3
//
//最大骑行细类输出个数为3
@JsonIgnore
//
@JsonIgnore
private
int
MaxBikeSubClassNum
;
//
private int MaxBikeSubClassNum;
public
Output
(
int
subClass
,
int
maxHumanSubClassNum
,
int
maxVehicleSubClassNum
,
int
maxBikeSubClassNum
)
{
public
Output
(
int
subClass
,
int
maxHumanSubClassNum
,
int
maxVehicleSubClassNum
,
int
maxBikeSubClassNum
)
{
SubClass
=
subClass
;
SubClass
=
subClass
;
MaxHumanSubClassNum
=
maxHumanSubClassNum
;
//
MaxHumanSubClassNum = maxHumanSubClassNum;
MaxVehicleSubClassNum
=
maxVehicleSubClassNum
;
//
MaxVehicleSubClassNum = maxVehicleSubClassNum;
MaxBikeSubClassNum
=
maxBikeSubClassNum
;
//
MaxBikeSubClassNum = maxBikeSubClassNum;
}
}
public
void
setSubClass
(
int
SubClass
)
{
public
void
setSubClass
(
int
SubClass
)
{
...
@@ -32,31 +32,31 @@ public class Output {
...
@@ -32,31 +32,31 @@ public class Output {
public
int
getSubClass
()
{
public
int
getSubClass
()
{
return
this
.
SubClass
;
return
this
.
SubClass
;
}
}
//
public
void
setMaxHumanSubClassNum
(
int
MaxHumanSubClassNum
)
{
//
public void setMaxHumanSubClassNum(int MaxHumanSubClassNum) {
this
.
MaxHumanSubClassNum
=
MaxHumanSubClassNum
;
//
this.MaxHumanSubClassNum = MaxHumanSubClassNum;
}
//
}
//
@JSONField
(
name
=
"MaxHumanSubClassNum"
)
//
@JSONField(name = "MaxHumanSubClassNum")
public
int
getMaxHumanSubClassNum
()
{
//
public int getMaxHumanSubClassNum() {
return
this
.
MaxHumanSubClassNum
;
//
return this.MaxHumanSubClassNum;
}
//
}
//
public
void
setMaxVehicleSubClassNum
(
int
MaxVehicleSubClassNum
)
{
//
public void setMaxVehicleSubClassNum(int MaxVehicleSubClassNum) {
this
.
MaxVehicleSubClassNum
=
MaxVehicleSubClassNum
;
//
this.MaxVehicleSubClassNum = MaxVehicleSubClassNum;
}
//
}
//
@JSONField
(
name
=
"MaxVehicleSubClassNum"
)
//
@JSONField(name = "MaxVehicleSubClassNum")
public
int
getMaxVehicleSubClassNum
()
{
//
public int getMaxVehicleSubClassNum() {
return
this
.
MaxVehicleSubClassNum
;
//
return this.MaxVehicleSubClassNum;
}
//
}
//
public
void
setMaxBikeSubClassNum
(
int
MaxBikeSubClassNum
)
{
//
public void setMaxBikeSubClassNum(int MaxBikeSubClassNum) {
this
.
MaxBikeSubClassNum
=
MaxBikeSubClassNum
;
//
this.MaxBikeSubClassNum = MaxBikeSubClassNum;
}
//
}
//
@JSONField
(
name
=
"MaxBikeSubClassNum"
)
//
@JSONField(name = "MaxBikeSubClassNum")
public
int
getMaxBikeSubClassNum
()
{
//
public int getMaxBikeSubClassNum() {
return
this
.
MaxBikeSubClassNum
;
//
return this.MaxBikeSubClassNum;
}
//
}
}
}
src/main/java/com/cx/cn/cxquartz/vo/TraffpictureParam.java
View file @
56a562b4
...
@@ -68,6 +68,16 @@ public class TraffpictureParam extends Traffpicture {
...
@@ -68,6 +68,16 @@ public class TraffpictureParam extends Traffpicture {
@JsonIgnore
@JsonIgnore
private
Integer
objh
;
private
Integer
objh
;
private
String
metatype
;
public
String
getMetatype
()
{
return
metatype
;
}
public
void
setMetatype
(
String
metatype
)
{
this
.
metatype
=
metatype
;
}
public
Integer
getObjx
()
{
public
Integer
getObjx
()
{
return
objx
;
return
objx
;
}
}
...
...
src/main/resources/application.yml
View file @
56a562b4
...
@@ -38,15 +38,19 @@ spring:
...
@@ -38,15 +38,19 @@ spring:
enabled
:
true
enabled
:
true
encoding
:
UTF-8
encoding
:
UTF-8
mode
:
HTML
mode
:
HTML
redis
:
database
:
0
host
:
172.16.24.29
port
:
6379
#logging:
#logging:
# level:
# level:
# root:
# root:
# info
# info
logging
:
#
logging:
level
:
#
level:
com.cx.cn.cxquartz.dao
:
#
com.cx.cn.cxquartz.dao:
debug
#
debug
src/main/resources/file.properties
View file @
56a562b4
...
@@ -12,3 +12,4 @@ file.rtspurl=http://172.16.24.29:8081/getrealcamerasnapshot.php
...
@@ -12,3 +12,4 @@ file.rtspurl=http://172.16.24.29:8081/getrealcamerasnapshot.php
file.recogurl
=
http://172.16.24.29:9098/images/recog
file.recogurl
=
http://172.16.24.29:9098/images/recog
redis.cachekey.ftplist
=
gs:traff:global:cache:ftplist
redis.cachekey.ftplist
=
gs:traff:global:cache:ftplist
file.getrtspbyurl
=
http://212.129.142.17:8281/gh/device/test
file.getrtspbyurl
=
http://212.129.142.17:8281/gh/device/test
src/main/resources/mapper/QuartzTaskInformationsMapper.xml
View file @
56a562b4
...
@@ -59,7 +59,7 @@
...
@@ -59,7 +59,7 @@
taskName, schedulerRule, frozenStatus,
taskName, schedulerRule, frozenStatus,
executorNo, frozenTime, unfrozenTime,
executorNo, frozenTime, unfrozenTime,
createTime, lastModifyTime, sendType,
createTime, lastModifyTime, sendType,
url, executeParamter, timeKey,objectx,objecty,
p
bjectw,objecth,recordtype,metatype,
url, executeParamter, timeKey,objectx,objecty,
o
bjectw,objecth,recordtype,metatype,
rtsp,imgsrc,videoid
rtsp,imgsrc,videoid
)
)
values (#{id,jdbcType=BIGINT}, #{version,jdbcType=INTEGER}, #{taskno,jdbcType=VARCHAR},
values (#{id,jdbcType=BIGINT}, #{version,jdbcType=INTEGER}, #{taskno,jdbcType=VARCHAR},
...
@@ -70,9 +70,10 @@
...
@@ -70,9 +70,10 @@
#{executeparamter,jdbcType=VARCHAR}, #{timekey,jdbcType=VARCHAR}
#{executeparamter,jdbcType=VARCHAR}, #{timekey,jdbcType=VARCHAR}
, #{objectx,jdbcType=BIGINT}
, #{objectx,jdbcType=BIGINT}
, #{objecty,jdbcType=BIGINT}
, #{objecty,jdbcType=BIGINT}
, #{
p
bjectw,jdbcType=BIGINT}
, #{
o
bjectw,jdbcType=BIGINT}
, #{objecth,jdbcType=BIGINT}
, #{objecth,jdbcType=BIGINT}
, #{recordtype,jdbcType=VARCHAR}
, #{recordtype,jdbcType=VARCHAR}
, #{metatype,jdbcType=VARCHAR}
, #{rtsp,jdbcType=VARCHAR}
, #{rtsp,jdbcType=VARCHAR}
, #{imgsrc,jdbcType=VARCHAR}
, #{imgsrc,jdbcType=VARCHAR}
, #{videoid,jdbcType=VARCHAR}
, #{videoid,jdbcType=VARCHAR}
...
...
src/main/resources/mapper/SbtdspsrMapper.xml
View file @
56a562b4
...
@@ -5,18 +5,43 @@
...
@@ -5,18 +5,43 @@
<result
column=
"sbbh"
jdbcType=
"VARCHAR"
property=
"sbbh"
/>
<result
column=
"sbbh"
jdbcType=
"VARCHAR"
property=
"sbbh"
/>
<result
column=
"tdbh"
jdbcType=
"INTEGER"
property=
"tdbh"
/>
<result
column=
"tdbh"
jdbcType=
"INTEGER"
property=
"tdbh"
/>
<result
column=
"xzbh"
jdbcType=
"VARCHAR"
property=
"xzbh"
/>
<result
column=
"xzbh"
jdbcType=
"VARCHAR"
property=
"xzbh"
/>
<result
column=
"tdmc"
jdbcType=
"VARCHAR"
property=
"tdmc"
/>
</resultMap>
</resultMap>
<select
id=
"selectByRtsp"
parameterType=
"java.lang.String"
resultType=
"com.cx.cn.cxquartz.vo.Sbtdspsr"
>
<select
id=
"selectByRtsp"
parameterType=
"java.lang.String"
resultType=
"com.cx.cn.cxquartz.vo.Sbtdspsr"
>
select * from sbtdspsr where sbbh = #{videoid}
select * from sbtdspsr where sbbh = #{videoid}
or squrllj =#{rtsp}
</select>
</select>
<select
id=
"selectRecogByRtsp"
parameterType=
"java.lang.String"
resultType=
"java.util.HashMap"
>
<select
id=
"selectRecogByRtsp"
parameterType=
"java.lang.String"
resultType=
"java.util.HashMap"
>
select distinct metatype,recordtype ,objectx,objecty,objectw,objecth from quartz_task_informations where videoid=#{rtsp}
SELECT DISTINCT
metatype,
recordtype,
objectx,
objecty,
objectw,
objecth,(
SELECT
concat( sbbh, '_', tdbh )
FROM
sbtdspsr
WHERE squrllj =#{rtsp}
OR (
sbbh = substring_index( #{rtsp}, '_', 1 )
AND tdbh = substring_index( #{rtsp}, '_',- 1 ))) videoid
FROM
quartz_task_informations
WHERE
videoid =#{rtsp}
OR executeParamter =#{rtsp}
</select>
</select>
<update
id=
"updateRecogByRtsp"
parameterType=
"java.util.HashMap"
>
<update
id=
"updateRecogByRtsp"
parameterType=
"java.util.HashMap"
>
update sbtdspsr set squrllj= #{rtsp} where sbbh=#{devicecode}
update sbtdspsr set squrllj= #{rtsp} where sbbh=#{devicecode}
</update>
</update>
<select
id=
"list"
resultType=
"com.cx.cn.cxquartz.vo.Sbtdspsr"
>
select * from sbtdspsr
</select>
</mapper>
</mapper>
src/main/resources/mapper/TraffPictureMapper.xml
View file @
56a562b4
...
@@ -110,7 +110,7 @@
...
@@ -110,7 +110,7 @@
</select>
</select>
<update
id=
"updateTraffpicture"
>
<update
id=
"updateTraffpicture"
>
update traffpicture set objx=#{objx},objy=#{objy},objw=#{objw},objh=#{objh},imagedata=#{imagedata} where id=#{id}
update traffpicture set objx=#{objx},objy=#{objy},objw=#{objw},objh=#{objh},imagedata=#{imagedata}
,metatype=#{metatype}
where id=#{id}
</update>
</update>
...
...
src/main/resources/templates/addtask.html
View file @
56a562b4
...
@@ -19,6 +19,8 @@
...
@@ -19,6 +19,8 @@
</head>
</head>
<body>
<body>
<div
class=
"col-md-12 top-20 padding-0"
>
<div
class=
"col-md-12 top-20 padding-0"
>
<input
type=
"hidden"
value=
"false"
id=
"changewidthnot"
/>
<input
type=
"hidden"
value=
"false"
id=
"imgsrc"
/>
<div
class=
"col-md-12"
>
<div
class=
"col-md-12"
>
<div
class=
"panel"
>
<div
class=
"panel"
>
<div
class=
"panel-body"
>
<div
class=
"panel-body"
>
...
@@ -45,7 +47,7 @@
...
@@ -45,7 +47,7 @@
<div
class=
"form-group"
><label
<div
class=
"form-group"
><label
class=
"col-sm-2 control-label text-right"
>
间隔时间(秒):
</label>
class=
"col-sm-2 control-label text-right"
>
间隔时间(秒):
</label>
<div
class=
"col-sm-10"
>
<div
class=
"col-sm-10"
>
<input
type=
"number"
min=
"1"
max=
"
60
"
step=
"1"
<input
type=
"number"
min=
"1"
max=
"
59
"
step=
"1"
placeholder=
"间隔时间"
placeholder=
"间隔时间"
name=
"schedulerrule"
name=
"schedulerrule"
id=
"schedulerrule"
id=
"schedulerrule"
...
@@ -76,9 +78,11 @@
...
@@ -76,9 +78,11 @@
<div
class=
"form-group"
>
<div
class=
"form-group"
>
<div
class=
"col-sm-10"
>
<div
class=
"col-sm-10"
>
<input
type=
"text"
name=
"videoid"
<input
type=
"text"
name=
"videoid"
id=
"videoid"
class=
"form-control"
style=
"width:50%;float: left"
>
id=
"videoid"
class=
"form-control"
style=
"width:65%;float: left"
>
<a
id=
"getrtsp"
href=
" javascript:void(0)"
style=
"float: left;padding-left: 12px;padding-top: 10px;"
>
获得监控图片
</a>
<a
id=
"getrtsp"
href=
" javascript:void(0)"
<a
id=
"getwidth"
href=
" javascript:void(0)"
style=
"padding-left: 12px; padding-top: 10px;"
>
编辑监控范围
</a>
style=
"float: left;padding-left: 12px;padding-top: 10px;"
>
获得监控图片
</a>
<a
id=
"getwidth"
href=
" javascript:void(0)"
style=
"float: left;padding-left: 12px;padding-top: 10px;"
>
编辑监控范围
</a>
</div>
</div>
</div>
</div>
...
@@ -172,8 +176,375 @@
...
@@ -172,8 +176,375 @@
<canvas
id=
"draw-canvas"
width=
"600"
height=
"400"
<canvas
id=
"draw-canvas"
width=
"600"
height=
"400"
style=
"border:1px solid #d3d3d3; position: absolute; left: 50%; top: 100px;}"
>
style=
"border:1px solid #d3d3d3; position: absolute; left: 50%; top: 100px;}"
>
</canvas>
</canvas>
<script
type=
"text/javascript"
th:src=
"@{/js/canvasutil.js}"
></script>
<script
type=
"text/javascript"
th:inline=
"javascript"
>
<script
type=
"text/javascript"
th:inline=
"javascript"
>
class
DrawRectangle
{
constructor
(
id
,
options
)
{
this
.
canvas
=
document
.
getElementById
(
id
);
//canvas标签
this
.
ctx
=
this
.
canvas
.
getContext
(
'
2d
'
);
this
.
currentR
=
null
;
//单前点击的矩形框
this
.
startX
=
0
;
//开始X坐标
this
.
startY
=
0
;
//开始Y坐标
this
.
endX
=
0
;
// 结束X坐标
this
.
endY
=
0
;
// 结束Y坐标
this
.
layers
=
options
&&
options
.
layers
||
[];
//图层
this
.
optype
=
0
;
//op操作类型 0 无操作 1 画矩形框 2 拖动矩形框
this
.
scale
=
1
;
//放大倍数
this
.
scaleStep
=
1.05
;
//
this
.
flag
=
false
;
//是否点击鼠标的标志
this
.
type
=
0
;
//鼠标移动类型
this
.
topDistance
=
0
;
//
this
.
leftDistance
=
0
;
//
this
.
ratew
=
1
;
this
.
rateh
=
1
;
this
.
config
=
{
width
:
600
,
height
:
400
,
dashedColor
:
'
red
'
,
//虚线颜色
solidColor
:
'
red
'
,
//实线颜色
src
:
null
,
//图片的路径
}
if
(
options
)
{
for
(
const
key
in
options
)
{
this
.
config
[
key
]
=
options
[
key
]
}
}
this
.
setImageBackground
(
this
.
config
.
src
);
this
.
canvas
.
onmouseleave
=
()
=>
{
this
.
canvas
.
onmousedown
=
null
;
this
.
canvas
.
onmousemove
=
null
;
this
.
canvas
.
onmouseup
=
null
;
}
this
.
canvas
.
onmouseenter
=
()
=>
{
this
.
canvas
.
onmousedown
=
this
.
mousedown
.
bind
(
this
);
this
.
canvas
.
onmousemove
=
this
.
mousemove
.
bind
(
this
);
document
.
onmouseup
=
this
.
mouseup
.
bind
(
this
);
}
}
init
(
cvw
,
cvh
,
imgw
,
imgh
)
{
var
item
=
this
.
layers
[
1
];
this
.
ratew
=
cvw
/
imgw
;
this
.
rateh
=
cvh
/
imgh
;
this
.
ctx
.
beginPath
();
this
.
startX
=
(
item
.
x1
)
*
this
.
ratew
;
this
.
startY
=
(
item
.
y1
)
*
this
.
rateh
;
this
.
endX
=
(
item
.
x1
)
*
this
.
ratew
+
(
item
.
width
)
*
this
.
ratew
;
this
.
endY
=
(
item
.
y1
)
*
this
.
ratew
+
(
item
.
height
)
*
this
.
rateh
;
this
.
ctx
.
rect
(
this
.
startX
,
this
.
startY
,
(
item
.
width
)
*
this
.
ratew
,
(
item
.
height
)
*
this
.
rateh
);
// this.ctx.rect(item.x1, item.y1, item.width, item.height);
this
.
ctx
.
strokeStyle
=
item
.
strokeStyle
;
this
.
layers
.
splice
(
0
,
1
,
this
.
fixPosition
({
x1
:
Math
.
ceil
(
this
.
startX
),
y1
:
Math
.
ceil
(
this
.
startY
),
x2
:
Math
.
ceil
(
this
.
endX
),
y2
:
Math
.
ceil
(
this
.
endY
),
strokeStyle
:
this
.
config
.
solidColor
,
type
:
this
.
type
}));
console
.
log
(
`item`
,
item
)
this
.
ctx
.
stroke
();
console
.
log
(
`init:`
,
this
.
layers
);
}
//设置图片为canvas的背景
setImageBackground
(
src
)
{
const
img
=
new
Image
();
img
.
src
=
src
;
img
.
onload
=
()
=>
{
let
actImgW
=
img
.
width
,
actImgH
=
img
.
height
,
imgW
=
actImgW
,
imgH
=
actImgH
,
rate
=
1
,
left
=
0
,
top
=
0
,
canvasW
=
600
,
canvasH
=
400
;
//因为canvas画布的宽高固定,所以通过判断图片的宽高来进行缩放处理
if
(
actImgW
>
canvasW
||
actImgH
>
canvasH
)
{
if
(
actImgW
/
actImgH
>=
canvasW
/
canvasH
)
{
imgW
=
canvasW
;
rate
=
actImgW
/
canvasW
;
imgH
=
actImgH
/
rate
;
top
=
(
canvasH
-
imgH
)
/
2
;
}
else
{
imgH
=
canvasH
;
rate
=
actImgH
/
canvasH
;
imgW
=
actImgW
/
rate
;
left
=
(
canvasW
-
imgW
)
/
2
;
}
}
else
{
left
=
(
canvasW
-
imgW
)
/
2
;
top
=
(
canvasH
-
imgH
)
/
2
;
}
//this.ctx.drawImage(img, left, top, imgW, imgH);
//if (img.labelVos)
//drawRect(this.ctx, img, left, top, rate);
const
_this
=
this
;
//img.onload = ()=> {
_this
.
canvas
.
width
=
imgW
;
_this
.
canvas
.
height
=
imgH
;
_this
.
config
.
width
=
actImgW
;
_this
.
config
.
height
=
actImgH
;
_this
.
canvas
.
style
.
backgroundImage
=
"
url(
"
+
img
.
src
+
"
)
"
;
_this
.
canvas
.
style
.
backgroundSize
=
`
${
imgW
}
px
${
imgH
}
px`
;
_this
.
init
(
imgW
,
imgH
,
actImgW
,
actImgH
);
// }
}
}
//左侧拉伸展
resizeLeft
(
rect
)
{
this
.
canvas
.
style
.
cursor
=
"
w-resize
"
;
if
(
this
.
flag
&&
this
.
optype
==
0
)
{
this
.
optype
=
3
;
}
if
(
this
.
flag
&&
this
.
optype
==
3
)
{
if
(
!
this
.
currentR
)
{
this
.
currentR
=
rect
}
this
.
currentR
.
x1
=
this
.
endX
;
this
.
currentR
.
width
=
this
.
currentR
.
x2
-
this
.
currentR
.
x1
}
}
//上边框拉伸
resizeTop
(
rect
)
{
this
.
canvas
.
style
.
cursor
=
"
s-resize
"
;
if
(
this
.
flag
&&
this
.
optype
==
0
)
{
this
.
optype
=
4
;
}
if
(
this
.
flag
&&
this
.
optype
==
4
)
{
if
(
!
this
.
currentR
)
{
this
.
currentR
=
rect
}
this
.
currentR
.
y1
=
this
.
endY
;
this
.
currentR
.
height
=
this
.
currentR
.
y2
-
this
.
currentR
.
y1
;
}
}
resizeWidth
(
rect
)
{
this
.
canvas
.
style
.
cursor
=
"
w-resize
"
;
if
(
this
.
flag
&&
this
.
optype
==
0
)
{
this
.
optype
=
5
;
}
if
(
this
.
flag
&&
this
.
optype
==
5
)
{
if
(
!
this
.
currentR
)
{
this
.
currentR
=
rect
}
this
.
currentR
.
x2
=
this
.
endX
;
this
.
currentR
.
width
=
this
.
currentR
.
x2
-
this
.
currentR
.
x1
}
}
resizeHeight
(
rect
)
{
this
.
canvas
.
style
.
cursor
=
"
s-resize
"
;
if
(
this
.
flag
&&
this
.
optype
==
0
)
{
this
.
optype
=
6
;
}
if
(
this
.
flag
&&
this
.
optype
==
6
)
{
if
(
!
this
.
currentR
)
{
this
.
currentR
=
rect
}
this
.
currentR
.
y2
=
this
.
endY
;
this
.
currentR
.
height
=
this
.
currentR
.
y2
-
this
.
currentR
.
y1
;
}
}
resizeLT
(
rect
)
{
this
.
canvas
.
style
.
cursor
=
"
se-resize
"
;
if
(
this
.
flag
&&
this
.
optype
==
0
)
{
this
.
optype
=
7
;
}
if
(
this
.
flag
&&
this
.
optype
==
7
)
{
if
(
!
this
.
currentR
)
{
this
.
currentR
=
rect
}
this
.
currentR
.
x1
=
this
.
endX
;
this
.
currentR
.
y1
=
this
.
endY
;
this
.
currentR
.
height
=
this
.
currentR
.
y2
-
this
.
currentR
.
y1
;
this
.
currentR
.
width
=
this
.
currentR
.
x2
-
this
.
currentR
.
x1
;
}
}
resizeWH
(
rect
)
{
this
.
canvas
.
style
.
cursor
=
"
se-resize
"
;
if
(
this
.
flag
&&
this
.
optype
==
0
)
{
this
.
optype
=
8
;
}
if
(
this
.
flag
&&
this
.
optype
==
8
)
{
if
(
!
this
.
currentR
)
{
this
.
currentR
=
rect
}
this
.
currentR
.
x2
=
this
.
endX
;
this
.
currentR
.
y2
=
this
.
endY
;
this
.
currentR
.
height
=
this
.
currentR
.
y2
-
this
.
currentR
.
y1
;
this
.
currentR
.
width
=
this
.
currentR
.
x2
-
this
.
currentR
.
x1
;
}
}
resizeLH
(
rect
)
{
this
.
canvas
.
style
.
cursor
=
"
ne-resize
"
;
if
(
this
.
flag
&&
this
.
optype
==
0
)
{
this
.
optype
=
9
;
}
if
(
this
.
flag
&&
this
.
optype
==
9
)
{
if
(
!
this
.
currentR
)
{
this
.
currentR
=
rect
}
this
.
currentR
.
x1
=
this
.
endX
;
this
.
currentR
.
y2
=
this
.
endY
;
this
.
currentR
.
height
=
this
.
currentR
.
y2
-
this
.
currentR
.
y1
;
this
.
currentR
.
width
=
this
.
currentR
.
x2
-
this
.
currentR
.
x1
;
}
}
resizeWT
(
rect
)
{
this
.
canvas
.
style
.
cursor
=
"
ne-resize
"
;
if
(
this
.
flag
&&
this
.
optype
==
0
)
{
this
.
optype
=
10
;
}
if
(
this
.
flag
&&
this
.
optype
==
10
)
{
if
(
!
this
.
currentR
)
{
this
.
currentR
=
rect
}
this
.
currentR
.
x2
=
this
.
endX
;
this
.
currentR
.
y1
=
this
.
endY
;
this
.
currentR
.
height
=
this
.
currentR
.
y2
-
this
.
currentR
.
y1
this
.
currentR
.
width
=
this
.
currentR
.
x2
-
this
.
currentR
.
x1
}
}
reshow
(
x
,
y
,
changesmall
)
{
let
allNotIn
=
1
;
let
item
=
this
.
layers
[
0
];
this
.
ctx
.
beginPath
();
console
.
log
(
item
.
x1
);
this
.
ctx
.
rect
(
item
.
x1
,
item
.
y1
,
item
.
width
,
item
.
height
);
this
.
ctx
.
strokeStyle
=
item
.
strokeStyle
;
if
(
this
.
ctx
.
isPointInPath
(
x
*
this
.
scale
,
y
*
this
.
scale
))
{
this
.
render
(
item
);
allNotIn
=
0
;
}
this
.
ctx
.
stroke
();
if
(
this
.
flag
&&
allNotIn
&&
this
.
optype
<
3
)
{
this
.
optype
=
1
;
}
}
render
(
rect
)
{
this
.
canvas
.
style
.
cursor
=
"
move
"
;
if
(
this
.
flag
&&
this
.
optype
==
0
)
{
this
.
optype
=
2
;
}
if
(
this
.
flag
&&
this
.
optype
==
2
)
{
if
(
!
this
.
currentR
)
{
this
.
currentR
=
rect
}
this
.
currentR
.
x2
+=
this
.
endX
-
this
.
leftDistance
-
this
.
currentR
.
x1
;
this
.
currentR
.
x1
+=
this
.
endX
-
this
.
leftDistance
-
this
.
currentR
.
x1
;
this
.
currentR
.
y2
+=
this
.
endY
-
this
.
topDistance
-
this
.
currentR
.
y1
;
this
.
currentR
.
y1
+=
this
.
endY
-
this
.
topDistance
-
this
.
currentR
.
y1
;
}
}
isPointInRetc
(
x
,
y
)
{
let
len
=
this
.
layers
.
length
;
for
(
let
i
=
0
;
i
<
len
;
i
++
)
{
if
(
this
.
layers
[
i
].
x1
<
x
&&
x
<
this
.
layers
[
i
].
x2
&&
this
.
layers
[
i
].
y1
<
y
&&
y
<
this
.
layers
[
i
].
y2
)
{
return
this
.
layers
[
i
];
}
}
}
fixPosition
(
position
)
{
if
(
position
.
x1
>
position
.
x2
)
{
let
x
=
position
.
x1
;
position
.
x1
=
position
.
x2
;
position
.
x2
=
x
;
}
if
(
position
.
y1
>
position
.
y2
)
{
let
y
=
position
.
y1
;
position
.
y1
=
position
.
y2
;
position
.
y2
=
y
;
}
position
.
width
=
position
.
x2
-
position
.
x1
position
.
height
=
position
.
y2
-
position
.
y1
return
position
}
mousedown
(
e
)
{
if
(
$
(
"
#changewidthnot
"
).
val
()
==
"
1
"
)
{
this
.
startX
=
(
e
.
pageX
-
this
.
canvas
.
offsetLeft
)
/
this
.
scale
;
this
.
startY
=
(
e
.
pageY
-
this
.
canvas
.
offsetTop
)
/
this
.
scale
;
this
.
currentR
=
this
.
isPointInRetc
(
this
.
startX
,
this
.
startY
);
if
(
this
.
currentR
)
{
this
.
leftDistance
=
this
.
startX
-
this
.
currentR
.
x1
;
this
.
topDistance
=
this
.
startY
-
this
.
currentR
.
y1
;
}
this
.
ctx
.
strokeRect
(
this
.
endX
,
this
.
endY
,
0
,
0
);
this
.
ctx
.
strokeStyle
=
this
.
config
.
dashedColor
;
this
.
flag
=
1
;
}
}
mousemove
(
e
)
{
if
(
$
(
"
#changewidthnot
"
).
val
()
==
"
1
"
)
{
this
.
endX
=
(
e
.
pageX
-
this
.
canvas
.
offsetLeft
)
/
this
.
scale
;
this
.
endY
=
(
e
.
pageY
-
this
.
canvas
.
offsetTop
)
/
this
.
scale
;
// console.log(`mousemove`, this.endX, this.endY);
this
.
ctx
.
save
();
this
.
ctx
.
setLineDash
([
5
])
this
.
canvas
.
style
.
cursor
=
"
crosshair
"
;
this
.
ctx
.
clearRect
(
0
,
0
,
this
.
config
.
width
,
this
.
config
.
height
);
if
(
this
.
flag
&&
this
.
optype
==
1
)
{
this
.
ctx
.
strokeRect
(
this
.
startX
,
this
.
startY
,
this
.
endX
-
this
.
startX
,
this
.
endY
-
this
.
startY
);
}
this
.
ctx
.
restore
();
this
.
reshow
(
this
.
endX
,
this
.
endY
,
"
1
"
);
}
}
mouseup
(
e
)
{
if
(
$
(
"
#changewidthnot
"
).
val
()
==
"
1
"
)
{
if
(
this
.
optype
==
1
)
{
this
.
layers
.
splice
(
0
,
1
,
this
.
fixPosition
({
x1
:
this
.
startX
,
y1
:
this
.
startY
,
x2
:
this
.
endX
,
y2
:
this
.
endY
,
strokeStyle
:
this
.
config
.
solidColor
,
type
:
this
.
type
}))
var
ratew
=
this
.
config
.
width
/
this
.
canvas
.
width
;
var
rateh
=
this
.
config
.
height
/
this
.
canvas
.
height
;
this
.
layers
.
splice
(
1
,
1
,
this
.
fixPosition
({
x1
:
Math
.
ceil
(
this
.
startX
*
ratew
),
y1
:
Math
.
ceil
(
this
.
startY
*
rateh
),
x2
:
Math
.
ceil
(
this
.
endX
*
ratew
),
y2
:
Math
.
ceil
(
this
.
endY
*
rateh
),
strokeStyle
:
this
.
config
.
solidColor
,
type
:
this
.
type
}));
}
else
if
(
this
.
optype
>=
3
)
{
this
.
fixPosition
(
this
.
currentR
);
}
this
.
currentR
=
null
;
this
.
flag
=
0
;
this
.
reshow
(
this
.
endX
,
this
.
endY
);
this
.
optype
=
0
;
}
}
}
const
draw
=
new
DrawRectangle
(
'
draw-canvas
'
,
{
const
draw
=
new
DrawRectangle
(
'
draw-canvas
'
,
{
src
:
$
(
"
#imgsrc
"
).
val
(),
src
:
$
(
"
#imgsrc
"
).
val
(),
layers
:[{},
layers
:[{},
...
@@ -191,21 +562,26 @@
...
@@ -191,21 +562,26 @@
});
});
$
(
function
()
{
$
(
function
()
{
$
(
"
#getrtsp
"
).
on
(
'
click
'
,
function
(
e
)
{
$
(
"
#getrtsp
"
).
on
(
'
click
'
,
function
(
e
)
{
$
.
ajax
({
$
.
ajax
({
url
:
"
/quartz/getRtsp
/
"
+
$
(
"
#videoid
"
).
val
()
,
url
:
"
/quartz/getRtsp
"
,
dataType
:
"
json
"
,
dataType
:
"
json
"
,
type
:
"
get
"
,
type
:
"
post
"
,
contentType
:
'
application/json
'
,
data
:
JSON
.
stringify
({
data
:
$
(
"
#videoid
"
).
val
()}),
success
:
function
(
result
)
{
success
:
function
(
result
)
{
if
(
result
.
code
==
200
)
{
if
(
result
.
code
==
200
)
{
if
(
result
.
message
.
indexOf
(
"
,
"
)
>-
1
)
{
if
(
result
.
message
.
indexOf
(
"
,
"
)
>
-
1
)
{
$
(
"
#executeparamter
"
).
val
(
result
.
message
.
split
(
"
,
"
)[
1
]
);
$
(
"
#executeparamter
"
).
val
(
$
(
"
#videoid
"
).
val
()
+
"
_0
"
);
$
(
"
#rtsp
"
).
val
(
result
.
message
.
split
(
"
,
"
)[
1
]);
$
(
"
#rtsp
"
).
val
(
result
.
message
.
split
(
"
,
"
)[
1
]);
$
(
"
#imgsrc
"
).
val
(
result
.
message
.
split
(
"
,
"
)[
0
]);
$
(
"
#imgsrc
"
).
val
(
result
.
message
.
split
(
"
,
"
)[
0
]);
draw
.
src
=
result
.
message
.
split
(
"
,
"
)[
0
];
draw
.
src
=
result
.
message
.
split
(
"
,
"
)[
0
];
draw
.
setImageBackground
(
result
.
message
.
split
(
"
,
"
)[
0
]);
draw
.
setImageBackground
(
result
.
message
.
split
(
"
,
"
)[
0
]);
//draw.init();
}
}
}
}
else
{
alert
(
"
超时!
"
);
}
}
}
});
});
...
@@ -213,7 +589,17 @@
...
@@ -213,7 +589,17 @@
});
});
$
(
"
#getwidth
"
).
on
(
'
click
'
,
function
(
e
)
{
if
(
$
(
"
#changewidthnot
"
).
val
()
==
"
1
"
)
{
$
(
"
#changewidthnot
"
).
val
(
"
0
"
);
//$("#draw-canvas").style.cursor = "hand";
}
else
{
$
(
"
#changewidthnot
"
).
val
(
"
1
"
);
// $("#draw-canvas").style.cursor = "crosshair";
}
});
$
(
"
#savetask
"
).
on
(
'
click
'
,
function
(
e
)
{
$
(
"
#savetask
"
).
on
(
'
click
'
,
function
(
e
)
{
var
taskno
=
$
(
"
#taskno
"
).
val
();
var
taskno
=
$
(
"
#taskno
"
).
val
();
if
(
null
==
taskno
||
""
==
taskno
)
if
(
null
==
taskno
||
""
==
taskno
)
...
...
src/main/resources/templates/index.html
View file @
56a562b4
...
@@ -29,14 +29,13 @@
...
@@ -29,14 +29,13 @@
</div>
</div>
<div
class=
"col-md-6"
>
<div
class=
"col-md-6"
>
<div
class=
"col-lg-12"
>
<div
class=
"col-lg-12"
>
<form
action=
"/index"
>
<div
class=
"input-group"
>
<div
class=
"input-group"
>
<input
type=
"input"
class=
"form-control"
aria-label=
"..."
name
=
"name"
/>
<input
type=
"input"
class=
"form-control"
aria-label=
"..."
id
=
"name"
/>
<div
class=
"input-group-btn"
>
<div
class=
"input-group-btn"
>
<input
type=
"
submit
"
class=
"btn btn-3d btn-success"
style=
"box-shadow:none;background-color: #73B18D !important;width:70px;margin-left: 19px;"
value=
"search"
/>
<input
type=
"
button"
id=
"search"
onclick=
"dosearch()
"
class=
"btn btn-3d btn-success"
style=
"box-shadow:none;background-color: #73B18D !important;width:70px;margin-left: 19px;"
value=
"search"
/>
</div>
</div>
</div>
</div>
</form>
</div>
</div>
</div>
</div>
</div>
</div>
...
@@ -48,8 +47,7 @@
...
@@ -48,8 +47,7 @@
<th
style=
"text-align:center;vertical-align:middle;"
>
任务名称
</th>
<th
style=
"text-align:center;vertical-align:middle;"
>
任务名称
</th>
<th
style=
"text-align:center;vertical-align:middle;"
>
间隔时间(秒)
</th>
<th
style=
"text-align:center;vertical-align:middle;"
>
间隔时间(秒)
</th>
<th
style=
"text-align:center;vertical-align:middle;"
>
冻结状态
</th>
<th
style=
"text-align:center;vertical-align:middle;"
>
冻结状态
</th>
<th
style=
"text-align:center;vertical-align:middle;"
>
执行方
</th>
<th
style=
"text-align:center;vertical-align:middle;"
>
执行参数
</th>
<th
style=
"text-align:center;vertical-align:middle;"
>
执行方式
</th>
<th
style=
"text-align:center;vertical-align:middle;"
>
创建时间
</th>
<th
style=
"text-align:center;vertical-align:middle;"
>
创建时间
</th>
<th
style=
"text-align:center;vertical-align:middle;"
>
最后修改时间
</th>
<th
style=
"text-align:center;vertical-align:middle;"
>
最后修改时间
</th>
<th
style=
"text-align:center;vertical-align:middle;"
>
操作
</th>
<th
style=
"text-align:center;vertical-align:middle;"
>
操作
</th>
...
@@ -66,11 +64,8 @@
...
@@ -66,11 +64,8 @@
<span
th:if=
"${task.frozenstatus eq 'UNFROZEN'}"
>
未冻结
</span>
<span
th:if=
"${task.frozenstatus eq 'UNFROZEN'}"
>
未冻结
</span>
<span
th:if=
"${task.frozenstatus eq 'FROZEN'}"
style=
"color:red;"
>
已冻结
</span>
<span
th:if=
"${task.frozenstatus eq 'FROZEN'}"
style=
"color:red;"
>
已冻结
</span>
</td>
</td>
<td
th:text=
"${task.executorno}"
/>
<td
th:text=
"${task.executeparamter}"
/>
<td>
<span
th:if=
"${task.sendtype eq 'kafka'}"
>
kafka
</span>
<span
th:if=
"${task.sendtype eq 'http'}"
>
http
</span>
</td>
<td
th:text=
"${#dates.format(task.createtime,'yyyy-MM-dd HH:mm:ss')}"
/>
<td
th:text=
"${#dates.format(task.createtime,'yyyy-MM-dd HH:mm:ss')}"
/>
<td
th:text=
"${#dates.format(task.lastmodifytime,'yyyy-MM-dd HH:mm:ss')}"
/>
<td
th:text=
"${#dates.format(task.lastmodifytime,'yyyy-MM-dd HH:mm:ss')}"
/>
<td>
<td>
...
@@ -131,11 +126,12 @@
...
@@ -131,11 +126,12 @@
<script
type=
"text/javascript"
th:inline=
"javascript"
>
<script
type=
"text/javascript"
th:inline=
"javascript"
>
function
editpage
(
id
)
{
function
editpage
(
id
)
{
location
.
href
=
"
/quartz/edit/taskpage?id=
"
+
id
;
window
.
open
(
"
/quartz/edit/taskpage?id=
"
+
id
)
;
}
}
function
addNewTask
()
{
function
addNewTask
()
{
location
.
href
=
"
/quartz/add/taskpage/
"
;
window
.
open
(
"
/quartz/add/taskpage/
"
);
}
}
function
startOrStop
(
taskNo
)
{
function
startOrStop
(
taskNo
)
{
...
@@ -176,6 +172,29 @@
...
@@ -176,6 +172,29 @@
}
}
});
});
}
}
function
dosearch
(){
$
.
ajax
({
url
:
"
/quartz/list/optionjob?taskNo=
"
+
taskNo
,
type
:
"
GET
"
,
dataType
:
"
json
"
,
success
:
function
(
result
)
{
if
(
result
.
code
==
200
)
{
alert
(
"
success!
"
);
location
.
href
=
"
/
"
;
}
else
if
(
result
.
code
==
6001
)
{
alert
(
"
任务编号为空!
"
);
}
else
if
(
result
.
code
==
1003
)
{
alert
(
"
无此定时任务!
"
);
}
else
{
alert
(
"
system error!
"
);
}
}
});
}
</script>
</script>
</body>
</body>
</html>
</html>
src/main/resources/templates/updatetask.html
View file @
56a562b4
...
@@ -11,10 +11,12 @@
...
@@ -11,10 +11,12 @@
<link
rel=
"stylesheet"
type=
"text/css"
th:href=
"@{/css/red.css}"
/>
<link
rel=
"stylesheet"
type=
"text/css"
th:href=
"@{/css/red.css}"
/>
<link
rel=
"stylesheet"
type=
"text/css"
th:href=
"@{/css/simple-line-icons.css}"
/>
<link
rel=
"stylesheet"
type=
"text/css"
th:href=
"@{/css/simple-line-icons.css}"
/>
<link
rel=
"stylesheet"
type=
"text/css"
th:href=
"@{/css/style.css}"
/>
<link
rel=
"stylesheet"
type=
"text/css"
th:href=
"@{/css/style.css}"
/>
<style
type=
"text/css"
>
<style
type=
"text/css"
>
.col-sm-10
{
margin-bottom
:
10px
}
.col-sm-10
{
margin-bottom
:
10px
}
</style>
</style>
</head>
</head>
<body>
<body>
<div
class=
"col-md-12 top-20 padding-0"
>
<div
class=
"col-md-12 top-20 padding-0"
>
...
@@ -49,188 +51,191 @@
...
@@ -49,188 +51,191 @@
id=
"objecth"
/>
id=
"objecth"
/>
<input
type=
"hidden"
th:value=
"${taskInformation.imgsrc}"
name=
"imgsrc"
<input
type=
"hidden"
th:value=
"${taskInformation.imgsrc}"
name=
"imgsrc"
id=
"imgsrc"
/>
id=
"imgsrc"
/>
<input
type=
"hidden"
value=
"false"
name=
"
imgsrc
"
<input
type=
"hidden"
value=
"false"
name=
"
changewidthnot
"
id=
"changewidthnot"
/>
id=
"changewidthnot"
/>
<input
type=
"hidden"
th:value=
"${taskInformation.rtsp}"
name=
"rtsp"
<input
type=
"hidden"
th:value=
"${taskInformation.rtsp}"
name=
"rtsp"
id=
"rtsp"
/>
id=
"rtsp"
/>
<div
class=
"form-group"
><label
<div
class=
"form-group"
><label
class=
"col-sm-2 control-label text-right"
>
任务编号:
</label>
class=
"col-sm-2 control-label text-right"
>
任务编号:
</label>
<div
class=
"col-sm-10"
><input
type=
"text"
th:value=
"${taskInformation.taskno}"
<div
class=
"col-sm-10"
><input
type=
"text"
th:value=
"${taskInformation.taskno}"
name=
"taskno"
name=
"taskno"
id=
"taskno"
class=
"form-control"
>
id=
"taskno"
class=
"form-control"
>
</div>
</div>
</div>
</div>
<div
class=
"form-group"
><label
<div
class=
"form-group"
><label
class=
"col-sm-2 control-label text-right"
>
任务名称:
</label>
class=
"col-sm-2 control-label text-right"
>
任务描述:
</label>
<div
class=
"col-sm-10"
><input
type=
"text"
th:value=
"${taskInformation.taskname}"
<div
class=
"col-sm-10"
><input
type=
"text"
th:value=
"${taskInformation.taskname}"
name=
"taskname"
id=
"taskname"
name=
"taskname"
id=
"taskname"
class=
"form-control"
></div>
class=
"form-control"
></div>
</div>
</div>
<div
class=
"form-group"
><label
<div
class=
"form-group"
><label
class=
"col-sm-2 control-label text-right"
>
间隔时间(秒):
</label>
class=
"col-sm-2 control-label text-right"
>
间隔时间(秒):
</label>
<div
class=
"col-sm-10"
>
<div
class=
"col-sm-10"
>
<input
type=
"number"
min=
"1"
max=
"60"
step=
"1"
<input
type=
"number"
min=
"1"
max=
"59"
step=
"1"
placeholder=
"间隔时间"
placeholder=
"间隔时间"
name=
"schedulerrule"
name=
"schedulerrule"
th:value=
"${taskInformation.schedulerrule}"
th:value=
"${taskInformation.schedulerrule}"
id=
"schedulerrule"
id=
"schedulerrule"
class=
"form-control"
>
class=
"form-control"
>
</div>
</div>
</div>
</div>
<div
class=
"form-group"
><label
<div
class=
"form-group"
><label
class=
"col-sm-2 control-label text-right"
>
冻结状态:
</label>
class=
"col-sm-2 control-label text-right"
>
冻结状态:
</label>
<div
class=
"col-sm-10"
>
<div
class=
"col-sm-10"
>
<select
class=
"form-control"
id=
"frozenstatus"
>
<select
class=
"form-control"
id=
"frozenstatus"
>
<option
th:value=
"FROZEN"
<option
th:value=
"FROZEN"
th:selected=
"${taskInformation.frozenstatus == 'FROZEN'}"
>
th:selected=
"${taskInformation.frozenstatus == 'FROZEN'}"
>
冻结
冻结
</option>
</option>
<option
th:value=
"UNFROZEN"
<option
th:value=
"UNFROZEN"
th:selected=
"${taskInformation.frozenstatus == 'UNFROZEN'}"
>
解冻
th:selected=
"${taskInformation.frozenstatus == 'UNFROZEN'}"
>
解冻
</option>
</option>
</select>
</select>
</div>
</div>
</div>
</div>
<!--<td>-->
<!--<td>-->
<!--<div class="form-group"><label-->
<!--<div class="form-group"><label-->
<!--class="col-sm-2 control-label text-right">执行方:</label>-->
<!--class="col-sm-2 control-label text-right">执行方:</label>-->
<!--<div class="col-sm-10"><input type="text"-->
<!--<div class="col-sm-10"><input type="text"-->
<!--th:value="${taskInformation.executorno}"-->
<!--th:value="${taskInformation.executorno}"-->
<!--name="executorno" id="executorno"-->
<!--name="executorno" id="executorno"-->
<!--class="form-control"></div>-->
<!--class="form-control"></div>-->
<!--</div>-->
<!--</div>-->
<!--</td>-->
<!--</td>-->
<div
class=
"form-group"
><label
<div
class=
"form-group"
><label
class=
"col-sm-2 control-label text-right"
>
执行方式:
</label>
class=
"col-sm-2 control-label text-right"
>
执行方式:
</label>
<div
class=
"col-sm-10"
>
<div
class=
"col-sm-10"
>
<select
class=
"form-control"
id=
"sendtype"
>
<select
class=
"form-control"
id=
"sendtype"
>
<option
th:value=
"http"
<option
th:value=
"http"
th:selected=
"${taskInformation.sendtype == 'http'}"
>
http
th:selected=
"${taskInformation.sendtype == 'http'}"
>
http
</option>
</option>
<option
th:value=
"kafka"
<option
th:value=
"kafka"
th:selected=
"${taskInformation.sendtype == 'kafka'}"
>
th:selected=
"${taskInformation.sendtype == 'kafka'}"
>
kafka
kafka
</option>
</option>
</select>
</select>
</div>
</div>
</div>
</div>
<div
class=
"form-group"
><label
<div
class=
"form-group"
><label
class=
"col-sm-2 control-label text-right"
>
监控id:
</label>
class=
"col-sm-2 control-label text-right"
>
监控id:
</label>
</div>
</div>
<div
class=
"form-group"
>
<div
class=
"form-group"
>
<div
class=
"col-sm-10"
>
<div
class=
"col-sm-10"
>
<input
type=
"text"
name=
"videoid"
th:value=
"${taskInformation.videoid}"
<input
type=
"text"
name=
"videoid"
th:value=
"${taskInformation.videoid}"
id=
"videoid"
class=
"form-control"
style=
"width:50%;float: left"
>
id=
"videoid"
class=
"form-control"
style=
"width:65%;float: left"
>
<a
id=
"getrtsp"
href=
" javascript:void(0)"
style=
"float: left;padding-left: 12px;padding-top: 10px;"
>
获得监控图片
</a>
<a
id=
"getrtsp"
href=
" javascript:void(0)"
<a
id=
"getwidth"
href=
" javascript:void(0)"
style=
"padding-left: 12px; padding-top: 10px;"
>
编辑监控范围
</a>
style=
"float: left;padding-left: 12px;padding-top: 10px;"
>
获得监控图片
</a>
<a
id=
"getwidth"
href=
" javascript:void(0)"
</div>
style=
"float: left;padding-left: 12px;padding-top: 10px;"
>
编辑监控范围
</a>
</div>
<div
class=
"form-group"
><label
</div>
class=
"col-sm-2 control-label text-right"
>
事件类型:
</label>
</div>
<div
class=
"col-sm-10"
>
<div
class=
"form-group"
><label
<select
class=
"form-control"
id=
"metatype"
>
class=
"col-sm-2 control-label text-right"
>
事件类型:
</label>
<option
th:value=
"1"
th:selected=
"${taskInformation.metatype == '1'}"
>
<div
class=
"col-sm-10"
>
全目标
<select
class=
"form-control"
id=
"metatype"
>
</option>
<option
th:value=
"1"
th:selected=
"${taskInformation.metatype == '1'}"
>
<option
th:value=
"2"
th:selected=
"${taskInformation.metatype == '2'}"
>
全目标
行人、骑行、车辆检测识别
</option>
<option
th:value=
"2"
th:selected=
"${taskInformation.metatype == '2'}"
>
</option>
行人、骑行、车辆检测识别
<option
th:value=
"3"
th:selected=
"${taskInformation.metatype == '3'}"
>
人脸检测识别
</option>
</option>
<option
th:value=
"3"
th:selected=
"${taskInformation.metatype == '3'}"
>
人脸检测识别
<option
th:value=
"4"
th:selected=
"${taskInformation.metatype == '4'}"
>
</option>
单独行人、骑行检测识别
</option>
<option
th:value=
"4"
th:selected=
"${taskInformation.metatype == '4'}"
>
<option
th:value=
"5"
th:selected=
"${taskInformation.metatype == '5'}"
>
单独行人、骑行检测识别
单独车辆检测识别
</option>
</option>
<option
th:value=
"5"
th:selected=
"${taskInformation.metatype == '5'}"
>
<option
th:value=
"6"
th:selected=
"${taskInformation.metatype == '6'}"
>
单独车辆检测识别
人脸检测识别(不包含大类检测)
</option>
</option>
<option
th:value=
"6"
th:selected=
"${taskInformation.metatype == '6'}"
>
<option
th:value=
"7"
th:selected=
"${taskInformation.metatype == '7'}"
>
人脸检测识别(不包含大类检测)
行人、骑行、人脸
</option>
</option>
<option
th:value=
"7"
th:selected=
"${taskInformation.metatype == '7'}"
>
</select>
行人、骑行、人脸
</div>
</option>
</div>
</select>
</div>
<div
class=
"form-group"
><label
</div>
class=
"col-sm-2 control-label text-right"
>
告警类型:
</label>
<div
class=
"col-sm-10"
>
<div
class=
"form-group"
><label
<select
class=
"form-control"
id=
"recordtype"
>
class=
"col-sm-2 control-label text-right"
>
告警类型:
</label>
<option
th:value=
"1"
th:selected=
"${taskInformation.recordtype == '1'}"
>
<div
class=
"col-sm-10"
>
周界入侵
<select
class=
"form-control"
id=
"recordtype"
>
</option>
<option
th:value=
"1"
th:selected=
"${taskInformation.recordtype == '1'}"
>
<option
th:value=
"2"
th:selected=
"${taskInformation.recordtype == '2'}"
>
周界入侵
人群密度
</option>
</option>
<option
th:value=
"2"
th:selected=
"${taskInformation.recordtype == '2'}"
>
<option
th:value=
"3"
th:selected=
"${taskInformation.recordtype == '3'}"
>
人群密度
周界越线
</option>
</option>
<option
th:value=
"3"
th:selected=
"${taskInformation.recordtype == '3'}"
>
<option
th:value=
"4"
th:selected=
"${taskInformation.recordtype == '4'}"
>
周界越线
非机动车未戴头盔
</option>
</option>
<option
th:value=
"4"
th:selected=
"${taskInformation.recordtype == '4'}"
>
<option
th:value=
"5"
th:selected=
"${taskInformation.recordtype == '5'}"
>
非机动车未戴头盔
非机动车载人
</option>
</option>
<option
th:value=
"5"
th:selected=
"${taskInformation.recordtype == '5'}"
>
<option
th:value=
"6"
th:selected=
"${taskInformation.recordtype == '6'}"
>
非机动车载人
结构化统计
</option>
</option>
<option
th:value=
"6"
th:selected=
"${taskInformation.recordtype == '6'}"
>
</select>
结构化统计
</div>
</option>
</div>
</select>
</div>
<!--<div class="form-group"><label class="col-sm-2 control-label text-right">人群密度标准:</label>-->
</div>
<!--<div class="col-sm-10">-->
<!--<input type="text" th:value="${taskInformation.populationdensity}"-->
<!--<div class="form-group"><label class="col-sm-2 control-label text-right">人群密度标准:</label>-->
<!--name="executorno" id="populationdensity"-->
<!--<div class="col-sm-10">-->
<!--class="form-control">-->
<!--<input type="text" th:value="${taskInformation.populationdensity}"-->
<!--</div>-->
<!--name="executorno" id="populationdensity"-->
<!--</div>-->
<!--class="form-control">-->
<!--</div>-->
<div
class=
"form-group"
><label
<!--</div>-->
class=
"col-sm-2 control-label text-right"
>
url:
</label>
<div
class=
"form-group"
><label
<div
class=
"col-sm-10"
><input
type=
"text"
name=
"url"
class=
"col-sm-2 control-label text-right"
>
url:
</label>
th:value=
"${taskInformation.url}"
<div
class=
"col-sm-10"
><input
type=
"text"
name=
"url"
id=
"url"
class=
"form-control"
></div>
th:value=
"${taskInformation.url}"
</div>
id=
"url"
class=
"form-control"
></div>
</div>
<div
class=
"form-group"
><label
class=
"col-sm-2 control-label text-right"
>
执行参数:
</label>
<div
class=
"form-group"
><label
<div
class=
"col-sm-10"
><input
readonly
type=
"text"
name=
"executeparamter"
class=
"col-sm-2 control-label text-right"
>
执行参数:
</label>
th:value=
"${taskInformation.executeparamter}"
<div
class=
"col-sm-10"
><input
readonly
type=
"text"
name=
"executeparamter"
id=
"executeparamter"
th:value=
"${taskInformation.executeparamter}"
class=
"form-control"
></div>
id=
"executeparamter"
</div>
class=
"form-control"
>
</div>
<div
class=
"form-group"
><label
class=
"col-sm-2 control-label text-right"
>
timeKey:
</label>
<div
class=
"form-group"
><label
<div
class=
"col-sm-10"
><input
type=
"text"
class=
"col-sm-2 control-label text-right"
>
timeKey:
</label>
placeholder=
"(例如: yyyy-MM-dd HH:mm:ss)"
<div
class=
"col-sm-10"
><input
type=
"text"
name=
"timekey"
placeholder=
"(例如: yyyy-MM-dd HH:mm:ss)"
th:value=
"${taskInformation.timekey}"
name=
"timekey"
id=
"timekey"
class=
"form-control"
></div>
th:value=
"${taskInformation.timekey}"
</div>
id=
"timekey"
class=
"form-control"
></div>
</div>
<input
type=
"button"
class=
"btn btn-3d btn-warning"
th:onclick=
"'history.go(-1);'"
align=
"left"
style=
"float:left;margin-left:120px;box-shadow:none;background-color: #f26c4f !important;width:70px"
value=
"关闭"
/>
<input
type=
"button"
class=
"btn btn-3d btn-warning"
th:onclick=
"'history.go(-1);'"
<input
type=
"button"
class=
"btn btn-3d btn-success"
id=
"updatetask"
align=
"right"
style=
"box-shadow:none;background-color: #73B18D !important;width:70px"
value=
"保存"
/>
align=
"left"
style=
"float:left;margin-left:120px;box-shadow:none;background-color: #f26c4f !important;width:70px"
value=
"关闭"
/>
<input
type=
"button"
class=
"btn btn-3d btn-success"
id=
"updatetask"
align=
"right"
style=
"box-shadow:none;background-color: #73B18D !important;width:70px"
value=
"保存"
/>
</form>
</form>
<!--</div>-->
</div>
</div>
</div>
</div>
</div>
</div>
...
@@ -242,12 +247,12 @@
...
@@ -242,12 +247,12 @@
</canvas>
</canvas>
<script
type=
"text/javascript"
th:inline=
"javascript"
>
<script
type=
"text/javascript"
th:inline=
"javascript"
>
class
DrawRectangle
{
class
DrawRectangle
{
constructor
(
id
,
options
){
constructor
(
id
,
options
)
{
this
.
canvas
=
document
.
getElementById
(
id
);
//canvas标签
this
.
canvas
=
document
.
getElementById
(
id
);
//canvas标签
this
.
ctx
=
this
.
canvas
.
getContext
(
'
2d
'
);
this
.
ctx
=
this
.
canvas
.
getContext
(
'
2d
'
);
this
.
currentR
=
null
;
//单前点击的矩形框
this
.
currentR
=
null
;
//单前点击的矩形框
this
.
startX
=
0
;
//开始X坐标
this
.
startX
=
0
;
//开始X坐标
this
.
startY
=
0
;
//开始Y坐标
this
.
startY
=
0
;
//开始Y坐标
this
.
endX
=
0
;
// 结束X坐标
this
.
endX
=
0
;
// 结束X坐标
this
.
endY
=
0
;
// 结束Y坐标
this
.
endY
=
0
;
// 结束Y坐标
...
@@ -256,11 +261,11 @@
...
@@ -256,11 +261,11 @@
this
.
scale
=
1
;
//放大倍数
this
.
scale
=
1
;
//放大倍数
this
.
scaleStep
=
1.05
;
//
this
.
scaleStep
=
1.05
;
//
this
.
flag
=
false
;
//是否点击鼠标的标志
this
.
flag
=
false
;
//是否点击鼠标的标志
this
.
type
=
0
;
//鼠标移动类型
this
.
type
=
0
;
//鼠标移动类型
this
.
topDistance
=
0
;
//
this
.
topDistance
=
0
;
//
this
.
leftDistance
=
0
;
//
this
.
leftDistance
=
0
;
//
this
.
ratew
=
1
;
this
.
ratew
=
1
;
this
.
rateh
=
1
;
this
.
rateh
=
1
;
this
.
config
=
{
this
.
config
=
{
width
:
600
,
width
:
600
,
height
:
400
,
height
:
400
,
...
@@ -274,48 +279,51 @@
...
@@ -274,48 +279,51 @@
}
}
}
}
this
.
setImageBackground
(
this
.
config
.
src
);
this
.
setImageBackground
(
this
.
config
.
src
);
this
.
canvas
.
onmouseleave
=
()
=>
{
this
.
canvas
.
onmouseleave
=
()
=>
{
this
.
canvas
.
onmousedown
=
null
;
this
.
canvas
.
onmousedown
=
null
;
this
.
canvas
.
onmousemove
=
null
;
this
.
canvas
.
onmousemove
=
null
;
this
.
canvas
.
onmouseup
=
null
;
this
.
canvas
.
onmouseup
=
null
;
}
}
this
.
canvas
.
onmouseenter
=
()
=>
{
this
.
canvas
.
onmouseenter
=
()
=>
{
this
.
canvas
.
onmousedown
=
this
.
mousedown
.
bind
(
this
);
this
.
canvas
.
onmousedown
=
this
.
mousedown
.
bind
(
this
);
this
.
canvas
.
onmousemove
=
this
.
mousemove
.
bind
(
this
);
this
.
canvas
.
onmousemove
=
this
.
mousemove
.
bind
(
this
);
document
.
onmouseup
=
this
.
mouseup
.
bind
(
this
);
document
.
onmouseup
=
this
.
mouseup
.
bind
(
this
);
}
}
}
}
init
(
cvw
,
cvh
,
imgw
,
imgh
)
{
init
(
cvw
,
cvh
,
imgw
,
imgh
)
{
var
item
=
this
.
layers
[
1
];
var
item
=
this
.
layers
[
1
];
this
.
ratew
=
cvw
/
imgw
;
this
.
ratew
=
cvw
/
imgw
;
this
.
rateh
=
cvh
/
imgh
;
this
.
rateh
=
cvh
/
imgh
;
this
.
ctx
.
beginPath
();
this
.
ctx
.
beginPath
();
this
.
startX
=
(
item
.
x1
)
*
this
.
ratew
;
this
.
startX
=
(
item
.
x1
)
*
this
.
ratew
;
this
.
startY
=
(
item
.
y1
)
*
this
.
rateh
;
this
.
startY
=
(
item
.
y1
)
*
this
.
rateh
;
this
.
endX
=
(
item
.
x1
)
*
this
.
ratew
+
(
item
.
width
)
*
this
.
ratew
;
this
.
endX
=
(
item
.
x1
)
*
this
.
ratew
+
(
item
.
width
)
*
this
.
ratew
;
this
.
endY
=
(
item
.
y1
)
*
this
.
ratew
+
(
item
.
height
)
*
this
.
rateh
;
this
.
endY
=
(
item
.
y1
)
*
this
.
ratew
+
(
item
.
height
)
*
this
.
rateh
;
this
.
ctx
.
rect
(
this
.
startX
,
this
.
startY
,
(
item
.
width
)
*
this
.
ratew
,
(
item
.
height
)
*
this
.
rateh
);
this
.
ctx
.
rect
(
this
.
startX
,
this
.
startY
,
(
item
.
width
)
*
this
.
ratew
,
(
item
.
height
)
*
this
.
rateh
);
// this.ctx.rect(item.x1, item.y1, item.width, item.height);
// this.ctx.rect(item.x1, item.y1, item.width, item.height);
this
.
ctx
.
strokeStyle
=
item
.
strokeStyle
;
this
.
ctx
.
strokeStyle
=
item
.
strokeStyle
;
this
.
layers
.
splice
(
0
,
1
,
this
.
fixPosition
({
this
.
layers
.
splice
(
0
,
1
,
this
.
fixPosition
({
x1
:
Math
.
ceil
(
this
.
startX
),
x1
:
Math
.
ceil
(
this
.
startX
),
y1
:
Math
.
ceil
(
this
.
startY
),
y1
:
Math
.
ceil
(
this
.
startY
),
x2
:
Math
.
ceil
(
this
.
endX
),
x2
:
Math
.
ceil
(
this
.
endX
),
y2
:
Math
.
ceil
(
this
.
endY
),
y2
:
Math
.
ceil
(
this
.
endY
),
strokeStyle
:
this
.
config
.
solidColor
,
strokeStyle
:
this
.
config
.
solidColor
,
type
:
this
.
type
type
:
this
.
type
}));
}));
console
.
log
(
`item`
,
item
)
console
.
log
(
`item`
,
item
)
this
.
ctx
.
stroke
();
this
.
ctx
.
stroke
();
console
.
log
(
`init:`
,
this
.
layers
);
console
.
log
(
`init:`
,
this
.
layers
);
}
}
//设置图片为canvas的背景
//设置图片为canvas的背景
setImageBackground
(
src
){
setImageBackground
(
src
)
{
const
img
=
new
Image
();
const
img
=
new
Image
();
img
.
src
=
src
;
img
.
src
=
src
;
img
.
onload
=
()
=>
{
img
.
onload
=
()
=>
{
let
let
actImgW
=
img
.
width
,
actImgW
=
img
.
width
,
actImgH
=
img
.
height
,
actImgH
=
img
.
height
,
...
@@ -324,8 +332,8 @@
...
@@ -324,8 +332,8 @@
rate
=
1
,
rate
=
1
,
left
=
0
,
left
=
0
,
top
=
0
,
top
=
0
,
canvasW
=
600
,
canvasW
=
600
,
canvasH
=
400
;
canvasH
=
400
;
//因为canvas画布的宽高固定,所以通过判断图片的宽高来进行缩放处理
//因为canvas画布的宽高固定,所以通过判断图片的宽高来进行缩放处理
if
(
actImgW
>
canvasW
||
actImgH
>
canvasH
)
{
if
(
actImgW
>
canvasW
||
actImgH
>
canvasH
)
{
if
(
actImgW
/
actImgH
>=
canvasW
/
canvasH
)
{
if
(
actImgW
/
actImgH
>=
canvasW
/
canvasH
)
{
...
@@ -354,7 +362,7 @@
...
@@ -354,7 +362,7 @@
_this
.
config
.
height
=
actImgH
;
_this
.
config
.
height
=
actImgH
;
_this
.
canvas
.
style
.
backgroundImage
=
"
url(
"
+
img
.
src
+
"
)
"
;
_this
.
canvas
.
style
.
backgroundImage
=
"
url(
"
+
img
.
src
+
"
)
"
;
_this
.
canvas
.
style
.
backgroundSize
=
`
${
imgW
}
px
${
imgH
}
px`
;
_this
.
canvas
.
style
.
backgroundSize
=
`
${
imgW
}
px
${
imgH
}
px`
;
_this
.
init
(
imgW
,
imgH
,
actImgW
,
actImgH
);
_this
.
init
(
imgW
,
imgH
,
actImgW
,
actImgH
);
// }
// }
...
@@ -362,11 +370,15 @@
...
@@ -362,11 +370,15 @@
}
}
//左侧拉伸展
//左侧拉伸展
resizeLeft
(
rect
)
{
resizeLeft
(
rect
)
{
this
.
canvas
.
style
.
cursor
=
"
w-resize
"
;
this
.
canvas
.
style
.
cursor
=
"
w-resize
"
;
if
(
this
.
flag
&&
this
.
optype
==
0
)
{
this
.
optype
=
3
;
}
if
(
this
.
flag
&&
this
.
optype
==
0
)
{
this
.
optype
=
3
;
}
if
(
this
.
flag
&&
this
.
optype
==
3
)
{
if
(
this
.
flag
&&
this
.
optype
==
3
)
{
if
(
!
this
.
currentR
)
{
this
.
currentR
=
rect
}
if
(
!
this
.
currentR
)
{
this
.
currentR
=
rect
}
this
.
currentR
.
x1
=
this
.
endX
;
this
.
currentR
.
x1
=
this
.
endX
;
this
.
currentR
.
width
=
this
.
currentR
.
x2
-
this
.
currentR
.
x1
this
.
currentR
.
width
=
this
.
currentR
.
x2
-
this
.
currentR
.
x1
}
}
...
@@ -375,9 +387,13 @@
...
@@ -375,9 +387,13 @@
//上边框拉伸
//上边框拉伸
resizeTop
(
rect
)
{
resizeTop
(
rect
)
{
this
.
canvas
.
style
.
cursor
=
"
s-resize
"
;
this
.
canvas
.
style
.
cursor
=
"
s-resize
"
;
if
(
this
.
flag
&&
this
.
optype
==
0
)
{
this
.
optype
=
4
;
}
if
(
this
.
flag
&&
this
.
optype
==
0
)
{
this
.
optype
=
4
;
}
if
(
this
.
flag
&&
this
.
optype
==
4
)
{
if
(
this
.
flag
&&
this
.
optype
==
4
)
{
if
(
!
this
.
currentR
)
{
this
.
currentR
=
rect
}
if
(
!
this
.
currentR
)
{
this
.
currentR
=
rect
}
this
.
currentR
.
y1
=
this
.
endY
;
this
.
currentR
.
y1
=
this
.
endY
;
this
.
currentR
.
height
=
this
.
currentR
.
y2
-
this
.
currentR
.
y1
;
this
.
currentR
.
height
=
this
.
currentR
.
y2
-
this
.
currentR
.
y1
;
}
}
...
@@ -385,9 +401,13 @@
...
@@ -385,9 +401,13 @@
resizeWidth
(
rect
)
{
resizeWidth
(
rect
)
{
this
.
canvas
.
style
.
cursor
=
"
w-resize
"
;
this
.
canvas
.
style
.
cursor
=
"
w-resize
"
;
if
(
this
.
flag
&&
this
.
optype
==
0
)
{
this
.
optype
=
5
;
}
if
(
this
.
flag
&&
this
.
optype
==
0
)
{
this
.
optype
=
5
;
}
if
(
this
.
flag
&&
this
.
optype
==
5
)
{
if
(
this
.
flag
&&
this
.
optype
==
5
)
{
if
(
!
this
.
currentR
)
{
this
.
currentR
=
rect
}
if
(
!
this
.
currentR
)
{
this
.
currentR
=
rect
}
this
.
currentR
.
x2
=
this
.
endX
;
this
.
currentR
.
x2
=
this
.
endX
;
this
.
currentR
.
width
=
this
.
currentR
.
x2
-
this
.
currentR
.
x1
this
.
currentR
.
width
=
this
.
currentR
.
x2
-
this
.
currentR
.
x1
}
}
...
@@ -395,9 +415,13 @@
...
@@ -395,9 +415,13 @@
resizeHeight
(
rect
)
{
resizeHeight
(
rect
)
{
this
.
canvas
.
style
.
cursor
=
"
s-resize
"
;
this
.
canvas
.
style
.
cursor
=
"
s-resize
"
;
if
(
this
.
flag
&&
this
.
optype
==
0
)
{
this
.
optype
=
6
;
}
if
(
this
.
flag
&&
this
.
optype
==
0
)
{
this
.
optype
=
6
;
}
if
(
this
.
flag
&&
this
.
optype
==
6
)
{
if
(
this
.
flag
&&
this
.
optype
==
6
)
{
if
(
!
this
.
currentR
)
{
this
.
currentR
=
rect
}
if
(
!
this
.
currentR
)
{
this
.
currentR
=
rect
}
this
.
currentR
.
y2
=
this
.
endY
;
this
.
currentR
.
y2
=
this
.
endY
;
this
.
currentR
.
height
=
this
.
currentR
.
y2
-
this
.
currentR
.
y1
;
this
.
currentR
.
height
=
this
.
currentR
.
y2
-
this
.
currentR
.
y1
;
}
}
...
@@ -405,9 +429,13 @@
...
@@ -405,9 +429,13 @@
resizeLT
(
rect
)
{
resizeLT
(
rect
)
{
this
.
canvas
.
style
.
cursor
=
"
se-resize
"
;
this
.
canvas
.
style
.
cursor
=
"
se-resize
"
;
if
(
this
.
flag
&&
this
.
optype
==
0
)
{
this
.
optype
=
7
;
}
if
(
this
.
flag
&&
this
.
optype
==
0
)
{
this
.
optype
=
7
;
}
if
(
this
.
flag
&&
this
.
optype
==
7
)
{
if
(
this
.
flag
&&
this
.
optype
==
7
)
{
if
(
!
this
.
currentR
)
{
this
.
currentR
=
rect
}
if
(
!
this
.
currentR
)
{
this
.
currentR
=
rect
}
this
.
currentR
.
x1
=
this
.
endX
;
this
.
currentR
.
x1
=
this
.
endX
;
this
.
currentR
.
y1
=
this
.
endY
;
this
.
currentR
.
y1
=
this
.
endY
;
this
.
currentR
.
height
=
this
.
currentR
.
y2
-
this
.
currentR
.
y1
;
this
.
currentR
.
height
=
this
.
currentR
.
y2
-
this
.
currentR
.
y1
;
...
@@ -417,9 +445,13 @@
...
@@ -417,9 +445,13 @@
resizeWH
(
rect
)
{
resizeWH
(
rect
)
{
this
.
canvas
.
style
.
cursor
=
"
se-resize
"
;
this
.
canvas
.
style
.
cursor
=
"
se-resize
"
;
if
(
this
.
flag
&&
this
.
optype
==
0
)
{
this
.
optype
=
8
;
}
if
(
this
.
flag
&&
this
.
optype
==
0
)
{
this
.
optype
=
8
;
}
if
(
this
.
flag
&&
this
.
optype
==
8
)
{
if
(
this
.
flag
&&
this
.
optype
==
8
)
{
if
(
!
this
.
currentR
)
{
this
.
currentR
=
rect
}
if
(
!
this
.
currentR
)
{
this
.
currentR
=
rect
}
this
.
currentR
.
x2
=
this
.
endX
;
this
.
currentR
.
x2
=
this
.
endX
;
this
.
currentR
.
y2
=
this
.
endY
;
this
.
currentR
.
y2
=
this
.
endY
;
this
.
currentR
.
height
=
this
.
currentR
.
y2
-
this
.
currentR
.
y1
;
this
.
currentR
.
height
=
this
.
currentR
.
y2
-
this
.
currentR
.
y1
;
...
@@ -429,9 +461,13 @@
...
@@ -429,9 +461,13 @@
resizeLH
(
rect
)
{
resizeLH
(
rect
)
{
this
.
canvas
.
style
.
cursor
=
"
ne-resize
"
;
this
.
canvas
.
style
.
cursor
=
"
ne-resize
"
;
if
(
this
.
flag
&&
this
.
optype
==
0
)
{
this
.
optype
=
9
;
}
if
(
this
.
flag
&&
this
.
optype
==
0
)
{
this
.
optype
=
9
;
}
if
(
this
.
flag
&&
this
.
optype
==
9
)
{
if
(
this
.
flag
&&
this
.
optype
==
9
)
{
if
(
!
this
.
currentR
)
{
this
.
currentR
=
rect
}
if
(
!
this
.
currentR
)
{
this
.
currentR
=
rect
}
this
.
currentR
.
x1
=
this
.
endX
;
this
.
currentR
.
x1
=
this
.
endX
;
this
.
currentR
.
y2
=
this
.
endY
;
this
.
currentR
.
y2
=
this
.
endY
;
this
.
currentR
.
height
=
this
.
currentR
.
y2
-
this
.
currentR
.
y1
;
this
.
currentR
.
height
=
this
.
currentR
.
y2
-
this
.
currentR
.
y1
;
...
@@ -441,9 +477,13 @@
...
@@ -441,9 +477,13 @@
resizeWT
(
rect
)
{
resizeWT
(
rect
)
{
this
.
canvas
.
style
.
cursor
=
"
ne-resize
"
;
this
.
canvas
.
style
.
cursor
=
"
ne-resize
"
;
if
(
this
.
flag
&&
this
.
optype
==
0
)
{
this
.
optype
=
10
;
}
if
(
this
.
flag
&&
this
.
optype
==
0
)
{
this
.
optype
=
10
;
}
if
(
this
.
flag
&&
this
.
optype
==
10
)
{
if
(
this
.
flag
&&
this
.
optype
==
10
)
{
if
(
!
this
.
currentR
)
{
this
.
currentR
=
rect
}
if
(
!
this
.
currentR
)
{
this
.
currentR
=
rect
}
this
.
currentR
.
x2
=
this
.
endX
;
this
.
currentR
.
x2
=
this
.
endX
;
this
.
currentR
.
y1
=
this
.
endY
;
this
.
currentR
.
y1
=
this
.
endY
;
this
.
currentR
.
height
=
this
.
currentR
.
y2
-
this
.
currentR
.
y1
this
.
currentR
.
height
=
this
.
currentR
.
y2
-
this
.
currentR
.
y1
...
@@ -451,9 +491,9 @@
...
@@ -451,9 +491,9 @@
}
}
}
}
reshow
(
x
,
y
,
changesmall
)
{
reshow
(
x
,
y
,
changesmall
)
{
let
allNotIn
=
1
;
let
allNotIn
=
1
;
let
item
=
this
.
layers
[
0
];
let
item
=
this
.
layers
[
0
];
this
.
ctx
.
beginPath
();
this
.
ctx
.
beginPath
();
console
.
log
(
item
.
x1
);
console
.
log
(
item
.
x1
);
this
.
ctx
.
rect
(
item
.
x1
,
item
.
y1
,
item
.
width
,
item
.
height
);
this
.
ctx
.
rect
(
item
.
x1
,
item
.
y1
,
item
.
width
,
item
.
height
);
...
@@ -470,12 +510,16 @@
...
@@ -470,12 +510,16 @@
render
(
rect
)
{
render
(
rect
)
{
this
.
canvas
.
style
.
cursor
=
"
move
"
;
this
.
canvas
.
style
.
cursor
=
"
move
"
;
if
(
this
.
flag
&&
this
.
optype
==
0
)
{
this
.
optype
=
2
;
}
if
(
this
.
flag
&&
this
.
optype
==
0
)
{
this
.
optype
=
2
;
}
if
(
this
.
flag
&&
this
.
optype
==
2
)
{
if
(
this
.
flag
&&
this
.
optype
==
2
)
{
if
(
!
this
.
currentR
)
{
this
.
currentR
=
rect
}
if
(
!
this
.
currentR
)
{
this
.
currentR
=
rect
}
this
.
currentR
.
x2
+=
this
.
endX
-
this
.
leftDistance
-
this
.
currentR
.
x1
;
this
.
currentR
.
x2
+=
this
.
endX
-
this
.
leftDistance
-
this
.
currentR
.
x1
;
this
.
currentR
.
x1
+=
this
.
endX
-
this
.
leftDistance
-
this
.
currentR
.
x1
;
this
.
currentR
.
x1
+=
this
.
endX
-
this
.
leftDistance
-
this
.
currentR
.
x1
;
this
.
currentR
.
y2
+=
this
.
endY
-
this
.
topDistance
-
this
.
currentR
.
y1
;
this
.
currentR
.
y2
+=
this
.
endY
-
this
.
topDistance
-
this
.
currentR
.
y1
;
this
.
currentR
.
y1
+=
this
.
endY
-
this
.
topDistance
-
this
.
currentR
.
y1
;
this
.
currentR
.
y1
+=
this
.
endY
-
this
.
topDistance
-
this
.
currentR
.
y1
;
}
}
}
}
...
@@ -505,9 +549,9 @@
...
@@ -505,9 +549,9 @@
return
position
return
position
}
}
mousedown
(
e
){
mousedown
(
e
)
{
if
(
$
(
"
#changewidthnot
"
).
val
()
==
"
1
"
)
{
if
(
$
(
"
#changewidthnot
"
).
val
()
==
"
1
"
)
{
this
.
startX
=
(
e
.
pageX
-
this
.
canvas
.
offsetLeft
)
/
this
.
scale
;
this
.
startX
=
(
e
.
pageX
-
this
.
canvas
.
offsetLeft
)
/
this
.
scale
;
this
.
startY
=
(
e
.
pageY
-
this
.
canvas
.
offsetTop
)
/
this
.
scale
;
this
.
startY
=
(
e
.
pageY
-
this
.
canvas
.
offsetTop
)
/
this
.
scale
;
this
.
currentR
=
this
.
isPointInRetc
(
this
.
startX
,
this
.
startY
);
this
.
currentR
=
this
.
isPointInRetc
(
this
.
startX
,
this
.
startY
);
if
(
this
.
currentR
)
{
if
(
this
.
currentR
)
{
...
@@ -520,8 +564,8 @@
...
@@ -520,8 +564,8 @@
}
}
}
}
mousemove
(
e
){
mousemove
(
e
)
{
if
(
$
(
"
#changewidthnot
"
).
val
()
==
"
1
"
)
{
if
(
$
(
"
#changewidthnot
"
).
val
()
==
"
1
"
)
{
this
.
endX
=
(
e
.
pageX
-
this
.
canvas
.
offsetLeft
)
/
this
.
scale
;
this
.
endX
=
(
e
.
pageX
-
this
.
canvas
.
offsetLeft
)
/
this
.
scale
;
this
.
endY
=
(
e
.
pageY
-
this
.
canvas
.
offsetTop
)
/
this
.
scale
;
this
.
endY
=
(
e
.
pageY
-
this
.
canvas
.
offsetTop
)
/
this
.
scale
;
// console.log(`mousemove`, this.endX, this.endY);
// console.log(`mousemove`, this.endX, this.endY);
...
@@ -570,25 +614,37 @@
...
@@ -570,25 +614,37 @@
}
}
}
}
}
}
const
draw
=
new
DrawRectangle
(
'
draw-canvas
'
,
{
const
draw
=
new
DrawRectangle
(
'
draw-canvas
'
,
{
src
:
$
(
"
#imgsrc
"
).
val
(),
src
:
$
(
"
#imgsrc
"
).
val
(),
layers
:[{},
layers
:
[{},
{
{
"
x1
"
:
parseInt
(
$
(
"
#objectx
"
).
val
()),
"
x1
"
:
parseInt
(
$
(
"
#objectx
"
).
val
()),
"
y1
"
:
parseInt
(
$
(
"
#objecty
"
).
val
()),
"
y1
"
:
parseInt
(
$
(
"
#objecty
"
).
val
()),
"
x2
"
:
parseInt
(
$
(
"
#objectx
"
).
val
())
+
parseInt
(
$
(
"
#objectw
"
).
val
()),
"
x2
"
:
parseInt
(
$
(
"
#objectx
"
).
val
())
+
parseInt
(
$
(
"
#objectw
"
).
val
()),
"
y2
"
:
parseInt
(
$
(
"
#objecty
"
).
val
())
+
parseInt
(
$
(
"
#objecth
"
).
val
()),
"
y2
"
:
parseInt
(
$
(
"
#objecty
"
).
val
())
+
parseInt
(
$
(
"
#objecth
"
).
val
()),
"
width
"
:
parseInt
(
$
(
"
#objectw
"
).
val
()),
"
width
"
:
parseInt
(
$
(
"
#objectw
"
).
val
()),
"
height
"
:
parseInt
(
$
(
"
#objecth
"
).
val
()),
"
height
"
:
parseInt
(
$
(
"
#objecth
"
).
val
()),
"
strokeStyle
"
:
"
red
"
,
"
strokeStyle
"
:
"
red
"
,
"
type
"
:
0
"
type
"
:
0
}
}
]
]
});
});
$
(
function
()
{
$
(
function
()
{
//查询所有监控
$
.
ajax
({
url
:
"
/video/list
"
,
dataType
:
"
json
"
,
type
:
"
get
"
,
success
:
function
(
result
)
{
console
.
log
(
result
);
}
});
$
(
"
#getwidth
"
).
on
(
'
click
'
,
function
(
e
)
{
$
(
"
#getwidth
"
).
on
(
'
click
'
,
function
(
e
)
{
if
(
$
(
"
#changewidthnot
"
).
val
()
==
"
1
"
)
{
if
(
$
(
"
#changewidthnot
"
).
val
()
==
"
1
"
)
{
$
(
"
#changewidthnot
"
).
val
(
"
0
"
);
$
(
"
#changewidthnot
"
).
val
(
"
0
"
);
// $("#draw-canvas").style.cursor = "hand";
// $("#draw-canvas").style.cursor = "hand";
}
}
...
@@ -600,25 +656,31 @@
...
@@ -600,25 +656,31 @@
});
});
$
(
"
#getrtsp
"
).
on
(
'
click
'
,
function
(
e
)
{
$
(
"
#getrtsp
"
).
on
(
'
click
'
,
function
(
e
)
{
$
.
ajax
({
$
.
ajax
({
url
:
"
/quartz/getRtsp/
"
+
$
(
"
#videoid
"
).
val
(),
url
:
"
/quartz/getRtsp
"
,
dataType
:
"
json
"
,
dataType
:
"
json
"
,
type
:
"
get
"
,
type
:
"
post
"
,
success
:
function
(
result
)
{
contentType
:
'
application/json
'
,
if
(
result
.
code
==
200
)
{
data
:
JSON
.
stringify
({
data
:
$
(
"
#videoid
"
).
val
()}),
if
(
result
.
message
.
indexOf
(
"
,
"
)
>-
1
){
success
:
function
(
result
)
{
$
(
"
#executeparamter
"
).
val
(
$
(
"
#videoid
"
).
val
());
if
(
result
.
code
==
200
)
{
$
(
"
#rtsp
"
).
val
(
result
.
message
.
split
(
"
,
"
)[
1
]);
if
(
result
.
message
.
indexOf
(
"
,
"
)
>
-
1
)
{
$
(
"
#imgsrc
"
).
val
(
result
.
message
.
split
(
"
,
"
)[
0
]);
$
(
"
#executeparamter
"
).
val
(
$
(
"
#videoid
"
).
val
());
draw
.
src
=
result
.
message
.
split
(
"
,
"
)[
0
];
$
(
"
#rtsp
"
).
val
(
result
.
message
.
split
(
"
,
"
)[
1
]);
draw
.
setImageBackground
(
result
.
message
.
split
(
"
,
"
)[
0
]);
$
(
"
#imgsrc
"
).
val
(
result
.
message
.
split
(
"
,
"
)[
0
]);
//draw.init();
draw
.
src
=
result
.
message
.
split
(
"
,
"
)[
0
];
}
draw
.
setImageBackground
(
result
.
message
.
split
(
"
,
"
)[
0
]);
}
//draw.init();
}
}
});
}
else
{
alert
(
"
超时!
"
);
}
},
error
:
function
(
result
)
{
alert
(
"
超时!
"
);
}
});
});
});
...
@@ -659,15 +721,15 @@
...
@@ -659,15 +721,15 @@
"
lastmodifytime
"
:
lastmodifytime
,
"
lastmodifytime
"
:
lastmodifytime
,
"
frozentime
"
:
frozentime
,
"
frozentime
"
:
frozentime
,
"
unfrozentime
"
:
unfrozentime
,
"
unfrozentime
"
:
unfrozentime
,
"
objectx
"
:
object
.
x1
,
"
objectx
"
:
object
.
x1
,
"
objecty
"
:
object
.
y1
,
"
objecty
"
:
object
.
y1
,
"
objectw
"
:
object
.
width
,
"
objectw
"
:
object
.
width
,
"
objecth
"
:
object
.
height
,
"
objecth
"
:
object
.
height
,
"
recordtype
"
:
$
(
"
#recordtype
"
).
val
(),
"
recordtype
"
:
$
(
"
#recordtype
"
).
val
(),
"
metatype
"
:
$
(
"
#metatype
"
).
val
(),
"
metatype
"
:
$
(
"
#metatype
"
).
val
(),
"
rtsp
"
:
$
(
"
#rtsp
"
).
val
(),
"
rtsp
"
:
$
(
"
#rtsp
"
).
val
(),
"
imgsrc
"
:
$
(
"
#imgsrc
"
).
val
(),
"
imgsrc
"
:
$
(
"
#imgsrc
"
).
val
(),
"
videoid
"
:
$
(
"
#videoid
"
).
val
()
"
videoid
"
:
$
(
"
#videoid
"
).
val
()
},
},
success
:
function
(
result
)
{
success
:
function
(
result
)
{
...
@@ -686,9 +748,6 @@
...
@@ -686,9 +748,6 @@
});
});
</script>
</script>
</body>
</body>
</html>
</html>
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