|
@@ -1,10 +1,13 @@
|
|
|
package com.onemap.analyse.controller;
|
|
|
|
|
|
import com.fasterxml.jackson.core.JsonProcessingException;
|
|
|
+import com.onemap.analyse.domain.FzxzReport;
|
|
|
import com.onemap.analyse.domain.calculation.FzxzCalc;
|
|
|
+import com.onemap.analyse.domain.vo.DkReportVo;
|
|
|
import com.onemap.analyse.domain.vo.SelectPilotVo;
|
|
|
import com.onemap.analyse.service.IFzssService;
|
|
|
import com.onemap.analyse.domain.HgxfxEntityDTO;
|
|
|
+import com.onemap.analyse.service.IReportService;
|
|
|
import com.onemap.analyse.utils.UnitsUtil;
|
|
|
import com.onemap.common.core.utils.file.FileUtils;
|
|
|
import com.onemap.common.core.web.controller.BaseController;
|
|
@@ -13,12 +16,14 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
+import javax.annotation.Resource;
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
import java.io.IOException;
|
|
|
import java.text.SimpleDateFormat;
|
|
|
import java.util.ArrayList;
|
|
|
import java.util.Date;
|
|
|
+import java.util.HashMap;
|
|
|
import java.util.Map;
|
|
|
|
|
|
@RestController
|
|
@@ -31,6 +36,11 @@ public class FzssController extends BaseController {
|
|
|
@Value("${Hgxfx.tempLinux}")
|
|
|
public String tempLinux;
|
|
|
|
|
|
+
|
|
|
+ // 报告服务
|
|
|
+ @Resource
|
|
|
+ private IReportService iReportService;
|
|
|
+
|
|
|
/**
|
|
|
* 新建辅助选址
|
|
|
*
|
|
@@ -96,39 +106,34 @@ public class FzssController extends BaseController {
|
|
|
*
|
|
|
* @return
|
|
|
*/
|
|
|
- @PostMapping("/SaveWordFile")
|
|
|
- public RequestResult SaveWordFile(@RequestBody Map params) {
|
|
|
- String bsm = (String) params.get("bsm");
|
|
|
- ArrayList xzbsm = (ArrayList) params.get("xzbsm");
|
|
|
- // RequestResult res = fzssService.saveWordFile(bsm, xzbsm);
|
|
|
- return null;
|
|
|
+ @PostMapping("/DownloadLandReport")
|
|
|
+ public RequestResult SaveWordFile(@RequestBody DkReportVo dkReportVo) {
|
|
|
+ FzxzReport fzxzReport = iReportService.createReport(dkReportVo.getBsm(), dkReportVo.getDkIds());
|
|
|
+ Map<String, String> resMap = new HashMap<>();
|
|
|
+ resMap.put("fxbg", fzxzReport.getReportfile());
|
|
|
+ return RequestResult.success("查询成功!", resMap);
|
|
|
}
|
|
|
|
|
|
@GetMapping("/DownloadReport")
|
|
|
- public void fileDownload(String filePath, HttpServletResponse response, HttpServletRequest request) {
|
|
|
- try {
|
|
|
- String path = tempWin;
|
|
|
- // windows 使用 tempWin, linux 使用 tempLinux
|
|
|
- System.out.println("####获取操作系统名称####");
|
|
|
- System.out.println("os.name: " + System.getProperty("os.name").toLowerCase());
|
|
|
- if (System.getProperty("os.name").toLowerCase().contains("linux")) {
|
|
|
- path = tempLinux;
|
|
|
- }
|
|
|
-
|
|
|
- String realFileName = path + filePath;
|
|
|
- response.setCharacterEncoding("utf-8");
|
|
|
- response.setContentType("multipart/form-data");
|
|
|
- response.setContentType("application/vnd.openxmlformats-officedocument.wordprocessingml.document");
|
|
|
+ public void fileDownload(String filePath, HttpServletResponse response) throws IOException {
|
|
|
+ String path = tempWin;
|
|
|
+ // windows 使用 tempWin, linux 使用 tempLinux
|
|
|
+ System.out.println("####获取操作系统名称####");
|
|
|
+ System.out.println("os.name: " + System.getProperty("os.name").toLowerCase());
|
|
|
+ if (System.getProperty("os.name").toLowerCase().contains("linux")) {
|
|
|
+ path = tempLinux;
|
|
|
+ }
|
|
|
|
|
|
- String fileType = filePath.substring(filePath.lastIndexOf(".") + 1);
|
|
|
- String time = new SimpleDateFormat("yyyyMMddHHmmss").format(new Date());
|
|
|
- String downloadName = time + "." + fileType;
|
|
|
+ String realFileName = path + filePath;
|
|
|
+ response.setCharacterEncoding("utf-8");
|
|
|
+ response.setContentType("multipart/form-data");
|
|
|
+ response.setContentType("application/vnd.openxmlformats-officedocument.wordprocessingml.document");
|
|
|
|
|
|
- response.setHeader("Content-Disposition", "attachment;fileName=\"" + downloadName + "\"");
|
|
|
- FileUtils.writeBytes(realFileName, response.getOutputStream());
|
|
|
+ String fileType = filePath.substring(filePath.lastIndexOf(".") + 1);
|
|
|
+ String time = new SimpleDateFormat("yyyyMMddHHmmss").format(new Date());
|
|
|
+ String downloadName = time + "." + fileType;
|
|
|
|
|
|
- } catch (Exception e) {
|
|
|
- // log.error("下载文件失败", e);
|
|
|
- }
|
|
|
+ response.setHeader("Content-Disposition", "attachment;fileName=\"" + downloadName + "\"");
|
|
|
+ FileUtils.writeBytes(realFileName, response.getOutputStream());
|
|
|
}
|
|
|
}
|