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
a7847503
Commit
a7847503
authored
Sep 01, 2023
by
s_guodong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update
parent
a98a4dc6
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
57 additions
and
36 deletions
+57
-36
MdaContext.java
...ava/com/brilliance/mda/runtime/mda/driver/MdaContext.java
+0
-2
EmitterFactory.java
...liance/mda/runtime/mda/driver/compile/EmitterFactory.java
+21
-3
SnapshotServiceImpl.java
...lliance/mda/runtime/mda/snapshot/SnapshotServiceImpl.java
+4
-13
MdaUtils.java
...in/java/com/brilliance/mda/runtime/mda/util/MdaUtils.java
+2
-2
Systems.java
...ain/java/com/brilliance/mda/runtime/mda/util/Systems.java
+22
-5
XmlUtil.java
...ain/java/com/brilliance/mda/runtime/mda/util/XmlUtil.java
+3
-4
ResponseSet.java
...java/com/brilliance/mda/runtime/response/ResponseSet.java
+5
-7
No files found.
gjjs-bd-runtime/src/main/java/com/brilliance/mda/runtime/mda/driver/MdaContext.java
View file @
a7847503
...
...
@@ -16,8 +16,6 @@ import static com.brilliance.mda.runtime.mda.Constants.NO_ERROR;
public
class
MdaContext
implements
IContext
{
private
static
final
String
DISPLAY_TEMPLATE_PATH
=
"displayTemplate/"
;
private
transient
final
IDaoSession
daoSession
;
private
transient
final
EnvConfig
config
;
private
transient
final
IDisplay
display
;
...
...
gjjs-bd-runtime/src/main/java/com/brilliance/mda/runtime/mda/driver/compile/EmitterFactory.java
View file @
a7847503
...
...
@@ -5,17 +5,20 @@ import com.brilliance.mda.runtime.annotation.Transaction;
import
com.brilliance.mda.runtime.mda.driver.MdaScanner
;
import
com.brilliance.mda.runtime.mda.driver.compile.processor.ModuleAnnotationProcess
;
import
com.brilliance.mda.runtime.mda.driver.compile.processor.TransAnnotationProcessor
;
import
com.brilliance.mda.runtime.mda.util.Systems
;
import
com.brilliance.mda.support.td.ModuleInfoManager
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.InitializingBean
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.core.io.Resource
;
import
org.springframework.core.io.support.PathMatchingResourcePatternResolver
;
import
org.springframework.core.io.support.ResourcePatternResolver
;
import
org.springframework.stereotype.Component
;
import
java.util.HashMap
;
import
java.util.Map
;
import
java.util.Set
;
import
java.io.IOException
;
import
java.util.*
;
@Component
public
class
EmitterFactory
implements
InitializingBean
{
...
...
@@ -63,5 +66,20 @@ public class EmitterFactory implements InitializingBean {
log
.
info
(
"动态Emitter扫描包:{}"
,
scanPackage
);
String
[]
scanPackages
=
scanPackage
.
split
(
","
);
this
.
buildEmitter
(
scanPackages
);
log
.
info
(
"加载配置文件包displayTemplate..."
);
loadConfigResources
(
"classpath*:displayTemplate/*.*"
);
}
private
void
loadConfigResources
(
String
scanPackage
)
{
List
<
Resource
>
resources
=
Systems
.
getResources
();
// 加载配置文件
ResourcePatternResolver
resourcePatternResolver
=
new
PathMatchingResourcePatternResolver
();
try
{
resources
.
addAll
(
Arrays
.
asList
(
resourcePatternResolver
.
getResources
(
scanPackage
)));
}
catch
(
IOException
e
)
{
log
.
error
(
"加载配置文件{}出错"
,
scanPackage
,
e
);
}
}
}
gjjs-bd-runtime/src/main/java/com/brilliance/mda/runtime/mda/snapshot/SnapshotServiceImpl.java
View file @
a7847503
...
...
@@ -9,16 +9,15 @@ 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.DateUtils
;
import
com.brilliance.mda.runtime.mda.util.MdaUtils
;
import
com.brilliance.mda.runtime.mda.util.Systems
;
import
com.brilliance.mda.runtime.mda.util.XmlUtil
;
import
org.apache.commons.lang3.StringUtils
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.stereotype.Service
;
import
java.io.File
;
import
java.io.UnsupportedEncodingException
;
import
java.io.InputStream
;
import
java.lang.reflect.Method
;
import
java.net.URL
;
import
java.util.*
;
/**
...
...
@@ -30,8 +29,6 @@ import java.util.*;
public
class
SnapshotServiceImpl
implements
SnapshotService
{
private
static
Logger
log
=
LoggerFactory
.
getLogger
(
SnapshotServiceImpl
.
class
);
protected
static
final
String
DISPLAY_TEMPLATE_PATH
=
"displayTemplate/"
;
private
static
final
Set
<
ValueVo
>
keySet
=
new
HashSet
<>();
@Override
...
...
@@ -48,15 +45,9 @@ public class SnapshotServiceImpl implements SnapshotService {
@Override
public
DocumentBo
unpackTemplate
(
String
panelPath
)
{
URL
root
=
ClassLoader
.
getSystemResource
(
""
);
String
filePath
=
null
;
try
{
filePath
=
java
.
net
.
URLDecoder
.
decode
(
root
.
getPath
(),
"utf-8"
);
}
catch
(
UnsupportedEncodingException
e
)
{
}
File
file
=
new
File
(
filePath
+
DISPLAY_TEMPLATE_PATH
+
panelPath
+
".zul"
);
InputStream
resourceInputStream
=
Systems
.
getResourceInputStream
(
panelPath
+
".zul"
);
try
{
DocumentBo
documentBo
=
XmlUtil
.
unmarshToObjBinding
(
DocumentBo
.
class
,
file
);
DocumentBo
documentBo
=
XmlUtil
.
unmarshToObjBinding
(
DocumentBo
.
class
,
resourceInputStream
);
return
documentBo
;
}
catch
(
Exception
e
)
{
log
.
error
(
"模板{}解析失败"
,
panelPath
,
e
);
...
...
gjjs-bd-runtime/src/main/java/com/brilliance/mda/runtime/mda/util/MdaUtils.java
View file @
a7847503
...
...
@@ -68,8 +68,8 @@ public class MdaUtils {
if
(!
propfile
.
exists
())
{
String
pathToUse
=
StringUtils
.
cleanPath
(
name
);
IContext
ctx
=
MdaEnv
.
getContext
();
String
rootpath
=
ctx
.
getEnvConfig
().
getRootPath
(
);
pathToUse
=
pathToUse
.
substring
(
rootpath
.
length
());
String
rootpath
=
StringUtils
.
cleanPath
(
ctx
.
getEnvConfig
().
getRootPath
()
);
pathToUse
=
pathToUse
.
substring
(
pathToUse
.
indexOf
(
rootpath
)
+
rootpath
.
length
());
if
(
pathToUse
.
startsWith
(
"/"
))
{
pathToUse
=
pathToUse
.
substring
(
1
);
}
...
...
gjjs-bd-runtime/src/main/java/com/brilliance/mda/runtime/mda/util/Systems.java
View file @
a7847503
...
...
@@ -17,12 +17,9 @@ import org.apache.commons.lang3.StringUtils;
import
org.apache.commons.lang3.SystemUtils
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
com.brilliance.mda.runtime.mda.IStream
;
import
org.springframework.core.io.Resource
;
import
java.io.BufferedWriter
;
import
java.io.File
;
import
java.io.FileWriter
;
import
java.io.IOException
;
import
java.io.*
;
import
java.lang.reflect.Field
;
import
java.lang.reflect.Method
;
import
java.math.BigDecimal
;
...
...
@@ -38,6 +35,10 @@ public class Systems {
private
static
final
Logger
log
=
LoggerFactory
.
getLogger
(
Systems
.
class
);
private
static
final
List
<
Resource
>
resources
=
new
ArrayList
<>();
private
static
final
Map
<
String
,
InputStream
>
FILE_MAP
=
new
HashMap
<>();
public
static
void
setAttribute
(
IDatafield
field
,
String
ATTR
,
Object
val
)
{
setAttribute
(
field
.
getParent
(),
field
.
getName
(),
ATTR
,
val
);
}
...
...
@@ -1029,4 +1030,20 @@ public class Systems {
return
MdaEnv
.
getLang
();
}
public
static
List
<
Resource
>
getResources
()
{
return
resources
;
}
public
static
InputStream
getResourceInputStream
(
String
fileName
)
{
if
(
FILE_MAP
.
size
()
==
0
)
{
for
(
Resource
resource
:
resources
)
{
try
{
FILE_MAP
.
put
(
resource
.
getFilename
(),
resource
.
getInputStream
());
}
catch
(
IOException
e
)
{
}
}
}
return
FILE_MAP
.
get
(
fileName
);
}
}
gjjs-bd-runtime/src/main/java/com/brilliance/mda/runtime/mda/util/XmlUtil.java
View file @
a7847503
...
...
@@ -7,8 +7,7 @@ import javax.xml.bind.*;
import
javax.xml.parsers.SAXParserFactory
;
import
javax.xml.transform.Source
;
import
javax.xml.transform.sax.SAXSource
;
import
java.io.File
;
import
java.io.FileInputStream
;
import
java.io.InputStream
;
import
java.io.StringWriter
;
import
java.util.concurrent.ConcurrentHashMap
;
...
...
@@ -19,7 +18,7 @@ public class XmlUtil {
/**
* 将XML格式的文件转换成JAXB实现对象
*/
public
static
<
T
>
T
unmarshToObjBinding
(
Class
<
T
>
tclz
,
File
file
)
throws
Exception
{
public
static
<
T
>
T
unmarshToObjBinding
(
Class
<
T
>
tclz
,
InputStream
inputStream
)
throws
Exception
{
JAXBContext
jc
=
jaxbContextMap
.
get
(
tclz
);
if
(
jc
==
null
)
{
jc
=
JAXBContext
.
newInstance
(
tclz
);
...
...
@@ -29,7 +28,7 @@ public class XmlUtil {
sax
.
setNamespaceAware
(
false
);
XMLReader
xmlReader
=
sax
.
newSAXParser
().
getXMLReader
();
Source
source
=
new
SAXSource
(
xmlReader
,
new
InputSource
(
new
FileInputStream
(
file
)
));
inputStream
));
Object
obj
=
un
.
unmarshal
(
source
);
if
(
JAXBElement
.
class
.
isAssignableFrom
(
obj
.
getClass
()))
{
obj
=
(
T
)
JAXBIntrospector
.
getValue
(
obj
);
...
...
gjjs-bd-runtime/src/main/java/com/brilliance/mda/runtime/response/ResponseSet.java
View file @
a7847503
...
...
@@ -17,9 +17,8 @@ public class ResponseSet<T> {
/**
* 成功代码
*/
public
static
final
String
CODE_SUCCESS
=
"AAAAAA"
;
public
static
final
String
CODE_FAILURE
=
"BBBBBB"
;
public
static
final
String
MSG_SUCESS
=
"操作成功!"
;
public
static
final
String
CODE_SUCCESS
=
"AAAAAAA"
;
public
static
final
String
CODE_FAILURE
=
"ERR9999"
;
private
String
retcod
;
private
String
retmsg
;
...
...
@@ -27,7 +26,7 @@ public class ResponseSet<T> {
public
ResponseSet
(
IContext
ctx
,
Object
t
)
{
this
.
retcod
=
CODE_SUCCESS
;
this
.
retmsg
=
MSG_SU
CESS
;
this
.
retmsg
=
CODE_SUC
CESS
;
this
.
data
=
t
;
ctx
.
visitValues
();
MdaDriver
.
setValueToVO
(
ctx
,
this
.
data
);
...
...
@@ -46,7 +45,7 @@ public class ResponseSet<T> {
public
ResponseSet
(
Object
t
)
{
this
.
retcod
=
CODE_SUCCESS
;
this
.
retmsg
=
MSG_SU
CESS
;
this
.
retmsg
=
CODE_SUC
CESS
;
if
(
MdaEnv
.
getContext
()
!=
null
)
{
MdaEnv
.
getContext
().
visitValues
();
}
...
...
@@ -101,10 +100,9 @@ public class ResponseSet<T> {
}
}
static
final
String
FAIL_CODE
=
"999999"
;
public
static
ResponseSet
fail
(
String
message
)
{
ResponseSet
responseSet
=
new
ResponseSet
(
FAIL_COD
E
,
message
);
ResponseSet
responseSet
=
new
ResponseSet
(
CODE_FAILUR
E
,
message
);
return
responseSet
;
}
...
...
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