From 9a0ef802a678ffc421fc1d416f7f867e89e5536a Mon Sep 17 00:00:00 2001 From: D C <chenbangcai@prec-tech.com> Date: 星期五, 26 五月 2023 10:32:04 +0800 Subject: [PATCH] 维修合同 多年保修消费率逻辑更改 --- force-app/main/default/triggers/ChangedDepartmentOwner.trigger | 30 ++++++++++++++++++++++++++++++ 1 files changed, 30 insertions(+), 0 deletions(-) diff --git a/force-app/main/default/triggers/ChangedDepartmentOwner.trigger b/force-app/main/default/triggers/ChangedDepartmentOwner.trigger index 0946918..cb8b5e3 100644 --- a/force-app/main/default/triggers/ChangedDepartmentOwner.trigger +++ b/force-app/main/default/triggers/ChangedDepartmentOwner.trigger @@ -123,17 +123,47 @@ AND owner_not_automatically_update__c = FALSE ]; //System.debug('updateList : ' + updateList.size()); + //20220929 you SWAG-CJP7TL start 鍚屾淇敼涓爣锛屽け鍗曚换鍔℃墍鏈変汉 + Map<Id,String> mapoppid = new Map<Id,String>(); + list<task__c> taskUpdateList = new list<task__c>(); + //20220929 you SWAG-CJP7TL end list<Opportunity> opUpdateList = new list<Opportunity>(); for (Opportunity op : updateList) { if(op.OwnerId != acMap.get(op.AccountId)){ op.OwnerId = acMap.get(op.AccountId); opUpdateList.add(op); + //20220929 you SWAG-CJP7TL start + mapoppid.put(op.id,acMap.get(op.AccountId)); + //20220929 you SWAG-CJP7TL end } } + if (opUpdateList.size() > 0) { ControllerUtil.updOppList(opUpdateList); } + //20220929 you SWAG-CJP7TL start + if(mapoppid.size() > 0){ + List<Task__c> taskList = [ + SELECT Id,OpportunityId__c,taskStatus__c + FROM task__c + WHERE OpportunityId__c in :mapoppid.keySet() + AND (RecordType.Name = '涓爣缁撴灉纭' OR RecordType.Name = '澶卞崟鎶ュ憡浠诲姟') + AND taskStatus__c = '02 鎺ュ彈']; + system.debug(mapoppid.keySet()+'test1-----'+taskList); + for(Task__c t: taskList){ + if(mapoppid.containsKey(t.OpportunityId__c)){ + t.Ownerid = mapoppid.get(t.OpportunityId__c); + t.assignee__c = mapoppid.get(t.OpportunityId__c); + taskUpdateList.add(t); + } + + } + if (taskUpdateList != null && taskUpdateList.size() > 0) { + update taskUpdateList; + } + } + //20220929 you SWAG-CJP7TL end } // HWAG-BG682M end } \ No newline at end of file -- Gitblit v1.9.1