From 884f10a686d0c576209498a1e6573e7bee4fd172 Mon Sep 17 00:00:00 2001
From: GWY <guweiyiscp096@foxmail.com>
Date: 星期二, 19 四月 2022 10:39:38 +0800
Subject: [PATCH] Merge branch 'master' of http://47.92.229.245:8089/r/OlympusSSBG
---
force-app/main/default/classes/NFMUtil.cls | 1443 +++++---------------------------------------------------
1 files changed, 145 insertions(+), 1,298 deletions(-)
diff --git a/force-app/main/default/classes/NFMUtil.cls b/force-app/main/default/classes/NFMUtil.cls
index f70f39d..840b710 100644
--- a/force-app/main/default/classes/NFMUtil.cls
+++ b/force-app/main/default/classes/NFMUtil.cls
@@ -7,183 +7,46 @@
public static Integer MaxLogColumnLength = 131072;
public static String DummyAssetProfix = '涓嶅彲鐢細';
public static String Authorization = 'Basic T0NNX1NGX1VTRVI6b2Ntc2ZkYzg0MDI=';
-
- public static final String CBPR_Auth_AWS = 'APPCODE60144b374d314ec2984182046e4ad5fb';
- public static final String APP_KEY = '47b829e07dc9512b871a677b383fb716';
- // public static final String AWS_DOMAIN = 'http://jzbase.bqbot.com:29990';
- public static String AWS_DOMAIN = '';
-
public static String CLIENT_CERT_NAME = null;
- public static String NFM001_ENDPOINT = null;
- public static String NFM007_ENDPOINT = null;
- public static String NFM008_ENDPOINT = null;
- public static String NFM103_ENDPOINT = null;
- public static String NFM106_ENDPOINT = null;
- //update NFMUtil鐨凬FM401鐨勭綉绔欏湴鍧�淇敼涓轰娇鐢‵QDN銆備笉鏄疘P鍦板潃銆�
- // public static String NFM401_ENDPOINT = 'http://161.189.3.104:8088/dojtest/dojInfo/recevie';
- public static String NFM401_ENDPOINT = null;
- // public static String NFM401_ENDPOINT = 'http://192.168.0.173:8088/dojtest/dojInfo/recevie';
- //---------- insert by rentongxiao 2020-08-19
- public static String NFM402_ENDPOINT = null;
- //---------- insert by rentongxiao 2020-08-19
- public static String NFM501_ENDPOINT = null;
- public static String NFM502_ENDPOINT = null;
- //fxk 2021/9/6 Satr
- public static String NFM504_ENDPOINT = null;
- //fxk 2021/9/6 end
- // public static String NFM401_ENDPOINT = 'http://161.189.87.140:8082/doj/dojInfo/recevie';
- // LHJ 20180824 CBPR Start
- //public static String CBPR_Auth_Sap = 'Basic U0ZEQ19XU1VTRVI6cG9kMTIzNDU=';
+ public static String SBG001_ENDPOINT = null;
+ public static String SBG007_ENDPOINT = null;
+ public static String SBG027_ENDPOINT = null;
+
public static String CBPR_Auth_Sap = null;
- public static String CBPR_Auth_Spo = null;
- public static String QLM_NFM501_Point = 'application/x-www-form-urlencoded';
- public static String QLM_Token = null;
- //public static String CBPR_Auth_Spo = 'http://cbpr.chinacloudsites.cn/sfdc/token';
- //public static String CBPR_Auth_Spo = 'http://cbprproduct.chinacloudsites.cn/sfdc/token1';
- public static String CBPR_UserName_Spo = 'int1@olympus.partner.onmschina.cn';
- public static String CBPR_Password_Spo = 'Rog618571108';
- public static String appKey = '070f00bf-64f1-4720-a8d8-bbe1aa976d22';
- public static String appSecret = '67BB2BAFC8AA0BA0CABB37CBF50EC292';
- public static String NFM009_ENDPOINT = null;
- public static String NFM201_ENDPOINT = null;
- public static String NFM202_ENDPOINT = null;
- public static String NFM207_ENDPOINT = null;
- // LHJ 20180824 CBPR End
- // 鏅烘収鍖荤枟&鏈嶅姟鏂扮郴缁熼�氫俊 LY 20210916 Star
- public static String NFM621_ENDPOINT = null;
- // 鏅烘収鍖荤枟&鏈嶅姟鏂扮郴缁熼�氫俊 LY 20210916 End
- // 鏅烘収鍖荤枟&鏈嶅姟鏂扮郴缁熼�氫俊 瀹㈡埛鎺ュ彛
- public static String NFM601_ENDPOINT = null;
- // 鏅烘収鍖荤枟&鏈嶅姟鏂扮郴缁熼�氫俊 鑱旂郴浜烘帴鍙�
- public static String NFM606_ENDPOINT = null;
- // 鏅烘収鍖荤枟&鏈嶅姟鏂扮郴缁熼�氫俊 瀛︿細銉绘椿鍔ㄦ帴鍙�
- public static String NFM622_ENDPOINT = null;
- public static String NFM701_ENDPOINT = null;
- public static String NFM702_ENDPOINT = null;
- public static String NFM703_ENDPOINT = null;
- public static String NFM115_ENDPOINT = null;
-
- public static String NFM112_ENDPOINT = null;
-
-
- public static String requestURILMS = null;
- public static String appSecretLMS = null;
- public static String appKeyLMS = null;
static {
if (isSandbox()) {
- CLIENT_CERT_NAME = 'owdc_test';
- NFM001_ENDPOINT = 'https://wdp.olympus.com.cn:44301/RESTAdapter/NFM001';
- // NFM007_ENDPOINT = 'https://owdc-test.olympus.co.jp/XISOAPAdapter/MessageServlet?senderParty=&senderService=OCM_SFDC_T&receiverParty=&receiverService=&interface=NFM007_Sync_BC2GPI&interfaceNamespace=http%3A%2F%2Folympus.co.jp%2Fgpi%2FNFM007';
- //NFM007_ENDPOINT = 'http://wdp.olympus.com.cn:8089/RESTAdapter/NFM007';
- NFM007_ENDPOINT = 'https://wdp.olympus.com.cn:44301/RESTAdapter/NFM007';
- NFM008_ENDPOINT = 'https://owdc-test.olympus.co.jp/XISOAPAdapter/MessageServlet?senderParty=&senderService=OCM_SFDC_T&receiverParty=&receiverService=&interface=NFM008_Sync_BC2GPI&interfaceNamespace=http%3A%2F%2Folympus.co.jp%2Fgpi%2FNFM008';
- NFM103_ENDPOINT = 'http://wdp.olympus.com.cn:8089/RESTAdapter/NFM103';
- // NFM106_ENDPOINT = 'https://owdc-test.olympus.co.jp/XISOAPAdapter/MessageServlet?senderParty=&senderService=OCM_SFDC_T&receiverParty=&receiverService=&interface=NFM106_Sync_BC2GPI&interfaceNamespace=http%3A%2F%2Folympus.co.jp%2Fgpi%2FNFM106';
- NFM106_ENDPOINT = 'http://wdp.olympus.com.cn:8089/RESTAdapter/NFM106';
- //NFM106_ENDPOINT = 'https://sfdc-ocm-test.olympus.co.jp/XISOAPAdapter/MessageServlet?senderParty=&senderService=OCM_SFDC_T&receiverParty=&receiverService=&interface=NFM106_Sync_BC2GPI&interfaceNamespace=http%3A%2F%2Folympus.co.jp%2Fgpi%2FNFM106';
- // LHJ 20180824 CBPR Start
- //NFM009_ENDPOINT = 'http://58.246.66.49:8088/RESTAdapter/SFDC002/';
- //NFM009_ENDPOINT = 'https://wstest.olympus.com.cn/RESTAdapter/SFDC002/';
- //NFM009_ENDPOINT = 'https://wdp.olympus.com.cn/RESTAdapter/SFDC002/';
- NFM009_ENDPOINT = 'https://wdp.olympus.com.cn:44301/RESTAdapter/SFDC002/';
- //NFM201_ENDPOINT = 'http://cbpr.chinacloudsites.cn/sfdc/Hospital';
- //NFM202_ENDPOINT = 'http://cbpr.chinacloudsites.cn/sfdc/Inquiry';
- //NFM207_ENDPOINT = 'http://cbpr.chinacloudsites.cn/sfdc/QIS';
- //NFM201_ENDPOINT = 'http://cbprproduct.chinacloudsites.cn/sfdc/Hospital';
- //NFM202_ENDPOINT = 'http://cbprproduct.chinacloudsites.cn/sfdc/Inquiry';
- //NFM207_ENDPOINT = 'http://cbprproduct.chinacloudsites.cn/sfdc/QIS';
- NFM201_ENDPOINT = 'http://cbpr.olympuschina.com/sfdc/Hospital';
- NFM202_ENDPOINT = 'http://cbpr.olympuschina.com/sfdc/Inquiry';
- NFM207_ENDPOINT = 'http://cbpr.olympuschina.com/sfdc/QIS';
-
- 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/v1/info/page/';
- NFM502_ENDPOINT = 'http://cusdata.qianlima.com/v1/info/detailHtml?url=';
- NFM504_ENDPOINT = 'http://cusdata.qianlima.com/v1/customer/albs/feedback';
+ System.debug('sandbox');
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';
+ CLIENT_CERT_NAME = 'owdc_test';
+ // SBG001_ENDPOINT = 'https://owdc-test.olympus.co.jp/XISOAPAdapter/MessageServlet?senderParty=&senderService=OCN_SFDC_T&receiverParty=&receiverService=&interface=SBG001_Sync_BC2GPI&interfaceNamespace=http%3A%2F%2Folympus.co.jp%2Fgpi%2FSBG001';
+ //SBG007_ENDPOINT = 'https://owdc-test.olympus.co.jp/XISOAPAdapter/MessageServlet?senderParty=&senderService=OCN_SFDC_T&receiverParty=&receiverService=&interface=SBG007_Sync_BC2GPI&interfaceNamespace=http%3A%2F%2Folympus.co.jp%2Fgpi%2FSBG007';
+ //SBG027_ENDPOINT = 'https://owdc-test.olympus.co.jp/XISOAPAdapter/MessageServlet?senderParty=&senderService=OCN_SFDC_T&receiverParty=&receiverService=&interface=SBG027_Sync_BC2GPI&interfaceNamespace=http%3A%2F%2Folympus.co.jp%2Fgpi%2FSBG027';
+ //SBG027_ENDPOINT = 'https://wdp.olympus.com.cn:44301/RESTAdapter/SBG027';
+ // SBG027_ENDPOINT = 'http://wdp.olympus.com.cn:8089/RESTAdapter/SBG027';
+ // SBG001_ENDPOINT = 'http://wdp.olympus.com.cn:44301/RESTAdapter/SBG001';
+ //SBG001_ENDPOINT = 'https://owdc-test.olympus.co.jp/XISOAPAdapter/MessageServlet?senderParty=&senderService=OCN_SFDC_T&receiverParty=&receiverService=&interface=SBG001_Sync_BC2GPI&interfaceNamespace=http%3A%2F%2Folympus.co.jp%2Fgpi%2FSBG001';
+ SBG001_ENDPOINT = 'http://wdp.olympus.com.cn:8089/RESTAdapter/SBG001';
+ //SBG007_ENDPOINT = 'https://owdc-test.olympus.co.jp/XISOAPAdapter/MessageServlet?senderParty=&senderService=OCN_SFDC_T&receiverParty=&receiverService=&interface=SBG007_Sync_BC2GPI&interfaceNamespace=http%3A%2F%2Folympus.co.jp%2Fgpi%2FSBG007';
+ SBG007_ENDPOINT = 'http://wdp.olympus.com.cn:8089/RESTAdapter/SBG007';
+ //SBG027_ENDPOINT = 'https://owdc-test.olympus.co.jp/XISOAPAdapter/MessageServlet?senderParty=&senderService=OCN_SFDC_T&receiverParty=&receiverService=&interface=SBG027_Sync_BC2GPI&interfaceNamespace=http%3A%2F%2Folympus.co.jp%2Fgpi%2FSBG027';
+ //SBG027_ENDPOINT = 'https://wdp.olympus.com.cn:44301/RESTAdapter/SBG027';
+ SBG027_ENDPOINT = 'http://wdp.olympus.com.cn:8089/RESTAdapter/SBG027';
-
- // 鏅烘収鍖荤枟&鏈嶅姟鏂扮郴缁熼�氫俊 瀹㈡埛鎺ュ彛
- NFM601_ENDPOINT = 'https://wdp.olympus.com.cn:44301/RESTAdapter/NFM601';
- // 鏅烘収鍖荤枟&鏈嶅姟鏂扮郴缁熼�氫俊 鑱旂郴浜烘帴鍙�
- NFM606_ENDPOINT = 'https://wdp.olympus.com.cn:44301/RESTAdapter/NFM606';
- // 鏅烘収鍖荤枟&鏈嶅姟鏂扮郴缁熼�氫俊 鐢ㄦ埛鎺ュ彛
- NFM621_ENDPOINT = 'https://wdp.olympus.com.cn:44301/RESTAdapter/NFM621';
- NFM622_ENDPOINT = 'http://test-platform.olympuschina.com/prod-api/api/sso/sfdc_activitydata';
- NFM701_ENDPOINT = 'https://wdp.olympus.com.cn:44301/RESTAdapter/NFM701';
- 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';
-
- NFM115_ENDPOINT = 'https://wdp.olympus.com.cn:44301/RESTAdapter/NFM115';
- // 鏂版湇鍔$郴缁� 娴嬭瘯鐜
- AWS_DOMAIN = 'https://olympus.bqbot.com';
- // 鏂版湇鍔$郴缁� 鏈湴鐜锛堜复鏃讹級
- // AWS_DOMAIN = 'http://114.249.236.98:29990';
- // AWS_DOMAIN = 'http://jzbase.bqbot.com:29990';
- // AWS_DOMAIN = 'http://114.249.238.243:29990';
-
-
- requestURILMS = '/v1/uc/user/syncOlympusUnit';
- appSecretLMS = 'CAE1D68BE3EB4F7AB5FE97EBDD11B83E';
- appKeyLMS = '39111FC57691491190C1D137A1EE3962';
} else {
- CLIENT_CERT_NAME = 'sfdc_ocm';
- NFM001_ENDPOINT = 'https://wdp.olympus.com.cn:44302/RESTAdapter/NFM001';
- //NFM007_ENDPOINT = 'https://owdc.olympus.co.jp/XISOAPAdapter/MessageServlet?senderParty=&senderService=OCM_SFDC_P&receiverParty=&receiverService=&interface=NFM007_Sync_BC2GPI&interfaceNamespace=http%3A%2F%2Folympus.co.jp%2Fgpi%2FNFM007';
- 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';
- //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
- NFM009_ENDPOINT = 'https://wdp.olympus.com.cn:44302/RESTAdapter/SFDC002/';
- //NFM201_ENDPOINT = 'http://cbprproduct.chinacloudsites.cn/sfdc/Hospital';
- //NFM202_ENDPOINT = 'http://cbprproduct.chinacloudsites.cn/sfdc/Inquiry';
- //NFM207_ENDPOINT = 'http://cbprproduct.chinacloudsites.cn/sfdc/QIS';
- NFM201_ENDPOINT = 'http://cbprproduct.olympuschina.com/sfdc/Hospital';
- NFM202_ENDPOINT = 'http://cbprproduct.olympuschina.com/sfdc/Inquiry';
- NFM207_ENDPOINT = 'http://cbprproduct.olympuschina.com/sfdc/QIS';
-
- 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/';
- 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=';
- //CBPR_Auth_Spo = 'http://cbprproduct.chinacloudsites.cn/sfdc/token';
- CBPR_Auth_Spo = 'http://cbprproduct.olympuschina.com/sfdc/token';
- // LHJ 20180824 CBPR End
- QLM_Token = 'http://cusdata.qianlima.com/v1/token';
-
- // 鏅烘収鍖荤枟&鏈嶅姟鏂扮郴缁熼�氫俊 瀹㈡埛鎺ュ彛
- NFM601_ENDPOINT = 'https://wdp.olympus.com.cn:44302/RESTAdapter/NFM601';
- // 鏅烘収鍖荤枟&鏈嶅姟鏂扮郴缁熼�氫俊 鑱旂郴浜烘帴鍙�
- NFM606_ENDPOINT = 'https://wdp.olympus.com.cn:44302/RESTAdapter/NFM606';
- // 鏅烘収鍖荤枟&鏈嶅姟鏂扮郴缁熼�氫俊 鐢ㄦ埛鎺ュ彛
- NFM621_ENDPOINT = 'https://wdp.olympus.com.cn:44302/RESTAdapter/NFM621';
- NFM622_ENDPOINT = 'https://api-platform.olympuschina.com/prod-api/api/sso/sfdc_activitydata';
-
- // 鏂版湇鍔$郴缁�
- AWS_DOMAIN = 'https://svc-elb.olympuschina.com';
-
- requestURILMS = '/v1/uc/user/syncOlympusUnit';
- appSecretLMS = '569117ED8E574BF3A6E4247C1AF8118A';
- appKeyLMS = 'B70889DEF6E647EC8A542E3C46925F93';
+ System.debug('production');
+ CLIENT_CERT_NAME = 'sfdc_ocn';
+ //SBG001_ENDPOINT = 'https://owdc.olympus.co.jp/XISOAPAdapter/MessageServlet?senderParty=&senderService=OCN_SFDC_P&receiverParty=&receiverService=&interface=SBG001_Sync_BC2GPI&interfaceNamespace=http%3A%2F%2Folympus.co.jp%2Fgpi%2FSBG001';
+ SBG001_ENDPOINT = 'https://wdp.olympus.com.cn:44302/RESTAdapter/SBG001';
+ //SBG007_ENDPOINT = 'https://owdc.olympus.co.jp/XISOAPAdapter/MessageServlet?senderParty=&senderService=OCN_SFDC_P&receiverParty=&receiverService=&interface=SBG007_Sync_BC2GPI&interfaceNamespace=http%3A%2F%2Folympus.co.jp%2Fgpi%2FSBG007';
+ SBG007_ENDPOINT = 'https://wdp.olympus.com.cn:44302/RESTAdapter/SBG007';
+ //SBG027_ENDPOINT = 'https://owdc.olympus.co.jp/XISOAPAdapter/MessageServlet?senderParty=&senderService=OCN_SFDC_P&receiverParty=&receiverService=&interface=SBG027_Sync_BC2GPI&interfaceNamespace=http%3A%2F%2Folympus.co.jp%2Fgpi%2FSBG027';
+
+ SBG027_ENDPOINT = 'https://wdp.olympus.com.cn:44302/RESTAdapter/SBG027';
}
}
-
+
// 鍙椾俊鐢�
global class Monitoring {
webservice String Tag;
@@ -195,37 +58,39 @@
webservice String TransmissionDateTime;
webservice String Text;
}
- // NFM622浣跨敤
- global class MonitoringToOnline {
- webservice String Tag;
- webservice String Sender;
- webservice String Receiver;
- webservice String MessageType;
- webservice String MessageGroupNumber;
- webservice String NumberOfRecord;
- webservice String TransmissionDateTime;
- webservice String Text;
- webservice String username;
- webservice String password;
- }
- // NFM601銆丯FM606銆丯FM621浣跨敤
- global class MonitoringToComPlat {
- webservice String Tag;
- webservice String Sender;
- webservice String Receiver;
- webservice String MessageType;
- webservice String MessageGroupNumber;
- webservice String NumberOfRecord;
- webservice String TransmissionDateTime;
- webservice String Text;
- webservice String API_RANDOM_STR;
- webservice String API_TIME;
- webservice String API_TOKEN;
- webservice String sign;
- webservice String timestamp;
- webservice String appKey;
+ //add for pipl sushanhu 20220311 start
+ public static response sendToPiAWS(String rowDataStr, String endpoint,String awsToken) {
+
+ Http http = new Http();
+ HttpRequest req = new HttpRequest();
+ HTTPResponse res;
+ String resb;
+ req.setHeader('Content-Type', 'application/json');
+ req.setTimeout(120000);
+ req.setEndpoint(endpoint);
+ req.setMethod('POST');
+ req.setHeader('pi-token', awsToken);
+ req.setBody(rowDataStr);
+ res = http.send(req);
+ string ress = String.valueOf(res.getStatusCode()) ;
+ resb = res.getBody();
+ system.debug('ress:' + ress);
+ return new response(ress, resb);
}
+ public static response getAwsToken(){
+ String responseBody = AWSServiceTool.getAWSToken();
+ return new response('success', responseBody);
+ }
+ public class response {
+ public string status;
+ public string responseBody;
+ public response(string status, string responseBody ) {
+ this.status = status;
+ this.responseBody = responseBody;
+ }
+ }
+ //add for pipl sushanhu 20220311 end
/**
* @return yyyyMMdd 銇棩浠樻枃瀛楀垪
*/
@@ -244,161 +109,18 @@
return rtn;
}
- /**
- * @return yyyyMMdd 銇棩浠樻枃瀛楀垪
- */
- public static String formatDate2StrDateTime(Date dt) {
- String rtn = null;
- if (dt == null) {
- return rtn;
- }
- rtn = String.valueOf(dt);
- rtn = rtn.replaceAll('-', '');
- if (rtn >= '40001231') {
- rtn = '99991231';
- } else if (rtn < '19000101') {
- rtn = '19000101';
- }
- return rtn + '000000';
- }
-
- /**
- * [formatDate2StrDateNewTime description]
- * @param dt [鏃ユ湡]
- * @return [description]
- * 鎷兼帴鏃ユ湡/鏃堕棿锛屽弬鏁版棩鏈燂紙骞存湀鏃ワ級+ 褰撳墠鏃堕棿锛堟椂鍒嗙锛�
- */
- public static String formatDate2StrDateNewTime(Date dt) {
- String rtn = null;
- if (dt == null) {
- return rtn;
- }
- rtn = String.valueOf(dt);
- rtn = rtn.replaceAll('-', '');
- if (rtn >= '40001231') {
- rtn = '99991231';
- } else if (rtn < '19000101') {
- rtn = '19000101';
- }
-
- String phourMinuteSecond = String.valueOf(DateTime.now());
- if(phourMinuteSecond.length() >= 19){
- phourMinuteSecond = phourMinuteSecond.subString(10,19).replaceall(':', '');
- }
- return rtn + phourMinuteSecond;
- }
-
-
- /**
- * @return yyyyMMddHHmmss 銇棩浠樻枃瀛楀垪
- */
- public static String formatDateTime2Str(Datetime dt) {
- String rtn = null;
- if (dt == null) {
- return rtn;
- }
- rtn = String.valueOf(dt);
- rtn = rtn.replaceAll('-', '').replaceall(' ', '').replaceall(':', '');
- if (rtn >= '40001231000000') {
- rtn = '99991231000000';
- } else if (rtn < '19000101000000') {
- rtn = '19000101000000';
- }
- return rtn;
- }
-
- // LHJ Start
- /**
- * @return yyyyMMdd 銇棩浠樻枃瀛楀垪
- */
- public static String formatDate2StrSpo(Date dt) {
- String rtn = null;
- if (dt == null) {
- rtn = '2999-12-31';
- } else {
- rtn = String.valueOf(dt);
- }
- return rtn;
- }
-
- // LHJ Start
- /**
- * @return yyyy/MM/dd 銇棩浠樻枃瀛楀垪
- */
- public static String formatDateTime2StrSprit(DateTime dt) {
- String rtn = null;
- if (dt == null) {
- rtn = '';
- } else {
- String pDate = formatDateTime2Str(dt);
- rtn = Integer.valueOf(pDate.substring(0, 4)) + '/' +
- Integer.valueOf(pDate.substring(4, 6)) + '/' +
- Integer.valueOf(pDate.substring(6, 8));
- }
- return rtn;
- }
-
- /**
- * add wangweipeng 2022/02/11
- * [formatDateTime2StrDateTime description]
- * @param dt [鏃ユ湡/鏃堕棿]
- * @return [瀛楃涓瞉
- *
- * 姝ゆ柟娉曠敤浜庢柊寤烘暟鎹椂锛屾妸 鏃ユ湡/鏃堕棿 杞崲鎴愬瓧绗︿覆绫诲瀷锛屽苟鎶� 绉� 鍘绘帀
- */
- public static String formatDateTime2StrDateTime(DateTime dt){
- String rtn = null;
- if (dt == null) {
- return rtn;
- }
- rtn = String.valueOf(dt);
- rtn = rtn.replaceAll('-', '/');
- if (rtn >= '40001231000000') {
- rtn = '99991231000000';
- } else if (rtn < '19000101000000') {
- rtn = '19000101000000';
- }
- //鍘绘帀 绉�
- rtn = rtn.substring(0,rtn.length()-3);
- return rtn;
- }
-
- // LHJ End
-
public static Date parseStr2DateTimeDate(String pDateTime) {
if (pDateTime == null || pDateTime.length() != 14) {
return null;
}
return parseStr2Date(pDateTime.substring(0, 8));
}
-
- /**
- * add wangweipeng 2022/02/15
- * [parseStr2DateTime description]
- * @param pDate [鏃ユ湡锛堜笉鍖呮嫭鏃堕棿锛塢
- * @return [description]
- *
- * 鎷兼帴鏃ユ湡/鏃堕棿锛屽叾涓棩鏈熶负鐪熷疄鏃ユ湡锛屾椂闂翠负褰撳墠鏃堕棿
-
- */
- public static Datetime parseStr3DateTime(String pDate) {
- if (String.isBlank(pDate)) {
- return null;
- }
- String phourMinuteSecond = String.valueOf(DateTime.now());
- if(phourMinuteSecond.length() >= 19){
- phourMinuteSecond = phourMinuteSecond.subString(10,19).replaceall(':', '');
- }
- return parseStr2DateTime(pDate.substring(0, 8), phourMinuteSecond);
- }
-
public static Datetime parseStr2DateTime(String pDateTime) {
if (pDateTime == null || pDateTime.length() != 14) {
return null;
}
return parseStr2DateTime(pDateTime.substring(0, 8), pDateTime.substring(8, 14));
}
-
public static Datetime parseStr2DateTime(String pDate, String pTime) {
Datetime rtn = null;
try {
@@ -413,12 +135,12 @@
return null;
}
rtn = Datetime.newinstance(
- Integer.valueOf(pDate.substring(0, 4)),
- Integer.valueOf(pDate.substring(4, 6)),
- Integer.valueOf(pDate.substring(6, 8)),
- Integer.valueOf(pTime.substring(0, 2)),
- Integer.valueOf(pTime.substring(2, 4)),
- Integer.valueOf(pTime.substring(4, 6))
+ Integer.valueOf(pDate.substring(0, 4)),
+ Integer.valueOf(pDate.substring(4, 6)),
+ Integer.valueOf(pDate.substring(6, 8)),
+ Integer.valueOf(pTime.substring(0, 2)),
+ Integer.valueOf(pTime.substring(2, 4)),
+ Integer.valueOf(pTime.substring(4, 6))
);
} catch (Exception ex) {
System.debug(Logginglevel.ERROR, 'NFMUtil#parseStr2DateTime(' + pDate + ', ' + pTime + ')' + ex.getMessage());
@@ -438,7 +160,7 @@
public static Date parseStr2Date(String pStr, boolean changeToNull) {
Date rtn = null;
try {
- if (pStr == null || pStr.length() != 8 || pStr == '00000000') {
+ if (pStr == null || pStr.length() != 8) {
return rtn;
} else if (pStr > '40001231') {
pStr = '40001231';
@@ -449,36 +171,20 @@
return null;
}
rtn = Date.newinstance(
- Integer.valueOf(pStr.substring(0, 4)),
- Integer.valueOf(pStr.substring(4, 6)),
- Integer.valueOf(pStr.substring(6, 8))
+ Integer.valueOf(pStr.substring(0, 4)),
+ Integer.valueOf(pStr.substring(4, 6)),
+ Integer.valueOf(pStr.substring(6, 8))
);
} catch (Exception ex) {
System.debug(Logginglevel.ERROR, 'NFMUtil#parseStr2Date(' + pStr + ')' + ex.getMessage());
}
return rtn;
}
-
- /**
- * @param pStr yyyyMMdd 銇棩浠樻枃瀛楀垪
- * @param changeToNull 19000101浠ヤ笅銇牬鍚� null 銇鎻涖仚銈嬨亱銇┿亞銇�
- */
- public static Date parseDateTimeStr2Date(String pStr) {
- if (pStr == null || pStr.length() < 8) {
- return null;
- } else {
- pStr = pStr.replace('-', '').replace('/', '');
- String dateStr = pStr.substring(0, 8);
- return parseStr2Date(dateStr, true);
- }
- }
-
-
-
+
/**
* 銈傘仐key銇宮ap銇瓨鍦ㄣ仐銇亜鍫村悎銆乲ey銈掋仢銇伨銇炬埢銈�
*/
- public static String getMapValue(Map < String, String > transferMap, String col, String key, BatchIF_Log__c iflog) {
+ public static String getMapValue(Map<String, String> transferMap, String col, String key, BatchIF_Log__c iflog) {
String rtn = key;
if (transferMap == null) {
return rtn;
@@ -495,58 +201,6 @@
rtn = key;
}
return rtn;
- }
-
- /**
- * LMS浣跨敤(NFM601浣跨敤)
- * @return [description]
- */
- public static String getSignMD5(){
-
- String signText = appSecretLMS + '|' + requestURILMS + '|' + appSecretLMS;
- String signMD5 = EncodingUtil.convertToHex(Crypto.generateDigest('MD5', Blob.valueOf(signText))).toUpperCase();
- String result = signMD5;
- return signMD5;
- }
-
- public static String randomUUID(Integer length) {
-
- String result = '';
- for (Integer i = 0; i < length; i++) {
-
- Integer ran = (Math.random() * 16).intValue();
- if (ran == 10) {
- result += 'A';
- } else if (ran == 11) {
- result += 'B';
- } else if (ran == 12) {
- result += 'C';
- } else if (ran == 13) {
- result += 'D';
- } else if (ran == 14) {
- result += 'E';
- } else if (ran == 15) {
- result += 'F';
- } else {
- result += ran.format();
- }
-
- }
- return result;
- }
-
- public static String getToken(String randomstr, long timestamp) {
- if (randomstr == null) {
- randomstr = randomUUID(16);
- }
- System.debug('-------------------randomstr:' + randomstr);
- System.debug('-------------------timestamp:' + timestamp);
- String str = 'appkey=' + APP_KEY + '×tamp=' + timestamp + '&random_str=' + randomstr + '&key=' + APP_KEY;
-
- String result = EncodingUtil.convertToHex(Crypto.generateDigest('MD5', Blob.valueOf(str)));
- System.debug('-------------------result:' + result);
- return result;
-
}
/**
@@ -567,10 +221,45 @@
}
public static Boolean isSandbox() {
- //return URL.getSalesforceBaseUrl().getHost().left(2).equalsignorecase('cs') || URL.getSalesforceBaseUrl().toExternalForm().CONTAINS('.cs');
+ //System.debug(URL.getSalesforceBaseUrl().getHost());
+ //return URL.getSalesforceBaseUrl().getHost().left(2).equalsignorecase('cs');
return [SELECT IsSandbox FROM Organization LIMIT 1].IsSandbox;
+
}
+ public static void sendToSap(String rowDataStr, String endpoint) {
+
+ Http http = new Http();
+ HttpRequest req = new HttpRequest();
+ HTTPResponse res;
+ String resb;
+
+ req.setTimeout(120000);
+ req.setEndpoint(endpoint);
+ req.setMethod('POST');
+ req.setHeader('Authorization', CBPR_Auth_Sap);
+ req.setBody(rowDataStr);
+
+ res = http.send(req);
+ resb = res.getBody();
+ }
+
+ public static String sendToSapRet(String rowDataStr, String endpoint) {
+ Http http = new Http();
+ HttpRequest req = new HttpRequest();
+ HTTPResponse res;
+ String resb;
+
+ req.setTimeout(120000);
+ req.setEndpoint(endpoint);
+ req.setMethod('POST');
+ req.setHeader('Authorization', CBPR_Auth_Sap);
+ req.setBody(rowDataStr);
+
+ res = http.send(req);
+ resb = res.getStatus();
+ return resb;
+ }
public static BatchIF_Log__c makeRowData(NFMUtil.Monitoring Monitoring, String NFMType, Object NFMData) {
BatchIF_Log__c rowData = new BatchIF_Log__c();
rowData.Type__c = NFMType;
@@ -597,44 +286,15 @@
}
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();
- String nowStr = nowDT.format('yyyyMMddHHmm');
+ public static BatchIF_Log__c saveRowData(NFMUtil.Monitoring Monitoring, String NFMType, Object NFMData) {
BatchIF_Log__c rowData = new BatchIF_Log__c();
rowData.Type__c = NFMType;
- rowData.MessageGroupNumber__c = iflog.Name;
- rowData.TransmissionDateTime__c = nowStr;
+ rowData.MessageGroupNumber__c = Monitoring.MessageGroupNumber;
+ rowData.TransmissionDateTime__c = Monitoring.TransmissionDateTime;
rowData.RowDataFlg__c = true;
rowData.Log__c = '';
rowData.ErrorLog__c = '';
+ insert rowData;
String rowDataStr = JSON.serialize(NFMData);
if (rowDataStr.length() > 0) {
Integer splitIdx = 1;
@@ -650,15 +310,12 @@
splitIdx++;
rowDataStr = rowDataStr.substring((rowDataStr.length() > MaxLogColumnLength ? MaxLogColumnLength : rowDataStr.length()));
}
+ update rowData;
}
return rowData;
}
+
- public static BatchIF_Log__c saveRowData(NFMUtil.Monitoring Monitoring, String NFMType, Object NFMData) {
- BatchIF_Log__c rowData = makeRowData(Monitoring, NFMType, NFMData);
- insert rowData;
- return rowData;
- }
public static String getRowDataStr(BatchIF_Log__c rowData) {
String rowDataStr = rowData.Log__c;
Integer splitIdx = 2;
@@ -672,853 +329,43 @@
}
return rowDataStr;
}
+ //杞崲琛ㄨ浆鎹㈠悗鐨勬暟鎹�
+ public static Map<String,String> BatchIF_Transfer(String object_API_Name) {
- // 20180823 LHJ C-BPR Spo鎺ュ彛璁よ瘉 Start
-
- public class Token_Response {
- public String expires_in;
- public String access_token;
+ Map<String, String> result = new Map<String, String>();
+ List<BatchIF_Transfer__c> transferList = [select Table__c,
+ Column__c,
+ External_value__c,
+ Internal_value__c
+ from BatchIF_Transfer__c
+ where Dropped_Flag__c = false
+ and Table__c = :object_API_Name];
+ for (BatchIF_Transfer__c t : transferList) {
+ result.put(t.Column__c + t.External_value__c, t.Internal_value__c);
+ }
+ return result;
}
-
-
- public class AWS_Response {
- public Integer code;
- public String msg;
- public String data;
+//add for pipl sushanhu 20220311 start
+ global class NFMResponse{
+ public Boolean SFStatus;
+ public String SFMessage;
+ public StaticResponse staticResponse;
}
-
- public static String sendToSpoRet(String rowDataStr, String endpoint) {
- Http http = new Http();
- HttpRequest req = new HttpRequest();
- HTTPResponse res;
- String resb;
-
- // 鑾峰彇token
- req.setEndpoint(CBPR_Auth_Spo);
- req.setMethod('POST');
- req.setHeader('grant_type', 'password');
- req.setHeader('username', CBPR_UserName_Spo);
- req.setHeader('password', CBPR_Password_Spo);
- req.setBody('');
- res = http.send(req);
- resb = res.getBody();
-
- Token_Response tr = (Token_Response) JSON.deserialize(resb, Token_Response.class);
- // 鍙戦�佹帴鍙�
- Http http2 = new Http();
- HttpRequest req2 = new HttpRequest();
- HTTPResponse res2;
- String resb2;
-
- req2.setTimeout(110000);
- req2.setEndpoint(endpoint);
- req2.setMethod('POST');
- req2.setHeader('access_token', tr.access_token);
- req2.setHeader('Content-Type', 'application/json');
- req2.setBody(rowDataStr);
- res2 = http2.send(req2);
- resb2 = res2.getStatus();
-
- return resb2;
- }
-
- /*
- send to AWS
- */
- public static String sendToAWS(String rowDataStr, String endpoint) {
-
- Http http = new Http();
- HttpRequest req = new HttpRequest();
- HTTPResponse res;
- String resb;
- system.debug('sendToAWS--->rowDataStr----->'+rowDataStr);
- // List<GeDatas> GeDataList = (List<GeDatas>) JSON.deserialize(rowDataStr, List<GeData>.class);
- req.setTimeout(120000);
- req.setEndpoint(AWS_DOMAIN + endpoint);
- req.setMethod('POST');
- //req.setHeader('Authorization', CBPR_Auth_AWS);
- String randomstr = randomUUID(16);
- long timestamp = DateTime.now().getTime();
- req.setHeader('Content-Type', 'application/json');
- req.setHeader('API-RANDOM-STR', randomstr);
- req.setHeader('API-TIME', timestamp + '');
- req.setHeader('API-TOKEN', getToken(randomstr, timestamp));
- req.setBody(rowDataStr);
- system.debug('req--->'+req);
- //return '';
- res = http.send(req);
- // resb = res.getBody();
- resb = res.getStatus();
- //AWS_Response tr = (AWS_Response) JSON.deserialize(resb, AWS_Response.class);
- return resb;
-
- }
-
- public static void sendToSpo(String rowDataStr, String endpoint) {
-
- Http http = new Http();
- HttpRequest req = new HttpRequest();
- HTTPResponse res;
- String resb;
-
- // 鑾峰彇token
- req.setEndpoint(CBPR_Auth_Spo);
- req.setMethod('POST');
- req.setHeader('grant_type', 'password');
- req.setHeader('username', CBPR_UserName_Spo);
- req.setHeader('password', CBPR_Password_Spo);
- req.setBody('');
- res = http.send(req);
- resb = res.getBody();
-
- Token_Response tr = (Token_Response) JSON.deserialize(resb, Token_Response.class);
- // 鍙戦�佹帴鍙�
- Http http2 = new Http();
- HttpRequest req2 = new HttpRequest();
- HTTPResponse res2;
- String resb2;
-
- req2.setTimeout(120000);
- req2.setEndpoint(endpoint);
- req2.setMethod('POST');
- req2.setHeader('access_token', tr.access_token);
- req2.setHeader('Content-Type', 'application/json');
- req2.setBody(rowDataStr);
- res2 = http2.send(req2);
- resb2 = res2.getStatus();
-
- }
-
- // 20180823 LHJ C-BPR Sap鎺ュ彛璁よ瘉 Start
- public static void sendToSap(String rowDataStr, String endpoint) {
-
- Http http = new Http();
- HttpRequest req = new HttpRequest();
- HTTPResponse res;
- String resb;
-
- req.setTimeout(120000);
- req.setEndpoint(endpoint);
- req.setMethod('POST');
- req.setHeader('Authorization', CBPR_Auth_Sap);
- req.setBody(rowDataStr);
-
- res = http.send(req);
- resb = res.getBody();
- }
-
- // 20180823 LHJ C-BPR Sap鎺ュ彛璁よ瘉 Start
- public static String sendToETQ(String rowDataStr, String endpoint) {
-
- Http http = new Http();
- HttpRequest req = new HttpRequest();
- HTTPResponse res;
- String resb;
-
- req.setTimeout(120000);
- req.setEndpoint(endpoint);
- req.setMethod('POST');
- req.setHeader('Content-Type', 'application/json');
- req.setBody(rowDataStr);
-
- res = http.send(req);
- resb = res.getStatus();
- system.debug('resb:' + resb);
- return resb;
- }
-
- public static String sendToSapRet(String rowDataStr, String endpoint) {
-
- Http http = new Http();
- HttpRequest req = new HttpRequest();
- HTTPResponse res;
- String resb;
-
- req.setTimeout(120000);
- req.setEndpoint(endpoint);
- req.setMethod('POST');
- req.setHeader('Authorization', CBPR_Auth_Sap);
- req.setBody(rowDataStr);
-
- res = http.send(req);
- resb = res.getStatus();
- system.debug('resb:' + resb);
- return resb;
- }
- // WLIG-BXQBH6 棰濆鎺ユ敹reponse 鐨刡ody start
- public static response sendToSapStatusAndBody(String rowDataStr, String endpoint) {
-
- Http http = new Http();
- HttpRequest req = new HttpRequest();
- HTTPResponse res;
- String resb;
-
- req.setTimeout(120000);
- req.setEndpoint(endpoint);
- req.setMethod('POST');
- req.setHeader('Authorization', CBPR_Auth_Sap);
- req.setBody(rowDataStr);
-
- res = http.send(req);
- string ress = res.getStatus();
- resb = res.getBody();
- system.debug('ress:' + ress);
- return new response(ress, resb);
- }
-
- public class response {
+ global class StaticResponse{
public string status;
- public string responseBody;
- public response(string status, string responseBody) {
- this.status = status;
- this.responseBody = responseBody;
+ public String Message;
+ public StaticResponse(){
+ status='0';
+ Message='';
}
}
- // WLIG-BXQBH6 end
- //---------- insert by rentongxaio 2020-08-19 Start
- public static String getETQData(String rowDataStr, String endpoint) {
-
- HttpRequest req = new HttpRequest();
- //endPoint 灏辨槸璇锋眰璺緞
- req.setEndpoint(endpoint);
- req.setMethod('POST');
- req.setHeader('Content-Type', 'application/json');
- //璇锋眰鍙傛暟
- req.setBody(rowDataStr);
-
- Http http = new Http();
- HTTPResponse res = http.send(req);
-
- String responseBody = res.getBody();
- return responseBody;
+ public static NFMResponse getNFMResponse(){
+ NFMResponse result=new NFMResponse();
+ result.staticResponse =new StaticResponse();
+ return result;
+
}
+//add for pipl sushanhu 20220311 end
- //---------- insert by rentongxiao 2020-08-19 End
-
-
- //杩斿洖鏍煎紡: hh:ss:mm
- //insert by rentongxiao 2020-10-12 start
- public static Time parseStr2Time(String timeStr) {
- if (timeStr.length() != 6) {
- return null;
- }
- return Time.newInstance(
- Integer.valueOf(timeStr.substring(0, 2)),
- Integer.valueOf(timeStr.substring(2, 4)),
- Integer.valueOf(timeStr.substring(4, 6)),
- 0);
- }
- //insert by rentongxiao 2020-10-12 end
-
- //鍗冮噷椹�
- //鎺ュ彛1锛岃幏鍙杢oken
- public class Body {
- public String msg;
- public String access_token;
- public String code;
- }
- public class Body502 {
- public String msg;
- public String data1;
- public String code;
- }
-
- public static response receiveToken() {
- //1銆� 鑾峰彇token:
- Http http = new Http();
- HttpRequest req = new HttpRequest();
- String content = 'appKey=' + EncodingUtil.urlEncode(appKey, 'UTF-8') +
- '&appSecret=' + EncodingUtil.urlEncode(appSecret, 'UTF-8');
- //璇锋眰璺緞
- req.setEndpoint(QLM_Token);
- req.setHeader('Content-Type', QLM_NFM501_Point);
- req.setMethod('POST');
- //璇锋眰鍙傛暟
- req.setBody(content);
- //涓や釜code鍒嗗埆涓猴細
- //1.http锛歝ode鍜岀姸鎬�
- //2.
- HTTPResponse response = http.send(req);
- string ress = response.getStatus();
- System.debug('response:' + response);
- System.debug('Status:' + ress);
- //`1.http:code鍜岀姸鎬�
- //濡傛灉鐘舵�佷笉閫氳繃锛屽垯涓轰粬鍏剁姸鎬佸強token = null杩斿洖
-
- if (string.isBlank(ress) || !ress.replace('o', 'O').replace('k', 'K').equals('OK')) {
- return new response(ress, null);
- }
-
- String responseBodyToken = response.getBody();
- System.debug('Body:' + responseBodyToken);
- Body BodyToken = (Body) JSON.deserializeStrict(responseBodyToken, Body.class);
- System.debug('======1=====' + BodyToken.code);
- //濡傛灉瑙f瀽鏃禼ode涓嶄负0锛屽垯灏嗗叾閿欒淇℃伅鍙妕oken = null杩斿洖
- if (String.isBlank(BodyToken.code) || !BodyToken.code.equals('0')) {
- System.debug('======12=====' + BodyToken.code);
- return new response(BodyToken.msg, null);
- }
- //姝e父鎵ц
- String token = BodyToken.access_token;
- return new response(ress, token);
- }
-
- //鎺ュ彛2锛岃幏鍙栨帴鍙d腑鐨勬暟鎹� 鍜� 鎺ュ彛3锛岃幏鍙栭〉闈�
- public static response getQLMData(String endpoint, String token) {
- //2銆佽幏鍙栨嫑鏍囦俊鎭細璁板緱浣跨敤1涓幏鍙栫殑token
- Http http = new Http();
- HttpRequest req = new HttpRequest();
- req.setHeader('Content-Type', QLM_NFM501_Point);
- req.setHeader('open-authorization', 'Bearer' + token);
- req.setTimeout(120000);
- req.setEndpoint(endpoint);
- req.setMethod('GET');
-
- HTTPResponse response = http.send(req);
- String ress = response.getStatus();
- System.debug('response:' + response);
- //http锛氱姸鎬佸拰code
- //濡傛灉鐘舵�佷笉閫氳繃 锛� 鍒欏皢鐘舵�佸強绌虹殑鐨勬暟鎹� 锛� 杩斿洖
- if (string.isBlank(ress) || !ress.replace('o', 'O').replace('k', 'K').equals('OK')) {
- return new response(ress, null);
- }
- System.debug('=====2======' + response.getBody());
- //姝e父鎵ц
- return new response(ress, response.getBody());
- }
-
- //鎺ュ彛3锛岃幏鍙栧叾浠栭檮浠�
- public static response503 getFileData(String token503, String endpoint) {
- //4銆佽幏鍙栫綉椤碉細璁板緱浣跨敤1涓幏鍙栫殑token锛岃寰桬ndPoint 浣跨敤2涓幏鍙栫殑缃戦〉
- try {
- Http http503 = new Http();
- HttpRequest req503 = new HttpRequest();
- req503.setHeader('open-authorization', 'Bearer' + token503);
- req503.setTimeout(120000);
- req503.setEndpoint(endpoint);
- req503.setMethod('GET');
-
- HTTPResponse NFM503response = http503.send(req503);
- System.debug('NFM503response:' + NFM503response);
- System.debug('12345678' + NFM503response.getHeader('Content-Disposition'));
- String ress503 = NFM503response.getStatus();
- if (string.isBlank(ress503) || !ress503.replace('o', 'O').replace('k', 'K').equals('OK')) {
- return new response503(ress503, null, null);
- }
-
- string str = NFM503response.getHeader('Content-Disposition');
- string fileName = str.replaceall('filename=', '').replaceall('attachment;', '');
- fileName = EncodingUtil.urlDecode(fileName, 'utf-8');
- Blob responseBody503 = NFM503response.getBodyAsBlob();
- System.debug('=====2======' + NFM503response.getBodyAsBlob());
- return new response503(ress503, responseBody503, fileName);
- } catch (Exception ex) {
- return new response503('', Blob.valueOf('鏂囦欢澶у皬瓒呰繃12M'), '鏂囦欢澶у皬瓒呰繃12M');
- }
- }
-
- public class response503 {
- public string status;
- public Blob responseBody;
- public String Name;
- public response503(string status, Blob responseBody, String Name) {
- this.status = status;
- this.responseBody = responseBody;
- this.Name = Name;
- }
- }
-
- //鎺ュ彛4锛屽彂閫佽鍒犻櫎椤圭洰鐨勪俊鎭疘d銆傘�傘��2021/9/2,閫昏緫鍒犻櫎鏂板姞鎺ュ彛 fxk
- public static String sendTenInfo(String token504, String jsonStr, String endpoint) {
- Http http = new Http();
- HttpRequest req = new HttpRequest();
- req.setEndpoint('http://cusdata.qianlima.com/test/v1/customer/albs/feedback');
- req.setHeader('open-authorization', 'Bearer' + token504);
- req.setHeader('Content-Type', 'application/x-www-form-urlencoded');
- req.setMethod('POST');
- req.setBody(jsonStr);
-
- HTTPResponse response = http.send(req);
- string ress = response.getStatus();
- // if (string.isBlank(ress) || !ress.replace('o', 'O').replace('k', 'K').equals('OK')) {
- // return new response(ress, null);
- // }
- System.debug('Body ' + response.getBody());
- System.debug('Status ' + response.getStatus());
- System.debug('Status code ' + response.getStatusCode());
- return ress;
- }
-
-
- // 鏈�澶у�间负3锛岀敤鏉ヤ綔涓哄垽鏂敊璇殑鏉′欢锛堥噸鍙戜笁娆★級
- public static Integer batch_retry_max_cnt = Integer.valueOf(System.Label.batch_retry_max_cnt);
- public static void againSendRequest(BatchIF_Log__c iflog, String count, BatchIF_Log__c rowData, String errorStr) {
- //鍒ゆ柇rowdata涓暟鎹幏鍙栨垚鍔熶笌鍚︼紝濡傛灉澶辫触閲嶅彂涓夋锛屽鏋滃ぇ浜庝笁娆″垯鎵嬪姩鎿嶄綔
- System.debug('----====---9-------');
- Integer rowDataStr = Integer.valueOf(rowData.get(count));
- if (rowDataStr == null) {
- rowDataStr = 0;
- }
- if (rowDataStr < batch_retry_max_cnt) {
- rowDataStr++;
- LogAutoSendSchedule.assignOneMinute();
- }
- if (rowDataStr >= batch_retry_max_cnt) {
- iflog.ErrorLog__c += errorStr;
- rowData.ErrorLog__c += errorStr;
- }
- upsert rowData;
- upsert iflog;
- rowData.put(count, rowDataStr);
- }
-
- //鍥爈og瀛樺叆鏁版嵁鏈夐檺锛屾墍浠ラ槻姝㈡暟鎹お澶�
- public static String QLMgetRowDataStr(BatchIF_Log__c rowData) {
- String QLMDataStr = rowData.Log__c;
- Integer splitIdx = 2;
- while (rowData.get('Log' + splitIdx + '__c') != null && String.isBlank('' + rowData.get('Log' + splitIdx + '__c')) == false) {
- QLMDataStr += rowData.get('Log' + splitIdx + '__c');
- splitIdx++;
- if (splitIdx == 13) break;
- }
- return QLMDataStr;
- }
-
- //鍒涘缓RowDataFlg绫诲瀷鐨勬棩蹇�
- // public static BatchIF_Log__c QLMsaveRowData( String NFMType, Object NFMData) {
- // BatchIF_Log__c rowData = QLMmakeRowData( NFMType, NFMData);
- // insert rowData;
- // return rowData;
- // }
-
- public static BatchIF_Log__c QLMmakeRowData(String response, BatchIF_Log__c rowData) {
-
- rowData.Log__c = '';
- rowData.ErrorLog__c = '';
- String rowDataStr = response;
- Integer MaxLogColumnLength = 131072;
- 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 LogAutoSend(BatchIF_Log__c rowDataSFDC, Exception ex, String status) {
- 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++;
- LogAutoSendSchedule.assignOneMinute();
- }
- 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;
- }
- // https://oly.ngrok.kunchuangtech.net/api/sso/sfdc_activitydata
- //鍙戦�佺粰鍏遍�氬钩鍙� 绮剧悽鎶�鏈� thh 2021-09-22 start
- public static String sendToComPlat(String rowDataStr, String endpoint) {
- Http http = new Http();
- HttpRequest req = new HttpRequest();
- HTTPResponse res;
- String resb;
-
- req.setTimeout(120000);
- req.setEndpoint(endpoint);
- req.setMethod('POST');
- req.setHeader('Content-Type', 'application/json');
- req.setBody(rowDataStr);
-
- res = http.send(req);
- resb = res.getStatus();
- system.debug('resb:' + resb);
- return resb;
- }
-
-
- //鍙戦�佺粰鍏遍�氬钩鍙� 绮剧悽鎶�鏈� thh 2021-09-22 end
-
- public static Integer ControllerUtil() {
- Integer i = 0;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- i++;
- return i;
- }
+ public static Boolean EscapeSBG001TriggerHandler = false;
}
\ No newline at end of file
--
Gitblit v1.9.1