国际化修改提交
parent
ba12a2977b
commit
39f579c10b
|
|
@ -96,6 +96,8 @@ namespace IRaCIS.Core.Application.ViewModel
|
||||||
|
|
||||||
public int State { get; set; }
|
public int State { get; set; }
|
||||||
|
|
||||||
|
public Guid? PublishLogId { get; set; }
|
||||||
|
|
||||||
public List<BatchAddInternationalizationDto> AddList { 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 string Module { get; set; } = string.Empty;
|
||||||
|
|
||||||
|
public int? State { get; set; }
|
||||||
|
|
||||||
|
public int InternationalizationType { get; set; }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public class BatchAddInternationalizationDto : BatchInternationalizationDto
|
public class BatchAddInternationalizationDto : BatchInternationalizationDto
|
||||||
|
|
@ -119,6 +125,9 @@ namespace IRaCIS.Core.Application.ViewModel
|
||||||
|
|
||||||
public class InternationalizationSimpleDto : BatchInternationalizationDto
|
public class InternationalizationSimpleDto : BatchInternationalizationDto
|
||||||
{
|
{
|
||||||
|
public string Version { get; set; }
|
||||||
|
|
||||||
|
public DateTime CreateTime { get; set; }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,7 @@ namespace IRaCIS.Core.Application.Service
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[ApiExplorerSettings(GroupName = "Common")]
|
[ApiExplorerSettings(GroupName = "Common")]
|
||||||
public class InternationalizationService(IRepository<Internationalization> _internationalizationRepository,
|
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,
|
ValueCN = t.ValueCN,
|
||||||
FrontType = t.FrontType,
|
FrontType = t.FrontType,
|
||||||
Description = t.Description,
|
Description = t.Description,
|
||||||
|
Module = t.Module,
|
||||||
|
State = t.State,
|
||||||
|
Version = t.PublishLog.Version,
|
||||||
|
CreateTime = t.CreateTime,
|
||||||
|
InternationalizationType = t.InternationalizationType
|
||||||
}).ToListAsync();
|
}).ToListAsync();
|
||||||
|
|
||||||
await _fusionCache.SetAsync<List<InternationalizationSimpleDto>>(CacheKeys.FrontInternational, list, TimeSpan.FromDays(1));
|
await _fusionCache.SetAsync<List<InternationalizationSimpleDto>>(CacheKeys.FrontInternational, list, TimeSpan.FromDays(1));
|
||||||
|
|
@ -55,15 +60,17 @@ namespace IRaCIS.Core.Application.Service
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 前端批量提交,后端判断不存在就添加,存在就更新
|
/// 前端批量提交,后端查询判断不存在就添加,存在就更新 (这里提交接口也能提交后端的标识,对后端标识进行更新)
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
[AllowAnonymous]
|
[AllowAnonymous]
|
||||||
public async Task<IResponseOutput> BatchAddOrUpdateFrontInternationalization(List<BatchInternationalizationDto> batchList)
|
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)
|
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)
|
if (find != null)
|
||||||
{
|
{
|
||||||
|
|
@ -71,13 +78,21 @@ namespace IRaCIS.Core.Application.Service
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
||||||
|
var frontState = item.State == null ? 0 : (int)item.State;
|
||||||
|
|
||||||
var mapItem = _mapper.Map<Internationalization>(item);
|
var mapItem = _mapper.Map<Internationalization>(item);
|
||||||
mapItem.InternationalizationType = 0;
|
//mapItem.InternationalizationType = 0;
|
||||||
|
|
||||||
// 0 是预翻译 1是已确认 2是后端废弃
|
// 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();
|
await _internationalizationRepository.SaveChangesAsync();
|
||||||
|
|
@ -128,6 +143,7 @@ namespace IRaCIS.Core.Application.Service
|
||||||
|
|
||||||
mapItem.InternationalizationType = batchAdd.InternationalizationType;
|
mapItem.InternationalizationType = batchAdd.InternationalizationType;
|
||||||
mapItem.State = batchAdd.State;
|
mapItem.State = batchAdd.State;
|
||||||
|
mapItem.PublishLogId = batchAdd.PublishLogId;
|
||||||
|
|
||||||
var verifyExp1 = new EntityVerifyExp<Internationalization>()
|
var verifyExp1 = new EntityVerifyExp<Internationalization>()
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue