From 2494e3538d2ca2003f250b3f75283a9444442068 Mon Sep 17 00:00:00 2001
From: huliguo <2023611923@qq.com>
Date: 星期一, 18 八月 2025 14:28:35 +0800
Subject: [PATCH] 增加导出条件
---
guns-admin/src/main/java/com/stylefeng/guns/modular/api/PatrolTaskController.java | 100 +++++++++++++++++++++++++++++++++++++++----------
1 files changed, 79 insertions(+), 21 deletions(-)
diff --git a/guns-admin/src/main/java/com/stylefeng/guns/modular/api/PatrolTaskController.java b/guns-admin/src/main/java/com/stylefeng/guns/modular/api/PatrolTaskController.java
index c523743..f36d398 100644
--- a/guns-admin/src/main/java/com/stylefeng/guns/modular/api/PatrolTaskController.java
+++ b/guns-admin/src/main/java/com/stylefeng/guns/modular/api/PatrolTaskController.java
@@ -1,5 +1,6 @@
package com.stylefeng.guns.modular.api;
+import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.plugins.Page;
import com.stylefeng.guns.core.base.controller.BaseController;
import com.stylefeng.guns.core.common.constant.JwtConstants;
@@ -15,22 +16,29 @@
import com.stylefeng.guns.modular.system.util.videoGateway.VideoGateway;
import com.stylefeng.guns.modular.system.util.videoGateway.model.Ship;
import com.stylefeng.guns.modular.system.util.videoGateway.model.Vehicle;
+import com.stylefeng.guns.modular.system.warpper.VehicleSpeed;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
+import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
+import java.time.LocalDateTime;
+import java.time.format.DateTimeFormatter;
+import java.time.format.DateTimeParseException;
import java.util.*;
+import java.util.stream.Collectors;
/**
* @author zhibing.pu
* @Date 2024/12/17 20:18
*/
+@Slf4j
@RestController
-@RequestMapping("/base/patrolTask")
+@RequestMapping("")
public class PatrolTaskController extends BaseController {
@Resource
@@ -41,9 +49,9 @@
- @GetMapping("/getTaskDetailList")
+ @PostMapping("/api/patrolTask/getTaskDetailList")
@ApiOperation(value = "获取任务列表数据", tags = {"任务管理"})
- public PageInfoBT<TaskDetailList> getTaskDetailList(TaskDetailListVo vo){
+ public PageInfoBT<TaskDetailList> getTaskDetailList(@RequestBody TaskDetailListVo vo){
Page<TaskDetailList> pageInfo = new Page(vo.getLimit(), vo.getOffset());
List<TaskDetailList> taskDetailList = taskDetailService.getTaskDetailList(pageInfo, vo);
pageInfo.setRecords(taskDetailList);
@@ -55,7 +63,7 @@
- @DeleteMapping("/delTaskDetail")
+ @DeleteMapping("/api/patrolTask/delTaskDetail")
@ApiOperation(value = "删除任务", tags = {"任务管理"})
public ResultUtil delTaskDetail(String ids){
List<String> id = Arrays.asList(ids.split(","));
@@ -65,7 +73,7 @@
- @PostMapping("/addPatrolTask")
+ @PostMapping("/api/patrolTask/addPatrolTask")
@ApiOperation(value = "添加巡查任务", tags = {"任务管理"})
public ResultUtil addPatrolTask(@RequestBody PatrolTaskVo vo, HttpServletRequest request){
String token = request.getHeader(JwtConstants.AUTH_HEADER);
@@ -77,7 +85,7 @@
return ResultUtil.success();
}
- @GetMapping("/getImageModel")
+ @GetMapping("/api/patrolTask/getImageModel")
@ApiOperation(value = "获取图片模型", tags = {"任务管理"})
public ResultUtil<List<Map<String, Object>>> getImageModel(){
ImageModelEnum[] values = ImageModelEnum.values();
@@ -95,7 +103,7 @@
- @GetMapping("/getVideoChannel")
+ @GetMapping("/api/patrolTask/getVideoChannel")
@ApiOperation(value = "获取视频通道", tags = {"任务管理"})
public ResultUtil<List<Map<String, Object>>> getVideoChannel(){
VideoChannelEnum[] values = VideoChannelEnum.values();
@@ -112,7 +120,7 @@
}
- @GetMapping("/getVehicleList")
+ @GetMapping("/api/patrolTask/getVehicleList")
@ApiOperation(value = "获取车辆列表", tags = {"任务管理"})
public ResultUtil<List<Vehicle>> getVehicleList(Integer year){
List<Vehicle> vehicleList = VideoGateway.getVehicleList(null, null, null, 0);
@@ -132,7 +140,7 @@
- @GetMapping("/getShipList")
+ @GetMapping("/api/patrolTask/getShipList")
@ApiOperation(value = "获取船舶列表", tags = {"任务管理"})
public ResultUtil<List<Ship>> getShipList(Integer year){
List<Ship> shipList = VideoGateway.getShipList(null, null, null, 0);
@@ -152,9 +160,9 @@
- @GetMapping("/getTaskRecordList")
+ @PostMapping("/api/patrolTask/getTaskRecordList")
@ApiOperation(value = "获取任务记录列表", tags = {"任务记录"})
- public PageInfoBT<TaskRecordList> getTaskRecordList(TaskRecordListVo vo){
+ public PageInfoBT<TaskRecordList> getTaskRecordList(@RequestBody TaskRecordListVo vo){
Page<TaskRecordList> pageInfo = new Page(vo.getLimit(), vo.getOffset());
List<TaskRecordList> taskRecordList = taskDetailService.getTaskRecordList(pageInfo, vo);
pageInfo.setRecords(taskRecordList);
@@ -166,14 +174,14 @@
- @GetMapping("/getTaskRecordInfo")
+ @GetMapping("/api/patrolTask/getTaskRecordInfo")
@ApiOperation(value = "获取任务记录详情", tags = {"任务记录"})
public ResultUtil<TaskRecordInfo> getTaskRecordInfo(Integer id){
TaskRecordInfo taskRecordInfo = taskDetailService.getTaskRecordInfo(id);
return ResultUtil.success(taskRecordInfo);
}
- @PostMapping("/getPictureDetailsVehicle")
+ @PostMapping("/api/patrolTask/getPictureDetailsVehicle")
@ApiOperation(value = "获取任务记录详情中的车船数据", tags = {"任务记录"})
public ResultUtil<PictureDetailsVehicle> getPictureDetailsVehicle(@RequestBody PictureDetailsVo vo){
PictureDetailsVehicle pictureDetailsVehicle = taskDetailService.getPictureDetailsVehicle(vo);
@@ -182,7 +190,7 @@
- @PostMapping("/getPictureDetails")
+ @PostMapping("/api/patrolTask/getPictureDetails")
@ApiOperation(value = "获取任务记录详情中的视频通道数据", tags = {"任务记录"})
public PageInfoBT<PictureDetails> getPictureDetails(@RequestBody PictureDetailsVo vo){
Page<PictureDetails> pageInfo = new Page(vo.getLimit(), vo.getOffset());
@@ -196,27 +204,77 @@
- @PostMapping("/manualAudit")
+ @PostMapping("/api/patrolTask/manualAudit")
@ApiOperation(value = "人工审核视频通道数据", tags = {"任务记录"})
- public ResultUtil manualAudit(@RequestBody ManualAuditVo vo){
- return taskDetailService.manualAudit(vo);
+ public ResultUtil manualAudit(@RequestBody ManualAuditVo vo, HttpServletRequest request){
+ String token = request.getHeader(JwtConstants.AUTH_HEADER);
+ if (token != null && token.startsWith("Bearer ")) {
+ token = token.substring(token.indexOf(" ") + 1);
+ }
+ String userId = JwtTokenUtil.getPrivateClaimFromToken(token, "userId");
+ return taskDetailService.manualAudit(vo, userId);
}
+
- @GetMapping("/downloadTaskRecord")
+ @GetMapping("/api/patrolTask/downloadTaskRecord")
@ApiOperation(value = "下载任务记录数据", tags = {"任务记录"})
@ApiImplicitParams({
@ApiImplicitParam(value = "列表数据id,多个逗号分隔", name = "ids", dataType = "String"),
- @ApiImplicitParam(value = "状态(1=待执行,2=进行中,3=成功,4=失败)", name = "status", dataType = "int"),
+ @ApiImplicitParam(value = "状态(1=待执行,2=进行中,3=成功,4=失败)", name = "status", dataType = "String"),
@ApiImplicitParam(value = "规则编号", name = "code", dataType = "String"),
+ @ApiImplicitParam(value = "任务类型", name = "type", dataType = "int"),
+ @ApiImplicitParam(value = "任务名称", name = "name", dataType = "String"),
+ @ApiImplicitParam(value = "系统审核状态(1=未执行,2=正常,3=异常)", name = "sysStatus", dataType = "int"),
+ @ApiImplicitParam(value = "执行时间范围(开始时间)", name = "startTime", dataType = "String"),
+ @ApiImplicitParam(value = "执行时间范围(结束时间)", name = "endTime", dataType = "String"),
})
- public void downloadTaskRecord(String ids, String code, Integer status, HttpServletResponse response){
+ public void downloadTaskRecord(String ids, String code, String status,Integer type, String name, Integer sysStatus,String startTime ,String endTime,HttpServletResponse response){
List<String> id = null;
if(ToolUtil.isNotEmpty(ids)){
String[] split = ids.split(",");
id = Arrays.asList(split);
}
- taskDetailService.downloadTaskRecord(id, code, status, response);
+ List<Integer> statusList=null;
+ if(ToolUtil.isNotEmpty(status)){
+ String[] split = status.split(",");
+ statusList = Arrays.stream(split)
+ .map(Integer::parseInt)
+ .collect(Collectors.toList());
+
+ }
+ LocalDateTime startTime2 = null;
+ LocalDateTime endTime2 = null;
+
+ // 定义匹配前端时间格式的解析器(处理带毫秒和Z的情况)
+ DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
+ try {
+ // 解析为LocalDateTime(Z代表UTC时区,这里直接按字符串处理)
+ startTime2 = LocalDateTime.parse(startTime, formatter);
+ endTime2 = LocalDateTime.parse(endTime, formatter);
+ } catch (DateTimeParseException e) {
+ System.err.println("时间格式错误 " );
+ }
+ taskDetailService.downloadTaskRecord(id, code, statusList,sysStatus,type,name,startTime2,endTime2,response);
+ }
+
+
+ @PostMapping("/base/patrolTask/vehicleSpeed")
+ @ApiOperation(value = "变更车辆状态", tags = {"互联互通接口"})
+ @ApiImplicitParams({
+ @ApiImplicitParam(value = "车牌号", name = "vehicleNum", dataType = "String", required = true),
+ @ApiImplicitParam(value = "状态(1=行驶中,2=已停止)", name = "vehicleStatus", dataType = "int", required = true),
+ @ApiImplicitParam(value = "车辆类型(1=车,2=船)", name = "vehicleType", dataType = "int", required = true),
+ @ApiImplicitParam(value = "通信号", name = "communicationNum", dataType = "String", required = true),
+ @ApiImplicitParam(value = "gps协议", name = "vehicleGpsProtocol", dataType = "String", required = true),
+ @ApiImplicitParam(value = "纬度", name = "latitude", dataType = "double", required = true),
+ @ApiImplicitParam(value = "经度", name = "longitude", dataType = "double", required = true),
+ })
+ public ResultUtil vehicleSpeed(@RequestBody VehicleSpeed vehicleSpeed){
+ log.info("推送车辆状态:{}", JSON.toJSONString(vehicleSpeed));
+ patrolTaskService.vehicleSpeed(vehicleSpeed.getVehicleNum(), vehicleSpeed.getVehicleStatus(), vehicleSpeed.getVehicleType(),
+ vehicleSpeed.getCommunicationNum(), vehicleSpeed.getVehicleGpsProtocol(), vehicleSpeed.getLatitude(), vehicleSpeed.getLongitude());
+ return ResultUtil.success();
}
}
--
Gitblit v1.7.1