浏览代码

refactor(qhse-common):优化学习文件处理逻辑

- 废弃文件时更新废弃字段
- 优化删除学习文件人员关联的逻辑,增加非空判断
lg 1 月之前
父节点
当前提交
c91b522836

+ 9 - 1
qhse-common/src/main/java/com/rongwei/bscommon/sys/service/impl/StudyFileServiceImpl.java

@@ -46,6 +46,12 @@ public class StudyFileServiceImpl implements StudyFileService {
             return false;
         }
 
+        // 废弃文件时更新废弃字段
+        if ("abandoned".equals(processType)) {
+            currentFile.setIsAbandoned("1");
+            studyFileDao.updateById(currentFile);
+        }
+
         // 保存历史学习文件信息
         StudyFileRecordDo historyFile = createHistoryFileRecord(currentFile);
         studyFileRecordService.save(historyFile);
@@ -96,7 +102,9 @@ public class StudyFileServiceImpl implements StudyFileService {
             List<String> personIdsToDelete = currentPersons.stream()
                     .map(StudyFilePersonDo::getId)
                     .collect(Collectors.toList());
-            studyFilePersonService.removeByIds(personIdsToDelete);
+            if (!personIdsToDelete.isEmpty()) {
+                studyFilePersonService.removeByIds(personIdsToDelete);
+            }
         }
     }