Merge remote-tracking branch 'origin/main' into main
This commit is contained in:
commit
dc742d1b36
@ -6,6 +6,7 @@ import io.dataease.auth.entity.TokenInfo;
|
||||
import io.dataease.auth.service.AuthUserService;
|
||||
import io.dataease.auth.util.JWTUtils;
|
||||
import io.dataease.commons.utils.CommonBeanFactory;
|
||||
import io.dataease.commons.utils.ServletUtils;
|
||||
import io.dataease.i18n.Translator;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.shiro.authc.AuthenticationException;
|
||||
@ -111,7 +112,7 @@ public class JWTFilter extends BasicHttpAuthenticationFilter {
|
||||
// JWTUtils.removeTokenExpire(token);
|
||||
String newToken = JWTUtils.sign(tokenInfo, password);
|
||||
// 记录新token操作时间
|
||||
JWTUtils.addTokenExpire(newToken);
|
||||
// JWTUtils.addTokenExpire(newToken);
|
||||
|
||||
JWTToken jwtToken = new JWTToken(newToken);
|
||||
this.getSubject(request, response).login(jwtToken);
|
||||
|
||||
@ -24,7 +24,7 @@ public class JWTUtils {
|
||||
// token过期时间1min (过期会自动刷新续命 目的是避免一直都是同一个token )
|
||||
private static final long EXPIRE_TIME = 1*60*1000;
|
||||
// 登录间隔时间10min 超过这个时间强制重新登录
|
||||
private static long Login_Interval;
|
||||
private static long Login_Interval;
|
||||
|
||||
|
||||
|
||||
@ -84,17 +84,24 @@ public class JWTUtils {
|
||||
*/
|
||||
public static boolean loginExpire(String token){
|
||||
if (Login_Interval==0) {
|
||||
int minute = CommonBeanFactory.getBean(Environment.class).getProperty("dataease.login_timeout", Integer.class, 8*60);
|
||||
String property = CommonBeanFactory.getBean(Environment.class).getProperty("dataease.login_timeout");
|
||||
// 默认超时时间是8h
|
||||
int minute = StringUtils.isNotEmpty(property) ? Integer.parseInt(property): (8*60);
|
||||
// 分钟换算成毫秒
|
||||
Login_Interval = minute * 1000 * 60;
|
||||
}
|
||||
Long now = System.currentTimeMillis();
|
||||
Long lastOperateTime = tokenLastOperateTime(token);
|
||||
if (ObjectUtils.isEmpty(lastOperateTime)) return true;
|
||||
boolean isExpire = false;
|
||||
if (lastOperateTime != null) {
|
||||
isExpire = now - lastOperateTime > Login_Interval;
|
||||
}
|
||||
if (isExpire) {
|
||||
// System.out.println("-----------------------");
|
||||
// System.out.println("-----上次操作时间是["+lastOperateTime+"]-----");
|
||||
// System.out.println("-----当前操作时间是["+now+"]-----");
|
||||
// System.out.println("-----------------------");
|
||||
}
|
||||
return isExpire;
|
||||
}
|
||||
|
||||
@ -109,7 +116,7 @@ public class JWTUtils {
|
||||
}
|
||||
|
||||
/**
|
||||
* 生成签名,1min后过期
|
||||
* 生成签名,5min后过期
|
||||
* @param tokenInfo 用户信息
|
||||
* @param secret 用户的密码
|
||||
* @return 加密的token
|
||||
@ -158,12 +165,10 @@ public class JWTUtils {
|
||||
CacheManager cacheManager = CommonBeanFactory.getBean(CacheManager.class);
|
||||
Cache tokens_expire = cacheManager.getCache("tokens_expire");
|
||||
Long expTime = tokens_expire.get(token, Long.class);
|
||||
// System.out.println("get-------"+token+" :"+expTime);
|
||||
return expTime;
|
||||
}
|
||||
|
||||
public static void removeTokenExpire(String token){
|
||||
// System.out.println("remove----"+token);
|
||||
CacheManager cacheManager = CommonBeanFactory.getBean(CacheManager.class);
|
||||
Cache tokens_expire = cacheManager.getCache("tokens_expire");
|
||||
tokens_expire.evict(token);
|
||||
@ -173,7 +178,6 @@ public class JWTUtils {
|
||||
CacheManager cacheManager = CommonBeanFactory.getBean(CacheManager.class);
|
||||
Cache tokens_expire = cacheManager.getCache("tokens_expire");
|
||||
long now = System.currentTimeMillis();
|
||||
// System.out.println("add-------"+token+" :"+now);
|
||||
tokens_expire.put(token, now);
|
||||
}
|
||||
|
||||
|
||||
@ -21,6 +21,7 @@ import io.dataease.dto.dataset.DataTableInfoDTO;
|
||||
import io.dataease.i18n.Translator;
|
||||
import io.dataease.service.dataset.DataSetGroupService;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.apache.commons.lang3.ObjectUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
@ -118,7 +119,11 @@ public class DatasourceService {
|
||||
dbTableDTO.setEnableCheck(false);
|
||||
List<DatasetGroup> parents = dataSetGroupService.getParents(datasetTable.getSceneId());
|
||||
StringBuilder stringBuilder = new StringBuilder();
|
||||
parents.forEach(ele -> stringBuilder.append(ele.getName()).append("/"));
|
||||
parents.forEach(ele -> {
|
||||
if (ObjectUtils.isNotEmpty(ele)) {
|
||||
stringBuilder.append(ele.getName()).append("/");
|
||||
}
|
||||
});
|
||||
stringBuilder.append(datasetTable.getName());
|
||||
dbTableDTO.setDatasetPath(stringBuilder.toString());
|
||||
break;
|
||||
|
||||
@ -1,8 +1,6 @@
|
||||
package io.dataease.service.dataset;
|
||||
|
||||
import io.dataease.base.domain.DatasetTableTask;
|
||||
import io.dataease.base.domain.DatasetTableTaskExample;
|
||||
import io.dataease.base.domain.DatasetTableTaskLog;
|
||||
import io.dataease.base.domain.*;
|
||||
import io.dataease.base.mapper.DatasetTableTaskMapper;
|
||||
import io.dataease.commons.constants.JobStatus;
|
||||
import io.dataease.commons.constants.ScheduleType;
|
||||
@ -38,7 +36,9 @@ public class DataSetTableTaskService {
|
||||
private DataSetTableService dataSetTableService;
|
||||
@Resource
|
||||
private ExtractDataService extractDataService;
|
||||
|
||||
public DatasetTableTask save(DataSetTaskRequest dataSetTaskRequest) throws Exception {
|
||||
checkName(dataSetTaskRequest);
|
||||
DatasetTableTask datasetTableTask = dataSetTaskRequest.getDatasetTableTask();
|
||||
dataSetTableService.saveIncrementalConfig(dataSetTaskRequest.getDatasetTableIncrementalConfig());
|
||||
|
||||
@ -60,10 +60,10 @@ public class DataSetTableTaskService {
|
||||
datasetTableTask.setId(UUID.randomUUID().toString());
|
||||
datasetTableTask.setCreateTime(System.currentTimeMillis());
|
||||
// SIMPLE 类型,提前占位
|
||||
if(datasetTableTask.getRate().equalsIgnoreCase(ScheduleType.SIMPLE.toString())){
|
||||
if(extractDataService.updateSyncStatus(dataSetTableService.get(datasetTableTask.getTableId()))){
|
||||
if (datasetTableTask.getRate().equalsIgnoreCase(ScheduleType.SIMPLE.toString())) {
|
||||
if (extractDataService.updateSyncStatus(dataSetTableService.get(datasetTableTask.getTableId()))) {
|
||||
throw new Exception(Translator.get("i18n_sync_job_exists"));
|
||||
}else {
|
||||
} else {
|
||||
//write log
|
||||
DatasetTableTaskLog datasetTableTaskLog = new DatasetTableTaskLog();
|
||||
datasetTableTaskLog.setTableId(datasetTableTask.getTableId());
|
||||
@ -119,4 +119,22 @@ public class DataSetTableTaskService {
|
||||
datasetTableTaskExample.setOrderByClause("create_time desc,name asc");
|
||||
return datasetTableTaskMapper.selectByExample(datasetTableTaskExample);
|
||||
}
|
||||
|
||||
private void checkName(DataSetTaskRequest dataSetTaskRequest) {
|
||||
DatasetTableTaskExample datasetTableTaskExample = new DatasetTableTaskExample();
|
||||
DatasetTableTaskExample.Criteria criteria = datasetTableTaskExample.createCriteria();
|
||||
if (StringUtils.isNotEmpty(dataSetTaskRequest.getDatasetTableTask().getId())) {
|
||||
criteria.andIdNotEqualTo(dataSetTaskRequest.getDatasetTableTask().getId());
|
||||
}
|
||||
if (StringUtils.isNotEmpty(dataSetTaskRequest.getDatasetTableTask().getTableId())) {
|
||||
criteria.andTableIdEqualTo(dataSetTaskRequest.getDatasetTableTask().getTableId());
|
||||
}
|
||||
if (StringUtils.isNotEmpty(dataSetTaskRequest.getDatasetTableTask().getName())) {
|
||||
criteria.andNameEqualTo(dataSetTaskRequest.getDatasetTableTask().getName());
|
||||
}
|
||||
List<DatasetTableTask> list = datasetTableTaskMapper.selectByExample(datasetTableTaskExample);
|
||||
if (list.size() > 0) {
|
||||
throw new RuntimeException(Translator.get("i18n_task_name_repeat"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -29,7 +29,7 @@
|
||||
<defaultCache
|
||||
eternal="false"
|
||||
maxElementsInMemory="1000"
|
||||
overflowToDisk="true"
|
||||
overflowToDisk="false"
|
||||
diskPersistent="false"
|
||||
timeToIdleSeconds="0"
|
||||
timeToLiveSeconds="600"
|
||||
@ -38,46 +38,46 @@
|
||||
<cache
|
||||
name="users_info"
|
||||
eternal="false"
|
||||
maxElementsInMemory="1000"
|
||||
maxElementsOnDisk="0"
|
||||
maxElementsInMemory="100"
|
||||
maxElementsOnDisk="1000"
|
||||
overflowToDisk="true"
|
||||
diskPersistent="false"
|
||||
timeToIdleSeconds="28800"
|
||||
timeToLiveSeconds="36000"
|
||||
diskPersistent="true"
|
||||
timeToIdleSeconds="1800"
|
||||
timeToLiveSeconds="3600"
|
||||
memoryStoreEvictionPolicy="LRU"
|
||||
/>
|
||||
<cache
|
||||
name="users_roles_info"
|
||||
eternal="false"
|
||||
maxElementsInMemory="1000"
|
||||
maxElementsOnDisk="0"
|
||||
maxElementsInMemory="100"
|
||||
maxElementsOnDisk="1000"
|
||||
overflowToDisk="true"
|
||||
diskPersistent="false"
|
||||
timeToIdleSeconds="28800"
|
||||
timeToLiveSeconds="36000"
|
||||
diskPersistent="true"
|
||||
timeToIdleSeconds="1800"
|
||||
timeToLiveSeconds="3600"
|
||||
memoryStoreEvictionPolicy="LRU"
|
||||
/>
|
||||
<cache
|
||||
name="users_permissions_info"
|
||||
eternal="false"
|
||||
maxElementsInMemory="1000"
|
||||
maxElementsOnDisk="0"
|
||||
maxElementsInMemory="100"
|
||||
maxElementsOnDisk="1000"
|
||||
overflowToDisk="true"
|
||||
diskPersistent="false"
|
||||
timeToIdleSeconds="28800"
|
||||
timeToLiveSeconds="36000"
|
||||
diskPersistent="true"
|
||||
timeToIdleSeconds="1800"
|
||||
timeToLiveSeconds="3600"
|
||||
memoryStoreEvictionPolicy="LRU"
|
||||
/>
|
||||
|
||||
<cache
|
||||
name="tokens_expire"
|
||||
eternal="false"
|
||||
maxElementsInMemory="1000"
|
||||
maxElementsOnDisk="0"
|
||||
maxElementsInMemory="100"
|
||||
maxElementsOnDisk="1000"
|
||||
overflowToDisk="true"
|
||||
diskPersistent="false"
|
||||
timeToIdleSeconds="28800"
|
||||
timeToLiveSeconds="36000"
|
||||
diskPersistent="true"
|
||||
timeToIdleSeconds="1800"
|
||||
timeToLiveSeconds="3600"
|
||||
memoryStoreEvictionPolicy="LRU"
|
||||
/>
|
||||
|
||||
|
||||
@ -241,8 +241,9 @@ i18n_union_field_exists=The same field can't in two dataset
|
||||
i18n_cron_time_error=Start time can't greater then end time
|
||||
i18n_auth_source_be_canceled=This Auth Resource Already Be Canceled
|
||||
i18n_username_exists=ID is already exists
|
||||
i18n_ds_name_exists=Datasource name exists
|
||||
i18n_ds_name_exists=Datasource name used
|
||||
i18n_sync_job_exists=There is already a synchronization task running, please try again later
|
||||
i18n_datasource_check_fail=Invalid,please check config
|
||||
i18n_not_find_user=Can not find user.
|
||||
i18n_sql_not_empty=SQL can not be empty.
|
||||
i18n_sql_not_empty=SQL can not be empty.
|
||||
i18n_task_name_repeat=Name is used in same data set
|
||||
@ -243,8 +243,9 @@ i18n_union_field_exists=两个数据集之间关联不能出现多次相同字
|
||||
i18n_cron_time_error=开始时间不能大于结束时间
|
||||
i18n_auth_source_be_canceled=当前资源授权权限已经被取消
|
||||
i18n_username_exists=用户 ID 已存在
|
||||
i18n_ds_name_exists=数据源名称已存在
|
||||
i18n_ds_name_exists=数据源名称已被使用
|
||||
i18n_sync_job_exists=已经有同步任务在运行,稍后重试
|
||||
i18n_datasource_check_fail=校验失败,请检查配置信息
|
||||
i18n_not_find_user=未找到用户
|
||||
i18n_sql_not_empty=SQL 不能为空
|
||||
i18n_sql_not_empty=SQL 不能为空
|
||||
i18n_task_name_repeat=同一数据集下任务名称已被使用
|
||||
@ -243,8 +243,9 @@ i18n_union_field_exists=兩個數據集之間關聯不能出現多次相同字
|
||||
i18n_cron_time_error=開始時間不能大於結束時間
|
||||
i18n_auth_source_be_canceled=當前資源授權權限已經被取消
|
||||
i18n_username_exists=用戶ID已存在
|
||||
i18n_ds_name_exists=數據源名稱已存在
|
||||
i18n_ds_name_exists=數據源名稱已被使用
|
||||
i18n_sync_job_exists=已經有同步任務在運行,稍後重試
|
||||
i18n_datasource_check_fail=校驗失敗,請檢查配置信息
|
||||
i18n_not_find_user=未找到用戶
|
||||
i18n_sql_not_empty=SQL 不能為空
|
||||
i18n_sql_not_empty=SQL 不能為空
|
||||
i18n_task_name_repeat=同一數據集下任務名稱已被使用
|
||||
@ -380,7 +380,9 @@ export default {
|
||||
this.calHeight()
|
||||
},
|
||||
created() {
|
||||
this.timer = setInterval(this.listTaskLog, 5000)
|
||||
this.timer = setInterval(() => {
|
||||
this.listTaskLog(false)
|
||||
}, 5000)
|
||||
},
|
||||
beforeDestroy() {
|
||||
clearInterval(this.timer)
|
||||
@ -461,10 +463,10 @@ export default {
|
||||
post('/dataset/table/incrementalConfig', { tableId: this.table.id }).then(response => {
|
||||
this.incrementalConfig = response.data
|
||||
this.incrementalUpdateType = 'incrementalAdd'
|
||||
console.log(this.sql);
|
||||
console.log(this.sql)
|
||||
if (this.incrementalConfig.incrementalAdd) {
|
||||
this.sql = this.incrementalConfig.incrementalAdd
|
||||
}else {
|
||||
} else {
|
||||
this.sql = ''
|
||||
}
|
||||
})
|
||||
@ -543,8 +545,8 @@ export default {
|
||||
this.taskForm.cron = '0 0 * ? * * *'
|
||||
}
|
||||
},
|
||||
listTaskLog() {
|
||||
post('/dataset/taskLog/list/' + this.page.currentPage + '/' + this.page.pageSize, { tableId: this.table.id }).then(response => {
|
||||
listTaskLog(loading = true) {
|
||||
post('/dataset/taskLog/list/' + this.page.currentPage + '/' + this.page.pageSize, { tableId: this.table.id }, loading).then(response => {
|
||||
this.taskLogData = response.data.listObject
|
||||
this.page.total = response.data.itemCount
|
||||
})
|
||||
|
||||
Loading…
Reference in New Issue
Block a user