111
沙世明
2022-11-22 928399eceec50e3d37ea08669a12789a9410a9d2
force-app/main/default/triggers/AttachmentTrigger.trigger
@@ -5,6 +5,9 @@
    List<String> attdelIds = new List<String>();
    List<String> rentalApplyIds = new List<String>();
    List<String> accIds = new List<String>();
    //20221014 yc 医院审批优化 start
    List<String> accAppIds = new List<String>();
    //20221014 yc 医院审批优化 end
    // LHJ CHAN-BCLD4P 20190618 Start
    List<String> specIds = new List<String>();
    List<String> specDelIds = new List<String>();
@@ -52,6 +55,11 @@
            if (String.valueOf(att.ParentId).startsWith('001')) {
                accIds.add(att.ParentId);
            }
            //20221014 yc 医院审批优化 start
            if (String.valueOf(att.ParentId).startsWith('a5C')) {
                accAppIds.add(att.ParentId);
            }
            //20221014 yc 医院审批优化 end
            if(String.valueOf(att.ParentId).startsWith(System.Label.Oppor_sepKey)){
                OpporFileIds.add(att.ParentId);
            }
@@ -106,6 +114,11 @@
                specIds.add(att.ParentId);
            }
            // LHJ CHAN-BCLD4P 20190618 End
            //20221014 yc 医院审批优化 start
            if (String.valueOf(att.ParentId).startsWith('a5C')) {
                accAppIds.add(att.ParentId);
            }
            //20221014 yc 医院审批优化 end
        }
    }
@@ -153,6 +166,22 @@
        }
        if (updAccList.size() > 0) update updAccList;
    }
    //20221014 yc 医院审批优化 start
    if (accAppIds.size() > 0) {
        Map<String, String> attMap = new Map<String, String>();
        List<Attachment> attList = [select Id, ParentId from Attachment where ParentId = :accAppIds order by ParentId];
        for (Attachment att : attList) {
            attMap.put(att.ParentId, att.ParentId);
        }
        List<Account_Delay_Apply__c> updAccAppList = new List<Account_Delay_Apply__c>();
        for (String accappid : accAppIds) {
            Account_Delay_Apply__c accapp = new Account_Delay_Apply__c(Id = accappid);
            accapp.Is_upload_file__c = attMap.containsKey(accappid);
            updAccAppList.add(accapp);
        }
        if (updAccAppList.size() > 0) update updAccAppList;
    }
    //20221014 yc 医院审批优化 end
    // LHJ CHAN-BCLD4P 20190618 Start
    if (specIds.size() > 0) {