|
@@ -12,6 +12,7 @@ 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.common.page.QueryInfo;
|
|
|
import com.ym.mec.util.collection.MapUtil;
|
|
|
import com.ym.mec.util.date.DateUtil;
|
|
|
import com.ym.mec.util.excel.POIUtil;
|
|
@@ -85,6 +86,8 @@ public class ExportController extends BaseController {
|
|
|
@Autowired
|
|
|
private TeacherAttendanceService teacherAttendanceService;
|
|
|
@Autowired
|
|
|
+ private StudentAttendanceService studentAttendanceService;
|
|
|
+ @Autowired
|
|
|
private TeacherCourseRewardService teacherCourseRewardService;
|
|
|
@Autowired
|
|
|
private DegreeRegistrationService degreeRegistrationService;
|
|
@@ -102,11 +105,63 @@ public class ExportController extends BaseController {
|
|
|
private TeacherService teacherService;
|
|
|
@Autowired
|
|
|
private MusicGroupBuildLogDao musicGroupBuildLogDao;
|
|
|
+ @Autowired
|
|
|
+ private CourseScheduleStudentPaymentDao courseScheduleStudentPaymentDao;
|
|
|
+
|
|
|
+ @ApiOperation(value = "学员考勤记录导出")
|
|
|
+ @PostMapping("export/exportStudentAttendances")
|
|
|
+ @PreAuthorize("@pcs.hasPermissions('export/exportStudentAttendances')")
|
|
|
+ public void exportStudentAttendances(HttpServletResponse response, ExportStudentAttendanceQueryInfo queryInfo) throws IOException {
|
|
|
+ queryInfo.setPage(1);
|
|
|
+ queryInfo.setRows(49999);
|
|
|
+ SysUser sysUser = sysUserFeignService.queryUserInfo();
|
|
|
+ if (sysUser == null) {
|
|
|
+ throw new BizException("用户信息获取失败");
|
|
|
+ }
|
|
|
+ if (!sysUser.getIsSuperAdmin()) {
|
|
|
+ Employee employee = employeeDao.get(sysUser.getId());
|
|
|
+ if (StringUtils.isEmpty(queryInfo.getOrganId())) {
|
|
|
+ queryInfo.setOrganId(employee.getOrganIdList());
|
|
|
+ } else if (StringUtils.isEmpty(employee.getOrganIdList())) {
|
|
|
+ throw new BizException("用户所在分部异常");
|
|
|
+ } else {
|
|
|
+ List<String> list = Arrays.asList(employee.getOrganIdList().split(","));
|
|
|
+ if (!list.containsAll(Arrays.asList(queryInfo.getOrganId().split(",")))) {
|
|
|
+ throw new BizException("非法请求");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ List<ExportStudentAttendanceDto> rows = studentAttendanceService.exportStudentAttendancesQueryPage(queryInfo).getRows();
|
|
|
+ OutputStream outputStream = response.getOutputStream();
|
|
|
+ try {
|
|
|
+ HSSFWorkbook workbook = POIUtil.exportExcel(new String[]{"分部编号", "分部名称", "课程组类型", "课程组编号", "课程组名称", "学员姓名",
|
|
|
+ "学员编号", "课程编号", "课程名称", "上课日期", "上课开始时间","上课结束时间","指导老师名称","指导老师编号","教务老师名称","教务老师编号","学员考勤状态"}, new String[]{
|
|
|
+ "organId", "organName", "groupType.desc", "groupId", "groupName", "username",
|
|
|
+ "userId", "courseScheduleId", "courseScheduleName", "classDate", "startClassTime", "endClassTime", "guideTeacherName", "guideTeacherId"
|
|
|
+ , "educationalTeacherName", "educationalTeacherId", "studentAttendanceStatus.msg"}, rows);
|
|
|
+ response.setContentType("application/octet-stream");
|
|
|
+ response.setHeader("Content-Disposition", "attachment;filename=studentAttendance-" + DateUtil.getDate(new Date()) + ".xls");
|
|
|
+ response.flushBuffer();
|
|
|
+ outputStream = response.getOutputStream();
|
|
|
+ workbook.write(outputStream);
|
|
|
+ outputStream.flush();
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ } finally {
|
|
|
+ if (outputStream != null) {
|
|
|
+ try {
|
|
|
+ outputStream.close();
|
|
|
+ } catch (IOException e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
@ApiOperation(value = "乐团管理--修改--缴费设置--缴费记录导出")
|
|
|
@PostMapping("export/musicGroupPaymentCalenderDetail")
|
|
|
@PreAuthorize("@pcs.hasPermissions('export/musicGroupPaymentCalenderDetail')")
|
|
|
- public void exportTeacherAttendances(HttpServletResponse response, MusicCalenderDetailQueryInfo queryInfo) throws IOException {
|
|
|
+ public void exportMusicGroupPaymentCalenderDetail(HttpServletResponse response, MusicCalenderDetailQueryInfo queryInfo) throws IOException {
|
|
|
queryInfo.setPage(1);
|
|
|
queryInfo.setRows(49999);
|
|
|
List<MusicGroupPaymentCalenderDetail> rows = musicGroupPaymentCalenderDetailService.queryPage(queryInfo).getRows();
|
|
@@ -1213,11 +1268,21 @@ public class ExportController extends BaseController {
|
|
|
}
|
|
|
OutputStream outputStream = response.getOutputStream();
|
|
|
Set<Integer> studentIds = vipGroupExports.stream().map(CourseGroupExportDto::getStudentId).collect(Collectors.toSet());
|
|
|
+ List<Map<Integer, Date>> studentLastCourseSchedule = courseScheduleStudentPaymentDao.findStudentLastCourseSchedule(new ArrayList<>(studentIds));
|
|
|
+ Map<Integer, String> studentLastCourseMap = new HashMap<>();
|
|
|
+ if(!CollectionUtils.isEmpty(studentLastCourseSchedule)){
|
|
|
+ studentLastCourseMap = MapUtil.convertMybatisMap(studentLastCourseSchedule);
|
|
|
+ }
|
|
|
List<CourseGroupExportDto> studentCourseInfos = courseScheduleDao.getStudentVipCourseInfo(studentIds);
|
|
|
List<CourseGroupExportDto> totalClassTimes = courseScheduleDao.getStudentCourseScheduleNum(studentIds, GroupType.VIP, null);
|
|
|
List<CourseGroupExportDto> noStartClassTimes = courseScheduleDao.getStudentCourseScheduleNum(studentIds, GroupType.VIP, CourseStatusEnum.NOT_START);
|
|
|
for (CourseGroupExportDto vipGroupExport : vipGroupExports) {
|
|
|
|
|
|
+ String lastClassDateStr = studentLastCourseMap.get(vipGroupExport.getStudentId());
|
|
|
+ if(StringUtils.isNotBlank(lastClassDateStr)){
|
|
|
+ vipGroupExport.setLastClassDate(DateUtil.stringToDate(lastClassDateStr));
|
|
|
+ }
|
|
|
+
|
|
|
for (CourseGroupExportDto studentCourseInfo : studentCourseInfos) {
|
|
|
if (studentCourseInfo.getStudentId().equals(vipGroupExport.getStudentId())) {
|
|
|
vipGroupExport.setTeacherIds(studentCourseInfo.getTeacherIds());
|
|
@@ -1242,8 +1307,8 @@ public class ExportController extends BaseController {
|
|
|
}
|
|
|
|
|
|
try {
|
|
|
- String[] header = {"分部", "学生编号", "学生姓名", "指导老师id", "指导老师", "教务老师id", "教务老师", "课程开始时间", "课程截止时间", "总课时", "剩余课时"};
|
|
|
- String[] body = {"organName", "studentId", "studentName", "teacherIds", "teacherName", "eduTeacherIds", "eduTeacherName", "classStartDate", "classEndDate", "totalClassTimes", "noStartClassTimes"};
|
|
|
+ String[] header = {"分部", "学生编号", "学生姓名", "指导老师id", "指导老师", "教务老师id", "教务老师", "课程开始时间", "课程截止时间", "上次课时间", "总课时", "剩余课时"};
|
|
|
+ String[] body = {"organName", "studentId", "studentName", "teacherIds", "teacherName", "eduTeacherIds", "eduTeacherName", "classStartDate", "classEndDate", "lastClassDate", "totalClassTimes", "noStartClassTimes"};
|
|
|
HSSFWorkbook workbook = POIUtil.exportExcel(header, body, vipGroupExports);
|
|
|
response.setContentType("application/octet-stream");
|
|
|
response.setHeader("Content-Disposition", "attachment;filename=lender-" + DateUtil.getDate(new Date()) + ".xls");
|