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

📄 interfacemgr.java

📁 java阿里巴巴代码
💻 JAVA
字号:
package com.saas.biz.interfaceMgr;

import java.util.*;
import java.util.HashMap;
import com.ahbay.commenMgr.*;
import com.saas.biz.dao.actionDAO.ActionInfoDAO;
import com.saas.biz.dao.actionDAO.ActionInfoExt;
import com.saas.sys.buffer.Buffers;
import com.saas.sys.dbm.Dbtable;
import com.saas.sys.exp.SaasApplicationException;
import com.saas.sys.log.Logger;
import javax.servlet.http.*;
import com.saas.biz.dao.userDAO.UserDAO;
import com.saas.biz.dao.userDAO.UserExt;
import com.saas.biz.dao.custDAO.CustomerDAO;
import com.saas.biz.dao.custDAO.CustomerExt;

public class InterfaceMgr{
	Logger log;

	Buffers inBuffer;

	Buffers outBuffer;

	Dbtable tradeQuery;

	ArrayList queryResult = new ArrayList();
    
	public InterfaceMgr() {
		log = new Logger(this);
		tradeQuery = new Dbtable();
		outBuffer = new Buffers();
	}

	public void setOutBuffer(Buffers outBuffer) {
		this.outBuffer = outBuffer;
	}

	public Buffers getOutBuffer() {
		return this.outBuffer;
	}

	public void setTradeQuery(Dbtable tradeQuery) {
		this.tradeQuery = tradeQuery;
	}

	public Dbtable getTradeQuery() {
		return this.tradeQuery;
	}

	public ArrayList getQueryResult() {
		return this.queryResult;
	}

	public void setQueryResult(ArrayList queryResult) {
		this.queryResult = queryResult;
	}


	public ArrayList getInterfaceData(HttpServletRequest req) 
	{
		log.LOG_INFO("进入getInterfaceData方法...");
		 
		ArrayList outDataList = new ArrayList();
		String tf_type = "";
		String tf_id = "";
		String username = req.getParameter("user_name");		 
		String userpasswd=req.getParameter("passwd");
		String login_tag=req.getParameter("login_tag");
		if (req.getParameter("tf_type") != null)
		{
		    tf_type = req.getParameter("tf_type");
		}
		if (req.getParameter("tf_id") != null)
		{
		    tf_id = req.getParameter("tf_id");
		}
		try 
		{			
			outDataList = getInterfaceData(tf_type,tf_id,username,userpasswd,login_tag);
		}
		catch (Exception e) {
			throw new RuntimeException(e);	
		}
		log.LOG_INFO("退出getInterfaceData方法...");
		return outDataList;
	}
	 
    public ArrayList getInterfaceData(String getType,String tf_id,String username,String userpasswd,String login_tag) throws SaasApplicationException
	{
		commMethodMgr comm = new commMethodMgr();
		ArrayList outList = new ArrayList();
		UserExt userExt = new UserExt();
		UserDAO userDao = new UserDAO();
		ArrayList itemsList = new ArrayList();	
		ArrayList custList = new ArrayList();	 
		String user_id = "";
		String  user_name= "";
		String  cust_id= "";   
		String web_login_tag ="";   
		String user_state ="";
		String cust_class ="";
		String cust_name ="";
		String depart_code="";
		String id = comm.GenTradeId();
		   userExt.setParam(":VUSER_NAME", username);
            itemsList = userExt.selByList("SEL_BY_CHECK");
        try
        {
            if (!login_tag.equals("1"))
		    {
         
        		if (itemsList == null || itemsList.isEmpty())
        		{			
        			throw new RuntimeException("用户名不存在!");		
        		}	 
        		else
        		{
        		    Iterator it = itemsList.iterator(); it.hasNext();
        		    HashMap itemsListMap = (HashMap) it.next();
        		    user_id = itemsListMap.get("user_id").toString();
        		    user_name= itemsListMap.get("user_name").toString();
        		    userpasswd= itemsListMap.get("passwd").toString();
        		    cust_id= itemsListMap.get("cust_id").toString();
        		    user_state= itemsListMap.get("user_state").toString();
        		    web_login_tag= itemsListMap.get("web_login_tag").toString();
        		    cust_class= itemsListMap.get("cust_class").toString();
        		    if (itemsListMap.get("depart_code")!= null) depart_code= itemsListMap.get("depart_code").toString();
        		    custList=genSpecCustInfo(cust_id);
        		    if (custList != null)
        		    {
        		        Iterator cit = custList.iterator(); cit.hasNext();
            		    HashMap cListMap = (HashMap) cit.next();
            		    cust_name = cListMap.get("cust_name").toString();
        		    }
        	    }
        		if (userDao == null)
        		{
        			throw new RuntimeException("用户名不存在!");
        		}	 
        		if (!userpasswd.trim().equalsIgnoreCase(userpasswd))
        		{			 
        			throw new RuntimeException("用户密码错误!");
        		}
        		if(user_state.toString().equals("1"))
        		{ 
        			throw new RuntimeException("用户当前状态不允许登录!"); 
        		}
        		if(user_state.toString().equals("2"))
        		{
        			throw new RuntimeException("用户当前状态不允许登录!"); 
        		}
        		if(web_login_tag.toString().equals("0"))
        		{			 
        			throw new RuntimeException("您的帐号还没有激活,不允许登录,请到注册时候填写的邮箱里收取激活邮件!"); 		 
                }            
	        }
    		if (getType.equals("1"))
    		{
    		    outList = this.getInfoPage(tf_id);  //公司通知
    		    HashMap datamap = new HashMap();
    		    datamap.put("trade_type_code", "1009");
    		    datamap.put("session_user_name", user_name);
    		    datamap.put("session_user_id", user_id);
    		    datamap.put("depart_code", depart_code);
    		    datamap.put("path", depart_code);
    		    datamap.put("xvisible",tf_id);
     
    		    outList.add(datamap); 
    		}
    		else if (getType.equals("2"))
    		{
    		    outList = this.getInfoPage(tf_id); //公司新闻
    		    HashMap datamap = new HashMap();
    		    datamap.put("trade_type_code", "1009");
    		    datamap.put("session_user_name", user_name);
    		    datamap.put("session_user_id", user_id);
    		    datamap.put("depart_code", depart_code);
    		    datamap.put("path", depart_code);
    		    datamap.put("xvisible",tf_id);
    		    datamap.put("id",id);
    		    outList.add(datamap);
    		}
    		else if (getType.equals("3"))
    		{
    		    outList = this.getYpPage(tf_id); //公司潜在客户
    		    HashMap datamap = new HashMap();
    		    datamap.put("trade_type_code", "1047");
    		    datamap.put("session_user_name", tf_id);
    		    datamap.put("session_user_id", user_id);
    		    datamap.put("session_cust_id", cust_id); 
    		    datamap.put("depart_code", depart_code);
    		    datamap.put("cust_id", comm.GenTradeId());
    		    datamap.put("user_id", comm.GenTradeId());
    		    datamap.put("user_name",tf_id);
                datamap.put("password","111111");
                datamap.put("pspt_type_code","0");
                datamap.put("web_login_tag","0");
                datamap.put("pspt_id","0");
                datamap.put("eparchy_code","");
                datamap.put("sex","0");
                datamap.put("passwd_ques","");
                datamap.put("passwd_answer","");
                datamap.put("qq","");
                datamap.put("home_addr","");
                datamap.put("work_depart","");
                datamap.put("educate_degree_code","");
                datamap.put("folk_code","");
                datamap.put("birthday","");
                datamap.put("pspt_addr","");
                datamap.put("country_code","");
                datamap.put("post_addr","");
                datamap.put("blog","");
                datamap.put("work_name","");
                datamap.put("job","");
                datamap.put("marriage","");
                datamap.put("cust_aim","");
                datamap.put("company_address","");
                datamap.put("fax_nbr","");
                datamap.put("user_count","0"); 
                datamap.put("group_contact_phone","");
                datamap.put("calling_type_code","");
                datamap.put("juristic","");
                datamap.put("bigsort","");
                datamap.put("salekeyword","");
                datamap.put("buykeyword","");
                datamap.put("group_memo","");
                datamap.put("website","");
                datamap.put("rsrv_str1","0");
                datamap.put("relation_type_code","4");  
                datamap.put("relation_type_name","潜在客户");   
                
                datamap.put("entity_type","0");
                datamap.put("e_class_id","0");
                datamap.put("e_class_name","未分类客户");
                datamap.put("e_class_id_grp","");
                datamap.put("e_class_name_grp",""); 
    		    outList.add(datamap);
    		}
    		else if (getType.equals("4"))
    		{
    		    outList = this.getYpPage(tf_id); //公司竞争对手
    		    HashMap datamap = new HashMap();
    		    datamap.put("trade_type_code", "1234");
    		    outList.add(datamap);
    		}
    		else if (getType.equals("5"))
    		{
    		    outList = this.getGyPage(tf_id); //公司通知
    		    HashMap datamap = new HashMap();
    		    datamap.put("trade_type_code", "1009");
    		    datamap.put("session_user_name", user_name);
    		    datamap.put("session_user_id", user_id);
    		    datamap.put("depart_code", depart_code);
    		    datamap.put("path", depart_code);
    		    datamap.put("xvisible",tf_id);
    		    datamap.put("id",id);
    		    outList.add(datamap);
    		}
    		else if (getType.equals("6"))
    		{
    		    outList = this.getGyPage(tf_id); //公司新闻
    		    HashMap datamap = new HashMap();
    		    datamap.put("trade_type_code", "1009");
    		    datamap.put("session_user_name", user_name);
    		    datamap.put("session_user_id", user_id);
    		    datamap.put("depart_code", depart_code);
    		    datamap.put("path", depart_code);
    		    datamap.put("xvisible",tf_id);
    		    datamap.put("id",id);
    		    outList.add(datamap);
    		}
    		else if (getType.equals("7"))
    		{
    		    outList = this.getGyPage(tf_id); //公司销售线索
    		    HashMap datamap = new HashMap();
    		    datamap.put("trade_type_code", "1234");
    		    outList.add(datamap);
    		}
    		else if (getType.equals("8"))
    		{
    		    outList = this.getPricePage(tf_id); //公司通知
    		    HashMap datamap = new HashMap();
    		    datamap.put("trade_type_code", "1009");
    		    datamap.put("session_user_name", user_name);
    		    datamap.put("session_user_id", user_id);
    		    datamap.put("depart_code", depart_code);
    		    datamap.put("path", depart_code);
    		    datamap.put("xvisible",tf_id);
    		    datamap.put("id",id);
    		    outList.add(datamap);
    		}
    		else if (getType.equals("9"))
    		{
    		    outList = this.getPricePage(tf_id); //公司通知
    		    HashMap datamap = new HashMap();
    		    datamap.put("trade_type_code", "1009");
    		    datamap.put("session_user_name", user_name);
    		    datamap.put("session_user_id", user_id);
    		    datamap.put("depart_code", depart_code);
    		    datamap.put("path", depart_code);
    		    datamap.put("xvisible",tf_id);
    		    datamap.put("id",id);
    		    outList.add(datamap);
    		}
		}
		catch (Exception e)
        {		
            throw new RuntimeException(e);
        }
        return outList;
	}
	public ArrayList getYpPage(String tf_id)  
	{
	    InterfDataBaseCommMgr DBQuery = new InterfDataBaseCommMgr();
	    ArrayList strResult = new ArrayList();
		ArrayList outList = new ArrayList();
		String sql = "";
		sql = "select * from agriyp where id="+tf_id;		
		DBQuery.setStrQuery(sql);
		strResult = DBQuery.SelBizQuery();		
		return strResult;
	} 
	public ArrayList getGyPage(String tf_id)  
	{
	    InterfDataBaseCommMgr DBQuery = new InterfDataBaseCommMgr();
	    ArrayList strResult = new ArrayList();
		ArrayList outList = new ArrayList();
		String sql = "";
		sql = "select * from agriinfo where id="+tf_id;		
		DBQuery.setStrQuery(sql);
		strResult = DBQuery.SelBizQuery();		
		return strResult;
	} 
	public ArrayList getQgPage(String tf_id)  
	{
	    InterfDataBaseCommMgr DBQuery = new InterfDataBaseCommMgr();
	    ArrayList strResult = new ArrayList();
		ArrayList outList = new ArrayList();
		String sql = "";
		sql = "select * from agriinfo where id="+tf_id;	
		DBQuery.setStrQuery(sql);
		strResult = DBQuery.SelBizQuery();		
		return strResult;
	}
	public ArrayList getInfoPage(String tf_id)  
	{
	    InterfDataBaseCommMgr DBQuery = new InterfDataBaseCommMgr();
	    ArrayList strResult = new ArrayList();
		ArrayList outList = new ArrayList();
		String sql = "";
		sql = "select * from agrinews where id="+tf_id;	
		DBQuery.setStrQuery(sql);	
		strResult = DBQuery.SelBizQuery();
		return strResult;
	}    
	public ArrayList getPricePage(String tf_id)  
	{
	    InterfDataBaseCommMgr DBQuery = new InterfDataBaseCommMgr();
	    ArrayList strResult = new ArrayList();
		ArrayList outList = new ArrayList();
		String sql = "";
		sql = "select * from agriprice where id="+tf_id;	
		DBQuery.setStrQuery(sql);
		strResult = DBQuery.SelBizQuery();		
		return strResult;
	}  
	public ArrayList genSpecCustInfo(String cust_id)
	{
		InterfDataBaseCommMgr DBQuery = new InterfDataBaseCommMgr();
		ArrayList itemsList = new ArrayList();
		CustomerExt customerExt = new CustomerExt();
		customerExt.setParam(":VCUST_ID", cust_id);
		itemsList = customerExt.selByList("SEL_SPEC_CUST");
		return itemsList;
	}
}

⌨️ 快捷键说明

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