提交 796fa96c 编写于 作者: ibizdev's avatar ibizdev

ibiz4j 发布系统代码

上级 112fca94
......@@ -115,16 +115,16 @@ mock.onGet(new RegExp(/^\/jobsinfos\/([a-zA-Z0-9\-\;]{1,35})\/select$/)).reply((
return [status, _items];
});
// Start
mock.onPost(new RegExp(/^\/jobsinfos\/?([a-zA-Z0-9\-\;]{0,35})\/start$/)).reply((config: any) => {
console.groupCollapsed("实体:jobsinfo 方法: Start");
// Create
mock.onPost(new RegExp(/^\/jobsinfos\/?([a-zA-Z0-9\-\;]{0,35})$/)).reply((config: any) => {
console.groupCollapsed("实体:jobsinfo 方法: Create");
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> = ['id'];
const matchArray:any = new RegExp(/^\/jobsinfos\/([a-zA-Z0-9\-\;]{1,35})\/start$/).exec(config.url);
const matchArray:any = new RegExp(/^\/jobsinfos\/([a-zA-Z0-9\-\;]{1,35})$/).exec(config.url);
let tempValue: any = {};
if(matchArray && matchArray.length >1 && paramArray && paramArray.length >0){
paramArray.forEach((item: any, index: number) => {
......@@ -134,23 +134,11 @@ mock.onPost(new RegExp(/^\/jobsinfos\/?([a-zA-Z0-9\-\;]{0,35})\/start$/)).reply(
});
});
}
//let items = mockDatas ? mockDatas : [];
//let _items = items.find((item: any) => Object.is(item.id, tempValue.id));
let data = JSON.parse(config.data);
mockDatas.forEach((item)=>{
if(item['id'] == tempValue['id'] ){
for(let value in data){
if(item.hasOwnProperty(value)){
item[value] = data[value];
}
}
}
})
console.groupCollapsed("response数据 status: "+status+" data: ");
console.table(data);
console.table(mockDatas[0]);
console.groupEnd();
console.groupEnd();
return [status, data];
return [status, mockDatas[0]];
});
// Update
......@@ -190,6 +178,22 @@ mock.onPut(new RegExp(/^\/jobsinfos\/?([a-zA-Z0-9\-\;]{0,35})$/)).reply((config:
console.groupEnd();
return [status, data];
});
// GetDraft
mock.onGet(new RegExp(/^\/jobsinfos\/getdraft$/)).reply((config: any) => {
console.groupCollapsed("实体:jobsinfo 方法: GetDraft");
console.table({url:config.url, method: config.method, data:config.data});
// GetDraft
let status = MockAdapter.mockStatus(config);
if (status !== 200) {
return [status, null];
}
console.groupCollapsed("response数据 status: "+status+" data: ");
console.table({});
console.groupEnd();
console.groupEnd();
return [status, {}];
});
// CheckKey
mock.onPost(new RegExp(/^\/jobsinfos\/?([a-zA-Z0-9\-\;]{0,35})\/checkkey$/)).reply((config: any) => {
......@@ -304,33 +308,17 @@ mock.onPost(new RegExp(/^\/jobsinfos\/?([a-zA-Z0-9\-\;]{0,35})\/save$/)).reply((
console.groupEnd();
return [status, data];
});
// GetDraft
mock.onGet(new RegExp(/^\/jobsinfos\/getdraft$/)).reply((config: any) => {
console.groupCollapsed("实体:jobsinfo 方法: GetDraft");
console.table({url:config.url, method: config.method, data:config.data});
// GetDraft
let status = MockAdapter.mockStatus(config);
if (status !== 200) {
return [status, null];
}
console.groupCollapsed("response数据 status: "+status+" data: ");
console.table({});
console.groupEnd();
console.groupEnd();
return [status, {}];
});
// Create
mock.onPost(new RegExp(/^\/jobsinfos\/?([a-zA-Z0-9\-\;]{0,35})$/)).reply((config: any) => {
console.groupCollapsed("实体:jobsinfo 方法: Create");
// Start
mock.onPost(new RegExp(/^\/jobsinfos\/?([a-zA-Z0-9\-\;]{0,35})\/start$/)).reply((config: any) => {
console.groupCollapsed("实体:jobsinfo 方法: Start");
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> = ['id'];
const matchArray:any = new RegExp(/^\/jobsinfos\/([a-zA-Z0-9\-\;]{1,35})$/).exec(config.url);
const matchArray:any = new RegExp(/^\/jobsinfos\/([a-zA-Z0-9\-\;]{1,35})\/start$/).exec(config.url);
let tempValue: any = {};
if(matchArray && matchArray.length >1 && paramArray && paramArray.length >0){
paramArray.forEach((item: any, index: number) => {
......@@ -340,11 +328,23 @@ mock.onPost(new RegExp(/^\/jobsinfos\/?([a-zA-Z0-9\-\;]{0,35})$/)).reply((config
});
});
}
//let items = mockDatas ? mockDatas : [];
//let _items = items.find((item: any) => Object.is(item.id, tempValue.id));
let data = JSON.parse(config.data);
mockDatas.forEach((item)=>{
if(item['id'] == tempValue['id'] ){
for(let value in data){
if(item.hasOwnProperty(value)){
item[value] = data[value];
}
}
}
})
console.groupCollapsed("response数据 status: "+status+" data: ");
console.table(mockDatas[0]);
console.table(data);
console.groupEnd();
console.groupEnd();
return [status, mockDatas[0]];
return [status, data];
});
// Stop
......
......@@ -141,16 +141,16 @@ mock.onPost(new RegExp(/^\/jobslocks\/?([a-zA-Z0-9\-\;]{0,35})$/)).reply((config
return [status, mockDatas[0]];
});
// Save
mock.onPost(new RegExp(/^\/jobslocks\/?([a-zA-Z0-9\-\;]{0,35})\/save$/)).reply((config: any) => {
console.groupCollapsed("实体:jobslock 方法: Save");
// Update
mock.onPut(new RegExp(/^\/jobslocks\/?([a-zA-Z0-9\-\;]{0,35})$/)).reply((config: any) => {
console.groupCollapsed("实体:jobslock 方法: Update");
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> = ['id'];
const matchArray:any = new RegExp(/^\/jobslocks\/([a-zA-Z0-9\-\;]{1,35})\/save$/).exec(config.url);
const matchArray:any = new RegExp(/^\/jobslocks\/([a-zA-Z0-9\-\;]{1,35})$/).exec(config.url);
let tempValue: any = {};
if(matchArray && matchArray.length >1 && paramArray && paramArray.length >0){
paramArray.forEach((item: any, index: number) => {
......@@ -178,17 +178,33 @@ mock.onPost(new RegExp(/^\/jobslocks\/?([a-zA-Z0-9\-\;]{0,35})\/save$/)).reply((
console.groupEnd();
return [status, data];
});
// GetDraft
mock.onGet(new RegExp(/^\/jobslocks\/getdraft$/)).reply((config: any) => {
console.groupCollapsed("实体:jobslock 方法: GetDraft");
console.table({url:config.url, method: config.method, data:config.data});
// GetDraft
let status = MockAdapter.mockStatus(config);
if (status !== 200) {
return [status, null];
}
console.groupCollapsed("response数据 status: "+status+" data: ");
console.table({});
console.groupEnd();
console.groupEnd();
return [status, {}];
});
// Update
mock.onPut(new RegExp(/^\/jobslocks\/?([a-zA-Z0-9\-\;]{0,35})$/)).reply((config: any) => {
console.groupCollapsed("实体:jobslock 方法: Update");
// CheckKey
mock.onPost(new RegExp(/^\/jobslocks\/?([a-zA-Z0-9\-\;]{0,35})\/checkkey$/)).reply((config: any) => {
console.groupCollapsed("实体:jobslock 方法: CheckKey");
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> = ['id'];
const matchArray:any = new RegExp(/^\/jobslocks\/([a-zA-Z0-9\-\;]{1,35})$/).exec(config.url);
const matchArray:any = new RegExp(/^\/jobslocks\/([a-zA-Z0-9\-\;]{1,35})\/checkkey$/).exec(config.url);
let tempValue: any = {};
if(matchArray && matchArray.length >1 && paramArray && paramArray.length >0){
paramArray.forEach((item: any, index: number) => {
......@@ -217,16 +233,16 @@ mock.onPut(new RegExp(/^\/jobslocks\/?([a-zA-Z0-9\-\;]{0,35})$/)).reply((config:
return [status, data];
});
// CheckKey
mock.onPost(new RegExp(/^\/jobslocks\/?([a-zA-Z0-9\-\;]{0,35})\/checkkey$/)).reply((config: any) => {
console.groupCollapsed("实体:jobslock 方法: CheckKey");
// Save
mock.onPost(new RegExp(/^\/jobslocks\/?([a-zA-Z0-9\-\;]{0,35})\/save$/)).reply((config: any) => {
console.groupCollapsed("实体:jobslock 方法: Save");
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> = ['id'];
const matchArray:any = new RegExp(/^\/jobslocks\/([a-zA-Z0-9\-\;]{1,35})\/checkkey$/).exec(config.url);
const matchArray:any = new RegExp(/^\/jobslocks\/([a-zA-Z0-9\-\;]{1,35})\/save$/).exec(config.url);
let tempValue: any = {};
if(matchArray && matchArray.length >1 && paramArray && paramArray.length >0){
paramArray.forEach((item: any, index: number) => {
......@@ -254,22 +270,6 @@ mock.onPost(new RegExp(/^\/jobslocks\/?([a-zA-Z0-9\-\;]{0,35})\/checkkey$/)).rep
console.groupEnd();
return [status, data];
});
// GetDraft
mock.onGet(new RegExp(/^\/jobslocks\/getdraft$/)).reply((config: any) => {
console.groupCollapsed("实体:jobslock 方法: GetDraft");
console.table({url:config.url, method: config.method, data:config.data});
// GetDraft
let status = MockAdapter.mockStatus(config);
if (status !== 200) {
return [status, null];
}
console.groupCollapsed("response数据 status: "+status+" data: ");
console.table({});
console.groupEnd();
console.groupEnd();
return [status, {}];
});
// FetchDefault
mock.onGet(new RegExp(/^\/jobslocks\/fetchdefault$/)).reply((config: any) => {
......@@ -323,9 +323,9 @@ mock.onGet(new RegExp(/^\/jobslocks\/fetchdefault(\?[\w-./?%&=,]*)*$/)).reply((c
// URI参数传递情况未实现
// Get
mock.onGet(new RegExp(/^\/jobslocks\/([a-zA-Z0-9\-\;]{1,35})$/)).reply((config: any) => {
console.groupCollapsed("实体:jobslock 方法: Get");
// Remove
mock.onDelete(new RegExp(/^\/jobslocks\/([a-zA-Z0-9\-\;]{1,35})$/)).reply((config: any) => {
console.groupCollapsed("实体:jobslock 方法: Remove");
console.table({url:config.url, method: config.method, data:config.data});
let status = MockAdapter.mockStatus(config);
if (status !== 200) {
......@@ -351,9 +351,9 @@ mock.onGet(new RegExp(/^\/jobslocks\/([a-zA-Z0-9\-\;]{1,35})$/)).reply((config:
return [status, _items?_items:{}];
});
// Remove
mock.onDelete(new RegExp(/^\/jobslocks\/([a-zA-Z0-9\-\;]{1,35})$/)).reply((config: any) => {
console.groupCollapsed("实体:jobslock 方法: Remove");
// Get
mock.onGet(new RegExp(/^\/jobslocks\/([a-zA-Z0-9\-\;]{1,35})$/)).reply((config: any) => {
console.groupCollapsed("实体:jobslock 方法: Get");
console.table({url:config.url, method: config.method, data:config.data});
let status = MockAdapter.mockStatus(config);
if (status !== 200) {
......
......@@ -114,21 +114,31 @@ mock.onGet(new RegExp(/^\/jobslogs\/([a-zA-Z0-9\-\;]{1,35})\/select$/)).reply((c
console.groupEnd();
return [status, _items];
});
// GetDraft
mock.onGet(new RegExp(/^\/jobslogs\/getdraft$/)).reply((config: any) => {
console.groupCollapsed("实体:jobslog 方法: GetDraft");
// Create
mock.onPost(new RegExp(/^\/jobslogs\/?([a-zA-Z0-9\-\;]{0,35})$/)).reply((config: any) => {
console.groupCollapsed("实体:jobslog 方法: Create");
console.table({url:config.url, method: config.method, data:config.data});
// GetDraft
let status = MockAdapter.mockStatus(config);
if (status !== 200) {
return [status, null];
}
const paramArray:Array<any> = ['id'];
const matchArray:any = new RegExp(/^\/jobslogs\/([a-zA-Z0-9\-\;]{1,35})$/).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]
});
});
}
console.groupCollapsed("response数据 status: "+status+" data: ");
console.table({});
console.table(mockDatas[0]);
console.groupEnd();
console.groupEnd();
return [status, {}];
return [status, mockDatas[0]];
});
// Update
......@@ -168,31 +178,21 @@ mock.onPut(new RegExp(/^\/jobslogs\/?([a-zA-Z0-9\-\;]{0,35})$/)).reply((config:
console.groupEnd();
return [status, data];
});
// Create
mock.onPost(new RegExp(/^\/jobslogs\/?([a-zA-Z0-9\-\;]{0,35})$/)).reply((config: any) => {
console.groupCollapsed("实体:jobslog 方法: Create");
// GetDraft
mock.onGet(new RegExp(/^\/jobslogs\/getdraft$/)).reply((config: any) => {
console.groupCollapsed("实体:jobslog 方法: GetDraft");
console.table({url:config.url, method: config.method, data:config.data});
// GetDraft
let status = MockAdapter.mockStatus(config);
if (status !== 200) {
return [status, null];
}
const paramArray:Array<any> = ['id'];
const matchArray:any = new RegExp(/^\/jobslogs\/([a-zA-Z0-9\-\;]{1,35})$/).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]
});
});
}
console.groupCollapsed("response数据 status: "+status+" data: ");
console.table(mockDatas[0]);
console.table({});
console.groupEnd();
console.groupEnd();
return [status, mockDatas[0]];
return [status, {}];
});
// CheckKey
......
......@@ -115,9 +115,9 @@ mock.onGet(new RegExp(/^\/jobsregistries\/([a-zA-Z0-9\-\;]{1,35})\/select$/)).re
return [status, _items];
});
// Update
mock.onPut(new RegExp(/^\/jobsregistries\/?([a-zA-Z0-9\-\;]{0,35})$/)).reply((config: any) => {
console.groupCollapsed("实体:jobsregistry 方法: Update");
// Create
mock.onPost(new RegExp(/^\/jobsregistries\/?([a-zA-Z0-9\-\;]{0,35})$/)).reply((config: any) => {
console.groupCollapsed("实体:jobsregistry 方法: Create");
console.table({url:config.url, method: config.method, data:config.data});
let status = MockAdapter.mockStatus(config);
if (status !== 200) {
......@@ -134,35 +134,23 @@ mock.onPut(new RegExp(/^\/jobsregistries\/?([a-zA-Z0-9\-\;]{0,35})$/)).reply((co
});
});
}
//let items = mockDatas ? mockDatas : [];
//let _items = items.find((item: any) => Object.is(item.id, tempValue.id));
let data = JSON.parse(config.data);
mockDatas.forEach((item)=>{
if(item['id'] == tempValue['id'] ){
for(let value in data){
if(item.hasOwnProperty(value)){
item[value] = data[value];
}
}
}
})
console.groupCollapsed("response数据 status: "+status+" data: ");
console.table(data);
console.table(mockDatas[0]);
console.groupEnd();
console.groupEnd();
return [status, data];
return [status, mockDatas[0]];
});
// Save
mock.onPost(new RegExp(/^\/jobsregistries\/?([a-zA-Z0-9\-\;]{0,35})\/save$/)).reply((config: any) => {
console.groupCollapsed("实体:jobsregistry 方法: Save");
// Update
mock.onPut(new RegExp(/^\/jobsregistries\/?([a-zA-Z0-9\-\;]{0,35})$/)).reply((config: any) => {
console.groupCollapsed("实体:jobsregistry 方法: Update");
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> = ['id'];
const matchArray:any = new RegExp(/^\/jobsregistries\/([a-zA-Z0-9\-\;]{1,35})\/save$/).exec(config.url);
const matchArray:any = new RegExp(/^\/jobsregistries\/([a-zA-Z0-9\-\;]{1,35})$/).exec(config.url);
let tempValue: any = {};
if(matchArray && matchArray.length >1 && paramArray && paramArray.length >0){
paramArray.forEach((item: any, index: number) => {
......@@ -190,31 +178,21 @@ mock.onPost(new RegExp(/^\/jobsregistries\/?([a-zA-Z0-9\-\;]{0,35})\/save$/)).re
console.groupEnd();
return [status, data];
});
// Create
mock.onPost(new RegExp(/^\/jobsregistries\/?([a-zA-Z0-9\-\;]{0,35})$/)).reply((config: any) => {
console.groupCollapsed("实体:jobsregistry 方法: Create");
// GetDraft
mock.onGet(new RegExp(/^\/jobsregistries\/getdraft$/)).reply((config: any) => {
console.groupCollapsed("实体:jobsregistry 方法: GetDraft");
console.table({url:config.url, method: config.method, data:config.data});
// GetDraft
let status = MockAdapter.mockStatus(config);
if (status !== 200) {
return [status, null];
}
const paramArray:Array<any> = ['id'];
const matchArray:any = new RegExp(/^\/jobsregistries\/([a-zA-Z0-9\-\;]{1,35})$/).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]
});
});
}
console.groupCollapsed("response数据 status: "+status+" data: ");
console.table(mockDatas[0]);
console.table({});
console.groupEnd();
console.groupEnd();
return [status, mockDatas[0]];
return [status, {}];
});
// CheckKey
......@@ -254,21 +232,43 @@ mock.onPost(new RegExp(/^\/jobsregistries\/?([a-zA-Z0-9\-\;]{0,35})\/checkkey$/)
console.groupEnd();
return [status, data];
});
// GetDraft
mock.onGet(new RegExp(/^\/jobsregistries\/getdraft$/)).reply((config: any) => {
console.groupCollapsed("实体:jobsregistry 方法: GetDraft");
// Save
mock.onPost(new RegExp(/^\/jobsregistries\/?([a-zA-Z0-9\-\;]{0,35})\/save$/)).reply((config: any) => {
console.groupCollapsed("实体:jobsregistry 方法: Save");
console.table({url:config.url, method: config.method, data:config.data});
// GetDraft
let status = MockAdapter.mockStatus(config);
if (status !== 200) {
return [status, null];
}
const paramArray:Array<any> = ['id'];
const matchArray:any = new RegExp(/^\/jobsregistries\/([a-zA-Z0-9\-\;]{1,35})\/save$/).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.id, tempValue.id));
let data = JSON.parse(config.data);
mockDatas.forEach((item)=>{
if(item['id'] == tempValue['id'] ){
for(let value in data){
if(item.hasOwnProperty(value)){
item[value] = data[value];
}
}
}
})
console.groupCollapsed("response数据 status: "+status+" data: ");
console.table({});
console.table(data);
console.groupEnd();
console.groupEnd();
return [status, {}];
return [status, data];
});
// FetchDefault
......@@ -323,9 +323,9 @@ mock.onGet(new RegExp(/^\/jobsregistries\/fetchdefault(\?[\w-./?%&=,]*)*$/)).rep
// URI参数传递情况未实现
// Get
mock.onGet(new RegExp(/^\/jobsregistries\/([a-zA-Z0-9\-\;]{1,35})$/)).reply((config: any) => {
console.groupCollapsed("实体:jobsregistry 方法: Get");
// Remove
mock.onDelete(new RegExp(/^\/jobsregistries\/([a-zA-Z0-9\-\;]{1,35})$/)).reply((config: any) => {
console.groupCollapsed("实体:jobsregistry 方法: Remove");
console.table({url:config.url, method: config.method, data:config.data});
let status = MockAdapter.mockStatus(config);
if (status !== 200) {
......@@ -351,9 +351,9 @@ mock.onGet(new RegExp(/^\/jobsregistries\/([a-zA-Z0-9\-\;]{1,35})$/)).reply((con
return [status, _items?_items:{}];
});
// Remove
mock.onDelete(new RegExp(/^\/jobsregistries\/([a-zA-Z0-9\-\;]{1,35})$/)).reply((config: any) => {
console.groupCollapsed("实体:jobsregistry 方法: Remove");
// Get
mock.onGet(new RegExp(/^\/jobsregistries\/([a-zA-Z0-9\-\;]{1,35})$/)).reply((config: any) => {
console.groupCollapsed("实体:jobsregistry 方法: Get");
console.table({url:config.url, method: config.method, data:config.data});
let status = MockAdapter.mockStatus(config);
if (status !== 200) {
......
......@@ -1015,14 +1015,58 @@ export default class JobsInfoGridViewBase extends Vue {
}
!!!!模版产生代码错误:----
Tip: If the failing expression is known to be legally refer to something that's sometimes null or missing, either specify a default value like myOptionalVar!myDefault, or use <#if myOptionalVar??>when-present<#else>when-missing</#if>. (These only cover the last step of the expression; to cover the whole expression, use parenthesis: (myOptionalVar.foo)!myDefault, (myOptionalVar.foo)??
----
----
FTL stack trace ("~" means nesting-related):
- Failed at: #if ctrl.getPSControlContainer().getV... [in template "TEMPLCODE_zh_CN" at line 43, column 5]
----
/**
* 打开编辑数据视图
*
* @param {any[]} args
* @param {*} [params]
* @param {*} [fullargs]
* @param {*} [$event]
* @param {*} [xData]
* @memberof JobsInfoGridView
*/
public opendata(args: any[],fullargs?:any[],params?: any, $event?: any, xData?: any) {
if(!this.viewDefaultUsage){
if(Object.is(this.navModel,"route")){
this.initNavDataWithRoute(this.viewCacheData, false, true);
}else{
this.initNavDataWithTab(this.viewCacheData, false, true);
}
}
let localContext:any = null;
let localViewParam:any =null;
const data: any = {};
let tempContext = JSON.parse(JSON.stringify(this.context));
if(args.length >0){
Object.assign(tempContext,args[0]);
}
const deResParameters: any[] = [];
const parameters: any[] = [
{ pathName: 'jobsinfos', parameterName: 'jobsinfo' },
];
const _this: any = this;
const openDrawer = (view: any, data: any) => {
let container: Subject<any> = this.$appdrawer.openDrawer(view, tempContext, data);
container.subscribe((result: any) => {
if (!result || !Object.is(result.ret, 'OK')) {
return;
}
if (!xData || !(xData.refresh instanceof Function)) {
return;
}
xData.refresh(result.datas);
});
}
const view: any = {
viewname: 'jobs-info-edit-view',
height: 0,
width: 0,
title: this.$t('entities.jobsinfo.views.editview.title'),
placement: 'DRAWER_RIGHT',
};
openDrawer(view, data);
}
/**
* 新建
......
......@@ -708,14 +708,58 @@ export default class JobsLogGridViewBase extends Vue {
}
!!!!模版产生代码错误:----
Tip: If the failing expression is known to be legally refer to something that's sometimes null or missing, either specify a default value like myOptionalVar!myDefault, or use <#if myOptionalVar??>when-present<#else>when-missing</#if>. (These only cover the last step of the expression; to cover the whole expression, use parenthesis: (myOptionalVar.foo)!myDefault, (myOptionalVar.foo)??
----
----
FTL stack trace ("~" means nesting-related):
- Failed at: #if ctrl.getPSControlContainer().getV... [in template "TEMPLCODE_zh_CN" at line 43, column 5]
----
/**
* 打开编辑数据视图
*
* @param {any[]} args
* @param {*} [params]
* @param {*} [fullargs]
* @param {*} [$event]
* @param {*} [xData]
* @memberof JobsLogGridView
*/
public opendata(args: any[],fullargs?:any[],params?: any, $event?: any, xData?: any) {
if(!this.viewDefaultUsage){
if(Object.is(this.navModel,"route")){
this.initNavDataWithRoute(this.viewCacheData, false, true);
}else{
this.initNavDataWithTab(this.viewCacheData, false, true);
}
}
let localContext:any = null;
let localViewParam:any =null;
const data: any = {};
let tempContext = JSON.parse(JSON.stringify(this.context));
if(args.length >0){
Object.assign(tempContext,args[0]);
}
const deResParameters: any[] = [];
const parameters: any[] = [
{ pathName: 'jobslogs', parameterName: 'jobslog' },
];
const _this: any = this;
const openDrawer = (view: any, data: any) => {
let container: Subject<any> = this.$appdrawer.openDrawer(view, tempContext, data);
container.subscribe((result: any) => {
if (!result || !Object.is(result.ret, 'OK')) {
return;
}
if (!xData || !(xData.refresh instanceof Function)) {
return;
}
xData.refresh(result.datas);
});
}
const view: any = {
viewname: 'jobs-log-edit-view',
height: 0,
width: 0,
title: this.$t('entities.jobslog.views.editview.title'),
placement: 'DRAWER_RIGHT',
};
openDrawer(view, data);
}
/**
......
......@@ -922,14 +922,58 @@ export default class JobsRegistryGridViewBase extends Vue {
}
!!!!模版产生代码错误:----
Tip: If the failing expression is known to be legally refer to something that's sometimes null or missing, either specify a default value like myOptionalVar!myDefault, or use <#if myOptionalVar??>when-present<#else>when-missing</#if>. (These only cover the last step of the expression; to cover the whole expression, use parenthesis: (myOptionalVar.foo)!myDefault, (myOptionalVar.foo)??
----
----
FTL stack trace ("~" means nesting-related):
- Failed at: #if ctrl.getPSControlContainer().getV... [in template "TEMPLCODE_zh_CN" at line 43, column 5]
----
/**
* 打开编辑数据视图
*
* @param {any[]} args
* @param {*} [params]
* @param {*} [fullargs]
* @param {*} [$event]
* @param {*} [xData]
* @memberof JobsRegistryGridView
*/
public opendata(args: any[],fullargs?:any[],params?: any, $event?: any, xData?: any) {
if(!this.viewDefaultUsage){
if(Object.is(this.navModel,"route")){
this.initNavDataWithRoute(this.viewCacheData, false, true);
}else{
this.initNavDataWithTab(this.viewCacheData, false, true);
}
}
let localContext:any = null;
let localViewParam:any =null;
const data: any = {};
let tempContext = JSON.parse(JSON.stringify(this.context));
if(args.length >0){
Object.assign(tempContext,args[0]);
}
const deResParameters: any[] = [];
const parameters: any[] = [
{ pathName: 'jobsregistries', parameterName: 'jobsregistry' },
];
const _this: any = this;
const openDrawer = (view: any, data: any) => {
let container: Subject<any> = this.$appdrawer.openDrawer(view, tempContext, data);
container.subscribe((result: any) => {
if (!result || !Object.is(result.ret, 'OK')) {
return;
}
if (!xData || !(xData.refresh instanceof Function)) {
return;
}
xData.refresh(result.datas);
});
}
const view: any = {
viewname: 'jobs-registry-edit-view',
height: 0,
width: 0,
title: this.$t('entities.jobsregistry.views.editview.title'),
placement: 'DRAWER_RIGHT',
};
openDrawer(view, data);
}
/**
* 新建
......
......@@ -53,7 +53,7 @@ export default class JobsInfoServiceBase extends EntityService {
}
/**
* Start接口方法
* Create接口方法
*
* @param {*} [context={}]
* @param {*} [data={}]
......@@ -61,8 +61,17 @@ export default class JobsInfoServiceBase extends EntityService {
* @returns {Promise<any>}
* @memberof JobsInfoServiceBase
*/
public async Start(context: any = {},data: any = {}, isloading?: boolean): Promise<any> {
let res:any = await Http.getInstance().post(`/jobsinfos/${context.jobsinfo}/start`,data,isloading);
public async Create(context: any = {},data: any = {}, isloading?: boolean): Promise<any> {
let masterData:any = {};
Object.assign(data,masterData);
if(!data.srffrontuf || data.srffrontuf !== "1"){
data[this.APPDEKEY] = null;
}
if(data.srffrontuf){
delete data.srffrontuf;
}
let tempContext:any = JSON.parse(JSON.stringify(context));
let res:any = await Http.getInstance().post(`/jobsinfos`,data,isloading);
return res;
}
......@@ -83,7 +92,7 @@ export default class JobsInfoServiceBase extends EntityService {
}
/**
* CheckKey接口方法
* Remove接口方法
*
* @param {*} [context={}]
* @param {*} [data={}]
......@@ -91,13 +100,13 @@ export default class JobsInfoServiceBase extends EntityService {
* @returns {Promise<any>}
* @memberof JobsInfoServiceBase
*/
public async CheckKey(context: any = {},data: any = {}, isloading?: boolean): Promise<any> {
let res:any = await Http.getInstance().post(`/jobsinfos/${context.jobsinfo}/checkkey`,data,isloading);
public async Remove(context: any = {},data: any = {}, isloading?: boolean): Promise<any> {
let res:any = await Http.getInstance().delete(`/jobsinfos/${context.jobsinfo}`,isloading);
return res;
}
/**
* Execute接口方法
* Get接口方法
*
* @param {*} [context={}]
* @param {*} [data={}]
......@@ -105,13 +114,13 @@ export default class JobsInfoServiceBase extends EntityService {
* @returns {Promise<any>}
* @memberof JobsInfoServiceBase
*/
public async Execute(context: any = {},data: any = {}, isloading?: boolean): Promise<any> {
let res:any = await Http.getInstance().post(`/jobsinfos/${context.jobsinfo}/execute`,data,isloading);
public async Get(context: any = {},data: any = {}, isloading?: boolean): Promise<any> {
let res:any = await Http.getInstance().get(`/jobsinfos/${context.jobsinfo}`,isloading);
return res;
}
/**
* Save接口方法
* GetDraft接口方法
*
* @param {*} [context={}]
* @param {*} [data={}]
......@@ -119,15 +128,14 @@ export default class JobsInfoServiceBase extends EntityService {
* @returns {Promise<any>}
* @memberof JobsInfoServiceBase
*/
public async Save(context: any = {},data: any = {}, isloading?: boolean): Promise<any> {
let masterData:any = {};
Object.assign(data,masterData);
let res:any = await Http.getInstance().post(`/jobsinfos/${context.jobsinfo}/save`,data,isloading);
public async GetDraft(context: any = {},data: any = {}, isloading?: boolean): Promise<any> {
let res:any = await Http.getInstance().get(`/jobsinfos/getdraft`,isloading);
res.data.jobsinfo = data.jobsinfo;
return res;
}
/**
* GetDraft接口方法
* CheckKey接口方法
*
* @param {*} [context={}]
* @param {*} [data={}]
......@@ -135,14 +143,13 @@ export default class JobsInfoServiceBase extends EntityService {
* @returns {Promise<any>}
* @memberof JobsInfoServiceBase
*/
public async GetDraft(context: any = {},data: any = {}, isloading?: boolean): Promise<any> {
let res:any = await Http.getInstance().get(`/jobsinfos/getdraft`,isloading);
res.data.jobsinfo = data.jobsinfo;
public async CheckKey(context: any = {},data: any = {}, isloading?: boolean): Promise<any> {
let res:any = await Http.getInstance().post(`/jobsinfos/${context.jobsinfo}/checkkey`,data,isloading);
return res;
}
/**
* Remove接口方法
* Execute接口方法
*
* @param {*} [context={}]
* @param {*} [data={}]
......@@ -150,13 +157,13 @@ export default class JobsInfoServiceBase extends EntityService {
* @returns {Promise<any>}
* @memberof JobsInfoServiceBase
*/
public async Remove(context: any = {},data: any = {}, isloading?: boolean): Promise<any> {
let res:any = await Http.getInstance().delete(`/jobsinfos/${context.jobsinfo}`,isloading);
public async Execute(context: any = {},data: any = {}, isloading?: boolean): Promise<any> {
let res:any = await Http.getInstance().post(`/jobsinfos/${context.jobsinfo}/execute`,data,isloading);
return res;
}
/**
* Get接口方法
* Save接口方法
*
* @param {*} [context={}]
* @param {*} [data={}]
......@@ -164,13 +171,15 @@ export default class JobsInfoServiceBase extends EntityService {
* @returns {Promise<any>}
* @memberof JobsInfoServiceBase
*/
public async Get(context: any = {},data: any = {}, isloading?: boolean): Promise<any> {
let res:any = await Http.getInstance().get(`/jobsinfos/${context.jobsinfo}`,isloading);
public async Save(context: any = {},data: any = {}, isloading?: boolean): Promise<any> {
let masterData:any = {};
Object.assign(data,masterData);
let res:any = await Http.getInstance().post(`/jobsinfos/${context.jobsinfo}/save`,data,isloading);
return res;
}
/**
* Create接口方法
* Start接口方法
*
* @param {*} [context={}]
* @param {*} [data={}]
......@@ -178,17 +187,8 @@ export default class JobsInfoServiceBase extends EntityService {
* @returns {Promise<any>}
* @memberof JobsInfoServiceBase
*/
public async Create(context: any = {},data: any = {}, isloading?: boolean): Promise<any> {
let masterData:any = {};
Object.assign(data,masterData);
if(!data.srffrontuf || data.srffrontuf !== "1"){
data[this.APPDEKEY] = null;
}
if(data.srffrontuf){
delete data.srffrontuf;
}
let tempContext:any = JSON.parse(JSON.stringify(context));
let res:any = await Http.getInstance().post(`/jobsinfos`,data,isloading);
public async Start(context: any = {},data: any = {}, isloading?: boolean): Promise<any> {
let res:any = await Http.getInstance().post(`/jobsinfos/${context.jobsinfo}/start`,data,isloading);
return res;
}
......
......@@ -76,7 +76,7 @@ export default class JobsLockServiceBase extends EntityService {
}
/**
* Save接口方法
* Update接口方法
*
* @param {*} [context={}]
* @param {*} [data={}]
......@@ -84,15 +84,15 @@ export default class JobsLockServiceBase extends EntityService {
* @returns {Promise<any>}
* @memberof JobsLockServiceBase
*/
public async Save(context: any = {},data: any = {}, isloading?: boolean): Promise<any> {
public async Update(context: any = {},data: any = {}, isloading?: boolean): Promise<any> {
let masterData:any = {};
Object.assign(data,masterData);
let res:any = await Http.getInstance().post(`/jobslocks/${context.jobslock}/save`,data,isloading);
let res:any = await Http.getInstance().put(`/jobslocks/${context.jobslock}`,data,isloading);
return res;
}
/**
* Get接口方法
* Remove接口方法
*
* @param {*} [context={}]
* @param {*} [data={}]
......@@ -100,13 +100,13 @@ export default class JobsLockServiceBase extends EntityService {
* @returns {Promise<any>}
* @memberof JobsLockServiceBase
*/
public async Get(context: any = {},data: any = {}, isloading?: boolean): Promise<any> {
let res:any = await Http.getInstance().get(`/jobslocks/${context.jobslock}`,isloading);
public async Remove(context: any = {},data: any = {}, isloading?: boolean): Promise<any> {
let res:any = await Http.getInstance().delete(`/jobslocks/${context.jobslock}`,isloading);
return res;
}
/**
* Update接口方法
* Get接口方法
*
* @param {*} [context={}]
* @param {*} [data={}]
......@@ -114,15 +114,13 @@ export default class JobsLockServiceBase extends EntityService {
* @returns {Promise<any>}
* @memberof JobsLockServiceBase
*/
public async Update(context: any = {},data: any = {}, isloading?: boolean): Promise<any> {
let masterData:any = {};
Object.assign(data,masterData);
let res:any = await Http.getInstance().put(`/jobslocks/${context.jobslock}`,data,isloading);
public async Get(context: any = {},data: any = {}, isloading?: boolean): Promise<any> {
let res:any = await Http.getInstance().get(`/jobslocks/${context.jobslock}`,isloading);
return res;
}
/**
* CheckKey接口方法
* GetDraft接口方法
*
* @param {*} [context={}]
* @param {*} [data={}]
......@@ -130,13 +128,14 @@ export default class JobsLockServiceBase extends EntityService {
* @returns {Promise<any>}
* @memberof JobsLockServiceBase
*/
public async CheckKey(context: any = {},data: any = {}, isloading?: boolean): Promise<any> {
let res:any = await Http.getInstance().post(`/jobslocks/${context.jobslock}/checkkey`,data,isloading);
public async GetDraft(context: any = {},data: any = {}, isloading?: boolean): Promise<any> {
let res:any = await Http.getInstance().get(`/jobslocks/getdraft`,isloading);
res.data.jobslock = data.jobslock;
return res;
}
/**
* Remove接口方法
* CheckKey接口方法
*
* @param {*} [context={}]
* @param {*} [data={}]
......@@ -144,13 +143,13 @@ export default class JobsLockServiceBase extends EntityService {
* @returns {Promise<any>}
* @memberof JobsLockServiceBase
*/
public async Remove(context: any = {},data: any = {}, isloading?: boolean): Promise<any> {
let res:any = await Http.getInstance().delete(`/jobslocks/${context.jobslock}`,isloading);
public async CheckKey(context: any = {},data: any = {}, isloading?: boolean): Promise<any> {
let res:any = await Http.getInstance().post(`/jobslocks/${context.jobslock}/checkkey`,data,isloading);
return res;
}
/**
* GetDraft接口方法
* Save接口方法
*
* @param {*} [context={}]
* @param {*} [data={}]
......@@ -158,9 +157,10 @@ export default class JobsLockServiceBase extends EntityService {
* @returns {Promise<any>}
* @memberof JobsLockServiceBase
*/
public async GetDraft(context: any = {},data: any = {}, isloading?: boolean): Promise<any> {
let res:any = await Http.getInstance().get(`/jobslocks/getdraft`,isloading);
res.data.jobslock = data.jobslock;
public async Save(context: any = {},data: any = {}, isloading?: boolean): Promise<any> {
let masterData:any = {};
Object.assign(data,masterData);
let res:any = await Http.getInstance().post(`/jobslocks/${context.jobslock}/save`,data,isloading);
return res;
}
......
......@@ -53,7 +53,7 @@ export default class JobsLogServiceBase extends EntityService {
}
/**
* GetDraft接口方法
* Create接口方法
*
* @param {*} [context={}]
* @param {*} [data={}]
......@@ -61,9 +61,17 @@ export default class JobsLogServiceBase extends EntityService {
* @returns {Promise<any>}
* @memberof JobsLogServiceBase
*/
public async GetDraft(context: any = {},data: any = {}, isloading?: boolean): Promise<any> {
let res:any = await Http.getInstance().get(`/jobslogs/getdraft`,isloading);
res.data.jobslog = data.jobslog;
public async Create(context: any = {},data: any = {}, isloading?: boolean): Promise<any> {
let masterData:any = {};
Object.assign(data,masterData);
if(!data.srffrontuf || data.srffrontuf !== "1"){
data[this.APPDEKEY] = null;
}
if(data.srffrontuf){
delete data.srffrontuf;
}
let tempContext:any = JSON.parse(JSON.stringify(context));
let res:any = await Http.getInstance().post(`/jobslogs`,data,isloading);
return res;
}
......@@ -84,7 +92,7 @@ export default class JobsLogServiceBase extends EntityService {
}
/**
* Create接口方法
* Remove接口方法
*
* @param {*} [context={}]
* @param {*} [data={}]
......@@ -92,22 +100,13 @@ export default class JobsLogServiceBase extends EntityService {
* @returns {Promise<any>}
* @memberof JobsLogServiceBase
*/
public async Create(context: any = {},data: any = {}, isloading?: boolean): Promise<any> {
let masterData:any = {};
Object.assign(data,masterData);
if(!data.srffrontuf || data.srffrontuf !== "1"){
data[this.APPDEKEY] = null;
}
if(data.srffrontuf){
delete data.srffrontuf;
}
let tempContext:any = JSON.parse(JSON.stringify(context));
let res:any = await Http.getInstance().post(`/jobslogs`,data,isloading);
public async Remove(context: any = {},data: any = {}, isloading?: boolean): Promise<any> {
let res:any = await Http.getInstance().delete(`/jobslogs/${context.jobslog}`,isloading);
return res;
}
/**
* CheckKey接口方法
* Get接口方法
*
* @param {*} [context={}]
* @param {*} [data={}]
......@@ -115,13 +114,13 @@ export default class JobsLogServiceBase extends EntityService {
* @returns {Promise<any>}
* @memberof JobsLogServiceBase
*/
public async CheckKey(context: any = {},data: any = {}, isloading?: boolean): Promise<any> {
let res:any = await Http.getInstance().post(`/jobslogs/${context.jobslog}/checkkey`,data,isloading);
public async Get(context: any = {},data: any = {}, isloading?: boolean): Promise<any> {
let res:any = await Http.getInstance().get(`/jobslogs/${context.jobslog}`,isloading);
return res;
}
/**
* Save接口方法
* GetDraft接口方法
*
* @param {*} [context={}]
* @param {*} [data={}]
......@@ -129,15 +128,14 @@ export default class JobsLogServiceBase extends EntityService {
* @returns {Promise<any>}
* @memberof JobsLogServiceBase
*/
public async Save(context: any = {},data: any = {}, isloading?: boolean): Promise<any> {
let masterData:any = {};
Object.assign(data,masterData);
let res:any = await Http.getInstance().post(`/jobslogs/${context.jobslog}/save`,data,isloading);
public async GetDraft(context: any = {},data: any = {}, isloading?: boolean): Promise<any> {
let res:any = await Http.getInstance().get(`/jobslogs/getdraft`,isloading);
res.data.jobslog = data.jobslog;
return res;
}
/**
* Remove接口方法
* CheckKey接口方法
*
* @param {*} [context={}]
* @param {*} [data={}]
......@@ -145,13 +143,13 @@ export default class JobsLogServiceBase extends EntityService {
* @returns {Promise<any>}
* @memberof JobsLogServiceBase
*/
public async Remove(context: any = {},data: any = {}, isloading?: boolean): Promise<any> {
let res:any = await Http.getInstance().delete(`/jobslogs/${context.jobslog}`,isloading);
public async CheckKey(context: any = {},data: any = {}, isloading?: boolean): Promise<any> {
let res:any = await Http.getInstance().post(`/jobslogs/${context.jobslog}/checkkey`,data,isloading);
return res;
}
/**
* Get接口方法
* Save接口方法
*
* @param {*} [context={}]
* @param {*} [data={}]
......@@ -159,8 +157,10 @@ export default class JobsLogServiceBase extends EntityService {
* @returns {Promise<any>}
* @memberof JobsLogServiceBase
*/
public async Get(context: any = {},data: any = {}, isloading?: boolean): Promise<any> {
let res:any = await Http.getInstance().get(`/jobslogs/${context.jobslog}`,isloading);
public async Save(context: any = {},data: any = {}, isloading?: boolean): Promise<any> {
let masterData:any = {};
Object.assign(data,masterData);
let res:any = await Http.getInstance().post(`/jobslogs/${context.jobslog}/save`,data,isloading);
return res;
}
......
......@@ -53,7 +53,7 @@ export default class JobsRegistryServiceBase extends EntityService {
}
/**
* Get接口方法
* Create接口方法
*
* @param {*} [context={}]
* @param {*} [data={}]
......@@ -61,13 +61,22 @@ export default class JobsRegistryServiceBase extends EntityService {
* @returns {Promise<any>}
* @memberof JobsRegistryServiceBase
*/
public async Get(context: any = {},data: any = {}, isloading?: boolean): Promise<any> {
let res:any = await Http.getInstance().get(`/jobsregistries/${context.jobsregistry}`,isloading);
public async Create(context: any = {},data: any = {}, isloading?: boolean): Promise<any> {
let masterData:any = {};
Object.assign(data,masterData);
if(!data.srffrontuf || data.srffrontuf !== "1"){
data[this.APPDEKEY] = null;
}
if(data.srffrontuf){
delete data.srffrontuf;
}
let tempContext:any = JSON.parse(JSON.stringify(context));
let res:any = await Http.getInstance().post(`/jobsregistries`,data,isloading);
return res;
}
/**
* Remove接口方法
* Update接口方法
*
* @param {*} [context={}]
* @param {*} [data={}]
......@@ -75,13 +84,15 @@ export default class JobsRegistryServiceBase extends EntityService {
* @returns {Promise<any>}
* @memberof JobsRegistryServiceBase
*/
public async Remove(context: any = {},data: any = {}, isloading?: boolean): Promise<any> {
let res:any = await Http.getInstance().delete(`/jobsregistries/${context.jobsregistry}`,isloading);
public async Update(context: any = {},data: any = {}, isloading?: boolean): Promise<any> {
let masterData:any = {};
Object.assign(data,masterData);
let res:any = await Http.getInstance().put(`/jobsregistries/${context.jobsregistry}`,data,isloading);
return res;
}
/**
* Update接口方法
* Remove接口方法
*
* @param {*} [context={}]
* @param {*} [data={}]
......@@ -89,15 +100,13 @@ export default class JobsRegistryServiceBase extends EntityService {
* @returns {Promise<any>}
* @memberof JobsRegistryServiceBase
*/
public async Update(context: any = {},data: any = {}, isloading?: boolean): Promise<any> {
let masterData:any = {};
Object.assign(data,masterData);
let res:any = await Http.getInstance().put(`/jobsregistries/${context.jobsregistry}`,data,isloading);
public async Remove(context: any = {},data: any = {}, isloading?: boolean): Promise<any> {
let res:any = await Http.getInstance().delete(`/jobsregistries/${context.jobsregistry}`,isloading);
return res;
}
/**
* Save接口方法
* Get接口方法
*
* @param {*} [context={}]
* @param {*} [data={}]
......@@ -105,15 +114,13 @@ export default class JobsRegistryServiceBase extends EntityService {
* @returns {Promise<any>}
* @memberof JobsRegistryServiceBase
*/
public async Save(context: any = {},data: any = {}, isloading?: boolean): Promise<any> {
let masterData:any = {};
Object.assign(data,masterData);
let res:any = await Http.getInstance().post(`/jobsregistries/${context.jobsregistry}/save`,data,isloading);
public async Get(context: any = {},data: any = {}, isloading?: boolean): Promise<any> {
let res:any = await Http.getInstance().get(`/jobsregistries/${context.jobsregistry}`,isloading);
return res;
}
/**
* Create接口方法
* GetDraft接口方法
*
* @param {*} [context={}]
* @param {*} [data={}]
......@@ -121,17 +128,9 @@ export default class JobsRegistryServiceBase extends EntityService {
* @returns {Promise<any>}
* @memberof JobsRegistryServiceBase
*/
public async Create(context: any = {},data: any = {}, isloading?: boolean): Promise<any> {
let masterData:any = {};
Object.assign(data,masterData);
if(!data.srffrontuf || data.srffrontuf !== "1"){
data[this.APPDEKEY] = null;
}
if(data.srffrontuf){
delete data.srffrontuf;
}
let tempContext:any = JSON.parse(JSON.stringify(context));
let res:any = await Http.getInstance().post(`/jobsregistries`,data,isloading);
public async GetDraft(context: any = {},data: any = {}, isloading?: boolean): Promise<any> {
let res:any = await Http.getInstance().get(`/jobsregistries/getdraft`,isloading);
res.data.jobsregistry = data.jobsregistry;
return res;
}
......@@ -150,7 +149,7 @@ export default class JobsRegistryServiceBase extends EntityService {
}
/**
* GetDraft接口方法
* Save接口方法
*
* @param {*} [context={}]
* @param {*} [data={}]
......@@ -158,9 +157,10 @@ export default class JobsRegistryServiceBase extends EntityService {
* @returns {Promise<any>}
* @memberof JobsRegistryServiceBase
*/
public async GetDraft(context: any = {},data: any = {}, isloading?: boolean): Promise<any> {
let res:any = await Http.getInstance().get(`/jobsregistries/getdraft`,isloading);
res.data.jobsregistry = data.jobsregistry;
public async Save(context: any = {},data: any = {}, isloading?: boolean): Promise<any> {
let masterData:any = {};
Object.assign(data,masterData);
let res:any = await Http.getInstance().post(`/jobsregistries/${context.jobsregistry}/save`,data,isloading);
return res;
}
......
......@@ -25,19 +25,19 @@ import com.baomidou.mybatisplus.extension.service.IService;
*/
public interface IJobsInfoService extends IService<JobsInfo>{
JobsInfo start(JobsInfo et) ;
boolean create(JobsInfo et) ;
void createBatch(List<JobsInfo> list) ;
boolean update(JobsInfo et) ;
void updateBatch(List<JobsInfo> list) ;
boolean remove(String key) ;
void removeBatch(Collection<String> idList) ;
JobsInfo get(String key) ;
JobsInfo getDraft(JobsInfo et) ;
boolean checkKey(JobsInfo et) ;
JobsInfo execute(JobsInfo et) ;
boolean save(JobsInfo et) ;
void saveBatch(List<JobsInfo> list) ;
JobsInfo getDraft(JobsInfo et) ;
boolean remove(String key) ;
void removeBatch(Collection<String> idList) ;
JobsInfo get(String key) ;
boolean create(JobsInfo et) ;
void createBatch(List<JobsInfo> list) ;
JobsInfo start(JobsInfo et) ;
JobsInfo stop(JobsInfo et) ;
Page<JobsInfo> searchDefault(JobsInfoSearchContext context) ;
/**
......
......@@ -27,15 +27,15 @@ public interface IJobsLockService extends IService<JobsLock>{
boolean create(JobsLock et) ;
void createBatch(List<JobsLock> list) ;
boolean save(JobsLock et) ;
void saveBatch(List<JobsLock> list) ;
JobsLock get(String key) ;
boolean update(JobsLock et) ;
void updateBatch(List<JobsLock> list) ;
boolean checkKey(JobsLock et) ;
boolean remove(String key) ;
void removeBatch(Collection<String> idList) ;
JobsLock get(String key) ;
JobsLock getDraft(JobsLock et) ;
boolean checkKey(JobsLock et) ;
boolean save(JobsLock et) ;
void saveBatch(List<JobsLock> list) ;
Page<JobsLock> searchDefault(JobsLockSearchContext context) ;
/**
*自定义查询SQL
......
......@@ -25,17 +25,17 @@ import com.baomidou.mybatisplus.extension.service.IService;
*/
public interface IJobsLogService extends IService<JobsLog>{
JobsLog getDraft(JobsLog et) ;
boolean update(JobsLog et) ;
void updateBatch(List<JobsLog> list) ;
boolean create(JobsLog et) ;
void createBatch(List<JobsLog> list) ;
boolean checkKey(JobsLog et) ;
boolean save(JobsLog et) ;
void saveBatch(List<JobsLog> list) ;
boolean update(JobsLog et) ;
void updateBatch(List<JobsLog> list) ;
boolean remove(String key) ;
void removeBatch(Collection<String> idList) ;
JobsLog get(String key) ;
JobsLog getDraft(JobsLog et) ;
boolean checkKey(JobsLog et) ;
boolean save(JobsLog et) ;
void saveBatch(List<JobsLog> list) ;
Page<JobsLog> searchDefault(JobsLogSearchContext context) ;
/**
*自定义查询SQL
......
......@@ -25,17 +25,17 @@ import com.baomidou.mybatisplus.extension.service.IService;
*/
public interface IJobsRegistryService extends IService<JobsRegistry>{
JobsRegistry get(String key) ;
boolean remove(String key) ;
void removeBatch(Collection<String> idList) ;
boolean create(JobsRegistry et) ;
void createBatch(List<JobsRegistry> list) ;
boolean update(JobsRegistry et) ;
void updateBatch(List<JobsRegistry> list) ;
boolean remove(String key) ;
void removeBatch(Collection<String> idList) ;
JobsRegistry get(String key) ;
JobsRegistry getDraft(JobsRegistry et) ;
boolean checkKey(JobsRegistry et) ;
boolean save(JobsRegistry et) ;
void saveBatch(List<JobsRegistry> list) ;
boolean create(JobsRegistry et) ;
void createBatch(List<JobsRegistry> list) ;
boolean checkKey(JobsRegistry et) ;
JobsRegistry getDraft(JobsRegistry et) ;
Page<JobsRegistry> searchDefault(JobsRegistrySearchContext context) ;
/**
*自定义查询SQL
......
......@@ -49,12 +49,18 @@ public class JobsInfoServiceImpl extends ServiceImpl<JobsInfoMapper, JobsInfo> i
@Override
@Transactional
public JobsInfo start(JobsInfo et) {
et.set("Status","0");
et.set("Last_time","0");
update(et);
return et;
public boolean create(JobsInfo et) {
if(!this.retBool(this.baseMapper.insert(et)))
return false;
CachedBeanCopier.copy(get(et.getId()),et);
return true;
}
@Override
public void createBatch(List<JobsInfo> list) {
this.saveBatch(list,batchSize);
}
@Override
@Transactional
public boolean update(JobsInfo et) {
......@@ -69,6 +75,36 @@ public class JobsInfoServiceImpl extends ServiceImpl<JobsInfoMapper, JobsInfo> i
updateBatchById(list,batchSize);
}
@Override
@Transactional
public boolean remove(String key) {
boolean result=removeById(key);
return result ;
}
@Override
public void removeBatch(Collection<String> idList) {
removeByIds(idList);
}
@Override
@Transactional
public JobsInfo get(String key) {
JobsInfo et = getById(key);
if(et==null){
et=new JobsInfo();
et.setId(key);
}
else{
}
return et;
}
@Override
public JobsInfo getDraft(JobsInfo et) {
return et;
}
@Override
public boolean checkKey(JobsInfo et) {
return (!ObjectUtils.isEmpty(et.getId()))&&(!Objects.isNull(this.getById(et.getId())));
......@@ -111,50 +147,14 @@ public class JobsInfoServiceImpl extends ServiceImpl<JobsInfoMapper, JobsInfo> i
saveOrUpdateBatch(list,batchSize);
}
@Override
public JobsInfo getDraft(JobsInfo et) {
return et;
}
@Override
@Transactional
public boolean remove(String key) {
boolean result=removeById(key);
return result ;
}
@Override
public void removeBatch(Collection<String> idList) {
removeByIds(idList);
}
@Override
@Transactional
public JobsInfo get(String key) {
JobsInfo et = getById(key);
if(et==null){
et=new JobsInfo();
et.setId(key);
}
else{
}
public JobsInfo start(JobsInfo et) {
et.set("Status","0");
et.set("Last_time","0");
update(et);
return et;
}
@Override
@Transactional
public boolean create(JobsInfo et) {
if(!this.retBool(this.baseMapper.insert(et)))
return false;
CachedBeanCopier.copy(get(et.getId()),et);
return true;
}
@Override
public void createBatch(List<JobsInfo> list) {
this.saveBatch(list,batchSize);
}
@Override
@Transactional
public JobsInfo stop(JobsInfo et) {
......
......@@ -63,33 +63,28 @@ public class JobsLockServiceImpl extends ServiceImpl<JobsLockMapper, JobsLock> i
@Override
@Transactional
public boolean save(JobsLock et) {
if(!saveOrUpdate(et))
public boolean update(JobsLock et) {
if(!update(et,(Wrapper) et.getUpdateWrapper(true).eq("id",et.getId())))
return false;
CachedBeanCopier.copy(get(et.getId()),et);
return true;
}
@Override
@Transactional(
rollbackFor = {Exception.class}
)
public boolean saveOrUpdate(JobsLock et) {
if (null == et) {
return false;
} else {
return checkKey(et) ? this.update(et) : this.create(et);
}
public void updateBatch(List<JobsLock> list) {
updateBatchById(list,batchSize);
}
@Override
public boolean saveBatch(Collection<JobsLock> list) {
saveOrUpdateBatch(list,batchSize);
return true;
@Transactional
public boolean remove(String key) {
boolean result=removeById(key);
return result ;
}
@Override
public void saveBatch(List<JobsLock> list) {
saveOrUpdateBatch(list,batchSize);
public void removeBatch(Collection<String> idList) {
removeByIds(idList);
}
@Override
......@@ -106,17 +101,8 @@ public class JobsLockServiceImpl extends ServiceImpl<JobsLockMapper, JobsLock> i
}
@Override
@Transactional
public boolean update(JobsLock et) {
if(!update(et,(Wrapper) et.getUpdateWrapper(true).eq("id",et.getId())))
return false;
CachedBeanCopier.copy(get(et.getId()),et);
return true;
}
@Override
public void updateBatch(List<JobsLock> list) {
updateBatchById(list,batchSize);
public JobsLock getDraft(JobsLock et) {
return et;
}
@Override
......@@ -125,19 +111,33 @@ public class JobsLockServiceImpl extends ServiceImpl<JobsLockMapper, JobsLock> i
}
@Override
@Transactional
public boolean remove(String key) {
boolean result=removeById(key);
return result ;
public boolean save(JobsLock et) {
if(!saveOrUpdate(et))
return false;
return true;
}
@Override
public void removeBatch(Collection<String> idList) {
removeByIds(idList);
@Transactional(
rollbackFor = {Exception.class}
)
public boolean saveOrUpdate(JobsLock et) {
if (null == et) {
return false;
} else {
return checkKey(et) ? this.update(et) : this.create(et);
}
}
@Override
public JobsLock getDraft(JobsLock et) {
return et;
public boolean saveBatch(Collection<JobsLock> list) {
saveOrUpdateBatch(list,batchSize);
return true;
}
@Override
public void saveBatch(List<JobsLock> list) {
saveOrUpdateBatch(list,batchSize);
}
......
......@@ -48,8 +48,17 @@ public class JobsLogServiceImpl extends ServiceImpl<JobsLogMapper, JobsLog> impl
protected int batchSize = 500;
@Override
public JobsLog getDraft(JobsLog et) {
return et;
@Transactional
public boolean create(JobsLog et) {
if(!this.retBool(this.baseMapper.insert(et)))
return false;
CachedBeanCopier.copy(get(et.getId()),et);
return true;
}
@Override
public void createBatch(List<JobsLog> list) {
this.saveBatch(list,batchSize);
}
@Override
......@@ -68,16 +77,32 @@ public class JobsLogServiceImpl extends ServiceImpl<JobsLogMapper, JobsLog> impl
@Override
@Transactional
public boolean create(JobsLog et) {
if(!this.retBool(this.baseMapper.insert(et)))
return false;
CachedBeanCopier.copy(get(et.getId()),et);
return true;
public boolean remove(String key) {
boolean result=removeById(key);
return result ;
}
@Override
public void createBatch(List<JobsLog> list) {
this.saveBatch(list,batchSize);
public void removeBatch(Collection<String> idList) {
removeByIds(idList);
}
@Override
@Transactional
public JobsLog get(String key) {
JobsLog et = getById(key);
if(et==null){
et=new JobsLog();
et.setId(key);
}
else{
}
return et;
}
@Override
public JobsLog getDraft(JobsLog et) {
return et;
}
@Override
......@@ -115,31 +140,6 @@ public class JobsLogServiceImpl extends ServiceImpl<JobsLogMapper, JobsLog> impl
saveOrUpdateBatch(list,batchSize);
}
@Override
@Transactional
public boolean remove(String key) {
boolean result=removeById(key);
return result ;
}
@Override
public void removeBatch(Collection<String> idList) {
removeByIds(idList);
}
@Override
@Transactional
public JobsLog get(String key) {
JobsLog et = getById(key);
if(et==null){
et=new JobsLog();
et.setId(key);
}
else{
}
return et;
}
/**
......
......@@ -49,15 +49,30 @@ public class JobsRegistryServiceImpl extends ServiceImpl<JobsRegistryMapper, Job
@Override
@Transactional
public JobsRegistry get(String key) {
JobsRegistry et = getById(key);
if(et==null){
et=new JobsRegistry();
et.setId(key);
}
else{
}
return et;
public boolean create(JobsRegistry et) {
if(!this.retBool(this.baseMapper.insert(et)))
return false;
CachedBeanCopier.copy(get(et.getId()),et);
return true;
}
@Override
public void createBatch(List<JobsRegistry> list) {
this.saveBatch(list,batchSize);
}
@Override
@Transactional
public boolean update(JobsRegistry et) {
if(!update(et,(Wrapper) et.getUpdateWrapper(true).eq("id",et.getId())))
return false;
CachedBeanCopier.copy(get(et.getId()),et);
return true;
}
@Override
public void updateBatch(List<JobsRegistry> list) {
updateBatchById(list,batchSize);
}
@Override
......@@ -74,18 +89,26 @@ public class JobsRegistryServiceImpl extends ServiceImpl<JobsRegistryMapper, Job
@Override
@Transactional
public boolean update(JobsRegistry et) {
if(!update(et,(Wrapper) et.getUpdateWrapper(true).eq("id",et.getId())))
return false;
CachedBeanCopier.copy(get(et.getId()),et);
return true;
public JobsRegistry get(String key) {
JobsRegistry et = getById(key);
if(et==null){
et=new JobsRegistry();
et.setId(key);
}
else{
}
return et;
}
@Override
public void updateBatch(List<JobsRegistry> list) {
updateBatchById(list,batchSize);
public JobsRegistry getDraft(JobsRegistry et) {
return et;
}
@Override
public boolean checkKey(JobsRegistry et) {
return (!ObjectUtils.isEmpty(et.getId()))&&(!Objects.isNull(this.getById(et.getId())));
}
@Override
@Transactional
public boolean save(JobsRegistry et) {
......@@ -117,29 +140,6 @@ public class JobsRegistryServiceImpl extends ServiceImpl<JobsRegistryMapper, Job
saveOrUpdateBatch(list,batchSize);
}
@Override
@Transactional
public boolean create(JobsRegistry et) {
if(!this.retBool(this.baseMapper.insert(et)))
return false;
CachedBeanCopier.copy(get(et.getId()),et);
return true;
}
@Override
public void createBatch(List<JobsRegistry> list) {
this.saveBatch(list,batchSize);
}
@Override
public boolean checkKey(JobsRegistry et) {
return (!ObjectUtils.isEmpty(et.getId()))&&(!Objects.isNull(this.getById(et.getId())));
}
@Override
public JobsRegistry getDraft(JobsRegistry et) {
return et;
}
/**
......
......@@ -8,7 +8,7 @@
"delogicname":"任务信息",
"sysmoudle":{"id":"TASK","name":"task"},
"dedataset":[{"id":"Default" , "name":"DEFAULT"}],
"deaction":[{"id":"Start" , "name":"开始" , "type":"USERUPDATE" },{"id":"Update" , "name":"Update" , "type":"BUILTIN" },{"id":"CheckKey" , "name":"CheckKey" , "type":"BUILTIN" },{"id":"Execute" , "name":"执行" , "type":"USERCUSTOM" },{"id":"Save" , "name":"Save" , "type":"BUILTIN" },{"id":"GetDraft" , "name":"GetDraft" , "type":"BUILTIN" },{"id":"Remove" , "name":"Remove" , "type":"BUILTIN" },{"id":"Get" , "name":"Get" , "type":"BUILTIN" },{"id":"Create" , "name":"Create" , "type":"BUILTIN" },{"id":"Stop" , "name":"停止" , "type":"USERUPDATE" }],
"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":"Execute" , "name":"执行" , "type":"USERCUSTOM" },{"id":"Save" , "name":"Save" , "type":"BUILTIN" },{"id":"Start" , "name":"开始" , "type":"USERUPDATE" },{"id":"Stop" , "name":"停止" , "type":"USERUPDATE" }],
"datascope":[{"id":"all","name":"全部数据"}]
}
, {
......@@ -16,7 +16,7 @@
"delogicname":"任务调度日志",
"sysmoudle":{"id":"TASK","name":"task"},
"dedataset":[{"id":"Default" , "name":"DEFAULT"}],
"deaction":[{"id":"GetDraft" , "name":"GetDraft" , "type":"BUILTIN" },{"id":"Update" , "name":"Update" , "type":"BUILTIN" },{"id":"Create" , "name":"Create" , "type":"BUILTIN" },{"id":"CheckKey" , "name":"CheckKey" , "type":"BUILTIN" },{"id":"Save" , "name":"Save" , "type":"BUILTIN" },{"id":"Remove" , "name":"Remove" , "type":"BUILTIN" },{"id":"Get" , "name":"Get" , "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":"CheckKey" , "name":"CheckKey" , "type":"BUILTIN" },{"id":"Save" , "name":"Save" , "type":"BUILTIN" }],
"datascope":[{"id":"all","name":"全部数据"}]
}
, {
......@@ -24,7 +24,7 @@
"delogicname":"任务锁",
"sysmoudle":{"id":"TASK","name":"task"},
"dedataset":[{"id":"Default" , "name":"DEFAULT"}],
"deaction":[{"id":"Create" , "name":"Create" , "type":"BUILTIN" },{"id":"Save" , "name":"Save" , "type":"BUILTIN" },{"id":"Get" , "name":"Get" , "type":"BUILTIN" },{"id":"Update" , "name":"Update" , "type":"BUILTIN" },{"id":"CheckKey" , "name":"CheckKey" , "type":"BUILTIN" },{"id":"Remove" , "name":"Remove" , "type":"BUILTIN" },{"id":"GetDraft" , "name":"GetDraft" , "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":"CheckKey" , "name":"CheckKey" , "type":"BUILTIN" },{"id":"Save" , "name":"Save" , "type":"BUILTIN" }],
"datascope":[{"id":"all","name":"全部数据"}]
}
, {
......@@ -32,7 +32,7 @@
"delogicname":"任务注册信息",
"sysmoudle":{"id":"TASK","name":"task"},
"dedataset":[{"id":"Default" , "name":"DEFAULT"}],
"deaction":[{"id":"Get" , "name":"Get" , "type":"BUILTIN" },{"id":"Remove" , "name":"Remove" , "type":"BUILTIN" },{"id":"Update" , "name":"Update" , "type":"BUILTIN" },{"id":"Save" , "name":"Save" , "type":"BUILTIN" },{"id":"Create" , "name":"Create" , "type":"BUILTIN" },{"id":"CheckKey" , "name":"CheckKey" , "type":"BUILTIN" },{"id":"GetDraft" , "name":"GetDraft" , "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":"CheckKey" , "name":"CheckKey" , "type":"BUILTIN" },{"id":"Save" , "name":"Save" , "type":"BUILTIN" }],
"datascope":[{"id":"all","name":"全部数据"}]
}
],
......
......@@ -47,16 +47,23 @@ public class JobsInfoResource {
@Lazy
public JobsInfoMapping jobsinfoMapping;
@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','ibztask-JobsInfo-Start-all')")
@ApiOperation(value = "开始", tags = {"任务信息" }, notes = "开始")
@RequestMapping(method = RequestMethod.POST, value = "/jobsinfos/{jobsinfo_id}/start")
@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','ibztask-JobsInfo-Create-all')")
@ApiOperation(value = "新建任务信息", tags = {"任务信息" }, notes = "新建任务信息")
@RequestMapping(method = RequestMethod.POST, value = "/jobsinfos")
@Transactional
public ResponseEntity<JobsInfoDTO> start(@PathVariable("jobsinfo_id") String jobsinfo_id, @RequestBody JobsInfoDTO jobsinfodto) {
public ResponseEntity<JobsInfoDTO> create(@RequestBody JobsInfoDTO jobsinfodto) {
JobsInfo domain = jobsinfoMapping.toDomain(jobsinfodto);
domain.setId(jobsinfo_id);
domain = jobsinfoService.start(domain);
jobsinfodto = jobsinfoMapping.toDto(domain);
return ResponseEntity.status(HttpStatus.OK).body(jobsinfodto);
jobsinfoService.create(domain);
JobsInfoDTO dto = jobsinfoMapping.toDto(domain);
return ResponseEntity.status(HttpStatus.OK).body(dto);
}
@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','ibztask-JobsInfo-Create-all')")
@ApiOperation(value = "批量新建任务信息", tags = {"任务信息" }, notes = "批量新建任务信息")
@RequestMapping(method = RequestMethod.POST, value = "/jobsinfos/batch")
public ResponseEntity<Boolean> createBatch(@RequestBody List<JobsInfoDTO> jobsinfodtos) {
jobsinfoService.createBatch(jobsinfoMapping.toDomain(jobsinfodtos));
return ResponseEntity.status(HttpStatus.OK).body(true);
}
@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','ibztask-JobsInfo-Update-all')")
......@@ -79,6 +86,37 @@ public class JobsInfoResource {
return ResponseEntity.status(HttpStatus.OK).body(true);
}
@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','ibztask-JobsInfo-Remove-all')")
@ApiOperation(value = "删除任务信息", tags = {"任务信息" }, notes = "删除任务信息")
@RequestMapping(method = RequestMethod.DELETE, value = "/jobsinfos/{jobsinfo_id}")
@Transactional
public ResponseEntity<Boolean> remove(@PathVariable("jobsinfo_id") String jobsinfo_id) {
return ResponseEntity.status(HttpStatus.OK).body(jobsinfoService.remove(jobsinfo_id));
}
@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','ibztask-JobsInfo-Remove-all')")
@ApiOperation(value = "批量删除任务信息", tags = {"任务信息" }, notes = "批量删除任务信息")
@RequestMapping(method = RequestMethod.DELETE, value = "/jobsinfos/batch")
public ResponseEntity<Boolean> removeBatch(@RequestBody List<String> ids) {
jobsinfoService.removeBatch(ids);
return ResponseEntity.status(HttpStatus.OK).body(true);
}
@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','ibztask-JobsInfo-Get-all')")
@ApiOperation(value = "获取任务信息", tags = {"任务信息" }, notes = "获取任务信息")
@RequestMapping(method = RequestMethod.GET, value = "/jobsinfos/{jobsinfo_id}")
public ResponseEntity<JobsInfoDTO> get(@PathVariable("jobsinfo_id") String jobsinfo_id) {
JobsInfo domain = jobsinfoService.get(jobsinfo_id);
JobsInfoDTO dto = jobsinfoMapping.toDto(domain);
return ResponseEntity.status(HttpStatus.OK).body(dto);
}
@ApiOperation(value = "获取任务信息草稿", tags = {"任务信息" }, notes = "获取任务信息草稿")
@RequestMapping(method = RequestMethod.GET, value = "/jobsinfos/getdraft")
public ResponseEntity<JobsInfoDTO> getDraft() {
return ResponseEntity.status(HttpStatus.OK).body(jobsinfoMapping.toDto(jobsinfoService.getDraft(new JobsInfo())));
}
@ApiOperation(value = "检查任务信息", tags = {"任务信息" }, notes = "检查任务信息")
@RequestMapping(method = RequestMethod.POST, value = "/jobsinfos/checkkey")
public ResponseEntity<Boolean> checkKey(@RequestBody JobsInfoDTO jobsinfodto) {
......@@ -112,54 +150,16 @@ public class JobsInfoResource {
return ResponseEntity.status(HttpStatus.OK).body(true);
}
@ApiOperation(value = "获取任务信息草稿", tags = {"任务信息" }, notes = "获取任务信息草稿")
@RequestMapping(method = RequestMethod.GET, value = "/jobsinfos/getdraft")
public ResponseEntity<JobsInfoDTO> getDraft() {
return ResponseEntity.status(HttpStatus.OK).body(jobsinfoMapping.toDto(jobsinfoService.getDraft(new JobsInfo())));
}
@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','ibztask-JobsInfo-Remove-all')")
@ApiOperation(value = "删除任务信息", tags = {"任务信息" }, notes = "删除任务信息")
@RequestMapping(method = RequestMethod.DELETE, value = "/jobsinfos/{jobsinfo_id}")
@Transactional
public ResponseEntity<Boolean> remove(@PathVariable("jobsinfo_id") String jobsinfo_id) {
return ResponseEntity.status(HttpStatus.OK).body(jobsinfoService.remove(jobsinfo_id));
}
@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','ibztask-JobsInfo-Remove-all')")
@ApiOperation(value = "批量删除任务信息", tags = {"任务信息" }, notes = "批量删除任务信息")
@RequestMapping(method = RequestMethod.DELETE, value = "/jobsinfos/batch")
public ResponseEntity<Boolean> removeBatch(@RequestBody List<String> ids) {
jobsinfoService.removeBatch(ids);
return ResponseEntity.status(HttpStatus.OK).body(true);
}
@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','ibztask-JobsInfo-Get-all')")
@ApiOperation(value = "获取任务信息", tags = {"任务信息" }, notes = "获取任务信息")
@RequestMapping(method = RequestMethod.GET, value = "/jobsinfos/{jobsinfo_id}")
public ResponseEntity<JobsInfoDTO> get(@PathVariable("jobsinfo_id") String jobsinfo_id) {
JobsInfo domain = jobsinfoService.get(jobsinfo_id);
JobsInfoDTO dto = jobsinfoMapping.toDto(domain);
return ResponseEntity.status(HttpStatus.OK).body(dto);
}
@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','ibztask-JobsInfo-Create-all')")
@ApiOperation(value = "新建任务信息", tags = {"任务信息" }, notes = "新建任务信息")
@RequestMapping(method = RequestMethod.POST, value = "/jobsinfos")
@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','ibztask-JobsInfo-Start-all')")
@ApiOperation(value = "开始", tags = {"任务信息" }, notes = "开始")
@RequestMapping(method = RequestMethod.POST, value = "/jobsinfos/{jobsinfo_id}/start")
@Transactional
public ResponseEntity<JobsInfoDTO> create(@RequestBody JobsInfoDTO jobsinfodto) {
public ResponseEntity<JobsInfoDTO> start(@PathVariable("jobsinfo_id") String jobsinfo_id, @RequestBody JobsInfoDTO jobsinfodto) {
JobsInfo domain = jobsinfoMapping.toDomain(jobsinfodto);
jobsinfoService.create(domain);
JobsInfoDTO dto = jobsinfoMapping.toDto(domain);
return ResponseEntity.status(HttpStatus.OK).body(dto);
}
@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','ibztask-JobsInfo-Create-all')")
@ApiOperation(value = "批量新建任务信息", tags = {"任务信息" }, notes = "批量新建任务信息")
@RequestMapping(method = RequestMethod.POST, value = "/jobsinfos/batch")
public ResponseEntity<Boolean> createBatch(@RequestBody List<JobsInfoDTO> jobsinfodtos) {
jobsinfoService.createBatch(jobsinfoMapping.toDomain(jobsinfodtos));
return ResponseEntity.status(HttpStatus.OK).body(true);
domain.setId(jobsinfo_id);
domain = jobsinfoService.start(domain);
jobsinfodto = jobsinfoMapping.toDto(domain);
return ResponseEntity.status(HttpStatus.OK).body(jobsinfodto);
}
@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','ibztask-JobsInfo-Stop-all')")
......@@ -174,7 +174,7 @@ public class JobsInfoResource {
return ResponseEntity.status(HttpStatus.OK).body(jobsinfodto);
}
@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','ibztask-JobsInfo-searchDefault-all')")
@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','ibztask-JobsInfo-searchDefault-all') and hasPermission(#context,'ibztask-JobsInfo-Get')")
@ApiOperation(value = "获取DEFAULT", tags = {"任务信息" } ,notes = "获取DEFAULT")
@RequestMapping(method= RequestMethod.GET , value="/jobsinfos/fetchdefault")
public ResponseEntity<List<JobsInfoDTO>> fetchDefault(JobsInfoSearchContext context) {
......@@ -187,7 +187,7 @@ public class JobsInfoResource {
.body(list);
}
@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','ibztask-JobsInfo-searchDefault-all')")
@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','ibztask-JobsInfo-searchDefault-all') and hasPermission(#context,'ibztask-JobsInfo-Get')")
@ApiOperation(value = "查询DEFAULT", tags = {"任务信息" } ,notes = "查询DEFAULT")
@RequestMapping(method= RequestMethod.POST , value="/jobsinfos/searchdefault")
public ResponseEntity<Page<JobsInfoDTO>> searchDefault(@RequestBody JobsInfoSearchContext context) {
......
......@@ -66,30 +66,6 @@ public class JobsLockResource {
return ResponseEntity.status(HttpStatus.OK).body(true);
}
@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','ibztask-JobsLock-Save-all')")
@ApiOperation(value = "保存任务锁", tags = {"任务锁" }, notes = "保存任务锁")
@RequestMapping(method = RequestMethod.POST, value = "/jobslocks/save")
public ResponseEntity<Boolean> save(@RequestBody JobsLockDTO jobslockdto) {
return ResponseEntity.status(HttpStatus.OK).body(jobslockService.save(jobslockMapping.toDomain(jobslockdto)));
}
@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','ibztask-JobsLock-Save-all')")
@ApiOperation(value = "批量保存任务锁", tags = {"任务锁" }, notes = "批量保存任务锁")
@RequestMapping(method = RequestMethod.POST, value = "/jobslocks/savebatch")
public ResponseEntity<Boolean> saveBatch(@RequestBody List<JobsLockDTO> jobslockdtos) {
jobslockService.saveBatch(jobslockMapping.toDomain(jobslockdtos));
return ResponseEntity.status(HttpStatus.OK).body(true);
}
@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','ibztask-JobsLock-Get-all')")
@ApiOperation(value = "获取任务锁", tags = {"任务锁" }, notes = "获取任务锁")
@RequestMapping(method = RequestMethod.GET, value = "/jobslocks/{jobslock_id}")
public ResponseEntity<JobsLockDTO> get(@PathVariable("jobslock_id") String jobslock_id) {
JobsLock domain = jobslockService.get(jobslock_id);
JobsLockDTO dto = jobslockMapping.toDto(domain);
return ResponseEntity.status(HttpStatus.OK).body(dto);
}
@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','ibztask-JobsLock-Update-all')")
@ApiOperation(value = "更新任务锁", tags = {"任务锁" }, notes = "更新任务锁")
@RequestMapping(method = RequestMethod.PUT, value = "/jobslocks/{jobslock_id}")
......@@ -110,12 +86,6 @@ public class JobsLockResource {
return ResponseEntity.status(HttpStatus.OK).body(true);
}
@ApiOperation(value = "检查任务锁", tags = {"任务锁" }, notes = "检查任务锁")
@RequestMapping(method = RequestMethod.POST, value = "/jobslocks/checkkey")
public ResponseEntity<Boolean> checkKey(@RequestBody JobsLockDTO jobslockdto) {
return ResponseEntity.status(HttpStatus.OK).body(jobslockService.checkKey(jobslockMapping.toDomain(jobslockdto)));
}
@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','ibztask-JobsLock-Remove-all')")
@ApiOperation(value = "删除任务锁", tags = {"任务锁" }, notes = "删除任务锁")
@RequestMapping(method = RequestMethod.DELETE, value = "/jobslocks/{jobslock_id}")
......@@ -132,13 +102,43 @@ public class JobsLockResource {
return ResponseEntity.status(HttpStatus.OK).body(true);
}
@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','ibztask-JobsLock-Get-all')")
@ApiOperation(value = "获取任务锁", tags = {"任务锁" }, notes = "获取任务锁")
@RequestMapping(method = RequestMethod.GET, value = "/jobslocks/{jobslock_id}")
public ResponseEntity<JobsLockDTO> get(@PathVariable("jobslock_id") String jobslock_id) {
JobsLock domain = jobslockService.get(jobslock_id);
JobsLockDTO dto = jobslockMapping.toDto(domain);
return ResponseEntity.status(HttpStatus.OK).body(dto);
}
@ApiOperation(value = "获取任务锁草稿", tags = {"任务锁" }, notes = "获取任务锁草稿")
@RequestMapping(method = RequestMethod.GET, value = "/jobslocks/getdraft")
public ResponseEntity<JobsLockDTO> getDraft() {
return ResponseEntity.status(HttpStatus.OK).body(jobslockMapping.toDto(jobslockService.getDraft(new JobsLock())));
}
@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','ibztask-JobsLock-searchDefault-all')")
@ApiOperation(value = "检查任务锁", tags = {"任务锁" }, notes = "检查任务锁")
@RequestMapping(method = RequestMethod.POST, value = "/jobslocks/checkkey")
public ResponseEntity<Boolean> checkKey(@RequestBody JobsLockDTO jobslockdto) {
return ResponseEntity.status(HttpStatus.OK).body(jobslockService.checkKey(jobslockMapping.toDomain(jobslockdto)));
}
@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','ibztask-JobsLock-Save-all')")
@ApiOperation(value = "保存任务锁", tags = {"任务锁" }, notes = "保存任务锁")
@RequestMapping(method = RequestMethod.POST, value = "/jobslocks/save")
public ResponseEntity<Boolean> save(@RequestBody JobsLockDTO jobslockdto) {
return ResponseEntity.status(HttpStatus.OK).body(jobslockService.save(jobslockMapping.toDomain(jobslockdto)));
}
@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','ibztask-JobsLock-Save-all')")
@ApiOperation(value = "批量保存任务锁", tags = {"任务锁" }, notes = "批量保存任务锁")
@RequestMapping(method = RequestMethod.POST, value = "/jobslocks/savebatch")
public ResponseEntity<Boolean> saveBatch(@RequestBody List<JobsLockDTO> jobslockdtos) {
jobslockService.saveBatch(jobslockMapping.toDomain(jobslockdtos));
return ResponseEntity.status(HttpStatus.OK).body(true);
}
@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','ibztask-JobsLock-searchDefault-all') and hasPermission(#context,'ibztask-JobsLock-Get')")
@ApiOperation(value = "获取DEFAULT", tags = {"任务锁" } ,notes = "获取DEFAULT")
@RequestMapping(method= RequestMethod.GET , value="/jobslocks/fetchdefault")
public ResponseEntity<List<JobsLockDTO>> fetchDefault(JobsLockSearchContext context) {
......@@ -151,7 +151,7 @@ public class JobsLockResource {
.body(list);
}
@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','ibztask-JobsLock-searchDefault-all')")
@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','ibztask-JobsLock-searchDefault-all') and hasPermission(#context,'ibztask-JobsLock-Get')")
@ApiOperation(value = "查询DEFAULT", tags = {"任务锁" } ,notes = "查询DEFAULT")
@RequestMapping(method= RequestMethod.POST , value="/jobslocks/searchdefault")
public ResponseEntity<Page<JobsLockDTO>> searchDefault(@RequestBody JobsLockSearchContext context) {
......
......@@ -47,32 +47,6 @@ public class JobsLogResource {
@Lazy
public JobsLogMapping jobslogMapping;
@ApiOperation(value = "获取任务调度日志草稿", tags = {"任务调度日志" }, notes = "获取任务调度日志草稿")
@RequestMapping(method = RequestMethod.GET, value = "/jobslogs/getdraft")
public ResponseEntity<JobsLogDTO> getDraft() {
return ResponseEntity.status(HttpStatus.OK).body(jobslogMapping.toDto(jobslogService.getDraft(new JobsLog())));
}
@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','ibztask-JobsLog-Update-all')")
@ApiOperation(value = "更新任务调度日志", tags = {"任务调度日志" }, notes = "更新任务调度日志")
@RequestMapping(method = RequestMethod.PUT, value = "/jobslogs/{jobslog_id}")
@Transactional
public ResponseEntity<JobsLogDTO> update(@PathVariable("jobslog_id") String jobslog_id, @RequestBody JobsLogDTO jobslogdto) {
JobsLog domain = jobslogMapping.toDomain(jobslogdto);
domain .setId(jobslog_id);
jobslogService.update(domain );
JobsLogDTO dto = jobslogMapping.toDto(domain );
return ResponseEntity.status(HttpStatus.OK).body(dto);
}
@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','ibztask-JobsLog-Update-all')")
@ApiOperation(value = "批量更新任务调度日志", tags = {"任务调度日志" }, notes = "批量更新任务调度日志")
@RequestMapping(method = RequestMethod.PUT, value = "/jobslogs/batch")
public ResponseEntity<Boolean> updateBatch(@RequestBody List<JobsLogDTO> jobslogdtos) {
jobslogService.updateBatch(jobslogMapping.toDomain(jobslogdtos));
return ResponseEntity.status(HttpStatus.OK).body(true);
}
@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','ibztask-JobsLog-Create-all')")
@ApiOperation(value = "新建任务调度日志", tags = {"任务调度日志" }, notes = "新建任务调度日志")
@RequestMapping(method = RequestMethod.POST, value = "/jobslogs")
......@@ -92,24 +66,23 @@ public class JobsLogResource {
return ResponseEntity.status(HttpStatus.OK).body(true);
}
@ApiOperation(value = "检查任务调度日志", tags = {"任务调度日志" }, notes = "检查任务调度日志")
@RequestMapping(method = RequestMethod.POST, value = "/jobslogs/checkkey")
public ResponseEntity<Boolean> checkKey(@RequestBody JobsLogDTO jobslogdto) {
return ResponseEntity.status(HttpStatus.OK).body(jobslogService.checkKey(jobslogMapping.toDomain(jobslogdto)));
}
@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','ibztask-JobsLog-Save-all')")
@ApiOperation(value = "保存任务调度日志", tags = {"任务调度日志" }, notes = "保存任务调度日志")
@RequestMapping(method = RequestMethod.POST, value = "/jobslogs/save")
public ResponseEntity<Boolean> save(@RequestBody JobsLogDTO jobslogdto) {
return ResponseEntity.status(HttpStatus.OK).body(jobslogService.save(jobslogMapping.toDomain(jobslogdto)));
@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','ibztask-JobsLog-Update-all')")
@ApiOperation(value = "更新任务调度日志", tags = {"任务调度日志" }, notes = "更新任务调度日志")
@RequestMapping(method = RequestMethod.PUT, value = "/jobslogs/{jobslog_id}")
@Transactional
public ResponseEntity<JobsLogDTO> update(@PathVariable("jobslog_id") String jobslog_id, @RequestBody JobsLogDTO jobslogdto) {
JobsLog domain = jobslogMapping.toDomain(jobslogdto);
domain .setId(jobslog_id);
jobslogService.update(domain );
JobsLogDTO dto = jobslogMapping.toDto(domain );
return ResponseEntity.status(HttpStatus.OK).body(dto);
}
@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','ibztask-JobsLog-Save-all')")
@ApiOperation(value = "批量保存任务调度日志", tags = {"任务调度日志" }, notes = "批量保存任务调度日志")
@RequestMapping(method = RequestMethod.POST, value = "/jobslogs/savebatch")
public ResponseEntity<Boolean> saveBatch(@RequestBody List<JobsLogDTO> jobslogdtos) {
jobslogService.saveBatch(jobslogMapping.toDomain(jobslogdtos));
@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','ibztask-JobsLog-Update-all')")
@ApiOperation(value = "批量更新任务调度日志", tags = {"任务调度日志" }, notes = "批量更新任务调度日志")
@RequestMapping(method = RequestMethod.PUT, value = "/jobslogs/batch")
public ResponseEntity<Boolean> updateBatch(@RequestBody List<JobsLogDTO> jobslogdtos) {
jobslogService.updateBatch(jobslogMapping.toDomain(jobslogdtos));
return ResponseEntity.status(HttpStatus.OK).body(true);
}
......@@ -138,7 +111,34 @@ public class JobsLogResource {
return ResponseEntity.status(HttpStatus.OK).body(dto);
}
@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','ibztask-JobsLog-searchDefault-all')")
@ApiOperation(value = "获取任务调度日志草稿", tags = {"任务调度日志" }, notes = "获取任务调度日志草稿")
@RequestMapping(method = RequestMethod.GET, value = "/jobslogs/getdraft")
public ResponseEntity<JobsLogDTO> getDraft() {
return ResponseEntity.status(HttpStatus.OK).body(jobslogMapping.toDto(jobslogService.getDraft(new JobsLog())));
}
@ApiOperation(value = "检查任务调度日志", tags = {"任务调度日志" }, notes = "检查任务调度日志")
@RequestMapping(method = RequestMethod.POST, value = "/jobslogs/checkkey")
public ResponseEntity<Boolean> checkKey(@RequestBody JobsLogDTO jobslogdto) {
return ResponseEntity.status(HttpStatus.OK).body(jobslogService.checkKey(jobslogMapping.toDomain(jobslogdto)));
}
@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','ibztask-JobsLog-Save-all')")
@ApiOperation(value = "保存任务调度日志", tags = {"任务调度日志" }, notes = "保存任务调度日志")
@RequestMapping(method = RequestMethod.POST, value = "/jobslogs/save")
public ResponseEntity<Boolean> save(@RequestBody JobsLogDTO jobslogdto) {
return ResponseEntity.status(HttpStatus.OK).body(jobslogService.save(jobslogMapping.toDomain(jobslogdto)));
}
@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','ibztask-JobsLog-Save-all')")
@ApiOperation(value = "批量保存任务调度日志", tags = {"任务调度日志" }, notes = "批量保存任务调度日志")
@RequestMapping(method = RequestMethod.POST, value = "/jobslogs/savebatch")
public ResponseEntity<Boolean> saveBatch(@RequestBody List<JobsLogDTO> jobslogdtos) {
jobslogService.saveBatch(jobslogMapping.toDomain(jobslogdtos));
return ResponseEntity.status(HttpStatus.OK).body(true);
}
@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','ibztask-JobsLog-searchDefault-all') and hasPermission(#context,'ibztask-JobsLog-Get')")
@ApiOperation(value = "获取DEFAULT", tags = {"任务调度日志" } ,notes = "获取DEFAULT")
@RequestMapping(method= RequestMethod.GET , value="/jobslogs/fetchdefault")
public ResponseEntity<List<JobsLogDTO>> fetchDefault(JobsLogSearchContext context) {
......@@ -151,7 +151,7 @@ public class JobsLogResource {
.body(list);
}
@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','ibztask-JobsLog-searchDefault-all')")
@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','ibztask-JobsLog-searchDefault-all') and hasPermission(#context,'ibztask-JobsLog-Get')")
@ApiOperation(value = "查询DEFAULT", tags = {"任务调度日志" } ,notes = "查询DEFAULT")
@RequestMapping(method= RequestMethod.POST , value="/jobslogs/searchdefault")
public ResponseEntity<Page<JobsLogDTO>> searchDefault(@RequestBody JobsLogSearchContext context) {
......
package cn.ibizlab.util.security;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import lombok.SneakyThrows;
import cn.ibizlab.util.annotation.DEField;
import cn.ibizlab.util.domain.EntityBase;
import cn.ibizlab.util.enums.DEPredefinedFieldType;
import cn.ibizlab.util.filter.QueryWrapperContext;
import cn.ibizlab.util.helper.DEFieldCacheMap;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.security.access.PermissionEvaluator;
......@@ -11,7 +14,10 @@ import org.springframework.security.core.GrantedAuthority;
import org.springframework.stereotype.Component;
import org.springframework.util.ObjectUtils;
import java.io.Serializable;
import java.lang.reflect.ParameterizedType;
import java.lang.reflect.Type;
import java.util.*;
import java.util.function.Consumer;
/**
* spring security 权限管理类
......@@ -23,44 +29,144 @@ public class AuthPermissionEvaluator implements PermissionEvaluator {
@Value("${ibiz.enablePermissionValid:false}")
boolean enablePermissionValid; //是否开启权限校验
/**
* 实体行为鉴权
* @param authentication
* @param entity
* @param action
* 服务接口鉴权
* @param authentication 用户
* @param entity 实体
* @param action 操作
* @return
*/
@Override
@SneakyThrows
public boolean hasPermission(Authentication authentication, Object entity, Object action) {
//未开启权限校验、超级管理员则不进行权限检查
if(AuthenticationUser.getAuthenticationUser().getSuperuser()==1 || !enablePermissionValid)
if(!enablePermissionValid)
return true;
Object principal = authentication.getPrincipal();
if(ObjectUtils.isEmpty(principal))
return false;
AuthenticationUser authenticationUser= (AuthenticationUser) authentication.getPrincipal();
if(authenticationUser.getSuperuser()==1)
return true;
String strAction=String.valueOf(action);
Set<String> userAuthorities = getAuthorities(authentication,strAction);
if(userAuthorities.size()==0)
return false;
//拥有全部数据访问权限时,则跳过权限检查
if(isAllData(strAction,userAuthorities)){
return true;
}
if(entity instanceof ArrayList){
List<EntityBase> entities= (List<EntityBase>) entity;
for(EntityBase entityBase: entities){
boolean result=actionValid(entityBase, strAction ,userAuthorities);
boolean result=actionValid(entityBase, strAction ,userAuthorities,authenticationUser);
if(!result){
return false;
}
}
}
else if (entity instanceof QueryWrapperContext){
QueryWrapperContext queryWrapperContext= (QueryWrapperContext) entity;
setPermissionCondToSearchContext(getEntity(queryWrapperContext),queryWrapperContext,userAuthorities,authenticationUser);
}
else{
EntityBase entityBase= (EntityBase) entity;
return actionValid(entityBase , strAction ,userAuthorities);
return actionValid(entityBase , strAction ,userAuthorities,authenticationUser);
}
return true;
}
/**
* 获取实体信息
* @param qc
* @return
*/
@SneakyThrows
private EntityBase getEntity(QueryWrapperContext qc){
EntityBase entity=null;
Type type =qc.getClass().getGenericSuperclass();
if(type instanceof ParameterizedType){
ParameterizedType parameterizedType= (ParameterizedType) qc.getClass().getGenericSuperclass();
Type [] typeArr= parameterizedType.getActualTypeArguments();
if(typeArr.length>0){
Class<EntityBase> entityClass = (Class) typeArr[0];
return entityClass.newInstance();
}
}
return entity;
}
/**
* 在searchContext中拼接权限条件
* @param entity 实体
* @param qc 查询上下文
* @param userAuthorities 用户权限
* @param authenticationUser 当前用户
*/
@SneakyThrows
private void setPermissionCondToSearchContext(EntityBase entity, QueryWrapperContext qc , Set<String> userAuthorities ,AuthenticationUser authenticationUser){
if(entity==null)
return ;
Map<String,String> permissionField=getPermissionField(entity);//获取组织、部门预置属性
String orgField=permissionField.get("orgfield");
String orgDeptField=permissionField.get("orgsecfield");
String createManField=permissionField.get("createmanfield");
Map<String, Set<String>> userInfo = authenticationUser.getOrgInfo();
Set<String> orgParent = userInfo.get("parentorg");
Set<String> orgChild = userInfo.get("suborg");
Set<String> orgDeptParent = userInfo.get("parentdept");
Set<String> orgDeptChild = userInfo.get("subdept");
Set<String> userOrg = new HashSet<>();
Set<String> userOrgDept = new HashSet<>();
Set<String> userCreateMan = new HashSet<>();
for(String authority:userAuthorities){
if(authority.endsWith("curorg")){ //本单位
userOrg.add(authenticationUser.getOrgid());
}
else if(authority.endsWith("porg")){//上级单位
userOrg.addAll(orgParent);
}
else if(authority.endsWith("sorg")){//下级单位
userOrg.addAll(orgChild);
}
else if(authority.endsWith("curorgdept")){//本部门
userOrgDept.add(authenticationUser.getMdeptid());
}
else if(authority.endsWith("porgdept")){//上级部门
userOrgDept.addAll(orgDeptParent);
}
else if(authority.endsWith("sorgdept")){//下级部门
userOrgDept.addAll(orgDeptChild);
}
else if (authority.endsWith("createman")){
userCreateMan.add(authority);
}
}
if(userOrg.size()==0 && userOrgDept.size()==0 && userCreateMan.size()==0){
qc.getSelectCond().apply("1<>1");
}
else{
Consumer<QueryWrapper> consumer = qw -> {
if(userOrg.size()>0){
Consumer<QueryWrapper> org = orgQw -> {
orgQw.in(orgField,userOrg);
};
qw.or(org);
}
if(userOrgDept.size()>0){
Consumer<QueryWrapper> dept = deptQw -> {
deptQw.in(orgDeptField,userOrgDept);
};
qw.or(dept);
}
if(userCreateMan.size()>0){
Consumer<QueryWrapper> createMan = createManQw -> {
createManQw.eq(createManField,authenticationUser.getUserid());
};
qw.or(createMan);
}
};
qc.getSelectCond().and(consumer);
}
}
@Override
public boolean hasPermission(Authentication authentication, Serializable id, String action, Object params) {
......@@ -106,13 +212,12 @@ public class AuthPermissionEvaluator implements PermissionEvaluator {
* @param userAuthorities
* @return
*/
private boolean actionValid(EntityBase entity, String action , Set<String> userAuthorities){
private boolean actionValid(EntityBase entity, String action , Set<String> userAuthorities ,AuthenticationUser authenticationUser){
Map<String,String> permissionField=getPermissionField(entity);//获取组织、部门预置属性
String orgField=permissionField.get("orgfield");
String orgDeptField=permissionField.get("orgsecfield");
String createManField=permissionField.get("createmanfield");
AuthenticationUser authenticationUser = AuthenticationUser.getAuthenticationUser();
Map<String, Set<String>> userInfo = authenticationUser.getOrgInfo();
Set<String> orgParent = userInfo.get("parentorg");
Set<String> orgChild = userInfo.get("suborg");
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册