Commit 199b4c30 authored by Ryan Loong's avatar Ryan Loong

fix 文件导出

parent 6d6551e7
...@@ -6,6 +6,7 @@ import cn.exploring.engine.server.db.domain.StudentPointInfo; ...@@ -6,6 +6,7 @@ import cn.exploring.engine.server.db.domain.StudentPointInfo;
import cn.exploring.engine.server.db.domain.vo.IdVo; import cn.exploring.engine.server.db.domain.vo.IdVo;
import cn.exploring.engine.server.db.service.StudentInfoService; import cn.exploring.engine.server.db.service.StudentInfoService;
import cn.exploring.engine.server.db.service.StudentPointService; import cn.exploring.engine.server.db.service.StudentPointService;
import cn.exploring.engine.server.db.util.StrUtil;
import org.springframework.util.StringUtils; import org.springframework.util.StringUtils;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
...@@ -55,8 +56,7 @@ public class PointController { ...@@ -55,8 +56,7 @@ public class PointController {
FileInputStream in = null; FileInputStream in = null;
try { try {
in = new FileInputStream(file); in = new FileInputStream(file);
// return ResponseUtil.ok(storageService.store(in, file.length(), "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", file.getName(), storageService.generateKey(file.getName()))); return ResponseUtil.ok(storageService.store(in, file.length(), "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", StrUtil.format("学生成绩-{}.xlsx", System.currentTimeMillis()), storageService.generateKey(file.getName())));
return ResponseUtil.ok(storageService.store(in, file.length(), "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=utf-8", file.getName(), storageService.generateKey(file.getName())));
} catch (FileNotFoundException e) { } catch (FileNotFoundException e) {
throw new RuntimeException(e); throw new RuntimeException(e);
......
...@@ -174,7 +174,7 @@ public class WxStorageController { ...@@ -174,7 +174,7 @@ public class WxStorageController {
} }
String type = storage.getType(); String type = storage.getType();
if(type.equals("application/x-zip-compressed")){ if(type.equals("application/x-zip-compressed") || type.equals("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet")){
MediaType mediaType = MediaType.parseMediaType(type); MediaType mediaType = MediaType.parseMediaType(type);
Resource file = storageService.loadAsResource(key); Resource file = storageService.loadAsResource(key);
if(file == null) { if(file == null) {
......
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