Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
提交反馈
为 GitLab 提交贡献
登录
切换导航
I
ibzuaa
项目
项目
详情
动态
版本
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
ibiz4jteam
ibzuaa
提交
a3946f67
提交
a3946f67
编写于
4月 28, 2020
作者:
ibizdev
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
ibizdev提交
上级
da7097fb
变更
7
隐藏空白字符变更
内嵌
并排
正在显示
7 个修改的文件
包含
90 行增加
和
45 行删除
+90
-45
codelist-service.ts
app_web/src/service/app/codelist-service.ts
+65
-30
Dockerfile
ibzuaa-app/ibzuaa-app-web/src/main/docker/Dockerfile
+3
-2
h2_table.xml
ibzuaa-core/src/main/resources/liquibase/h2_table.xml
+1
-1
UAAFallback.java
...src/main/java/cn/ibizlab/util/client/uaa/UAAFallback.java
+2
-2
UAAFeignClient.java
.../main/java/cn/ibizlab/util/client/uaa/UAAFeignClient.java
+17
-8
PermissionSyncJob.java
.../src/main/java/cn/ibizlab/util/job/PermissionSyncJob.java
+1
-1
SimpleUserService.java
.../main/java/cn/ibizlab/util/service/SimpleUserService.java
+1
-1
未找到文件。
app_web/src/service/app/codelist-service.ts
浏览文件 @
a3946f67
...
...
@@ -51,38 +51,13 @@ export default class CodeListService {
*/
public
getItems
(
tag
:
string
,
context
:
any
=
{},
data
?:
any
,
isloading
?:
boolean
,):
Promise
<
any
[]
>
{
let
_this
:
any
=
this
;
let
isEnableCache
:
boolean
=
_this
[
tag
].
isEnableCache
;
let
cacheTimeout
:
any
=
_this
[
tag
].
cacheTimeout
;
return
new
Promise
((
resolve
:
any
,
reject
:
any
)
=>
{
if
(
!
data
){
if
(
this
.
$store
&&
_this
.
$store
.
getters
){
let
items
:
any
=
_this
.
$store
.
getters
.
getCodeListItems
(
tag
);
if
(
items
.
length
>
0
){
return
resolve
(
items
);
}
}
if
(
_this
[
tag
])
{
const
callback
:
Function
=
(
tag
:
string
,
promise
:
Promise
<
any
>
)
=>
{
promise
.
then
((
result
:
any
)
=>
{
if
(
result
.
length
>
0
){
_this
.
$store
.
commit
(
'updateCodeList'
,{
srfkey
:
tag
,
items
:
result
});
return
resolve
(
result
);
}
else
{
return
resolve
([]);
}
}).
catch
((
result
:
any
)
=>
{
return
reject
(
result
);
})
}
if
(
CodeListService
.
codelistCache
.
get
(
tag
)){
callback
(
tag
,
CodeListService
.
codelistCache
.
get
(
tag
));
}
else
{
let
result
:
Promise
<
any
>
=
_this
[
tag
].
getItems
(
context
,
data
,
isloading
);
CodeListService
.
codelistCache
.
set
(
tag
,
result
);
callback
(
tag
,
result
);
}
}
}
else
{
// 如有查询参数传递过来,需直接加载,不能使用缓存
if
(
data
&&
Object
.
keys
(
data
).
length
>
0
){
if
(
_this
[
tag
])
{
_this
[
tag
].
getItems
(
context
,
data
,
isloading
).
then
((
result
:
any
)
=>
{
_this
[
tag
].
getItems
(
context
,
JSON
.
parse
(
JSON
.
stringify
(
data
))
,
isloading
).
then
((
result
:
any
)
=>
{
resolve
(
result
);
}).
catch
((
error
:
any
)
=>
{
Promise
.
reject
([]);
...
...
@@ -90,6 +65,66 @@ export default class CodeListService {
}
else
{
return
Promise
.
reject
([]);
}
}
else
{
// 启用缓存
if
(
isEnableCache
){
// 加载完成,从store获取
if
(
this
.
$store
&&
_this
.
$store
.
getters
){
let
items
:
any
=
_this
.
$store
.
getters
.
getCodeListItems
(
tag
);
if
(
items
.
length
>
0
){
if
(
cacheTimeout
!==
-
1
){
if
(
new
Date
().
getTime
()
>
_this
[
tag
].
expirationTime
){
_this
[
tag
].
getItems
(
context
,
data
,
isloading
).
then
((
result
:
any
)
=>
{
_this
.
$store
.
commit
(
'updateCodeList'
,{
srfkey
:
tag
,
items
:
result
});
_this
[
tag
].
expirationTime
=
new
Date
().
getTime
()
+
cacheTimeout
;
resolve
(
result
);
}).
catch
((
error
:
any
)
=>
{
Promise
.
reject
([]);
})
}
else
{
return
resolve
(
items
);
}
}
else
{
return
resolve
(
items
);
}
}
}
if
(
_this
[
tag
])
{
const
callback
:
Function
=
(
tag
:
string
,
promise
:
Promise
<
any
>
)
=>
{
promise
.
then
((
result
:
any
)
=>
{
if
(
result
.
length
>
0
){
_this
.
$store
.
commit
(
'updateCodeList'
,{
srfkey
:
tag
,
items
:
result
});
return
resolve
(
result
);
}
else
{
return
resolve
([]);
}
}).
catch
((
result
:
any
)
=>
{
return
reject
(
result
);
})
}
// 加载中,UI又需要数据,解决连续加载同一代码表问题
if
(
CodeListService
.
codelistCache
.
get
(
tag
)){
callback
(
tag
,
CodeListService
.
codelistCache
.
get
(
tag
));
}
else
{
let
result
:
Promise
<
any
>
=
_this
[
tag
].
getItems
(
context
,
data
,
isloading
);
CodeListService
.
codelistCache
.
set
(
tag
,
result
);
if
(
cacheTimeout
!==
-
1
){
_this
[
tag
].
expirationTime
=
new
Date
().
getTime
()
+
cacheTimeout
;
}
callback
(
tag
,
result
);
}
}
}
else
{
if
(
_this
[
tag
])
{
_this
[
tag
].
getItems
(
context
,
data
,
isloading
).
then
((
result
:
any
)
=>
{
resolve
(
result
);
}).
catch
((
error
:
any
)
=>
{
Promise
.
reject
([]);
})
}
else
{
return
Promise
.
reject
([]);
}
}
}
})
}
...
...
ibzuaa-app/ibzuaa-app-web/src/main/docker/Dockerfile
浏览文件 @
a3946f67
FROM
openjdk:8-jre-alpine
ENV
SPRING_OUTPUT_ANSI_ENABLED=ALWAYS \
...
...
@@ -6,8 +7,8 @@ ENV SPRING_OUTPUT_ANSI_ENABLED=ALWAYS \
CMD
echo "The application will start in ${IBZ_SLEEP}s..." && \
sleep ${IBZ_SLEEP} && \
java ${JAVA_OPTS} -Djava.security.egd=file:/dev/./urandom -jar /ibzuaa.jar
java ${JAVA_OPTS} -Djava.security.egd=file:/dev/./urandom -jar /ibzuaa
-app-web
.jar
EXPOSE
8080
ADD
ibzuaa
.jar /ibzuaa
.jar
ADD
ibzuaa
-app-web.jar /ibzuaa-app-web
.jar
ibzuaa-core/src/main/resources/liquibase/h2_table.xml
浏览文件 @
a3946f67
...
...
@@ -112,7 +112,7 @@
</createTable>
</changeSet>
<!--输出实体[SYS_PERMISSION]数据结构 -->
<changeSet
author=
"a_A_5d9d78509"
id=
"tab-sys_permission-3
0
-6"
>
<changeSet
author=
"a_A_5d9d78509"
id=
"tab-sys_permission-3
1
-6"
>
<createTable
tableName=
"IBZPERMISSION"
>
<column
name=
"SYS_PERMISSIONID"
remarks=
""
type=
"VARCHAR(200)"
>
<constraints
primaryKey=
"true"
primaryKeyName=
"PK_SYS_PERMISSION_SYS_PERMISSI"
/>
...
...
ibzuaa-util/src/main/java/cn/ibizlab/util/client/uaa/UAAFallback.java
浏览文件 @
a3946f67
...
...
@@ -8,12 +8,12 @@ import java.util.Map;
public
class
UAAFallback
implements
UAAFeignClient
{
@Override
public
JSONObject
get
Permission
(
String
userid
,
String
systemi
d
)
{
public
JSONObject
get
UserPermissionData
(
String
userId
,
String
systemI
d
)
{
return
null
;
}
@Override
public
Map
<
String
,
Object
>
push
PermissionData
(
Map
<
String
,
Object
>
map
,
String
systemi
d
)
{
public
Map
<
String
,
Object
>
push
SystemPermissionData
(
Map
<
String
,
Object
>
systemPermissionData
,
String
systemI
d
)
{
return
null
;
}
...
...
ibzuaa-util/src/main/java/cn/ibizlab/util/client/uaa/UAAFeignClient.java
浏览文件 @
a3946f67
...
...
@@ -2,20 +2,29 @@ package cn.ibizlab.util.client.uaa;
import
com.alibaba.fastjson.JSONObject
;
import
org.springframework.cloud.openfeign.FeignClient
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestParam
;
import
org.springframework.web.bind.annotation.*
;
import
java.util.Map
;
@FeignClient
(
value
=
"ibzuaa"
,
fallback
=
UAAFallback
.
class
)
public
interface
UAAFeignClient
{
@GetMapping
(
value
=
"/uaa/getpermission"
)
JSONObject
getPermission
(
@RequestParam
(
"userid"
)
String
userid
,
@RequestParam
(
"systemid"
)
String
systemid
);
/**
* 从uaa中获取当前用户权限
* @param userId
* @param systemId
* @return
*/
@GetMapping
(
value
=
"/uaa/permission/{userid}"
)
JSONObject
getUserPermissionData
(
@PathVariable
(
"userid"
)
String
userId
,
@RequestParam
(
"systemid"
)
String
systemId
);
@PostMapping
(
"/uaa/pushpermissiondata"
)
Map
<
String
,
Object
>
pushPermissionData
(
@RequestBody
Map
<
String
,
Object
>
map
,
@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
);
}
ibzuaa-util/src/main/java/cn/ibizlab/util/job/PermissionSyncJob.java
浏览文件 @
a3946f67
...
...
@@ -45,7 +45,7 @@ public class PermissionSyncJob implements ApplicationRunner {
Map
<
String
,
Object
>
map
=
new
HashMap
<
String
,
Object
>();
map
.
put
(
"menu"
,
new
JSONArray
());
map
.
put
(
"permission"
,
jsonNodePermission
);
client
.
pushPermissionData
(
map
,
systemId
);
client
.
push
System
PermissionData
(
map
,
systemId
);
}
catch
(
Exception
ex
)
{
log
.
error
(
String
.
format
(
"向UAA同步数据发生错误,请检查UAA服务是否正常! [%s]"
,
ex
));
...
...
ibzuaa-util/src/main/java/cn/ibizlab/util/service/SimpleUserService.java
浏览文件 @
a3946f67
...
...
@@ -90,7 +90,7 @@ public class SimpleUserService implements AuthenticationUserService{
String
userid
=
curUser
.
getUserid
();
//String userid="4fb71d8997d4505d2748ad2bdc471969";
//String systemid="2C40DFCD-0DF5-47BF-91A5-C45F810B0001";
JSONObject
permission
=
client
.
get
Permission
(
userid
,
systemid
);
JSONObject
permission
=
client
.
get
UserPermissionData
(
userid
,
systemid
);
curUser
.
setPermisionList
(
permission
);
}
}
...
...
编辑
预览
Markdown
格式
0%
请重试
or
添加新附件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
先完成此消息的编辑!
取消
想要评论请
注册
或
登录