forked from github/dataease
fix(仪表板): 从模版市场新建仪表板地图找不到坐标文件
This commit is contained in:
parent
bfacd16d08
commit
1bd2cf390f
@ -57,6 +57,8 @@ public class PanelGroupService {
|
|||||||
|
|
||||||
private final Logger LOGGER = LoggerFactory.getLogger(this.getClass());
|
private final Logger LOGGER = LoggerFactory.getLogger(this.getClass());
|
||||||
|
|
||||||
|
private final Gson gson = new Gson();
|
||||||
|
|
||||||
private final SysLogConstants.SOURCE_TYPE sourceType = SysLogConstants.SOURCE_TYPE.PANEL;
|
private final SysLogConstants.SOURCE_TYPE sourceType = SysLogConstants.SOURCE_TYPE.PANEL;
|
||||||
|
|
||||||
private final static String DATA_URL_TITLE = "data:image/jpeg;base64,";
|
private final static String DATA_URL_TITLE = "data:image/jpeg;base64,";
|
||||||
@ -364,7 +366,7 @@ public class PanelGroupService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public String newPanel(PanelGroupRequest request) {
|
public String newPanel(PanelGroupRequest request) {
|
||||||
Gson gson = new Gson();
|
|
||||||
String newPanelId = UUIDUtil.getUUIDAsString();
|
String newPanelId = UUIDUtil.getUUIDAsString();
|
||||||
String newFrom = request.getNewFrom();
|
String newFrom = request.getNewFrom();
|
||||||
String templateStyle = null;
|
String templateStyle = null;
|
||||||
@ -400,12 +402,14 @@ public class PanelGroupService {
|
|||||||
mobileLayout = panelViewService.havaMobileLayout(templateData);
|
mobileLayout = panelViewService.havaMobileLayout(templateData);
|
||||||
}
|
}
|
||||||
Map<String, String> dynamicDataMap = gson.fromJson(dynamicData, Map.class);
|
Map<String, String> dynamicDataMap = gson.fromJson(dynamicData, Map.class);
|
||||||
|
|
||||||
List<PanelViewInsertDTO> panelViews = new ArrayList<>();
|
List<PanelViewInsertDTO> panelViews = new ArrayList<>();
|
||||||
List<PanelGroupExtendDataDTO> viewsData = new ArrayList<>();
|
List<PanelGroupExtendDataDTO> viewsData = new ArrayList<>();
|
||||||
for (Map.Entry<String, String> entry : dynamicDataMap.entrySet()) {
|
for (Map.Entry<String, String> entry : dynamicDataMap.entrySet()) {
|
||||||
String originViewId = entry.getKey();
|
String originViewId = entry.getKey();
|
||||||
String originViewData = entry.getValue();
|
String originViewData = entry.getValue();
|
||||||
ChartViewDTO chartView = gson.fromJson(originViewData, ChartViewDTO.class);
|
ChartViewDTO chartView = gson.fromJson(originViewData, ChartViewDTO.class);
|
||||||
|
chartView = transferTemplateMapAreaCode(chartView);
|
||||||
String position = chartView.getPosition();
|
String position = chartView.getPosition();
|
||||||
String newViewId = UUIDUtil.getUUIDAsString();
|
String newViewId = UUIDUtil.getUUIDAsString();
|
||||||
chartView.setId(newViewId);
|
chartView.setId(newViewId);
|
||||||
@ -434,6 +438,20 @@ public class PanelGroupService {
|
|||||||
return newPanelId;
|
return newPanelId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private ChartViewDTO transferTemplateMapAreaCode(ChartViewDTO chartViewDTO) {
|
||||||
|
Object areaCodeObj = null;
|
||||||
|
String areaCodeKey = "areaCode";
|
||||||
|
if (StringUtils.equals(chartViewDTO.getType(), "map") || StringUtils.equals(chartViewDTO.getType(), "buddle-map")) {
|
||||||
|
String customAttrJson = chartViewDTO.getCustomAttr();
|
||||||
|
Map map = gson.fromJson(customAttrJson, Map.class);
|
||||||
|
if (map.containsKey(areaCodeKey) && ObjectUtils.isNotEmpty((areaCodeObj = map.get(areaCodeKey))) && areaCodeObj.toString().length() == 6) {
|
||||||
|
map.put(areaCodeKey, "156" + areaCodeObj.toString());
|
||||||
|
chartViewDTO.setCustomAttr(gson.toJson(map));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return chartViewDTO;
|
||||||
|
}
|
||||||
|
|
||||||
public void sysInit1HistoryPanel() {
|
public void sysInit1HistoryPanel() {
|
||||||
LogUtil.info("=====v1.8版本 仪表板私有化【开始】=====");
|
LogUtil.info("=====v1.8版本 仪表板私有化【开始】=====");
|
||||||
List<PanelGroupDTO> needInitPanels = extPanelGroupMapper.panelGroupInit();
|
List<PanelGroupDTO> needInitPanels = extPanelGroupMapper.panelGroupInit();
|
||||||
|
Loading…
Reference in New Issue
Block a user