流程相关2

This commit is contained in:
Timer
2026-03-06 01:08:17 +08:00
parent 3d81e6950f
commit ed81825425
6 changed files with 199 additions and 113 deletions

View File

@ -55,6 +55,7 @@ import java.beans.Introspector;
import java.beans.PropertyDescriptor;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.List;
@ -728,12 +729,21 @@ public class ModelController {
if(stencil.get("id").asText().toString().equals("UserTask")){
JSONObject json = JSONObject.fromObject(childShapes.path(i).toString());
JSONObject properties = JSONObject.fromObject(json.get("properties").toString());
String documentation = properties.get("documentation").toString();
String documentation = properties.get("documentation").toString();
// 获取节点名称
String nodeName = "";
if(properties.has("name") && properties.get("name") != null) {
nodeName = properties.get("name").toString();
}
// 添加节点名称字段,方便前端显示
json.put("nodeName", nodeName);
json.put("businessunit", businessUnitService.selectById(documentation));
String resourceId = json.get("resourceId").toString();
List<ModelNodeJob> list = this.jobService.selectModelNodeJobListByWhere(" where resource_id='"+resourceId+"' and model_id ='"+modelData.getId()+"' ");
StringBuilder jobNames= new StringBuilder();
StringBuilder jobIds = new StringBuilder();
StringBuilder jobIds= new StringBuilder();
if(list != null && !list.isEmpty()){
for(int j=0;j<list.size();j++){
if(list.get(j)!=null){
@ -874,6 +884,7 @@ public class ModelController {
@RequestMapping("/saveNode.do")
public String saveNode(HttpServletRequest request,Model model,
@RequestParam(value ="businessid") String businessid,
@RequestParam(value ="nodename") String nodename,
@RequestParam(value ="modelid") String modelid,
@RequestParam(value ="index") String index,
@RequestParam(value = "countersign",required = false,defaultValue = "false") boolean countersign,
@ -890,6 +901,8 @@ public class ModelController {
JSONObject json= modelobject.getJSONArray("childShapes").getJSONObject(i);
JSONObject properties =json.getJSONObject("properties");
properties.put("documentation", businessid);
properties.put("name", nodename);
properties.put("nodename", nodename);
// properties.put("usertaskassignment", "{\"assignment\":{\"candidateUsers\":[{\"value\":\"#{userIds}\",\"assignee\":\"${applicantId}\"}}");
//properties.put("usertaskassignment", "{\"assignment\":{\"candidateUsers\":[{\"value\":\"#{userIds}\",\"$$hashKey\":\"0BQ\"}],\"candidateGroups\":[{\"value\":\"#{groupIds}\",\"$$hashKey\":\"0AY\"}],\"assignee\":\"${applicantId}\"}}");
properties.put("usertaskassignment", "{\"assignment\":{\"candidateUsers\":[{\"value\":\"#{userIds}\",\"$$hashKey\":\"0BQ\"}],\"assignee\":\"${applicantId}\"}}");
@ -925,7 +938,7 @@ public class ModelController {
//保存
editorNode = new BpmnJsonConverter().convertToJson(bpmnModel);
}
repositoryService.addModelEditorSource(modelid, editorNode.toString().getBytes("utf-8"));
repositoryService.addModelEditorSource(modelid, editorNode.toString().getBytes(StandardCharsets.UTF_8));
result = modelid;
} catch (Exception e) {

View File

@ -47,14 +47,11 @@ public class BusinessUnitController {
@RequestParam(value = "order", required=false) String order) {
HttpSession currentSession = request.getSession(false);
User cu=(User)request.getSession().getAttribute("cu");
// if(cu==null){
// cu=loginService.Login(request.getParameter("username"), request.getParameter("pwd"));
// }
if(sort==null){
sort = " insdt ";
}
if(order==null){
order = " asc ";
order = " desc ";
}
String orderstr=" order by "+sort+" "+order;
@ -65,6 +62,9 @@ public class BusinessUnitController {
if(request.getParameter("search_name")!=null && !request.getParameter("search_name").isEmpty()){
wherestr += " and name like '%"+request.getParameter("search_name")+"%' ";
}
if(request.getParameter("search_processType")!=null && !request.getParameter("search_processType").isEmpty()){
wherestr += " and process_type_id = '"+request.getParameter("search_processType")+"' ";
}
PageHelper.startPage(page, rows);
List<BusinessUnit> list = this.businessUnitService.selectListByWhere(wherestr+orderstr);
@ -72,7 +72,6 @@ public class BusinessUnitController {
JSONArray json=JSONArray.fromObject(list);
String result="{\"total\":"+pi.getTotal()+",\"rows\":"+json+"}";
// System.out.println(result);
model.addAttribute("result",result);
return new ModelAndView("result");
}

View File

@ -79,8 +79,8 @@ var initTable = function(id) {
align: 'center', // 左右居中
valign: 'middle', // 上下居中
formatter:function(value,row,index){
return value.name;
}
return row.nodeName || (value && value.name) || '';
}
},{
field: 'businessunit', // 返回json数据中的name
title: '节点业务名称', // 表格表头显示文字

View File

@ -4,7 +4,7 @@
function dosave() {
$("#subForm").bootstrapValidator('validate');//提交验证
if ($("#subForm").data('bootstrapValidator').isValid()) {//获取验证结果,如果成功,执行下面代码
$.post(ext.contextPath + "/work/group/save.do", $("#subForm").serialize(), function(data) {
$.post(ext.contextPath + "/business/businessunit/save.do", $("#subForm").serialize(), function(data) {
if (data.res == 1) {
closeModal('subModal')
$("#table").bootstrapTable('refresh');
@ -25,12 +25,42 @@
name: {
validators: {
notEmpty: {
message: '用户名不能为空'
message: '业务单元名称不能为空'
}
}
},
processTypeId: {
validators: {
notEmpty: {
message: '流程类型不能为空'
}
}
},
}
});
});
$(function() {
// 加载流程类型下拉框
$.post(ext.contextPath + "/activiti/workflow/getProcessTypes4Combo.do", function(data) {
var selelct = $("#processTypeId").select2({
data: data,
placeholder: '请选择',
allowClear: true,
escapeMarkup: function(markup) {
return markup;
},
language: "zh-CN",
minimumInputLength: 0,
minimumResultsForSearch: 10,
formatResult: function formatRepo(repo) {
return repo.text;
},
formatSelection: function formatRepoSelection(repo) {
return repo.text;
}
});
}, 'json');
});
</script>
<div class="modal fade" id="subModal">
<div class="modal-dialog">
@ -38,7 +68,7 @@
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span></button>
<h4 class="modal-title">新增界面</h4>
<h4 class="modal-title">新增业务单元</h4>
</div>
<div class="modal-body">
<!-- 新增界面formid强制为subForm -->
@ -46,10 +76,24 @@
<!-- 界面提醒div强制id为alertDiv -->
<div id="alertDiv"></div>
<div class="form-group">
<label class="col-sm-2 control-label">名称</label>
<div class="col-sm-10">
<input type="text" class="form-control" id="name" name ="name" placeholder="名称" >
<label class="col-sm-3 control-label">*业务单元名称</label>
<div class="col-sm-9">
<input type="text" class="form-control" id="name" name="name" placeholder="业务单元名称" >
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">*流程类型</label>
<div class="col-sm-9">
<select class="form-control select2" id="processTypeId" name="processTypeId" style="width: 100%;"></select>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">激活状态</label>
<div class="col-sm-9">
<select class="form-control" id="active" name="active">
<option value="1" selected>激活</option>
<option value="0">停用</option>
</select>
</div>
</div>
</form>

View File

@ -2,27 +2,7 @@
<script type="text/javascript">
function doupdate() {
/* $("#baseForm").validate({
rules: {
name: "required"
},
messages: {
name: "请输入用户名"
},
// 校验全部通过
submitHandler: function () {
alert("校验全部通过!")
$.post(ext.contextPath + "/work/group/save.do", $("#baseForm").serialize(), function(data) {
if (data.res == 1) {
alert("保存成功")
}else if(data.res == 0){
alert("保存失败")
}else{
}
},'json');
}
}); */
$.post(ext.contextPath + "/work/group/update.do", $("#subForm").serialize(), function(data) {
$.post(ext.contextPath + "/business/businessunit/update.do", $("#subForm").serialize(), function(data) {
if (data.res == 1) {
$(".modal").modal("hide");
$("#table").bootstrapTable('refresh');
@ -34,6 +14,31 @@
},'json');
}
$(function() {
// 加载流程类型下拉框
$.post(ext.contextPath + "/activiti/workflow/getProcessTypes4Combo.do", function(data) {
var selelct = $("#processTypeId").select2({
data: data,
placeholder: '请选择',
allowClear: true,
escapeMarkup: function(markup) {
return markup;
},
language: "zh-CN",
minimumInputLength: 0,
minimumResultsForSearch: 10,
formatResult: function formatRepo(repo) {
return repo.text;
},
formatSelection: function formatRepoSelection(repo) {
return repo.text;
}
});
// 设置当前值
selelct.val('${businessUnit.processTypeId}').trigger("change");
}, 'json');
});
</script>
<div class="modal fade" id="subModal">
<div class="modal-dialog">
@ -41,19 +46,32 @@
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span></button>
<h4 class="modal-title">编辑界面</h4>
<h4 class="modal-title">编辑业务单元</h4>
</div>
<div class="modal-body">
<!-- 新增界面formid强制为subForm -->
<form class="form-horizontal" id="subForm">
<div id="alertDiv"></div>
<input id ="id" name="id" type="hidden" value="${group.id}"/>
<!-- 界面提醒div强制id为alertdiv -->
<input id="id" name="id" type="hidden" value="${businessUnit.id}"/>
<div class="form-group">
<label class="col-sm-2 control-label">名称</label>
<div class="col-sm-10">
<input type="text" class="form-control" id="name" name ="name" placeholder="名称" value="${group.name}">
<label class="col-sm-3 control-label">*业务单元名称</label>
<div class="col-sm-9">
<input type="text" class="form-control" id="name" name="name" placeholder="业务单元名称" value="${businessUnit.name}">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">*流程类型</label>
<div class="col-sm-9">
<select class="form-control select2" id="processTypeId" name="processTypeId" style="width: 100%;"></select>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">激活状态</label>
<div class="col-sm-9">
<select class="form-control" id="active" name="active">
<option value="1" ${businessUnit.active eq '1' ? 'selected' : ''}>激活</option>
<option value="0" ${businessUnit.active eq '0' ? 'selected' : ''}>停用</option>
</select>
</div>
</div>
</form>

View File

@ -5,21 +5,19 @@
<%@ page import="com.sipai.entity.base.ServerObject"%>
<%@ taglib uri="http://www.springsecurity.org/jsp" prefix="security"%>
<!DOCTYPE html>
<!-- <html lang="zh-CN"> -->
<!-- BEGIN HEAD -->
<html>
<head>
<title><%= ServerObject.atttable.get("TOPTITLE")%></title>
<!-- 引用页头及CSS页-->
<jsp:include page="/jsp/inc.jsp"></jsp:include>
<script type="text/javascript">
var addFun = function() {
$.post(ext.contextPath + '/work/group/add.do', {} , function(data) {
$.post(ext.contextPath + '/business/businessunit/add.do', {} , function(data) {
$("#subDiv").html(data);
openModal('subModal');
});
};
var editFun = function(id) {
$.post(ext.contextPath + '/work/group/edit.do', {id:id} , function(data) {
$.post(ext.contextPath + '/business/businessunit/edit.do', {id:id} , function(data) {
$("#subDiv").html(data);
openModal('subModal');
});
@ -47,7 +45,7 @@
})
.then(function(willDelete) {
if (willDelete) {
$.post(ext.contextPath + '/work/group/delete.do', {id : id}, function(data) {
$.post(ext.contextPath + '/business/businessunit/delete.do', {id : id}, function(data) {
if(data==1){
$("#table").bootstrapTable('refresh');
}else{
@ -89,7 +87,7 @@
})
.then(function(willDelete) {
if (willDelete) {
$.post(ext.contextPath + '/work/group/deletes.do', {ids:datas} , function(data) {
$.post(ext.contextPath + '/business/businessunit/deletes.do', {ids:datas} , function(data) {
if(data>0){
$("#table").bootstrapTable('refresh');
}else{
@ -105,8 +103,8 @@
$("#table").bootstrapTable('refresh');
};
$(function() {
//init();
$("#search_code").select2({
// 流程类型筛选下拉框
$("#search_processType").select2({
ajax: {
type:'POST',
url: ext.contextPath +"/activiti/workflow/getProcessTypes4Combo.do",
@ -119,59 +117,91 @@
},
cache: true
},
placeholder:'请选择',//默认文字提示
allowClear: true,//允许清空
escapeMarkup: function (markup) { return markup; }, // 自定义格式化防止xss注入
placeholder:'请选择流程类型',
allowClear: true,
escapeMarkup: function (markup) { return markup; },
language: "zh-CN",
minimumInputLength: 0,
minimumResultsForSearch: 10,//数据超过十个启用搜索框
formatResult: function formatRepo(repo){return repo.text;}, // 函数用来渲染结果
formatSelection: function formatRepoSelection(repo){return repo.text;} // 函数用于呈现当前的选择
minimumResultsForSearch: 10,
formatResult: function formatRepo(repo){return repo.text;},
formatSelection: function formatRepoSelection(repo){return repo.text;}
});
fixSelect2ToTool("search_code");
$("#table").bootstrapTable({ // 对应table标签的id
url: ext.contextPath + '/work/group/getlist.do', // 获取表格数据的url
cache: false, // 设置为 false 禁用 AJAX 数据缓存, 默认为true
striped: true, //表格显示条纹默认为false
pagination: true, // 在表格底部显示分页组件默认false
pageList: [10, 20,50], // 设置页面可以显示的数据条数
pageSize: 50, // 页面数据条数
pageNumber: 1, // 首页页码
sidePagination: 'server', // 设置为服务器端分页
queryParams: function (params) { // 请求服务器数据时发送的参数可以在这里添加额外的查询参数返回false则终止请求
fixSelect2ToTool("search_processType");
$("#table").bootstrapTable({
url: ext.contextPath + '/business/businessunit/getlist.do',
cache: false,
striped: true,
pagination: true,
pageList: [10, 20,50],
pageSize: 50,
pageNumber: 1,
sidePagination: 'server',
queryParams: function (params) {
return {
rows: params.limit, // 每页要显示的数据条数
page: params.offset/params.limit+1, // 每页显示数据的开始页码
sort: params.sort, // 要排序的字段
rows: params.limit,
page: params.offset/params.limit+1,
sort: params.sort,
order: params.order,
search_name: $('#search_name').val()
search_name: $('#search_name').val(),
search_processType: $('#search_processType').val()
}
},
sortName: 'id', // 要排序的字段
sortOrder: 'desc', // 排序规则
sortName: 'insdt',
sortOrder: 'desc',
columns: [
{
checkbox: true, // 显示一个勾选框
checkbox: true,
}, {
field: 'name',
title: '业务单元名称',
align: 'center',
valign: 'middle'
}, {
field: 'processTypeId',
title: '流程类型',
align: 'center',
valign: 'middle',
formatter: function(value, row) {
// 从ProcessType枚举获取名称
if(value) {
return value;
}
return '';
}
}, {
field: 'active',
title: '状态',
align: 'center',
valign: 'middle',
formatter: function(value, row) {
if(value == '1') {
return '<span class="label label-success">激活</span>';
} else {
return '<span class="label label-default">停用</span>';
}
}
}, {
field: 'insdt',
title: '创建时间',
align: 'center',
valign: 'middle'
}, {
field: 'name', // 返回json数据中的name
title: '编号', // 表格表头显示文字
align: 'center', // 左右居中
valign: 'middle' // 上下居中
},{
title: "操作",
align: 'center',
valign: 'middle',
width: 60, // 定义列的宽度单位为像素px
width: 120,
formatter: function (value, row, index) {
return '<button class="btn btn-default btn-sm" onclick="editFun(\'' + row.id + '\')" data-toggle="tooltip" title="编辑"><i class="fa fa-edit "></i><span class="hidden-md hidden-lg"> 编辑</span></button>';
/* return '<i class="fa fa-edit" onclick="editFun()(\'' + row.id + '\')></i>'; */
var str = '';
str += '<button class="btn btn-default btn-sm" onclick="editFun(\'' + row.id + '\')" data-toggle="tooltip" title="编辑"><i class="fa fa-edit "></i></button>';
str += '<button class="btn btn-default btn-sm" onclick="deleteFun(\'' + row.id + '\')" data-toggle="tooltip" title="删除"><i class="fa fa-trash "></i></button>';
return '<div class="btn-group">' + str + '</div>';
}
}
],
onLoadSuccess: function(){ //加载成功时执行
onLoadSuccess: function(){
adjustBootstrapTableView("table");
},
onLoadError: function(){ //加载失败时执行
onLoadError: function(){
console.info("加载数据失败");
}
@ -183,59 +213,41 @@
</head>
<body onload="initMenu()" class="hold-transition ${cu.themeclass} sidebar-mini">
<div class="wrapper">
<!-- 引用top -->
<%-- <jsp:include page="/jsp/top.jsp"></jsp:include> --%>
<!-- 菜单栏 -->
<%-- <jsp:include page="/jsp/left.jsp"></jsp:include> --%>
<div class="content-wrapper">
<!-- Content Header (Page header) -->
<section class="content-header">
<h1 id ="head_title"></h1>
<h1 id ="head_title">业务流程类别管理</h1>
<ol class="breadcrumb">
<li><a id ='head_firstlevel' href="#"><i class="fa fa-dashboard"></i> </a></li>
<!-- <li class="active">Here</li> -->
</ol>
</section>
<!-- Main content -->
<section class="content container-fluid">
<div id="mainAlertdiv"></div>
<div id="subDiv"></div>
<div id="menu4SelectDiv"></div>
<div >
<div class="btn-group" style="width: 220px;padding-bottom:10px;">
<security:authorize buttonUrl="plan/dailyplan/add.do">
<div class="btn-group" style="padding-bottom:10px;">
<security:authorize buttonUrl="business/businessunit/add.do">
<button type="button" class="btn btn-default" onclick="addFun();"><i class="fa fa-plus"></i> 新增</button>
</security:authorize>
<!-- <button type="button" class="btn btn-default" onclick="editFun();"><i class="fa fa-edit"></i> 编辑</button> -->
<button type="button" class="btn btn-default" onclick="deletesFun();"><i class="fa fa-trash-o"></i> 删除</button>
</div>
<br>
<div class="form-group " style="padding:0;">
<label class="form-label">班组</label>
<select class="form-control select2 " id="search_code" name ="search_code" style="width: 220px;"></select>
<label class="form-label" style="margin-left:10px;">流程类型</label>
<select class="form-control select2 " id="search_processType" name="search_processType" style="width: 220px;"></select>
<div class="form-group pull-right" >
<div class="input-group input-group-sm" style="width: 250px;">
<input type="text" id="search_name" name="search_name" class="form-control pull-right" placeholder="名称">
<input type="text" id="search_name" name="search_name" class="form-control pull-right" placeholder="业务单元名称">
<div class="input-group-btn">
<button class="btn btn-default" onclick="dosearch();"><i class="fa fa-search"></i></button>
</div>
</div>
</div>
</div>
<table id="table"></table>
</div>
</section>
<!-- /.content -->
</div>
<%-- <jsp:include page="/jsp/bottom.jsp"></jsp:include> --%>
<%-- <jsp:include page="/jsp/side.jsp"></jsp:include> --%>
</div>
</body>
</html>