|
@@ -16,10 +16,10 @@ 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.security.access.prepost.PreAuthorize;
|
|
|
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;
|
|
@@ -39,34 +39,6 @@ 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 = "导出乐器采购清单")
|
|
|
@PostMapping("order/musicalListExport")
|
|
|
public void musicalListExport(HttpServletResponse response, String musicGroupId){
|
|
@@ -98,30 +70,22 @@ public class ExportController extends BaseController {
|
|
|
|
|
|
@ApiOperation(value = "乐团【报名中、缴费中】 学生详情列表导出")
|
|
|
@PostMapping(value = "studentRegistration/queryStudentApplyDetailExport")
|
|
|
+ @PreAuthorize("@pcs.hasPermissions('studentRegistration/queryStudentApplyDetailExport')")
|
|
|
public void queryStudentApplyDetailExport(StudentRegistrationQueryInfo queryInfo, HttpServletResponse response) {
|
|
|
List<StudentApplyDetailDto> studentApplyDetail = studentRegistrationService.queryStudentDetailPage(queryInfo).getRows();
|
|
|
if(studentApplyDetail == null || studentApplyDetail.size() < 1){
|
|
|
throw new BizException("数据为空");
|
|
|
}
|
|
|
- OutputStream outputStream = null;
|
|
|
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/vnd.ms-excel");
|
|
|
- response.setHeader("Content-disposition", "attachment;filename=lender-" + DateUtil.getDate(new Date()) + ".xls");
|
|
|
- outputStream = response.getOutputStream();
|
|
|
- workbook.write(outputStream);
|
|
|
- outputStream.flush();
|
|
|
+ "studentName","parentsName", "currentGrade", "currentClass", "gender.description", "isAllowAdjust.msg", "subjectName", "actualSubjectName", "parentsPhone","paymentStatus.desc","kitGroupPurchaseTypeEnum.msg"}, studentApplyDetail);
|
|
|
+ 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();
|
|
|
- } finally {
|
|
|
- if (outputStream != null) {
|
|
|
- try {
|
|
|
- outputStream.close();
|
|
|
- } catch (IOException e) {
|
|
|
- e.printStackTrace();
|
|
|
- }
|
|
|
- }
|
|
|
}
|
|
|
}
|
|
|
|