Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
J
jz-dmp-cmdexectool
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
姚本章
jz-dmp-cmdexectool
Commits
3e16f307
Commit
3e16f307
authored
Mar 12, 2021
by
sml
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
代码提交
parent
55c875df
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
50 additions
and
22 deletions
+50
-22
DoctransParameters.java
...ol/scheduler/common/task/docTrans/DoctransParameters.java
+8
-6
ShellCommandExecutor.java
...ol/scheduler/server/worker/task/ShellCommandExecutor.java
+7
-1
DoctransTask.java
...l/scheduler/server/worker/task/doctrans/DoctransTask.java
+7
-2
FtpTask.java
...cmdexectool/scheduler/server/worker/task/ftp/FtpTask.java
+6
-2
HdfsTask.java
...dexectool/scheduler/server/worker/task/hdfs/HdfsTask.java
+7
-2
ShellTask.java
...xectool/scheduler/server/worker/task/shell/ShellTask.java
+3
-2
UnzipfileTask.java
...scheduler/server/worker/task/unzipfile/UnzipfileTask.java
+7
-2
doctrans.ftl
src/main/resources/templates/doctrans.ftl
+5
-5
No files found.
src/main/java/com/jz/dmp/cmdexectool/scheduler/common/task/docTrans/DoctransParameters.java
View file @
3e16f307
...
...
@@ -62,15 +62,17 @@ public class DoctransParameters extends AbstractParameters {
Map
<
String
,
String
>
doctransModel
=
new
HashMap
<
String
,
String
>();
String
srcDir
=
scriptObj
.
getString
(
"f
tp
Url"
);
String
[]
srcDirSuffix
=
srcDir
.
split
(
"."
);
String
srcDir
=
scriptObj
.
getString
(
"f
ileAddress
Url"
);
String
[]
srcDirSuffix
=
srcDir
.
split
(
"
\\
."
);
String
fileSuffix
=
srcDirSuffix
[
1
];
String
desDir
=
scriptObj
.
getString
(
"ftpUrl"
);
String
sourceConvert
=
scriptObj
.
getString
(
"ftpUrl"
);
String
sinkConvert
=
scriptObj
.
getString
(
"ftpUrl"
);
String
srcDirPath
=
srcDir
.
substring
(
0
,
srcDir
.
lastIndexOf
(
"/"
));
String
desDir
=
scriptObj
.
getString
(
"outpuAddressUrl"
);
String
sourceConvert
=
scriptObj
.
getString
(
"documentCode"
);
String
sinkConvert
=
scriptObj
.
getString
(
"fileCharsetEncode"
);
doctransModel
.
put
(
"src_dir"
,
srcDir
);
doctransModel
.
put
(
"src_dir"
,
srcDir
Path
);
doctransModel
.
put
(
"des_dir"
,
desDir
);
doctransModel
.
put
(
"source_convert"
,
sourceConvert
);
doctransModel
.
put
(
"sink_convert"
,
sinkConvert
);
...
...
src/main/java/com/jz/dmp/cmdexectool/scheduler/server/worker/task/ShellCommandExecutor.java
View file @
3e16f307
...
...
@@ -60,9 +60,15 @@ public class ShellCommandExecutor extends AbstractCommandExecutor {
@Override
protected
String
buildCommandFilePath
()
{
// command file
return
String
.
format
(
"%s/%s.%s"
//return String.format("%s/%s.%s"
// , taskExecutionContext.getExecutePath()
// , taskExecutionContext.getTaskAppId()
// , OSUtils.isWindows() ? "bat" : "command");
return
String
.
format
(
"%s/%s_%s.%s"
,
taskExecutionContext
.
getExecutePath
()
,
taskExecutionContext
.
getTaskAppId
()
,
taskExecutionContext
.
getExecId
()
,
OSUtils
.
isWindows
()
?
"bat"
:
"command"
);
}
...
...
src/main/java/com/jz/dmp/cmdexectool/scheduler/server/worker/task/doctrans/DoctransTask.java
View file @
3e16f307
...
...
@@ -111,8 +111,13 @@ public class DoctransTask extends AbstractTask {
*/
private
String
buildCommand
()
throws
Exception
{
// generate scripts
String
fileName
=
String
.
format
(
"%s/%s_node.%s"
,
taskExecutionContext
.
getExecutePath
(),
taskExecutionContext
.
getTaskAppId
(),
OSUtils
.
isWindows
()
?
"bat"
:
"sh"
);
//String fileName = String.format("%s/%s_node.%s", taskExecutionContext.getExecutePath(),
// taskExecutionContext.getTaskAppId(), OSUtils.isWindows() ? "bat" : "sh");
String
fileName
=
String
.
format
(
"%s/%s_node_%s.%s"
,
taskExecutionContext
.
getExecutePath
(),
taskExecutionContext
.
getTaskAppId
(),
taskExecutionContext
.
getExecId
(),
OSUtils
.
isWindows
()
?
"bat"
:
"sh"
);
Path
path
=
new
File
(
fileName
).
toPath
();
...
...
src/main/java/com/jz/dmp/cmdexectool/scheduler/server/worker/task/ftp/FtpTask.java
View file @
3e16f307
...
...
@@ -108,8 +108,12 @@ public class FtpTask extends AbstractTask {
*/
private
String
buildCommand
()
throws
Exception
{
// generate scripts
String
fileName
=
String
.
format
(
"%s/%s_node2.%s"
,
taskExecutionContext
.
getExecutePath
(),
taskExecutionContext
.
getTaskAppId
(),
OSUtils
.
isWindows
()
?
"bat"
:
"sh"
);
//String fileName = String.format("%s/%s_node2.%s", taskExecutionContext.getExecutePath(),
// taskExecutionContext.getTaskAppId(), OSUtils.isWindows() ? "bat" : "sh");
String
fileName
=
String
.
format
(
"%s/%s_node_%s.%s"
,
taskExecutionContext
.
getExecutePath
(),
taskExecutionContext
.
getTaskAppId
(),
taskExecutionContext
.
getExecId
(),
OSUtils
.
isWindows
()
?
"bat"
:
"sh"
);
Path
path
=
new
File
(
fileName
).
toPath
();
...
...
src/main/java/com/jz/dmp/cmdexectool/scheduler/server/worker/task/hdfs/HdfsTask.java
View file @
3e16f307
...
...
@@ -111,8 +111,13 @@ public class HdfsTask extends AbstractTask {
*/
private
String
buildCommand
()
throws
Exception
{
// generate scripts
String
fileName
=
String
.
format
(
"%s/%s_node.%s"
,
taskExecutionContext
.
getExecutePath
(),
taskExecutionContext
.
getTaskAppId
(),
OSUtils
.
isWindows
()
?
"bat"
:
"sh"
);
//String fileName = String.format("%s/%s_node.%s", taskExecutionContext.getExecutePath(),
// taskExecutionContext.getTaskAppId(), OSUtils.isWindows() ? "bat" : "sh");
String
fileName
=
String
.
format
(
"%s/%s_node_%s.%s"
,
taskExecutionContext
.
getExecutePath
(),
taskExecutionContext
.
getTaskAppId
(),
taskExecutionContext
.
getExecId
(),
OSUtils
.
isWindows
()
?
"bat"
:
"sh"
);
Path
path
=
new
File
(
fileName
).
toPath
();
...
...
src/main/java/com/jz/dmp/cmdexectool/scheduler/server/worker/task/shell/ShellTask.java
View file @
3e16f307
...
...
@@ -118,9 +118,10 @@ public class ShellTask extends AbstractTask {
*/
private
String
buildCommand
()
throws
Exception
{
// generate scripts
String
fileName
=
String
.
format
(
"%s/%s_node.%s"
,
String
fileName
=
String
.
format
(
"%s/%s_node
_%s
.%s"
,
taskExecutionContext
.
getExecutePath
(),
taskExecutionContext
.
getTaskAppId
(),
OSUtils
.
isWindows
()
?
"bat"
:
"sh"
);
taskExecutionContext
.
getTaskAppId
(),
taskExecutionContext
.
getExecId
(),
OSUtils
.
isWindows
()
?
"bat"
:
"sh"
);
Path
path
=
new
File
(
fileName
).
toPath
();
...
...
src/main/java/com/jz/dmp/cmdexectool/scheduler/server/worker/task/unzipfile/UnzipfileTask.java
View file @
3e16f307
...
...
@@ -111,8 +111,13 @@ public class UnzipfileTask extends AbstractTask {
*/
private
String
buildCommand
()
throws
Exception
{
// generate scripts
String
fileName
=
String
.
format
(
"%s/%s_node.%s"
,
taskExecutionContext
.
getExecutePath
(),
taskExecutionContext
.
getTaskAppId
(),
OSUtils
.
isWindows
()
?
"bat"
:
"sh"
);
//String fileName = String.format("%s/%s_node.%s", taskExecutionContext.getExecutePath(),
// taskExecutionContext.getTaskAppId(), OSUtils.isWindows() ? "bat" : "sh");
String
fileName
=
String
.
format
(
"%s/%s_node_%s.%s"
,
taskExecutionContext
.
getExecutePath
(),
taskExecutionContext
.
getTaskAppId
(),
taskExecutionContext
.
getExecId
(),
OSUtils
.
isWindows
()
?
"bat"
:
"sh"
);
Path
path
=
new
File
(
fileName
).
toPath
();
...
...
src/main/resources/templates/doctrans.ftl
View file @
3e16f307
...
...
@@ -10,14 +10,14 @@ file_suffix=${file_suffix!}
cd
${
src_dir
}
filename
=
`
ls
-l
|
grep
^- |
awk
'{print $9}'
|
grep
.
${
file_suffix
}
`
echo
${
filename
}
echo
${
r
'${filename}'
}
# 获取当前系统时间
time
=
`
date
+%Y-%m-%d_%H:%M:%S
`
for
file
in
${
filename
}
for
file
in
${
r
'${filename}'
}
do
echo
"正在转码的文件是:
${
file
}
"
mkdir
-p
${
des_dir
}
/
${
time
}
iconv
-f
${
source_convert
}
-t
${
sink_convert
}
$src_dir
/
${
file
}
-o
${
des_dir
}
/
${
time
}
/
${
file
}
${
r
'echo "正在转码的文件是: ${file}"'
}
${
r
'mkdir -p ${des_dir}/${time}'
}
${
r
'iconv -f ${source_convert} -t ${sink_convert} $src_dir/${file} -o ${des_dir}/${time}/${file}'
}
done
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment