chore 优化代码
This commit is contained in:
		| @ -25,4 +25,4 @@ public class AdminApplicationContractsModule : AbpModule | ||||
|     { | ||||
|         AdminDtoExtensions.Configure(); | ||||
|     } | ||||
| } | ||||
| } | ||||
| @ -1,28 +1,26 @@ | ||||
| using Volo.Abp.Identity; | ||||
| using Volo.Abp.ObjectExtending; | ||||
| using Volo.Abp.Threading; | ||||
| using Volo.Abp.Threading; | ||||
|  | ||||
| namespace KonSoft.Admin; | ||||
|  | ||||
| public static class AdminDtoExtensions | ||||
| { | ||||
|     private static readonly OneTimeRunner OneTimeRunner = new OneTimeRunner(); | ||||
|     private static readonly OneTimeRunner OneTimeRunner = new(); | ||||
|  | ||||
|     public static void Configure() | ||||
|     { | ||||
|         OneTimeRunner.Run(() => | ||||
|         { | ||||
|                 /* You can add extension properties to DTOs | ||||
|                  * defined in the depended modules. | ||||
|                  * | ||||
|                  * Example: | ||||
|                  * | ||||
|                  * ObjectExtensionManager.Instance | ||||
|                  *   .AddOrUpdateProperty<IdentityRoleDto, string>("Title"); | ||||
|                  * | ||||
|                  * See the documentation for more: | ||||
|                  * https://docs.abp.io/en/abp/latest/Object-Extensions | ||||
|                  */ | ||||
|             /* You can add extension properties to DTOs | ||||
|              * defined in the depended modules. | ||||
|              * | ||||
|              * Example: | ||||
|              * | ||||
|              * ObjectExtensionManager.Instance | ||||
|              *   .AddOrUpdateProperty<IdentityRoleDto, string>("Title"); | ||||
|              * | ||||
|              * See the documentation for more: | ||||
|              * https://docs.abp.io/en/abp/latest/Object-Extensions | ||||
|              */ | ||||
|         }); | ||||
|     } | ||||
| } | ||||
| } | ||||
| @ -1,17 +1,10 @@ | ||||
| using System; | ||||
| using System.Collections.Generic; | ||||
| using System.Linq; | ||||
| using System.Text; | ||||
| using System.Threading.Tasks; | ||||
| namespace KonSoft.Admin.Dtos; | ||||
|  | ||||
| namespace KonSoft.Admin.Dtos | ||||
| public class AddressDto | ||||
| { | ||||
|     public class AddressDto | ||||
|     { | ||||
|         public string ContactName { get; set; } | ||||
|         public string ContactPhone { get; set; } | ||||
|         public string DetailAddress { get; set; } | ||||
|         public string City { get; set; } | ||||
|         public string District { get; set; } | ||||
|     } | ||||
| } | ||||
|     public string ContactName { get; set; } | ||||
|     public string ContactPhone { get; set; } | ||||
|     public string DetailAddress { get; set; } | ||||
|     public string City { get; set; } | ||||
|     public string District { get; set; } | ||||
| } | ||||
| @ -1,25 +1,19 @@ | ||||
| using System; | ||||
| using System.Collections.Generic; | ||||
| using System.ComponentModel.DataAnnotations; | ||||
| using System.Linq; | ||||
| using System.Text; | ||||
| using System.Threading.Tasks; | ||||
|  | ||||
| namespace KonSoft.Admin.Dtos | ||||
| namespace KonSoft.Admin.Dtos; | ||||
|  | ||||
| public class CreateOrderDto | ||||
| { | ||||
|     public class CreateOrderDto | ||||
|     { | ||||
|         [Required] | ||||
|         public Guid CustomerId { get; set; } | ||||
|         [Required] | ||||
|         public Guid ServiceCategoryId { get; set; } | ||||
|         [Required] | ||||
|         public DateTime ServiceTime { get; set; } | ||||
|         [Required] | ||||
|         public decimal Amount { get; set; } | ||||
|         [Required] | ||||
|         public AddressDto Address { get; set; } | ||||
|     [Required] public Guid CustomerId { get; set; } | ||||
|  | ||||
|         public string Remark { get; set; } | ||||
|     } | ||||
| } | ||||
|     [Required] public Guid ServiceCategoryId { get; set; } | ||||
|  | ||||
|     [Required] public DateTime ServiceTime { get; set; } | ||||
|  | ||||
|     [Required] public decimal Amount { get; set; } | ||||
|  | ||||
|     [Required] public AddressDto Address { get; set; } | ||||
|  | ||||
|     public string Remark { get; set; } | ||||
| } | ||||
| @ -1,14 +1,9 @@ | ||||
| using System; | ||||
| using System.Collections.Generic; | ||||
| using System.Linq; | ||||
| using System.Text; | ||||
| using System.Threading.Tasks; | ||||
|  | ||||
| namespace KonSoft.Admin.Dtos | ||||
| namespace KonSoft.Admin.Dtos; | ||||
|  | ||||
| public class CreateServiceCategoryDto | ||||
| { | ||||
|     public class CreateServiceCategoryDto | ||||
|     { | ||||
|         public string Name { get; set; } | ||||
|         public Guid? ParentId { get; set; } | ||||
|     } | ||||
| } | ||||
|     public string Name { get; set; } | ||||
|     public Guid? ParentId { get; set; } | ||||
| } | ||||
| @ -1,26 +1,20 @@ | ||||
| using KonSoft.Admin.Enums; | ||||
| using System; | ||||
| using System.Collections.Generic; | ||||
| using System.Linq; | ||||
| using System.Text; | ||||
| using System.Threading.Tasks; | ||||
| using Volo.Abp.Application.Dtos; | ||||
| using System; | ||||
| using KonSoft.Admin.Enums; | ||||
|  | ||||
| namespace KonSoft.Admin.Dtos | ||||
| namespace KonSoft.Admin.Dtos; | ||||
|  | ||||
| public class OrderDto | ||||
| { | ||||
|     public class OrderDto | ||||
|     { | ||||
|         public Guid Id { get; set; } | ||||
|         public string OrderSN { get; set; } | ||||
|         public Guid CustomerId { get; set; } | ||||
|         public Guid? WorkerId { get; set; } | ||||
|         public ServiceCategoryDto? ServiceCategory { get; set; } | ||||
|         public DateTime ServiceTime { get; set; } | ||||
|         public OrderStatus Status { get; set; } | ||||
|         public decimal Amount { get; set; } | ||||
|         public decimal PaidAmount { get; set; } | ||||
|         public string PaymentMethod { get; set; } | ||||
|         public AddressDto Address { get; set; } | ||||
|         public string Remark { get; set; } | ||||
|     } | ||||
| } | ||||
|     public Guid Id { get; set; } | ||||
|     public string OrderSN { get; set; } | ||||
|     public Guid CustomerId { get; set; } | ||||
|     public Guid? WorkerId { get; set; } | ||||
|     public ServiceCategoryDto? ServiceCategory { get; set; } | ||||
|     public DateTime ServiceTime { get; set; } | ||||
|     public OrderStatus Status { get; set; } | ||||
|     public decimal Amount { get; set; } | ||||
|     public decimal PaidAmount { get; set; } | ||||
|     public string PaymentMethod { get; set; } | ||||
|     public AddressDto Address { get; set; } | ||||
|     public string Remark { get; set; } | ||||
| } | ||||
| @ -1,12 +1,5 @@ | ||||
| using System; | ||||
| using System.Collections.Generic; | ||||
| using System.Linq; | ||||
| using System.Text; | ||||
| using System.Threading.Tasks; | ||||
| namespace KonSoft.Admin.Dtos; | ||||
|  | ||||
| namespace KonSoft.Admin.Dtos | ||||
| public class PayOrderDto | ||||
| { | ||||
|     public class PayOrderDto | ||||
|     { | ||||
|     } | ||||
| } | ||||
| } | ||||
| @ -1,66 +1,60 @@ | ||||
|  | ||||
| using System; | ||||
| using System; | ||||
| using System.Collections.Generic; | ||||
| using System.Diagnostics; | ||||
| using System.Linq; | ||||
| using System.Text; | ||||
| using System.Threading.Tasks; | ||||
| using System.Xml.Linq; | ||||
|  | ||||
| namespace KonSoft.Admin.Dtos | ||||
| namespace KonSoft.Admin.Dtos; | ||||
|  | ||||
| public class ProductDto : CreateProductDto | ||||
| { | ||||
|     public class ProductDto: CreateProductDto | ||||
|     { | ||||
|         /// <summary> | ||||
|         /// 嵌套子类 | ||||
|         /// </summary> | ||||
|         public List<CreateProductDto> Children { get; set; } = new(); | ||||
|     } | ||||
|  | ||||
|     public class CreateProductDto | ||||
|     { | ||||
|         /// <summary> | ||||
|         /// 分类名称 | ||||
|         /// </summary> | ||||
|         public string Name { get; private set; } | ||||
|  | ||||
|         /// <summary> | ||||
|         /// 商品编码 | ||||
|         /// </summary> | ||||
|         public string Code { get; private set; } | ||||
|         /// <summary> | ||||
|         /// 商品价格 | ||||
|         /// </summary> | ||||
|         public decimal Price { get; private set; }  | ||||
|  | ||||
|         /// <summary> | ||||
|         /// 商品描述 | ||||
|         /// </summary> | ||||
|         public string Description { get; private set; }  | ||||
|  | ||||
|         /// <summary> | ||||
|         /// 分类类型(大类或小类) | ||||
|         /// </summary> | ||||
|         public string Type { get; private set; }  | ||||
|  | ||||
|         /// <summary> | ||||
|         /// 父分类ID | ||||
|         /// </summary> | ||||
|         public Guid? ParentId { get; private set; } | ||||
|  | ||||
|         /// <summary> | ||||
|         /// 商品状态(在售/下架等) | ||||
|         /// </summary> | ||||
|         public string Status { get; private set; } | ||||
|  | ||||
|         /// <summary> | ||||
|         /// 排序字段 | ||||
|         /// </summary> | ||||
|         public int Order { get; private set; } | ||||
|     } | ||||
|  | ||||
|     public class UpdateProductDto: CreateProductDto | ||||
|     { | ||||
|         public Guid Id { get; set; } | ||||
|     } | ||||
|     /// <summary> | ||||
|     ///     嵌套子类 | ||||
|     /// </summary> | ||||
|     public List<CreateProductDto> Children { get; set; } = new(); | ||||
| } | ||||
|  | ||||
| public class CreateProductDto | ||||
| { | ||||
|     /// <summary> | ||||
|     ///     分类名称 | ||||
|     /// </summary> | ||||
|     public string Name { get; private set; } | ||||
|  | ||||
|     /// <summary> | ||||
|     ///     商品编码 | ||||
|     /// </summary> | ||||
|     public string Code { get; private set; } | ||||
|  | ||||
|     /// <summary> | ||||
|     ///     商品价格 | ||||
|     /// </summary> | ||||
|     public decimal Price { get; private set; } | ||||
|  | ||||
|     /// <summary> | ||||
|     ///     商品描述 | ||||
|     /// </summary> | ||||
|     public string Description { get; private set; } | ||||
|  | ||||
|     /// <summary> | ||||
|     ///     分类类型(大类或小类) | ||||
|     /// </summary> | ||||
|     public string Type { get; private set; } | ||||
|  | ||||
|     /// <summary> | ||||
|     ///     父分类ID | ||||
|     /// </summary> | ||||
|     public Guid? ParentId { get; private set; } | ||||
|  | ||||
|     /// <summary> | ||||
|     ///     商品状态(在售/下架等) | ||||
|     /// </summary> | ||||
|     public string Status { get; private set; } | ||||
|  | ||||
|     /// <summary> | ||||
|     ///     排序字段 | ||||
|     /// </summary> | ||||
|     public int Order { get; private set; } | ||||
| } | ||||
|  | ||||
| public class UpdateProductDto : CreateProductDto | ||||
| { | ||||
|     public Guid Id { get; set; } | ||||
| } | ||||
| @ -1,17 +1,13 @@ | ||||
| using System; | ||||
| using System.Collections.Generic; | ||||
| using System.Linq; | ||||
| using System.Text; | ||||
| using System.Threading.Tasks; | ||||
|  | ||||
| namespace KonSoft.Admin.Dtos | ||||
| namespace KonSoft.Admin.Dtos; | ||||
|  | ||||
| public class ServiceCategoryDto | ||||
| { | ||||
|     public class ServiceCategoryDto | ||||
|     { | ||||
|         public Guid Id { get; set; } | ||||
|         public string Name { get; set; } | ||||
|         public Guid? ParentId { get; set; } | ||||
|         public int Level { get; set; } | ||||
|         public List<ServiceCategoryDto> Children { get; set; } = new List<ServiceCategoryDto>(); | ||||
|     } | ||||
| } | ||||
|     public Guid Id { get; set; } | ||||
|     public string Name { get; set; } | ||||
|     public Guid? ParentId { get; set; } | ||||
|     public int Level { get; set; } | ||||
|     public List<ServiceCategoryDto> Children { get; set; } = new(); | ||||
| } | ||||
| @ -1,17 +1,12 @@ | ||||
| using KonSoft.Admin.Enums; | ||||
| using System; | ||||
| using System; | ||||
| using System.Collections.Generic; | ||||
| using System.Linq; | ||||
| using System.Text; | ||||
| using System.Threading.Tasks; | ||||
| using Volo.Abp.Application.Dtos; | ||||
|  | ||||
| namespace KonSoft.Admin.Dtos | ||||
| namespace KonSoft.Admin.Dtos; | ||||
|  | ||||
| public class WorkerDto : EntityDto<Guid> | ||||
| { | ||||
|     public class WorkerDto : EntityDto<Guid> | ||||
|     { | ||||
|         public string Name { get; set; } | ||||
|         public string Phone { get; set; } | ||||
|         public List<Guid> SkillCategoryIds { get; set; } = new();  // 擅长服务类型 | ||||
|     } | ||||
| } | ||||
|     public string Name { get; set; } | ||||
|     public string Phone { get; set; } | ||||
|     public List<Guid> SkillCategoryIds { get; set; } = new(); // 擅长服务类型 | ||||
| } | ||||
| @ -1,28 +1,28 @@ | ||||
| using KonSoft.Admin.Dtos; | ||||
| using System; | ||||
| using System; | ||||
| using System.Threading.Tasks; | ||||
| using KonSoft.Admin.Dtos; | ||||
| using Volo.Abp.Application.Dtos; | ||||
| using Volo.Abp.Application.Services; | ||||
|  | ||||
| namespace KonSoft.Admin.IApplicationServices | ||||
| namespace KonSoft.Admin.IApplicationServices; | ||||
|  | ||||
| public interface IOrderAppService : IApplicationService | ||||
| { | ||||
|     public interface IOrderAppService : IApplicationService | ||||
|     { | ||||
|         /// <summary> | ||||
|         /// 创建订单 | ||||
|         /// </summary> | ||||
|         /// <param name="input"></param> | ||||
|         /// <returns></returns> | ||||
|         Task<OrderDto> CreateAsync(CreateOrderDto input); | ||||
|         Task<OrderDto> PayAsync(Guid orderId, PayOrderDto input); | ||||
|         Task AssignAsync(Guid orderId, Guid workerId); | ||||
|         Task StartServiceAsync(Guid orderId); | ||||
|         Task CompleteServiceAsync(Guid orderId); | ||||
|         Task ConfirmAsync(Guid orderId); | ||||
|         Task CancelAsync(Guid orderId, string reason); | ||||
|         Task DeleteAsync(params Guid[] ids); | ||||
|         Task EditAsync(OrderDto input); | ||||
|         Task<OrderDto> GetAsync(Guid id); | ||||
|         Task<PagedResultDto<OrderDto>> GetListAsync(PagedResultRequestDto input); | ||||
|     } | ||||
| } | ||||
|     /// <summary> | ||||
|     ///     创建订单 | ||||
|     /// </summary> | ||||
|     /// <param name="input"></param> | ||||
|     /// <returns></returns> | ||||
|     Task<OrderDto> CreateAsync(CreateOrderDto input); | ||||
|  | ||||
|     Task<OrderDto> PayAsync(Guid orderId, PayOrderDto input); | ||||
|     Task AssignAsync(Guid orderId, Guid workerId); | ||||
|     Task StartServiceAsync(Guid orderId); | ||||
|     Task CompleteServiceAsync(Guid orderId); | ||||
|     Task ConfirmAsync(Guid orderId); | ||||
|     Task CancelAsync(Guid orderId, string reason); | ||||
|     Task DeleteAsync(params Guid[] ids); | ||||
|     Task EditAsync(OrderDto input); | ||||
|     Task<OrderDto> GetAsync(Guid id); | ||||
|     Task<PagedResultDto<OrderDto>> GetListAsync(PagedResultRequestDto input); | ||||
| } | ||||
| @ -0,0 +1,16 @@ | ||||
| using System; | ||||
| using System.Threading.Tasks; | ||||
| using KonSoft.Admin.Dtos; | ||||
| using Volo.Abp.Application.Dtos; | ||||
| using Volo.Abp.Application.Services; | ||||
|  | ||||
| namespace KonSoft.Admin.IApplicationServices; | ||||
|  | ||||
| public interface IProductAppService : IApplicationService | ||||
| { | ||||
|     Task CreateAsync(CreateProductDto input); | ||||
|     Task UpdateAsync(UpdateProductDto input); | ||||
|     Task DeleteAsync(Guid id); | ||||
|     Task<ProductDto> GetAsync(Guid id); | ||||
|     Task<PagedResultDto<ProductDto>> GetListAsync(PagedResultRequestDto input); | ||||
| } | ||||
| @ -1,17 +0,0 @@ | ||||
| using KonSoft.Admin.Dtos; | ||||
| using System; | ||||
| using System.Threading.Tasks; | ||||
| using Volo.Abp.Application.Dtos; | ||||
| using Volo.Abp.Application.Services; | ||||
|  | ||||
| namespace KonSoft.Admin.IApplicationServices | ||||
| { | ||||
|     public interface IProductService: IApplicationService | ||||
|     { | ||||
|         Task CreateAsync(CreateProductDto input); | ||||
|         Task UpdateAsync(UpdateProductDto input); | ||||
|         Task DeleteAsync(Guid id); | ||||
|         Task<ProductDto> GetAsync(Guid id); | ||||
|         Task<PagedResultDto<ProductDto>> GetListAsync(PagedResultRequestDto input); | ||||
|     } | ||||
| } | ||||
| @ -1,16 +1,13 @@ | ||||
| using KonSoft.Admin.Dtos; | ||||
| using System; | ||||
| using System; | ||||
| using System.Collections.Generic; | ||||
| using System.Linq; | ||||
| using System.Text; | ||||
| using System.Threading.Tasks; | ||||
| using KonSoft.Admin.Dtos; | ||||
|  | ||||
| namespace KonSoft.Admin.IApplicationServices | ||||
| namespace KonSoft.Admin.IApplicationServices; | ||||
|  | ||||
| public interface IServiceCategoryAppService | ||||
| { | ||||
|     public interface IServiceCategoryAppService | ||||
|     { | ||||
|         Task<ServiceCategoryDto> CreateAsync(CreateServiceCategoryDto input); | ||||
|         Task DeleteAsync(Guid id); | ||||
|         Task<List<ServiceCategoryDto>> GetTreeAsync(); | ||||
|     } | ||||
| } | ||||
|     Task<ServiceCategoryDto> CreateAsync(CreateServiceCategoryDto input); | ||||
|     Task DeleteAsync(Guid id); | ||||
|     Task<List<ServiceCategoryDto>> GetTreeAsync(); | ||||
| } | ||||
| @ -1,13 +1,7 @@ | ||||
| using System; | ||||
| using System.Collections.Generic; | ||||
| using System.Linq; | ||||
| using System.Text; | ||||
| using System.Threading.Tasks; | ||||
| using Volo.Abp.Application.Services; | ||||
| using Volo.Abp.Application.Services; | ||||
|  | ||||
| namespace KonSoft.Admin.IApplicationServices | ||||
| namespace KonSoft.Admin.IApplicationServices; | ||||
|  | ||||
| public interface IWorkerAppService : IApplicationService | ||||
| { | ||||
|     public interface IWorkerAppService : IApplicationService | ||||
|     { | ||||
|     } | ||||
| } | ||||
| } | ||||
| @ -1,15 +1,5 @@ | ||||
| using System; | ||||
| using System.Collections.Generic; | ||||
| using System.Linq; | ||||
| using System.Text; | ||||
| using System.Threading.Tasks; | ||||
| namespace KonSoft.Admin.IApplicationServices; | ||||
|  | ||||
| namespace KonSoft.Admin.IApplicationServices | ||||
| public interface IWorkerAssignmentService | ||||
| { | ||||
|     public interface IWorkerAssignmentService | ||||
|     { | ||||
|  | ||||
|  | ||||
|  | ||||
|     } | ||||
| } | ||||
| } | ||||
| @ -17,4 +17,4 @@ public class AdminPermissionDefinitionProvider : PermissionDefinitionProvider | ||||
|     { | ||||
|         return LocalizableString.Create<AdminResource>(name); | ||||
|     } | ||||
| } | ||||
| } | ||||
| @ -6,4 +6,4 @@ public static class AdminPermissions | ||||
|  | ||||
|     //Add your own permission names. Example: | ||||
|     //public const string MyPermission1 = GroupName + ".MyPermission1"; | ||||
| } | ||||
| } | ||||
		Reference in New Issue
	
	Block a user