@RequestMapping(path = { "api-mem-info-export" }, method = { RequestMethod.POST })
public ResponseEntity<byte[]> ddd(HttpServletRequest request) throws BusinessException{
MemUserInfo memUserInfo = new MemUserInfo();
List<MemUserInfo> select = memUserInfoService.select(memUserInfo);
HttpHeaders headers = new HttpHeaders();
headers.setContentDispositionFormData("attachment", "会员信息.xlsx");
headers.setContentType(MediaType.APPLICATION_OCTET_STREAM);
String[] arr = new String[]{"会员账号","结构","真实姓名","身份正证号","卡号 ","开户支行","账户余额","电话号码","QQ号码"};
Workbook wb = new XSSFWorkbook();
Sheet sheet = wb.createSheet("会员信息");
// 创建行 第一行
Row Row1 = sheet.createRow((int) 0);
for(int i=0;i<arr.length;i++){
Cell createCell = Row1.createCell(i);
createCell.setCellValue(arr[i]);
}
for(int i=1;i<=select.size();i++){
Row createRow = sheet.createRow(i);
List<String> list = new ArrayList<String>();
list.add(select.get(i-1).getLoginName());
list.add(select.get(i-1).getAgentName());
list.add(select.get(i-1).getUserName());
list.add(select.get(i-1).getCertifyNo());
list.add(select.get(i-1).getBankAccount());
list.add(select.get(i-1).getBankSubName());
list.add(String.valueOf(select.get(i-1).getCapital1()));
list.add(select.get(i-1).getUserMobi());
list.add(select.get(i-1).getQqUid());
for(int j=0;j<9;j++){
Cell createCell = createRow.createCell(j);
createCell.setCellValue(list.get(j));
}
}
ByteArrayOutputStream baos = new ByteArrayOutputStream();
try {
wb.write(baos);
wb.close();
return new ResponseEntity<byte[]>(baos.toByteArray(), headers, HttpStatus.OK);
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
} finally {
try {
if (baos != null)
baos.close();
} catch (Exception e) {
}
}
return null;
}
public ResponseEntity<byte[]> ddd(HttpServletRequest request) throws BusinessException{
MemUserInfo memUserInfo = new MemUserInfo();
List<MemUserInfo> select = memUserInfoService.select(memUserInfo);
HttpHeaders headers = new HttpHeaders();
headers.setContentDispositionFormData("attachment", "会员信息.xlsx");
headers.setContentType(MediaType.APPLICATION_OCTET_STREAM);
String[] arr = new String[]{"会员账号","结构","真实姓名","身份正证号","卡号 ","开户支行","账户余额","电话号码","QQ号码"};
Workbook wb = new XSSFWorkbook();
Sheet sheet = wb.createSheet("会员信息");
// 创建行 第一行
Row Row1 = sheet.createRow((int) 0);
for(int i=0;i<arr.length;i++){
Cell createCell = Row1.createCell(i);
createCell.setCellValue(arr[i]);
}
for(int i=1;i<=select.size();i++){
Row createRow = sheet.createRow(i);
List<String> list = new ArrayList<String>();
list.add(select.get(i-1).getLoginName());
list.add(select.get(i-1).getAgentName());
list.add(select.get(i-1).getUserName());
list.add(select.get(i-1).getCertifyNo());
list.add(select.get(i-1).getBankAccount());
list.add(select.get(i-1).getBankSubName());
list.add(String.valueOf(select.get(i-1).getCapital1()));
list.add(select.get(i-1).getUserMobi());
list.add(select.get(i-1).getQqUid());
for(int j=0;j<9;j++){
Cell createCell = createRow.createCell(j);
createCell.setCellValue(list.get(j));
}
}
ByteArrayOutputStream baos = new ByteArrayOutputStream();
try {
wb.write(baos);
wb.close();
return new ResponseEntity<byte[]>(baos.toByteArray(), headers, HttpStatus.OK);
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
} finally {
try {
if (baos != null)
baos.close();
} catch (Exception e) {
}
}
return null;
}