Commit 793e5ae2 authored by wangjinjing's avatar wangjinjing

图片画框

parent 6287b042
...@@ -153,6 +153,16 @@ ...@@ -153,6 +153,16 @@
<artifactId>fastjson</artifactId> <artifactId>fastjson</artifactId>
<version>1.2.28</version> <version>1.2.28</version>
</dependency> </dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-websocket</artifactId>
</dependency>
<dependency>
<groupId>javax.websocket</groupId>
<artifactId>javax.websocket-api</artifactId>
<version>1.1</version>
</dependency>
</dependencies> </dependencies>
......
...@@ -30,6 +30,89 @@ public class QuartzTaskInformations { ...@@ -30,6 +30,89 @@ public class QuartzTaskInformations {
private String executeparamter; private String executeparamter;
private String timekey; private String timekey;
private Long objectx;
private Long objecty;
private Long objectw;
private Long objecth;
private String recordtype;
private String metatype;
private String imgsrc;
private String rtsp;
private String videoid;
public String getVideoid() {
return videoid;
}
public void setVideoid(String videoid) {
this.videoid = videoid;
}
public String getImgsrc() {
return imgsrc;
}
public void setImgsrc(String imgsrc) {
this.imgsrc = imgsrc;
}
public String getRtsp() {
return rtsp;
}
public void setRtsp(String rtsp) {
this.rtsp = rtsp;
}
public String getMetatype() {
return metatype;
}
public void setMetatype(String metatype) {
this.metatype = metatype;
}
public Long getObjectx() {
return objectx;
}
public void setObjectx(Long objectx) {
this.objectx = objectx;
}
public Long getObjecty() {
return objecty;
}
public void setObjecty(Long objecty) {
this.objecty = objecty;
}
public Long getObjectw() {
return objectw;
}
public void setObjectw(Long objectw) {
this.objectw = objectw;
}
public Long getObjecth() {
return objecth;
}
public void setObjecth(Long objecth) {
this.objecth = objecth;
}
public String getRecordtype() {
return recordtype;
}
public void setRecordtype(String recordtype) {
this.recordtype = recordtype;
}
public Long getId() { public Long getId() {
return id; return id;
......
...@@ -63,7 +63,6 @@ public class ExtController { ...@@ -63,7 +63,6 @@ public class ExtController {
@Value("${file.recogurl}") @Value("${file.recogurl}")
private String recogurl; private String recogurl;
@Autowired @Autowired
private RestTemplate restTemplate; private RestTemplate restTemplate;
...@@ -209,7 +208,7 @@ public class ExtController { ...@@ -209,7 +208,7 @@ public class ExtController {
headers.setContentType(MediaType.APPLICATION_JSON_UTF8); headers.setContentType(MediaType.APPLICATION_JSON_UTF8);
Map<String, Object> maps = new HashMap<String, Object>(); Map<String, Object> maps = new HashMap<String, Object>();
maps.put("rtspvalue", rtspValue); maps.put("rtspvalue", rtspValue);
maps.put("refresh",1); maps.put("refresh", 1);
HttpEntity<String> formEntity = new HttpEntity<String>(null, headers); HttpEntity<String> formEntity = new HttpEntity<String>(null, headers);
TraffAlarmRecord record = new TraffAlarmRecord(); TraffAlarmRecord record = new TraffAlarmRecord();
Map<String, Object> transferRecordMap = new HashMap<>(); Map<String, Object> transferRecordMap = new HashMap<>();
...@@ -241,7 +240,7 @@ public class ExtController { ...@@ -241,7 +240,7 @@ public class ExtController {
Ftp ftp = ftpService.reloadFtp(); Ftp ftp = ftpService.reloadFtp();
//入表 //入表
Long recordid=Long.parseLong(String.valueOf(traffAlarmRecordService.inserTraffAlarmRecord(traffAlarmRecord))); Long recordid = Long.parseLong(String.valueOf(traffAlarmRecordService.inserTraffAlarmRecord(traffAlarmRecord)));
FileTransferManager.fetchUrlsFromRecord(traffAlarmRecord, transferRecordMap); FileTransferManager.fetchUrlsFromRecord(traffAlarmRecord, transferRecordMap);
List<TransferResult> results = FileTransferManager.transferFile(transferRecordMap, ftp, basepath); List<TransferResult> results = FileTransferManager.transferFile(transferRecordMap, ftp, basepath);
// logger.info("缓存数据上传结果:" + results.toString()); // logger.info("缓存数据上传结果:" + results.toString());
...@@ -267,29 +266,64 @@ public class ExtController { ...@@ -267,29 +266,64 @@ public class ExtController {
@RequestMapping(value = "/getRecog", method = RequestMethod.POST) @RequestMapping(value = "/getRecog", method = RequestMethod.POST)
public String getRecog(HttpServletRequest request, @RequestBody String rtspValue) { public String getRecog(HttpServletRequest request, @RequestBody String rtspValue) {
//根据判断监控是否存在,该监控检测的事件是什么 //根据判断监控是否存在,该监控检测的事件是什么
List<String> video_model = sbtdspsrService.selectRecogByRtsp(rtspValue); List<Map> mapList = sbtdspsrService.selectRecogByRtsp(rtspValue);
if (null!=video_model &&!video_model.equals("") && video_model.size()>0 ) { String model ="1";
//获得该监控的检测业务 String videoid = "";
String model = video_model.get(0).split("/")[1]; String recordtype ="1";
String videoid = video_model.get(0).split("/")[0]; Long[] roiarray=new Long[4];//图片框选出来的范围
if (null != mapList && !mapList.equals("") && mapList.size()>0) {
//获得该监控的检测业务与检测范围
for (Map<String, Object> map: mapList) {
String state =null;
Integer state_id = null;
for (Map.Entry<String, Object> maps:map.entrySet()) {
if("videoid".equals(maps.getKey())){
videoid = String.valueOf(maps.getValue());
}
else if("metatype".equals(maps.getKey())){
model = String.valueOf(maps.getValue());
}
else if("recordtype".equals(maps.getKey())){
recordtype = String.valueOf(maps.getValue());
}
else if("objectx".equals(maps.getKey())){
roiarray[0]=new Long(String.valueOf(maps.getValue()));
}
else if("objecty".equals(maps.getKey())){
roiarray[1]=new Long(String.valueOf(maps.getValue()));
}
else if("objectw".equals(maps.getKey())){
roiarray[2]=new Long(String.valueOf(maps.getValue()));
}
else if("objecth".equals(maps.getKey())){
roiarray[3]=new Long(String.valueOf(maps.getValue()));
}
}
}
//查询该监控下面还没有经过分析的数据 //查询该监控下面还没有经过分析的数据
Map<String, Object> map = new HashMap<>(); Map<String, Object> map = new HashMap<>();
map.put("sbbh", videoid.split("_")[0]); map.put("sbbh", videoid.split("_")[0]);
map.put("tdbh", videoid.split("_")[1]); map.put("tdbh", videoid.split("_")[1]);
List<TraffAlarmRecord> traffalarmrecordlist = traffAlarmRecordService.getTraffAlarmRecordByProgress(map); List<TraffAlarmRecord> traffalarmrecordlist = traffAlarmRecordService.getTraffAlarmRecordByProgress(map);
BASE64Decoder base64Decoder=new BASE64Decoder(); if(traffalarmrecordlist.size()<1)return ResultUtil.success();
BASE64Decoder base64Decoder = new BASE64Decoder();
int count = 0; int count = 0;
//开启多线程 //开启多线程
//调用结构化服务,获得图片返回结果 //调用结构化服务,获得图片返回结果
HttpHeaders headers = new HttpHeaders(); HttpHeaders headers = new HttpHeaders();
BASE64Encoder base64Encoder = new BASE64Encoder(); BASE64Encoder base64Encoder = new BASE64Encoder();
headers.setContentType(MediaType.APPLICATION_JSON_UTF8); headers.setContentType(MediaType.APPLICATION_JSON_UTF8);
HttpEntity<String> requestEntity=null; HttpEntity<String> requestEntity = null;
for (TraffAlarmRecord transferRecord : traffalarmrecordlist) { for (TraffAlarmRecord transferRecord : traffalarmrecordlist) {
count = 0; count = 0;
GoalStructureParam param = FileTransferManager.getGoalStructureParam(count, Integer.parseInt(model == null ? "1" : model.equals("") ? "1" : model), base64Encoder, transferRecord); GoalStructureParam param = FileTransferManager.getGoalStructureParam(count,roiarray,
if(param.getImageList().size()<1)continue; Integer.parseInt(model == null ? "1" : model.equals("") ? "1" : model
requestEntity= new HttpEntity<String>(JSONObject.toJSONString(param), headers); ), base64Encoder, transferRecord);
if (param.getImageList().size() < 1) continue;
requestEntity = new HttpEntity<>(JSONObject.toJSONString(param), headers);
ResponseEntity<String> response = restTemplate.exchange(recogurl, HttpMethod.POST, requestEntity, String.class); ResponseEntity<String> response = restTemplate.exchange(recogurl, HttpMethod.POST, requestEntity, String.class);
String body = response.getBody(); String body = response.getBody();
JSONObject result = JSONObject.parseObject(body); JSONObject result = JSONObject.parseObject(body);
...@@ -299,31 +333,22 @@ public class ExtController { ...@@ -299,31 +333,22 @@ public class ExtController {
//获得 type //获得 type
//更新 recordalarm 为一分析 //更新 recordalarm 为一分析
traffAlarmRecordService.updateTraffAlarmRecordProcess(transferRecord); traffAlarmRecordService.updateTraffAlarmRecordProcess(transferRecord);
//判断是否统计结构化数据
if(recordtype.equals("6")||recordtype.equals("2"))//结构化统计
{
TraffpictureParam traffpictureParam=new TraffpictureParam();
setTraffpictureParam(recordtype, base64Encoder, transferRecord, traffpictureParam);
traffpictureParam.setTargetnum(objectList.size());
traffPictureService.updateTraffpicture(traffpictureParam);}
else {
for (TraffpictureParam traffpictureParam : objectList) { for (TraffpictureParam traffpictureParam : objectList) {
//根据imageid 获得 base64图片 //根据imageid 获得 base64图片
JSONObject metadata = JSONObject.parseObject(String.valueOf(traffpictureParam.getMetadata())); JSONObject metadata = JSONObject.parseObject(String.valueOf(traffpictureParam.getMetadata()));
traffpictureParam.setAreaid(transferRecord.getAreaid()); if (null != metadata && metadata.get("Type").equals(model)) {//规定区域内出现告警对象
traffpictureParam.setFdid(transferRecord.getFdid()); setTraffpictureParam(recordtype, base64Encoder, transferRecord, traffpictureParam);
traffpictureParam.setChannelid(transferRecord.getChannelid()); if (metadata.get("Type").equals("1"))//行人
traffpictureParam.setRecordid(transferRecord.getRecordid());
traffpictureParam.setRecordtype(String.valueOf(metadata.get("Type")));
traffpictureParam.setProcessstatus("0");
//获得imgid 对应的 base64
String imgftpurl=traffPictureService.queryimgpath(traffpictureParam);
Ftp ftp = ftpService.reloadFtp();
if (null != imgftpurl && !"".equals(imgftpurl)) {
byte[] Img = FTPUtil.getFtpPicBytes(imgftpurl);
if(null!=Img) {
traffpictureParam.setImagedata(base64Encoder.encode(Img));
}
}
//新增到picture
int id = traffPictureService.inserTraffpicture(traffpictureParam);
if (null != metadata && metadata.get("Type").equals("1"))//行人
{ {
//规定范围内检测到人
Pedestrian meta = JSON.toJavaObject(metadata, Pedestrian.class); Pedestrian meta = JSON.toJavaObject(metadata, Pedestrian.class);
meta.setId(traffpictureParam.getId()); meta.setId(traffpictureParam.getId());
pedestrianService.insertpedestrian(meta); pedestrianService.insertpedestrian(meta);
...@@ -332,21 +357,19 @@ public class ExtController { ...@@ -332,21 +357,19 @@ public class ExtController {
traffpictureParam.setObjy(meta.getObjectBoundingBox().getY()); traffpictureParam.setObjy(meta.getObjectBoundingBox().getY());
traffpictureParam.setObjw(meta.getObjectBoundingBox().getW()); traffpictureParam.setObjw(meta.getObjectBoundingBox().getW());
traffpictureParam.setObjh(meta.getObjectBoundingBox().getH()); traffpictureParam.setObjh(meta.getObjectBoundingBox().getH());
}
else if (null != metadata && metadata.get("Type").equals("2"))//车辆 } else if (null != metadata && metadata.get("Type").equals("2"))//车辆
{ {
Traffic meta = JSON.toJavaObject(metadata, Traffic.class); Traffic meta = JSON.toJavaObject(metadata, Traffic.class);
meta.setId(traffpictureParam.getId()); meta.setId(traffpictureParam.getId());
//新增到车辆详情表 //新增到车辆详情表
trafficService.insertTraffic(meta); trafficService.insertTraffic(meta);
if(null!=meta.getObjectBoundingBox()) if (null != meta.getObjectBoundingBox())
traffpictureParam.setObjx(meta.getObjectBoundingBox().getX()); traffpictureParam.setObjx(meta.getObjectBoundingBox().getX());
traffpictureParam.setObjy(meta.getObjectBoundingBox().getY()); traffpictureParam.setObjy(meta.getObjectBoundingBox().getY());
traffpictureParam.setObjw(meta.getObjectBoundingBox().getW()); traffpictureParam.setObjw(meta.getObjectBoundingBox().getW());
traffpictureParam.setObjh(meta.getObjectBoundingBox().getH()); traffpictureParam.setObjh(meta.getObjectBoundingBox().getH());
} } else if (null != metadata && metadata.get("Type").equals("3")) {
else if (null != metadata && metadata.get("Type").equals("3"))
{
Face meta = JSON.toJavaObject(metadata, Face.class); Face meta = JSON.toJavaObject(metadata, Face.class);
meta.setId(traffpictureParam.getId()); meta.setId(traffpictureParam.getId());
faceService.insertFace(meta); faceService.insertFace(meta);
...@@ -354,8 +377,7 @@ public class ExtController { ...@@ -354,8 +377,7 @@ public class ExtController {
traffpictureParam.setObjy(meta.getFaceBoundingBox().getY()); traffpictureParam.setObjy(meta.getFaceBoundingBox().getY());
traffpictureParam.setObjw(meta.getFaceBoundingBox().getW()); traffpictureParam.setObjw(meta.getFaceBoundingBox().getW());
traffpictureParam.setObjh(meta.getFaceBoundingBox().getH()); traffpictureParam.setObjh(meta.getFaceBoundingBox().getH());
} } else if (null != metadata && metadata.get("Type").equals("4"))//人骑车
else if (null != metadata && metadata.get("Type").equals("4"))//人骑车
{ {
PeopleRideBicyc meta = JSON.toJavaObject(metadata, PeopleRideBicyc.class); PeopleRideBicyc meta = JSON.toJavaObject(metadata, PeopleRideBicyc.class);
meta.setId(traffpictureParam.getId()); meta.setId(traffpictureParam.getId());
...@@ -376,17 +398,16 @@ public class ExtController { ...@@ -376,17 +398,16 @@ public class ExtController {
ByteArrayOutputStream stream = new ByteArrayOutputStream(); ByteArrayOutputStream stream = new ByteArrayOutputStream();
ImageIO.write(image, "png", stream); ImageIO.write(image, "png", stream);
traffpictureParam.setImagedata(new String(Base64.getEncoder().encode(stream.toByteArray()))); traffpictureParam.setImagedata(new String(Base64.getEncoder().encode(stream.toByteArray())));
} catch (Exception ex) } catch (Exception ex) {
{ logger.info("base64画框异常:" + ex.toString());
logger.info("base64画框异常:"+ex.toString());
} }
traffPictureService.updateTraffpicture(traffpictureParam); traffPictureService.updateTraffpicture(traffpictureParam);
//推送告警
WebSocket.GroupSending(JSONObject.toJSONString(traffpictureParam)); WebSocket.GroupSending(JSONObject.toJSONString(traffpictureParam));
} }
} }
}
}
} }
return ResultUtil.success(); return ResultUtil.success();
...@@ -399,5 +420,26 @@ public class ExtController { ...@@ -399,5 +420,26 @@ public class ExtController {
return ResultUtil.fail(); return ResultUtil.fail();
} }
private void setTraffpictureParam(String recordtype, BASE64Encoder base64Encoder, TraffAlarmRecord transferRecord, TraffpictureParam traffpictureParam) {
traffpictureParam.setAreaid(transferRecord.getAreaid());
traffpictureParam.setFdid(transferRecord.getFdid());
traffpictureParam.setChannelid(transferRecord.getChannelid());
traffpictureParam.setRecordid(transferRecord.getRecordid());
traffpictureParam.setProcessstatus("0");
//获得imgid 对应的 base64
String imgftpurl = traffPictureService.queryimgpath(traffpictureParam);
Ftp ftp = ftpService.reloadFtp();
if (null != imgftpurl && !"".equals(imgftpurl)) {
byte[] Img = FTPUtil.getFtpPicBytes(imgftpurl);
if (null != Img) {
traffpictureParam.setImagedata(base64Encoder.encode(Img));
}
}
traffpictureParam.setRecordtype(recordtype);
//新增到picture
int id = traffPictureService.inserTraffpicture(traffpictureParam);
}
} }
package com.cx.cn.cxquartz.controller; package com.cx.cn.cxquartz.controller;
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;
...@@ -11,14 +12,17 @@ import org.apache.commons.lang.StringUtils; ...@@ -11,14 +12,17 @@ import org.apache.commons.lang.StringUtils;
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;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.http.*;
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
import org.springframework.ui.Model; import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.client.RestTemplate;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import javax.servlet.http.HttpServletRequest;
import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map;
@Controller @Controller
@RequestMapping("/quartz") @RequestMapping("/quartz")
...@@ -29,7 +33,14 @@ public class QuartzController { ...@@ -29,7 +33,14 @@ public class QuartzController {
@Autowired @Autowired
private QuartzService quartzService; private QuartzService quartzService;
@Value("${file.getrtspbyurl}")
private String getrtspbyurl;
@Value("${file.rtspurl}")
private String rtspurl;
@Autowired
private RestTemplate restTemplate;
@RequestMapping(value = "/add/taskpage", method = RequestMethod.GET) @RequestMapping(value = "/add/taskpage", method = RequestMethod.GET)
public String addTaskpage() { public String addTaskpage() {
...@@ -155,5 +166,34 @@ public class QuartzController { ...@@ -155,5 +166,34 @@ public class QuartzController {
return "redirect:/"; return "redirect:/";
} }
} }
@RequestMapping(value = "/getRtsp/{devicecode}", method = RequestMethod.GET)
@ResponseBody
public String getRTSP(@PathVariable("devicecode") String devicecode) {
//判断rtsp 是否过期http://212.129.142.17:8281/gh/device/test?deviceCode=3YSCA44445TFCPX
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);
JSONObject json = JSONObject.parseObject(responseEntity.getBody());
if (null != json.getString("code") && json.getString("code").equals("0")) {
//返回rtsp 地址
//获得抽帧图片
Map maps = new HashMap<>();
maps.put("rtspvalue",String.valueOf( json.get("obj")));
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")) {
//获得图片地址
return ResultUtil.success( ResultEnum.SUCCESS.getCode(),jsonresult.getString("url")+","+json.get("obj"));
}
} else {
logger.info("未获取到监控rtsp");
}
logger.error("rtsp 不存在-->");
return ResultUtil.fail();
}
} }
...@@ -4,6 +4,7 @@ package com.cx.cn.cxquartz.controller; ...@@ -4,6 +4,7 @@ package com.cx.cn.cxquartz.controller;
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.QuartzTaskRecordsService;
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;
...@@ -31,7 +32,6 @@ public class SbtdspsrController { ...@@ -31,7 +32,6 @@ public class SbtdspsrController {
@RequestMapping(value = "/getSbtdspsrbyrtsp", method = RequestMethod.GET) @RequestMapping(value = "/getSbtdspsrbyrtsp", method = RequestMethod.GET)
public String addTaskpage() { public String addTaskpage() {
return "addtask"; return "addtask";
...@@ -42,6 +42,8 @@ public class SbtdspsrController { ...@@ -42,6 +42,8 @@ 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);
...@@ -60,7 +62,13 @@ public class SbtdspsrController { ...@@ -60,7 +62,13 @@ public class SbtdspsrController {
@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 {
QuartzTaskInformations resultTaskInformations= quartzService.getTaskById(taskInformations.getTaskno());
String result = quartzService.updateTask(taskInformations); String result = quartzService.updateTask(taskInformations);
//判断corn 是否改变,改变重新生成任务
if(!resultTaskInformations.getSchedulerrule().equals(taskInformations.getSchedulerrule())) {
//重新启动,重新发布新的任务
quartzService.startJob(taskInformations.getTaskno());
}
return result; return result;
} catch (Exception e) { } catch (Exception e) {
logger.error("/edit/task exception={}", e); logger.error("/edit/task exception={}", e);
......
...@@ -6,9 +6,10 @@ import org.apache.ibatis.annotations.Mapper; ...@@ -6,9 +6,10 @@ import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import java.util.List; import java.util.List;
import java.util.Map;
@Mapper @Mapper
public interface SbtdspsrMapper { public interface SbtdspsrMapper {
List<Sbtdspsr> selectByRtsp( String rtsp); List<Sbtdspsr> selectByRtsp( String rtsp);
List<String> selectRecogByRtsp( String rtsp); List<Map> selectRecogByRtsp(String rtsp);
} }
package com.cx.cn.cxquartz.service.quartz; package com.cx.cn.cxquartz.service.quartz;
import java.util.List; import java.util.List;
import java.util.Map;
public interface SbtdspsrService { public interface SbtdspsrService {
List selectByRtsp( String rtsp); List selectByRtsp( String rtsp);
List<String> selectRecogByRtsp( String rtsp); List<Map> selectRecogByRtsp(String rtsp);
} }
...@@ -8,6 +8,7 @@ import org.springframework.beans.factory.annotation.Autowired; ...@@ -8,6 +8,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.List; import java.util.List;
import java.util.Map;
@Service @Service
public class SbtdspsrImpl implements SbtdspsrService { public class SbtdspsrImpl implements SbtdspsrService {
...@@ -21,7 +22,7 @@ public class SbtdspsrImpl implements SbtdspsrService { ...@@ -21,7 +22,7 @@ public class SbtdspsrImpl implements SbtdspsrService {
} }
@Override @Override
public List<String> selectRecogByRtsp(String rtsp) { public List<Map> selectRecogByRtsp(String rtsp) {
return sbtdspsrMapper.selectRecogByRtsp(rtsp); return sbtdspsrMapper.selectRecogByRtsp(rtsp);
} }
......
...@@ -28,13 +28,13 @@ public class AdminInterceptor implements HandlerInterceptor { ...@@ -28,13 +28,13 @@ public class AdminInterceptor implements HandlerInterceptor {
// System.out.println("执行了TestInterceptor的preHandle方法"); // System.out.println("执行了TestInterceptor的preHandle方法");
try { try {
//
//统一拦截(查询当前session是否存在user)(这里user会在每次登陆成功后,写入session) // //统一拦截(查询当前session是否存在user)(这里user会在每次登陆成功后,写入session)
String token = (String) request.getSession().getAttribute("token"); // String token = (String) request.getSession().getAttribute("token");
RestTemplate restTemplate = new RestTemplate(); // RestTemplate restTemplate = new RestTemplate();
HttpHeaders headers = new HttpHeaders(); // HttpHeaders headers = new HttpHeaders();
headers.setContentType(MediaType.APPLICATION_FORM_URLENCODED); // headers.setContentType(MediaType.APPLICATION_FORM_URLENCODED);
ResponseEntity<String> result = null; // ResponseEntity<String> result = null;
// if (null == token) { // if (null == token) {
// //登录 // //登录
......
...@@ -142,28 +142,28 @@ public class FileTransferManager { ...@@ -142,28 +142,28 @@ public class FileTransferManager {
return record; return record;
} }
public static GoalStructureParam getGoalStructureParam(int count, int model, BASE64Encoder base64Encoder, TraffAlarmRecord transferRecord) { public static GoalStructureParam getGoalStructureParam(int count,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));
param.setModel(model); param.setModel(model);
param.setApiout("1");////打开1400标准输出,默认可以不填 param.setApiout("1");////打开1400标准输出,默认可以不填
List<ImageList> list = new ArrayList<>(); List<ImageList> list = new ArrayList<>();
getImageList("1", base64Encoder, list, transferRecord.getImg1path()); getImageList("1",roiarray, base64Encoder, list, transferRecord.getImg1path());
getImageList("2", base64Encoder, list, transferRecord.getImg2path()); getImageList("2", roiarray,base64Encoder, list, transferRecord.getImg2path());
getImageList("3", base64Encoder, list, transferRecord.getImg3path()); getImageList("3", roiarray,base64Encoder, list, transferRecord.getImg3path());
getImageList("4", base64Encoder, list, transferRecord.getImg4path()); getImageList("4",roiarray, base64Encoder, list, transferRecord.getImg4path());
getImageList("5", base64Encoder, list, transferRecord.getImg5path()); getImageList("5", roiarray,base64Encoder, list, transferRecord.getImg5path());
param.setImageList(list); param.setImageList(list);
return param; return param;
} }
private static void getImageList(String id, BASE64Encoder base64Encoder, List<ImageList> list, String img1path) { private static void getImageList(String id,Long[] roiarray, BASE64Encoder base64Encoder, List<ImageList> list, String img1path) {
if (null != img1path && !"".equals(img1path)) { if (null != img1path && !"".equals(img1path)) {
byte[] Img = FTPUtil.getFtpPicBytes(img1path); byte[] Img = FTPUtil.getFtpPicBytes(img1path);
if (Img != null) { if (Img != null) {
list.add(new ImageList(id, base64Encoder.encode(Img).replaceAll("\r|\n", ""))); list.add(new ImageList(id,roiarray,20,1,20,100,base64Encoder.encode(Img).replaceAll("\r|\n", "")));
} }
} }
......
...@@ -3,9 +3,58 @@ package com.cx.cn.cxquartz.vo; ...@@ -3,9 +3,58 @@ package com.cx.cn.cxquartz.vo;
import com.alibaba.fastjson.annotation.JSONField; import com.alibaba.fastjson.annotation.JSONField;
import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonIgnore;
import java.util.List;
public class ImageList { public class ImageList {
private String ImageID; private String ImageID;
private Long[] Roi;
private Integer RoiPadding;
private Integer CropObjectImage;
private Integer CropObjectImagePadding;
private Integer CropObjectImageQuality;
public Long[] getRoi() {
return Roi;
}
public void setRoi(Long[] roi) {
Roi = roi;
}
public Integer getRoiPadding() {
return RoiPadding;
}
public void setRoiPadding(Integer roiPadding) {
RoiPadding = roiPadding;
}
public Integer getCropObjectImage() {
return CropObjectImage;
}
public void setCropObjectImage(Integer cropObjectImage) {
CropObjectImage = cropObjectImage;
}
public Integer getCropObjectImagePadding() {
return CropObjectImagePadding;
}
public void setCropObjectImagePadding(Integer cropObjectImagePadding) {
CropObjectImagePadding = cropObjectImagePadding;
}
public Integer getCropObjectImageQuality() {
return CropObjectImageQuality;
}
public void setCropObjectImageQuality(Integer cropObjectImageQuality) {
CropObjectImageQuality = cropObjectImageQuality;
}
@JsonIgnore @JsonIgnore
private int Format; private int Format;
...@@ -16,6 +65,16 @@ public class ImageList { ...@@ -16,6 +65,16 @@ public class ImageList {
Data = data; Data = data;
} }
public ImageList(String imageID, Long[] roi, Integer roiPadding, Integer cropObjectImage, Integer cropObjectImagePadding, Integer cropObjectImageQuality, String data) {
ImageID = imageID;
Roi = roi;
RoiPadding = roiPadding;
CropObjectImage = cropObjectImage;
CropObjectImagePadding = cropObjectImagePadding;
CropObjectImageQuality = cropObjectImageQuality;
Data = data;
}
public void setImageID(String ImageID){ public void setImageID(String ImageID){
this.ImageID = ImageID; this.ImageID = ImageID;
} }
......
...@@ -57,7 +57,15 @@ public class Traffpicture{ ...@@ -57,7 +57,15 @@ public class Traffpicture{
private String index; private String index;
private Integer targetnum;
public Integer getTargetnum() {
return targetnum;
}
public void setTargetnum(Integer targetnum) {
this.targetnum = targetnum;
}
public String getImageid() { public String getImageid() {
return imageid; return imageid;
......
...@@ -11,10 +11,10 @@ mybatis: ...@@ -11,10 +11,10 @@ mybatis:
spring: spring:
datasource: datasource:
#url: jdbc:mysql://localhost:3306/test?useUnicode=true&characterEncoding=utf-8&useSSL=false url: jdbc:mysql://192.168.168.212:3306/imagepro?useUnicode=true&characterEncoding=utf-8&useSSL=false
#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.153:3306/imagepro?useUnicode=true&characterEncoding=utf-8&useSSL=false
username: root username: root
password: 123456 password: 123456
driver-class-name: com.mysql.jdbc.Driver driver-class-name: com.mysql.jdbc.Driver
......
...@@ -2,6 +2,10 @@ file.uploadpath=D:\\imp\\VideoPic ...@@ -2,6 +2,10 @@ file.uploadpath=D:\\imp\\VideoPic
file.alarmpath=D:\\imp\\VideoPic file.alarmpath=D:\\imp\\VideoPic
file.recordurl=http://www.zjwwzf.cn/xzzfSpv/ext/patrolCtrlRecord file.recordurl=http://www.zjwwzf.cn/xzzfSpv/ext/patrolCtrlRecord
file.alarmurl=http://www.zjwwzf.cn/xzzfSpv/ext/alarm/camera 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.recogurl=http://localhost:8089/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
...@@ -17,6 +17,16 @@ ...@@ -17,6 +17,16 @@
<result column="url" property="url" jdbcType="VARCHAR"/> <result column="url" property="url" jdbcType="VARCHAR"/>
<result column="executeParamter" property="executeparamter" jdbcType="VARCHAR"/> <result column="executeParamter" property="executeparamter" jdbcType="VARCHAR"/>
<result column="timeKey" property="timekey" jdbcType="VARCHAR"/> <result column="timeKey" property="timekey" jdbcType="VARCHAR"/>
<result column="objectx" property="objectx" jdbcType="BIGINT"/>
<result column="objectx" property="objectx" jdbcType="BIGINT"/>
<result column="objecty" property="objecty" jdbcType="BIGINT"/>
<result column="objectw" property="objectw" jdbcType="BIGINT"/>
<result column="objecth" property="objecth" jdbcType="BIGINT"/>
<result column="recordtype" property="recordtype" jdbcType="VARCHAR"/>
<result column="metatype" property="metatype" jdbcType="VARCHAR"/>
<result column="rtsp" property="rtsp" jdbcType="VARCHAR"/>
<result column="videoid" property="videoid" jdbcType="VARCHAR"/>
<result column="imgsrc" property="imgsrc" jdbcType="VARCHAR"/>
</resultMap> </resultMap>
<resultMap id="PicResultMap" type="com.cx.cn.cxquartz.bean.PictureTime"> <resultMap id="PicResultMap" type="com.cx.cn.cxquartz.bean.PictureTime">
<id column="deviceid" property="deviceid" jdbcType="VARCHAR"/> <id column="deviceid" property="deviceid" jdbcType="VARCHAR"/>
...@@ -31,7 +41,8 @@ ...@@ -31,7 +41,8 @@
<sql id="Base_Column_List"> <sql id="Base_Column_List">
id, version, taskNo, taskName, schedulerRule, frozenStatus, executorNo, frozenTime, id, version, taskNo, taskName, schedulerRule, frozenStatus, executorNo, frozenTime,
unfrozenTime, createTime, lastModifyTime, sendType, url, executeParamter, timeKey unfrozenTime, createTime, lastModifyTime, sendType, url, executeParamter, timeKey,
objectx , objecty ,objectw,objecth,recordtype,metatype,videoid,rtsp,imgsrc
</sql> </sql>
<select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Long"> <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Long">
select select
...@@ -48,13 +59,23 @@ ...@@ -48,13 +59,23 @@
taskName, schedulerRule, frozenStatus, taskName, schedulerRule, frozenStatus,
executorNo, frozenTime, unfrozenTime, executorNo, frozenTime, unfrozenTime,
createTime, lastModifyTime, sendType, createTime, lastModifyTime, sendType,
url, executeParamter, timeKey url, executeParamter, timeKey,objectx,objecty,pbjectw,objecth,recordtype,metatype,
rtsp,imgsrc,videoid
) )
values (#{id,jdbcType=BIGINT}, #{version,jdbcType=INTEGER}, #{taskno,jdbcType=VARCHAR}, values (#{id,jdbcType=BIGINT}, #{version,jdbcType=INTEGER}, #{taskno,jdbcType=VARCHAR},
#{taskname,jdbcType=VARCHAR}, #{schedulerrule,jdbcType=VARCHAR}, #{frozenstatus,jdbcType=VARCHAR}, #{taskname,jdbcType=VARCHAR}, #{schedulerrule,jdbcType=VARCHAR}, #{frozenstatus,jdbcType=VARCHAR},
#{executorno,jdbcType=VARCHAR}, #{frozentime,jdbcType=BIGINT}, #{unfrozentime,jdbcType=BIGINT}, #{executorno,jdbcType=VARCHAR}, #{frozentime,jdbcType=BIGINT}, #{unfrozentime,jdbcType=BIGINT},
#{createtime,jdbcType=BIGINT}, #{lastmodifytime,jdbcType=BIGINT}, #{sendtype,jdbcType=VARCHAR}, #{createtime,jdbcType=BIGINT}, #{lastmodifytime,jdbcType=BIGINT}, #{sendtype,jdbcType=VARCHAR},
#{url,jdbcType=VARCHAR}, #{executeparamter,jdbcType=VARCHAR}, #{timekey,jdbcType=VARCHAR} #{url,jdbcType=VARCHAR},
#{executeparamter,jdbcType=VARCHAR}, #{timekey,jdbcType=VARCHAR}
, #{objectx,jdbcType=BIGINT}
, #{objecty,jdbcType=BIGINT}
, #{pbjectw,jdbcType=BIGINT}
, #{objecth,jdbcType=BIGINT}
, #{recordtype,jdbcType=VARCHAR}
, #{rtsp,jdbcType=VARCHAR}
, #{imgsrc,jdbcType=VARCHAR}
, #{videoid,jdbcType=VARCHAR}
) )
</insert> </insert>
<insert id="insertSelective" parameterType="com.cx.cn.cxquartz.bean.QuartzTaskInformations"> <insert id="insertSelective" parameterType="com.cx.cn.cxquartz.bean.QuartzTaskInformations">
...@@ -105,6 +126,35 @@ ...@@ -105,6 +126,35 @@
<if test="timekey != null"> <if test="timekey != null">
timeKey, timeKey,
</if> </if>
<if test="objectx != null">
objectx,
</if>
<if test="objecty != null">
objecty,
</if>
<if test="objectw != null">
objectw,
</if>
<if test="objecth != null">
objecth,
</if>
<if test="recordtype != null">
recordtype,
</if>
<if test="metatype != null">
metatype,
</if>
<if test="rtsp != null">
rtsp,
</if>
<if test="imgsrc != null">
imgsrc,
</if>
<if test="videoid != null">
videoid,
</if>
</trim> </trim>
<trim prefix="values (" suffix=")" suffixOverrides=","> <trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null"> <if test="id != null">
...@@ -152,6 +202,36 @@ ...@@ -152,6 +202,36 @@
<if test="timekey != null"> <if test="timekey != null">
#{timekey,jdbcType=VARCHAR}, #{timekey,jdbcType=VARCHAR},
</if> </if>
<if test="objectx != null">
#{objectx,jdbcType=BIGINT},
</if>
<if test="objecty != null">
#{objecty,jdbcType=BIGINT},
</if>
<if test="objectw != null">
#{objectw,jdbcType=BIGINT},
</if>
<if test="objecth != null">
#{objecth,jdbcType=BIGINT},
</if>
<if test="recordtype != null">
#{recordtype,jdbcType=VARCHAR},
</if>
<if test="metatype != null">
#{metatype,jdbcType=VARCHAR},
</if>
<if test="rtsp != null">
#{rtsp,jdbcType=VARCHAR},
</if>
<if test="imgsrc != null">
#{imgsrc,jdbcType=VARCHAR},
</if>
<if test="videoid != null">
#{videoid,jdbcType=VARCHAR},
</if>
</trim> </trim>
</insert> </insert>
<update id="updateByPrimaryKeySelective" <update id="updateByPrimaryKeySelective"
...@@ -200,8 +280,36 @@ ...@@ -200,8 +280,36 @@
<if test="timekey != null"> <if test="timekey != null">
timeKey = #{timekey,jdbcType=VARCHAR}, timeKey = #{timekey,jdbcType=VARCHAR},
</if> </if>
<if test="objectx != null">
objectx = #{objectx,jdbcType=BIGINT},
</if>
<if test="objecty != null">
objecty = #{objecty,jdbcType=BIGINT},
</if>
<if test="objectw != null">
objectw = #{objectw,jdbcType=BIGINT},
</if>
<if test="objecth != null">
objecth = #{objecth,jdbcType=BIGINT},
</if>
<if test="recordtype != null">
recordtype = #{recordtype,jdbcType=VARCHAR},
</if>
<if test="metatype != null">
metatype = #{metatype,jdbcType=VARCHAR},
</if>
<if test="rtsp != null">
rtsp = #{rtsp,jdbcType=VARCHAR},
</if>
<if test="imgsrc != null">
imgsrc = #{imgsrc,jdbcType=VARCHAR},
</if>
<if test="videoid != null">
videoid = #{videoid,jdbcType=VARCHAR},
</if>
</set> </set>
where id = #{id,jdbcType=BIGINT} and version = #{version} where id = #{id,jdbcType=BIGINT}
</update> </update>
<update id="updateByPrimaryKey" parameterType="com.cx.cn.cxquartz.bean.QuartzTaskInformations"> <update id="updateByPrimaryKey" parameterType="com.cx.cn.cxquartz.bean.QuartzTaskInformations">
update quartz_task_informations update quartz_task_informations
...@@ -218,7 +326,16 @@ ...@@ -218,7 +326,16 @@
sendType = #{sendtype,jdbcType=VARCHAR}, sendType = #{sendtype,jdbcType=VARCHAR},
url = #{url,jdbcType=VARCHAR}, url = #{url,jdbcType=VARCHAR},
executeParamter = #{executeparamter,jdbcType=VARCHAR}, executeParamter = #{executeparamter,jdbcType=VARCHAR},
timeKey = #{timekey,jdbcType=VARCHAR} timeKey = #{timekey,jdbcType=VARCHAR} ,
objectx = #{objectx,jdbcType=BIGINT},
objecty = #{objecty,jdbcType=BIGINT} ,
objectw = #{lastmodifytime,jdbcType=BIGINT} ,
objecth = #{lastmodifytime,jdbcType=BIGINT},
recordtype = #{recordtype,jdbcType=VARCHAR} ,
metatype = #{metatype,jdbcType=VARCHAR},
rtsp = #{rtsp,jdbcType=VARCHAR},
videoid = #{videoid,jdbcType=VARCHAR},
imgsrc = #{imgsrc,jdbcType=VARCHAR}
where id = #{id,jdbcType=BIGINT} where id = #{id,jdbcType=BIGINT}
</update> </update>
......
...@@ -11,8 +11,8 @@ ...@@ -11,8 +11,8 @@
select sbbh,tdbh,xzbh from sbtdspsr where squrllj = #{rtsp} select sbbh,tdbh,xzbh from sbtdspsr where squrllj = #{rtsp}
</select> </select>
<select id="selectRecogByRtsp" parameterType="java.lang.String" resultType="java.lang.String"> <select id="selectRecogByRtsp" parameterType="java.lang.String" resultType="java.util.HashMap">
select distinct concat(a.sbbh,'_',a.tdbh,'/',b.recordtype) from sbtdspsr a left join videoerecordtype b on concat(a.sbbh,'_',a.tdbh)=b.videoid where a.squrllj =#{rtsp} select distinct concat(videoid,'_0')videoid ,metatype,recordtype ,objectx,objecty,objectw,objecth from quartz_task_informations where rtsp=#{rtsp}
</select> </select>
......
...@@ -3,7 +3,6 @@ ...@@ -3,7 +3,6 @@
<head> <head>
<meta charset="UTF-8"> <meta charset="UTF-8">
<title>定时任务修改</title> <title>定时任务修改</title>
<!-- jquery -->
<script type="text/javascript" th:src="@{/js/jquery.min.js}"></script> <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/animate.min.css}"/>
<link rel="stylesheet" type="text/css" th:href="@{/css/bootstrap.min.css}"/> <link rel="stylesheet" type="text/css" th:href="@{/css/bootstrap.min.css}"/>
...@@ -33,30 +32,54 @@ ...@@ -33,30 +32,54 @@
id="frozentime"/> id="frozentime"/>
<input type="hidden" th:value="${taskInformation.unfrozentime}" name="unfrozentime" <input type="hidden" th:value="${taskInformation.unfrozentime}" name="unfrozentime"
id="unfrozentime"/> id="unfrozentime"/>
<div class="form-group"><label class="col-sm-2 control-label text-right">任务编号:</label> <input type="hidden" th:value="${taskInformation.objectx}" name="objectx"
<div class="col-sm-10"><input type="text" th:value="${taskInformation.taskno}" name="taskno" id="objectx"/>
<input type="hidden" th:value="${taskInformation.objecty}" name="objecty"
id="objecty"/>
<input type="hidden" th:value="${taskInformation.objectw}" name="objectw"
id="objectw"/>
<input type="hidden" th:value="${taskInformation.objecth}" name="objecth"
id="objecth"/>
<input type="hidden" th:value="${taskInformation.imgsrc}" name="imgsrc"
id="imgsrc"/>
<input type="hidden" th:value="${taskInformation.rtsp}" name="rtsp"
id="rtsp"/>
<div class="form-group"><label
class="col-sm-2 control-label text-right">任务编号:</label>
<div class="col-sm-10"><input type="text" th:value="${taskInformation.taskno}"
name="taskno"
id="taskno" class="form-control"> id="taskno" class="form-control">
</div> </div>
</div> </div>
<br/> <br/> <br/>
<div class="form-group"><label class="col-sm-2 control-label text-right">任务名称:</label> <div class="form-group"><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>
<br/> <br/>
<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 type="text" placeholder="(例如: * /5 * * * * ? 每5秒执行一次)" class="col-sm-2 control-label text-right">定时配置规则:</label>
<div class="col-sm-10"><input type="text"
placeholder="(例如: * /5 * * * * ? 每5秒执行一次)"
name="schedulerrule" name="schedulerrule"
th:value="${taskInformation.schedulerrule}" id="schedulerrule" th:value="${taskInformation.schedulerrule}"
id="schedulerrule"
class="form-control"> class="form-control">
</div> </div>
</div> </div>
<br/> <br/>
<div class="form-group"><label class="col-sm-2 control-label text-right">冻结状态:</label> <div class="form-group"><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" th:selected="${taskInformation.frozenstatus == 'FROZEN'}"> <option th:value="FROZEN"
th:selected="${taskInformation.frozenstatus == 'FROZEN'}">
冻结 冻结
</option> </option>
<option th:value="UNFROZEN" <option th:value="UNFROZEN"
...@@ -66,43 +89,136 @@ ...@@ -66,43 +89,136 @@
</div> </div>
</div> </div>
<br/> <br/>
<div class="form-group"><label class="col-sm-2 control-label text-right">执行方:</label> <!--<td>-->
<div class="col-sm-10"><input type="text" th:value="${taskInformation.executorno}"
name="executorno" id="executorno" <!--<div class="form-group"><label-->
class="form-control"></div> <!--class="col-sm-2 control-label text-right">执行方:</label>-->
</div> <!--<div class="col-sm-10"><input type="text"-->
<br/> <br/> <!--th:value="${taskInformation.executorno}"-->
<div class="form-group"><label class="col-sm-2 control-label text-right">执行方式:</label> <!--name="executorno" id="executorno"-->
<!--class="form-control"></div>-->
<!--</div>-->
<!--</td>-->
<div class="form-group"><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" th:selected="${taskInformation.sendtype == 'http'}">http <option th:value="http"
th:selected="${taskInformation.sendtype == 'http'}">http
</option> </option>
<option th:value="kafka" th:selected="${taskInformation.sendtype == 'kafka'}"> <option th:value="kafka"
th:selected="${taskInformation.sendtype == 'kafka'}">
kafka kafka
</option> </option>
</select> </select>
</div> </div>
</div> </div>
<br/> <br/>
<div class="form-group"><label 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" th:value="${taskInformation.url}" class="col-sm-2 control-label text-right">监控id:</label>
</div>
<div class="form-group">
<div class="col-sm-10">
<input type="text" name="videoid" th:value="${taskInformation.videoid}"
id="videoid" class="form-control">
<a id="getrtsp" href=" javascript:void(0)">获得监控图片</a>
</div>
</div>
<div class="form-group"><label
class="col-sm-2 control-label text-right">事件类型:</label>
<div class="col-sm-10">
<select class="form-control" id="metatype">
<option th:value="1" th:selected="${taskInformation.metatype == '1'}">
全目标
</option>
<option th:value="2" th:selected="${taskInformation.metatype == '2'}">
行人、骑行、车辆检测识别
</option>
<option th:value="3" th:selected="${taskInformation.metatype == '3'}">
人脸检测识别
</option>
<option th:value="4" th:selected="${taskInformation.metatype == '4'}">
单独行人、骑行检测识别
</option>
<option th:value="5" th:selected="${taskInformation.metatype == '5'}">
单独车辆检测识别
</option>
<option th:value="6" th:selected="${taskInformation.metatype == '6'}">
人脸检测识别(不包含大类检测)
</option>
<option th:value="7" th:selected="${taskInformation.metatype == '7'}">
行人、骑行、人脸
</option>
</select>
</div>
</div>
<div class="form-group"><label
class="col-sm-2 control-label text-right">告警类型:</label>
<div class="col-sm-10">
<select class="form-control" id="recordtype">
<option th:value="1" th:selected="${taskInformation.recordtype == '1'}">
周界入侵
</option>
<option th:value="2" th:selected="${taskInformation.recordtype == '2'}">
人群密度
</option>
<option th:value="3" th:selected="${taskInformation.recordtype == '3'}">
周界越线
</option>
<option th:value="4" th:selected="${taskInformation.recordtype == '4'}">
非机动车未戴头盔
</option>
<option th:value="5" th:selected="${taskInformation.recordtype == '5'}">
非机动车载人
</option>
<option th:value="6" th:selected="${taskInformation.recordtype == '6'}">
结构化统计
</option>
</select>
</div>
</div>
<!--<div class="form-group"><label class="col-sm-2 control-label text-right">人群密度标准:</label>-->
<!--<div class="col-sm-10">-->
<!--<input type="text" th:value="${taskInformation.populationdensity}"-->
<!--name="executorno" id="populationdensity"-->
<!--class="form-control">-->
<!--</div>-->
<!--</div>-->
<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"
th:value="${taskInformation.url}"
id="url" class="form-control"></div> id="url" class="form-control"></div>
</div> </div>
<br/> <br/>
<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 type="text" name="executeparamter" class="col-sm-2 control-label text-right">执行参数:</label>
<div class="col-sm-10"><input readonly type="text" name="executeparamter"
th:value="${taskInformation.executeparamter}" th:value="${taskInformation.executeparamter}"
id="executeparamter" id="executeparamter"
class="form-control"></div> class="form-control"></div>
</div> </div>
<br/><br/>
<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" placeholder="(例如: yyyy-MM-dd HH:mm:ss)" class="col-sm-2 control-label text-right">timeKey:</label>
name="timekey" th:value="${taskInformation.timekey}" <div class="col-sm-10"><input type="text"
placeholder="(例如: yyyy-MM-dd HH:mm:ss)"
name="timekey"
th:value="${taskInformation.timekey}"
id="timekey" class="form-control"></div> id="timekey" class="form-control"></div>
</div> </div>
<br/> <br/><br/>
<input type="button" class="btn btn-3d btn-danger" th:onclick="'history.go(-1);'" align="left" <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; style="float:left;margin-left:700px;" 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" value="保存"/>
...@@ -112,11 +228,385 @@ ...@@ -112,11 +228,385 @@
</div> </div>
</div> </div>
</div> </div>
</div>
</div>
<canvas id="draw-canvas" width="600" height="400"
style="border:1px solid #d3d3d3; position: absolute; right: 100px; top: 100px;}">
</canvas>
<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.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[0];
var ratew=cvw/imgw;
var rateh=cvh/imgh;
this.ctx.beginPath();
this.ctx.rect((item.x1)*ratew, (item.y1)*rateh, (item.width)*ratew, (item.height)*rateh);
// this.ctx.rect(item.x1, item.y1, item.width, item.height);
this.ctx.strokeStyle = item.strokeStyle;
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);
// }
}
}
$(function () { //左侧拉伸展
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) {
let allNotIn = 1;
let item=this.layers[0];
this.ctx.beginPath();
this.ctx.rect(item.x1, item.y1, item.width, item.height);
this.ctx.strokeStyle = item.strokeStyle
<!--if (x >= (item.x1 - 25 / this.scale) && x <= (item.x1 + 25 / this.scale) && y <= (item.y2 - 25 / this.scale) && y >= (item.y1 + 25 / this.scale)) {-->
<!--this.resizeLeft(item);-->
<!--} else if (x >= (item.x2 - 25 / this.scale) && x <= (item.x2 + 25 / this.scale) && y <= (item.y2 - 25 / this.scale) && y >= (item.y1 + 25 / this.scale)) {-->
<!--this.resizeWidth(item);-->
<!--} else if (y >= (item.y1 - 25 / this.scale) && y <= (item.y1 + 25 / this.scale) && x <= (item.x2 - 25 / this.scale) && x >= (item.x1 + 25 / this.scale)) {-->
<!--this.resizeTop(item);-->
<!--} else if (y >= (item.y2 - 25 / this.scale) && y <= (item.y2 + 25 / this.scale) && x <= (item.x2 - 25 / this.scale) && x >= (item.x1 + 25 / this.scale)) {-->
<!--this.resizeHeight(item);-->
<!--} else if (x >= (item.x1 - 25 / this.scale) && x <= (item.x1 + 25 / this.scale) && y <= (item.y1 + 25 / this.scale) && y >= (item.y1 - 25 / this.scale)) {-->
<!--this.resizeLT(item);-->
<!--} else if (x >= (item.x2 - 25 / this.scale) && x <= (item.x2 + 25 / this.scale) && y <= (item.y2 + 25 / this.scale) && y >= (item.y2 - 25 / this.scale)) {-->
<!--this.resizeWH(item);-->
<!--} else if (x >= (item.x1 - 25 / this.scale) && x <= (item.x1 + 25 / this.scale) && y <= (item.y2 + 25 / this.scale) && y >= (item.y2 - 25 / this.scale)) {-->
<!--this.resizeLH(item);-->
<!--} else if (x >= (item.x2 - 25 / this.scale) && x <= (item.x2 + 25 / this.scale) && y <= (item.y1 + 25 / this.scale) && y >= (item.y1 - 25 / this.scale)) {-->
<!--this.resizeWT(item);-->
<!--}-->
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
<!--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
}
mousedown(e){
this.startX = (e.pageX - this.canvas.offsetLeft + this.canvas.parentElement.scrollLeft) / this.scale;
this.startY = (e.pageY - this.canvas.offsetTop + this.canvas.parentElement.scrollTop) / 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){
this.endX = (e.pageX - this.canvas.offsetLeft + this.canvas.parentElement.scrollLeft) / this.scale;
this.endY = (e.pageY - this.canvas.offsetTop + this.canvas.parentElement.scrollTop) / this.scale;
// console.log(`mousemove`, this.endX, this.endY);
this.ctx.save();
this.ctx.setLineDash([5])
this.canvas.style.cursor = "default";
this.ctx.clearRect(0, 0, this.config.width, this.config.height);
if (this.flag && this.optype == 1) {
// ctx.strokeRect(startx, starty, x - startx, y - starty);
// ctx.strokeRect(startx, starty, x - startx, y - starty);
this.ctx.strokeRect(this.startX<0?0:this.startX, this.startY<0?0:this.startY, this.endX - this.startX, this.endY - this.startY);
}
this.ctx.restore();
this.reshow(this.endX, this.endY);
}
mouseup(e){
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', {
src: $("#imgsrc").val(),
layers:[{
"x1": parseInt($("#objectx").val()),
"y1": parseInt($("#objecty").val()),
"x2":parseInt($("#objectx").val())+parseInt($("#objectw").val()),
"y2":parseInt($("#objecty").val())+parseInt($("#objecth").val()),
"width":parseInt($("#objectw").val()),
"height":parseInt($("#objecth").val()),
"strokeStyle":"green",
"type":0
}
]
});
$( function () {
$("#getrtsp").on('click', function (e) {
$.ajax({
url: "/quartz/getRtsp/"+ $("#videoid").val(),
dataType: "json",
type: "get",
success: function (result) {
if (result.code == 200) {
if(result.message.indexOf(",")>-1){
$("#executeparamter").val(result.message.split(",")[1]);
$("#rtsp").val(result.message.split(",")[1]);
$("#imgsrc").val(result.message.split(",")[0]);
draw.src=result.message.split(",")[0];
draw.setImageBackground(result.message.split(",")[0]);
//draw.init();
}
}
}
});
});
$("#updatetask").on('click', function (e) { $("#updatetask").on('click', function (e) {
var taskno = $("#taskno").val(); var taskno = $("#taskno").val();
var taskname = $("#taskname").val(); var taskname = $("#taskname").val();
...@@ -133,6 +623,7 @@ ...@@ -133,6 +623,7 @@
var lastmodifytime = $("#lastmodifytime").val(); var lastmodifytime = $("#lastmodifytime").val();
var frozentime = $("#frozentime").val(); var frozentime = $("#frozentime").val();
var unfrozentime = $("#unfrozentime").val(); var unfrozentime = $("#unfrozentime").val();
object=draw.layers[1];
$.ajax({ $.ajax({
url: "/quartz/edit/task", url: "/quartz/edit/task",
dataType: "json", dataType: "json",
...@@ -152,7 +643,17 @@ ...@@ -152,7 +643,17 @@
"createtime": createtime, "createtime": createtime,
"lastmodifytime": lastmodifytime, "lastmodifytime": lastmodifytime,
"frozentime": frozentime, "frozentime": frozentime,
"unfrozentime": unfrozentime "unfrozentime": unfrozentime,
"objectx":object.x1,
"objecty":object.y1,
"objectw":object.width,
"objecth":object.height,
"recordtype":$("#recordtype").val(),
"metatype":$("#metatype").val(),
"rtsp":$("#rtsp").val(),
"imgsrc":$("#imgsrc").val(),
"videoid":$("#videoid").val()
}, },
success: function (result) { success: function (result) {
if (result.code == 200) { if (result.code == 200) {
...@@ -168,6 +669,11 @@ ...@@ -168,6 +669,11 @@
}) })
}); });
}); });
</script> </script>
</body> </body>
</html> </html>
<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
<meta charset="UTF-8">
<title>定时任务修改</title>
<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="/quartz/edit/task" method="post">
<input type="hidden" th:value="${taskInformation.id}" name="id" id="id"/>
<input type="hidden" th:value="${taskInformation.version}" name="version" id="version"/>
<input type="hidden" th:value="${taskInformation.createtime}" name="createtime"
id="createtime"/>
<input type="hidden" th:value="${taskInformation.lastmodifytime}" name="lastmodifytime"
id="lastmodifytime"/>
<input type="hidden" th:value="${taskInformation.frozentime}" name="frozentime"
id="frozentime"/>
<input type="hidden" th:value="${taskInformation.unfrozentime}" name="unfrozentime"
id="unfrozentime"/>
<input type="hidden" th:value="${taskInformation.objectx}" name="objectx"
id="objectx"/>
<input type="hidden" th:value="${taskInformation.objecty}" name="objecty"
id="objecty"/>
<input type="hidden" th:value="${taskInformation.objectw}" name="objectw"
id="objectw"/>
<input type="hidden" th:value="${taskInformation.objecth}" name="objecth"
id="objecth"/>
<input type="hidden" th:value="${taskInformation.imgsrc}" name="imgsrc"
id="imgsrc"/>
<input type="hidden" th:value="${taskInformation.rtsp}" name="rtsp"
id="rtsp"/>
<div class="form-group"><label
class="col-sm-2 control-label text-right">任务编号:</label>
<div class="col-sm-10"><input type="text" th:value="${taskInformation.taskno}"
name="taskno"
id="taskno" class="form-control">
</div>
</div>
<div class="form-group"><label
class="col-sm-2 control-label text-right">任务名称:</label>
<div class="col-sm-10"><input type="text" th:value="${taskInformation.taskname}"
name="taskname" id="taskname"
class="form-control"></div>
</div>
<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"
th:value="${taskInformation.schedulerrule}"
id="schedulerrule"
class="form-control">
</div>
</div>
<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"
th:selected="${taskInformation.frozenstatus == 'FROZEN'}">
冻结
</option>
<option th:value="UNFROZEN"
th:selected="${taskInformation.frozenstatus == 'UNFROZEN'}">解冻
</option>
</select>
</div>
</div>
<!--<td>-->
<!--<div class="form-group"><label-->
<!--class="col-sm-2 control-label text-right">执行方:</label>-->
<!--<div class="col-sm-10"><input type="text"-->
<!--th:value="${taskInformation.executorno}"-->
<!--name="executorno" id="executorno"-->
<!--class="form-control"></div>-->
<!--</div>-->
<!--</td>-->
<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"
th:selected="${taskInformation.sendtype == 'http'}">http
</option>
<option th:value="kafka"
th:selected="${taskInformation.sendtype == 'kafka'}">
kafka
</option>
</select>
</div>
</div>
<div class="form-group"><label
class="col-sm-2 control-label text-right">监控id:</label>
</div>
<div class="form-group">
<div class="col-sm-10">
<input type="text" name="videoid" th:value="${taskInformation.videoid}"
id="videoid" class="form-control">
<a id="getrtsp" href=" javascript:void(0)">获得监控图片</a>
<canvas id="cv" width="600" height="400"
style="border:1px solid #d3d3d3;">
</canvas>
</div>
</div>
<div class="form-group"><label
class="col-sm-2 control-label text-right">事件类型:</label>
<div class="col-sm-10">
<select class="form-control" id="metatype">
<option th:value="1" th:selected="${taskInformation.metatype == '1'}">
全目标
</option>
<option th:value="2" th:selected="${taskInformation.metatype == '2'}">
行人、骑行、车辆检测识别
</option>
<option th:value="3" th:selected="${taskInformation.metatype == '3'}">
人脸检测识别
</option>
<option th:value="4" th:selected="${taskInformation.metatype == '4'}">
单独行人、骑行检测识别
</option>
<option th:value="5" th:selected="${taskInformation.metatype == '5'}">
单独车辆检测识别
</option>
<option th:value="6" th:selected="${taskInformation.metatype == '6'}">
人脸检测识别(不包含大类检测)
</option>
<option th:value="7" th:selected="${taskInformation.metatype == '7'}">
行人、骑行、人脸
</option>
</select>
</div>
</div>
<div class="form-group"><label
class="col-sm-2 control-label text-right">告警类型:</label>
<div class="col-sm-10">
<select class="form-control" id="recordtype">
<option th:value="1" th:selected="${taskInformation.recordtype == '1'}">
周界入侵
</option>
<option th:value="2" th:selected="${taskInformation.recordtype == '2'}">
人群密度
</option>
<option th:value="3" th:selected="${taskInformation.recordtype == '3'}">
周界越线
</option>
<option th:value="4" th:selected="${taskInformation.recordtype == '4'}">
非机动车未戴头盔
</option>
<option th:value="5" th:selected="${taskInformation.recordtype == '5'}">
非机动车载人
</option>
<option th:value="6" th:selected="${taskInformation.recordtype == '6'}">
结构化统计
</option>
</select>
</div>
</div>
<!--<div class="form-group"><label class="col-sm-2 control-label text-right">人群密度标准:</label>-->
<!--<div class="col-sm-10">-->
<!--<input type="text" th:value="${taskInformation.populationdensity}"-->
<!--name="executorno" id="populationdensity"-->
<!--class="form-control">-->
<!--</div>-->
<!--</div>-->
<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"
th:value="${taskInformation.url}"
id="url" class="form-control"></div>
</div>
<div class="form-group"><label
class="col-sm-2 control-label text-right">执行参数:</label>
<div class="col-sm-10"><input readonly type="text" name="executeparamter"
th:value="${taskInformation.executeparamter}"
id="executeparamter"
class="form-control"></div>
</div>
<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"
th:value="${taskInformation.timekey}"
id="timekey" class="form-control"></div>
</div>
<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="updatetask" align="right" value="保存"/>
</form>
<!--</div>-->
</div>
</div>
</div>
</div>
</div>
<script type="text/javascript" th:inline="javascript">
var layer=0;
CanvasExt = {
renderImgAndRect:function(ctx, img, imgData, canvasW, canvasH) {
let
actImgW = img.width,
actImgH = img.height,
imgW = actImgW,
imgH = actImgH,
rate = 1,
left = 0,
top = 0;
//因为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;
}
ctx.drawImage(img, left, top, imgW, imgH);
if (imgData.labelVos) drawRect(ctx, imgData.labelVos, left, top, rate);
}
drawRect:function(ctx, rectList, left, top, rate){
let colorType = sessionStorage.getItem("colorType");
let labelArr = [];
if (colorType) {
colorType = JSON.parse(colorType);
labelArr = Object.keys(colorType);
} else {
colorType = {};
}
for (let i = 0; i < rectList.length; i++) {
let rect = rectList[i];
let labelName = rect.labelName;
if (!labelArr.includes(labelName)) {
labelArr.push(labelName);
let randomColor = getRandomColor();
colorType[labelName] = randomColor;
ctx.strokeStyle = randomColor;
ctx.fillStyle = randomColor;
} else {
ctx.strokeStyle = colorType[labelName];
ctx.fillStyle = colorType[labelName];
}
let
x = rect.upperLeftCoorX / rate + left,
y = rect.upperLeftCoorY / rate + top,
w = (rect.lowerRightCoorX - rect.upperLeftCoorX) / rate,
h = (rect.lowerRightCoorY - rect.upperLeftCoorY) / rate;
ctx.strokeRect(x, y, w, h);
if (labelName) {
ctx.font = `${20 / rate}px sans-serif`;
let {confidence} = rect;
let text = confidence ? `${labelName}: ${confidence}%` : labelName;
ctx.fillText(text, x - 1, y - 10 / rate);
}
}
sessionStorage.setItem("colorType", JSON.stringify(colorType));
//鼠标点击按下事件,画图准备
canvas.onmousedown=function(e){
<!--//设置画笔颜色和宽度-->
<!--var color=that.penColor;-->
<!--var penWidth=that.penWidth;-->
<!--layerIndex++;-->
<!--layer++;-->
<!--layerName+=layerIndex;-->
x = e.clientX-canvasLeft;
y = e.clientY-canvasTop;
$("#"+canvasId).addLayer({
type: 'rectangle',
strokeStyle: color,
strokeWidth: penWidth,
name:layerName,
fromCenter: false,
x: x, y: y,
width: 1,
height: 1
});
$("#"+canvasId).drawLayers();
$("#"+canvasId).saveCanvas();
//鼠标移动事件,画图
canvas.onmousemove=function(e){
width = e.clientX-canvasLeft-x;
height = e.clientY-canvasTop-y;
$("#"+canvasId).removeLayer(layerName);
$("#"+canvasId).addLayer({
type: 'rectangle',
strokeStyle: color,
strokeWidth: penWidth,
name:layerName,
fromCenter: false,
x: x, y: y,
width: width,
height: height
});
$("#"+canvasId).drawLayers();
}
};
canvas.onmouseup=function(e){
var color=that.penColor;
var penWidth=that.penWidth;
canvas.onmousemove=null;
width = e.clientX-canvasLeft-x;
height = e.clientY-canvasTop-y;
$("#"+canvasId).removeLayer(layerName);
$("#"+canvasId).addLayer({
type: 'rectangle',
strokeStyle: color,
strokeWidth: penWidth,
name:layerName,
fromCenter: false,
x: x, y: y,
width: width,
height: height
});
$("#"+canvasId).drawLayers();
$("#"+canvasId).saveCanvas();
}
}
getRandomColor:function() {
let colorValue = "0123456789abcdef";
let randomColor = "#";
for (let i = 0; i < 6; i++) {
randomColor += colorValue[Math.floor(Math.random() * 16)];
}
return randomColor;
}
};
drawPen();
function drawPen(){
var color = "red";
var width = 1;
CanvasExt.drawRect("cv",color,width);
}
function initCanvas(imgData) {
var cvs =document.getElementById("cv");
var ctx = cvs.getContext('2d'),
canvasW = cvs.width,
canvasH = cvs.height;
ctx.clearRect(0, 0, canvasW, canvasH);
ctx.lineWidth = '2';
let img = new Image();
img.src = imgData;
img.onload = function () {
renderImgAndRect(ctx, img, imgData, canvasW, canvasH)
};
}
$( function () {
<!--initCanvas($("#imgsrc").val());-->
$("#getrtsp").on('click', function (e) {
$.ajax({ url: "/quartz/getRtsp/"+ $("#videoid").val(),
dataType: "json",
type: "get",
success: function (result) {
if (result.code == 200) {
if(result.message.indexOf(",")>-1){
$("#executeparamter").val(result.message.split(",")[1]);
$("#rtsp").val(result.message.split(",")[1]);
$("#imgsrc").val(result.message.split(",")[0]);
draw.src=result.message.split(",")[0];
draw.setImageBackground(result.message.split(",")[0]);
draw.init();
}
}
}
});
$.ajax({
url: "http://212.129.142.17:8281/gh/device/test?deviceCode="+$("#videoid").val(),
async: false,
dataType: "jsonp",
jsonp: "callback",
jsonpCallback: "callback",
success: function (result) {
if (result.code == 200) {
}
}
});
});
$("#updatetask").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();
var id = $("#id").val();
var version = $("#version").val();
var createtime = $("#createtime").val();
var lastmodifytime = $("#lastmodifytime").val();
var frozentime = $("#frozentime").val();
var unfrozentime = $("#unfrozentime").val();
object=draw.layers[0];
$.ajax({
url: "/quartz/edit/task",
dataType: "json",
type: "POST",
data: {
"taskno": taskno,
"taskname": taskname,
"schedulerrule": schedulerrule,
"frozenstatus": frozenstatus,
"executorno": executorno,
"sendtype": sendtype,
"url": url,
"executeparamter": executeparamter,
"timekey": timekey,
"id": id,
"version": version,
"createtime": createtime,
"lastmodifytime": lastmodifytime,
"frozentime": frozentime,
"unfrozentime": unfrozentime,
"objectx":object.x1,
"objecty":object.y1,
"objectw":object.width,
"objecth":object.height,
"recordtype":$("#recordtype").val(),
"metatype":$("#metatype").val(),
"rtsp":$("#rtsp").val(),
"imgsrc":$("#imgsrc").val(),
"videoid":$("#videoid").val()
},
success: function (result) {
if (result.code == 200) {
alert("更新成功!");
location.href = "/";
} else if (result.code == 1002) {
alert("更新失败!");
}
else {
alert("system error");
}
}
})
});
});
</script>
</body>
</html>
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