Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
D
dataease
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
zhu
dataease
Commits
f7baa9a0
提交
f7baa9a0
authored
8月 19, 2021
作者:
taojinlong
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix: 尝试解决导入excle 报找不到字段的问题
上级
4681c10b
隐藏空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
41 行增加
和
14 行删除
+41
-14
ExtractDataService.java
.../java/io/dataease/service/dataset/ExtractDataService.java
+41
-14
没有找到文件。
backend/src/main/java/io/dataease/service/dataset/ExtractDataService.java
浏览文件 @
f7baa9a0
...
...
@@ -44,6 +44,8 @@ import org.pentaho.di.job.entries.trans.JobEntryTrans;
import
org.pentaho.di.job.entry.JobEntryCopy
;
import
org.pentaho.di.repository.RepositoryDirectoryInterface
;
import
org.pentaho.di.repository.filerep.KettleFileRepository
;
import
org.pentaho.di.trans.Trans
;
import
org.pentaho.di.trans.TransExecutionConfiguration
;
import
org.pentaho.di.trans.TransHopMeta
;
import
org.pentaho.di.trans.TransMeta
;
import
org.pentaho.di.trans.step.StepMeta
;
...
...
@@ -56,6 +58,7 @@ import org.pentaho.di.trans.steps.textfileoutput.TextFileOutputMeta;
import
org.pentaho.di.trans.steps.userdefinedjavaclass.UserDefinedJavaClassDef
;
import
org.pentaho.di.trans.steps.userdefinedjavaclass.UserDefinedJavaClassMeta
;
import
org.pentaho.di.www.SlaveServerJobStatus
;
import
org.pentaho.di.www.SlaveServerTransStatus
;
import
org.quartz.JobExecutionContext
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.context.annotation.Lazy
;
...
...
@@ -572,16 +575,20 @@ public class ExtractDataService {
datasourceService
.
validate
(
datasetTable
.
getDataSourceId
());
KettleFileRepository
repository
=
CommonBeanFactory
.
getBean
(
KettleFileRepository
.
class
);
RepositoryDirectoryInterface
repositoryDirectoryInterface
=
repository
.
loadRepositoryDirectoryTree
();
TransMeta
transMeta
=
null
;
JobMeta
jobMeta
=
null
;
switch
(
extractType
)
{
case
"all_scope"
:
jobMeta
=
repository
.
loadJob
(
"job_"
+
DorisTableUtils
.
dorisName
(
datasetTable
.
getId
()),
repositoryDirectoryInterface
,
null
,
null
);
transMeta
=
repository
.
loadTransformation
(
"trans_"
+
DorisTableUtils
.
dorisName
(
datasetTable
.
getId
()),
repositoryDirectoryInterface
,
null
,
true
,
""
);
break
;
case
"incremental_add"
:
jobMeta
=
repository
.
loadJob
(
"job_add_"
+
DorisTableUtils
.
dorisName
(
datasetTable
.
getId
()),
repositoryDirectoryInterface
,
null
,
null
);
transMeta
=
repository
.
loadTransformation
(
"trans_add_"
+
DorisTableUtils
.
dorisName
(
datasetTable
.
getId
()),
repositoryDirectoryInterface
,
null
,
true
,
""
);
break
;
case
"incremental_delete"
:
jobMeta
=
repository
.
loadJob
(
"job_delete_"
+
DorisTableUtils
.
dorisName
(
datasetTable
.
getId
()),
repositoryDirectoryInterface
,
null
,
null
);
transMeta
=
repository
.
loadTransformation
(
"trans_delete_"
+
DorisTableUtils
.
dorisName
(
datasetTable
.
getId
()),
repositoryDirectoryInterface
,
null
,
true
,
""
);
break
;
default
:
break
;
...
...
@@ -591,9 +598,29 @@ public class ExtractDataService {
JobExecutionConfiguration
jobExecutionConfiguration
=
new
JobExecutionConfiguration
();
jobExecutionConfiguration
.
setRemoteServer
(
remoteSlaveServer
);
jobExecutionConfiguration
.
setRepository
(
repository
);
TransExecutionConfiguration
transExecutionConfiguration
=
new
TransExecutionConfiguration
();
transExecutionConfiguration
.
setRepository
(
repository
);
transExecutionConfiguration
.
setRemoteServer
(
remoteSlaveServer
);
String
lastTranceId
=
Trans
.
sendToSlaveServer
(
transMeta
,
transExecutionConfiguration
,
repository
,
null
);
SlaveServerTransStatus
transStatus
=
null
;
boolean
executing
=
true
;
while
(
executing
)
{
transStatus
=
remoteSlaveServer
.
getTransStatus
(
transMeta
.
getName
(),
lastTranceId
,
0
);
executing
=
transStatus
.
isRunning
()
||
transStatus
.
isWaiting
();
if
(!
executing
)
break
;
Thread
.
sleep
(
1000
);
}
if
(!
transStatus
.
getStatusDescription
().
equals
(
"Finished"
))
{
DataEaseException
.
throwException
((
transStatus
.
getLoggingString
()));
}
executing
=
true
;
String
lastCarteObjectId
=
Job
.
sendToSlaveServer
(
jobMeta
,
jobExecutionConfiguration
,
repository
,
null
);
SlaveServerJobStatus
jobStatus
=
null
;
boolean
executing
=
true
;
while
(
executing
)
{
jobStatus
=
remoteSlaveServer
.
getJobStatus
(
jobMeta
.
getName
(),
lastCarteObjectId
,
0
);
executing
=
jobStatus
.
isRunning
()
||
jobStatus
.
isWaiting
();
...
...
@@ -666,18 +693,18 @@ public class ExtractDataService {
jobMeta
.
addJobEntry
(
startEntry
);
//trans
JobEntryTrans
transrans
=
new
JobEntryTrans
();
transrans
.
clearResultFiles
=
true
;
transrans
.
clearResultRows
=
true
;
transrans
.
followingAbortRemotely
=
true
;
transrans
.
setTransname
(
transName
);
transrans
.
setName
(
"Transformation"
);
JobEntryCopy
transEntry
=
new
JobEntryCopy
(
transrans
);
transEntry
.
setDrawn
(
true
);
transEntry
.
setLocation
(
300
,
100
);
jobMeta
.
addJobEntry
(
transEntry
);
jobMeta
.
addJobHop
(
new
JobHopMeta
(
startEntry
,
transEntry
));
//
JobEntryTrans transrans = new JobEntryTrans();
//
transrans.clearResultFiles = true;
//
transrans.clearResultRows = true;
//
transrans.followingAbortRemotely = true;
//
transrans.setTransname(transName);
//
transrans.setName("Transformation");
//
JobEntryCopy transEntry = new JobEntryCopy(transrans);
//
transEntry.setDrawn(true);
//
transEntry.setLocation(300, 100);
//
jobMeta.addJobEntry(transEntry);
//
jobMeta.addJobHop(new JobHopMeta(startEntry, transEntry));
//exec shell
JobEntryShell
shell
=
new
JobEntryShell
();
...
...
@@ -689,7 +716,7 @@ public class ExtractDataService {
shellEntry
.
setLocation
(
500
,
100
);
jobMeta
.
addJobEntry
(
shellEntry
);
JobHopMeta
transHop
=
new
JobHopMeta
(
trans
Entry
,
shellEntry
);
JobHopMeta
transHop
=
new
JobHopMeta
(
start
Entry
,
shellEntry
);
transHop
.
setEvaluation
(
true
);
jobMeta
.
addJobHop
(
transHop
);
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论