sptotalreport.java

来自「WAP PUSH后台源码,WAP PUSH后台源码」· Java 代码 · 共 91 行

JAVA
91
字号
package com.sxit.wap.report;

import java.sql.*;
import java.util.*;
import com.sxit.wap.common.*;
import com.sxit.wap.exception.*;


public class SpTotalReport extends Report {
    public SpTotalReport() {
    }

	public String[] getReportHeader () {
		String [] str = {"MDN","费率","费率类型","频道名称","定制日期" };
		return str;
	}
	public String getReportTitle () {
		return "CP 业务统计";
	}

	public ResultSet getResult ( java.sql.Statement statement, java.util.Date startDate ,java.util.Date endDate,int cpid  ) {
		Timestamp tt =null;
		Timestamp bt =null;
		if (startDate == null){
			tt = new java.sql.Timestamp(0);
		}else
					tt = new java.sql.Timestamp(startDate.getTime());
		if (endDate == null)
				  endDate = new java.util.Date();
		   bt = new java.sql.Timestamp(endDate.getTime());


		String sql = "select  h.user_mdn , ft.fee_type ,h.fee_code ,ch.channel_name, h.sub_date  ,c.cp_name ";
			   sql += " from wap_user_sub_his h,wap_cp c,wap_channel ch, wap_fee_type ft ";
			   sql += " where h.channel_id = ch.id and ch.cp_id = c.id and ft.fee_type = h.fee_type ";
			   sql += " and c.id ="+ cpid;
			   sql+= " and "+DateUtil.getDateCompareSql(Database.dbType, "h.sub_date", tt, bt) ;

			java.sql.ResultSet rs = null;
		try {
			rs = statement.executeQuery ( sql );
		}catch (Exception e1) {
		}
		return rs;
	}


	public Collection getCollection (java.util.Date startDate, java.util.Date endDate,int cpid , int beginRow,
									  int endRow ) throws SysException {
		 Timestamp tt =null;
		 Timestamp bt =null;
		 if (startDate == null){
			 tt = new java.sql.Timestamp(0);
		 }else
					 tt = new java.sql.Timestamp(startDate.getTime());
		 if (endDate == null)
				   endDate = new java.util.Date();
			bt = new java.sql.Timestamp(endDate.getTime());



		String sql = "select c.id ,c.cp_name , h.fee_code ,ch.channel_name, ft.fee_type, h.user_mdn ,h.sub_date";
			   sql += " from wap_user_sub_his h,wap_cp c,wap_channel ch, wap_fee_type ft ";
			   sql += " where h.channel_id = ch.id and ch.cp_id = c.id and ft.fee_type = h.fee_type ";
			   sql += " and c.id ="+ cpid;
			   sql+= " and "+DateUtil.getDateCompareSql(Database.dbType, "h.sub_date", tt, bt) ;

		return queryBySql ( sql, beginRow, endRow );
	}

	public int getCollectionCount ( java.util.Date startDate, java.util.Date endDate,int cpid ) throws SysException {
		Timestamp tt =null;
		Timestamp bt =null;
		if (startDate == null){
			tt = new java.sql.Timestamp(0);
		}else
					tt = new java.sql.Timestamp(startDate.getTime());
		if (endDate == null)
				  endDate = new java.util.Date();
		   bt = new java.sql.Timestamp(endDate.getTime());

		String sql = "select count(*) ";
			   sql += " from wap_user_sub_his h,wap_cp c,wap_channel ch, wap_fee_type ft ";
			   sql += " where h.channel_id = ch.id and ch.cp_id = c.id and ft.fee_type = h.fee_type ";
			   sql += " and c.id ="+ cpid;
			   sql+= " and "+DateUtil.getDateCompareSql(Database.dbType, "h.sub_date", tt, bt) ;

		return getRowCountBySql ( sql );
	}

}

⌨️ 快捷键说明

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