main
黄海 7 months ago
parent 56eadd6e17
commit f8488cf9a0

@ -24,7 +24,7 @@ public class YunXiaoController extends Controller {
// http://10.10.21.20:9000/QingLong/yx/getStandardSchoolList
@Before(GET.class)
public void getStandardSchoolList() {
List<Record> list=ym.getStandardSchoolList();
List<Record> list = ym.getStandardSchoolList();
renderJson(CommonUtil.renderJsonForLayUI(list));
}
@ -112,9 +112,9 @@ public class YunXiaoController extends Controller {
String tmpDir = System.getProperty("java.io.tmpdir");
//使用guid生成一个临时文件名然后拼接到tmpDir后面生成完整的临时文件路径
String tmpFile = tmpDir + File.separator + UUID.randomUUID() + ".xlsx";
exporter.LessonConstructionExportExcel(tmpFile, list1,list2);
exporter.LessonConstructionExportExcel(tmpFile, list1, list2);
//提供下载
renderFile(new File(tmpFile), "课程建设情况报表.xlsx");
renderFile(new File(tmpFile), "课程建设情况报表.xlsx");
}
/**
@ -126,14 +126,15 @@ public class YunXiaoController extends Controller {
List<Record> list1 = ym.LessonConstructionInfoByXzqh();
List<Record> list2 = ym.LessonConstructionInfoByXzqhStage();
List<Record> list3 = ym.LessonConstructionInfoByXzqhSchool();
List<Record> list4 = ym.LessonConstructionInfo();
YunXiaoExportExcelUtil exporter = new YunXiaoExportExcelUtil();
//获取系统临时目录
String tmpDir = System.getProperty("java.io.tmpdir");
//使用guid生成一个临时文件名然后拼接到tmpDir后面生成完整的临时文件路径
String tmpFile = tmpDir + File.separator + UUID.randomUUID() + ".xlsx";
exporter.LessonConstructionInfoByXzqhSchool(tmpFile, list1,list2,list3);
exporter.LessonConstructionInfoByXzqhSchool(tmpFile, list1, list2, list3,list4);
//提供下载
renderFile(new File(tmpFile), "【区域+学校】课程建设情况报表.xlsx");
renderFile(new File(tmpFile), "【区域+学校】课程建设情况报表.xlsx");
}
}

@ -124,4 +124,9 @@ public class YunXiaoModel {
SqlPara sqlPara = Db.getSqlPara("YunXiao.LessonConstructionInfoByXzqhSchool");
return Db.find(sqlPara);
}
public List<Record> LessonConstructionInfo() {
SqlPara sqlPara = Db.getSqlPara("YunXiao.LessonConstructionInfo");
return Db.find(sqlPara);
}
}

@ -104,7 +104,7 @@ public class YunXiaoExportExcelUtil {
* @param list2
* @param list3
*/
public void LessonConstructionInfoByXzqhSchool(String filePath, List<Record> list1, List<Record> list2, List<Record> list3) {
public void LessonConstructionInfoByXzqhSchool(String filePath, List<Record> list1, List<Record> list2, List<Record> list3, List<Record> list4) {
try (XSSFWorkbook workbook = new XSSFWorkbook()) {
// 创建样式
CellStyle headerStyle = createHeaderStyle(workbook);
@ -175,7 +175,7 @@ public class YunXiaoExportExcelUtil {
XSSFSheet sheet3 = workbook.createSheet("学校课程建设情况");
// 设置列宽
sheet3.setColumnWidth(0, 5000); // 县区名称
sheet3.setColumnWidth(1, 5000); // 学校
sheet3.setColumnWidth(1, 8000); // 学校
sheet3.setColumnWidth(2, 5000); // 课程数量
// 创建表头
headerRow = sheet3.createRow(0);
@ -200,6 +200,47 @@ public class YunXiaoExportExcelUtil {
// 建设数量
createCell(row, 2, record.getStr("c"), dataStyle);
}
//第四个 Sheet
XSSFSheet sheet4 = workbook.createSheet("学校课程建设详情");
// 设置列宽
sheet4.setColumnWidth(0, 8000); // 县区名称
sheet4.setColumnWidth(1, 5000); // 学段
sheet4.setColumnWidth(2, 8000); // 学校
sheet4.setColumnWidth(3, 5000); // 科目
sheet4.setColumnWidth(4, 5000); // 教师
sheet4.setColumnWidth(5, 10000); // 课程名称
// 创建表头
headerRow = sheet4.createRow(0);
headerRow.setHeight((short) (28 * 20));
String[] headers4 = {
"县区名称", "学段", "学校", "科目", "教师", "课程名称"
};
for (int i = 0; i < headers4.length; i++) {
Cell cell = headerRow.createCell(i);
cell.setCellValue(headers4[i]);
cell.setCellStyle(headerStyle);
}
rowNum = 1;
// 填充数据
for (Record record : list4) {
Row row = sheet4.createRow(rowNum++);
row.setHeight((short) (28 * 20));
//县区名称
createCell(row, 0, record.getStr("gather_regionc"), dataStyle);
//学段
createCell(row, 1, record.getStr("stage_name"), dataStyle);
// 学校
createCell(row, 2, record.getStr("organization_name"), dataStyle);
//科目
createCell(row, 3, record.getStr("subject_name"), dataStyle);
// 教师
createCell(row, 4, record.getStr("teacher_name"), dataStyle);
// 课程
createCell(row, 5, record.getStr("lesson_name"), dataStyle);
}
// 保存文件
try (FileOutputStream fileOut = new FileOutputStream(filePath)) {
workbook.write(fileOut);

@ -47,4 +47,13 @@
inner join t_crawler_lesson as t2 on t1.lesson_id=t2.lesson_id
where t1.match_type=0
#end
-- 课程建设的详细情况
#sql("LessonConstructionInfo")
select t2.gather_regionc,t3.stage_name,t2.organization_name,t4.subject_name,t1.teacher_name,t1.lesson_name from t_crawler_lesson as t1
inner join t_crawler_lesson_school as t2 on t1.lesson_id=t2.lesson_id
inner join t_crawler_stage as t3 on t1.stage_id=t3.stage_id
inner join t_crawler_subject as t4 on t1.subject_id=t4.subject_id
where t2.match_type in (1,2,3) order by t2.gather_regionc,t2.organization_name,t4.subject_name,t1.teacher_name
#end
#end
Loading…
Cancel
Save