Jelajahi Sumber

Merge remote-tracking branch 'origin/master'

# Conflicts:
#	jeeplus-modules/jeeplus-business/src/main/java/com/jeeplus/business/bid/mapper/TenderBidBasicMapper.java
#	jeeplus-modules/jeeplus-business/src/main/java/com/jeeplus/business/tender/domain/BidDetail.java
#	jeeplus-modules/jeeplus-business/src/main/java/com/jeeplus/business/tender/service/DTO/TenderDTO.java
#	jeeplus-modules/jeeplus-business/src/main/java/com/jeeplus/business/tender/service/TenderService.java
sangwenwei 6 bulan lalu
induk
melakukan
da70e90ff5

+ 0 - 2
jeeplus-modules/jeeplus-business/src/main/java/com/jeeplus/business/bid/service/TenderBidService.java

@@ -14,9 +14,7 @@ import com.jeeplus.business.bid.mapper.TenderBidDetailMapper;
 import com.jeeplus.business.bid.service.dto.TenderBidDTO;
 import com.jeeplus.business.notify.service.dto.WorkAttachmentDto;
 import com.jeeplus.business.tender.domain.BidDetail;
-import com.jeeplus.business.tender.domain.Tender;
 import com.jeeplus.business.tender.mapper.BidDetailMapper;
-import com.jeeplus.business.tender.service.DTO.TenderDTO;
 import com.jeeplus.common.TokenProvider;
 import com.jeeplus.core.query.QueryWrapperGenerator;
 import com.jeeplus.flowable.feign.IFlowableApi;

+ 7 - 3
jeeplus-modules/jeeplus-business/src/main/java/com/jeeplus/business/inscription/controller/InscriptionController.java

@@ -118,10 +118,13 @@ public class InscriptionController {
         Template template=null;
         //下载文件地址
         String filePath = null;
+        String exportFilePath = null;
         if(System.getProperty("os.name").toLowerCase().contains("win")){
             filePath = this.getClass().getResource("/").getPath()+"/freemarker";
+            exportFilePath = "D:/attachment-file/";
         }else{
             filePath = "/mnt/project/cloud/freemarker";
+            exportFilePath = "/attachment-file/";
         }
         //freemaker模板路径
         File path = new File(filePath);
@@ -133,7 +136,8 @@ public class InscriptionController {
             template = cfg.getTemplate("文印申请单.ftl","UTF-8");
             File docFile = new File("文印申请单.doc");
             FreemarkerUtil.generateFile(data,template,docFile);
-            JyResponseUtil.docResponse("文印申请单.doc",docFile,response);
+            //JyResponseUtil.docResponse("文印申请单.doc",docFile,response);
+            JyResponseUtil.exportAndSaveFile("文印申请单.doc",docFile,exportFilePath, response);
         } catch (IOException e) {
             e.printStackTrace();
         }finally {
@@ -141,13 +145,13 @@ public class InscriptionController {
                 //获取tomcat的路径
                 String tomcatFilePath=System.getProperty("catalina.home");
                 //删除tomcat目录下的处理后的文件信息
-                File tomcatFile = new File(tomcatFilePath+"/bin/文印申请单.doc");
+                File tomcatFile = new File(exportFilePath+"/文印申请单.doc");
                 if (tomcatFile.isFile()) {
                     tomcatFile.delete();
                 }
             }else{
                 //删除目录下的处理后的文件信息
-                File tomcatFile = new File("/mnt/project/cloud/文印申请单.doc");
+                File tomcatFile = new File(exportFilePath + "/文印申请单.doc");
                 if (tomcatFile.isFile()) {
                     tomcatFile.delete();
                 }

+ 1 - 4
jeeplus-modules/jeeplus-business/src/main/java/com/jeeplus/business/inscription/service/InscriptionService.java

@@ -47,10 +47,7 @@ import org.springframework.web.bind.annotation.RequestBody;
 
 import javax.annotation.Resource;
 import javax.xml.parsers.DocumentBuilder;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileNotFoundException;
-import java.io.IOException;
+import java.io.*;
 import java.math.BigInteger;
 import java.net.URLDecoder;
 import java.net.URLEncoder;

+ 7 - 3
jeeplus-modules/jeeplus-business/src/main/java/com/jeeplus/business/project/controller/JyProjectController.java

@@ -264,10 +264,13 @@ public class JyProjectController {
         Template template=null;
         //下载文件地址
         String filePath = null;
+        String exportFilePath = null;
         if(System.getProperty("os.name").toLowerCase().contains("win")){
             filePath = this.getClass().getResource("/").getPath()+"/freemarker";
+            exportFilePath = "D:/attachment-file/";
         }else{
             filePath = "/mnt/project/cloud/freemarker";
+            exportFilePath = "/attachment-file/";
         }
         //freemaker模板路径
         File path = new File(filePath);
@@ -279,7 +282,8 @@ public class JyProjectController {
             template = cfg.getTemplate("firstAudit.ftl","UTF-8");
             File docFile = new File(projectName+"报告质量内审单.doc");
             FreemarkerUtil.generateFile(data,template,docFile);
-            JyResponseUtil.docResponse(projectName+"报告质量内审单.doc",docFile,response);
+            //JyResponseUtil.docResponse(projectName+"报告质量内审单.doc",docFile,response);
+            JyResponseUtil.exportAndSaveFile("报告质量内审单.doc",docFile,exportFilePath, response);
         } catch (IOException e) {
             e.printStackTrace();
         }finally {
@@ -288,13 +292,13 @@ public class JyProjectController {
                 //获取tomcat的路径
                 String tomcatFilePath=System.getProperty("catalina.home");
                 //删除tomcat目录下的处理后的文件信息
-                File tomcatFile = new File(tomcatFilePath+"/bin/"+projectName+"报告质量内审单.doc");
+                File tomcatFile = new File(exportFilePath+"/"+projectName+"报告质量内审单.doc");
                 if (tomcatFile.isFile()) {
                     tomcatFile.delete();
                 }
             }else{
                 //删除目录下的处理后的文件信息
-                File tomcatFile = new File("/mnt/project/cloud/"+projectName+"报告质量内审单.doc");
+                File tomcatFile = new File(exportFilePath + "/"+projectName+"报告质量内审单.doc");
                 if (tomcatFile.isFile()) {
                     tomcatFile.delete();
                 }

+ 61 - 0
jeeplus-modules/jeeplus-business/src/main/java/com/jeeplus/business/project/utils/JyResponseUtil.java

@@ -7,6 +7,7 @@ import javax.servlet.ServletOutputStream;
 import javax.servlet.http.HttpServletResponse;
 import java.io.File;
 import java.io.FileInputStream;
+import java.io.FileOutputStream;
 import java.io.IOException;
 import java.net.URLEncoder;
 import java.util.Calendar;
@@ -45,6 +46,66 @@ public class JyResponseUtil {
         }
     }
 
+    public static void exportAndSaveFile(String fileName, File sourceFile, String targetDir, HttpServletResponse response) {
+        ServletOutputStream out = null;
+        FileInputStream fin = null;
+        FileOutputStream fout = null;
+
+        try {
+            // 检查源文件是否存在以及是否可以读取
+            if (sourceFile == null || !sourceFile.exists() || !sourceFile.canRead()) {
+                throw new IOException("源文件不存在或不可读: " + sourceFile.getAbsolutePath());
+            }
+
+            // 创建输入流读取源文件
+            fin = new FileInputStream(sourceFile);
+
+            // 设置响应头,以浏览器下载方式处理该文件
+            response.setCharacterEncoding("utf-8");
+            response.setContentType("application/octet-stream; charset=UTF-8");
+            String encodedFileName = URLEncoder.encode(fileName, "UTF-8").replaceAll("\\+", "%20");
+            response.setHeader("Content-Disposition", "attachment;filename=" + encodedFileName);
+
+            out = response.getOutputStream();
+
+            // 创建目标文件并检查目录是否存在
+            File targetFile = new File(targetDir, fileName);
+            if (!targetFile.getParentFile().exists()) {
+                targetFile.getParentFile().mkdirs();  // 如果目标文件夹不存在,则创建
+            }
+
+            // 创建输出流写入目标文件
+            fout = new FileOutputStream(targetFile);
+
+            // 使用4KB的缓冲区读取文件并同时写入浏览器和目标文件
+            byte[] buffer = new byte[4096];  // 4KB缓冲区
+            int bytesToRead;
+
+            while ((bytesToRead = fin.read(buffer)) != -1) {
+                out.write(buffer, 0, bytesToRead);  // 写入浏览器
+                fout.write(buffer, 0, bytesToRead); // 写入目标文件
+            }
+
+            // 确保所有数据已发送到客户端和目标文件
+            out.flush();
+            fout.flush();
+
+            System.out.println("文件已成功导出并保存到: " + targetFile.getAbsolutePath());
+
+        } catch (Exception e) {
+            e.printStackTrace();
+            response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
+        } finally {
+            try {
+                if (fin != null) fin.close();
+                if (fout != null) fout.close();
+                if (out != null) out.close();
+            } catch (IOException e) {
+                e.printStackTrace();
+            }
+        }
+    }
+
 
     /**
      * 获取当前时间年月日

+ 0 - 4
jeeplus-modules/jeeplus-business/src/main/java/com/jeeplus/business/tender/controller/TenderController.java

@@ -3,18 +3,14 @@ package com.jeeplus.business.tender.controller;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.jeeplus.business.finance.util.EasyPoiUtil;
-import com.jeeplus.business.reimbursement.service.dto.JyReimbursementInfoDTO;
 import com.jeeplus.business.tender.service.DTO.TenderDTO;
 import com.jeeplus.business.tender.service.TenderService;
-import com.jeeplus.business.useSeal.service.dto.SignetDTO;
 import com.jeeplus.common.excel.ExcelOptions;
 import com.jeeplus.common.excel.annotation.ExportMode;
-import com.jeeplus.common.utils.ResponseUtil;
 import com.jeeplus.logging.annotation.ApiLog;
 import com.jeeplus.logging.constant.enums.LogTypeEnum;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
-import org.apache.commons.lang3.StringUtils;
 import org.springframework.http.ResponseEntity;
 import org.springframework.web.bind.annotation.*;
 

+ 1 - 1
jeeplus-modules/jeeplus-system/src/main/java/com/jeeplus/sys/controller/UserController.java

@@ -880,7 +880,7 @@ public class UserController {
         UserDTO currentUserDTO = UserUtils.getCurrentUserDTO();
         List<PostDTO> postDTOList = currentUserDTO.getPostDTOList();
         for (PostDTO postDTO : postDTOList) {
-            if (postDTO.getCode().equals("rsb")){
+            if (postDTO.getCode().equals("rlgly")){
                 return true;
             }
         }