From 519eb18702a09a25bd1822e933b97d9d5eb65743 Mon Sep 17 00:00:00 2001 From: yj <913944315@qq.com> Date: Tue, 6 Feb 2024 10:03:38 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E9=83=A8=E7=BD=B2=E5=86=85?= =?UTF-8?q?=E5=AE=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/SendUdpLogController.java | 69 ------------------- .../common/utils/HkComUtil.java | 51 -------------- 2 files changed, 120 deletions(-) delete mode 100644 device_cars/src/main/java/com/xr/device_car/modules/analysis/controller/SendUdpLogController.java delete mode 100644 device_udpclent/src/main/java/com/xr/device_udpclent/common/utils/HkComUtil.java diff --git a/device_cars/src/main/java/com/xr/device_car/modules/analysis/controller/SendUdpLogController.java b/device_cars/src/main/java/com/xr/device_car/modules/analysis/controller/SendUdpLogController.java deleted file mode 100644 index ddd7ac4..0000000 --- a/device_cars/src/main/java/com/xr/device_car/modules/analysis/controller/SendUdpLogController.java +++ /dev/null @@ -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 pageList(SendUdpLog sendUdpLog, HttpServletRequest req){ - Page page = StringFormatterUtil.returnPage(req); - QueryWrapper 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 object = (Map) JSONObject.parse(data); - SendUdpLog sendUdpLog = JSONObject.parseObject(data,SendUdpLog.class); - List list = (List) object.get("ids"); - List sendUdpLogs =new ArrayList<>(); - if(list.isEmpty()){ - QueryWrapper 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日志"); - } - -} diff --git a/device_udpclent/src/main/java/com/xr/device_udpclent/common/utils/HkComUtil.java b/device_udpclent/src/main/java/com/xr/device_udpclent/common/utils/HkComUtil.java deleted file mode 100644 index 735b9f2..0000000 --- a/device_udpclent/src/main/java/com/xr/device_udpclent/common/utils/HkComUtil.java +++ /dev/null @@ -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 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; - } - - - - - - -}