Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
提交反馈
为 GitLab 提交贡献
登录
切换导航
iBiz4j Spring R7
项目
项目
详情
动态
版本
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
iBiz-R7后台标准模板
iBiz4j Spring R7
提交
ba01328a
提交
ba01328a
编写于
5月 29, 2020
作者:
sq3536
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
ibzconfig 介入
上级
76a6b9b3
变更
4
隐藏空白字符变更
内嵌
并排
正在显示
4 个修改的文件
包含
176 行增加
和
3 行删除
+176
-3
IBZConfig.java.ftl
...rc/main/java/%SYS_PKGPATH%/util/domain/IBZConfig.java.ftl
+81
-0
IBZConfigMapper.java.ftl
...n/java/%SYS_PKGPATH%/util/mapper/IBZConfigMapper.java.ftl
+11
-0
AppController.java.ftl
.../main/java/%SYS_PKGPATH%/util/rest/AppController.java.ftl
+23
-3
IBZConfigService.java.ftl
...java/%SYS_PKGPATH%/util/service/IBZConfigService.java.ftl
+61
-0
未找到文件。
SLN/%PUBPRJ%-util/src/main/java/%SYS_PKGPATH%/util/domain/IBZConfig.java.ftl
0 → 100644
浏览文件 @
ba01328a
<#
ibiztemplate
>
TARGET
=
PSSYSTEM
</#
ibiztemplate
>
package
${
pub
.
getPKGCodeName
()}.
util
.
domain
;
import
${
pub
.
getPKGCodeName
()}.
util
.
helper
.
DataObject
;
import
com
.
alibaba
.
fastjson
.
annotation
.
JSONField
;
import
com
.
baomidou
.
mybatisplus
.
annotation
.
TableId
;
import
com
.
baomidou
.
mybatisplus
.
annotation
.
TableName
;
import
com
.
fasterxml
.
jackson
.
annotation
.
JsonFormat
;
import
com
.
fasterxml
.
jackson
.
annotation
.
JsonIgnoreProperties
;
import
lombok
.*;
import
org
.
springframework
.
util
.
DigestUtils
;
import
org
.
springframework
.
util
.
StringUtils
;
import
java
.
sql
.
Timestamp
;
@
TableName
(
value
=
"IBZCFG"
)
@
JsonIgnoreProperties
(
ignoreUnknown
=
true
)
@
Getter
@
Setter
@
Builder
@
AllArgsConstructor
@
NoArgsConstructor
public
class
IBZConfig
{
/**
*
配置标识
*
系统
+
配置类型
+
引用对象
+
用户标识联合主键
*/
@
TableId
private
String
cfgId
;
/**
*
系统标识
*/
private
String
systemId
;
/**
*
配置类型
*
门户配置
/
表格自定义配置
/
自定义查询
...
消费方自定义
*/
private
String
cfgType
;
/**
*
引用对象
*
门户页标识
/
具体表格视图标识
...
消费方具体使用位置的标识
*/
private
String
targetType
;
/**
*
用户标识
*
默认当前登录者
*/
private
String
userId
;
/**
*
配置
*
JSONObject
*/
private
String
cfg
;
@
JsonFormat
(
pattern
=
"yyyy-MM-dd HH:mm:ss"
,
locale
=
"zh"
,
timezone
=
"GMT+8"
)
@
JSONField
(
format
=
"yyyy-MM-dd HH:mm:ss"
)
private
Timestamp
updateDate
;
public
String
getCfgId
()
{
if
(
StringUtils
.
isEmpty
(
cfgId
)&&
(
!(StringUtils.isEmpty(systemId)))&&
(
!(StringUtils.isEmpty(cfgType)))&&
(
!(StringUtils.isEmpty(targetType)))&&
(
!(StringUtils.isEmpty(userId))))
{
cfgId
=
DigestUtils
.
md5DigestAsHex
((
systemId
+
"||"
+
cfgType
+
"||"
+
targetType
+
"||"
+
userId
).
getBytes
());
}
return
cfgId
;
}
}
SLN/%PUBPRJ%-util/src/main/java/%SYS_PKGPATH%/util/mapper/IBZConfigMapper.java.ftl
0 → 100644
浏览文件 @
ba01328a
<#
ibiztemplate
>
TARGET
=
PSSYSTEM
</#
ibiztemplate
>
package
${
pub
.
getPKGCodeName
()}.
util
.
mapper
;
import
${
pub
.
getPKGCodeName
()}.
util
.
domain
.
IBZConfig
;
import
com
.
baomidou
.
mybatisplus
.
core
.
mapper
.
BaseMapper
;
public
interface
IBZConfigMapper
extends
BaseMapper
<
IBZConfig
>{
}
\ No newline at end of file
SLN/%PUBPRJ%-util/src/main/java/%SYS_PKGPATH%/util/rest/AppController.java.ftl
浏览文件 @
ba01328a
...
@@ -3,6 +3,8 @@ TARGET=PSSYSTEM
...
@@ -3,6 +3,8 @@ TARGET=PSSYSTEM
</#
ibiztemplate
>
</#
ibiztemplate
>
package
${
pub
.
getPKGCodeName
()}.
util
.
rest
;
package
${
pub
.
getPKGCodeName
()}.
util
.
rest
;
import
${
pub
.
getPKGCodeName
()}.
util
.
errors
.
BadRequestAlertException
;
import
${
pub
.
getPKGCodeName
()}.
util
.
service
.
IBZConfigService
;
import
com
.
alibaba
.
fastjson
.
JSONObject
;
import
com
.
alibaba
.
fastjson
.
JSONObject
;
import
${
pub
.
getPKGCodeName
()}.
util
.
security
.
AuthenticationUser
;
import
${
pub
.
getPKGCodeName
()}.
util
.
security
.
AuthenticationUser
;
import
${
pub
.
getPKGCodeName
()}.
util
.
service
.
AuthenticationUserService
;
import
${
pub
.
getPKGCodeName
()}.
util
.
service
.
AuthenticationUserService
;
...
@@ -11,9 +13,8 @@ import org.springframework.beans.factory.annotation.Value;
...
@@ -11,9 +13,8 @@ import org.springframework.beans.factory.annotation.Value;
import
org
.
springframework
.
http
.
HttpStatus
;
import
org
.
springframework
.
http
.
HttpStatus
;
import
org
.
springframework
.
http
.
ResponseEntity
;
import
org
.
springframework
.
http
.
ResponseEntity
;
import
org
.
springframework
.
security
.
core
.
GrantedAuthority
;
import
org
.
springframework
.
security
.
core
.
GrantedAuthority
;
import
org
.
springframework
.
web
.
bind
.
annotation
.
RequestMapping
;
import
org
.
springframework
.
util
.
StringUtils
;
import
org
.
springframework
.
web
.
bind
.
annotation
.
RequestMethod
;
import
org
.
springframework
.
web
.
bind
.
annotation
.*;
import
org
.
springframework
.
web
.
bind
.
annotation
.
RestController
;
import
java
.
util
.
Collection
;
import
java
.
util
.
Collection
;
import
java
.
util
.
HashSet
;
import
java
.
util
.
HashSet
;
import
java
.
util
.
Iterator
;
import
java
.
util
.
Iterator
;
...
@@ -64,4 +65,23 @@ public class AppController {
...
@@ -64,4 +65,23 @@ public class AppController {
userDetailsService
.
resetByUsername
(
AuthenticationUser
.
getAuthenticationUser
().
getUsername
());
userDetailsService
.
resetByUsername
(
AuthenticationUser
.
getAuthenticationUser
().
getUsername
());
}
}
}
}
@
Autowired
private
IBZConfigService
ibzConfigService
;
@
RequestMapping
(
method
=
RequestMethod
.
PUT
,
value
=
"/configs/{configType}/{targetType}"
)
public
ResponseEntity
<
Boolean
>
saveConfig
(@
PathVariable
(
"configType"
)
String
configType
,
@
PathVariable
(
"targetType"
)
String
targetType
,
@
RequestBody
JSONObject
config
)
{
String
userId
=
AuthenticationUser
.
getAuthenticationUser
().
getUserid
();
if
(
StringUtils
.
isEmpty
(
userId
))
throw
new
BadRequestAlertException
(
"保存配置失败,参数缺失"
,
"IBZConfig"
,
configType
);
return
ResponseEntity
.
ok
(
ibzConfigService
.
saveConfig
(
configType
,
targetType
,
userId
,
config
));
}
@
RequestMapping
(
method
=
RequestMethod
.
GET
,
value
=
"/configs/{configType}/{targetType}"
)
public
ResponseEntity
<
JSONObject
>
getConfig
(@
PathVariable
(
"configType"
)
String
configType
,
@
PathVariable
(
"targetType"
)
String
targetType
)
{
String
userId
=
AuthenticationUser
.
getAuthenticationUser
().
getUserid
();
if
(
StringUtils
.
isEmpty
(
userId
))
throw
new
BadRequestAlertException
(
"获取配置失败,参数缺失"
,
"IBZConfig"
,
configType
);
return
ResponseEntity
.
ok
(
ibzConfigService
.
getConfig
(
configType
,
targetType
,
userId
));
}
}
}
SLN/%PUBPRJ%-util/src/main/java/%SYS_PKGPATH%/util/service/IBZConfigService.java.ftl
0 → 100644
浏览文件 @
ba01328a
<#
ibiztemplate
>
TARGET
=
PSSYSTEM
</#
ibiztemplate
>
package
${
pub
.
getPKGCodeName
()}.
util
.
service
;
import
${
pub
.
getPKGCodeName
()}.
util
.
domain
.
IBZConfig
;
import
${
pub
.
getPKGCodeName
()}.
util
.
errors
.
BadRequestAlertException
;
import
${
pub
.
getPKGCodeName
()}.
util
.
helper
.
DataObject
;
import
${
pub
.
getPKGCodeName
()}.
util
.
mapper
.
IBZConfigMapper
;
import
com
.
alibaba
.
fastjson
.
JSON
;
import
com
.
alibaba
.
fastjson
.
JSONObject
;
import
com
.
baomidou
.
mybatisplus
.
core
.
toolkit
.
Wrappers
;
import
com
.
baomidou
.
mybatisplus
.
extension
.
service
.
IService
;
import
com
.
baomidou
.
mybatisplus
.
extension
.
service
.
impl
.
ServiceImpl
;
import
lombok
.
extern
.
slf4j
.
Slf4j
;
import
org
.
springframework
.
beans
.
factory
.
annotation
.
Value
;
import
org
.
springframework
.
cache
.
annotation
.
CacheEvict
;
import
org
.
springframework
.
cache
.
annotation
.
Cacheable
;
import
org
.
springframework
.
stereotype
.
Service
;
import
org
.
springframework
.
util
.
StringUtils
;
@
Slf4j
@
Service
public
class
IBZConfigService
extends
ServiceImpl
<
IBZConfigMapper
,
IBZConfig
>
implements
IService
<
IBZConfig
>
{
@
Value
(
"${r'${'}ibiz.systemid:${sys.getName()}}"
)
private
String
systemId
;
@
Cacheable
(
value
=
"ibzou_configs"
,
key
=
"'cfgid:'+#p0+'||'+#p1+'||'+#p2"
)
public
JSONObject
getConfig
(
String
cfgType
,
String
targetType
,
String
userId
)
{
if
(
StringUtils
.
isEmpty
(
userId
)||
StringUtils
.
isEmpty
(
cfgType
)||
StringUtils
.
isEmpty
(
targetType
))
throw
new
BadRequestAlertException
(
"获取配置失败,参数缺失"
,
"IBZConfig"
,
cfgType
);
IBZConfig
config
=
this
.
getOne
(
Wrappers
.
query
(
IBZConfig
.
builder
().
systemId
(
systemId
).
cfgType
(
cfgType
).
targetType
(
targetType
).
userId
(
userId
).
build
()),
false
);
if
(
config
==
null
)
return
new
JSONObject
();
else
return
JSON
.
parseObject
(
config
.
getCfg
());
}
@
CacheEvict
(
value
=
"ibzou_configs"
,
key
=
"'cfgid:'+#p0+'||'+#p1+'||'+#p2"
)
public
boolean
saveConfig
(
String
cfgType
,
String
targetType
,
String
userId
,
JSONObject
config
)
{
if
(
StringUtils
.
isEmpty
(
userId
)||
StringUtils
.
isEmpty
(
cfgType
)||
StringUtils
.
isEmpty
(
targetType
))
throw
new
BadRequestAlertException
(
"保存配置失败,参数缺失"
,
"IBZConfig"
,
cfgType
);
String
cfg
=
"{}"
;
if
(
config
!=null)
cfg
=
JSONObject
.
toJSONString
(
config
);
return
this
.
saveOrUpdate
(
IBZConfig
.
builder
().
systemId
(
systemId
).
cfgType
(
cfgType
).
targetType
(
targetType
).
userId
(
userId
).
cfg
(
cfg
).
updateDate
(
DataObject
.
getNow
()).
build
());
}
@
CacheEvict
(
value
=
"ibzou_configs"
,
key
=
"'cfgid:'+#p0+'||'+#p1+'||'+#p2"
)
public
void
resetConfig
(
String
cfgType
,
String
targetType
,
String
userId
)
{
if
(
StringUtils
.
isEmpty
(
userId
)||
StringUtils
.
isEmpty
(
cfgType
)||
StringUtils
.
isEmpty
(
targetType
))
throw
new
BadRequestAlertException
(
"重置配置失败,参数缺失"
,
"IBZConfig"
,
cfgType
);
this
.
remove
(
Wrappers
.
query
(
IBZConfig
.
builder
().
systemId
(
systemId
).
cfgType
(
cfgType
).
targetType
(
targetType
).
userId
(
userId
).
build
()));
}
}
\ No newline at end of file
编辑
预览
Markdown
格式
0%
请重试
or
添加新附件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
先完成此消息的编辑!
取消
想要评论请
注册
或
登录