From 6991a074dcb256dcf97933f1d6df5aa84d812013 Mon Sep 17 00:00:00 2001 From: RuicyWu <1063154311@qq.com> Date: Mon, 19 Jan 2026 15:18:16 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=9D=E5=A7=8B=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../FlowIntegrationPluginApi.java | 44 +++++++++++++ .../config/FlowIntegrationConfigProvider.java | 21 +++++++ .../constants/FlowIntegrationConstants.java | 31 ++++++++++ .../service/FlowIntegrationService.java | 37 +++++++++++ .../service/OaFlowCreateService.java | 45 ++++++++++++++ .../service/ThirdSysBizMapService.java | 17 ++++++ .../src_flowIntegration/vo/FlowCreateVo.java | 61 +++++++++++++++++++ .../ThirdFlowIntegrationController.java | 40 ++++++++++++ .../plugin/src_flowIntegration/pluginCfg.xml | 6 ++ .../src_flowIntegration/spring/spring.xml | 8 +++ .../src_saomiaoyi/spring/spring-bean.xml | 2 +- .../src/test/SheBaoFenZhangTest.java | 2 +- 12 files changed, 312 insertions(+), 2 deletions(-) create mode 100644 v5/apps-customize/src/main/java/com/seeyon/apps/src_flowIntegration/FlowIntegrationPluginApi.java create mode 100644 v5/apps-customize/src/main/java/com/seeyon/apps/src_flowIntegration/config/FlowIntegrationConfigProvider.java create mode 100644 v5/apps-customize/src/main/java/com/seeyon/apps/src_flowIntegration/constants/FlowIntegrationConstants.java create mode 100644 v5/apps-customize/src/main/java/com/seeyon/apps/src_flowIntegration/service/FlowIntegrationService.java create mode 100644 v5/apps-customize/src/main/java/com/seeyon/apps/src_flowIntegration/service/OaFlowCreateService.java create mode 100644 v5/apps-customize/src/main/java/com/seeyon/apps/src_flowIntegration/service/ThirdSysBizMapService.java create mode 100644 v5/apps-customize/src/main/java/com/seeyon/apps/src_flowIntegration/vo/FlowCreateVo.java create mode 100644 v5/apps-customize/src/main/java/com/seeyon/ctp/rest/resources/flowIntegration/ThirdFlowIntegrationController.java create mode 100644 v5/apps-customize/src/main/webapp/WEB-INF/cfgHome/plugin/src_flowIntegration/pluginCfg.xml create mode 100644 v5/apps-customize/src/main/webapp/WEB-INF/cfgHome/plugin/src_flowIntegration/spring/spring.xml diff --git a/v5/apps-customize/src/main/java/com/seeyon/apps/src_flowIntegration/FlowIntegrationPluginApi.java b/v5/apps-customize/src/main/java/com/seeyon/apps/src_flowIntegration/FlowIntegrationPluginApi.java new file mode 100644 index 0000000..dbb5cde --- /dev/null +++ b/v5/apps-customize/src/main/java/com/seeyon/apps/src_flowIntegration/FlowIntegrationPluginApi.java @@ -0,0 +1,44 @@ +package com.seeyon.apps.src_flowIntegration; + +import com.seeyon.apps.common.plugin.api.APluginInfoApi; +import com.seeyon.apps.common.plugin.vo.ConfigVo; +import com.seeyon.apps.src_flowIntegration.constants.FlowIntegrationConstants; + + +public class FlowIntegrationPluginApi extends APluginInfoApi { + public FlowIntegrationPluginApi() { + } + + public String getPluginId() { + return FlowIntegrationConstants.getPluginId(); + } + + public String getCreateUser() { + return "橙阳科技"; + } + + public String getDescription() { + return "第三方流程集成集成管理"; + } + + public boolean syncOrg() { + return true; + } + + public ConfigVo getDefaultConfig() { + ConfigVo configVo = new ConfigVo(); + FlowIntegrationConstants[] var2 = FlowIntegrationConstants.values(); + int var3 = var2.length; + + for(int var4 = 0; var4 < var3; ++var4) { + FlowIntegrationConstants value = var2[var4]; + if (value != FlowIntegrationConstants.plugin) { + configVo.getDevParams().put(value.name(), value.getDefaultValue()); + configVo.getProdParams().put(value.name(), value.getDefaultValue()); + configVo.getParamMap().put(value.name(), value.getDescription()); + } + } + + return configVo; + } +} diff --git a/v5/apps-customize/src/main/java/com/seeyon/apps/src_flowIntegration/config/FlowIntegrationConfigProvider.java b/v5/apps-customize/src/main/java/com/seeyon/apps/src_flowIntegration/config/FlowIntegrationConfigProvider.java new file mode 100644 index 0000000..f480056 --- /dev/null +++ b/v5/apps-customize/src/main/java/com/seeyon/apps/src_flowIntegration/config/FlowIntegrationConfigProvider.java @@ -0,0 +1,21 @@ +package com.seeyon.apps.src_flowIntegration.config; + +import com.seeyon.apps.common.config.ICstConfigApi; +import com.seeyon.apps.common.plugin.vo.ConfigVo; +import com.seeyon.apps.src_flowIntegration.constants.FlowIntegrationConstants; +import com.seeyon.ctp.common.AppContext; +import org.springframework.stereotype.Component; + +import static com.seeyon.apps.src_flowIntegration.constants.FlowIntegrationConstants.getPluginId; + + +@Component("src_flowIntegration.flowIntegrationConfigProvider") +public class FlowIntegrationConfigProvider { + + protected ICstConfigApi cstConfigApi = (ICstConfigApi) AppContext.getBean("cstConfigApi"); + + public String getBizConfigByKey(FlowIntegrationConstants key) { + ConfigVo config = cstConfigApi.getConfig(getPluginId()); + return config.getParamVal(key.name()); + } +} diff --git a/v5/apps-customize/src/main/java/com/seeyon/apps/src_flowIntegration/constants/FlowIntegrationConstants.java b/v5/apps-customize/src/main/java/com/seeyon/apps/src_flowIntegration/constants/FlowIntegrationConstants.java new file mode 100644 index 0000000..f231e54 --- /dev/null +++ b/v5/apps-customize/src/main/java/com/seeyon/apps/src_flowIntegration/constants/FlowIntegrationConstants.java @@ -0,0 +1,31 @@ +package com.seeyon.apps.src_flowIntegration.constants; + +public enum FlowIntegrationConstants { + + plugin("src_flowIntegration", "插件ID"), + OA_HOST("","oa地址"), + restName("",""), + restPwd("",""), + ; + + private String defaultValue; + private String description; + + private FlowIntegrationConstants(String defaultValue, String description) { + this.defaultValue = defaultValue; + this.description = description; + } + + public String getDefaultValue() { + return this.defaultValue; + } + + public String getDescription() { + return this.description; + } + + public static String getPluginId() { + return plugin.defaultValue; + } + +} diff --git a/v5/apps-customize/src/main/java/com/seeyon/apps/src_flowIntegration/service/FlowIntegrationService.java b/v5/apps-customize/src/main/java/com/seeyon/apps/src_flowIntegration/service/FlowIntegrationService.java new file mode 100644 index 0000000..282e175 --- /dev/null +++ b/v5/apps-customize/src/main/java/com/seeyon/apps/src_flowIntegration/service/FlowIntegrationService.java @@ -0,0 +1,37 @@ +package com.seeyon.apps.src_flowIntegration.service; + +import com.alibaba.fastjson.JSONObject; +import org.springframework.beans.factory.annotation.Autowired; + +import java.util.List; +import java.util.Map; + + +public class FlowIntegrationService { + + @Autowired + private ThirdSysBizMapService thirdSysBizMapService; + @Autowired + private OaFlowCreateService oaFlowCreateService; + + public String thirdFlowCreate(JSONObject jsonObject) throws Exception { + String tirdFlowId = jsonObject.getString("thirdFlowId"); + String flowStatusCallbackUrl = jsonObject.getString("flowStatusCallbackUrl"); + String flowAuditStatusCallbackUrl = jsonObject.getString("flowAuditStatusCallbackUrl"); + String flowBizCode = jsonObject.getString("flowBizCode"); + String flowCreator = jsonObject.getString("flowCreator"); + Map data = (Map) jsonObject.get("data"); + Map map = thirdSysBizMapService.getOaFlowTemplateInfoByBizCode(flowBizCode); + String appName = map.get("appName"); + String templateCode = map.get("templateCode"); + String flowName = map.get("flowName"); + Map mainFormData = (Map) data.get("mainTableData"); + mainFormData.put("流程创建者",flowCreator); + mainFormData.put("流程状态回调地址",flowStatusCallbackUrl); + mainFormData.put("流程审批状态回调地址",flowAuditStatusCallbackUrl); + mainFormData.put("第三方系统流程ID",tirdFlowId); + Map> subFormDatas = (Map>) data.get("subTableDatas"); + Map result = (Map) oaFlowCreateService.flowStart(flowName, mainFormData, subFormDatas, appName, templateCode); + return (String)result.get("processId"); + } +} diff --git a/v5/apps-customize/src/main/java/com/seeyon/apps/src_flowIntegration/service/OaFlowCreateService.java b/v5/apps-customize/src/main/java/com/seeyon/apps/src_flowIntegration/service/OaFlowCreateService.java new file mode 100644 index 0000000..f50c192 --- /dev/null +++ b/v5/apps-customize/src/main/java/com/seeyon/apps/src_flowIntegration/service/OaFlowCreateService.java @@ -0,0 +1,45 @@ +package com.seeyon.apps.src_flowIntegration.service; + +import com.seeyon.apps.src_flowIntegration.config.FlowIntegrationConfigProvider; +import com.seeyon.apps.src_flowIntegration.constants.FlowIntegrationConstants; +import com.seeyon.utils.http.OaResp; +import com.seeyon.utils.http.OaRestClient; +import org.springframework.beans.factory.annotation.Autowired; + + +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class OaFlowCreateService { + + @Autowired + private FlowIntegrationConfigProvider configProvider; + + public Object flowStart(String flowName, Map mainFormData, Map> subFormDatas, String appName, String templateCode) throws Exception { + OaRestClient client = new OaRestClient(configProvider.getBizConfigByKey(FlowIntegrationConstants.OA_HOST), + configProvider.getBizConfigByKey(FlowIntegrationConstants.restName), + configProvider.getBizConfigByKey(FlowIntegrationConstants.restPwd)); + String url = "/bpm/process/start"; + Map params = new HashMap<>(); + Map datas = new HashMap<>(); + Map formDatas = new HashMap<>(); + params.put("appName",appName); + params.put("data",datas); + datas.put("templateCode",templateCode); + datas.put("draft","0"); + datas.put("data",formDatas); + for (String key : mainFormData.keySet()) { + formDatas.put(key,mainFormData.get(key)); + } + for (String key : subFormDatas.keySet()) { + formDatas.put(key,subFormDatas.get(key)); + } + OaResp oaResp = client.sendPost(flowName, url, params); + if(oaResp.getCode() != 0) { + throw new Exception(flowName + "流程发起失败:" + oaResp.getMessage()); + } + return oaResp.getData(); + } + +} diff --git a/v5/apps-customize/src/main/java/com/seeyon/apps/src_flowIntegration/service/ThirdSysBizMapService.java b/v5/apps-customize/src/main/java/com/seeyon/apps/src_flowIntegration/service/ThirdSysBizMapService.java new file mode 100644 index 0000000..2c13b57 --- /dev/null +++ b/v5/apps-customize/src/main/java/com/seeyon/apps/src_flowIntegration/service/ThirdSysBizMapService.java @@ -0,0 +1,17 @@ +package com.seeyon.apps.src_flowIntegration.service; + + +import java.util.HashMap; +import java.util.Map; + +public class ThirdSysBizMapService { + + public Map getOaFlowTemplateInfoByBizCode(String thirdBizCode){ + Map map = new HashMap<>(); + if(thirdBizCode.equals("kindee_bill")) { + map.put("templateCode","kindee_bill"); + map.put("appName","测试2"); + } + return map; + } +} diff --git a/v5/apps-customize/src/main/java/com/seeyon/apps/src_flowIntegration/vo/FlowCreateVo.java b/v5/apps-customize/src/main/java/com/seeyon/apps/src_flowIntegration/vo/FlowCreateVo.java new file mode 100644 index 0000000..a191ee2 --- /dev/null +++ b/v5/apps-customize/src/main/java/com/seeyon/apps/src_flowIntegration/vo/FlowCreateVo.java @@ -0,0 +1,61 @@ +package com.seeyon.apps.src_flowIntegration.vo; + +import java.util.Map; + +public class FlowCreateVo { + + private String thirdFlowId; + private String flowStatusCallbackUrl; + private String flowAuditStatusCallbackUrl; + private String flowBizCode; + private String flowCreator; + private Map data; + + public String getThirdFlowId() { + return thirdFlowId; + } + + public void setThirdFlowId(String thirdFlowId) { + this.thirdFlowId = thirdFlowId; + } + + public String getFlowStatusCallbackUrl() { + return flowStatusCallbackUrl; + } + + public void setFlowStatusCallbackUrl(String flowStatusCallbackUrl) { + this.flowStatusCallbackUrl = flowStatusCallbackUrl; + } + + public String getFlowAuditStatusCallbackUrl() { + return flowAuditStatusCallbackUrl; + } + + public void setFlowAuditStatusCallbackUrl(String flowAuditStatusCallbackUrl) { + this.flowAuditStatusCallbackUrl = flowAuditStatusCallbackUrl; + } + + public String getFlowBizCode() { + return flowBizCode; + } + + public void setFlowBizCode(String flowBizCode) { + this.flowBizCode = flowBizCode; + } + + public String getFlowCreator() { + return flowCreator; + } + + public void setFlowCreator(String flowCreator) { + this.flowCreator = flowCreator; + } + + public Map getData() { + return data; + } + + public void setData(Map data) { + this.data = data; + } +} diff --git a/v5/apps-customize/src/main/java/com/seeyon/ctp/rest/resources/flowIntegration/ThirdFlowIntegrationController.java b/v5/apps-customize/src/main/java/com/seeyon/ctp/rest/resources/flowIntegration/ThirdFlowIntegrationController.java new file mode 100644 index 0000000..81ed9d3 --- /dev/null +++ b/v5/apps-customize/src/main/java/com/seeyon/ctp/rest/resources/flowIntegration/ThirdFlowIntegrationController.java @@ -0,0 +1,40 @@ +package com.seeyon.ctp.rest.resources.flowIntegration; + +import com.alibaba.fastjson.JSONObject; +import com.seeyon.apps.src_flowIntegration.service.FlowIntegrationService; +import com.seeyon.ctp.common.AppContext; +import com.seeyon.ctp.common.log.CtpLogFactory; +import com.seeyon.ctp.rest.resources.BaseResource; +import org.apache.commons.logging.Log; + +import javax.ws.rs.Consumes; +import javax.ws.rs.POST; +import javax.ws.rs.Path; +import javax.ws.rs.Produces; +import javax.ws.rs.core.Response; +import java.util.HashMap; +import java.util.Map; + + +@Path("/third") +@Produces({"application/json", "application/xml"}) +public class ThirdFlowIntegrationController extends BaseResource { + private static final Log log = CtpLogFactory.getLog(ThirdFlowIntegrationController.class); + private FlowIntegrationService flowIntegrationService = (FlowIntegrationService) AppContext.getBean("flowIntegrationService"); + + + @POST + @Path("/flowcreate") + @Produces({"application/json"}) + @Consumes({"application/json"}) + public Response flowCreate(JSONObject params) { + try { + String flowId = flowIntegrationService.thirdFlowCreate(params); + Map res = new HashMap<>(); + res.put("oaFlowId",flowId); + return success(res); + }catch (Exception e) { + return fail(e.getMessage()); + } + } +} diff --git a/v5/apps-customize/src/main/webapp/WEB-INF/cfgHome/plugin/src_flowIntegration/pluginCfg.xml b/v5/apps-customize/src/main/webapp/WEB-INF/cfgHome/plugin/src_flowIntegration/pluginCfg.xml new file mode 100644 index 0000000..57d19ac --- /dev/null +++ b/v5/apps-customize/src/main/webapp/WEB-INF/cfgHome/plugin/src_flowIntegration/pluginCfg.xml @@ -0,0 +1,6 @@ + + + src_flowIntegration + 第三方流程集成 + 20250111 + \ No newline at end of file diff --git a/v5/apps-customize/src/main/webapp/WEB-INF/cfgHome/plugin/src_flowIntegration/spring/spring.xml b/v5/apps-customize/src/main/webapp/WEB-INF/cfgHome/plugin/src_flowIntegration/spring/spring.xml new file mode 100644 index 0000000..6fe182f --- /dev/null +++ b/v5/apps-customize/src/main/webapp/WEB-INF/cfgHome/plugin/src_flowIntegration/spring/spring.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/v5/apps-customize/src/main/webapp/WEB-INF/cfgHome/plugin/src_saomiaoyi/spring/spring-bean.xml b/v5/apps-customize/src/main/webapp/WEB-INF/cfgHome/plugin/src_saomiaoyi/spring/spring-bean.xml index 19d4cd3..d2f5e1c 100644 --- a/v5/apps-customize/src/main/webapp/WEB-INF/cfgHome/plugin/src_saomiaoyi/spring/spring-bean.xml +++ b/v5/apps-customize/src/main/webapp/WEB-INF/cfgHome/plugin/src_saomiaoyi/spring/spring-bean.xml @@ -8,5 +8,5 @@ http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd"> - + \ No newline at end of file diff --git a/v5/apps-customize/src/test/SheBaoFenZhangTest.java b/v5/apps-customize/src/test/SheBaoFenZhangTest.java index 22c43cf..48745db 100644 --- a/v5/apps-customize/src/test/SheBaoFenZhangTest.java +++ b/v5/apps-customize/src/test/SheBaoFenZhangTest.java @@ -2,6 +2,6 @@ import com.seeyon.apps.jync_fz.node.SheBaoFenZhangNode; public class SheBaoFenZhangTest { public static void main(String[] args) { - SheBaoFenZhangNode sheBaoFenZhangNode = new SheBaoFenZhangNode(); + } }