Browse Source

修改部署内容

dev-sn
yj 2 years ago
parent
commit
519eb18702
  1. 69
      device_cars/src/main/java/com/xr/device_car/modules/analysis/controller/SendUdpLogController.java
  2. 51
      device_udpclent/src/main/java/com/xr/device_udpclent/common/utils/HkComUtil.java

69
device_cars/src/main/java/com/xr/device_car/modules/analysis/controller/SendUdpLogController.java

@ -1,69 +0,0 @@
package com.xr.device_car.modules.analysis.controller;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.xr.device_car.config.utils.StringFormatterUtil;
import com.xr.device_car.modules.analysis.entity.SendUdpLog;
import com.xr.device_car.modules.analysis.entity.xslx.SendUdpLogXslx;
import com.xr.device_car.modules.analysis.service.SendUdpLogService;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.*;
@RestController
@RequestMapping("/udpLog")
@RequiredArgsConstructor
public class SendUdpLogController {
private final SendUdpLogService sendUdpLogService;
@RequestMapping("/pageList")
public IPage<SendUdpLog> pageList(SendUdpLog sendUdpLog, HttpServletRequest req){
Page<SendUdpLog> page = StringFormatterUtil.returnPage(req);
QueryWrapper<SendUdpLog> query=new QueryWrapper<>();
if(!sendUdpLog.getMessageId().isEmpty()){
query.eq("message_id", sendUdpLog.getMessageId());
}
if(sendUdpLog.getStartDate()!=null){
query.ge("request_time", sendUdpLog.getStartDate());
}
if(sendUdpLog.getEndDate()!=null){
query.lt("request_time", sendUdpLog.getEndDate());
}
query.orderByDesc("request_time");
return sendUdpLogService.page(page,query);
}
@RequestMapping("/downloadExcel")
public void downloadExcel(@RequestBody String data,HttpServletResponse res){
System.out.println(data);
Map<String,Object> object = (Map<String, Object>) JSONObject.parse(data);
SendUdpLog sendUdpLog = JSONObject.parseObject(data,SendUdpLog.class);
List<String> list = (List<String>) object.get("ids");
List<SendUdpLog> sendUdpLogs =new ArrayList<>();
if(list.isEmpty()){
QueryWrapper<SendUdpLog> query=new QueryWrapper<>();
if(!sendUdpLog.getMessageId().isEmpty()){
query.eq("message_id", sendUdpLog.getMessageId());
}
if(sendUdpLog.getStartDate()!=null){
query.ge("request_time", sendUdpLog.getStartDate());
}
if(sendUdpLog.getEndDate()!=null){
query.lt("request_time", sendUdpLog.getEndDate());
}
sendUdpLogs = sendUdpLogService.list(query);
}else{
sendUdpLogs = sendUdpLogService.listByIds(list);
}
EasyExcelUtil.writeExcel(res,sendUdpLogs,SendUdpLogXslx.class,"UDP日志");
}
}

51
device_udpclent/src/main/java/com/xr/device_udpclent/common/utils/HkComUtil.java

@ -1,51 +0,0 @@
package com.xr.device_udpclent.common.utils;
import com.xr.device_udpclent.common.config.OnvifAuthBean;
import com.xr.device_udpclent.models.entity.BallheadPT;
import com.xr.device_udpclent.models.entity.DeviceCamera;
import com.xr.device_udpclent.models.entity.OnvifBean;
import org.springframework.util.CollectionUtils;
import java.awt.image.BufferedImage;
import java.util.List;
public class HkComUtil {
public static BufferedImage getBole(DeviceCamera device) throws Exception{ //拉取枪机图片
OnvifAuthBean onvifBean= new OnvifAuthBean(device.getDeviceIp(),80,device.getAccount(),device.getPassword());
String url= OnvifBean.getRequestUrl(onvifBean);
String auth = OnvifUtils.getAuthorization("digest",onvifBean,"digest/GetProfiles.wsdl", url);
System.out.println("鉴权:"+auth);
//获取Token
List<String> profileTokens = OnvifUtils.getProfileTokens(onvifBean,auth);
System.out.println("Token:"+profileTokens);
onvifBean.setAuth(auth);
if(!CollectionUtils.isEmpty(profileTokens)){
String snapshotUrl=null;
String token = profileTokens.get(0);
BallheadPT ballheadPT=OnvifUtils.getPtzStatus(token,onvifBean);
//如果类型是球机转换指定点位
if(device.getDeviceType().equals("3") && OnvifUtils.ptzCamera(token,onvifBean,device.getX(),device.getY(),device.getZ())){
Thread.sleep(1000);
//拉取图片
snapshotUrl = OnvifUtils.getSnapshotUrl(token,onvifBean);
if(snapshotUrl!=null){
//转回原来位置
OnvifUtils.ptzCamera(token,onvifBean,ballheadPT.getX(),ballheadPT.getY(),ballheadPT.getZ());
}
//如果类型是固定枪机,直接获取图片
}else{
snapshotUrl = OnvifUtils.getSnapshotUrl(token,onvifBean);
}
//返回图片地址
return Files.urlByImage(snapshotUrl,device.getAccount(),device.getPassword());
}
return null;
}
}
Loading…
Cancel
Save