Merge branch 'Test_HIR_Net8' of https://gitea.frp.extimaging.com/XCKJ/irc-netcore-api into Test_HIR_Net8
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
commit
a8a1198c52
|
|
@ -96,6 +96,8 @@ namespace IRaCIS.Core.Application.ViewModel
|
|||
|
||||
public int State { get; set; }
|
||||
|
||||
public Guid? PublishLogId { get; set; }
|
||||
|
||||
public List<BatchAddInternationalizationDto> AddList { get; set; }
|
||||
}
|
||||
|
||||
|
|
@ -110,6 +112,10 @@ namespace IRaCIS.Core.Application.ViewModel
|
|||
|
||||
public string Module { get; set; } = string.Empty;
|
||||
|
||||
public int? State { get; set; }
|
||||
|
||||
public int InternationalizationType { get; set; }
|
||||
|
||||
}
|
||||
|
||||
public class BatchAddInternationalizationDto : BatchInternationalizationDto
|
||||
|
|
@ -119,6 +125,9 @@ namespace IRaCIS.Core.Application.ViewModel
|
|||
|
||||
public class InternationalizationSimpleDto : BatchInternationalizationDto
|
||||
{
|
||||
public string Version { get; set; }
|
||||
|
||||
public DateTime CreateTime { get; set; }
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ namespace IRaCIS.Core.Application.Service
|
|||
/// </summary>
|
||||
[ApiExplorerSettings(GroupName = "Common")]
|
||||
public class InternationalizationService(IRepository<Internationalization> _internationalizationRepository,
|
||||
IMapper _mapper, IUserInfo _userInfo, IStringLocalizer _localizer, IFusionCache _fusionCache) : BaseService, IInternationalizationService
|
||||
IMapper _mapper, IRepository<PublishLog> _publishLogRepository, IStringLocalizer _localizer, IFusionCache _fusionCache) : BaseService, IInternationalizationService
|
||||
{
|
||||
|
||||
|
||||
|
|
@ -45,6 +45,11 @@ namespace IRaCIS.Core.Application.Service
|
|||
ValueCN = t.ValueCN,
|
||||
FrontType = t.FrontType,
|
||||
Description = t.Description,
|
||||
Module = t.Module,
|
||||
State = t.State,
|
||||
Version = t.PublishLog.Version,
|
||||
CreateTime = t.CreateTime,
|
||||
InternationalizationType = t.InternationalizationType
|
||||
}).ToListAsync();
|
||||
|
||||
await _fusionCache.SetAsync<List<InternationalizationSimpleDto>>(CacheKeys.FrontInternational, list, TimeSpan.FromDays(1));
|
||||
|
|
@ -55,15 +60,17 @@ namespace IRaCIS.Core.Application.Service
|
|||
}
|
||||
|
||||
/// <summary>
|
||||
/// 前端批量提交,后端判断不存在就添加,存在就更新
|
||||
/// 前端批量提交,后端查询判断不存在就添加,存在就更新 (这里提交接口也能提交后端的标识,对后端标识进行更新)
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[AllowAnonymous]
|
||||
public async Task<IResponseOutput> BatchAddOrUpdateFrontInternationalization(List<BatchInternationalizationDto> batchList)
|
||||
{
|
||||
var result = (await _publishLogRepository.Where(t => t.IsCurrentVersion == true).ProjectTo<PublishLogView>(_mapper.ConfigurationProvider).FirstOrDefaultAsync()).IfNullThrowException();
|
||||
|
||||
foreach (var item in batchList)
|
||||
{
|
||||
var find = await _internationalizationRepository.FirstOrDefaultAsync(t => t.Code == item.Code && t.Description == item.Description && t.InternationalizationType == 0);
|
||||
var find = await _internationalizationRepository.FirstOrDefaultAsync(t => t.Code == item.Code && t.InternationalizationType == item.InternationalizationType);
|
||||
|
||||
if (find != null)
|
||||
{
|
||||
|
|
@ -71,13 +78,21 @@ namespace IRaCIS.Core.Application.Service
|
|||
}
|
||||
else
|
||||
{
|
||||
|
||||
var frontState = item.State == null ? 0 : (int)item.State;
|
||||
|
||||
var mapItem = _mapper.Map<Internationalization>(item);
|
||||
mapItem.InternationalizationType = 0;
|
||||
//mapItem.InternationalizationType = 0;
|
||||
|
||||
// 0 是预翻译 1是已确认 2是后端废弃
|
||||
mapItem.State = 0;
|
||||
mapItem.State = frontState;
|
||||
|
||||
await _internationalizationRepository.AddAsync(mapItem);
|
||||
find = await _internationalizationRepository.AddAsync(mapItem);
|
||||
}
|
||||
|
||||
if (find.PublishLogId == null || find.PublishLogId == Guid.Empty)
|
||||
{
|
||||
find.PublishLogId = result.Id;
|
||||
}
|
||||
}
|
||||
await _internationalizationRepository.SaveChangesAsync();
|
||||
|
|
@ -128,6 +143,7 @@ namespace IRaCIS.Core.Application.Service
|
|||
|
||||
mapItem.InternationalizationType = batchAdd.InternationalizationType;
|
||||
mapItem.State = batchAdd.State;
|
||||
mapItem.PublishLogId = batchAdd.PublishLogId;
|
||||
|
||||
var verifyExp1 = new EntityVerifyExp<Internationalization>()
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in New Issue