From e14d6d0619330cad423f06493e3aa2371faa2a8f Mon Sep 17 00:00:00 2001
From: 19626 <1962676589@qq.com>
Date: 星期六, 09 九月 2023 14:02:23 +0800
Subject: [PATCH] Sit期间修改
---
force-app/main/default/classes/OPDNoReportApplicationController.cls | 28 ++++++++++++++++++++--------
1 files changed, 20 insertions(+), 8 deletions(-)
diff --git a/force-app/main/default/classes/OPDNoReportApplicationController.cls b/force-app/main/default/classes/OPDNoReportApplicationController.cls
index 55ef72f..3ad8e23 100644
--- a/force-app/main/default/classes/OPDNoReportApplicationController.cls
+++ b/force-app/main/default/classes/OPDNoReportApplicationController.cls
@@ -53,7 +53,7 @@
for (ContentDocumentLink docLink : cdlList) {
fileIDs.add(docLink.ContentDocumentId);
}
- attachmentinfo=[SELECT Title,OwnerId,ContentModifiedDate from ContentDocument WHERE id IN :fileIDs];
+ attachmentinfo=[SELECT Id,Title,OwnerId from ContentDocument WHERE Id IN :fileIDs];
// attachmentinfo = [SELECT Id, Name,OwnerId FROM Attachment WHERE parentid = :paramId];
@@ -71,13 +71,25 @@
@RemoteAction
public static String testAddAttachment(String attachmentName,String attachmentType, String attachmentBody,String parentId) {
String operateResult;
- Attachment tmpAttachment = new Attachment();
- tmpAttachment.Name = attachmentName;
- tmpAttachment.Body = EncodingUtil.base64Decode(attachmentBody);
- tmpAttachment.ParentId = parentId;
- tmpAttachment.ContentType = attachmentType;
+ // Attachment tmpAttachment = new Attachment();
+ // tmpAttachment.Name = attachmentName;
+ // tmpAttachment.Body = EncodingUtil.base64Decode(attachmentBody);
+ // tmpAttachment.ParentId = parentId;
+ // tmpAttachment.ContentType = attachmentType;
+ ContentVersion version = new ContentVersion();
+ version.Title = attachmentName;
+ version.VersionData = EncodingUtil.base64Decode(attachmentBody);
+ version.ContentLocation = 's';
+ version.PathOnClient = attachmentName + '.' + attachmentType;
try {
- insert tmpAttachment;
+ insert version;
+ version = [select Id,ContentDocumentId from ContentVersion where Id =: version.Id];
+ ContentDocumentLink link = new ContentDocumentLink();
+ link.ContentDocumentId = version.ContentDocumentId;
+ link.LinkedEntityId = parentId;
+ link.ShareType = 'I';
+ link.Visibility = 'AllUsers';
+ insert link;
operateResult = '鎮ㄥ凡涓婁紶鏂囦欢鎴愬姛锛�';
} catch (Exception e){
operateResult = '涓婁紶鏂囦欢澶辫触锛岃閲嶈瘯锛�';
@@ -115,7 +127,7 @@
opdPlan.noReportStatus__c = '宸蹭繚瀛�';
System.debug('opdPlan2:'+opdPlan);
update opdPlan;
- ApexPages.addmessage(new ApexPages.message(ApexPages.severity.CONFIRM, '淇濆瓨瀹屾瘯锛�'));
+ // ApexPages.addmessage(new ApexPages.message(ApexPages.severity.CONFIRM, '淇濆瓨瀹屾瘯锛�'));
saveFlag = true;
}catch(exception e){
ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR, e.getMessage()));
--
Gitblit v1.9.1