From f24a5026dbfb2981e234ce46ed503584c03ce420 Mon Sep 17 00:00:00 2001
From: 涂煌豪 <tuhuanghao@prec-tech.com>
Date: 星期一, 18 四月 2022 17:49:35 +0800
Subject: [PATCH] SelectAssetEstimateVMController
---
force-app/main/default/classes/NFMUtil.cls | 149 +++++++++++++++++++++++++++++++++++++++----------
1 files changed, 119 insertions(+), 30 deletions(-)
diff --git a/force-app/main/default/classes/NFMUtil.cls b/force-app/main/default/classes/NFMUtil.cls
index 064e12f..91cf2fc 100644
--- a/force-app/main/default/classes/NFMUtil.cls
+++ b/force-app/main/default/classes/NFMUtil.cls
@@ -78,7 +78,8 @@
//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';
+ // NFM103_ENDPOINT = 'http://wdp.olympus.com.cn:8089/RESTAdapter/NFM103';
+ NFM103_ENDPOINT = 'https://sfpi-mebg-test.olympuschina.com/api/nfm/103';//aws 103鎺ュ彛
// 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';
@@ -100,7 +101,7 @@
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/';
+ 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 U0ZEQ19XU1VTRVI6cG9xMTIzNDU=';
@@ -109,7 +110,7 @@
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';
@@ -127,11 +128,11 @@
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';
@@ -158,7 +159,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';
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=';
@@ -183,7 +184,7 @@
//鏍锋湰绠$悊
NFM115_ENDPOINT = 'https://wdp.olympus.com.cn:44302/RESTAdapter/NFM115';
- // 鏂版湇鍔$郴缁�
+ // 鏂版湇鍔$郴缁�
AWS_DOMAIN = 'https://svc-elb.olympuschina.com';
requestURILMS = '/v1/uc/user/syncOlympusUnit';
@@ -233,7 +234,27 @@
webservice String timestamp;
webservice String appKey;
}
-
+ // add to aws response sushanhu 20220224 start
+ global class NFMResponse{
+ public Boolean SFStatus;
+ public String SFMessage;
+ public StaticResponse staticResponse;
+ }
+ global class StaticResponse{
+ public string status;
+ public String Message;
+ public StaticResponse(){
+ status='Success';
+ Message='';
+ }
+ }
+ public static NFMResponse getNFMResponse(){
+ NFMResponse result=new NFMResponse();
+ result.staticResponse =new StaticResponse();
+ return result;
+
+ }
+// add to aws response sushanhu 20220224 end
/**
* @return yyyyMMdd 銇棩浠樻枃瀛楀垪
*/
@@ -346,7 +367,7 @@
return rtn;
}
- /**
+ /**
* add wangweipeng 2022/02/11
* [formatDateTime2StrDateTime description]
* @param dt [鏃ユ湡/鏃堕棿]
@@ -380,7 +401,7 @@
return parseStr2Date(pDateTime.substring(0, 8));
}
- /**
+ /**
* add wangweipeng 2022/02/15
* [parseStr2DateTime description]
* @param pDate [鏃ユ湡锛堜笉鍖呮嫭鏃堕棿锛塢
@@ -421,13 +442,13 @@
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());
}
@@ -457,10 +478,10 @@
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());
}
@@ -606,7 +627,7 @@
return rowData;
}
- // public static BatchIF_Log__c makeRowDataToOnline(NFMUtil.MonitoringToOnline Monitoring, String NFMType, Object NFMData) {
+ // 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;
@@ -873,7 +894,30 @@
system.debug('ress:' + ress);
return new response(ress, resb);
}
+ // send to aws to sap sushuanhu 20220222
+ public static response sendToPiAWS(String rowDataStr, String endpoint,String awsToken) {
+ 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.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);
+ }
+ // 鑾峰彇aws token sushanhu 20220222
+ public static response getAwsToken(){
+ String responseBody = AWSServiceTool.getAWSToken();
+ return new response('success', responseBody);
+ }
public class response {
public string status;
public string responseBody;
@@ -911,10 +955,10 @@
return null;
}
return Time.newInstance(
- Integer.valueOf(timeStr.substring(0, 2)),
- Integer.valueOf(timeStr.substring(2, 4)),
- Integer.valueOf(timeStr.substring(4, 6)),
- 0);
+ 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
@@ -935,8 +979,8 @@
//1銆� 鑾峰彇token:
Http http = new Http();
HttpRequest req = new HttpRequest();
- String content = 'appKey=' + EncodingUtil.urlEncode(appKey, 'UTF-8') +
- '&appSecret=' + EncodingUtil.urlEncode(appSecret, 'UTF-8');
+ 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);
@@ -994,6 +1038,51 @@
//姝e父鎵ц
return new response(ress, response.getBody());
}
+ // NEW QLM AWS 501 鎺ュ彛 sushanhu 20220223
+ public static response getAWSQLMData(String endpoint, String token) {
+ //2銆佽幏鍙栨嫑鏍囦俊鎭細璁板緱浣跨敤1涓幏鍙栫殑token
+ Http http = new Http();
+ HttpRequest req = new HttpRequest();
+ req.setHeader('Content-Type', 'application/json');
+ req.setHeader('pi-token', token);
+ req.setTimeout(120000);
+ req.setEndpoint(endpoint);
+ req.setMethod('GET');
+ HTTPResponse response = http.send(req);
+ String statusCode = String.valueof(response.getStatusCode());
+ System.debug('response:' + response);
+ //http锛氱姸鎬佸拰code
+ //濡傛灉鐘舵�佷笉閫氳繃 锛� 鍒欏皢鐘舵�佸強绌虹殑鐨勬暟鎹� 锛� 杩斿洖
+ // if (String.isNotBlank(statusCode)) {
+ // return new response(statusCode, null);
+ // }
+ System.debug('=====2======' + response.getBody());
+ //姝e父鎵ц
+ return new response(statusCode, response.getBody());
+ }
+ // NEW QLM AWS 502 503鎺ュ彛 sushanhu 20220223
+ public static response getAWSQLMData(String endpoint,String jsonStr, String token) {
+ //2銆佽幏鍙栨嫑鏍囦俊鎭細璁板緱浣跨敤1涓幏鍙栫殑token
+ Http http = new Http();
+ HttpRequest req = new HttpRequest();
+ req.setHeader('Content-Type', 'application/json');
+ req.setHeader('pi-token', token);
+ req.setTimeout(120000);
+ req.setEndpoint(endpoint);
+ req.setMethod('POST');
+ req.setBody(jsonStr);
+ HTTPResponse response = http.send(req);
+ String statusCode = String.valueof(response.getStatusCode());
+ System.debug('response:' + response);
+ //http锛氱姸鎬佸拰code
+ //濡傛灉鐘舵�佷笉閫氳繃 锛� 鍒欏皢鐘舵�佸強绌虹殑鐨勬暟鎹� 锛� 杩斿洖
+ // if (String.isNotBlank(statusCode)) {
+ // return new response(statusCode, null);
+ // }
+ System.debug('=====2======' + response.getBody());
+ //姝e父鎵ц
+ return new response(statusCode, response.getBody());
+ }
//鎺ュ彛3锛岃幏鍙栧叾浠栭檮浠�
public static response503 getFileData(String token503, String endpoint) {
@@ -1040,7 +1129,7 @@
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.setEndpoint(endpoint);
req.setHeader('open-authorization', 'Bearer' + token504);
req.setHeader('Content-Type', 'application/x-www-form-urlencoded');
req.setMethod('POST');
@@ -1159,7 +1248,7 @@
return resb;
}
//鍙戦�佺粰鍏遍�氬钩鍙� 绮剧悽鎶�鏈� thh 2021-09-22 end
-
+
public static Integer ControllerUtil() {
Integer i = 0;
i++;
--
Gitblit v1.9.1