2026-02-26通用流程集成功能demo上传
This commit is contained in:
@@ -173,7 +173,7 @@ public class TongYongFileNode extends ACommonSuperNode {
|
||||
jsonObject.put("billno", billno);
|
||||
jsonObject.put("code", "FJ01");
|
||||
jsonObject.put("fileList", jsonArray);
|
||||
System.out.println(jsonObject);
|
||||
log.info("推送附件报文:"+jsonObject);
|
||||
JSONObject res = ProtUtil.doPost(jsonObject, PropKit.getProp(PropKit.PAYBILLFILEURL), headerer);
|
||||
String isStatus = res.get("status").toString();
|
||||
if("1".equals(isStatus)) {
|
||||
|
||||
@@ -1,54 +1,49 @@
|
||||
package com.seeyon.apps.src_contract.lease.node;
|
||||
|
||||
import cn.hutool.log.Log;
|
||||
import com.seeyon.apps.common.config.ICstConfigApi;
|
||||
import com.seeyon.apps.common.plugin.vo.ConfigVo;
|
||||
import com.seeyon.apps.common.workflow.constants.WorkFlowType;
|
||||
import com.seeyon.apps.common.workflow.node.ACommonSuperNode;
|
||||
import java.util.Map;
|
||||
|
||||
import com.seeyon.apps.src_contract.lease.param.LeaseContractParam;
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.seeyon.apps.ext.workflow.vo.FormDataVo;
|
||||
import com.seeyon.apps.ext.workflow.vo.SuperNodeContext;
|
||||
import com.seeyon.apps.src_contract.lease.constants.ContractConstants;
|
||||
import com.seeyon.apps.src_contract.lease.kit.PropKit;
|
||||
import com.seeyon.apps.src_contract.lease.param.LeaseContractParam;
|
||||
import com.seeyon.apps.src_contract.lease.kit.form.CAP4FormKit;
|
||||
import com.seeyon.apps.src_contract.lease.util.HeaderUtil;
|
||||
import com.seeyon.apps.src_contract.lease.util.ProtUtil;
|
||||
import com.seeyon.cap4.form.api.FormDataApi4Cap4;
|
||||
import com.seeyon.cap4.form.bean.FormDataMasterBean;
|
||||
import com.seeyon.ctp.common.AppContext;
|
||||
import com.seeyon.ctp.common.ctpenumnew.manager.EnumManager;
|
||||
import com.seeyon.ctp.common.exceptions.BusinessException;
|
||||
import com.seeyon.ctp.workflow.supernode.BaseSuperNodeAction;
|
||||
import com.seeyon.ctp.workflow.supernode.SuperNodeResponse;
|
||||
import com.seeyon.ctp.workflow.supernode.enums.SuperNodeEnums.RunAction;
|
||||
import com.seeyon.v3x.services.form.FormFactory;
|
||||
|
||||
public class LeaseContractTerminationNode extends ACommonSuperNode {
|
||||
public class LeaseContractTerminationNode extends BaseSuperNodeAction {
|
||||
|
||||
private static final Log log = Log.get(LeaseContractTerminationNode.class);
|
||||
protected ICstConfigApi cstConfigApi = (ICstConfigApi) AppContext.getBean("cstConfigApi");
|
||||
@Override
|
||||
public String getNodeId() {
|
||||
return "leaseContractTerminationNode";
|
||||
private static final Log log = LogFactory.getLog(LeaseContractTerminationNode.class);
|
||||
private FormFactory formFactory;
|
||||
|
||||
public FormFactory getFormFactory() {
|
||||
if (formFactory == null) {
|
||||
formFactory = (FormFactory) AppContext.getBean("formFactory");
|
||||
}
|
||||
return formFactory;
|
||||
}
|
||||
@Override
|
||||
public String getNodeName() {
|
||||
return "OA合同终止同步BIP合同终止状态超级节点";
|
||||
}
|
||||
@Override
|
||||
public String getPluginId() {
|
||||
return ContractConstants.getPluginId();
|
||||
}
|
||||
@Override
|
||||
public String getFormParse() {
|
||||
return "json";
|
||||
}
|
||||
public ConfigVo getContractConfig() {
|
||||
return cstConfigApi.getConfig(getPluginId());
|
||||
}
|
||||
@Override
|
||||
public WorkFlowType[] getTypes() {
|
||||
return new WorkFlowType[] {WorkFlowType.superNode};
|
||||
protected FormDataApi4Cap4 formDataApi4Cap4;
|
||||
|
||||
public void setFormDataApi4Cap4(FormDataApi4Cap4 formDataApi4Cap4) {
|
||||
this.formDataApi4Cap4 = formDataApi4Cap4;
|
||||
}
|
||||
|
||||
private EnumManager enumManagerNew;
|
||||
|
||||
public void setEnumManagerNew(EnumManager enumManagerNew) {
|
||||
this.enumManagerNew = enumManagerNew;
|
||||
}
|
||||
|
||||
public EnumManager getEnumManagerNew() {
|
||||
if (enumManagerNew == null) {
|
||||
enumManagerNew = (EnumManager) AppContext.getBean("enumManagerNew");
|
||||
@@ -57,80 +52,258 @@ public class LeaseContractTerminationNode extends ACommonSuperNode {
|
||||
}
|
||||
|
||||
@Override
|
||||
public SuperNodeContext proceed(String request, FormDataVo formDataVo, FormDataMasterBean formDataMasterBean) throws Exception {
|
||||
// 进入超级审核节点
|
||||
log.info("进入流程"+getNodeId());
|
||||
ConfigVo configVo = getContractConfig();
|
||||
SuperNodeContext context = new SuperNodeContext();
|
||||
context.setNeedSave(true);
|
||||
// String bipfhjg = CAP4FormKit.getFieldStrValue(master, "BIP返回结果");
|
||||
String bipfhjg = formDataVo.getFieldData("BIP返回结果")!=null?formDataVo.getFieldData("BIP返回结果").getStringValue():"";
|
||||
if(bipfhjg.contains("成功")){
|
||||
context.success("跳过:"+bipfhjg);
|
||||
formDataVo.getNewFieldDataMap().put("BIP返回结果", "跳过:"+bipfhjg);
|
||||
return context;
|
||||
public void cancelAction(String token, String activityId, Map<String, Object> params) throws BusinessException {
|
||||
}
|
||||
/**
|
||||
* 节点动作撤销。
|
||||
*/
|
||||
public void cancelAction(String token, String activityId) {
|
||||
System.out.println("撤销");
|
||||
}
|
||||
|
||||
@Override
|
||||
public SuperNodeResponse confirmAction(String token, String activityId, Map<String, Object> params)
|
||||
throws BusinessException {
|
||||
return executeAction(token, activityId, params);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SuperNodeResponse executeAction(String token, String activityId, Map<String, Object> params)
|
||||
throws BusinessException {
|
||||
//进入超级审核节点
|
||||
SuperNodeResponse response = new SuperNodeResponse();
|
||||
System.out.println("开始处理单据");
|
||||
Map<String, Object> data = getFormData(params);
|
||||
FormDataMasterBean master = (FormDataMasterBean) data.get("formDataBean");
|
||||
String bipfhjg = CAP4FormKit.getFieldStrValue(master, "BIP返回结果");
|
||||
if (bipfhjg.contains("推送BIP合同终止状态成功")) {
|
||||
CAP4FormKit.setCellValue(master, "BIP返回结果", "跳过:" + bipfhjg);
|
||||
response.setReturnCode(RunAction.FORWARD.getKey());
|
||||
response.setSuccess(true);
|
||||
response.setReturnMsg("跳过:" + bipfhjg);
|
||||
response.setAddComment(false);
|
||||
return response;
|
||||
}
|
||||
try {
|
||||
// String contractType = CAP4FormKit.getFieldStrValue(master, "合同类型文本");
|
||||
String contractType = formDataVo.getFieldData("合同类型文本")!=null?formDataVo.getFieldData("合同类型文本").getStringValue():"";
|
||||
String contractType = CAP4FormKit.getFieldStrValue(master, "合同类型文本");
|
||||
LeaseContractParam leaseContractParam = new LeaseContractParam();
|
||||
JSONObject headerer = HeaderUtil.getHeader();
|
||||
System.out.println(headerer);
|
||||
// System.out.println(headerer);
|
||||
JSONObject res = new JSONObject();
|
||||
String url = "";
|
||||
if("租赁合同".equals(contractType)) {
|
||||
url = PropKit.getProp(PropKit.LEASRTERMINATIONURL);
|
||||
context.setUrl(url);
|
||||
JSONObject jsonObject = leaseContractParam.getLeaseContractTerminationParam(formDataVo);
|
||||
context.setRequest(jsonObject.toString());
|
||||
res = ProtUtil.doPost(jsonObject, url, headerer);
|
||||
context.setResponse(res.toString());
|
||||
JSONObject jsonObject = leaseContractParam.getLeaseContractTerminationParam(master);
|
||||
res = ProtUtil.doPost(jsonObject, PropKit.getProp(PropKit.LEASRTERMINATIONURL), headerer);
|
||||
}else if ("一般付款合同".equals(contractType)){
|
||||
url = PropKit.getProp(PropKit.LEASRTERMINATIONFKURL);
|
||||
context.setUrl(url);
|
||||
JSONObject jsonObject = leaseContractParam.getfkContractTerminationParam(formDataVo);
|
||||
context.setRequest(jsonObject.toString());
|
||||
res = ProtUtil.doPost(jsonObject, url, headerer);
|
||||
context.setResponse(res.toString());
|
||||
JSONObject jsonObject = leaseContractParam.getfkContractTerminationParam(master);
|
||||
res = ProtUtil.doPost(jsonObject, PropKit.getProp(PropKit.LEASRTERMINATIONFKURL), headerer);
|
||||
}else if("一般合同".equals(contractType)) {
|
||||
url = PropKit.getProp(PropKit.LEASRTERMINATIONURL);
|
||||
context.setUrl(url);
|
||||
JSONObject jsonObject = leaseContractParam.getskContractTerminationParam(formDataVo);
|
||||
context.setRequest(jsonObject.toString());
|
||||
res = ProtUtil.doPost(jsonObject, url, headerer);
|
||||
context.setResponse(res.toString());
|
||||
JSONObject jsonObject = leaseContractParam.getskContractTerminationParam(master);
|
||||
res = ProtUtil.doPost(jsonObject, PropKit.getProp(PropKit.LEASRTERMINATIONURL), headerer);
|
||||
}else{
|
||||
response.setReturnCode(RunAction.BACK.getKey());
|
||||
response.setSuccess(false);
|
||||
response.setReturnMsg("请检查数据是否正确");
|
||||
response.setAddComment(false);
|
||||
log.info("请检查数据是否正确");
|
||||
context.back("请检查数据是否正确");
|
||||
context.setResponse("请检查数据是否正确");
|
||||
context.setErrMsg("请检查数据是否正确");
|
||||
return context;
|
||||
return response;
|
||||
}
|
||||
if(res.isEmpty()) {
|
||||
response.setReturnCode(RunAction.BACK.getKey());
|
||||
response.setSuccess(false);
|
||||
response.setReturnMsg("合同终止状态失败,请联系管理员处理");
|
||||
response.setAddComment(false);
|
||||
log.info("合同终止状态失败,请联系管理员处理");
|
||||
context.back("合同终止状态失败,请联系管理员处理");
|
||||
context.setResponse("合同终止状态失败,请联系管理员处理");
|
||||
context.setErrMsg("合同终止状态失败,请联系管理员处理");
|
||||
}else {
|
||||
String isStatus = res.get("status").toString();
|
||||
String msg = res.get("msg").toString();
|
||||
if("1".equals(isStatus)) {
|
||||
CAP4FormKit.setCellValue(master, "BIP返回结果", "推送BIP合同终止状态成功:"+res.get("msg"));
|
||||
// System.out.println("推送BIP合同终止状态成功");
|
||||
log.info("推送BIP合同终止状态成功");
|
||||
context.success(msg);
|
||||
formDataVo.getNewFieldDataMap().put("BIP返回结果", res.get("msg"));
|
||||
response.setReturnCode(RunAction.FORWARD.getKey());
|
||||
response.setSuccess(true);
|
||||
response.setReturnMsg(msg);
|
||||
response.setAddComment(false);
|
||||
}else {
|
||||
CAP4FormKit.setCellValue(master, "BIP返回结果", "推送BIP合同终止状态失败:"+res.get("msg").toString());
|
||||
response.setReturnCode(RunAction.BACK.getKey());
|
||||
response.setSuccess(false);
|
||||
response.setReturnMsg(msg);
|
||||
response.setAddComment(false);
|
||||
log.info("推送BIP合同终止状态失败:"+res.get("msg").toString());
|
||||
context.back(msg);
|
||||
formDataVo.getNewFieldDataMap().put("BIP返回结果", "推送BIP合同终止状态失败:"+res.get("msg").toString());
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error("异常:"+ e);
|
||||
response.setReturnCode(RunAction.BACK.getKey());
|
||||
response.setSuccess(false);
|
||||
response.setReturnMsg("异常:"+ e);
|
||||
response.setAddComment(false);
|
||||
CAP4FormKit.setCellValue(master, "BIP返回结果", "推送BIP合同终止状态失败:"+e);
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
log.info("异常:"+ e);
|
||||
context.back("异常:"+ e);
|
||||
formDataVo.getNewFieldDataMap().put("BIP返回结果", "推送BIP合同终止状态失败:"+e);
|
||||
}
|
||||
return context;
|
||||
formDataApi4Cap4.insertOrUpdateMasterData(master, false);
|
||||
return response;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getNodeId() {
|
||||
return "leaseContractTerminationNode";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getNodeName() {
|
||||
return "OA合同终止同步BIP合同终止状态超级节点";
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getOrder() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取表单数据
|
||||
* @param params
|
||||
* @return
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
private Map<String, Object> getFormData(Map<String, Object> params) {
|
||||
return (Map<String, Object>) params.get("CTP_FORM_DATA");
|
||||
}
|
||||
|
||||
|
||||
//import cn.hutool.log.Log;
|
||||
//import com.seeyon.apps.common.config.ICstConfigApi;
|
||||
//import com.seeyon.apps.common.plugin.vo.ConfigVo;
|
||||
//import com.seeyon.apps.common.workflow.constants.WorkFlowType;
|
||||
//import com.seeyon.apps.common.workflow.node.ACommonSuperNode;
|
||||
//
|
||||
//import com.alibaba.fastjson.JSONObject;
|
||||
//import com.seeyon.apps.ext.workflow.vo.FormDataVo;
|
||||
//import com.seeyon.apps.ext.workflow.vo.SuperNodeContext;
|
||||
//import com.seeyon.apps.src_contract.lease.constants.ContractConstants;
|
||||
//import com.seeyon.apps.src_contract.lease.kit.PropKit;
|
||||
//import com.seeyon.apps.src_contract.lease.param.LeaseContractParam;
|
||||
//import com.seeyon.apps.src_contract.lease.util.HeaderUtil;
|
||||
//import com.seeyon.apps.src_contract.lease.util.ProtUtil;
|
||||
//import com.seeyon.cap4.form.bean.FormDataMasterBean;
|
||||
//import com.seeyon.ctp.common.AppContext;
|
||||
//import com.seeyon.ctp.common.ctpenumnew.manager.EnumManager;
|
||||
//
|
||||
//public class LeaseContractTerminationNode extends ACommonSuperNode {
|
||||
//
|
||||
// private static final Log log = Log.get(LeaseContractTerminationNode.class);
|
||||
// protected ICstConfigApi cstConfigApi = (ICstConfigApi) AppContext.getBean("cstConfigApi");
|
||||
// @Override
|
||||
// public String getNodeId() {
|
||||
// return "leaseContractTerminationNode";
|
||||
// }
|
||||
// @Override
|
||||
// public String getNodeName() {
|
||||
// return "OA合同终止同步BIP合同终止状态超级节点";
|
||||
// }
|
||||
// @Override
|
||||
// public String getPluginId() {
|
||||
// return ContractConstants.getPluginId();
|
||||
// }
|
||||
// @Override
|
||||
// public String getFormParse() {
|
||||
// return "json";
|
||||
// }
|
||||
// public ConfigVo getContractConfig() {
|
||||
// return cstConfigApi.getConfig(getPluginId());
|
||||
// }
|
||||
// @Override
|
||||
// public WorkFlowType[] getTypes() {
|
||||
// return new WorkFlowType[] {WorkFlowType.superNode};
|
||||
// }
|
||||
// private EnumManager enumManagerNew;
|
||||
// public void setEnumManagerNew(EnumManager enumManagerNew) {
|
||||
// this.enumManagerNew = enumManagerNew;
|
||||
// }
|
||||
// public EnumManager getEnumManagerNew() {
|
||||
// if (enumManagerNew == null) {
|
||||
// enumManagerNew = (EnumManager) AppContext.getBean("enumManagerNew");
|
||||
// }
|
||||
// return enumManagerNew;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public SuperNodeContext proceed(String request, FormDataVo formDataVo, FormDataMasterBean formDataMasterBean) throws Exception {
|
||||
//// 进入超级审核节点
|
||||
// log.info("进入流程"+getNodeId());
|
||||
// ConfigVo configVo = getContractConfig();
|
||||
// SuperNodeContext context = new SuperNodeContext();
|
||||
// context.setNeedSave(true);
|
||||
//// String bipfhjg = CAP4FormKit.getFieldStrValue(master, "BIP返回结果");
|
||||
// String bipfhjg = formDataVo.getFieldData("BIP返回结果")!=null?formDataVo.getFieldData("BIP返回结果").getStringValue():"";
|
||||
// if(bipfhjg.contains("推送BIP合同终止状态成功")){
|
||||
// context.success("跳过:"+bipfhjg);
|
||||
// formDataVo.getNewFieldDataMap().put("BIP返回结果", "跳过:"+bipfhjg);
|
||||
// return context;
|
||||
// }
|
||||
// try {
|
||||
//// String contractType = CAP4FormKit.getFieldStrValue(master, "合同类型文本");
|
||||
// String contractType = formDataVo.getFieldData("合同类型文本")!=null?formDataVo.getFieldData("合同类型文本").getStringValue():"";
|
||||
// LeaseContractParam leaseContractParam = new LeaseContractParam();
|
||||
// JSONObject headerer = HeaderUtil.getHeader();
|
||||
// System.out.println(headerer);
|
||||
// JSONObject res = new JSONObject();
|
||||
// String url = "";
|
||||
// if("租赁合同".equals(contractType)) {
|
||||
// url = PropKit.getProp(PropKit.LEASRTERMINATIONURL);
|
||||
// context.setUrl(url);
|
||||
// JSONObject jsonObject = leaseContractParam.getLeaseContractTerminationParam(formDataVo);
|
||||
// context.setRequest(jsonObject.toString());
|
||||
// res = ProtUtil.doPost(jsonObject, url, headerer);
|
||||
// context.setResponse(res.toString());
|
||||
// }else if ("一般付款合同".equals(contractType)){
|
||||
// url = PropKit.getProp(PropKit.LEASRTERMINATIONFKURL);
|
||||
// context.setUrl(url);
|
||||
// JSONObject jsonObject = leaseContractParam.getfkContractTerminationParam(formDataVo);
|
||||
// context.setRequest(jsonObject.toString());
|
||||
// res = ProtUtil.doPost(jsonObject, url, headerer);
|
||||
// context.setResponse(res.toString());
|
||||
// }else if("一般合同".equals(contractType)) {
|
||||
// url = PropKit.getProp(PropKit.LEASRTERMINATIONURL);
|
||||
// context.setUrl(url);
|
||||
// JSONObject jsonObject = leaseContractParam.getskContractTerminationParam(formDataVo);
|
||||
// context.setRequest(jsonObject.toString());
|
||||
// res = ProtUtil.doPost(jsonObject, url, headerer);
|
||||
// context.setResponse(res.toString());
|
||||
// }else{
|
||||
// log.info("请检查数据是否正确");
|
||||
// context.back("请检查数据是否正确");
|
||||
// context.setResponse("请检查数据是否正确");
|
||||
// context.setErrMsg("请检查数据是否正确");
|
||||
// return context;
|
||||
// }
|
||||
// if(res.isEmpty()) {
|
||||
// log.info("合同终止状态失败,请联系管理员处理");
|
||||
// context.back("合同终止状态失败,请联系管理员处理");
|
||||
// context.setResponse("合同终止状态失败,请联系管理员处理");
|
||||
// context.setErrMsg("合同终止状态失败,请联系管理员处理");
|
||||
// }else {
|
||||
// String isStatus = res.get("status").toString();
|
||||
// String msg = res.get("msg").toString();
|
||||
// if("1".equals(isStatus)) {
|
||||
// log.info("推送BIP合同终止状态成功");
|
||||
// context.success(msg);
|
||||
// formDataVo.getNewFieldDataMap().put("BIP返回结果", "推送BIP合同终止状态成功:"+res.get("msg"));
|
||||
// }else {
|
||||
// log.info("推送BIP合同终止状态失败:"+res.get("msg").toString());
|
||||
// context.back(msg);
|
||||
// formDataVo.getNewFieldDataMap().put("BIP返回结果", "推送BIP合同终止状态失败:"+res.get("msg").toString());
|
||||
// }
|
||||
// }
|
||||
// } catch (Exception e) {
|
||||
// e.printStackTrace();
|
||||
// log.info("异常:"+ e);
|
||||
// context.back("异常:"+ e);
|
||||
// formDataVo.getNewFieldDataMap().put("BIP返回结果", "推送BIP合同终止状态失败:"+e);
|
||||
// }
|
||||
// return context;
|
||||
// }
|
||||
|
||||
}
|
||||
|
||||
@@ -9,6 +9,8 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import com.seeyon.apps.ext.workflow.vo.FormDataVo;
|
||||
import com.seeyon.apps.src_contract.lease.kit.form.CAP4FormKit;
|
||||
import com.seeyon.cap4.form.bean.FormDataMasterBean;
|
||||
import org.apache.commons.io.FileUtils;
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
@@ -406,7 +408,7 @@ public class LeaseContractParam {
|
||||
}
|
||||
jsonObject.put("items", jsonArray);
|
||||
// String str = SystemEnvironment.getApplicationFolder();
|
||||
// String date = DateUtil.format(new Date(), "yyyyMMddHHmmss");
|
||||
//// String date = DateUtil.format(new Date(), "yyyyMMddHHmmss");
|
||||
// FileUtils.writeStringToFile(new File(str+"/LeaseContractjson/"+date.substring(0,4)+"/"+date.substring(4,6)+"/"+date.substring(6,8)+"/BIPZLSK_" + date + ".json"), jsonObject.toString(), "UTF-8");
|
||||
return jsonObject;
|
||||
}
|
||||
@@ -503,8 +505,31 @@ public class LeaseContractParam {
|
||||
// FileUtils.writeStringToFile(new File(str+"/LeaseContractjson/"+date.substring(0,4)+"/"+date.substring(4,6)+"/"+date.substring(6,8)+"/BIPYBSK_" + date + ".json"), jsonObject.toString(), "UTF-8");
|
||||
return jsonObject;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 获取租赁合同终止接口参数封装
|
||||
* @param master
|
||||
* @return
|
||||
* @throws IOException
|
||||
* @throws BusinessException
|
||||
*/
|
||||
public JSONObject getLeaseContractTerminationParam(FormDataMasterBean master) throws IOException, BusinessException {
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
jsonObject.put("vbillcode", CAP4FormKit.getFieldStrValue(master, "租赁合同编号"));//OA单据号
|
||||
jsonObject.put("vexecdate", DateUtil.format(new Date(), "yyyy-MM-dd"));//执行时间
|
||||
jsonObject.put("terminateReason", CAP4FormKit.getFieldStrValue(master, "终止原因"));//终止原因
|
||||
String businessTypeId = CAP4FormKit.getFieldStrValue(master, "业务类型");
|
||||
String businessTypeValue = getEnumManagerNew().getEnumItem(Long.parseLong(businessTypeId)).getValue();
|
||||
if("1".equals(businessTypeValue)) {
|
||||
jsonObject.put("businessType", "业务终止");//终止类型
|
||||
}else if("9".equals(businessTypeValue)){
|
||||
jsonObject.put("businessType", "正常终止");//终止类型
|
||||
}
|
||||
String str = SystemEnvironment.getApplicationFolder();
|
||||
String date = DateUtil.format(new Date(), "yyyyMMddHHmmss");
|
||||
FileUtils.writeStringToFile(new File(str+"/LeaseContractjson/"+date.substring(0,4)+"/"+date.substring(4,6)+"/"+date.substring(6,8)+"/BIPZLZZ_" + date + ".json"), jsonObject.toString(), "UTF-8");
|
||||
return jsonObject;
|
||||
}
|
||||
/**
|
||||
* 获取租赁合同终止接口参数封装
|
||||
* @param formDataVo
|
||||
@@ -532,6 +557,30 @@ public class LeaseContractParam {
|
||||
// FileUtils.writeStringToFile(new File(str+"/LeaseContractjson/"+date.substring(0,4)+"/"+date.substring(4,6)+"/"+date.substring(6,8)+"/BIPZLZZ_" + date + ".json"), jsonObject.toString(), "UTF-8");
|
||||
return jsonObject;
|
||||
}
|
||||
/**
|
||||
* 获取一般付款合同终止接口参数封装
|
||||
* @param master
|
||||
* @return
|
||||
* @throws IOException
|
||||
* @throws BusinessException
|
||||
*/
|
||||
public JSONObject getfkContractTerminationParam(FormDataMasterBean master) throws IOException, BusinessException {
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
jsonObject.put("vbillcode", CAP4FormKit.getFieldStrValue(master, "付款合同编号"));//OA单据号
|
||||
jsonObject.put("vexecdate",DateUtil.format(new Date(), "yyyy-MM-dd"));//执行时间
|
||||
jsonObject.put("terminateReason", CAP4FormKit.getFieldStrValue(master, "终止原因"));//终止原因
|
||||
String businessTypeId = CAP4FormKit.getFieldStrValue(master, "业务类型");
|
||||
String businessTypeValue = getEnumManagerNew().getEnumItem(Long.parseLong(businessTypeId)).getValue();
|
||||
if("1".equals(businessTypeValue)) {
|
||||
jsonObject.put("businessType", "业务终止");//终止类型
|
||||
}else if("9".equals(businessTypeValue)){
|
||||
jsonObject.put("businessType", "正常终止");//终止类型
|
||||
}
|
||||
String str = SystemEnvironment.getApplicationFolder();
|
||||
String date = DateUtil.format(new Date(), "yyyyMMddHHmmss");
|
||||
FileUtils.writeStringToFile(new File(str+"/LeaseContractjson/"+date.substring(0,4)+"/"+date.substring(4,6)+"/"+date.substring(6,8)+"/BIPZLZZ_" + date + ".json"), jsonObject.toString(), "UTF-8");
|
||||
return jsonObject;
|
||||
}
|
||||
/**
|
||||
* 获取一般付款合同终止接口参数封装
|
||||
* @param formDataVo
|
||||
@@ -559,6 +608,30 @@ public class LeaseContractParam {
|
||||
// FileUtils.writeStringToFile(new File(str+"/LeaseContractjson/"+date.substring(0,4)+"/"+date.substring(4,6)+"/"+date.substring(6,8)+"/BIPZLZZ_" + date + ".json"), jsonObject.toString(), "UTF-8");
|
||||
return jsonObject;
|
||||
}
|
||||
/**
|
||||
* 获取一般收款合同终止接口参数封装
|
||||
* @param master
|
||||
* @return
|
||||
* @throws IOException
|
||||
* @throws BusinessException
|
||||
*/
|
||||
public JSONObject getskContractTerminationParam(FormDataMasterBean master) throws IOException, BusinessException {
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
jsonObject.put("vbillcode", CAP4FormKit.getFieldStrValue(master, "收款合同编号"));//OA单据号
|
||||
jsonObject.put("vexecdate", DateUtil.format(new Date(), "yyyy-MM-dd"));//执行时间
|
||||
jsonObject.put("terminateReason", CAP4FormKit.getFieldStrValue(master, "终止原因"));//终止原因
|
||||
String businessTypeId = CAP4FormKit.getFieldStrValue(master, "业务类型");
|
||||
String businessTypeValue = getEnumManagerNew().getEnumItem(Long.parseLong(businessTypeId)).getValue();
|
||||
if("1".equals(businessTypeValue)) {
|
||||
jsonObject.put("businessType", "业务终止");//终止类型
|
||||
}else if("9".equals(businessTypeValue)){
|
||||
jsonObject.put("businessType", "正常终止");//终止类型
|
||||
}
|
||||
String str = SystemEnvironment.getApplicationFolder();
|
||||
String date = DateUtil.format(new Date(), "yyyyMMddHHmmss");
|
||||
FileUtils.writeStringToFile(new File(str+"/LeaseContractjson/"+date.substring(0,4)+"/"+date.substring(4,6)+"/"+date.substring(6,8)+"/BIPSKZZ_" + date + ".json"), jsonObject.toString(), "UTF-8");
|
||||
return jsonObject;
|
||||
}
|
||||
/**
|
||||
* 获取一般收款合同终止接口参数封装
|
||||
* @param formDataVo
|
||||
|
||||
@@ -3,10 +3,8 @@ package com.seeyon.apps.src_contract.lease.servlet;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.sql.SQLException;
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@@ -9,14 +9,13 @@ import com.seeyon.apps.common.plugin.vo.ConfigVo;
|
||||
import com.seeyon.apps.src_flowIntegration.config.FlowIntegrationConfigProvider;
|
||||
import com.seeyon.apps.src_flowIntegration.constants.FlowIntegrationConstants;
|
||||
import com.seeyon.apps.src_flowIntegration.dao.SrcFlowDao;
|
||||
import com.seeyon.apps.src_flowIntegration.util.AddressBookUtil;
|
||||
import com.seeyon.apps.src_flowIntegration.util.AesUtil;
|
||||
import com.seeyon.ctp.common.AppContext;
|
||||
import com.seeyon.ctp.common.controller.BaseController;
|
||||
import com.seeyon.ctp.common.ctpenumnew.manager.EnumManager;
|
||||
import com.seeyon.ctp.common.exceptions.BusinessException;
|
||||
import com.seeyon.ctp.common.po.ctpenumnew.CtpEnumItem;
|
||||
import com.seeyon.ctp.organization.bo.V3xOrgMember;
|
||||
import com.seeyon.ctp.organization.manager.OrgManager;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
import www.seeyon.com.utils.StringUtil;
|
||||
@@ -24,7 +23,10 @@ import www.seeyon.com.utils.StringUtil;
|
||||
import javax.inject.Inject;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.net.URLEncoder;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
|
||||
public class FormRedirectController extends BaseController {
|
||||
|
||||
@@ -42,17 +44,15 @@ public class FormRedirectController extends BaseController {
|
||||
|
||||
protected ICstConfigApi cstConfigApi = (ICstConfigApi) AppContext.getBean("cstConfigApi");
|
||||
|
||||
public ModelAndView index(HttpServletRequest request, HttpServletResponse response) throws Exception {
|
||||
public ModelAndView index(HttpServletRequest request,HttpServletResponse response) throws Exception {
|
||||
request.setCharacterEncoding("UTF-8");
|
||||
response.setCharacterEncoding("UTF-8");
|
||||
System.out.println("进入表单跳转方法");
|
||||
ConfigVo config = cstConfigApi.getConfig(FlowIntegrationConstants.getPluginId());
|
||||
// 表单连接跳转处理方法。
|
||||
// long memberId = AppContext.currentUserId();
|
||||
// V3xOrgMember v3xOrgMember = orgManager.getMemberById(memberId);
|
||||
// 查询当前状态登录名
|
||||
// String loginName = v3xOrgMember.getLoginName();
|
||||
// 获取系统内置参数第三方系统主数据字段信息
|
||||
String extAttrLabel = configProvider.getBizConfigByKey(FlowIntegrationConstants.extAttrLabel);
|
||||
log.info("获取人员账号自定义字段名称"+extAttrLabel);
|
||||
// 获取当前登录账号的人员自定义主数据信息,通过主数据信息查询到BIP系统登录信息
|
||||
AddressBook addressBook = addressBookCustomerFieldInfoManager.getByMemberId(AppContext.currentUserId());
|
||||
if(null == addressBook) {
|
||||
@@ -60,48 +60,48 @@ public class FormRedirectController extends BaseController {
|
||||
ModelAndView mav = exceptionRedirect("人员自定义数据未维护,无法单点登录!");
|
||||
return mav;
|
||||
}
|
||||
JSONObject addressBookjson = appleAddressBook(addressBook);
|
||||
JSONObject addressBookjson = AddressBookUtil.appleAddressBook(addressBook,enumManagerNew);
|
||||
// 通过字段名称查询人员账号主数据数据库字段
|
||||
String extAttrName = srcFlowDao.getMetadataNameByLabel(extAttrLabel);
|
||||
String extAttrValue = addressBookjson.getString(extAttrName);
|
||||
log.info("查询对应人员账号"+extAttrValue);
|
||||
if(StringUtil.isEmpty(extAttrValue)){
|
||||
log.info(extAttrLabel+"未维护,无法单点登录!");
|
||||
ModelAndView mav = exceptionRedirect(extAttrLabel+"未维护,无法单点登录!");
|
||||
return mav;
|
||||
}
|
||||
|
||||
// 获取第三方系统标识,通过第三方系统标识查询第三方系统的ip,端口,表单跳转地址,加密规则信息等
|
||||
String thirdpartyCode = request.getParameter("thirdpartyCode");
|
||||
// 设置跳转参数
|
||||
JSONObject autoToken = new JSONObject();
|
||||
autoToken.put("thirdPartyLoginName",extAttrValue);
|
||||
autoToken.put("loginName",AppContext.currentUserLoginName());
|
||||
autoToken.put("time",new Date().getTime());
|
||||
log.info("第三方应用编码:"+thirdpartyCode+",设置连接跳转参数"+autoToken);
|
||||
// 根据第三方系统标识获取加密key和vi
|
||||
String paramValue = srcFlowDao.getThirdpartyParamByThirdpartyCode(thirdpartyCode);
|
||||
JSONObject paramjson = JSONObject.parseObject(paramValue);
|
||||
String secretKey = paramjson.getString("secretKey");
|
||||
String vi = paramjson.getString("vi");
|
||||
String encrypted = AesUtil.encrypt("loginName="+extAttrValue,secretKey,vi);
|
||||
String tourl = request.getParameter("tourl");
|
||||
String thirdpartyParam = srcFlowDao.getThirdpartyParamByThirdpartyCode(thirdpartyCode);
|
||||
if(StringUtil.isEmpty(thirdpartyParam)){
|
||||
log.info("参数信息"+paramValue);
|
||||
if(StringUtil.isEmpty(paramValue)){
|
||||
log.info("当前第三方系统标识在系统中没有找到,请检查系统设置。");
|
||||
ModelAndView mav = exceptionRedirect("当前第三方系统标识在系统中没有找到,请检查系统设置。");
|
||||
return mav;
|
||||
}
|
||||
JSONObject thirdpartyParamjson = JSONObject.parseObject(thirdpartyParam);
|
||||
String redirectUrl = thirdpartyParamjson.getString("redirectUrl");
|
||||
if(StringUtil.isEmpty(redirectUrl)){
|
||||
log.info("当前第三方系统跳转链接为空,请检查系统设置。");
|
||||
ModelAndView mav = exceptionRedirect("当前第三方系统跳转链接为空,请检查系统设置。");
|
||||
return mav;
|
||||
}
|
||||
String ip = thirdpartyParamjson.getString("IP");
|
||||
String port = thirdpartyParamjson.getString("PORT");
|
||||
JSONObject paramjson = JSONObject.parseObject(paramValue);
|
||||
String secretKey = paramjson.getString("secretKey");
|
||||
String vi = paramjson.getString("vi");
|
||||
String encrypted = AesUtil.encrypt(autoToken.toString(),secretKey,vi);
|
||||
String tourl = request.getParameter("tourl");
|
||||
|
||||
StringBuilder urlsb = new StringBuilder("http://").append(ip).append(':').append(port).
|
||||
append('/').append(redirectUrl).append("?tourl=").append(tourl).append("&ticket=").append(encrypted);
|
||||
// JSONObject thirdpartyParamjson = JSONObject.parseObject(paramValue);
|
||||
// 连接地址转换,特殊标识符
|
||||
String url = tourl;
|
||||
String encodedToken = URLEncoder.encode(encrypted, StandardCharsets.UTF_8.name());
|
||||
StringBuilder urlsb = new StringBuilder(url).append("&auth_token=").append(encodedToken);
|
||||
log.info("跳转链接为:"+urlsb);
|
||||
response.sendRedirect(urlsb.toString());
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
private ModelAndView exceptionRedirect(String popupContent){
|
||||
ModelAndView mav = new ModelAndView("popup");
|
||||
// 2. 向前端传递弹窗参数(可自定义字段)
|
||||
@@ -111,164 +111,4 @@ public class FormRedirectController extends BaseController {
|
||||
mav.addObject("popupType", "success"); // 弹窗类型(成功/失败)
|
||||
return mav;
|
||||
}
|
||||
|
||||
|
||||
private JSONObject appleAddressBook(AddressBook addressBook) throws BusinessException {
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
if(StringUtil.isNotEmpty(addressBook.getExtAttr1())){
|
||||
jsonObject.put("extAttr1",addressBook.getExtAttr1());
|
||||
}if(StringUtil.isNotEmpty(addressBook.getExtAttr2())){
|
||||
jsonObject.put("extAttr2",addressBook.getExtAttr2());
|
||||
}if(StringUtil.isNotEmpty(addressBook.getExtAttr3())){
|
||||
jsonObject.put("extAttr3",addressBook.getExtAttr3());
|
||||
}if(StringUtil.isNotEmpty(addressBook.getExtAttr4())){
|
||||
jsonObject.put("extAttr4",addressBook.getExtAttr4());
|
||||
}if(StringUtil.isNotEmpty(addressBook.getExtAttr5())){
|
||||
jsonObject.put("extAttr5",addressBook.getExtAttr5());
|
||||
}if(StringUtil.isNotEmpty(addressBook.getExtAttr6())){
|
||||
jsonObject.put("extAttr6",addressBook.getExtAttr6());
|
||||
}if(StringUtil.isNotEmpty(addressBook.getExtAttr7())){
|
||||
jsonObject.put("extAttr7",addressBook.getExtAttr7());
|
||||
}if(StringUtil.isNotEmpty(addressBook.getExtAttr8())){
|
||||
jsonObject.put("extAttr8",addressBook.getExtAttr8());
|
||||
}if(StringUtil.isNotEmpty(addressBook.getExtAttr9())){
|
||||
jsonObject.put("extAttr9",addressBook.getExtAttr9());
|
||||
}if(StringUtil.isNotEmpty(addressBook.getExtAttr10())){
|
||||
jsonObject.put("extAttr10",addressBook.getExtAttr10());
|
||||
}if( addressBook.getExtAttr11()!=null){
|
||||
jsonObject.put("extAttr11",addressBook.getExtAttr11());
|
||||
}if( addressBook.getExtAttr12()!=null){
|
||||
jsonObject.put("extAttr12",addressBook.getExtAttr12());
|
||||
}if(addressBook.getExtAttr13()!=null){
|
||||
jsonObject.put("extAttr13",addressBook.getExtAttr13());
|
||||
}if(addressBook.getExtAttr14()!=null){
|
||||
jsonObject.put("extAttr14",addressBook.getExtAttr14());
|
||||
}if(addressBook.getExtAttr15()!=null){
|
||||
jsonObject.put("extAttr15",addressBook.getExtAttr15());
|
||||
}if(addressBook.getExtAttr16()!=null){
|
||||
jsonObject.put("extAttr16",addressBook.getExtAttr16());
|
||||
}if(addressBook.getExtAttr17()!=null){
|
||||
jsonObject.put("extAttr17",addressBook.getExtAttr17());
|
||||
}if(addressBook.getExtAttr18()!=null){
|
||||
jsonObject.put("extAttr18",addressBook.getExtAttr18());
|
||||
}if(addressBook.getExtAttr19()!=null){
|
||||
jsonObject.put("extAttr19",addressBook.getExtAttr19());
|
||||
}if(addressBook.getExtAttr20()!=null){
|
||||
jsonObject.put("extAttr20",addressBook.getExtAttr20());
|
||||
}if(addressBook.getExtAttr21()!=null){
|
||||
jsonObject.put("extAttr21",sdf.format(addressBook.getExtAttr21()));
|
||||
}if(addressBook.getExtAttr22()!=null){
|
||||
jsonObject.put("extAttr22",sdf.format(addressBook.getExtAttr22()));
|
||||
}if(addressBook.getExtAttr23()!=null){
|
||||
jsonObject.put("extAttr23",sdf.format(addressBook.getExtAttr23()));
|
||||
}if(addressBook.getExtAttr24()!=null){
|
||||
jsonObject.put("extAttr24",sdf.format(addressBook.getExtAttr24()));
|
||||
}if(addressBook.getExtAttr25()!=null){
|
||||
jsonObject.put("extAttr25",sdf.format(addressBook.getExtAttr25()));
|
||||
}if(addressBook.getExtAttr26()!=null){
|
||||
jsonObject.put("extAttr26",sdf.format(addressBook.getExtAttr26()));
|
||||
}if(addressBook.getExtAttr27()!=null){
|
||||
jsonObject.put("extAttr27",sdf.format(addressBook.getExtAttr27()));
|
||||
}if(addressBook.getExtAttr28()!=null){
|
||||
jsonObject.put("extAttr28",sdf.format(addressBook.getExtAttr28()));
|
||||
}if(addressBook.getExtAttr29()!=null){
|
||||
jsonObject.put("extAttr29",sdf.format(addressBook.getExtAttr29()));
|
||||
}if(addressBook.getExtAttr30()!=null){
|
||||
jsonObject.put("extAttr30",sdf.format(addressBook.getExtAttr30()));
|
||||
}if(StringUtil.isNotEmpty(addressBook.getExtAttr31())){
|
||||
CtpEnumItem ctpEnumItem = enumManagerNew.getCtpEnumItem(Long.parseLong(addressBook.getExtAttr31()));
|
||||
jsonObject.put("extAttr31",ctpEnumItem.getShowvalue());
|
||||
}if(StringUtil.isNotEmpty(addressBook.getExtAttr32())){
|
||||
CtpEnumItem ctpEnumItem = enumManagerNew.getCtpEnumItem(Long.parseLong(addressBook.getExtAttr32()));
|
||||
jsonObject.put("extAttr32",ctpEnumItem.getShowvalue());
|
||||
}if(StringUtil.isNotEmpty(addressBook.getExtAttr33())){
|
||||
CtpEnumItem ctpEnumItem = enumManagerNew.getCtpEnumItem(Long.parseLong(addressBook.getExtAttr33()));
|
||||
jsonObject.put("extAttr33",ctpEnumItem.getShowvalue());
|
||||
}if(StringUtil.isNotEmpty(addressBook.getExtAttr34())){
|
||||
CtpEnumItem ctpEnumItem = enumManagerNew.getCtpEnumItem(Long.parseLong(addressBook.getExtAttr34()));
|
||||
jsonObject.put("extAttr34",ctpEnumItem.getShowvalue());
|
||||
}if(StringUtil.isNotEmpty(addressBook.getExtAttr35())){
|
||||
CtpEnumItem ctpEnumItem = enumManagerNew.getCtpEnumItem(Long.parseLong(addressBook.getExtAttr35()));
|
||||
jsonObject.put("extAttr35",ctpEnumItem.getShowvalue());
|
||||
}if(StringUtil.isNotEmpty(addressBook.getExtAttr36())){
|
||||
CtpEnumItem ctpEnumItem = enumManagerNew.getCtpEnumItem(Long.parseLong(addressBook.getExtAttr36()));
|
||||
jsonObject.put("extAttr36",ctpEnumItem.getShowvalue());
|
||||
}if(StringUtil.isNotEmpty(addressBook.getExtAttr37())){
|
||||
CtpEnumItem ctpEnumItem = enumManagerNew.getCtpEnumItem(Long.parseLong(addressBook.getExtAttr37()));
|
||||
jsonObject.put("extAttr37",ctpEnumItem.getShowvalue());
|
||||
}if(StringUtil.isNotEmpty(addressBook.getExtAttr38())){
|
||||
CtpEnumItem ctpEnumItem = enumManagerNew.getCtpEnumItem(Long.parseLong(addressBook.getExtAttr38()));
|
||||
jsonObject.put("extAttr38",ctpEnumItem.getShowvalue());
|
||||
}if(StringUtil.isNotEmpty(addressBook.getExtAttr39())){
|
||||
CtpEnumItem ctpEnumItem = enumManagerNew.getCtpEnumItem(Long.parseLong(addressBook.getExtAttr39()));
|
||||
jsonObject.put("extAttr39",ctpEnumItem.getShowvalue());
|
||||
}if(StringUtil.isNotEmpty(addressBook.getExtAttr40())){
|
||||
CtpEnumItem ctpEnumItem = enumManagerNew.getCtpEnumItem(Long.parseLong(addressBook.getExtAttr40()));
|
||||
jsonObject.put("extAttr40",ctpEnumItem.getShowvalue());
|
||||
}if(StringUtil.isNotEmpty(addressBook.getExtAttr41())){
|
||||
jsonObject.put("extAttr41",addressBook.getExtAttr41());
|
||||
}if(StringUtil.isNotEmpty(addressBook.getExtAttr42())){
|
||||
jsonObject.put("extAttr42",addressBook.getExtAttr42());
|
||||
}if(StringUtil.isNotEmpty(addressBook.getExtAttr43())){
|
||||
jsonObject.put("extAttr43",addressBook.getExtAttr43());
|
||||
}if(StringUtil.isNotEmpty(addressBook.getExtAttr44())){
|
||||
jsonObject.put("extAttr44",addressBook.getExtAttr44());
|
||||
}if(StringUtil.isNotEmpty(addressBook.getExtAttr45())){
|
||||
jsonObject.put("extAttr45",addressBook.getExtAttr45());
|
||||
}if(StringUtil.isNotEmpty(addressBook.getExtAttr46())){
|
||||
jsonObject.put("extAttr46",addressBook.getExtAttr46());
|
||||
}if(StringUtil.isNotEmpty(addressBook.getExtAttr47())){
|
||||
jsonObject.put("extAttr47",addressBook.getExtAttr47());
|
||||
}if(StringUtil.isNotEmpty(addressBook.getExtAttr48())){
|
||||
jsonObject.put("extAttr48",addressBook.getExtAttr48());
|
||||
}if(StringUtil.isNotEmpty(addressBook.getExtAttr49())){
|
||||
jsonObject.put("extAttr49",addressBook.getExtAttr49());
|
||||
}if(StringUtil.isNotEmpty(addressBook.getExtAttr50())){
|
||||
jsonObject.put("extAttr50",addressBook.getExtAttr50());
|
||||
}if(StringUtil.isNotEmpty(addressBook.getExtAttr51())){
|
||||
jsonObject.put("extAttr51",addressBook.getExtAttr51());
|
||||
}if(StringUtil.isNotEmpty(addressBook.getExtAttr52())){
|
||||
jsonObject.put("extAttr52",addressBook.getExtAttr52());
|
||||
}if(StringUtil.isNotEmpty(addressBook.getExtAttr53())){
|
||||
jsonObject.put("extAttr53",addressBook.getExtAttr53());
|
||||
}if(StringUtil.isNotEmpty(addressBook.getExtAttr54())){
|
||||
jsonObject.put("extAttr54",addressBook.getExtAttr54());
|
||||
}if(StringUtil.isNotEmpty(addressBook.getExtAttr55())){
|
||||
jsonObject.put("extAttr55",addressBook.getExtAttr55());
|
||||
}if(StringUtil.isNotEmpty(addressBook.getExtAttr56())){
|
||||
jsonObject.put("extAttr56",addressBook.getExtAttr56());
|
||||
}if(StringUtil.isNotEmpty(addressBook.getExtAttr57())){
|
||||
jsonObject.put("extAttr57",addressBook.getExtAttr57());
|
||||
}if(StringUtil.isNotEmpty(addressBook.getExtAttr58())){
|
||||
jsonObject.put("extAttr58",addressBook.getExtAttr58());
|
||||
}if(StringUtil.isNotEmpty(addressBook.getExtAttr59())){
|
||||
jsonObject.put("extAttr59",addressBook.getExtAttr59());
|
||||
}if(StringUtil.isNotEmpty(addressBook.getExtAttr60())){
|
||||
jsonObject.put("extAttr60",addressBook.getExtAttr60());
|
||||
}if(StringUtil.isNotEmpty(addressBook.getExtAttr61())){
|
||||
jsonObject.put("extAttr61",addressBook.getExtAttr61());
|
||||
}if(StringUtil.isNotEmpty(addressBook.getExtAttr62())){
|
||||
jsonObject.put("extAttr62",addressBook.getExtAttr62());
|
||||
}if(StringUtil.isNotEmpty(addressBook.getExtAttr63())){
|
||||
jsonObject.put("extAttr63",addressBook.getExtAttr63());
|
||||
}if(StringUtil.isNotEmpty(addressBook.getExtAttr64())){
|
||||
jsonObject.put("extAttr64",addressBook.getExtAttr64());
|
||||
}if(StringUtil.isNotEmpty(addressBook.getExtAttr65())){
|
||||
jsonObject.put("extAttr65",addressBook.getExtAttr65());
|
||||
}if(StringUtil.isNotEmpty(addressBook.getExtAttr66())){
|
||||
jsonObject.put("extAttr66",addressBook.getExtAttr66());
|
||||
}if(StringUtil.isNotEmpty(addressBook.getExtAttr67())){
|
||||
jsonObject.put("extAttr67",addressBook.getExtAttr67());
|
||||
}if(StringUtil.isNotEmpty(addressBook.getExtAttr68())){
|
||||
jsonObject.put("extAttr68",addressBook.getExtAttr68());
|
||||
}if(StringUtil.isNotEmpty(addressBook.getExtAttr69())){
|
||||
jsonObject.put("extAttr69",addressBook.getExtAttr69());
|
||||
}if(StringUtil.isNotEmpty(addressBook.getExtAttr70())){
|
||||
jsonObject.put("extAttr70",addressBook.getExtAttr70());
|
||||
}
|
||||
return jsonObject;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
package com.seeyon.apps.src_flowIntegration.dao;
|
||||
|
||||
import com.seeyon.apps.src_flowIntegration.util.SQLParamUtil;
|
||||
import com.seeyon.ctp.common.exceptions.BusinessException;
|
||||
import com.seeyon.ctp.util.JDBCAgent;
|
||||
|
||||
import java.sql.SQLException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@@ -15,7 +16,12 @@ public class SrcFlowDao{
|
||||
private String getAuthIdByFormId = "select resource_id from cap_form_auth_info where form_id = ? and type = 'add' and deleted = 0 and default_auth = 1 ";
|
||||
private String getFieldInfoByFormId = "select field_info from cap_form_definition where id = ?";
|
||||
private String uniqueDataValidation = "select #{fieldName} from #{tableName} where #{fieldName} = ?";
|
||||
private String getFormDataByParam = "select #{fieldName} from #{tableName} where 1=1 #{whereString} ";
|
||||
private String getThirdpartyParamByThirdpartyCode = "select param_value from thirdparty_register where app_code = ?";
|
||||
private String getColSummaryById = "select id,state,subject,start_member_id,process_id,templete_id,form_recordid,formid,form_appid from col_summary where id = ?";
|
||||
private String getProcessLogsByProcessId = "select id,process_id,action_id,action_user_id,action_time,action_desc from ctp_process_log where process_id = ?";
|
||||
private String getColSummaryByFormRecordid = "select id,state,subject,start_member_id,process_id,templete_id,form_recordid,formid,form_appid from col_summary where form_recordid = ?";
|
||||
private String getCtpAffairBySummaryId = "select id,member_id,state,sub_state from ctp_affair where object_id = ?";
|
||||
|
||||
private String getMetadataNameByLabel = "select name from ctp_metadata_column where label = ? and is_enable = 1";
|
||||
|
||||
@@ -152,6 +158,37 @@ public class SrcFlowDao{
|
||||
return res;
|
||||
}
|
||||
|
||||
public List<Map<String,Object>> getFormDataByParam (String tableName,String[] fieldNames,Map<String,String> params){
|
||||
List<Map<String,Object>> res = new ArrayList<>();
|
||||
JDBCAgent agent = new JDBCAgent();
|
||||
try {
|
||||
StringBuilder sql = new StringBuilder(getFormDataByParam);
|
||||
String fieldName = SQLParamUtil.joinWithCommaFilterEmpty(fieldNames);
|
||||
String whereString = SQLParamUtil.mapToAndCondition(params);
|
||||
String replacedStr = sql.toString().replace("#{tableName}", tableName).replace("#{fieldName}", fieldName).replace("#{whereString}",whereString);
|
||||
sql = new StringBuilder(replacedStr);
|
||||
List<Object> p = new ArrayList<Object>();
|
||||
agent.execute(sql.toString(), p);
|
||||
List<Map> list = agent.resultSetToList();
|
||||
if (list != null && list.size() > 0) {
|
||||
for(int i = 0 ; i < list.size() ; i++){
|
||||
Map<String,Object> r = list.get(i);
|
||||
res.add(r);
|
||||
}
|
||||
return res;
|
||||
}
|
||||
} catch (BusinessException e) {
|
||||
e.printStackTrace();
|
||||
} catch (SQLException e) {
|
||||
e.printStackTrace();
|
||||
} finally {
|
||||
if (agent != null) {
|
||||
agent.close();
|
||||
}
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
public String getThirdpartyParamByThirdpartyCode(String thirdpartyCode){
|
||||
String res = "";
|
||||
JDBCAgent agent = new JDBCAgent();
|
||||
@@ -204,5 +241,120 @@ public class SrcFlowDao{
|
||||
return res;
|
||||
}
|
||||
|
||||
// id,state,subject,start_member_id,process_id,templete_id,form_recordid,formid,form_appid
|
||||
public Map<String,Object> getColSummaryById(String summaryId){
|
||||
Map<String,Object> res = new HashMap<>();
|
||||
JDBCAgent agent = new JDBCAgent();
|
||||
try {
|
||||
StringBuilder sql = new StringBuilder(getColSummaryById);
|
||||
List<Object> p = new ArrayList<Object>();
|
||||
p.add(summaryId);
|
||||
agent.execute(sql.toString(), p);
|
||||
List<Map> list = agent.resultSetToList();
|
||||
if (list != null && list.size() > 0) {
|
||||
res = list.get(0);
|
||||
}
|
||||
} catch (BusinessException e) {
|
||||
e.printStackTrace();
|
||||
} catch (SQLException e) {
|
||||
e.printStackTrace();
|
||||
} finally {
|
||||
if (agent != null) {
|
||||
agent.close();
|
||||
}
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
// id,process_id,action_user_id,action_time,action_desc
|
||||
public List<Map<String,String>> getProcessLogsByProcessId(String processId){
|
||||
List<Map<String,String>> res = new ArrayList<>();
|
||||
JDBCAgent agent = new JDBCAgent();
|
||||
try {
|
||||
StringBuilder sql = new StringBuilder(getProcessLogsByProcessId);
|
||||
List<Object> p = new ArrayList<Object>();
|
||||
p.add(processId);
|
||||
agent.execute(sql.toString(), p);
|
||||
List<Map> list = agent.resultSetToList();
|
||||
if (list != null && list.size() > 0) {
|
||||
for(int i = 0 ; i< list.size();i++){
|
||||
Map<String,Object> data = list.get(i);
|
||||
Map<String,String> map = new HashMap<>();
|
||||
map.put("id",data.get("id")!=null?data.get("id").toString():"");
|
||||
map.put("processId",data.get("process_id")!=null?data.get("process_id").toString():"");
|
||||
map.put("actionId",data.get("action_id")!=null?data.get("action_id").toString():"");
|
||||
map.put("actionUserId",data.get("action_user_id")!=null?data.get("action_user_id").toString():"");
|
||||
map.put("actionTime",data.get("action_time")!=null?data.get("action_time").toString():"");
|
||||
map.put("actionDesc",data.get("action_desc")!=null?data.get("action_desc").toString():"");
|
||||
res.add(map);
|
||||
}
|
||||
}
|
||||
} catch (BusinessException e) {
|
||||
e.printStackTrace();
|
||||
} catch (SQLException e) {
|
||||
e.printStackTrace();
|
||||
} finally {
|
||||
if (agent != null) {
|
||||
agent.close();
|
||||
}
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
public Map<String,String> getColSummaryByFormRecordid(String formRecordid){
|
||||
Map<String,String> res = new HashMap<>();
|
||||
JDBCAgent agent = new JDBCAgent();
|
||||
try {
|
||||
StringBuilder sql = new StringBuilder(getColSummaryByFormRecordid);
|
||||
List<Object> p = new ArrayList<Object>();
|
||||
p.add(formRecordid);
|
||||
agent.execute(sql.toString(), p);
|
||||
List<Map> list = agent.resultSetToList();
|
||||
if (list != null && list.size() > 0) {
|
||||
res = list.get(0);
|
||||
}
|
||||
} catch (BusinessException e) {
|
||||
e.printStackTrace();
|
||||
} catch (SQLException e) {
|
||||
e.printStackTrace();
|
||||
} finally {
|
||||
if (agent != null) {
|
||||
agent.close();
|
||||
}
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
public List<Map<String,String>> getCtpAffairBySummaryId(String summaryId){
|
||||
List<Map<String,String>> res = new ArrayList<>();
|
||||
JDBCAgent agent = new JDBCAgent();
|
||||
try {
|
||||
StringBuilder sql = new StringBuilder(getCtpAffairBySummaryId);
|
||||
List<Object> p = new ArrayList<Object>();
|
||||
p.add(summaryId);
|
||||
agent.execute(sql.toString(), p);
|
||||
List<Map> list = agent.resultSetToList();
|
||||
if (list != null && list.size() > 0) {
|
||||
for(int i = 0 ; i< list.size();i++){
|
||||
Map<String,Object> data = list.get(i);
|
||||
Map<String,String> map = new HashMap<>();
|
||||
map.put("id",data.get("id")!=null?data.get("id").toString():"");
|
||||
map.put("memberId",data.get("member_id")!=null?data.get("member_id").toString():"");
|
||||
map.put("state",data.get("state")!=null?data.get("state").toString():"");
|
||||
map.put("subState",data.get("sub_state")!=null?data.get("sub_state").toString():"");
|
||||
res.add(map);
|
||||
}
|
||||
}
|
||||
} catch (BusinessException e) {
|
||||
e.printStackTrace();
|
||||
} catch (SQLException e) {
|
||||
e.printStackTrace();
|
||||
} finally {
|
||||
if (agent != null) {
|
||||
agent.close();
|
||||
}
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -61,10 +61,25 @@ public class FlowStatusCallbackEvent extends ACommonWorkflowEvent {
|
||||
JSONObject req = JSONObject.parseObject(request);
|
||||
String url = req.getString("flowStatusCallbackUrl");
|
||||
context.setUrl(url);
|
||||
// {
|
||||
// "thirdFlowId": "2026013021110001",
|
||||
// "flowInfo": {
|
||||
// "flowStatus": "1",
|
||||
// "flowStatusTxt": "流程结束"
|
||||
// },
|
||||
// "formInfo": {
|
||||
//
|
||||
// }
|
||||
// }
|
||||
JSONObject datajson = new JSONObject();
|
||||
datajson.put("thirdFlowId",req.getString("thirdFlowId"));
|
||||
datajson.put("flowStatus","1");
|
||||
datajson.put("remark","流程结束");
|
||||
JSONObject flowInfo = new JSONObject();
|
||||
flowInfo.put("flowStatus","2");
|
||||
flowInfo.put("flowStatusTxt","流程终止");
|
||||
datajson.put("flowInfo",flowInfo);
|
||||
JSONObject formInfo = new JSONObject();
|
||||
// 封装流程表单信息
|
||||
datajson.put("formInfo",formInfo);
|
||||
context.setRequest(datajson.toString());
|
||||
// 进行请求参数加密
|
||||
String thirdpartyCode = req.getString("thirdpartyCode");
|
||||
@@ -95,9 +110,10 @@ public class FlowStatusCallbackEvent extends ACommonWorkflowEvent {
|
||||
context.setSuccess(true);
|
||||
context.setErrMsg("终止成功,第三方流程已回退");
|
||||
}else{
|
||||
context.setSuccess(false);
|
||||
context.setErrMsg("流程终止失败。");
|
||||
context.setSuccess(true);
|
||||
context.setErrMsg("终止失败");
|
||||
}
|
||||
|
||||
return context;
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,265 @@
|
||||
package com.seeyon.apps.src_flowIntegration.listener;
|
||||
|
||||
import cn.hutool.log.Log;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.seeyon.apps.addressbook.manager.AddressBookCustomerFieldInfoManager;
|
||||
import com.seeyon.apps.addressbook.po.AddressBook;
|
||||
import com.seeyon.apps.common.config.ICstConfigApi;
|
||||
import com.seeyon.apps.common.plugin.vo.ConfigVo;
|
||||
import com.seeyon.apps.extIntegration.vo.ExtAffair;
|
||||
import com.seeyon.apps.extIntegration.vo.ExtSummary;
|
||||
import com.seeyon.apps.src_flowIntegration.config.FlowIntegrationConfigProvider;
|
||||
import com.seeyon.apps.src_flowIntegration.constants.FlowIntegrationConstants;
|
||||
import com.seeyon.apps.src_flowIntegration.dao.SrcFlowDao;
|
||||
import com.seeyon.apps.src_flowIntegration.util.*;
|
||||
import com.seeyon.apps.zhifei.event.ExtIntegrationExtendEvent;
|
||||
import com.seeyon.ctp.common.AppContext;
|
||||
import com.seeyon.ctp.common.ctpenumnew.manager.EnumManager;
|
||||
import com.seeyon.ctp.common.exceptions.BusinessException;
|
||||
import com.seeyon.ctp.organization.bo.V3xOrgMember;
|
||||
import com.seeyon.ctp.organization.manager.OrgManager;
|
||||
import com.seeyon.ctp.util.annotation.ListenEvent;
|
||||
import com.seeyon.utils.http.HttpClient;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import www.seeyon.com.utils.StringUtil;
|
||||
import www.seeyon.com.utils.UUIDUtil;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
public class FlowEventListener {
|
||||
|
||||
private static Log log = Log.get(FlowEventListener.class);
|
||||
|
||||
protected ICstConfigApi cstConfigApi = (ICstConfigApi) AppContext.getBean("cstConfigApi");
|
||||
@Autowired
|
||||
private FlowIntegrationConfigProvider configProvider;
|
||||
@Inject
|
||||
private OrgManager orgManager;
|
||||
@Inject
|
||||
private AddressBookCustomerFieldInfoManager addressBookCustomerFieldInfoManager;
|
||||
@Inject
|
||||
private SrcFlowDao srcFlowDao;
|
||||
@Inject
|
||||
private EnumManager enumManagerNew;
|
||||
|
||||
public ConfigVo getFlowConfig() {
|
||||
return this.cstConfigApi.getConfig(this.getPluginId());
|
||||
}
|
||||
|
||||
public String getPluginId() {
|
||||
return FlowIntegrationConstants.getPluginId();
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**编写一个事件监听ExtIntegrationExtendEvent**/
|
||||
/**
|
||||
* 流程待办事件
|
||||
* @param event
|
||||
* @throws BusinessException
|
||||
*/
|
||||
@ListenEvent(event = ExtIntegrationExtendEvent.class, async = true)
|
||||
public void onExtIntegrationEvent(ExtIntegrationExtendEvent event){
|
||||
System.out.println("统一待办集成监听");
|
||||
ConfigVo configVo = this.getFlowConfig();
|
||||
// 创建最终推送返回对象
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
try {
|
||||
// 判断当前流程是否需要进行流程审批状态返回
|
||||
ExtSummary extSummary = event.getExtSummary();
|
||||
// 获取summaryId
|
||||
String summaryId = extSummary.getExtSummaryId();
|
||||
// 获取系统内置参数第三方系统主数据字段信息
|
||||
String extAttrLabel = configProvider.getBizConfigByKey(FlowIntegrationConstants.extAttrLabel);
|
||||
// 根据summaryId获取colSummary对象//优化点通过ID查询ColSummary对象
|
||||
// 发起人 流程ID 模板ID 表单数据ID 表单ID 表单应用ID
|
||||
// id,state,subject,start_member_id,process_id,templete_id,form_recordid,formid,form_appid
|
||||
Map summaryMap = srcFlowDao.getColSummaryById(summaryId);
|
||||
// 获取流程逻辑数据,获取流程表单字段对象。
|
||||
String formAppid = summaryMap.get("form_appid")==null?"":summaryMap.get("form_appid").toString();
|
||||
String fieldInfo = srcFlowDao.getFieldInfoByFormId(formAppid);
|
||||
JSONObject fieldjson = JSONObject.parseObject(fieldInfo);
|
||||
// 获取表单信息,制定唯一值信息,第三方系统编码信息
|
||||
JSONObject frontFormmain = fieldjson.getJSONObject("front_formmain");
|
||||
String tableName = frontFormmain.getString("tableName");
|
||||
String tirdFlowIdName = FieldUtil.isDisplayExists(frontFormmain,"第三方系统流程ID");
|
||||
if(StringUtil.isEmpty(tirdFlowIdName)){
|
||||
log.info("当前表单中不存在集成指定字段。不进行流程状态回传。");
|
||||
return ;
|
||||
}
|
||||
String processId = summaryMap.get("process_id")==null?"":summaryMap.get("process_id").toString();
|
||||
// id,process_id,action_user_id,action_time,action_desc,审批记录
|
||||
List<Map<String ,String>> processLogs = srcFlowDao.getProcessLogsByProcessId(processId);
|
||||
// 创建审批记录对象
|
||||
JSONArray completedList = new JSONArray();
|
||||
for(Map<String,String> processLog :processLogs){
|
||||
// 创建参数对象转换参数信息
|
||||
JSONObject completed = new JSONObject();
|
||||
// 处理节点名称(当前功能无法获取,暂时为空)
|
||||
completed.put("affairName","");
|
||||
// 处理人信息
|
||||
completed.put("affairMember","");
|
||||
completed.put("affairMemberLoginName","");
|
||||
completed.put("affairMemberthirdPartyLoginName","");
|
||||
String actionUserId = processLog.get("actionUserId");
|
||||
if(StringUtil.isNotEmpty(actionUserId)){
|
||||
V3xOrgMember v3xOrgMember = orgManager.getMemberById(Long.parseLong(actionUserId));
|
||||
AddressBook memberAddressBook = addressBookCustomerFieldInfoManager.getByMemberId(v3xOrgMember.getId());
|
||||
if(null == memberAddressBook) {
|
||||
log.info("人员自定义数据未维护,无法单点登录!");
|
||||
return;
|
||||
}
|
||||
JSONObject addressBookjson = AddressBookUtil.appleAddressBook(memberAddressBook,enumManagerNew);
|
||||
// 通过字段名称查询人员账号主数据数据库字段
|
||||
String extAttrName = srcFlowDao.getMetadataNameByLabel(extAttrLabel);
|
||||
String extAttrValue = addressBookjson.getString(extAttrName);
|
||||
log.info("查询对应人员账号"+extAttrValue);
|
||||
if(StringUtil.isEmpty(extAttrValue)){
|
||||
log.info(extAttrLabel+"未维护,无法单点登录!");
|
||||
return;
|
||||
}
|
||||
completed.put("affairMember",v3xOrgMember.getName());
|
||||
completed.put("affairMemberLoginName",v3xOrgMember.getLoginName());
|
||||
completed.put("affairMemberthirdPartyLoginName",extAttrValue);
|
||||
}
|
||||
// 处理事项状态及描述
|
||||
String actionId = processLog.get("actionId");
|
||||
// 处理操作状态字段转换成对应状态
|
||||
completed.put("affairStatus",TransitionAffairUtil.actionIdTransitionAffairStatus(actionId));
|
||||
completed.put("affairStatusTxt",TransitionAffairUtil.actionIdTransitionAffairStatusTxt(actionId));
|
||||
// 处理时间
|
||||
completed.put("completeTime",processLog.get("actionTime"));
|
||||
// 是否最新处理,当前为处理日志,默认为flase
|
||||
completed.put("isLatest",false);
|
||||
completedList.add(completed);
|
||||
}
|
||||
// 解析当前审批信息
|
||||
// 添加当前审批信息到completedList对象中
|
||||
List<ExtAffair> extAffairs = extSummary.getExtAffairs();
|
||||
System.out.println(extAffairs.size());
|
||||
for(ExtAffair extAffair : extAffairs){
|
||||
log.info("当前节点状态为" + extAffair.getCtpAffairState());
|
||||
log.info("当前节点副状态为" + extAffair.getCtpAffairSubState());
|
||||
// 主状态为已发、已办、撤销、回退、取回、终止,状态为审批,进行数据处理
|
||||
if(isCtpAffairState(extAffair.getCtpAffairState())){
|
||||
JSONObject completed = new JSONObject();
|
||||
// 节点名称暂无法获取到位空
|
||||
completed.put("affairName","");
|
||||
long ctpAffairMemberId = extAffair.getCtpAffairMemberId();
|
||||
V3xOrgMember v3xOrgMember = orgManager.getMemberById(ctpAffairMemberId);
|
||||
AddressBook memberAddressBook = addressBookCustomerFieldInfoManager.getByMemberId(v3xOrgMember.getId());
|
||||
if(null == memberAddressBook) {
|
||||
log.info("人员自定义数据未维护,无法单点登录!");
|
||||
return;
|
||||
}
|
||||
JSONObject addressBookjson = AddressBookUtil.appleAddressBook(memberAddressBook,enumManagerNew);
|
||||
// 通过字段名称查询人员账号主数据数据库字段
|
||||
String extAttrName = srcFlowDao.getMetadataNameByLabel(extAttrLabel);
|
||||
String extAttrValue = addressBookjson.getString(extAttrName);
|
||||
log.info("查询对应人员账号"+extAttrValue);
|
||||
if(StringUtil.isEmpty(extAttrValue)){
|
||||
log.info(extAttrLabel+"未维护,无法单点登录!");
|
||||
return;
|
||||
}
|
||||
completed.put("affairMember",v3xOrgMember.getName());
|
||||
completed.put("affairMemberLoginName",v3xOrgMember.getLoginName());
|
||||
completed.put("affairMemberthirdPartyLoginName",extAttrValue);
|
||||
// 处理操作状态字段转换成对应状态
|
||||
completed.put("affairStatus",TransitionAffairUtil.extAffairAffairStatus(extAffair));
|
||||
completed.put("affairStatusTxt",TransitionAffairUtil.extAffairAffairStatusTxt(extAffair));
|
||||
// 处理时间
|
||||
System.out.println(extAffair.getCtpAffairCompleteDate());
|
||||
completed.put("completeTime", TimestampConverter.timestampToDateTime(extAffair.getCtpAffairCompleteDate()));
|
||||
// 是否最新处理,当前为处理日志,默认为flase
|
||||
completed.put("isLatest",true);
|
||||
completedList.add(completed);
|
||||
// 只对收个结果进行返回,参数处理完成则跳出当前循环
|
||||
break;
|
||||
}else{
|
||||
continue;
|
||||
}
|
||||
}
|
||||
// 保存流程处理信息
|
||||
jsonObject.put("completedList",completedList);
|
||||
|
||||
String thirdpartyCodeName = FieldUtil.isDisplayExists(frontFormmain,"第三方系统标识");
|
||||
String flowStatusCallbackUrlName = FieldUtil.isDisplayExists(frontFormmain,"流程审核状态回调地址");
|
||||
// 获取表单数据ID
|
||||
String formRecordid = summaryMap.get("form_recordid")==null?"":summaryMap.get("form_recordid").toString();
|
||||
// 设置表单查询字段
|
||||
String[] fieldNames = {tirdFlowIdName,thirdpartyCodeName,flowStatusCallbackUrlName};
|
||||
// 设置表单查询字段及结果
|
||||
Map<String,String> whereParam = new HashMap<>();
|
||||
whereParam.put("id",formRecordid);
|
||||
// 通过formmian表单及数据ID获取当前表单中的第三方系统唯一值字段
|
||||
List<Map<String,Object>> formmainDatas = srcFlowDao.getFormDataByParam(tableName,fieldNames,whereParam);
|
||||
if(formmainDatas.size()!=1){
|
||||
log.info("当前查询结果不唯一,请检查");
|
||||
return;
|
||||
}
|
||||
// 封装第三方系统流程唯一值字段
|
||||
Map<String,Object> map = formmainDatas.get(0);
|
||||
String tirdFlowId,flowStatusCallbackUrl,thirdpartyCode;
|
||||
if(map.size()>0){
|
||||
tirdFlowId = formmainDatas.get(0).get(tirdFlowIdName)==null?"":formmainDatas.get(0).get(tirdFlowIdName).toString();
|
||||
flowStatusCallbackUrl = formmainDatas.get(0).get(flowStatusCallbackUrlName)==null?"":formmainDatas.get(0).get(flowStatusCallbackUrlName).toString();
|
||||
thirdpartyCode = formmainDatas.get(0).get(thirdpartyCodeName)==null?"":formmainDatas.get(0).get(thirdpartyCodeName).toString();
|
||||
}else{
|
||||
tirdFlowId = "";
|
||||
flowStatusCallbackUrl = "";
|
||||
thirdpartyCode = "";
|
||||
}
|
||||
// 保存第三方流程ID数据
|
||||
jsonObject.put("thirdFlowId",tirdFlowId);
|
||||
// 设置当前待办审批列表,当前为审批触发不添加待办信息
|
||||
jsonObject.put("todoList",new JSONArray());
|
||||
// 设置的当前流程表单字段信息,此为流程审批过程回调不添加表单数据
|
||||
jsonObject.put("formInfo",new JSONObject());
|
||||
System.out.println(jsonObject);
|
||||
// 进行请求参数加密
|
||||
String paramValue = srcFlowDao.getThirdpartyParamByThirdpartyCode(thirdpartyCode);
|
||||
JSONObject paramjson = JSONObject.parseObject(paramValue);
|
||||
String secretKey = paramjson.getString("secretKey");
|
||||
String vi = paramjson.getString("vi");
|
||||
String datastr = jsonObject.toString();
|
||||
// 加密请求参数
|
||||
String encrypted = AesUtil.encrypt(datastr,secretKey,vi);
|
||||
long timestamp = new Date().getTime();
|
||||
// 生成随机数
|
||||
String nonce = UUIDUtil.getUUIDLong()+"";
|
||||
String signContent = encrypted + timestamp + nonce + secretKey;
|
||||
String sign = SignUtil.sha256(signContent);
|
||||
JSONObject param = new JSONObject();
|
||||
param.put("data",encrypted);
|
||||
param.put("timestamp",timestamp+"");
|
||||
param.put("nonce",nonce);
|
||||
param.put("sign",sign);
|
||||
// 调通接口推送数据到第三方系统
|
||||
String res = HttpClient.httpPostRaw(flowStatusCallbackUrl,param.toString(),new HashMap<String,String>(), null);
|
||||
JSONObject resultJSON = JSONObject.parseObject(res);
|
||||
String code = resultJSON.getString("code");
|
||||
if("0".equals(code)){
|
||||
log.info("推送结果成功");
|
||||
}else{
|
||||
log.info("推送结果失败");
|
||||
}
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
private boolean isCtpAffairState(int ctpAffairState){
|
||||
if(ctpAffairState ==2 || ctpAffairState == 4 || ctpAffairState == 5 || ctpAffairState == 6 || ctpAffairState == 7 ||
|
||||
ctpAffairState == 8 || ctpAffairState == 11 || ctpAffairState ==15){
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,14 +1,11 @@
|
||||
package com.seeyon.apps.src_flowIntegration.node;
|
||||
|
||||
import cn.hutool.log.Log;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.seeyon.apps.common.config.ICstConfigApi;
|
||||
import com.seeyon.apps.common.plugin.vo.ConfigVo;
|
||||
import com.seeyon.apps.common.workflow.constants.WorkFlowType;
|
||||
import com.seeyon.apps.common.workflow.node.ACommonSuperNode;
|
||||
import com.seeyon.apps.ext.workflow.vo.FieldDataVo;
|
||||
import com.seeyon.apps.ext.workflow.vo.FormDataVo;
|
||||
import com.seeyon.apps.ext.workflow.vo.SuperNodeContext;
|
||||
import com.seeyon.apps.src_flowIntegration.constants.FlowIntegrationConstants;
|
||||
@@ -70,10 +67,16 @@ public class FlowStatusCallbackNode extends ACommonSuperNode {
|
||||
JSONObject req = JSONObject.parseObject(request);
|
||||
String url = req.getString("flowStatusCallbackUrl");
|
||||
context.setUrl(url);
|
||||
|
||||
JSONObject datajson = new JSONObject();
|
||||
datajson.put("thirdFlowId",req.getString("thirdFlowId"));
|
||||
datajson.put("flowStatus","1");
|
||||
datajson.put("remark","流程结束");
|
||||
JSONObject flowInfo = new JSONObject();
|
||||
flowInfo.put("flowStatus","1");
|
||||
flowInfo.put("flowStatusTxt","流程结束");
|
||||
datajson.put("flowInfo",flowInfo);
|
||||
JSONObject formInfo = new JSONObject();
|
||||
// 封装流程表单信息
|
||||
datajson.put("formInfo",formInfo);
|
||||
context.setRequest(datajson.toString());
|
||||
// 进行请求参数加密
|
||||
String thirdpartyCode = req.getString("thirdpartyCode");
|
||||
@@ -103,7 +106,7 @@ public class FlowStatusCallbackNode extends ACommonSuperNode {
|
||||
if("0".equals(code)){
|
||||
context.success("流程状态回调成功!");
|
||||
}else{
|
||||
context.back("回调失败,请联系管理员处理");
|
||||
context.success("流程状态回调失败!");
|
||||
}
|
||||
return context;
|
||||
}
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
package com.seeyon.apps.src_flowIntegration.service;
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.seeyon.ctp.common.exceptions.BusinessException;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import www.seeyon.com.utils.StringUtil;
|
||||
|
||||
@@ -14,6 +16,8 @@ public class FlowIntegrationService {
|
||||
private ThirdSysBizMapService thirdSysBizMapService;
|
||||
@Autowired
|
||||
private OaFlowCreateService oaFlowCreateService;
|
||||
@Autowired
|
||||
private OaFlowQueryService oaFlowQueryService;
|
||||
|
||||
public JSONObject thirdFlowCreate(JSONObject jsonObject,String token) throws Exception {
|
||||
JSONObject res = new JSONObject();
|
||||
@@ -22,11 +26,9 @@ public class FlowIntegrationService {
|
||||
String flowStatusCallbackUrl = jsonObject.getString("flowStatusCallbackUrl");
|
||||
String flowAuditStatusCallbackUrl = jsonObject.getString("flowAuditStatusCallbackUrl");
|
||||
JSONObject data = jsonObject.getJSONObject("data");
|
||||
|
||||
JSONObject flowParam = new JSONObject();
|
||||
// 设置流程生成参数
|
||||
flowParam.put("appName","collaboration");
|
||||
|
||||
String templateCode = data.getString("templateCode");
|
||||
|
||||
String uniqueDataValidation = thirdSysBizMapService.uniqueDataValidation(tirdFlowId,templateCode);
|
||||
@@ -35,7 +37,6 @@ public class FlowIntegrationService {
|
||||
res.put("msg","当前第三方系统流程ID在当前表单中已经存在,提交失败。");
|
||||
return res;
|
||||
}
|
||||
|
||||
// 设置流程rightId字段信息
|
||||
String rightId = thirdSysBizMapService.getRightIdByTemplateCode(templateCode);
|
||||
data.put("rightId",rightId);
|
||||
@@ -54,6 +55,38 @@ public class FlowIntegrationService {
|
||||
res.put("code","0");
|
||||
res.put("oaFlowId",(String)result.get("processId"));
|
||||
return res;
|
||||
// return null;
|
||||
}
|
||||
|
||||
public JSONObject thirdFlowQuery(JSONObject jsonObject){
|
||||
JSONObject res = new JSONObject();
|
||||
String thirdpartyCode = jsonObject.getString("thirdpartyCode");//第三方系统标识
|
||||
String templateCode = jsonObject.getString("templateCode");//流程表单编码
|
||||
String thirdFlowId = jsonObject.getString("thirdFlowId");//第三方系统流程表单ID
|
||||
try {
|
||||
// 查询summaryId
|
||||
Map<String,String> colSummary = oaFlowQueryService.getColSummaryData(thirdpartyCode,templateCode,thirdFlowId);
|
||||
// 通过当前表单编码字段查询待办信息
|
||||
JSONArray todoList = oaFlowQueryService.getTodoList(String.valueOf (colSummary.get("id")));
|
||||
// 设置当前待办信息
|
||||
res.put("todoList",todoList);
|
||||
JSONArray completedList = oaFlowQueryService.getCompletedList(String.valueOf (colSummary.get("process_id")));
|
||||
// 设置当前已经执行流程记录
|
||||
res.put("completedList",completedList);
|
||||
JSONObject flowInfo = oaFlowQueryService.getFlowInfo(String.valueOf (colSummary.get("id")));
|
||||
// 设置当前流程状态信息
|
||||
res.put("flowInfo",flowInfo);
|
||||
// 设置第三方系统流程ID字段
|
||||
res.put("flowInfo",thirdFlowId);
|
||||
JSONObject formInfo = oaFlowQueryService.getFormInfo(colSummary);
|
||||
// 设置流程表单数据
|
||||
res.put("formInfo",formInfo);
|
||||
} catch (BusinessException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,469 @@
|
||||
package com.seeyon.apps.src_flowIntegration.service;
|
||||
|
||||
import cn.hutool.log.Log;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.seeyon.apps.addressbook.manager.AddressBookCustomerFieldInfoManager;
|
||||
import com.seeyon.apps.addressbook.po.AddressBook;
|
||||
import com.seeyon.apps.src_flowIntegration.config.FlowIntegrationConfigProvider;
|
||||
import com.seeyon.apps.src_flowIntegration.constants.FlowIntegrationConstants;
|
||||
import com.seeyon.apps.src_flowIntegration.dao.SrcFlowDao;
|
||||
import com.seeyon.apps.src_flowIntegration.listener.FlowEventListener;
|
||||
import com.seeyon.apps.src_flowIntegration.util.AddressBookUtil;
|
||||
import com.seeyon.apps.src_flowIntegration.util.FieldUtil;
|
||||
import com.seeyon.apps.src_flowIntegration.util.TimestampConverter;
|
||||
import com.seeyon.apps.src_flowIntegration.util.TransitionAffairUtil;
|
||||
import com.seeyon.ctp.common.ctpenumnew.manager.EnumManager;
|
||||
import com.seeyon.ctp.common.exceptions.BusinessException;
|
||||
import com.seeyon.ctp.common.po.ctpenumnew.CtpEnumItem;
|
||||
import com.seeyon.ctp.organization.bo.*;
|
||||
import com.seeyon.ctp.organization.manager.OrgManager;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import www.seeyon.com.utils.StringUtil;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import java.time.ZoneId;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public class OaFlowQueryService {
|
||||
|
||||
private static Log log = Log.get(FlowEventListener.class);
|
||||
|
||||
@Autowired
|
||||
private FlowIntegrationConfigProvider configProvider;
|
||||
@Inject
|
||||
private SrcFlowDao srcFlowDao;
|
||||
@Inject
|
||||
private OrgManager orgManager;
|
||||
@Inject
|
||||
private AddressBookCustomerFieldInfoManager addressBookCustomerFieldInfoManager;
|
||||
@Inject
|
||||
private EnumManager enumManagerNew;
|
||||
|
||||
/**
|
||||
* 通过第三方相关数据查询对应流程ColSummary相关数据
|
||||
* @param thirdpartyCode 第三个系统标识
|
||||
* @param templateCode 流程表单编码
|
||||
* @param thirdFlowId 第三个系统流程表单ID
|
||||
* @return 数据库map对象,主要数据来源于col_summary字段信息
|
||||
*/
|
||||
public Map<String,String> getColSummaryData(String thirdpartyCode,String templateCode,String thirdFlowId){
|
||||
// 先根据流程表单编码字段查询流程表单信息
|
||||
// 在通过流程表单信息查询当前流程表中唯一值字段及数据库表单名称
|
||||
// 在通过第三方系统编码和流程表单ID字段查询对应的流程表单数据ID
|
||||
// 在通过流程表单数据ID查询当前数据的summaryId信息
|
||||
// 查询流程表单ID
|
||||
String formAppid = srcFlowDao.getFormIdByTemplateCode(templateCode);
|
||||
// 查询流程表单字段信息
|
||||
String fieldInfo = srcFlowDao.getFieldInfoByFormId(formAppid);
|
||||
JSONObject fieldJSON = JSONObject.parseObject(fieldInfo);
|
||||
JSONObject frontFormmain = fieldJSON.getJSONObject("front_formmain");
|
||||
// 获取需要查询到的数据库字段
|
||||
String tableName = frontFormmain.getString("tableName");
|
||||
String thirdpartyCodeName = FieldUtil.isDisplayExists(frontFormmain,"第三方系统标识");
|
||||
String thirdFlowIdName = FieldUtil.isDisplayExists(frontFormmain,"第三方系统流程ID");
|
||||
// 查询对应数据唯一值 String tableName,String[] fieldNames,Map<String,String> params
|
||||
// 设置查询字段
|
||||
String[] fieldNames = {"id"};
|
||||
// 设置查询参数信息
|
||||
Map<String,String> whereString = new HashMap<>();
|
||||
whereString.put(thirdpartyCodeName,thirdpartyCode);
|
||||
whereString.put(thirdFlowIdName,thirdFlowId);
|
||||
List<Map<String,Object>> formDatas = srcFlowDao.getFormDataByParam(tableName,fieldNames,whereString);
|
||||
String formDataId = "";
|
||||
if(formDatas.size()==1){
|
||||
Map<String,Object> formData = formDatas.get(0);
|
||||
formDataId = formData.get("id")==null?"":formData.get("id").toString();
|
||||
}
|
||||
// 通过数据ID查询对应流程表单查询到一应colSummary数据库信息,通过process_id查询col_summary数据库表信息。
|
||||
Map<String,String> colSummary = srcFlowDao.getColSummaryByFormRecordid(formDataId);
|
||||
return colSummary;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
*通过summaryId查询ctp_affair数据获取待办待办列表信息
|
||||
* @param summaryId
|
||||
* @return
|
||||
*/
|
||||
public JSONArray getTodoList(String summaryId) throws BusinessException {
|
||||
// 获取系统内置参数第三方系统主数据字段信息
|
||||
String extAttrLabel = configProvider.getBizConfigByKey(FlowIntegrationConstants.extAttrLabel);
|
||||
JSONArray todoList = new JSONArray();
|
||||
// 通过summaryId查询,查询当前流程个人事项信息
|
||||
List<Map<String,String>> ctpAffairs = srcFlowDao.getCtpAffairBySummaryId(summaryId);
|
||||
for (Map<String,String> ctpAffairMap :ctpAffairs){
|
||||
String state = ctpAffairMap.get("state");
|
||||
if("3".equals(state)){
|
||||
String memberId = ctpAffairMap.get("memberId");
|
||||
if(StringUtil.isNotEmpty(memberId)){
|
||||
V3xOrgMember v3xOrgMember = orgManager.getMemberById(Long.parseLong(memberId));
|
||||
AddressBook memberAddressBook = addressBookCustomerFieldInfoManager.getByMemberId(v3xOrgMember.getId());
|
||||
if(null == memberAddressBook) {
|
||||
log.info("人员自定义数据未维护,无法单点登录!");
|
||||
continue;
|
||||
}
|
||||
JSONObject addressBookjson = AddressBookUtil.appleAddressBook(memberAddressBook,enumManagerNew);
|
||||
// 通过字段名称查询人员账号主数据数据库字段
|
||||
String extAttrName = srcFlowDao.getMetadataNameByLabel(extAttrLabel);
|
||||
String extAttrValue = addressBookjson.getString(extAttrName);
|
||||
log.info("查询对应人员账号"+extAttrValue);
|
||||
if(StringUtil.isEmpty(extAttrValue)){
|
||||
log.info(extAttrLabel+"未维护,无法单点登录!");
|
||||
continue;
|
||||
}
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
jsonObject.put("affairName","");
|
||||
jsonObject.put("affairMember",v3xOrgMember.getName());
|
||||
jsonObject.put("affairMemberLoginName",v3xOrgMember.getLoginName());
|
||||
jsonObject.put("affairMemberthirdPartyLoginName",extAttrValue);
|
||||
jsonObject.put("affairStatus","3");
|
||||
jsonObject.put("affairStatusTxt","待办");
|
||||
todoList.add(jsonObject);
|
||||
}
|
||||
}
|
||||
}
|
||||
return todoList;
|
||||
}
|
||||
|
||||
/**
|
||||
*通过processId查询ctp_process_log数据获取待办待办列表信息
|
||||
* @param processId
|
||||
* @return
|
||||
*/
|
||||
public JSONArray getCompletedList(String processId) throws BusinessException {
|
||||
// 获取系统内置参数第三方系统主数据字段信息
|
||||
String extAttrLabel = configProvider.getBizConfigByKey(FlowIntegrationConstants.extAttrLabel);
|
||||
JSONArray completedList = new JSONArray();
|
||||
List<Map<String,String>> processLogs = srcFlowDao.getProcessLogsByProcessId(processId);
|
||||
for(Map<String,String> processLogMap : processLogs){
|
||||
String actionId = processLogMap.get("actionId");
|
||||
if(StringUtil.isNotEmpty(actionId)){
|
||||
String actionUserId = processLogMap.get("actionUserId");
|
||||
if(StringUtil.isNotEmpty(actionUserId)){
|
||||
V3xOrgMember v3xOrgMember = orgManager.getMemberById(Long.parseLong(actionUserId));
|
||||
AddressBook memberAddressBook = addressBookCustomerFieldInfoManager.getByMemberId(v3xOrgMember.getId());
|
||||
if(null == memberAddressBook) {
|
||||
log.info("人员自定义数据未维护,无法单点登录!");
|
||||
continue;
|
||||
}
|
||||
JSONObject addressBookjson = AddressBookUtil.appleAddressBook(memberAddressBook,enumManagerNew);
|
||||
// 通过字段名称查询人员账号主数据数据库字段
|
||||
String extAttrName = srcFlowDao.getMetadataNameByLabel(extAttrLabel);
|
||||
String extAttrValue = addressBookjson.getString(extAttrName);
|
||||
log.info("查询对应人员账号"+extAttrValue);
|
||||
if(StringUtil.isEmpty(extAttrValue)){
|
||||
log.info(extAttrLabel+"未维护,无法单点登录!");
|
||||
continue;
|
||||
}
|
||||
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
jsonObject.put("affairName","");
|
||||
jsonObject.put("affairMember",v3xOrgMember.getName());
|
||||
jsonObject.put("affairMemberLoginName",v3xOrgMember.getLoginName());
|
||||
jsonObject.put("affairMemberthirdPartyLoginName",extAttrValue);
|
||||
// 获取的都是待办信息,只有待办信息进行输出
|
||||
jsonObject.put("affairStatus", TransitionAffairUtil.actionIdTransitionAffairStatus(actionId));
|
||||
jsonObject.put("affairStatusTxt", TransitionAffairUtil.actionIdTransitionAffairStatusTxt(actionId));
|
||||
jsonObject.put("completeTime",processLogMap.get("actionTime"));
|
||||
jsonObject.put("isLatest",true);
|
||||
completedList.add(jsonObject);
|
||||
}
|
||||
}
|
||||
}
|
||||
return completedList;
|
||||
}
|
||||
|
||||
/**
|
||||
*通过summaryId查询当前表单的数据设置封装数据
|
||||
* @param summaryId
|
||||
* @return
|
||||
*/
|
||||
public JSONObject getFlowInfo(String summaryId){
|
||||
JSONObject flowInfo = new JSONObject();
|
||||
// 通过sumnmary查询流程参数信息
|
||||
Map<String,Object> colSummary = srcFlowDao.getColSummaryById(summaryId);
|
||||
String state = colSummary.get("state")==null?"":colSummary.get("state").toString();
|
||||
flowInfo.put("flowStatus",TransitionAffairUtil.colSummaryStateFlowState(state));
|
||||
flowInfo.put("flowStatusTxt",TransitionAffairUtil.colSummaryStateFlowStateTxt(state));
|
||||
return flowInfo;
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过summaryId对应表单的数据,并且封装成指定格式刷数据
|
||||
* @param colSummary
|
||||
* @return
|
||||
*/
|
||||
public JSONObject getFormInfo(Map<String,String> colSummary) throws BusinessException {
|
||||
// 根据formAppid查询字段参数信息
|
||||
String fieldInfoStr = srcFlowDao.getFieldInfoByFormId(String.valueOf(colSummary.get("form_appid")));
|
||||
JSONObject fieldInfoJson = JSONObject.parseObject(fieldInfoStr);
|
||||
// 检索字段信息,将数据查询完成并封装数据
|
||||
// 查询主表表单名称
|
||||
JSONObject frontFormmain = fieldInfoJson.getJSONObject("front_formmain");
|
||||
String formmainName = frontFormmain.getString("tableName");
|
||||
JSONArray fieldInfo = frontFormmain.getJSONArray("fieldInfo");
|
||||
// 整理主表字段
|
||||
List<String> fieldNames = new ArrayList<>();
|
||||
for(int i = 0 ; i < fieldInfo.size();i++){
|
||||
JSONObject field = fieldInfo.getJSONObject(i);
|
||||
String fieldName = field.getString("name");
|
||||
fieldNames.add(fieldName);
|
||||
}
|
||||
String[] fieldNameString = fieldNames.toArray(new String[fieldNames.size()]);
|
||||
|
||||
Map<String,String> formmainParam = new HashMap<>();
|
||||
String formmainId = colSummary.get("form_recordid")==null?"":String.valueOf(colSummary.get("form_recordid"));
|
||||
formmainParam.put("id",formmainId);
|
||||
List<Map<String,Object>> formmainDatas = srcFlowDao.getFormDataByParam(formmainName,fieldNameString,formmainParam);
|
||||
Map<String,Object> formmainData = formmainDatas.get(0);
|
||||
// 设置主表字段
|
||||
JSONObject masterTable = toMasterTable(formmainName,fieldInfo,formmainData);
|
||||
// 查询从表表单数据
|
||||
JSONArray formsons = fieldInfoJson.getJSONArray("formsons");
|
||||
JSONObject subTables = new JSONObject();
|
||||
for(int i = 0 ; i < formsons.size() ;i++){
|
||||
JSONObject formson = formsons.getJSONObject(i);
|
||||
String formsonName = formson.getString("tableName");
|
||||
// 整理明细明细表字段
|
||||
List<String> subFieldNames = new ArrayList<>();
|
||||
JSONArray subFieldInfo = formson.getJSONArray("fieldInfo");
|
||||
for(int n = 0 ; n < subFieldInfo.size();n++){
|
||||
JSONObject field = subFieldInfo.getJSONObject(n);
|
||||
String subFieldName = field.getString("name");
|
||||
subFieldNames.add(subFieldName);
|
||||
}
|
||||
String[] subFieldNameString = subFieldNames.toArray(new String[subFieldNames.size()]);
|
||||
|
||||
Map<String,String> formsonParam = new HashMap<>();
|
||||
formsonParam.put("formmain_id",formmainId);
|
||||
List<Map<String,Object>> formsonDatas = srcFlowDao.getFormDataByParam(formsonName,subFieldNameString,formsonParam);
|
||||
// 设置从表数据
|
||||
JSONObject subTable = toSubTable(formsonName,subFieldInfo,formsonDatas);
|
||||
subTables.putAll(subTable);
|
||||
}
|
||||
|
||||
JSONObject formInfo = new JSONObject();
|
||||
// 保存主表字段数据
|
||||
formInfo.put("masterTable",masterTable);
|
||||
// 保存从表字段数据
|
||||
formInfo.put("subTables",subTables);
|
||||
|
||||
return formInfo;
|
||||
}
|
||||
|
||||
private JSONObject toMasterTable(String masterTableName,JSONArray fieldInfo,Map<String,Object> formmainData) throws BusinessException {
|
||||
JSONObject masterTable = new JSONObject();
|
||||
JSONArray masterFieldData = new JSONArray();
|
||||
// 遍历主表所有字段
|
||||
for(int i = 0 ; i < fieldInfo.size();i++){
|
||||
JSONObject fieldInfoData = fieldInfo.getJSONObject(i);
|
||||
String fieldName = fieldInfoData.getString("name");
|
||||
JSONObject mainFieldData = new JSONObject();
|
||||
mainFieldData.put("name",fieldName);
|
||||
mainFieldData.put("display",fieldInfoData.get("display"));
|
||||
mainFieldData.put("value",formmainData.get(fieldName));
|
||||
// 判断字段类型,如果字段类型是附件则跳过当前字段
|
||||
if("image".equals(fieldInfoData.getString("type"))||"attachment".equals(fieldInfoData.getString("type"))){
|
||||
continue;
|
||||
}else if ("date".equals(fieldInfoData.getString("type"))){
|
||||
if(formmainData.get(fieldName)!=null){
|
||||
String dateStr = TimestampConverter.longToDateStr(Long.parseLong(formmainData.get(fieldName).toString()));
|
||||
mainFieldData.put("showvalue",dateStr);
|
||||
}else{
|
||||
continue;
|
||||
}
|
||||
}else if ("dateTime".equals(fieldInfoData.getString("type"))){
|
||||
if(formmainData.get(fieldName)!=null){
|
||||
String dateTimeStr = TimestampConverter.longToDateTimeStr(Long.parseLong(formmainData.get(fieldName).toString()));
|
||||
mainFieldData.put("showvalue",dateTimeStr);
|
||||
}else{
|
||||
continue;
|
||||
}
|
||||
}else if ("account".equals(fieldInfoData.getString("type"))){
|
||||
if(formmainData.get(fieldName)!=null){
|
||||
V3xOrgAccount v3xOrgAccount = orgManager.getAccountById(Long.parseLong(formmainData.get(fieldName).toString()));
|
||||
mainFieldData.put("showvalue",v3xOrgAccount==null?"":v3xOrgAccount.getName());
|
||||
}else{
|
||||
continue;
|
||||
}
|
||||
}else if ("department".equals(fieldInfoData.getString("type"))){
|
||||
if(formmainData.get(fieldName)!=null){
|
||||
V3xOrgDepartment v3xOrgDepartment = orgManager.getDepartmentById(Long.parseLong(formmainData.get(fieldName).toString()));
|
||||
mainFieldData.put("showvalue",v3xOrgDepartment==null?"":v3xOrgDepartment.getName());
|
||||
}else{
|
||||
continue;
|
||||
}
|
||||
}else if ("member".equals(fieldInfoData.getString("type"))){
|
||||
if(formmainData.get(fieldName)!=null){
|
||||
V3xOrgMember v3xOrgMember = orgManager.getMemberById(Long.parseLong(formmainData.get(fieldName).toString()));
|
||||
mainFieldData.put("showvalue",v3xOrgMember==null?"":v3xOrgMember.getName());
|
||||
}else{
|
||||
continue;
|
||||
}
|
||||
}else if ("post".equals(fieldInfoData.getString("type"))){
|
||||
if(formmainData.get(fieldName)!=null){
|
||||
V3xOrgPost v3xOrgPost = orgManager.getPostById(Long.parseLong(formmainData.get(fieldName).toString()));
|
||||
mainFieldData.put("showvalue",v3xOrgPost==null?"":v3xOrgPost.getName());
|
||||
}else{
|
||||
continue;
|
||||
}
|
||||
}else if ("level".equals(fieldInfoData.getString("type"))){
|
||||
if(formmainData.get(fieldName)!=null){
|
||||
V3xOrgLevel v3xOrgLevel = orgManager.getLevelById(Long.parseLong(formmainData.get(fieldName).toString()));
|
||||
mainFieldData.put("showvalue",v3xOrgLevel==null?"":v3xOrgLevel.getName());
|
||||
}else{
|
||||
continue;
|
||||
}
|
||||
}else if ("multiselect".equals(fieldInfoData.getString("type"))){
|
||||
// 下拉多选
|
||||
String value = String.valueOf(formmainData.get(fieldName));
|
||||
String[] values = value.split(",");
|
||||
StringBuilder showvalue = new StringBuilder();
|
||||
for(int n = 0 ; n < values.length;n++){
|
||||
CtpEnumItem ctpEnumItem = enumManagerNew.getCtpEnumItem(Long.parseLong(value));
|
||||
if(ctpEnumItem!=null){
|
||||
showvalue.append(ctpEnumItem.getShowvalue()).append(',');
|
||||
}
|
||||
}
|
||||
if(showvalue.length()>0){
|
||||
showvalue.deleteCharAt(showvalue.length() - 1);
|
||||
formmainData.put("showvalue",showvalue.toString());
|
||||
}else{
|
||||
continue;
|
||||
}
|
||||
}else if ("select".equals(fieldInfoData.getString("type"))){
|
||||
// 下拉单选
|
||||
String value = String.valueOf(formmainData.get(fieldName));
|
||||
CtpEnumItem ctpEnumItem = enumManagerNew.getCtpEnumItem(Long.parseLong(value));
|
||||
if(ctpEnumItem!=null){
|
||||
formmainData.put("showvalue",ctpEnumItem.getShowvalue());
|
||||
}else{
|
||||
continue;
|
||||
}
|
||||
}else{
|
||||
if(formmainData.get(fieldName)!=null){
|
||||
mainFieldData.put("showvalue",formmainData.get(fieldName));
|
||||
}else{
|
||||
continue;
|
||||
}
|
||||
}
|
||||
masterFieldData.add(mainFieldData);
|
||||
}
|
||||
masterTable.put(masterTableName,masterFieldData);
|
||||
|
||||
return masterTable;
|
||||
}
|
||||
|
||||
private JSONObject toSubTable(String formsonName,JSONArray subFieldInfo,List<Map<String,Object>> formsonDatas) throws BusinessException {
|
||||
// 创建返回值信息
|
||||
JSONArray subFieldData = new JSONArray();
|
||||
for(Map<String,Object> formsonData :formsonDatas){
|
||||
JSONArray formsonDataRow = new JSONArray();
|
||||
for(int i = 0 ; i < subFieldInfo.size();i++){
|
||||
JSONObject fieldData = new JSONObject();
|
||||
// 获取当前需要处理的字段
|
||||
JSONObject subField = subFieldInfo.getJSONObject(i);
|
||||
String fieldName = subField.getString("name");
|
||||
|
||||
fieldData.put("name",fieldName);
|
||||
fieldData.put("display",subField.getString("display"));
|
||||
fieldData.put("value",formsonData.get(subField.getString("name"))==null?"":formsonData.get(subField.getString("name")));
|
||||
if("image".equals(subField.getString("type"))||"attachment".equals(subField.getString("type"))){
|
||||
continue;
|
||||
}else if ("date".equals(subField.getString("type"))){
|
||||
if(formsonData.get(fieldName)!=null){
|
||||
String dateStr = TimestampConverter.longToDateStr(Long.parseLong(formsonData.get(fieldName).toString()));
|
||||
fieldData.put("showvalue",dateStr);
|
||||
}else{
|
||||
continue;
|
||||
}
|
||||
}else if ("dateTime".equals(subField.getString("type"))){
|
||||
if(formsonData.get(fieldName)!=null){
|
||||
String dateTimeStr = TimestampConverter.longToDateTimeStr(Long.parseLong(formsonData.get(fieldName).toString()));
|
||||
fieldData.put("showvalue",dateTimeStr);
|
||||
}else{
|
||||
continue;
|
||||
}
|
||||
}else if ("account".equals(subField.getString("type"))){
|
||||
if(formsonData.get(fieldName)!=null){
|
||||
V3xOrgAccount v3xOrgAccount = orgManager.getAccountById(Long.parseLong(formsonData.get(fieldName).toString()));
|
||||
fieldData.put("showvalue",v3xOrgAccount==null?"":v3xOrgAccount.getName());
|
||||
}else{
|
||||
continue;
|
||||
}
|
||||
}else if ("department".equals(subField.getString("type"))){
|
||||
if(formsonData.get(fieldName)!=null){
|
||||
V3xOrgDepartment v3xOrgDepartment = orgManager.getDepartmentById(Long.parseLong(formsonData.get(fieldName).toString()));
|
||||
fieldData.put("showvalue",v3xOrgDepartment==null?"":v3xOrgDepartment.getName());
|
||||
}else{
|
||||
continue;
|
||||
}
|
||||
}else if ("member".equals(subField.getString("type"))){
|
||||
if(formsonData.get(fieldName)!=null){
|
||||
V3xOrgMember v3xOrgMember = orgManager.getMemberById(Long.parseLong(formsonData.get(fieldName).toString()));
|
||||
fieldData.put("showvalue",v3xOrgMember==null?"":v3xOrgMember.getName());
|
||||
}else{
|
||||
continue;
|
||||
}
|
||||
}else if ("post".equals(subField.getString("type"))){
|
||||
if(formsonData.get(fieldName)!=null){
|
||||
V3xOrgPost v3xOrgPost = orgManager.getPostById(Long.parseLong(formsonData.get(fieldName).toString()));
|
||||
fieldData.put("showvalue",v3xOrgPost==null?"":v3xOrgPost.getName());
|
||||
}else{
|
||||
continue;
|
||||
}
|
||||
}else if ("level".equals(subField.getString("type"))){
|
||||
if(formsonData.get(fieldName)!=null){
|
||||
V3xOrgLevel v3xOrgLevel = orgManager.getLevelById(Long.parseLong(formsonData.get(fieldName).toString()));
|
||||
fieldData.put("showvalue",v3xOrgLevel==null?"":v3xOrgLevel.getName());
|
||||
}else{
|
||||
continue;
|
||||
}
|
||||
}else if ("multiselect".equals(subField.getString("type"))){
|
||||
// 下拉多选
|
||||
String value = String.valueOf(formsonData.get(fieldName));
|
||||
String[] values = value.split(",");
|
||||
StringBuilder showvalue = new StringBuilder();
|
||||
for(int n = 0 ; n < values.length;n++){
|
||||
CtpEnumItem ctpEnumItem = enumManagerNew.getCtpEnumItem(Long.parseLong(values[n]));
|
||||
if(ctpEnumItem!=null){
|
||||
showvalue.append(ctpEnumItem.getShowvalue()).append(',');
|
||||
}
|
||||
}
|
||||
if(showvalue.length()>0){
|
||||
showvalue.deleteCharAt(showvalue.length() - 1);
|
||||
fieldData.put("showvalue",showvalue.toString());
|
||||
}else{
|
||||
continue;
|
||||
}
|
||||
}else if ("select".equals(subField.getString("type"))){
|
||||
// 下拉单选
|
||||
String value = String.valueOf(formsonData.get(fieldName));
|
||||
CtpEnumItem ctpEnumItem = enumManagerNew.getCtpEnumItem(Long.parseLong(value));
|
||||
if(ctpEnumItem!=null){
|
||||
fieldData.put("showvalue",ctpEnumItem.getShowvalue());
|
||||
}else{
|
||||
continue;
|
||||
}
|
||||
}else{
|
||||
if(formsonData.get(fieldName)!=null){
|
||||
fieldData.put("showvalue",formsonData.get(fieldName));
|
||||
}else{
|
||||
continue;
|
||||
}
|
||||
}
|
||||
formsonDataRow.add(fieldData);
|
||||
}
|
||||
subFieldData.add(formsonDataRow);
|
||||
}
|
||||
JSONObject subTable = new JSONObject();
|
||||
subTable.put(formsonName,subFieldData);
|
||||
return subTable;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,6 +1,5 @@
|
||||
package com.seeyon.apps.src_flowIntegration.service;
|
||||
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.seeyon.apps.src_flowIntegration.dao.SrcFlowDao;
|
||||
@@ -9,7 +8,6 @@ import www.seeyon.com.utils.StringUtil;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
|
||||
public class ThirdSysBizMapService {
|
||||
|
||||
@Inject
|
||||
@@ -20,7 +18,6 @@ public class ThirdSysBizMapService {
|
||||
return formId;
|
||||
}
|
||||
|
||||
|
||||
// 根据表单编号获取表单rightId
|
||||
public String getRightIdByTemplateCode(String templateCode){
|
||||
// 根据templateCode查询表单rightId和固定字段信息,rightId格式为viewId.authId
|
||||
@@ -65,8 +62,8 @@ public class ThirdSysBizMapService {
|
||||
String thirdpartyCodeName = FieldUtil.isDisplayExists(frontFormmain,"第三方系统标识");
|
||||
if(StringUtil.isNotEmpty(thirdpartyCodeName)){
|
||||
JSONObject thirdpartyCodejson = new JSONObject();
|
||||
thirdpartyCodejson.put("name",tirdFlowIdName);
|
||||
thirdpartyCodejson.put("value",tirdFlowId);
|
||||
thirdpartyCodejson.put("name",thirdpartyCodeName);
|
||||
thirdpartyCodejson.put("value",thirdpartyCode);
|
||||
fields.add(thirdpartyCodejson);
|
||||
}
|
||||
// 插入流程状态回调地址字段
|
||||
@@ -85,7 +82,6 @@ public class ThirdSysBizMapService {
|
||||
flowAuditStatusCallbackUrljson.put("value",flowAuditStatusCallbackUrl);
|
||||
fields.add(flowAuditStatusCallbackUrljson);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public String uniqueDataValidation(String tirdFlowId,String templateCode){
|
||||
@@ -103,12 +99,6 @@ public class ThirdSysBizMapService {
|
||||
// 通过表单名称,唯一值字段,当前数据,查询当前数据是否在当前表单中是否存在
|
||||
String uniqueData = srcFlowDao.uniqueDataValidation(tableName,tirdFlowIdName,tirdFlowId);
|
||||
return uniqueData;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ package com.seeyon.apps.src_flowIntegration.util;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.seeyon.apps.addressbook.po.AddressBook;
|
||||
import com.seeyon.ctp.common.ctpenumnew.manager.EnumManager;
|
||||
import com.seeyon.ctp.common.exceptions.BusinessException;
|
||||
import com.seeyon.ctp.common.po.ctpenumnew.CtpEnumItem;
|
||||
import www.seeyon.com.utils.StringUtil;
|
||||
@@ -10,6 +11,162 @@ import java.text.SimpleDateFormat;
|
||||
|
||||
public class AddressBookUtil {
|
||||
|
||||
public static JSONObject appleAddressBook(AddressBook addressBook, EnumManager enumManagerNew) throws BusinessException {
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
if(StringUtil.isNotEmpty(addressBook.getExtAttr1())){
|
||||
jsonObject.put("EXT_ATTR_1",addressBook.getExtAttr1());
|
||||
}if(StringUtil.isNotEmpty(addressBook.getExtAttr2())){
|
||||
jsonObject.put("EXT_ATTR_2",addressBook.getExtAttr2());
|
||||
}if(StringUtil.isNotEmpty(addressBook.getExtAttr3())){
|
||||
jsonObject.put("EXT_ATTR_3",addressBook.getExtAttr3());
|
||||
}if(StringUtil.isNotEmpty(addressBook.getExtAttr4())){
|
||||
jsonObject.put("EXT_ATTR_4",addressBook.getExtAttr4());
|
||||
}if(StringUtil.isNotEmpty(addressBook.getExtAttr5())){
|
||||
jsonObject.put("EXT_ATTR_5",addressBook.getExtAttr5());
|
||||
}if(StringUtil.isNotEmpty(addressBook.getExtAttr6())){
|
||||
jsonObject.put("EXT_ATTR_6",addressBook.getExtAttr6());
|
||||
}if(StringUtil.isNotEmpty(addressBook.getExtAttr7())){
|
||||
jsonObject.put("EXT_ATTR_7",addressBook.getExtAttr7());
|
||||
}if(StringUtil.isNotEmpty(addressBook.getExtAttr8())){
|
||||
jsonObject.put("EXT_ATTR_8",addressBook.getExtAttr8());
|
||||
}if(StringUtil.isNotEmpty(addressBook.getExtAttr9())){
|
||||
jsonObject.put("EXT_ATTR_9",addressBook.getExtAttr9());
|
||||
}if(StringUtil.isNotEmpty(addressBook.getExtAttr10())){
|
||||
jsonObject.put("EXT_ATTR_10",addressBook.getExtAttr10());
|
||||
}if( addressBook.getExtAttr11()!=null){
|
||||
jsonObject.put("EXT_ATTR_11",addressBook.getExtAttr11());
|
||||
}if( addressBook.getExtAttr12()!=null){
|
||||
jsonObject.put("EXT_ATTR_12",addressBook.getExtAttr12());
|
||||
}if(addressBook.getExtAttr13()!=null){
|
||||
jsonObject.put("EXT_ATTR_13",addressBook.getExtAttr13());
|
||||
}if(addressBook.getExtAttr14()!=null){
|
||||
jsonObject.put("EXT_ATTR_14",addressBook.getExtAttr14());
|
||||
}if(addressBook.getExtAttr15()!=null){
|
||||
jsonObject.put("EXT_ATTR_15",addressBook.getExtAttr15());
|
||||
}if(addressBook.getExtAttr16()!=null){
|
||||
jsonObject.put("EXT_ATTR_16",addressBook.getExtAttr16());
|
||||
}if(addressBook.getExtAttr17()!=null){
|
||||
jsonObject.put("EXT_ATTR_17",addressBook.getExtAttr17());
|
||||
}if(addressBook.getExtAttr18()!=null){
|
||||
jsonObject.put("EXT_ATTR_18",addressBook.getExtAttr18());
|
||||
}if(addressBook.getExtAttr19()!=null){
|
||||
jsonObject.put("EXT_ATTR_19",addressBook.getExtAttr19());
|
||||
}if(addressBook.getExtAttr20()!=null){
|
||||
jsonObject.put("EXT_ATTR_20",addressBook.getExtAttr20());
|
||||
}if(addressBook.getExtAttr21()!=null){
|
||||
jsonObject.put("EXT_ATTR_21",sdf.format(addressBook.getExtAttr21()));
|
||||
}if(addressBook.getExtAttr22()!=null){
|
||||
jsonObject.put("EXT_ATTR_22",sdf.format(addressBook.getExtAttr22()));
|
||||
}if(addressBook.getExtAttr23()!=null){
|
||||
jsonObject.put("EXT_ATTR_23",sdf.format(addressBook.getExtAttr23()));
|
||||
}if(addressBook.getExtAttr24()!=null){
|
||||
jsonObject.put("EXT_ATTR_24",sdf.format(addressBook.getExtAttr24()));
|
||||
}if(addressBook.getExtAttr25()!=null){
|
||||
jsonObject.put("EXT_ATTR_25",sdf.format(addressBook.getExtAttr25()));
|
||||
}if(addressBook.getExtAttr26()!=null){
|
||||
jsonObject.put("EXT_ATTR_26",sdf.format(addressBook.getExtAttr26()));
|
||||
}if(addressBook.getExtAttr27()!=null){
|
||||
jsonObject.put("EXT_ATTR_27",sdf.format(addressBook.getExtAttr27()));
|
||||
}if(addressBook.getExtAttr28()!=null){
|
||||
jsonObject.put("EXT_ATTR_28",sdf.format(addressBook.getExtAttr28()));
|
||||
}if(addressBook.getExtAttr29()!=null){
|
||||
jsonObject.put("EXT_ATTR_29",sdf.format(addressBook.getExtAttr29()));
|
||||
}if(addressBook.getExtAttr30()!=null){
|
||||
jsonObject.put("EXT_ATTR_30",sdf.format(addressBook.getExtAttr30()));
|
||||
}if(StringUtil.isNotEmpty(addressBook.getExtAttr31())){
|
||||
CtpEnumItem ctpEnumItem = enumManagerNew.getCtpEnumItem(Long.parseLong(addressBook.getExtAttr31()));
|
||||
jsonObject.put("EXT_ATTR_31",ctpEnumItem.getShowvalue());
|
||||
}if(StringUtil.isNotEmpty(addressBook.getExtAttr32())){
|
||||
CtpEnumItem ctpEnumItem = enumManagerNew.getCtpEnumItem(Long.parseLong(addressBook.getExtAttr32()));
|
||||
jsonObject.put("EXT_ATTR_32",ctpEnumItem.getShowvalue());
|
||||
}if(StringUtil.isNotEmpty(addressBook.getExtAttr33())){
|
||||
CtpEnumItem ctpEnumItem = enumManagerNew.getCtpEnumItem(Long.parseLong(addressBook.getExtAttr33()));
|
||||
jsonObject.put("EXT_ATTR_33",ctpEnumItem.getShowvalue());
|
||||
}if(StringUtil.isNotEmpty(addressBook.getExtAttr34())){
|
||||
CtpEnumItem ctpEnumItem = enumManagerNew.getCtpEnumItem(Long.parseLong(addressBook.getExtAttr34()));
|
||||
jsonObject.put("EXT_ATTR_34",ctpEnumItem.getShowvalue());
|
||||
}if(StringUtil.isNotEmpty(addressBook.getExtAttr35())){
|
||||
CtpEnumItem ctpEnumItem = enumManagerNew.getCtpEnumItem(Long.parseLong(addressBook.getExtAttr35()));
|
||||
jsonObject.put("EXT_ATTR_35",ctpEnumItem.getShowvalue());
|
||||
}if(StringUtil.isNotEmpty(addressBook.getExtAttr36())){
|
||||
CtpEnumItem ctpEnumItem = enumManagerNew.getCtpEnumItem(Long.parseLong(addressBook.getExtAttr36()));
|
||||
jsonObject.put("EXT_ATTR_36",ctpEnumItem.getShowvalue());
|
||||
}if(StringUtil.isNotEmpty(addressBook.getExtAttr37())){
|
||||
CtpEnumItem ctpEnumItem = enumManagerNew.getCtpEnumItem(Long.parseLong(addressBook.getExtAttr37()));
|
||||
jsonObject.put("EXT_ATTR_37",ctpEnumItem.getShowvalue());
|
||||
}if(StringUtil.isNotEmpty(addressBook.getExtAttr38())){
|
||||
CtpEnumItem ctpEnumItem = enumManagerNew.getCtpEnumItem(Long.parseLong(addressBook.getExtAttr38()));
|
||||
jsonObject.put("EXT_ATTR_38",ctpEnumItem.getShowvalue());
|
||||
}if(StringUtil.isNotEmpty(addressBook.getExtAttr39())){
|
||||
CtpEnumItem ctpEnumItem = enumManagerNew.getCtpEnumItem(Long.parseLong(addressBook.getExtAttr39()));
|
||||
jsonObject.put("EXT_ATTR_39",ctpEnumItem.getShowvalue());
|
||||
}if(StringUtil.isNotEmpty(addressBook.getExtAttr40())){
|
||||
CtpEnumItem ctpEnumItem = enumManagerNew.getCtpEnumItem(Long.parseLong(addressBook.getExtAttr40()));
|
||||
jsonObject.put("EXT_ATTR_40",ctpEnumItem.getShowvalue());
|
||||
}if(StringUtil.isNotEmpty(addressBook.getExtAttr41())){
|
||||
jsonObject.put("EXT_ATTR_41",addressBook.getExtAttr41());
|
||||
}if(StringUtil.isNotEmpty(addressBook.getExtAttr42())){
|
||||
jsonObject.put("EXT_ATTR_42",addressBook.getExtAttr42());
|
||||
}if(StringUtil.isNotEmpty(addressBook.getExtAttr43())){
|
||||
jsonObject.put("EXT_ATTR_43",addressBook.getExtAttr43());
|
||||
}if(StringUtil.isNotEmpty(addressBook.getExtAttr44())){
|
||||
jsonObject.put("EXT_ATTR_44",addressBook.getExtAttr44());
|
||||
}if(StringUtil.isNotEmpty(addressBook.getExtAttr45())){
|
||||
jsonObject.put("EXT_ATTR_45",addressBook.getExtAttr45());
|
||||
}if(StringUtil.isNotEmpty(addressBook.getExtAttr46())){
|
||||
jsonObject.put("EXT_ATTR_46",addressBook.getExtAttr46());
|
||||
}if(StringUtil.isNotEmpty(addressBook.getExtAttr47())){
|
||||
jsonObject.put("EXT_ATTR_47",addressBook.getExtAttr47());
|
||||
}if(StringUtil.isNotEmpty(addressBook.getExtAttr48())){
|
||||
jsonObject.put("EXT_ATTR_48",addressBook.getExtAttr48());
|
||||
}if(StringUtil.isNotEmpty(addressBook.getExtAttr49())){
|
||||
jsonObject.put("EXT_ATTR_49",addressBook.getExtAttr49());
|
||||
}if(StringUtil.isNotEmpty(addressBook.getExtAttr50())){
|
||||
jsonObject.put("EXT_ATTR_50",addressBook.getExtAttr50());
|
||||
}if(StringUtil.isNotEmpty(addressBook.getExtAttr51())){
|
||||
jsonObject.put("EXT_ATTR_51",addressBook.getExtAttr51());
|
||||
}if(StringUtil.isNotEmpty(addressBook.getExtAttr52())){
|
||||
jsonObject.put("EXT_ATTR_52",addressBook.getExtAttr52());
|
||||
}if(StringUtil.isNotEmpty(addressBook.getExtAttr53())){
|
||||
jsonObject.put("EXT_ATTR_53",addressBook.getExtAttr53());
|
||||
}if(StringUtil.isNotEmpty(addressBook.getExtAttr54())){
|
||||
jsonObject.put("EXT_ATTR_54",addressBook.getExtAttr54());
|
||||
}if(StringUtil.isNotEmpty(addressBook.getExtAttr55())){
|
||||
jsonObject.put("EXT_ATTR_55",addressBook.getExtAttr55());
|
||||
}if(StringUtil.isNotEmpty(addressBook.getExtAttr56())){
|
||||
jsonObject.put("EXT_ATTR_56",addressBook.getExtAttr56());
|
||||
}if(StringUtil.isNotEmpty(addressBook.getExtAttr57())){
|
||||
jsonObject.put("EXT_ATTR_57",addressBook.getExtAttr57());
|
||||
}if(StringUtil.isNotEmpty(addressBook.getExtAttr58())){
|
||||
jsonObject.put("EXT_ATTR_58",addressBook.getExtAttr58());
|
||||
}if(StringUtil.isNotEmpty(addressBook.getExtAttr59())){
|
||||
jsonObject.put("EXT_ATTR_59",addressBook.getExtAttr59());
|
||||
}if(StringUtil.isNotEmpty(addressBook.getExtAttr60())){
|
||||
jsonObject.put("EXT_ATTR_60",addressBook.getExtAttr60());
|
||||
}if(StringUtil.isNotEmpty(addressBook.getExtAttr61())){
|
||||
jsonObject.put("EXT_ATTR_61",addressBook.getExtAttr61());
|
||||
}if(StringUtil.isNotEmpty(addressBook.getExtAttr62())){
|
||||
jsonObject.put("EXT_ATTR_62",addressBook.getExtAttr62());
|
||||
}if(StringUtil.isNotEmpty(addressBook.getExtAttr63())){
|
||||
jsonObject.put("EXT_ATTR_63",addressBook.getExtAttr63());
|
||||
}if(StringUtil.isNotEmpty(addressBook.getExtAttr64())){
|
||||
jsonObject.put("EXT_ATTR_64",addressBook.getExtAttr64());
|
||||
}if(StringUtil.isNotEmpty(addressBook.getExtAttr65())){
|
||||
jsonObject.put("EXT_ATTR_65",addressBook.getExtAttr65());
|
||||
}if(StringUtil.isNotEmpty(addressBook.getExtAttr66())){
|
||||
jsonObject.put("EXT_ATTR_66",addressBook.getExtAttr66());
|
||||
}if(StringUtil.isNotEmpty(addressBook.getExtAttr67())){
|
||||
jsonObject.put("EXT_ATTR_67",addressBook.getExtAttr67());
|
||||
}if(StringUtil.isNotEmpty(addressBook.getExtAttr68())){
|
||||
jsonObject.put("EXT_ATTR_68",addressBook.getExtAttr68());
|
||||
}if(StringUtil.isNotEmpty(addressBook.getExtAttr69())){
|
||||
jsonObject.put("EXT_ATTR_69",addressBook.getExtAttr69());
|
||||
}if(StringUtil.isNotEmpty(addressBook.getExtAttr70())){
|
||||
jsonObject.put("EXT_ATTR_70",addressBook.getExtAttr70());
|
||||
}
|
||||
return jsonObject;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,127 @@
|
||||
package com.seeyon.apps.src_flowIntegration.util;
|
||||
import java.util.Arrays;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* SQL语句参数处理
|
||||
*/
|
||||
public class SQLParamUtil {
|
||||
|
||||
/**
|
||||
* 基础版:直接拼接,null元素会转为"null"字符串,空字符串保留
|
||||
* (JDK 8+ 推荐,极简写法)
|
||||
* @param array 目标字符串数组
|
||||
* @return 逗号分隔的字符串,空数组返回空字符串
|
||||
*/
|
||||
public static String joinWithComma(String[] array) {
|
||||
// 空值校验:避免传入null导致空指针
|
||||
if (array == null || array.length == 0) {
|
||||
return "";
|
||||
}
|
||||
return String.join(",", array);
|
||||
}
|
||||
|
||||
/**
|
||||
* 增强版:过滤null和空字符串(含纯空格),仅保留有效元素
|
||||
* @param array 目标字符串数组
|
||||
* @return 逗号分隔的有效元素字符串,无有效元素返回空字符串
|
||||
*/
|
||||
public static String joinWithCommaFilterEmpty(String[] array) {
|
||||
if (array == null || array.length == 0) {
|
||||
return "";
|
||||
}
|
||||
// 流式处理:过滤null、空字符串、纯空格字符串
|
||||
return Arrays.stream(array)
|
||||
.filter(str -> str != null && !str.trim().isEmpty())
|
||||
.collect(Collectors.joining(","));
|
||||
}
|
||||
|
||||
/**
|
||||
* 兼容版:支持JDK 7及以下,手动循环拼接,可选择是否过滤空值
|
||||
* @param array 目标字符串数组
|
||||
* @param filterEmpty 是否过滤null和空字符串(true=过滤,false=不过滤)
|
||||
* @return 逗号分隔的字符串
|
||||
*/
|
||||
public static String joinWithCommaCompat(String[] array, boolean filterEmpty) {
|
||||
if (array == null || array.length == 0) {
|
||||
return "";
|
||||
}
|
||||
StringBuilder sb = new StringBuilder();
|
||||
for (int i = 0; i < array.length; i++) {
|
||||
String element = array[i];
|
||||
// 过滤逻辑:根据参数决定是否跳过无效元素
|
||||
if (filterEmpty && (element == null || element.trim().isEmpty())) {
|
||||
continue;
|
||||
}
|
||||
// 处理null元素:转为空字符串(避免拼接出"null")
|
||||
String addStr = element == null ? "" : element;
|
||||
// 添加元素
|
||||
sb.append(addStr);
|
||||
// 处理逗号:仅当不是最后一个有效元素时添加
|
||||
if (i != array.length - 1) {
|
||||
// 预判下一个元素是否需要处理(避免末尾多余逗号)
|
||||
boolean hasNextValid = false;
|
||||
for (int j = i + 1; j < array.length; j++) {
|
||||
String next = array[j];
|
||||
if (!filterEmpty || (next != null && !next.trim().isEmpty())) {
|
||||
hasNextValid = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (hasNextValid) {
|
||||
sb.append(",");
|
||||
}
|
||||
}
|
||||
}
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* 将Map<String, String>转换为 and key = 'value' and key = 'value' 格式的字符串
|
||||
* @param paramMap 目标Map(键值均为字符串)
|
||||
* @return 格式化字符串,空Map/Null返回空字符串
|
||||
*/
|
||||
public static String mapToAndCondition(Map<String, String> paramMap) {
|
||||
// 1. 空值校验:Map为null或空,直接返回空字符串
|
||||
if (paramMap == null || paramMap.isEmpty()) {
|
||||
return "";
|
||||
}
|
||||
|
||||
// 2. 遍历Map,拼接每个 key = 'value' 片段(自动转义值中的单引号)
|
||||
String conditionSegments = paramMap.entrySet().stream()
|
||||
// 过滤null键/值(避免拼接出 and null = 'null' 这种无效条件)
|
||||
.filter(entry -> entry.getKey() != null && entry.getValue() != null)
|
||||
// 拼接单个条件片段:key = 'value'(转义值中的单引号,如 'a'b' → 'a''b')
|
||||
.map(entry -> {
|
||||
String key = entry.getKey().trim();
|
||||
String value = escapeSingleQuote(entry.getValue().trim());
|
||||
return key + " = '" + value + "'";
|
||||
})
|
||||
// 用 " and " 连接所有片段
|
||||
.collect(Collectors.joining(" and "));
|
||||
|
||||
// 3. 如果有有效片段,前面加 "and ";无有效片段返回空字符串
|
||||
return conditionSegments.isEmpty() ? "" : "and " + conditionSegments;
|
||||
}
|
||||
|
||||
/**
|
||||
* 转义字符串中的单引号(避免SQL注入/语法错误)
|
||||
* 例如:O'Neil → O''Neil
|
||||
* @param str 原始字符串
|
||||
* @return 转义后的字符串
|
||||
*/
|
||||
private static String escapeSingleQuote(String str) {
|
||||
if (str == null) {
|
||||
return "";
|
||||
}
|
||||
// 将单个单引号替换为两个单引号(SQL标准转义方式)
|
||||
return str.replace("'", "''");
|
||||
}
|
||||
|
||||
|
||||
// ------------------- 测试用例 -------------------
|
||||
public static void main(String[] args) {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,10 @@
|
||||
package com.seeyon.apps.src_flowIntegration.util;
|
||||
import com.seeyon.ctp.util.DateUtil;
|
||||
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.security.MessageDigest;
|
||||
import java.util.Date;
|
||||
|
||||
public class SignUtil {
|
||||
|
||||
public static String sha256(String content) throws Exception {
|
||||
@@ -17,6 +21,9 @@ public class SignUtil {
|
||||
|
||||
// 测试主方法
|
||||
public static void main(String[] args) {
|
||||
String time = DateUtil.format(new Date(),"yyyy-MM-dd HH:mm:ss");
|
||||
System.out.println(1111);
|
||||
System.out.println(time);
|
||||
// 测试用例集合
|
||||
String[][] testCases = {
|
||||
// {测试内容, 预期SHA256结果(可通过在线工具验证)}
|
||||
@@ -60,11 +67,11 @@ public class SignUtil {
|
||||
}
|
||||
|
||||
// 测试总结
|
||||
System.out.println("\n=== 测试总结 ===");
|
||||
System.out.println("总测试用例数: " + testCases.length);
|
||||
System.out.println("通过数: " + passCount);
|
||||
System.out.println("失败数: " + failCount);
|
||||
System.out.println("测试结果: " + (failCount == 0 ? "✅ 全部通过" : "❌ 存在失败用例"));
|
||||
// System.out.println("\n=== 测试总结 ===");
|
||||
// System.out.println("总测试用例数: " + testCases.length);
|
||||
// System.out.println("通过数: " + passCount);
|
||||
// System.out.println("失败数: " + failCount);
|
||||
// System.out.println("测试结果: " + (failCount == 0 ? "✅ 全部通过" : "❌ 存在失败用例"));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,70 @@
|
||||
package com.seeyon.apps.src_flowIntegration.util;
|
||||
import java.time.Instant;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.ZoneId;
|
||||
import java.time.ZonedDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
|
||||
public class TimestampConverter {
|
||||
// 定义全局的格式化器(线程安全,可复用)
|
||||
private static final DateTimeFormatter DATE_FORMATTER = DateTimeFormatter.ofPattern("yyyy-MM-dd");
|
||||
private static final DateTimeFormatter DATETIME_FORMATTER = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
|
||||
// 采用系统默认时区,也可指定如 ZoneId.of("Asia/Shanghai")
|
||||
private static final ZoneId DEFAULT_ZONE = ZoneId.systemDefault();
|
||||
|
||||
/**
|
||||
* long时间戳转 yyyy-MM-dd 格式
|
||||
* @param timestamp 毫秒级时间戳(long类型)
|
||||
* @return 日期字符串,如 2026-02-26
|
||||
*/
|
||||
public static String longToDateStr(long timestamp) {
|
||||
// 将long时间戳转为Instant,再转为指定时区的LocalDateTime,最后格式化
|
||||
LocalDateTime localDateTime = LocalDateTime.ofInstant(Instant.ofEpochMilli(timestamp), DEFAULT_ZONE);
|
||||
return localDateTime.format(DATE_FORMATTER);
|
||||
}
|
||||
|
||||
/**
|
||||
* long时间戳转 yyyy-MM-dd HH:mm:ss 格式
|
||||
* @param timestamp 毫秒级时间戳(long类型)
|
||||
* @return 日期时间字符串,如 2026-02-26 10:50:30
|
||||
*/
|
||||
public static String longToDateTimeStr(long timestamp) {
|
||||
LocalDateTime localDateTime = LocalDateTime.ofInstant(Instant.ofEpochMilli(timestamp), DEFAULT_ZONE);
|
||||
return localDateTime.format(DATETIME_FORMATTER);
|
||||
}
|
||||
|
||||
/**
|
||||
* 将long型毫秒时间戳转换为yyyy-MM-dd HH:mm:ss格式字符串
|
||||
* @param timestamp 毫秒级时间戳(long类型)
|
||||
* @return 格式化后的时间字符串
|
||||
*/
|
||||
public static String timestampToDateTime(long timestamp) {
|
||||
// 1. 时间戳转Instant
|
||||
Instant instant = Instant.ofEpochMilli(timestamp);
|
||||
// 2. Instant转带时区的ZonedDateTime
|
||||
ZonedDateTime zonedDateTime = instant.atZone(DEFAULT_ZONE);
|
||||
// 3. 格式化输出
|
||||
return zonedDateTime.format(DATETIME_FORMATTER);
|
||||
}
|
||||
|
||||
/**
|
||||
* 处理秒级时间戳的重载方法
|
||||
* @param timestamp 秒级时间戳
|
||||
* @return 格式化后的时间字符串
|
||||
*/
|
||||
public static String timestampToDateTimeFromSecond(long timestamp) {
|
||||
Instant instant = Instant.ofEpochSecond(timestamp);
|
||||
ZonedDateTime zonedDateTime = instant.atZone(DEFAULT_ZONE);
|
||||
return zonedDateTime.format(DATETIME_FORMATTER);
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
// 测试1:毫秒级时间戳(最常用)
|
||||
long msTimestamp = 1735689600000L; // 对应2025-01-01 08:00:00
|
||||
System.out.println("毫秒级转换结果:" + timestampToDateTime(msTimestamp));
|
||||
|
||||
// 测试2:秒级时间戳
|
||||
long sTimestamp = 1735689600L;
|
||||
System.out.println("秒级转换结果:" + timestampToDateTimeFromSecond(sTimestamp));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,180 @@
|
||||
package com.seeyon.apps.src_flowIntegration.util;
|
||||
|
||||
import com.seeyon.apps.extIntegration.vo.ExtAffair;
|
||||
|
||||
public class TransitionAffairUtil {
|
||||
|
||||
// 进行审批状态编码转换,流程日志
|
||||
public static String actionIdTransitionAffairStatus(String actionId){
|
||||
// 流程节点查询 1向前、0撤销、3终止、2向后、4异常
|
||||
switch(actionId){
|
||||
case "2"://已发
|
||||
return "1";
|
||||
case "5"://撤销
|
||||
return "0";
|
||||
case "6"://终止
|
||||
return "3";
|
||||
case "8"://加签
|
||||
return "1";
|
||||
case "16"://回退
|
||||
return "2";
|
||||
case "17"://取回
|
||||
return "2";
|
||||
case "19"://已办
|
||||
return "1";
|
||||
case "35"://退回重填
|
||||
return "2";
|
||||
case "167"://转干预人
|
||||
return "4";
|
||||
case "201"://超级节点执行
|
||||
return "1";
|
||||
default:
|
||||
return "1";
|
||||
}
|
||||
}
|
||||
|
||||
// 进行审批状态含义转换,流程日志
|
||||
public static String actionIdTransitionAffairStatusTxt(String actionId){
|
||||
// 流程节点查询
|
||||
switch(actionId){
|
||||
case "2"://已发
|
||||
return "已发";
|
||||
case "5"://撤销
|
||||
return "撤销";
|
||||
case "6"://终止
|
||||
return "终止";
|
||||
case "8"://加签
|
||||
return "加签";
|
||||
case "16"://回退
|
||||
return "回退";
|
||||
case "17"://取回
|
||||
return "取回";
|
||||
case "19"://已办
|
||||
return "已办";
|
||||
case "35"://退回重填
|
||||
return "退回重填";
|
||||
case "167"://转干预人
|
||||
return "超级节点转干预人";
|
||||
case "201"://超级节点执行
|
||||
return "超级节点执行";
|
||||
default:
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
// 根据当前审批状态返回对应的审批状态,监听
|
||||
public static String extAffairAffairStatus(ExtAffair extAffair){
|
||||
int affairState = extAffair.getCtpAffairState();//主状态 0撤销、1向前、2向后、3终止、4异常
|
||||
// extAffair.getCtpAffairSubState();//辅状态
|
||||
switch(affairState){
|
||||
case 1://协同-待发
|
||||
return "0";
|
||||
case 2://协同-已发
|
||||
return "1";
|
||||
case 3://协同-待办
|
||||
return "0";
|
||||
case 30://待办-重复处理自动跳过
|
||||
return "1";
|
||||
case 4://协同-已办
|
||||
return "1";
|
||||
case 5://协同-撤销
|
||||
return "0";
|
||||
case 6://协同-回退
|
||||
return "2";
|
||||
case 7://协同-取回
|
||||
return "2";
|
||||
case 8://协同-竞争执行结束
|
||||
return "1";
|
||||
case 11://竞争执行完,但是其他人可以查看。
|
||||
return "1";
|
||||
case 15://协同-终止。
|
||||
return "3";
|
||||
default:
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
// 根据当前审批状态返回对应的审批状态描述,监听
|
||||
public static String extAffairAffairStatusTxt(ExtAffair extAffair){
|
||||
// int affairState = extAffair.getCtpAffairState();//主状态
|
||||
int affairSubState = extAffair.getCtpAffairSubState();//辅状态
|
||||
switch(affairSubState){
|
||||
case 0://协同-子状态-正常
|
||||
return "正常";
|
||||
case 1://协同-待发-草稿
|
||||
return "待发";
|
||||
case 2://协同-待发-被回退
|
||||
return "待发被回退";
|
||||
case 3://协同-待发-被撤销
|
||||
return "待发被撤销";
|
||||
case 5://协同-撤销
|
||||
return "撤销";
|
||||
case 6://协同-待办-取回
|
||||
return "取回";
|
||||
case 7://协同-待办-被回退
|
||||
return "被回退";
|
||||
case 11://协同-待办-未读
|
||||
return "待办";
|
||||
case 12://协同-待办-已读
|
||||
return "待办已读";
|
||||
case 13://协同-待办-暂存待办
|
||||
return "暂存待办";
|
||||
case 14://协同-待办-知会
|
||||
return "知会";
|
||||
case 15://协同-待办-主动指定回退的状态,我指定回退给别人,这是我的状态
|
||||
return "指定回退";
|
||||
case 16://协同-待办--被指定回退到的事项,别人回退给我,这是我的状态
|
||||
return "被指定回退";
|
||||
case 17://协同-待办--被指定回退到的事项,又指定回退给别人
|
||||
return "指定回退后又指定回退";
|
||||
case 18://协同-待发--指定回退到发起人并且选择流程重走
|
||||
return "指定回退流程重走";
|
||||
case 21://协同-已办-流程被终止
|
||||
return "被终止";
|
||||
case 22://协同-已办-删除
|
||||
return "删除";
|
||||
case 23://协同-已办 -归档
|
||||
return "归档";
|
||||
case 24://协同-已办 -超期跳过
|
||||
return "超期跳过";
|
||||
case 25://协同-已办-流程主动终止
|
||||
return "终止";
|
||||
default:
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
// 根据当前流程状态查询接口流程状态
|
||||
public static String colSummaryStateFlowState(String summaryState){
|
||||
// 流程状态查询
|
||||
switch(summaryState){
|
||||
case "0"://待办
|
||||
return "1";
|
||||
case "1"://终止
|
||||
return "2";
|
||||
case "2"://待发
|
||||
return "1";
|
||||
case "3"://结束
|
||||
return "1";
|
||||
default:
|
||||
return "0";
|
||||
}
|
||||
}
|
||||
|
||||
// 根据当前流程状态查询接口流程状态描述
|
||||
public static String colSummaryStateFlowStateTxt(String summaryState){
|
||||
// 流程状态查询描述
|
||||
switch(summaryState){
|
||||
case "0"://待办
|
||||
return "流程待办";
|
||||
case "1"://终止
|
||||
return "流程终止";
|
||||
case "2"://待发
|
||||
return "流程待发";
|
||||
case "3"://结束
|
||||
return "流程结束";
|
||||
default:
|
||||
return "流程异常";
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -52,4 +52,26 @@ public class ThirdFlowIntegrationController extends BaseResource {
|
||||
return fail(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@POST
|
||||
@Path("/flowquery")
|
||||
@Produces({"application/json"})
|
||||
@Consumes({"application/json"})
|
||||
public Response flowquery(JSONObject params ,@QueryParam("token") String urlToken, @Context HttpHeaders headers) {
|
||||
try {
|
||||
// 获取当前请求中的token,可能通过url或者header中进行token获取
|
||||
// String tokenString = headers.getHeaderString("token");
|
||||
// String token = "";
|
||||
// if(StringUtil.isNotEmpty(urlToken)){
|
||||
// token = urlToken;
|
||||
// }else{
|
||||
// token = tokenString;
|
||||
// }
|
||||
JSONObject r = flowIntegrationService.thirdFlowQuery(params);
|
||||
return success(r);
|
||||
}catch (Exception e) {
|
||||
return fail(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -2,6 +2,4 @@
|
||||
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
|
||||
<beans default-autowire="byName">
|
||||
<bean name="/formRedirectController.do" class="com.seeyon.apps.src_flowIntegration.controller.FormRedirectController" />
|
||||
|
||||
|
||||
</beans>
|
||||
@@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
|
||||
<beans default-autowire="byName">
|
||||
<bean id="flowEventListener" class="com.seeyon.apps.src_flowIntegration.listener.FlowEventListener" />
|
||||
</beans>
|
||||
@@ -5,6 +5,7 @@
|
||||
<bean id="thirdSysBizMapService" class="com.seeyon.apps.src_flowIntegration.service.ThirdSysBizMapService"/>
|
||||
<bean id="flowIntegrationService" class="com.seeyon.apps.src_flowIntegration.service.FlowIntegrationService"/>
|
||||
<bean id="oaFlowCreateService" class="com.seeyon.apps.src_flowIntegration.service.OaFlowCreateService"/>
|
||||
<bean id="oaFlowQueryService" class="com.seeyon.apps.src_flowIntegration.service.OaFlowQueryService"/>
|
||||
|
||||
<bean id="configProvider" class="com.seeyon.apps.src_flowIntegration.config.FlowIntegrationConfigProvider"/>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user