|
@@ -72,15 +72,16 @@ public class StmtController
|
|
|
* @return
|
|
|
*/
|
|
|
@RequestMapping(value = {"/campus/export", "/"}, method = RequestMethod.GET)
|
|
|
- public APIResult<Page<CampusVo>> exportCampus(HttpServletResponse res, @NeedUser UserDetails user, CampusSearchDTO campusSearchDTO)
|
|
|
+ public String exportCampus(HttpServletResponse res, @NeedUser UserDetails user, CampusSearchDTO campusSearchDTO)
|
|
|
{
|
|
|
if (!user.isPlatForm())
|
|
|
{
|
|
|
String merchantId = user.getMerchantId();
|
|
|
campusSearchDTO.setMerchantId(merchantId);
|
|
|
}
|
|
|
- APIResult<Page<CampusVo>> pageData = StmtService.search(BeanUtil.convertToMap(campusSearchDTO));
|
|
|
+ APIResult<List<CampusVo>> apiResult = StmtService.query(BeanUtil.convertToMap(campusSearchDTO));
|
|
|
|
|
|
+ List<CampusVo> list = apiResult.getData();
|
|
|
//创建HSSFWorkbook对象(excel的文档对象)
|
|
|
HSSFWorkbook wb = new HSSFWorkbook();
|
|
|
//建立新的sheet对象(excel的表单)
|
|
@@ -96,17 +97,29 @@ public class StmtController
|
|
|
//在sheet里创建第二行
|
|
|
HSSFRow row2 = sheet.createRow(1);
|
|
|
//创建单元格并设置单元格内容
|
|
|
- row2.createCell(0).setCellValue("姓名");
|
|
|
- row2.createCell(1).setCellValue("班级");
|
|
|
- row2.createCell(2).setCellValue("笔试成绩");
|
|
|
- row2.createCell(3).setCellValue("机试成绩");
|
|
|
- //在sheet里创建第三行
|
|
|
- HSSFRow row3 = sheet.createRow(2);
|
|
|
- row3.createCell(0).setCellValue("李明");
|
|
|
- row3.createCell(1).setCellValue("As178");
|
|
|
- row3.createCell(2).setCellValue(87);
|
|
|
- row3.createCell(3).setCellValue(78);
|
|
|
- //.....省略部分代码
|
|
|
+ row2.createCell(0).setCellValue("校区名");
|
|
|
+ row2.createCell(1).setCellValue("客户类型");
|
|
|
+ row2.createCell(2).setCellValue("创建日期");
|
|
|
+ row2.createCell(3).setCellValue("省");
|
|
|
+ row2.createCell(4).setCellValue("市");
|
|
|
+ row2.createCell(5).setCellValue("联系人");
|
|
|
+ row2.createCell(6).setCellValue("联系方式");
|
|
|
+
|
|
|
+ //插入数据
|
|
|
+ if (list != null && list.size() > 0)
|
|
|
+ {
|
|
|
+ for (CampusVo vo : list)
|
|
|
+ {
|
|
|
+ HSSFRow row = sheet.createRow(2);
|
|
|
+ row.createCell(0).setCellValue(vo.getName());
|
|
|
+ row.createCell(1).setCellValue(vo.getMerchantName());
|
|
|
+ row.createCell(2).setCellValue(vo.getGmtCreated());
|
|
|
+ row.createCell(3).setCellValue(vo.getProvinceName());
|
|
|
+ row.createCell(4).setCellValue(vo.getCityName());
|
|
|
+ row.createCell(5).setCellValue(vo.getContactName());
|
|
|
+ row.createCell(6).setCellValue(vo.getMobile());
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
try
|
|
|
{
|