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

📄 infobean.java

📁 一个很不错的移动业务简单业务支撑系统
💻 JAVA
字号:
package com.oristand.service;

import java.util.ArrayList;
import java.util.List;

import com.oristand.dao.InfoDao;

public class InfoBean {
InfoDao infodao=new InfoDao();
//登入查找操作员是否存在
   public boolean getOperator(String user,String psw){
	   String sql="select count(*) from TOperator where Operator_ID='"+user+"' and Operator_Pwd='"+psw+"'";
	  if(infodao.findOperator(sql)!=0){
		  return true;
	  }
	  return false;
   }
   //新增操作员
   
   public boolean NewOperator(String userID,String userName,String usePwd,String admin){
	   String  sql1="select count(*) from TOperator where Operator_ID='"+userID+"'";
	   if(infodao.Check(sql1)!=0){
		   return false;  
	   }
	  String sql2="insert into TOperator values('"+userID+"','"+userName+"','"+usePwd+"','"+admin+"')";
	  if(infodao.Update(sql2)==0){
		  return false;
	  }
	  return true;
	  
   }
   //资源管理
   public boolean SetResource(String begin,String end,String type){
	   long begin1=Long.parseLong(begin);
	   long end1=Long.parseLong(end);
	   for(long i=begin1;i<=end1;i++){
		   String sql1="select count(*) from TMobile where Mobile_Number='"+i+"'";
		   if(infodao.Check(sql1)!=0){
			   System.out.println("该号码已存在");
			   return false;
		   }
		   String sql2="insert into TMobile values('"+i+"','"+type+"','Y')";
		   System.out.println(sql2);
		   if(infodao.Update(sql2)==0){
			   return false;
		   }
	   }
	   return true;
   }
   //费用
   
   public String[] getCharge(){
	   String[] charge=null;
	   String sql="select Charge from TCharge ";
	   charge=infodao.getCharge(sql);
	   return  charge;
   }
   public boolean UpdateCharge(String money,String Code){
	   String sql="update TCharge set Charge="+money+" where Charge_Code='"+Code+"'";
	   if(infodao.Update(sql)==0){
		   return false;
	   }
	   return true;
   }
   public boolean setCharge_Rule(String type,String[] change){
	   String Func_Name="";
	   if(type.equals("O")){
		  Func_Name="开户";
	   }
	   String del="delete from Tcharge_Rule";
	   infodao.Update(del);
	   for(int i=0;i<change.length;i++){
		   String sql="insert into TCharge_Rule values('"+type+"','"+change[i]+"','"+Func_Name+"')";
		   if(infodao.Update(sql)==0){
			   return false;
		   }
	   }
	 
			   
	   return true;
   }
   //新增客户输入证件类型
   public List  findCustomer(String number){
	   List list =new ArrayList();
	   String sql="select count(*) from TCustomer where ID_Number='"+number+"'";
	   if(infodao.Check(sql)!=0){
		   String sql1="select * from TCustomer where ID_Number='"+number+"'";
		   list=infodao.findCustomerList(sql1);
	   }
	   return list;
   }
   
   
   public boolean newCustomer(String ID_Type,String ID_Number,String Customer_Name,String birth,String sex,String address){
	   String sql="insert into TCustomer values(customer_sequence.nextval,'"+ID_Type+"','"+ID_Number+"','"+Customer_Name+"','"+birth+"','"+sex+"','"+address+"')";
	   if(infodao.Update(sql)==0){
		   return false;
	   }
	   return true;
   }
   
   //新增用户
   //1.查询客户ID
   
   public String findCustomer_ID(String ID_Number){
	   String  Customer_ID="";
	   String sql="select Customer_ID from TCustomer where ID_Number='"+ID_Number+"'";
	   Customer_ID=infodao.findCustomer_ID(sql);
	   return Customer_ID;
   }
   //2.查询手机号
   public List findMobile_Number(){
	   List list=new ArrayList();
	   String sql="select Mobile_Number from TMobile where Is_Available='Y'";
	   list=infodao.findList(sql);
	   return list;
   }
   //插入用户信息

   public boolean newUser(String mobile_Number, String status, String com_Leval, String customer_ID, String account_ID) {
	// TODO Auto-generated method stub
	   String sql="insert into TUser values(user_sequence.nextval,'"+mobile_Number+"','"+status+"','"+com_Leval+"','"+customer_ID+"','"+account_ID+"')";
	   if(infodao.Update(sql)==0){
		   return false;
	   }
	  return true;
   }
  //开账户TAccount
    public double getBalance(){
    	String sql="select Charge from TCharge where Charge_Code in (select Charge_Code from TCharge_Rule where Func_ID='O')";
    	double sum=0;
    	//System.out.println("计算开户费");
    	List list=infodao.findList(sql);
    	for(int i=0;i<list.size();i++){
    		String charge=(String)list.get(i);
    		sum=sum+Float.parseFloat(charge);
    	}
    	//System.out.println("开户费:--------"+sum);
    	return sum;
    	
    }
    //新增用户
    public boolean newAccount(String ID, String Person, String Address, String banlance) {
	// TODO Auto-generated method stub
    	double sum=this.getBalance();
    	double count=Double.parseDouble(banlance);
    	count=count-sum;
    	String sql="insert into TAccount values('"+ID+"','"+Person+"','"+Address+"','"+count+"')";
    	if(infodao.Update(sql)==0){
    		return false;
    	}
	    return true;
    }
    
    public List getAccountList(String ID){
    	List list=new ArrayList();
    	String sql="select * from TAccount where Account_ID='"+ID+"'";
    	list=infodao.findAccountList(sql);
    	//System.out.println("infobean =========findAccountList --------"+list);
    	return list;
    }
    public boolean updateAccount(String ID, String Person, String Address, String banlance){
    	  double sum=this.getBalance();
    
    	  double  count=Double.parseDouble(banlance);
    	  
    	  count=count-sum;
    	  String sql="update TAccount set Contact_Person='"+Person+"',Contact_Address='"+Address+"',Account_Balance='"+count+"'"+"where Account_ID='"+ID+"'";
    	  System.out.println(sql);
    	  if(infodao.Update(sql)==0){
    		  return false;
    	  }
    	  
    	  return true;
    }
    //查看操作员
    public List OperatorList(String ID,String name,String manager){
    	List list=new ArrayList();
    	String sql="select * from Toperator where 1=1";
    	if(ID!=null && !ID.trim().equals("")){
			sql = sql + "and Operator_ID='"+ID+"'";
		}
		if(name!=null && !name.trim().equals("")){
			sql = sql + " and upper(Operator_Name) like '%"+name.toUpperCase()+"%'";
		}
		if(manager!=null && !manager.trim().equals("")){
			sql = sql + " and upper(Is_Admin)='"+manager.toUpperCase()+"'";
		}
    	list=infodao.findOperatorList(sql);
    	
    	return list;
    }

	public  List OperatorDetail(String updateid) {
		// TODO Auto-generated method stub
		String sql="select * from TOperator where Operator_ID='"+updateid+"'";
		List list=infodao.findOperatorList(sql);
		
		return list;
	}

	public boolean updateOperator(String id, String name, String manager) {
		// TODO Auto-generated method stub
		String sql="update TOperator set Operator_Name='"+name+"',Is_Admin='"+manager+"' where Operator_ID='"+id+"'";
		if(infodao.Update(sql)==0){
			return false;
		}
		return true;
	}
	public boolean deleteOperator(String[] strids){
		String ids = "";
		//如果没有选择记录,则手工抛出一个RuntimeException异常
		if(strids==null){
			throw new RuntimeException("请选择要删除的记录");
		}
		for(int i=0;i<strids.length;i++){
			ids = ids + "'"+strids[i] + "',";
		}
		ids = ids.substring(0,ids.lastIndexOf(","));
		String sql = "delete from TOperator where Operator_ID in ("+ids+")";
		int count  = infodao.Update(sql);
		//如果count的值为0,表示删除失败
		if(count==0){
			return false;
		}
		return true;
	
	}
}

⌨️ 快捷键说明

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