|
|
@@ -1289,6 +1289,65 @@ public class FundIncomeInfoController {
|
|
|
}
|
|
|
|
|
|
|
|
|
+
|
|
|
+ @ApiOperation(value = "汇总表选择导出")
|
|
|
+ @RequestMapping(value = "selectExportXls", method = RequestMethod.POST)
|
|
|
+ public MessageResult<Object> selectExportXls(@RequestBody List<Map> dataTable) {
|
|
|
+ MessageResult<Object> msgResult = new MessageResult<>();
|
|
|
+
|
|
|
+ Workbook workbook = new HSSFWorkbook();
|
|
|
+ Sheet sheet = workbook.createSheet();
|
|
|
+
|
|
|
+ //表头
|
|
|
+ Row rowTitle = sheet.createRow(0);
|
|
|
+
|
|
|
+ String[] titles = new String[]{"排序号", "序号", "收入子项目", "预算收入", "本月到账金额", "实际总收入", "累计欠费", "目前收入完全比率(%)",
|
|
|
+ "累计已支出金额", "实际收入结余", "备注"};
|
|
|
+
|
|
|
+ for (int i = 0; i < titles.length; i++) {
|
|
|
+ Cell cell = rowTitle.createCell(i);
|
|
|
+ cell.setCellValue(titles[i]);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ for (int i = 0; i < dataTable.size(); i++) {
|
|
|
+ Map<String, Object> map = dataTable.get(i);
|
|
|
+
|
|
|
+ Row row = sheet.createRow(i+1);
|
|
|
+
|
|
|
+ int colIndex = 0;
|
|
|
+ row.createCell(colIndex++).setCellValue(i + 1);
|
|
|
+ row.createCell(colIndex++).setCellValue(com.jpsoft.employment.modules.common.utils.StringUtils.strValue(map.get("serialNum"), ""));
|
|
|
+ row.createCell(colIndex++).setCellValue(com.jpsoft.employment.modules.common.utils.StringUtils.strValue(map.get("name"), ""));
|
|
|
+ row.createCell(colIndex++).setCellValue(com.jpsoft.employment.modules.common.utils.StringUtils.strValue(map.get("curBudgetRevenue"), ""));
|
|
|
+ row.createCell(colIndex++).setCellValue(com.jpsoft.employment.modules.common.utils.StringUtils.strValue(map.get("curMonthReceived"), ""));
|
|
|
+ row.createCell(colIndex++).setCellValue(com.jpsoft.employment.modules.common.utils.StringUtils.strValue(map.get("actualTotalRevenue"), ""));
|
|
|
+ row.createCell(colIndex++).setCellValue(com.jpsoft.employment.modules.common.utils.StringUtils.strValue(map.get("accumulatedArrears"), ""));
|
|
|
+ row.createCell(colIndex++).setCellValue(com.jpsoft.employment.modules.common.utils.StringUtils.strValue(map.get("percentage"), ""));
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ ByteArrayOutputStream output = new ByteArrayOutputStream();
|
|
|
+
|
|
|
+ try {
|
|
|
+ workbook.write(output);
|
|
|
+
|
|
|
+ byte[] buffer = output.toByteArray();
|
|
|
+ ByteArrayInputStream input = new ByteArrayInputStream(buffer);
|
|
|
+
|
|
|
+ String downloadUrl = OSSUtil.upload(ossConfig, "summaryList", "板块汇总表.xls", input);
|
|
|
+
|
|
|
+ msgResult.setData(downloadUrl);
|
|
|
+ msgResult.setResult(true);
|
|
|
+ } catch (Exception ex) {
|
|
|
+ logger.error(ex.getMessage(), ex);
|
|
|
+ msgResult.setResult(false);
|
|
|
+ }
|
|
|
+
|
|
|
+ return msgResult;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
private String dateFormate(String str) {
|
|
|
//String s="45292.0"; //举例日期为2024-01-01 / 45292.0
|
|
|
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
|