修改稽查

This commit is contained in:
2022-08-25 14:19:57 +08:00
parent 5a046da4d0
commit 7c08e7606c
5 changed files with 130 additions and 98 deletions
@@ -195,7 +195,7 @@ namespace IRaCIS.Core.Application.Service
var currentInspection = await _dataInspectionRepository.Where(t => t.Id == id).Select(t => new { t.GeneralId, t.ObjectRelationParentId, t.CreateTime }).FirstOrDefaultAsync();
var beforeId = await _dataInspectionRepository.Where(x => x.GeneralId == currentInspection.GeneralId && x.ObjectRelationParentId == currentInspection.ObjectRelationParentId && x.CreateTime <= currentInspection.CreateTime && x.Id != id).OrderByDescending(x => x.CreateTime).Select(t => t.Id)
var beforeId = await _dataInspectionRepository.Where(x => x.GeneralId == currentInspection.GeneralId /*&& x.ObjectRelationParentId == currentInspection.ObjectRelationParentId*/ && x.CreateTime <= currentInspection.CreateTime && x.Id != id).OrderByDescending(x => x.CreateTime).Select(t => t.Id)
.FirstOrDefaultAsync();
List<Guid> searchGuidList = new List<Guid>() { id };
@@ -245,7 +245,7 @@ namespace IRaCIS.Core.Application.Service
var objectLsit = new List<object>();
var commonDataObjList = await GetRelationParentData(item.ObjectRelationParentId, item.ObjectRelationParentId2, item.CreateTime, item.BatchId, objectLsit);
var commonDataObjList = await GetRelationParentData( item.Id,item.ObjectRelationParentId, item.ObjectRelationParentId2, item.CreateTime, item.BatchId, objectLsit);
var currentDic = JsonConvert.DeserializeObject<IDictionary<string, object>>(jsonDict[nameof(InspectionJsonDetail.CommonData)].ToJsonStr());
@@ -347,12 +347,12 @@ namespace IRaCIS.Core.Application.Service
private async Task AddJsonObjectToDic(Guid? objectRelationParentId, DateTime createTime, Guid batchId, List<object> objectLsit)
private async Task AddJsonObjectToDic(Guid id, Guid? objectRelationParentId, DateTime createTime, Guid batchId, List<object> objectLsit)
{
if (objectRelationParentId != null)
{
//父子层级的数据可能在同一个批次 进行更新 但是后插入的是父层级的数据 找父层级的稽查应该优先同一批次的
var relationParentInspection = await _dataInspectionRepository.Where(t => t.GeneralId == objectRelationParentId && (t.CreateTime <= createTime || t.BatchId == batchId)).OrderByDescending(x => x.CreateTime).Select(t => new { t.ObjectRelationParentId, t.CreateTime, t.JsonDetail, t.BatchId, t.ObjectRelationParentId2, t.EntityName }).FirstOrDefaultAsync();
var relationParentInspection = await _dataInspectionRepository.Where(t => t.GeneralId == objectRelationParentId && (t.CreateTime <= createTime || t.BatchId == batchId) && t.Id !=id).OrderByDescending(x => x.CreateTime).Select(t => new { t.ObjectRelationParentId, t.CreateTime, t.JsonDetail, t.BatchId, t.ObjectRelationParentId2, t.EntityName ,t.Id}).FirstOrDefaultAsync();
if (relationParentInspection != null)
@@ -386,8 +386,8 @@ namespace IRaCIS.Core.Application.Service
await AddJsonObjectToDic(relationParentInspection.ObjectRelationParentId, relationParentInspection.CreateTime, relationParentInspection.BatchId, objectLsit);
await AddJsonObjectToDic( relationParentInspection.ObjectRelationParentId2, relationParentInspection.CreateTime, relationParentInspection.BatchId, objectLsit);
await AddJsonObjectToDic(relationParentInspection.Id, relationParentInspection.ObjectRelationParentId, relationParentInspection.CreateTime, relationParentInspection.BatchId, objectLsit);
await AddJsonObjectToDic(relationParentInspection.Id, relationParentInspection.ObjectRelationParentId2, relationParentInspection.CreateTime, relationParentInspection.BatchId, objectLsit);
}
else
@@ -405,10 +405,10 @@ namespace IRaCIS.Core.Application.Service
private async Task<List<object>> GetRelationParentData(Guid? objectRelationParentId, Guid? objectRelationParentId2, DateTime createTime, Guid batchId, List<object> objectLsit)
private async Task<List<object>> GetRelationParentData(Guid id,Guid? objectRelationParentId, Guid? objectRelationParentId2, DateTime createTime, Guid batchId, List<object> objectLsit)
{
await AddJsonObjectToDic(objectRelationParentId, createTime, batchId, objectLsit);
await AddJsonObjectToDic(objectRelationParentId2, createTime, batchId, objectLsit);
await AddJsonObjectToDic(id,objectRelationParentId, createTime, batchId, objectLsit);
await AddJsonObjectToDic(id,objectRelationParentId2, createTime, batchId, objectLsit);
#region
//if (objectRelationParentId != null)
@@ -121,7 +121,16 @@ namespace IRaCIS.Application.Services
}
await _enrollReadingCategoryRepository.BatchDeleteNoTrackingAsync(x => x.EnrollId == inDto.EnrollId);
if (inDto.ReadingCategorys.Count > 0)
{
await _enrollReadingCategoryRepository.BatchDeleteNoTrackingAsync(x => x.EnrollId == inDto.EnrollId);
}
else
{
await _enrollReadingCategoryRepository.DeleteFromQueryAsync(x => x.EnrollId == inDto.EnrollId);
}
List<EnrollReadingCategory> enrollReadings = inDto.ReadingCategorys.Select(x => new EnrollReadingCategory()
{