Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
提交反馈
为 GitLab 提交贡献
登录
切换导航
iBiz4j Spring R7
项目
项目
详情
动态
版本
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
iBiz-R7后台标准模板
iBiz4j Spring R7
提交
e0c93bb0
提交
e0c93bb0
编写于
10月 17, 2020
作者:
zhouweidong
浏览文件
操作
浏览文件
下载
差异文件
合并分支 'dev' 到 '2020.08.10【669】'
Dev 查看合并请求
!32
上级
55724b4b
cec882b5
变更
17
隐藏空白字符变更
内嵌
并排
正在显示
17 个修改的文件
包含
602 行增加
和
42 行删除
+602
-42
CHANGELOG.md
CHANGELOG.md
+7
-0
%DE%.java.ftl
...ava/%SYS_PKGPATH%/core/%MOD_PKGPATH%/domain/%DE%.java.ftl
+9
-2
%DE%SearchContext.java.ftl
...ATH%/core/%MOD_PKGPATH%/filter/%DE%SearchContext.java.ftl
+37
-0
%DE%ESMapping.java.ftl
...KGPATH%/core/%MOD_PKGPATH%/mapping/%DE%ESMapping.java.ftl
+26
-0
%DE%ServiceImpl.java.ftl
.../core/%MOD_PKGPATH%/service/impl/%DE%ServiceImpl.java.ftl
+35
-0
%DE%ESRepository.java.ftl
.../java/%SYS_PKGPATH%/core/es/dao/%DE%ESRepository.java.ftl
+24
-0
%DE%.java.ftl
.../src/main/java/%SYS_PKGPATH%/core/es/domain/%DE%.java.ftl
+53
-0
I%DE%ESService.java.ftl
...ava/%SYS_PKGPATH%/core/es/service/I%DE%ESService.java.ftl
+51
-0
%DE%ESServiceImpl.java.ftl
..._PKGPATH%/core/es/service/impl/%DE%ESServiceImpl.java.ftl
+113
-0
pom.xml.ftl
SLN/%PUBPRJ%-dependencies/pom.xml.ftl
+13
-0
%ITEM%Resource.java.ftl
...YS_PKGPATH%/%SYSAPI_PKGPATH%/rest/%ITEM%Resource.java.ftl
+37
-0
AuditAspect.java.ftl
.../main/java/%SYS_PKGPATH%/util/aspect/AuditAspect.java.ftl
+44
-33
ESAspect.java.ftl
...src/main/java/%SYS_PKGPATH%/util/aspect/ESAspect.java.ftl
+114
-0
LayeringCache.java.ftl
...ava/%SYS_PKGPATH%/util/cache/cache/LayeringCache.java.ftl
+10
-4
SearchContextBase.java.ftl
...java/%SYS_PKGPATH%/util/filter/SearchContextBase.java.ftl
+16
-1
SimpleFileService.java.ftl
...ava/%SYS_PKGPATH%/util/service/SimpleFileService.java.ftl
+1
-1
application-sys.yml.ftl
SLN/%PUBPRJ%-util/src/main/resources/application-sys.yml.ftl
+12
-1
未找到文件。
CHANGELOG.md
浏览文件 @
e0c93bb0
# **iBiz4j Spring R7 Template ChangeLog**
## [v2020.10.17]
-
支持es查询加速:开启查询加速的实体,在完成标准实体存储之外,还会将一份数据存入es中,用于后续在es中进行检索。
-
兼容虚拟主键、多个联合键值属性类型不统一的问题。
-
补充联合主键中出现时间类型属性处理(时间类型属性默认按照yyyyMMddHHmmss格式处理)。
-
修复程序异常时,L1缓存值为空的问题。
## [v2020.09.22]
-
处理逻辑:支持处理逻辑中启动工作流
...
...
SLN/%PUBPRJ%-core/src/main/java/%SYS_PKGPATH%/core/%MOD_PKGPATH%/domain/%DE%.java.ftl
浏览文件 @
e0c93bb0
...
...
@@ -22,6 +22,7 @@ import ${pub.getPKGCodeName()}.util.domain.EntityBase;
import
${
pub
.
getPKGCodeName
()}.
util
.
annotation
.
DEField
;
import
${
pub
.
getPKGCodeName
()}.
util
.
enums
.
DEPredefinedFieldType
;
import
${
pub
.
getPKGCodeName
()}.
util
.
enums
.
DEFieldDefaultValueType
;
import
${
pub
.
getPKGCodeName
()}.
util
.
helper
.
DataObject
;
import
java
.
io
.
Serializable
;
import
lombok
.*;
import
org
.
springframework
.
data
.
annotation
.
Transient
;
...
...
@@ -313,7 +314,7 @@ public class ${item.getCodeName()} extends EntityMP implements Serializable {
<#
list
item
.
getUnionKeyValuePSDEFields
()
as
defield
>
<#
assign
unionKeyPrivateCodeName
=
srfcaseformat
(
defield
.
getCodeName
(),
'l_u2lC'
)
>
<#
assign
unionKeyPublicCodeName
=
unionKeyPrivateCodeName
?
cap_first
>
this
.
set
${
unionKeyPublicCodeName
}(
args
[${
defield_index
}]);
this
.
set
(
"${unionKeyPrivateCodeName}"
,
args
[${
defield_index
}]);
</#
list
>
}
}
...
...
@@ -942,13 +943,19 @@ public class ${item.getCodeName()} extends EntityBase implements Serializable {
<#
assign
formatKey
=
""
>
<#
assign
formatValue
=
""
>
<#
list
item
.
getUnionKeyValuePSDEFields
()
as
defield
>
<#
assign
dataType
=
(
defield
.
getDataType
())
!"">
<#
assign
unionKeyPrivateCodeName
=
srfcaseformat
(
defield
.
getCodeName
(),
'l_u2lC'
)
>
<#
assign
unionKeyPublicCodeName
=
unionKeyPrivateCodeName
?
cap_first
>
<#
assign
formatKey
=
formatKey
+
"%s"
>
<#
if
defield_has_next
>
<#
assign
formatKey
=
formatKey
+
"||"
>
</#
if
>
<#
assign
formatValue
=
formatValue
+
"this.get"
+
unionKeyPublicCodeName
+
"()"
>
<#
comment
>
补充联合键值中出现时间类型属性的处理
</#
comment
>
<#
if
dataType
==
"DATETIME"
||
dataType
==
"DATE"
||
dataType
==
"TIME"
>
<#
assign
formatValue
=
formatValue
+
"DataObject.datetimeFormat.format(this.get"
+
unionKeyPublicCodeName
+
"())"
>
<#
else
>
<#
assign
formatValue
=
formatValue
+
"this.get"
+
unionKeyPublicCodeName
+
"()"
>
</#
if
>
<#
if
defield_has_next
>
<#
assign
formatValue
=
formatValue
+
","
>
</#
if
>
...
...
SLN/%PUBPRJ%-core/src/main/java/%SYS_PKGPATH%/core/%MOD_PKGPATH%/filter/%DE%SearchContext.java.ftl
浏览文件 @
e0c93bb0
...
...
@@ -18,6 +18,9 @@ import com.alibaba.fastjson.annotation.JSONField;
import
org
.
springframework
.
util
.
ObjectUtils
;
import
org
.
springframework
.
util
.
StringUtils
;
<#
if
de
.
getUserTag
()??
&&
de
.
getUserTag
()==
'elasticsearch'
>
import
org
.
elasticsearch
.
index
.
query
.
QueryBuilders
;
</#
if
>
<#
comment
>
SQL
存储
-
Mybatis
</#
comment
>
<#
if
de
.
getStorageMode
()==
1
>
...
...
@@ -91,6 +94,8 @@ public class ${item.codeName}SearchContext extends QueryWrapperContext<${item.co
<#
assign
valueSeparator
=
getInCondSeparator
(
formitem
)>
this
.
getSearchCond
().
notIn
(
"${formitem.getPSDEField().getName()?lower_case}"
,
this
.${
formitem
.
getName
()?
lower_case
}.
split
(
"${valueSeparator}"
));
</#
if
>
<#
comment
>
构造
es
查询条件
</#
comment
>
<@
esqueryCond
formitem
/>
}
}
</#
if
>
...
...
@@ -203,6 +208,8 @@ public class ${item.codeName}SearchContext extends QueryBuildContext {
<#
assign
valueSeparator
=
getInCondSeparator
(
formitem
)>
this
.
getSearchCond
().
and
(
"${formitem.getPSDEField().getName()?lower_case}"
).
notIn
(
this
.${
formitem
.
getName
()?
lower_case
}.
split
(
"${valueSeparator}"
)));
</#
if
>
<#
comment
>
构造
es
查询条件
</#
comment
>
<@
esqueryCond
formitem
/>
}
}
</#
if
>
...
...
@@ -319,4 +326,34 @@ public class ${item.codeName}SearchContext extends SearchContextBase {
<#
return
valueSeparator
/>
</#
function
>
<#
comment
>
构造
es
查询条件
</#
comment
>
<#
macro
esqueryCond
formitem
>
<#
if
de
.
getUserTag
()??
&&
de
.
getUserTag
()==
'elasticsearch'
>
<#
if
formitem
.
getValueOp
()
==
"LIKE"
>
this
.
getEsCond
().
must
(
QueryBuilders
.
wildcardQuery
(
"${formitem.getPSDEField().getName()?lower_case}"
,
String
.
format
(
"*%s*"
,${
formitem
.
getName
()?
lower_case
})));
<#
elseif
formitem
.
getValueOp
()
==
"LEFTLIKE"
>
this
.
getEsCond
().
must
(
QueryBuilders
.
wildcardQuery
(
"${formitem.getPSDEField().getName()?lower_case}"
,
String
.
format
(
"%s*"
,${
formitem
.
getName
()?
lower_case
})));
<#
elseif
formitem
.
getValueOp
()
==
"RIGHTLIKE"
>
this
.
getEsCond
().
must
(
QueryBuilders
.
wildcardQuery
(
"${formitem.getPSDEField().getName()?lower_case}"
,
String
.
format
(
"*%s"
,${
formitem
.
getName
()?
lower_case
})));
<#
elseif
formitem
.
getValueOp
()
==
"EQ"
>
this
.
getEsCond
().
must
(
QueryBuilders
.
termQuery
(
"${formitem.getPSDEField().getName()?lower_case}"
,
${
formitem
.
getName
()?
lower_case
}));
<#
elseif
formitem
.
getValueOp
()
==
"NOTEQ"
>
this
.
getEsCond
().
mustNot
(
QueryBuilders
.
termQuery
(
"${formitem.getPSDEField().getName()?lower_case}"
,
${
formitem
.
getName
()?
lower_case
}));
<#
elseif
formitem
.
getValueOp
()
==
"GT"
>
this
.
getEsCond
().
must
(
QueryBuilders
.
rangeQuery
(
"${formitem.getPSDEField().getName()?lower_case}"
).
gt
(${
formitem
.
getName
()?
lower_case
}));
<#
elseif
formitem
.
getValueOp
()
==
"GTANDEQ"
>
this
.
getEsCond
().
must
(
QueryBuilders
.
rangeQuery
(
"${formitem.getPSDEField().getName()?lower_case}"
).
gte
(${
formitem
.
getName
()?
lower_case
}));
<#
elseif
formitem
.
getValueOp
()
==
"LT"
>
this
.
getEsCond
().
must
(
QueryBuilders
.
rangeQuery
(
"${formitem.getPSDEField().getName()?lower_case}"
).
lt
(${
formitem
.
getName
()?
lower_case
}));
<#
elseif
formitem
.
getValueOp
()
==
"LTANDEQ"
>
this
.
getEsCond
().
must
(
QueryBuilders
.
rangeQuery
(
"${formitem.getPSDEField().getName()?lower_case}"
).
lte
(${
formitem
.
getName
()?
lower_case
}));
<#
elseif
formitem
.
getValueOp
()
==
"ISNOTNULL"
>
this
.
getEsCond
().
mustNot
(
QueryBuilders
.
existsQuery
(
"${formitem.getPSDEField().getName()?lower_case}"
));
<#
elseif
formitem
.
getValueOp
()
==
"ISNULL"
>
this
.
getEsCond
().
must
(
QueryBuilders
.
existsQuery
(
"${formitem.getPSDEField().getName()?lower_case}"
));
<#
elseif
formitem
.
getValueOp
()
==
"IN"
>
<#
elseif
formitem
.
getValueOp
()
==
"NOTIN"
>
</#
if
>
</#
if
>
</#
macro
>
SLN/%PUBPRJ%-core/src/main/java/%SYS_PKGPATH%/core/%MOD_PKGPATH%/mapping/%DE%ESMapping.java.ftl
0 → 100644
浏览文件 @
e0c93bb0
<#
ibiztemplate
>
TARGET
=
PSDATAENTITY
</#
ibiztemplate
>
<#
if
de
.
getUserTag
()??
&&
de
.
getUserTag
()==
'elasticsearch'
>
package
${
pub
.
getPKGCodeName
()}.
core
.${
de
.
getPSSystemModule
().
codeName
?
lower_case
}.
mapping
;
import
${
pub
.
getPKGCodeName
()}.
core
.${
de
.
getPSSystemModule
().
codeName
?
lower_case
}.
domain
.${
item
.
codeName
};
import
org
.
mapstruct
.
Mapper
;
import
org
.
mapstruct
.
NullValueCheckStrategy
;
import
org
.
mapstruct
.
NullValuePropertyMappingStrategy
;
import
java
.
util
.
List
;
@
Mapper
(
componentModel
=
"spring"
,
uses
=
{},
nullValuePropertyMappingStrategy
=
NullValuePropertyMappingStrategy
.
IGNORE
,
nullValueCheckStrategy
=
NullValueCheckStrategy
.
ALWAYS
)
public
interface
${
item
.
codeName
}
ESMapping
{
${
item
.
codeName
}
toDomain
(${
pub
.
getPKGCodeName
()}.
core
.
es
.
domain
.${
item
.
codeName
}
esEntity
);
${
pub
.
getPKGCodeName
()}.
core
.
es
.
domain
.${
item
.
codeName
}
toESDomain
(${
item
.
codeName
}
entity
);
List
<${
item
.
codeName
}>
toDomain
(
List
<${
pub
.
getPKGCodeName
()}.
core
.
es
.
domain
.${
item
.
codeName
}>
esEntityList
);
List
<${
pub
.
getPKGCodeName
()}.
core
.
es
.
domain
.${
item
.
codeName
}>
toESDomain
(
List
<${
item
.
codeName
}>
entityList
);
}
</#
if
>
SLN/%PUBPRJ%-core/src/main/java/%SYS_PKGPATH%/core/%MOD_PKGPATH%/service/impl/%DE%ServiceImpl.java.ftl
浏览文件 @
e0c93bb0
...
...
@@ -954,6 +954,9 @@ public class ${item.getCodeName()}ServiceImpl extends ServiceImpl<${de.getCodeNa
return
true
;
}
</#
if
>
<#
comment
>
发布
es
服务对象
</#
comment
>
<@
esAnno
/>
}
<#
comment
>
NOSQL
存储
</#
comment
>
...
...
@@ -1444,6 +1447,9 @@ public class ${item.getCodeName()}ServiceImpl implements I${de.getCodeName()}Ser
<#
comment
>
实体数据导入
</#
comment
>
<@
deImportData
/>
<#
comment
>
发布
es
服务对象
</#
comment
>
<@
esAnno
/>
}
...
...
@@ -2814,4 +2820,33 @@ public class ${item.getCodeName()}ServiceImpl implements I${de.getCodeName()}Ser
<#
return
unionKeyResult
>
</#
function
>
<#
comment
>
发布
es
对象
</#
comment
>
<#
macro
esAnno
>
<#
if
de
.
getUserTag
()??
&&
de
.
getUserTag
()==
'elasticsearch'
>
@
Autowired
@
Lazy
${
pub
.
getPKGCodeName
()}.
core
.
es
.
service
.
I
${
de
.
codeName
}
ESService
esService
;
@
Autowired
@
Lazy
${
pub
.
getPKGCodeName
()}.
core
.${
de
.
getPSSystemModule
().
codeName
?
lower_case
}.
mapping
.${
de
.
codeName
}
ESMapping
esMapping
;
/**
*
获取
es
service
*
@
return
*/
public
${
pub
.
getPKGCodeName
()}.
core
.
es
.
service
.
I
${
de
.
codeName
}
ESService
getESService
(){
return
esService
;
}
/**
*
获取
es
mapping
*
@
return
*/
public
${
pub
.
getPKGCodeName
()}.
core
.${
de
.
getPSSystemModule
().
codeName
?
lower_case
}.
mapping
.${
de
.
codeName
}
ESMapping
getESMapping
(){
return
esMapping
;
}
</#
if
>
</#
macro
>
</#
if
>
SLN/%PUBPRJ%-core/src/main/java/%SYS_PKGPATH%/core/es/dao/%DE%ESRepository.java.ftl
0 → 100644
浏览文件 @
e0c93bb0
<#
ibiztemplate
>
TARGET
=
PSDATAENTITY
</#
ibiztemplate
>
<#
if
de
.
getUserTag
()??
&&
de
.
getUserTag
()==
'elasticsearch'
>
package
${
pub
.
getPKGCodeName
()}.
core
.
es
.
dao
;
import
${
pub
.
getPKGCodeName
()}.
core
.
es
.
domain
.${
item
.
getCodeName
()};
import
org
.
springframework
.
data
.
elasticsearch
.
repository
.
ElasticsearchRepository
;
import
org
.
springframework
.
stereotype
.
Repository
;
/**
*
实体
[${
item
.
getLogicName
()}]
*/
@
Repository
public
interface
${
item
.
getCodeName
()}
ESRepository
extends
ElasticsearchRepository
<${
item
.
getCodeName
()},
String
>{
}
</#
if
>
SLN/%PUBPRJ%-core/src/main/java/%SYS_PKGPATH%/core/es/domain/%DE%.java.ftl
0 → 100644
浏览文件 @
e0c93bb0
<#
ibiztemplate
>
TARGET
=
PSDATAENTITY
</#
ibiztemplate
>
<#
if
de
.
getUserTag
()??
&&
de
.
getUserTag
()==
'elasticsearch'
>
package
${
pub
.
getPKGCodeName
()}.
core
.
es
.
domain
;
import
org
.
springframework
.
data
.
elasticsearch
.
annotations
.
Document
;
import
org
.
springframework
.
data
.
elasticsearch
.
annotations
.
Field
;
import
org
.
springframework
.
data
.
elasticsearch
.
annotations
.
FieldType
;
import
org
.
springframework
.
data
.
annotation
.
Id
;
import
java
.
io
.
Serializable
;
import
java
.
math
.
BigDecimal
;
import
java
.
sql
.
Timestamp
;
import
lombok
.
Data
;
@
Data
@
Document
(
indexName
=
"${sys.codeName?lower_case}"
,
type
=
"${item.codeName?lower_case}"
,
shards
=
5
,
replicas
=
1
)
public
class
${
item
.
codeName
}
implements
Serializable
{
private
static
final
long
serialVersionUID
=
1L
;
<#
if
de
.
getPSDEFields
()??>
<#
comment
>
输出实体属性
</#
comment
>
<#
list
de
.
getPSDEFields
()
as
defield
>
<#
if
defield
.
isPhisicalDEField
()==
true
>
<#
assign
privateCodeName
=
srfcaseformat
(
defield
.
getCodeName
(),
'l_u2lC'
)
>
<#
assign
javaType
=
srfr7javatype
(
defield
.
getStdDataType
())>
<#
assign
esType
=
"FieldType.Text"
>
<#
if
javaType
==
'Long'
>
<#
assign
esType
=
"FieldType.Long"
>
<#
elseif
javaType
==
'Integer'
>
<#
assign
esType
=
"FieldType.Integer"
>
<#
elseif
javaType
==
'Double'
||
javaType
==
'BigDecimal'
>
<#
assign
esType
=
"FieldType.Double"
>
<#
elseif
javaType
==
'Timestamp'
>
<#
assign
esType
=
"FieldType.Date"
>
</#
if
>
<#
if
defield
.
isKeyDEField
()==
true
>
@
Id
<#
else
>
@
Field
(
type
=
${
esType
})
</#
if
>
private
${
javaType
}
${
privateCodeName
};
</#
if
>
</#
list
>
</#
if
>
}
</#
if
>
SLN/%PUBPRJ%-core/src/main/java/%SYS_PKGPATH%/core/es/service/I%DE%ESService.java.ftl
0 → 100644
浏览文件 @
e0c93bb0
<#
ibiztemplate
>
TARGET
=
PSDATAENTITY
</#
ibiztemplate
>
<#
if
de
.
getUserTag
()??
&&
de
.
getUserTag
()==
'elasticsearch'
>
package
${
pub
.
getPKGCodeName
()}.
core
.
es
.
service
;
import
${
pub
.
getPKGCodeName
()}.
core
.
es
.
domain
.${
item
.
codeName
};
import
${
pub
.
getPKGCodeName
()}.
core
.${
de
.
getPSSystemModule
().
getCodeName
()?
lower_case
}.
filter
.${
item
.
codeName
}
SearchContext
;
import
org
.
springframework
.
data
.
domain
.
Page
;
import
java
.
util
.
Collection
;
import
java
.
util
.
List
;
/**
*
实体
[${
item
.
codeName
}]
服务对象接口
*/
public
interface
I
${
item
.
codeName
}
ESService
{
<@
addIDESerivceBody
/>
}
<#
macro
addIDESerivceBody
>
<#
comment
>
实体接口主体内容
</#
comment
>
<#
assign
keyfield
=
item
.
getKeyPSDEField
()>
<#
if
item
.
getAllPSDEActions
()??>
<#
list
item
.
getAllPSDEActions
()
as
deaction
>
<#
if
deaction
.
isEnableBackend
()>
<#
if
deaction
.
codeName
?
lower_case
==
'get'
>
${
item
.
codeName
}
get
(${
srfr7javatype
(
keyfield
.
stdDataType
)}
key
)
;
<#
elseif
deaction
.
codeName
?
lower_case
==
"create"
>
boolean
create
(${
item
.
codeName
}
et
)
;
void
createBatch
(
List
<${
item
.
codeName
}>
list
)
;
<#
elseif
deaction
.
codeName
?
lower_case
==
"update"
>
boolean
update
(${
item
.
codeName
}
et
)
;
void
updateBatch
(
List
<${
item
.
codeName
}>
list
)
;
<#
elseif
deaction
.
codeName
?
lower_case
==
"remove"
>
boolean
remove
(${
srfr7javatype
(
keyfield
.
stdDataType
)}
key
)
;
void
removeBatch
(
Collection
<${
srfr7javatype
(
keyfield
.
stdDataType
)}>
idList
)
;
<#
elseif
deaction
.
codeName
?
lower_case
==
"save"
>
boolean
save
(${
item
.
codeName
}
et
)
;
void
saveBatch
(
List
<${
item
.
codeName
}>
list
)
;
</#
if
>
</#
if
>
</#
list
>
</#
if
>
<#
if
item
.
getAllPSDEDataSets
()??>
<#
list
item
.
getAllPSDEDataSets
()
as
dedataset
>
Page
<${
item
.
getCodeName
()}>
search
${
dedataset
.
getCodeName
()}(${
item
.
codeName
}
SearchContext
context
)
;
</#
list
>
</#
if
>
</#
macro
>
</#
if
>
\ No newline at end of file
SLN/%PUBPRJ%-core/src/main/java/%SYS_PKGPATH%/core/es/service/impl/%DE%ESServiceImpl.java.ftl
0 → 100644
浏览文件 @
e0c93bb0
<#
ibiztemplate
>
TARGET
=
PSDATAENTITY
</#
ibiztemplate
>
<#
if
de
.
getUserTag
()??
&&
de
.
getUserTag
()==
'elasticsearch'
>
package
${
pub
.
getPKGCodeName
()}.
core
.
es
.
service
.
impl
;
import
com
.
google
.
common
.
collect
.
Lists
;
import
${
pub
.
getPKGCodeName
()}.
core
.
es
.
dao
.${
item
.
getCodeName
()}
ESRepository
;
import
${
pub
.
getPKGCodeName
()}.
core
.
es
.
domain
.${
item
.
getCodeName
()};
import
${
pub
.
getPKGCodeName
()}.
core
.
es
.
service
.
I
${
item
.
getCodeName
()}
ESService
;
import
${
pub
.
getPKGCodeName
()}.
core
.
valuerule
.
filter
.${
item
.
getCodeName
()}
SearchContext
;
import
${
pub
.
getPKGCodeName
()}.
util
.
helper
.
CachedBeanCopier
;
import
org
.
springframework
.
beans
.
factory
.
annotation
.
Autowired
;
import
org
.
springframework
.
context
.
annotation
.
Lazy
;
import
org
.
springframework
.
data
.
domain
.
Page
;
import
org
.
springframework
.
data
.
domain
.
PageImpl
;
import
java
.
util
.
List
;
import
java
.
util
.
Optional
;
import
org
.
springframework
.
stereotype
.
Service
;
import
java
.
util
.
Collection
;
/**
*
实体
[${
item
.
getLogicName
()}]
服务对象接口实现
*/
@
Service
public
class
${
item
.
getCodeName
()}
ESServiceImpl
implements
I
${
de
.
getCodeName
()}
ESService
{
@
Autowired
@
Lazy
${
item
.
getCodeName
()}
ESRepository
repository
;
<#
assign
keyfield
=
de
.
getKeyPSDEField
()>
<#
comment
>
输出实体行为
</#
comment
>
<#
if
item
.
getAllPSDEActions
()??>
<#
list
item
.
getAllPSDEActions
()
as
deaction
>
<#
if
deaction
.
getCodeName
()?
lower_case
==
'get'
>
@
Override
public
${
item
.
getCodeName
()}
get
(${
srfr7javatype
(
keyfield
.
stdDataType
)}
key
)
{
Optional
<${
item
.
getCodeName
()}>
result
=
repository
.
findById
(
key
);
if
(
!result.isPresent()){
${
item
.
getCodeName
()}
et
=
new
${
item
.
getCodeName
()}();
et
.
set
${
srfcaseformat
(
keyfield
.
codeName
,
'l_u2lC'
)?
cap_first
}(
key
);
return
et
;
}
else
{
${
item
.
getCodeName
()}
et
=
result
.
get
();
return
et
;
}
}
<#
elseif
deaction
.
getCodeName
()?
lower_case
==
"create"
>
@
Override
public
boolean
create
(${
item
.
getCodeName
()}
et
)
{
repository
.
save
(
et
);
CachedBeanCopier
.
copy
(
get
(
et
.
get
${
srfcaseformat
(
keyfield
.
codeName
,
'l_u2lC'
)?
cap_first
}()),
et
);
return
true
;
}
@
Override
public
void
createBatch
(
List
<${
item
.
getCodeName
()}>
list
)
{
}
<#
elseif
deaction
.
getCodeName
()?
lower_case
==
"update"
>
@
Override
public
boolean
update
(${
item
.
getCodeName
()}
et
)
{
repository
.
save
(
et
);
CachedBeanCopier
.
copy
(
get
(
et
.
get
${
srfcaseformat
(
keyfield
.
codeName
,
'l_u2lC'
)?
cap_first
}()),
et
);
return
true
;
}
@
Override
public
void
updateBatch
(
List
<${
item
.
getCodeName
()}>
list
)
{
}
<#
elseif
deaction
.
getCodeName
()?
lower_case
==
"save"
>
@
Override
public
boolean
save
(${
item
.
getCodeName
()}
et
)
{
repository
.
save
(
et
);
CachedBeanCopier
.
copy
(
get
(
et
.
get
${
srfcaseformat
(
keyfield
.
codeName
,
'l_u2lC'
)?
cap_first
}()),
et
);
return
true
;
}
@
Override
public
void
saveBatch
(
List
<${
item
.
getCodeName
()}>
list
)
{
}
<#
elseif
deaction
.
getCodeName
()?
lower_case
==
"remove"
>
@
Override
public
boolean
remove
(${
srfr7javatype
(
keyfield
.
stdDataType
)}
key
)
{
repository
.
deleteById
(
key
);
return
true
;
}
@
Override
public
void
removeBatch
(
Collection
<${
srfr7javatype
(
keyfield
.
stdDataType
)}>
idList
)
{
}
</#
if
>
</#
list
>
</#
if
>
<#
comment
>
输出实体数据集
</#
comment
>
<#
if
item
.
getAllPSDEDataSets
()??>
<#
list
item
.
getAllPSDEDataSets
()
as
dedataset
>
public
Page
<${
item
.
getCodeName
()}>
search
${
dedataset
.
getCodeName
()}(${
item
.
codeName
}
SearchContext
context
){
Iterable
<${
item
.
getCodeName
()}>
list
=
repository
.
search
(
context
.
getEsCond
());
List
<${
item
.
getCodeName
()}>
entities
=
Lists
.
newArrayList
(
list
);
return
new
PageImpl
<${
item
.
getCodeName
()}>(
entities
,
context
.
getPageable
(),
entities
.
size
());
}
</#
list
>
</#
if
>
}
</#
if
>
\ No newline at end of file
SLN/%PUBPRJ%-dependencies/pom.xml.ftl
浏览文件 @
e0c93bb0
...
...
@@ -8,6 +8,13 @@ TARGET=PSSYSTEM
<#break>
</#if>
</#list>
<#assign hasESEntity=false>
<#list sys.getAllPSDataEntities() as dataEntity>
<#if dataEntity.getUserTag()?? && dataEntity.getUserTag()=='elasticsearch'>
<#assign hasESEntity=true>
<#break>
</#if>
</#list>
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
...
...
@@ -422,6 +429,12 @@ TARGET=PSSYSTEM
</dependency>
</#if>
<#if hasESEntity>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-elasticsearch</artifactId>
</dependency>
</#if>
</dependencies>
</project>
SLN/%PUBPRJ%-provider/%PUBPRJ%-provider-%SYSAPI_PKGPATH%/src/main/java/%SYS_PKGPATH%/%SYSAPI_PKGPATH%/rest/%ITEM%Resource.java.ftl
浏览文件 @
e0c93bb0
...
...
@@ -312,9 +312,46 @@ public class ${itemCodeName}Resource {
.
body
(
new
PageImpl
(${
itemCodeNameLC
}
Mapping
.
toDto
(
domains
.
getContent
()),
context
.
getPageable
(),
domains
.
getTotalElements
()));
</#
if
>
}
<#
if
de
.
getUserTag
()??
&&
de
.
getUserTag
()==
'elasticsearch'
>
<@
DataQuerySecurityAnnotation
deds
/>
@
ApiOperation
(
value
=
"获取${deds.getLogicName()}"
,
tags
=
{
"${deLogicName}"
}
,
notes
=
"获取${deds.getLogicName()}"
)
@
RequestMapping
(
method
=
RequestMethod
.${
reqMtd
}
,
value
=
"${fullPath}/fetch<#if (deds.getName()=='DEFAULT')>${deds.getCodeName()?lower_case}<#else>${deds.getCodeName()?lower_case}</#if>/es"
)
public
ResponseEntity
<
List
<${
itemCodeName
}
DTO
>>
esFetch
<#
if
(
deds
.
getName
()==
'DEFAULT'
)>${
deds
.
getCodeName
()}<#
else
>${
deds
.
getCodeName
()}</#
if
>(${
deCodeName
}
SearchContext
context
)
{
Page
<${
pub
.
getPKGCodeName
()}.
core
.
es
.
domain
.${
item
.
codeName
}>
domains
=
esService
.
search
${
deds
.
getCodeName
()}(
context
)
;
List
<${
itemCodeName
}
DTO
>
list
=
${
itemCodeNameLC
}
Mapping
.
toDto
(
esMapping
.
toDomain
(
domains
.
getContent
()));
return
ResponseEntity
.
status
(${
statusCode
})
.
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
);
}
</#
if
>
</#
if
>
</#
list
>
</#
if
>
<#
comment
>
es
get
行为
</#
comment
>
<#
if
de
.
getUserTag
()??
&&
de
.
getUserTag
()==
'elasticsearch'
>
@
Autowired
@
Lazy
${
pub
.
getPKGCodeName
()}.
core
.
es
.
service
.
I
${
de
.
codeName
}
ESService
esService
;
@
Autowired
@
Lazy
${
pub
.
getPKGCodeName
()}.
core
.${
de
.
getPSSystemModule
().
codeName
?
lower_case
}.
mapping
.${
de
.
codeName
}
ESMapping
esMapping
;
<@
SecurityAnnotation
deaction
/>
@
ApiOperation
(
value
=
"获取${deLogicName}"
,
tags
=
{
"${deLogicName}"
},
notes
=
"获取${deLogicName}"
)
@
RequestMapping
(
method
=
RequestMethod
.
GET
,
value
=
"${fullPath}/{${itemCodeNameLC + keyCNLC}}/es"
)
public
ResponseEntity
<${
itemCodeName
}
DTO
>
esGet
(${
idParams
})
{
${
pub
.
getPKGCodeName
()}.
core
.
es
.
domain
.${
item
.
codeName
}
domain
=
esService
.
get
(${
itemCodeNameLC
+
keyCNLC
});
${
itemCodeName
}
DTO
dto
=
${
itemCodeNameLC
}
Mapping
.
toDto
(
esMapping
.
toDomain
(
domain
));
return
ResponseEntity
.
status
(
HttpStatus
.
OK
).
body
(
dto
);
}
</#
if
>
</#
if
>
<#--
主接口
end
-->
<#--
关系接口
start
-->
...
...
SLN/%PUBPRJ%-util/src/main/java/%SYS_PKGPATH%/util/aspect/AuditAspect.java.ftl
浏览文件 @
e0c93bb0
<#
ibiztemplate
>
TARGET
=
PSSYSTEM
</#
ibiztemplate
>
<#
assign
hasESEntity
=
false
>
<#
list
sys
.
getAllPSDataEntities
()
as
dataEntity
>
<#
if
dataEntity
.
getUserTag
()??
&&
dataEntity
.
getUserTag
()==
'elasticsearch'
>
<#
assign
hasESEntity
=
true
>
<#
break
>
</#
if
>
</#
list
>
package
${
pub
.
getPKGCodeName
()}.
util
.
aspect
;
import
lombok
.
SneakyThrows
;
...
...
@@ -44,7 +51,7 @@ public class AuditAspect
*
实体数据建立切面,在成功创建数据后将新增数据内容记录审计日志内(审计明细【
AuditInfo
】中只记录审计属性变化情况,审计属性在平台属性中配置)
*
@
param
point
*/
@
AfterReturning
(
value
=
"execution(* ${pub.getPKGCodeName()}.core.*.service.*.create(..))"
)
@
AfterReturning
(
value
=
"execution(* ${pub.getPKGCodeName()}.core.*.service.*.create(..))
<#if hasESEntity>&& !execution(* ${pub.getPKGCodeName()}.core.es.service.*.create*(..))</#if>
"
)
@
SneakyThrows
public
void
create
(
JoinPoint
point
){
HttpServletRequest
request
=
null
;
...
...
@@ -57,19 +64,20 @@ public class AuditAspect
return
;
Object
serviceParam
=
args
[
0
];
EntityBase
entity
=(
EntityBase
)
serviceParam
;//
创建数据
Map
<
String
,
Audit
>
auditFields
=
DEFieldCacheMap
.
getAuditFields
(
entity
.
getClass
());
if
(
auditFields
.
size
()==
0
)//
是否有审计属性
return
;
if
(
serviceParam
instanceof
EntityBase
){
EntityBase
entity
=(
EntityBase
)
serviceParam
;//
创建数据
Map
<
String
,
Audit
>
auditFields
=
DEFieldCacheMap
.
getAuditFields
(
entity
.
getClass
());
if
(
auditFields
.
size
()==
0
)//
是否有审计属性
return
;
String
idField
=
DEFieldCacheMap
.
getDEKeyField
(
entity
.
getClass
());
Object
idValue
=
""
;
if
(
!StringUtils.isEmpty(idField)){
idValue
=
entity
.
get
(
idField
);
String
idField
=
DEFieldCacheMap
.
getDEKeyField
(
entity
.
getClass
());
Object
idValue
=
""
;
if
(
!StringUtils.isEmpty(idField)){
idValue
=
entity
.
get
(
idField
);
}
//
记录审计日志
dataAuditService
.
createAudit
(
request
,
entity
,
idValue
,
auditFields
);
}
//
记录审计日志
dataAuditService
.
createAudit
(
request
,
entity
,
idValue
,
auditFields
);
return
;
}
/**
...
...
@@ -77,7 +85,7 @@ public class AuditAspect
*
使用环切【
@
Around
】获取到更新前后的实体数据并进行差异比较,并将差异内容记入审计日志内
*
@
param
point
*/
@
Around
(
"execution(* ${pub.getPKGCodeName()}.core.*.service.*.update(..))"
)
@
Around
(
"execution(* ${pub.getPKGCodeName()}.core.*.service.*.update(..))
<#if hasESEntity>&& !execution(* ${pub.getPKGCodeName()}.core.es.service.*.update*(..))</#if>
"
)
public
Object
update
(
ProceedingJoinPoint
point
)
throws
Throwable
{
HttpServletRequest
request
=
null
;
RequestAttributes
requestAttributes
=
RequestContextHolder
.
getRequestAttributes
();
...
...
@@ -91,27 +99,30 @@ public class AuditAspect
return
point
.
proceed
();
Object
arg
=
args
[
0
];
EntityBase
entity
=
(
EntityBase
)
arg
;
Map
<
String
,
Audit
>
auditFields
=
DEFieldCacheMap
.
getAuditFields
(
entity
.
getClass
());
if
(
arg
instanceof
EntityBase
){
EntityBase
entity
=
(
EntityBase
)
arg
;
Map
<
String
,
Audit
>
auditFields
=
DEFieldCacheMap
.
getAuditFields
(
entity
.
getClass
());
//
是否有审计属性
if
(
auditFields
.
size
()==
0
)
return
point
.
proceed
();
String
idField
=
DEFieldCacheMap
.
getDEKeyField
(
entity
.
getClass
());
Object
idValue
=
""
;
if
(
!StringUtils.isEmpty(idField)){
idValue
=
entity
.
get
(
idField
);
}
if
(
ObjectUtils
.
isEmpty
(
idValue
))
return
point
.
proceed
();
//
是否有审计属性
if
(
auditFields
.
size
()==
0
)
return
point
.
proceed
();
String
idField
=
DEFieldCacheMap
.
getDEKeyField
(
entity
.
getClass
());
Object
idValue
=
""
;
if
(
!StringUtils.isEmpty(idField)){
idValue
=
entity
.
get
(
idField
);
}
if
(
ObjectUtils
.
isEmpty
(
idValue
))
return
point
.
proceed
();
//
获取更新前实体
EntityBase
beforeEntity
=
getEntity
(
serviceObj
,
idValue
);
//
执行更新操作
point
.
proceed
();
//
记录审计日志
dataAuditService
.
updateAudit
(
request
,
beforeEntity
,
serviceObj
,
idValue
,
auditFields
);
return
true
;
//
获取更新前实体
EntityBase
beforeEntity
=
getEntity
(
serviceObj
,
idValue
);
//
执行更新操作
point
.
proceed
();
//
记录审计日志
dataAuditService
.
updateAudit
(
request
,
beforeEntity
,
serviceObj
,
idValue
,
auditFields
);
return
true
;
}
return
point
.
proceed
();
}
/**
...
...
@@ -121,7 +132,7 @@ public class AuditAspect
*
@
return
*
@
throws
Throwable
*/
@
Around
(
"execution(* ${pub.getPKGCodeName()}.core.*.service.*.remove(..))"
)
@
Around
(
"execution(* ${pub.getPKGCodeName()}.core.*.service.*.remove(..))
<#if hasESEntity>&& !execution(* ${pub.getPKGCodeName()}.core.es.service.*.remove*(..))</#if>
"
)
public
Object
remove
(
ProceedingJoinPoint
point
)
throws
Throwable
{
HttpServletRequest
request
=
null
;
RequestAttributes
requestAttributes
=
RequestContextHolder
.
getRequestAttributes
();
...
...
SLN/%PUBPRJ%-util/src/main/java/%SYS_PKGPATH%/util/aspect/ESAspect.java.ftl
0 → 100644
浏览文件 @
e0c93bb0
<#
ibiztemplate
>
TARGET
=
PSDATAENTITY
</#
ibiztemplate
>
<#
assign
hasESEntity
=
false
>
<#
list
sys
.
getAllPSDataEntities
()
as
dataEntity
>
<#
if
dataEntity
.
getUserTag
()??
&&
dataEntity
.
getUserTag
()==
'elasticsearch'
>
<#
assign
hasESEntity
=
true
>
<#
break
>
</#
if
>
</#
list
>
<#
if
hasESEntity
==
true
>
package
${
pub
.
getPKGCodeName
()}.
util
.
es
.
aspect
;
import
lombok
.
extern
.
slf4j
.
Slf4j
;
import
${
pub
.
getPKGCodeName
()}.
util
.
domain
.
EntityBase
;
import
org
.
aspectj
.
lang
.
JoinPoint
;
import
org
.
aspectj
.
lang
.
annotation
.
AfterReturning
;
import
org
.
aspectj
.
lang
.
annotation
.
Aspect
;
import
org
.
springframework
.
expression
.
EvaluationContext
;
import
org
.
springframework
.
expression
.
Expression
;
import
org
.
springframework
.
expression
.
ExpressionParser
;
import
org
.
springframework
.
expression
.
spel
.
standard
.
SpelExpressionParser
;
import
org
.
springframework
.
expression
.
spel
.
support
.
StandardEvaluationContext
;
import
org
.
springframework
.
scheduling
.
annotation
.
Async
;
import
org
.
springframework
.
stereotype
.
Component
;
import
org
.
springframework
.
util
.
ObjectUtils
;
import
org
.
springframework
.
util
.
StringUtils
;
import
java
.
util
.
List
;
/**
*
es
同步数据切面
*/
@
Aspect
@
Component
@
Slf4j
public
class
ESAspect
{
private
final
ExpressionParser
parser
=
new
SpelExpressionParser
();
<#
list
sys
.
getAllPSDataEntities
()
as
dataEntity
>
<#
if
dataEntity
.
getUserTag
()??
&&
dataEntity
.
getUserTag
()==
'elasticsearch'
>
/**
*
实体
[${
dataEntity
.
codeName
}]
es
切面
*
@
param
point
*/
@
AfterReturning
(
value
=
"(execution(* ${pub.getPKGCodeName()}.core.*.service.*${dataEntity.codeName}*.create*(..))||execution(* ${pub.getPKGCodeName()}.core.*.service.*${dataEntity.codeName}*.update*(..))||execution(* ${pub.getPKGCodeName()}.core.*.service.*${dataEntity.codeName}*.save*(..)) ||execution(* ${pub.getPKGCodeName()}.core.*.service.*${dataEntity.codeName}*.remove*(..))) && !execution(* ${pub.getPKGCodeName()}.core.es.service.*.create*(..)) && !execution(* ${pub.getPKGCodeName()}.core.es.service.*.update*(..)) && !execution(* ${pub.getPKGCodeName()}.core.es.service.*.save*(..)) && !execution(* ${pub.getPKGCodeName()}.core.es.service.*.remove*(..))"
)
@
Async
public
void
Sync
${
dataEntity
.
codeName
?
lower_case
?
cap_first
}(
JoinPoint
point
){
syncSaveESData
(
point
,
"${dataEntity.codeName}"
);
}
</#
if
>
</#
list
>
/**
*
异步往
es
中保存数据
*
@
param
point
*/
public
void
syncSaveESData
(
JoinPoint
point
,
String
deName
){
try
{
Object
service
=
point
.
getTarget
();
String
action
=
point
.
getSignature
().
getName
();
Object
[]
args
=
point
.
getArgs
();
if
(
ObjectUtils
.
isEmpty
(
args
)
||
args
.
length
==
0
||
StringUtils
.
isEmpty
(
action
))
return
;
EvaluationContext
exServiceCtx
=
new
StandardEvaluationContext
();
exServiceCtx
.
setVariable
(
"service"
,
service
);
Expression
esServiceExp
=
parser
.
parseExpression
(
"#service.getESService()"
);
Object
exService
=
esServiceExp
.
getValue
(
exServiceCtx
);
if
(
ObjectUtils
.
isEmpty
(
exService
)){
log
.
error
(
"获取[{}]实体全文检索服务对象失败"
,
deName
);
return
;
}
Object
arg
=
args
[
0
];
if
(
arg
instanceof
EntityBase
||
arg
instanceof
List
){
EvaluationContext
exMappingCtx
=
new
StandardEvaluationContext
();
exMappingCtx
.
setVariable
(
"service"
,
service
);
Expression
esMappingExp
=
parser
.
parseExpression
(
"#service.getESMapping()"
);
Object
exMapping
=
esMappingExp
.
getValue
(
exMappingCtx
);
if
(
ObjectUtils
.
isEmpty
(
exMapping
)){
log
.
error
(
"获取[{}]实体全文检索映射对象失败"
,
deName
);
return
;
}
EvaluationContext
exDomainCtx
=
new
StandardEvaluationContext
();
exDomainCtx
.
setVariable
(
"mapping"
,
exMapping
);
exDomainCtx
.
setVariable
(
"arg"
,
arg
);
Expression
esDomainExp
=
parser
.
parseExpression
(
"#mapping.toESDomain(#arg)"
);
arg
=
esDomainExp
.
getValue
(
exDomainCtx
);
executeESMethod
(
exService
,
action
,
arg
);
}
else
if
(
"remove"
.
equals
(
action
)
||
"removeBatch"
.
equals
(
action
)){
executeESMethod
(
exService
,
action
,
arg
);
}
}
catch
(
Exception
e
)
{
log
.
error
(
"同步[{}]实体全文检索数据失败,{}"
,
deName
,
e
);
}
}
/**
*
执行
es
方法
*
@
param
exService
*
@
param
action
*
@
param
arg
*/
private
void
executeESMethod
(
Object
exService
,
Object
action
,
Object
arg
){
EvaluationContext
esContext
=
new
StandardEvaluationContext
();
esContext
.
setVariable
(
"exService"
,
exService
);
esContext
.
setVariable
(
"arg"
,
arg
);
Expression
exExp
=
parser
.
parseExpression
(
String
.
format
(
"#exService.%s(#arg)"
,
action
));
exExp
.
getValue
(
esContext
);
}
}
</#
if
>
\ No newline at end of file
SLN/%PUBPRJ%-util/src/main/java/%SYS_PKGPATH%/util/cache/cache/LayeringCache.java.ftl
浏览文件 @
e0c93bb0
...
...
@@ -14,6 +14,7 @@ import java.util.Map;
import
java
.
util
.
concurrent
.
Callable
;
import
${
pub
.
getPKGCodeName
()}.
util
.
cache
.
listener
.
RedisPublisher
;
import
${
pub
.
getPKGCodeName
()}.
util
.
enums
.
RedisChannelTopic
;
import
org
.
springframework
.
util
.
ObjectUtils
;
/**
*
缓存分层类
...
...
@@ -61,11 +62,16 @@ public class LayeringCache extends AbstractValueAdaptingCache {
@
Override
public
ValueWrapper
get
(
Object
key
)
{
ValueWrapper
wrapper
=
caffeineCache
.
get
(
key
);
log
.
debug
(
"查询一级缓存 key:{},value:{}"
,
key
,
wrapper
);
if
(
wrapper
==
null
)
{
Object
value
=
ObjectUtils
.
isEmpty
(
wrapper
)?
null
:
wrapper
.
get
();
log
.
debug
(
"查询一级缓存 key:{} ,value:{}"
,
key
,
value
);
if
(
ObjectUtils
.
isEmpty
(
value
))
{
wrapper
=
redisCache
.
get
(
key
);
caffeineCache
.
put
(
key
,
wrapper
==
null
?
null
:
wrapper
.
get
());
log
.
debug
(
"查询二级缓存,并将数据放到一级缓存。 key:{}"
,
key
);
value
=
ObjectUtils
.
isEmpty
(
wrapper
)?
null
:
wrapper
.
get
();
log
.
debug
(
"查询二级缓存 key:{} ,value:{}"
,
key
,
value
);
if
(
!ObjectUtils.isEmpty(value)){
caffeineCache
.
put
(
key
,
value
);
log
.
debug
(
"查询二级缓存,并将数据放到一级缓存。 key:{} ,value:{}"
,
key
,
value
);
}
}
return
wrapper
;
}
...
...
SLN/%PUBPRJ%-util/src/main/java/%SYS_PKGPATH%/util/filter/SearchContextBase.java.ftl
浏览文件 @
e0c93bb0
<#
ibiztemplate
>
TARGET
=
PSSYSTEM
</#
ibiztemplate
>
<#
assign
hasESEntity
=
false
>
<#
list
sys
.
getAllPSDataEntities
()
as
dataEntity
>
<#
if
dataEntity
.
getUserTag
()??
&&
dataEntity
.
getUserTag
()==
'elasticsearch'
>
<#
assign
hasESEntity
=
true
>
<#
break
>
</#
if
>
</#
list
>
package
${
pub
.
getPKGCodeName
()}.
util
.
filter
;
import
${
pub
.
getPKGCodeName
()}.
util
.
security
.
AuthenticationUser
;
...
...
@@ -16,6 +23,9 @@ import org.springframework.data.domain.Sort;
import
org
.
springframework
.
util
.
StringUtils
;
import
org
.
springframework
.
util
.
ObjectUtils
;
import
java
.
util
.*;
<#
if
hasESEntity
>
import
org
.
elasticsearch
.
index
.
query
.
BoolQueryBuilder
;
</#
if
>
@
Slf4j
@
Data
...
...
@@ -70,7 +80,12 @@ public class SearchContextBase implements ISearchContext{
*
工作流流程标识
*/
public
String
processDefinitionKey
;
<#
if
hasESEntity
>
/**
*
es
查询条件
*/
public
BoolQueryBuilder
esCond
=
new
BoolQueryBuilder
();
</#
if
>
/**
*
获取工作流步骤标识
*/
...
...
SLN/%PUBPRJ%-util/src/main/java/%SYS_PKGPATH%/util/service/SimpleFileService.java.ftl
浏览文件 @
e0c93bb0
...
...
@@ -41,7 +41,7 @@ public class SimpleFileService implements FileService {
FileCopyUtils
.
copy
(
multipartFile
.
getInputStream
(),
Files
.
newOutputStream
(
file
.
toPath
()));
item
=
new
FileItem
(
fileid
,
fileName
,
fileid
,
fileName
,(
int
)
multipartFile
.
getSize
(),
extname
);
}
catch
(
IOException
e
)
{
throw
new
InternalServerErrorException
(
"文件上传失败
"
);
throw
new
InternalServerErrorException
(
"文件上传失败
,"
+
e
);
}
return
item
;
}
...
...
SLN/%PUBPRJ%-util/src/main/resources/application-sys.yml.ftl
浏览文件 @
e0c93bb0
...
...
@@ -26,7 +26,13 @@ TARGET=PSSYSTEM
<#break>
</#if>
</#list>
<#assign hasESEntity=false>
<#list sys.getAllPSDataEntities() as dataEntity>
<#if dataEntity.getUserTag()?? && dataEntity.getUserTag()=='elasticsearch'>
<#assign hasESEntity=true>
<#break>
</#if>
</#list>
<#assign TcServerCluster="default">
<#assign seataServerName="seata-server">
<#assign nacosAddress="localhost">
...
...
@@ -219,6 +225,11 @@ spring:
mongodb:
uri: ${mongodbUri}
</#if>
<#if hasESEntity>
elasticsearch:
repositories:
enabled: true
</#if>
<#if bDynamicDS>
<@dynamicDatasourceConfig/>
<#else>
...
...
编辑
预览
Markdown
格式
0%
请重试
or
添加新附件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
先完成此消息的编辑!
取消
想要评论请
注册
或
登录