From de9565270a88b0749d17c1961cd41399c8483c96 Mon Sep 17 00:00:00 2001
From: binxie <137736985@qq.com>
Date: 星期一, 26 六月 2023 17:46:45 +0800
Subject: [PATCH] merge
---
force-app/main/default/classes/NFMUtil.cls | 198 ++++++++++++++++++++++++++++++++++++++++++++-----
1 files changed, 176 insertions(+), 22 deletions(-)
diff --git a/force-app/main/default/classes/NFMUtil.cls b/force-app/main/default/classes/NFMUtil.cls
index 75592b4..d058c29 100644
--- a/force-app/main/default/classes/NFMUtil.cls
+++ b/force-app/main/default/classes/NFMUtil.cls
@@ -63,6 +63,9 @@
public static String NFM703_ENDPOINT = null;
public static String NFM115_ENDPOINT = null;
+ // 鐢靛瓙绛炬敹鍗昐FDC2SAP thh 20220427 start
+ public static String NFM116_ENDPOINT = null;
+ // 鐢靛瓙绛炬敹鍗昐FDC2SAP thh 20220427 end
public static String NFM112_ENDPOINT = null;
@@ -101,16 +104,16 @@
NFM401_ENDPOINT = 'http://ec2-161-189-3-104.cn-northwest-1.compute.amazonaws.com.cn:8088/dojtest/dojInfo/recevie';
NFM402_ENDPOINT = 'http://ec2-161-189-3-104.cn-northwest-1.compute.amazonaws.com.cn:8088/dojtest/dojInfo/getDojInfoByRefNo';
- // NFM501_ENDPOINT = 'http://cusdata.qianlima.com/test/v1/info/page/';
NFM501_ENDPOINT = 'https://sfpi-mebg-test.olympuschina.com/api/nfm/501';
- NFM502_ENDPOINT = 'http://cusdata.qianlima.com/test/v1/info/detailHtml?url=';
- NFM504_ENDPOINT = 'http://cusdata.qianlima.com/test/v1/customer/albs/feedback';
+ NFM502_ENDPOINT = 'http://cusdata.qianlima.com/v1/info/detailHtml?url=';
+ NFM504_ENDPOINT = 'http://cusdata.qianlima.com/v1/customer/albs/feedback';
CBPR_Auth_Sap = 'Basic U0ZEQ19XU1VTRVI6cG9xMTIzNDU=';
// LHJ 20180824 CBPR End
//CBPR_Auth_Spo = 'http://cbpr.chinacloudsites.cn/sfdc/token';
CBPR_Auth_Spo = 'http://cbpr.olympuschina.com/sfdc/token';
QLM_Token = 'http://cusdata.qianlima.com/v1/token';
+
// 鏅烘収鍖荤枟&鏈嶅姟鏂扮郴缁熼�氫俊 瀹㈡埛鎺ュ彛
NFM601_ENDPOINT = 'https://wdp.olympus.com.cn:44301/RESTAdapter/NFM601';
@@ -123,13 +126,19 @@
NFM702_ENDPOINT = 'https://wdp.olympus.com.cn:44301/RESTAdapter/NFM702';
NFM703_ENDPOINT = 'https://wdp.olympus.com.cn:44301/RESTAdapter/NFM703';
- NFM112_ENDPOINT = 'http://wdp.olympus.com.cn:8089/RESTAdapter/NFM112';
+ NFM112_ENDPOINT = 'https://wdp.olympus.com.cn:44301/RESTAdapter/NFM112';
NFM115_ENDPOINT = 'https://wdp.olympus.com.cn:44301/RESTAdapter/NFM115';
+
+ // sanbox鐢靛瓙绛炬敹鍗昐FDC2SAP thh 20220427 start
+ NFM116_ENDPOINT = 'https://wdp.olympus.com.cn:44301/RESTAdapter/NFM116';
+ // sanbox鐢靛瓙绛炬敹鍗昐FDC2SAP thh 20220427 end
+
// 鏂版湇鍔$郴缁� 娴嬭瘯鐜
AWS_DOMAIN = 'https://olympus.bqbot.com';
- // 鏂版湇鍔$郴缁� 鏈湴鐜锛堜复鏃讹級
+ // 鏂版湇鍔$郴缁� 鏈湴鐜锛堜复鏃讹級
// AWS_DOMAIN = 'http://114.249.236.98:29990';
+ // AWS_DOMAIN = 'http://114.249.231.75:29995';
// AWS_DOMAIN = 'http://jzbase.bqbot.com:29990';
// AWS_DOMAIN = 'http://114.249.238.243:29990';
@@ -144,7 +153,7 @@
NFM007_ENDPOINT = 'https://wdp.olympus.com.cn:44302/RESTAdapter/NFM007';
NFM008_ENDPOINT = 'https://owdc.olympus.co.jp/XISOAPAdapter/MessageServlet?senderParty=&senderService=OCM_SFDC_P&receiverParty=&receiverService=&interface=NFM008_Sync_BC2GPI&interfaceNamespace=http%3A%2F%2Folympus.co.jp%2Fgpi%2FNFM008';
//NFM103_ENDPOINT = 'https://owdc.olympus.co.jp/XISOAPAdapter/MessageServlet?senderParty=&senderService=OCM_SFDC_P&receiverParty=&receiverService=&interface=NFM103_Sync_BC2GPI&interfaceNamespace=http%3A%2F%2Folympus.co.jp%2Fgpi%2FNFM103';
- NFM103_ENDPOINT = 'https://wdp.olympus.com.cn:44302/RESTAdapter/NFM103';// 鍘焥aphost
+ NFM103_ENDPOINT = 'https://wdp.olympus.com.cn:44302/RESTAdapter/NFM103';
//NFM106_ENDPOINT = 'https://owdc.olympus.co.jp/XISOAPAdapter/MessageServlet?senderParty=&senderService=OCM_SFDC_P&receiverParty=&receiverService=&interface=NFM106_Sync_BC2GPI&interfaceNamespace=http%3A%2F%2Folympus.co.jp%2Fgpi%2FNFM106';
NFM106_ENDPOINT = 'https://wdp.olympus.com.cn:44302/RESTAdapter/NFM106';
// LHJ 20180824 CBPR Start
@@ -159,8 +168,7 @@
NFM401_ENDPOINT = 'http://ec2-161-189-3-104.cn-northwest-1.compute.amazonaws.com.cn:8082/doj/dojInfo/recevie';
NFM402_ENDPOINT = 'http://ec2-161-189-3-104.cn-northwest-1.compute.amazonaws.com.cn:8082/doj/dojInfo/getDojInfoByRefNo';
- // NFM501_ENDPOINT = 'http://cusdata.qianlima.com/v1/info/page/';
- NFM501_ENDPOINT ='https://sfpi-mebg-test.olympuschina.com/api/nfm/501';
+ NFM501_ENDPOINT ='https://sfpi-mebg-test.olympuschina.com/api/nfm/501';
NFM502_ENDPOINT = 'http://cusdata.qianlima.com/v1/info/detailHtml?url=';
NFM504_ENDPOINT = 'http://cusdata.qianlima.com/v1/customer/albs/feedback';
CBPR_Auth_Sap = 'Basic U0ZEQ19XU1VTRVI6cG9wMTIzNDU=';
@@ -176,9 +184,18 @@
// 鏅烘収鍖荤枟&鏈嶅姟鏂扮郴缁熼�氫俊 鐢ㄦ埛鎺ュ彛
NFM621_ENDPOINT = 'https://wdp.olympus.com.cn:44302/RESTAdapter/NFM621';
NFM622_ENDPOINT = 'https://api-platform.olympuschina.com/prod-api/api/sso/sfdc_activitydata';
+ NFM701_ENDPOINT = 'https://wdp.olympus.com.cn:44302/RESTAdapter/NFM701';
+ NFM702_ENDPOINT = 'https://wdp.olympus.com.cn:44302/RESTAdapter/NFM702';
+ NFM703_ENDPOINT = 'https://wdp.olympus.com.cn:44302/RESTAdapter/NFM703';
+ //鍏堟鍚庝慨
+ NFM112_ENDPOINT = 'https://wdp.olympus.com.cn:44302/RESTAdapter/NFM112';
//鏍锋湰绠$悊
NFM115_ENDPOINT = 'https://wdp.olympus.com.cn:44302/RESTAdapter/NFM115';
+
+ // 鐢靛瓙绛炬敹鍗昐FDC2SAP thh 20220427 start
+ NFM116_ENDPOINT = 'https://wdp.olympus.com.cn:44302/RESTAdapter/NFM116';
+ // 鐢靛瓙绛炬敹鍗昐FDC2SAP thh 20220427 end
// 鏂版湇鍔$郴缁�
AWS_DOMAIN = 'https://svc-elb.olympuschina.com';
@@ -230,6 +247,7 @@
webservice String timestamp;
webservice String appKey;
}
+ // add to aws response sushanhu 20220224 start
global class NFMResponse{
public Boolean SFStatus;
public String SFMessage;
@@ -249,6 +267,7 @@
return result;
}
+// add to aws response sushanhu 20220224 end
/**
* @return yyyyMMdd 銇棩浠樻枃瀛楀垪
*/
@@ -360,6 +379,24 @@
}
return rtn;
}
+
+ // lt 20220419 Start
+ /**
+ * @return yyyy/MM/dd 銇棩浠樻枃瀛楀垪
+ */
+ public static String formatDateTime2StrSprit2(DateTime dt) {
+ String rtn = null;
+ if (dt == null) {
+ rtn = '';
+ } else {
+ String pDate = formatDateTime2Str(dt);
+ rtn = (pDate.substring(0, 4)) + '/' +
+ (pDate.substring(4, 6)) + '/' +
+ (pDate.substring(6, 8));
+ }
+ return rtn;
+ }
+ // lt 20220419 End
/**
* add wangweipeng 2022/02/11
@@ -513,7 +550,7 @@
col = '';
}
rtn = transferMap.get(col + key);
- if (rtn == null) {
+ if (!transferMap.containsKey(col + key)) { //lt 20220530 update
iflog.ErrorLog__c += 'Warning! Please check [' + col + '] can not transfer key [' + key + ']\n';
rtn = key;
}
@@ -621,6 +658,32 @@
return rowData;
}
+ // public static BatchIF_Log__c makeRowDataToOnline(NFMUtil.MonitoringToOnline Monitoring, String NFMType, Object NFMData) {
+ // BatchIF_Log__c rowData = new BatchIF_Log__c();
+ // rowData.Type__c = NFMType;
+ // rowData.MessageGroupNumber__c = Monitoring.MessageGroupNumber;
+ // rowData.TransmissionDateTime__c = Monitoring.TransmissionDateTime;
+ // rowData.RowDataFlg__c = true;
+ // rowData.Log__c = '';
+ // rowData.ErrorLog__c = '';
+ // String rowDataStr = JSON.serialize(NFMData);
+ // if (rowDataStr.length() > 0) {
+ // Integer splitIdx = 1;
+ // while (rowDataStr.length() > 0) {
+ // if (splitIdx == 1) {
+ // rowData.put('Log__c', rowDataStr.substring(0, (rowDataStr.length() > MaxLogColumnLength ? MaxLogColumnLength : rowDataStr.length())));
+ // } else if (splitIdx == 13) {
+ // rowData.ErrorLog__c = rowDataStr;
+ // break;
+ // } else {
+ // rowData.put('Log' + splitIdx + '__c', rowDataStr.substring(0, (rowDataStr.length() > MaxLogColumnLength ? MaxLogColumnLength : rowDataStr.length())));
+ // }
+ // splitIdx++;
+ // rowDataStr = rowDataStr.substring((rowDataStr.length() > MaxLogColumnLength ? MaxLogColumnLength : rowDataStr.length()));
+ // }
+ // }
+ // return rowData;
+ // }
public static BatchIF_Log__c makeRowData(BatchIF_Log__c iflog, String NFMType, Object NFMData) {
// TransmissionDateTime銇ō瀹�
Datetime nowDT = Datetime.now();
@@ -889,9 +952,9 @@
public class response {
public string status;
public string responseBody;
- public response(string status, string responseBody ) {
- this.status = status;
- this.responseBody = responseBody;
+ public response(string status, string responseBody) {
+ this.status = status;
+ this.responseBody = responseBody;
}
}
// WLIG-BXQBH6 end
@@ -1017,13 +1080,13 @@
req.setEndpoint(endpoint);
req.setMethod('GET');
HTTPResponse response = http.send(req);
- String statusCode = response.getStatus();
+ String statusCode = String.valueof(response.getStatusCode());
System.debug('response:' + response);
//http锛氱姸鎬佸拰code
//濡傛灉鐘舵�佷笉閫氳繃 锛� 鍒欏皢鐘舵�佸強绌虹殑鐨勬暟鎹� 锛� 杩斿洖
- if (String.isNotBlank(statusCode)) {
- return new response(statusCode, null);
- }
+ // if (String.isNotBlank(statusCode)) {
+ // return new response(statusCode, null);
+ // }
System.debug('=====2======' + response.getBody());
//姝e父鎵ц
return new response(statusCode, response.getBody());
@@ -1040,13 +1103,13 @@
req.setMethod('POST');
req.setBody(jsonStr);
HTTPResponse response = http.send(req);
- String statusCode = response.getStatus();
+ String statusCode = String.valueof(response.getStatusCode());
System.debug('response:' + response);
//http锛氱姸鎬佸拰code
//濡傛灉鐘舵�佷笉閫氳繃 锛� 鍒欏皢鐘舵�佸強绌虹殑鐨勬暟鎹� 锛� 杩斿洖
- if (String.isNotBlank(statusCode)) {
- return new response(statusCode, null);
- }
+ // if (String.isNotBlank(statusCode)) {
+ // return new response(statusCode, null);
+ // }
System.debug('=====2======' + response.getBody());
//姝e父鎵ц
return new response(statusCode, response.getBody());
@@ -1196,6 +1259,31 @@
}
return rowDataSFDC;
}
+ // 2022-12-06 zyh add start DB202211540694-閲嶅彂鍙彂鑷繁
+ public static BatchIF_Log__c LogAutoSend(BatchIF_Log__c rowDataSFDC, Exception ex, String status, Boolean check){
+ Integer batch_retry_max_cnt = Integer.valueOf(System.Label.batch_retry_max_cnt);
+ if (rowDataSFDC.retry_cnt__c == null) rowDataSFDC.retry_cnt__c = 0;
+ if (rowDataSFDC.retry_cnt__c < batch_retry_max_cnt){
+ rowDataSFDC.retry_cnt__c++;
+ // 20230131 ljh start
+ // LogAutoSendSchedule.logId = rowDataSFDC.Id; // 璧嬪�兼湰鏃ュ織Id
+ // LogAutoSendSchedule.messageGroupNumber = rowDataSFDC.MessageGroupNumber__c; // messagenum鍙疯祴鍊� 2023-01-19 zyh add
+ // LogAutoSendSchedule.type = rowDataSFDC.Type__c; // 璧嬪�兼湰鏃ュ織type 2023-01-19 zyh add
+ System.debug('NFM鎺ュ彛娴嬭瘯==========>Id锛�' + rowDataSFDC.Id + ';===MessageGroupNumber锛�' + rowDataSFDC.MessageGroupNumber__c + ';===Type' + rowDataSFDC.Type__c);
+ // LogAutoSendSchedule.assignOneMinute();
+ LogAutoSendSchedule.assignOneMinute(rowDataSFDC.MessageGroupNumber__c,rowDataSFDC.Type__c);
+ // 20230131 ljh end
+ }
+ if (rowDataSFDC.retry_cnt__c >= batch_retry_max_cnt){
+ if (ex == null) {
+ rowDataSFDC.ErrorLog__c = status + '\n閿欒娆℃暟宸茬粡瓒呰繃鑷姩閫佷俊璁惧畾鐨勬渶澶ф鏁帮紝璇锋墜鍔ㄩ�佷俊';
+ } else {
+ rowDataSFDC.ErrorLog__c = ex.getMessage() + '\n' + ex.getStackTraceString() + '\n' + rowDataSFDC.ErrorLog__c+'閿欒娆℃暟宸茬粡瓒呰繃鑷姩閫佷俊璁惧畾鐨勬渶澶ф鏁帮紝璇锋墜鍔ㄩ�佷俊';
+ }
+ }
+ return rowDataSFDC;
+ }// 寤鸿浠ュ悗閲嶅彂璋冪敤姝ゆ柟娉�
+ // 2022-12-06 zyh add end DB202211540694-閲嶅彂鍙彂鑷繁
// https://oly.ngrok.kunchuangtech.net/api/sso/sfdc_activitydata
//鍙戦�佺粰鍏遍�氬钩鍙� 绮剧悽鎶�鏈� thh 2021-09-22 start
public static String sendToComPlat(String rowDataStr, String endpoint) {
@@ -1215,10 +1303,76 @@
system.debug('resb:' + resb);
return resb;
}
-
-
//鍙戦�佺粰鍏遍�氬钩鍙� 绮剧悽鎶�鏈� thh 2021-09-22 end
+ //zhj batch 璋冪敤624鎺ュ彛鐨勬椂鍊� 闇�瑕佽皟鐢ˋWS 2023-01-08 start
+ public static void batchSendToAWS624(String rowDataId) {
+ System.debug('enter batchSendToAWS624');
+ BatchIF_Log__c rowData = [Select Id, Name, Log__c,Is_Error__c, ErrorLog__c, Log2__c, Log3__c, Log4__c, Log5__c, Log6__c, Log7__c, Log8__c, Log9__c, Log10__c, Log11__c, Log12__c, MessageGroupNumber__c, retry_cnt__c,NFM624_Secondary_processing__c from BatchIF_Log__c where RowDataFlg__c = true and Id =: rowDataId];
+ String rowDataStr = getRowDataStr(rowData);
+ List < NFM624Rest2.GeData > GeDataList = (List < NFM624Rest2.GeData > ) JSON.deserialize(rowDataStr, List < NFM624Rest2.GeData > .class);
+ Http http = new Http();
+ HttpRequest request = new HttpRequest();
+ PIHelper.PIIntegration documentPI=PIHelper.getPIIntegrationInfo('Document');
+ String hostUrl = documentPI.hostUrl;
+ System.debug('GeDataList[0].nfm624RequestId = ' + GeDataList[0].nfm624RequestId);
+ System.debug('documentPI.hostUrl = ' + documentPI.hostUrl);
+ System.debug('documentPI.token = ' + documentPI.token);
+ request.setEndpoint(hostUrl + '/api/nfm/reCallNFM624Batch?nfm624RequestId=' + GeDataList[0].nfm624RequestId + '&rowDataId=' + rowDataId);
+ request.setMethod('GET');
+ request.setHeader('pi-token',documentPI.token);
+ HttpResponse response = http.send(request);
+ System.debug('send batchSendToAWS624');
+ }
+ //zhj batch 璋冪敤624鎺ュ彛鐨勬椂鍊� 闇�瑕佽皟鐢ˋWS 2023-01-08 end
+
+ //zhj 閲嶆柊 璋冪敤624鎺ュ彛鐨勬椂鍊� 璋冪敤AWS 2023-01-11 start
+ public static void againSendToAWS624(String rowDataId) {
+ if(!Test.isRunningTest()){
+ System.debug('enter againSendToAWS624');
+ BatchIF_Log__c rowData = [Select Id, Name, Log__c,Is_Error__c, ErrorLog__c, Log2__c, Log3__c, Log4__c, Log5__c, Log6__c, Log7__c, Log8__c, Log9__c, Log10__c, Log11__c, Log12__c, MessageGroupNumber__c, retry_cnt__c,NFM624_Secondary_processing__c from BatchIF_Log__c where RowDataFlg__c = true and Id =: rowDataId];
+ String rowDataStr = getRowDataStr(rowData);
+ List < NFM624Rest2.GeData > GeDataList = (List < NFM624Rest2.GeData > ) JSON.deserialize(rowDataStr, List < NFM624Rest2.GeData > .class);
+ Http http = new Http();
+ HttpRequest request = new HttpRequest();
+ PIHelper.PIIntegration documentPI=PIHelper.getPIIntegrationInfo('Document');
+ String hostUrl = documentPI.hostUrl;
+ System.debug('GeDataList[0].nfm624RequestId = ' + GeDataList[0].reCallNfm624RequestId);
+ System.debug('documentPI.hostUrl = ' + documentPI.hostUrl);
+ System.debug('documentPI.token = ' + documentPI.token);
+ request.setEndpoint(hostUrl + '/api/nfm/reCallNFM624?reCallNfm624RequestId=' + GeDataList[0].reCallNfm624RequestId + '&rowDataId=' + rowDataId);
+ request.setMethod('GET');
+ request.setHeader('pi-token',documentPI.token);
+ HttpResponse response = http.send(request);
+ System.debug('send againSendToAWS624');
+ }
+ }
+ //zhj 閲嶆柊 璋冪敤624鎺ュ彛鐨勬椂鍊� 璋冪敤AWS 2023-01-11 end
+
+ //zhj 鏂版柟妗堟敼閫� 624Batch鏇存柊鏃ュ織 灏嗘棩蹇楀唴瀹规洿鏂板埌rowdata閲岄潰 2023-01-09 start
+ public static BatchIF_Log__c updateRowData(String rowDataId, Object NFMData) {
+ BatchIF_Log__c rowData = [Select Id, Name, Log__c,Is_Error__c, ErrorLog__c, Log2__c, Log3__c, Log4__c, Log5__c, Log6__c, Log7__c, Log8__c, Log9__c, Log10__c, Log11__c, Log12__c, MessageGroupNumber__c, retry_cnt__c,NFM624_Secondary_processing__c from BatchIF_Log__c where Id =: rowDataId];
+ String rowDataStr = JSON.serialize(NFMData);
+ if (rowDataStr.length() > 0) {
+ Integer splitIdx = 1;
+ while (rowDataStr.length() > 0) {
+ if (splitIdx == 1) {
+ rowData.put('Log__c', rowDataStr.substring(0, (rowDataStr.length() > MaxLogColumnLength ? MaxLogColumnLength : rowDataStr.length())));
+ } else if (splitIdx == 13) {
+ rowData.ErrorLog__c = rowDataStr;
+ break;
+ } else {
+ rowData.put('Log' + splitIdx + '__c', rowDataStr.substring(0, (rowDataStr.length() > MaxLogColumnLength ? MaxLogColumnLength : rowDataStr.length())));
+ }
+ splitIdx++;
+ rowDataStr = rowDataStr.substring((rowDataStr.length() > MaxLogColumnLength ? MaxLogColumnLength : rowDataStr.length()));
+ }
+ }
+ update rowData;
+ return rowData;
+ }
+ //zhj 鏂版柟妗堟敼閫� 624Batch鏇存柊鏃ュ織 灏嗘棩蹇楀唴瀹规洿鏂板埌rowdata閲岄潰 2023-01-09 end
+
public static Integer ControllerUtil() {
Integer i = 0;
i++;
--
Gitblit v1.9.1