|
@@ -10,10 +10,8 @@ import com.ym.mec.common.entity.HttpResponseResult;
|
|
|
import com.ym.mec.common.service.IdGeneratorService;
|
|
|
import io.swagger.annotations.Api;
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
-
|
|
|
import java.io.IOException;
|
|
|
import java.io.OutputStream;
|
|
|
-import java.math.BigDecimal;
|
|
|
import java.util.ArrayList;
|
|
|
import java.util.Arrays;
|
|
|
import java.util.Date;
|
|
@@ -24,9 +22,7 @@ import java.util.Map;
|
|
|
import java.util.Objects;
|
|
|
import java.util.Set;
|
|
|
import java.util.stream.Collectors;
|
|
|
-
|
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
-
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
@@ -36,7 +32,6 @@ import org.springframework.web.bind.annotation.GetMapping;
|
|
|
import org.springframework.web.bind.annotation.PostMapping;
|
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
|
-
|
|
|
import com.ym.mec.auth.api.client.SysUserFeignService;
|
|
|
import com.ym.mec.auth.api.entity.SysUser;
|
|
|
import com.ym.mec.common.controller.BaseController;
|
|
@@ -66,10 +61,6 @@ public class ExportController extends BaseController {
|
|
|
@Autowired
|
|
|
private EmployeeDao employeeDao;
|
|
|
@Autowired
|
|
|
- private StudentPaymentOrderService studentPaymentOrderService;
|
|
|
- @Autowired
|
|
|
- private StudentRegistrationDao studentRegistrationDao;
|
|
|
- @Autowired
|
|
|
private VipGroupDao vipGroupDao;
|
|
|
@Autowired
|
|
|
private MusicGroupDao musicGroupDao;
|
|
@@ -124,8 +115,6 @@ public class ExportController extends BaseController {
|
|
|
@Autowired
|
|
|
private CourseScheduleStudentPaymentDao courseScheduleStudentPaymentDao;
|
|
|
@Autowired
|
|
|
- private SellOrderDao sellOrderDao;
|
|
|
- @Autowired
|
|
|
private VipGroupActivityService vipGroupActivityService;
|
|
|
@Autowired
|
|
|
private GoodsService goodsService;
|
|
@@ -865,7 +854,7 @@ public class ExportController extends BaseController {
|
|
|
@ApiOperation(value = "终课表列表导出")
|
|
|
@GetMapping("export/superFindCourseSchedules")
|
|
|
@PreAuthorize("@pcs.hasPermissions('export/superFindCourseSchedules')")
|
|
|
- public void superFindCourseSchedules(EndCourseScheduleQueryInfo queryInfo, HttpServletResponse response) throws IOException {
|
|
|
+ public Object superFindCourseSchedules(EndCourseScheduleQueryInfo queryInfo) throws IOException {
|
|
|
queryInfo.setPage(1);
|
|
|
queryInfo.setRows(49999);
|
|
|
queryInfo.setIsExport(true);
|
|
@@ -884,33 +873,29 @@ public class ExportController extends BaseController {
|
|
|
throw new BizException("非法请求");
|
|
|
}
|
|
|
}
|
|
|
- List<CourseScheduleEndDto> rows = scheduleService.endFindCourseSchedules(queryInfo).getRows();
|
|
|
- for (CourseScheduleEndDto row : rows) {
|
|
|
- row.setIsComplaints(StringUtils.equals(row.getIsComplaints(), "1") ? "有" : "无");
|
|
|
+ Map<String, Object> params = new HashMap<>();
|
|
|
+ MapUtil.populateMap(params, queryInfo);
|
|
|
+ int count = scheduleService.endCountCourseSchedules(params);
|
|
|
+ if (count <= 0) {
|
|
|
+ return failed("没有可导出的数据");
|
|
|
}
|
|
|
- OutputStream ouputStream = null;
|
|
|
- try {
|
|
|
- HSSFWorkbook workbook = POIUtil.exportExcel(new String[]{"分部名称", "课程编号", "开始时间", "结束时间",
|
|
|
- "班级名称", "班级声部", "课程名称", "课程类型", "教学模式",
|
|
|
- "教学点", "课程状态", "指导老师", "学员编号", "是否点名", "是否有考勤申诉", "预计上课人数"}, new String[]{
|
|
|
- "organName", "id", "startClassTime", "endClassTime", "classGroupName", "subjectName", "name",
|
|
|
- "groupType.desc", "teachMode.msg", "schoolName", "status.msg", "teacherName", "studentId", "isCallNames.msg", "isComplaints", "studentNum"}, rows);
|
|
|
- response.setContentType("application/octet-stream");
|
|
|
- response.setHeader("Content-Disposition", "attachment;filename=lender-" + DateUtil.getDate(new Date()) + ".xls");
|
|
|
- ouputStream = response.getOutputStream();
|
|
|
- workbook.write(ouputStream);
|
|
|
- ouputStream.flush();
|
|
|
- } catch (Exception e) {
|
|
|
- e.printStackTrace();
|
|
|
- } finally {
|
|
|
- if (ouputStream != null) {
|
|
|
- try {
|
|
|
- ouputStream.close();
|
|
|
- } catch (IOException e) {
|
|
|
- e.printStackTrace();
|
|
|
- }
|
|
|
- }
|
|
|
+
|
|
|
+ if (count > 50000) {
|
|
|
+ return failed("数据集太大,不能导出.最大数据集不能超过50000");
|
|
|
}
|
|
|
+ Date nowDate = new Date();
|
|
|
+ String no = idGeneratorService.generatorId("download") + "";
|
|
|
+ String fileName = "课表列表-" + no + "-" + DateUtil.getDate(nowDate) + ".xls";
|
|
|
+ ManagerDownload managerDownload = new ManagerDownload();
|
|
|
+ managerDownload.setType(ExportTypeEnum.COURSE_SCHEDULE);
|
|
|
+ managerDownload.setUserId(sysUser.getId());
|
|
|
+ managerDownload.setName(fileName);
|
|
|
+ managerDownload.setFileUrl("");
|
|
|
+ managerDownload.setCreateTime(nowDate);
|
|
|
+ managerDownload.setUpdateTime(nowDate);
|
|
|
+ managerDownloadDao.insert(managerDownload);
|
|
|
+ exportService.superFindCourseSchedules(params, managerDownload);
|
|
|
+ return succeed(fileName+"导出申请已提交,请到【报表中心-下载列表查看】");
|
|
|
}
|
|
|
|
|
|
|