/* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.design.oa.activiti.rest.diagram.services;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.node.ArrayNode;
import com.fasterxml.jackson.databind.node.ObjectNode;
import org.activiti.engine.*;
import org.activiti.engine.history.HistoricActivityInstance;
import org.activiti.engine.impl.bpmn.behavior.BoundaryEventActivityBehavior;
import org.activiti.engine.impl.bpmn.behavior.CallActivityBehavior;
import org.activiti.engine.impl.bpmn.parser.BpmnParse;
import org.activiti.engine.impl.bpmn.parser.ErrorEventDefinition;
import org.activiti.engine.impl.bpmn.parser.EventSubscriptionDeclaration;
import org.activiti.engine.impl.jobexecutor.TimerDeclarationImpl;
import org.activiti.engine.impl.persistence.entity.ExecutionEntity;
import org.activiti.engine.impl.persistence.entity.ProcessDefinitionEntity;
import org.activiti.engine.impl.pvm.PvmTransition;
import org.activiti.engine.impl.pvm.delegate.ActivityBehavior;
import org.activiti.engine.impl.pvm.process.*;
import org.activiti.engine.repository.ProcessDefinition;
import org.activiti.engine.runtime.Execution;
import org.activiti.engine.runtime.ProcessInstance;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import java.util.*;
public class BaseProcessDefinitionDiagramLayoutResource {
@Autowired
private RuntimeService runtimeService;
@Autowired
private RepositoryService repositoryService;
@Autowired
private HistoryService historyService;
public ObjectNode getDiagramNode(String processInstanceId, String processDefinitionId) {
List<String> highLightedFlows = Collections.<String> emptyList();
List<String> highLightedActivities = Collections.<String> emptyList();
Map<String, ObjectNode> subProcessInstanceMap = new HashMap<String, ObjectNode>();
ProcessInstance processInstance = null;
if (processInstanceId != null) {
processInstance = runtimeService.createProcessInstanceQuery().processInstanceId(processInstanceId).singleResult();
if (processInstance == null) {
throw new ActivitiObjectNotFoundException("Process instance could not be found");
}
processDefinitionId = processInstance.getProcessDefinitionId();
List<ProcessInstance> subProcessInstances = runtimeService
.createProcessInstanceQuery()
.superProcessInstanceId(processInstanceId).list();
for (ProcessInstance subProcessInstance : subProcessInstances) {
String subDefId = subProcessInstance.getProcessDefinitionId();
String superExecutionId = ((ExecutionEntity) subProcessInstance)
.getSuperExecutionId();
ProcessDefinitionEntity subDef = (ProcessDefinitionEntity) repositoryService.getProcessDefinition(subDefId);
ObjectNode processInstanceJSON = new ObjectMapper().createObjectNode();
processInstanceJSON.put("processInstanceId", subProcessInstance.getId());
processInstanceJSON.put("superExecutionId", superExecutionId);
processInstanceJSON.put("processDefinitionId", subDef.getId());
processInstanceJSON.put("processDefinitionKey", subDef.getKey());
processInstanceJSON.put("processDefinitionName", subDef.getName());
subProcessInstanceMap.put(superExecutionId, processInstanceJSON);
}
}
if (processDefinitionId == null) {
throw new ActivitiObjectNotFoundException("No process definition id provided");
}
ProcessDefinitionEntity processDefinition = (ProcessDefinitionEntity) repositoryService.getProcessDefinition(processDefinitionId);
if (processDefinition == null) {
throw new ActivitiException("Process definition " + processDefinitionId + " could not be found");
}
ObjectNode responseJSON = new ObjectMapper().createObjectNode();
// Process definition
JsonNode pdrJSON = getProcessDefinitionResponse(processDefinition);
if (pdrJSON != null) {
responseJSON.put("processDefinition", pdrJSON);
}
// Highlighted activities
if (processInstance != null) {
ArrayNode activityArray = new ObjectMapper().createArrayNode();
ArrayNode flowsArray = new ObjectMapper().createArrayNode();
highLightedActivities = runtimeService.getActiveActivityIds(processInstanceId);
highLightedFlows = getHighLightedFlows(processInstanceId, processDefinition);
for (String activityName : highLightedActivities) {
activityArray.add(activityName);
}
for (String flow : highLightedFlows)
flowsArray.add(flow);
responseJSON.put("highLightedActivities", activityArray);
responseJSON.put("highLightedFlows", flowsArray);
}
// Pool shape, if process is participant in collaboration
if (processDefinition.getParticipantProcess() != null) {
ParticipantProcess pProc = processDefinition.getParticipantProcess();
ObjectNode participantProcessJSON = new ObjectMapper().createObjectNode();
participantProcessJSON.put("id", pProc.getId());
if (StringUtils.isNotEmpty(pProc.getName())) {
participantProcessJSON.put("name", pProc.getName());
} else {
participantProcessJSON.put("name", "");
}
participantProcessJSON.put("x", pProc.getX());
participantProcessJSON.put("y", pProc.getY());
participantProcessJSON.put("width", pProc.getWidth());
participantProcessJSON.put("height", pProc.getHeight());
responseJSON.put("participantProcess", participantProcessJSON);
}
// Draw lanes
if (processDefinition.getLaneSets() != null && !processDefinition.getLaneSets().isEmpty()) {
ArrayNode laneSetArray = new ObjectMapper().createArrayNode();
for (LaneSet laneSet : processDefinition.getLaneSets()) {
ArrayNode laneArray = new ObjectMapper().createArrayNode();
if (laneSet.getLanes() != null && !laneSet.getLanes().isEmpty()) {
for (Lane lane : laneSet.getLanes()) {
ObjectNode laneJSON = new ObjectMapper().createObjectNode();
laneJSON.put("id", lane.getId());
if (StringUtils.isNotEmpty(lane.getName())) {
laneJSON.put("name", lane.getName());
} else {
laneJSON.put("name", "");
}
laneJSON.put("x", lane.getX());
laneJSON.put("y", lane.getY());
laneJSON.put("width", lane.getWidth());
laneJSON.put("height", lane.getHeight());
List<String> flowNodeIds = lane.getFlowNodeIds();
ArrayNode flowNodeIdsArray = new ObjectMapper().createArrayNode();
for (String flowNodeId : flowNodeIds) {
flowNodeIdsArray.add(flowNodeId);
}
laneJSON.put("flowNodeIds", flowNodeIdsArray);
laneArray.add(laneJSON);
}
}
ObjectNode laneSetJSON = new ObjectMapper().createObjectNode();
laneSetJSON.put("id", laneSet.getId());
if (StringUtils.isNotEmpty(laneSet.getName())) {
laneSetJSON.put("name", laneSet.getName());
} else {
laneSetJSON.put("name", "");
}
laneSetJSON.put("lanes", laneArray);
laneSetArray.add(laneSetJSON);
}
if (laneSetArray.size() > 0)
responseJSON.put("laneSets", laneSetArray);
}
ArrayNode sequenceFlowArray = new
没有合适的资源?快使用搜索试试~ 我知道了~
基于BS架构的OA系统设计与实现源码+文档+全部资料+优秀项目.zip
共1076个文件
xml:211个
js:210个
png:144个
1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉
0 下载量 197 浏览量
2024-12-18
13:27:01
上传
评论
收藏 3.55MB ZIP 举报
温馨提示
【资源说明】 基于BS架构的OA系统设计与实现源码+文档+全部资料+优秀项目.zip 【备注】 1、该项目是个人高分项目源码,已获导师指导认可通过,答辩评审分达到95分 2、该资源内项目代码都经过测试运行成功,功能ok的情况下才上传的,请放心下载使用! 3、本项目适合计算机相关专业(人工智能、通信工程、自动化、电子信息、物联网等)的在校学生、老师或者企业员工下载使用,也可作为毕业设计、课程设计、作业、项目初期立项演示等,当然也适合小白学习进阶。 4、如果基础还行,可以在此代码基础上进行修改,以实现其他功能,也可直接用于毕设、课设、作业等。 欢迎下载,沟通交流,互相学习,共同进步!
资源推荐
资源详情
资源评论
收起资源包目录
基于BS架构的OA系统设计与实现源码+文档+全部资料+优秀项目.zip (1076个子文件)
CHANGES 3KB
CHANGES 3KB
BaseProcessDefinitionDiagramLayoutResource.class 19KB
DocumentServiceImp.class 16KB
AttenController.class 13KB
TaskController.class 13KB
Reject.class 12KB
ProcessInstanceHighlightsResource.class 10KB
EmailServiceImp.class 10KB
MailController.class 10KB
ReceiverOneMail.class 10KB
ModelerController.class 9KB
AnnController.class 9KB
DocumentController.class 9KB
AnnServiceImp.class 8KB
ControllerDe.class 8KB
UserServiceImp.class 8KB
AttenServiceImp.class 7KB
AdminController.class 7KB
AdminServiceImp.class 6KB
ProcessController.class 6KB
DeploymentController.class 6KB
User.class 6KB
Announcement.class 5KB
OaApplicationTests.class 5KB
OutgoingMessage.class 5KB
UserController.class 5KB
Cfg_Activiti.class 5KB
CustomRealm.class 5KB
RoleController.class 4KB
ShiroConfig.class 4KB
ModelSaveRestResource.class 4KB
LeaveNote.class 4KB
MyProcessDefinition.class 4KB
MailUtils.class 4KB
ToWeb.class 4KB
Incoming.class 3KB
JsonpCallbackFilter.class 3KB
ModelEditorJsonRestResource.class 3KB
DepartmentServiceImp.class 3KB
DepartmentController.class 3KB
RejectTaskCMD.class 3KB
MainDataSourceConfig.class 3KB
MailDataSourceConfig.class 3KB
Department.class 3KB
ContactController.class 3KB
Role.class 3KB
MyTask.class 3KB
CustomUserEntityManager.class 3KB
ActivitiUserUtils.class 3KB
ContactServiceImp.class 2KB
CustomGroupEntityManager.class 2KB
MyProcessInstance.class 2KB
Email.class 2KB
AttendanceAdmin.class 2KB
AttendanceRecord.class 2KB
ModelController.class 2KB
LeaveNoteServiceImp.class 2KB
MyLogoutFilter.class 2KB
MyDocListener.class 2KB
Contact.class 2KB
RestFilter.class 2KB
Menu.class 2KB
MyEndIncListener.class 2KB
DeploymentResponse.class 2KB
MyAnnListener.class 2KB
ToWeb$Rows.class 2KB
MyExecutionListener.class 2KB
UserAuthority.class 2KB
Text.class 2KB
EmailService.class 2KB
EncryPassword.class 2KB
GenericResponseWrapper.class 2KB
Workflow.class 2KB
Admin.class 2KB
StencilsetRestResource.class 2KB
RestServiceController.class 2KB
CustomDefaultWebSessionManager.class 2KB
EmialAttachment.class 1KB
DocumentService.class 1KB
UserMapper.class 1KB
JamesUser.class 1KB
GlobalExceptionHandler.class 1KB
UserService.class 1KB
AttenAdminServiceImp.class 1KB
ProcessDefinitionDiagramLayoutResource.class 1KB
FilterServletOutputStream.class 1KB
ProcessInstanceDiagramLayoutResource.class 1KB
CustomGroupEntityManagerFactory.class 1KB
AnnouncementMapper.class 1KB
AttenService.class 1KB
ApplicationContextUtils.class 1KB
RoleMapper.class 1KB
AttendanceRecordMapper.class 1KB
MyHistoricTaskInstance.class 1KB
OutgoingMessageMapper.class 1KB
CustomUserEntityManagerFactory.class 1KB
OaApplication.class 989B
AnnRead.class 979B
DepartmentMapper.class 968B
共 1076 条
- 1
- 2
- 3
- 4
- 5
- 6
- 11
资源评论
Yuki-^_^
- 粉丝: 3100
- 资源: 2013
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- VBA-028.取消复杂的合并单元格
- VBA-027.将Word表格批量写入Excel
- VBA-026.合并多工作簿数据成总表
- VBA-025.获取多层文件夹下文件名并创建超链接
- 基于Java+SpringBoot+Vue摄影约拍管理系统(源码)
- Matlab2024a许可证文件Crack、license.lic
- 低成本单发单收激光测距传感器方案 低成本单发单收激光测距全套方案,包括原理图、源代码、PCB、BOM、光学部分资料,结构、特殊元件数据手册及供应商联系方式,提供调试技术文档 全套方案已成功打板验证
- VBA-022.批量获取指定文件夹下文件名并创建超链接
- VBA-020.按指定名称批量创建工作簿
- comsol多孔介质流燃烧器模型,集层流流动模块,流体传热模块,浓物质传递模块和化学反应模块于一体,四场耦合,多物理场涉及非等温流动场,反应流场 经实测可以精确的模拟燃烧流动耦合的仿真结果,适用于CH
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功