package com.changhong.epc.admin; import com.alibaba.fastjson.TypeReference; import com.changhong.epc.constter.base.BaseConst; import com.changhong.epc.constter.system.prop.ChangHongProperties; import com.changhong.epc.rely.api.bean.Process; import com.changhong.epc.rely.api.tool.StringUtils; import com.changhong.epc.rely.api.tool.WorkflowTool; import com.iemsoft.framework.cloud.core.thread.ThreadData; import com.iemsoft.framework.cloud.core.tools.JSONTool; import com.iemsoft.framework.cloud.core.tools.SpringUtil; import com.iemsoft.framework.cloud.core.tools.http.Http; import org.springframework.beans.BeansException; import org.springframework.context.support.ClassPathXmlApplicationContext; import org.springframework.ui.ModelMap; import java.util.Collections; import java.util.HashMap; import java.util.Map; public class FlowTest implements BaseConst { static { Map info = new HashMap<>(); info.put(ChangHongProperties.class, new ChangHongProperties(){ { setProcessServiceId("9"); setProcessSecurityKey("8199609c3cf9465289c04c73ef6d5b19"); setProcessAppKey("9a4b2489b28b4ceeb1e4426018db4a75"); setProcessAccessId("5425975"); } }); new SpringUtil().setApplicationContext(new ClassPathXmlApplicationContext(){ @Override public T getBean(Class requiredType) throws BeansException { return (T) info.get(requiredType); } }); } // @Test public void test(){ ThreadData.set(OPEN_ID, "893ccd52f0ec4eae"); ThreadData.set(TENANT_ID, "100000320"); ThreadData.set(COMPANY_ID, 310); WorkflowTool workflowTool = new WorkflowTool(); Process process = workflowTool.getProcess( new ModelMap("processDefName", "f9fe73ff27784e6ca9eb55fd3b17c19c") .addAttribute("processDefId", 4344) .addAttribute("processInstName", StringUtils.getRandomStr(5)) ); Map res = Http.post("http://ubpyq.chfcloud.com:8087/ubp/ubp-api-control/process/inst/autofinish", Map.class) .addUrlParam(process.getFlowmap()) .execute(new TypeReference>(){}.getType()) .orElse(Collections.emptyMap()); System.out.println( JSONTool.toJson(res) ); } }