| | |
| | | @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; |
| | | } |
| | | // 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 |
| | | } |
| | | |
| | | |
| | |
| | | @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 |
| | | @AuraEnabled//SWAG-CBX68C fy 【委托】DAMS系统周报模块内容需求增加 start SupportNeedsc ,String SupportNeedsc |
| | | public static String saveAgencyReport(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, |
| | |
| | | { |
| | | 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, |
| | | Product_Category1, Product_Category2, Product_Category3,//SWAG-CBX68C fy 【委托】DAMS系统周报模块内容需求增加 start SupportNeedsc ,SupportNeedsc |
| | | Result, Opportunity, StageName, oppAmount, oppOCMPrice, Close_Forecasted_Date, Report_Date); |
| | | |
| | | agency_report = LightningUtil.insertAgencyReport(agency_report); |
| | |
| | | } |
| | | 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 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) |
| | | { |
| | | Agency_Report__c agency_report = new 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; } |
| | | 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; } |
| | |
| | | @AuraEnabled |
| | | public static String editAgencyReport(String Agency_Report_Id, 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 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; |
| | | } |
| | | }//SWAG-CBX68C fy 【委托】DAMS系统周报模块内容需求增加 start SupportNeeds__c ,SupportNeeds__c |
| | | Agency_Report__c agency_report = [select Id, Name, Department_Cateogy__c, Purpose_Type__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]; |
| | |
| | | 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; } |
| | |
| | | System.debug('sobjectName:::'+sobjectName); |
| | | System.debug('fields:::'+fields); |
| | | String errorMag = ''; |
| | | |
| | | // 创建周报 |
| | | try{ |
| | | |
| | | if(fileData!=null){ |
| | | String[] fileLines = new String[]{}; |
| | | fileLines = fileData.split('\n'); |
| | |
| | | // 经销商询价名称list |
| | | // List<String> ahlOppNameList = new List<String>(); |
| | | //for content |
| | | system.debug('fileLines.size()==============>'+fileLines.size()); |
| | | for (Integer i=1,j=fileLines.size();i<j;i++){ |
| | | system.debug('for2022161329'); |
| | | List<String> inputvalues = new List<String>(); |
| | | inputvalues = fileLines[i].split(','); |
| | | if(inputvalues != null){ |
| | | system.debug('if2022161333'); |
| | | if(inputvalues[0] == '' || inputvalues[0] == null){ |
| | | // return 'error1 第'+i+'行数据担当不能为空'; |
| | | errorMag += 'error1 第'+i+'行数据担当不能为空'; |
| | |
| | | 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 |
| | | 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 += '='; |
| | |
| | | errorMag += 'error3 第'+i+'行数据结果选项列表的值'+inputvalues[9]+'不存在'; |
| | | errorMag += '='; |
| | | } |
| | | // String ePurposeType = GetEPurposeType(inputvalues[8]); |
| | | 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[4]=================>'+inputvalues[4]); |
| | | system.debug('inputvalues[5]=================>'+inputvalues[5]); |
| | | system.debug('inputvalues[6]=================>'+inputvalues[6]); |
| | | system.debug('inputvalues[7]=================>'+inputvalues[7]); |
| | | system.debug('inputvalues[8]=================>'+inputvalues[8]); |
| | | system.debug('inputvalues[9]=================>'+inputvalues[9]); |
| | | |
| | | |
| | | nameList.add(inputvalues[0]); |
| | | dateList.add(Date.valueOf(inputvalues[1].replace('/','-'))); |
| | | ahlNameList.add(inputvalues[2]); |
| | |
| | | inputList.add(inputvalues); |
| | | } |
| | | } |
| | | system.debug('snduksbdnjsvbdskjv'); |
| | | // 担当名称匹配的map |
| | | Map<String,String> nameIdMap = new Map<String,String>(); |
| | | Map<String,String> nameConMap = new Map<String,String>(); |
| | |
| | | dateMap.put(olym.Date__c, olym.FirstDayOfWeek__c); |
| | | } |
| | | } |
| | | System.debug('dateMap===='+dateMap); |
| | | System.debug('x'+dateMap); |
| | | List<OlympusCalendar__c> olympusIdList = [select Id,Date__c,FirstDayOfWeek__c from OlympusCalendar__c where Date__c= :dateMap.values()]; |
| | | for(OlympusCalendar__c olym : olympusIdList){ |
| | | dateIdMap.put(olym.FirstDayOfWeek__c, olym.id); |
| | |
| | | ahlMap.get(lineList[2]).MaxActivityDate__c = week; |
| | | }else{ |
| | | if(lineList[2] != '' && lineList[2] != null){ |
| | | |
| | | // return 'error2 第'+hang+'行数据经销商医院'+lineList[2]+'不存在'; |
| | | errorMag += 'error2 第'+hang+'行数据经销商医院'+lineList[2]+'不存在'; |
| | | errorMag += '='; |
| | |
| | | return false; |
| | | } |
| | | public static boolean getResultlist(String resultlist){ |
| | | system.debug('resultlist===============>'+resultlist); |
| | | Schema.DescribeFieldResult fieldResult = Agency_Report__c.Result__c.getDescribe(); |
| | | List<Schema.PicklistEntry> ple = fieldResult.getPicklistValues(); |
| | | for( Schema.PicklistEntry pickListVal : ple){ |
| | | System.debug('weixiao'+resultlist+''+pickListVal.getValue()); |
| | | if(pickListVal.getValue()+'\r' == resultlist){ |
| | | System.debug('weixiao'+resultlist.trim()+'111111'+pickListVal.getValue()+'222222'); |
| | | string temp = string.ValueOf(pickListVal.getValue()); |
| | | if(temp.equals(resultlist.trim())){ |
| | | // if(pickListVal.getValue().equals(resultlist)){ |
| | | System.debug('weixiaoweixiao'+resultlist+''+pickListVal.getValue()); |
| | | return false; |
| | | } |
| | |
| | | |
| | | // 判断产品区分是否满足要求 |
| | | public static String ifTrueProduct(List<Map<String,String>> prolist,String str){ |
| | | system.debug('=ifTrueProduct==============ifTrueProduct========='+str); |
| | | system.debug('=prolist==============prolist========='+prolist); |
| | | |
| | | for(Map<String,String> strmap :prolist){ |
| | | System.debug('---===---===---==='+str+'==='+strmap.get('label')); |
| | | if(strmap.get('label')==str){ |