|
@@ -18,10 +18,12 @@ import com.ym.mec.common.tenant.TenantContextHolder;
|
|
|
import com.ym.mec.util.collection.MapUtil;
|
|
|
import com.ym.mec.util.date.DateUtil;
|
|
|
import com.ym.mec.util.excel.POIUtil;
|
|
|
+
|
|
|
import io.swagger.annotations.Api;
|
|
|
import io.swagger.annotations.ApiImplicitParam;
|
|
|
import io.swagger.annotations.ApiImplicitParams;
|
|
|
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;
|
|
@@ -31,6 +33,7 @@ import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
+
|
|
|
import java.io.IOException;
|
|
|
import java.io.OutputStream;
|
|
|
import java.math.BigDecimal;
|
|
@@ -145,6 +148,9 @@ public class ExportController extends BaseController {
|
|
|
|
|
|
@Autowired
|
|
|
private SysMusicCompareRecordService sysMusicCompareRecordService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private SchoolService schoolService;
|
|
|
|
|
|
@ApiOperation(value = "获取可导出字段")
|
|
|
@RequestMapping("export/getFields")
|
|
@@ -2951,4 +2957,40 @@ public class ExportController extends BaseController {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ @ApiOperation(value = "教学点管理导出")
|
|
|
+ @PostMapping("export/exportSchoolList")
|
|
|
+ @PreAuthorize("@pcs.hasPermissions('export/exportSchoolList')")
|
|
|
+ public void exportSchoolList(HttpServletResponse response, SchoolQueryInfo queryInfo) throws IOException {
|
|
|
+ queryInfo.setPage(1);
|
|
|
+ queryInfo.setRows(49999);
|
|
|
+
|
|
|
+ List<School> rows = schoolService.querySchoolExportList(queryInfo);
|
|
|
+ if (rows.size() < 1) {
|
|
|
+ throw new BizException("没有可导出数据");
|
|
|
+ }
|
|
|
+ OutputStream outputStream = response.getOutputStream();
|
|
|
+ try {
|
|
|
+ HSSFWorkbook workbook = POIUtil.exportExcel(new String[]{"分部", "编号", "教学点来源", "教学点名称","可用状态",
|
|
|
+ "租赁费用","上课地点详情"}, new String[]{
|
|
|
+ "organName", "id", "cooperationOrganName", "name", "realName","subsidy","address"}, rows);
|
|
|
+ response.setContentType("application/octet-stream");
|
|
|
+ response.setHeader("Content-Disposition", "attac:wq" +
|
|
|
+ "hment;filename=SchoolList-" + DateUtil.getDate(new Date()) + ".xls");
|
|
|
+
|
|
|
+ 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();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|