diff --git a/core/core-backend/src/main/java/io/dataease/system/manage/SysParameterManage.java b/core/core-backend/src/main/java/io/dataease/system/manage/SysParameterManage.java index f370cfcb7d..0b51783a38 100644 --- a/core/core-backend/src/main/java/io/dataease/system/manage/SysParameterManage.java +++ b/core/core-backend/src/main/java/io/dataease/system/manage/SysParameterManage.java @@ -1,6 +1,7 @@ package io.dataease.system.manage; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import io.dataease.api.system.request.OnlineMapEditor; import io.dataease.api.system.vo.SettingItemVO; import io.dataease.datasource.server.DatasourceServer; import io.dataease.license.config.XpackInteract; @@ -13,11 +14,13 @@ import io.dataease.utils.IDUtils; import io.dataease.utils.SystemSettingUtils; import jakarta.annotation.Resource; import org.apache.commons.lang3.ObjectUtils; +import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Component; import org.springframework.transaction.annotation.Transactional; import org.springframework.util.CollectionUtils; +import java.beans.PropertyDescriptor; import java.util.*; import java.util.stream.Collectors; @@ -30,7 +33,7 @@ public class SysParameterManage { @Value("${dataease.demo-tips-content:#{null}}") private String demoTipsContent; - private static final String mapKey = "map.key"; + private static final String MAP_KEY_PREFIX = "map."; @Resource private CoreSysSettingMapper coreSysSettingMapper; @@ -50,26 +53,39 @@ public class SysParameterManage { return null; } - public String queryOnlineMap() { - return singleVal(mapKey); + public OnlineMapEditor queryOnlineMap() { + var editor = new OnlineMapEditor(); + List fields = BeanUtils.getFieldNames(OnlineMapEditor.class); + Map mapVal = groupVal(MAP_KEY_PREFIX); + fields.forEach(field -> { + String val = mapVal.get(MAP_KEY_PREFIX + field); + if (StringUtils.isNotBlank(val)) { + BeanUtils.setFieldValueByName(editor, field, val, String.class); + } + }); + return editor; } - public void saveOnlineMap(String val) { - - QueryWrapper queryWrapper = new QueryWrapper<>(); - queryWrapper.eq("pkey", mapKey); - CoreSysSetting sysSetting = coreSysSettingMapper.selectOne(queryWrapper); - if (ObjectUtils.isEmpty(sysSetting)) { - sysSetting = new CoreSysSetting(); - sysSetting.setId(IDUtils.snowID()); - sysSetting.setPkey(mapKey); + public void saveOnlineMap(OnlineMapEditor editor) { + List fieldNames = BeanUtils.getFieldNames(OnlineMapEditor.class); + fieldNames.forEach(field -> { + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.eq("pkey", MAP_KEY_PREFIX + field); + CoreSysSetting sysSetting = coreSysSettingMapper.selectOne(queryWrapper); + var val = (String) BeanUtils.getFieldValueByName(field, editor); + if (ObjectUtils.isEmpty(sysSetting)) { + sysSetting = new CoreSysSetting(); + sysSetting.setId(IDUtils.snowID()); + sysSetting.setPkey(MAP_KEY_PREFIX + field); + sysSetting.setPval(val == null ? "" : val); + sysSetting.setType("text"); + sysSetting.setSort(1); + coreSysSettingMapper.insert(sysSetting); + return; + } sysSetting.setPval(val); - sysSetting.setType("text"); - sysSetting.setSort(1); - coreSysSettingMapper.insert(sysSetting); - } - sysSetting.setPval(val); - coreSysSettingMapper.updateById(sysSetting); + coreSysSettingMapper.updateById(sysSetting); + }); } @@ -81,7 +97,7 @@ public class SysParameterManage { if (!CollectionUtils.isEmpty(sysSettings)) { return sysSettings.stream().collect(Collectors.toMap(CoreSysSetting::getPkey, CoreSysSetting::getPval)); } - return null; + return new HashMap<>(); } public List groupList(String groupKey) { diff --git a/core/core-backend/src/main/java/io/dataease/system/server/SysParameterServer.java b/core/core-backend/src/main/java/io/dataease/system/server/SysParameterServer.java index 14d5b17476..8bf4f0f075 100644 --- a/core/core-backend/src/main/java/io/dataease/system/server/SysParameterServer.java +++ b/core/core-backend/src/main/java/io/dataease/system/server/SysParameterServer.java @@ -27,13 +27,12 @@ public class SysParameterServer implements SysParameterApi { @Override public void saveOnlineMap(OnlineMapEditor editor) { - sysParameterManage.saveOnlineMap(editor.getKey()); + sysParameterManage.saveOnlineMap(editor); } @Override - public String queryOnlineMap() { - String key = sysParameterManage.queryOnlineMap(); - return StringUtils.isNotBlank(key) ? key : ""; + public OnlineMapEditor queryOnlineMap() { + return sysParameterManage.queryOnlineMap(); } @Override diff --git a/core/core-frontend/src/locales/zh-CN.ts b/core/core-frontend/src/locales/zh-CN.ts index 522c6c7775..e243938f7a 100644 --- a/core/core-frontend/src/locales/zh-CN.ts +++ b/core/core-frontend/src/locales/zh-CN.ts @@ -1451,20 +1451,17 @@ export default { start_point: '起点经纬度', end_point: '终点经纬度', line: '线条', - map_style: '风格', + map_style: '地图风格', + map_style_url: '地图风格 URL', map_pitch: '倾角', map_rotation: '旋转', map_style_normal: '标准', map_style_light: '明亮', map_style_dark: '暗黑', - map_style_whitesmoke: '远山黛', map_style_fresh: '草色青', map_style_grey: '雅士灰', - map_style_graffiti: '涂鸦', - map_style_macaron: '马卡龙', map_style_blue: '靛青蓝', map_style_darkblue: '极夜蓝', - map_style_wine: '酱籽', map_line_type: '类型', type: '类型', map_line_width: '线条宽度', @@ -1542,7 +1539,8 @@ export default { map_symbol_hexagram: '菱形', tip: '提示', hide: '隐藏', - show_label: '显示标签' + show_label: '显示标签', + security_code: '安全密钥' }, dataset: { scope_edit: '仅编辑时生效', diff --git a/core/core-frontend/src/models/chart/chart-attr.d.ts b/core/core-frontend/src/models/chart/chart-attr.d.ts index 68b4a12cb5..9b488470c9 100644 --- a/core/core-frontend/src/models/chart/chart-attr.d.ts +++ b/core/core-frontend/src/models/chart/chart-attr.d.ts @@ -205,6 +205,10 @@ declare interface ChartBasicStyle { * 地图主题风格 */ mapStyle: string + /** + * 自定义地图风格url + */ + mapStyleUrl: string heatMapType?: string heatMapIntensity?: number heatMapRadius?: number diff --git a/core/core-frontend/src/store/modules/map.ts b/core/core-frontend/src/store/modules/map.ts index f937327aa7..f25ffcd020 100644 --- a/core/core-frontend/src/store/modules/map.ts +++ b/core/core-frontend/src/store/modules/map.ts @@ -3,12 +3,18 @@ import { store } from '@/store' import { FeatureCollection } from '@antv/l7plot/dist/esm/plots/choropleth/types' interface MapStore { mapCache: Record - mapKey: string + mapKey: { + key: string + securityCode: string + } } export const useMapStore = defineStore('map', { state: (): MapStore => ({ mapCache: {}, - mapKey: '' + mapKey: { + key: '', + securityCode: '' + } }), actions: { setMap({ id, geoJson }) { diff --git a/core/core-frontend/src/views/chart/components/editor/editor-style/components/BasicStyleSelector.vue b/core/core-frontend/src/views/chart/components/editor/editor-style/components/BasicStyleSelector.vue index c81edad34b..6e44206cbe 100644 --- a/core/core-frontend/src/views/chart/components/editor/editor-style/components/BasicStyleSelector.vue +++ b/core/core-frontend/src/views/chart/components/editor/editor-style/components/BasicStyleSelector.vue @@ -213,13 +213,10 @@ const mapStyleOptions = [ { name: t('chart.map_style_darkblue'), value: 'darkblue' }, { name: t('chart.map_style_light'), value: 'light' }, { name: t('chart.map_style_dark'), value: 'dark' }, - { name: t('chart.map_style_whitesmoke'), value: 'whitesmoke' }, { name: t('chart.map_style_fresh'), value: 'fresh' }, { name: t('chart.map_style_grey'), value: 'grey' }, - { name: t('chart.map_style_graffiti'), value: 'graffiti' }, - { name: t('chart.map_style_macaron'), value: 'macaron' }, { name: t('chart.map_style_blue'), value: 'blue' }, - { name: t('chart.map_style_wine'), value: 'wine' } + { name: t('commons.custom'), value: 'custom' } ] const heatMapTypeOptions = [ { name: t('chart.heatmap_classics'), value: 'heatmap' }, @@ -374,7 +371,7 @@ onMounted(() => { @@ -393,6 +390,21 @@ onMounted(() => { + + + + + + +