|
|
@@ -13,10 +13,7 @@ import org.slf4j.Logger;
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.validation.annotation.Validated;
|
|
|
-import org.springframework.web.bind.annotation.PostMapping;
|
|
|
-import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
-import org.springframework.web.bind.annotation.RequestParam;
|
|
|
-import org.springframework.web.bind.annotation.RestController;
|
|
|
+import org.springframework.web.bind.annotation.*;
|
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
|
|
|
|
import java.io.ByteArrayOutputStream;
|
|
|
@@ -61,7 +58,7 @@ public class PerformanceVerificationController extends GenericProvider{
|
|
|
}
|
|
|
|
|
|
@PostMapping("/exportExcelTemplate")
|
|
|
- @ApiOperation(value = "导出数据模板", notes = "导出数据")
|
|
|
+ @ApiOperation(value = "导出数据模板", notes = "导出数据模板")
|
|
|
public void exportExcelTemplate(@RequestParam(value = "name") String name,
|
|
|
@RequestParam(value = "id") String id) {
|
|
|
ByteArrayOutputStream bos = null;
|
|
|
@@ -88,4 +85,32 @@ public class PerformanceVerificationController extends GenericProvider{
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+ @PostMapping("/exportExcelReport")
|
|
|
+ @ApiOperation(value = "导出数据报告", notes = "导出数据报告")
|
|
|
+ public void exportExcelReport(@RequestParam(value = "name") String name,
|
|
|
+ @RequestParam(value = "id") String id) {
|
|
|
+ ByteArrayOutputStream bos = null;
|
|
|
+ try {
|
|
|
+
|
|
|
+ Workbook workbook = performanceVerificationService.exportExcelReport(name, id);
|
|
|
+// String rootRealPath = AppFileUtil.getRealPath("/" + AppFileUtil.TEMP_PATH); // 操作的根目录
|
|
|
+ String fileName = "dataTemplate_" + name + (workbook instanceof HSSFWorkbook ? ".xls" : ".xlsx");
|
|
|
+// FileUtil.writeFile(rootRealPath + File.separator + fileName + (workbook instanceof HSSFWorkbook ? ".xls" : ".xlsx"), workbook);
|
|
|
+ bos = new ByteArrayOutputStream();
|
|
|
+ workbook.write(bos);
|
|
|
+ byte[] barray = bos.toByteArray();
|
|
|
+ com.lc.ibps.base.web.util.RequestUtil.downLoadFileByByte(this.getRequest(), this.getResponse(), barray, fileName);// 导出
|
|
|
+
|
|
|
+ } catch (Exception e) {
|
|
|
+ logger.error("/pv/exportExcelReport", e);
|
|
|
+ } finally {
|
|
|
+ if (bos != null) {
|
|
|
+ try {
|
|
|
+ bos.close();
|
|
|
+ } catch (IOException e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|