参考文献校对失败重新校对
This commit is contained in:
@@ -204,6 +204,77 @@ class ReferenceRelevanceCheckService
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* 仅重新校对某篇文章下 status=3(失败)的记录;不刷新 refer_text / 文献摘要,只重置结果字段后入队。
|
||||
* 联合引用组会整组重跑(与 enqueueRecheckFailedByPReferIdWithGroup 一致)。
|
||||
*
|
||||
* @param int $pArticleId
|
||||
* @return array{p_article_id:int,reset:int,queued:int,check_ids:int[],transport:string,queue:string}
|
||||
*/
|
||||
public function recheckFailedOnlyByArticle($pArticleId)
|
||||
{
|
||||
$pArticleId = intval($pArticleId);
|
||||
if ($pArticleId <= 0) {
|
||||
throw new \InvalidArgumentException('p_article_id is required');
|
||||
}
|
||||
|
||||
DbReconnectHelper::ensure();
|
||||
$rows = Db::name('article_reference_relevance_check_result')
|
||||
->where('p_article_id', $pArticleId)
|
||||
->where('status', self::RECORD_FAILED)
|
||||
->order('reference_no asc,am_id asc,text_start asc,id asc')
|
||||
->select();
|
||||
if (empty($rows)) {
|
||||
return [
|
||||
'p_article_id' => $pArticleId,
|
||||
'reset' => 0,
|
||||
'queued' => 0,
|
||||
'check_ids' => [],
|
||||
'transport' => self::TRANSPORT_RABBITMQ,
|
||||
'queue' => self::TRANSPORT_RABBITMQ,
|
||||
];
|
||||
}
|
||||
|
||||
$now = date('Y-m-d H:i:s');
|
||||
$resetFields = $this->relevanceCheckResultResetFields([
|
||||
'updated_at' => $now,
|
||||
]);
|
||||
|
||||
$targetRows = [];
|
||||
foreach ($rows as $row) {
|
||||
$groupRows = $this->findCitationGroupRows($row);
|
||||
foreach ($groupRows as $gr) {
|
||||
$checkId = $this->resolveCheckRowId($gr);
|
||||
if ($checkId > 0) {
|
||||
$targetRows[$checkId] = $gr;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$pendingJobs = [];
|
||||
foreach ($targetRows as $row) {
|
||||
$checkId = $this->resolveCheckRowId($row);
|
||||
Db::name('article_reference_relevance_check_result')->where('id', $checkId)->update($resetFields);
|
||||
$pendingJobs[] = [
|
||||
'check_id' => $checkId,
|
||||
'reference_no' => intval($row['reference_no']),
|
||||
'am_id' => intval($row['am_id']),
|
||||
'text_start' => intval($row['text_start']),
|
||||
];
|
||||
}
|
||||
|
||||
$checkIds = $this->enqueueChecksSortedByReferenceNo($pendingJobs, $pArticleId, 'recheck_failed');
|
||||
|
||||
return [
|
||||
'p_article_id' => $pArticleId,
|
||||
'reset' => count($targetRows),
|
||||
'queued' => count($checkIds),
|
||||
'check_ids' => $checkIds,
|
||||
'transport' => self::TRANSPORT_RABBITMQ,
|
||||
'queue' => self::TRANSPORT_RABBITMQ,
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* 某条参考文献下「校对失败」的明细重新校对(异步)
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user