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

📄 hexiaoreptotal.java

📁 文件的上传和下载的实现,用JAva编写,非常简单
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
						//pzqztemp.setHexiaoJe(233);	
					}
					if(pzqzhexiao.getPzzl().equals("3"))
					{
						 sql = "select sum(jfje) as jeTotal from tjp where sfzf='否' and  pzhm between '"
							+ pzqztemp.getPzqh()
							+ "' and '"
							+ pzqztemp.getPzzh() + "'";						
						//pzqztemp.setHexiaoJe(333);	
					}
					if(pzqzhexiao.getPzzl().equals("4"))
					{
						 sql = "select sum(jfje) as jeTotal from gnhc where pzzl='4' and sfzf='否' and  pzhm between '"
							+ pzqztemp.getPzqh()
							+ "' and '"
							+ pzqztemp.getPzzh() + "'";						
						//pzqztemp.setHexiaoJe(433);	
					}
					System.out.println(sql);
					ResultSet rs = conndb.executeQuery(sql);
					if (rs == null)
						{pzqztemp.setHexiaoJe(0);}
					 while (rs.next()) {
						 result.add(rs.getString("jeTotal"));	
						}
				    je = Float.parseFloat(donull(String.valueOf(result.get(0))));
				    pzqztemp.setHexiaoJe(je);//设置每票段的金额
					pzqzLists.add(pzqztemp);
					pzqzhexiao.setPzqh(sNext);//每次拆分后要对最后一段进行特殊处理
					pzqzhexiao.setPzzh(sNext);				
				}
			}
		}
		pzqzLists.add(pzqzhexiao);
		if (pzqzhexiao.getPzqh() == null)
			pzqzLists.remove(pzqzhexiao);
		conndb.close();
		return pzqzLists;
	}

	public static long getyijingFsTotal(String highZddm, String lowZddm,
			String dprdm, String syzt, String pzzl) throws SQLException {
		// 获取已经核销的票证列表中核销的票证全体票段总张数
		ArrayList yijingQz = new ArrayList();
		yijingQz = HexiaoRepTotal.getPzqzsYijingHexiao(highZddm, lowZddm,
				dprdm, syzt, pzzl);
		long fs = 0;
		int i;
		for (i = 0; i < yijingQz.size(); i++) {
			PzqzHexiao pzqzYijingHexiao = (PzqzHexiao) yijingQz.get(i);
			fs = fs + Long.parseLong(pzqzYijingHexiao.getPzzh())
					- Long.parseLong(pzqzYijingHexiao.getPzqh()) + 1;
		}
		return fs;
	}

	public static long getyijingzffsTotal(String highZddm, String lowZddm,
			String dprdm, String syzt, String pzzl) throws SQLException {
		// 获取已经核销的票证中全体票段作废总张数
		ConnectDB conndb = new ConnectDB();
		ArrayList yijingQz = new ArrayList();
		yijingQz = HexiaoRepTotal.getPzqzsYijingHexiao(highZddm, lowZddm,
				dprdm, syzt, pzzl);
		long zffs = 0;
		int i;
		for (i = 0; i < yijingQz.size(); i++) {
			PzqzHexiao pzqzYijingHexiao = (PzqzHexiao) yijingQz.get(i);
			String sql = "select count(*) as zfs from pjztb  where zfzt='1' and pzhm  between '"
					+ pzqzYijingHexiao.getPzqh()
					+ "' and '"
					+ pzqzYijingHexiao.getPzzh()
					+ "' and pzzl='"
					+ pzqzYijingHexiao.getPzzl() + "'";
			 long zfss=0;
			 ResultSet rs = conndb.executeQuery(sql);
			 if (rs == null)
				zfss=0;
			 while (rs.next()) {
					zfss=Long.parseLong(rs.getString("zfs"));
				}
			 System.out.println(sql);
			 zffs=zffs+zfss;			  
		}
		conndb.close();
		return zffs;
	}

	public static float getyijingpzjeTotal(String highZddm, String lowZddm,
			String dprdm, String syzt, String pzzl) throws SQLException{
	      //获取已经核销的票证全体票段金额总计	,这种写法错了	
		ArrayList yijingQz = new ArrayList();
		yijingQz = HexiaoRepTotal.getPzqzsYijingHexiao(highZddm, lowZddm,
				dprdm, syzt, pzzl);
		float je = 0;
		float je1=0;
		int i;
		ConnectDB conndb = new ConnectDB();		
		String sql = "";
		ArrayList result = new ArrayList();
		for (i = 0; i < yijingQz.size(); i++) 
		{
			PzqzHexiao pzqzYijingHexiao = (PzqzHexiao) yijingQz.get(i);
			if(pzzl.equals("1"))
			{
				 sql = "select sum(jfje) as jeTotal from gjhc where pzzl='1' and sfzf='否' and  pzhm between '"
					+ pzqzYijingHexiao.getPzqh()
					+ "' and '"
					+ pzqzYijingHexiao.getPzzh() + "'";	
			}
			if(pzzl.equals("2"))
			{
				 sql = "select sum(jfje) as jeTotal from gnhc where sfzf='否' and  pzhm between '"
						+ pzqzYijingHexiao.getPzqh()
						+ "' and '"
						+ pzqzYijingHexiao.getPzzh() + "'";	
			}
			if(pzzl.equals("3"))
			{
				 sql = "select sum(jfje) as jeTotal from tjp where sfzf='否' and  pzhm between '"
						+ pzqzYijingHexiao.getPzqh()
						+ "' and '"
						+ pzqzYijingHexiao.getPzzh() + "'";	
			}
			if(pzzl.equals("4"))
			{
				 sql = "select sum(jfje) as jeTotal from gnhc where pzzl='4' and sfzf='否' and  pzhm between '"
						+ pzqzYijingHexiao.getPzqh()
						+ "' and '"
						+ pzqzYijingHexiao.getPzzh() + "'";	
			}
			System.out.println(sql);
			ResultSet rs = conndb.executeQuery(sql);
			if (rs == null)
				{je1= 0;}
			 while (rs.next()) {
				 result.add(rs.getString("jeTotal"));	
				}
			je1=Float.parseFloat(donull(String.valueOf(result.get(i))));
		    je = je + je1;
		}
		conndb.close();
		return je;
	}
	//根据票证起号、票证止号、票证种类来查找票证金额
	public static float getWeipiaoduanJe(String pzqh,String pzzh,String pzzl) throws SQLException{
		float je;
		ConnectDB conndb = new ConnectDB();		
		String sql = "";
		ArrayList result = new ArrayList();
		if(pzzl.equals("1"))
		{
			 sql = "select sum(jfje) as jeTotal from gjhc where pzzl='1' and sfzf='否' and  pzhm between '"
				+ pzqh
				+ "' and '"
				+ pzzh + "'";	
		}
		if(pzzl.equals("2"))
		{
			 sql = "select sum(jfje) as jeTotal from gnhc where sfzf='否' and  pzhm between '"
				+ pzqh
				+ "' and '"
				+ pzzh + "'";						
			//pzqztemp.setHexiaoJe(233);	
		}
		if(pzzl.equals("3"))
		{
			 sql = "select sum(jfje) as jeTotal from tjp where sfzf='否' and  pzhm between '"
				+ pzqh
				+ "' and '"
				+ pzzh + "'";						
			//pzqztemp.setHexiaoJe(333);	
		}
		if(pzzl.equals("4"))
		{
			 sql = "select sum(jfje) as jeTotal from gnhc where pzzl='4' and sfzf='否' and  pzhm between '"
				+ pzqh
				+ "' and '"
				+ pzzh + "'";						
			//pzqztemp.setHexiaoJe(433);	
		}
		System.out.println(sql);
		ResultSet rs = conndb.executeQuery(sql);
		if (rs == null)
			{return 0;}
		 while (rs.next()) {
			 result.add(rs.getString("jeTotal"));	
			}
	    je = Float.parseFloat(donull(String.valueOf(result.get(0))));
	    conndb.close();
	    return je;
	}
	
	public static boolean isNull(String s)
    {
        return s == null || s.trim().equals("") || s.trim().equals("null");
    }
	public static String donull(String s)//0处理
           {
               if(isNull(s))
                   s = "0";
               return s;
           }
	
   public static ArrayList getweiHexiaoAll(String highZddm,
			String lowZddm, String dprdm, String syzt, String pzzl) throws SQLException{
	   //获取未核销的票段(起号、止号、种类、金额)
		float je;
		int i;
		ConnectDB conndb = new ConnectDB();		
		String sql = "";
		ArrayList result = new ArrayList();
		ArrayList result1 = new ArrayList();
		ArrayList result2 = new ArrayList();
		result1 =getPzqzsWeiHexiao(highZddm,lowZddm,dprdm,syzt,pzzl);
		for(i=0;i<result1.size();i++)
		{
			PzqzHexiao add = new PzqzHexiao();
			PzqzHexiao ssd = (PzqzHexiao) result1.get(i);
			if(ssd.getPzzl().equals("1"))
			{
				 sql = "select sum(jfje) as jeTotal from gjhc where pzzl='1' and sfzf='否' and  pzhm between '"
					+ ssd.getPzqh()
					+ "' and '"
					+ ssd.getPzzh() + "'";	
			}
			if(ssd.getPzzl().equals("2"))
			{
				 sql = "select sum(jfje) as jeTotal from gnhc where sfzf='否' and  pzhm between '"
					+ ssd.getPzqh()
					+ "' and '"
					+ ssd.getPzzh() + "'";						
				//pzqztemp.setHexiaoJe(233);	
			}
			if(ssd.getPzzl().equals("3"))
			{
				 sql = "select sum(jfje) as jeTotal from tjp where sfzf='否' and  pzhm between '"
					+ ssd.getPzqh()
					+ "' and '"
					+ ssd.getPzzh() + "'";						
				//pzqztemp.setHexiaoJe(333);	
			}
			if(ssd.getPzzl().equals("4"))
			{
				 sql = "select sum(jfje) as jeTotal from gnhc where pzzl='4' and sfzf='否' and  pzhm between '"
					+ ssd.getPzqh()
					+ "' and '"
					+ ssd.getPzzh() + "'";						
				//pzqztemp.setHexiaoJe(433);	
			}
			System.out.println(sql);
			ResultSet rs = conndb.executeQuery(sql);
			if (rs == null)
				{add.setHexiaoJe(0);}
			 while (rs.next()) {
				 result.add(rs.getString("jeTotal"));			    
				    je = Float.parseFloat(donull(String.valueOf(result.get(i))));			
					add.setPzqh(ssd.getPzqh());
					add.setPzzh(ssd.getPzzh());
					add.setPzzl(ssd.getPzzl());
					add.setHexiaoJe(je);
					result2.add(add);	
				}
	
		}
		conndb.close();
      return result2;
   }
	public static void main(String args[])
	{
		/*try {
			float je=getyijingpzjeTotal("110202"," ","110202001","5","2");
			System.out.println("je is"+je);
		} catch (SQLException e1) {
			// TODO Auto-generated catch block
			e1.printStackTrace();
		}*/
		try{
			ArrayList ar=getweiHexiaoAll("110202"," ","110202001","5","2");
			System.out.println("size"+ar.size());
			int j;
            for(j=0;j<ar.size();j++)
             {
            	PzqzHexiao ssd = (PzqzHexiao) ar.get(j);
            	System.out.println(ssd.getPzqh());
            	System.out.println(ssd.getPzzh());	
            	System.out.println(ssd.getPzzl());	
            	System.out.println(ssd.getHexiaoJe());	
             }
			}
			catch(SQLException e)
			{
				e.printStackTrace();
			}
			
	}	
}

⌨️ 快捷键说明

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