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

多线程测试生成PDF

parent 13b84537
......@@ -50,38 +50,38 @@ public class GeneratorAllTypePdfByProvinceController {
String suffix = examId.trim().replace("TDA","").replace("G3","").replace("G2","").trim();
String synthesisSchoolSubjectReportSql = "select \n" +
"school,exam_id,province,region,sub_subject\n" +
"school,exam_id,province,region1,sub_subject\n" +
"from \n" +
"base_school_subject_tda"+suffix+" \n" +
" where subject_type = '常规'\n";
" where subject_type = '常规' group by school,exam_id,province,region1,sub_subject \n";
String synthesisSchoolReportSql = "select \n" +
"school,exam_id,province,region\n" +
"school,exam_id,province,region1\n" +
"from \n" +
"base_school_total_score_tda"+suffix+" where subject_type = '常规'\n";
"base_school_subject_tda"+suffix+" where subject_type = '常规' group by school,exam_id,province,region1\n";
String synthesisClassSubjectReportSql = "SELECT\n" +
"\tclass as class_name,\n" +
"\tsub_subject,\n" +
"\tschool,\n" +
"\tprovince,\n" +
"\tregion,\n" +
"\tregion1 as region,\n" +
"\texam_id\n" +
"FROM\n" +
"\tbase_student_subject_tda"+suffix+"\n" +
"where\n" +
"subject_type = '常规'\n" ;
"subject_type = '常规' group by class,sub_subject,school,province,region1,exam_id \n " ;
String synthesisClassReportSql = "SELECT\n" +
"\tclass AS class_name,\n" +
"\tschool,\n" +
"\texam_id,\n" +
"\tprovince,\n" +
"\tregion \n" +
"\tregion1 as region \n" +
"FROM\n" +
"\tbase_class_total_score_tda"+suffix+"\n" +
"WHERE\n" +
"\tsubject_type = '常规'\n" ;
"\tsubject_type = '常规' group by class,school,province,region1,exam_id\n" ;
if(provinceName!=null){
......@@ -117,8 +117,8 @@ public class GeneratorAllTypePdfByProvinceController {
List<BasicReportParameters> synthesisSchoolSubjectReportParameters = this.reportJdbcTemplate.query(synthesisSchoolSubjectReportSql, new Object[]{}, new BeanPropertyRowMapper<>(BasicReportParameters.class));
for (BasicReportParameters parameter : synthesisSchoolSubjectReportParameters) {
if(parameter.getRegion().equals("改革")||parameter.getRegion().equals("改革A")){
String command = "node /myworkSpace/puppeteer2.js \"http://localhost:8080/pdf/subject?province=condition5&school=condition1&examId=condition4&region=conditionC&subSubject=condition6&subjectType=常规\" pdf";
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 \"https://schoolreport.cssatest.com/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);
......@@ -127,7 +127,7 @@ public class GeneratorAllTypePdfByProvinceController {
fileToUrl.put(fileName.replace("/myworkSpace/subject/",""),"PdfSubjectTest/"+fileName.replace("/myworkSpace/subject/",""));
}else{
String command = "node /myworkSpace/puppeteer2.js \"http://localhost:8080/pdf/subject?province=condition5&school=condition1&examId=condition4&region=非改革&branch=condition3&subSubject=condition6&subjectType=常规\" pdf";
String command = "node /myworkSpace/puppeteer2.js \"https://schoolreport.cssatest.com/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);
......@@ -140,8 +140,8 @@ public class GeneratorAllTypePdfByProvinceController {
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")){
String command = "node /myworkSpace/puppeteer.js \"http://localhost:8080/pdf/basic?province=condition5&school=condition1&examId=condition4&region=conditionC&subjectType=常规\" pdf ";
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 \"https://schoolreport.cssatest.com/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())
.concat(" ").concat(fileName);
......@@ -149,7 +149,7 @@ public class GeneratorAllTypePdfByProvinceController {
synthesisSchoolReportParameter.setPrefix("/myworkSpace/basic/");
fileToUrl.put(fileName.replace("/myworkSpace/basic/",""),"PdfTest/"+fileName.replace("/myworkSpace/subject/",""));
}else{
String command = "node /myworkSpace/puppeteer.js \"http://localhost:8080/pdf/basic?province=condition5&school=condition1&examId=condition4&region=非改革&branch=condition3&subjectType=常规\" pdf ";
String command = "node /myworkSpace/puppeteer.js \"https://schoolreport.cssatest.com/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())
.concat(" ").concat(fileName);
......@@ -164,8 +164,8 @@ public class GeneratorAllTypePdfByProvinceController {
for (ClassBasicReportParameters synthesisClassSubjectReportParameter : synthesisClassSubjectReportParameters) {
if (synthesisClassSubjectReportParameter.getRegion().equals("改革")||synthesisClassSubjectReportParameter.getRegion().equals("改革A")) {
String command = "node /myworkSpace/pdfOfClassSubjectGen.js \"http://localhost:8080/pdf/classSubject?province=condition5&school=condition1&examId=condition4&region=conditionC&subSubject=condition6&subjectType=常规&className=conditionA\" pdf";
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 \"https://schoolreport.cssatest.com/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())
.concat(" ").concat(fileName);
......@@ -173,7 +173,7 @@ public class GeneratorAllTypePdfByProvinceController {
synthesisClassSubjectReportParameter.setCommand(command);
synthesisClassSubjectReportParameter.setPrefix("/myworkSpace/Class/subject/");
} else {
String command = "node /myworkSpace/pdfOfClassSubjectGen.js \"http://localhost:8080/pdf/classSubject?province=condition5&school=condition1&examId=condition4&region=非改革&branch=condition3&subSubject=condition6&subjectType=常规&className=conditionA\" pdf";
String command = "node /myworkSpace/pdfOfClassSubjectGen.js \"https://schoolreport.cssatest.com/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())
......@@ -188,9 +188,9 @@ public class GeneratorAllTypePdfByProvinceController {
for (ClassBasicReportParameters synthesisClassReportParameter : synthesisClassReportParameters) {
if(synthesisClassReportParameter.getRegion().equals("改革")||synthesisClassReportParameter.getRegion().equals("改革A")){
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://localhost:8080/pdf/classBasic?province=condition5&school=condition1&examId=condition4&region=conditionC&subjectType=常规&className=conditionA\" pdf ";
String command = "node /myworkSpace/pdfOfClassBasicGen.js \"https://schoolreport.cssatest.com/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";
......@@ -205,7 +205,7 @@ public class GeneratorAllTypePdfByProvinceController {
} else {
String command = "node/myworkSpace/pdfOfClassBasicGen.js \"http://localhost:8080/pdf/classBasic?province=condition5&school=condition1&examId=condition4&region=非改革&branch=condition3&subjectType=常规&className=conditionA\" pdf ";
String command = "node/myworkSpace/pdfOfClassBasicGen.js \"https://schoolreport.cssatest.com/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";
......
......@@ -22,10 +22,11 @@ import java.util.stream.Collectors;
public class ClassIncrement {
// @Test
@Test
public void GeProvinceQuesTypeSituation(){
String sql = "select region,province from base_province_subject_tda20240919 where subject_type = '常规' group by region,province";
String sql = "select region1" +
" as region,province from base_province_subject_tda20241031 where subject_type = '常规' group by region1,province";
JdbcTemplate jdbcTemplate = MyDataSourceConfig.getReportJdbcTemplate();
List<Params> params = jdbcTemplate.query(sql,new Object[]{},new BeanPropertyRowMapper<>(Params.class));
for (Params param : params) {
......@@ -42,25 +43,25 @@ public class ClassIncrement {
"sub_subject,\n" +
"stu_id\n" +
"from\n" +
"base_student_ques_type_tda20240919\n" +
"base_student_ques_type_tda20241031\n" +
"where\n" +
"region = '"+region+"'\n" +
"region1 = '"+region+"'\n" +
"AND province = '"+province+"'\n" +
"\t\t\tAND subject_type = '常规' \n" +
"\t\t\tAND exam_id = 'TDA20240919G2'\n";
"\t\t\tAND exam_id = 'TDA20241031G3'\n";
List<DtoArgs> list = jdbcTemplate.query(sql,new Object[]{},new BeanPropertyRowMapper<>(DtoArgs.class));
Map<String, List<DtoArgs>> collect = list.stream().collect(Collectors.groupingBy(DtoArgs::getSubSubject));
for(String subject : collect.keySet()){
String sql2 = "SELECT\n" +
"\tstu_id \n" +
"FROM\n" +
"\tbase_student_subject_tda20240919 \n" +
"\tbase_student_subject_tda20241031 \n" +
"WHERE\n" +
"\tstu_subject_score_rate_province_pct_rank >= ( 1-0.27 ) \n" +
"\tAND region = '"+region+"' \n" +
"\tAND region1 = '"+region+"' \n" +
"\tAND province = '"+province+"' \n" +
"\tAND subject_type = '常规' \n" +
"\tAND exam_id = 'TDA20240919G2' \n" +
"\tAND exam_id = 'TDA20241031G3' \n" +
"\tAND sub_subject = '"+subject+"'";
List<String> excellentIds = jdbcTemplate.queryForList(sql2,String.class);
......@@ -92,7 +93,7 @@ public class ClassIncrement {
params.put("Mean",resultMean);
NamedParameterJdbcTemplate namedParameterJdbcTemplate = new NamedParameterJdbcTemplate(jdbcTemplate);
namedParameterJdbcTemplate.update("insert into province_ques_type_excellent20240919(region,province,sub_subject,mean,ques_type) value (:region,:province,:subSubject,:Mean,:quesType)",new MapSqlParameterSource(params));
namedParameterJdbcTemplate.update("insert into province_ques_type_excellent20241031(region,province,sub_subject,mean,ques_type) value (:region,:province,:subSubject,:Mean,:quesType)",new MapSqlParameterSource(params));
}
}
......@@ -100,10 +101,10 @@ public class ClassIncrement {
// @Test
@Test
public void GeProvinceExcellentDifficultySituations(){
String sql = "select region,province from base_province_subject_tda20240919 where subject_type = '常规' group by region,province";
String sql = "select region1 as region,province from base_province_subject_tda20241031 where subject_type = '常规' group by region1,province";
JdbcTemplate jdbcTemplate = MyDataSourceConfig.getReportJdbcTemplate();
List<Params> params = jdbcTemplate.query(sql,new Object[]{},new BeanPropertyRowMapper<>(Params.class));
for (Params param : params) {
......@@ -115,7 +116,7 @@ public class ClassIncrement {
private void ProcessProvinceExcellentQuestTypeDifficultyLevel(String province, String region, JdbcTemplate jdbcTemplate) {
String sql = "SELECT\n" +
"\ta.region,\n" +
"\ta.region1 as region,\n" +
"\ta.sub_subject,\n" +
"\ta.subject_type,\n" +
"\ta.exam_id,\n" +
......@@ -125,9 +126,9 @@ public class ClassIncrement {
"\tb.`ques_max_score`,\n" +
"\tb.`stu_id`\n" +
"\tFROM\n" +
"\tbase_area_question_tda20240919 a\n" +
"\tleft join base_student_question_tda20240919 b on a.ques_no = b.ques_no and a.sub_subject = b.`sub_subject` and a.region = b.region and a.subject_type = b.subject_type\n" +
"\twhere a.subject_type = '常规' and a.region = '"+region+"' and b.province = '"+province+"'";
"\tbase_area_question_tda20241031 a\n" +
"\tleft join base_student_question_tda20241031 b on a.ques_no = b.ques_no and a.sub_subject = b.`sub_subject` and a.region1 = b.region1 and a.subject_type = b.subject_type\n" +
"\twhere a.subject_type = '常规' and a.region1 = '"+region+"' and b.province = '"+province+"'";
NamedParameterJdbcTemplate namedParameterJdbcTemplate = new NamedParameterJdbcTemplate(jdbcTemplate);
System.out.println("emoj--->"+sql);
......@@ -138,7 +139,7 @@ public class ClassIncrement {
for (String subject : collect.keySet()) {
String sql2 = "select stu_id from base_student_subject_tda20240919 where sub_subject = '"+subject+"' and region = '"+region+"' and province = '"+province +"' and stu_subject_score_rate_province_pct_rank >= 0.73 and subject_type = '常规'";
String sql2 = "select stu_id from base_student_subject_tda20241031 where sub_subject = '"+subject+"' and region1 = '"+region+"' and province = '"+province +"' and stu_subject_score_rate_province_pct_rank >= 0.73 and subject_type = '常规'";
List<String> excellentIds = namedParameterJdbcTemplate.queryForList(sql2,new HashMap<>(),String.class);
......@@ -231,11 +232,11 @@ public class ClassIncrement {
put("scoreMean", nanResult);
}};
namedParameterJdbcTemplate.update("insert into province_excellent_difficult20240919(sub_subject,difficult,region,province,score_mean) value(:subSubject,:difficult,:region,:province,:scoreMean)",new MapSqlParameterSource(paramsYi));
namedParameterJdbcTemplate.update("insert into province_excellent_difficult20240919(sub_subject,difficult,region,province,score_mean) value(:subSubject,:difficult,:region,:province,:scoreMean)",new MapSqlParameterSource(paramsJiaoYi));
namedParameterJdbcTemplate.update("insert into province_excellent_difficult20240919(sub_subject,difficult,region,province,score_mean) value(:subSubject,:difficult,:region,:province,:scoreMean)",new MapSqlParameterSource(paramsZhong));
namedParameterJdbcTemplate.update("insert into province_excellent_difficult20240919(sub_subject,difficult,region,province,score_mean) value(:subSubject,:difficult,:region,:province,:scoreMean)",new MapSqlParameterSource(paramsJiaoNan));
namedParameterJdbcTemplate.update("insert into province_excellent_difficult20240919(sub_subject,difficult,region,province,score_mean) value(:subSubject,:difficult,:region,:province,:scoreMean)",new MapSqlParameterSource(paramsNan));
namedParameterJdbcTemplate.update("insert into province_excellent_difficult20241031(sub_subject,difficult,region,province,score_mean) value(:subSubject,:difficult,:region,:province,:scoreMean)",new MapSqlParameterSource(paramsYi));
namedParameterJdbcTemplate.update("insert into province_excellent_difficult20241031(sub_subject,difficult,region,province,score_mean) value(:subSubject,:difficult,:region,:province,:scoreMean)",new MapSqlParameterSource(paramsJiaoYi));
namedParameterJdbcTemplate.update("insert into province_excellent_difficult20241031(sub_subject,difficult,region,province,score_mean) value(:subSubject,:difficult,:region,:province,:scoreMean)",new MapSqlParameterSource(paramsZhong));
namedParameterJdbcTemplate.update("insert into province_excellent_difficult20241031(sub_subject,difficult,region,province,score_mean) value(:subSubject,:difficult,:region,:province,:scoreMean)",new MapSqlParameterSource(paramsJiaoNan));
namedParameterJdbcTemplate.update("insert into province_excellent_difficult20241031(sub_subject,difficult,region,province,score_mean) value(:subSubject,:difficult,:region,:province,:scoreMean)",new MapSqlParameterSource(paramsNan));
}
......
......@@ -18,14 +18,14 @@ import java.util.stream.Collectors;
public class Garbge {
// @Test
@Test
public void meanRegion(){
JdbcTemplate jdbcTemplate = MyDataSourceConfig.getReportJdbcTemplate();
NamedParameterJdbcTemplate namedParameterJdbcTemplate = new NamedParameterJdbcTemplate(jdbcTemplate);
String sql = "select region from base_school_subject_tda20240919 where subject_type = '常规' group by region";
String sql = "select region1 from base_school_subject_tda20241031 where subject_type = '常规' group by region1";
List<String> regions = jdbcTemplate.queryForList(sql, String.class);
for (String region : regions) {
......@@ -41,9 +41,9 @@ public class Garbge {
"sub_subject,\n" +
"stu_id\n" +
"from\n" +
"base_student_knowledge_tda20240919\n" +
"base_student_knowledge_tda20241031\n" +
"where\n" +
"region = '"+region+"' and subject_type = '常规'";
"region1 = '"+region+"' and subject_type = '常规'";
List<DtoKn> list = reportJdbcTemplate.query(sql,new BeanPropertyRowMapper<>(DtoKn.class));
Map<String, List<DtoKn>> collect = list.stream().collect(Collectors.groupingBy(DtoKn::getSubSubject));
......@@ -52,13 +52,13 @@ public class Garbge {
String sql2 = "select \n" +
"stu_id\n" +
"from \n" +
"base_student_subject_tda20240919\n" +
"base_student_subject_tda20241031\n" +
"where\n" +
"sub_subject = '"+subject+"'\n" +
"and\n" +
"subject_type = '常规'\n" +
"and\n" +
"region = '"+region+"'\n" +
"region1= '"+region+"'\n" +
"and \n" +
"stu_subject_score_rate_region_pct_rank >= 0.73";
List<String> ids = reportJdbcTemplate.queryForList(sql2,new HashMap<>(),String.class);
......@@ -81,7 +81,7 @@ public class Garbge {
paramsYi.put("rate",resultRate);
reportJdbcTemplate.update("insert into knowledge_region_excellent20240919(sub_subject,knowledge,region,rate) value (:subSubject,:knowledge,:region,:rate)",new MapSqlParameterSource(paramsYi));
reportJdbcTemplate.update("insert into knowledge_region_excellent20241031(sub_subject,knowledge,region,rate) value (:subSubject,:knowledge,:region,:rate)",new MapSqlParameterSource(paramsYi));
}
......
......@@ -23,14 +23,14 @@ public class GenerateTaskPool {
String sql = "SELECT\n" +
"\texam_id,\n" +
"\tregion,\n" +
"\tregion1 as region,\n" +
"\tprovince,\n" +
"\tschool,\n" +
"\t0 as status\n" +
"FROM\n" +
"\tbase_school_total_score_tda20240919 \n" +
"\tbase_school_subject_tda20241031 \n" +
"GROUP BY\n" +
"\tregion,\n" +
"\tregion1,\n" +
"\tprovince,\n" +
"\tschool,\n" +
"\texam_id";
......
......@@ -18,11 +18,11 @@ import java.util.stream.Collectors;
@SpringBootTest
public class NumberTwo {
// @Test
@Test
public void ProvinceExKnow(){
JdbcTemplate jdbcTemplate = MyDataSourceConfig.getReportJdbcTemplate();
NamedParameterJdbcTemplate namedParameterJdbcTemplate = new NamedParameterJdbcTemplate(jdbcTemplate);
String sql = "select region,province from base_school_subject_tda20240919 where subject_type = '常规' group by region,province";
String sql = "select region1 as region,province from base_school_subject_tda20241031 where subject_type = '常规' group by region1,province";
List<Params> paramsList = namedParameterJdbcTemplate.query(sql,new BeanPropertyRowMapper<>(Params.class));
for (Params param : paramsList) {
provinceExe(param.getRegion(),param.getProvince(),namedParameterJdbcTemplate);
......@@ -37,9 +37,9 @@ public class NumberTwo {
"sub_subject,\n" +
"stu_id\n" +
"from\n" +
"base_student_knowledge_tda20240919\n" +
"base_student_knowledge_tda20241031\n" +
"where\n" +
"region = '"+region+"' and subject_type = '常规' and province = '"+province+"'";
"region1 = '"+region+"' and subject_type = '常规' and province = '"+province+"'";
List<DtoKn> list = reportTemplate.query(sql,new HashMap<>(),new BeanPropertyRowMapper<>(DtoKn.class));
Map<String, List<DtoKn>> collect = list.stream().collect(Collectors.groupingBy(DtoKn::getSubSubject));
......@@ -49,12 +49,12 @@ public class NumberTwo {
String sql3 = "\t\t\t\tSELECT\n" +
"\t\t\tstu_id \n" +
"\t\tFROM\n" +
"\t\t\tbase_student_subject_tda20240919 \n" +
"\t\t\tbase_student_subject_tda20241031 \n" +
"\t\tWHERE\n" +
"\t\t\tprovince = '"+province+"' \n" +
"\t\t\tAND region = '"+region+"' \n" +
"\t\t\tAND region1 = '"+region+"' \n" +
"\t\t\tAND subject_type = '常规' \n" +
"\t\t\tAND exam_id = 'TDA20240919G2' \n" +
"\t\t\tAND exam_id = 'TDA20241031G3' \n" +
"\t\t\tAND sub_subject = '"+subject+"' \n" +
"\t\t\tAND stu_subject_score_rate_province_pct_rank >= (1-0.27) ";
......@@ -80,7 +80,7 @@ public class NumberTwo {
}};
paramsYi.put("rate",result);
reportTemplate.update("insert into knowledge_province_excellent20240919(sub_subject,knowledge,region,rate,province) value (:subSubject,:knowledge,:region,:rate,:province)",new MapSqlParameterSource(paramsYi));
reportTemplate.update("insert into knowledge_province_excellent20241031(sub_subject,knowledge,region,rate,province) value (:subSubject,:knowledge,:region,:rate,:province)",new MapSqlParameterSource(paramsYi));
}
}
......
......@@ -20,24 +20,24 @@ class PdfGeneratorApplicationTests {
}
// @Test
@Test
public void TestInsertSchoolClass(){
JdbcTemplate reportJdbcTemplate = MyDataSourceConfig.getReportJdbcTemplate();
String sql = "SELECT\n" +
"\tregion,\n" +
"\tregion1 as region,\n" +
"\tschool,\n" +
"\tclass as className\n" +
"FROM\n" +
"\tbase_class_subject_tda20240919 \n" +
"\tbase_class_subject_tda20241031 \n" +
"WHERE\n" +
"\tsubject_type = '常规' \n" +
"GROUP BY\n" +
"\tschool,\n" +
"\tregion,\n" +
"\tregion1,\n" +
"\tclass\n" +
"order by region,school,class";
"order by region1,school,class";
List<ClassDtoArgs> paramsList = reportJdbcTemplate.query(sql,new Object[]{},new BeanPropertyRowMapper<>(ClassDtoArgs.class));
......@@ -50,7 +50,7 @@ class PdfGeneratorApplicationTests {
public void TestInsertClassName(String school,String region,String className,JdbcTemplate jdbcTemplate){
//学校的
String sql = "SELECT\n" +
"\ta.region,\n" +
"\ta.region1 as region, \n" +
"\ta.sub_subject,\n" +
"\ta.subject_type,\n" +
"\ta.exam_id,\n" +
......@@ -59,9 +59,9 @@ class PdfGeneratorApplicationTests {
"\tb.stu_ques_score,\n" +
"\tb.`ques_max_score`,b.stu_ques_score\n" +
"\tFROM\n" +
"\tbase_area_question_tda20240919 a\n" +
"\tleft join base_student_question_tda20240919 b on a.ques_no = b.ques_no and a.sub_subject = b.`sub_subject`\n" +"and a.region = b.region "+
"\twhere b.school = '"+school+"' and b.subject_type = '常规' and a.region = '"+region+"'"+"and class = '"+className+"'";
"\tbase_area_question_tda20241031 a\n" +
"\tleft join base_student_question_tda20241031 b on a.ques_no = b.ques_no and a.sub_subject = b.`sub_subject`\n" +"and a.region1 = b.region1 "+
"\twhere b.school = '"+school+"' and b.subject_type = '常规' and a.region1 = '"+region+"'"+"and class = '"+className+"'";
NamedParameterJdbcTemplate namedParameterJdbcTemplate = new NamedParameterJdbcTemplate(jdbcTemplate);
......@@ -164,11 +164,11 @@ class PdfGeneratorApplicationTests {
put("region",region);
put("scoreMean", nanResult);
}};
namedParameterJdbcTemplate.update("insert into class_diffficult20240919(class,school,sub_subject,difficult,region,score_mean) value(:class,:school,:subSubject,:difficult,:region,:scoreMean)",new MapSqlParameterSource(paramsYi));
namedParameterJdbcTemplate.update("insert into class_diffficult20240919(class,school,sub_subject,difficult,region,score_mean) value(:class,:school,:subSubject,:difficult,:region,:scoreMean)",new MapSqlParameterSource(paramsJiaoYi));
namedParameterJdbcTemplate.update("insert into class_diffficult20240919(class,school,sub_subject,difficult,region,score_mean) value(:class,:school,:subSubject,:difficult,:region,:scoreMean)",new MapSqlParameterSource(paramsZhong));
namedParameterJdbcTemplate.update("insert into class_diffficult20240919(class,school,sub_subject,difficult,region,score_mean) value(:class,:school,:subSubject,:difficult,:region,:scoreMean)",new MapSqlParameterSource(paramsJiaoNan));
namedParameterJdbcTemplate.update("insert into class_diffficult20240919(class,school,sub_subject,difficult,region,score_mean) value(:class,:school,:subSubject,:difficult,:region,:scoreMean)",new MapSqlParameterSource(paramsNan));
namedParameterJdbcTemplate.update("insert into class_diffficult20241031(class,school,sub_subject,difficult,region,score_mean) value(:class,:school,:subSubject,:difficult,:region,:scoreMean)",new MapSqlParameterSource(paramsYi));
namedParameterJdbcTemplate.update("insert into class_diffficult20241031(class,school,sub_subject,difficult,region,score_mean) value(:class,:school,:subSubject,:difficult,:region,:scoreMean)",new MapSqlParameterSource(paramsJiaoYi));
namedParameterJdbcTemplate.update("insert into class_diffficult20241031(class,school,sub_subject,difficult,region,score_mean) value(:class,:school,:subSubject,:difficult,:region,:scoreMean)",new MapSqlParameterSource(paramsZhong));
namedParameterJdbcTemplate.update("insert into class_diffficult20241031(class,school,sub_subject,difficult,region,score_mean) value(:class,:school,:subSubject,:difficult,:region,:scoreMean)",new MapSqlParameterSource(paramsJiaoNan));
namedParameterJdbcTemplate.update("insert into class_diffficult20241031(class,school,sub_subject,difficult,region,score_mean) value(:class,:school,:subSubject,:difficult,:region,:scoreMean)",new MapSqlParameterSource(paramsNan));
}
}
......@@ -177,7 +177,7 @@ class PdfGeneratorApplicationTests {
JdbcTemplate reportJdbcTemplate = MyDataSourceConfig.getReportJdbcTemplate();
String sql = "select school,region from base_school_subject_tda20240919 where subject_type = '常规' group by school,region";
String sql = "select school,region1 as region from base_school_subject_tda20241031 where subject_type = '常规' group by school,region1";
List<Dto> listParams = reportJdbcTemplate.query(sql,new Object[]{},new BeanPropertyRowMapper<>(Dto.class));
......@@ -192,7 +192,7 @@ class PdfGeneratorApplicationTests {
//学校的
String sql = "SELECT\n" +
"\ta.region,\n" +
"\ta.region1 as region,\n" +
"\ta.sub_subject,\n" +
"\ta.subject_type,\n" +
"\ta.exam_id,\n" +
......@@ -201,9 +201,9 @@ class PdfGeneratorApplicationTests {
"\tb.stu_ques_score,\n" +
"\tb.`ques_max_score`\n" +
"\tFROM\n" +
"\tbase_area_question_tda20240919 a\n" +
"\tleft join base_student_question_tda20240919 b on a.ques_no = b.ques_no and a.sub_subject = b.`sub_subject`\n" +"and a.region = b.region "+
"\twhere b.school = '"+school+"' and b.subject_type = '常规' and a.region = '"+region+"'";
"\tbase_area_question_tda20241031 a\n" +
"\tleft join base_student_question_tda20241031 b on a.ques_no = b.ques_no and a.sub_subject = b.`sub_subject`\n" +"and a.region1 = b.region1 "+
"\twhere b.school = '"+school+"' and b.subject_type = '常规' and a.region1 = '"+region+"'";
NamedParameterJdbcTemplate namedParameterJdbcTemplate = new NamedParameterJdbcTemplate(jdbcTemplate);
......@@ -323,22 +323,22 @@ class PdfGeneratorApplicationTests {
put("scoreMean", nanResult);
}};
namedParameterJdbcTemplate.update("insert into school_diffficult20240919(school,sub_subject,difficult,region,score_mean) value(:school,:subSubject,:difficult,:region,:scoreMean)",new MapSqlParameterSource(paramsYi));
namedParameterJdbcTemplate.update("insert into school_diffficult20240919(school,sub_subject,difficult,region,score_mean) value(:school,:subSubject,:difficult,:region,:scoreMean)",new MapSqlParameterSource(paramsJiaoYi));
namedParameterJdbcTemplate.update("insert into school_diffficult20240919(school,sub_subject,difficult,region,score_mean) value(:school,:subSubject,:difficult,:region,:scoreMean)",new MapSqlParameterSource(paramsZhong));
namedParameterJdbcTemplate.update("insert into school_diffficult20240919(school,sub_subject,difficult,region,score_mean) value(:school,:subSubject,:difficult,:region,:scoreMean)",new MapSqlParameterSource(paramsJiaoNan));
namedParameterJdbcTemplate.update("insert into school_diffficult20240919(school,sub_subject,difficult,region,score_mean) value(:school,:subSubject,:difficult,:region,:scoreMean)",new MapSqlParameterSource(paramsNan));
namedParameterJdbcTemplate.update("insert into school_diffficult20241031(school,sub_subject,difficult,region,score_mean) value(:school,:subSubject,:difficult,:region,:scoreMean)",new MapSqlParameterSource(paramsYi));
namedParameterJdbcTemplate.update("insert into school_diffficult20241031(school,sub_subject,difficult,region,score_mean) value(:school,:subSubject,:difficult,:region,:scoreMean)",new MapSqlParameterSource(paramsJiaoYi));
namedParameterJdbcTemplate.update("insert into school_diffficult20241031(school,sub_subject,difficult,region,score_mean) value(:school,:subSubject,:difficult,:region,:scoreMean)",new MapSqlParameterSource(paramsZhong));
namedParameterJdbcTemplate.update("insert into school_diffficult20241031(school,sub_subject,difficult,region,score_mean) value(:school,:subSubject,:difficult,:region,:scoreMean)",new MapSqlParameterSource(paramsJiaoNan));
namedParameterJdbcTemplate.update("insert into school_diffficult20241031(school,sub_subject,difficult,region,score_mean) value(:school,:subSubject,:difficult,:region,:scoreMean)",new MapSqlParameterSource(paramsNan));
}
// DeFenLu deFenLu = yi.get(0);
}
// @Test
@Test
public void TestInsertRegion(){
JdbcTemplate reportJdbcTemplate = MyDataSourceConfig.getReportJdbcTemplate();
String sql = "select region from base_school_subject_tda20240919 where subject_type = '常规' group by region";
String sql = "select region1 from base_school_subject_tda20241031 where subject_type = '常规' group by region1";
List<String> listParams = reportJdbcTemplate.queryForList(sql,String.class);
......@@ -353,7 +353,7 @@ class PdfGeneratorApplicationTests {
String sql = "SELECT\n" +
"\ta.region,\n" +
"\ta.region1,\n" +
"\ta.sub_subject,\n" +
"\ta.subject_type,\n" +
"\ta.exam_id,\n" +
......@@ -362,9 +362,9 @@ class PdfGeneratorApplicationTests {
"\tb.stu_ques_score,\n" +
"\tb.`ques_max_score`\n" +
"\tFROM\n" +
"\tbase_area_question_tda20240919 a\n" +
"\tleft join base_student_question_tda20240919 b on a.ques_no = b.ques_no and a.sub_subject = b.`sub_subject` and a.region = b.region and a.subject_type = b.subject_type\n" +
"\twhere a.subject_type = '常规' and a.region = '"+region+"'\n";
"\tbase_area_question_tda20241031 a\n" +
"\tleft join base_student_question_tda20241031 b on a.ques_no = b.ques_no and a.sub_subject = b.`sub_subject` and a.region1 = b.region1 and a.subject_type = b.subject_type\n" +
"\twhere a.subject_type = '常规' and a.region1 = '"+region+"'\n";
NamedParameterJdbcTemplate namedParameterJdbcTemplate = new NamedParameterJdbcTemplate(jdbcTemplate);
......@@ -459,23 +459,23 @@ class PdfGeneratorApplicationTests {
put("scoreMean", nanResult);
}};
namedParameterJdbcTemplate.update("insert into region_difficult20240919(sub_subject,difficult,region,score_mean) value(:subSubject,:difficult,:region,:scoreMean)",new MapSqlParameterSource(paramsYi));
namedParameterJdbcTemplate.update("insert into region_difficult20240919(sub_subject,difficult,region,score_mean) value(:subSubject,:difficult,:region,:scoreMean)",new MapSqlParameterSource(paramsJiaoYi));
namedParameterJdbcTemplate.update("insert into region_difficult20240919(sub_subject,difficult,region,score_mean) value(:subSubject,:difficult,:region,:scoreMean)",new MapSqlParameterSource(paramsZhong));
namedParameterJdbcTemplate.update("insert into region_difficult20240919(sub_subject,difficult,region,score_mean) value(:subSubject,:difficult,:region,:scoreMean)",new MapSqlParameterSource(paramsJiaoNan));
namedParameterJdbcTemplate.update("insert into region_difficult20240919(sub_subject,difficult,region,score_mean) value(:subSubject,:difficult,:region,:scoreMean)",new MapSqlParameterSource(paramsNan));
namedParameterJdbcTemplate.update("insert into region_difficult20241031(sub_subject,difficult,region,score_mean) value(:subSubject,:difficult,:region,:scoreMean)",new MapSqlParameterSource(paramsYi));
namedParameterJdbcTemplate.update("insert into region_difficult20241031(sub_subject,difficult,region,score_mean) value(:subSubject,:difficult,:region,:scoreMean)",new MapSqlParameterSource(paramsJiaoYi));
namedParameterJdbcTemplate.update("insert into region_difficult20241031(sub_subject,difficult,region,score_mean) value(:subSubject,:difficult,:region,:scoreMean)",new MapSqlParameterSource(paramsZhong));
namedParameterJdbcTemplate.update("insert into region_difficult20241031(sub_subject,difficult,region,score_mean) value(:subSubject,:difficult,:region,:scoreMean)",new MapSqlParameterSource(paramsJiaoNan));
namedParameterJdbcTemplate.update("insert into region_difficult20241031(sub_subject,difficult,region,score_mean) value(:subSubject,:difficult,:region,:scoreMean)",new MapSqlParameterSource(paramsNan));
}
}
// @Test
@Test
public void TestProvinceInsert(){
JdbcTemplate reportJdbcTemplate = MyDataSourceConfig.getReportJdbcTemplate();
String sql = "select region,province from base_school_subject_tda20240919 where subject_type = '常规' group by region,province";
String sql = "select region1 as region ,province from base_school_subject_tda20241031 where subject_type = '常规' group by region1,province";
List<Params> paramsList = reportJdbcTemplate.query(sql,new Object[]{},new BeanPropertyRowMapper<>(Params.class));
......@@ -494,7 +494,7 @@ class PdfGeneratorApplicationTests {
public void TestProvince(String province,String region,JdbcTemplate jdbcTemplate){
String sql = "SELECT\n" +
"\ta.region,\n" +
"\ta.region1 as region,\n" +
"\ta.sub_subject,\n" +
"\ta.subject_type,\n" +
"\ta.exam_id,\n" +
......@@ -503,9 +503,9 @@ class PdfGeneratorApplicationTests {
"\tb.stu_ques_score,\n" +
"\tb.`ques_max_score`\n" +
"\tFROM\n" +
"\tbase_area_question_tda20240919 a\n" +
"\tleft join base_student_question_tda20240919 b on a.ques_no = b.ques_no and a.sub_subject = b.`sub_subject` and a.region = b.region and a.subject_type = b.subject_type\n" +
"\twhere a.subject_type = '常规' and a.region = '"+region+"' and b.province = '"+province+"'";
"\tbase_area_question_tda20241031 a\n" +
"\tleft join base_student_question_tda20241031 b on a.ques_no = b.ques_no and a.sub_subject = b.`sub_subject` and a.region1 = b.region1 and a.subject_type = b.subject_type\n" +
"\twhere a.subject_type = '常规' and a.region1 = '"+region+"' and b.province = '"+province+"'";
NamedParameterJdbcTemplate namedParameterJdbcTemplate = new NamedParameterJdbcTemplate(jdbcTemplate);
......@@ -601,23 +601,24 @@ class PdfGeneratorApplicationTests {
put("region",region);
put("scoreMean", nanResult);
}};
namedParameterJdbcTemplate.update("insert into province_difficult20240919(province,sub_subject,difficult,region,score_mean) value(:province,:subSubject,:difficult,:region,:scoreMean)",new MapSqlParameterSource(paramsYi));
namedParameterJdbcTemplate.update("insert into province_difficult20240919(province,sub_subject,difficult,region,score_mean) value(:province,:subSubject,:difficult,:region,:scoreMean)",new MapSqlParameterSource(paramsJiaoYi));
namedParameterJdbcTemplate.update("insert into province_difficult20240919(province,sub_subject,difficult,region,score_mean) value(:province,:subSubject,:difficult,:region,:scoreMean)",new MapSqlParameterSource(paramsZhong));
namedParameterJdbcTemplate.update("insert into province_difficult20240919(province,sub_subject,difficult,region,score_mean) value(:province,:subSubject,:difficult,:region,:scoreMean)",new MapSqlParameterSource(paramsJiaoNan));
namedParameterJdbcTemplate.update("insert into province_difficult20240919(province,sub_subject,difficult,region,score_mean) value(:province,:subSubject,:difficult,:region,:scoreMean)",new MapSqlParameterSource(paramsNan));
namedParameterJdbcTemplate.update("insert into province_difficult20241031(province,sub_subject,difficult,region,score_mean) value(:province,:subSubject,:difficult,:region,:scoreMean)",new MapSqlParameterSource(paramsYi));
namedParameterJdbcTemplate.update("insert into province_difficult20241031(province,sub_subject,difficult,region,score_mean) value(:province,:subSubject,:difficult,:region,:scoreMean)",new MapSqlParameterSource(paramsJiaoYi));
namedParameterJdbcTemplate.update("insert into province_difficult20241031(province,sub_subject,difficult,region,score_mean) value(:province,:subSubject,:difficult,:region,:scoreMean)",new MapSqlParameterSource(paramsZhong));
namedParameterJdbcTemplate.update("insert into province_difficult20241031(province,sub_subject,difficult,region,score_mean) value(:province,:subSubject,:difficult,:region,:scoreMean)",new MapSqlParameterSource(paramsJiaoNan));
namedParameterJdbcTemplate.update("insert into province_difficult20241031(province,sub_subject,difficult,region,score_mean) value(:province,:subSubject,:difficult,:region,:scoreMean)",new MapSqlParameterSource(paramsNan));
}
}
// @Test
@Test
public void excellentRegion(){
JdbcTemplate jdbcTemplate = MyDataSourceConfig.getReportJdbcTemplate();
String sql = "select region from base_school_subject_tda20240919 where subject_type ='常规' group by region";
String sql = "select region1 from base_school_subject_tda20241031 where subject_type ='常规' group by region1";
List<String> regions = jdbcTemplate.queryForList(sql,new Object[]{},String.class);
for (String region : regions) {
......@@ -630,7 +631,7 @@ class PdfGeneratorApplicationTests {
public void testExcellent(String region,JdbcTemplate jdbcTemplate){
String sql = "SELECT\n" +
" a.region,\n" +
" a.region1,\n" +
" a.sub_subject,\n" +
" a.subject_type,\n" +
" a.exam_id,\n" +
......@@ -640,9 +641,9 @@ class PdfGeneratorApplicationTests {
" b.`ques_max_score`,\n" +
" b.`stu_id`\n" +
" FROM\n" +
" base_area_question_tda20240919 a\n" +
" left join base_student_question_tda20240919 b on a.ques_no = b.ques_no and a.sub_subject = b.`sub_subject` and a.region = b.region and a.subject_type = b.subject_type\n" +
" where a.subject_type = '常规' and a.region = '"+region+"'";
" base_area_question_tda20241031 a\n" +
" left join base_student_question_tda20241031 b on a.ques_no = b.ques_no and a.sub_subject = b.`sub_subject` and a.region1 = b.region1 and a.subject_type = b.subject_type\n" +
" where a.subject_type = '常规' and a.region1 = '"+region+"'";
NamedParameterJdbcTemplate namedParameterJdbcTemplate = new NamedParameterJdbcTemplate(jdbcTemplate);
......@@ -661,7 +662,7 @@ class PdfGeneratorApplicationTests {
//这个级别开始晒数据
String sql2 = "select stu_id from base_student_subject_tda20240919 where sub_subject = '"+subject+"' and region = '"+region+"' and stu_subject_score_rate_region_pct_rank >= 0.73 and subject_type = '常规'";
String sql2 = "select stu_id from base_student_subject_tda20241031 where sub_subject = '"+subject+"' and region1 = '"+region+"' and stu_subject_score_rate_region_pct_rank >= 0.73 and subject_type = '常规'";
List<String> excellent = namedParameterJdbcTemplate.queryForList(sql2,new HashMap<>(),String.class);
......@@ -747,20 +748,20 @@ class PdfGeneratorApplicationTests {
put("scoreMean", nanResult);
}};
namedParameterJdbcTemplate.update("insert into region_excellent_difficult20240919(sub_subject,difficult,region,score_mean) value(:subSubject,:difficult,:region,:scoreMean)",new MapSqlParameterSource(paramsYi));
namedParameterJdbcTemplate.update("insert into region_excellent_difficult20240919(sub_subject,difficult,region,score_mean) value(:subSubject,:difficult,:region,:scoreMean)",new MapSqlParameterSource(paramsJiaoYi));
namedParameterJdbcTemplate.update("insert into region_excellent_difficult20240919(sub_subject,difficult,region,score_mean) value(:subSubject,:difficult,:region,:scoreMean)",new MapSqlParameterSource(paramsZhong));
namedParameterJdbcTemplate.update("insert into region_excellent_difficult20240919(sub_subject,difficult,region,score_mean) value(:subSubject,:difficult,:region,:scoreMean)",new MapSqlParameterSource(paramsJiaoNan));
namedParameterJdbcTemplate.update("insert into region_excellent_difficult20240919(sub_subject,difficult,region,score_mean) value(:subSubject,:difficult,:region,:scoreMean)",new MapSqlParameterSource(paramsNan));
namedParameterJdbcTemplate.update("insert into region_excellent_difficult20241031(sub_subject,difficult,region,score_mean) value(:subSubject,:difficult,:region,:scoreMean)",new MapSqlParameterSource(paramsYi));
namedParameterJdbcTemplate.update("insert into region_excellent_difficult20241031(sub_subject,difficult,region,score_mean) value(:subSubject,:difficult,:region,:scoreMean)",new MapSqlParameterSource(paramsJiaoYi));
namedParameterJdbcTemplate.update("insert into region_excellent_difficult20241031(sub_subject,difficult,region,score_mean) value(:subSubject,:difficult,:region,:scoreMean)",new MapSqlParameterSource(paramsZhong));
namedParameterJdbcTemplate.update("insert into region_excellent_difficult20241031(sub_subject,difficult,region,score_mean) value(:subSubject,:difficult,:region,:scoreMean)",new MapSqlParameterSource(paramsJiaoNan));
namedParameterJdbcTemplate.update("insert into region_excellent_difficult20241031(sub_subject,difficult,region,score_mean) value(:subSubject,:difficult,:region,:scoreMean)",new MapSqlParameterSource(paramsNan));
}
}
// @Test
@Test
public void ExcellentAswTimeProvince(){
String sql = "select region,province from base_province_subject_tda20240919 where subject_type = '常规' group by region,province";
String sql = "select region1 as region,province from base_province_subject_tda20241031 where subject_type = '常规' group by region1,province";
JdbcTemplate jdbcTemplate = MyDataSourceConfig.getReportJdbcTemplate();
List<Params> params = jdbcTemplate.query(sql,new Object[]{},new BeanPropertyRowMapper<>(Params.class));
for (Params param : params) {
......@@ -778,15 +779,15 @@ class PdfGeneratorApplicationTests {
"stu_ques_asw_time,\n" +
"sub_subject\n" +
"from \n" +
"base_student_question_log_time_tda20240919\n" +
"base_student_question_log_time_tda20241031\n" +
"where\n" +
// "region = '"+region+"'\n" +
// "and \n" +
"region1 = '"+region+"'\n" +
"and \n" +
"province = '"+province+"'\n" +
"and \n" +
"subject_type='常规'\n" +
"and \n" +
"exam_id = 'TDA20240919G2'\n" ;
"exam_id = 'TDA20241031G3'\n" ;
NamedParameterJdbcTemplate namedParameterJdbcTemplate = new NamedParameterJdbcTemplate(jdbcTemplate);
List<DtoAsw> listDtoAsw = jdbcTemplate.query(sql,new Object[]{},new BeanPropertyRowMapper<>(DtoAsw.class));
......@@ -796,16 +797,16 @@ class PdfGeneratorApplicationTests {
//科目粒度
for (String subject : collect.keySet()) {
System.out.println("operator"+subject+"科目");
String sql2 = "select stu_id from base_student_subject_tda20240919 where " +
// "region = '"+region+"'\n" +
// "and \n" +
String sql2 = "select stu_id from base_student_subject_tda20241031 where " +
"region1 = '"+region+"'\n" +
"and \n" +
"sub_subject = '"+subject+"'\n" +
"and \n" +
"province = '"+province+"' \n" +
"and \n" +
"subject_type= '常规'\n" +
"and \n" +
"exam_id = 'TDA20240919G2'\n" +
"exam_id = 'TDA20241031G3'\n" +
"and \n" +
"stu_subject_score_rate_province_pct_rank >= (1-0.27)";
......@@ -825,26 +826,26 @@ class PdfGeneratorApplicationTests {
HashMap params = new HashMap(){{
put("subSubject",subject);
put("province",province);
put("region","改革");
put("region",region);
put("quesNo",ques_no);
put("time",avgTime);
}};
namedParameterJdbcTemplate.update("insert into province_excellent_asw_time20240919(sub_subject,province,region,ques_no,time) value (:subSubject,:province,:region,:quesNo,:time)",new MapSqlParameterSource(params));
namedParameterJdbcTemplate.update("insert into province_excellent_asw_time20241031(sub_subject,province,region,ques_no,time) value (:subSubject,:province,:region,:quesNo,:time)",new MapSqlParameterSource(params));
}
}
}
// @Test
@Test
public void ExcellentRegionAswTime(){
String sql = "select region from base_province_subject_tda20240919 where subject_type = '常规' group by region\n";
String sql = "select region1 from base_province_subject_tda20241031 where subject_type = '常规' group by region1\n";
JdbcTemplate reportJdbcTemplate = MyDataSourceConfig.getReportJdbcTemplate();
List<String> regions = reportJdbcTemplate.queryForList(sql,String.class);
// for (String region : regions) {
// ExcellentRegionAsw(region,reportJdbcTemplate);
// }
ExcellentRegionAsw("",reportJdbcTemplate);
for (String region : regions) {
ExcellentRegionAsw(region,reportJdbcTemplate);
}
// ExcellentRegionAsw("",reportJdbcTemplate);
}
public void ExcellentRegionAsw(String region,JdbcTemplate jdbcTemplate){
......@@ -855,13 +856,13 @@ class PdfGeneratorApplicationTests {
"stu_id,\n" +
"stu_ques_asw_time\n" +
"from \n" +
"base_student_question_log_time_tda20240919\n" +
"base_student_question_log_time_tda20241031\n" +
"where\n" +
// "region = '"+region+"'\n" +
// "and \n" +
"region1 = '"+region+"'\n" +
"and \n" +
"subject_type= '常规'\n" +
"and \n" +
"exam_id = 'TDA20240919G2'\n";
"exam_id = 'TDA20241031G3'\n";
NamedParameterJdbcTemplate namedParameterJdbcTemplate = new NamedParameterJdbcTemplate(jdbcTemplate);
List<DtoAsw> list = jdbcTemplate.query(sql,new Object[]{},new BeanPropertyRowMapper<>(DtoAsw.class));
......@@ -869,14 +870,14 @@ class PdfGeneratorApplicationTests {
Map<String, List<DtoAsw>> collect = list.stream().collect(Collectors.groupingBy(DtoAsw::getSubSubject));
for (String subject : collect.keySet()) {
String sql2 = "select stu_id from base_student_subject_tda20240919 where " +
// "region = '"+region+"'\n" +
// "and \n" +
String sql2 = "select stu_id from base_student_subject_tda20241031 where " +
"region1 = '"+region+"'\n" +
"and \n" +
"sub_subject = '"+subject+"'\n" +
"and \n" +
"subject_type= '常规'\n" +
"and \n" +
"exam_id = 'TDA20240919G2'\n" +
"exam_id = 'TDA20241031G3'\n" +
"and \n" +
"stu_subject_score_rate_region_pct_rank >= (1-0.27)";
List<String> yousheng = jdbcTemplate.queryForList(sql2,String.class);
......@@ -889,21 +890,21 @@ class PdfGeneratorApplicationTests {
Double avgTime = sumTime/collect1.get(ques_no).size();
HashMap params = new HashMap(){{
put("subSubject",subject);
put("region","改革");
put("region",region);
put("quesNo",ques_no);
put("time",avgTime);
}};
namedParameterJdbcTemplate.update("insert into region_excellent_asw_time20240919(sub_subject,region,ques_no,time) value (:subSubject,:region,:quesNo,:time)",new MapSqlParameterSource(params));
namedParameterJdbcTemplate.update("insert into region_excellent_asw_time20241031(sub_subject,region,ques_no,time) value (:subSubject,:region,:quesNo,:time)",new MapSqlParameterSource(params));
}
}
}
// @Test
@Test
public void testQuesType(){
String sql = "select region from base_province_subject_tda20240919 where subject_type = '常规' group by region\n";
String sql = "select region1 from base_province_subject_tda20241031 where subject_type = '常规' group by region1\n";
JdbcTemplate reportJdbcTemplate = MyDataSourceConfig.getReportJdbcTemplate();
List<String> regions = reportJdbcTemplate.queryForList(sql,String.class);
for (String region : regions) {
......@@ -919,11 +920,11 @@ class PdfGeneratorApplicationTests {
"sub_subject,\n" +
"stu_id\n" +
"from\n" +
"base_student_ques_type_tda20240919\n" +
"base_student_ques_type_tda20241031\n" +
"where\n" +
"region = '"+region+"'\n" +
"region1 = '"+region+"'\n" +
"\t\t\tAND subject_type = '常规' \n" +
"\t\t\tAND exam_id = 'TDA20240919G2'\n";
"\t\t\tAND exam_id = 'TDA20241031G3'\n";
List<DtoArgs> list = jdbcTemplate.query(sql,new Object[]{},new BeanPropertyRowMapper<>(DtoArgs.class));
Map<String, List<DtoArgs>> collect = list.stream().collect(Collectors.groupingBy(DtoArgs::getSubSubject));
......@@ -931,12 +932,12 @@ class PdfGeneratorApplicationTests {
String sql2 = "SELECT\n" +
"\tstu_id \n" +
"FROM\n" +
"\tbase_student_subject_tda20240919 \n" +
"\tbase_student_subject_tda20241031 \n" +
"WHERE\n" +
"\tstu_subject_score_rate_region_pct_rank >= ( 1-0.27 ) \n" +
"\tAND region = '"+region+"' \n" +
"\tAND region1 = '"+region+"' \n" +
"\tAND subject_type = '常规' \n" +
"\tAND exam_id = 'TDA20240919G2' \n" +
"\tAND exam_id = 'TDA20241031G3' \n" +
"\tAND sub_subject = '"+subject+"'";
List<String> youshengIds = jdbcTemplate.queryForList(sql2, String.class);
......@@ -966,7 +967,7 @@ class PdfGeneratorApplicationTests {
params.put("Mean",resultMean);
NamedParameterJdbcTemplate namedParameterJdbcTemplate = new NamedParameterJdbcTemplate(jdbcTemplate);
namedParameterJdbcTemplate.update("insert into region_ques_type_excellent20240919(region,sub_subject,mean,ques_type) value (:region,:subSubject,:Mean,:quesType)",new MapSqlParameterSource(params));
namedParameterJdbcTemplate.update("insert into region_ques_type_excellent20241031(region,sub_subject,mean,ques_type) value (:region,:subSubject,:Mean,:quesType)",new MapSqlParameterSource(params));
}
}
......
package com.example.pdfgenerator.GenerateTable;
import com.example.pdfgenerator.config.MyDataSourceConfig;
import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.jdbc.core.JdbcTemplate;
@SpringBootTest
public class GenerateSchool {
@Test
public void GenerateSchool(){
JdbcTemplate reportJdbcTemplate = MyDataSourceConfig.getReportJdbcTemplate();
String examId = "TDA20241031G3";
String suffix = examId.replace("TDA","").replace("G2","").replace("G3","");
String createTableClassDifficult = "CREATE TABLE IF NOT EXISTS `class_diffficult"+suffix+"` (\n" +
" `id` int NOT NULL AUTO_INCREMENT,\n" +
" `class` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL,\n" +
" `school` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL,\n" +
" `sub_subject` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL,\n" +
" `difficult` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL,\n" +
" `region` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL,\n" +
" `score_mean` double DEFAULT NULL,\n" +
" PRIMARY KEY (`id`) USING BTREE\n" +
") ENGINE=InnoDB AUTO_INCREMENT=17401 DEFAULT CHARSET=utf8mb3";
String createTableProvinceDifficult = "CREATE TABLE IF NOT EXISTS `province_difficult"+suffix+"` (\n" +
" `id` int NOT NULL AUTO_INCREMENT,\n" +
" `province` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL,\n" +
" `region` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL,\n" +
" `sub_subject` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL,\n" +
" `difficult` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL,\n" +
" `score_mean` double DEFAULT NULL,\n" +
" PRIMARY KEY (`id`) USING BTREE\n" +
") ENGINE=InnoDB AUTO_INCREMENT=371 DEFAULT CHARSET=utf8mb3";
String createTableProvinceExcellentDifficult = "CREATE TABLE IF NOT EXISTS `province_excellent_difficult"+suffix+"` (\n" +
" `id` int NOT NULL AUTO_INCREMENT,\n" +
" `region` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL,\n" +
" `province` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL,\n" +
" `sub_subject` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL,\n" +
" `difficult` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL,\n" +
" `score_mean` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL,\n" +
" PRIMARY KEY (`id`) USING BTREE\n" +
") ENGINE=InnoDB AUTO_INCREMENT=916 DEFAULT CHARSET=utf8mb3";
String createTableRegionDifficult = "CREATE TABLE `region_difficult"+suffix+"` (\n" +
" `id` int NOT NULL AUTO_INCREMENT,\n" +
" `region` varchar(255) DEFAULT NULL,\n" +
" `sub_subject` varchar(255) DEFAULT NULL,\n" +
" `difficult` varchar(255) DEFAULT NULL,\n" +
" `score_mean` varchar(255) DEFAULT NULL,\n" +
" PRIMARY KEY (`id`)\n" +
") ENGINE=InnoDB AUTO_INCREMENT=101 DEFAULT CHARSET=utf8mb3";
String createTableRegionExcellentDifficult = "CREATE TABLE IF NOT EXISTS `region_excellent_difficult"+suffix+"` (\n" +
" `id` int NOT NULL AUTO_INCREMENT,\n" +
" `region` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL,\n" +
" `sub_subject` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL,\n" +
" `difficult` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL,\n" +
" `score_mean` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL,\n" +
" PRIMARY KEY (`id`) USING BTREE\n" +
") ENGINE=InnoDB AUTO_INCREMENT=101 DEFAULT CHARSET=utf8mb3";
String createTableSchoolDifficult = "CREATE TABLE IF NOT EXISTS `school_diffficult"+suffix+"` (\n" +
" `id` int NOT NULL AUTO_INCREMENT,\n" +
" `school` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL,\n" +
" `sub_subject` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL,\n" +
" `difficult` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL,\n" +
" `region` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL,\n" +
" `score_mean` double DEFAULT NULL,\n" +
" PRIMARY KEY (`id`) USING BTREE\n" +
") ENGINE=InnoDB AUTO_INCREMENT=7176 DEFAULT CHARSET=utf8mb3";
String createTableKnowledgeProvinceExcellent = "CREATE TABLE IF NOT EXISTS `knowledge_province_excellent"+suffix+"` (\n" +
" `id` int NOT NULL AUTO_INCREMENT,\n" +
" `region` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL,\n" +
" `province` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL,\n" +
" `sub_subject` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL,\n" +
" `rate` double DEFAULT NULL,\n" +
" `knowledge` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL,\n" +
" PRIMARY KEY (`id`) USING BTREE\n" +
") ENGINE=InnoDB AUTO_INCREMENT=811 DEFAULT CHARSET=utf8mb3";
String createTableKnowledgeRegionExcellent = "CREATE TABLE IF NOT EXISTS `knowledge_region_excellent"+suffix+"` (\n" +
" `id` int NOT NULL AUTO_INCREMENT,\n" +
" `region` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL,\n" +
" `sub_subject` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL,\n" +
" `knowledge` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL,\n" +
" `rate` double DEFAULT NULL,\n" +
" PRIMARY KEY (`id`) USING BTREE\n" +
") ENGINE=InnoDB AUTO_INCREMENT=218 DEFAULT CHARSET=utf8mb3";
String createTableProvinceExcellentAswTime = "CREATE TABLE IF NOT EXISTS `province_excellent_asw_time"+suffix+"` (\n" +
" `id` int NOT NULL AUTO_INCREMENT,\n" +
" `region` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL,\n" +
" `province` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL,\n" +
" `sub_subject` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL,\n" +
" `ques_no` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL,\n" +
" `time` double DEFAULT NULL,\n" +
" PRIMARY KEY (`id`) USING BTREE\n" +
") ENGINE=InnoDB AUTO_INCREMENT=916 DEFAULT CHARSET=utf8mb3";
String createTableProvinceQuesTypeExcellent = "CREATE TABLE \n" +
"IF NOT EXISTS `province_ques_type_excellent"+suffix+"` (\n" +
" `id` int NOT NULL AUTO_INCREMENT,\n" +
" `region` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL,\n" +
" `province` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL,\n" +
" `sub_subject` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL,\n" +
" `ques_type` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL,\n" +
" `mean` double DEFAULT NULL,\n" +
" PRIMARY KEY (`id`) USING BTREE\n" +
") ENGINE=InnoDB AUTO_INCREMENT=526 DEFAULT CHARSET=utf8mb3\n";
String createTableRegionExcellentAswTime = "CREATE TABLE \n" +
"IF NOT EXISTS `region_excellent_asw_time"+suffix+"` (\n" +
" `id` int NOT NULL AUTO_INCREMENT,\n" +
" `region` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL,\n" +
" `ques_no` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL,\n" +
" `sub_subject` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL,\n" +
" `time` double DEFAULT NULL,\n" +
" PRIMARY KEY (`id`) USING BTREE\n" +
") ENGINE=InnoDB AUTO_INCREMENT=273 DEFAULT CHARSET=utf8mb3";
String createTableRegionQuesTypeExcellent = "CREATE TABLE IF NOT EXISTS `region_ques_type_excellent"+suffix+"` (\n" +
" `id` int NOT NULL AUTO_INCREMENT,\n" +
" `region` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL,\n" +
" `sub_subject` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL,\n" +
" `ques_type` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL,\n" +
" `mean` double DEFAULT NULL,\n" +
" PRIMARY KEY (`id`) USING BTREE\n" +
") ENGINE=InnoDB AUTO_INCREMENT=54 DEFAULT CHARSET=utf8mb3";
reportJdbcTemplate.update(createTableClassDifficult);
reportJdbcTemplate.update(createTableProvinceDifficult);
reportJdbcTemplate.update(createTableProvinceExcellentDifficult);
reportJdbcTemplate.update(createTableRegionExcellentDifficult);
reportJdbcTemplate.update(createTableKnowledgeProvinceExcellent);
reportJdbcTemplate.update(createTableKnowledgeRegionExcellent);
reportJdbcTemplate.update(createTableProvinceExcellentAswTime);
reportJdbcTemplate.update(createTableProvinceQuesTypeExcellent);
reportJdbcTemplate.update(createTableRegionDifficult);
reportJdbcTemplate.update(createTableSchoolDifficult);
reportJdbcTemplate.update(createTableRegionExcellentAswTime);
reportJdbcTemplate.update(createTableRegionQuesTypeExcellent);
}
}
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