|
|
@ -1,4 +1,5 @@ |
|
|
|
using Magicodes.ExporterAndImporter.Core.Extension; |
|
|
|
using Magicodes.ExporterAndImporter.Core; |
|
|
|
using Magicodes.ExporterAndImporter.Core.Extension; |
|
|
|
using Magicodes.ExporterAndImporter.Excel; |
|
|
|
using Microsoft.AspNetCore.Builder; |
|
|
|
using Microsoft.AspNetCore.Hosting; |
|
|
@ -14,6 +15,7 @@ using System; |
|
|
|
using System.Data; |
|
|
|
using System.Data.Common; |
|
|
|
using System.Linq.Expressions; |
|
|
|
using System.Reflection; |
|
|
|
using System.Text; |
|
|
|
using System.Text.Json; |
|
|
|
using System.Text.Json.Serialization; |
|
|
@ -43,6 +45,15 @@ namespace TaskManager.Controllers |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private async Task InsertDataAsync(List<T> list) |
|
|
|
{ |
|
|
|
if (list.Any()) |
|
|
@ -78,11 +89,8 @@ namespace TaskManager.Controllers |
|
|
|
int pageSize = 0; |
|
|
|
int currentPage = 1; |
|
|
|
string date = !string.IsNullOrEmpty(inputdate) ? inputdate : DateTime.Now.ToString("yyyy-MM-dd"); |
|
|
|
|
|
|
|
var taskId = Guid.NewGuid(); |
|
|
|
var version = date.Replace("-", ""); |
|
|
|
|
|
|
|
|
|
|
|
var readedcount = _jobDbContext.Set<T>().Where(p => p.RequestDate == inputdate).Count(); |
|
|
|
if (readedcount == 0)//第一次请求用false,接口人胡启名要求
|
|
|
|
{ |
|
|
@ -104,12 +112,7 @@ namespace TaskManager.Controllers |
|
|
|
totalItems = int.Parse(firstResponse.Data.Total); |
|
|
|
pageSize = int.Parse(firstResponse.Data.PageSize); |
|
|
|
List<T> pagefirstList = new List<T>(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// firstResponse.Data.Rows.Select(p=>p.Id)
|
|
|
|
|
|
|
|
|
|
|
|
foreach (var itm in firstResponse.Data.Rows) |
|
|
|
{ |
|
|
|
T entity = new T(); |
|
|
@ -119,8 +122,6 @@ namespace TaskManager.Controllers |
|
|
|
pagefirstList.Add(entity); |
|
|
|
allData.Add(itm); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
//if (readedcount > 0)
|
|
|
|
//{
|
|
|
|
// var listrows = firstResponse.Data.Rows.Where(p => !ids.Contains(p.Id));
|
|
|
@ -670,6 +671,42 @@ namespace TaskManager.Controllers |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// 高级查询字段
|
|
|
|
/// </summary>
|
|
|
|
/// <returns></returns>
|
|
|
|
|
|
|
|
[HttpGet("fields")] |
|
|
|
public IActionResult GetQueryFields() |
|
|
|
{ |
|
|
|
// 获取实体类的所有属性
|
|
|
|
Type entityType = typeof(T); |
|
|
|
var properties = entityType.GetProperties(); |
|
|
|
|
|
|
|
// 构建字段信息列表
|
|
|
|
var fields = new List<QueryFieldInfo>(); |
|
|
|
|
|
|
|
foreach (var property in properties) |
|
|
|
{ |
|
|
|
// 获取ExporterHeader特性中的DisplayName
|
|
|
|
var exporterHeader = property.GetCustomAttribute<ExporterHeaderAttribute>(); |
|
|
|
string displayName = exporterHeader?.DisplayName ?? property.Name; |
|
|
|
|
|
|
|
// 获取属性类型
|
|
|
|
string dataType = property.PropertyType.Name; |
|
|
|
|
|
|
|
// 添加到字段列表
|
|
|
|
fields.Add(new QueryFieldInfo |
|
|
|
{ |
|
|
|
FieldName = property.Name, |
|
|
|
DisplayName = displayName, |
|
|
|
DataType = dataType |
|
|
|
}); |
|
|
|
} |
|
|
|
|
|
|
|
return Ok(fields); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|