Commit 37a7ec1c authored by yzm's avatar yzm

bug

parent fb73cb9a
......@@ -33,6 +33,11 @@ public class IndexController {
try {
List<QuartzTaskInformations> taskList = quartzService.getTaskList(taskNo, currentPage);
for(QuartzTaskInformations task:taskList)
{
task.setSchedulerrule(task.getSchedulerrule().replaceAll("\\?","").replaceAll("\\*","").replaceAll("\\/",""));
}
int current = Integer.parseInt(currentPage);
Page<QuartzTaskInformations> page = new Page(taskList, taskList.size(), current);
model.addAttribute("taskList", taskList);
......
......@@ -5,6 +5,7 @@ import com.alibaba.fastjson.JSONObject;
import com.cx.cn.cxquartz.bean.QuartzTaskErrors;
import com.cx.cn.cxquartz.bean.QuartzTaskInformations;
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.ResultUtil;
import com.cx.cn.cxquartz.vo.QuartzTaskRecordsVo;
......@@ -39,6 +40,9 @@ public class QuartzController {
@Value("${file.rtspurl}")
private String rtspurl;
@Autowired
private SbtdspsrService sbtdspsrService;
@Autowired
private RestTemplate restTemplate;
......@@ -51,6 +55,7 @@ public class QuartzController {
@RequestMapping(value = "/add/task", method = RequestMethod.POST)
public String addTask(QuartzTaskInformations taskInformations) {
try {
taskInformations.setSchedulerrule("*/"+taskInformations.getSchedulerrule()+" * * * * ?");
String result = quartzService.addTask(taskInformations);
return result;
} catch (Exception e) {
......@@ -62,6 +67,7 @@ public class QuartzController {
@RequestMapping(value = "/edit/taskpage", method = RequestMethod.GET)
public String editTaskpage(Model model, String id) {
QuartzTaskInformations taskInformation = quartzService.getTaskById(id);
taskInformation.setSchedulerrule(taskInformation.getSchedulerrule().replaceAll("\\?","").replaceAll("\\*","").replaceAll("\\/",""));
model.addAttribute("taskInformation", taskInformation);
return "updatetask";
}
......@@ -70,7 +76,12 @@ public class QuartzController {
@RequestMapping(value = "/edit/task", method = RequestMethod.POST)
public String editTask(QuartzTaskInformations taskInformations) {
try {
taskInformations.setSchedulerrule("*/"+taskInformations.getSchedulerrule()+" * * * * ?");
String result = quartzService.updateTask(taskInformations);
int upresult = sbtdspsrService.updateRecogByRtsp(taskInformations.getRtsp(), taskInformations.getVideoid());
if (upresult > 0) {
logger.info("更新sbtddspsr squrllj 的值为:"+taskInformations.getExecuteparamter());
}
return result;
} catch (Exception e) {
logger.error("/edit/task exception={}", e);
......@@ -173,27 +184,26 @@ public class QuartzController {
Map<String, String> map = new HashMap<>();
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> exchange = restTemplate.exchange(getrtspbyurl + "?deviceCode={deviceCode}",
// HttpMethod.GET, null, String.class, map);
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 地址
//返回rtsp 地址,更新 sbtdspsr 地址
String rtspValue=String.valueOf( json.get("obj"));
//获得抽帧图片
Map maps = new HashMap<>();
maps.put("rtspvalue",String.valueOf( json.get("obj")));
maps.put("rtspvalue",rtspValue);
maps.put("refresh",1);
ResponseEntity<String> result = restTemplate.exchange(rtspurl + "?url={rtspvalue}&refresh={refresh}",
HttpMethod.GET, null, String.class, maps);
JSONObject jsonresult = JSONObject.parseObject(result.getBody());
if (null != jsonresult.getString("ret") && jsonresult.getString("ret").equals("0")) {
//获得图片地址
//获得图片地址,存放到ftp上面
return ResultUtil.success( ResultEnum.SUCCESS.getCode(),jsonresult.getString("url")+","+json.get("obj"));
}
} else {
logger.info("未获取到监控rtsp");
}
logger.error("rtsp 不存在-->");
return ResultUtil.fail();
return ResultUtil.success();
}
}
......@@ -42,8 +42,6 @@ public class SbtdspsrController {
public String addTask(QuartzTaskInformations taskInformations) {
try {
String result = quartzService.addTask(taskInformations);
//任务添加到任务中
quartzService.addTask(taskInformations);
return result;
} catch (Exception e) {
logger.error("/add/task exception={}", e);
......
package com.cx.cn.cxquartz.service.quartz;
import com.cx.cn.cxquartz.vo.Sbtdspsr;
import java.util.List;
import java.util.Map;
public interface SbtdspsrService {
List selectByRtsp( String rtsp);
List<Sbtdspsr> selectByRtsp(String videoid);
List<Map> selectRecogByRtsp(String rtsp);
int updateRecogByRtsp(String rtsp,String devicecode);
}
......@@ -17,9 +17,9 @@ public class SbtdspsrImpl implements SbtdspsrService {
@Autowired
private SbtdspsrMapper sbtdspsrMapper;
public List<Sbtdspsr> selectByRtsp(String rtsp)
public List<Sbtdspsr> selectByRtsp(String videoid)
{
return sbtdspsrMapper.selectByRtsp(rtsp);
return sbtdspsrMapper.selectByRtsp(videoid);
}
@Override
......
......@@ -47,7 +47,7 @@ public class FileTransferManager {
connection.setReadTimeout(2000); //延迟连接
connection.setConnectTimeout(3000);
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();
String pname = DateUtils.formatCurrDayNoSign() + "_" + recordid + "_0000_" + key.replace("path", "");
String fileName = pname + filesuff;
......@@ -141,7 +141,7 @@ public class FileTransferManager {
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();
param.setOutput(new Output(1, 1, -1, 3));
......
......@@ -11,10 +11,10 @@ mybatis:
spring:
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
#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
password: 123456
driver-class-name: com.mysql.jdbc.Driver
......
......@@ -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.recogurl=http://172.16.24.153:9098/images/recog
file.rtspurl=http://localhost:8089/getrealcamerasnapshot
file.recogurl=http://localhost:8089/images/recog
#file.rtspurl=http://localhost:8089/getrealcamerasnapshot
#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
file.getrtspbyurl=http://212.129.142.17:8281/gh/device/test
......@@ -7,12 +7,12 @@
<result column="xzbh" jdbcType="VARCHAR" property="xzbh"/>
</resultMap>
<select id="selectByRtsp" parameterType="java.lang.String" resultMap="BaseResultMap">
select sbbh,tdbh,xzbh from sbtdspsr where squrllj = #{rtsp}
<select id="selectByRtsp" parameterType="java.lang.String" resultType="com.cx.cn.cxquartz.vo.Sbtdspsr">
select * from sbtdspsr where sbbh = #{videoid}
</select>
<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>
<update id="updateRecogByRtsp" parameterType="java.util.HashMap" >
......
......@@ -115,6 +115,7 @@
<if test="img4path!=null">img4path=#{img4path},</if>
<if test="img5path!=null">img5path=#{img5path},</if>
<if test="videopath!=null">videopath=#{videopath},</if>
<if test="processstatus!=null">processstatus=#{processstatus},</if>
</trim>
WHERE recordid=#{recordid}
</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 @@
<hr/>
<div class="col-md-6" style="padding-left:10px;">
<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="新增定时任务"/>
</form>
</div>
......@@ -33,7 +33,7 @@
<div class="input-group">
<input type="input" class="form-control" aria-label="..." name="name"/>
<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>
</form>
......@@ -46,7 +46,7 @@
<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;">定时配置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>
......@@ -76,15 +76,15 @@
<td>
<span th:if="${task.frozenstatus eq 'UNFROZEN'}"> <input type="button"
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>
<span th:if="${task.frozenstatus eq 'FROZEN'}"> <input type="button"
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>
<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="立刻运行一次"/>
<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="修改"/>
</td>
</tr>
......
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