flowable集成

This commit is contained in:
459816669@qq.com 2020-11-24 22:49:16 +08:00
parent c8a0472d9e
commit bb2dbb9682
16 changed files with 186 additions and 56 deletions

View File

@ -65,9 +65,8 @@ public class FlowController {
}
mmap.put("sysOaLeave", sysOaLeaves.get(0));
mmap.put("taskId", taskId);
return "system/leave/finishTask";
}
return "";
return task.getFormKey();
}
/**

View File

@ -53,7 +53,7 @@ public class FlowModelerController extends BaseController
return redirect("/modeler/index.html");
}
@RequiresPermissions("modeler:flow:view")
@RequiresPermissions("modeler:deployment:view")
@GetMapping()
public String deploymentView()
{
@ -63,7 +63,7 @@ public class FlowModelerController extends BaseController
/**
* 查询发布实例列表
*/
@RequiresPermissions("modeler:flow:list")
@RequiresPermissions("modeler:deployment:list")
@PostMapping("/list")
@ResponseBody
public TableDataInfo list(DeploymentQueryDTO deploymentQuery)
@ -92,6 +92,7 @@ public class FlowModelerController extends BaseController
* 获取XML
*/
@GetMapping("/getXml")
@RequiresPermissions("modeler:deployment:getXml")
public void getXml(String id,String resourceName,HttpServletResponse response)
{
@ -102,6 +103,7 @@ public class FlowModelerController extends BaseController
* 获取流程图
*/
@GetMapping("/getFlowPicture")
@RequiresPermissions("modeler:deployment:getFlowPicture")
public void getFlowPicture(String id,String resourceName,HttpServletResponse response)
{
@ -145,7 +147,7 @@ public class FlowModelerController extends BaseController
/**
* 删除发布
*/
@RequiresPermissions("modeler:flow:remove")
@RequiresPermissions("modeler:deployment:remove")
@Log(title = "删除发布", businessType = BusinessType.DELETE)
@PostMapping( "/remove")
@ResponseBody
@ -157,7 +159,7 @@ public class FlowModelerController extends BaseController
@Log(title = "发布流程", businessType = BusinessType.IMPORT)
@RequiresPermissions("modeler:flow:import")
@RequiresPermissions("modeler:deployment:deployment")
@PostMapping("/importData")
@ResponseBody
public AjaxResult importData(MultipartFile file, String name,String key,String category) throws Exception

View File

@ -1,10 +1,15 @@
package com.snow.web.controller.system;
import java.util.List;
import java.util.Map;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import com.snow.common.constant.SequenceContants;
import com.snow.common.utils.StringUtils;
import com.snow.flowable.domain.CompleteTaskDTO;
import com.snow.flowable.domain.FileEntry;
import com.snow.flowable.domain.FinishTaskDTO;
import com.snow.flowable.domain.StartProcessDTO;
import com.snow.flowable.service.impl.FlowableServiceImpl;
import com.snow.framework.util.ShiroUtils;
@ -121,7 +126,7 @@ public class SysOaLeaveController extends BaseController
* 完成任务
*/
//@RequiresPermissions("system:leave:startLeaveProcess")
@Log(title = "发起审批", businessType = BusinessType.INSERT)
@Log(title = "完成任务", businessType = BusinessType.OTHER)
@PostMapping("/finishTask")
@ResponseBody
@Transactional(rollbackFor = Exception.class)
@ -179,6 +184,7 @@ public class SysOaLeaveController extends BaseController
flowableService.completeTask(completeTaskDTO);
sysOaLeave.setProcessStatus(1);
sysOaLeave.setCreateBy(sysUser.getUserName());
sysOaLeave.setApplyPerson(sysUser.getUserName());
BeanUtils.copyProperties(sysOaLeave,oldSysOaLeave);
sysOaLeave.setProcessInstanceId(processInstance.getProcessInstanceId());
return toAjax(sysOaLeaveService.updateSysOaLeave(sysOaLeave));
@ -195,4 +201,36 @@ public class SysOaLeaveController extends BaseController
{
return toAjax(sysOaLeaveService.deleteSysOaLeaveByIds(ids));
}
@Log(title = "主管完成审批", businessType = BusinessType.OTHER)
@PostMapping("/managerFinishTask")
@ResponseBody
@Transactional(rollbackFor = Exception.class)
public AjaxResult managerFinishTask(FinishTaskDTO finishTaskDTO)
{
SysUser sysUser = ShiroUtils.getSysUser();
List<FileEntry> files=Lists.newArrayList();
FileEntry fileEntry=new FileEntry();
fileEntry.setName("请假申请");
fileEntry.setUrl(finishTaskDTO.getSuggestionFileUrl());
files.add(fileEntry);
CompleteTaskDTO completeTaskDTO=new CompleteTaskDTO();
completeTaskDTO.setTaskId(finishTaskDTO.getTaskId());
completeTaskDTO.setUserId(String.valueOf(sysUser.getUserId()));
completeTaskDTO.setFiles(files);
completeTaskDTO.setComment(finishTaskDTO.getSuggestion());
Integer checkStatus = finishTaskDTO.getCheckStatus();
Map<String,Object> paramMap=Maps.newHashMap();
paramMap.put("hr",2);
completeTaskDTO.setParamMap(paramMap);
if(checkStatus==0){
completeTaskDTO.setIsPass(true);
}else {
completeTaskDTO.setIsPass(false);
}
flowableService.completeTask(completeTaskDTO);
return AjaxResult.success();
}
}

View File

@ -48,9 +48,6 @@
<a class="btn btn-info" onclick="$.table.importFlowDeployment()" shiro:hasPermission="modeler:flow:import">
<i class="fa fa-upload"></i> 发布流程
</a>
<a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="system:flow:export">
<i class="fa fa-download"></i> 导出
</a>
</div>
<div class="col-sm-12 select-table table-striped">
<table id="bootstrap-table"></table>
@ -62,10 +59,6 @@
<script th:inline="javascript">
var editFlag = [[${@permission.hasPermi('system:flow:edit')}]];
var removeFlag = [[${@permission.hasPermi('system:flow:remove')}]];
var tradeTypeDatas = [[${@dict.getType('trade_type')}]];
var tradeStatusDatas = [[${@dict.getType('trade_status_type')}]];
var incomeExpenditureTypeDatas = [[${@dict.getType('income_expenditure_type')}]];
var capitalStatusDatas = [[${@dict.getType('capital_status')}]];
var flowCategoryDatas = [[${@dict.getType('flow_category')}]];
var prefix = ctx + "modeler";
$(function() {

View File

@ -96,6 +96,28 @@
</div>
</div>
<div class="row">
<div class="col-sm-12">
<div class="ibox float-e-margins">
<div class="ibox-title">
<h5>我的已办</h5>
<div class="pull-right">
<div class="btn-group">
时间
</div>
</div>
</div>
<div class="ibox-content">
<div class="row">
<div class="col-sm-12 select-table table-striped">
<table id="bootstrap-table"></table>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<script th:src="@{/js/jquery.min.js}"></script>
<script th:src="@{/js/bootstrap.min.js}"></script>
@ -107,11 +129,6 @@
<script th:inline="javascript">
var editFlag = [[${@permission.hasPermi('system:flow:edit')}]];
var removeFlag = [[${@permission.hasPermi('system:flow:remove')}]];
var tradeTypeDatas = [[${@dict.getType('trade_type')}]];
var tradeStatusDatas = [[${@dict.getType('trade_status_type')}]];
var incomeExpenditureTypeDatas = [[${@dict.getType('income_expenditure_type')}]];
var capitalStatusDatas = [[${@dict.getType('capital_status')}]];
var billTypeDatas = [[${@dict.getType('bill_type')}]];
var prefix = ctx + "modeler";
var prefixFlow = ctx + "flow";
$(function() {

View File

@ -14,7 +14,7 @@
<label>请假名称:</label>
<input type="text" name="name"/>
</li>
<li class="select-time">
<!-- <li class="select-time">
<label>开始时间:</label>
<input type="text" class="time-input" id="startTime" placeholder="开始时间" name="params[beginStartTime]"/>
<span>-</span>
@ -25,18 +25,18 @@
<input type="text" class="time-input" id="startTime" placeholder="开始时间" name="params[beginEndTime]"/>
<span>-</span>
<input type="text" class="time-input" id="endTime" placeholder="结束时间" name="params[endEndTime]"/>
</li>
</li>-->
<li>
<label>流程实例ID</label>
<label>流程状态</label>
<select name="processStatus" th:with="type=${@dict.getType('process_status')}">
<option value="">所有</option>
<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
</select>
</li>
<li>
<!-- <li>
<label>流程实例ID</label>
<input type="text" name="processInstanceId"/>
</li>
</li>-->
<li>
<label>申请人:</label>
<input type="text" name="applyPerson"/>
@ -92,14 +92,15 @@
title: 'id',
visible: false
},
{
field: 'leaveNo',
title: '单号'
},
{
field: 'name',
title: '请假名称'
},
{
field: 'reason',
title: '请假理由'
},
/*
{
field: 'startTime',
title: '开始时间'
@ -107,7 +108,7 @@
{
field: 'endTime',
title: '结束时间'
},
},*/
{
field: 'processStatus',
title: '流程状态',
@ -115,29 +116,19 @@
return $.table.selectDictLabel(processStatusDatas, value);
}
},
{
field: 'processInstanceId',
title: '流程实例ID'
},
{
field: 'applyPerson',
title: '申请人'
},
{
field: 'remark',
title: '备注'
},
{
field: 'fileUrl',
title: '附件'
},
{
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.edit(\'' + row.id + '\')"><i class="fa fa-edit"></i>发起申请</a> ');
if(row.processStatus==0) {
actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.edit(\'' + 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.remove(\'' + row.id + '\')"><i class="fa fa-remove"></i>删除</a>');
return actions.join('');
}

View File

@ -1,7 +1,7 @@
<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
<th:block th:include="include :: header('完成任务')" />
<th:block th:include="include :: header('主管审批')" />
<th:block th:include="include :: jsonview-css" />
<th:block th:include="include :: bootstrap-fileinput-css"/>
</head>
@ -13,11 +13,16 @@
<div class="col-sm-offset-0 col-sm-10">
<button type="button" class="btn btn-sm btn-primary" onclick="submitCheckHandler()"><i class="fa fa-check"></i>通 过</button>&nbsp;
<button type="button" class="btn btn-sm btn-danger" onclick="submitHandler()"><i class="fa fa-remove"></i>驳 回</button>&nbsp;
<button type="button" class="btn btn-sm btn-danger" onclick="closeItem()"><i class="fa fa-reply-all"></i>关 闭 </button>
</div>
</div>
<br/>
<input class="form-control" type="hidden" name="taskId" th:value="*{taskId}"/>
<h4 class="form-header h4">请假信息</h4>
<div class="form-group">
<label class="col-sm-3 control-label">单号:</label>
<div class="form-control-static" th:text="${sysOaLeave.leaveNo}">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">标题:</label>
<div class="form-control-static" th:text="${sysOaLeave.name}">
@ -68,8 +73,9 @@
<script th:inline="javascript">
$(function() {
var reason = [[${sysOaLeave.reason}]];
console.log(reason);
if ($.common.isNotEmpty(reason) && reason.length < 2000) {
$("#reason").JSONView(reason);
$("#reason").text(reason);
} else {
$("#reason").text(reason);
}
@ -96,7 +102,7 @@
if ($.validate.form()) {
var data = $("#signupForm").serializeArray();
data.push({"name": "checkStatus", "value": 0});
$.operate.saveTab("/flow/finishTask", data);
$.operate.saveTab("/system/leave/managerFinishTask", data);
}
}
</script>

View File

@ -6,6 +6,18 @@
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
<form class="form-horizontal m" id="form-sequence-add">
<div class="form-group">
<label class="col-sm-3 control-label is-required">单号序列:</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">单号名称:</label>
<div class="col-sm-8">
<input name="described" class="form-control" type="text" required>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label is-required">当前值:</label>
<div class="col-sm-8">

View File

@ -6,7 +6,18 @@
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
<form class="form-horizontal m" id="form-sequence-edit" th:object="${sysSequence}">
<input name="name" th:field="*{name}" type="hidden">
<div class="form-group">
<label class="col-sm-3 control-label is-required">单号序列:</label>
<div class="col-sm-8">
<input name="name" th:field="*{name}" class="form-control" type="text" readonly>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label is-required">单号名称:</label>
<div class="col-sm-8">
<input name="describe" th:field="*{described}" class="form-control" type="text" required>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label is-required">当前值:</label>
<div class="col-sm-8">

View File

@ -63,11 +63,17 @@
columns: [{
checkbox: true
},
{
field: 'name',
title: '序列名称',
visible: false
title: '单号序列'
},
{
field: 'described',
title: '单号名称'
},
{
field: 'currentValue',
title: '当前值'

View File

@ -32,7 +32,7 @@
<!-- 通用工具-->
<dependency>
<groupId>com.snow</groupId>
<artifactId>snow-common</artifactId>
<artifactId>snow-framework</artifactId>
<version>4.3.1</version>
</dependency>

View File

@ -21,7 +21,10 @@ public class RyTask
System.out.println("执行有参方法:" + params);
}
public void ryNoParams()
/**
*
*/
public void updateSquenceValue()
{
System.out.println("执行无参方法");
}

View File

@ -0,0 +1,36 @@
package com.snow.quartz.task;
import cn.hutool.core.date.DateUtil;
import com.snow.system.domain.SysSequence;
import com.snow.system.service.impl.SysSequenceServiceImpl;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.util.List;
/**
* @program: snow
* @description 每日凌晨更新序列值
* @author: 没用的阿吉
* @create: 2020-11-24 21:27
**/
@Component("sequenceTask")
@Slf4j
public class SequenceTask {
@Autowired
private SysSequenceServiceImpl sysSequenceService;
/**
*每日凌晨更新序列值
*/
public void updateSequenceValue()
{
log.info("开始更新序列值时间:{}",DateUtil.now());
SysSequence sysSequence=new SysSequence();
List<SysSequence> sysSequences = sysSequenceService.selectSysSequenceList(sysSequence);
sysSequences.stream().forEach(t->{
t.setCurrentValue(1L);
sysSequenceService.updateSysSequence(t);
});
}
}

View File

@ -36,6 +36,7 @@ public class SysOaLeave extends BaseEntity
/** 结束时间 */
@Excel(name = "结束时间", width = 30, dateFormat = "yyyy-MM-dd")
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
private Date endTime;
/** 流程状态0--待审批1-审批中2--审批通过3--已驳回) */

View File

@ -25,6 +25,8 @@ public class SysSequence extends BaseEntity
/** 步幅 */
@Excel(name = "步幅")
private Long increment;
@Excel(name = "描述")
private String described;
public void setName(String name)
{
@ -54,6 +56,14 @@ public class SysSequence extends BaseEntity
return increment;
}
public String getDescribed() {
return described;
}
public void setDescribed(String described) {
this.described = described;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)

View File

@ -8,36 +8,40 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="name" column="name" />
<result property="currentValue" column="current_value" />
<result property="increment" column="increment" />
<result property="described" column="described" />
</resultMap>
<sql id="selectSysSequenceVo">
select name, current_value, increment from sys_sequence
select name,described, current_value, increment from sys_sequence
</sql>
<select id="selectSysSequenceList" parameterType="SysSequence" resultMap="SysSequenceResult">
<include refid="selectSysSequenceVo"/>
<where>
<where>
<if test="currentValue != null "> and current_value = #{currentValue}</if>
<if test="increment != null "> and increment = #{increment}</if>
</where>
</select>
<select id="selectSysSequenceById" parameterType="String" resultMap="SysSequenceResult">
<include refid="selectSysSequenceVo"/>
where name = #{name}
</select>
<insert id="insertSysSequence" parameterType="SysSequence">
insert into sys_sequence
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="name != null">name,</if>
<if test="currentValue != null">current_value,</if>
<if test="increment != null">increment,</if>
<if test="described != null">described,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="name != null">#{name},</if>
<if test="currentValue != null">#{currentValue},</if>
<if test="increment != null">#{increment},</if>
<if test="described != null">#{described},</if>
</trim>
</insert>
@ -46,6 +50,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<trim prefix="SET" suffixOverrides=",">
<if test="currentValue != null">current_value = #{currentValue},</if>
<if test="increment != null">increment = #{increment},</if>
<if test="described != null">described = #{described},</if>
</trim>
where name = #{name}
</update>