提交 704f658f 编写于 作者: doc_wei's avatar doc_wei

流程发布完成

上级 d7c0c94b
因为 它太大了无法显示 source diff 。你可以改为 查看blob
此差异已折叠。
......@@ -111,4 +111,20 @@ public class ActivitiModelController {
activitiModelService.deleteActivitiModelById(inputObject, outputObject);
}
/**
*
* @Title: queryReleasedActivitiModelList
* @Description: 获取已经发布的模型
* @param @param inputObject
* @param @param outputObject
* @param @throws Exception 参数
* @return void 返回类型
* @throws
*/
@RequestMapping("/post/ActivitiModelController/queryReleasedActivitiModelList")
@ResponseBody
public void queryReleasedActivitiModelList(InputObject inputObject, OutputObject outputObject) throws Exception{
activitiModelService.queryReleasedActivitiModelList(inputObject, outputObject);
}
}
package com.skyeye.activiti.entity;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import org.activiti.engine.repository.Deployment;
import org.activiti.rest.common.util.DateToStringSerializer;
import java.util.Date;
public class DeploymentResponse {
private String id;
private String name;
@JsonSerialize(using = DateToStringSerializer.class, as = Date.class)
private Date deploymentTime;
private String category;
private String tenantId;
public DeploymentResponse(Deployment deployment) {
setId(deployment.getId());
setName(deployment.getName());
setDeploymentTime(deployment.getDeploymentTime());
setCategory(deployment.getCategory());
setTenantId(deployment.getTenantId());
}
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 Date getDeploymentTime() {
return deploymentTime;
}
public void setDeploymentTime(Date deploymentTime) {
this.deploymentTime = deploymentTime;
}
public String getCategory() {
return category;
}
public void setCategory(String category) {
this.category = category;
}
public void setTenantId(String tenantId) {
this.tenantId = tenantId;
}
public String getTenantId() {
return tenantId;
}
}
\ No newline at end of file
......@@ -17,4 +17,6 @@ public interface ActivitiModelService {
public void deleteActivitiModelById(InputObject inputObject, OutputObject outputObject) throws Exception;
public void queryReleasedActivitiModelList(InputObject inputObject, OutputObject outputObject) throws Exception;
}
......@@ -19,6 +19,7 @@ import org.springframework.stereotype.Service;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.node.ObjectNode;
import com.skyeye.activiti.entity.DeploymentResponse;
import com.skyeye.activiti.service.ActivitiModelService;
import com.skyeye.common.object.InputObject;
import com.skyeye.common.object.OutputObject;
......@@ -92,13 +93,19 @@ public class ActivitiModelServiceImpl implements ActivitiModelService{
*/
@Override
public void queryActivitiModelList(InputObject inputObject, OutputObject outputObject) throws Exception {
Map<String, Object> map = inputObject.getParams();
RepositoryService repositoryService = processEngine.getRepositoryService();
List<Model> beans = repositoryService.createModelQuery().list();
List<Model> beans = repositoryService.createModelQuery()
.listPage(Integer.parseInt(map.get("limit").toString()) * (Integer.parseInt(map.get("page").toString()) - 1), Integer.parseInt(map.get("limit").toString()));
long count = repositoryService.createModelQuery().count() - repositoryService.createDeploymentQuery().count();
List<Map<String, Object>> rows = new ArrayList<>();
for(Model model : beans){
rows.add(ToolUtil.javaBean2Map(model));
if(ToolUtil.isBlank(model.getDeploymentId())){
rows.add(ToolUtil.javaBean2Map(model));
}
}
outputObject.setBeans(rows);
outputObject.settotal(count);
}
/**
......@@ -198,6 +205,34 @@ public class ActivitiModelServiceImpl implements ActivitiModelService{
String id = map.get("id").toString();
repositoryService.deleteModel(id);
}
/**
*
* @Title: queryReleasedActivitiModelList
* @Description: 获取已经发布的模型
* @param @param inputObject
* @param @param outputObject
* @param @throws Exception 参数
* @return void 返回类型
* @throws
*/
@Override
public void queryReleasedActivitiModelList(InputObject inputObject, OutputObject outputObject) throws Exception {
Map<String, Object> map = inputObject.getParams();
List<Deployment> deployments = repositoryService.createDeploymentQuery()
.listPage(Integer.parseInt(map.get("limit").toString()) * (Integer.parseInt(map.get("page").toString()) - 1), Integer.parseInt(map.get("limit").toString()));
long count = repositoryService.createDeploymentQuery().count();
List<DeploymentResponse> list = new ArrayList<>();
for(Deployment deployment: deployments){
list.add(new DeploymentResponse(deployment));
}
List<Map<String, Object>> rows = new ArrayList<>();
for(DeploymentResponse deploymentResponse : list){
rows.add(ToolUtil.javaBean2Map(deploymentResponse));
}
outputObject.setBeans(rows);
outputObject.settotal(count);
}
}
......@@ -83,7 +83,7 @@ public class SessionFilter implements Filter {
}else{
for(String str : Constants.FILTER_FILE_NO_SESSION_REQUEST_OPTION){
if (url.contains(str)) {
chain.doFilter(new XssHttpServletRequestWrapper((HttpServletRequest) request), response);
chain.doFilter(request, response);
return;
}
}
......
......@@ -20,8 +20,8 @@ public class OutputObject extends PutObject implements Serializable{
setNull();
}
public void settotal(int total){
OutputObject.object.put("total",total);
public void settotal(Object total){
OutputObject.object.put("total", total);
}
public void setreturnMessage(Object returnMessage){
......
......@@ -892,6 +892,8 @@
<url id="activitimode001" path="/post/ActivitiModelController/insertNewActivitiModel" val="新建一个空模型" allUse="1">
</url>
<url id="activitimode002" path="/post/ActivitiModelController/queryActivitiModelList" val="获取所有模型" allUse="1">
<property id="limit" name="limit" ref="required,num" var="分页参数,每页多少条数据" />
<property id="page" name="page" ref="required,num" var="分页参数,第几页"/>
</url>
<url id="activitimode003" path="/post/ActivitiModelController/editActivitiModelToDeploy" val="发布模型为流程定义" allUse="1">
<property id="modelId" name="modelId" ref="required" var="模型id"/>
......@@ -905,6 +907,10 @@
<url id="activitimode006" path="/post/ActivitiModelController/deleteActivitiModelById" val="删除模型" allUse="1">
<property id="rowId" name="id" ref="required" var="模型id"/>
</url>
<url id="activitimode007" path="/post/ActivitiModelController/queryReleasedActivitiModelList" val="获取已经发布的模型" allUse="1">
<property id="limit" name="limit" ref="required,num" var="分页参数,每页多少条数据" />
<property id="page" name="page" ref="required,num" var="分页参数,第几页"/>
</url>
<!-- 工作流结束 -->
</controller>
\ No newline at end of file
......@@ -284,7 +284,7 @@ div.propertySection {
.property-row > span {
display: block;
float: left;
margin: 2px 2%;
margin: 0px 2%;
padding: 0;
min-height: 25px;
}
......@@ -301,7 +301,7 @@ div.propertySection {
}
.property-row span.title {
font-size: 13px;
font-size: 12px;
font-weight: bold;
width: 46%;
}
......
......@@ -19,17 +19,26 @@ layui.config({
url: reqBasePath + 'activitimode002',
where:{},
even:true, //隔行变色
page: false,
page: true,
limits: [8, 16, 24, 32, 40, 48, 56],
limit: 8,
cols: [[
{ title: '序号', type: 'numbers'},
{ field: 'id', title: '模型编号', width: 120 },
{ field: 'name', title: '模型名称', width: 120 },
{ field: 'version', title: '版本', width: 120},
{ field: 'deploymentId', title: '状态', width: 120, templet: function(d){
if(isNull(d.deploymentId)){
return "<span class='state-new'>未发布</span>";
}else{
return "<span class='state-up'>已发布</span>";
}
}},
{ field: 'createTime', title: '创建时间', width: 180, templet: function(d){
var str = d.createTime.toString();
str = str.substring(0, str.length - 3);
return date('Y-m-d H:i:s', str);
} },
}},
{ title: '操作', fixed: 'right', align: 'center', width: 240, toolbar: '#tableBar'}
]]
});
......@@ -41,6 +50,8 @@ layui.config({
del(data, obj);
}else if (layEvent === 'edit') { //编辑
edit(data);
}else if (layEvent === 'fb') { //发布
fb(data);
}
});
......@@ -89,6 +100,23 @@ layui.config({
}});
}
//发布
function fb(data){
rowId = data.id;
var msg = data ? '确认发布模型【' + data.name + '】吗?' : '确认发布选中数据吗?';
layer.confirm(msg, { icon: 3, title: '发布模型' }, function (index) {
layer.close(index);
AjaxPostUtil.request({url:reqBasePath + "activitimode003", params:{modelId: rowId}, type:'json', callback:function(json){
if(json.returnCode == 0){
top.winui.window.msg("发布成功", {icon: 1,time: 2000});
loadTable();
}else{
top.winui.window.msg(json.returnMessage, {icon: 2,time: 2000});
}
}});
});
}
//刷新数据
$("body").on("click", "#reloadTable", function(){
loadTable();
......
layui.config({
base: basePath,
version: skyeyeVersion
}).define(['table', 'jquery', 'winui', 'form'], function (exports) {
winui.renderColor();
//模板分组ID
groupId = parent.rowId;
var $ = layui.$,
form = layui.form,
table = layui.table;
//表格渲染
table.render({
id: 'messageTable',
elem: '#messageTable',
method: 'post',
url: reqBasePath + 'activitimode007',
where:{},
even:true, //隔行变色
page: true,
limits: [8, 16, 24, 32, 40, 48, 56],
limit: 8,
cols: [[
{ title: '序号', type: 'numbers'},
{ field: 'id', title: '编号', width: 120 },
{ field: 'name', title: '名称', width: 120 },
{ field: 'id', title: '状态', width: 120, templet: function(d){
return "<span class='state-up'>已发布</span>";
}},
{ field: 'deploymentTime', title: '部署时间', width: 180, templet: function(d){
var str = d.deploymentTime.toString();
str = str.substring(0, str.length - 3);
return date('Y-m-d H:i:s', str);
}},
{ title: '操作', fixed: 'right', align: 'center', width: 240, toolbar: '#tableBar'}
]]
});
table.on('tool(messageTable)', function (obj) { //注:tool是工具条事件名,test是table原始容器的属性 lay-filter="对应的值"
var data = obj.data; //获得当前行数据
var layEvent = obj.event; //获得 lay-event 对应的值
if (layEvent === 'del') { //取消发布
del(data, obj);
}
});
//搜索表单
form.render();
form.on('submit(formSearch)', function (data) {
//表单验证
if (winui.verifyForm(data.elem)) {
loadTable();
}
return false;
});
//取消发布
function del(data, obj){
var msg = obj ? '确认取消发布【' + obj.data.name + '】吗?' : '确认取消发布选中数据吗?';
layer.confirm(msg, { icon: 3, title: '取消发布' }, function (index) {
layer.close(index);
//向服务端发送删除指令
AjaxPostUtil.request({url:reqBasePath + "activitimode006", params:{rowId: data.id}, type:'json', callback:function(json){
if(json.returnCode == 0){
top.winui.window.msg("取消发布成功", {icon: 1,time: 2000});
loadTable();
}else{
top.winui.window.msg(json.returnMessage, {icon: 2,time: 2000});
}
}});
});
}
//刷新数据
$("body").on("click", "#reloadTable", function(){
loadTable();
});
function loadTable(){
table.reload("messageTable", {where:{}});
}
exports('codemodellist', {});
});
......@@ -16,15 +16,14 @@
</div>
</div>
<div id="modelContentDiv" style="height:auto; position: fixed; left: 10000px;">
<textarea id="modelContent"></textarea>
</div>
<div style="margin:auto 10px;">
<table id="messageTable" lay-filter="messageTable"></table>
<script type="text/html" id="tableBar">
<a class="layui-btn layui-btn-xs" lay-event="edit">编辑</a>
<a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del">删除</a>
{{# if(isNull(d.deploymentId)){ }}
<a class="layui-btn layui-btn-xs" lay-event="edit">编辑</a>
<a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del">删除</a>
<a class="layui-btn layui-btn-normal layui-btn-xs" lay-event="fb">发布</a>
{{# } }}
</script>
</div>
<script src="../../assets/lib/layui/layui.js"></script>
......
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title></title>
<link href="../../assets/lib/layui/css/layui.css" rel="stylesheet" />
<link href="../../assets/lib/font-awesome-4.7.0/css/font-awesome.css" rel="stylesheet" />
<link href="../../assets/lib/winui/css/winui.css" rel="stylesheet" />
<link href="../../assets/lib/layui/css/codemirror.css" rel="stylesheet" />
</head>
<body>
<div class="winui-toolbar">
<div class="winui-tool">
<button id="reloadTable" class="winui-toolbtn"><i class="fa fa-refresh" aria-hidden="true"></i>刷新数据</button>
</div>
</div>
<div style="margin:auto 10px;">
<table id="messageTable" lay-filter="messageTable"></table>
<script type="text/html" id="tableBar">
<a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del">取消发布</a>
</script>
</div>
<script src="../../assets/lib/layui/layui.js"></script>
<script src="../../assets/lib/layui/custom.js"></script>
<script type="text/javascript">
layui.config({base: '../../js/activitimodel/'}).use('releasedactivitimodellist');
</script>
</body>
</html>
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册