|
@@ -23,6 +23,7 @@ import org.apache.commons.lang3.StringUtils;
|
|
|
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.security.access.prepost.PreAuthorize;
|
|
|
+import org.springframework.util.CollectionUtils;
|
|
|
import org.springframework.web.bind.annotation.GetMapping;
|
|
|
import org.springframework.web.bind.annotation.PostMapping;
|
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
@@ -103,9 +104,9 @@ public class ExportController extends BaseController {
|
|
|
}
|
|
|
List<StudentBuyPracticeDto> rows = practiceGroupService.studentBuys(queryInfo).getRows();
|
|
|
try {
|
|
|
- HSSFWorkbook workbook = POIUtil.exportExcel(new String[]{"学员编号", "学员名称", "所属分部", "联系电话", "购买网管课",
|
|
|
+ HSSFWorkbook workbook = POIUtil.exportExcel(new String[]{"学员编号", "学员名称", "所属分部", "购买网管课",
|
|
|
"免费课结束日期", "首次购买日期", "时间差"}, new String[]{
|
|
|
- "studentId", "studentName", "organName", "phone", "buyPractice.msg",
|
|
|
+ "studentId", "studentName", "organName", "buyPractice.msg",
|
|
|
"lastClassDate", "firstBuyTime", "intervalDay"}, rows);
|
|
|
response.setContentType("application/octet-stream");
|
|
|
response.setHeader("Content-Disposition", "attachment;filename=lender-" + DateUtil.getDate(new Date()) + ".xls");
|
|
@@ -887,7 +888,7 @@ public class ExportController extends BaseController {
|
|
|
@ApiOperation(value = "学生课外训练记录导出")
|
|
|
@GetMapping("export/extraExercisesReplys")
|
|
|
@PreAuthorize("@pcs.hasPermissions('export/extraExercisesReplys')")
|
|
|
- public void extraExercisesReplys(ExtraExercilseReplyQueryInfo queryInfo, HttpServletResponse response) {
|
|
|
+ public void extraExercisesReplys(ExtraExercilseReplyQueryInfo queryInfo, HttpServletResponse response) throws IOException {
|
|
|
queryInfo.setRows(999999999);
|
|
|
SysUser sysUser = sysUserFeignService.queryUserInfo();
|
|
|
if (sysUser == null) {
|
|
@@ -907,11 +908,23 @@ public class ExportController extends BaseController {
|
|
|
}
|
|
|
}
|
|
|
List<ExtraExerciseStudentsDto> rows = extracurricularExercisesReplyService.findExtraExercises(queryInfo).getRows();
|
|
|
+ if (CollectionUtils.isEmpty(rows)) {
|
|
|
+ response.setStatus(500);
|
|
|
+ response.setContentType("Content-Type: application/json;charset=UTF-8");
|
|
|
+ response.getOutputStream().write("{\"data\": null, \"code\": 500, \"status\": false, \"msg\": \"没有可导出的记录\"}".getBytes());
|
|
|
+ response.flushBuffer();
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ for (ExtraExerciseStudentsDto row : rows) {
|
|
|
+ row.setStatusStr(Objects.isNull(row.getStatus())||row.getStatus()==0?"否":"是");
|
|
|
+ row.setIsViewStr(Objects.isNull(row.getIsView())||row.getIsView()==0?"否":"是");
|
|
|
+ row.setIsRepliedStr(Objects.isNull(row.getIsReplied())||row.getIsReplied()==0?"否":"是");
|
|
|
+ }
|
|
|
OutputStream ouputStream = null;
|
|
|
try {
|
|
|
HSSFWorkbook workbook = POIUtil.exportExcel(
|
|
|
new String[]{"布置时间", "截至时间", "训练标题", "老师名字", "分部", "学生姓名", "提交作业", "是否回复", "是否查看"},
|
|
|
- new String[]{"createTime", "expireDate", "title", "teacherName", "organName", "user.username", "status", "isReplied", "isView"}, rows);
|
|
|
+ new String[]{"createTime", "expireDate", "title", "teacherName", "organName", "user.username", "statusStr", "isRepliedStr", "isViewStr"}, rows);
|
|
|
response.setContentType("application/octet-stream");
|
|
|
response.setHeader("Content-Disposition", "attachment;filename=lender-" + DateUtil.getDate(new Date()) + ".xls");
|
|
|
ouputStream = response.getOutputStream();
|