From 647e4fb44d3aa7b8aaaad90dbe600b12478934ef Mon Sep 17 00:00:00 2001 From: wxd <123@qq.com> Date: Tue, 7 May 2024 17:52:24 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A4=8D=E5=88=B6=E5=88=86=E7=BB=84=E3=80=81?= =?UTF-8?q?=E9=A1=B9=E7=9B=AE=E7=B1=BB=E5=88=AB=E6=8E=92=E5=BA=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../CustomerOrgRegisterIdInputDto.cs | 11 +++ .../PeisPermissionDefinitionProvider.cs | 8 +- .../CustomerOrgGroupAppService.cs | 84 ++++++++++++++++++- .../ItemTypes/ItemTypeAppService.cs | 41 +++++++++ .../ItemTypes/ItemTypeManager.cs | 17 +++- 5 files changed, 153 insertions(+), 8 deletions(-) create mode 100644 src/Shentun.Peis.Application.Contracts/CustomerOrgGroups/CustomerOrgRegisterIdInputDto.cs diff --git a/src/Shentun.Peis.Application.Contracts/CustomerOrgGroups/CustomerOrgRegisterIdInputDto.cs b/src/Shentun.Peis.Application.Contracts/CustomerOrgGroups/CustomerOrgRegisterIdInputDto.cs new file mode 100644 index 0000000..6d1ed17 --- /dev/null +++ b/src/Shentun.Peis.Application.Contracts/CustomerOrgGroups/CustomerOrgRegisterIdInputDto.cs @@ -0,0 +1,11 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace Shentun.Peis.CustomerOrgGroups +{ + public class CustomerOrgRegisterIdInputDto + { + public Guid CustomerOrgRegisterId { get; set; } + } +} diff --git a/src/Shentun.Peis.Application.Contracts/Permissions/PeisPermissionDefinitionProvider.cs b/src/Shentun.Peis.Application.Contracts/Permissions/PeisPermissionDefinitionProvider.cs index 4738879..64433e3 100644 --- a/src/Shentun.Peis.Application.Contracts/Permissions/PeisPermissionDefinitionProvider.cs +++ b/src/Shentun.Peis.Application.Contracts/Permissions/PeisPermissionDefinitionProvider.cs @@ -13,10 +13,10 @@ public class PeisPermissionDefinitionProvider : PermissionDefinitionProvider //Define your own permissions here. Example: //myGroup.AddPermission(PeisPermissions.MyPermission1, L("Permission:MyPermission1")); - var booksPermission = myGroup.AddPermission(PeisPermissions.Books.Default, L("Permission:Books")); - booksPermission.AddChild(PeisPermissions.Books.Create, L("Permission:Books.Create")); - booksPermission.AddChild(PeisPermissions.Books.Edit, L("Permission:Books.Edit")); - booksPermission.AddChild(PeisPermissions.Books.Delete, L("Permission:Books.Delete")); + //var booksPermission = myGroup.AddPermission(PeisPermissions.Books.Default, L("Permission:Books")); + //booksPermission.AddChild(PeisPermissions.Books.Create, L("Permission:Books.Create")); + //booksPermission.AddChild(PeisPermissions.Books.Edit, L("Permission:Books.Edit")); + //booksPermission.AddChild(PeisPermissions.Books.Delete, L("Permission:Books.Delete")); //配置权限选项 diff --git a/src/Shentun.Peis.Application/CustomerOrgGroups/CustomerOrgGroupAppService.cs b/src/Shentun.Peis.Application/CustomerOrgGroups/CustomerOrgGroupAppService.cs index fb6d973..cc17fbd 100644 --- a/src/Shentun.Peis.Application/CustomerOrgGroups/CustomerOrgGroupAppService.cs +++ b/src/Shentun.Peis.Application/CustomerOrgGroups/CustomerOrgGroupAppService.cs @@ -6,6 +6,7 @@ using Shentun.Peis.CustomerOrgGroupDetails; using Shentun.Peis.CustomerOrgGroups; using Shentun.Peis.HelperDto; using Shentun.Peis.Models; +using Shentun.Peis.PatientRegisters; using System; using System.Collections.Generic; using System.Linq; @@ -16,6 +17,7 @@ using Volo.Abp.Application.Dtos; using Volo.Abp.Application.Services; using Volo.Abp.Domain.Repositories; using Volo.Abp.Identity; +using Xceed.Document.NET; namespace Shentun.Peis.CustomerOrgGroups { @@ -93,7 +95,7 @@ namespace Shentun.Peis.CustomerOrgGroups [HttpGet("api/app/customerorggroup/getlistinfilter")] public async Task> GetListInFilterAsync(GetListDto input) { - + var oldlist = (await Repository.GetQueryableAsync()). Include(x => x.CustomerOrgRegister). Include(x => x.CustomerOrgRegister.CustomerOrg).AsEnumerable(); @@ -110,7 +112,7 @@ namespace Shentun.Peis.CustomerOrgGroups if (input.MedicalTimes != null) oldlist = oldlist.Where(m => m.CustomerOrgRegister.MedicalTimes == input.MedicalTimes); - + var entdto = oldlist.OrderBy(o => o.CustomerOrgRegister.CustomerOrg.DisplayOrder) .ThenBy(o => o.CustomerOrgRegister.MedicalTimes) .ThenBy(o => o.DisplayOrder) @@ -140,7 +142,7 @@ namespace Shentun.Peis.CustomerOrgGroups }).OrderBy(m => m.DisplayOrder).ToList(); - return entdto; + return entdto; } @@ -359,5 +361,81 @@ namespace Shentun.Peis.CustomerOrgGroups } return new List(); } + + + /// + /// 复制上次分组 + /// + /// + [HttpPost("api/app/CustomerOrgGroup/CopyLastGrouping")] + public async Task CopyLastGroupingAsync(CustomerOrgRegisterIdInputDto input) + { + if (input == null) + throw new UserFriendlyException("请求参数有误"); + var customerOrgRegisterEnt = await _customerOrgRegisterRepository.GetAsync(input.CustomerOrgRegisterId); + if (customerOrgRegisterEnt == null) + throw new UserFriendlyException("单位体检次数不存在"); + if (customerOrgRegisterEnt.IsComplete == 'Y') + throw new UserFriendlyException("该单位体检次数已完成,无法复制"); + + var prevCustomerOrgRegister = (await _customerOrgRegisterRepository.GetQueryableAsync()) + .Where(m => m.CustomerOrgId == customerOrgRegisterEnt.CustomerOrgId && m.MedicalTimes < customerOrgRegisterEnt.MedicalTimes) + .OrderByDescending(o => o.MedicalTimes).FirstOrDefault(); + + if (prevCustomerOrgRegister != null) + { + #region 创建分组、明细 + //上一次体检次数的分组 + var prevCustomerOrgGroupList = (await Repository.GetQueryableAsync()).Where(m => m.CustomerOrgRegisterId == prevCustomerOrgRegister.Id); + + + + foreach (var group in prevCustomerOrgGroupList) + { + Guid customerOrgGroupId = GuidGenerator.Create(); + var newCustomerOrgGroup = new CustomerOrgGroup(customerOrgGroupId) + { + AgeLowerLimit = group.AgeLowerLimit, + AgeUpperLimit = group.AgeUpperLimit, + CustomerOrgRegisterId = customerOrgRegisterEnt.Id, + DisplayName = group.DisplayName, + DisplayOrder = group.DisplayOrder, + ForSexId = group.ForSexId, + JobPost = group.JobPost, + JobTitle = group.JobTitle, + MaritalStatusId = group.MaritalStatusId, + Price = group.Price, + Remark = group.Remark + }; + + await Repository.InsertAsync(newCustomerOrgGroup, true); + + #region 创建分组明细 + + var prevCustomerOrgGroupDetailList = (await _customerOrgGroupDetailRepository.GetQueryableAsync()).Where(m => m.CustomerOrgGroupId == group.Id); + foreach (var customerOrgGroupDetail in prevCustomerOrgGroupDetailList) + { + var newcustomerOrgGroupDetail = new CustomerOrgGroupDetail + { + Amount = customerOrgGroupDetail.Amount, + AsbitemId = customerOrgGroupDetail.AsbitemId, + CustomerOrgGroupId = customerOrgGroupId, + Price = customerOrgGroupDetail.Price + }; + + await _customerOrgGroupDetailRepository.InsertAsync(newcustomerOrgGroupDetail); + } + + #endregion + } + + + #endregion + } + else + { + throw new UserFriendlyException("上一次单位体检次数不存在"); + } + } } } diff --git a/src/Shentun.Peis.Application/ItemTypes/ItemTypeAppService.cs b/src/Shentun.Peis.Application/ItemTypes/ItemTypeAppService.cs index 84e5b74..2e97346 100644 --- a/src/Shentun.Peis.Application/ItemTypes/ItemTypeAppService.cs +++ b/src/Shentun.Peis.Application/ItemTypes/ItemTypeAppService.cs @@ -1,7 +1,9 @@ using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; +using Microsoft.EntityFrameworkCore; using Shentun.Peis.Books; using Shentun.Peis.GuidTypes; +using Shentun.Peis.HelperDto; using Shentun.Peis.Models; using Shentun.Peis.OrganizationUnits; using System; @@ -17,6 +19,7 @@ using Volo.Abp.Domain.Entities; using Volo.Abp.Domain.Repositories; using Volo.Abp.Identity; using Volo.Abp.ObjectMapping; +using Volo.Abp.Uow; namespace Shentun.Peis.ItemTypes { @@ -32,6 +35,7 @@ namespace Shentun.Peis.ItemTypes { private readonly ItemTypeManager _manager; private readonly IDistributedCache _itemTypeCache; + public ItemTypeAppService( IRepository repository, ItemTypeManager manager, @@ -147,6 +151,19 @@ namespace Shentun.Peis.ItemTypes return GetTreeParent(items.ToList(), 0, "", ItemTypeId); } + + /// + /// 修改排序 拖拽 + /// + /// + /// + [HttpPut("api/app/ItemType/UpdateSortMany")] + public async Task UpdateSortManyAsync(UpdateSortManyDto input) + { + await _manager.UpdateSortManyAsync(input); + } + + #region 私有方法 /// @@ -203,5 +220,29 @@ namespace Shentun.Peis.ItemTypes #endregion + + //public async Task GetTest() + //{ + + + // Guid id = Guid.Parse("3a120290-16cc-fc9e-5b6a-b2fd50e47fb0"); + // var ss = (await Repository.GetQueryableAsync()).Where(m => m.Id == id).FirstOrDefault(); + // ss.DisplayName = "放射科4"; + // var ss3 = await Repository.GetAsync(id); + + // //await Repository.UpdateAsync(ss); + + // //var sss = from a in await _readOnlyRepository.GetQueryableAsync() + // // where a.Id == id + // // select new + // // { + // // a + // // }; + + // //foreach ( var s in sss ) { + // // s.a.DisplayName = "放射科3"; + // //} + + //} } } diff --git a/src/Shentun.Peis.Domain/ItemTypes/ItemTypeManager.cs b/src/Shentun.Peis.Domain/ItemTypes/ItemTypeManager.cs index dfc638e..eceebb6 100644 --- a/src/Shentun.Peis.Domain/ItemTypes/ItemTypeManager.cs +++ b/src/Shentun.Peis.Domain/ItemTypes/ItemTypeManager.cs @@ -1,5 +1,6 @@ using JetBrains.Annotations; using NPOI.POIFS.Properties; +using Shentun.Peis.HelperDto; using Shentun.Peis.Models; using Shentun.Utilities; using System; @@ -238,7 +239,21 @@ namespace Shentun.Peis.ItemTypes /// - /// 更新排序 + /// 修改排序 拖拽 + /// + /// + /// + /// + /// + public async Task UpdateSortManyAsync(UpdateSortManyDto input) + { + await EntityHelper.UpdateSortManyAsync(_repository, input); + + } + + + /// + /// 更新排序 全局同步 /// /// public async Task UpdateDisplayOrder()