李彤
2022-05-12 a2f7f78e8b02e3613c9ff9cf584de2ec0bda075d
force-app/main/default/classes/NFM703Controller.cls
@@ -1,3 +1,8 @@
/**********************************************************************
 * @msg:
 *   1.上传OBPM的数据里需要包含申请人和其他共有权限的人,但不需要区分
 *   2.传输时使用员工编号,多人时用逗号分隔
*************************************************************************/
public without sharing class NFM703Controller {
    private static final String LOG_TYPE = 'NFM703';
@@ -32,7 +37,7 @@
      public String ActivityTypeName; //活动形式
      public String ExpectedOlympusAttendance; //预计参会Olympus人数
      public String ExpectedHcpAttendance; //预计参会HCP人数
      public String BudgetType; //预算类型=Budget_Type__c
      public String BudgetType; //预算类型=Implementation_Purpose__c
      public String OfficeCategory; //科室分类=OfficeCategory__c
      public String MeetingType; //会议类型=Meeting_Type__c
      public String StateMaster; //省=State_Master__c
@@ -40,6 +45,7 @@
      public String WorkshopPlace; //会场地点=WorkshopPlace__c
      public String HostName; //会议主办方=HostName__c
      public String CooperatorCompany; //会议承办方=cooperatorCompany__c
        public String SharedEditing; // 申请人+共同编辑人=Shared_Editing__c
    }
    @future(callout = true)
    public static void callout(String iflog_Id, List < String > camIdList) {
@@ -65,7 +71,7 @@
                               Name,Num__c,
                               StartDate,
                               EndDate,
                               Budget_Type__c,
                               Implementation_Purpose__c,
                               OfficeCategory__c,
                               Meeting_Type__c,
                               State_Master__r.Name,
@@ -75,7 +81,10 @@
                                        Expected_Hcp_Attendance__c,
                                        Activity_Type_Name__c,
                               HostName__c,
                               cooperatorCompany__c,
                               cooperatorCompany__c,
                                        Owner.Employee_No__c,
                                        Shared_Editing__c,
                                        Carbon_Copy__c,
                               IF_Approved__c from Campaign where id in: camIdList];
       String logstr = ' ' + 'NumberOfRecord=' + camList.size() + '\n';
@@ -90,6 +99,19 @@
      mon.TransmissionDateTime = nowStr;
      mon.Text = '';
        Map<String, String> transferMap = new Map<String, String>();
        List<BatchIF_Transfer__c> transferList = [select Table__c,
                                  Column__c,
                                  External_value__c,
                                  Internal_value__c
                                  from BatchIF_Transfer__c
                                  where Dropped_Flag__c = false
                                          and (Table__c = 'Application_for_Conference_Adjudication__c')
                                          ];
        for (BatchIF_Transfer__c t : transferList) {
            transferMap.put(t.Column__c + t.Internal_value__c, t.External_value__c);
        }
        try {
              
           for (Campaign cam : camList) {
@@ -99,8 +121,8 @@
                ged.Name            = cam.Name;
              ged.StartDate         = NFMUtil.formatDate2StrSpo(cam.StartDate);
              ged.EndDate         = NFMUtil.formatDate2StrSpo(cam.EndDate);
                ged.BudgetType        = cam.Budget_Type__c;
            ged.OfficeCategory      = cam.OfficeCategory__c;
                ged.BudgetType        = cam.Implementation_Purpose__c;
            ged.OfficeCategory      = NFMUtil.getMapValue(transferMap, 'OfficeCategory__c', cam.OfficeCategory__c, iflog);
            ged.MeetingType      = cam.Meeting_Type__c;
                ged.ActivityTypeName  = cam.Activity_Type_Name__c;
            ged.StateMaster      = cam.State_Master__r.Name;                 
@@ -110,6 +132,8 @@
            ged.CooperatorCompany = cam.cooperatorCompany__c;
                ged.ExpectedOlympusAttendance = String.valueOf(cam.Expected_Olympus_Attendance__c);
                ged.ExpectedHcpAttendance = String.valueOf(cam.Expected_Hcp_Attendance__c);
                // 暂时定义为主担当,后续添加其他共享人
                ged.SharedEditing     = Modify_Sharing(cam.Owner.Employee_No__c, cam.Shared_Editing__c, cam.Carbon_Copy__c);
                gds.GeData.add(ged);
          }
@@ -222,4 +246,27 @@
        upsert rowDataSFDC;
    }
    public static String Modify_Sharing(String owner, String shared_editors, String carbon_copies) {
        if (String.isBlank(owner) && String.isBlank(shared_editors) && String.isBlank(carbon_copies)) {
            return '';
        }
        String ret = '';
        if (String.isNotBlank(owner)) {
            ret = owner;
        }
        if (String.isNotBlank(shared_editors)) {
            if (ret.length() > 0) {
                ret = ret + ',';
            }
            ret = ret + shared_editors;
        }
        if (String.isNotBlank(carbon_copies)) {
            if (ret.length() > 0) {
                ret = ret + ',';
            }
            ret = ret + carbon_copies;
        }
        return ret;
    }
}