Compare commits
No commits in common. "deeffe034bb337e7095a1b3b8a627f8e754a5356" and "77eac6c1d0815f5888e10930788ce05e42ec7504" have entirely different histories.
deeffe034b
...
77eac6c1d0
|
|
@ -96,8 +96,6 @@ 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; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -112,10 +110,6 @@ 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
|
||||||
|
|
@ -125,9 +119,6 @@ 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, IRepository<PublishLog> _publishLogRepository, IStringLocalizer _localizer, IFusionCache _fusionCache) : BaseService, IInternationalizationService
|
IMapper _mapper, IUserInfo _userInfo, IStringLocalizer _localizer, IFusionCache _fusionCache) : BaseService, IInternationalizationService
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -45,11 +45,6 @@ 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));
|
||||||
|
|
@ -60,17 +55,15 @@ 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.InternationalizationType == item.InternationalizationType);
|
var find = await _internationalizationRepository.FirstOrDefaultAsync(t => t.Code == item.Code && t.Description == item.Description && t.InternationalizationType == 0);
|
||||||
|
|
||||||
if (find != null)
|
if (find != null)
|
||||||
{
|
{
|
||||||
|
|
@ -78,21 +71,13 @@ 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 = frontState;
|
mapItem.State = 0;
|
||||||
|
|
||||||
find = await _internationalizationRepository.AddAsync(mapItem);
|
await _internationalizationRepository.AddAsync(mapItem);
|
||||||
}
|
|
||||||
|
|
||||||
if (find.PublishLogId == null || find.PublishLogId == Guid.Empty)
|
|
||||||
{
|
|
||||||
find.PublishLogId = result.Id;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
await _internationalizationRepository.SaveChangesAsync();
|
await _internationalizationRepository.SaveChangesAsync();
|
||||||
|
|
@ -143,7 +128,6 @@ 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