增加序列号

This commit is contained in:
jinqiming 2020-12-02 18:17:28 +08:00
parent feea2f66ee
commit 441e5e078b
20 changed files with 1148 additions and 87 deletions

View File

@ -0,0 +1,146 @@
package com.snow.web.controller.flowable;
import java.util.List;
import com.snow.flowable.service.impl.FlowablePublishServiceImpl;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.flowable.engine.repository.Deployment;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.ui.ModelMap;
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.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import com.snow.common.annotation.Log;
import com.snow.common.enums.BusinessType;
import org.springframework.stereotype.Controller;
import com.snow.system.domain.ActDeModel;
import com.snow.system.service.IActDeModelService;
import com.snow.common.core.controller.BaseController;
import com.snow.common.core.domain.AjaxResult;
import com.snow.common.utils.poi.ExcelUtil;
import com.snow.common.core.page.TableDataInfo;
/**
* 设计器modelController
*
* @author qimingjin
* @date 2020-12-01
*/
@Controller
@RequestMapping("/system/model")
public class ActDeModelController extends BaseController
{
private String prefix = "system/model";
@Autowired
private IActDeModelService actDeModelService;
@Autowired
private FlowablePublishServiceImpl flowablePublishServiceImpl;
@RequiresPermissions("system:model:view")
@GetMapping()
public String model()
{
return prefix + "/model";
}
/**
* 查询设计器model列表
*/
@RequiresPermissions("system:model:list")
@PostMapping("/list")
@ResponseBody
public TableDataInfo list(ActDeModel actDeModel)
{
startPage();
List<ActDeModel> list = actDeModelService.selectActDeModelList(actDeModel);
return getDataTable(list);
}
/**
* 导出设计器model列表
*/
@RequiresPermissions("system:model:export")
@Log(title = "设计器model", businessType = BusinessType.EXPORT)
@PostMapping("/export")
@ResponseBody
public AjaxResult export(ActDeModel actDeModel)
{
List<ActDeModel> list = actDeModelService.selectActDeModelList(actDeModel);
ExcelUtil<ActDeModel> util = new ExcelUtil<ActDeModel>(ActDeModel.class);
return util.exportExcel(list, "model");
}
/**
* 新增设计器model
*/
@GetMapping("/add")
public String add()
{
return prefix + "/add";
}
/**
* 新增保存设计器model
*/
@RequiresPermissions("system:model:add")
@Log(title = "设计器model", businessType = BusinessType.INSERT)
@PostMapping("/add")
@ResponseBody
public AjaxResult addSave(ActDeModel actDeModel)
{
return toAjax(actDeModelService.insertActDeModel(actDeModel));
}
/**
* 修改设计器model
*/
@GetMapping("/edit/{id}")
public String edit(@PathVariable("id") String id, ModelMap mmap)
{
ActDeModel actDeModel = actDeModelService.selectActDeModelById(id);
mmap.put("actDeModel", actDeModel);
return redirect("/modeler/index.html#/editor/"+id);
}
/**
* 修改保存设计器model
*/
@RequiresPermissions("system:model:edit")
@Log(title = "设计器model", businessType = BusinessType.UPDATE)
@PostMapping("/edit")
@ResponseBody
public AjaxResult editSave(ActDeModel actDeModel)
{
return toAjax(actDeModelService.updateActDeModel(actDeModel));
}
/**
* 删除设计器model
*/
@RequiresPermissions("system:model:remove")
@Log(title = "设计器model", businessType = BusinessType.DELETE)
@PostMapping( "/remove")
@ResponseBody
public AjaxResult remove(String ids)
{
return toAjax(actDeModelService.deleteActDeModelByIds(ids));
}
@Log(title = "发布流程", businessType = BusinessType.DEPLOYMENT)
@RequiresPermissions("system:model:deployment")
@PostMapping("/deployment")
@ResponseBody
public AjaxResult deployment(String id)
{
Deployment Deployment = flowablePublishServiceImpl.createBytesDeploymentByModelId(id);
if(Deployment==null){
return AjaxResult.error("modelId不存在");
}
return AjaxResult.success("发布成功");
}
}

View File

@ -26,7 +26,7 @@ import java.io.InputStream;
import java.util.List;
/**
* 财务支付宝流水Controller
* Controller
*
* @author snow
* @date 2020-11-09
@ -90,10 +90,8 @@ public class FlowModelerController extends BaseController
@ResponseBody
public TableDataInfo list(DeploymentQueryDTO deploymentQuery)
{
startPage();
List<DeploymentVO> deploymentList = flowableService.getDeploymentList(deploymentQuery);
return getDataTable(deploymentList);
PageModel<DeploymentVO> deploymentList = flowableService.getDeploymentList(deploymentQuery);
return getFlowDataTable(deploymentList);
}
/**

View File

@ -1098,6 +1098,41 @@ var table = {
}
return url;
},
// 弹出层全屏
parentDetail: function ( id, width, height) {
var url = $.operate.detailUrl(id);
var title='设计器';
//如果是移动端,就使用自适应大小弹窗
if ($.common.isMobile()) {
width = 'auto';
height = 'auto';
}
if ($.common.isEmpty(title)) {
title = false;
}
if ($.common.isEmpty(url)) {
url = "/404.html";
}
if ($.common.isEmpty(width)) {
width = 800;
}
if ($.common.isEmpty(height)) {
height = ($(window).height() - 50);
}
var index = parent.layer.open({
type: 2,
area: [width + 'px', height + 'px'],
fix: false,
//不固定
maxmin: true,
shade: 0.3,
title: '流程设计器',
content: url
});
layer.full(index);
},
// 删除信息
remove: function(id) {
table.set();
@ -1126,6 +1161,20 @@ var table = {
$.operate.submit(url, "post", "json", data);
});
},
// 删除信息
deployment: function(id) {
table.set();
$.modal.confirm("确定发布该条" + table.options.modalName + "信息吗?", function() {
var url = $.common.isEmpty(id) ? table.options.deploymentUrl : table.options.deploymentUrl.replace("{id}", id);
if(table.options.type == table_type.bootstrapTreeTable) {
$.operate.get(url);
} else {
var data = { "id": id };
$.operate.submit(url, "post", "json", data);
}
});
},
// 清空信息
clean: function() {
table.set();

View File

@ -92,28 +92,28 @@
}
},
{
/* {
field: 'processDefinitionVO',
title: '流程定义key',
formatter: function(value, row, index) {
return value.key;
}
},
{
},*/
/* {
field: 'processDefinitionVO',
title: '版本号',
formatter: function(value, row, index) {
return value.version;
}
},
},*/
{
/* {
field: 'processDefinitionVO',
title: '文件名',
formatter: function(value, row, index) {
return value.resourceName;
}
},
},*/
{
field: 'deploymentTime',
title: '流程发布时间'
@ -128,14 +128,12 @@
title: '操作',
align: 'center',
formatter: function(value, row, index) {
console.log(JSON.stringify(row.processDefinitionVO));
var processDefinition= row.processDefinitionVO;
// var getFlowPicture=prefix+'/getFlowPicture?id='+processDefinition.deploymentId+'&resourceName='+processDefinition.diagramResourceName;
var getXmlUrl=prefix+'/getXml?id='+processDefinition.deploymentId+'&resourceName='+processDefinition.resourceName;
var getXmlUrl=prefix+'/getXml?id='+row.id+'&resourceName=';
var actions = [];
actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="previewXml(\'' + processDefinition.deploymentId + '\',\''+processDefinition.diagramResourceName+'\');"><i class="fa fa-edit"></i>流程图</a> ');
/* actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="previewXml(\'' + processDefinition.deploymentId + '\',\''+processDefinition.diagramResourceName+'\');"><i class="fa fa-edit"></i>流程图</a> ');*/
actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="previewXml(\'' + row.id+ '\',);"><i class="fa fa-edit"></i>流程图</a> ');
actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="'+getXmlUrl+'" target="_blank"><i class="fa fa-eye"></i>XML</a> ');
/* actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="'+getFlowPicture+'" target="_blank" ><i class="fa fa-etsy" ></i>流程图</a> ');*/
actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.id + '\')"><i class="fa fa-remove"></i>删除</a>');
return actions.join('');
}
@ -148,9 +146,9 @@
* 预览XML
* @param tableId
*/
function previewXml(deploymentId,resourceName) {
function previewXml(deploymentId) {
console.log(JSON.stringify(deploymentId));
var preViewUrl=prefix+'/getFlowPicture?id='+deploymentId+'&resourceName='+resourceName;
var preViewUrl=prefix+'/getFlowPicture?id='+deploymentId+'&resourceName=';
$.modal.openTab("预览流程图", preViewUrl);
}
</script>

View File

@ -100,14 +100,13 @@
title: '操作',
align: 'center',
formatter: function(value, row, index) {
console.log(JSON.stringify(row.processDefinitionVO));
var processDefinition= row.processDefinitionVO;
// var getFlowPicture=prefix+'/getFlowPicture?id='+processDefinition.deploymentId+'&resourceName='+processDefinition.diagramResourceName;
var getXmlUrl=prefix+'/getXml?id='+processDefinition.deploymentId+'&resourceName='+processDefinition.resourceName;
//var processDefinition= row.processDefinitionVO;
// var getXmlUrl=prefix+'/getXml?id='+processDefinition.deploymentId+'&resourceName='+processDefinition.resourceName;
var getXmlUrl=prefix+'/getXml?id='+row.id+'&resourceName=';
var actions = [];
actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="previewXml(\'' + processDefinition.deploymentId + '\',\''+processDefinition.diagramResourceName+'\');"><i class="fa fa-edit"></i>流程图</a> ');
/* actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="previewXml(\'' + processDefinition.deploymentId + '\',\''+processDefinition.diagramResourceName+'\');"><i class="fa fa-edit"></i>流程图</a> ');*/
actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="previewXml(\'' + row.id+ '\',);"><i class="fa fa-edit"></i>流程图</a> ');
actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="'+getXmlUrl+'" target="_blank"><i class="fa fa-eye"></i>XML</a> ');
/* actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="'+getFlowPicture+'" target="_blank" ><i class="fa fa-etsy" ></i>流程图</a> ');*/
actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.id + '\')"><i class="fa fa-remove"></i>删除</a>');
return actions.join('');
}
@ -120,9 +119,9 @@
* 预览XML
* @param tableId
*/
function previewXml(deploymentId,resourceName) {
function previewXml(deploymentId) {
console.log(JSON.stringify(deploymentId));
var preViewUrl=prefix+'/getFlowPicture?id='+deploymentId+'&resourceName='+resourceName;
var preViewUrl=prefix+'/getFlowPicture?id='+deploymentId+'&resourceName=';
$.modal.openTab("预览流程图", preViewUrl);
}
</script>

View File

@ -0,0 +1,126 @@
<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
<th:block th:include="include :: header('新增设计器model')" />
<th:block th:include="include :: datetimepicker-css" />
</head>
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
<form class="form-horizontal m" id="form-model-add">
<div class="form-group">
<label class="col-sm-3 control-label is-required">null</label>
<div class="col-sm-8">
<input name="name" class="form-control" type="text" required>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label is-required">null</label>
<div class="col-sm-8">
<input name="modelKey" class="form-control" type="text" required>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">null</label>
<div class="col-sm-8">
<textarea name="description" class="form-control"></textarea>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">null</label>
<div class="col-sm-8">
<textarea name="modelComment" class="form-control"></textarea>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">null</label>
<div class="col-sm-8">
<div class="input-group date">
<input name="created" class="form-control" placeholder="yyyy-MM-dd" type="text">
<span class="input-group-addon"><i class="fa fa-calendar"></i></span>
</div>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">null</label>
<div class="col-sm-8">
<input name="createdBy" class="form-control" type="text">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">null</label>
<div class="col-sm-8">
<div class="input-group date">
<input name="lastUpdated" class="form-control" placeholder="yyyy-MM-dd" type="text">
<span class="input-group-addon"><i class="fa fa-calendar"></i></span>
</div>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">null</label>
<div class="col-sm-8">
<input name="lastUpdatedBy" class="form-control" type="text">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">null</label>
<div class="col-sm-8">
<input name="version" class="form-control" type="text">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">null</label>
<div class="col-sm-8">
<input name="modelEditorJson" class="form-control" type="text">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">null</label>
<div class="col-sm-8">
<input name="thumbnail" class="form-control" type="text">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">null</label>
<div class="col-sm-8">
<select name="modelType" class="form-control m-b">
<option value="">所有</option>
</select>
<span class="help-block m-b-none"><i class="fa fa-info-circle"></i> 代码生成请选择字典属性</span>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">null</label>
<div class="col-sm-8">
<input name="tenantId" class="form-control" type="text">
</div>
</div>
</form>
</div>
<th:block th:include="include :: footer" />
<th:block th:include="include :: datetimepicker-js" />
<script th:inline="javascript">
var prefix = ctx + "system/model"
$("#form-model-add").validate({
focusCleanup: true
});
function submitHandler() {
if ($.validate.form()) {
$.operate.save(prefix + "/add", $('#form-model-add').serialize());
}
}
$("input[name='created']").datetimepicker({
format: "yyyy-mm-dd",
minView: "month",
autoclose: true
});
$("input[name='lastUpdated']").datetimepicker({
format: "yyyy-mm-dd",
minView: "month",
autoclose: true
});
</script>
</body>
</html>

View File

@ -0,0 +1,127 @@
<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
<th:block th:include="include :: header('修改设计器model')" />
<th:block th:include="include :: datetimepicker-css" />
</head>
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
<form class="form-horizontal m" id="form-model-edit" th:object="${actDeModel}">
<input name="id" th:field="*{id}" type="hidden">
<div class="form-group">
<label class="col-sm-3 control-label is-required">null</label>
<div class="col-sm-8">
<input name="name" th:field="*{name}" class="form-control" type="text" required>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label is-required">null</label>
<div class="col-sm-8">
<input name="modelKey" th:field="*{modelKey}" class="form-control" type="text" required>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">null</label>
<div class="col-sm-8">
<textarea name="description" class="form-control">[[*{description}]]</textarea>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">null</label>
<div class="col-sm-8">
<textarea name="modelComment" class="form-control">[[*{modelComment}]]</textarea>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">null</label>
<div class="col-sm-8">
<div class="input-group date">
<input name="created" th:value="${#dates.format(actDeModel.created, 'yyyy-MM-dd')}" class="form-control" placeholder="yyyy-MM-dd" type="text">
<span class="input-group-addon"><i class="fa fa-calendar"></i></span>
</div>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">null</label>
<div class="col-sm-8">
<input name="createdBy" th:field="*{createdBy}" class="form-control" type="text">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">null</label>
<div class="col-sm-8">
<div class="input-group date">
<input name="lastUpdated" th:value="${#dates.format(actDeModel.lastUpdated, 'yyyy-MM-dd')}" class="form-control" placeholder="yyyy-MM-dd" type="text">
<span class="input-group-addon"><i class="fa fa-calendar"></i></span>
</div>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">null</label>
<div class="col-sm-8">
<input name="lastUpdatedBy" th:field="*{lastUpdatedBy}" class="form-control" type="text">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">null</label>
<div class="col-sm-8">
<input name="version" th:field="*{version}" class="form-control" type="text">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">null</label>
<div class="col-sm-8">
<input name="modelEditorJson" th:field="*{modelEditorJson}" class="form-control" type="text">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">null</label>
<div class="col-sm-8">
<input name="thumbnail" th:field="*{thumbnail}" class="form-control" type="text">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">null</label>
<div class="col-sm-8">
<select name="modelType" class="form-control m-b">
<option value="">所有</option>
</select>
<span class="help-block m-b-none"><i class="fa fa-info-circle"></i> 代码生成请选择字典属性</span>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">null</label>
<div class="col-sm-8">
<input name="tenantId" th:field="*{tenantId}" class="form-control" type="text">
</div>
</div>
</form>
</div>
<th:block th:include="include :: footer" />
<th:block th:include="include :: datetimepicker-js" />
<script th:inline="javascript">
var prefix = ctx + "system/model";
$("#form-model-edit").validate({
focusCleanup: true
});
function submitHandler() {
if ($.validate.form()) {
$.operate.save(prefix + "/edit", $('#form-model-edit').serialize());
}
}
$("input[name='created']").datetimepicker({
format: "yyyy-mm-dd",
minView: "month",
autoclose: true
});
$("input[name='lastUpdated']").datetimepicker({
format: "yyyy-mm-dd",
minView: "month",
autoclose: true
});
</script>
</body>
</html>

View File

@ -0,0 +1,127 @@
<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
<th:block th:include="include :: header('设计器model列表')" />
</head>
<body class="gray-bg">
<div class="container-div">
<div class="row">
<div class="col-sm-12 search-collapse">
<form id="formId">
<div class="select-list">
<ul>
<li>
<label>模型名称:</label>
<input type="text" name="name"/>
</li>
<li>
<label>模型key</label>
<input type="text" name="modelKey"/>
</li>
<li>
<label>版本号:</label>
<input type="text" name="version"/>
</li>
<li>
<a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
<a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
</li>
</ul>
</div>
</form>
</div>
<div class="btn-group-sm" id="toolbar" role="group">
<a class="btn btn-success" onclick="$.operate.add()" shiro:hasPermission="system:model:add">
<i class="fa fa-plus"></i> 添加
</a>
<a class="btn btn-primary single disabled" onclick="$.operate.edit()" shiro:hasPermission="system:model:edit">
<i class="fa fa-edit"></i> 修改
</a>
<a class="btn btn-danger multiple disabled" onclick="$.operate.removeAll()" shiro:hasPermission="system:model:remove">
<i class="fa fa-remove"></i> 删除
</a>
<a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="system:model:export">
<i class="fa fa-download"></i> 导出
</a>
</div>
<div class="col-sm-12 select-table table-striped">
<table id="bootstrap-table"></table>
</div>
</div>
</div>
<th:block th:include="include :: footer" />
<script th:inline="javascript">
var editFlag = [[${@permission.hasPermi('system:model:edit')}]];
var removeFlag = [[${@permission.hasPermi('system:model:remove')}]];
var prefix = ctx + "system/model";
$(function() {
var options = {
url: prefix + "/list",
createUrl: prefix + "/add",
updateUrl: prefix + "/edit/{id}",
removeUrl: prefix + "/remove",
exportUrl: prefix + "/export",
detailUrl: prefix + "/edit/{id}",
deploymentUrl: prefix + "/deployment",
modalName: "设计器model",
columns: [{
checkbox: true
},
{
field: 'id',
title: 'id',
visible: false
},
{
field: 'name',
title: '模型名称'
},
{
field: 'version',
title: '版本号'
},
{
field: 'modelKey',
title: '模型key'
},
{
field: 'description',
title: '描述'
},
{
field: 'created',
title: '创建时间'
},
{
field: 'lastUpdated',
title: '更新时间'
},
/* {
field: 'modelType',
title: 'null'
},*/
{
title: '操作',
align: 'center',
formatter: function(value, row, index) {
var actions = [];
actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.parentDetail(\'' + row.id + '\')"><i class="fa fa-edit"></i>编辑模型</a> ');
actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.deployment(\'' + row.id + '\')"><i class="fa fa-dashboard"></i>发布</a> ');
actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.id + '\')"><i class="fa fa-remove"></i>删除</a>');
return actions.join('');
}
}]
};
$.table.init(options);
});
</script>
</body>
</html>

View File

@ -56,6 +56,10 @@ public enum BusinessType
* 清空
*/
CLEAN,
/**
* 发布
*/
DEPLOYMENT,
/**
* 钉钉
*/

View File

@ -11,7 +11,7 @@ import java.io.Serializable;
* @create: 2020-11-20 21:44
**/
@Data
public class DeploymentQueryDTO implements Serializable {
public class DeploymentQueryDTO extends FlowBaseDTO implements Serializable {
private String deploymentKeyLike;
@ -22,12 +22,4 @@ public class DeploymentQueryDTO implements Serializable {
private String processDefinitionKeyLike;
private String startUserId;
/**
* 初始页
*/
private int firstResult=0;
/**
* 每页数
*/
private int maxResults=10;
}

View File

@ -3,11 +3,13 @@ package com.snow.flowable.domain;
import com.alibaba.fastjson.annotation.JSONField;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import org.flowable.common.engine.api.repository.EngineResource;
import org.flowable.engine.repository.ProcessDefinition;
import java.io.Serializable;
import java.util.Date;
import java.util.List;
import java.util.Map;
/**
* @program: snow
@ -18,28 +20,28 @@ import java.util.List;
@Data
public class DeploymentVO implements Serializable {
private String id;
/**
* 发布名称
*/
private String name;
/**
* 发布时间
*/
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
private Date deploymentTime;
/**
* 分类
*/
private String category;
private String key;
/**
* 租户Id
*/
protected String tenantId;
/**
* 父节点
*/
protected String parentDeploymentId;
private String derivedFrom;
private String derivedFromRoot;
private String tenantId;
private String engineVersion;
private ProcessDefinitionVO processDefinitionVO;
private List<ProcessDefinitionVO> processDefinitionVOList;
private List<ModelVO> modelVOList;
}

View File

@ -49,4 +49,11 @@ public interface FlowablePublishService {
* @return
*/
Deployment createBytesDeployment(DeploymentDTO deploymentDTO,byte[] bytes );
/**
* 根据modelId发布
* @param id
* @return
*/
Deployment createBytesDeploymentByModelId(String id);
}

View File

@ -26,11 +26,11 @@ public interface FlowableService {
PageModel<Model> getModelList(ModelDTO modelDTO);
/**
* 查询发布列表
* 查询发布列表(分页)
* @param deploymentQueryDTO
* @return
*/
List<DeploymentVO> getDeploymentList(DeploymentQueryDTO deploymentQueryDTO);
PageModel<DeploymentVO> getDeploymentList(DeploymentQueryDTO deploymentQueryDTO);
/**
* 删除发布

View File

@ -4,15 +4,23 @@ import com.snow.common.utils.StringUtils;
import com.snow.flowable.domain.ClassDeploymentDTO;
import com.snow.flowable.domain.DeploymentDTO;
import com.snow.flowable.service.FlowablePublishService;
import com.snow.system.domain.ActDeModel;
import com.snow.system.mapper.ActDeModelMapper;
import com.snow.system.service.IActDeModelService;
import lombok.extern.slf4j.Slf4j;
import org.flowable.bpmn.model.BpmnModel;
import org.flowable.common.engine.impl.util.IoUtil;
import org.flowable.engine.RepositoryService;
import org.flowable.engine.repository.Deployment;
import org.flowable.engine.repository.DeploymentBuilder;
import org.flowable.ui.modeler.domain.Model;
import org.flowable.ui.modeler.service.ModelServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.io.ByteArrayInputStream;
import java.io.InputStream;
import java.util.Optional;
import java.util.zip.ZipInputStream;
/**
@ -38,6 +46,11 @@ public class FlowablePublishServiceImpl implements FlowablePublishService {
@Autowired
private RepositoryService repositoryService;
@Autowired
private IActDeModelService iActDeModelService;
@Autowired
private ModelServiceImpl modelService;
/**
* class部署
@ -102,7 +115,6 @@ public class FlowablePublishServiceImpl implements FlowablePublishService {
@Override
public Deployment createBytesDeployment(DeploymentDTO deploymentDTO, byte[] bytes) {
Deployment deploy = repositoryService.createDeployment()
.tenantId(deploymentDTO.getTenantId())
.category(deploymentDTO.getCategory())
.name(deploymentDTO.getName())
.key(deploymentDTO.getKey())
@ -111,5 +123,23 @@ public class FlowablePublishServiceImpl implements FlowablePublishService {
return deploy;
}
@Override
public Deployment createBytesDeploymentByModelId(String id) {
Model model = modelService.getModel(id);
BpmnModel bpmnModel = modelService.getBpmnModel(model);
if(StringUtils.isNull(model)){
return null;
}
byte[] bpmnXML = modelService.getBpmnXML(model);
InputStream inputStream = new ByteArrayInputStream(bpmnXML);
DeploymentDTO deployModel = new DeploymentDTO();
deployModel.setCategory("system_flow");
deployModel.setName(model.getName());
deployModel.setKey(model.getKey());
//这个地方必须加.bpmn或者.bpmn20.xml后缀不然数据不会生成act_re_procdef这个表的数据
deployModel.setResourceName(model.getName()+".bpmn20.xml");
Deployment deploy = createInputStreamDeployment(deployModel,inputStream);
return deploy;
}
}

View File

@ -125,8 +125,8 @@ public class FlowableServiceImpl implements FlowableService {
}
@Override
public List<DeploymentVO> getDeploymentList(DeploymentQueryDTO deploymentQueryDTO) {
public PageModel<DeploymentVO> getDeploymentList(DeploymentQueryDTO deploymentQueryDTO) {
DeploymentQuery deploymentQuery = repositoryService.createDeploymentQuery();
if(!StringUtils.isEmpty(deploymentQueryDTO.getDeploymentNameLike())){
deploymentQuery.deploymentKeyLike(deploymentQueryDTO.getDeploymentNameLike());
@ -140,28 +140,20 @@ public class FlowableServiceImpl implements FlowableService {
if(!StringUtils.isEmpty(deploymentQueryDTO.getProcessDefinitionKeyLike())){
deploymentQuery.processDefinitionKeyLike(deploymentQueryDTO.getProcessDefinitionKeyLike());
}
long count = deploymentQuery.orderByDeploymenTime().desc().
count();
List<Deployment> deployments = deploymentQuery.orderByDeploymenTime().desc().
listPage(deploymentQueryDTO.getFirstResult(), deploymentQueryDTO.getMaxResults());
List<DeploymentVO> deploymentVOList = deployments.stream().map(t -> {
listPage(deploymentQueryDTO.getPageNum(), deploymentQueryDTO.getPageSize());
List<DeploymentVO> deploymentVoList = deployments.stream().map(t -> {
DeploymentVO deploymentVO = new DeploymentVO();
ProcessDefinitionQuery processDefinitionQuery = repositoryService.createProcessDefinitionQuery();
processDefinitionQuery.deploymentId(t.getId());
if (!StringUtils.isEmpty(deploymentQueryDTO.getStartUserId())) {
processDefinitionQuery.startableByUser(deploymentQueryDTO.getStartUserId());
}
List<ProcessDefinition> processDefinitionList = processDefinitionQuery.active().list();
List<ProcessDefinitionVO> processDefinitionVOList = processDefinitionList.stream().map(processDefinition -> {
ProcessDefinitionVO processDefinitionVO = new ProcessDefinitionVO();
BeanUtils.copyProperties(processDefinition, processDefinitionVO);
return processDefinitionVO;
}).collect(Collectors.toList());
BeanUtils.copyProperties(t,deploymentVO);
deploymentVO.setProcessDefinitionVO(processDefinitionVOList.get(0));
deploymentVO.setProcessDefinitionVOList(processDefinitionVOList);
BeanUtils.copyProperties(t, deploymentVO);
return deploymentVO;
}).collect(Collectors.toList());
return deploymentVOList;
PageModel<DeploymentVO> pageModel = new PageModel<> ();
pageModel.setTotalCount((int)count);
pageModel.setPagedRecords(deploymentVoList);
return pageModel;
}
@Override
@ -175,25 +167,37 @@ public class FlowableServiceImpl implements FlowableService {
@Override
public void getDeploymentSource(String id, String resourceName, String type,HttpServletResponse response) {
try {
byte[] b = null;
if (type.equals("xml")) {
response.setHeader("Content-type", "text/xml;charset=UTF-8");
InputStream inputStream = repositoryService.getResourceAsStream(id, resourceName);
b = IoUtil.readInputStream(inputStream, resourceName);
} else {
//todo 输出的有乱码暂时没有解决办法
response.setHeader("Content-Type", "image/png;charset=UTF-8");
response.setCharacterEncoding("utf-8");
InputStream inputStream = repositoryService.getResourceAsStream(id, resourceName);
b = IoUtil.readInputStream(inputStream, resourceName);
}
byte[] b = null;
if(StringUtils.isEmpty(resourceName)){
List<String> deploymentResourceNames = repositoryService.getDeploymentResourceNames(id);
if(type.equals("xml")){
String xmlType=".xml";
String bpmnType=".bpmn";
resourceName = deploymentResourceNames.stream().filter(p -> (p.endsWith(xmlType) || p.endsWith(bpmnType))).findFirst().orElse(null);
}else {
String pngType=".png";
resourceName = deploymentResourceNames.stream().filter(p -> p.endsWith(pngType)).findFirst().orElse(null);
}
}
if (type.equals("xml")) {
response.setHeader("Content-type", "text/xml;charset=UTF-8");
InputStream inputStream = repositoryService.getResourceAsStream(id, resourceName);
b = IoUtil.readInputStream(inputStream, resourceName);
} else if(type.equals("png")){
response.setHeader("Content-Type", "image/png;charset=UTF-8");
response.setCharacterEncoding("utf-8");
InputStream inputStream = repositoryService.getResourceAsStream(id, resourceName);
b = IoUtil.readInputStream(inputStream, resourceName);
}
response.getOutputStream().write(b);
} catch (IOException e) {
log.error("ApiFlowableModelResource-loadXmlByModelId:" + e);
e.printStackTrace();
}
}
@Override
public ProcessInstance startProcessInstanceByKey(StartProcessDTO startProcessDTO) {
ProcessInstance processInstance=null;

View File

@ -0,0 +1,101 @@
package com.snow.system.domain;
import java.util.Date;
import com.snow.common.annotation.Excel;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.snow.common.core.domain.BaseEntity;
import lombok.Data;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
/**
* 设计器model对象 act_de_model
*
* @author qimingjin
* @date 2020-12-01
*/
@Data
public class ActDeModel extends BaseEntity
{
private static final long serialVersionUID = 1L;
private String id;
@Excel(name = "模型名称")
private String name;
@Excel(name = "模型key")
private String modelKey;
@Excel(name = "描述")
private String description;
@Excel(name = "模型注解")
private String modelComment;
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
@Excel(name = "创建时间", width = 30, dateFormat = "yyyy-MM-dd")
private Date created;
@Excel(name = "创建人")
private String createdBy;
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
@Excel(name = "更新时间", width = 30, dateFormat = "yyyy-MM-dd")
private Date lastUpdated;
@Excel(name = "更新人")
private String lastUpdatedBy;
@Excel(name = "版本")
private Long version;
@Excel(name = "模型采用json格式")
private String modelEditorJson;
@Excel(name = "图片流")
private byte[] thumbnail;
/**
* 详见org.flowable.ui.modeler.domain.AbstractModel
*/
@Excel(name = "模型类型")
private Long modelType;
@Excel(name = "租户ID")
private String tenantId;
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("name", getName())
.append("modelKey", getModelKey())
.append("description", getDescription())
.append("modelComment", getModelComment())
.append("created", getCreated())
.append("createdBy", getCreatedBy())
.append("lastUpdated", getLastUpdated())
.append("lastUpdatedBy", getLastUpdatedBy())
.append("version", getVersion())
.append("modelEditorJson", getModelEditorJson())
.append("thumbnail", getThumbnail())
.append("modelType", getModelType())
.append("tenantId", getTenantId())
.toString();
}
}

View File

@ -0,0 +1,61 @@
package com.snow.system.mapper;
import java.util.List;
import com.snow.system.domain.ActDeModel;
/**
* 设计器modelMapper接口
*
* @author qimingjin
* @date 2020-12-01
*/
public interface ActDeModelMapper
{
/**
* 查询设计器model
*
* @param id 设计器modelID
* @return 设计器model
*/
public ActDeModel selectActDeModelById(String id);
/**
* 查询设计器model列表
*
* @param actDeModel 设计器model
* @return 设计器model集合
*/
public List<ActDeModel> selectActDeModelList(ActDeModel actDeModel);
/**
* 新增设计器model
*
* @param actDeModel 设计器model
* @return 结果
*/
public int insertActDeModel(ActDeModel actDeModel);
/**
* 修改设计器model
*
* @param actDeModel 设计器model
* @return 结果
*/
public int updateActDeModel(ActDeModel actDeModel);
/**
* 删除设计器model
*
* @param id 设计器modelID
* @return 结果
*/
public int deleteActDeModelById(String id);
/**
* 批量删除设计器model
*
* @param ids 需要删除的数据ID
* @return 结果
*/
public int deleteActDeModelByIds(String[] ids);
}

View File

@ -0,0 +1,64 @@
package com.snow.system.service;
import java.util.List;
import com.snow.system.domain.ActDeModel;
/**
* 设计器modelService接口
*
* @author qimingjin
* @date 2020-12-01
*/
public interface IActDeModelService
{
/**
* 查询设计器model
*
* @param id 设计器modelID
* @return 设计器model
*/
public ActDeModel selectActDeModelById(String id);
public ActDeModel selectThumbnailById(String id);
/**
* 查询设计器model列表
*
* @param actDeModel 设计器model
* @return 设计器model集合
*/
public List<ActDeModel> selectActDeModelList(ActDeModel actDeModel);
/**
* 新增设计器model
*
* @param actDeModel 设计器model
* @return 结果
*/
public int insertActDeModel(ActDeModel actDeModel);
/**
* 修改设计器model
*
* @param actDeModel 设计器model
* @return 结果
*/
public int updateActDeModel(ActDeModel actDeModel);
/**
* 批量删除设计器model
*
* @param ids 需要删除的数据ID
* @return 结果
*/
public int deleteActDeModelByIds(String ids);
/**
* 删除设计器model信息
*
* @param id 设计器modelID
* @return 结果
*/
public int deleteActDeModelById(String id);
}

View File

@ -0,0 +1,108 @@
package com.snow.system.service.impl;
import java.util.List;
import cn.hutool.core.io.IoUtil;
import org.apache.commons.io.IOUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.snow.system.mapper.ActDeModelMapper;
import com.snow.system.domain.ActDeModel;
import com.snow.system.service.IActDeModelService;
import com.snow.common.core.text.Convert;
/**
* 设计器modelService业务层处理
*
* @author qimingjin
* @date 2020-12-01
*/
@Service
public class ActDeModelServiceImpl implements IActDeModelService
{
@Autowired
private ActDeModelMapper actDeModelMapper;
/**
* 查询设计器model
*
* @param id 设计器modelID
* @return 设计器model
*/
@Override
public ActDeModel selectActDeModelById(String id)
{
return actDeModelMapper.selectActDeModelById(id);
}
@Override
public ActDeModel selectThumbnailById(String id) {
ActDeModel actDeModel = actDeModelMapper.selectActDeModelById(id);
byte[] thumbnail = actDeModel.getThumbnail();
//createBytesDeployment
// IOUtils.
return null;
}
/**
* 查询设计器model列表
*
* @param actDeModel 设计器model
* @return 设计器model
*/
@Override
public List<ActDeModel> selectActDeModelList(ActDeModel actDeModel)
{
return actDeModelMapper.selectActDeModelList(actDeModel);
}
/**
* 新增设计器model
*
* @param actDeModel 设计器model
* @return 结果
*/
@Override
public int insertActDeModel(ActDeModel actDeModel)
{
return actDeModelMapper.insertActDeModel(actDeModel);
}
/**
* 修改设计器model
*
* @param actDeModel 设计器model
* @return 结果
*/
@Override
public int updateActDeModel(ActDeModel actDeModel)
{
return actDeModelMapper.updateActDeModel(actDeModel);
}
/**
* 删除设计器model对象
*
* @param ids 需要删除的数据ID
* @return 结果
*/
@Override
public int deleteActDeModelByIds(String ids)
{
return actDeModelMapper.deleteActDeModelByIds(Convert.toStrArray(ids));
}
/**
* 删除设计器model信息
*
* @param id 设计器modelID
* @return 结果
*/
@Override
public int deleteActDeModelById(String id)
{
return actDeModelMapper.deleteActDeModelById(id);
}
}

View File

@ -0,0 +1,118 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.snow.system.mapper.ActDeModelMapper">
<resultMap type="ActDeModel" id="ActDeModelResult">
<result property="id" column="id" />
<result property="name" column="name" />
<result property="modelKey" column="model_key" />
<result property="description" column="description" />
<result property="modelComment" column="model_comment" />
<result property="created" column="created" />
<result property="createdBy" column="created_by" />
<result property="lastUpdated" column="last_updated" />
<result property="lastUpdatedBy" column="last_updated_by" />
<result property="version" column="version" />
<result property="modelEditorJson" column="model_editor_json" />
<result property="thumbnail" column="thumbnail" />
<result property="modelType" column="model_type" />
<result property="tenantId" column="tenant_id" />
</resultMap>
<sql id="selectActDeModelVo">
select id, name, model_key, description, model_comment, created, created_by, last_updated, last_updated_by, version, model_editor_json, thumbnail, model_type, tenant_id from act_de_model
</sql>
<select id="selectActDeModelList" parameterType="ActDeModel" resultMap="ActDeModelResult">
<include refid="selectActDeModelVo"/>
<where>
<if test="name != null and name != ''"> and name like concat('%', #{name}, '%')</if>
<if test="modelKey != null and modelKey != ''"> and model_key = #{modelKey}</if>
<if test="description != null and description != ''"> and description = #{description}</if>
<if test="modelComment != null and modelComment != ''"> and model_comment = #{modelComment}</if>
<if test="created != null "> and created = #{created}</if>
<if test="createdBy != null and createdBy != ''"> and created_by = #{createdBy}</if>
<if test="lastUpdated != null "> and last_updated = #{lastUpdated}</if>
<if test="lastUpdatedBy != null and lastUpdatedBy != ''"> and last_updated_by = #{lastUpdatedBy}</if>
<if test="version != null "> and version = #{version}</if>
<if test="modelEditorJson != null and modelEditorJson != ''"> and model_editor_json = #{modelEditorJson}</if>
<if test="modelType != null "> and model_type = #{modelType}</if>
<if test="tenantId != null and tenantId != ''"> and tenant_id = #{tenantId}</if>
</where>
</select>
<select id="selectActDeModelById" parameterType="String" resultMap="ActDeModelResult">
<include refid="selectActDeModelVo"/>
where id = #{id}
</select>
<insert id="insertActDeModel" parameterType="ActDeModel">
insert into act_de_model
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">id,</if>
<if test="name != null and name != ''">name,</if>
<if test="modelKey != null and modelKey != ''">model_key,</if>
<if test="description != null">description,</if>
<if test="modelComment != null">model_comment,</if>
<if test="created != null">created,</if>
<if test="createdBy != null">created_by,</if>
<if test="lastUpdated != null">last_updated,</if>
<if test="lastUpdatedBy != null">last_updated_by,</if>
<if test="version != null">version,</if>
<if test="modelEditorJson != null">model_editor_json,</if>
<if test="thumbnail != null">thumbnail,</if>
<if test="modelType != null">model_type,</if>
<if test="tenantId != null">tenant_id,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">#{id},</if>
<if test="name != null and name != ''">#{name},</if>
<if test="modelKey != null and modelKey != ''">#{modelKey},</if>
<if test="description != null">#{description},</if>
<if test="modelComment != null">#{modelComment},</if>
<if test="created != null">#{created},</if>
<if test="createdBy != null">#{createdBy},</if>
<if test="lastUpdated != null">#{lastUpdated},</if>
<if test="lastUpdatedBy != null">#{lastUpdatedBy},</if>
<if test="version != null">#{version},</if>
<if test="modelEditorJson != null">#{modelEditorJson},</if>
<if test="thumbnail != null">#{thumbnail},</if>
<if test="modelType != null">#{modelType},</if>
<if test="tenantId != null">#{tenantId},</if>
</trim>
</insert>
<update id="updateActDeModel" parameterType="ActDeModel">
update act_de_model
<trim prefix="SET" suffixOverrides=",">
<if test="name != null and name != ''">name = #{name},</if>
<if test="modelKey != null and modelKey != ''">model_key = #{modelKey},</if>
<if test="description != null">description = #{description},</if>
<if test="modelComment != null">model_comment = #{modelComment},</if>
<if test="created != null">created = #{created},</if>
<if test="createdBy != null">created_by = #{createdBy},</if>
<if test="lastUpdated != null">last_updated = #{lastUpdated},</if>
<if test="lastUpdatedBy != null">last_updated_by = #{lastUpdatedBy},</if>
<if test="version != null">version = #{version},</if>
<if test="modelEditorJson != null">model_editor_json = #{modelEditorJson},</if>
<if test="thumbnail != null">thumbnail = #{thumbnail},</if>
<if test="modelType != null">model_type = #{modelType},</if>
<if test="tenantId != null">tenant_id = #{tenantId},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteActDeModelById" parameterType="String">
delete from act_de_model where id = #{id}
</delete>
<delete id="deleteActDeModelByIds" parameterType="String">
delete from act_de_model where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>