| | |
| | | // return [select id, Name, Agency_User__c from contact where Agency_User__c = true and AccountId in (select AccountId from User where id=:login_user_id)]; |
| | | return [select id, Name, Agency_User__c from contact]; |
| | | } |
| | | |
| | | // fy 导入 20220424 start |
| | | public class GeDatass { |
| | | public String dataId; |
| | | public String doctorDivision1; |
| | | public String doctorDivision1Encrypt; |
| | | public Integer isDelete; |
| | | public String name; |
| | | public String nameEncrypt; |
| | | public String sfRecordId; |
| | | public String type; |
| | | public String typeEncrypt; |
| | | } |
| | | @AuraEnabled |
| | | public static String processDataAWSId(String fileData) { |
| | | System.debug('fileData:::'+filedata); |
| | | String errorMag = ''; |
| | | // 创建周报 |
| | | try{ |
| | | if(fileData!=null){ |
| | | String[] fileLines = new String[]{}; |
| | | fileLines = fileData.split('\n'); |
| | | |
| | | // 经销商医院名称list |
| | | List<String> ahlNameList = new List<String>(); |
| | | //for content |
| | | system.debug('fileLines.size()==============>'+fileLines.size()); |
| | | for (Integer i=1,j=fileLines.size();i<j;i++){ |
| | | List<String> inputvalues = new List<String>(); |
| | | inputvalues = fileLines[i].split(','); |
| | | if(inputvalues != null){ |
| | | if(inputvalues[2] == '' || inputvalues[2] == null){ |
| | | errorMag += 'error1 第'+i+'行数据医院不能为空'; |
| | | } |
| | | ahlNameList.add(inputvalues[2]); |
| | | } |
| | | } |
| | | // 经销商医院的ocsm医院id的list |
| | | List<String> ahlOcsmIdList = new List<String>(); |
| | | List<Agency_Hospital_Link__c> ahlList = [select id,name,Hospital__c,MaxActivityDate__c from Agency_Hospital_Link__c where name = :ahlNameList and Agency_Campaign_Obj__c = true]; |
| | | |
| | | for(Agency_Hospital_Link__c ahl : ahlList){ |
| | | ahlOcsmIdList.add(ahl.Hospital__c); |
| | | } |
| | | List<Agency_Contact__c> doctor2list = [select id,Name,Doctor_Division1__c,Type__c,Agency_Hospital__c,AWS_Data_Id__c,Name_Encrypted__c FROM Agency_Contact__c WHERE Hospital_ID18__c= :ahlOcsmIdList order by Name]; |
| | | |
| | | if(errorMag != ''){ |
| | | return errorMag; |
| | | } |
| | | String doctor2listStr = JSON.serialize(doctor2list); |
| | | return doctor2listStr; |
| | | } |
| | | }catch(Exception e){ |
| | | System.debug('exception'+e); |
| | | return e.getLineNumber()+'exception:'+e; |
| | | } |
| | | return 'success'; |
| | | } |
| | | // fy 导入 20220424 end |
| | | @AuraEnabled// fy 导入 20220424 start String sobjectName,List<String> fields, |
| | | // public static String processData(String fileData,String Agency_ContactListjson) { |
| | | public static String processData(String fileData,String sobjectName,List<String> fields) { |
| | | |
| | | DateTime now =System.now(); |
| | | System.debug('当前时间:::'+now); |
| | | System.debug('fileData:::'+filedata); |
| | | System.debug('sobjectName:::'+sobjectName); |
| | | System.debug('fields:::'+fields); |
| | | // System.debug('Agency_ContactListjson::::'+Agency_ContactListjson); |
| | | String errorMag = ''; |
| | | |
| | | // 创建周报 |
| | | try{ |
| | | |
| | | if(fileData!=null){ |
| | | // List<GeDatass> Agency_ContactList = (List<GeDatass>)JSON.deserialize(Agency_ContactListjson,List<GeDatass>.class); |
| | | // System.debug('Agency_ContactList::::'+Agency_ContactList); |
| | | // Map<String,String> Agency_ContactMap = new Map<String,String>(); |
| | | // for(GeDatass agconobj :Agency_ContactList){ |
| | | // Agency_ContactMap.put(agconobj.name.replace(' ',''),agconobj.dataId); |
| | | // } |
| | | String[] fileLines = new String[]{}; |
| | | fileLines = fileData.split('\n'); |
| | | // 担当名称的list |
| | |
| | | system.debug('for2022161329'); |
| | | List<String> inputvalues = new List<String>(); |
| | | inputvalues = fileLines[i].split(','); |
| | | System.debug('inputvalues++'+inputvalues); |
| | | if(inputvalues != null){ |
| | | system.debug('if2022161333'); |
| | | if(inputvalues[0] == '' || inputvalues[0] == null){ |
| | |
| | | errorMag += '='; |
| | | } |
| | | } |
| | | if(inputvalues[9] != '\r' && getResultlist(inputvalues[9])){ |
| | | // if(inputvalues[9] != '\r' && getResultlist(inputvalues[9])){ |
| | | if(inputvalues[9] != '' && getResultlist(inputvalues[9])){ |
| | | // return 'error3 第'+i+'行数据结果选项列表的值'+inputvalues[9]+'不存在'; |
| | | errorMag += 'error3 第'+i+'行数据结果选项列表的值'+inputvalues[9]+'不存在'; |
| | | errorMag += '='; |
| | |
| | | system.debug('inputvalues[7]=================>'+inputvalues[7]); |
| | | system.debug('inputvalues[8]=================>'+inputvalues[8]); |
| | | system.debug('inputvalues[9]=================>'+inputvalues[9]); |
| | | // system.debug('inputvalues[10]=================>'+inputvalues[10]); |
| | | |
| | | |
| | | nameList.add(inputvalues[0]); |
| | |
| | | // for(ProductTypes__c protype : proTypeList){ |
| | | // protypeMap.put(protype.Name, protype.Id); |
| | | // } |
| | | List<Agency_Contact__c> doctor2list = [select id,Name,Doctor_Division1__c,Type__c,Agency_Hospital__c FROM Agency_Contact__c WHERE Hospital_ID18__c= :ahlOcsmIdList order by Name]; |
| | | //fy 20220424 start AWS_Data_Id__c |
| | | List<Agency_Contact__c> doctor2list = [select id,Name,Doctor_Division1__c,Type__c,Agency_Hospital__c,AWS_Data_Id__c,Name_Encrypted__c FROM Agency_Contact__c WHERE Hospital_ID18__c= :ahlOcsmIdList order by Name]; |
| | | for(Agency_Contact__c ac : doctor2list){ |
| | | doctor2Map.put(ac.Name.replace(' ',''), ac.Id); |
| | | //fy 20220424 start |
| | | // doctor2Map.put(ac.AWS_Data_Id__c, ac.Id); |
| | | // doctor2Map.put(ac.Name.replace(' ',''), ac.Id); |
| | | doctor2Map.put(ac.Name_Encrypted__c, ac.Id); |
| | | //fy 20220424 end |
| | | } |
| | | |
| | | |
| | |
| | | // errorMag += 'error2 第'+hang+'行数据科室'+lineList[3]+'不存在'; |
| | | // errorMag += '='; |
| | | } |
| | | |
| | | if(doctor2Map.containsKey(lineList[4].replace(' ',''))){ |
| | | agencyReport.doctor2__c = doctor2Map.get(lineList[4].replace(' ','')); // 拜访人 |
| | | //fy 20220424 start |
| | | // if(doctor2Map.containsKey(lineList[4].replace(' ',''))){ |
| | | if(doctor2Map.containsKey(lineList[4])){ |
| | | // if(Agency_ContactMap.containsKey(lineList[4].replace(' ',''))){ |
| | | // if(doctor2Map.containsKey(Agency_ContactMap.get(lineList[4].replace(' ','')))){ |
| | | // agencyReport.doctor2__c = doctor2Map.get(lineList[4].replace(' ','')); // 拜访人 |
| | | agencyReport.doctor2__c = doctor2Map.get(lineList[4]); // 拜访人 |
| | | // agencyReport.doctor2__c = doctor2Map.get(Agency_ContactMap.get(lineList[4].replace(' ',''))); // 拜访人 |
| | | // } |
| | | }else{ |
| | | if(lineList[4] != '' && lineList[4] != null){ |
| | | // return 'error2 第'+hang+'行数据拜访人'+lineList[4]+'不存在'; |
| | |
| | | // agencyReport.Product_Category3__c = protypeMap.get(lineList[7]);// 产品区分3 |
| | | // } |
| | | agencyReport.Result__c = lineList[9]; |
| | | if(lineList.size()==11){ |
| | | if(lineList[10] != null && lineList[10] != ''){ |
| | | agencyReport.SupportNeeds__c = lineList[10]; |
| | | } |
| | | } |
| | | String headerStr = createHeader(week,s_agency); |
| | | if(agency_report_headerMap.containsKey(headerStr)){ |
| | | agencyReport.Agency_Report_Header__c = agency_report_headerMap.get(headerStr).Id; // 周报一览 |
| | |
| | | return 'success'; |
| | | }catch(Exception e){ |
| | | System.debug('exception'+e); |
| | | return 'exception'+e; |
| | | return e.getLineNumber()+'exception:'+e; |
| | | } |
| | | return 'success'; |
| | | } |