19626
2023-10-23 1727a4f4d02e429475608e60f142a63bc24127bc
force-app/main/default/classes/CheckAllOlympusAssetController.cls
@@ -424,6 +424,7 @@
        if (beipinCunFangDi=='广州 备品中心' || beipinCunFangDi=='北京 备品中心' || beipinCunFangDi=='上海 备品中心') {
            angecylookrole =true;
        }
        System.debug('angecylookrole===' + angecylookrole);
        setAssetFieldSetInfo();//20210628 1650 you 挪个位置
        if (UserInfo.getProfileId() == System.Label.ProfileId_SystemAdmin || System.Label.ProfileId_EquCenAdmin.contains(UserInfo.getProfileId())) {
            internalAssetLocationLogin = FixtureUtil.bieCunFangDiOpsMap.get('备品管理中心')[0].getValue();  // SelectOption('All', '--全部--')
@@ -758,6 +759,7 @@
        }
        System.debug('oldAssetInfoList===' + oldAssetInfoList);
        checkedAssetInfoNum = oldAssetInfoList.size();
        System.debug('oldAssetInfoListSize===' + oldAssetInfoList.size());
        allAssetInfoList.clear();
        totalFixDataNum = oldAssetInfoList.size(); // 打勾固定数据数量
@@ -968,6 +970,7 @@
        }
        System.debug('currPage===' + currPage);
        System.debug('totalPage===' + totalPage);
        System.debug('selctRecordNum===' + selctRecordNum);
        if (selRecordOption != NONE) {
            // selRecordOption = String.valueOf(Integer.valueOf(selRecordOption) + checkedAssetInfoNum);
            if (currPage == 1) {
@@ -977,7 +980,12 @@
                soqlAsset += ' limit ' + selRecordOption + ' offset ' + String.valueOf((currPage - 1) * selctRecordNum - checkedAssetInfoNum);
                System.debug('Last page;');
            } else {
                soqlAsset += ' limit ' + selRecordOption + ' offset ' + String.valueOf((currPage - 1) * selctRecordNum - checkedAssetInfoNum);
                if(oldAssetInfoList.size() > 10 && currPage == 2){
                    soqlAsset += ' limit ' + selRecordOption + ' offset ' + String.valueOf((currPage) * selctRecordNum - checkedAssetInfoNum);
                }else{
                    soqlAsset += ' limit ' + selRecordOption + ' offset ' + String.valueOf((currPage - 1) * selctRecordNum - checkedAssetInfoNum);
                }
            }
        }
        // 最终检索结果
@@ -1208,7 +1216,9 @@
    public Date stringToDate(String dateStr) {  // Fri Jan 18 00:00:00 GMT 2019
        //System.debug('dateStr=====' + dateStr);
        return Date.valueOf(dateStr);
        dateStr = dateStr.split(' ')[0];
        return Date.valueOf(dateStr.replaceAll('/','-'));
        //String monthStr = dateStr.substring(4,7);
        //Integer dayStr = Integer.ValueOf(dateStr.substring(8,10));
        //Integer yearStr = Integer.ValueOf(dateStr.substring(24,28));
@@ -1269,11 +1279,11 @@
        }
        System.debug('333333');
        // 检索CSV中的ID检索Asset获得List<Asset>
        try {
        // try {
            if (allApiList.contains('Id')) {
                allApiList.remove(0);
            }
            if (importApiList.contains('Id(不可修改)')) {
            if (importApiList.contains('Id')) {
                importApiList.remove(0);
            }
            List<String> notIncludeApiList = new List<String>();
@@ -1307,7 +1317,11 @@
                    if (!queryAssetFieldResult.isCalculated()) {
                        if (queryAssetFieldResult.getType() == Schema.DisplayType.Date) {
                            if (tempCsvBody[i][j+1] != '') {
                                tempAsset.put(importApiList[j], stringToDate(tempCsvBody[i][j+1]));
                                String s = tempCsvBody[i][j+1].substring(0,1);
                                if(s == '2'){
                                    tempAsset.put(importApiList[j], stringToDate(tempCsvBody[i][j+1]));
                                }
                            }
                        } else if (queryAssetFieldResult.getType() == Schema.DisplayType.Boolean) {
                            if (tempCsvBody[i][j+1] != '') {
@@ -1370,11 +1384,11 @@
                ApexPages.Message errorMessage = new ApexPages.Message(ApexPages.severity.INFO, importSuccessfulMsg);
                ApexPages.addMessage(errorMessage);
            }
        } catch (Exception e) {
            System.debug('1234 ' + e);
            ApexPages.Message errorMessage = new ApexPages.Message(ApexPages.severity.ERROR, '导入过程出现错误,导入文件中可能存在Fieldset中不存在的列名,请检查CSV文件。');
            ApexPages.addMessage(errorMessage);
        }
        // } catch (Exception e) {
        //     System.debug('1234 ' + e);
        //     ApexPages.Message errorMessage = new ApexPages.Message(ApexPages.severity.ERROR, '导入过程出现错误,导入文件中可能存在Fieldset中不存在的列名,请检查CSV文件。');
        //     ApexPages.addMessage(errorMessage);
        // }
    }