From fd9df05c48c09b4d7f39a3b401882bda226dedea Mon Sep 17 00:00:00 2001
From: 19626 <1962676589@qq.com>
Date: 星期二, 31 十月 2023 20:38:18 +0800
Subject: [PATCH] 近期修改

---
 force-app/main/default/classes/OPDNoReportApplicationController.cls |   41 ++++++++++++++++++++++++++++++-----------
 1 files changed, 30 insertions(+), 11 deletions(-)

diff --git a/force-app/main/default/classes/OPDNoReportApplicationController.cls b/force-app/main/default/classes/OPDNoReportApplicationController.cls
index 55ef72f..be152b0 100644
--- a/force-app/main/default/classes/OPDNoReportApplicationController.cls
+++ b/force-app/main/default/classes/OPDNoReportApplicationController.cls
@@ -1,12 +1,14 @@
 public  without sharing class OPDNoReportApplicationController {
     //瀹氫箟OPD璁″垝
-    public  OPDPlan__c opdPlan { get; set; }
+    public OPDPlan__c opdPlan { get; set; }
     //鏄惁涓婁紶闄勪欢
     public Boolean IsUpload { get; set; }
     //璺宠繃涓婁紶闄勪欢鍒ゆ柇 
     public Boolean IsHavFile { get; set; }
     //闄勪欢
+    // 20231103 chenjingwu  Lightning鏂囦欢淇敼 Start
     public List<ContentDocument> attachmentinfo { get; set; }
+    // 20231103 chenjingwu  Lightning鏂囦欢淇敼 End
     // //鎵ц瀹℃壒娴佹垚鍔熸爣璇�
     public Boolean approvalFlag { get; set; }
 
@@ -33,8 +35,10 @@
         //鑾峰彇椤甸潰鍙傛暟
         String paramId = ApexPages.currentPage().getParameters().get('id');
         //妫�绱pd璁″垝鐨勭姸鎬併�佸嚭鍊熺洰鐨勩�佸嚭鍊熺洰鐨�(宸ヤ綔娴佺敤)銆佹ā鍨嬪嚭鍊熶骇鍝佸瀷鍙枫�佸搴斾慨鐞嗙淮淇甆O,鏃犳姤鍛婄姸鎬�,杩藉姞閰嶅,opd鏉ユ簮,鎺ㄥ箍缁忕悊
-        List<OPDPlan__c> OPDPlanList = [select Id,Status__c,RentalReson__c,RentalResonTemp__c,ModelLendingProduct__c,ModelLendingProduct__r.Name,CorrespondingRepairNo__c,noReportStatus__c,AdditionalSupport__c,ModelLending__c,OPDType__c,SalesManager__c,ownerId   from OPDPlan__c where Id = :paramId];
-
+        //kk  澧炲姞鍑犱釜瀛楁鐨勬煡璇ccount_Laboratory__c,OPDPlan_ImplementDate__c    20231027 start
+         // List<OPDPlan__c> OPDPlanList = [select Id,Status__c,RentalReson__c,RentalResonTemp__c,ModelLendingProduct__c,ModelLendingProduct__r.Name,CorrespondingRepairNo__c,noReportStatus__c,AdditionalSupport__c,ModelLending__c,OPDType__c,SalesManager__c,ownerId,AdditionalSupport__r.Account_Laboratory__c,AdditionalSupport__r.OPDPlan_ImplementDate__c   from OPDPlan__c where Id = :paramId];
+        List<OPDPlan__c> OPDPlanList = [select Id,Status__c,RentalReson__c,RentalResonTemp__c,ModelLendingProduct__c,ModelLendingProduct__r.Name,CorrespondingRepairNo__c,noReportStatus__c,AdditionalSupport__c,ModelLending__c,OPDType__c,SalesManager__c,ownerId,AdditionalSupport__r.Account_Laboratory__c,AdditionalSupport__r.OPDPlan_ImplementDate__c ,Account_Laboratory__c,OPDPlan_ImplementDate__c  from OPDPlan__c where Id = :paramId];
+        //kk  澧炲姞鍑犱釜瀛楁鐨勬煡璇�  20231027 end
         if( OPDPlanList.size() == 0){
             ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR, '鎵句笉鍒板搴旂殑OPD璁″垝锛�'));
             return;
@@ -46,6 +50,7 @@
         }
 
         //闄勪欢(lightning)
+        // 20231103 chenjingwu  Lightning鏂囦欢淇敼 Start
         List<ContentDocumentLink> cdlList = [SELECT ContentDocumentId
         FROM ContentDocumentLink
         WHERE LinkedEntityId = :paramId];
@@ -53,8 +58,8 @@
         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];
+// 20231103 chenjingwu  Lightning鏂囦欢淇敼 End
 
         // attachmentinfo = [SELECT Id, Name,OwnerId FROM Attachment WHERE  parentid = :paramId];
         if(attachmentinfo.size()>0){
@@ -71,13 +76,27 @@
     @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;
+         // 20231103 chenjingwu  Lightning鏂囦欢淇敼 Start
+        //  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;
+            // 20231103 chenjingwu  Lightning鏂囦欢淇敼 End
              operateResult = '鎮ㄥ凡涓婁紶鏂囦欢鎴愬姛锛�';
          } catch (Exception e){
              operateResult = '涓婁紶鏂囦欢澶辫触锛岃閲嶈瘯锛�';

--
Gitblit v1.9.1