Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
提交反馈
为 GitLab 提交贡献
登录
切换导航
I
ibzou
项目
项目
详情
动态
版本
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
ibiz4jteam
ibzou
提交
a5b198a5
提交
a5b198a5
编写于
4月 29, 2020
作者:
ibizdev
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
ibizdev提交
上级
74432f1d
变更
29
隐藏空白字符变更
内嵌
并排
正在显示
29 个修改的文件
包含
525 行增加
和
71 行删除
+525
-71
ibzdepartment_en_US.ts
...eb/src/locale/lanres/ibzdepartment/ibzdepartment_en_US.ts
+2
-0
ibzdepartment_zh_CN.ts
...eb/src/locale/lanres/ibzdepartment/ibzdepartment_zh_CN.ts
+2
-0
ibzdepartments.ts
app_web/src/mock/entity/ibzdepartments/ibzdepartments.ts
+33
-0
ibzemployees.ts
app_web/src/mock/entity/ibzemployees/ibzemployees.ts
+33
-0
ibzorganizations.ts
app_web/src/mock/entity/ibzorganizations/ibzorganizations.ts
+33
-0
entity-service.ts
app_web/src/service/entity-service.ts
+39
-0
state.ts
app_web/src/store/modules/view-action/state.ts
+1
-0
http.ts
app_web/src/utils/http/http.ts
+14
-6
main-form-base.vue
...eb/src/widgets/ibzdepartment/main-form/main-form-base.vue
+47
-0
main-form-model.ts
...eb/src/widgets/ibzdepartment/main-form/main-form-model.ts
+5
-0
main-form-service.ts
.../src/widgets/ibzdepartment/main-form/main-form-service.ts
+12
-0
pickup-viewpickupviewpanel-pickupviewpanel-model.ts
...panel/pickup-viewpickupviewpanel-pickupviewpanel-model.ts
+3
-0
IBZDepartment.java
...rc/main/java/cn/ibizlab/core/ou/domain/IBZDepartment.java
+8
-0
IBZDepartmentSearchContext.java
...cn/ibizlab/core/ou/filter/IBZDepartmentSearchContext.java
+14
-0
DEPrivs.json
ibzou-core/src/main/resources/deprivs/DEPrivs.json
+3
-3
h2_table.xml
ibzou-core/src/main/resources/liquibase/h2_table.xml
+7
-5
IBZDepartmentMapper.xml
...resources/mapper/ou/ibzdepartment/IBZDepartmentMapper.xml
+3
-3
pom.xml
ibzou-provider/ibzou-provider-ouapi/pom.xml
+21
-0
Dockerfile
...-provider/ibzou-provider-ouapi/src/main/docker/Dockerfile
+14
-0
ibzou-provider-ouapi.yaml
...-provider-ouapi/src/main/docker/ibzou-provider-ouapi.yaml
+16
-0
IBZDepartmentDTO.java
.../src/main/java/cn/ibizlab/ouapi/dto/IBZDepartmentDTO.java
+8
-0
IBZOUFallback.java
...l/src/main/java/cn/ibizlab/util/client/IBZOUFallback.java
+13
-0
IBZOUFeignClient.java
...rc/main/java/cn/ibizlab/util/client/IBZOUFeignClient.java
+19
-0
IBZUAAFallback.java
.../src/main/java/cn/ibizlab/util/client/IBZUAAFallback.java
+20
-0
IBZUAAFeignClient.java
...c/main/java/cn/ibizlab/util/client/IBZUAAFeignClient.java
+30
-0
PermissionSyncJob.java
.../src/main/java/cn/ibizlab/util/job/PermissionSyncJob.java
+2
-2
AuthPermissionEvaluator.java
...ava/cn/ibizlab/util/security/AuthPermissionEvaluator.java
+83
-36
AuthenticationUser.java
...ain/java/cn/ibizlab/util/security/AuthenticationUser.java
+2
-0
SimpleUserService.java
.../main/java/cn/ibizlab/util/service/SimpleUserService.java
+38
-16
未找到文件。
app_web/src/locale/lanres/ibzdepartment/ibzdepartment_en_US.ts
浏览文件 @
a5b198a5
...
...
@@ -13,6 +13,7 @@ export default {
enable
:
'逻辑有效'
,
createdate
:
'创建时间'
,
updatedate
:
'最后修改时间'
,
orgname
:
'单位'
,
},
views
:
{
editview
:
{
...
...
@@ -46,6 +47,7 @@ export default {
deptid
:
"部门标识"
,
deptcode
:
"部门代码"
,
deptname
:
"部门名称"
,
orgname
:
"单位"
,
orgid
:
"单位"
,
pdeptid
:
"上级部门"
,
shortname
:
"部门简称"
,
...
...
app_web/src/locale/lanres/ibzdepartment/ibzdepartment_zh_CN.ts
浏览文件 @
a5b198a5
...
...
@@ -12,6 +12,7 @@ export default {
enable
:
'逻辑有效'
,
createdate
:
'创建时间'
,
updatedate
:
'最后修改时间'
,
orgname
:
'单位'
,
},
views
:
{
editview
:
{
...
...
@@ -45,6 +46,7 @@ export default {
deptid
:
'部门标识'
,
deptcode
:
'部门代码'
,
deptname
:
'部门名称'
,
orgname
:
'单位'
,
orgid
:
'单位'
,
pdeptid
:
'上级部门'
,
shortname
:
'部门简称'
,
...
...
app_web/src/mock/entity/ibzdepartments/ibzdepartments.ts
浏览文件 @
a5b198a5
...
...
@@ -6,6 +6,39 @@ const mock = MockAdapter.getInstance();
const
mockDatas
:
Array
<
any
>
=
[
];
// createBatch
mock
.
onPost
(
new
RegExp
(
/^
\/
ibzdepartments
\/
batch$/
)).
reply
((
config
:
any
)
=>
{
console
.
groupCollapsed
(
"实体:ibzdepartment 方法: createBatch"
);
console
.
table
({
url
:
config
.
url
,
method
:
config
.
method
,
data
:
config
.
data
});
let
status
=
MockAdapter
.
mockStatus
(
config
);
if
(
status
!==
200
)
{
return
[
status
,
{}];
}
return
[
status
,
{}];
});
// updateBatch
mock
.
onPut
(
new
RegExp
(
/^
\/
ibzdepartments
\/
batch$/
)).
reply
((
config
:
any
)
=>
{
console
.
groupCollapsed
(
"实体:ibzdepartment 方法: updateBatch"
);
console
.
table
({
url
:
config
.
url
,
method
:
config
.
method
,
data
:
config
.
data
});
let
status
=
MockAdapter
.
mockStatus
(
config
);
if
(
status
!==
200
)
{
return
[
status
,
{}];
}
return
[
status
,
{}];
});
// removeBatch
mock
.
onDelete
(
new
RegExp
(
/^
\/
ibzdepartments
\/
batch$/
)).
reply
((
config
:
any
)
=>
{
console
.
groupCollapsed
(
"实体:ibzdepartment 方法: removeBatch"
);
console
.
table
({
url
:
config
.
url
,
method
:
config
.
method
,
data
:
config
.
data
});
let
status
=
MockAdapter
.
mockStatus
(
config
);
if
(
status
!==
200
)
{
return
[
status
,
{}];
}
return
[
status
,
{}];
});
// Select
...
...
app_web/src/mock/entity/ibzemployees/ibzemployees.ts
浏览文件 @
a5b198a5
...
...
@@ -6,6 +6,39 @@ const mock = MockAdapter.getInstance();
const
mockDatas
:
Array
<
any
>
=
[
];
// createBatch
mock
.
onPost
(
new
RegExp
(
/^
\/
ibzemployees
\/
batch$/
)).
reply
((
config
:
any
)
=>
{
console
.
groupCollapsed
(
"实体:ibzemployee 方法: createBatch"
);
console
.
table
({
url
:
config
.
url
,
method
:
config
.
method
,
data
:
config
.
data
});
let
status
=
MockAdapter
.
mockStatus
(
config
);
if
(
status
!==
200
)
{
return
[
status
,
{}];
}
return
[
status
,
{}];
});
// updateBatch
mock
.
onPut
(
new
RegExp
(
/^
\/
ibzemployees
\/
batch$/
)).
reply
((
config
:
any
)
=>
{
console
.
groupCollapsed
(
"实体:ibzemployee 方法: updateBatch"
);
console
.
table
({
url
:
config
.
url
,
method
:
config
.
method
,
data
:
config
.
data
});
let
status
=
MockAdapter
.
mockStatus
(
config
);
if
(
status
!==
200
)
{
return
[
status
,
{}];
}
return
[
status
,
{}];
});
// removeBatch
mock
.
onDelete
(
new
RegExp
(
/^
\/
ibzemployees
\/
batch$/
)).
reply
((
config
:
any
)
=>
{
console
.
groupCollapsed
(
"实体:ibzemployee 方法: removeBatch"
);
console
.
table
({
url
:
config
.
url
,
method
:
config
.
method
,
data
:
config
.
data
});
let
status
=
MockAdapter
.
mockStatus
(
config
);
if
(
status
!==
200
)
{
return
[
status
,
{}];
}
return
[
status
,
{}];
});
// Select
...
...
app_web/src/mock/entity/ibzorganizations/ibzorganizations.ts
浏览文件 @
a5b198a5
...
...
@@ -6,6 +6,39 @@ const mock = MockAdapter.getInstance();
const
mockDatas
:
Array
<
any
>
=
[
];
// createBatch
mock
.
onPost
(
new
RegExp
(
/^
\/
ibzorganizations
\/
batch$/
)).
reply
((
config
:
any
)
=>
{
console
.
groupCollapsed
(
"实体:ibzorganization 方法: createBatch"
);
console
.
table
({
url
:
config
.
url
,
method
:
config
.
method
,
data
:
config
.
data
});
let
status
=
MockAdapter
.
mockStatus
(
config
);
if
(
status
!==
200
)
{
return
[
status
,
{}];
}
return
[
status
,
{}];
});
// updateBatch
mock
.
onPut
(
new
RegExp
(
/^
\/
ibzorganizations
\/
batch$/
)).
reply
((
config
:
any
)
=>
{
console
.
groupCollapsed
(
"实体:ibzorganization 方法: updateBatch"
);
console
.
table
({
url
:
config
.
url
,
method
:
config
.
method
,
data
:
config
.
data
});
let
status
=
MockAdapter
.
mockStatus
(
config
);
if
(
status
!==
200
)
{
return
[
status
,
{}];
}
return
[
status
,
{}];
});
// removeBatch
mock
.
onDelete
(
new
RegExp
(
/^
\/
ibzorganizations
\/
batch$/
)).
reply
((
config
:
any
)
=>
{
console
.
groupCollapsed
(
"实体:ibzorganization 方法: removeBatch"
);
console
.
table
({
url
:
config
.
url
,
method
:
config
.
method
,
data
:
config
.
data
});
let
status
=
MockAdapter
.
mockStatus
(
config
);
if
(
status
!==
200
)
{
return
[
status
,
{}];
}
return
[
status
,
{}];
});
// Select
mock
.
onGet
(
new
RegExp
(
/^
\/
ibzorganizations
\/([
a-zA-Z0-9
\-\;]{1,35})\/
select$/
)).
reply
((
config
:
any
)
=>
{
...
...
app_web/src/service/entity-service.ts
浏览文件 @
a5b198a5
...
...
@@ -565,6 +565,45 @@ export default class EntityService {
return
Http
.
getInstance
().
post
(
`/
${
this
.
APPDENAME
}
/import`
,
data
,
isloading
);
}
/**
* createBatch接口方法
*
* @param {*} [context={}]
* @param {*} [data={}]
* @param {boolean} [isloading]
* @returns {Promise<any>}
* @memberof EntityService
*/
public
async
createBatch
(
context
:
any
=
{},
data
:
any
=
{},
isloading
?:
boolean
):
Promise
<
any
>
{
return
Http
.
getInstance
().
post
(
`/
${
this
.
APPDENAME
}
/batch`
,
data
,
isloading
);
}
/**
* updateBatch接口方法
*
* @param {*} [context={}]
* @param {*} [data={}]
* @param {boolean} [isloading]
* @returns {Promise<any>}
* @memberof EntityService
*/
public
async
updateBatch
(
context
:
any
=
{},
data
:
any
=
{},
isloading
?:
boolean
):
Promise
<
any
>
{
return
Http
.
getInstance
().
put
(
`/
${
this
.
APPDENAME
}
/batch`
,
data
,
isloading
);
}
/**
* removeBatch接口方法
*
* @param {*} [context={}]
* @param {*} [data={}]
* @param {boolean} [isloading]
* @returns {Promise<any>}
* @memberof EntityService
*/
public
async
removeBatch
(
context
:
any
=
{},
data
:
any
=
{},
isloading
?:
boolean
):
Promise
<
any
>
{
return
Http
.
getInstance
().
delete
(
`/
${
this
.
APPDENAME
}
/batch`
,
isloading
,
data
);
}
/**
* WFStart接口方法
*
...
...
app_web/src/store/modules/view-action/state.ts
浏览文件 @
a5b198a5
...
...
@@ -30,6 +30,7 @@ export const viewstate: any = {
viewaction
:
''
,
viewdatachange
:
false
,
refviews
:
[
'9e25d15d43ff644fa008c9cf7d063ac3'
,
],
},
{
...
...
app_web/src/utils/http/http.ts
浏览文件 @
a5b198a5
...
...
@@ -150,16 +150,24 @@ export class Http {
* @returns {Promise<any>}
* @memberof Http
*/
public
delete
(
url
:
string
,
isloading
?:
boolean
,
serialnumber
?:
number
):
Promise
<
any
>
{
public
delete
(
url
:
string
,
isloading
?:
boolean
,
data
?:
any
,
serialnumber
?:
number
):
Promise
<
any
>
{
if
(
isloading
)
{
this
.
beginLoading
();
}
return
new
Promise
((
resolve
:
any
,
reject
:
any
)
=>
{
axios
.
delete
(
url
).
then
((
response
:
any
)
=>
{
this
.
doResponseRresult
(
response
,
resolve
,
isloading
,
serialnumber
);
}).
catch
((
response
:
any
)
=>
{
this
.
doResponseRresult
(
response
,
reject
,
isloading
,
serialnumber
);
});
if
(
!
data
){
axios
.
delete
(
url
).
then
((
response
:
any
)
=>
{
this
.
doResponseRresult
(
response
,
resolve
,
isloading
,
serialnumber
);
}).
catch
((
response
:
any
)
=>
{
this
.
doResponseRresult
(
response
,
reject
,
isloading
,
serialnumber
);
});
}
else
{
axios
.
delete
(
url
,{
data
:
data
}).
then
((
response
:
any
)
=>
{
this
.
doResponseRresult
(
response
,
resolve
,
isloading
,
serialnumber
);
}).
catch
((
response
:
any
)
=>
{
this
.
doResponseRresult
(
response
,
reject
,
isloading
,
serialnumber
);
});
}
});
}
...
...
app_web/src/widgets/ibzdepartment/main-form/main-form-base.vue
浏览文件 @
a5b198a5
...
...
@@ -20,6 +20,31 @@
<input-box
v-model=
"data.deptname"
@
enter=
"onEnter($event)"
unit=
""
:disabled=
"detailsModel.deptname.disabled"
type=
'text'
style=
""
></input-box>
</app-form-item>
</i-col>
<i-col
v-show=
"detailsModel.orgname.visible"
:style=
"
{}" :lg="{ span: 24, offset: 0 }">
<app-form-item
name=
'orgname'
:itemRules=
"this.rules.orgname"
class=
''
:caption=
"$t('entities.ibzdepartment.main_form.details.orgname')"
uiStyle=
"DEFAULT"
:labelWidth=
"130"
:isShowCaption=
"true"
:error=
"detailsModel.orgname.error"
:isEmptyCaption=
"false"
labelPos=
"LEFT"
>
<app-picker
:formState=
"formState"
:data=
"data"
:context=
"context"
:viewparams=
"viewparams"
:itemParam=
'
{ }'
:disabled="detailsModel.orgname.disabled"
name='orgname'
deMajorField='orgname'
deKeyField='ibzorganization'
:service="service"
:acParams="{ serviceName: 'IBZOrganizationService', interfaceName: 'FetchDefault'}"
valueitem='orgid'
:value="data.orgname"
editortype=""
:pickupView="{ viewname: 'ibzorganization-pickup-view', title: $t('entities.ibzorganization.views.pickupview.title'), deResParameters: [], parameters: [{ pathName: 'ibzorganizations', parameterName: 'ibzorganization' }, { pathName: 'pickupview', parameterName: 'pickupview' } ], placement:'' }"
style=""
@formitemvaluechange="onFormItemValueChange">
</app-picker>
</app-form-item>
</i-col>
<i-col
v-show=
"detailsModel.shortname.visible"
:style=
"
{}" :lg="{ span: 24, offset: 0 }">
<app-form-item
name=
'shortname'
:itemRules=
"this.rules.shortname"
class=
''
:caption=
"$t('entities.ibzdepartment.main_form.details.shortname')"
uiStyle=
"DEFAULT"
:labelWidth=
"130"
:isShowCaption=
"true"
:error=
"detailsModel.shortname.error"
:isEmptyCaption=
"false"
labelPos=
"LEFT"
>
...
...
@@ -360,6 +385,7 @@ export default class MainBase extends Vue implements ControlInterface {
deptid
:
null
,
deptcode
:
null
,
deptname
:
null
,
orgname
:
null
,
orgid
:
null
,
pdeptid
:
null
,
shortname
:
null
,
...
...
@@ -476,6 +502,12 @@ export default class MainBase extends Vue implements ControlInterface {
{
required
:
true
,
type
:
'string'
,
message
:
'部门名称 值不能为空'
,
trigger
:
'change'
},
{
required
:
true
,
type
:
'string'
,
message
:
'部门名称 值不能为空'
,
trigger
:
'blur'
},
],
orgname
:
[
{
type
:
'string'
,
message
:
'单位 值必须为字符串类型'
,
trigger
:
'change'
},
{
type
:
'string'
,
message
:
'单位 值必须为字符串类型'
,
trigger
:
'blur'
},
{
required
:
false
,
type
:
'string'
,
message
:
'单位 值不能为空'
,
trigger
:
'change'
},
{
required
:
false
,
type
:
'string'
,
message
:
'单位 值不能为空'
,
trigger
:
'blur'
},
],
orgid
:
[
{
type
:
'string'
,
message
:
'单位 值必须为字符串类型'
,
trigger
:
'change'
},
{
type
:
'string'
,
message
:
'单位 值必须为字符串类型'
,
trigger
:
'blur'
},
...
...
@@ -556,6 +588,8 @@ export default class MainBase extends Vue implements ControlInterface {
deptcode
:
new
FormItemModel
({
caption
:
'部门代码'
,
detailType
:
'FORMITEM'
,
name
:
'deptcode'
,
visible
:
true
,
isShowCaption
:
true
,
form
:
this
,
disabled
:
false
,
enableCond
:
1
})
,
deptname
:
new
FormItemModel
({
caption
:
'部门名称'
,
detailType
:
'FORMITEM'
,
name
:
'deptname'
,
visible
:
true
,
isShowCaption
:
true
,
form
:
this
,
disabled
:
false
,
enableCond
:
3
})
,
orgname
:
new
FormItemModel
({
caption
:
'单位'
,
detailType
:
'FORMITEM'
,
name
:
'orgname'
,
visible
:
true
,
isShowCaption
:
true
,
form
:
this
,
disabled
:
false
,
enableCond
:
3
})
,
orgid
:
new
FormItemModel
({
caption
:
'单位'
,
detailType
:
'FORMITEM'
,
name
:
'orgid'
,
visible
:
true
,
isShowCaption
:
true
,
form
:
this
,
disabled
:
false
,
enableCond
:
3
})
,
...
...
@@ -707,6 +741,18 @@ export default class MainBase extends Vue implements ControlInterface {
this
.
formDataChange
({
name
:
'deptname'
,
newVal
:
newVal
,
oldVal
:
oldVal
});
}
/**
* 监控表单属性 orgname 值
*
* @param {*} newVal
* @param {*} oldVal
* @memberof Main
*/
@
Watch
(
'data.orgname'
)
onOrgnameChange
(
newVal
:
any
,
oldVal
:
any
)
{
this
.
formDataChange
({
name
:
'orgname'
,
newVal
:
newVal
,
oldVal
:
oldVal
});
}
/**
* 监控表单属性 orgid 值
*
...
...
@@ -857,6 +903,7 @@ export default class MainBase extends Vue implements ControlInterface {
}
...
...
app_web/src/widgets/ibzdepartment/main-form/main-form-model.ts
浏览文件 @
a5b198a5
...
...
@@ -70,6 +70,11 @@ export default class MainModel {
prop
:
'deptname'
,
dataType
:
'TEXT'
,
},
{
name
:
'orgname'
,
prop
:
'orgname'
,
dataType
:
'PICKUPTEXT'
,
},
{
name
:
'orgid'
,
prop
:
'orgid'
,
...
...
app_web/src/widgets/ibzdepartment/main-form/main-form-service.ts
浏览文件 @
a5b198a5
...
...
@@ -2,6 +2,7 @@ import { Http,Util,Errorlog } from '@/utils';
import
ControlService
from
'@/widgets/control-service'
;
import
IBZDepartmentService
from
'@/service/ibzdepartment/ibzdepartment-service'
;
import
MainModel
from
'./main-form-model'
;
import
IBZOrganizationService
from
'@/service/ibzorganization/ibzorganization-service'
;
/**
...
...
@@ -41,6 +42,14 @@ export default class MainService extends ControlService {
this
.
model
=
new
MainModel
();
}
/**
* 单位机构服务对象
*
* @type {IBZOrganizationService}
* @memberof MainService
*/
public
ibzorganizationService
:
IBZOrganizationService
=
new
IBZOrganizationService
();
/**
* 处理数据
*
...
...
@@ -80,6 +89,9 @@ export default class MainService extends ControlService {
*/
@
Errorlog
public
getItems
(
serviceName
:
string
,
interfaceName
:
string
,
context
:
any
=
{},
data
:
any
,
isloading
?:
boolean
):
Promise
<
any
[]
>
{
if
(
Object
.
is
(
serviceName
,
'IBZOrganizationService'
)
&&
Object
.
is
(
interfaceName
,
'FetchDefault'
))
{
return
this
.
doItems
(
this
.
ibzorganizationService
.
FetchDefault
(
JSON
.
parse
(
JSON
.
stringify
(
context
)),
data
,
isloading
),
'orgid'
,
'ibzorganization'
);
}
return
Promise
.
reject
([])
}
...
...
app_web/src/widgets/ibzdepartment/pickup-viewpickupviewpanel-pickupviewpanel/pickup-viewpickupviewpanel-pickupviewpanel-model.ts
浏览文件 @
a5b198a5
...
...
@@ -51,6 +51,9 @@ export default class PickupViewpickupviewpanelModel {
{
name
:
'updatedate'
,
},
{
name
:
'orgname'
,
},
]
}
...
...
ibzou-core/src/main/java/cn/ibizlab/core/ou/domain/IBZDepartment.java
浏览文件 @
a5b198a5
...
...
@@ -124,6 +124,14 @@ public class IBZDepartment extends EntityMP implements Serializable {
@JSONField
(
name
=
"updatedate"
,
format
=
"yyyy-MM-dd HH:mm:ss"
)
@JsonProperty
(
"updatedate"
)
private
Timestamp
updatedate
;
/**
* 单位
*/
@DEField
(
preType
=
DEPredefinedFieldType
.
ORGNAME
)
@TableField
(
value
=
"orgname"
)
@JSONField
(
name
=
"orgname"
)
@JsonProperty
(
"orgname"
)
private
String
orgname
;
/**
*
...
...
ibzou-core/src/main/java/cn/ibizlab/core/ou/filter/IBZDepartmentSearchContext.java
浏览文件 @
a5b198a5
...
...
@@ -61,6 +61,20 @@ public class IBZDepartmentSearchContext extends QueryWrapperContext<IBZDepartmen
this
.
getSelectCond
().
like
(
"bcode"
,
n_bcode_like
);
}
}
private
String
n_orgname_eq
;
//[单位]
public
void
setN_orgname_eq
(
String
n_orgname_eq
)
{
this
.
n_orgname_eq
=
n_orgname_eq
;
if
(!
ObjectUtils
.
isEmpty
(
this
.
n_orgname_eq
)){
this
.
getSelectCond
().
eq
(
"orgname"
,
n_orgname_eq
);
}
}
private
String
n_orgname_like
;
//[单位]
public
void
setN_orgname_like
(
String
n_orgname_like
)
{
this
.
n_orgname_like
=
n_orgname_like
;
if
(!
ObjectUtils
.
isEmpty
(
this
.
n_orgname_like
)){
this
.
getSelectCond
().
like
(
"orgname"
,
n_orgname_like
);
}
}
/**
* 启用快速搜索
...
...
ibzou-core/src/main/resources/deprivs/DEPrivs.json
浏览文件 @
a5b198a5
...
...
@@ -4,7 +4,7 @@
{
"dename"
:
"IBZDepartment"
,
"delogicname"
:
"部门"
,
"sysmoudle"
:{
"id"
:
"OU"
,
"name"
:
"
组织人事
"
},
"sysmoudle"
:{
"id"
:
"OU"
,
"name"
:
"
ou
"
},
"dedataset"
:[{
"id"
:
"Default"
,
"name"
:
"默认数据集"
}],
"dedatarange"
:[{
"id"
:
"ALL"
,
"name"
:
"全部数据"
},{
"id"
:
"CURORG"
,
"name"
:
"当前单位"
},{
"id"
:
"PORG"
,
"name"
:
"上级单位"
},{
"id"
:
"SORG"
,
"name"
:
"下级单位"
},{
"id"
:
"CURORGDEPT"
,
"name"
:
"当前部门"
},{
"id"
:
"PORGDEPT"
,
"name"
:
"上级部门"
},{
"id"
:
"SORGDEPT"
,
"name"
:
"下级部门"
}],
"deprivs"
:[{
"id"
:
"READ"
,
"name"
:
"READ"
},{
"id"
:
"CREATE"
,
"name"
:
"CREATE"
},{
"id"
:
"UPDATE"
,
"name"
:
"UPDATE"
},{
"id"
:
"DELETE"
,
"name"
:
"DELETE"
}]
...
...
@@ -13,7 +13,7 @@
{
"dename"
:
"IBZEmployee"
,
"delogicname"
:
"人员"
,
"sysmoudle"
:{
"id"
:
"OU"
,
"name"
:
"
组织人事
"
},
"sysmoudle"
:{
"id"
:
"OU"
,
"name"
:
"
ou
"
},
"dedataset"
:[{
"id"
:
"Default"
,
"name"
:
"默认数据集"
}],
"dedatarange"
:[{
"id"
:
"ALL"
,
"name"
:
"全部数据"
},{
"id"
:
"CURORG"
,
"name"
:
"当前单位"
},{
"id"
:
"PORG"
,
"name"
:
"上级单位"
},{
"id"
:
"SORG"
,
"name"
:
"下级单位"
},{
"id"
:
"CURORGDEPT"
,
"name"
:
"当前部门"
},{
"id"
:
"PORGDEPT"
,
"name"
:
"上级部门"
},{
"id"
:
"SORGDEPT"
,
"name"
:
"下级部门"
}],
"deprivs"
:[{
"id"
:
"READ"
,
"name"
:
"READ"
},{
"id"
:
"CREATE"
,
"name"
:
"CREATE"
},{
"id"
:
"UPDATE"
,
"name"
:
"UPDATE"
},{
"id"
:
"DELETE"
,
"name"
:
"DELETE"
}]
...
...
@@ -22,7 +22,7 @@
{
"dename"
:
"IBZOrganization"
,
"delogicname"
:
"单位机构"
,
"sysmoudle"
:{
"id"
:
"OU"
,
"name"
:
"
组织人事
"
},
"sysmoudle"
:{
"id"
:
"OU"
,
"name"
:
"
ou
"
},
"dedataset"
:[{
"id"
:
"Default"
,
"name"
:
"默认数据集"
}],
"dedatarange"
:[{
"id"
:
"ALL"
,
"name"
:
"全部数据"
},{
"id"
:
"CURORG"
,
"name"
:
"当前单位"
},{
"id"
:
"PORG"
,
"name"
:
"上级单位"
},{
"id"
:
"SORG"
,
"name"
:
"下级单位"
},{
"id"
:
"CURORGDEPT"
,
"name"
:
"当前部门"
},{
"id"
:
"PORGDEPT"
,
"name"
:
"上级部门"
},{
"id"
:
"SORGDEPT"
,
"name"
:
"下级部门"
}],
"deprivs"
:[{
"id"
:
"READ"
,
"name"
:
"READ"
},{
"id"
:
"CREATE"
,
"name"
:
"CREATE"
},{
"id"
:
"UPDATE"
,
"name"
:
"UPDATE"
},{
"id"
:
"DELETE"
,
"name"
:
"DELETE"
}]
...
...
ibzou-core/src/main/resources/liquibase/h2_table.xml
浏览文件 @
a5b198a5
...
...
@@ -2,7 +2,7 @@
<databaseChangeLog
xmlns=
"http://www.liquibase.org/xml/ns/dbchangelog"
xmlns:ext=
"http://www.liquibase.org/xml/ns/dbchangelog-ext"
xmlns:xsi=
"http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation=
"http://www.liquibase.org/xml/ns/dbchangelog-ext http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-ext.xsd http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.6.xsd"
>
<!--输出实体[IBZORG]数据结构 -->
<changeSet
author=
"a_A_5d9d78509"
id=
"tab-ibzorg-3
68
-1"
>
<changeSet
author=
"a_A_5d9d78509"
id=
"tab-ibzorg-3
80
-1"
>
<createTable
tableName=
"IBZORG"
>
<column
name=
"ORGID"
remarks=
""
type=
"VARCHAR(100)"
>
<constraints
primaryKey=
"true"
primaryKeyName=
"PK_IBZORG_ORGID"
/>
...
...
@@ -106,7 +106,7 @@
</createTable>
</changeSet>
<!--输出实体[IBZDEPT]数据结构 -->
<changeSet
author=
"a_A_5d9d78509"
id=
"tab-ibzdept-4
76
-3"
>
<changeSet
author=
"a_A_5d9d78509"
id=
"tab-ibzdept-4
95
-3"
>
<createTable
tableName=
"IBZDEPT"
>
<column
name=
"DEPTID"
remarks=
""
type=
"VARCHAR(100)"
>
<constraints
primaryKey=
"true"
primaryKeyName=
"PK_IBZDEPT_DEPTID"
/>
...
...
@@ -133,11 +133,13 @@
</column>
<column
name=
"UPDATEDATE"
remarks=
""
type=
"DATETIME"
>
</column>
<column
name=
"ORGNAME"
remarks=
""
type=
"VARCHAR(100)"
>
</column>
</createTable>
</changeSet>
<!--输出实体[IBZORG]外键关系 -->
<changeSet
author=
"a_A_5d9d78509"
id=
"fk-ibzorg-3
68
-4"
>
<changeSet
author=
"a_A_5d9d78509"
id=
"fk-ibzorg-3
80
-4"
>
<addForeignKeyConstraint
baseColumnNames=
"PORGID"
baseTableName=
"IBZORG"
constraintName=
"DER1N_IBZORG_IBZORG_PORGID"
deferrable=
"false"
initiallyDeferred=
"false"
onDelete=
"RESTRICT"
onUpdate=
"RESTRICT"
referencedColumnNames=
"ORGID"
referencedTableName=
"IBZORG"
validate=
"true"
/>
</changeSet>
<!--输出实体[IBZEMP]外键关系 -->
...
...
@@ -148,10 +150,10 @@
<addForeignKeyConstraint
baseColumnNames=
"ORGID"
baseTableName=
"IBZEMP"
constraintName=
"DER1N_IBZEMP_IBZORG_ORGID"
deferrable=
"false"
initiallyDeferred=
"false"
onDelete=
"RESTRICT"
onUpdate=
"RESTRICT"
referencedColumnNames=
"ORGID"
referencedTableName=
"IBZORG"
validate=
"true"
/>
</changeSet>
<!--输出实体[IBZDEPT]外键关系 -->
<changeSet
author=
"a_A_5d9d78509"
id=
"fk-ibzdept-4
76
-7"
>
<changeSet
author=
"a_A_5d9d78509"
id=
"fk-ibzdept-4
95
-7"
>
<addForeignKeyConstraint
baseColumnNames=
"PDEPTID"
baseTableName=
"IBZDEPT"
constraintName=
"DER1N_IBZDEPT_IBZDEPT_PDEPTID"
deferrable=
"false"
initiallyDeferred=
"false"
onDelete=
"RESTRICT"
onUpdate=
"RESTRICT"
referencedColumnNames=
"DEPTID"
referencedTableName=
"IBZDEPT"
validate=
"true"
/>
</changeSet>
<changeSet
author=
"a_A_5d9d78509"
id=
"fk-ibzdept-4
76
-8"
>
<changeSet
author=
"a_A_5d9d78509"
id=
"fk-ibzdept-4
95
-8"
>
<addForeignKeyConstraint
baseColumnNames=
"ORGID"
baseTableName=
"IBZDEPT"
constraintName=
"DER1N_IBZDEPT_IBZORG_ORGID"
deferrable=
"false"
initiallyDeferred=
"false"
onDelete=
"RESTRICT"
onUpdate=
"RESTRICT"
referencedColumnNames=
"ORGID"
referencedTableName=
"IBZORG"
validate=
"true"
/>
</changeSet>
...
...
ibzou-core/src/main/resources/mapper/ou/ibzdepartment/IBZDepartmentMapper.xml
浏览文件 @
a5b198a5
...
...
@@ -5,7 +5,7 @@
<!--该方法用于重写mybatis中selectById方法,以实现查询逻辑属性-->
<select
id=
"selectById"
resultMap=
"IBZDepartmentResultMap"
databaseId=
"mysql"
>
<![CDATA[select t1.* from (SELECT t1.`BCODE`, t1.`CREATEDATE`, t1.`DEPTCODE`, t1.`DEPTID`, t1.`DEPTLEVEL`, t1.`DEPTNAME`, t1.`ENABLE`, t1.`ORGID`, t1.`PDEPTID`, t1.`SHORTNAME`, t1.`SHOWORDER`, t1.`UPDATEDATE` FROM `IBZDEPT` t1 ) t1 where deptid=#{id}]]>
<![CDATA[select t1.* from (SELECT t1.`BCODE`, t1.`CREATEDATE`, t1.`DEPTCODE`, t1.`DEPTID`, t1.`DEPTLEVEL`, t1.`DEPTNAME`, t1.`ENABLE`, t1.`ORGID`, t1.`
ORGNAME`, t1.`
PDEPTID`, t1.`SHORTNAME`, t1.`SHOWORDER`, t1.`UPDATEDATE` FROM `IBZDEPT` t1 ) t1 where deptid=#{id}]]>
</select>
<select
id=
"selectById"
resultMap=
"IBZDepartmentResultMap"
databaseId=
"postgresql"
>
<![CDATA[select t1.* from (SELECT t1.BCODE, t1.CREATEDATE, t1.DEPTCODE, t1.DEPTID, t1.DEPTLEVEL, t1.DEPTNAME, t1.ENABLE, t1.ORGID, t1.PDEPTID, t1.SHORTNAME, t1.SHOWORDER, t1.UPDATEDATE FROM IBZDEPT t1 ) t1 where deptid=#{id}]]>
...
...
@@ -50,7 +50,7 @@
<!--数据查询[Default]-->
<sql
id=
"Default"
databaseId=
"mysql"
>
<![CDATA[ SELECT t1.`BCODE`, t1.`CREATEDATE`, t1.`DEPTCODE`, t1.`DEPTID`, t1.`DEPTLEVEL`, t1.`DEPTNAME`, t1.`ENABLE`, t1.`ORGID`, t1.`PDEPTID`, t1.`SHORTNAME`, t1.`SHOWORDER`, t1.`UPDATEDATE` FROM `IBZDEPT` t1
<![CDATA[ SELECT t1.`BCODE`, t1.`CREATEDATE`, t1.`DEPTCODE`, t1.`DEPTID`, t1.`DEPTLEVEL`, t1.`DEPTNAME`, t1.`ENABLE`, t1.`ORGID`, t1.`
ORGNAME`, t1.`
PDEPTID`, t1.`SHORTNAME`, t1.`SHOWORDER`, t1.`UPDATEDATE` FROM `IBZDEPT` t1
WHERE t1.ENABLE = 1
]]>
</sql>
...
...
@@ -64,7 +64,7 @@
<!--数据查询[View]-->
<sql
id=
"View"
databaseId=
"mysql"
>
<![CDATA[ SELECT t1.`BCODE`, t1.`CREATEDATE`, t1.`DEPTCODE`, t1.`DEPTID`, t1.`DEPTLEVEL`, t1.`DEPTNAME`, t1.`ENABLE`, t1.`ORGID`, t1.`PDEPTID`, t1.`SHORTNAME`, t1.`SHOWORDER`, t1.`UPDATEDATE` FROM `IBZDEPT` t1
<![CDATA[ SELECT t1.`BCODE`, t1.`CREATEDATE`, t1.`DEPTCODE`, t1.`DEPTID`, t1.`DEPTLEVEL`, t1.`DEPTNAME`, t1.`ENABLE`, t1.`ORGID`, t1.`
ORGNAME`, t1.`
PDEPTID`, t1.`SHORTNAME`, t1.`SHOWORDER`, t1.`UPDATEDATE` FROM `IBZDEPT` t1
WHERE t1.ENABLE = 1
]]>
</sql>
...
...
ibzou-provider/ibzou-provider-ouapi/pom.xml
浏览文件 @
a5b198a5
...
...
@@ -31,6 +31,10 @@
</dependency>
</dependencies>
<properties>
<docker.image.prefix>
registry.cn-shanghai.aliyuncs.com/ibizsys
</docker.image.prefix>
</properties>
<profiles>
<profile>
<id>
ouapi
</id>
...
...
@@ -62,6 +66,23 @@
</execution>
</executions>
</plugin>
<plugin>
<groupId>
com.spotify
</groupId>
<artifactId>
docker-maven-plugin
</artifactId>
<version>
0.4.13
</version>
<configuration>
<serverId>
ibiz-dev
</serverId>
<imageName>
${docker.image.prefix}/${project.artifactId}:latest
</imageName>
<dockerDirectory>
${project.basedir}/src/main/docker
</dockerDirectory>
<resources>
<resource>
<targetPath>
/
</targetPath>
<directory>
../../
</directory>
<include>
${project.artifactId}.jar
</include>
</resource>
</resources>
</configuration>
</plugin>
</plugins>
</build>
</profile>
...
...
ibzou-provider/ibzou-provider-ouapi/src/main/docker/Dockerfile
0 → 100644
浏览文件 @
a5b198a5
FROM
openjdk:8-jre-alpine
ENV
SPRING_OUTPUT_ANSI_ENABLED=ALWAYS \
IBZ_SLEEP=0 \
JAVA_OPTS=""
CMD
echo "The application will start in ${IBZ_SLEEP}s..." && \
sleep ${IBZ_SLEEP} && \
java ${JAVA_OPTS} -Djava.security.egd=file:/dev/./urandom -jar /ibzou-provider-ouapi.jar
EXPOSE
8081
ADD
ibzou-provider-ouapi.jar /ibzou-provider-ouapi.jar
ibzou-provider/ibzou-provider-ouapi/src/main/docker/ibzou-provider-ouapi.yaml
0 → 100644
浏览文件 @
a5b198a5
version
:
"
3.2"
services
:
ibzou-provider-ouapi
:
image
:
registry.cn-shanghai.aliyuncs.com/ibizsys/ibzou-provider-ouapi:latest
ports
:
-
"
8081:8081"
networks
:
-
agent_network
deploy
:
mode
:
replicated
replicas
:
1
networks
:
agent_network
:
driver
:
overlay
attachable
:
true
\ No newline at end of file
ibzou-provider/ibzou-provider-ouapi/src/main/java/cn/ibizlab/ouapi/dto/IBZDepartmentDTO.java
浏览文件 @
a5b198a5
...
...
@@ -121,6 +121,14 @@ public class IBZDepartmentDTO extends DTOBase implements Serializable {
@JsonProperty
(
"updatedate"
)
private
Timestamp
updatedate
;
/**
* 属性 [ORGNAME]
*
*/
@JSONField
(
name
=
"orgname"
)
@JsonProperty
(
"orgname"
)
private
String
orgname
;
/**
* 设置 [DEPTCODE]
...
...
ibzou-util/src/main/java/cn/ibizlab/util/client/IBZOUFallback.java
0 → 100644
浏览文件 @
a5b198a5
package
cn
.
ibizlab
.
util
.
client
;
import
com.alibaba.fastjson.JSONObject
;
import
org.springframework.stereotype.Component
;
@Component
public
class
IBZOUFallback
implements
IBZOUFeignClient
{
@Override
public
JSONObject
getOrgInfo
(
String
orgLevel
)
{
return
null
;
}
}
ibzou-util/src/main/java/cn/ibizlab/util/client/IBZOUFeignClient.java
0 → 100644
浏览文件 @
a5b198a5
package
cn
.
ibizlab
.
util
.
client
;
import
com.alibaba.fastjson.JSONObject
;
import
org.springframework.cloud.openfeign.FeignClient
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.PathVariable
;
@FeignClient
(
value
=
"ibzou"
,
fallback
=
IBZOUFallback
.
class
)
public
interface
IBZOUFeignClient
{
/**
* 从ou中获取当前上下级组织、部门信息
* @param orgLevel
* @return
*/
@GetMapping
(
value
=
"/ibzou/org/{orglevel}"
)
JSONObject
getOrgInfo
(
@PathVariable
(
"orglevel"
)
String
orgLevel
);
}
ibzou-util/src/main/java/cn/ibizlab/util/client/IBZUAAFallback.java
0 → 100644
浏览文件 @
a5b198a5
package
cn
.
ibizlab
.
util
.
client
;
import
com.alibaba.fastjson.JSONObject
;
import
org.springframework.stereotype.Component
;
import
java.util.Map
;
@Component
public
class
IBZUAAFallback
implements
IBZUAAFeignClient
{
@Override
public
JSONObject
getUserPermissionData
(
String
userId
,
String
systemId
)
{
return
null
;
}
@Override
public
Map
<
String
,
Object
>
pushSystemPermissionData
(
Map
<
String
,
Object
>
systemPermissionData
,
String
systemId
)
{
return
null
;
}
}
ibzou-util/src/main/java/cn/ibizlab/util/client/IBZUAAFeignClient.java
0 → 100644
浏览文件 @
a5b198a5
package
cn
.
ibizlab
.
util
.
client
;
import
com.alibaba.fastjson.JSONObject
;
import
org.springframework.cloud.openfeign.FeignClient
;
import
org.springframework.web.bind.annotation.*
;
import
java.util.Map
;
@FeignClient
(
value
=
"ibzuaa"
,
fallback
=
IBZUAAFallback
.
class
)
public
interface
IBZUAAFeignClient
{
/**
* 从uaa中获取当前用户权限
* @param userId
* @param systemId
* @return
*/
@GetMapping
(
value
=
"/uaa/permission/{userid}"
)
JSONObject
getUserPermissionData
(
@PathVariable
(
"userid"
)
String
userId
,
@RequestParam
(
"systemid"
)
String
systemId
);
/**
* 推送系统权限数据到uaa
* @param systemPermissionData
* @param systemId
* @return
*/
@PostMapping
(
"/uaa/permission/save"
)
Map
<
String
,
Object
>
pushSystemPermissionData
(
@RequestBody
Map
<
String
,
Object
>
systemPermissionData
,
@RequestParam
(
"systemid"
)
String
systemId
);
}
ibzou-util/src/main/java/cn/ibizlab/util/job/PermissionSyncJob.java
浏览文件 @
a5b198a5
...
...
@@ -2,7 +2,7 @@ package cn.ibizlab.util.job;
import
com.alibaba.fastjson.JSONArray
;
import
com.alibaba.fastjson.JSONObject
;
import
cn.ibizlab.util.client.
uaa.
UAAFeignClient
;
import
cn.ibizlab.util.client.
IBZ
UAAFeignClient
;
import
org.apache.commons.io.IOUtils
;
import
org.apache.commons.logging.Log
;
import
org.apache.commons.logging.LogFactory
;
...
...
@@ -27,7 +27,7 @@ public class PermissionSyncJob implements ApplicationRunner {
private
Log
log
=
LogFactory
.
getLog
(
PermissionSyncJob
.
class
);
@Autowired
private
UAAFeignClient
client
;
private
IBZ
UAAFeignClient
client
;
@Value
(
"${ibiz.enablePermissionValid:false}"
)
boolean
enablePermissionValid
;
//是否开启权限校验
...
...
ibzou-util/src/main/java/cn/ibizlab/util/security/AuthPermissionEvaluator.java
浏览文件 @
a5b198a5
...
...
@@ -2,7 +2,6 @@ package cn.ibizlab.util.security;
import
com.alibaba.fastjson.JSONArray
;
import
com.alibaba.fastjson.JSONObject
;
import
com.baomidou.mybatisplus.core.conditions.Wrapper
;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
cn.ibizlab.util.domain.EntityBase
;
...
...
@@ -111,28 +110,32 @@ public class AuthPermissionEvaluator implements PermissionEvaluator {
boolean
isPermission
;
EntityBase
entity
Base
=
null
;
EntityBase
entity
=
null
;
if
(
cur_entity
instanceof
EntityBase
)
entity
Base
=
(
EntityBase
)
cur_entity
;
entity
=
(
EntityBase
)
cur_entity
;
if
(
StringUtils
.
isEmpty
(
entity
Base
))
if
(
StringUtils
.
isEmpty
(
entity
))
return
false
;
try
{
String
entityName
=
entityBase
.
getClass
().
getSimpleName
();
//实体名
String
entityName
=
entity
.
getClass
().
getSimpleName
();
//实体名
if
(
action
.
equals
(
"CREATE"
)){
//表单新建权限校验
JSONObject
permissionList
=
AuthenticationUser
.
getAuthenticationUser
().
getPermisionList
();
//获取权限列表
JSONObject
formDataAbility
=
permissionList
.
getJSONObject
(
"dataAbility-form"
);
//获取表单的权限数据
return
isFormCreatePermission
(
formDataAbility
,
entityName
,
action
);
//拼接权限条件
}
else
{
//表单编辑、查询权限校验
else
{
//表单编辑、查询权限校验
ServiceImpl
service
=
SpringContextHolder
.
getBean
(
String
.
format
(
"%s%s"
,
getBeanName
(
entityName
),
"ServiceImpl"
));
//获取当前实体service
JSONObject
permissionList
=
AuthenticationUser
.
getAuthenticationUser
().
getPermisionList
();
//获取权限列表
JSONObject
formDataAbility
=
permissionList
.
getJSONObject
(
"dataAbility-form"
);
//获取表单的权限数据
Map
<
String
,
String
>
permissionField
=
getPermissionField
(
entityBase
);
String
selectCond
=
generatePermissionSQLForm
(
formDataAbility
,
entityName
,
action
,
srfkey
,
permissionField
);
//拼接权限条件
if
(
isAllData
(
formDataAbility
,
entityName
,
action
)){
//若为全部数据则直接返回,不再进行校验
return
true
;
}
Map
<
String
,
String
>
permissionField
=
getPermissionField
(
entity
);
//获取系统预置属性
String
selectCond
=
generatePermissionSQLForm
(
formDataAbility
,
entityName
,
action
,
srfkey
,
permissionField
);
//根据uaa中分配的权限拼接where条件
if
(
StringUtils
.
isEmpty
(
selectCond
))
return
false
;
QueryWrapper
permissionCond
=
getPermissionCond
(
selectCond
,
permissionField
);
...
...
@@ -144,6 +147,33 @@ public class AuthPermissionEvaluator implements PermissionEvaluator {
return
isPermission
;
}
/**
* 判断是否包含全部数据
* @param formDataAbility
* @param entityName
* @param action
* @return
*/
private
boolean
isAllData
(
JSONObject
formDataAbility
,
String
entityName
,
String
action
)
{
if
(
formDataAbility
==
null
)
return
false
;
if
(!
formDataAbility
.
containsKey
(
entityName
))
return
false
;
JSONObject
entityObj
=
formDataAbility
.
getJSONObject
(
entityName
);
//获取实体
if
(!
entityObj
.
containsKey
(
action
))
return
false
;
JSONArray
entityOperation
=
entityObj
.
getJSONArray
(
action
);
//行为:read;insert...
if
(
entityOperation
.
size
()==
0
)
return
false
;
if
(
entityOperation
.
contains
(
"ALL"
)){
//全部数据
return
true
;
}
return
false
;
}
/**
* 拼接表格查询条件
* @param gridDataAbility
...
...
@@ -260,41 +290,51 @@ public class AuthPermissionEvaluator implements PermissionEvaluator {
*/
private
String
getPermissionCond
(
JSONArray
entityOperation
,
Map
<
String
,
String
>
permissionField
){
String
orgField
=
permissionField
.
get
(
"orgfield"
);
String
orgsecfield
=
permissionField
.
get
(
"orgsecfield"
);
StringBuffer
cond
=
new
StringBuffer
();
String
orgDeptField
=
permissionField
.
get
(
"orgsecfield"
);
StringBuffer
permissionSQL
=
new
StringBuffer
();
AuthenticationUser
authenticationUser
=
AuthenticationUser
.
getAuthenticationUser
();
JSONObject
userInfo
=
authenticationUser
.
getOrgInfo
();
JSONObject
orgObject
=
userInfo
.
getJSONObject
(
"org"
);
JSONArray
orgParent
=
orgObject
.
getJSONArray
(
"porg"
);
JSONArray
orgChild
=
orgObject
.
getJSONArray
(
"sorg"
);
JSONObject
orgDeptObject
=
userInfo
.
getJSONObject
(
"orgdept"
);
JSONArray
orgDeptParent
=
orgDeptObject
.
getJSONArray
(
"porgdept"
);
JSONArray
orgDeptChild
=
orgDeptObject
.
getJSONArray
(
"sorgdept"
);
for
(
int
i
=
0
;
i
<
entityOperation
.
size
();
i
++){
if
(
i
>
0
&&
(!
StringUtils
.
isEmpty
(
cond
.
toString
())))
cond
.
append
(
"OR"
);
if
(
i
>
0
&&
(!
StringUtils
.
isEmpty
(
permissionSQL
.
toString
())))
permissionSQL
.
append
(
"OR"
);
String
permissionCond
=
entityOperation
.
getString
(
i
);
//权限配置条件
if
(
permissionCond
.
equals
(
"CUR
_
ORG"
)){
//本单位
cond
.
append
(
String
.
format
(
"(t1.
%s='%s')"
,
orgField
,
AuthenticationUser
.
getAuthenticationUser
().
getOrgid
()));
if
(
permissionCond
.
equals
(
"CURORG"
)){
//本单位
permissionSQL
.
append
(
String
.
format
(
"(
%s='%s')"
,
orgField
,
AuthenticationUser
.
getAuthenticationUser
().
getOrgid
()));
}
if
(
permissionCond
.
equals
(
"S
UB_
ORG"
)){
//下级单位
cond
.
append
(
" INSTR(j1.LEVELCODE,'"
+
AuthenticationUser
.
getAuthenticationUser
().
getLevelcode
()+
"')=1 "
);
if
(
permissionCond
.
equals
(
"SORG"
)){
//下级单位
permissionSQL
.
append
(
String
.
format
(
" %s in(%s) "
,
orgField
,
formatStringArr
(
orgChild
))
);
}
if
(
permissionCond
.
equals
(
"
HIT_
ORG"
)){
//上级单位
cond
.
append
(
" INSTR('"
+
AuthenticationUser
.
getAuthenticationUser
().
getLevelcode
()+
"',j1.LEVELCODE)=1 "
);
if
(
permissionCond
.
equals
(
"
P
ORG"
)){
//上级单位
permissionSQL
.
append
(
String
.
format
(
" %s in(%s) "
,
orgField
,
formatStringArr
(
orgParent
))
);
}
if
(
permissionCond
.
equals
(
"CREATEMAN"
)){
//建立人
cond
.
append
(
String
.
format
(
"(t1.createman='%s')"
,
AuthenticationUser
.
getAuthenticationUser
().
getUserid
()));
permissionSQL
.
append
(
String
.
format
(
"(createman='%s')"
,
AuthenticationUser
.
getAuthenticationUser
().
getUserid
()));
}
if
(
permissionCond
.
equals
(
"CURORGDEPT"
)){
//本部门
permissionSQL
.
append
(
String
.
format
(
"(orgsecid='%s')"
,
AuthenticationUser
.
getAuthenticationUser
().
getMdeptid
()));
}
if
(
permissionCond
.
equals
(
"SORGDEPT"
)){
//下级部门
permissionSQL
.
append
(
String
.
format
(
" %s in (%s) "
,
orgDeptField
,
formatStringArr
(
orgDeptChild
)));
}
if
(
permissionCond
.
equals
(
"PORGDEPT"
)){
//上级部门
permissionSQL
.
append
(
String
.
format
(
" %s in (%s) "
,
orgDeptField
,
formatStringArr
(
orgDeptParent
)));
}
// if(permissionCond.equals("CUR_ORGSEC")){//本部门
// cond.append(String.format("(t1.orgsecid='%s')",AuthenticationUser.getAuthenticationUser().getMdeptid()));
// }
// if(permissionCond.equals("SUB_ORGSEC")){//下级部门
// cond.append(" INSTR(j2.LEVELCODE,'"+AuthenticationUser.getAuthenticationUser().getMdeptcode()+"')=1 ");
// }
// if(permissionCond.equals("HIGH_ORGSEC")){//上级部门
// cond.append(" INSTR('"+AuthenticationUser.getAuthenticationUser().getMdeptcode()+"',j2.LEVELCODE)=1 ");
// }
if
(
permissionCond
.
equals
(
"ALL"
)){
//全部数据
cond
.
append
(
"(1=1)"
);
permissionSQL
.
append
(
"(1=1)"
);
}
}
if
(
StringUtils
.
isEmpty
(
cond
.
toString
()))
if
(
StringUtils
.
isEmpty
(
permissionSQL
.
toString
()))
return
""
;
String
resultCond
=
cond
.
toString
();
String
resultCond
=
permissionSQL
.
toString
();
if
(
resultCond
.
endsWith
(
"OR"
)){
resultCond
=
resultCond
.
substring
(
0
,
resultCond
.
lastIndexOf
(
"OR"
));
}
...
...
@@ -309,15 +349,11 @@ public class AuthPermissionEvaluator implements PermissionEvaluator {
*/
private
QueryWrapper
getPermissionCond
(
String
whereCond
,
Map
<
String
,
String
>
permissionField
){
Wrapper
wrapper
=
new
QueryWrapper
();
QueryWrapper
allPermissionCond
=
new
QueryWrapper
();
//permissionCond.apply("inner join JC_ORG j1 on t1.ORGID=j1.orgid inner join JC_ORGSEC j2 on t1.orgsecid=j2.orgsecid");
if
(
StringUtils
.
isEmpty
(
whereCond
))
return
allPermissionCond
;
// String strAllPermissionCond=String.format("inner join XT_ZZJG_DWBM j1 on t1.%s=j1.dwbm where (%s) ",permissionField.get("orgfield"),whereCond);
allPermissionCond
.
apply
(
whereCond
);
return
allPermissionCond
;
...
...
@@ -361,4 +397,15 @@ public class AuthPermissionEvaluator implements PermissionEvaluator {
}
}
/**
* 转换[a,b]格式字符串到 'a','b'格式
*
* @return
*/
private
String
formatStringArr
(
JSONArray
array
)
{
String
[]
arr
=
array
.
toArray
(
new
String
[
array
.
size
()]);
return
"'"
+
String
.
join
(
"','"
,
arr
)
+
"'"
;
}
}
\ No newline at end of file
ibzou-util/src/main/java/cn/ibizlab/util/security/AuthenticationUser.java
浏览文件 @
a5b198a5
...
...
@@ -65,6 +65,8 @@ public class AuthenticationUser implements UserDetails
private
String
levelcode
;
//单位级别编码
@JsonIgnore
private
Map
<
String
,
String
>
userSessionParam
;
//用户自定义session值
@JsonIgnore
private
JSONObject
orgInfo
;
//上下级组织信息
@JsonIgnore
...
...
ibzou-util/src/main/java/cn/ibizlab/util/service/SimpleUserService.java
浏览文件 @
a5b198a5
package
cn
.
ibizlab
.
util
.
service
;
import
cn.ibizlab.util.security.AuthenticationUser
;
import
cn.ibizlab.util.client.uaa.UAAFeignClient
;
import
cn.ibizlab.util.client.IBZUAAFeignClient
;
import
cn.ibizlab.util.client.IBZOUFeignClient
;
import
org.springframework.context.annotation.Primary
;
import
org.springframework.stereotype.Service
;
...
...
@@ -18,7 +19,17 @@ import org.springframework.beans.factory.annotation.Value;
@Service
(
"SimpleUserService"
)
public
class
SimpleUserService
implements
AuthenticationUserService
{
@Value
(
"${ibiz.enablePermissionValid:false}"
)
boolean
enablePermissionValid
;
//是否开启权限校验
@Value
(
"${ibiz.systemid:2C40DFCD-0DF5-47BF-91A5-C45F810B0001}"
)
private
String
systemid
;
@Autowired
private
IBZUAAFeignClient
uaaFeignClient
;
@Autowired
private
IBZOUFeignClient
ouFeignClient
;
@Override
public
AuthenticationUser
loadUserByUsername
(
String
username
)
{
...
...
@@ -49,7 +60,9 @@ public class SimpleUserService implements AuthenticationUserService{
user
.
setOrgcode
(
domains
);
user
.
setOrgname
(
domains
);
testPermissionData
(
user
);
setUserPermission
(
user
);
setUserOrgInfo
(
user
);
return
user
;
}
...
...
@@ -73,25 +86,34 @@ public class SimpleUserService implements AuthenticationUserService{
}
@Value
(
"${ibiz.enablePermissionValid:false}"
)
boolean
enablePermissionValid
;
//是否开启权限校验
@Value
(
"${ibiz.systemid:2C40DFCD-0DF5-47BF-91A5-C45F810B0001}"
)
private
String
systemid
;
@Autowired
private
UAAFeignClient
client
;
/**
* 设置用户权限
*/
private
void
setUserPermission
(
AuthenticationUser
curU
ser
)
{
private
void
setUserPermission
(
AuthenticationUser
u
ser
)
{
if
(
enablePermissionValid
){
String
userid
=
curUser
.
getUserid
();
//String userid="4fb71d8997d4505d2748ad2bdc471969";
//String systemid="2C40DFCD-0DF5-47BF-91A5-C45F810B0001";
JSONObject
permission
=
client
.
getUserPermissionData
(
userid
,
systemid
);
curUser
.
setPermisionList
(
permission
);
JSONObject
permission
=
uaaFeignClient
.
getUserPermissionData
(
user
.
getUserid
(),
systemid
);
user
.
setPermisionList
(
permission
);
}
}
/**
* 设置用户组织相关信息
* @param user
*/
private
void
setUserOrgInfo
(
AuthenticationUser
user
)
{
if
(
enablePermissionValid
)
{
user
.
setOrgInfo
(
ouFeignClient
.
getOrgInfo
(
user
.
getLevelcode
()));
}
}
/**
* 测试数据
* @param user
*/
private
void
testPermissionData
(
AuthenticationUser
user
){
user
.
setLevelcode
(
"4501"
);
user
.
setUserid
(
"4fb71d8997d4505d2748ad2bdc471969"
);
this
.
systemid
=
"2C40DFCD-0DF5-47BF-91A5-C45F810B0001"
;
}
}
编辑
预览
Markdown
格式
0%
请重试
or
添加新附件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
先完成此消息的编辑!
取消
想要评论请
注册
或
登录