| | |
| | | where Accountid in:deptUpdateList |
| | | and isOwnerDiffWithAccount__c = true |
| | | AND owner_not_automatically_update__c = FALSE ]; |
| | | //20220928 you SWAG-CJP7TL start |
| | | system.debug('deptUpdateList==='+deptUpdateList); |
| | | Map<Id,String> mapoppid = new Map<Id,String>(); |
| | | for (Opportunity opp : updateOpportunityList) { |
| | | if (opp.Ownerid != opp.Account.ownerId) { |
| | | opp.Ownerid = opp.Account.ownerId; |
| | | mapoppid.put(opp.id,opp.Account.ownerId); |
| | | } |
| | | } |
| | | 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); |
| | | } |
| | | |
| | | } |
| | | |
| | | Integer indexCon = 0; |
| | | Database.SaveResult[] lsrUpdateCon = Database.update(updateOpportunityList, false); |
| | | Database.SaveResult[] lsrUpdatetask = Database.update(taskList, false); |
| | | //20220928 you SWAG-CJP7TL end |
| | | for (Database.SaveResult lsrChild : lsrUpdateCon) { |
| | | if (!lsrChild.isSuccess()) { |
| | | iflog.Is_Error__c = 3; |