示例#1
0
    // 开始统计
    public override OpRes doStat(object param, GMUser user)
    {
        ParamQueryRecharge p   = (ParamQueryRecharge)param;
        QueryMgr           mgr = user.getSys <QueryMgr>(SysType.sysTypeQuery);

        m_cond.startQuery();
        OpRes res = mgr.makeQuery(param, QueryType.queryTypeRecharge, user, m_cond);

        if (res != OpRes.opres_success)
        {
            return(res);
        }

        IMongoQuery   imq = m_cond.getImq();
        QueryDocument qd  = (QueryDocument)imq;

        if (!qd.Contains("PayTime"))
        {
            return(OpRes.op_res_time_format_error);
        }

        m_result.Clear();
        QueryRecharge   rq         = mgr.getQuery <QueryRecharge>(QueryType.queryTypeRecharge);
        int             serverId   = DBMgr.getInstance().getSpecialServerId(DbName.DB_PAYMENT);
        MapReduceResult map_result = DBMgr.getInstance().executeMapReduce(rq.getPlatInfo().m_tableName,
                                                                          serverId,
                                                                          DbName.DB_PAYMENT,
                                                                          imq,
                                                                          MapReduceTable.getMap("sameOrderId"),
                                                                          MapReduceTable.getReduce("sameOrderId"));
        int count = 0;

        if (map_result != null)
        {
            IEnumerable <BsonDocument> bson = map_result.GetResults();
            foreach (BsonDocument d in bson)
            {
                BsonValue resValue = d["value"];
                count = resValue["total"].ToInt32();
                if (count > 1)
                {
                    ResultSameOrderIdItem tmp = new ResultSameOrderIdItem();
                    m_result.Add(tmp);
                    tmp.m_count   = count;
                    tmp.m_orderId = Convert.ToString(d["_id"]);
                }
            }
        }
        return(OpRes.opres_success);
    }
示例#2
0
    // 开始统计
    public override OpRes doStat(object param, GMUser user)
    {
        ParamQueryRecharge p   = (ParamQueryRecharge)param;
        QueryMgr           mgr = user.getSys <QueryMgr>(SysType.sysTypeQuery);

        m_cond.startQuery();
        OpRes res = mgr.makeQuery(param, QueryType.queryTypeRecharge, user, m_cond);

        if (res != OpRes.opres_success)
        {
            return(res);
        }

        IMongoQuery imq = m_cond.getImq();

        m_result.reset();
        QueryRecharge   rq         = mgr.getQuery <QueryRecharge>(QueryType.queryTypeRecharge);
        int             serverId   = DBMgr.getInstance().getSpecialServerId(DbName.DB_PAYMENT);
        MapReduceResult map_result = DBMgr.getInstance().executeMapReduce(rq.getPlatInfo().m_tableName,
                                                                          serverId,
                                                                          DbName.DB_PAYMENT,
                                                                          imq,
                                                                          MapReduceTable.getMap("recharge"),
                                                                          MapReduceTable.getReduce("recharge"));

        if (map_result != null)
        {
            IEnumerable <BsonDocument> bson = map_result.GetResults();
            foreach (BsonDocument d in bson)
            {
                BsonValue resValue = d["value"];
                m_result.m_total += resValue["total"].ToInt32();
                m_result.m_rechargePersonNum++;
                m_result.m_rechargeCount += resValue["rechargeCount"].ToInt32();
            }
        }
        return(OpRes.opres_success);
    }