一:在项目pom.xml文件中添加activity依赖。
<dependency>
<groupId>org.activiti</groupId>
<artifactId>activiti-spring-boot-starter-basic</artifactId>
<version>6.0.0</version>
</dependency>
二:修改启动类。
详见https://www.jianshu.com/p/085580b3dda8
@SpringBootApplication(exclude={org.activiti.spring.boot.SecurityAutoConfiguration.class})
三:流程文件。
在src/main/java/resources目录下新建processes目录,并在该目录下新增一个业务流程文件(默认以.bpmn20.xml或.bpmn为后缀名)(activity默认校验resources下的processes文件夹里的流程文件,如果没有processes目录并且目录下没有流程文件会报错class path resource [processes/] cannot be resolved to URL because it does not exist),
可以在配置文件中配置spring.activiti.check-process-definitions=false,设置为不校验,这样就不会报错。参考https://www.jianshu.com/p/085580b3dda8
四:修改activity默认的id生成策略。
1.activiti默认的ID生成策略在高并发场景下会出现ID重复的情况,因此在高并发场景下建议采用UUID的策略。
2.传统的spring在配置文件中添加idGenerator属性:
<bean id="processEngineConfiguration" class="org.activiti.spring.SpringProcessEngineConfiguration">
<!-- UUID作为主键生成策略 -->
<property name="idGenerator" ref="idGen" />
</bean>
3.springboot中在配置类中修改idGenerator。
需要写一个类实现IdGenerator,并重写getNextId()方法;
activity也内置了一个实现类org.activiti.engine.impl.persistence.StrongUuidGenerator,生成的uuid是带'-'的
package com.mycompany.myapp.config;
import org.activiti.spring.SpringProcessEngineConfiguration;
import org.activiti.spring.boot.ProcessEngineConfigurationConfigurer;
import org.springframework.context.annotation.Configuration;
import com.mycompany.myapp.utils.IdGen;
/**
* @author xuzhipeng
* @date 2018-11-09 10:26:47
* @since 1.0
*/
@Configuration
public class ActivitiConfig implements ProcessEngineConfigurationConfigurer {
@Override
public void configure(SpringProcessEngineConfiguration springProcessEngineConfiguration) {
springProcessEngineConfiguration.setIdGenerator(new IdGen());
}
}
package com.mycompany.myapp.utils;
import java.util.UUID;
import org.activiti.engine.impl.cfg.IdGenerator;
/**
* @author xuzhipeng
* @date 2018-11-09 10:47:59
* @since 1.0
*/
public class IdGen implements IdGenerator{
/**
* 封装JDK自带的UUID, 通过Random数字生成, 中间无-分割.
*/
public static String uuid() {
return UUID.randomUUID().toString().replaceAll("-", "");
}
/**
* Activiti ID 生成
*/
@Override
public String getNextId() {
return IdGen.uuid();
}
}
五:配置文件属性:
1.spring.activiti.database-schema-update
spring.activiti.database-schema-update=true
databaseSchemaUpdate配置项可以设置流程引擎启动和关闭时数据库执行的策略。 databaseSchemaUpdate有以下四个值:
false:false为默认值,设置为该值后,Activiti在启动时,会对比数据库表中保存的版本,如果版本不匹配时,将在启动时抛出异常。
true:设置为该值后,Activiti会对数据库中所有的表进行更新,如果表不存在,则Activiti会自动创建。
create-drop:Activiti启动时,会执行数据库表的创建操作,在Activiti关闭时,执行数据库表的删除操作。
drop-create:Activiti启动时,执行数据库表的删除操作在Activiti关闭时,会执行数据库表的创建操作。
设置为true后启动应用,会在数据库里创建28张表,表创建好之后停止应用,设置为false,每次应用启动不检查Activiti数据表是否存在及版本号是否匹配,以提升应用启动速度。
2.spring.activiti.history-level
#保存历史数据级别设置为full最高级别,便于历史数据的追溯
spring.activiti.history-level=full
对于历史数据,保存到何种粒度,Activiti提供了history-level属性对其进行配置。history-level属性有点像log4j的日志输出级别,该属性有以下四个值:
none:不保存任何的历史数据,因此,在流程执行过程中,这是最高效的。
activity:级别高于none,保存流程实例与流程行为,其他数据不保存。
audit:除activity级别会保存的数据外,还会保存全部的流程任务及其属性。audit为history的默认值。
full:保存历史数据的最高级别,除了会保存audit级别的数据外,还会保存其他全部流程相关的细节数据,包括一些流程参数等。
3.spring.activiti.check-process-definitions
#关闭activiti自动部署(使用流程设计器部署,不使用具体文件访问方式)
spring.activiti.check-process-definitions=false
六:集成在线流程设计器Activiti Modeler。
1.pom文件添加activiti-modeler依赖。
<!-- https://mvnrepository.com/artifact/org.activiti/activiti-modeler -->
<dependency>
<groupId>org.activiti</groupId>
<artifactId>activiti-modeler</artifactId>
<version>5.22.0</version>
<exclusions>
<exclusion>
<groupId>org.activiti</groupId>
<artifactId>activiti-bpmn-model</artifactId>
</exclusion>
</exclusions>
</dependency>
2.下载activiti5.22.0源码https://github.com/Activiti/Activiti/tree/activiti-5.22.0。
3.复制Activiti 5.22.0中Activiti\modules\activiti-webapp-explorer2\src\main\webapp中的diagram-viewer、editor-app两个文件夹和modeler.html文件到Spring Boot项目resources目录下的static文件夹下。
image.png
4.修改resource/static/editor-app/app-cfg.js。
image.png
改为:
var ACTIVITI = ACTIVITI || {};
ACTIVITI.CONFIG = {
'contextRoot' : '/service',
};
5.复制Activiti\modules\activiti-webapp-explorer2\src\main\resources中的stencilset.json文件到Spring Boot项目中的resources目录下,activiti自带是英文的。
6.将Activiti 5.22.0源码中activiti-modeler中的下列3个java文件复制到自己的项目中,并在三个java类上添加注解@RequestMapping("/service")。(/service与上面app-cfg.js中保持一致)
image.png
image.png
7.修改ModelSaveRestResource.java文件:
/* 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.mycompany.myapp.modeler.editor.model;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.InputStream;
import org.activiti.editor.constants.ModelDataJsonConstants;
import org.activiti.engine.ActivitiException;
import org.activiti.engine.RepositoryService;
import org.activiti.engine.repository.Model;
import org.apache.batik.transcoder.TranscoderInput;
import org.apache.batik.transcoder.TranscoderOutput;
import org.apache.batik.transcoder.image.PNGTranscoder;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseStatus;
import org.springframework.web.bind.annotation.RestController;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.node.ObjectNode;
/**
* @author Tijs Rademakers
*/
@RestController
@RequestMapping("/service")
public class ModelSaveRestResource implements ModelDataJsonConstants {
protected static final Logger LOGGER = LoggerFactory.getLogger(ModelSaveRestResource.class);
@Autowired
private RepositoryService repositoryService;
@Autowired
private ObjectMapper objectMapper;
@RequestMapping(value="/model/{modelId}/save", method = RequestMethod.PUT)
@ResponseStatus(value = HttpStatus.OK)
public void saveModel(@PathVariable String modelId
, String name, String description
, String json_xml, String svg_xml) {
try {
Model model = repositoryService.getModel(modelId);
ObjectNode modelJson = (ObjectNode) objectMapper.readTree(model.getMetaInfo());
modelJson.put(MODEL_NAME, name);
modelJson.put(MODEL_DESCRIPTION, description);
model.setMetaInfo(modelJson.toString());
model.setName(name);
repositoryService.saveModel(model);
repositoryService.addModelEditorSource(model.getId(), json_xml.getBytes("utf-8"));
InputStream svgStream = new ByteArrayInputStream(svg_xml.getBytes("utf-8"));
TranscoderInput input = new TranscoderInput(svgStream);
PNGTranscoder transcoder = new PNGTranscoder();
// Setup output
ByteArrayOutputStream outStream = new ByteArrayOutputStream();
TranscoderOutput output = new TranscoderOutput(outStream);
// Do the transformation
transcoder.transcode(input, output);
final byte[] result = outStream.toByteArray();
repositoryService.addModelEditorSourceExtra(model.getId(), result);
outStream.close();
} catch (Exception e) {
LOGGER.error("Error saving model", e);
throw new ActivitiException("Error saving model", e);
}
}
}
8.测试创建模型。
/**
* 新建一个空模型
* @return
* @throws UnsupportedEncodingException
*/
@GetMapping("/create")
public void newModel(HttpServletRequest request,HttpServletResponse response) throws Exception {
//初始化一个空模型
Model model = repositoryService.newModel();
//设置一些默认信息
String name = "new-process";
String description = "";
int revision = 1;
String key = "process";
ObjectNode modelNode = objectMapper.createObjectNode();
modelNode.put(ModelDataJsonConstants.MODEL_NAME, name);
modelNode.put(ModelDataJsonConstants.MODEL_DESCRIPTION, description);
modelNode.put(ModelDataJsonConstants.MODEL_REVISION, revision);
model.setName(name);
model.setKey(key);
model.setMetaInfo(modelNode.toString());
repositoryService.saveModel(model);
String id = model.getId();
//完善ModelEditorSource
ObjectNode editorNode = objectMapper.createObjectNode();
editorNode.put("id", "canvas");
editorNode.put("resourceId", "canvas");
ObjectNode stencilSetNode = objectMapper.createObjectNode();
stencilSetNode.put("namespace",
"http://b3mn.org/stencilset/bpmn2.0#");
editorNode.set("stencilset", stencilSetNode);
repositoryService.addModelEditorSource(id,editorNode.toString().getBytes("utf-8"));
response.sendRedirect("/modeler.html?modelId="+id);
}
9.请求创建模型接口后,显示如下页面表示成功:
10.去掉Activiti Afresco的logo标题栏,并且把样式上的空白栏去掉(https://blog.csdn.net/redxun_cn/article/details/69226945)。
1)修改modeler.html中的以下内容,注意不要把该文本删除,建议加style=”display:none”,删除后其会造成底层下的一些内容有40个像数的东西显示不出来。
<div style="display:none" class="navbar navbar-fixed-top navbar-inverse" role="navigation" id="main-header">
<div class="navbar-header">
<a href="" ng-click="backToLanding()" class="navbar-brand"
title="{{'GENERAL.MAIN-TITLE' | translate}}"><span
class="sr-only">{{'GENERAL.MAIN-TITLE' | translate}}</span></a>
</div>
</div>
2)在editor-app/css/style-common.css中,把以下样式的padding-top部分改为0px;
.wrapper.full {
padding: 0px 0px 0px 0px;
overflow: hidden;
max-width: 100%;
min-width: 100%;
}
11.保存模型如果报错获取不到参数。(https://www.jianshu.com/p/cbcb31937af9),添加过滤器:
package com.mycompany.myapp.config;
import javax.servlet.annotation.WebFilter;
import org.springframework.core.annotation.Order;
import org.springframework.stereotype.Component;
import org.springframework.web.filter.HttpPutFormContentFilter;
/**
* @author xuzhipeng
* @date 2018-11-20 15:47:39
* @since 1.0
*/
@Component
@WebFilter(urlPatterns = "/*", filterName = "putFilter")
@Order(Integer.MIN_VALUE)
public class PutFilter extends HttpPutFormContentFilter {
}
七.modeler相关方法的封装。
package com.lhtc.jv.vo;
import java.io.Serializable;
import javax.validation.constraints.NotNull;
/**
* @author xuzhipeng
* @date 2018-11-21 14:38:54
* @since 1.0
*/
public class ActModelVO implements Serializable{
/**
*
*/
private static final long serialVersionUID = 1L;
private String id;//模型id
@NotNull
private String name;//模型名称
@NotNull
private String key;//模型标识
private String description;//模型描述
private String category;//模型分类
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getKey() {
return key;
}
public void setKey(String key) {
this.key = key;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public String getCategory() {
return category;
}
public void setCategory(String category) {
this.category = category;
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((category == null) ? 0 : category.hashCode());
result = prime * result + ((description == null) ? 0 : description.hashCode());
result = prime * result + ((id == null) ? 0 : id.hashCode());
result = prime * result + ((key == null) ? 0 : key.hashCode());
result = prime * result + ((name == null) ? 0 : name.hashCode());
return result;
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
ActModelVO other = (ActModelVO) obj;
if (category == null) {
if (other.category != null)
return false;
} else if (!category.equals(other.category))
return false;
if (description == null) {
if (other.description != null)
return false;
} else if (!description.equals(other.description))
return false;
if (id == null) {
if (other.id != null)
return false;
} else if (!id.equals(other.id))
return false;
if (key == null) {
if (other.key != null)
return false;
} else if (!key.equals(other.key))
return false;
if (name == null) {
if (other.name != null)
return false;
} else if (!name.equals(other.name))
return false;
return true;
}
@Override
public String toString() {
return "ActModelVO [id=" + id + ", name=" + name + ", key=" + key + ", description=" + description
+ ", category=" + category + "]";
}
}
package com.lhtc.jv.service;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.activiti.bpmn.converter.BpmnXMLConverter;
import org.activiti.bpmn.model.BpmnModel;
import org.activiti.editor.constants.ModelDataJsonConstants;
import org.activiti.editor.language.json.converter.BpmnJsonConverter;
import org.activiti.engine.RepositoryService;
import org.activiti.engine.repository.Deployment;
import org.activiti.engine.repository.Model;
import org.activiti.engine.repository.ModelQuery;
import org.activiti.engine.repository.ProcessDefinition;
import org.apache.commons.io.IOUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageImpl;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.node.ObjectNode;
import com.lhtc.jv.vo.ActModelVO;
/**
* 流程模型service
* @author xuzhipeng
* @date 2018-11-21 11:28:38
* @since 1.0
*/
@Service
@Transactional(readOnly = true)
public class ActModelService {
@Autowired
private RepositoryService repositoryService;
@Autowired
private ObjectMapper objectMapper;
/**
* 创建模型
* @param actModelVO
* @return
* @throws UnsupportedEncodingException
*/
@Transactional(readOnly = false)
public Model createModel(ActModelVO actModelVO) throws UnsupportedEncodingException{
//初始化一个空模型
Model model = repositoryService.newModel();
model.setKey(actModelVO.getKey());
model.setName(actModelVO.getName());
model.setCategory(actModelVO.getCategory());
model.setVersion(Integer.parseInt(String.valueOf(repositoryService.createModelQuery().modelKey(model.getKey()).count()+1)));
ObjectNode modelNode = objectMapper.createObjectNode();
modelNode.put(ModelDataJsonConstants.MODEL_NAME, model.getName());
modelNode.put(ModelDataJsonConstants.MODEL_REVISION, model.getVersion());
modelNode.put(ModelDataJsonConstants.MODEL_DESCRIPTION, actModelVO.getDescription());
model.setMetaInfo(modelNode.toString());
repositoryService.saveModel(model);
//完善ModelEditorSource
ObjectNode editorNode = objectMapper.createObjectNode();
editorNode.put("id", "canvas");
editorNode.put("resourceId", "canvas");
ObjectNode stencilSetNode = objectMapper.createObjectNode();
stencilSetNode.put("namespace","http://b3mn.org/stencilset/bpmn2.0#");
editorNode.set("stencilset", stencilSetNode);
repositoryService.addModelEditorSource(model.getId(),editorNode.toString().getBytes("utf-8"));
return model;
}
/**
* 根据模型id查询
* @param modelId 模型id
* @return
*/
public Model getModelById(String modelId){
return repositoryService.getModel(modelId);
}
/**
* 查询模型列表
* @param pageable
* @return
*/
public Page<Model> getAllModels(Pageable pageable){
ModelQuery modelQuery = repositoryService.createModelQuery().latestVersion().orderByLastUpdateTime().desc();
return new PageImpl<>(modelQuery.listPage(pageable.getPageNumber()*pageable.getPageSize(), pageable.getPageSize()), pageable, modelQuery.count());
}
/**
* 部署模型
* @param modelId 模型id
* @return
* @throws IOException
*/
@Transactional(readOnly = false)
public List<ProcessDefinition> deployModel(String modelId) throws IOException{
Model modelData = repositoryService.getModel(modelId);
BpmnJsonConverter jsonConverter = new BpmnJsonConverter();
ObjectNode editorNode = (ObjectNode) new ObjectMapper().readTree(repositoryService.getModelEditorSource(modelData.getId()));
BpmnModel bpmnModel = jsonConverter.convertToBpmnModel(editorNode);
BpmnXMLConverter xmlConverter = new BpmnXMLConverter();
byte[] bpmnBytes = xmlConverter.convertToXML(bpmnModel);
ByteArrayInputStream in = new ByteArrayInputStream(bpmnBytes);
Deployment deployment = repositoryService.createDeployment().name(modelData.getName())
.addInputStream(modelData.getKey()+".bpmn20.xml", in).enableDuplicateFiltering().deploy();
return repositoryService.createProcessDefinitionQuery().deploymentId(deployment.getId()).list();
}
/**
* 删除模型
* @param modelId 模型id
*/
@Transactional(readOnly = false)
public void deleteModel(String modelId){
repositoryService.deleteModel(modelId);
}
/**
* 导出模型xml文件
* @param modelId 模型id
* @param response HttpServletResponse
* @throws IOException
*/
public void exportModel(String modelId, HttpServletResponse response) throws IOException{
Model modelData = repositoryService.getModel(modelId);
BpmnJsonConverter jsonConverter = new BpmnJsonConverter();
ObjectNode editorNode = (ObjectNode) new ObjectMapper().readTree(repositoryService.getModelEditorSource(modelData.getId()));
BpmnModel bpmnModel = jsonConverter.convertToBpmnModel(editorNode);
BpmnXMLConverter xmlConverter = new BpmnXMLConverter();
byte[] bpmnBytes = xmlConverter.convertToXML(bpmnModel);
ByteArrayInputStream in = new ByteArrayInputStream(bpmnBytes);
IOUtils.copy(in, response.getOutputStream());
String filename = bpmnModel.getMainProcess().getId() + ".bpmn20.xml";
response.setHeader("Content-Disposition", "attachment; filename=" + java.net.URLEncoder.encode(filename, "UTF-8"));
response.flushBuffer();
}
}
package com.lhtc.jv.web.rest.activiti;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.net.URI;
import java.net.URISyntaxException;
import java.util.List;
import java.util.Optional;
import javax.servlet.http.HttpServletResponse;
import javax.validation.Valid;
import org.activiti.engine.repository.Model;
import org.activiti.engine.repository.ProcessDefinition;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.util.CollectionUtils;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import com.lhtc.jv.service.ActModelService;
import com.lhtc.jv.vo.ActModelVO;
import com.lhtc.jv.web.rest.util.HeaderUtil;
import com.lhtc.jv.web.rest.util.PaginationUtil;
import io.github.jhipster.web.util.ResponseUtil;
/**
* 流程模型controller
* @author xuzhipeng
* @date 2018-11-21 13:39:47
* @since 1.0
*/
@RestController
@RequestMapping("/api")
public class ActModelResource {
private final Logger log = LoggerFactory.getLogger(ActModelResource.class);
private static final String ENTITY_NAME = "model";
@Autowired
private ActModelService actModelService;
/**
* 创建模型
* @param actModelVO
* @return the ResponseEntity with status 201 (Created) and with body the new model
* @throws UnsupportedEncodingException
* @throws URISyntaxException if the Location URI syntax is incorrect
*/
@PostMapping("/models")
public ResponseEntity<Model> createModel(@Valid @RequestBody ActModelVO actModelVO) throws UnsupportedEncodingException, URISyntaxException{
log.debug("REST request to save Model : {}", actModelVO);
Model result = actModelService.createModel(actModelVO);
return ResponseEntity.created(new URI("/act/models/" + result.getId()))
.headers(HeaderUtil.createEntityCreationAlert(ENTITY_NAME, result.getId().toString()))
.body(result);
}
/**
* 根据模型id查询
* @param modelId 模型id
* @return
*/
@GetMapping("/models/{modelId}")
public ResponseEntity<Model> getModel(@PathVariable String modelId){
log.debug("REST request to get Model : {}", modelId);
return ResponseUtil.wrapOrNotFound(Optional.ofNullable(actModelService.getModelById(modelId)));
}
/**
* 查询模型列表
* @param pageable the pagination information
* @return the ResponseEntity with status 200 (OK) and with body all models
*/
@GetMapping("/models")
public ResponseEntity<List<Model>> getAllModels(Pageable pageable) {
final Page<Model> page = actModelService.getAllModels(pageable);
HttpHeaders headers = PaginationUtil.generatePaginationHttpHeaders(page, "/act/models");
return new ResponseEntity<>(page.getContent(), headers, HttpStatus.OK);
}
/**
* 部署模型
* @param modelId 模型id
* @return
*/
@PutMapping("/models/deploy")
public ResponseEntity<Void> deployModel(@RequestBody ActModelVO actModelVO){
String modelId = actModelVO.getId();
log.debug("REST request to deploy Model : {}", modelId);
try {
List<ProcessDefinition> processDefinitions = actModelService.deployModel(modelId);
if(!CollectionUtils.isEmpty(processDefinitions)){
return ResponseEntity.ok().headers(HeaderUtil.createAlert("A " + ENTITY_NAME + " is deployed with identifier " + modelId, modelId)).build();
}
} catch (Exception e) {
e.printStackTrace();
}
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).headers(HeaderUtil.createFailureAlert(ENTITY_NAME, modelId,"A " + ENTITY_NAME + " failed to deploy with identifier " + modelId)).build();
}
/**
* 删除模型
* @param modelId 模型id
* @return
*/
@DeleteMapping("/models/{modelId}")
public ResponseEntity<Void> deleteModel(@PathVariable String modelId) {
log.debug("REST request to delete Model: {}", modelId);
actModelService.deleteModel(modelId);
return ResponseEntity.ok().headers(HeaderUtil.createEntityDeletionAlert(ENTITY_NAME, modelId)).build();
}
/**
* 导出模型xml文件
* @param modelId 模型id
* @param response HttpServletResponse
* @throws IOException
*/
@GetMapping("/models/export")
public void exportModel(@RequestParam("modelId")String modelId, HttpServletResponse response) throws IOException{
actModelService.exportModel(modelId, response);
}
}
网友评论