Commit 0fb389f1 authored by 高飞's avatar 高飞

添加手动筛选功能

parent 3fe59c5a
package com.hzjt.controller;
import cn.hutool.core.codec.Base64Encoder;
import com.alibaba.fastjson.JSONObject;
import com.google.common.util.concurrent.RateLimiter;
import com.hzjt.domain.*;
......@@ -17,6 +18,7 @@ import org.springframework.beans.factory.annotation.Value;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.web.bind.annotation.*;
import javax.websocket.server.PathParam;
import java.io.IOException;
import java.io.InputStream;
import java.net.HttpURLConnection;
......@@ -218,10 +220,20 @@ public class TraffController {
traffAlarmRecord.setRecordid((long) (recordid));
//发送给前端
Map map = new HashMap();
map.put("type", "alarm");
//判断是否需要手动筛选
String manualStatus=traffAlarmRecordMapper.seletManualStatus();
if(manualStatus.equalsIgnoreCase("1")) {
map.put("type", "recordalarm");
}else {
map.put("type", "alarm");
}
map.put("data", trffClientMessage);
map.put("recordid", recordid);
WebSocket.GroupSending(JsonUtil.beanToString(map));
traffAlarmRecord.setProcessstatus("0");
traffAlarmRecordMapper.inserTraffAlarmRecord(traffAlarmRecord);
......@@ -268,8 +280,10 @@ public class TraffController {
traffAlarmRecordMapper.updateTraffAlarmRecordUrl(traffAlarmRecord);
//推送给第三方
ResultObj obj = eventWriteService.updateAndAutoSendEvent(traffAlarmRecord);
if(!manualStatus.equalsIgnoreCase("1")) {
ResultObj obj = eventWriteService.updateAndAutoSendEvent(traffAlarmRecord);
// log.info("send to guangda:HTTP_OK" + obj.toString());
}
}
} else {
ResultObj obj = eventWriteService.updateAndAutoSendEvent(traffAlarmRecord);
......@@ -288,9 +302,11 @@ public class TraffController {
} else {
//推送给第三方
ResultObj obj = eventWriteService.updateAndAutoSendEvent(traffAlarmRecord);
// log.info("send to guangda novideopath --->response message" + obj.toString());
//需要先过滤,过滤结束后推送给第三方
if(!manualStatus.equalsIgnoreCase("1")) {
ResultObj obj = eventWriteService.updateAndAutoSendEvent(traffAlarmRecord);
log.info("send to guangda novideopath --->response message" + obj.toString());
}
}
......@@ -419,16 +435,139 @@ public class TraffController {
return ResultObj.ok();
}
//车流量推送
@GetMapping("/sendtouser/{recordid}")
@ResponseBody
public Integer sendtouser(@PathVariable("recordid") String recordid) {
//查询该信息
Traffalarmrecord traffalarmrecord = traffAlarmRecordMapper.selectByPrimaryKey(recordid);
if(traffalarmrecord==null) return 0;
Alarm alarm=new Alarm();
Base64Encoder base64Encoder=new Base64Encoder();
alarm.setTs(Long.toString(traffalarmrecord.getRecordtime()==null?new Date().getTime():traffalarmrecord.getRecordtime().getTime()));
alarm.setDept(traffalarmrecord.getAreaid()==null?null:Long.toString(traffalarmrecord.getAreaid()));
alarm.setVideo_id(traffalarmrecord.getFdid()+"_"+traffalarmrecord.getChannelid());
alarm.setIncident_type(traffalarmrecord.getRecordtype());
List<String> strImgs=new ArrayList<>();
if(traffalarmrecord.getImg1path() != null ){
byte[] Img=FTPUtil.getFtpPicBytes(traffalarmrecord.getImg1path());
strImgs.add(Img!=null?base64Encoder.encode(Img) : null);
}
if(traffalarmrecord.getImg2path() != null ){
byte[] Img=FTPUtil.getFtpPicBytes(traffalarmrecord.getImg2path());
strImgs.add(Img!= null ? base64Encoder.encode(Img) : null);
}
if(traffalarmrecord.getImg3path() != null ) {
byte[] Img = FTPUtil.getFtpPicBytes(traffalarmrecord.getImg3path());
strImgs.add(Img != null ? base64Encoder.encode(Img) : null);
}
if(traffalarmrecord.getImg4path() != null ) {
byte[] Img = FTPUtil.getFtpPicBytes(traffalarmrecord.getImg4path());
strImgs.add(Img != null ? base64Encoder.encode(Img) : null);
}
if(traffalarmrecord.getImg5path() != null ) {
byte[] Img = FTPUtil.getFtpPicBytes(traffalarmrecord.getImg5path());
strImgs.add(Img != null ? base64Encoder.encode(Img) : null);
}
alarm.setImg_base64(strImgs);
Map map=new HashMap();
//websocket 推送给客户
map.put("type", "alarm");
map.put("data", alarm);
map.put("recordid", recordid);
WebSocket.GroupSending(JsonUtil.beanToString(map));
try {
//推送给第三方
ResultObj obj = eventWriteService.updateAndAutoSendEvent(traffalarmrecord);
log.info("send to guangda novideopath --->response message" + obj.toString());
if (obj.getStatus() == 200) {
return 1;
} else {
return 0;
}
}catch (Exception ex){
log.info("send to guangda novideopath --->response error" + ex.toString());
return 1;
}
}
//车流量推送
@GetMapping("/test")
@ResponseBody
public String test() {
public void test() {
Alarm alarm=new Alarm();
alarm.setVideo_id("20200305112042989_0");
alarm.setIncident_type("vehicle_ban");
alarm.setTs("1345677777");
alarm.setType("TRAFFIC_INCIDENT_ALARM");
Map map=new HashMap();
map.put("type", "recordalarm");
map.put("data", alarm);
map.put("recordid", "33448");
WebSocket.GroupSending(JsonUtil.beanToString(map));
Traffalarmrecord traffAlarmRecord=new Traffalarmrecord();
traffAlarmRecord.setRecordid(Long.parseLong("33448"));
traffAlarmRecord.setChannelid(new Integer(1));
traffAlarmRecord.setFdid("20200305112042989");
traffAlarmRecord.setRecordtype("vehicle_ban");
// traffAlarmRecordMapper.inserTraffAlarmRecord(traffAlarmRecord);
map.put("recordid", "33449");
WebSocket.GroupSending(JsonUtil.beanToString(map));
Traffalarmrecord traffAlarmRecord2=new Traffalarmrecord();
traffAlarmRecord2.setRecordid(Long.parseLong("33449"));
traffAlarmRecord2.setChannelid(new Integer(1));
traffAlarmRecord2.setFdid("20200305112042989");
traffAlarmRecord2.setRecordtype("vehicle_ban");
Long ldir2 = new Long(180);
String result=ldir2.longValue()<=ldir.longValue()?"2":"1";
return result;
// traffAlarmRecordMapper.inserTraffAlarmRecord(traffAlarmRecord2);
}
//车流量推送
@GetMapping("/test2")
@ResponseBody
public void test2() {
Alarm alarm=new Alarm();
alarm.setVideo_id("20200305112042989_0");
alarm.setIncident_type("vehicle_ban");
alarm.setType("TRAFFIC_INCIDENT_ALARM");
Map map=new HashMap();
map.put("type", "recordalarm");
map.put("data", alarm);
map.put("recordid", "33446");
WebSocket.GroupSending(JsonUtil.beanToString(map));
Traffalarmrecord traffAlarmRecord=new Traffalarmrecord();
traffAlarmRecord.setRecordid(Long.parseLong("33446"));
traffAlarmRecord.setChannelid(new Integer(1));
traffAlarmRecord.setFdid("20200305112042989");
traffAlarmRecord.setRecordtype("vehicle_ban");
traffAlarmRecordMapper.inserTraffAlarmRecord(traffAlarmRecord);
map.put("recordid", "33447");
WebSocket.GroupSending(JsonUtil.beanToString(map));
Traffalarmrecord traffAlarmRecord2=new Traffalarmrecord();
traffAlarmRecord2.setRecordid(Long.parseLong("33447"));
traffAlarmRecord2.setChannelid(new Integer(1));
traffAlarmRecord2.setFdid("20200305112042989");
traffAlarmRecord2.setRecordtype("vehicle_ban");
traffAlarmRecordMapper.inserTraffAlarmRecord(traffAlarmRecord2);
}
}
......@@ -2,6 +2,7 @@ package com.hzjt.handler;
import cn.hutool.json.JSONUtil;
import com.hzjt.service.TraffFlowService;
import com.hzjt.util.JsonUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
......
......@@ -31,4 +31,6 @@ public interface TraffAlarmRecordMapper extends BaseMapper<Traffalarmrecord>, Co
Integer updateInworkRectifytimeTraffAlarm(Traffalarmrecord traffalarmrecord);
String seletManualStatus();
}
\ No newline at end of file
......@@ -140,14 +140,35 @@ public class EventWriteService {
eventWriteParam.setEventDeviceID(sbtdspsr.get(0).getWbbh());
eventWriteParam.setEventSupplier(EVENT_SUPPLIER);
BASE64Encoder base64Encoder = new BASE64Encoder();
if(traffalarmrecord.getImg1path() != null ){
byte[] Img=FTPUtil.getFtpPicBytes(traffalarmrecord.getImg1path());
eventWriteParam.setEventProof1(Img!=null?base64Encoder.encode(Img) : null);
}
if(traffalarmrecord.getImg2path() != null ){
byte[] Img=FTPUtil.getFtpPicBytes(traffalarmrecord.getImg2path());
eventWriteParam.setEventProof2(Img!= null ? base64Encoder.encode(Img) : null);
}
if(traffalarmrecord.getImg3path() != null ) {
byte[] Img = FTPUtil.getFtpPicBytes(traffalarmrecord.getImg3path());
eventWriteParam.setEventProof3(Img != null ? base64Encoder.encode(Img) : null);
}
if(traffalarmrecord.getImg4path() != null ) {
byte[] Img = FTPUtil.getFtpPicBytes(traffalarmrecord.getImg4path());
eventWriteParam.setEventProof4(Img != null ? base64Encoder.encode(Img) : null);
}
if(traffalarmrecord.getImg5path() != null ) {
byte[] Img = FTPUtil.getFtpPicBytes(traffalarmrecord.getImg5path());
eventWriteParam.setEventProof5(Img != null ? base64Encoder.encode(Img) : null);
}
if(traffalarmrecord.getVideopath() != null ) {
byte[] video = FTPUtil.getFtpPicBytes(traffalarmrecord.getVideopath());
eventWriteParam.setEventvideo1(video != null ? base64Encoder.encode(video) : null);
}
//String strBase64 = new BASE64Encoder().encode(FTPUtil.getFtpPicBytes(strings.get(i).get("PICPATH1").toString()));
eventWriteParam.setEventProof1(traffalarmrecord.getImg1path()!=null?base64Encoder.encode(FTPUtil.getFtpPicBytes(traffalarmrecord.getImg1path())):null);
eventWriteParam.setEventProof2(traffalarmrecord.getImg2path()!=null?base64Encoder.encode(FTPUtil.getFtpPicBytes(traffalarmrecord.getImg2path())):null);
eventWriteParam.setEventProof3(traffalarmrecord.getImg3path()!=null?base64Encoder.encode(FTPUtil.getFtpPicBytes(traffalarmrecord.getImg3path())):null);
eventWriteParam.setEventProof4(traffalarmrecord.getImg4path()!=null?base64Encoder.encode(FTPUtil.getFtpPicBytes(traffalarmrecord.getImg4path())):null);
eventWriteParam.setEventProof5(traffalarmrecord.getImg5path()!=null?base64Encoder.encode(FTPUtil.getFtpPicBytes(traffalarmrecord.getImg5path())):null);
eventWriteParam.setEventvideo1(traffalarmrecord.getVideopath()!=null?base64Encoder.encode(FTPUtil.getFtpPicBytes(traffalarmrecord.getVideopath())):null);
//String strBase64 = new BASE64Encoder().encode(FTPUtil.getFtpPicBytes(strings.get(i).get("PICPATH1").toString()));
WriteResultObj writeResultObj;
Long endtime = System.currentTimeMillis();
try {
......
......@@ -29,12 +29,12 @@ mybatis.configuration.default-statement-timeout=3000
#spring.datasource.dbcp2.connection-properties=characterEncoding=utf8
# Mysql���ݿ�-����Դ����
#spring.datasource.username=test
#spring.datasource.password=test
#spring.datasource.url=jdbc:oracle:thin:@192.168.168.212:1523:helowin
spring.datasource.username=hzjt
spring.datasource.password=hzjt
spring.datasource.url=jdbc:oracle:thin:@33.50.1.22:1521:orcl
spring.datasource.username=test
spring.datasource.password=test
spring.datasource.url=jdbc:oracle:thin:@192.168.168.212:1523:helowin
#spring.datasource.username=hzjt
#spring.datasource.password=hzjt
#spring.datasource.url=jdbc:oracle:thin:@33.50.1.22:1521:orcl
spring.datasource.driverClassName=oracle.jdbc.OracleDriver
# druid
spring.datasource.type=com.alibaba.druid.pool.DruidDataSource
......
......@@ -174,5 +174,7 @@
and recordtype in ('illegal_parking','no_motor_ban')
</update>
<select id="seletManualStatus">
select name from t_code where type=4
</select>
</mapper>
\ No newline at end of file
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