ComplianceServer/oldcode/Core.Model/QueryModels/CashFlowQuery.cs

83 lines
2.7 KiB
C#

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<CashFlowQuery> 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; }
}
/// <summary>
/// 树形排序?
/// </summary>
/// <param name="auditItemResults"></param>
/// <param name="parentId"></param>
/// <returns></returns>
public static List<CashFlowQuery> SortTrees(List<CashFlowQuery> CashFlowQuerys, int parentId = 1)
{
var result = new List<CashFlowQuery>();
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;
}
}
}