如果pdf是单文件,则也需要进行一次文件复制,但是不需要进行合并
parent
3c57e87b7f
commit
9ea873a7ca
|
@ -4,13 +4,19 @@ import aiyh.utils.Util;
|
|||
import aiyh.utils.mapUtil.ParaMap;
|
||||
import aiyh.utils.sqlUtil.sqlResult.impl.PrepSqlResultImpl;
|
||||
import aiyh.utils.zwl.common.ToolUtil;
|
||||
import org.apache.axiom.util.base64.Base64Utils;
|
||||
import org.apache.commons.io.IOUtils;
|
||||
import org.h2.util.StringUtils;
|
||||
import weaver.conn.RecordSet;
|
||||
import weaver.docs.docs.seconddev.CreateDocForJSGJXT;
|
||||
import weaver.file.ImageFileManager;
|
||||
import weaver.hrm.User;
|
||||
import weaver.interfaces.workflow.action.Action;
|
||||
import weaver.soa.workflow.FileProcessor;
|
||||
import weaver.soa.workflow.request.RequestInfo;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
|
@ -67,9 +73,7 @@ public class ConvertPdfAction implements Action {
|
|||
if(StringUtils.isNullOrEmpty(docIds)){
|
||||
return Action.SUCCESS;
|
||||
}
|
||||
if(docIds.split(",").length <= 1){
|
||||
return Action.SUCCESS;
|
||||
}
|
||||
|
||||
// 查询字段的目录
|
||||
String docCategorys = Util.getDocCategorys(workflowId, mergeField);
|
||||
CreateDocForJSGJXT createDocForJSGJXT = new CreateDocForJSGJXT();
|
||||
|
@ -107,7 +111,29 @@ public class ConvertPdfAction implements Action {
|
|||
fileName = defaultFileName;
|
||||
}
|
||||
toolUtil.writeDebuggerLog("合并文件参数:fileName:" + fileName + " docCategory:" + docCategory + " docIds:" + docIds);
|
||||
int fileId = createDocForJSGJXT.creatDoc(user, fileName, docCategory, docIds);
|
||||
int fileId;
|
||||
if(docIds.split(",").length <= 1){
|
||||
// 查询真实文件id
|
||||
query = "select imagefileid from docimagefile where docid = ?";
|
||||
toolUtil.writeDebuggerLog(query + " ---> " + docIds);
|
||||
rs.executeQuery(query,docIds);
|
||||
rs.next();
|
||||
fileId = Util.getIntValue(rs.getString("imagefileid"),0);
|
||||
FileProcessor fileProcessor = new FileProcessor();
|
||||
InputStream inputStreamById = ImageFileManager.getInputStreamById(fileId);
|
||||
byte[] bytes = new byte[0];
|
||||
try {
|
||||
bytes = IOUtils.toByteArray(inputStreamById);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
toolUtil.writeErrorLog("复制文件时,文件转为base64出错,文件转换出错!" + e);
|
||||
}
|
||||
String base64 = Base64Utils.encode(bytes);
|
||||
fileId = fileProcessor.Process("base64:" + base64, docCategorys, user, fileName);
|
||||
}else{
|
||||
fileId = createDocForJSGJXT.creatDoc(user, fileName, docCategory, docIds);
|
||||
}
|
||||
|
||||
if(fileId <= 0){
|
||||
toolUtil.writeDebuggerLog("文件合并错误!(-2:用户为空,-1:文档获取异常)、错误id:" + fileId);
|
||||
// TODO 修改labelId
|
||||
|
|
Loading…
Reference in New Issue