buli
2022-03-11 02ddc35714cbd1688b7cb057f770f1410de79dab
force-app/main/default/classes/NFM501Controller.cls
@@ -1,5 +1,6 @@
public with sharing class NFM501Controller implements Queueable {
    //先定义
    //add aws response
    public class AllData {
        public String code;
        public QLMData data;
@@ -45,6 +46,17 @@
        public String[] ZhaoRelationName;
        public String[] ZhongRelationName;
        public String infoTypeSegment;
        //add aws pi start sushanhu 20220223 start
        public String[] AgentRelationWayEncrypted;//代理机构联系方式密文
        public String[] AgentRelationNameEncrypted;//代理机构联系方式人密文
        public String[] ZhongRelationWayEncrypted;//中标单位联系方式密文
        public String[] ZhongRelationNameEncrypted;//中标单位联系人密文
        public String[] ZhaoRelationNameEncrypted;//招标单位联系人密文
        public String[] ZhaoRelationWayEncrypted;//招标单位联系方式密文
        public String DataId;// AWS 存储凭据
        //add aws pi start sushanhu 20220223 start
    }
    public class AmountItem {
        public String Amount;
@@ -166,7 +178,10 @@
            System.debug('++++1++++' + token + '  : ' + timeslot);
            if (string.isblank(token) || timeslot > 1800000) {
                System.debug('++++2++++' + token + '  : ' + timeslot);
                NFMUtil.response response = NFMUtil.receiveToken();
                // NFMUtil.response response = NFMUtil.receiveToken();
                //update to aws token sushanhu start 20220223
                NFMUtil.response response=NFMUtil.getAwsToken();
                //update to aws token sushanhu end 20220223
                System.debug('++++response++++' + response);
                //判断rowdata中数据获取成功与否,如果失败重发三次,如果大于三次则手动操作
                if (String.isBlank(response.responseBody)) {
@@ -188,11 +203,19 @@
                oldTimeTran.NFM501_Gain_End_Time__c = oldTime;
            }
            //替换获取到数据中的关键字
            NFMUtil.response response = NFMUtil.getQLMData(NFMUtil.NFM501_ENDPOINT
                                        + oldMark.Internal_Value__c + '/10', token);
            // aaaaaaaa 这里顺序错了,肯定是应该先判断是不是因为http 报错,然后才是千里马的code解析
            // //替换获取到数据中的关键字
            // NFMUtil.response response = NFMUtil.getQLMData(NFMUtil.NFM501_ENDPOINT
            //                             + oldMark.Internal_Value__c + '/10', token);
            // // aaaaaaaa 这里顺序错了,肯定是应该先判断是不是因为http 报错,然后才是千里马的code解析
            //update to aws start sushanhu 20220223
            PIHelper.PIIntegration NFM501AWS =PIHelper.getPIIntegrationInfo('QLMNFM501');
            NFMUtil.response response = NFMUtil.getAWSQLMData(NFM501AWS.newUrl+'cursorMark='
                                         + oldMark.Internal_Value__c + '&pageSize=10', token);
            //update to aws  sushanhu end 20220223
            //http的报错处理(重发三遍)
            //
            if (String.isBlank(response.responseBody)) {
                System.debug('-------7-------');
                // aaaaaaaa 报错原因写的不对
@@ -209,7 +232,14 @@
            // 解析后的code报错处理
            String NFM501responseBody = response.responseBody;
            System.debug('-------------NFM501responseBody------------' + NFM501responseBody);
            NFM501responseBody = NFM501responseBody.replaceAll('"list"', '"list1"').replaceAll('"number":', '"number1":');
            //update to aws response sushanhu 20220223 start
            Map<String, Object> results = (Map<String, Object>) JSON.deserializeUntyped(NFM501responseBody);
            //String qlmResult =(String)results.get('object');
            String qlmResult =JSON.serialize(results.get('object'));
            System.debug('-------------NFM501responseBody qlmResult------------' + qlmResult);
            // NFM501responseBody = NFM501responseBody.replaceAll('"list"', '"list1"').replaceAll('"number":', '"number1":');
            NFM501responseBody = qlmResult.replaceAll('"list"', '"list1"').replaceAll('"number":', '"number1":');
            //update to aws response sushanhu 20220223 end
            AllData getQLMData =  (AllData) JSON.deserializeStrict(NFM501responseBody, AllData.class);
            System.debug('-------------8------------' + getQLMData);
            if (!getQLMData.code.equals('0')) {
@@ -223,6 +253,8 @@
                return;
            }
            rowData = NFMUtil.QLMmakeRowData(NFM501responseBody, rowData);
            rowData.AWS_Transaction_Id__c = (String)results.get('txId');// add for pi susanhu 20220310
            system.debug('rowData---'+rowData);
            System.debug('======2221234======');
            update tokenTran;
@@ -244,7 +276,7 @@
                // 12点自动抓取招投标数据
                // NFM501Controller.TwoMarkEqualAgainSend();
            }
            rowData.retry_cnt__c = 0;
            if (System.Test.isRunningTest()) {
                throw new ControllerUtil.myException('aaa');