From c961a1a85fdf279ae6ae31af51e66847ae514a0a Mon Sep 17 00:00:00 2001 From: Li Jun <buli@deloitte.com.cn> Date: 星期一, 14 三月 2022 16:40:08 +0800 Subject: [PATCH] PIPL Function Update 20220314 --- force-app/main/default/classes/NFM503InfoFileBatch.cls | 28 +++++++++---- force-app/main/default/pages/NewAndEditContact.page | 4 +- force-app/main/default/classes/CM_SearchContactServiceController.cls | 3 + force-app/main/default/classes/SearchVisitorController.cls | 6 ++- force-app/main/default/classes/PIHelper.cls | 8 +++ force-app/main/default/pages/NewAndEditInquiryForm.page | 4 + force-app/main/default/pages/ViewAddressDecryptInfo.page | 2 force-app/main/default/classes/ContactTriggerHandler.cls | 6 ++- force-app/main/default/pages/StraightBackAddress.page | 8 ++- force-app/main/default/pages/NewAndEditCase.page | 1 force-app/main/default/pages/SearchVisitor.page | 1 11 files changed, 49 insertions(+), 22 deletions(-) diff --git a/force-app/main/default/classes/CM_SearchContactServiceController.cls b/force-app/main/default/classes/CM_SearchContactServiceController.cls index 405631b..b50def8 100644 --- a/force-app/main/default/classes/CM_SearchContactServiceController.cls +++ b/force-app/main/default/classes/CM_SearchContactServiceController.cls @@ -22,8 +22,9 @@ //1. Query Contact by accountId List<Contact> conList = new List<Contact>(); system.debug('Account Id from Front-end:'+accountId); + PIHelper.PIIntegration contactPIIntegration = PIHelper.getPIIntegrationInfo('Contact'); if(String.isNotBlank(accountId) && String.isNotEmpty(accountId)){ - conList = new List<Contact>([select Id,AWS_Data_Id__c from Contact where AccountId=:accountId and AWS_Data_Id__c!='' limit 500]); + conList = new List<Contact>([select Id,AWS_Data_Id__c from Contact where AccountId=:accountId and AWS_Data_Id__c!='' limit :contactPIIntegration.maxQueryNumber]); } //2. Prepare the Contact Info Map<String,Contact> awsIdToContactMap = new Map<String,Contact>(); diff --git a/force-app/main/default/classes/ContactTriggerHandler.cls b/force-app/main/default/classes/ContactTriggerHandler.cls index bc9b7b3..d5d7095 100644 --- a/force-app/main/default/classes/ContactTriggerHandler.cls +++ b/force-app/main/default/classes/ContactTriggerHandler.cls @@ -284,7 +284,8 @@ } // 鏂板鑱旂郴浜烘椂锛� if (accountIdSet.size() > 0) { - List<Contact> contactList = [SELECT Id,AccountId,FullName__c,LastName,FirstName,Account.Name,CManageCode__c,IsFromSPO__c + List<Contact> contactList = [SELECT Id,AccountId,FullName__c,LastName,FirstName,Account.Name,CManageCode__c,IsFromSPO__c, + LastName_Encrypted__c// 20220314 PI鏀归�� by Bright FROM Contact WHERE IsFromSPO__c = false AND AccountId IN:accountIdSet]; if ( contactList.size() > 0) { @@ -293,6 +294,7 @@ String lastNameStr = String.isNotBlank(contact.LastName) ? contact.LastName:''; String firstNameStr = String.isNotBlank(contact.FirstName) ? contact.FirstName:''; String contactFullName = lastNameStr + firstNameStr; + contactFullName = contact.LastName_Encrypted__c;// 20220314 PI鏀归�� by Bright String accountId = String.valueOf(contact.AccountId).SubString(0,15); Map<String,Contact> contactFullNameMap = new Map<String,Contact>(); if (accountContactMap.containsKey(accountId)) { @@ -315,7 +317,7 @@ String lastNameStr = String.isNotBlank(contactnew.LastName) ? contactnew.LastName:''; String firstNameStr = String.isNotBlank(contactnew.FirstName) ? contactnew.FirstName:''; String contactFullName = lastNameStr + firstNameStr; - + contactFullName = contactnew.LastName_Encrypted__c;// 20220314 PI鏀归�� by Bright if (contactFullNameMap.containsKey(contactFullName)) { String accountName = contactFullNameMap.get(contactFullName).Account.Name; String cManageCode = contactFullNameMap.get(contactFullName).CManageCode__c; diff --git a/force-app/main/default/classes/NFM503InfoFileBatch.cls b/force-app/main/default/classes/NFM503InfoFileBatch.cls index d9199c8..4703d3f 100644 --- a/force-app/main/default/classes/NFM503InfoFileBatch.cls +++ b/force-app/main/default/classes/NFM503InfoFileBatch.cls @@ -5,6 +5,8 @@ public static String transUrl; public static String transId; public static String token; + public static integer isSuccess=0; + public static List<String> sfRecordIds; //add staic sushanhu 20220302 end Boolean IsNeedExecute = false; //2021-06-28 mzy WLIG-BYHD79 SFDC鐜batch鍚堝苟璋冩煡 鏄惁绗﹀悎鎵ц鏉′欢 //add nfm 503 aws response start sushanhu 20220301 @@ -28,8 +30,8 @@ global Database.QueryLocator start(Database.BatchableContext bc) { String query = 'select Id, Tender_information__c, infoAddress__c, ' + - 'Tender_information__r.InfoType__c, isProcessed__c, ' + - ' ErrorMessage__c from bidInfoFile__c where isProcessed__c = false '; + 'Tender_information__r.InfoType__c, isProcessed__c, ' + + ' ErrorMessage__c from bidInfoFile__c where isProcessed__c = false '; if (String.isNotBlank(TenId)) { query += 'and Tender_information__r.Id =: TenId'; } @@ -95,7 +97,6 @@ transUrl =pi.searchUrl; NFMUtil.response response = NFMUtil.getAWSQLMData(pi.newUrl ,JSON.serialize(queryfileList), token); system.debug('aws result'+response.responseBody); - Map<String, Object> result = (Map<String, Object>)JSON.deserializeUntyped(response.responseBody); system.debug('NFM503 aws result--'+response.responseBody+'status'+response.status); transId =(String)result.get('txId'); @@ -191,14 +192,16 @@ update bidInfoFileList; // add 纭浜嬪姟 sushanhu 20220302 start - List<String> sfRecordIds = new List<String>(); + isSuccess =1; + if (fileList.size() > 0 ) { for (FileAddress__c fileAddress : fileList) { sfRecordIds.add(fileAddress.Id); system.debug('fileAddress.Id---'+fileAddress.Id); } + } system.debug('鎴愬姛鐨則oken'+token); - PIHelper.confirmFileTrans('NFM503',1,JSON.serialize(sfRecordIds),transId,token,transUrl); + // PIHelper.confirmFileTrans('NFM503',1,JSON.serialize(sfRecordIds),transId,token,transUrl); // if (!confirm) { // //鍥炴粴 @@ -215,9 +218,9 @@ if (sp != null) { Database.rollback(sp); } - //add 纭浜嬪姟 20220302 sushanhu start - system.debug('澶辫触鐨則oken'+token); - PIHelper.confirmFileTrans('NFM503',0,'',transId,token,transUrl); + // //add 纭浜嬪姟 20220302 sushanhu start + // system.debug('澶辫触鐨則oken'+token); + // PIHelper.confirmFileTrans('NFM503',0,'',transId,token,transUrl); //add 纭浜嬪姟 20220302 sushanhu end bidInfoFile.ErrorMessage__c = '503鎶涘嚭寮傚父锛�' + ex.getMessage() + '\n' + ex.getStackTraceString(); system.debug('ErrorMessage'+bidInfoFile.ErrorMessage__c); @@ -226,6 +229,13 @@ } global void finish(Database.BatchableContext BC) { - + // add confirm transaction for pipl sushanhu 20220314 start + if (sfRecordIds==null) { + PIHelper.confirmFileTrans('NFM503',0,'',transId,token,transUrl); + }else { + PIHelper.confirmFileTrans('NFM503',isSuccess,JSON.serialize(sfRecordIds),transId,token,transUrl); + } + + // add confirm transaction for pipl sushanhu 20220314 end } } \ No newline at end of file diff --git a/force-app/main/default/classes/PIHelper.cls b/force-app/main/default/classes/PIHelper.cls index a1217ab..768cb35 100644 --- a/force-app/main/default/classes/PIHelper.cls +++ b/force-app/main/default/classes/PIHelper.cls @@ -8,6 +8,7 @@ * * */ global without sharing class PIHelper { + public static Set<String> displayByOrderNumberObject = new set<String>{'Report__c'}; public static String getObjectKeyPrefix(String objName){ try{ schema.sObjectType sObjType = Schema.getGlobalDescribe().get(objName); @@ -119,7 +120,7 @@ System.debug('config = ' + config); //鑾峰彇appid鍜宎ppsecret - AWS_Integration_Info__mdt awsConfiguration = [SELECT App_Id__c,Token_URL__c,App_Secret__c,Host_URL__c FROM AWS_Integration_Info__mdt WHERE DeveloperName = 'AWS_Default_Configuration']; + AWS_Integration_Info__mdt awsConfiguration = [SELECT App_Id__c,Max_Query_Number__c,Token_URL__c,App_Secret__c,Host_URL__c FROM AWS_Integration_Info__mdt WHERE DeveloperName = 'AWS_Default_Configuration']; if (awsConfiguration == null) { System.debug('AWS_Integration_Info__mdt娌¢厤缃�'); return null; @@ -157,6 +158,9 @@ //鑾峰彇鏁忔劅瀛楁 piIntegration.PIDetails = [select id,PI_Policy_Configuration__r.Full_New_URL__c, Enable_Encrypt__c, SF_Field_API_Name__c,SF_Field_Encrypted_API__c, AWS_Field_API__c,AWS_Encrypted_Field_API__c,Field_Type__c from PI_Field_Policy_Detail__c where PI_Policy_Configuration_Name__c =:sobjectType and Enable_Encrypt__c=true]; + if(displayByOrderNumberObject.contains(sobjectType)){ + piIntegration.PIDetails = [select id,PI_Policy_Configuration__r.Full_New_URL__c, Enable_Encrypt__c, SF_Field_API_Name__c,SF_Field_Encrypted_API__c, AWS_Field_API__c,AWS_Encrypted_Field_API__c,Field_Type__c from PI_Field_Policy_Detail__c where PI_Policy_Configuration_Name__c =:sobjectType and Enable_Encrypt__c=true order by Order_Number__c]; + } List<String> vLookUpFields = new List<String>(); List<String> PIFields = new List<String>(); for (PI_Field_Policy_Detail__c PIDetail : piIntegration.PIDetails) { @@ -170,6 +174,7 @@ System.debug('PIFields = ' + PIFields.toString()); //濉厖鏁版嵁 + piIntegration.maxQueryNumber = Integer.valueof(awsConfiguration.Max_Query_Number__c); piIntegration.newUrl = config.Full_New_URL__c; piIntegration.updateUrl = config.Full_Update_URL__c; piIntegration.queryUrl = config.Full_Read_URL__c; @@ -189,6 +194,7 @@ return piIntegration; } global class PIIntegration{ + public Integer maxQueryNumber{set;get;} public String sobjectPrefix{set;get;} public String searchUrl{set;get;} public String newUrl{set;get;} diff --git a/force-app/main/default/classes/SearchVisitorController.cls b/force-app/main/default/classes/SearchVisitorController.cls index 2a48b1b..eeadfef 100644 --- a/force-app/main/default/classes/SearchVisitorController.cls +++ b/force-app/main/default/classes/SearchVisitorController.cls @@ -176,16 +176,18 @@ List<Contact> conList = new List<Contact>(); system.debug('Account Id from Front-end:'+a.Id); String accountId = a.Id; + PIHelper.PIIntegration contactPIIntegration = PIHelper.getPIIntegrationInfo('Contact'); if(String.isNotBlank(accountId) && String.isNotEmpty(accountId)){ - conList = new List<Contact>([select Id,AWS_Data_Id__c from Contact where AccountId=:accountId and AWS_Data_Id__c!='']); + conList = new List<Contact>([select Id,AWS_Data_Id__c from Contact where AccountId=:accountId and AWS_Data_Id__c!='' limit :contactPIIntegration.maxQueryNumber]); } //2. Prepare the Contact Info List<String> conAWSIds = new List<String>(); + system.debug('Contact Size:'+conList.size()); for(Contact con:conList){ conAWSIds.add(con.AWS_Data_Id__c); } contactAWSIds = JSON.serialize(conAWSIds); - staticResource = JSON.serialize(PIHelper.getPIIntegrationInfo('Contact')); + staticResource = JSON.serialize(contactPIIntegration); //Add By Li Jun for PIPL 20220217 End } //Add by Li Jun for PIPL 202202117 Start diff --git a/force-app/main/default/pages/NewAndEditCase.page b/force-app/main/default/pages/NewAndEditCase.page index 092954e..8dd8253 100644 --- a/force-app/main/default/pages/NewAndEditCase.page +++ b/force-app/main/default/pages/NewAndEditCase.page @@ -2,6 +2,7 @@ <apex:includeScript value="{! URLFOR($Resource.AWSService, 'AWSService.js') }" /> <apex:includeScript value="{!URLFOR($Resource.jquery183minjs)}"/> <apex:includeScript value="{!URLFOR($Resource.PleaseWaitDialog)}"/> + <apex:stylesheet value="{!URLFOR($Resource.blockUIcss)}"/> <script src="../../soap/ajax/53.0/connection.js" type="text/javascript"></script> <style> .disabledbutton { diff --git a/force-app/main/default/pages/NewAndEditContact.page b/force-app/main/default/pages/NewAndEditContact.page index 0a78a75..ef36178 100644 --- a/force-app/main/default/pages/NewAndEditContact.page +++ b/force-app/main/default/pages/NewAndEditContact.page @@ -195,12 +195,12 @@ let textPhone = "[data-id='Phone']"; //Email let email = document.querySelector(textEmail); - if(email && !/^[\w-]{3,12}@[\da-zA-Z]{2,16}\.[a-zA-Z]+$/.test(email.value)){ + if(email && email.previousSibling && email.previousSibling.className.indexOf('requiredBlock')>-1 && !/^[\w-]{3,12}@[\da-zA-Z]{2,16}\.[a-zA-Z]+$/.test(email.value)){ error_msg += ';閭欢鏍煎紡閿欒'; } let phone = document.querySelector(textPhone); - if(phone && !/^1[3|5|8|7][0-9]\d{4,8}$/.test(phone.value)){ + if(phone && phone.previousSibling && phone.previousSibling.className.indexOf('requiredBlock')>-1 && !/^1[3|5|8|7][0-9]\d{4,8}$/.test(phone.value)){ error_msg += ';鐢佃瘽鍙风爜閿欒'; } diff --git a/force-app/main/default/pages/NewAndEditInquiryForm.page b/force-app/main/default/pages/NewAndEditInquiryForm.page index ddf818a..be37f91 100644 --- a/force-app/main/default/pages/NewAndEditInquiryForm.page +++ b/force-app/main/default/pages/NewAndEditInquiryForm.page @@ -228,7 +228,9 @@ let multiple = field_api_name; let targets = ""; //InquiryForm鐗规畩澶勭悊 - if(multiple == "Product1__c" || multiple == "Request1__c"){ + if(multiple == "Product1__c"){ + targets = GetEleByClass(config.ApiPrefix+'_'+field_api_name).parentNode.children[1].rows[1].cells[2].innerText; + }else if(multiple == "Request1__c"){ targets = GetEleByClass(config.ApiPrefix+'_'+field_api_name).parentNode.children[2].rows[1].cells[2].innerText; }else{ targets = GetEleByClass(config.ApiPrefix+'_'+field_api_name).parentNode.children[1].children[0].children[1].children[2].children[0].innerText; diff --git a/force-app/main/default/pages/SearchVisitor.page b/force-app/main/default/pages/SearchVisitor.page index 4798584..09049f0 100644 --- a/force-app/main/default/pages/SearchVisitor.page +++ b/force-app/main/default/pages/SearchVisitor.page @@ -191,6 +191,7 @@ createDiv.style.background = "#dddddd"; createDiv.style.position = "absolute"; parentNode.appendChild(createDiv); + parentNode.style.position = "relative"; } } diff --git a/force-app/main/default/pages/StraightBackAddress.page b/force-app/main/default/pages/StraightBackAddress.page index 89b7177..e62de6b 100644 --- a/force-app/main/default/pages/StraightBackAddress.page +++ b/force-app/main/default/pages/StraightBackAddress.page @@ -355,7 +355,7 @@ PIData[Id] = temp; }; for(var i=0;i<tableDataStr.length;i++){ - if(tableDataStr[i].address.Contacts__r){ + if(tableDataStr[i].address.AWS_Data_Id__c){ correct++; AWSService.queryRepair(staticResource.queryUrl,tableDataStr[i].address.AWS_Data_Id__c,tableDataStr[i].address.Id,tableDataStr[i].address.Contacts__r.AWS_Data_Id__c,searchCallBack,staticResource.token); } @@ -650,9 +650,9 @@ <td align="left" style="vertical-align: inherit;border-width: 0px 1px 1px 0px;"> <apex:outputText value="{!or.address.Detailed_Address__c}" /> </td> - <td align="center" style="vertical-align: inherit;width:30px;"> + <!-- <td align="center" style="vertical-align: inherit;width:30px;"> <apex:commandButton value=" 缂栬緫 " onclick="onEditorJs('{!or.address.id}');return false;" style="background:#98c1fbf7;display:{!or.canEdit};"/> - </td> + </td> --> <td align="center" style="vertical-align: inherit;width:30px;"> <apex:commandButton value=" 澶嶅埗 " onclick="onCopyJs('{!or.address.id}');return false;" style="background: #98c1fbf7;display:{!or.canCopy};"/> </td> @@ -671,6 +671,7 @@ </apex:outputPanel> </apex:pageblocksection> </apex:pageBlock> + </div> <div id="tab03"> <apex:pageBlock id="oppBlock2" tabStyle="Report"> @@ -713,6 +714,7 @@ </script> </apex:pageBlock> </div> + </apex:form> <apex:outputPanel id="checEventFrame"> <script type="text/javascript"> diff --git a/force-app/main/default/pages/ViewAddressDecryptInfo.page b/force-app/main/default/pages/ViewAddressDecryptInfo.page index 5b8b014..a9aa22d 100644 --- a/force-app/main/default/pages/ViewAddressDecryptInfo.page +++ b/force-app/main/default/pages/ViewAddressDecryptInfo.page @@ -16,7 +16,7 @@ AWSService.query(staticResources.queryUrl, '{!AWSDataId}', queryBack, staticResources.token); } var queryBack = function queryBack(data) { - document.querySelector("[id='page:form:pageBlock:pageBlockSection:j_id1:0:j_id2']").innerHTML = data.object.telephone; + document.querySelector("[data-id='Telephone__c']").innerHTML = data.object.telephone; document.querySelector("[data-id='ZipCode__c']").innerHTML = data.object.zipCode; document.querySelector("[data-id='Detailed_Address__c']").innerHTML = data.object.detailedAddress; -- Gitblit v1.9.1