初始化

This commit is contained in:
2026-01-19 15:18:16 +08:00
parent a954a0e771
commit 6991a074dc
12 changed files with 312 additions and 2 deletions

View File

@@ -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;
}
}

View File

@@ -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());
}
}

View File

@@ -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;
}
}

View File

@@ -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<String,Object> data = (Map<String, Object>) jsonObject.get("data");
Map<String, String> map = thirdSysBizMapService.getOaFlowTemplateInfoByBizCode(flowBizCode);
String appName = map.get("appName");
String templateCode = map.get("templateCode");
String flowName = map.get("flowName");
Map<String,Object> mainFormData = (Map<String, Object>) data.get("mainTableData");
mainFormData.put("流程创建者",flowCreator);
mainFormData.put("流程状态回调地址",flowStatusCallbackUrl);
mainFormData.put("流程审批状态回调地址",flowAuditStatusCallbackUrl);
mainFormData.put("第三方系统流程ID",tirdFlowId);
Map<String, List<Object>> subFormDatas = (Map<String, List<Object>>) data.get("subTableDatas");
Map<String,Object> result = (Map<String,Object>) oaFlowCreateService.flowStart(flowName, mainFormData, subFormDatas, appName, templateCode);
return (String)result.get("processId");
}
}

View File

@@ -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<String,Object> mainFormData, Map<String, List<Object>> 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<String,Object> params = new HashMap<>();
Map<String,Object> datas = new HashMap<>();
Map<String,Object> 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();
}
}

View File

@@ -0,0 +1,17 @@
package com.seeyon.apps.src_flowIntegration.service;
import java.util.HashMap;
import java.util.Map;
public class ThirdSysBizMapService {
public Map<String,String> getOaFlowTemplateInfoByBizCode(String thirdBizCode){
Map<String,String> map = new HashMap<>();
if(thirdBizCode.equals("kindee_bill")) {
map.put("templateCode","kindee_bill");
map.put("appName","测试2");
}
return map;
}
}

View File

@@ -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<String,Object> 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<String, Object> getData() {
return data;
}
public void setData(Map<String, Object> data) {
this.data = data;
}
}

View File

@@ -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<String,String> res = new HashMap<>();
res.put("oaFlowId",flowId);
return success(res);
}catch (Exception e) {
return fail(e.getMessage());
}
}
}

View File

@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<plugin>
<id>src_flowIntegration</id>
<name>第三方流程集成</name>
<category>20250111</category>
</plugin>

View File

@@ -0,0 +1,8 @@
<?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="flowIntegrationPluginApi" class="com.seeyon.apps.src_flowIntegration.FlowIntegrationPluginApi"/>
<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"/>
</beans>

View File

@@ -8,5 +8,5 @@
http://www.springframework.org/schema/context http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context.xsd"> http://www.springframework.org/schema/context/spring-context.xsd">
<!-- 扫描包以发现bean--> <!-- 扫描包以发现bean-->
<context:component-scan base-package="com.seeyon.apps.src_saomaoyi.*"/> <context:component-scan base-package="com.seeyon.apps.src_saomaoyi"/>
</beans> </beans>

View File

@@ -2,6 +2,6 @@ import com.seeyon.apps.jync_fz.node.SheBaoFenZhangNode;
public class SheBaoFenZhangTest { public class SheBaoFenZhangTest {
public static void main(String[] args) { public static void main(String[] args) {
SheBaoFenZhangNode sheBaoFenZhangNode = new SheBaoFenZhangNode();
} }
} }