GWY
2022-05-21 a3460549533111815e7f73d6cef601a58031525d
LS审批流程变更
1个文件已修改
538 ■■■■■ 已修改文件
ssbg/src/classes/OrderTriggerHandler.cls 538 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ssbg/src/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,15 @@
                        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_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_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 +2119,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;
            }
        }
    }
@@ -2628,6 +2663,13 @@
                        // 合同-变更申请-原合同无效或者手动修改导致合同无效
                        if (!approveStatus && status) {
                            /*if(newOrd.oldOrder__c){
                                RadiationUtil.oldOrder = true;
                                if (updateFlag) {
                                    newOrd.oldOrder__c = false;
                                }
                            }*/
                            RadiationUtil.updateRadiationTypeQuantity(newOrd.Id,orderFounder , newOrd.DealerId__c, true,'无效或变更无效',newOrd.LastModifiedById );
                        }
@@ -2644,6 +2686,12 @@
                            if (RadiationUtil.EscapeOrderTriggerHandler) {
                                RadiationUtil.EscapeOrderTriggerHandler = false;
                                /*if(newOrd.oldOrder__c){
                                    RadiationUtil.oldOrder = true;
                                    if (updateFlag) {
                                        newOrd.oldOrder__c = false;
                                    }
                                }*/
                                RadiationUtil.updateRadiationTypeQuantity(newOrd.Id,orderFounder , newOrd.DealerId__c, true,'合同变更草案中',newOrd.LastModifiedById );
                            }
@@ -2657,20 +2705,43 @@
                        Boolean status = newOrd.Status__c != oldOrd.Status__c && newOrd.Status__c == 'Inactive';
                        // 合同提交状态变成无效
                        if ( status ) {
                            /*if(newOrd.oldOrder__c){
                                RadiationUtil.oldOrder = true;
                                if (updateFlag) {
                                    newOrd.oldOrder__c = false;
                                }
                            }*/
                            RadiationUtil.updateRadiationTypeQuantity(newOrd.Id,orderFounder , newOrd.DealerId__c, true,'合同提交变无效',newOrd.LastModifiedById );
                        }
                    } else if (newOrd.ApproveStatus__c == 'CancelPass' && newOrd.Status__c == 'Active') {
                        // 合同-合同批准→→→合同取消
                        if ( approveStatus && newOrd.BeforeSubmitStatus__c == 'OrderPass') {
                            /*if(newOrd.oldOrder__c){
                                RadiationUtil.oldOrder = true;
                                if (updateFlag) {
                                    newOrd.oldOrder__c = false;
                                }
                            }*/
                            RadiationUtil.updateRadiationTypeQuantity(newOrd.Id,orderFounder , newOrd.DealerId__c, true,'合同取消',newOrd.LastModifiedById );
                        }
                    } else if (oldOrd.ApproveStatus__c == 'OrderSubmit' && newOrd.ApproveStatus__c == 'OrderReject' && newOrd.Status__c == 'Active') {
                        // 合同提交→→→合同驳回
                        /*if(newOrd.oldOrder__c){
                            RadiationUtil.oldOrder = true;
                            if (updateFlag) {
                                newOrd.oldOrder__c = false;
                            }
                        }*/
                        RadiationUtil.updateRadiationTypeQuantity(newOrd.Id,orderFounder , newOrd.DealerId__c, true,'合同驳回',newOrd.LastModifiedById );
                    } else if (oldOrd.ApproveStatus__c == 'OrderSubmit' && newOrd.ApproveStatus__c == 'OrderDraft' && newOrd.Status__c == 'Active') {
                        // 合同提交→→→合同调回
                        /*if(newOrd.oldOrder__c){
                            RadiationUtil.oldOrder = true;
                            if (updateFlag) {
                                newOrd.oldOrder__c = false;
                            }
                        }*/
                        RadiationUtil.updateRadiationTypeQuantity(newOrd.Id,orderFounder , newOrd.DealerId__c, true,'合同调回',newOrd.LastModifiedById );
                    }
                   
@@ -2788,6 +2859,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 = '客户名或最终用户与询价不一致!';
@@ -2796,7 +2869,13 @@
                System.debug(oppAccountMap.get(orOne.OpportunityId) != orOne.AccountId);
                System.debug( !roleMap.containsKey(orOne.OpportunityId));
                System.debug(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);
@@ -3363,6 +3442,451 @@
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
        i++;
    }
    
}