@ApiOperation(value = "查询代办信息(工作流)")@PostMapping(path = "/todo")public Response todo(@RequestBody PexContentBillVo cond){List<PexContentBill> list = workflowService.Todo(cond);return Response.success().setData(list);}
@Overridepublic List<PexContentBill> Todo(PexContentBillVo cond){List<PexContentBill> listAll =getTodoMessage(cond);listAll.stream().forEach(ele -> {if (BillFunc().equals(PexConstants.BILL_FUNC_LOAN)) {ele.LoanReason());}});//按照创建日期排序List<PexContentBill> sortList = listAll.stream().sorted(Comparatorparing(PexContentBill::getCreatedTime).reversed()).List());return sortList;}
private List<PexContentBill> getTodoMessage(PexContentBillVo cond){List<PexContentBill> listAssigneeAll = new ArrayList<PexContentBill>();List<PexContentBill> listAssignee = new ArrayList<PexContentBill>();List<PexContentBill> listRoles = new ArrayList<PexContentBill>();List<PexContentBill> listCandidate = new ArrayList<PexContentBill>();List<PexContentBill> listAll = new ArrayList<PexContentBill>();String userCode = Creator();String fiscal = Fiscal().toString();String sql = OrgAuthorityStr(userCode, fiscal);//查询指定代理人下的代办listAssigneeAll = commonInfoService.listAssigneeTodo(cond);listAssignee = listAssigneeAll.stream().filter(ele -> !Assignee().Creator())).List());//查询角色下的代办listRoles = commonInfoService.listRolesTodo(cond, sql);//查询候选组办理人下的代办listCandidate = commonInfoService.listCandidateTodo(cond);listAll.addAll(listAssignee);listAll.addAll(listRoles);listAll.addAll(listCandidate);return listAll;}
<select id="listAssigneeTodo" parameterType="com.ity.PexContentBill"resultType="com.ity.PexContentBill">select<include refid="allColumnAlias"/>,wf_task_id as wfTaskId,is_return as isReturn,proc_inst_id as processInstanceId,proc_def_id as processDefinitionId,assignee as assignee,executionId as executionIdfrom pex_bill inner join<include refid="com.pty.workflow.doAssignee_sql"/>on pex_bill.bill_id=wf_task.busi_keyWHERE 1=1<if test="createdTimeStart != null and createdTimeStart != ''">AND created_time >=str_to_date( #{createdTimeStart,jdbcType=VARCHAR},'%Y-%m-%d %H:%i:%S')</if><if test="createdTimeEnd != null and createdTimeEnd != ''">AND created_time <=date_add( #{createdTimeEnd,jdbcType=VARCHAR},INTERVAL 86399 SECOND)</if><if test="billNo != null and billNo != ''">AND bill_no=#{billNo,jdbcType=VARCHAR}</if><if test="billType != null and billType != ''">AND bill_type=#{billType,jdbcType=VARCHAR}</if><if test="agyCode != null and agyCode != ''">AND agy_code=#{agyCode,jdbcType=VARCHAR}</if><if test="billFunc != null and billFunc != ''">AND bill_func=#{billFunc,jdbcType=VARCHAR}</if><if test="fiscal != null">AND fiscal=#{fiscal,jdbcType=INTEGER}</if><if test="billId != null and billId != ''">AND bill_id=#{billId,jdbcType=VARCHAR}</if><if test="isSend != null and isSend != ''">AND is_send=#{isSend,jdbcType=INTEGER}</if><if test="departmentName != null and departmentName != ''">AND department_name=#{departmentName,jdbcType=VARCHAR}</if><if test="departmentCode != null and departmentCode != ''">AND department_code=#{departmentCode,jdbcType=VARCHAR}</if>order by created_time desc, bill_no desc</select><select id="listRolesTodo" parameterType="java.util.Map" resultType="com.ity.PexContentBill">select<include refid="allColumnAlias"/>,wf_task_id as wfTaskId,is_return as isReturn,proc_inst_id as processInstanceId,proc_def_id as processDefinitionId,executionId as executionIdfrom pex_bill inner join<include refid="com.pty.workflow.do_sql"/>on pex_bill.bill_id=wf_task.busi_keyWHERE 1=1${sql}<if test=atedTimeStart != null atedTimeStart != ''">AND created_time >=str_to_date( #{atedTimeStart,jdbcType=VARCHAR},'%Y-%m-%d %H:%i:%S')</if><if test=atedTimeEnd != null atedTimeEnd != ''">AND created_time <=date_add( #{atedTimeEnd,jdbcType=VARCHAR},INTERVAL 86399 SECOND)</if><if test="cond.billNo != null and cond.billNo != ''">AND bill_no=#{cond.billNo,jdbcType=VARCHAR}</if><if test="cond.billType != null and cond.billType != ''">AND bill_type=#{cond.billType,jdbcType=VARCHAR}</if><if test="cond.agyCode != null and cond.agyCode != ''">AND agy_code=#{cond.agyCode,jdbcType=VARCHAR}</if><if test="cond.billFunc != null and cond.billFunc != ''">AND bill_func=#{cond.billFunc,jdbcType=VARCHAR}</if><if test="cond.fiscal != null">AND fiscal=#{cond.fiscal,jdbcType=INTEGER}</if><if test="cond.billId != null and cond.billId != ''">AND bill_id=#{cond.billId,jdbcType=VARCHAR}</if><if test="cond.isSend != null and cond.isSend != ''">AND is_send=#{cond.isSend,jdbcType=INTEGER}</if>order by created_time desc, bill_no desc</select><select id="listCandidateTodo" parameterType="com.ity.PexContentBill"resultType="com.ity.PexContentBill">select<include refid="allColumnAlias"/>,wf_task_id as wfTaskId,is_return as isReturn,proc_inst_id as processInstanceId,proc_def_id as processDefinitionId,executionId as executionIdfrom pex_bill inner join<include refid="com.pty.workflow.doCandidate_sql"/>on pex_bill.bill_id=wf_task.busi_keyWHERE 1=1<if test="createdTimeStart != null and createdTimeStart != ''">AND created_time >=str_to_date( #{createdTimeStart,jdbcType=VARCHAR},'%Y-%m-%d %H:%i:%S')</if><if test="createdTimeEnd != null and createdTimeEnd != ''">AND created_time <=date_add( #{createdTimeEnd,jdbcType=VARCHAR},INTERVAL 86399 SECOND)</if><if test="billNo != null and billNo != ''">AND bill_no=#{billNo,jdbcType=VARCHAR}</if><if test="billType != null and billType != ''">AND bill_type=#{billType,jdbcType=VARCHAR}</if><if test="agyCode != null and agyCode != ''">AND agy_code=#{agyCode,jdbcType=VARCHAR}</if><if test="billFunc != null and billFunc != ''">AND bill_func=#{billFunc,jdbcType=VARCHAR}</if><if test="fiscal != null">AND fiscal=#{fiscal,jdbcType=INTEGER}</if><if test="billId != null and billId != ''">AND bill_id=#{billId,jdbcType=VARCHAR}</if><if test="isSend != null and isSend != ''">AND is_send=#{isSend,jdbcType=INTEGER}</if><if test="departmentName != null and departmentName != ''">AND department_name=#{departmentName,jdbcType=VARCHAR}</if><if test="departmentCode != null and departmentCode != ''">AND department_code=#{departmentCode,jdbcType=VARCHAR}</if>order by created_time desc, bill_no desc</select>
<sql id="todo_sql">(<if test=les != null">SELECTact_ru_task.ID_ AS wf_task_id,act_ru_task.ASSIGNEE_ as assignee,act_ru_task.EXECUTION_ID_ AS executionId,act_ru_task.IS_RETURN_ AS is_return,act_hi_procinst.BUSINESS_KEY_ AS busi_key,act_hi_procinst.PROC_INST_ID_ AS proc_inst_id,act_hi_procinst.PROC_DEF_ID_ AS proc_def_idFROMact_ru_taskINNER JOIN act_ru_identitylink ON act_ru_task.ID_ = act_ru_identitylink.TASK_ID_INNER JOIN act_hi_procinst ON act_hi_procinst.PROC_INST_ID_ = act_ru_task.PROC_INST_ID_WHERE 1=1AND act_ru_identitylink.GROUP_ID_ IN <foreach collection=les" index="index" item="id" open="(" separator="," close=")">#{id}</foreach></if>) wf_task</sql><sql id="todoAssignee_sql">(SELECTact_ru_task.ID_ AS wf_task_id,act_ru_task.ASSIGNEE_ as assignee,act_ru_task.EXECUTION_ID_ AS executionId,act_ru_task.IS_RETURN_ AS is_return,act_hi_procinst.BUSINESS_KEY_ AS busi_key,act_hi_procinst.PROC_INST_ID_ AS proc_inst_id,act_hi_procinst.PROC_DEF_ID_ AS proc_def_idFROMact_ru_taskINNER JOIN act_hi_procinst ON act_hi_procinst.PROC_INST_ID_ = act_ru_task.PROC_INST_ID_WHEREact_ru_task.assignee_ IS NOT NULL AND act_ru_task.assignee_ =#{creator}) wf_task</sql><sql id="todoCandidate_sql">(SELECTact_ru_task.ID_ AS wf_task_id,act_ru_task.ASSIGNEE_ as assignee,act_ru_task.EXECUTION_ID_ AS executionId,act_ru_task.IS_RETURN_ AS is_return,act_hi_procinst.BUSINESS_KEY_ AS busi_key,act_hi_procinst.PROC_INST_ID_ AS proc_inst_id,act_hi_procinst.PROC_DEF_ID_ AS proc_def_idFROMact_ru_taskINNER JOIN act_ru_identitylink ON act_ru_task.ID_ = act_ru_identitylink.TASK_ID_INNER JOIN act_hi_procinst ON act_hi_procinst.PROC_INST_ID_ = act_ru_task.PROC_INST_ID_WHERE 1=1AND act_ru_identitylink.TYPE_='candidate' AND act_ru_identitylink.USER_ID_=#{creator}) wf_task</sql>
已办:
@ApiOperation(value = "查询已办信息(工作流)")@PostMapping(path = "/done")public Response done(@RequestBody PexContentBillVo cond){List<PexContentBill> list = workflowService.Done(cond);return Response.success().setData(list);}
@Overridepublic List<PexContentBill> Done(PexContentBillVo cond){return commonInfoService.listDone(cond);}
@Overridepublic List<PexContentBill> listDone(PexContentBillVo cond) {List<PexContentBill> list = commonInfoDao.listDone(cond);list.stream().forEach(ele -> {Integer status = wfTaskService.WfTaskId());//1 可以回退 0 不可以回退ele.setFinalCanReturn(status);//挂起流程//String processInstanceIdWfTaskId());//wfRuntimeService.suspendProcess(processInstanceId);Integer recovery = wfTaskService.ProcessInstanceId(), WfTaskId());ele.setCanRecovery(recovery);String taskId = ProcessInstanceId());if (taskId != null) {ele.setNextTaskId(taskId);}if (BillFunc().equals(PexConstants.BILL_FUNC_LOAN)) {ele.LoanReason());}});return list;}
<select id="listDone" parameterType="com.pty.pex.vo.PexContentBillVo"resultType="com.ity.PexContentBill">select<include refid="allColumnAlias"/>,proc_inst_id as processInstanceId,proc_def_id as processDefinitionId,act_id_ as exeNodeId,wf_task_id wfTaskIdfrom pex_bill inner join<include refid="com.pty.workflow.dao.WfTaskDao.done_sql"/>on pex_bill.bill_id=wf_task.busi_keyWHERE 1=1<if test="createdTimeStart != null and createdTimeStart != ''">AND created_time >=str_to_date( #{createdTimeStart,jdbcType=VARCHAR},'%Y-%m-%d %H:%i:%S')</if><if test="createdTimeEnd != null and createdTimeEnd != ''">AND created_time <=date_add( #{createdTimeEnd,jdbcType=VARCHAR},INTERVAL 86399 SECOND)</if><if test="billNo != null and billNo != ''">AND bill_no=#{billNo,jdbcType=VARCHAR}</if><if test="billType != null and billType != ''">AND bill_type=#{billType,jdbcType=VARCHAR}</if><if test="agyCode != null and agyCode != ''">AND agy_code=#{agyCode,jdbcType=VARCHAR}</if><if test="billFunc != null and billFunc != ''">AND bill_func=#{billFunc,jdbcType=VARCHAR}</if><if test="fiscal != null">AND fiscal=#{fiscal,jdbcType=INTEGER}</if><if test="billId != null and billId != ''">AND bill_id=#{billId,jdbcType=VARCHAR}</if><if test="departmentCode != null and departmentCode != ''">AND department_code=#{departmentCode,jdbcType=VARCHAR}</if><if test="departmentName != null and departmentName != ''">AND department_name=#{departmentName,jdbcType=VARCHAR}</if>order by created_time desc, bill_no desc</select>
<sql id="done_sql">(SELECTact_hi_actinst.TASK_ID_ AS wf_task_id,act_hi_actinst.ACT_ID_ AS act_id_,act_hi_procinst.BUSINESS_KEY_ AS busi_key,act_hi_procinst.PROC_INST_ID_ AS proc_inst_id,act_hi_procinst.PROC_DEF_ID_ AS proc_def_idFROMact_hi_actinstINNER JOIN act_hi_procinst ON act_hi_procinst.PROC_INST_ID_ = act_hi_actinst.PROC_INST_ID_WHEREact_hi_actinst.duration_ IS NOT NULL AND act_hi_actinst.assignee_ IS NOT NULL AND act_hi_actinst.assignee_ =#{creator} ) wf_task</sql>
@SuppressWarnings("unchecked")@Overridepublic Integer isEndNode(String wfTaskId) {try {HistoricTaskInstance task = HistoryService().createHistoricTaskInstanceQuery().taskId(wfTaskId).singleResult();String id = Id();// TODO (l) 节点乱序 标记非常规节点?/** Process process =* RepositoryService().getBpmnModel(task.* getProcessDefinitionId()) .getMainProcess();* List<org.del.UserTask> taskNodes = process* .findFlowElementsOfType(org.del.UserTask.class);*/// 流程结束了ProcessInstance pi = RuntimeService().createProcessInstanceQuery()//.ProcessInstanceId())// 使用流程实例ID查询.singleResult();if (pi == null) {/** List<HistoricTaskInstance>* taskNodesHistoryService().* createHistoricTaskInstanceQuery().* ProcessInstanceId()).* orderByHistoricTaskInstanceEndTime().asc().list();*/List<HistoricActivityInstance> taskNodes = HistoryService().createHistoricActivityInstanceQuery().ProcessInstanceId()).activityType("userTask").orderByHistoricActivityInstanceEndTime().asc().list();if (taskNodes != null && id != null) {if ((taskNodes.size() - 1).getTaskId().equals(id)) {return 1;} else {return 0;}} else {return 0;}} else {// LOGGER.info("=====>流程未结束");return 0;}} catch (Exception e) {// ("=====>流程已经废止", e.getMessage());return 0;}}
@Overridepublic Integer canRecovery(String processInstanceId, String wfTaskId) {ProcessInstance pi = RuntimeService().createProcessInstanceQuery()//.processInstanceId(processInstanceId)// 使用流程实例ID查询.singleResult();try {if (pi != null) {/** List<HistoricActivityInstance> taskNodes=activitiEngine* .getHistoryService().createHistoricActivityInstanceQuery().* processInstanceId(processInstanceId).activityType("userTask").* orderByHistoricActivityInstanceEndTime().asc().list();*/List<HistoricTaskInstance> taskNodes = HistoryService().createHistoricTaskInstanceQuery().processInstanceId(processInstanceId).orderByHistoricTaskInstanceEndTime().asc().list();// TODO (l) 并行多实例情况下(0));if (taskNodes != null && wfTaskId != null) {if ((taskNodes.size() - 1).getId().equals(wfTaskId)) {return 1;} else {return 0;}} else {return 0;}} else {LOGGER.info("=====>流程已结束");return 0;}} catch (Exception e) {return 0;}}
@Overridepublic String getNextTaskId(String processInstanceId) {List<Task> list = TaskService().createTaskQuery().processInstanceId(processInstanceId).orderByTaskCreateTime().asc().list();if (list.size() == 1) {(0).getId();} else {// TODO (l) 并行多实例情况下的处理return null;}}
本文发布于:2024-02-02 14:44:38,感谢您对本站的认可!
本文链接:https://www.4u4v.net/it/170685627944494.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
留言与评论(共有 0 条评论) |