From e6068da47c1bef5517c9e5fdc8c726766867ad4e Mon Sep 17 00:00:00 2001
From: buli <137736985@qq.com>
Date: 星期五, 14 七月 2023 15:10:02 +0800
Subject: [PATCH] Merge branch 'master' into LEXUpgrade2023-Deloitte

---
 force-app/main/default/classes/LexSummonsCreatController.cls |  119 ++++++++++++++++++++++++-----------------------------------
 1 files changed, 49 insertions(+), 70 deletions(-)

diff --git a/force-app/main/default/classes/LexSummonsCreatController.cls b/force-app/main/default/classes/LexSummonsCreatController.cls
index 9d25889..598c217 100644
--- a/force-app/main/default/classes/LexSummonsCreatController.cls
+++ b/force-app/main/default/classes/LexSummonsCreatController.cls
@@ -285,17 +285,9 @@
                 editAble = true;
             }
             userId = UserInfo.getUserId();
-            localuser = [
-                SELECT id, State_Hospital__c
-                FROM User
-                WHERE id = :UserInfo.getUserId()
-            ];
+            localuser = [SELECT id, State_Hospital__c FROM User WHERE id = :UserInfo.getUserId()];
             //userId = '00510000005QO75';
-            user Useracc = [
-                SELECT accountid, Work_Location__c, UserPro_Type__c
-                FROM user
-                WHERE id = :userId
-            ];
+            user Useracc = [SELECT accountid, Work_Location__c, UserPro_Type__c FROM user WHERE id = :userId];
             accountid = Useracc.accountid;
             userWorkLocation = Useracc.Work_Location__c;
             agencyProType = Useracc.UserPro_Type__c;
@@ -313,19 +305,11 @@
             ];
 
             List<Agency_Hospital_Link__c> AgencyHospitalLink = new List<Agency_Hospital_Link__c>();
-            AgencyHospitalLink = [
-                SELECT Id, Hospital__c, Hospital__r.Name
-                FROM Agency_Hospital_Link__c
-                WHERE Agency__c = :accountid
-            ];
+            AgencyHospitalLink = [SELECT Id, Hospital__c, Hospital__r.Name FROM Agency_Hospital_Link__c WHERE Agency__c = :accountid];
 
             //add by rentx 2021-3-1 start
             //鍒ゆ柇褰撳墠缁忛攢鍟嗕笅鏄惁鏈夌壒浠峰尰闄�
-            List<hospitalprice__c> hlist = [
-                SELECT id, product__c
-                FROM hospitalprice__c
-                WHERE account__c = :accountid
-            ];
+            List<hospitalprice__c> hlist = [SELECT id, product__c FROM hospitalprice__c WHERE account__c = :accountid];
             if (hlist == null || hlist.size() == 0) {
                 hasHos = false;
             } else {
@@ -365,6 +349,7 @@
             for (AggregateResult orderdetail : orderdetailCount) {
                 zaikuId.add(String.valueOf(orderdetail.get('cpc')));
             }
+            System.debug('orderdetailCount = ' + orderdetailCount);
             System.debug('sqlagencyProType = ' + sqlagencyProType);
             System.debug('userWorkLocation = ' + userWorkLocation);
             System.debug('accountName = ' + accountName);
@@ -408,6 +393,7 @@
                     for (Integer i = 0; i < product2Selected.size(); i++) {
                         MidMap.put(product2Selected[i].Id, new ConsumableorderdetailsInfo(product2Selected[i]));
                     }
+                    System.debug('MidMap = ' + MidMap);
                     for (Integer i = 0; i < CountDel.size(); i++) {
                         String str = '';
                         if (CountDel[i].hospitalSpecialOffer__c) {
@@ -415,6 +401,8 @@
                         } else {
                             str = 'notHos';
                         }
+                        System.debug('CountDel[i].Consumable_Product__c= ' + CountDel[i].Consumable_Product__c);
+                        System.debug('CountDel[i].Consumable_Product__c + str= ' + CountDel[i].Consumable_Product__c + str);
                         //鏄庣粏2瀵瑰簲鐨勪骇鍝佸瓨鍦ㄤ簬MidMap涓�
                         if (MidMap.containsKey(CountDel[i].Consumable_Product__c)) {
                             //璁剧疆map涓璳ey鐨勫悗缂� 鐢ㄤ簬鍖哄垎鍖婚櫌鐗逛环鍜岄潪鍖婚櫌鐗逛环
@@ -759,11 +747,7 @@
                     SELECT Id, Name, Invoice_Date__c, NoConfirmedPrice__c, Invoice_total_amount__c, Invoice_status__c
                     FROM Consumable_order__c
                     WHERE
-                        Id IN (
-                            SELECT Invoice_Code_link__c
-                            FROM Consumable_order_LinkTable__c
-                            WHERE Outboundorder_Code_link__c = :ESetId
-                        )
+                        Id IN (SELECT Invoice_Code_link__c FROM Consumable_order_LinkTable__c WHERE Outboundorder_Code_link__c = :ESetId)
                         AND Invoice_status__c != '鑽夋涓�'
                 ];
 
@@ -1323,11 +1307,7 @@
             // 鏄剧ず鏁版嵁鏉℃暟淇℃伅
             //    makeMessage();
             //闄勪欢
-            attachmentinfo = [
-                SELECT Id, Name, OwnerId
-                FROM Attachment
-                WHERE parentid = :ESetId
-            ];
+            attachmentinfo = [SELECT Id, Name, OwnerId FROM Attachment WHERE parentid = :ESetId];
             if (attachmentinfo.size() > 0) {
                 for (Integer i = 0; i < attachmentinfo.size(); i++) {
                     attachmentRecoeds.add(new ConsumableorderdetailsInfo(attachmentinfo[i]));
@@ -1441,6 +1421,7 @@
             WHERE Category3_text__c = :category3 AND Category4_text__c != NULL AND Category5_text__c != NULL
             GROUP BY Category4_text__c
         ];
+        System.debug('category4List ' + category4List);
         category4OptionList = new List<SelectOption>();
         category4OptionList.add(new SelectOption('', '-鏃�-'));
         category4OptionMap = new Map<String, String>();
@@ -1458,6 +1439,7 @@
             GROUP BY Category5_text__c
         ];
 
+        System.debug('category5List ' + category5List);
         category5OptionList = new List<SelectOption>();
         category5OptionList.add(new SelectOption('', '-鏃�-'));
         category5OptionMap = new Map<String, String>();
@@ -1489,6 +1471,7 @@
             WHERE Category3_text__c = :category3 AND Category4_text__c != NULL AND Category5_text__c != NULL
             GROUP BY Category4_text__c
         ];
+        System.debug('category4List ' + category4List);
         category4OptionList = new List<SelectOption>();
         category4OptionList.add(new SelectOption('', '-鏃�-'));
         category4OptionMap = new Map<String, String>();
@@ -1506,6 +1489,7 @@
             GROUP BY Category5_text__c
         ];
 
+        System.debug('category5List ' + category5List);
         category5OptionList = new List<SelectOption>();
         category5OptionList.add(new SelectOption('', '-鏃�-'));
         category5OptionMap = new Map<String, String>();
@@ -1573,6 +1557,8 @@
                 AND Arrive_Owner_Work_Location__c = :userWorkLocationLwc
             GROUP BY Consumable_Product__c, Box_Piece__c
         ];
+        System.debug('orderdetailCount = ' + orderdetailCount);
+
         for (AggregateResult orderdetail : orderdetailCount) {
             zaikuId.add(String.valueOf(orderdetail.get('cpc')));
         }
@@ -2085,11 +2071,7 @@
         //鐗逛环鍖婚櫌鍑哄簱闈炴湰鍖婚櫌缁存姢鐨勭壒浠峰晢鍝佹椂,鎶ラ敊 闈炵壒浠峰尰闄㈠嚭搴撶淮鎶ゅ湪鍖婚櫌鐗逛环鍏崇郴琛ㄧ殑浜у搧鏃� 鎶ラ敊
         if (coc.SummonsForDirction__c != '浜掔浉璋冭揣') {
             //闈炵壒浠峰尰闄㈠嚭搴撶壒浠蜂骇鍝佹椂 鎶ラ敊(褰撳墠缁忛攢鍟嗕笅娌℃湁鐗逛环鍖婚櫌闄ゅ)
-            List<hospitalprice__c> hopList = [
-                SELECT id, hospital__c, product__c
-                FROM hospitalprice__c
-                WHERE account__c = :accountid
-            ];
+            List<hospitalprice__c> hopList = [SELECT id, hospital__c, product__c FROM hospitalprice__c WHERE account__c = :accountid];
             //缁忛攢鍟嗗搴斿尰闄笅鐨勬墍鏈夌壒浠蜂骇鍝�
             Map<String, String> proMap = new Map<String, String>();
             //缁忛攢鍟嗕笅鐨勬墍鏈夌壒浠蜂骇鍝�
@@ -2275,11 +2257,7 @@
             insert p;
             ESetId = p.id;
             List<Consumable_order__c> detailName = new List<Consumable_order__c>();
-            detailName = [
-                SELECT id, Name
-                FROM Consumable_order__c
-                WHERE id = :ESetId
-            ];
+            detailName = [SELECT id, Name FROM Consumable_order__c WHERE id = :ESetId];
             Integer i = 1;
             for (ConsumableorderdetailsInfoLwc ass : pageRecordsLwc) {
                 if (ass.check == true) {
@@ -2436,6 +2414,7 @@
                         InsAfterDel.Name = p.name + '-' + str;
                         InsAfterDel.Shipment_Count__c = ass.orderdetails1.Shipment_Count__c;
                         InsAfterDel.Consumable_order__c = ESetId;
+                        System.debug('ass.Prod.id:' + ass.Prod.id);
                         InsAfterDel.Consumable_Product__c = ass.Prod.id;
                         InsAfterDel.Intra_Trade_List_RMB__c = ass.Prod.Intra_Trade_List_RMB__c;
                         InsAfterDel.Delivery_List_RMB__c = ass.orderdetails1.Delivery_List_RMB__c;
@@ -2454,11 +2433,7 @@
             }
             update p;
             List<Consumable_orderdetails__c> qs = new List<Consumable_orderdetails__c>();
-            qs = [
-                SELECT Id
-                FROM Consumable_orderdetails__c
-                WHERE Consumable_order__c = :ESetId
-            ];
+            qs = [SELECT Id FROM Consumable_orderdetails__c WHERE Consumable_order__c = :ESetId];
             if (qs.size() > 0) {
                 delete qs;
             }
@@ -2615,11 +2590,7 @@
         System.debug('thisDatetime2 = ' + thisDatetime2);
         System.debug('nextDatetime = ' + nextDatetime);
         System.debug('UserInfo.getUserId() = ' + UserInfo.getUserId());
-        User UserProTypecTemp = [
-            SELECT UserPro_Type__c
-            FROM User
-            WHERE id = :UserInfo.getUserId()
-        ];
+        User UserProTypecTemp = [SELECT UserPro_Type__c FROM User WHERE id = :UserInfo.getUserId()];
 
         String sql = 'SELECT id, Parentid FROM Account WHERE Parent.Name LIKE :nameCondition ';
         if (thisMonth < 4) {
@@ -2714,11 +2685,30 @@
         ResponseBodyLWC res = new ResponseBodyLWC();
         Map<String, object> data = new Map<String, object>();
         res.entity = data;
-        List<ContentVersion> cvList = [
-            SELECT id, Title, CreatedBy.Name, PathOnClient, CreatedDate, ContentDocumentId
-            FROM ContentVersion
-            WHERE FirstPublishLocationId = :recordId
-        ];
+        List<ContentVersion> cvList = new List<ContentVersion>();
+        List<ContentDocumentLink> links = [SELECT Id, ContentDocumentId FROM ContentDocumentLink WHERE LinkedEntityId = :recordId];
+        if (links != null && links.size() > 0) {
+            List<String> documentIds = new List<String>();
+            for (ContentDocumentLink link : links) {
+                documentIds.add(link.ContentDocumentId);
+            }
+            List<ContentVersion> cvInfo = [
+                SELECT Id, Title, OwnerId, Owner.Name, CreatedDate, ContentDocumentId
+                FROM ContentVersion
+                WHERE ContentDocumentId IN :documentIds
+            ];
+
+            if (cvInfo.size() > 0) {
+                for (Integer i = 0; i < cvInfo.size(); i++) {
+                    cvList.add(cvInfo[i]);
+                }
+            }
+        }
+        // List<ContentVersion> cvList = [
+        //     SELECT id, Title, CreatedBy.Name, PathOnClient, CreatedDate, ContentDocumentId
+        //     FROM ContentVersion
+        //     WHERE FirstPublishLocationId = :recordId
+        // ];
         data.put('cvList', cvList);
         res.status = 'Success';
         res.code = 200;
@@ -2730,17 +2720,9 @@
     @AuraEnabled
     public static ResponseBodyLWC deleteAtt(String contentVersionId) {
         try {
-            ContentVersion conVersion = [
-                SELECT ContentDocumentId
-                FROM ContentVersion
-                WHERE Id = :contentVersionId
-            ];
+            ContentVersion conVersion = [SELECT ContentDocumentId FROM ContentVersion WHERE Id = :contentVersionId];
             String contentDocumentId = conVersion.ContentDocumentId;
-            ContentDocument conDocument = [
-                SELECT Id
-                FROM ContentDocument
-                WHERE Id = :contentDocumentId
-            ];
+            ContentDocument conDocument = [SELECT Id FROM ContentDocument WHERE Id = :contentDocumentId];
             delete conDocument;
             return new ResponseBodyLWC('Success', 200, '', '');
         } catch (Exception e) {
@@ -2805,11 +2787,7 @@
         try {
             List<Consumable_order__c> qs = new List<Consumable_order__c>();
             List<Consumable_orderdetails__c> Dqs = new List<Consumable_orderdetails__c>();
-            Dqs = [
-                SELECT Id
-                FROM Consumable_orderdetails__c
-                WHERE Consumable_order__c = :ESetId
-            ];
+            Dqs = [SELECT Id FROM Consumable_orderdetails__c WHERE Consumable_order__c = :ESetId];
             qs = [SELECT Id FROM Consumable_order__c WHERE Id = :ESetId];
             if (Dqs.size() > 0 || qs.size() > 0) {
                 delete Dqs;
@@ -2917,6 +2895,7 @@
         }
 
         //闄勪欢
+        @TestVisible
         public ConsumableorderdetailsInfo(Attachment e) {
             concc = e;
             hospitalSpecialOffer = false;

--
Gitblit v1.9.1