feat: OCR 服务 + 会议材料模块

ry-ocr/ (新)
  本地发票识别微服务 (PaddleOCR 3.x + FastAPI, 8801)
  - QR 优先: 扫到二维码即取开票时间/发票号/金额; 没扫到/格式不合法直接判非发票, 不跑 OCR
  - 配置 QR_FULL_OCR 控制快路径(false, 0.2s)还是全字段(true, 4.5s)
  - /recognize/invoice (multipart) + /recognize/invoice/by-path (本地路径, 白名单) + /recognize/text
  - is_invoice / from_qr / qr_raw / qr_error / error_code 字段
  - 12 字段发票抽取 (regex + 启发式, 左右主体识别)
  - 超时保护 (15s 单页 / 60s 总流程) + PaddleOCR 单例 + ThreadPoolExecutor

ry-api/ruoyi-business/
  - pom.xml: 加 hutool-http/json/core 5.8.27, lombok 1.18.30 (OcrClient @Slf4j 所需)
  - ocr/: OcrClient + InvoiceResult/Fields/Line + ZipExtractor + InvoiceOcrScheduler
  - oss/: OssUploader + OssConfMeta (OCR 识别后重传 OSS)
  - config/: OcrConfig + OcrExecutorConfig (后台线程池)
  - service/impl/InvoiceOcrService: 后台提交 OCR, ZIP 路径解压识别, 替换场景先清旧
  - 会议材料 CRUD 全套 (BizMeetingAuditLog/Executor/Invoice/Material/Supervisor):
    controller + service + mapper + domain + xml

ry-vue3/
  - MeetingDetail.vue (新建): 会议详情页 (含评分维度章节, 改只读)
  - Meetings.vue / OssFileUploader.vue / router / Login.vue: 适配新字段

ry-api/ruoyi-admin/
  - RuoYiApplication.java + application.yml: 启用 @Async 异步支持

_self/
  - manager_meetings.md / manager_meeting_detail.md: 文档
This commit is contained in:
郭庆泰
2026-08-22 00:23:22 +08:00
parent edfaf4e7f5
commit c3eb8ed9c3
88 changed files with 6710 additions and 240 deletions
@@ -0,0 +1,153 @@
<?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.ruoyi.business.mapper.BizMeetingInvoiceMapper">
<resultMap type="BizMeetingInvoice" id="BizMeetingInvoiceResult">
<id property="id" column="id" />
<result property="meetingId" column="meeting_id" />
<result property="materialId" column="material_id" />
<result property="ossUrl" column="oss_url" />
<result property="invoiceType" column="invoice_type" />
<result property="amount" column="amount" />
<result property="creatorId" column="creator_id" />
<result property="createTime" column="create_time" />
<result property="updateTime" column="update_time" />
<result property="recognizeStatus" column="recognize_status" />
<result property="errorMsg" column="error_msg" />
<result property="sourceFilename" column="source_filename" />
</resultMap>
<sql id="selectFields">
select id, meeting_id, material_id, oss_url, invoice_type, amount, creator_id, create_time, update_time,
recognize_status, error_msg, source_filename
from biz_meeting_invoice
</sql>
<select id="selectByPrimaryKey" resultMap="BizMeetingInvoiceResult" parameterType="Long">
<include refid="selectFields"/>
where id = #{id}
</select>
<select id="selectList" resultMap="BizMeetingInvoiceResult" parameterType="BizMeetingInvoice">
<include refid="selectFields"/>
<where>
<if test="meetingId != null">and meeting_id = #{meetingId}</if>
<if test="materialId != null">and material_id = #{materialId}</if>
<if test="invoiceType != null and invoiceType != ''">and invoice_type = #{invoiceType}</if>
</where>
order by id desc
</select>
<select id="selectByMaterialId" resultMap="BizMeetingInvoiceResult" parameterType="Long">
<include refid="selectFields"/>
where material_id = #{materialId}
limit 1
</select>
<select id="selectByMeetingId" resultMap="BizMeetingInvoiceResult" parameterType="Long">
<include refid="selectFields"/>
where meeting_id = #{meetingId}
order by id desc
</select>
<insert id="insert" parameterType="BizMeetingInvoice" useGeneratedKeys="true" keyProperty="id">
insert into biz_meeting_invoice
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="meetingId != null">meeting_id,</if>
<if test="materialId != null">material_id,</if>
<if test="ossUrl != null and ossUrl != ''">oss_url,</if>
<if test="invoiceType != null and invoiceType != ''">invoice_type,</if>
<if test="amount != null">amount,</if>
<if test="creatorId != null">creator_id,</if>
<if test="createTime != null">create_time,</if>
<if test="updateTime != null">update_time,</if>
<if test="recognizeStatus != null and recognizeStatus != ''">recognize_status,</if>
<if test="errorMsg != null">error_msg,</if>
<if test="sourceFilename != null">source_filename,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="meetingId != null">#{meetingId},</if>
<if test="materialId != null">#{materialId},</if>
<if test="ossUrl != null and ossUrl != ''">#{ossUrl},</if>
<if test="invoiceType != null and invoiceType != ''">#{invoiceType},</if>
<if test="amount != null">#{amount},</if>
<if test="creatorId != null">#{creatorId},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="recognizeStatus != null and recognizeStatus != ''">#{recognizeStatus},</if>
<if test="errorMsg != null">#{errorMsg},</if>
<if test="sourceFilename != null">#{sourceFilename},</if>
</trim>
</insert>
<update id="updateByPrimaryKey" parameterType="BizMeetingInvoice">
update biz_meeting_invoice
<trim prefix="SET" suffixOverrides=",">
<if test="meetingId != null">meeting_id = #{meetingId},</if>
<if test="materialId != null">material_id = #{materialId},</if>
<if test="ossUrl != null and ossUrl != ''">oss_url = #{ossUrl},</if>
<if test="invoiceType != null and invoiceType != ''">invoice_type = #{invoiceType},</if>
<if test="amount != null">amount = #{amount},</if>
<if test="creatorId != null">creator_id = #{creatorId},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="recognizeStatus != null and recognizeStatus != ''">recognize_status = #{recognizeStatus},</if>
<if test="errorMsg != null">error_msg = #{errorMsg},</if>
<if test="sourceFilename != null">source_filename = #{sourceFilename},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteByPrimaryKey" parameterType="Long">
delete from biz_meeting_invoice where id = #{id}
</delete>
<delete id="deleteByPrimaryKeys" parameterType="Long">
delete from biz_meeting_invoice where id in
<foreach collection="ids" item="id" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
<delete id="deleteByMaterialId" parameterType="Long">
delete from biz_meeting_invoice where material_id = #{materialId}
</delete>
<!-- 兜底扫描: UNRECOGNIZED 状态且 create_time 早于 N 分钟前的行 (处理程序重启 / OCR 临时挂掉导致的遗漏) -->
<select id="selectUnrecognizedOlderThanMinutes" resultMap="BizMeetingInvoiceResult" parameterType="int">
<include refid="selectFields"/>
where recognize_status = 'UNRECOGNIZED'
and create_time is not null
and create_time &lt; date_sub(now(), INTERVAL #{minutes} MINUTE)
order by create_time ASC
limit 100
</select>
<!-- 单文件后台 OCR 完成: 状态+金额 一起更新 (按 material_id) -->
<update id="updateStatusByMaterial">
update biz_meeting_invoice
set recognize_status = #{recognizeStatus},
<if test="errorMsg != null">error_msg = #{errorMsg},</if>
update_time = now()
where material_id = #{materialId}
and recognize_status = 'UNRECOGNIZED'
</update>
<!-- 单文件后台 OCR 完成: 更新金额 (前提: 状态已是 RECOGNIZED) -->
<update id="updateAmountByMaterial">
update biz_meeting_invoice
set amount = #{amount},
update_time = now()
where material_id = #{materialId}
</update>
<!-- 兜底 OCR 用: 同时更新状态 + 金额 + 错误信息 (按主键) -->
<update id="updateStatusAndAmountByPrimaryKey">
update biz_meeting_invoice
set recognize_status = #{recognizeStatus},
amount = #{amount},
error_msg = #{errorMsg},
update_time = now()
where id = #{id}
</update>
</mapper>