|  | @@ -12,10 +12,7 @@ import com.ym.mec.biz.dal.enums.GroupType;
 | 
	
		
			
				|  |  |  import com.ym.mec.biz.dal.enums.KitGroupPurchaseTypeEnum;
 | 
	
		
			
				|  |  |  import com.ym.mec.biz.dal.enums.OrderDetailTypeEnum;
 | 
	
		
			
				|  |  |  import com.ym.mec.biz.dal.enums.OrderTypeEnum;
 | 
	
		
			
				|  |  | -import com.ym.mec.biz.dal.page.CourseScheduleTeacherSalaryQueryInfo;
 | 
	
		
			
				|  |  | -import com.ym.mec.biz.dal.page.MusicGroupStudentQueryInfo;
 | 
	
		
			
				|  |  | -import com.ym.mec.biz.dal.page.StudentPaymentOrderQueryInfo;
 | 
	
		
			
				|  |  | -import com.ym.mec.biz.dal.page.StudentRegistrationQueryInfo;
 | 
	
		
			
				|  |  | +import com.ym.mec.biz.dal.page.*;
 | 
	
		
			
				|  |  |  import com.ym.mec.biz.service.*;
 | 
	
		
			
				|  |  |  import com.ym.mec.common.controller.BaseController;
 | 
	
		
			
				|  |  |  import com.ym.mec.common.exception.BizException;
 | 
	
	
		
			
				|  | @@ -30,15 +27,13 @@ import org.apache.poi.hssf.usermodel.HSSFWorkbook;
 | 
	
		
			
				|  |  |  import org.springframework.beans.factory.annotation.Autowired;
 | 
	
		
			
				|  |  |  import org.springframework.security.access.prepost.PreAuthorize;
 | 
	
		
			
				|  |  |  import org.springframework.stereotype.Controller;
 | 
	
		
			
				|  |  | +import org.springframework.web.bind.annotation.GetMapping;
 | 
	
		
			
				|  |  |  import org.springframework.web.bind.annotation.PostMapping;
 | 
	
		
			
				|  |  |  import org.springframework.web.bind.annotation.RequestMapping;
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  import javax.servlet.http.HttpServletResponse;
 | 
	
		
			
				|  |  |  import java.math.BigDecimal;
 | 
	
		
			
				|  |  | -import java.util.Date;
 | 
	
		
			
				|  |  | -import java.util.HashMap;
 | 
	
		
			
				|  |  | -import java.util.List;
 | 
	
		
			
				|  |  | -import java.util.Map;
 | 
	
		
			
				|  |  | +import java.util.*;
 | 
	
		
			
				|  |  |  import java.util.stream.Collectors;
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  @RequestMapping
 | 
	
	
		
			
				|  | @@ -66,6 +61,96 @@ public class ExportController extends BaseController {
 | 
	
		
			
				|  |  |      private VipGroupDao vipGroupDao;
 | 
	
		
			
				|  |  |      @Autowired
 | 
	
		
			
				|  |  |      private MusicGroupDao musicGroupDao;
 | 
	
		
			
				|  |  | +    @Autowired
 | 
	
		
			
				|  |  | +    private VipGroupService vipGroupService;
 | 
	
		
			
				|  |  | +    @Autowired
 | 
	
		
			
				|  |  | +    private CourseScheduleService scheduleService;
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    @ApiOperation(value = "导出VIP课管理")
 | 
	
		
			
				|  |  | +    @GetMapping("export/vipGroupList")
 | 
	
		
			
				|  |  | +    @PreAuthorize("@pcs.hasPermissions('export/vipGroupList')")
 | 
	
		
			
				|  |  | +    public void queryAll(HttpServletResponse response,VipGroupQueryInfo queryInfo) {
 | 
	
		
			
				|  |  | +        queryInfo.setRows(999999999);
 | 
	
		
			
				|  |  | +        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<VipGroup> rows = vipGroupService.findVipGroups(queryInfo).getRows();
 | 
	
		
			
				|  |  | +        if(rows != null && rows.size() > 0){
 | 
	
		
			
				|  |  | +            rows.forEach(e->{
 | 
	
		
			
				|  |  | +                e.setSubClassTimes(e.getTotalClassTimes()==null?0:e.getTotalClassTimes() - (e.getCurrentClassTimes()==null?0:e.getCurrentClassTimes()));
 | 
	
		
			
				|  |  | +            });
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +        try {
 | 
	
		
			
				|  |  | +            HSSFWorkbook workbook = POIUtil.exportExcel(new String[]{"VIP编号", "课程名称", "课程状态", "指导老师", "班级人数", "先上课单价", "线下课单价",
 | 
	
		
			
				|  |  | +                    "活动方案", "当前课次", "总课次", "剩余课次", "月消耗", "开课时间", "结束时间", "申请时间"}, new String[]{
 | 
	
		
			
				|  |  | +                    "id", "name", "status.msg", "userName", "studentNum", "onlineClassesUnitPrice",
 | 
	
		
			
				|  |  | +                    "offlineClassesUnitPrice", "vipGroupActivityName", "currentClassTimes", "totalClassTimes", "subClassTimes", "monthConsumeRate",
 | 
	
		
			
				|  |  | +                    "courseStartDate", "coursesExpireDate", "registrationStartTime"}, rows);
 | 
	
		
			
				|  |  | +            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();
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    @ApiOperation(value = "终极课表获取")
 | 
	
		
			
				|  |  | +    @GetMapping("export/superFindCourseSchedules")
 | 
	
		
			
				|  |  | +    @PreAuthorize("@pcs.hasPermissions('export/superFindCourseSchedules')")
 | 
	
		
			
				|  |  | +    public void superFindCourseSchedules(EndCourseScheduleQueryInfo queryInfo,HttpServletResponse response){
 | 
	
		
			
				|  |  | +        queryInfo.setRows(999999999);
 | 
	
		
			
				|  |  | +        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<CourseScheduleEndDto> rows = scheduleService.endFindCourseSchedules(queryInfo).getRows();
 | 
	
		
			
				|  |  | +        try {
 | 
	
		
			
				|  |  | +            HSSFWorkbook workbook = POIUtil.exportExcel(new String[]{"分部名称", "课程编号", "开始时间", "结束时间", "班级名称", "课程名称", "课程类型", "教学模式",
 | 
	
		
			
				|  |  | +                    "教学点", "课程状态", "签到时间", "签退时间", "是否点名", "指导老师"}, new String[]{
 | 
	
		
			
				|  |  | +                    "organName", "id", "startClassTime", "endClassTime", "classGroupName", "name",
 | 
	
		
			
				|  |  | +                    "groupType.desc", "teachMode.msg", "schoolName", "status.msg", "signInTime",
 | 
	
		
			
				|  |  | +                    "signOutTime", "isCallNames.msg", "teacherName"}, rows);
 | 
	
		
			
				|  |  | +            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();
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      @ApiOperation(value = "导出学员是否有课")
 | 
	
		
			
				|  |  |      @PostMapping("export/studentHasCourse")
 | 
	
	
		
			
				|  | @@ -351,5 +436,4 @@ public class ExportController extends BaseController {
 | 
	
		
			
				|  |  |              e.printStackTrace();
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  |  }
 |