using System; using System.Collections.Concurrent; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace CRM.Core.Model.QueryModels { public class CashFlow { public class CashFlowQuery { public string Day { get; set; } public int itemId { get; set; } public int parentId { get; set; } public int sort { get; set; } public int level { get; set; } public string item { get; set; } public int orderNum { get; set; } public decimal payprice { get; set; } public decimal Refundprice { get; set; } public decimal DepConsume { get; set; } public decimal netPayprice { get { return payprice - Refundprice; } } public int monOrderNum { get; set; } public int monRefundOrderNum { get; set; } public int monNetOrderNum { get { return monOrderNum - monRefundOrderNum; } } public decimal monPayprice { get; set; } public decimal monRefundprice { get; set; } public decimal monDepConsume { get; set; } public decimal monNetPayprice { get { return monPayprice - monRefundprice; } } } public class CashFlowQueryTimes { public List cashFlowQueries { get; set; } public DateTime QueryTime { get; set; } } public class OrderQuery { public int orderid { get; set; } public DateTime arrivaltime { get; set; } public int channel { get; set; } } public class DepositQuery { public decimal payprice { get; set; } public DateTime paydate { get; set; } public int channel { get; set; } } /// /// 树形排序? /// /// /// /// public static List SortTrees(List CashFlowQuerys, int parentId = 1) { var result = new List(); var lv0 = CashFlowQuerys.Where(d => d.parentId == parentId).OrderBy(d => d.sort); var item = CashFlowQuerys.Where(d => d.itemId == parentId).First(); if (item == null) return result; result.Add(item); var lv = item.level; foreach (var lv0item in lv0) { lv0item.level = lv + 1; result.AddRange(SortTrees(CashFlowQuerys, lv0item.itemId)); } return result; } } }