Commit cc45a34b by s_guodong

调试 acdopn.save交易

parent 8e3d76d0
......@@ -103,6 +103,13 @@
<scope>system</scope>
<systemPath>${pom.basedir}/lib/eibs-container-3.5.0.jar</systemPath>
</dependency>
<dependency>
<groupId>com.brilliance</groupId>
<artifactId>be-esb-core</artifactId>
<version>2.0</version>
<scope>system</scope>
<systemPath>${pom.basedir}/lib/be-esb-core-2.0.jar</systemPath>
</dependency>
</dependencies>
<build>
......
package com.ceb.gjjs.mda.global;
import java.util.*;
import java.math.BigDecimal;
import com.brilliance.mda.runtime.mda.*;
import com.brilliance.mda.runtime.mda.impl.*;
import com.brilliance.mda.runtime.annotation.*;
import com.brilliance.mda.runtime.mda.driver.*;
import static com.brilliance.mda.runtime.mda.Constants.*;
import com.brilliance.mda.runtime.mda.util.*;
import com.ceb.gjjs.mda.bo.*;
import java.util.regex.*;
import com.brilliance.mda.runtime.mda.CodetableItem;
import com.brilliance.mda.runtime.mda.IContext;
import com.brilliance.mda.runtime.mda.IDatafield;
import com.brilliance.mda.runtime.mda.IModule;
import com.brilliance.mda.runtime.mda.driver.MdaDriver;
import com.brilliance.mda.runtime.mda.driver.MdaEnv;
import com.brilliance.mda.runtime.mda.impl.Argument;
import com.brilliance.mda.runtime.mda.util.MdaUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class Platform
{
private static Logger log = LoggerFactory.getLogger(Platform.class);
/**
* source:sysmod.@0022.script
*/
public static String sdbCounter(String name)
{
//取得上下文
IContext ctx = MdaEnv.getContext();
ctx.setErrorCode(NO_ERROR);
return MdaUtils.format(ctx.getDaoSession().dbCounter(name),"00000000");
}
/**
* source:sysmod.@0035.script
*/
public static boolean errorCloseCursor(String message)
{
//取得上下文
IContext ctx = MdaEnv.getContext();
ctx.setErrorCode(NO_ERROR);
ctx.getDaoSession().dbCloseCursor();
ctx.setMessage(MdaUtils.getI18NString("sysmod","CT000211"),message);
return false;
}
/**
* source:sysmod.@0036.script
*/
public static Map<String,Object> getValueMap(IModule mctx,String transName,String name)
{
//取得上下文
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(","))
{
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) + ",");
}
log.debug("{}","values.size:" + values.size());
values.put("locale",ctx.getLocale());
return values;
}
/**
* source:sysmod.@0037.script
*/
public static Object[] getValues(IModule mctx,String transName,String name)
{
//取得上下文
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();
}
/**
* source:sysmod.@0038.script
*/
public static Object getDatafieldValue(IModule context,String path)
{
//取得上下文
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;
}
/**
* source:sysmod.@0065.script
*/
public static Map<String,Object> convertContentToMap(IModule mctx,Map<String,Object> data,String transName,String name)
{
//取得上下文
IContext ctx = MdaEnv.getContext();
ctx.setErrorCode(NO_ERROR);
/**
* 功能:将模型内容转换为指定的Map格式
* 参数: mctx - 配置中Datafield的相对模块
* transName- 转换配置的参数文件名称
* name - 配置文件中的字段定义,使用','隔开 ,默认为DATA
*/
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(","))
{
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)+ " }") ;
}
}
values.put("locale",ctx.getLocale());
return values;
}
/**
* source:sysmod.@0073.script
*/
public static Date formatDateTime (Date d ,String pattern)
{
//取得上下文
IContext ctx = MdaEnv.getContext();
ctx.setErrorCode(NO_ERROR);
if(d==null)
{
d = MdaUtils.today();
}
if(MdaUtils.isEmpty(pattern) || "0".equals(pattern) )
{
pattern = "000000";
}
String time = MdaUtils.format(d,"yyyyMMddHHmmss");
time = time.substring(0,8);
time = time + pattern;
return MdaUtils.parseDate(time,"yyyyMMddHHmmss");
}
/**
* source:sysmod.@0074.script
*/
public static boolean isXmlmapTransaction(String transNam)
{
//取得上下文
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) ) )
{
ret = true;
}
log.debug("{}"," out isXmlmapTransaction = " + ret );
return ret;
}
/**
* source:sysmod.@0079.script
*/
public static boolean isNoError(Map msg)
{
//取得上下文
IContext ctx = MdaEnv.getContext();
ctx.setErrorCode(NO_ERROR);
/*
* 判断是否没有错误,方便回滚或提交事务
*/
log.debug("{}","in static sysmod.isNoError ... ");
boolean ret = true ;
if(!MdaUtils.isEmpty(msg))
{
String errcod =(String) msg.get("ERRORCODE");
log.debug("{}","msgErrcod = " + errcod +".");
if(!MdaUtils.isEmpty(errcod) && !"00000".equals(errcod))
{
ret = false;
}
}
return ret;
}
import java.util.*;
/**
* source:sysmod.@0080.script
*/
public static void setErrorInfo(Map<String,Object> msgMap, String errcod, String errMsg)
{
//取得上下文
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);
}
import static com.brilliance.mda.runtime.mda.Constants.*;
public class Platform {
private static Logger log = LoggerFactory.getLogger(Platform.class);
/**
* source:sysmod.@0022.script
*/
public static String sdbCounter(String name) {
//取得上下文
IContext ctx = MdaEnv.getContext();
ctx.setErrorCode(NO_ERROR);
return MdaUtils.format(ctx.getDaoSession().dbCounter(name), "00000000");
}
/**
* source:sysmod.@0035.script
*/
public static boolean errorCloseCursor(String message) {
//取得上下文
IContext ctx = MdaEnv.getContext();
ctx.setErrorCode(NO_ERROR);
ctx.getDaoSession().dbCloseCursor();
ctx.setMessage(MdaUtils.getI18NString("sysmod", "CT000211"), message);
return false;
}
/**
* source:sysmod.@0036.script
*/
public static Map<String, Object> getValueMap(IModule mctx, String transName, String name) {
//取得上下文
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(",")) {
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) + ",");
}
log.debug("{}", "values.size:" + values.size());
values.put("locale", ctx.getLocale());
return values;
}
/**
* source:sysmod.@0037.script
*/
public static Object[] getValues(IModule mctx, String transName, String name) {
//取得上下文
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();
}
/**
* source:sysmod.@0038.script
*/
public static Object getDatafieldValue(IModule context, String path) {
//取得上下文
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;
}
/**
* source:sysmod.@0065.script
*/
public static Map<String, Object> convertContentToMap(IModule mctx, Map<String, Object> data, String transName, String name) {
//取得上下文
IContext ctx = MdaEnv.getContext();
ctx.setErrorCode(NO_ERROR);
/**
* source:sysmod.@0103.script
*/
public static String headBchcod()
{
//取得上下文
IContext ctx = MdaEnv.getContext();
ctx.setErrorCode(NO_ERROR);
return "08350000";
}
* 功能:将模型内容转换为指定的Map格式
* 参数: mctx - 配置中Datafield的相对模块
* transName- 转换配置的参数文件名称
* name - 配置文件中的字段定义,使用','隔开 ,默认为DATA
*/
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(",")) {
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) + " }");
}
}
/**
* source:sysmod.@0162.script
*/
public static Map execLocalScriptwithLog(String command)
{
//取得上下文
IContext ctx = MdaEnv.getContext();
ctx.setErrorCode(NO_ERROR);
values.put("locale", ctx.getLocale());
return values;
}
/**
* source:sysmod.@0073.script
*/
public static Date formatDateTime(Date d, String pattern) {
//取得上下文
IContext ctx = MdaEnv.getContext();
ctx.setErrorCode(NO_ERROR);
if (d == null) {
d = MdaUtils.today();
}
if (MdaUtils.isEmpty(pattern) || "0".equals(pattern)) {
pattern = "000000";
}
String time = MdaUtils.format(d, "yyyyMMddHHmmss");
time = time.substring(0, 8);
time = time + pattern;
return MdaUtils.parseDate(time, "yyyyMMddHHmmss");
}
/**
* source:sysmod.@0074.script
*/
public static boolean isXmlmapTransaction(String transNam) {
//取得上下文
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))) {
ret = true;
}
log.debug("{}", " out isXmlmapTransaction = " + ret);
return ret;
}
/**
* source:sysmod.@0079.script
*/
public static boolean isNoError(Map msg) {
//取得上下文
IContext ctx = MdaEnv.getContext();
ctx.setErrorCode(NO_ERROR);
/*
* 判断是否没有错误,方便回滚或提交事务
*/
log.debug("{}", "in static sysmod.isNoError ... ");
boolean ret = true;
if (!MdaUtils.isEmpty(msg)) {
String errcod = (String) msg.get("ERRORCODE");
log.debug("{}", "msgErrcod = " + errcod + ".");
if (!MdaUtils.isEmpty(errcod) && !"00000".equals(errcod)) {
ret = false;
}
}
return ret;
}
/**
* source:sysmod.@0080.script
*/
public static void setErrorInfo(Map<String, Object> msgMap, String errcod, String errMsg) {
//取得上下文
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);
}
/**
* source:sysmod.@0103.script
*/
public static String headBchcod() {
//取得上下文
IContext ctx = MdaEnv.getContext();
ctx.setErrorCode(NO_ERROR);
return "08350000";
}
/**
* source:sysmod.@0162.script
*/
public static Map execLocalScriptwithLog(String command) {
//取得上下文
IContext ctx = MdaEnv.getContext();
ctx.setErrorCode(NO_ERROR);
/*
#! 执行command命令,返回执行是否成功标志flg和执行结果result组合成的map
#!========================================
......@@ -485,422 +429,378 @@ public class Platform
#! 变量 : 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
{
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)
{
err.add(line2);
}
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;
}
/**
* source:sysmod.@0106.script
*/
public static Object[] getValueSMS(IModule mctx,String transName,String name)
{
//取得上下文
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();
}
/**
* source:sysmod.@0107.script
*/
public static Object[] getValueSM(IModule mctx,String transName,String name)
{
//取得上下文
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);
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();
}
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.@0115.script
*/
public static boolean errorDeal(boolean tips,String message,boolean rollback)
{
//取得上下文
IContext ctx = MdaEnv.getContext();
ctx.setErrorCode(NO_ERROR);
/**
tips:true,需要调用Platform.message提示,内容为参数message;否则打印日志
rollback:true则回滚数据库事务,false只是返回
*/
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;
}
/**
* source:sysmod.@0125.script
*/
public static boolean isFromApp()
{
//取得上下文
IContext ctx = MdaEnv.getContext();
ctx.setErrorCode(NO_ERROR);
String terminalType = (String)Platform.getLoginData("__terminalType");
log.info("{}","terminalType:"+terminalType);
if(MdaUtils.isEmpty(terminalType))
return false;
if("APP".equals(terminalType))
return true;
return false;
}
/**
* source:sysmod.@0126.script
*/
public static boolean indexGt(IDatafield fld,String str)
{
//取得上下文
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;
}
/**
* source:sysmod.@0127.script
*/
public static boolean containsValue(IDatafield fld,String splstr)
{
//取得上下文
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++)
{
bool= ((String)fld.getValue()).contains(s[i]);
if(bool)
break;
}
return bool;
}
/**
* source:sysmod.@0128.script
*/
public static boolean isALLChinese(String content)
{
//取得上下文
IContext ctx = MdaEnv.getContext();
ctx.setErrorCode(NO_ERROR);
if (MdaUtils.isEmpty(content))
{
return false;
}
///判断字符串中是否全为中文字符
char[] charArr = content.toCharArray();
Boolean flag = true;
for(int i = 0; i < charArr.length; i ++)
{
//if(charArr[i] >= 0x4E00 && charArr[i] <= 0x9FA5)
if(!(charArr[i] >= 19968 && charArr[i] <= 40869))
{
return false;
}
}
return flag;
}
/**
* source:wfmmod.@0002.script
*/
public static boolean errorHandle(IModule wfe,String reason)
{
//取得上下文
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))
{
sta.setValue("R");
rtycnt.setValue("1");
}
else
{
int count=Integer.valueOf(rtycnt.getValue());
if(count>=2)
sta.setValue("E");
rtycnt.setValue(String.valueOf(count+1));
}
ctx.getDaoSession().dbBegin();
ctx.getDaoSession().dbUpdate(wfe);
ctx.getDaoSession().dbCommit();
return false;
}
/**
* source:apldoc.@0011.script
*/
public static void setContractFlg()
{
//取得上下文
IContext ctx = MdaEnv.getContext();
ctx.setErrorCode(NO_ERROR);
/*
* 设置为申请PDF信息
*/
}
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 {
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) {
err.add(line2);
}
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;
}
/**
* source:sysmod.@0106.script
*/
public static Object[] getValueSMS(IModule mctx, String transName, String name) {
//取得上下文
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();
}
/**
* source:sysmod.@0107.script
*/
public static Object[] getValueSM(IModule mctx, String transName, String name) {
//取得上下文
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);
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));
}
}
/**
* source:trnmod.@0025.script
*/
public static String sdbCounter(IModule rec)
{
//取得上下文
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();
}
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();
}
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.@0115.script
*/
public static boolean errorDeal(boolean tips, String message, boolean rollback) {
//取得上下文
IContext ctx = MdaEnv.getContext();
ctx.setErrorCode(NO_ERROR);
/**
* source:bimenu.@0040.script
*/
public static boolean closeCursor(boolean flag)
{
//取得上下文
IContext ctx = MdaEnv.getContext();
ctx.setErrorCode(NO_ERROR);
ctx.getDaoSession().dbCloseCursor();
return flag;
}
tips:true,需要调用Platform.message提示,内容为参数message;否则打印日志
rollback:true则回滚数据库事务,false只是返回
*/
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;
}
/**
* source:sysmod.@0125.script
*/
public static boolean isFromApp() {
//取得上下文
IContext ctx = MdaEnv.getContext();
ctx.setErrorCode(NO_ERROR);
String terminalType = (String) Platform.getLoginData("__terminalType");
log.info("{}", "terminalType:" + terminalType);
if (MdaUtils.isEmpty(terminalType))
return false;
if ("APP".equals(terminalType))
return true;
return false;
}
/**
* source:sysmod.@0126.script
*/
public static boolean indexGt(IDatafield fld, String str) {
//取得上下文
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;
}
/**
* source:sysmod.@0127.script
*/
public static boolean containsValue(IDatafield fld, String splstr) {
//取得上下文
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++) {
bool = ((String) fld.getValue()).contains(s[i]);
if (bool)
break;
}
return bool;
}
/**
* source:sysmod.@0128.script
*/
public static boolean isALLChinese(String content) {
//取得上下文
IContext ctx = MdaEnv.getContext();
ctx.setErrorCode(NO_ERROR);
if (MdaUtils.isEmpty(content)) {
return false;
}
///判断字符串中是否全为中文字符
char[] charArr = content.toCharArray();
Boolean flag = true;
for (int i = 0; i < charArr.length; i++) {
//if(charArr[i] >= 0x4E00 && charArr[i] <= 0x9FA5)
if (!(charArr[i] >= 19968 && charArr[i] <= 40869)) {
return false;
}
}
return flag;
}
/**
* source:wfmmod.@0002.script
*/
public static boolean errorHandle(IModule wfe, String reason) {
//取得上下文
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)) {
sta.setValue("R");
rtycnt.setValue("1");
} else {
int count = Integer.valueOf(rtycnt.getValue());
if (count >= 2)
sta.setValue("E");
rtycnt.setValue(String.valueOf(count + 1));
}
ctx.getDaoSession().dbBegin();
ctx.getDaoSession().dbUpdate(wfe);
ctx.getDaoSession().dbCommit();
return false;
}
/**
* source:apldoc.@0011.script
*/
public static void setContractFlg() {
//取得上下文
IContext ctx = MdaEnv.getContext();
ctx.setErrorCode(NO_ERROR);
/*
* 设置为申请PDF信息
*/
}
/**
* source:trnmod.@0025.script
*/
public static String sdbCounter(IModule rec) {
//取得上下文
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();
}
/**
* source:bimenu.@0040.script
*/
public static boolean closeCursor(boolean flag) {
//取得上下文
IContext ctx = MdaEnv.getContext();
ctx.setErrorCode(NO_ERROR);
ctx.getDaoSession().dbCloseCursor();
return flag;
}
/**
* source:xmlbod.@0004.script
*/
public static Map<String, String> loadPropertyPart(String transName, String keyType) {
//取得上下文
IContext ctx = MdaEnv.getContext();
ctx.setErrorCode(NO_ERROR);
/*
* 功能:将配置文件中的映射关系初始化为map
*/
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)) {
String keys = MdaUtils.getPropertyValue(fileName, keyType);
if (MdaUtils.isEmpty(keys)) {
log.error("{}", "未配置 " + transName + ".properties 中的 " + keyType + " 数据项 ");
return map;
}
for (String key : keys.split(",")) {
String path = MdaUtils.getPropertyValue(fileName, key);
if (!MdaUtils.isEmpty(path))
map.put(key, path);
}
}
log.debug("{}", " out static xmlbod.getDatafieldMapping ... ");
return map;
}
/**
* source:xmlbod.@0005.script
*/
public static String getRef(String prefix) {
//取得上下文
IContext ctx = MdaEnv.getContext();
ctx.setErrorCode(NO_ERROR);
/**
* source:xmlbod.@0004.script
*/
public static Map<String,String> loadPropertyPart(String transName, String keyType )
{
//取得上下文
IContext ctx = MdaEnv.getContext();
ctx.setErrorCode(NO_ERROR);
/*
* 功能:将配置文件中的映射关系初始化为map
*/
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))
{
String keys=MdaUtils.getPropertyValue(fileName,keyType);
if(MdaUtils.isEmpty(keys))
{
log.error("{}","未配置 " + transName + ".properties 中的 " + keyType + " 数据项 " ) ;
return map ;
}
for(String key:keys.split(","))
{
String path=MdaUtils.getPropertyValue(fileName,key);
if(!MdaUtils.isEmpty(path))
map.put(key,path);
}
}
log.debug("{}"," out static xmlbod.getDatafieldMapping ... ") ;
return map ;
}
* 返回业务参考号,如LC-090817-0001)。
*/
String ownref = "";
if (!MdaUtils.isEmpty(prefix)) {
String seq = prefix + MdaUtils.format(MdaUtils.today(), "yyMMdd");
ownref = seq + MdaUtils.format(ctx.getDaoSession().dbCounter(prefix + MdaUtils.format(MdaUtils.today(), "yy")), "0000");
}
return ownref;
}
/**
* source:xmlbod.@0005.script
*/
public static String getRef(String prefix)
{
//取得上下文
IContext ctx = MdaEnv.getContext();
ctx.setErrorCode(NO_ERROR);
/**
* 返回业务参考号,如LC-090817-0001)。
*/
String ownref = "" ;
if(!MdaUtils.isEmpty(prefix))
{
String seq = prefix + MdaUtils.format(MdaUtils.today(),"yyMMdd");
ownref = seq + MdaUtils.format(ctx.getDaoSession().dbCounter(prefix+MdaUtils.format(MdaUtils.today(),"yy")),"0000");
}
return ownref ;
}
public static void writeToSession(Object arg1, Object arg2) {
public static void writeToSession(Object arg1,Object arg2){
}
}
public static Object readFromSession(Object arg1){
return null;
}
public static Object readFromSession(Object arg1) {
return null;
}
public static Object getLoginData(Object param){
return null;
public static Object getLoginData(String param) {
if ("usrinr".equals(param)) {
return "00000970";
}
return null;
}
public static void addEventRule(Object arg1,Object arg2,Object arg3,Object arg4){
public static void addEventRule(Object arg1, Object arg2, Object arg3, Object arg4) {
}
}
}
\ No newline at end of file
......@@ -4,6 +4,8 @@ import java.util.*;
import java.math.BigDecimal;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import com.alibaba.fastjson.JSON;
import com.brilliance.mda.runtime.mda.*;
import com.brilliance.mda.runtime.mda.impl.*;
import com.brilliance.mda.runtime.annotation.*;
......@@ -101,7 +103,7 @@ public class Acdopn extends AbstractTransaction{
if(!MdaUtils.isEmpty(this.getAcdgrp().getRec().getReason()))
{
this.getAcdgrp().getRec().setReason(NULLSTR);
}
String cifno = this.getAcdgrp().getRec().getSocialcrdtcd();
if(!ctx.absGet(Sysmod.class).judgeSWFunctions("open_account",cifno,""))
......@@ -147,8 +149,8 @@ public class Acdopn extends AbstractTransaction{
}
//组织报文发给预约开户系统,等待返回
Map yymap = new HashMap();
String seq =MdaUtils.format(ctx.getDaoSession().dbCounter("WindowsLSH"),"0000000000");
String transid = "270"+seq;
// String seq =MdaUtils.format(ctx.getDaoSession().dbCounter("WindowsLSH"),"0000000000");
String transid = "270"+"11111111111111";
yymap.put("TransID",transid);
yymap.put("EntName",this.getAcdgrp().getRec().getEntname());
......@@ -179,17 +181,22 @@ public class Acdopn extends AbstractTransaction{
yymap.put("ContactAddress",this.getAcdgrp().getRec().getContactaddress());//新增
yymap.put("AppointmentDate",MdaUtils.format(this.getAcdgrp().getRec().getAppointmentdate(),"yyyyMMdd"));//新增
yymap.put("openaccRegion",bk);//新增
Object resMsg = MdaUtils.invoke("com.brilliance.eibs.main.Client","scall","w414","w414",new Object[]{yymap});
Map yyrst = null;
if((Boolean)MdaUtils.invoke(resMsg,"isSuccess"))
{
yyrst = (Map)MdaUtils.invoke(resMsg,"getContent");
}
else
{
ctx.setMessage(MdaUtils.getI18NString("acdopn","CT000051"),MdaUtils.getI18NString("acdopn","CT000052"));
return false;
}
// Object resMsg = MdaUtils.invoke("com.brilliance.eibs.main.Client","scall","w414","w414",new Object[]{yymap});
Map yyrst = new HashMap();
yyrst.put("code","1");
yyrst.put("exeTaskResult","1");
yyrst.put("promptInfo","1");
yyrst.put("accountSerialNo","1");
yyrst.put("openaccBizId","1");
// if((Boolean)MdaUtils.invoke(resMsg,"isSuccess"))
// {
// yyrst = (Map)MdaUtils.invoke(resMsg,"getContent");
// }
// else
// {
// ctx.setMessage(MdaUtils.getI18NString("acdopn","CT000051"),MdaUtils.getI18NString("acdopn","CT000052"));
// return false;
// }
//判断处理结果,给出提示
String yycode = (String) yyrst.get("code");
if(MdaUtils.isEmpty(yycode))
......@@ -334,8 +341,8 @@ public class Acdopn extends AbstractTransaction{
ctx.getDaoSession().dbBegin();
//05:开户失败 ;
this.getAcdgrp().getRec().setStatus("05");//直接返回开户失败
String seq =MdaUtils.format(ctx.getDaoSession().dbCounter("WindowsLSH"),"0000000000");
String transid = "270"+seq;
//String seq =MdaUtils.format(ctx.getDaoSession().dbCounter("WindowsLSH"),"0000000000");
String transid = "270"+"2131243124";
this.getAcdgrp().getRec().setTransid(transid);
if(MdaUtils.isEmpty(this.getAcdgrp().getRec().getInr()))
{
......@@ -397,7 +404,7 @@ public class Acdopn extends AbstractTransaction{
this.getAcdgrp().getRec().copyValue(acd);
this.getAcdgrp().getRec().setCredat(MdaUtils.today());
this.getAcdgrp().getRec().setSocialcrdtcd("1");
ctx.getDaoSession().dbRead(this.getAcdgrp().getPty(),new Argument<String>("cifno",EQ,this.getAcdgrp().getRec().getSocialcrdtcd()));
this.getAcdgrp().getRec().setNcid(this.getAcdgrp().getPty().getCid());
......@@ -441,7 +448,8 @@ public class Acdopn extends AbstractTransaction{
String objinr = this.getAcdp().getAcdgrp().getRec().getInr();
String objtyp = "acd";
MdaUtils.clear(this.getTrnmod().getBnktrn());
ctx.getDaoSession().dbRead(this.getTrnmod().getBnktrn(),new Argument<String>("objinr",objinr),new Argument<String>("objtyp",objtyp));
// 6-16-update
ctx.getDaoSession().dbRead(this.getTrnmod().getBnktrn(),new Argument<String>("objinr","00000686"),new Argument<String>("objtyp",objtyp));
return true;
}
......@@ -918,7 +926,27 @@ public class Acdopn extends AbstractTransaction{
public static void main(String[] args) {
AcdopnVO acdopnVO = new AcdopnVO();
acdopnVO.setAcdgrp_rec_acdno("1");
acdopnVO.setAcdgrp_rec_account("2");
acdopnVO.setAcdgrp_rec_accounttype("3");
acdopnVO.setAcdgrp_rec_appointmentdate(new Date());
acdopnVO.setAcdgrp_rec_bchcod("4");
acdopnVO.setAcdgrp_rec_busiscope("5");
acdopnVO.setAcdgrp_rec_busistatus("6");
acdopnVO.setAcdgrp_rec_credat(new Date());
acdopnVO.setAcdgrp_rec_contactaddress("7");
acdopnVO.setAcdgrp_rec_entname("8");
acdopnVO.setAcdgrp_rec_enttel("9");
acdopnVO.setAcdgrp_rec_enttype("10");
System.out.println(JSON.toJSONString(acdopnVO));
}
}
}
\ No newline at end of file
......@@ -1133,7 +1133,7 @@ public class MdaUtils {
public static boolean prompt(Object... o) {
return true;
return false;
}
public static String generateSerialNum() {
......@@ -1323,7 +1323,14 @@ public class MdaUtils {
* @param o
*/
public static void setValues(Object... o) {
// if (o.length == 3) {
// Object o1 = o[0];
// Object o2 = o[1];
// Object o3 = o[2];
// if (o1 instanceof IModule && o2 instanceof String) {
// Datas.setFieldValue((IModule) o1, (String) o2, o3);
// }
// }
}
/**
......@@ -1555,7 +1562,7 @@ public class MdaUtils {
BufferedReader br = new BufferedReader(new StringReader(block));
String _line;
for(int count = 0; (_line = br.readLine()) != null; ++count) {
for (int count = 0; (_line = br.readLine()) != null; ++count) {
if (count == line) {
return _line;
}
......@@ -1565,6 +1572,7 @@ public class MdaUtils {
return null;
}
public static String getServerName() {
InetAddress addr = null;
String serverName = "";
......@@ -1582,20 +1590,21 @@ public class MdaUtils {
/**
* todo 解决evt.getData()问题
*
* @return
*/
public static Object getEventData(){
public static Object getEventData() {
return "-1";
}
/**
* todo 解决evt.getTarget问题
*
* @return
*/
public static IAttribute getEventTarget(){
public static IAttribute getEventTarget() {
return new AttributeValue();
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment