|
|
@ -78,23 +78,6 @@ public class DcWarningController extends BaseController |
|
|
|
@Log(title = "预警信息", businessType = BusinessType.EXPORT) |
|
|
|
@PostMapping("/export") |
|
|
|
public void export(HttpServletResponse response,@RequestBody DcWarning dcWarning) throws UnsupportedEncodingException { |
|
|
|
String percentEncodedFileName=URLEncoder.encode("感知事件列表.xlsx", StandardCharsets.UTF_8.toString()).replaceAll("\\+", "%20"); |
|
|
|
if (dcWarning!=null&&dcWarning.getWarningSource()!=null&&dcWarning.getWarningSource()==6){ |
|
|
|
percentEncodedFileName = URLEncoder.encode("非机预警事件列表.xlsx", StandardCharsets.UTF_8.toString()).replaceAll("\\+", "%20"); |
|
|
|
} |
|
|
|
if (dcWarning!=null&&dcWarning.getWarningState()!=null&&dcWarning.getWarningState()==1){ |
|
|
|
percentEncodedFileName = URLEncoder.encode("告警事件列表.xlsx", StandardCharsets.UTF_8.toString()).replaceAll("\\+", "%20"); |
|
|
|
} |
|
|
|
StringBuilder contentDispositionValue = new StringBuilder(); |
|
|
|
contentDispositionValue.append("attachment; filename=") |
|
|
|
.append(percentEncodedFileName) |
|
|
|
.append(";") |
|
|
|
.append("filename*=") |
|
|
|
.append("utf-8''") |
|
|
|
.append(percentEncodedFileName); |
|
|
|
response.addHeader("Access-Control-Expose-Headers", "Content-Disposition,download-filename"); |
|
|
|
response.setHeader("Content-disposition", contentDispositionValue.toString()); |
|
|
|
response.setHeader("download-filename", percentEncodedFileName); |
|
|
|
List<DcWarning> list = dcWarningService.export(dcWarning); |
|
|
|
ExcelUtil<DcWarning> util = new ExcelUtil<>(DcWarning.class); |
|
|
|
util.exportExcel(response, list, UniversalEnum.EARLY_WARNING_INFORMATION_DATA.getValue()); |
|
|
|