Commit f1608c46 authored by 霍传世's avatar 霍传世

Revert "测试服务器生成的效率"

This reverts commit ee95caf5.

# Conflicts:
#	src/main/java/com/example/pdfgenerator/controller/GeneratorAllTypePdfByProvinceController.java
parent bacc9730
...@@ -5,10 +5,6 @@ import com.example.pdfgenerator.Dto.ClassBasicReportParameters; ...@@ -5,10 +5,6 @@ import com.example.pdfgenerator.Dto.ClassBasicReportParameters;
import com.example.pdfgenerator.Dto.RetryCommand; import com.example.pdfgenerator.Dto.RetryCommand;
import com.example.pdfgenerator.config.MyDataSourceConfig; import com.example.pdfgenerator.config.MyDataSourceConfig;
import com.qcloud.cos.COSClient; import com.qcloud.cos.COSClient;
import com.qcloud.cos.exception.CosClientException;
import com.qcloud.cos.exception.CosServiceException;
import com.qcloud.cos.model.PutObjectRequest;
import com.qcloud.cos.model.PutObjectResult;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
...@@ -20,7 +16,6 @@ import org.springframework.web.bind.annotation.RequestParam; ...@@ -20,7 +16,6 @@ import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import java.io.BufferedReader; import java.io.BufferedReader;
import java.io.File;
import java.io.IOException; import java.io.IOException;
import java.io.InputStreamReader; import java.io.InputStreamReader;
import java.util.*; import java.util.*;
...@@ -145,22 +140,22 @@ public class GeneratorAllTypePdfByProvinceController { ...@@ -145,22 +140,22 @@ public class GeneratorAllTypePdfByProvinceController {
for (BasicReportParameters parameter : synthesisSchoolSubjectReportParameters) { for (BasicReportParameters parameter : synthesisSchoolSubjectReportParameters) {
if(parameter.getRegion().equals("改革")||parameter.getRegion().equals("改革A")||parameter.getRegion().equals("改革3+3")||parameter.getRegion().equals("改革3+1+2")){ if(parameter.getRegion().equals("改革")||parameter.getRegion().equals("改革A")||parameter.getRegion().equals("改革3+3")||parameter.getRegion().equals("改革3+1+2")){
String command = "node D:/myworkSpace/puppeteer2.js \"http://schoolreport.cssat.cn/pdf/subject?province=condition5&school=condition1&examId=condition4&region=conditionC&subSubject=condition6&subjectType=常规\" pdf"; String command = "node /myworkSpace/puppeteer2.js \"http://schoolreport.cssat.cn/pdf/subject?province=condition5&school=condition1&examId=condition4&region=conditionC&subSubject=condition6&subjectType=常规\" pdf";
String fileName = "D:/myworkSpace/subject/" + parameter.getRegion() + parameter.getProvince() + parameter.getSchool() + parameter.getSubSubject() + parameter.getExamId() + ".pdf"; String fileName = "/myworkSpace/subject/" + parameter.getRegion() + parameter.getProvince() + parameter.getSchool() + parameter.getSubSubject() + parameter.getExamId() + ".pdf";
command = command.replace("condition1", parameter.getSchool()).replace("condition5", parameter.getProvince()).replace("conditionC", parameter.getRegion()).replace("condition4", parameter.getExamId()).replace("condition6", parameter.getSubSubject()) command = command.replace("condition1", parameter.getSchool()).replace("condition5", parameter.getProvince()).replace("conditionC", parameter.getRegion()).replace("condition4", parameter.getExamId()).replace("condition6", parameter.getSubSubject())
.concat(" ").concat(fileName); .concat(" ").concat(fileName);
parameter.setCommand(command); parameter.setCommand(command);
parameter.setPrefix("D:/myworkSpace/subject/"); parameter.setPrefix("/myworkSpace/subject/");
fileToUrl.put(fileName.replace("D:/myworkSpace/subject/",""),"PdfSubject/"+fileName.replace("D:/myworkSpace/subject/","")); fileToUrl.put(fileName.replace("/myworkSpace/subject/",""),"PdfSubject/"+fileName.replace("/myworkSpace/subject/",""));
}else{ }else{
String command = "node D:/myworkSpace/puppeteer2.js \"http://schoolreport.cssat.cn/pdf/subject?province=condition5&school=condition1&examId=condition4&region=非改革&branch=condition3&subSubject=condition6&subjectType=常规\" pdf"; String command = "node /myworkSpace/puppeteer2.js \"http://schoolreport.cssat.cn/pdf/subject?province=condition5&school=condition1&examId=condition4&region=非改革&branch=condition3&subSubject=condition6&subjectType=常规\" pdf";
String fileName = "D:/myworkSpace/subject/" + parameter.getRegion() + parameter.getProvince() + parameter.getSchool() + parameter.getSubSubject() + parameter.getExamId() + ".pdf"; String fileName = "/myworkSpace/subject/" + parameter.getRegion() + parameter.getProvince() + parameter.getSchool() + parameter.getSubSubject() + parameter.getExamId() + ".pdf";
command = command.replace("condition1", parameter.getSchool()).replace("condition5", parameter.getProvince()).replace("condition3", parameter.getRegion()).replace("condition4", parameter.getExamId()).replace("condition6", parameter.getSubSubject()) command = command.replace("condition1", parameter.getSchool()).replace("condition5", parameter.getProvince()).replace("condition3", parameter.getRegion()).replace("condition4", parameter.getExamId()).replace("condition6", parameter.getSubSubject())
.concat(" ").concat(fileName); .concat(" ").concat(fileName);
parameter.setCommand(command); parameter.setCommand(command);
parameter.setPrefix("D:/myworkSpace/subject/"); parameter.setPrefix("/myworkSpace/subject/");
fileToUrl.put(fileName.replace("D:/myworkSpace/subject/",""),"PdfSubject/"+fileName.replace("D:/myworkSpace/subject/","")); fileToUrl.put(fileName.replace("/myworkSpace/subject/",""),"PdfSubject/"+fileName.replace("/myworkSpace/subject/",""));
} }
} }
...@@ -168,21 +163,21 @@ public class GeneratorAllTypePdfByProvinceController { ...@@ -168,21 +163,21 @@ public class GeneratorAllTypePdfByProvinceController {
for (BasicReportParameters synthesisSchoolReportParameter : synthesisSchoolReportParameters) { for (BasicReportParameters synthesisSchoolReportParameter : synthesisSchoolReportParameters) {
if(synthesisSchoolReportParameter.getRegion().equals("改革")||synthesisSchoolReportParameter.getRegion().equals("改革A")||synthesisSchoolReportParameter.getRegion().equals("改革3+3")||synthesisSchoolReportParameter.getRegion().equals("改革3+1+2")){ if(synthesisSchoolReportParameter.getRegion().equals("改革")||synthesisSchoolReportParameter.getRegion().equals("改革A")||synthesisSchoolReportParameter.getRegion().equals("改革3+3")||synthesisSchoolReportParameter.getRegion().equals("改革3+1+2")){
String command = "node D:/myworkSpace/puppeteer.js \"http://schoolreport.cssat.cn/pdf/basic?province=condition5&school=condition1&examId=condition4&region=conditionC&subjectType=常规\" pdf "; String command = "node /myworkSpace/puppeteer.js \"http://schoolreport.cssat.cn/pdf/basic?province=condition5&school=condition1&examId=condition4&region=conditionC&subjectType=常规\" pdf ";
String fileName = "D:/myworkSpace/basic/"+synthesisSchoolReportParameter.getRegion()+synthesisSchoolReportParameter.getProvince()+synthesisSchoolReportParameter.getSchool()+synthesisSchoolReportParameter.getExamId()+".pdf"; String fileName = "/myworkSpace/basic/"+synthesisSchoolReportParameter.getRegion()+synthesisSchoolReportParameter.getProvince()+synthesisSchoolReportParameter.getSchool()+synthesisSchoolReportParameter.getExamId()+".pdf";
command = command.replace("condition1", synthesisSchoolReportParameter.getSchool()).replace("condition5", synthesisSchoolReportParameter.getProvince()).replace("conditionC",synthesisSchoolReportParameter.getRegion()).replace("condition4", synthesisSchoolReportParameter.getExamId()) command = command.replace("condition1", synthesisSchoolReportParameter.getSchool()).replace("condition5", synthesisSchoolReportParameter.getProvince()).replace("conditionC",synthesisSchoolReportParameter.getRegion()).replace("condition4", synthesisSchoolReportParameter.getExamId())
.concat(" ").concat(fileName); .concat(" ").concat(fileName);
synthesisSchoolReportParameter.setCommand(command); synthesisSchoolReportParameter.setCommand(command);
synthesisSchoolReportParameter.setPrefix("D:/myworkSpace/basic/"); synthesisSchoolReportParameter.setPrefix("/myworkSpace/basic/");
fileToUrl.put(fileName.replace("D:/myworkSpace/basic/",""),"PdfDir/"+fileName.replace("D:/myworkSpace/basic/","")); fileToUrl.put(fileName.replace("/myworkSpace/basic/",""),"PdfDir/"+fileName.replace("/myworkSpace/basic/",""));
}else{ }else{
String command = "node D:/myworkSpace/puppeteer.js \"http://schoolreport.cssat.cn/pdf/basic?province=condition5&school=condition1&examId=condition4&region=非改革&branch=condition3&subjectType=常规\" pdf "; String command = "node /myworkSpace/puppeteer.js \"http://schoolreport.cssat.cn/pdf/basic?province=condition5&school=condition1&examId=condition4&region=非改革&branch=condition3&subjectType=常规\" pdf ";
String fileName = "D:/myworkSpace/basic/"+synthesisSchoolReportParameter.getRegion()+synthesisSchoolReportParameter.getProvince()+synthesisSchoolReportParameter.getSchool()+synthesisSchoolReportParameter.getExamId()+".pdf"; String fileName = "/myworkSpace/basic/"+synthesisSchoolReportParameter.getRegion()+synthesisSchoolReportParameter.getProvince()+synthesisSchoolReportParameter.getSchool()+synthesisSchoolReportParameter.getExamId()+".pdf";
command = command.replace("condition1", synthesisSchoolReportParameter.getSchool()).replace("condition5", synthesisSchoolReportParameter.getProvince()).replace("condition3",synthesisSchoolReportParameter.getRegion()).replace("condition4", synthesisSchoolReportParameter.getExamId()) command = command.replace("condition1", synthesisSchoolReportParameter.getSchool()).replace("condition5", synthesisSchoolReportParameter.getProvince()).replace("condition3",synthesisSchoolReportParameter.getRegion()).replace("condition4", synthesisSchoolReportParameter.getExamId())
.concat(" ").concat(fileName); .concat(" ").concat(fileName);
synthesisSchoolReportParameter.setCommand(command); synthesisSchoolReportParameter.setCommand(command);
synthesisSchoolReportParameter.setPrefix("D:/myworkSpace/basic/"); synthesisSchoolReportParameter.setPrefix("/myworkSpace/basic/");
fileToUrl.put(fileName.replace("D:/myworkSpace/basic/",""),"PdfDir/"+fileName.replace("D:/myworkSpace/basic/","")); fileToUrl.put(fileName.replace("/myworkSpace/basic/",""),"PdfDir/"+fileName.replace("/myworkSpace/basic/",""));
} }
} }
...@@ -192,22 +187,22 @@ public class GeneratorAllTypePdfByProvinceController { ...@@ -192,22 +187,22 @@ public class GeneratorAllTypePdfByProvinceController {
for (ClassBasicReportParameters synthesisClassSubjectReportParameter : synthesisClassSubjectReportParameters) { for (ClassBasicReportParameters synthesisClassSubjectReportParameter : synthesisClassSubjectReportParameters) {
if (synthesisClassSubjectReportParameter.getRegion().equals("改革")||synthesisClassSubjectReportParameter.getRegion().equals("改革A")||synthesisClassSubjectReportParameter.getRegion().equals("改革3+3")||synthesisClassSubjectReportParameter.getRegion().equals("改革3+1+2")) { if (synthesisClassSubjectReportParameter.getRegion().equals("改革")||synthesisClassSubjectReportParameter.getRegion().equals("改革A")||synthesisClassSubjectReportParameter.getRegion().equals("改革3+3")||synthesisClassSubjectReportParameter.getRegion().equals("改革3+1+2")) {
String command = "node D:/myworkSpace/pdfOfClassSubjectGen.js \"http://schoolreport.cssat.cn/pdf/classSubject?province=condition5&school=condition1&examId=condition4&region=conditionC&subSubject=condition6&subjectType=常规&className=conditionA\" pdf"; String command = "node /myworkSpace/pdfOfClassSubjectGen.js \"http://schoolreport.cssat.cn/pdf/classSubject?province=condition5&school=condition1&examId=condition4&region=conditionC&subSubject=condition6&subjectType=常规&className=conditionA\" pdf";
String fileName = "D:/myworkSpace/Class/subject/" + synthesisClassSubjectReportParameter.getRegion() + synthesisClassSubjectReportParameter.getProvince() + synthesisClassSubjectReportParameter.getSchool() + synthesisClassSubjectReportParameter.getSubSubject() + synthesisClassSubjectReportParameter.getExamId() + synthesisClassSubjectReportParameter.getSubSubject() + synthesisClassSubjectReportParameter.getClassName().replace(" ","")+ ".pdf"; String fileName = "/myworkSpace/Class/subject/" + synthesisClassSubjectReportParameter.getRegion() + synthesisClassSubjectReportParameter.getProvince() + synthesisClassSubjectReportParameter.getSchool() + synthesisClassSubjectReportParameter.getSubSubject() + synthesisClassSubjectReportParameter.getExamId() + synthesisClassSubjectReportParameter.getSubSubject() + synthesisClassSubjectReportParameter.getClassName().replace(" ","")+ ".pdf";
command = command.replace("condition1", synthesisClassSubjectReportParameter.getSchool()).replace("condition5", synthesisClassSubjectReportParameter.getProvince()).replace("conditionC", synthesisClassSubjectReportParameter.getRegion()).replace("condition4", synthesisClassSubjectReportParameter.getExamId()).replace("condition6", synthesisClassSubjectReportParameter.getSubSubject()).replace("conditionA",synthesisClassSubjectReportParameter.getClassName()) command = command.replace("condition1", synthesisClassSubjectReportParameter.getSchool()).replace("condition5", synthesisClassSubjectReportParameter.getProvince()).replace("conditionC", synthesisClassSubjectReportParameter.getRegion()).replace("condition4", synthesisClassSubjectReportParameter.getExamId()).replace("condition6", synthesisClassSubjectReportParameter.getSubSubject()).replace("conditionA",synthesisClassSubjectReportParameter.getClassName())
.concat(" ").concat(fileName); .concat(" ").concat(fileName);
fileToUrl.put(fileName.replace("D:/myworkSpace/Class/subject/",""),"/class/"+synthesisClassSubjectReportParameter.getExamId()+"/"+synthesisClassSubjectReportParameter.getProvince()+"/"+synthesisClassSubjectReportParameter.getSchool()+"/班级学科报告/"+synthesisClassSubjectReportParameter.getClassName()+"/"+synthesisClassSubjectReportParameter.getSubSubject()+"/"+fileName.replace("D:/myworkSpace/Class/subject/","")); fileToUrl.put(fileName.replace("/myworkSpace/Class/subject/",""),"/class/"+synthesisClassSubjectReportParameter.getExamId()+"/"+synthesisClassSubjectReportParameter.getProvince()+"/"+synthesisClassSubjectReportParameter.getSchool()+"/班级学科报告/"+synthesisClassSubjectReportParameter.getClassName()+"/"+synthesisClassSubjectReportParameter.getSubSubject()+"/"+fileName.replace("/myworkSpace/Class/subject/",""));
synthesisClassSubjectReportParameter.setCommand(command); synthesisClassSubjectReportParameter.setCommand(command);
synthesisClassSubjectReportParameter.setPrefix("D:/myworkSpace/Class/subject/"); synthesisClassSubjectReportParameter.setPrefix("/myworkSpace/Class/subject/");
} else { } else {
String command = "node D:/myworkSpace/pdfOfClassSubjectGen.js \"http://schoolreport.cssat.cn/pdf/classSubject?province=condition5&school=condition1&examId=condition4&region=非改革&branch=condition3&subSubject=condition6&subjectType=常规&className=conditionA\" pdf"; String command = "node /myworkSpace/pdfOfClassSubjectGen.js \"http://schoolreport.cssat.cn/pdf/classSubject?province=condition5&school=condition1&examId=condition4&region=非改革&branch=condition3&subSubject=condition6&subjectType=常规&className=conditionA\" pdf";
String fileName = "D:/myworkSpace/Class/subject/" + synthesisClassSubjectReportParameter.getRegion() + synthesisClassSubjectReportParameter.getProvince() + synthesisClassSubjectReportParameter.getSchool() + synthesisClassSubjectReportParameter.getSubSubject() + synthesisClassSubjectReportParameter.getExamId() + synthesisClassSubjectReportParameter.getSubSubject() + synthesisClassSubjectReportParameter.getClassName().replace(" ","")+".pdf"; String fileName = "/myworkSpace/Class/subject/" + synthesisClassSubjectReportParameter.getRegion() + synthesisClassSubjectReportParameter.getProvince() + synthesisClassSubjectReportParameter.getSchool() + synthesisClassSubjectReportParameter.getSubSubject() + synthesisClassSubjectReportParameter.getExamId() + synthesisClassSubjectReportParameter.getSubSubject() + synthesisClassSubjectReportParameter.getClassName().replace(" ","")+".pdf";
command = command.replace("condition1", synthesisClassSubjectReportParameter.getSchool()).replace("condition5", synthesisClassSubjectReportParameter.getProvince()).replace("condition3", synthesisClassSubjectReportParameter.getRegion()).replace("condition4", synthesisClassSubjectReportParameter.getExamId()).replace("condition6", synthesisClassSubjectReportParameter.getSubSubject()).replace("conditionA",synthesisClassSubjectReportParameter.getClassName()) command = command.replace("condition1", synthesisClassSubjectReportParameter.getSchool()).replace("condition5", synthesisClassSubjectReportParameter.getProvince()).replace("condition3", synthesisClassSubjectReportParameter.getRegion()).replace("condition4", synthesisClassSubjectReportParameter.getExamId()).replace("condition6", synthesisClassSubjectReportParameter.getSubSubject()).replace("conditionA",synthesisClassSubjectReportParameter.getClassName())
.concat(" ").concat(fileName); .concat(" ").concat(fileName);
fileToUrl.put(fileName.replace("D:/myworkSpace/Class/subject/",""),"/class/"+synthesisClassSubjectReportParameter.getExamId()+"/"+synthesisClassSubjectReportParameter.getProvince()+"/"+synthesisClassSubjectReportParameter.getSchool()+"/班级学科报告/"+synthesisClassSubjectReportParameter.getClassName()+"/"+synthesisClassSubjectReportParameter.getSubSubject()+"/"+fileName.replace("D:/myworkSpace/Class/subject/","")); fileToUrl.put(fileName.replace("/myworkSpace/Class/subject/",""),"/class/"+synthesisClassSubjectReportParameter.getExamId()+"/"+synthesisClassSubjectReportParameter.getProvince()+"/"+synthesisClassSubjectReportParameter.getSchool()+"/班级学科报告/"+synthesisClassSubjectReportParameter.getClassName()+"/"+synthesisClassSubjectReportParameter.getSubSubject()+"/"+fileName.replace("/myworkSpace/Class/subject/",""));
synthesisClassSubjectReportParameter.setCommand(command); synthesisClassSubjectReportParameter.setCommand(command);
synthesisClassSubjectReportParameter.setPrefix("D:/myworkSpace/Class/subject/"); synthesisClassSubjectReportParameter.setPrefix("/myworkSpace/Class/subject/");
} }
} }
...@@ -217,33 +212,33 @@ public class GeneratorAllTypePdfByProvinceController { ...@@ -217,33 +212,33 @@ public class GeneratorAllTypePdfByProvinceController {
if(synthesisClassReportParameter.getRegion().equals("改革")||synthesisClassReportParameter.getRegion().equals("改革A")||synthesisClassReportParameter.getRegion().equals("改革3+3")||synthesisClassReportParameter.getRegion().equals("改革3+1+2")){ if(synthesisClassReportParameter.getRegion().equals("改革")||synthesisClassReportParameter.getRegion().equals("改革A")||synthesisClassReportParameter.getRegion().equals("改革3+3")||synthesisClassReportParameter.getRegion().equals("改革3+1+2")){
String command = "node D:/myworkSpace/pdfOfClassBasicGen.js \"http://schoolreport.cssat.cn/pdf/classBasic?province=condition5&school=condition1&examId=condition4&region=conditionC&subjectType=常规&className=conditionA\" pdf "; String command = "node /myworkSpace/pdfOfClassBasicGen.js \"http://schoolreport.cssat.cn/pdf/classBasic?province=condition5&school=condition1&examId=condition4&region=conditionC&subjectType=常规&className=conditionA\" pdf ";
String fileName = "D:/myworkSpace/Class/Basic/"+synthesisClassReportParameter.getRegion()+synthesisClassReportParameter.getProvince()+synthesisClassReportParameter.getSchool()+ synthesisClassReportParameter.getClassName()+synthesisClassReportParameter.getExamId()+".pdf"; String fileName = "/myworkSpace/Class/Basic/"+synthesisClassReportParameter.getRegion()+synthesisClassReportParameter.getProvince()+synthesisClassReportParameter.getSchool()+ synthesisClassReportParameter.getClassName()+synthesisClassReportParameter.getExamId()+".pdf";
command = command.replace("condition1", synthesisClassReportParameter.getSchool()).replace("condition5", synthesisClassReportParameter.getProvince()).replace("conditionC",synthesisClassReportParameter.getRegion()).replace("condition4", synthesisClassReportParameter.getExamId()).replace("conditionA",synthesisClassReportParameter.getClassName()) command = command.replace("condition1", synthesisClassReportParameter.getSchool()).replace("condition5", synthesisClassReportParameter.getProvince()).replace("conditionC",synthesisClassReportParameter.getRegion()).replace("condition4", synthesisClassReportParameter.getExamId()).replace("conditionA",synthesisClassReportParameter.getClassName())
.concat(" ").concat(fileName); .concat(" ").concat(fileName);
fileToUrl.put(fileName.replace("D:/myworkSpace/Class/Basic/",""),"/class/"+synthesisClassReportParameter.getExamId()+"/"+synthesisClassReportParameter.getProvince()+"/"+synthesisClassReportParameter.getSchool()+"/班级综合报告/"+synthesisClassReportParameter.getClassName()+"/"+fileName.replace("D:/myworkSpace/Class/Basic/","")); fileToUrl.put(fileName.replace("/myworkSpace/Class/Basic/",""),"/class/"+synthesisClassReportParameter.getExamId()+"/"+synthesisClassReportParameter.getProvince()+"/"+synthesisClassReportParameter.getSchool()+"/班级综合报告/"+synthesisClassReportParameter.getClassName()+"/"+fileName.replace("/myworkSpace/Class/Basic/",""));
synthesisClassReportParameter.setCommand(command); synthesisClassReportParameter.setCommand(command);
synthesisClassReportParameter.setPrefix("D:/myworkSpace/Class/Basic/"); synthesisClassReportParameter.setPrefix("/myworkSpace/Class/Basic/");
} else { } else {
String command = "nodeD:/myworkSpace/pdfOfClassBasicGen.js \"http://schoolreport.cssat.cn/pdf/classBasic?province=condition5&school=condition1&examId=condition4&region=非改革&branch=condition3&subjectType=常规&className=conditionA\" pdf "; String command = "node/myworkSpace/pdfOfClassBasicGen.js \"http://schoolreport.cssat.cn/pdf/classBasic?province=condition5&school=condition1&examId=condition4&region=非改革&branch=condition3&subjectType=常规&className=conditionA\" pdf ";
String fileName = "D:/myworkSpace/Class/Basic/"+synthesisClassReportParameter.getRegion()+synthesisClassReportParameter.getProvince()+synthesisClassReportParameter.getSchool()+synthesisClassReportParameter.getClassName()+synthesisClassReportParameter.getExamId()+".pdf"; String fileName = "/myworkSpace/Class/Basic/"+synthesisClassReportParameter.getRegion()+synthesisClassReportParameter.getProvince()+synthesisClassReportParameter.getSchool()+synthesisClassReportParameter.getClassName()+synthesisClassReportParameter.getExamId()+".pdf";
command = command.replace("condition1", synthesisClassReportParameter.getSchool()).replace("condition5", synthesisClassReportParameter.getProvince()).replace("condition3",synthesisClassReportParameter.getRegion()).replace("condition4", synthesisClassReportParameter.getExamId()).replace("conditionA",synthesisClassReportParameter.getClassName()) command = command.replace("condition1", synthesisClassReportParameter.getSchool()).replace("condition5", synthesisClassReportParameter.getProvince()).replace("condition3",synthesisClassReportParameter.getRegion()).replace("condition4", synthesisClassReportParameter.getExamId()).replace("conditionA",synthesisClassReportParameter.getClassName())
.concat(" ").concat(fileName); .concat(" ").concat(fileName);
fileToUrl.put(fileName.replace("D:/myworkSpace/Class/Basic/",""),"/class/"+synthesisClassReportParameter.getExamId()+"/"+synthesisClassReportParameter.getProvince()+"/"+synthesisClassReportParameter.getSchool()+"/班级综合报告/"+synthesisClassReportParameter.getClassName()+"/"+fileName.replace("D:/myworkSpace/Class/Basic/","")); fileToUrl.put(fileName.replace("/myworkSpace/Class/Basic/",""),"/class/"+synthesisClassReportParameter.getExamId()+"/"+synthesisClassReportParameter.getProvince()+"/"+synthesisClassReportParameter.getSchool()+"/班级综合报告/"+synthesisClassReportParameter.getClassName()+"/"+fileName.replace("/myworkSpace/Class/Basic/",""));
synthesisClassReportParameter.setCommand(command); synthesisClassReportParameter.setCommand(command);
synthesisClassReportParameter.setPrefix("D:/myworkSpace/Class/Basic/"); synthesisClassReportParameter.setPrefix("/myworkSpace/Class/Basic/");
} }
} }
...@@ -277,7 +272,7 @@ public class GeneratorAllTypePdfByProvinceController { ...@@ -277,7 +272,7 @@ public class GeneratorAllTypePdfByProvinceController {
logger.info("basicReport:loading"); logger.info("basicReport:loading");
logger.info("exitCode:"+schoolLevel.getSchool()); logger.info("exitCode:"+schoolLevel.getSchool());
ProcessBuilder processBuilder = new ProcessBuilder(); ProcessBuilder processBuilder = new ProcessBuilder();
processBuilder.command("cmd.exe", "/c", schoolLevel.getCommand()); processBuilder.command("bash", "-c", schoolLevel.getCommand());
processBuilder.redirectErrorStream(true); // 合并标准输出和错误输出 processBuilder.redirectErrorStream(true); // 合并标准输出和错误输出
Process process = null; Process process = null;
try { try {
...@@ -287,51 +282,51 @@ public class GeneratorAllTypePdfByProvinceController { ...@@ -287,51 +282,51 @@ public class GeneratorAllTypePdfByProvinceController {
} }
BufferedReader reader = new BufferedReader(new InputStreamReader(process.getInputStream())); BufferedReader reader = new BufferedReader(new InputStreamReader(process.getInputStream()));
String line; String line;
// while (true) { while (true) {
// try { try {
// if (!((line = reader.readLine()) != null)) break; if (!((line = reader.readLine()) != null)) break;
// } catch (IOException e) { } catch (IOException e) {
// throw new RuntimeException(e); throw new RuntimeException(e);
// } }
// }
while ((line = reader.readLine()) != null) {
// 如果输出了 "DONE",表示生成完毕
if ("DONE".equals(line)) {
break; // 跳出循环
}
} }
// while ((line = reader.readLine()) != null) {
// // 如果输出了 "DONE",表示生成完毕
// if ("DONE".equals(line)) {
// break; // 跳出循环
// }
// }
try { try {
int exitCode = process.waitFor(); int exitCode = process.waitFor();
} catch (InterruptedException e) { } catch (InterruptedException e) {
throw new RuntimeException(e); throw new RuntimeException(e);
} }
//上传文件 //上传文件
File basicFile = new File("D:/myworkSpace/basic/"); // File basicFile = new File("/myworkSpace/basic/");
File[] basicFiles = basicFile.listFiles(); // File[] basicFiles = basicFile.listFiles();
assert basicFiles != null; // assert basicFiles != null;
for (File file : basicFiles) { // for (File file : basicFiles) {
PutObjectRequest putObjectRequest = new PutObjectRequest(bucketName, fileToUrl.get(file.getName()), file); // PutObjectRequest putObjectRequest = new PutObjectRequest(bucketName, fileToUrl.get(file.getName()), file);
try { // try {
PutObjectResult putObjectResult = cosClient.putObject(putObjectRequest); // PutObjectResult putObjectResult = cosClient.putObject(putObjectRequest);
logger.info(putObjectResult.getRequestId()); // logger.info(putObjectResult.getRequestId());
file.delete(); // file.delete();
} catch (CosServiceException e) { // } catch (CosServiceException e) {
logger.info("cos服务出现问题"); // logger.info("cos服务出现问题");
e.printStackTrace(); // e.printStackTrace();
} catch (CosClientException e) { // } catch (CosClientException e) {
logger.info("cos客户端出现问题"+file.getName()+"文件上传有误,重新上传"); // logger.info("cos客户端出现问题"+file.getName()+"文件上传有误,重新上传");
RetryCommand retryCommand = new RetryCommand(); // RetryCommand retryCommand = new RetryCommand();
retryCommand.setRetryCommand(schoolLevel.getCommand()); // retryCommand.setRetryCommand(schoolLevel.getCommand());
retryCommand.setParams(schoolLevel); // retryCommand.setParams(schoolLevel);
retryCommands.add(retryCommand); // retryCommands.add(retryCommand);
e.printStackTrace(); // e.printStackTrace();
} // }
} // }
for (BasicReportParameters parameters : schoolSelf) { for (BasicReportParameters parameters : schoolSelf) {
logger.info("subjectReport:loading"); logger.info("subjectReport:loading");
logger.info("exitCode:"+parameters.getSubSubject()); logger.info("exitCode:"+parameters.getSubSubject());
ProcessBuilder processBuilderSubject = new ProcessBuilder(); ProcessBuilder processBuilderSubject = new ProcessBuilder();
processBuilderSubject.command("cmd.exe", "/c", parameters.getCommand()); processBuilderSubject.command("bash", "-c", parameters.getCommand());
processBuilderSubject.redirectErrorStream(true); // 合并标准输出和错误输出 processBuilderSubject.redirectErrorStream(true); // 合并标准输出和错误输出
Process processSubject = null; Process processSubject = null;
try { try {
...@@ -341,45 +336,45 @@ public class GeneratorAllTypePdfByProvinceController { ...@@ -341,45 +336,45 @@ public class GeneratorAllTypePdfByProvinceController {
} }
BufferedReader readerSubject = new BufferedReader(new InputStreamReader(processSubject.getInputStream())); BufferedReader readerSubject = new BufferedReader(new InputStreamReader(processSubject.getInputStream()));
String lineSubject; String lineSubject;
// while (true) { while (true) {
// try { try {
// if (!((lineSubject = readerSubject.readLine()) != null)) break; if (!((lineSubject = readerSubject.readLine()) != null)) break;
// } catch (IOException e) { } catch (IOException e) {
// throw new RuntimeException(e); throw new RuntimeException(e);
// }
// }
while ((lineSubject = readerSubject.readLine()) != null) {
// 如果输出了 "DONE",表示生成完毕
if ("DONE".equals(lineSubject)) {
break; // 跳出循环
} }
} }
// while ((lineSubject = readerSubject.readLine()) != null) {
// // 如果输出了 "DONE",表示生成完毕
// if ("DONE".equals(lineSubject)) {
// break; // 跳出循环
// }
// }
try { try {
int exitCodeSubject = processSubject.waitFor(); int exitCodeSubject = processSubject.waitFor();
} catch (InterruptedException e) { } catch (InterruptedException e) {
throw new RuntimeException(e); throw new RuntimeException(e);
} }
File subjectFile = new File("D:/myworkSpace/subject/"); // File subjectFile = new File("/myworkSpace/subject/");
File[] subjectFiles = subjectFile.listFiles(); // File[] subjectFiles = subjectFile.listFiles();
assert subjectFiles != null; // assert subjectFiles != null;
for (File file : subjectFiles) { // for (File file : subjectFiles) {
PutObjectRequest putObjectRequest = new PutObjectRequest(bucketName, fileToUrl.get(file.getName()), file); // PutObjectRequest putObjectRequest = new PutObjectRequest(bucketName, fileToUrl.get(file.getName()), file);
try { // try {
PutObjectResult putObjectResult = cosClient.putObject(putObjectRequest); // PutObjectResult putObjectResult = cosClient.putObject(putObjectRequest);
logger.info(putObjectResult.getRequestId()); // logger.info(putObjectResult.getRequestId());
file.delete(); // file.delete();
} catch (CosServiceException e) { // } catch (CosServiceException e) {
logger.info("cos服务出现问题"); // logger.info("cos服务出现问题");
e.printStackTrace(); // e.printStackTrace();
} catch (CosClientException e) { // } catch (CosClientException e) {
logger.info("cos客户端出现问题"+file.getName()+"文件上传有误,重新上传"); // logger.info("cos客户端出现问题"+file.getName()+"文件上传有误,重新上传");
RetryCommand retryCommand = new RetryCommand(); // RetryCommand retryCommand = new RetryCommand();
retryCommand.setParams(parameters); // retryCommand.setParams(parameters);
retryCommand.setRetryCommand(parameters.getCommand()); // retryCommand.setRetryCommand(parameters.getCommand());
retryCommands.add(retryCommand); // retryCommands.add(retryCommand);
e.printStackTrace(); // e.printStackTrace();
} // }
} // }
} }
List<ClassBasicReportParameters> args = classBasic.get(schoolLevel.getSchool()); List<ClassBasicReportParameters> args = classBasic.get(schoolLevel.getSchool());
List<ClassBasicReportParameters> params = subjectClass.get(schoolLevel.getSchool()); List<ClassBasicReportParameters> params = subjectClass.get(schoolLevel.getSchool());
...@@ -387,7 +382,7 @@ public class GeneratorAllTypePdfByProvinceController { ...@@ -387,7 +382,7 @@ public class GeneratorAllTypePdfByProvinceController {
logger.info("classBasic:loading"); logger.info("classBasic:loading");
logger.info("exitCode:"+arg.getClassName()); logger.info("exitCode:"+arg.getClassName());
ProcessBuilder processBuilderClass = new ProcessBuilder(); ProcessBuilder processBuilderClass = new ProcessBuilder();
processBuilderClass.command("cmd.exe", "/c", arg.getCommand()); processBuilderClass.command("bash", "-c", arg.getCommand());
processBuilderClass.redirectErrorStream(true); // 合并标准输出和错误输出 processBuilderClass.redirectErrorStream(true); // 合并标准输出和错误输出
Process processClass = null; Process processClass = null;
try { try {
...@@ -397,52 +392,52 @@ public class GeneratorAllTypePdfByProvinceController { ...@@ -397,52 +392,52 @@ public class GeneratorAllTypePdfByProvinceController {
} }
BufferedReader readerClass = new BufferedReader(new InputStreamReader(processClass.getInputStream())); BufferedReader readerClass = new BufferedReader(new InputStreamReader(processClass.getInputStream()));
String lineClass; String lineClass;
// while (true) { while (true) {
// try { try {
// if (!((lineClass = readerClass.readLine()) != null)) break; if (!((lineClass = readerClass.readLine()) != null)) break;
// } catch (IOException e) { } catch (IOException e) {
// throw new RuntimeException(e); throw new RuntimeException(e);
// }
// }
while ((lineClass = readerClass.readLine()) != null) {
// 如果输出了 "DONE",表示生成完毕
if ("DONE".equals(lineClass)) {
break; // 跳出循环
} }
} }
// while ((lineClass = readerClass.readLine()) != null) {
// // 如果输出了 "DONE",表示生成完毕
// if ("DONE".equals(lineClass)) {
// break; // 跳出循环
// }
// }
try { try {
int exitCodeSubject = processClass.waitFor(); int exitCodeSubject = processClass.waitFor();
} catch (InterruptedException e) { } catch (InterruptedException e) {
throw new RuntimeException(e); throw new RuntimeException(e);
} }
File classBasicFile = new File("D:/myworkSpace/Class/Basic/"); // File classBasicFile = new File("/myworkSpace/Class/Basic/");
File[] classBasicFiles = classBasicFile.listFiles(); // File[] classBasicFiles = classBasicFile.listFiles();
assert classBasicFiles != null; // assert classBasicFiles != null;
for (File file : classBasicFiles) { // for (File file : classBasicFiles) {
PutObjectRequest putObjectRequest = new PutObjectRequest(bucketName, fileToUrl.get(file.getName()), file); // PutObjectRequest putObjectRequest = new PutObjectRequest(bucketName, fileToUrl.get(file.getName()), file);
try { // try {
PutObjectResult putObjectResult = cosClient.putObject(putObjectRequest); // PutObjectResult putObjectResult = cosClient.putObject(putObjectRequest);
logger.info(putObjectResult.getRequestId()); // logger.info(putObjectResult.getRequestId());
file.delete(); // file.delete();
} catch (CosServiceException e) { // } catch (CosServiceException e) {
logger.info("cos服务出现问题"); // logger.info("cos服务出现问题");
e.printStackTrace(); // e.printStackTrace();
} catch (CosClientException e) { // } catch (CosClientException e) {
logger.info("cos客户端出现问题"+file.getName()+"文件上传有误,重新上传"); // logger.info("cos客户端出现问题"+file.getName()+"文件上传有误,重新上传");
RetryCommand retryCommand = new RetryCommand(); // RetryCommand retryCommand = new RetryCommand();
retryCommand.setParams(arg); // retryCommand.setParams(arg);
retryCommand.setRetryCommand(arg.getCommand()); // retryCommand.setRetryCommand(arg.getCommand());
retryCommands.add(retryCommand); // retryCommands.add(retryCommand);
e.printStackTrace(); // e.printStackTrace();
} // }
} // }
final Map<String, List<ClassBasicReportParameters>> collect = params.stream().collect(Collectors.groupingBy(ClassBasicReportParameters::getClassName)); final Map<String, List<ClassBasicReportParameters>> collect = params.stream().collect(Collectors.groupingBy(ClassBasicReportParameters::getClassName));
List<ClassBasicReportParameters> list = collect.get(arg.getClassName()); List<ClassBasicReportParameters> list = collect.get(arg.getClassName());
for (ClassBasicReportParameters classBasicReportParameters : list) { for (ClassBasicReportParameters classBasicReportParameters : list) {
logger.info("classSubject:loading"); logger.info("classSubject:loading");
logger.info("exitCode:"+classBasicReportParameters.getSubSubject()); logger.info("exitCode:"+classBasicReportParameters.getSubSubject());
ProcessBuilder processBuilderClassSubject = new ProcessBuilder(); ProcessBuilder processBuilderClassSubject = new ProcessBuilder();
processBuilderClassSubject.command("cmd.exe", "/c", classBasicReportParameters.getCommand()); processBuilderClassSubject.command("bash", "-c", classBasicReportParameters.getCommand());
processBuilderClassSubject.redirectErrorStream(true); // 合并标准输出和错误输出 processBuilderClassSubject.redirectErrorStream(true); // 合并标准输出和错误输出
Process processClassSubject = null; Process processClassSubject = null;
try { try {
...@@ -452,46 +447,46 @@ public class GeneratorAllTypePdfByProvinceController { ...@@ -452,46 +447,46 @@ public class GeneratorAllTypePdfByProvinceController {
} }
BufferedReader readerClassSubject = new BufferedReader(new InputStreamReader(processClassSubject.getInputStream())); BufferedReader readerClassSubject = new BufferedReader(new InputStreamReader(processClassSubject.getInputStream()));
String lineClassSubject; String lineClassSubject;
// while (true) { while (true) {
// try { try {
// if (!((lineClassSubject = readerClassSubject.readLine()) != null)) break; if (!((lineClassSubject = readerClassSubject.readLine()) != null)) break;
// } catch (IOException e) { } catch (IOException e) {
// throw new RuntimeException(e); throw new RuntimeException(e);
// }
// }
while ((lineClassSubject = readerClassSubject.readLine()) != null) {
// 如果输出了 "DONE",表示生成完毕
if ("DONE".equals(lineClassSubject)) {
break; // 跳出循环
} }
} }
// while ((lineClassSubject = readerClassSubject.readLine()) != null) {
// // 如果输出了 "DONE",表示生成完毕
// if ("DONE".equals(lineClassSubject)) {
// break; // 跳出循环
// }
// }
try { try {
int exitCodeSubjectClass = processClassSubject.waitFor(); int exitCodeSubjectClass = processClassSubject.waitFor();
} catch (InterruptedException e) { } catch (InterruptedException e) {
throw new RuntimeException(e); throw new RuntimeException(e);
} }
File classSubjectFile = new File("D:/myworkSpace/Class/subject/"); // File classSubjectFile = new File("/myworkSpace/Class/subject/");
File[] classSubjectFiles = classSubjectFile.listFiles(); // File[] classSubjectFiles = classSubjectFile.listFiles();
assert classSubjectFiles != null; // assert classSubjectFiles != null;
for (File file : classSubjectFiles) { // for (File file : classSubjectFiles) {
logger.info(file.getName()+"=file—>key="+fileToUrl.get(file.getName())); // logger.info(file.getName()+"=file—>key="+fileToUrl.get(file.getName()));
PutObjectRequest putObjectRequest = new PutObjectRequest(bucketName, fileToUrl.get(file.getName()), file); // PutObjectRequest putObjectRequest = new PutObjectRequest(bucketName, fileToUrl.get(file.getName()), file);
try { // try {
PutObjectResult putObjectResult = cosClient.putObject(putObjectRequest); // PutObjectResult putObjectResult = cosClient.putObject(putObjectRequest);
logger.info(putObjectResult.getRequestId()); // logger.info(putObjectResult.getRequestId());
file.delete(); // file.delete();
} catch (CosServiceException e) { // } catch (CosServiceException e) {
logger.info("cos服务出现问题"); // logger.info("cos服务出现问题");
e.printStackTrace(); // e.printStackTrace();
} catch (CosClientException e) { // } catch (CosClientException e) {
logger.info("cos客户端出现问题"+file.getName()+"文件上传有误,重新上传"); // logger.info("cos客户端出现问题"+file.getName()+"文件上传有误,重新上传");
RetryCommand retryCommand = new RetryCommand(); // RetryCommand retryCommand = new RetryCommand();
retryCommand.setParams(classBasicReportParameters); // retryCommand.setParams(classBasicReportParameters);
retryCommand.setRetryCommand(classBasicReportParameters.getCommand()); // retryCommand.setRetryCommand(classBasicReportParameters.getCommand());
retryCommands.add(retryCommand); // retryCommands.add(retryCommand);
e.printStackTrace(); // e.printStackTrace();
} // }
} // }
} }
} }
...@@ -512,7 +507,7 @@ public class GeneratorAllTypePdfByProvinceController { ...@@ -512,7 +507,7 @@ public class GeneratorAllTypePdfByProvinceController {
logger.info("RetryCommand:ls"); logger.info("RetryCommand:ls");
ProcessBuilder processBuilderClassSubject = new ProcessBuilder(); ProcessBuilder processBuilderClassSubject = new ProcessBuilder();
processBuilderClassSubject.command("cmd.exe", "/c", command); processBuilderClassSubject.command("bash", "-c", command);
processBuilderClassSubject.redirectErrorStream(true); // 合并标准输出和错误输出 processBuilderClassSubject.redirectErrorStream(true); // 合并标准输出和错误输出
Process processClassSubject = null; Process processClassSubject = null;
try { try {
...@@ -522,41 +517,41 @@ public class GeneratorAllTypePdfByProvinceController { ...@@ -522,41 +517,41 @@ public class GeneratorAllTypePdfByProvinceController {
} }
BufferedReader readerClassSubject = new BufferedReader(new InputStreamReader(processClassSubject.getInputStream())); BufferedReader readerClassSubject = new BufferedReader(new InputStreamReader(processClassSubject.getInputStream()));
String lineClassSubject; String lineClassSubject;
// while (true) { while (true) {
// try { try {
// if (!((lineClassSubject = readerClassSubject.readLine()) != null)) break; if (!((lineClassSubject = readerClassSubject.readLine()) != null)) break;
// } catch (IOException e) { } catch (IOException e) {
// throw new RuntimeException(e); throw new RuntimeException(e);
// }
// }
while ((lineClassSubject = readerClassSubject.readLine()) != null) {
// 如果输出了 "DONE",表示生成完毕
if ("DONE".equals(lineClassSubject)) {
break; // 跳出循环
} }
} }
// while ((lineClassSubject = readerClassSubject.readLine()) != null) {
// // 如果输出了 "DONE",表示生成完毕
// if ("DONE".equals(lineClassSubject)) {
// break; // 跳出循环
// }
// }
try { try {
int exitCodeSubjectClass = processClassSubject.waitFor(); int exitCodeSubjectClass = processClassSubject.waitFor();
} catch (InterruptedException e) { } catch (InterruptedException e) {
throw new RuntimeException(e); throw new RuntimeException(e);
} }
File classSubjectFile = new File(filePrefix); // File classSubjectFile = new File(filePrefix);
File[] classSubjectFiles = classSubjectFile.listFiles(); // File[] classSubjectFiles = classSubjectFile.listFiles();
assert classSubjectFiles != null; // assert classSubjectFiles != null;
for (File file : classSubjectFiles) { // for (File file : classSubjectFiles) {
logger.info(file.getName()+"=file—>key="+fileToUrl.get(file.getName())); // logger.info(file.getName()+"=file—>key="+fileToUrl.get(file.getName()));
PutObjectRequest putObjectRequest = new PutObjectRequest(bucketName, fileToUrl.get(file.getName()), file); // PutObjectRequest putObjectRequest = new PutObjectRequest(bucketName, fileToUrl.get(file.getName()), file);
try { // try {
PutObjectResult putObjectResult = cosClient.putObject(putObjectRequest); // PutObjectResult putObjectResult = cosClient.putObject(putObjectRequest);
logger.info(putObjectResult.getRequestId()); // logger.info(putObjectResult.getRequestId());
file.delete(); // file.delete();
} catch (CosServiceException e) { // } catch (CosServiceException e) {
logger.info("cos服务出现问题"); // logger.info("cos服务出现问题");
e.printStackTrace(); // e.printStackTrace();
} catch (CosClientException e) { // } catch (CosClientException e) {
logger.info("cos客户端出现问题"+file.getName()+"文件上传有误,重新上传"); // logger.info("cos客户端出现问题"+file.getName()+"文件上传有误,重新上传");
} // }
} // }
} }
......
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