|
@@ -15,6 +15,7 @@ import com.ningdatech.basic.exception.BizException; |
|
|
import com.ningdatech.basic.function.VUtils; |
|
|
import com.ningdatech.basic.function.VUtils; |
|
|
import com.ningdatech.basic.model.PageVo; |
|
|
import com.ningdatech.basic.model.PageVo; |
|
|
import com.ningdatech.basic.util.StrPool; |
|
|
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.BizConst; |
|
|
import com.ningdatech.pmapi.common.constant.RegionConst; |
|
|
import com.ningdatech.pmapi.common.constant.RegionConst; |
|
|
import com.ningdatech.pmapi.common.helper.RegionCacheHelper; |
|
|
import com.ningdatech.pmapi.common.helper.RegionCacheHelper; |
|
@@ -58,6 +59,7 @@ import io.swagger.annotations.ApiModelProperty; |
|
|
import lombok.RequiredArgsConstructor; |
|
|
import lombok.RequiredArgsConstructor; |
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
import org.apache.commons.lang3.StringUtils; |
|
|
import org.apache.commons.lang3.StringUtils; |
|
|
|
|
|
import org.apache.poi.util.IOUtils; |
|
|
import org.flowable.engine.HistoryService; |
|
|
import org.flowable.engine.HistoryService; |
|
|
import org.flowable.engine.RuntimeService; |
|
|
import org.flowable.engine.RuntimeService; |
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
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.stereotype.Component; |
|
|
import org.springframework.transaction.annotation.Transactional; |
|
|
import org.springframework.transaction.annotation.Transactional; |
|
|
import org.springframework.web.client.RestTemplate; |
|
|
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.lang.reflect.Field; |
|
|
import java.time.LocalDate; |
|
|
import java.time.LocalDate; |
|
|
import java.time.LocalDateTime; |
|
|
import java.time.LocalDateTime; |
|
@@ -121,6 +121,8 @@ public class GovProjectCollectionManage { |
|
|
|
|
|
|
|
|
private final ThreadPoolTaskScheduler threadPoolTaskScheduler; |
|
|
private final ThreadPoolTaskScheduler threadPoolTaskScheduler; |
|
|
|
|
|
|
|
|
|
|
|
private final FileService fileService; |
|
|
|
|
|
|
|
|
@Value("${project.push-url}") |
|
|
@Value("${project.push-url}") |
|
|
private String pushUrl; |
|
|
private String pushUrl; |
|
|
|
|
|
|
|
@@ -1695,7 +1697,9 @@ public class GovProjectCollectionManage { |
|
|
StringJoiner sj = convertAndUpload(procure.getBiddingFile()); |
|
|
StringJoiner sj = convertAndUpload(procure.getBiddingFile()); |
|
|
saveProcure.setBiddingFilePdf(sj.toString()); |
|
|
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()); |
|
|
StringJoiner sj = convertAndUpload(procure.getPurchaseContract()); |
|
|
saveProcure.setPurchaseContractPdf(sj.toString()); |
|
|
saveProcure.setPurchaseContractPdf(sj.toString()); |
|
|
} |
|
|
} |
|
@@ -1710,9 +1714,25 @@ public class GovProjectCollectionManage { |
|
|
JSONArray fileArray = JSON.parseArray(bpb); |
|
|
JSONArray fileArray = JSON.parseArray(bpb); |
|
|
fileArray.forEach(j -> { |
|
|
fileArray.forEach(j -> { |
|
|
JSONObject jsonObject = JSON.parseObject(JSON.toJSONString(j)); |
|
|
JSONObject jsonObject = JSON.parseObject(JSON.toJSONString(j)); |
|
|
byte[] btyes = wpsConvertManage.downloadToPdfStream(jsonObject.getLong("id")); |
|
|
|
|
|
String suffix = jsonObject.getString("suffix"); |
|
|
String suffix = jsonObject.getString("suffix"); |
|
|
|
|
|
//如果已经是PDF 就不用转换了 |
|
|
|
|
|
byte[] btyes = null; |
|
|
String originalFileName = jsonObject.getString("originalFileName"); |
|
|
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)){ |
|
|
if(!BizConst.DEV.equals(active)){ |
|
|
originalFileName = originalFileName.replace(StrPool.DOT + suffix, ".pdf"); |
|
|
originalFileName = originalFileName.replace(StrPool.DOT + suffix, ".pdf"); |
|
|
} |
|
|
} |
|
|