Commit 908e4b7e authored by 付培阳's avatar 付培阳

值班导入导出

parent 7d1f1741
......@@ -120,7 +120,8 @@ public class ExcelUtil {
}
}
}
// String s = new String(fileName.getBytes(), "UTF-8");
// response.setHeader("Content-Disposition", "attachment;filename=" + URLEncoder.encode(s, "UTF-8"));
ExcelWriterSheetBuilder excelWriterSheetBuilder = EasyExcel.write(getOutputStream(fileName, response,
ExcelTypeEnum.XLSX)).head(dutyCarTitleList).excelType(ExcelTypeEnum.XLSX)
.sheet(sheetName).registerWriteHandler(new TemplateCellWriteHandlerDate(explicitListConstraintMap))
......@@ -251,10 +252,12 @@ public class ExcelUtil {
//创建本地文件
String filePath = fileName + excelTypeEnum.getValue();
try {
fileName = new String(filePath.getBytes(), StandardCharsets.ISO_8859_1);
fileName = new String(filePath.getBytes(),"UTF-8");
response.setCharacterEncoding(StandardCharsets.UTF_8.name());
response.setContentType("application/vnd.ms-excel");
response.addHeader("Content-Disposition", "filename=" + fileName);
response.setHeader("Content-Disposition", "attachment; filename=" + URLEncoder.encode(fileName,
StandardCharsets.UTF_8.name()));
return response.getOutputStream();
} catch (IOException e) {
throw new Exception("系统异常");
......
......@@ -159,7 +159,7 @@ public class ExcelController extends BaseController {
@TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
@ApiOperation(value = "上传文件数据-")
@PostMapping("/upload")
public void template2(MultipartFile multipartFile, ExcelDto excelDto) {
public void template2(@RequestPart("file") MultipartFile multipartFile, ExcelDto excelDto) {
try {
switch (excelDto.getType()) {
......
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