package com.hotent.bpmModel.controller; import java.util.Map; import javax.annotation.Resource; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; import com.hotent.base.annotation.ApiGroup; import com.hotent.base.annotation.NewVersion; import com.hotent.base.constants.ApiGroupConsts; import com.hotent.base.model.CommonResult; import com.hotent.bpm.api.model.process.nodedef.BpmNodeDef; import com.hotent.bpm.api.service.BpmDefinitionAccessor; import com.hotent.bpm.plugin.task.startnewflow.context.StartNewFlowPluginContext; import com.hotent.bpmModel.manager.BpmPluginsService; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiParam; /** * 描述:流程插件管理 * @company 广州宏天软件有限公司 * @author wanghb * @email wanghb@jee-soft.cn * @date 2018年6月26日 */ @RestController @RequestMapping("/flow/plugins/v1/") @Api(tags="流程插件") @ApiGroup(group= {ApiGroupConsts.GROUP_BPM}) @NewVersion public class PluginsController { @Resource BpmDefinitionAccessor bpmDefinitionAccessor ; @Autowired private BpmPluginsService bpmPluginsService; @RequestMapping(value="procNotifyEdit",method=RequestMethod.GET, produces = { "application/json; charset=utf-8" }) @ApiOperation(value = "获取编辑结束抄送页面数据", httpMethod = "GET", notes = "获取编辑结束抄送页面数据") public String procNotifyEdit(@ApiParam(name="defId",value="流程定义id", required = true) @RequestParam String defId) throws Exception{ return bpmPluginsService.procNotifyEdit(defId); } /** * 保存结束抄送 * @exception * @since 1.0.0 */ @RequestMapping(value="procNotifySave",method=RequestMethod.POST, produces = { "application/json; charset=utf-8" }) @ApiOperation(value = "保存结束抄送", httpMethod = "POST", notes = "保存结束抄送") public CommonResult procNotifySave( @ApiParam(name="defId",value="流程定义id", required = true) @RequestParam String defId, @ApiParam(name="procNotifyJson",value="办结抄送的json数据", required = true) @RequestBody String procNotifyJson) throws Exception{ return bpmPluginsService.procNotifySave(defId,procNotifyJson); } /** * 获取催办json */ @RequestMapping(value="remindersJson", method=RequestMethod.GET, produces={"application/json; charset=utf-8" }) @ApiOperation(value = "获取催办json", httpMethod = "GET", notes = "获取催办json") public Map remindersJson(@ApiParam(name="defId",value="流程定义id", required = true) @RequestParam String defId, @ApiParam(name="nodeId",value="节点id", required = true) @RequestParam String nodeId ) throws Exception{ return bpmPluginsService.remindersJson(defId,nodeId); } /** * 保存结束抄送 * @exception * @since 1.0.0 */ @RequestMapping(value="remindersSave", method=RequestMethod.POST, produces={"application/json; charset=utf-8" }) @ApiOperation(value = "保存结束抄送", httpMethod = "POST", notes = "保存结束抄送") public CommonResult remindersSave( @ApiParam(name="defId",value="流程定义id", required = true) @RequestParam String defId, @ApiParam(name="nodeId",value="节点id", required = true) @RequestParam String nodeId, @ApiParam(name="remindersJson",value="抄送json", required = true) @RequestBody String remindersJson) throws Exception{ return bpmPluginsService.reminderSave(defId,nodeId,remindersJson); } /** * 获取测试插件json */ @RequestMapping(value="getTestPlugin", method=RequestMethod.GET, produces={"application/json; charset=utf-8" }) @ApiOperation(value = "获取测试插件json", httpMethod = "GET", notes = "获取测试插件json") public String getTestPlugin(@ApiParam(name="defId",value="流程定义id", required = true) @RequestParam String defId, @ApiParam(name="nodeId",value="节点id", required = true) @RequestParam String nodeId ) throws Exception{ return bpmPluginsService.getTestPlugin(defId,nodeId); } /** * 保存测试插件 * @exception * @since 1.0.0 */ @RequestMapping(value="saveTestPlugin", method=RequestMethod.POST, produces={"application/json; charset=utf-8" }) @ApiOperation(value = "保存测试插件", httpMethod = "POST", notes = "保存测试插件") public CommonResult saveTestPlugin( @ApiParam(name="defId",value="流程定义id", required = true) @RequestParam String defId, @ApiParam(name="nodeId",value="节点id", required = true) @RequestParam String nodeId, @ApiParam(name="json",value="json", required = true) @RequestBody String json) throws Exception{ return bpmPluginsService.saveTestPlugin(defId,nodeId,json); } /** * 获取触发新流程配置 */ @RequestMapping(value="startNewFlowJson", method=RequestMethod.GET, produces={"application/json; charset=utf-8" }) @ApiOperation(value = "获取触发新流程json", httpMethod = "GET", notes = "获取触发新流程json") public String startNewFlowJson(@ApiParam(name="defId",value="流程定义id", required = true) @RequestParam String defId, @ApiParam(name="nodeId",value="节点id", required = true) @RequestParam String nodeId ) throws Exception{ BpmNodeDef nodeDef = bpmDefinitionAccessor.getBpmNodeDef(defId, nodeId); StartNewFlowPluginContext context=nodeDef.getPluginContext(StartNewFlowPluginContext.class); return context!= null?context.getJson() : ""; } /** * 保存触发新流程配置 * @exception * @since 1.0.0 */ @RequestMapping(value="startNewFlowSave", method=RequestMethod.POST, produces={"application/json; charset=utf-8" }) @ApiOperation(value = "保存结束抄送", httpMethod = "POST", notes = "保存结束抄送") public CommonResult startNewFlowSave( @ApiParam(name="defId",value="流程定义id", required = true) @RequestParam String defId, @ApiParam(name="nodeId",value="节点id", required = true) @RequestParam String nodeId, @ApiParam(name="json",value="配置json", required = true) @RequestBody String json) throws Exception{ return bpmPluginsService.startNewFlowSave(defId,nodeId,json); } /** * 保存子流程发起设置插件 * * @exception @since 1.0.0 */ @RequestMapping(value = "saveSubProcessPlugin", method = RequestMethod.POST, produces = { "application/json; charset=utf-8" }) @ApiOperation(value = "保存子流程发起设置插件", httpMethod = "POST", notes = "保存子流程发起设置插件") public CommonResult saveSubProcessPlugin( @ApiParam(name = "defId", value = "流程定义id", required = true) @RequestParam String defId, @ApiParam(name = "nodeId", value = "节点id", required = true) @RequestParam String nodeId, @ApiParam(name = "json", value = "json", required = true) @RequestBody String json) throws Exception { return bpmPluginsService.saveSubMappingStart(defId, nodeId, json); } /** * 获取子流程发起设置插件json */ @RequestMapping(value = "getSubProcessPlugin", method = RequestMethod.GET, produces = { "application/json; charset=utf-8" }) @ApiOperation(value = "获取子流程发起设置插件json", httpMethod = "GET", notes = "获取子流程发起设置插件json") public String getSubProcessPlugin( @ApiParam(name = "defId", value = "流程定义id", required = true) @RequestParam String defId, @ApiParam(name = "nodeId", value = "节点id", required = true) @RequestParam String nodeId) throws Exception { return bpmPluginsService.getSubMappingPlugin(defId, nodeId); } }