buli
2022-05-14 ead4df22dca33a867279471821ca675f91dec760
force-app/main/default/classes/OrderTriggerHandler.cls
@@ -360,6 +360,11 @@
                newOrd.SpecialDeliveryContact_D__c = newOrd.SpecialDeliveryContact__c;
                newOrd.SpecialDeliveryPhone_D__c = newOrd.SpecialDeliveryPhone__c;
                newOrd.SpecialDeliveryAddress_D__c = newOrd.SpecialDeliveryAddress__c;
                // PIPL Update 20220420 By Chen Yanan Start
                newOrd.SpecialDeliveryContact_D_Encrypted__c = newOrd.SpecialDeliveryContact_Encrypted__c;
                newOrd.SpecialDeliveryPhone_D_Encrypted__c = newOrd.SpecialDeliveryPhone_Encrypted__c;
                newOrd.SpecialDeliveryAddress_D_Encrypted__c = newOrd.SpecialDeliveryAddress_Encrypted__c;
                // PIPL Update 20220420 By Chen Yanan End
                newOrd.SpecialParkage_D__c = newOrd.SpecialParkage__c;
                newOrd.SpecialWarranty_D__c = newOrd.SpecialWarranty__c;
                newOrd.DealerProfit_D__c = newOrd.DealerProfit__c;
@@ -425,7 +430,7 @@
    }
    public static void setPriceBook(List<Order> newList, Map<Id, Order> newMap, List<Order> oldList, Map<Id, Order> oldMap) {
        List<String> oppidList = new List<String>();
        for (Order o : newList) {
            oppidList.add(o.OpportunityId);
@@ -1316,12 +1321,21 @@
            }
            if (newOrd.SpecialDeliveryContact__c != oldOrd.SpecialDeliveryContact__c) {
                newOrd.SpecialDeliveryContact_D__c = newOrd.SpecialDeliveryContact__c;
                // PIPL Update 20220420 By Chen Yanan Start
                newOrd.SpecialDeliveryContact_D_Encrypted__c = newOrd.SpecialDeliveryContact_Encrypted__c;
                // PIPL Update 20220420 By Chen Yanan End
            }
            if (newOrd.SpecialDeliveryPhone__c != oldOrd.SpecialDeliveryPhone__c) {
                newOrd.SpecialDeliveryPhone_D__c = newOrd.SpecialDeliveryPhone__c;
                // PIPL Update 20220420 By Chen Yanan Start
                newOrd.SpecialDeliveryPhone_D_Encrypted__c = newOrd.SpecialDeliveryPhone_Encrypted__c;
                // PIPL Update 20220420 By Chen Yanan End
            }
            if (newOrd.SpecialDeliveryAddress__c != oldOrd.SpecialDeliveryAddress__c) {
                newOrd.SpecialDeliveryAddress_D__c = newOrd.SpecialDeliveryAddress__c;
                // PIPL Update 20220420 By Chen Yanan Start
                newOrd.SpecialDeliveryAddress_D_Encrypted__c = newOrd.SpecialDeliveryAddress_Encrypted__c;
                // PIPL Update 20220420 By Chen Yanan End
            }
            if (newOrd.SpecialParkage__c != oldOrd.SpecialParkage__c) {
                newOrd.SpecialParkage_D__c = newOrd.SpecialParkage__c;
@@ -1637,6 +1651,11 @@
                    newOrd.SpecialDeliveryContact__c = newOrd.SpecialDeliveryContact_D__c;
                    newOrd.SpecialDeliveryPhone__c = newOrd.SpecialDeliveryPhone_D__c;
                    newOrd.SpecialDeliveryAddress__c = newOrd.SpecialDeliveryAddress_D__c;
                    // PIPL Update 20220420 By Chen Yanan Start
                    newOrd.SpecialDeliveryContact_Encrypted__c = newOrd.SpecialDeliveryContact_D_Encrypted__c;
                    newOrd.SpecialDeliveryPhone_Encrypted__c = newOrd.SpecialDeliveryPhone_D_Encrypted__c;
                    newOrd.SpecialDeliveryAddress_Encrypted__c = newOrd.SpecialDeliveryAddress_D_Encrypted__c;
                    // PIPL Update 20220420 By Chen Yanan End
                    newOrd.SpecialParkage__c = newOrd.SpecialParkage_D__c;
                    newOrd.SpecialWarranty__c = newOrd.SpecialWarranty_D__c;
                    newOrd.DealerProfit__c = newOrd.DealerProfit_D__c;
@@ -1765,6 +1784,11 @@
                    newOrd.SpecialDeliveryContact_D__c = newOrd.SpecialDeliveryContact__c;
                    newOrd.SpecialDeliveryPhone_D__c = newOrd.SpecialDeliveryPhone__c;
                    newOrd.SpecialDeliveryAddress_D__c = newOrd.SpecialDeliveryAddress__c;
                    // PIPL Update 20220420 By Chen Yanan Start
                    newOrd.SpecialDeliveryContact_D_Encrypted__c = newOrd.SpecialDeliveryContact_Encrypted__c;
                    newOrd.SpecialDeliveryPhone_D_Encrypted__c = newOrd.SpecialDeliveryPhone_Encrypted__c;
                    newOrd.SpecialDeliveryAddress_D_Encrypted__c = newOrd.SpecialDeliveryAddress_Encrypted__c;
                    // PIPL Update 20220420 By Chen Yanan End
                    newOrd.SpecialParkage_D__c = newOrd.SpecialParkage__c;
                    newOrd.SpecialWarranty_D__c = newOrd.SpecialWarranty__c;
                    newOrd.DealerProfit_D__c = newOrd.DealerProfit__c;
@@ -1806,6 +1830,9 @@
                    newOrd.Contract_StatusD__c = newOrd.Contract_Status__c;
                    newOrd.ProductConfig_D__c = newOrd.ProductConfig__c;
                    // PIPL Update 20220420 By Chen Yanan Start
                    newOrd.SpecialDeliveryPhone_Encrypted__c = newOrd.SpecialDeliveryPhone_D_Encrypted__c;
                    // PIPL Update 20220420 By Chen Yanan End
                    if (newOrd.Upload_IsChanged__c == true) {
                        newOrd.Upload_IsChanged__c = false;
@@ -2063,15 +2090,14 @@
                        newOrder.BS_AsistBGenManger_BS__c = u.BS_AsistBGenManger__c == null ? u.Id : u.BS_AsistBGenManger__c;
                        newOrder.BS_AsistGenManger_BS__c  = u.BS_AsistGenManger__c  == null ? u.Id : u.BS_AsistGenManger__c;
                        newOrder.BS_MandAGM__c  = u.BS_Manager__c         == u.BS_AsistGenManger__c ? true : false;
                        newOrder.BS_AGMandD__c  = u.BS_AsistGenManger__c  == u.BS_Department__c ? true : false;
                        newOrder.BS_DandAB__c   = u.BS_Department__c      == u.BS_AsistBGenManger__c ? true : false;
                        newOrder.BS_MandAGM__c  = u.BS_Manager__c         == u.BS_AsistBGenManger__c ? true : false;
                        //newOrder.BS_AGMandD__c  = u.BS_AsistGenManger__c  == u.BS_Department__c ? true : false;
                        //newOrder.BS_DandAB__c   = u.BS_Department__c      == u.BS_AsistBGenManger__c ? true : false;
                        newOrder.BS_ABGandBD__c = u.BS_AsistBGenManger__c == u.BS_BDepartment__c ? true : false;
                        newOrder.BS_BDandIND__c = u.BS_BDepartment__c     == u.BS_INDepartment__c ? true : false;
                        newOrder.BS_INDandGM__c = u.BS_INDepartment__c    == u.BS_GeneralManager__c ? true : false;
                    }
                }
                if (newOrder.ProductSegment__c != 'BS') {
                    newOrder.SalesOwner_BS__c = newOrder.OpportunityOwnerId__c;
@@ -2092,6 +2118,14 @@
            }    
            //}
        }
        for (Order newOrder : newList) {
            if (newOrder.ProductSegment__c == 'BS') {
                newOrder.BS_AGMandD__c  = newOrder.BS_Manager_BS__c    == newOrder.SalesOwner_BS__c ? true : false;
                newOrder.BS_DandAB__c   = newOrder.BS_Department_BS__c == newOrder.SalesOwner_BS__c ? true : false;
            }
        }
    }
@@ -2824,6 +2858,8 @@
        for(OpportunityContactRole oppor:role_list){
            roleMap.put(oppor.OpportunityId,oppor.ContactId);
        }
        System.debug('oppidList: ' + oppidList);//Nancy 2022-04-25
        System.debug('role_list: ' + role_list);//Nancy 2022-04-25
        // 获取系统管理员Id
        String getUserId = System.label.SystemAdmin1_2_GPI;
        String errMessage = '客户名或最终用户与询价不一致!';
@@ -2832,8 +2868,14 @@
                System.debug(oppAccountMap.get(orOne.OpportunityId) != orOne.AccountId);
                System.debug( !roleMap.containsKey(orOne.OpportunityId));
                System.debug(orOne.EndUserD__c + '++'+ roleMap.get(orOne.OpportunityId));
                /*if(oppAccountMap.get(orOne.OpportunityId) != orOne.AccountId || !roleMap.containsKey(orOne.OpportunityId) || orOne.EndUserD__c != roleMap.get(orOne.OpportunityId)){
                //zhj 2022-04-22 start
                System.debug('oppAccountMap.get(orOne.OpportunityId) = ' + oppAccountMap.get(orOne.OpportunityId));
                System.debug('orOne.AccountId = ' + orOne.AccountId);
                System.debug('roleMap.containsKey(orOne.OpportunityId) = ' + roleMap.containsKey(orOne.OpportunityId));
                System.debug('orOne.EndUserD__c = ' + orOne.EndUserD__c);
                System.debug('roleMap.get(orOne.OpportunityId) = ' + roleMap.get(orOne.OpportunityId));
                //zhj 2022-04-22 end
                if(oppAccountMap.get(orOne.OpportunityId) != orOne.AccountId || !roleMap.containsKey(orOne.OpportunityId) || orOne.EndUserD__c != roleMap.get(orOne.OpportunityId)){
                    // 获取用户Id
                    String userId = UserInfo.getUserId().subString(0,15);
                    if (String.isNotBlank(getUserId)) {
@@ -2855,7 +2897,7 @@
                    }
                    
                    
                }*/
                }
            }
        }
    }