Commit 37a7ec1c authored by yzm's avatar yzm

bug

parent fb73cb9a
...@@ -33,6 +33,11 @@ public class IndexController { ...@@ -33,6 +33,11 @@ public class IndexController {
try { try {
List<QuartzTaskInformations> taskList = quartzService.getTaskList(taskNo, currentPage); List<QuartzTaskInformations> taskList = quartzService.getTaskList(taskNo, currentPage);
for(QuartzTaskInformations task:taskList)
{
task.setSchedulerrule(task.getSchedulerrule().replaceAll("\\?","").replaceAll("\\*","").replaceAll("\\/",""));
}
int current = Integer.parseInt(currentPage); int current = Integer.parseInt(currentPage);
Page<QuartzTaskInformations> page = new Page(taskList, taskList.size(), current); Page<QuartzTaskInformations> page = new Page(taskList, taskList.size(), current);
model.addAttribute("taskList", taskList); model.addAttribute("taskList", taskList);
......
...@@ -5,6 +5,7 @@ import com.alibaba.fastjson.JSONObject; ...@@ -5,6 +5,7 @@ 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.QuartzService; import com.cx.cn.cxquartz.service.quartz.QuartzService;
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;
...@@ -39,6 +40,9 @@ public class QuartzController { ...@@ -39,6 +40,9 @@ public class QuartzController {
@Value("${file.rtspurl}") @Value("${file.rtspurl}")
private String rtspurl; private String rtspurl;
@Autowired
private SbtdspsrService sbtdspsrService;
@Autowired @Autowired
private RestTemplate restTemplate; private RestTemplate restTemplate;
...@@ -51,6 +55,7 @@ public class QuartzController { ...@@ -51,6 +55,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()+" * * * * ?");
String result = quartzService.addTask(taskInformations); String result = quartzService.addTask(taskInformations);
return result; return result;
} catch (Exception e) { } catch (Exception e) {
...@@ -62,6 +67,7 @@ public class QuartzController { ...@@ -62,6 +67,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("\\/",""));
model.addAttribute("taskInformation", taskInformation); model.addAttribute("taskInformation", taskInformation);
return "updatetask"; return "updatetask";
} }
...@@ -70,7 +76,12 @@ public class QuartzController { ...@@ -70,7 +76,12 @@ 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()+" * * * * ?");
String result = quartzService.updateTask(taskInformations); String result = quartzService.updateTask(taskInformations);
int upresult = sbtdspsrService.updateRecogByRtsp(taskInformations.getRtsp(), taskInformations.getVideoid());
if (upresult > 0) {
logger.info("更新sbtddspsr squrllj 的值为:"+taskInformations.getExecuteparamter());
}
return result; return result;
} catch (Exception e) { } catch (Exception e) {
logger.error("/edit/task exception={}", e); logger.error("/edit/task exception={}", e);
...@@ -173,27 +184,26 @@ public class QuartzController { ...@@ -173,27 +184,26 @@ public class QuartzController {
Map<String, String> map = new HashMap<>(); Map<String, String> map = new HashMap<>();
map.put("deviceCode", devicecode); map.put("deviceCode", devicecode);
ResponseEntity<String> responseEntity = restTemplate.getForEntity("http://212.129.142.17:8281/gh/device/test?deviceCode={deviceCode}", String.class, map); ResponseEntity<String> responseEntity = restTemplate.getForEntity(getrtspbyurl+"?deviceCode={deviceCode}", String.class, map);
// ResponseEntity<String> exchange = restTemplate.exchange(getrtspbyurl + "?deviceCode={deviceCode}",
// HttpMethod.GET, null, String.class, map);
JSONObject json = JSONObject.parseObject(responseEntity.getBody()); JSONObject json = JSONObject.parseObject(responseEntity.getBody());
if (null != json.getString("code") && json.getString("code").equals("0")) { if (null != json.getString("code") && json.getString("code").equals("0")) {
//返回rtsp 地址 //返回rtsp 地址,更新 sbtdspsr 地址
String rtspValue=String.valueOf( json.get("obj"));
//获得抽帧图片 //获得抽帧图片
Map maps = new HashMap<>(); Map maps = new HashMap<>();
maps.put("rtspvalue",String.valueOf( json.get("obj"))); maps.put("rtspvalue",rtspValue);
maps.put("refresh",1); 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")) {
//获得图片地址 //获得图片地址,存放到ftp上面
return ResultUtil.success( ResultEnum.SUCCESS.getCode(),jsonresult.getString("url")+","+json.get("obj")); return ResultUtil.success( ResultEnum.SUCCESS.getCode(),jsonresult.getString("url")+","+json.get("obj"));
} }
} else { } else {
logger.info("未获取到监控rtsp"); logger.info("未获取到监控rtsp");
} }
logger.error("rtsp 不存在-->"); return ResultUtil.success();
return ResultUtil.fail();
} }
} }
...@@ -42,8 +42,6 @@ public class SbtdspsrController { ...@@ -42,8 +42,6 @@ public class SbtdspsrController {
public String addTask(QuartzTaskInformations taskInformations) { public String addTask(QuartzTaskInformations taskInformations) {
try { try {
String result = quartzService.addTask(taskInformations); String result = quartzService.addTask(taskInformations);
//任务添加到任务中
quartzService.addTask(taskInformations);
return result; return result;
} catch (Exception e) { } catch (Exception e) {
logger.error("/add/task exception={}", e); logger.error("/add/task exception={}", e);
......
package com.cx.cn.cxquartz.service.quartz; package com.cx.cn.cxquartz.service.quartz;
import com.cx.cn.cxquartz.vo.Sbtdspsr;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
public interface SbtdspsrService { public interface SbtdspsrService {
List selectByRtsp( String rtsp); 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);
} }
...@@ -17,9 +17,9 @@ public class SbtdspsrImpl implements SbtdspsrService { ...@@ -17,9 +17,9 @@ public class SbtdspsrImpl implements SbtdspsrService {
@Autowired @Autowired
private SbtdspsrMapper sbtdspsrMapper; private SbtdspsrMapper sbtdspsrMapper;
public List<Sbtdspsr> selectByRtsp(String rtsp) public List<Sbtdspsr> selectByRtsp(String videoid)
{ {
return sbtdspsrMapper.selectByRtsp(rtsp); return sbtdspsrMapper.selectByRtsp(videoid);
} }
@Override @Override
......
...@@ -47,7 +47,7 @@ public class FileTransferManager { ...@@ -47,7 +47,7 @@ public class FileTransferManager {
connection.setReadTimeout(2000); //延迟连接 connection.setReadTimeout(2000); //延迟连接
connection.setConnectTimeout(3000); connection.setConnectTimeout(3000);
connection.setRequestMethod("GET"); connection.setRequestMethod("GET");
if (connection.getResponseCode() == HttpURLConnection.HTTP_OK) { if (connection.getResponseCode() == HttpURLConnection.HTTP_OK || connection.getResponseCode()==HttpURLConnection.HTTP_NOT_MODIFIED) {
InputStream inputStream = connection.getInputStream(); InputStream inputStream = connection.getInputStream();
String pname = DateUtils.formatCurrDayNoSign() + "_" + recordid + "_0000_" + key.replace("path", ""); String pname = DateUtils.formatCurrDayNoSign() + "_" + recordid + "_0000_" + key.replace("path", "");
String fileName = pname + filesuff; String fileName = pname + filesuff;
...@@ -141,7 +141,7 @@ public class FileTransferManager { ...@@ -141,7 +141,7 @@ public class FileTransferManager {
return record; return record;
} }
public static GoalStructureParam getGoalStructureParam(int count,Long[] roiarray, int model, BASE64Encoder base64Encoder, TraffAlarmRecord transferRecord) { public static GoalStructureParam getGoalStructureParam(Long[] roiarray, int model, BASE64Encoder base64Encoder, TraffAlarmRecord transferRecord) {
//获得图片进行分析 //获得图片进行分析
GoalStructureParam param = new GoalStructureParam(); GoalStructureParam param = new GoalStructureParam();
param.setOutput(new Output(1, 1, -1, 3)); param.setOutput(new Output(1, 1, -1, 3));
......
...@@ -11,10 +11,10 @@ mybatis: ...@@ -11,10 +11,10 @@ mybatis:
spring: spring:
datasource: datasource:
url: jdbc:mysql://localhost:3306/imagepro?useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone=UTC # url: jdbc:mysql://192.168.168.212:3306/imagepro?useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone=UTC&allowPublicKeyRetrieval=true
#username: zn06 #username: zn06
#password: znznzn8 #password: znznzn8
# url: jdbc:mysql://172.16.24.153:3306/imagepro?useUnicode=true&characterEncoding=utf-8&useSSL=false url: jdbc:mysql://172.16.24.29:3306/imagepro?useUnicode=true&characterEncoding=utf-8&useSSL=false&allowPublicKeyRetrieval=true
username: root username: root
password: 123456 password: 123456
driver-class-name: com.mysql.jdbc.Driver driver-class-name: com.mysql.jdbc.Driver
......
...@@ -5,7 +5,10 @@ file.alarmurl=http://www.zjwwzf.cn/xzzfSpv/ext/alarm/camera ...@@ -5,7 +5,10 @@ file.alarmurl=http://www.zjwwzf.cn/xzzfSpv/ext/alarm/camera
#file.rtspurl=http://172.16.24.153:8081/getrealcamerasnapshot.php #file.rtspurl=http://172.16.24.153:8081/getrealcamerasnapshot.php
#file.recogurl=http://172.16.24.153:9098/images/recog #file.recogurl=http://172.16.24.153:9098/images/recog
file.rtspurl=http://localhost:8089/getrealcamerasnapshot #file.rtspurl=http://localhost:8089/getrealcamerasnapshot
file.recogurl=http://localhost:8089/images/recog #file.recogurl=http://localhost:8089/images/recog
file.rtspurl=http://172.16.24.29:8081/getrealcamerasnapshot.php
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
...@@ -7,12 +7,12 @@ ...@@ -7,12 +7,12 @@
<result column="xzbh" jdbcType="VARCHAR" property="xzbh"/> <result column="xzbh" jdbcType="VARCHAR" property="xzbh"/>
</resultMap> </resultMap>
<select id="selectByRtsp" parameterType="java.lang.String" resultMap="BaseResultMap"> <select id="selectByRtsp" parameterType="java.lang.String" resultType="com.cx.cn.cxquartz.vo.Sbtdspsr">
select sbbh,tdbh,xzbh from sbtdspsr where squrllj = #{rtsp} select * from sbtdspsr where sbbh = #{videoid}
</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 concat(videoid,'_0')videoid ,metatype,recordtype ,objectx,objecty,objectw,objecth from quartz_task_informations where rtsp=#{rtsp} select distinct metatype,recordtype ,objectx,objecty,objectw,objecth from quartz_task_informations where videoid=#{rtsp}
</select> </select>
<update id="updateRecogByRtsp" parameterType="java.util.HashMap" > <update id="updateRecogByRtsp" parameterType="java.util.HashMap" >
......
...@@ -115,6 +115,7 @@ ...@@ -115,6 +115,7 @@
<if test="img4path!=null">img4path=#{img4path},</if> <if test="img4path!=null">img4path=#{img4path},</if>
<if test="img5path!=null">img5path=#{img5path},</if> <if test="img5path!=null">img5path=#{img5path},</if>
<if test="videopath!=null">videopath=#{videopath},</if> <if test="videopath!=null">videopath=#{videopath},</if>
<if test="processstatus!=null">processstatus=#{processstatus},</if>
</trim> </trim>
WHERE recordid=#{recordid} WHERE recordid=#{recordid}
</update> </update>
......
This diff is collapsed.
This diff is collapsed.
<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
<meta charset="UTF-8">
<title>定时任务新增页面</title>
<!-- jquery -->
<script type="text/javascript" th:src="@{/js/jquery.min.js}"></script>
<link rel="stylesheet" type="text/css" th:href="@{/css/animate.min.css}"/>
<link rel="stylesheet" type="text/css" th:href="@{/css/bootstrap.min.css}"/>
<link rel="stylesheet" type="text/css" th:href="@{/css/font-awesome.min.css}"/>
<link rel="stylesheet" type="text/css" th:href="@{/css/mediaelementplayer.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/style.css}"/>
</head>
<body>
<div class="col-md-12 top-20 padding-0">
<div class="col-md-12">
<div class="panel">
<div class="panel-body">
<div class="panel-heading">
<h4>新增定时任务项</h4>
</div>
<div class="col-md-6" style="padding-left:10px;">
<form action="#" method="post">
<div class="form-group"><label class="col-sm-2 control-label text-right">任务编号:</label>
<div class="col-sm-10"><input type="text" name="taskno" id="taskno" class="form-control">
</div>
</div>
<br/> <br/> <br/>
<div class="form-group"><label class="col-sm-2 control-label text-right">任务名称:</label>
<div class="col-sm-10"><input type="text" name="taskname" id="taskname"
class="form-control"></div>
</div>
<br/> <br/>
<div class="form-group"><label class="col-sm-2 control-label text-right">定时配置规则:</label>
<div class="col-sm-10"><input type="text" placeholder="(例如: * /5 * * * * ? 每5秒执行一次)"
name="schedulerrule" id="schedulerrule" class="form-control">
</div>
</div>
<br/> <br/>
<div class="form-group"><label class="col-sm-2 control-label text-right">冻结状态:</label>
<div class="col-sm-10">
<select class="form-control" id="frozenstatus">
<option th:value="FROZEN" selected="selected" disabled="disabled">冻结</option>
</select>
</div>
</div>
<br/> <br/>
<div class="form-group"><label class="col-sm-2 control-label text-right">执行方:</label>
<div class="col-sm-10"><input type="text" name="executorno" id="executorno"
class="form-control"></div>
</div>
<br/> <br/>
<div class="form-group"><label class="col-sm-2 control-label text-right">执行方式:</label>
<div class="col-sm-10">
<select class="form-control" id="sendtype">
<option th:value="http" >http</option>
<option th:value="kafka" >kafka</option>
</select>
</div>
</div>
<br/> <br/>
<div class="form-group"><label class="col-sm-2 control-label text-right">url:</label>
<div class="col-sm-10"><input type="text" name="url" id="url" class="form-control"></div>
</div>
<br/> <br/>
<div class="form-group"><label class="col-sm-2 control-label text-right">执行参数:</label>
<div class="col-sm-10"><input type="text" name="executeparamter" id="executeparamter"
class="form-control"></div>
</div>
<br/><br/>
<div class="form-group"><label class="col-sm-2 control-label text-right">timeKey:</label>
<div class="col-sm-10"><input type="text" placeholder="(例如: yyyy-MM-dd HH:mm:ss)"
name="timekey" id="timekey" class="form-control"></div>
</div>
<br/> <br/><br/>
<input type="button" class="btn btn-3d btn-danger" th:onclick="'history.go(-1);'" align="left"
style="float:left;margin-left:700px;" value="关闭"/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<input type="button" class="btn btn-3d btn-success" id="savetask" align="right" value="保存"/>
</form>
</div>
</div>
</div>
</div>
</div>
<script type="text/javascript" th:inline="javascript">
$(function () {
$("#savetask").on('click', function (e) {
var taskno = $("#taskno").val();
var taskname = $("#taskname").val();
var schedulerrule = $("#schedulerrule").val();
var frozenstatus = $("#frozenstatus").val();
var executorno = $("#executorno").val();
var sendtype = $("#sendtype").val();
var url = $("#url").val();
var executeparamter = $("#executeparamter").val();
var timekey = $("#timekey").val();
$.ajax({
url: "/quartz/add/task",
dataType: "json",
type: "POST",
data: {
"taskno": taskno,
"taskname": taskname,
"schedulerrule": schedulerrule,
"frozenstatus": frozenstatus,
"executorno": executorno,
"sendtype": sendtype,
"url": url,
"executeparamter": executeparamter,
"timekey": timekey
},
success: function (result) {
if (result.code == 200) {
alert("添加成功!");
location.href = "/";
} else if (result.code == 1001) {
alert("该任务编号已经存在");
}
else {
alert("system error");
}
}
})
});
});
</script>
</body>
</html>
...@@ -23,7 +23,7 @@ ...@@ -23,7 +23,7 @@
<hr/> <hr/>
<div class="col-md-6" style="padding-left:10px;"> <div class="col-md-6" style="padding-left:10px;">
<form action="import" method="post"> <form action="import" method="post">
<input type="button" class="btn btn-raised btn-success" onclick="addNewTask()" <input type="button" class="btn btn-3d btn-success" style="box-shadow:none;background-color: #73B18D !important;width:70px" onclick="addNewTask()"
value="新增定时任务"/> value="新增定时任务"/>
</form> </form>
</div> </div>
...@@ -33,7 +33,7 @@ ...@@ -33,7 +33,7 @@
<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="..." name="name"/>
<div class="input-group-btn"> <div class="input-group-btn">
<input type="submit" class="btn btn-raised btn-success" value="search"/>&nbsp;&nbsp;&nbsp; <input type="submit" class="btn btn-3d btn-success" style="box-shadow:none;background-color: #73B18D !important;width:70px;margin-left: 19px;" value="search"/>&nbsp;&nbsp;&nbsp;
</div> </div>
</div> </div>
</form> </form>
...@@ -46,7 +46,7 @@ ...@@ -46,7 +46,7 @@
<tr> <tr>
<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;">定时配置cron</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>
...@@ -76,15 +76,15 @@ ...@@ -76,15 +76,15 @@
<td> <td>
<span th:if="${task.frozenstatus eq 'UNFROZEN'}"> <input type="button" <span th:if="${task.frozenstatus eq 'UNFROZEN'}"> <input type="button"
class="btn btn-3d btn-danger" class="btn btn-3d btn-danger"
value="暂停" value="暂停" style="box-shadow:none;background-color: #f26c4f !important;width:70px"
th:onclick="'javascript:startOrStop('+${task.taskno}+')'"/>&nbsp;</span> th:onclick="'javascript:startOrStop('+${task.taskno}+')'"/>&nbsp;</span>
<span th:if="${task.frozenstatus eq 'FROZEN'}"> <input type="button" <span th:if="${task.frozenstatus eq 'FROZEN'}"> <input type="button"
class="btn btn-3d btn-success" class="btn btn-3d btn-success"
value="启动" value="启动" style="box-shadow:none;background-color: #73B18D !important;width:70px"
th:onclick="'javascript:startOrStop('+${task.taskno}+')'"/>&nbsp;</span> th:onclick="'javascript:startOrStop('+${task.taskno}+')'"/>&nbsp;</span>
<input type="button" class="btn btn-3d btn-success" <input type="button" class="btn btn-3d btn-success" style="box-shadow:none;background-color: #73B18D !important;width:70px"
th:onclick="'javascript:runRightNow('+${task.taskno}+')'" value="立刻运行一次"/> th:onclick="'javascript:runRightNow('+${task.taskno}+')'" value="立刻运行一次"/>
<input type="button" class="btn btn-3d btn-success" <input type="button" class="btn btn-3d btn-success" style="box-shadow:none;background-color: #73B18D !important;width:70px"
th:onclick="'javascript:editpage('+${task.id}+')'" value="修改"/> th:onclick="'javascript:editpage('+${task.id}+')'" value="修改"/>
</td> </td>
</tr> </tr>
......
...@@ -11,6 +11,10 @@ ...@@ -11,6 +11,10 @@
<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">
.col-sm-10 {margin-bottom: 10px}
</style>
</head> </head>
<body> <body>
<div class="col-md-12 top-20 padding-0"> <div class="col-md-12 top-20 padding-0">
...@@ -67,9 +71,10 @@ ...@@ -67,9 +71,10 @@
</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" <div class="col-sm-10">
placeholder="(例如: * /5 * * * * ? 每5秒执行一次)" <input type="number" min="1" max="60" step="1"
placeholder="间隔时间"
name="schedulerrule" name="schedulerrule"
th:value="${taskInformation.schedulerrule}" th:value="${taskInformation.schedulerrule}"
id="schedulerrule" id="schedulerrule"
...@@ -126,10 +131,9 @@ ...@@ -126,10 +131,9 @@
<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"> id="videoid" class="form-control" style="width:50%;float: left">
<a id="getrtsp" href=" javascript:void(0)">获得监控图片</a> <a id="getrtsp" href=" javascript:void(0)" style="float: left;padding-left: 12px;padding-top: 10px;">获得监控图片</a>
<a id="getwidth" href=" javascript:void(0)">编辑监控范围</a> <a id="getwidth" href=" javascript:void(0)" style="padding-left: 12px; padding-top: 10px;">编辑监控范围</a>
</div> </div>
</div> </div>
...@@ -222,9 +226,9 @@ ...@@ -222,9 +226,9 @@
id="timekey" class="form-control"></div> id="timekey" class="form-control"></div>
</div> </div>
<input type="button" class="btn btn-3d btn-danger" th:onclick="'history.go(-1);'" align="left" <input type="button" class="btn btn-3d btn-warning" th:onclick="'history.go(-1);'" align="left"
style="float:left;margin-left:700px;" value="关闭"/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; style="float:left;margin-left:120px;box-shadow:none;background-color: #f26c4f !important;width:70px" value="关闭"/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<input type="button" class="btn btn-3d btn-success" id="updatetask" align="right" 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>
...@@ -234,8 +238,9 @@ ...@@ -234,8 +238,9 @@
</div> </div>
<canvas id="draw-canvas" width="600" height="400" <canvas id="draw-canvas" width="600" height="400"
style="border:1px solid #d3d3d3; position: absolute; right: 100px; top: 100px;}"> style="border:1px solid #d3d3d3; position: absolute; left: 50%; top: 100px;}">
</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){
...@@ -353,7 +358,7 @@ ...@@ -353,7 +358,7 @@
// } // }
} }
} }
//左侧拉伸展 //左侧拉伸展
...@@ -497,19 +502,13 @@ ...@@ -497,19 +502,13 @@
} }
position.width = position.x2 - position.x1 position.width = position.x2 - position.x1
position.height = position.y2 - position.y1 position.height = position.y2 - position.y1
<!--if (position.width < 50 || position.height < 50) {-->
<!--position.width = 60;-->
<!--position.height = 60;-->
<!--position.x2 += position.x1 + 60;-->
<!--position.y2 += position.y1 + 60;-->
<!--}-->
return position return position
} }
mousedown(e){ mousedown(e){
if($("#changewidthnot").val()=="1") { if($("#changewidthnot").val()=="1") {
this.startX = (e.pageX - $("#draw-canvas").offset().left) / this.scale; this.startX = (e.pageX -this.canvas.offsetLeft ) / this.scale;
this.startY = (e.pageY - $("#draw-canvas").offset().top) / 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) {
this.leftDistance = this.startX - this.currentR.x1; this.leftDistance = this.startX - this.currentR.x1;
...@@ -523,8 +522,8 @@ ...@@ -523,8 +522,8 @@
mousemove(e){ mousemove(e){
if($("#changewidthnot").val()=="1") { if($("#changewidthnot").val()=="1") {
this.endX = (e.pageX - $("#draw-canvas").offset().left) / this.scale; this.endX = (e.pageX - this.canvas.offsetLeft) / this.scale;
this.endY = (e.pageY - $("#draw-canvas").offset().top) / 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);
this.ctx.save(); this.ctx.save();
this.ctx.setLineDash([5]) this.ctx.setLineDash([5])
...@@ -571,7 +570,6 @@ ...@@ -571,7 +570,6 @@
} }
} }
} }
const draw = new DrawRectangle('draw-canvas', { const draw = new DrawRectangle('draw-canvas', {
src: $("#imgsrc").val(), src: $("#imgsrc").val(),
layers:[{}, layers:[{},
...@@ -582,22 +580,21 @@ ...@@ -582,22 +580,21 @@
"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":"green", "strokeStyle":"red",
"type":0 "type":0
} }
] ]
}); });
$( function () { $( function () {
$("#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";
} }
else { else {
$("#changewidthnot").val("1"); $("#changewidthnot").val("1");
$("#draw-canvas").style.cursor = "crosshair"; // $("#draw-canvas").style.cursor = "crosshair";
} }
}); });
...@@ -610,7 +607,7 @@ ...@@ -610,7 +607,7 @@
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());
$("#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];
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment