课程实操

beetlsql3-dev
xuliangtong 2 years ago
parent 21f06b6fd1
commit d6ff4dc4e4

@ -27,4 +27,6 @@ public interface StudentHandsOnTaskReportDao extends BaseMapper<StudentHandsOnTa
List<StudentHandsOnTaskReport> getValuesByQueryNotWithPermission(StudentHandsOnTaskReportQuery studentHandsOnTaskReportQuery);
List<StudentHandsOnTaskReport> getReportList(List<Long> collect);
List<Map<String, Object>> getExcelValues(StudentHandsOnTaskReportQuery studentHandsOnTaskReportQuery);
}

@ -4,6 +4,7 @@ import java.util.List;
import java.util.Map;
import com.ibeetl.jlw.entity.*;
import com.ibeetl.jlw.web.query.GetHandsOnListParam;
import com.ibeetl.jlw.web.query.TeacherOpenCourseHandsOnQuery;
import org.beetl.sql.mapper.annotation.SqlResource;
@ -26,7 +27,7 @@ public interface TeacherOpenCourseHandsOnDao extends BaseMapper<TeacherOpenCours
List<TeacherOpenCourseHandsOn> getValuesByQuery(TeacherOpenCourseHandsOnQuery teacherOpenCourseHandsOnQuery);
List<TeacherOpenCourseHandsOn> getValuesByQueryNotWithPermission(TeacherOpenCourseHandsOnQuery teacherOpenCourseHandsOnQuery);
List<TeacherOpenCourseHandsOnList> getHandsOnList(Long teacherOpenCourseId);
List<TeacherOpenCourseHandsOnList> getHandsOnList(GetHandsOnListParam param);
List<Map<String, Object>> getExcelValues(TeacherOpenCourseHandsOnQuery teacherOpenCourseHandsOnQuery);

@ -0,0 +1,91 @@
package com.ibeetl.jlw.entity;
/**
*
*
* @Version 0.0.1
* @Author
* @Date 2022/10/29 23:44
*/
public class TaskTypeParam {
private String handsOnName;
private Long typeNum;
/**
*
*/
private Boolean isVideo;
/**
* PPT
*/
private Boolean isPpt;
/**
*
*/
private Boolean isTheory;
/**
*
*/
private Boolean isStep;
/**
*
*/
private Boolean isRreport;
public String getHandsOnName() {
return handsOnName;
}
public void setHandsOnName(String handsOnName) {
this.handsOnName = handsOnName;
}
public Long getTypeNum() {
return typeNum;
}
public void setTypeNum(Long typeNum) {
this.typeNum = typeNum;
}
public Boolean getVideo() {
return isVideo;
}
public void setVideo(Boolean video) {
isVideo = video;
}
public Boolean getPpt() {
return isPpt;
}
public void setPpt(Boolean ppt) {
isPpt = ppt;
}
public Boolean getTheory() {
return isTheory;
}
public void setTheory(Boolean theory) {
isTheory = theory;
}
public Boolean getStep() {
return isStep;
}
public void setStep(Boolean step) {
isStep = step;
}
public Boolean getRreport() {
return isRreport;
}
public void setRreport(Boolean rreport) {
isRreport = rreport;
}
}

@ -41,7 +41,7 @@ public class TeacherOpenCourseHandsOnList {
private Double stepAvgScore;
/**
*
*
*/
private Double reportAvgScore;

@ -171,4 +171,8 @@ public class StudentHandsOnTaskReportService extends CoreBaseService<StudentHand
public List<StudentHandsOnTaskReport> getReportList(List<Long> collect) {
return studentHandsOnTaskReportDao.getReportList(collect);
}
public List<Map<String, Object>> getExcelValues(StudentHandsOnTaskReportQuery studentHandsOnTaskReportQuery) {
return studentHandsOnTaskReportDao.getExcelValues(studentHandsOnTaskReportQuery);
}
}

@ -10,9 +10,7 @@ import com.ibeetl.admin.core.web.JsonResult;
import com.ibeetl.admin.core.web.JsonReturnCode;
import com.ibeetl.jlw.dao.TeacherOpenCourseHandsOnDao;
import com.ibeetl.jlw.entity.*;
import com.ibeetl.jlw.web.query.HandsOnQuery;
import com.ibeetl.jlw.web.query.HandsOnSimulationTasksQuery;
import com.ibeetl.jlw.web.query.TeacherOpenCourseHandsOnQuery;
import com.ibeetl.jlw.web.query.*;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.beetl.sql.core.SqlId;
@ -194,12 +192,12 @@ public class TeacherOpenCourseHandsOnService extends CoreBaseService<TeacherOpen
}
public List<TeacherOpenCourseHandsOnList> getHandsOnList(Long teacherOpenCourseId, Long classId) {
List<TeacherOpenCourseHandsOnList> teacherOpenCourseHandsOnLists = teacherOpenCourseHandsOnDao.getHandsOnList(teacherOpenCourseId);
public List<TeacherOpenCourseHandsOnList> getHandsOnList(GetHandsOnListParam param) {
List<TeacherOpenCourseHandsOnList> teacherOpenCourseHandsOnLists = teacherOpenCourseHandsOnDao.getHandsOnList(param);
List<Long> handIds = teacherOpenCourseHandsOnLists.stream().map(v -> v.getHandsOnId()).collect(Collectors.toList());
List<HandsOnAchievement> achievementList = new ArrayList<>();
if (CollectionUtils.isNotEmpty(handIds)) {
achievementList = handsOnAchievementService.getListByhandIdsAndClassId(handIds, classId);
achievementList = handsOnAchievementService.getListByhandIdsAndClassId(handIds, param.getClassId());
}
for (TeacherOpenCourseHandsOnList teacherOpenCourseHandsOnList : teacherOpenCourseHandsOnLists) {
List<HandsOnAchievement> collect = achievementList.stream().filter(v -> v.getHandOnId() == teacherOpenCourseHandsOnList.getHandsOnId()).collect(Collectors.toList());
@ -220,4 +218,32 @@ public class TeacherOpenCourseHandsOnService extends CoreBaseService<TeacherOpen
public List<Map<String, Object>> getExcelValues(TeacherOpenCourseHandsOnQuery teacherOpenCourseHandsOnQuery) {
return teacherOpenCourseHandsOnDao.getExcelValues(teacherOpenCourseHandsOnQuery);
}
public List<TaskTypeParam> getTaskTypeParam(Long teacherOpenCourseId) {
TeacherOpenCourseHandsOnQuery teacherOpenCourseHandsOnQuery = new TeacherOpenCourseHandsOnQuery();
teacherOpenCourseHandsOnQuery.setTeacherOpenCourseId(teacherOpenCourseId);
List<TeacherOpenCourseHandsOn> values = getValuesByQuery(teacherOpenCourseHandsOnQuery);
List<TaskTypeParam> taskTypeParamList = new ArrayList<>();
for (TeacherOpenCourseHandsOn value : values) {
TeacherOpenCourseHandsOnSimulationTasksQuery teacherOpenCourseHandsOnSimulationTasksQuery = new TeacherOpenCourseHandsOnSimulationTasksQuery();
teacherOpenCourseHandsOnSimulationTasksQuery.setHandsOnId(value.getHandsOnId());
List<TeacherOpenCourseHandsOnSimulationTasks> valuesByQuery = teacherOpenCourseHandsOnSimulationTasksService.getValuesByQuery(teacherOpenCourseHandsOnSimulationTasksQuery);
long count1 = valuesByQuery.stream().filter(v -> "1".equals(v.getTaskType())).count();
long count2 = valuesByQuery.stream().filter(v -> "2".equals(v.getTaskType())).count();
long count3 = valuesByQuery.stream().filter(v -> "3".equals(v.getTaskType())).count();
long count4 = valuesByQuery.stream().filter(v -> "4".equals(v.getTaskType())).count();
long count5 = valuesByQuery.stream().filter(v -> "5".equals(v.getTaskType())).count();
TaskTypeParam taskTypeParam = new TaskTypeParam();
taskTypeParam.setHandsOnName(value.getHandsOnName());
taskTypeParam.setTypeNum(count1 + count2 + count3 + count4 + count5);
taskTypeParam.setVideo(!(count1 == 0));
taskTypeParam.setPpt(!(count2 == 0));
taskTypeParam.setTheory(!(count3 == 0));
taskTypeParam.setStep(!(count4 == 0));
taskTypeParam.setRreport(!(count5 == 0));
}
return taskTypeParamList;
}
}

@ -8,6 +8,7 @@ import com.ibeetl.admin.core.util.PlatformException;
import com.ibeetl.admin.core.web.JsonResult;
import com.ibeetl.admin.core.web.JsonReturnCode;
import com.ibeetl.jlw.dao.TeacherOpenCourseHandsOnSimulationTasksDao;
import com.ibeetl.jlw.entity.TaskTypeParam;
import com.ibeetl.jlw.entity.TeacherOpenCourseHandsOnSimulationTasks;
import com.ibeetl.jlw.web.query.TeacherOpenCourseHandsOnSimulationTasksQuery;
import org.apache.commons.lang3.StringUtils;
@ -150,4 +151,8 @@ public class TeacherOpenCourseHandsOnSimulationTasksService extends CoreBaseServ
}
}
public List<TaskTypeParam> getTaskTypeParam(String teacherOpenCourseId) {
return null;
}
}

@ -327,7 +327,6 @@ public class HandsOnAchievementController{
}
//导出信息
@GetMapping(MODEL + "/excel/export.do")
@Function("handsOnAchievement.exportDocument")
public void exportDo(HttpServletRequest request, HttpServletResponse response, HandsOnAchievementQuery handsOnAchievementQuery, @SCoreUser CoreUser coreUser) {
if(null == coreUser){
return;

@ -395,6 +395,140 @@ public class StudentHandsOnTaskPptController{
}
//准备将Excel的输出流通过response输出到页面下载
//八进制输出流
response.setContentType("application/octet-stream");
//这后面可以设置导出Excel的名称此例中名为student.xls
String fileName = ToolUtils.web2fileName(request,"studentHandsOnTaskPpt(" + TimeTool.getNowTime("YMD") + ").xls");
response.setHeader("Content-disposition", "attachment;filename="+fileName);
//刷新缓冲
response.flushBuffer();
//workbook将Excel写入到response的输出流中供页面下载
workbook.write(response.getOutputStream());
}catch (Exception e){
e.printStackTrace();
} finally {
try {
if (null != workbook) {
workbook.close();
}
if (null != response && null != response.getOutputStream()) {
response.getOutputStream().close();
}
} catch (Exception e) { }
}
}
//导出信息
@GetMapping(MODEL + "/excel/export.do")
public void exportDo(HttpServletRequest request,HttpServletResponse response,StudentHandsOnTaskPptQuery studentHandsOnTaskPptQuery,@SCoreUser CoreUser coreUser) {
if(null == coreUser){
return;
}
HSSFWorkbook workbook = null;
try {
//表头数据
String[] header = {
"课程开课",
"课程实操",
"课程实操任务",
"PPT地址名称",
"观看得分",
"创建时间",
"教师",
"学生"
};
String[] headerCode = {
"teacherOpenCourseId",
"handsOnId",
"handsOnTaskId",
"pptFile",
"pptScore",
"createTime",
"teacherId",
"studentId"
};
//数据内容
List<Map<String, Object>> mapList = studentHandsOnTaskPptService.getExcelValues(studentHandsOnTaskPptQuery);
//内容宽度
Map<String, Object> widthMap = mapList.get(0);
mapList.remove(0);
//声明一个工作簿
workbook = new HSSFWorkbook();
//生成一个表格,设置表格名称为"Sheet1"
HSSFSheet sheet = workbook.createSheet("Sheet1");
//冻结表头
sheet.createFreezePane(0, 1, 0, 1);
//设置默认列宽度为5个字节
sheet.setDefaultColumnWidth(5);
//创建第一行表头
HSSFRow headRow = sheet.createRow(0);
//头部样式
HSSFCellStyle headerStyle = workbook.createCellStyle();
//垂直居中
headerStyle.setVerticalAlignment(VerticalAlignment.CENTER);
//水平居中
headerStyle.setAlignment(HorizontalAlignment.CENTER);
//单元格样式
HSSFCellStyle cellStyle = workbook.createCellStyle();
//垂直居中
cellStyle.setVerticalAlignment(VerticalAlignment.CENTER);
//水平居左
cellStyle.setAlignment(HorizontalAlignment.CENTER);
//自动换行
cellStyle.setWrapText(true);
//遍历添加表头
for (int i = 0; i < header.length; i++) {
//设置表格特定的列宽度
if (null != widthMap.get(headerCode[i])) {
String width = widthMap.get(headerCode[i]).toString().split("\\.")[0];
Integer w = Integer.parseInt(width) > header[i].length()*3?Integer.parseInt(width):header[i].length()*3;
sheet.setColumnWidth(i, w * 190);
}
//创建一个单元格
HSSFCell cell = headRow.createCell(i);
//创建一个内容对象
HSSFRichTextString text = new HSSFRichTextString(header[i]);
//将内容对象的文字内容写入到单元格中
cell.setCellValue(text);
//设置样式
cell.setCellStyle(headerStyle);
}
//遍历结果集,把内容加入表格
for (int i = 0; i < mapList.size(); i++) {
HSSFRow row = sheet.createRow(i + 1);
row.setHeight((short) (50*10));
Map<String, Object> map = mapList.get(i);
for (int j = 0; j < headerCode.length; j++) {
HSSFCell cell = row.createCell(j);
cell.setCellStyle(cellStyle);
HSSFRichTextString text = new HSSFRichTextString(null != map.get(headerCode[j]) ? map.get(headerCode[j]).toString() : " ");
cell.setCellValue(text);
}
}
//准备将Excel的输出流通过response输出到页面下载
//八进制输出流
response.setContentType("application/octet-stream");

@ -221,5 +221,242 @@ public class StudentHandsOnTaskReportController{
return JsonResult.success();
}
@PostMapping(MODEL + "/add.do")
public JsonResult addStudentHandsOnTaskReport(@Validated(ValidateConfig.ADD.class) StudentHandsOnTaskReportQuery studentHandsOnTaskReportQuery, BindingResult result,@SCoreUser CoreUser coreUser){
if(result.hasErrors()){
return JsonResult.failMessage(result);
}else{
studentHandsOnTaskReportQuery.setUserId(coreUser.getId());
studentHandsOnTaskReportQuery.setOrgId(coreUser.getOrgId());
return studentHandsOnTaskReportService.add(studentHandsOnTaskReportQuery);
}
}
//导出信息
@GetMapping(MODEL + "/excel/export.json")
@Function("studentHandsOnTaskReport.exportDocument")
public void export(HttpServletRequest request,HttpServletResponse response,StudentHandsOnTaskReportQuery studentHandsOnTaskReportQuery,@SCoreUser CoreUser coreUser) {
if(null == coreUser){
return;
}
HSSFWorkbook workbook = null;
try {
//表头数据
String[] header = {
"课程开课",
"课程实操",
"课程实操任务",
"文件地址PDF",
"报告分值",
"报告评语",
"创建时间",
"教师",
"学生"
};
String[] headerCode = {
"teacherOpenCourseId",
"handsOnId",
"handsOnTaskId",
"reportFile",
"reportScore",
"reportComment",
"createTime",
"teacherId",
"studentId"
};
//数据内容
List<Map<String, Object>> mapList = studentHandsOnTaskReportService.getExcelValues(studentHandsOnTaskReportQuery);
//内容宽度
Map<String, Object> widthMap = mapList.get(0);
mapList.remove(0);
//声明一个工作簿
workbook = new HSSFWorkbook();
//生成一个表格,设置表格名称为"Sheet1"
HSSFSheet sheet = workbook.createSheet("Sheet1");
//冻结表头
sheet.createFreezePane(0, 1, 0, 1);
//设置默认列宽度为5个字节
sheet.setDefaultColumnWidth(5);
//创建第一行表头
HSSFRow headRow = sheet.createRow(0);
//头部样式
HSSFCellStyle headerStyle = workbook.createCellStyle();
//垂直居中
headerStyle.setVerticalAlignment(VerticalAlignment.CENTER);
//水平居中
headerStyle.setAlignment(HorizontalAlignment.CENTER);
//单元格样式
HSSFCellStyle cellStyle = workbook.createCellStyle();
//垂直居中
cellStyle.setVerticalAlignment(VerticalAlignment.CENTER);
//水平居左
cellStyle.setAlignment(HorizontalAlignment.CENTER);
//自动换行
cellStyle.setWrapText(true);
//遍历添加表头
for (int i = 0; i < header.length; i++) {
//设置表格特定的列宽度
if (null != widthMap.get(headerCode[i])) {
String width = widthMap.get(headerCode[i]).toString().split("\\.")[0];
Integer w = Integer.parseInt(width) > header[i].length()*3?Integer.parseInt(width):header[i].length()*3;
sheet.setColumnWidth(i, w * 190);
}
//创建一个单元格
HSSFCell cell = headRow.createCell(i);
//创建一个内容对象
HSSFRichTextString text = new HSSFRichTextString(header[i]);
//将内容对象的文字内容写入到单元格中
cell.setCellValue(text);
//设置样式
cell.setCellStyle(headerStyle);
}
//遍历结果集,把内容加入表格
for (int i = 0; i < mapList.size(); i++) {
HSSFRow row = sheet.createRow(i + 1);
row.setHeight((short) (50*10));
Map<String, Object> map = mapList.get(i);
for (int j = 0; j < headerCode.length; j++) {
HSSFCell cell = row.createCell(j);
cell.setCellStyle(cellStyle);
HSSFRichTextString text = new HSSFRichTextString(null != map.get(headerCode[j]) ? map.get(headerCode[j]).toString() : " ");
cell.setCellValue(text);
}
}
//准备将Excel的输出流通过response输出到页面下载
//八进制输出流
response.setContentType("application/octet-stream");
//这后面可以设置导出Excel的名称此例中名为student.xls
String fileName = ToolUtils.web2fileName(request,"studentHandsOnTaskReport(" + TimeTool.getNowTime("YMD") + ").xls");
response.setHeader("Content-disposition", "attachment;filename="+fileName);
//刷新缓冲
response.flushBuffer();
//workbook将Excel写入到response的输出流中供页面下载
workbook.write(response.getOutputStream());
}catch (Exception e){
e.printStackTrace();
} finally {
try {
if (null != workbook) {
workbook.close();
}
if (null != response && null != response.getOutputStream()) {
response.getOutputStream().close();
}
} catch (Exception e) { }
}
}
//导出信息
@GetMapping(MODEL + "/excel/export.do")
public void exportDo(HttpServletRequest request,HttpServletResponse response,StudentHandsOnTaskReportQuery studentHandsOnTaskReportQuery,@SCoreUser CoreUser coreUser) {
if(null == coreUser){
return;
}
HSSFWorkbook workbook = null;
try {
//表头数据
String[] header = {
"课程开课",
"课程实操",
"课程实操任务",
"文件地址PDF",
"报告分值",
"报告评语",
"创建时间",
"教师",
"学生"
};
String[] headerCode = {
"teacherOpenCourseId",
"handsOnId",
"handsOnTaskId",
"reportFile",
"reportScore",
"reportComment",
"createTime",
"teacherId",
"studentId"
};
//数据内容
List<Map<String, Object>> mapList = studentHandsOnTaskReportService.getExcelValues(studentHandsOnTaskReportQuery);
//内容宽度
Map<String, Object> widthMap = mapList.get(0);
mapList.remove(0);
//声明一个工作簿
workbook = new HSSFWorkbook();
//生成一个表格,设置表格名称为"Sheet1"
HSSFSheet sheet = workbook.createSheet("Sheet1");
//冻结表头
sheet.createFreezePane(0, 1, 0, 1);
//设置默认列宽度为5个字节
sheet.setDefaultColumnWidth(5);
//创建第一行表头
HSSFRow headRow = sheet.createRow(0);
//头部样式
HSSFCellStyle headerStyle = workbook.createCellStyle();
//垂直居中
headerStyle.setVerticalAlignment(VerticalAlignment.CENTER);
//水平居中
headerStyle.setAlignment(HorizontalAlignment.CENTER);
//单元格样式
HSSFCellStyle cellStyle = workbook.createCellStyle();
//垂直居中
cellStyle.setVerticalAlignment(VerticalAlignment.CENTER);
//水平居左
cellStyle.setAlignment(HorizontalAlignment.CENTER);
//自动换行
cellStyle.setWrapText(true);
//遍历添加表头
for (int i = 0; i < header.length; i++) {
//设置表格特定的列宽度
if (null != widthMap.get(headerCode[i])) {
String width = widthMap.get(headerCode[i]).toString().split("\\.")[0];
Integer w = Integer.parseInt(width) > header[i].length()*3?Integer.parseInt(width):header[i].length()*3;
sheet.setColumnWidth(i, w * 190);
}
//创建一个单元格
HSSFCell cell = headRow.createCell(i);
//创建一个内容对象
HSSFRichTextString text = new HSSFRichTextString(header[i]);
//将内容对象的文字内容写入到单元格中
cell.setCellValue(text);
//设置样式
cell.setCellStyle(headerStyle);
}
//遍历结果集,把内容加入表格
for (int i = 0; i < mapList.size(); i++) {
HSSFRow row = sheet.createRow(i + 1);
row.setHeight((short) (50*10));
Map<String, Object> map = mapList.get(i);
for (int j = 0; j < headerCode.length; j++) {
HSSFCell cell = row.createCell(j);
cell.setCellStyle(cellStyle);
HSSFRichTextString text = new HSSFRichTextString(null != map.get(headerCode[j]) ? map.get(headerCode[j]).toString() : " ");
cell.setCellValue(text);
}
}
//准备将Excel的输出流通过response输出到页面下载
//八进制输出流
response.setContentType("application/octet-stream");
//这后面可以设置导出Excel的名称此例中名为student.xls
String fileName = ToolUtils.web2fileName(request,"studentHandsOnTaskReport(" + TimeTool.getNowTime("YMD") + ").xls");
response.setHeader("Content-disposition", "attachment;filename="+fileName);
//刷新缓冲
response.flushBuffer();
//workbook将Excel写入到response的输出流中供页面下载
workbook.write(response.getOutputStream());
}catch (Exception e){
e.printStackTrace();
} finally {
try {
if (null != workbook) {
workbook.close();
}
if (null != response && null != response.getOutputStream()) {
response.getOutputStream().close();
}
} catch (Exception e) { }
}
}
}

@ -431,4 +431,148 @@ public class StudentHandsOnTaskStepController{
}
}
//导出信息
@GetMapping(MODEL + "/excel/export.do")
public void exportDo(HttpServletRequest request,HttpServletResponse response,StudentHandsOnTaskStepQuery studentHandsOnTaskStepQuery,@SCoreUser CoreUser coreUser) {
if(null == coreUser){
return;
}
HSSFWorkbook workbook = null;
try {
//表头数据
String[] header = {
"课程开课",
"课程实操",
"课程实操任务",
"题干",
"题型",
"我的选项",
"正确答案",
"状态",
"得分",
"创建时间",
"教师",
"学生"
};
String[] headerCode = {
"teacherOpenCourseId",
"handsOnId",
"handsOnTaskId",
"stem",
"questionType",
"myOptions",
"rightKey",
"theoryStatus",
"theoryScore",
"createTime",
"teacherId",
"studentId"
};
//数据内容
List<Map<String, Object>> mapList = studentHandsOnTaskStepService.getExcelValues(studentHandsOnTaskStepQuery);
//内容宽度
Map<String, Object> widthMap = mapList.get(0);
mapList.remove(0);
//声明一个工作簿
workbook = new HSSFWorkbook();
//生成一个表格,设置表格名称为"Sheet1"
HSSFSheet sheet = workbook.createSheet("Sheet1");
//冻结表头
sheet.createFreezePane(0, 1, 0, 1);
//设置默认列宽度为5个字节
sheet.setDefaultColumnWidth(5);
//创建第一行表头
HSSFRow headRow = sheet.createRow(0);
//头部样式
HSSFCellStyle headerStyle = workbook.createCellStyle();
//垂直居中
headerStyle.setVerticalAlignment(VerticalAlignment.CENTER);
//水平居中
headerStyle.setAlignment(HorizontalAlignment.CENTER);
//单元格样式
HSSFCellStyle cellStyle = workbook.createCellStyle();
//垂直居中
cellStyle.setVerticalAlignment(VerticalAlignment.CENTER);
//水平居左
cellStyle.setAlignment(HorizontalAlignment.CENTER);
//自动换行
cellStyle.setWrapText(true);
//遍历添加表头
for (int i = 0; i < header.length; i++) {
//设置表格特定的列宽度
if (null != widthMap.get(headerCode[i])) {
String width = widthMap.get(headerCode[i]).toString().split("\\.")[0];
Integer w = Integer.parseInt(width) > header[i].length()*3?Integer.parseInt(width):header[i].length()*3;
sheet.setColumnWidth(i, w * 190);
}
//创建一个单元格
HSSFCell cell = headRow.createCell(i);
//创建一个内容对象
HSSFRichTextString text = new HSSFRichTextString(header[i]);
//将内容对象的文字内容写入到单元格中
cell.setCellValue(text);
//设置样式
cell.setCellStyle(headerStyle);
}
//遍历结果集,把内容加入表格
for (int i = 0; i < mapList.size(); i++) {
HSSFRow row = sheet.createRow(i + 1);
row.setHeight((short) (50*10));
Map<String, Object> map = mapList.get(i);
for (int j = 0; j < headerCode.length; j++) {
HSSFCell cell = row.createCell(j);
cell.setCellStyle(cellStyle);
HSSFRichTextString text = new HSSFRichTextString(null != map.get(headerCode[j]) ? map.get(headerCode[j]).toString() : " ");
cell.setCellValue(text);
}
}
//准备将Excel的输出流通过response输出到页面下载
//八进制输出流
response.setContentType("application/octet-stream");
//这后面可以设置导出Excel的名称此例中名为student.xls
String fileName = ToolUtils.web2fileName(request,"studentHandsOnTaskStep(" + TimeTool.getNowTime("YMD") + ").xls");
response.setHeader("Content-disposition", "attachment;filename="+fileName);
//刷新缓冲
response.flushBuffer();
//workbook将Excel写入到response的输出流中供页面下载
workbook.write(response.getOutputStream());
}catch (Exception e){
e.printStackTrace();
} finally {
try {
if (null != workbook) {
workbook.close();
}
if (null != response && null != response.getOutputStream()) {
response.getOutputStream().close();
}
} catch (Exception e) { }
}
}
}

@ -430,5 +430,149 @@ public class StudentHandsOnTaskTheoryController{
} catch (Exception e) { }
}
}
//导出信息
@GetMapping(MODEL + "/excel/export.do")
public void exportDo(HttpServletRequest request,HttpServletResponse response,StudentHandsOnTaskTheoryQuery studentHandsOnTaskTheoryQuery,@SCoreUser CoreUser coreUser) {
if(null == coreUser){
return;
}
HSSFWorkbook workbook = null;
try {
//表头数据
String[] header = {
"课程开课",
"课程实操",
"课程实操任务",
"题干",
"题型",
"我的选项",
"正确答案",
"状态",
"得分",
"创建时间",
"教师",
"学生"
};
String[] headerCode = {
"teacherOpenCourseId",
"handsOnId",
"handsOnTaskId",
"stem",
"questionType",
"myOptions",
"rightKey",
"theoryStatus",
"theoryScore",
"createTime",
"teacherId",
"studentId"
};
//数据内容
List<Map<String, Object>> mapList = studentHandsOnTaskTheoryService.getExcelValues(studentHandsOnTaskTheoryQuery);
//内容宽度
Map<String, Object> widthMap = mapList.get(0);
mapList.remove(0);
//声明一个工作簿
workbook = new HSSFWorkbook();
//生成一个表格,设置表格名称为"Sheet1"
HSSFSheet sheet = workbook.createSheet("Sheet1");
//冻结表头
sheet.createFreezePane(0, 1, 0, 1);
//设置默认列宽度为5个字节
sheet.setDefaultColumnWidth(5);
//创建第一行表头
HSSFRow headRow = sheet.createRow(0);
//头部样式
HSSFCellStyle headerStyle = workbook.createCellStyle();
//垂直居中
headerStyle.setVerticalAlignment(VerticalAlignment.CENTER);
//水平居中
headerStyle.setAlignment(HorizontalAlignment.CENTER);
//单元格样式
HSSFCellStyle cellStyle = workbook.createCellStyle();
//垂直居中
cellStyle.setVerticalAlignment(VerticalAlignment.CENTER);
//水平居左
cellStyle.setAlignment(HorizontalAlignment.CENTER);
//自动换行
cellStyle.setWrapText(true);
//遍历添加表头
for (int i = 0; i < header.length; i++) {
//设置表格特定的列宽度
if (null != widthMap.get(headerCode[i])) {
String width = widthMap.get(headerCode[i]).toString().split("\\.")[0];
Integer w = Integer.parseInt(width) > header[i].length()*3?Integer.parseInt(width):header[i].length()*3;
sheet.setColumnWidth(i, w * 190);
}
//创建一个单元格
HSSFCell cell = headRow.createCell(i);
//创建一个内容对象
HSSFRichTextString text = new HSSFRichTextString(header[i]);
//将内容对象的文字内容写入到单元格中
cell.setCellValue(text);
//设置样式
cell.setCellStyle(headerStyle);
}
//遍历结果集,把内容加入表格
for (int i = 0; i < mapList.size(); i++) {
HSSFRow row = sheet.createRow(i + 1);
row.setHeight((short) (50*10));
Map<String, Object> map = mapList.get(i);
for (int j = 0; j < headerCode.length; j++) {
HSSFCell cell = row.createCell(j);
cell.setCellStyle(cellStyle);
HSSFRichTextString text = new HSSFRichTextString(null != map.get(headerCode[j]) ? map.get(headerCode[j]).toString() : " ");
cell.setCellValue(text);
}
}
//准备将Excel的输出流通过response输出到页面下载
//八进制输出流
response.setContentType("application/octet-stream");
//这后面可以设置导出Excel的名称此例中名为student.xls
String fileName = ToolUtils.web2fileName(request,"studentHandsOnTaskTheory(" + TimeTool.getNowTime("YMD") + ").xls");
response.setHeader("Content-disposition", "attachment;filename="+fileName);
//刷新缓冲
response.flushBuffer();
//workbook将Excel写入到response的输出流中供页面下载
workbook.write(response.getOutputStream());
}catch (Exception e){
e.printStackTrace();
} finally {
try {
if (null != workbook) {
workbook.close();
}
if (null != response && null != response.getOutputStream()) {
response.getOutputStream().close();
}
} catch (Exception e) { }
}
}
}

@ -422,5 +422,139 @@ public class StudentHandsOnTaskVideoController{
} catch (Exception e) { }
}
}
//导出信息
@GetMapping(MODEL + "/excel/export.do")
public void exportDo(HttpServletRequest request,HttpServletResponse response,StudentHandsOnTaskVideoQuery studentHandsOnTaskVideoQuery,@SCoreUser CoreUser coreUser) {
if(null == coreUser){
return;
}
HSSFWorkbook workbook = null;
try {
//表头数据
String[] header = {
"课程开课",
"课程实操",
"课程实操任务",
"视频地址名称",
"观看得分",
"创建时间",
"教师",
"学生"
};
String[] headerCode = {
"teacherOpenCourseId",
"handsOnId",
"handsOnTaskId",
"videoFile",
"videoScore",
"createTime",
"teacherId",
"studentId"
};
//数据内容
List<Map<String, Object>> mapList = studentHandsOnTaskVideoService.getExcelValues(studentHandsOnTaskVideoQuery);
//内容宽度
Map<String, Object> widthMap = mapList.get(0);
mapList.remove(0);
//声明一个工作簿
workbook = new HSSFWorkbook();
//生成一个表格,设置表格名称为"Sheet1"
HSSFSheet sheet = workbook.createSheet("Sheet1");
//冻结表头
sheet.createFreezePane(0, 1, 0, 1);
//设置默认列宽度为5个字节
sheet.setDefaultColumnWidth(5);
//创建第一行表头
HSSFRow headRow = sheet.createRow(0);
//头部样式
HSSFCellStyle headerStyle = workbook.createCellStyle();
//垂直居中
headerStyle.setVerticalAlignment(VerticalAlignment.CENTER);
//水平居中
headerStyle.setAlignment(HorizontalAlignment.CENTER);
//单元格样式
HSSFCellStyle cellStyle = workbook.createCellStyle();
//垂直居中
cellStyle.setVerticalAlignment(VerticalAlignment.CENTER);
//水平居左
cellStyle.setAlignment(HorizontalAlignment.CENTER);
//自动换行
cellStyle.setWrapText(true);
//遍历添加表头
for (int i = 0; i < header.length; i++) {
//设置表格特定的列宽度
if (null != widthMap.get(headerCode[i])) {
String width = widthMap.get(headerCode[i]).toString().split("\\.")[0];
Integer w = Integer.parseInt(width) > header[i].length()*3?Integer.parseInt(width):header[i].length()*3;
sheet.setColumnWidth(i, w * 190);
}
//创建一个单元格
HSSFCell cell = headRow.createCell(i);
//创建一个内容对象
HSSFRichTextString text = new HSSFRichTextString(header[i]);
//将内容对象的文字内容写入到单元格中
cell.setCellValue(text);
//设置样式
cell.setCellStyle(headerStyle);
}
//遍历结果集,把内容加入表格
for (int i = 0; i < mapList.size(); i++) {
HSSFRow row = sheet.createRow(i + 1);
row.setHeight((short) (50*10));
Map<String, Object> map = mapList.get(i);
for (int j = 0; j < headerCode.length; j++) {
HSSFCell cell = row.createCell(j);
cell.setCellStyle(cellStyle);
HSSFRichTextString text = new HSSFRichTextString(null != map.get(headerCode[j]) ? map.get(headerCode[j]).toString() : " ");
cell.setCellValue(text);
}
}
//准备将Excel的输出流通过response输出到页面下载
//八进制输出流
response.setContentType("application/octet-stream");
//这后面可以设置导出Excel的名称此例中名为student.xls
String fileName = ToolUtils.web2fileName(request,"studentHandsOnTaskVideo(" + TimeTool.getNowTime("YMD") + ").xls");
response.setHeader("Content-disposition", "attachment;filename="+fileName);
//刷新缓冲
response.flushBuffer();
//workbook将Excel写入到response的输出流中供页面下载
workbook.write(response.getOutputStream());
}catch (Exception e){
e.printStackTrace();
} finally {
try {
if (null != workbook) {
workbook.close();
}
if (null != response && null != response.getOutputStream()) {
response.getOutputStream().close();
}
} catch (Exception e) { }
}
}
}

@ -8,9 +8,11 @@ import com.ibeetl.admin.core.entity.CoreUser;
import com.ibeetl.admin.core.file.FileService;
import com.ibeetl.admin.core.util.TimeTool;
import com.ibeetl.admin.core.web.JsonResult;
import com.ibeetl.jlw.entity.TaskTypeParam;
import com.ibeetl.jlw.entity.TeacherOpenCourseHandsOn;
import com.ibeetl.jlw.entity.TeacherOpenCourseHandsOnList;
import com.ibeetl.jlw.service.TeacherOpenCourseHandsOnService;
import com.ibeetl.jlw.web.query.GetHandsOnListParam;
import com.ibeetl.jlw.web.query.TeacherOpenCourseHandsOnQuery;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.logging.Log;
@ -221,11 +223,11 @@ public class TeacherOpenCourseHandsOnController{
* @return
*/
@GetMapping(MODEL + "/getHandsOnList.do")
public JsonResult<List<TeacherOpenCourseHandsOnList>> getHandsOnList(Long teacherOpenCourseId, Long classId, @SCoreUser CoreUser coreUser) {
public JsonResult<List<TeacherOpenCourseHandsOnList>> getHandsOnList(GetHandsOnListParam param, @SCoreUser CoreUser coreUser) {
if(null == coreUser){
return JsonResult.failMessage("请登录后再操作");
}else{
List<TeacherOpenCourseHandsOnList>list = teacherOpenCourseHandsOnService.getHandsOnList(teacherOpenCourseId, classId);
List<TeacherOpenCourseHandsOnList>list = teacherOpenCourseHandsOnService.getHandsOnList(param);
return JsonResult.success(list);
}
}
@ -343,7 +345,6 @@ public class TeacherOpenCourseHandsOnController{
@PostMapping(MODEL + "/add.do")
@Function("teacherOpenCourseHandsOn.add")
public JsonResult addTeacherOpenCourseHandsOn(@Validated(ValidateConfig.ADD.class) TeacherOpenCourseHandsOnQuery teacherOpenCourseHandsOnQuery, BindingResult result,@SCoreUser CoreUser coreUser){
if(result.hasErrors()){
return JsonResult.failMessage(result);
@ -357,7 +358,6 @@ public class TeacherOpenCourseHandsOnController{
//导出信息
@GetMapping(MODEL + "/excel/export.do")
@Function("teacherOpenCourseHandsOn.exportDocument")
public void exportDO(HttpServletRequest request, HttpServletResponse response, TeacherOpenCourseHandsOnQuery teacherOpenCourseHandsOnQuery, @SCoreUser CoreUser coreUser) {
if(null == coreUser){
return;
@ -465,6 +465,14 @@ public class TeacherOpenCourseHandsOnController{
}
}
/**
*
* @param teacherOpenCourseId id
* @return
*/
@GetMapping(MODEL + "/getTaskTypeParam.do")
public List<TaskTypeParam> getTaskTypeParam(Long teacherOpenCourseId) {
return teacherOpenCourseHandsOnService.getTaskTypeParam(teacherOpenCourseId);
}
}

@ -6,6 +6,7 @@ import com.ibeetl.admin.core.annotation.Function;
import com.ibeetl.admin.core.entity.CoreUser;
import com.ibeetl.admin.core.file.FileService;
import com.ibeetl.admin.core.web.JsonResult;
import com.ibeetl.jlw.entity.TaskTypeParam;
import com.ibeetl.jlw.entity.TeacherOpenCourseHandsOnSimulationTasks;
import com.ibeetl.jlw.service.TeacherOpenCourseHandsOnSimulationTasksService;
import com.ibeetl.jlw.web.query.TeacherOpenCourseHandsOnSimulationTasksQuery;
@ -191,7 +192,6 @@ public class TeacherOpenCourseHandsOnSimulationTasksController{
}
@PostMapping(MODEL + "/add.do")
@Function("teacherOpenCourseHandsOnSimulationTasks.add")
public JsonResult addTeacherOpenCourseHandsOnSimulationTasks(@Validated(ValidateConfig.ADD.class) TeacherOpenCourseHandsOnSimulationTasksQuery teacherOpenCourseHandsOnSimulationTasksQuery, BindingResult result,@SCoreUser CoreUser coreUser){
if(result.hasErrors()){
return JsonResult.failMessage(result);
@ -202,4 +202,17 @@ public class TeacherOpenCourseHandsOnSimulationTasksController{
}
}
/**
*
* @param teacherOpenCourseId id
* @return
*/
@GetMapping(MODEL + "/getTaskTypeParam.do")
public List<TaskTypeParam> getTaskTypeParam(String teacherOpenCourseId) {
return teacherOpenCourseHandsOnSimulationTasksService.getTaskTypeParam(teacherOpenCourseId);
}
}

@ -0,0 +1,33 @@
package com.ibeetl.jlw.web.query;
import com.ibeetl.admin.core.web.query.PageParam;
/**
*
*
* @Version 0.0.1
* @Author
* @Date 2022/10/30 0:06
*/
public class GetHandsOnListParam extends PageParam {
private Long teacherOpenCourseId;
private Long classId;
public Long getTeacherOpenCourseId() {
return teacherOpenCourseId;
}
public void setTeacherOpenCourseId(Long teacherOpenCourseId) {
this.teacherOpenCourseId = teacherOpenCourseId;
}
public Long getClassId() {
return classId;
}
public void setClassId(Long classId) {
this.classId = classId;
}
}

@ -374,3 +374,159 @@ getReportList
select t.*
from student_hands_on_task_report t where t.teacher_open_course_id in (#join(collect)#)
getExcelValues
===
* 根据不为空的参数进行查询导入需要的参数
SELECT * FROM (
(
select
MAX(LENGTH(t.teacher_open_course_id)) teacher_open_course_id,
MAX(LENGTH(t.hands_on_id)) hands_on_id,
MAX(LENGTH(t.hands_on_task_id)) hands_on_task_id,
MAX(LENGTH(t.report_file)) report_file,
MAX(LENGTH(t.report_score)) report_score,
MAX(LENGTH(t.report_comment)) report_comment,
MAX(LENGTH(t.create_time)) create_time,
MAX(LENGTH(t.teacher_id)) teacher_id,
MAX(LENGTH(t.student_id)) student_id
from student_hands_on_task_report t
where 1=1 and #function("studentHandsOnTaskReport.query")#
@if(!isEmpty(studentHandsOnTaskReportId)){
and t.student_hands_on_task_report_id =#studentHandsOnTaskReportId#
@}
@if(!isEmpty(studentHandsOnTaskReportIdPlural)){
and find_in_set(t.student_hands_on_task_report_id,#studentHandsOnTaskReportIdPlural#)
@}
@if(!isEmpty(teacherOpenCourseId)){
and t.teacher_open_course_id =#teacherOpenCourseId#
@}
@if(!isEmpty(teacherOpenCourseIdPlural)){
and find_in_set(t.teacher_open_course_id,#teacherOpenCourseIdPlural#)
@}
@if(!isEmpty(handsOnId)){
and t.hands_on_id =#handsOnId#
@}
@if(!isEmpty(handsOnIdPlural)){
and find_in_set(t.hands_on_id,#handsOnIdPlural#)
@}
@if(!isEmpty(handsOnTaskId)){
and t.hands_on_task_id =#handsOnTaskId#
@}
@if(!isEmpty(handsOnTaskIdPlural)){
and find_in_set(t.hands_on_task_id,#handsOnTaskIdPlural#)
@}
@if(!isEmpty(reportFile)){
and t.report_file =#reportFile#
@}
@if(!isEmpty(reportScore)){
and t.report_score =#reportScore#
@}
@if(!isEmpty(reportComment)){
and t.report_comment =#reportComment#
@}
@if(!isEmpty(createTime)){
and t.create_time =#createTime#
@}
@if(!isEmpty(orgId)){
and t.org_id =#orgId#
@}
@if(!isEmpty(orgIdPlural)){
and find_in_set(t.org_id,#orgIdPlural#)
@}
@if(!isEmpty(userId)){
and t.user_id =#userId#
@}
@if(!isEmpty(userIdPlural)){
and find_in_set(t.user_id,#userIdPlural#)
@}
@if(!isEmpty(teacherId)){
and t.teacher_id =#teacherId#
@}
@if(!isEmpty(teacherIdPlural)){
and find_in_set(t.teacher_id,#teacherIdPlural#)
@}
@if(!isEmpty(studentId)){
and t.student_id =#studentId#
@}
@if(!isEmpty(studentIdPlural)){
and find_in_set(t.student_id,#studentIdPlural#)
@}
)
UNION ALL
(
select
t.teacher_open_course_id ,
t.hands_on_id ,
t.hands_on_task_id ,
t.report_file ,
t.report_score ,
t.report_comment ,
t.create_time ,
t.teacher_id ,
t.student_id
from student_hands_on_task_report t
where 1=1 and #function("studentHandsOnTaskReport.query")#
@if(!isEmpty(studentHandsOnTaskReportId)){
and t.student_hands_on_task_report_id =#studentHandsOnTaskReportId#
@}
@if(!isEmpty(studentHandsOnTaskReportIdPlural)){
and find_in_set(t.student_hands_on_task_report_id,#studentHandsOnTaskReportIdPlural#)
@}
@if(!isEmpty(teacherOpenCourseId)){
and t.teacher_open_course_id =#teacherOpenCourseId#
@}
@if(!isEmpty(teacherOpenCourseIdPlural)){
and find_in_set(t.teacher_open_course_id,#teacherOpenCourseIdPlural#)
@}
@if(!isEmpty(handsOnId)){
and t.hands_on_id =#handsOnId#
@}
@if(!isEmpty(handsOnIdPlural)){
and find_in_set(t.hands_on_id,#handsOnIdPlural#)
@}
@if(!isEmpty(handsOnTaskId)){
and t.hands_on_task_id =#handsOnTaskId#
@}
@if(!isEmpty(handsOnTaskIdPlural)){
and find_in_set(t.hands_on_task_id,#handsOnTaskIdPlural#)
@}
@if(!isEmpty(reportFile)){
and t.report_file =#reportFile#
@}
@if(!isEmpty(reportScore)){
and t.report_score =#reportScore#
@}
@if(!isEmpty(reportComment)){
and t.report_comment =#reportComment#
@}
@if(!isEmpty(createTime)){
and t.create_time =#createTime#
@}
@if(!isEmpty(orgId)){
and t.org_id =#orgId#
@}
@if(!isEmpty(orgIdPlural)){
and find_in_set(t.org_id,#orgIdPlural#)
@}
@if(!isEmpty(userId)){
and t.user_id =#userId#
@}
@if(!isEmpty(userIdPlural)){
and find_in_set(t.user_id,#userIdPlural#)
@}
@if(!isEmpty(teacherId)){
and t.teacher_id =#teacherId#
@}
@if(!isEmpty(teacherIdPlural)){
and find_in_set(t.teacher_id,#teacherIdPlural#)
@}
@if(!isEmpty(studentId)){
and t.student_id =#studentId#
@}
@if(!isEmpty(studentIdPlural)){
and find_in_set(t.student_id,#studentIdPlural#)
@}
)
)t

@ -337,7 +337,9 @@ getHandsOnList
* 查询参数
select t.*
select @pageTag(){
t.*
@}
from teacher_open_course_hands_on t
where t.teacher_open_course_id =#teacherOpenCourseId#

Loading…
Cancel
Save