Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
提交反馈
为 GitLab 提交贡献
登录
切换导航
I
ibzdst
项目
项目
详情
动态
版本
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
议题
1
议题
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
ibiz4jteam
ibzdst
提交
1a8a8b18
提交
1a8a8b18
编写于
12月 11, 2020
作者:
ibizdev
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
zhouweidong 发布系统代码 [ibz-dst,应用]
上级
9016ec12
变更
7
隐藏空白字符变更
内嵌
并排
正在显示
7 个修改的文件
包含
85 行增加
和
4 行删除
+85
-4
rule-items.ts
app_web/src/mock/entity/rule-items/rule-items.ts
+38
-0
rule-item-service-base.ts
app_web/src/service/rule-item/rule-item-service-base.ts
+14
-0
IRuleItemService.java
...n/java/cn/ibizlab/core/rule/service/IRuleItemService.java
+1
-0
RuleItemServiceImpl.java
...n/ibizlab/core/rule/service/impl/RuleItemServiceImpl.java
+17
-0
h2_table.xml
ibzdst-core/src/main/resources/liquibase/h2_table.xml
+3
-3
systemResource.json
...st-core/src/main/resources/permission/systemResource.json
+1
-1
RuleItemResource.java
...i/src/main/java/cn/ibizlab/api/rest/RuleItemResource.java
+11
-0
未找到文件。
app_web/src/mock/entity/rule-items/rule-items.ts
浏览文件 @
1a8a8b18
...
...
@@ -195,6 +195,44 @@ mock.onGet(new RegExp(/^\/ruleitems\/getdraft$/)).reply((config: any) => {
return
[
status
,
{}];
});
// BuildRuleFile
mock
.
onPost
(
new
RegExp
(
/^
\/
ruleitems
\/?([
a-zA-Z0-9
\-\;]{0,35})\/
buildrulefile$/
)).
reply
((
config
:
any
)
=>
{
console
.
groupCollapsed
(
"实体:ruleitem 方法: BuildRuleFile"
);
console
.
table
({
url
:
config
.
url
,
method
:
config
.
method
,
data
:
config
.
data
});
let
status
=
MockAdapter
.
mockStatus
(
config
);
if
(
status
!==
200
)
{
return
[
status
,
null
];
}
const
paramArray
:
Array
<
any
>
=
[
'rule_id'
];
const
matchArray
:
any
=
new
RegExp
(
/^
\/
ruleitems
\/([
a-zA-Z0-9
\-\;]{1,35})\/
buildrulefile$/
).
exec
(
config
.
url
);
let
tempValue
:
any
=
{};
if
(
matchArray
&&
matchArray
.
length
>
1
&&
paramArray
&&
paramArray
.
length
>
0
){
paramArray
.
forEach
((
item
:
any
,
index
:
number
)
=>
{
Object
.
defineProperty
(
tempValue
,
item
,
{
enumerable
:
true
,
value
:
matchArray
[
index
+
1
]
});
});
}
//let items = mockDatas ? mockDatas : [];
//let _items = items.find((item: any) => Object.is(item.rule_id, tempValue.rule_id));
let
data
=
JSON
.
parse
(
config
.
data
);
mockDatas
.
forEach
((
item
)
=>
{
if
(
item
[
'rule_id'
]
==
tempValue
[
'rule_id'
]
){
for
(
let
value
in
data
){
if
(
item
.
hasOwnProperty
(
value
)){
item
[
value
]
=
data
[
value
];
}
}
}
})
console
.
groupCollapsed
(
"response数据 status: "
+
status
+
" data: "
);
console
.
table
(
data
);
console
.
groupEnd
();
console
.
groupEnd
();
return
[
status
,
data
];
});
// CheckKey
mock
.
onPost
(
new
RegExp
(
/^
\/
ruleitems
\/?([
a-zA-Z0-9
\-\;]{0,35})\/
checkkey$/
)).
reply
((
config
:
any
)
=>
{
console
.
groupCollapsed
(
"实体:ruleitem 方法: CheckKey"
);
...
...
app_web/src/service/rule-item/rule-item-service-base.ts
浏览文件 @
1a8a8b18
...
...
@@ -139,6 +139,20 @@ export default class RuleItemServiceBase extends EntityService {
return
res
;
}
/**
* BuildRuleFile接口方法
*
* @param {*} [context={}]
* @param {*} [data={}]
* @param {boolean} [isloading]
* @returns {Promise<any>}
* @memberof RuleItemServiceBase
*/
public
async
BuildRuleFile
(
context
:
any
=
{},
data
:
any
=
{},
isloading
?:
boolean
):
Promise
<
any
>
{
let
res
:
any
=
Http
.
getInstance
().
post
(
`/ruleitems/
${
context
.
ruleitem
}
/buildrulefile`
,
data
,
isloading
);
return
res
;
}
/**
* CheckKey接口方法
*
...
...
ibzdst-core/src/main/java/cn/ibizlab/core/rule/service/IRuleItemService.java
浏览文件 @
1a8a8b18
...
...
@@ -33,6 +33,7 @@ public interface IRuleItemService extends IService<RuleItem> {
void
removeBatch
(
Collection
<
String
>
idList
);
RuleItem
get
(
String
key
);
RuleItem
getDraft
(
RuleItem
et
);
RuleItem
buildRuleFile
(
RuleItem
et
);
boolean
checkKey
(
RuleItem
et
);
RuleItem
modelchange
(
RuleItem
et
);
boolean
save
(
RuleItem
et
);
...
...
ibzdst-core/src/main/java/cn/ibizlab/core/rule/service/impl/RuleItemServiceImpl.java
浏览文件 @
1a8a8b18
...
...
@@ -55,12 +55,19 @@ public class RuleItemServiceImpl extends ServiceImpl<RuleItemMapper, RuleItem> i
@Lazy
protected
cn
.
ibizlab
.
core
.
lite
.
service
.
IMetaModelService
metamodelService
;
@Autowired
@Lazy
protected
cn
.
ibizlab
.
core
.
rule
.
service
.
IRuleItemService
ruleitemService
;
protected
int
batchSize
=
500
;
@Override
@Transactional
public
boolean
create
(
RuleItem
et
)
{
fillParentData
(
et
);
cn
.
ibizlab
.
core
.
rule
.
domain
.
RuleItem
actionLogicDE
=
new
cn
.
ibizlab
.
core
.
rule
.
domain
.
RuleItem
();
et
.
copyTo
(
actionLogicDE
,
true
);
ruleitemService
.
buildRuleFile
(
actionLogicDE
);
if
(!
this
.
retBool
(
this
.
baseMapper
.
insert
(
et
)))
{
return
false
;
}
...
...
@@ -79,6 +86,9 @@ public class RuleItemServiceImpl extends ServiceImpl<RuleItemMapper, RuleItem> i
@Transactional
public
boolean
update
(
RuleItem
et
)
{
fillParentData
(
et
);
cn
.
ibizlab
.
core
.
rule
.
domain
.
RuleItem
actionLogicDE
=
new
cn
.
ibizlab
.
core
.
rule
.
domain
.
RuleItem
();
et
.
copyTo
(
actionLogicDE
,
true
);
ruleitemService
.
buildRuleFile
(
actionLogicDE
);
if
(!
update
(
et
,
(
Wrapper
)
et
.
getUpdateWrapper
(
true
).
eq
(
"ruleid"
,
et
.
getRuleId
())))
{
return
false
;
}
...
...
@@ -125,6 +135,13 @@ public class RuleItemServiceImpl extends ServiceImpl<RuleItemMapper, RuleItem> i
return
et
;
}
@Override
@Transactional
public
RuleItem
buildRuleFile
(
RuleItem
et
)
{
//自定义代码
return
et
;
}
@Override
public
boolean
checkKey
(
RuleItem
et
)
{
return
(!
ObjectUtils
.
isEmpty
(
et
.
getRuleId
()))
&&
(!
Objects
.
isNull
(
this
.
getById
(
et
.
getRuleId
())));
...
...
ibzdst-core/src/main/resources/liquibase/h2_table.xml
浏览文件 @
1a8a8b18
...
...
@@ -48,7 +48,7 @@
<!--输出实体[DA_METRIC]数据结构 -->
<changeSet
author=
"root"
id=
"tab-da_metric-5
6
-3"
>
<changeSet
author=
"root"
id=
"tab-da_metric-5
9
-3"
>
<createTable
tableName=
"IBZDAMETRIC"
>
<column
name=
"DA_METRICID"
remarks=
""
type=
"VARCHAR(100)"
>
<constraints
primaryKey=
"true"
primaryKeyName=
"PK_DA_METRIC_DA_METRICID"
/>
...
...
@@ -420,7 +420,7 @@
<!--输出实体[RU_ITEM]数据结构 -->
<changeSet
author=
"root"
id=
"tab-ru_item-6
5
-16"
>
<changeSet
author=
"root"
id=
"tab-ru_item-6
8
-16"
>
<createTable
tableName=
"IBZRULE"
>
<column
name=
"RULEID"
remarks=
""
type=
"VARCHAR(100)"
>
<constraints
primaryKey=
"true"
primaryKeyName=
"PK_RU_ITEM_RULEID"
/>
...
...
@@ -457,7 +457,7 @@
<!--输出实体[DA_BUILD]外键关系 -->
<!--输出实体[DA_CHART]外键关系 -->
<!--输出实体[DA_METRIC]外键关系 -->
<changeSet
author=
"root"
id=
"fk-da_metric-5
6
-17"
>
<changeSet
author=
"root"
id=
"fk-da_metric-5
9
-17"
>
<addForeignKeyConstraint
baseColumnNames=
"BUILDID"
baseTableName=
"IBZDAMETRIC"
constraintName=
"DER1N_DA_METRIC_DA_BUILD_BUILD"
deferrable=
"false"
initiallyDeferred=
"false"
onDelete=
"RESTRICT"
onUpdate=
"RESTRICT"
referencedColumnNames=
"BUILDID"
referencedTableName=
"IBZDABUILD"
validate=
"true"
/>
</changeSet>
<!--输出实体[DA_REPORT]外键关系 -->
...
...
ibzdst-core/src/main/resources/permission/systemResource.json
浏览文件 @
1a8a8b18
...
...
@@ -152,7 +152,7 @@
"delogicname"
:
"规则"
,
"sysmoudle"
:{
"id"
:
"RULE"
,
"name"
:
"rule"
},
"dedataset"
:[{
"id"
:
"Default"
,
"name"
:
"数据集"
}],
"deaction"
:[{
"id"
:
"Create"
,
"name"
:
"Create"
,
"type"
:
"BUILTIN"
},{
"id"
:
"Update"
,
"name"
:
"Update"
,
"type"
:
"BUILTIN"
},{
"id"
:
"Remove"
,
"name"
:
"Remove"
,
"type"
:
"BUILTIN"
},{
"id"
:
"Get"
,
"name"
:
"Get"
,
"type"
:
"BUILTIN"
},{
"id"
:
"GetDraft"
,
"name"
:
"GetDraft"
,
"type"
:
"BUILTIN"
},{
"id"
:
"CheckKey"
,
"name"
:
"CheckKey"
,
"type"
:
"BUILTIN"
},{
"id"
:
"Modelchange"
,
"name"
:
"modelchange"
,
"type"
:
"USERCUSTOM"
},{
"id"
:
"Save"
,
"name"
:
"Save"
,
"type"
:
"BUILTIN"
}],
"deaction"
:[{
"id"
:
"Create"
,
"name"
:
"Create"
,
"type"
:
"BUILTIN"
},{
"id"
:
"Update"
,
"name"
:
"Update"
,
"type"
:
"BUILTIN"
},{
"id"
:
"Remove"
,
"name"
:
"Remove"
,
"type"
:
"BUILTIN"
},{
"id"
:
"Get"
,
"name"
:
"Get"
,
"type"
:
"BUILTIN"
},{
"id"
:
"GetDraft"
,
"name"
:
"GetDraft"
,
"type"
:
"BUILTIN"
},{
"id"
:
"
BuildRuleFile"
,
"name"
:
"生成规则文件"
,
"type"
:
"USERCUSTOM"
},{
"id"
:
"
CheckKey"
,
"name"
:
"CheckKey"
,
"type"
:
"BUILTIN"
},{
"id"
:
"Modelchange"
,
"name"
:
"modelchange"
,
"type"
:
"USERCUSTOM"
},{
"id"
:
"Save"
,
"name"
:
"Save"
,
"type"
:
"BUILTIN"
}],
"datascope"
:[{
"id"
:
"all"
,
"name"
:
"全部数据"
}]
}
],
...
...
ibzdst-provider/ibzdst-provider-api/src/main/java/cn/ibizlab/api/rest/RuleItemResource.java
浏览文件 @
1a8a8b18
...
...
@@ -115,6 +115,17 @@ public class RuleItemResource {
return
ResponseEntity
.
status
(
HttpStatus
.
OK
).
body
(
ruleitemMapping
.
toDto
(
ruleitemService
.
getDraft
(
new
RuleItem
())));
}
@PreAuthorize
(
"hasAnyAuthority('ROLE_SUPERADMIN','ibzdst-RuleItem-BuildRuleFile-all')"
)
@ApiOperation
(
value
=
"生成规则文件"
,
tags
=
{
"规则"
},
notes
=
"生成规则文件"
)
@RequestMapping
(
method
=
RequestMethod
.
POST
,
value
=
"/ruleitems/{ruleitem_id}/buildrulefile"
)
public
ResponseEntity
<
RuleItemDTO
>
buildRuleFile
(
@PathVariable
(
"ruleitem_id"
)
String
ruleitem_id
,
@RequestBody
RuleItemDTO
ruleitemdto
)
{
RuleItem
domain
=
ruleitemMapping
.
toDomain
(
ruleitemdto
);
domain
.
setRuleId
(
ruleitem_id
);
domain
=
ruleitemService
.
buildRuleFile
(
domain
);
ruleitemdto
=
ruleitemMapping
.
toDto
(
domain
);
return
ResponseEntity
.
status
(
HttpStatus
.
OK
).
body
(
ruleitemdto
);
}
@ApiOperation
(
value
=
"检查规则"
,
tags
=
{
"规则"
},
notes
=
"检查规则"
)
@RequestMapping
(
method
=
RequestMethod
.
POST
,
value
=
"/ruleitems/checkkey"
)
public
ResponseEntity
<
Boolean
>
checkKey
(
@RequestBody
RuleItemDTO
ruleitemdto
)
{
...
...
编辑
预览
Markdown
格式
0%
请重试
or
添加新附件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
先完成此消息的编辑!
取消
想要评论请
注册
或
登录