Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
guns-vip
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
chenjunxiong
guns-vip
Commits
3d08514e
Commit
3d08514e
authored
Dec 05, 2017
by
naan1993
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
增加审批流程管理
parent
5e6533a4
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
28 changed files
with
1278 additions
and
61 deletions
+1278
-61
guns-admin/sql/guns.sql
+0
-0
guns-admin/src/main/java/com/stylefeng/guns/common/constant/state/ExpenseState.java
+52
-0
guns-admin/src/main/java/com/stylefeng/guns/common/persistence/dao/ExpenseMapper.java
+17
-0
guns-admin/src/main/java/com/stylefeng/guns/common/persistence/dao/mapping/ExpenseMapper.xml
+20
-0
guns-admin/src/main/java/com/stylefeng/guns/common/persistence/model/Expense.java
+121
-0
guns-admin/src/main/java/com/stylefeng/guns/modular/flowable/controller/ExpenseController.java
+121
-0
guns-admin/src/main/java/com/stylefeng/guns/modular/flowable/controller/ProcessController.java
+70
-0
guns-admin/src/main/java/com/stylefeng/guns/modular/flowable/handler/BossTaskHandler.java
+16
-0
guns-admin/src/main/java/com/stylefeng/guns/modular/flowable/handler/ManagerTaskHandler.java
+1
-16
guns-admin/src/main/java/com/stylefeng/guns/modular/flowable/model/TaskVo.java
+84
-0
guns-admin/src/main/java/com/stylefeng/guns/modular/flowable/service/IExpenseService.java
+44
-0
guns-admin/src/main/java/com/stylefeng/guns/modular/flowable/service/impl/ExpenseServiceImpl.java
+130
-0
guns-admin/src/main/java/com/stylefeng/guns/modular/flowable/warpper/ExpenseWarpper.java
+26
-0
guns-admin/src/main/java/generator/config/GunsGeneratorConfig.java
+9
-9
guns-admin/src/main/resources/application.yml
+2
-2
guns-admin/src/main/resources/processes/ExpenseProcess.bpmn20.xml
+3
-3
guns-admin/src/main/webapp/WEB-INF/view/flowable/expense/expense.html
+30
-0
guns-admin/src/main/webapp/WEB-INF/view/flowable/expense/expense_add.html
+26
-0
guns-admin/src/main/webapp/WEB-INF/view/flowable/expense/expense_edit.html
+25
-0
guns-admin/src/main/webapp/WEB-INF/view/flowable/process/process.html
+27
-0
guns-admin/src/main/webapp/static/modular/flowable/expense/expense.js
+89
-0
guns-admin/src/main/webapp/static/modular/flowable/expense/expense_info.js
+96
-0
guns-admin/src/main/webapp/static/modular/flowable/process/process.js
+77
-0
guns-admin/src/main/webapp/static/modular/flowable/process/process_info.js
+96
-0
guns-admin/src/test/java/com/stylefeng/guns/flowable/FlowableTest.java
+40
-3
guns-admin/src/test/resources/ExpenseProcess.bpmn20.xml
+3
-3
guns-core/src/main/java/com/stylefeng/guns/core/support/BeanKit.java
+52
-24
guns-parent/pom.xml
+1
-1
No files found.
guns-admin/sql/guns.sql
View file @
3d08514e
This diff is collapsed.
Click to expand it.
guns-admin/src/main/java/com/stylefeng/guns/common/constant/state/ExpenseState.java
0 → 100644
View file @
3d08514e
package
com
.
stylefeng
.
guns
.
common
.
constant
.
state
;
/**
* 是否是菜单的枚举
*
* @author fengshuonan
* @date 2017年6月1日22:50:11
*/
public
enum
ExpenseState
{
SUBMITING
(
1
,
"待提交"
),
CHECKING
(
2
,
"待审核"
),
PASS
(
3
,
"审核通过"
),
UN_PASS
(
4
,
"未通过"
);
int
code
;
String
message
;
ExpenseState
(
int
code
,
String
message
)
{
this
.
code
=
code
;
this
.
message
=
message
;
}
public
int
getCode
()
{
return
code
;
}
public
void
setCode
(
int
code
)
{
this
.
code
=
code
;
}
public
String
getMessage
()
{
return
message
;
}
public
void
setMessage
(
String
message
)
{
this
.
message
=
message
;
}
public
static
String
valueOf
(
Integer
status
)
{
if
(
status
==
null
)
{
return
""
;
}
else
{
for
(
ExpenseState
s
:
ExpenseState
.
values
())
{
if
(
s
.
getCode
()
==
status
)
{
return
s
.
getMessage
();
}
}
return
""
;
}
}
}
guns-admin/src/main/java/com/stylefeng/guns/common/persistence/dao/ExpenseMapper.java
0 → 100644
View file @
3d08514e
package
com
.
stylefeng
.
guns
.
common
.
persistence
.
dao
;
import
com.baomidou.mybatisplus.mapper.BaseMapper
;
import
com.stylefeng.guns.common.persistence.model.Expense
;
/**
* <p>
* 报销表 Mapper 接口
* </p>
*
* @author stylefeng
* @since 2017-12-04
*/
public
interface
ExpenseMapper
extends
BaseMapper
<
Expense
>
{
}
\ No newline at end of file
guns-admin/src/main/java/com/stylefeng/guns/common/persistence/dao/mapping/ExpenseMapper.xml
0 → 100644
View file @
3d08514e
<?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.stylefeng.guns.common.persistence.dao.ExpenseMapper"
>
<!-- 通用查询映射结果 -->
<resultMap
id=
"BaseResultMap"
type=
"com.stylefeng.guns.common.persistence.model.Expense"
>
<id
column=
"id"
property=
"id"
/>
<result
column=
"money"
property=
"money"
/>
<result
column=
"desc"
property=
"desc"
/>
<result
column=
"createtime"
property=
"createtime"
/>
<result
column=
"state"
property=
"state"
/>
<result
column=
"userid"
property=
"userid"
/>
</resultMap>
<!-- 通用查询结果列 -->
<sql
id=
"Base_Column_List"
>
id, money, desc, createtime, state, userid
</sql>
</mapper>
guns-admin/src/main/java/com/stylefeng/guns/common/persistence/model/Expense.java
0 → 100644
View file @
3d08514e
package
com
.
stylefeng
.
guns
.
common
.
persistence
.
model
;
import
com.baomidou.mybatisplus.activerecord.Model
;
import
com.baomidou.mybatisplus.annotations.TableId
;
import
com.baomidou.mybatisplus.enums.IdType
;
import
java.io.Serializable
;
import
java.math.BigDecimal
;
import
java.util.Date
;
/**
* <p>
* 报销表
* </p>
*
* @author stylefeng
* @since 2017-12-05
*/
public
class
Expense
extends
Model
<
Expense
>
{
private
static
final
long
serialVersionUID
=
1L
;
@TableId
(
value
=
"id"
,
type
=
IdType
.
AUTO
)
private
Integer
id
;
/**
* 报销金额
*/
private
BigDecimal
money
;
/**
* 描述
*/
private
String
desc
;
private
Date
createtime
;
/**
* 状态: 1.待提交 2:待审核 3.审核通过
*/
private
Integer
state
;
/**
* 用户id
*/
private
Integer
userid
;
/**
* 流程定义id
*/
private
String
processId
;
public
Integer
getId
()
{
return
id
;
}
public
void
setId
(
Integer
id
)
{
this
.
id
=
id
;
}
public
BigDecimal
getMoney
()
{
return
money
;
}
public
void
setMoney
(
BigDecimal
money
)
{
this
.
money
=
money
;
}
public
String
getDesc
()
{
return
desc
;
}
public
void
setDesc
(
String
desc
)
{
this
.
desc
=
desc
;
}
public
Date
getCreatetime
()
{
return
createtime
;
}
public
void
setCreatetime
(
Date
createtime
)
{
this
.
createtime
=
createtime
;
}
public
Integer
getState
()
{
return
state
;
}
public
void
setState
(
Integer
state
)
{
this
.
state
=
state
;
}
public
Integer
getUserid
()
{
return
userid
;
}
public
void
setUserid
(
Integer
userid
)
{
this
.
userid
=
userid
;
}
public
String
getProcessId
()
{
return
processId
;
}
public
void
setProcessId
(
String
processId
)
{
this
.
processId
=
processId
;
}
@Override
protected
Serializable
pkVal
()
{
return
this
.
id
;
}
@Override
public
String
toString
()
{
return
"Expense{"
+
"id="
+
id
+
", money="
+
money
+
", desc="
+
desc
+
", createtime="
+
createtime
+
", state="
+
state
+
", userid="
+
userid
+
", processId="
+
processId
+
"}"
;
}
}
guns-admin/src/main/java/com/stylefeng/guns/modular/flowable/controller/ExpenseController.java
0 → 100644
View file @
3d08514e
package
com
.
stylefeng
.
guns
.
modular
.
flowable
.
controller
;
import
com.baomidou.mybatisplus.mapper.EntityWrapper
;
import
com.stylefeng.guns.common.persistence.model.Expense
;
import
com.stylefeng.guns.core.base.controller.BaseController
;
import
com.stylefeng.guns.core.log.LogObjectHolder
;
import
com.stylefeng.guns.core.shiro.ShiroKit
;
import
com.stylefeng.guns.modular.flowable.service.IExpenseService
;
import
com.stylefeng.guns.modular.flowable.warpper.ExpenseWarpper
;
import
org.flowable.engine.RuntimeService
;
import
org.flowable.engine.TaskService
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Controller
;
import
org.springframework.ui.Model
;
import
org.springframework.web.bind.annotation.PathVariable
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestParam
;
import
org.springframework.web.bind.annotation.ResponseBody
;
import
java.util.List
;
import
java.util.Map
;
/**
* 报销管理控制器
*
* @author fengshuonan
* @Date 2017-12-04 21:11:36
*/
@Controller
@RequestMapping
(
"/expense"
)
public
class
ExpenseController
extends
BaseController
{
private
String
PREFIX
=
"/flowable/expense/"
;
@Autowired
private
IExpenseService
expenseService
;
@Autowired
private
RuntimeService
runtimeService
;
@Autowired
private
TaskService
taskService
;
/**
* 跳转到报销管理首页
*/
@RequestMapping
(
""
)
public
String
index
()
{
return
PREFIX
+
"expense.html"
;
}
/**
* 跳转到添加报销管理
*/
@RequestMapping
(
"/expense_add"
)
public
String
expenseAdd
()
{
return
PREFIX
+
"expense_add.html"
;
}
/**
* 跳转到修改报销管理
*/
@RequestMapping
(
"/expense_update/{expenseId}"
)
public
String
expenseUpdate
(
@PathVariable
Integer
expenseId
,
Model
model
)
{
Expense
expense
=
expenseService
.
selectById
(
expenseId
);
model
.
addAttribute
(
"item"
,
expense
);
LogObjectHolder
.
me
().
set
(
expense
);
return
PREFIX
+
"expense_edit.html"
;
}
/**
* 获取报销管理列表
*/
@RequestMapping
(
value
=
"/list"
)
@ResponseBody
public
Object
list
(
String
condition
)
{
EntityWrapper
<
Expense
>
expenseEntityWrapper
=
new
EntityWrapper
<>();
expenseEntityWrapper
.
eq
(
"userid"
,
ShiroKit
.
getUser
().
getId
());
List
<
Map
<
String
,
Object
>>
stringObjectMap
=
expenseService
.
selectMaps
(
expenseEntityWrapper
);
return
super
.
warpObject
(
new
ExpenseWarpper
(
stringObjectMap
));
}
/**
* 新增报销管理
*/
@RequestMapping
(
value
=
"/add"
)
@ResponseBody
public
Object
add
(
Expense
expense
)
{
expenseService
.
add
(
expense
);
return
super
.
SUCCESS_TIP
;
}
/**
* 删除报销管理
*/
@RequestMapping
(
value
=
"/delete"
)
@ResponseBody
public
Object
delete
(
@RequestParam
Integer
expenseId
)
{
expenseService
.
delete
(
expenseId
);
return
SUCCESS_TIP
;
}
/**
* 修改报销管理
*/
@RequestMapping
(
value
=
"/update"
)
@ResponseBody
public
Object
update
(
Expense
expense
)
{
expenseService
.
updateById
(
expense
);
return
super
.
SUCCESS_TIP
;
}
/**
* 报销管理详情
*/
@RequestMapping
(
value
=
"/detail/{expenseId}"
)
@ResponseBody
public
Object
detail
(
@PathVariable
(
"expenseId"
)
Integer
expenseId
)
{
return
expenseService
.
selectById
(
expenseId
);
}
}
guns-admin/src/main/java/com/stylefeng/guns/modular/flowable/controller/ProcessController.java
0 → 100644
View file @
3d08514e
package
com
.
stylefeng
.
guns
.
modular
.
flowable
.
controller
;
import
com.stylefeng.guns.core.base.controller.BaseController
;
import
com.stylefeng.guns.modular.flowable.service.IExpenseService
;
import
org.flowable.engine.RuntimeService
;
import
org.flowable.engine.TaskService
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Controller
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.ResponseBody
;
/**
* 审批管理控制器
*
* @author fengshuonan
* @Date 2017-12-04 21:11:36
*/
@Controller
@RequestMapping
(
"/process"
)
public
class
ProcessController
extends
BaseController
{
private
String
PREFIX
=
"/flowable/process/"
;
@Autowired
private
IExpenseService
expenseService
;
@Autowired
private
TaskService
taskService
;
@Autowired
private
RuntimeService
runtimeService
;
/**
* 跳转到审批管理首页
*/
@RequestMapping
(
""
)
public
String
index
()
{
return
PREFIX
+
"process.html"
;
}
/**
* 获取审批管理列表
*/
@RequestMapping
(
value
=
"/list"
)
@ResponseBody
public
Object
list
(
String
condition
)
{
return
expenseService
.
getProcessList
();
}
/**
* 审核通过
*/
@RequestMapping
(
value
=
"/pass"
)
@ResponseBody
public
Object
pass
(
String
taskId
)
{
expenseService
.
pass
(
taskId
);
return
super
.
SUCCESS_TIP
;
}
/**
* 审核不通过
*/
@RequestMapping
(
value
=
"/unPass"
)
@ResponseBody
public
Object
unPass
(
String
taskId
)
{
expenseService
.
unPass
(
taskId
);
return
super
.
SUCCESS_TIP
;
}
}
guns-admin/src/main/java/com/stylefeng/guns/modular/flowable/handler/BossTaskHandler.java
0 → 100644
View file @
3d08514e
package
com
.
stylefeng
.
guns
.
modular
.
flowable
.
handler
;
import
org.flowable.engine.delegate.TaskListener
;
import
org.flowable.task.service.delegate.DelegateTask
;
/**
* 员工经理任务分配
*/
public
class
BossTaskHandler
implements
TaskListener
{
@Override
public
void
notify
(
DelegateTask
delegateTask
)
{
delegateTask
.
setAssignee
(
"老板"
);
}
}
guns-admin/src/main/java/com/stylefeng/guns/modular/flowable/handler/ManagerTaskHandler.java
View file @
3d08514e
package
com
.
stylefeng
.
guns
.
modular
.
flowable
.
handler
;
import
com.stylefeng.guns.core.shiro.ShiroKit
;
import
com.stylefeng.guns.core.shiro.ShiroUser
;
import
org.flowable.engine.delegate.TaskListener
;
import
org.flowable.task.service.delegate.DelegateTask
;
...
...
@@ -12,20 +10,7 @@ public class ManagerTaskHandler implements TaskListener {
@Override
public
void
notify
(
DelegateTask
delegateTask
)
{
/**
* 获取当前用户
*/
ShiroUser
user
=
ShiroKit
.
getUser
();
/**
* 获取当前用户的上一级领导
*/
Integer
deptId
=
user
.
getDeptId
();
/**
* 设置个人任务的办理人
*/
delegateTask
.
setAssignee
(
""
);
delegateTask
.
setAssignee
(
"经理"
);
}
}
guns-admin/src/main/java/com/stylefeng/guns/modular/flowable/model/TaskVo.java
0 → 100644
View file @
3d08514e
package
com
.
stylefeng
.
guns
.
modular
.
flowable
.
model
;
import
java.util.Date
;
/**
* 任务列表vo
*
* @author fengshuonan
* @date 2017-12-04 23:18
*/
public
class
TaskVo
{
private
String
id
;
private
String
name
;
private
Date
createTime
;
private
String
assignee
;
private
Object
money
;
private
Boolean
selfFlag
;
public
TaskVo
()
{
}
public
TaskVo
(
String
id
,
String
name
,
Date
createTime
,
String
assignee
,
Object
money
,
Boolean
flag
)
{
this
.
id
=
id
;
this
.
name
=
name
;
this
.
createTime
=
createTime
;
this
.
assignee
=
assignee
;
this
.
money
=
money
;
this
.
selfFlag
=
flag
;
}
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
getCreateTime
()
{
return
createTime
;
}
public
void
setCreateTime
(
Date
createTime
)
{
this
.
createTime
=
createTime
;
}
public
String
getAssignee
()
{
return
assignee
;
}
public
void
setAssignee
(
String
assignee
)
{
this
.
assignee
=
assignee
;
}
public
Object
getMoney
()
{
return
money
;
}
public
void
setMoney
(
Object
money
)
{
this
.
money
=
money
;
}
public
Boolean
getSelfFlag
()
{
return
selfFlag
;
}
public
void
setSelfFlag
(
Boolean
selfFlag
)
{
this
.
selfFlag
=
selfFlag
;
}
}
guns-admin/src/main/java/com/stylefeng/guns/modular/flowable/service/IExpenseService.java
0 → 100644
View file @
3d08514e
package
com
.
stylefeng
.
guns
.
modular
.
flowable
.
service
;
import
com.baomidou.mybatisplus.service.IService
;
import
com.stylefeng.guns.common.persistence.model.Expense
;
import
com.stylefeng.guns.modular.flowable.model.TaskVo
;
import
java.util.List
;
/**
* <p>
* 报销表 服务类
* </p>
*
* @author stylefeng
* @since 2017-12-04
*/
public
interface
IExpenseService
extends
IService
<
Expense
>
{
/**
* 新增一个报销单
*/
void
add
(
Expense
expense
);
/**
* 删除一个报销单
*/
void
delete
(
Integer
expenseId
);
/**
* 通过审批
*/
void
pass
(
String
taskId
);
/**
* 通过审批
*/
void
unPass
(
String
taskId
);
/**
* 获取审批列表
*/
List
<
TaskVo
>
getProcessList
();
}
guns-admin/src/main/java/com/stylefeng/guns/modular/flowable/service/impl/ExpenseServiceImpl.java
0 → 100644
View file @
3d08514e
package
com
.
stylefeng
.
guns
.
modular
.
flowable
.
service
.
impl
;
import
com.baomidou.mybatisplus.mapper.EntityWrapper
;
import
com.baomidou.mybatisplus.mapper.Wrapper
;
import
com.baomidou.mybatisplus.service.impl.ServiceImpl
;
import
com.stylefeng.guns.common.constant.state.ExpenseState
;
import
com.stylefeng.guns.common.persistence.dao.ExpenseMapper
;
import
com.stylefeng.guns.common.persistence.model.Expense
;
import
com.stylefeng.guns.core.shiro.ShiroKit
;
import
com.stylefeng.guns.modular.flowable.model.TaskVo
;
import
com.stylefeng.guns.modular.flowable.service.IExpenseService
;
import
org.flowable.engine.RuntimeService
;
import
org.flowable.engine.TaskService
;
import
org.flowable.engine.runtime.ProcessInstance
;
import
org.flowable.task.api.Task
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.List
;
/**
* <p>
* 报销表 服务实现类
* </p>
*
* @author stylefeng
* @since 2017-12-04
*/
@Service
public
class
ExpenseServiceImpl
extends
ServiceImpl
<
ExpenseMapper
,
Expense
>
implements
IExpenseService
{
@Autowired
private
RuntimeService
runtimeService
;
@Autowired
private
TaskService
taskService
;
@Override
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
void
add
(
Expense
expense
)
{
//保存业务数据
expense
.
setUserid
(
ShiroKit
.
getUser
().
getId
());
expense
.
setState
(
ExpenseState
.
SUBMITING
.
getCode
());
//启动流程
HashMap
<
String
,
Object
>
map
=
new
HashMap
<>();
map
.
put
(
"taskUser"
,
ShiroKit
.
getUser
().
getName
());
map
.
put
(
"money"
,
expense
.
getMoney
());
ProcessInstance
processInstance
=
runtimeService
.
startProcessInstanceByKey
(
"Expense"
,
map
);
expense
.
setProcessId
(
processInstance
.
getId
());
this
.
insert
(
expense
);
}
@Override
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
void
delete
(
Integer
expenseId
)
{
Expense
expense
=
this
.
selectById
(
expenseId
);
List
<
ProcessInstance
>
list
=
runtimeService
.
createProcessInstanceQuery
().
processInstanceId
(
expense
.
getProcessId
()).
list
();
for
(
ProcessInstance
processInstance
:
list
)
{
if
(
processInstance
.
getId
().
equals
(
expense
.
getProcessId
()))
{
runtimeService
.
deleteProcessInstance
(
processInstance
.
getProcessInstanceId
(),
"取消报销"
);
}
}
this
.
deleteById
(
expenseId
);
}
@Override
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
void
pass
(
String
taskId
)
{
//使用任务ID,查询任务对象,获取流程流程实例ID
Task
task
=
taskService
.
createTaskQuery
()
//
.
taskId
(
taskId
)
.
singleResult
();
//通过审核
HashMap
<
String
,
Object
>
map
=
new
HashMap
<>();
map
.
put
(
"outcome"
,
"通过"
);
taskService
.
complete
(
taskId
,
map
);
//判断流程是否结束,结束之后修改状态
ProcessInstance
pi
=
runtimeService
.
createProcessInstanceQuery
()
//
.
processInstanceId
(
task
.
getProcessInstanceId
())
//使用流程实例ID查询
.
singleResult
();
Wrapper
<
Expense
>
wrapper
=
new
EntityWrapper
<
Expense
>().
eq
(
"processId"
,
task
.
getProcessInstanceId
());
Expense
expense
=
this
.
selectOne
(
wrapper
);
//审核通过修改为通过状态
if
(
pi
==
null
)
{
expense
.
setState
(
ExpenseState
.
PASS
.
getCode
());
expense
.
updateById
();
}
else
{
//审核通过如果还有记录则为经理或boss审核中
expense
.
setState
(
ExpenseState
.
CHECKING
.
getCode
());
expense
.
updateById
();
}
}
@Override
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
void
unPass
(
String
taskId
)
{
HashMap
<
String
,
Object
>
map
=
new
HashMap
<>();
map
.
put
(
"outcome"
,
"驳回"
);
taskService
.
complete
(
taskId
,
map
);
}
@Override
public
List
<
TaskVo
>
getProcessList
()
{
String
name
=
ShiroKit
.
getUser
().
getName
();
List
<
Task
>
list
=
taskService
.
createTaskQuery
()
.
taskAssignee
(
name
)
.
orderByTaskCreateTime
().
desc
()
.
list
();
ArrayList
<
TaskVo
>
taskVos
=
new
ArrayList
<>();
for
(
Task
task
:
list
)
{
Object
money
=
runtimeService
.
getVariable
(
task
.
getExecutionId
(),
"money"
);
String
taskUser
=
(
String
)
taskService
.
getVariable
(
task
.
getId
(),
"taskUser"
);
boolean
flag
=
false
;
if
(
name
.
equals
(
taskUser
))
{
flag
=
false
;
}
else
{
flag
=
true
;
}
taskVos
.
add
(
new
TaskVo
(
task
.
getId
(),
task
.
getName
(),
task
.
getCreateTime
(),
taskUser
,
money
,
flag
));
}
return
taskVos
;
}
}
guns-admin/src/main/java/com/stylefeng/guns/modular/flowable/warpper/ExpenseWarpper.java
0 → 100644
View file @
3d08514e
package
com
.
stylefeng
.
guns
.
modular
.
flowable
.
warpper
;
import
com.stylefeng.guns.common.constant.state.ExpenseState
;
import
com.stylefeng.guns.core.base.warpper.BaseControllerWarpper
;
import
java.util.Map
;
/**
* 报销列表的包装
*
* @author fengshuonan
* @date 2017年12月4日21:56:06
*/
public
class
ExpenseWarpper
extends
BaseControllerWarpper
{
public
ExpenseWarpper
(
Object
list
)
{
super
(
list
);
}
@Override
public
void
warpTheMap
(
Map
<
String
,
Object
>
map
)
{
Integer
state
=
(
Integer
)
map
.
get
(
"state"
);
map
.
put
(
"stateName"
,
ExpenseState
.
valueOf
(
state
));
}
}
guns-admin/src/main/java/generator/config/GunsGeneratorConfig.java
View file @
3d08514e
...
...
@@ -59,18 +59,18 @@ public class GunsGeneratorConfig extends AbstractGeneratorConfig {
* mybatis-plus 生成器开关
*/
contextConfig
.
setEntitySwitch
(
true
);
contextConfig
.
setDaoSwitch
(
tru
e
);
contextConfig
.
setServiceSwitch
(
tru
e
);
contextConfig
.
setDaoSwitch
(
fals
e
);
contextConfig
.
setServiceSwitch
(
fals
e
);
/**
* guns 生成器开关
*/
contextConfig
.
setControllerSwitch
(
tru
e
);
contextConfig
.
setIndexPageSwitch
(
tru
e
);
contextConfig
.
setAddPageSwitch
(
tru
e
);
contextConfig
.
setEditPageSwitch
(
tru
e
);
contextConfig
.
setJsSwitch
(
tru
e
);
contextConfig
.
setInfoJsSwitch
(
tru
e
);
contextConfig
.
setSqlSwitch
(
tru
e
);
contextConfig
.
setControllerSwitch
(
fals
e
);
contextConfig
.
setIndexPageSwitch
(
fals
e
);
contextConfig
.
setAddPageSwitch
(
fals
e
);
contextConfig
.
setEditPageSwitch
(
fals
e
);
contextConfig
.
setJsSwitch
(
fals
e
);
contextConfig
.
setInfoJsSwitch
(
fals
e
);
contextConfig
.
setSqlSwitch
(
fals
e
);
}
}
guns-admin/src/main/resources/application.yml
View file @
3d08514e
...
...
@@ -15,7 +15,7 @@ guns:
################### 项目启动端口 ###################
server
:
port
:
80
80
port
:
80
################### beetl配置 ###################
beetl
:
...
...
@@ -61,7 +61,7 @@ mybatis-plus:
db-column-underline
:
false
refresh-mapper
:
true
configuration
:
map-underscore-to-camel-case
:
tru
e
map-underscore-to-camel-case
:
fals
e
cache-enabled
:
true
#配置的缓存的全局开关
lazyLoadingEnabled
:
true
#延时加载的开关
multipleResultSetsEnabled
:
true
#开启的话,延时加载一个属性时会加载该对象全部属性,否则按需加载属性
...
...
guns-admin/src/main/resources/processes/ExpenseProcess.bpmn20.xml
View file @
3d08514e
...
...
@@ -21,7 +21,7 @@
</userTask>
<userTask
id=
"bossTask"
name=
"老板审批"
>
<extensionElements>
<flowable:taskListener
event=
"create"
class=
"com.stylefeng.guns.modular.flowable.handler.
Manager
TaskHandler"
></flowable:taskListener>
<flowable:taskListener
event=
"create"
class=
"com.stylefeng.guns.modular.flowable.handler.
Boss
TaskHandler"
></flowable:taskListener>
</extensionElements>
</userTask>
<endEvent
id=
"end"
name=
"结束"
></endEvent>
...
...
@@ -34,7 +34,7 @@
<sequenceFlow
id=
"flow1"
sourceRef=
"start"
targetRef=
"fillTask"
></sequenceFlow>
<sequenceFlow
id=
"flow2"
sourceRef=
"fillTask"
targetRef=
"judgeTask"
></sequenceFlow>
<sequenceFlow
id=
"judgeMore"
name=
"大于500元"
sourceRef=
"judgeTask"
targetRef=
"bossTask"
>
<conditionExpression
xsi:type=
"tFormalExpression"
>
<![CDATA[${money
}>500
]]>
</conditionExpression>
<conditionExpression
xsi:type=
"tFormalExpression"
>
<![CDATA[${money
> 500}
]]>
</conditionExpression>
</sequenceFlow>
<sequenceFlow
id=
"bossPassFlow"
name=
"通过"
sourceRef=
"bossTask"
targetRef=
"end"
>
<conditionExpression
xsi:type=
"tFormalExpression"
>
<![CDATA[${outcome=='通过'}]]>
</conditionExpression>
...
...
@@ -43,7 +43,7 @@
<conditionExpression
xsi:type=
"tFormalExpression"
>
<![CDATA[${outcome=='通过'}]]>
</conditionExpression>
</sequenceFlow>
<sequenceFlow
id=
"judgeLess"
name=
"小于500元"
sourceRef=
"judgeTask"
targetRef=
"directorTak"
>
<conditionExpression
xsi:type=
"tFormalExpression"
>
<![CDATA[${money
}<=500
]]>
</conditionExpression>
<conditionExpression
xsi:type=
"tFormalExpression"
>
<![CDATA[${money
<= 500}
]]>
</conditionExpression>
</sequenceFlow>
</process>
<bpmndi:BPMNDiagram
id=
"BPMNDiagram_Expense"
>
...
...
guns-admin/src/main/webapp/WEB-INF/view/flowable/expense/expense.html
0 → 100644
View file @
3d08514e
@layout("/common/_container.html"){
<div
class=
"row"
>
<div
class=
"col-sm-12"
>
<div
class=
"ibox float-e-margins"
>
<div
class=
"ibox-title"
>
<h5>
报销管理管理
</h5>
</div>
<div
class=
"ibox-content"
>
<div
class=
"row row-lg"
>
<div
class=
"col-sm-12"
>
<div
class=
"row"
>
<div
class=
"col-sm-3"
>
<
#
NameCon
id=
"condition"
name=
"名称"
/>
</div>
<div
class=
"col-sm-3"
>
<
#
button
name=
"搜索"
icon=
"fa-search"
clickFun=
"Expense.search()"
/>
</div>
</div>
<div
class=
"hidden-xs"
id=
"ExpenseTableToolbar"
role=
"group"
>
<
#
button
name=
"新增报销单"
icon=
"fa-plus"
clickFun=
"Expense.openAddExpense()"
/>
</div>
<
#
table
id=
"ExpenseTable"
/>
</div>
</div>
</div>
</div>
</div>
</div>
<script
src=
"${ctxPath}/static/modular/flowable/expense/expense.js"
></script>
@}
guns-admin/src/main/webapp/WEB-INF/view/flowable/expense/expense_add.html
0 → 100644
View file @
3d08514e
@layout("/common/_container.html"){
<div
class=
"ibox float-e-margins"
>
<div
class=
"ibox-content"
>
<div
class=
"form-horizontal"
>
<input
type=
"hidden"
id=
"id"
value=
""
>
<div
class=
"row"
>
<div
class=
"col-sm-12"
>
<
#
input
id=
"money"
name=
"报销金额"
underline=
"true"
/>
<
#
input
id=
"desc"
name=
"描述"
/>
</div>
</div>
<div
class=
"row btn-group-m-t"
>
<div
class=
"col-sm-12"
>
<
#
button
btnCss=
"info"
name=
"提交"
id=
"ensure"
icon=
"fa-check"
clickFun=
"ExpenseInfoDlg.addSubmit()"
/>
<
#
button
btnCss=
"danger"
name=
"取消"
id=
"cancel"
icon=
"fa-eraser"
clickFun=
"ExpenseInfoDlg.close()"
/>
</div>
</div>
</div>
</div>
</div>
<script
src=
"${ctxPath}/static/modular/flowable/expense/expense_info.js"
></script>
@}
guns-admin/src/main/webapp/WEB-INF/view/flowable/expense/expense_edit.html
0 → 100644
View file @
3d08514e
@layout("/common/_container.html"){
<div
class=
"ibox float-e-margins"
>
<div
class=
"ibox-content"
>
<div
class=
"form-horizontal"
>
<input
type=
"hidden"
id=
"id"
value=
"${item.id}"
>
<div
class=
"row"
>
<div
class=
"col-sm-12"
>
<
#
input
id=
"money"
name=
"报销金额"
value=
"${item.money}"
/>
<
#
input
id=
"desc"
name=
"描述"
value=
"${item.desc}"
/>
</div>
</div>
<div
class=
"row btn-group-m-t"
>
<div
class=
"col-sm-10"
>
<
#
button
btnCss=
"info"
name=
"提交"
id=
"ensure"
icon=
"fa-check"
clickFun=
"ExpenseInfoDlg.editSubmit()"
/>
<
#
button
btnCss=
"danger"
name=
"取消"
id=
"cancel"
icon=
"fa-eraser"
clickFun=
"ExpenseInfoDlg.close()"
/>
</div>
</div>
</div>
</div>
</div>
<script
src=
"${ctxPath}/static/modular/flowable/expense/expense_info.js"
></script>
@}
guns-admin/src/main/webapp/WEB-INF/view/flowable/process/process.html
0 → 100644
View file @
3d08514e
@layout("/common/_container.html"){
<div
class=
"row"
>
<div
class=
"col-sm-12"
>
<div
class=
"ibox float-e-margins"
>
<div
class=
"ibox-title"
>
<h5>
报销管理管理
</h5>
</div>
<div
class=
"ibox-content"
>
<div
class=
"row row-lg"
>
<div
class=
"col-sm-12"
>
<div
class=
"row"
>
<div
class=
"col-sm-3"
>
<
#
NameCon
id=
"condition"
name=
"名称"
/>
</div>
<div
class=
"col-sm-3"
>
<
#
button
name=
"搜索"
icon=
"fa-search"
clickFun=
"Process.search()"
/>
</div>
</div>
<
#
table
id=
"ProcessTable"
/>
</div>
</div>
</div>
</div>
</div>
</div>
<script
src=
"${ctxPath}/static/modular/flowable/process/process.js"
></script>
@}
guns-admin/src/main/webapp/static/modular/flowable/expense/expense.js
0 → 100644
View file @
3d08514e
/**
* 报销管理管理初始化
*/
var
Expense
=
{
id
:
"ExpenseTable"
,
//表格id
seItem
:
null
,
//选中的条目
table
:
null
,
layerIndex
:
-
1
};
/**
* 初始化表格的列
*/
Expense
.
initColumn
=
function
()
{
return
[
{
field
:
'selectItem'
,
radio
:
true
},
{
title
:
'报销id'
,
field
:
'id'
,
visible
:
true
,
align
:
'center'
,
valign
:
'middle'
},
{
title
:
'报销金额'
,
field
:
'money'
,
visible
:
true
,
align
:
'center'
,
valign
:
'middle'
},
{
title
:
'描述'
,
field
:
'desc'
,
visible
:
true
,
align
:
'center'
,
valign
:
'middle'
},
{
title
:
'状态'
,
field
:
'stateName'
,
visible
:
true
,
align
:
'center'
,
valign
:
'middle'
},
{
title
:
'创建时间'
,
field
:
'createtime'
,
visible
:
true
,
align
:
'center'
,
valign
:
'middle'
},
{
title
:
'操作'
,
visible
:
true
,
align
:
'center'
,
valign
:
'middle'
,
formatter
:
function
(
value
,
row
,
index
)
{
return
'<button type="button" class="btn btn-primary button-margin" onclick="Expense.findRecord('
+
row
.
id
+
')" id=""><i class="fa fa-edit"></i> 查看</button>'
+
'<button type="button" class="btn btn-danger button-margin" onclick="Expense.deleteRecord('
+
row
.
id
+
')" id=""><i class="fa fa-arrows-alt"></i> 删除</button>'
;
}
}
];
};
/**
* 查看审核记录
*/
Expense
.
findRecord
=
function
(
id
)
{
var
index
=
layer
.
open
({
type
:
2
,
title
:
'报销管理详情'
,
area
:
[
'600px'
,
'350px'
],
//宽高
fix
:
false
,
//不固定
maxmin
:
true
,
content
:
Feng
.
ctxPath
+
'/expense/expense_update/'
+
id
});
this
.
layerIndex
=
index
;
};
/**
* 删除审核记录
*/
Expense
.
deleteRecord
=
function
(
id
)
{
var
ajax
=
new
$ax
(
Feng
.
ctxPath
+
"/expense/delete"
,
function
(
data
)
{
Feng
.
success
(
"删除成功!"
);
Expense
.
table
.
refresh
();
},
function
(
data
)
{
Feng
.
error
(
"删除失败!"
+
data
.
responseJSON
.
message
+
"!"
);
});
ajax
.
set
(
"expenseId"
,
id
);
ajax
.
start
();
};
/**
* 点击添加报销管理
*/
Expense
.
openAddExpense
=
function
()
{
var
index
=
layer
.
open
({
type
:
2
,
title
:
'添加报销管理'
,
area
:
[
'600px'
,
'350px'
],
//宽高
fix
:
false
,
//不固定
maxmin
:
true
,
content
:
Feng
.
ctxPath
+
'/expense/expense_add'
});
this
.
layerIndex
=
index
;
};
/**
* 查询报销管理列表
*/
Expense
.
search
=
function
()
{
var
queryData
=
{};
queryData
[
'condition'
]
=
$
(
"#condition"
).
val
();
Expense
.
table
.
refresh
({
query
:
queryData
});
};
$
(
function
()
{
var
defaultColunms
=
Expense
.
initColumn
();
var
table
=
new
BSTable
(
Expense
.
id
,
"/expense/list"
,
defaultColunms
);
table
.
setPaginationType
(
"client"
);
Expense
.
table
=
table
.
init
();
});
guns-admin/src/main/webapp/static/modular/flowable/expense/expense_info.js
0 → 100644
View file @
3d08514e
/**
* 初始化报销管理详情对话框
*/
var
ExpenseInfoDlg
=
{
expenseInfoData
:
{}
};
/**
* 清除数据
*/
ExpenseInfoDlg
.
clearData
=
function
()
{
this
.
expenseInfoData
=
{};
}
/**
* 设置对话框中的数据
*
* @param key 数据的名称
* @param val 数据的具体值
*/
ExpenseInfoDlg
.
set
=
function
(
key
,
val
)
{
this
.
expenseInfoData
[
key
]
=
(
typeof
val
==
"undefined"
)
?
$
(
"#"
+
key
).
val
()
:
val
;
return
this
;
}
/**
* 设置对话框中的数据
*
* @param key 数据的名称
* @param val 数据的具体值
*/
ExpenseInfoDlg
.
get
=
function
(
key
)
{
return
$
(
"#"
+
key
).
val
();
}
/**
* 关闭此对话框
*/
ExpenseInfoDlg
.
close
=
function
()
{
parent
.
layer
.
close
(
window
.
parent
.
Expense
.
layerIndex
);
}
/**
* 收集数据
*/
ExpenseInfoDlg
.
collectData
=
function
()
{
this
.
set
(
'id'
)
.
set
(
'money'
)
.
set
(
'desc'
)
;
}
/**
* 提交添加
*/
ExpenseInfoDlg
.
addSubmit
=
function
()
{
this
.
clearData
();
this
.
collectData
();
//提交信息
var
ajax
=
new
$ax
(
Feng
.
ctxPath
+
"/expense/add"
,
function
(
data
){
Feng
.
success
(
"添加成功!"
);
window
.
parent
.
Expense
.
table
.
refresh
();
ExpenseInfoDlg
.
close
();
},
function
(
data
){
Feng
.
error
(
"添加失败!"
+
data
.
responseJSON
.
message
+
"!"
);
});
ajax
.
set
(
this
.
expenseInfoData
);
ajax
.
start
();
}
/**
* 提交修改
*/
ExpenseInfoDlg
.
editSubmit
=
function
()
{
this
.
clearData
();
this
.
collectData
();
//提交信息
var
ajax
=
new
$ax
(
Feng
.
ctxPath
+
"/expense/update"
,
function
(
data
){
Feng
.
success
(
"修改成功!"
);
window
.
parent
.
Expense
.
table
.
refresh
();
ExpenseInfoDlg
.
close
();
},
function
(
data
){
Feng
.
error
(
"修改失败!"
+
data
.
responseJSON
.
message
+
"!"
);
});
ajax
.
set
(
this
.
expenseInfoData
);
ajax
.
start
();
}
$
(
function
()
{
});
guns-admin/src/main/webapp/static/modular/flowable/process/process.js
0 → 100644
View file @
3d08514e
/**
* 报销管理管理初始化
*/
var
Process
=
{
id
:
"ProcessTable"
,
//表格id
seItem
:
null
,
//选中的条目
table
:
null
,
layerIndex
:
-
1
};
/**
* 初始化表格的列
*/
Process
.
initColumn
=
function
()
{
return
[
{
field
:
'selectItem'
,
radio
:
true
},
{
title
:
'任务id'
,
field
:
'id'
,
visible
:
true
,
align
:
'center'
,
valign
:
'middle'
},
{
title
:
'名称'
,
field
:
'name'
,
visible
:
true
,
align
:
'center'
,
valign
:
'middle'
},
{
title
:
'金额'
,
field
:
'money'
,
visible
:
true
,
align
:
'center'
,
valign
:
'middle'
},
{
title
:
'创建时间'
,
field
:
'createTime'
,
visible
:
true
,
align
:
'center'
,
valign
:
'middle'
},
{
title
:
'申请人'
,
field
:
'assignee'
,
visible
:
true
,
align
:
'center'
,
valign
:
'middle'
},
{
title
:
'操作'
,
visible
:
true
,
align
:
'center'
,
valign
:
'middle'
,
formatter
:
function
(
value
,
row
,
index
)
{
if
(
row
.
selfFlag
==
true
)
{
return
'<button type="button" class="btn btn-primary button-margin" onclick="Process.pass('
+
row
.
id
+
')" id=""><i class="fa fa-edit"></i> 通过</button>'
+
'<button type="button" class="btn btn-danger button-margin" onclick="Process.unPass('
+
row
.
id
+
')" id=""><i class="fa fa-arrows-alt"></i> 不通过</button>'
;
}
else
{
return
'<button type="button" class="btn btn-primary button-margin" onclick="Process.pass('
+
row
.
id
+
')" id=""><i class="fa fa-edit"></i> 通过</button>'
;
}
}
}
];
};
/**
* 通过审核
*/
Process
.
pass
=
function
(
id
)
{
var
ajax
=
new
$ax
(
Feng
.
ctxPath
+
"/process/pass"
,
function
(
data
)
{
Feng
.
success
(
"审核成功!"
);
Process
.
table
.
refresh
();
},
function
(
data
)
{
Feng
.
error
(
"审核失败!"
+
data
.
responseJSON
.
message
+
"!"
);
});
ajax
.
set
(
"taskId"
,
id
);
ajax
.
start
();
};
/**
* 未通过审核
*/
Process
.
unPass
=
function
(
id
)
{
var
ajax
=
new
$ax
(
Feng
.
ctxPath
+
"/process/unPass"
,
function
(
data
)
{
Feng
.
success
(
"审核成功!"
);
Process
.
table
.
refresh
();
},
function
(
data
)
{
Feng
.
error
(
"审核失败!"
+
data
.
responseJSON
.
message
+
"!"
);
});
ajax
.
set
(
"taskId"
,
id
);
ajax
.
start
();
};
/**
* 查询报销管理列表
*/
Process
.
search
=
function
()
{
var
queryData
=
{};
queryData
[
'condition'
]
=
$
(
"#condition"
).
val
();
Process
.
table
.
refresh
({
query
:
queryData
});
};
$
(
function
()
{
var
defaultColunms
=
Process
.
initColumn
();
var
table
=
new
BSTable
(
Process
.
id
,
"/process/list"
,
defaultColunms
);
table
.
setPaginationType
(
"client"
);
Process
.
table
=
table
.
init
();
});
guns-admin/src/main/webapp/static/modular/flowable/process/process_info.js
0 → 100644
View file @
3d08514e
/**
* 初始化报销管理详情对话框
*/
var
ExpenseInfoDlg
=
{
expenseInfoData
:
{}
};
/**
* 清除数据
*/
ExpenseInfoDlg
.
clearData
=
function
()
{
this
.
expenseInfoData
=
{};
}
/**
* 设置对话框中的数据
*
* @param key 数据的名称
* @param val 数据的具体值
*/
ExpenseInfoDlg
.
set
=
function
(
key
,
val
)
{
this
.
expenseInfoData
[
key
]
=
(
typeof
val
==
"undefined"
)
?
$
(
"#"
+
key
).
val
()
:
val
;
return
this
;
}
/**
* 设置对话框中的数据
*
* @param key 数据的名称
* @param val 数据的具体值
*/
ExpenseInfoDlg
.
get
=
function
(
key
)
{
return
$
(
"#"
+
key
).
val
();
}
/**
* 关闭此对话框
*/
ExpenseInfoDlg
.
close
=
function
()
{
parent
.
layer
.
close
(
window
.
parent
.
Expense
.
layerIndex
);
}
/**
* 收集数据
*/
ExpenseInfoDlg
.
collectData
=
function
()
{
this
.
set
(
'id'
)
.
set
(
'money'
)
.
set
(
'desc'
)
;
}
/**
* 提交添加
*/
ExpenseInfoDlg
.
addSubmit
=
function
()
{
this
.
clearData
();
this
.
collectData
();
//提交信息
var
ajax
=
new
$ax
(
Feng
.
ctxPath
+
"/expense/add"
,
function
(
data
){
Feng
.
success
(
"添加成功!"
);
window
.
parent
.
Expense
.
table
.
refresh
();
ExpenseInfoDlg
.
close
();
},
function
(
data
){
Feng
.
error
(
"添加失败!"
+
data
.
responseJSON
.
message
+
"!"
);
});
ajax
.
set
(
this
.
expenseInfoData
);
ajax
.
start
();
}
/**
* 提交修改
*/
ExpenseInfoDlg
.
editSubmit
=
function
()
{
this
.
clearData
();
this
.
collectData
();
//提交信息
var
ajax
=
new
$ax
(
Feng
.
ctxPath
+
"/expense/update"
,
function
(
data
){
Feng
.
success
(
"修改成功!"
);
window
.
parent
.
Expense
.
table
.
refresh
();
ExpenseInfoDlg
.
close
();
},
function
(
data
){
Feng
.
error
(
"修改失败!"
+
data
.
responseJSON
.
message
+
"!"
);
});
ajax
.
set
(
this
.
expenseInfoData
);
ajax
.
start
();
}
$
(
function
()
{
});
guns-admin/src/test/java/com/stylefeng/guns/flowable/FlowableTest.java
View file @
3d08514e
package
com
.
stylefeng
.
guns
.
flowable
;
import
com.alibaba.fastjson.JSON
;
import
org.flowable.engine.*
;
import
org.flowable.engine.impl.cfg.StandaloneProcessEngineConfiguration
;
import
org.flowable.engine.repository.Deployment
;
...
...
@@ -54,6 +55,21 @@ public class FlowableTest {
}
/**
* 查看发布
*/
@Test
public
void
findDeploy
()
{
RepositoryService
repositoryService
=
processEngine
.
getRepositoryService
();
List
<
Deployment
>
list
=
repositoryService
.
createDeploymentQuery
().
list
();
for
(
Deployment
deployment
:
list
)
{
System
.
out
.
println
(
deployment
.
getCategory
());
System
.
out
.
println
(
deployment
.
getName
());
System
.
out
.
println
(
"deploy = "
+
deployment
.
getId
());
System
.
out
.
println
(
"key = "
+
deployment
.
getKey
());
}
}
/**
* 启动流程
*/
@Test
...
...
@@ -71,10 +87,18 @@ public class FlowableTest {
*/
@Test
public
void
queryProcess
()
{
List
<
ProcessInstance
>
list1
=
processEngine
.
getRuntimeService
().
createProcessInstanceQuery
().
list
();
for
(
ProcessInstance
processDefinition
:
list1
)
{
System
.
out
.
println
(
"id = "
+
processDefinition
.
getId
());
System
.
out
.
println
(
"getDeploymentId = "
+
processDefinition
.
getDeploymentId
());
System
.
out
.
println
(
"getTenantId = "
+
processDefinition
.
getTenantId
());
System
.
out
.
println
(
"name = "
+
processDefinition
.
getName
());
}
System
.
err
.
println
(
"---------------------------------"
);
List
<
ProcessDefinition
>
list
=
processEngine
.
getRepositoryService
()
.
createProcessDefinitionQuery
()
.
list
();
for
(
ProcessDefinition
processDefinition
:
list
)
{
System
.
out
.
println
(
"id = "
+
processDefinition
.
getId
());
System
.
out
.
println
(
"getDeploymentId = "
+
processDefinition
.
getDeploymentId
());
...
...
@@ -91,7 +115,8 @@ public class FlowableTest {
*/
@Test
public
void
delProcess
()
{
processEngine
.
getRepositoryService
().
deleteDeployment
(
"1"
,
true
);
processEngine
.
getRuntimeService
().
deleteProcessInstance
(
"67501"
,
"abcd"
);
//processEngine.getRepositoryService().deleteDeployment("25001", true);
System
.
out
.
println
(
"删除成功"
);
}
...
...
@@ -100,17 +125,29 @@ public class FlowableTest {
*/
@Test
public
void
queryMyTask
()
{
String
name
=
"
fsn
"
;
String
name
=
"
张三
"
;
TaskQuery
taskQuery
=
processEngine
.
getTaskService
().
createTaskQuery
().
taskAssignee
(
name
);
List
<
Task
>
list
=
taskQuery
.
list
();
for
(
Task
task
:
list
)
{
System
.
out
.
println
(
"name = "
+
task
.
getName
());
System
.
out
.
println
(
JSON
.
toJSON
(
task
.
getTaskLocalVariables
()));
}
System
.
out
.
println
(
"查询完毕!"
);
}
/**
* 完成任务
*/
@Test
public
void
complete
()
{
HashMap
<
String
,
Object
>
map
=
new
HashMap
<>();
map
.
put
(
"money"
,
600
);
TaskService
taskService
=
processEngine
.
getTaskService
();
taskService
.
complete
(
"47513"
,
map
);
}
public
static
void
main
(
String
[]
args
)
{
ProcessEngineConfiguration
cfg
=
new
StandaloneProcessEngineConfiguration
()
.
setJdbcUrl
(
"jdbc:mysql://127.0.0.1:3306/flowable?autoReconnect=true&useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull"
)
...
...
guns-admin/src/test/resources/ExpenseProcess.bpmn20.xml
View file @
3d08514e
...
...
@@ -21,7 +21,7 @@
</userTask>
<userTask
id=
"bossTask"
name=
"老板审批"
>
<extensionElements>
<flowable:taskListener
event=
"create"
class=
"com.stylefeng.guns.modular.flowable.handler.
Manager
TaskHandler"
></flowable:taskListener>
<flowable:taskListener
event=
"create"
class=
"com.stylefeng.guns.modular.flowable.handler.
Boss
TaskHandler"
></flowable:taskListener>
</extensionElements>
</userTask>
<endEvent
id=
"end"
name=
"结束"
></endEvent>
...
...
@@ -34,7 +34,7 @@
<sequenceFlow
id=
"flow1"
sourceRef=
"start"
targetRef=
"fillTask"
></sequenceFlow>
<sequenceFlow
id=
"flow2"
sourceRef=
"fillTask"
targetRef=
"judgeTask"
></sequenceFlow>
<sequenceFlow
id=
"judgeMore"
name=
"大于500元"
sourceRef=
"judgeTask"
targetRef=
"bossTask"
>
<conditionExpression
xsi:type=
"tFormalExpression"
>
<![CDATA[${money
}>500
]]>
</conditionExpression>
<conditionExpression
xsi:type=
"tFormalExpression"
>
<![CDATA[${money
> 500}
]]>
</conditionExpression>
</sequenceFlow>
<sequenceFlow
id=
"bossPassFlow"
name=
"通过"
sourceRef=
"bossTask"
targetRef=
"end"
>
<conditionExpression
xsi:type=
"tFormalExpression"
>
<![CDATA[${outcome=='通过'}]]>
</conditionExpression>
...
...
@@ -43,7 +43,7 @@
<conditionExpression
xsi:type=
"tFormalExpression"
>
<![CDATA[${outcome=='通过'}]]>
</conditionExpression>
</sequenceFlow>
<sequenceFlow
id=
"judgeLess"
name=
"小于500元"
sourceRef=
"judgeTask"
targetRef=
"directorTak"
>
<conditionExpression
xsi:type=
"tFormalExpression"
>
<![CDATA[${money
}<=500
]]>
</conditionExpression>
<conditionExpression
xsi:type=
"tFormalExpression"
>
<![CDATA[${money
<= 500}
]]>
</conditionExpression>
</sequenceFlow>
</process>
<bpmndi:BPMNDiagram
id=
"BPMNDiagram_Expense"
>
...
...
guns-core/src/main/java/com/stylefeng/guns/core/support/BeanKit.java
View file @
3d08514e
This diff is collapsed.
Click to expand it.
guns-parent/pom.xml
View file @
3d08514e
...
...
@@ -28,7 +28,7 @@
<mybatisplus-spring-boot-starter.version>
1.0.4
</mybatisplus-spring-boot-starter.version>
<shiro.version>
1.4.0
</shiro.version>
<mybatis-plus.version>
2.1.0
</mybatis-plus.version>
<fastjson.version>
1.2.
3
1
</fastjson.version>
<fastjson.version>
1.2.
4
1
</fastjson.version>
<commons.io.version>
2.5
</commons.io.version>
<velocity.version>
1.7
</velocity.version>
<kaptcha.version>
2.3.2
</kaptcha.version>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment