From ca51336f247021aa79b8863522e15e8dee957e19 Mon Sep 17 00:00:00 2001
From: 李金换 <lijinhuan@prec-tech.com>
Date: 星期一, 21 三月 2022 10:19:49 +0800
Subject: [PATCH] 盘点Copy邮件标头修改
---
force-app/main/default/classes/PIHelper.cls | 25 ++++++++++++++++++++-----
1 files changed, 20 insertions(+), 5 deletions(-)
diff --git a/force-app/main/default/classes/PIHelper.cls b/force-app/main/default/classes/PIHelper.cls
index 48cc2cd..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);
@@ -18,19 +19,22 @@
}
}
// confirm file transaction
- @future(callout =true)
+ // @future(callout =true)
public static void confirmFileTrans(String module,Integer isSuccess, String sfRecordId ,String transId ,String token,String transUrl){
Boolean result =false;
Transaction_Log__c traLog = new Transaction_Log__c();
traLog.Module__c = 'ConfirmFileTransaction '+module;
traLog.Interface_URL__c = transUrl;
traLog.TransId__c = transId;
- traLog.SFRecordId__c=sfRecordId;
+ // traLog.SFRecordId__c=sfRecordId;
+ Integer MaxLogColumnLength = 131072;
try {
Http http = new Http();
HttpRequest request = new HttpRequest();
request.setEndpoint(transUrl);
request.setMethod('POST');
+ request.setHeader('pi-token',token);
+ request.setHeader('Content-Type', 'application/json');
TransRequestBody requestBody =new TransRequestBody();
requestBody.isSuccess=isSuccess;
requestBody.sfRecordId=sfRecordId;
@@ -44,7 +48,9 @@
result = (Boolean)results.get('success');
System.debug('result = ' + result);
traLog.Status__c = 'success';
- traLog.Response__c=response.getBody();
+ String res=response.getBody();
+ traLog.Response__c=res.substring(0, (res.length() > MaxLogColumnLength ? MaxLogColumnLength : res.length()));
+
} catch (Exception e) {
traLog.Status__c = 'fail';
traLog.Response__c = e.getMessage();
@@ -59,6 +65,7 @@
traLog.Module__c = 'Confirm Transaction '+module;
traLog.Interface_URL__c = transUrl;
traLog.TransId__c = transId;
+ Integer MaxLogColumnLength = 131072;
if (!String.isEmpty(sfRecordId)) {
traLog.SFRecordId__c=sfRecordId;
}else {
@@ -70,6 +77,8 @@
HttpRequest request = new HttpRequest();
request.setEndpoint(transUrl);
request.setMethod('POST');
+ request.setHeader('pi-token',token);
+ request.setHeader('Content-Type', 'application/json');
TransactionRequestBody requestBody =new TransactionRequestBody();
requestBody.isSuccess=isSuccess;
requestBody.sfRecordId=sfRecordId;
@@ -83,7 +92,8 @@
result = (Boolean)results.get('success');
System.debug('result = ' + result);
traLog.Status__c = 'success';
- traLog.Response__c=response.getBody();
+ String res=response.getBody();
+ traLog.Response__c=res.substring(0, (res.length() > MaxLogColumnLength ? MaxLogColumnLength : res.length()));
} catch (Exception e) {
traLog.Status__c = 'fail';
traLog.Response__c = e.getMessage();
@@ -110,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;
@@ -148,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) {
@@ -161,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;
@@ -180,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;}
--
Gitblit v1.9.1