add: 师傅实体和服务类型
This commit is contained in:
@ -36,7 +36,9 @@ namespace KonSoft.Admin.Entities
|
||||
/// <summary>
|
||||
/// 服务项目ID
|
||||
/// </summary>
|
||||
public Guid ServiceId { get; private set; }
|
||||
public Guid ServiceCategoryId { get; private set; }
|
||||
|
||||
public virtual ServiceCategory ServiceCategory { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// 服务预约时间
|
||||
@ -74,12 +76,12 @@ namespace KonSoft.Admin.Entities
|
||||
protected Order() { }
|
||||
|
||||
|
||||
public Order(Guid id, string orderSN, Guid customerId, Guid serviceId, DateTime serviceTime, decimal amount, AddressInfo address, string remark = null)
|
||||
public Order(Guid id, string orderSN, Guid customerId, Guid serviceCategoryId, DateTime serviceTime, decimal amount, AddressInfo address, string remark = null)
|
||||
: base(id)
|
||||
{
|
||||
OrderSN = orderSN;
|
||||
CustomerId = customerId;
|
||||
ServiceId = serviceId;
|
||||
ServiceCategoryId = serviceCategoryId;
|
||||
ServiceTime = serviceTime;
|
||||
Amount = amount;
|
||||
Address = address;
|
||||
|
||||
@ -0,0 +1,46 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Volo.Abp.Domain.Entities.Auditing;
|
||||
|
||||
namespace KonSoft.Admin.Entities
|
||||
{
|
||||
public class ServiceCategory : FullAuditedAggregateRoot<Guid>
|
||||
{
|
||||
public string Name { get; private set; }
|
||||
public Guid? ParentId { get; private set; }
|
||||
public string Path { get; private set; }
|
||||
public int Level { get; private set; }
|
||||
|
||||
protected ServiceCategory() { }
|
||||
|
||||
public ServiceCategory(Guid id, string name)
|
||||
: base(id)
|
||||
{
|
||||
Name = name;
|
||||
}
|
||||
|
||||
public ServiceCategory(Guid id, string name, Guid? parentId = null, string path = null, int level = 0) : base(id)
|
||||
{
|
||||
Name = name;
|
||||
ParentId = parentId;
|
||||
Path = path ?? id.ToString();
|
||||
Level = level;
|
||||
}
|
||||
|
||||
|
||||
public void UpdateName(string name) => Name = name;
|
||||
|
||||
|
||||
public void SetParent(ServiceCategory parent)
|
||||
{
|
||||
ParentId = parent?.Id;
|
||||
Level = (parent?.Level ?? 0) + 1;
|
||||
Path = parent != null ? $"{parent.Path}/{Id}" : Id.ToString();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
34
modules/admin/src/KonSoft.Admin.Domain/Entities/Worker.cs
Normal file
34
modules/admin/src/KonSoft.Admin.Domain/Entities/Worker.cs
Normal file
@ -0,0 +1,34 @@
|
||||
using KonSoft.Admin.Enums;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Volo.Abp.Domain.Entities.Auditing;
|
||||
|
||||
namespace KonSoft.Admin.Entities
|
||||
{
|
||||
/// <summary>
|
||||
/// 家政人员
|
||||
/// </summary>
|
||||
public class Worker : FullAuditedAggregateRoot<Guid>
|
||||
{
|
||||
public string Name { get; private set; }
|
||||
public string Phone { get; private set; }
|
||||
public decimal Rating { get; private set; } // 评分
|
||||
public List<Guid> SkillCategoryIds { get; private set; } = new List<Guid>();
|
||||
|
||||
public Worker() { }
|
||||
|
||||
|
||||
public void UpdateRating(decimal newRating)
|
||||
{
|
||||
Rating = newRating;
|
||||
}
|
||||
|
||||
public bool CanPerform(Guid serviceCategoryId)
|
||||
{
|
||||
return SkillCategoryIds.Contains(serviceCategoryId);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user