Browse Source

修改20240325

bjmzak
wxd 2 years ago
parent
commit
64b2e82c09
  1. 19
      src/Shentun.Peis.Application/CommonCharTypes/CommonCharTypeAppService.cs
  2. 19
      src/Shentun.Peis.Application/CommonChars/CommonCharAppService.cs
  3. 6
      src/Shentun.Peis.Application/CustomerOrgGroupDetails/CustomerOrgGroupDetailAppService.cs
  4. 11
      src/Shentun.Peis.Application/CustomerOrgGroups/CustomerOrgGroupAppService.cs
  5. 3
      src/Shentun.Peis.Application/CustomerOrgRegisters/CustomerOrgRegisterAppService.cs
  6. 26
      src/Shentun.Peis.Application/CustomerOrgTypes/CustomerOrgTypeAppService.cs
  7. 11
      src/Shentun.Peis.Domain/CommonCharTypes/CommonCharTypeManager.cs
  8. 10
      src/Shentun.Peis.Domain/CommonChars/CommonCharManager.cs
  9. 35
      src/Shentun.Peis.Domain/CustomerOrgGroupDetails/CustomerOrgGroupDetailManager.cs
  10. 43
      src/Shentun.Peis.Domain/CustomerOrgGroups/CustomerOrgGroupManager.cs
  11. 18
      src/Shentun.Peis.Domain/CustomerOrgRegisters/CustomerOrgRegisterManager.cs
  12. 10
      src/Shentun.Peis.Domain/CustomerOrgTypes/CustomerOrgTypeManager.cs

19
src/Shentun.Peis.Application/CommonCharTypes/CommonCharTypeAppService.cs

@ -13,6 +13,7 @@ using Volo.Abp.Application.Services;
using Volo.Abp.Domain.Repositories;
using Volo.Abp.Identity;
using Microsoft.AspNetCore.Authorization;
using Volo.Abp;
namespace Shentun.Peis.CommonCharTypes
{
@ -48,13 +49,18 @@ namespace Shentun.Peis.CommonCharTypes
/// <returns></returns>
public override async Task<CommonCharTypeDto> GetAsync(Guid id)
{
return await base.GetAsync(id);
var userList = await _userRepository.GetListAsync();
var entityDto = await base.GetAsync(id);
entityDto.CreatorName = EntityHelper.GetUserNameNoSql(userList, entityDto.CreatorId);
entityDto.LastModifierName = EntityHelper.GetUserNameNoSql(userList, entityDto.CreatorId);
return entityDto;
}
/// <summary>
/// 获取列表 常用字符类别
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
[RemoteService(false)]
public override async Task<PagedResultDto<CommonCharTypeDto>> GetListAsync(PagedAndSortedResultRequestDto input)
{
return await base.GetListAsync(input);
@ -135,16 +141,7 @@ namespace Shentun.Peis.CommonCharTypes
return base.DeleteAsync(id);
}
/// <summary>
/// 修改排序 相邻之间
/// </summary>
/// <param name="id">需要修改的ID</param>
/// <param name="targetid">目标ID</param>
[HttpPut("api/app/commonchartype/updatesort")]
public async Task UpdateSortAsync(Guid id, Guid targetid)
{
await _manager.UpdateSortAsync(id, targetid);
}
/// <summary>
/// 修改排序 置顶,置底

19
src/Shentun.Peis.Application/CommonChars/CommonCharAppService.cs

@ -14,6 +14,7 @@ using Volo.Abp.Domain.Repositories;
using Volo.Abp.Identity;
using Microsoft.EntityFrameworkCore;
using Microsoft.AspNetCore.Authorization;
using Volo.Abp;
namespace Shentun.Peis.CommonChars
{
@ -49,13 +50,18 @@ namespace Shentun.Peis.CommonChars
/// <returns></returns>
public override async Task<CommonCharDto> GetAsync(Guid id)
{
return await base.GetAsync(id);
var userList = await _userRepository.GetListAsync();
var entityDto = await base.GetAsync(id);
entityDto.CreatorName = EntityHelper.GetUserNameNoSql(userList, entityDto.CreatorId);
entityDto.LastModifierName = EntityHelper.GetUserNameNoSql(userList, entityDto.CreatorId);
return entityDto;
}
/// <summary>
/// 获取列表 常用字符 遗弃
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
[RemoteService(false)]
public override async Task<PagedResultDto<CommonCharDto>> GetListAsync(PagedAndSortedResultRequestDto input)
{
return await base.GetListAsync(input);
@ -145,16 +151,7 @@ namespace Shentun.Peis.CommonChars
return base.DeleteAsync(id);
}
/// <summary>
/// 修改排序 相邻之间
/// </summary>
/// <param name="id">需要修改的ID</param>
/// <param name="targetid">目标ID</param>
[HttpPut("api/app/commonchar/updatesort")]
public async Task UpdateSortAsync(Guid id, Guid targetid)
{
await _manager.UpdateSortAsync(id, targetid);
}
/// <summary>
/// 修改排序 置顶,置底

6
src/Shentun.Peis.Application/CustomerOrgGroupDetails/CustomerOrgGroupDetailAppService.cs

@ -32,10 +32,11 @@ namespace Shentun.Peis.CustomerOrgGroupDetails
private readonly ICustomerOrgGroupDetailRepository _customerOrgGroupRepository;
private readonly CustomerOrgGroupDetailManager _manager;
public CustomerOrgGroupDetailAppService(
ICustomerOrgGroupDetailRepository customerOrgGroupRepository,
CustomerOrgGroupDetailManager manager
)
)
{
this._customerOrgGroupRepository = customerOrgGroupRepository;
this._manager = manager;
@ -63,6 +64,7 @@ namespace Shentun.Peis.CustomerOrgGroupDetails
[HttpPost("api/app/customerorggroupdetail/createcustomerorggroupdetailmany")]
public async Task CreateCustomerOrgGroupDetailManyAsync(CreateCustomerOrgGroupDetailDto input)
{
await _manager.CheckAndDeleteAsync(input.CustomerOrgGroupId);
if (input.details.Any())
@ -103,5 +105,7 @@ namespace Shentun.Peis.CustomerOrgGroupDetails
return entdto;
}
}
}

11
src/Shentun.Peis.Application/CustomerOrgGroups/CustomerOrgGroupAppService.cs

@ -192,16 +192,7 @@ namespace Shentun.Peis.CustomerOrgGroups
await _manager.CheckAndDeleteAsync(id);
}
/// <summary>
/// 修改排序 相邻之间
/// </summary>
/// <param name="id">需要修改的ID</param>
/// <param name="targetid">目标ID</param>
[HttpPut("api/app/customerorggroup/updatesort")]
public async Task UpdateSortAsync(Guid id, Guid targetid)
{
await _manager.UpdateSortAsync(id, targetid);
}
/// <summary>
/// 修改排序 置顶,置底

3
src/Shentun.Peis.Application/CustomerOrgRegisters/CustomerOrgRegisterAppService.cs

@ -135,6 +135,7 @@ namespace Shentun.Peis.CustomerOrgRegisters
{
var CustomerOrgParenId = EntityHelper.GetParentNoSql(await _customerOrgRepository.GetListAsync(), CustomerOrgId); //获取一级单位ID
var entity = await _manager.CreateAsync(CustomerOrgParenId);
entity = await Repository.InsertAsync(entity);
var dto = ObjectMapper.Map<CustomerOrgRegister, CustomerOrgRegisterDto>(entity);
return dto;
}
@ -212,7 +213,7 @@ namespace Shentun.Peis.CustomerOrgRegisters
CustomerOrgId = s.CustomerOrgId,
CreatorName = EntityHelper.GetUserNameNoSql(userList, s.CreatorId),
LastModifierName = EntityHelper.GetUserNameNoSql(userList, s.LastModifierId)
}).OrderBy(o=>o.MedicalTimes).ToList();
}).OrderBy(o => o.MedicalTimes).ToList();
return entdto;

26
src/Shentun.Peis.Application/CustomerOrgTypes/CustomerOrgTypeAppService.cs

@ -55,15 +55,11 @@ namespace Shentun.Peis.CustomerOrgTypes
/// <returns></returns>
public override async Task<CustomerOrgTypeDto> GetAsync(Guid id)
{
var entity = await Repository.FindAsync(o => o.Id == id);
//throw new Exception("标准异常测试");
//throw new BusinessException("业务异常测试");
//throw new UserFriendlyException("友好异常测试");
//throw new EntityNotFoundException("未发现实体异常测试");
//return null;
if (entity == null)
return null;
return ObjectMapper.Map<CustomerOrgType, CustomerOrgTypeDto>(entity);
var userList = await _userRepository.GetListAsync();
var entityDto = await base.GetAsync(id);
entityDto.CreatorName = EntityHelper.GetUserNameNoSql(userList, entityDto.CreatorId);
entityDto.LastModifierName = EntityHelper.GetUserNameNoSql(userList, entityDto.CreatorId);
return entityDto;
}
/// <summary>
@ -160,17 +156,7 @@ namespace Shentun.Peis.CustomerOrgTypes
/// <summary>
/// 修改排序 相邻之间
/// </summary>
/// <param name="id">需要修改的ID</param>
/// <param name="targetid">目标ID</param>
[HttpPut("api/app/customerorgtype/updatesort")]
[RemoteService(false)]
public async Task UpdateSortAsync(Guid id, Guid targetid)
{
await _manager.UpdateSortAsync(id, targetid);
}
/// <summary>
/// 修改排序 置顶,置底

11
src/Shentun.Peis.Domain/CommonCharTypes/CommonCharTypeManager.cs

@ -62,16 +62,7 @@ namespace Shentun.Peis.CommonCharTypes
}
/// <summary>
/// 修改排序 相邻之间
/// </summary>
/// <param name="id">需要修改的ID</param>
/// <param name="targetid">目标ID</param>
public async Task UpdateSortAsync(Guid id, Guid targetid)
{
await EntityHelper.UpdateSort(_repository, id, targetid);
}
/// <summary>
/// 修改排序 置顶,置底

10
src/Shentun.Peis.Domain/CommonChars/CommonCharManager.cs

@ -79,15 +79,7 @@ namespace Shentun.Peis.CommonChars
/// <summary>
/// 修改排序 相邻之间
/// </summary>
/// <param name="id">需要修改的ID</param>
/// <param name="targetid">目标ID</param>
public async Task UpdateSortAsync(Guid id, Guid targetid)
{
await EntityHelper.UpdateSort(_repository, id, targetid);
}
/// <summary>
/// 修改排序 置顶,置底

35
src/Shentun.Peis.Domain/CustomerOrgGroupDetails/CustomerOrgGroupDetailManager.cs

@ -14,12 +14,20 @@ namespace Shentun.Peis.CustomerOrgGroupDetails
public class CustomerOrgGroupDetailManager : DomainService
{
private readonly IRepository<CustomerOrgGroupDetail> _repository;
private readonly IRepository<CustomerOrgGroup, Guid> _customerOrgGroupRepository;
private readonly IRepository<CustomerOrgRegister, Guid> _customerOrgRegisterRepository;
private readonly IRepository<CustomerOrg, Guid> _customerOrgRepository;
public CustomerOrgGroupDetailManager(
IRepository<CustomerOrgGroupDetail> repository
IRepository<CustomerOrgGroupDetail> repository,
IRepository<CustomerOrg, Guid> customerOrgRepository,
IRepository<CustomerOrgGroup, Guid> customerOrgGroupRepository,
IRepository<CustomerOrgRegister, Guid> customerOrgRegisterRepository
)
{
this._repository = repository;
this._customerOrgRepository = customerOrgRepository;
this._customerOrgGroupRepository = customerOrgGroupRepository;
this._customerOrgRegisterRepository = customerOrgRegisterRepository;
}
@ -32,6 +40,9 @@ namespace Shentun.Peis.CustomerOrgGroupDetails
/// <exception cref="UserFriendlyException"></exception>
public async Task CheckAndDeleteAsync(Guid CustomerOrgGroupId)
{
await CheckCustomerOrgStatus(CustomerOrgGroupId);
var customerOrgGroupDetailList = await _repository.GetListAsync(m => m.CustomerOrgGroupId == CustomerOrgGroupId);
if (customerOrgGroupDetailList.Any())
{
@ -59,7 +70,25 @@ namespace Shentun.Peis.CustomerOrgGroupDetails
await _repository.DeleteManyAsync(customerOrgGroupDetailList);
}
}
/// <summary>
/// 检查单位状态是否可以使用 未启用和加锁和单位体检次数已完成,不允许操作
/// </summary>
/// <param name="CustomerOrgGroupId">单位分组ID</param>
/// <returns></returns>
private async Task CheckCustomerOrgStatus(Guid CustomerOrgGroupId)
{
var customerOrgGroup = (from a in await _customerOrgGroupRepository.GetQueryableAsync()
join b in await _customerOrgRegisterRepository.GetQueryableAsync() on a.CustomerOrgRegisterId equals b.Id
join c in await _customerOrgRepository.GetQueryableAsync() on b.CustomerOrgId equals c.Id
where a.Id == CustomerOrgGroupId && (c.IsLock == 'Y' || c.IsActive == 'N' || b.IsComplete == 'Y')
select c.DisplayName).FirstOrDefault();
if (!string.IsNullOrWhiteSpace(customerOrgGroup))
{
throw new UserFriendlyException($"单位{customerOrgGroup}未启用或者已锁定,无法操作!");
}
}
}
}

43
src/Shentun.Peis.Domain/CustomerOrgGroups/CustomerOrgGroupManager.cs

@ -24,7 +24,7 @@ namespace Shentun.Peis.CustomerOrgGroups
private readonly IRepository<CustomerOrgGroup, Guid> _repository;
private readonly IRepository<PatientRegister, Guid> _patientRegisterRepository;
private readonly IRepository<CustomerOrgGroupDetail> _customerOrgGroupDetailRepository;
private readonly IRepository<CustomerOrg, Guid> _customerOrgRepository;
private readonly IRepository<CustomerOrgRegister, Guid> _customerOrgRegisterRepositor;
private readonly CustomerOrgGroupDetailManager _customerOrgGroupDetailManager;
@ -32,14 +32,14 @@ namespace Shentun.Peis.CustomerOrgGroups
public CustomerOrgGroupManager(
IRepository<CustomerOrgGroup, Guid> repository,
IRepository<PatientRegister, Guid> patientRegisterRepository,
IRepository<CustomerOrgGroupDetail> customerOrgGroupDetailRepository,
IRepository<CustomerOrg, Guid> customerOrgRepository,
IRepository<CustomerOrgRegister, Guid> customerOrgRegisterRepositor,
CustomerOrgGroupDetailManager customerOrgGroupDetailManager)
{
_repository = repository;
this._patientRegisterRepository = patientRegisterRepository;
this._customerOrgGroupDetailRepository = customerOrgGroupDetailRepository;
this._customerOrgRepository = customerOrgRepository;
this._customerOrgRegisterRepositor = customerOrgRegisterRepositor;
this._customerOrgGroupDetailManager = customerOrgGroupDetailManager;
@ -55,11 +55,11 @@ namespace Shentun.Peis.CustomerOrgGroups
CustomerOrgGroup entity
)
{
//DataHelper.CheckVerifyData(entity.DisplayName, "名称");
//await EntityHelper.CheckSameName<CustomerOrgGroup, Guid>(_repository, entity.DisplayName);
//var customerorgRegisterEnt = await _customerorgRegisterRepository.FindAsync(m => m.CustomerOrgId == customerOrgId && m.IsComplete == 'N');
if (customerOrgId != null && customerOrgId != Guid.Empty)
{
//检查单位状态
await CheckCustomerOrgStatus(customerOrgId.Value);
}
Guid NewCustomerorgRegisterId = Guid.Empty;
if (IsMaxMedicalTimes == 'Y')
{
@ -127,15 +127,7 @@ namespace Shentun.Peis.CustomerOrgGroups
/// <summary>
/// 修改排序 相邻之间
/// </summary>
/// <param name="id">需要修改的ID</param>
/// <param name="targetid">目标ID</param>
public async Task UpdateSortAsync(Guid id, Guid targetid)
{
await EntityHelper.UpdateSort(_repository, id, targetid);
}
/// <summary>
/// 修改排序 置顶,置底
@ -213,7 +205,7 @@ namespace Shentun.Peis.CustomerOrgGroups
/// <summary>
/// 检查体检次数状态 如果已完成 就不能行操作
/// 检查体检次数状态 如果已完成 就不能行操作
/// </summary>
/// <param name="CustomerOrgRegisterId"></param>
/// <returns></returns>
@ -225,5 +217,20 @@ namespace Shentun.Peis.CustomerOrgGroups
throw new UserFriendlyException("当前分组的体检次数已完成,无法操作!");
}
}
/// <summary>
/// 检查单位状态是否可以使用
/// </summary>
/// <param name="CustomerOrgId"></param>
/// <returns></returns>
private async Task CheckCustomerOrgStatus(Guid CustomerOrgId)
{
var customerOrgEntity = await _customerOrgRepository.FirstOrDefaultAsync(f => f.Id == CustomerOrgId && (f.IsLock == 'Y' || f.IsActive == 'N'));
if (customerOrgEntity != null)
{
throw new UserFriendlyException("当前单位未启用或者已锁定,无法操作!");
}
}
}
}

18
src/Shentun.Peis.Domain/CustomerOrgRegisters/CustomerOrgRegisterManager.cs

@ -24,6 +24,7 @@ namespace Shentun.Peis.CustomerOrgRegisters
private readonly IRepository<CustomerOrgRegister, Guid> _repository;
private readonly IRepository<CustomerOrg, Guid> _customerOrgRepository;
private readonly IRepository<CustomerOrgGroup, Guid> _customerOrgGroupRepository;
private readonly IRepository<PatientRegister, Guid> _patientRegisterRepository;
private readonly CustomerOrgGroupManager _customerOrgGroupManager;
public CustomerOrgRegisterManager(
@ -31,12 +32,14 @@ namespace Shentun.Peis.CustomerOrgRegisters
IRepository<CustomerOrg, Guid> customerOrgRepository,
IRepository<CustomerOrgGroup, Guid> customerOrgGroupRepository,
CustomerOrgGroupManager customerOrgGroupManager
)
,
IRepository<PatientRegister, Guid> patientRegisterRepository)
{
_repository = repository;
this._customerOrgRepository = customerOrgRepository;
this._customerOrgGroupRepository = customerOrgGroupRepository;
this._customerOrgGroupManager = customerOrgGroupManager;
this._patientRegisterRepository = patientRegisterRepository;
}
/// <summary>
/// 创建
@ -136,7 +139,8 @@ namespace Shentun.Peis.CustomerOrgRegisters
RegisterNo = ""
};
return await _repository.InsertAsync(entity);
return entity;
// return await _repository.InsertAsync(entity);
}
/// <summary>
@ -184,13 +188,23 @@ namespace Shentun.Peis.CustomerOrgRegisters
public async Task CheckAndDeleteAsync(Guid id)
{
var customerOrgRegisterEnt = await _repository.FirstOrDefaultAsync(m => m.Id == id);
if (customerOrgRegisterEnt != null)
{
var patientRegisterEntity =await _patientRegisterRepository.FirstOrDefaultAsync(m => m.CustomerOrgRegisterId == id);
if (patientRegisterEntity != null)
{
throw new UserFriendlyException($"单位体检次数\"{customerOrgRegisterEnt.MedicalTimes}\"已被{patientRegisterEntity.PatientName}登记使用,不能删除");
}
if (customerOrgRegisterEnt.IsComplete == 'Y')
{
throw new UserFriendlyException($"单位体检次数\"{customerOrgRegisterEnt.MedicalTimes}\"已完成,不能删除");
}
var customerOrgGroups = await _customerOrgGroupRepository.GetListAsync(m => m.CustomerOrgRegisterId == id);
if (customerOrgGroups.Any())

10
src/Shentun.Peis.Domain/CustomerOrgTypes/CustomerOrgTypeManager.cs

@ -69,15 +69,7 @@ namespace Shentun.Peis.CustomerOrgTypes
}
/// <summary>
/// 修改排序 相邻之间
/// </summary>
/// <param name="id">需要修改的ID</param>
/// <param name="targetid">目标ID</param>
public async Task UpdateSortAsync(Guid id, Guid targetid)
{
await EntityHelper.UpdateSort(_repository, id, targetid);
}
/// <summary>
/// 修改排序 置顶,置底

Loading…
Cancel
Save