Commit 89a55bb0 authored by yzm's avatar yzm

文件上传到本地,并且推送给dx

parent b312fd59
......@@ -12,7 +12,7 @@
<artifactId>VideoofCultural</artifactId>
<version>1.0</version>
<packaging>jar</packaging>
<description>视频截图推送</description>
<description>文物局视频截图推送</description>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
......@@ -60,6 +60,7 @@
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
......@@ -67,12 +68,6 @@
<artifactId>commons-lang3</artifactId>
<version>3.6</version>
</dependency>
<dependency>
<groupId>commons-httpclient</groupId>
<artifactId>commons-httpclient</artifactId>
<version>3.1</version>
</dependency>
<dependency>
<groupId>net.sf.json-lib</groupId>
......@@ -136,18 +131,27 @@
<artifactId>commons-net</artifactId>
<version>3.6</version>
</dependency>
<dependency>
<groupId>org.java-websocket</groupId>
<artifactId>Java-WebSocket</artifactId>
<version>1.3.8</version>
</dependency>
<!-- redis -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-redis</artifactId>
</dependency>
<!--kafka依赖-->
<dependency>
<groupId>org.springframework.kafka</groupId>
<artifactId>spring-kafka</artifactId>
</dependency>
<!-- HttpClient依赖 -->
<dependency>
<groupId>commons-httpclient</groupId>
<artifactId>commons-httpclient</artifactId>
<version>3.1</version>
</dependency>
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>fastjson</artifactId>
......@@ -156,12 +160,7 @@
<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>
<artifactId>spring-boot-starter-mail</artifactId>
</dependency>
</dependencies>
......
......@@ -25,7 +25,7 @@ public class ScheduleTaskConfig {
/***
* 每隔20分钟执行一遍判断rtsp 是否变换
*/
@Scheduled(cron = "0 0 2 * * ? ")
// @Scheduled(cron = "0 0 2 * * ? ")
private void statis() {
//查询所有监控设备,更新rtsp 地址
List<Sbtdspsr> sbtdpsrList= sbtdspsrService.list();
......
package com.cx.cn.cxquartz.config;
import com.cx.cn.cxquartz.job.WebSocket;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.socket.server.standard.ServerEndpointExporter;
@Configuration
public class WebSocketConfig {
/**
* ServerEndpointExporter 作用
*
* 这个Bean会自动注册使用@ServerEndpoint注解声明的websocket endpoint
*
* @return
*/
@Bean
public ServerEndpointExporter serverEndpointExporter() {
return new ServerEndpointExporter();
}
}
\ No newline at end of file
......@@ -7,12 +7,8 @@ import com.cx.cn.cxquartz.bean.QuartzTaskInformations;
import com.cx.cn.cxquartz.service.quartz.FtpService;
import com.cx.cn.cxquartz.service.quartz.QuartzService;
import com.cx.cn.cxquartz.service.quartz.SbtdspsrService;
import com.cx.cn.cxquartz.util.FTPUtil;
import com.cx.cn.cxquartz.util.FileTransferManager;
import com.cx.cn.cxquartz.util.ResultEnum;
import com.cx.cn.cxquartz.util.ResultUtil;
import com.cx.cn.cxquartz.vo.Ftp;
import com.cx.cn.cxquartz.vo.QuartzTaskRecordsVo;
import com.cx.cn.cxquartz.util.*;
import com.cx.cn.cxquartz.vo.*;
import org.apache.commons.lang.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
......@@ -30,7 +26,7 @@ import java.util.List;
import java.util.Map;
@Controller
@RequestMapping("/quartz")
@RequestMapping("/ai")
public class QuartzController {
private static final Logger logger = LoggerFactory.getLogger(QuartzController.class);
......@@ -76,6 +72,91 @@ public class QuartzController {
}
}
@PostMapping("/task")
@ResponseBody
public TaskResultObj scheduleJob(@RequestBody JobParam jobParam) {
String taskno="fx_" + jobParam.getDeviceId() + "_" + jobParam.getDetectType();
QuartzTaskInformations taskInformations = new QuartzTaskInformations();
taskInformations.setExecuteparamter(jobParam.getDeviceId());
taskInformations.setMetatype(jobParam.getDetectType());
//查询是否有抽帧服务
// List<QuartzTaskInformations> tasks = quartzService.getTaskSByDeviceCode(jobParam.getDeviceId());
// Map<String, Integer> map = getTaskCzAndFxNumer(tasks);
//Integer cznum = map.get("cznum");
//Integer fxnum = map.get("fxnum");
Long[] roiarray=new Long[4];
if ("0".equals(jobParam.getType())) {//0新增 1开启 2停止 3删除
//判断是否存在抽帧任务,存在则直接新增分析任务,不存在则新增
taskInformations.setFrozenstatus("UNFROZEN");
taskInformations.setSchedulerrule("*/" + jobParam.getParams().get("schedulerRule").toString() + " * * * * ?");
List<Point> listpoint=jobParam.getArea();
PointUtil.getXYWH(listpoint,roiarray);
taskInformations.setObjectx(roiarray[0]);
taskInformations.setObjecty(roiarray[1]);
taskInformations.setObjectw(roiarray[2]);
taskInformations.setObjecth(roiarray[3]);
taskInformations.setMetatype( jobParam.getParams().get("thresholdValue").toString());
taskInformations.setUrl(jobParam.getCallBackUrl());
taskInformations.setExecutorno(taskno);
taskInformations.setTaskno(taskInformations.getExecutorno());
taskInformations.setTaskname(jobParam.getName());
taskInformations.setVideoid(jobParam.getDeviceId() );
taskInformations.setRecordtype(jobParam.getDetectType());
String result = quartzService.addTask(taskInformations);
//查询是否有抽帧服务
//if (cznum == 0) {
// taskInformations.setExecutorno("cz_" + jobParam.getDeviceId() + "_" + jobParam.getDetectType());
// taskInformations.setTaskno(taskInformations.getExecutorno());
// quartzService.addTask(taskInformations);
// }
} else if ("1".equals(jobParam.getType()))//开启
{
try {
quartzService.startOrStopJob(taskno,"UNFROZEN");
} catch (Exception ex) {
}
} else if ("2".equals(jobParam.getType()) ) {//停止
//一抽帧多分析,停止不停抽帧服务
try {
quartzService.startOrStopJob(taskno, "FROZEN");
} catch (Exception ex) {
}
} else if ("3".equals(jobParam.getType())) {//删除
//一抽帧多分析,停止不停抽帧服务
try {
quartzService.startOrStopJob(taskno, "FROZEN");
quartzService.deletetask(taskno);
} catch (Exception ex) {
}
//quartzService.("fx_" + jobParam.getDeviceId() + "_" + jobParam.getDetectType(), fxnum);
}
return TaskResultObj.ok();
}
public Map getTaskCzAndFxNumer(List<QuartzTaskInformations> tasks) {
Map<String, Integer> map = new HashMap();
int cznum = 0, fxnum = 0;
if (tasks.size() > 0) {
//一抽多分析
for (QuartzTaskInformations item : tasks) {
if (item.getTaskno().contains("cz")) {
cznum++;
} else if (item.getTaskno().contains("fx")) {
fxnum++;
}
}
}
map.put("cznum", cznum);
map.put("fxnum", fxnum);
return map;
}
@RequestMapping(value = "/edit/taskpage", method = RequestMethod.GET)
public String editTaskpage(Model model, String id) {
QuartzTaskInformations taskInformation = quartzService.getTaskById(id);
......@@ -90,7 +171,7 @@ public class QuartzController {
try {
taskInformations.setSchedulerrule("*/" + taskInformations.getSchedulerrule() + " * * * * ?");
String result = quartzService.updateTask(taskInformations);
if(null!=taskInformations.getExecuteparamter() && !taskInformations.getExecuteparamter().contains("rtsp:")) {
if (null != taskInformations.getExecuteparamter() && !taskInformations.getExecuteparamter().contains("rtsp:")) {
int upresult = sbtdspsrService.updateRecogByRtsp(taskInformations.getRtsp(), taskInformations.getVideoid());
if (upresult > 0) {
......@@ -219,17 +300,17 @@ public class QuartzController {
ResponseEntity<String> result = restTemplate.exchange(rtspurl + "?url={rtspvalue}&refresh={refresh}",
HttpMethod.GET, null, String.class, maps);
JSONObject jsonresult = JSONObject.parseObject(result.getBody());
logger.info("getRtsp:{}",jsonresult);
logger.info("getRtsp:{}", jsonresult);
if (null != jsonresult.getString("ret") && jsonresult.getString("ret").equals("0") && !"".equals(jsonresult.getString("url"))) {
//获得图片地址,存放到ftp上面
//将图片存储到ftp 上去,jsonresult.getString("url")
Ftp ftp = ftpService.reloadFtp();
String ftpfilepath=FileTransferManager.urlTransToFtp(jsonresult.getString("url"),ftp,"gstraff/picturedemo/");
logger.info("ftppath"+ftpfilepath);
ftpfilepath=ftpfilepath.replace("ftp://"+ftppath+"/","");
String ftpfilepath = FileTransferManager.urlTransToFtp(jsonresult.getString("url"), ftp, "gstraff/picturedemo/");
logger.info("ftppath" + ftpfilepath);
ftpfilepath = ftpfilepath.replace("ftp://" + ftppath + "/", "");
// return ResultUtil.success(ResultEnum.SUCCESS.getCode(), jsonresult.getString("url")+ "," + rtspValue);
return ResultUtil.success(ResultEnum.SUCCESS.getCode(), ftpfilepath+ "," + rtspValue);
return ResultUtil.success(ResultEnum.SUCCESS.getCode(), ftpfilepath + "," + rtspValue);
}
return ResultUtil.fail();
} catch (Exception ex) {
......
......@@ -43,4 +43,7 @@ public interface QuartzTaskInformationsMapper {
List<Sbtdspsr> selectByRtsp(String rtsp);
Integer UpdateExecuteParam(Map map);
List<QuartzTaskInformations> getTaskSByDeviceCode(String devicecode);
Integer deletetask(String tasKno);
}
package com.cx.cn.cxquartz.dao;
import com.cx.cn.cxquartz.bean.QuartzTaskInformations;
import com.cx.cn.cxquartz.vo.Sbtdspsr;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
......@@ -12,6 +13,6 @@ import java.util.Map;
public interface SbtdspsrMapper {
List<Sbtdspsr> selectByRtsp( String rtsp);
List<Sbtdspsr> list( );
List<Map> selectRecogByRtsp(String rtsp);
List<QuartzTaskInformations> selectRecogByRtsp(String rtsp);
int updateRecogByRtsp(Map map);
}
......@@ -12,6 +12,7 @@ import org.apache.commons.lang.StringUtils;
import org.quartz.*;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Value;
import java.util.concurrent.atomic.AtomicInteger;
......@@ -22,6 +23,11 @@ public class QuartzMainJobFactory implements Job {
private AtomicInteger atomicInteger;
@Value("${local.czurl}")
private String czurl;
@Value("${local.fxurl}")
private String fxurl;
@Override
public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
atomicInteger = new AtomicInteger(0);
......@@ -43,9 +49,9 @@ public class QuartzMainJobFactory implements Job {
return;
}
if (ResultEnum.HTTP.getMessage().equals(sendType)) {
//if (ResultEnum.HTTP.getMessage().equals(sendType)) {
try {
String result = HttpClientUtil.doPost(url, "text/json", executeParameter);
String result = HttpClientUtil.doPost(taskNo.contains("cz_") ? czurl : fxurl, "text/json", executeParameter);
logger.info("taskNo={},sendtype={}执行结果result{}", taskNo, sendType, result);
if (StringUtils.isEmpty(result)) {
throw new RuntimeException("taskNo=" + taskNo + "http方式返回null");
......@@ -54,16 +60,16 @@ public class QuartzMainJobFactory implements Job {
logger.error("");
throw ex;
}
} else if (ResultEnum.KAFKA.getMessage().equals(sendType)) {
try {
String message = new StringBuffer(taskNo).append(":").append(id).append(":").append(executeParameter).toString();
quartzService.sendMessage(message);
logger.info("taskNo={},sendtype={}推送至kafka成功", taskNo, sendType);
} catch (Exception ex) {
logger.error("");
throw ex;
}
}
// } else if (ResultEnum.KAFKA.getMessage().equals(sendType)) {
// try {
// String message = new StringBuffer(taskNo).append(":").append(id).append(":").append(executeParameter).toString();
// quartzService.sendMessage(message);
// logger.info("taskNo={},sendtype={}推送至kafka成功", taskNo, sendType);
// } catch (Exception ex) {
// logger.error("");
// throw ex;
// }
// }
} catch (Exception ex) {
logger.error("");
atomicInteger.incrementAndGet();
......
......@@ -21,6 +21,7 @@ public interface QuartzService {
String startJob(String taskNo) throws SchedulerException;
String startOrStopJob(String taskNo,String status) throws SchedulerException;
void initLoadOnlineTasks();
......@@ -48,4 +49,7 @@ public interface QuartzService {
List< PatrolCtrlRecord> queryCameraCode(List<String> ids);
List<QuartzTaskInformations> getTaskSByDeviceCode(String devicecode);
Integer deletetask(String taskno);
}
......@@ -35,4 +35,9 @@ public interface QuartzTaskInformationsService {
List<PictureTime> findLastPicTime();
List< PatrolCtrlRecord> queryCameraCode(List<String> ids);
List<QuartzTaskInformations> getTaskSByDeviceCode(String devicecode);
Integer deletetask(String taskno);
}
package com.cx.cn.cxquartz.service.quartz;
import com.cx.cn.cxquartz.bean.QuartzTaskInformations;
import com.cx.cn.cxquartz.vo.Sbtdspsr;
import java.util.List;
......@@ -7,7 +8,7 @@ import java.util.Map;
public interface SbtdspsrService {
List<Sbtdspsr> selectByRtsp(String videoid);
List<Map> selectRecogByRtsp(String rtsp);
List<QuartzTaskInformations> selectRecogByRtsp(String rtsp);
int updateRecogByRtsp(String rtsp,String devicecode);
List<Sbtdspsr> list();
}
......@@ -19,6 +19,7 @@ import org.slf4j.LoggerFactory;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.kafka.core.KafkaTemplate;
import org.springframework.scheduling.quartz.SchedulerFactoryBean;
import org.springframework.stereotype.Service;
......@@ -52,6 +53,10 @@ public class QuartzServiceImpl implements QuartzService, InitializingBean {
@Autowired
private SchedulerFactoryBean schedulerBean;
@Value("${local.czurl}")
private String czurl;
@Value("${local.fxurl}")
private String fxurl;
/**
* 列表查询所有定时任务
*
......@@ -128,6 +133,32 @@ public class QuartzServiceImpl implements QuartzService, InitializingBean {
return ResultUtil.success(ResultEnum.SUCCESS.getCode(), ResultEnum.SUCCESS.getMessage());
}
public String startOrStopJob(String taskNo,String status) throws SchedulerException {
QuartzTaskInformations quartzTaskInformation = quartzTaskInformationsService.getTaskByTaskNo(taskNo);
if (quartzTaskInformation == null) {
return ResultUtil.success(ResultEnum.NO_DATA.getCode(), ResultEnum.NO_DATA.getMessage());
}
Scheduler scheduler = schedulerBean.getScheduler();
long currentTimeMillis = System.currentTimeMillis();
QuartzTaskInformations task = new QuartzTaskInformations();
task.setId(quartzTaskInformation.getId());
task.setVersion(quartzTaskInformation.getVersion());
//说明要暂停
scheduler.deleteJob(new JobKey(taskNo));
if (ResultEnum.UNFROZEN.name().equals(status)) {
task.setFrozentime(currentTimeMillis);
task.setFrozenstatus(ResultEnum.UNFROZEN.name());
//说明要启动
} else if (ResultEnum.FROZEN.name().equals(status)) {
this.schedule(quartzTaskInformation, scheduler);
task.setUnfrozentime(currentTimeMillis);
task.setFrozenstatus(ResultEnum.FROZEN.name());
}
task.setLastmodifytime(currentTimeMillis);
quartzTaskInformationsService.updateStatusById(task);
logger.info("taskNo={},taskName={},scheduleRule={},任务{}成功", quartzTaskInformation.getTaskno(), quartzTaskInformation.getTaskname(), quartzTaskInformation.getSchedulerrule(), ResultEnum.FROZEN.name().equals(status) ? "启动" : "暂停");
return ResultUtil.success(ResultEnum.SUCCESS.getCode(), ResultEnum.SUCCESS.getMessage());
}
/**
* 初始化加载定时任务
*
......@@ -293,28 +324,28 @@ public class QuartzServiceImpl implements QuartzService, InitializingBean {
return ResultUtil.success(ResultEnum.RUN_NOW_FAIL.getCode(), ResultEnum.RUN_NOW_FAIL.getMessage());
}
if (ResultEnum.HTTP.getMessage().equals(sendType)) {
// if (ResultEnum.HTTP.getMessage().equals(sendType)) {
try {
//将抽取的时间段获得,如果是没有规则,全抽所有。、
//如果是当天上午八点,就抽当天8点之前喝前一天的3点之后0 30 8 ? * *
HttpClientUtil.doPost(url, "text/json", executeParameter);
HttpClientUtil.doPost(taskNo.contains("cz_") ? czurl : fxurl, "text/json", executeParameter);
logger.info("");
} catch (Exception ex) {
logger.error("");
atomicInteger.incrementAndGet();
throw ex;
}
} else if (ResultEnum.KAFKA.getMessage().equals(sendType)) {
try {
String message = new StringBuffer(taskNo).append(":").append(executeParameter).toString();
this.sendMessage(message);
} catch (Exception ex) {
logger.error("");
atomicInteger.incrementAndGet();
throw ex;
}
}
// } else if (ResultEnum.KAFKA.getMessage().equals(sendType)) {
// try {
// String message = new StringBuffer(taskNo).append(":").append(executeParameter).toString();
// this.sendMessage(message);
// } catch (Exception ex) {
// logger.error("");
// atomicInteger.incrementAndGet();
// throw ex;
// }
// }
} catch (Exception ex) {
logger.error("");
atomicInteger.incrementAndGet();
......@@ -355,5 +386,15 @@ public class QuartzServiceImpl implements QuartzService, InitializingBean {
public List< PatrolCtrlRecord> queryCameraCode(List<String> ids){
return quartzTaskInformationsService.queryCameraCode(ids);
}
@Override
public List<QuartzTaskInformations> getTaskSByDeviceCode(String devicecode) {
return quartzTaskInformationsService.getTaskSByDeviceCode(devicecode);
}
@Override
public Integer deletetask(String taskno) {
return quartzTaskInformationsService.deletetask(taskno);
}
}
......@@ -121,4 +121,14 @@ public class QuartzTaskInformationsServiceImpl implements QuartzTaskInformations
public List<PatrolCtrlRecord> queryCameraCode(List<String> ids){
return quartzTaskInformationsMapper.queryCameraCode(ids);
}
@Override
public List<QuartzTaskInformations> getTaskSByDeviceCode(String devicecode) {
return quartzTaskInformationsMapper.getTaskSByDeviceCode(devicecode);
}
@Override
public Integer deletetask(String taskno) {
return quartzTaskInformationsMapper.deletetask(taskno);
}
}
......@@ -2,6 +2,7 @@ package com.cx.cn.cxquartz.service.quartz.impl;
import com.alibaba.fastjson.JSONObject;
import com.cx.cn.cxquartz.bean.QuartzTaskInformations;
import com.cx.cn.cxquartz.dao.SbtdspsrMapper;
import com.cx.cn.cxquartz.service.quartz.SbtdspsrService;
import com.cx.cn.cxquartz.vo.Sbtdspsr;
......@@ -26,7 +27,7 @@ public class SbtdspsrImpl implements SbtdspsrService {
}
@Override
public List<Map> selectRecogByRtsp(String rtsp) {
public List<QuartzTaskInformations> selectRecogByRtsp(String rtsp) {
return sbtdspsrMapper.selectRecogByRtsp(rtsp);
}
......
......@@ -26,10 +26,10 @@ public class TokenCacheService {
@Autowired
private StringRedisTemplate stringRedisTemplate;
@Value("${eventwrite.token}")
@Value("${countryside.eventwrite.token}")
private String qztoken;
@Value("${eventwrite.expiretoken}")
@Value("${countryside.eventwrite.expiretoken}")
private String expiretoken;
@Value("${countryside.appid}")
......
......@@ -13,6 +13,8 @@ public class DateUtils {
private static final DateTimeFormatter YMDHMS = DateTimeFormat.forPattern("yyyyMMddHHmmss");
private static final DateTimeFormatter YMD = DateTimeFormat.forPattern("yyyyMMdd");
private static final DateTimeFormatter Y_M_D = DateTimeFormat.forPattern("yyyy-MM-dd");
private static final DateTimeFormatter YM= DateTimeFormat.forPattern("yyyyMM");
private static final DateTimeFormatter DD= DateTimeFormat.forPattern("dd");
public static String formatCurrDate(){
return formatCurrDateByType(YMD_HMS);
}
......@@ -29,6 +31,12 @@ public class DateUtils {
return formatCurrDateByType(YMD);
}
public static String formatCurrDayYM(){
return formatCurrDateByType(YM);
}
public static String formatCurrDayDD(){
return formatCurrDateByType(DD);
}
public static Date parseDate(String date){
return DateTime.parse(date,YMD_HMS).toDate();
}
......
......@@ -19,64 +19,44 @@ import java.util.concurrent.ExecutorCompletionService;
import java.util.concurrent.TimeUnit;
public class FileTransferManager {
private static CompletionService<TransferResult> completionService = new ExecutorCompletionService<TransferResult>(ThreadPoolUtil.getPool());
private static CompletionService<String> completionService = new ExecutorCompletionService<String>(ThreadPoolUtil.getPool());
private static CompletionService<String> threadService = new ExecutorCompletionService<String>(ThreadPoolUtil.getPool());
private static final Logger log = LoggerFactory.getLogger(ExtController.class);
/**
* @param transferRecord
* @param ftp
* @param basePath
* @return
* @throws Exception
*/
public static List<TransferResult> transferFile(final Map<String, Object> transferRecord, final Ftp ftp, final String basePath) throws Exception {
Integer ret = 0;
final Long recordid = Long.parseLong(transferRecord.get("recordid").toString());
int count = 0;
for (String key : transferRecord.keySet()) {
if (key.equals("img1path") || key.equals("img2path")
|| key.equals("img3path") || key.equals("img4path")
|| key.equals("img5path")) {
final String url = transferRecord.get(key).toString();
count++;
public static void transferFile(final TraffAlarmRecord traffAlarmRecord, final Ftp ftp, final String basePath) throws Exception {
final Long recordid = traffAlarmRecord.getRecordid();
String fileName = DateUtils.formatCurrDayNoSign() + "_" + recordid + "_img1.jpg";
String ftputl = FTPUtil.getFtpUrl(ftp) + basePath + "/" + fileName;
traffAlarmRecord.setImg1path(ftputl);
completionService.submit(() -> {
TransferResult result = new TransferResult(recordid, key, url, "", false);
try {
String filesuff = "videopath".equals(key) ? ".mp4" : ".jpg";
HttpURLConnection connection = (HttpURLConnection) new URL(url).openConnection();
HttpURLConnection connection = (HttpURLConnection) new URL(traffAlarmRecord.getImg1urlfrom()).openConnection();
connection.setReadTimeout(2000); //延迟连接
connection.setConnectTimeout(3000);
connection.setRequestMethod("GET");
if (connection.getResponseCode() == HttpURLConnection.HTTP_OK || connection.getResponseCode()==HttpURLConnection.HTTP_NOT_MODIFIED) {
if (connection.getResponseCode() == HttpURLConnection.HTTP_OK || connection.getResponseCode() == HttpURLConnection.HTTP_NOT_MODIFIED) {
InputStream inputStream = connection.getInputStream();
String pname = DateUtils.formatCurrDayNoSign() + "_" + recordid + "_0000_" + key.replace("path", "");
String fileName = pname + filesuff;
String ftputl = FTPUtil.getFtpUrl(ftp) + basePath + "/" + fileName;
boolean r = FTPUtil.uploadFile(ftp, basePath, fileName, inputStream);
result.setResult(r);
if (r) {
result.setImgpath(ftputl);
log.info(" ftpupload success:{}", ftputl);
}
// log.info("callable thread:" +result.toString());
} else {
log.error("connection code: " + connection.getResponseCode() + " ," + result.toString());
log.error("connection code: " + connection.getResponseCode());
}
} catch (IOException e) {
System.out.println(e.toString());
log.error(e.toString());
}
return result;
});
log.error("ftputl connection error:{}", e.toString());
return "0";
}
return "1";
}
List<TransferResult> listret = new ArrayList<>();
for (int i = 0; i < count; i++) {
listret.add(completionService.poll(10, TimeUnit.SECONDS).get());
);
}
return listret;
}
public static void fetchUrlsFromRecord(TraffAlarmRecord record, Map<String, Object> transferRecord) {
if (record == null || record.getRecordid() == null) {
......@@ -87,26 +67,6 @@ public class FileTransferManager {
if (record.getImg1path() == null && record.getImg1urlfrom() != null) {
transferRecord.put("img1path", record.getImg1urlfrom());
}
if (record.getImg2path() == null && record.getImg2urlfrom() != null) {
transferRecord.put("img2path", record.getImg2urlfrom());
}
if (record.getImg3path() == null && record.getImg3urlfrom() != null) {
transferRecord.put("img3path", record.getImg3urlfrom());
}
if (record.getImg4path() == null && record.getImg4urlfrom() != null) {
transferRecord.put("img4path", record.getImg4urlfrom());
}
if (record.getImg5path() == null && record.getImg5urlfrom() != null) {
transferRecord.put("img5path", record.getImg5urlfrom());
}
if (record.getVideopath() == null && record.getVideourlfrom() != null) {
transferRecord.put("videopath", record.getVideourlfrom());
}
}
public static TraffAlarmRecord traffAlarmRecordUrlUpdate(List<TransferResult> results) throws Exception {
......@@ -118,18 +78,6 @@ public class FileTransferManager {
case "img1path":
record.setImg1path(result.getImgpath());
break;
case "img2path":
record.setImg2path(result.getImgpath());
break;
case "img3path":
record.setImg3path(result.getImgpath());
break;
case "img4path":
record.setImg4path(result.getImgpath());
break;
case "img5path":
record.setImg5path(result.getImgpath());
break;
case "videopath":
record.setVideopath(result.getImgpath());
break;
......@@ -148,27 +96,26 @@ public class FileTransferManager {
param.setModel(model);
param.setApiout("1");////打开1400标准输出,默认可以不填
List<ImageList> list = new ArrayList<>();
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());
getImageList("1", roiarray, base64Encoder, list, transferRecord.getImg1path());
param.setImageList(list);
return param;
}
private static void getImageList(String id,Long[] roiarray, 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,roiarray,20,1,20,100,base64Encoder.encode(Img).replaceAll("\r|\n", "")));
list.add(new ImageList(id, roiarray, 10, 1, 20, 100, base64Encoder.encode(Img).replaceAll("\r|\n", "")));
}
}
}
public static String urlTransToFtp(String url, final Ftp ftp, final String basePath){
public static String urlTransToFtp(String url, final Ftp ftp, final String basePath) {
threadService.submit(() -> {
try {
......@@ -176,11 +123,11 @@ public class FileTransferManager {
connection.setReadTimeout(2000); //延迟连接
connection.setConnectTimeout(3000);
connection.setRequestMethod("GET");
if (connection.getResponseCode() == HttpURLConnection.HTTP_OK || connection.getResponseCode()==HttpURLConnection.HTTP_NOT_MODIFIED) {
if (connection.getResponseCode() == HttpURLConnection.HTTP_OK || connection.getResponseCode() == HttpURLConnection.HTTP_NOT_MODIFIED) {
InputStream inputStream = connection.getInputStream();
String pname = DateUtils.formatCurrDayNoSign() + ".jpg";
String ftputl = FTPUtil.getFtpUrl(ftp) + basePath+pname;
boolean r = FTPUtil.uploadFile(ftp, basePath, pname,inputStream);
String ftputl = FTPUtil.getFtpUrl(ftp) + basePath + pname;
boolean r = FTPUtil.uploadFile(ftp, basePath, pname, inputStream);
if (r) {
return ftputl;
}
......@@ -195,9 +142,10 @@ public class FileTransferManager {
});
try {
return threadService.poll(10, TimeUnit.SECONDS).get();
}catch (Exception ex){
} catch (Exception ex) {
return url;
}
}
}
package com.cx.cn.cxquartz.util;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.*;
public class FileUtil {
private static final Logger logger = LoggerFactory.getLogger(FileUtil.class);
public static File uploadToLocal(String path,ByteArrayOutputStream bout, String fileName) {
logger.info("file upload :{}",path+fileName);
DataOutputStream to=null;
try {
File tempFile = new File(path);
if (!tempFile.exists()) {
tempFile.mkdirs();
}
File file= new File(tempFile.getPath() + File.separator + fileName);
if (!file.exists()) {
file.createNewFile();
}
to=new DataOutputStream(new FileOutputStream(file));
bout.writeTo(to);
return file;
} catch (IOException e) {
logger.error(e.toString());
e.printStackTrace();
return null;
} catch (Exception e) {
logger.error(e.toString());
e.printStackTrace();
return null;
} finally {
try {
if(null!=bout)
bout.close();
if(null!=to){
to.close();
}
} catch (IOException e) {
logger.error(e.toString());
e.printStackTrace();
}
}
}
}
package com.cx.cn.cxquartz.util;
import com.cx.cn.cxquartz.controller.IndexController;
import com.cx.cn.cxquartz.vo.Location;
import com.cx.cn.cxquartz.vo.Point;
import com.fasterxml.jackson.databind.ObjectMapper;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import javax.imageio.ImageIO;
import java.awt.*;
import java.awt.image.BufferedImage;
import java.io.ByteArrayOutputStream;
import java.io.InputStream;
import java.util.*;
import java.util.List;
public class PointUtil {
private static final Logger logger = LoggerFactory.getLogger(IndexController.class);
public static void getXYWH(List<Point> points, Long[] roiarray){
Map<Integer, Integer> map=new HashMap();
Map<Integer, Integer> mapy=new HashMap();
for(Point point :points){
map.put(point.getX(),point.getX());
mapy.put(point.getY(),point.getY());
}
//map有两个,mapy有两个值
List<Integer> numx = new ArrayList<Integer>();
for (Map.Entry<Integer, Integer> mx:map.entrySet()) {
numx.add(mx.getValue());
}
List<Integer> numy = new ArrayList<Integer>();
for (Map.Entry<Integer, Integer> my:mapy.entrySet()) {
numy.add(my.getValue());
}
Collections.sort(numx);
Collections.sort(numy);
if(numx.size()==2 && numy.size()==2) {
roiarray[0]=Long.parseLong(String.valueOf(numx.get(0)));
roiarray[1]=Long.parseLong(String.valueOf(numy.get(0)));
roiarray[2]=Long.parseLong(String.valueOf(numx.get(1) - numx.get(0)));
roiarray[3]=Long.parseLong(String.valueOf(numy.get(1) - numy.get(0)));
}}
public static ByteArrayOutputStream drawByPoints(InputStream bais,List<Map> detectObjects) {
ByteArrayOutputStream stream = new ByteArrayOutputStream();
try {
BufferedImage image = ImageIO.read(bais);
Graphics g = image.getGraphics();
g.setColor(Color.RED);
//遍历所有特征值,画到图片上
for (Map box : detectObjects) {
if (null != box) {
try {
if (null != box.get("location")) {
try {
Location lo =(Location) box.get("location");
logger.info("detectObjects x1,x2,y1,y2==="+lo.toString());
g.drawRect(lo.getX1(), lo.getY1(),
lo.getX2() - lo.getX1(),
lo.getY2() - lo.getY1());
}catch (Exception ex){
logger.error("Location Map error:{}", ex.toString());
}
}
} catch (Exception ex) {
logger.error("Location readValue error:{}", ex.toString());
}
}
}
ImageIO.write(image, "JPEG", stream);
return stream;
}catch (Exception ex){
logger.error("Location readValue error:{}", ex.toString());
}
return stream;
}
}
......@@ -3,14 +3,17 @@ package com.cx.cn.cxquartz.util;
import com.alibaba.fastjson.JSONObject;
import com.cx.cn.cxquartz.controller.ExtController;
import com.cx.cn.cxquartz.service.quartz.SbtdspsrService;
import com.cx.cn.cxquartz.vo.TraffAlarmRecord;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpEntity;
import org.springframework.http.HttpMethod;
import org.springframework.http.ResponseEntity;
import org.springframework.http.*;
import org.springframework.web.client.RestTemplate;
import java.io.IOException;
import java.io.InputStream;
import java.net.HttpURLConnection;
import java.net.URL;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
......@@ -19,10 +22,10 @@ public class RestUtil {
private static final Logger logger = LoggerFactory.getLogger(RestUtil.class);
@Autowired
private RestTemplate restTemplate;
public RestTemplate restTemplate;
@Autowired
SbtdspsrService sbtdspsrService;
public SbtdspsrService sbtdspsrService;
public String getnewRtspVlue(String devicecode,String getrtspbyurl ){
String rtspnewvalue="";
......@@ -79,15 +82,71 @@ public class RestUtil {
}
}
public void getPicture(List<String> imgUrls, Map<String, Object> maps, HttpEntity<String> formEntity,String rtspurl) {
ResponseEntity<String> exchange = restTemplate.exchange(rtspurl + "?url={rtspvalue}&refresh={refresh}",
public String getPicture(List<String> imgUrls, String deviceCode, String rtspurl, TraffAlarmRecord record ) {
HttpHeaders headers = new HttpHeaders();
headers.setContentType(MediaType.APPLICATION_JSON_UTF8);
Map<String, Object> maps = new HashMap<>();
maps.put("deviceCode", deviceCode);
logger.info("rtspurl:{}",rtspurl);
HttpEntity<String> formEntity = new HttpEntity<>(null, headers);
ResponseEntity<String> exchange = restTemplate.exchange(rtspurl + "?deviceCode={deviceCode}",
HttpMethod.GET, formEntity, String.class, maps);
if(null!=exchange.getBody()) {
JSONObject json = JSONObject.parseObject(exchange.getBody());
if (null != json.getString("ret") && json.getString("ret").equals("0")) {
//获得图片地址
imgUrls.add(json.getString("url"));
record.setImg1urlfrom(json.getString("url"));
record.setImg1path(json.getString("localuri"));
}
return json.getString("timestamp");
}
return null;
}
public String getSnapshot(List<String> imgUrls, String deviceCode, String rtspurl, TraffAlarmRecord record ) {
HttpHeaders headers = new HttpHeaders();
headers.setContentType(MediaType.APPLICATION_JSON_UTF8);
Map<String, Object> maps = new HashMap<>();
maps.put("deviceCode", deviceCode);
logger.info("rtspurl:{}",rtspurl);
HttpEntity<String> formEntity = new HttpEntity<>(null, headers);
ResponseEntity<String> exchange = restTemplate.exchange(rtspurl + "?deviceCode={deviceCode}",
HttpMethod.GET, formEntity, String.class, maps);
if(null!=exchange.getBody()) {
JSONObject json = JSONObject.parseObject(exchange.getBody());
if (null != json.getString("ret") && json.getString("ret").equals("0")) {
//获得图片地址
imgUrls.add(json.getString("url"));
record.setImg1path(json.getString("url"));
}
return json.getString("timestamp");
}
return null;
}
/// <summary>
/// 读取远程文件的内容
/// </summary>
/// <param name="path"></param>
/// <returns></returns>
public static InputStream ReadFromURL(String serverFilePath)
{
try {
HttpURLConnection connection = (HttpURLConnection) new URL(serverFilePath).openConnection();
connection.setReadTimeout(2000); //延迟连接
connection.setConnectTimeout(8000);
connection.setRequestMethod("GET");
if (connection.getResponseCode() == HttpURLConnection.HTTP_OK || connection.getResponseCode() == HttpURLConnection.HTTP_NOT_MODIFIED) {
InputStream inputStream = connection.getInputStream();
return inputStream;
}
} catch (IOException e) {
}
return null;
}
}
......@@ -15,29 +15,5 @@ public enum TraffAlarmRecordFromImgEnum implements TraffAlarmRecordImg {
public void setImg(TraffAlarmRecord traffAlarmRecord, String img) {
traffAlarmRecord.setImg1urlfrom(img);
}
},
IMG1 {
@Override
public void setImg(TraffAlarmRecord traffAlarmRecord, String img) {
traffAlarmRecord.setImg2urlfrom(img);
}
},
IMG2 {
@Override
public void setImg(TraffAlarmRecord traffAlarmRecord, String img) {
traffAlarmRecord.setImg3urlfrom(img);
}
},
IMG3 {
@Override
public void setImg(TraffAlarmRecord traffAlarmRecord, String img) {
traffAlarmRecord.setImg4urlfrom(img);
}
},
IMG4 {
@Override
public void setImg(TraffAlarmRecord traffAlarmRecord, String img) {
traffAlarmRecord.setImg5urlfrom(img);
}
}
}
package com.cx.cn.cxquartz.vo;
import java.util.Date;
public class FileUploadResult {
private String filename;
private String url;
private String localuri;
private long length;
private Date timestamp;
public void setFilename(String filename) {
this.filename = filename;
}
public String getFilename() {
return filename;
}
public void setUrl(String url) {
this.url = url;
}
public String getUrl() {
return url;
}
public void setLocaluri(String localuri) {
this.localuri = localuri;
}
public String getLocaluri() {
return localuri;
}
public void setLength(long length) {
this.length = length;
}
public long getLength() {
return length;
}
public void setTimestamp(Date timestamp) {
this.timestamp = timestamp;
}
public Date getTimestamp() {
return timestamp;
}
}
package com.cx.cn.cxquartz.vo;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.Date;
import java.util.List;
public class FileUploadResultVo {
@JsonProperty("Url")
private String Url;
@JsonProperty("Error")
private String Error;
@JsonProperty("Code")
private int Code;
@JsonProperty("StackTrace")
private String StackTrace;
@JsonProperty("Data")
private List<FileUploadResult> Data;
@JsonProperty("ID")
private String ID;
public void setUrl(String Url) {
this.Url = Url;
}
public String getUrl() {
return Url;
}
public void setError(String Error) {
this.Error = Error;
}
public String getError() {
return Error;
}
public void setCode(int Code) {
this.Code = Code;
}
public int getCode() {
return Code;
}
public void setStackTrace(String StackTrace) {
this.StackTrace = StackTrace;
}
public String getStackTrace() {
return StackTrace;
}
public List<FileUploadResult> getData() {
return Data;
}
public void setData(List<FileUploadResult> data) {
Data = data;
}
public void setID(String ID) {
this.ID = ID;
}
public String getID() {
return ID;
}
}
......@@ -10,10 +10,10 @@ public class ImageList {
private Long[] Roi;
// private Integer RoiPadding;
private Integer RoiPadding;
private Integer CropObjectImage;
private Integer CropObjectImagePadding;
private Integer CropObjectImageQuality;
private Integer CropImageQuality;
@JSONField(name = "Roi")
public Long[] getRoi() {
......@@ -24,13 +24,13 @@ public class ImageList {
Roi = roi;
}
// public Integer getRoiPadding() {
// return RoiPadding;
// }
//
// public void setRoiPadding(Integer roiPadding) {
// RoiPadding = roiPadding;
// }
public Integer getRoiPadding() {
return RoiPadding;
}
public void setRoiPadding(Integer roiPadding) {
RoiPadding = roiPadding;
}
public Integer getCropObjectImage() {
return CropObjectImage;
......@@ -48,12 +48,12 @@ public class ImageList {
CropObjectImagePadding = cropObjectImagePadding;
}
public Integer getCropObjectImageQuality() {
return CropObjectImageQuality;
public Integer getCropImageQuality() {
return CropImageQuality;
}
public void setCropObjectImageQuality(Integer cropObjectImageQuality) {
CropObjectImageQuality = cropObjectImageQuality;
public void setCropImageQuality(Integer cropImageQuality) {
CropImageQuality = cropImageQuality;
}
@JsonIgnore
......@@ -66,13 +66,24 @@ public class ImageList {
Data = data;
}
public ImageList(String imageID, Long[] roi, Integer roiPadding, Integer cropObjectImage, Integer cropObjectImagePadding, Integer cropObjectImageQuality, String data) {
public ImageList(String imageID, Long[] roi, Integer roiPadding, Integer cropObjectImage, Integer cropObjectImagePadding, Integer cropImageQuality, String data) {
ImageID = imageID;
Roi = roi;
// RoiPadding = roiPadding;
RoiPadding = roiPadding;
CropObjectImage = cropObjectImage;
CropObjectImagePadding = cropObjectImagePadding;
CropObjectImageQuality = cropObjectImageQuality;
CropImageQuality = cropImageQuality;
Data = data;
}
public ImageList(String imageID, Long[] roi, Integer roiPadding, Integer cropObjectImage, Integer cropObjectImagePadding, Integer cropImageQuality, int format, String data) {
ImageID = imageID;
Roi = roi;
RoiPadding = roiPadding;
CropObjectImage = cropObjectImage;
CropObjectImagePadding = cropObjectImagePadding;
CropImageQuality = cropImageQuality;
Format = format;
Data = data;
}
......@@ -86,8 +97,7 @@ public class ImageList {
public void setFormat(int Format){
this.Format = Format;
}
@JSONField(name = "Format")
@JSONField(name = "Format",serialize = false)
public int getFormat(){
return this.Format;
}
......
package com.cx.cn.cxquartz.vo;
import java.util.List;
import java.util.Map;
public class JobParam {
private String detectType;
private String deviceId;
private String type;
private String name;
private Map params;
private String callBackUrl;
private List<Point> area;
public String getDetectType() {
return detectType;
}
public void setDetectType(String detectType) {
this.detectType = detectType;
}
public String getDeviceId() {
return deviceId;
}
public void setDeviceId(String deviceId) {
this.deviceId = deviceId;
}
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public Map getParams() {
return params;
}
public void setParams(Map params) {
this.params = params;
}
public String getCallBackUrl() {
return callBackUrl;
}
public void setCallBackUrl(String callBackUrl) {
this.callBackUrl = callBackUrl;
}
public List<Point> getArea() {
return area;
}
public void setArea(List<Point> area) {
this.area = area;
}
}
package com.cx.cn.cxquartz.vo;
public class JobTjParam {
private String detectType;
private String deviceId;
private String imageUrl;
private Object detectInfo;
private Long timestamp;
public String getDetectType() {
return detectType;
}
public void setDetectType(String detectType) {
this.detectType = detectType;
}
public String getDeviceId() {
return deviceId;
}
public void setDeviceId(String deviceId) {
this.deviceId = deviceId;
}
public String getImageUrl() {
return imageUrl;
}
public void setImageUrl(String imageUrl) {
this.imageUrl = imageUrl;
}
public Object getDetectInfo() {
return detectInfo;
}
public void setDetectInfo(Object detectInfo) {
this.detectInfo = detectInfo;
}
public Long getTimestamp() {
return timestamp;
}
public void setTimestamp(Long timestamp) {
this.timestamp = timestamp;
}
@Override
public String toString() {
return "JobTjParam{" +
"detectType='" + detectType + '\'' +
", deviceId='" + deviceId + '\'' +
", imageUrl='" + imageUrl + '\'' +
", detectInfo=" + detectInfo +
", timestamp=" + timestamp +
'}';
}
}
/**
* Copyright 2021 json.cn
*/
package com.cx.cn.cxquartz.vo;
public class Location {
private int x1;
private int y1;
private int x2;
private int y2;
public int getX1() {
return x1;
}
public void setX1(int x1) {
this.x1 = x1;
}
public int getY1() {
return y1;
}
public void setY1(int y1) {
this.y1 = y1;
}
public int getX2() {
return x2;
}
public void setX2(int x2) {
this.x2 = x2;
}
public int getY2() {
return y2;
}
public void setY2(int y2) {
this.y2 = y2;
}
public Location(int x1, int y1, int x2, int y2) {
this.x1 = x1;
this.y1 = y1;
this.x2 = x2;
this.y2 = y2;
}
public Location() {
}
@Override
public String toString() {
return "Location{" +
"x1=" + x1 +
", y1=" + y1 +
", x2=" + x2 +
", y2=" + y2 +
'}';
}
}
\ No newline at end of file
......@@ -142,4 +142,27 @@ public class ObjectList {
return Index;
}
public ObjectList() {
}
public ObjectList(String imageID, int objectID, com.cx.cn.cxquartz.vo.Metadata metadata, String feature, int bucketID, List<Integer> bucketIDList, String faceFeature, int faceBucketID, List<Integer> faceBucketIDList, String faceQuality, String faceYaw, String facePitch, String faceRoll, String faceBlurry, String objectImageData, String faceImageData, int index) {
ImageID = imageID;
ObjectID = objectID;
Metadata = metadata;
Feature = feature;
BucketID = bucketID;
BucketIDList = bucketIDList;
FaceFeature = faceFeature;
FaceBucketID = faceBucketID;
FaceBucketIDList = faceBucketIDList;
FaceQuality = faceQuality;
FaceYaw = faceYaw;
FacePitch = facePitch;
FaceRoll = faceRoll;
FaceBlurry = faceBlurry;
ObjectImageData = objectImageData;
FaceImageData = faceImageData;
Index = index;
}
}
/**
* Copyright 2021 json.cn
*/
package com.cx.cn.cxquartz.vo;
public class ObjectListResult {
private ObjectResult recogdata;
private int ret;
private String desc;
private String url;
private String localuri;
private String timestamp;
public int getRet() {
return ret;
}
public void setRet(int ret) {
this.ret = ret;
}
public String getDesc() {
return desc;
}
public void setDesc(String desc) {
this.desc = desc;
}
public String getUrl() {
return url;
}
public void setUrl(String url) {
this.url = url;
}
public String getLocaluri() {
return localuri;
}
public void setLocaluri(String localuri) {
this.localuri = localuri;
}
public String getTimestamp() {
return timestamp;
}
public void setTimestamp(String timestamp) {
this.timestamp = timestamp;
}
public ObjectResult getRecogdata() {
return recogdata;
}
public void setRecogdata(ObjectResult recogdata) {
this.recogdata = recogdata;
}
}
\ No newline at end of file
/**
* Copyright 2021 json.cn
*/
package com.cx.cn.cxquartz.vo;
import java.util.List;
public class ObjectResult {
private List<ObjectList> ObjectList;
private String ret;
private String error_msg;
public ObjectResult() {
}
public ObjectResult(List<com.cx.cn.cxquartz.vo.ObjectList> objectList, String ret, String error_msg) {
ObjectList = objectList;
this.ret = ret;
this.error_msg = error_msg;
}
public List<com.cx.cn.cxquartz.vo.ObjectList> getObjectList() {
return ObjectList;
}
public void setObjectList(List<com.cx.cn.cxquartz.vo.ObjectList> objectList) {
ObjectList = objectList;
}
public String getRet() {
return ret;
}
public void setRet(String ret) {
this.ret = ret;
}
public String getError_msg() {
return error_msg;
}
public void setError_msg(String error_msg) {
this.error_msg = error_msg;
}
}
\ No newline at end of file
package com.cx.cn.cxquartz.vo;
public class Point {
int x;
int y;
public int getX() {
return x;
}
public void setX(int x) {
this.x = x;
}
public int getY() {
return y;
}
public void setY(int y) {
this.y = y;
}
}
......@@ -6,7 +6,7 @@ public class Sbtdspsr {
private String sbbh;
private Long tdbh;
private Integer tdbh;
private Long tdlx;
......@@ -162,11 +162,11 @@ public class Sbtdspsr {
this.sbbh = sbbh;
}
public Long getTdbh() {
public Integer getTdbh() {
return tdbh;
}
public void setTdbh(Long tdbh) {
public void setTdbh(Integer tdbh) {
this.tdbh = tdbh;
}
......
package com.cx.cn.cxquartz.vo;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import java.util.List;
public class TaskResultObj {
private static final ObjectMapper MAPPER = new ObjectMapper();
/**
* 响应业务状态
* 200 成功
* 201 错误
* 400 参数错误
*/
private String errorCode;
/**
* 响应消息
*/
private String errorMsg;
/**
* 响应中的数据
*/
private Object data;
public static TaskResultObj error(String status, String msg, Object data) {
return new TaskResultObj(status, msg, data);
}
public static TaskResultObj ok(Object data) {
return new TaskResultObj(data);
}
public static TaskResultObj ok() {
return ok(null);
}
private TaskResultObj() {
}
public static TaskResultObj error(String status, String msg) {
return new TaskResultObj(status, msg, null);
}
private TaskResultObj(String status, String msg, Object data) {
this.errorCode = status;
this.errorMsg = msg;
this.data = data;
}
private TaskResultObj(Object data) {
this.errorCode = "0";
this.errorMsg = "success";
this.data = data;
}
/**
* 将json结果集转化为SysResult对象
*
* @param jsonData json数据
* @param clazz SysResult中的object类型
* @return SysResult对象
*/
public static TaskResultObj formatToPojo(String jsonData, Class<?> clazz) {
try {
if (clazz == null) {
return MAPPER.readValue(jsonData, TaskResultObj.class);
}
JsonNode jsonNode = MAPPER.readTree(jsonData);
JsonNode data = jsonNode.get("data");
Object obj = null;
if (data.isObject()) {
obj = MAPPER.readValue(data.traverse(), clazz);
} else if (data.isTextual()) {
obj = MAPPER.readValue(data.asText(), clazz);
}
return error(jsonNode.get("errorCode").toString(), jsonNode.get("errorMsg").asText(), obj);
} catch (Exception e) {
e.printStackTrace();
return null;
}
}
/**
* 没有object对象的转化
*
* @param json 字符串
* @return SysResult对象
*/
public static TaskResultObj format(String json) {
try {
return MAPPER.readValue(json, TaskResultObj.class);
} catch (Exception e) {
e.printStackTrace();
}
return null;
}
/**
* Object是集合转化
*
* @param jsonData json数据
* @param clazz 集合中的类型
* @return SysResult对象
*/
public static TaskResultObj formatToList(String jsonData, Class<?> clazz) {
try {
JsonNode jsonNode = MAPPER.readTree(jsonData);
JsonNode data = jsonNode.get("data");
Object obj = null;
if (data.isArray() && data.size() > 0) {
obj = MAPPER.readValue(data.traverse(),
MAPPER.getTypeFactory().constructCollectionType(List.class, clazz));
}
return error(jsonNode.get("errorCode").toString(), jsonNode.get("errorMsg").asText(), obj);
} catch (Exception e) {
e.printStackTrace();
return null;
}
}
public String getErrorCode() {
return errorCode;
}
public void setErrorCode(String errorCode) {
this.errorCode = errorCode;
}
public String getErrorMsg() {
return errorMsg;
}
public void setErrorMsg(String errorMsg) {
this.errorMsg = errorMsg;
}
public Object getData() {
return data;
}
public void setData(Object data) {
this.data = data;
}
}
\ No newline at end of file
......@@ -32,7 +32,7 @@ public class TraffAlarmRecord {
private Integer recordlevel;//�¼����� --Ĭ��Ϊ0 ����������ʱδ֪
private Integer checkstatus ;//0:����� 1:���ͨ�� 2:��˲�ͨ�� 9:����
private String creator;//������
private Date createtime ;//����ʱ��
private String createtime ;//����ʱ��
private String updator ;//������
private Date updatetime ;//����ʱ��
private String remark ;
......@@ -140,71 +140,6 @@ public class TraffAlarmRecord {
public void setImg1path(String img1path) {
this.img1path = img1path;
}
public String getImg2urlfrom() {
return img2urlfrom;
}
public void setImg2urlfrom(String img2urlfrom) {
this.img2urlfrom = img2urlfrom;
}
public String getImg2path() {
return img2path;
}
public void setImg2path(String img2path) {
this.img2path = img2path;
}
public String getImg3urlfrom() {
return img3urlfrom;
}
public void setImg3urlfrom(String img3urlfrom) {
this.img3urlfrom = img3urlfrom;
}
public String getImg3path() {
return img3path;
}
public void setImg3path(String img3path) {
this.img3path = img3path;
}
public String getImg4urlfrom() {
return img4urlfrom;
}
public void setImg4urlfrom(String img4urlfrom) {
this.img4urlfrom = img4urlfrom;
}
public String getImg4path() {
return img4path;
}
public void setImg4path(String img4path) {
this.img4path = img4path;
}
public String getImg5urlfrom() {
return img5urlfrom;
}
public void setImg5urlfrom(String img5urlfrom) {
this.img5urlfrom = img5urlfrom;
}
public String getImg5path() {
return img5path;
}
public void setImg5path(String img5path) {
this.img5path = img5path;
}
public String getVideourlfrom() {
return videourlfrom;
}
......@@ -261,11 +196,11 @@ public class TraffAlarmRecord {
this.creator = creator;
}
public Date getCreatetime() {
public String getCreatetime() {
return createtime;
}
public void setCreatetime(Date createtime) {
public void setCreatetime(String createtime) {
this.createtime = createtime;
}
......@@ -357,6 +292,70 @@ public class TraffAlarmRecord {
this.manualstatus = manualstatus;
}
public String getImg2urlfrom() {
return img2urlfrom;
}
public void setImg2urlfrom(String img2urlfrom) {
this.img2urlfrom = img2urlfrom;
}
public String getImg2path() {
return img2path;
}
public void setImg2path(String img2path) {
this.img2path = img2path;
}
public String getImg3urlfrom() {
return img3urlfrom;
}
public void setImg3urlfrom(String img3urlfrom) {
this.img3urlfrom = img3urlfrom;
}
public String getImg3path() {
return img3path;
}
public void setImg3path(String img3path) {
this.img3path = img3path;
}
public String getImg4urlfrom() {
return img4urlfrom;
}
public void setImg4urlfrom(String img4urlfrom) {
this.img4urlfrom = img4urlfrom;
}
public String getImg4path() {
return img4path;
}
public void setImg4path(String img4path) {
this.img4path = img4path;
}
public String getImg5urlfrom() {
return img5urlfrom;
}
public void setImg5urlfrom(String img5urlfrom) {
this.img5urlfrom = img5urlfrom;
}
public String getImg5path() {
return img5path;
}
public void setImg5path(String img5path) {
this.img5path = img5path;
}
@Override
public String toString() {
return "Traffalarmrecord{" +
......@@ -372,14 +371,6 @@ public class TraffAlarmRecord {
", location='" + location + '\'' +
", img1urlfrom='" + img1urlfrom + '\'' +
", img1path='" + img1path + '\'' +
", img2urlfrom='" + img2urlfrom + '\'' +
", img2path='" + img2path + '\'' +
", img3urlfrom='" + img3urlfrom + '\'' +
", img3path='" + img3path + '\'' +
", img4urlfrom='" + img4urlfrom + '\'' +
", img4path='" + img4path + '\'' +
", img5urlfrom='" + img5urlfrom + '\'' +
", img5path='" + img5path + '\'' +
", videourlfrom='" + videourlfrom + '\'' +
", videopath='" + videopath + '\'' +
", retrytime=" + retrytime +
......
......@@ -35,6 +35,15 @@ public class Traffic {
private String HasSkylight;
private String HasBaggage;
private String HasAerial;
private String creattime;
public String getCreattime() {
return creattime;
}
public void setCreattime(String creattime) {
this.creattime = creattime;
}
public void setType(String Type) {
this.Type = Type;
......
......@@ -59,6 +59,16 @@ public class Traffpicture{
private Integer targetnum;
private String creattime;
public String getCreattime() {
return creattime;
}
public void setCreattime(String creattime) {
this.creattime = creattime;
}
public Integer getTargetnum() {
return targetnum;
}
......
......@@ -37,7 +37,7 @@ public class TraffpictureParam extends Traffpicture {
@JsonIgnore
private String creator;
@JsonIgnore
private Date createtime;
private String createtime;
@JsonIgnore
private String updator;
@JsonIgnore
......@@ -166,11 +166,11 @@ public class TraffpictureParam extends Traffpicture {
this.creator = creator;
}
public Date getCreatetime() {
public String getCreatetime() {
return createtime;
}
public void setCreatetime(Date createtime) {
public void setCreatetime(String createtime) {
this.createtime = createtime;
}
......
package com.cx.cn.cxquartz.vo;
/**
* <p>
*
* </p>
*
* @author wjj
* @since 2021-04-29
*/
public class Voice {
private Integer eventId;
private String unionId;
public Integer getEventId() {
return eventId;
}
public void setEventId(Integer eventId) {
this.eventId = eventId;
}
public String getUnionId() {
return unionId;
}
public void setUnionId(String unionId) {
this.unionId = unionId;
}
}
package com.cx.cn.cxquartz.vo;
/**
* <p>
*
* </p>
*
* @author wjj
* @since 2021-04-29
*/
public class VoiceData {
private String corpId;
private String appKey;
private Voice requestData;
public String getCorpId() {
return corpId;
}
public void setCorpId(String corpId) {
this.corpId = corpId;
}
public String getAppKey() {
return appKey;
}
public void setAppKey(String appKey) {
this.appKey = appKey;
}
public Voice getRequestData() {
return requestData;
}
public void setRequestData(Voice requestData) {
this.requestData = requestData;
}
}
/**
* Copyright 2021 json.cn
*/
package com.cx.cn.cxquartz.vo;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import java.util.List;
public class VoiceResultObj {
private static final ObjectMapper MAPPER = new ObjectMapper();
/**
* 响应业务状态
* 200 成功
* 201 错误
* 400 参数错误
*/
private Integer Code;
/**
* 响应消息
*/
private String msg;
/**
* 响应中的数据
*/
private Object data;
private String page;
public static VoiceResultObj error(Integer status, String msg, Object data) {
return new VoiceResultObj(status, msg, data);
}
public static VoiceResultObj ok(Object data) {
return new VoiceResultObj(data);
}
public static VoiceResultObj ok() {
return ok(null);
}
private VoiceResultObj() {
}
public static VoiceResultObj error(Integer status, String msg) {
return new VoiceResultObj(status, msg, null);
}
private VoiceResultObj(Integer code, String msg, Object data) {
this.Code = code;
this.msg = msg;
this.data = data;
}
private VoiceResultObj(Object data) {
this.Code =1;
this.msg = "success";
this.data = data;
}
public Integer getCode() {
return Code;
}
public void setCode(Integer code) {
this.Code = code;
}
public String getMsg() {
return msg;
}
public void setMsg(String msg) {
this.msg = msg;
}
public Object getData() {
return data;
}
public void setData(Object data) {
this.data = data;
}
public String getPage() {
return page;
}
public void setPage(String page) {
this.page = page;
}
/**
* 将json结果集转化为SysResult对象
*
* @param jsonData json数据
* @param clazz SysResult中的object类型
* @return SysResult对象
*/
public static VoiceResultObj formatToPojo(String jsonData, Class<?> clazz) {
try {
if (clazz == null) {
return MAPPER.readValue(jsonData, VoiceResultObj.class);
}
JsonNode jsonNode = MAPPER.readTree(jsonData);
JsonNode data = jsonNode.get("data");
Object obj = null;
if (data.isObject()) {
obj = MAPPER.readValue(data.traverse(), clazz);
} else if (data.isTextual()) {
obj = MAPPER.readValue(data.asText(), clazz);
}
return error( Integer.parseInt(jsonNode.get("code").toString()), jsonNode.get("msg").asText(), obj);
} catch (Exception e) {
e.printStackTrace();
return null;
}
}
/**
* 没有object对象的转化
*
* @param json 字符串
* @return SysResult对象
*/
public static VoiceResultObj format(String json) {
try {
return MAPPER.readValue(json, VoiceResultObj.class);
} catch (Exception e) {
e.printStackTrace();
}
return null;
}
/**
* Object是集合转化
*
* @param jsonData json数据
* @param clazz 集合中的类型
* @return SysResult对象
*/
public static VoiceResultObj formatToList(String jsonData, Class<?> clazz) {
try {
JsonNode jsonNode = MAPPER.readTree(jsonData);
JsonNode data = jsonNode.get("data");
Object obj = null;
if (data.isArray() && data.size() > 0) {
obj = MAPPER.readValue(data.traverse(),
MAPPER.getTypeFactory().constructCollectionType(List.class, clazz));
}
return error(Integer.parseInt(jsonNode.get("code").toString()), jsonNode.get("msg").asText(), obj);
} catch (Exception e) {
e.printStackTrace();
return null;
}
}
@Override
public String toString() {
return "ResultObj{" +
"code=" + Code +
", msg='" + msg + '\'' +
", obj=" + data +
'}';
}
}
\ No newline at end of file
......@@ -11,10 +11,10 @@ mybatis:
spring:
datasource:
url: jdbc:mysql://192.168.168.110:3306/imagepro?useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone=UTC&allowPublicKeyRetrieval=true
url: jdbc:mysql://172.16.24.29:3306/imagepro?useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone=UTC&allowPublicKeyRetrieval=true
username: root
password: 123456
# url: jdbc:mysql://172.16.24.29:3306/imagepro?useUnicode=true&characterEncoding=utf-8&useSSL=false&allowPublicKeyRetrieval=true
# url: jdbc:mysql://192.168.168.110:3306/imagepro?useUnicode=true&characterEncoding=utf-8&useSSL=false&allowPublicKeyRetrieval=true
# username: root
# password: 123456
driver-class-name: com.mysql.jdbc.Driver
......@@ -41,14 +41,18 @@ spring:
redis:
database: 0
host: 172.16.24.29
# host: 127.0.0.1
port: 6379
#logging:
# level:
# root:
# info
local:
czurl: http://localhost:8089/ext/getRTSP/1
fxurl: http://localhost:8089/ext/getDeviceSnapshotAndRecognize
logging:
level:
com.cx.cn.cxquartz.dao:
debug
\ No newline at end of file
#logging:
# level:
# com.cx.cn.cxquartz.dao:
# debug
\ No newline at end of file
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.29:7080/getrealcamerasnapshot.php
#file.recogurl=http://172.16.24.29:9098/images/recog
#file.rtspurl=http://localhost:8089/getrealcamerasnapshot
#file.recogurl=http://localhost:8089/images/recog
file.rtspurl=http://172.16.24.29:8081/getrealcamerasnapshot.php
file.recogurl=http://172.16.24.29:9098/images/recog
#
#file.rtspurl=http://zjh189.ncpoi.cc:7080/getDeviceSnapshot
#file.recogurl=http://zjh189.ncpoi.cc:7080/getDeviceSnapshotAndRecognize
#file.uploadurl=http://home2.ncpoi.cc:7080/uploadResultFile
#
file.rtspurl=http://172.16.24.29:7080/getDeviceSnapshot
file.recogurl=http://172.16.24.29:7080/getDeviceSnapshotAndRecognize
file.uploadurl=http://172.16.24.29:7080/uploadResultFile
redis.cachekey.ftplist=gs:traff:global:cache:ftplist
file.getrtspbyurl=http://212.129.142.17:8888/heschome_api/api/hesc/open/getRtsp
countryside.url=http://countryside.51iwifi.com/gw/hesc-mq/hesc/mq/receive/cameraalarm
eventwrite.timeout=5000
eventwrite.token=countrysidetoken
eventwrite.expiretoken=countrysideexpiretime
eventwrite.url=http://countryside.51iwifi.com/gw/hesc-mq/hesc/mq/receive/cameraalarm
countryside.eventwrite.timeout=5
countryside.eventwrite.token=countrysidetoken
countryside.eventwrite.expiretoken=countrysideexpiretime
countryside.eventwrite.url=http://countryside.51iwifi.com/gw/hesc-mq/hesc/mq/receive/cameraalarm
countryside.appid=05744e80b2c211ebe32a8e271066b19e
countryside.appsecret=a55a8870b2e911ebe32a8e271066b19e
countryside.tokenurl=http://countryside.51iwifi.com/gw/getAccessToken
file.publicpictureurl=http://zjh189.ncpoi.cc:10001/api/alg/files
file.ftppath=jiuling:9ling.cn@172.16.24.29:21
voice.url=http://106.13.41.128:9102/giant-sound/api/voice/1.0/play
voice.appKey=9555a51a08a2e1b1c9f02a5b3e9bea11
voice.corpId=587c9d56ee324c0186a86aea85fc7691
voice.eventId=5
voice.unionId=3YSCA450426N3XP
file.rootpath=/home/ubuntu/pictures
file.outpath=result
file.webrl=http://zjh189.ncpoi.cc:7080
......@@ -400,4 +400,16 @@
<update id="UpdateExecuteParam" parameterType="java.util.HashMap">
update quartz_task_informations set executeParamter=#{nrtsp} where executeParamter=#{ortsp}
</update>
<select id="getTaskSByDeviceCode" resultMap="BaseResultMap" parameterType="java.lang.String">
select * from quartz_task_informations where
taskno like concat(concat('%',#{devicecode}),'%')
and frozenStatus='UNFROZEN'
</select>
<delete id="deletetask">
delete from quartz_task_informations
where taskno = #{taskno,jdbcType=BIGINT}
</delete>
</mapper>
......@@ -12,26 +12,16 @@
<select id="selectByRtsp" parameterType="java.lang.String" resultType="com.cx.cn.cxquartz.vo.Sbtdspsr">
select distinct a.* from sbtdspsr a,
quartz_task_informations b
WHERE (a.sbbh=b.videoid or a.squrllj=b.videoid) and
(a.sbbh=#{rtsp} or a.squrllj=#{rtsp})
select * from sbtdspsr where
(sbbh=#{rtsp} or squrllj=#{rtsp})
</select>
<select id="selectRecogByRtsp" parameterType="java.lang.String" resultType="java.util.HashMap">
SELECT DISTINCT
(select sbbh from sbtdspsr where sbbh=b.videoid or squrllj=b.videoid limit 1) videoid,
(select tdmc from sbtdspsr where sbbh=b.videoid or squrllj=b.videoid limit 1) tdmc,
metatype,
recordtype,
objectx,
objecty,
objectw,
objecth
FROM
<select id="selectRecogByRtsp" parameterType="java.lang.String" resultType="com.cx.cn.cxquartz.bean.QuartzTaskInformations">
select * from
quartz_task_informations b
WHERE
(videoid=#{rtsp} or executeparamter=#{rtsp})and recordtype is not null
(taskNo like concat(concat('%fx_',#{rtsp}),'%'))
and frozenstatus='UNFROZEN'
</select>
<update id="updateRecogByRtsp" parameterType="java.util.HashMap" >
......
......@@ -51,14 +51,8 @@
<if test="objlable != null">objlable,</if>
<if test="rectificationtype != null">rectificationtype ,</if>
<if test="manualstatus != null">manualstatus ,</if>
<if test="img1path!=null">img1path,</if>
<if test="img2path!=null">img2path,</if>
<if test="img3path!=null">img3path</if>
<if test="img4path!=null">img4path,</if>
<if test="img5path!=null">img5path,</if>
<if test="videopath!=null">videopath,</if>
</trim>
<trim prefix="select" suffix="from dual" suffixOverrides=",">
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="algotype != null">#{algotype},</if>
<if test="areaid != null">#{areaid},</if>
<if test="fdid != null">#{fdid},</if>
......@@ -85,7 +79,7 @@
<if test="recordlevel != null">#{recordlevel,jdbcType=INTEGER},</if>
<if test="checkstatus != null">#{checkstatus,jdbcType=INTEGER},</if>
<if test="creator != null">#{creator},</if>
<if test="createtime != null">#{createtime},</if>
<if test="createtime != null">str_to_date(#{createtime},'%Y-%m-%d %H:%i:%s'),</if>
<if test="updator != null">#{updator},</if>
<if test="updatetime != null">#{updatetime},</if>
<if test="remark != null">#{remark},</if>
......@@ -95,12 +89,6 @@
<if test="objlable != null">#{objlable},</if>
<if test="rectificationtype != null">#{rectificationtype},</if>
<if test="manualstatus != null">#{manualstatus,jdbcType=INTEGER},</if>
<if test="img1path!=null">#{img1path},</if>
<if test="img2path!=null">#{img2path},</if>
<if test="img3path!=null">#{img3path},</if>
<if test="img4path!=null">#{img4path},</if>
<if test="img5path!=null">#{img5path},</if>
<if test="videopath!=null">#{videopath},</if>
</trim>
......
......@@ -3,41 +3,41 @@
<mapper namespace="com.cx.cn.cxquartz.dao.TraffPictureMapper">
<resultMap id="BaseResultMap" type="com.cx.cn.cxquartz.vo.TraffpictureParam">
<id column="recordid" property="recordid" />
<result column="imageid" property="imageid" />
<result column="areaid" property="areaid" />
<result column="fdid" property="fdid" />
<result column="channelid" property="channelid" />
<result column="objectid" property="objectid" />
<result column="recordtype" property="recordtype" />
<result column="Feature" property="Feature" />
<result column="bucketidlist" property="bucketidlist" />
<result column="facefeature" property="facefeature" />
<result column="facebucketid" property="facebucketid" />
<result column="facebucketidlist" property="facebucketidlist" />
<result column="facequality" property="facequality" />
<result column="faceyaw" property="faceyaw" />
<result column="facepitch" property="facepitch" />
<result column="faceroll" property="faceroll" />
<result column="faceblurry" property="faceblurry" />
<result column="objectimagedata" property="objectimagedata" />
<result column="faceimagedata" property="faceimagedata" />
<result column="pindex" property="index" />
<result column="metadataid" property="metadataid" />
<result column="retrycount" property="retrycount" />
<result column="recordlevel" property="recordlevel" />
<result column="checkstatus" property="checkstatus" />
<result column="creator" property="creator" />
<result column="createtime" property="createtime" />
<result column="updator" property="updator" />
<result column="updatetime" property="updatetime" />
<result column="remark" property="remark" />
<result column="pushstatus" property="pushstatus" />
<result column="pushdesc" property="pushdesc" />
<result column="pushcount" property="pushcount" />
<result column="pushdate" property="pushdate" />
<result column="processstatus" property="processstatus" />
<result column="manualstatus" property="manualstatus" />
<id column="recordid" property="recordid"/>
<result column="imageid" property="imageid"/>
<result column="areaid" property="areaid"/>
<result column="fdid" property="fdid"/>
<result column="channelid" property="channelid"/>
<result column="objectid" property="objectid"/>
<result column="recordtype" property="recordtype"/>
<result column="Feature" property="Feature"/>
<result column="bucketidlist" property="bucketidlist"/>
<result column="facefeature" property="facefeature"/>
<result column="facebucketid" property="facebucketid"/>
<result column="facebucketidlist" property="facebucketidlist"/>
<result column="facequality" property="facequality"/>
<result column="faceyaw" property="faceyaw"/>
<result column="facepitch" property="facepitch"/>
<result column="faceroll" property="faceroll"/>
<result column="faceblurry" property="faceblurry"/>
<result column="objectimagedata" property="objectimagedata"/>
<result column="faceimagedata" property="faceimagedata"/>
<result column="pindex" property="index"/>
<result column="metadataid" property="metadataid"/>
<result column="retrycount" property="retrycount"/>
<result column="recordlevel" property="recordlevel"/>
<result column="checkstatus" property="checkstatus"/>
<result column="creator" property="creator"/>
<result column="createtime" property="createtime"/>
<result column="updator" property="updator"/>
<result column="updatetime" property="updatetime"/>
<result column="remark" property="remark"/>
<result column="pushstatus" property="pushstatus"/>
<result column="pushdesc" property="pushdesc"/>
<result column="pushcount" property="pushcount"/>
<result column="pushdate" property="pushdate"/>
<result column="processstatus" property="processstatus"/>
<result column="manualstatus" property="manualstatus"/>
</resultMap>
......@@ -66,8 +66,9 @@
<if test="index != null">pindex,</if>
<if test="imagedata != null">imagedata,</if>
<if test="processstatus != null">processstatus,</if>
<if test="createtime !=null">createtime ,</if>
</trim>
<trim prefix="select" suffix="from dual" suffixOverrides=",">
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="recordid != null">#{recordid},</if>
<if test="fdid != null">#{fdid},</if>
<if test="channelid != null">#{channelid},</if>
......@@ -90,6 +91,7 @@
<if test="index != null">#{index},</if>
<if test="imagedata != null">#{imagedata},</if>
<if test="processstatus != null">#{processstatus},</if>
<if test="createtime !=null">str_to_date(#{createtime},'%Y-%m-%d %H:%i:%s') ,</if>
</trim>
</insert>
......@@ -110,14 +112,36 @@
</select>
<update id="updateTraffpicture">
update traffpicture set objx=#{objx},objy=#{objy},objw=#{objw},objh=#{objh},imagedata=#{imagedata},metatype=#{metatype},targetnum=#{targetnum} where id=#{id}
update traffpicture
<trim prefix="set" suffixOverrides=",">
<if test="imagedata != null and imagedata !=''">
imagedata =#{imagedata},
</if>
<if test="targetnum != null and targetnum !=''">
targetnum =#{targetnum},
</if>
<if test="objx != null and objx !=''">
objx =#{objx},
</if>
<if test="objy != null and objy !=''">
objy =#{objy},
</if>
<if test="objw != null and objw !=''">
objw =#{objw},
</if>
<if test="objh != null and objh !=''">
objh =#{objh},
</if>
</trim>
where id=#{id}
</update>
<update id="updateTraffpicturePushStatus">
update traffpicture set pushdesc=#{pushdesc} , pushstatus=#{pushstatus} where id=#{id}
</update>
<select id="queryimgdataByid" parameterType="java.lang.String" resultType="java.lang.String">
<select id="queryimgdataByid" parameterType="java.lang.String" resultType="java.lang.String">
select imagedata from traffpicture where id=#{id}
</select>
......
......@@ -72,6 +72,7 @@
<if test="HasSkylight !=null"> hasskylight ,</if>
<if test="HasBaggage !=null"> hasbaggage ,</if>
<if test="HasAerial !=null"> hasaerial ,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id !=null">#{id} ,</if>
......
......@@ -131,24 +131,23 @@
class="col-sm-2 control-label text-right">告警类型:</label>
<div class="col-sm-10">
<select class="form-control" id="recordtype">
<option th:value="1">
<option th:value="20">
周界入侵
</option>
<option th:value="2">
<option th:value="10">
人群密度
</option>
<option th:value="3">
周界越线
</option>
<option th:value="4">
非机动车未戴头盔
<option th:value="41">
结构化统计机动车
</option>
<option th:value="5">
非机动车载人
<option th:value="42">
结构化统计非机动车
</option>
<option th:value="6">
结构化统计
<option th:value="50">
未佩戴口罩
</option>
</select>
</div>
</div>
......@@ -573,7 +572,7 @@
$(function () {
$("#getrtsp").on('click', function (e) {
$.ajax({
url: "/quartz/getRtsp",
url: "/ai/getRtsp",
dataType: "json",
type: "post",
contentType: 'application/json',
......@@ -648,7 +647,7 @@
return;
}
$.ajax({
url: "/quartz/add/task",
url: "/ai/add/task",
dataType: "json",
type: "POST",
data: {
......
......@@ -99,7 +99,7 @@
var executeparamter = $("#executeparamter").val();
var timekey = $("#timekey").val();
$.ajax({
url: "/quartz/add/task",
url: "/ai/add/task",
dataType: "json",
type: "POST",
data: {
......
......@@ -126,17 +126,17 @@
<script type="text/javascript" th:inline="javascript">
function editpage(id) {
window.open( "/quartz/edit/taskpage?id=" + id);
window.open( "/ai/edit/taskpage?id=" + id);
}
function addNewTask() {
window.open( "/quartz/add/taskpage/");
window.open( "/ai/add/taskpage/");
}
function startOrStop(taskNo) {
$.ajax({
url: "/quartz/list/optionjob?taskNo=" + taskNo,
url: "/ai/list/optionjob?taskNo=" + taskNo,
type: "GET",
dataType: "json",
success: function (result) {
......@@ -156,7 +156,7 @@
function runRightNow(taskNo) {
$.ajax({
url: "/quartz/runtask/rightnow?taskno=" + taskNo,
url: "/ai/runtask/rightnow?taskno=" + taskNo,
type: "GET",
dataType: "json",
success: function (result) {
......@@ -175,7 +175,7 @@
function dosearch(){
$.ajax({
url: "/quartz/list/optionjob?taskNo=" + taskNo,
url: "/ai/list/optionjob?taskNo=" + taskNo,
type: "GET",
dataType: "json",
success: function (result) {
......
......@@ -41,16 +41,16 @@
<script type="text/javascript" th:inline="javascript">
function editpage(id) {
location.href = "/quartz/edit/taskpage?id=" + id;
location.href = "/ai/edit/taskpage?id=" + id;
}
function addNewTask() {
location.href = "/quartz/add/taskpage/";
location.href = "/ai/add/taskpage/";
}
function startOrStop(taskNo) {
$.ajax({
url: "/quartz/list/optionjob?taskNo=" + taskNo,
url: "/ai/list/optionjob?taskNo=" + taskNo,
type: "GET",
dataType: "json",
success: function (result) {
......@@ -70,7 +70,7 @@
function runRightNow(taskNo) {
$.ajax({
url: "/quartz/runtask/rightnow?taskno=" + taskNo,
url: "/ai/runtask/rightnow?taskno=" + taskNo,
type: "GET",
dataType: "json",
success: function (result) {
......
......@@ -65,7 +65,7 @@
<script type="text/javascript" th:inline="javascript">
function detailTaskErrors(recordId) {
location.href="/quartz/task/errors?recordid="+recordId;
location.href="/ai/task/errors?recordid="+recordId;
}
</script>
......
......@@ -27,7 +27,7 @@
<h4>修改定时任务项</h4>
</div>
<div class="col-md-6" style="padding-left:10px;">
<form action="/quartz/edit/task" method="post">
<form action="/ai/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"
......@@ -657,7 +657,7 @@
$("#getrtsp").on('click', function (e) {
$.ajax({
url: "/quartz/getRtsp",
url: "/ai/getRtsp",
dataType: "json",
type: "post",
contentType: 'application/json',
......@@ -702,7 +702,7 @@
var unfrozentime = $("#unfrozentime").val();
object = draw.layers[1];
$.ajax({
url: "/quartz/edit/task",
url: "/ai/edit/task",
dataType: "json",
type: "POST",
data: {
......
......@@ -21,7 +21,7 @@
<h4>修改定时任务项</h4>
</div>
<div class="col-md-6" style="padding-left:10px;">
<form action="/quartz/edit/task" method="post">
<form action="/ai/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"
......@@ -422,7 +422,7 @@ function initCanvas(imgData) {
$("#getrtsp").on('click', function (e) {
$.ajax({ url: "/quartz/getRtsp/"+ $("#videoid").val(),
$.ajax({ url: "/ai/getRtsp/"+ $("#videoid").val(),
dataType: "json",
type: "get",
success: function (result) {
......@@ -471,7 +471,7 @@ function initCanvas(imgData) {
var unfrozentime = $("#unfrozentime").val();
object=draw.layers[0];
$.ajax({
url: "/quartz/edit/task",
url: "/ai/edit/task",
dataType: "json",
type: "POST",
data: {
......
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