Przeglądaj źródła

上传OSSPDF 测试优化

master
PoffyZhang 11 miesięcy temu
rodzic
commit
7eca258d44
2 zmienionych plików z 28 dodań i 6 usunięć
  1. +2
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/dashboard/manage/DashboardProjectManage.java
  2. +26
    -6
      pmapi/src/main/java/com/ningdatech/pmapi/gov/manage/GovProjectCollectionManage.java

+ 2
- 0
pmapi/src/main/java/com/ningdatech/pmapi/dashboard/manage/DashboardProjectManage.java Wyświetl plik

@@ -396,6 +396,7 @@ public class DashboardProjectManage {
}
projectInfo.setProjectIntroduction(apply.getBaseProjIntro());
projectInfo.setBuildCycle(apply.getBaseProjDuration());
projectInfo.setApprovalAmount(apply.getBaseProjTotalAmount());
}
projectInfo.setProjectCode(projectCode);
projectInfo.setProjectName(baseInfo.getBaseProjName());
@@ -416,6 +417,7 @@ public class DashboardProjectManage {
}
projectInfo.setProjectIntroduction(apply.getBaseProjIntro());
projectInfo.setBuildCycle(apply.getBaseProjDuration());
projectInfo.setApprovalAmount(apply.getBaseProjTotalAmount());
}
projectInfo.setProjectCode(projectCode);
projectInfo.setProjectName(operationBase.getBaseProjName());


+ 26
- 6
pmapi/src/main/java/com/ningdatech/pmapi/gov/manage/GovProjectCollectionManage.java Wyświetl plik

@@ -15,6 +15,7 @@ import com.ningdatech.basic.exception.BizException;
import com.ningdatech.basic.function.VUtils;
import com.ningdatech.basic.model.PageVo;
import com.ningdatech.basic.util.StrPool;
import com.ningdatech.file.service.FileService;
import com.ningdatech.pmapi.common.constant.BizConst;
import com.ningdatech.pmapi.common.constant.RegionConst;
import com.ningdatech.pmapi.common.helper.RegionCacheHelper;
@@ -58,6 +59,7 @@ import io.swagger.annotations.ApiModelProperty;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.apache.poi.util.IOUtils;
import org.flowable.engine.HistoryService;
import org.flowable.engine.RuntimeService;
import org.springframework.beans.factory.annotation.Autowired;
@@ -70,10 +72,8 @@ import org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.client.RestTemplate;
import java.io.BufferedOutputStream;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;

import java.io.*;
import java.lang.reflect.Field;
import java.time.LocalDate;
import java.time.LocalDateTime;
@@ -121,6 +121,8 @@ public class GovProjectCollectionManage {

private final ThreadPoolTaskScheduler threadPoolTaskScheduler;

private final FileService fileService;

@Value("${project.push-url}")
private String pushUrl;

@@ -1695,7 +1697,9 @@ public class GovProjectCollectionManage {
StringJoiner sj = convertAndUpload(procure.getBiddingFile());
saveProcure.setBiddingFilePdf(sj.toString());
}
if(checkFieldNotPdf(procure.getPurchaseContract(),o,"purchaseContract")){
Boolean purchaseContract = checkFieldNotPdf(procure.getPurchaseContract(), o, "purchaseContract");
log.info("是否转换 采购合同 purchaseContract:{}",purchaseContract);
if(purchaseContract){
StringJoiner sj = convertAndUpload(procure.getPurchaseContract());
saveProcure.setPurchaseContractPdf(sj.toString());
}
@@ -1710,9 +1714,25 @@ public class GovProjectCollectionManage {
JSONArray fileArray = JSON.parseArray(bpb);
fileArray.forEach(j -> {
JSONObject jsonObject = JSON.parseObject(JSON.toJSONString(j));
byte[] btyes = wpsConvertManage.downloadToPdfStream(jsonObject.getLong("id"));
String suffix = jsonObject.getString("suffix");
//如果已经是PDF 就不用转换了
byte[] btyes = null;
String originalFileName = jsonObject.getString("originalFileName");
if(StringUtils.isNotBlank(suffix) && suffix.equals("pdf")){
com.ningdatech.file.entity.File file = fileService.getById(jsonObject.getLong("id"));
if(Objects.isNull(file)){
throw new RuntimeException("转换PDF文件失败:" + originalFileName);
}
InputStream inputStream = fileService.getFileInputStream(file);
try {
btyes = IOUtils.toByteArray(inputStream);
} catch (IOException e) {
throw new RuntimeException("转换PDF文件失败:" + originalFileName,e);
}
}else{
btyes = wpsConvertManage.downloadToPdfStream(jsonObject.getLong("id"));
}

if(!BizConst.DEV.equals(active)){
originalFileName = originalFileName.replace(StrPool.DOT + suffix, ".pdf");
}


Ładowanie…
Anuluj
Zapisz