From 01f207d979d6be17c8cdec293feab48828c0ec3e Mon Sep 17 00:00:00 2001
From: 黄千龙 <huangqianlong@prec-tech.com>
Date: 星期五, 08 四月 2022 14:22:52 +0800
Subject: [PATCH] Merge branch 'master' of http://47.92.229.245:8089/r/OlyMEBG
---
force-app/main/default/classes/NFM502Controller.cls | 792 ++++++++++++++++++++++++++++----------------------------
1 files changed, 399 insertions(+), 393 deletions(-)
diff --git a/force-app/main/default/classes/NFM502Controller.cls b/force-app/main/default/classes/NFM502Controller.cls
index c699cea..0442dff 100644
--- a/force-app/main/default/classes/NFM502Controller.cls
+++ b/force-app/main/default/classes/NFM502Controller.cls
@@ -1,408 +1,414 @@
public with sharing class NFM502Controller implements Queueable {
- public String rowData_id;
- //add staic sushanhu 20220302 start
- public static String transUrl;
- public static String transId;
- public static String token;
- public static List<String> sfRecordIds =new List<String>();
- //add staic sushanhu 20220302 end
- public NFM502Controller(String rowData_id) {
- this.rowData_id = rowData_id;
- }
+ public String rowData_id;
+ //add staic sushanhu 20220302 start
+ public static String transUrl;
+ public static String transId;
+ public static String token;
+ public static List<String> sfRecordIds =new List<String>();
+ //add staic sushanhu 20220302 end
+ public NFM502Controller(String rowData_id) {
+ this.rowData_id = rowData_id;
+ }
- public static Integer batch_retry_max_cnt = Integer.valueOf(System.Label.batch_retry_max_cnt);
- public void execute(QueueableContext context) {
- // 閫氳繃Rowdata.Id鏉ユ绱㈡棩蹇椾腑鐨勫唴瀹癸紙鍗冮噷椹暟鎹瓑锛�
- BatchIF_Log__c rowData = [Select Id, Name, Log__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,
- NFM501Future_Count__c,
- NFM501_Web_Annex_Count__c
- from BatchIF_Log__c where RowDataFlg__c = true and Id = :rowData_id];
- //瀛樻斁鎶ラ敊淇℃伅
- BatchIF_Log__c iflog502 = new BatchIF_Log__c();
- iflog502.Type__c = 'NFM501';
- iflog502.RowDataFlg__c = false;
- iflog502.Log__c = ' ';
- iflog502.ErrorLog__c = ' ';
- iflog502.MessageGroupNumber__c = rowData.MessageGroupNumber__c;
- insert iflog502;
- NFM502Controller.WebAnnexGain(rowData.Id, iflog502.Id, false);
- }
- @future(callout = true)
- public static void WebAnnexGain(String rowData_id, String iflog502_id, boolean Manual_execution502) {
- BatchIF_Log__c rowData = [Select Id, Name, Log__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,
- NFM501Future_Count__c,
- NFM501_Web_Annex_Count__c from BatchIF_Log__c
- where RowDataFlg__c = true and Id = :rowData_id];
- BatchIF_Log__c iflog502 = [Select Id, Name, Log__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,
- NFM501Future_Count__c,
- NFM501_Web_Annex_Count__c from BatchIF_Log__c
- where Id = :iflog502_id];
+ public static Integer batch_retry_max_cnt = Integer.valueOf(System.Label.batch_retry_max_cnt);
+ public void execute(QueueableContext context) {
+ // 閫氳繃Rowdata.Id鏉ユ绱㈡棩蹇椾腑鐨勫唴瀹癸紙鍗冮噷椹暟鎹瓑锛�
+ BatchIF_Log__c rowData = [Select Id, Name, Log__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,
+ NFM501Future_Count__c,
+ NFM501_Web_Annex_Count__c
+ from BatchIF_Log__c where RowDataFlg__c = true and Id = :rowData_id];
+ //瀛樻斁鎶ラ敊淇℃伅
+ BatchIF_Log__c iflog502 = new BatchIF_Log__c();
+ iflog502.Type__c = 'NFM501';
+ iflog502.RowDataFlg__c = false;
+ iflog502.Log__c = ' ';
+ iflog502.ErrorLog__c = ' ';
+ iflog502.MessageGroupNumber__c = rowData.MessageGroupNumber__c;
+ insert iflog502;
+ NFM502Controller.WebAnnexGain(rowData.Id, iflog502.Id, false);
+ }
+ @future(callout = true)
+ public static void WebAnnexGain(String rowData_id, String iflog502_id, boolean Manual_execution502) {
+ BatchIF_Log__c rowData = [Select Id, Name, Log__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,
+ NFM501Future_Count__c,
+ NFM501_Web_Annex_Count__c from BatchIF_Log__c
+ where RowDataFlg__c = true and Id = :rowData_id];
+ BatchIF_Log__c iflog502 = [Select Id, Name, Log__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,
+ NFM501Future_Count__c,
+ NFM501_Web_Annex_Count__c from BatchIF_Log__c
+ where Id = :iflog502_id];
- iflog502.Log__c = iflog502.Log__c == null ? '' : iflog502.Log__c;
- iflog502.ErrorLog__c = iflog502.ErrorLog__c == null ? '' : iflog502.ErrorLog__c;
- rowData.Log__c = rowData.Log__c == null ? '' : rowData.Log__c;
- rowData.ErrorLog__c = rowData.ErrorLog__c == null ? '' : rowData.ErrorLog__c;
+ iflog502.Log__c = iflog502.Log__c == null ? '' : iflog502.Log__c;
+ iflog502.ErrorLog__c = iflog502.ErrorLog__c == null ? '' : iflog502.ErrorLog__c;
+ rowData.Log__c = rowData.Log__c == null ? '' : rowData.Log__c;
+ rowData.ErrorLog__c = rowData.ErrorLog__c == null ? '' : rowData.ErrorLog__c;
- // Savepoint sp = Database.setSavepoint();
- try {
- //update 鍚宻taic 20220302 satrt
- // String token;
- //update 鍚宻taic 20220302 end
- Datetime oldTime;
- // 浠庤浆鎹㈣〃涓幏鍙杢oken
- BatchIF_Transfer__c token502 = [Select ID, NFM501_Token__c
- FROM BatchIF_Transfer__c Where Table__c = 'NFM501Token'];
- token = token502.NFM501_Token__c;
- // 浠庤浆鎹㈣〃涓幏鍙栬幏鍙栧畬token鐨勬椂闂�
- BatchIF_Transfer__c oldTime502 = [Select ID, NFM501_Gain_End_Time__c
- FROM BatchIF_Transfer__c Where Table__c = 'NFM501GainEndTime'];
- oldTime = oldTime502.NFM501_Gain_End_Time__c;
- // 瀵规棩蹇椾腑鐨勬暟鎹繘琛岃В鏋�
- String WebUrl = NFMUtil.QLMgetRowDataStr(rowData);
- NFM501Controller.AllData getQLMData502 = (NFM501Controller.AllData)
- JSON.deserialize(WebUrl, NFM501Controller.AllData.class);
- if (getQLMData502 == null) {
- return;
- }
+ // Savepoint sp = Database.setSavepoint();
+ try {
+ //update 鍚宻taic 20220302 satrt
+ // String token;
+ //update 鍚宻taic 20220302 end
+ Datetime oldTime;
+ // 浠庤浆鎹㈣〃涓幏鍙杢oken
+ BatchIF_Transfer__c token502 = [Select ID, NFM501_Token__c
+ FROM BatchIF_Transfer__c Where Table__c = 'NFM501Token'];
+ token = token502.NFM501_Token__c;
+ // 浠庤浆鎹㈣〃涓幏鍙栬幏鍙栧畬token鐨勬椂闂�
+ BatchIF_Transfer__c oldTime502 = [Select ID, NFM501_Gain_End_Time__c
+ FROM BatchIF_Transfer__c Where Table__c = 'NFM501GainEndTime'];
+ oldTime = oldTime502.NFM501_Gain_End_Time__c;
+ // 瀵规棩蹇椾腑鐨勬暟鎹繘琛岃В鏋�
+ String WebUrl = NFMUtil.QLMgetRowDataStr(rowData);
+ NFM501Controller.AllData getQLMData502 = (NFM501Controller.AllData)
+ JSON.deserialize(WebUrl, NFM501Controller.AllData.class);
+ if (getQLMData502 == null) {
+ return;
+ }
- // 鍒ゆ柇token鏄惁澶辨晥锛堝け鏁堟潯浠朵负30鍒嗛挓涔嬪悗锛夛紝濡傛灉澶辨晥锛岄噸鏂拌幏鍙�
- Long timeslot;
- Datetime newTime = System.now();
- if (oldTime == null) {
- timeslot = 2800000;
- } else {
- // 褰撳墠鏃堕棿涓庤幏鍙杢oken缁撴潫鏃堕棿鐨勬椂闂村樊
- timeslot = newTime.getTime() - oldTime.getTime();
- }
- // System.debug('++++1++++' + token + ' : ' + timeslot);
- if (string.isblank(token) || timeslot > 1800000) {
- // NFMUtil.response response = NFMUtil.receiveToken();
- //update to aws token sushanhu 20220301 start
- NFMUtil.response response = NFMUtil.getAWSToken();
- //鍒ゆ柇rowdata涓暟鎹幏鍙栨垚鍔熶笌鍚︼紝濡傛灉澶辫触閲嶅彂涓夋锛屽鏋滃ぇ浜庝笁娆″垯鎵嬪姩鎿嶄綔
- if (String.isBlank(response.responseBody)) {
- System.debug('response.responseBody:' + response.responseBody);
- iflog502.ErrorLog__c = '502token:' + response.responseBody;
- // rowData.NFM501_Web_Annex_Count__c = 0;
- if (!Manual_execution502) {
- NFM501Controller.againSendRequest(iflog502, 'NFM501_Web_Annex_Count__c', rowData);
- }
- //鏇存柊鏃ュ織鏁版嵁
- System.debug('123@@@');
- return;
- }
- token = response.responseBody;
- oldTime = Datetime.now();
- token502.NFM501_Token__c = token;
- oldTime502.NFM501_Gain_End_Time__c = oldTime;
- //update to aws token sushanhu 20220301 end
- }
+ // 鍒ゆ柇token鏄惁澶辨晥锛堝け鏁堟潯浠朵负30鍒嗛挓涔嬪悗锛夛紝濡傛灉澶辨晥锛岄噸鏂拌幏鍙�
+ Long timeslot;
+ Datetime newTime = System.now();
+ if (oldTime == null) {
+ timeslot = 2800000;
+ } else {
+ // 褰撳墠鏃堕棿涓庤幏鍙杢oken缁撴潫鏃堕棿鐨勬椂闂村樊
+ timeslot = newTime.getTime() - oldTime.getTime();
+ }
+ // System.debug('++++1++++' + token + ' : ' + timeslot);
+ if (string.isblank(token) || timeslot > 1800000) {
+ // NFMUtil.response response = NFMUtil.receiveToken();
+ //update to aws token sushanhu 20220301 start
+ NFMUtil.response response = NFMUtil.getAWSToken();
+ //鍒ゆ柇rowdata涓暟鎹幏鍙栨垚鍔熶笌鍚︼紝濡傛灉澶辫触閲嶅彂涓夋锛屽鏋滃ぇ浜庝笁娆″垯鎵嬪姩鎿嶄綔
+ if (String.isBlank(response.responseBody)) {
+ System.debug('response.responseBody:' + response.responseBody);
+ iflog502.ErrorLog__c = '502token:' + response.responseBody;
+ // rowData.NFM501_Web_Annex_Count__c = 0;
+ if (!Manual_execution502) {
+ NFM501Controller.againSendRequest(iflog502, 'NFM501_Web_Annex_Count__c', rowData);
+ }
+ //鏇存柊鏃ュ織鏁版嵁
+ System.debug('123@@@');
+ return;
+ }
+ token = response.responseBody;
+ oldTime = Datetime.now();
+ token502.NFM501_Token__c = token;
+ oldTime502.NFM501_Gain_End_Time__c = oldTime;
+ //update to aws token sushanhu 20220301 end
+ }
- //鍏宠仈闄勪欢涓庢嫑鎶曟爣椤圭洰锛堥�氳繃Id锛�
- //1.璇诲嚭鎷涙姇鏍囦腑鐨勫敮涓�鏍囪瘑锛坧rojecId锛夛紝灏嗗叏閮ㄦ嫑鎶曟爣projectId瀛樺叆ProjectIdList
- List<String> ProjectIdList = new List<String>();
- for (NFM501Controller.ListItem ProId : getQLMData502.data.list1) {
- ProjectIdList.add(ProId.projectId);
- }
- System.debug('---===ProjectIdList' + ProjectIdList);
- //2.鍙栧叾瀵瑰簲鐨�
- List<Tender_information__c> TIList =
- [Select Id, ProjectId__c, InfoType__c
- FROM Tender_information__c
- Where ProjectId__c in :ProjectIdList];
- System.debug('---===2345TIList' + TIList);
- Set<Id> TenIdSet = new Set<Id>();
+ //鍏宠仈闄勪欢涓庢嫑鎶曟爣椤圭洰锛堥�氳繃Id锛�
+ //1.璇诲嚭鎷涙姇鏍囦腑鐨勫敮涓�鏍囪瘑锛坧rojecId锛夛紝灏嗗叏閮ㄦ嫑鎶曟爣projectId瀛樺叆ProjectIdList
+ List<String> ProjectIdList = new List<String>();
+ for (NFM501Controller.ListItem ProId : getQLMData502.data.list1) {
+ ProjectIdList.add(ProId.projectId);
+ }
+ System.debug('---===ProjectIdList' + ProjectIdList);
+ //2.鍙栧叾瀵瑰簲鐨�
+ List<Tender_information__c> TIList =
+ [Select Id, ProjectId__c, InfoType__c
+ FROM Tender_information__c
+ Where ProjectId__c in :ProjectIdList];
+ System.debug('---===2345TIList' + TIList);
+ Set<Id> TenIdSet = new Set<Id>();
- Map<String, Tender_information__c> TenMap = new Map<String, Tender_information__c>();
- for (Tender_information__c Ten : TIList) {
- TenMap.put(Ten.ProjectId__c, Ten);
- TenIdSet.add(Ten.Id);
- }
+ Map<String, Tender_information__c> TenMap = new Map<String, Tender_information__c>();
+ for (Tender_information__c Ten : TIList) {
+ TenMap.put(Ten.ProjectId__c, Ten);
+ TenIdSet.add(Ten.Id);
+ }
- //寰幆URL
- // List<Attachment> TenAttList = new List<Attachment>();
- //update to aws pi sushanhu 20220301 start
- List<FileAddress__c> fileList = new List<FileAddress__c>();
- List<String> queryUrlList = new List<String>();
- Map<String, NFM501Controller.ListItem> queryMap = new Map<String, NFM501Controller.ListItem>();
- //update to aws pi sushanhu 20220301 end
- for (NFM501Controller.ListItem QLMWebAtt : getQLMData502.data.list1) {
- if (QLMWebAtt.projectId == null) {
- iflog502.ErrorLog__c += 'Error! [' + QLMWebAtt.projectId + ']NotExist. This information is skipped.\n';
- continue;
- }
- if (QLMWebAtt.areaProvince.equals('棣欐腐鐗瑰埆琛屾斂鍖�')
- || QLMWebAtt.areaProvince.equals('婢抽棬鐗瑰埆琛屾斂鍖�')
- || QLMWebAtt.areaProvince.equals('鍙版咕鐪�')) {
- iflog502.ErrorLog__c += 'Error! [' + QLMWebAtt.areaProvince +
- ']Is 棣欐腐鐗瑰埆琛屾斂鍖�(婢抽棬鐗瑰埆琛屾斂鍖�,鍙版咕鐪�). This information is skipped.\n';
- continue;
- }
- //update to aws pi sushanhu 20220301 start
- queryUrlList.add(QLMWebAtt.infoQianlimaUrl);
- queryMap.put(QLMWebAtt.infoQianlimaUrl,QLMWebAtt);
- //update to aws pi sushanhu 20220301 start
- // //璋冪敤鎺ュ彛3
- // NFMUtil.response response = NFMUtil.getQLMData(NFMUtil.NFM502_ENDPOINT + QLMWebAtt.infoQianlimaUrl, token);
- // if (String.isBlank(response.responseBody)) {
- // System.debug('response.responseBody:' + response.responseBody);
- // iflog502.ErrorLog__c = '502鎺ュ彛璋冪敤锛�' + response.status;
- // rowData.NFM501_Web_Annex_Count__c = 0;
- // if (!Manual_execution502) {
- // NFM501Controller.againSendRequest(iflog502, 'NFM501_Web_Annex_Count__c', rowData);
- // }
- // //鏇存柊鏃ュ織鏁版嵁
- // update token502;
- // update oldTime502;
- // return;
- // }
+ //寰幆URL
+ // List<Attachment> TenAttList = new List<Attachment>();
+ //update to aws pi sushanhu 20220301 start
+ List<FileAddress__c> fileList = new List<FileAddress__c>();
+ List<String> queryUrlList = new List<String>();
+ Map<String, NFM501Controller.ListItem> queryMap = new Map<String, NFM501Controller.ListItem>();
+ //update to aws pi sushanhu 20220301 end
+ for (NFM501Controller.ListItem QLMWebAtt : getQLMData502.data.list1) {
+ if (QLMWebAtt.projectId == null) {
+ iflog502.ErrorLog__c += 'Error! [' + QLMWebAtt.projectId + ']NotExist. This information is skipped.\n';
+ continue;
+ }
+ if (QLMWebAtt.areaProvince.equals('棣欐腐鐗瑰埆琛屾斂鍖�')
+ || QLMWebAtt.areaProvince.equals('婢抽棬鐗瑰埆琛屾斂鍖�')
+ || QLMWebAtt.areaProvince.equals('鍙版咕鐪�')) {
+ iflog502.ErrorLog__c += 'Error! [' + QLMWebAtt.areaProvince +
+ ']Is 棣欐腐鐗瑰埆琛屾斂鍖�(婢抽棬鐗瑰埆琛屾斂鍖�,鍙版咕鐪�). This information is skipped.\n';
+ continue;
+ }
+ //update to aws pi sushanhu 20220301 start
+ queryUrlList.add(QLMWebAtt.infoQianlimaUrl);
+ queryMap.put(QLMWebAtt.infoQianlimaUrl,QLMWebAtt);
+ //update to aws pi sushanhu 20220301 start
+ // //璋冪敤鎺ュ彛3
+ // NFMUtil.response response = NFMUtil.getQLMData(NFMUtil.NFM502_ENDPOINT + QLMWebAtt.infoQianlimaUrl, token);
+ // if (String.isBlank(response.responseBody)) {
+ // System.debug('response.responseBody:' + response.responseBody);
+ // iflog502.ErrorLog__c = '502鎺ュ彛璋冪敤锛�' + response.status;
+ // rowData.NFM501_Web_Annex_Count__c = 0;
+ // if (!Manual_execution502) {
+ // NFM501Controller.againSendRequest(iflog502, 'NFM501_Web_Annex_Count__c', rowData);
+ // }
+ // //鏇存柊鏃ュ織鏁版嵁
+ // update token502;
+ // update oldTime502;
+ // return;
+ // }
- // //瑙f瀽鍚庣殑code鎶ラ敊澶勭悊
- // string NFM502responseBody = response.responseBody;
- // Map<String, Object> Body502 = (Map<String, Object>) JSON.deserializeUntyped(NFM502responseBody);
- // if (!Body502.get('code').equals('0')) {
- // System.debug('-------9-------');
- // iflog502.ErrorLog__c = '502瑙f瀽锛�' + Body502.get('msg').tostring() ;
- // if (!Manual_execution502) {
- // NFM501Controller.againSendRequest(iflog502, 'NFM501_Web_Annex_Count__c', rowData);
- // }
- // update token502;
- // update oldTime502;
- // return;
- // }
- // System.debug('Body502.data:' + Body502.get('data').tostring() + '---------'
- // + Body502.get('msg').tostring() + '-------' + Body502.get('code').tostring());
+ // //瑙f瀽鍚庣殑code鎶ラ敊澶勭悊
+ // string NFM502responseBody = response.responseBody;
+ // Map<String, Object> Body502 = (Map<String, Object>) JSON.deserializeUntyped(NFM502responseBody);
+ // if (!Body502.get('code').equals('0')) {
+ // System.debug('-------9-------');
+ // iflog502.ErrorLog__c = '502瑙f瀽锛�' + Body502.get('msg').tostring() ;
+ // if (!Manual_execution502) {
+ // NFM501Controller.againSendRequest(iflog502, 'NFM501_Web_Annex_Count__c', rowData);
+ // }
+ // update token502;
+ // update oldTime502;
+ // return;
+ // }
+ // System.debug('Body502.data:' + Body502.get('data').tostring() + '---------'
+ // + Body502.get('msg').tostring() + '-------' + Body502.get('code').tostring());
- // //鑾峰彇缃戦〉淇℃伅杞瓨涓洪檮浠�
- // //鎴垏鏁版嵁锛堜娇鏁版嵁鎴愪负瑙f瀽鐨勬牸寮忥級
- // Integer start = NFM502responseBody.indexOf('"infoHtml":"');
- // Integer theEnd = NFM502responseBody.lastIndexOf('"},"msg');
- // NFM502responseBody = NFM502responseBody.substring(start + 12, theEnd);
- // //灏嗗叾杞崲涓洪檮浠�
- // // System.debug('---------' + NFM502responseBody);
- // Attachment WebAtt = new Attachment();
- // // System.debug('projectId:' + QLMWebAtt.projectId);
- // if (TenMap.containskey(QLMWebAtt.projectId)) {
- // WebAtt.ParentId = TenMap.get(QLMWebAtt.projectId).Id;
- // WebAtt.Body = Blob.valueOf(NFM502responseBody);
- // WebAtt.Name = TenMap.get(QLMWebAtt.projectId).InfoType__c + ':' + QLMWebAtt.infoTitle + '.html';
- // TenAttList.add(WebAtt);
- // }
- }
- //update to aws pi sushanhu 20220301 start
- PIHelper.piIntegration pi =PIHelper.getPIIntegrationInfo('NFM502');
- transUrl=pi.searchUrl;
- //璋冪敤鎺ュ彛3
- system.debug('Payload for NFM 520:'+JSON.serialize(queryUrlList));
- NFMUtil.response response = NFMUtil.getAWSQLMData(pi.newUrl ,JSON.serialize(queryUrlList), token);
- Map<String, Object> result = (Map<String, Object>)JSON.deserializeUntyped(response.responseBody);
- String statusCode =(String)result.get('status');
- transId =(String)result.get('txId');
- if (!'0'.equals(statusCode)) {
- System.debug('response.responseBody:' + response.responseBody);
- iflog502.ErrorLog__c = '502鎺ュ彛璋冪敤锛�' + (String)result.get('message');
- rowData.NFM501_Web_Annex_Count__c = 0;
- if (!Manual_execution502) {
- NFM501Controller.againSendRequest(iflog502, 'NFM501_Web_Annex_Count__c', rowData);
- }
- //鏇存柊鏃ュ織鏁版嵁
- update token502;
- update oldTime502;
- return;
- }
+ // //鑾峰彇缃戦〉淇℃伅杞瓨涓洪檮浠�
+ // //鎴垏鏁版嵁锛堜娇鏁版嵁鎴愪负瑙f瀽鐨勬牸寮忥級
+ // Integer start = NFM502responseBody.indexOf('"infoHtml":"');
+ // Integer theEnd = NFM502responseBody.lastIndexOf('"},"msg');
+ // NFM502responseBody = NFM502responseBody.substring(start + 12, theEnd);
+ // //灏嗗叾杞崲涓洪檮浠�
+ // // System.debug('---------' + NFM502responseBody);
+ // Attachment WebAtt = new Attachment();
+ // // System.debug('projectId:' + QLMWebAtt.projectId);
+ // if (TenMap.containskey(QLMWebAtt.projectId)) {
+ // WebAtt.ParentId = TenMap.get(QLMWebAtt.projectId).Id;
+ // WebAtt.Body = Blob.valueOf(NFM502responseBody);
+ // WebAtt.Name = TenMap.get(QLMWebAtt.projectId).InfoType__c + ':' + QLMWebAtt.infoTitle + '.html';
+ // TenAttList.add(WebAtt);
+ // }
+ }
+ //update to aws pi sushanhu 20220301 start
+ PIHelper.piIntegration pi =PIHelper.getPIIntegrationInfo('NFM502');
+ transUrl=pi.searchUrl;
+ //璋冪敤鎺ュ彛3
+ system.debug('Payload for NFM 520:'+JSON.serialize(queryUrlList));
+ NFMUtil.response response = NFMUtil.getAWSQLMData(pi.newUrl ,JSON.serialize(queryUrlList), token);
+ Map<String, Object> result = (Map<String, Object>)JSON.deserializeUntyped(response.responseBody);
+ String statusCode =(String)result.get('status');
+ transId =(String)result.get('txId');
+ if (!'0'.equals(statusCode)) {
+ System.debug('response.responseBody:' + response.responseBody);
+ iflog502.ErrorLog__c = '502鎺ュ彛璋冪敤锛�' + (String)result.get('message');
+ rowData.NFM501_Web_Annex_Count__c = 0;
+ if (!Manual_execution502) {
+ NFM501Controller.againSendRequest(iflog502, 'NFM501_Web_Annex_Count__c', rowData);
+ }
+ //鏇存柊鏃ュ織鏁版嵁
+ update token502;
+ update oldTime502;
+ return;
+ }
- //瑙f瀽鍚庣殑code鎶ラ敊澶勭悊
- string NFM502responseBody = response.responseBody;
- Map<String, Object> Body502 = (Map<String, Object>) JSON.deserializeUntyped(NFM502responseBody);
- if (!String.valueOf(Body502.get('status')).equals('0')) {
- System.debug('-------9-------');
- iflog502.ErrorLog__c = '502瑙f瀽锛�' + Body502.get('message').tostring() ;
- if (!Manual_execution502) {
- NFM501Controller.againSendRequest(iflog502, 'NFM501_Web_Annex_Count__c', rowData);
- }
- update token502;
- update oldTime502;
- return;
- }
- System.debug('Body502.data:' + Body502.get('object').tostring() + '---------'
- + Body502.get('message').tostring() + '-------' + Body502.get('status').tostring());
+ //瑙f瀽鍚庣殑code鎶ラ敊澶勭悊
+ string NFM502responseBody = response.responseBody;
+ Map<String, Object> Body502 = (Map<String, Object>) JSON.deserializeUntyped(NFM502responseBody);
+ if (!String.valueOf(Body502.get('status')).equals('0')) {
+ System.debug('-------9-------');
+ iflog502.ErrorLog__c = '502瑙f瀽锛�' + Body502.get('message').tostring() ;
+ if (!Manual_execution502) {
+ NFM501Controller.againSendRequest(iflog502, 'NFM501_Web_Annex_Count__c', rowData);
+ }
+ update token502;
+ update oldTime502;
+ return;
+ }
+ System.debug('Body502.data:' + Body502.get('object').tostring() + '---------'
+ + Body502.get('message').tostring() + '-------' + Body502.get('status').tostring());
- //鑾峰彇aws杩斿洖鐨勫湴鍧�骞跺瓨鍌�
-
- Map<String, Object> fileMap = (Map<String, Object >)result.get('object');
- for(String url:queryUrlList){
- NFM501Controller.ListItem QLMWebAtt = queryMap.get(url);
- if (TenMap.containskey(QLMWebAtt.projectId)) {
- FileAddress__c file =new FileAddress__c();
- file.ParentRecordId__c = TenMap.get(QLMWebAtt.projectId).Id;
- file.FileName__c = TenMap.get(QLMWebAtt.projectId).InfoType__c + ':' + QLMWebAtt.infoTitle + '.html';
- file.DownloadLink__c =pi.undeleteUrl+(String)fileMap.get(url)+'&fileName='+file.FileName__c;
- file.ViewLink__c = pi.queryUrl+(String)fileMap.get(url) ;
- file.AWS_File_Key__c =(String)fileMap.get(url) ;
- fileList.add(file);
- }
- }
-
- //鍒犻櫎鍚屽悕鐨勯檮浠�
- List<String> UrlList = new List<String>();
- for (NFM501Controller.ListItem UrlName : getQLMData502.data.list1) {
- if (TenMap.containskey(UrlName.projectId)) {
- UrlList.add(TenMap.get(UrlName.projectId).InfoType__c + ':' + UrlName.infoTitle + '.html');
- }
- }
+ //鑾峰彇aws杩斿洖鐨勫湴鍧�骞跺瓨鍌�
+
+ Map<String, Object> fileMap = (Map<String, Object >)result.get('object');
+ for(String url:queryUrlList){
+ NFM501Controller.ListItem QLMWebAtt = queryMap.get(url);
+ if (TenMap.containskey(QLMWebAtt.projectId)) {
+ FileAddress__c file =new FileAddress__c();
+ file.ParentRecordId__c = TenMap.get(QLMWebAtt.projectId).Id;
+ file.FileName__c = TenMap.get(QLMWebAtt.projectId).InfoType__c + ':' + QLMWebAtt.infoTitle + '.html';
+ file.DownloadLink__c =pi.undeleteUrl+(String)fileMap.get(url)+'&fileName='+file.FileName__c;
+ file.ViewLink__c = pi.queryUrl+(String)fileMap.get(url) ;
+ file.AWS_File_Key__c =(String)fileMap.get(url) ;
+ fileList.add(file);
+ }
+ }
+
+ //鍒犻櫎鍚屽悕鐨勯檮浠�
+ List<String> UrlList = new List<String>();
+ for (NFM501Controller.ListItem UrlName : getQLMData502.data.list1) {
+ if (TenMap.containskey(UrlName.projectId)) {
+ UrlList.add(TenMap.get(UrlName.projectId).InfoType__c + ':' + UrlName.infoTitle + '.html');
+ }
+ }
- List<FileAddress__c> DeleFileList = [select id, FileName__c, ParentRecordId__c from FileAddress__c
- where FileName__c in :UrlList and ParentRecordId__c in :TenIdSet];
- if (DeleFileList.size() > 0) {
- delete DeleFileList;
- }
- System.debug('----1----' + fileList);
- if (fileList.size() > 0) {
- upsert fileList;
- }
- //纭浜嬪姟
-
- for (FileAddress__c file : fileList) {
- system.debug('file--'+json.serialize(file));
- system.debug('file.id'+file.Id);
- sfRecordIds.add(file.Id);
- }
- //update to aws pi sushanhu 20220301 end
- // PIHelper.confirmFileTrans('NFM502',1,JSON.serialize(sfRecordIds),transId,token,transUrl);
- PIHelper.insertConfirmTrans('NFM502',1,JSON.serialize(sfRecordIds),transId,0,transUrl,null);
- // if (!confirm) {
- // //鍥炴粴
- // }
- rowData.NFM501_Web_Annex_Count__c = 0;
- } catch (Exception ex) {
- // Database.rollback(sp);
- // System.debug(Logginglevel.ERROR, 'QLMData_' + rowData.MessageGroupNumber__c + ':' + ex.getMessage());
- // System.debug(Logginglevel.ERROR, 'QLMData_' + rowData.MessageGroupNumber__c + ':' + ex.getStackTraceString());
- // logstr += '\n' + ex.getMessage();
- //add 浜嬪姟纭 sushanhu 20220302 satrt
- // PIHelper.confirmFileTrans('NFM502',0,'',transId,token,transUrl);
- PIHelper.insertConfirmTrans('NFM502',0,JSON.serialize(sfRecordIds),transId,0,transUrl,null);
- //add 浜嬪姟纭 sushanhu 20220302 end
- iflog502.ErrorLog__c = '502鎶涘嚭寮傚父锛�' + ex.getMessage() + '\n'
- + ex.getStackTraceString() + '\n' + iflog502.ErrorLog__c;
- if (!Manual_execution502) {
- NFM501Controller.againSendExceptionRequest(iflog502, 'NFM501_Web_Annex_Count__c', rowData,
- '502鎶涘嚭寮傚父锛�' + ex.getMessage() + '\n' + ex.getStackTraceString()
- + '\n' + rowData.ErrorLog__c +
- '閿欒娆℃暟宸茬粡瓒呰繃鑷姩鏀朵俊璁惧畾鐨勬渶澶ф鏁帮紝璇锋墜鍔ㄦ敹淇�');
- }
- }
- update rowData;
- System.debug('+++++++5+++++++' + rowData);
- System.debug('+++++++3+++++++' + iflog502.Log__c);
- System.debug('+++++++2+++++++' + iflog502.ErrorLog__c);
- //濡傛灉瀛樺叆淇℃伅瓒呭嚭闄愬埗锛岀敤鐪佺暐鍙蜂唬鏇�
- if (iflog502.Log__c.length() > 131072) {
- iflog502.Log__c = iflog502.Log__c.subString(0, 131065) + ' ...';
- }
- if (iflog502.ErrorLog__c.length() > 32768) {
- iflog502.ErrorLog__c = iflog502.ErrorLog__c.subString(0, 32760) + ' ...';
- }
- upsert iflog502;
- }
- public static void test() {
- 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++;
+ List<FileAddress__c> DeleFileList = [select id, FileName__c, ParentRecordId__c from FileAddress__c
+ where FileName__c in :UrlList and ParentRecordId__c in :TenIdSet];
+ if (DeleFileList.size() > 0) {
+ delete DeleFileList;
+ }
+ System.debug('----1----' + fileList);
+ if (fileList.size() > 0) {
+ upsert fileList;
+ }
+ //纭浜嬪姟
+
+ for (FileAddress__c file : fileList) {
+ system.debug('file--'+json.serialize(file));
+ system.debug('file.id'+file.Id);
+ sfRecordIds.add(file.Id);
+ }
+ //update to aws pi sushanhu 20220301 end
+ // PIHelper.confirmFileTrans('NFM502',1,JSON.serialize(sfRecordIds),transId,token,transUrl);
+ if (fileList.size() > 0) {
+ PIHelper.insertConfirmTrans('NFM502',1,JSON.serialize(sfRecordIds),transId,0,transUrl,null);
+ }else{
+ PIHelper.insertConfirmTrans('NFM502',0,JSON.serialize(sfRecordIds),transId,0,transUrl,null);
+ }
- }
+
+ // if (!confirm) {
+ // //鍥炴粴
+ // }
+ rowData.NFM501_Web_Annex_Count__c = 0;
+ } catch (Exception ex) {
+ // Database.rollback(sp);
+ // System.debug(Logginglevel.ERROR, 'QLMData_' + rowData.MessageGroupNumber__c + ':' + ex.getMessage());
+ // System.debug(Logginglevel.ERROR, 'QLMData_' + rowData.MessageGroupNumber__c + ':' + ex.getStackTraceString());
+ // logstr += '\n' + ex.getMessage();
+ //add 浜嬪姟纭 sushanhu 20220302 satrt
+ // PIHelper.confirmFileTrans('NFM502',0,'',transId,token,transUrl);
+ PIHelper.insertConfirmTrans('NFM502',0,JSON.serialize(sfRecordIds),transId,0,transUrl,null);
+ //add 浜嬪姟纭 sushanhu 20220302 end
+ iflog502.ErrorLog__c = '502鎶涘嚭寮傚父锛�' + ex.getMessage() + '\n'
+ + ex.getStackTraceString() + '\n' + iflog502.ErrorLog__c;
+ if (!Manual_execution502) {
+ NFM501Controller.againSendExceptionRequest(iflog502, 'NFM501_Web_Annex_Count__c', rowData,
+ '502鎶涘嚭寮傚父锛�' + ex.getMessage() + '\n' + ex.getStackTraceString()
+ + '\n' + rowData.ErrorLog__c +
+ '閿欒娆℃暟宸茬粡瓒呰繃鑷姩鏀朵俊璁惧畾鐨勬渶澶ф鏁帮紝璇锋墜鍔ㄦ敹淇�');
+ }
+ }
+ update rowData;
+ System.debug('+++++++5+++++++' + rowData);
+ System.debug('+++++++3+++++++' + iflog502.Log__c);
+ System.debug('+++++++2+++++++' + iflog502.ErrorLog__c);
+ //濡傛灉瀛樺叆淇℃伅瓒呭嚭闄愬埗锛岀敤鐪佺暐鍙蜂唬鏇�
+ if (iflog502.Log__c.length() > 131072) {
+ iflog502.Log__c = iflog502.Log__c.subString(0, 131065) + ' ...';
+ }
+ if (iflog502.ErrorLog__c.length() > 32768) {
+ iflog502.ErrorLog__c = iflog502.ErrorLog__c.subString(0, 32760) + ' ...';
+ }
+ upsert iflog502;
+ }
+ public static void test() {
+ 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++;
+
+ }
}
\ No newline at end of file
--
Gitblit v1.9.1