根据id获取组织扩展属性接口

This commit is contained in:
2023-08-01 17:04:23 +08:00
parent de2ad9b2d0
commit 1e21885da5
2 changed files with 75 additions and 18 deletions

View File

@@ -1,10 +1,12 @@
using Aop.Api.Domain;
using System.Collections;
using Aop.Api.Domain;
using JNPF.Common.Core.Manager;
using JNPF.Common.Enums;
using JNPF.Common.Filter;
using JNPF.Common.Security;
using JNPF.DependencyInjection;
using JNPF.DynamicApiController;
using JNPF.Extras.CollectiveOAuth.Models;
using JNPF.FriendlyException;
using JNPF.Logging;
using JNPF.Systems.Entitys.Dto.Department;
@@ -609,6 +611,61 @@ public class DepartmentService : IDepartmentService, IDynamicApiController, ITra
if (!(isOk > 0)) throw Oops.Oh(ErrorCode.D2016);
}
/// <summary>
/// 根据id获取组织扩展属性
/// </summary>
/// <param name="id"></param>
/// <param name="type"></param>
/// <returns></returns>
[HttpPost]
public async Task<dynamic> GetFpropertyjsonById(Dictionary<string,string> dic)
{
string id = dic["id"];
string type = dic["type"];
var organizeEntity = await _repository.GetSingleAsync(x => x.Id == id);
if (organizeEntity != null && !string.IsNullOrEmpty(organizeEntity.PropertyJson))
{
Dictionary<string, object> dictionary =
JsonConvert.DeserializeObject<Dictionary<string, object>>(organizeEntity.PropertyJson);
if (type == "1")
{
if (dictionary.TryGetValue("roweqp", out var value))
{
List<EqpEquipment> eqpEquipments = JsonConvert.DeserializeObject<List<EqpEquipment>>(JsonConvert.SerializeObject(value));
return new AuthResponse(200, "", new Dictionary<string,object>()
{
["list"] = eqpEquipments.Select(x=>new
{
id = x.id,
code = x.code,
name = x.name
}).ToList(),
});
}
}
else
{
if (dictionary.TryGetValue("rowprocess", out var value))
{
List<BasProcess> eqpEquipments = JsonConvert.DeserializeObject<List<BasProcess>>(JsonConvert.SerializeObject(value));
return new AuthResponse(200, "", new Dictionary<string,object>()
{
["list"] = eqpEquipments.Select(x=>new
{
id = x.id,
code = x.process_code,
name = x.process_name
}).ToList(),
});
}
}
}
return new AuthResponse(200, "", new Dictionary<string,object>()
{
["list"] = Enumerable.Empty<int>()
});
}
#endregion
#region PublicMethod