|
|
|
@ -41,7 +41,10 @@ import org.springframework.web.multipart.MultipartFile; |
|
|
|
|
|
|
|
import javax.mail.MessagingException; |
|
|
|
import javax.mail.internet.MimeMessage; |
|
|
|
import javax.servlet.ServletOutputStream; |
|
|
|
import javax.servlet.http.HttpServletResponse; |
|
|
|
import java.io.*; |
|
|
|
import java.net.URLEncoder; |
|
|
|
import java.sql.CallableStatement; |
|
|
|
import java.sql.Connection; |
|
|
|
import java.sql.DriverManager; |
|
|
|
@ -422,6 +425,44 @@ public class EamProjectServiceImpl implements EamProjectService { |
|
|
|
return list; |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public List<SysOssEntity> getFileDataList(ProofDocumentData inData) { |
|
|
|
List<SysOssEntity> fileList = EamProjectMapper.searchSysOssFileList(inData); |
|
|
|
return fileList; |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public void previewEamProjectInfoForUploadFile(SysOssEntity inData, HttpServletResponse response) throws UnsupportedEncodingException { |
|
|
|
String url = inData.getUrl(); |
|
|
|
// 创建文件对象 |
|
|
|
File file = new File(url); |
|
|
|
if (!file.exists()) { |
|
|
|
throw new IllegalArgumentException("文件不存在"); |
|
|
|
} |
|
|
|
|
|
|
|
String encodedFileName = URLEncoder.encode("sop", "UTF-8"); |
|
|
|
// 设置响应头 |
|
|
|
response.setContentType("application/pdf;charset=utf-8"); |
|
|
|
response.setHeader("Content-Disposition", "attachment; filename=" + encodedFileName); |
|
|
|
|
|
|
|
try (FileInputStream fis = new FileInputStream(file); |
|
|
|
BufferedInputStream bis = new BufferedInputStream(fis); |
|
|
|
ServletOutputStream os = response.getOutputStream()) { |
|
|
|
|
|
|
|
byte[] buffer = new byte[1024]; |
|
|
|
int bytesRead; |
|
|
|
|
|
|
|
// 循环读取文件内容并写入到响应流中 |
|
|
|
while ((bytesRead = bis.read(buffer)) != -1) { |
|
|
|
os.write(buffer, 0, bytesRead); |
|
|
|
} |
|
|
|
|
|
|
|
} catch (IOException e) { |
|
|
|
throw new RuntimeException("文件下载失败", e); |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public boolean checkProductionValidationDocument(List<ProjectProductionValidationDocumentData> list) { |
|
|
|
for (ProjectProductionValidationDocumentData inData : list) { |
|
|
|
|