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

📄 cpaccoutreport.java

📁 WAP PUSH后台源码,WAP PUSH后台源码
💻 JAVA
字号:
package com.sxit.wap.report;

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

public class CpAccoutReport extends Report {
	//todo:oracle和mysql 的日期类型不一样,需要改动
	public CpAccoutReport () {
	}

	public String[] getReportHeader () {
		String [] str = {"CPID","CP名称","总的费率" };
		return str;
	}
	public String getReportTitle () {
		return "cp 收费统计报表";
	}

	public ResultSet getResult ( java.sql.Statement statement, java.util.Date startDate, java.util.Date endDate) {
		String sqlDate =null;

		if (startDate == null)
			startDate = new java.util.Date();
		if (endDate == null)
			endDate = new java.util.Date();
		Timestamp bt = new java.sql.Timestamp ( startDate.getTime () );
		Timestamp et = new java.sql.Timestamp ( endDate.getTime () );
		sqlDate = DateUtil.getDateCompareSql ( Database.dbType, "h.SUB_DATE", bt, et );

		String sql = "select c.id ,c.cp_name , sum(h.fee_code )";
		sql += " from wap_user_sub_his h,wap_cp c,wap_channel ch";
		sql += " where h.channel_id = ch.id";
		sql += " and ch.cp_id = c.id and ";
		sql += sqlDate;
		sql += " group by c.id,c.cp_name";
		System.out.println(sql);
			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 beginRow,
									  int endRow ) throws SysException {
		String sqlDate =null;
		if (startDate == null)
			startDate = new java.util.Date();
		if (endDate == null)
			endDate = new java.util.Date();
		Timestamp bt = new java.sql.Timestamp ( startDate.getTime () );
		Timestamp et = new java.sql.Timestamp ( endDate.getTime () );
		sqlDate = DateUtil.getDateCompareSql ( Database.dbType, "h.SUB_DATE", bt, et );

		String sql = "select c.id ,c.cp_name , sum(h.fee_code ) feecodecount";
		sql += " from wap_user_sub_his h,wap_cp c,wap_channel ch";
		sql += " where h.channel_id = ch.id";
		sql += " and ch.cp_id = c.id and ";
		sql += sqlDate;
		sql += " group by c.id,c.cp_name ";

		return queryBySql ( sql, beginRow, endRow );
	}

	public int getCollectionCount ( java.util.Date startDate, java.util.Date endDate ) throws SysException {
		String sqlDate =null;

		if (startDate == null)
			startDate = new java.util.Date();
		if (endDate == null)
			endDate = new java.util.Date();
		Timestamp bt = new java.sql.Timestamp ( startDate.getTime () );
		Timestamp et = new java.sql.Timestamp ( endDate.getTime () );
		sqlDate = DateUtil.getDateCompareSql ( Database.dbType, "h.SUB_DATE", bt, et );

		String sql = "select count(*) from (select c.id ";
		sql += " from wap_user_sub_his h,wap_cp c,wap_channel ch";
		sql += " where h.channel_id = ch.id";
		sql += " and ch.cp_id = c.id and ";
		sql += sqlDate;
		sql += " group by c.id,c.cp_name)";

		return getRowCountBySql ( sql );
	}
        public int getSpIncomeAccount( java.sql.Timestamp start,java.sql.Timestamp end,int cpId) throws SysException{
                String sql = "SELECT SUM(FEE_CODE) FROM WAP_USER_SUB_HIS HIS,WAP_CHANNEL CH";
                sql += " WHERE HIS.CHANNEL_ID = CH.ID AND CH.CP_ID = " + cpId + " AND ";
                sql += DateUtil.getDateCompareSql ( Database.dbType, "HIS.SUB_DATE", start, DateUtil.getSomeDate(end, 1));
                System.out.println("income");
                return getRowCountBySql ( sql );
       }
       public int getSpAcessAccount( java.sql.Timestamp start,java.sql.Timestamp end,int cpId) throws SysException{
                String sql = "SELECT COUNT(*) FROM WAP_ACCESS WHERE CP_ID = " + cpId + " AND " ;
                sql += DateUtil.getDateCompareSql ( Database.dbType, "VISIT_TIME", start, DateUtil.getSomeDate(end, 1) );
                System.out.println("access");
                return getRowCountBySql ( sql );
       }
       public int getSpOrderAccount( java.sql.Timestamp start,java.sql.Timestamp end,int cpId) throws SysException{
                String sql = "SELECT COUNT(*) FROM WAP_USER_SUB_HIS HIS,WAP_CHANNEL CH";
                sql += " WHERE HIS.CHANNEL_ID = CH.ID AND CH.CP_ID = " + cpId + " AND ";
                sql += DateUtil.getDateCompareSql ( Database.dbType, "HIS.SUB_DATE", start, DateUtil.getSomeDate(end, 1) );
                System.out.println("order");
                return getRowCountBySql ( sql );
       }
}

⌨️ 快捷键说明

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