Commit 3ee6af0a authored by 霍传世's avatar 霍传世

测试生成上传任务表

parent c9a29266
......@@ -213,51 +213,34 @@ public class PDFGeByProvinceBatchController {
List<BasicReportParameters> schoolBasicReport = schoolReport.get(key);
for (BasicReportParameters schoolLevel : schoolBasicReport) {
logger.info("school:"+schoolLevel.getSchool()+"loading---------------------------------------------------------------");
executorService.submit(() -> {
// 其他逻辑...
logger.info("basicReport:loading******************************************");
ProcessBuilder processBuilder = new ProcessBuilder();
processBuilder.command("bash", "-c", schoolLevel.getCommand());
processBuilder.redirectErrorStream(true); // 合并标准输出和错误输出
Process process = null;
try {
process = processBuilder.start();
} catch (IOException e) {
throw new RuntimeException(e);
}
Process process = processBuilder.start();
BufferedReader reader = new BufferedReader(new InputStreamReader(process.getInputStream()));
String line;
while (true) {
try {
if (!((line = reader.readLine()) != null)) break;
} catch (IOException e) {
throw new RuntimeException(e);
while ((line = reader.readLine()) != null) {
}
}
try {
int exitCode = process.waitFor();
} catch (InterruptedException e) {
throw new RuntimeException(e);
}
logger.info("exitCode:"+schoolLevel.getSchool());
// File file = new File("/myworkSpace/basic/");
// File[] files1 = file.listFiles();
// assert files1 != null;
// for (File file1 : files1) {
// PutObjectRequest putObjectRequest = new PutObjectRequest(bucketName, "PdfTest/"+file1.getName(), file1);
// try {
// PutObjectResult putObjectResult = cosClient.putObject(putObjectRequest);
// logger.info(putObjectResult.getRequestId());
// file1.delete();
// } catch (CosServiceException e) {
// logger.info("cos服务出现问题");
// e.printStackTrace();
// } catch (CosClientException e) {
// logger.info("cos客户端出现问题"+file.getName()+"文件上传有误,重新上传");
// e.printStackTrace();
// }
// }
});
File file = new File("/myworkSpace/basic/");
File[] files1 = file.listFiles();
assert files1 != null;
for (File file1 : files1) {
PutObjectRequest putObjectRequest = new PutObjectRequest(bucketName, "PdfTest/"+file1.getName(), file1);
try {
PutObjectResult putObjectResult = cosClient.putObject(putObjectRequest);
logger.info(putObjectResult.getRequestId());
file1.delete();
} catch (CosServiceException e) {
logger.info("cos服务出现问题");
e.printStackTrace();
} catch (CosClientException e) {
logger.info("cos客户端出现问题"+file.getName()+"文件上传有误,重新上传");
e.printStackTrace();
}
}
}
}
return null;
......
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