Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
提交反馈
为 GitLab 提交贡献
登录
切换导航
I
ibzdict
项目
项目
详情
动态
版本
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
ibiz4jteam
ibzdict
提交
7cffb530
提交
7cffb530
编写于
4月 17, 2020
作者:
ibizdev
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
ibizdev提交
上级
a621dfda
变更
2
隐藏空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
75 行增加
和
3 行删除
+75
-3
webDataEntitySysApiMappingFilter.java
.../ibizlab/web/filter/webDataEntitySysApiMappingFilter.java
+61
-0
IBZDictResource.java
.../cn/ibizlab/service/dictapi/resource/IBZDictResource.java
+14
-3
未找到文件。
ibzdict-app/ibzdict-app-web/src/main/java/cn/ibizlab/web/filter/webDataEntitySysApiMappingFilter.java
0 → 100644
浏览文件 @
7cffb530
package
cn
.
ibizlab
.
web
.
filter
;
import
com.netflix.zuul.ZuulFilter
;
import
com.netflix.zuul.context.RequestContext
;
import
org.springframework.cloud.netflix.zuul.filters.support.FilterConstants
;
import
org.springframework.stereotype.Component
;
import
org.springframework.util.ObjectUtils
;
import
org.springframework.util.StringUtils
;
import
javax.annotation.PostConstruct
;
import
java.util.HashMap
;
import
java.util.Map
;
/**
* 将应用实体映射到对应的系统服务接口
*/
@Component
public
class
webDataEntitySysApiMappingFilter
extends
ZuulFilter
{
private
static
Map
<
String
,
String
>
AppDataEntitySysApiMapping
=
new
HashMap
<>();
@PostConstruct
private
void
initDataEntitySysApiMapping
()
{
AppDataEntitySysApiMapping
.
put
(
"ibzdictitem"
,
"dictapi"
);
AppDataEntitySysApiMapping
.
put
(
"ibzdict"
,
"dictapi"
);
}
@Override
public
Object
run
()
{
RequestContext
context
=
RequestContext
.
getCurrentContext
();
Object
entity
=
context
.
get
(
FilterConstants
.
PROXY_KEY
);
Object
requestPath
=
context
.
get
(
FilterConstants
.
REQUEST_URI_KEY
);
if
(
ObjectUtils
.
isEmpty
(
requestPath
)
||
ObjectUtils
.
isEmpty
(
entity
))
{
return
null
;
}
String
sysApiPrefix
=
AppDataEntitySysApiMapping
.
get
(
entity
);
if
(
StringUtils
.
isEmpty
(
sysApiPrefix
))
{
return
null
;
}
context
.
put
(
FilterConstants
.
REQUEST_URI_KEY
,
String
.
format
(
"/%s%s"
,
sysApiPrefix
,
requestPath
));
return
null
;
}
@Override
public
String
filterType
()
{
return
FilterConstants
.
PRE_TYPE
;
}
@Override
public
int
filterOrder
()
{
return
FilterConstants
.
PRE_DECORATION_FILTER_ORDER
+
1
;
}
@Override
public
boolean
shouldFilter
()
{
return
true
;
}
}
ibzdict-provider/ibzdict-provider-dictapi/src/main/java/cn/ibizlab/service/dictapi/resource/IBZDictResource.java
浏览文件 @
7cffb530
...
@@ -35,16 +35,26 @@ import cn.ibizlab.core.dict.filter.IBZDictSearchContext;
...
@@ -35,16 +35,26 @@ import cn.ibizlab.core.dict.filter.IBZDictSearchContext;
import
cn.ibizlab.core.dict.service.mapping.IBZDictMapping
;
import
cn.ibizlab.core.dict.service.mapping.IBZDictMapping
;
import
cn.ibizlab.service.dictapi.dto.IBZDictItemDTO
;
import
cn.ibizlab.core.dict.domain.IBZDictItem
;
import
cn.ibizlab.core.dict.service.IIBZDictItemService
;
@Slf4j
@Slf4j
@Api
(
tags
=
{
"IBZDict"
})
@Api
(
tags
=
{
"IBZDict"
})
@RestController
(
"dictapi
IBZD
ict"
)
@RestController
(
"dictapi
-ibzd
ict"
)
@RequestMapping
(
""
)
@RequestMapping
(
""
)
public
class
IBZDictResource
{
public
class
IBZDictResource
{
@Autowired
@Autowired
private
IIBZDictService
ibzdictService
;
private
IIBZDictService
ibzdictService
;
@Autowired
private
IBZDictMapping
ibzdictMapping
;
@Autowired
private
IIBZDictItemService
ibzdictitemService
;
@ApiOperation
(
value
=
"Get"
,
tags
=
{
"IBZDict"
},
notes
=
"Get"
)
@ApiOperation
(
value
=
"Get"
,
tags
=
{
"IBZDict"
},
notes
=
"Get"
)
@RequestMapping
(
method
=
RequestMethod
.
GET
,
value
=
"/dictapi/ibzdicts/{ibzdict_id}"
)
@RequestMapping
(
method
=
RequestMethod
.
GET
,
value
=
"/dictapi/ibzdicts/{ibzdict_id}"
)
public
ResponseEntity
<
IBZDictDTO
>
get
(
@PathVariable
(
"ibzdict_id"
)
String
ibzdict_id
)
{
public
ResponseEntity
<
IBZDictDTO
>
get
(
@PathVariable
(
"ibzdict_id"
)
String
ibzdict_id
)
{
...
@@ -57,9 +67,10 @@ public class IBZDictResource {
...
@@ -57,9 +67,10 @@ public class IBZDictResource {
@RequestMapping
(
method
=
RequestMethod
.
POST
,
value
=
"/dictapi/ibzdicts"
)
@RequestMapping
(
method
=
RequestMethod
.
POST
,
value
=
"/dictapi/ibzdicts"
)
@Transactional
@Transactional
public
ResponseEntity
<
IBZDictDTO
>
create
(
@RequestBody
IBZDictDTO
ibzdictdto
)
{
public
ResponseEntity
<
IBZDictDTO
>
create
(
@RequestBody
IBZDictDTO
ibzdictdto
)
{
IBZDict
domain
=
IBZDictMapping
.
MAPPER
.
toDomain
(
ibzdictdto
);
IBZDict
domain
=
ibzdictMapping
.
toDomain
(
ibzdictdto
);
ibzdictService
.
create
(
domain
);
ibzdictService
.
create
(
domain
);
IBZDictDTO
dto
=
IBZDictMapping
.
MAPPER
.
toDto
(
domain
);
IBZDictDTO
dto
=
ibzdictMapping
.
toDto
(
domain
);
return
ResponseEntity
.
status
(
HttpStatus
.
OK
).
body
(
dto
);
return
ResponseEntity
.
status
(
HttpStatus
.
OK
).
body
(
dto
);
}
}
...
...
编辑
预览
Markdown
格式
0%
请重试
or
添加新附件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
先完成此消息的编辑!
取消
想要评论请
注册
或
登录