步步为盈
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

53 lines
2.3 KiB

3 years ago
using BBWY.Common.Models;
3 years ago
using BBWY.Server.Model.Db;
using BBWY.Server.Model.Dto;
2 years ago
using System;
3 years ago
using System.Collections.Generic;
using System.Linq;
3 years ago
using Yitter.IdGenerator;
namespace BBWY.Server.Business
{
3 years ago
public class FinancialTerminalBusiness : BaseBusiness, IDenpendency
3 years ago
{
2 years ago
public FinancialTerminalBusiness(IFreeSql fsql, NLogManager nLogManager, IIdGenerator idGenerator, IEnumerable<PlatformSDKBusiness> platformSDKBusinessList) : base(fsql, nLogManager, idGenerator, platformSDKBusinessList)
3 years ago
{
}
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).OrderByDescending(b => b.PayTime).ToList<AuditPayBillResponse>();
3 years ago
}
3 years ago
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();
}
3 years ago
3 years ago
public void BatchInsertAuditPayBill(List<AuditPayBill> insertList)
{
3 years ago
if (insertList == null || insertList.Count == 0)
throw new BusinessException("数据不全");
//var importShopIds = insertList[0].ImportShopIds;
//var startTime = insertList.Min(abp => abp.PayTime).Value;
//var endTime = insertList.Max(abp => abp.PayTime).Value;
3 years ago
var deleteIds = insertList.Select(p => p.PayBillNo).ToArray();
2 years ago
foreach (var b in insertList)
b.CreateTime = DateTime.Now;
3 years ago
fsql.Transaction(() =>
{
fsql.Delete<AuditPayBill>(deleteIds).ExecuteAffrows();
3 years ago
fsql.Insert(insertList).ExecuteAffrows();
});
}
3 years ago
}
}