提交 1a8a8b18 编写于 作者: ibizdev's avatar ibizdev

zhouweidong 发布系统代码 [ibz-dst,应用]

上级 9016ec12
...@@ -195,6 +195,44 @@ mock.onGet(new RegExp(/^\/ruleitems\/getdraft$/)).reply((config: any) => { ...@@ -195,6 +195,44 @@ mock.onGet(new RegExp(/^\/ruleitems\/getdraft$/)).reply((config: any) => {
return [status, {}]; 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 // CheckKey
mock.onPost(new RegExp(/^\/ruleitems\/?([a-zA-Z0-9\-\;]{0,35})\/checkkey$/)).reply((config: any) => { mock.onPost(new RegExp(/^\/ruleitems\/?([a-zA-Z0-9\-\;]{0,35})\/checkkey$/)).reply((config: any) => {
console.groupCollapsed("实体:ruleitem 方法: CheckKey"); console.groupCollapsed("实体:ruleitem 方法: CheckKey");
......
...@@ -139,6 +139,20 @@ export default class RuleItemServiceBase extends EntityService { ...@@ -139,6 +139,20 @@ export default class RuleItemServiceBase extends EntityService {
return res; 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接口方法 * CheckKey接口方法
* *
......
...@@ -33,6 +33,7 @@ public interface IRuleItemService extends IService<RuleItem> { ...@@ -33,6 +33,7 @@ public interface IRuleItemService extends IService<RuleItem> {
void removeBatch(Collection<String> idList); void removeBatch(Collection<String> idList);
RuleItem get(String key); RuleItem get(String key);
RuleItem getDraft(RuleItem et); RuleItem getDraft(RuleItem et);
RuleItem buildRuleFile(RuleItem et);
boolean checkKey(RuleItem et); boolean checkKey(RuleItem et);
RuleItem modelchange(RuleItem et); RuleItem modelchange(RuleItem et);
boolean save(RuleItem et); boolean save(RuleItem et);
......
...@@ -55,12 +55,19 @@ public class RuleItemServiceImpl extends ServiceImpl<RuleItemMapper, RuleItem> i ...@@ -55,12 +55,19 @@ public class RuleItemServiceImpl extends ServiceImpl<RuleItemMapper, RuleItem> i
@Lazy @Lazy
protected cn.ibizlab.core.lite.service.IMetaModelService metamodelService; protected cn.ibizlab.core.lite.service.IMetaModelService metamodelService;
@Autowired
@Lazy
protected cn.ibizlab.core.rule.service.IRuleItemService ruleitemService;
protected int batchSize = 500; protected int batchSize = 500;
@Override @Override
@Transactional @Transactional
public boolean create(RuleItem et) { public boolean create(RuleItem et) {
fillParentData(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))) { if(!this.retBool(this.baseMapper.insert(et))) {
return false; return false;
} }
...@@ -79,6 +86,9 @@ public class RuleItemServiceImpl extends ServiceImpl<RuleItemMapper, RuleItem> i ...@@ -79,6 +86,9 @@ public class RuleItemServiceImpl extends ServiceImpl<RuleItemMapper, RuleItem> i
@Transactional @Transactional
public boolean update(RuleItem et) { public boolean update(RuleItem et) {
fillParentData(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()))) { if(!update(et, (Wrapper) et.getUpdateWrapper(true).eq("ruleid", et.getRuleId()))) {
return false; return false;
} }
...@@ -125,6 +135,13 @@ public class RuleItemServiceImpl extends ServiceImpl<RuleItemMapper, RuleItem> i ...@@ -125,6 +135,13 @@ public class RuleItemServiceImpl extends ServiceImpl<RuleItemMapper, RuleItem> i
return et; return et;
} }
@Override
@Transactional
public RuleItem buildRuleFile(RuleItem et) {
//自定义代码
return et;
}
@Override @Override
public boolean checkKey(RuleItem et) { public boolean checkKey(RuleItem et) {
return (!ObjectUtils.isEmpty(et.getRuleId())) && (!Objects.isNull(this.getById(et.getRuleId()))); return (!ObjectUtils.isEmpty(et.getRuleId())) && (!Objects.isNull(this.getById(et.getRuleId())));
......
...@@ -48,7 +48,7 @@ ...@@ -48,7 +48,7 @@
<!--输出实体[DA_METRIC]数据结构 --> <!--输出实体[DA_METRIC]数据结构 -->
<changeSet author="root" id="tab-da_metric-56-3"> <changeSet author="root" id="tab-da_metric-59-3">
<createTable tableName="IBZDAMETRIC"> <createTable tableName="IBZDAMETRIC">
<column name="DA_METRICID" remarks="" type="VARCHAR(100)"> <column name="DA_METRICID" remarks="" type="VARCHAR(100)">
<constraints primaryKey="true" primaryKeyName="PK_DA_METRIC_DA_METRICID"/> <constraints primaryKey="true" primaryKeyName="PK_DA_METRIC_DA_METRICID"/>
...@@ -420,7 +420,7 @@ ...@@ -420,7 +420,7 @@
<!--输出实体[RU_ITEM]数据结构 --> <!--输出实体[RU_ITEM]数据结构 -->
<changeSet author="root" id="tab-ru_item-65-16"> <changeSet author="root" id="tab-ru_item-68-16">
<createTable tableName="IBZRULE"> <createTable tableName="IBZRULE">
<column name="RULEID" remarks="" type="VARCHAR(100)"> <column name="RULEID" remarks="" type="VARCHAR(100)">
<constraints primaryKey="true" primaryKeyName="PK_RU_ITEM_RULEID"/> <constraints primaryKey="true" primaryKeyName="PK_RU_ITEM_RULEID"/>
...@@ -457,7 +457,7 @@ ...@@ -457,7 +457,7 @@
<!--输出实体[DA_BUILD]外键关系 --> <!--输出实体[DA_BUILD]外键关系 -->
<!--输出实体[DA_CHART]外键关系 --> <!--输出实体[DA_CHART]外键关系 -->
<!--输出实体[DA_METRIC]外键关系 --> <!--输出实体[DA_METRIC]外键关系 -->
<changeSet author="root" id="fk-da_metric-56-17"> <changeSet author="root" id="fk-da_metric-59-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"/> <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> </changeSet>
<!--输出实体[DA_REPORT]外键关系 --> <!--输出实体[DA_REPORT]外键关系 -->
......
...@@ -152,7 +152,7 @@ ...@@ -152,7 +152,7 @@
"delogicname":"规则", "delogicname":"规则",
"sysmoudle":{"id":"RULE","name":"rule"}, "sysmoudle":{"id":"RULE","name":"rule"},
"dedataset":[{"id":"Default" , "name":"数据集"}], "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":"全部数据"}] "datascope":[{"id":"all","name":"全部数据"}]
} }
], ],
......
...@@ -115,6 +115,17 @@ public class RuleItemResource { ...@@ -115,6 +115,17 @@ public class RuleItemResource {
return ResponseEntity.status(HttpStatus.OK).body(ruleitemMapping.toDto(ruleitemService.getDraft(new RuleItem()))); 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 = "检查规则") @ApiOperation(value = "检查规则", tags = {"规则" }, notes = "检查规则")
@RequestMapping(method = RequestMethod.POST, value = "/ruleitems/checkkey") @RequestMapping(method = RequestMethod.POST, value = "/ruleitems/checkkey")
public ResponseEntity<Boolean> checkKey(@RequestBody RuleItemDTO ruleitemdto) { public ResponseEntity<Boolean> checkKey(@RequestBody RuleItemDTO ruleitemdto) {
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册