Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
提交反馈
为 GitLab 提交贡献
登录
切换导航
I
ibzlite
项目
项目
详情
动态
版本
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
ibiz4jteam
ibzlite
提交
bf510c0c
提交
bf510c0c
编写于
1月 25, 2021
作者:
tangyaolong
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
优化逻辑
上级
30b2c75f
变更
2
显示空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
16 行增加
和
53 行删除
+16
-53
DynamicModelConfigExService.java
.../core/extensions/service/DynamicModelConfigExService.java
+9
-48
FileHelper.java
...util/src/main/java/cn/ibizlab/util/helper/FileHelper.java
+7
-5
未找到文件。
ibzlite-core/src/main/java/cn/ibizlab/core/extensions/service/DynamicModelConfigExService.java
浏览文件 @
bf510c0c
...
@@ -84,8 +84,8 @@ public class DynamicModelConfigExService extends DynamicModelConfigServiceImpl {
...
@@ -84,8 +84,8 @@ public class DynamicModelConfigExService extends DynamicModelConfigServiceImpl {
String
unzipPath
=
modelFile
.
getParent
().
replace
(
"ibizutil"
,
"dynamicmodel"
);
String
unzipPath
=
modelFile
.
getParent
().
replace
(
"ibizutil"
,
"dynamicmodel"
);
if
(
".gz"
.
equals
(
modelFile
.
getName
().
substring
(
modelFile
.
getName
().
lastIndexOf
(
"."
)))){
if
(
".gz"
.
equals
(
modelFile
.
getName
().
substring
(
modelFile
.
getName
().
lastIndexOf
(
"."
)))){
String
fileName
=
modelFile
.
getName
().
substring
(
0
,
modelFile
.
getName
().
indexOf
(
"."
));
String
fileName
=
modelFile
.
getName
().
substring
(
0
,
modelFile
.
getName
().
indexOf
(
"."
));
FileHelper
.
unTarGz
(
modelFile
,
unzipPath
);
FileHelper
.
unTarGz
(
modelFile
,
unzipPath
,
true
);
system
=
getSystem
(
unzipPath
,
fileName
);
system
=
getSystem
(
unzipPath
);
}
else
if
(
".zip"
.
equals
(
modelFile
.
getName
().
substring
(
modelFile
.
getName
().
lastIndexOf
(
"."
)))){
}
else
if
(
".zip"
.
equals
(
modelFile
.
getName
().
substring
(
modelFile
.
getName
().
lastIndexOf
(
"."
)))){
FileHelper
.
unzip
(
modelFile
,
unzipPath
,
true
);
FileHelper
.
unzip
(
modelFile
,
unzipPath
,
true
);
system
=
getSystem
(
unzipPath
);
system
=
getSystem
(
unzipPath
);
...
@@ -130,14 +130,14 @@ public class DynamicModelConfigExService extends DynamicModelConfigServiceImpl {
...
@@ -130,14 +130,14 @@ public class DynamicModelConfigExService extends DynamicModelConfigServiceImpl {
List
<
Map
<
String
,
Object
>>
workflow
=
searchWorkFlow
(
publishFile
.
getPath
());
List
<
Map
<
String
,
Object
>>
workflow
=
searchWorkFlow
(
publishFile
.
getPath
());
//部署流程
//部署流程
if
(
workflow
.
size
()
>
0
)
{
if
(
workflow
.
size
()
>
0
)
{
wfClient
.
deployBpmnFile
(
workflow
);
//
wfClient.deployBpmnFile(workflow);
}
}
//发送redis广播
//发送redis广播
Map
<
String
,
Object
>
message
=
new
HashMap
<>();
//
Map<String, Object> message = new HashMap<>();
message
.
put
(
"cacheName"
,
"dynamicModel"
);
//
message.put("cacheName", "dynamicModel");
message
.
put
(
"dynamicModel"
,
et
.
getConfigname
());
//
message.put("dynamicModel", et.getConfigname());
RedisPublisher
redisPublisher
=
new
RedisPublisher
(
redisOperations
,
RedisChannelTopic
.
REDIS_CACHE_DYNAMICMODEL_TOPIC
.
getChannelTopic
());
//
RedisPublisher redisPublisher = new RedisPublisher(redisOperations, RedisChannelTopic.REDIS_CACHE_DYNAMICMODEL_TOPIC.getChannelTopic());
redisPublisher
.
publisher
(
message
);
//
redisPublisher.publisher(message);
//激活当前et.
//激活当前et.
et
.
setStatus
(
StaticDict
.
DynamicModelStatus
.
ITEM_1
.
getValue
());
et
.
setStatus
(
StaticDict
.
DynamicModelStatus
.
ITEM_1
.
getValue
());
update
(
Wrappers
.<
DynamicModelConfig
>
lambdaUpdate
().
set
(
DynamicModelConfig:
:
getStatus
,
StaticDict
.
DynamicModelStatus
.
ITEM_0
.
getValue
()).
eq
(
DynamicModelConfig:
:
getSystemId
,
systemId
));
update
(
Wrappers
.<
DynamicModelConfig
>
lambdaUpdate
().
set
(
DynamicModelConfig:
:
getStatus
,
StaticDict
.
DynamicModelStatus
.
ITEM_0
.
getValue
()).
eq
(
DynamicModelConfig:
:
getSystemId
,
systemId
));
...
@@ -181,7 +181,7 @@ public class DynamicModelConfigExService extends DynamicModelConfigServiceImpl {
...
@@ -181,7 +181,7 @@ public class DynamicModelConfigExService extends DynamicModelConfigServiceImpl {
if
(!
ObjectUtils
.
isEmpty
(
subModels
))
{
if
(!
ObjectUtils
.
isEmpty
(
subModels
))
{
models
.
addAll
(
subModels
);
models
.
addAll
(
subModels
);
}
}
}
else
if
(
subFile
.
isFile
()
&&
(!
subFile
.
getName
().
equalsIgnoreCase
(
"PSWFVERSION.json.bpm"
))
&&
(
subFile
.
getName
().
endsWith
(
".bpmn"
)
||
subFile
.
getName
().
endsWith
(
".drl"
)))
{
}
else
if
(
subFile
.
isFile
()
&&
(!
subFile
.
getName
().
equalsIgnoreCase
(
"PSWFVERSION.json.bpm
n
"
))
&&
(
subFile
.
getName
().
endsWith
(
".bpmn"
)
||
subFile
.
getName
().
endsWith
(
".drl"
)))
{
InputStream
file
=
null
;
InputStream
file
=
null
;
try
{
try
{
file
=
new
FileInputStream
(
subFile
);
file
=
new
FileInputStream
(
subFile
);
...
@@ -300,43 +300,4 @@ public class DynamicModelConfigExService extends DynamicModelConfigServiceImpl {
...
@@ -300,43 +300,4 @@ public class DynamicModelConfigExService extends DynamicModelConfigServiceImpl {
}
}
return
system
;
return
system
;
}
}
/**
* gzip版获取系统标识
*
* @param filePath
* @return
*/
private
JSONObject
getSystem
(
String
filePath
,
String
fileName
)
{
JSONObject
system
=
null
;
InputStream
in
=
null
;
byte
[]
bytes
=
null
;
try
{
File
file
=
new
File
(
filePath
+
File
.
separator
+
fileName
+
File
.
separator
+
"PSSYSTEM.json"
);
if
(!
file
.
exists
())
{
throw
new
BadRequestAlertException
(
String
.
format
(
"无法找到动态系统模型文件[%s]"
,
file
.
getPath
()),
"DynamicModelConfig"
,
"getSystemId"
);
}
in
=
new
FileInputStream
(
file
);
bytes
=
new
byte
[
in
.
available
()];
in
.
read
(
bytes
);
}
catch
(
Exception
e
)
{
}
finally
{
try
{
if
(
in
!=
null
)
{
in
.
close
();
}
}
catch
(
IOException
e
)
{
}
}
if
(
bytes
!=
null
)
{
String
strSystem
=
new
String
(
bytes
);
if
(!
StringUtils
.
isEmpty
(
strSystem
))
{
system
=
JSONObject
.
parseObject
(
strSystem
);
}
}
if
(
ObjectUtils
.
isEmpty
(
system
))
{
throw
new
BadRequestAlertException
(
"无法获取系统标识"
,
"DynamicModelConfig"
,
"getSystem"
);
}
return
system
;
}
}
}
ibzlite-util/src/main/java/cn/ibizlab/util/helper/FileHelper.java
浏览文件 @
bf510c0c
...
@@ -76,25 +76,27 @@ public class FileHelper {
...
@@ -76,25 +76,27 @@ public class FileHelper {
* @param zipFile zip文件路径
* @param zipFile zip文件路径
* @param descDir 解压目录
* @param descDir 解压目录
*/
*/
public
static
void
unTarGz
(
File
zipFile
,
String
descDir
)
throws
IOException
{
public
static
void
unTarGz
(
File
zipFile
,
String
descDir
,
boolean
exp
)
throws
IOException
{
TarInputStream
tarIn
=
null
;
TarInputStream
tarIn
=
null
;
try
{
try
{
tarIn
=
new
TarInputStream
(
new
GZIPInputStream
(
tarIn
=
new
TarInputStream
(
new
GZIPInputStream
(
new
BufferedInputStream
(
new
FileInputStream
(
zipFile
))),
new
BufferedInputStream
(
new
FileInputStream
(
zipFile
))),
1024
*
2
);
1024
*
2
);
//创建输出目录
//创建输出目录
String
root
=
zipFile
.
getName
().
replace
(
".tar.gz"
,
"/"
);
createDirectory
(
descDir
,
null
);
createDirectory
(
descDir
,
null
);
TarEntry
entry
=
null
;
TarEntry
entry
=
null
;
String
fileName
=
null
;
while
((
entry
=
tarIn
.
getNextEntry
())
!=
null
){
while
((
entry
=
tarIn
.
getNextEntry
())
!=
null
){
fileName
=
exp
?
entry
.
getName
().
replace
(
root
,
""
)
:
entry
.
getName
();
if
(
entry
.
isDirectory
()){
if
(
entry
.
isDirectory
()){
//是目录
entry
.
getName
();
//创建空目录
//创建空目录
createDirectory
(
descDir
,
entry
.
getName
()
);
createDirectory
(
descDir
,
fileName
);
}
else
{
}
else
{
fileName
=
exp
?
entry
.
getName
().
replace
(
root
,
""
)
:
entry
.
getName
();
//是文件
//是文件
File
tmpFile
=
new
File
(
descDir
+
"/"
+
entry
.
getName
()
);
File
tmpFile
=
new
File
(
descDir
+
"/"
+
fileName
);
//创建输出目录
//创建输出目录
createDirectory
(
tmpFile
.
getParent
()
+
"/"
,
null
);
createDirectory
(
tmpFile
.
getParent
()
+
"/"
,
null
);
OutputStream
out
=
null
;
OutputStream
out
=
null
;
...
...
编辑
预览
Markdown
格式
0%
请重试
or
添加新附件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
先完成此消息的编辑!
取消
想要评论请
注册
或
登录