⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 commmethodmgr.java

📁 java阿里巴巴代码
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
/*
 * Created on 2006-6-28
 *
 * To change the template for this generated file go to
 * Window>Preferences>Java>Code Generation>Code and Comments
 */
package com.saas.biz.commen;

import com.saas.biz.mysite.*;
import java.text.*;
import java.util.*;
import java.sql.*;
import java.io.*;
import org.apache.struts.upload.FormFile;
import com.saas.biz.dao.commenDAO.*;
/**
 * @author: Wangrc
 * @Date: 2006-6-28 15:02:58
 * @Method Name: 
 */
public class commMethodMgr
{
	public commMethodMgr(){}
	
	/**
	 * 
	 * @author: Wangrc
	 * @Date: 2006-6-28 15:03:58
	 * @Method Name: GenTradeId
	 */
 
	public String GenTradeId()
	{
		String tradeId = "";
		RandomStrg.setCharset("a-zA-Z0-9");		 
		RandomStrg.setLength("15");	  
		try
		{
			RandomStrg.generateRandomObject();
			tradeId=RandomStrg.getRandom();			 
		}
		catch (Exception e)
		{		 	
		}
		return tradeId;		
	}
	public String GenShortTradeId()
		{
			String tradeId = "";
			RandomStrg.setCharset("a-zA-Z0-9");		 
			RandomStrg.setLength("10");	  
			try
			{
				RandomStrg.generateRandomObject();
				tradeId=RandomStrg.getRandom();			 
			}
			catch (Exception e)
			{		 	
			}
			return tradeId;		
		}
	 
	/**
	 * 
	 * @author: Wangrc
	 * @Date: 2006-6-28 15:06:46
	 * @Method Name: GenSysdate
	 */
	public String GenSysdate(String X_Tag)
	{
		Calendar cal = Calendar.getInstance();
		SimpleDateFormat tradeTime = null;
		String result = "";
		if (X_Tag.equalsIgnoreCase("1"))
		{
			tradeTime = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
		}
		else if (X_Tag.equalsIgnoreCase("2"))
		{
			tradeTime = new SimpleDateFormat("yyyy-MM-dd");
		}	
		else
		{	
			tradeTime = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
		}
		result=tradeTime.format(cal.getTime());
		return result;		
	}
	/**
	 * 
	 * @author: 王仁超
	 * @Date: 2005-7-2
	 * @FileName: newsMgr.java
	 * @PackageName: com.ahbay.newsMgr
	 * @Method Name: splitStr
	 */

	public String splitStr(String str,int len)  
	{ 
		
		int strlen = str.length(); 
		if(len>=strlen) {
			return str;
		} 
		int i = 0; 
		int fixlen = 0; 
		while(i<len){ 
			char chr = str.charAt(i); 
			i++; 
			if(chr<0x80) fixlen++; 
			else if(i<len){ 
				i++; 
				fixlen += 2; 
			}
		} 
		return str.substring(0,fixlen); 
	}
	/**
	 * 
	 * @author: 王仁超
	 * @Date: 2005-7-2
	 * @FileName: newsMgr.java
	 * @PackageName: com.ahbay.newsMgr
	 * @Method Name: convetStrToWeb
	 */
	public String convetStrToWeb(String str)  
	{ 
		String outstr = "";
		if (str == null || str == "")
		{
			 outstr ="";
		}
		else
		{
			try
			{	
				outstr =new String(str.getBytes("GB2312"),"ISO8859_1"); 
			} 
			catch (Exception e)
			{	
				throw new RuntimeException("编码转换错误"+e);
			}		
		}
		if (str == null || str == "")
		{
			 outstr ="";
		}
		return outstr; 
	}
	
	/**
	 * 
	 * @author: 王仁超
	 * @Date: 2005-7-2
	 * @FileName: newsMgr.java
	 * @PackageName: com.ahbay.newsMgr
	 * @Method Name: convetStrToDb
	 */

	public String convetStrToDb(String instr)  
	{ 
		String outstr = "";
		if (instr == null || instr == "")
		{
				outstr ="";
		}
		else
		{		
			try
			{	
				outstr =new String(instr.getBytes("ISO8859_1"),"GB2312"); 
			} 
			catch (Exception e)
			{	
				throw new RuntimeException("编码转换错误"+e);
			}
		}		
		if (instr == null || instr == "")
		{
				outstr ="";
		}
		return outstr; 
	}
	/**
	 * 
	 * @author: Wangrc
	 * @Date: 2006-7-25 11:03:40
	 * @Method Name: ConvertCodeToName()
	 */	
	public String ConvertCodeToName(String strCodeType,String strCode)  
	{
		String strResultName = "";
		String sql = "";
		
		/******************代码实现**************************/
		if (strCodeType.equalsIgnoreCase("sex"))
		{
			if (strCode.equalsIgnoreCase("0")) strResultName = "男性";
			if (strCode.equalsIgnoreCase("1")) strResultName = "女性";
		}
		if (strCodeType.equalsIgnoreCase("bookstate"))
		{
			if (strCode.equalsIgnoreCase("0")) strResultName = "正常库存";
			if (strCode.equalsIgnoreCase("1")) strResultName = "已经借出";
		}
		else if (strCodeType.equalsIgnoreCase("custname"))
		{
			sql = "select cust_name from custperson where cust_id='"+strCode+"' union all " +
				  "select cust_name from custgroup where cust_id='"+strCode+"'";
			strResultName = GetNameForCode(sql);
			 
		}
		else if (strCodeType.equalsIgnoreCase("staffname"))
		{
			sql = "select staff_name from staffinfo where staff_id='"+strCode+"'";
			strResultName = GetNameForCode(sql);			
		}
		else if (strCodeType.equalsIgnoreCase("casetype"))
		{
			sql = "select para_code1 from commpara where subsys_code='WEB' and param_attr='casetype'" +
				"and param_code='"+strCode+"'";
			strResultName = GetNameForCode(sql);			
		}
		else if (strCodeType.equalsIgnoreCase("querytype"))
		{
			sql = "select para_code1 from commpara where subsys_code='WEB' and param_attr='querytype'" +
				"and param_code='"+strCode+"'";
			strResultName = GetNameForCode(sql);			
		}
		else if (strCodeType.equalsIgnoreCase("custrole"))
		{
			sql = "select para_code1 from commpara where subsys_code='WEB' and param_attr='custrole'" +
				"and param_code='"+strCode+"'";
			strResultName = GetNameForCode(sql);			
		}
		else if (strCodeType.equalsIgnoreCase("agentstage"))
		{
			sql = "select para_code1 from commpara where subsys_code='WEB' and param_attr='agentstage'" +
				"and param_code='"+strCode+"'";
			strResultName = GetNameForCode(sql);			
		}
		else if (strCodeType.equalsIgnoreCase("agenttype"))
		{
			sql = "select para_code1 from commpara where subsys_code='WEB' and param_attr='agenttype'" +
				"and param_code='"+strCode+"'";
			strResultName = GetNameForCode(sql);			
		}
		else if (strCodeType.equalsIgnoreCase("filestype"))
		{
			sql = "select para_code1 from commpara where subsys_code='WEB' and param_attr='filestype'" +
				"and param_code='"+strCode+"'";
			strResultName = GetNameForCode(sql);			
		}
		else if (strCodeType.equalsIgnoreCase("booktype"))
		{
			sql = "select para_code1 from commpara where subsys_code='WEB' and param_attr='booktype'" +
				"and param_code='"+strCode+"'";
			strResultName = GetNameForCode(sql);			
		}
		else if (strCodeType.equalsIgnoreCase("booksize"))
		{
			sql = "select para_code1 from commpara where subsys_code='WEB' and param_attr='booksize'" +
				"and param_code='"+strCode+"'";
			strResultName = GetNameForCode(sql);			
		}
		else if (strCodeType.equalsIgnoreCase("itemstate"))
		{
			sql = "select para_code1 from commpara where subsys_code='WEB' and param_attr='itemstate'" +
				"and param_code='"+strCode+"'";
			strResultName = GetNameForCode(sql);			
		}
		else if (strCodeType.equalsIgnoreCase("secretlevel"))
		{
			sql = "select para_code1 from commpara where subsys_code='WEB' and param_attr='secretlevel'" +
				"and param_code='"+strCode+"'";

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -