Commit 797fa862 by GhostUI

Merge branch 'feature/f-zmh-付现流水'

parents d7ef241a e253f22b
...@@ -10,7 +10,7 @@ namespace Bailun.DC.DB.Base ...@@ -10,7 +10,7 @@ namespace Bailun.DC.DB.Base
/// </summary> /// </summary>
public static class ConfigHelper public static class ConfigHelper
{ {
private static IConfigurationSection _appSection = null; private static IConfiguration _appSection = null;
public static string AppSetting(string key) public static string AppSetting(string key)
{ {
...@@ -22,7 +22,7 @@ namespace Bailun.DC.DB.Base ...@@ -22,7 +22,7 @@ namespace Bailun.DC.DB.Base
return str; return str;
} }
public static void SetAppSetting(IConfigurationSection section) public static void SetAppSetting(IConfiguration section)
{ {
_appSection = section; _appSection = section;
} }
......
...@@ -683,7 +683,25 @@ namespace Dapper ...@@ -683,7 +683,25 @@ namespace Dapper
return connection.Query<T>(strsql, parameters,null,true,timeout); return connection.Query<T>(strsql, parameters,null,true,timeout);
} }
public static IEnumerable<T> Query<T>(string sql, DynamicParameters param, string connection)
{
if (string.IsNullOrEmpty(connection))
{
throw new Exception("连接字符不能为空");
}
IEnumerable<T> result = null;
using (MySql.Data.MySqlClient.MySqlConnection con = new MySql.Data.MySqlClient.MySqlConnection(connection))
{
result = con.Query<T>(sql, param, null, true, 60000);
con.Dispose();
}
return result;
}
//build update statement based on list on an entity //build update statement based on list on an entity
private static void BuildUpdateSet<T>(T entityToUpdate, StringBuilder sb) private static void BuildUpdateSet<T>(T entityToUpdate, StringBuilder sb)
......
...@@ -13,7 +13,7 @@ namespace Bailun.DC.Models.Common ...@@ -13,7 +13,7 @@ namespace Bailun.DC.Models.Common
/// <summary> /// <summary>
/// 指示是否成功 /// 指示是否成功
/// </summary> /// </summary>
public bool IsSuccess { get; set; } public bool IsSuccess { get; set; } = true;
/// <summary> /// <summary>
/// 返回的业务数据 /// 返回的业务数据
......
using System;
using System.Collections.Generic;
using System.Text;
namespace Bailun.DC.Models.Common.Page
{
/// <summary>
/// 分页请求参数
/// </summary>
public class PageRequest
{
/// <summary>
/// 当前页
/// </summary>
public int PageIndex { get; set; }
/// <summary>
/// 每页行数
/// </summary>
public int PageNumber { get; set; } = 20;
/// <summary>
/// 总条数
/// </summary>
public long Total { get; set; }
/// <summary>
/// 排序字段
/// </summary>
public string SortField {get;set;}
/// <summary>
/// 排序类型:asc/desc
/// </summary>
public string Sort{get;set;}
}
}
using System;
using System.Collections;
using System.Collections.Generic;
using System.Text;
namespace Bailun.DC.Models.Common.Page
{
/// <summary>
/// 分页返回值
/// </summary>
/// <typeparam name="TData"></typeparam>
public class PageResult<TData> where TData : IList
{
/// <summary>
/// 每页行数
/// </summary>
public int Rows
{
get
{
if (Data != null)
{
return Data.Count;
}
return 0;
}
}
public bool IsSuccess
{
get;
set;
} = true;
public TData Data
{
get;
set;
}
public int PageIndex
{
get;
set;
}
public long Total
{
get;
set;
}
public long TotalPage
{
get
{
if (Total > 0)
{
return (Total % Rows == 0L) ? (Total / Rows) : (Total / Rows + 1);
}
return 0L;
}
}
/// <summary>
/// 构造返回值
/// </summary>
/// <param name="pageIndex">当前页</param>
/// <param name="records">总条数</param>
/// <param name="data">分页数据</param>
/// <returns></returns>
public PageResult<TData> ToPageResult(int pageIndex, long records, TData data)
{
return new PageResult<TData>
{
Data = data,
PageIndex = pageIndex,
Total = records,
};
}
}
}
using Bailun.DC.Models.Common.Page;
using System;
using System.Collections.Generic;
using System.Text;
namespace Bailun.DC.Models.Dtos.Finance
{
public class GetCashFlowStatementInput : PageRequest
{
/// <summary>
/// 付款开始
/// </summary>
public DateTime PaymentTimeStart { get; set; }
/// <summary>
/// 付款结束
/// </summary>
public DateTime PaymentTimeEnd { get; set; }
/// <summary>
/// 公司主体
/// </summary>
public string CorporateEntity { get; set; }
}
}
using Bailun.DC.Common;
using Bailun.DC.DB.Base;
using Bailun.DC.Models;
using Bailun.DC.Models.Common;
using Bailun.DC.Models.Common.Page;
using Bailun.DC.Models.Dtos.Finance;
using Dapper;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net.Http;
using System.Text;
using System.Threading.Tasks;
namespace Bailun.DC.Services.WebApiService
{
public partial class FinanceService
{
public async Task<CommonApiResponseDto<List<dc_base_finance_fee>>> GetCashFlowStatement(GetCashFlowStatementInput input)
{
try
{
var sql = $@"select * from dc_base_finance_fee s1
left JOIN dc_base_finance_company s2
ON s1.company_name = s2.company_name
where s1.cost_status = 4
and (s1.is_lend is null or s1.is_lend = 1
or (s1.is_lend = 2 and s1.lend_balance > 0) or (s1.is_lend = 2 and s1.cost_form = 1))
and s1.pay_time >= @PaymentTimeStart and s1.pay_time < @PaymentTimeEnd
and s2.company_type = @CorporateEntity";
var para = new DynamicParameters();
para.Add("PaymentTimeStart", input.PaymentTimeStart.Date);
para.Add("PaymentTimeEnd", input.PaymentTimeEnd.Date);
para.Add("CorporateEntity", input.CorporateEntity);
var data = SimpleCRUD.Query<dc_base_finance_fee>(sql, para, GlobalConfig.ConnectionString).ToList();
var url = ConfigHelper.AppSetting("cwUrl");
return new CommonApiResponseDto<List<dc_base_finance_fee>>
{
Data = data
};
}
catch (Exception e)
{
return new CommonApiResponseDto<List<dc_base_finance_fee>> { IsSuccess = false, Message = e.Message };
}
}
private async Task<List<Models.Api.mInterestExpense>> GetMInterestExpense(string url)
{
using (var http = new HttpClient())
{
var result = await http.GetStringAsync(url);
var obj = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Models.Api.mInterestExpense>>(result);
return obj;
};
}
}
}
...@@ -10,7 +10,10 @@ ...@@ -10,7 +10,10 @@
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<Folder Include="wwwroot\" /> <Compile Remove="wwwroot\**" />
<Content Remove="wwwroot\**" />
<EmbeddedResource Remove="wwwroot\**" />
<None Remove="wwwroot\**" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
......
using Bailun.DC.Models; using Bailun.DC.Models;
using Bailun.DC.Models.Common; using Bailun.DC.Models.Common;
using Bailun.DC.Models.Common.Page;
using Bailun.DC.Models.Dtos.Finance;
using Bailun.DC.Services;
using Bailun.DC.Services.WebApiService;
using Bailun.DC.WebApi.Attribute; using Bailun.DC.WebApi.Attribute;
using Bailun.ServiceFabric.Authorize; using Bailun.ServiceFabric.Authorize;
using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Threading.Tasks;
namespace Bailun.DC.WebApi.Controllers namespace Bailun.DC.WebApi.Controllers
{ {
...@@ -29,5 +34,13 @@ namespace Bailun.DC.WebApi.Controllers ...@@ -29,5 +34,13 @@ namespace Bailun.DC.WebApi.Controllers
return new CommonApiResponseDto<List<dc_base_finance_fee>> { Data = list, IsSuccess = true }; return new CommonApiResponseDto<List<dc_base_finance_fee>> { Data = list, IsSuccess = true };
} }
/// <summary>
/// 获取付现流水报表
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
[HttpPost("getCashFlowStatement")]
public async Task<CommonApiResponseDto<List<dc_base_finance_fee>>> GetCashFlowStatement(GetCashFlowStatementInput input)
=> await new FinanceService().GetCashFlowStatement(input);
} }
} }
using Bailun.ServiceFabric.Extension; using Bailun.DC.DB.Base;
using Bailun.ServiceFabric.Extension;
using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
...@@ -32,6 +33,7 @@ namespace Bailun.DC.WebApi ...@@ -32,6 +33,7 @@ namespace Bailun.DC.WebApi
public void ConfigureServices(IServiceCollection services) public void ConfigureServices(IServiceCollection services)
{ {
ConfigManagerConf.SetConfiguration(Configuration); ConfigManagerConf.SetConfiguration(Configuration);
ConfigHelper.SetAppSetting(Configuration);
services.AddSwaggerGen(c => services.AddSwaggerGen(c =>
{ {
c.SwaggerDoc("v1", new OpenApiInfo { Title = "Bailun.DC.WebApi", Version = "v1" }); c.SwaggerDoc("v1", new OpenApiInfo { Title = "Bailun.DC.WebApi", Version = "v1" });
......
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