Commit 3e16f307 authored by sml's avatar sml

代码提交

parent 55c875df
......@@ -62,15 +62,17 @@ public class DoctransParameters extends AbstractParameters {
Map<String, String> doctransModel = new HashMap<String, String>();
String srcDir = scriptObj.getString("ftpUrl");
String[] srcDirSuffix = srcDir.split(".");
String srcDir = scriptObj.getString("fileAddressUrl");
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", srcDirPath);
doctransModel.put("des_dir", desDir);
doctransModel.put("source_convert", sourceConvert);
doctransModel.put("sink_convert", sinkConvert);
......
......@@ -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");
}
......
......@@ -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();
......
......@@ -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();
......
......@@ -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();
......
......@@ -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();
......
......@@ -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();
......
......@@ -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
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment