diff --git a/core/core-backend/src/main/java/io/dataease/visualization/server/DataVisualizationServer.java b/core/core-backend/src/main/java/io/dataease/visualization/server/DataVisualizationServer.java index e53d980086..27461a0363 100644 --- a/core/core-backend/src/main/java/io/dataease/visualization/server/DataVisualizationServer.java +++ b/core/core-backend/src/main/java/io/dataease/visualization/server/DataVisualizationServer.java @@ -576,12 +576,19 @@ public class DataVisualizationServer implements DataVisualizationApi { // 模板市场记录 coreOptRecentManage.saveOpt(request.getResourceName(), OptConstants.OPT_RESOURCE_TYPE.TEMPLATE, OptConstants.OPT_TYPE.NEW); } - if(StringUtils.isNotEmpty(appDataStr)){ - VisualizationExport2AppVO appDataFormat = JsonUtil.parseObject(appDataStr,VisualizationExport2AppVO.class); - String dvInfo = appDataFormat.getVisualizationInfo(); - VisualizationBaseInfoVO baseInfoVO = JsonUtil.parseObject(dvInfo,VisualizationBaseInfoVO.class); - Long sourceDvId = baseInfoVO.getId(); - appDataStr = appDataStr.replaceAll(sourceDvId.toString(), newDvId.toString()); + if(StringUtils.isNotEmpty(appDataStr) && appDataStr.length()>10){ + try{ + VisualizationExport2AppVO appDataFormat = JsonUtil.parseObject(appDataStr,VisualizationExport2AppVO.class); + String dvInfo = appDataFormat.getVisualizationInfo(); + VisualizationBaseInfoVO baseInfoVO = JsonUtil.parseObject(dvInfo,VisualizationBaseInfoVO.class); + Long sourceDvId = baseInfoVO.getId(); + appDataStr = appDataStr.replaceAll(sourceDvId.toString(), newDvId.toString()); + }catch (Exception e){ + LogUtil.error(e); + appDataStr = null; + } + }else{ + appDataStr = null; } // 解析动态数据 Map dynamicDataMap = JsonUtil.parseObject(dynamicData, Map.class); diff --git a/core/core-frontend/src/utils/imgUtils.ts b/core/core-frontend/src/utils/imgUtils.ts index 0aa5825cde..f824dda73a 100644 --- a/core/core-frontend/src/utils/imgUtils.ts +++ b/core/core-frontend/src/utils/imgUtils.ts @@ -56,7 +56,7 @@ export function download2AppTemplate(downloadType, canvasDom, name, attachParams componentData: JSON.stringify(componentData.value), dynamicData: JSON.stringify(canvasViewDataTemplate), staticResource: JSON.stringify(staticResource || {}), - appData: JSON.stringify(attachParams || {}) + appData: attachParams ? JSON.stringify(attachParams) : null } const blob = new Blob([JSON.stringify(templateInfo)], { type: '' }) if (downloadType === 'template') {