Li Jun
2022-03-14 c961a1a85fdf279ae6ae31af51e66847ae514a0a
PIPL Function Update 20220314
11个文件已修改
71 ■■■■■ 已修改文件
force-app/main/default/classes/CM_SearchContactServiceController.cls 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/ContactTriggerHandler.cls 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/NFM503InfoFileBatch.cls 28 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/PIHelper.cls 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/classes/SearchVisitorController.cls 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/pages/NewAndEditCase.page 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/pages/NewAndEditContact.page 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/pages/NewAndEditInquiryForm.page 4 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/pages/SearchVisitor.page 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/pages/StraightBackAddress.page 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
force-app/main/default/pages/ViewAddressDecryptInfo.page 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
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>();
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;
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('成功的token'+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('失败的token'+token);
             PIHelper.confirmFileTrans('NFM503',0,'',transId,token,transUrl);
            // //add 确认事务 20220302 sushanhu start
            // system.debug('失败的token'+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
    }
}
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和appsecret
        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;}
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
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 {
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 += ';电话号码错误';
            }
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;
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";
            }            
        }
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">
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;