Browse Source

复制分组、项目类别排序

bjmzak
wxd 2 years ago
parent
commit
647e4fb44d
  1. 11
      src/Shentun.Peis.Application.Contracts/CustomerOrgGroups/CustomerOrgRegisterIdInputDto.cs
  2. 8
      src/Shentun.Peis.Application.Contracts/Permissions/PeisPermissionDefinitionProvider.cs
  3. 84
      src/Shentun.Peis.Application/CustomerOrgGroups/CustomerOrgGroupAppService.cs
  4. 41
      src/Shentun.Peis.Application/ItemTypes/ItemTypeAppService.cs
  5. 17
      src/Shentun.Peis.Domain/ItemTypes/ItemTypeManager.cs

11
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; }
}
}

8
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"));
//配置权限选项

84
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<List<CustomerOrgGroupOrCustomerOrgDto>> 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<CustomerOrgGroupDto>();
}
/// <summary>
/// 复制上次分组
/// </summary>
/// <returns></returns>
[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("上一次单位体检次数不存在");
}
}
}
}

41
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<ItemType, Guid> _itemTypeCache;
public ItemTypeAppService(
IRepository<ItemType, Guid> repository,
ItemTypeManager manager,
@ -147,6 +151,19 @@ namespace Shentun.Peis.ItemTypes
return GetTreeParent(items.ToList(), 0, "", ItemTypeId);
}
/// <summary>
/// 修改排序 拖拽
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
[HttpPut("api/app/ItemType/UpdateSortMany")]
public async Task UpdateSortManyAsync(UpdateSortManyDto input)
{
await _manager.UpdateSortManyAsync(input);
}
#region 私有方法
/// <summary>
@ -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";
// //}
//}
}
}

17
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
/// <summary>
/// 更新排序
/// 修改排序 拖拽
/// </summary>
/// <typeparam name="TEntity"></typeparam>
/// <param name="repository"></param>
/// <param name="input"></param>
/// <returns></returns>
public async Task UpdateSortManyAsync(UpdateSortManyDto input)
{
await EntityHelper.UpdateSortManyAsync(_repository, input);
}
/// <summary>
/// 更新排序 全局同步
/// </summary>
/// <returns></returns>
public async Task UpdateDisplayOrder()

Loading…
Cancel
Save