feat: 添加复查功能和批量审核操作

- 复查功能: PUT /assessment/:id/review
  * 支持调整最终总分
  * 记录复查历史(reviewHistory)
  * 保存原始分数(originalScore)
  * 保留复查人、复查时间、复查意见

- 批量审核: POST /question-banks/:bankId/items/batch-review
  * 支持批量通过/拒绝题目
  * 可添加审核意见

- AssessmentSession实体: 添加复查相关字段
This commit is contained in:
Developer
2026-05-13 23:06:40 +08:00
parent 332b14454b
commit 649844a657
7 changed files with 149 additions and 0 deletions
@@ -406,4 +406,38 @@ export class QuestionBankService {
);
return selected;
}
async batchReviewItems(
bankId: string,
itemIds: string[],
approved: boolean,
comment?: string,
): Promise<QuestionBankItem[]> {
await this.findOne(bankId);
const items = await this.itemRepository.find({
where: itemIds.map(id => ({ id, bankId })),
});
if (items.length !== itemIds.length) {
throw new NotFoundException('Some items not found');
}
const newStatus = approved
? QuestionBankItemStatus.PUBLISHED
: QuestionBankItemStatus.PENDING_REVIEW;
for (const item of items) {
item.status = newStatus;
if (comment) {
item.basis = item.basis
? `${item.basis}\n[审核意见]: ${comment}`
: `[审核意见]: ${comment}`;
}
}
await this.itemRepository.save(items);
this.logger.log(`[batchReview] ${items.length} items ${approved ? 'approved' : 'rejected'}`);
return items;
}
}