qijirenjian 3 months ago
parent f8624cbbbd
commit 93d4b09e43

@ -2,6 +2,7 @@ package com.weaver.seconddev.interfaces.workflow.action;
import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.weaver.seconddev.interfaces.workflow.util.DocUtil;
import org.apache.axis.encoding.Base64; import org.apache.axis.encoding.Base64;
import com.weaver.seconddev.interfaces.pmoa.PMService; import com.weaver.seconddev.interfaces.pmoa.PMService;
import java.io.*; import java.io.*;
@ -37,8 +38,10 @@ public class PMProjectAcceptanceAction extends BaseBean implements Action, EsbSe
private RequestInfo requestInfoTemp; private RequestInfo requestInfoTemp;
@Autowired @Autowired
private PMService pmService ; private PMService pmService ;
@Autowired
private DocUtil docUtil;
private static final Logger logger_f17f81aa = LoggerFactory.getLogger(PMProjectAcceptanceAction.class); private static final Logger logger_f17f81aa = LoggerFactory.getLogger(PMProjectAcceptanceAction.class);
public WeaResult<Map<String, Object>> execute(Map<String, Object> requestInfoMap) { public WeaResult<Map<String, Object>> execute(Map<String, Object> requestInfoMap) {
@ -115,34 +118,43 @@ public class PMProjectAcceptanceAction extends BaseBean implements Action, EsbSe
String[] docs = fj.split(","); String[] docs = fj.split(",");
for (int i = 0; i < docs.length; i++) { for (int i = 0; i < docs.length; i++) {
String docid = docs[i]; String docid = docs[i];
String sql = " select b.filerealpath,b.iszip,b.name,b.imagefileid from " + " e10_common.dbo.fileobj b where b.imagefileid in(select max(imagefileid) " + "from e10_common.dbo.document_main_access as docimagefile where docid in(" + docid + ") group by docid)";
String poolname = CONN_TYPE.workflow.getType(); Map<String, String> docInfoWf = docUtil.getDocInfoWf(docid, "t6kj9c07jr");
// TODO E10执行sql方法第二参数必须指定源默认使用流程源单体客户无需修改微服务/组合客户需根据查询表所属服务切换源,或使用外部数据源 String uploadBuffer = docInfoWf.get("base64str");
boolean b = rs.executeSql(sql, poolname); String imagefilename = docInfoWf.get("filename");
logger_f17f81aa.error("b--" + b); logger_f17f81aa.error(String.valueOf(requestIdTemp + " 附件:" + imagefilename + " " + uploadBuffer.length()));
if (rs.next()) { JSONObject fileItem = new JSONObject();
JSONObject fileItem = new JSONObject(); fileItem.put("fileName", imagefilename);
String imagefileid = Util.null2String(rs.getString("imagefileid")); fileItem.put("context", uploadBuffer);
String filerealpath = Util.null2String(rs.getString("filerealpath")); fileList.add(fileItem);
String iszip = Util.null2String(rs.getString("iszip")); // String sql = " select b.filerealpath,b.iszip,b.name,b.imagefileid from " + " e10_common.dbo.fileobj b where b.imagefileid in(select max(imagefileid) " + "from e10_common.dbo.document_main_access as docimagefile where docid in(" + docid + ") group by docid)";
// 文件名 // String poolname = CONN_TYPE.workflow.getType();
String imagefilename = Util.null2String(rs.getString("imagefilename")); // // TODO E10执行sql方法第二参数必须指定源默认使用流程源单体客户无需修改微服务/组合客户需根据查询表所属服务切换源,或使用外部数据源
InputStream fi = getFile(filerealpath, iszip); // boolean b = rs.executeSql(sql, poolname);
ByteArrayOutputStream baos = new ByteArrayOutputStream(); // logger_f17f81aa.error("b--" + b);
byte[] buffer = new byte[1024]; // if (rs.next()) {
int count = 0; // JSONObject fileItem = new JSONObject();
while ((count = fi.read(buffer)) >= 0) { // String imagefileid = Util.null2String(rs.getString("imagefileid"));
baos.write(buffer, 0, count); // String filerealpath = Util.null2String(rs.getString("filerealpath"));
} // String iszip = Util.null2String(rs.getString("iszip"));
String uploadBuffer = Base64.encode(baos.toByteArray()); // // 文件名
logger_f17f81aa.error(String.valueOf(requestid + " 附件:" + imagefilename + " " + uploadBuffer.length())); // String imagefilename = Util.null2String(rs.getString("imagefilename"));
fileItem.put("filename", imagefilename); // InputStream fi = getFile(filerealpath, iszip);
fileItem.put("context", uploadBuffer); // ByteArrayOutputStream baos = new ByteArrayOutputStream();
fileList.add(fileItem); // byte[] buffer = new byte[1024];
baos.close(); // int count = 0;
fi.close(); // while ((count = fi.read(buffer)) >= 0) {
// 这里就可以封装 文件名和文件内容 传给第三方系统 // baos.write(buffer, 0, count);
} // }
// String uploadBuffer = Base64.encode(baos.toByteArray());
// logger_f17f81aa.error(String.valueOf(requestid + " 附件:" + imagefilename + " " + uploadBuffer.length()));
// fileItem.put("filename", imagefilename);
// fileItem.put("context", uploadBuffer);
// fileList.add(fileItem);
// baos.close();
// fi.close();
// // 这里就可以封装 文件名和文件内容 传给第三方系统
// }
} }
} }
// DocServiceImpl service = new DocServiceImpl(); // DocServiceImpl service = new DocServiceImpl();

Loading…
Cancel
Save