|
@@ -20,7 +20,7 @@ import com.google.zxing.common.detector.MathUtils;
|
20
|
20
|
import lombok.Data;
|
21
|
21
|
import lombok.extern.slf4j.Slf4j;
|
22
|
22
|
import org.apache.commons.lang3.StringUtils;
|
23
|
|
-import org.apache.poi.hssf.usermodel.HSSFWorkbook;
|
|
23
|
+import org.apache.poi.hssf.usermodel.*;
|
24
|
24
|
import org.apache.poi.ss.usermodel.Cell;
|
25
|
25
|
import org.apache.poi.ss.usermodel.Row;
|
26
|
26
|
import org.apache.poi.ss.usermodel.Sheet;
|
|
@@ -31,7 +31,10 @@ import org.springframework.stereotype.Service;
|
31
|
31
|
import org.springframework.transaction.annotation.Transactional;
|
32
|
32
|
import org.springframework.web.multipart.MultipartFile;
|
33
|
33
|
|
|
34
|
+import java.io.FileInputStream;
|
|
35
|
+import java.io.FileNotFoundException;
|
34
|
36
|
import java.io.IOException;
|
|
37
|
+import java.io.InputStream;
|
35
|
38
|
import java.text.ParseException;
|
36
|
39
|
import java.text.SimpleDateFormat;
|
37
|
40
|
import java.util.Date;
|
|
@@ -463,4 +466,79 @@ public class BillServiceImpl extends ServiceImpl<BillMapper, Bill> implements IB
|
463
|
466
|
// 收费说明
|
464
|
467
|
private String billExplain;
|
465
|
468
|
}
|
|
469
|
+
|
|
470
|
+ @Override
|
|
471
|
+ public ResponseBean downloadExcel(String parameter) {
|
|
472
|
+ ResponseBean responseBean = new ResponseBean();
|
|
473
|
+
|
|
474
|
+ InputStream inputStream = null;
|
|
475
|
+ HSSFWorkbook workbook = null;
|
|
476
|
+ try {
|
|
477
|
+ inputStream = new FileInputStream("缴费单模板.xls");
|
|
478
|
+ workbook = new HSSFWorkbook(inputStream);
|
|
479
|
+ } catch (FileNotFoundException e) {
|
|
480
|
+ e.printStackTrace();
|
|
481
|
+ } catch (IOException e) {
|
|
482
|
+ e.printStackTrace();
|
|
483
|
+ }
|
|
484
|
+
|
|
485
|
+
|
|
486
|
+ HSSFSheet sheet = workbook.createSheet("缴费单");
|
|
487
|
+ // 创建行
|
|
488
|
+ HSSFRow row = sheet.createRow(0);
|
|
489
|
+ // 创建列
|
|
490
|
+ HSSFCell cell = row.createCell(0);
|
|
491
|
+ cell.setCellValue("1.第1行到第4行为模板说明。第5行为列头。第6行为示例。第7行及以后行中的金额部分为需要您填写的区域。请不要删除任何列、说明以及示例等。");
|
|
492
|
+ row = sheet.createRow(1);
|
|
493
|
+ cell = row.createCell(0);
|
|
494
|
+ cell.setCellValue("2.下表中 栋/单元/楼层/房号/业主姓名为系统生成,自行增加、修改无效,只能修改金额!!!如果没有内容或缺失内容,请先登录物业系统,在 社区管理——业主/楼盘——楼盘库中添加楼盘信息,在社区管理——业主/楼盘——业主资料库中添加业主信息,完成后再重新下载账单模板。");
|
|
495
|
+ row = sheet.createRow(2);
|
|
496
|
+ cell = row.createCell(0);
|
|
497
|
+ cell.setCellValue("3.无需缴费的户可以直接在户所在行最左侧行号上点击右键删除行。");
|
|
498
|
+ row = sheet.createRow(3);
|
|
499
|
+ cell = row.createCell(0);
|
|
500
|
+ cell.setCellValue("4.需要缴费的户,在金额列中填写金额,默认单位为人民币元,请输入大于0的数字,小数点请用英文小数点,更不能使用句号。最多保留小数点后两位。若是复制粘贴的金额,请在粘贴后检查金额是否正确,系统暂时无法退费,请仔细核对账单");
|
|
501
|
+ row = sheet.createRow(4);
|
|
502
|
+ cell = row.createCell(0);
|
|
503
|
+ cell.setCellValue("期/区");
|
|
504
|
+ cell = row.createCell(1);
|
|
505
|
+ cell.setCellValue("栋");
|
|
506
|
+ cell = row.createCell(2);
|
|
507
|
+ cell.setCellValue("单元");
|
|
508
|
+ cell = row.createCell(3);
|
|
509
|
+ cell.setCellValue("楼层");
|
|
510
|
+ cell = row.createCell(4);
|
|
511
|
+ cell.setCellValue("房号");
|
|
512
|
+ cell = row.createCell(5);
|
|
513
|
+ cell.setCellValue("业主姓名");
|
|
514
|
+ cell = row.createCell(6);
|
|
515
|
+ cell.setCellValue("金额(元)");
|
|
516
|
+
|
|
517
|
+ String [] [] data = new String[][] {{"1区","0", "0", "0", "0", "示例忽删", "12.34", "<-示例"}};
|
|
518
|
+ int crrentRow = 5;
|
|
519
|
+ // 行数
|
|
520
|
+ for (int i = 0; i < data.length; i++) {
|
|
521
|
+ row = sheet.createRow(i + crrentRow);
|
|
522
|
+ for (int t = 0; t < data[i].length; t++) {
|
|
523
|
+ cell = row.createCell(t);
|
|
524
|
+ cell.setCellValue(data[i][t]);
|
|
525
|
+ }
|
|
526
|
+ }
|
|
527
|
+
|
|
528
|
+ responseBean.addSuccess(workbook);
|
|
529
|
+ return responseBean;
|
|
530
|
+ }
|
|
531
|
+
|
|
532
|
+ private void setExcelData(String [][] data, HSSFSheet sheet, HSSFRow row, HSSFCell cell){
|
|
533
|
+ int crrentRow = 5;
|
|
534
|
+ // 行数
|
|
535
|
+ for (int i = 0; i < data.length; i++) {
|
|
536
|
+ row = sheet.createRow(i + crrentRow);
|
|
537
|
+ for (int t = 0; t < data[i].length; t++) {
|
|
538
|
+ cell = row.createCell(t);
|
|
539
|
+ cell.setCellValue(data[i][t]);
|
|
540
|
+ }
|
|
541
|
+ }
|
|
542
|
+ }
|
|
543
|
+
|
466
|
544
|
}
|