提交 435d12f8 编写于 作者: ibizdev's avatar ibizdev

ibizdev提交

上级 b85a3000
import EditViewEngine from './edit-view-engine';
/**
* 视图引擎基础
*
* @export
* @class WFDynaEditViewEngine
* @extends {EditViewEngine}
*/
export default class WFDynaEditViewEngine extends EditViewEngine {
/**
* Creates an instance of WFDynaEditViewEngine.
* @memberof WFDynaEditViewEngine
*/
constructor() {
super();
}
/**
* 表单加载完成
*
* @param {*} args
* @memberof WFDynaEditViewEngine
*/
public onFormLoad(arg: any): void {
super.onFormLoad(arg);
this.view.getWFLinkModel();
}
}
\ No newline at end of file
...@@ -759,7 +759,7 @@ export default class EntityService { ...@@ -759,7 +759,7 @@ export default class EntityService {
* @memberof EntityService * @memberof EntityService
*/ */
public async GetWFLink(context: any = {},data: any = {}, isloading?: boolean): Promise<any> { public async GetWFLink(context: any = {},data: any = {}, isloading?: boolean): Promise<any> {
return Http.getInstance().get(`/wfcore/${this.SYSTEMNAME}-app-${this.APPNAME}/${this.APPDENAME}/${data[this.APPDEKEY]}/usertasks/${data['taskDefinitionKey']}/ways`); return Http.getInstance().get(`/wfcore/${this.SYSTEMNAME}-app-${this.APPNAME}/${this.APPDENAME}/${context[this.APPLYDEKEY]}/usertasks/${data['taskDefinitionKey']}/ways`);
} }
/** /**
...@@ -768,13 +768,19 @@ export default class EntityService { ...@@ -768,13 +768,19 @@ export default class EntityService {
* @param {*} [context={}] * @param {*} [context={}]
* @param {*} [data={}] * @param {*} [data={}]
* @param {boolean} [isloading] * @param {boolean} [isloading]
* @param {boolean} [isEmbeddedApp] * @param {*} [localdata]
* @returns {Promise<any>} * @returns {Promise<any>}
* @memberof EntityService * @memberof EntityService
*/ */
public async WFSubmit(context: any = {},data: any = {}, isloading?: boolean,isEmbeddedApp?:boolean): Promise<any> { public async WFSubmit(context: any = {},data: any = {}, isloading?: boolean,localdata?:any): Promise<any> {
if(isEmbeddedApp){ if(localdata && Object.keys(localdata).length > 0){
return Http.getInstance().post(`/wfcore/${this.SYSTEMNAME}-app-${this.APPNAME}/${this.APPDENAME}/${data[this.APPDEKEY]}/tasks/${data['taskId']}`); const requestData:any = {};
if(data.viewparams){
delete data.viewparams;
}
Object.assign(requestData,{activedata:data});
Object.assign(requestData,localdata);
return Http.getInstance().post(`/wfcore/${this.SYSTEMNAME}-app-${this.APPNAME}/${this.APPDENAME}/${data[this.APPDEKEY]}/tasks/${localdata['taskId']}`,requestData,isloading);
}else{ }else{
const requestData:any = {}; const requestData:any = {};
if(data.srfwfmemo){ if(data.srfwfmemo){
......
...@@ -122,20 +122,21 @@ export default class DefaultService extends ControlService { ...@@ -122,20 +122,21 @@ export default class DefaultService extends ControlService {
* @param {*} [context={}] * @param {*} [context={}]
* @param {*} [data={}] * @param {*} [data={}]
* @param {boolean} [isloading] * @param {boolean} [isloading]
* @param {*} [localdata]
* @returns {Promise<any>} * @returns {Promise<any>}
* @memberof DefaultService * @memberof DefaultService
*/ */
@Errorlog @Errorlog
public wfsubmit(action: string,context: any = {}, data: any = {}, isloading?: boolean): Promise<any> { public wfsubmit(action: string,context: any = {}, data: any = {}, isloading?: boolean,localdata?:any): Promise<any> {
data = this.handleWFData(data,true); data = this.handleWFData(data,true);
context = this.handleRequestData(action,context,data).context; context = this.handleRequestData(action,context,data).context;
return new Promise((resolve: any, reject: any) => { return new Promise((resolve: any, reject: any) => {
let result: Promise<any>; let result: Promise<any>;
const _appEntityService: any = this.appEntityService; const _appEntityService: any = this.appEntityService;
if (_appEntityService[action] && _appEntityService[action] instanceof Function) { if (_appEntityService[action] && _appEntityService[action] instanceof Function) {
result = _appEntityService[action](context,data, isloading); result = _appEntityService[action](context,data, isloading,localdata);
} else { } else {
result = this.appEntityService.Create(context,data, isloading); result = this.appEntityService.WFSubmit(context,data, isloading,localdata);
} }
result.then((response) => { result.then((response) => {
this.handleResponse(action, response); this.handleResponse(action, response);
......
...@@ -1310,10 +1310,11 @@ export default class MainBase extends Vue implements ControlInterface { ...@@ -1310,10 +1310,11 @@ export default class MainBase extends Vue implements ControlInterface {
* 工作流提交 * 工作流提交
* *
* @param {*} [data={}] * @param {*} [data={}]
* @param {*} [localdata={}]
* @returns {Promise<any>} * @returns {Promise<any>}
* @memberof Main * @memberof Main
*/ */
protected async wfsubmit(data: any): Promise<any> { protected async wfsubmit(data: any,localdata?:any): Promise<any> {
return new Promise((resolve: any, reject: any) => { return new Promise((resolve: any, reject: any) => {
if(!this.WFSubmitAction){ if(!this.WFSubmitAction){
this.$Notice.error({ title: '错误', desc: 'WFGroupEditView视图表单WFSubmitAction参数未配置' }); this.$Notice.error({ title: '错误', desc: 'WFGroupEditView视图表单WFSubmitAction参数未配置' });
...@@ -1325,13 +1326,13 @@ export default class MainBase extends Vue implements ControlInterface { ...@@ -1325,13 +1326,13 @@ export default class MainBase extends Vue implements ControlInterface {
if (!arg.wfgroup || Object.is(arg.wfgroup, '')) { if (!arg.wfgroup || Object.is(arg.wfgroup, '')) {
return; return;
} }
const post: Promise<any> = Object.is(arg.srfuf, '1')?this.service.update(this.updateAction, JSON.parse(JSON.stringify(this.context)),arg, this.showBusyIndicator):this.service.add(this.createAction,JSON.parse(JSON.stringify(this.context)),arg, this.showBusyIndicator); const post: Promise<any> = Object.is(arg.srfuf, '1')?this.service.update(this.updateAction, JSON.parse(JSON.stringify(this.context)),arg, this.showBusyIndicator):this.service.add(this.createAction,JSON.parse(JSON.stringify(this.context)),arg, this.showBusyIndicator,localdata);
post.then((response:any) =>{ post.then((response:any) =>{
const arg:any = response.data; const arg:any = response.data;
if(this.viewparams){ if(this.viewparams){
Object.assign(arg,{viewparams:this.viewparams}); Object.assign(arg,{viewparams:this.viewparams});
} }
const result: Promise<any> = this.service.wfsubmit(_this.WFSubmitAction, JSON.parse(JSON.stringify(this.context)),arg, this.showBusyIndicator); const result: Promise<any> = this.service.wfsubmit(_this.WFSubmitAction, JSON.parse(JSON.stringify(this.context)),arg, this.showBusyIndicator,localdata);
result.then((response: any) => { result.then((response: any) => {
if (!response || response.status !== 200) { if (!response || response.status !== 200) {
this.$Notice.error({ title: '', desc: '工作流提交失败, ' + response.info }); this.$Notice.error({ title: '', desc: '工作流提交失败, ' + response.info });
......
...@@ -122,20 +122,21 @@ export default class MainService extends ControlService { ...@@ -122,20 +122,21 @@ export default class MainService extends ControlService {
* @param {*} [context={}] * @param {*} [context={}]
* @param {*} [data={}] * @param {*} [data={}]
* @param {boolean} [isloading] * @param {boolean} [isloading]
* @param {*} [localdata]
* @returns {Promise<any>} * @returns {Promise<any>}
* @memberof MainService * @memberof MainService
*/ */
@Errorlog @Errorlog
public wfsubmit(action: string,context: any = {}, data: any = {}, isloading?: boolean): Promise<any> { public wfsubmit(action: string,context: any = {}, data: any = {}, isloading?: boolean,localdata?:any): Promise<any> {
data = this.handleWFData(data,true); data = this.handleWFData(data,true);
context = this.handleRequestData(action,context,data).context; context = this.handleRequestData(action,context,data).context;
return new Promise((resolve: any, reject: any) => { return new Promise((resolve: any, reject: any) => {
let result: Promise<any>; let result: Promise<any>;
const _appEntityService: any = this.appEntityService; const _appEntityService: any = this.appEntityService;
if (_appEntityService[action] && _appEntityService[action] instanceof Function) { if (_appEntityService[action] && _appEntityService[action] instanceof Function) {
result = _appEntityService[action](context,data, isloading); result = _appEntityService[action](context,data, isloading,localdata);
} else { } else {
result = this.appEntityService.Create(context,data, isloading); result = this.appEntityService.WFSubmit(context,data, isloading,localdata);
} }
result.then((response) => { result.then((response) => {
this.handleResponse(action, response); this.handleResponse(action, response);
......
...@@ -122,20 +122,21 @@ export default class DefaultService extends ControlService { ...@@ -122,20 +122,21 @@ export default class DefaultService extends ControlService {
* @param {*} [context={}] * @param {*} [context={}]
* @param {*} [data={}] * @param {*} [data={}]
* @param {boolean} [isloading] * @param {boolean} [isloading]
* @param {*} [localdata]
* @returns {Promise<any>} * @returns {Promise<any>}
* @memberof DefaultService * @memberof DefaultService
*/ */
@Errorlog @Errorlog
public wfsubmit(action: string,context: any = {}, data: any = {}, isloading?: boolean): Promise<any> { public wfsubmit(action: string,context: any = {}, data: any = {}, isloading?: boolean,localdata?:any): Promise<any> {
data = this.handleWFData(data,true); data = this.handleWFData(data,true);
context = this.handleRequestData(action,context,data).context; context = this.handleRequestData(action,context,data).context;
return new Promise((resolve: any, reject: any) => { return new Promise((resolve: any, reject: any) => {
let result: Promise<any>; let result: Promise<any>;
const _appEntityService: any = this.appEntityService; const _appEntityService: any = this.appEntityService;
if (_appEntityService[action] && _appEntityService[action] instanceof Function) { if (_appEntityService[action] && _appEntityService[action] instanceof Function) {
result = _appEntityService[action](context,data, isloading); result = _appEntityService[action](context,data, isloading,localdata);
} else { } else {
result = this.appEntityService.Create(context,data, isloading); result = this.appEntityService.WFSubmit(context,data, isloading,localdata);
} }
result.then((response) => { result.then((response) => {
this.handleResponse(action, response); this.handleResponse(action, response);
......
...@@ -1319,10 +1319,11 @@ export default class MainBase extends Vue implements ControlInterface { ...@@ -1319,10 +1319,11 @@ export default class MainBase extends Vue implements ControlInterface {
* 工作流提交 * 工作流提交
* *
* @param {*} [data={}] * @param {*} [data={}]
* @param {*} [localdata={}]
* @returns {Promise<any>} * @returns {Promise<any>}
* @memberof Main * @memberof Main
*/ */
protected async wfsubmit(data: any): Promise<any> { protected async wfsubmit(data: any,localdata?:any): Promise<any> {
return new Promise((resolve: any, reject: any) => { return new Promise((resolve: any, reject: any) => {
if(!this.WFSubmitAction){ if(!this.WFSubmitAction){
this.$Notice.error({ title: '错误', desc: 'WFMemberEditView视图表单WFSubmitAction参数未配置' }); this.$Notice.error({ title: '错误', desc: 'WFMemberEditView视图表单WFSubmitAction参数未配置' });
...@@ -1334,13 +1335,13 @@ export default class MainBase extends Vue implements ControlInterface { ...@@ -1334,13 +1335,13 @@ export default class MainBase extends Vue implements ControlInterface {
if (!arg.wfmember || Object.is(arg.wfmember, '')) { if (!arg.wfmember || Object.is(arg.wfmember, '')) {
return; return;
} }
const post: Promise<any> = Object.is(arg.srfuf, '1')?this.service.update(this.updateAction, JSON.parse(JSON.stringify(this.context)),arg, this.showBusyIndicator):this.service.add(this.createAction,JSON.parse(JSON.stringify(this.context)),arg, this.showBusyIndicator); const post: Promise<any> = Object.is(arg.srfuf, '1')?this.service.update(this.updateAction, JSON.parse(JSON.stringify(this.context)),arg, this.showBusyIndicator):this.service.add(this.createAction,JSON.parse(JSON.stringify(this.context)),arg, this.showBusyIndicator,localdata);
post.then((response:any) =>{ post.then((response:any) =>{
const arg:any = response.data; const arg:any = response.data;
if(this.viewparams){ if(this.viewparams){
Object.assign(arg,{viewparams:this.viewparams}); Object.assign(arg,{viewparams:this.viewparams});
} }
const result: Promise<any> = this.service.wfsubmit(_this.WFSubmitAction, JSON.parse(JSON.stringify(this.context)),arg, this.showBusyIndicator); const result: Promise<any> = this.service.wfsubmit(_this.WFSubmitAction, JSON.parse(JSON.stringify(this.context)),arg, this.showBusyIndicator,localdata);
result.then((response: any) => { result.then((response: any) => {
if (!response || response.status !== 200) { if (!response || response.status !== 200) {
this.$Notice.error({ title: '', desc: '工作流提交失败, ' + response.info }); this.$Notice.error({ title: '', desc: '工作流提交失败, ' + response.info });
......
...@@ -134,20 +134,21 @@ export default class MainService extends ControlService { ...@@ -134,20 +134,21 @@ export default class MainService extends ControlService {
* @param {*} [context={}] * @param {*} [context={}]
* @param {*} [data={}] * @param {*} [data={}]
* @param {boolean} [isloading] * @param {boolean} [isloading]
* @param {*} [localdata]
* @returns {Promise<any>} * @returns {Promise<any>}
* @memberof MainService * @memberof MainService
*/ */
@Errorlog @Errorlog
public wfsubmit(action: string,context: any = {}, data: any = {}, isloading?: boolean): Promise<any> { public wfsubmit(action: string,context: any = {}, data: any = {}, isloading?: boolean,localdata?:any): Promise<any> {
data = this.handleWFData(data,true); data = this.handleWFData(data,true);
context = this.handleRequestData(action,context,data).context; context = this.handleRequestData(action,context,data).context;
return new Promise((resolve: any, reject: any) => { return new Promise((resolve: any, reject: any) => {
let result: Promise<any>; let result: Promise<any>;
const _appEntityService: any = this.appEntityService; const _appEntityService: any = this.appEntityService;
if (_appEntityService[action] && _appEntityService[action] instanceof Function) { if (_appEntityService[action] && _appEntityService[action] instanceof Function) {
result = _appEntityService[action](context,data, isloading); result = _appEntityService[action](context,data, isloading,localdata);
} else { } else {
result = this.appEntityService.Create(context,data, isloading); result = this.appEntityService.WFSubmit(context,data, isloading,localdata);
} }
result.then((response) => { result.then((response) => {
this.handleResponse(action, response); this.handleResponse(action, response);
......
...@@ -122,20 +122,21 @@ export default class DefaultService extends ControlService { ...@@ -122,20 +122,21 @@ export default class DefaultService extends ControlService {
* @param {*} [context={}] * @param {*} [context={}]
* @param {*} [data={}] * @param {*} [data={}]
* @param {boolean} [isloading] * @param {boolean} [isloading]
* @param {*} [localdata]
* @returns {Promise<any>} * @returns {Promise<any>}
* @memberof DefaultService * @memberof DefaultService
*/ */
@Errorlog @Errorlog
public wfsubmit(action: string,context: any = {}, data: any = {}, isloading?: boolean): Promise<any> { public wfsubmit(action: string,context: any = {}, data: any = {}, isloading?: boolean,localdata?:any): Promise<any> {
data = this.handleWFData(data,true); data = this.handleWFData(data,true);
context = this.handleRequestData(action,context,data).context; context = this.handleRequestData(action,context,data).context;
return new Promise((resolve: any, reject: any) => { return new Promise((resolve: any, reject: any) => {
let result: Promise<any>; let result: Promise<any>;
const _appEntityService: any = this.appEntityService; const _appEntityService: any = this.appEntityService;
if (_appEntityService[action] && _appEntityService[action] instanceof Function) { if (_appEntityService[action] && _appEntityService[action] instanceof Function) {
result = _appEntityService[action](context,data, isloading); result = _appEntityService[action](context,data, isloading,localdata);
} else { } else {
result = this.appEntityService.Create(context,data, isloading); result = this.appEntityService.WFSubmit(context,data, isloading,localdata);
} }
result.then((response) => { result.then((response) => {
this.handleResponse(action, response); this.handleResponse(action, response);
......
...@@ -1424,10 +1424,11 @@ export default class MainBase extends Vue implements ControlInterface { ...@@ -1424,10 +1424,11 @@ export default class MainBase extends Vue implements ControlInterface {
* 工作流提交 * 工作流提交
* *
* @param {*} [data={}] * @param {*} [data={}]
* @param {*} [localdata={}]
* @returns {Promise<any>} * @returns {Promise<any>}
* @memberof Main * @memberof Main
*/ */
protected async wfsubmit(data: any): Promise<any> { protected async wfsubmit(data: any,localdata?:any): Promise<any> {
return new Promise((resolve: any, reject: any) => { return new Promise((resolve: any, reject: any) => {
if(!this.WFSubmitAction){ if(!this.WFSubmitAction){
this.$Notice.error({ title: '错误', desc: 'WFProcessDefinitionEditView视图表单WFSubmitAction参数未配置' }); this.$Notice.error({ title: '错误', desc: 'WFProcessDefinitionEditView视图表单WFSubmitAction参数未配置' });
...@@ -1439,13 +1440,13 @@ export default class MainBase extends Vue implements ControlInterface { ...@@ -1439,13 +1440,13 @@ export default class MainBase extends Vue implements ControlInterface {
if (!arg.wfprocessdefinition || Object.is(arg.wfprocessdefinition, '')) { if (!arg.wfprocessdefinition || Object.is(arg.wfprocessdefinition, '')) {
return; return;
} }
const post: Promise<any> = Object.is(arg.srfuf, '1')?this.service.update(this.updateAction, JSON.parse(JSON.stringify(this.context)),arg, this.showBusyIndicator):this.service.add(this.createAction,JSON.parse(JSON.stringify(this.context)),arg, this.showBusyIndicator); const post: Promise<any> = Object.is(arg.srfuf, '1')?this.service.update(this.updateAction, JSON.parse(JSON.stringify(this.context)),arg, this.showBusyIndicator):this.service.add(this.createAction,JSON.parse(JSON.stringify(this.context)),arg, this.showBusyIndicator,localdata);
post.then((response:any) =>{ post.then((response:any) =>{
const arg:any = response.data; const arg:any = response.data;
if(this.viewparams){ if(this.viewparams){
Object.assign(arg,{viewparams:this.viewparams}); Object.assign(arg,{viewparams:this.viewparams});
} }
const result: Promise<any> = this.service.wfsubmit(_this.WFSubmitAction, JSON.parse(JSON.stringify(this.context)),arg, this.showBusyIndicator); const result: Promise<any> = this.service.wfsubmit(_this.WFSubmitAction, JSON.parse(JSON.stringify(this.context)),arg, this.showBusyIndicator,localdata);
result.then((response: any) => { result.then((response: any) => {
if (!response || response.status !== 200) { if (!response || response.status !== 200) {
this.$Notice.error({ title: '', desc: '工作流提交失败, ' + response.info }); this.$Notice.error({ title: '', desc: '工作流提交失败, ' + response.info });
......
...@@ -122,20 +122,21 @@ export default class MainService extends ControlService { ...@@ -122,20 +122,21 @@ export default class MainService extends ControlService {
* @param {*} [context={}] * @param {*} [context={}]
* @param {*} [data={}] * @param {*} [data={}]
* @param {boolean} [isloading] * @param {boolean} [isloading]
* @param {*} [localdata]
* @returns {Promise<any>} * @returns {Promise<any>}
* @memberof MainService * @memberof MainService
*/ */
@Errorlog @Errorlog
public wfsubmit(action: string,context: any = {}, data: any = {}, isloading?: boolean): Promise<any> { public wfsubmit(action: string,context: any = {}, data: any = {}, isloading?: boolean,localdata?:any): Promise<any> {
data = this.handleWFData(data,true); data = this.handleWFData(data,true);
context = this.handleRequestData(action,context,data).context; context = this.handleRequestData(action,context,data).context;
return new Promise((resolve: any, reject: any) => { return new Promise((resolve: any, reject: any) => {
let result: Promise<any>; let result: Promise<any>;
const _appEntityService: any = this.appEntityService; const _appEntityService: any = this.appEntityService;
if (_appEntityService[action] && _appEntityService[action] instanceof Function) { if (_appEntityService[action] && _appEntityService[action] instanceof Function) {
result = _appEntityService[action](context,data, isloading); result = _appEntityService[action](context,data, isloading,localdata);
} else { } else {
result = this.appEntityService.Create(context,data, isloading); result = this.appEntityService.WFSubmit(context,data, isloading,localdata);
} }
result.then((response) => { result.then((response) => {
this.handleResponse(action, response); this.handleResponse(action, response);
......
...@@ -122,20 +122,21 @@ export default class DefaultService extends ControlService { ...@@ -122,20 +122,21 @@ export default class DefaultService extends ControlService {
* @param {*} [context={}] * @param {*} [context={}]
* @param {*} [data={}] * @param {*} [data={}]
* @param {boolean} [isloading] * @param {boolean} [isloading]
* @param {*} [localdata]
* @returns {Promise<any>} * @returns {Promise<any>}
* @memberof DefaultService * @memberof DefaultService
*/ */
@Errorlog @Errorlog
public wfsubmit(action: string,context: any = {}, data: any = {}, isloading?: boolean): Promise<any> { public wfsubmit(action: string,context: any = {}, data: any = {}, isloading?: boolean,localdata?:any): Promise<any> {
data = this.handleWFData(data,true); data = this.handleWFData(data,true);
context = this.handleRequestData(action,context,data).context; context = this.handleRequestData(action,context,data).context;
return new Promise((resolve: any, reject: any) => { return new Promise((resolve: any, reject: any) => {
let result: Promise<any>; let result: Promise<any>;
const _appEntityService: any = this.appEntityService; const _appEntityService: any = this.appEntityService;
if (_appEntityService[action] && _appEntityService[action] instanceof Function) { if (_appEntityService[action] && _appEntityService[action] instanceof Function) {
result = _appEntityService[action](context,data, isloading); result = _appEntityService[action](context,data, isloading,localdata);
} else { } else {
result = this.appEntityService.Create(context,data, isloading); result = this.appEntityService.WFSubmit(context,data, isloading,localdata);
} }
result.then((response) => { result.then((response) => {
this.handleResponse(action, response); this.handleResponse(action, response);
......
...@@ -1268,10 +1268,11 @@ export default class MainBase extends Vue implements ControlInterface { ...@@ -1268,10 +1268,11 @@ export default class MainBase extends Vue implements ControlInterface {
* 工作流提交 * 工作流提交
* *
* @param {*} [data={}] * @param {*} [data={}]
* @param {*} [localdata={}]
* @returns {Promise<any>} * @returns {Promise<any>}
* @memberof Main * @memberof Main
*/ */
protected async wfsubmit(data: any): Promise<any> { protected async wfsubmit(data: any,localdata?:any): Promise<any> {
return new Promise((resolve: any, reject: any) => { return new Promise((resolve: any, reject: any) => {
if(!this.WFSubmitAction){ if(!this.WFSubmitAction){
this.$Notice.error({ title: '错误', desc: 'WFUserEditView视图表单WFSubmitAction参数未配置' }); this.$Notice.error({ title: '错误', desc: 'WFUserEditView视图表单WFSubmitAction参数未配置' });
...@@ -1283,13 +1284,13 @@ export default class MainBase extends Vue implements ControlInterface { ...@@ -1283,13 +1284,13 @@ export default class MainBase extends Vue implements ControlInterface {
if (!arg.wfuser || Object.is(arg.wfuser, '')) { if (!arg.wfuser || Object.is(arg.wfuser, '')) {
return; return;
} }
const post: Promise<any> = Object.is(arg.srfuf, '1')?this.service.update(this.updateAction, JSON.parse(JSON.stringify(this.context)),arg, this.showBusyIndicator):this.service.add(this.createAction,JSON.parse(JSON.stringify(this.context)),arg, this.showBusyIndicator); const post: Promise<any> = Object.is(arg.srfuf, '1')?this.service.update(this.updateAction, JSON.parse(JSON.stringify(this.context)),arg, this.showBusyIndicator):this.service.add(this.createAction,JSON.parse(JSON.stringify(this.context)),arg, this.showBusyIndicator,localdata);
post.then((response:any) =>{ post.then((response:any) =>{
const arg:any = response.data; const arg:any = response.data;
if(this.viewparams){ if(this.viewparams){
Object.assign(arg,{viewparams:this.viewparams}); Object.assign(arg,{viewparams:this.viewparams});
} }
const result: Promise<any> = this.service.wfsubmit(_this.WFSubmitAction, JSON.parse(JSON.stringify(this.context)),arg, this.showBusyIndicator); const result: Promise<any> = this.service.wfsubmit(_this.WFSubmitAction, JSON.parse(JSON.stringify(this.context)),arg, this.showBusyIndicator,localdata);
result.then((response: any) => { result.then((response: any) => {
if (!response || response.status !== 200) { if (!response || response.status !== 200) {
this.$Notice.error({ title: '', desc: '工作流提交失败, ' + response.info }); this.$Notice.error({ title: '', desc: '工作流提交失败, ' + response.info });
......
...@@ -122,20 +122,21 @@ export default class MainService extends ControlService { ...@@ -122,20 +122,21 @@ export default class MainService extends ControlService {
* @param {*} [context={}] * @param {*} [context={}]
* @param {*} [data={}] * @param {*} [data={}]
* @param {boolean} [isloading] * @param {boolean} [isloading]
* @param {*} [localdata]
* @returns {Promise<any>} * @returns {Promise<any>}
* @memberof MainService * @memberof MainService
*/ */
@Errorlog @Errorlog
public wfsubmit(action: string,context: any = {}, data: any = {}, isloading?: boolean): Promise<any> { public wfsubmit(action: string,context: any = {}, data: any = {}, isloading?: boolean,localdata?:any): Promise<any> {
data = this.handleWFData(data,true); data = this.handleWFData(data,true);
context = this.handleRequestData(action,context,data).context; context = this.handleRequestData(action,context,data).context;
return new Promise((resolve: any, reject: any) => { return new Promise((resolve: any, reject: any) => {
let result: Promise<any>; let result: Promise<any>;
const _appEntityService: any = this.appEntityService; const _appEntityService: any = this.appEntityService;
if (_appEntityService[action] && _appEntityService[action] instanceof Function) { if (_appEntityService[action] && _appEntityService[action] instanceof Function) {
result = _appEntityService[action](context,data, isloading); result = _appEntityService[action](context,data, isloading,localdata);
} else { } else {
result = this.appEntityService.Create(context,data, isloading); result = this.appEntityService.WFSubmit(context,data, isloading,localdata);
} }
result.then((response) => { result.then((response) => {
this.handleResponse(action, response); this.handleResponse(action, response);
......
...@@ -38,11 +38,6 @@ ...@@ -38,11 +38,6 @@
git clone -b master $para2 ibzwf/ git clone -b master $para2 ibzwf/
export NODE_OPTIONS=--max-old-space-size=4096 export NODE_OPTIONS=--max-old-space-size=4096
cd ibzwf/ cd ibzwf/
mvn clean package -Papi
cd ibzwf-provider/ibzwf-provider-api
mvn -Papi docker:build
mvn -Papi docker:push
docker -H $para1 stack deploy --compose-file=src/main/docker/ibzwf-provider-api.yaml dev --with-registry-auth
</command> </command>
</hudson.tasks.Shell> </hudson.tasks.Shell>
</builders> </builders>
......
...@@ -6,7 +6,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper; ...@@ -6,7 +6,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.conditions.Wrapper; import com.baomidou.mybatisplus.core.conditions.Wrapper;
import java.util.Map; import java.util.HashMap;
import org.apache.ibatis.annotations.Select; import org.apache.ibatis.annotations.Select;
import cn.ibizlab.core.workflow.domain.WFGroup; import cn.ibizlab.core.workflow.domain.WFGroup;
import cn.ibizlab.core.workflow.filter.WFGroupSearchContext; import cn.ibizlab.core.workflow.filter.WFGroupSearchContext;
......
...@@ -6,7 +6,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper; ...@@ -6,7 +6,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.conditions.Wrapper; import com.baomidou.mybatisplus.core.conditions.Wrapper;
import java.util.Map; import java.util.HashMap;
import org.apache.ibatis.annotations.Select; import org.apache.ibatis.annotations.Select;
import cn.ibizlab.core.workflow.domain.WFMember; import cn.ibizlab.core.workflow.domain.WFMember;
import cn.ibizlab.core.workflow.filter.WFMemberSearchContext; import cn.ibizlab.core.workflow.filter.WFMemberSearchContext;
......
...@@ -6,7 +6,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper; ...@@ -6,7 +6,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.conditions.Wrapper; import com.baomidou.mybatisplus.core.conditions.Wrapper;
import java.util.Map; import java.util.HashMap;
import org.apache.ibatis.annotations.Select; import org.apache.ibatis.annotations.Select;
import cn.ibizlab.core.workflow.domain.WFProcessDefinition; import cn.ibizlab.core.workflow.domain.WFProcessDefinition;
import cn.ibizlab.core.workflow.filter.WFProcessDefinitionSearchContext; import cn.ibizlab.core.workflow.filter.WFProcessDefinitionSearchContext;
......
...@@ -6,7 +6,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper; ...@@ -6,7 +6,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.conditions.Wrapper; import com.baomidou.mybatisplus.core.conditions.Wrapper;
import java.util.Map; import java.util.HashMap;
import org.apache.ibatis.annotations.Select; import org.apache.ibatis.annotations.Select;
import cn.ibizlab.core.workflow.domain.WFSystem; import cn.ibizlab.core.workflow.domain.WFSystem;
import cn.ibizlab.core.workflow.filter.WFSystemSearchContext; import cn.ibizlab.core.workflow.filter.WFSystemSearchContext;
......
...@@ -6,7 +6,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper; ...@@ -6,7 +6,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.conditions.Wrapper; import com.baomidou.mybatisplus.core.conditions.Wrapper;
import java.util.Map; import java.util.HashMap;
import org.apache.ibatis.annotations.Select; import org.apache.ibatis.annotations.Select;
import cn.ibizlab.core.workflow.domain.WFUser; import cn.ibizlab.core.workflow.domain.WFUser;
import cn.ibizlab.core.workflow.filter.WFUserSearchContext; import cn.ibizlab.core.workflow.filter.WFUserSearchContext;
......
...@@ -5,6 +5,7 @@ import java.util.ArrayList; ...@@ -5,6 +5,7 @@ import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Set; import java.util.Set;
import java.util.HashSet; import java.util.HashSet;
import java.util.HashMap;
import java.util.Collection; import java.util.Collection;
import java.util.Objects; import java.util.Objects;
import java.util.Optional; import java.util.Optional;
......
...@@ -5,6 +5,7 @@ import java.util.ArrayList; ...@@ -5,6 +5,7 @@ import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Set; import java.util.Set;
import java.util.HashSet; import java.util.HashSet;
import java.util.HashMap;
import java.util.Collection; import java.util.Collection;
import java.util.Objects; import java.util.Objects;
import java.util.Optional; import java.util.Optional;
......
...@@ -5,6 +5,7 @@ import java.util.ArrayList; ...@@ -5,6 +5,7 @@ import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Set; import java.util.Set;
import java.util.HashSet; import java.util.HashSet;
import java.util.HashMap;
import java.util.Collection; import java.util.Collection;
import java.util.Objects; import java.util.Objects;
import java.util.Optional; import java.util.Optional;
......
...@@ -5,6 +5,7 @@ import java.util.ArrayList; ...@@ -5,6 +5,7 @@ import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Set; import java.util.Set;
import java.util.HashSet; import java.util.HashSet;
import java.util.HashMap;
import java.util.Collection; import java.util.Collection;
import java.util.Objects; import java.util.Objects;
import java.util.Optional; import java.util.Optional;
......
...@@ -5,6 +5,7 @@ import java.util.ArrayList; ...@@ -5,6 +5,7 @@ import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Set; import java.util.Set;
import java.util.HashSet; import java.util.HashSet;
import java.util.HashMap;
import java.util.Collection; import java.util.Collection;
import java.util.Objects; import java.util.Objects;
import java.util.Optional; import java.util.Optional;
......
...@@ -5,6 +5,7 @@ import java.util.ArrayList; ...@@ -5,6 +5,7 @@ import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Set; import java.util.Set;
import java.util.HashSet; import java.util.HashSet;
import java.util.HashMap;
import java.util.Collection; import java.util.Collection;
import java.util.Objects; import java.util.Objects;
import java.util.Optional; import java.util.Optional;
......
...@@ -5,6 +5,7 @@ import java.util.ArrayList; ...@@ -5,6 +5,7 @@ import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Set; import java.util.Set;
import java.util.HashSet; import java.util.HashSet;
import java.util.HashMap;
import java.util.Collection; import java.util.Collection;
import java.util.Objects; import java.util.Objects;
import java.util.Optional; import java.util.Optional;
......
...@@ -5,6 +5,7 @@ import java.util.ArrayList; ...@@ -5,6 +5,7 @@ import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Set; import java.util.Set;
import java.util.HashSet; import java.util.HashSet;
import java.util.HashMap;
import java.util.Collection; import java.util.Collection;
import java.util.Objects; import java.util.Objects;
import java.util.Optional; import java.util.Optional;
......
...@@ -5,6 +5,7 @@ import java.util.ArrayList; ...@@ -5,6 +5,7 @@ import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Set; import java.util.Set;
import java.util.HashSet; import java.util.HashSet;
import java.util.HashMap;
import java.util.Collection; import java.util.Collection;
import java.util.Objects; import java.util.Objects;
import java.util.Optional; import java.util.Optional;
......
...@@ -9,6 +9,6 @@ CMD echo "The application will start in ${IBZ_SLEEP}s..." && \ ...@@ -9,6 +9,6 @@ CMD echo "The application will start in ${IBZ_SLEEP}s..." && \
sleep ${IBZ_SLEEP} && \ sleep ${IBZ_SLEEP} && \
java ${JAVA_OPTS} -Djava.security.egd=file:/dev/./urandom -jar /ibzwf-provider-api.jar java ${JAVA_OPTS} -Djava.security.egd=file:/dev/./urandom -jar /ibzwf-provider-api.jar
EXPOSE 40003 EXPOSE 8081
ADD ibzwf-provider-api.jar /ibzwf-provider-api.jar ADD ibzwf-provider-api.jar /ibzwf-provider-api.jar
...@@ -3,11 +3,9 @@ services: ...@@ -3,11 +3,9 @@ services:
ibzwf-provider-api: ibzwf-provider-api:
image: registry.cn-shanghai.aliyuncs.com/ibizsys/ibzwf-provider-api:latest image: registry.cn-shanghai.aliyuncs.com/ibizsys/ibzwf-provider-api:latest
ports: ports:
- "40003:40003" - "8081:8081"
networks: networks:
- agent_network - agent_network
environment:
SPRING_CLOUD_NACOS_DISCOVERY_IP: 172.16.180.237
deploy: deploy:
mode: replicated mode: replicated
replicas: 1 replicas: 1
......
server: server:
port: 40003 port: 8081
\ No newline at end of file \ No newline at end of file
package cn.ibizlab.util.client; package cn.ibizlab.util.client;
import com.alibaba.fastjson.JSONObject; import cn.ibizlab.util.security.AuthenticationUser;
import cn.ibizlab.util.security.AuthorizationLogin;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import java.util.Map; import java.util.Map;
...@@ -8,12 +9,12 @@ import java.util.Map; ...@@ -8,12 +9,12 @@ import java.util.Map;
public class IBZUAAFallback implements IBZUAAFeignClient { public class IBZUAAFallback implements IBZUAAFeignClient {
@Override @Override
public JSONObject getUserPermissionData(String loginName, String systemId) { public Map<String, Object> pushSystemPermissionData(Map<String, Object> systemPermissionData, String systemId) {
return null; return null;
} }
@Override @Override
public Map<String, Object> pushSystemPermissionData(Map<String, Object> systemPermissionData, String systemId) { public AuthenticationUser login(AuthorizationLogin authorizationLogin) {
return null; return null;
} }
......
package cn.ibizlab.util.client; package cn.ibizlab.util.client;
import com.alibaba.fastjson.JSONObject; import cn.ibizlab.util.security.AuthenticationUser;
import cn.ibizlab.util.security.AuthorizationLogin;
import org.springframework.cloud.openfeign.FeignClient; import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import java.util.Map; import java.util.Map;
...@@ -8,16 +9,6 @@ import java.util.Map; ...@@ -8,16 +9,6 @@ import java.util.Map;
@FeignClient(value = "ibzuaa",fallback = IBZUAAFallback.class) @FeignClient(value = "ibzuaa",fallback = IBZUAAFallback.class)
public interface IBZUAAFeignClient public interface IBZUAAFeignClient
{ {
/**
* 从uaa中获取当前用户权限
* @param loginName
* @param systemId
* @return
*/
@GetMapping(value = "/uaa/permission/{loginname}")
JSONObject getUserPermissionData(@PathVariable("loginname") String loginName, @RequestParam("systemid") String systemId);
/** /**
* 推送系统权限数据到uaa * 推送系统权限数据到uaa
* @param systemPermissionData * @param systemPermissionData
...@@ -27,4 +18,12 @@ public interface IBZUAAFeignClient ...@@ -27,4 +18,12 @@ public interface IBZUAAFeignClient
@PostMapping("/uaa/permission/save") @PostMapping("/uaa/permission/save")
Map<String,Object> pushSystemPermissionData(@RequestBody Map<String, Object> systemPermissionData, @RequestParam("systemid") String systemId); Map<String,Object> pushSystemPermissionData(@RequestBody Map<String, Object> systemPermissionData, @RequestParam("systemid") String systemId);
/**
* 用户登录
* @param authorizationLogin 登录信息
* @return
*/
@PostMapping(value = "/uaa/authentication/login")
AuthenticationUser login(@RequestBody AuthorizationLogin authorizationLogin);
} }
...@@ -4,8 +4,6 @@ import com.alibaba.fastjson.JSONArray; ...@@ -4,8 +4,6 @@ import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.mongodb.BasicDBList;
import com.mongodb.BasicDBObject;
import com.mongodb.QueryBuilder; import com.mongodb.QueryBuilder;
import cn.ibizlab.util.annotation.DEField; import cn.ibizlab.util.annotation.DEField;
import cn.ibizlab.util.domain.EntityBase; import cn.ibizlab.util.domain.EntityBase;
...@@ -13,9 +11,7 @@ import cn.ibizlab.util.enums.DEPredefinedFieldType; ...@@ -13,9 +11,7 @@ import cn.ibizlab.util.enums.DEPredefinedFieldType;
import cn.ibizlab.util.filter.QueryBuildContext; import cn.ibizlab.util.filter.QueryBuildContext;
import cn.ibizlab.util.filter.QueryWrapperContext; import cn.ibizlab.util.filter.QueryWrapperContext;
import cn.ibizlab.util.helper.DEFieldCacheMap; import cn.ibizlab.util.helper.DEFieldCacheMap;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.data.domain.PageImpl;
import org.springframework.data.mongodb.core.MongoTemplate; import org.springframework.data.mongodb.core.MongoTemplate;
import org.springframework.data.mongodb.core.query.BasicQuery; import org.springframework.data.mongodb.core.query.BasicQuery;
import org.springframework.data.mongodb.core.query.Query; import org.springframework.data.mongodb.core.query.Query;
...@@ -25,13 +21,9 @@ import org.springframework.stereotype.Component; ...@@ -25,13 +21,9 @@ import org.springframework.stereotype.Component;
import org.springframework.util.ObjectUtils; import org.springframework.util.ObjectUtils;
import org.springframework.util.StringUtils; import org.springframework.util.StringUtils;
import javax.annotation.Resource; import javax.annotation.Resource;
import javax.swing.text.html.parser.Entity;
import java.io.Serializable; import java.io.Serializable;
import java.lang.reflect.Field; import java.lang.reflect.Field;
import java.util.ArrayList; import java.util.*;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/** /**
* spring security 权限管理类 * spring security 权限管理类
...@@ -440,13 +432,11 @@ public class AuthPermissionEvaluator implements PermissionEvaluator { ...@@ -440,13 +432,11 @@ public class AuthPermissionEvaluator implements PermissionEvaluator {
String orgDeptField=permissionField.get("orgsecfield"); String orgDeptField=permissionField.get("orgsecfield");
String createManField=permissionField.get("createmanfield"); String createManField=permissionField.get("createmanfield");
AuthenticationUser authenticationUser = AuthenticationUser.getAuthenticationUser(); AuthenticationUser authenticationUser = AuthenticationUser.getAuthenticationUser();
JSONObject userInfo = authenticationUser.getOrgInfo(); Map<String, Set<String>> userInfo = authenticationUser.getOrgInfo();
JSONObject orgObject = userInfo.getJSONObject("org"); Set<String> orgParent = userInfo.get("parentorg");
JSONArray orgParent = orgObject.getJSONArray("porg"); Set<String> orgChild = userInfo.get("suborg");
JSONArray orgChild = orgObject.getJSONArray("sorg"); Set<String> orgDeptParent = userInfo.get("parentdept");
JSONObject orgDeptObject = userInfo.getJSONObject("orgdept"); Set<String> orgDeptChild = userInfo.get("subdept");
JSONArray orgDeptParent = orgDeptObject.getJSONArray("porgdept");
JSONArray orgDeptChild = orgDeptObject.getJSONArray("sorgdept");
for(int i=0;i<oppriList.size();i++){ for(int i=0;i<oppriList.size();i++){
String permissionCond=oppriList.getString(i);//权限配置条件 String permissionCond=oppriList.getString(i);//权限配置条件
...@@ -492,13 +482,11 @@ public class AuthPermissionEvaluator implements PermissionEvaluator { ...@@ -492,13 +482,11 @@ public class AuthPermissionEvaluator implements PermissionEvaluator {
String createManField=permissionField.get("createmanfield"); String createManField=permissionField.get("createmanfield");
StringBuffer permissionSQL=new StringBuffer(); StringBuffer permissionSQL=new StringBuffer();
AuthenticationUser authenticationUser = AuthenticationUser.getAuthenticationUser(); AuthenticationUser authenticationUser = AuthenticationUser.getAuthenticationUser();
JSONObject userInfo = authenticationUser.getOrgInfo(); Map<String, Set<String>> userInfo = authenticationUser.getOrgInfo();
JSONObject orgObject = userInfo.getJSONObject("org"); Set<String> orgParent = userInfo.get("parentorg");
JSONArray orgParent = orgObject.getJSONArray("porg"); Set<String> orgChild = userInfo.get("suborg");
JSONArray orgChild = orgObject.getJSONArray("sorg"); Set<String> orgDeptParent = userInfo.get("parentdept");
JSONObject orgDeptObject = userInfo.getJSONObject("orgdept"); Set<String> orgDeptChild = userInfo.get("subdept");
JSONArray orgDeptParent = orgDeptObject.getJSONArray("porgdept");
JSONArray orgDeptChild = orgDeptObject.getJSONArray("sorgdept");
for(int i=0;i<oppriList.size();i++){ for(int i=0;i<oppriList.size();i++){
permissionSQL.append("OR"); permissionSQL.append("OR");
...@@ -607,7 +595,7 @@ public class AuthPermissionEvaluator implements PermissionEvaluator { ...@@ -607,7 +595,7 @@ public class AuthPermissionEvaluator implements PermissionEvaluator {
* 转换[a,b]格式字符串到 'a','b'格式 * 转换[a,b]格式字符串到 'a','b'格式
* @return * @return
*/ */
private String formatStringArr(JSONArray array) { private String formatStringArr(Set<String> array) {
String[] arr = array.toArray(new String[array.size()]); String[] arr = array.toArray(new String[array.size()]);
return "'" + String.join("','", arr) + "'"; return "'" + String.join("','", arr) + "'";
......
...@@ -12,6 +12,7 @@ import java.util.Map; ...@@ -12,6 +12,7 @@ import java.util.Map;
import java.util.HashMap; import java.util.HashMap;
import java.sql.Timestamp; import java.sql.Timestamp;
import java.util.Collection; import java.util.Collection;
import java.util.Set;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
@Data @Data
...@@ -60,14 +61,12 @@ public class AuthenticationUser implements UserDetails ...@@ -60,14 +61,12 @@ public class AuthenticationUser implements UserDetails
private Collection<GrantedAuthority> authorities; private Collection<GrantedAuthority> authorities;
@JsonIgnore @JsonIgnore
private int superuser; private int superuser;
@JsonIgnore
private JSONObject permisionList; private JSONObject permisionList;
private String orglevel;//单位级别 private String orglevel;//单位级别
private String deptlevel;//部门级别 private String deptlevel;//部门级别
@JsonIgnore @JsonIgnore
private Map<String,Object> userSessionParam;//用户自定义session值 private Map<String,Object> userSessionParam;//用户自定义session值
@JsonIgnore private Map<String, Set<String>> orgInfo;//上下级组织信息
private JSONObject orgInfo;//上下级组织信息
@JsonIgnore @JsonIgnore
......
package cn.ibizlab.util.service;
import com.alibaba.fastjson.JSONObject;
import cn.ibizlab.util.client.IBZOUFeignClient;
import cn.ibizlab.util.client.IBZUAAFeignClient;
import cn.ibizlab.util.security.AuthenticationUser;
import cn.ibizlab.util.security.AuthorizationLogin;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Primary;
import org.springframework.stereotype.Service;
import org.springframework.util.DigestUtils;
import org.springframework.util.StringUtils;
/**
* 实体[IBZUSER] 服务对象接口实现
*/
//@Primary
@Service("IBZUAAUserService")
public class IBZUAAUserService implements AuthenticationUserService{
@Autowired
private IBZUAAFeignClient uaaFeignClient;
@Override
public AuthenticationUser loadUserByUsername(String username) {
String[] data=username.split("[|]");
String loginname=username;
String domains="";
String password="";
if(data.length==3) {
loginname=data[0].trim();
domains=data[1].trim();
password=data[2].trim();
}
else if(data.length==2) {
loginname=data[0].trim();
password=data[1].trim();
}
AuthorizationLogin user = new AuthorizationLogin();
user.setDomain(domains);
user.setLoginname(loginname);
user.setPassword(password);
return uaaFeignClient.login(user);
}
@Override
public AuthenticationUser loadUserByLogin(String username, String password) {
AuthenticationUser authuserdetail = loadUserByUsername(username+"|"+password);
return authuserdetail;
}
@Override
public AuthenticationUser loadUserByLogin(String domain, String username, String password) {
if(!StringUtils.isEmpty(domain))
username = username+"|"+domain;
return loadUserByLogin(username,password);
}
@Override
public void resetByUsername(String username) {
}
}
...@@ -25,12 +25,6 @@ public class SimpleUserService implements AuthenticationUserService{ ...@@ -25,12 +25,6 @@ public class SimpleUserService implements AuthenticationUserService{
@Value("${ibiz.systemid:2C40DFCD-0DF5-47BF-91A5-C45F810B0001}") @Value("${ibiz.systemid:2C40DFCD-0DF5-47BF-91A5-C45F810B0001}")
private String systemid; private String systemid;
@Autowired
private IBZUAAFeignClient uaaFeignClient;
@Autowired
private IBZOUFeignClient ouFeignClient;
@Override @Override
public AuthenticationUser loadUserByUsername(String username) { public AuthenticationUser loadUserByUsername(String username) {
AuthenticationUser user = new AuthenticationUser(); AuthenticationUser user = new AuthenticationUser();
...@@ -60,9 +54,6 @@ public class SimpleUserService implements AuthenticationUserService{ ...@@ -60,9 +54,6 @@ public class SimpleUserService implements AuthenticationUserService{
user.setOrgcode(domains); user.setOrgcode(domains);
user.setOrgname(domains); user.setOrgname(domains);
setUserPermission(user);
setUserOrgInfo(user);
return user; return user;
} }
...@@ -85,30 +76,4 @@ public class SimpleUserService implements AuthenticationUserService{ ...@@ -85,30 +76,4 @@ public class SimpleUserService implements AuthenticationUserService{
} }
/**
* 设置用户权限
*/
private void setUserPermission(AuthenticationUser user) {
if(enablePermissionValid){
JSONObject permission= uaaFeignClient.getUserPermissionData(user.getLoginname(),systemid);
user.setPermisionList(permission);
}
}
/**
* 设置用户组织相关信息
* @param user
*/
private void setUserOrgInfo(AuthenticationUser user) {
if(enablePermissionValid) {
JSONObject orgInfo=ouFeignClient.getOrgInfo(user.getLoginname());
if(orgInfo==null)
throw new RuntimeException("获取用户信息失败,请检查用户中心[IBZOU]中是否存在当前用户!");
JSONObject curUser=orgInfo.getJSONObject("curuser");
user.setOrgInfo(orgInfo);
user.setMdeptid(curUser.getString("orgdept"));
user.setOrgid(curUser.getString("org"));
}
}
} }
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册