mirror of
https://github.com/dataease/dataease.git
synced 2025-02-25 03:52:59 +08:00
fix(应用市场): 应用市场格式化等问题修复
This commit is contained in:
parent
d634950272
commit
9da3990f25
@ -2,15 +2,12 @@ package io.dataease.controller.panel;
|
|||||||
|
|
||||||
import com.github.xiaoymin.knife4j.annotations.ApiSupport;
|
import com.github.xiaoymin.knife4j.annotations.ApiSupport;
|
||||||
import io.dataease.controller.handler.annotation.I18n;
|
import io.dataease.controller.handler.annotation.I18n;
|
||||||
import io.dataease.controller.request.panel.PanelAppTemplateApplyRequest;
|
|
||||||
import io.dataease.controller.request.panel.PanelAppTemplateRequest;
|
import io.dataease.controller.request.panel.PanelAppTemplateRequest;
|
||||||
import io.dataease.plugins.common.base.domain.PanelAppTemplate;
|
|
||||||
import io.dataease.plugins.common.base.domain.PanelAppTemplateWithBLOBs;
|
import io.dataease.plugins.common.base.domain.PanelAppTemplateWithBLOBs;
|
||||||
import io.dataease.service.panel.PanelAppTemplateService;
|
import io.dataease.service.panel.PanelAppTemplateService;
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
import io.swagger.annotations.ApiOperation;
|
import io.swagger.annotations.ApiOperation;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@ -63,12 +60,4 @@ public class PanelAppTemplateController {
|
|||||||
return panelAppTemplateService.nameCheck(request);
|
return panelAppTemplateService.nameCheck(request);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiOperation("应用模板")
|
|
||||||
@PostMapping("/appApply")
|
|
||||||
@I18n
|
|
||||||
public String appApply(@RequestBody PanelAppTemplateApplyRequest request) throws Exception{
|
|
||||||
// return panelAppTemplateService.appApply(request);
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -299,7 +299,7 @@ public class DataSetTableService {
|
|||||||
@DeCleaner(value = DePermissionType.DATASET, key = "sceneId")
|
@DeCleaner(value = DePermissionType.DATASET, key = "sceneId")
|
||||||
public DatasetTable save(DataSetTableRequest datasetTable) throws Exception {
|
public DatasetTable save(DataSetTableRequest datasetTable) throws Exception {
|
||||||
checkName(datasetTable);
|
checkName(datasetTable);
|
||||||
if (StringUtils.equalsIgnoreCase(datasetTable.getType(), DatasetType.SQL.name())&&!"appApply".equalsIgnoreCase(datasetTable.getOptFrom())) {
|
if (StringUtils.equalsIgnoreCase(datasetTable.getType(), DatasetType.SQL.name()) && !"appApply".equalsIgnoreCase(datasetTable.getOptFrom())) {
|
||||||
DataSetTableRequest dataSetTableRequest = new DataSetTableRequest();
|
DataSetTableRequest dataSetTableRequest = new DataSetTableRequest();
|
||||||
BeanUtils.copyBean(dataSetTableRequest, datasetTable);
|
BeanUtils.copyBean(dataSetTableRequest, datasetTable);
|
||||||
getSQLPreview(dataSetTableRequest);
|
getSQLPreview(dataSetTableRequest);
|
||||||
@ -317,7 +317,7 @@ public class DataSetTableService {
|
|||||||
|
|
||||||
// 添加表成功后,获取当前表字段和类型,抽象到dataease数据库
|
// 添加表成功后,获取当前表字段和类型,抽象到dataease数据库
|
||||||
if (insert == 1) {
|
if (insert == 1) {
|
||||||
if(datasetTable.getOptFrom()==null || !"appApply".equalsIgnoreCase(datasetTable.getOptFrom())){
|
if (datasetTable.getOptFrom() == null || !"appApply".equalsIgnoreCase(datasetTable.getOptFrom())) {
|
||||||
saveTableField(datasetTable);
|
saveTableField(datasetTable);
|
||||||
}
|
}
|
||||||
extractData(datasetTable);
|
extractData(datasetTable);
|
||||||
@ -2871,18 +2871,18 @@ public class DataSetTableService {
|
|||||||
return sql.contains(SubstitutedParams);
|
return sql.contains(SubstitutedParams);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void createAppCustomDorisView(String datasetInfo,String tableId) throws Exception {
|
public void createAppCustomDorisView(String datasetInfo, String tableId) throws Exception {
|
||||||
DataTableInfoDTO dataTableInfoDTO = new Gson().fromJson(datasetInfo, DataTableInfoDTO.class);
|
DataTableInfoDTO dataTableInfoDTO = new Gson().fromJson(datasetInfo, DataTableInfoDTO.class);
|
||||||
createDorisView(TableUtils.tableName(tableId), getCustomViewSQL(dataTableInfoDTO,
|
createDorisView(TableUtils.tableName(tableId), getCustomViewSQL(dataTableInfoDTO,
|
||||||
dataSetTableUnionService.listByTableId(dataTableInfoDTO.getList().get(0).getTableId())));
|
dataSetTableUnionService.listByTableId(dataTableInfoDTO.getList().get(0).getTableId())));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void createAppUnionDorisView(String datasetInfo,String tableId) throws Exception {
|
public void createAppUnionDorisView(String datasetInfo, String tableId) throws Exception {
|
||||||
// save field
|
// save field
|
||||||
DataTableInfoDTO dataTableInfoDTO = new Gson().fromJson(datasetInfo, DataTableInfoDTO.class);
|
DataTableInfoDTO dataTableInfoDTO = new Gson().fromJson(datasetInfo, DataTableInfoDTO.class);
|
||||||
Map<String, Object> sqlMap = getUnionSQLDoris(dataTableInfoDTO);
|
Map<String, Object> sqlMap = getUnionSQLDoris(dataTableInfoDTO);
|
||||||
String sql = (String) sqlMap.get("sql");
|
String sql = (String) sqlMap.get("sql");
|
||||||
// custom 创建doris视图
|
// custom 创建doris视图
|
||||||
createDorisView(TableUtils.tableName(tableId),sql);
|
createDorisView(TableUtils.tableName(tableId), sql);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,34 +1,11 @@
|
|||||||
package io.dataease.service.panel;
|
package io.dataease.service.panel;
|
||||||
|
|
||||||
import com.alibaba.fastjson.JSON;
|
|
||||||
import com.google.gson.Gson;
|
|
||||||
import io.dataease.commons.constants.CommonConstants;
|
|
||||||
import io.dataease.commons.utils.AuthUtils;
|
import io.dataease.commons.utils.AuthUtils;
|
||||||
import io.dataease.commons.utils.BeanUtils;
|
|
||||||
import io.dataease.controller.request.dataset.DataSetTableRequest;
|
|
||||||
import io.dataease.controller.request.panel.PanelAppTemplateApplyRequest;
|
|
||||||
import io.dataease.controller.request.panel.PanelAppTemplateRequest;
|
|
||||||
import io.dataease.controller.request.panel.PanelGroupRequest;
|
|
||||||
import io.dataease.dto.dataset.DataSetTaskDTO;
|
|
||||||
import io.dataease.plugins.common.base.domain.*;
|
import io.dataease.plugins.common.base.domain.*;
|
||||||
import io.dataease.plugins.common.base.mapper.PanelAppTemplateLogMapper;
|
import io.dataease.plugins.common.base.mapper.PanelAppTemplateLogMapper;
|
||||||
import io.dataease.plugins.common.base.mapper.PanelAppTemplateMapper;
|
|
||||||
import io.dataease.plugins.common.constants.DatasetType;
|
|
||||||
import io.dataease.service.chart.ChartViewFieldService;
|
|
||||||
import io.dataease.service.chart.ChartViewService;
|
|
||||||
import io.dataease.service.dataset.DataSetTableFieldsService;
|
|
||||||
import io.dataease.service.dataset.DataSetTableService;
|
|
||||||
import io.dataease.service.datasource.DatasourceService;
|
|
||||||
import org.apache.commons.lang3.StringUtils;
|
|
||||||
import org.pentaho.di.core.util.UUIDUtil;
|
import org.pentaho.di.core.util.UUIDUtil;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
|
||||||
import org.springframework.util.CollectionUtils;
|
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Author: wangjiahao
|
* Author: wangjiahao
|
||||||
|
@ -21,7 +21,6 @@ import io.dataease.service.datasource.DatasourceService;
|
|||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.pentaho.di.core.util.UUIDUtil;
|
import org.pentaho.di.core.util.UUIDUtil;
|
||||||
import org.springframework.context.annotation.Lazy;
|
import org.springframework.context.annotation.Lazy;
|
||||||
import org.springframework.scheduling.annotation.Async;
|
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
import org.springframework.util.CollectionUtils;
|
import org.springframework.util.CollectionUtils;
|
||||||
@ -60,40 +59,40 @@ public class PanelAppTemplateService {
|
|||||||
@Resource
|
@Resource
|
||||||
private DataSetGroupService dataSetGroupService;
|
private DataSetGroupService dataSetGroupService;
|
||||||
|
|
||||||
public List<PanelAppTemplateWithBLOBs> list(PanelAppTemplateRequest request){
|
public List<PanelAppTemplateWithBLOBs> list(PanelAppTemplateRequest request) {
|
||||||
PanelAppTemplateExample example = new PanelAppTemplateExample();
|
PanelAppTemplateExample example = new PanelAppTemplateExample();
|
||||||
if(StringUtils.isNotEmpty(request.getPid())){
|
if (StringUtils.isNotEmpty(request.getPid())) {
|
||||||
example.createCriteria().andPidEqualTo(request.getPid());
|
example.createCriteria().andPidEqualTo(request.getPid());
|
||||||
}
|
}
|
||||||
if(StringUtils.isNotEmpty(request.getNodeType())){
|
if (StringUtils.isNotEmpty(request.getNodeType())) {
|
||||||
example.createCriteria().andNodeTypeEqualTo(request.getNodeType());
|
example.createCriteria().andNodeTypeEqualTo(request.getNodeType());
|
||||||
}
|
}
|
||||||
return panelAppTemplateMapper.selectByExampleWithBLOBs(example);
|
return panelAppTemplateMapper.selectByExampleWithBLOBs(example);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void save(PanelAppTemplateRequest request){
|
public void save(PanelAppTemplateRequest request) {
|
||||||
request.setId(UUIDUtil.getUUIDAsString());
|
request.setId(UUIDUtil.getUUIDAsString());
|
||||||
request.setCreateUser(AuthUtils.getUser().getUsername());
|
request.setCreateUser(AuthUtils.getUser().getUsername());
|
||||||
request.setCreateTime(System.currentTimeMillis());
|
request.setCreateTime(System.currentTimeMillis());
|
||||||
PanelAppTemplateWithBLOBs requestTemplate = new PanelAppTemplateWithBLOBs();
|
PanelAppTemplateWithBLOBs requestTemplate = new PanelAppTemplateWithBLOBs();
|
||||||
BeanUtils.copyBean(requestTemplate,request);
|
BeanUtils.copyBean(requestTemplate, request);
|
||||||
if(StringUtils.isEmpty(requestTemplate.getNodeType())){
|
if (StringUtils.isEmpty(requestTemplate.getNodeType())) {
|
||||||
requestTemplate.setNodeType("template");
|
requestTemplate.setNodeType("template");
|
||||||
}
|
}
|
||||||
panelAppTemplateMapper.insertSelective(requestTemplate);
|
panelAppTemplateMapper.insertSelective(requestTemplate);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void update(PanelAppTemplateRequest request){
|
public void update(PanelAppTemplateRequest request) {
|
||||||
nameCheck(CommonConstants.OPT_TYPE.UPDATE,request.getName(),request.getPid(),request.getId());
|
nameCheck(CommonConstants.OPT_TYPE.UPDATE, request.getName(), request.getPid(), request.getId());
|
||||||
request.setUpdateUser(AuthUtils.getUser().getUsername());
|
request.setUpdateUser(AuthUtils.getUser().getUsername());
|
||||||
request.setUpdateTime(System.currentTimeMillis());
|
request.setUpdateTime(System.currentTimeMillis());
|
||||||
PanelAppTemplateWithBLOBs requestTemplate = new PanelAppTemplateWithBLOBs();
|
PanelAppTemplateWithBLOBs requestTemplate = new PanelAppTemplateWithBLOBs();
|
||||||
BeanUtils.copyBean(requestTemplate,request);
|
BeanUtils.copyBean(requestTemplate, request);
|
||||||
panelAppTemplateMapper.updateByPrimaryKeySelective(requestTemplate);
|
panelAppTemplateMapper.updateByPrimaryKeySelective(requestTemplate);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void delete(String appTemplateId){
|
public void delete(String appTemplateId) {
|
||||||
panelAppTemplateMapper.deleteByPrimaryKey(appTemplateId);
|
panelAppTemplateMapper.deleteByPrimaryKey(appTemplateId);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -118,19 +117,21 @@ public class PanelAppTemplateService {
|
|||||||
return CommonConstants.CHECK_RESULT.EXIST_ALL;
|
return CommonConstants.CHECK_RESULT.EXIST_ALL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public Map<String,String> applyDatasource(List<Datasource> oldDatasourceList,List<Datasource> newDatasourceList) throws Exception{
|
public Map<String, String> applyDatasource(List<Datasource> oldDatasourceList, List<Datasource> newDatasourceList) throws Exception {
|
||||||
Map<String,String> datasourceRelaMap = new HashMap<>();
|
Map<String, String> datasourceRelaMap = new HashMap<>();
|
||||||
for(int i=0;i<newDatasourceList.size();i++){
|
for (int i = 0; i < newDatasourceList.size(); i++) {
|
||||||
Datasource datasource = newDatasourceList.get(0);
|
Datasource datasource = newDatasourceList.get(0);
|
||||||
datasource.setId(null);
|
datasource.setId(null);
|
||||||
Datasource newDatasource = datasourceService.addDatasource(datasource);
|
Datasource newDatasource = datasourceService.addDatasource(datasource);
|
||||||
datasourceRelaMap.put(oldDatasourceList.get(i).getId(),newDatasource.getId());
|
datasourceRelaMap.put(oldDatasourceList.get(i).getId(), newDatasource.getId());
|
||||||
}
|
}
|
||||||
return datasourceRelaMap;
|
return datasourceRelaMap;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public void applyPanelView(List<PanelView> panelViewsInfo,Map<String,String> chartViewsRelaMap,String panelId){
|
public void applyPanelView(List<PanelView> panelViewsInfo, Map<String, String> chartViewsRelaMap, String panelId) {
|
||||||
Long time = System.currentTimeMillis();
|
Long time = System.currentTimeMillis();
|
||||||
String userName = AuthUtils.getUser().getUsername();
|
String userName = AuthUtils.getUser().getUsername();
|
||||||
panelViewsInfo.forEach(panelView -> {
|
panelViewsInfo.forEach(panelView -> {
|
||||||
@ -142,8 +143,9 @@ public class PanelAppTemplateService {
|
|||||||
panelViewService.save(panelView);
|
panelViewService.save(panelView);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public String applyPanel(PanelGroupRequest panelInfo,Map<String,String> chartViewsRelaMap,String newPanelId,String panelName,String pid){
|
public String applyPanel(PanelGroupRequest panelInfo, Map<String, String> chartViewsRelaMap, String newPanelId, String panelName, String pid) {
|
||||||
panelInfo.setId(newPanelId);
|
panelInfo.setId(newPanelId);
|
||||||
panelInfo.setPid(pid);
|
panelInfo.setPid(pid);
|
||||||
panelInfo.setName(panelName);
|
panelInfo.setName(panelName);
|
||||||
@ -151,101 +153,105 @@ public class PanelAppTemplateService {
|
|||||||
panelInfo.setPanelType("self");
|
panelInfo.setPanelType("self");
|
||||||
panelInfo.setCreateBy(AuthUtils.getUser().getUsername());
|
panelInfo.setCreateBy(AuthUtils.getUser().getUsername());
|
||||||
panelInfo.setCreateTime(System.currentTimeMillis());
|
panelInfo.setCreateTime(System.currentTimeMillis());
|
||||||
panelGroupService.newPanelFromApp(panelInfo,chartViewsRelaMap);
|
panelGroupService.newPanelFromApp(panelInfo, chartViewsRelaMap);
|
||||||
return newPanelId;
|
return newPanelId;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public Map<String,String> applyDataset(List<DatasetTable> datasetTablesInfo,Map<String,String> datasourceRelaMap,String sceneId) throws Exception{
|
public Map<String, String> applyDataset(List<DatasetTable> datasetTablesInfo, Map<String, String> datasourceRelaMap, String sceneId) throws Exception {
|
||||||
Map<String,String> datasetsRelaMap = new HashMap<>();
|
Map<String, String> datasetsRelaMap = new HashMap<>();
|
||||||
for(DatasetTable datasetTable:datasetTablesInfo){
|
for (DatasetTable datasetTable : datasetTablesInfo) {
|
||||||
String oldId = datasetTable.getId();
|
String oldId = datasetTable.getId();
|
||||||
datasetTable.setId(null);
|
datasetTable.setId(null);
|
||||||
datasetTable.setSceneId(sceneId);
|
datasetTable.setSceneId(sceneId);
|
||||||
datasetTable.setDataSourceId(datasourceRelaMap.get(datasetTable.getDataSourceId()));
|
datasetTable.setDataSourceId(datasourceRelaMap.get(datasetTable.getDataSourceId()));
|
||||||
DataSetTableRequest datasetRequest = new DataSetTableRequest();
|
DataSetTableRequest datasetRequest = new DataSetTableRequest();
|
||||||
BeanUtils.copyBean(datasetRequest,datasetTable);
|
BeanUtils.copyBean(datasetRequest, datasetTable);
|
||||||
datasetRequest.setOptFrom("appApply");
|
datasetRequest.setOptFrom("appApply");
|
||||||
DatasetTable newDataset = dataSetTableService.save(datasetRequest);
|
DatasetTable newDataset = dataSetTableService.save(datasetRequest);
|
||||||
datasetsRelaMap.put(oldId,newDataset.getId());
|
datasetsRelaMap.put(oldId, newDataset.getId());
|
||||||
}
|
}
|
||||||
return datasetsRelaMap;
|
return datasetsRelaMap;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public Map<String,String> applyDatasetField(List<DatasetTableField> datasetTableFieldsInfo ,Map<String,String> datasetsRelaMap ){
|
public Map<String, String> applyDatasetField(List<DatasetTableField> datasetTableFieldsInfo, Map<String, String> datasetsRelaMap) {
|
||||||
Map<String,String> datasetFieldsRelaMap = new HashMap<>();
|
Map<String, String> datasetFieldsRelaMap = new HashMap<>();
|
||||||
for(DatasetTableField datasetTableField:datasetTableFieldsInfo){
|
for (DatasetTableField datasetTableField : datasetTableFieldsInfo) {
|
||||||
String oldId = datasetTableField.getId();
|
String oldId = datasetTableField.getId();
|
||||||
datasetTableField.setTableId(datasetsRelaMap.get(datasetTableField.getTableId()));
|
datasetTableField.setTableId(datasetsRelaMap.get(datasetTableField.getTableId()));
|
||||||
DatasetTableField newTableField = dataSetTableFieldsService.save(datasetTableField);
|
DatasetTableField newTableField = dataSetTableFieldsService.save(datasetTableField);
|
||||||
datasetFieldsRelaMap.put(oldId,newTableField.getId());
|
datasetFieldsRelaMap.put(oldId, newTableField.getId());
|
||||||
}
|
}
|
||||||
return datasetFieldsRelaMap;
|
return datasetFieldsRelaMap;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public void resetCustomAndUnionDataset(List<DatasetTable> datasetTablesInfo, Map<String,String> datasetRelaMap, Map<String,String> datasetFieldsRelaMap) throws Exception{
|
public void resetCustomAndUnionDataset(List<DatasetTable> datasetTablesInfo, Map<String, String> datasetRelaMap, Map<String, String> datasetFieldsRelaMap) throws Exception {
|
||||||
for(DatasetTable datasetTable:datasetTablesInfo ){
|
for (DatasetTable datasetTable : datasetTablesInfo) {
|
||||||
if((DatasetType.CUSTOM.name().equalsIgnoreCase(datasetTable.getType())||DatasetType.UNION.name().equalsIgnoreCase(datasetTable.getType()))){
|
if ((DatasetType.CUSTOM.name().equalsIgnoreCase(datasetTable.getType()) || DatasetType.UNION.name().equalsIgnoreCase(datasetTable.getType()))) {
|
||||||
datasetRelaMap.forEach((k,v)->{
|
datasetRelaMap.forEach((k, v) -> {
|
||||||
datasetTable.setInfo(datasetTable.getInfo().replaceAll(k,v));
|
datasetTable.setInfo(datasetTable.getInfo().replaceAll(k, v));
|
||||||
});
|
});
|
||||||
datasetFieldsRelaMap.forEach((k,v)->{
|
datasetFieldsRelaMap.forEach((k, v) -> {
|
||||||
datasetTable.setInfo(datasetTable.getInfo().replaceAll(k,v));
|
datasetTable.setInfo(datasetTable.getInfo().replaceAll(k, v));
|
||||||
});
|
});
|
||||||
if(1 == datasetTable.getMode()){
|
if (1 == datasetTable.getMode()) {
|
||||||
if(DatasetType.CUSTOM.name().equalsIgnoreCase(datasetTable.getType())){
|
if (DatasetType.CUSTOM.name().equalsIgnoreCase(datasetTable.getType())) {
|
||||||
dataSetTableService.createAppCustomDorisView(datasetTable.getInfo(),datasetTable.getId());
|
dataSetTableService.createAppCustomDorisView(datasetTable.getInfo(), datasetTable.getId());
|
||||||
}else if(DatasetType.UNION.name().equalsIgnoreCase(datasetTable.getType())){
|
} else if (DatasetType.UNION.name().equalsIgnoreCase(datasetTable.getType())) {
|
||||||
dataSetTableService.createAppUnionDorisView(datasetTable.getInfo(),datasetTable.getId());
|
dataSetTableService.createAppUnionDorisView(datasetTable.getInfo(), datasetTable.getId());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public Map<String,String> applyViews(List<ChartViewWithBLOBs> chartViewsInfo,Map<String,String> datasetsRelaMap,Map<String,String> datasetFieldsRelaMap,String sceneId) throws Exception{
|
public Map<String, String> applyViews(List<ChartViewWithBLOBs> chartViewsInfo, Map<String, String> datasetsRelaMap, Map<String, String> datasetFieldsRelaMap, String sceneId) throws Exception {
|
||||||
Map<String,String> chartViewsRelaMap = new HashMap<>();
|
Map<String, String> chartViewsRelaMap = new HashMap<>();
|
||||||
for(ChartViewWithBLOBs chartView:chartViewsInfo){
|
for (ChartViewWithBLOBs chartView : chartViewsInfo) {
|
||||||
String oldViewId = chartView.getId();
|
String oldViewId = chartView.getId();
|
||||||
// 替换datasetId
|
// 替换datasetId
|
||||||
chartView.setTableId(datasetsRelaMap.get(chartView.getTableId()));
|
chartView.setTableId(datasetsRelaMap.get(chartView.getTableId()));
|
||||||
datasetsRelaMap.forEach((k,v)->{
|
datasetsRelaMap.forEach((k, v) -> {
|
||||||
chartView.setXAxis(chartView.getXAxis().replaceAll(k,v));
|
chartView.setXAxis(chartView.getXAxis().replaceAll(k, v));
|
||||||
chartView.setXAxisExt(chartView.getXAxisExt().replaceAll(k,v));
|
chartView.setXAxisExt(chartView.getXAxisExt().replaceAll(k, v));
|
||||||
chartView.setYAxis(chartView.getYAxis().replaceAll(k,v));
|
chartView.setYAxis(chartView.getYAxis().replaceAll(k, v));
|
||||||
chartView.setYAxisExt(chartView.getYAxisExt().replaceAll(k,v));
|
chartView.setYAxisExt(chartView.getYAxisExt().replaceAll(k, v));
|
||||||
chartView.setExtStack(chartView.getExtStack().replaceAll(k,v));
|
chartView.setExtStack(chartView.getExtStack().replaceAll(k, v));
|
||||||
chartView.setExtBubble(chartView.getExtBubble().replaceAll(k,v));
|
chartView.setExtBubble(chartView.getExtBubble().replaceAll(k, v));
|
||||||
chartView.setCustomAttr(chartView.getCustomAttr().replaceAll(k,v));
|
chartView.setCustomAttr(chartView.getCustomAttr().replaceAll(k, v));
|
||||||
chartView.setCustomStyle(chartView.getCustomStyle().replaceAll(k,v));
|
chartView.setCustomStyle(chartView.getCustomStyle().replaceAll(k, v));
|
||||||
chartView.setCustomFilter(chartView.getCustomFilter().replaceAll(k,v));
|
chartView.setCustomFilter(chartView.getCustomFilter().replaceAll(k, v));
|
||||||
chartView.setDrillFields(chartView.getDrillFields().replaceAll(k,v));
|
chartView.setDrillFields(chartView.getDrillFields().replaceAll(k, v));
|
||||||
});
|
});
|
||||||
//替换datasetFieldId
|
//替换datasetFieldId
|
||||||
datasetFieldsRelaMap.forEach((k,v)->{
|
datasetFieldsRelaMap.forEach((k, v) -> {
|
||||||
chartView.setXAxis(chartView.getXAxis().replaceAll(k,v));
|
chartView.setXAxis(chartView.getXAxis().replaceAll(k, v));
|
||||||
chartView.setXAxisExt(chartView.getXAxisExt().replaceAll(k,v));
|
chartView.setXAxisExt(chartView.getXAxisExt().replaceAll(k, v));
|
||||||
chartView.setYAxis(chartView.getYAxis().replaceAll(k,v));
|
chartView.setYAxis(chartView.getYAxis().replaceAll(k, v));
|
||||||
chartView.setYAxisExt(chartView.getYAxisExt().replaceAll(k,v));
|
chartView.setYAxisExt(chartView.getYAxisExt().replaceAll(k, v));
|
||||||
chartView.setExtStack(chartView.getExtStack().replaceAll(k,v));
|
chartView.setExtStack(chartView.getExtStack().replaceAll(k, v));
|
||||||
chartView.setExtBubble(chartView.getExtBubble().replaceAll(k,v));
|
chartView.setExtBubble(chartView.getExtBubble().replaceAll(k, v));
|
||||||
chartView.setCustomAttr(chartView.getCustomAttr().replaceAll(k,v));
|
chartView.setCustomAttr(chartView.getCustomAttr().replaceAll(k, v));
|
||||||
chartView.setCustomStyle(chartView.getCustomStyle().replaceAll(k,v));
|
chartView.setCustomStyle(chartView.getCustomStyle().replaceAll(k, v));
|
||||||
chartView.setCustomFilter(chartView.getCustomFilter().replaceAll(k,v));
|
chartView.setCustomFilter(chartView.getCustomFilter().replaceAll(k, v));
|
||||||
chartView.setDrillFields(chartView.getDrillFields().replaceAll(k,v));
|
chartView.setDrillFields(chartView.getDrillFields().replaceAll(k, v));
|
||||||
});
|
});
|
||||||
chartView.setId(null);
|
chartView.setId(null);
|
||||||
chartView.setSceneId(sceneId);
|
chartView.setSceneId(sceneId);
|
||||||
ChartViewWithBLOBs newOne = chartViewService.newOne(chartView);
|
ChartViewWithBLOBs newOne = chartViewService.newOne(chartView);
|
||||||
chartViewsRelaMap.put(oldViewId,newOne.getId());
|
chartViewsRelaMap.put(oldViewId, newOne.getId());
|
||||||
}
|
}
|
||||||
return chartViewsRelaMap;
|
return chartViewsRelaMap;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public Map<String,String> applyViewsField(List<ChartViewField> chartViewFieldsInfo,Map<String,String> chartViewsRelaMap,Map<String,String> datasetsRelaMap,Map<String,String> datasetFieldsRelaMap){
|
public Map<String, String> applyViewsField(List<ChartViewField> chartViewFieldsInfo, Map<String, String> chartViewsRelaMap, Map<String, String> datasetsRelaMap, Map<String, String> datasetFieldsRelaMap) {
|
||||||
Map<String,String> chartViewFieldsRelaMap = new HashMap<>();
|
Map<String, String> chartViewFieldsRelaMap = new HashMap<>();
|
||||||
if(!CollectionUtils.isEmpty(chartViewFieldsInfo)){
|
if (!CollectionUtils.isEmpty(chartViewFieldsInfo)) {
|
||||||
for(ChartViewField chartViewField:chartViewFieldsInfo){
|
for (ChartViewField chartViewField : chartViewFieldsInfo) {
|
||||||
String oldChartFieldId = chartViewField.getId();
|
String oldChartFieldId = chartViewField.getId();
|
||||||
chartViewField.setId(null);
|
chartViewField.setId(null);
|
||||||
//替换datasetId
|
//替换datasetId
|
||||||
@ -253,24 +259,24 @@ public class PanelAppTemplateService {
|
|||||||
//替换chartViewId
|
//替换chartViewId
|
||||||
chartViewField.setChartId(chartViewsRelaMap.get(chartViewField.getId()));
|
chartViewField.setChartId(chartViewsRelaMap.get(chartViewField.getId()));
|
||||||
//替换datasetFieldId
|
//替换datasetFieldId
|
||||||
datasetFieldsRelaMap.forEach((k,v)->{
|
datasetFieldsRelaMap.forEach((k, v) -> {
|
||||||
chartViewField.setOriginName(chartViewField.getOriginName().replaceAll(k,v));
|
chartViewField.setOriginName(chartViewField.getOriginName().replaceAll(k, v));
|
||||||
});
|
});
|
||||||
ChartViewField newChartViewField = chartViewFieldService.save(chartViewField);
|
ChartViewField newChartViewField = chartViewFieldService.save(chartViewField);
|
||||||
chartViewFieldsRelaMap.put(oldChartFieldId,newChartViewField.getId());
|
chartViewFieldsRelaMap.put(oldChartFieldId, newChartViewField.getId());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return chartViewFieldsRelaMap;
|
return chartViewFieldsRelaMap;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void nameCheck(PanelAppTemplateApplyRequest request){
|
public void nameCheck(PanelAppTemplateApplyRequest request) {
|
||||||
panelGroupService.checkPanelName(request.getPanelName(),request.getPanelId(), PanelConstants.OPT_TYPE_UPDATE,null,null);
|
panelGroupService.checkPanelName(request.getPanelName(), request.getPanelId(), PanelConstants.OPT_TYPE_INSERT, null, "panel");
|
||||||
DatasetGroup datasetGroup = new DatasetGroup();
|
DatasetGroup datasetGroup = new DatasetGroup();
|
||||||
datasetGroup.setPid(request.getDatasetGroupId());
|
datasetGroup.setPid(request.getDatasetGroupId());
|
||||||
datasetGroup.setName(request.getDatasetGroupName());
|
datasetGroup.setName(request.getDatasetGroupName());
|
||||||
dataSetGroupService.checkName(datasetGroup);
|
dataSetGroupService.checkName(datasetGroup);
|
||||||
request.getDatasourceList().stream().forEach(datasource -> {
|
request.getDatasourceList().stream().forEach(datasource -> {
|
||||||
datasourceService.checkName(datasource.getName(),datasource.getType(),null);
|
datasourceService.checkName(datasource.getName(), datasource.getType(), null);
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
package io.dataease.service.panel;
|
package io.dataease.service.panel;
|
||||||
|
|
||||||
import com.alibaba.fastjson.JSON;
|
|
||||||
import com.alibaba.fastjson.JSONArray;
|
import com.alibaba.fastjson.JSONArray;
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import com.google.gson.Gson;
|
import com.google.gson.Gson;
|
||||||
|
import com.google.gson.reflect.TypeToken;
|
||||||
import io.dataease.auth.annotation.DeCleaner;
|
import io.dataease.auth.annotation.DeCleaner;
|
||||||
import io.dataease.commons.constants.*;
|
import io.dataease.commons.constants.*;
|
||||||
import io.dataease.commons.utils.*;
|
import io.dataease.commons.utils.*;
|
||||||
@ -33,6 +33,7 @@ import io.dataease.listener.util.CacheUtils;
|
|||||||
import io.dataease.plugins.common.base.domain.*;
|
import io.dataease.plugins.common.base.domain.*;
|
||||||
import io.dataease.plugins.common.base.mapper.*;
|
import io.dataease.plugins.common.base.mapper.*;
|
||||||
import io.dataease.plugins.common.constants.DeTypeConstants;
|
import io.dataease.plugins.common.constants.DeTypeConstants;
|
||||||
|
import io.dataease.plugins.common.dto.dataset.SqlVariableDetails;
|
||||||
import io.dataease.service.chart.ChartGroupService;
|
import io.dataease.service.chart.ChartGroupService;
|
||||||
import io.dataease.service.chart.ChartViewService;
|
import io.dataease.service.chart.ChartViewService;
|
||||||
import io.dataease.service.dataset.DataSetGroupService;
|
import io.dataease.service.dataset.DataSetGroupService;
|
||||||
@ -829,21 +830,21 @@ public class PanelGroupService {
|
|||||||
//查询应用信息
|
//查询应用信息
|
||||||
PanelAppTemplateWithBLOBs appInfo = panelAppTemplateMapper.selectByPrimaryKey(request.getAppTemplateId());
|
PanelAppTemplateWithBLOBs appInfo = panelAppTemplateMapper.selectByPrimaryKey(request.getAppTemplateId());
|
||||||
//1.获取所有视图信息
|
//1.获取所有视图信息
|
||||||
List<ChartViewWithBLOBs> chartViewsInfo = JSON.parseArray(appInfo.getChartViewsInfo(),ChartViewWithBLOBs.class);
|
List<ChartViewWithBLOBs> chartViewsInfo = gson.fromJson(appInfo.getChartViewsInfo(), new TypeToken<List<ChartViewWithBLOBs>>(){}.getType());
|
||||||
//2.获取视图扩展字段信息
|
//2.获取视图扩展字段信息
|
||||||
List<ChartViewField> chartViewFieldsInfo = JSON.parseArray(appInfo.getChartViewFieldsInfo(),ChartViewField.class);
|
List<ChartViewField> chartViewFieldsInfo = gson.fromJson(appInfo.getChartViewFieldsInfo(), new TypeToken<List<ChartViewField>>(){}.getType());
|
||||||
//3.获取所有数据集信息
|
//3.获取所有数据集信息
|
||||||
List<DatasetTable> datasetTablesInfo = JSON.parseArray(appInfo.getDatasetTablesInfo(),DatasetTable.class);
|
List<DatasetTable> datasetTablesInfo = gson.fromJson(appInfo.getDatasetTablesInfo(), new TypeToken<List<DatasetTable>>(){}.getType());
|
||||||
//4.获取所有数据集字段信息
|
//4.获取所有数据集字段信息
|
||||||
List<DatasetTableField> datasetTableFieldsInfo = JSON.parseArray(appInfo.getDatasetTableFieldsInfo(),DatasetTableField.class);
|
List<DatasetTableField> datasetTableFieldsInfo = gson.fromJson(appInfo.getDatasetTableFieldsInfo(), new TypeToken<List<DatasetTableField>>(){}.getType());
|
||||||
//5.获取所有任务信息
|
//5.获取所有任务信息
|
||||||
List<DataSetTaskDTO> dataSetTasksInfo = JSON.parseArray(appInfo.getDatasetTasksInfo(),DataSetTaskDTO.class);
|
List<DataSetTaskDTO> dataSetTasksInfo = gson.fromJson(appInfo.getDatasetTasksInfo(), new TypeToken<List<DataSetTaskDTO>>(){}.getType());
|
||||||
//6.获取所有数据源信息
|
//6.获取所有数据源信息
|
||||||
List<Datasource> oldDatasourceInfo = JSON.parseArray(appInfo.getDatasourceInfo(),Datasource.class);
|
List<Datasource> oldDatasourceInfo = gson.fromJson(appInfo.getDatasourceInfo(), new TypeToken<List<Datasource>>(){}.getType());
|
||||||
//获取仪表板信息
|
//获取仪表板信息
|
||||||
PanelGroupRequest panelInfo = JSON.parseObject(appInfo.getPanelInfo(),PanelGroupRequest.class);
|
PanelGroupRequest panelInfo = gson.fromJson(appInfo.getPanelInfo(),PanelGroupRequest.class);
|
||||||
//获取仪表板视图信息
|
//获取仪表板视图信息
|
||||||
List<PanelView> panelViewsInfo = JSON.parseArray(appInfo.getPanelViewsInfo(),PanelView.class);
|
List<PanelView> panelViewsInfo = gson.fromJson(appInfo.getPanelViewsInfo(), new TypeToken<List<PanelView>>(){}.getType());
|
||||||
|
|
||||||
Map<String,String> datasourceRelaMap = panelAppTemplateService.applyDatasource(oldDatasourceInfo,request.getDatasourceList());
|
Map<String,String> datasourceRelaMap = panelAppTemplateService.applyDatasource(oldDatasourceInfo,request.getDatasourceList());
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
\u4E2A\u4EBA\u4FE1\u606F=\u4E2A\u4EBA\u4FE1\u606F
|
\u4E2A\u4EBA\u4FE1\u606F=\u4E2A\u4EBA\u4FE1\u606F
|
||||||
\u4EEA\u8868\u677F=\u4EEA\u8868\u677F
|
\u4EEA\u8868\u677F=\u4EEA\u8868\u677F
|
||||||
\u6A21\u677F\u5E02\u573A=\u6A21\u677F\u5E02\u573A
|
\u6A21\u677F\u5E02\u573A=\u6A21\u677F\u5E02\u573A
|
||||||
\u5E94\u7528\u5E02\u573A=\u5E94\u7528\u5E02\u5834
|
\u5E94\u7528\u5E02\u573A=\u5E94\u7528\u5E02\u573A
|
||||||
\u5E94\u7528\u7BA1\u7406=\u5E94\u7528\u7BA1\u7406
|
\u5E94\u7528\u7BA1\u7406=\u5E94\u7528\u7BA1\u7406
|
||||||
\u4FEE\u6539\u5BC6\u7801=\u4FEE\u6539\u5BC6\u7801
|
\u4FEE\u6539\u5BC6\u7801=\u4FEE\u6539\u5BC6\u7801
|
||||||
\u521B\u5EFA\u7528\u6237=\u521B\u5EFA\u7528\u6237
|
\u521B\u5EFA\u7528\u6237=\u521B\u5EFA\u7528\u6237
|
||||||
|
@ -2487,6 +2487,8 @@ export default {
|
|||||||
app_group_icon: 'Cover icon',
|
app_group_icon: 'Cover icon',
|
||||||
app_name: 'Application name',
|
app_name: 'Application name',
|
||||||
search_by_keyword:'Search by keyword',
|
search_by_keyword:'Search by keyword',
|
||||||
apply_logs:'Apply logs'
|
apply_logs:'Apply logs',
|
||||||
|
app_group_delete_tips: 'Are you sure to delete this application category?',
|
||||||
|
app_group_delete_content: 'After deletion, all application templates in this category will also be deleted.'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2487,6 +2487,9 @@ export default {
|
|||||||
no_apps: '暫無應用',
|
no_apps: '暫無應用',
|
||||||
app_group_icon: '封面圖標',
|
app_group_icon: '封面圖標',
|
||||||
app_name: '應用名稱',
|
app_name: '應用名稱',
|
||||||
search_by_keyword:'通過關鍵字搜索'
|
search_by_keyword:'通過關鍵字搜索',
|
||||||
|
apply_logs:'應用記錄',
|
||||||
|
app_group_delete_tips: '確定刪除該應用分類嗎?',
|
||||||
|
app_group_delete_content: '刪除後,該分類中所有的應用模闆也將被刪除。'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2487,6 +2487,9 @@ export default {
|
|||||||
no_apps: '暂无应用',
|
no_apps: '暂无应用',
|
||||||
app_group_icon: '封面图标',
|
app_group_icon: '封面图标',
|
||||||
app_name: '应用名称',
|
app_name: '应用名称',
|
||||||
search_by_keyword:'通过关键字搜索'
|
search_by_keyword:'通过关键字搜索',
|
||||||
|
apply_logs:'应用记录',
|
||||||
|
app_group_delete_tips: '确定删除该应用分类吗?',
|
||||||
|
app_group_delete_content: '删除后,该分类中所有的应用模板也将被删除。'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
<template>
|
<template>
|
||||||
<div :style="classBackground" class="de-card-model">
|
<div :style="classBackground" class="de-card-model">
|
||||||
<div class="card-img-model" :style="classImg">
|
<div class="card-img-model" :style="classImg">
|
||||||
<img :src="model.snapshot" alt="" />
|
<img :src="model.snapshot" alt=""/>
|
||||||
</div>
|
</div>
|
||||||
<div class="card-info">
|
<div class="card-info">
|
||||||
<el-tooltip
|
<el-tooltip
|
||||||
@ -36,7 +36,8 @@ export default {
|
|||||||
props: {
|
props: {
|
||||||
model: {
|
model: {
|
||||||
type: Object,
|
type: Object,
|
||||||
default: () => {},
|
default: () => {
|
||||||
|
},
|
||||||
},
|
},
|
||||||
width: {
|
width: {
|
||||||
type: Number
|
type: Number
|
||||||
@ -51,10 +52,8 @@ export default {
|
|||||||
},
|
},
|
||||||
classImg() {
|
classImg() {
|
||||||
return {
|
return {
|
||||||
width: (this.width-2) + 'px',
|
width: (this.width - 2) + 'px',
|
||||||
height: this.width * 0.576 + 'px',
|
height: this.width * 0.576 + 'px'
|
||||||
// background: `url(${this.model.snapshot}) no-repeat`,
|
|
||||||
// 'background-size': `100% 100%`
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@ -73,6 +72,7 @@ export default {
|
|||||||
border: 1px solid var(--deCardStrokeColor, #dee0e3);
|
border: 1px solid var(--deCardStrokeColor, #dee0e3);
|
||||||
border-radius: 4px;
|
border-radius: 4px;
|
||||||
margin: 0 24px 25px 0;
|
margin: 0 24px 25px 0;
|
||||||
|
|
||||||
.card-img-model {
|
.card-img-model {
|
||||||
border-bottom: 1px solid var(--deCardStrokeColor, #dee0e3);
|
border-bottom: 1px solid var(--deCardStrokeColor, #dee0e3);
|
||||||
height: 144px;
|
height: 144px;
|
||||||
@ -138,6 +138,7 @@ export default {
|
|||||||
|
|
||||||
.de-card-dropdown {
|
.de-card-dropdown {
|
||||||
margin-top: 0 !important;
|
margin-top: 0 !important;
|
||||||
|
|
||||||
.popper__arrow {
|
.popper__arrow {
|
||||||
display: none !important;
|
display: none !important;
|
||||||
}
|
}
|
||||||
|
@ -129,8 +129,8 @@ export default {
|
|||||||
},
|
},
|
||||||
templateDelete(template) {
|
templateDelete(template) {
|
||||||
const options = {
|
const options = {
|
||||||
title: "确定删除该应用分类吗?",
|
title: this.$('app_template.app_group_delete_tips'),
|
||||||
content: "删除后,该分类中所有的应用模版也将被删除。",
|
content: this.$('app_template.app_group_delete_content'),
|
||||||
type: "primary",
|
type: "primary",
|
||||||
cb: () => this.$emit("templateDelete", template.id),
|
cb: () => this.$emit("templateDelete", template.id),
|
||||||
};
|
};
|
||||||
|
@ -442,10 +442,6 @@ export default {
|
|||||||
z-index: 2;
|
z-index: 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
//.open-button:hover{
|
|
||||||
// transition: 0.5s;
|
|
||||||
// width: 50px;
|
|
||||||
//}
|
|
||||||
.open-button:hover{
|
.open-button:hover{
|
||||||
color: #3a8ee6;
|
color: #3a8ee6;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user