Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
uniplat-example
/
intent-example
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
af094ce3
authored
May 07, 2022
by
张蕴鹏
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
feat(类型):调整导入方法和逻辑
parent
e3f875fa
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
145 additions
and
0 deletions
models/city.groovy
models/city.json
models/province.groovy
models/city.groovy
0 → 100644
View file @
af094ce3
import
com.qinqinxiaobao.report.commons.ErrorLine
import
com.qinqinxiaobao.report.general.controller.ActionValidationResponse
import
com.qinqinxiaobao.report.uniplat.engine.DO.DataObject
import
com.qinqinxiaobao.report.uniplat.engine.DO.EnvDataObject
import
com.qinqinxiaobao.report.uniplat.engine.DataList
import
com.qinqinxiaobao.report.uniplat.executor.*
import
com.qinqinxiaobao.report.uniplat.host.Host
import
com.qinqinxiaobao.report.uniplat.models.meta.DataModel
import
com.qinqinxiaobao.report.uniplat.workflow.dto.WorkflowUser
import
com.qinqinxiaobao.report.uniplat.workflow.dto.handle.WorkflowHandleContext
import
com.qinqinxiaobao.report.uniplat.workflow.engine.WorkflowDao
import
com.qinqinxiaobao.report.uniplat.workflow.params.StartPlanTaskParam
class
CityChange
{
def
model_name
=
"city"
def
multiCascadeInput
(
ActionBehaviorContext
context
)
{
// 测试树
def
treeModel
=
context
.
host
.
getDataModel
(
'province'
)
def
treeList1
=
treeModel
.
tableTree
.
queryNodeAllAncestor
(
3
,
false
)
def
treeList
=
treeModel
.
tableTree
.
queryNodeAllDescendant
(
1
,
false
)
def
model
=
context
.
dataModel
def
obj
=
context
.
dataList
.
fetchOne
()
def
typeList
=
context
.
inputs
.
type
.
value
def
sql
=
"delete from city_type_relation where city_id = ?"
// 执行删除
model
.
getDataSource
().
execute
(
sql
,
obj
.
getKeyValue
())
// 插入新的 sql
sql
=
"insert into city_type_relation(city_id, type_id) values (?,?)"
for
(
List
type
:
typeList
)
{
def
lastItem
=
type
.
get
(
type
.
size
()
-
1
)
model
.
getDataSource
().
insert
(
sql
,
obj
.
getKeyValue
(),
lastItem
)
}
return
new
BehaviorResult
(
0
,
"成功"
,
0
)
}
def
getMultiCascadeList
(
DataObject
object
)
{
def
dataModel
=
Host
.
getInstance
().
getDataModel
(
"city"
)
def
sql
=
"select type_id from city_type_relation where city_id = ?"
def
list
=
dataModel
.
queryDataListWithParams
(
sql
,
[
object
.
getKeyValue
()])
def
result
=
[]
for
(
DataObject
o
:
list
.
asList
())
{
def
parent
=
getParent
(
dataModel
,
o
.
type_id
.
value
)
def
innerList
=
[
o
.
type_id
.
value
]
if
(
parent
!=
null
&&
parent
!=
''
)
{
innerList
=
[
parent
,
o
.
type_id
.
value
]
}
result
.
add
(
innerList
)
}
return
result
}
def
getParent
(
DataModel
model
,
Object
id
)
{
def
sql
=
"select parent from demo_product_type where id = ?"
def
obj
=
model
.
queryDataListWithParams
(
sql
,
[
id
]).
fetchOne
()
return
obj
.
parent
.
value
}
def
level_updator
(
Host
host
,
InputParameter
parameter
,
DataList
datalist
,
EnvDataObject
env
,
Map
params
,
String
sender
)
{
if
(
sender
==
"name"
)
{
return
[
"default_value"
:
10
]
}
return
[
"default_value"
:
""
]
}
def
testValid
(
BatchActionValidatorContext
context
)
{
def
list
=
context
.
getList
()
def
value
=
list
.
get
(
0
).
getValue
(
"test1"
)
def
errorLines
=
new
ArrayList
()
errorLines
.
add
(
new
ErrorLine
(
0
,
"找不到主订单"
))
ActionValidationResponse
response
=
new
ActionValidationResponse
()
// response.fromErrLines(errorLines)
return
response
}
def
process1
(
ActionBehaviorContext
context
)
{
var
obj
=
context
.
dataList
.
fetchOne
()
context
.
dataModel
.
addRemark
(
obj
.
getKeyFieldValue
(),
"dataModel备注"
)
obj
.
addRemark
(
"dataObject备注"
)
StartPlanTaskParam
startPlanTaskParam
=
new
StartPlanTaskParam
();
startPlanTaskParam
.
setDealer
(
1L
)
startPlanTaskParam
.
setAssociateId
(
1L
)
startPlanTaskParam
.
setDays
(
2
)
startPlanTaskParam
.
setRemark
(
"测试 API 接口"
)
startPlanTaskParam
.
setPriority
(
1
)
startPlanTaskParam
.
setCreator
(
238
)
def
pid
=
context
.
getDataModel
().
getWorkflowEngine
().
getProcessCore
().
startPlanProcessApi
(
startPlanTaskParam
)
// def obj = context.dataList.fetchOne()
// def model = context.getDataModel()
// def id = obj.getKeyValue()
// WorkflowUser user = new WorkflowUser();
// user.setId(999)
// user.setName("测试启动11")
// def pid = model.getWorkflowEngine().getWorkFlowCore().createUninitializedProcess("信息核验", id, user)
return
new
BehaviorResult
(
0
,
"成功"
,
pid
)
}
def
testWorkflow
(
ActionBehaviorContext
context
)
{
def
obj
=
context
.
dataList
.
fetchOne
()
def
process
=
context
.
getDataModel
().
getWorkflowEngine
().
getWorkflowQuery
().
getRunningProcess
(
obj
.
getLong
(
"id"
),
"信息核验"
)
context
.
getDataModel
().
getWorkflowEngine
().
processCore
.
changeProcessStateOrFinishTask
(
process
.
getId
().
longValue
(),
"关机"
)
return
new
BehaviorResult
(
0
,
"成功"
,
2
)
}
def
batchInsert
(
ActionBehaviorContext
context
)
{
def
model
=
context
.
getDataModel
()
def
workflowDao
=
new
WorkflowDao
(
model
)
workflowDao
.
getProcessInstance
()
def
core
=
model
.
getWorkflowEngine
().
getWorkFlowCore
()
core
.
changeProcessState
()
// for (int i = 0; i < 10000; i++) {
// var name = String.format("批量city%s", i)
// model.insertByMap(["name": name, "province_id": 1])
// }
return
new
BehaviorResult
(
0
,
"成功"
,
2
)
}
def
test1
(
List
<
Map
<
String
,
String
>>
map
)
{
var
a
=
2
var
c
=
3
return
[
"result"
:
false
,
"msg"
:
"非法的手机号"
]
}
def
batchTest
(
BatchActionBehaviorContext
context
)
{
def
object
=
context
.
getList
().
get
(
0
)
Thread
.
sleep
(
Math
.
random
()
*
1500
as
long
)
return
new
BehaviorResult
(
0
,
"成功"
,
2
)
}
def
dealerConfig
(
WorkflowHandleContext
context
)
{
def
workflow
=
context
.
workflowContext
return
WorkflowHandleContext
.
success
(
new
WorkflowUser
(
1000
,
"李冬梅"
))
}
}
\ No newline at end of file
models/city.json
0 → 100644
View file @
af094ce3
This diff is collapsed.
Click to expand it.
models/province.groovy
View file @
af094ce3
...
@@ -3,11 +3,16 @@ import com.qinqinxiaobao.report.uniplat.engine.DO.PureDataObject
...
@@ -3,11 +3,16 @@ import com.qinqinxiaobao.report.uniplat.engine.DO.PureDataObject
import
com.qinqinxiaobao.report.uniplat.engine.DataList
import
com.qinqinxiaobao.report.uniplat.engine.DataList
import
com.qinqinxiaobao.report.uniplat.executor.InputParameter
import
com.qinqinxiaobao.report.uniplat.executor.InputParameter
import
com.qinqinxiaobao.report.uniplat.host.Host
import
com.qinqinxiaobao.report.uniplat.host.Host
import
com.qinqinxiaobao.report.uniplat.list.ListDef
import
com.qinqinxiaobao.report.uniplat.models.meta.DataModel
import
com.qinqinxiaobao.report.uniplat.models.meta.DataModel
class
province
{
class
province
{
def
model_name
=
"province"
def
model_name
=
"province"
def
methodTest
(
Host
host
,
String
a
,
int
b
,
Long
c
,
ListDef
pureDataObject
)
{
return
0
}
def
up
(
Host
host
,
DataModel
dataModel
,
DataList
dataList
,
PureDataObject
inputsObj
,
EnvDataObject
envObj
)
{
def
up
(
Host
host
,
DataModel
dataModel
,
DataList
dataList
,
PureDataObject
inputsObj
,
EnvDataObject
envObj
)
{
def
object
=
dataList
.
fetchOne
();
def
object
=
dataList
.
fetchOne
();
dataModel
.
getTableTree
().
orderUpOrDown
(
object
.
getKeyValue
(),
true
);
dataModel
.
getTableTree
().
orderUpOrDown
(
object
.
getKeyValue
(),
true
);
...
...
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