|
@@ -136,34 +136,18 @@ public class StudyFileServiceImpl implements StudyFileService {
|
|
|
return R.ok();
|
|
|
}
|
|
|
|
|
|
- // 恢复人员
|
|
|
- List<StudyFilePersonDo> persons = personRecords.stream()
|
|
|
- .map(record -> convertToPerson(record, currentFile))
|
|
|
+ // 批量恢复人员的ID
|
|
|
+ List<String> recoverIds = personRecords.stream().map(StudyFilePersonRecordDo::getMainId)
|
|
|
.collect(Collectors.toList());
|
|
|
- studyFilePersonService.saveBatch(persons);
|
|
|
+ studyFilePersonService.batchRecoverByIds(recoverIds);
|
|
|
return R.ok();
|
|
|
}
|
|
|
|
|
|
- /**
|
|
|
- * 转换人员信息
|
|
|
- *
|
|
|
- * @param record 历史记录
|
|
|
- * @param currentFile 最新文件
|
|
|
- * @return 人员信息
|
|
|
- */
|
|
|
- private StudyFilePersonDo convertToPerson(StudyFilePersonRecordDo record, StudyFileDo currentFile) {
|
|
|
- StudyFilePersonDo studyFilePersonDo = new StudyFilePersonDo();
|
|
|
- BeanUtils.copyProperties(record, studyFilePersonDo);
|
|
|
- studyFilePersonDo.setId(SecurityUtil.getUUID());
|
|
|
- studyFilePersonDo.setStudyFileId(currentFile.getId());
|
|
|
- return studyFilePersonDo;
|
|
|
- }
|
|
|
-
|
|
|
/**
|
|
|
* 创建历史学习文件记录
|
|
|
*
|
|
|
* @param source 源数据
|
|
|
- * @param currentUser
|
|
|
+ * @param currentUser 当前用户
|
|
|
*/
|
|
|
private StudyFileRecordDo createHistoryFileRecord(StudyFileDo source, SysUserVo currentUser) {
|
|
|
StudyFileRecordDo target = new StudyFileRecordDo();
|
|
@@ -216,7 +200,7 @@ public class StudyFileServiceImpl implements StudyFileService {
|
|
|
*
|
|
|
* @param source 源数据
|
|
|
* @param historyFileId 历史文件ID
|
|
|
- * @param currentUser
|
|
|
+ * @param currentUser 当前用户
|
|
|
*/
|
|
|
private StudyFilePersonRecordDo convertToHistoryPersonRecord(StudyFilePersonDo source,
|
|
|
String historyFileId, SysUserVo currentUser) {
|