|
@@ -3,21 +3,30 @@ package com.ym.mec.web.controller;
|
|
|
import com.ym.mec.auth.api.client.SysUserFeignService;
|
|
|
import com.ym.mec.auth.api.entity.SysUser;
|
|
|
import com.ym.mec.biz.dal.dao.EmployeeDao;
|
|
|
+import com.ym.mec.biz.dal.dto.CourseReviewDto;
|
|
|
+import com.ym.mec.biz.dal.dto.MusicGroupStudentsDto;
|
|
|
import com.ym.mec.biz.dal.entity.Employee;
|
|
|
import com.ym.mec.biz.dal.page.CourseReviewQueryInfo;
|
|
|
+import com.ym.mec.biz.dal.page.MusicGroupStudentQueryInfo;
|
|
|
import com.ym.mec.biz.service.CourseReviewService;
|
|
|
import com.ym.mec.common.controller.BaseController;
|
|
|
import com.ym.mec.common.entity.HttpResponseResult;
|
|
|
+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.ApiOperation;
|
|
|
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.web.bind.annotation.GetMapping;
|
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
|
|
|
|
+import javax.servlet.http.HttpServletResponse;
|
|
|
import java.util.Arrays;
|
|
|
+import java.util.Date;
|
|
|
import java.util.List;
|
|
|
|
|
|
@RequestMapping("courseReview")
|
|
@@ -66,4 +75,54 @@ public class CourseReviewController extends BaseController {
|
|
|
return succeed(courseReviewService.getReviewInfo(id));
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+ @ApiOperation(value = "评论列表导出")
|
|
|
+ @RequestMapping("export")
|
|
|
+ @PreAuthorize("@pcs.hasPermissions('courseReview/export')")
|
|
|
+ public void export(CourseReviewQueryInfo queryInfo, HttpServletResponse response) {
|
|
|
+ SysUser sysUser = sysUserFeignService.queryUserInfo();
|
|
|
+ if (!sysUser.getIsSuperAdmin()) {
|
|
|
+ Employee employee = employeeDao.get(sysUser.getId());
|
|
|
+ queryInfo.setOrganId(employee.getOrganIdList());
|
|
|
+ }
|
|
|
+ queryInfo.setRows(99999);
|
|
|
+ PageInfo<CourseReviewDto> practiceGroupReviews = courseReviewService.findPracticeGroupReviews(queryInfo);
|
|
|
+ try {
|
|
|
+ for (CourseReviewDto row : practiceGroupReviews.getRows()) {
|
|
|
+ row.setClassDateStr(DateUtil.dateToString(row.getClassDate(),"yyyy-MM-dd"));
|
|
|
+ if(row.getBuyMonths() >0){
|
|
|
+ row.setStartClassTimeStr("收费");
|
|
|
+ }else {
|
|
|
+ row.setStartClassTimeStr("免费");
|
|
|
+ }
|
|
|
+ if(row.getReviewId() > 0){
|
|
|
+ row.setEndClassTimeStr("是");
|
|
|
+ }else {
|
|
|
+ row.setEndClassTimeStr("否");
|
|
|
+ }
|
|
|
+ if(row.getReviewId() > 0){
|
|
|
+ row.setEndClassTimeStr("是");
|
|
|
+ }else {
|
|
|
+ row.setEndClassTimeStr("否");
|
|
|
+ }
|
|
|
+ if(row.getHandHomework() > 0){
|
|
|
+ row.setHandHomeworkStr("是");
|
|
|
+ }else {
|
|
|
+ row.setHandHomeworkStr("否");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ String[] header = {"分部名称", "课程编号","课程日期","课程名称", "声部", "指导老师", "教务老师", "收费类型", "学员评分", "完成评价", "提交作业", "教务评价"};
|
|
|
+ String[] body = {"organName","id","classDateStr","courseName", "subjectName", "teacherName", "eduTeacherName", "startClassTimeStr", "studentReview", "endClassTimeStr", "handHomeworkStr", "courseReview"};
|
|
|
+ HSSFWorkbook workbook = POIUtil.exportExcel(header, body, practiceGroupReviews.getRows());
|
|
|
+ response.setContentType("application/octet-stream");
|
|
|
+ response.setHeader("Content-Disposition", "attachment;filename=lender-" + DateUtil.getDate(new Date()) + ".xls");
|
|
|
+ response.flushBuffer();
|
|
|
+ workbook.write(response.getOutputStream());
|
|
|
+ workbook.close();
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
}
|