Commit b6ebcc10 by 陶然

优化

parent 79bd88b3
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
<DebugSymbols>true</DebugSymbols> <DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType> <DebugType>full</DebugType>
<Optimize>false</Optimize> <Optimize>false</Optimize>
<OutputPath>..\..\..\..\njzj.k5\appextend\</OutputPath> <OutputPath>..\..\..\k5-njzj\appextend\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants> <DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport> <ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel> <WarningLevel>4</WarningLevel>
...@@ -31,14 +31,17 @@ ...@@ -31,14 +31,17 @@
<WarningLevel>4</WarningLevel> <WarningLevel>4</WarningLevel>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<Reference Include="Kivii.Common.V4.5, Version=5.6.2022.12000, Culture=neutral, processorArchitecture=MSIL"> <Reference Include="Kivii.Common.V4.5, Version=5.6.2023.2220, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\..\..\..\njzj.k5\packages\Kivii.Common.5.6.2022.12000\lib\net45\Kivii.Common.V4.5.dll</HintPath> <HintPath>..\..\..\k5-njzj\packages\Kivii.Common.5.6.2023.2220\lib\net45\Kivii.Common.V4.5.dll</HintPath>
<Private>False</Private>
</Reference> </Reference>
<Reference Include="Kivii.Core.V4.5, Version=5.6.2022.12000, Culture=neutral, processorArchitecture=MSIL"> <Reference Include="Kivii.Core.V4.5, Version=5.6.2023.1310, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\..\..\..\njzj.k5\packages\Kivii.Core.5.6.2022.12000\lib\net45\Kivii.Core.V4.5.dll</HintPath> <HintPath>..\..\..\k5-njzj\packages\Kivii.Core.5.6.2023.1310\lib\net45\Kivii.Core.V4.5.dll</HintPath>
<Private>False</Private>
</Reference> </Reference>
<Reference Include="Kivii.Linq.V4.5, Version=5.6.2022.12180, Culture=neutral, processorArchitecture=MSIL"> <Reference Include="Kivii.Linq.V4.5, Version=5.6.2022.12200, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\..\..\..\njzj.k5\packages\Kivii.Linq.5.6.2022.12180\lib\net45\Kivii.Linq.V4.5.dll</HintPath> <HintPath>..\..\..\k5-njzj\packages\Kivii.Linq.5.6.2022.12200\lib\net45\Kivii.Linq.V4.5.dll</HintPath>
<Private>False</Private>
</Reference> </Reference>
<Reference Include="System" /> <Reference Include="System" />
<Reference Include="System.Core" /> <Reference Include="System.Core" />
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|AnyCPU'"> <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|AnyCPU'">
<StartAction>Program</StartAction> <StartAction>Program</StartAction>
<StartProgram>D:\njzj.k5\Startup.exe</StartProgram> <StartProgram>D:\git.kivii.org\k5-njzj\Startup.exe</StartProgram>
<StartArguments>-debug</StartArguments> <StartArguments>-debug</StartArguments>
</PropertyGroup> </PropertyGroup>
</Project> </Project>
\ No newline at end of file
...@@ -520,6 +520,73 @@ namespace Kivii.Finances.Transforms ...@@ -520,6 +520,73 @@ namespace Kivii.Finances.Transforms
} }
} }
[Api(Description = "到账划转分析")]
[RequiresAnyRole(SystemRoles.Everyone)]
public class PaymentAssignAnalysis : RestfulExecution<Payment>
{
public Guid OwnerKvid { get; set; }
public List<Guid> OwnerKvids { get; set; }
public DateTime BeginTime { get; set; }
public DateTime EndTime { get; set; }
public override object OnExecution(IRequest req, IResponse res)
{
if (OwnerKvids.IsNullOrEmpty()) OwnerKvids = new List<Guid>();
if (OwnerKvid != Guid.Empty) OwnerKvids.Add(OwnerKvid);
int monthDay = DateTime.DaysInMonth(DateTime.Now.Year, DateTime.Now.Month);
if (BeginTime == DateTime.MinValue) BeginTime = new DateTime(DateTime.Now.Year, DateTime.Now.Month, 1);
if (EndTime == DateTime.MinValue) EndTime = new DateTime(DateTime.Now.Year, DateTime.Now.Month, monthDay);
BeginTime = DateTime.Parse(BeginTime.ToString("yyyy-MM-dd"));
EndTime = DateTime.Parse(EndTime.ToString("yyyy-MM-dd"));
if (EndTime < BeginTime) throw new Exception("查询结束日期不可小于开始日期!");
var rtns = new StatisticResponse<Analysis>();
rtns.Results = new List<Analysis>();
rtns.BeginTime = BeginTime;
rtns.EndTime = EndTime;
var conn = KiviiContext.GetOpenedDbConnection<Payment>();
var queryAccount = conn.From<Account>();
queryAccount.Where(o => o.OrganizationKvid == KiviiContext.CurrentMember.OrganizationKvid && Sql.In(o.Type, AccountType.Balance, AccountType.Cash, AccountType.Pos));
queryAccount.Select(o => o.Kvid);
//当前部门已经认领且被划转的流水Kvid
var querySplits = conn.From<Payment>();
querySplits.Where(o => o.OffsetKvid == Guid.Empty && o.Type == PaymentType.Split && o.AmountSplited > 0);
querySplits.And(o => o.OperateTime >= BeginTime && o.OperateTime < EndTime);
if (!OwnerKvids.IsNullOrEmpty()) querySplits.And(o => Sql.In(o.OwnerKvid, OwnerKvids));
querySplits.And(o => (Sql.In(o.PayerAccountKvid, queryAccount)));
querySplits.Select(o => o.Kvid);
var sqlExpress = conn.From<Payment>();
sqlExpress.Where(o => o.OffsetKvid == Guid.Empty && o.Type == PaymentType.Assign);
sqlExpress.And(o => o.OperateTime >= BeginTime && o.OperateTime < EndTime);
sqlExpress.And(o => (Sql.In(o.ParentKvid, querySplits) || Sql.In(o.OwnerKvid, OwnerKvids)));
sqlExpress.OrderBy(o => o.OwnerName);
sqlExpress.Select(o => new { o.OwnerKvid, o.OwnerName, o.Amount, o.AmountInvoice, o.AmountUsed, o.OperateTime, o.CreateTime, o.Type, o.Kvid });
sqlExpress.GroupBy(o => o.OwnerName);
sqlExpress.Select(o => new
{
Summary = o.OwnerName,
Amount = Sql.Sum(o.Amount),
Quantity = Sql.Count(o.Kvid),
AmountInvoice = Sql.Sum(o.AmountInvoice),
QuantityInvoice = Sql.Sum(o.AmountInvoice == o.Amount ? 1 : 0),
AmountUsed = Sql.Sum(o.AmountUsed),
QuantityUsed = Sql.Sum(o.AmountUsed == o.Amount ? 1 : 0),
AmountSplit = Sql.Sum(o.Amount),
QuantitySplit = Sql.Count(o.Kvid)
});
rtns.Results = conn.Select<Analysis>(sqlExpress);
rtns.Total = rtns.Results.Count;
return rtns;
}
}
//[Api(Description = "结算分析")] //[Api(Description = "结算分析")]
//[RequiresAnyRole(SystemRoles.Everyone)] //[RequiresAnyRole(SystemRoles.Everyone)]
//public class SettlementPayedAnalysis : RestfulExecution<Settlement> //public class SettlementPayedAnalysis : RestfulExecution<Settlement>
......
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<packages> <packages>
<package id="Kivii.Common" version="5.6.2022.12000" targetFramework="net45" /> <package id="Kivii.Common" version="5.6.2023.2220" targetFramework="net45" />
<package id="Kivii.Core" version="5.6.2022.12000" targetFramework="net45" /> <package id="Kivii.Core" version="5.6.2023.1310" targetFramework="net45" />
<package id="Kivii.Linq" version="5.6.2022.12180" targetFramework="net45" /> <package id="Kivii.Linq" version="5.6.2022.12200" targetFramework="net45" />
</packages> </packages>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment