package com.hotent.runtime.controller; import java.util.ArrayList; import java.util.List; import java.util.Map; import java.util.Optional; import java.util.Set; import java.util.concurrent.CompletableFuture; import javax.annotation.Resource; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.validation.Valid; import com.hotent.base.query.*; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.util.CollectionUtils; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PostMapping; 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.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.node.ArrayNode; import com.fasterxml.jackson.databind.node.ObjectNode; import com.hotent.base.annotation.ApiGroup; import com.hotent.base.annotation.AvoidRepeatableCommit; import com.hotent.base.constants.ApiGroupConsts; import com.hotent.base.context.BaseContext; import com.hotent.base.controller.BaseController; import com.hotent.base.exception.BaseException; import com.hotent.base.model.CommonResult; import com.hotent.base.util.BeanUtils; import com.hotent.base.util.SQLUtil; import com.hotent.base.util.StringUtil; import com.hotent.base.util.ThreadMsgUtil; import com.hotent.bpm.api.constant.BpmConstants; import com.hotent.bpm.api.model.form.FormType; import com.hotent.bpm.api.model.process.def.BpmDefExtProperties; import com.hotent.bpm.api.model.process.def.BpmProcessDef; import com.hotent.bpm.api.model.process.def.BpmProcessDefExt; import com.hotent.bpm.api.model.process.inst.BpmInstanceTrack; import com.hotent.bpm.api.model.process.inst.BpmProcessInstance; import com.hotent.bpm.api.model.process.nodedef.BpmNodeDef; import com.hotent.bpm.api.model.process.nodedef.BpmNodeForm; import com.hotent.bpm.api.model.process.task.BpmTaskOpinion; import com.hotent.bpm.api.service.BoDataService; import com.hotent.bpm.api.service.BoSubDataHandlers; import com.hotent.bpm.api.service.BpmDefinitionAccessor; import com.hotent.bpm.api.service.BpmFormService; import com.hotent.bpm.api.service.BpmIdentityService; import com.hotent.bpm.api.service.BpmInstService; import com.hotent.bpm.api.service.BpmOpinionService; import com.hotent.bpm.engine.form.BpmFormFactory; import com.hotent.bpm.engine.inst.DefaultProcessInstCmd; import com.hotent.bpm.model.form.FormCategory; import com.hotent.bpm.model.form.FormModel; import com.hotent.bpm.params.PreviewProcessVo; import com.hotent.bpm.persistence.manager.BpmBusLinkManager; import com.hotent.bpm.persistence.manager.BpmCheckOpinionManager; import com.hotent.bpm.persistence.manager.BpmCptoReceiverManager; import com.hotent.bpm.persistence.manager.BpmDefinitionManager; import com.hotent.bpm.persistence.manager.BpmExeStackManager; import com.hotent.bpm.persistence.manager.BpmProcessInstanceManager; import com.hotent.bpm.persistence.manager.BpmReadRecordManager; import com.hotent.bpm.persistence.manager.BpmTaskManager; import com.hotent.bpm.persistence.manager.BpmTaskTurnManager; import com.hotent.bpm.persistence.manager.BpmTaskUrgentManager; import com.hotent.bpm.persistence.manager.PreviewProcessService; import com.hotent.bpm.persistence.model.BpmBusLink; import com.hotent.bpm.persistence.model.BpmCptoReceiver; import com.hotent.bpm.persistence.model.BpmIdentityResult; import com.hotent.bpm.persistence.model.BpmInstDeleteLog; import com.hotent.bpm.persistence.model.BpmReadRecord; import com.hotent.bpm.persistence.model.BpmTaskUrgent; import com.hotent.bpm.persistence.model.CopyTo; import com.hotent.bpm.persistence.model.DefaultBpmCheckOpinion; import com.hotent.bpm.persistence.model.DefaultBpmDefinition; import com.hotent.bpm.persistence.model.DefaultBpmProcessInstance; import com.hotent.bpm.persistence.model.DefaultBpmTask; import com.hotent.bpm.persistence.model.ResultMessage; import com.hotent.bpm.persistence.model.TaskTurnAssign; import com.hotent.bpm.util.BoDataUtil; import com.hotent.bpm.util.BpmUtil; import com.hotent.runtime.annotation.PermissionCheck; import com.hotent.runtime.manager.IFlowManager; import com.hotent.runtime.manager.IProcessManager; import com.hotent.runtime.manager.InstanceService; import com.hotent.runtime.manager.PreviewProcessManager; import com.hotent.runtime.model.RelatedInformation; import com.hotent.runtime.params.BpmCheckOpinionVo; import com.hotent.runtime.params.BpmImageParamObject; import com.hotent.runtime.params.BpmNodeDefVo; import com.hotent.runtime.params.CopyToParam; import com.hotent.runtime.params.CustomSignRevokeParam; import com.hotent.runtime.params.DataTemplateButtonPermissionVo; import com.hotent.runtime.params.DoEndParamObject; import com.hotent.runtime.params.DoNextParamObject; import com.hotent.runtime.params.FlowImageMobileVo; import com.hotent.runtime.params.FlowImageVo; import com.hotent.runtime.params.FormAndBoVo; import com.hotent.runtime.params.InfoboxVo; import com.hotent.runtime.params.InstFormAndBoVo; import com.hotent.runtime.params.NodeStatusVo; import com.hotent.runtime.params.RevokeParamObject; import com.hotent.runtime.params.RevokeSignLineParamObject; import com.hotent.runtime.params.RevokeTransParamObject; import com.hotent.runtime.params.SelectDestinationVo; import com.hotent.runtime.params.StartCmdParam; import com.hotent.runtime.params.StartFlowParamObject; import com.hotent.runtime.params.StartResult; import com.hotent.runtime.params.ToCopyToVo; import com.hotent.runtime.service.RevokeHandler; import com.hotent.runtime.vo.BpmInstDeleteVo; import com.hotent.runtime.vo.FlowTypeVo; import com.hotent.uc.api.impl.util.ContextUtil; import com.hotent.uc.api.model.IUser; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiParam; /** * 流程实例相关接口 * * @company 广州宏天软件股份有限公司 * @author zhangxianwen * @email zhangxw@jee-soft.cn * @date 2018年6月28日 */ @RestController @RequestMapping("/runtime/instance/v1/") @Api(tags = "流程实例管理") @ApiGroup(group= {ApiGroupConsts.GROUP_BPM}) public class InstanceController extends BaseController { @Resource IFlowManager iFlowService; @Resource IProcessManager iProcessService; @Resource BpmInstService processInstanceService; @Resource BpmDefinitionAccessor bpmDefinitionAccessor; @Resource BpmProcessInstanceManager bpmProcessInstanceManager; @Resource BpmOpinionService bpmOpinionService; @Resource BpmIdentityService bpmIdentityService; @Resource BpmTaskTurnManager bpmTaskTurnManager; @Resource BpmCptoReceiverManager bpmCptoReceiverManager; @Resource BpmDefinitionManager bpmDefinitionManager; @Resource BpmBusLinkManager bpmBusLinkManager; @Resource BoDataService boDataService; @Resource BpmCheckOpinionManager bpmCheckOpinionManager; @Resource BpmReadRecordManager bpmReadRecordManager; @Resource BpmTaskUrgentManager bpmTaskUrgentManager; @Resource BoSubDataHandlers boSubDataHandler; @Resource RevokeHandler revokeHandler; @Resource BaseContext baseContext; @Autowired InstanceService instanceService; @Resource BpmExeStackManager bpmExeStackManager; @Resource BpmTaskManager bpmTaskManager; @Resource PreviewProcessService previewProcessService; @Resource PreviewProcessManager previewProcessManager; @RequestMapping(value="getSubDataSqlByFk", method=RequestMethod.POST, produces={"application/json; charset=utf-8" }) @ApiOperation(value = "根据外键获取子表数据sql", httpMethod = "POST", notes = "根据外键获取子表数据sql") public CommonResult getSubDataSqlByFk(@ApiParam(name="boEnt",value="bo实体",required = true)@RequestBody ObjectNode boEnt, @ApiParam(name="fkValue",value="外键值 ",required = true)@RequestParam Object fkValue, @ApiParam(name="defId",value="定义id ",required = false)@RequestParam(required = false) Optional defId, @ApiParam(name="nodeId",value="节点id ",required = false)@RequestParam(required = false) Optional nodeId, @ApiParam(name="parentDefKey",value="父流程key ",required = false)@RequestParam(required = false) Optional parentDefKey) throws Exception { return boSubDataHandler.getSubDataSqlByFk(boEnt,fkValue,defId.orElse(""),nodeId.orElse(""),parentDefKey.orElse("")); } @RequestMapping(value = "getDoneList", method = RequestMethod.POST, produces = { "application/json; charset=utf-8" }) @ApiOperation(value = "获取用户的已办事宜", httpMethod = "POST", notes = "获取用户的已办事宜,参数status表示流程状态,不填表示查询所有") public PageList> getDoneList( @ApiParam(required = true, name = "queryFilter", value = "查询参数对象") @RequestBody QueryFilter queryFilter, @ApiParam(name = "status", value = "流程状态", allowableValues = "running,end,manualend,cancel,back,revoke,revokeToStart", required = false) @RequestParam(required = false) String status, @ApiParam(name = "isCheckRevoke", value = "是否检测可撤回状态") @RequestParam Optional isCheckRevoke,@ApiParam(name = "ownerId",value = "指定用户") @RequestParam(required = false) String ownerId, HttpServletResponse response) throws Exception { PageList> pageList = iFlowService.getDoneList(baseContext.getCurrentUserAccout(),ownerId, queryFilter, status); // 如果需要检测是否可以撤回 if (isCheckRevoke.orElse(false)) { revokeHandler.checkRevoke(pageList); } return pageList; } @RequestMapping(value = "getDoneInstList", method = RequestMethod.POST, produces = { "application/json; charset=utf-8" }) @ApiOperation(value = "获取用户经办的流程实例", httpMethod = "POST", notes = "获取用户的已办事宜,参数status表示流程状态,不填表示查询所有") public PageList> getDoneInstList( @ApiParam(required = true, name = "queryFilter", value = "查询参数对象") @RequestBody QueryFilter queryFilter, @ApiParam(name = "status", value = "流程状态", allowableValues = "running,end,manualend,cancel,back,revoke,revokeToStart", required = false) @RequestParam(required = false) String status, HttpServletResponse response) throws Exception { return iFlowService.getDoneInstList(baseContext.getCurrentUserAccout(), queryFilter, status).get(); } @PostMapping(value = "getDoneInstCount", produces = { "application/json; charset=utf-8" }) @ApiOperation(value = "获取用户经办的流程实例数", httpMethod = "POST", notes = "获取用户的已办事宜,参数status表示流程状态,不填表示查询所有") public List> getDoneInstCount( @ApiParam(required = true, name = "queryFilter", value = "查询参数对象") @RequestBody QueryFilter queryFilter, @ApiParam(name = "status", value = "流程状态数", allowableValues = "running,end,manualend,cancel,back,revoke,revokeToStart", required = false) @RequestParam(required = false) String status, HttpServletResponse response) throws Exception { return iFlowService.getDoneInstCount(baseContext.getCurrentUserAccout(), queryFilter, status); } @RequestMapping(value = "completed", method = RequestMethod.POST, produces = { "application/json; charset=utf-8" }) @ApiOperation(value = "获取办结事宜", httpMethod = "POST", notes = "获取用户的办结事宜") public PageList completed( @ApiParam(required = true, name = "queryFilter", value = "查询参数对象") @RequestBody QueryFilter queryFilter, HttpServletResponse response) throws Exception { return iFlowService.getCompletedList(baseContext.getCurrentUserAccout(), queryFilter); } @RequestMapping(value = "myCompleted", method = RequestMethod.POST, produces = { "application/json; charset=utf-8" }) @ApiOperation(value = "获取用户办结事宜", httpMethod = "POST", notes = "获取用户的办结事宜") public PageList myCompleted( @ApiParam(required = true, name = "queryFilter", value = "查询参数对象") @RequestBody QueryFilter queryFilter, HttpServletResponse response) throws Exception { return iFlowService.getMyCompletedList(baseContext.getCurrentUserAccout(), queryFilter); } @RequestMapping(value = "getMyRequestList", method = RequestMethod.POST, produces = { "application/json; charset=utf-8" }) @ApiOperation(value = "我的请求", httpMethod = "POST", notes = "我的请求") public PageList getMyRequestList( @ApiParam(required = true, name = "queryFilter", value = "查询参数对象") @RequestBody QueryFilter queryFilter, HttpServletResponse response) throws Exception { return iFlowService.getMyRequestList(baseContext.getCurrentUserAccout(), queryFilter); } @RequestMapping(value = "getMyDraftList", method = RequestMethod.POST, produces = { "application/json; charset=utf-8" }) @ApiOperation(value = "获取我的草稿列表", httpMethod = "POST", notes = "获取我的草稿列表") public PageList getMyDraftList( @ApiParam(required = true, name = "queryFilter", value = "查询参数对象") @RequestBody QueryFilter queryFilter, HttpServletResponse response) throws Exception { return iFlowService.getMyDraftList(baseContext.getCurrentUserAccout(), queryFilter); } @RequestMapping(value = "getReceiverCopyTo", method = RequestMethod.POST, produces = { "application/json; charset=utf-8" }) @ApiOperation(value = "获取用户的抄送转发数据", httpMethod = "POST", notes = "获取用户的抄送转发数据") public PageList getReceiverCopyTo( @ApiParam(required = true, name = "queryFilter", value = "查询参数对象") @RequestBody QueryFilter queryFilter, @ApiParam(name = "type", value = "类型:copyto(抄送) trans(转发)", allowableValues = "copyto,trans", required = false) @RequestParam(required = false) String type, HttpServletResponse response) throws Exception { return iFlowService.getReceiverCopyTo(baseContext.getCurrentUserAccout(), queryFilter, type); } @RequestMapping(value = "getMobileReceiverCopyTo", method = RequestMethod.POST, produces = { "application/json; charset=utf-8" }) @ApiOperation(value = "获取手机用户的抄送转发数据", httpMethod = "POST", notes = "获取手机用户的抄送转发数据") public PageList getMobileReceiverCopyTo( @ApiParam(required = true, name = "queryFilter", value = "查询参数对象") @RequestBody QueryFilter queryFilter, @ApiParam(name = "type", value = "类型:copyto(抄送) trans(转发)", allowableValues = "copyto,trans", required = false) @RequestParam(required = false) String type, HttpServletResponse response) throws Exception { queryFilter.addFilter("support_mobile_", 1, QueryOP.EQUAL, FieldRelation.AND, "m"); return iFlowService.getReceiverCopyTo(baseContext.getCurrentUserAccout(), queryFilter, type); } @RequestMapping(value = "myCopyTo", method = RequestMethod.POST, produces = { "application/json; charset=utf-8" }) @ApiOperation(value = "由我发出的抄送", httpMethod = "POST", notes = "获取用户的抄送转发数据") public PageList myCopyTo( @ApiParam(required = true, name = "queryFilter", value = "查询参数对象") @RequestBody QueryFilter queryFilter) throws Exception { return iFlowService.myCopyTo(baseContext.getCurrentUserAccout(), queryFilter); } @RequestMapping(value = "revokeInstance", method = RequestMethod.POST, produces = { "application/json; charset=utf-8" }) @ApiOperation(value = "根据实例id撤回流程(撤销)", httpMethod = "POST", notes = "根据实例id撤回流程(撤销)") @AvoidRepeatableCommit public CommonResult revokeInstance( @ApiParam(required = true, name = "revokeParamObject", value = "流程撤销对象") @RequestBody RevokeParamObject revokeParamObject) throws Exception { return iFlowService.revokeInstance(revokeParamObject); } @RequestMapping(value = "getProcessRunByTaskId", method = RequestMethod.GET, produces = { "application/json; charset=utf-8" }) @ApiOperation(value = "根据taskId获取对应的流程运行对象", notes = "根据taskId获取对应的流程运行对象", httpMethod = "GET") public BpmProcessInstance getProcessRunByTaskId( @ApiParam(name = "taskId", value = "任务id", required = true) @RequestParam String taskId) throws Exception { return iProcessService.getProcessRunByTaskId(taskId); } @RequestMapping(value = "getInstancetByBusinessKey", method = RequestMethod.GET, produces = { "application/json; charset=utf-8" }) @ApiOperation(value = "通过businessKey获取运行实例", notes = "通过businessKey获取运行实例", httpMethod = "GET") public BpmProcessInstance getInstancetByBusinessKey( @ApiParam(name = "businessKey", value = "业务主键", required = true) @RequestParam String businessKey) throws Exception { return iProcessService.getInstancetByBusinessKey(businessKey); } @RequestMapping(value = "getInstancetByBizKeySysCode", method = RequestMethod.GET, produces = { "application/json; charset=utf-8" }) @ApiOperation(value = "通过businessKey获取运行实例", notes = "通过businessKey获取运行实例", httpMethod = "GET") public BpmProcessInstance getInstancetByBizKeySysCode( @ApiParam(name = "businessKey", value = "业务主键", required = true) @RequestParam String businessKey, @ApiParam(name = "sysCode", value = "业务系统编码", required = true) @RequestParam String sysCode) throws Exception { return iProcessService.getInstancetByBizKeySysCode(businessKey, sysCode); } @RequestMapping(value = "getInstanceByInstId", method = RequestMethod.GET, produces = { "application/json; charset=utf-8" }) @ApiOperation(value = "根据实例id获取实例对象", notes = "根据实例id获取实例对象", httpMethod = "GET") public BpmProcessInstance getInstanceByInstId( @ApiParam(name = "instId", value = "实例id", required = true) @RequestParam String instId) throws Exception { return iProcessService.getInstanceByInstId(instId); } @RequestMapping(value = "getInstanceListByXml", method = RequestMethod.GET, produces = { "application/json; charset=utf-8" }) @ApiOperation(value = "根据xml获取实例列表", notes = "根据xml获取实例列表,xml的根元素包含属性account(用户帐号)、subject(标题)、
status(流程状态,draft草稿,pending挂起,running运行中,manualend人工结束,revokeToStart撤销到发起人,back驳回,end结束)、
" + "pageSize(分页大小,不填默认20)、currentPage(当前页,不填默认第一页)", httpMethod = "GET") public PageList getInstanceListByXml( @ApiParam(name = "xml", value = "xml", required = true) @RequestParam String xml) throws Exception { return iProcessService.getInstanceListByXml(xml); } @RequestMapping(value = "forbiddenInstance", method = RequestMethod.GET, produces = { "application/json; charset=utf-8" }) @ApiOperation(value = "通过流程实例id挂起流程实例", notes = "通过流程实例id挂起流程实例", httpMethod = "GET") public CommonResult forbiddenInstance( @ApiParam(name = "instId", value = "实例id", required = true) @RequestParam String instId,@ApiParam(name = "taskId", value = "任务id", required = false)@RequestParam(required = false) String taskId) throws Exception { if(StringUtil.isNotEmpty(taskId)){ BpmUtil.checkDefForbidStatus(null,instId , taskId); DefaultBpmTask defaultBpmTask = bpmTaskManager.get(taskId); if (BeanUtils.isEmpty(defaultBpmTask) || BpmUtil.isCompletedByTaskStatus(defaultBpmTask.getStatus())) { throw new BaseException("任务不存在或已被处理!"); } } return iProcessService.forbiddenInstance(instId); } @RequestMapping(value = "unForbiddenInstance", method = RequestMethod.GET, produces = { "application/json; charset=utf-8" }) @ApiOperation(value = "通过流程实例id取消挂起流程实例", notes = "通过流程实例id取消挂起流程实例", httpMethod = "GET") public CommonResult unForbiddenInstance( @ApiParam(name = "instId", value = "实例id", required = true) @RequestParam String instId) throws Exception { return iProcessService.unForbiddenInstance(instId); } @RequestMapping(value = "getBpmProcessByParentIdAndSuperNodeId", method = RequestMethod.GET, produces = { "application/json; charset=utf-8" }) @ApiOperation(value = "根据父流程实例ID和节点定义ID查子流程实例", notes = "根据父流程实例ID和节点定义ID查子流程实例", httpMethod = "GET") public List getBpmProcessByParentIdAndSuperNodeId( @ApiParam(name = "parentInstId", value = "父实例ID", required = true) @RequestParam String parentInstId, @ApiParam(name = "superNodeId", value = "节点ID", required = true) @RequestParam String superNodeId) throws Exception { return iProcessService.getBpmProcessByParentIdAndSuperNodeId(parentInstId, superNodeId); } @RequestMapping(value = "getInstancesByParentId", method = RequestMethod.GET, produces = { "application/json; charset=utf-8" }) @ApiOperation(value = "通过父流程实例ID和实例的状态获取实例列表", notes = "通过父流程实例ID和实例的状态获取实例列表", httpMethod = "GET") public List getInstancesByParentId( @ApiParam(name = "parentInstId", value = "父实例ID", required = true) @RequestParam String parentInstId, @ApiParam(name = "status", value = "状态(draft:草稿,running:运行中,end:结束,manualend:人工结束,backToStart:驳回到发起人,back:驳回,revoke:撤销,revokeToStart:撤销到发起人)", required = true) @RequestParam String status) throws Exception { return iProcessService.getInstancesByParentId(parentInstId, status); } @RequestMapping(value = "getInstancesByDefId", method = RequestMethod.GET, produces = { "application/json; charset=utf-8" }) @ApiOperation(value = "通过流程定义id和实例的状态获取实例列表", notes = "通过流程定义id和实例的状态获取实例列表", httpMethod = "GET") public List getInstancesByDefId( @ApiParam(name = "defId", value = "", required = true) @RequestParam String defId, @ApiParam(name = "status", value = "状态(draft:草稿,running:运行中,end:结束,manualend:人工结束,backToStart:驳回到发起人,back:驳回,revoke:撤销,revokeToStart:撤销到发起人)", required = true) @RequestParam String status) throws Exception { return iProcessService.getInstancesByDefId(defId, status); } @RequestMapping(value = "getTopBpmProcessInstance", method = RequestMethod.GET, produces = { "application/json; charset=utf-8" }) @ApiOperation(value = "根据流程实例ID查询顶级的流程实例(根据父实例向上查找,只到找到父实例为0的实例为止)", notes = "根据流程实例ID查询顶级的流程实例(根据父实例向上查找,只到找到父实例为0的实例为止)", httpMethod = "GET") public BpmProcessInstance getTopBpmProcessInstance( @ApiParam(name = "instId", value = "实例id", required = true) @RequestParam String instId) throws Exception { return iProcessService.getTopBpmProcessInstance(instId); } @RequestMapping(value = "getMyRequestListAll", method = RequestMethod.POST, produces = { "application/json; charset=utf-8" }) @ApiOperation(value = "我的请求(包括人工终止和结束状态的实例)", httpMethod = "POST", notes = "我的请求(包括人工终止和结束状态的实例)") public PageList getMyRequestListAll( @ApiParam(required = true, name = "queryFilter", value = "查询参数对象") @RequestBody QueryFilter queryFilter, HttpServletResponse response) throws Exception { return iFlowService.getMyRequestListAll(baseContext.getCurrentUserAccout(), queryFilter); } @RequestMapping(value = "getBpmImage", method = RequestMethod.POST, produces = { "application/json; charset=utf-8" }) @ApiOperation(value = "根据流程定义id或流程实例id或任务id或BPMN实例ID获取流程图。", notes = "根据流程定义id或流程实例id或任务id或BPMN实例ID获取流程图。", httpMethod = "POST") public String getBpmImage( @ApiParam(name = "BpmImageParamObject", value = "获取流程图(状态)参数", required = true) @RequestBody BpmImageParamObject bpmImageParamObject) throws Exception { return iProcessService.getBpmImage(bpmImageParamObject); } @RequestMapping(value = "getInstanceList", method = RequestMethod.POST, produces = { "application/json; charset=utf-8" }) @ApiOperation(value = "查询流程实例列表", httpMethod = "POST", notes = "查询流程实例列表") public PageList getInstanceList( @ApiParam(required = true, name = "queryFilter", value = "查询参数对象") @RequestBody QueryFilter queryFilter, @ApiParam(required = true, name = "defId", value = "查询参数对象") @RequestParam Optional defId) throws Exception { if (StringUtil.isNotEmpty(defId.orElse(""))) queryFilter.addFilter("proc_def_id_", defId.orElse(""), QueryOP.EQUAL); return iFlowService.getInstanceList(baseContext.getCurrentUserAccout(), queryFilter); } @RequestMapping(value = "newProcess", method = RequestMethod.POST, produces = { "application/json; charset=utf-8" }) @ApiOperation(value = "新建流程", httpMethod = "POST", notes = "查询新建流程列表") public PageList newProcess( @ApiParam(required = true, name = "queryFilter", value = "查询参数对象") @RequestBody QueryFilter queryFilter) throws Exception { return iFlowService.newProcess(baseContext.getCurrentUserAccout(), queryFilter); } @RequestMapping(value = "newProcessCard", method = RequestMethod.POST, produces = {"application/json; charset=utf-8"}) @ApiOperation(value = "新建流程卡片,通过流程key分组,取前n个", httpMethod = "POST", notes = "新建流程卡片,通过流程key分组,取前n个") public CommonResult>> newProcessCard(@ApiParam(required = true, name = "queryFilter", value = "查询参数对象") @RequestBody QueryFilter queryFilter, @ApiParam(required = true, name = "size", value = "每组个数") Integer size)throws Exception { Map> map = iFlowService.newProcessCard(baseContext.getCurrentUserAccout(), queryFilter, size); return new CommonResult<>(true, "获取成功", map); } @PostMapping(value = "newProcessCount", produces = { "application/json; charset=utf-8" }) @ApiOperation(value = "新建流程", httpMethod = "POST", notes = "查询新建流程列表") public List> newProcessCount( @ApiParam(required = true, name = "queryFilter", value = "查询参数对象") @RequestBody QueryFilter queryFilter) throws Exception { return iFlowService.newProcessCount(queryFilter); } @RequestMapping(value = "myRequest", method = RequestMethod.POST, produces = { "application/json; charset=utf-8" }) @ApiOperation(value = "我的请求", httpMethod = "POST", notes = "查询我的请求列表") public PageList myRequest( @ApiParam(required = true, name = "queryFilter", value = "查询参数对象") @RequestBody QueryFilter queryFilter) throws Exception { return iFlowService.myRequest(baseContext.getCurrentUserAccout(), queryFilter); } @GetMapping(value = "myRequestCount", produces = { "application/json; charset=utf-8" }) @ApiOperation(value = "我的请求", httpMethod = "POST", notes = "查询我的请求列表在个分类的数量") public List> myRequestCount() throws Exception { return iFlowService.myRequestCount(baseContext.getCurrentUserAccout()); } @RequestMapping(value = "myMobileRequest", method = RequestMethod.POST, produces = { "application/json; charset=utf-8" }) @ApiOperation(value = "手机端我的请求", httpMethod = "POST", notes = "查询手机端我的请求列表") public PageList myMobileRequest( @ApiParam(required = true, name = "queryFilter", value = "查询参数对象") @RequestBody QueryFilter queryFilter) throws Exception { // queryFilter.addFilter("SUPPORT_MOBILE_", 1, QueryOP.EQUAL,FieldRelation.AND,"m"); if (BeanUtils.isNotEmpty(queryFilter)){ List sorter = queryFilter.getSorter(); List fieldSortList = new ArrayList<>(); //移动端,草稿案件始终排在我的申请列表最前面 fieldSortList.add(new FieldSort("isDraft",Direction.DESC)); if (BeanUtils.isNotEmpty(sorter)){ fieldSortList.addAll(sorter); } queryFilter.setSorter(fieldSortList); } return iFlowService.myRequest(baseContext.getCurrentUserAccout(), queryFilter); } @RequestMapping(value = "myMobileDraft", method = RequestMethod.POST, produces = { "application/json; charset=utf-8" }) @ApiOperation(value = "获取手机端我的草稿列表", httpMethod = "POST", notes = "获取手机端我的草稿列表") public PageList myMobileDraft( @ApiParam(required = true, name = "queryFilter", value = "查询参数对象") @RequestBody QueryFilter queryFilter, HttpServletResponse response) throws Exception { queryFilter.addFilter("SUPPORT_MOBILE_", 1, QueryOP.EQUAL, FieldRelation.AND, "m"); return iFlowService.getMyDraftList(baseContext.getCurrentUserAccout(), queryFilter); } @RequestMapping(value = "myMobileProcess", method = RequestMethod.POST, produces = { "application/json; charset=utf-8" }) @ApiOperation(value = "手机端新建流程", httpMethod = "POST", notes = "手机端查询新建流程列表") public PageList myMobileProcess( @ApiParam(required = true, name = "queryFilter", value = "查询参数对象") @RequestBody QueryFilter queryFilter) throws Exception { // queryFilter.addFilter("SUPPORT_MOBILE_", 1, QueryOP.EQUAL, FieldRelation.AND, "m"); return iFlowService.newProcess(baseContext.getCurrentUserAccout(), queryFilter); } @RequestMapping(value = "myMobileProcessShowButton", method = RequestMethod.POST, produces = { "application/json; charset=utf-8" }) @ApiOperation(value = "手机端查询新建流程列表时,该分类是否有未配置移动表单", httpMethod = "POST", notes = "手机端查询新建流程列表时,该分类是否有未配置移动表单") public CommonResult myMobileProcessShowButton( @ApiParam(required = true, name = "queryFilter", value = "查询参数对象") @RequestBody QueryFilter queryFilter) throws Exception { queryFilter.addFilter("SUPPORT_MOBILE_", 0, QueryOP.EQUAL, FieldRelation.AND, "main"); queryFilter.setPageBean(new PageBean(1,0)); PageList queryList = iFlowService.newProcess(baseContext.getCurrentUserAccout(), queryFilter); return CommonResult.success(Long.compare(queryList.getTotal(),Long.valueOf("0"))>0); } /** * 根据任务id获取流程实例某个节点上的执行人员 * * @param taskId * @return * @throws Exception */ @RequestMapping(value = "getNodeUsers", method = RequestMethod.GET, produces = { "application/json; charset=utf-8" }) @ApiOperation(value = "根据任务id获取流程实例某个节点上的执行人员", notes = "根据任务id获取流程实例某个节点上的执行人员", httpMethod = "GET") public List getNodeUsers( @ApiParam(value = "任务id", name = "taskId", required = true) @RequestParam String taskId) throws Exception { return iProcessService.getNodeUsers(taskId); } @RequestMapping(value = "start", method = RequestMethod.POST, produces = { "application/json; charset=utf-8" }) @ApiOperation(value = "客户端启动流程", httpMethod = "POST", notes = "客户端启动流程") public StartResult start( @ApiParam(name = "startFlowParamObject", value = "流程启动参数", required = true) @RequestBody StartFlowParamObject startFlowParamObject) throws Exception { CompletableFuture start = iProcessService.start(startFlowParamObject); return start.get(); } @RequestMapping(value = "syncStart", method = RequestMethod.POST, produces = { "application/json; charset=utf-8" }) @ApiOperation(value = "客户端同步启动流程", httpMethod = "POST", notes = "客户端启动流程-采用同步线程的方式") public StartResult syncStartWithRight( @ApiParam(name = "startFlowParamObject", value = "流程启动参数", required = true) @RequestBody StartFlowParamObject startFlowParamObject) throws Exception { return iProcessService.syncStartWithRight(startFlowParamObject); } @RequestMapping(value="assignBpmTask",method=RequestMethod.POST, produces = { "application/json; charset=utf-8" }) @ApiOperation(value = "节点属性配置执行人为空时选择 assign:由审批人指定", httpMethod = "POST", notes = "节点属性配置执行人为空时选择 assign:由审批人指定") public CommonResult assignBpmTask(@ApiParam(name="map",value="参数", required = true) @RequestBody Map map) throws Exception{ return bpmTaskManager.assignBpmTask(map); } @RequestMapping(value = "saveDraft", method = RequestMethod.POST, produces = { "application/json; charset=utf-8" }) @ApiOperation(value = "保存草稿", httpMethod = "POST", notes = "保存草稿") public StartResult saveDraft( @ApiParam(name = "startFlowParamObject", value = "流程启动参数", required = true) @RequestBody StartFlowParamObject startFlowParamObject) throws Exception { startFlowParamObject.setAccount(baseContext.getCurrentUserAccout()); return iProcessService.saveDraft(startFlowParamObject); } @RequestMapping(value = "doNext", method = RequestMethod.POST, produces = { "application/json; charset=utf-8" }) @ApiOperation(value = "客户端提交数据,执行流程往下跳转", httpMethod = "POST", notes = "客户端提交数据,执行流程往下跳转") public CommonResult doNext( @ApiParam(name = "doNextParamObject", value = "流程向下执行对象", required = true) @RequestBody DoNextParamObject doNextParamObject) throws Exception { return iProcessService.doNext(doNextParamObject); } @RequestMapping(value = "doEndProcess", method = RequestMethod.POST, produces = { "application/json; charset=utf-8" }) @ApiOperation(value = "人工终止流程", httpMethod = "POST", notes = "人工终止流程") @AvoidRepeatableCommit public CommonResult doEndProcess( @ApiParam(name = "doEndParamObject", value = "流程终止对象") @RequestBody DoEndParamObject doEndParamObject) throws Exception { return iProcessService.doEndProcess(doEndParamObject); } @RequestMapping(value = "renewProcess", method = RequestMethod.GET, produces = { "application/json; charset=utf-8" }) @ApiOperation(value = "终止恢复", httpMethod = "GET", notes = "人工终止流程恢复") public CommonResult renewProcess(@ApiParam(name = "id", required = true, value = "流程实例id") @RequestParam String id, @ApiParam(name = "reason", required = true, value = "终止原因") @RequestParam String reason) throws Exception { return iProcessService.renewProcess(id, reason); } @RequestMapping(value = "getHistoryOpinion", method = RequestMethod.GET, produces = { "application/json; charset=utf-8" }) @ApiOperation(value = "按流程实例ID或任务实例ID取得某个流程的审批历史", httpMethod = "GET", notes = "按流程实例ID或任务实例ID取得某个流程的审批历史") public List getHistoryOpinion( @ApiParam(name = "instanId", value = "流程实例id", required = false) @RequestParam(required = false) String instanId, @ApiParam(name = "taskId", value = "任务id", required = false) @RequestParam(required = false) String taskId) throws Exception { return iProcessService.getHistoryOpinion(instanId, taskId); } @RequestMapping(value = "getProcessOpinionByActInstId", method = RequestMethod.GET, produces = { "application/json; charset=utf-8" }) @ApiOperation(value = "按Activiti实例Id取得对应流程的审批历史", httpMethod = "GET", notes = "按Activiti实例Id取得对应流程的审批历史") public List getProcessOpinionByActInstId( @ApiParam(name = "actTaskId", value = "Activiti任务Id", required = true) @RequestParam String actTaskId) throws Exception { return iProcessService.getProcessOpinionByActInstId(actTaskId); } @RequestMapping(value = "getEnableRejectNode", method = RequestMethod.POST, produces = { "application/json; charset=utf-8" }) @ApiOperation(value = "根据任务ID获取可驳回的节点", httpMethod = "POST", notes = "根据任务ID获取可驳回的节点,rejectType驳回方式:direct直来直往,normal按照流程图执行") public List getEnableRejectNode( @ApiParam(name = "taskId", value = "任务id") @RequestParam String taskId, @ApiParam(name = "rejectType", allowableValues = "direct,normal", value = "返回方式") @RequestParam String rejectType) throws Exception { return iProcessService.getEnableRejectNode(taskId, rejectType); } @RequestMapping(value = "getBusinessKey", method = RequestMethod.GET, produces = { "application/json; charset=utf-8" }) @ApiOperation(value = "根据任务ID或流程实例ID获取BusinessKey(流程表单为URL表单的情况)", httpMethod = "GET", notes = "根据任务ID或流程实例ID获取BusinessKey(流程表单为URL表单的情况)") public CommonResult getBusinessKey( @ApiParam(name = "instanId", value = "流程实例id", required = false) @RequestParam(required = false) String instanId, @ApiParam(name = "taskId", value = "任务id", required = false) @RequestParam(required = false) String taskId) throws NullPointerException { return iProcessService.getBusinessKey(instanId, taskId); } @RequestMapping(value = "getProcInstId", method = RequestMethod.POST, produces = { "application/json; charset=utf-8" }) @ApiOperation(value = "根据BussinessKey获取流程实例ID", httpMethod = "POST", notes = "根据BussinessKey获取流程实例ID") public CommonResult getProcInstId( @ApiParam(name = "businessKey", value = "businessKey") @RequestParam String businessKey) throws NullPointerException { return iProcessService.getProcInstId(businessKey); } /** * 根据任务id获取在线表单地址 * * @param taskId * @return * @throws Exception */ @RequestMapping(value = "getDetailUrl", method = RequestMethod.GET, produces = { "application/json;charset=utf-8" }) @ApiOperation(value = "根据任务id获取在线表单地址", notes = "根据任务id获取在线表单地址", httpMethod = "GET") public String getDetailUrl(@ApiParam(name = "taskId", value = "任务id") @RequestParam String taskId) throws Exception { return iProcessService.getDetailUrl(taskId); } @RequestMapping(value = "transToMore", method = RequestMethod.POST, produces = { "application/json; charset=utf-8" }) @ApiOperation(value = "抄送转发", httpMethod = "POST", notes = "抄送转发") public CommonResult transToMore( @ApiParam(required = true, name = "copyToParam", value = "抄送转发参数对象") @RequestBody CopyToParam copyToParam) throws Exception { CommonResult res=instanceService.transToMore(copyToParam); return res; } @RequestMapping(value = "getInstFormAndBO", method = RequestMethod.GET, produces = { "application/json; charset=utf-8" }) @ApiOperation(value = "获取流程实例的表单和数据", notes = "获取流程实例的表单和数据", httpMethod = "GET") @PermissionCheck(instanceId = "#proInstId",isDefAuthorize = "#isDefAuthorize") public CommonResult getInstFormAndBO( @ApiParam(name = "proInstId", value = "流程实例id") @RequestParam(required = false) String proInstId, @ApiParam(name = "nodeId", value = "任务节点id") @RequestParam Optional nodeId, @ApiParam(name = "formId", value = "表单id") @RequestParam Optional formId, @ApiParam(name = "getStartForm", value = "获取发起节点表单") @RequestParam Optional getStartForm, @ApiParam(name = "myApplication", value = "是否是我的申请") @RequestParam Optional myApplication, @ApiParam(name = "includData", value = "任务节点id") @RequestParam Optional includData, @ApiParam(name = "isDefAuthorize", value = "是否是分管授权获取的打开权限") @RequestParam(required = false) String isDefAuthorize ) throws Exception { InstFormAndBoVo instFormAndBO = iFlowService.getInstFormAndBO(proInstId, nodeId.orElse(null), formId.orElse(null), FormType.PC, includData.orElse(true), getStartForm.orElse(false),myApplication.orElse(false)); FormModel form = instFormAndBO.getForm(); if((BeanUtils.isEmpty(instFormAndBO.getData()) || instFormAndBO.getData().isEmpty()) && form != null && FormCategory.INNER.value().equals(form.getFormType())){ List boDatas = boDataService.getDataByDefId(instFormAndBO.getInstance().getProcDefId()); ObjectNode jsondata = (ObjectNode) BoDataUtil.hanlerData(boDatas); instFormAndBO.setData(jsondata); } return CommonResult.ok().value(instFormAndBO); } @RequestMapping(value = "getMobileInstFormAndBO", method = RequestMethod.GET, produces = { "application/json; charset=utf-8" }) @ApiOperation(value = "获取手机流程实例的表单和数据", notes = "获取手机流程实例的表单和数据", httpMethod = "GET") public InstFormAndBoVo getMobileInstFormAndBO( @ApiParam(name = "proInstId", value = "流程实例id") @RequestParam Optional proInstId, @ApiParam(name = "nodeId", value = "任务节点id") @RequestParam Optional nodeId,@ApiParam(name = "myApplication", value = "我的申请") @RequestParam Optional myApplication) throws Exception { return iFlowService.getInstFormAndBO(proInstId.orElse(null), nodeId.orElse(null), null, FormType.MOBILE, true, false,myApplication.orElse(false)); } @RequestMapping(value = "getFormAndBO", method = RequestMethod.POST, produces = { "application/json; charset=utf-8" }) @ApiOperation(value = "流程启动时获取bo和表单", notes = "流程启动时获取bo和表单", httpMethod = "POST") @PermissionCheck(instanceId = "#startCmdParam.proInstId") public FormAndBoVo getFormAndBO( @ApiParam(required = true, name = "startCmdParam", value = "参数对象") @RequestBody StartCmdParam startCmdParam) throws Exception { return iFlowService.getFormAndBO(startCmdParam, FormType.PC); } @RequestMapping(value = "getMobileFormAndBO", method = RequestMethod.POST, produces = { "application/json; charset=utf-8" }) @ApiOperation(value = "手机流程启动时获取bo和表单", notes = "手机流程启动时获取bo和表单", httpMethod = "POST") public FormAndBoVo getMobileFormAndBO( @ApiParam(required = true, name = "startCmdParam", value = "参数对象") @RequestBody StartCmdParam startCmdParam) throws Exception { return iFlowService.getFormAndBO(startCmdParam, FormType.MOBILE); } @RequestMapping(value = "getStartCmd", method = RequestMethod.POST, produces = { "application/json; charset=utf-8" }) @ApiOperation(value = "获取发起的cmd格式数据", httpMethod = "POST", notes = "获取发起的cmd格式数据") public DefaultProcessInstCmd getStartCmd(@RequestBody StartCmdParam startCmdParam) throws Exception { return iFlowService.getStartCmd(startCmdParam); } @RequestMapping(value = "startForm", method = RequestMethod.POST, produces = { "application/json; charset=utf-8" }) @ApiOperation(value = "业务数据模板中 启动流程实例", httpMethod = "POST", notes = "业务数据模板中 启动流程实例") public CommonResult startForm( @ApiParam(required = true, name = "defKey", value = "流程定义defKey") @RequestParam String defKey, @ApiParam(required = true, name = "businessKey", value = "业务主键") @RequestParam String businessKey, @ApiParam(required = true, name = "boAlias", value = "bo定义alias") @RequestParam String boAlias) throws Exception { return instanceService.startForm(defKey,businessKey,boAlias); } @RequestMapping(value = "sendNodeUsers", method = RequestMethod.GET, produces = { "application/json; charset=utf-8" }) @ApiOperation(value = "获取可发送到节点指定人", httpMethod = "GET", notes = "获取可发送到节点指定人") public List nodeUsers( @ApiParam(required = true, name = "defId", value = "流程定义id") @RequestParam String defId, @ApiParam(name = "nodeId", value = "节点id") @RequestParam String nodeId) throws Exception { return instanceService.nodeUsers(defId,nodeId); } @RequestMapping(value = "selectDestination", method = RequestMethod.GET, produces = { "application/json; charset=utf-8" }) @ApiOperation(value = "选择路径", notes = "选择路径", httpMethod = "GET") public SelectDestinationVo selectDestination( @ApiParam(name = "defId", value = "流程定义id", required = true) @RequestParam String defId) throws Exception { return iFlowService.selectDestination(defId); } @RequestMapping(value = "instanceToStart", method = RequestMethod.GET, produces = { "application/json; charset=utf-8" }) @ApiOperation(value = "进入流程页面获取相关数据", notes = "进入流程页面获取相关数据", httpMethod = "GET") public BpmDefExtProperties instanceToStart( @ApiParam(name = "defId", value = "流程定义id", required = true) @RequestParam String defId) throws Exception { BpmProcessDef procDef = bpmDefinitionAccessor.getBpmProcessDef(defId); BpmDefExtProperties prop = procDef.getProcessDefExt().getExtProperties(); return prop; } @RequestMapping(value = "instanceToCopyTo", method = RequestMethod.GET, produces = { "application/json; charset=utf-8" }) @ApiOperation(value = "进入流程转发页面", notes = "进入流程转发页面", httpMethod = "GET") public ToCopyToVo toCopyTo( @ApiParam(name = "proInstId", value = "流程实例id", required = true) @RequestParam String proInstId, @ApiParam(name = "taskId", value = "任务id", required = true) @RequestParam String taskId, @ApiParam(name = "copyToType", value = "类型:0 抄送 1转发", required = true) @RequestParam String copyToType) throws Exception { return instanceService.toCopyTo(proInstId,taskId,copyToType); } @RequestMapping(value = "get", method = RequestMethod.GET, produces = { "application/json; charset=utf-8" }) @ApiOperation(value = "获取流程实例明细", httpMethod = "GET", notes = "获取流程实例明细") public ObjectNode get( @ApiParam(name = "id", value = "流程实例id", required = true) @RequestParam String id) throws Exception { return bpmProcessInstanceManager.getInstDetail(id); } @RequestMapping(value = "realDetail", method = RequestMethod.GET, produces = { "application/json; charset=utf-8" }) @ApiOperation(value = "获取流程实例明细", httpMethod = "GET", notes = "获取流程实例明细") public DefaultBpmProcessInstance realDetail( @ApiParam(name = "cptoReceiverId", value = "抄送接收对象id", required = true) @RequestParam String cptoReceiverId, @ApiParam(name = "id", value = "流程实例id", required = true) @RequestParam String id) throws Exception { BpmCptoReceiver model = bpmCptoReceiverManager.get(cptoReceiverId); if (model != null && model.getIsRead() == 0) { model.setIsRead((short) 1); bpmCptoReceiverManager.update(model); } return bpmProcessInstanceManager.get(id); } @RequestMapping(value = "instanceFlowImage", method = RequestMethod.GET, produces = { "application/json; charset=utf-8" }) @ApiOperation(value = "获取流程实例明细", httpMethod = "GET", notes = "获取流程实例明细") public FlowImageVo flowImage( @ApiParam(name = "proInstId", value = "流程实例id", required = true) @RequestParam Optional proInstId, @ApiParam(name = "type", value = "如果为子流程:subFlow") @RequestParam Optional type, @ApiParam(name = "from", value = "") @RequestParam Optional from, @ApiParam(name = "nodeId", value = "节点id") @RequestParam Optional nodeId, @ApiParam(name = "defId", value = "流程定义id") @RequestParam Optional defId, @ApiParam(name = "isScale", value = "缩放比例") @RequestParam Optional scalePrcent) throws Exception { ThreadMsgUtil.addMapMsg(BpmConstants.FLOW_CHART_SCALING, String.valueOf(scalePrcent.orElse((double) 1))); return iFlowService.flowImage(proInstId.orElse(null), type.orElse(null), from.orElse(null), nodeId.orElse(null), defId.orElse(null)); } @RequestMapping(value = "instanceFlowImageMobile", method = RequestMethod.GET, produces = { "application/json; charset=utf-8" }) @ApiOperation(value = "获取移动端流程实例明细", httpMethod = "GET", notes = "获取流程实例明细") public FlowImageMobileVo flowImageFormMobile( @ApiParam(name = "proInstId", value = "流程实例id", required = true) @RequestParam Optional proInstId, @ApiParam(name = "type", value = "如果为子流程:subFlow") @RequestParam Optional type, @ApiParam(name = "from", value = "") @RequestParam Optional from, @ApiParam(name = "nodeId", value = "节点id") @RequestParam Optional nodeId, @ApiParam(name = "defId", value = "流程定义id") @RequestParam Optional defId) throws Exception { FlowImageMobileVo flowImageVo = iFlowService.flowImageMobile(proInstId.orElse(null), type.orElse(null), from.orElse(null), nodeId.orElse(null), defId.orElse(null)); return flowImageVo; } @RequestMapping(value = "getBpmImage", method = RequestMethod.GET, produces = { "application/json; charset=utf-8" }) @ApiOperation(value = "获取流程图", httpMethod = "GET", notes = "获取流程图") public String getBpmImage(@ApiParam(name = "defId", value = "流程定义id") @RequestParam Optional defId, @ApiParam(name = "bpmnInstId", value = "bpmnInstId") @RequestParam Optional bpmnInstId, @ApiParam(name = "taskId", value = "taskId") @RequestParam Optional taskId, @ApiParam(name = "proInstId", value = "proInstId") @RequestParam Optional proInstId, @ApiParam(name = "isScale", value = "缩放比例") @RequestParam Optional scalePrcent) throws Exception { ThreadMsgUtil.addMapMsg(BpmConstants.FLOW_CHART_SCALING, String.valueOf(scalePrcent.orElse((double) 1))); BpmImageParamObject object = new BpmImageParamObject(); object.setDefId(defId.orElse(null)); object.setBpmnInstId(bpmnInstId.orElse(null)); object.setTaskId(taskId.orElse(null)); object.setProcInstId(proInstId.orElse(null)); return iProcessService.getBpmImage(object); } @RequestMapping(value = "instanceNodeStatus", method = RequestMethod.GET, produces = { "application/json; charset=utf-8" }) @ApiOperation(value = "获取节点审批状态", httpMethod = "GET", notes = "获取节点审批状态") public NodeStatusVo getNodeStatus( @ApiParam(name = "instId", value = "流程实例id", required = true) @RequestParam String instId, @ApiParam(name = "nodeId", value = "节点id", required = true) @RequestParam String nodeId) throws Exception { List userList = null; // 获取审批情况 List bpmTaskOpinions = bpmOpinionService.getByInstNodeId(instId, nodeId); // 没有审批、则获取有审批权限的人... if (bpmTaskOpinions.size() < 1) { userList = bpmIdentityService.queryUsersByNode(instId, nodeId); } return new NodeStatusVo(userList, bpmTaskOpinions); } @RequestMapping(value = "instanceFlowOpinions", method = RequestMethod.GET, produces = { "application/json; charset=utf-8" }) @ApiOperation(value = "流程审批历史(页面数据)", httpMethod = "GET", notes = "流程审批历史") public List opinionHistory( @ApiParam(name = "instId", value = "流程实例id", required = true) @RequestParam Optional instId, @ApiParam(name = "taskId", value = "任务id", required = false) @RequestParam Optional taskId, @ApiParam(name = "isCommu", value = "是否包含沟通", required = false) @RequestParam Optional isCommu, @ApiParam(name = "isRelFlow", value = "是否相关流程", required = false) @RequestParam Optional isRelFlow, @ApiParam(name = "isRequest", value = "是否在我的请求处调用", required = false) @RequestParam Optional isRequest) throws Exception { List res=instanceService.opinionHistory(instId,taskId,isCommu,isRelFlow,isRequest); return res; } @RequestMapping(value = "remove", method = RequestMethod.DELETE, produces = { "application/json; charset=utf-8" }) @ApiOperation(value = "删除流程实例", httpMethod = "DELETE", notes = "删除流程实例") public Object remove(@ApiParam(name = "ids", value = "流程实例id,多个用“,”号隔开", required = true) @RequestParam String ids) throws Exception { Object res=instanceService.remove(ids); return res; } @RequestMapping(value = "instRemove", method = RequestMethod.DELETE, produces = { "application/json; charset=utf-8" }) @ApiOperation(value = "删除流程", httpMethod = "DELETE", notes = "删除流程") public Object instRemove(@ApiParam(name = "id", value = "流程实例id", required = true) @RequestParam String id) throws Exception { Object res=iFlowService.instRemove(id); return res; } @RequestMapping(value = "getInstDeleteLog", method = RequestMethod.POST, produces = { "application/json; charset=utf-8" }) @ApiOperation(value = "查询彻底删除的日志", httpMethod = "DELETE", notes = "查询彻底删除的日志") public PageList getInstDeleteLog(@ApiParam(required = true, name = "queryFilter", value = "查询参数对象") @RequestBody QueryFilter queryFilter) throws Exception { return instanceService.getInstDeleteLog(queryFilter); } @RequestMapping(value = "completelyRemove", method = RequestMethod.POST, produces = { "application/json; charset=utf-8" }) @ApiOperation(value = "彻底删除流程实例", httpMethod = "DELETE", notes = "彻底删除流程实例") public Object completelyRemove(@ApiParam(name = "bpmInstDeleteVos", value = "流程实例删除对象list", required = true) @RequestBody List bpmInstDeleteVos, @ApiParam(name = "content", value = "删除事由", required = true) @RequestParam String content, @ApiParam(name = "isRemoveBo" ,value = "是否删除表单数据",required = false)@RequestParam Boolean isRemoveBo) throws Exception { return instanceService.completelyRemove(bpmInstDeleteVos,content,isRemoveBo); } @RequestMapping(value = "restore", method = RequestMethod.GET, produces = { "application/json; charset=utf-8" }) @ApiOperation(value = "根据流程实例ID恢复实例数据", httpMethod = "GET", notes = "根据流程实例ID恢复实例数据") public Object restore(@ApiParam(name = "id", value = "流程实例id", required = true) @RequestParam String id) throws Exception { String[] idArr = null; if (StringUtil.isNotEmpty(id)) { idArr = id.split(","); } return iFlowService.doRestore(idArr); } @RequestMapping(value = "checkInvoke", method = RequestMethod.GET, produces = { "application/json; charset=utf-8" }) @ApiOperation(value = "判断根据流程实是否例撤销到发起人", httpMethod = "GET", notes = "判断根据流程实是否例撤销到发起人") public CommonResult checkInvoke( @ApiParam(name = "invokeToStart", value = "", required = true) @RequestParam Integer invokeToStart, @ApiParam(name = "instanceId", value = "流程实例id", required = true) @RequestParam String instanceId) throws Exception { ResultMessage result = null; invokeToStart = BeanUtils.isEmpty(invokeToStart) ? 1 : invokeToStart; if (invokeToStart == 1) { result = bpmProcessInstanceManager.canRevokeToStart(instanceId); return new CommonResult(true, result.getMessage(), null); } return new CommonResult(false, "", null); } @RequestMapping(value = "getPathNodes", method = RequestMethod.GET, produces = { "application/json; charset=utf-8" }) @ApiOperation(value = "通过流程实例ID获取流程运行轨迹", httpMethod = "GET", notes = "通过流程实例ID获取流程运行轨迹") public List getPathNodes( @ApiParam(name = "instanceId", value = "流程实例id", required = true) @RequestParam String procInstId) throws Exception { return processInstanceService.getTracksByInstId(procInstId); } @RequestMapping(value = "getStatusByRunidNodeId", method = RequestMethod.GET, produces = { "application/json;charset=utf-8" }) @ApiOperation(value = "根据实例id和节点id获取节点状态", notes = "根据实例id和节点id获取节点状态", httpMethod = "GET") public String getStatusByRunidNodeId(@ApiParam(name = "instId", value = "实例id") @RequestParam String instId, @ApiParam(name = "nodeId", value = "节点id") @RequestParam String nodeId) throws Exception { return iProcessService.getStatusByRunidNodeId(instId, nodeId); } @RequestMapping(value = "getDataByDefId", method = RequestMethod.GET, produces = { "application/json;charset=utf-8" }) @ApiOperation(value = "根据流程定义id获取bo数据", notes = "根据流程定义id获取bo数据", httpMethod = "GET") public List getDataByDefId(@ApiParam(name = "defId", value = "流程定义id") @RequestParam String defId) throws Exception { return boDataService.getDataByDefId(defId); } @RequestMapping(value = "removeDraftById", method = RequestMethod.DELETE, produces = { "application/json; charset=utf-8" }) @ApiOperation(value = " 删除草稿", httpMethod = "DELETE", notes = "删除草稿") public CommonResult removeDraftById( @ApiParam(name = "ids", value = "流程实例id,多个用“,”号隔开", required = true) @RequestParam String ids) throws Exception { String[] aryIds = null; if (!StringUtil.isEmpty(ids)) { aryIds = ids.split(","); } for(String str : aryIds){ bpmProcessInstanceManager.removeBpm(str); } return new CommonResult(true, "删除草稿成功", ""); } @RequestMapping(value = "taskTurnAssigns", method = RequestMethod.GET, produces = { "application/json; charset=utf-8" }) @ApiOperation(value = "通过Id获取转办人员", httpMethod = "GET", notes = "通过Id获取转办人员") public List taskTurnAssigns( @ApiParam(name = "taskTurnId", value = "taskTurnId", required = true) @RequestParam String taskTurnId) throws Exception { return bpmTaskTurnManager.getTurnAssignByTaskTurnId(taskTurnId); } @RequestMapping(value = "getByBusinesKey", method = RequestMethod.GET, produces = { "application/json;charset=utf-8" }) @ApiOperation(value = "获取流程实例与业务数据关系", notes = "获取流程实例与业务数据关系", httpMethod = "GET") public BpmBusLink getByBusinesKey( @ApiParam(name = "businessKey", value = "业务数据id", required = true) @RequestParam String businessKey, @ApiParam(name = "formIdentity", value = "表单标识") @RequestParam(required = false) String formIdentity, @ApiParam(name = "isNumber", value = "是否数字类型", required = true) @RequestParam Boolean isNumber) throws Exception { List bpmBusLinkList = bpmBusLinkManager.getByBusinesKey(businessKey, formIdentity, isNumber); if(CollectionUtils.isEmpty(bpmBusLinkList)){ return null; } return bpmBusLinkList.get(0); } @RequestMapping(value = "getDefaultInfobox", method = RequestMethod.GET, produces = { "application/json; charset=utf-8" }) @ApiOperation(value = "信息盒子", httpMethod = "GET", notes = "首页栏目信息盒子") public List getDefaultInfobox() throws Exception { List res=instanceService.getDefaultInfobox(); return res; } @RequestMapping(value = "getDefaultInfoMap", method = RequestMethod.GET, produces = { "application/json; charset=utf-8" }) @ApiOperation(value = "信息盒子", httpMethod = "GET", notes = "首页栏目信息盒子") public Map getDefaultInfoMap() throws Exception { Map res=instanceService.getDefaultInfoMap(); return res; } @RequestMapping(value = "getFlowsMap", method = RequestMethod.GET, produces = { "application/json; charset=utf-8" }) @ApiOperation(value = "首页栏目获取固化流程信息", httpMethod = "GET", notes = "首页栏目获取固化流程信息") public Map getFlowsMap() throws Exception { return instanceService.getFlowsMap(); } @RequestMapping(value = "getNewsAndBulletin", method = RequestMethod.POST, produces = { "application/json; charset=utf-8" }) @ApiOperation(value = "获取新闻公告", httpMethod = "POST", notes = "查询新建流程列表") public ArrayNode getNewsAndBulletin( @ApiParam(required = true, name = "queryFilter", value = "查询参数对象") @RequestBody Optional queryFilter) throws Exception { ArrayNode res=instanceService.getNewsAndBulletin(queryFilter); return res; } @RequestMapping(value = "publishMsgNews", method = RequestMethod.POST, produces = { "application/json; charset=utf-8" }) @ApiOperation(value = "通过Id获取转办人员", httpMethod = "POST", notes = "通过Id获取转办人员") public void publishMsgNews(@ApiParam(name = "params", required = true) @RequestBody String params) throws Exception { instanceService.publishMsgNews(params); } @RequestMapping(value = "getBusLink", method = RequestMethod.POST, produces = { "application/json; charset=utf-8" }) @ApiOperation(value = "根据流程实例获取关联数据", httpMethod = "POST", notes = "根据流程实例获取关联数据") public List getBusLink(@ApiParam(name = "params", required = true) @RequestBody ObjectNode params) throws Exception { List res=instanceService.getBusLink(params); return res; } /** * 获取流程运行时的变量 */ @RequestMapping(value = "getInstRunDataList", method = RequestMethod.GET, produces = { "application/json; charset=utf-8" }) @ApiOperation(value = "获取流程运行时的变量", httpMethod = "GET", notes = "获取流程运行时的变量") public List getInstRunDataList( @ApiParam(name = "instanceId", required = true) @RequestParam String instanceId) throws Exception { List res=instanceService.getInstRunDataList(instanceId); return res; } /** * 移交流程列表 * * @param userId * @return * @throws Exception */ @RequestMapping(value = "inst/listJson", method = RequestMethod.POST, produces = { "application/json; charset=utf-8" }) @ApiOperation(value = "获取移交流程列表(带分页信息,DefaultBpmProcessInstance对象)", httpMethod = "POST", notes = "获取移交流程列表(带分页信息,DefaultBpmProcessInstance对象)") public PageList listJson( @ApiParam(name = "queryFilter", value = "通用查询对象") @RequestBody QueryFilter queryFilter, @ApiParam(name = "userId", value = "移交人id", required = true) @RequestParam Optional userId) throws Exception { queryFilter.addParams("userId", userId.orElse(ContextUtil.getCurrentUserId())); PageList list = bpmProcessInstanceManager.queryByuserId(queryFilter); return list; } /** * 流程实例列表 * * @param queryFilter * @param defId * @return * @throws Exception */ @RequestMapping(value = "getInstDetailList", method = RequestMethod.POST, produces = { "application/json; charset=utf-8" }) @ApiOperation(value = "查询流程实例列表", httpMethod = "POST", notes = "查询流程实例列表") public PageList getInstDetailList( @ApiParam(required = true, name = "queryFilter", value = "查询参数对象") @RequestBody QueryFilter queryFilter, @ApiParam(required = true, name = "queryFilter", value = "查询参数对象") @RequestParam Optional defId) throws Exception { PageList res=instanceService.getInstDetailList(queryFilter,defId); return res; } @RequestMapping(value = "getByInstId", method = RequestMethod.GET, produces = { "application/json; charset=utf-8" }) @ApiOperation(value = "根据流程实例ID获取流程实例信息", httpMethod = "GET", notes = "根据流程实例ID获取流程实例信息") public DefaultBpmProcessInstance getByInstId( @ApiParam(name = "id", value = "是否相关流程", required = true) @RequestParam String id, @ApiParam(name = "isRelFlow", required = false) @RequestParam Optional isRelFlow) throws Exception { if (!isRelFlow.orElse(false)) { // 验证权限 // checkInstAuth(id); } DefaultBpmProcessInstance instance = bpmProcessInstanceManager.get(id); // iFlowService.addReadRecord(instance); return instance; } @RequestMapping(value = "getSponsorRevokeByInstId", method = RequestMethod.GET, produces = { "application/json; charset=utf-8" }) @ApiOperation(value = "根据流程实例id判断是否允许发起人撤回", httpMethod = "GET", notes = "根据流程实例id判断是否允许发起人撤回") public CommonResult getSponsorRevokeByInstId( @ApiParam(name = "instId", value = "流程实例Id", required = true) @RequestParam String instId)throws Exception { CommonResult res=instanceService.getSponsorRevokeByInstId(instId); return res; } @RequestMapping(value = "updateFlowOpinions", method = RequestMethod.POST, produces = { "application/json; charset=utf-8" }) @ApiOperation(value = "修改审批历史包含沟通", httpMethod = "POST", notes = "修改审批历史包含沟通") public CommonResult updateFlowOpinions( @ApiParam(name = "opinions", value = "审批历史信息") @RequestBody ObjectNode opinions) throws Exception { return bpmCheckOpinionManager.updateFlowOpinions(opinions); } @RequestMapping(value = "delFlowOpinions", method = RequestMethod.POST, produces = { "application/json; charset=utf-8" }) @ApiOperation(value = "删除审批历史包含沟通", httpMethod = "POST", notes = "人工终止流程") public CommonResult delFlowOpinions(@ApiParam(name = "id", value = "审批意见id") @RequestParam String id, @ApiParam(name = "opinion", value = "删除原因") @RequestBody String opinion) throws Exception { return bpmCheckOpinionManager.delFlowOpinions(id, opinion); } @RequestMapping(value = "saveFormData", method = RequestMethod.POST, produces = { "application/json; charset=utf-8" }) @ApiOperation(value = "保存表单数据", httpMethod = "POST", notes = "保存表单数据") public CommonResult saveFormData( @ApiParam(name = "startFlowParamObject", value = "流程启动参数", required = true) @RequestBody StartFlowParamObject startFlowParamObject) throws Exception { CommonResult res=instanceService.saveFormData(startFlowParamObject); return res; } @RequestMapping(value = "relatedProcess", method = RequestMethod.POST, produces = { "application/json; charset=utf-8" }) @ApiOperation(value = "根据申请人获取相关流程", httpMethod = "POST", notes = "根据申请人获取相关流程") public PageList relatedProcess( @ApiParam(required = true, name = "queryFilter", value = "查询参数对象") @RequestBody QueryFilter queryFilter) throws Exception { PageList res=instanceService.relatedProcess(queryFilter); return res; } @RequestMapping(value = "getHasAuthFlowList", method = RequestMethod.POST, produces = { "application/json; charset=utf-8" }) @ApiOperation(value = "获取有权限的流程并将其按照分类名称进行分组", httpMethod = "POST", notes = "获取有权限的流程并将其按照分类名称进行分组") public List getHasAuthFlowList( @ApiParam(required = true, name = "queryFilter", value = "查询参数对象") @RequestBody QueryFilter queryFilter) throws Exception { List res=instanceService.getHasAuthFlowList(queryFilter); return res; } @RequestMapping(value = "doNextcommu", method = RequestMethod.POST, produces = { "application/json; charset=utf-8" }) @ApiOperation(value = "沟通反馈", httpMethod = "POST", notes = "沟通反馈") public CommonResult doNextcommu( @ApiParam(name = "doNextParamObject", value = "沟通反馈对象", required = true) @RequestBody DoNextParamObject doNextParamObject, HttpServletRequest request) throws Exception { return iProcessService.doNextcommu(doNextParamObject); } @RequestMapping(value = "getRelatedInformationById", method = RequestMethod.GET, produces = { "application/json; charset=utf-8" }) @ApiOperation(value = "根据流程实例ID获取相关信息", httpMethod = "GET", notes = "根据流程实例ID获取相关信息") public RelatedInformation getRelatedInformationById(@ApiParam(name = "id", required = true) @RequestParam String id) throws Exception { return instanceService.getRelatedInformationById(id); } @RequestMapping(value = "getByRecordInstId", method = RequestMethod.POST, produces = { "application/json; charset=utf-8" }) @ApiOperation(value = "根据流程实例ID获取阅读记录", httpMethod = "POST", notes = "根据流程实例ID获取阅读记录") public PageList getByRecordInstId( @ApiParam(required = true, name = "queryFilter", value = "查询参数对象") @RequestBody QueryFilter queryFilter) throws Exception { return instanceService.getByRecordInstId(queryFilter); } @RequestMapping(value = "isSynchronize", method = RequestMethod.GET, produces = { "application/json; charset=utf-8" }) @ApiOperation(value = "根据流程实例ID,任务节点,审批状态验证审批记录", httpMethod = "GET", notes = "根据流程实例ID,任务节点,审批状态验证审批记录") public Boolean isSynchronize(@ApiParam(name = "instId", required = false) @RequestParam String instId, @ApiParam(name = "nodeIds", required = false) @RequestParam String nodeIds, @ApiParam(name = "status", required = false) @RequestParam String status, @ApiParam(name = "lastStatus", required = false) @RequestParam String lastStatus, @ApiParam(name = "lastNodeIds", required = false) @RequestParam String lastNodeIds) throws Exception { Boolean flag = false; String dbType = SQLUtil.getDbType(); String[] nodeId = nodeIds.split(","); for (String str : nodeId) { DefaultBpmCheckOpinion defaultBpmCheckOpinion = bpmCheckOpinionManager.getBpmOpinion(instId, str, dbType); if (status.equals(defaultBpmCheckOpinion.getStatus()) && !lastNodeIds.equals(str)) { flag = true; } else { if (lastNodeIds.equals(str) && lastStatus.equals(status)) { flag = true; } else { flag = false; break; } } } return flag; } @RequestMapping(value = "doEndProcessById", method = RequestMethod.GET, produces = { "application/json; charset=utf-8" }) @ApiOperation(value = "根据流程实例ID终止流程", httpMethod = "GET", notes = "根据流程实例ID终止流程") public CommonResult doEndProcessById(@ApiParam(name = "id", required = true, value = "流程实例id") @RequestParam String id, @ApiParam(name = "reason", required = false, value = "终止原因") @RequestParam Optional reason) throws Exception { return instanceService.doEndProcessById(id,reason); } @RequestMapping(value = "getFlowFieldList", method = RequestMethod.POST, produces = { "application/json;charset=utf-8" }) @ApiOperation(value = "获取流程字段信息", notes = "获取流程字段信息", httpMethod = "POST") public List> getFlowFieldList( @ApiParam(required = true, name = "queryFilter", value = "查询参数对象") @RequestBody QueryFilter queryFilter) throws Exception { return bpmProcessInstanceManager.getFlowFieldList(queryFilter); } @RequestMapping(value = "getUrgentStateConf", method = RequestMethod.POST, produces = { "application/json;charset=utf-8" }) @ApiOperation(value = "获取流程紧急状态配置", notes = "获取流程字段信息", httpMethod = "POST") public Map getUrgentStateConf( @ApiParam(required = true, name = "conf", value = "参数对象") @RequestBody ObjectNode obj) throws Exception { return iProcessService.getUrgentStateConf(obj); } @RequestMapping(value = "getUrgrntById", method = RequestMethod.POST, produces = { "application/json; charset=utf-8" }) @ApiOperation(value = "根据流程实例ID、催办人ID获取催办记录", httpMethod = "POST", notes = "根据流程实例ID、催办人ID获取催办记录") public PageList getUrgrntById( @ApiParam(required = true, name = "queryFilter", value = "查询参数对象") @RequestBody QueryFilter queryFilter) throws Exception { return bpmTaskUrgentManager.getUrgrntById(queryFilter); } @RequestMapping(value = "getExcutorNameByInstId", method = RequestMethod.GET, produces = { "application/json; charset=utf-8" }) @ApiOperation(value = "根据流程实例ID获取当前实例的所有节点和审批人", httpMethod = "GET", notes = "根据流程实例ID获取当前实例的所有节点和审批人") public Object getExcutorNameByInstId(@ApiParam(name = "instId", required = true) @RequestParam String instId) throws Exception { List includeIdList = new ArrayList(); includeIdList.add(instId); return bpmProcessInstanceManager.getNodeApprovalUsers(includeIdList); } @RequestMapping(value = "sendUrgentByInstId", method = RequestMethod.POST, produces = { "application/json;charset=utf-8" }) @ApiOperation(value = "发送人工催办", notes = "发送人工催办", httpMethod = "POST") public CommonResult sendUrgentByInstId( @ApiParam(required = true, name = "bpmTaskUrgent", value = "参数对象") @RequestBody BpmTaskUrgent bpmTaskUrgent) throws Exception { CommonResult res=instanceService.sendUrgentByInstId(bpmTaskUrgent); return res; } @RequestMapping(value = "sendBpmTaskUrgent", method = RequestMethod.POST, produces = { "application/json;charset=utf-8" }) @ApiOperation(value = "发送人工催办", notes = "发送人工催办", httpMethod = "POST") public CommonResult sendBpmTaskUrgent( @ApiParam(required = true, name = "bpmTaskUrgent", value = "参数对象") @RequestBody BpmTaskUrgent bpmTaskUrgent) throws Exception { CommonResult res=instanceService.sendBpmTaskUrgent(bpmTaskUrgent); return res; } @RequestMapping(value = "doNextCopyto", method = RequestMethod.POST, produces = { "application/json; charset=utf-8" }) @ApiOperation(value = "传阅回复", httpMethod = "POST", notes = "传阅回复") public CommonResult doNextCopyto( @ApiParam(name = "doNextParamObject", value = "传阅回复对象", required = true) @RequestBody DoNextParamObject doNextParamObject, HttpServletRequest request) throws Exception { return iProcessService.doNextCopyto(doNextParamObject); } /** * 通用流程明细页面 * * @param * @return * @throws Exception ModelAndView */ @GetMapping(value = "/getMyOftenFlow") @ApiOperation(value = "获取我的常用流程", httpMethod = "GET", notes = "获取我的常用流程") public PageList getMyOftenFlow() throws Exception { QueryFilter queryFilter = QueryFilter.build(); queryFilter.setPageBean(new PageBean(PageBean.NO_PAGE, PageBean.WITHOUT_PAGE)); PageList result = iFlowService.getMyOftenFlow(queryFilter); return result; } /** * 通用流程明细页面 * * @param * @return * @throws Exception ModelAndView */ @GetMapping(value = "/getMyMobileOftenFlow") @ApiOperation(value = "获取我的移动端常用流程", httpMethod = "GET", notes = "获取我的移动端常用流程") public PageList getMyMobileOftenFlow(@ApiParam(name = "supportMobile", value = "是否支持手机表单", required = false) @RequestParam(required = false) Integer supportMobile) throws Exception { QueryFilter queryFilter = QueryFilter.build(); queryFilter.setPageBean(new PageBean(PageBean.NO_PAGE, PageBean.WITHOUT_PAGE)); if(supportMobile != null){ queryFilter.addFilter("support_mobile_", supportMobile, QueryOP.EQUAL); } PageList result = iFlowService.getMyOftenFlowKeyHasAuthority(queryFilter); return result; } @GetMapping(value = "getMyMobileOftenFlowShowButton") @ApiOperation(value = "获取我的移动端常用流程时,是否有未配置移动表单", httpMethod = "GET", notes = "获取我的移动端常用流程时,是否有未配置移动表单") public CommonResult getMyMobileOftenFlowShowButton() throws Exception { QueryFilter queryFilter = QueryFilter.build(); queryFilter.addFilter("support_mobile_", 0, QueryOP.EQUAL); queryFilter.setPageBean(new PageBean(1,0)); PageList result = iFlowService.getMyOftenFlow(queryFilter); return CommonResult.success(Long.compare(result.getTotal(),Long.valueOf("0"))>0); } @RequestMapping(value = "revokeTrans", method = RequestMethod.POST, produces = { "application/json; charset=utf-8" }) @ApiOperation(value = "并行审批任务撤回", httpMethod = "POST", notes = "并行审批任务撤回") public CommonResult revokeTrans( @ApiParam(required = true, name = "revokeParamObject", value = "流转任务撤销对象") @RequestBody RevokeTransParamObject revokeTransParamObject) throws Exception { return iFlowService.revokeTrans(revokeTransParamObject); } @RequestMapping(value = "revokeCustomSign", method = RequestMethod.POST, produces = { "application/json; charset=utf-8" }) @ApiOperation(value = "签署撤回", httpMethod = "POST", notes = "顺序签署撤回") public CommonResult revokeSignSequence( @ApiParam(required = true, name = "revokeParamObject", value = "撤销对象") @RequestBody CustomSignRevokeParam customSignRevokeParam) throws Exception { revokeHandler.doRevoke(customSignRevokeParam); return new CommonResult(true, "撤回成功", ""); } @RequestMapping(value = "revokeSignLine", method = RequestMethod.POST, produces = { "application/json; charset=utf-8" }) @ApiOperation(value = "并行签署撤回", httpMethod = "POST", notes = "并行签署撤回") public CommonResult revokeSignLine( @ApiParam(required = true, name = "revokeParamObject", value = "撤销对象") @RequestBody RevokeSignLineParamObject revokeParamObject) throws Exception { iFlowService.revokeSignLine(revokeParamObject); return new CommonResult(true, "撤回成功", ""); } @RequestMapping(value = "getDefStatus", method = RequestMethod.GET, produces = { "application/json; charset=utf-8"}) @ApiOperation(value = "定义id或者实例id或者任务id获取流程状态", httpMethod = "GET", notes = "定义id或者实例id或者任务id获取流程状态") public String getDefStatus( @ApiParam(required = false, name = "instId", value = "实例id") @RequestParam Optional instId, @ApiParam(required = false, name = "taskId", value = "任务id") @RequestParam Optional taskId, @ApiParam(required = false, name = "defId", value = "定义id") @RequestParam Optional defId) throws Exception { return bpmProcessInstanceManager.getDefForbidStatus(defId.orElse(""),instId.orElse(""),taskId.orElse("")); } //获取节点表单 @RequestMapping(value="printBoAndFormKey",method=RequestMethod.GET, produces = {"application/json; charset=utf-8"}) public ObjectNode printBoAndFormKey(@ApiParam(required = false, name = "defId", value = "流程定义Id") @RequestParam(required = false) String defId, @ApiParam(required = false, name = "nodeId", value = "节点Id") @RequestParam(required = false) String nodeId, @ApiParam(required = true, name = "procInstId", value = "流程实例Id") @RequestParam String procInstId) throws Exception { ObjectNode res=instanceService.printBoAndFormKey(defId,nodeId,procInstId); return res; } @RequestMapping(value = "getFlowKey", method = RequestMethod.GET, produces = { "application/json; charset=utf-8" }) @ApiOperation(value = "获取流程key", httpMethod = "GET", notes = "根据定义id或流程实例ID或任务id获取流程key") public CommonResult getFlowKey(@ApiParam(name = "defId", required = true, value = "流程定义id") @RequestParam Optional defId, @ApiParam(name = "procInstId", required = true, value = "流程实例id") @RequestParam Optional procInstId, @ApiParam(name = "taskId", required = true, value = "任务id") @RequestParam Optional taskId) throws Exception { CommonResult res=instanceService.getFlowKey(defId,procInstId,taskId); return res; } @RequestMapping(value = "testRestful", method = RequestMethod.POST, produces = { "application/json; charset=utf-8" }) @ApiOperation(value = "testRestful", httpMethod = "POST", notes = "testRestful") public CommonResult testRestful( @ApiParam(required = true, name = "params", value = "params") @RequestBody String params) throws Exception { System.out.println("****************************************"); System.out.println(params); System.out.println("****************************************"); return new CommonResult(true, "成功。"); } @RequestMapping(value = "getDefaultInfoTodo", method = RequestMethod.POST, produces = { "application/json; charset=utf-8" }) @ApiOperation(value = "待办信息", httpMethod = "POST", notes = "待办信息") public Map getDefaultInfoTodo(@ApiParam(required = true, name = "map", value = "查询参数对象") @RequestBody Map map) throws Exception { Map res=instanceService.getDefaultInfoTodo(map); return res; } @RequestMapping(value = "getInstanceCountByDefKeys", method = RequestMethod.GET, produces = { "application/json; charset=utf-8" }) @ApiOperation(value = "根据流程key获取流程定义下的实例统计信息", httpMethod = "GET", notes = "根据流程key获取流程定义下的实例统计信息") public List> getInstanceCountByDefKeys(@ApiParam(required = true, name = "defKeys", value = "流程key字符串,多个逗号分隔") @RequestParam String defKeys) throws Exception { if (StringUtil.isEmpty(defKeys)) { return new ArrayList>(); } return baseService.getInstanceCountByDefKeys(defKeys.split(",")); } @RequestMapping(value = "getStartNodeTaskByInstId", method = RequestMethod.GET, produces = { "application/json; charset=utf-8" }) @ApiOperation(value = "根据流程流程实例id获取该流程在发起节点的任务", httpMethod = "GET", notes = "根据流程流程实例id获取该流程在发起节点的任务") public DefaultBpmTask getStartNodeTaskByInstId(@ApiParam(required = true, name = "instId", value = "实例id") @RequestParam String instId) throws Exception { if (StringUtil.isEmpty(instId)) { return null; } List tasks = bpmTaskManager.getByInstId(instId); if (BeanUtils.isEmpty(tasks)) { return null; } String StartNodeId = bpmDefinitionAccessor.getStartNodes(tasks.get(0).getProcDefId()).get(0).getNodeId(); for (DefaultBpmTask task : tasks) { if (task.getNodeId().equals(StartNodeId) && task.getAssigneeId().equals(baseContext.getCurrentUserId())) { return task; } } return null; } @RequestMapping(value = "getFlowFilterBusinessKeys", method = RequestMethod.POST, produces = {"application/json; charset=utf-8"}) @ApiOperation(value = "获取表单列表根据流程过滤的业务数据主键", httpMethod = "POST", notes = "获取表单列表根据流程过滤的业务数据主键") public Set getFlowFilterBusinessKeys(@ApiParam(required = true, name = "filterTypes", value = "过滤类型") @RequestBody List filterTypes, @ApiParam(required = true, name = "entName", value = "实体名") @RequestParam("entName") String entName, @ApiParam(required = true, name = "isNumberPk", value = "是否数字类型主键") @RequestParam("isNumberPk") boolean isNumberPk) { return bpmBusLinkManager.getFlowFilterBusinessKeys(filterTypes, entName, isNumberPk); } @PostMapping(value = "getInstanceByPks",produces = { "application/json; charset=utf-8" }) @ApiOperation(value = "根据bo数据ID获取表单列表流程信息", httpMethod = "POST", notes = "根据bo数据ID获取表单列表流程信息") public CommonResult> getInstanceByPks(@ApiParam(name = "boDefAlias") @RequestParam String boDefAlias, @ApiParam(name = "pks", value = "表单数据ID集合")@RequestBody List pks, @ApiParam(name = "flowKey") @RequestParam(required = false) String flowKey)throws Exception{ return new CommonResult>(true, "", iFlowService.getInstanceByPks(pks, boDefAlias,flowKey)); } @PostMapping(value = "getDataTemplateButtonPermission", produces = { "application/json; charset=utf-8" }) @ApiOperation(value = "根据流程实例ID获取表单列表按钮权限", httpMethod = "POST", notes = "根据流程实例ID获取表单列表按钮权限") public CommonResult> getDataTemplateButtonPermission(@ApiParam(name = "instIds", value = "流程实例ID集合") @RequestBody List instIds, @ApiParam(name = "permissionTypes", value = "获取类型") @RequestParam String permissionTypes)throws Exception { return new CommonResult<>(true, "获取成功", iFlowService.getDataTemplateButtonPermission(instIds, permissionTypes)); } @RequestMapping(value = "getDoneListByAccount", method = RequestMethod.POST, produces = { "application/json; charset=utf-8" }) @ApiOperation(value = "获取用户经办的流程实例", httpMethod = "POST", notes = "获取用户的已办事宜,参数status表示流程状态,不填表示查询所有") public PageList> getDoneListByAccount( @ApiParam(required = true, name = "queryFilter", value = "查询参数对象") @RequestBody QueryFilter queryFilter, @ApiParam(name="account",value="用户账号", required = true) @RequestParam String account, @ApiParam(name = "status", value = "流程状态", allowableValues = "running,end,manualend,cancel,back,revoke,revokeToStart", required = false) @RequestParam(required = false) String status, HttpServletResponse response) throws Exception { return iFlowService.getDoneInstList(account, queryFilter, status).get(); } @RequestMapping(value="divertDoneTask",method=RequestMethod.POST, produces = { "application/json; charset=utf-8" }) @ApiOperation(value = "转移已办给用户", httpMethod = "POST", notes = "转移任务给用户") public CommonResult divertDoneTask(@ApiParam(name="map",value="参数", required = true) @RequestBody Map map) throws Exception{ return iFlowService.divertDoneTask(map); } @PostMapping(value = "getDoneCountByAccount", produces = { "application/json; charset=utf-8" }) @ApiOperation(value = "获取用户经办的流程实例数", httpMethod = "POST", notes = "获取用户的已办事宜,参数status表示流程状态,不填表示查询所有") public List> getDoneCountByAccount( @ApiParam(required = true, name = "queryFilter", value = "查询参数对象") @RequestBody QueryFilter queryFilter, @ApiParam(name="account",value="用户账号", required = true) @RequestParam String account, @ApiParam(name = "status", value = "流程状态数", allowableValues = "running,end,manualend,cancel,back,revoke,revokeToStart", required = false) @RequestParam(required = false) String status, HttpServletResponse response) throws Exception { return iFlowService.getDoneInstCount(account, queryFilter, status); } @RequestMapping(value = "getStartFormKeyByFlowKey",produces = { "application/json; charset=utf-8" }) @ApiOperation(value = "根据流程key获取主板本发起时的表单", httpMethod = "GET", notes = "根据流程key获取主板本发起时的表单") public CommonResult getStartFormKeyByFlowKey(@ApiParam(required = true, name = "flowKey", value = "流程key") @RequestParam String flowKey)throws Exception{ DefaultBpmDefinition bpmDefinition = bpmDefinitionManager.getMainByDefKey(flowKey, false); if(BeanUtils.isEmpty(bpmDefinition)) { return new CommonResult(false, "流程key:"+flowKey+" 不存在"); } BpmFormService bpmFormService = BpmFormFactory.getFormService(FormType.PC); BpmNodeForm nodeForm = bpmFormService.getByDefId(bpmDefinition.getDefId()); if(BeanUtils.isEmpty(nodeForm)) { return new CommonResult(false, "流程还未设置表单"); } return new CommonResult(true, "获取成功!", nodeForm.getForm().getFormValue()); } @RequestMapping(value = "meetingRoomApply", method = RequestMethod.POST, produces = { "application/json; charset=utf-8" }) @ApiOperation(value = "会议申请绑定流程发起", httpMethod = "POST", notes = "会议申请绑定流程发起") public CommonResult meetingRoomApply(@ApiParam(name = "mappingObject", value = "会议申请信息字段映射", required = true) @RequestBody JsonNode mappingObject, @ApiParam(name="flowKey",value="流程key") @RequestParam(value="flowKey", required = true) String flowKey) throws Exception { return iProcessService.meetingRoomApply(mappingObject, flowKey); } @RequestMapping(value = "getMyDraftCount", method = RequestMethod.POST, produces = {"application/json; charset=utf-8"}) @ApiOperation(value = "获取我的草稿分类数量", httpMethod = "POST", notes = "获取我的草稿分类数量") public List> getMyDraftCount(@ApiParam(name = "queryFilter", value = "通用查询器") @RequestBody QueryFilter queryFilter) { return bpmProcessInstanceManager.getUserDraftCount(queryFilter, ContextUtil.getCurrentUserId()); } /** * 审批路径推演 * @param previewProcessVo * @return * @throws Exception */ @RequestMapping(value = "previewProcess", method = RequestMethod.POST, produces = { "application/json; charset=utf-8" }) @ApiOperation(value = "获取节点审批路径", httpMethod = "POST", notes = "获取节点审批路径") public Object previewProcess(@RequestBody @Valid PreviewProcessVo previewProcessVo) throws Exception { return previewProcessManager.previewProcess(previewProcessVo); //return previewProcessService.previewProcess(previewProcessVo); } @RequestMapping(value = "getSubInstanceList", method = RequestMethod.GET, produces = {"application/json; charset=utf-8" }) @ApiOperation(value = "获取流程实例明细", httpMethod = "GET", notes = "获取流程实例明细") public List getSubInstanceList( @ApiParam(name = "parentInstId", value = "流程实例id", required = true) @RequestParam String parentInstId, @ApiParam(name = "nodeId", value = "节点id") @RequestParam String nodeId) throws Exception { return iFlowService.getSubInstanceList(parentInstId, nodeId); } @RequestMapping(value = "getSubDefId", method = RequestMethod.GET, produces = {"application/json; charset=utf-8" }) @ApiOperation(value = "获取流程实例明细", httpMethod = "GET", notes = "获取流程实例明细") public CommonResult getSubDefId( @ApiParam(name = "parentDefId", value = "父流程定义id", required = true) @RequestParam Optional parentDefId, @ApiParam(name = "parentInstId", value = "父流程实例id", required = true) @RequestParam Optional parentInstId, @ApiParam(name = "nodeId", value = "节点id") @RequestParam String nodeId) throws Exception { return new CommonResult<>(true,"",iFlowService.getSubDefId(parentDefId.orElse(""),parentInstId.orElse(""), nodeId)); } @RequestMapping(value = "getCurUserFlowType", method = RequestMethod.GET, produces = { "application/json; charset=utf-8" }) @ApiOperation(value = "获取当前用户有权限的流程分类信息", httpMethod = "GET", notes = "获取当前用户有权限的流程分类信息") public CommonResult> getCurUserFlowType() throws Exception { return CommonResult.success(iFlowService.getCurUserFlowType()); } }