|
@@ -1,10 +1,13 @@
|
|
|
using Hotline.Permissions;
|
|
|
using Hotline.Settings;
|
|
|
using Hotline.Share.Dtos.Org;
|
|
|
+using Hotline.Share.Enums.Order;
|
|
|
using MapsterMapper;
|
|
|
using Microsoft.AspNetCore.Authorization;
|
|
|
using Microsoft.AspNetCore.Mvc;
|
|
|
+using System.Threading.Channels;
|
|
|
using XF.Domain.Exceptions;
|
|
|
+using XF.Utility.EnumExtensions;
|
|
|
|
|
|
namespace Hotline.Api.Controllers
|
|
|
{
|
|
@@ -51,9 +54,7 @@ namespace Hotline.Api.Controllers
|
|
|
var org = _mapper.Map<SystemOrganize>(dto);
|
|
|
//验证名称是否重复
|
|
|
if (await _systemDomainService.IsNameRepeat(dto.OrgName, HttpContext.RequestAborted))
|
|
|
- {
|
|
|
throw UserFriendlyException.SameMessage("组织名称重复");
|
|
|
- }
|
|
|
//处理编码
|
|
|
org.OrgCode = await _systemDomainService.GenerateNewOrgCodeAsync(dto.ParentId, HttpContext.RequestAborted);
|
|
|
//org.OrgCode = await _systemOrganizeRepository.GetNewOrgCode(org.ParentId);
|
|
@@ -77,9 +78,7 @@ namespace Hotline.Api.Controllers
|
|
|
throw UserFriendlyException.SameMessage("父级不能为自己");
|
|
|
//验证名称是否重复
|
|
|
if (await _systemDomainService.IsNameRepeat(dto.OrgName, HttpContext.RequestAborted))
|
|
|
- {
|
|
|
throw UserFriendlyException.SameMessage("组织名称重复");
|
|
|
- }
|
|
|
_mapper.Map(dto, org);
|
|
|
await _systemOrganizeRepository.UpdateAsync(org, HttpContext.RequestAborted);
|
|
|
}
|
|
@@ -109,5 +108,19 @@ namespace Hotline.Api.Controllers
|
|
|
{
|
|
|
return await _systemOrganizeRepository.GetCanUseOrg();
|
|
|
}
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 新增页面基础数据
|
|
|
+ /// </summary>
|
|
|
+ /// <returns></returns>
|
|
|
+ [HttpGet("base-data-add")]
|
|
|
+ public async Task<object> BaseDataAdd()
|
|
|
+ {
|
|
|
+ var rep = new
|
|
|
+ {
|
|
|
+ OrgType = EnumExts.GetDescriptions<EOrgType>()
|
|
|
+ };
|
|
|
+ return rep;
|
|
|
+ }
|
|
|
}
|
|
|
}
|