当前位置: 首页 > news >正文

工作流代码

工作流代码

  • 目录
    • 概述
      • 需求:
    • 设计思路
    • 实现思路分析
      • 1.at parata:
      • 2.cash2019
      • 3.cashEntity
      • 4.cashFrmTemplate
      • 5.chartType:
  • 参考资料和推荐阅读

Survive by day and develop by night.
talk for import biz , show your perfect code,full busy,skip hardness,make a better result,wait for change,challenge Survive.
happy for hardess to solve denpendies.

目录

在这里插入图片描述

概述

需求:

设计思路

实现思路分析

1.at parata:

package BP.DA;

import java.io.File;
import java.util.ArrayList;
import java.util.Hashtable;

import BP.Difference.ContextHolderUtils;
import BP.En.Attr;
import BP.En.Attrs;
import BP.En.ClassFactory;
import BP.En.Entities;
import BP.En.Entity;
import BP.En.Map;
import BP.En.SQLCash;
import BP.En.SqlBuilder;
import BP.Pub.RepBill;
import BP.Sys.SysEnum;
import BP.Sys.SysEnumAttr;
import BP.Sys.SysEnums;
import BP.Sys.SystemConfig;
import BP.Tools.ConvertTools;
import BP.Tools.StringHelper;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * Cash 的摘要说明。
 */
public class Cash {

	private static final Logger LOGGER = LoggerFactory.getLogger(Cash.class);
	
	public static Hashtable<String, String> EnumKeySQL_Cash;

	public static String getCaseWhenSQL(String mTable, String key, String field, String enumKey, int def, String tag)
			throws Exception {
		String mykey = mTable + "" + key + "" + field + "" + enumKey + def;

		if (EnumKeySQL_Cash == null)
			EnumKeySQL_Cash = new Hashtable();

		String sql = EnumKeySQL_Cash.get(mykey);
		if (sql != null)
			return sql;

		SysEnums ses = null;
		if (DataType.IsNullOrEmpty(tag) == true) {

			ses = new SysEnums(enumKey);
			if (ses.size() == 0) {
				BP.Sys.XML.EnumInfoXml xml = new BP.Sys.XML.EnumInfoXml(enumKey);
				ses.RegIt(enumKey, xml.getVals());
			}
		} else {
			ses = new SysEnums();
			ses.RegIt(enumKey, tag, true);
			// ses.LoadIt(enumKey);
		}

		sql = " CASE " + mTable + field;
		for (SysEnum se1 : ses.ToJavaList()) {
			sql += " WHEN " + se1.getIntKey() + " THEN '" + se1.getLab() + "'";
		}

		SysEnum se = (SysEnum) ses.GetEntityByKey(SysEnumAttr.IntKey, def);
		if (se == null) {
			sql += " END \"" + key + "Text\"";
		} else {
			sql += " WHEN NULL THEN '" + se.getLab() + "' END \"" + key + "Text\"";
		}
		EnumKeySQL_Cash.put(mykey, sql);

		return sql;

	}
	
	static {
		if (!SystemConfig.getIsBSsystem()) {
			CS_Cash = new Hashtable<String, Object>();
		}
	}
	public static Hashtable<String, Object> CS_Cash;

	// Bill_Cash 单据模板cash.
	private static Hashtable _Bill_Cash;

	public static Hashtable getBill_Cash() {
		if (_Bill_Cash == null) {
			_Bill_Cash = new Hashtable();
		}
		return _Bill_Cash;
	}

	// BS_Cash
	private static Hashtable<String, Object> _BS_Cash;

	public static Hashtable<String, Object> getBS_Cash() {
		if (_BS_Cash == null) {
			_BS_Cash = new Hashtable<String, Object>();
		}
		return _BS_Cash;
	}

	public static void ClearCash() {
		if (_BS_Cash != null)
			_BS_Cash.clear();

		if (_SQL_Cash != null)
			_SQL_Cash.clear();

		if (_EnsData_Cash != null)
			_EnsData_Cash.clear();

		if (_Map_Cash != null)
			_Map_Cash.clear();

		if (_EnsData_Cash_Ext != null)
			_EnsData_Cash_Ext.clear();

		if (_Bill_Cash != null)
			_Bill_Cash.clear();

	}

	// SQL cash
	private static Hashtable<String, Object> _SQL_Cash;

	public static Hashtable<String, Object> getSQL_Cash() {
		if (_SQL_Cash == null) {
			_SQL_Cash = new Hashtable<String, Object>();
		}
		return _SQL_Cash;
	}

	public static SQLCash GetSQL(String clName) {
		SQLCash tempVar = (SQLCash) getSQL_Cash().get(clName);
		return (SQLCash) ((tempVar instanceof SQLCash) ? tempVar : null);
	}

	public static void SetSQL(String clName, SQLCash csh) {
		if (clName == null || csh == null) {
			throw new RuntimeException("clName.  csh 参数有一个为空。");
		}
		getSQL_Cash().put(clName, csh);
	}

	public static void InitSQL() throws Exception {
		ArrayList<Entity> al = ClassFactory.GetObjects("Entity");
		for (Entity en : al) {
			String sql = SqlBuilder.Retrieve(en);
		}
	}

	// EnsData cash
	private static Hashtable<String, Object> _EnsData_Cash;

	public static Hashtable<String, Object> getEnsData_Cash() {
		if (_EnsData_Cash == null) {
			_EnsData_Cash = new Hashtable<String, Object>();
		}
		return _EnsData_Cash;
	}

	public static Entities GetEnsData(String clName) {
		Entities tempVar = (Entities) getEnsData_Cash().get(clName);
		Entities ens = (Entities) ((tempVar instanceof Entities) ? tempVar : null);
		if (ens == null) {
			return null;
		}

		if (ens.size() == 0) {
			return null;
		}
		// throw new Exception(clName + "个数为0");
		return ens;
	}

	public static void EnsDataSet(String clName, Entities obj) {
		if (obj.size() == 0) {
			/**
			 * obj.RetrieveAll();
			 */

			// throw new Exception(clName +
			// "设置个数为0 , 请确定这个缓存实体,是否有数据?sq=select * from " +
			// obj.GetNewEntity.getEnMap().getPhysicsTable());
		}

		getEnsData_Cash().put(clName, obj);
	}

	public static void remove(String clName) {
		getEnsData_Cash().remove(clName);
	}

	// EnsData cash 扩展 临时的cash 文件。
	private static Hashtable<String, Object> _EnsData_Cash_Ext;

	public static Hashtable<String, Object> getEnsData_Cash_Ext() {
		if (_EnsData_Cash_Ext == null) {
			_EnsData_Cash_Ext = new Hashtable<String, Object>();
		}
		return _EnsData_Cash_Ext;
	}

	/**
	 * 为部分数据做的缓冲处理
	 * 
	 * @param clName
	 * @return
	 */
	public static Entities GetEnsDataExt(String clName) {
		// 判断是否失效了。
		if (SystemConfig.getIsTempCashFail()) {
			getEnsData_Cash_Ext().clear();
			return null;
		}

		try {
			Entities ens;
			Entities tempVar = (Entities) getEnsData_Cash_Ext().get(clName);
			ens = (Entities) ((tempVar instanceof Entities) ? tempVar : null);
			return ens;
		} catch (java.lang.Exception e) {
			return null;
		}
	}

	/**
	 * 为部分数据做的缓冲处理
	 * 
	 * @param clName
	 * @param obj
	 */
	public static void SetEnsDataExt(String clName, Entities obj) {
		if (clName == null || obj == null) {
			throw new RuntimeException("clName.  obj 参数有一个为空。");
		}
		getEnsData_Cash_Ext().put(clName, obj);
	}

	// map cash
	private static Hashtable<String, Object> _Map_Cash;

	public static Hashtable<String, Object> getMap_Cash() {
		if (_Map_Cash == null) {
			_Map_Cash = new Hashtable<String, Object>();
		}
		return _Map_Cash;
	}

	public static Map GetMap(String clName) {
		try {
			Map tempVar = (Map) getMap_Cash().get(clName);
			return (Map) ((tempVar instanceof Map) ? tempVar : null);
		} catch (java.lang.Exception e) {
			return null;
		}
	}

	public static void SetMap(String clName, Map map) {
		if (clName == null)
			return;

		// throw new Exception("clName.不能为空。");
		if (map == null) {
			getMap_Cash().remove(clName);
			return;
		}

		getMap_Cash().put(clName, map);
	}

	// 取出对象
	/**
	 * 从 Cash 里面取出对象.
	 */
	public static Object GetObj(String key, Depositary where) {
		if (where == Depositary.None) {
			throw new RuntimeException("您没有把(" + key + ")放到session or application 里面不能找出他们.");
		}
		if (SystemConfig.getIsBSsystem()) {
			if (where == Depositary.Application)
			// return BP.Glo.HttpContextCurrent.Cache(key);
			{
				return getBS_Cash().get(key); // BP.Glo.HttpContextCurrent.Cache(key);
			} else {
				/*
				 * warning return BP.Glo.getHttpContextCurrent().Session(key);
				 */
				return ContextHolderUtils.getSession().getAttribute(key);
			}
		} else {
			return CS_Cash.get(key);
		}
	}

	public static Object GetObj(String key) {
		if (SystemConfig.getIsBSsystem()) {
			Object obj = getBS_Cash().get(key); // Cash.GetObjFormApplication(key,
												// null);
			if (obj == null) {
				obj = Cash.GetObjFormSession(key);
			}
			return obj;
		} else {
			return CS_Cash.get(key);
		}
	}

	/**
	 * 删除 like 名称的缓存对象。
	 * 
	 * @param likeKey
	 * @return
	 */
	public static int DelObjFormApplication(String likeKey) {
		int i = 0;
		if (SystemConfig.getIsBSsystem()) {
			String willDelKeys = "";
			for (String key : getBS_Cash().keySet()) {
				if (!key.contains(likeKey)) {
					continue;
				}
				willDelKeys += "@" + key;
			}

			String[] strs = willDelKeys.split("(@)", -1);
			for (String s : strs) {
				if (s == null || s.equals("")) {
					continue;
				}
				getBS_Cash().remove(s);
				i++;
			}
		} else {
			String willDelKeys = "";
			for (String key : CS_Cash.keySet()) {
				if (!key.contains(likeKey)) {
					continue;
				}
				willDelKeys += "@" + key;
			}

			String[] strs = willDelKeys.split("(@)", -1);
			for (String s : strs) {
				if (s == null || s.equals("")) {
					continue;
				}
				CS_Cash.remove(s);
				i++;
			}
		}

		return i;
	}

	public static Object GetObjFormApplication(String key, Object isNullAsVal) {
		if (SystemConfig.getIsBSsystem()) {
			Object obj = getBS_Cash().get(key); // BP.Glo.HttpContextCurrent.Cache(key);
			if (obj == null) {
				return isNullAsVal;
			} else {
				return obj;
			}
		} else {
			Object obj = CS_Cash.get(key);
			if (obj == null) {
				return isNullAsVal;
			} else {
				return obj;
			}
		}
	}

	public static Object GetObjFormSession(String key) {
		if (SystemConfig.getIsBSsystem()) {
			try {
				/*
				 * warning return BP.Glo.getHttpContextCurrent().Session(key);
				 */
				return ContextHolderUtils.getSession().getAttribute(key);
			} catch (java.lang.Exception e) {
				return null;
			}
		} else {
			return CS_Cash.get(key);
		}
	}

	// remove Obj
	/**
	 * RemoveObj
	 * 
	 * @param key
	 * @param where
	 */
	public static void RemoveObj(String key, Depositary where) {
		if (!Cash.IsExits(key, where)) {
			return;
		}

		if (SystemConfig.getIsBSsystem()) {
			if (where == Depositary.Application) {
				/*
				 * warning BP.Glo.getHttpContextCurrent().Cache.remove(key);
				 */
			} else {
				/*
				 * warning BP.Glo.getHttpContextCurrent().Session.remove(key);
				 */
				ContextHolderUtils.getSession().removeAttribute(key);
			}
		} else {
			CS_Cash.remove(key);
		}
	}

	// 放入对象
	public static void RemoveObj(String key) {
		getBS_Cash().remove(key);
	}

	public static void AddObj(String key, Depositary where, Object obj) {
		if (key == null) {
			throw new RuntimeException("您需要为obj=" + obj.toString() + ",设置为主键值。key");
		}

		if (obj == null) {
			throw new RuntimeException("您需要为obj=null  设置为主键值。key=" + key);
		}

		if (where == Depositary.None) {
			throw new RuntimeException("您没有把(" + key + ")放到 session or application 里面设置他们.");
		}
		// if (Cash.IsExits(key, where))
		// return;

		if (SystemConfig.getIsBSsystem()) {
			if (where == Depositary.Application) {
				getBS_Cash().put(key, obj);
			} else {
				/*
				 * warning BP.Glo.getHttpContextCurrent().Session(key) = obj;
				 */
				ContextHolderUtils.getSession().setAttribute(key, obj);
			}
		} else {
			if (CS_Cash.containsKey(key)) {
				CS_Cash.put(key, obj);
			} else {
				CS_Cash.put(key, obj);
			}
		}
	}

	// 判断对象是不是存在
	/**
	 * 判断对象是不是存在
	 */
	public static boolean IsExits(String key, Depositary where) {
		if (SystemConfig.getIsBSsystem()) {
			if (where == Depositary.Application) {
				/*
				 * warning if (BP.Glo.getHttpContextCurrent().Cache(key) ==
				 * null) { return false; } else { return true; }
				 */
				return true;
			} else {
				/*
				 * warning if (BP.Glo.getHttpContextCurrent().Session(key) ==
				 * null) { return false; } else { return true; }
				 */
				return true;
			}
		} else {
			return CS_Cash.containsKey(key);
		}
	}

	public static String GetBillStr(String cfile, boolean isCheckCash) {
		String val = (String) ((getBill_Cash().get(cfile) instanceof String) ? getBill_Cash().get(cfile) : null);
		if (isCheckCash == true) {
			val = null;
		}

		if (StringHelper.isNullOrEmpty(val)) {
			String file = null;
			if (cfile.contains(":")) {
				file = cfile;
			} else {
				file = SystemConfig.getPathOfDataUser() + "CyclostyleFile/" + cfile;
			}

			if (SystemConfig.getIsDebug()) {
				RepBill.RepairBill(file);
			}
			try {
				val = ConvertTools.StreamReaderToStringConvert(file, "us-ascii");
			} catch (Exception ex) {
				throw new RuntimeException("@读取单据模板时出现错误。cfile=" + cfile + " @Ex=" + ex.getMessage());
			}
			_Bill_Cash.put(cfile, val);
		}
		return val.substring(0);
	}

	public static String[] GetBillParas(String cfile, String ensStrs, Entities ens) {
		String[] paras = (String[]) ((getBill_Cash().get(cfile + "Para") instanceof String[])
				? getBill_Cash().get(cfile + "Para") : null);
		if (paras != null) {
			return paras;
		}

		Attrs attrs = new Attrs();
		for (Entity en : Entities.convertEntities(ens)) {
			String perKey = en.toString();

			Attrs enAttrs = en.getEnMap().getAttrs();
			for (Attr attr : Attrs.convertAttrs(enAttrs)) {
				Attr attrN = new Attr();
				attrN.setKey(perKey + "." + attr.getKey());

				// attrN.Key = attrN.Key.replace("\\f2","");
				// attrN.Key = attrN.Key.replace("\\f3", "");

				if (attr.getIsRefAttr()) {
					attrN.setField(perKey + "." + attr.getKey() + "Text");
				}
				attrN.setMyDataType(attr.getMyDataType());
				attrN.setMyFieldType(attr.getMyFieldType());
				attrN.setUIBindKey(attr.getUIBindKey());
				attrN.setField(attr.getField());
				attrs.Add(attrN);
			}
		}

		paras = Cash.GetBillParas_Gener(cfile, attrs);
		_Bill_Cash.put(cfile + "Para", paras);
		return paras;
	}

	public static String[] GetBillParas(String cfile, String ensStrs, Entity en) {
		String[] paras = (String[]) ((getBill_Cash().get(cfile + "Para") instanceof String[])
				? getBill_Cash().get(cfile + "Para") : null);
		if (paras != null) {
			return paras;
		}

		paras = Cash.GetBillParas_Gener(cfile, en.getEnMap().getAttrs());
		_Bill_Cash.put(cfile + "Para", paras);
		return paras;
	}

	public static String[] GetBillParas_Gener(String cfile, Attrs attrs) {
		// Attrs attrs = en.getEnMap().getAttrs();
		String[] paras = new String[300];
		String Billstr = Cash.GetBillStr(cfile, true);
		char[] chars = Billstr.toCharArray();
		String para = "";
		int i = 0;
		boolean haveError = false;
		String msg = "";
		for (char c : chars) {
			if (c == '>') {
				// 首先解决空格的问题.
				String real = para.toString();
				if (attrs != null && real.contains(" ")) {
					real = real.replace(" ", "");
					Billstr = Billstr.replace(para, real);
					para = real;
					haveError = true;
				}

				// 解决特殊符号
				if (attrs != null && real.contains("\\") && real.contains("ND") == false) {
					haveError = true;
					String findKey = null;
					int keyLen = 0;
					for (Attr attr : attrs) {
						if (real.contains(attr.getKey())) {
							if (keyLen <= attr.getKey().length()) {
								keyLen = attr.getKey().length();
								findKey = attr.getKey();
							}
						}
					}

					if (findKey == null) {
						msg += "@参数:<font color=red><b>(" + real + ")</b></font>可能拼写错误。";
						continue;
					}

					if (real.contains(findKey + ".NYR") == true) {
						real = findKey + ".NYR";
					} else if (real.contains(findKey + ".RMB") == true) {
						real = findKey + ".RMB";
					} else if (real.contains(findKey + ".RMBDX") == true) {
						real = findKey + ".RMBDX";
					} else {
						real = findKey;
					}

					Billstr = Billstr.replace(para, real);
					// msg += "@参数:<font color=red><b>(" + para +
					// ")</b></font>不符合规范。";
					// continue;
				}

				// paras.SetValue(para, i);
				paras[i] = para;
				i++;
			}

			if (c == '<') {
				para = ""; // 如果遇到了 '<' 开始记录
			} else {
				if ((new Character(c)).toString().equals("")) {
					continue;
				}
				para += (new Character(c)).toString();
			}
		}

		if (haveError) {
			String myfile = SystemConfig.getPathOfDataUser() + "/CyclostyleFile/" + cfile;
			if (!new File(myfile).exists()) {
				myfile = cfile;
			}

			// throw new Exception("@没有文件:"+myfile);
			try {
				ConvertTools.StreamWriteConvert(Billstr, myfile);
			} catch (Exception e) {
				LOGGER.error("GetBillParas_Gener", e);
			}
			// StreamWriter wr = new StreamWriter(myfile, false,
			// Encoding.ASCII);
			// wr.Write(Billstr);
			// wr.Close();
		}

		if (!msg.equals("")) {
			// String s =
			// "@帮助信息:用记事本打开它模板,找到红色的字体.
			// 把尖括号内部的非法字符去了,例如:《|f0|fs20RDT.NYR|lang1033|kerning2》,修改后事例:《RDT.NYR》。@注意把双引号代替单引号,竖线代替反斜线。";
			// throw new
			// Exception("@单据模板("+cfile+")如下标记出现错误,系统无法修复它,需要您手工的删除标记或者用记事本打开查找到这写标记修复他们.@"
			// + msg + s);
		}
		return paras;
	}
}

2.cash2019

package BP.DA;

import java.util.Hashtable;

import BP.En.Entities;
import BP.En.Row;

public class Cash2019
{
	private static Hashtable _hts;
	public static Hashtable gethts()
	{
		if (_hts == null)
		{
			_hts = new Hashtable();
		}
		return _hts;
	}

	/** 
	 把实体放入缓存里面
	 
	 @param enName
	 @param ens
	 @param enPK
	*/
	public static void PutRow(String enName, String pkVal, Row row)
	{
		synchronized (lockObj)
		{
			Hashtable tempVar = (Hashtable)gethts().get(enName);
			Hashtable ht = (Hashtable)((tempVar instanceof Hashtable) ? tempVar : null);
			if (ht == null)
			{
				ht = new Hashtable();
				gethts().put(enName, ht);
			}
			ht.put(pkVal.toString(), row);
		}
	}
	public static void UpdateRow(String enName, String pkVal, Row row)
	{
		synchronized (lockObj)
		{
			Hashtable tempVar = (Hashtable) gethts().get(enName);
			Hashtable ht = (Hashtable)((tempVar instanceof Hashtable) ? tempVar : null);
			if (ht == null)
			{
				ht = new Hashtable();
				gethts().put(enName, ht);
			}
			ht.put(pkVal, row);
		}
	}
	public static void DeleteRow(String enName, String pkVal)
	{
		synchronized (lockObj)
		{
			Hashtable tempVar = (Hashtable)gethts().get(enName);
			Hashtable ht = (Hashtable)((tempVar instanceof Hashtable) ? tempVar : null);
			if (ht == null)
			{
				ht = new Hashtable();
				gethts().put(enName, ht);
			}
			ht.remove(pkVal.toString());
		}
	}
	private static Object lockObj = new Object();
	/** 
	 获得实体类
	 
	 @param enName 实体名字
	 @param pkVal 键
	 @return row
	*/
	public static Row GetRow(String enName, String pkVal)
	{
		synchronized (lockObj)
		{
			Hashtable tempVar = (Hashtable)gethts().get(enName);
			Hashtable ht = (Hashtable)((tempVar instanceof Hashtable) ? tempVar : null);
			if (ht == null)
			{
				return null;
			}
			if (ht.containsKey(pkVal) == true)
			{
				return (Row)((ht.get(pkVal) instanceof Row) ? ht.get(pkVal) : null);
			}
			return null;
		}
	}

	/** 
	 把集合放入缓存.
	 
	 @param ensName 集合实体类名
	 @param ens 实体集合
	*/
	public static void PutEns(String ensName, Entities ens)
	{
		//StackExchange.Redis
	}
	/** 
	 获取实体集合类
	 
	 @param ensName 集合类名
	 @param pkVal 主键
	 @return 实体集合
	*/
	public static Entities GetEns(String ensName, Object pkVal)
	{
		return null;
	}
}

3.cashEntity

package BP.DA;

import BP.En.Entities;
import BP.En.Entity;

public class CashEntity
{
	// Hashtable 属性
	private static java.util.Hashtable _Cash;
	
	public static java.util.Hashtable getDCash()
	{
		if (_Cash == null)
		{
			_Cash = new java.util.Hashtable();
		}
		return _Cash;
	}
	
	/**
	 * 把实体放入缓存里面
	 * 
	 * @param enName
	 * @param ens
	 * @param enPK
	 */
	public static void PubEns(String enName, Entities ens, String enPK)
	{
		Object tempVar = CashEntity.getDCash().get(enName);
		java.util.Hashtable ht = (java.util.Hashtable) ((tempVar instanceof java.util.Hashtable) ? tempVar
				: null);
		if (ht == null)
		{
			ht = new java.util.Hashtable();
		}
		
		ht.clear();
		for (Object en : ens)
		{
			ht.put(((Entity) en).GetValStrByKey(enPK), (Entity) en);
		}
		// 把实体集合放入.
		CashEntity.getDCash().put(enName + "Ens", ens);
	}
	
	public static Entities GetEns(String enName)
	{
		Object tempVar = CashEntity.getDCash().get(enName + "Ens");
		Entities ens = (Entities) ((tempVar instanceof Entities) ? tempVar
				: null);
		return ens;
	}
	
	/**
	 * 更新对象
	 * 
	 * @param enName
	 * @param key
	 * @param en
	 */
	public static void Update(String enName, String key, Entity en)
	{
		Object tempVar = CashEntity.getDCash().get(enName);
		java.util.Hashtable ht = (java.util.Hashtable) ((tempVar instanceof java.util.Hashtable) ? tempVar
				: null);
		if (ht == null)
		{
			ht = new java.util.Hashtable();
			CashEntity.getDCash().put(enName, ht);
		}
		ht.put(key, en);
		
		//此处增加一个清缓存,解决java缓存问题
		CashEntity.getDCash().remove(enName);
		
		// 清除集合.
		CashEntity.getDCash().remove(enName + "Ens");
	}
	
	/**
	 * 获取一个实体
	 * 
	 * @param enName
	 *            实体Name
	 * @param pkVal
	 *            主键值
	 * @return 返回这个实体
	 */
	public static Entity Select(String enName, String pkVal)
	{
		Object tempVar = CashEntity.getDCash().get(enName);
		java.util.Hashtable ht = (java.util.Hashtable) ((tempVar instanceof java.util.Hashtable) ? tempVar
				: null);
		if (ht == null)
		{
			return null;
		}
		
		return (Entity) ((ht.get(pkVal) instanceof Entity) ? ht.get(pkVal)
				: null);
	}
	
	/**
	 * 删除
	 * 
	 * @param enName
	 * @param pkVal
	 */
	public static void Delete(String enName, String pkVal)
	{
		Object tempVar = CashEntity.getDCash().get(enName);
		java.util.Hashtable ht = (java.util.Hashtable) ((tempVar instanceof java.util.Hashtable) ? tempVar
				: null);
		if (ht == null)
		{
			return;
		}
		
		ht.remove(pkVal);
		// 清除集合.
		CashEntity.getDCash().remove(enName + "Ens");
	}
	
	/**
	 * 插入
	 * 
	 * @param enName
	 * @param en
	 * @param pkVal
	 */
	public static void Insert(String enName, String pkVal, Entity en)
	{
		Object tempVar = CashEntity.getDCash().get(enName);
		java.util.Hashtable ht = (java.util.Hashtable) ((tempVar instanceof java.util.Hashtable) ? tempVar
				: null);
		if (ht == null)
		{
			//CashEntity.getDCash().remove("BP.WF.Rpt.MapRptEns");
			return;
		}
		
		// edited by liuxc,2014-8-21 17:21
		if (ht.containsKey(pkVal))
		{
			ht.put(pkVal, en);
		} else
		{
			ht.put(pkVal, en);
		}
		
		// 清除集合.
		CashEntity.getDCash().remove(enName + "Ens");
	}
}

4.cashFrmTemplate

package BP.DA;
import java.io.IOException;

public class CashFrmTemplate
{
	//缓存
	private static java.util.Hashtable _hts;

	/**
	 * 放入表单
	 * @param frmID
	 * @param ds
	 */
	public static void Put(String frmID, DataSet ds)
	{
		String json = BP.Tools.Json.ToJson(ds);

		synchronized (lockObj)
		{
			if (_hts == null)
			{
				_hts = new java.util.Hashtable();
			}

			if (_hts.containsKey(frmID) == false)
			{
				_hts.put(frmID, json);
			}
			else
			{
				_hts.put(frmID, json);
			}
		}
	}

	/**
	 *  移除
	 * @param frmID
	 */
	public static void Remove(String frmID)
	{
		synchronized (lockObj)
		{
			if (_hts == null)
			{
				_hts = new java.util.Hashtable();
			}

			_hts.remove(frmID);
		}
	}
	private static Object lockObj = new Object();

	/**
	 * 获得表单DataSet模式的模版数据
	 * @param frmID
	 * @return
	 * @throws ClassNotFoundException
	 * @throws IOException
	 */
	public static DataSet GetFrmDataSetModel(String frmID) throws ClassNotFoundException, IOException
	{
		synchronized (lockObj)
		{
			if (_hts == null)
			{
				_hts = new java.util.Hashtable();
			}

			if (_hts.containsKey(frmID) == true)
			{
				String json = (String)((_hts.get(frmID) instanceof String) ? _hts.get(frmID) : null);
				
				DataSet ds = BP.Tools.Json.ToDataSet(json);
				return ds;
			}
			return null;
		}
	}

	/**
	 * 获得表单json模式的模版数据
	 * @param frmID
	 * @return
	 */
	public static String GetFrmJsonModel(String frmID)
	{
		synchronized (lockObj)
		{
			if (_hts == null)
			{
				_hts = new java.util.Hashtable();
			}

			if (_hts.containsKey(frmID) == true)
			{
				String json = (String)((_hts.get(frmID) instanceof String) ? _hts.get(frmID) : null);
				return json;
			}
			return null;
		}
	}
}

5.chartType:

package BP.DA;

/**
 * 图表类型
 */
public enum ChartType
{
	/**
	 * 柱状图
	 */
	Histogram,
	/**
	 * 丙状图
	 */
	Pie,
	/**
	 * 折线图
	 */
	Line;
	
	public int getValue()
	{
		return this.ordinal();
	}
	
	public static ChartType forValue(int value)
	{
		return values()[value];
	}
}
在这里插入代码片

在这里插入图片描述

参考资料和推荐阅读

  1. 暂无

欢迎阅读,各位老铁,如果对你有帮助,点个赞加个关注呗!~

相关文章:

  • wordpress如何添加广告悬浮按钮/足球队世界排名榜
  • 河北怎样做网站/市场营销推广方案模板
  • 专业建站网产品网络推广/线上渠道推广有哪些方式
  • 北京东城区做网站的公司/网络营销的核心是
  • 男女做那个视频的网站/seo手机排名软件
  • 宜兴网站建设/怎么找需要做推广的公司
  • 使用批处理__更改ip
  • 第一章 TCP/IP 协议
  • 前端面试当中 js原型及原型链常考知识点
  • 【代码随想录】343. 整数拆分
  • 使用nginx搭建HTTP FLV流媒体服务器
  • 11 Java接口(语法、规范、微观宏观接口)
  • 前端学习路线(包括计算机基础,算法,项目开发等学习路径)
  • 实战18:基于深度学习的人脸识系统(完整代码+数据+报告+可作为毕设)
  • Vue 2.x源码学习:数据响应式改造
  • OpenJudge NOI 2.2 9273:PKU2506Tiling | 2.3 9273:PKU2506Tiling
  • 【微信小程序】动态设置导航栏标题
  • day49 业务逻辑水平垂直越权访问控制脆弱验证