Commit 51f34449 by lcx

抽取新增字段configid,决定script的抽取配置

parent 8a3157ca
...@@ -7,35 +7,40 @@ ...@@ -7,35 +7,40 @@
using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema; using System.ComponentModel.DataAnnotations.Schema;
namespace Performance.EntityModels namespace Performance.EntityModels
{ {
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
[Table("ex_script")] [Table("ex_script")]
public class ex_script public class ex_script
{ {
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
[Key] [Key]
public int Id { get; set; } public int Id { get; set; }
/// <summary> /// <summary>
/// 执行sql /// 执行sql
/// </summary> /// </summary>
public string ExecScript { get; set; } public string ExecScript { get; set; }
/// <summary> /// <summary>
/// 数据库类型1、Sql Server 2、Orcale /// 数据库类型1、Sql Server 2、Orcale
/// </summary> /// </summary>
public int DatabaseType { get; set; } public int DatabaseType { get; set; }
/// <summary> /// <summary>
/// ExTypeId /// ExTypeId
/// </summary> /// </summary>
public int TypeId { get; set; } public int TypeId { get; set; }
/// <summary>
/// 配置Id
/// </summary>
public int ConfigId { get; set; }
/// <summary> /// <summary>
/// 是否可用 1 可用 2 不可用 /// 是否可用 1 可用 2 不可用
/// </summary> /// </summary>
......
...@@ -203,15 +203,20 @@ private List<ex_result> ExtractIncome<TEntity>(List<TEntity> entities, List<ex_s ...@@ -203,15 +203,20 @@ private List<ex_result> ExtractIncome<TEntity>(List<TEntity> entities, List<ex_s
ratio += 15m / incomemodules.Count(); ratio += 15m / incomemodules.Count();
logManage.ReturnTheLog(Allot.ID, GroupName, 3, "", ratio > 20 ? 20 : ratio); logManage.ReturnTheLog(Allot.ID, GroupName, 3, "", ratio > 20 ? 20 : ratio);
logManage.ReturnTheLog(Allot.ID, GroupName, 2, "提取数据", $"开始提取模块“{module.ModuleName}”的数据"); logManage.ReturnTheLog(Allot.ID, GroupName, 2, "提取数据", $"开始提取模块“{module.ModuleName}”的数据");
foreach (var config in configs) var items = scripts.Where(t => t.TypeId == module.TypeId);
if (items != null && items.Any())
{ {
var item = scripts.FirstOrDefault(t => t.TypeId == module.TypeId && t.DatabaseType == config.DataBaseType); foreach (var item in items)
if (item == null) continue;
var querydata = QueryData(config, allot, item.ExecScript, module.ModuleName);
if (querydata != null && querydata.Any())
{ {
perforExresultRepository.AddRange(querydata.ToArray()); var config = configs.FirstOrDefault(t => t.Id == item.ConfigId);
data.AddRange(querydata); if (config == null) continue;
var querydata = QueryData(config, allot, item.ExecScript, module.ModuleName);
if (querydata != null && querydata.Any())
{
perforExresultRepository.AddRange(querydata.ToArray());
data.AddRange(querydata);
}
} }
} }
logManage.ReturnTheLog(Allot.ID, GroupName, 2, "提取数据", $"模块“{module.ModuleName}”的数据已完成提取"); logManage.ReturnTheLog(Allot.ID, GroupName, 2, "提取数据", $"模块“{module.ModuleName}”的数据已完成提取");
...@@ -249,21 +254,25 @@ private List<ex_result> ExtractItems<TEntity>(List<TEntity> entities, List<ex_sc ...@@ -249,21 +254,25 @@ private List<ex_result> ExtractItems<TEntity>(List<TEntity> entities, List<ex_sc
logManage.ReturnTheLog(Allot.ID, GroupName, 3, "", ratio > 50 ? 50 : ratio); logManage.ReturnTheLog(Allot.ID, GroupName, 3, "", ratio > 50 ? 50 : ratio);
logManage.ReturnTheLog(Allot.ID, GroupName, 2, "提取数据", $"开始提取项目“{exitem.ItemName}”的数据"); logManage.ReturnTheLog(Allot.ID, GroupName, 2, "提取数据", $"开始提取项目“{exitem.ItemName}”的数据");
var module = modules.FirstOrDefault(t => t.Id == exitem.ModuleId); var module = modules.FirstOrDefault(t => t.Id == exitem.ModuleId);
foreach (var config in configs) var scritems = scripts.Where(t => t.TypeId == exitem.TypeId);
if (scritems != null && scritems.Any())
{ {
var item = scripts.FirstOrDefault(t => t.TypeId == exitem.TypeId && t.DatabaseType == config.DataBaseType); foreach (var item in scritems)
if (item == null) continue;
var result = QueryData(config, allot, item.ExecScript, module.ModuleName);
if (result != null && result.Any())
{ {
result.ForEach(t => var config = configs.FirstOrDefault(t => t.Id == item.ConfigId);
if (config == null) continue;
var result = QueryData(config, allot, item.ExecScript, module.ModuleName);
if (result != null && result.Any())
{ {
t.Category = exitem.ItemName; result.ForEach(t =>
}); {
t.Category = exitem.ItemName;
});
perforExresultRepository.AddRange(result.ToArray()); perforExresultRepository.AddRange(result.ToArray());
data.AddRange(result); data.AddRange(result);
}
} }
} }
logManage.ReturnTheLog(Allot.ID, GroupName, 2, "提取数据", $"项目“{exitem.ItemName}”的数据已完成提取"); logManage.ReturnTheLog(Allot.ID, GroupName, 2, "提取数据", $"项目“{exitem.ItemName}”的数据已完成提取");
...@@ -299,18 +308,22 @@ private List<ex_result> ExtractSpcial<TEntity>(List<TEntity> entities, List<ex_s ...@@ -299,18 +308,22 @@ private List<ex_result> ExtractSpcial<TEntity>(List<TEntity> entities, List<ex_s
ratio += 10m / specials.Where(t => t.TypeId > 0).Count(); ratio += 10m / specials.Where(t => t.TypeId > 0).Count();
logManage.ReturnTheLog(Allot.ID, GroupName, 3, "", ratio > 60 ? 60 : ratio); logManage.ReturnTheLog(Allot.ID, GroupName, 3, "", ratio > 60 ? 60 : ratio);
logManage.ReturnTheLog(Allot.ID, GroupName, 2, "提取数据", $"开始提取特殊核算项“{special.Target}”的数据"); logManage.ReturnTheLog(Allot.ID, GroupName, 2, "提取数据", $"开始提取特殊核算项“{special.Target}”的数据");
foreach (var config in configs) var scritems = scripts.Where(t => t.TypeId == special.TypeId);
if (scritems != null && scritems.Any())
{ {
var item = scripts.FirstOrDefault(t => t.TypeId == special.TypeId && t.DatabaseType == config.DataBaseType); foreach (var item in scritems)
if (item == null) continue;
var result = QueryData(config, allot, item.ExecScript, specialname);
result.ForEach(t =>
{ {
t.Category = special.Target; var config = configs.FirstOrDefault(t => t.Id == item.ConfigId);
t.Department = special.Department; if (config == null) continue;
});
data.AddRange(result); var result = QueryData(config, allot, item.ExecScript, specialname);
result.ForEach(t =>
{
t.Category = special.Target;
t.Department = special.Department;
});
data.AddRange(result);
}
} }
logManage.ReturnTheLog(Allot.ID, GroupName, 2, "提取数据", $"特殊核算项“{special.Target}”的数据已完成提取"); logManage.ReturnTheLog(Allot.ID, GroupName, 2, "提取数据", $"特殊核算项“{special.Target}”的数据已完成提取");
} }
......
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