提交 3c81632a 编写于 作者: ibizdev's avatar ibizdev

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

上级 a740f537
......@@ -281,6 +281,44 @@ mock.onPost(new RegExp(/^\/ruleengines\/?([a-zA-Z0-9\-\;]{0,35})\/save$/)).reply
return [status, data];
});
// SyncRun
mock.onPost(new RegExp(/^\/ruleengines\/?([a-zA-Z0-9\-\;]{0,35})\/syncrun$/)).reply((config: any) => {
console.groupCollapsed("实体:ruleengine 方法: SyncRun");
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})\/syncrun$/).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];
});
// Update
mock.onPut(new RegExp(/^\/ruleengines\/?([a-zA-Z0-9\-\;]{0,35})$/)).reply((config: any) => {
console.groupCollapsed("实体:ruleengine 方法: Update");
......
......@@ -194,6 +194,34 @@ export default class RuleEngineServiceBase extends EntityService {
return res;
}
/**
* SyncRun接口方法
*
* @param {*} [context={}]
* @param {*} [data={}]
* @param {boolean} [isloading]
* @returns {Promise<any>}
* @memberof RuleEngineServiceBase
*/
public async SyncRun(context: any = {},data: any = {}, isloading?: boolean): Promise<any> {
let res:any = Http.getInstance().post(`/ruleengines/${context.ruleengine}/syncrun`,data,isloading);
return res;
}
/**
* SyncRunBatch接口方法
*
* @param {*} [context={}]
* @param {*} [data={}]
* @param {boolean} [isloading]
* @returns {Promise<any>}
* @memberof RuleEngineServiceBase
*/
public async SyncRunBatch(context: any = {},data: any = {}, isloading?: boolean): Promise<any> {
let tempData:any = JSON.parse(JSON.stringify(data));
return await Http.getInstance().post(`/ruleengines/syncrunbatch`,tempData,isloading);
}
/**
* Update接口方法
*
......
......@@ -698,7 +698,7 @@ export default class DefaultBase extends Vue implements ControlInterface {
*/
public load(opt: any = {}): void {
if(!this.loadAction){
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: 'DictCatalogGridView' + (this.$t('app.searchForm.notConfig.loadAction') as string) });
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: 'DictCatalogPickupGridView' + (this.$t('app.searchForm.notConfig.loadAction') as string) });
return;
}
const arg: any = { ...opt };
......@@ -734,7 +734,7 @@ export default class DefaultBase extends Vue implements ControlInterface {
*/
public loadDraft(opt: any = {},mode?:string): void {
if(!this.loaddraftAction){
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: 'DictCatalogGridView' + (this.$t('app.searchForm.notConfig.loaddraftAction') as string) });
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: 'DictCatalogPickupGridView' + (this.$t('app.searchForm.notConfig.loaddraftAction') as string) });
return;
}
const arg: any = { ...opt } ;
......
......@@ -838,7 +838,7 @@ export default class DefaultBase extends Vue implements ControlInterface {
*/
public load(opt: any = {}): void {
if(!this.loadAction){
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: 'RuleItemGridView' + (this.$t('app.searchForm.notConfig.loadAction') as string) });
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: 'RuleItemPickupGridView' + (this.$t('app.searchForm.notConfig.loadAction') as string) });
return;
}
const arg: any = { ...opt };
......@@ -874,7 +874,7 @@ export default class DefaultBase extends Vue implements ControlInterface {
*/
public loadDraft(opt: any = {},mode?:string): void {
if(!this.loaddraftAction){
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: 'RuleItemGridView' + (this.$t('app.searchForm.notConfig.loaddraftAction') as string) });
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: 'RuleItemPickupGridView' + (this.$t('app.searchForm.notConfig.loaddraftAction') as string) });
return;
}
const arg: any = { ...opt } ;
......
......@@ -392,20 +392,6 @@ export default class MainBase extends Vue implements ControlInterface {
return this.selections[0];
}
/**
* 打开新建数据视图
*
* @type {any}
* @memberof MainBase
*/
@Prop() public newdata: any;
/**
* 打开编辑数据视图
*
* @type {any}
* @memberof MainBase
*/
@Prop() public opendata: any;
/**
* 是否嵌入关系界面
......@@ -973,7 +959,7 @@ export default class MainBase extends Vue implements ControlInterface {
*/
public load(opt: any = {}, pageReset: boolean = false): void {
if(!this.fetchAction){
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: 'RuleItemGridView'+(this.$t('app.gridpage.notConfig.fetchAction') as string) });
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: 'RuleItemPickupGridView'+(this.$t('app.gridpage.notConfig.fetchAction') as string) });
return;
}
if(pageReset){
......@@ -1068,7 +1054,7 @@ export default class MainBase extends Vue implements ControlInterface {
*/
public async remove(datas: any[]): Promise<any> {
if(!this.removeAction){
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: 'RuleItemGridView'+(this.$t('app.gridpage.notConfig.removeAction') as string) });
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: 'RuleItemPickupGridView'+(this.$t('app.gridpage.notConfig.removeAction') as string) });
return;
}
let _datas:any[] = [];
......@@ -1174,7 +1160,7 @@ export default class MainBase extends Vue implements ControlInterface {
*/
public addBatch(arg: any = {}): void {
if(!this.fetchAction){
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: 'RuleItemGridView'+(this.$t('app.gridpage.notConfig.fetchAction') as string) });
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: 'RuleItemPickupGridView'+(this.$t('app.gridpage.notConfig.fetchAction') as string) });
return;
}
if(!arg){
......@@ -1990,7 +1976,7 @@ export default class MainBase extends Vue implements ControlInterface {
public setColState() {
this.resetColModel = Util.deepCopy(this.allColumns);
const viewParams: any = Util.deepCopy(this.viewparams);
Object.assign(viewParams,{utilServiceName: 'grid_dynaconfig', modelid: 'ibzdst_web_ruleitemgridview_grid_main'});
Object.assign(viewParams,{utilServiceName: 'grid_dynaconfig', modelid: 'ibzdst_web_ruleitempickupgridview_grid_main'});
const post = this.service.loadModel('grid_dynaconfig', this.context, viewParams);
post.then((response: any) => {
if(response.status == 200 && response.data) {
......@@ -2057,7 +2043,7 @@ export default class MainBase extends Vue implements ControlInterface {
*/
public saveDynaConfig() {
const viewParams: any = Util.deepCopy(this.viewparams);
Object.assign(viewParams,{utilServiceName: 'grid_dynaconfig', modelid: 'ibzdst_web_ruleitemgridview_grid_main', model: this.allColumns});
Object.assign(viewParams,{utilServiceName: 'grid_dynaconfig', modelid: 'ibzdst_web_ruleitempickupgridview_grid_main', model: this.allColumns});
const post = this.service.saveModel('grid_dynaconfig', this.context, viewParams);
post.then((response: any) => {
if (response.status == 200) {
......@@ -2128,7 +2114,7 @@ export default class MainBase extends Vue implements ControlInterface {
try {
if(Object.is(item.rowDataState, 'create')){
if(!this.createAction){
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: 'RuleItemGridView'+(this.$t('app.gridpage.notConfig.createAction') as string) });
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: 'RuleItemPickupGridView'+(this.$t('app.gridpage.notConfig.createAction') as string) });
}else{
Object.assign(item,{viewparams:this.viewparams});
let response = await this.service.add(this.createAction, JSON.parse(JSON.stringify(this.context)),item, this.showBusyIndicator);
......@@ -2136,7 +2122,7 @@ export default class MainBase extends Vue implements ControlInterface {
}
}else if(Object.is(item.rowDataState, 'update')){
if(!this.updateAction){
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: 'RuleItemGridView'+(this.$t('app.gridpage.notConfig.updateAction') as string) });
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: 'RuleItemPickupGridView'+(this.$t('app.gridpage.notConfig.updateAction') as string) });
}else{
Object.assign(item,{viewparams:this.viewparams});
if(item.ruleitem){
......@@ -2209,7 +2195,7 @@ export default class MainBase extends Vue implements ControlInterface {
*/
public newRow(args: any[], params?: any, $event?: any, xData?: any): void {
if(!this.loaddraftAction){
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: 'RuleItemGridView'+(this.$t('app.gridpage.notConfig.loaddraftAction') as string) });
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: 'RuleItemPickupGridView'+(this.$t('app.gridpage.notConfig.loaddraftAction') as string) });
return;
}
let _this = this;
......
......@@ -40,6 +40,8 @@ public interface IRuleEngineService extends IService<RuleEngine> {
boolean runBatch(List<RuleEngine> etList);
boolean save(RuleEngine et);
void saveBatch(List<RuleEngine> list);
RuleEngine syncRun(RuleEngine et);
boolean syncRunBatch(List<RuleEngine> etList);
Page<RuleEngine> searchDefault(RuleEngineSearchContext context);
List<RuleEngine> selectByModelId(String id);
void removeByModelId(String id);
......
......@@ -217,6 +217,22 @@ public class RuleEngineServiceImpl extends ServiceImpl<RuleEngineMapper, RuleEng
}
}
@Override
@Transactional
public RuleEngine syncRun(RuleEngine et) {
//自定义代码
return et;
}
@Override
@Transactional
public boolean syncRunBatch(List<RuleEngine> etList) {
for(RuleEngine et : etList) {
syncRun(et);
}
return true;
}
@Override
public List<RuleEngine> selectByModelId(String id) {
......
......@@ -468,7 +468,7 @@
<!--输出实体[RU_ENGINE]数据结构 -->
<changeSet author="root" id="tab-ru_engine-3-17">
<changeSet author="root" id="tab-ru_engine-5-17">
<createTable tableName="IBZRULEENGINE">
<column name="ENGINEID" remarks="" type="VARCHAR(100)">
<constraints primaryKey="true" primaryKeyName="PK_RU_ENGINE_ENGINEID"/>
......
......@@ -161,7 +161,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":"Check" , "name":"校验" , "type":"USERCUSTOM" },{"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" },{"id":"SyncRun" , "name":"同步运行" , "type":"USERCUSTOM" }],
"datascope":[{"id":"all","name":"全部数据"}]
}
, {
......
......@@ -176,6 +176,23 @@ public class RuleEngineResource {
return ResponseEntity.status(HttpStatus.OK).body(true);
}
@ApiOperation(value = "同步运行", tags = {"规则引擎" }, notes = "同步运行")
@RequestMapping(method = RequestMethod.POST, value = "/ruleengines/{ruleengine_id}/syncrun")
public ResponseEntity<RuleEngineDTO> syncRun(@PathVariable("ruleengine_id") String ruleengine_id, @RequestBody RuleEngineDTO ruleenginedto) {
RuleEngine domain = ruleengineMapping.toDomain(ruleenginedto);
domain.setEngineId(ruleengine_id);
domain = ruleengineService.syncRun(domain);
ruleenginedto = ruleengineMapping.toDto(domain);
return ResponseEntity.status(HttpStatus.OK).body(ruleenginedto);
}
@ApiOperation(value = "批量处理[同步运行]", tags = {"规则引擎" }, notes = "批量处理[同步运行]")
@RequestMapping(method = RequestMethod.POST, value = "/ruleengines/syncrunbatch")
public ResponseEntity<Boolean> syncRunBatch(@RequestBody List<RuleEngineDTO> ruleenginedtos) {
List<RuleEngine> domains = ruleengineMapping.toDomain(ruleenginedtos);
boolean result = ruleengineService.syncRunBatch(domains);
return ResponseEntity.status(HttpStatus.OK).body(result);
}
@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','ibzdst-RuleEngine-searchDefault-all')")
@ApiOperation(value = "获取数据集", tags = {"规则引擎" } ,notes = "获取数据集")
@RequestMapping(method= RequestMethod.GET , value="/ruleengines/fetchdefault")
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册