Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gjjs-bd-common
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
s_guodong
gjjs-bd-common
Commits
c4d080d1
Commit
c4d080d1
authored
Sep 26, 2023
by
吴佳
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
兼容ZK saveData\loadData 调整
parent
cf6f5741
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
28 additions
and
11 deletions
+28
-11
MdaUtils.java
...in/java/com/brilliance/mda/runtime/mda/util/MdaUtils.java
+28
-11
No files found.
gjjs-bd-runtime/src/main/java/com/brilliance/mda/runtime/mda/util/MdaUtils.java
View file @
c4d080d1
...
...
@@ -963,7 +963,7 @@ public class MdaUtils {
//在第一行写入module 名字
os
.
insertLine
(
0
,
module
.
getName
());
try
{
os
.
getOutputStream
().
write
((
module
.
getName
()).
getBytes
(
StandardCharsets
.
UTF_8
));
os
.
getOutputStream
().
write
((
"\r"
+
module
.
getName
()).
getBytes
(
StandardCharsets
.
UTF_8
));
}
catch
(
IOException
e
){
log
.
error
(
"流数据写入失败"
);
}
...
...
@@ -976,7 +976,7 @@ public class MdaUtils {
private
static
void
writeData
(
String
parentDir
,
IModule
module
,
IStream
os
)
{
String
thisDir
=
""
;
if
(
parentDir
.
length
()
!=
0
){
thisDir
=
parentDir
+
"\\"
;
thisDir
=
parentDir
+
File
.
separator
;
}
String
moduleName
=
module
.
getClass
().
getName
();
...
...
@@ -1013,7 +1013,7 @@ public class MdaUtils {
String
line
=
thisDir
+
fieldName
+
"="
+
newFieldVal
;
// os.insertLine(0,line);
try
{
os
.
getOutputStream
().
write
((
"\r
\n
"
+
line
).
getBytes
(
StandardCharsets
.
UTF_8
));
os
.
getOutputStream
().
write
((
"\r"
+
line
).
getBytes
(
StandardCharsets
.
UTF_8
));
}
catch
(
IOException
e
){
log
.
error
(
"流数据写入失败"
);
}
...
...
@@ -1035,24 +1035,41 @@ public class MdaUtils {
return
Codetables
.
getCodetableLabel
(
key
,
codetable
,
locale
.
getLanguage
());
}
public
static
void
loadMdlData
(
IModule
module
,
IStream
stream
)
{
public
static
void
loadMdlData
(
IModule
module
,
String
moduleName
,
IStream
stream
)
{
module
.
clear
();
String
[]
lines
=
null
;
try
{
lines
=
stream
.
getOutputStream
().
toString
().
split
(
"\r
\n
"
);
lines
=
stream
.
getOutputStream
().
toString
().
split
(
"\r"
);
}
catch
(
Exception
e
){
log
.
error
(
"获取流数据失败"
);
}
boolean
isLoading
=
false
;
if
(
lines
.
length
>
0
){
// Class moduleClass = module.getClass();
for
(
String
line
:
lines
)
{
Class
moduleClass
=
module
.
getClass
();
if
(
moduleClass
.
getName
().
toUpperCase
().
indexOf
(
line
.
toUpperCase
())
!=
-
1
){
//去除空格
line
.
trim
();
//空行和#开头的注释行 跳过
if
(
line
.
length
()
==
0
||
line
.
indexOf
(
"#"
)
==
0
){
continue
;
}
//读取到本模型模型名相同数据的行,开始获取模型数据
if
(
moduleName
.
toUpperCase
().
indexOf
(
line
.
toUpperCase
())
!=
-
1
){
//开始获取模型数据标识
isLoading
=
true
;
continue
;
}
if
(
isLoading
){
//读取到下一个模型(不包含"="好的列为模型名),跳出循环
if
(
line
.
indexOf
(
"="
)
==
-
1
)
{
break
;
}
//获取模型数据
String
val
=
line
.
split
(
"="
)[
1
].
trim
();
String
key
=
line
.
split
(
"="
)[
0
].
trim
();
readData
(
module
,
key
,
val
);
}
}
}
}
...
...
@@ -1063,7 +1080,7 @@ public class MdaUtils {
String
moduleName
=
moduleClass
.
getName
();
Method
getMethod
=
null
;
Method
setMethod
=
null
;
if
(
key
.
indexOf
(
"\\"
)
==
-
1
){
//叶子节点赋值
if
(
key
.
indexOf
(
File
.
separator
)
==
-
1
){
//叶子节点赋值
//获取setXXX方法名
fieldName
=
key
;
String
setMethodName
=
"set"
+
fieldName
.
substring
(
0
,
1
).
toUpperCase
()
+
fieldName
.
substring
(
1
);
...
...
@@ -1101,8 +1118,8 @@ public class MdaUtils {
}
}
else
{
//非叶子节点继续迭代
//获取setXXX方法名
fieldName
=
key
.
substring
(
0
,
key
.
indexOf
(
"\\"
));
String
newKey
=
key
.
substring
(
key
.
indexOf
(
"\\"
)+
1
);
fieldName
=
key
.
substring
(
0
,
key
.
indexOf
(
File
.
separator
));
String
newKey
=
key
.
substring
(
key
.
indexOf
(
File
.
separator
)+
1
);
String
getMethodName
=
"get"
+
fieldName
.
substring
(
0
,
1
).
toUpperCase
()
+
fieldName
.
substring
(
1
);
try
{
//查询getXXX方法
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment