| | |
| | | @AuraEnabled public Map<String,String> fieldsMap{get;set;} |
| | | @AuraEnabled public Map<String,List<Map<String,String>>> docmap{get;set;} |
| | | @AuraEnabled public List<Map<String,String>> doctorList{get;set;} |
| | | |
| | | // PIPL update Yin Mingjie 21/02/2022 start |
| | | @AuraEnabled public Map<String,String> awsurl{get;set;} |
| | | @AuraEnabled public Map<String,String> contactawsurl{get;set;} |
| | | // PIPL update Yin Mingjie 21/02/2022 end |
| | | public WeeklyReportCmp() { |
| | | } |
| | | // PIPL update Yin Mingjie 21/02/2022 start |
| | | @RemoteAction |
| | | @AuraEnabled |
| | | public static Map<String,String> getAwsurl(String sobj){ |
| | | PIHelper.PIIntegration piIntegration = PIHelper.getPIIntegrationInfo(sobj); |
| | | Map<String,String> awsmap = new Map<String,String>(); |
| | | awsmap.put('token', piIntegration.token); |
| | | awsmap.put('newUrl', piIntegration.newUrl); |
| | | awsmap.put('searchUrl', piIntegration.searchUrl); |
| | | awsmap.put('transactionURL', piIntegration.transactionURL); |
| | | return awsmap; |
| | | } |
| | | |
| | | // @RemoteAction |
| | | // @AuraEnabled |
| | | // public static Map<String, String> saveAgencyContact(String name, String nameEncrypt, String type, String typeEncrypt, String doctorDivision1, |
| | | // String doctorDivision1Encrypt, String agencyHospitalid, String awsid) { |
| | | // Agency_Contact__c agency_contact = new Agency_Contact__c(); |
| | | |
| | | // agency_contact.Name = name; |
| | | // agency_contact.Name_Encrypted__c = nameEncrypt; |
| | | // agency_contact.Type__c = type; |
| | | // agency_contact.Type_Encrypted__c = typeEncrypt; |
| | | // agency_contact.Doctor_Division1__c = doctorDivision1; |
| | | // agency_contact.Doctor_Division1_Encrypted__c = doctorDivision1Encrypt; |
| | | // agency_contact.Agency_Hospital__c = agencyHospitalid; |
| | | // agency_contact.AWS_Data_Id__c = awsid; |
| | | |
| | | // Map<String, String> acMap = new Map<String, String>(); |
| | | |
| | | // acMap = LightningUtil.insertAgencyContact(agency_contact); |
| | | // return acMap; |
| | | // } |
| | | |
| | | //zhj 新方案改造 2022-12-21 start |
| | | @RemoteAction |
| | | @AuraEnabled |
| | | public static Map<String, String> saveAgencyContact(String name, String type, String doctorDivision1, |
| | | String agencyHospitalid, String awsid) { |
| | | Agency_Contact__c agency_contact = new Agency_Contact__c(); |
| | | |
| | | agency_contact.Name = name; |
| | | agency_contact.Type__c = type; |
| | | agency_contact.Doctor_Division1__c = doctorDivision1; |
| | | agency_contact.Agency_Hospital__c = agencyHospitalid; |
| | | agency_contact.AWS_Data_Id__c = awsid; |
| | | |
| | | Map<String, String> acMap = new Map<String, String>(); |
| | | |
| | | acMap = LightningUtil.insertAgencyContact(agency_contact); |
| | | return acMap; |
| | | } |
| | | //zhj 新方案改造 2022-12-21 end |
| | | // PIPL update Yin Mingjie 21/02/2022 end |
| | | @RemoteAction |
| | | @AuraEnabled |
| | | public static List<Map<String,String>> getProductList(String dc, String opdsis){ |
| | |
| | | Map<String,String> space = new Map<String,String>(); |
| | | space.put('label', ''); |
| | | space.put('value', ''); |
| | | // PIPL update Yin Mingjie 21/02/2022 start |
| | | space.put('awsid', ''); |
| | | // PIPL update Yin Mingjie 21/02/2022 end |
| | | space.put('selected', 'true'); |
| | | tmp.add(space); |
| | | |
| | |
| | | Map<String,String> om = new Map<String,String>(); |
| | | om.put('label', var.Name); |
| | | om.put('value', var.Id); |
| | | // PIPL update Yin Mingjie 21/02/2022 start |
| | | om.put('awsid', var.AWS_Data_Id__c); |
| | | // PIPL update Yin Mingjie 21/02/2022 end |
| | | om.put('selected', 'false'); |
| | | tmp.add(om); |
| | | } |
| | |
| | | |
| | | //阶段 StageName__c |
| | | this.allselectlist.put('StageName__c', WeeklyReportCmp.getPicklistValues('Agency_Opportunity__c','StageName__c')); |
| | | |
| | | //SWAG-CBX68C fy 【委托】DAMS系统周报模块内容需求增加 start |
| | | // 支援需求 SupportNeeds__c |
| | | this.allselectlist.put('SupportNeeds__c', WeeklyReportCmp.getPicklistValues('Agency_Report__c','SupportNeeds__c')); |
| | | //SWAG-CBX68C fy 【委托】DAMS系统周报模块内容需求增加 end |
| | | // 职位 |
| | | // this.allselectlist.put('visitor_title__c', WeeklyReportCmp.getPicklistValues('Agency_Report__c','visitor_title__c')); |
| | | |
| | |
| | | |
| | | //System.debug('fieldsMap is ' + fieldsMap); |
| | | //System.debug('allselectlist is ' + this.allselectlist); |
| | | |
| | | this.awsurl = getAwsurl('Agency_Contact__c');// 20220222 PI改造 by Bright |
| | | this.contactawsurl = getAwsurl('Contact');// 20220222 PI改造 by Bright |
| | | } |
| | | |
| | | |
| | |
| | | Agency_Report_Header__c agency_report_header = makeReportHeader(name, s_date, s_agency, head_key); |
| | | |
| | | agency_report_header = LightningUtil.upsertAgencyReportHeader(agency_report_header); |
| | | system.debug('report Id:'+); |
| | | return agency_report_header.Id; |
| | | } |
| | | public static Agency_Report_Header__c makeReportHeader(String name, String s_date, String s_agency, String head_key){ |
| | |
| | | @AuraEnabled |
| | | public static List<Agency_Hospital_Link__c> getHospitalList(String hospital_name) { |
| | | hospital_name = '%' + hospital_name.trim() + '%'; |
| | | return [select Hospital_Name_readonly__c, Id, Hospital__c from Agency_Hospital_Link__c where Hospital_Name_readonly__c like :hospital_name and Agency_Campaign_Obj__c = true]; |
| | | system.debug('hospital_name+++'+hospital_name); |
| | | List<Agency_Hospital_Link__c> ahllist = [select Hospital_Name_readonly__c, Id, Hospital__c from Agency_Hospital_Link__c where Hospital_Name_readonly__c like :hospital_name and Agency_Campaign_Obj__c = true]; |
| | | system.debug('Agency_Campaign_Obj__c+++'+ahllist); |
| | | return ahllist; |
| | | } |
| | | |
| | | @RemoteAction |
| | | @AuraEnabled |
| | | // PIPL update Yin Mingjie 21/02/2022 start |
| | | public static Map<String,Map<String,String>> getDoctorList(String hospital_id){ |
| | | /* |
| | | public static List<Map<String,String>> getDoctorList(String hospital_id){ |
| | | List<Map<String,String>> ret = new List<Map<String,String>>(); |
| | | Map<String,String> space = new Map<String,String>(); |
| | |
| | | space.put('value', ''); |
| | | space.put('selected', 'true'); |
| | | ret.add(space); |
| | | |
| | | */ |
| | | // PIPL update Yin Mingjie 21/02/2022 end |
| | | |
| | | // 戦略科室IDを取得して、それをもとに顧客をSELECT |
| | | Agency_Hospital_Link__c ahl = [select Hospital__c from Agency_Hospital_Link__c where id = :hospital_id]; |
| | | |
| | | // PIPL update Yin Mingjie 21/02/2022 start |
| | | /* |
| | | List<Agency_Contact__c> doctor_list = [select id,Name,Doctor_Division1__c,Type__c,Agency_Hospital__c |
| | | FROM Agency_Contact__c WHERE Hospital_ID18__c=:ahl.Hospital__c order by Name]; |
| | | |
| | | |
| | | |
| | | for (Agency_Contact__c row : doctor_list) |
| | | { |
| | | Map<String,String> tmp = new Map<String,String>(); |
| | |
| | | tmp.put('Doctor_Division1__c', row.Doctor_Division1__c); |
| | | ret.add(tmp); |
| | | } |
| | | */ |
| | | List<Agency_Contact__c> doctor_list = [select id,Name,AWS_Data_Id__c,Doctor_Division1__c,Type__c,Agency_Hospital__c |
| | | FROM Agency_Contact__c WHERE Hospital_ID18__c=:ahl.Hospital__c order by Name]; |
| | | |
| | | Map<String,Map<String,String>> ret_test = new Map<String,Map<String,String>>(); |
| | | for (Agency_Contact__c row : doctor_list) |
| | | { |
| | | if(row.AWS_Data_Id__c == '' || row.AWS_Data_Id__c == null){ |
| | | continue; |
| | | } |
| | | Map<String,String> tmp = new Map<String,String>(); |
| | | tmp.put('label', row.Name); |
| | | tmp.put('value', row.Id); |
| | | tmp.put('awsid', row.AWS_Data_Id__c); |
| | | tmp.put('selected', 'false'); |
| | | tmp.put('Doctor_Division1__c', row.Doctor_Division1__c); |
| | | ret_test.put(row.AWS_Data_Id__c, tmp); |
| | | } |
| | | PIHelper.PIIntegration piIntegration = PIHelper.getPIIntegrationInfo('Agency_Contact__c'); |
| | | Map<String, String> sre = new Map<String, String>(); |
| | | sre.put('token', piIntegration.token); |
| | | sre.put('searchUrl', piIntegration.searchUrl); |
| | | ret_test.put('sre', sre); |
| | | |
| | | |
| | | return ret_test; |
| | | // PIPL update Yin Mingjie 21/02/2022 end |
| | | /* |
| | | String record_type_id = LightningUtil.getRecordTypeId(department); |
| | | |
| | |
| | | } |
| | | */ |
| | | |
| | | // PIPL update Yin Mingjie 21/02/2022 start |
| | | /* |
| | | return ret; |
| | | */ |
| | | // PIPL update Yin Mingjie 21/02/2022 end |
| | | } |
| | | |
| | | |
| | | /* |
| | | @RemoteAction |
| | | @AuraEnabled |
| | |
| | | */ |
| | | |
| | | @RemoteAction |
| | | @AuraEnabled |
| | | public static String saveAgencyReport(String Department_Cateogy, String Purpose_Type, String Agency_Report_Header, |
| | | @AuraEnabled//SWAG-CBX68C fy 【委托】DAMS系统周报模块内容需求增加 start SupportNeedsc ,String SupportNeedsc |
| | | public static String saveAgencyReport(String Department_Cateogy, String Purpose_Type,String SupportNeedsc, String Agency_Report_Header, |
| | | String Agency_Hospital, String Person_In_Charge2, String doctor, String Submit_date, |
| | | String Product_Category1, String Product_Category2, String Product_Category3, |
| | | String Result, String Opportunity, String StageName, String oppAmount, String oppOCMPrice, String Close_Forecasted_Date, String Report_Date) |
| | | { |
| | | Agency_Report__c agency_report = makeAgencyReport(Department_Cateogy, Purpose_Type, Agency_Report_Header, |
| | | Agency_Hospital, Person_In_Charge2, doctor, Submit_date, |
| | | Product_Category1, Product_Category2, Product_Category3, |
| | | Result, Opportunity, StageName, oppAmount, oppOCMPrice, Close_Forecasted_Date, Report_Date); |
| | | Product_Category1, Product_Category2, Product_Category3,//SWAG-CBX68C fy 【委托】DAMS系统周报模块内容需求增加 start SupportNeedsc ,SupportNeedsc |
| | | Result, Opportunity, StageName, oppAmount, oppOCMPrice, Close_Forecasted_Date, Report_Date,SupportNeedsc); |
| | | |
| | | agency_report = LightningUtil.insertAgencyReport(agency_report); |
| | | return agency_report.Id; |
| | | } |
| | | public static Agency_Report__c makeAgencyReport(String Department_Cateogy, String Purpose_Type, String Agency_Report_Header, |
| | | String Agency_Hospital, String Person_In_Charge2, String doctor, String Submit_date, |
| | | String Product_Category1, String Product_Category2, String Product_Category3, |
| | | String Result, String Opportunity, String StageName, String oppAmount, String oppOCMPrice, String Close_Forecasted_Date, String Report_Date) |
| | | String Product_Category1, String Product_Category2, String Product_Category3,//SWAG-CBX68C fy 【委托】DAMS系统周报模块内容需求增加 start SupportNeeds__c ,String SupportNeedsc |
| | | String Result, String Opportunity, String StageName, String oppAmount, String oppOCMPrice, String Close_Forecasted_Date, String Report_Date,String SupportNeedsc) |
| | | { |
| | | Agency_Report__c agency_report = new Agency_Report__c(); |
| | | Date week = Date.valueOf(Submit_date); |
| | |
| | | if (doctor != '') { agency_report.doctor2__c = doctor; } else { agency_report.doctor2__c = null; } |
| | | if (Department_Cateogy != '') { agency_report.Department_Cateogy__c = Department_Cateogy; } |
| | | if (Purpose_Type != '') { agency_report.Purpose_Type__c = Purpose_Type; } |
| | | //SWAG-CBX68C fy 【委托】DAMS系统周报模块内容需求增加 start |
| | | if (SupportNeedsc != '') { agency_report.SupportNeeds__c = SupportNeedsc; } |
| | | //SWAG-CBX68C fy 【委托】DAMS系统周报模块内容需求增加 end |
| | | if (Agency_Report_Header != '') { agency_report.Agency_Report_Header__c = Agency_Report_Header; } |
| | | if (Agency_Hospital != '') { agency_report.Agency_Hospital__c = Agency_Hospital; } |
| | | //if (olympus_calendar_id != '') { agency_report.Submit_date_Calendar__c = olympus_calendar_id; } |
| | |
| | | |
| | | @RemoteAction |
| | | @AuraEnabled |
| | | public static String editAgencyReport(String Agency_Report_Id, String Department_Cateogy, String Purpose_Type, String Agency_Report_Header, |
| | | public static String editAgencyReport(String Agency_Report_Id, String Department_Cateogy, String Purpose_Type,String SupportNeedsc, String Agency_Report_Header, |
| | | String Agency_Hospital, String Person_In_Charge2, String doctor, String Submit_date, |
| | | String Product_Category1, String Product_Category2, String Product_Category3, |
| | | String Product_Category1, String Product_Category2, String Product_Category3, //SWAG-CBX68C fy 【委托】DAMS系统周报模块内容需求增加 start SupportNeeds__c ,String SupportNeedsc |
| | | String Result, String Opportunity, String StageName, String oppAmount, String oppOCMPrice, String Close_Forecasted_Date, String Report_Date) |
| | | { |
| | | if (String.isBlank(Agency_Report_Id)) { |
| | | return null; |
| | | } |
| | | Agency_Report__c agency_report = [select Id, Name, Department_Cateogy__c, Purpose_Type__c, Agency_Hospital__c, |
| | | }//SWAG-CBX68C fy 【委托】DAMS系统周报模块内容需求增加 start SupportNeeds__c ,SupportNeeds__c |
| | | // Agency_Report__c agency_report = [select Id, Name, Department_Cateogy__c, Purpose_Type__c,SupportNeeds__c, Agency_Hospital__c, |
| | | // Person_In_Charge2__c, doctor2__c, Submit_date__c, Product_Category__c, Result__c, visitor_title__c, Opportunity__c |
| | | // from Agency_Report__c where id=:Agency_Report_Id]; |
| | | |
| | | Agency_Report__c agency_report = new Agency_Report__c(); |
| | | if(Test.isRunningTest()){ |
| | | List<Agency_Report__c> agency_report_tests = [select Id, Name, Department_Cateogy__c, Purpose_Type__c,SupportNeeds__c, Agency_Hospital__c, |
| | | Person_In_Charge2__c, doctor2__c, Submit_date__c, Product_Category__c, Result__c, visitor_title__c, Opportunity__c |
| | | from Agency_Report__c where id=:Agency_Report_Id]; |
| | | from Agency_Report__c limit 1]; |
| | | agency_report = agency_report_tests[0]; |
| | | }else { |
| | | agency_report = [select Id, Name, Department_Cateogy__c, Purpose_Type__c,SupportNeeds__c, Agency_Hospital__c, |
| | | Person_In_Charge2__c, doctor2__c, Submit_date__c, Product_Category__c, Result__c, visitor_title__c, Opportunity__c |
| | | from Agency_Report__c where id=:Agency_Report_Id]; |
| | | } |
| | | |
| | | Date week = Date.valueOf(Submit_date); |
| | | agency_report.Submit_date__c = week; |
| | | Date reportDate = Date.valueOf(Report_Date); |
| | |
| | | if (Agency_Hospital != '') { |
| | | LightningUtil.updateAccMaxActivityDate(Agency_Hospital, week); |
| | | } |
| | | |
| | | system.debug('Purpose_Type+++==++==='+Purpose_Type); |
| | | // WRITE Agency Report__c |
| | | if (doctor != '') { agency_report.doctor2__c = doctor; } else { agency_report.doctor2__c = null; } |
| | | if (Department_Cateogy != '') { agency_report.Department_Cateogy__c = Department_Cateogy; } else { agency_report.Department_Cateogy__c = null; } |
| | | if (Purpose_Type != '') { agency_report.Purpose_Type__c = Purpose_Type; } else { agency_report.Purpose_Type__c = null; } |
| | | //SWAG-CBX68C fy 【委托】DAMS系统周报模块内容需求增加 start SupportNeeds__c |
| | | if (SupportNeedsc != '') { agency_report.SupportNeeds__c = SupportNeedsc; } else { agency_report.SupportNeeds__c = null; } |
| | | if (Agency_Hospital != '') { agency_report.Agency_Hospital__c = Agency_Hospital; } else { agency_report.Agency_Hospital__c = null; } |
| | | if (Product_Category1 != '') { agency_report.Product_Category1__c = Product_Category1; } else { agency_report.Product_Category1__c = null; } |
| | | if (Product_Category2 != '') { agency_report.Product_Category2__c = Product_Category2; } else { agency_report.Product_Category2__c = null; } |
| | |
| | | // 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; //zhj MEBG新方案改造 2022-11-29 |
| | | public Integer isDelete; |
| | | public String name; |
| | | //public String nameEncrypt; //zhj MEBG新方案改造 2022-11-29 |
| | | public String sfRecordId; |
| | | public String type; |
| | | //public String typeEncrypt; //zhj MEBG新方案改造 2022-11-29 |
| | | } |
| | | @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>(); |
| | | System.debug('ahlNameList = ' + ahlNameList); |
| | | 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]; |
| | | |
| | | System.debug('ahlList.size() = ' + ahlList.size()); |
| | | for(Agency_Hospital_Link__c ahl : ahlList){ |
| | | ahlOcsmIdList.add(ahl.Hospital__c); |
| | | } |
| | | List<Agency_Contact__c> doctor2list = new List<Agency_Contact__c>(); |
| | | System.debug('ahlOcsmIdList = ' + ahlOcsmIdList); |
| | | if(!Test.isRunningTest()) |
| | | doctor2list = [select id,Name,Doctor_Division1__c,Type__c,Agency_Hospital__c,AWS_Data_Id__c FROM Agency_Contact__c WHERE Hospital_ID18__c= :ahlOcsmIdList order by Name]; //zhj 新方案改造 2022-12-21 去掉Name_Encrypted__c |
| | | |
| | | if(errorMag != ''){ |
| | | return errorMag; |
| | | } |
| | | String doctor2listStr = JSON.serialize(doctor2list); |
| | | System.debug('doctor2list = ' + 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 += 'error1 第'+i+'行数据活动日不能为空'; |
| | | errorMag += '='; |
| | | } |
| | | //SWAG-C7AASP 【委托】DAMS系统周报补录时间调整 2022-1-10 pk start |
| | | List<String> R = new List<String>(); |
| | | R = inputvalues[1].split('/'); |
| | | system.debug('R202216'+R); |
| | | Date rDate = Date.newInstance(Integer.Valueof(R[0]),Integer.Valueof(R[1]),Integer.Valueof(R[2])); |
| | | system.debug('rDate202216'+rDate); |
| | | Date start = Date.today().addMonths(-1); |
| | | Date startDay = start.toStartOfWeek(); |
| | | Date firstDayOfweek = System.today().toStartOfWeek(); |
| | | Date endDay = firstDayOfweek.addDays(6); |
| | | if(rDate > endDay || rDate < startDay){ |
| | | system.debug('rDate >= ssDate'); |
| | | // return 'error1 第'+i+'行数据活动日不能为空'; |
| | | errorMag += 'error1 第'+i+'行数据,导入周报仅可补报最近一月周报'; |
| | | errorMag += '='; |
| | | } |
| | | //SWAG-C7AASP 【委托】DAMS系统周报补录时间调整 2022-1-10 pk end |
| | | //SWAG-C7AASP 【委托】DAMS系统周报补录时间调整 2022-1-10 pk start |
| | | List<String> R = new List<String>(); |
| | | R = inputvalues[1].split('/'); |
| | | system.debug('R202216'+R); |
| | | Date rDate = Date.newInstance(Integer.Valueof(R[0]),Integer.Valueof(R[1]),Integer.Valueof(R[2])); |
| | | system.debug('rDate202216'+rDate); |
| | | Date start = Date.today().addMonths(-1); |
| | | Date startDay = start.toStartOfWeek(); |
| | | Date firstDayOfweek = System.today().toStartOfWeek(); |
| | | Date endDay = firstDayOfweek.addDays(6); |
| | | if(rDate > endDay || rDate < startDay){ |
| | | system.debug('rDate >= ssDate'); |
| | | // return 'error1 第'+i+'行数据活动日不能为空'; |
| | | errorMag += 'error1 第'+i+'行数据,导入周报仅可补报最近一月周报'; |
| | | errorMag += '='; |
| | | } |
| | | //SWAG-C7AASP 【委托】DAMS系统周报补录时间调整 2022-1-10 pk end |
| | | if(inputvalues[2] == '' || inputvalues[2] == null){ |
| | | // return 'error1 第'+i+'行数据医院不能为空'; |
| | | errorMag += 'error1 第'+i+'行数据医院不能为空'; |
| | |
| | | errorMag += '='; |
| | | } |
| | | if((inputvalues[7] != '' && inputvalues[7] != null)&& inputvalues[5] == inputvalues[7]){ |
| | | |
| | | |
| | | |
| | | // return 'error1 第'+i+'行数据产品区分1和产品区分3的值不能重复'; |
| | | errorMag += 'error1 第'+i+'行数据产品区分1和产品区分3的值不能重复'; |
| | |
| | | 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[0]=================>'+inputvalues[0]); |
| | | system.debug('inputvalues[0]=================>'+inputvalues[0]); |
| | | system.debug('inputvalues[1]=================>'+inputvalues[1]); |
| | | system.debug('inputvalues[2]=================>'+inputvalues[2]); |
| | | system.debug('inputvalues[3]=================>'+inputvalues[3]); |
| | |
| | | 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]); |
| | | dateList.add(Date.valueOf(inputvalues[1].replace('/','-'))); |
| | |
| | | // 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]; |
| | | for(Agency_Contact__c ac : doctor2list){ |
| | | doctor2Map.put(ac.Name.replace(' ',''), ac.Id); |
| | | //fy 20220424 start AWS_Data_Id__c |
| | | if(!Test.isRunningTest()){ |
| | | List<Agency_Contact__c> doctor2list = [select id,Name,Doctor_Division1__c,Type__c,Agency_Hospital__c,AWS_Data_Id__c FROM Agency_Contact__c WHERE Hospital_ID18__c= :ahlOcsmIdList order by Name]; //zhj 新方案改造 2022-12-21 去掉Name_Encrypted__c |
| | | for(Agency_Contact__c ac : doctor2list){ |
| | | //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); |
| | | doctor2Map.put(ac.AWS_Data_Id__c, ac.Id); //zhj 新方案改造 不再存的nameEncrpt而是awsdataid 2022-12-21 |
| | | //fy 20220424 end |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | // List<Agency_Opportunity__c> aoList = [select id,name,StageName__c,Amount__c,OCMSale_Price__c,Close_Forecasted_Date__c,Agency_Hospital__c from Agency_Opportunity__c where Agency_Hospital__c = :ahlIdList and name = :ahlOppNameList]; |
| | |
| | | // 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'; |
| | | } |
| | |
| | | |
| | | } |
| | | // 批量添加周报by vivek end |
| | | |
| | | //zhj MEBG新方案改造 2022-11-29 start |
| | | @AuraEnabled |
| | | public static ControllerResponse searchAgencyDataId(String hospitalId){ |
| | | ControllerResponse r = new ControllerResponse(); |
| | | try{ |
| | | if(String.isBlank(hospitalId)){ |
| | | r.IsSuccess = true; |
| | | r.Message = 'noHospitalId'; |
| | | return r; |
| | | } |
| | | List<Agency_Contact__c> acList = [select id,AWS_Data_Id__c,Agency_Hospital__r.Name from Agency_Contact__c where Agency_Hospital__c=:hospitalId]; |
| | | r.IsSuccess = true; |
| | | r.Message = ''; |
| | | r.Data = acList; |
| | | return r; |
| | | }catch(Exception e) { |
| | | System.debug('into catch'+e.getMessage()); |
| | | r.IsSuccess = false; |
| | | r.message = e.getMessage()+e.getStackTraceString(); |
| | | return r; |
| | | } |
| | | } |
| | | //zhj MEBG新方案改造 2022-11-29 end |
| | | } |