feat: add report review publish flow

This commit is contained in:
wushumin
2026-06-04 12:08:16 +08:00
parent 9dfd5976ed
commit 55c357f2c2
14 changed files with 624 additions and 52 deletions

View File

@@ -269,7 +269,7 @@ class FulfillmentFlowService
$context = $this->formatOrderContext((int)$flow['order_id'], $request);
$report = $context['report_info'] ?? null;
if (!$report || ($report['report_status'] ?? '') !== 'published') {
throw new \InvalidArgumentException('订单报告未发布,不能进入寄回流程');
throw new \InvalidArgumentException('报告未发布,不符合寄回条件');
}
return $context + [
@@ -289,7 +289,7 @@ class FulfillmentFlowService
}
$report = $this->latestReport((int)$flow['order_id']);
if (!$report || ($report['report_status'] ?? '') !== 'published') {
throw new \InvalidArgumentException('订单报告未发布,不能确认寄回');
throw new \InvalidArgumentException('报告未发布,不符合寄回条件');
}
$tag = (new MaterialTagService())->findTagByInput($qrInput);
@@ -320,7 +320,10 @@ class FulfillmentFlowService
$report = $this->latestReport((int)$flow['order_id']);
$content = $report ? Db::name('report_contents')->where('report_id', (int)$report['id'])->find() : null;
$files = $this->decodeJsonArray($content['zhongjian_report_files_json'] ?? null);
if (!$report || ($report['report_status'] ?? '') !== 'published' || trim((string)($report['zhongjian_report_no'] ?? '')) === '' || !$files) {
if (!$report || ($report['report_status'] ?? '') !== 'published') {
throw new \InvalidArgumentException('该报告未发布,不符合寄回条件');
}
if (trim((string)($report['zhongjian_report_no'] ?? '')) === '' || !$files) {
throw new \InvalidArgumentException('中检报告未完整录入,不能确认寄回');
}
@@ -337,7 +340,7 @@ class FulfillmentFlowService
$report = $this->latestReport((int)$flow['order_id']);
if (!$report || ($report['report_status'] ?? '') !== 'published') {
throw new \InvalidArgumentException('订单报告未发布,不能确认寄回');
throw new \InvalidArgumentException('报告未发布,不符合寄回条件');
}
if ((int)$report['id'] !== $reportId) {
throw new \InvalidArgumentException('确认的报告与当前订单报告不匹配');
@@ -371,6 +374,10 @@ class FulfillmentFlowService
if (!$flow) {
throw new \RuntimeException('未找到可用的内部流转挂牌', 404);
}
$report = $this->latestReport((int)$flow['order_id']);
if (!$report || ($report['report_status'] ?? '') !== 'published') {
throw new \InvalidArgumentException('该报告未发布,不符合寄回条件');
}
if ((string)($flow['current_stage'] ?? '') !== 'return_confirmed') {
throw new \InvalidArgumentException('请先完成报告确认,再登记回寄运单');
}