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