Commit 12254c87 authored by yzm's avatar yzm

修复ftpbug

parent 42a7d921
...@@ -93,10 +93,6 @@ ...@@ -93,10 +93,6 @@
<version>1.9</version> <version>1.9</version>
</dependency> </dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
</dependency>
<dependency> <dependency>
<groupId>junit</groupId> <groupId>junit</groupId>
...@@ -120,15 +116,9 @@ ...@@ -120,15 +116,9 @@
<artifactId>spring-boot-starter-quartz</artifactId> <artifactId>spring-boot-starter-quartz</artifactId>
</dependency> </dependency>
<dependency> <dependency>
<groupId>commons-io</groupId> <groupId>commons-httpclient</groupId>
<artifactId>commons-io</artifactId> <artifactId>commons-httpclient</artifactId>
<version>2.6</version> <version>3.1</version>
</dependency>
<dependency>
<groupId>commons-net</groupId>
<artifactId>commons-net</artifactId>
<version>3.6</version>
</dependency> </dependency>
<!-- redis --> <!-- redis -->
...@@ -142,12 +132,6 @@ ...@@ -142,12 +132,6 @@
<groupId>org.springframework.kafka</groupId> <groupId>org.springframework.kafka</groupId>
<artifactId>spring-kafka</artifactId> <artifactId>spring-kafka</artifactId>
</dependency> </dependency>
<!-- HttpClient依赖 -->
<dependency>
<groupId>commons-httpclient</groupId>
<artifactId>commons-httpclient</artifactId>
<version>3.1</version>
</dependency>
<dependency> <dependency>
<groupId>com.alibaba</groupId> <groupId>com.alibaba</groupId>
<artifactId>fastjson</artifactId> <artifactId>fastjson</artifactId>
......
package com.cx.cn.cxquartz.config; 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.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.annotation.EnableScheduling; import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled; import org.springframework.scheduling.annotation.Scheduled;
import java.util.Calendar; import java.util.Calendar;
import java.util.List;
@Configuration @Configuration
@EnableScheduling @EnableScheduling
public class ScheduleTaskConfig { public class ScheduleTaskConfig {
@Autowired
private SbtdspsrService sbtdspsrService;
@Value("${file.getrtspbyurl}")
private String getrtspbyurl;
RestUtil restUtil=new RestUtil();
/*** /***
* 每隔20分钟执行一遍判断rtsp 是否变换 * 每隔20分钟执行一遍判断rtsp 是否变换
*/ */
@Scheduled(cron = "0 0 2 * * ? ") @Scheduled(cron = "0 0 2 * * ? ")
private void statis() { 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 { ...@@ -35,7 +35,7 @@ public class IndexController {
@Autowired @Autowired
private RestTemplate restTemplate; private RestTemplate restTemplate;
@Value("${ftppath}") @Value("${file.ftppath}")
private String ftppath; private String ftppath;
@Autowired @Autowired
......
...@@ -45,7 +45,7 @@ public class QuartzController { ...@@ -45,7 +45,7 @@ public class QuartzController {
private String rtspurl; private String rtspurl;
@Value("${ftppath}") @Value("${file.ftppath}")
private String ftppath; private String ftppath;
......
...@@ -9,6 +9,5 @@ public interface SbtdspsrService { ...@@ -9,6 +9,5 @@ public interface SbtdspsrService {
List<Sbtdspsr> selectByRtsp(String videoid); List<Sbtdspsr> selectByRtsp(String videoid);
List<Map> selectRecogByRtsp(String rtsp); List<Map> selectRecogByRtsp(String rtsp);
int updateRecogByRtsp(String rtsp,String devicecode); int updateRecogByRtsp(String rtsp,String devicecode);
List<Sbtdspsr> list(); List<Sbtdspsr> list();
} }
package com.cx.cn.cxquartz.service.quartz.impl; 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.dao.SbtdspsrMapper;
import com.cx.cn.cxquartz.service.quartz.SbtdspsrService; import com.cx.cn.cxquartz.service.quartz.SbtdspsrService;
import com.cx.cn.cxquartz.vo.Sbtdspsr; import com.cx.cn.cxquartz.vo.Sbtdspsr;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.web.client.RestTemplate;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; 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: ...@@ -11,12 +11,12 @@ mybatis:
spring: spring:
datasource: datasource:
# url: jdbc:mysql://192.168.168.212:3306/imagepro?useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone=UTC&allowPublicKeyRetrieval=true url: jdbc:mysql://192.168.168.110: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
username: root username: root
password: 123456 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 driver-class-name: com.mysql.jdbc.Driver
type: com.alibaba.druid.pool.DruidDataSource type: com.alibaba.druid.pool.DruidDataSource
filters: stat filters: stat
...@@ -51,6 +51,4 @@ spring: ...@@ -51,6 +51,4 @@ spring:
logging: logging:
level: level:
com.cx.cn.cxquartz.dao: com.cx.cn.cxquartz.dao:
debug debug
\ No newline at end of file
...@@ -20,6 +20,6 @@ eventwrite.url=http://countryside.51iwifi.com/gw/hesc-mq/hesc/mq/receive/cameraa ...@@ -20,6 +20,6 @@ eventwrite.url=http://countryside.51iwifi.com/gw/hesc-mq/hesc/mq/receive/cameraa
countryside.appid=05744e80b2c211ebe32a8e271066b19e countryside.appid=05744e80b2c211ebe32a8e271066b19e
countryside.appsecret=a55a8870b2e911ebe32a8e271066b19e countryside.appsecret=a55a8870b2e911ebe32a8e271066b19e
countryside.tokenurl=http://countryside.51iwifi.com/gw/getAccessToken countryside.tokenurl=http://countryside.51iwifi.com/gw/getAccessToken
file.publicpictureurl=http://zjh189.ncpoi.cc:10001 file.publicpictureurl=http://zjh189.ncpoi.cc:10001/api/alg/files
ftppath=jiuling:9ling.cn@172.16.24.29:21 file.ftppath=jiuling:9ling.cn@172.16.24.29:21
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
<select id="selectRecogByRtsp" parameterType="java.lang.String" resultType="java.util.HashMap"> <select id="selectRecogByRtsp" parameterType="java.lang.String" resultType="java.util.HashMap">
SELECT DISTINCT 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, (select tdmc from sbtdspsr where sbbh=b.videoid or squrllj=b.videoid limit 1) tdmc,
metatype, metatype,
recordtype, recordtype,
...@@ -31,7 +31,7 @@ ...@@ -31,7 +31,7 @@
FROM FROM
quartz_task_informations b quartz_task_informations b
WHERE WHERE
(videoid=#{rtsp} or executeparamter=#{rtsp}) (videoid=#{rtsp} or executeparamter=#{rtsp})and recordtype is not null
</select> </select>
<update id="updateRecogByRtsp" parameterType="java.util.HashMap" > <update id="updateRecogByRtsp" parameterType="java.util.HashMap" >
......
...@@ -162,7 +162,7 @@ ...@@ -162,7 +162,7 @@
</update> </update>
<select id="getTraffAlarmRecordByProgress" parameterType="java.util.HashMap" resultType="com.cx.cn.cxquartz.vo.TraffAlarmRecord"> <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> </select>
<update id="updateTraffAlarmRecordProcess" parameterType="com.cx.cn.cxquartz.vo.TraffAlarmRecord"> <update id="updateTraffAlarmRecordProcess" parameterType="com.cx.cn.cxquartz.vo.TraffAlarmRecord">
......
...@@ -72,7 +72,18 @@ ...@@ -72,7 +72,18 @@
</div> </div>
<div class="form-group"><label <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>
<div class="form-group"> <div class="form-group">
...@@ -81,8 +92,8 @@ ...@@ -81,8 +92,8 @@
id="videoid" class="form-control" style="width:65%;float: left"> id="videoid" class="form-control" style="width:65%;float: left">
<a id="getrtsp" href=" javascript:void(0)" <a id="getrtsp" href=" javascript:void(0)"
style="float: left;padding-left: 12px;padding-top: 10px;">获得监控图片</a> style="float: left;padding-left: 12px;padding-top: 10px;">获得监控图片</a>
<a id="getwidth" href=" javascript:void(0)" <!--<a id="getwidth" href=" javascript:void(0)"-->
style="float: left;padding-left: 12px;padding-top: 10px;">编辑监控范围</a> <!--style="float: left;padding-left: 12px;padding-top: 10px;">编辑监控范围</a>-->
</div> </div>
</div> </div>
...@@ -95,7 +106,6 @@ ...@@ -95,7 +106,6 @@
</option> </option>
<option th:value="2"> <option th:value="2">
行人、骑行、车辆检测识别 行人、骑行、车辆检测识别
</option> </option>
<option th:value="3" > <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