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
e214e52b
Commit
e214e52b
authored
Aug 25, 2024
by
gechengyang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
提交国际支付springboot初版
parent
f470a500
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
1672 additions
and
611 deletions
+1672
-611
pom.xml
gjjs-bd-business/pom.xml
+6
-0
Bd2poinnewApplication.java
...java/com/brilliance/bd2poinnew/Bd2poinnewApplication.java
+3
-1
XxxtskSchedued.java
...rc/main/java/com/brilliance/scheduled/XxxtskSchedued.java
+16
-0
Platform.java
...iness/src/main/java/com/ceb/gjjs/mda/global/Platform.java
+1633
-610
MyBatisDaoSession.java
...com/brilliance/mda/support/mybatis/MyBatisDaoSession.java
+10
-0
IDaoSession.java
...main/java/com/brilliance/mda/runtime/mda/IDaoSession.java
+4
-0
No files found.
gjjs-bd-business/pom.xml
View file @
e214e52b
...
...
@@ -118,6 +118,12 @@
<scope>
system
</scope>
<systemPath>
${pom.basedir}/lib/be-esb-core-2.0.jar
</systemPath>
</dependency>
<dependency>
<groupId>
com.brilliance
</groupId>
<artifactId>
gjjs-bd-runtime
</artifactId>
<version>
0.0.2
</version>
<scope>
compile
</scope>
</dependency>
</dependencies>
<build>
...
...
gjjs-bd-business/src/main/java/com/brilliance/bd2poinnew/Bd2poinnewApplication.java
View file @
e214e52b
...
...
@@ -3,9 +3,11 @@ package com.brilliance.bd2poinnew;
import
org.mybatis.spring.annotation.MapperScan
;
import
org.springframework.boot.SpringApplication
;
import
org.springframework.boot.autoconfigure.SpringBootApplication
;
import
org.springframework.scheduling.annotation.EnableScheduling
;
@SpringBootApplication
(
scanBasePackages
=
{
"com.brilliance.mda"
,
"com.ceb.gjjs.mda"
})
@SpringBootApplication
(
scanBasePackages
=
{
"com.brilliance.
scheduled"
,
"com.brilliance.
mda"
,
"com.ceb.gjjs.mda"
})
@MapperScan
({
"com.ceb.gjjs.mda.dao"
})
@EnableScheduling
public
class
Bd2poinnewApplication
{
public
static
void
main
(
String
[]
args
)
{
SpringApplication
.
run
(
Bd2poinnewApplication
.
class
,
args
);
...
...
gjjs-bd-business/src/main/java/com/brilliance/scheduled/XxxtskSchedued.java
0 → 100644
View file @
e214e52b
package
com
.
brilliance
.
scheduled
;
import
org.springframework.scheduling.annotation.Scheduled
;
import
org.springframework.stereotype.Component
;
import
java.time.LocalDateTime
;
@Component
public
class
XxxtskSchedued
{
@Scheduled
(
fixedRate
=
5000
)
// 或者使用cron表达式
public
void
reportCurrentTime
()
{
System
.
out
.
println
(
"The time is now "
+
LocalDateTime
.
now
());
}
}
gjjs-bd-business/src/main/java/com/ceb/gjjs/mda/global/Platform.java
View file @
e214e52b
...
...
@@ -19,7 +19,7 @@ public class Platform
private
static
Logger
log
=
LoggerFactory
.
getLogger
(
Platform
.
class
);
/**
* source:sysmod.@00
22
.script
* source:sysmod.@00
00
.script
*/
public
static
String
sdbCounter
(
String
name
)
{
...
...
@@ -30,861 +30,1884 @@ public class Platform
}
/**
* source:sysmod.@00
35
.script
* source:sysmod.@00
01
.script
*/
public
static
boolean
errorCloseCursor
(
String
messag
e
)
public
static
String
sdbCounter
(
IModule
modul
e
)
{
//取得上下文
IContext
ctx
=
MdaEnv
.
getContext
();
ctx
.
setErrorCode
(
NO_ERROR
);
ctx
.
getDaoSession
().
dbCloseCursor
(
);
ctx
.
setMessage
(
MdaUtils
.
getI18NString
(
"sysmod"
,
"CT000211"
),
message
);
return
false
;
IDatafield
<
String
>
inr
=
(
IDatafield
)
MdaDriver
.
getBaseObject
(
module
,
"inr"
);
inr
.
setValue
(
Platform
.
sdbCounter
(
MdaDriver
.
getModuleType
(
module
))
);
return
inr
.
getValue
()
;
}
/**
* source:sysmod.@00
36
.script
* source:sysmod.@00
05
.script
*/
public
static
Map
<
String
,
Object
>
getValueMap
(
IModule
mctx
,
String
transName
,
String
name
)
public
static
Argument
addArgumentNotEmpty
(
String
[]
colnam
,
IDatafield
...
datafield
)
{
//取得上下文
IContext
ctx
=
MdaEnv
.
getContext
();
ctx
.
setErrorCode
(
NO_ERROR
);
log
.
info
(
"{}"
,
"Platform.getValueMap Invoked..."
);
IModule
context
=
MdaDriver
.
getModule
(
mctx
,
"\\bimenu"
);
if
(
Platform
.
isXmlmapTransaction
(
transName
))
{
context
=
MdaDriver
.
getModule
(
mctx
,
"\\xmlmap"
);
}
if
(
context
==
null
)
context
=
mctx
;
String
fileName
=
MdaUtils
.
catPath
(
ctx
.
getEnvConfig
().
getRootPath
(),
"/cfg/"
+
transName
+
".properties"
);
log
.
info
(
"{}"
,
"fileName = "
+
fileName
)
;
String
keys
=
MdaUtils
.
getPropertyValue
(
fileName
,
name
);
Map
<
String
,
Object
>
values
=
new
HashMap
<
String
,
Object
>();
if
(
MdaUtils
.
isEmpty
(
keys
))
return
values
;
for
(
String
key:
keys
.
split
(
","
))
Argument
rlt
=
new
Argument
();
for
(
int
i
=
0
;
i
<
datafield
.
length
;
i
++)
{
String
path
=
MdaUtils
.
getPropertyValue
(
fileName
,
key
);
log
.
info
(
"{}"
,
key
+
"的取值路径为:"
+
path
+
","
);
if
(!
MdaUtils
.
isEmpty
(
path
))
values
.
put
(
key
,
Platform
.
getDatafieldValue
(
context
,
path
));
//by mkz for debug 19.03.04
//log.debug("存入" + key + "的值为:" + Platform.getDatafieldValue(context,path));
log
.
debug
(
"{}"
,
key
+
"取出的值为+==:"
+
values
.
get
(
key
)
+
","
);
if
(!
MdaUtils
.
isEmpty
(
datafield
[
i
]))
{
rlt
=
rlt
.
and
(
colnam
[
i
],
EQ
,
datafield
[
i
].
getValue
());
}
}
log
.
debug
(
"{}"
,
"values.size:"
+
values
.
size
());
values
.
put
(
"locale"
,
ctx
.
getLocale
());
return
values
;
return
rlt
;
}
/**
* source:sysmod.@00
37
.script
* source:sysmod.@00
02
.script
*/
public
static
Object
[]
getValues
(
IModule
mctx
,
String
transName
,
String
name
)
public
static
int
[]
getChcTime
(
int
total
)
{
//取得上下文
IContext
ctx
=
MdaEnv
.
getContext
();
ctx
.
setErrorCode
(
NO_ERROR
);
log
.
info
(
"{}"
,
"Platform.getValueMap Invoked..."
);
IModule
context
=
null
;
if
(!
Platform
.
isXmlmapTransaction
(
transName
))
{
log
.
debug
(
"{}"
,
"in bimenu "
);
context
=
MdaDriver
.
getModule
(
mctx
,
"\\bimenu"
);
}
else
{
log
.
debug
(
"{}"
,
"in xmlmap "
);
context
=
MdaDriver
.
getModule
(
mctx
,
"\\xmlmap"
);
}
if
(
context
==
null
)
context
=
mctx
;
String
fileName
=
MdaUtils
.
catPath
(
ctx
.
getEnvConfig
().
getRootPath
(),
"/cfg/"
+
transName
+
".properties"
);
String
keys
=
MdaUtils
.
getPropertyValue
(
fileName
,
name
);
if
(
MdaUtils
.
isEmpty
(
keys
))
return
new
Object
[]{};
List
<
Object
>
values
=
new
ArrayList
<
Object
>();
for
(
String
key:
keys
.
split
(
","
))
{
String
path
=
MdaUtils
.
getPropertyValue
(
fileName
,
key
);
if
(!
MdaUtils
.
isEmpty
(
path
))
values
.
add
(
Platform
.
getDatafieldValue
(
context
,
path
));
}
return
values
.
toArray
();
int
a
=
total
/
3600
;
int
b
=(
total
%
3600
)/
60
;
int
c
=
total
-
a
*
3600
-
b
*
60
;
int
temp
[]=
new
int
[
3
];
temp
[
0
]=
a
;
temp
[
1
]=
b
;
temp
[
2
]=
c
;
return
temp
;
}
/**
* source:sysmod.@00
38
.script
* source:sysmod.@00
03
.script
*/
public
static
Object
getDatafieldValue
(
IModule
context
,
String
path
)
public
static
Date
formatDateTime
(
Date
d
,
String
hhmmss
)
{
//取得上下文
IContext
ctx
=
MdaEnv
.
getContext
();
ctx
.
setErrorCode
(
NO_ERROR
);
log
.
info
(
"{}"
,
"&path==="
+
path
);
//log.debug("是否以”.“开头:" + path.startsWith("."));
Object
value
=
null
;
if
(
path
.
startsWith
(
"!"
))
value
=
path
.
substring
(
1
);
else
if
(
path
.
startsWith
(
".0"
))
{
if
(
MdaUtils
.
isEmpty
(
MdaDriver
.
getDatafield
(
context
,
path
.
substring
(
2
))))
return
value
;
value
=(
MdaDriver
.
getDatafield
(
context
,
path
.
substring
(
2
))).
getValue
();
log
.
info
(
"{}"
,
"value="
+
value
);
String
sql
=
"SELECT nam FROM pty WHERE cid='"
+
value
+
"'"
;
ctx
.
getDaoSession
().
dbExecuteSQL
(
sql
);
Argument
<
String
>
nam
=
new
Argument
<
String
>(
"nam"
);
ctx
.
getDaoSession
().
dbFetchFields
(
nam
);
ctx
.
getDaoSession
().
dbCloseCursor
();
if
(!
MdaUtils
.
isEmpty
(
nam
.
value
))
value
=
nam
.
value
;
return
value
;
}
else
if
(
path
.
startsWith
(
"."
))
{
//log.debug("path.value:" +Platform.getDatafield(context,path.substring(1)));
if
(
MdaUtils
.
isEmpty
(
MdaDriver
.
getDatafield
(
context
,
path
.
substring
(
1
))))
return
value
;
value
=(
MdaDriver
.
getDatafield
(
context
,
path
.
substring
(
1
))).
getValue
();
log
.
info
(
"{}"
,
"value="
+
value
);
List
<
CodetableItem
>
list
=(
List
<
CodetableItem
>)(
MdaDriver
.
getDatafield
(
null
,
"\\sysmod\\bchcodvals"
)).
getValue
();
if
(
MdaUtils
.
isEmpty
(
list
))
{
//by dg for debug...10.09
log
.
info
(
"{}"
,
"bchcod list is empty!"
);
return
value
;
}
for
(
CodetableItem
item:
list
)
{
log
.
info
(
"{}"
,
"item.getValue()="
+
item
.
getValue
());
if
(
item
.
getValue
().
equals
(
value
))
{
log
.
info
(
"{}"
,
"item="
+
item
.
getLabel
());
return
item
.
getLabel
();
}
}
}
else
if
(
path
.
startsWith
(
"*"
))
{
if
(
MdaUtils
.
isEmpty
(
MdaDriver
.
getDatafield
(
context
,
path
.
substring
(
1
))))
return
value
;
value
=(
MdaDriver
.
getDatafield
(
context
,
path
.
substring
(
1
))).
getValue
();
if
(
"X"
.
equals
(
value
))
return
"√"
;
}
else
if
(
path
.
startsWith
(
"?0"
))
{
//处理45A
String
rtvalue
=
""
;
String
[]
fields
=
path
.
substring
(
2
).
split
(
"\\?"
);
Map
<
String
,
IDatafield
>
flds
=
new
HashMap
<
String
,
IDatafield
>();
for
(
String
field:
fields
)
{
flds
.
put
(
field
.
substring
(
field
.
lastIndexOf
(
"\\"
)+
1
),
MdaDriver
.
getDatafield
(
context
,
field
));
}
//adlcnd
Object
adlcnd
=
flds
.
get
(
"adlcnd"
).
getValue
();
Object
nomton
=
flds
.
get
(
"nomton"
).
getValue
();
Object
nomflg
=
flds
.
get
(
"nomflg"
).
getValue
();
Object
nomtop
=
flds
.
get
(
"nomtop"
).
getValue
();
// log.debug("nomflg=="+nomflg.toString());
// log.debug("nomflg=="+nomflg);
if
(!
MdaUtils
.
isEmpty
(
nomflg
)&&
TRUE
.
equals
(
nomflg
.
toString
()))
{
rtvalue
=
"+Quantity And Amount "
;
if
(!
MdaUtils
.
isEmpty
(
nomtop
))
rtvalue
+=
nomtop
.
toString
()+
" PERCENT More "
;
if
(!
MdaUtils
.
isEmpty
(
nomton
))
{
if
(!
MdaUtils
.
isEmpty
(
nomtop
))
rtvalue
+=
" Or "
;
rtvalue
+=
nomton
.
toString
()+
" PERCENT Less"
;
}
rtvalue
+=
" Are Allowed"
;
}
if
(!
MdaUtils
.
isEmpty
(
adlcnd
))
if
(
rtvalue
==
null
||
""
.
equals
(
rtvalue
)
)
rtvalue
=
adlcnd
.
toString
();
else
rtvalue
+=
CR
+
adlcnd
.
toString
();
else
rtvalue
=
rtvalue
;
return
rtvalue
;
}
else
if
(
path
.
startsWith
(
"?1"
))
{
//处理47A
String
returnvalue
=
""
;
String
[]
fields
=
path
.
substring
(
2
).
split
(
"\\?"
);
Map
<
String
,
IDatafield
>
flds
=
new
HashMap
<
String
,
IDatafield
>();
for
(
String
field:
fields
)
{
flds
.
put
(
field
.
substring
(
field
.
lastIndexOf
(
"\\"
)+
1
),
MdaDriver
.
getDatafield
(
context
,
field
));
}
//adlcnd
Object
lcrgod
=
flds
.
get
(
"lcrgod"
).
getValue
();
Object
trdtrm
=
flds
.
get
(
"trdtrm"
).
getValue
();
Object
trdtrmplc
=
flds
.
get
(
"trdtrmplc"
).
getValue
();
Object
trdtrmver
=
flds
.
get
(
"trdtrmver"
).
getValue
();
if
(!
MdaUtils
.
isEmpty
(
lcrgod
))
returnvalue
=
lcrgod
.
toString
()+
CR
;
if
(!
MdaUtils
.
isEmpty
(
trdtrm
))
returnvalue
+=
"+Trade Terms: "
+
trdtrm
.
toString
();
if
(!
MdaUtils
.
isEmpty
(
trdtrmplc
))
returnvalue
+=
" "
+
trdtrmplc
.
toString
();
if
(!
MdaUtils
.
isEmpty
(
trdtrmver
))
returnvalue
+=
" "
+
trdtrmver
.
toString
();
return
returnvalue
.
trim
();
}
else
if
(
path
.
startsWith
(
"?7"
))
{
//处理进口代收,出口托收等申请书期限
String
returnvalue
=
""
;
String
[]
fields
=
path
.
substring
(
2
).
split
(
"\\?"
);
Map
<
String
,
IDatafield
>
flds
=
new
HashMap
<
String
,
IDatafield
>();
for
(
String
field:
fields
)
{
flds
.
put
(
field
.
substring
(
field
.
lastIndexOf
(
"\\"
)+
1
),
MdaDriver
.
getDatafield
(
context
,
field
));
}
//adrblk
Object
doctypcod
=
flds
.
get
(
"doctypcod"
).
getValue
();
Object
matpercnt
=
flds
.
get
(
"matpercnt"
).
getValue
();
Object
matpertyp
=
flds
.
get
(
"matpertyp"
).
getValue
();
Object
doctxt
=
flds
.
get
(
"mixdet"
).
getValue
();
if
(
"1"
.
equals
(
doctypcod
.
toString
())
||
"3"
.
equals
(
doctypcod
.
toString
())
)
if
(!
MdaUtils
.
isEmpty
(
matpercnt
))
returnvalue
=
matpercnt
+
" Days "
+
MdaUtils
.
getCodetableLabel
(
"matpertyp1"
,
matpertyp
.
toString
());
if
(
"4"
.
equals
(
doctypcod
.
toString
())
&&
doctxt
!=
null
)
returnvalue
=
doctxt
.
toString
();
return
returnvalue
.
trim
();
}
else
if
(
path
.
startsWith
(
"?8"
))
{
//处理进口代收,出口托收等申请书期限
String
returnvalue
=
""
;
String
[]
fields
=
path
.
substring
(
2
).
split
(
"\\?"
);
Map
<
String
,
IDatafield
>
flds
=
new
HashMap
<
String
,
IDatafield
>();
for
(
String
field:
fields
)
{
flds
.
put
(
field
.
substring
(
field
.
lastIndexOf
(
"\\"
)+
1
),
MdaDriver
.
getDatafield
(
context
,
field
));
}
//adrblk
Object
doctypcod
=
flds
.
get
(
"doctypcod"
).
getValue
();
Object
matpercnt
=
flds
.
get
(
"matpercnt"
).
getValue
();
Object
matpertyp
=
flds
.
get
(
"matpertyp"
).
getValue
();
Object
doctxt
=
flds
.
get
(
"doctxt"
).
getValue
();
if
(
"1"
.
equals
(
doctypcod
.
toString
())
||
"3"
.
equals
(
doctypcod
.
toString
())
)
if
(!
MdaUtils
.
isEmpty
(
matpercnt
))
returnvalue
=
matpercnt
+
" Days "
+
MdaUtils
.
getCodetableLabel
(
"matpertyp"
,
matpertyp
.
toString
());
if
(
"4"
.
equals
(
doctypcod
.
toString
())&&
doctxt
!=
null
)
returnvalue
=
doctxt
.
toString
();
return
returnvalue
.
trim
();
}
else
if
(
path
.
startsWith
(
"?9"
))
{
//处理出口信用证申请内容
String
returnvalue
=
""
;
String
[]
fields
=
path
.
substring
(
2
).
split
(
"\\?"
);
Map
<
String
,
IDatafield
>
flds
=
new
HashMap
<
String
,
IDatafield
>();
for
(
String
field:
fields
)
{
flds
.
put
(
field
.
substring
(
field
.
lastIndexOf
(
"\\"
)+
1
),
MdaDriver
.
getDatafield
(
context
,
field
));
}
//adrblk
Object
adrblk
=
flds
.
get
(
"adrblk"
).
getValue
();
Object
details
=
flds
.
get
(
"details"
).
getValue
();
if
(!
MdaUtils
.
isEmpty
(
adrblk
))
returnvalue
=
"THE BENEFICIARY HAS BEEN AMENDED TO "
+
adrblk
.
toString
()+
CR
;
if
(!
MdaUtils
.
isEmpty
(
details
))
returnvalue
+=
details
.
toString
();
return
returnvalue
.
trim
();
}
else
if
(
path
.
startsWith
(
"?r?n"
))
{
Object
fldVavle
=
(
MdaDriver
.
getDatafield
(
context
,
path
.
substring
(
4
))).
getValue
();
String
valueStr
=
""
;
if
(!
MdaUtils
.
isEmpty
(
fldVavle
))
{
valueStr
=
fldVavle
.
toString
();
if
(
valueStr
.
contains
(
"\n"
))
{
valueStr
=
valueStr
.
replace
(
"\n"
,
" "
);
}
if
(
valueStr
.
contains
(
"\r"
))
{
valueStr
=
valueStr
.
replace
(
"\r"
,
""
);
}
}
value
=
valueStr
;
}
else
if
(!
MdaUtils
.
isEmpty
(
MdaDriver
.
getDatafield
(
context
,
path
)))
value
=(
MdaDriver
.
getDatafield
(
context
,
path
)).
getValue
();
else
if
(
path
.
endsWith
(
"nomtop"
)
||
path
.
endsWith
(
"nomton"
))
value
=
"0"
;
return
value
;
if
(
d
==
null
)
d
=
MdaUtils
.
today
();
if
(
MdaUtils
.
isEmpty
(
hhmmss
)||
hhmmss
.
equals
(
"0"
))
hhmmss
=
"000000"
;
String
time
=
MdaUtils
.
format
(
d
,
"yyyyMMddHHmmss"
);
time
=
time
.
substring
(
0
,
8
);
time
=
time
+
hhmmss
;
//log.debug(time);
return
MdaUtils
.
parseDate
(
time
,
"yyyyMMddHHmmss"
);
}
/**
* source:sysmod.@00
65
.script
* source:sysmod.@00
08
.script
*/
public
static
Map
<
String
,
Object
>
convertContentToMap
(
IModule
mctx
,
Map
<
String
,
Object
>
data
,
String
transName
,
String
name
)
public
static
void
sdbRead
(
IModule
mod
,
String
inr
)
{
//取得上下文
IContext
ctx
=
MdaEnv
.
getContext
();
ctx
.
setErrorCode
(
NO_ERROR
);
/**
* 功能:将模型内容转换为指定的Map格式
* 参数: mctx - 配置中Datafield的相对模块
* transName- 转换配置的参数文件名称
* name - 配置文件中的字段定义,使用','隔开 ,默认为DATA
*/
ctx
.
getDaoSession
().
dbRead
(
mod
,
new
Argument
<
String
>(
"inr"
,
inr
));
int
errorcode
=
ctx
.
getErrorCode
();
return
;
}
log
.
info
(
"{}"
,
"sysmod.convertContentToMap Invoked..."
);
Map
<
String
,
Object
>
values
=
null
;
IModule
context
=
MdaDriver
.
getModule
(
mctx
,
"\\xmlmap"
);
int
errcod
=
ctx
.
getErrorCode
();
if
(
context
==
null
)
context
=
mctx
;
String
fileName
=
MdaUtils
.
catPath
(
ctx
.
getEnvConfig
().
getRootPath
(),
"/cfg/"
+
transName
+
".properties"
);
String
keys
=
MdaUtils
.
getPropertyValue
(
fileName
,
name
);
if
(
MdaUtils
.
isEmpty
(
keys
))
{
log
.
error
(
"{}"
,
"配置文件:"
+
fileName
+
" 未配置 "
+
name
+
" 项 ."
)
;
return
values
;
}
values
=
data
;
log
.
debug
(
"{}"
,
" keys: "
+
keys
)
;
for
(
String
key:
keys
.
split
(
","
))
/**
* source:sysmod.@0011.script
*/
public
static
String
sgetTransName
()
{
//取得上下文
IContext
ctx
=
MdaEnv
.
getContext
();
ctx
.
setErrorCode
(
NO_ERROR
);
String
tn
=
ctx
.
getTransName
();
if
(
MdaUtils
.
isEmpty
(
tn
))
return
tn
;
int
i
=
tn
.
indexOf
(
","
);
if
(
i
>=
0
)
{
log
.
debug
(
"{}"
,
"key = {"
+
key
+
"}"
);
String
path
=
MdaUtils
.
getPropertyValue
(
fileName
,
key
);
log
.
debug
(
"{}"
,
" sysmod.convertContentToMap : path = "
+
path
)
;
if
(!
MdaUtils
.
isEmpty
(
path
))
{
values
.
put
(
key
,
Platform
.
getDatafieldValue
(
context
,
path
));
log
.
debug
(
"{}"
,
"xmlMap:{ key="
+
key
+
", value="
+
Platform
.
getDatafieldValue
(
context
,
path
)+
" }"
)
;
}
tn
=
tn
.
substring
(
0
,
i
);
}
values
.
put
(
"locale"
,
ctx
.
getLocale
());
return
values
;
return
tn
;
}
/**
* source:sysmod.@00
73
.script
* source:sysmod.@00
12
.script
*/
public
static
Date
formatDateTime
(
Date
d
,
String
pattern
)
public
static
String
sgetTransParam
(
)
{
//取得上下文
IContext
ctx
=
MdaEnv
.
getContext
();
ctx
.
setErrorCode
(
NO_ERROR
);
if
(
d
==
null
)
String
tn
=
ctx
.
getTransName
();
if
(
MdaUtils
.
isEmpty
(
tn
))
return
""
;
int
i
=
tn
.
indexOf
(
","
);
if
(
i
>=
0
)
{
d
=
MdaUtils
.
today
(
);
tn
=
tn
.
substring
(
i
+
1
);
}
if
(
MdaUtils
.
isEmpty
(
pattern
)
||
"0"
.
equals
(
pattern
)
)
return
tn
;
}
/**
* source:sysmod.@0013.script
*/
public
static
String
sgetTransNameWithParam
(
String
param
)
{
//取得上下文
IContext
ctx
=
MdaEnv
.
getContext
();
ctx
.
setErrorCode
(
NO_ERROR
);
String
tn
=
Platform
.
sgetTransName
();
if
(
MdaUtils
.
isEmpty
(
param
))
{
pattern
=
"000000"
;
return
tn
;
}
String
time
=
MdaUtils
.
format
(
d
,
"yyyyMMddHHmmss"
);
time
=
time
.
substring
(
0
,
8
);
time
=
time
+
pattern
;
return
MdaUtils
.
parseDate
(
time
,
"yyyyMMddHHmmss"
);
return
tn
+
","
+
param
;
}
/**
* source:sysmod.@00
74
.script
* source:sysmod.@00
15
.script
*/
public
static
boolean
isXmlmapTransaction
(
String
transNam
)
public
static
String
sfixPreToken
(
String
value
,
String
token
,
int
len
)
{
//取得上下文
IContext
ctx
=
MdaEnv
.
getContext
();
ctx
.
setErrorCode
(
NO_ERROR
);
/*
* 用于判断来报通知是否从xmlmap中映射模块,以便于区分原来的bimenu
*/
log
.
debug
(
"{}"
,
" in isXmlmapTransaction "
+
transNam
);
boolean
ret
=
false
;
if
(!
MdaUtils
.
isEmpty
(
transNam
)
&&
(
"rptshw"
.
equals
(
transNam
)||
"ersshw"
.
equals
(
transNam
)
)
)
//用指定字符从前填充字符串到指定长度
// String value 要填充的字符串
// String token 填充字符
// int len 填充至长度
if
(
len
==
0
)
return
value
;
if
(
MdaUtils
.
isEmpty
(
value
))
value
=
""
;
value
=
value
.
trim
();
if
(
value
.
length
()>=
len
)
return
value
;
StringBuffer
sb
=
new
StringBuffer
(
len
);
sb
.
append
(
value
);
for
(
int
i
=
value
.
length
();
i
<
len
;
i
++)
{
ret
=
true
;
sb
.
insert
(
0
,
token
)
;
}
log
.
debug
(
"{}"
,
" out isXmlmapTransaction = "
+
ret
);
return
ret
;
return
sb
.
toString
(
);
}
/**
* source:sysmod.@0017.script
*/
public
static
boolean
falseAndRollback
()
{
//取得上下文
IContext
ctx
=
MdaEnv
.
getContext
();
ctx
.
setErrorCode
(
NO_ERROR
);
ctx
.
getDaoSession
().
dbRollback
();
return
false
;
}
/**
* source:sysmod.@00
79
.script
* source:sysmod.@00
18
.script
*/
public
static
boolean
isNoError
(
Map
msg
)
public
static
boolean
sdbLock
(
IModule
mod
)
{
//取得上下文
IContext
ctx
=
MdaEnv
.
getContext
();
ctx
.
setErrorCode
(
NO_ERROR
);
/*
* 判断是否没有错误,方便回滚或提交事务
*/
log
.
debug
(
"{}"
,
"in static sysmod.isNoError ... "
);
boolean
ret
=
true
;
if
(!
MdaUtils
.
isEmpty
(
msg
))
// 1本方法直接对module模块加锁。
// 2被加锁的模块不能是grp等数据集合只能是单表模块。
// 3此模块inr中必须有值
// 4此加锁方法按操作员登录名加锁,如果是系统服务启动时没有操作员不始于本方法。
if
(
MdaUtils
.
isEmpty
(
mod
))
return
false
;
IDatafield
inrd
=
MdaDriver
.
getDatafield
(
mod
,
"inr"
);
if
(
MdaUtils
.
isEmpty
(
inrd
))
return
false
;
String
typ
=
MdaDriver
.
getModuleType
(
mod
);
String
inr
=
inrd
.
getValue
().
toString
();
//log.debug("typ="+typ);
//log.debug("inr="+inr);
//log.debug("lockusr="+Platform.getLoginUser());
int
errorCode
=
ctx
.
getErrorCode
();
LockInfo
lock
=
ctx
.
getLocker
().
lock
(
MdaEnv
.
getLoginUser
(),
typ
+
inr
);
//log.debug("lockinfo="+l);
if
(
lock
==
null
)
return
false
;
errorCode
=
ctx
.
getErrorCode
();
//log.debug("lock errcode="+errorCode);
if
(
MdaEnv
.
getLoginUser
().
equals
(
lock
.
name
))
{
String
errcod
=(
String
)
msg
.
get
(
"ERRORCODE"
);
log
.
debug
(
"{}"
,
"msgErrcod = "
+
errcod
+
"."
);
if
(!
MdaUtils
.
isEmpty
(
errcod
)
&&
!
"00000"
.
equals
(
errcod
))
{
ret
=
false
;
}
return
true
;
}
return
ret
;
return
false
;
}
/**
* source:sysmod.@00
80
.script
* source:sysmod.@00
19
.script
*/
public
static
void
setErrorInfo
(
Map
<
String
,
Object
>
msgMap
,
String
errcod
,
String
errMsg
)
public
static
boolean
sdbUnLock
(
IModule
mod
)
{
//取得上下文
IContext
ctx
=
MdaEnv
.
getContext
();
ctx
.
setErrorCode
(
NO_ERROR
);
log
.
debug
(
"{}"
,
"in static sysmod setErrorInfo ... "
);
msgMap
.
put
(
"ERRORMSG"
,
errMsg
);
msgMap
.
put
(
"ERRORCODE"
,
errcod
);
log
.
error
(
"{}"
,
"错误码:"
+
errcod
+
", 错误描述"
+
errMsg
);
if
(
MdaUtils
.
isEmpty
(
mod
))
return
false
;
IDatafield
inrd
=
MdaDriver
.
getDatafield
(
mod
,
"inr"
);
if
(
MdaUtils
.
isEmpty
(
inrd
))
return
false
;
String
typ
=
MdaDriver
.
getModuleType
(
mod
);
String
inr
=
inrd
.
getValue
().
toString
();
//log.debug("unlk typ="+typ);
//log.debug("unlk inr="+inr);
//log.debug("unlk lockusr="+Platform.getLoginUser());
ctx
.
getLocker
().
unlock
(
MdaEnv
.
getLoginUser
(),
typ
+
inr
);
return
true
;
}
/**
* source:sysmod.@0
103
.script
* source:sysmod.@0
021
.script
*/
public
static
String
headBchcod
(
)
public
static
String
sdbInsert
(
IModule
module
)
{
//取得上下文
IContext
ctx
=
MdaEnv
.
getContext
();
ctx
.
setErrorCode
(
NO_ERROR
);
return
"08350000"
;
String
inr
=
Platform
.
sdbCounter
(
module
);
ctx
.
getDaoSession
().
dbInsert
(
module
);
return
inr
;
}
/**
* source:sysmod.@0
16
2.script
* source:sysmod.@0
02
2.script
*/
public
static
Map
execLocalScriptwithLog
(
String
comman
d
)
public
static
Argument
addStringArgumentOfLIKE
(
String
[]
colnam
,
IDatafield
...
datafiel
d
)
{
//取得上下文
IContext
ctx
=
MdaEnv
.
getContext
();
ctx
.
setErrorCode
(
NO_ERROR
);
/*
#! 执行command命令,返回执行是否成功标志flg和执行结果result组合成的map
#!========================================
#! 返回值: 执行是否成功标志flg和执行结果result组合成的map
#! 变量 : command 前台命令
#!========================================
*/
log
.
info
(
"{}"
,
"execLocalScript:"
+
command
);
Process
process
=
null
;
Map
map
=
new
HashMap
();
Boolean
flg
=
true
;
List
<
String
>
result
=
new
ArrayList
();
List
<
String
>
err
=
new
ArrayList
();
try
Argument
rlt
=
new
Argument
();
for
(
int
i
=
0
;
i
<
datafield
.
length
;
i
++)
{
process
=
Runtime
.
getRuntime
().
exec
(
command
);
process
.
waitFor
();
java
.
io
.
InputStream
is1
=
process
.
getInputStream
();
java
.
io
.
InputStreamReader
isr1
=
new
java
.
io
.
InputStreamReader
(
is1
);
java
.
io
.
BufferedReader
br1
=
new
java
.
io
.
BufferedReader
(
isr1
);
java
.
io
.
InputStream
is2
=
process
.
getErrorStream
();
java
.
io
.
InputStreamReader
isr2
=
new
java
.
io
.
InputStreamReader
(
is2
);
java
.
io
.
BufferedReader
br2
=
new
java
.
io
.
BufferedReader
(
isr2
);
String
line1
=
null
;
while
((
line1
=
br1
.
readLine
())
!=
null
)
{
result
.
add
(
line1
);
}
is1
.
close
();
isr1
.
close
();
br1
.
close
();
String
line2
=
null
;
while
((
line2
=
br2
.
readLine
())
!=
null
)
if
(!
MdaUtils
.
isEmpty
(
datafield
[
i
]))
{
err
.
add
(
line2
);
rlt
=
rlt
.
and
(
colnam
[
i
],
LIKE
,
"%"
+
datafield
[
i
]
+
"%"
);
}
is2
.
close
();
isr2
.
close
();
br2
.
close
();
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
flg
=
false
;
}
finally
{
if
(
process
!=
null
)
process
.
destroy
();
}
map
.
put
(
"flg"
,
flg
);
map
.
put
(
"result"
,
result
);
map
.
put
(
"error"
,
err
);
return
map
;
return
rlt
;
}
/**
* source:sysmod.@0
106
.script
* source:sysmod.@0
023
.script
*/
public
static
Object
[]
getValueSMS
(
IModule
mctx
,
String
transName
,
String
name
)
public
static
void
addError
(
IDatafield
idf
,
String
errcod
)
{
//取得上下文
IContext
ctx
=
MdaEnv
.
getContext
();
ctx
.
setErrorCode
(
NO_ERROR
);
log
.
info
(
"{}"
,
"Platform.getValueMap Invoked..."
);
IModule
context
=
null
;
if
(!
Platform
.
isXmlmapTransaction
(
transName
))
{
log
.
debug
(
"{}"
,
"in bimenu "
);
context
=
MdaDriver
.
getModule
(
mctx
,
"\\bimenu"
);
}
else
{
log
.
debug
(
"{}"
,
"in xmlmap "
);
context
=
MdaDriver
.
getModule
(
mctx
,
"\\xmlmap"
);
}
if
(
context
==
null
)
context
=
mctx
;
String
fileName
=
MdaUtils
.
catPath
(
ctx
.
getEnvConfig
().
getRootPath
(),
"/cfg/"
+
transName
+
".properties"
);
String
keys
=
MdaUtils
.
getPropertyValue
(
fileName
,
name
);
if
(
MdaUtils
.
isEmpty
(
keys
))
return
new
Object
[]{};
List
<
Object
>
values
=
new
ArrayList
<
Object
>();
for
(
String
key:
keys
.
split
(
","
))
/*
*传一个IDatafield,错误代码。如果错误码为空或为0则返回,否则判断IDatafield是否已经存在该错误,没有则添加
*/
if
(
MdaUtils
.
isEmpty
(
errcod
)
||
"0"
.
equals
(
errcod
))
return
;
String
err
=
""
;
if
(
idf
.
getValue
()!=
null
)
{
String
path
=
MdaUtils
.
getPropertyValue
(
fileName
,
key
);
if
(!
MdaUtils
.
isEmpty
(
path
))
values
.
add
(
Platform
.
getDatafieldValue
(
context
,
path
));
err
=
idf
.
getValue
().
toString
();
if
(
"0"
.
equals
(
err
))
{
err
=
""
;
}
}
return
values
.
toArray
();
if
(!
err
.
contains
(
errcod
))
err
+=
errcod
;
log
.
info
(
"{}"
,
"@@@@Error Code.................:"
+
errcod
);
idf
.
setValue
(
err
);
}
/**
* source:sysmod.@0
107
.script
* source:sysmod.@0
024
.script
*/
public
static
Object
[]
getValueSM
(
IModule
mctx
,
String
transName
,
String
name
)
public
static
String
transnullString
(
String
str
)
{
//取得上下文
IContext
ctx
=
MdaEnv
.
getContext
();
ctx
.
setErrorCode
(
NO_ERROR
);
log
.
info
(
"{}"
,
"Platform.getValueMap Invoked..."
);
IModule
context
=
null
;
if
(!
Platform
.
isXmlmapTransaction
(
transName
))
if
(
MdaUtils
.
isEmpty
(
str
))
{
log
.
debug
(
"{}"
,
"in bimenu "
);
context
=
MdaDriver
.
getModule
(
mctx
,
"\\bimenu"
);
return
""
;
}
else
{
log
.
debug
(
"{}"
,
"in xmlmap "
);
context
=
MdaDriver
.
getModule
(
mctx
,
"\\xmlmap"
);
}
if
(
context
==
null
)
context
=
mctx
;
String
fileName
=
MdaUtils
.
catPath
(
ctx
.
getEnvConfig
().
getRootPath
(),
"/cfg/"
+
transName
+
".properties"
);
String
keys
=
MdaUtils
.
getPropertyValue
(
fileName
,
name
);
String
files
=
MdaUtils
.
catPath
(
ctx
.
getEnvConfig
().
getRootPath
(),
"/cfg/"
+
"trdnam.properties"
);
String
vals
=
MdaUtils
.
getPropertyValue
(
files
,
transName
);
if
(
MdaUtils
.
isEmpty
(
keys
)
||
MdaUtils
.
isEmpty
(
vals
))
return
new
Object
[]{};
List
<
Object
>
values
=
new
ArrayList
<
Object
>();
for
(
String
key:
keys
.
split
(
","
))
{
String
path
=
MdaUtils
.
getPropertyValue
(
fileName
,
key
);
if
(!
MdaUtils
.
isEmpty
(
path
))
{
log
.
debug
(
"{}"
,
"Message="
+
Platform
.
getDatafieldValue
(
context
,
path
));
values
.
add
(
Platform
.
getDatafieldValue
(
context
,
path
));
}
}
for
(
String
val:
vals
.
split
(
","
))
{
String
conts
=
null
;
try
{
conts
=
new
String
(
val
.
getBytes
(
"ISO-8859-1"
),
"GBK"
);
log
.
debug
(
"{}"
,
"Message="
+
conts
);
}
catch
(
Exception
e
)
{
log
.
debug
(
"{}"
,
"----------------------------Chage Encoding Error------------------------------------------"
);
e
.
printStackTrace
();
return
str
;
}
values
.
add
(
conts
);
}
//获取所属核心机构号idc
Object
vas
=
null
;
String
bchp
=
transName
.
substring
(
0
,
2
).
trim
();
String
bch
=
bchp
+
"dgrp\\rec\\bchcod"
;
vas
=(
MdaDriver
.
getDatafield
(
context
,
bch
)).
getValue
();
String
sql
=
"SELECT distinct idc FROM pty WHERE cid='"
+
vas
+
"'"
;
ctx
.
getDaoSession
().
dbExecuteSQL
(
sql
);
Argument
<
String
>
idc
=
new
Argument
<
String
>(
"idc"
);
ctx
.
getDaoSession
().
dbFetchFields
(
idc
);
ctx
.
getDaoSession
().
dbCloseCursor
();
values
.
add
(
idc
.
value
);
//if(!Platform.isEmpty(idc.value))
//value = nam.value;
log
.
debug
(
"{}"
,
"idc 值 :"
+
idc
.
value
);
return
values
.
toArray
();
}
/**
* source:sysmod.@0
11
5.script
* source:sysmod.@0
02
5.script
*/
public
static
boolean
errorDeal
(
boolean
tips
,
String
message
,
boolean
rollback
)
public
static
void
removeError
(
IDatafield
idf
,
String
errcod
)
{
//取得上下文
IContext
ctx
=
MdaEnv
.
getContext
();
ctx
.
setErrorCode
(
NO_ERROR
);
/**
tips:true,需要调用Platform.message提示,内容为参数message;否则打印日志
rollback:true则回滚数据库事务,false只是返回
/*
*传一个IDatafield,错误代码。从该错误字段中移除错误代码
*/
int
errorno
=
ctx
.
getErrorCode
();
if
(
errorno
!=
NO_ERROR
)
{
if
(
tips
)
{
ctx
.
setMessage
(
MdaUtils
.
getI18NString
(
"sysmod"
,
"CT000363"
),
MdaUtils
.
getI18NString
(
"sysmod"
,
"CT000364"
));
}
else
{
log
.
error
(
"{}"
,
message
);
}
ctx
.
getDaoSession
().
dbRollback
();
return
false
;
}
return
true
;
if
(
MdaUtils
.
isEmpty
(
errcod
)
||
MdaUtils
.
isEmpty
(
idf
)||
MdaUtils
.
isEmpty
(
idf
.
getValue
()))
return
;
String
err
=
idf
.
getValue
().
toString
();
idf
.
setValue
(
err
.
replaceAll
(
errcod
,
""
));
log
.
debug
(
"{}"
,
"remove Error Code.................:"
+
errcod
);
}
/**
* source:sysmod.@0
125
.script
* source:sysmod.@0
026
.script
*/
public
static
boolean
isFromApp
(
)
public
static
boolean
equalsIgnore
(
String
source
,
String
target
,
boolean
digitalOnly
)
{
//取得上下文
IContext
ctx
=
MdaEnv
.
getContext
();
ctx
.
setErrorCode
(
NO_ERROR
);
String
terminalType
=
(
String
)
Platform
.
getLoginData
(
"__terminalType"
);
log
.
info
(
"{}"
,
"terminalType:"
+
terminalType
);
if
(
MdaUtils
.
isEmpty
(
terminalType
))
if
(
MdaUtils
.
isEmpty
(
source
))
return
false
;
if
(
"APP"
.
equals
(
terminalType
))
return
true
;
return
false
;
if
(
MdaUtils
.
isEmpty
(
target
))
return
false
;
if
(
digitalOnly
)
{
source
=
source
.
replaceAll
(
"\\D"
,
""
);
target
=
target
.
replaceAll
(
"\\D"
,
""
);
}
else
{
source
=
source
.
replaceAll
(
"[^a-zA-Z0-9]"
,
""
);
target
=
target
.
replaceAll
(
"[^a-zA-Z0-9]"
,
""
);
}
return
source
.
equalsIgnoreCase
(
target
);
}
/**
* source:sysmod.@0
126
.script
* source:sysmod.@0
027
.script
*/
public
static
boolean
indexGt
(
IDatafield
fld
,
String
str
)
public
static
String
format4Equals
(
String
value
,
boolean
digitalOnly
)
{
//取得上下文
IContext
ctx
=
MdaEnv
.
getContext
();
ctx
.
setErrorCode
(
NO_ERROR
);
boolean
bool
=
false
;
if
(
MdaUtils
.
isEmpty
(
fld
))
return
false
;
if
(
str
.
indexOf
((
String
)
fld
.
getValue
())>
0
)
bool
=
true
;
return
bool
;
if
(
MdaUtils
.
isEmpty
(
value
))
return
""
;
if
(
digitalOnly
)
{
return
value
.
replaceAll
(
"\\D"
,
""
);
}
else
return
value
.
replaceAll
(
"[^a-zA-Z0-9]"
,
""
).
toLowerCase
();
}
/**
* source:sysmod.@0
127
.script
* source:sysmod.@0
028
.script
*/
public
static
boolean
containsValue
(
IDatafield
fld
,
String
splstr
)
public
static
List
<
CodetableItem
>
getMtyList
()
//获取系统维护的报文类型下拉列表
{
//取得上下文
IContext
ctx
=
MdaEnv
.
getContext
();
ctx
.
setErrorCode
(
NO_ERROR
);
boolean
bool
=
false
;
if
(
MdaUtils
.
isEmpty
(
fld
))
return
false
;
String
[]
s
=
splstr
.
split
(
"-"
);
int
len
=
s
.
length
;
for
(
int
i
=
1
;
i
<
len
;
i
++)
//得到所有报文类型名称
List
<
CodetableItem
>
mtyList
=
new
ArrayList
<
CodetableItem
>();
//构造码表mtyList
ctx
.
getDaoSession
().
dbExecuteSQL
(
"SELECT mty FROM mfd WHERE tno=1 AND mty LIKE 'MT%' ORDER BY mty"
);
//执行sql语句查询记录
Argument
<
String
>
nam
=
new
Argument
<
String
>(
"mty"
);
//构造Label列nam
while
(
true
)
{
bool
=
((
String
)
fld
.
getValue
()).
contains
(
s
[
i
]);
if
(
bool
)
ctx
.
getDaoSession
().
dbFetchFields
(
nam
);
//逐条取出记录
int
errorCode
=
ctx
.
getErrorCode
();
//取出记录的执行结果
if
(
errorCode
==
NO_ERROR
)
{
String
mtyval
=
nam
.
value
;
if
(!
MdaUtils
.
isEmpty
(
mtyval
)&&
mtyval
.
length
()>
4
)
{
mtyval
=
mtyval
.
substring
(
3
);
mtyList
.
add
(
new
CodetableItem
(
mtyval
,
mtyval
));
}
}
else
{
break
;
}
}
return
bool
;
ctx
.
getDaoSession
().
dbCloseCursor
();
return
mtyList
;
}
/**
* source:sysmod.@0
128
.script
* source:sysmod.@0
031
.script
*/
public
static
boolean
isALLChinese
(
String
content
)
public
static
void
transAndCheckBIC
(
IDatafield
df
)
{
//取得上下文
IContext
ctx
=
MdaEnv
.
getContext
();
ctx
.
setErrorCode
(
NO_ERROR
);
if
(
MdaUtils
.
isEmpty
(
content
))
/*
* BIC输入转化好检查(BIC输入自动小写转大写,并作合法性检验)
* 1,将输入bic转化为大写
* 2,位数检查,不是4、8和11位的输入报错 位数不对返回2
* 3,位数正确查询数据库中是否存在此BIC 不合法返回3
* 4,完全合法返回1
- df 检查的输入域
- bic 检查的输入值
*/
if
(
MdaUtils
.
isEmpty
(
df
))
{
return
false
;
return
;
}
String
bic
=
(
String
)
df
.
getValue
();
log
.
debug
(
"{}"
,
"transAndCheckBIC: "
+
bic
);
if
(!
bic
.
matches
(
"[0-9A-Za-z]*"
))
{
ctx
.
setFieldError
(
df
,
MdaUtils
.
getI18NString
(
"sysmod"
,
"CT000104"
));
return
;
}
///判断字符串中是否全为中文字符
char
[]
charArr
=
content
.
toCharArray
();
Boolean
flag
=
true
;
for
(
int
i
=
0
;
i
<
charArr
.
length
;
i
++)
///小写转大写
String
biccopy
=
bic
.
toUpperCase
();
int
length
=
biccopy
.
length
();
///位数检查
if
(
length
==
11
||
length
==
8
||
length
==
4
)
{
//if(charArr[i] >= 0x4E00 && charArr[i] <= 0x9FA5)
if
(!(
charArr
[
i
]
>=
19968
&&
charArr
[
i
]
<=
40869
))
if
(
length
==
8
)
{
return
false
;
biccopy
+=
"XXX"
;
}
if
(
length
==
4
)
{
biccopy
+=
"XXXXXXX"
;
}
///合法性检查
Argument
<
String
>
inrarg
=
new
Argument
<
String
>(
"inr"
);
String
sql
=
"SELECT inr FROM pty WHERE extkey = '"
+
biccopy
+
"' "
+
"AND ptytyp LIKE '%B%'"
;
ctx
.
getDaoSession
().
dbExecuteSQL
(
sql
);
ctx
.
getDaoSession
().
dbFetchFields
(
inrarg
);
ctx
.
getDaoSession
().
dbCloseCursor
();
if
(
ctx
.
getErrorCode
()
==
NO_ERROR
)
{
df
.
setValue
(
biccopy
);
MdaUtils
.
setEmptyImpl
(
df
);
}
else
{
///bic不存在
ctx
.
setFieldError
(
df
,
MdaUtils
.
getI18NString
(
"sysmod"
,
"CT000105"
));
}
}
return
flag
;
else
{
ctx
.
setFieldError
(
df
,
MdaUtils
.
getI18NString
(
"sysmod"
,
"CT000156"
));
}
}
/**
* source:
wfmmod.@0002
.script
* source:
sysmod.@0033
.script
*/
public
static
boolean
errorHandle
(
IModule
wfe
,
String
reason
)
public
static
void
transAndCheckRef
(
IDatafield
df
)
{
//取得上下文
IContext
ctx
=
MdaEnv
.
getContext
();
ctx
.
setErrorCode
(
NO_ERROR
);
/*
*
功能:代替原来在mgrtsk交易下定义的函数 errorHandle.
*
参考号的自动小写转大写,以及格式检查
*/
log
.
error
(
"{}"
,
reason
);
IDatafield
<
String
>
sta
=(
IDatafield
)
wfe
.
get
(
"sta"
);
IDatafield
<
String
>
rtycnt
=(
IDatafield
)
wfe
.
get
(
"rtycnt"
);
if
(
MdaUtils
.
isEmpty
(
rtycnt
))
if
(
MdaUtils
.
isEmpty
(
df
))
{
sta
.
setValue
(
"R"
);
rtycnt
.
setValue
(
"1"
);
return
;
}
String
ref
=
(
String
)
df
.
getValue
();
if
(!
ref
.
matches
(
"[0-9a-zA-Z /-?().,’+{}]*"
))
{
ctx
.
setFieldError
(
df
,
MdaUtils
.
getI18NString
(
"sysmod"
,
"CT000144"
));
}
else
{
int
count
=
Integer
.
valueOf
(
rtycnt
.
getValue
());
if
(
count
>=
2
)
sta
.
setValue
(
"E"
);
rtycnt
.
setValue
(
String
.
valueOf
(
count
+
1
));
ref
=
ref
.
toUpperCase
();
df
.
setValue
(
ref
);
MdaUtils
.
setEmptyImpl
(
df
);
}
ctx
.
getDaoSession
().
dbBegin
();
ctx
.
getDaoSession
().
dbUpdate
(
wfe
);
ctx
.
getDaoSession
().
dbCommit
();
return
false
;
}
/**
* source:apldoc.@0011.script
* source:sysmod.@0034.script
*/
public
static
String
getLogicalTerminalAddress
(
String
bic
)
{
//取得上下文
IContext
ctx
=
MdaEnv
.
getContext
();
ctx
.
setErrorCode
(
NO_ERROR
);
if
(
MdaUtils
.
isEmpty
(
bic
))
return
null
;
if
(
bic
.
length
()
==
8
||
bic
.
length
()
==
11
||
bic
.
length
()
==
12
)
{
//判断是否使用测试BIC码
if
(!
Platform
.
isUsingTestBicCode
())
{
if
(
bic
.
length
()
==
11
)
{
return
bic
.
substring
(
0
,
8
)
+
"X"
+
bic
.
substring
(
8
,
11
);
}
else
if
(
bic
.
length
()
==
8
)
{
return
bic
.
substring
(
0
,
8
)
+
"XXXX"
;
}
else
return
bic
;
}
else
{
if
(
bic
.
length
()
==
11
)
{
return
bic
.
substring
(
0
,
7
)
+
"0X"
+
bic
.
substring
(
8
,
11
);
}
else
if
(
bic
.
length
()
==
8
)
{
return
bic
.
substring
(
0
,
7
)
+
"0XXXX"
;
}
else
return
bic
.
substring
(
0
,
7
)
+
"0"
+
bic
.
substring
(
8
);
}
}
else
return
null
;
}
/**
* source:sysmod.@0035.script
*/
public
static
void
setContractFlg
(
)
public
static
String
gerner202Ref
(
String
syscod
)
{
//取得上下文
IContext
ctx
=
MdaEnv
.
getContext
();
ctx
.
setErrorCode
(
NO_ERROR
);
/*
* 设置为申请PDF信息
传入 syscod,查询去其编号生成规则
根据202ref生成规则来生成ref
维护交易维护202ref生成规则,共16位规则
*/
return
null
;
}
/**
* source:
trnmod.@0025
.script
* source:
sysmod.@0036
.script
*/
public
static
String
sdbCounter
(
IModule
rec
)
public
static
String
changeCurToNum
(
String
cur
)
{
//取得上下文
IContext
ctx
=
MdaEnv
.
getContext
();
ctx
.
setErrorCode
(
NO_ERROR
);
IDatafield
<
String
>
inr
=(
IDatafield
)
MdaDriver
.
getBaseObject
(
rec
,
"inr"
);
inr
.
setValue
(
Platform
.
sdbCounter
(
rec
.
getName
()));
return
inr
.
getValue
();
String
sql
=
"SELECT numcod FROM cur WHERE cur=?"
;
Argument
<
String
>
curArg
=
new
Argument
<
String
>(
"numcod"
);
ctx
.
getDaoSession
().
dbExecuteSQL
(
sql
,
cur
);
ctx
.
getDaoSession
().
dbFetchFields
(
curArg
);
if
(
ctx
.
getErrorCode
()==
NO_ERROR
)
{
ctx
.
getDaoSession
().
dbCloseCursor
();
return
curArg
.
value
;
}
else
{
ctx
.
getDaoSession
().
dbCloseCursor
();
return
null
;
}
}
/**
* source:
bimenu.@0040
.script
* source:
sysmod.@0037
.script
*/
public
static
boolean
closeCursor
(
boolean
flag
)
public
static
String
getPropertyValues
(
String
propertyPath
,
String
key
)
{
//取得上下文
IContext
ctx
=
MdaEnv
.
getContext
();
ctx
.
setErrorCode
(
NO_ERROR
);
ctx
.
getDaoSession
().
dbCloseCursor
();
return
flag
;
String
value
=
""
;
value
=
MdaUtils
.
getPropertyValue
(
propertyPath
,
key
);
if
(
MdaUtils
.
isEmpty
(
value
))
value
=
""
;
log
.
debug
(
"{}"
,
key
+
":"
+
value
);
return
value
;
}
/**
* source:
xmlbod.@0004
.script
* source:
sysmod.@0038
.script
*/
public
static
Map
<
String
,
String
>
loadPropertyPart
(
String
transName
,
String
keyType
)
public
static
String
getAccountDate
(
)
{
//取得上下文
IContext
ctx
=
MdaEnv
.
getContext
();
ctx
.
setErrorCode
(
NO_ERROR
);
/*
* 功能:将配置文件中的映射关系初始化为map
* 获取当前会计日期
- 无
@ Date 当前会计日期 YYYYMMDD 格式
*/
log
.
debug
(
"{}"
,
" in static xmlbod.getDatafieldMapping ... "
)
;
Map
<
String
,
String
>
map
=
new
HashMap
<
String
,
String
>()
;
String
fileName
=
MdaUtils
.
catPath
(
ctx
.
getEnvConfig
().
getRootPath
(),
"/cfg/"
+
transName
+
".properties"
);
log
.
debug
(
"{}"
,
"fileName:"
+
fileName
);
if
(
MdaUtils
.
fileExists
(
fileName
))
Argument
<
String
>
accountDate
=
new
Argument
<
String
>(
"accdat"
);
String
sqlQuery
=
"SELECT accdat FROM dat"
;
ctx
.
getDaoSession
().
dbExecuteSQL
(
sqlQuery
);
ctx
.
getDaoSession
().
dbFetchFields
(
accountDate
);
int
errorcode
=
ctx
.
getErrorCode
();
ctx
.
getDaoSession
().
dbCloseCursor
();
if
(
errorcode
!=
NO_ERROR
)
{
String
keys
=
MdaUtils
.
getPropertyValue
(
fileName
,
keyType
);
if
(
MdaUtils
.
isEmpty
(
keys
))
log
.
error
(
"{}"
,
"getAccountDate with errorcode:"
+
errorcode
);
return
MdaUtils
.
format
(
MdaUtils
.
today
(),
"yyyyMMdd"
);
}
else
{
String
val
=
accountDate
.
value
;
if
(
val
==
null
)
{
log
.
error
(
"{}"
,
"
未配置 "
+
transName
+
".properties 中的 "
+
keyType
+
" 数据项 "
)
;
return
map
;
log
.
error
(
"{}"
,
"
getAccountDate is null,return today."
)
;
return
MdaUtils
.
format
(
MdaUtils
.
today
(),
"yyyyMMdd"
)
;
}
for
(
String
key:
keys
.
split
(
","
))
else
{
String
path
=
MdaUtils
.
getPropertyValue
(
fileName
,
key
);
if
(!
MdaUtils
.
isEmpty
(
path
))
map
.
put
(
key
,
path
);
log
.
debug
(
"{}"
,
"获取会计日期:"
+
val
);
return
val
;
}
}
log
.
debug
(
"{}"
,
" out static xmlbod.getDatafieldMapping ... "
)
;
return
map
;
}
/**
* source:sysmod.@0039.script
*/
public
static
String
sdbBopCounter
(
String
name
)
{
//取得上下文
IContext
ctx
=
MdaEnv
.
getContext
();
ctx
.
setErrorCode
(
NO_ERROR
);
return
MdaUtils
.
format
(
ctx
.
getDaoSession
().
dbCounter
(
name
),
"00"
);
}
/**
* source:
xmlbod.@0005
.script
* source:
sysmod.@0040
.script
*/
public
static
String
getRef
(
String
prefix
)
public
static
void
disableModule
(
IModule
im
,
List
<
String
>
exp
)
{
//取得上下文
IContext
ctx
=
MdaEnv
.
getContext
();
ctx
.
setErrorCode
(
NO_ERROR
);
/**
* 返回业务参考号,如LC-090817-0001)。
/*
*灰显一个模型的不包含exp在内的所有字段
-im 要灰显的模块
-exp 不要灰显的字段列表
@无
*/
Object
[]
idfs
=
im
.
getDatafields
().
toArray
();
for
(
Object
idf:
idfs
)
{
IDatafield
idfC
=
(
IDatafield
)
idf
;
String
idfNam
=
idfC
.
getName
();
if
(
exp
!=
null
&&
exp
.
contains
(
idfNam
))
continue
;
MdaUtils
.
setEmptyImpl
(
idfC
);
MdaUtils
.
setEmptyImpl
(
idfC
);
}
}
/**
* source:sysmod.@0041.script
*/
public
static
void
enableModule
(
IModule
im
,
List
<
String
>
exp
)
{
//取得上下文
IContext
ctx
=
MdaEnv
.
getContext
();
ctx
.
setErrorCode
(
NO_ERROR
);
/*
*亮显一个模型的不包含exp在内的所有字段
-im 要亮显的模块
-exp 不要亮显的字段列表
@无
*/
Object
[]
idfs
=
im
.
getDatafields
().
toArray
();
for
(
Object
idf:
idfs
)
{
IDatafield
idfC
=
(
IDatafield
)
idf
;
String
idfNam
=
idfC
.
getName
();
if
(
exp
!=
null
&&
exp
.
contains
(
idfNam
))
continue
;
MdaUtils
.
setEmptyImpl
(
idfC
);
MdaUtils
.
setEmptyImpl
(
idfC
);
}
}
/**
* source:sysmod.@0044.script
*/
public
static
String
getControlValue
(
String
key
)
{
//取得上下文
IContext
ctx
=
MdaEnv
.
getContext
();
ctx
.
setErrorCode
(
NO_ERROR
);
if
(
key
==
null
)
return
null
;
char
flag
=
'`'
;
String
sql
=
"SELECT val FROM ctl WHERE "
+
flag
+
"key"
+
flag
+
" = ?"
;
ctx
.
getDaoSession
().
dbExecuteSQL
(
sql
,
key
);
Argument
<
String
>
val
=
new
Argument
<
String
>(
"val"
);
String
valStr
=
null
;
ctx
.
getDaoSession
().
dbFetchFields
(
val
);
if
(
ctx
.
getErrorCode
()
==
NO_ERROR
)
{
valStr
=
val
.
value
;
}
ctx
.
getDaoSession
().
dbCloseCursor
();
return
valStr
;
}
/**
* source:sysmod.@0048.script
*/
public
static
void
writeUserLog
(
IModule
userLogModule
,
String
userName
,
String
operationName
,
String
operationStatus
)
{
//取得上下文
IContext
ctx
=
MdaEnv
.
getContext
();
ctx
.
setErrorCode
(
NO_ERROR
);
/*
* 写入用户操作日志
@ userLogModule usrlog模块
@ userName 操作用户
@ operationName 操作描述
@ operationStatus 操作状态 S - 成功, E - 失败
- 无
*/
String
ownref
=
""
;
if
(!
MdaUtils
.
isEmpty
(
prefix
))
MdaUtils
.
clear
(
userLogModule
);
IDatafield
field
=
MdaDriver
.
getDatafield
(
userLogModule
,
"nam"
);
field
.
setValue
(
userName
);
field
=
MdaDriver
.
getDatafield
(
userLogModule
,
"oprnam"
);
field
.
setValue
(
operationName
);
field
=
MdaDriver
.
getDatafield
(
userLogModule
,
"sta"
);
field
.
setValue
(
operationStatus
);
field
=
MdaDriver
.
getDatafield
(
userLogModule
,
"oprdattim"
);
field
.
setValue
(
MdaUtils
.
today
());
Platform
.
sdbInsert
(
userLogModule
);
int
errorcode
=
ctx
.
getErrorCode
();
log
.
debug
(
"{}"
,
"writeUserLog:["
+
userName
+
","
+
operationName
+
"] in status:"
+
operationStatus
+
" with errorcode:"
+
errorcode
);
}
/**
* source:sysmod.@0056.script
*/
public
static
String
getFirstRegStr
(
String
reg
,
String
str
)
{
//取得上下文
IContext
ctx
=
MdaEnv
.
getContext
();
ctx
.
setErrorCode
(
NO_ERROR
);
/*将符合正则表达式的第一个字串内容返回*/
if
(
str
==
null
)
return
null
;
Matcher
m
=
Pattern
.
compile
(
reg
).
matcher
(
str
);
if
(
m
.
find
())
return
m
.
group
();
else
return
null
;
}
/**
* source:sysmod.@0073.script
*/
public
static
Object
getDatabaseValue
(
String
tableName
,
String
fieldName
,
String
whereFieldName
,
Object
whereFieldValue
)
{
//取得上下文
IContext
ctx
=
MdaEnv
.
getContext
();
ctx
.
setErrorCode
(
NO_ERROR
);
String
sql
=
"SELECT "
+
fieldName
+
" FROM "
+
tableName
+
" WHERE "
+
whereFieldName
+
" = ? "
;
int
errorcode
=
ctx
.
getErrorCode
();
Argument
arg
=
new
Argument
(
fieldName
);
ctx
.
getDaoSession
().
dbExecuteSQL
(
sql
,
whereFieldValue
);
ctx
.
getDaoSession
().
dbFetchFields
(
arg
);
ctx
.
getDaoSession
().
dbCloseCursor
();
return
arg
.
value
;
}
/**
* source:sysmod.@0074.script
*/
public
static
void
disableDatafield
(
IDatafield
datafield
)
{
//取得上下文
IContext
ctx
=
MdaEnv
.
getContext
();
ctx
.
setErrorCode
(
NO_ERROR
);
MdaUtils
.
setEmptyImpl
(
datafield
);
MdaUtils
.
setEmptyImpl
(
datafield
);
}
/**
* source:sysmod.@0075.script
*/
public
static
void
enableDatafield
(
IDatafield
datafield
)
{
//取得上下文
IContext
ctx
=
MdaEnv
.
getContext
();
ctx
.
setErrorCode
(
NO_ERROR
);
MdaUtils
.
setEmptyImpl
(
datafield
);
MdaUtils
.
setEmptyImpl
(
datafield
);
}
/**
* source:sysmod.@0076.script
*/
public
static
void
clearDatafield
(
IDatafield
datafield
)
{
//取得上下文
IContext
ctx
=
MdaEnv
.
getContext
();
ctx
.
setErrorCode
(
NO_ERROR
);
MdaUtils
.
clear
(
datafield
);
MdaUtils
.
setEmptyImpl
(
datafield
);
}
/**
* source:sysmod.@0077.script
*/
public
static
IAttributeValue
[]
createStreamGridHeader
(
String
[]
titles
,
ViewType
[]
viewTypes
,
int
[]
lengths
)
{
//取得上下文
IContext
ctx
=
MdaEnv
.
getContext
();
ctx
.
setErrorCode
(
NO_ERROR
);
if
(
titles
.
length
!=
viewTypes
.
length
||
titles
.
length
!=
lengths
.
length
||
viewTypes
.
length
!=
lengths
.
length
)
{
log
.
debug
(
"{}"
,
"createStreamGridHeader 3个数组参数长度不一致."
);
return
null
;
}
int
length
=
titles
.
length
;
IAttributeValue
[]
attrValues
=
new
IAttributeValue
[
length
];
for
(
int
i
=
0
;
i
<
length
;
i
++)
{
attrValues
[
i
]
=
new
AttributeValue
(
titles
[
i
]);
}
return
attrValues
;
}
/**
* source:sysmod.@0079.script
*/
public
static
String
getKtpCodetableLabel
(
String
ktpNo
)
{
//取得上下文
IContext
ctx
=
MdaEnv
.
getContext
();
ctx
.
setErrorCode
(
NO_ERROR
);
Argument
<
String
>
ktpName
=
new
Argument
<
String
>(
"ktpnam"
);
ctx
.
getDaoSession
().
dbExecuteSQL
(
"SELECT KTPNAM FROM KTP WHERE KTPNO = ?"
,
ktpNo
);
ctx
.
getDaoSession
().
dbFetchFields
(
ktpName
);
//逐条取出记录
int
errorCode
=
ctx
.
getErrorCode
();
//取出记录的执行结果
ctx
.
getDaoSession
().
dbCloseCursor
();
if
(
MdaUtils
.
isEmpty
(
ktpName
.
value
))
return
""
;
else
return
ktpName
.
value
;
}
/**
* source:sysmod.@0083.script
*/
public
static
String
getCurrentChn
(
String
mps
)
{
//取得上下文
IContext
ctx
=
MdaEnv
.
getContext
();
ctx
.
setErrorCode
(
NO_ERROR
);
//获取当前渠道
if
(
MdaUtils
.
isEmpty
(
mps
))
return
null
;
ctx
.
getErrorCode
();
String
sql
=
"SELECT E.CHNCOD COD FROM MPE E WHERE E.MPSINR='"
+
mps
+
"' ORDER BY E.INR"
;
Argument
cod
=
new
Argument
<
String
>(
"COD"
);
List
codlst
=
new
ArrayList
();
ctx
.
getDaoSession
().
dbExecuteSQL
(
sql
);
while
(
true
)
{
ctx
.
getDaoSession
().
dbFetchFields
(
cod
);
if
(
ctx
.
getErrorCode
()==
NO_ERROR
)
{
codlst
.
add
(
cod
.
value
);
}
else
break
;
}
ctx
.
getDaoSession
().
dbCloseCursor
();
if
(
codlst
==
null
)
return
null
;
return
(
String
)
codlst
.
get
(
0
);
}
/**
* source:sysmod.@0084.script
*/
public
static
String
getUilCN
()
{
//取得上下文
IContext
ctx
=
MdaEnv
.
getContext
();
ctx
.
setErrorCode
(
NO_ERROR
);
return
"zh_CN"
;
}
/**
* source:sysmod.@0085.script
*/
public
static
String
[]
getCodetableKeyset
(
List
<
CodetableItem
>
ctl
)
{
//取得上下文
IContext
ctx
=
MdaEnv
.
getContext
();
ctx
.
setErrorCode
(
NO_ERROR
);
String
[]
keysets
=
new
String
[
ctl
.
size
()];
for
(
int
i
=
0
;
i
<
ctl
.
size
();
i
++)
{
CodetableItem
cti
=
ctl
.
get
(
i
);
keysets
[
i
]
=
cti
.
getValue
();
}
return
keysets
;
}
/**
* source:sysmod.@0086.script
*/
public
static
String
getListCodetableLabel
(
List
<
CodetableItem
>
ctl
,
String
value
)
{
//取得上下文
IContext
ctx
=
MdaEnv
.
getContext
();
ctx
.
setErrorCode
(
NO_ERROR
);
for
(
int
i
=
0
;
i
<
ctl
.
size
();
i
++)
{
CodetableItem
cti
=
ctl
.
get
(
i
);
if
(
cti
.
getValue
().
equals
(
value
))
return
cti
.
getLabel
();
}
return
""
;
}
/**
* source:sysmod.@0087.script
*/
public
static
List
<
Object
>
getModuleDatafieldsValue
(
IModule
module
)
{
//取得上下文
IContext
ctx
=
MdaEnv
.
getContext
();
ctx
.
setErrorCode
(
NO_ERROR
);
List
<
Object
>
contentList
=
new
ArrayList
<
Object
>();
java
.
lang
.
reflect
.
Field
[]
fields
=
module
.
getClass
().
getDeclaredFields
();
log
.
debug
(
"{}"
,
"datafields size:"
+
fields
.
length
);
for
(
int
i
=
0
;
i
<
fields
.
length
;
i
++)
{
try
{
Object
obj
=
fields
[
i
].
get
(
module
);
if
(!(
obj
instanceof
IDatafield
))
{
contentList
.
add
(
""
);
continue
;
}
IDatafield
datafield
=
(
IDatafield
)
obj
;
log
.
debug
(
"{}"
,
fields
[
i
].
getName
()
+
":"
+
datafield
.
getValue
());
contentList
.
add
(
datafield
.
getValue
());
}
catch
(
Exception
e
)
{
log
.
error
(
"{}"
,
e
);
continue
;
}
}
log
.
debug
(
"{}"
,
"contentList size:"
+
contentList
.
size
());
return
contentList
;
}
/**
* source:sysmod.@0088.script
*/
public
static
Argument
[]
setModuleDatafieldsValue
(
IModule
module
,
List
<
Object
>
contentList
)
{
//取得上下文
IContext
ctx
=
MdaEnv
.
getContext
();
ctx
.
setErrorCode
(
NO_ERROR
);
java
.
lang
.
reflect
.
Field
[]
fields
=
module
.
getClass
().
getDeclaredFields
();
//Argument [] arguments = new Argument[fields.length];
List
<
Argument
>
arguments
=
new
ArrayList
<
Argument
>();
log
.
debug
(
"{}"
,
"datafield size:"
+
fields
.
length
);
log
.
debug
(
"{}"
,
"contentList size:"
+
contentList
.
size
());
for
(
int
i
=
0
;
i
<
fields
.
length
;
i
++)
{
try
{
Object
obj
=
fields
[
i
].
get
(
module
);
if
(!(
obj
instanceof
IDatafield
))
continue
;
if
(!
MdaUtils
.
isEmpty
(
contentList
.
get
(
i
)))
{
log
.
debug
(
"{}"
,
fields
[
i
].
getName
()
+
":"
+
contentList
.
get
(
i
));
Argument
argument
=
new
Argument
(
fields
[
i
].
getName
(),
contentList
.
get
(
i
));
arguments
.
add
(
argument
);
}
}
catch
(
Exception
e
)
{
log
.
error
(
"{}"
,
e
);
continue
;
}
}
Argument
[]
argList
=
new
Argument
[
arguments
.
size
()];
for
(
int
i
=
0
;
i
<
arguments
.
size
();
i
++)
argList
[
i
]
=
arguments
.
get
(
i
);
return
argList
;
}
/**
* source:sysmod.@0089.script
*/
public
static
boolean
clears
(
Object
obj
)
{
//取得上下文
IContext
ctx
=
MdaEnv
.
getContext
();
ctx
.
setErrorCode
(
NO_ERROR
);
//这个函数为配合新的clear()函数而设计的,是对clear函数的一种多态设计
if
(
obj
==
null
)
return
true
;
if
(
obj
instanceof
IModule
)
{
IModule
imod
=(
IModule
)
obj
;
imod
.
clear
();
}
else
if
(
obj
instanceof
IModuleList
)
{
IModuleList
imodlst
=(
IModuleList
)
obj
;
if
(
MdaUtils
.
isEmpty
(
imodlst
))
return
false
;
int
sz
=
imodlst
.
size
()
-
1
;
log
.
info
(
"{}"
,
"imodlst size "
+
sz
+
1
);
for
(
int
i
=
sz
;
i
>=
0
;
i
--)
{
imodlst
.
remove
(
i
);
}
return
true
;
}
else
{
return
false
;
}
return
true
;
}
/**
* source:sysmod.@0090.script
*/
public
static
String
getValidBicCode
(
String
bic
)
{
//取得上下文
IContext
ctx
=
MdaEnv
.
getContext
();
ctx
.
setErrorCode
(
NO_ERROR
);
if
(
MdaUtils
.
isEmpty
(
bic
))
return
""
;
if
(!
bic
.
matches
(
"[0-9A-Za-z]*"
))
return
""
;
bic
=
bic
.
toUpperCase
();
///位数检查
if
(
bic
.
length
()
==
11
)
{
return
bic
;
}
else
if
(
bic
.
length
()
==
8
)
{
String
seq
=
prefix
+
MdaUtils
.
format
(
MdaUtils
.
today
(),
"yyMMdd"
);
ownref
=
seq
+
MdaUtils
.
format
(
ctx
.
getDaoSession
().
dbCounter
(
prefix
+
MdaUtils
.
format
(
MdaUtils
.
today
(),
"yy"
)),
"0000"
);
return
bic
+=
"XXX"
;
}
else
return
""
;
}
/**
* source:sysmod.@0093.script
*/
public
static
String
getInterfaceSequence
(
String
interfaceName
,
String
sector
)
{
//取得上下文
IContext
ctx
=
MdaEnv
.
getContext
();
ctx
.
setErrorCode
(
NO_ERROR
);
interfaceName
=
interfaceName
.
toUpperCase
();
sector
=
sector
.
toUpperCase
();
String
ownSystemCode
=
"99306"
;
String
month
=
MdaUtils
.
format
(
MdaUtils
.
today
(),
"yyMM"
);
String
sequenceName
=
interfaceName
+
sector
+
month
;
String
sequenceNumber
=
Platform
.
sdbCounter
(
sequenceName
,
"000000"
);
return
ownSystemCode
+
sector
+
month
+
sequenceNumber
;
}
/**
* source:sysmod.@0094.script
*/
public
static
String
sdbCounter
(
String
name
,
String
pattern
)
{
//取得上下文
IContext
ctx
=
MdaEnv
.
getContext
();
ctx
.
setErrorCode
(
NO_ERROR
);
return
MdaUtils
.
format
(
ctx
.
getDaoSession
().
dbCounter
(
name
),
pattern
);
}
/**
* source:sysmod.@0095.script
*/
public
static
String
getLogicInterfaceSequence
(
String
sector
)
{
//取得上下文
IContext
ctx
=
MdaEnv
.
getContext
();
ctx
.
setErrorCode
(
NO_ERROR
);
return
Platform
.
getInterfaceSequence
(
"LJJZ"
,
sector
);
}
/**
* source:sysmod.@0096.script
*/
public
static
Map
<
String
,
Object
>
callLogicInterface
(
Map
<
String
,
Object
>
map
)
{
//取得上下文
IContext
ctx
=
MdaEnv
.
getContext
();
ctx
.
setErrorCode
(
NO_ERROR
);
Map
<
String
,
Object
>
returnMap
=
(
Map
<
String
,
Object
>)
MdaUtils
.
invoke
(
"cn.com.brilliance.psbc.util.TexudoUtil"
,
"SendMessage"
,
map
);
return
returnMap
;
}
/**
* source:sysmod.@0097.script
*/
public
static
Map
<
String
,
Object
>
getOwnerNameByAccountInterface
(
String
account
)
{
//取得上下文
IContext
ctx
=
MdaEnv
.
getContext
();
ctx
.
setErrorCode
(
NO_ERROR
);
if
(
MdaUtils
.
isEmpty
(
account
))
return
null
;
Map
<
String
,
Object
>
map
=
new
HashMap
<
String
,
Object
>();
//交易类型码
if
(
account
.
startsWith
(
"FT"
))
{
map
.
put
(
"PCODE"
,
"633120"
);
}
else
map
.
put
(
"PCODE"
,
"633050"
);
//主账号/卡号
map
.
put
(
"ACCOUNT"
,
account
);
//交易属性
map
.
put
(
"TRADEFLAG"
,
"0"
);
//渠道标识
map
.
put
(
"CHNLNO"
,
"29"
);
//流水号
String
seqno
=
Platform
.
getLogicInterfaceSequence
(
"NQ"
);
map
.
put
(
"SEQNO"
,
seqno
);
//本地时间
map
.
put
(
"LOCALTIME"
,
MdaUtils
.
format
(
MdaUtils
.
today
(),
"hhmmss"
));
//本地日期
map
.
put
(
"LOCALDATE"
,
MdaUtils
.
format
(
MdaUtils
.
today
(),
"yyyyMMdd"
));
//会计日期
map
.
put
(
"CLEARDATE"
,
Platform
.
getAccountDate
());
//交易系统代码
map
.
put
(
"TRANSINST"
,
"99306000000"
);
//发信系统代码
map
.
put
(
"SENDINST"
,
"99306000000"
);
String
trace
=
"99306000000"
+
MdaUtils
.
format
(
MdaUtils
.
today
(),
"yyyyMMdd"
)
+
seqno
.
substring
(
2
);
map
.
put
(
"STD_SYS_TRACE_NO"
,
trace
);
//接收系统代码
map
.
put
(
"DESTINST"
,
"99700010000"
);
//交易机构代码/受卡方标识码,默认送总行机构码
map
.
put
(
"TRANBRANCH"
,
"11005293"
);
//柜员号,默认送11位数字
map
.
put
(
"OPRCODE"
,
"99311005293"
);
//MAC
map
.
put
(
"MAC"
,
"8C30A0J1"
);
Map
<
String
,
Object
>
returnMap
=
Platform
.
callLogicInterface
(
map
);
return
returnMap
;
}
/**
* source:sysmod.@0098.script
*/
public
static
void
convertString2IStream
(
String
str
,
IStream
is
)
{
//取得上下文
IContext
ctx
=
MdaEnv
.
getContext
();
ctx
.
setErrorCode
(
NO_ERROR
);
try
{
is
.
getOutputStream
().
write
(
str
.
getBytes
());
is
.
getOutputStream
().
flush
();
}
catch
(
Exception
e
)
{
log
.
error
(
"{}"
,
e
);
}
}
/**
* source:sysmod.@0099.script
*/
public
static
String
convertIStream2String
(
IStream
is
)
{
//取得上下文
IContext
ctx
=
MdaEnv
.
getContext
();
ctx
.
setErrorCode
(
NO_ERROR
);
try
{
return
org
.
apache
.
commons
.
io
.
IOUtils
.
toString
(
is
.
getInputStream
(),
"UTF-8"
);
}
catch
(
Exception
e
)
{
log
.
error
(
"{}"
,
e
);
}
return
null
;
}
/**
* source:sysmod.@0100.script
*/
public
static
BigDecimal
roundDecimal
(
BigDecimal
bigDecimal
,
int
round
)
{
//取得上下文
IContext
ctx
=
MdaEnv
.
getContext
();
ctx
.
setErrorCode
(
NO_ERROR
);
return
bigDecimal
.
setScale
(
round
,
java
.
math
.
BigDecimal
.
ROUND_HALF_UP
);
}
/**
* source:sysmod.@0102.script
*/
public
static
boolean
datafieldIsEmpty
(
IDatafield
datafield
)
{
//取得上下文
IContext
ctx
=
MdaEnv
.
getContext
();
ctx
.
setErrorCode
(
NO_ERROR
);
if
(
datafield
==
null
)
return
true
;
else
{
if
(
MdaUtils
.
isEmpty
(
datafield
))
return
true
;
else
return
false
;
}
}
/**
* source:sysmod.@0103.script
*/
public
static
void
copyValueExceptInListField
(
IModule
src
,
IModule
dst
,
List
<
String
>
exp
)
{
//取得上下文
IContext
ctx
=
MdaEnv
.
getContext
();
ctx
.
setErrorCode
(
NO_ERROR
);
if
(
exp
==
null
)
dst
.
copyValue
(
src
);
else
{
Object
[]
srcdfs
=
src
.
getDatafields
().
toArray
();
for
(
Object
sidf:
srcdfs
)
{
IDatafield
sidfv
=
(
IDatafield
)
sidf
;
String
sdfNam
=
sidfv
.
getName
();
if
(
exp
.
contains
(
sdfNam
))
continue
;
Object
[]
dstdfs
=
dst
.
getDatafields
().
toArray
();
for
(
Object
didf:
dstdfs
)
{
IDatafield
didfv
=
(
IDatafield
)
didf
;
String
ddfNam
=
didfv
.
getName
();
if
(
ddfNam
.
equals
(
sdfNam
))
didfv
.
setValue
(
sidfv
.
getValue
());
}
}
}
}
/**
* source:sysmod.@0104.script
*/
public
static
Date
getAccountDateTime
()
{
//取得上下文
IContext
ctx
=
MdaEnv
.
getContext
();
ctx
.
setErrorCode
(
NO_ERROR
);
String
date
=
Platform
.
getAccountDate
();
String
time
=
MdaUtils
.
format
(
MdaUtils
.
today
(),
"HHmmss"
);
date
=
date
+
" "
+
time
;
return
MdaUtils
.
parseDate
(
date
,
"yyyyMMdd HHmmss"
);
}
/**
* source:sysmod.@0105.script
*/
public
static
String
getPropertys
(
String
propertyPath
,
String
key
)
{
//取得上下文
IContext
ctx
=
MdaEnv
.
getContext
();
ctx
.
setErrorCode
(
NO_ERROR
);
String
value
=
""
;
value
=
MdaUtils
.
getPropertyValue
(
propertyPath
,
key
);
if
(
MdaUtils
.
isEmpty
(
value
))
value
=
""
;
log
.
debug
(
"{}"
,
key
+
":"
+
value
);
return
value
;
}
/**
* source:sysmod.@0106.script
*/
public
static
boolean
isUsingTestBicCode
()
{
//取得上下文
IContext
ctx
=
MdaEnv
.
getContext
();
ctx
.
setErrorCode
(
NO_ERROR
);
String
propertyPath
=
MdaUtils
.
catPath
(
ctx
.
getEnvConfig
().
getRootPath
(),
"cfg"
);
propertyPath
=
MdaUtils
.
catPath
(
propertyPath
,
"rcvsndmsg.properties"
);
String
propertyValue
=
Platform
.
getPropertys
(
propertyPath
,
"BankPostalUsingTestBic"
);
if
(!
MdaUtils
.
isEmpty
(
propertyValue
))
return
true
;
else
return
false
;
}
/**
* source:sysmod.@0107.script
*/
public
static
String
getBeforeAccountDate
()
{
//取得上下文
IContext
ctx
=
MdaEnv
.
getContext
();
ctx
.
setErrorCode
(
NO_ERROR
);
/*
* 获取前一会计日期
- 无
@ Date 前一会计日期 YYYYMMDD 格式
*/
Argument
<
String
>
accountDate
=
new
Argument
<
String
>(
"befdat"
);
String
sqlQuery
=
"SELECT befdat FROM dat"
;
ctx
.
getDaoSession
().
dbExecuteSQL
(
sqlQuery
);
ctx
.
getDaoSession
().
dbFetchFields
(
accountDate
);
int
errorcode
=
ctx
.
getErrorCode
();
ctx
.
getDaoSession
().
dbCloseCursor
();
if
(
errorcode
!=
NO_ERROR
)
{
log
.
error
(
"{}"
,
"getBeforeAccountDate with errorcode:"
+
errorcode
);
return
MdaUtils
.
format
(
MdaUtils
.
add
(
MdaUtils
.
parseDate
(
Platform
.
getAccountDate
(),
"yyyyMMdd"
),-
1
),
"yyyyMMdd"
);
}
else
{
String
val
=
accountDate
.
value
;
if
(
val
==
null
)
{
log
.
error
(
"{}"
,
"getBeforeAccountDate is null,return accountDate - 1."
);
return
MdaUtils
.
format
(
MdaUtils
.
add
(
MdaUtils
.
parseDate
(
Platform
.
getAccountDate
(),
"yyyyMMdd"
),-
1
),
"yyyyMMdd"
);
}
else
{
log
.
debug
(
"{}"
,
"获取前一会计日期:"
+
val
);
return
val
;
}
}
}
/**
* source:sysmod.@0108.script
*/
public
static
String
leftPad
(
String
source
,
String
charPad
,
int
fullLength
)
{
//取得上下文
IContext
ctx
=
MdaEnv
.
getContext
();
ctx
.
setErrorCode
(
NO_ERROR
);
//如果字符串是空
if
(
MdaUtils
.
isEmpty
(
source
))
{
String
padStr
=
""
;
for
(
int
i
=
0
;
i
<
fullLength
;
i
++)
padStr
+=
charPad
;
return
padStr
;
}
else
{
int
length
=
fullLength
-
source
.
length
();
if
(
length
<=
0
)
return
source
;
else
{
String
padStr
=
""
;
for
(
int
i
=
0
;
i
<
length
;
i
++)
padStr
+=
charPad
;
return
padStr
+
source
;
}
}
}
/**
* source:sysmod.@0110.script
*/
public
static
String
rightPad
(
String
source
,
String
charPad
,
int
fullLength
)
{
//取得上下文
IContext
ctx
=
MdaEnv
.
getContext
();
ctx
.
setErrorCode
(
NO_ERROR
);
//如果字符串是空
if
(
MdaUtils
.
isEmpty
(
source
))
{
String
padStr
=
""
;
for
(
int
i
=
0
;
i
<
fullLength
;
i
++)
padStr
+=
charPad
;
return
padStr
;
}
else
{
int
length
=
fullLength
-
source
.
length
();
if
(
length
<=
0
)
return
source
;
else
{
String
padStr
=
""
;
for
(
int
i
=
0
;
i
<
length
;
i
++)
padStr
+=
charPad
;
return
source
+
padStr
;
}
}
}
/**
* source:sysmod.@0111.script
*/
public
static
Argument
<
Date
>
getDateEqualArgument
(
String
columnName
,
Date
date
)
{
//取得上下文
IContext
ctx
=
MdaEnv
.
getContext
();
ctx
.
setErrorCode
(
NO_ERROR
);
Argument
<
Date
>
arg
=
new
Argument
<
Date
>(
columnName
,
GE
,
MdaUtils
.
sqlDate
(
date
,
GE
));
arg
=
arg
.
and
(
new
Argument
<
Date
>(
columnName
,
LE
,
MdaUtils
.
sqlDate
(
date
,
LE
)));
return
arg
;
}
/**
* source:sysmod.@0112.script
*/
public
static
String
replaceCharacter
(
String
charac
)
{
//取得上下文
IContext
ctx
=
MdaEnv
.
getContext
();
ctx
.
setErrorCode
(
NO_ERROR
);
if
(
MdaUtils
.
isEmpty
(
charac
))
return
""
;
return
charac
.
replaceAll
(
"\\D"
,
""
);
}
/**
* source:sysmod.@0115.script
*/
public
static
List
<
CodetableItem
>
getFMtyList
()
//获取系统维护的报文类型下拉列表
{
//取得上下文
IContext
ctx
=
MdaEnv
.
getContext
();
ctx
.
setErrorCode
(
NO_ERROR
);
//得到所有报文类型名称
List
<
CodetableItem
>
mtyList
=
new
ArrayList
<
CodetableItem
>();
//构造码表mtyList
ctx
.
getDaoSession
().
dbExecuteSQL
(
"SELECT mty FROM mfd WHERE tno=1 AND mty LIKE 'FMT%' ORDER BY mty"
);
//执行sql语句查询记录
Argument
<
String
>
nam
=
new
Argument
<
String
>(
"mty"
);
//构造Label列nam
while
(
true
)
{
ctx
.
getDaoSession
().
dbFetchFields
(
nam
);
//逐条取出记录
int
errorCode
=
ctx
.
getErrorCode
();
//取出记录的执行结果
if
(
errorCode
==
NO_ERROR
)
{
String
mtyval
=
nam
.
value
;
if
(!
MdaUtils
.
isEmpty
(
mtyval
)&&
mtyval
.
length
()>
5
)
{
mtyval
=
mtyval
.
substring
(
4
);
mtyList
.
add
(
new
CodetableItem
(
mtyval
,
mtyval
));
}
}
else
{
break
;
}
}
ctx
.
getDaoSession
().
dbCloseCursor
();
return
mtyList
;
}
/**
* source:sysmod.@0121.script
*/
public
static
String
getCfgPropertyValue
(
String
propertiesName
,
String
key
)
{
//取得上下文
IContext
ctx
=
MdaEnv
.
getContext
();
ctx
.
setErrorCode
(
NO_ERROR
);
String
propertyPath
=
MdaUtils
.
catPath
(
ctx
.
getEnvConfig
().
getRootPath
(),
"cfg"
);
propertyPath
=
MdaUtils
.
catPath
(
propertyPath
,
propertiesName
);
log
.
debug
(
"{}"
,
"propertyPath:"
+
propertyPath
);
return
MdaUtils
.
getPropertyValue
(
propertyPath
,
key
);
}
/**
* source:sysmod.@0124.script
*/
public
static
String
getRelStbtbl
(
String
stbtbl
,
String
etyinr
)
{
//取得上下文
IContext
ctx
=
MdaEnv
.
getContext
();
ctx
.
setErrorCode
(
NO_ERROR
);
String
rtn
=
""
;
String
sql
=
"SELECT tbl FROM sth WHERE tbl LIKE '"
+
stbtbl
+
"%' "
;
if
(
"00000001"
.
equals
(
etyinr
))
{
sql
=
sql
+
" AND ( etyinr = '"
+
etyinr
+
"' OR etyinr is null ) "
;
}
else
sql
=
sql
+
" AND etyinr = '"
+
etyinr
+
"' "
;
ctx
.
getErrorCode
();
ctx
.
getDaoSession
().
dbExecuteSQL
(
sql
);
if
(
ctx
.
getErrorCode
()==
NO_ERROR
)
{
Argument
<
String
>
tbl
=
new
Argument
<
String
>(
"tbl"
);
ctx
.
getDaoSession
().
dbFetchFields
(
tbl
);
if
(
ctx
.
getErrorCode
()==
NO_ERROR
)
{
rtn
=
tbl
.
value
;
}
ctx
.
getDaoSession
().
dbCloseCursor
();
}
return
rtn
;
}
/**
* source:sysmod.@0137.script
*/
public
static
String
urlDecode
(
String
str
)
{
//取得上下文
IContext
ctx
=
MdaEnv
.
getContext
();
ctx
.
setErrorCode
(
NO_ERROR
);
return
java
.
net
.
URLDecoder
.
decode
(
str
);
}
/**
* source:sysmod.@0138.script
*/
public
static
String
urlEncode
(
String
str
)
{
//取得上下文
IContext
ctx
=
MdaEnv
.
getContext
();
ctx
.
setErrorCode
(
NO_ERROR
);
return
java
.
net
.
URLEncoder
.
encode
(
str
);
}
/**
* source:sysmod.@0139.script
*/
public
static
Map
<
String
,
String
>
commonSendDEA
(
Map
<
String
,
String
>
data
)
{
//取得上下文
IContext
ctx
=
MdaEnv
.
getContext
();
ctx
.
setErrorCode
(
NO_ERROR
);
Map
<
String
,
String
>
rtndata
=
(
Map
<
String
,
String
>)
MdaUtils
.
invoke
(
"com.brilliance.inner.interf.CommonSend"
,
"send"
,
data
);
log
.
debug
(
"{}"
,
"调用接口返回:"
+
rtndata
);
return
rtndata
;
}
/**
* source:sysmod.@0141.script
*/
public
static
List
<
CodetableItem
>
getBchList
()
{
//取得上下文
IContext
ctx
=
MdaEnv
.
getContext
();
ctx
.
setErrorCode
(
NO_ERROR
);
//得到所有报文类型名称
List
<
CodetableItem
>
bchList
=
new
ArrayList
<
CodetableItem
>();
//构造码表mtyList
ctx
.
getDaoSession
().
dbExecuteSQL
(
"SELECT bchkey,nam FROM bch"
);
//执行sql语句查询记录
Argument
<
String
>
nam
=
new
Argument
<
String
>(
"nam"
);
//构造Label列nam
Argument
<
String
>
key
=
new
Argument
<
String
>(
"bchkey"
);
while
(
true
)
{
ctx
.
getDaoSession
().
dbFetchFields
(
nam
,
key
);
//逐条取出记录
int
errorCode
=
ctx
.
getErrorCode
();
//取出记录的执行结果
if
(
errorCode
==
NO_ERROR
)
{
String
bchnam
=
nam
.
value
;
String
bchkey
=
key
.
value
;
String
bchnam_bchkey
=
bchkey
+
"-"
+
bchnam
;
bchList
.
add
(
new
CodetableItem
(
bchnam_bchkey
,
bchkey
));
}
else
{
break
;
}
}
ctx
.
getDaoSession
().
dbCloseCursor
();
return
bchList
;
}
/**
* source:sysmod.@0145.script
*/
public
static
String
[]
findMessagePty
(
String
mty
,
String
ref
)
{
//取得上下文
IContext
ctx
=
MdaEnv
.
getContext
();
ctx
.
setErrorCode
(
NO_ERROR
);
return
(
String
[])
MdaUtils
.
invoke
(
"com.brilliance.p21.P21"
,
"getPty"
,
mty
,
ref
);
}
/**
* source:sysmod.@0147.script
*/
public
static
boolean
isZHBch
(
String
bch
)
{
//取得上下文
IContext
ctx
=
MdaEnv
.
getContext
();
ctx
.
setErrorCode
(
NO_ERROR
);
//判断是否是总行用户
if
(
"043400"
.
equals
(
bch
))
return
true
;
else
return
false
;
}
/**
* source:sysmod.@0148.script
*/
public
static
void
mdbInsert
(
IModule
module
)
{
//取得上下文
IContext
ctx
=
MdaEnv
.
getContext
();
ctx
.
setErrorCode
(
NO_ERROR
);
//String db = (String)Platform.getStoredData("BeginDB."+Platform.getModuleRoot()+Platform.addThreadIdIfIsBackground());
//Platform.mdbConnect(db);
Platform
.
delCharTerm
(
module
);
ctx
.
getDaoSession
().
dbInsert
(
module
);
}
/**
* source:sysmod.@0149.script
*/
public
static
void
mdbUpdate
(
IModule
module
)
{
//取得上下文
IContext
ctx
=
MdaEnv
.
getContext
();
ctx
.
setErrorCode
(
NO_ERROR
);
//String db = (String)Platform.getStoredData("BeginDB."+getModuleRoot()+Platform.addThreadIdIfIsBackground());
//Platform.mdbConnect(db);
Platform
.
delCharTerm
(
module
);
ctx
.
getDaoSession
().
dbUpdate
(
module
);
}
/**
* source:sysmod.@0150.script
*/
public
static
void
mstreamSave
(
IStream
stream
,
String
fileName
)
{
//取得上下文
IContext
ctx
=
MdaEnv
.
getContext
();
ctx
.
setErrorCode
(
NO_ERROR
);
try
{
java
.
io
.
File
file
=
new
java
.
io
.
File
(
fileName
);
if
(!
file
.
getParentFile
().
exists
())
{
file
.
getParentFile
().
mkdirs
();
}
try
{
org
.
sss
.
util
.
ContainerUtils
.
copy
(
stream
.
getInputStream
(),
new
java
.
io
.
FileOutputStream
(
file
));
stream
.
close
();
}
catch
(
Exception
e1
)
{
log
.
error
(
"{}"
,
"mstreamSave CopyOrClose error."
);
}
//将文件上传到文件服务器
//boolean rtn = Platform.fsUpload(fileName);
//if(!rtn)
//{
// log.error("mstreamSave fsUpload error.");
//}
}
catch
(
Exception
e
)
{
log
.
error
(
"{}"
,
"mstreamSave error."
,
e
);
}
}
/**
* source:sysmod.@0152.script
*/
public
static
void
mstreamLoad
(
IStream
stream
,
String
fileName
)
{
//取得上下文
IContext
ctx
=
MdaEnv
.
getContext
();
ctx
.
setErrorCode
(
NO_ERROR
);
//将文件内容写入stream流中
try
{
stream
.
close
();
java
.
io
.
File
file
=
null
;
try
{
file
=
new
java
.
io
.
File
(
fileName
);
if
(
file
!=
null
&&
file
.
length
()
>
0
)
{
log
.
info
(
"{}"
,
"local file exists,trying streamLoad."
);
org
.
sss
.
util
.
ContainerUtils
.
copy
(
new
java
.
io
.
FileInputStream
(
file
),
stream
.
getOutputStream
());
}
else
{
log
.
info
(
"{}"
,
"local file unexists,trying streamLoad from fileserver."
);
//从文件服务器下载文件
file
=
Platform
.
fsDownload
(
fileName
);
if
(
file
!=
null
&&
file
.
length
()
>
0
)
{
log
.
info
(
"{}"
,
"fileserver exists,trying streamLoad."
);
org
.
sss
.
util
.
ContainerUtils
.
copy
(
new
java
.
io
.
FileInputStream
(
file
),
stream
.
getOutputStream
());
}
}
/*}
catch(Exception e1)
{
//从文件服务器下载文件
file = Platform.fsDownload(fileName);
if(file == null)
{
log.error("mstreamLoad fsDownload error.");
}
}*/
}
catch
(
Exception
e2
)
{
log
.
error
(
"{}"
,
"mstreamLoad copy error."
);
}
}
catch
(
Exception
e
)
{
log
.
error
(
"{}"
,
"mstreamLoad error."
,
e
);
}
}
/**
* source:sysmod.@0153.script
*/
public
static
void
delCharTerm
(
IModule
module
)
{
//取得上下文
IContext
ctx
=
MdaEnv
.
getContext
();
ctx
.
setErrorCode
(
NO_ERROR
);
/**
**删除String字段中的字符串终止符,postgresql的varchar字段中不允许出现字符串终止符
**/
java
.
lang
.
reflect
.
Field
[]
fields
=
module
.
getClass
().
getDeclaredFields
();
for
(
int
i
=
0
;
i
<
fields
.
length
;
i
++)
{
try
{
Object
obj
=
fields
[
i
].
get
(
module
);
if
(
obj
instanceof
IDatafield
)
{
IDatafield
<
String
>
idf
=(
IDatafield
)
obj
;
Object
value
=
idf
.
getValue
();
if
(
value
!=
null
&&
(
value
instanceof
String
)
&&
((
String
)
value
).
contains
(
"\0"
))
idf
.
setValue
(((
String
)
value
).
replace
(
"\0"
,
""
));
}
}
catch
(
Exception
e
)
{
continue
;
}
}
}
/**
* source:sysmod.@0154.script
*/
public
synchronized
static
String
addThreadIdIfIsBackground
()
{
//取得上下文
IContext
ctx
=
MdaEnv
.
getContext
();
ctx
.
setErrorCode
(
NO_ERROR
);
if
(
MdaUtils
.
isBackground
())
{
return
String
.
valueOf
(
Thread
.
currentThread
().
getId
());
}
else
{
return
""
;
}
}
/**
* source:sysmod.@0155.script
*/
public
static
java
.
io
.
File
fsDownload
(
String
fileName
)
{
//取得上下文
IContext
ctx
=
MdaEnv
.
getContext
();
ctx
.
setErrorCode
(
NO_ERROR
);
/**
**从文件服务器下载文件
**参数为文件存储的路径
**/
byte
[]
buffer
=
null
;
java
.
io
.
File
file
=
null
;
Object
object
=
MdaUtils
.
invoke
(
"cn.com.brilliance.psbc.client.imp.FileImp"
,
"fsDownload"
,
fileName
);
if
(
MdaUtils
.
isEmpty
(
object
)||
object
==
null
)
{
log
.
info
(
"{}"
,
"fsDownload from fileserver is null."
);
//file = null;
}
else
{
log
.
info
(
"{}"
,
"fsDownload from fileserver is notnull."
);
buffer
=
(
byte
[])
object
;
file
=
new
java
.
io
.
File
(
fileName
);
try
{
if
(!
file
.
exists
())
{
int
lastIndex
=
fileName
.
lastIndexOf
(
"/"
);
if
(
lastIndex
>
0
)
{
String
path
=
fileName
.
substring
(
0
,
lastIndex
);
java
.
io
.
File
dir
=
new
java
.
io
.
File
(
path
);
if
(!
dir
.
exists
())
{
dir
.
mkdirs
();
}
}
file
.
createNewFile
();
}
java
.
io
.
FileOutputStream
fos
=
new
java
.
io
.
FileOutputStream
(
file
);
try
{
fos
.
write
(
buffer
);
fos
.
close
();
}
catch
(
Exception
e
)
{
//e.printStackTrace();
log
.
error
(
"{}"
,
"fsDownload writeOrClose error."
);
}
}
catch
(
Exception
e1
)
{
//e1.printStackTrace();
log
.
error
(
"{}"
,
"fsDownload error."
);
}
}
return
ownref
;
return
file
;
}
...
...
gjjs-bd-mybatis-support/src/main/java/com/brilliance/mda/support/mybatis/MyBatisDaoSession.java
View file @
e214e52b
...
...
@@ -396,6 +396,11 @@ public class MyBatisDaoSession extends AbstractDaoSession implements IDaoSession
}
@Override
public
<
T
extends
IModule
>
int
dbReadset
(
IModuleList
<
T
>
list
,
int
maxSize
,
Argument
...
args
)
{
return
0
;
}
@Override
public
int
dbCounter
(
String
seqname
)
{
return
this
.
counter
.
dbCounter
(
seqname
);
}
...
...
@@ -430,6 +435,11 @@ public class MyBatisDaoSession extends AbstractDaoSession implements IDaoSession
}
@Override
public
void
dbReadset
(
IModuleList
list
,
int
maxSize
)
{
}
@Override
public
String
dbName
()
{
return
sqlSessionTemplate
.
getConfiguration
().
getDatabaseId
();
}
...
...
gjjs-bd-runtime/src/main/java/com/brilliance/mda/runtime/mda/IDaoSession.java
View file @
e214e52b
...
...
@@ -25,6 +25,8 @@ public interface IDaoSession {
@SuppressWarnings
(
"rawtypes"
)
<
T
extends
IModule
>
int
dbReadset
(
IModuleList
<
T
>
list
,
Argument
...
args
);
<
T
extends
IModule
>
int
dbReadset
(
IModuleList
<
T
>
list
,
int
maxSize
,
Argument
...
args
);
<
T
extends
IModule
>
int
dbReadset
(
ModuleList
<
T
>
list
,
CacheOption
cacheOption
,
Argument
...
args
);
<
T
extends
IModule
>
int
dbReadset
(
IModuleList
<
T
>[]
list
,
CacheOption
cacheOption
,
String
whereSql
,
Object
[]
param
);
...
...
@@ -61,6 +63,8 @@ public interface IDaoSession {
void
dbReadset
(
IModuleList
list
,
int
maxSize
,
String
sql
);
void
dbReadset
(
IModuleList
list
,
int
maxSize
);
String
dbName
();
List
<
String
>
dbColumnNames
();
...
...
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