Commit 793e5ae2 authored by wangjinjing's avatar wangjinjing

图片画框

parent 6287b042
......@@ -153,6 +153,16 @@
<artifactId>fastjson</artifactId>
<version>1.2.28</version>
</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>
......
......@@ -30,6 +30,89 @@ public class QuartzTaskInformations {
private String executeparamter;
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() {
return id;
......
package com.cx.cn.cxquartz.controller;
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;
......@@ -11,14 +12,17 @@ import org.apache.commons.lang.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
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.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.client.RestTemplate;
import javax.servlet.http.HttpServletRequest;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@Controller
@RequestMapping("/quartz")
......@@ -29,7 +33,14 @@ public class QuartzController {
@Autowired
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)
public String addTaskpage() {
......@@ -155,5 +166,34 @@ public class QuartzController {
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;
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.QuartzTaskRecordsService;
import com.cx.cn.cxquartz.util.ResultEnum;
import com.cx.cn.cxquartz.util.ResultUtil;
import com.cx.cn.cxquartz.vo.QuartzTaskRecordsVo;
......@@ -31,7 +32,6 @@ public class SbtdspsrController {
@RequestMapping(value = "/getSbtdspsrbyrtsp", method = RequestMethod.GET)
public String addTaskpage() {
return "addtask";
......@@ -42,6 +42,8 @@ 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);
......@@ -60,7 +62,13 @@ public class SbtdspsrController {
@RequestMapping(value = "/edit/task", method = RequestMethod.POST)
public String editTask(QuartzTaskInformations taskInformations) {
try {
QuartzTaskInformations resultTaskInformations= quartzService.getTaskById(taskInformations.getTaskno());
String result = quartzService.updateTask(taskInformations);
//判断corn 是否改变,改变重新生成任务
if(!resultTaskInformations.getSchedulerrule().equals(taskInformations.getSchedulerrule())) {
//重新启动,重新发布新的任务
quartzService.startJob(taskInformations.getTaskno());
}
return result;
} catch (Exception e) {
logger.error("/edit/task exception={}", e);
......
......@@ -6,9 +6,10 @@ import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
import java.util.Map;
@Mapper
public interface SbtdspsrMapper {
List<Sbtdspsr> selectByRtsp( String rtsp);
List<String> selectRecogByRtsp( String rtsp);
List<Map> selectRecogByRtsp(String rtsp);
}
package com.cx.cn.cxquartz.service.quartz;
import java.util.List;
import java.util.Map;
public interface SbtdspsrService {
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;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.Map;
@Service
public class SbtdspsrImpl implements SbtdspsrService {
......@@ -21,7 +22,7 @@ public class SbtdspsrImpl implements SbtdspsrService {
}
@Override
public List<String> selectRecogByRtsp(String rtsp) {
public List<Map> selectRecogByRtsp(String rtsp) {
return sbtdspsrMapper.selectRecogByRtsp(rtsp);
}
......
......@@ -28,13 +28,13 @@ public class AdminInterceptor implements HandlerInterceptor {
// System.out.println("执行了TestInterceptor的preHandle方法");
try {
//统一拦截(查询当前session是否存在user)(这里user会在每次登陆成功后,写入session)
String token = (String) request.getSession().getAttribute("token");
RestTemplate restTemplate = new RestTemplate();
HttpHeaders headers = new HttpHeaders();
headers.setContentType(MediaType.APPLICATION_FORM_URLENCODED);
ResponseEntity<String> result = null;
//
// //统一拦截(查询当前session是否存在user)(这里user会在每次登陆成功后,写入session)
// String token = (String) request.getSession().getAttribute("token");
// RestTemplate restTemplate = new RestTemplate();
// HttpHeaders headers = new HttpHeaders();
// headers.setContentType(MediaType.APPLICATION_FORM_URLENCODED);
// ResponseEntity<String> result = null;
// if (null == token) {
// //登录
......
......@@ -142,28 +142,28 @@ public class FileTransferManager {
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();
param.setOutput(new Output(1, 1, -1, 3));
param.setModel(model);
param.setApiout("1");////打开1400标准输出,默认可以不填
List<ImageList> list = new ArrayList<>();
getImageList("1", base64Encoder, list, transferRecord.getImg1path());
getImageList("2", base64Encoder, list, transferRecord.getImg2path());
getImageList("3", base64Encoder, list, transferRecord.getImg3path());
getImageList("4", base64Encoder, list, transferRecord.getImg4path());
getImageList("5", base64Encoder, list, transferRecord.getImg5path());
getImageList("1",roiarray, base64Encoder, list, transferRecord.getImg1path());
getImageList("2", roiarray,base64Encoder, list, transferRecord.getImg2path());
getImageList("3", roiarray,base64Encoder, list, transferRecord.getImg3path());
getImageList("4",roiarray, base64Encoder, list, transferRecord.getImg4path());
getImageList("5", roiarray,base64Encoder, list, transferRecord.getImg5path());
param.setImageList(list);
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)) {
byte[] Img = FTPUtil.getFtpPicBytes(img1path);
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;
import com.alibaba.fastjson.annotation.JSONField;
import com.fasterxml.jackson.annotation.JsonIgnore;
import java.util.List;
public class ImageList {
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
private int Format;
......@@ -16,6 +65,16 @@ public class ImageList {
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){
this.ImageID = ImageID;
}
......
......@@ -57,7 +57,15 @@ public class Traffpicture{
private String index;
private Integer targetnum;
public Integer getTargetnum() {
return targetnum;
}
public void setTargetnum(Integer targetnum) {
this.targetnum = targetnum;
}
public String getImageid() {
return imageid;
......
......@@ -11,10 +11,10 @@ mybatis:
spring:
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
#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
password: 123456
driver-class-name: com.mysql.jdbc.Driver
......
......@@ -2,6 +2,10 @@ file.uploadpath=D:\\imp\\VideoPic
file.alarmpath=D:\\imp\\VideoPic
file.recordurl=http://www.zjwwzf.cn/xzzfSpv/ext/patrolCtrlRecord
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://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
redis.cachekey.ftplist=gs:traff:global:cache:ftplist
file.getrtspbyurl=http://212.129.142.17:8281/gh/device/test
......@@ -17,6 +17,16 @@
<result column="url" property="url" jdbcType="VARCHAR"/>
<result column="executeParamter" property="executeparamter" 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 id="PicResultMap" type="com.cx.cn.cxquartz.bean.PictureTime">
<id column="deviceid" property="deviceid" jdbcType="VARCHAR"/>
......@@ -31,7 +41,8 @@
<sql id="Base_Column_List">
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>
<select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Long">
select
......@@ -48,13 +59,23 @@
taskName, schedulerRule, frozenStatus,
executorNo, frozenTime, unfrozenTime,
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},
#{taskname,jdbcType=VARCHAR}, #{schedulerrule,jdbcType=VARCHAR}, #{frozenstatus,jdbcType=VARCHAR},
#{executorno,jdbcType=VARCHAR}, #{frozentime,jdbcType=BIGINT}, #{unfrozentime,jdbcType=BIGINT},
#{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 id="insertSelective" parameterType="com.cx.cn.cxquartz.bean.QuartzTaskInformations">
......@@ -105,6 +126,35 @@
<if test="timekey != null">
timeKey,
</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 prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">
......@@ -152,6 +202,36 @@
<if test="timekey != null">
#{timekey,jdbcType=VARCHAR},
</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>
</insert>
<update id="updateByPrimaryKeySelective"
......@@ -200,8 +280,36 @@
<if test="timekey != null">
timeKey = #{timekey,jdbcType=VARCHAR},
</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>
where id = #{id,jdbcType=BIGINT} and version = #{version}
where id = #{id,jdbcType=BIGINT}
</update>
<update id="updateByPrimaryKey" parameterType="com.cx.cn.cxquartz.bean.QuartzTaskInformations">
update quartz_task_informations
......@@ -218,7 +326,16 @@
sendType = #{sendtype,jdbcType=VARCHAR},
url = #{url,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}
</update>
......
......@@ -11,8 +11,8 @@
select sbbh,tdbh,xzbh from sbtdspsr where squrllj = #{rtsp}
</select>
<select id="selectRecogByRtsp" parameterType="java.lang.String" resultType="java.lang.String">
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 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>
......
This diff is collapsed.
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