📄 commmethodmgr.java
字号:
strResultName = GetNameForCode(sql);
}
else if (strCodeType.equalsIgnoreCase("itemkind"))
{
sql = "select para_code1 from commpara where subsys_code='WEB' and param_attr='itemkind'" +
"and param_code='"+strCode+"'";
strResultName = GetNameForCode(sql);
}
else if (strCodeType.equalsIgnoreCase("itemmedia"))
{
sql = "select para_code1 from commpara where subsys_code='WEB' and param_attr='itemmedia'" +
"and param_code='"+strCode+"'";
strResultName = GetNameForCode(sql);
}
else if (strCodeType.equalsIgnoreCase("goodsstate"))
{
sql = "select para_code1 from commpara where subsys_code='WEB' and param_attr='goodsstate'" +
"and param_code='"+strCode+"'";
strResultName = GetNameForCode(sql);
}
else if (strCodeType.equalsIgnoreCase("docustate"))
{
sql = "select para_code1 from commpara where subsys_code='WEB' and param_attr='docustate'" +
"and param_code='"+strCode+"'";
strResultName = GetNameForCode(sql);
}
else if (strCodeType.equalsIgnoreCase("infotype"))
{
sql = "select para_code1 from commpara where subsys_code='WEB' and param_attr='infotype'" +
"and param_code='"+strCode+"'";
strResultName = GetNameForCode(sql);
}
else if (strCodeType.equalsIgnoreCase("mailtype"))
{
sql = "select para_code1 from commpara where subsys_code='WEB' and param_attr='mailtype'" +
"and param_code='"+strCode+"'";
strResultName = GetNameForCode(sql);
}
else if (strCodeType.equalsIgnoreCase("warntype"))
{
sql = "select para_code1 from commpara where subsys_code='WEB' and param_attr='warntype'" +
"and param_code='"+strCode+"'";
strResultName = GetNameForCode(sql);
}
else if (strCodeType.equalsIgnoreCase("opentype"))
{
sql = "select para_code1 from commpara where subsys_code='WEB' and param_attr='opentype'" +
"and param_code='"+strCode+"'";
strResultName = GetNameForCode(sql);
}
else if (strCodeType.equalsIgnoreCase("proofunit"))
{
sql = "select para_code1 from commpara where subsys_code='WEB' and param_attr='proofunit'" +
"and param_code='"+strCode+"'";
strResultName = GetNameForCode(sql);
}
else if (strCodeType.equalsIgnoreCase("proofmedia"))
{
sql = "select para_code1 from commpara where subsys_code='WEB' and param_attr='proofmedia'" +
"and param_code='"+strCode+"'";
strResultName = GetNameForCode(sql);
}
else if (strCodeType.equalsIgnoreCase("itemowndepart"))
{
sql = "select depart_name from departinfo where depart_id='"+strCode+"'";
strResultName = GetNameForCode(sql);
}
else if (strCodeType.equalsIgnoreCase("casersrvstr2"))
{
sql = "select rsrv_str2 from caseinfo where case_id='"+strCode+"'";
strResultName = GetNameForCode(sql);
}
else if (strCodeType.equalsIgnoreCase("modulename"))
{
sql = "select module_name from moduleinfo where module_id='"+strCode+"'";
strResultName = GetNameForCode(sql);
}
else if (strCodeType.equalsIgnoreCase("menuname"))
{
sql = "select menu_name from menuinfo where menu_id='"+strCode+"'";
strResultName = GetNameForCode(sql);
}
else if (strCodeType.equalsIgnoreCase("webname"))
{
sql = "select lmmc from lmxxb where lmbs='"+strCode+"'";
strResultName = GetNameForCode(sql);
}
else if (strCodeType.equalsIgnoreCase("repository_type"))
{
sql =" select para_code2 from td_s_commpara t where t.param_code='"+strCode+"'";
strResultName = GetNameForCode(sql);
}
/******************编码转换**************************/
try
{
strResultName =new String(strResultName.getBytes("GB2312"),"ISO8859_1");
}
catch (Exception e)
{
System.out.println("SQLERROR:"+e.getMessage());
}
return strResultName;
}
/**
*从td_b_productclass表中获取数据
*2007.9.30刘阳
*/
public String getClassNameByClassId(String class_id)
{
String class_name="";
String sql = "select class_name from td_b_productclass where class_id='"+class_id+"'";
try
{
class_name = GetNameForCode(sql);
}catch(Exception e)
{
return "";
}
return class_name;
}
/**
*从td_b_productclass表中获取数据
*2007.10.8刘阳
*/
public String getUserNameByUserId(String user_id)
{
String user_Name="";
String sql = "select user_name from tf_f_user where user_id='"+user_id+"'";
try
{
user_Name = GetNameForCode(sql);
}catch(Exception e)
{
return "";
}
return user_Name;
}
//参数配置
public String genOption(String strOptionName)
{
String str = "";
CommparaExt commparaExt = new CommparaExt();
ArrayList commparaList= new ArrayList();
commparaExt.setParam(":VSUBSYS_CODE", "CRM");
commparaExt.setParam(":VPARAM_CODE", strOptionName);
commparaList = commparaExt.selByList("SEL_BY_CODE");
if (commparaList == null)
{
str = "<option value=0>无数据</option>";
return str;
}
for (Iterator it = commparaList.iterator(); it.hasNext();)
{
HashMap commparaMap = (HashMap) it.next();
String code = "";
String name = "";
if (commparaMap.get("para_code1")!=null) code=commparaMap.get("para_code1").toString();
if (commparaMap.get("para_code2")!=null) name=commparaMap.get("para_code2").toString();
str = str + "<option value="+code+">"+name+"</option>\r\n";
}
return str;
}
/**
*
* @author: Wangrc
* @Date: 2006-7-25 11:17:12
* @Method Name: GetNameForCode
*/
public String GetNameForCode(String strGetSql)
{
ResultSet rst = null;
String strResult = "";
/**
DBQuery.setStrQuery(strGetSql);
rst = DBQuery.SelBizQuery();
try
{
while (rst.next())
{
strResult = rst.getString(1);
if(rst.wasNull()) strResult = "null";
}
}
catch (Exception e)
{
}
**/
return strResult;
}
public String Savefiles(FormFile file,String path)
{
String fileName= file.getFileName();
String contentType = file.getContentType();
String size = (file.getFileSize() + " bytes");
try
{
ByteArrayOutputStream baos = new ByteArrayOutputStream();
InputStream stream = file.getInputStream();
OutputStream bos = new FileOutputStream(path+fileName);
int bytesRead = 0;
byte[] buffer = new byte[8192];
while ((bytesRead = stream.read(buffer, 0, 8192)) != -1) {
bos.write(buffer, 0, bytesRead);
}
bos.close();
stream.close();
}
catch (IOException e) {
return e.getMessage();
}
return "1";
}
/**
* 复制单个文件
* @param oldPath String 原文件路径 如:c:/fqf.txt
* @param newPath String 复制后路径 如:f:/fqf.txt
* @return boolean
*/
public void copyFile(String oldPath, String newPath)
{
try {
int bytesum = 0;
int byteread = 0;
File oldfile = new File(oldPath);
if (oldfile.exists()) { //文件存在时
InputStream inStream = new FileInputStream(oldPath); //读入原文件
FileOutputStream fs = new FileOutputStream(newPath);
byte[] buffer = new byte[1444];
int length;
while ( (byteread = inStream.read(buffer)) != -1) {
bytesum += byteread; //字节数 文件大小
System.out.println(bytesum);
fs.write(buffer, 0, byteread);
}
inStream.close();
}
}
catch (Exception e) {
System.out.println("复制单个文件操作出错");
e.printStackTrace();
}
}
/**
* 分割字符串 add by sjp date:2007-6-25
* @param str String 需分割的字符串
* @param separator String 分割符
* @return String[]
*/
private static String[] strToStrArrayManager(String str,String separator)
{
StringTokenizer strTokens = new StringTokenizer(str, separator);
String[] strArray = new String[strTokens.countTokens()];
int i = 0;
while (strTokens.hasMoreTokens())
{
strArray[i] = strTokens.nextToken().trim();
i++;
}
return strArray;
}
public String setTextYin(String content)
{
String yincontent = content;
String textyin = "<font style=display:none>http://www.bolibaba.com</font>";
yincontent = yincontent.replaceAll("\n", textyin+"\n");
return yincontent;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -