Merge remote-tracking branch 'origin/main' into main

This commit is contained in:
wangjiahao
2021-05-18 18:39:32 +08:00
26 changed files with 146 additions and 77 deletions

View File

@@ -10,7 +10,7 @@
<select id="search" resultMap="BaseResultMapDTO">
select
id, `name`, scene_id, data_source_id, `type`, `mode`, create_by, create_time,
id, `name`, scene_id, data_source_id, `type`, `mode`,`info`, create_by, create_time,
get_auths(id,'dataset',#{userId}) as `privileges`
from dataset_table
<where>

View File

@@ -21,7 +21,7 @@ public class DefaultLicenseService {
private static final String LICENSE_ID = "fit2cloud_license";
private static final String validatorUtil = "/usr/bin/validator";
private static final String product = "dataease";
private static final String product = "DataEase";
/*private static final String[] NO_PLU_LIMIT_MODULES = new String[]{"dashboard", "gateway"};*/
public F2CLicenseResponse validateLicense(String product, String licenseKey){

View File

@@ -31,6 +31,6 @@ public interface StoreApi {
@ApiOperation("移除收藏")
@PostMapping("/remove/{storeId}")
void remove(@PathVariable("storeId") Long storeId);
void remove(@PathVariable("storeId") String storeId);
}

View File

@@ -16,7 +16,7 @@ public class StoreServer implements StoreApi {
private StoreService storeService;
@Override
public void store( String id) {
public void store(String id) {
storeService.save(id);
}
@@ -26,7 +26,12 @@ public class StoreServer implements StoreApi {
}
@Override
public void remove( Long storeId) {
storeService.remove(storeId);
public void remove(String storeId) {
try {
Long id = Long.parseLong(storeId);
storeService.remove(id);
} catch (Exception e) {
storeService.removeByPanelId(storeId);
}
}
}

View File

@@ -382,9 +382,10 @@ public class JdbcProvider extends DatasourceProvider {
case doris:
return "show tables;";
case sqlServer:
return "SELECT TABLE_NAME FROM fit2cloud2.INFORMATION_SCHEMA.TABLES WHERE TABLE_TYPE = 'BASE TABLE';";
SqlServerConfigration sqlServerConfigration = new Gson().fromJson(datasourceRequest.getDatasource().getConfiguration(), SqlServerConfigration.class);
return "SELECT TABLE_NAME FROM DATABASE.INFORMATION_SCHEMA.TABLES WHERE TABLE_TYPE = 'BASE TABLE';".replace("DATABASE", sqlServerConfigration.getDataBase());
default:
return "show tables;";
}
}
}
}

View File

@@ -15,8 +15,8 @@ import java.util.Optional;
@Service
public class AboutService {
private static final String BUILD_VERSION = "/opt/fit2cloud/conf/version";
private static final String product = "dataease";
private static final String BUILD_VERSION = "/opt/dataease/conf/version";
private static final String product = "DataEase";
@Resource
private DefaultLicenseService defaultLicenseService;

View File

@@ -661,12 +661,15 @@ public class DataSetTableService {
for (int j = 0; j < row.getPhysicalNumberOfCells(); j++) {
if (i == 0) {
TableFiled tableFiled = new TableFiled();
tableFiled.setFieldName(readCell(row.getCell(j)));
tableFiled.setRemarks(readCell(row.getCell(j)));
tableFiled.setFieldType("TEXT");
if(StringUtils.isEmpty(tableFiled.getFieldName())){
continue;
tableFiled.setFieldSize(1024);
String columnName = readCell(row.getCell(j));
if(StringUtils.isEmpty(columnName)){
columnName = "NONE_" + String.valueOf(j);
}
tableFiled.setFieldName(columnName);
tableFiled.setRemarks(columnName);
fields.add(tableFiled);
} else {
r[j] = readCell(row.getCell(j));
@@ -694,10 +697,14 @@ public class DataSetTableService {
for (int j = 0; j < row.getPhysicalNumberOfCells(); j++) {
if (i == 0) {
TableFiled tableFiled = new TableFiled();
tableFiled.setFieldName(readCell(row.getCell(j)));
tableFiled.setRemarks(readCell(row.getCell(j)));
tableFiled.setFieldType("TEXT");
tableFiled.setFieldSize(1024);
String columnName = readCell(row.getCell(j));
if(StringUtils.isEmpty(columnName)){
columnName = "NONE_" + String.valueOf(j);
}
tableFiled.setFieldName(columnName);
tableFiled.setRemarks(columnName);
fields.add(tableFiled);
} else {
r[j] = readCell(row.getCell(j));

View File

@@ -497,8 +497,14 @@ public class ExtractDataService {
}
private StepMeta excelInputStep(String filePath, List<DatasetTableField> datasetTableFields) {
String suffix = filePath.substring(filePath.lastIndexOf(".") + 1);
ExcelInputMeta excelInputMeta = new ExcelInputMeta();
excelInputMeta.setSpreadSheetType(SpreadSheetType.SAX_POI);
if (StringUtils.equalsIgnoreCase(suffix, "xlsx")) {
excelInputMeta.setSpreadSheetType(SpreadSheetType.SAX_POI);
}
if (StringUtils.equalsIgnoreCase(suffix, "xls")) {
excelInputMeta.setSpreadSheetType(SpreadSheetType.JXL);
}
excelInputMeta.setPassword("Encrypted");
excelInputMeta.setFileName(new String[]{filePath});
excelInputMeta.setStartsWithHeader(true);

View File

@@ -1,6 +1,7 @@
package io.dataease.service.panel;
import io.dataease.base.domain.PanelStore;
import io.dataease.base.domain.PanelStoreExample;
import io.dataease.base.mapper.PanelStoreMapper;
import io.dataease.base.mapper.ext.ExtPanelStoreMapper;
import io.dataease.base.mapper.ext.query.GridExample;
@@ -9,6 +10,7 @@ import io.dataease.controller.sys.base.BaseGridRequest;
import io.dataease.controller.sys.base.ConditionEntity;
import io.dataease.dto.panel.PanelStoreDto;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;
@@ -22,7 +24,7 @@ public class StoreService {
@Resource
private ExtPanelStoreMapper extPanelStoreMapper;
public void save(String panelGroupId){
public void save(String panelGroupId) {
Long userId = AuthUtils.getUser().getUserId();
PanelStore panelStore = new PanelStore();
panelStore.setCreateTime(System.currentTimeMillis());
@@ -31,24 +33,31 @@ public class StoreService {
panelStoreMapper.insert(panelStore);
}
public void removeByPanelId(String panelId) {
PanelStoreExample panelStoreExample = new PanelStoreExample();
panelStoreExample.createCriteria().andPanelGroupIdEqualTo(panelId);
panelStoreMapper.deleteByExample(panelStoreExample);
}
public void remove(Long storeId){
public void remove(Long storeId) {
panelStoreMapper.deleteByPrimaryKey(storeId);
}
/**
* 按照当前用户ID查询收藏仪表板
*
* @param request
* @return
*/
public List<PanelStoreDto> query(BaseGridRequest request){
public List<PanelStoreDto> query(BaseGridRequest request) {
Long userId = AuthUtils.getUser().getUserId();
ConditionEntity condition = new ConditionEntity();
condition.setField("s.user_id");
condition.setOperator("eq");
condition.setValue(userId);
request.setConditions(new ArrayList<ConditionEntity>(){{add(condition);}});
request.setConditions(new ArrayList<ConditionEntity>() {{
add(condition);
}});
GridExample example = request.convertExample();
List<PanelStoreDto> stores = extPanelStoreMapper.query(example);
return stores;