feat(settle report): download settle report excel from ui

master
yixian 5 years ago
parent 5af9537a6c
commit 1534515ee3

@ -10,6 +10,7 @@ import au.com.royalpay.payment.tools.permission.enums.ManagerRole;
import com.alibaba.fastjson.JSONObject;
import org.springframework.core.io.ByteArrayResource;
import org.springframework.core.io.InputStreamResource;
import org.springframework.http.HttpHeaders;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
@ -169,8 +170,10 @@ public class SettlementDevController {
@GetMapping("/settle_batches/{batchId}/settle_report_xlsx")
public ResponseEntity<ByteArrayResource> getSettlementReportForBatch(@PathVariable int batchId) {
ByteArrayResource body = cleanService.downloadBatchSettleReportXlsx(batchId);
return ResponseEntity.ok().contentType(MediaType.APPLICATION_OCTET_STREAM)
.body(cleanService.downloadBatchSettleReportXlsx(batchId));
.header(HttpHeaders.CONTENT_DISPOSITION, body.getFilename())
.body(body);
}
@GetMapping("/details/{detailId}")

@ -13,8 +13,8 @@ import java.util.Map;
* Create by davep at 2020-03-12 11:59
*/
public class ExcelTemplate {
public static final CellStyleFactory STYLE_LEFT = new CellStyleFactory(CellStyle.BORDER_MEDIUM, CellStyle.ALIGN_LEFT);
public static final CellStyleFactory STYLE_RIGHT = new CellStyleFactory(CellStyle.BORDER_MEDIUM, CellStyle.ALIGN_RIGHT);
public static final CellStyleFactory STYLE_LEFT = new CellStyleFactory(CellStyle.BORDER_THIN, CellStyle.ALIGN_LEFT);
public static final CellStyleFactory STYLE_RIGHT = new CellStyleFactory(CellStyle.BORDER_THIN, CellStyle.ALIGN_RIGHT);
private Map<String, SheetTemplate> sheets;
public ExcelTemplate() {
@ -104,7 +104,7 @@ public class ExcelTemplate {
rowNum++;
Workbook workbook = sheet.getWorkbook();
Font boldFont = PoiUtils.initBoldFont(workbook);
CellStyle titleStyle = new CellStyleFactory(CellStyle.BORDER_MEDIUM, CellStyle.ALIGN_CENTER).buildCellStyle(workbook, boldFont);
CellStyle titleStyle = new CellStyleFactory(CellStyle.BORDER_THIN, CellStyle.ALIGN_CENTER).buildCellStyle(workbook, boldFont);
for (int i = 0, len = columns.size(); i < len; i++) {
ColumnTemplate col = columns.get(i);
Cell cell = titleRow.createCell(i, Cell.CELL_TYPE_STRING);

Loading…
Cancel
Save