20 changed files with 5627 additions and 60 deletions
-
41src/Shentun.ProjectManager.Application.Contracts/Customers/CreateCustomerDtoInputDto.cs
-
42src/Shentun.ProjectManager.Application.Contracts/Customers/CustomerDto.cs
-
11src/Shentun.ProjectManager.Application.Contracts/Customers/CustomerIdInputDto.cs
-
14src/Shentun.ProjectManager.Application.Contracts/Customers/GetCustomerListInputDto.cs
-
43src/Shentun.ProjectManager.Application.Contracts/Customers/UpdateCustomerDtoInputDto.cs
-
29src/Shentun.ProjectManager.Application.Contracts/Projects/CreateProjectInputDto.cs
-
5src/Shentun.ProjectManager.Application.Contracts/Projects/GetProjectListInputDto.cs
-
35src/Shentun.ProjectManager.Application.Contracts/Projects/ProjectDto.cs
-
37src/Shentun.ProjectManager.Application.Contracts/Projects/ProjectTreeDto.cs
-
26src/Shentun.ProjectManager.Application.Contracts/Projects/UpdateProjectInputDto.cs
-
182src/Shentun.ProjectManager.Application/Customers/CustomerAppService.cs
-
4src/Shentun.ProjectManager.Application/ProjectManagerApplicationAutoMapperProfile.cs
-
195src/Shentun.ProjectManager.Application/Projects/ProjectAppService.cs
-
15src/Shentun.ProjectManager.Domain/Projects/Project.cs
-
3src/Shentun.ProjectManager.EntityFrameworkCore/Configures/ProjectConfigure.cs
-
2380src/Shentun.ProjectManager.EntityFrameworkCore/Migrations/20250828030313_insert_customer.Designer.cs
-
67src/Shentun.ProjectManager.EntityFrameworkCore/Migrations/20250828030313_insert_customer.cs
-
2399src/Shentun.ProjectManager.EntityFrameworkCore/Migrations/20251125115551_update_project_add_plan.Designer.cs
-
52src/Shentun.ProjectManager.EntityFrameworkCore/Migrations/20251125115551_update_project_add_plan.cs
-
107src/Shentun.ProjectManager.EntityFrameworkCore/Migrations/ProjectManagerDbContextModelSnapshot.cs
@ -0,0 +1,41 @@ |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.Text; |
|||
|
|||
namespace Shentun.ProjectManager.Customers |
|||
{ |
|||
public class CreateCustomerDtoInputDto |
|||
{ |
|||
/// <summary>
|
|||
/// 名称
|
|||
/// </summary>
|
|||
public string DisplayName { get; set; } |
|||
/// <summary>
|
|||
/// 简称
|
|||
/// </summary>
|
|||
public string ShortName { get; set; } |
|||
|
|||
|
|||
/// <summary>
|
|||
/// 负责人
|
|||
/// </summary>
|
|||
public string PersonInCharge { get; set; } |
|||
|
|||
|
|||
/// <summary>
|
|||
/// 联系电话
|
|||
/// </summary>
|
|||
public string ContactNumber { get; set; } |
|||
|
|||
|
|||
/// <summary>
|
|||
/// 联系地址
|
|||
/// </summary>
|
|||
public string ContactAddress { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 是否启用
|
|||
/// </summary>
|
|||
public char IsActive { get; set; } |
|||
} |
|||
} |
|||
@ -0,0 +1,42 @@ |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.ComponentModel.DataAnnotations; |
|||
using System.Text; |
|||
|
|||
namespace Shentun.ProjectManager.Customers |
|||
{ |
|||
public class CustomerDto : AuditedEntityDtoName |
|||
{ |
|||
/// <summary>
|
|||
/// 名称
|
|||
/// </summary>
|
|||
public string DisplayName { get; set; } |
|||
/// <summary>
|
|||
/// 简称
|
|||
/// </summary>
|
|||
public string ShortName { get; set; } |
|||
|
|||
|
|||
/// <summary>
|
|||
/// 负责人
|
|||
/// </summary>
|
|||
public string PersonInCharge { get; set; } |
|||
|
|||
|
|||
/// <summary>
|
|||
/// 联系电话
|
|||
/// </summary>
|
|||
public string ContactNumber { get; set; } |
|||
|
|||
|
|||
/// <summary>
|
|||
/// 联系地址
|
|||
/// </summary>
|
|||
public string ContactAddress { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 是否启用
|
|||
/// </summary>
|
|||
public char IsActive { get; set; } |
|||
} |
|||
} |
|||
@ -0,0 +1,11 @@ |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.Text; |
|||
|
|||
namespace Shentun.ProjectManager.Customers |
|||
{ |
|||
public class CustomerIdInputDto |
|||
{ |
|||
public Guid CustomerId { get; set; } |
|||
} |
|||
} |
|||
@ -0,0 +1,14 @@ |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.Text; |
|||
|
|||
namespace Shentun.ProjectManager.Customers |
|||
{ |
|||
public class GetCustomerListInputDto |
|||
{ |
|||
/// <summary>
|
|||
/// 名称
|
|||
/// </summary>
|
|||
public string DisplayName { get; set; } |
|||
} |
|||
} |
|||
@ -0,0 +1,43 @@ |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.Text; |
|||
|
|||
namespace Shentun.ProjectManager.Customers |
|||
{ |
|||
public class UpdateCustomerDtoInputDto |
|||
{ |
|||
public Guid Id { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 名称
|
|||
/// </summary>
|
|||
public string DisplayName { get; set; } |
|||
/// <summary>
|
|||
/// 简称
|
|||
/// </summary>
|
|||
public string ShortName { get; set; } |
|||
|
|||
|
|||
/// <summary>
|
|||
/// 负责人
|
|||
/// </summary>
|
|||
public string PersonInCharge { get; set; } |
|||
|
|||
|
|||
/// <summary>
|
|||
/// 联系电话
|
|||
/// </summary>
|
|||
public string ContactNumber { get; set; } |
|||
|
|||
|
|||
/// <summary>
|
|||
/// 联系地址
|
|||
/// </summary>
|
|||
public string ContactAddress { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 是否启用
|
|||
/// </summary>
|
|||
public char IsActive { get; set; } |
|||
} |
|||
} |
|||
@ -0,0 +1,182 @@ |
|||
using AutoMapper.Internal.Mappers; |
|||
using Microsoft.AspNetCore.Authorization; |
|||
using Microsoft.AspNetCore.Mvc; |
|||
using Shentun.ProjectManager.Models; |
|||
using Shentun.ProjectManager.ProjectStaffFeedbacks; |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.Linq; |
|||
using System.Text; |
|||
using System.Threading.Tasks; |
|||
using Volo.Abp.Application.Services; |
|||
using Volo.Abp.Domain.Repositories; |
|||
using Volo.Abp.Guids; |
|||
using Volo.Abp.Identity; |
|||
using Volo.Abp.Users; |
|||
using Volo.Abp; |
|||
|
|||
namespace Shentun.ProjectManager.Customers |
|||
{ |
|||
|
|||
/// <summary>
|
|||
/// 客户管理
|
|||
/// </summary>
|
|||
[ApiExplorerSettings(GroupName = "Bus")] |
|||
[Authorize] |
|||
public class CustomerAppService : ApplicationService |
|||
{ |
|||
|
|||
private readonly CacheService _cacheService; |
|||
private readonly IRepository<Customer, Guid> _customerRepository; |
|||
private readonly IRepository<Project, Guid> _projectRepository; |
|||
private readonly IRepository<IdentityUser, Guid> _identityUserRepository; |
|||
private readonly CurrentUser _currentUser; |
|||
|
|||
public CustomerAppService( |
|||
CacheService cacheService, |
|||
IRepository<Project, Guid> projectRepository, |
|||
CurrentUser currentUser, |
|||
IRepository<IdentityUser, Guid> identityUserRepository, |
|||
IRepository<Customer, Guid> customerRepository) |
|||
{ |
|||
_cacheService = cacheService; |
|||
_projectRepository = projectRepository; |
|||
_currentUser = currentUser; |
|||
_identityUserRepository = identityUserRepository; |
|||
_customerRepository = customerRepository; |
|||
} |
|||
|
|||
|
|||
|
|||
/// <summary>
|
|||
/// 查询单个详细信息
|
|||
/// </summary>
|
|||
/// <param name="input"></param>
|
|||
/// <returns></returns>
|
|||
[HttpPost("api/app/Customer/Get")] |
|||
public async Task<CustomerDto> GetAsync(CustomerIdInputDto input) |
|||
{ |
|||
var customerEnt = await _customerRepository.FirstOrDefaultAsync(f => f.Id == input.CustomerId); |
|||
var entDto = ObjectMapper.Map<Customer, CustomerDto>(customerEnt); |
|||
entDto.CreatorName = await _cacheService.GetNameAsync(entDto.CreatorId); |
|||
entDto.LastModifierName = await _cacheService.GetNameAsync(entDto.LastModifierId); |
|||
|
|||
return entDto; |
|||
} |
|||
|
|||
|
|||
/// <summary>
|
|||
/// 查询客户列表记录
|
|||
/// </summary>
|
|||
/// <returns></returns>
|
|||
[HttpPost("api/app/Customer/GetList")] |
|||
public async Task<List<CustomerDto>> GetListAsync(GetCustomerListInputDto input) |
|||
{ |
|||
var query = await _customerRepository.GetQueryableAsync(); |
|||
|
|||
|
|||
|
|||
if (!string.IsNullOrWhiteSpace(input.DisplayName)) |
|||
{ |
|||
query = query.Where(m => m.DisplayName == input.DisplayName); |
|||
} |
|||
|
|||
|
|||
var entListDto = query.Select(s => new CustomerDto |
|||
{ |
|||
CreationTime = s.CreationTime, |
|||
CreatorId = s.CreatorId, |
|||
Id = s.Id, |
|||
LastModificationTime = s.LastModificationTime, |
|||
LastModifierId = s.LastModifierId, |
|||
CreatorName = _cacheService.GetNameAsync(s.CreatorId).GetAwaiter().GetResult(), |
|||
LastModifierName = _cacheService.GetNameAsync(s.LastModifierId).GetAwaiter().GetResult(), |
|||
ContactAddress = s.ContactAddress, |
|||
DisplayName = s.DisplayName, |
|||
ContactNumber = s.ContactNumber, |
|||
IsActive = s.IsActive, |
|||
PersonInCharge = s.PersonInCharge, |
|||
ShortName = s.ShortName |
|||
}).ToList(); |
|||
|
|||
|
|||
return entListDto; |
|||
|
|||
} |
|||
|
|||
|
|||
/// <summary>
|
|||
/// 创建客户
|
|||
/// </summary>
|
|||
/// <param name="input"></param>
|
|||
/// <returns></returns>
|
|||
[HttpPost("api/app/Customer/Create")] |
|||
public async Task CreateAsync(CreateCustomerDtoInputDto input) |
|||
{ |
|||
if (string.IsNullOrWhiteSpace(input.DisplayName)) |
|||
{ |
|||
throw new UserFriendlyException("名称不能为空"); |
|||
} |
|||
|
|||
var customerDto = new Customer(GuidGenerator.Create()) |
|||
{ |
|||
ShortName = input.ShortName, |
|||
PersonInCharge = input.PersonInCharge, |
|||
IsActive = input.IsActive, |
|||
ContactNumber = input.ContactNumber, |
|||
DisplayName = input.DisplayName, |
|||
ContactAddress = input.ContactAddress |
|||
}; |
|||
|
|||
|
|||
|
|||
await _customerRepository.InsertAsync(customerDto); |
|||
} |
|||
|
|||
|
|||
/// <summary>
|
|||
/// 修改客户
|
|||
/// </summary>
|
|||
/// <param name="input"></param>
|
|||
/// <returns></returns>
|
|||
[HttpPost("api/app/Customer/Update")] |
|||
public async Task UpdateAsync(UpdateCustomerDtoInputDto input) |
|||
{ |
|||
var customerEnt = await _customerRepository.FirstOrDefaultAsync(f => f.Id == input.Id); |
|||
|
|||
if (customerEnt == null) |
|||
{ |
|||
throw new UserFriendlyException("信息不存在"); |
|||
} |
|||
|
|||
|
|||
customerEnt.ShortName = input.ShortName; |
|||
customerEnt.PersonInCharge = input.PersonInCharge; |
|||
customerEnt.IsActive = input.IsActive; |
|||
customerEnt.ContactNumber = input.ContactNumber; |
|||
customerEnt.DisplayName = input.DisplayName; |
|||
customerEnt.ContactAddress = input.ContactAddress; |
|||
|
|||
|
|||
await _customerRepository.UpdateAsync(customerEnt); |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// 删除客户
|
|||
/// </summary>
|
|||
/// <param name="input"></param>
|
|||
/// <returns></returns>
|
|||
[HttpPost("api/app/Customer/Delete")] |
|||
public async Task DeleteAsync(CustomerIdInputDto input) |
|||
{ |
|||
var customer = await _customerRepository.FirstOrDefaultAsync(f => f.Id == input.CustomerId); |
|||
if (customer == null) |
|||
{ |
|||
throw new UserFriendlyException("记录不存在"); |
|||
} |
|||
|
|||
await _customerRepository.DeleteAsync(customer); |
|||
} |
|||
|
|||
} |
|||
} |
|||
2380
src/Shentun.ProjectManager.EntityFrameworkCore/Migrations/20250828030313_insert_customer.Designer.cs
File diff suppressed because it is too large
View File
File diff suppressed because it is too large
View File
@ -0,0 +1,67 @@ |
|||
using System; |
|||
using Microsoft.EntityFrameworkCore.Migrations; |
|||
|
|||
#nullable disable |
|||
|
|||
namespace Shentun.ProjectManager.Migrations |
|||
{ |
|||
public partial class insert_customer : Migration |
|||
{ |
|||
protected override void Up(MigrationBuilder migrationBuilder) |
|||
{ |
|||
migrationBuilder.AddColumn<char>( |
|||
name: "complete_flag", |
|||
table: "project", |
|||
type: "character(1)", |
|||
maxLength: 1, |
|||
nullable: false, |
|||
defaultValueSql: "'0'", |
|||
comment: "完成状态 0=未完成 1=已完成 2=中止"); |
|||
|
|||
migrationBuilder.AddColumn<Guid>( |
|||
name: "customer_id", |
|||
table: "project", |
|||
type: "uuid", |
|||
nullable: false, |
|||
defaultValue: new Guid("00000000-0000-0000-0000-000000000000"), |
|||
comment: "客户id"); |
|||
|
|||
migrationBuilder.CreateTable( |
|||
name: "customer", |
|||
columns: table => new |
|||
{ |
|||
id = table.Column<Guid>(type: "uuid", nullable: false), |
|||
display_name = table.Column<string>(type: "character varying(50)", maxLength: 50, nullable: false, comment: "名称"), |
|||
short_name = table.Column<string>(type: "character varying(50)", maxLength: 50, nullable: true, comment: "简称"), |
|||
person_in_charge = table.Column<string>(type: "character varying(50)", maxLength: 50, nullable: true, comment: "负责人"), |
|||
contact_number = table.Column<string>(type: "character varying(20)", maxLength: 20, nullable: true, comment: "联系电话"), |
|||
contact_address = table.Column<string>(type: "character varying(200)", maxLength: 200, nullable: true, comment: "联系地址"), |
|||
is_active = table.Column<char>(type: "character(1)", maxLength: 1, nullable: false, defaultValueSql: "'Y'", comment: "是否启用"), |
|||
concurrency_stamp = table.Column<string>(type: "character varying(40)", maxLength: 40, nullable: true), |
|||
creation_time = table.Column<DateTime>(type: "timestamp without time zone", nullable: false), |
|||
creator_id = table.Column<Guid>(type: "uuid", nullable: true), |
|||
last_modification_time = table.Column<DateTime>(type: "timestamp without time zone", nullable: true), |
|||
last_modifier_id = table.Column<Guid>(type: "uuid", nullable: true) |
|||
}, |
|||
constraints: table => |
|||
{ |
|||
table.PrimaryKey("pk_customer", x => x.id); |
|||
}, |
|||
comment: "客户表"); |
|||
} |
|||
|
|||
protected override void Down(MigrationBuilder migrationBuilder) |
|||
{ |
|||
migrationBuilder.DropTable( |
|||
name: "customer"); |
|||
|
|||
migrationBuilder.DropColumn( |
|||
name: "complete_flag", |
|||
table: "project"); |
|||
|
|||
migrationBuilder.DropColumn( |
|||
name: "customer_id", |
|||
table: "project"); |
|||
} |
|||
} |
|||
} |
|||
2399
src/Shentun.ProjectManager.EntityFrameworkCore/Migrations/20251125115551_update_project_add_plan.Designer.cs
File diff suppressed because it is too large
View File
File diff suppressed because it is too large
View File
@ -0,0 +1,52 @@ |
|||
using System; |
|||
using Microsoft.EntityFrameworkCore.Migrations; |
|||
|
|||
#nullable disable |
|||
|
|||
namespace Shentun.ProjectManager.Migrations |
|||
{ |
|||
public partial class update_project_add_plan : Migration |
|||
{ |
|||
protected override void Up(MigrationBuilder migrationBuilder) |
|||
{ |
|||
migrationBuilder.AddColumn<Guid>( |
|||
name: "leader_id", |
|||
table: "project", |
|||
type: "uuid", |
|||
nullable: false, |
|||
defaultValue: new Guid("00000000-0000-0000-0000-000000000000"), |
|||
comment: "负责人id"); |
|||
|
|||
migrationBuilder.AddColumn<decimal>( |
|||
name: "plan_time", |
|||
table: "project", |
|||
type: "numeric", |
|||
nullable: false, |
|||
defaultValue: 0m, |
|||
comment: "计划时间"); |
|||
|
|||
migrationBuilder.AddColumn<char>( |
|||
name: "plan_unit", |
|||
table: "project", |
|||
type: "character(1)", |
|||
nullable: false, |
|||
defaultValueSql: "'0'", |
|||
comment: "计划时间单位 0-天 1-小时"); |
|||
} |
|||
|
|||
protected override void Down(MigrationBuilder migrationBuilder) |
|||
{ |
|||
migrationBuilder.DropColumn( |
|||
name: "leader_id", |
|||
table: "project"); |
|||
|
|||
migrationBuilder.DropColumn( |
|||
name: "plan_time", |
|||
table: "project"); |
|||
|
|||
migrationBuilder.DropColumn( |
|||
name: "plan_unit", |
|||
table: "project"); |
|||
} |
|||
} |
|||
} |
|||
Write
Preview
Loading…
Cancel
Save
Reference in new issue