不再生成通过函图片

This commit is contained in:
feng.li
2023-07-25 10:49:03 +08:00
parent d6a5630697
commit 97cfac0c5a
2 changed files with 9 additions and 7 deletions

View File

@@ -135,6 +135,8 @@ public class PDFUtils {
* @param inputStream pdf 输入流 * @param inputStream pdf 输入流
* @param scale 缩放比例 * @param scale 缩放比例
*/ */
//不再将通过函转为图片
@Deprecated
public static ByteArrayOutputStream pdf2Img(InputStream inputStream, float scale) { public static ByteArrayOutputStream pdf2Img(InputStream inputStream, float scale) {
org.icepdf.core.pobjects.Document document = new org.icepdf.core.pobjects.Document(); org.icepdf.core.pobjects.Document document = new org.icepdf.core.pobjects.Document();
ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); ByteArrayOutputStream outputStream = new ByteArrayOutputStream();

View File

@@ -407,12 +407,12 @@ public class FlowServiceImpl implements FlowService {
//生成的 pdf 通过函内存输入流 //生成的 pdf 通过函内存输入流
ByteArrayInputStream inputStream = new ByteArrayInputStream(pdfOut.toByteArray()); ByteArrayInputStream inputStream = new ByteArrayInputStream(pdfOut.toByteArray());
String passPdfUrl = ossServer.uploadFileServer(inputStream, "passLetter/" + passCode + ".pdf"); String passPdfUrl = ossServer.uploadFileServer(inputStream, "passLetter/" + passCode + ".pdf");
//转换为图片 //不再转换为图片
inputStream.reset(); //inputStream.reset();
ByteArrayOutputStream imageOut = PDFUtils.pdf2Img(inputStream, 2.0f); //ByteArrayOutputStream imageOut = PDFUtils.pdf2Img(inputStream, 2.0f);
inputStream = new ByteArrayInputStream(imageOut.toByteArray()); //inputStream = new ByteArrayInputStream(imageOut.toByteArray());
//上传 OSS //上传 OSS
String passImageUrl = ossServer.uploadFileServer(inputStream, "passLetter/" + passCode + ".png"); //String passImageUrl = ossServer.uploadFileServer(inputStream, "passLetter/" + passCode + ".png");
//计算有效期截止日期 //计算有效期截止日期
Date expiryDate = DateUtil.offsetDay(passTime, 60); Date expiryDate = DateUtil.offsetDay(passTime, 60);
expiryDate = DateUtil.endOfDay(expiryDate); expiryDate = DateUtil.endOfDay(expiryDate);
@@ -422,11 +422,11 @@ public class FlowServiceImpl implements FlowService {
interviewDO.setPassTime(passTime); interviewDO.setPassTime(passTime);
interviewDO.setExpiryDate(DateUtil.formatDateTime(expiryDate)); interviewDO.setExpiryDate(DateUtil.formatDateTime(expiryDate));
interviewDO.setPassPdfUrl(passPdfUrl); interviewDO.setPassPdfUrl(passPdfUrl);
interviewDO.setPassImageUrl(passImageUrl); //interviewDO.setPassImageUrl(passImageUrl);
hyPartnerInterviewMapper.updateByPrimaryKeySelective(interviewDO); hyPartnerInterviewMapper.updateByPrimaryKeySelective(interviewDO);
inputStream.close(); inputStream.close();
pdfOut.close(); pdfOut.close();
imageOut.close(); //imageOut.close();
} catch (Exception e) { } catch (Exception e) {
log.error("资格面试通过函生成失败 e{}", e.getMessage()); log.error("资格面试通过函生成失败 e{}", e.getMessage());
throw new ServiceException("通过函生成失败!"); throw new ServiceException("通过函生成失败!");