4 changed files with 63 additions and 3 deletions
@ -1,15 +1,49 @@ |
|||
using BBWY.Common.Models; |
|||
using BBWY.Server.Model.Db; |
|||
using BBWY.Server.Model.Dto; |
|||
using System.Collections.Generic; |
|||
using System.Linq; |
|||
using Yitter.IdGenerator; |
|||
|
|||
namespace BBWY.Server.Business |
|||
{ |
|||
public class FinancialTerminalBusiness: BaseBusiness, IDenpendency |
|||
public class FinancialTerminalBusiness : BaseBusiness, IDenpendency |
|||
{ |
|||
public FinancialTerminalBusiness(IFreeSql fsql, NLog.ILogger logger, IIdGenerator idGenerator) : base(fsql, logger, idGenerator) |
|||
{ |
|||
|
|||
{ |
|||
|
|||
} |
|||
|
|||
public IList<AuditPayBillResponse> GetAuditPayBillList(QueryAuditPayBillRequest request) |
|||
{ |
|||
request.EndDate = request.EndDate.Date.AddDays(1).AddSeconds(-1); |
|||
return fsql.Select<AuditPayBill>().Where(apb => apb.ImportShopIds == request.ImportShopIds && |
|||
apb.PayTime >= request.StartDate && |
|||
apb.PayTime <= request.EndDate).ToList<AuditPayBillResponse>(); |
|||
} |
|||
|
|||
public bool IsExistAuditPayBill(QueryAuditPayBillRequest request) |
|||
{ |
|||
request.EndDate = request.EndDate.Date.AddDays(1).AddSeconds(-1); |
|||
return fsql.Select<AuditPayBill>().Where(apb => apb.ImportShopIds == request.ImportShopIds && |
|||
apb.PayTime >= request.StartDate && |
|||
apb.PayTime <= request.EndDate).Any(); |
|||
} |
|||
|
|||
public void BatchInsertAuditPayBill(List<AuditPayBill> insertList) |
|||
{ |
|||
var importShopIds = insertList[0].ImportShopIds; |
|||
var startTime = insertList.Min(abp => abp.PayTime).Value; |
|||
var endTime = insertList.Max(abp => abp.PayTime).Value; |
|||
|
|||
|
|||
fsql.Transaction(() => |
|||
{ |
|||
fsql.Delete<AuditPayBill>().Where(apb => apb.ImportShopIds == importShopIds && |
|||
apb.PayTime >= startTime && |
|||
apb.PayTime <= endTime).ExecuteAffrows(); |
|||
fsql.Insert(insertList).ExecuteAffrows(); |
|||
}); |
|||
} |
|||
} |
|||
} |
|||
|
@ -0,0 +1,13 @@ |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.Text; |
|||
|
|||
namespace BBWY.Server.Model.Dto |
|||
{ |
|||
public class QueryAuditPayBillRequest |
|||
{ |
|||
public string ImportShopIds { get; set; } |
|||
public DateTime StartDate { get; set; } |
|||
public DateTime EndDate { get; set; } |
|||
} |
|||
} |
@ -0,0 +1,9 @@ |
|||
using BBWY.Server.Model.Db; |
|||
|
|||
namespace BBWY.Server.Model.Dto |
|||
{ |
|||
public class AuditPayBillResponse: AuditPayBill |
|||
{ |
|||
|
|||
} |
|||
} |
Loading…
Reference in new issue