fix: sync material tag on report publish

This commit is contained in:
wushumin
2026-06-05 15:42:16 +08:00
parent 65d8f93410
commit ed87ea1541
3 changed files with 122 additions and 8 deletions

View File

@@ -435,8 +435,10 @@ class ReportsController
$effectivePublishTime = $report['publish_time'] ?: $now;
$isOrderAppraisalReport = ($report['report_type'] ?? 'appraisal') === 'appraisal' && (int)($report['order_id'] ?? 0) > 0;
$materialTag = null;
$materialTagService = new MaterialTagService();
if ($isOrderAppraisalReport) {
$materialTag = (new MaterialTagService())->findBoundTagForReport($id);
$materialTag = $materialTagService->findBoundTagForReport($id)
?: $materialTagService->syncBoundTagForReport($report, $request);
if (!$materialTag) {
if ($qrInput === '') {
Db::rollback();
@@ -452,7 +454,7 @@ class ReportsController
return api_error('报告未关联鉴定任务,不能绑定吊牌发布', 422);
}
$materialTag = (new MaterialTagService())->bindTagToReportByTask((int)$task['id'], $qrInput, $request);
$materialTag = $materialTagService->bindTagToReportByTask((int)$task['id'], $qrInput, $request);
}
}
@@ -476,6 +478,7 @@ class ReportsController
if ($isOrderAppraisalReport) {
$this->refreshAppraisalSnapshot((int)$report['id'], (int)$report['order_id'], $report['service_provider'], $now);
$materialTag = $materialTagService->syncBoundTagForReport($report, $request) ?: $materialTag;
}
$verify = $this->createOrUpdateVerifyRecord($report, $now);