|
@@ -3,6 +3,7 @@ package com.ym.mec.web.controller;
|
|
import com.ym.mec.biz.dal.dao.*;
|
|
import com.ym.mec.biz.dal.dao.*;
|
|
import com.ym.mec.biz.dal.dto.*;
|
|
import com.ym.mec.biz.dal.dto.*;
|
|
import com.ym.mec.biz.dal.entity.*;
|
|
import com.ym.mec.biz.dal.entity.*;
|
|
|
|
+import com.ym.mec.biz.dal.enums.*;
|
|
import com.ym.mec.biz.dal.page.*;
|
|
import com.ym.mec.biz.dal.page.*;
|
|
import com.ym.mec.biz.service.*;
|
|
import com.ym.mec.biz.service.*;
|
|
import io.swagger.annotations.Api;
|
|
import io.swagger.annotations.Api;
|
|
@@ -38,17 +39,6 @@ import org.springframework.web.bind.annotation.RestController;
|
|
|
|
|
|
import com.ym.mec.auth.api.client.SysUserFeignService;
|
|
import com.ym.mec.auth.api.client.SysUserFeignService;
|
|
import com.ym.mec.auth.api.entity.SysUser;
|
|
import com.ym.mec.auth.api.entity.SysUser;
|
|
-import com.ym.mec.biz.dal.enums.AccountType;
|
|
|
|
-import com.ym.mec.biz.dal.enums.CourseStatusEnum;
|
|
|
|
-import com.ym.mec.biz.dal.enums.GroupType;
|
|
|
|
-import com.ym.mec.biz.dal.enums.KitGroupPurchaseTypeEnum;
|
|
|
|
-import com.ym.mec.biz.dal.enums.MusicGroupStatusEnum;
|
|
|
|
-import com.ym.mec.biz.dal.enums.OrderDetailTypeEnum;
|
|
|
|
-import com.ym.mec.biz.dal.enums.OrderTypeEnum;
|
|
|
|
-import com.ym.mec.biz.dal.enums.PaymentChannelEnum;
|
|
|
|
-import com.ym.mec.biz.dal.enums.SporadicChargeTypeEnum;
|
|
|
|
-import com.ym.mec.biz.dal.enums.StudentMusicGroupStatusEnum;
|
|
|
|
-import com.ym.mec.biz.dal.enums.YesOrNoEnum;
|
|
|
|
import com.ym.mec.common.controller.BaseController;
|
|
import com.ym.mec.common.controller.BaseController;
|
|
import com.ym.mec.common.exception.BizException;
|
|
import com.ym.mec.common.exception.BizException;
|
|
import com.ym.mec.common.page.PageInfo;
|
|
import com.ym.mec.common.page.PageInfo;
|
|
@@ -137,6 +127,72 @@ public class ExportController extends BaseController {
|
|
private VipGroupActivityService vipGroupActivityService;
|
|
private VipGroupActivityService vipGroupActivityService;
|
|
@Autowired
|
|
@Autowired
|
|
private GoodsService goodsService;
|
|
private GoodsService goodsService;
|
|
|
|
+ @Autowired
|
|
|
|
+ private ClassGroupService classGroupService;
|
|
|
|
+
|
|
|
|
+ @ApiOperation(value = "班级列表导出")
|
|
|
|
+ @PostMapping("export/classGroup")
|
|
|
|
+ @PreAuthorize("@pcs.hasPermissions('export/classGroup')")
|
|
|
|
+ public void exportClassGroup(HttpServletResponse response, ClassGroupQueryInfo 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 (org.apache.commons.lang3.StringUtils.isEmpty(queryInfo.getOrganIdList())) {
|
|
|
|
+ queryInfo.setOrganIdList(employee.getOrganIdList());
|
|
|
|
+ }else if(org.apache.commons.lang3.StringUtils.isEmpty(employee.getOrganIdList())){
|
|
|
|
+ throw new BizException("用户所在分部异常");
|
|
|
|
+ }else {
|
|
|
|
+ List<String> list = Arrays.asList(employee.getOrganIdList().split(","));
|
|
|
|
+ if(!list.containsAll(Arrays.asList(queryInfo.getOrganIdList().split(",")))){
|
|
|
|
+ throw new BizException("非法请求");
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ List<ClassGroupTeachersDto> rows = classGroupService.queryClassGroupPage(queryInfo).getRows();
|
|
|
|
+ for (ClassGroupTeachersDto row : rows) {
|
|
|
|
+ List<ClassGroupTeacherMapper> classGroupTeacherMapperList = row.getClassGroupTeacherMapperList();
|
|
|
|
+ if(classGroupTeacherMapperList.size() > 0){
|
|
|
|
+ List<ClassGroupTeacherMapper> teachingTeachers = classGroupTeacherMapperList.stream().filter(e -> e.getTeacherRole() == TeachTypeEnum.TEACHING).collect(Collectors.toList());
|
|
|
|
+ if(teachingTeachers.size() > 0){
|
|
|
|
+ row.setTeachingTeacherName(StringUtils.join(teachingTeachers.stream().map(e->e.getUserName()).collect(Collectors.toList()), ","));
|
|
|
|
+ }
|
|
|
|
+ List<ClassGroupTeacherMapper> bishopTeachers = classGroupTeacherMapperList.stream().filter(e -> e.getTeacherRole() == TeachTypeEnum.BISHOP).collect(Collectors.toList());
|
|
|
|
+ if(bishopTeachers.size() > 0){
|
|
|
|
+ row.setBishopTeacherName(StringUtils.join(bishopTeachers.stream().map(e->e.getUserName()).collect(Collectors.toList()),","));
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ OutputStream outputStream = response.getOutputStream();
|
|
|
|
+ try {
|
|
|
|
+ HSSFWorkbook workbook = POIUtil.exportExcel(new String[]{"课程组编号", "课程组名称", "分部名称", "班级名称",
|
|
|
|
+ "班级类型", "班级人数", "主教老师", "助教老师", "已上课时", "总课数"}, new String[]{
|
|
|
|
+ "musicGroupId", "musicGroupName", "organName", "name",
|
|
|
|
+ "type.msg", "studentNum", "bishopTeacherName", "teachingTeacherName", "currentClassTimes",
|
|
|
|
+ "totalClassTimes"}, rows);
|
|
|
|
+ response.setContentType("application/octet-stream");
|
|
|
|
+ response.setHeader("Content-Disposition", "attac:wq" +
|
|
|
|
+ "hment;filename=goods-" + 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 = "商品列表导出")
|
|
@ApiOperation(value = "商品列表导出")
|
|
@PostMapping("export/goods")
|
|
@PostMapping("export/goods")
|