浏览代码

修改中图代码下载问题、项目智慧选址和合规性分析下载文件名称

LAPTOP-BJJ3IV5R\SIWEI 11 月之前
父节点
当前提交
84721d79da

+ 2 - 10
onemap-modules/onemap-analyse/src/main/java/com/onemap/analyse/controller/FzssController.java

@@ -7,6 +7,7 @@ import com.onemap.analyse.domain.vo.DkReportVo;
 import com.onemap.analyse.domain.vo.SelectPilotVo;
 import com.onemap.analyse.service.IFzssService;
 import com.onemap.analyse.service.IReportService;
+import com.onemap.analyse.utils.DownloadUtils;
 import com.onemap.analyse.utils.UnitsUtil;
 import com.onemap.common.core.utils.file.FileUtils;
 import com.onemap.common.core.web.controller.BaseController;
@@ -112,15 +113,6 @@ public class FzssController extends BaseController {
     @GetMapping("/DownloadReport")
     public void fileDownload(String filePath, HttpServletResponse response) throws IOException {
         String realFileName = temp + filePath;
-        response.setCharacterEncoding("utf-8");
-        response.setContentType("multipart/form-data");
-        response.setContentType("application/vnd.openxmlformats-officedocument.wordprocessingml.document");
-
-        String fileType = filePath.substring(filePath.lastIndexOf(".") + 1);
-        String time = new SimpleDateFormat("yyyyMMddHHmmss").format(new Date());
-        String downloadName = time + "." + fileType;
-
-        response.setHeader("Content-Disposition", "attachment;fileName=\"" + downloadName + "\"");
-        FileUtils.writeBytes(realFileName, response.getOutputStream());
+        DownloadUtils.download(response, realFileName, null);
     }
 }

+ 2 - 2
onemap-modules/onemap-analyse/src/main/java/com/onemap/analyse/service/impl/HgxfxJgReportServiceImpl.java

@@ -50,7 +50,7 @@ public class HgxfxJgReportServiceImpl implements HgxfxJgReportService {
         String timeStamp = new Date().getTime() + "";
         String tempPath = temp;
         String rootPath = File.separator + "合规性分析报告" + File.separator + hgxfxReportVo.getBsm();
-        String docxName = "合规性报告_" + timeStamp + ".docx";
+        String docxName = "合规性分析报告_" + timeStamp + ".docx";
         File f = new File(tempPath + rootPath);
         if (!f.exists()) {
             f.mkdirs();
@@ -115,7 +115,7 @@ public class HgxfxJgReportServiceImpl implements HgxfxJgReportService {
 
             int pos = 0;
             // 0、文本标题
-            NpoiHelper.title(document, hgxfxReportVo.getXmmc() + "合规性分析报告", pos++);
+            NpoiHelper.title(document, "合规性分析报告", pos++);
             SimpleDateFormat sdf = new SimpleDateFormat("yyyy年MM月dd日");
 
             // 1、项目选址信息

+ 3 - 3
onemap-modules/onemap-analyse/src/main/java/com/onemap/analyse/service/impl/ReportServiceImpl.java

@@ -82,7 +82,7 @@ public class ReportServiceImpl implements IReportService {
             if (!f.exists()) {
                 f.mkdirs();
             }
-            String reportPath = res.getXmmc() + "选址报告_" + timeStamp + ".docx";
+            String reportPath = "选址报告_" + timeStamp + ".docx";
             // TODO ###选址报告耗时,暂时隐藏###
             createReport(res, allPath + "/" + reportPath, dkIds);
             // 生成返回结果
@@ -120,7 +120,7 @@ public class ReportServiceImpl implements IReportService {
             document = new XWPFDocument();
             int pos = 0;
             // 0、文本标题
-            NpoiHelper.title(document, res.getXmmc() + "选址报告", pos++);
+            NpoiHelper.title(document, "选址报告", pos++);
             SimpleDateFormat sdf = new SimpleDateFormat("yyyy年MM月dd日");
             // NpoiHelper.Option optionCENTER = new NpoiHelper.Option();
             // optionCENTER.setAlign(ParagraphAlignment.CENTER);
@@ -209,7 +209,7 @@ public class ReportServiceImpl implements IReportService {
             for (int i = 0; i < fzxzJgGisDTOList.size(); i++) {
                 SelectionResDTO item = fzxzJgGisDTOList.get(i);
 
-                String dkidStr= item.getDkid().toString();
+                String dkidStr = item.getDkid().toString();
                 List<String> dkidList = Arrays.asList(dkidStr.split(","));
                 // 地块信息
                 List<Map<String, String>> dkList = getDkList(item.getSjyb(), dkidList.get(0));

+ 1 - 1
onemap-modules/onemap-model/src/main/java/com/onemap/sanya/controller/SanYaController.java

@@ -35,7 +35,7 @@ import java.util.stream.Collectors;
 /**
  * @author Zzz
  */
-@CrossOrigin(origins = "*")
+//@CrossOrigin(origins = "*")
 @RestController
 @RequestMapping("/sanya")
 public class SanYaController extends BaseController {