自办办理流程
确定办理程序
# 将当前办理记录的办理程序存储到上下文中
${execution.setVariableLocal('prcHandleProcedure', cmpBpmnFacade.getPrcHandleProcedure(execution))}
//获取承办记录的办理程序
public String getPrcHandleProcedure(DelegateExecution execution) {
//业务key
String processId=execution.getBusinessKey();
//获取办理记录
CmpRecordProcess prc = prcRepository.findById(processId);
//返回办理程序
return prc.getHandleInfo().getHandleProcedure();
}
普通信访程序
- 出具受理告知书
- 是否选择延期,是,出具延期告知书
- 出具答复意见书
# 走普通信访办理程序分支
${execution.getVariable('prcHandleProcedure')=='xfcx'}
出具受理告知书,答复意见书,延期告知书,判断类似,下面以受理告知为例
${execution.setVariableLocal('prcHasFinishedSlgz', cmpBpmnFacade.checkPrcHasDoc(execution,'xf_sl_xf',true))}
//检查办理记录是否有公文
public boolean checkPrcHasDoc(DelegateExecution execution,String docCategory,boolean finished) {
//业务id
String processId=execution.getBusinessKey();
CmpRecordProcess prc = prcRepository.findById(processId);
//根据业务id获取办理记录对应的受理告知书
List<DocBaseInfoDTO> docs = docQueryService.findDocBaseInfoDTOsBy(null, Arrays.asList(prc.getId()),
RelateProjConstants.PROJTYPE_CMP_PRC, Arrays.asList(docCategory), finished, null).stream()
.filter(d -> !d.isYcxStatus())
.collect(Collectors.toList());
return !CollectionUtils.isEmpty(docs);
}
Execution listeners没有使用,重要的是Message
xf_sl_xf_finish_with_proj
这是一个Receive Task 任务 等待接受受理告知书出具完成。
在公文流程中有一个Send Task 任务。这两个是相互呼应的。
# 通过这个方法 去处理等待出具的各种公文Task
${docBpmnFacade.sendDocFinishMsgWithProjs(execution,null,'_finish_with_proj')}
//发送公文完成消息
public void sendDocFinishMsgWithProjs(DelegateExecution execution, String msgNamePrefix, String msgNameSuffix) {
//公文id
String docId=execution.getBusinessKey();
Doc doc=this.docRepository.getDocById(docId);
//当前用户
OperateInfo operateInfo=(OperateInfo)execution.getVariable("operateInfo");
//前缀
if(StringUtils.isBlank(msgNamePrefix)) msgNamePrefix="";
//后缀
if(StringUtils.isBlank(msgNameSuffix)) msgNameSuffix="";
String msgName=msgNamePrefix+doc.getCreateInfo().getDocCategory()+msgNameSuffix;
String relId = (String) execution.getVariable("relId");
String eventType = null;
//处理 信访 发送公文 监听
if(doc.getBasicInfo().getValidRelateProjs().stream()
.anyMatch(r -> RelateProjConstants.PROJTYPE_CMP_PRC.equals(r.getRelateProj().getProjType()))){
eventType = "Handle_CmpSendDoc";
}
//省略....
//向办理记录发送消息
for (DocRelateProj relProj : doc.getBasicInfo().getValidRelateProjs()) {
String projId=relProj.getRelateProj().getProjId();
//找到办理记录相关的流程实例
ProcessInstance prcIns = this.runtimeService.createProcessInstanceQuery()
.active()
.leafProcessInstances()
.processInstanceBusinessKey(projId)
.singleResult();
if(prcIns == null) continue;
//将流程封装一下
List<MsgSubscriber> msgSubs = this.commonService.queryMsgSubscribers(prcIns.getProcessInstanceId(), msgName,null);
//如果没有找到,则找完成类型的流程实例
if(CollectionUtils.isEmpty(msgSubs)){
msgSubs = this.commonService.queryMsgSubscribers(prcIns.getProcessInstanceId(), "prc_finish",null);
}
//改为 逐个触发 查询出的事件
Map<String,Object> processVariables=Utils.buildMap("docId", docId, "operateInfo", operateInfo);
this.commonService.msgReceived(msgSubs, processVariables);
//省略....
}
办理记录的流程实例中等待出具受理告知节点,收到通知。则进行下一步流程。
答复意见书,延期告知书,办理结果报告 同上。