Commit 22546f68 authored by ryzeycy's avatar ryzeycy

xx

parent f256d31b
......@@ -34,26 +34,26 @@ public class GeneratorAllTypePdfByProvinceController {
private static final String bucketName = "schoolreportpdf-1317275686";
private static Map<String,String> fileToUrl = new HashMap<>();
private static Map<String, String> fileToUrl = new HashMap<>();
JdbcTemplate reportJdbcTemplate = MyDataSourceConfig.getReportJdbcTemplate();
@RequestMapping("/GeneratorByProvinceName")
public ResponseEntity generatorName(@RequestParam("examId")String examId, @RequestParam(value = "provinceName",required = false)String provinceName,@RequestParam(value = "schoolName",required = false)String schoolName) throws IOException, InterruptedException {
public ResponseEntity generatorName(@RequestParam("examId") String examId, @RequestParam(value = "provinceName", required = false) String provinceName, @RequestParam(value = "schoolName", required = false) String schoolName) throws IOException, InterruptedException {
String suffix = examId.trim().replace("TDA","").replace("G3","").replace("G2","").replace("G10","").replace("G11","").replace("G12","").trim();
String suffix = examId.trim().replace("TDA", "").replace("G3", "").replace("G2", "").replace("G10", "").replace("G11", "").replace("G12", "").trim();
String synthesisSchoolSubjectReportSql = "select \n" +
String synthesisSchoolSubjectReportSql = "select \n" +
"school,exam_id,province,region1 as region,sub_subject\n" +
"from \n" +
"base_school_subject_tda"+suffix+" \n" +
" where subject_type = '常规' \n";
"base_school_subject_tda" + suffix + " \n" +
" where subject_type = '常规' \n";
String synthesisSchoolReportSql = "select \n" +
String synthesisSchoolReportSql = "select \n" +
"school,exam_id,province,region1 as region\n" +
"from \n" +
"base_school_subject_tda"+suffix+" where subject_type = '常规' \n";
"base_school_subject_tda" + suffix + " where subject_type = '常规' \n";
String synthesisClassSubjectReportSql = "SELECT\n" +
"\tclass as class_name,\n" +
......@@ -63,9 +63,9 @@ public class GeneratorAllTypePdfByProvinceController {
"\tregion1 as region,\n" +
"\texam_id\n" +
"FROM\n" +
"\tbase_student_subject_tda"+suffix+"\n" +
"\tbase_student_subject_tda" + suffix + "\n" +
"where\n" +
"subject_type = '常规' \n " ;
"subject_type = '常规' \n ";
String synthesisClassReportSql = "SELECT\n" +
"\tclass AS class_name,\n" +
......@@ -74,43 +74,43 @@ public class GeneratorAllTypePdfByProvinceController {
"\tprovince,\n" +
"\tregion1 as region \n" +
"FROM\n" +
"\tbase_class_subject_tda"+suffix+"\n" +
"\tbase_class_subject_tda" + suffix + "\n" +
"WHERE\n" +
"\tsubject_type = '常规'\n" ;
"\tsubject_type = '常规'\n";
if(provinceName!=null){
if (provinceName != null) {
List<String> provinceList = Arrays.asList(provinceName.split("#"));
String appendStatement = " and province in (" ;
String appendStatement = " and province in (";
for (String s : provinceList) {
appendStatement = appendStatement +"'"+s+"',";
appendStatement = appendStatement + "'" + s + "',";
}
appendStatement = appendStatement.substring(0,appendStatement.length()-1)+") ";
appendStatement = appendStatement.substring(0, appendStatement.length() - 1) + ") ";
synthesisSchoolSubjectReportSql = synthesisSchoolSubjectReportSql + " " + appendStatement;
synthesisSchoolReportSql = synthesisSchoolReportSql + " " + appendStatement ;
synthesisSchoolReportSql = synthesisSchoolReportSql + " " + appendStatement;
synthesisClassSubjectReportSql = synthesisClassSubjectReportSql + " " + appendStatement;
synthesisClassReportSql = synthesisClassReportSql + " " + appendStatement;
}
if(schoolName!=null){
if (schoolName != null) {
List<String> schoolList = Arrays.asList(schoolName.split("#"));
String appendStatement = " and school in (" ;
String appendStatement = " and school in (";
for (String s : schoolList) {
appendStatement = appendStatement +"'"+s+"',";
appendStatement = appendStatement + "'" + s + "',";
}
appendStatement = appendStatement.substring(0,appendStatement.length()-1)+") ";
appendStatement = appendStatement.substring(0, appendStatement.length() - 1) + ") ";
synthesisSchoolSubjectReportSql = synthesisSchoolSubjectReportSql + " " + appendStatement;
synthesisSchoolReportSql = synthesisSchoolReportSql + " " + appendStatement ;
synthesisSchoolReportSql = synthesisSchoolReportSql + " " + appendStatement;
synthesisClassSubjectReportSql = synthesisClassSubjectReportSql + " " + appendStatement;
synthesisClassReportSql = synthesisClassReportSql + " " + appendStatement;
......@@ -120,7 +120,7 @@ public class GeneratorAllTypePdfByProvinceController {
synthesisSchoolReportSql = synthesisSchoolReportSql + " " + " group by school,exam_id,province,region1";
synthesisClassSubjectReportSql = synthesisClassSubjectReportSql + " " + "\tGROUP BY\n" +"\tclass,\n" + "\tsub_subject,\n" + "\tschool,\n" + "\tprovince,\n" + "\tregion1,\n" + "\texam_id";
synthesisClassSubjectReportSql = synthesisClassSubjectReportSql + " " + "\tGROUP BY\n" + "\tclass,\n" + "\tsub_subject,\n" + "\tschool,\n" + "\tprovince,\n" + "\tregion1,\n" + "\texam_id";
synthesisClassReportSql = synthesisClassReportSql + " " + " GROUP BY\n" + "\tclass,\n" + "\tschool,\n" + "\texam_id,\n" + "\tprovince,\n" + "\tregion1\n";
......@@ -139,96 +139,87 @@ public class GeneratorAllTypePdfByProvinceController {
List<BasicReportParameters> synthesisSchoolSubjectReportParameters = this.reportJdbcTemplate.query(synthesisSchoolSubjectReportSql, new Object[]{}, new BeanPropertyRowMapper<>(BasicReportParameters.class));
for (BasicReportParameters parameter : synthesisSchoolSubjectReportParameters) {
if (!parameter.getSubSubject().contains("物理") || !parameter.getSubSubject().contains("生物")){
continue;
}
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 /myworkSpace/puppeteer2.js \"http://schoolreport.cssat.cn/pdf/subject?province=condition5&school=condition1&examId=condition4&region=conditionC&subSubject=condition6&subjectType=常规\" 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())
.concat(" ").concat(fileName);
parameter.setCommand(command);
parameter.setPrefix("/myworkSpace/subject/");
fileToUrl.put(fileName.replace("/myworkSpace/subject/",""),"PdfSubject/"+fileName.replace("/myworkSpace/subject/",""));
fileToUrl.put(fileName.replace("/myworkSpace/subject/", ""), "PdfSubject/" + fileName.replace("/myworkSpace/subject/", ""));
}else{
} else {
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 = "/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())
.concat(" ").concat(fileName);
parameter.setCommand(command);
parameter.setPrefix("/myworkSpace/subject/");
fileToUrl.put(fileName.replace("/myworkSpace/subject/",""),"PdfSubject/"+fileName.replace("/myworkSpace/subject/",""));
fileToUrl.put(fileName.replace("/myworkSpace/subject/", ""), "PdfSubject/" + fileName.replace("/myworkSpace/subject/", ""));
}
}
List<BasicReportParameters> synthesisSchoolReportParameters = this.reportJdbcTemplate.query(synthesisSchoolReportSql, new Object[]{}, new BeanPropertyRowMapper<>(BasicReportParameters.class));
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 /myworkSpace/puppeteer.js \"http://schoolreport.cssat.cn/pdf/basic?province=condition5&school=condition1&examId=condition4&region=conditionC&subjectType=常规\" 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())
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())
.concat(" ").concat(fileName);
synthesisSchoolReportParameter.setCommand(command);
synthesisSchoolReportParameter.setPrefix("/myworkSpace/basic/");
fileToUrl.put(fileName.replace("/myworkSpace/basic/",""),"PdfDir/"+fileName.replace("/myworkSpace/basic/",""));
}else{
fileToUrl.put(fileName.replace("/myworkSpace/basic/", ""), "PdfDir/" + fileName.replace("/myworkSpace/basic/", ""));
} else {
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 = "/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())
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())
.concat(" ").concat(fileName);
synthesisSchoolReportParameter.setCommand(command);
synthesisSchoolReportParameter.setPrefix("/myworkSpace/basic/");
fileToUrl.put(fileName.replace("/myworkSpace/basic/",""),"PdfDir/"+fileName.replace("/myworkSpace/basic/",""));
fileToUrl.put(fileName.replace("/myworkSpace/basic/", ""), "PdfDir/" + fileName.replace("/myworkSpace/basic/", ""));
}
}
List<ClassBasicReportParameters> synthesisClassSubjectReportParameters = this.reportJdbcTemplate.query(synthesisClassSubjectReportSql,new Object[]{},new BeanPropertyRowMapper<>(ClassBasicReportParameters.class));
List<ClassBasicReportParameters> synthesisClassSubjectReportParameters = this.reportJdbcTemplate.query(synthesisClassSubjectReportSql, new Object[]{}, new BeanPropertyRowMapper<>(ClassBasicReportParameters.class));
for (ClassBasicReportParameters synthesisClassSubjectReportParameter : synthesisClassSubjectReportParameters) {
if (!synthesisClassSubjectReportParameter.getSubSubject().contains("物理") || !synthesisClassSubjectReportParameter.getSubSubject().contains("生物")){
continue;
}
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 /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 = "/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())
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())
.concat(" ").concat(fileName);
fileToUrl.put(fileName.replace("/myworkSpace/Class/subject/",""),"/class/"+synthesisClassSubjectReportParameter.getExamId()+"/"+synthesisClassSubjectReportParameter.getProvince()+"/"+synthesisClassSubjectReportParameter.getSchool()+"/班级学科报告/"+synthesisClassSubjectReportParameter.getClassName()+"/"+synthesisClassSubjectReportParameter.getSubSubject()+"/"+fileName.replace("/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.setPrefix("/myworkSpace/Class/subject/");
} else {
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 = "/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())
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())
.concat(" ").concat(fileName);
fileToUrl.put(fileName.replace("/myworkSpace/Class/subject/",""),"/class/"+synthesisClassSubjectReportParameter.getExamId()+"/"+synthesisClassSubjectReportParameter.getProvince()+"/"+synthesisClassSubjectReportParameter.getSchool()+"/班级学科报告/"+synthesisClassSubjectReportParameter.getClassName()+"/"+synthesisClassSubjectReportParameter.getSubSubject()+"/"+fileName.replace("/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.setPrefix("/myworkSpace/Class/subject/");
}
}
List<ClassBasicReportParameters> synthesisClassReportParameters = this.reportJdbcTemplate.query(synthesisClassReportSql,new Object[]{},new BeanPropertyRowMapper<>(ClassBasicReportParameters.class));
List<ClassBasicReportParameters> synthesisClassReportParameters = this.reportJdbcTemplate.query(synthesisClassReportSql, new Object[]{}, new BeanPropertyRowMapper<>(ClassBasicReportParameters.class));
for (ClassBasicReportParameters synthesisClassReportParameter : synthesisClassReportParameters) {
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 /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 = "/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);
fileToUrl.put(fileName.replace("/myworkSpace/Class/Basic/",""),"/class/"+synthesisClassReportParameter.getExamId()+"/"+synthesisClassReportParameter.getProvince()+"/"+synthesisClassReportParameter.getSchool()+"/班级综合报告/"+synthesisClassReportParameter.getClassName()+"/"+fileName.replace("/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);
......@@ -238,12 +229,12 @@ public class GeneratorAllTypePdfByProvinceController {
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 = "/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);
fileToUrl.put(fileName.replace("/myworkSpace/Class/Basic/",""),"/class/"+synthesisClassReportParameter.getExamId()+"/"+synthesisClassReportParameter.getProvince()+"/"+synthesisClassReportParameter.getSchool()+"/班级综合报告/"+synthesisClassReportParameter.getClassName()+"/"+fileName.replace("/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);
......@@ -256,30 +247,30 @@ public class GeneratorAllTypePdfByProvinceController {
// System.out.println("file="+s+"==mapto=="+"key="+fileToUrl.get(s));
// }
Map<String, List<BasicReportParameters>> schoolReport = synthesisSchoolReportParameters.stream().collect(Collectors.groupingBy(BasicReportParameters::getProvince));
Map<String, List<BasicReportParameters>> schoolReport = synthesisSchoolReportParameters.stream().collect(Collectors.groupingBy(BasicReportParameters::getProvince));
Map<String, List<BasicReportParameters>> schoolSubjectReport = synthesisSchoolSubjectReportParameters.stream().collect(Collectors.groupingBy(BasicReportParameters::getProvince));
Map<String, List<BasicReportParameters>> schoolSubjectReport = synthesisSchoolSubjectReportParameters.stream().collect(Collectors.groupingBy(BasicReportParameters::getProvince));
Map<String, List<ClassBasicReportParameters>> classReport = synthesisClassReportParameters.stream().collect(Collectors.groupingBy(ClassBasicReportParameters::getProvince));
Map<String, List<ClassBasicReportParameters>> classReport = synthesisClassReportParameters.stream().collect(Collectors.groupingBy(ClassBasicReportParameters::getProvince));
Map<String, List<ClassBasicReportParameters>> classSubjectReport = synthesisClassSubjectReportParameters.stream().collect(Collectors.groupingBy(ClassBasicReportParameters::getProvince));
Map<String, List<ClassBasicReportParameters>> classSubjectReport = synthesisClassSubjectReportParameters.stream().collect(Collectors.groupingBy(ClassBasicReportParameters::getProvince));
// 分组开始执行记录
for (String key : schoolReport.keySet()) {
logger.info("province:"+key+ "Gen");
List<BasicReportParameters> schoolBasicReport = schoolReport.get(key);
List<BasicReportParameters> schoolSubject = schoolSubjectReport.get(key);
logger.info("province:" + key + "Gen");
List<BasicReportParameters> schoolBasicReport = schoolReport.get(key);
List<BasicReportParameters> schoolSubject = schoolSubjectReport.get(key);
List<ClassBasicReportParameters> classBasicReport = classReport.get(key);
List<ClassBasicReportParameters> classSubject = classSubjectReport.get(key);
for (BasicReportParameters schoolLevel : schoolBasicReport) {
List<RetryCommand> retryCommands = new ArrayList<>();
logger.info("school:"+schoolLevel.getSchool()+"loading");
Map<String, List<BasicReportParameters>> schoolMap= schoolSubject.stream().collect(Collectors.groupingBy(BasicReportParameters::getSchool));
List<RetryCommand> retryCommands = new ArrayList<>();
logger.info("school:" + schoolLevel.getSchool() + "loading");
Map<String, List<BasicReportParameters>> schoolMap = schoolSubject.stream().collect(Collectors.groupingBy(BasicReportParameters::getSchool));
Map<String, List<ClassBasicReportParameters>> classBasic = classBasicReport.stream().collect(Collectors.groupingBy(ClassBasicReportParameters::getSchool));
final Map<String, List<ClassBasicReportParameters>> subjectClass = classSubject.stream().collect(Collectors.groupingBy(ClassBasicReportParameters::getSchool));
List<BasicReportParameters> schoolSelf = schoolMap.get(schoolLevel.getSchool());
List<BasicReportParameters> schoolSelf = schoolMap.get(schoolLevel.getSchool());
logger.info("basicReport:loading");
logger.info("exitCode:"+schoolLevel.getSchool());
logger.info("exitCode:" + schoolLevel.getSchool());
// ProcessBuilder processBuilder = new ProcessBuilder();
// processBuilder.command("bash", "-c", schoolLevel.getCommand());
// processBuilder.redirectErrorStream(true); // 合并标准输出和错误输出
......@@ -333,7 +324,12 @@ public class GeneratorAllTypePdfByProvinceController {
// }
for (BasicReportParameters parameters : schoolSelf) {
logger.info("subjectReport:loading");
logger.info("exitCode:"+parameters.getSubSubject());
String subSubject = parameters.getSubSubject();
if (!subSubject.equals("物理") || !subSubject.equals("历史")) {
continue;
}
logger.info("exitCode:" + parameters.getSubSubject());
ProcessBuilder processBuilderSubject = new ProcessBuilder();
processBuilderSubject.command("bash", "-c", parameters.getCommand());
processBuilderSubject.redirectErrorStream(true); // 合并标准输出和错误输出
......@@ -389,7 +385,7 @@ public class GeneratorAllTypePdfByProvinceController {
List<ClassBasicReportParameters> params = subjectClass.get(schoolLevel.getSchool());
for (ClassBasicReportParameters arg : args) {
logger.info("classBasic:loading");
logger.info("exitCode:"+arg.getClassName());
logger.info("exitCode:" + arg.getClassName());
// ProcessBuilder processBuilderClass = new ProcessBuilder();
// processBuilderClass.command("bash", "-c", arg.getCommand());
// processBuilderClass.redirectErrorStream(true); // 合并标准输出和错误输出
......@@ -443,8 +439,13 @@ public class GeneratorAllTypePdfByProvinceController {
final Map<String, List<ClassBasicReportParameters>> collect = params.stream().collect(Collectors.groupingBy(ClassBasicReportParameters::getClassName));
List<ClassBasicReportParameters> list = collect.get(arg.getClassName());
for (ClassBasicReportParameters classBasicReportParameters : list) {
String subSubject = classBasicReportParameters.getSubSubject();
if (!subSubject.equals("物理") || !subSubject.equals("历史")) {
continue;
}
logger.info("classSubject:loading");
logger.info("exitCode:"+classBasicReportParameters.getSubSubject());
logger.info("exitCode:" + classBasicReportParameters.getSubSubject());
ProcessBuilder processBuilderClassSubject = new ProcessBuilder();
processBuilderClassSubject.command("bash", "-c", classBasicReportParameters.getCommand());
processBuilderClassSubject.redirectErrorStream(true); // 合并标准输出和错误输出
......@@ -499,19 +500,19 @@ public class GeneratorAllTypePdfByProvinceController {
}
}
if(retryCommands.size()!=0){
logger.info("size"+retryCommands.size());
if (retryCommands.size() != 0) {
logger.info("size" + retryCommands.size());
for (RetryCommand retryCommand : retryCommands) {
String command = retryCommand.getRetryCommand();
Object arguments = retryCommand.getParams();
String filePrefix = "";
if ( arguments instanceof BasicReportParameters){
BasicReportParameters parametersOne = (BasicReportParameters) arguments;
filePrefix = parametersOne.getPrefix();
if (arguments instanceof BasicReportParameters) {
BasicReportParameters parametersOne = (BasicReportParameters) arguments;
filePrefix = parametersOne.getPrefix();
}
if (arguments instanceof ClassBasicReportParameters) {
ClassBasicReportParameters parametersTwo = (ClassBasicReportParameters) arguments;
filePrefix = parametersTwo.getPrefix();
filePrefix = parametersTwo.getPrefix();
}
logger.info("RetryCommand:ls");
......@@ -567,7 +568,7 @@ public class GeneratorAllTypePdfByProvinceController {
}
//插入数据
int rowsAffected = reportJdbcTemplate.update("UPDATE school_report_task_generate SET status = ? WHERE exam_id = ? AND region = ? AND province = ? AND school = ?",1,schoolLevel.getExamId(),schoolLevel.getRegion(),schoolLevel.getProvince(),schoolLevel.getSchool());
int rowsAffected = reportJdbcTemplate.update("UPDATE school_report_task_generate SET status = ? WHERE exam_id = ? AND region = ? AND province = ? AND school = ?", 1, schoolLevel.getExamId(), schoolLevel.getRegion(), schoolLevel.getProvince(), schoolLevel.getSchool());
logger.info("Rows affected:" + rowsAffected);
}
......
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