当前位置: 首页 > wzjs >正文

jsp网站怎么做珠海关键词优化软件

jsp网站怎么做,珠海关键词优化软件,网站两边横幅怎么做,河北邢台有什么好玩的地方Flowable 与 bpmn.io7.0 完整集成示例 Demo 下面是一个完整的前后端集成示例&#xff0c;包含前端使用 bpmn.js 7.0 和与 Flowable 后端交互的实现。 1. 后端实现 (Spring Boot Flowable) 1.1 添加依赖 (pom.xml) <dependencies><!-- Spring Boot --><depe…

Flowable 与 bpmn.io@7.0 完整集成示例 Demo

下面是一个完整的前后端集成示例,包含前端使用 bpmn.js 7.0 和与 Flowable 后端交互的实现。

1. 后端实现 (Spring Boot + Flowable)

1.1 添加依赖 (pom.xml)

<dependencies><!-- Spring Boot --><dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-web</artifactId></dependency><!-- Flowable --><dependency><groupId>org.flowable</groupId><artifactId>flowable-spring-boot-starter</artifactId><version>6.7.0</version></dependency><!-- 其他必要依赖 --><dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-security</artifactId></dependency><dependency><groupId>io.jsonwebtoken</groupId><artifactId>jjwt</artifactId><version>0.9.1</version></dependency>
</dependencies>

1.2 应用配置 (application.yml)

server:port: 8080spring:datasource:url: jdbc:h2:mem:flowable;DB_CLOSE_DELAY=-1username: sapassword:driver-class-name: org.h2.Driverh2:console:enabled: truepath: /h2-consoleflowable:async-executor-activate: falsedatabase-schema-update: true

1.3 控制器 (FlowableController.java)

@RestController
@RequestMapping("/api")
public class FlowableController {@Autowiredprivate RepositoryService repositoryService;@Autowiredprivate RuntimeService runtimeService;// 部署流程@PostMapping("/deploy")public ResponseEntity<?> deployProcess(@RequestParam("file") MultipartFile file) {try {Deployment deployment = repositoryService.createDeployment().addBytes(file.getOriginalFilename(), file.getBytes()).deploy();return ResponseEntity.ok(Map.of("deploymentId", deployment.getId(),"deploymentName", deployment.getName(),"deploymentTime", deployment.getDeploymentTime()));} catch (Exception e) {return ResponseEntity.badRequest().body(e.getMessage());}}// 获取流程定义XML@GetMapping("/process-definition/{id}/xml")public ResponseEntity<?> getProcessDefinitionXml(@PathVariable String id) {try {ProcessDefinition processDefinition = repositoryService.createProcessDefinitionQuery().processDefinitionId(id).singleResult();InputStream resourceAsStream = repositoryService.getResourceAsStream(processDefinition.getDeploymentId(), processDefinition.getResourceName());String xml = IOUtils.toString(resourceAsStream, StandardCharsets.UTF_8);return ResponseEntity.ok(xml);} catch (Exception e) {return ResponseEntity.badRequest().body(e.getMessage());}}// 获取流程定义列表@GetMapping("/process-definitions")public ResponseEntity<?> getProcessDefinitions() {List<ProcessDefinition> processDefinitions = repositoryService.createProcessDefinitionQuery().latestVersion().list();List<Map<String, Object>> result = processDefinitions.stream().map(pd -> Map.of("id", pd.getId(),"name", pd.getName(),"key", pd.getKey(),"version", pd.getVersion(),"deploymentId", pd.getDeploymentId())).collect(Collectors.toList());return ResponseEntity.ok(result);}
}

1.4 安全配置 (SecurityConfig.java)

@Configuration
@EnableWebSecurity
public class SecurityConfig extends WebSecurityConfigurerAdapter {@Overrideprotected void configure(HttpSecurity http) throws Exception {http.cors().and().csrf().disable().authorizeRequests().antMatchers("/api/**").authenticated().and().httpBasic();}@BeanCorsConfigurationSource corsConfigurationSource() {CorsConfiguration configuration = new CorsConfiguration();configuration.setAllowedOrigins(Arrays.asList("*"));configuration.setAllowedMethods(Arrays.asList("GET", "POST", "PUT", "DELETE"));configuration.setAllowedHeaders(Arrays.asList("*"));UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource();source.registerCorsConfiguration("/**", configuration);return source;}
}

2. 前端实现 (React + bpmn.js)

2.1 项目初始化

npx create-react-app flowable-bpmn-demo
cd flowable-bpmn-demo
npm install bpmn-js@7.0.0 axios

2.2 BPMN 编辑器组件 (BpmnEditor.js)

import React, { useEffect, useRef, useState } from 'react';
import BpmnModeler from 'bpmn-js/lib/Modeler';
import 'bpmn-js/dist/assets/diagram-js.css';
import 'bpmn-js/dist/assets/bpmn-font/css/bpmn.css';
import axios from 'axios';
import './BpmnEditor.css';const BpmnEditor = () => {const containerRef = useRef(null);const modelerRef = useRef(null);const [processDefinitions, setProcessDefinitions] = useState([]);const [selectedDefinition, setSelectedDefinition] = useState(null);const [xml, setXml] = useState('');// 初始化建模器useEffect(() => {if (containerRef.current && !modelerRef.current) {modelerRef.current = new BpmnModeler({container: containerRef.current,keyboard: { bindTo: document }});// 创建新流程图createNewDiagram();}// 加载流程定义列表loadProcessDefinitions();return () => {if (modelerRef.current) {modelerRef.current.destroy();}};}, []);// 创建新流程图const createNewDiagram = async () => {try {const result = await modelerRef.current.createDiagram();console.log('Diagram created');} catch (err) {console.error('Could not create diagram', err);}};// 加载流程定义列表const loadProcessDefinitions = async () => {try {const response = await axios.get('http://localhost:8080/api/process-definitions', {auth: {username: 'admin',password: 'test'}});setProcessDefinitions(response.data);} catch (error) {console.error('Error loading process definitions:', error);}};// 加载特定流程定义const loadProcessDefinition = async (definitionId) => {try {const response = await axios.get(`http://localhost:8080/api/process-definition/${definitionId}/xml`,{auth: {username: 'admin',password: 'test'}});await modelerRef.current.importXML(response.data);setXml(response.data);setSelectedDefinition(definitionId);} catch (error) {console.error('Error loading process definition:', error);}};// 保存当前流程图const saveDiagram = async () => {try {const { xml } = await modelerRef.current.saveXML({ format: true });setXml(xml);const formData = new FormData();const blob = new Blob([xml], { type: 'text/xml' });formData.append('file', blob, 'process.bpmn');const response = await axios.post('http://localhost:8080/api/deploy', formData, {headers: {'Content-Type': 'multipart/form-data'},auth: {username: 'admin',password: 'test'}});alert(`Deployed successfully! Deployment ID: ${response.data.deploymentId}`);loadProcessDefinitions();} catch (error) {console.error('Error saving diagram:', error);}};return (<div className="bpmn-editor-container"><div className="toolbar"><button onClick={createNewDiagram}>New Diagram</button><button onClick={saveDiagram}>Save/Deploy</button><select value={selectedDefinition || ''}onChange={(e) => loadProcessDefinition(e.target.value)}><option value="">Load Process Definition</option>{processDefinitions.map((pd) => (<option key={pd.id} value={pd.id}>{pd.name || pd.key} (v{pd.version})</option>))}</select></div><div className="canvas" ref={containerRef}></div><div className="xml-viewer"><h3>BPMN XML</h3><textarea value={xml} onChange={(e) => setXml(e.target.value)}rows="20"/></div></div>);
};export default BpmnEditor;

2.3 样式文件 (BpmnEditor.css)

.bpmn-editor-container {display: flex;flex-direction: column;height: 100vh;
}.toolbar {padding: 10px;background: #f5f5f5;border-bottom: 1px solid #ddd;
}.toolbar button, .toolbar select {margin-right: 10px;padding: 5px 10px;
}.canvas {flex: 1;height: 60%;border: 1px solid #ccc;
}.xml-viewer {height: 30%;padding: 10px;border-top: 1px solid #ddd;
}.xml-viewer textarea {width: 100%;height: calc(100% - 30px);font-family: monospace;
}

2.4 主应用组件 (App.js)

import React from 'react';
import './App.css';
import BpmnEditor from './BpmnEditor';function App() {return (<div className="App"><header className="App-header"><h1>Flowable + bpmn.js Integration Demo</h1></header><main><BpmnEditor /></main></div>);
}export default App;

3. 运行说明

3.1 启动后端

  1. 启动 Spring Boot 应用
  2. Flowable 会自动创建必要的数据库表
  3. 后端将在 http://localhost:8080 运行

3.2 启动前端

  1. 运行 npm start
  2. 前端将在 http://localhost:3000 运行
  3. 使用默认凭据登录 (admin/test)

4. 功能说明

  1. 新建流程图:创建空白的 BPMN 流程图
  2. 保存/部署:将当前流程图保存并部署到 Flowable
  3. 加载流程:从 Flowable 加载已部署的流程定义
  4. XML 查看/编辑:查看和编辑 BPMN XML

5. 扩展建议

  1. 添加 Flowable 特定属性面板
  2. 集成 Flowable 表单设计器
  3. 添加流程实例启动和监控功能
  4. 实现更完善的用户认证和授权

这个完整示例展示了如何将 bpmn.js 7.0 与 Flowable 后端集成,实现流程建模、部署和管理的完整功能。

http://www.dtcms.com/wzjs/284059.html

相关文章:

  • 网站怎么做排行榜在线seo外链工具
  • 网站建设内部下单流程图收录优美图片app
  • 网站公安备案时间限制高端网站设计公司
  • 电子商务网站的开发方式有哪三种时事新闻热点摘抄
  • ps中网站页面做多大的制作自己的网站
  • 网站开辟两学一做专栏信息流广告推广
  • 合肥比较好的网站建设公司有没有免费的推广网站
  • 开发网站公司多少钱广告软文范例大全100
  • 海淀教育互动平台西安seo技术培训班
  • 气球网站建设中国销售网
  • 网站建设 cms 下载福州百度开户多少钱
  • 宝安自适应网站建设公司品牌宣传
  • 品牌网站建设-建站之路搜狗网页
  • 成都较出名的广告公司南宁seo公司
  • 品牌展示榜ui做的好的网站志鸿优化网官网
  • 沈阳网站页面设计公司有趣的软文
  • 免费模板素材软件三台网站seo
  • 惠州seo优化西安网站seo优化公司
  • 深圳龙华做网站的公司百度seo和sem
  • 山东建设管理局网站抖音关键词排名查询工具
  • 嘉兴专业网站建设做网站价格
  • 网站建设公司特点sem搜索引擎
  • 网站建设方案对比武汉百度推广代运营
  • html5手机网站 源码seo排名点击报价
  • app推广多少钱一个天津seo结算
  • 保定百度关键词优化抖音seo关键词优化怎么做
  • 哪里查询网站备案百度一对一解答
  • 自网站EXCel数据导入怎么做贵阳网站优化公司
  • 海淀区建设委员会官方网站竞彩足球最新比赛
  • seo 网站关键词开发制作app软件