yzh
2022-06-08 9c98f5d15e35587b7bcd9d7c8a506c467e758632
web/web/ExportDocument.aspx.cs
@@ -10,20 +10,30 @@
public partial class ExportDocument : PageBase<SysUser>, IRequiresSessionState
{
    private int _userId = -1;
    private int _userType = -1;
    private string _account = "";
    protected void Page_Load(object sender, EventArgs e)
    {
        _userId = this.AppContext.SessionObject.UserID;
        _userType = this.AppContext.SessionObject.UserType;
        _account = this.AppContext.SessionObject.Account;
        switch (this.AppContext.GetString("action"))
        {
            case "exPortGwSp":
                this.ExPortGwSp();
                this.ExPortGwSp();
                break;
            case "exPortGwSm":
                this.ExportGwSmData();
                break;
            case "exportGwStatisV3"://导出统计报表
                this.ExprortGwStatisV3();
                break;
            case "exportGwClient":  //导出客户信息
                this.ExportGwClientData();
                break;
        }
    }
@@ -45,6 +55,8 @@
        string statistype = this.AppContext.GetString("Statistype");
        StatisOption statisoption = (StatisOption)this.AppContext.GetInt("Statisoption");
        string permissionsSQL = new GwClientDao().GetClientPermissions(_userId, _userType, null);
        List<GwOp> opList;
        using (GwOpDao dao = new GwOpDao())
@@ -56,7 +68,7 @@
        using (GwClientDao dao = new GwClientDao())
        {
            clientList = dao.LoadInfoList("", "", "", "");
            clientList = dao.LoadInfoList("", "", "", "", permissionsSQL);
        }
        List<GwAp> apList;
@@ -68,8 +80,9 @@
            apList = dao.LoadInfoList("", "", "", out recordCount, 99999, 1);
        }
        GwStatisV3Dao _Dao = new GwStatisV3Dao();
        var list = _Dao.Query(Convert.ToDateTime(beginTime), Convert.ToDateTime(endTime), clientId, spid, apMid, opid, statistype, (StatisOption)statisoption);
        var list = _Dao.Query(Convert.ToDateTime(beginTime), Convert.ToDateTime(endTime), clientId, spid, apMid, opid, statistype, permissionsSQL, (StatisOption)statisoption);
        List<Model.GwStatisV3> statisList = new List<Model.GwStatisV3>();
        foreach (GwStatisV3Item item in list)
@@ -303,13 +316,14 @@
                this.Response.End();
            }
            DataTable dataTable = gwSmDao.LoadSpDataTable(apMid, opName, clientId, spid, mobile, sDate, beginTime, endTime, content, @int, opstat);
            WebTool webTool = new WebTool();
            Dictionary<string, string> dictionary = new Dictionary<string, string>();
            dictionary["AP消息ID"] = "AP_MID";
            dictionary["CLTID"] = "CLIENT_ID";
            dictionary["客户ID"] = "CLIENT_ID";
            dictionary["账号"] = "SP_ID";
            dictionary["APID"] = "AP_ID";
            dictionary["OPID"] = "OP_ID";
            dictionary["接入点ID"] = "AP_ID";
            dictionary["通道名"] = "OP_NAME";
            dictionary["码号"] = "ACCESS_CODE";
            dictionary["接收号码"] = "MOBILE";
            dictionary["PKN "] = "PK_NUMBER";
@@ -328,7 +342,65 @@
            dictionary["状态报告回执时间"] = "OP_DELIVER_TIME";
            dictionary["内容"] = "MSG_CONTENT";
            dictionary["状态"] = "STAT";
            dictionary["耗时"] = "OUT_TIME";
            webTool.Export(dataTable, dictionary, "日志_" + sDate, this.Context.Response);
        }
    }
    //导出客户信息
    private void ExportGwClientData()
    {
        string ClientID = this.AppContext.GetString("ClientID");
        string Company = this.AppContext.GetString("Company");
        string ClientName = this.AppContext.GetString("ClientName");
        string Telephone = this.AppContext.GetString("Telephone");
        string Salesman = this.AppContext.GetString("Salesman");
        string SupportStaff = this.AppContext.GetString("SupportStaff");
        string ProductId = this.AppContext.GetString("ProductId");
        string Agent = this.AppContext.GetString("Agent");
        int IsEnable = this.AppContext.GetInt("IsEnable", -1);
        int pageIndex = this.AppContext.GetInt("pageIndex", 1);
        int recordCount = 0;
        int pageSize = this.AppContext.GetInt("pageSize", 999999999);
        string str = "";
        using (GwClientDao dao = new GwClientDao())
        {
            string permissionsSQL = dao.GetClientPermissions(_userId, _userType, "gwc");
            var list = dao.LoadInfoList(out recordCount, pageIndex, pageSize, ClientID, ClientName, Telephone, Agent, Company, Salesman, SupportStaff, ProductId, IsEnable, permissionsSQL);
            if (recordCount> 1000000)
            {
                this.Response.Write("<script type='text/javascript'>alert('导出数据不能大于100万条!');location.href='GwClient.aspx?IsEnable=" + IsEnable + "';</script>");
                this.Response.End();
            }
            DataTable dataTable = dao.LoadClientDataTable(ClientID, ClientName, Telephone, Agent, Company, Salesman, SupportStaff, ProductId, IsEnable, permissionsSQL);
            WebTool webTool = new WebTool();
            Dictionary<string, string> dictionary = new Dictionary<string, string>();
            dictionary["客户账号"] = "CLIENT_ID";
            dictionary["公司名称"] = "COMPANY";
            dictionary["联系人"] = "CLIENT_NAME";
            dictionary["联系电话"] = "TELEPHONE";
            dictionary["账户余额(元)"] = "BALANCE";  //已除以1000
            dictionary["累计充值(元)"] = "TOP_UP_AMOUNT_TOTAL";  //已除以1000
            dictionary["业务员"] = "SALESMAN_NAME";
            dictionary["已分配个性产品(多个按“,”分隔) "] = "PRODUCT_IDS";
            dictionary["状态 "] = "Is_Enable";
            string isEnableStr = "";
            if (IsEnable == 1)
            {
                isEnableStr = "正常";
            }
            else
            {
                isEnableStr = "停用";
            }
            webTool.Export(dataTable, dictionary, isEnableStr + "客户信息_" + DateTime.Now, this.Context.Response);
        }
    }
}