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
58867c4e
Commit
58867c4e
authored
Aug 21, 2023
by
s_guodong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
处理码表值
parent
aa204af7
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
64 additions
and
26 deletions
+64
-26
MdaContext.java
...ava/com/brilliance/mda/runtime/mda/driver/MdaContext.java
+2
-1
SnapshotService.java
.../brilliance/mda/runtime/mda/snapshot/SnapshotService.java
+4
-3
SnapshotServiceImpl.java
...lliance/mda/runtime/mda/snapshot/SnapshotServiceImpl.java
+28
-22
ValueVo.java
...a/com/brilliance/mda/runtime/mda/snapshot/bo/ValueVo.java
+27
-0
CustomAttributes.java
.../mda/runtime/mda/snapshot/bo/unpack/CustomAttributes.java
+3
-0
No files found.
gjjs-bd-runtime/src/main/java/com/brilliance/mda/runtime/mda/driver/MdaContext.java
View file @
58867c4e
...
...
@@ -4,6 +4,7 @@ import com.brilliance.mda.runtime.annotation.Transaction;
import
com.brilliance.mda.runtime.mda.*
;
import
com.brilliance.mda.runtime.mda.impl.EnvConfig
;
import
com.brilliance.mda.runtime.mda.snapshot.SnapshotService
;
import
com.brilliance.mda.runtime.mda.snapshot.bo.ValueVo
;
import
com.brilliance.mda.runtime.request.BaseVO
;
import
java.util.*
;
...
...
@@ -260,7 +261,7 @@ public class MdaContext implements IContext {
// 获取模板内容
String
templateContent
=
snapshotService
.
getTemplateContent
(
panelPath
);
// 获取填充值的key
Set
<
String
>
keySet
=
snapshotService
.
getKeySet
();
Set
<
ValueVo
>
keySet
=
snapshotService
.
getKeySet
();
// 获取填充的值
Map
<
String
,
Object
>
valueMap
=
snapshotService
.
getValueMap
(
keySet
,
parent
);
if
(
this
.
display
!=
null
)
{
...
...
gjjs-bd-runtime/src/main/java/com/brilliance/mda/runtime/mda/snapshot/SnapshotService.java
View file @
58867c4e
package
com
.
brilliance
.
mda
.
runtime
.
mda
.
snapshot
;
import
com.brilliance.mda.runtime.mda.IModule
;
import
com.brilliance.mda.runtime.mda.snapshot.bo.ValueVo
;
import
com.brilliance.mda.runtime.mda.snapshot.bo.pack.PackDocumentBo
;
import
com.brilliance.mda.runtime.mda.snapshot.bo.unpack.DocumentBo
;
...
...
@@ -28,7 +29,7 @@ public interface SnapshotService {
* @param parent
* @return
*/
Map
<
String
,
Object
>
getValueMap
(
Set
<
String
>
keySet
,
IModule
parent
);
Map
<
String
,
Object
>
getValueMap
(
Set
<
ValueVo
>
keySet
,
IModule
parent
);
/**
* 解析标准模板
...
...
@@ -47,9 +48,9 @@ public interface SnapshotService {
PackDocumentBo
packTemplate
(
DocumentBo
documentBo
);
/**
* 获取需要填充值的
key
* 获取需要填充值的
实体
*
* @return
*/
Set
<
String
>
getKeySet
();
Set
<
ValueVo
>
getKeySet
();
}
gjjs-bd-runtime/src/main/java/com/brilliance/mda/runtime/mda/snapshot/SnapshotServiceImpl.java
View file @
58867c4e
package
com
.
brilliance
.
mda
.
runtime
.
mda
.
snapshot
;
import
com.brilliance.mda.runtime.mda.IModule
;
import
com.brilliance.mda.runtime.mda.snapshot.bo.ValueVo
;
import
com.brilliance.mda.runtime.mda.snapshot.bo.pack.*
;
import
com.brilliance.mda.runtime.mda.snapshot.bo.unpack.*
;
import
com.brilliance.mda.runtime.mda.util.DateUtil
;
...
...
@@ -28,7 +29,7 @@ public class SnapshotServiceImpl implements SnapshotService {
protected
static
final
String
DISPLAY_TEMPLATE_PATH
=
"displayTemplate/"
;
private
static
final
Set
<
String
>
keySet
=
new
HashSet
<>();
private
static
final
Set
<
ValueVo
>
keySet
=
new
HashSet
<>();
@Override
public
String
getTemplateContent
(
String
panelPath
)
{
...
...
@@ -109,7 +110,7 @@ public class SnapshotServiceImpl implements SnapshotService {
for
(
CustomAttributes
customAttribute
:
customAttributes
)
{
text
=
customAttribute
.
getFieldUrl
();
if
(
StringUtils
.
isNotBlank
(
text
))
{
keySet
.
add
(
text
);
keySet
.
add
(
new
ValueVo
(
text
)
);
break
;
}
}
...
...
@@ -127,7 +128,7 @@ public class SnapshotServiceImpl implements SnapshotService {
String
value
=
customAttributes
.
getLabelId
();
if
(
StringUtils
.
isBlank
(
value
))
{
value
=
customAttributes
.
getFieldUrl
();
keySet
.
add
(
value
);
keySet
.
add
(
new
ValueVo
(
value
)
);
data
.
setValue
(
"${"
+
value
+
"}"
);
}
else
{
// /bctp/LT000070/
...
...
@@ -145,7 +146,7 @@ public class SnapshotServiceImpl implements SnapshotService {
for
(
CustomAttributes
customAttribute
:
customAttributes
)
{
text
=
customAttribute
.
getFieldUrl
();
if
(
StringUtils
.
isNotBlank
(
text
))
{
keySet
.
add
(
text
);
keySet
.
add
(
new
ValueVo
(
text
,
null
,
customAttribute
.
getCodeTable
())
);
break
;
}
}
...
...
@@ -161,7 +162,7 @@ public class SnapshotServiceImpl implements SnapshotService {
for
(
CustomAttributes
customAttribute
:
customAttributes
)
{
text
=
customAttribute
.
getFieldUrl
();
if
(
StringUtils
.
isNotBlank
(
text
))
{
keySet
.
add
(
text
+
":"
+
textboxBo
.
getFormat
(
));
keySet
.
add
(
new
ValueVo
(
text
,
textboxBo
.
getFormat
(),
null
));
break
;
}
}
...
...
@@ -178,7 +179,7 @@ public class SnapshotServiceImpl implements SnapshotService {
for
(
CustomAttributes
customAttribute
:
customAttributes
)
{
text
=
customAttribute
.
getFieldUrl
();
if
(
StringUtils
.
isNotBlank
(
text
))
{
keySet
.
add
(
text
);
keySet
.
add
(
new
ValueVo
(
text
)
);
break
;
}
}
...
...
@@ -202,21 +203,21 @@ public class SnapshotServiceImpl implements SnapshotService {
@Override
public
Set
<
String
>
getKeySet
()
{
public
Set
<
ValueVo
>
getKeySet
()
{
return
keySet
;
}
@Override
public
Map
<
String
,
Object
>
getValueMap
(
Set
<
String
>
keySet
,
IModule
parent
)
{
public
Map
<
String
,
Object
>
getValueMap
(
Set
<
ValueVo
>
keySet
,
IModule
parent
)
{
Map
<
String
,
Object
>
valueMap
=
new
HashMap
();
IModule
root
=
getRoot
(
parent
);
for
(
String
key
:
keySet
)
{
if
(
key
.
startsWith
(
"\\"
))
{
for
(
ValueVo
valueVo
:
keySet
)
{
if
(
valueVo
.
getKey
()
.
startsWith
(
"\\"
))
{
// 从根节点获取值
getValueFromModule
(
valueMap
,
root
,
key
);
getValueFromModule
(
valueMap
,
root
,
valueVo
);
}
else
{
getValueFromModule
(
valueMap
,
parent
,
key
);
getValueFromModule
(
valueMap
,
parent
,
valueVo
);
}
}
return
valueMap
;
...
...
@@ -242,16 +243,11 @@ public class SnapshotServiceImpl implements SnapshotService {
*
* @param valueMap
* @param parent
* @param
key
* @param
valueVo
*/
private
void
getValueFromModule
(
Map
<
String
,
Object
>
valueMap
,
IModule
parent
,
String
key
)
{
private
void
getValueFromModule
(
Map
<
String
,
Object
>
valueMap
,
IModule
parent
,
ValueVo
valueVo
)
{
String
key
=
valueVo
.
getKey
();
String
originKey
=
key
;
String
format
=
""
;
if
(
key
.
contains
(
":"
))
{
String
[]
split
=
key
.
split
(
":"
);
originKey
=
split
[
0
];
format
=
split
[
1
];
}
if
(
key
.
startsWith
(
"\\"
))
{
key
=
key
.
substring
(
1
);
}
...
...
@@ -274,9 +270,19 @@ public class SnapshotServiceImpl implements SnapshotService {
}
}
if
(
value
!=
null
&&
StringUtils
.
isNotBlank
(
format
))
{
value
=
DateUtil
.
format
((
Date
)
value
,
format
.
replaceAll
(
"/"
,
"-"
));
if
(
value
!=
null
)
{
String
format
=
valueVo
.
getFormat
();
String
codeTable
=
valueVo
.
getCodeTable
();
// 从码表中转换
if
(
StringUtils
.
isNotBlank
(
codeTable
))
{
value
=
MdaUtils
.
getCodetableLabel
(
codeTable
,
(
String
)
value
);
}
// 时间格式化
if
(
StringUtils
.
isNotBlank
(
format
)
&&
value
instanceof
Date
)
{
value
=
DateUtil
.
format
((
Date
)
value
,
format
.
replaceAll
(
"/"
,
"-"
));
}
}
valueMap
.
put
(
originKey
,
value
==
null
?
""
:
value
);
}
...
...
gjjs-bd-runtime/src/main/java/com/brilliance/mda/runtime/mda/snapshot/bo/ValueVo.java
0 → 100644
View file @
58867c4e
package
com
.
brilliance
.
mda
.
runtime
.
mda
.
snapshot
.
bo
;
import
lombok.Data
;
/**
* @Description
* @Author s_guodong
* @Date 2023/8/21
*/
@Data
public
class
ValueVo
{
private
String
key
;
private
String
format
;
private
String
codeTable
;
public
ValueVo
(
String
key
)
{
this
.
key
=
key
;
}
public
ValueVo
(
String
key
,
String
format
,
String
codeTable
)
{
this
.
key
=
key
;
this
.
format
=
format
;
this
.
codeTable
=
codeTable
;
}
}
gjjs-bd-runtime/src/main/java/com/brilliance/mda/runtime/mda/snapshot/bo/unpack/CustomAttributes.java
View file @
58867c4e
...
...
@@ -22,4 +22,7 @@ public class CustomAttributes {
@XmlAttribute
(
name
=
"fieldUrl"
)
private
String
fieldUrl
;
@XmlAttribute
(
name
=
"codeTable"
)
private
String
codeTable
;
}
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