Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
D
dataease
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
zhu
dataease
Commits
e522d393
提交
e522d393
authored
5月 26, 2021
作者:
taojinlong
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix: 限制数据集只有一个同步任务
上级
d65194ef
隐藏空白字符变更
内嵌
并排
正在显示
7 个修改的文件
包含
126 行增加
和
10 行删除
+126
-10
DatasetTable.java
...d/src/main/java/io/dataease/base/domain/DatasetTable.java
+2
-0
DatasetTableExample.java
...ain/java/io/dataease/base/domain/DatasetTableExample.java
+70
-0
DatasetTableMapper.xml
.../main/java/io/dataease/base/mapper/DatasetTableMapper.xml
+25
-7
DataSourceInitStartListener.java
...ava/io/dataease/listener/DataSourceInitStartListener.java
+4
-0
DataSetTableService.java
...java/io/dataease/service/dataset/DataSetTableService.java
+8
-0
ExtractDataService.java
.../java/io/dataease/service/dataset/ExtractDataService.java
+16
-2
generatorConfig.xml
backend/src/main/resources/generatorConfig.xml
+1
-1
没有找到文件。
backend/src/main/java/io/dataease/base/domain/DatasetTable.java
浏览文件 @
e522d393
...
@@ -21,6 +21,8 @@ public class DatasetTable implements Serializable {
...
@@ -21,6 +21,8 @@ public class DatasetTable implements Serializable {
private
Long
createTime
;
private
Long
createTime
;
private
String
syncStatus
;
private
String
info
;
private
String
info
;
private
static
final
long
serialVersionUID
=
1L
;
private
static
final
long
serialVersionUID
=
1L
;
...
...
backend/src/main/java/io/dataease/base/domain/DatasetTableExample.java
浏览文件 @
e522d393
...
@@ -643,6 +643,76 @@ public class DatasetTableExample {
...
@@ -643,6 +643,76 @@ public class DatasetTableExample {
addCriterion
(
"create_time not between"
,
value1
,
value2
,
"createTime"
);
addCriterion
(
"create_time not between"
,
value1
,
value2
,
"createTime"
);
return
(
Criteria
)
this
;
return
(
Criteria
)
this
;
}
}
public
Criteria
andSyncStatusIsNull
()
{
addCriterion
(
"sync_status is null"
);
return
(
Criteria
)
this
;
}
public
Criteria
andSyncStatusIsNotNull
()
{
addCriterion
(
"sync_status is not null"
);
return
(
Criteria
)
this
;
}
public
Criteria
andSyncStatusEqualTo
(
String
value
)
{
addCriterion
(
"sync_status ="
,
value
,
"syncStatus"
);
return
(
Criteria
)
this
;
}
public
Criteria
andSyncStatusNotEqualTo
(
String
value
)
{
addCriterion
(
"sync_status <>"
,
value
,
"syncStatus"
);
return
(
Criteria
)
this
;
}
public
Criteria
andSyncStatusGreaterThan
(
String
value
)
{
addCriterion
(
"sync_status >"
,
value
,
"syncStatus"
);
return
(
Criteria
)
this
;
}
public
Criteria
andSyncStatusGreaterThanOrEqualTo
(
String
value
)
{
addCriterion
(
"sync_status >="
,
value
,
"syncStatus"
);
return
(
Criteria
)
this
;
}
public
Criteria
andSyncStatusLessThan
(
String
value
)
{
addCriterion
(
"sync_status <"
,
value
,
"syncStatus"
);
return
(
Criteria
)
this
;
}
public
Criteria
andSyncStatusLessThanOrEqualTo
(
String
value
)
{
addCriterion
(
"sync_status <="
,
value
,
"syncStatus"
);
return
(
Criteria
)
this
;
}
public
Criteria
andSyncStatusLike
(
String
value
)
{
addCriterion
(
"sync_status like"
,
value
,
"syncStatus"
);
return
(
Criteria
)
this
;
}
public
Criteria
andSyncStatusNotLike
(
String
value
)
{
addCriterion
(
"sync_status not like"
,
value
,
"syncStatus"
);
return
(
Criteria
)
this
;
}
public
Criteria
andSyncStatusIn
(
List
<
String
>
values
)
{
addCriterion
(
"sync_status in"
,
values
,
"syncStatus"
);
return
(
Criteria
)
this
;
}
public
Criteria
andSyncStatusNotIn
(
List
<
String
>
values
)
{
addCriterion
(
"sync_status not in"
,
values
,
"syncStatus"
);
return
(
Criteria
)
this
;
}
public
Criteria
andSyncStatusBetween
(
String
value1
,
String
value2
)
{
addCriterion
(
"sync_status between"
,
value1
,
value2
,
"syncStatus"
);
return
(
Criteria
)
this
;
}
public
Criteria
andSyncStatusNotBetween
(
String
value1
,
String
value2
)
{
addCriterion
(
"sync_status not between"
,
value1
,
value2
,
"syncStatus"
);
return
(
Criteria
)
this
;
}
}
}
public
static
class
Criteria
extends
GeneratedCriteria
{
public
static
class
Criteria
extends
GeneratedCriteria
{
...
...
backend/src/main/java/io/dataease/base/mapper/DatasetTableMapper.xml
浏览文件 @
e522d393
...
@@ -10,6 +10,7 @@
...
@@ -10,6 +10,7 @@
<result
column=
"mode"
jdbcType=
"INTEGER"
property=
"mode"
/>
<result
column=
"mode"
jdbcType=
"INTEGER"
property=
"mode"
/>
<result
column=
"create_by"
jdbcType=
"VARCHAR"
property=
"createBy"
/>
<result
column=
"create_by"
jdbcType=
"VARCHAR"
property=
"createBy"
/>
<result
column=
"create_time"
jdbcType=
"BIGINT"
property=
"createTime"
/>
<result
column=
"create_time"
jdbcType=
"BIGINT"
property=
"createTime"
/>
<result
column=
"sync_status"
jdbcType=
"VARCHAR"
property=
"syncStatus"
/>
</resultMap>
</resultMap>
<resultMap
extends=
"BaseResultMap"
id=
"ResultMapWithBLOBs"
type=
"io.dataease.base.domain.DatasetTable"
>
<resultMap
extends=
"BaseResultMap"
id=
"ResultMapWithBLOBs"
type=
"io.dataease.base.domain.DatasetTable"
>
<result
column=
"info"
jdbcType=
"LONGVARCHAR"
property=
"info"
/>
<result
column=
"info"
jdbcType=
"LONGVARCHAR"
property=
"info"
/>
...
@@ -73,7 +74,7 @@
...
@@ -73,7 +74,7 @@
</where>
</where>
</sql>
</sql>
<sql
id=
"Base_Column_List"
>
<sql
id=
"Base_Column_List"
>
id, `name`, scene_id, data_source_id, `type`, `mode`, create_by, create_time
id, `name`, scene_id, data_source_id, `type`, `mode`, create_by, create_time
, sync_status
</sql>
</sql>
<sql
id=
"Blob_Column_List"
>
<sql
id=
"Blob_Column_List"
>
info
info
...
@@ -129,12 +130,12 @@
...
@@ -129,12 +130,12 @@
<insert
id=
"insert"
parameterType=
"io.dataease.base.domain.DatasetTable"
>
<insert
id=
"insert"
parameterType=
"io.dataease.base.domain.DatasetTable"
>
insert into dataset_table (id, `name`, scene_id,
insert into dataset_table (id, `name`, scene_id,
data_source_id, `type`, `mode`,
data_source_id, `type`, `mode`,
create_by, create_time,
info
create_by, create_time,
sync_status,
)
info
)
values (#{id,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR}, #{sceneId,jdbcType=VARCHAR},
values (#{id,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR}, #{sceneId,jdbcType=VARCHAR},
#{dataSourceId,jdbcType=VARCHAR}, #{type,jdbcType=VARCHAR}, #{mode,jdbcType=INTEGER},
#{dataSourceId,jdbcType=VARCHAR}, #{type,jdbcType=VARCHAR}, #{mode,jdbcType=INTEGER},
#{createBy,jdbcType=VARCHAR}, #{createTime,jdbcType=BIGINT}, #{
info,jdbcType=LONGVARCHAR}
#{createBy,jdbcType=VARCHAR}, #{createTime,jdbcType=BIGINT}, #{
syncStatus,jdbcType=VARCHAR},
)
#{info,jdbcType=LONGVARCHAR}
)
</insert>
</insert>
<insert
id=
"insertSelective"
parameterType=
"io.dataease.base.domain.DatasetTable"
>
<insert
id=
"insertSelective"
parameterType=
"io.dataease.base.domain.DatasetTable"
>
insert into dataset_table
insert into dataset_table
...
@@ -163,6 +164,9 @@
...
@@ -163,6 +164,9 @@
<if
test=
"createTime != null"
>
<if
test=
"createTime != null"
>
create_time,
create_time,
</if>
</if>
<if
test=
"syncStatus != null"
>
sync_status,
</if>
<if
test=
"info != null"
>
<if
test=
"info != null"
>
info,
info,
</if>
</if>
...
@@ -192,6 +196,9 @@
...
@@ -192,6 +196,9 @@
<if
test=
"createTime != null"
>
<if
test=
"createTime != null"
>
#{createTime,jdbcType=BIGINT},
#{createTime,jdbcType=BIGINT},
</if>
</if>
<if
test=
"syncStatus != null"
>
#{syncStatus,jdbcType=VARCHAR},
</if>
<if
test=
"info != null"
>
<if
test=
"info != null"
>
#{info,jdbcType=LONGVARCHAR},
#{info,jdbcType=LONGVARCHAR},
</if>
</if>
...
@@ -230,6 +237,9 @@
...
@@ -230,6 +237,9 @@
<if
test=
"record.createTime != null"
>
<if
test=
"record.createTime != null"
>
create_time = #{record.createTime,jdbcType=BIGINT},
create_time = #{record.createTime,jdbcType=BIGINT},
</if>
</if>
<if
test=
"record.syncStatus != null"
>
sync_status = #{record.syncStatus,jdbcType=VARCHAR},
</if>
<if
test=
"record.info != null"
>
<if
test=
"record.info != null"
>
info = #{record.info,jdbcType=LONGVARCHAR},
info = #{record.info,jdbcType=LONGVARCHAR},
</if>
</if>
...
@@ -248,6 +258,7 @@
...
@@ -248,6 +258,7 @@
`mode` = #{record.mode,jdbcType=INTEGER},
`mode` = #{record.mode,jdbcType=INTEGER},
create_by = #{record.createBy,jdbcType=VARCHAR},
create_by = #{record.createBy,jdbcType=VARCHAR},
create_time = #{record.createTime,jdbcType=BIGINT},
create_time = #{record.createTime,jdbcType=BIGINT},
sync_status = #{record.syncStatus,jdbcType=VARCHAR},
info = #{record.info,jdbcType=LONGVARCHAR}
info = #{record.info,jdbcType=LONGVARCHAR}
<if
test=
"_parameter != null"
>
<if
test=
"_parameter != null"
>
<include
refid=
"Update_By_Example_Where_Clause"
/>
<include
refid=
"Update_By_Example_Where_Clause"
/>
...
@@ -262,7 +273,8 @@
...
@@ -262,7 +273,8 @@
`type` = #{record.type,jdbcType=VARCHAR},
`type` = #{record.type,jdbcType=VARCHAR},
`mode` = #{record.mode,jdbcType=INTEGER},
`mode` = #{record.mode,jdbcType=INTEGER},
create_by = #{record.createBy,jdbcType=VARCHAR},
create_by = #{record.createBy,jdbcType=VARCHAR},
create_time = #{record.createTime,jdbcType=BIGINT}
create_time = #{record.createTime,jdbcType=BIGINT},
sync_status = #{record.syncStatus,jdbcType=VARCHAR}
<if
test=
"_parameter != null"
>
<if
test=
"_parameter != null"
>
<include
refid=
"Update_By_Example_Where_Clause"
/>
<include
refid=
"Update_By_Example_Where_Clause"
/>
</if>
</if>
...
@@ -291,6 +303,9 @@
...
@@ -291,6 +303,9 @@
<if
test=
"createTime != null"
>
<if
test=
"createTime != null"
>
create_time = #{createTime,jdbcType=BIGINT},
create_time = #{createTime,jdbcType=BIGINT},
</if>
</if>
<if
test=
"syncStatus != null"
>
sync_status = #{syncStatus,jdbcType=VARCHAR},
</if>
<if
test=
"info != null"
>
<if
test=
"info != null"
>
info = #{info,jdbcType=LONGVARCHAR},
info = #{info,jdbcType=LONGVARCHAR},
</if>
</if>
...
@@ -306,6 +321,7 @@
...
@@ -306,6 +321,7 @@
`mode` = #{mode,jdbcType=INTEGER},
`mode` = #{mode,jdbcType=INTEGER},
create_by = #{createBy,jdbcType=VARCHAR},
create_by = #{createBy,jdbcType=VARCHAR},
create_time = #{createTime,jdbcType=BIGINT},
create_time = #{createTime,jdbcType=BIGINT},
sync_status = #{syncStatus,jdbcType=VARCHAR},
info = #{info,jdbcType=LONGVARCHAR}
info = #{info,jdbcType=LONGVARCHAR}
where id = #{id,jdbcType=VARCHAR}
where id = #{id,jdbcType=VARCHAR}
</update>
</update>
...
@@ -317,7 +333,8 @@
...
@@ -317,7 +333,8 @@
`type` = #{type,jdbcType=VARCHAR},
`type` = #{type,jdbcType=VARCHAR},
`mode` = #{mode,jdbcType=INTEGER},
`mode` = #{mode,jdbcType=INTEGER},
create_by = #{createBy,jdbcType=VARCHAR},
create_by = #{createBy,jdbcType=VARCHAR},
create_time = #{createTime,jdbcType=BIGINT}
create_time = #{createTime,jdbcType=BIGINT},
sync_status = #{syncStatus,jdbcType=VARCHAR}
where id = #{id,jdbcType=VARCHAR}
where id = #{id,jdbcType=VARCHAR}
</update>
</update>
</mapper>
</mapper>
\ No newline at end of file
backend/src/main/java/io/dataease/listener/DataSourceInitStartListener.java
浏览文件 @
e522d393
...
@@ -3,6 +3,7 @@ package io.dataease.listener;
...
@@ -3,6 +3,7 @@ package io.dataease.listener;
import
io.dataease.base.domain.DatasetTableTask
;
import
io.dataease.base.domain.DatasetTableTask
;
import
io.dataease.datasource.service.DatasourceService
;
import
io.dataease.datasource.service.DatasourceService
;
import
io.dataease.service.ScheduleService
;
import
io.dataease.service.ScheduleService
;
import
io.dataease.service.dataset.DataSetTableService
;
import
io.dataease.service.dataset.DataSetTableTaskService
;
import
io.dataease.service.dataset.DataSetTableTaskService
;
import
org.springframework.boot.context.event.ApplicationReadyEvent
;
import
org.springframework.boot.context.event.ApplicationReadyEvent
;
import
org.springframework.context.ApplicationListener
;
import
org.springframework.context.ApplicationListener
;
...
@@ -17,9 +18,12 @@ import java.util.List;
...
@@ -17,9 +18,12 @@ import java.util.List;
public
class
DataSourceInitStartListener
implements
ApplicationListener
<
ApplicationReadyEvent
>
{
public
class
DataSourceInitStartListener
implements
ApplicationListener
<
ApplicationReadyEvent
>
{
@Resource
@Resource
private
DatasourceService
datasourceService
;
private
DatasourceService
datasourceService
;
@Resource
private
DataSetTableService
dataSetTableService
;
@Override
@Override
public
void
onApplicationEvent
(
ApplicationReadyEvent
applicationReadyEvent
)
{
public
void
onApplicationEvent
(
ApplicationReadyEvent
applicationReadyEvent
)
{
datasourceService
.
initAllDataSourceConnectionPool
();
datasourceService
.
initAllDataSourceConnectionPool
();
dataSetTableService
.
updateDatasetTableStatus
();
}
}
}
}
backend/src/main/java/io/dataease/service/dataset/DataSetTableService.java
浏览文件 @
e522d393
...
@@ -876,4 +876,12 @@ public class DataSetTableService {
...
@@ -876,4 +876,12 @@ public class DataSetTableService {
List
<
String
[]>
data
=
jdbcProvider
.
getData
(
datasourceRequest
);
List
<
String
[]>
data
=
jdbcProvider
.
getData
(
datasourceRequest
);
return
CollectionUtils
.
isNotEmpty
(
data
);
return
CollectionUtils
.
isNotEmpty
(
data
);
}
}
public
void
updateDatasetTableStatus
(){
DatasetTable
record
=
new
DatasetTable
();
record
.
setSyncStatus
(
JobStatus
.
Completed
.
name
());
DatasetTableExample
example
=
new
DatasetTableExample
();
example
.
createCriteria
().
andSyncStatusEqualTo
(
JobStatus
.
Underway
.
name
());
datasetTableMapper
.
updateByExampleSelective
(
record
,
example
);
}
}
}
backend/src/main/java/io/dataease/service/dataset/ExtractDataService.java
浏览文件 @
e522d393
...
@@ -2,6 +2,7 @@ package io.dataease.service.dataset;
...
@@ -2,6 +2,7 @@ package io.dataease.service.dataset;
import
com.google.gson.Gson
;
import
com.google.gson.Gson
;
import
io.dataease.base.domain.*
;
import
io.dataease.base.domain.*
;
import
io.dataease.base.mapper.DatasetTableMapper
;
import
io.dataease.base.mapper.DatasourceMapper
;
import
io.dataease.base.mapper.DatasourceMapper
;
import
io.dataease.commons.constants.JobStatus
;
import
io.dataease.commons.constants.JobStatus
;
import
io.dataease.commons.constants.ScheduleType
;
import
io.dataease.commons.constants.ScheduleType
;
...
@@ -93,6 +94,8 @@ public class ExtractDataService {
...
@@ -93,6 +94,8 @@ public class ExtractDataService {
private
DataSetTableTaskService
dataSetTableTaskService
;
private
DataSetTableTaskService
dataSetTableTaskService
;
@Resource
@Resource
private
DatasourceMapper
datasourceMapper
;
private
DatasourceMapper
datasourceMapper
;
@Resource
private
DatasetTableMapper
datasetTableMapper
;
private
static
String
lastUpdateTime
=
"${__last_update_time__}"
;
private
static
String
lastUpdateTime
=
"${__last_update_time__}"
;
private
static
String
currentUpdateTime
=
"${__current_update_time__}"
;
private
static
String
currentUpdateTime
=
"${__current_update_time__}"
;
...
@@ -172,12 +175,17 @@ public class ExtractDataService {
...
@@ -172,12 +175,17 @@ public class ExtractDataService {
}
}
public
void
extractData
(
String
datasetTableId
,
String
taskId
,
String
type
)
{
public
void
extractData
(
String
datasetTableId
,
String
taskId
,
String
type
)
{
DatasetTable
datasetTable
=
dataSetTableService
.
get
(
datasetTableId
);
datasetTable
.
setSyncStatus
(
JobStatus
.
Underway
.
name
());
DatasetTableExample
example
=
new
DatasetTableExample
();
example
.
createCriteria
().
andIdEqualTo
(
datasetTableId
);
if
(
datasetTableMapper
.
updateByExampleSelective
(
datasetTable
,
example
)
==
0
)
{
return
;
}
DatasetTableTaskLog
datasetTableTaskLog
=
new
DatasetTableTaskLog
();
DatasetTableTaskLog
datasetTableTaskLog
=
new
DatasetTableTaskLog
();
UpdateType
updateType
=
UpdateType
.
valueOf
(
type
);
UpdateType
updateType
=
UpdateType
.
valueOf
(
type
);
DatasetTable
datasetTable
=
null
;
Datasource
datasource
=
new
Datasource
();
Datasource
datasource
=
new
Datasource
();
try
{
try
{
datasetTable
=
dataSetTableService
.
get
(
datasetTableId
);
if
(
StringUtils
.
isNotEmpty
(
datasetTable
.
getDataSourceId
()))
{
if
(
StringUtils
.
isNotEmpty
(
datasetTable
.
getDataSourceId
()))
{
datasource
=
datasourceMapper
.
selectByPrimaryKey
(
datasetTable
.
getDataSourceId
());
datasource
=
datasourceMapper
.
selectByPrimaryKey
(
datasetTable
.
getDataSourceId
());
}
else
{
}
else
{
...
@@ -261,6 +269,10 @@ public class ExtractDataService {
...
@@ -261,6 +269,10 @@ public class ExtractDataService {
datasetTableTask
.
setRate
(
ScheduleType
.
SIMPLE_COMPLETE
.
toString
());
datasetTableTask
.
setRate
(
ScheduleType
.
SIMPLE_COMPLETE
.
toString
());
dataSetTableTaskService
.
update
(
datasetTableTask
);
dataSetTableTaskService
.
update
(
datasetTableTask
);
}
}
datasetTable
.
setSyncStatus
(
JobStatus
.
Completed
.
name
());
example
.
clear
();
example
.
createCriteria
().
andIdEqualTo
(
datasetTableId
);
datasetTableMapper
.
updateByExampleSelective
(
datasetTable
,
example
);
}
}
}
}
...
@@ -273,6 +285,8 @@ public class ExtractDataService {
...
@@ -273,6 +285,8 @@ public class ExtractDataService {
}
}
private
void
extractData
(
DatasetTable
datasetTable
,
String
extractType
)
throws
Exception
{
private
void
extractData
(
DatasetTable
datasetTable
,
String
extractType
)
throws
Exception
{
KettleFileRepository
repository
=
CommonBeanFactory
.
getBean
(
KettleFileRepository
.
class
);
KettleFileRepository
repository
=
CommonBeanFactory
.
getBean
(
KettleFileRepository
.
class
);
RepositoryDirectoryInterface
repositoryDirectoryInterface
=
repository
.
loadRepositoryDirectoryTree
();
RepositoryDirectoryInterface
repositoryDirectoryInterface
=
repository
.
loadRepositoryDirectoryTree
();
JobMeta
jobMeta
=
null
;
JobMeta
jobMeta
=
null
;
...
...
backend/src/main/resources/generatorConfig.xml
浏览文件 @
e522d393
...
@@ -74,7 +74,7 @@
...
@@ -74,7 +74,7 @@
<!-- </table>-->
<!-- </table>-->
<!-- <table tableName="v_dataset"/>-->
<!-- <table tableName="v_dataset"/>-->
<!-- <table tableName="sys_auth_detail"/>-->
<!-- <table tableName="sys_auth_detail"/>-->
<table
tableName=
"
panel_group
"
/>
<table
tableName=
"
dataset_table
"
/>
</context>
</context>
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论