Commit 12254c87 authored by yzm's avatar yzm

修复ftpbug

parent 42a7d921
......@@ -93,10 +93,6 @@
<version>1.9</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
</dependency>
<dependency>
<groupId>junit</groupId>
......@@ -120,15 +116,9 @@
<artifactId>spring-boot-starter-quartz</artifactId>
</dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.6</version>
</dependency>
<dependency>
<groupId>commons-net</groupId>
<artifactId>commons-net</artifactId>
<version>3.6</version>
<groupId>commons-httpclient</groupId>
<artifactId>commons-httpclient</artifactId>
<version>3.1</version>
</dependency>
<!-- redis -->
......@@ -142,12 +132,6 @@
<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>
......
package com.cx.cn.cxquartz.config;
import com.cx.cn.cxquartz.service.quartz.SbtdspsrService;
import com.cx.cn.cxquartz.util.RestUtil;
import com.cx.cn.cxquartz.vo.Sbtdspsr;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;
import java.util.Calendar;
import java.util.List;
@Configuration
@EnableScheduling
public class ScheduleTaskConfig {
@Autowired
private SbtdspsrService sbtdspsrService;
@Value("${file.getrtspbyurl}")
private String getrtspbyurl;
RestUtil restUtil=new RestUtil();
/***
* 每隔20分钟执行一遍判断rtsp 是否变换
*/
@Scheduled(cron = "0 0 2 * * ? ")
private void statis() {
//查询所有监控设备,更新rtsp 地址
List<Sbtdspsr> sbtdpsrList= sbtdspsrService.list();
//调用decice 端口获得新的rtsp 地址,如果与表里的一样无需更新,不一样则立即更新
for(Sbtdspsr sbtd:sbtdpsrList)
{
restUtil.rtspChangeVlue(sbtd.getSbbh(),sbtd.getSqurllj(),getrtspbyurl);
}
}
......
......@@ -35,7 +35,7 @@ public class IndexController {
@Autowired
private RestTemplate restTemplate;
@Value("${ftppath}")
@Value("${file.ftppath}")
private String ftppath;
@Autowired
......
......@@ -45,7 +45,7 @@ public class QuartzController {
private String rtspurl;
@Value("${ftppath}")
@Value("${file.ftppath}")
private String ftppath;
......
......@@ -9,6 +9,5 @@ public interface SbtdspsrService {
List<Sbtdspsr> selectByRtsp(String videoid);
List<Map> selectRecogByRtsp(String rtsp);
int updateRecogByRtsp(String rtsp,String devicecode);
List<Sbtdspsr> list();
}
package com.cx.cn.cxquartz.service.quartz.impl;
import com.alibaba.fastjson.JSONObject;
import com.cx.cn.cxquartz.dao.SbtdspsrMapper;
import com.cx.cn.cxquartz.service.quartz.SbtdspsrService;
import com.cx.cn.cxquartz.vo.Sbtdspsr;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Service;
import org.springframework.web.client.RestTemplate;
import java.util.HashMap;
import java.util.List;
......
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 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.web.client.RestTemplate;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class RestUtil {
private static final Logger logger = LoggerFactory.getLogger(RestUtil.class);
@Autowired
private RestTemplate restTemplate;
@Autowired
SbtdspsrService sbtdspsrService;
public String getnewRtspVlue(String devicecode,String getrtspbyurl ){
String rtspnewvalue="";
Map<String, String> map = new HashMap<>();
map.put("deviceCode", devicecode);
ResponseEntity<String> responseEntity = restTemplate.getForEntity(getrtspbyurl+"?deviceCode={deviceCode}", String.class, map);
JSONObject json = JSONObject.parseObject(responseEntity.getBody());
if (null != json.getString("errorCode") && json.getString("errorCode").equals("0")) {
//返回rtsp 地址
json = JSONObject.parseObject(json.getString("data"));
if (null != json.get("rtspUri") && !"".equals(json.get("rtspUri"))) {
rtspnewvalue = String.valueOf(json.get("rtspUri"));
if(rtspnewvalue.contains("rtsp")) {
//更新sbtdspsr 地址
int result = sbtdspsrService.updateRecogByRtsp(rtspnewvalue, devicecode);
if (result > 0) {
logger.info("更新rtsp success");
} else {
logger.info("设备" + devicecode + "不存在");
}
}
else {
logger.info("获取失败");
}
}
}
return rtspnewvalue;
}
public void rtspChangeVlue(String devicecode,String oldrtsp,String getrtspbyurl ){
String rtspnewvalue="";
Map<String, String> map = new HashMap<>();
map.put("deviceCode", devicecode);
ResponseEntity<String> responseEntity = restTemplate.getForEntity(getrtspbyurl+"?deviceCode={deviceCode}", String.class, map);
JSONObject json = JSONObject.parseObject(responseEntity.getBody());
if (null != json.getString("errorCode") && json.getString("errorCode").equals("0")) {
//返回rtsp 地址
json = JSONObject.parseObject(json.getString("data"));
if (null != json.get("rtspUri") && !"".equals(json.get("rtspUri"))) {
rtspnewvalue = String.valueOf(json.get("rtspUri"));
//与新获得的rtsp 比较,如果一样则不更新,否则更新
if(oldrtsp.contains("rtsp") && !oldrtsp.equals(rtspnewvalue)) {
//更新sbtdspsr 地址
int result = sbtdspsrService.updateRecogByRtsp(rtspnewvalue, devicecode);
if (result > 0) {
logger.info("更新rtsp success");
} else {
logger.info("设备" + devicecode + "不存在");
}
}
else {
logger.info("获取失败");
}
}
}
}
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}",
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"));
}
}
}
}
......@@ -11,12 +11,12 @@ mybatis:
spring:
datasource:
# url: jdbc:mysql://192.168.168.212:3306/imagepro?useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone=UTC&allowPublicKeyRetrieval=true
#username: zn06
#password: znznzn8
url: jdbc:mysql://172.16.24.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&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
# username: root
# password: 123456
driver-class-name: com.mysql.jdbc.Driver
type: com.alibaba.druid.pool.DruidDataSource
filters: stat
......@@ -52,5 +52,3 @@ logging:
level:
com.cx.cn.cxquartz.dao:
debug
\ No newline at end of file
......@@ -20,6 +20,6 @@ eventwrite.url=http://countryside.51iwifi.com/gw/hesc-mq/hesc/mq/receive/cameraa
countryside.appid=05744e80b2c211ebe32a8e271066b19e
countryside.appsecret=a55a8870b2e911ebe32a8e271066b19e
countryside.tokenurl=http://countryside.51iwifi.com/gw/getAccessToken
file.publicpictureurl=http://zjh189.ncpoi.cc:10001
ftppath=jiuling:9ling.cn@172.16.24.29:21
file.publicpictureurl=http://zjh189.ncpoi.cc:10001/api/alg/files
file.ftppath=jiuling:9ling.cn@172.16.24.29:21
......@@ -20,7 +20,7 @@
<select id="selectRecogByRtsp" parameterType="java.lang.String" resultType="java.util.HashMap">
SELECT DISTINCT
(select concat(sbbh,"_",tdbh) from sbtdspsr where sbbh=b.videoid or squrllj=b.videoid limit 1) videoid,
(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,
......@@ -31,7 +31,7 @@
FROM
quartz_task_informations b
WHERE
(videoid=#{rtsp} or executeparamter=#{rtsp})
(videoid=#{rtsp} or executeparamter=#{rtsp})and recordtype is not null
</select>
<update id="updateRecogByRtsp" parameterType="java.util.HashMap" >
......
......@@ -162,7 +162,7 @@
</update>
<select id="getTraffAlarmRecordByProgress" parameterType="java.util.HashMap" resultType="com.cx.cn.cxquartz.vo.TraffAlarmRecord">
select * from traffalarmrecord where fdid=#{sbbh} and channelid=#{tdbh} and processstatus='-2'
select * from traffalarmrecord where fdid=#{sbbh} and processstatus='-2'
</select>
<update id="updateTraffAlarmRecordProcess" parameterType="com.cx.cn.cxquartz.vo.TraffAlarmRecord">
......
......@@ -72,7 +72,18 @@
</div>
<div class="form-group"><label
class="col-sm-2 control-label text-right">监控id:</label>
class="col-sm-2 control-label text-right">监控id:</label>
<select class="form-control" id="metatype">
<option th:value="3DHCA343714GMCE"
山河村
</option>
<option th:value="3DHCA34401BUXS9">
赵家上村
</option>
<option th:value="3YSCA44524PUH3B" >
3YSCA44524PUH3B
</option>
</select>
</div>
<div class="form-group">
......@@ -81,8 +92,8 @@
id="videoid" class="form-control" style="width:65%;float: left">
<a id="getrtsp" href=" javascript:void(0)"
style="float: left;padding-left: 12px;padding-top: 10px;">获得监控图片</a>
<a id="getwidth" href=" javascript:void(0)"
style="float: left;padding-left: 12px;padding-top: 10px;">编辑监控范围</a>
<!--<a id="getwidth" href=" javascript:void(0)"-->
<!--style="float: left;padding-left: 12px;padding-top: 10px;">编辑监控范围</a>-->
</div>
</div>
......@@ -95,7 +106,6 @@
</option>
<option th:value="2">
行人、骑行、车辆检测识别
</option>
<option th:value="3" >
人脸检测识别
......
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