|
@@ -16,6 +16,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
+import javax.activation.MimetypesFileTypeMap;
|
|
|
import javax.annotation.Resource;
|
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
import java.awt.*;
|
|
@@ -48,13 +49,13 @@ public class FzssController extends BaseController {
|
|
|
public RequestResult AddFzxz(@RequestBody SelectPilotVo selectPilotVo) throws JsonProcessingException {
|
|
|
if (selectPilotVo.getYdmjbegin() != null) {
|
|
|
selectPilotVo.setYdmjbegin((float) (UnitsUtil.muToM2(selectPilotVo.getYdmjbegin())));
|
|
|
- }else{
|
|
|
- selectPilotVo.setYdmjbegin((float)UnitsUtil.muToM2(10f));
|
|
|
+ } else {
|
|
|
+ selectPilotVo.setYdmjbegin((float) UnitsUtil.muToM2(10f));
|
|
|
}
|
|
|
if (selectPilotVo.getYdmjend() != null) {
|
|
|
selectPilotVo.setYdmjend((float) (UnitsUtil.muToM2(selectPilotVo.getYdmjend())));
|
|
|
- }else{
|
|
|
- selectPilotVo.setYdmjend((float)UnitsUtil.muToM2(100f));
|
|
|
+ } else {
|
|
|
+ selectPilotVo.setYdmjend((float) UnitsUtil.muToM2(100f));
|
|
|
}
|
|
|
|
|
|
// 存储规划参数
|
|
@@ -127,9 +128,14 @@ public class FzssController extends BaseController {
|
|
|
if ("zip".equals(extension)) {
|
|
|
DownloadUtils.download(response, realFileName, null);
|
|
|
} else {
|
|
|
+ // 建议定义为静态常量,可复用
|
|
|
+ MimetypesFileTypeMap mimeTypeMap = new MimetypesFileTypeMap();
|
|
|
+ // 传入文件名,得到文件类型,判断失败则返回application/octet-stream
|
|
|
+ String contentType = mimeTypeMap.getContentType(downloadName.substring(lastIndex));
|
|
|
response.setCharacterEncoding("utf-8");
|
|
|
- response.setContentType("multipart/form-data");
|
|
|
- response.setContentType("application/vnd.openxmlformats-officedocument.wordprocessingml.document");
|
|
|
+ response.setContentType(contentType);
|
|
|
+// response.setContentType("multipart/form-data");
|
|
|
+// response.setContentType("application/vnd.openxmlformats-officedocument.wordprocessingml.document");
|
|
|
response.setHeader("Content-Disposition", "attachment;fileName=" + URLEncoder.encode(downloadName, "UTF-8"));
|
|
|
FileUtils.writeBytes(realFileName, response.getOutputStream());
|
|
|
}
|
|
@@ -152,7 +158,6 @@ public class FzssController extends BaseController {
|
|
|
public RequestResult openFile(String filePath) throws IOException {
|
|
|
|
|
|
|
|
|
-
|
|
|
File file = new File(filePath);
|
|
|
|
|
|
try {
|