|
@@ -79,8 +79,6 @@ public class DocInfoServiceImpl implements IDocInfoService {
|
|
|
if (StringUtils.isNotEmpty(info.getFileId())) {
|
|
|
elasticSearchService.save(info);
|
|
|
}
|
|
|
- //改变空间容量
|
|
|
- spaceService.updateUsedCap(info.getSpaceId());
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -158,8 +156,9 @@ public class DocInfoServiceImpl implements IDocInfoService {
|
|
|
elasticSearchService.save(docInfo);
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
//改变空间容量
|
|
|
- spaceService.updateUsedCap(docInfo.getSpaceId());
|
|
|
+ spaceService.changeUsedCap(docInfo.getSpaceId(), docInfo.getFileSize());
|
|
|
return i;
|
|
|
}
|
|
|
|
|
@@ -202,17 +201,11 @@ public class DocInfoServiceImpl implements IDocInfoService {
|
|
|
*/
|
|
|
@Override
|
|
|
public int deleteDocInfoByDocIds(Long[] docIds) {
|
|
|
- List<Long> spaceIds = new ArrayList<>();
|
|
|
+ int i = 1;
|
|
|
for (Long docId : docIds) {
|
|
|
- DocInfo docInfo = selectDocInfoByDocId(docId);
|
|
|
- spaceIds.add(docInfo.getSpaceId());
|
|
|
- }
|
|
|
- int i = docInfoMapper.deleteDocInfoByDocIds(docIds);
|
|
|
- //改变空间容量
|
|
|
- for (Long spaceId : spaceIds) {
|
|
|
- spaceService.updateUsedCap(spaceId);
|
|
|
+ i = i & deleteDocInfoByDocId(docId);
|
|
|
}
|
|
|
- return i;
|
|
|
+ return 1;
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -226,8 +219,7 @@ public class DocInfoServiceImpl implements IDocInfoService {
|
|
|
DocInfo docInfo = selectDocInfoByDocId(docId);
|
|
|
int i = docInfoMapper.deleteDocInfoByDocId(docId);
|
|
|
//改变空间容量
|
|
|
- spaceService.updateUsedCap(docInfo.getSpaceId());
|
|
|
-
|
|
|
+ spaceService.changeUsedCap(docInfo.getSpaceId(), 0 - docInfo.getFileSize());
|
|
|
return i;
|
|
|
}
|
|
|
|