Commit fd1a989e by wukaiqiang

Merge branch 'feature/form_statistics_05' into 'develop'

修复excel下载报错问题--默认请求返回JASON格式,已修改

See merge request kunlun/xyst_dinas/xyst_dinas_backend!27
parents d015baa7 69323753
......@@ -3,6 +3,7 @@ package com.xyst.dinas.statistics.internal.service;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.net.URLEncoder;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
......@@ -88,6 +89,7 @@ public class DownLoadStatisticsServiceImpl implements DownLoadStatisticsService
String endDate, String purchaseSandUnit, String project, String fundType, String paymentDetailsList)
throws IOException {
String fileName = new String("回款明细表".getBytes("gb2312"), "ISO8859-1") + ".xlsx";
//String fileName = URLEncoder.encode("回款明细表", "utf-8");
InputStream is = null;
for (Resource resource : resourcesXlsx) {
......@@ -117,27 +119,27 @@ public class DownLoadStatisticsServiceImpl implements DownLoadStatisticsService
cell0.setCellStyle(textBorderStyle);
XSSFCell cell1 = row.createCell(1);
cell1.setCellValue(paymentDetail.getCreateTime());
cell1.setCellValue(paymentDetail.getPurchaseSandUnit());
cell1.setCellStyle(textBorderStyle);
XSSFCell cell2 = row.createCell(2);
cell2.setCellValue(paymentDetail.getCreateTime());
cell2.setCellValue(paymentDetail.getProject());
cell2.setCellStyle(textBorderStyle);
XSSFCell cell3 = row.createCell(3);
cell3.setCellValue(paymentDetail.getCreateTime());
cell3.setCellValue(paymentDetail.getFundType());
cell3.setCellStyle(textBorderStyle);
XSSFCell cell4 = row.createCell(4);
cell4.setCellValue(paymentDetail.getCreateTime());
cell4.setCellValue(paymentDetail.getRechargeAmount());
cell4.setCellStyle(textBorderStyle);
XSSFCell cell5 = row.createCell(5);
cell5.setCellValue(paymentDetail.getCreateTime());
cell5.setCellValue(paymentDetail.getActualRefundAmount());
cell5.setCellStyle(textBorderStyle);
XSSFCell cell6 = row.createCell(6);
cell6.setCellValue(paymentDetail.getCreateTime());
cell6.setCellValue(paymentDetail.getRemark());
cell6.setCellStyle(textBorderStyle);
r++;
}
......
......@@ -4,9 +4,12 @@ import java.io.IOException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import com.beecode.inz.basis.team.pojo.ResponseObj;
import com.xyst.dinas.statistics.service.DownLoadStatisticsService;
import com.xyst.dinas.statistics.web.Info.ConditionsDetailsInfo;
......@@ -16,18 +19,15 @@ public class DownLoadStatisticsController {
@Autowired
DownLoadStatisticsService downLoadStatisticsService;
@PostMapping(value = "/DownLoadStatistics/downLoadStatisticsService", consumes = "application/json")
public Object downLoadStatisticsService(HttpServletResponse response, HttpServletRequest request,
@RequestMapping(value ="/DownLoadStatistics/downLoadStatisticsService", method = RequestMethod.GET)
public void downLoadStatisticsService(HttpServletResponse response, HttpServletRequest request,
@RequestBody ConditionsDetailsInfo conditionsDetailsInfo) {
try {
downLoadStatisticsService.downLoadStatisticsServiceTable(response, request, conditionsDetailsInfo);
return ResponseObj.success("数据下成功");
} catch (RuntimeException e) {
// TODO: handle exception
return ResponseObj.error("数据下成功操作后台失败!详情请查看日志", e.getMessage());
} catch (IOException e) {
// TODO Auto-generated catch block
return ResponseObj.error("数据下成功操作后台失败!详情请查看日志", e.getMessage());
}
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment