|
|
@@ -4,8 +4,6 @@ import cn.hutool.core.bean.BeanUtil; |
|
|
|
import cn.hutool.core.bean.copier.CopyOptions; |
|
|
|
import cn.hutool.core.collection.CollUtil; |
|
|
|
import com.alibaba.fastjson.JSON; |
|
|
|
import com.alibaba.fastjson.JSONArray; |
|
|
|
import com.alibaba.fastjson.JSONObject; |
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
|
|
@@ -36,16 +34,14 @@ import com.hz.pm.api.projectlib.enumeration.ProjectTypeNewEnum; |
|
|
|
import com.hz.pm.api.projectlib.model.entity.*; |
|
|
|
import com.hz.pm.api.projectlib.model.req.ProjectListReq; |
|
|
|
import com.hz.pm.api.projectlib.service.*; |
|
|
|
import com.hz.pm.api.provincial.manage.ProvincialManage; |
|
|
|
import com.hz.pm.api.safety.model.entity.PersonSafetyInfo; |
|
|
|
import com.hz.pm.api.safety.model.entity.SupplierSafetyQualification; |
|
|
|
import com.hz.pm.api.safety.service.IPersonSafetyInfoService; |
|
|
|
import com.hz.pm.api.safety.service.ISupplierSafetyQualificationService; |
|
|
|
import com.hz.pm.api.staging.model.entity.ProjectStaging; |
|
|
|
import com.hz.pm.api.staging.service.IProjectStagingService; |
|
|
|
import com.hz.pm.api.user.security.auth.model.UserInfoDetails; |
|
|
|
import com.hz.pm.api.user.security.model.UserInfoDetails; |
|
|
|
import com.hz.pm.api.user.util.LoginUserUtil; |
|
|
|
import com.hz.pm.api.wps.manage.WpsConvertManage; |
|
|
|
import com.ningdatech.basic.exception.BizException; |
|
|
|
import com.ningdatech.basic.function.VUtils; |
|
|
|
import com.ningdatech.basic.model.PageVo; |
|
|
@@ -56,7 +52,6 @@ import com.wflow.service.WflowCcTasksService; |
|
|
|
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.Value; |
|
|
@@ -69,7 +64,10 @@ import org.springframework.stereotype.Component; |
|
|
|
import org.springframework.transaction.annotation.Transactional; |
|
|
|
import org.springframework.web.client.RestTemplate; |
|
|
|
|
|
|
|
import java.io.*; |
|
|
|
import java.io.BufferedOutputStream; |
|
|
|
import java.io.File; |
|
|
|
import java.io.FileOutputStream; |
|
|
|
import java.io.IOException; |
|
|
|
import java.lang.reflect.Field; |
|
|
|
import java.time.LocalDate; |
|
|
|
import java.time.LocalDateTime; |
|
|
@@ -113,8 +111,6 @@ public class GovProjectCollectionManage { |
|
|
|
|
|
|
|
private final RestTemplate restTemplate; |
|
|
|
|
|
|
|
private final WpsConvertManage wpsConvertManage; |
|
|
|
|
|
|
|
private final ThreadPoolTaskScheduler threadPoolTaskScheduler; |
|
|
|
|
|
|
|
private final FileService fileService; |
|
|
@@ -1723,45 +1719,7 @@ public class GovProjectCollectionManage { |
|
|
|
} |
|
|
|
|
|
|
|
public StringJoiner convertAndUpload(String baseProjBasisFile) { |
|
|
|
String[] baseProjBasisFileArr = baseProjBasisFile.split(";"); |
|
|
|
StringJoiner sj = new StringJoiner(";"); |
|
|
|
for (String bpb : baseProjBasisFileArr) { |
|
|
|
try { |
|
|
|
JSONArray fileArray = JSON.parseArray(bpb); |
|
|
|
fileArray.forEach(j -> { |
|
|
|
JSONObject jsonObject = JSON.parseObject(JSON.toJSONString(j)); |
|
|
|
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"); |
|
|
|
} |
|
|
|
// upload(btyes,"/temp",originalFileName); |
|
|
|
String oss = ProvincialManage.uploadToOss(btyes, originalFileName); |
|
|
|
sj.add(oss); |
|
|
|
}); |
|
|
|
} catch (Exception e) { |
|
|
|
log.error("解析文件出错!" + e); |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
return sj; |
|
|
|
throw BizException.wrap("pdf转换无效"); |
|
|
|
} |
|
|
|
|
|
|
|
private Boolean checkFieldNotPdf(String field, Object record, String fieldName) { |
|
|
|