Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
提交反馈
为 GitLab 提交贡献
登录
切换导航
I
ibzdict
项目
项目
详情
动态
版本
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
ibiz4jteam
ibzdict
提交
35d9fa5c
提交
35d9fa5c
编写于
4月 17, 2020
作者:
sq3536
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
移除无效
上级
03f52b57
变更
2
隐藏空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
0 行增加
和
288 行删除
+0
-288
AppDataEntitySysApiMappingFilter.java
.../ibizlab/web/filter/AppDataEntitySysApiMappingFilter.java
+0
-61
IBZDictItemResource.java
...ibizlab/service/dictapi/resource/IBZDictItemResource.java
+0
-227
未找到文件。
ibzdict-app/ibzdict-app-web/src/main/java/cn/ibizlab/web/filter/AppDataEntitySysApiMappingFilter.java
已删除
100644 → 0
浏览文件 @
03f52b57
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
AppDataEntitySysApiMappingFilter
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/IBZDictItemResource.java
已删除
100644 → 0
浏览文件 @
03f52b57
package
cn
.
ibizlab
.
service
.
dictapi
.
resource
;
import
java.sql.Timestamp
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.Map
;
import
java.math.BigInteger
;
import
java.util.HashMap
;
import
lombok.extern.slf4j.Slf4j
;
import
com.alibaba.fastjson.JSONObject
;
import
javax.servlet.ServletRequest
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.cglib.beans.BeanCopier
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.http.ResponseEntity
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.http.HttpStatus
;
import
org.springframework.data.domain.PageRequest
;
import
org.springframework.data.domain.Page
;
import
org.springframework.data.domain.PageImpl
;
import
org.springframework.data.domain.Pageable
;
import
org.springframework.util.StringUtils
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
io.swagger.annotations.ApiResponse
;
import
io.swagger.annotations.ApiResponses
;
import
cn.ibizlab.core.dict.service.dto.IBZDictItemDTO
;
import
cn.ibizlab.core.dict.domain.IBZDictItem
;
import
cn.ibizlab.core.dict.service.IIBZDictItemService
;
import
cn.ibizlab.core.dict.filter.IBZDictItemSearchContext
;
import
cn.ibizlab.core.dict.service.mapping.IBZDictItemMapping
;
import
cn.ibizlab.util.log.IBIZLog
;
@Slf4j
@IBIZLog
@Api
(
tags
=
{
"IBZDictItem"
})
@RestController
@RequestMapping
(
""
)
public
class
IBZDictItemResource
{
@Autowired
private
IIBZDictItemService
ibzdictitemService
;
@ApiOperation
(
value
=
"Get"
,
tags
=
{
"IBZDictItem"
},
notes
=
"Get"
)
@RequestMapping
(
method
=
RequestMethod
.
GET
,
value
=
"/dictapi/ibzdictitems/{ibzdictitem_id}"
)
public
ResponseEntity
<
IBZDictItemDTO
>
get
(
@PathVariable
(
"ibzdictitem_id"
)
String
ibzdictitem_id
)
{
IBZDictItem
domain
=
ibzdictitemService
.
get
(
ibzdictitem_id
);
IBZDictItemDTO
dto
=
IBZDictItemMapping
.
MAPPER
.
toDto
(
domain
);
return
ResponseEntity
.
status
(
HttpStatus
.
OK
).
body
(
dto
);
}
@ApiOperation
(
value
=
"GetDraft"
,
tags
=
{
"IBZDictItem"
},
notes
=
"GetDraft"
)
@RequestMapping
(
method
=
RequestMethod
.
GET
,
value
=
"/dictapi/ibzdictitems/getdraft"
)
@Transactional
public
ResponseEntity
<
IBZDictItemDTO
>
getDraft
()
{
return
ResponseEntity
.
status
(
HttpStatus
.
OK
).
body
(
new
IBZDictItemDTO
());
}
//SAVE
@ApiOperation
(
value
=
"Save"
,
tags
=
{
"IBZDictItem"
},
notes
=
"Save"
)
@RequestMapping
(
method
=
RequestMethod
.
POST
,
value
=
"/dictapi/ibzdictitems/{ibzdictitem_id}/save"
)
public
ResponseEntity
<
Boolean
>
save
(
@RequestBody
IBZDictItemDTO
ibzdictitemdto
)
{
IBZDictItem
ibzdictitem
=
IBZDictItemMapping
.
MAPPER
.
toDomain
(
ibzdictitemdto
);
Boolean
b
=
ibzdictitemService
.
save
(
ibzdictitem
)
;
return
ResponseEntity
.
status
(
HttpStatus
.
OK
).
body
(
b
);
}
@ApiOperation
(
value
=
"CheckKey"
,
tags
=
{
"IBZDictItem"
},
notes
=
"CheckKey"
)
@RequestMapping
(
method
=
RequestMethod
.
POST
,
value
=
"/dictapi/ibzdictitems/checkkey"
)
public
ResponseEntity
<
Boolean
>
checkKey
(
@RequestBody
IBZDictItemDTO
ibzdictitemdto
)
{
return
ResponseEntity
.
status
(
HttpStatus
.
OK
).
body
(
true
);
}
@ApiOperation
(
value
=
"Remove"
,
tags
=
{
"IBZDictItem"
},
notes
=
"Remove"
)
@RequestMapping
(
method
=
RequestMethod
.
DELETE
,
value
=
"/dictapi/ibzdictitems/{ibzdictitem_id}"
)
@Transactional
public
ResponseEntity
<
Boolean
>
remove
(
@PathVariable
(
"ibzdictitem_id"
)
String
ibzdictitem_id
)
{
IBZDictItemDTO
ibzdictitemdto
=
new
IBZDictItemDTO
();
IBZDictItem
domain
=
new
IBZDictItem
();
ibzdictitemdto
.
setItemId
(
ibzdictitem_id
);
domain
.
setItemId
(
ibzdictitem_id
);
Boolean
rst
=
ibzdictitemService
.
remove
(
domain
.
getItemId
());
if
(
rst
){
return
ResponseEntity
.
status
(
HttpStatus
.
OK
).
body
(
rst
);
}
else
{
return
ResponseEntity
.
status
(
HttpStatus
.
OK
).
body
(
rst
);
}
}
@ApiOperation
(
value
=
"Create"
,
tags
=
{
"IBZDictItem"
},
notes
=
"Create"
)
@RequestMapping
(
method
=
RequestMethod
.
POST
,
value
=
"/dictapi/ibzdictitems"
)
@Transactional
public
ResponseEntity
<
IBZDictItemDTO
>
create
(
@RequestBody
IBZDictItemDTO
ibzdictitemdto
)
{
IBZDictItem
domain
=
IBZDictItemMapping
.
MAPPER
.
toDomain
(
ibzdictitemdto
);
ibzdictitemService
.
create
(
domain
);
IBZDictItemDTO
dto
=
IBZDictItemMapping
.
MAPPER
.
toDto
(
domain
);
return
ResponseEntity
.
status
(
HttpStatus
.
OK
).
body
(
dto
);
}
@ApiOperation
(
value
=
"Update"
,
tags
=
{
"IBZDictItem"
},
notes
=
"Update"
)
@RequestMapping
(
method
=
RequestMethod
.
PUT
,
value
=
"/dictapi/ibzdictitems/{ibzdictitem_id}"
)
@Transactional
public
ResponseEntity
<
IBZDictItemDTO
>
update
(
@PathVariable
(
"ibzdictitem_id"
)
String
ibzdictitem_id
,
@RequestBody
IBZDictItemDTO
ibzdictitemdto
)
{
IBZDictItem
domain
=
IBZDictItemMapping
.
MAPPER
.
toDomain
(
ibzdictitemdto
);
domain
.
setItemId
(
ibzdictitem_id
);
ibzdictitemService
.
update
(
domain
);
IBZDictItemDTO
dto
=
IBZDictItemMapping
.
MAPPER
.
toDto
(
domain
);
return
ResponseEntity
.
status
(
HttpStatus
.
OK
).
body
(
dto
);
}
//9
@ApiOperation
(
value
=
"获取DEFAULT"
,
tags
=
{
"IBZDictItem"
}
,
notes
=
"获取DEFAULT"
)
@RequestMapping
(
method
=
RequestMethod
.
GET
,
value
=
"/dictapi/ibzdictitems/fetchdefault"
)
public
ResponseEntity
<
List
<
IBZDictItemDTO
>>
fetchDefault
(
IBZDictItemSearchContext
context
)
{
List
<
IBZDictItemDTO
>
list
=
new
ArrayList
<
IBZDictItemDTO
>();
Page
<
IBZDictItem
>
domains
=
ibzdictitemService
.
searchDefault
(
context
)
;
for
(
IBZDictItem
ibzdictitem
:
domains
.
getContent
()){
IBZDictItemDTO
dto
=
IBZDictItemMapping
.
MAPPER
.
toDto
(
ibzdictitem
);
list
.
add
(
dto
);
}
return
ResponseEntity
.
status
(
HttpStatus
.
OK
)
.
header
(
"x-page"
,
String
.
valueOf
(
context
.
getPageable
().
getPageNumber
()))
.
header
(
"x-per-page"
,
String
.
valueOf
(
context
.
getPageable
().
getPageSize
()))
.
header
(
"x-total"
,
String
.
valueOf
(
domains
.
getTotalElements
()))
.
body
(
list
);
}
@ApiOperation
(
value
=
"Get"
,
tags
=
{
"IBZDictItem"
},
notes
=
"Get"
)
@RequestMapping
(
method
=
RequestMethod
.
GET
,
value
=
"/dictapi/ibzdicts/{ibzdict_id}/ibzdictitems/{ibzdictitem_id}"
)
public
ResponseEntity
<
IBZDictItemDTO
>
getByIBZDict
(
@PathVariable
(
"ibzdict_id"
)
String
ibzdict_id
,
@PathVariable
(
"ibzdictitem_id"
)
String
ibzdictitem_id
)
{
IBZDictItem
domain
=
ibzdictitemService
.
get
(
ibzdictitem_id
);
IBZDictItemDTO
dto
=
IBZDictItemMapping
.
MAPPER
.
toDto
(
domain
);
return
ResponseEntity
.
status
(
HttpStatus
.
OK
).
body
(
dto
);
}
@ApiOperation
(
value
=
"GetDraft"
,
tags
=
{
"IBZDictItem"
},
notes
=
"GetDraft"
)
@RequestMapping
(
method
=
RequestMethod
.
GET
,
value
=
"/dictapi/ibzdicts/{ibzdict_id}/ibzdictitems/{ibzdictitemitemid}/getdraft"
)
@Transactional
public
ResponseEntity
<
IBZDictItemDTO
>
getDraftByIBZDict
(
@PathVariable
(
"ibzdict_id"
)
String
ibzdict_id
,
@PathVariable
(
"ibzdictitem_id"
)
String
ibzdictitem_id
,
@RequestBody
IBZDictItemDTO
ibzdictitemdto
)
{
//8
IBZDictItem
ibzdictitem
=
IBZDictItemMapping
.
MAPPER
.
toDomain
(
ibzdictitemdto
);
ibzdictitem
=
ibzdictitemService
.
getDraft
(
ibzdictitem
)
;
ibzdictitemdto
=
IBZDictItemMapping
.
MAPPER
.
toDto
(
ibzdictitem
);
return
ResponseEntity
.
status
(
HttpStatus
.
OK
).
body
(
ibzdictitemdto
);
}
@ApiOperation
(
value
=
"Save"
,
tags
=
{
"IBZDictItem"
},
notes
=
"Save"
)
@RequestMapping
(
method
=
RequestMethod
.
POST
,
value
=
"/dictapi/ibzdicts/{ibzdict_id}/ibzdictitems/save"
)
public
ResponseEntity
<
Boolean
>
saveByIBZDict
(
@PathVariable
(
"ibzdict_id"
)
String
ibzdict_id
,
@RequestBody
IBZDictItemDTO
ibzdictitemdto
)
{
//6
IBZDictItem
domain
=
IBZDictItemMapping
.
MAPPER
.
toDomain
(
ibzdictitemdto
);
domain
.
setDictId
(
ibzdict_id
);
Boolean
b
=
ibzdictitemService
.
save
(
domain
)
;
return
ResponseEntity
.
status
(
HttpStatus
.
OK
).
body
(
b
);
}
@ApiOperation
(
value
=
"CheckKey"
,
tags
=
{
"IBZDictItem"
},
notes
=
"CheckKey"
)
@RequestMapping
(
method
=
RequestMethod
.
POST
,
value
=
"/dictapi/ibzdicts/{ibzdict_id}/ibzdictitems/checkkey"
)
public
ResponseEntity
<
Boolean
>
checkKeyByIBZDict
(
@PathVariable
(
"ibzdict_id"
)
String
ibzdict_id
,
@RequestBody
IBZDictItemDTO
ibzdictitemdto
)
{
return
ResponseEntity
.
status
(
HttpStatus
.
OK
).
body
(
true
);
}
@ApiOperation
(
value
=
"Remove"
,
tags
=
{
"IBZDictItem"
},
notes
=
"Remove"
)
@RequestMapping
(
method
=
RequestMethod
.
DELETE
,
value
=
"/dictapi/ibzdicts/{ibzdict_id}/ibzdictitems/{ibzdictitem_id}"
)
@Transactional
public
ResponseEntity
<
Boolean
>
removeByIBZDict
(
@PathVariable
(
"ibzdict_id"
)
String
ibzdict_id
,
@PathVariable
(
"ibzdictitem_id"
)
String
ibzdictitem_id
)
{
IBZDictItem
domain
=
new
IBZDictItem
();
domain
.
setItemId
(
ibzdictitem_id
);
Boolean
rst
=
ibzdictitemService
.
remove
(
domain
.
getItemId
());
if
(
rst
){
return
ResponseEntity
.
status
(
HttpStatus
.
OK
).
body
(
rst
);
}
else
{
return
ResponseEntity
.
status
(
HttpStatus
.
OK
).
body
(
rst
);
}
}
@ApiOperation
(
value
=
"Create"
,
tags
=
{
"IBZDictItem"
},
notes
=
"Create"
)
@RequestMapping
(
method
=
RequestMethod
.
POST
,
value
=
"/dictapi/ibzdicts/{ibzdict_id}/ibzdictitems"
)
@Transactional
public
ResponseEntity
<
IBZDictItemDTO
>
createByIBZDict
(
@PathVariable
(
"ibzdict_id"
)
String
ibzdict_id
,
@RequestBody
IBZDictItemDTO
ibzdictitemdto
)
{
//4
IBZDictItem
domain
=
IBZDictItemMapping
.
MAPPER
.
toDomain
(
ibzdictitemdto
);
domain
.
setDictId
(
ibzdict_id
);
ibzdictitemService
.
create
(
domain
);
IBZDictItemDTO
dto
=
IBZDictItemMapping
.
MAPPER
.
toDto
(
domain
);
return
ResponseEntity
.
status
(
HttpStatus
.
OK
).
body
(
dto
);
}
@ApiOperation
(
value
=
"Update"
,
tags
=
{
"IBZDictItem"
},
notes
=
"Update"
)
@RequestMapping
(
method
=
RequestMethod
.
PUT
,
value
=
"/dictapi/ibzdicts/{ibzdict_id}/ibzdictitems/{ibzdictitem_id}"
)
@Transactional
public
ResponseEntity
<
IBZDictItemDTO
>
updateByIBZDict
(
@PathVariable
(
"ibzdict_id"
)
String
ibzdict_id
,
@PathVariable
(
"ibzdictitem_id"
)
String
ibzdictitem_id
,
@RequestBody
IBZDictItemDTO
ibzdictitemdto
)
{
//5
IBZDictItem
domain
=
IBZDictItemMapping
.
MAPPER
.
toDomain
(
ibzdictitemdto
);
domain
.
setDictId
(
ibzdict_id
);
domain
.
setItemId
(
ibzdictitem_id
);
ibzdictitemService
.
update
(
domain
);
IBZDictItemDTO
dto
=
IBZDictItemMapping
.
MAPPER
.
toDto
(
domain
);
return
ResponseEntity
.
status
(
HttpStatus
.
OK
).
body
(
dto
);
}
//10
@ApiOperation
(
value
=
"获取DEFAULT"
,
tags
=
{
"IBZDictItem"
}
,
notes
=
"获取DEFAULT"
)
@RequestMapping
(
method
=
RequestMethod
.
GET
,
value
=
"/dictapi/ibzdicts/{ibzdict_id}/ibzdictitems/fetchdefault"
)
public
ResponseEntity
<
Page
<
IBZDictItemDTO
>>
fetchIBZDictItemDefault
(
@PathVariable
(
"ibzdict_id"
)
String
ibzdict_id
,
IBZDictItemSearchContext
context
,
Pageable
pageable
,
ServletRequest
request
)
{
context
.
setPageable
(
pageable
);
List
<
IBZDictItemDTO
>
list
=
new
ArrayList
<
IBZDictItemDTO
>();
context
.
setN_dictid_eq
(
ibzdict_id
);
Page
<
IBZDictItem
>
domains
=
ibzdictitemService
.
searchDefault
(
context
)
;
for
(
IBZDictItem
ibzdictitem
:
domains
.
getContent
()){
IBZDictItemDTO
dto
=
IBZDictItemMapping
.
MAPPER
.
toDto
(
ibzdictitem
);
list
.
add
(
dto
);
}
return
ResponseEntity
.
status
(
HttpStatus
.
OK
).
body
(
new
PageImpl
(
list
,
context
.
getPageable
(),
domains
.
getTotalElements
()));
}
}
编辑
预览
Markdown
格式
0%
请重试
or
添加新附件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
先完成此消息的编辑!
取消
想要评论请
注册
或
登录