提交 990a279b 编写于 作者: ibizdev's avatar ibizdev

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

上级 b18fc8c5
...@@ -132,6 +132,10 @@ function getLocaleResourceBase(){ ...@@ -132,6 +132,10 @@ function getLocaleResourceBase(){
caption: commonLogic.appcommonhandle("运行",null), caption: commonLogic.appcommonhandle("运行",null),
tip: commonLogic.appcommonhandle("运行",null), tip: commonLogic.appcommonhandle("运行",null),
}, },
tbitem1_check: {
caption: commonLogic.appcommonhandle("校验",null),
tip: commonLogic.appcommonhandle("校验",null),
},
tbitem2: { tbitem2: {
caption: commonLogic.appcommonhandle("-",null), caption: commonLogic.appcommonhandle("-",null),
tip: commonLogic.appcommonhandle("",null), tip: commonLogic.appcommonhandle("",null),
......
...@@ -132,6 +132,10 @@ function getLocaleResourceBase(){ ...@@ -132,6 +132,10 @@ function getLocaleResourceBase(){
caption: commonLogic.appcommonhandle("运行",null), caption: commonLogic.appcommonhandle("运行",null),
tip: commonLogic.appcommonhandle("运行",null), tip: commonLogic.appcommonhandle("运行",null),
}, },
tbitem1_check: {
caption: commonLogic.appcommonhandle("校验",null),
tip: commonLogic.appcommonhandle("校验",null),
},
tbitem2: { tbitem2: {
caption: commonLogic.appcommonhandle("-",null), caption: commonLogic.appcommonhandle("-",null),
tip: commonLogic.appcommonhandle("",null), tip: commonLogic.appcommonhandle("",null),
......
...@@ -195,6 +195,44 @@ mock.onGet(new RegExp(/^\/ruleengines\/getdraft$/)).reply((config: any) => { ...@@ -195,6 +195,44 @@ mock.onGet(new RegExp(/^\/ruleengines\/getdraft$/)).reply((config: any) => {
return [status, {}]; return [status, {}];
}); });
// Check
mock.onPost(new RegExp(/^\/ruleengines\/?([a-zA-Z0-9\-\;]{0,35})\/check$/)).reply((config: any) => {
console.groupCollapsed("实体:ruleengine 方法: Check");
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> = ['engine_id'];
const matchArray:any = new RegExp(/^\/ruleengines\/([a-zA-Z0-9\-\;]{1,35})\/check$/).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.engine_id, tempValue.engine_id));
let data = JSON.parse(config.data);
mockDatas.forEach((item)=>{
if(item['engine_id'] == tempValue['engine_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(/^\/ruleengines\/?([a-zA-Z0-9\-\;]{0,35})\/checkkey$/)).reply((config: any) => { mock.onPost(new RegExp(/^\/ruleengines\/?([a-zA-Z0-9\-\;]{0,35})\/checkkey$/)).reply((config: any) => {
console.groupCollapsed("实体:ruleengine 方法: CheckKey"); console.groupCollapsed("实体:ruleengine 方法: CheckKey");
......
...@@ -13,6 +13,13 @@ ...@@ -13,6 +13,13 @@
</i-button> </i-button>
<div slot='content'>{{$t('entities.ruleengine.editviewtoolbar_toolbar.tbitem1_run.tip')}}</div> <div slot='content'>{{$t('entities.ruleengine.editviewtoolbar_toolbar.tbitem1_run.tip')}}</div>
</tooltip> </tooltip>
<tooltip :transfer="true" :max-width="600">
<i-button v-show="toolBarModels.tbitem1_check.visabled" :disabled="toolBarModels.tbitem1_check.disabled" class='' v-loading:i-button @click="toolbar_click({ tag: 'tbitem1_check' }, $event)">
<i class=''></i>
<span class='caption'>{{$t('entities.ruleengine.editviewtoolbar_toolbar.tbitem1_check.caption')}}</span>
</i-button>
<div slot='content'>{{$t('entities.ruleengine.editviewtoolbar_toolbar.tbitem1_check.tip')}}</div>
</tooltip>
<span class='seperator'>|</span> <span class='seperator'>|</span>
<tooltip :transfer="true" :max-width="600"> <tooltip :transfer="true" :max-width="600">
<i-button v-show="toolBarModels.tbitem3.visabled" :disabled="toolBarModels.tbitem3.disabled" class='' v-loading:i-button @click="toolbar_click({ tag: 'tbitem3' }, $event)"> <i-button v-show="toolBarModels.tbitem3.visabled" :disabled="toolBarModels.tbitem3.disabled" class='' v-loading:i-button @click="toolbar_click({ tag: 'tbitem3' }, $event)">
...@@ -388,6 +395,8 @@ export default class RuleEngineEditViewBase extends Vue { ...@@ -388,6 +395,8 @@ export default class RuleEngineEditViewBase extends Vue {
public toolBarModels: any = { public toolBarModels: any = {
tbitem1_run: { name: 'tbitem1_run', actiontarget: 'NONE', caption: '运行', disabled: false, type: 'DEUIACTION', visabled: true,noprivdisplaymode:2,dataaccaction: '', uiaction: { tag: 'run', target: 'SINGLEKEY' } }, tbitem1_run: { name: 'tbitem1_run', actiontarget: 'NONE', caption: '运行', disabled: false, type: 'DEUIACTION', visabled: true,noprivdisplaymode:2,dataaccaction: '', uiaction: { tag: 'run', target: 'SINGLEKEY' } },
tbitem1_check: { name: 'tbitem1_check', actiontarget: 'NONE', caption: '校验', disabled: false, type: 'DEUIACTION', visabled: true,noprivdisplaymode:2,dataaccaction: '', uiaction: { tag: 'Check', target: 'SINGLEKEY' } },
tbitem2: { name: 'tbitem2', type: 'SEPERATOR', visabled: true, dataaccaction: '', uiaction: { } }, tbitem2: { name: 'tbitem2', type: 'SEPERATOR', visabled: true, dataaccaction: '', uiaction: { } },
tbitem3: { name: 'tbitem3', actiontarget: 'NONE', caption: '保存', disabled: false, type: 'DEUIACTION', visabled: true,noprivdisplaymode:2,dataaccaction: '', uiaction: { tag: 'Save', target: '' } }, tbitem3: { name: 'tbitem3', actiontarget: 'NONE', caption: '保存', disabled: false, type: 'DEUIACTION', visabled: true,noprivdisplaymode:2,dataaccaction: '', uiaction: { tag: 'Save', target: '' } },
...@@ -752,6 +761,9 @@ export default class RuleEngineEditViewBase extends Vue { ...@@ -752,6 +761,9 @@ export default class RuleEngineEditViewBase extends Vue {
if (Object.is($event.tag, 'tbitem1_run')) { if (Object.is($event.tag, 'tbitem1_run')) {
this.toolbar_tbitem1_run_click(null, '', $event2); this.toolbar_tbitem1_run_click(null, '', $event2);
} }
if (Object.is($event.tag, 'tbitem1_check')) {
this.toolbar_tbitem1_check_click(null, '', $event2);
}
if (Object.is($event.tag, 'tbitem3')) { if (Object.is($event.tag, 'tbitem3')) {
this.toolbar_tbitem3_click(null, '', $event2); this.toolbar_tbitem3_click(null, '', $event2);
} }
...@@ -863,6 +875,35 @@ export default class RuleEngineEditViewBase extends Vue { ...@@ -863,6 +875,35 @@ export default class RuleEngineEditViewBase extends Vue {
curUIService.RuleEngine_run(datas,contextJO, paramJO, $event, xData,this,"RuleEngine"); curUIService.RuleEngine_run(datas,contextJO, paramJO, $event, xData,this,"RuleEngine");
} }
/**
* 逻辑事件
*
* @param {*} [params={}]
* @param {*} [tag]
* @param {*} [$event]
* @memberof
*/
public toolbar_tbitem1_check_click(params: any = {}, tag?: any, $event?: any) {
// 参数
// 取数
let datas: any[] = [];
let xData: any = null;
// _this 指向容器对象
const _this: any = this;
let paramJO:any = {};
let contextJO:any = {};
xData = this.$refs.form;
if (xData.getDatas && xData.getDatas instanceof Function) {
datas = [...xData.getDatas()];
}
if(params){
datas = [params];
}
// 界面行为
const curUIService:RuleEngineUIService = new RuleEngineUIService();
curUIService.RuleEngine_Check(datas,contextJO, paramJO, $event, xData,this,"RuleEngine");
}
/** /**
* 逻辑事件 * 逻辑事件
* *
......
...@@ -139,6 +139,34 @@ export default class RuleEngineServiceBase extends EntityService { ...@@ -139,6 +139,34 @@ export default class RuleEngineServiceBase extends EntityService {
return res; return res;
} }
/**
* Check接口方法
*
* @param {*} [context={}]
* @param {*} [data={}]
* @param {boolean} [isloading]
* @returns {Promise<any>}
* @memberof RuleEngineServiceBase
*/
public async Check(context: any = {},data: any = {}, isloading?: boolean): Promise<any> {
let res:any = Http.getInstance().post(`/ruleengines/${context.ruleengine}/check`,data,isloading);
return res;
}
/**
* CheckBatch接口方法
*
* @param {*} [context={}]
* @param {*} [data={}]
* @param {boolean} [isloading]
* @returns {Promise<any>}
* @memberof RuleEngineServiceBase
*/
public async CheckBatch(context: any = {},data: any = {}, isloading?: boolean): Promise<any> {
let tempData:any = JSON.parse(JSON.stringify(data));
return await Http.getInstance().post(`/ruleengine/checkbatch`,tempData,isloading);
}
/** /**
* CheckKey接口方法 * CheckKey接口方法
* *
......
...@@ -116,6 +116,87 @@ export default class RuleEngineUIServiceBase extends UIService { ...@@ -116,6 +116,87 @@ export default class RuleEngineUIServiceBase extends UIService {
public initDeMainStateOPPrivsMap(){ public initDeMainStateOPPrivsMap(){
} }
/**
* 校验
*
* @param {any[]} args 当前数据
* @param {any} context 行为附加上下文
* @param {*} [params] 附加参数
* @param {*} [$event] 事件源
* @param {*} [xData] 执行行为所需当前部件
* @param {*} [actionContext] 执行行为上下文
* @param {*} [srfParentDeName] 父实体名称
* @returns {Promise<any>}
*/
public async RuleEngine_Check(args: any[],context:any = {}, params:any = {}, $event?: any, xData?: any,actionContext?: any,srfParentDeName?:string){
let data: any = {};
let parentContext:any = {};
let parentViewParam:any = {};
const _this: any = actionContext;
const _args: any[] = Util.deepCopy(args);
const actionTarget: string | null = 'SINGLEKEY';
Object.assign(context, { ruleengine: '%ruleengine%' });
Object.assign(params, { engine_id: '%ruleengine%' });
Object.assign(params, { engine_name: '%engine_name%' });
if(_this.context){
parentContext = _this.context;
}
if(_this.viewparams){
parentViewParam = _this.viewparams;
}
context = UIActionTool.handleContextParam(actionTarget,_args,parentContext,parentViewParam,context);
data = UIActionTool.handleActionParam(actionTarget,_args,parentContext,parentViewParam,params);
if(Object.is(actionTarget,"MULTIKEY")){
let tempDataArray:Array<any> = [];
if((_args.length >1) && (Object.keys(data).length >0)){
for(let i =0;i<_args.length;i++){
let tempObject:any = {};
Object.keys(data).forEach((key:string) =>{
Object.assign(tempObject,{[key]:data[key].split(',')[i]});
})
tempDataArray.push(tempObject);
}
}else{
tempDataArray.push(data);
}
data = tempDataArray;
}
context = Object.assign({},actionContext.context,context);
let parentObj:any = {srfparentdename:srfParentDeName?srfParentDeName:null,srfparentkey:srfParentDeName?context[srfParentDeName.toLowerCase()]:null};
if(!Object.is(actionTarget,"MULTIKEY")){
Object.assign(data,parentObj);
}
Object.assign(context,parentObj);
// 直接调实体服务需要转换的数据
if(context && context.srfsessionid){
context.srfsessionkey = context.srfsessionid;
delete context.srfsessionid;
}
const backend = () => {
const curService:RuleEngineService = new RuleEngineService();
curService.Check(context,data, true).then((response: any) => {
if (!response || response.status !== 200) {
actionContext.$Notice.error({ title: '错误', desc: response.message });
return;
}
actionContext.$Notice.success({ title: '成功', desc: '校验成功!' });
const _this: any = actionContext;
return response;
}).catch((response: any) => {
if (response && response.status && response.data) {
actionContext.$Notice.error({ title: (actionContext.$t('app.commonWords.wrong') as string), desc: response.data.message });
return;
}
if (!response || !response.status || !response.data) {
actionContext.$Notice.error({ title: (actionContext.$t('app.commonWords.wrong') as string), desc: (actionContext.$t('app.commonWords.sysException') as string) });
return;
}
return response;
});
};
backend();
}
/** /**
* 运行 * 运行
* *
......
...@@ -33,6 +33,8 @@ public interface IRuleEngineService extends IService<RuleEngine> { ...@@ -33,6 +33,8 @@ public interface IRuleEngineService extends IService<RuleEngine> {
void removeBatch(Collection<String> idList); void removeBatch(Collection<String> idList);
RuleEngine get(String key); RuleEngine get(String key);
RuleEngine getDraft(RuleEngine et); RuleEngine getDraft(RuleEngine et);
RuleEngine check(RuleEngine et);
boolean checkBatch(List<RuleEngine> etList);
boolean checkKey(RuleEngine et); boolean checkKey(RuleEngine et);
RuleEngine run(RuleEngine et); RuleEngine run(RuleEngine et);
boolean runBatch(List<RuleEngine> etList); boolean runBatch(List<RuleEngine> etList);
......
...@@ -122,6 +122,22 @@ public class RuleEngineServiceImpl extends ServiceImpl<RuleEngineMapper, RuleEng ...@@ -122,6 +122,22 @@ public class RuleEngineServiceImpl extends ServiceImpl<RuleEngineMapper, RuleEng
return et; return et;
} }
@Override
@Transactional
public RuleEngine check(RuleEngine et) {
//自定义代码
return et;
}
@Override
@Transactional
public boolean checkBatch(List<RuleEngine> etList) {
for(RuleEngine et : etList) {
check(et);
}
return true;
}
@Override @Override
public boolean checkKey(RuleEngine et) { public boolean checkKey(RuleEngine et) {
return (!ObjectUtils.isEmpty(et.getEngineId())) && (!Objects.isNull(this.getById(et.getEngineId()))); return (!ObjectUtils.isEmpty(et.getEngineId())) && (!Objects.isNull(this.getById(et.getEngineId())));
......
...@@ -398,7 +398,7 @@ ...@@ -398,7 +398,7 @@
<!--输出实体[RU_ENGINE]数据结构 --> <!--输出实体[RU_ENGINE]数据结构 -->
<changeSet author="root" id="tab-ru_engine-36-15"> <changeSet author="root" id="tab-ru_engine-38-15">
<createTable tableName="IBZRULEENGINE"> <createTable tableName="IBZRULEENGINE">
<column name="ENGINEID" remarks="" type="VARCHAR(100)"> <column name="ENGINEID" remarks="" type="VARCHAR(100)">
<constraints primaryKey="true" primaryKeyName="PK_RU_ENGINE_ENGINEID"/> <constraints primaryKey="true" primaryKeyName="PK_RU_ENGINE_ENGINEID"/>
......
...@@ -144,7 +144,7 @@ ...@@ -144,7 +144,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":"Run" , "name":"运行" , "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":"Check" , "name":"校验" , "type":"USERCUSTOM" },{"id":"CheckKey" , "name":"CheckKey" , "type":"BUILTIN" },{"id":"Run" , "name":"运行" , "type":"USERCUSTOM" },{"id":"Save" , "name":"Save" , "type":"BUILTIN" }],
"datascope":[{"id":"all","name":"全部数据"}] "datascope":[{"id":"all","name":"全部数据"}]
} }
, { , {
......
...@@ -114,6 +114,23 @@ public class RuleEngineResource { ...@@ -114,6 +114,23 @@ public class RuleEngineResource {
return ResponseEntity.status(HttpStatus.OK).body(ruleengineMapping.toDto(ruleengineService.getDraft(new RuleEngine()))); return ResponseEntity.status(HttpStatus.OK).body(ruleengineMapping.toDto(ruleengineService.getDraft(new RuleEngine())));
} }
@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','ibzdst-RuleEngine-Check-all')")
@ApiOperation(value = "校验", tags = {"规则引擎" }, notes = "校验")
@RequestMapping(method = RequestMethod.POST, value = "/ruleengines/{ruleengine_id}/check")
public ResponseEntity<RuleEngineDTO> check(@PathVariable("ruleengine_id") String ruleengine_id, @RequestBody RuleEngineDTO ruleenginedto) {
RuleEngine domain = ruleengineMapping.toDomain(ruleenginedto);
domain.setEngineId(ruleengine_id);
domain = ruleengineService.check(domain);
ruleenginedto = ruleengineMapping.toDto(domain);
return ResponseEntity.status(HttpStatus.OK).body(ruleenginedto);
}
@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','ibzdst-RuleEngine-Check-all')")
@ApiOperation(value = "批量处理[校验]", tags = {"规则引擎" }, notes = "批量处理[校验]")
@RequestMapping(method = RequestMethod.POST, value = "/ruleengines/{ruleengine_id}/checkbatch")
public ResponseEntity<Boolean> checkBatch(@RequestBody List<RuleEngineDTO> ruleenginedtos) {
return ResponseEntity.status(HttpStatus.OK).body(ruleengineService.checkBatch(ruleengineMapping.toDomain(ruleenginedtos)));
}
@ApiOperation(value = "检查规则引擎", tags = {"规则引擎" }, notes = "检查规则引擎") @ApiOperation(value = "检查规则引擎", tags = {"规则引擎" }, notes = "检查规则引擎")
@RequestMapping(method = RequestMethod.POST, value = "/ruleengines/checkkey") @RequestMapping(method = RequestMethod.POST, value = "/ruleengines/checkkey")
public ResponseEntity<Boolean> checkKey(@RequestBody RuleEngineDTO ruleenginedto) { public ResponseEntity<Boolean> checkKey(@RequestBody RuleEngineDTO ruleenginedto) {
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册