Commit 06950f76 by zhanghou

解决BD括号问题,修改isStdErrorNo,是checkAll可以返回返回值

parent 6b632187
package com.ceb.gjjs.mda.global; package com.ceb.gjjs.mda.global;
import com.brilliance.mda.runtime.mda.CodetableItem; import java.util.*;
import com.brilliance.mda.runtime.mda.IContext; import java.math.BigDecimal;
import com.brilliance.mda.runtime.mda.IDatafield; import com.brilliance.mda.runtime.mda.*;
import com.brilliance.mda.runtime.mda.IModule; import com.brilliance.mda.runtime.mda.impl.*;
import com.brilliance.mda.runtime.mda.driver.MdaDriver; import com.brilliance.mda.runtime.annotation.*;
import com.brilliance.mda.runtime.mda.driver.MdaEnv; import com.brilliance.mda.runtime.mda.driver.*;
import com.brilliance.mda.runtime.mda.impl.Argument; import static com.brilliance.mda.runtime.mda.Constants.*;
import com.brilliance.mda.runtime.mda.util.MdaUtils; import com.brilliance.mda.runtime.mda.util.*;
import com.ceb.gjjs.mda.bo.*;
import com.ceb.gjjs.mda.util.LoginData; import com.ceb.gjjs.mda.util.LoginData;
import java.util.regex.*;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import java.util.*; public class Platform
{
import static com.brilliance.mda.runtime.mda.Constants.*;
public class Platform {
private static Logger log = LoggerFactory.getLogger(Platform.class); private static Logger log = LoggerFactory.getLogger(Platform.class);
/** /**
* source:sysmod.@0022.script * source:sysmod.@0022.script
*/ */
public static String sdbCounter(String name) { public static String sdbCounter(String name)
{
//取得上下文 //取得上下文
IContext ctx = MdaEnv.getContext(); IContext ctx = MdaEnv.getContext();
ctx.setErrorCode(NO_ERROR); ctx.setErrorCode(NO_ERROR);
return MdaUtils.format(ctx.getDaoSession().dbCounter(name), "00000000"); return MdaUtils.format(ctx.getDaoSession().dbCounter(name),"00000000");
} }
/** /**
* source:sysmod.@0035.script * source:sysmod.@0035.script
*/ */
public static boolean errorCloseCursor(String message) { public static boolean errorCloseCursor(String message)
{
//取得上下文 //取得上下文
IContext ctx = MdaEnv.getContext(); IContext ctx = MdaEnv.getContext();
ctx.setErrorCode(NO_ERROR); ctx.setErrorCode(NO_ERROR);
ctx.getDaoSession().dbCloseCursor(); ctx.getDaoSession().dbCloseCursor();
ctx.setMessage(MdaUtils.getI18NString("sysmod", "CT000211"), message); ctx.setMessage(MdaUtils.getI18NString("sysmod","CT000211"),message);
return false; return false;
} }
/** /**
* source:sysmod.@0036.script * source:sysmod.@0036.script
*/ */
public static Map<String, Object> getValueMap(IModule mctx, String transName, String name) { public static Map<String,Object> getValueMap(IModule mctx,String transName,String name)
{
//取得上下文 //取得上下文
IContext ctx = MdaEnv.getContext(); IContext ctx = MdaEnv.getContext();
ctx.setErrorCode(NO_ERROR); ctx.setErrorCode(NO_ERROR);
log.info("{}", "Platform.getValueMap Invoked..."); log.info("{}","Platform.getValueMap Invoked...");
IModule context = MdaDriver.getModule(mctx, "\\bimenu"); IModule context=MdaDriver.getModule(mctx,"\\bimenu");
if (Platform.isXmlmapTransaction(transName)) { if(Platform.isXmlmapTransaction(transName))
context = MdaDriver.getModule(mctx, "\\xmlmap"); {
} context=MdaDriver.getModule(mctx,"\\xmlmap");
if (context == null) }
context = mctx; if(context==null)
context=mctx;
String fileName = MdaUtils.catPath(ctx.getEnvConfig().getRootPath(), "/cfg/" + transName + ".properties");
log.info("{}", "fileName = " + fileName); String fileName=MdaUtils.catPath(ctx.getEnvConfig().getRootPath(),"/cfg/"+transName+".properties");
String keys = MdaUtils.getPropertyValue(fileName, name); log.info("{}","fileName = " + fileName) ;
Map<String, Object> values = new HashMap<String, Object>(); String keys=MdaUtils.getPropertyValue(fileName,name);
if (MdaUtils.isEmpty(keys)) Map<String,Object> values=new HashMap<String,Object>();
if(MdaUtils.isEmpty(keys))
return values; return values;
for (String key : keys.split(",")) { for(String key:keys.split(","))
String path = MdaUtils.getPropertyValue(fileName, key); {
log.info("{}", key + "的取值路径为:" + path + ","); String path=MdaUtils.getPropertyValue(fileName,key);
if (!MdaUtils.isEmpty(path)) log.info("{}",key+"的取值路径为:" + path + ",");
values.put(key, Platform.getDatafieldValue(context, path)); if(!MdaUtils.isEmpty(path))
values.put(key,Platform.getDatafieldValue(context,path));
//by mkz for debug 19.03.04 //by mkz for debug 19.03.04
//log.debug("存入" + key + "的值为:" + Platform.getDatafieldValue(context,path)); //log.debug("存入" + key + "的值为:" + Platform.getDatafieldValue(context,path));
log.debug("{}", key + "取出的值为+==:" + values.get(key) + ","); log.debug("{}",key+"取出的值为+==:" + values.get(key) + ",");
} }
log.debug("{}", "values.size:" + values.size()); log.debug("{}","values.size:" + values.size());
values.put("locale", ctx.getLocale()); values.put("locale",ctx.getLocale());
return values; return values;
} }
/** /**
* source:sysmod.@0037.script * source:sysmod.@0037.script
*/ */
public static Object[] getValues(IModule mctx, String transName, String name) { public static Object[] getValues(IModule mctx,String transName,String name)
{
//取得上下文 //取得上下文
IContext ctx = MdaEnv.getContext(); IContext ctx = MdaEnv.getContext();
ctx.setErrorCode(NO_ERROR); ctx.setErrorCode(NO_ERROR);
log.info("{}", "Platform.getValueMap Invoked..."); log.info("{}","Platform.getValueMap Invoked...");
IModule context = null; IModule context= null ;
if (!Platform.isXmlmapTransaction(transName)) { if(!Platform.isXmlmapTransaction(transName))
log.debug("{}", "in bimenu "); {
context = MdaDriver.getModule(mctx, "\\bimenu"); log.debug("{}","in bimenu ");
} else { context =MdaDriver.getModule(mctx,"\\bimenu");
log.debug("{}", "in xmlmap "); }
context = MdaDriver.getModule(mctx, "\\xmlmap"); else
} {
if (context == null) log.debug("{}","in xmlmap ");
context = mctx; context =MdaDriver.getModule(mctx,"\\xmlmap");
String fileName = MdaUtils.catPath(ctx.getEnvConfig().getRootPath(), "/cfg/" + transName + ".properties"); }
String keys = MdaUtils.getPropertyValue(fileName, name); if(context==null)
if (MdaUtils.isEmpty(keys)) 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[]{}; return new Object[]{};
List<Object> values = new ArrayList<Object>(); List<Object> values=new ArrayList<Object>();
for (String key : keys.split(",")) { for(String key:keys.split(","))
String path = MdaUtils.getPropertyValue(fileName, key); {
if (!MdaUtils.isEmpty(path)) String path=MdaUtils.getPropertyValue(fileName,key);
values.add(Platform.getDatafieldValue(context, path)); if(!MdaUtils.isEmpty(path))
values.add(Platform.getDatafieldValue(context,path));
} }
return values.toArray(); return values.toArray();
} }
...@@ -111,59 +120,71 @@ public class Platform { ...@@ -111,59 +120,71 @@ public class Platform {
/** /**
* source:sysmod.@0038.script * source:sysmod.@0038.script
*/ */
public static Object getDatafieldValue(IModule context, String path) { public static Object getDatafieldValue(IModule context,String path)
{
//取得上下文 //取得上下文
IContext ctx = MdaEnv.getContext(); IContext ctx = MdaEnv.getContext();
ctx.setErrorCode(NO_ERROR); ctx.setErrorCode(NO_ERROR);
log.info("{}", "&path===" + path); log.info("{}","&path==="+path);
//log.debug("是否以”.“开头:" + path.startsWith(".")); //log.debug("是否以”.“开头:" + path.startsWith("."));
Object value = null; Object value=null;
if (path.startsWith("!")) if(path.startsWith("!"))
value = path.substring(1); value = path.substring(1);
else if (path.startsWith(".0")) { else if(path.startsWith(".0"))
if (MdaUtils.isEmpty(MdaDriver.getDatafield(context, path.substring(2)))) {
if(MdaUtils.isEmpty(MdaDriver.getDatafield(context,path.substring(2))))
return value; return value;
value = (MdaDriver.getDatafield(context, path.substring(2))).getValue(); value=(MdaDriver.getDatafield(context,path.substring(2))).getValue();
log.info("{}", "value=" + value); log.info("{}","value="+value);
String sql = "SELECT nam FROM pty WHERE cid='" + value + "'"; String sql = "SELECT nam FROM pty WHERE cid='"+value+"'";
ctx.getDaoSession().dbExecuteSQL(sql); ctx.getDaoSession().dbExecuteSQL(sql);
Argument<String> nam = new Argument<String>("nam"); Argument<String> nam = new Argument<String>("nam");
ctx.getDaoSession().dbFetchFields(nam); ctx.getDaoSession().dbFetchFields(nam);
ctx.getDaoSession().dbCloseCursor(); ctx.getDaoSession().dbCloseCursor();
if (!MdaUtils.isEmpty(nam.value)) if(!MdaUtils.isEmpty(nam.value))
value = nam.value; value = nam.value;
return value; return value;
} else if (path.startsWith(".")) { }
else if(path.startsWith("."))
{
//log.debug("path.value:" +Platform.getDatafield(context,path.substring(1))); //log.debug("path.value:" +Platform.getDatafield(context,path.substring(1)));
if (MdaUtils.isEmpty(MdaDriver.getDatafield(context, path.substring(1)))) if(MdaUtils.isEmpty(MdaDriver.getDatafield(context,path.substring(1))))
return value; return value;
value = (MdaDriver.getDatafield(context, path.substring(1))).getValue(); value=(MdaDriver.getDatafield(context,path.substring(1))).getValue();
log.info("{}", "value=" + value); log.info("{}","value="+value);
List<CodetableItem> list = (List<CodetableItem>) (MdaDriver.getDatafield(null, "\\sysmod\\bchcodvals")).getValue(); List<CodetableItem> list=(List<CodetableItem>)(MdaDriver.getDatafield(null,"\\sysmod\\bchcodvals")).getValue();
if (MdaUtils.isEmpty(list)) { //by dg for debug...10.09 if(MdaUtils.isEmpty(list))
log.info("{}", "bchcod list is empty!"); { //by dg for debug...10.09
log.info("{}","bchcod list is empty!");
return value; return value;
} }
for (CodetableItem item : list) { for(CodetableItem item:list)
log.info("{}", "item.getValue()=" + item.getValue()); {
if (item.getValue().equals(value)) { log.info("{}","item.getValue()="+item.getValue());
log.info("{}", "item=" + item.getLabel()); if(item.getValue().equals(value))
{
log.info("{}","item="+item.getLabel());
return item.getLabel(); return item.getLabel();
} }
} }
} else if (path.startsWith("*")) { }
if (MdaUtils.isEmpty(MdaDriver.getDatafield(context, path.substring(1)))) else if(path.startsWith("*"))
{
if(MdaUtils.isEmpty(MdaDriver.getDatafield(context,path.substring(1))))
return value; return value;
value = (MdaDriver.getDatafield(context, path.substring(1))).getValue(); value=(MdaDriver.getDatafield(context,path.substring(1))).getValue();
if ("X".equals(value)) if("X".equals(value))
return "√"; return "√";
} else if (path.startsWith("?0")) { }
else if(path.startsWith("?0"))
{
//处理45A //处理45A
String rtvalue = ""; String rtvalue="";
String[] fields = path.substring(2).split("\\?"); String[] fields = path.substring(2).split("\\?");
Map<String, IDatafield> flds = new HashMap<String, IDatafield>(); Map<String,IDatafield> flds = new HashMap<String,IDatafield>();
for (String field : fields) { for(String field:fields)
flds.put(field.substring(field.lastIndexOf("\\") + 1), MdaDriver.getDatafield(context, field)); {
flds.put(field.substring(field.lastIndexOf("\\")+1),MdaDriver.getDatafield(context,field));
} }
//adlcnd //adlcnd
Object adlcnd = flds.get("adlcnd").getValue(); Object adlcnd = flds.get("adlcnd").getValue();
...@@ -172,120 +193,140 @@ public class Platform { ...@@ -172,120 +193,140 @@ public class Platform {
Object nomtop = flds.get("nomtop").getValue(); Object nomtop = flds.get("nomtop").getValue();
// log.debug("nomflg=="+nomflg.toString()); // log.debug("nomflg=="+nomflg.toString());
// log.debug("nomflg=="+nomflg); // log.debug("nomflg=="+nomflg);
if (!MdaUtils.isEmpty(nomflg) && TRUE.equals(nomflg.toString())) { if(!MdaUtils.isEmpty(nomflg)&&TRUE.equals(nomflg.toString()))
rtvalue = "+Quantity And Amount "; {
if (!MdaUtils.isEmpty(nomtop)) rtvalue= "+Quantity And Amount ";
rtvalue += nomtop.toString() + " PERCENT More "; if(!MdaUtils.isEmpty(nomtop))
if (!MdaUtils.isEmpty(nomton)) { rtvalue+=nomtop.toString()+" PERCENT More ";
if (!MdaUtils.isEmpty(nomtop)) if(!MdaUtils.isEmpty(nomton))
rtvalue += " Or "; {
rtvalue += nomton.toString() + " PERCENT Less"; if(!MdaUtils.isEmpty(nomtop))
} rtvalue+= " Or ";
rtvalue += " Are Allowed"; rtvalue+=nomton.toString()+" PERCENT Less";
} }
if (!MdaUtils.isEmpty(adlcnd)) rtvalue+=" Are Allowed";
if (rtvalue == null || "".equals(rtvalue)) }
rtvalue = adlcnd.toString(); if(!MdaUtils.isEmpty(adlcnd))
if(rtvalue==null || "".equals(rtvalue) )
rtvalue=adlcnd.toString();
else else
rtvalue += CR + adlcnd.toString(); rtvalue+= CR+adlcnd.toString();
else else
rtvalue = rtvalue; rtvalue=rtvalue;
return rtvalue; return rtvalue;
} else if (path.startsWith("?1")) { }
else if(path.startsWith("?1"))
{
//处理47A //处理47A
String returnvalue = ""; String returnvalue ="";
String[] fields = path.substring(2).split("\\?"); String[] fields = path.substring(2).split("\\?");
Map<String, IDatafield> flds = new HashMap<String, IDatafield>(); Map<String,IDatafield> flds = new HashMap<String,IDatafield>();
for (String field : fields) { for(String field:fields)
flds.put(field.substring(field.lastIndexOf("\\") + 1), MdaDriver.getDatafield(context, field)); {
flds.put(field.substring(field.lastIndexOf("\\")+1),MdaDriver.getDatafield(context,field));
} }
//adlcnd //adlcnd
Object lcrgod = flds.get("lcrgod").getValue(); Object lcrgod = flds.get("lcrgod").getValue();
Object trdtrm = flds.get("trdtrm").getValue(); Object trdtrm = flds.get("trdtrm").getValue();
Object trdtrmplc = flds.get("trdtrmplc").getValue(); Object trdtrmplc = flds.get("trdtrmplc").getValue();
Object trdtrmver = flds.get("trdtrmver").getValue(); Object trdtrmver = flds.get("trdtrmver").getValue();
if (!MdaUtils.isEmpty(lcrgod)) if(!MdaUtils.isEmpty(lcrgod))
returnvalue = lcrgod.toString() + CR; returnvalue=lcrgod.toString()+CR;
if (!MdaUtils.isEmpty(trdtrm)) if(!MdaUtils.isEmpty(trdtrm))
returnvalue += "+Trade Terms: " + trdtrm.toString(); returnvalue+="+Trade Terms: "+trdtrm.toString();
if (!MdaUtils.isEmpty(trdtrmplc)) if(!MdaUtils.isEmpty(trdtrmplc))
returnvalue += " " + trdtrmplc.toString(); returnvalue+=" "+trdtrmplc.toString();
if (!MdaUtils.isEmpty(trdtrmver)) if(!MdaUtils.isEmpty(trdtrmver))
returnvalue += " " + trdtrmver.toString(); returnvalue+=" "+trdtrmver.toString();
return returnvalue.trim(); return returnvalue.trim();
} else if (path.startsWith("?7")) { }
else if(path.startsWith("?7"))
{
//处理进口代收,出口托收等申请书期限 //处理进口代收,出口托收等申请书期限
String returnvalue = ""; String returnvalue ="";
String[] fields = path.substring(2).split("\\?"); String[] fields = path.substring(2).split("\\?");
Map<String, IDatafield> flds = new HashMap<String, IDatafield>(); Map<String,IDatafield> flds = new HashMap<String,IDatafield>();
for (String field : fields) { for(String field:fields)
flds.put(field.substring(field.lastIndexOf("\\") + 1), MdaDriver.getDatafield(context, field)); {
flds.put(field.substring(field.lastIndexOf("\\")+1),MdaDriver.getDatafield(context,field));
} }
//adrblk //adrblk
Object doctypcod = flds.get("doctypcod").getValue(); Object doctypcod = flds.get("doctypcod").getValue();
Object matpercnt = flds.get("matpercnt").getValue(); Object matpercnt = flds.get("matpercnt").getValue();
Object matpertyp = flds.get("matpertyp").getValue(); Object matpertyp = flds.get("matpertyp").getValue();
Object doctxt = flds.get("mixdet").getValue(); Object doctxt = flds.get("mixdet").getValue();
if ("1".equals(doctypcod.toString()) || "3".equals(doctypcod.toString())) if("1".equals(doctypcod.toString()) || "3".equals(doctypcod.toString()) )
if (!MdaUtils.isEmpty(matpercnt)) if(!MdaUtils.isEmpty(matpercnt))
returnvalue = matpercnt + " Days " + MdaUtils.getCodetableLabel("matpertyp1", matpertyp.toString()); returnvalue=matpercnt +" Days "+MdaUtils.getCodetableLabel("matpertyp1",matpertyp.toString());
if ("4".equals(doctypcod.toString()) && doctxt != null) if("4".equals(doctypcod.toString()) && doctxt!=null)
returnvalue = doctxt.toString(); returnvalue=doctxt.toString();
return returnvalue.trim(); return returnvalue.trim();
} else if (path.startsWith("?8")) { }
else if(path.startsWith("?8"))
{
//处理进口代收,出口托收等申请书期限 //处理进口代收,出口托收等申请书期限
String returnvalue = ""; String returnvalue ="";
String[] fields = path.substring(2).split("\\?"); String[] fields = path.substring(2).split("\\?");
Map<String, IDatafield> flds = new HashMap<String, IDatafield>(); Map<String,IDatafield> flds = new HashMap<String,IDatafield>();
for (String field : fields) { for(String field:fields)
flds.put(field.substring(field.lastIndexOf("\\") + 1), MdaDriver.getDatafield(context, field)); {
flds.put(field.substring(field.lastIndexOf("\\")+1),MdaDriver.getDatafield(context,field));
} }
//adrblk //adrblk
Object doctypcod = flds.get("doctypcod").getValue(); Object doctypcod = flds.get("doctypcod").getValue();
Object matpercnt = flds.get("matpercnt").getValue(); Object matpercnt = flds.get("matpercnt").getValue();
Object matpertyp = flds.get("matpertyp").getValue(); Object matpertyp = flds.get("matpertyp").getValue();
Object doctxt = flds.get("doctxt").getValue(); Object doctxt = flds.get("doctxt").getValue();
if ("1".equals(doctypcod.toString()) || "3".equals(doctypcod.toString())) if("1".equals(doctypcod.toString()) || "3".equals(doctypcod.toString()) )
if (!MdaUtils.isEmpty(matpercnt)) if(!MdaUtils.isEmpty(matpercnt))
returnvalue = matpercnt + " Days " + MdaUtils.getCodetableLabel("matpertyp", matpertyp.toString()); returnvalue=matpercnt +" Days "+MdaUtils.getCodetableLabel("matpertyp",matpertyp.toString());
if ("4".equals(doctypcod.toString()) && doctxt != null) if("4".equals(doctypcod.toString())&& doctxt!=null)
returnvalue = doctxt.toString(); returnvalue=doctxt.toString();
return returnvalue.trim(); return returnvalue.trim();
} else if (path.startsWith("?9")) { }
else if(path.startsWith("?9"))
{
//处理出口信用证申请内容 //处理出口信用证申请内容
String returnvalue = ""; String returnvalue ="";
String[] fields = path.substring(2).split("\\?"); String[] fields = path.substring(2).split("\\?");
Map<String, IDatafield> flds = new HashMap<String, IDatafield>(); Map<String,IDatafield> flds = new HashMap<String,IDatafield>();
for (String field : fields) { for(String field:fields)
flds.put(field.substring(field.lastIndexOf("\\") + 1), MdaDriver.getDatafield(context, field)); {
flds.put(field.substring(field.lastIndexOf("\\")+1),MdaDriver.getDatafield(context,field));
} }
//adrblk //adrblk
Object adrblk = flds.get("adrblk").getValue(); Object adrblk = flds.get("adrblk").getValue();
Object details = flds.get("details").getValue(); Object details = flds.get("details").getValue();
if (!MdaUtils.isEmpty(adrblk)) if(!MdaUtils.isEmpty(adrblk))
returnvalue = "THE BENEFICIARY HAS BEEN AMENDED TO " + adrblk.toString() + CR; returnvalue="THE BENEFICIARY HAS BEEN AMENDED TO "+adrblk.toString()+CR;
if (!MdaUtils.isEmpty(details)) if(!MdaUtils.isEmpty(details))
returnvalue += details.toString(); returnvalue+=details.toString();
return returnvalue.trim(); return returnvalue.trim();
} else if (path.startsWith("?r?n")) { }
Object fldVavle = (MdaDriver.getDatafield(context, path.substring(4))).getValue(); else if(path.startsWith("?r?n"))
{
Object fldVavle = (MdaDriver.getDatafield(context,path.substring(4))).getValue();
String valueStr = ""; String valueStr = "";
if (!MdaUtils.isEmpty(fldVavle)) { if(!MdaUtils.isEmpty(fldVavle))
{
valueStr = fldVavle.toString(); valueStr = fldVavle.toString();
if (valueStr.contains("\n")) { if(valueStr.contains("\n"))
{
valueStr = valueStr.replace("\n", " "); valueStr=valueStr.replace("\n"," ");
} }
if (valueStr.contains("\r")) { if(valueStr.contains("\r"))
{
valueStr = valueStr.replace("\r", ""); valueStr=valueStr.replace("\r","");
}
} }
value=valueStr;
} }
value = valueStr; else if(!MdaUtils.isEmpty(MdaDriver.getDatafield(context,path)))
} else if (!MdaUtils.isEmpty(MdaDriver.getDatafield(context, path))) value=(MdaDriver.getDatafield(context,path)).getValue();
value = (MdaDriver.getDatafield(context, path)).getValue(); else if(path.endsWith("nomtop") || path.endsWith("nomton"))
else if (path.endsWith("nomtop") || path.endsWith("nomton")) value="0";
value = "0";
return value; return value;
} }
...@@ -293,7 +334,8 @@ public class Platform { ...@@ -293,7 +334,8 @@ public class Platform {
/** /**
* source:sysmod.@0065.script * source:sysmod.@0065.script
*/ */
public static Map<String, Object> convertContentToMap(IModule mctx, Map<String, Object> data, String transName, String name) { public static Map<String,Object> convertContentToMap(IModule mctx,Map<String,Object> data,String transName,String name)
{
//取得上下文 //取得上下文
IContext ctx = MdaEnv.getContext(); IContext ctx = MdaEnv.getContext();
ctx.setErrorCode(NO_ERROR); ctx.setErrorCode(NO_ERROR);
...@@ -304,69 +346,77 @@ public class Platform { ...@@ -304,69 +346,77 @@ public class Platform {
* name - 配置文件中的字段定义,使用','隔开 ,默认为DATA * name - 配置文件中的字段定义,使用','隔开 ,默认为DATA
*/ */
log.info("{}", "sysmod.convertContentToMap Invoked..."); log.info("{}","sysmod.convertContentToMap Invoked...");
Map<String, Object> values = null; Map<String,Object> values= null ;
IModule context = MdaDriver.getModule(mctx, "\\xmlmap"); IModule context=MdaDriver.getModule(mctx,"\\xmlmap");
int errcod = ctx.getErrorCode(); int errcod = ctx.getErrorCode();
if (context == null) if(context==null )
context = mctx; context=mctx;
String fileName = MdaUtils.catPath(ctx.getEnvConfig().getRootPath(), "/cfg/" + transName + ".properties"); String fileName=MdaUtils.catPath(ctx.getEnvConfig().getRootPath(),"/cfg/"+transName+".properties");
String keys = MdaUtils.getPropertyValue(fileName, name); String keys=MdaUtils.getPropertyValue(fileName,name);
if (MdaUtils.isEmpty(keys)) { if ( MdaUtils.isEmpty(keys))
log.error("{}", "配置文件:" + fileName + " 未配置 " + name + " 项 ."); {
return values; log.error("{}","配置文件:" + fileName +" 未配置 "+ name +" 项 ." ) ;
} return values ;
values = data; }
log.debug("{}", " keys: " + keys); values = data ;
for (String key : keys.split(",")) { log.debug("{}"," keys: " + keys) ;
log.debug("{}", "key = {" + key + "}"); for(String key:keys.split(","))
String path = MdaUtils.getPropertyValue(fileName, key); {
log.debug("{}", " sysmod.convertContentToMap : path = " + path); log.debug("{}","key = {" + key +"}");
if (!MdaUtils.isEmpty(path)) { String path=MdaUtils.getPropertyValue(fileName,key);
values.put(key, Platform.getDatafieldValue(context, path)); log.debug("{}"," sysmod.convertContentToMap : path = " + path) ;
log.debug("{}", "xmlMap:{ key=" + key + ", value=" + Platform.getDatafieldValue(context, 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()); }
}
values.put("locale",ctx.getLocale());
return values; return values;
} }
/** /**
* source:sysmod.@0073.script * source:sysmod.@0073.script
*/ */
public static Date formatDateTime(Date d, String pattern) { public static Date formatDateTime (Date d ,String pattern)
{
//取得上下文 //取得上下文
IContext ctx = MdaEnv.getContext(); IContext ctx = MdaEnv.getContext();
ctx.setErrorCode(NO_ERROR); ctx.setErrorCode(NO_ERROR);
if (d == null) { if(d==null)
{
d = MdaUtils.today(); d = MdaUtils.today();
} }
if (MdaUtils.isEmpty(pattern) || "0".equals(pattern)) { if(MdaUtils.isEmpty(pattern) || "0".equals(pattern) )
{
pattern = "000000"; pattern = "000000";
} }
String time = MdaUtils.format(d, "yyyyMMddHHmmss"); String time = MdaUtils.format(d,"yyyyMMddHHmmss");
time = time.substring(0, 8); time = time.substring(0,8);
time = time + pattern; time = time + pattern;
return MdaUtils.parseDate(time, "yyyyMMddHHmmss"); return MdaUtils.parseDate(time,"yyyyMMddHHmmss");
} }
/** /**
* source:sysmod.@0074.script * source:sysmod.@0074.script
*/ */
public static boolean isXmlmapTransaction(String transNam) { public static boolean isXmlmapTransaction(String transNam)
{
//取得上下文 //取得上下文
IContext ctx = MdaEnv.getContext(); IContext ctx = MdaEnv.getContext();
ctx.setErrorCode(NO_ERROR); ctx.setErrorCode(NO_ERROR);
/* /*
* 用于判断来报通知是否从xmlmap中映射模块,以便于区分原来的bimenu * 用于判断来报通知是否从xmlmap中映射模块,以便于区分原来的bimenu
*/ */
log.debug("{}", " in isXmlmapTransaction " + transNam); log.debug("{}"," in isXmlmapTransaction " +transNam );
boolean ret = false; boolean ret = false ;
if (!MdaUtils.isEmpty(transNam) && ("rptshw".equals(transNam) || "ersshw".equals(transNam))) { if(!MdaUtils.isEmpty(transNam) && ("rptshw".equals(transNam)|| "ersshw".equals(transNam) ) )
{
ret = true; ret = true;
} }
log.debug("{}", " out isXmlmapTransaction = " + ret); log.debug("{}"," out isXmlmapTransaction = " + ret );
return ret; return ret;
} }
...@@ -374,19 +424,22 @@ public class Platform { ...@@ -374,19 +424,22 @@ public class Platform {
/** /**
* source:sysmod.@0079.script * source:sysmod.@0079.script
*/ */
public static boolean isNoError(Map msg) { public static boolean isNoError(Map msg)
{
//取得上下文 //取得上下文
IContext ctx = MdaEnv.getContext(); IContext ctx = MdaEnv.getContext();
ctx.setErrorCode(NO_ERROR); ctx.setErrorCode(NO_ERROR);
/* /*
* 判断是否没有错误,方便回滚或提交事务 * 判断是否没有错误,方便回滚或提交事务
*/ */
log.debug("{}", "in static sysmod.isNoError ... "); log.debug("{}","in static sysmod.isNoError ... ");
boolean ret = true; boolean ret = true ;
if (!MdaUtils.isEmpty(msg)) { if(!MdaUtils.isEmpty(msg))
String errcod = (String) msg.get("ERRORCODE"); {
log.debug("{}", "msgErrcod = " + errcod + "."); String errcod =(String) msg.get("ERRORCODE");
if (!MdaUtils.isEmpty(errcod) && !"00000".equals(errcod)) { log.debug("{}","msgErrcod = " + errcod +".");
if(!MdaUtils.isEmpty(errcod) && !"00000".equals(errcod))
{
ret = false; ret = false;
} }
} }
...@@ -396,20 +449,22 @@ public class Platform { ...@@ -396,20 +449,22 @@ public class Platform {
/** /**
* source:sysmod.@0080.script * source:sysmod.@0080.script
*/ */
public static void setErrorInfo(Map<String, Object> msgMap, String errcod, String errMsg) { public static void setErrorInfo(Map<String,Object> msgMap, String errcod, String errMsg)
{
//取得上下文 //取得上下文
IContext ctx = MdaEnv.getContext(); IContext ctx = MdaEnv.getContext();
ctx.setErrorCode(NO_ERROR); ctx.setErrorCode(NO_ERROR);
log.debug("{}", "in static sysmod setErrorInfo ... "); log.debug("{}","in static sysmod setErrorInfo ... ");
msgMap.put("ERRORMSG", errMsg); msgMap.put("ERRORMSG", errMsg);
msgMap.put("ERRORCODE", errcod); msgMap.put("ERRORCODE",errcod);
log.error("{}", "错误码:" + errcod + ", 错误描述" + errMsg); log.error("{}","错误码:"+ errcod + ", 错误描述" + errMsg);
} }
/** /**
* source:sysmod.@0103.script * source:sysmod.@0103.script
*/ */
public static String headBchcod() { public static String headBchcod()
{
//取得上下文 //取得上下文
IContext ctx = MdaEnv.getContext(); IContext ctx = MdaEnv.getContext();
ctx.setErrorCode(NO_ERROR); ctx.setErrorCode(NO_ERROR);
...@@ -419,7 +474,8 @@ public class Platform { ...@@ -419,7 +474,8 @@ public class Platform {
/** /**
* source:sysmod.@0162.script * source:sysmod.@0162.script
*/ */
public static Map execLocalScriptwithLog(String command) { public static Map execLocalScriptwithLog(String command)
{
//取得上下文 //取得上下文
IContext ctx = MdaEnv.getContext(); IContext ctx = MdaEnv.getContext();
ctx.setErrorCode(NO_ERROR); ctx.setErrorCode(NO_ERROR);
...@@ -430,13 +486,14 @@ public class Platform { ...@@ -430,13 +486,14 @@ public class Platform {
#! 变量 : command 前台命令 #! 变量 : command 前台命令
#!======================================== #!========================================
*/ */
log.info("{}", "execLocalScript:" + command); log.info("{}","execLocalScript:"+command);
Process process = null; Process process = null;
Map map = new HashMap(); Map map = new HashMap();
Boolean flg = true; Boolean flg = true;
List<String> result = new ArrayList(); List<String> result = new ArrayList();
List<String> err = new ArrayList(); List<String> err = new ArrayList();
try { try
{
process = Runtime.getRuntime().exec(command); process = Runtime.getRuntime().exec(command);
process.waitFor(); process.waitFor();
java.io.InputStream is1 = process.getInputStream(); java.io.InputStream is1 = process.getInputStream();
...@@ -448,7 +505,8 @@ public class Platform { ...@@ -448,7 +505,8 @@ public class Platform {
java.io.BufferedReader br2 = new java.io.BufferedReader(isr2); java.io.BufferedReader br2 = new java.io.BufferedReader(isr2);
String line1 = null; String line1 = null;
while ((line1 = br1.readLine()) != null) { while ((line1 = br1.readLine()) != null)
{
result.add(line1); result.add(line1);
} }
is1.close(); is1.close();
...@@ -456,53 +514,63 @@ public class Platform { ...@@ -456,53 +514,63 @@ public class Platform {
br1.close(); br1.close();
String line2 = null; String line2 = null;
while ((line2 = br2.readLine()) != null) { while ((line2 = br2.readLine()) != null)
{
err.add(line2); err.add(line2);
} }
is2.close(); is2.close();
isr2.close(); isr2.close();
br2.close(); br2.close();
} catch (Exception e) { }
catch (Exception e)
{
e.printStackTrace(); e.printStackTrace();
flg = false; flg = false;
} finally { }
if (process != null) finally
{
if(process != null)
process.destroy(); process.destroy();
} }
map.put("flg", flg); map.put("flg",flg);
map.put("result", result); map.put("result",result);
map.put("error", err); map.put("error",err);
return map; return map;
} }
/** /**
* source:sysmod.@0106.script * source:sysmod.@0106.script
*/ */
public static Object[] getValueSMS(IModule mctx, String transName, String name) { public static Object[] getValueSMS(IModule mctx,String transName,String name)
{
//取得上下文 //取得上下文
IContext ctx = MdaEnv.getContext(); IContext ctx = MdaEnv.getContext();
ctx.setErrorCode(NO_ERROR); ctx.setErrorCode(NO_ERROR);
log.info("{}", "Platform.getValueMap Invoked..."); log.info("{}","Platform.getValueMap Invoked...");
IModule context = null; IModule context= null ;
if (!Platform.isXmlmapTransaction(transName)) { if(!Platform.isXmlmapTransaction(transName))
log.debug("{}", "in bimenu "); {
context = MdaDriver.getModule(mctx, "\\bimenu"); log.debug("{}","in bimenu ");
} else { context =MdaDriver.getModule(mctx,"\\bimenu");
log.debug("{}", "in xmlmap "); }
context = MdaDriver.getModule(mctx, "\\xmlmap"); else
} {
if (context == null) log.debug("{}","in xmlmap ");
context = mctx; context =MdaDriver.getModule(mctx,"\\xmlmap");
String fileName = MdaUtils.catPath(ctx.getEnvConfig().getRootPath(), "/cfg/" + transName + ".properties"); }
String keys = MdaUtils.getPropertyValue(fileName, name); if(context==null)
if (MdaUtils.isEmpty(keys)) 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[]{}; return new Object[]{};
List<Object> values = new ArrayList<Object>(); List<Object> values=new ArrayList<Object>();
for (String key : keys.split(",")) { for(String key:keys.split(","))
String path = MdaUtils.getPropertyValue(fileName, key); {
if (!MdaUtils.isEmpty(path)) String path=MdaUtils.getPropertyValue(fileName,key);
values.add(Platform.getDatafieldValue(context, path)); if(!MdaUtils.isEmpty(path))
values.add(Platform.getDatafieldValue(context,path));
} }
return values.toArray(); return values.toArray();
} }
...@@ -510,56 +578,66 @@ public class Platform { ...@@ -510,56 +578,66 @@ public class Platform {
/** /**
* source:sysmod.@0107.script * source:sysmod.@0107.script
*/ */
public static Object[] getValueSM(IModule mctx, String transName, String name) { public static Object[] getValueSM(IModule mctx,String transName,String name)
{
//取得上下文 //取得上下文
IContext ctx = MdaEnv.getContext(); IContext ctx = MdaEnv.getContext();
ctx.setErrorCode(NO_ERROR); ctx.setErrorCode(NO_ERROR);
log.info("{}", "Platform.getValueMap Invoked..."); log.info("{}","Platform.getValueMap Invoked...");
IModule context = null; IModule context= null ;
if (!Platform.isXmlmapTransaction(transName)) { if(!Platform.isXmlmapTransaction(transName))
log.debug("{}", "in bimenu "); {
context = MdaDriver.getModule(mctx, "\\bimenu"); log.debug("{}","in bimenu ");
} else { context =MdaDriver.getModule(mctx,"\\bimenu");
log.debug("{}", "in xmlmap "); }
context = MdaDriver.getModule(mctx, "\\xmlmap"); else
} {
if (context == null) log.debug("{}","in xmlmap ");
context = mctx; context =MdaDriver.getModule(mctx,"\\xmlmap");
String fileName = MdaUtils.catPath(ctx.getEnvConfig().getRootPath(), "/cfg/" + transName + ".properties"); }
String keys = MdaUtils.getPropertyValue(fileName, name); if(context==null)
context=mctx;
String files = MdaUtils.catPath(ctx.getEnvConfig().getRootPath(), "/cfg/" + "trdnam.properties"); String fileName=MdaUtils.catPath(ctx.getEnvConfig().getRootPath(),"/cfg/"+transName+".properties");
String vals = MdaUtils.getPropertyValue(files, transName); String keys=MdaUtils.getPropertyValue(fileName,name);
if (MdaUtils.isEmpty(keys) || MdaUtils.isEmpty(vals))
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[]{}; return new Object[]{};
List<Object> values = new ArrayList<Object>(); List<Object> values=new ArrayList<Object>();
for (String key : keys.split(",")) { for(String key:keys.split(","))
String path = MdaUtils.getPropertyValue(fileName, key); {
if (!MdaUtils.isEmpty(path)) { String path=MdaUtils.getPropertyValue(fileName,key);
log.debug("{}", "Message=" + Platform.getDatafieldValue(context, path)); if(!MdaUtils.isEmpty(path))
values.add(Platform.getDatafieldValue(context, path)); {
} log.debug("{}","Message="+Platform.getDatafieldValue(context,path));
} values.add(Platform.getDatafieldValue(context,path));
}
for (String val : vals.split(",")) { }
String conts = null;
try { for(String val:vals.split(","))
conts = new String(val.getBytes("ISO-8859-1"), "GBK"); {
log.debug("{}", "Message=" + conts); String conts=null;
} catch (Exception e) { try
log.debug("{}", "----------------------------Chage Encoding Error------------------------------------------"); {
conts=new String(val.getBytes("ISO-8859-1"),"GBK");
log.debug("{}","Message="+conts);
}
catch(Exception e)
{
log.debug("{}","----------------------------Chage Encoding Error------------------------------------------");
e.printStackTrace(); e.printStackTrace();
} }
values.add(conts); values.add(conts);
} }
//获取所属核心机构号idc //获取所属核心机构号idc
Object vas = null; Object vas=null;
String bchp = transName.substring(0, 2).trim(); String bchp=transName.substring(0,2).trim();
String bch = bchp + "dgrp\\rec\\bchcod"; String bch=bchp+"dgrp\\rec\\bchcod";
vas = (MdaDriver.getDatafield(context, bch)).getValue(); vas=(MdaDriver.getDatafield(context,bch)).getValue();
String sql = "SELECT distinct idc FROM pty WHERE cid='" + vas + "'"; String sql = "SELECT distinct idc FROM pty WHERE cid='"+vas+"'";
ctx.getDaoSession().dbExecuteSQL(sql); ctx.getDaoSession().dbExecuteSQL(sql);
Argument<String> idc = new Argument<String>("idc"); Argument<String> idc = new Argument<String>("idc");
ctx.getDaoSession().dbFetchFields(idc); ctx.getDaoSession().dbFetchFields(idc);
...@@ -567,7 +645,7 @@ public class Platform { ...@@ -567,7 +645,7 @@ public class Platform {
values.add(idc.value); values.add(idc.value);
//if(!Platform.isEmpty(idc.value)) //if(!Platform.isEmpty(idc.value))
//value = nam.value; //value = nam.value;
log.debug("{}", "idc 值 :" + idc.value); log.debug("{}","idc 值 :"+idc.value);
return values.toArray(); return values.toArray();
} }
...@@ -575,7 +653,8 @@ public class Platform { ...@@ -575,7 +653,8 @@ public class Platform {
/** /**
* source:sysmod.@0115.script * source:sysmod.@0115.script
*/ */
public static boolean errorDeal(boolean tips, String message, boolean rollback) { public static boolean errorDeal(boolean tips,String message,boolean rollback)
{
//取得上下文 //取得上下文
IContext ctx = MdaEnv.getContext(); IContext ctx = MdaEnv.getContext();
ctx.setErrorCode(NO_ERROR); ctx.setErrorCode(NO_ERROR);
...@@ -584,11 +663,15 @@ public class Platform { ...@@ -584,11 +663,15 @@ public class Platform {
rollback:true则回滚数据库事务,false只是返回 rollback:true则回滚数据库事务,false只是返回
*/ */
int errorno = ctx.getErrorCode(); int errorno = ctx.getErrorCode();
if (errorno != NO_ERROR) { if(errorno != NO_ERROR)
if (tips) { {
ctx.setMessage(MdaUtils.getI18NString("sysmod", "CT000363"), MdaUtils.getI18NString("sysmod", "CT000364")); if(tips)
} else { {
log.error("{}", message); ctx.setMessage(MdaUtils.getI18NString("sysmod","CT000363"),MdaUtils.getI18NString("sysmod","CT000364"));
}
else
{
log.error("{}",message);
} }
ctx.getDaoSession().dbRollback(); ctx.getDaoSession().dbRollback();
return false; return false;
...@@ -599,15 +682,16 @@ public class Platform { ...@@ -599,15 +682,16 @@ public class Platform {
/** /**
* source:sysmod.@0125.script * source:sysmod.@0125.script
*/ */
public static boolean isFromApp() { public static boolean isFromApp()
{
//取得上下文 //取得上下文
IContext ctx = MdaEnv.getContext(); IContext ctx = MdaEnv.getContext();
ctx.setErrorCode(NO_ERROR); ctx.setErrorCode(NO_ERROR);
String terminalType = (String) Platform.getLoginData("__terminalType"); String terminalType = (String)Platform.getLoginData("__terminalType");
log.info("{}", "terminalType:" + terminalType); log.info("{}","terminalType:"+terminalType);
if (MdaUtils.isEmpty(terminalType)) if(MdaUtils.isEmpty(terminalType))
return false; return false;
if ("APP".equals(terminalType)) if("APP".equals(terminalType))
return true; return true;
return false; return false;
} }
...@@ -615,34 +699,37 @@ public class Platform { ...@@ -615,34 +699,37 @@ public class Platform {
/** /**
* source:sysmod.@0126.script * source:sysmod.@0126.script
*/ */
public static boolean indexGt(IDatafield fld, String str) { public static boolean indexGt(IDatafield fld,String str)
{
//取得上下文 //取得上下文
IContext ctx = MdaEnv.getContext(); IContext ctx = MdaEnv.getContext();
ctx.setErrorCode(NO_ERROR); ctx.setErrorCode(NO_ERROR);
boolean bool = false; boolean bool=false;
if (MdaUtils.isEmpty(fld)) if (MdaUtils.isEmpty(fld))
return false; return false;
if (str.indexOf((String) fld.getValue()) > 0) if (str.indexOf((String)fld.getValue())>0)
bool = true; bool =true;
return bool; return bool;
} }
/** /**
* source:sysmod.@0127.script * source:sysmod.@0127.script
*/ */
public static boolean containsValue(IDatafield fld, String splstr) { public static boolean containsValue(IDatafield fld,String splstr)
{
//取得上下文 //取得上下文
IContext ctx = MdaEnv.getContext(); IContext ctx = MdaEnv.getContext();
ctx.setErrorCode(NO_ERROR); ctx.setErrorCode(NO_ERROR);
boolean bool = false; boolean bool=false;
if (MdaUtils.isEmpty(fld)) if (MdaUtils.isEmpty(fld))
return false; return false;
String[] s = splstr.split("-"); String [] s= splstr.split("-");
int len = s.length; int len=s.length;
for (int i = 1; i < len; i++) { for(int i=1;i<len;i++)
bool = ((String) fld.getValue()).contains(s[i]); {
if (bool) bool= ((String)fld.getValue()).contains(s[i]);
if(bool)
break; break;
} }
return bool; return bool;
...@@ -651,19 +738,23 @@ public class Platform { ...@@ -651,19 +738,23 @@ public class Platform {
/** /**
* source:sysmod.@0128.script * source:sysmod.@0128.script
*/ */
public static boolean isALLChinese(String content) { public static boolean isALLChinese(String content)
{
//取得上下文 //取得上下文
IContext ctx = MdaEnv.getContext(); IContext ctx = MdaEnv.getContext();
ctx.setErrorCode(NO_ERROR); ctx.setErrorCode(NO_ERROR);
if (MdaUtils.isEmpty(content)) { if (MdaUtils.isEmpty(content))
{
return false; return false;
} }
///判断字符串中是否全为中文字符 ///判断字符串中是否全为中文字符
char[] charArr = content.toCharArray(); char[] charArr = content.toCharArray();
Boolean flag = true; Boolean flag = true;
for (int i = 0; i < charArr.length; i++) { for(int i = 0; i < charArr.length; i ++)
{
//if(charArr[i] >= 0x4E00 && charArr[i] <= 0x9FA5) //if(charArr[i] >= 0x4E00 && charArr[i] <= 0x9FA5)
if (!(charArr[i] >= 19968 && charArr[i] <= 40869)) { if(!(charArr[i] >= 19968 && charArr[i] <= 40869))
{
return false; return false;
} }
} }
...@@ -673,24 +764,28 @@ public class Platform { ...@@ -673,24 +764,28 @@ public class Platform {
/** /**
* source:wfmmod.@0002.script * source:wfmmod.@0002.script
*/ */
public static boolean errorHandle(IModule wfe, String reason) { public static boolean errorHandle(IModule wfe,String reason)
{
//取得上下文 //取得上下文
IContext ctx = MdaEnv.getContext(); IContext ctx = MdaEnv.getContext();
ctx.setErrorCode(NO_ERROR); ctx.setErrorCode(NO_ERROR);
/* /*
* 功能:代替原来在mgrtsk交易下定义的函数 errorHandle. * 功能:代替原来在mgrtsk交易下定义的函数 errorHandle.
*/ */
log.error("{}", reason); log.error("{}",reason);
IDatafield<String> sta = (IDatafield) wfe.get("sta"); IDatafield<String> sta=(IDatafield)wfe.get("sta");
IDatafield<String> rtycnt = (IDatafield) wfe.get("rtycnt"); IDatafield<String> rtycnt=(IDatafield)wfe.get("rtycnt");
if (MdaUtils.isEmpty(rtycnt)) { if(MdaUtils.isEmpty(rtycnt))
{
sta.setValue("R"); sta.setValue("R");
rtycnt.setValue("1"); rtycnt.setValue("1");
} else { }
int count = Integer.valueOf(rtycnt.getValue()); else
if (count >= 2) {
int count=Integer.valueOf(rtycnt.getValue());
if(count>=2)
sta.setValue("E"); sta.setValue("E");
rtycnt.setValue(String.valueOf(count + 1)); rtycnt.setValue(String.valueOf(count+1));
} }
ctx.getDaoSession().dbBegin(); ctx.getDaoSession().dbBegin();
ctx.getDaoSession().dbUpdate(wfe); ctx.getDaoSession().dbUpdate(wfe);
...@@ -701,7 +796,8 @@ public class Platform { ...@@ -701,7 +796,8 @@ public class Platform {
/** /**
* source:apldoc.@0011.script * source:apldoc.@0011.script
*/ */
public static void setContractFlg() { public static void setContractFlg()
{
//取得上下文 //取得上下文
IContext ctx = MdaEnv.getContext(); IContext ctx = MdaEnv.getContext();
ctx.setErrorCode(NO_ERROR); ctx.setErrorCode(NO_ERROR);
...@@ -714,11 +810,12 @@ public class Platform { ...@@ -714,11 +810,12 @@ public class Platform {
/** /**
* source:trnmod.@0025.script * source:trnmod.@0025.script
*/ */
public static String sdbCounter(IModule rec) { public static String sdbCounter(IModule rec)
{
//取得上下文 //取得上下文
IContext ctx = MdaEnv.getContext(); IContext ctx = MdaEnv.getContext();
ctx.setErrorCode(NO_ERROR); ctx.setErrorCode(NO_ERROR);
IDatafield<String> inr = (IDatafield) MdaDriver.getBaseObject(rec, "inr"); IDatafield<String> inr=(IDatafield)MdaDriver.getBaseObject(rec,"inr");
inr.setValue(Platform.sdbCounter(rec.getName())); inr.setValue(Platform.sdbCounter(rec.getName()));
return inr.getValue(); return inr.getValue();
} }
...@@ -726,7 +823,8 @@ public class Platform { ...@@ -726,7 +823,8 @@ public class Platform {
/** /**
* source:bimenu.@0040.script * source:bimenu.@0040.script
*/ */
public static boolean closeCursor(boolean flag) { public static boolean closeCursor(boolean flag)
{
//取得上下文 //取得上下文
IContext ctx = MdaEnv.getContext(); IContext ctx = MdaEnv.getContext();
ctx.setErrorCode(NO_ERROR); ctx.setErrorCode(NO_ERROR);
...@@ -737,68 +835,78 @@ public class Platform { ...@@ -737,68 +835,78 @@ public class Platform {
/** /**
* source:xmlbod.@0004.script * source:xmlbod.@0004.script
*/ */
public static Map<String, String> loadPropertyPart(String transName, String keyType) { public static Map<String,String> loadPropertyPart(String transName, String keyType )
{
//取得上下文 //取得上下文
IContext ctx = MdaEnv.getContext(); IContext ctx = MdaEnv.getContext();
ctx.setErrorCode(NO_ERROR); ctx.setErrorCode(NO_ERROR);
/* /*
* 功能:将配置文件中的映射关系初始化为map * 功能:将配置文件中的映射关系初始化为map
*/ */
log.debug("{}", " in static xmlbod.getDatafieldMapping ... "); log.debug("{}"," in static xmlbod.getDatafieldMapping ... ") ;
Map<String, String> map = new HashMap<String, String>(); Map<String,String> map = new HashMap<String,String>() ;
String fileName = MdaUtils.catPath(ctx.getEnvConfig().getRootPath(), "/cfg/" + transName + ".properties"); String fileName=MdaUtils.catPath(ctx.getEnvConfig().getRootPath(),"/cfg/"+transName+".properties");
log.debug("{}", "fileName:" + fileName); log.debug("{}","fileName:"+ fileName);
if (MdaUtils.fileExists(fileName)) { if (MdaUtils.fileExists(fileName))
String keys = MdaUtils.getPropertyValue(fileName, keyType); {
if (MdaUtils.isEmpty(keys)) { String keys=MdaUtils.getPropertyValue(fileName,keyType);
log.error("{}", "未配置 " + transName + ".properties 中的 " + keyType + " 数据项 "); if(MdaUtils.isEmpty(keys))
return map; {
log.error("{}","未配置 " + transName + ".properties 中的 " + keyType + " 数据项 " ) ;
return map ;
} }
for (String key : keys.split(",")) { for(String key:keys.split(","))
String path = MdaUtils.getPropertyValue(fileName, key); {
if (!MdaUtils.isEmpty(path)) String path=MdaUtils.getPropertyValue(fileName,key);
map.put(key, path); if(!MdaUtils.isEmpty(path))
map.put(key,path);
} }
} }
log.debug("{}", " out static xmlbod.getDatafieldMapping ... "); log.debug("{}"," out static xmlbod.getDatafieldMapping ... ") ;
return map; return map ;
} }
/** /**
* source:xmlbod.@0005.script * source:xmlbod.@0005.script
*/ */
public static String getRef(String prefix) { public static String getRef(String prefix)
{
//取得上下文 //取得上下文
IContext ctx = MdaEnv.getContext(); IContext ctx = MdaEnv.getContext();
ctx.setErrorCode(NO_ERROR); ctx.setErrorCode(NO_ERROR);
/** /**
* 返回业务参考号,如LC-090817-0001)。 * 返回业务参考号,如LC-090817-0001)。
*/ */
String ownref = ""; String ownref = "" ;
if (!MdaUtils.isEmpty(prefix)) { 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"); String seq = prefix + MdaUtils.format(MdaUtils.today(),"yyMMdd");
ownref = seq + MdaUtils.format(ctx.getDaoSession().dbCounter(prefix+MdaUtils.format(MdaUtils.today(),"yy")),"0000");
} }
return ownref; return ownref ;
} }
public static void writeToSession(Object arg1, Object arg2) { public static void writeToSession(Object arg1,Object arg2){
} }
public static Object readFromSession(Object arg1){
public static Object readFromSession(Object arg1) {
return null; return null;
} }
public static Object getLoginData(String param) { public static Object getLoginData(String param){
return LoginData.getLoginData(param); return LoginData.getLoginData(param);
} }
public static void addEventRule(Object arg1, Object arg2, Object arg3, Object arg4) { public static void addEventRule(Object arg1,Object arg2,Object arg3,Object arg4){
} }
public static void setEmptyImpl(Object... args) {
}
} }
\ No newline at end of file
...@@ -186,7 +186,7 @@ public abstract class AbstractRouteService<V extends BaseVO> { ...@@ -186,7 +186,7 @@ public abstract class AbstractRouteService<V extends BaseVO> {
public boolean isStdErrorNo(String errorNo) { public boolean isStdErrorNo(String errorNo) {
//if (errorNo != null && errorNo.matches("E\\d{4}")) { //if (errorNo != null && errorNo.matches("E\\d{4}")) {
if (errorNo != null) { if (errorNo != null&&!errorNo.equals("")) {
return true; return true;
} }
return false; return false;
......
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