REQ-3581: 返回幂等信息
This commit is contained in:
parent
6f13a02061
commit
19c3696f5d
@ -197,25 +197,30 @@ public class EssService {
|
|||||||
|
|
||||||
@BizTransactional
|
@BizTransactional
|
||||||
public void downloadContractPDF(EssContract contract, boolean retryDownload) {
|
public void downloadContractPDF(EssContract contract, boolean retryDownload) {
|
||||||
if (StringUtils.isNotBlank(contract.getOssFileKey()) && !retryDownload) {
|
EssContract reload = essContractDao.findForUpdateOrNull(contract.getEssContractId());
|
||||||
log.info("合同已下载PDF, contract={}", contract);
|
if (reload == null) {
|
||||||
|
log.warn("合同不存在, essContractId={}", contract.getEssContractId());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!shouldDownloadContractPDF(contract)) {
|
if (StringUtils.isNotBlank(reload.getOssFileKey()) && !retryDownload) {
|
||||||
log.info("合同不需要下载PDF, contract={}", contract);
|
log.info("合同已下载PDF, contract={}", reload);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!shouldDownloadContractPDF(reload)) {
|
||||||
|
log.info("合同不需要下载PDF, contract={}", reload);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
String pdfUrl = getContractPDFUrlFromEss(contract);
|
String pdfUrl = getContractPDFUrlFromEss(reload);
|
||||||
String fileName = String.format("%s.pdf", contract.getContractName());
|
String fileName = String.format("%s.pdf", reload.getContractName());
|
||||||
String fileKey = ossService.uploadToOss(pdfUrl, fileName);
|
String fileKey = ossService.uploadToOss(pdfUrl, fileName);
|
||||||
essContractDao.setOssFileKey(contract, fileKey);
|
essContractDao.setOssFileKey(reload, fileKey);
|
||||||
essLogDao.log("uploadContractToOss", contract.getEssContractId(),
|
essLogDao.log("uploadContractToOss", reload.getEssContractId(),
|
||||||
"ossFileKey", fileKey, "forceDownload", retryDownload);
|
"ossFileKey", fileKey, "forceDownload", retryDownload);
|
||||||
log.info("上传合同到OSS成功, essContractId={}", contract.getEssContractId());
|
log.info("上传合同到OSS成功, essContractId={}", reload.getEssContractId());
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.warn("上传合同到OSS失败", e);
|
log.warn("上传合同到OSS失败", e);
|
||||||
essLogDao.log(e, "uploadContractToOss", contract.getEssContractId());
|
essLogDao.log(e, "uploadContractToOss", reload.getEssContractId());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user