|
|
@@ -1,17 +1,23 @@
|
|
|
package com.ym.mec.web.controller;
|
|
|
|
|
|
+import com.ym.mec.biz.dal.dto.ReplacementInstrumentActivityStatDto;
|
|
|
import com.ym.mec.biz.dal.dto.StudentStatisticsDto;
|
|
|
import com.ym.mec.biz.dal.dto.StudentStatisticsSumDto;
|
|
|
import com.ym.mec.biz.dal.dto.StudentStatisticsSumForDateDto;
|
|
|
import com.ym.mec.biz.dal.page.StudentStatisticsQueryInfo;
|
|
|
+import com.ym.mec.biz.service.OrganizationService;
|
|
|
import com.ym.mec.biz.service.StudentStatisticsService;
|
|
|
import com.ym.mec.common.controller.BaseController;
|
|
|
import com.ym.mec.common.entity.HttpResponseResult;
|
|
|
+import com.ym.mec.common.exception.BizException;
|
|
|
import com.ym.mec.common.page.PageInfo;
|
|
|
+import com.ym.mec.util.date.DateUtil;
|
|
|
+import com.ym.mec.util.excel.POIUtil;
|
|
|
import io.swagger.annotations.Api;
|
|
|
import io.swagger.annotations.ApiImplicitParam;
|
|
|
import io.swagger.annotations.ApiImplicitParams;
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
+import org.apache.poi.hssf.usermodel.HSSFWorkbook;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.security.access.prepost.PreAuthorize;
|
|
|
import org.springframework.web.bind.annotation.GetMapping;
|
|
|
@@ -19,6 +25,10 @@ import org.springframework.web.bind.annotation.PostMapping;
|
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
|
|
|
|
+import javax.servlet.http.HttpServletResponse;
|
|
|
+import java.io.IOException;
|
|
|
+import java.io.OutputStream;
|
|
|
+import java.util.Date;
|
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
|
|
|
|
@@ -29,6 +39,8 @@ public class StudentStatisticsController extends BaseController {
|
|
|
|
|
|
@Autowired
|
|
|
private StudentStatisticsService studentStatisticsService;
|
|
|
+ @Autowired
|
|
|
+ private OrganizationService organizationService;
|
|
|
|
|
|
@ApiOperation(value = "分页查询收费类型列表")
|
|
|
@PostMapping("/queryPage")
|
|
|
@@ -72,4 +84,49 @@ public class StudentStatisticsController extends BaseController {
|
|
|
public HttpResponseResult<List<Map<Integer, String>>> queryDirectorList(String groupType) {
|
|
|
return succeed(studentStatisticsService.queryDirectorList(groupType));
|
|
|
}
|
|
|
+
|
|
|
+ @ApiOperation(value = "导出小课学员管理")
|
|
|
+ @PostMapping("/exportStudentSmallClassStatisticsSum")
|
|
|
+ @PreAuthorize("@pcs.hasPermissions('studentStatistics/exportStudentSmallClassStatisticsSum')")
|
|
|
+ public void exportStudentSmallClassStatisticsSum(StudentStatisticsQueryInfo queryInfo, HttpServletResponse response) throws IOException {
|
|
|
+ queryInfo.setOrganId(organizationService.getEmployeeOrgan(queryInfo.getOrganId()));
|
|
|
+ queryInfo.setRows(65535);
|
|
|
+ PageInfo<StudentStatisticsDto> pageList = studentStatisticsService.queryStatisticsPage(queryInfo);
|
|
|
+
|
|
|
+ if (pageList.getTotal() <= 0) {
|
|
|
+ throw new BizException("没有可导出的记录");
|
|
|
+ }
|
|
|
+
|
|
|
+ OutputStream outputStream = response.getOutputStream();
|
|
|
+ HSSFWorkbook workbook = null;
|
|
|
+ try {
|
|
|
+ String[] header = {"分部", "学生姓名", "学员编号","联系电话", "声部", "学校", "年级", "学员状态", "未排课时", "总课时", "已完成课时",
|
|
|
+ "剩余课时","预收金额","第一次课时间","最近上课时间","指导老师编号","指导老师","乐团主管编号","乐团主管","声部课老师编号","声部课老师","近30天课耗","回访次数",
|
|
|
+ "回访状态","原因","回访日期"};
|
|
|
+ String[] body = {"studentBasicInfo.organName", "studentBasicInfo.userName", "studentBasicInfo.userId",
|
|
|
+ "studentBasicInfo.phone","studentBasicInfo.subjectName", "studentBasicInfo.cooperationOrganName", "studentBasicInfo.grade",
|
|
|
+ "overCourseNum > 0 && subCourseNum > 0 && latelyYearCourseConsumer < 1 ? '沉睡' : (noScheduleNum > 0 || subCourseNum > 0) && (latelyYearCourseConsumer > 0 || overCourseNum <= 0) ? '在读':''",
|
|
|
+ "noScheduleNum","totalCourseNum", "overCourseNum", "subCourseNum","preCourseFee","firstCourseTime","lastCourseTime","teacherId","teacherName","musicDirectorId","musicDirectorName",
|
|
|
+ "studentBasicInfo.subjectTeacherId","studentBasicInfo.subjectTeacherName","latelyCourseConsumer","visitNum","lastVisitStatus","visitReason","lastVisitTime"};
|
|
|
+ workbook = POIUtil.exportExcel(header, body, pageList.getRows());
|
|
|
+ response.setContentType("application/octet-stream");
|
|
|
+ response.setHeader("Content-Disposition", "attachment;filename=replacement-" + DateUtil.getDate(new Date()) + ".xls");
|
|
|
+ response.flushBuffer();
|
|
|
+ outputStream = response.getOutputStream();
|
|
|
+ workbook.write(outputStream);
|
|
|
+ outputStream.flush();
|
|
|
+ workbook.close();
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ } finally {
|
|
|
+ if (outputStream != null) {
|
|
|
+ try {
|
|
|
+ workbook.close();
|
|
|
+ outputStream.close();
|
|
|
+ } catch (IOException e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|