|  | @@ -1,25 +1,5 @@
 | 
	
		
			
				|  |  |  package com.ym.mec.web.controller;
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -import io.swagger.annotations.Api;
 | 
	
		
			
				|  |  | -import io.swagger.annotations.ApiImplicitParam;
 | 
	
		
			
				|  |  | -import io.swagger.annotations.ApiImplicitParams;
 | 
	
		
			
				|  |  | -import io.swagger.annotations.ApiOperation;
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -import java.io.IOException;
 | 
	
		
			
				|  |  | -import java.io.OutputStream;
 | 
	
		
			
				|  |  | -import java.util.Date;
 | 
	
		
			
				|  |  | -import java.util.List;
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -import javax.servlet.http.HttpServletResponse;
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -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 com.ym.mec.biz.dal.dto.StudentApplyDetailDto;
 | 
	
		
			
				|  |  |  import com.ym.mec.biz.dal.dto.TeacherSalaryDto;
 | 
	
		
			
				|  |  |  import com.ym.mec.biz.dal.entity.Goods;
 | 
	
	
		
			
				|  | @@ -32,6 +12,20 @@ import com.ym.mec.common.controller.BaseController;
 | 
	
		
			
				|  |  |  import com.ym.mec.common.exception.BizException;
 | 
	
		
			
				|  |  |  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.poi.hssf.usermodel.HSSFWorkbook;
 | 
	
		
			
				|  |  | +import org.springframework.beans.factory.annotation.Autowired;
 | 
	
		
			
				|  |  | +import org.springframework.stereotype.Controller;
 | 
	
		
			
				|  |  | +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;
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  @RequestMapping
 | 
	
		
			
				|  |  |  @Api(tags = "数据导出服务")
 | 
	
	
		
			
				|  | @@ -45,18 +39,45 @@ public class ExportController extends BaseController {
 | 
	
		
			
				|  |  |      @Autowired
 | 
	
		
			
				|  |  |      private CourseScheduleTeacherSalaryService courseScheduleTeacherSalaryService;
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | +    /*@RequestMapping("order/musicalListExport")
 | 
	
		
			
				|  |  | +    public ResponseEntity<byte[]> exportExcel(String musicGroupId) {
 | 
	
		
			
				|  |  | +        // 每次只需要改这几行
 | 
	
		
			
				|  |  | +        List<Goods> musicalList = studentPaymentOrderDetailService.getMusicalList(musicGroupId);
 | 
	
		
			
				|  |  | +        if(musicalList == null || musicalList.size() < 1){
 | 
	
		
			
				|  |  | +            throw new BizException("数据为空");
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +        String fileName = "乐器采购清单";
 | 
	
		
			
				|  |  | +        String[] headers = new String[] {"乐团","分部","商品类型", "商品名称", "型号", "数量"};
 | 
	
		
			
				|  |  | +        String[] getters  = new String[] {"getMemo","getBrief","getType","getName","getSpecification","getSellCount"};
 | 
	
		
			
				|  |  | +        Workbook wb = POIUtil.createWorkBook(musicalList, getters, headers,Goods.class);
 | 
	
		
			
				|  |  | +        ByteArrayOutputStream os = new ByteArrayOutputStream();
 | 
	
		
			
				|  |  | +        try {
 | 
	
		
			
				|  |  | +            wb.write(os);
 | 
	
		
			
				|  |  | +        } catch (IOException e) {
 | 
	
		
			
				|  |  | +            e.printStackTrace();
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +        byte[] content = os.toByteArray();
 | 
	
		
			
				|  |  | +        HttpHeaders httpHeaders = new HttpHeaders();
 | 
	
		
			
				|  |  | +        try {
 | 
	
		
			
				|  |  | +            fileName = URLEncoder.encode(fileName, "UTF-8");
 | 
	
		
			
				|  |  | +        } catch (UnsupportedEncodingException e) {
 | 
	
		
			
				|  |  | +            e.printStackTrace();
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +        httpHeaders.setContentDispositionFormData("attachment", fileName + ".xlsx");
 | 
	
		
			
				|  |  | +        return new ResponseEntity<>(content, httpHeaders, HttpStatus.OK);
 | 
	
		
			
				|  |  | +    }*/
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |      @ApiOperation(value = "导出乐器采购清单")
 | 
	
		
			
				|  |  | -    @GetMapping("order/musicalListExport")
 | 
	
		
			
				|  |  | -    @ApiImplicitParams({@ApiImplicitParam(name = "musicGroupId", value = "乐团id", required = true, dataType = "String")})
 | 
	
		
			
				|  |  | -    public void musicalListExport(HttpServletResponse response,String musicGroupId){
 | 
	
		
			
				|  |  | +    @PostMapping("order/musicalListExport")
 | 
	
		
			
				|  |  | +    public void musicalListExport(HttpServletResponse response, String musicGroupId){
 | 
	
		
			
				|  |  |          List<Goods> musicalList = studentPaymentOrderDetailService.getMusicalList(musicGroupId);
 | 
	
		
			
				|  |  |          if(musicalList == null || musicalList.size() < 1){
 | 
	
		
			
				|  |  |              throw new BizException("数据为空");
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |          OutputStream outputStream = null;
 | 
	
		
			
				|  |  |          try {
 | 
	
		
			
				|  |  | -            HSSFWorkbook workbook = POIUtil.exportExcel(new String[] { "分部","乐团", "声部", "商品名称", "数量"}, new String[] {
 | 
	
		
			
				|  |  | -                    "brief","memo", "currentGrade", "currentClass", "gender", "isAllowAdjust.msg"}, musicalList);
 | 
	
		
			
				|  |  | +            HSSFWorkbook workbook = POIUtil.exportExcel(new String[] {"乐团","分部","商品类型", "商品名称", "型号", "数量"}, new String[] {
 | 
	
		
			
				|  |  | +                    "brief","memo","type.desc","name","specification","sellCount"}, musicalList);
 | 
	
		
			
				|  |  |              response.setContentType("application/msexcel");
 | 
	
		
			
				|  |  |              response.setHeader("Content-disposition", "attachment;filename=lender-" + DateUtil.getDate(new Date()) + ".xls");
 | 
	
		
			
				|  |  |              outputStream = response.getOutputStream();
 | 
	
	
		
			
				|  | @@ -86,7 +107,7 @@ public class ExportController extends BaseController {
 | 
	
		
			
				|  |  |          try {
 | 
	
		
			
				|  |  |              HSSFWorkbook workbook = POIUtil.exportExcel(new String[] { "学生姓名","家长姓名", "年级", "班级", "性别", "服从调剂","报名专业", "实际专业","联系电话", "学员缴费状态", "乐器购买方式"}, new String[] {
 | 
	
		
			
				|  |  |                      "studentName","parentsName", "currentGrade", "currentClass", "gender", "isAllowAdjust.msg", "subjectName", "actualSubjectName", "parentsPhone","paymentStatus","kitGroupPurchaseTypeEnum.msg"}, studentApplyDetail);
 | 
	
		
			
				|  |  | -            response.setContentType("application/msexcel");
 | 
	
		
			
				|  |  | +            response.setContentType("application/vnd.ms-excel");
 | 
	
		
			
				|  |  |              response.setHeader("Content-disposition", "attachment;filename=lender-" + DateUtil.getDate(new Date()) + ".xls");
 | 
	
		
			
				|  |  |              outputStream = response.getOutputStream();
 | 
	
		
			
				|  |  |              workbook.write(outputStream);
 |