From 01f207d979d6be17c8cdec293feab48828c0ec3e Mon Sep 17 00:00:00 2001
From: 黄千龙 <huangqianlong@prec-tech.com>
Date: 星期五, 08 四月 2022 14:22:52 +0800
Subject: [PATCH] Merge branch 'master' of http://47.92.229.245:8089/r/OlyMEBG

---
 force-app/main/default/classes/WeeklyReportCmp.cls |  161 ++++++++++++++++++++++++++++++++++++++++++-----------
 1 files changed, 126 insertions(+), 35 deletions(-)

diff --git a/force-app/main/default/classes/WeeklyReportCmp.cls b/force-app/main/default/classes/WeeklyReportCmp.cls
index 22e2175..9ffb987 100644
--- a/force-app/main/default/classes/WeeklyReportCmp.cls
+++ b/force-app/main/default/classes/WeeklyReportCmp.cls
@@ -4,10 +4,46 @@
     @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){
@@ -43,6 +79,9 @@
         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);
         
@@ -52,6 +91,9 @@
             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);
         }
@@ -86,7 +128,10 @@
 
         //闃舵 StageName__c
         this.allselectlist.put('StageName__c', WeeklyReportCmp.getPicklistValues('Agency_Opportunity__c','StageName__c'));
-
+        //SWAG-CBX68C fy 銆愬鎵樸�慏AMS绯荤粺鍛ㄦ姤妯″潡鍐呭闇�姹傚鍔� start
+        // 鏀彺闇�姹� SupportNeeds__c
+        // this.allselectlist.put('SupportNeeds__c', WeeklyReportCmp.getPicklistValues('Agency_Report__c','SupportNeeds__c'));
+        //SWAG-CBX68C fy 銆愬鎵樸�慏AMS绯荤粺鍛ㄦ姤妯″潡鍐呭闇�姹傚鍔� end
         // 鑱屼綅
 //        this.allselectlist.put('visitor_title__c', WeeklyReportCmp.getPicklistValues('Agency_Report__c','visitor_title__c'));
 
@@ -109,6 +154,9 @@
         
         //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
     }
     
     
@@ -210,11 +258,17 @@
     @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>();
@@ -222,14 +276,18 @@
         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>();
@@ -239,8 +297,32 @@
             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);
 
@@ -257,9 +339,13 @@
         }
         */
 
+        // PIPL update Yin Mingjie 21/02/2022 start
+        /*
         return ret;
+        */
+        // PIPL update Yin Mingjie 21/02/2022 end
     }
-
+    
     /*
     @RemoteAction
     @AuraEnabled
@@ -287,7 +373,7 @@
     */
 
     @RemoteAction
-    @AuraEnabled
+    @AuraEnabled//SWAG-CBX68C fy 銆愬鎵樸�慏AMS绯荤粺鍛ㄦ姤妯″潡鍐呭闇�姹傚鍔� 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,
@@ -295,7 +381,7 @@
     {
         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 銆愬鎵樸�慏AMS绯荤粺鍛ㄦ姤妯″潡鍐呭闇�姹傚鍔� start SupportNeedsc   ,SupportNeedsc
             Result, Opportunity, StageName, oppAmount, oppOCMPrice, Close_Forecasted_Date, Report_Date);
 
         agency_report = LightningUtil.insertAgencyReport(agency_report);
@@ -303,7 +389,7 @@
     }
     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 銆愬鎵樸�慏AMS绯荤粺鍛ㄦ姤妯″潡鍐呭闇�姹傚鍔� 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();
@@ -333,6 +419,9 @@
         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 銆愬鎵樸�慏AMS绯荤粺鍛ㄦ姤妯″潡鍐呭闇�姹傚鍔� start
+        // if (SupportNeedsc != '') { agency_report.SupportNeeds__c = SupportNeedsc; }
+        //SWAG-CBX68C fy 銆愬鎵樸�慏AMS绯荤粺鍛ㄦ姤妯″潡鍐呭闇�姹傚鍔� 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; }
@@ -371,12 +460,12 @@
     @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 銆愬鎵樸�慏AMS绯荤粺鍛ㄦ姤妯″潡鍐呭闇�姹傚鍔� 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 銆愬鎵樸�慏AMS绯荤粺鍛ㄦ姤妯″潡鍐呭闇�姹傚鍔� 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];
@@ -397,11 +486,13 @@
         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 銆愬鎵樸�慏AMS绯荤粺鍛ㄦ姤妯″潡鍐呭闇�姹傚鍔� 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; }
@@ -508,10 +599,10 @@
        System.debug('sobjectName:::'+sobjectName);
        System.debug('fields:::'+fields);
        String errorMag = '';
-       
+
        // 鍒涘缓鍛ㄦ姤
        try{
-          
+
             if(fileData!=null){ 
                 String[] fileLines = new String[]{};
                 fileLines = fileData.split('\n');
@@ -546,23 +637,23 @@
                             errorMag += 'error1 绗�'+i+'琛屾暟鎹椿鍔ㄦ棩涓嶈兘涓虹┖';
                             errorMag += '=';
                         }
-                        //SWAG-C7AASP 銆愬鎵樸�慏AMS绯荤粺鍛ㄦ姤琛ュ綍鏃堕棿璋冩暣  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 銆愬鎵樸�慏AMS绯荤粺鍛ㄦ姤琛ュ綍鏃堕棿璋冩暣  2022-1-10 pk end
+                         //SWAG-C7AASP 銆愬鎵樸�慏AMS绯荤粺鍛ㄦ姤琛ュ綍鏃堕棿璋冩暣  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 銆愬鎵樸�慏AMS绯荤粺鍛ㄦ姤琛ュ綍鏃堕棿璋冩暣  2022-1-10 pk end
                         if(inputvalues[2] == '' || inputvalues[2] == null){
                             // return 'error1 绗�'+i+'琛屾暟鎹尰闄笉鑳戒负绌�';
                             errorMag += 'error1 绗�'+i+'琛屾暟鎹尰闄笉鑳戒负绌�';
@@ -595,7 +686,7 @@
                             errorMag += '=';
                         }
                         if((inputvalues[7] != '' && inputvalues[7] != null)&& inputvalues[5] == inputvalues[7]){
-                           
+
 
                             // return 'error1 绗�'+i+'琛屾暟鎹骇鍝佸尯鍒�1鍜屼骇鍝佸尯鍒�3鐨勫�间笉鑳介噸澶�';
                             errorMag += 'error1 绗�'+i+'琛屾暟鎹骇鍝佸尯鍒�1鍜屼骇鍝佸尯鍒�3鐨勫�间笉鑳介噸澶�';
@@ -634,7 +725,7 @@
                             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]);
@@ -644,7 +735,7 @@
                         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('/','-')));

--
Gitblit v1.9.1