不再生成通过函图片

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

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