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
Show whitespace changes
Inline
Side-by-side
Showing
28 changed files
with
1375 additions
and
132 deletions
+1375
-132
guns-admin/sql/guns.sql
+97
-71
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
...
...
@@ -10,7 +10,7 @@ Target Server Type : MYSQL
Target Server Version : 50621
File Encoding : 65001
Date: 2017-
07-11 22:39:28
Date: 2017-
12-05 22:56:40
*/
SET
FOREIGN_KEY_CHECKS
=
0
;
...
...
@@ -29,7 +29,7 @@ CREATE TABLE `dept` (
`tips`
varchar
(
255
)
DEFAULT
NULL
COMMENT
'提示'
,
`version`
int
(
11
)
DEFAULT
NULL
COMMENT
'版本(乐观锁保留字段)'
,
PRIMARY
KEY
(
`id`
)
)
ENGINE
=
InnoDB
AUTO_INCREMENT
=
34
DEFAULT
CHARSET
=
utf8
COMMENT
=
'部门表'
;
)
ENGINE
=
InnoDB
AUTO_INCREMENT
=
28
DEFAULT
CHARSET
=
utf8
COMMENT
=
'部门表'
;
-- ----------------------------
-- Records of dept
...
...
@@ -67,6 +67,28 @@ INSERT INTO `dict` VALUES ('37', '2', '35', '冻结', null);
INSERT
INTO
`dict`
VALUES
(
'38'
,
'3'
,
'35'
,
'已删除'
,
null
);
-- ----------------------------
-- Table structure for expense
-- ----------------------------
DROP
TABLE
IF
EXISTS
`expense`
;
CREATE
TABLE
`expense`
(
`id`
int
(
11
)
NOT
NULL
AUTO_INCREMENT
,
`money`
decimal
(
20
,
2
)
DEFAULT
NULL
COMMENT
'报销金额'
,
`desc`
varchar
(
255
)
DEFAULT
''
COMMENT
'描述'
,
`createtime`
datetime
DEFAULT
CURRENT_TIMESTAMP
,
`state`
int
(
11
)
DEFAULT
NULL
COMMENT
'状态: 1.待提交 2:待审核 3.审核通过 4:驳回'
,
`userid`
int
(
11
)
DEFAULT
NULL
COMMENT
'用户id'
,
`processId`
varchar
(
255
)
DEFAULT
NULL
COMMENT
'流程定义id'
,
PRIMARY
KEY
(
`id`
)
)
ENGINE
=
InnoDB
AUTO_INCREMENT
=
23
DEFAULT
CHARSET
=
utf8
COMMENT
=
'报销表'
;
-- ----------------------------
-- Records of expense
-- ----------------------------
INSERT
INTO
`expense`
VALUES
(
'20'
,
'100.00'
,
'餐饮'
,
'2017-12-05 22:52:48'
,
'3'
,
'1'
,
'92501'
);
INSERT
INTO
`expense`
VALUES
(
'21'
,
'700.00'
,
'住宿费'
,
'2017-12-05 22:53:22'
,
'3'
,
'1'
,
'92517'
);
INSERT
INTO
`expense`
VALUES
(
'22'
,
'100.00'
,
'测试'
,
'2017-12-05 22:53:56'
,
'3'
,
'1'
,
'92533'
);
-- ----------------------------
-- Table structure for login_log
-- ----------------------------
DROP
TABLE
IF
EXISTS
`login_log`
;
...
...
@@ -79,15 +101,12 @@ CREATE TABLE `login_log` (
`message`
text
COMMENT
'具体消息'
,
`ip`
varchar
(
255
)
DEFAULT
NULL
COMMENT
'登录ip'
,
PRIMARY
KEY
(
`id`
)
)
ENGINE
=
InnoDB
AUTO_INCREMENT
=
130
DEFAULT
CHARSET
=
utf8
COMMENT
=
'登录记录'
;
)
ENGINE
=
InnoDB
AUTO_INCREMENT
=
214
DEFAULT
CHARSET
=
utf8
COMMENT
=
'登录记录'
;
-- ----------------------------
-- Records of login_log
-- ----------------------------
INSERT
INTO
`login_log`
VALUES
(
'126'
,
'退出日志'
,
'1'
,
'2017-06-04 10:21:55'
,
'成功'
,
null
,
'127.0.0.1'
);
INSERT
INTO
`login_log`
VALUES
(
'127'
,
'登录日志'
,
'1'
,
'2017-06-04 10:21:59'
,
'成功'
,
null
,
'127.0.0.1'
);
INSERT
INTO
`login_log`
VALUES
(
'128'
,
'退出日志'
,
'1'
,
'2017-06-04 10:22:59'
,
'成功'
,
null
,
'127.0.0.1'
);
INSERT
INTO
`login_log`
VALUES
(
'129'
,
'登录日志'
,
'1'
,
'2017-06-04 10:23:01'
,
'成功'
,
null
,
'127.0.0.1'
);
INSERT
INTO
`login_log`
VALUES
(
'213'
,
'退出日志'
,
'1'
,
'2017-12-05 22:56:32'
,
'成功'
,
null
,
'0:0:0:0:0:0:0:1'
);
-- ----------------------------
-- Table structure for menu
...
...
@@ -108,7 +127,7 @@ CREATE TABLE `menu` (
`status`
int
(
65
)
DEFAULT
NULL
COMMENT
'菜单状态 : 1:启用 0:不启用'
,
`isopen`
int
(
11
)
DEFAULT
NULL
COMMENT
'是否打开: 1:打开 0:不打开'
,
PRIMARY
KEY
(
`id`
)
)
ENGINE
=
InnoDB
AUTO_INCREMENT
=
1
68
DEFAULT
CHARSET
=
utf8
COMMENT
=
'菜单表'
;
)
ENGINE
=
InnoDB
AUTO_INCREMENT
=
1
71
DEFAULT
CHARSET
=
utf8
COMMENT
=
'菜单表'
;
-- ----------------------------
-- Records of menu
...
...
@@ -168,6 +187,9 @@ INSERT INTO `menu` VALUES ('164', 'role_list', 'role', '[0],[system],[role],', '
INSERT
INTO
`menu`
VALUES
(
'165'
,
'to_assign_role'
,
'mgr'
,
'[0],[system],[mgr],'
,
'分配角色跳转'
,
''
,
'/mgr/role_assign'
,
'8'
,
'3'
,
'0'
,
null
,
'1'
,
null
);
INSERT
INTO
`menu`
VALUES
(
'166'
,
'to_user_edit'
,
'mgr'
,
'[0],[system],[mgr],'
,
'编辑用户跳转'
,
''
,
'/mgr/user_edit'
,
'9'
,
'3'
,
'0'
,
null
,
'1'
,
null
);
INSERT
INTO
`menu`
VALUES
(
'167'
,
'mgr_list'
,
'mgr'
,
'[0],[system],[mgr],'
,
'用户列表'
,
''
,
'/mgr/list'
,
'10'
,
'3'
,
'0'
,
null
,
'1'
,
null
);
INSERT
INTO
`menu`
VALUES
(
'168'
,
'expense'
,
'0'
,
'[0],'
,
'报销管理'
,
'fa-clone'
,
'#'
,
'4'
,
'1'
,
'1'
,
null
,
'1'
,
null
);
INSERT
INTO
`menu`
VALUES
(
'169'
,
'expense_fill'
,
'expense'
,
'[0],[expense],'
,
'报销申请'
,
''
,
'/expense'
,
'1'
,
'2'
,
'1'
,
null
,
'1'
,
null
);
INSERT
INTO
`menu`
VALUES
(
'170'
,
'expense_progress'
,
'expense'
,
'[0],[expense],'
,
'报销审批'
,
''
,
'/process'
,
'2'
,
'2'
,
'1'
,
null
,
'1'
,
null
);
-- ----------------------------
-- Table structure for notice
...
...
@@ -181,7 +203,7 @@ CREATE TABLE `notice` (
`createtime`
datetime
DEFAULT
NULL
COMMENT
'创建时间'
,
`creater`
int
(
11
)
DEFAULT
NULL
COMMENT
'创建人'
,
PRIMARY
KEY
(
`id`
)
)
ENGINE
=
InnoDB
AUTO_INCREMENT
=
11
DEFAULT
CHARSET
=
utf8
COMMENT
=
'通知表'
;
)
ENGINE
=
InnoDB
AUTO_INCREMENT
=
9
DEFAULT
CHARSET
=
utf8
COMMENT
=
'通知表'
;
-- ----------------------------
-- Records of notice
...
...
@@ -204,14 +226,13 @@ CREATE TABLE `operation_log` (
`succeed`
varchar
(
255
)
DEFAULT
NULL
COMMENT
'是否成功'
,
`message`
text
COMMENT
'备注'
,
PRIMARY
KEY
(
`id`
)
)
ENGINE
=
InnoDB
AUTO_INCREMENT
=
483
DEFAULT
CHARSET
=
utf8
COMMENT
=
'操作日志'
;
)
ENGINE
=
InnoDB
AUTO_INCREMENT
=
540
DEFAULT
CHARSET
=
utf8
COMMENT
=
'操作日志'
;
-- ----------------------------
-- Records of operation_log
-- ----------------------------
INSERT
INTO
`operation_log`
VALUES
(
'480'
,
'业务日志'
,
'清空业务日志'
,
'1'
,
'com.stylefeng.guns.modular.system.controller.LogController'
,
'delLog'
,
'2017-06-03 23:04:22'
,
'成功'
,
'主键id=null'
);
INSERT
INTO
`operation_log`
VALUES
(
'481'
,
'业务日志'
,
'清空登录日志'
,
'1'
,
'com.stylefeng.guns.modular.system.controller.LoginLogController'
,
'delLog'
,
'2017-06-03 23:04:25'
,
'成功'
,
'主键id=null'
);
INSERT
INTO
`operation_log`
VALUES
(
'482'
,
'业务日志'
,
'修改菜单'
,
'1'
,
'com.stylefeng.guns.modular.system.controller.MenuController'
,
'edit'
,
'2017-06-04 10:22:58'
,
'成功'
,
'菜单名称=分配角色跳转;;;字段名称:url地址,旧值:/role/role_assign,新值:/mgr/role_assign'
);
INSERT
INTO
`operation_log`
VALUES
(
'538'
,
'业务日志'
,
'清空业务日志'
,
'1'
,
'com.stylefeng.guns.modular.system.controller.LogController'
,
'delLog'
,
'2017-12-05 22:56:25'
,
'成功'
,
'主键id=null'
);
INSERT
INTO
`operation_log`
VALUES
(
'539'
,
'业务日志'
,
'清空登录日志'
,
'1'
,
'com.stylefeng.guns.modular.system.controller.LoginLogController'
,
'delLog'
,
'2017-12-05 22:56:28'
,
'成功'
,
'主键id=null'
);
-- ----------------------------
-- Table structure for relation
...
...
@@ -222,7 +243,7 @@ CREATE TABLE `relation` (
`menuid`
int
(
11
)
DEFAULT
NULL
COMMENT
'菜单id'
,
`roleid`
int
(
11
)
DEFAULT
NULL
COMMENT
'角色id'
,
PRIMARY
KEY
(
`id`
)
)
ENGINE
=
InnoDB
AUTO_INCREMENT
=
3
679
DEFAULT
CHARSET
=
utf8
COMMENT
=
'角色和菜单关联表'
;
)
ENGINE
=
InnoDB
AUTO_INCREMENT
=
3
737
DEFAULT
CHARSET
=
utf8
COMMENT
=
'角色和菜单关联表'
;
-- ----------------------------
-- Records of relation
...
...
@@ -247,61 +268,64 @@ INSERT INTO `relation` VALUES ('3393', '121', '5');
INSERT
INTO
`relation`
VALUES
(
'3394'
,
'122'
,
'5'
);
INSERT
INTO
`relation`
VALUES
(
'3395'
,
'150'
,
'5'
);
INSERT
INTO
`relation`
VALUES
(
'3396'
,
'151'
,
'5'
);
INSERT
INTO
`relation`
VALUES
(
'3624'
,
'105'
,
'1'
);
INSERT
INTO
`relation`
VALUES
(
'3625'
,
'106'
,
'1'
);
INSERT
INTO
`relation`
VALUES
(
'3626'
,
'107'
,
'1'
);
INSERT
INTO
`relation`
VALUES
(
'3627'
,
'108'
,
'1'
);
INSERT
INTO
`relation`
VALUES
(
'3628'
,
'109'
,
'1'
);
INSERT
INTO
`relation`
VALUES
(
'3629'
,
'110'
,
'1'
);
INSERT
INTO
`relation`
VALUES
(
'3630'
,
'111'
,
'1'
);
INSERT
INTO
`relation`
VALUES
(
'3631'
,
'112'
,
'1'
);
INSERT
INTO
`relation`
VALUES
(
'3632'
,
'113'
,
'1'
);
INSERT
INTO
`relation`
VALUES
(
'3633'
,
'165'
,
'1'
);
INSERT
INTO
`relation`
VALUES
(
'3634'
,
'166'
,
'1'
);
INSERT
INTO
`relation`
VALUES
(
'3635'
,
'167'
,
'1'
);
INSERT
INTO
`relation`
VALUES
(
'3636'
,
'114'
,
'1'
);
INSERT
INTO
`relation`
VALUES
(
'3637'
,
'115'
,
'1'
);
INSERT
INTO
`relation`
VALUES
(
'3638'
,
'116'
,
'1'
);
INSERT
INTO
`relation`
VALUES
(
'3639'
,
'117'
,
'1'
);
INSERT
INTO
`relation`
VALUES
(
'3640'
,
'118'
,
'1'
);
INSERT
INTO
`relation`
VALUES
(
'3641'
,
'162'
,
'1'
);
INSERT
INTO
`relation`
VALUES
(
'3642'
,
'163'
,
'1'
);
INSERT
INTO
`relation`
VALUES
(
'3643'
,
'164'
,
'1'
);
INSERT
INTO
`relation`
VALUES
(
'3644'
,
'119'
,
'1'
);
INSERT
INTO
`relation`
VALUES
(
'3645'
,
'120'
,
'1'
);
INSERT
INTO
`relation`
VALUES
(
'3646'
,
'121'
,
'1'
);
INSERT
INTO
`relation`
VALUES
(
'3647'
,
'122'
,
'1'
);
INSERT
INTO
`relation`
VALUES
(
'3648'
,
'150'
,
'1'
);
INSERT
INTO
`relation`
VALUES
(
'3649'
,
'151'
,
'1'
);
INSERT
INTO
`relation`
VALUES
(
'3650'
,
'128'
,
'1'
);
INSERT
INTO
`relation`
VALUES
(
'3651'
,
'134'
,
'1'
);
INSERT
INTO
`relation`
VALUES
(
'3652'
,
'158'
,
'1'
);
INSERT
INTO
`relation`
VALUES
(
'3653'
,
'159'
,
'1'
);
INSERT
INTO
`relation`
VALUES
(
'3654'
,
'130'
,
'1'
);
INSERT
INTO
`relation`
VALUES
(
'3655'
,
'131'
,
'1'
);
INSERT
INTO
`relation`
VALUES
(
'3656'
,
'135'
,
'1'
);
INSERT
INTO
`relation`
VALUES
(
'3657'
,
'136'
,
'1'
);
INSERT
INTO
`relation`
VALUES
(
'3658'
,
'137'
,
'1'
);
INSERT
INTO
`relation`
VALUES
(
'3659'
,
'152'
,
'1'
);
INSERT
INTO
`relation`
VALUES
(
'3660'
,
'153'
,
'1'
);
INSERT
INTO
`relation`
VALUES
(
'3661'
,
'154'
,
'1'
);
INSERT
INTO
`relation`
VALUES
(
'3662'
,
'132'
,
'1'
);
INSERT
INTO
`relation`
VALUES
(
'3663'
,
'138'
,
'1'
);
INSERT
INTO
`relation`
VALUES
(
'3664'
,
'139'
,
'1'
);
INSERT
INTO
`relation`
VALUES
(
'3665'
,
'140'
,
'1'
);
INSERT
INTO
`relation`
VALUES
(
'3666'
,
'155'
,
'1'
);
INSERT
INTO
`relation`
VALUES
(
'3667'
,
'156'
,
'1'
);
INSERT
INTO
`relation`
VALUES
(
'3668'
,
'157'
,
'1'
);
INSERT
INTO
`relation`
VALUES
(
'3669'
,
'133'
,
'1'
);
INSERT
INTO
`relation`
VALUES
(
'3670'
,
'160'
,
'1'
);
INSERT
INTO
`relation`
VALUES
(
'3671'
,
'161'
,
'1'
);
INSERT
INTO
`relation`
VALUES
(
'3672'
,
'141'
,
'1'
);
INSERT
INTO
`relation`
VALUES
(
'3673'
,
'142'
,
'1'
);
INSERT
INTO
`relation`
VALUES
(
'3674'
,
'143'
,
'1'
);
INSERT
INTO
`relation`
VALUES
(
'3675'
,
'144'
,
'1'
);
INSERT
INTO
`relation`
VALUES
(
'3676'
,
'148'
,
'1'
);
INSERT
INTO
`relation`
VALUES
(
'3677'
,
'145'
,
'1'
);
INSERT
INTO
`relation`
VALUES
(
'3678'
,
'149'
,
'1'
);
INSERT
INTO
`relation`
VALUES
(
'3679'
,
'105'
,
'1'
);
INSERT
INTO
`relation`
VALUES
(
'3680'
,
'106'
,
'1'
);
INSERT
INTO
`relation`
VALUES
(
'3681'
,
'107'
,
'1'
);
INSERT
INTO
`relation`
VALUES
(
'3682'
,
'108'
,
'1'
);
INSERT
INTO
`relation`
VALUES
(
'3683'
,
'109'
,
'1'
);
INSERT
INTO
`relation`
VALUES
(
'3684'
,
'110'
,
'1'
);
INSERT
INTO
`relation`
VALUES
(
'3685'
,
'111'
,
'1'
);
INSERT
INTO
`relation`
VALUES
(
'3686'
,
'112'
,
'1'
);
INSERT
INTO
`relation`
VALUES
(
'3687'
,
'113'
,
'1'
);
INSERT
INTO
`relation`
VALUES
(
'3688'
,
'165'
,
'1'
);
INSERT
INTO
`relation`
VALUES
(
'3689'
,
'166'
,
'1'
);
INSERT
INTO
`relation`
VALUES
(
'3690'
,
'167'
,
'1'
);
INSERT
INTO
`relation`
VALUES
(
'3691'
,
'114'
,
'1'
);
INSERT
INTO
`relation`
VALUES
(
'3692'
,
'115'
,
'1'
);
INSERT
INTO
`relation`
VALUES
(
'3693'
,
'116'
,
'1'
);
INSERT
INTO
`relation`
VALUES
(
'3694'
,
'117'
,
'1'
);
INSERT
INTO
`relation`
VALUES
(
'3695'
,
'118'
,
'1'
);
INSERT
INTO
`relation`
VALUES
(
'3696'
,
'162'
,
'1'
);
INSERT
INTO
`relation`
VALUES
(
'3697'
,
'163'
,
'1'
);
INSERT
INTO
`relation`
VALUES
(
'3698'
,
'164'
,
'1'
);
INSERT
INTO
`relation`
VALUES
(
'3699'
,
'119'
,
'1'
);
INSERT
INTO
`relation`
VALUES
(
'3700'
,
'120'
,
'1'
);
INSERT
INTO
`relation`
VALUES
(
'3701'
,
'121'
,
'1'
);
INSERT
INTO
`relation`
VALUES
(
'3702'
,
'122'
,
'1'
);
INSERT
INTO
`relation`
VALUES
(
'3703'
,
'150'
,
'1'
);
INSERT
INTO
`relation`
VALUES
(
'3704'
,
'151'
,
'1'
);
INSERT
INTO
`relation`
VALUES
(
'3705'
,
'128'
,
'1'
);
INSERT
INTO
`relation`
VALUES
(
'3706'
,
'134'
,
'1'
);
INSERT
INTO
`relation`
VALUES
(
'3707'
,
'158'
,
'1'
);
INSERT
INTO
`relation`
VALUES
(
'3708'
,
'159'
,
'1'
);
INSERT
INTO
`relation`
VALUES
(
'3709'
,
'130'
,
'1'
);
INSERT
INTO
`relation`
VALUES
(
'3710'
,
'131'
,
'1'
);
INSERT
INTO
`relation`
VALUES
(
'3711'
,
'135'
,
'1'
);
INSERT
INTO
`relation`
VALUES
(
'3712'
,
'136'
,
'1'
);
INSERT
INTO
`relation`
VALUES
(
'3713'
,
'137'
,
'1'
);
INSERT
INTO
`relation`
VALUES
(
'3714'
,
'152'
,
'1'
);
INSERT
INTO
`relation`
VALUES
(
'3715'
,
'153'
,
'1'
);
INSERT
INTO
`relation`
VALUES
(
'3716'
,
'154'
,
'1'
);
INSERT
INTO
`relation`
VALUES
(
'3717'
,
'132'
,
'1'
);
INSERT
INTO
`relation`
VALUES
(
'3718'
,
'138'
,
'1'
);
INSERT
INTO
`relation`
VALUES
(
'3719'
,
'139'
,
'1'
);
INSERT
INTO
`relation`
VALUES
(
'3720'
,
'140'
,
'1'
);
INSERT
INTO
`relation`
VALUES
(
'3721'
,
'155'
,
'1'
);
INSERT
INTO
`relation`
VALUES
(
'3722'
,
'156'
,
'1'
);
INSERT
INTO
`relation`
VALUES
(
'3723'
,
'157'
,
'1'
);
INSERT
INTO
`relation`
VALUES
(
'3724'
,
'133'
,
'1'
);
INSERT
INTO
`relation`
VALUES
(
'3725'
,
'160'
,
'1'
);
INSERT
INTO
`relation`
VALUES
(
'3726'
,
'161'
,
'1'
);
INSERT
INTO
`relation`
VALUES
(
'3727'
,
'141'
,
'1'
);
INSERT
INTO
`relation`
VALUES
(
'3728'
,
'142'
,
'1'
);
INSERT
INTO
`relation`
VALUES
(
'3729'
,
'143'
,
'1'
);
INSERT
INTO
`relation`
VALUES
(
'3730'
,
'144'
,
'1'
);
INSERT
INTO
`relation`
VALUES
(
'3731'
,
'148'
,
'1'
);
INSERT
INTO
`relation`
VALUES
(
'3732'
,
'145'
,
'1'
);
INSERT
INTO
`relation`
VALUES
(
'3733'
,
'149'
,
'1'
);
INSERT
INTO
`relation`
VALUES
(
'3734'
,
'168'
,
'1'
);
INSERT
INTO
`relation`
VALUES
(
'3735'
,
'169'
,
'1'
);
INSERT
INTO
`relation`
VALUES
(
'3736'
,
'170'
,
'1'
);
-- ----------------------------
-- Table structure for role
...
...
@@ -360,10 +384,12 @@ CREATE TABLE `user` (
`createtime`
datetime
DEFAULT
NULL
COMMENT
'创建时间'
,
`version`
int
(
11
)
DEFAULT
NULL
COMMENT
'保留字段'
,
PRIMARY
KEY
(
`id`
)
)
ENGINE
=
InnoDB
AUTO_INCREMENT
=
4
5
DEFAULT
CHARSET
=
utf8
COMMENT
=
'管理员表'
;
)
ENGINE
=
InnoDB
AUTO_INCREMENT
=
4
7
DEFAULT
CHARSET
=
utf8
COMMENT
=
'管理员表'
;
-- ----------------------------
-- Records of user
-- ----------------------------
INSERT
INTO
`user`
VALUES
(
'1'
,
'girl.gif'
,
'admin'
,
'ecfadcde9305f8891bcfe5a1e28c253e'
,
'8pgby'
,
'张三'
,
'2017-05-05 00:00:00'
,
'2'
,
'sn93@qq.com'
,
'18200000000'
,
'1'
,
'27'
,
'1'
,
'2016-01-29 08:49:53'
,
'25'
);
INSERT
INTO
`user`
VALUES
(
'44'
,
null
,
'test'
,
'45abb7879f6a8268f1ef600e6038ac73'
,
'ssts3'
,
'test'
,
'2017-05-01 00:00:00'
,
'1'
,
'abc@123.com'
,
''
,
'5'
,
'26'
,
'1'
,
'2017-05-16 20:33:37'
,
null
);
INSERT
INTO
`user`
VALUES
(
'44'
,
null
,
'test'
,
'45abb7879f6a8268f1ef600e6038ac73'
,
'ssts3'
,
'test'
,
'2017-05-01 00:00:00'
,
'1'
,
'abc@123.com'
,
''
,
'5'
,
'26'
,
'3'
,
'2017-05-16 20:33:37'
,
null
);
INSERT
INTO
`user`
VALUES
(
'45'
,
null
,
'boss'
,
'71887a5ad666a18f709e1d4e693d5a35'
,
'1f7bf'
,
'老板'
,
'2017-12-04 00:00:00'
,
'1'
,
''
,
''
,
'1'
,
'24'
,
'1'
,
'2017-12-04 22:24:02'
,
null
);
INSERT
INTO
`user`
VALUES
(
'46'
,
null
,
'manager'
,
'b53cac62e7175637d4beb3b16b2f7915'
,
'j3cs9'
,
'经理'
,
'2017-12-04 00:00:00'
,
'1'
,
''
,
''
,
'1'
,
'24'
,
'1'
,
'2017-12-04 22:24:24'
,
null
);
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
...
...
@@ -5,28 +5,27 @@ import com.stylefeng.guns.core.util.Convert;
import
java.beans.*
;
import
java.lang.reflect.Method
;
import
java.util.HashMap
;
import
java.util.HashSet
;
import
java.util.Map
;
import
java.util.*
;
import
java.util.Map.Entry
;
/**
* Bean工具类
* @author Looly
*
* @author Looly
*/
public
class
BeanKit
{
/**
* 判断是否为Bean对象
*
* @param clazz 待测试类
* @return 是否为Bean对象
*/
public
static
boolean
isBean
(
Class
<?>
clazz
)
{
if
(
ClassKit
.
isNormalClass
(
clazz
))
{
public
static
boolean
isBean
(
Class
<?>
clazz
)
{
if
(
ClassKit
.
isNormalClass
(
clazz
))
{
Method
[]
methods
=
clazz
.
getMethods
();
for
(
Method
method
:
methods
)
{
if
(
method
.
getParameterTypes
().
length
==
1
&&
method
.
getName
().
startsWith
(
"set"
))
{
if
(
method
.
getParameterTypes
().
length
==
1
&&
method
.
getName
().
startsWith
(
"set"
))
{
//检测包含标准的setXXX方法即视为标准的JavaBean
return
true
;
}
...
...
@@ -35,7 +34,7 @@ public class BeanKit {
return
false
;
}
public
static
PropertyEditor
findEditor
(
Class
<?>
type
)
{
public
static
PropertyEditor
findEditor
(
Class
<?>
type
)
{
return
PropertyEditorManager
.
findEditor
(
type
);
}
...
...
@@ -52,11 +51,12 @@ public class BeanKit {
/**
* 获得字段名和字段描述Map
*
* @param clazz Bean类
* @return 字段名和字段描述Map
* @throws IntrospectionException
*/
public
static
Map
<
String
,
PropertyDescriptor
>
getFieldNamePropertyDescriptorMap
(
Class
<?>
clazz
)
throws
IntrospectionException
{
public
static
Map
<
String
,
PropertyDescriptor
>
getFieldNamePropertyDescriptorMap
(
Class
<?>
clazz
)
throws
IntrospectionException
{
final
PropertyDescriptor
[]
propertyDescriptors
=
getPropertyDescriptors
(
clazz
);
Map
<
String
,
PropertyDescriptor
>
map
=
new
HashMap
<>();
for
(
PropertyDescriptor
propertyDescriptor
:
propertyDescriptors
)
{
...
...
@@ -114,7 +114,7 @@ public class BeanKit {
* @return Bean
*/
public
static
<
T
>
T
fillBeanWithMap
(
final
Map
<?,
?>
map
,
T
bean
)
{
return
fillBean
(
bean
,
new
ValueProvider
()
{
return
fillBean
(
bean
,
new
ValueProvider
()
{
@Override
public
Object
value
(
String
name
)
{
return
map
.
get
(
name
);
...
...
@@ -131,7 +131,7 @@ public class BeanKit {
* @return Bean
*/
public
static
<
T
>
T
fillBeanWithMap
(
Map
<?,
?>
map
,
T
bean
,
boolean
isToCamelCase
)
{
if
(
isToCamelCase
)
{
if
(
isToCamelCase
)
{
final
Map
<
Object
,
Object
>
map2
=
new
HashMap
<
Object
,
Object
>();
for
(
Entry
<?,
?>
entry
:
map
.
entrySet
())
{
final
Object
key
=
entry
.
getKey
();
...
...
@@ -167,7 +167,7 @@ public class BeanKit {
}
}
return
fillBean
(
bean
,
new
ValueProvider
()
{
return
fillBean
(
bean
,
new
ValueProvider
()
{
@Override
public
Object
value
(
String
name
)
{
return
map2
.
get
(
name
.
toLowerCase
());
...
...
@@ -195,7 +195,7 @@ public class BeanKit {
*/
public
static
<
T
>
T
fillBeanWithRequestParam
(
final
javax
.
servlet
.
ServletRequest
request
,
T
bean
)
{
final
String
beanName
=
StrKit
.
lowerFirst
(
bean
.
getClass
().
getSimpleName
());
return
fillBean
(
bean
,
new
ValueProvider
()
{
return
fillBean
(
bean
,
new
ValueProvider
()
{
@Override
public
Object
value
(
String
name
)
{
String
value
=
request
.
getParameter
(
name
);
...
...
@@ -274,6 +274,20 @@ public class BeanKit {
* 对象转Map
*
* @param bean bean对象
* @return Map
*/
public
static
<
T
>
List
<
Map
<
String
,
Object
>>
listToMapList
(
List
<
T
>
bean
)
{
ArrayList
<
Map
<
String
,
Object
>>
maps
=
new
ArrayList
<>();
for
(
T
t
:
bean
)
{
maps
.
add
(
beanToMap
(
bean
,
false
));
}
return
maps
;
}
/**
* 对象转Map
*
* @param bean bean对象
* @param isToUnderlineCase 是否转换为下划线模式
* @return Map
*/
...
...
@@ -305,6 +319,7 @@ public class BeanKit {
/**
* 复制Bean对象属性
*
* @param source 源Bean对象
* @param target 目标Bean对象
*/
...
...
@@ -315,6 +330,7 @@ public class BeanKit {
/**
* 复制Bean对象属性<br>
* 限制类用于限制拷贝的属性,例如一个类我只想复制其父类的一些属性,就可以将editable设置为父类
*
* @param source 源Bean对象
* @param target 目标Bean对象
* @param ignoreProperties 不拷贝的的属性列表
...
...
@@ -326,12 +342,13 @@ public class BeanKit {
/**
* 复制Bean对象属性<br>
* 限制类用于限制拷贝的属性,例如一个类我只想复制其父类的一些属性,就可以将editable设置为父类
*
* @param source 源Bean对象
* @param target 目标Bean对象
* @param copyOptions 拷贝选项,见 {@link CopyOptions}
*/
public
static
void
copyProperties
(
Object
source
,
Object
target
,
CopyOptions
copyOptions
)
{
if
(
null
==
copyOptions
)
{
if
(
null
==
copyOptions
)
{
copyOptions
=
new
CopyOptions
();
}
...
...
@@ -363,7 +380,7 @@ public class BeanKit {
if
(
readMethod
!=
null
&&
ClassKit
.
isAssignable
(
writeMethod
.
getParameterTypes
()[
0
],
readMethod
.
getReturnType
()))
{
try
{
Object
value
=
ClassKit
.
setAccessible
(
readMethod
).
invoke
(
source
);
if
(
null
!=
value
||
false
==
copyOptions
.
isIgnoreNullValue
)
{
if
(
null
!=
value
||
false
==
copyOptions
.
isIgnoreNullValue
)
{
ClassKit
.
setAccessible
(
writeMethod
).
invoke
(
target
,
value
);
}
}
catch
(
Throwable
ex
)
{
...
...
@@ -381,7 +398,6 @@ public class BeanKit {
* 在Bean注入过程中,Bean获得字段名,通过外部方式根据这个字段名查找相应的字段值,然后注入Bean<br>
*
* @author Looly
*
*/
public
static
interface
ValueProvider
{
/**
...
...
@@ -403,29 +419,37 @@ public class BeanKit {
* @author Looly
*/
public
static
class
CopyOptions
{
/** 限制的类或接口,必须为目标对象的实现接口或父类,用于限制拷贝的属性,例如一个类我只想复制其父类的一些属性,就可以将editable设置为父类 */
/**
* 限制的类或接口,必须为目标对象的实现接口或父类,用于限制拷贝的属性,例如一个类我只想复制其父类的一些属性,就可以将editable设置为父类
*/
private
Class
<?>
editable
;
/** 是否忽略空值,当源对象的值为null时,true: 忽略而不注入此值,false: 注入null */
/**
* 是否忽略空值,当源对象的值为null时,true: 忽略而不注入此值,false: 注入null
*/
private
boolean
isIgnoreNullValue
;
/** 忽略的属性列表,设置一个属性列表,不拷贝这些属性值 */
/**
* 忽略的属性列表,设置一个属性列表,不拷贝这些属性值
*/
private
String
[]
ignoreProperties
;
/**
* 创建拷贝选项
*
* @return 拷贝选项
*/
public
static
CopyOptions
create
()
{
public
static
CopyOptions
create
()
{
return
new
CopyOptions
();
}
/**
* 创建拷贝选项
*
* @param editable 限制的类或接口,必须为目标对象的实现接口或父类,用于限制拷贝的属性
* @param isIgnoreNullValue 是否忽略空值,当源对象的值为null时,true: 忽略而不注入此值,false: 注入null
* @param ignoreProperties 忽略的属性列表,设置一个属性列表,不拷贝这些属性值
* @return 拷贝选项
*/
public
static
CopyOptions
create
(
Class
<?>
editable
,
boolean
isIgnoreNullValue
,
String
...
ignoreProperties
)
{
public
static
CopyOptions
create
(
Class
<?>
editable
,
boolean
isIgnoreNullValue
,
String
...
ignoreProperties
)
{
return
new
CopyOptions
(
editable
,
isIgnoreNullValue
,
ignoreProperties
);
}
...
...
@@ -437,6 +461,7 @@ public class BeanKit {
/**
* 构造拷贝选项
*
* @param editable 限制的类或接口,必须为目标对象的实现接口或父类,用于限制拷贝的属性
* @param isIgnoreNullValue 是否忽略空值,当源对象的值为null时,true: 忽略而不注入此值,false: 注入null
* @param ignoreProperties 忽略的属性列表,设置一个属性列表,不拷贝这些属性值
...
...
@@ -449,30 +474,33 @@ public class BeanKit {
/**
* 设置限制的类或接口,必须为目标对象的实现接口或父类,用于限制拷贝的属性
*
* @param editable 限制的类或接口
* @return CopyOptions
*/
public
CopyOptions
setEditable
(
Class
<?>
editable
)
{
public
CopyOptions
setEditable
(
Class
<?>
editable
)
{
this
.
editable
=
editable
;
return
this
;
}
/**
* 设置是否忽略空值,当源对象的值为null时,true: 忽略而不注入此值,false: 注入null
*
* @param isIgnoreNullVall 是否忽略空值,当源对象的值为null时,true: 忽略而不注入此值,false: 注入null
* @return CopyOptions
*/
public
CopyOptions
setIgnoreNullValue
(
boolean
isIgnoreNullVall
)
{
public
CopyOptions
setIgnoreNullValue
(
boolean
isIgnoreNullVall
)
{
this
.
isIgnoreNullValue
=
isIgnoreNullVall
;
return
this
;
}
/**
* 设置忽略的属性列表,设置一个属性列表,不拷贝这些属性值
*
* @param ignoreProperties 忽略的属性列表,设置一个属性列表,不拷贝这些属性值
* @return CopyOptions
*/
public
CopyOptions
setIgnoreProperties
(
String
...
ignoreProperties
)
{
public
CopyOptions
setIgnoreProperties
(
String
...
ignoreProperties
)
{
this
.
ignoreProperties
=
ignoreProperties
;
return
this
;
}
...
...
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