Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
提交反馈
为 GitLab 提交贡献
登录
切换导航
iBiz4j Spring R7
项目
项目
详情
动态
版本
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
iBiz-R7后台标准模板
iBiz4j Spring R7
提交
481cf7cf
提交
481cf7cf
编写于
1月 20, 2021
作者:
zhouweidong
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
动态系统逻辑优化
上级
3433df0e
变更
1
隐藏空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
17 行增加
和
5 行删除
+17
-5
DynamicModelService.java.ftl
...a/%SYS_PKGPATH%/util/service/DynamicModelService.java.ftl
+17
-5
未找到文件。
SLN/%PUBPRJ%-util/src/main/java/%SYS_PKGPATH%/util/service/DynamicModelService.java.ftl
浏览文件 @
481cf7cf
...
...
@@ -3,6 +3,7 @@ TARGET=PSSYSTEM
</#
ibiztemplate
>
<#
if
sys
.
getCodeName
()==
'Sample'
>
package
${
pub
.
getPKGCodeName
()}.
util
.
service
;
package
${
pub
.
getPKGCodeName
()}.
util
.
service
;
import
lombok
.
extern
.
slf4j
.
Slf4j
;
import
${
pub
.
getPKGCodeName
()}.
util
.
client
.
IBZLiteFeignClient
;
...
...
@@ -10,6 +11,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import
org
.
springframework
.
beans
.
factory
.
annotation
.
Value
;
import
org
.
springframework
.
stereotype
.
Service
;
import
org
.
springframework
.
util
.
ObjectUtils
;
import
org
.
springframework
.
util
.
StringUtils
;
import
java
.
io
.*;
import
java
.
util
.
List
;
...
...
@@ -37,7 +39,7 @@ public class DynamicModelService {
long
start
=
System
.
currentTimeMillis
();
List
<
Map
<
String
,
Object
>>
dynamicModels
=
liteClient
.
getDynamicModel
(
systemId
);
if
(
!ObjectUtils.isEmpty(dynamicModels)) {
File
dynamicFolder
=
new
File
(
dynamicPath
+
File
.
separator
+
systemId
);
File
dynamicFolder
=
new
File
(
getDynamicPath
()
+
systemId
);
if
(
dynamicFolder
.
exists
())
{
deleteDir
(
dynamicFolder
.
getPath
());
}
...
...
@@ -57,19 +59,15 @@ public class DynamicModelService {
}
File
file
=
new
File
(
fullPath
);
file
.
createNewFile
();
//
文件输入流并进行缓冲
inputStream
=
new
ByteArrayInputStream
(
String
.
valueOf
(
strFileContent
).
getBytes
());
bufferedInputStream
=
new
BufferedInputStream
(
inputStream
);
//
文件输出流并进行缓冲
outputStream
=
new
FileOutputStream
(
file
);
bufferedOutputStream
=
new
BufferedOutputStream
(
outputStream
);
//
缓冲数组,大文件
可将
1024
*
2
改大一些,但是
并不是越大就越快
byte
[]
bytes
=
new
byte
[
1024
*
2
];
int
len
=
0
;
while
((
len
=
inputStream
.
read
(
bytes
))
!= -1) {
bufferedOutputStream
.
write
(
bytes
,
0
,
len
);
}
//
刷新输出缓冲流
bufferedOutputStream
.
flush
();
log
.
debug
(
fullPath
);
}
catch
(
IOException
e
)
{
...
...
@@ -118,5 +116,19 @@ public class DynamicModelService {
}
}
}
/**
*
动态模型目录
*
@
return
*/
public
String
getDynamicPath
()
{
if
(
!StringUtils.isEmpty(dynamicPath)){
dynamicPath
=
dynamicPath
.
replace
(
"
\\\\
"
,
File
.
separator
).
replace
(
"
\\
"
,
File
.
separator
).
replace
(
"/"
,
File
.
separator
);
if
(
!dynamicPath.endsWith(File.separator)){
dynamicPath
=
dynamicPath
+
File
.
separator
;
}
}
return
dynamicPath
;
}
}
</#
if
>
\ No newline at end of file
编辑
预览
Markdown
格式
0%
请重试
or
添加新附件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
先完成此消息的编辑!
取消
想要评论请
注册
或
登录