yangjieke
2022-04-22 f3faaf0e700c819f6c6aee18066943efd3fe4a76
force-app/main/default/classes/SimpleEventRegisterController.cls
@@ -88,6 +88,12 @@
    //2021-10-20  mzy  任务管理改善   start
    private Boolean IsGeneratePlan;  //是否生成计划
    //2021-10-20  mzy  任务管理改善   end
    //Add By Li Jun 20220224 for PIPL start
    public String idVisitor1PI{set;get;}
    public String idVisitor2PI{set;get;}
    public String staticResource {get; set;}
    public String contactAWSIds{set;get;}
    //Add By Li Jun 20220224 for PIPL end
    public SimpleEventRegisterController(ApexPages.StandardController controller) {
        this.isHospital = true;
        this.isAgent = false;
@@ -153,6 +159,11 @@
            System.debug('-----:inputDatetime=' + inputDatetime);
            this.targetEvent.StartDateTime = inputDatetime;
        }
        //Add by Li Jun 20220303 for PIPL Start
        PIHelper.PIIntegration piIntegration = PIHelper.getPIIntegrationInfo('Contact');
        staticResource = JSON.serialize(piIntegration);
        system.debug('static resource:'+JSON.serialize(staticResource));
        //Add by Li Jun 20220303 for PIPL End
    }
    public void init() {
@@ -212,6 +223,22 @@
            //2021-07-28  mzy  SWAG-C4YB9J 事件页面优化 今天的事件 如果已经生成报告一览,则不允许进行取消和延期操作 end
                allDisable = true;
            }
            //Add By Li Jun for PIPL 20220303 Start
            List<String> conAWSIds = new List<String>();
            Set<String> contactIdsForReport = new Set<String>();
            List<String> visitorList = new List<String>{'Visitor1_ID__c','Visitor2_ID__c','Visitor3_ID__c','Visitor4_ID__c','Visitor5_ID__c'};
            for(String visitorValue:visitorList){
                if(String.isNotEmpty((String)targetEvent.get(visitorValue))&&String.isNotBlank((String)targetEvent.get(visitorValue))){
                    contactIdsForReport.add((String)targetEvent.get(visitorValue));
                }
            }
            List<Contact> conListForReport = new List<Contact>([select id,AWS_Data_Id__c from Contact where id in:contactIdsForReport and AWS_Data_Id__c!='']);
            for(Contact con:conListForReport){
                conAWSIds.add(con.AWS_Data_Id__c);
            }
            contactAWSIds = JSON.serialize(conAWSIds);
            system.debug('Contact AWSIDs:'+contactAWSIds);
            //Add By Li Jun for PIPL 20220303 End
        }
        //20210324 zh WLIG-BX3DQ5 【委托】Outlook日历和SFDC日历同步 end
        if (targetEvent.OPDPlan_Flag__c) {
@@ -1011,9 +1038,11 @@
                }
                
            }
            //20201123 zh 创建主动任务与维修合同关联 end
            if (LoginUser.Job_Category__c.equals('销售推广')) {
                if (this.targetEvent.Activity_Type2__c == '病院') {
                   // 2021-06-11 mzy sla 注释掉了询价3 因为现在的页面没有给询价3赋值,所以会显示 询价3不等于空字符串而是等于null ,导致后面的判断进不去
                   // if (this.targetEvent.Related_Opportunity1__c != '' || this.targetEvent.Related_Opportunity2__c != '' || this.targetEvent.Related_Opportunity3__c != '') {
                    System.debug('测试询价任务:' +'询价1:' +this.targetEvent.Related_Opportunity1__c +'---询价2:'+this.targetEvent.Related_Opportunity2__c);
@@ -1021,16 +1050,16 @@
                        taskType = System.Label.OpportunityFollow; // 询价跟进任务
                    } else if (this.targetEvent.OPDPlan_Flag__c) {
                        taskType = System.Label.OPD; // OPD任务
                    } else if (accToNumTarget.get(accToDepMap.get(this.targetEvent.whatid__c)).Is_Target_Account_Energy__c == 1 || accToNumTarget.get(accToDepMap.get(this.targetEvent.whatid__c)).Is_Target_Account__c == 1) {
                        taskType = System.Label.TargetAccountVisit; // 目标客户拜访任务
                    }  else if (accToNumTarget.get(accToDepMap.get(this.targetEvent.whatid__c)).OCM_Category__c == 'H1' || accToNumTarget.get(accToDepMap.get(this.targetEvent.whatid__c)).OCM_Category__c == 'H0') {
                        taskType = System.Label.visitHLevel; // H层拜访任务
                    } else if (!accToNumTarget.isEmpty() && !accToDepMap.isEmpty() && (accToNumTarget.get(accToDepMap.get(this.targetEvent.whatid__c)).Is_Target_Account_Energy__c == 1 || accToNumTarget.get(accToDepMap.get(this.targetEvent.whatid__c)).Is_Target_Account__c == 1)) {
                         taskType = System.Label.TargetAccountVisit; // 目标客户拜访任务
                    }  else if (!accToNumTarget.isEmpty() && !accToDepMap.isEmpty() && (accToNumTarget.get(accToDepMap.get(this.targetEvent.whatid__c)).OCM_Category__c == 'H1' || accToNumTarget.get(accToDepMap.get(this.targetEvent.whatid__c)).OCM_Category__c == 'H0')) {
                         taskType = System.Label.visitHLevel; // H层拜访任务
                    } else {
                        taskType = System.Label.DailyVisit;// 日程拜访任务
                    }
                }
                if (this.targetEvent.Activity_Type2__c == '販売店') {
                    taskType = System.Label.AgencyVisit; // 经销商拜访任务
                    taskType = System.Label.AgencyVisit; // 经销商支持任务
                }
                if (this.targetEvent.Activity_Type2__c == '社外イベント') {
                    taskType = System.Label.campaignFollow; // 学术会议跟进任务
@@ -1807,7 +1836,7 @@
        //2021-11-02  mzy  任务管理改善开发计划  end
        //5.申请类型
        tempCancelPostponePlan.ApplyType__c = '延期';
        tempCancelPostponePlan.isDailyReportDelay__c = true;//2022-4-22 yjk 事件延期odp增加标识,防止循环
        insert tempCancelPostponePlan;
    }