forked from github/dataease
refactor: 优化代码结构
This commit is contained in:
parent
c3f94d86f4
commit
2d66c2b0b6
@ -168,9 +168,7 @@ public class XssAndSqlHttpServletRequestWrapper extends HttpServletRequestWrappe
|
||||
// NOTE: It's highly recommended to use the ESAPI library and
|
||||
// uncomment the following line to
|
||||
// avoid encoded attacks.
|
||||
// value = ESAPI.encoder().canonicalize(value);
|
||||
// Avoid null characters
|
||||
/** value = value.replaceAll("", ""); ***/
|
||||
// Avoid anything between script tags
|
||||
Pattern scriptPattern = Pattern.compile(
|
||||
"<[\r\n| | ]*script[\r\n| | ]*>(.*?)</[\r\n| | ]*script[\r\n| | ]*>", Pattern.CASE_INSENSITIVE);
|
||||
|
@ -1,5 +1,6 @@
|
||||
package io.dataease.job.sechedule;
|
||||
|
||||
import io.dataease.commons.utils.LogUtil;
|
||||
import org.quartz.JobExecutionContext;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
@ -12,6 +13,6 @@ import java.util.Date;
|
||||
public class TestJob extends DeScheduleJob {
|
||||
@Override
|
||||
void businessExecute(JobExecutionContext context) {
|
||||
System.out.println("Test Job -- " + new SimpleDateFormat("HH:mm:ss").format(new Date()));
|
||||
LogUtil.info("Test Job -- " + new SimpleDateFormat("HH:mm:ss").format(new Date()));
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,6 @@
|
||||
package io.dataease.listener;
|
||||
|
||||
import io.dataease.commons.utils.LogUtil;
|
||||
import io.dataease.plugins.common.base.domain.DatasetTableTask;
|
||||
import io.dataease.commons.constants.ScheduleType;
|
||||
import io.dataease.service.ScheduleService;
|
||||
@ -23,7 +24,7 @@ public class AppStartListener implements ApplicationListener<ApplicationReadyEve
|
||||
|
||||
@Override
|
||||
public void onApplicationEvent(ApplicationReadyEvent applicationReadyEvent) {
|
||||
System.out.println("================= Application start =================");
|
||||
LogUtil.info("================= Application start =================");
|
||||
// 项目启动,从数据库读取任务加入到Quartz
|
||||
List<DatasetTableTask> list = dataSetTableTaskService.list(new DatasetTableTask());
|
||||
for (DatasetTableTask task : list) {
|
||||
|
@ -31,12 +31,10 @@ public class RowPermissionMergeListener implements ApplicationListener<Applicati
|
||||
public void onApplicationEvent(ApplicationReadyEvent applicationReadyEvent) {
|
||||
Map<String, RowPermissionTreeService> beansOfType = SpringContextUtil.getApplicationContext().getBeansOfType((RowPermissionTreeService.class));
|
||||
if (beansOfType.keySet().size() > 0) {
|
||||
System.out.println("====row permissions merge [start]====");
|
||||
logger.info("====row permissions merge [start]====");
|
||||
|
||||
SysStartupJob sysStartupJob = sysStartupJobMapper.selectByPrimaryKey(JOB_ID);
|
||||
if (ObjectUtils.isNotEmpty(sysStartupJob) && StringUtils.equalsIgnoreCase(sysStartupJob.getStatus(), "ready")) {
|
||||
System.out.println("====row permissions merge [doing]====");
|
||||
logger.info("====row permissions merge [doing]====");
|
||||
|
||||
RowPermissionTreeService rowPermissionTreeService = SpringContextUtil.getBean(RowPermissionTreeService.class);
|
||||
@ -44,7 +42,6 @@ public class RowPermissionMergeListener implements ApplicationListener<Applicati
|
||||
sysStartupJob.setStatus("done");
|
||||
sysStartupJobMapper.updateByPrimaryKey(sysStartupJob);
|
||||
}
|
||||
System.out.println("====row permissions merge [end]====");
|
||||
logger.info("====row permissions merge [end]====");
|
||||
}
|
||||
}
|
||||
|
@ -29,7 +29,6 @@ public class SystemInitListener implements ApplicationListener<ApplicationReadyE
|
||||
|
||||
@Override
|
||||
public void onApplicationEvent(ApplicationReadyEvent applicationReadyEvent) {
|
||||
System.out.println("=====initSystem from code [Start]=====");
|
||||
logger.info("=====initSystem from code [Start]=====");
|
||||
Integer dataeseVersion = versionMapper.lastSuccessDataEaseVersion();
|
||||
Integer dataeseCodeVersion = versionMapper.lastDataEaseCodeVersion();
|
||||
@ -51,8 +50,6 @@ public class SystemInitListener implements ApplicationListener<ApplicationReadyE
|
||||
codeVersionMapper.insert(codeVersion);
|
||||
}
|
||||
logger.info("=====initSystem from code [End]=====");
|
||||
System.out.println("=====initSystem from code [End]=====");
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -294,7 +294,6 @@ public class MongoQueryProvider extends QueryProvider {
|
||||
}
|
||||
if (CollectionUtils.isNotEmpty(yFields)) {
|
||||
st_sql.add("aggregators", yFields);
|
||||
// st_sql.add("notUseAs", true);
|
||||
}
|
||||
if (CollectionUtils.isNotEmpty(wheres)) st_sql.add("filters", wheres);
|
||||
if (ObjectUtils.isNotEmpty(tableObj)) st_sql.add("table", tableObj);
|
||||
@ -497,7 +496,6 @@ public class MongoQueryProvider extends QueryProvider {
|
||||
}
|
||||
if (CollectionUtils.isNotEmpty(yFields)) {
|
||||
st_sql.add("aggregators", yFields);
|
||||
// st_sql.add("notUseAs", true);
|
||||
}
|
||||
if (CollectionUtils.isNotEmpty(wheres)) st_sql.add("filters", wheres);
|
||||
if (ObjectUtils.isNotEmpty(tableObj)) st_sql.add("table", tableObj);
|
||||
@ -616,7 +614,6 @@ public class MongoQueryProvider extends QueryProvider {
|
||||
}
|
||||
if (CollectionUtils.isNotEmpty(yFields)) {
|
||||
st_sql.add("aggregators", yFields);
|
||||
// st_sql.add("notUseAs", true);
|
||||
}
|
||||
if (CollectionUtils.isNotEmpty(wheres)) st_sql.add("filters", wheres);
|
||||
if (ObjectUtils.isNotEmpty(tableObj)) st_sql.add("table", tableObj);
|
||||
@ -704,7 +701,6 @@ public class MongoQueryProvider extends QueryProvider {
|
||||
ST st_sql = stg.getInstanceOf("querySql");
|
||||
if (CollectionUtils.isNotEmpty(yFields)) {
|
||||
st_sql.add("aggregators", yFields);
|
||||
// st_sql.add("notUseAs", true);
|
||||
}
|
||||
if (CollectionUtils.isNotEmpty(wheres)) st_sql.add("filters", wheres);
|
||||
if (ObjectUtils.isNotEmpty(tableObj)) st_sql.add("table", tableObj);
|
||||
|
@ -830,14 +830,12 @@ public class ChartViewService {
|
||||
|
||||
//如果不是插件视图 走原生逻辑
|
||||
if (table.getMode() == 0) {// 直连
|
||||
// Datasource ds = datasourceService.get(table.getDataSourceId());
|
||||
if (ObjectUtils.isEmpty(ds)) {
|
||||
throw new RuntimeException(Translator.get("i18n_datasource_delete"));
|
||||
}
|
||||
if (StringUtils.isNotEmpty(ds.getStatus()) && ds.getStatus().equalsIgnoreCase("Error")) {
|
||||
throw new Exception(Translator.get("i18n_invalid_ds"));
|
||||
}
|
||||
// DatasourceProvider datasourceProvider = ProviderFactory.getProvider(ds.getType());
|
||||
datasourceRequest.setDatasource(ds);
|
||||
DataTableInfoDTO dataTableInfoDTO = gson.fromJson(table.getInfo(), DataTableInfoDTO.class);
|
||||
QueryProvider qp = ProviderFactory.getQueryProvider(ds.getType());
|
||||
@ -903,8 +901,6 @@ public class ChartViewService {
|
||||
data = datasourceProvider.getData(datasourceRequest);
|
||||
} else if (table.getMode() == 1) {// 抽取
|
||||
// 连接doris,构建doris数据源查询
|
||||
// Datasource ds = engineService.getDeEngine();
|
||||
// DatasourceProvider datasourceProvider = ProviderFactory.getProvider(ds.getType());
|
||||
datasourceRequest.setDatasource(ds);
|
||||
String tableName = "ds_" + table.getId().replaceAll("-", "_");
|
||||
datasourceRequest.setTable(tableName);
|
||||
@ -1154,7 +1150,6 @@ public class ChartViewService {
|
||||
pluginViewParam.setPluginChartFieldCustomFilters(fieldFilters);
|
||||
pluginViewParam.setPluginChartExtFilters(panelFilters);
|
||||
pluginViewParam.setPluginViewLimit(pluginViewLimit);
|
||||
// pluginViewParam.setUserId(AuthUtils.getUser().getUserId());
|
||||
return pluginViewParam;
|
||||
}
|
||||
|
||||
|
@ -325,27 +325,27 @@ public class ExtractDataService {
|
||||
try {
|
||||
deleteFile("all_scope", datasetTableId);
|
||||
} catch (Exception ignore) {
|
||||
System.out.println(ignore.getMessage());
|
||||
LogUtil.error(ignore);
|
||||
}
|
||||
try {
|
||||
sendWebMsg(datasetTable, datasetTableTask, datasetTableTaskLog, msg);
|
||||
} catch (Exception ignore) {
|
||||
System.out.println(ignore.getMessage());
|
||||
LogUtil.error(ignore);
|
||||
}
|
||||
try {
|
||||
updateTableStatus(datasetTableId, lastExecStatus, execTime);
|
||||
} catch (Exception ignore) {
|
||||
System.out.println(ignore.getMessage());
|
||||
LogUtil.error(ignore);
|
||||
}
|
||||
try {
|
||||
dataSetTableTaskService.updateTaskStatus(datasetTableTask, lastExecStatus);
|
||||
} catch (Exception ignore) {
|
||||
System.out.println(ignore.getMessage());
|
||||
LogUtil.error(ignore);
|
||||
}
|
||||
try {
|
||||
dropDorisTable(TableUtils.tmpName(TableUtils.tableName(datasetTableId)));
|
||||
} catch (Exception ignore) {
|
||||
System.out.println(ignore.getMessage());
|
||||
LogUtil.error(ignore);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
@ -51,7 +51,6 @@ public class PermissionService {
|
||||
lists.forEach(chartCustomFilterDTO -> {
|
||||
chartCustomFilterDTO.setFieldId(field.getId());
|
||||
if(datasetRowPermissions.getAuthTargetType().equalsIgnoreCase("sysParams")){
|
||||
System.out.println(values.get(chartCustomFilterDTO.getValue()).toString());
|
||||
chartCustomFilterDTO.setValue(values.get(chartCustomFilterDTO.getValue()).toString());
|
||||
}
|
||||
});
|
||||
|
@ -78,12 +78,10 @@ public class PluginService {
|
||||
String folder = pluginDir + "folder/";
|
||||
try {
|
||||
ZipUtil.unzip(dest.getAbsolutePath(), folder);
|
||||
// ZipUtils.unzip(dest, folder);
|
||||
} catch (Exception e) {
|
||||
DeFileUtils.deleteFile(pluginDir + "temp/");
|
||||
DeFileUtils.deleteFile(folder);
|
||||
// 需要删除文件
|
||||
// e.printStackTrace();
|
||||
LogUtil.error(e.getMessage(), e);
|
||||
DEException.throwException(e);
|
||||
}
|
||||
@ -261,7 +259,6 @@ public class PluginService {
|
||||
} catch (InvocationTargetException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
//BeanUtils.copyBean(result, myPlugin);
|
||||
if(result.getCategory().equalsIgnoreCase("datasource") && (StringUtils.isEmpty(result.getStore()) || !result.getStore().equalsIgnoreCase("default"))){
|
||||
result.setStore("thirdpart");
|
||||
}
|
||||
|
@ -140,7 +140,6 @@ public class SysUserService {
|
||||
sysUser.setLanguage("zh_CN");
|
||||
sysUser.setFrom(3);
|
||||
sysUser.setIsAdmin(false);
|
||||
// sysUser.setSub(ssoUserInfo.getSub());
|
||||
sysUserMapper.insert(sysUser);
|
||||
SysUser dbUser = findOne(sysUser);
|
||||
if (null != dbUser && null != dbUser.getUserId()) {
|
||||
|
@ -238,7 +238,6 @@ public class LogService {
|
||||
}
|
||||
|
||||
public void saveLog(SysLogDTO sysLogDTO) {
|
||||
// String ip = "";
|
||||
CurrentUserDto user = AuthUtils.getUser();
|
||||
SysLogWithBLOBs sysLogWithBLOBs = BeanUtils.copyBean(new SysLogWithBLOBs(), sysLogDTO);
|
||||
if (CollectionUtils.isNotEmpty(sysLogDTO.getPositions())) {
|
||||
@ -258,7 +257,6 @@ public class LogService {
|
||||
sysLogWithBLOBs.setNickName(sysLogDTO.getSourceName());
|
||||
}
|
||||
|
||||
// sysLogWithBLOBs.setIp(ip);
|
||||
sysLogMapper.insert(sysLogWithBLOBs);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user