轨迹状态
This commit is contained in:
parent
6596a26def
commit
8791f12423
@ -0,0 +1,31 @@
|
|||||||
|
using AutoMapper;
|
||||||
|
using AutoMapper.Internal.Mappers;
|
||||||
|
using SJZY.Track.Application.Dtos.Demo;
|
||||||
|
using SJZY.Track.Application.Dtos.TrackStatus;
|
||||||
|
using SJZY.Track.Domain.Aggregates.TrackStatusAggregate;
|
||||||
|
using SJZY.Track.Domain.Dtos.TrackStatus;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using Volo.Abp.ObjectMapping;
|
||||||
|
|
||||||
|
namespace SJZY.Track.Application.AutoMapper
|
||||||
|
{
|
||||||
|
public class TrackStatusAutoMapperProfile : Profile
|
||||||
|
{
|
||||||
|
public TrackStatusAutoMapperProfile()
|
||||||
|
{
|
||||||
|
CreateMap<EditTrackStatusInput, TrackStatusEntity>(MemberList.None)
|
||||||
|
//层级不一致的场景
|
||||||
|
.ForMember(dest => dest.Status, opt => opt.MapFrom(source => source.TrackStatus))
|
||||||
|
.ForMember(dest => dest.EnStatus, opt => opt.MapFrom(source => source.EntrackStatus))
|
||||||
|
.ForMember(dest => dest.Node, opt => opt.MapFrom(source => source.NodeId));
|
||||||
|
CreateMap<GetTrackStatusDetailVO, GetTrackStatusDetailDto>(MemberList.None);
|
||||||
|
CreateMap<GetPageTrackStatusInput, GetPageTrackStatusVO>(MemberList.None);
|
||||||
|
CreateMap<GetTrackStatusListVO, GetTrackStatusListDto>(MemberList.None);
|
||||||
|
CreateMap<UnifyPageResultDto<GetTrackStatusListVO>, UnifyPageResultDto<GetTrackStatusListDto>>(MemberList.None);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -5,7 +5,7 @@
|
|||||||
"NotFindData": "No data found under the specified number",
|
"NotFindData": "No data found under the specified number",
|
||||||
"ParameterDemo1": "{0} in {1} to do {2}",
|
"ParameterDemo1": "{0} in {1} to do {2}",
|
||||||
"TemplateExist": "The template code already exists under the currently selected subsystem",
|
"TemplateExist": "The template code already exists under the currently selected subsystem",
|
||||||
"TrackContentExist": "The trace code or trace content or trace content in the current subsystem is repeated in English"
|
"TrackContentExist": "The trace code or trace content or trace content in the current subsystem is repeated in English",
|
||||||
|
"TrackStatusExist": "The trajectory status code or trajectory status or trajectory status in English is repeated under the current subsystem"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -5,6 +5,7 @@
|
|||||||
"ParameterDemo": "{0}在{1}地方做了{2}动作",
|
"ParameterDemo": "{0}在{1}地方做了{2}动作",
|
||||||
"ParameterDemo1": "{0}在{1}地方做了{2}动作",
|
"ParameterDemo1": "{0}在{1}地方做了{2}动作",
|
||||||
"TemplateExist": "模板代码已存在于当前选择的子系统下",
|
"TemplateExist": "模板代码已存在于当前选择的子系统下",
|
||||||
"TrackContentExist": "当前子系统下轨迹代码或轨迹内容或轨迹内容英文重复"
|
"TrackContentExist": "当前子系统下轨迹代码或轨迹内容或轨迹内容英文重复",
|
||||||
|
"TrackStatusExist": "当前子系统下轨迹状态代码或轨迹状态或轨迹状态英文重复"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1,4 +1,6 @@
|
|||||||
using SJZY.Track.Application.Dtos.TrackStatus;
|
using Microsoft.Extensions.Localization;
|
||||||
|
using SJZY.Track.Application.Dtos.TrackStatus;
|
||||||
|
using SJZY.Track.Application.Localization;
|
||||||
using SJZY.Track.Domain.Aggregates.TrackStatusAggregate;
|
using SJZY.Track.Domain.Aggregates.TrackStatusAggregate;
|
||||||
using SJZY.Track.Domain.Dtos.TrackStatus;
|
using SJZY.Track.Domain.Dtos.TrackStatus;
|
||||||
using Volo.Abp.DependencyInjection;
|
using Volo.Abp.DependencyInjection;
|
||||||
@ -12,12 +14,15 @@ namespace SJZY.Track.Application.Services.TrackStatus;
|
|||||||
[Route("/Track/Status")]
|
[Route("/Track/Status")]
|
||||||
public class TrackStatusService : ApplicationService, ITransientDependency
|
public class TrackStatusService : ApplicationService, ITransientDependency
|
||||||
{
|
{
|
||||||
|
private readonly IStringLocalizer<TrackLocalizationResource> _stringLocalizer;
|
||||||
private readonly ITrackStatusRepository _trackStatusRepository;
|
private readonly ITrackStatusRepository _trackStatusRepository;
|
||||||
|
|
||||||
public TrackStatusService(
|
public TrackStatusService(
|
||||||
|
IStringLocalizer<TrackLocalizationResource> stringLocalizer,
|
||||||
ITrackStatusRepository trackStatusRepository
|
ITrackStatusRepository trackStatusRepository
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
|
this._stringLocalizer=stringLocalizer;
|
||||||
this._trackStatusRepository = trackStatusRepository;
|
this._trackStatusRepository = trackStatusRepository;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -73,9 +78,17 @@ public class TrackStatusService : ApplicationService, ITransientDependency
|
|||||||
}
|
}
|
||||||
|
|
||||||
#region 私有方法
|
#region 私有方法
|
||||||
|
|
||||||
private async Task<UnifyResultDto> AddAsync(EditTrackStatusInput input)
|
private async Task<UnifyResultDto> AddAsync(EditTrackStatusInput input)
|
||||||
{
|
{
|
||||||
|
#region 业务校验
|
||||||
|
var trackStatusEntity = await _trackStatusRepository.GetFirstAsync(a => a.SubSystemId==input.SubSystemId&& (a.Code==input.Code ||
|
||||||
|
a.Status==input.TrackStatus || a.EnStatus==input.EntrackStatus));
|
||||||
|
if (trackStatusEntity!=null)
|
||||||
|
{
|
||||||
|
throw new BusinessException(message: _stringLocalizer["TrackStatusExist"]);
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
var entity = ObjectMapper.Map<EditTrackStatusInput, TrackStatusEntity>(input);
|
var entity = ObjectMapper.Map<EditTrackStatusInput, TrackStatusEntity>(input);
|
||||||
var isTrue = await _trackStatusRepository.InsertAsync(entity);
|
var isTrue = await _trackStatusRepository.InsertAsync(entity);
|
||||||
|
|
||||||
@ -84,6 +97,15 @@ public class TrackStatusService : ApplicationService, ITransientDependency
|
|||||||
|
|
||||||
private async Task<UnifyResultDto> UpdateAsync(EditTrackStatusInput input)
|
private async Task<UnifyResultDto> UpdateAsync(EditTrackStatusInput input)
|
||||||
{
|
{
|
||||||
|
#region 业务校验
|
||||||
|
var trackStatusEntity = await _trackStatusRepository.GetFirstAsync(a => a.Id !=input.Id && a.SubSystemId==input.SubSystemId&& (a.Code==input.Code ||
|
||||||
|
a.Status==input.TrackStatus || a.EnStatus==input.EntrackStatus));
|
||||||
|
if (trackStatusEntity!=null)
|
||||||
|
{
|
||||||
|
throw new BusinessException(message: _stringLocalizer["TrackStatusExist"]);
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
var templateEntity = await _trackStatusRepository.GetFirstAsync(a => a.Id == input.Id);
|
var templateEntity = await _trackStatusRepository.GetFirstAsync(a => a.Id == input.Id);
|
||||||
ObjectMapper.Map(input, templateEntity);
|
ObjectMapper.Map(input, templateEntity);
|
||||||
var isTrue = await _trackStatusRepository.UpdateAsync(templateEntity);
|
var isTrue = await _trackStatusRepository.UpdateAsync(templateEntity);
|
||||||
@ -97,6 +119,5 @@ public class TrackStatusService : ApplicationService, ITransientDependency
|
|||||||
|
|
||||||
return new UnifyResultDto("200", "删除成功", isTrue);
|
return new UnifyResultDto("200", "删除成功", isTrue);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
@ -11,7 +11,7 @@ public class TrackStatusRepository : BasicRepository<TrackStatusEntity>, ITrackS
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 获取轨迹模版明细
|
/// 获取轨迹状态明细
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="id"></param>
|
/// <param name="id"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
@ -56,7 +56,10 @@ public class TrackStatusRepository : BasicRepository<TrackStatusEntity>, ITrackS
|
|||||||
Code = a.Code,
|
Code = a.Code,
|
||||||
EntrackStatus = a.EnStatus,
|
EntrackStatus = a.EnStatus,
|
||||||
TrackStatus = a.Status,
|
TrackStatus = a.Status,
|
||||||
Node = "",
|
NodeId = a.Node,
|
||||||
|
Node = SqlFunc.IF(a.Node == 1).Return("揽收").ElseIF(a.Node == 2).Return("干线").ElseIF(a.Node == 3).Return("清关")
|
||||||
|
.ElseIF(a.Node == 4).Return("中转").ElseIF(a.Node == 5).Return("派送")
|
||||||
|
.End(""),
|
||||||
CreateTime = a.CreateTime,
|
CreateTime = a.CreateTime,
|
||||||
CreateUser = c.Name,
|
CreateUser = c.Name,
|
||||||
UpdateTime = a.UpdateTime,
|
UpdateTime = a.UpdateTime,
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user