Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
小 白蛋
Ferry
Commits
12f48598
Commit
12f48598
authored
4 years ago
by
lanyulei
Browse files
Options
Download
Email Patches
Plain Diff
feat: 添加任务是否需执行的配置。
parent
590e14a3
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
apis/process/workOrder.go
+2
-0
apis/process/workOrder.go
pkg/service/createWorkOrder.go
+17
-13
pkg/service/createWorkOrder.go
pkg/service/handle.go
+22
-20
pkg/service/handle.go
tools/captcha/captcha.go
+6
-7
tools/captcha/captcha.go
with
47 additions
and
40 deletions
+47
-40
apis/process/workOrder.go
+
2
-
0
View file @
12f48598
...
...
@@ -116,6 +116,7 @@ func ProcessWorkOrder(c *gin.Context) {
FlowProperties
int
`json:"flow_properties"`
// 流转类型 0 拒绝,1 同意,2 其他
Remarks
string
`json:"remarks"`
// 处理的备注信息
Tpls
[]
map
[
string
]
interface
{}
`json:"tpls"`
// 表单数据
IsExecTask
bool
`json:"is_exec_task"`
// 是否执行任务
}
)
...
...
@@ -146,6 +147,7 @@ func ProcessWorkOrder(c *gin.Context) {
params
.
FlowProperties
,
// 流转属性
params
.
Remarks
,
// 备注信息
params
.
Tpls
,
// 工单数据更新
params
.
IsExecTask
,
// 是否执行任务
)
if
err
!=
nil
{
app
.
Error
(
c
,
-
1
,
err
,
fmt
.
Sprintf
(
"处理工单失败,%v"
,
err
.
Error
()))
...
...
This diff is collapsed.
Click to expand it.
pkg/service/createWorkOrder.go
+
17
-
13
View file @
12f48598
...
...
@@ -40,6 +40,7 @@ func CreateWorkOrder(c *gin.Context) (err error) {
SourceState
string
`json:"source_state"`
Tasks
json
.
RawMessage
`json:"tasks"`
Source
string
`json:"source"`
IsExecTask
bool
`json:"is_exec_task"`
}
paramsValue
struct
{
Id
int
`json:"id"`
...
...
@@ -348,23 +349,26 @@ func CreateWorkOrder(c *gin.Context) (err error) {
}()
}
// 执行任务
err
=
json
.
Unmarshal
(
workOrderValue
.
Tasks
,
&
taskList
)
if
err
!=
nil
{
return
}
if
len
(
taskList
)
>
0
{
paramsValue
.
Id
=
workOrderInfo
.
Id
paramsValue
.
Title
=
workOrderInfo
.
Title
paramsValue
.
Priority
=
workOrderInfo
.
Priority
paramsValue
.
FormData
=
workOrderValue
.
Tpls
[
"form_data"
]
var
params
[]
byte
params
,
err
=
json
.
Marshal
(
paramsValue
)
if
workOrderValue
.
IsExecTask
{
// 执行任务
err
=
json
.
Unmarshal
(
workOrderValue
.
Tasks
,
&
taskList
)
if
err
!=
nil
{
return
}
if
len
(
taskList
)
>
0
{
paramsValue
.
Id
=
workOrderInfo
.
Id
paramsValue
.
Title
=
workOrderInfo
.
Title
paramsValue
.
Priority
=
workOrderInfo
.
Priority
paramsValue
.
FormData
=
workOrderValue
.
Tpls
[
"form_data"
]
var
params
[]
byte
params
,
err
=
json
.
Marshal
(
paramsValue
)
if
err
!=
nil
{
return
}
go
ExecTask
(
taskList
,
string
(
params
))
go
ExecTask
(
taskList
,
string
(
params
))
}
}
return
}
This diff is collapsed.
Click to expand it.
pkg/service/handle.go
+
22
-
20
View file @
12f48598
...
...
@@ -404,6 +404,7 @@ func (h *Handle) HandleWorkOrder(
flowProperties
int
,
remarks
string
,
tpls
[]
map
[
string
]
interface
{},
isExecTask
bool
,
)
(
err
error
)
{
h
.
workOrderId
=
workOrderId
h
.
flowProperties
=
flowProperties
...
...
@@ -907,30 +908,31 @@ func (h *Handle) HandleWorkOrder(
}(
bodyData
)
}
// 执行流程公共任务及节点任务
if
h
.
stateValue
[
"task"
]
!=
nil
{
for
_
,
task
:=
range
h
.
stateValue
[
"task"
]
.
([]
interface
{})
{
tasks
=
append
(
tasks
,
task
.
(
string
))
if
isExecTask
{
// 执行流程公共任务及节点任务
if
h
.
stateValue
[
"task"
]
!=
nil
{
for
_
,
task
:=
range
h
.
stateValue
[
"task"
]
.
([]
interface
{})
{
tasks
=
append
(
tasks
,
task
.
(
string
))
}
}
}
continueTag
:
for
_
,
t
ask
:=
range
t
asks
{
for
_
,
t
:
=
range
execT
ask
s
{
if
t
==
task
{
continue
continueTag
continueTag
:
for
_
,
task
:=
range
tasks
{
for
_
,
t
:=
range
execT
asks
{
if
t
=
=
t
ask
{
continue
continueTag
}
}
execTasks
=
append
(
execTasks
,
task
)
}
execTasks
=
append
(
execTasks
,
task
)
}
paramsValue
.
Id
=
h
.
workOrderDetails
.
Id
paramsValue
.
Title
=
h
.
workOrderDetails
.
Title
paramsValue
.
Priority
=
h
.
workOrderDetails
.
Priority
params
,
err
:=
json
.
Marshal
(
paramsValue
)
if
err
!=
nil
{
return
err
paramsValue
.
Id
=
h
.
workOrderDetails
.
Id
paramsValue
.
Title
=
h
.
workOrderDetails
.
Title
paramsValue
.
Priority
=
h
.
workOrderDetails
.
Priority
params
,
err
:=
json
.
Marshal
(
paramsValue
)
if
err
!=
nil
{
return
err
}
go
ExecTask
(
execTasks
,
string
(
params
))
}
go
ExecTask
(
execTasks
,
string
(
params
))
return
}
This diff is collapsed.
Click to expand it.
tools/captcha/captcha.go
+
6
-
7
View file @
12f48598
package
captcha
import
(
"image/color"
"github.com/google/uuid"
"github.com/mojocn/base64Captcha"
"image/color"
)
var
store
=
base64Captcha
.
DefaultMemStore
...
...
@@ -20,9 +21,8 @@ type configJsonBody struct {
DriverDigit
*
base64Captcha
.
DriverDigit
}
func
DriverStringFunc
()
(
id
,
b64s
string
,
err
error
)
{
e
:=
configJsonBody
{}
func
DriverStringFunc
()
(
id
,
b64s
string
,
err
error
)
{
e
:=
configJsonBody
{}
e
.
Id
=
uuid
.
New
()
.
String
()
e
.
DriverString
=
base64Captcha
.
NewDriverString
(
46
,
140
,
2
,
2
,
4
,
"234567890abcdefghjkmnpqrstuvwxyz"
,
&
color
.
RGBA
{
240
,
240
,
246
,
246
},
[]
string
{
"wqy-microhei.ttc"
})
driver
:=
e
.
DriverString
.
ConvertFonts
()
...
...
@@ -30,12 +30,11 @@ func DriverStringFunc() (id, b64s string, err error) {
return
cap
.
Generate
()
}
func
DriverDigitFunc
()
(
id
,
b64s
string
,
err
error
)
{
e
:=
configJsonBody
{}
e
.
Id
=
uuid
.
New
()
.
String
()
e
.
DriverDigit
=
base64Captcha
.
Default
DriverDigit
e
.
DriverDigit
=
base64Captcha
.
New
DriverDigit
(
80
,
240
,
4
,
0.7
,
80
)
driver
:=
e
.
DriverDigit
cap
:=
base64Captcha
.
NewCaptcha
(
driver
,
store
)
return
cap
.
Generate
()
}
\ No newline at end of file
}
This diff is collapsed.
Click to expand it.
Write
Preview
Supports
Markdown
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
Menu
Projects
Groups
Snippets
Help