修改一版
This commit is contained in:
@@ -56,12 +56,12 @@ namespace IRaCIS.Core.Application.ViewModel
|
||||
/// <summary>
|
||||
/// 数据来源对象
|
||||
/// </summary>
|
||||
public Guid DataFromItemGuid { get; set; }
|
||||
public Guid FromItemId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 要赋值到的对象
|
||||
/// </summary>
|
||||
public Guid ThisItemGuid { get; set; }
|
||||
public Guid ToItemId { get; set; }
|
||||
|
||||
|
||||
}
|
||||
@@ -84,7 +84,7 @@ namespace IRaCIS.Core.Application.ViewModel
|
||||
|
||||
public class GetDescriptionByModuleTypeDto
|
||||
{
|
||||
public Guid? ModuleType { get; set; }
|
||||
public Guid ModuleTypeId { get; set; }
|
||||
}
|
||||
|
||||
///<summary>FrontAuditConfigQuery 列表查询参数模型</summary>
|
||||
@@ -118,7 +118,7 @@ namespace IRaCIS.Core.Application.ViewModel
|
||||
|
||||
public class ChangeFrontAuditSortDto
|
||||
{
|
||||
public List<FrontAuditSort> SortData { get; set; }
|
||||
public List<FrontAuditSort> SortDataList { get; set; }
|
||||
}
|
||||
|
||||
public class FrontAuditSort
|
||||
|
||||
@@ -64,7 +64,7 @@ namespace IRaCIS.Core.Application.Service
|
||||
/// <param name="inDto"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
public async Task<List<AccessToDialogueOutDto>> AccessToDialogue(AccessToDialogueInDto inDto)
|
||||
public async Task<List<AccessToDialogueOutDto>> GetDialogList(AccessToDialogueInDto inDto)
|
||||
{
|
||||
List<AccessToDialogueOutDto> data = new List<AccessToDialogueOutDto>();
|
||||
|
||||
@@ -153,15 +153,15 @@ namespace IRaCIS.Core.Application.Service
|
||||
/// <returns></returns>
|
||||
public async Task BatchAddFrontAudit(BatchAddFrontAudit data)
|
||||
{
|
||||
var maxsort = await _frontAuditConfigRepository.Where(x => x.ParentId == data.ParentId).MaxAsync(x => x.Sort);
|
||||
var maxSort = await _frontAuditConfigRepository.Where(x => x.ParentId == data.ParentId).MaxAsync(x => x.Sort);
|
||||
|
||||
List<FrontAuditConfig> fronts=new List<FrontAuditConfig>();
|
||||
foreach (var item in data.Columns)
|
||||
{
|
||||
maxsort++;
|
||||
maxSort++;
|
||||
fronts.Add(new FrontAuditConfig()
|
||||
{
|
||||
Sort = maxsort,
|
||||
Sort = maxSort,
|
||||
Code = item.Name,
|
||||
ValueCN = item.Remake,
|
||||
IsEnable = true,
|
||||
@@ -180,7 +180,7 @@ namespace IRaCIS.Core.Application.Service
|
||||
[HttpPost]
|
||||
public async Task<List<string>> SetInspectionEnumValue(SetInspectionEnumValueDto dto)
|
||||
{
|
||||
return await SetInspectionEnumValueData(dto);
|
||||
return await SetInspectionEnumValueDataList(dto);
|
||||
}
|
||||
|
||||
|
||||
@@ -190,7 +190,7 @@ namespace IRaCIS.Core.Application.Service
|
||||
/// </summary>
|
||||
/// <param name="dto">传入Dto</param>
|
||||
/// <returns></returns>
|
||||
private async Task<List<string>> SetInspectionEnumValueData(SetInspectionEnumValueDto dto)
|
||||
private async Task<List<string>> SetInspectionEnumValueDataList(SetInspectionEnumValueDto dto)
|
||||
{
|
||||
var listIdentification = dto.Items.Select(x => x.Identification).ToList();
|
||||
foreach (var item in dto.Items)
|
||||
@@ -215,9 +215,9 @@ namespace IRaCIS.Core.Application.Service
|
||||
/// </summary>
|
||||
/// <param name="Data">稽查数据</param>
|
||||
/// <returns></returns>
|
||||
private async Task<string> SetDataInspectionDateType(List<string> identification, string json)
|
||||
private async Task<string> SetDataInspectionDateType(List<string> identificationList, string jsonStr)
|
||||
{
|
||||
var list = await (from parent in _frontAuditConfigRepository.AsQueryable().Where(x => identification.Contains(x.Identification))
|
||||
var list = await (from parent in _frontAuditConfigRepository.AsQueryable().Where(x => identificationList.Contains(x.Identification))
|
||||
join child in _frontAuditConfigRepository.AsQueryable().Where(x => x.EnumType == "Date" && x.IsEnable ) on parent.Id equals child.ParentId
|
||||
select new DateDto()
|
||||
{
|
||||
@@ -231,28 +231,28 @@ namespace IRaCIS.Core.Application.Service
|
||||
DateType = lst.Max(x => x.DateType),
|
||||
}).ToList();
|
||||
|
||||
var JsonData = JsonConvert.DeserializeObject<IDictionary<string, object>>(json);
|
||||
var jsonDataDic = JsonConvert.DeserializeObject<IDictionary<string, object>>(jsonStr);
|
||||
|
||||
if (JsonData == null)
|
||||
if (jsonDataDic == null)
|
||||
{
|
||||
return json;
|
||||
return jsonStr;
|
||||
}
|
||||
|
||||
foreach (var item in JsonData.Keys)
|
||||
foreach (var item in jsonDataDic.Keys)
|
||||
{
|
||||
var datefirst = list.FirstOrDefault(x => x.Code.ToLower() == item.ToLower());
|
||||
if (datefirst != null && !IsNullOrEmpty(JsonData[item]))
|
||||
if (datefirst != null && !IsNullOrEmpty(jsonDataDic[item]))
|
||||
{
|
||||
try
|
||||
{
|
||||
if (datefirst.DateType == "Date")
|
||||
{
|
||||
JsonData[item] = DateTime.Parse(JsonData[item].ToString()).ToString("yyyy-MM-dd");
|
||||
jsonDataDic[item] = DateTime.Parse(jsonDataDic[item].ToString()).ToString("yyyy-MM-dd");
|
||||
}
|
||||
|
||||
if (datefirst.DateType == "DateTime")
|
||||
{
|
||||
JsonData[item] = DateTime.Parse(JsonData[item].ToString()).ToString("yyyy-MM-dd HH:mm:ss");
|
||||
jsonDataDic[item] = DateTime.Parse(jsonDataDic[item].ToString()).ToString("yyyy-MM-dd HH:mm:ss");
|
||||
}
|
||||
}
|
||||
catch (Exception)
|
||||
@@ -263,7 +263,7 @@ namespace IRaCIS.Core.Application.Service
|
||||
|
||||
}
|
||||
|
||||
return JsonConvert.SerializeObject(JsonData);
|
||||
return JsonConvert.SerializeObject(jsonDataDic);
|
||||
|
||||
|
||||
}
|
||||
@@ -276,9 +276,9 @@ namespace IRaCIS.Core.Application.Service
|
||||
/// <param name="ForeignKeyText">要查询的外键值</param>
|
||||
/// <param name="value">传入的纸</param>
|
||||
/// <returns></returns>
|
||||
private async Task<string> GetInspectionEnumValue(List<string> identification, string json)
|
||||
private async Task<string> GetInspectionEnumValue(List<string> identificationList, string jsonStr)
|
||||
{
|
||||
var list = await (from u in _frontAuditConfigRepository.Where(x => identification.Contains(x.Identification))
|
||||
var list = await (from u in _frontAuditConfigRepository.Where(x => identificationList.Contains(x.Identification))
|
||||
join p in _frontAuditConfigRepository.Where(x => x.EnumType == "Foreign" && x.IsEnable) on u.Id equals p.ParentId
|
||||
select new
|
||||
{
|
||||
@@ -296,19 +296,19 @@ namespace IRaCIS.Core.Application.Service
|
||||
|
||||
}).ToList();
|
||||
|
||||
var JsonDataValue = JsonConvert.DeserializeObject<IDictionary<string, object>>(json);
|
||||
var jsonDataValueDic = JsonConvert.DeserializeObject<IDictionary<string, object>>(jsonStr);
|
||||
foreach (var item in list)
|
||||
{
|
||||
if (!JsonDataValue.ContainsKey(item.Key))
|
||||
if (!jsonDataValueDic.ContainsKey(item.Key))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
string Table = item.ForeignKeyTable;
|
||||
string ForeignKeyValue = item.ForeignKeyValue;
|
||||
string ForeignKeyText = item.ForeignKeyText;
|
||||
if (JsonDataValue[item.Key] != null)
|
||||
if (jsonDataValueDic[item.Key] != null)
|
||||
{
|
||||
string value = JsonDataValue[item.Key].ToString();
|
||||
string value = jsonDataValueDic[item.Key].ToString();
|
||||
string para = string.Empty;
|
||||
string sql = string.Empty;
|
||||
var JsonData = JsonConvert.DeserializeObject<IDictionary<string, object>>(JsonConvert.SerializeObject(new { item = value }));
|
||||
@@ -328,10 +328,10 @@ namespace IRaCIS.Core.Application.Service
|
||||
SqlParameter[] paravalue = new SqlParameter[] {
|
||||
new SqlParameter("@para",para)
|
||||
};
|
||||
JsonDataValue[item.Key] = string.Join(",", _frontAuditConfigRepository._dbContext.Database.SqlQuery<ForeignKey>(sql, paravalue).Select(x => x.Text).ToList());
|
||||
jsonDataValueDic[item.Key] = string.Join(",", _frontAuditConfigRepository._dbContext.Database.SqlQuery<ForeignKey>(sql, paravalue).Select(x => x.Text).ToList());
|
||||
}
|
||||
}
|
||||
return JsonConvert.SerializeObject(JsonDataValue);
|
||||
return JsonConvert.SerializeObject(jsonDataValueDic);
|
||||
}
|
||||
|
||||
|
||||
@@ -342,13 +342,13 @@ namespace IRaCIS.Core.Application.Service
|
||||
/// <param name="identifications">标识</param>
|
||||
/// <param name="jsonStr">Json对象</param>
|
||||
/// <returns></returns>
|
||||
private async Task<string> SetEnum(Guid trialId, List<string> identifications, string jsonStr)
|
||||
private async Task<string> SetEnum(Guid trialId, List<string> identificationList, string jsonStr)
|
||||
{
|
||||
if (jsonStr == null || jsonStr == "null")
|
||||
{
|
||||
return null;
|
||||
}
|
||||
var list = await (from u in _frontAuditConfigRepository.Where(x => identifications.Contains(x.Identification))
|
||||
var list = await (from u in _frontAuditConfigRepository.Where(x => identificationList.Contains(x.Identification))
|
||||
join p in _frontAuditConfigRepository.Where(x => x.Code != "AuditState" && x.EnumType == "Dictionary" && x.IsEnable) on u.Id equals p.ParentId
|
||||
select new
|
||||
{
|
||||
@@ -376,17 +376,17 @@ namespace IRaCIS.Core.Application.Service
|
||||
Type = lst.Max(x => x.Type),
|
||||
}).ToList();
|
||||
|
||||
var JsonData = JsonConvert.DeserializeObject<IDictionary<string, object>>(jsonStr);
|
||||
var jsonDataDic = JsonConvert.DeserializeObject<IDictionary<string, object>>(jsonStr);
|
||||
foreach (var item in list)
|
||||
{
|
||||
try
|
||||
{
|
||||
|
||||
if (!JsonData.ContainsKey(item.Key) || JsonData[item.Key] == null)
|
||||
if (!jsonDataDic.ContainsKey(item.Key) || jsonDataDic[item.Key] == null)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
var value = JsonData[item.Key];
|
||||
var value = jsonDataDic[item.Key];
|
||||
if (value.GetType() == typeof(JArray))
|
||||
{
|
||||
JArray arrays = (JArray)value;
|
||||
@@ -397,7 +397,7 @@ namespace IRaCIS.Core.Application.Service
|
||||
{
|
||||
guids.Add(Guid.Parse(x.ToString()));
|
||||
});
|
||||
JsonData[item.Key] = string.Join(',', await _dictionaryRepository.Where(x => guids.Contains(x.Id)).Select(x => x.ValueCN).ToListAsync());
|
||||
jsonDataDic[item.Key] = string.Join(',', await _dictionaryRepository.Where(x => guids.Contains(x.Id)).Select(x => x.ValueCN).ToListAsync());
|
||||
}
|
||||
else if (item.Type.ToLower() == "ChildGroup".ToLower())
|
||||
{
|
||||
@@ -406,7 +406,7 @@ namespace IRaCIS.Core.Application.Service
|
||||
{
|
||||
guids.Add(x.ToString());
|
||||
});
|
||||
JsonData[item.Key] = string.Join(',', await
|
||||
jsonDataDic[item.Key] = string.Join(',', await
|
||||
_dictionaryRepository.Where(x => x.Code == item.Code).GroupJoin(
|
||||
_dictionaryRepository.Where(x => guids.Contains(x.ChildGroup)), a => a.Id, b => b.ParentId, (a, b) => new
|
||||
{
|
||||
@@ -424,7 +424,7 @@ namespace IRaCIS.Core.Application.Service
|
||||
{
|
||||
guids.Add(x.ToString());
|
||||
});
|
||||
JsonData[item.Key] = string.Join(',', await
|
||||
jsonDataDic[item.Key] = string.Join(',', await
|
||||
_dictionaryRepository.Where(x => x.Code == item.Code).GroupJoin(
|
||||
_dictionaryRepository.Where(x => guids.Contains(x.Code)), a => a.Id, b => b.ParentId, (a, b) => new
|
||||
{
|
||||
@@ -441,18 +441,18 @@ namespace IRaCIS.Core.Application.Service
|
||||
if (item.Type.ToLower() == "id".ToLower())
|
||||
{
|
||||
Guid guid = Guid.Parse(value.ToString());
|
||||
JsonData[item.Key] = await _dictionaryRepository.Where(x => guid == x.Id).Select(x => x.ValueCN).FirstOrDefaultAsync();
|
||||
jsonDataDic[item.Key] = await _dictionaryRepository.Where(x => guid == x.Id).Select(x => x.ValueCN).FirstOrDefaultAsync();
|
||||
}
|
||||
else if (item.Type.ToLower() == "ChildGroup".ToLower())
|
||||
{
|
||||
JsonData[item.Key] = await _dictionaryRepository.Where(x => x.Code == item.Code).Join(_dictionaryRepository.Where(x => x.ChildGroup == value.ToString()), a => a.Id, b => b.ParentId, (a, b) => new
|
||||
jsonDataDic[item.Key] = await _dictionaryRepository.Where(x => x.Code == item.Code).Join(_dictionaryRepository.Where(x => x.ChildGroup == value.ToString()), a => a.Id, b => b.ParentId, (a, b) => new
|
||||
{
|
||||
value = b.ValueCN
|
||||
}).Select(x => x.value).FirstOrDefaultAsync();
|
||||
}
|
||||
else
|
||||
{
|
||||
JsonData[item.Key] = await _dictionaryRepository.Where(x => x.Code == item.Code).Join(_dictionaryRepository.Where(x => x.Code == value.ToString()), a => a.Id, b => b.ParentId, (a, b) => new
|
||||
jsonDataDic[item.Key] = await _dictionaryRepository.Where(x => x.Code == item.Code).Join(_dictionaryRepository.Where(x => x.Code == value.ToString()), a => a.Id, b => b.ParentId, (a, b) => new
|
||||
{
|
||||
value = b.ValueCN
|
||||
}).Select(x => x.value).FirstOrDefaultAsync();
|
||||
@@ -463,7 +463,7 @@ namespace IRaCIS.Core.Application.Service
|
||||
{
|
||||
}
|
||||
}
|
||||
return JsonConvert.SerializeObject(JsonData);
|
||||
return JsonConvert.SerializeObject(jsonDataDic);
|
||||
}
|
||||
|
||||
|
||||
@@ -537,12 +537,12 @@ namespace IRaCIS.Core.Application.Service
|
||||
/// <summary>
|
||||
/// 获取子数据
|
||||
/// </summary>
|
||||
/// <param name="item"></param>
|
||||
/// <param name="frontAuditConfigId"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
public async Task<List<FrontAuditConfig>> GetChildrenItem(GetChildrenItem item)
|
||||
[HttpGet]
|
||||
public async Task<List<FrontAuditConfig>> GetAuditConfigChildList(Guid frontAuditConfigId)
|
||||
{
|
||||
var list =await (from data in _repository.GetQueryable<FrontAuditConfig>().Where(x => x.Id == item.Id)
|
||||
var list =await (from data in _repository.GetQueryable<FrontAuditConfig>().Where(x => x.Id == frontAuditConfigId)
|
||||
join childrenType in _repository.GetQueryable<FrontAuditConfig>() on data.Id equals childrenType.ParentId
|
||||
select childrenType).OrderBy(x=>x.Sort).ToListAsync();
|
||||
return list;
|
||||
@@ -556,12 +556,12 @@ namespace IRaCIS.Core.Application.Service
|
||||
[HttpPost]
|
||||
public async Task<IResponseOutput> FullyReplicated(FullyReplicated fully)
|
||||
{
|
||||
await _frontAuditConfigRepository.DeleteFromQueryAsync(x => x.ParentId == fully.ThisItemGuid);
|
||||
var list = await _frontAuditConfigRepository.Where(x => x.ParentId == fully.DataFromItemGuid).ToListAsync();
|
||||
await _frontAuditConfigRepository.DeleteFromQueryAsync(x => x.ParentId == fully.ToItemId);
|
||||
var list = await _frontAuditConfigRepository.Where(x => x.ParentId == fully.FromItemId).ToListAsync();
|
||||
list.ForEach(x =>
|
||||
{
|
||||
x.Id = NewId.NextGuid();
|
||||
x.ParentId = fully.ThisItemGuid;
|
||||
x.ParentId = fully.ToItemId;
|
||||
});
|
||||
await _frontAuditConfigRepository.AddRangeAsync(list);
|
||||
await _frontAuditConfigRepository.SaveChangesAsync();
|
||||
@@ -662,12 +662,12 @@ namespace IRaCIS.Core.Application.Service
|
||||
/// <summary>
|
||||
/// 获取Description
|
||||
/// </summary>
|
||||
/// <param name="dto"></param>
|
||||
/// <param name="moduleTypeId"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
public async Task<List<string>> GetDescriptionByModuleType(GetDescriptionByModuleTypeDto dto)
|
||||
[HttpGet]
|
||||
public async Task<List<string>> GetModuleTypeDescriptionList(Guid moduleTypeId)
|
||||
{
|
||||
var result= await _frontAuditConfigRepository.Where(x=>x.ModuleTypeId== dto.ModuleType&&x.Description!=null &&x.Description!=string.Empty).Select(x=>x.Description).Distinct().ToListAsync();
|
||||
var result= await _frontAuditConfigRepository.Where(x=>x.ModuleTypeId== moduleTypeId && x.Description!=string.Empty).Select(x=>x.Description).Distinct().ToListAsync();
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -756,11 +756,11 @@ namespace IRaCIS.Core.Application.Service
|
||||
/// <summary>
|
||||
/// 修改排序
|
||||
/// </summary>
|
||||
/// <param name="sortDto"></param>
|
||||
/// <param name="sortDataList"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<IResponseOutput> ChangeFrontAuditSort(ChangeFrontAuditSortDto sortDto)
|
||||
public async Task<IResponseOutput> ChangeFrontAuditSort(List<FrontAuditSort> sortDataList)
|
||||
{
|
||||
foreach (var item in sortDto.SortData)
|
||||
foreach (var item in sortDataList)
|
||||
{
|
||||
await _frontAuditConfigRepository.BatchUpdateNoTrackingAsync(x => x.Id == item.Id, x => new FrontAuditConfig
|
||||
{
|
||||
@@ -778,29 +778,18 @@ namespace IRaCIS.Core.Application.Service
|
||||
/// <returns></returns>
|
||||
public async Task<IResponseOutput> AddOrUpdateFrontAuditConfig(FrontAuditConfigAddOrEdit addOrEditFrontAuditConfig)
|
||||
{
|
||||
// 在此处拷贝automapper 映射
|
||||
|
||||
//CreateMap<FrontAuditConfig, FrontAuditConfigView>();
|
||||
|
||||
// CreateMap< FrontAuditConfig,FrontAuditConfigAddOrEdit>().ReverseMap();
|
||||
|
||||
|
||||
if (await _frontAuditConfigRepository.AnyAsync(x =>x.Identification!=string.Empty&& x.Identification == addOrEditFrontAuditConfig.Identification && x.Id != addOrEditFrontAuditConfig.Id&&x.ConfigType=="M"&& addOrEditFrontAuditConfig.ConfigType== "M"))
|
||||
{
|
||||
return ResponseOutput.NotOk("标识重复");
|
||||
}
|
||||
|
||||
|
||||
if (await _frontAuditConfigRepository.AnyAsync(x => x.Description == addOrEditFrontAuditConfig.Description && x.Id != addOrEditFrontAuditConfig.Id && x.ConfigType == "M" && addOrEditFrontAuditConfig.ConfigType == "M"))
|
||||
{
|
||||
return ResponseOutput.NotOk("名称重复");
|
||||
}
|
||||
|
||||
addOrEditFrontAuditConfig.CreateTime= DateTime.Now;
|
||||
addOrEditFrontAuditConfig.UpdateTime= DateTime.Now;
|
||||
addOrEditFrontAuditConfig.CreateUserId = _userInfo.Id;
|
||||
addOrEditFrontAuditConfig.UpdateUserId= _userInfo.Id;
|
||||
|
||||
var entity = await _repository.InsertOrUpdateAsync<FrontAuditConfig, FrontAuditConfigAddOrEdit>(addOrEditFrontAuditConfig, true);
|
||||
var entity = await _frontAuditConfigRepository.InsertOrUpdateAsync(addOrEditFrontAuditConfig, true);
|
||||
|
||||
return ResponseOutput.Ok(entity.Id.ToString());
|
||||
|
||||
|
||||
Reference in New Issue
Block a user