在线编辑文件必须走在线编辑的pdf转换
This commit is contained in:
+118
-1
@@ -4914,7 +4914,7 @@ public class SarBussionessStandServiceImpl extends ServiceImpl<SarBussionessStan
|
||||
/*
|
||||
未转换成刚的文件此处进行 转换
|
||||
*/
|
||||
private String sarStandFilePdf(String fileIds){
|
||||
/* private String sarStandFilePdf(String fileIds){
|
||||
String[] split = fileIds.split(",");
|
||||
for (String fileId : split){
|
||||
QueryWrapper<SarBussStandFile> objectQueryWrapper = new QueryWrapper<>();
|
||||
@@ -5008,6 +5008,123 @@ public class SarBussionessStandServiceImpl extends ServiceImpl<SarBussionessStan
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
return "2";
|
||||
}*/
|
||||
|
||||
/*
|
||||
未转换成刚的文件此处进行 转换
|
||||
*/
|
||||
private String sarStandFilePdf(String fileIds){
|
||||
String[] split = fileIds.split(",");
|
||||
for (String fileId : split){
|
||||
QueryWrapper<SarBussStandFile> objectQueryWrapper = new QueryWrapper<>();
|
||||
objectQueryWrapper.eq("ORI_ATT_ID",fileId);
|
||||
objectQueryWrapper.eq("USE_MODEL","SOURCE_FILE");
|
||||
//objectQueryWrapper.ne("FILE_SUFFIX","docx");
|
||||
List<SarBussStandFile> sarBussStandFiles = sarBussStandFileEODao.selectList(objectQueryWrapper);
|
||||
if(!sarBussStandFiles.isEmpty()) {
|
||||
//判断是否是在线编辑文件
|
||||
QueryWrapper<OnlineFileLog> onlineFileLogWrapper = new QueryWrapper<>();
|
||||
onlineFileLogWrapper.eq("ATT_FILE_ID",sarBussStandFiles.get(0).getOriAttId());
|
||||
List<OnlineFileLog> onlineFileLogs = onlineFileLogDao.selectList(onlineFileLogWrapper);
|
||||
if(!onlineFileLogs.isEmpty()){
|
||||
//在线编辑的情况下,判断是否有web
|
||||
QueryWrapper<SarBussStandFile> objectQueryWrapperSarBussStandFile = new QueryWrapper<>();
|
||||
objectQueryWrapperSarBussStandFile.eq("ORI_ATT_ID", sarBussStandFiles.get(0).getOriAttId());
|
||||
objectQueryWrapperSarBussStandFile.eq("USE_MODEL", "WEB_FILE");
|
||||
List<SarBussStandFile> sarBussStandFilesList = sarBussStandFileEODao.selectList(objectQueryWrapperSarBussStandFile);
|
||||
if(!sarBussStandFilesList.isEmpty()){
|
||||
//删除当前pdf文件
|
||||
AttFileEO fileInfo = attFileEOService.getFileInfo(sarBussStandFilesList.get(0).getAttId());
|
||||
if(fileInfo!=null) {
|
||||
File file = new File(filePath + fileInfo.getFilePath() + fileInfo.getFileName());
|
||||
if(file.exists()){
|
||||
file.delete();
|
||||
}
|
||||
sarBussStandFileEODao.deleteById(sarBussStandFilesList.get(0).getId());
|
||||
}
|
||||
}
|
||||
if(StringUtils.isNotBlank(onlineFileLogs.get(0).getOLdFileName()) && StringUtils.isNotBlank(onlineFileLogs.get(0).getFilekey()) && StringUtils.isNotBlank(onlineFileLogs.get(0).getFilePath())){
|
||||
try {
|
||||
logger.info("======================================远程调用转换开始启动=================================");
|
||||
logger.info("=================================="+ onlineFileLogs.get(0).toString());
|
||||
File file = OnlyofficePdfUtil.downloadFile(onlyofficeUrl,filePath,onlineFileLogs.get(0).getOLdFileName(), onlineFileLogs.get(0).getFilekey(), onlineFileLogs.get(0).getFilePath());
|
||||
logger.info("======================================远程调用转换开始结束=================================");
|
||||
// File file = new File(filePath+"/onlineFile/"+onlineFileLogs.get(0).getOLdFileName());
|
||||
logger.info("======================================file文件路径================================="+filePath+"/onlineFile/"+onlineFileLogs.get(0).getOLdFileName());
|
||||
if(file != null && file.exists()){
|
||||
logger.info("==============================文件所在位置:{}",file.getAbsolutePath());
|
||||
logger.info("======================================file文件保存================================="+filePath+"/onlineFile/"+onlineFileLogs.get(0).getOLdFileName());
|
||||
AttFileVo attFileVo = attFileEOService.saveFileInfo(file);
|
||||
if (file.delete()) {
|
||||
logger.info("==================删除临时文件成功================");
|
||||
}else{
|
||||
logger.info("====================删除临时文件失败=================");
|
||||
}
|
||||
if(attFileVo!=null){
|
||||
logger.info("============================文件ID:{},文件存储位置:{}",attFileVo.getId(),attFileVo.getFilePath());
|
||||
SarBussStandFile sarBussStandFile = new SarBussStandFile();
|
||||
//sarBussStandFile.setId();
|
||||
String uuId = com.adc.da.util.utils.UUID.randomUUID(20);
|
||||
sarBussStandFile.setId(uuId);
|
||||
sarBussStandFile.setStandId(sarBussStandFiles.get(0).getStandId());
|
||||
sarBussStandFile.setStandFileClassify(sarBussStandFiles.get(0).getStandFileClassify());
|
||||
sarBussStandFile.setAttId(attFileVo.getId());
|
||||
sarBussStandFile.setFileName(filePath+attFileVo.getFilePath()+attFileVo.getFileName());
|
||||
sarBussStandFile.setFileSuffix(attFileVo.getFileSuffix());
|
||||
sarBussStandFile.setUseModel(UseModuleEnum.WEB_FILE.getValue());
|
||||
sarBussStandFile.setPassword(sarBussStandFiles.get(0).getPassword());
|
||||
sarBussStandFile.setValidFlag(0);
|
||||
sarBussStandFile.setCreationTime(new Date());
|
||||
sarBussStandFile.setModifyTime(new Date());
|
||||
sarBussStandFile.setOriAttId(sarBussStandFiles.get(0).getOriAttId());
|
||||
sarBussStandFileEODao.insert(sarBussStandFile);
|
||||
}else {
|
||||
logger.info("======================================word.doc转换失败=================================");
|
||||
}
|
||||
}else {
|
||||
logger.info("======================================pdf文件不存在!!!!=================================");
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
}else {
|
||||
//不是在线编辑
|
||||
//在线编辑的情况下,判断是否有web
|
||||
QueryWrapper<SarBussStandFile> objectQueryWrapperSarBussStandFile = new QueryWrapper<>();
|
||||
objectQueryWrapperSarBussStandFile.eq("ORI_ATT_ID", sarBussStandFiles.get(0).getOriAttId());
|
||||
objectQueryWrapperSarBussStandFile.eq("USE_MODEL", "WEB_FILE");
|
||||
List<SarBussStandFile> sarBussStandFilesList = sarBussStandFileEODao.selectList(objectQueryWrapperSarBussStandFile);
|
||||
//是空则证明 当前文件是普通pdf 非在线编辑
|
||||
if(sarBussStandFilesList.isEmpty()){
|
||||
AttFileEO fileInfo = attFileEOService.getFileInfo(sarBussStandFiles.get(0).getOriAttId());
|
||||
if(fileInfo!=null){
|
||||
String fileName = "";
|
||||
if(StringUtils.isNotBlank(fileInfo.getFileName())){
|
||||
String[] splitInfo = fileInfo.getFileName().split("\\.");
|
||||
fileName = splitInfo[0];
|
||||
}
|
||||
Map<String, String> bussMap = new HashMap<>();
|
||||
bussMap.put("FILE_SUFFIX",sarBussStandFiles.get(0).getFileSuffix());
|
||||
bussMap.put("CONVERFILENAME",filePath+fileInfo.getFilePath()+fileInfo.getFileName());
|
||||
bussMap.put("SAVEPDFPATH",filePath+fileInfo.getFilePath()+fileName+".pdf");
|
||||
bussMap.put("STANDID",sarBussStandFiles.get(0).getStandId());
|
||||
bussMap.put("STANDFILECLASSIFY",sarBussStandFiles.get(0).getStandFileClassify());
|
||||
bussMap.put("FILENAME",filePath+fileInfo.getFilePath()+fileName+".pdf");
|
||||
bussMap.put("PASSWORD",sarBussStandFiles.get(0).getPassword());
|
||||
bussMap.put("OAIATTID",sarBussStandFiles.get(0).getOriAttId());
|
||||
logger.info("======================================word.doc发送mq=================================");
|
||||
createOnlineEditingFileMQService.OnlineEditingFileMQ(bussMap);
|
||||
}else {
|
||||
logger.info("======================================word.doc转换失败=================================");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
return "2";
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user