Commit b6cd133c by akexiu

Revert "经纪人名片4.经纪人电子名片由后端返回,支持PDF/png"

This reverts commit c25e9b2d.
parent 7d28bd10
...@@ -5203,7 +5203,7 @@ public class PractitionerServiceImpl implements com.yd.api.practitioner.service. ...@@ -5203,7 +5203,7 @@ public class PractitionerServiceImpl implements com.yd.api.practitioner.service.
//PDF模板输出结果文件 //PDF模板输出结果文件
String templateResultPDF = tmpPathPDF + practitionerId + "-businessCardE.pdf"; String templateResultPDF = tmpPathPDF + practitionerId + "-businessCardE.pdf";
//JPG模板输出结果文件 //JPG模板输出结果文件
String templateResultPNG = tmpPathPDF + practitionerId + "-businessCardE.png"; String templateResultJPG = tmpPathPDF + practitionerId + "-businessCardE.jpg";
//填充数据 //填充数据
Map<String, String> initDatas = new HashMap<>(); Map<String, String> initDatas = new HashMap<>();
Map<String, String> initImages = new HashMap<>(); Map<String, String> initImages = new HashMap<>();
...@@ -5259,7 +5259,6 @@ public class PractitionerServiceImpl implements com.yd.api.practitioner.service. ...@@ -5259,7 +5259,6 @@ public class PractitionerServiceImpl implements com.yd.api.practitioner.service.
//按模板填充数据生成结果PDF //按模板填充数据生成结果PDF
PDFTemplate.generatePDF(templatePDF, templateResultPDF, initDatas, initImages); PDFTemplate.generatePDF(templatePDF, templateResultPDF, initDatas, initImages);
try { try {
resp.setBusinessCardPdfUrl(putContractFileToOSS("businessCardEPDF", templateResultPDF, practitionerId));
PDDocument doc = null; PDDocument doc = null;
ByteArrayOutputStream os = null; ByteArrayOutputStream os = null;
InputStream stream = null; InputStream stream = null;
...@@ -5273,27 +5272,29 @@ public class PractitionerServiceImpl implements com.yd.api.practitioner.service. ...@@ -5273,27 +5272,29 @@ public class PractitionerServiceImpl implements com.yd.api.practitioner.service.
PDPageTree pages = doc.getPages(); PDPageTree pages = doc.getPages();
int pageCount = pages.getCount(); int pageCount = pages.getCount();
for (int i = 0; i < pageCount; i++) { for (int i = 0; i < pageCount; i++) {
BufferedImage bim = pdfRenderer.renderImageWithDPI(i, 70); BufferedImage bim = pdfRenderer.renderImageWithDPI(i, 92);
ImageIO.write(bim, "png", new File(templateResultPNG)); os = new ByteArrayOutputStream();
// os = new ByteArrayOutputStream();
// Image image = bim.getScaledInstance(70,45,Image.SCALE_SMOOTH); //设置图像的缩放大小 Image image = bim.getScaledInstance(92,58,Image.SCALE_SMOOTH); //设置图像的缩放大小
// AffineTransformOp op = new AffineTransformOp(AffineTransform.getScaleInstance(1,1),null); //设置图像的缩放比例 AffineTransformOp op = new AffineTransformOp(AffineTransform.getScaleInstance(1,1),null); //设置图像的缩放比例
// image = op.filter(bim,null); image = op.filter(bim,null);
// ImageIO.write((BufferedImage)image, "png", os);
// byte[] dataList = os.toByteArray(); ImageIO.write((BufferedImage)image, "jpg", os);
// // png文件转出路径 byte[] dataList = os.toByteArray();
// File file = new File(templateResultPNG); // jpg文件转出路径
// if (!file.getParentFile().exists()) { File file = new File(templateResultJPG);
// // 不存在则创建父目录及子文件 if (!file.getParentFile().exists()) {
// file.getParentFile().mkdirs(); // 不存在则创建父目录及子文件
// file.createNewFile(); file.getParentFile().mkdirs();
// } file.createNewFile();
// out = new FileOutputStream(file); }
// out.write(dataList); out = new FileOutputStream(file);
out.write(dataList);
if(i == 0){ if(i == 0){
resp.setBusinessCardProsImg(putContractFileToOSS("businessCardEPros", templateResultPNG, practitionerId)); resp.setBusinessCardProsUrl(putContractFileToOSS("businessCardEPros", templateResultJPG, practitionerId));
}else if(i == 1){ }else if(i == 1){
resp.setBusinessCardConsImg(putContractFileToOSS("businessCardECons", templateResultPNG, practitionerId)); resp.setBusinessCardConsUrl(putContractFileToOSS("businessCardECons", templateResultJPG, practitionerId));
} }
} }
} catch (Exception e) { } catch (Exception e) {
......
...@@ -26,9 +26,8 @@ public class PractitionerBusinessCardResponseVO { ...@@ -26,9 +26,8 @@ public class PractitionerBusinessCardResponseVO {
private String mobileNo;//手机号 private String mobileNo;//手机号
private String email;//电子邮件 private String email;//电子邮件
private Integer emailIsActive;//经纪人邮箱是否开通(0=No, 1=Yes) private Integer emailIsActive;//经纪人邮箱是否开通(0=No, 1=Yes)
private String businessCardPdfUrl;//电子名片PDF private String businessCardProsUrl;//电子名片正面Url
private String businessCardProsImg;//电子名片正面Url private String businessCardConsUrl;//电子名片反面Url
private String businessCardConsImg;//电子名片反面Url
private CommonResult commonResult; private CommonResult commonResult;
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment