|
@@ -45,22 +45,23 @@ public class AttachmentService {
|
|
|
|
|
|
|
|
@Transactional
|
|
@Transactional
|
|
|
public AttachmentUploadVO uploadAttachment(Long projectId, String displayName,
|
|
public AttachmentUploadVO uploadAttachment(Long projectId, String displayName,
|
|
|
- String fileName, String filePath,
|
|
|
|
|
|
|
+ String fileName, String fileKey,
|
|
|
String fileType, long fileSize) {
|
|
String fileType, long fileSize) {
|
|
|
Node project = nodeService.getById(projectId);
|
|
Node project = nodeService.getById(projectId);
|
|
|
if (project == null || !Constants.NODE_PROJECT.equals(project.getNodeType())) {
|
|
if (project == null || !Constants.NODE_PROJECT.equals(project.getNodeType())) {
|
|
|
throw new BusinessException(404, "项目不存在");
|
|
throw new BusinessException(404, "项目不存在");
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- String fileKey = IdGenerator.generateAttachmentKey();
|
|
|
|
|
|
|
+ // fileKey is now passed from FileStorageService, use it directly
|
|
|
|
|
+ String attachmentKey = IdGenerator.generateAttachmentKey();
|
|
|
Long userId = UserContext.currentUserId();
|
|
Long userId = UserContext.currentUserId();
|
|
|
|
|
|
|
|
Long attachmentId = nodeService.createNode(
|
|
Long attachmentId = nodeService.createNode(
|
|
|
- Constants.NODE_ATTACHMENT, fileKey,
|
|
|
|
|
|
|
+ Constants.NODE_ATTACHMENT, attachmentKey,
|
|
|
displayName != null ? displayName : fileName, userId);
|
|
displayName != null ? displayName : fileName, userId);
|
|
|
|
|
|
|
|
propertyService.setNodeProperty(attachmentId, "file_name", fileName);
|
|
propertyService.setNodeProperty(attachmentId, "file_name", fileName);
|
|
|
- propertyService.setNodeProperty(attachmentId, "file_path", filePath);
|
|
|
|
|
|
|
+ propertyService.setNodeProperty(attachmentId, "file_key", fileKey); // Store the actual file key
|
|
|
propertyService.setNodeProperty(attachmentId, "file_type", fileType);
|
|
propertyService.setNodeProperty(attachmentId, "file_type", fileType);
|
|
|
propertyService.setNodeProperty(attachmentId, "file_size", String.valueOf(fileSize));
|
|
propertyService.setNodeProperty(attachmentId, "file_size", String.valueOf(fileSize));
|
|
|
propertyService.setNodeProperty(attachmentId, "parse_status", Constants.PARSE_PENDING);
|
|
propertyService.setNodeProperty(attachmentId, "parse_status", Constants.PARSE_PENDING);
|