OSSServer调整为CDN访问
This commit is contained in:
@@ -26,6 +26,9 @@ public class OSSServer {
|
||||
@Value("${corp.id:null}")
|
||||
private String corpId;
|
||||
|
||||
@Value("${cdn.url:null}")
|
||||
private String cdnUrl;
|
||||
|
||||
/**
|
||||
* 服务端上传文件的方法
|
||||
* ObjectName 为文件存放位置 + 名字,不可包含 bucket
|
||||
@@ -38,7 +41,7 @@ public class OSSServer {
|
||||
PutObjectRequest putObjectRequest = new PutObjectRequest(bucket, objectName, inputStream);
|
||||
// 创建PutObject请求。
|
||||
ossClient.putObject(putObjectRequest);
|
||||
return "http://" + bucket + "." + endpoint + "/" + objectName;
|
||||
return cdnUrl + "/partner/" + corpId + "/" + objectName;
|
||||
} catch (OSSException oe) {
|
||||
log.error("Caught an OSSException, which means your request made it to OSS, "
|
||||
+ "but was rejected with an error response for some reason.");
|
||||
|
||||
@@ -260,13 +260,13 @@ public class FlowServiceImpl implements FlowService {
|
||||
ByteArrayOutputStream pdfOut = PassLetterUtils.genPassLetter(partnerName, passCode, verifyCity, passTime);
|
||||
//生成的 pdf 通过函内存输入流
|
||||
ByteArrayInputStream inputStream = new ByteArrayInputStream(pdfOut.toByteArray());
|
||||
String passPdfUrl = ossServer.uploadFileServer(inputStream, "partner/passLetter/" + passCode + ".pdf");
|
||||
String passPdfUrl = ossServer.uploadFileServer(inputStream, "passLetter/" + passCode + ".pdf");
|
||||
//转换为图片
|
||||
inputStream.reset();
|
||||
ByteArrayOutputStream imageOut = PDFUtils.pdf2Img(inputStream, 2.0f);
|
||||
inputStream = new ByteArrayInputStream(imageOut.toByteArray());
|
||||
//上传 OSS
|
||||
String passImageUrl = ossServer.uploadFileServer(inputStream, "partner/passLetter/" + passCode + ".png");
|
||||
String passImageUrl = ossServer.uploadFileServer(inputStream, "passLetter/" + passCode + ".png");
|
||||
//计算有效期截止日期
|
||||
DateTime expiryDate = DateUtil.offsetDay(passTime, 60);
|
||||
HyPartnerInterviewDO interviewDO = new HyPartnerInterviewDO();
|
||||
|
||||
Reference in New Issue
Block a user