Beispiel #1
0
        /// <summary>
        /// 月份统计
        /// </summary>
        /// <param name="req"></param>
        /// <returns></returns>
        public async Task <List <MonthSumListInfo <string> > > SumMonthAsync(MonthSumReq req)
        {
            //收入
            var reqIn = new InSumReq();

            reqIn.GroupType            = EnmInGroupType.Month;
            reqIn.IsContainBorrowRepay = req.IsContainBorrowRepay;
            var taskIn = this.SumInComeAsync(reqIn);

            //支出
            var reqOut = new OutSumReq();

            reqOut.GroupType            = EnmOutGroupType.Month;
            reqOut.IsContainBorrowRepay = req.IsContainBorrowRepay;
            var taskOut = this.SumOutPutAsync(reqOut);

            //结果
            var list = new List <MonthSumListInfo <string> >();

            //收入
            var lstIn = await taskIn;

            foreach (var income in lstIn)
            {
                list.Add(new MonthSumListInfo <string>()
                {
                    name         = income.name,
                    value        = income.value,
                    DataType     = EnmDataType.In,
                    DataTypeName = this.Res.Cst.DT.In
                });
            }

            //支出
            var lstOut = await taskOut;

            foreach (var output in lstOut)
            {
                list.Add(new MonthSumListInfo <string>()
                {
                    name         = output.name,
                    value        = -output.value,
                    DataType     = EnmDataType.Out,
                    DataTypeName = this.Res.Cst.DT.Out
                });
            }

            //排序
            list = list.OrderByDescending(m => m.name).ThenByDescending(m => m.value).ToList();

            return(list);
        }
Beispiel #2
0
        public async Task <ResultList <MonthSumListInfo <string> > > SumMonthAsync([FromQuery] MonthSumReq req)
        {
            var list = await this.bll.SumMonthAsync(req);

            return(new ResultList <MonthSumListInfo <string> >(true, this.bll.Res.Gen.OK, list));
        }