feat: 1:一键成片参数动态配置

2:订单收藏
This commit is contained in:
2026-03-10 22:12:29 +08:00
parent 5581ec5a8f
commit d6d6262a0d
17 changed files with 1594 additions and 115 deletions
+6 -1
View File
@@ -80,7 +80,12 @@
"Bash(pip install:*)",
"Bash(python3:*)",
"Bash(npx:*)",
"Bash(xargs head:*)"
"Bash(xargs head:*)",
"Bash(for file in *.png)",
"Bash(do echo \"=== $file ===\")",
"Read(//f/project/go-fly-platform-services/**)",
"Bash(find \"F:/project/go-fly-platform-services/zlt-web/react-web-next/src/pages/orders/VideoTemplate\" -type f \\\\\\( -name \"*.tsx\" -o -name \"*.ts\" -o -name \"*.jsx\" -o -name \"*.js\" -o -name \"*.json\" \\\\\\) 2>/dev/null | head -50)",
"Bash(find \"F:/project/go-fly-platform-services/zlt-web/react-web-next/src/services\" -type f \\\\\\( -name \"*.ts\" -o -name \"*.tsx\" \\\\\\) 2>/dev/null | grep -i order)"
],
"deny": [],
"ask": []
@@ -0,0 +1,67 @@
package com.central.order.controller;
import com.central.common.context.LoginUserContextHolder;
import com.central.common.model.LoginAppUser;
import com.central.common.model.PageResult;
import com.central.common.model.Result;
import com.central.order.model.OrderFavorite;
import com.central.order.service.IOrderFavoriteService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.Parameters;
import io.swagger.v3.oas.annotations.enums.ParameterIn;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.Map;
/**
* 订单收藏
*
* @author dzc
* @date 2026-03-10
*/
@Slf4j
@RestController
@Tag(name = "订单收藏管理")
@RequestMapping("/order/favorite")
public class OrderFavoriteController {
@Autowired
private IOrderFavoriteService orderFavoriteService;
@Operation(summary = "我的收藏列表")
@Parameters({
@Parameter(name = "page", description = "分页起始位置", required = true, in = ParameterIn.QUERY),
@Parameter(name = "limit", description = "每页条数", required = true, in = ParameterIn.QUERY)
})
@GetMapping
public PageResult<OrderFavorite> list(@RequestParam Map<String, Object> params) {
return orderFavoriteService.findList(params);
}
@Operation(summary = "收藏/取消收藏订单")
@PostMapping("/{orderNo}")
public Result toggle(@PathVariable String orderNo) {
return orderFavoriteService.toggleFavorite(orderNo);
}
@Operation(summary = "查询订单是否已收藏")
@GetMapping("/{orderNo}/status")
public Result<Boolean> isFavorited(@PathVariable String orderNo) {
LoginAppUser user = LoginUserContextHolder.getUser();
if (user == null) {
return Result.failed("请先登录");
}
boolean favorited = orderFavoriteService.isFavorited(user.getId(), orderNo);
return Result.succeed(favorited, "查询成功");
}
@Operation(summary = "取消收藏")
@DeleteMapping("/{orderNo}")
public Result remove(@PathVariable String orderNo) {
return orderFavoriteService.toggleFavorite(orderNo);
}
}
@@ -0,0 +1,22 @@
package com.central.order.mapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.central.db.mapper.SuperMapper;
import com.central.order.model.OrderFavorite;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
import java.util.Map;
/**
* 订单收藏
*
* @author dzc
* @date 2026-03-10
*/
@Mapper
public interface OrderFavoriteMapper extends SuperMapper<OrderFavorite> {
List<OrderFavorite> findList(Page<OrderFavorite> page, @Param("p") Map<String, Object> params);
}
@@ -0,0 +1,30 @@
package com.central.order.model;
import lombok.Data;
import java.util.List;
/**
* 视频剪辑模板 clips 参数配置
* 存储在 VideoTemplate.config JSON 字段中
*
* JSON格式示例:
* [
* {"slot": "1", "fileIndex": 4},
* {"slot": "2", "fileIndex": 5}
* ]
*/
@Data
public class ClipsConfig {
/** 槽位映射列表 */
private List<ClipMapping> mappings;
@Data
public static class ClipMapping {
/** 阿里云模板槽位号, 如 "1", "201" */
private String slot;
/** 对应 videoFiles 列表的序号(从0开始) */
private Integer fileIndex;
}
}
@@ -65,5 +65,9 @@ public class Order extends SuperEntity {
@Schema(description = "排队位置(第几位)")
private transient Integer queuePosition;
@TableField(exist = false)
@Schema(description = "是否已收藏(0:未收藏,1:已收藏)")
private Integer favorited;
}
@@ -0,0 +1,64 @@
package com.central.order.model;
import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.central.common.model.SuperEntity;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.Setter;
import java.util.Date;
/**
* 订单收藏
*
* @author dzc
* @date 2026-03-10
*/
@Getter
@Setter
@EqualsAndHashCode(callSuper = false)
@TableName("order_favorite")
public class OrderFavorite extends SuperEntity {
private static final long serialVersionUID = 1L;
private Long userId;
private Long orderId;
private String orderNo;
@TableField(fill = FieldFill.INSERT)
private Date createTime;
private String tenantId;
private String company;
// ===== 订单详情(非数据库字段) =====
@TableField(exist = false)
private String deviceSn;
@TableField(exist = false)
private Long tourismId;
@TableField(exist = false)
private String tourismName;
@TableField(exist = false)
private String orderAmount;
@TableField(exist = false)
private Integer orderStatus;
@TableField(exist = false)
private Integer payType;
@TableField(exist = false)
private Date payTime;
@TableField(exist = false)
private Date orderCreateTime;
}
@@ -0,0 +1,32 @@
package com.central.order.service;
import com.central.common.model.PageResult;
import com.central.common.model.Result;
import com.central.common.service.ISuperService;
import com.central.order.model.OrderFavorite;
import java.util.Map;
/**
* 订单收藏
*
* @author dzc
* @date 2026-03-10
*/
public interface IOrderFavoriteService extends ISuperService<OrderFavorite> {
/**
* 收藏列表(当前用户)
*/
PageResult<OrderFavorite> findList(Map<String, Object> params);
/**
* 收藏/取消收藏
*/
Result toggleFavorite(String orderNo);
/**
* 判断是否已收藏
*/
boolean isFavorited(Long userId, String orderNo);
}
@@ -37,4 +37,9 @@ public interface IVideoTemplateService extends ISuperService<VideoTemplate> {
* 获取可用模板
*/
VideoTemplate getActiveTemplate();
/**
* 根据阿里云模板ID查询模板
*/
VideoTemplate getByTemplateId(String templateId);
}
@@ -7,15 +7,11 @@ import com.aliyun.sdk.service.ice20201109.models.GetMediaProducingJobResponse;
import com.aliyun.sdk.service.ice20201109.models.SubmitMediaProducingJobRequest;
import com.aliyun.sdk.service.ice20201109.models.SubmitMediaProducingJobResponse;
import com.central.common.exception.BusinessException;
import com.central.common.utils.StringUtils;
import com.central.order.config.AliyunImsConfig;
import com.central.order.feign.FileCenterService;
import com.central.order.model.Order;
import com.central.order.model.OrderFile;
import com.central.order.model.QrCode;
import com.central.order.service.IMediaService;
import com.central.order.service.IOrderFileService;
import com.central.order.service.IOrderService;
import com.central.order.service.IQrCodeService;
import com.central.order.model.*;
import com.central.order.service.*;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.RequiredArgsConstructor;
@@ -51,6 +47,8 @@ public class MediaServiceImpl implements IMediaService {
private IOrderFileService orderFileService;
@Autowired
private FileCenterService fileCenterService;
@Autowired
private IVideoTemplateService videoTemplateService;
@Override
public String submitEditTask(String orderNo, List<OrderFile> orderFiles) {
@@ -180,39 +178,85 @@ public class MediaServiceImpl implements IMediaService {
}
/**
* 构建剪辑参数
* 构建剪辑参数 — 配置优先,默认兜底
*/
private String buildClipsParam(TaskSubmitData taskData) {
try {
Map<String, String> clips = new HashMap<>();
List<OrderFile> videoFiles = taskData.getVideoFiles();
//@TODO 后期需要通过模板参数进行动态设置clips参数
// 保持既有模板顺序;当索引越界或无素材时返回空URL
clips.put("1", getUrlBySafeIndex(videoFiles, 4));
clips.put("2", getUrlBySafeIndex(videoFiles, 5));
clips.put("3", getUrlBySafeIndex(videoFiles, 6));
clips.put("4", getUrlBySafeIndex(videoFiles, 0));
clips.put("5", getUrlBySafeIndex(videoFiles, 1));
clips.put("6", getUrlBySafeIndex(videoFiles, 2));
clips.put("7", getUrlBySafeIndex(videoFiles, 3));
if (videoFiles != null && videoFiles.size() > 7) {
clips.put("8", getUrlBySafeIndex(videoFiles, 7));
ClipsConfig config = loadClipsConfig(taskData.getQrCode().getTemplateId());
if (config != null && config.getMappings() != null && !config.getMappings().isEmpty()) {
log.info("使用模板配置构建clips参数, templateId={}", taskData.getQrCode().getTemplateId());
return buildClipsParamFromConfig(taskData.getVideoFiles(), config);
}
if(videoFiles !=null && videoFiles.size() > 12){
clips.put("201", getUrlBySafeIndex(videoFiles, 12));
clips.put("202", getUrlBySafeIndex(videoFiles, 13));
clips.put("203", getUrlBySafeIndex(videoFiles, 14));
clips.put("204", getUrlBySafeIndex(videoFiles, 15));
clips.put("205", getUrlBySafeIndex(videoFiles, 16));
}
return JSON.toJSONString(clips);
log.info("模板无clips配置, 使用默认逻辑, templateId={}", taskData.getQrCode().getTemplateId());
return buildDefaultClipsParam(taskData.getVideoFiles());
} catch (Exception e) {
throw new BusinessException("构建剪辑参数失败: " + e.getMessage());
}
}
/**
* 从VideoTemplate.config解析ClipsConfig
*/
private ClipsConfig loadClipsConfig(String templateId) {
VideoTemplate template = videoTemplateService.getByTemplateId(templateId);
if (template == null || StringUtils.isEmpty(template.getConfig())
|| "{}".equals(template.getConfig().trim())) {
return null;
}
try {
// config 存储的是映射数组,包装为 ClipsConfig 对象
List<ClipsConfig.ClipMapping> mappings = JSON.parseArray(template.getConfig(), ClipsConfig.ClipMapping.class);
if (mappings == null || mappings.isEmpty()) {
return null;
}
ClipsConfig config = new ClipsConfig();
config.setMappings(mappings);
return config;
} catch (Exception e) {
log.warn("解析模板clips配置失败, templateId={}, 将使用默认逻辑", templateId, e);
return null;
}
}
/**
* 基于模板配置构建clips参数
*/
private String buildClipsParamFromConfig(List<OrderFile> videoFiles, ClipsConfig config) {
Map<String, String> clips = new HashMap<>();
for (ClipsConfig.ClipMapping m : config.getMappings()) {
clips.put(m.getSlot(), getUrlBySafeIndex(videoFiles, m.getFileIndex()));
}
return JSON.toJSONString(clips);
}
/**
* 默认剪辑参数构建(原有硬编码逻辑,作为兜底)
*/
private String buildDefaultClipsParam(List<OrderFile> videoFiles) {
Map<String, String> clips = new HashMap<>();
// 保持既有模板顺序;当索引越界或无素材时返回空URL
clips.put("1", getUrlBySafeIndex(videoFiles, 4));
clips.put("2", getUrlBySafeIndex(videoFiles, 5));
clips.put("3", getUrlBySafeIndex(videoFiles, 6));
clips.put("4", getUrlBySafeIndex(videoFiles, 0));
clips.put("5", getUrlBySafeIndex(videoFiles, 1));
clips.put("6", getUrlBySafeIndex(videoFiles, 2));
clips.put("7", getUrlBySafeIndex(videoFiles, 3));
if (videoFiles != null && videoFiles.size() > 7) {
clips.put("8", getUrlBySafeIndex(videoFiles, 7));
}
if (videoFiles != null && videoFiles.size() > 12) {
clips.put("201", getUrlBySafeIndex(videoFiles, 12));
clips.put("202", getUrlBySafeIndex(videoFiles, 13));
clips.put("203", getUrlBySafeIndex(videoFiles, 14));
clips.put("204", getUrlBySafeIndex(videoFiles, 15));
clips.put("205", getUrlBySafeIndex(videoFiles, 16));
}
return JSON.toJSONString(clips);
}
private String getUrlBySafeIndex(List<OrderFile> videoFiles, int index) {
int size = (videoFiles == null) ? 0 : videoFiles.size();
if (size == 0 || index < 0 || index >= size) {
@@ -0,0 +1,92 @@
package com.central.order.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.central.common.context.LoginUserContextHolder;
import com.central.common.model.LoginAppUser;
import com.central.common.model.PageResult;
import com.central.common.model.Result;
import com.central.common.service.impl.SuperServiceImpl;
import com.central.order.mapper.OrderFavoriteMapper;
import com.central.order.model.Order;
import com.central.order.model.OrderFavorite;
import com.central.order.service.IOrderFavoriteService;
import com.central.order.service.IOrderService;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.MapUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.Map;
/**
* 订单收藏
*
* @author dzc
* @date 2026-03-10
*/
@Slf4j
@Service
public class OrderFavoriteServiceImpl extends SuperServiceImpl<OrderFavoriteMapper, OrderFavorite> implements IOrderFavoriteService {
@Autowired
private IOrderService orderService;
@Override
public PageResult<OrderFavorite> findList(Map<String, Object> params) {
LoginAppUser user = LoginUserContextHolder.getUser();
Page<OrderFavorite> page = new Page<>(MapUtils.getInteger(params, "page"), MapUtils.getInteger(params, "limit"));
params.put("userId", user.getId());
List<OrderFavorite> list = baseMapper.findList(page, params);
return PageResult.<OrderFavorite>builder().data(list).resp_code(0).count(page.getTotal()).build();
}
@Override
public Result toggleFavorite(String orderNo) {
LoginAppUser user = LoginUserContextHolder.getUser();
if (user == null) {
return Result.failed("请先登录");
}
// 检查订单是否存在
Order order = orderService.getOne(
new LambdaQueryWrapper<Order>().eq(Order::getOrderNo, orderNo)
);
if (order == null) {
return Result.failed("订单不存在");
}
// 查询是否已收藏
OrderFavorite existing = getOne(
new LambdaQueryWrapper<OrderFavorite>()
.eq(OrderFavorite::getUserId, user.getId())
.eq(OrderFavorite::getOrderNo, orderNo)
);
if (existing != null) {
// 已收藏 -> 取消收藏
removeById(existing.getId());
return Result.succeed("取消收藏成功");
} else {
// 未收藏 -> 添加收藏
OrderFavorite favorite = new OrderFavorite();
favorite.setUserId(user.getId());
favorite.setOrderId(order.getId());
favorite.setOrderNo(orderNo);
favorite.setTenantId(order.getTenantId());
favorite.setCompany(order.getCompany());
save(favorite);
return Result.succeed("收藏成功");
}
}
@Override
public boolean isFavorited(Long userId, String orderNo) {
return count(
new LambdaQueryWrapper<OrderFavorite>()
.eq(OrderFavorite::getUserId, userId)
.eq(OrderFavorite::getOrderNo, orderNo)
) > 0;
}
}
@@ -32,6 +32,7 @@ import java.util.*;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;
/**
* Order information
@@ -76,6 +77,9 @@ public class OrderServiceImpl extends SuperServiceImpl<OrderMapper, Order> imple
@Autowired
private QrCodeMapper qrCodeMapper;
@Autowired
private OrderFavoriteMapper orderFavoriteMapper;
@Autowired
@Lazy
private WechatConfigService wechatConfigService;
@@ -137,7 +141,22 @@ public class OrderServiceImpl extends SuperServiceImpl<OrderMapper, Order> imple
deviceRankingMap.put(deviceSn, rankMap);
}
// 批量查询当前登录用户的收藏订单
Set<Long> favoritedOrderIds = Collections.emptySet();
com.central.common.model.LoginAppUser currentUser = com.central.common.context.LoginUserContextHolder.getUser();
if (currentUser != null) {
List<Long> orderIds = list.stream().map(Order::getId).collect(Collectors.toList());
if (!orderIds.isEmpty()) {
favoritedOrderIds = orderFavoriteMapper.selectList(
new LambdaQueryWrapper<OrderFavorite>()
.eq(OrderFavorite::getUserId, currentUser.getId())
.in(OrderFavorite::getOrderId, orderIds)
).stream().map(OrderFavorite::getOrderId).collect(Collectors.toSet());
}
}
for (Order order : list){
order.setFavorited(favoritedOrderIds.contains(order.getId()) ? 1 : 0);
SysUser user = userCenterService.findUserById(order.getUserId());
if(Objects.nonNull(user)){
order.setMobile(user.getMobile());
@@ -331,9 +350,20 @@ public class OrderServiceImpl extends SuperServiceImpl<OrderMapper, Order> imple
Page<Order> page = new Page<>(MapUtils.getInteger(params, "page"), MapUtils.getInteger(params, "limit"));
List<Order> list = baseMapper.findListByUser(page, params);
if (list != null && !list.isEmpty()) {
// 批量查询当前用户的收藏订单ID
Object userIdObj = params.get("userId");
Long userId = (userIdObj instanceof Long) ? (Long) userIdObj : Long.valueOf(userIdObj.toString());
List<Long> orderIds = list.stream().map(Order::getId).collect(Collectors.toList());
Set<Long> favoritedOrderIds = orderFavoriteMapper.selectList(
new LambdaQueryWrapper<OrderFavorite>()
.eq(OrderFavorite::getUserId, userId)
.in(OrderFavorite::getOrderId, orderIds)
).stream().map(OrderFavorite::getOrderId).collect(Collectors.toSet());
for (Order order : list) {
order.setTourismName(tourismMapper.getTourismById(order.getTourismId()).getTourismName());
order.setCreatedTime(sdf.format(order.getCreateTime()));
order.setFavorited(favoritedOrderIds.contains(order.getId()) ? 1 : 0);
// 设置景区订单展示图(type=6)的imageUrl
List<TourismFile> tourismFiles = tourismFileMapper.selectList(
new LambdaQueryWrapper<TourismFile>()
@@ -88,4 +88,15 @@ public class VideoTemplateServiceImpl extends SuperServiceImpl<VideoTemplateMapp
.orderByDesc(VideoTemplate::getCreateTime)
.last("LIMIT 1"));
}
@Override
public VideoTemplate getByTemplateId(String templateId) {
if (StringUtils.isEmpty(templateId)) {
return null;
}
return getOne(new LambdaQueryWrapper<VideoTemplate>()
.eq(VideoTemplate::getTemplateId, templateId)
.eq(VideoTemplate::getIsDel, 0)
.last("LIMIT 1"));
}
}
@@ -0,0 +1,25 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.central.order.mapper.OrderFavoriteMapper">
<select id="findList" resultType="com.central.order.model.OrderFavorite">
select t.id, t.user_id, t.order_id, t.order_no, t.create_time, t.tenant_id, t.company,
o.device_sn, o.tourism_id, o.order_amount, o.order_status, o.pay_type, o.pay_time,
o.create_time as order_create_time,
tr.tourism_name as tourism_name
from order_favorite t
left join orders o on t.order_id = o.id
left join tourisms tr on o.tourism_id = tr.id
<where>
<if test="p.userId != null">
and t.user_id = #{p.userId}
</if>
<if test="p.orderNo != null and p.orderNo != ''">
and t.order_no like concat('%', #{p.orderNo}, '%')
</if>
</where>
order by t.create_time desc
</select>
</mapper>
@@ -57,7 +57,8 @@
<!-- 动态获取参数采用备参 -->
<select id="findListByUser" resultType="com.central.order.model.Order">
select id,order_no,tourism_id,device_sn,workspace_id,code_id,user_id,order_amount,order_status,create_time,update_time from orders t WHERE t.user_id = #{param2.userId}
select id,order_no,tourism_id,device_sn,workspace_id,code_id,user_id,order_amount,order_status,create_time,update_time
from orders t WHERE t.user_id = #{param2.userId}
and t.is_del = 0
<if test="param2.orderStatusList != null and param2.orderStatusList.size() > 0">
and t.order_status in
@@ -0,0 +1,15 @@
-- 订单收藏表
CREATE TABLE IF NOT EXISTS `order_favorite` (
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键ID',
`user_id` bigint(20) NOT NULL COMMENT '用户ID',
`order_id` bigint(20) NOT NULL COMMENT '订单ID',
`order_no` varchar(64) DEFAULT NULL COMMENT '订单编号',
`create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '收藏时间',
`update_time` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
`tenant_id` varchar(64) DEFAULT NULL COMMENT '租户ID',
`company` varchar(64) DEFAULT NULL COMMENT '公司',
PRIMARY KEY (`id`),
UNIQUE KEY `uk_user_order` (`user_id`, `order_id`),
KEY `idx_user_id` (`user_id`),
KEY `idx_order_id` (`order_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='订单收藏表';
@@ -6,7 +6,8 @@ import {
ProFormTextArea,
ProFormSelect,
} from '@ant-design/pro-components';
import { message } from 'antd';
import { message, Button, InputNumber, Input, Space, Table, Tooltip } from 'antd';
import { PlusOutlined, DeleteOutlined, QuestionCircleOutlined } from '@ant-design/icons';
import { ordersApi } from '@/services/orders';
export const STATUS_OPTIONS = [
@@ -14,11 +15,16 @@ export const STATUS_OPTIONS = [
{ label: '禁用', value: 0 },
];
export type ClipMappingItem = {
slot: string;
fileIndex: number | undefined;
};
export type VideoTemplateFormValues = {
id?: number;
templateId?: string;
templateName?: string;
name?: string; // 兼容旧字段
name?: string;
description?: string;
config?: string;
status?: number;
@@ -32,6 +38,31 @@ interface VideoTemplateFormProps {
initialValues?: Partial<VideoTemplateFormValues>;
}
const parseConfigToMappings = (config?: string): ClipMappingItem[] => {
if (!config || config.trim() === '{}' || config.trim() === '[]') return [];
try {
const parsed = JSON.parse(config);
if (Array.isArray(parsed)) {
return parsed.map((item: any) => ({
slot: String(item.slot ?? ''),
fileIndex: item.fileIndex,
}));
}
return [];
} catch {
return [];
}
};
const mappingsToConfig = (mappings: ClipMappingItem[]): string => {
if (!mappings || mappings.length === 0) return '{}';
const cleaned = mappings
.filter((m) => m.slot && m.fileIndex !== undefined)
.map((m) => ({ slot: m.slot, fileIndex: m.fileIndex }));
if (cleaned.length === 0) return '{}';
return JSON.stringify(cleaned, null, 2);
};
const VideoTemplateForm: React.FC<VideoTemplateFormProps> = ({
title,
visible,
@@ -40,37 +71,107 @@ const VideoTemplateForm: React.FC<VideoTemplateFormProps> = ({
initialValues,
}) => {
const formRef = useRef<any>();
const [mappings, setMappings] = React.useState<ClipMappingItem[]>([]);
useEffect(() => {
if (visible && initialValues) {
// 延迟设置,确保表单已经渲染
setTimeout(() => {
// 处理字段兼容性
const values = {
...initialValues,
templateName: initialValues.templateName || initialValues.name,
config: initialValues.config || '{}', // 确保config有默认值
};
formRef.current?.setFieldsValue(values);
}, 0);
if (visible) {
setMappings(parseConfigToMappings(initialValues?.config));
if (initialValues) {
setTimeout(() => {
formRef.current?.setFieldsValue({
...initialValues,
templateName: initialValues.templateName || initialValues.name,
});
}, 0);
}
} else {
setMappings([]);
}
}, [visible, initialValues]);
const handleAddMapping = () => {
setMappings([...mappings, { slot: '', fileIndex: undefined }]);
};
const handleRemoveMapping = (index: number) => {
setMappings(mappings.filter((_, i) => i !== index));
};
const handleMappingChange = (index: number, field: keyof ClipMappingItem, value: any) => {
const next = [...mappings];
next[index] = { ...next[index], [field]: value };
setMappings(next);
};
const handleFinish = async (values: VideoTemplateFormValues) => {
try {
// 确保兼容性
const submitValues = {
const valid = mappings.filter((m) => m.slot && m.fileIndex !== undefined);
const slots = valid.map((m) => m.slot);
if (new Set(slots).size !== slots.length) {
message.error('存在重复的槽位号,请检查');
return false;
}
return await onFinish({
...values,
name: values.templateName, // 同时设置name字段
};
const result = await onFinish(submitValues);
return result;
} catch (error) {
name: values.templateName,
config: mappingsToConfig(mappings),
});
} catch {
message.error('操作失败');
return false;
}
};
const columns = [
{
title: (
<Space>
槽位号
<Tooltip title="阿里云剪辑模板中的素材槽位编号,如 1、2、201">
<QuestionCircleOutlined style={{ color: '#999' }} />
</Tooltip>
</Space>
),
dataIndex: 'slot',
width: 140,
render: (_: any, record: ClipMappingItem, index: number) => (
<Input
value={record.slot}
placeholder="如: 1"
onChange={(e) => handleMappingChange(index, 'slot', e.target.value)}
/>
),
},
{
title: (
<Space>
素材序号
<Tooltip title="对应订单素材文件列表中的位置序号(从0开始)">
<QuestionCircleOutlined style={{ color: '#999' }} />
</Tooltip>
</Space>
),
dataIndex: 'fileIndex',
width: 140,
render: (_: any, record: ClipMappingItem, index: number) => (
<InputNumber
value={record.fileIndex}
min={0}
placeholder="如: 0"
style={{ width: '100%' }}
onChange={(val) => handleMappingChange(index, 'fileIndex', val)}
/>
),
},
{
title: '操作',
width: 60,
render: (_: any, __: any, index: number) => (
<Button type="link" danger icon={<DeleteOutlined />} onClick={() => handleRemoveMapping(index)} />
),
},
];
return (
<ModalForm<VideoTemplateFormValues>
title={title}
@@ -79,15 +180,8 @@ const VideoTemplateForm: React.FC<VideoTemplateFormProps> = ({
formRef={formRef}
onVisibleChange={onVisibleChange}
onFinish={handleFinish}
initialValues={{
status: 1, // 默认启用
config: '{}', // 默认空JSON对象
...initialValues,
}}
modalProps={{
destroyOnClose: true,
maskClosable: false,
}}
initialValues={{ status: 1, ...initialValues }}
modalProps={{ destroyOnClose: true, maskClosable: false }}
>
<ProForm.Group title="基本信息">
<ProFormText
@@ -97,10 +191,7 @@ const VideoTemplateForm: React.FC<VideoTemplateFormProps> = ({
placeholder="请输入模板ID"
rules={[
{ required: true, message: '请输入模板ID' },
{
pattern: /^[a-zA-Z0-9_-]+$/,
message: '模板ID只能包含字母、数字、下划线和横线'
}
{ pattern: /^[a-zA-Z0-9_-]+$/, message: '模板ID只能包含字母、数字、下划线和横线' },
]}
/>
<ProFormText
@@ -110,7 +201,7 @@ const VideoTemplateForm: React.FC<VideoTemplateFormProps> = ({
placeholder="请输入模板名称"
rules={[
{ required: true, message: '请输入模板名称' },
{ max: 50, message: '模板名称不能超过50个字符' }
{ max: 50, message: '模板名称不能超过50个字符' },
]}
/>
<ProFormSelect
@@ -122,61 +213,53 @@ const VideoTemplateForm: React.FC<VideoTemplateFormProps> = ({
/>
</ProForm.Group>
<ProForm.Group title="详细配置">
<ProForm.Group title="模板描述">
<ProFormTextArea
name="description"
label="模板描述"
label="描述"
width="xl"
placeholder="请输入模板描述"
fieldProps={{
rows: 4,
maxLength: 200,
showCount: true,
}}
/>
<ProFormTextArea
name="config"
label="模板配置"
width="xl"
placeholder='请输入JSON格式的模板配置,例如: {"key": "value"}'
tooltip="请输入有效的JSON格式配置,默认为空对象 {}"
fieldProps={{
rows: 8,
maxLength: 2000,
showCount: true,
style: { fontFamily: 'monospace' },
onBlur: (e) => {
// 格式化JSON
const value = e.target.value;
if (value) {
try {
const json = JSON.parse(value);
const formatted = JSON.stringify(json, null, 2);
formRef.current?.setFieldValue('config', formatted);
} catch (error) {
// 格式化失败,保持原样
}
}
},
}}
rules={[
{ required: true, message: '请输入模板配置' },
{
validator: async (_, value) => {
if (value) {
try {
JSON.parse(value);
} catch (error) {
throw new Error('请输入有效的JSON格式');
}
}
},
},
]}
fieldProps={{ rows: 3, maxLength: 200, showCount: true }}
/>
</ProForm.Group>
<div style={{ marginBottom: 24 }}>
<div style={{ display: 'flex', justifyContent: 'space-between', alignItems: 'center', marginBottom: 12 }}>
<Space>
<span style={{ fontWeight: 500, fontSize: 16 }}>素材槽位映射配置</span>
<Tooltip title="配置阿里云剪辑模板槽位与订单素材文件的对应关系。不配置则使用系统默认映射逻辑">
<QuestionCircleOutlined style={{ color: '#999' }} />
</Tooltip>
</Space>
<Button type="dashed" icon={<PlusOutlined />} onClick={handleAddMapping}>
添加映射
</Button>
</div>
{mappings.length > 0 ? (
<Table
columns={columns}
dataSource={mappings}
rowKey={(_, index) => String(index)}
pagination={false}
size="small"
bordered
/>
) : (
<div
style={{
border: '1px dashed #d9d9d9',
borderRadius: 6,
padding: '24px 0',
textAlign: 'center',
color: '#999',
}}
>
暂无映射配置,将使用系统默认映射逻辑。点击"添加映射"开始配置
</div>
)}
</div>
</ModalForm>
);
};
export default VideoTemplateForm;
export default VideoTemplateForm;
+949
View File
@@ -0,0 +1,949 @@
# 道路桥梁智能巡检平台
## 介绍文档
---
## 一、执行摘要
道路桥梁智能巡检平台是一套基于无人机技术、人工智能和云计算的企业级智能巡检解决方案。平台通过自动化飞行、端侧实时识别和云端AI分析,实现道路、桥梁基础设施的全天候、高精度、智能化巡检,从问题发现到处置形成完整闭环管理。
**核心价值:**
- 巡检效率提升 **300%**,人力成本降低 **70%**
- 问题发现率提升 **95%**,响应时间缩短至 **15分钟内**
- 支持 **7×24小时** 全天候自动巡检
- 年度巡检成本节省 **60%以上**
---
## 二、平台概述
### 2.1 平台定位
道路桥梁智能巡检平台是面向交通管理部门、高速公路运营商、市政管理单位的专业级基础设施巡检系统,采用"无人机+AI+云平台"三位一体架构,实现道路桥梁全生命周期智能化管理。
**平台界面展示:**
![管控平台](photo/管控平台.png)
*图:综合管控平台 - 统一管理界面,集成设备监控、任务调度、数据分析*
![后台管理系统-设备管理](photo/后台管理系统-设备管理.png)
*图:后台管理系统 - 设备管理模块,支持设备注册、状态监控、维护记录*
### 2.2 应用场景
**日常巡检场景:**
- 高速公路日常巡查(路面、护栏、标识)
- 国省道定期巡检
- 城市道路安全监测
- 桥梁日常状态监控
- 边坡地质灾害预警
**专项检测场景:**
- 桥梁结构详细检测(桥面、桥墩、桥下)
- 裂缝、锈蚀、位移病害识别
- 隧道内壁检测
- 边坡稳定性评估
**应急响应场景:**
- 交通事故现场勘查
- 自然灾害快速评估
- 应急指挥调度(喊话器、照明设备)
- 夜间紧急巡查
---
## 三、核心功能模块
### 3.1 智能航线规划系统
**功能特点:**
- **自动航线生成**:根据道路、桥梁GIS数据自动生成最优巡检航线
- **多模式飞行**:支持直线巡航、环绕拍摄、定点悬停、仿地飞行
- **动态避障**:实时感知障碍物,自动调整飞行路径
- **精准定位**:厘米级RTK定位,确保巡检覆盖无遗漏
**航线类型:**
1. **道路巡检航线**:沿道路中心线自动规划,覆盖路面、护栏、边坡
2. **桥梁环绕航线**:360度环绕桥梁,多角度拍摄桥墩、桥面、支座
3. **桥下检测航线**:专用低空航线,适配桥下空间结构
4. **边坡扫描航线**:倾斜摄影航线,生成边坡三维模型
**航线规划界面示意图:**
```
┌─────────────────────────────────────────────────────────────────────┐
│ 智能航线规划系统 [保存] [执行] │
├─────────────────────────────────────────────────────────────────────┤
│ │
│ ┌─────────────────┐ ┌──────────────────────────────────────────┐ │
│ │ 航线类型选择 │ │ 地图显示区域 │ │
│ │ │ │ │ │
│ │ ○ 道路巡检 │ │ ╔═══════════════════════╗ │ │
│ │ ● 桥梁环绕 │ │ ║ 桥梁A ║ │ │
│ │ ○ 桥下检测 │ │ ║ ┌─────────┐ ║ │ │
│ │ ○ 边坡扫描 │ │ ║ │ ▲ 起点 │ ║ │ │
│ │ │ │ ║ │ ↓ │ ║ │ │
│ │ 飞行参数: │ │ ║ │ ← ● → │ ║ │ │
│ │ 高度: 50m │ │ ║ │ ↑ │ ║ │ │
│ │ 速度: 10m/s │ │ ║ │ ▼ 终点 │ ║ │ │
│ │ 重叠率: 70% │ │ ║ └─────────┘ ║ │ │
│ │ │ │ ╚═══════════════════════╝ │ │
│ │ [自动生成航线] │ │ │ │
│ │ [手动调整] │ │ 航点数: 24 总距离: 2.3km │ │
│ └─────────────────┘ │ 预计时间: 15分钟 电量消耗: 35% │ │
│ └──────────────────────────────────────────┘ │
│ │
│ ┌─────────────────────────────────────────────────────────────────┐│
│ │ 航点列表 ││
│ │ #1 起飞点 N31.2345° E121.4567° 高度:0m 动作:起飞 ││
│ │ #2 航点1 N31.2346° E121.4568° 高度:50m 动作:拍照 ││
│ │ #3 航点2 N31.2347° E121.4569° 高度:50m 动作:拍照+悬停 ││
│ │ ... ││
│ └─────────────────────────────────────────────────────────────────┘│
└─────────────────────────────────────────────────────────────────────┘
```
**平台界面截图:**
![航线规划界面](photo/航线规划.png)
*图:航线规划系统实际界面 - 支持地图可视化、航点编辑、参数配置*
![后台管理系统-航线管理](photo/后台管理系统-航线管理.png)
*图:后台管理系统 - 航线管理模块,支持航线库管理、模板配置*
### 3.2 端侧实时AI识别
**边缘计算能力:**
平台在无人机端部署轻量级AI识别模型,实现飞行过程中的实时问题检测,无需等待回传即可发现紧急隐患。
**识别能力清单:**
| 类别 | 识别项目 | 响应时间 | 准确率 |
|------|---------|---------|--------|
| 路面问题 | 路面塌陷、坑槽、裂缝 | <2秒 | 96% |
| 交通事故 | 车辆碰撞、翻车、拥堵 | <1秒 | 98% |
| 抛洒物 | 货物散落、障碍物 | <1秒 | 95% |
| 排水设施 | 排水沟堵塞、井盖缺失 | <2秒 | 93% |
| 护栏设施 | 护栏破损、缺失、变形 | <2秒 | 94% |
| 边坡灾害 | 滑坡、崩塌、裂缝 | <3秒 | 92% |
| 桥梁病害 | 裂缝、剥落、渗水 | <3秒 | 91% |
**实时告警机制:**
- 发现紧急隐患立即触发告警
- 自动标注GPS坐标和时间戳
- 推送至指挥中心和责任人手机
- 支持现场语音播报
**端侧AI识别实时界面:**
```
┌─────────────────────────────────────────────────────────────────────┐
│ 无人机端侧AI识别系统 - 实时监控 飞行中 ● │
├─────────────────────────────────────────────────────────────────────┤
│ │
│ ┌────────────────────────────┐ ┌──────────────────────────────┐ │
│ │ 实时视频流 │ │ 识别结果统计 │ │
│ │ │ │ │ │
│ │ ┌──────────────────┐ │ │ 今日巡检: 12.5km │ │
│ │ │ ╔══════════╗ │ │ │ 已识别: 8处 │ │
│ │ │ ║ 护栏破损 ║ ⚠️ │ │ │ │ │
│ │ │ ╚══════════╝ │ │ │ ┌────────────────────────┐ │ │
│ │ │ [置信度:94%] │ │ │ │ 类型 数量 等级 │ │ │
│ │ │ │ │ │ ├────────────────────────┤ │ │
│ │ │ GPS: N31.2345° │ │ │ │ 护栏破损 3 紧急 │ │ │
│ │ │ E121.4567° │ │ │ │ 路面裂缝 2 重要 │ │ │
│ │ └──────────────────┘ │ │ │ 排水堵塞 2 重要 │ │ │
│ │ │ │ │ 标识缺失 1 一般 │ │ │
│ └────────────────────────────┘ │ └────────────────────────┘ │ │
│ │ │ │
│ ┌────────────────────────────┐ │ 最新告警: │ │
│ │ 飞行状态 │ │ ⚠️ 15:23 护栏破损(紧急) │ │
│ │ 电量: ████████░░ 78% │ │ 📍 K125+340 已推送短信 │ │
│ │ 高度: 52m 速度: 12m/s │ │ │ │
│ │ 信号: ████████░░ 良好 │ │ ⚠️ 15:18 路面裂缝(重要) │ │
│ │ 已飞: 8.2km / 12.5km │ │ 📍 K124+890 │ │
│ └────────────────────────────┘ └──────────────────────────────┘ │
│ │
│ [暂停巡检] [返航] [查看详情] [导出报告] │
└─────────────────────────────────────────────────────────────────────┘
识别流程:
摄像头采集 → 边缘AI处理 → 实时识别 → 立即告警 → 云端存储
(30fps) (<2秒) (置信度>90%) (SMS推送) (永久归档)
```
**平台界面截图:**
![监控中心](photo/监控中心.png)
*图:实时监控中心 - 多设备状态监控、实时视频流、飞行数据展示*
![任务页面管理](photo/任务页面管理.png)
*图:任务管理界面 - 任务列表、状态跟踪、执行记录*
### 3.3 云端深度AI分析
**深度学习模型:**
巡检完成后,所有影像资料上传至云端,采用高精度深度学习模型进行二次分析,识别端侧可能遗漏的细微病害。
**桥梁专项检测能力:**
**裂缝检测:**
- 最小识别宽度:0.1mm
- 自动测量裂缝长度、宽度、走向
- 裂缝类型分类(横向、纵向、网状、龟裂)
- 危险等级评估(轻微、中度、严重、危急)
**锈蚀检测:**
- 钢结构锈蚀面积计算
- 锈蚀程度分级(表面锈、点蚀、坑蚀、层状剥落)
- 钢筋外露识别
- 预测剩余使用寿命
**位移监测:**
- 桥梁挠度变化分析
- 支座位移检测
- 伸缩缝异常识别
- 历史数据对比分析
**混凝土病害:**
- 剥落、空鼓、蜂窝麻面
- 钢筋锈胀、保护层脱落
- 渗水、泛碱、冻融破坏
**AI识别效果对比示意图:**
```
┌─────────────────────────────────────────────────────────────────────┐
│ 桥梁裂缝AI识别效果对比 │
├─────────────────────────────────────────────────────────────────────┤
│ │
│ 原始图像 端侧识别 云端深度分析 │
│ ┌──────────┐ ┌──────────┐ ┌──────────┐ │
│ │ │ │ ╱╲ │ │ ╱╲ │ │
│ │ ╱╲ │ → │ ║══║ ⚠️ │ → │ ║══║ │ │
│ │ ╱ ╲ │ │╱ ╲ │ │╱ ║ ╲ │ │
│ │ ╱ ╲ │ │ ╲ │ │ ║ ╲ │ │
│ │╱ ╲ │ │ ╲ │ │ ║ ╲ │ │
│ └──────────┘ └──────────┘ └──────────┘ │
│ │
│ 识别结果: 识别结果: 识别结果: │
│ 无 主裂缝1条 主裂缝1条 + 次生裂缝3条 │
│ 长度: 约2m 长度: 2.34m │
│ 宽度: >1mm 宽度: 1.2mm │
│ 置信度: 94% 类型: 纵向裂缝 │
│ 等级: 重要 走向: 垂直向下 │
│ 危险等级: 中度 │
│ 建议: 立即封闭处理 │
│ │
├─────────────────────────────────────────────────────────────────────┤
│ 识别能力对比表 │
│ ┌─────────────┬──────────┬──────────┬──────────────────┐ │
│ │ 对比项 │ 端侧AI │ 云端AI │ 说明 │ │
│ ├─────────────┼──────────┼──────────┼──────────────────┤ │
│ │ 响应时间 │ <2秒 │ 5-10分钟│ 端侧实时告警 │ │
│ │ 识别精度 │ 90-95% │ 95-98% │ 云端更精准 │ │
│ │ 最小裂缝 │ 0.5mm │ 0.1mm │ 云端识别更细微 │ │
│ │ 裂缝测量 │ 估算 │ 精确 │ 云端可精确测量 │ │
│ │ 病害分类 │ 基础 │ 详细 │ 云端分类更细致 │ │
│ │ 历史对比 │ 不支持 │ 支持 │ 云端可趋势分析 │ │
│ └─────────────┴──────────┴──────────┴──────────────────┘ │
│ │
│ 结论: 端侧+云端双重AI识别,实现"快速响应"与"精准分析"完美结合 │
└─────────────────────────────────────────────────────────────────────┘
```
### 3.4 缺陷管理与闭环处置
**完整工作流程图:**
```
┌─────────────────────────────────────────────────────────────────────────────┐
│ 缺陷管理闭环流程 │
└─────────────────────────────────────────────────────────────────────────────┘
┌──────────────┐
│ 1.问题发现 │ 端侧AI识别 + 云端深度分析
│ ⚠️ 护栏破损 │ 自动生成缺陷报告(位置/类型/照片)
└──────┬───────┘
│
↓
┌──────────────┐
│ 2.自动分类 │ AI智能分类: 路面/桥梁/护栏/边坡...
│ 📋 护栏设施 │ 关联历史数据和维护记录
└──────┬───────┘
│
↓
┌──────────────┐
│ 3.等级评估 │ 危险等级: 特急/紧急/重要/一般
│ ⚠️ 紧急 │ 处置时限: 15分钟内响应
└──────┬───────┘
│
↓
┌──────────────┐
│ 4.任务派发 │ 自动分配: K125路段养护队
│ 📱 短信推送 │ 通知方式: 短信+APP+电话
└──────┬───────┘ 责任人: 张工(13800138000)
│
↓
┌──────────────┐
│ 5.现场处置 │ 责任人接单并前往现场
│ 🔧 维修中 │ 上传处置照片和说明
└──────┬───────┘ 记录材料和工时
│
↓
┌──────────────┐
│ 6.验收复查 │ 自动生成复查任务
│ ✓ 复查通过 │ 无人机再次飞行验证
└──────┬───────┘ AI对比处置前后效果
│
↓
┌──────────────┐
│ 7.归档统计 │ 数据永久存档
│ 📊 已完成 │ 生成统计报表
└──────────────┘ 支持决策分析
┌─────────────────────────────────────────────────────────────────────────────┐
│ 时间轴示例 │
├─────────────────────────────────────────────────────────────────────────────┤
│ 15:23 发现问题 → 15:23 自动分类 → 15:24 等级评估 → 15:25 任务派发 │
│ (实时) (1秒) (30秒) (1分钟) │
│ │
│ 15:40 责任人接单 → 16:20 到达现场 → 17:30 处置完成 → 次日 复查验收 │
│ (15分钟) (40分钟) (70分钟) (24小时) │
│ │
│ 总耗时: 从发现到处置完成约2小时,次日验收通过后归档 │
└─────────────────────────────────────────────────────────────────────────────┘
```
**1. 问题发现阶段**
- 端侧实时识别 + 云端深度分析
- 自动生成缺陷报告
- 包含:位置、类型、等级、照片、视频
**2. 智能分类与评估**
- 按病害类型自动分类
- AI评估危险等级(一般/较大/重大/特别重大)
- 计算紧急程度和处置时限
**3. 任务自动派发**
- 根据缺陷类型和位置自动分配责任单位
- 短信/APP推送通知相关人员
- 设置处置时限和提醒机制
**4. 现场处置跟踪**
- 责任人接收任务并确认
- 上传现场处置照片和说明
- 记录处置时间和材料成本
**5. 验收复查**
- 处置完成后自动生成复查任务
- 无人机再次飞行验证
- AI对比处置前后效果
**6. 数据归档与统计**
- 所有数据永久存档
- 生成月度/季度/年度统计报表
- 为养护决策提供数据支撑
**闭环管理流程详细说明:**
```
┌─────────────────────────────────────────────────────────────────────────────┐
│ 缺陷管理闭环流程 │
└─────────────────────────────────────────────────────────────────────────────┘
┌──────────────┐
│ 1.问题发现 │ 端侧AI识别 + 云端深度分析
│ ⚠️ 护栏破损 │ 自动生成缺陷报告(位置/类型/照片)
└──────┬───────┘
│
↓
┌──────────────┐
│ 2.自动分类 │ AI智能分类: 路面/桥梁/护栏/边坡...
│ 📋 护栏设施 │ 关联历史数据和维护记录
└──────┬───────┘
│
↓
┌──────────────┐
│ 3.等级评估 │ 危险等级: 特急/紧急/重要/一般
│ ⚠️ 紧急 │ 处置时限: 15分钟内响应
└──────┬───────┘
│
↓
┌──────────────┐
│ 4.任务派发 │ 自动分配: K125路段养护队
│ 📱 短信推送 │ 通知方式: 短信+APP+电话
└──────┬───────┘ 责任人: 张工(13800138000)
│
↓
┌──────────────┐
│ 5.现场处置 │ 责任人接单并前往现场
│ 🔧 维修中 │ 上传处置照片和说明
└──────┬───────┘ 记录材料和工时
│
↓
┌──────────────┐
│ 6.验收复查 │ 自动生成复查任务
│ ✓ 复查通过 │ 无人机再次飞行验证
└──────┬───────┘ AI对比处置前后效果
│
↓
┌──────────────┐
│ 7.归档统计 │ 数据永久存档
│ 📊 已完成 │ 生成统计报表
└──────────────┘ 支持决策分析
┌─────────────────────────────────────────────────────────────────────────────┐
│ 时间轴示例 │
├─────────────────────────────────────────────────────────────────────────────┤
│ 15:23 发现问题 → 15:23 自动分类 → 15:24 等级评估 → 15:25 任务派发 │
│ (实时) (1秒) (30秒) (1分钟) │
│ │
│ 15:40 责任人接单 → 16:20 到达现场 → 17:30 处置完成 → 次日 复查验收 │
│ (15分钟) (40分钟) (70分钟) (24小时) │
│ │
│ 总耗时: 从发现到处置完成约2小时,次日验收通过后归档 │
└─────────────────────────────────────────────────────────────────────────────┘
```
### 3.5 多级告警与通知系统
**告警分级:**
| 等级 | 类型 | 响应时限 | 通知方式 |
|------|------|---------|---------|
| 特急 | 交通事故、路面塌陷、桥梁严重病害 | 立即 | 短信+电话+APP推送 |
| 紧急 | 护栏破损、边坡滑坡、排水堵塞 | 15分钟 | 短信+APP推送 |
| 重要 | 路面裂缝、标识缺失、轻微病害 | 2小时 | APP推送 |
| 一般 | 日常维护项目 | 24小时 | 系统内通知 |
**通知对象:**
- 指挥中心调度员
- 路段责任人
- 养护单位负责人
- 应急处置队伍
- 上级主管部门
**通知内容:**
- 问题描述和位置(GPS坐标+地图标注)
- 现场照片/视频
- 危险等级和建议处置方案
- 历史同类问题参考
---
## 四、技术架构
### 4.1 系统架构图
```
┌─────────────────────────────────────────────────────────────────────────────┐
│ 前端展示层 │
│ ┌──────────┐ ┌──────────┐ ┌──────────┐ ┌──────────┐ │
│ │Web管理台 │ │ 移动APP │ │大屏指挥 │ │微信小程序│ │
│ │React+Ant │ │React Nav │ │数据可视化│ │轻量查询 │ │
│ └──────────┘ └──────────┘ └──────────┘ └──────────┘ │
└────────────────────────────────┬────────────────────────────────────────────┘
│ HTTPS / WebSocket
↓
┌─────────────────────────────────────────────────────────────────────────────┐
│ Spring Cloud Gateway │
│ 统一网关 | 路由转发 | 认证鉴权 | 限流熔断 │
└────────────────────────────────┬────────────────────────────────────────────┘
│
↓
┌─────────────────────────────────────────────────────────────────────────────┐
│ 业务应用层 │
│ ┌──────────┐ ┌──────────┐ ┌──────────┐ ┌──────────┐ ┌──────────┐ │
│ │航线规划 │ │任务调度 │ │AI识别 │ │缺陷管理 │ │统计分析 │ │
│ │服务 │ │服务 │ │服务 │ │服务 │ │服务 │ │
│ └──────────┘ └──────────┘ └──────────┘ └──────────┘ └──────────┘ │
│ ┌──────────┐ ┌──────────┐ ┌──────────┐ ┌──────────┐ │
│ │告警通知 │ │报表生成 │ │工单流转 │ │数据导出 │ │
│ │服务 │ │服务 │ │服务 │ │服务 │ │
│ └──────────┘ └──────────┘ └──────────┘ └──────────┘ │
└────────────────────────────────┬────────────────────────────────────────────┘
│
↓
┌─────────────────────────────────────────────────────────────────────────────┐
│ 微服务支撑层 │
│ ┌──────────┐ ┌──────────┐ ┌──────────┐ ┌──────────┐ ┌──────────┐ │
│ │设备管理 │ │文件存储 │ │用户权限 │ │消息队列 │ │任务引擎 │ │
│ │Device │ │File │ │User │ │Message │ │Job │ │
│ └──────────┘ └──────────┘ └──────────┘ └──────────┘ └──────────┘ │
└────────────────────────────────┬────────────────────────────────────────────┘
│
↓
┌─────────────────────────────────────────────────────────────────────────────┐
│ 基础设施层 │
│ ┌──────────┐ ┌──────────┐ ┌──────────┐ ┌──────────┐ ┌──────────┐ │
│ │MySQL 8.0 │ │Redis 7.0 │ │ElasticS │ │MinIO │ │RocketMQ │ │
│ │业务数据 │ │缓存/会话 │ │日志/搜索 │ │对象存储 │ │消息中间件│ │
│ └──────────┘ └──────────┘ └──────────┘ └──────────┘ └──────────┘ │
│ ┌──────────┐ ┌──────────┐ │
│ │Nacos │ │Sentinel │ │
│ │注册/配置 │ │流控/降级 │ │
│ └──────────┘ └──────────┘ │
└────────────────────────────────┬────────────────────────────────────────────┘
│ MQTT / HTTP / WebSocket
↓
┌─────────────────────────────────────────────────────────────────────────────┐
│ 设备接入层 │
│ ┌──────────┐ ┌──────────┐ ┌──────────┐ ┌──────────┐ │
│ │无人机 │ │多旋翼 │ │固定翼 │ │桥检专用 │ │
│ │自动机场 │ │无人机 │ │无人机 │ │无人机 │ │
│ │DJI Dock │ │M300/M350 │ │WingtraOne│ │Elios 3 │ │
│ └──────────┘ └──────────┘ └──────────┘ └──────────┘ │
│ ↓ ↓ ↓ ↓ │
│ [自动起降] [端侧AI] [长航时] [桥下检测] │
└─────────────────────────────────────────────────────────────────────────────┘
数据流向:
设备采集 → 实时上传 → 业务处理 → 数据存储 → 前端展示
↑ ↓
└──────────────── 控制指令反馈 ────────────────┘
```
### 4.2 核心技术栈
**后端技术:**
- Spring Cloud 微服务架构
- Spring Boot 3.1.6
- MyBatis Plus 3.5.4
- Java 17
- Redis 7.0(缓存与消息)
- MySQL 8.0(业务数据)
- Elasticsearch 7.13(日志与搜索)
**前端技术:**
- React 17
- Ant Design Pro 4.20
- UmiJS 3.5
- TypeScript
- ECharts(数据可视化)
**AI技术:**
- TensorFlow / PyTorch
- YOLOv8(目标检测)
- DeepLab(语义分割)
- ResNet(特征提取)
- 边缘计算框架(NVIDIA Jetson)
**无人机技术:**
- DJI SDK集成
- MAVLink协议
- RTK高精度定位
- 自动机场对接
---
## 五、设备方案与一机多用
### 5.1 一机多用解决方案
**"一机多用"的理解与实现:**
平台支持单台无人机通过**快速更换挂载设备**和**切换飞行模式**,适应不同巡检场景,实现设备投资效益最大化。
**核心实现方式:**
**1. 模块化挂载系统**
- 快拆式云台接口,5分钟内完成设备更换
- 标准化电源和数据接口
- 自动识别挂载设备类型
**2. 多功能挂载设备库**
| 挂载设备 | 应用场景 | 更换时间 |
|---------|---------|---------|
| 高清变焦相机 | 日常道路巡检、桥梁外观检测 | 标配 |
| 热成像相机 | 夜间巡查、桥梁内部缺陷检测 | 3分钟 |
| 激光雷达 | 三维建模、位移监测 | 5分钟 |
| 喊话器 | 应急指挥、交通疏导 | 2分钟 |
| 照明灯 | 夜间应急、桥下检测 | 2分钟 |
| 多光谱相机 | 植被监测、边坡分析 | 5分钟 |
| 抛投器 | 应急救援物资投送 | 3分钟 |
**3. 智能任务调度**
- 系统根据任务类型自动提示所需挂载
- 优化任务排序,减少设备更换次数
- 同类任务批量执行
**典型应用示例(一机多用全天工作流):**
```
┌─────────────────────────────────────────────────────────────────────────────┐
│ 一机多用 - 全天工作流程 │
├─────────────────────────────────────────────────────────────────────────────┤
│ │
│ 08:00-11:00 日常道路巡检 │
│ ┌─────────────────────────────────────────────────────────────┐ │
│ │ 无人机: M350 RTK │ │
│ │ 挂载: 📷 高清变焦相机 (Zenmuse H20T) │ │
│ │ 任务: 10公里道路巡查 │ │
│ │ 识别: 路面、护栏、标识、抛洒物 │ │
│ │ 成果: 发现3处护栏破损,2处路面裂缝 │ │
│ └─────────────────────────────────────────────────────────────┘ │
│ ↓ 更换挂载 (5分钟) │
│ 11:30-14:00 桥梁详细检测 │
│ ┌─────────────────────────────────────────────────────────────┐ │
│ │ 无人机: M350 RTK (同一台) │ │
│ │ 挂载: 📷 高清相机 + 📡 激光雷达 (L1) │ │
│ │ 任务: 3座桥梁结构检测 │ │
│ │ 识别: 裂缝、锈蚀、位移、支座状态 │ │
│ │ 成果: 生成3D模型,发现5处裂缝病害 │ │
│ └─────────────────────────────────────────────────────────────┘ │
│ ↓ 更换挂载 (5分钟) │
│ 14:30-17:00 边坡监测 │
│ ┌─────────────────────────────────────────────────────────────┐ │
│ │ 无人机: M350 RTK (同一台) │ │
│ │ 挂载: 🌈 多光谱相机 (P1) │ │
│ │ 任务: 5处边坡扫描 │ │
│ │ 识别: 滑坡、植被覆盖、地质变化 │ │
│ │ 成果: 发现1处潜在滑坡风险 │ │
│ └─────────────────────────────────────────────────────────────┘ │
│ ↓ 更换挂载 (3分钟) │
│ 20:00-22:00 应急响应 (突发交通事故) │
│ ┌─────────────────────────────────────────────────────────────┐ │
│ │ 无人机: M350 RTK (同一台) │ │
│ │ 挂载: 🔥 热成像 + 💡 照明灯 + 📢 喊话器 │ │
│ │ 任务: 交通事故现场勘查 │ │
│ │ 功能: 热成像搜救、现场照明、指挥疏导 │ │
│ │ 成果: 快速定位伤员,协助救援 │ │
│ └─────────────────────────────────────────────────────────────┘ │
│ │
│ 设备利用率: 85% | 总飞行时间: 8小时 | 更换挂载次数: 3次 │
│ 投资回报: 单台设备完成4类任务,相当于4台专用设备的工作量 │
└─────────────────────────────────────────────────────────────────────────────┘
挂载设备快速更换示意:
┌──────────┐ ┌──────────┐ ┌──────────┐
│ 无人机 │ │ 挂载库 │ │ 新挂载 │
│ ▼ │ → │ 📷🌈📡💡 │ → │ ▲ │
│ [旧挂载] │ │ 快拆接口 │ │ [新挂载] │
└──────────┘ └──────────┘ └──────────┘
卸下(1分钟) 选择设备 安装(2分钟)
```
### 5.2 桥下巡检专用方案
**问题:桥下巡检是否只能用专用无人机?是否需要挂载定位模块?**
**解决方案:**
**方案一:专用桥检无人机(推荐)**
```
┌─────────────────────────────────────────────────────────────────────────────┐
│ 专用桥检无人机配置方案 │
├─────────────────────────────────────────────────────────────────────────────┤
│ │
│ 设备示意图: 定位模块配置: │
│ │
│ ╔═══════════╗ ┌─────────────────────────┐ │
│ ║ ▲ ▲ ▲ ║ ← 全向避障 │ 1️⃣ RTK定位模块 │ │
│ ║ ◄─●─► ║ ← 防撞框架 │ 厘米级精度 │ │
│ ║ ▼ ▼ ▼ ║ │ 桥外开阔区域使用 │ │
│ ╚═══════════╝ └─────────────────────────┘ │
│ │ │ │ ┌─────────────────────────┐ │
│ 📷💡📡 │ 2️⃣ 视觉定位系统 (VPS) │ │
│ 相机+补光+雷达 │ 桥下GPS弱信号时启用 │ │
│ │ 识别地面纹理定位 │ │
│ 核心特点: └─────────────────────────┘ │
│ ✓ 小型化设计 (350mm轴距) ┌─────────────────────────┐ │
│ ✓ 六面障碍物感知 │ 3️⃣ 超声波定位 │ │
│ ✓ 强光补偿系统 │ 近距离测距 (0.1-5m) │ │
│ ✓ 防撞保护框架 │ 防止碰撞桥墩/梁体 │ │
│ ✓ 续航30分钟 └─────────────────────────┘ │
│ ┌─────────────────────────┐ │
│ 桥下飞行路径示意: │ 4️⃣ 惯性导航系统 (IMU) │ │
│ │ 信号丢失时维持定位 │ │
│ ╔═══════════════════════╗ │ 短时自主飞行 │ │
│ ║ 桥面 ║ └─────────────────────────┘ │
│ ╠═══════════════════════╣ │
│ ║ ┌→→→→→→→→→→→→→→┐ ║ 定位切换逻辑: │
│ ║ ↑ 扫描路径 ↓ ║ 开阔区域 → RTK (精度±2cm) │
│ ║ └←←←←←←←←←←←←←←┘ ║ 桥下区域 → VPS (精度±10cm) │
│ ║ 桥墩 桥墩 桥墩 ║ 近距离 → 超声波 (精度±5cm) │
│ ╚═══════════════════════╝ 信号丢失 → IMU (维持10秒) │
│ │
│ 适用场景: │
│ ✓ 大型桥梁桥下全面检测 (跨度>50m) │
│ ✓ 复杂结构桥梁 (斜拉桥、悬索桥、拱桥) │
│ ✓ 高频次桥梁专项检测 (每月1次以上) │
│ ✓ 对检测精度要求高的项目 │
└─────────────────────────────────────────────────────────────────────────────┘
```
**方案二:通用无人机+增强定位(经济型)**
```
┌─────────────────────────────────────────────────────────────────────────────┐
│ 通用无人机改装方案 │
├─────────────────────────────────────────────────────────────────────────────┤
│ │
│ 改装前: 改装后: │
│ │
│ ┌─────────┐ ╔═══════════╗ │
│ │ ▲ ▲ │ ║ ▲ ▲ ▲ ║ ← 新增避障 │
│ │ ● │ ────改装───→ ║ ◄─●─► ║ ← 防撞框 │
│ │ ▼ ▼ │ ║ ▼ ▼ ▼ ║ │
│ └─────────┘ ╚═══════════╝ │
│ │ │ │ │ │ │
│ 📷 📷💡📡 │
│ 标配相机 相机+补光+定位 │
│ │
│ 改装清单: 成本对比: │
│ ┌─────────────────────────┐ ┌──────────────────────────┐ │
│ │ 1. 视觉定位模块 2万元 │ │ 专用桥检机: 15-25万元 │ │
│ │ 2. 补光灯系统 0.5万元 │ │ 通用机改装: 8-12万元 │ │
│ │ 3. 防撞保护框 0.3万元 │ │ 节省成本: 40-50% │ │
│ │ 4. 避障传感器 1.2万元 │ └──────────────────────────┘ │
│ │ 总计: 4万元 │ │
│ └─────────────────────────┘ 性能对比: │
│ ┌──────────┬────────┬────────┐ │
│ 适用场景: │ 对比项 │ 专用机 │ 改装机 │ │
│ ✓ 中小型桥梁 (跨度<50m) ├──────────┼────────┼────────┤ │
│ ✓ 预算有限的项目 │ 检测精度 │ 极高 │ 较高 │ │
│ ✓ 低频次桥下巡检 (季度1次) │ 操作难度 │ 低 │ 中 │ │
│ ✓ 简单结构桥梁 │ 安全性 │ 极高 │ 较高 │ │
│ │ 适用范围 │ 全部 │ 部分 │ │
│ └──────────┴────────┴────────┘ │
└─────────────────────────────────────────────────────────────────────────────┘
```
**方案对比:**
| 对比项 | 专用桥检无人机 | 通用无人机改装 |
|-------|--------------|--------------|
| 投资成本 | 15-25万元/台 | 8-12万元/台 |
| 检测精度 | 极高 | 较高 |
| 操作难度 | 低(高度自动化) | 中(需要经验) |
| 适用范围 | 所有桥梁 | 中小型桥梁 |
| 安全性 | 极高 | 较高 |
| 推荐场景 | 专业桥检单位 | 综合巡检单位 |
**平台支持:**
- 两种方案均可接入平台统一管理
- 自动识别设备类型并匹配航线
- 统一的数据格式和分析流程
---
## 六、竞争优势
### 6.1 技术优势
**1. 端云协同AI识别**
- 业界首创端侧+云端双重AI识别
- 端侧实时响应,云端深度分析
- 识别准确率行业领先
**2. 全场景航线规划**
- 支持道路、桥梁、隧道、边坡全场景
- 自动避障与动态调整
- 厘米级精准定位
**3. 完整闭环管理**
- 从发现到处置全流程数字化
- 自动派单与进度跟踪
- 数据永久存档与分析
**4. 企业级架构**
- 微服务架构,支持百万级数据
- 高可用、高并发、高扩展
- 多租户隔离,数据安全
### 6.2 业务优势
**1. 降本增效显著**
- 人力成本降低70%
- 巡检效率提升300%
- 年度成本节省60%以上
**2. 问题发现率高**
- AI识别准确率95%以上
- 细微病害不遗漏
- 早发现早处置,避免重大事故
**3. 响应速度快**
- 紧急问题15分钟内响应
- 自动派单无需人工干预
- 移动端随时随地处理
**4. 数据资产积累**
- 所有巡检数据永久保存
- 形成基础设施健康档案
- 支持大数据分析与预测
### 6.3 行业优势
**1. 深度行业理解**
- 团队具备交通行业背景
- 熟悉道路桥梁养护规范
- 符合行业标准和要求
**2. 成熟案例积累**
- 已服务多个省市交通部门
- 累计巡检里程超10万公里
- 发现并处置隐患5000+处
**3. 持续技术创新**
- 专业研发团队
- 每季度功能迭代
- 紧跟行业前沿技术
---
## 七、商业模式
### 8.1 产品销售模式
**标准版:**
- 适用于:中小型道路管理单位
- 包含:基础巡检功能 + 5台无人机
- 价格:80-120万元
**专业版:**
- 适用于:高速公路运营商
- 包含:全功能 + 10台无人机 + 3个机场
- 价格:200-300万元
**旗舰版:**
- 适用于:省级交通管理部门
- 包含:全功能 + 定制开发 + 培训服务
- 价格:500万元以上
### 8.2 服务订阅模式
**SaaS云服务:**
- 客户无需购买设备
- 按巡检里程或次数付费
- 价格:5-10元/公里
**托管运营模式:**
- 平台提供设备+人员+系统
- 客户按年付费
- 价格:50-100万元/年
### 8.3 数据增值服务
- 巡检数据分析报告
- 养护决策咨询
- 预测性维护建议
- 行业大数据服务
---
## 九、市场前景
### 9.1 市场规模
**国内市场:**
- 公路总里程:535万公里
- 桥梁总数:100万座
- 年度养护市场:超1000亿元
- 智能化改造需求:200亿元以上
**目标市场:**
- 高速公路运营商:全国31个省市
- 国省道管理部门:2000+个
- 城市市政管理:300+个城市
- 桥梁检测机构:500+家
### 9.2 政策支持
- 《交通强国建设纲要》:推进智慧交通发展
- 《数字交通发展规划纲要》:加快基础设施数字化
- 各省市智慧交通专项资金支持
- 新基建政策红利
### 9.3 增长预测
- 2026年:市场规模50亿元,年增长率80%
- 2027年:市场规模100亿元,年增长率100%
- 2028年:市场规模200亿元,年增长率100%
- 2030年:市场规模500亿元,进入成熟期
---
## 十、投资亮点
### 10.1 技术壁垒高
- 核心AI算法自主研发
- 多项发明专利
- 行业数据积累优势
- 技术团队经验丰富
### 10.2 市场空间大
- 千亿级市场规模
- 政策强力支持
- 刚性需求,抗周期
- 可复制性强
### 10.3 商业模式清晰
- 多元化收入来源
- 高毛利率(60%以上)
- 客户粘性强
- 可持续增长
### 10.4 团队实力强
- 核心团队来自交通、AI、无人机领域
- 成功案例丰富
- 执行力强
- 行业资源深厚
---
## 十一、技术参数
### 11.1 系统性能指标
| 指标项 | 参数 |
|-------|------|
| 并发用户数 | >1000 |
| 数据处理能力 | 10TB/天 |
| 系统响应时间 | <200ms |
| 系统可用性 | 99.9% |
| 数据存储 | PB级 |
| AI识别速度 | 100张/秒 |
### 11.2 无人机性能指标
| 指标项 | 多旋翼 | 固定翼 | 桥检专用 |
|-------|--------|--------|---------|
| 续航时间 | 45分钟 | 120分钟 | 30分钟 |
| 巡航速度 | 15m/s | 25m/s | 5m/s |
| 最大航程 | 20km | 100km | 5km |
| 抗风等级 | 6级 | 7级 | 4级 |
| 定位精度 | ±2cm | ±5cm | ±1cm |
| 相机像素 | 4800万 | 4800万 | 6000万 |
### 11.3 AI识别指标
| 病害类型 | 准确率 | 召回率 | 处理速度 |
|---------|--------|--------|---------|
| 路面裂缝 | 96% | 94% | 0.5秒/张 |
| 桥梁裂缝 | 95% | 93% | 0.8秒/张 |
| 护栏破损 | 97% | 95% | 0.3秒/张 |
| 边坡滑坡 | 94% | 92% | 1.0秒/张 |
| 交通事故 | 98% | 97% | 0.2秒/张 |
---
**附录:**
- 附录A:系统架构详细设计文档
- 附录B:AI算法技术白皮书
- 附录C:典型案例详细报告
- 附录D:产品价格清单
- 附录E:实施方案模板
---
*本文档为商业机密,仅供投资人参考,未经授权不得传播。*