qijirenjian 4 months ago
parent 7059294f5e
commit 0242b908ad

@ -110,17 +110,21 @@ public class DelayDateSyncAction extends BaseBean implements Action, EsbServerle
if (!"S".equals(str[0])) {
requestInfo.getRequestManager().setMessageid("ERROR");
requestInfo.getRequestManager().setMessagecontent("报账系统返回错误信息:" + str[1]);
return WeaResult.fail(500, "报账系统返回错误信息"+ str[1], getResultMapForAction(weaverResultMap, "result", FAILURE_AND_CONTINUE, requestInfo.getRequestManager()));
}
} catch (Exception e) {
requestInfo.getRequestManager().setMessageid("ERROR");
requestInfo.getRequestManager().setMessagecontent("数据同步报账系统失败," + e.toString());
logger_46fa23c3.error(String.valueOf("DelayDateSyncAction--" + requestid + "--end"));
return WeaResult.fail(500, "数据同步报账系统失败"+e, getResultMapForAction(weaverResultMap, "result", FAILURE_AND_CONTINUE, requestInfo.getRequestManager()));
}
return WeaResult.success(getResultMapForAction(weaverResultMap, "result", Action.SUCCESS, requestInfo.getRequestManager()));
} catch (Exception e) {
e.printStackTrace();
logger_46fa23c3.error("DelayDateSyncAction e: {}", e.getMessage());
return WeaResult.success(getResultMapForAction(weaverResultMap, "result", WeaResult.fail(500, "执行异常", getResultMapForAction(weaverResultMap, "result", e.getMessage(), requestInfo.getRequestManager())), requestInfo.getRequestManager()));
return WeaResult.fail(500, "执行失败"+e, getResultMapForAction(weaverResultMap, "result", FAILURE_AND_CONTINUE, requestInfo.getRequestManager()));
}
}

@ -69,9 +69,9 @@ public class EAS_DZDAApproveAction extends BaseBean implements Action, EsbServer
*/
String ITFID = "HTEFS002";
// 接口账号
String USERNAME = "htefs";
String USERNAME = configProp.getEfsaccount();
// 接口密码
String PASSWORD = "efs2@2@@9!@HT";
String PASSWORD = configProp.getEfspassword();
// 审批者工号
String approvalBy = "";
// 审批时间
@ -167,7 +167,7 @@ public class EAS_DZDAApproveAction extends BaseBean implements Action, EsbServer
logger_3f787449.error("调用借阅审批回调接口请求数据:=====" + mJson.toString());
// 调用接口
// String url = Util.null2String(I18nContextUtilcus.getBean(Environment.class).getProperty("hteasoasync.uploadDZDAApprovelUrl")).trim();
String url = configProp.getUploadZZInfoUrl();
String url = configProp.getUploadDZDAApprovelUrl();
ZZ_SendPostRequest mGetResult = new ZZ_SendPostRequest();
String result = mGetResult.getResult(mJson, url);
logger_3f787449.error(String.valueOf("调用借阅审批回调接口返回值:" + result));
@ -183,26 +183,26 @@ public class EAS_DZDAApproveAction extends BaseBean implements Action, EsbServer
logger_3f787449.error(String.valueOf("报账系统返回错误信息:" + srMessage));
// requestInfo.getRequestManager().setMessageid("ERROR");
requestInfo.getRequestManager().setMessagecontent("报账系统返回错误信息:" + srMessage);
return WeaResult.fail(500, "执行失败", getResultMapForAction(weaverResultMap, "result", FAILURE_AND_CONTINUE, requestInfo.getRequestManager()));
return WeaResult.fail(500, "执行失败:"+srMessage, getResultMapForAction(weaverResultMap, "result", FAILURE_AND_CONTINUE, requestInfo.getRequestManager()));
}
} else {
logger_3f787449.error(String.valueOf("调用借阅审批回调接口返回失败,请联系报账系统管理员!"));
// requestInfo.getRequestManager().setMessageid("ERROR");
requestInfo.getRequestManager().setMessagecontent("调用借阅审批回调接口返回失败,请联系报账系统管理员!");
return WeaResult.fail(500, "执行失败", getResultMapForAction(weaverResultMap, "result", FAILURE_AND_CONTINUE, requestInfo.getRequestManager()));
return WeaResult.fail(500, "调用借阅审批回调接口返回失败,请联系报账系统管理员!", getResultMapForAction(weaverResultMap, "result", FAILURE_AND_CONTINUE, requestInfo.getRequestManager()));
}
} catch (Exception e) {
logger_3f787449.error(String.valueOf("提交失败!"));
logger_3f787449.error(String.valueOf("Error======" + e.getMessage()));
logger_3f787449.error(String.valueOf("Error======" ), e);
// requestInfo.getRequestManager().setMessageid("ERROR");
requestInfo.getRequestManager().setMessagecontent("提交失败!");
return WeaResult.fail(500, "执行失败", getResultMapForAction(weaverResultMap, "result", FAILURE_AND_CONTINUE, requestInfo.getRequestManager()));
return WeaResult.fail(500, "执行失败"+e, getResultMapForAction(weaverResultMap, "result", FAILURE_AND_CONTINUE, requestInfo.getRequestManager()));
}
return WeaResult.success(getResultMapForAction(weaverResultMap, "result", Action.SUCCESS, requestInfo.getRequestManager()));
} catch (Exception e) {
e.printStackTrace();
logger_3f787449.error("EAS_DZDAApproveAction e: {}", e.getMessage());
return WeaResult.fail(500, "执行失败", getResultMapForAction(weaverResultMap, "result", FAILURE_AND_CONTINUE, requestInfo.getRequestManager()));
return WeaResult.fail(500, "执行失败"+e, getResultMapForAction(weaverResultMap, "result", FAILURE_AND_CONTINUE, requestInfo.getRequestManager()));
}
}

@ -56,6 +56,7 @@ public class EasTzlhtApplyResult extends BaseBean {
logger_4b97b171.error(String.valueOf("EasTzlhtApplyResult---rspCode=" + rspCode));
} catch (Exception e) {
logger_4b97b171.error(String.valueOf("调用报账系统接口出错" + e.toString()));
} finally {
if (post != null) {
post.releaseConnection();

@ -425,11 +425,15 @@ public class EasTzlhtSubmitAction extends BaseBean implements Action, EsbServerl
logger_1cc47ce8.error(String.valueOf("报账系统返回错误信息:" + srMessage));
requestInfo.getRequestManager().setMessageid("ERROR");
requestInfo.getRequestManager().setMessagecontent("报账系统返回错误信息:" + srMessage);
return WeaResult.fail(500, "报账系统返回错误信息:" + srMessage, getResultMapForAction(weaverResultMap, "result", FAILURE_AND_CONTINUE, requestInfo.getRequestManager()));
}
} else {
logger_1cc47ce8.error(String.valueOf("调用报账系统投资类合同新增校验接口返回失败,请联系报账系统管理员!"));
requestInfo.getRequestManager().setMessageid("ERROR");
requestInfo.getRequestManager().setMessagecontent("调用报账系统投资类合同新增校验接口返回失败,请联系报账系统管理员!");
return WeaResult.fail(500, "调用报账系统投资类合同新增校验接口返回失败,请联系报账系统管理员!"+result, getResultMapForAction(weaverResultMap, "result", FAILURE_AND_CONTINUE, requestInfo.getRequestManager()));
}
}
} catch (Exception e) {
@ -437,12 +441,13 @@ public class EasTzlhtSubmitAction extends BaseBean implements Action, EsbServerl
logger_1cc47ce8.error(String.valueOf("Error======" + e.getMessage()));
requestInfo.getRequestManager().setMessageid("ERROR");
requestInfo.getRequestManager().setMessagecontent("提交失败!");
}
return WeaResult.success(getResultMapForAction(weaverResultMap, "result", Action.SUCCESS, requestInfo.getRequestManager()));
} catch (Exception e) {
e.printStackTrace();
logger_1cc47ce8.error("EasTzlhtSubmitAction e: {}", e.getMessage());
return WeaResult.success(getResultMapForAction(weaverResultMap, "result", WeaResult.fail(500, "执行异常", getResultMapForAction(weaverResultMap, "result", e.getMessage(), requestInfo.getRequestManager())), requestInfo.getRequestManager()));
logger_1cc47ce8.error("EasTzlhtSubmitAction e: {}", e.toString());
return WeaResult.fail(500, e.toString(), getResultMapForAction(weaverResultMap, "result", FAILURE_AND_CONTINUE, requestInfo.getRequestManager()));
}
}

@ -59,11 +59,11 @@ public class ScfDraftApplyResultAction extends BaseBean implements Action, EsbSe
String value = Util.null2String(properties[i].getValue());
mMap.put(name, value);
}
if ("4205".equals(flowid)) {
if ("100003460000004205".equals(flowid)) {
// 开票申请
applyNo = mMap.get("APPLYNO");
ITFID = "HT01OA003";
} else if ("4206".equals(flowid)) {
} else if ("100003460000004206".equals(flowid)) {
// 直贷业务申请
applyNo = mMap.get("DISCOUNTNO");
ITFID = "HT01OA004";
@ -94,26 +94,26 @@ public class ScfDraftApplyResultAction extends BaseBean implements Action, EsbSe
logger_d39bef7.error(String.valueOf(requestID + "供应链金融系统返回错误信息:" + srMessage));
// requestInfo.getRequestManager().setMessageid("ERROR");
requestInfo.getRequestManager().setMessagecontent("供应链金融系统返回错误信息:" + srMessage);
return WeaResult.fail(500, "执行失败", getResultMapForAction(weaverResultMap, "result", FAILURE_AND_CONTINUE, requestInfo.getRequestManager()));
return WeaResult.fail(500, "执行失败:"+srMessage, getResultMapForAction(weaverResultMap, "result", FAILURE_AND_CONTINUE, requestInfo.getRequestManager()));
}
} else {
logger_d39bef7.error(String.valueOf("调用供应链金融系统开票申请审批接口返回失败,请联系供应链金融系统管理员!"));
// requestInfo.getRequestManager().setMessageid("ERROR");
requestInfo.getRequestManager().setMessagecontent("调用供应链金融系统开票申请审批接口返回失败,请联系供应链金融系统管理员!");
return WeaResult.fail(500, "执行失败", getResultMapForAction(weaverResultMap, "result", FAILURE_AND_CONTINUE, requestInfo.getRequestManager()));
return WeaResult.fail(500, "调用供应链金融系统开票申请审批接口返回失败,请联系供应链金融系统管理员!"+mJson.toString(), getResultMapForAction(weaverResultMap, "result", FAILURE_AND_CONTINUE, requestInfo.getRequestManager()));
}
logger_d39bef7.error(String.valueOf("ScfDraftApplyResultAction--end--" + requestID));
} catch (Exception e) {
logger_d39bef7.error(String.valueOf(requestID + "调用供应链金融系统返回审批结果接口出错:" + e.toString()));
logger_d39bef7.error(String.valueOf(requestID + "调用供应链金融系统返回审批结果接口出错:" ), e);
// requestInfo.getRequestManager().setMessageid("ERROR");
requestInfo.getRequestManager().setMessagecontent("调用供应链金融系统开票申请审批接口返回失败,请联系供应链金融系统管理员!");
return WeaResult.fail(500, "执行失败", getResultMapForAction(weaverResultMap, "result", FAILURE_AND_CONTINUE, requestInfo.getRequestManager()));
return WeaResult.fail(500, "执行失败:"+e, getResultMapForAction(weaverResultMap, "result", FAILURE_AND_CONTINUE, requestInfo.getRequestManager()));
}
return WeaResult.success(getResultMapForAction(weaverResultMap, "result", Action.SUCCESS, requestInfo.getRequestManager()));
} catch (Exception e) {
e.printStackTrace();
logger_d39bef7.error("ScfDraftApplyResultAction e: {}", e.getMessage());
return WeaResult.fail(500, "执行失败", getResultMapForAction(weaverResultMap, "result", FAILURE_AND_CONTINUE, requestInfo.getRequestManager()));
logger_d39bef7.error("ScfDraftApplyResultAction e: {}", e);
return WeaResult.fail(500, "执行失败:"+e, getResultMapForAction(weaverResultMap, "result", FAILURE_AND_CONTINUE, requestInfo.getRequestManager()));
}
}

@ -3,6 +3,7 @@ package com.weaver.seconddev.interfaces.workflow.action;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.weaver.seconddev.interfaces.prop.ConfigProp;
import com.weaver.seconddev.interfaces.workflow.util.DocUtil;
import org.apache.axis.encoding.Base64;
import com.weaver.seconddev.interfaces.swfa.BillFieldUtil;
import java.io.*;
@ -44,6 +45,9 @@ public class ZWZX_CG_FileUploadAction extends BaseBean implements Action, EsbSer
private RequestInfo requestInfoTemp;
@Autowired
private ConfigProp configProp;
@Autowired
private DocUtil docUtil;
private static final Logger logger_323752e9 = LoggerFactory.getLogger(ZWZX_CG_FileUploadAction.class);
@Override
@ -147,39 +151,49 @@ public class ZWZX_CG_FileUploadAction extends BaseBean implements Action, EsbSer
String[] docs = fileIds.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_core_business.dbo.fileobj b where b.imagefileid in(select max(imagefileid) " + "from e10_core_business.dbo.document_main_access as docimagefile where docid in(" + docid + ") group by docid)";
logger_323752e9.error("sql -----"+ sql);
String poolname = CONN_TYPE.workflow.getType();
// TODO E10执行sql方法第二参数必须指定源默认使用流程源单体客户无需修改微服务/组合客户需根据查询表所属服务切换源,或使用外部数据源
boolean b1 = rs.executeSql(sql, poolname);
logger_323752e9.error("sql flag-----"+ b1);
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_323752e9.error(String.valueOf(requestID + " 附件:" + imagefilename + " " + uploadBuffer.length()));
fileItem.put("imgSeq", (i + 1) + "");
fileItem.put("fileName", imagefilename);
fileItem.put("fileContent", uploadBuffer);
fileItem.put("invoiceNo", "");
logger_323752e9.error(String.valueOf("fileItem =" + fileItem));
fileVOListArr.add(fileItem);
baos.close();
fi.close();
// 这里就可以封装 文件名和文件内容 传给第三方系统
}
// String sql = " select b.filerealpath,b.iszip,b.name,b.imagefileid from " + " e10_core_business.dbo.fileobj b where b.imagefileid in(select max(imagefileid) " + "from e10_core_business.dbo.document_main_access as docimagefile where docid in(" + docid + ") group by docid)";
// logger_323752e9.error("sql -----"+ sql);
// String poolname = CONN_TYPE.workflow.getType();
// // TODO E10执行sql方法第二参数必须指定源默认使用流程源单体客户无需修改微服务/组合客户需根据查询表所属服务切换源,或使用外部数据源
// boolean b1 = rs.executeSql(sql, poolname);
// logger_323752e9.error("sql flag-----"+ b1);
// 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_323752e9.error(String.valueOf(requestID + " 附件:" + imagefilename + " " + uploadBuffer.length()));
// fileItem.put("imgSeq", (i + 1) + "");
// fileItem.put("fileName", imagefilename);
// fileItem.put("fileContent", uploadBuffer);
// fileItem.put("invoiceNo", "");
//
// logger_323752e9.error(String.valueOf("fileItem =" + fileItem));
// fileVOListArr.add(fileItem);
// baos.close();
// fi.close();
// // 这里就可以封装 文件名和文件内容 传给第三方系统
// }
Map<String, String> docInfoWf = docUtil.getDocInfoWf(docid, "t6kj9c07jr");
String uploadBuffer = docInfoWf.get("base64str");
String imagefilename = docInfoWf.get("filename");
logger_323752e9.error(String.valueOf(requestID + " 附件:" + imagefilename + " " + uploadBuffer.length()));
JSONObject fileItem = new JSONObject();
fileItem.put("imgSeq", (i + 1) + "");
fileItem.put("fileName", imagefilename);
fileItem.put("fileContent", uploadBuffer);
fileItem.put("invoiceNo", "");
fileVOListArr.add(fileItem);
}
}
// DocServiceImpl service = new DocServiceImpl();

@ -64,9 +64,11 @@ public class ZZ_DZDAFDApproveAction extends BaseBean implements Action, EsbServe
*/
String ITFID = "HTEFS006";
// 接口账号
String USERNAME = "htefs";
// String USERNAME = "htefs";
String USERNAME = configProp.getEfsaccount();
// 接口密码
String PASSWORD = "efs2@2@@9!@HT";
// String PASSWORD = "efs2@2@@9!@HT";
String PASSWORD = configProp.getEfspassword();
try {
ResourceComInfo hr = I18nContextUtil.getBean(ResourceComInfo.class);
BillFieldUtil unit = new BillFieldUtil();

@ -3,6 +3,7 @@ package com.weaver.seconddev.interfaces.workflow.action;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.weaver.seconddev.interfaces.prop.ConfigProp;
import com.weaver.seconddev.interfaces.workflow.util.DocUtil;
import org.apache.axis.encoding.Base64;
import com.weaver.seconddev.interfaces.swfa.BillFieldUtil;
import java.io.*;
@ -51,6 +52,9 @@ public class ZZ_GDFileUploadAction extends BaseBean implements Action, EsbServer
private RequestInfo requestInfoTemp;
@Autowired
private ConfigProp configProp;
@Autowired
private DocUtil docUtil;
private static final Logger logger_b14cb5d0 = LoggerFactory.getLogger(ZZ_GDFileUploadAction.class);
@Override
@ -78,10 +82,10 @@ public class ZZ_GDFileUploadAction extends BaseBean implements Action, EsbServer
String ITFID = "HTEFS001";
// 接口账号
// String USERNAME = "htefs";
String USERNAME = "hengtong";
String USERNAME = configProp.getEfsaccount();
// 接口密码
// String PASSWORD = "efs2@2@@9!@HT";
String PASSWORD = "abc,,,123";
String PASSWORD = configProp.getEfspassword();
// 业务属性 6-总账
String businessTag = "6";
// //业务类型 1: 费用类 2; 采购类---1,2是针对报账系统的
@ -149,39 +153,49 @@ public class ZZ_GDFileUploadAction extends BaseBean implements Action, EsbServer
String[] docs = fileIds.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_core_business.dbo.fileobj b where b.imagefileid in(select max(imagefileid) " + "from e10_core_business.dbo.document_main_access as docimagefile where docid in(" + docid + ") group by docid)";
logger_b14cb5d0.error("sql -----"+ sql);
String poolname = CONN_TYPE.workflow.getType();
// TODO E10执行sql方法第二参数必须指定源默认使用流程源单体客户无需修改微服务/组合客户需根据查询表所属服务切换源,或使用外部数据源
boolean b1 = rs.executeSql(sql, poolname);
logger_b14cb5d0.error("sql flag-----"+ b1);
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_b14cb5d0.error(String.valueOf(requestID + " 附件:" + imagefilename + " " + uploadBuffer.length()));
fileItem.put("imgSeq", (i + 1) + "");
fileItem.put("fileName", imagefilename);
fileItem.put("fileContent", uploadBuffer);
fileItem.put("invoiceNo", "");
logger_b14cb5d0.error("fileItem -----"+ fileItem);
fileVOListArr.add(fileItem);
baos.close();
fi.close();
// 这里就可以封装 文件名和文件内容 传给第三方系统
}
// String sql = " select b.filerealpath,b.iszip,b.name,b.imagefileid from " + " e10_core_business.dbo.fileobj b where b.imagefileid in(select max(imagefileid) " + "from e10_core_business.dbo.document_main_access as docimagefile where docid in(" + docid + ") group by docid)";
// logger_b14cb5d0.error("sql -----"+ sql);
// String poolname = CONN_TYPE.workflow.getType();
// // TODO E10执行sql方法第二参数必须指定源默认使用流程源单体客户无需修改微服务/组合客户需根据查询表所属服务切换源,或使用外部数据源
// boolean b1 = rs.executeSql(sql, poolname);
// logger_b14cb5d0.error("sql flag-----"+ b1);
// 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_b14cb5d0.error(String.valueOf(requestID + " 附件:" + imagefilename + " " + uploadBuffer.length()));
// fileItem.put("imgSeq", (i + 1) + "");
// fileItem.put("fileName", imagefilename);
// fileItem.put("fileContent", uploadBuffer);
// fileItem.put("invoiceNo", "");
//
// logger_b14cb5d0.error("fileItem -----"+ fileItem);
// fileVOListArr.add(fileItem);
// baos.close();
// fi.close();
// // 这里就可以封装 文件名和文件内容 传给第三方系统
// }
Map<String, String> docInfoWf = docUtil.getDocInfoWf(docid, "t6kj9c07jr");
String uploadBuffer = docInfoWf.get("base64str");
String imagefilename = docInfoWf.get("filename");
logger_b14cb5d0.error(String.valueOf(requestID + " 附件:" + imagefilename + " " + uploadBuffer.length()));
JSONObject fileItem = new JSONObject();
fileItem.put("imgSeq", (i + 1) + "");
fileItem.put("fileName", imagefilename);
fileItem.put("fileContent", uploadBuffer);
fileItem.put("invoiceNo", "");
fileVOListArr.add(fileItem);
}
}
// 附件
@ -218,7 +232,7 @@ public class ZZ_GDFileUploadAction extends BaseBean implements Action, EsbServer
Row[] sq = dtq.getRow();
JSONArray invoiceVOListArr = new JSONArray();
// float totalScale = 0;
if (!"4805".equals(workFlowId)) {
if (!"100003460000004805".equals(workFlowId)) {
// ZWZX-ZZ05-电费电量统计审批流程 测试环境---3770正式环境---4805
for (int j = 0; j < sq.length; j++) {
// 指定行

@ -3,6 +3,7 @@ package com.weaver.seconddev.interfaces.workflow.action;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.weaver.seconddev.interfaces.prop.ConfigProp;
import com.weaver.seconddev.interfaces.workflow.util.DocUtil;
import org.apache.axis.encoding.Base64;
import com.weaver.seconddev.interfaces.swfa.BillFieldUtil;
import java.io.*;
@ -47,6 +48,9 @@ public class ZZ_Ten_GDFileUploadAction extends BaseBean implements Action, EsbSe
private RequestInfo requestInfoTemp;
@Autowired
private ConfigProp configProp;
@Autowired
private DocUtil docUtil;
private static final Logger logger_8ab26152 = LoggerFactory.getLogger(ZZ_Ten_GDFileUploadAction.class);
@Override
@ -73,11 +77,11 @@ public class ZZ_Ten_GDFileUploadAction extends BaseBean implements Action, EsbSe
String ITFID = "HTEFS001";
// 接口账号
// String USERNAME = "htefs";
String USERNAME = "hengtong";
String USERNAME = configProp.getEfsaccount();
// 接口密码
// String PASSWORD = "efs2@2@@9!@HT";
String PASSWORD = "abc,,,123";
String PASSWORD = configProp.getEfspassword();
// 业务属性 6-总账
String businessTag = "6";
// //业务类型 1: 费用类 2; 采购类---1,2是针对报账系统的
@ -160,40 +164,50 @@ public class ZZ_Ten_GDFileUploadAction extends BaseBean implements Action, EsbSe
String[] docs = fileIds.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_core_business.dbo.fileobj b where b.imagefileid in(select max(imagefileid) " + "from e10_core_business.dbo.document_main_access as docimagefile where docid in(" + docid + ") group by docid)";
logger_8ab26152.error("sql -----"+ sql);
String poolname = CONN_TYPE.workflow.getType();
// TODO E10执行sql方法第二参数必须指定源默认使用流程源单体客户无需修改微服务/组合客户需根据查询表所属服务切换源,或使用外部数据源
boolean b1 = rs.executeSql(sql, poolname);
logger_8ab26152.error("sql flag-----"+ b1);
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_8ab26152.error(String.valueOf(requestID + " 附件:" + imagefilename + " " + uploadBuffer.length()));
fileItem.put("imgSeq", (i + 1) + "");
fileItem.put("fileName", imagefilename);
fileItem.put("fileContent", uploadBuffer);
fileItem.put("invoiceNo", "");
logger_8ab26152.error("fileItem == "+fileItem);
fileVOListArr.add(fileItem);
baos.close();
fi.close();
// 这里就可以封装 文件名和文件内容 传给第三方系统
}
// String sql = " select b.filerealpath,b.iszip,b.name,b.imagefileid from " + " e10_core_business.dbo.fileobj b where b.imagefileid in(select max(imagefileid) " + "from e10_core_business.dbo.document_main_access as docimagefile where docid in(" + docid + ") group by docid)";
// logger_8ab26152.error("sql -----"+ sql);
// String poolname = CONN_TYPE.workflow.getType();
// // TODO E10执行sql方法第二参数必须指定源默认使用流程源单体客户无需修改微服务/组合客户需根据查询表所属服务切换源,或使用外部数据源
// boolean b1 = rs.executeSql(sql, poolname);
// logger_8ab26152.error("sql flag-----"+ b1);
// 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_8ab26152.error(String.valueOf(requestID + " 附件:" + imagefilename + " " + uploadBuffer.length()));
// fileItem.put("imgSeq", (i + 1) + "");
// fileItem.put("fileName", imagefilename);
// fileItem.put("fileContent", uploadBuffer);
// fileItem.put("invoiceNo", "");
//
// logger_8ab26152.error("fileItem == "+fileItem);
// fileVOListArr.add(fileItem);
// baos.close();
// fi.close();
// // 这里就可以封装 文件名和文件内容 传给第三方系统
// }
Map<String, String> docInfoWf = docUtil.getDocInfoWf(docid, "t6kj9c07jr");
String uploadBuffer = docInfoWf.get("base64str");
String imagefilename = docInfoWf.get("filename");
logger_8ab26152.error(String.valueOf(requestID + " 附件:" + imagefilename + " " + uploadBuffer.length()));
JSONObject fileItem = new JSONObject();
fileItem.put("imgSeq", (i + 1) + "");
fileItem.put("fileName", imagefilename);
fileItem.put("fileContent", uploadBuffer);
fileItem.put("invoiceNo", "");
fileVOListArr.add(fileItem);
}
}
// DocServiceImpl service = new DocServiceImpl();

@ -0,0 +1,453 @@
package com.weaver.seconddev.interfaces.workflow.util;
import com.weaver.common.hrm.util.HrmContextUtil;
import com.weaver.common.hrm.util.Util;
import com.weaver.common.i18n.tool.util.I18nContextUtil;
import com.weaver.eteams.file.client.file.FileObj;
import com.weaver.eteams.file.client.param.RemoteUploadParam;
import com.weaver.file.ud.api.FileUploadService;
import com.weaver.teams.domain.EntityType;
import com.weaver.teams.domain.user.SimpleEmployee;
import com.weaver.verupgrade.api.doc.detail.service.DocSaveService;
import com.weaver.verupgrade.conn.CONN_TYPE;
import com.weaver.verupgrade.conn.RecordSet;
import org.apache.axis.encoding.Base64;
import org.apache.commons.lang3.ObjectUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import com.weaver.verupgrade.hrm.User;
import org.springframework.stereotype.Service;
import java.io.*;
import java.nio.charset.StandardCharsets;
import java.util.HashMap;
import java.util.Map;
import java.util.zip.ZipInputStream;
/**
* createby jianyong.tang
* createTime
* version v1
* desc
*/
@Service
public class DocUtil {
/**
* 16id
* @param filename
* @param data16
* @param seccategory
* @param createrid
* @return
*/
private final Logger log = LoggerFactory.getLogger(DocUtil.class);
public static byte[] hexStringToByteArray(String s) {
int len = s.length();
byte[] data = new byte[len / 2];
for (int i = 0; i < len; i += 2) {
data[i / 2] = (byte) ((Character.digit(s.charAt(i), 16) << 4)
+ Character.digit(s.charAt(i + 1), 16));
}
return data;
}
public static String hexStringToString(String s) {
if (s == null || s.equals("")) {
return null;
}
s = s.replace(" ", "");
byte[] baKeyword = new byte[s.length() / 2];
for (int i = 0; i < baKeyword.length; i++) {
try {
baKeyword[i] = (byte) (0xff & Integer.parseInt(s.substring(i * 2, i * 2 + 2), 16));
} catch (Exception e) {
e.printStackTrace();
}
}
try {
s = new String(baKeyword, StandardCharsets.UTF_8);
// new String();
} catch (Exception e1) {
e1.printStackTrace();
}
return s;
}
@Autowired
private FileUploadService fileUploadService;
public String createdocByBase642(String filename,String base64Str,String seccategory,String createrid,String tenantKey){
String docid = "";
try {
//DocAccService das = new DocAccService();
RemoteUploadParam remoteUploadParam = new RemoteUploadParam(filename, "", EntityType.document.name());
FileObj fileObj = fileUploadService.uploadLocalFileWithBase64(toSemiangle(base64Str.replace(" ","").replace("\r","")), Long.valueOf(createrid), "", remoteUploadParam);
//long imagefileid = das.getFileByBase64(toSemiangle(base64Str), filename);
long imagefileid = ObjectUtils.isEmpty(fileObj) ? -1L : fileObj.getFileid();
docid=String.valueOf(imagefileid);
// DocSaveService var22 = new DocSaveService();
// if(imagefileid>0){
// RecordSet rs = I18nContextUtil.getBean(RecordSet.class);
// String poolname = CONN_TYPE.hrm.getType();
// rs.setTenantKey(tenantKey);
// String departmentId="-1";
// String sql="SELECT department FROM eteams.dbo.employee WHERE id = '"+createrid+"' AND delete_type = 0 AND tenant_key = '"+tenantKey+"'";
// rs.executeSql(sql, poolname);
// User user = new User();
// if(rs.next()){
// departmentId = Util.null2String(rs.getString("department"));
// }
// user.setUid(Long.valueOf(createrid));
// user.setUserDepartment(Long.valueOf(departmentId));
// user.setLanguage(7);
// user.setLogintype("1");
// user.setLoginip("127.0.0.1");
//
// log.error("seccategory:"+seccategory+"ten:"+HrmContextUtil.getCurrentTenantKey()+" imagefileid:"+imagefileid+" user:"+user.getUID());
// docid=String.valueOf(var22.accForDoc(Long.valueOf(seccategory),imagefileid,user));
// }
//拿到附件id就可以更新到流程表字段
}catch (Exception e){
log.error("e",e);
}
return docid;
}
public String toSemiangle(String src) {
char[] c = src.toCharArray();
for (int index = 0; index < c.length; index++) {
if (c[index] == 12288) {// 全角空格
c[index] = (char) 32;
} else if (c[index] > 65280 && c[index] < 65375) {// 其他全角字符
c[index] = (char) (c[index] - 65248);
}
}
return String.valueOf(c);
}
public Map<String,String> getDocInfo(String docid,String tenantKey) throws Exception {
RecordSet rs = I18nContextUtil.getBean(RecordSet.class);
String poolname = CONN_TYPE.document.getType();
rs.setTenantKey(tenantKey);
Map<String,String> docmap = new HashMap<>();
String uploadBuffer="";//base64字符串
String sql = " select c.file_path ,c.file_url ,b.id as imagefileid,b.size ,b.NAME from e10_core_business.dbo.document a,e10_core_business.dbo.fileobj b,e10_core_business.dbo.file_storage_info c where a.id=b.REF_ID and b.URL =c.file_url " +
"and a.ID ="+docid+" " +
"AND a.delete_type = 0 " +
"AND a.tenant_key = '"+tenantKey+"' " +
"AND b.delete_type = 0 " +
"AND b.tenant_key = '"+tenantKey+"' " +
"AND c.delete_type = 0 " +
"AND c.tenant_key = '"+tenantKey+"';";
rs.executeSql(sql, poolname);
if(rs.next()){
String imagefileid = Util.null2String(rs.getString("imagefileid"));
String filerealpath = Util.null2String(rs.getString("file_path"))+"/"+Util.null2String(rs.getString("file_url"));
String iszip ="1";
String filesize = Util.null2String(rs.getString("size"));
String imagefilename = Util.null2String(rs.getString("NAME"));//文件名
InputStream fi = getFile(filerealpath,iszip);
docmap.put("imagefileid",imagefileid);
docmap.put("filename",imagefilename);
ByteArrayOutputStream baos = new ByteArrayOutputStream();
byte[] buffer = new byte[1024];
int count = 0;
while((count = fi.read(buffer)) >= 0){
baos.write(buffer, 0, count);
}
uploadBuffer = Base64.encode(baos.toByteArray());
docmap.put("base64str",uploadBuffer);
docmap.put("filesize",filesize);
baos.close();
//这里就可以封装 文件名和文件内容 传给第三方系统
}
return docmap;
}
public Map<String,String> getDocInfoWf(String fileid,String tenantKey) throws Exception {
RecordSet rs = I18nContextUtil.getBean(RecordSet.class);
String poolname = CONN_TYPE.document.getType();
rs.setTenantKey(tenantKey);
Map<String,String> docmap = new HashMap<>();
String uploadBuffer="";//base64字符串
String sql = " select c.file_path ,c.file_url ,b.id as imagefileid,b.size ,b.NAME from e10_core_business.dbo.fileobj b,e10_core_business.dbo.file_storage_info c where b.URL =c.file_url " +
"and b.ID ="+fileid+" " +
"AND b.delete_type = 0 " +
"AND b.tenant_key = '"+tenantKey+"' " +
"AND c.delete_type = 0 " +
"AND c.tenant_key = '"+tenantKey+"';";
rs.executeSql(sql, poolname);
if(rs.next()){
String imagefileid = Util.null2String(rs.getString("imagefileid"));
String filerealpath = Util.null2String(rs.getString("file_path"))+"/"+Util.null2String(rs.getString("file_url"));
String iszip ="1";
String filesize = Util.null2String(rs.getString("size"));
String imagefilename = Util.null2String(rs.getString("NAME"));//文件名
InputStream fi = getFile(filerealpath,iszip);
docmap.put("imagefileid",imagefileid);
docmap.put("filename",imagefilename);
ByteArrayOutputStream baos = new ByteArrayOutputStream();
byte[] buffer = new byte[1024];
int count = 0;
while((count = fi.read(buffer)) >= 0){
baos.write(buffer, 0, count);
}
uploadBuffer = Base64.encode(baos.toByteArray());
docmap.put("base64str",uploadBuffer);
docmap.put("filesize",filesize);
baos.close();
//这里就可以封装 文件名和文件内容 传给第三方系统
}
return docmap;
}
/**
*
* @param filerealpath
* @param iszip
* @return
* @throws Exception
*/
private InputStream getFile(String filerealpath, String iszip)
throws Exception {
ZipInputStream zin = null;
InputStream imagefile = null;
File thefile = new File(filerealpath);
if (iszip.equals("1")) {
zin = new ZipInputStream(new FileInputStream(thefile));
if (zin.getNextEntry() != null)
imagefile = new BufferedInputStream(zin);
} else {
imagefile = new BufferedInputStream(new FileInputStream(thefile));
}
return imagefile;
}
public String getShareRyids(String wdid,String tenantKey){
StringBuffer ryids = new StringBuffer();
if("".equals(wdid)){
return "";
}
RecordSet rs = I18nContextUtil.getBean(RecordSet.class);
String poolname = CONN_TYPE.document.getType();
rs.setTenantKey(tenantKey);
RecordSet rs_dt = I18nContextUtil.getBean(RecordSet.class);
rs_dt.setTenantKey(tenantKey);
String typeids = "";
String flag = "";
String sql_dt = "";
String sql = "select distinct target_type from e10_core_business.dbo.document_ph_doc_s01 where source_id="+wdid+" and delete_type=0 and tenant_key ='"+tenantKey+"'";
rs.executeSql(sql, poolname);
while (rs.next()){
String type = Util.null2String(rs.getString("target_type"));
typeids = typeids + flag +type;
flag = ",";
}
poolname = CONN_TYPE.hrm.getType();
typeids = ","+typeids+",";
log.error(typeids);
flag = "";
if(typeids.indexOf(",11,")>=0){//所有人
String seclevel = "";
String seclevelmax = "";
sql = "select target_min_sec_level ,target_max_sec_level from e10_core_business.dbo.document_ph_doc_s01 where source_id="+wdid+" and delete_type=0 and tenant_key ='"+tenantKey+"' and target_type=11";
rs.executeSql(sql, CONN_TYPE.document.getType());
if(rs.next()){
seclevel = Util.null2String(rs.getString("target_min_sec_level"));
seclevelmax = Util.null2String(rs.getString("target_max_sec_level"));
}
sql = "select id from eteams.dbo.employee WHERE PERSONNEL_STATUS <6 and sec_level>="+seclevel+" and sec_level<="+seclevelmax +" AND delete_type = 0 AND tenant_key = '"+tenantKey+"'";
rs.executeSql(sql, poolname);
while (rs.next()){
ryids.append(flag).append(rs.getString("id"));
flag = ",";
}
}
if(typeids.indexOf(",5,")>=0 || typeids.indexOf(",501,")>=0){//分部
String seclevel = "";
String seclevelmax = "";
String subcomid = "";
sql = "select target_min_sec_level ,target_max_sec_level,target_id from e10_core_business.dbo.document_ph_doc_s01 where source_id="+wdid+" and delete_type=0 and tenant_key ='"+tenantKey+"' and target_type in(5,501)";
rs.executeSql(sql,CONN_TYPE.document.getType());
while (rs.next()){
seclevel = Util.null2String(rs.getString("target_min_sec_level"));
seclevelmax = Util.null2String(rs.getString("target_max_sec_level"));
subcomid = Util.null2String(rs.getString("target_id"));
if("".equals(subcomid)){
continue;
}
sql_dt = "SELECT a.id FROM eteams.dbo.employee a,eteams.dbo.department b WHERE a.DEPARTMENT =b.id and b.subcompanyid ='"+subcomid+"' and PERSONNEL_STATUS <6 and sec_level>="+seclevel+" and sec_level<="+seclevelmax +" AND a.delete_type = 0 AND a.tenant_key = '"+tenantKey+"'";
rs_dt.executeSql(sql_dt,poolname);
while (rs_dt.next()){
ryids.append(flag).append(rs_dt.getString("id"));
flag = ",";
}
}
}
if(typeids.indexOf(",6,")>=0 || typeids.indexOf(",502,")>=0){//分部下级
String seclevel = "";
String seclevelmax = "";
String subcomid = "";
sql = "select target_min_sec_level ,target_max_sec_level,target_id from e10_core_business.dbo.document_ph_doc_s01 where source_id="+wdid+" and delete_type=0 and tenant_key ='"+tenantKey+"' and target_type in(6,502)";
rs.executeSql(sql,CONN_TYPE.document.getType());
while (rs.next()){
seclevel = Util.null2String(rs.getString("target_min_sec_level"));
seclevelmax = Util.null2String(rs.getString("target_max_sec_level"));
subcomid = Util.null2String(rs.getString("target_id"));
if("".equals(subcomid)){
continue;
}
String comids = "";
String flag1 = "";
sql_dt = "WITH allsub(id,name,parent) " +
"as ( " +
"SELECT id,name ,parent FROM eteams.dbo.department where id in("+subcomid+") and type = 'subcompany' AND virtualid = 1 and STATUS =1 AND delete_type = 0 AND tenant_key = '"+tenantKey+"' " +
" UNION ALL SELECT a.id,a.name,a.parent FROM eteams.dbo.department a,allsub b where a.parent = b.id and type = 'subcompany' AND virtualid = 1 and STATUS =1 AND delete_type = 0 AND tenant_key = '"+tenantKey+"' " +
") select id from allsub";
rs_dt.executeSql(sql_dt,poolname);
while (rs_dt.next()){
comids = comids + flag1 +rs_dt.getString("id");
flag1 = ",";
}
sql_dt = "SELECT a.id FROM eteams.dbo.employee a,eteams.dbo.department b WHERE a.DEPARTMENT =b.id and b.subcompanyid in("+comids+") and PERSONNEL_STATUS <6 and sec_level>="+seclevel+" and sec_level<="+seclevelmax +" AND a.delete_type = 0 AND a.tenant_key = '"+tenantKey+"'";
rs_dt.executeSql(sql_dt,poolname);
while (rs_dt.next()){
ryids.append(flag).append(rs_dt.getString("id"));
flag = ",";
}
}
}
if(typeids.indexOf(",2,")>=0||typeids.indexOf(",2002,")>=0){//部门
String seclevel = "";
String seclevelmax = "";
String deptid = "";
sql = "select target_min_sec_level ,target_max_sec_level,target_id from e10_core_business.dbo.document_ph_doc_s01 where source_id="+wdid+" and delete_type=0 and tenant_key ='"+tenantKey+"' and target_type in(2,2002)";
rs.executeSql(sql,CONN_TYPE.document.getType());
while (rs.next()){
seclevel = Util.null2String(rs.getString("target_min_sec_level"));
seclevelmax = Util.null2String(rs.getString("target_max_sec_level"));
deptid = Util.null2String(rs.getString("target_id"));
if("".equals(deptid)){
continue;
}
sql_dt = "SELECT a.id FROM eteams.dbo.employee a WHERE a.DEPARTMENT ='"+deptid+"' and PERSONNEL_STATUS <6 and sec_level>="+seclevel+" and sec_level<="+seclevelmax +" AND delete_type = 0 AND tenant_key = '"+tenantKey+"'";
rs_dt.executeSql(sql_dt,poolname);
while (rs_dt.next()){
ryids.append(flag).append(rs_dt.getString("id"));
flag = ",";
}
}
}
if(typeids.indexOf(",3,")>=0 || typeids.indexOf(",3002,")>=0){//部门含下级
String seclevel = "";
String seclevelmax = "";
String deptid = "";
sql = "select target_min_sec_level ,target_max_sec_level,target_id from e10_core_business.dbo.document_ph_doc_s01 where source_id="+wdid+" and delete_type=0 and tenant_key ='"+tenantKey+"' and target_type in(3,3002)";
rs.executeSql(sql,CONN_TYPE.document.getType());
while (rs.next()){
seclevel = Util.null2String(rs.getString("target_min_sec_level"));
seclevelmax = Util.null2String(rs.getString("target_max_sec_level"));
deptid = Util.null2String(rs.getString("target_id"));
if("".equals(deptid)){
continue;
}
String deptids = "";
String flag1 = "";
sql_dt = "WITH allsub(id,name,parent) " +
"as ( " +
"SELECT id,name ,parent FROM eteams.dbo.department where id in("+deptid+") and type = 'department' AND virtualid = 1 and STATUS =1 AND delete_type = 0 AND tenant_key = '"+tenantKey+"' " +
" UNION ALL SELECT a.id,a.name,a.parent FROM eteams.dbo.department a,allsub b where a.parent = b.id and type = 'department' AND virtualid = 1 and STATUS =1 AND delete_type = 0 AND tenant_key = '"+tenantKey+"' " +
") select id from allsub";
rs_dt.executeSql(sql_dt,poolname);
while (rs_dt.next()){
deptids = deptids + flag1 +rs_dt.getString("id");
flag1 = ",";
}
sql_dt = "SELECT a.id FROM eteams.dbo.employee a WHERE a.DEPARTMENT in("+deptids+") and PERSONNEL_STATUS <6 and sec_level>="+seclevel+" and sec_level<="+seclevelmax +" AND delete_type = 0 AND tenant_key = '"+tenantKey+"'";
log.error(sql_dt);
rs_dt.executeSql(sql_dt,poolname);
while (rs_dt.next()){
ryids.append(flag).append(rs_dt.getString("id"));
flag = ",";
}
}
}
if(typeids.indexOf(",1,")>=0){//人员
String ryid = "";
sql = "select target_id from e10_core_business.dbo.document_ph_doc_s01 where source_id="+wdid+" and delete_type=0 and tenant_key ='"+tenantKey+"' and target_type in(1)";
rs.executeSql(sql,CONN_TYPE.document.getType());
while (rs.next()){
ryid = Util.null2String(rs.getString("target_id"));
if("".equals(ryid)){
continue;
}
ryids.append(flag).append(ryid);
flag = ",";
}
}
if(typeids.indexOf(",10,")>=0){//角色 人员
String seclevel = "";
String seclevelmax = "";
String roleid = "";
sql = "select target_min_sec_level ,target_max_sec_level,target_id from e10_core_business.dbo.document_ph_doc_s01 where source_id="+wdid+" and delete_type=0 and tenant_key ='"+tenantKey+"' and target_type in(10)";
rs.executeSql(sql,CONN_TYPE.document.getType());
while (rs.next()){
seclevel = Util.null2String(rs.getString("target_min_sec_level"));
seclevelmax = Util.null2String(rs.getString("target_max_sec_level"));
roleid = Util.null2String(rs.getString("target_id"));
if("".equals(roleid)){
continue;
}
sql_dt = "SELECT a.id FROM eteams.dbo.employee a where id in(SELECT user_id FROM eteams.dbo.auth_user_role WHERE role_id = "+roleid+" AND resource_type = 'RESOURCE' AND delete_type = 0 AND tenant_key = '"+tenantKey+"' ) and PERSONNEL_STATUS <6 and sec_level>="+seclevel+" and sec_level<="+seclevelmax;
rs_dt.executeSql(sql_dt,poolname);
while (rs_dt.next()){
ryids.append(flag).append(rs_dt.getString("id"));
flag = ",";
}
}
}
if(typeids.indexOf(",1411,")>=0){//群组
String seclevel = "";
String seclevelmax = "";
String groupid = "";
sql = "select target_min_sec_level ,target_max_sec_level,target_id from e10_core_business.dbo.document_ph_doc_s01 where source_id="+wdid+" and delete_type=0 and tenant_key ='"+tenantKey+"' and target_type in(1411)";
rs.executeSql(sql,CONN_TYPE.document.getType());
while (rs.next()){
seclevel = Util.null2String(rs.getString("target_min_sec_level"));
seclevelmax = Util.null2String(rs.getString("target_max_sec_level"));
groupid = Util.null2String(rs.getString("target_id"));
if("".equals(groupid)){
continue;
}
sql_dt = "SELECT a.id FROM eteams.dbo.employee a where id in(SELECT employee FROM eteams.dbo.channel_user_link where channel="+groupid+" and delete_type=0) and PERSONNEL_STATUS <6 and sec_level>="+seclevel+" and sec_level<="+seclevelmax;
rs_dt.executeSql(sql_dt,poolname);
while (rs_dt.next()){
ryids.append(flag).append(rs_dt.getString("id"));
flag = ",";
}
}
}
return ryids.toString();
}
}

@ -252,85 +252,89 @@ public class AutoCreateWorkflowService {
for (int i = 0; i < detailTables.length; i++) {
JSONArray innerArray = JSONArray.parseArray(detailTables[i]); // 获取内部的 JSONArray
log.error("innerArray:"+innerArray);
//判断明细表id是否存在
if (detailFormId.size() < i+1) {
log.error("明细表"+(i+1)+"form_id未找到或不存在");
return "明细表"+(i+1)+"form_id未找到或不存在";
}
Long subFormId = detailFormId.get(i);
log.error("明细表"+(i+1)+"form_id"+subFormId);
// 遍历内部 JSONArray
for (int j = 0; j < innerArray.size(); j++) {
JSONObject jsonDetail = innerArray.getJSONObject(j);
Long optionId = null;
// 遍历 JSONObject 的键值对
for (String key : jsonDetail.keySet()) {
FormDataDuty formDataDuty = FormDataDuty.builder().build();
String value = jsonDetail.getString(key);
if (!"".equals(key)) {
if(key.contains("hrm:")){
//判断人力资源字段工号是否正确 (todo)
optionId = getIdByWorkcode(value,createTenantKey);
if(optionId == null) {
return "工号为空或不存在";
}
key = key.replace("hrm:", "");
formDataDuty.setDataKey(key);
formDataDuty.setDataIndex((long) (j + 1));
formDataDuty.setSubFormId(subFormId);
DataOptions options = DataOptions.builder().optionId(optionId).build();
List<DataOptions> dataOptions = new ArrayList();
dataOptions.add(options);
formDataDuty.setDataOptions(dataOptions);
} else if (key.contains("com:") || key.contains("dep:")) { //e10 分部部门同一个字段
if(key.split(":").length != 3){
return "明细表表字段名"+key+"不符合规则...";
}
String str2 = key.split(":")[1];//关联人力资源字段
String str3 = key.split(":")[2];//当前字段
if(mainMap.get("hrm:"+str2) != null){
String hrmResource = (String) mainMap.get("hrm:"+str2);
Long id = getIdByWorkcode(hrmResource,createTenantKey);
SimpleEmployee simpleEmployee = hrmCommonUtil.getSimpleEmployee(id);
optionId = simpleEmployee.getDepartmentId();
if (key.contains("com:")) {
optionId = Long.valueOf(departmentComInfo.getSubcompanyid1(String.valueOf(optionId)));
if(innerArray.size()>0){
//判断明细表id是否存在
if (detailFormId.size() < i+1) {
log.error("明细表"+(i+1)+"form_id未找到或不存在");
return "明细表"+(i+1)+"form_id未找到或不存在";
}
Long subFormId = detailFormId.get(i);
log.error("明细表"+(i+1)+"form_id"+subFormId);
// 遍历内部 JSONArray
for (int j = 0; j < innerArray.size(); j++) {
JSONObject jsonDetail = innerArray.getJSONObject(j);
Long optionId = null;
// 遍历 JSONObject 的键值对
for (String key : jsonDetail.keySet()) {
FormDataDuty formDataDuty = FormDataDuty.builder().build();
String value = jsonDetail.getString(key);
if (!"".equals(key)) {
if(key.contains("hrm:")){
//判断人力资源字段工号是否正确 (todo)
optionId = getIdByWorkcode(value,createTenantKey);
if(optionId == null) {
return "工号为空或不存在";
}
key = str3;
key = key.replace("hrm:", "");
formDataDuty.setDataKey(key);
formDataDuty.setDataIndex((long) (j + 1));
formDataDuty.setSubFormId(subFormId);
DataOptions options = DataOptions.builder().optionId(optionId).build();
List<DataOptions> dataOptions = new ArrayList();
dataOptions.add(options);
formDataDuty.setDataOptions(dataOptions);
}else{
return "明细字段"+key+"不包含关联字段" ;
}
}else {
} else if (key.contains("com:") || key.contains("dep:")) { //e10 分部部门同一个字段
if(key.split(":").length != 3){
return "明细表表字段名"+key+"不符合规则...";
}
String str2 = key.split(":")[1];//关联人力资源字段
String str3 = key.split(":")[2];//当前字段
if(mainMap.get("hrm:"+str2) != null){
String hrmResource = (String) mainMap.get("hrm:"+str2);
Long id = getIdByWorkcode(hrmResource,createTenantKey);
SimpleEmployee simpleEmployee = hrmCommonUtil.getSimpleEmployee(id);
optionId = simpleEmployee.getDepartmentId();
if (key.contains("com:")) {
optionId = Long.valueOf(departmentComInfo.getSubcompanyid1(String.valueOf(optionId)));
}
key = str3;
formDataDuty.setDataKey(key);
formDataDuty.setDataIndex((long) (j + 1));
formDataDuty.setSubFormId(subFormId);
DataOptions options = DataOptions.builder().optionId(optionId).build();
List<DataOptions> dataOptions = new ArrayList();
dataOptions.add(options);
formDataDuty.setDataOptions(dataOptions);
}else{
return "明细字段"+key+"不包含关联字段" ;
}
}else {
// log.error("明细表普通字段值:"+value);
if(StringUtils.isNotEmpty(value)){
formDataDuty.setDataKey(key);
formDataDuty.setDataIndex((long) (j + 1));
formDataDuty.setContent(value);
//目前写死 后续在找方法
formDataDuty.setSubFormId(subFormId);
}else{
if(StringUtils.isNotEmpty(value)){
formDataDuty.setDataKey(key);
formDataDuty.setDataIndex((long) (j + 1));
formDataDuty.setContent(value);
//目前写死 后续在找方法
formDataDuty.setSubFormId(subFormId);
}else{
// log.error("明细表普通字段值为空");
}
}
}
formDataDutyList.add(formDataDuty);
}
formDataDutyList.add(formDataDuty);
}
}
}
}
log.error("formDataDutyList数据"+formDataDutyList.size()+"-"+formDataDutyList);

Loading…
Cancel
Save