修改字段类型
This commit is contained in:
parent
d6ea92bd20
commit
8ac687a9be
@ -47,5 +47,5 @@ public class UpdateTrackPullContentInput
|
||||
/// <summary>
|
||||
/// 轨迹时区GMT
|
||||
/// </summary>
|
||||
public string TrackTimeZone { get; set; }
|
||||
public double? TrackTimeZone { get; set; }
|
||||
}
|
||||
@ -57,5 +57,5 @@ public class EditTrackPushContentInput
|
||||
/// <summary>
|
||||
/// 轨迹时区GMT
|
||||
/// </summary>
|
||||
public string TrackTimeZone { get; set; }
|
||||
public double? TrackTimeZone { get; set; }
|
||||
}
|
||||
@ -100,83 +100,83 @@ public class TrackPullService : ApplicationService, ITransientDependency
|
||||
switch (input.Options)
|
||||
{
|
||||
case OptionTypeNoNull.新增:
|
||||
{
|
||||
var trackPullEntity = ObjectMapper.Map<EditTrackPullConfigInput, TrackPullConfigEntity>(input);
|
||||
var trackPullParamsEntity =
|
||||
ObjectMapper.Map<EditTrackPullConfigInput, TrackPushPullParamsConfigEntity>(input);
|
||||
|
||||
var trackTemplateContentEntities =
|
||||
await _trackTemplateRepository.GetContentListAsync(x => x.TrackTemplateId == input.TrackTemplateId);
|
||||
|
||||
var trackPullContentEntities = new List<TrackPullContentConfigEntity>();
|
||||
|
||||
using (var ts = TransactionScopeHelper.Create())
|
||||
{
|
||||
int id = await _trackPullConfigRepository.InsertReturnIdentityAsync(trackPullEntity);
|
||||
var trackPullEntity = ObjectMapper.Map<EditTrackPullConfigInput, TrackPullConfigEntity>(input);
|
||||
var trackPullParamsEntity =
|
||||
ObjectMapper.Map<EditTrackPullConfigInput, TrackPushPullParamsConfigEntity>(input);
|
||||
|
||||
trackPullParamsEntity.PullOrPushConfigId = id;
|
||||
await _trackPullConfigRepository.InsertParamsAsync(trackPullParamsEntity);
|
||||
var trackTemplateContentEntities =
|
||||
await _trackTemplateRepository.GetContentListAsync(x => x.TrackTemplateId == input.TrackTemplateId);
|
||||
|
||||
foreach (var item in trackTemplateContentEntities)
|
||||
var trackPullContentEntities = new List<TrackPullContentConfigEntity>();
|
||||
|
||||
using (var ts = TransactionScopeHelper.Create())
|
||||
{
|
||||
trackPullContentEntities.Add(new()
|
||||
int id = await _trackPullConfigRepository.InsertReturnIdentityAsync(trackPullEntity);
|
||||
|
||||
trackPullParamsEntity.PullOrPushConfigId = id;
|
||||
await _trackPullConfigRepository.InsertParamsAsync(trackPullParamsEntity);
|
||||
|
||||
foreach (var item in trackTemplateContentEntities)
|
||||
{
|
||||
TrackPullConfigId = id,
|
||||
TrackContentId = item.TrackContentId
|
||||
});
|
||||
trackPullContentEntities.Add(new()
|
||||
{
|
||||
TrackPullConfigId = id,
|
||||
TrackContentId = item.TrackContentId
|
||||
});
|
||||
}
|
||||
|
||||
await _trackPullConfigRepository.InsertContentRangeAsync(trackPullContentEntities);
|
||||
|
||||
ts.Complete();
|
||||
}
|
||||
|
||||
await _trackPullConfigRepository.InsertContentRangeAsync(trackPullContentEntities);
|
||||
|
||||
ts.Complete();
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case OptionTypeNoNull.修改:
|
||||
{
|
||||
var oldTrackPullEntity = await _trackPullConfigRepository.GetFirstAsync(x => x.Id == input.Id) ??
|
||||
throw new BusinessException(message: _stringLocalizer["NotFindData"]);
|
||||
|
||||
var oldTrackPullParamsEntity =
|
||||
await _trackPullConfigRepository.GetParamsSingleAsync(x =>
|
||||
x.PullOrPushConfigId == input.Id && !x.IsPush);
|
||||
|
||||
var trackPullContentEntities = new List<TrackPullContentConfigEntity>();
|
||||
|
||||
if (oldTrackPullEntity.TrackTemplateId != input.TrackTemplateId)
|
||||
{
|
||||
var trackTemplateContentEntities =
|
||||
await _trackTemplateRepository.GetContentListAsync(x =>
|
||||
x.TrackTemplateId == input.TrackTemplateId);
|
||||
var oldTrackPullEntity = await _trackPullConfigRepository.GetFirstAsync(x => x.Id == input.Id) ??
|
||||
throw new BusinessException(message: _stringLocalizer["NotFindData"]);
|
||||
|
||||
foreach (var item in trackTemplateContentEntities)
|
||||
{
|
||||
trackPullContentEntities.Add(new()
|
||||
{
|
||||
TrackPullConfigId = oldTrackPullEntity.Id,
|
||||
TrackContentId = item.TrackContentId
|
||||
});
|
||||
}
|
||||
}
|
||||
var oldTrackPullParamsEntity =
|
||||
await _trackPullConfigRepository.GetParamsSingleAsync(x =>
|
||||
x.PullOrPushConfigId == input.Id && !x.IsPush);
|
||||
|
||||
ObjectMapper.Map(input, oldTrackPullEntity);
|
||||
ObjectMapper.Map(input, oldTrackPullParamsEntity);
|
||||
|
||||
using (var ts = TransactionScopeHelper.Create())
|
||||
{
|
||||
await _trackPullConfigRepository.UpdateAsync(oldTrackPullEntity);
|
||||
await _trackPullConfigRepository.UpdateParamsAsync(oldTrackPullParamsEntity);
|
||||
var trackPullContentEntities = new List<TrackPullContentConfigEntity>();
|
||||
|
||||
if (oldTrackPullEntity.TrackTemplateId != input.TrackTemplateId)
|
||||
{
|
||||
await _trackPullConfigRepository.SoftDeleteContentAsync(x => x.TrackPullConfigId == input.Id);
|
||||
await _trackPullConfigRepository.InsertContentRangeAsync(trackPullContentEntities);
|
||||
var trackTemplateContentEntities =
|
||||
await _trackTemplateRepository.GetContentListAsync(x =>
|
||||
x.TrackTemplateId == input.TrackTemplateId);
|
||||
|
||||
foreach (var item in trackTemplateContentEntities)
|
||||
{
|
||||
trackPullContentEntities.Add(new()
|
||||
{
|
||||
TrackPullConfigId = oldTrackPullEntity.Id,
|
||||
TrackContentId = item.TrackContentId
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
ts.Complete();
|
||||
ObjectMapper.Map(input, oldTrackPullEntity);
|
||||
ObjectMapper.Map(input, oldTrackPullParamsEntity);
|
||||
|
||||
using (var ts = TransactionScopeHelper.Create())
|
||||
{
|
||||
await _trackPullConfigRepository.UpdateAsync(oldTrackPullEntity);
|
||||
await _trackPullConfigRepository.UpdateParamsAsync(oldTrackPullParamsEntity);
|
||||
|
||||
if (oldTrackPullEntity.TrackTemplateId != input.TrackTemplateId)
|
||||
{
|
||||
await _trackPullConfigRepository.SoftDeleteContentAsync(x => x.TrackPullConfigId == input.Id);
|
||||
await _trackPullConfigRepository.InsertContentRangeAsync(trackPullContentEntities);
|
||||
}
|
||||
|
||||
ts.Complete();
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case OptionTypeNoNull.删除:
|
||||
|
||||
@ -1,9 +1,6 @@
|
||||
using AutoMapper.Internal.Mappers;
|
||||
using Microsoft.Extensions.Localization;
|
||||
using Nito.AsyncEx;
|
||||
using Microsoft.Extensions.Localization;
|
||||
using SJZY.Expand.ABP.Core.Localization;
|
||||
using SJZY.Expand.ABP.Core.PublicMethords;
|
||||
using SJZY.Track.Application.Contract.Dtos.TrackPull;
|
||||
using SJZY.Track.Application.Contract.Dtos.TrackPush;
|
||||
using SJZY.Track.Application.Localization;
|
||||
using SJZY.Track.Domain.Aggregates.TrackPullAggregate;
|
||||
|
||||
@ -64,5 +64,5 @@ public class TrackPullContentConfigEntity : IFullAuditedBasicEntitys, IEntity
|
||||
/// 轨迹时区GMT
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnName = "TrackTimeZone")]
|
||||
public string TrackTimeZone { get; set; }
|
||||
public double? TrackTimeZone { get; set; }
|
||||
}
|
||||
@ -70,5 +70,5 @@ public class TrackPushContentConfigEntity : IFullAuditedBasicEntitys, IEntity
|
||||
/// 轨迹时区GMT
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnName = "TrackTimeZone")]
|
||||
public string TrackTimeZone { get; set; }
|
||||
public double? TrackTimeZone { get; set; }
|
||||
}
|
||||
@ -52,5 +52,5 @@ public class GetTrackPullContentDetailOutputVO
|
||||
/// <summary>
|
||||
/// 拉取轨迹时区
|
||||
/// </summary>
|
||||
public string TrackTimeZone { get; set; }
|
||||
public double? TrackTimeZone { get; set; }
|
||||
}
|
||||
@ -57,5 +57,5 @@ public class GetTrackPushContentDetailOutputVO
|
||||
/// <summary>
|
||||
/// 推送轨迹时区
|
||||
/// </summary>
|
||||
public string TrackTimeZone { get; set; }
|
||||
public double? TrackTimeZone { get; set; }
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user