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
dc6cc0f1
Commit
dc6cc0f1
authored
Dec 09, 2017
by
naan1993
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
增加查看流程图功能
parent
ce094079
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
83 additions
and
46 deletions
+83
-46
guns-admin/src/main/java/com/stylefeng/guns/config/FlowableConfig.java
+6
-1
guns-admin/src/main/java/com/stylefeng/guns/core/flowable/GunsDefaultProcessDiagramGenerator.java
+0
-0
guns-admin/src/main/java/com/stylefeng/guns/modular/flowable/controller/ExpenseController.java
+8
-16
guns-admin/src/main/java/com/stylefeng/guns/modular/flowable/service/IExpenseService.java
+6
-0
guns-admin/src/main/java/com/stylefeng/guns/modular/flowable/service/impl/ExpenseServiceImpl.java
+60
-2
guns-admin/src/main/webapp/WEB-INF/view/flowable/expense/expense_edit.html
+0
-24
guns-admin/src/main/webapp/static/modular/flowable/expense/expense.js
+3
-3
No files found.
guns-admin/src/main/java/com/stylefeng/guns/config/FlowableConfig.java
View file @
dc6cc0f1
...
@@ -3,6 +3,7 @@ package com.stylefeng.guns.config;
...
@@ -3,6 +3,7 @@ package com.stylefeng.guns.config;
import
com.alibaba.druid.pool.DruidDataSource
;
import
com.alibaba.druid.pool.DruidDataSource
;
import
com.stylefeng.guns.config.properties.GunsFlowableProperties
;
import
com.stylefeng.guns.config.properties.GunsFlowableProperties
;
import
com.stylefeng.guns.core.datasource.DruidProperties
;
import
com.stylefeng.guns.core.datasource.DruidProperties
;
import
com.stylefeng.guns.core.flowable.GunsDefaultProcessDiagramGenerator
;
import
org.flowable.spring.SpringAsyncExecutor
;
import
org.flowable.spring.SpringAsyncExecutor
;
import
org.flowable.spring.SpringProcessEngineConfiguration
;
import
org.flowable.spring.SpringProcessEngineConfiguration
;
import
org.flowable.spring.boot.AbstractProcessEngineAutoConfiguration
;
import
org.flowable.spring.boot.AbstractProcessEngineAutoConfiguration
;
...
@@ -43,6 +44,10 @@ public class FlowableConfig extends AbstractProcessEngineAutoConfiguration {
...
@@ -43,6 +44,10 @@ public class FlowableConfig extends AbstractProcessEngineAutoConfiguration {
PlatformTransactionManager
transactionManager
,
PlatformTransactionManager
transactionManager
,
SpringAsyncExecutor
springAsyncExecutor
)
throws
IOException
{
SpringAsyncExecutor
springAsyncExecutor
)
throws
IOException
{
return
this
.
baseSpringProcessEngineConfiguration
(
flowableDataSource
(),
transactionManager
,
springAsyncExecutor
);
SpringProcessEngineConfiguration
configuration
=
this
.
baseSpringProcessEngineConfiguration
(
flowableDataSource
(),
transactionManager
,
springAsyncExecutor
);
configuration
.
setActivityFontName
(
"宋体"
);
configuration
.
setLabelFontName
(
"宋体"
);
configuration
.
setProcessDiagramGenerator
(
new
GunsDefaultProcessDiagramGenerator
());
return
configuration
;
}
}
}
}
guns-admin/src/main/java/com/stylefeng/guns/core/flowable/GunsDefaultProcessDiagramGenerator.java
0 → 100644
View file @
dc6cc0f1
This diff is collapsed.
Click to expand it.
guns-admin/src/main/java/com/stylefeng/guns/modular/flowable/controller/ExpenseController.java
View file @
dc6cc0f1
...
@@ -3,20 +3,17 @@ package com.stylefeng.guns.modular.flowable.controller;
...
@@ -3,20 +3,17 @@ package com.stylefeng.guns.modular.flowable.controller;
import
com.baomidou.mybatisplus.mapper.EntityWrapper
;
import
com.baomidou.mybatisplus.mapper.EntityWrapper
;
import
com.stylefeng.guns.common.persistence.model.Expense
;
import
com.stylefeng.guns.common.persistence.model.Expense
;
import
com.stylefeng.guns.core.base.controller.BaseController
;
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.core.shiro.ShiroKit
;
import
com.stylefeng.guns.modular.flowable.service.IExpenseService
;
import
com.stylefeng.guns.modular.flowable.service.IExpenseService
;
import
com.stylefeng.guns.modular.flowable.warpper.ExpenseWarpper
;
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.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Controller
;
import
org.springframework.stereotype.Controller
;
import
org.springframework.ui.Model
;
import
org.springframework.web.bind.annotation.PathVariable
;
import
org.springframework.web.bind.annotation.PathVariable
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestParam
;
import
org.springframework.web.bind.annotation.RequestParam
;
import
org.springframework.web.bind.annotation.ResponseBody
;
import
org.springframework.web.bind.annotation.ResponseBody
;
import
java.io.IOException
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Map
;
...
@@ -35,12 +32,6 @@ public class ExpenseController extends BaseController {
...
@@ -35,12 +32,6 @@ public class ExpenseController extends BaseController {
@Autowired
@Autowired
private
IExpenseService
expenseService
;
private
IExpenseService
expenseService
;
@Autowired
private
RuntimeService
runtimeService
;
@Autowired
private
TaskService
taskService
;
/**
/**
* 跳转到报销管理首页
* 跳转到报销管理首页
*/
*/
...
@@ -58,14 +49,15 @@ public class ExpenseController extends BaseController {
...
@@ -58,14 +49,15 @@ public class ExpenseController extends BaseController {
}
}
/**
/**
*
跳转到修改报销管理
*
查看当前流程图
*/
*/
@RequestMapping
(
"/expense_update/{expenseId}"
)
@RequestMapping
(
"/expense_update/{expenseId}"
)
public
String
expenseUpdate
(
@PathVariable
Integer
expenseId
,
Model
model
)
{
public
void
expenseView
(
@PathVariable
Integer
expenseId
)
{
Expense
expense
=
expenseService
.
selectById
(
expenseId
);
try
{
model
.
addAttribute
(
"item"
,
expense
);
expenseService
.
printProcessImage
(
expenseId
);
LogObjectHolder
.
me
().
set
(
expense
);
}
catch
(
IOException
e
)
{
return
PREFIX
+
"expense_edit.html"
;
e
.
printStackTrace
();
}
}
}
/**
/**
...
...
guns-admin/src/main/java/com/stylefeng/guns/modular/flowable/service/IExpenseService.java
View file @
dc6cc0f1
...
@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.service.IService;
...
@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.service.IService;
import
com.stylefeng.guns.common.persistence.model.Expense
;
import
com.stylefeng.guns.common.persistence.model.Expense
;
import
com.stylefeng.guns.modular.flowable.model.TaskVo
;
import
com.stylefeng.guns.modular.flowable.model.TaskVo
;
import
java.io.IOException
;
import
java.util.List
;
import
java.util.List
;
/**
/**
...
@@ -41,4 +42,9 @@ public interface IExpenseService extends IService<Expense> {
...
@@ -41,4 +42,9 @@ public interface IExpenseService extends IService<Expense> {
*/
*/
List
<
TaskVo
>
getProcessList
();
List
<
TaskVo
>
getProcessList
();
/**
* 绘画当前流程图
*/
void
printProcessImage
(
Integer
expenseId
)
throws
IOException
;
}
}
guns-admin/src/main/java/com/stylefeng/guns/modular/flowable/service/impl/ExpenseServiceImpl.java
View file @
dc6cc0f1
...
@@ -7,16 +7,22 @@ import com.stylefeng.guns.common.constant.state.ExpenseState;
...
@@ -7,16 +7,22 @@ import com.stylefeng.guns.common.constant.state.ExpenseState;
import
com.stylefeng.guns.common.persistence.dao.ExpenseMapper
;
import
com.stylefeng.guns.common.persistence.dao.ExpenseMapper
;
import
com.stylefeng.guns.common.persistence.model.Expense
;
import
com.stylefeng.guns.common.persistence.model.Expense
;
import
com.stylefeng.guns.core.shiro.ShiroKit
;
import
com.stylefeng.guns.core.shiro.ShiroKit
;
import
com.stylefeng.guns.core.support.HttpKit
;
import
com.stylefeng.guns.modular.flowable.model.TaskVo
;
import
com.stylefeng.guns.modular.flowable.model.TaskVo
;
import
com.stylefeng.guns.modular.flowable.service.IExpenseService
;
import
com.stylefeng.guns.modular.flowable.service.IExpenseService
;
import
org.flowable.engine.RuntimeService
;
import
org.flowable.bpmn.model.BpmnModel
;
import
org.flowable.engine.TaskService
;
import
org.flowable.engine.*
;
import
org.flowable.engine.runtime.Execution
;
import
org.flowable.engine.runtime.ProcessInstance
;
import
org.flowable.engine.runtime.ProcessInstance
;
import
org.flowable.image.ProcessDiagramGenerator
;
import
org.flowable.task.api.Task
;
import
org.flowable.task.api.Task
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.transaction.annotation.Transactional
;
import
java.io.IOException
;
import
java.io.InputStream
;
import
java.io.OutputStream
;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.List
;
...
@@ -38,6 +44,12 @@ public class ExpenseServiceImpl extends ServiceImpl<ExpenseMapper, Expense> impl
...
@@ -38,6 +44,12 @@ public class ExpenseServiceImpl extends ServiceImpl<ExpenseMapper, Expense> impl
@Autowired
@Autowired
private
TaskService
taskService
;
private
TaskService
taskService
;
@Autowired
private
RepositoryService
repositoryService
;
@Autowired
private
ProcessEngine
processEngine
;
@Override
@Override
@Transactional
(
rollbackFor
=
Exception
.
class
)
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
void
add
(
Expense
expense
)
{
public
void
add
(
Expense
expense
)
{
...
@@ -127,4 +139,50 @@ public class ExpenseServiceImpl extends ServiceImpl<ExpenseMapper, Expense> impl
...
@@ -127,4 +139,50 @@ public class ExpenseServiceImpl extends ServiceImpl<ExpenseMapper, Expense> impl
}
}
return
taskVos
;
return
taskVos
;
}
}
@Override
public
void
printProcessImage
(
Integer
expenseId
)
throws
IOException
{
Expense
expense
=
this
.
selectById
(
expenseId
);
String
processId
=
expense
.
getProcessId
();
ProcessInstance
pi
=
runtimeService
.
createProcessInstanceQuery
().
processInstanceId
(
processId
).
singleResult
();
Task
task
=
taskService
.
createTaskQuery
().
processInstanceId
(
pi
.
getId
()).
singleResult
();
//使用流程实例ID,查询正在执行的执行对象表,返回流程实例对象
String
InstanceId
=
task
.
getProcessInstanceId
();
List
<
Execution
>
executions
=
runtimeService
.
createExecutionQuery
()
.
processInstanceId
(
InstanceId
)
.
list
();
//得到正在执行的Activity的Id
List
<
String
>
activityIds
=
new
ArrayList
<>();
List
<
String
>
flows
=
new
ArrayList
<>();
for
(
Execution
exe
:
executions
)
{
List
<
String
>
ids
=
runtimeService
.
getActiveActivityIds
(
exe
.
getId
());
activityIds
.
addAll
(
ids
);
}
//获取流程图
BpmnModel
bpmnModel
=
repositoryService
.
getBpmnModel
(
pi
.
getProcessDefinitionId
());
ProcessEngineConfiguration
engconf
=
processEngine
.
getProcessEngineConfiguration
();
ProcessDiagramGenerator
diagramGenerator
=
engconf
.
getProcessDiagramGenerator
();
InputStream
in
=
diagramGenerator
.
generateDiagram
(
bpmnModel
,
"png"
,
activityIds
,
flows
,
engconf
.
getActivityFontName
(),
engconf
.
getLabelFontName
(),
engconf
.
getAnnotationFontName
(),
engconf
.
getClassLoader
(),
1.0
);
OutputStream
out
=
null
;
byte
[]
buf
=
new
byte
[
1024
];
int
legth
=
0
;
try
{
out
=
HttpKit
.
getResponse
().
getOutputStream
();
while
((
legth
=
in
.
read
(
buf
))
!=
-
1
)
{
out
.
write
(
buf
,
0
,
legth
);
}
}
finally
{
if
(
in
!=
null
)
{
in
.
close
();
}
if
(
out
!=
null
)
{
out
.
close
();
}
}
}
}
}
guns-admin/src/main/webapp/WEB-INF/view/flowable/expense/expense_edit.html
deleted
100644 → 0
View file @
ce094079
@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}"
disabled=
"disabled"
/>
<
#
input
id=
"desc"
name=
"描述"
value=
"${item.desc}"
disabled=
"disabled"
/>
</div>
</div>
<div
class=
"row btn-group-m-t"
>
<div
class=
"col-sm-10"
>
<
#
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/static/modular/flowable/expense/expense.js
View file @
dc6cc0f1
...
@@ -29,13 +29,13 @@ Expense.initColumn = function () {
...
@@ -29,13 +29,13 @@ Expense.initColumn = function () {
};
};
/**
/**
*
查看审核记录
*
流程详情
*/
*/
Expense
.
findRecord
=
function
(
id
)
{
Expense
.
findRecord
=
function
(
id
)
{
var
index
=
layer
.
open
({
var
index
=
layer
.
open
({
type
:
2
,
type
:
2
,
title
:
'
报销管理
详情'
,
title
:
'
流程
详情'
,
area
:
[
'
600px'
,
'35
0px'
],
//宽高
area
:
[
'
1000px'
,
'50
0px'
],
//宽高
fix
:
false
,
//不固定
fix
:
false
,
//不固定
maxmin
:
true
,
maxmin
:
true
,
content
:
Feng
.
ctxPath
+
'/expense/expense_update/'
+
id
content
:
Feng
.
ctxPath
+
'/expense/expense_update/'
+
id
...
...
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