merge from 2023-03-14

This commit is contained in:
2023-03-24 09:37:07 +08:00
parent f95ef4cf73
commit 3de92dab06
57 changed files with 1538 additions and 528 deletions

View File

@@ -87,6 +87,10 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tnb.Extend.Entitys", "exten
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tnb.Extend.Interfaces", "extend\Tnb.Extend.Interfaces\Tnb.Extend.Interfaces.csproj", "{2E9F8B23-37B9-42BD-A62F-140A38C43A89}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tnb.Core", "..\Tnb.Core\src\Tnb.Core\Tnb.Core.csproj", "{6CE14DF1-4AC2-4E21-8910-1898BF7C2C6E}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tnb.SqlSugar", "..\Tnb.Core\src\Tnb.SqlSugar\Tnb.SqlSugar.csproj", "{8144C78D-AF9A-4C1B-8A18-CCD78B26D870}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@@ -209,6 +213,14 @@ Global
{2E9F8B23-37B9-42BD-A62F-140A38C43A89}.Debug|Any CPU.Build.0 = Debug|Any CPU
{2E9F8B23-37B9-42BD-A62F-140A38C43A89}.Release|Any CPU.ActiveCfg = Release|Any CPU
{2E9F8B23-37B9-42BD-A62F-140A38C43A89}.Release|Any CPU.Build.0 = Release|Any CPU
{6CE14DF1-4AC2-4E21-8910-1898BF7C2C6E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{6CE14DF1-4AC2-4E21-8910-1898BF7C2C6E}.Debug|Any CPU.Build.0 = Debug|Any CPU
{6CE14DF1-4AC2-4E21-8910-1898BF7C2C6E}.Release|Any CPU.ActiveCfg = Release|Any CPU
{6CE14DF1-4AC2-4E21-8910-1898BF7C2C6E}.Release|Any CPU.Build.0 = Release|Any CPU
{8144C78D-AF9A-4C1B-8A18-CCD78B26D870}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{8144C78D-AF9A-4C1B-8A18-CCD78B26D870}.Debug|Any CPU.Build.0 = Debug|Any CPU
{8144C78D-AF9A-4C1B-8A18-CCD78B26D870}.Release|Any CPU.ActiveCfg = Release|Any CPU
{8144C78D-AF9A-4C1B-8A18-CCD78B26D870}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE

View File

@@ -28,6 +28,13 @@ public static class LoggingConfigureExtensions
writeError.UseRollbackFileName(Path.GetFileNameWithoutExtension(writeError.CurrentFileName) + "-oops" + Path.GetExtension(writeError.CurrentFileName));
};
});
// 日志监听
// services.AddMonitorLogging(options =>
//{
// options.IgnorePropertyNames = new[] { "Byte" };
// options.IgnorePropertyTypes = new[] { typeof(byte[]) };
//});
return services;
}
private static string LoggerLevelName(LogLevel level)

View File

@@ -1,31 +1,26 @@
using JNPF.API.Entry.Handlers;
using IGeekFan.AspNetCore.Knife4jUI;
using JNPF.API.Entry.Handlers;
using JNPF.Common.Cache;
using JNPF.Common.Core.Filter;
using JNPF.Common.Core.Handlers;
using JNPF.Common.Security;
using JNPF.DatabaseAccessor;
using JNPF.EventHandler;
using JNPF.JsonSerialization;
using JNPF.Message.Handlers;
using JNPF.SpecificationDocument;
using JNPF.TaskScheduler.Interfaces.TaskScheduler;
using JNPF.UnifyResult;
using JNPF.VisualDev;
using Microsoft.AspNetCore.HttpOverrides;
using Microsoft.Extensions.Options;
using Newtonsoft.Json.Serialization;
using Newtonsoft.Json;
using Senparc.CO2NET.RegisterServices;
using Newtonsoft.Json.Serialization;
using Senparc.CO2NET;
using Senparc.CO2NET.RegisterServices;
using Senparc.Weixin;
using Senparc.Weixin.Entities;
using Senparc.Weixin.RegisterServices;
using SqlSugar;
using IGeekFan.AspNetCore.Knife4jUI;
using JNPF.SpecificationDocument;
using JNPF.Logging;
using System.Xml;
using System;
using System.Text;
using Top.Api;
using JNPF.Common.Security;
using JNPF.VisualDev;
namespace JNPF.API.Entry;
@@ -137,12 +132,6 @@ public class Startup : AppStartup
services.AddMemoryCache(); // 使用本地缓存必须添加
services.LoggingConfigure();
// 日志监听
// services.AddMonitorLogging(options =>
//{
// options.IgnorePropertyNames = new[] { "Byte" };
// options.IgnorePropertyTypes = new[] { typeof(byte[]) };
//});
services.AddUnitOfWork<SqlSugarUnitOfWork>();

View File

@@ -20,7 +20,7 @@ using JNPF.WebSockets;
using Mapster;
using SqlSugar;
namespace JNPF.Message.Handlers;
namespace JNPF.Common.Core.Handlers;
/// <summary>
/// IM 处理程序.

View File

@@ -13,7 +13,6 @@ using JNPF.Systems.Entitys.Permission;
using JNPF.Systems.Entitys.System;
using Microsoft.AspNetCore.Http;
using SqlSugar;
using System.Net.Http;
using System.Security.Claims;
namespace JNPF.Common.Core.Manager;
@@ -206,7 +205,7 @@ public class UserManager : IUserManager, IScoped
UserAgent userAgent = new UserAgent(_httpContext);
var data = new UserInfoModel();
var ipAddress = NetHelper.Ip;
//var ipAddressName = await NetHelper.GetLocation(ipAddress);
var ipAddressName = await NetHelper.GetLocation(ipAddress);
var userDataScope = await GetUserDataScopeAsync(UserId);
var sysConfigInfo = await _repository.AsSugarClient().Queryable<SysConfigEntity>().FirstAsync(s => s.Category.Equals("SysConfig") && s.Key.ToLower().Equals("tokentimeout"));
data = await _repository.AsQueryable().Where(it => it.Id == UserId)
@@ -252,8 +251,8 @@ public class UserManager : IUserManager, IScoped
data.loginTime = DateTime.Now;
data.prevLogin = (await _repository.AsSugarClient().Queryable<SysConfigEntity>().FirstAsync(x => x.Category.Equals("SysConfig") && x.Key.ToLower().Equals("lastlogintimeswitch"))).Value.ParseToInt();
data.loginIPAddress = ipAddress;
//data.loginIPAddressName = ipAddressName;
//data.prevLoginIPAddressName = await NetHelper.GetLocation(data.prevLoginIPAddress);
data.loginIPAddressName = ipAddressName;
data.prevLoginIPAddressName = await NetHelper.GetLocation(data.prevLoginIPAddress);
data.loginPlatForm = userAgent.RawValue;
data.subsidiary = await GetSubsidiaryAsync(data.organizeId, data.isAdministrator);
data.subordinates = await this.GetSubordinatesAsync(UserId);
@@ -501,11 +500,13 @@ public class UserManager : IUserManager, IScoped
var itemValue = fieldItem.Value;
var itemMethod = (QueryType)System.Enum.Parse(typeof(QueryType), fieldItem.Op);
var cmodel = GetConditionalModel(itemMethod, itemField, User.OrganizeId);
if (itemMethod.Equals(QueryType.Equal)) cmodel.ConditionalType = ConditionalType.Like;
if (itemMethod.Equals(QueryType.NotEqual)) cmodel.ConditionalType = ConditionalType.NoLike;
switch (itemValue)
{
case "@userId": // 当前用户
{
var cmodel = GetConditionalModel(itemMethod, itemField, userInfo.userId);
switch (conditionItem.Logic)
{
case "and":
@@ -524,17 +525,29 @@ public class UserManager : IUserManager, IScoped
{
var ids = new List<string>() { userInfo.userId };
ids.AddRange(userInfo.subordinates);
var cmodel = GetConditionalModel(itemMethod, itemField, string.Join(",", ids));
switch (conditionItem.Logic)
for (int i = 0; i < ids.Count; i++)
{
case "and":
conditionalList.Add(new { Key = (int)WhereType.And, Value = new { FieldName = itemField, FieldValue = string.Join(",", ids), ConditionalType = (int)cmodel.ConditionalType } });
if (i == 0)
{
switch (conditionItem.Logic)
{
case "and":
conditionalList.Add(new { Key = (int)WhereType.And, Value = new { FieldName = itemField, FieldValue = ids[i], ConditionalType = (int)cmodel.ConditionalType } });
break;
case "or":
conditionalList.Add(new { Key = (int)WhereType.Or, Value = new { FieldName = itemField, FieldValue = string.Join(",", ids), ConditionalType = (int)cmodel.ConditionalType } });
break;
case "or":
conditionalList.Add(new { Key = (int)WhereType.Or, Value = new { FieldName = itemField, FieldValue = ids[i], ConditionalType = (int)cmodel.ConditionalType } });
break;
break;
}
}
else
{
if (itemMethod.Equals(QueryType.NotEqual) || itemMethod.Equals(QueryType.NotIncluded))
conditionalList.Add(new { Key = (int)WhereType.And, Value = new { FieldName = itemField, FieldValue = ids[i], ConditionalType = (int)cmodel.ConditionalType } });
else
conditionalList.Add(new { Key = (int)WhereType.Or, Value = new { FieldName = itemField, FieldValue = ids[i], ConditionalType = (int)cmodel.ConditionalType } });
}
}
}
@@ -543,7 +556,6 @@ public class UserManager : IUserManager, IScoped
{
if (!string.IsNullOrEmpty(userInfo.organizeId))
{
var cmodel = GetConditionalModel(itemMethod, itemField, userInfo.organizeId);
switch (conditionItem.Logic)
{
case "and":
@@ -554,7 +566,6 @@ public class UserManager : IUserManager, IScoped
break;
}
}
}
break;
@@ -564,17 +575,29 @@ public class UserManager : IUserManager, IScoped
{
var ids = new List<string>() { userInfo.organizeId };
ids.AddRange(userInfo.subsidiary);
var cmodel = GetConditionalModel(itemMethod, itemField, string.Join(",", ids));
switch (conditionItem.Logic)
for (int i = 0; i < ids.Count; i++)
{
case "and":
conditionalList.Add(new { Key = (int)WhereType.And, Value = new { FieldName = itemField, FieldValue = string.Join(",", ids), ConditionalType = (int)cmodel.ConditionalType } });
if (i == 0)
{
switch (conditionItem.Logic)
{
case "and":
conditionalList.Add(new { Key = (int)WhereType.And, Value = new { FieldName = itemField, FieldValue = ids[i], ConditionalType = (int)cmodel.ConditionalType } });
break;
case "or":
conditionalList.Add(new { Key = (int)WhereType.Or, Value = new { FieldName = itemField, FieldValue = string.Join(",", ids), ConditionalType = (int)cmodel.ConditionalType } });
break;
case "or":
conditionalList.Add(new { Key = (int)WhereType.Or, Value = new { FieldName = itemField, FieldValue = ids[i], ConditionalType = (int)cmodel.ConditionalType } });
break;
break;
}
}
else
{
if (itemMethod.Equals(QueryType.NotEqual) || itemMethod.Equals(QueryType.NotIncluded))
conditionalList.Add(new { Key = (int)WhereType.And, Value = new { FieldName = itemField, FieldValue = ids[i], ConditionalType = (int)cmodel.ConditionalType } });
else
conditionalList.Add(new { Key = (int)WhereType.Or, Value = new { FieldName = itemField, FieldValue = ids[i], ConditionalType = (int)cmodel.ConditionalType } });
}
}
}
}
@@ -583,43 +606,79 @@ public class UserManager : IUserManager, IScoped
case "@branchManageOrganize": // 当前分管组织
{
var orgId = DataScope.Where(x => x.Select).Select(x => x.organizeId).ToList();
if (orgId != null)
var ids = DataScope.Where(x => x.Select).Select(x => x.organizeId).ToList();
if (ids != null)
{
var cmodel = GetConditionalModel(itemMethod, itemField, string.Join(",", orgId));
switch (conditionItem.Logic)
for (int i = 0; i < ids.Count; i++)
{
case "and":
conditionalList.Add(new { Key = (int)WhereType.And, Value = new { FieldName = itemField, FieldValue = string.Join(",", orgId), ConditionalType = (int)cmodel.ConditionalType } });
break;
case "or":
conditionalList.Add(new { Key = (int)WhereType.Or, Value = new { FieldName = itemField, FieldValue = string.Join(",", orgId), ConditionalType = (int)cmodel.ConditionalType } });
break;
if (i == 0)
{
switch (conditionItem.Logic)
{
case "and":
conditionalList.Add(new { Key = (int)WhereType.And, Value = new { FieldName = itemField, FieldValue = ids[i], ConditionalType = (int)cmodel.ConditionalType } });
break;
case "or":
conditionalList.Add(new { Key = (int)WhereType.Or, Value = new { FieldName = itemField, FieldValue = ids[i], ConditionalType = (int)cmodel.ConditionalType } });
break;
}
}
else
{
if (itemMethod.Equals(QueryType.NotEqual) || itemMethod.Equals(QueryType.NotIncluded))
conditionalList.Add(new { Key = (int)WhereType.And, Value = new { FieldName = itemField, FieldValue = ids[i], ConditionalType = (int)cmodel.ConditionalType } });
else
conditionalList.Add(new { Key = (int)WhereType.Or, Value = new { FieldName = itemField, FieldValue = ids[i], ConditionalType = (int)cmodel.ConditionalType } });
}
}
}
else
{
conditionalList.Add(new { Key = (int)WhereType.Or, Value = new { FieldName = itemField, FieldValue = "jnpf", ConditionalType = (int)ConditionalType.Equal } });
}
}
break;
case "@branchManageOrganizeAndSub": // 当前分管组织及子组织
{
var subOrgIds = new List<string>();
var ids = new List<string>();
DataScope.Where(x => x.Select).Select(x => x.organizeId).ToList()
.ForEach(item => subOrgIds.AddRange(_repository.AsSugarClient().Queryable<OrganizeEntity>().Where(x => x.OrganizeIdTree.Contains(item)).Select(x => x.Id).ToList()));
.ForEach(item => ids.AddRange(_repository.AsSugarClient().Queryable<OrganizeEntity>().Where(x => x.OrganizeIdTree.Contains(item)).Select(x => x.Id).ToList()));
if (subOrgIds.Any())
if (ids.Any())
{
var cmodel = GetConditionalModel(itemMethod, itemField, string.Join(",", subOrgIds));
switch (conditionItem.Logic)
for (int i = 0; i < ids.Count; i++)
{
case "and":
conditionalList.Add(new { Key = (int)WhereType.And, Value = new { FieldName = itemField, FieldValue = string.Join(",", subOrgIds), ConditionalType = (int)cmodel.ConditionalType } });
break;
case "or":
conditionalList.Add(new { Key = (int)WhereType.Or, Value = new { FieldName = itemField, FieldValue = string.Join(",", subOrgIds), ConditionalType = (int)cmodel.ConditionalType } });
break;
if (i == 0)
{
switch (conditionItem.Logic)
{
case "and":
conditionalList.Add(new { Key = (int)WhereType.And, Value = new { FieldName = itemField, FieldValue = ids[i], ConditionalType = (int)cmodel.ConditionalType } });
break;
case "or":
conditionalList.Add(new { Key = (int)WhereType.Or, Value = new { FieldName = itemField, FieldValue = ids[i], ConditionalType = (int)cmodel.ConditionalType } });
break;
}
}
else
{
if (itemMethod.Equals(QueryType.NotEqual) || itemMethod.Equals(QueryType.NotIncluded))
conditionalList.Add(new { Key = (int)WhereType.And, Value = new { FieldName = itemField, FieldValue = ids[i], ConditionalType = (int)cmodel.ConditionalType } });
else
conditionalList.Add(new { Key = (int)WhereType.Or, Value = new { FieldName = itemField, FieldValue = ids[i], ConditionalType = (int)cmodel.ConditionalType } });
}
}
}
else
{
conditionalList.Add(new { Key = (int)WhereType.Or, Value = new { FieldName = itemField, FieldValue = "jnpf", ConditionalType = (int)ConditionalType.Equal } });
}
}
break;
@@ -628,9 +687,9 @@ public class UserManager : IUserManager, IScoped
{
if (!string.IsNullOrEmpty(itemValue))
{
var cmodel = GetConditionalModel(itemMethod, itemField, itemValue, fieldItem.Type);
if (cmodel.ConditionalType.Equals(ConditionalType.In)) cmodel.ConditionalType = ConditionalType.Like;
if (cmodel.ConditionalType.Equals(ConditionalType.NotIn)) cmodel.ConditionalType = ConditionalType.NoLike;
var defCmodel = GetConditionalModel(itemMethod, itemField, itemValue, fieldItem.Type);
if (defCmodel.ConditionalType.Equals(ConditionalType.In)) defCmodel.ConditionalType = ConditionalType.Like;
if (defCmodel.ConditionalType.Equals(ConditionalType.NotIn)) defCmodel.ConditionalType = ConditionalType.NoLike;
switch (conditionItem.Logic)
{
case "and":
@@ -646,6 +705,8 @@ public class UserManager : IUserManager, IScoped
break;
}
if (itemMethod.Equals(QueryType.NotEqual) || itemMethod.Equals(QueryType.NotIncluded))
conditionalList.Add(new { Key = (int)WhereType.Or, Value = new { FieldName = itemField, FieldValue = string.Empty, ConditionalType = ConditionalType.IsNullOrEmpty } });
}
if (conditionalList.Any())
@@ -749,19 +810,21 @@ public class UserManager : IUserManager, IScoped
var itemValue = fieldItem.Value;
var itemMethod = (QueryType)System.Enum.Parse(typeof(QueryType), fieldItem.Op);
var cmodel = GetConditionalModel(itemMethod, itemField, User.OrganizeId);
if (itemMethod.Equals(QueryType.Equal)) cmodel.ConditionalType = ConditionalType.Like;
if (itemMethod.Equals(QueryType.NotEqual)) cmodel.ConditionalType = ConditionalType.NoLike;
switch (itemValue)
{
case "@userId": // 当前用户
{
var cmodel = GetConditionalModel(itemMethod, itemField, userInfo.userId);
switch (conditionItem.Logic)
{
case "and":
conditionalList.Add(new { Key = (int)WhereType.And, Value = new { FieldName = itemField, FieldValue = userInfo.userId, ConditionalType = (int)cmodel.ConditionalType } });
conditionalList.Add(new { Key = (int)WhereType.And, Value = new { FieldName = itemField, FieldValue = UserId, ConditionalType = (int)cmodel.ConditionalType } });
break;
case "or":
conditionalList.Add(new { Key = (int)WhereType.Or, Value = new { FieldName = itemField, FieldValue = userInfo.userId, ConditionalType = (int)cmodel.ConditionalType } });
conditionalList.Add(new { Key = (int)WhereType.Or, Value = new { FieldName = itemField, FieldValue = UserId, ConditionalType = (int)cmodel.ConditionalType } });
break;
}
@@ -770,59 +833,81 @@ public class UserManager : IUserManager, IScoped
break;
case "@userAraSubordinates": // 当前用户集下属
{
var ids = new List<string>() { userInfo.userId };
ids.AddRange(userInfo.subordinates);
var cmodel = GetConditionalModel(itemMethod, itemField, string.Join(",", ids));
switch (conditionItem.Logic)
var ids = new List<string>() { UserId };
ids.AddRange(Subordinates);
for (int i = 0; i < ids.Count; i++)
{
case "and":
conditionalList.Add(new { Key = (int)WhereType.And, Value = new { FieldName = itemField, FieldValue = string.Join(",", ids), ConditionalType = (int)cmodel.ConditionalType } });
if (i == 0)
{
switch (conditionItem.Logic)
{
case "and":
conditionalList.Add(new { Key = (int)WhereType.And, Value = new { FieldName = itemField, FieldValue = ids[i], ConditionalType = (int)cmodel.ConditionalType } });
break;
case "or":
conditionalList.Add(new { Key = (int)WhereType.Or, Value = new { FieldName = itemField, FieldValue = string.Join(",", ids), ConditionalType = (int)cmodel.ConditionalType } });
break;
case "or":
conditionalList.Add(new { Key = (int)WhereType.Or, Value = new { FieldName = itemField, FieldValue = ids[i], ConditionalType = (int)cmodel.ConditionalType } });
break;
break;
}
}
else
{
if (itemMethod.Equals(QueryType.NotEqual) || itemMethod.Equals(QueryType.NotIncluded))
conditionalList.Add(new { Key = (int)WhereType.And, Value = new { FieldName = itemField, FieldValue = ids[i], ConditionalType = (int)cmodel.ConditionalType } });
else
conditionalList.Add(new { Key = (int)WhereType.Or, Value = new { FieldName = itemField, FieldValue = ids[i], ConditionalType = (int)cmodel.ConditionalType } });
}
}
}
break;
case "@organizeId": // 当前组织
{
if (!string.IsNullOrEmpty(userInfo.organizeId))
if (!string.IsNullOrEmpty(User.OrganizeId))
{
var cmodel = GetConditionalModel(itemMethod, itemField, userInfo.organizeId);
switch (conditionItem.Logic)
{
case "and":
conditionalList.Add(new { Key = (int)WhereType.And, Value = new { FieldName = itemField, FieldValue = userInfo.organizeId, ConditionalType = (int)cmodel.ConditionalType } });
conditionalList.Add(new { Key = (int)WhereType.And, Value = new { FieldName = itemField, FieldValue = User.OrganizeId, ConditionalType = (int)cmodel.ConditionalType } });
break;
case "or":
conditionalList.Add(new { Key = (int)WhereType.Or, Value = new { FieldName = itemField, FieldValue = userInfo.organizeId, ConditionalType = (int)cmodel.ConditionalType } });
conditionalList.Add(new { Key = (int)WhereType.Or, Value = new { FieldName = itemField, FieldValue = User.OrganizeId, ConditionalType = (int)cmodel.ConditionalType } });
break;
}
}
}
break;
case "@organizationAndSuborganization": // 当前组织及子组织
{
if (!string.IsNullOrEmpty(userInfo.organizeId))
if (!string.IsNullOrEmpty(User.OrganizeId))
{
var ids = new List<string>() { userInfo.organizeId };
ids.AddRange(userInfo.subsidiary);
var cmodel = GetConditionalModel(itemMethod, itemField, string.Join(",", ids));
switch (conditionItem.Logic)
var ids = new List<string>() { User.OrganizeId };
ids.AddRange(Subsidiary);
for (int i = 0; i < ids.Count; i++)
{
case "and":
conditionalList.Add(new { Key = (int)WhereType.And, Value = new { FieldName = itemField, FieldValue = string.Join(",", ids), ConditionalType = (int)cmodel.ConditionalType } });
if (i == 0)
{
switch (conditionItem.Logic)
{
case "and":
conditionalList.Add(new { Key = (int)WhereType.And, Value = new { FieldName = itemField, FieldValue = ids[i], ConditionalType = (int)cmodel.ConditionalType } });
break;
case "or":
conditionalList.Add(new { Key = (int)WhereType.Or, Value = new { FieldName = itemField, FieldValue = string.Join(",", ids), ConditionalType = (int)cmodel.ConditionalType } });
break;
case "or":
conditionalList.Add(new { Key = (int)WhereType.Or, Value = new { FieldName = itemField, FieldValue = ids[i], ConditionalType = (int)cmodel.ConditionalType } });
break;
break;
}
}
else
{
if (itemMethod.Equals(QueryType.NotEqual) || itemMethod.Equals(QueryType.NotIncluded))
conditionalList.Add(new { Key = (int)WhereType.And, Value = new { FieldName = itemField, FieldValue = ids[i], ConditionalType = (int)cmodel.ConditionalType } });
else
conditionalList.Add(new { Key = (int)WhereType.Or, Value = new { FieldName = itemField, FieldValue = ids[i], ConditionalType = (int)cmodel.ConditionalType } });
}
}
}
}
@@ -831,18 +916,32 @@ public class UserManager : IUserManager, IScoped
case "@branchManageOrganize": // 当前分管组织
{
var orgId = DataScope.Where(x => x.Select).Select(x => x.organizeId).ToList();
if (orgId != null)
var ids = DataScope.Where(x => x.Select).Select(x => x.organizeId).ToList();
if (ids != null)
{
var cmodel = GetConditionalModel(itemMethod, itemField, string.Join(",", orgId));
switch (conditionItem.Logic)
for (int i = 0; i < ids.Count; i++)
{
case "and":
conditionalList.Add(new { Key = (int)WhereType.And, Value = new { FieldName = itemField, FieldValue = string.Join(",", orgId), ConditionalType = (int)cmodel.ConditionalType } });
break;
case "or":
conditionalList.Add(new { Key = (int)WhereType.Or, Value = new { FieldName = itemField, FieldValue = string.Join(",", orgId), ConditionalType = (int)cmodel.ConditionalType } });
break;
if (i == 0)
{
switch (conditionItem.Logic)
{
case "and":
conditionalList.Add(new { Key = (int)WhereType.And, Value = new { FieldName = itemField, FieldValue = ids[i], ConditionalType = (int)cmodel.ConditionalType } });
break;
case "or":
conditionalList.Add(new { Key = (int)WhereType.Or, Value = new { FieldName = itemField, FieldValue = ids[i], ConditionalType = (int)cmodel.ConditionalType } });
break;
}
}
else
{
if (itemMethod.Equals(QueryType.NotEqual) || itemMethod.Equals(QueryType.NotIncluded))
conditionalList.Add(new { Key = (int)WhereType.And, Value = new { FieldName = itemField, FieldValue = ids[i], ConditionalType = (int)cmodel.ConditionalType } });
else
conditionalList.Add(new { Key = (int)WhereType.Or, Value = new { FieldName = itemField, FieldValue = ids[i], ConditionalType = (int)cmodel.ConditionalType } });
}
}
}
else
@@ -855,21 +954,35 @@ public class UserManager : IUserManager, IScoped
case "@branchManageOrganizeAndSub": // 当前分管组织及子组织
{
var subOrgIds = new List<string>();
var ids = new List<string>();
DataScope.Where(x => x.Select).Select(x => x.organizeId).ToList()
.ForEach(item => subOrgIds.AddRange(_repository.AsSugarClient().Queryable<OrganizeEntity>().Where(x => x.OrganizeIdTree.Contains(item)).Select(x => x.Id).ToList()));
.ForEach(item => ids.AddRange(_repository.AsSugarClient().Queryable<OrganizeEntity>().Where(x => x.OrganizeIdTree.Contains(item)).Select(x => x.Id).ToList()));
if (subOrgIds.Any())
if (ids.Any())
{
var cmodel = GetConditionalModel(itemMethod, itemField, string.Join(",", subOrgIds));
switch (conditionItem.Logic)
for (int i = 0; i < ids.Count; i++)
{
case "and":
conditionalList.Add(new { Key = (int)WhereType.And, Value = new { FieldName = itemField, FieldValue = string.Join(",", subOrgIds), ConditionalType = (int)cmodel.ConditionalType } });
break;
case "or":
conditionalList.Add(new { Key = (int)WhereType.Or, Value = new { FieldName = itemField, FieldValue = string.Join(",", subOrgIds), ConditionalType = (int)cmodel.ConditionalType } });
break;
if (i == 0)
{
switch (conditionItem.Logic)
{
case "and":
conditionalList.Add(new { Key = (int)WhereType.And, Value = new { FieldName = itemField, FieldValue = ids[i], ConditionalType = (int)cmodel.ConditionalType } });
break;
case "or":
conditionalList.Add(new { Key = (int)WhereType.Or, Value = new { FieldName = itemField, FieldValue = ids[i], ConditionalType = (int)cmodel.ConditionalType } });
break;
}
}
else
{
if (itemMethod.Equals(QueryType.NotEqual) || itemMethod.Equals(QueryType.NotIncluded))
conditionalList.Add(new { Key = (int)WhereType.And, Value = new { FieldName = itemField, FieldValue = ids[i], ConditionalType = (int)cmodel.ConditionalType } });
else
conditionalList.Add(new { Key = (int)WhereType.Or, Value = new { FieldName = itemField, FieldValue = ids[i], ConditionalType = (int)cmodel.ConditionalType } });
}
}
}
else
@@ -884,16 +997,16 @@ public class UserManager : IUserManager, IScoped
{
if (!string.IsNullOrEmpty(itemValue))
{
var cmodel = GetConditionalModel(itemMethod, itemField, itemValue, fieldItem.Type);
if (cmodel.ConditionalType.Equals(ConditionalType.In)) cmodel.ConditionalType = ConditionalType.Like;
if (cmodel.ConditionalType.Equals(ConditionalType.NotIn)) cmodel.ConditionalType = ConditionalType.NoLike;
var defCmodel = GetConditionalModel(itemMethod, itemField, itemValue, fieldItem.Type);
if (defCmodel.ConditionalType.Equals(ConditionalType.In)) defCmodel.ConditionalType = ConditionalType.Like;
if (defCmodel.ConditionalType.Equals(ConditionalType.NotIn)) defCmodel.ConditionalType = ConditionalType.NoLike;
switch (conditionItem.Logic)
{
case "and":
conditionalList.Add(new { Key = (int)WhereType.And, Value = new { FieldName = itemField, FieldValue = itemValue, ConditionalType = (int)cmodel.ConditionalType } });
conditionalList.Add(new { Key = (int)WhereType.And, Value = new { FieldName = itemField, FieldValue = itemValue, ConditionalType = (int)defCmodel.ConditionalType } });
break;
case "or":
conditionalList.Add(new { Key = (int)WhereType.Or, Value = new { FieldName = itemField, FieldValue = itemValue, ConditionalType = (int)cmodel.ConditionalType } });
conditionalList.Add(new { Key = (int)WhereType.Or, Value = new { FieldName = itemField, FieldValue = itemValue, ConditionalType = (int)defCmodel.ConditionalType } });
break;
}
}
@@ -902,6 +1015,8 @@ public class UserManager : IUserManager, IScoped
break;
}
if (itemMethod.Equals(QueryType.NotEqual) || itemMethod.Equals(QueryType.NotIncluded))
conditionalList.Add(new { Key = (int)WhereType.Or, Value = new { FieldName = itemField, FieldValue = string.Empty, ConditionalType = ConditionalType.IsNullOrEmpty } });
}
if (conditionalList.Any())
@@ -1048,11 +1163,13 @@ public class UserManager : IUserManager, IScoped
var itemValue = fieldItem.Value;
var itemMethod = (QueryType)System.Enum.Parse(typeof(QueryType), fieldItem.Op);
var cmodel = GetConditionalModel(itemMethod, itemField, User.OrganizeId);
if (itemMethod.Equals(QueryType.Equal)) cmodel.ConditionalType = ConditionalType.Like;
if (itemMethod.Equals(QueryType.NotEqual)) cmodel.ConditionalType = ConditionalType.NoLike;
switch (itemValue)
{
case "@userId": // 当前用户
{
var cmodel = GetConditionalModel(itemMethod, itemField, UserId);
switch (conditionItem.Logic)
{
case "and":
@@ -1070,19 +1187,30 @@ public class UserManager : IUserManager, IScoped
case "@userAraSubordinates": // 当前用户集下属
{
var ids = new List<string>() { UserId };
var subordinates = await this.GetSubordinatesAsync(UserId);
ids.AddRange(subordinates);
var cmodel = GetConditionalModel(itemMethod, itemField, string.Join(",", ids));
switch (conditionItem.Logic)
ids.AddRange(Subordinates);
for (int i = 0; i < ids.Count; i++)
{
case "and":
conditionalList.Add(new { Key = (int)WhereType.And, Value = new { FieldName = itemField, FieldValue = string.Join(",", ids), ConditionalType = (int)cmodel.ConditionalType } });
if (i == 0)
{
switch (conditionItem.Logic)
{
case "and":
conditionalList.Add(new { Key = (int)WhereType.And, Value = new { FieldName = itemField, FieldValue = ids[i], ConditionalType = (int)cmodel.ConditionalType } });
break;
case "or":
conditionalList.Add(new { Key = (int)WhereType.Or, Value = new { FieldName = itemField, FieldValue = string.Join(",", ids), ConditionalType = (int)cmodel.ConditionalType } });
break;
case "or":
conditionalList.Add(new { Key = (int)WhereType.Or, Value = new { FieldName = itemField, FieldValue = ids[i], ConditionalType = (int)cmodel.ConditionalType } });
break;
break;
}
}
else
{
if (itemMethod.Equals(QueryType.NotEqual) || itemMethod.Equals(QueryType.NotIncluded))
conditionalList.Add(new { Key = (int)WhereType.And, Value = new { FieldName = itemField, FieldValue = ids[i], ConditionalType = (int)cmodel.ConditionalType } });
else
conditionalList.Add(new { Key = (int)WhereType.Or, Value = new { FieldName = itemField, FieldValue = ids[i], ConditionalType = (int)cmodel.ConditionalType } });
}
}
}
@@ -1091,7 +1219,6 @@ public class UserManager : IUserManager, IScoped
{
if (!string.IsNullOrEmpty(User.OrganizeId))
{
var cmodel = GetConditionalModel(itemMethod, itemField, User.OrganizeId);
switch (conditionItem.Logic)
{
case "and":
@@ -1108,23 +1235,33 @@ public class UserManager : IUserManager, IScoped
break;
case "@organizationAndSuborganization": // 当前组织及子组织
{
var userInfo = User;
if (!string.IsNullOrEmpty(userInfo.OrganizeId))
if (!string.IsNullOrEmpty(User.OrganizeId))
{
var subsidiary = await GetSubsidiaryAsync(userInfo.OrganizeId, userInfo.IsAdministrator.Equals(1));
var ids = new List<string>() { userInfo.OrganizeId };
ids.AddRange(subsidiary);
var cmodel = GetConditionalModel(itemMethod, itemField, string.Join(",", ids));
switch (conditionItem.Logic)
var ids = new List<string>() { User.OrganizeId };
ids.AddRange(Subsidiary);
for (int i = 0; i < ids.Count; i++)
{
case "and":
conditionalList.Add(new { Key = (int)WhereType.And, Value = new { FieldName = itemField, FieldValue = string.Join(",", ids), ConditionalType = (int)cmodel.ConditionalType } });
if (i == 0)
{
switch (conditionItem.Logic)
{
case "and":
conditionalList.Add(new { Key = (int)WhereType.And, Value = new { FieldName = itemField, FieldValue = ids[i], ConditionalType = (int)cmodel.ConditionalType } });
break;
case "or":
conditionalList.Add(new { Key = (int)WhereType.Or, Value = new { FieldName = itemField, FieldValue = string.Join(",", ids), ConditionalType = (int)cmodel.ConditionalType } });
break;
case "or":
conditionalList.Add(new { Key = (int)WhereType.Or, Value = new { FieldName = itemField, FieldValue = ids[i], ConditionalType = (int)cmodel.ConditionalType } });
break;
break;
}
}
else
{
if (itemMethod.Equals(QueryType.NotEqual) || itemMethod.Equals(QueryType.NotIncluded))
conditionalList.Add(new { Key = (int)WhereType.And, Value = new { FieldName = itemField, FieldValue = ids[i], ConditionalType = (int)cmodel.ConditionalType } });
else
conditionalList.Add(new { Key = (int)WhereType.Or, Value = new { FieldName = itemField, FieldValue = ids[i], ConditionalType = (int)cmodel.ConditionalType } });
}
}
}
}
@@ -1133,18 +1270,32 @@ public class UserManager : IUserManager, IScoped
case "@branchManageOrganize": // 当前分管组织
{
var orgId = DataScope.Where(x => x.Select).Select(x => x.organizeId).ToList();
if (orgId != null)
var ids = DataScope.Where(x => x.Select).Select(x => x.organizeId).ToList();
if (ids != null)
{
var cmodel = GetConditionalModel(itemMethod, itemField, string.Join(",", orgId));
switch (conditionItem.Logic)
for (int i = 0; i < ids.Count; i++)
{
case "and":
conditionalList.Add(new { Key = (int)WhereType.And, Value = new { FieldName = itemField, FieldValue = string.Join(",", orgId), ConditionalType = (int)cmodel.ConditionalType } });
break;
case "or":
conditionalList.Add(new { Key = (int)WhereType.Or, Value = new { FieldName = itemField, FieldValue = string.Join(",", orgId), ConditionalType = (int)cmodel.ConditionalType } });
break;
if (i == 0)
{
switch (conditionItem.Logic)
{
case "and":
conditionalList.Add(new { Key = (int)WhereType.And, Value = new { FieldName = itemField, FieldValue = ids[i], ConditionalType = (int)cmodel.ConditionalType } });
break;
case "or":
conditionalList.Add(new { Key = (int)WhereType.Or, Value = new { FieldName = itemField, FieldValue = ids[i], ConditionalType = (int)cmodel.ConditionalType } });
break;
}
}
else
{
if (itemMethod.Equals(QueryType.NotEqual) || itemMethod.Equals(QueryType.NotIncluded))
conditionalList.Add(new { Key = (int)WhereType.And, Value = new { FieldName = itemField, FieldValue = ids[i], ConditionalType = (int)cmodel.ConditionalType } });
else
conditionalList.Add(new { Key = (int)WhereType.Or, Value = new { FieldName = itemField, FieldValue = ids[i], ConditionalType = (int)cmodel.ConditionalType } });
}
}
}
else
@@ -1157,21 +1308,35 @@ public class UserManager : IUserManager, IScoped
case "@branchManageOrganizeAndSub": // 当前分管组织及子组织
{
var subOrgIds = new List<string>();
var ids = new List<string>();
DataScope.Where(x => x.Select).Select(x => x.organizeId).ToList()
.ForEach(item => subOrgIds.AddRange(_repository.AsSugarClient().Queryable<OrganizeEntity>().Where(x => x.OrganizeIdTree.Contains(item)).Select(x => x.Id).ToList()));
.ForEach(item => ids.AddRange(_repository.AsSugarClient().Queryable<OrganizeEntity>().Where(x => x.OrganizeIdTree.Contains(item)).Select(x => x.Id).ToList()));
if (subOrgIds.Any())
if (ids.Any())
{
var cmodel = GetConditionalModel(itemMethod, itemField, string.Join(",", subOrgIds));
switch (conditionItem.Logic)
for (int i = 0; i < ids.Count; i++)
{
case "and":
conditionalList.Add(new { Key = (int)WhereType.And, Value = new { FieldName = itemField, FieldValue = string.Join(",", subOrgIds), ConditionalType = (int)cmodel.ConditionalType } });
break;
case "or":
conditionalList.Add(new { Key = (int)WhereType.Or, Value = new { FieldName = itemField, FieldValue = string.Join(",", subOrgIds), ConditionalType = (int)cmodel.ConditionalType } });
break;
if (i == 0)
{
switch (conditionItem.Logic)
{
case "and":
conditionalList.Add(new { Key = (int)WhereType.And, Value = new { FieldName = itemField, FieldValue = ids[i], ConditionalType = (int)cmodel.ConditionalType } });
break;
case "or":
conditionalList.Add(new { Key = (int)WhereType.Or, Value = new { FieldName = itemField, FieldValue = ids[i], ConditionalType = (int)cmodel.ConditionalType } });
break;
}
}
else
{
if (itemMethod.Equals(QueryType.NotEqual) || itemMethod.Equals(QueryType.NotIncluded))
conditionalList.Add(new { Key = (int)WhereType.And, Value = new { FieldName = itemField, FieldValue = ids[i], ConditionalType = (int)cmodel.ConditionalType } });
else
conditionalList.Add(new { Key = (int)WhereType.Or, Value = new { FieldName = itemField, FieldValue = ids[i], ConditionalType = (int)cmodel.ConditionalType } });
}
}
}
else
@@ -1186,24 +1351,25 @@ public class UserManager : IUserManager, IScoped
{
if (!string.IsNullOrEmpty(itemValue))
{
var cmodel = GetConditionalModel(itemMethod, itemField, itemValue, fieldItem.Type);
if (cmodel.ConditionalType.Equals(ConditionalType.In)) cmodel.ConditionalType = ConditionalType.Like;
if (cmodel.ConditionalType.Equals(ConditionalType.NotIn)) cmodel.ConditionalType = ConditionalType.NoLike;
var defCmodel = GetConditionalModel(itemMethod, itemField, itemValue, fieldItem.Type);
if (defCmodel.ConditionalType.Equals(ConditionalType.In)) defCmodel.ConditionalType = ConditionalType.Like;
if (defCmodel.ConditionalType.Equals(ConditionalType.NotIn)) defCmodel.ConditionalType = ConditionalType.NoLike;
switch (conditionItem.Logic)
{
case "and":
conditionalList.Add(new { Key = (int)WhereType.And, Value = new { FieldName = itemField, FieldValue = itemValue, ConditionalType = (int)cmodel.ConditionalType } });
conditionalList.Add(new { Key = (int)WhereType.And, Value = new { FieldName = itemField, FieldValue = itemValue, ConditionalType = (int)defCmodel.ConditionalType } });
break;
case "or":
conditionalList.Add(new { Key = (int)WhereType.Or, Value = new { FieldName = itemField, FieldValue = itemValue, ConditionalType = (int)cmodel.ConditionalType } });
conditionalList.Add(new { Key = (int)WhereType.Or, Value = new { FieldName = itemField, FieldValue = itemValue, ConditionalType = (int)defCmodel.ConditionalType } });
break;
}
}
}
break;
}
if (itemMethod.Equals(QueryType.NotEqual) || itemMethod.Equals(QueryType.NotIncluded))
conditionalList.Add(new { Key = (int)WhereType.Or, Value = new { FieldName = itemField, FieldValue = string.Empty, ConditionalType = ConditionalType.IsNullOrEmpty } });
codeGenConditionalObject.Find(it => it.FieldRule == fieldRule && it.TableName.Equals(tableName)).conditionalModel.AddRange(conditionalList);
}
@@ -1329,11 +1495,13 @@ public class UserManager : IUserManager, IScoped
var itemValue = fieldItem.Value;
var itemMethod = (QueryType)System.Enum.Parse(typeof(QueryType), fieldItem.Op);
var cmodel = GetConditionalModel(itemMethod, itemField, User.OrganizeId);
if (itemMethod.Equals(QueryType.Equal)) cmodel.ConditionalType = ConditionalType.Like;
if (itemMethod.Equals(QueryType.NotEqual)) cmodel.ConditionalType = ConditionalType.NoLike;
switch (itemValue)
{
case "@userId": // 当前用户
{
var cmodel = GetConditionalModel(itemMethod, itemField, UserId);
switch (conditionItem.Logic)
{
case "and":
@@ -1352,17 +1520,29 @@ public class UserManager : IUserManager, IScoped
{
var ids = new List<string>() { UserId };
ids.AddRange(Subordinates);
var cmodel = GetConditionalModel(itemMethod, itemField, string.Join(",", ids));
switch (conditionItem.Logic)
for (int i = 0; i < ids.Count; i++)
{
case "and":
conditionalList.Add(new { Key = (int)WhereType.And, Value = new { FieldName = itemField, FieldValue = string.Join(",", ids), ConditionalType = (int)cmodel.ConditionalType } });
if (i == 0)
{
switch (conditionItem.Logic)
{
case "and":
conditionalList.Add(new { Key = (int)WhereType.And, Value = new { FieldName = itemField, FieldValue = ids[i], ConditionalType = (int)cmodel.ConditionalType } });
break;
case "or":
conditionalList.Add(new { Key = (int)WhereType.Or, Value = new { FieldName = itemField, FieldValue = string.Join(",", ids), ConditionalType = (int)cmodel.ConditionalType } });
break;
case "or":
conditionalList.Add(new { Key = (int)WhereType.Or, Value = new { FieldName = itemField, FieldValue = ids[i], ConditionalType = (int)cmodel.ConditionalType } });
break;
break;
}
}
else
{
if (itemMethod.Equals(QueryType.NotEqual) || itemMethod.Equals(QueryType.NotIncluded))
conditionalList.Add(new { Key = (int)WhereType.And, Value = new { FieldName = itemField, FieldValue = ids[i], ConditionalType = (int)cmodel.ConditionalType } });
else
conditionalList.Add(new { Key = (int)WhereType.Or, Value = new { FieldName = itemField, FieldValue = ids[i], ConditionalType = (int)cmodel.ConditionalType } });
}
}
}
@@ -1371,7 +1551,6 @@ public class UserManager : IUserManager, IScoped
{
if (!string.IsNullOrEmpty(User.OrganizeId))
{
var cmodel = GetConditionalModel(itemMethod, itemField, User.OrganizeId);
switch (conditionItem.Logic)
{
case "and":
@@ -1382,7 +1561,6 @@ public class UserManager : IUserManager, IScoped
break;
}
}
}
break;
@@ -1392,17 +1570,29 @@ public class UserManager : IUserManager, IScoped
{
var ids = new List<string>() { User.OrganizeId };
ids.AddRange(Subsidiary);
var cmodel = GetConditionalModel(itemMethod, itemField, string.Join(",", ids));
switch (conditionItem.Logic)
for (int i = 0; i < ids.Count; i++)
{
case "and":
conditionalList.Add(new { Key = (int)WhereType.And, Value = new { FieldName = itemField, FieldValue = string.Join(",", ids), ConditionalType = (int)cmodel.ConditionalType } });
if(i == 0)
{
switch (conditionItem.Logic)
{
case "and":
conditionalList.Add(new { Key = (int)WhereType.And, Value = new { FieldName = itemField, FieldValue = ids[i], ConditionalType = (int)cmodel.ConditionalType } });
break;
case "or":
conditionalList.Add(new { Key = (int)WhereType.Or, Value = new { FieldName = itemField, FieldValue = string.Join(",", ids), ConditionalType = (int)cmodel.ConditionalType } });
break;
case "or":
conditionalList.Add(new { Key = (int)WhereType.Or, Value = new { FieldName = itemField, FieldValue = ids[i], ConditionalType = (int)cmodel.ConditionalType } });
break;
break;
}
}
else
{
if (itemMethod.Equals(QueryType.NotEqual) || itemMethod.Equals(QueryType.NotIncluded))
conditionalList.Add(new { Key = (int)WhereType.And, Value = new { FieldName = itemField, FieldValue = ids[i], ConditionalType = (int)cmodel.ConditionalType } });
else
conditionalList.Add(new { Key = (int)WhereType.Or, Value = new { FieldName = itemField, FieldValue = ids[i], ConditionalType = (int)cmodel.ConditionalType } });
}
}
}
}
@@ -1411,18 +1601,32 @@ public class UserManager : IUserManager, IScoped
case "@branchManageOrganize": // 当前分管组织
{
var orgId = DataScope.Where(x => x.Select).Select(x => x.organizeId).ToList();
if (orgId != null)
var ids = DataScope.Where(x => x.Select).Select(x => x.organizeId).ToList();
if (ids != null)
{
var cmodel = GetConditionalModel(itemMethod, itemField, string.Join(",", orgId));
switch (conditionItem.Logic)
for (int i = 0; i < ids.Count; i++)
{
case "and":
conditionalList.Add(new { Key = (int)WhereType.And, Value = new { FieldName = itemField, FieldValue = string.Join(",", orgId), ConditionalType = (int)cmodel.ConditionalType } });
break;
case "or":
conditionalList.Add(new { Key = (int)WhereType.Or, Value = new { FieldName = itemField, FieldValue = string.Join(",", orgId), ConditionalType = (int)cmodel.ConditionalType } });
break;
if (i == 0)
{
switch (conditionItem.Logic)
{
case "and":
conditionalList.Add(new { Key = (int)WhereType.And, Value = new { FieldName = itemField, FieldValue = ids[i], ConditionalType = (int)cmodel.ConditionalType } });
break;
case "or":
conditionalList.Add(new { Key = (int)WhereType.Or, Value = new { FieldName = itemField, FieldValue = ids[i], ConditionalType = (int)cmodel.ConditionalType } });
break;
}
}
else
{
if(itemMethod.Equals(QueryType.NotEqual) || itemMethod.Equals(QueryType.NotIncluded))
conditionalList.Add(new { Key = (int)WhereType.And, Value = new { FieldName = itemField, FieldValue = ids[i], ConditionalType = (int)cmodel.ConditionalType } });
else
conditionalList.Add(new { Key = (int)WhereType.Or, Value = new { FieldName = itemField, FieldValue = ids[i], ConditionalType = (int)cmodel.ConditionalType } });
}
}
}
else
@@ -1435,21 +1639,35 @@ public class UserManager : IUserManager, IScoped
case "@branchManageOrganizeAndSub": // 当前分管组织及子组织
{
var subOrgIds = new List<string>();
var ids = new List<string>();
DataScope.Where(x => x.Select).Select(x => x.organizeId).ToList()
.ForEach(item => subOrgIds.AddRange(_repository.AsSugarClient().Queryable<OrganizeEntity>().Where(x => x.OrganizeIdTree.Contains(item)).Select(x => x.Id).ToList()));
.ForEach(item => ids.AddRange(_repository.AsSugarClient().Queryable<OrganizeEntity>().Where(x => x.OrganizeIdTree.Contains(item)).Select(x => x.Id).ToList()));
if (subOrgIds.Any())
if (ids.Any())
{
var cmodel = GetConditionalModel(itemMethod, itemField, string.Join(",", subOrgIds));
switch (conditionItem.Logic)
for (int i = 0; i < ids.Count; i++)
{
case "and":
conditionalList.Add(new { Key = (int)WhereType.And, Value = new { FieldName = itemField, FieldValue = string.Join(",", subOrgIds), ConditionalType = (int)cmodel.ConditionalType } });
break;
case "or":
conditionalList.Add(new { Key = (int)WhereType.Or, Value = new { FieldName = itemField, FieldValue = string.Join(",", subOrgIds), ConditionalType = (int)cmodel.ConditionalType } });
break;
if (i == 0)
{
switch (conditionItem.Logic)
{
case "and":
conditionalList.Add(new { Key = (int)WhereType.And, Value = new { FieldName = itemField, FieldValue = ids[i], ConditionalType = (int)cmodel.ConditionalType } });
break;
case "or":
conditionalList.Add(new { Key = (int)WhereType.Or, Value = new { FieldName = itemField, FieldValue = ids[i], ConditionalType = (int)cmodel.ConditionalType } });
break;
}
}
else
{
if (itemMethod.Equals(QueryType.NotEqual) || itemMethod.Equals(QueryType.NotIncluded))
conditionalList.Add(new { Key = (int)WhereType.And, Value = new { FieldName = itemField, FieldValue = ids[i], ConditionalType = (int)cmodel.ConditionalType } });
else
conditionalList.Add(new { Key = (int)WhereType.Or, Value = new { FieldName = itemField, FieldValue = ids[i], ConditionalType = (int)cmodel.ConditionalType } });
}
}
}
else
@@ -1464,16 +1682,16 @@ public class UserManager : IUserManager, IScoped
{
if (!string.IsNullOrEmpty(itemValue))
{
var cmodel = GetConditionalModel(itemMethod, itemField, itemValue, fieldItem.Type);
if (cmodel.ConditionalType.Equals(ConditionalType.In)) cmodel.ConditionalType = ConditionalType.Like;
if (cmodel.ConditionalType.Equals(ConditionalType.NotIn)) cmodel.ConditionalType = ConditionalType.NoLike;
var defCmodel = GetConditionalModel(itemMethod, itemField, itemValue, fieldItem.Type);
if (defCmodel.ConditionalType.Equals(ConditionalType.In)) defCmodel.ConditionalType = ConditionalType.Like;
if (defCmodel.ConditionalType.Equals(ConditionalType.NotIn)) defCmodel.ConditionalType = ConditionalType.NoLike;
switch (conditionItem.Logic)
{
case "and":
conditionalList.Add(new { Key = (int)WhereType.And, Value = new { FieldName = itemField, FieldValue = itemValue, ConditionalType = (int)cmodel.ConditionalType } });
conditionalList.Add(new { Key = (int)WhereType.And, Value = new { FieldName = itemField, FieldValue = itemValue, ConditionalType = (int)defCmodel.ConditionalType } });
break;
case "or":
conditionalList.Add(new { Key = (int)WhereType.Or, Value = new { FieldName = itemField, FieldValue = itemValue, ConditionalType = (int)cmodel.ConditionalType } });
conditionalList.Add(new { Key = (int)WhereType.Or, Value = new { FieldName = itemField, FieldValue = itemValue, ConditionalType = (int)defCmodel.ConditionalType } });
break;
}
}
@@ -1482,6 +1700,8 @@ public class UserManager : IUserManager, IScoped
break;
}
if (itemMethod.Equals(QueryType.NotEqual) || itemMethod.Equals(QueryType.NotIncluded))
conditionalList.Add(new { Key = (int)WhereType.Or, Value = new { FieldName = itemField, FieldValue = string.Empty, ConditionalType = ConditionalType.IsNullOrEmpty } });
}
if (conditionalList.Any())
@@ -1691,12 +1911,14 @@ public class UserManager : IUserManager, IScoped
// 包含
case QueryType.In:
case QueryType.Included:
return new ConditionalModel() { FieldName = fieldName, ConditionalType = ConditionalType.In, FieldValue = fieldValue };
case QueryType.Included:
return new ConditionalModel() { FieldName = fieldName, ConditionalType = ConditionalType.Like, FieldValue = fieldValue };
// 不包含
case QueryType.NotIn:
return new ConditionalModel() { FieldName = fieldName, ConditionalType = ConditionalType.In, FieldValue = fieldValue };
case QueryType.NotIncluded:
return new ConditionalModel() { FieldName = fieldName, ConditionalType = ConditionalType.NotIn, FieldValue = fieldValue };
return new ConditionalModel() { FieldName = fieldName, ConditionalType = ConditionalType.NoLike, FieldValue = fieldValue };
}
return new ConditionalModel();

View File

@@ -14,8 +14,10 @@
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\message\Tnb.Message.Entitys\Tnb.Message.Entitys.csproj" />
<ProjectReference Include="..\..\system\Tnb.Systems.Entitys\Tnb.Systems.Entitys.csproj" />
<ProjectReference Include="..\..\visualdev\Tnb.VisualDev.Entitys\Tnb.VisualDev.Entitys.csproj" />
<ProjectReference Include="..\Tnb.WebSockets\Tnb.WebSockets.csproj" />
</ItemGroup>
</Project>

View File

@@ -86,12 +86,14 @@ public class CodeGenUploadAttribute : Attribute
/// 构造函数
/// "popupSelect".
/// </summary>
public CodeGenUploadAttribute(string Model, string SecondParameter, string ThreeParameters, string FourParameters, string Config)
public CodeGenUploadAttribute(string Model, string dataConversionModel, string SecondParameter, string ThreeParameters, string FourParameters, string ShowField, string Config)
{
__Model__ = Model;
__vModel__ = dataConversionModel;
interfaceId = SecondParameter;
propsValue = ThreeParameters;
relationField = FourParameters;
showField = ShowField;
__config__ = Config.ToObject<CodeGenConfigModel>();
}
@@ -135,9 +137,7 @@ public class CodeGenUploadAttribute : Attribute
/// <summary>
/// 构造函数
/// "treeSelect"
/// "usersSelect":
/// "depSelect":
/// "relationForm".
/// "depSelect":.
/// </summary>
public CodeGenUploadAttribute(string Model, bool Multiple, string ThreeParameters, string FourParameters, string Config)
{
@@ -146,18 +146,10 @@ public class CodeGenUploadAttribute : Attribute
__config__ = Config.ToObject<CodeGenConfigModel>();
switch (__config__.jnpfKey)
{
case JnpfKeyConst.RELATIONFORM:
modelId = ThreeParameters;
relationField = FourParameters;
break;
case JnpfKeyConst.DEPSELECT:
selectType = ThreeParameters;
ableDepIds = FourParameters?.ToObject<List<string>>();
break;
case JnpfKeyConst.USERSSELECT:
selectType = ThreeParameters;
ableIds = FourParameters?.ToObject<List<string>>();
break;
default:
props = ThreeParameters?.ToObject<CodeGenPropsModel>();
options = FourParameters?.ToObject<List<object>>();
@@ -165,10 +157,25 @@ public class CodeGenUploadAttribute : Attribute
}
}
/// <summary>
/// 构造函数
/// "usersSelect":.
/// </summary>
public CodeGenUploadAttribute(string Model, string dataConversionModel, bool Multiple, string ThreeParameters, string FourParameters, string Config)
{
__Model__ = Model;
__vModel__ = dataConversionModel;
multiple = Multiple;
__config__ = Config.ToObject<CodeGenConfigModel>();
selectType = ThreeParameters;
ableIds = FourParameters?.ToObject<List<string>>();
}
/// <summary>
/// 构造函数
/// "cascader"
/// "posSelect":
/// "relationForm"
/// "popupTableSelect".
/// </summary>
public CodeGenUploadAttribute(string Model, bool Multiple, string InterfaceId, string PropsValue, string RelationField, string Config)
@@ -196,6 +203,21 @@ public class CodeGenUploadAttribute : Attribute
}
}
/// <summary>
/// 构造函数
/// "relationForm".
/// </summary>
public CodeGenUploadAttribute(string Model, string dataConversionModel, bool Multiple, string InterfaceId, string PropsValue, string RelationField, string Config)
{
__Model__ = Model;
__vModel__ = dataConversionModel;
multiple = Multiple;
__config__ = Config.ToObject<CodeGenConfigModel>();
modelId = InterfaceId;
relationField = PropsValue;
showField = RelationField;
}
/// <summary>
/// 构造函数
/// "userSelect":.
@@ -218,6 +240,11 @@ public class CodeGenUploadAttribute : Attribute
/// </summary>
public string __Model__ { get; set; }
/// <summary>
/// 数据转换.
/// </summary>
public string __vModel__ { get; set; }
/// <summary>
/// 最小值.
/// </summary>
@@ -332,4 +359,9 @@ public class CodeGenUploadAttribute : Attribute
/// 新用户选择控件.
/// </summary>
public List<string> ableIds { get; set; }
/// <summary>
/// 展示字段.
/// </summary>
public string showField { get; set; }
}

View File

@@ -222,6 +222,18 @@ public enum ErrorCode
[ErrorCodeItemMetadata("登录票据已失效")]
D1035,
/// <summary>
/// 主系统不允许禁用.
/// </summary>
[ErrorCodeItemMetadata("主系统不允许禁用")]
D1036,
/// <summary>
/// 主系统不允许更改应用编码.
/// </summary>
[ErrorCodeItemMetadata("主系统不允许更改应用编码")]
D1037,
#endregion
#region 2
@@ -504,6 +516,12 @@ public enum ErrorCode
[ErrorCodeItemMetadata("当前导入菜单为Web端菜单请在对应模块下导入")]
D4013,
/// <summary>
/// 该系统已被禁用
/// </summary>
[ErrorCodeItemMetadata("切换失败,当前系统已被管理员禁用")]
D4014,
#endregion
#region 5

View File

@@ -83,4 +83,9 @@ public class ConvertSuperQuery
/// 是否主条件.
/// </summary>
public bool mainWhere { get; set; }
/// <summary>
/// 象征.
/// </summary>
public string symbol { get; set; }
}

View File

@@ -22,14 +22,14 @@ public static class CodeGenHelper
case "nchar":
case "timestamp":
case "string":
return "string";
return "string?";
case "int":
case "smallint":
return "int";
return "int?";
case "tinyint":
return "byte";
return "byte?";
case "bigint":
// sqlite数据库
@@ -43,10 +43,10 @@ public static class CodeGenHelper
case "smallmoney":
case "numeric":
case "decimal":
return "decimal";
return "decimal?";
case "real":
return "Single";
return "Single?";
case "datetime":
case "datetime2":
@@ -55,7 +55,7 @@ public static class CodeGenHelper
return "DateTime?";
case "float":
return "double";
return "double?";
case "image":
case "binary":
@@ -218,7 +218,7 @@ public static class CodeGenHelper
result.Add(label, "系统自动生成");
break;
case JnpfKeyConst.COMSELECT:
result.Add(label, multiple ? "例:拓通智联/产品部,拓通智联/技术部" : "例:拓通智联/技术部");
result.Add(label, multiple ? "例:引迈信息/产品部,引迈信息/技术部" : "例:引迈信息/技术部");
break;
case JnpfKeyConst.DEPSELECT:
result.Add(label, multiple ? "例:产品部/部门编码,技术部/部门编码" : "例:技术部/部门编码");
@@ -230,7 +230,7 @@ public static class CodeGenHelper
result.Add(label, multiple ? "例:张三/账号,李四/账号" : "例:张三/账号");
break;
case JnpfKeyConst.USERSSELECT:
result.Add(label, multiple ? "例:拓通智联/产品部,产品部/部门编码,技术经理/岗位编码,研发人员/角色编码,A分组/分组编码,张三/账号" : "例:李四/账号");
result.Add(label, multiple ? "例:引迈信息/产品部,产品部/部门编码,技术经理/岗位编码,研发人员/角色编码,A分组/分组编码,张三/账号" : "例:李四/账号");
break;
case JnpfKeyConst.ROLESELECT:
result.Add(label, multiple ? "例:研发人员/角色编码,测试人员/角色编码" : "例:研发人员/角色编码");

View File

@@ -0,0 +1,41 @@
using JNPF.DependencyInjection;
using SqlSugar;
namespace JNPF.Extend.Entitys.Dto.Customer;
/// <summary>
/// 客户信息.
/// </summary>
[SuppressSniffer]
public class CustomerListOutput
{
/// <summary>
/// 主键.
/// </summary>
public string id { get; set; }
/// <summary>
/// 客户编号.
/// </summary>
public string code { get; set; }
/// <summary>
/// 客户名称.
/// </summary>
public string customerName { get; set; }
/// <summary>
/// 地址.
/// </summary>
public string address { get; set; }
/// <summary>
/// 名称.
/// </summary>
public string name { get; set; }
/// <summary>
/// 联系方式.
/// </summary>
public string contactTel { get; set; }
}

View File

@@ -1,4 +1,5 @@
using JNPF.DependencyInjection;
using JNPF.Extend.Entitys.Dto.ProductEntry;
namespace JNPF.Extend.Entitys.Dto.Product;
@@ -106,5 +107,5 @@ public class ProductCrInput
/// <summary>
/// 子表数据.
/// </summary>
public List<ProductEntryEntity> productEntryList { get; set; }
public List<ProductEntryCrInput> productEntryList { get; set; }
}

View File

@@ -0,0 +1,60 @@
using JNPF.DependencyInjection;
namespace JNPF.Extend.Entitys.Dto.ProductEntry;
/// <summary>
/// 新建产品明细.
/// </summary>
[SuppressSniffer]
public class ProductEntryCrInput
{
/// <summary>
/// 主键.
/// </summary>
public string? id { get; set; }
/// <summary>
/// 产品编号.
/// </summary>
public string productCode { get; set; }
/// <summary>
/// 产品名称.
/// </summary>
public string productName { get; set; }
/// <summary>
/// 产品规格.
/// </summary>
public string productSpecification { get; set; }
/// <summary>
/// 数量.
/// </summary>
public int qty { get; set; }
/// <summary>
/// 订货类型.
/// </summary>
public string type { get; set; }
/// <summary>
/// 单价.
/// </summary>
public decimal money { get; set; }
/// <summary>
/// 折后单价.
/// </summary>
public decimal price { get; set; }
/// <summary>
/// 金额.
/// </summary>
public decimal amount { get; set; }
/// <summary>
/// 备注.
/// </summary>
public string description { get; set; }
}

View File

@@ -8,6 +8,11 @@ namespace JNPF.Extend.Entitys.Dto.ProductEntry;
[SuppressSniffer]
public class ProductEntryInfoOutput
{
/// <summary>
/// 主键.
/// </summary>
public string id { get; set; }
/// <summary>
/// 产品编号.
/// </summary>

View File

@@ -0,0 +1,50 @@
using JNPF.DependencyInjection;
namespace JNPF.Extend.Entitys.Dto.ProductGoods;
/// <summary>
/// 产品列表.
/// </summary>
[SuppressSniffer]
public class ProductGoodsListOutput
{
/// <summary>
/// 主键.
/// </summary>
public string id { get; set; }
/// <summary>
/// 分类主键.
/// </summary>
public string classifyId { get; set; }
/// <summary>
/// 订单编号.
/// </summary>
public string code { get; set; }
/// <summary>
/// 订单名称.
/// </summary>
public string fullName { get; set; }
/// <summary>
/// 订单名称.
/// </summary>
public int qty { get; set; }
/// <summary>
/// 订货类型.
/// </summary>
public string type { get; set; }
/// <summary>
/// 金额.
/// </summary>
public string amount { get; set; }
/// <summary>
/// 单价.
/// </summary>
public string money { get; set; }
}

View File

@@ -0,0 +1,26 @@
using JNPF.Common.Filter;
using JNPF.DependencyInjection;
namespace JNPF.Extend.Entitys.Dto.ProductGoods;
/// <summary>
/// 产品列表.
/// </summary>
[SuppressSniffer]
public class ProductGoodsListQueryInput : PageInputBase
{
/// <summary>
/// 订单编号.
/// </summary>
public string code { get; set; }
/// <summary>
/// 产品名称.
/// </summary>
public string fullName { get; set; }
/// <summary>
/// 分类ID.
/// </summary>
public string classifyId { get; set; }
}

View File

@@ -6,7 +6,8 @@ namespace JNPF.Extend.Entitys;
/// <summary>
/// 大数据测试
/// 版 本V3.2
/// 版 权:拓通智联科技有限公司http://www.tuotong-tech.com
/// 版 权:引迈信息技术有限公司https://www.jnpfsoft.com
/// 作 者JNPF开发平台组
/// 日 期2021-06-01.
/// </summary>
[SugarTable("EXT_BIGDATA")]

View File

@@ -0,0 +1,59 @@
using JNPF.Common.Contracts;
using SqlSugar;
namespace JNPF.Extend.Entitys.Entity;
/// <summary>
/// 客户信息.
/// </summary>
[SugarTable("ext_customer", TableDescription = "客户信息")]
public class CustomerEntity : CLEntityBase
{
/// <summary>
/// 编码.
/// </summary>
[SugarColumn(ColumnName = "F_Code")]
public string Code { get; set; }
/// <summary>
/// 客户名称.
/// </summary>
[SugarColumn(ColumnName = "F_CustomerName")]
public string Customername { get; set; }
/// <summary>
/// 地址.
/// </summary>
[SugarColumn(ColumnName = "F_Address")]
public string Address { get; set; }
/// <summary>
/// 名称.
/// </summary>
[SugarColumn(ColumnName = "F_Name")]
public string Name { get; set; }
/// <summary>
/// 联系方式.
/// </summary>
[SugarColumn(ColumnName = "F_ContactTel")]
public string ContactTel { get; set; }
/// <summary>
/// 删除标志.
/// </summary>
[SugarColumn(ColumnName = "F_DeleteMark")]
public float Deletemark { get; set; }
/// <summary>
/// 删除时间.
/// </summary>
[SugarColumn(ColumnName = "F_DeleteTime")]
public DateTime Deletetime { get; set; }
/// <summary>
/// 删除用户.
/// </summary>
[SugarColumn(ColumnName = "F_DeleteUserId")]
public string Deleteuserid { get; set; }
}

View File

@@ -6,7 +6,8 @@ namespace JNPF.Extend.Entitys;
/// <summary>
/// 知识文档
/// 版 本V3.2
/// 版 权:拓通智联科技有限公司http://www.tuotong-tech.com
/// 版 权:引迈信息技术有限公司https://www.jnpfsoft.com
/// 作 者JNPF开发平台组
/// 日 期2021-06-01.
/// </summary>
[SugarTable("EXT_DOCUMENT")]

View File

@@ -6,7 +6,8 @@ namespace JNPF.Extend.Entitys;
/// <summary>
/// 知识文档共享
/// 版 本V3.2
/// 版 权:拓通智联科技有限公司http://www.tuotong-tech.com
/// 版 权:引迈信息技术有限公司https://www.jnpfsoft.com
/// 作 者JNPF开发平台组
/// 日 期2021-06-01 .
/// </summary>
[SugarTable("EXT_DOCUMENTSHARE")]

View File

@@ -6,7 +6,8 @@ namespace JNPF.Extend.Entitys;
/// <summary>
/// 邮件配置
/// 版 本V3.2
/// 版 权:拓通智联科技有限公司http://www.tuotong-tech.com
/// 版 权:引迈信息技术有限公司https://www.jnpfsoft.com
/// 作 者JNPF开发平台组
/// 日 期2021-06-01.
/// </summary>
[SugarTable("EXT_EMAILCONFIG")]

View File

@@ -6,7 +6,8 @@ namespace JNPF.Extend.Entitys;
/// <summary>
/// 邮件接收
/// 版 本V3.2
/// 版 权:拓通智联科技有限公司http://www.tuotong-tech.com
/// 版 权:引迈信息技术有限公司https://www.jnpfsoft.com
/// 作 者JNPF开发平台组
/// 日 期2021-06-01.
/// </summary>
[SugarTable("EXT_EMAILRECEIVE")]

View File

@@ -6,7 +6,8 @@ namespace JNPF.Extend.Entitys;
/// <summary>
/// 邮件发送
/// 版 本V3.2
/// 版 权:拓通智联科技有限公司http://www.tuotong-tech.com
/// 版 权:引迈信息技术有限公司https://www.jnpfsoft.com
/// 作 者JNPF开发平台组
/// 日 期2021-06-01 .
/// </summary>
[SugarTable("EXT_EMAILSEND")]

View File

@@ -6,7 +6,8 @@ namespace JNPF.Extend.Entitys;
/// <summary>
/// 职员信息
/// 版 本V3.2
/// 版 权:拓通智联科技有限公司http://www.tuotong-tech.com
/// 版 权:引迈信息技术有限公司https://www.jnpfsoft.com
/// 作 者JNPF开发平台组
/// 日 期2021-06-01 .
/// </summary>
[SugarTable("EXT_EMPLOYEE")]

View File

@@ -6,7 +6,8 @@ namespace JNPF.Extend.Entitys;
/// <summary>
/// 订单信息
/// 版 本V3.2
/// 版 权:拓通智联科技有限公司http://www.tuotong-tech.com
/// 版 权:引迈信息技术有限公司https://www.jnpfsoft.com
/// 作 者JNPF开发平台组
/// 日 期2021-06-01 .
/// </summary>
[SugarTable("EXT_ORDER")]

View File

@@ -6,7 +6,8 @@ namespace JNPF.Extend.Entitys;
/// <summary>
/// 订单明细
/// 版 本V3.2
/// 版 权:拓通智联科技有限公司http://www.tuotong-tech.com
/// 版 权:引迈信息技术有限公司https://www.jnpfsoft.com
/// 作 者JNPF开发平台组
/// 日 期2021-06-01 .
/// </summary>
[SugarTable("EXT_ORDERENTRY")]

View File

@@ -6,7 +6,8 @@ namespace JNPF.Extend.Entitys;
/// <summary>
/// 订单收款
/// 版 本V3.2
/// 版 权:拓通智联科技有限公司http://www.tuotong-tech.com
/// 版 权:引迈信息技术有限公司https://www.jnpfsoft.com
/// 作 者JNPF开发平台组
/// 日 期2021-06-01 .
/// </summary>
[SugarTable("EXT_ORDERRECEIVABLE")]

View File

@@ -9,14 +9,8 @@ namespace JNPF.Extend.Entitys;
/// </summary>
[SugarTable("ext_productclassify")]
[Tenant(ClaimConst.TENANTID)]
public class ProductClassifyEntity : CLDEntityBase
public class ProductClassifyEntity : CLEntityBase
{
/// <summary>
/// 主键.
/// </summary>
[SugarColumn(ColumnName = "F_Id", IsPrimaryKey = true)]
public string Id { get; set; }
/// <summary>
/// 上级.
/// </summary>
@@ -28,4 +22,22 @@ public class ProductClassifyEntity : CLDEntityBase
/// </summary>
[SugarColumn(ColumnName = "F_FULLNAME")]
public string FullName { get; set; }
/// <summary>
/// 获取或设置 删除标志.
/// </summary>
[SugarColumn(ColumnName = "F_DeleteMark", ColumnDescription = "删除标志")]
public int? DeleteMark { get; set; }
/// <summary>
/// 获取或设置 删除时间.
/// </summary>
[SugarColumn(ColumnName = "F_DeleteTime", ColumnDescription = "删除时间")]
public DateTime? DeleteTime { get; set; }
/// <summary>
/// 获取或设置 删除用户.
/// </summary>
[SugarColumn(ColumnName = "F_DeleteUserId", ColumnDescription = "删除用户")]
public string DeleteUserId { get; set; }
}

View File

@@ -9,14 +9,8 @@ namespace JNPF.Extend.Entitys;
/// </summary>
[SugarTable("ext_product")]
[Tenant(ClaimConst.TENANTID)]
public class ProductEntity
public class ProductEntity : EntityBase<string>
{
/// <summary>
/// 自然主键.
/// </summary>
[SugarColumn(ColumnName = "F_Id", IsPrimaryKey = true)]
public string Id { get; set; }
/// <summary>
/// 订单编号.
/// </summary>

View File

@@ -7,7 +7,8 @@ namespace JNPF.Extend.Entitys;
/// <summary>
/// 项目计划
/// 版 本V3.2
/// 版 权:拓通智联科技有限公司http://www.tuotong-tech.com
/// 版 权:引迈信息技术有限公司https://www.yinmaisoft.com
/// 作 者JNPF开发平台组
/// 日 期2021-06-01.
/// </summary>
[SugarTable("EXT_PROJECTGANTT")]

View File

@@ -7,7 +7,8 @@ namespace JNPF.Extend.Entitys;
/// <summary>
/// 日程安排
/// 版 本V3.2
/// 版 权:拓通智联科技有限公司http://www.tuotong-tech.com
/// 版 权:引迈信息技术有限公司https://www.jnpfsoft.com
/// 作 者JNPF开发平台组
/// 日 期2021-06-01.
/// </summary>
[SugarTable("EXT_SCHEDULE")]

View File

@@ -6,7 +6,8 @@ namespace JNPF.Extend.Entitys;
/// <summary>
/// 表格示例数据
/// 版 本V3.2
/// 版 权:拓通智联科技有限公司http://www.tuotong-tech.com
/// 版 权:引迈信息技术有限公司https://www.jnpfsoft.com
/// 作 者JNPF开发平台组
/// 日 期2021-06-01 .
/// </summary>
[SugarTable("EXT_TABLEEXAMPLE")]

View File

@@ -6,7 +6,8 @@ namespace JNPF.Extend.Entitys;
/// <summary>
/// 工作日志
/// 版 本V3.2
/// 版 权:拓通智联科技有限公司http://www.tuotong-tech.com
/// 版 权:引迈信息技术有限公司https://www.jnpfsoft.com
/// 作 者JNPF开发平台组
/// 日 期2021-06-01 .
/// </summary>
[SugarTable("EXT_WORKLOG")]

View File

@@ -7,7 +7,8 @@ namespace JNPF.Extend.Entitys;
/// <summary>
/// 工作日志分享
/// 版 本V3.2
/// 版 权:拓通智联科技有限公司http://www.tuotong-tech.com
/// 版 权:引迈信息技术有限公司https://www.jnpfsoft.com
/// 作 者JNPF开发平台组
/// 日 期2021-06-01 .
/// </summary>
[SugarTable("EXT_WORKLOGSHARE")]

View File

@@ -59,7 +59,7 @@ public class ProductClassifyService : IDynamicApiController, ITransient
[HttpGet("{id}")]
public async Task<dynamic> GetInfo(string id)
{
return (await _repository.AsQueryable().FirstAsync(a => a.Id.Equals(id))).Adapt<ProductClassifyInfoOutput>();
return (await _repository.AsQueryable().FirstAsync(a => a.Id.Equals(id) && a.DeleteMark == null)).Adapt<ProductClassifyInfoOutput>();
}
#endregion

View File

@@ -1,13 +1,16 @@
using System.Collections.Generic;
using JNPF.Common.Core.Manager;
using JNPF.Common.Core.Manager;
using JNPF.Common.Enums;
using JNPF.Common.Filter;
using JNPF.Common.Security;
using JNPF.DatabaseAccessor;
using JNPF.DependencyInjection;
using JNPF.DynamicApiController;
using JNPF.Extend.Entitys;
using JNPF.Extend.Entitys.Dto.Product;
using JNPF.Extend.Entitys.Dto.ProductEntry;
using JNPF.Extend.Entitys.Model;
using JNPF.FriendlyException;
using JNPF.Systems.Interfaces.System;
using Mapster;
using Microsoft.AspNetCore.Mvc;
using SqlSugar;
@@ -31,17 +34,26 @@ public class ProductService : IDynamicApiController, ITransient
/// </summary>
private readonly IUserManager _userManager;
/// <summary>
/// 单据规则服务.
/// </summary>
private readonly IBillRullService _billRullService;
/// <summary>
/// 初始化一个<see cref="ProductService"/>类型的新实例.
/// </summary>
public ProductService(
ISqlSugarRepository<ProductEntity> extProductRepository,
IBillRullService billRullService,
IUserManager userManager)
{
_repository = extProductRepository;
_billRullService = billRullService;
_userManager = userManager;
}
#region Get
/// <summary>
/// 获取订单示例.
/// </summary>
@@ -51,7 +63,7 @@ public class ProductService : IDynamicApiController, ITransient
public async Task<dynamic> GetInfo(string id)
{
return (await _repository.AsQueryable()
.Includes(x => x.productEntryList.Select(it => new ProductEntryEntity
.Includes(x => x.productEntryList.Where(it => it.DeleteMark == null).Select(it => new ProductEntryEntity
{
ProductCode = it.ProductCode,
ProductName = it.ProductName,
@@ -62,7 +74,7 @@ public class ProductService : IDynamicApiController, ITransient
Price = it.Price,
Amount = it.Amount,
Description = it.Description
}).ToList()).Where(a => a.Id.Equals(id))
}).ToList()).Where(a => a.Id.Equals(id) && a.DeleteMark == null)
.ToListAsync(it => new ProductInfoOutput
{
id = it.Id,
@@ -96,10 +108,15 @@ public class ProductService : IDynamicApiController, ITransient
[HttpGet("")]
public async Task<dynamic> GetList([FromQuery] ProductListQueryInput input)
{
if (input.auditState == "0")
input.auditState = null;
if (input.closeState == "0")
input.closeState = null;
var data = await _repository.AsQueryable()
.Where(it => it.DeleteMark == null)
.WhereIF(!string.IsNullOrEmpty(input.code), it => it.Code.Contains(input.code))
.WhereIF(!string.IsNullOrEmpty(input.customerName), it => it.Type.Contains(input.customerName))
.WhereIF(!string.IsNullOrEmpty(input.contactTel), it => it.CustomerId.Contains(input.contactTel))
.WhereIF(!string.IsNullOrEmpty(input.customerName), it => it.CustomerName.Contains(input.customerName))
.WhereIF(!string.IsNullOrEmpty(input.contactTel), it => it.ContactTel.Contains(input.contactTel))
.WhereIF(!string.IsNullOrEmpty(input.auditState), it => it.AuditState.Equals(input.auditState))
.WhereIF(!string.IsNullOrEmpty(input.closeState), it => it.CloseState.Equals(input.closeState))
.Select(it => new ProductListOutput
@@ -130,7 +147,7 @@ public class ProductService : IDynamicApiController, ITransient
{
string data = "[{\"id\":\"37c995b4044541009fb7e285bcf9845d\",\"productSpecification\":\"120ml\",\"qty\":16,\"money\":510,\"price\":120,\"commandType\":\"唯一码\",\"util\":\"盒\"},{\"id\":\"2dbb11d3cde04c299985ac944d130ba0\",\"productSpecification\":\"150ml\",\"qty\":15,\"money\":520,\"price\":310,\"commandType\":\"唯一码\",\"util\":\"盒\"},{\"id\":\"f8ec261ccdf045e5a2e1f0e5485cda76\",\"productSpecification\":\"40ml\",\"qty\":13,\"money\":530,\"price\":140,\"commandType\":\"唯一码\",\"util\":\"盒\"},{\"id\":\"6c110b57ae56445faa8ce9be501c8997\",\"productSpecification\":\"103ml\",\"qty\":2,\"money\":504,\"price\":150,\"commandType\":\"唯一码\",\"util\":\"盒\"},{\"id\":\"f2ee981aaf934147a4d090a0eed2203f\",\"productSpecification\":\"120ml\",\"qty\":21,\"money\":550,\"price\":160,\"commandType\":\"唯一码\",\"util\":\"盒\"}]";
List<ProductEntryMdoel> dataAll = data.ToObject<List<ProductEntryMdoel>>();
List<ProductEntryListOutput> productEntryList = await _repository.AsSugarClient().Queryable<ProductEntryEntity>().Where(it => it.ProductId.Equals(id)).Select(it => new ProductEntryListOutput
List<ProductEntryListOutput> productEntryList = await _repository.AsSugarClient().Queryable<ProductEntryEntity>().Where(it => it.ProductId.Equals(id) && it.DeleteMark == null).Select(it => new ProductEntryListOutput
{
productCode = it.ProductCode,
productName = it.ProductName,
@@ -155,4 +172,126 @@ public class ProductService : IDynamicApiController, ITransient
return new { list = productEntryList };
}
#endregion
#region POST
/// <summary>
/// 新建.
/// </summary>
/// <param name="input">请求参数.</param>
/// <returns></returns>
[HttpPost("")]
[UnitOfWork]
public async Task Create([FromBody] ProductCrInput input)
{
var entity = input.Adapt<ProductEntity>();
entity.Code = await _billRullService.GetBillNumber("OrderNumber", false);
entity.Id = SnowflakeIdHelper.NextId();
entity.CreatorTime = DateTime.Now;
entity.CreatorUserId = _userManager.UserId;
var productEntryList = input.productEntryList.Adapt<List<ProductEntryEntity>>();
if (productEntryList != null)
{
productEntryList.ForEach(item =>
{
item.Id = SnowflakeIdHelper.NextId();
item.ProductId = entity.Id;
item.CreatorTime = DateTime.Now;
item.CreatorUserId = _userManager.UserId;
});
entity.productEntryList = productEntryList;
}
var isOk = await _repository.AsSugarClient().InsertNav(entity)
.Include(it => it.productEntryList).ExecuteCommandAsync();
if (!isOk)
throw Oops.Oh(ErrorCode.COM1000);
}
/// <summary>
/// 更新订单示例.
/// </summary>
/// <param name="id">主键值.</param>
/// <param name="input">参数.</param>
/// <returns></returns>
[HttpPut("{id}")]
[UnitOfWork]
public async Task Update(string id, [FromBody] ProductUpInput input)
{
var entity = input.Adapt<ProductEntity>();
entity.LastModifyTime = DateTime.Now;
entity.LastModifyUserId = _userManager.UserId;
await _repository.AsSugarClient().Updateable<ProductEntryEntity>()
.Where(it => it.ProductId.Equals(entity.Id) && !input.productEntryList.Select(a => a.id).ToList().Contains(it.Id))
.SetColumns(it => new ProductEntryEntity()
{
DeleteMark = 1,
DeleteUserId = _userManager.UserId,
DeleteTime = SqlFunc.GetDate()
}).ExecuteCommandAsync();
var productEntryList = input.productEntryList.Adapt<List<ProductEntryEntity>>();
productEntryList.ForEach(item =>
{
item.Id = item.Id == null ? SnowflakeIdHelper.NextId() : item.Id;
item.ProductId = entity.Id;
});
await _repository.AsSugarClient().Storageable(productEntryList).ExecuteCommandAsync();
var isOk = await _repository.AsUpdateable(entity).UpdateColumns(it => new
{
it.Code,
it.CustomerName,
it.ContactTel,
it.Address,
it.GoodsWarehouse,
it.Business,
it.GatheringType,
it.PartPrice,
it.ReducedPrice,
it.DiscountPrice,
it.Description,
it.LastModifyUserId,
it.LastModifyTime
}).ExecuteCommandAsync();
if (!(isOk > 0))
throw Oops.Oh(ErrorCode.COM1001);
}
/// <summary>
/// 删除订单示例.
/// </summary>
/// <returns></returns>
[HttpDelete("{id}")]
[UnitOfWork]
public async Task Delete(string id)
{
await _repository.AsSugarClient().Updateable<ProductEntryEntity>()
.Where(it => it.ProductId.Equals(id))
.SetColumns(it => new ProductEntryEntity()
{
DeleteMark = 1,
DeleteUserId = _userManager.UserId,
DeleteTime = SqlFunc.GetDate()
}).ExecuteCommandAsync();
var isOk = await _repository.AsUpdateable()
.Where(it => it.Id.Equals(id))
.SetColumns(it => new ProductEntity()
{
DeleteMark = 1,
DeleteUserId = _userManager.UserId,
DeleteTime = SqlFunc.GetDate()
}).ExecuteCommandAsync();
if (!(isOk > 0))
throw Oops.Oh(ErrorCode.COM1002);
}
#endregion
}

View File

@@ -1,10 +1,10 @@
using JNPF.Common.Core.Manager;
using JNPF.Common.Core.Handlers;
using JNPF.Common.Core.Manager;
using JNPF.Common.Security;
using JNPF.DependencyInjection;
using JNPF.DynamicApiController;
using JNPF.Message.Entitys;
using JNPF.Message.Entitys.Dto.ImReply;
using JNPF.Message.Handlers;
using JNPF.Message.Interfaces;
using JNPF.Systems.Entitys.Permission;
using Mapster;

View File

@@ -1,4 +1,5 @@
using JNPF.Common.Core.Manager;
using JNPF.Common.Core.Handlers;
using JNPF.Common.Core.Manager;
using JNPF.Common.Enums;
using JNPF.Common.Extension;
using JNPF.Common.Filter;
@@ -12,7 +13,6 @@ using JNPF.LinqBuilder;
using JNPF.Message.Entitys;
using JNPF.Message.Entitys.Dto.Message;
using JNPF.Message.Entitys.Entity;
using JNPF.Message.Handlers;
using JNPF.Message.Interfaces.Message;
using JNPF.RemoteRequest.Extensions;
using JNPF.Systems.Entitys.Permission;
@@ -26,7 +26,8 @@ namespace JNPF.Message;
/// <summary>
/// 系统消息
/// 版 本V3.2
/// 版 权:拓通智联科技有限公司http://www.tuotong-tech.com
/// 版 权:引迈信息技术有限公司https://www.jnpfsoft.com
/// 作 者JNPF开发平台组
/// 日 期2021-06-01.
/// </summary>
[ApiDescriptionSettings(Tag = "Message", Name = "message", Order = 240)]

View File

@@ -10,7 +10,6 @@
<ItemGroup>
<ProjectReference Include="..\..\common\Tnb.Common.Core\Tnb.Common.Core.csproj" />
<ProjectReference Include="..\..\common\Tnb.WebSockets\Tnb.WebSockets.csproj" />
<ProjectReference Include="..\..\system\Tnb.Systems.Interfaces\Tnb.Systems.Interfaces.csproj" />
<ProjectReference Include="..\..\workflow\Tnb.WorkFlow.Entitys\Tnb.WorkFlow.Entitys.csproj" />
<ProjectReference Include="..\Tnb.Message.Interfaces\Tnb.Message.Interfaces.csproj" />

View File

@@ -1,6 +1,9 @@
using JNPF.Common.Core.Manager;
using JNPF.Common.Const;
using JNPF.Common.Core.Handlers;
using JNPF.Common.Core.Manager;
using JNPF.Common.Enums;
using JNPF.Common.Extension;
using JNPF.Common.Manager;
using JNPF.Common.Models.User;
using JNPF.Common.Security;
using JNPF.DatabaseAccessor;
@@ -36,15 +39,29 @@ public class AuthorizeService : IAuthorizeService, IDynamicApiController, ITrans
/// </summary>
private readonly IUserManager _userManager;
/// <summary>
/// 缓存管理器.
/// </summary>
private readonly ICacheManager _cacheManager;
/// <summary>
/// IM中心处理程序.
/// </summary>
private IMHandler _imHandler;
/// <summary>
/// 初始化一个<see cref="AuthorizeService"/>类型的新实例.
/// </summary>
public AuthorizeService(
ISqlSugarRepository<AuthorizeEntity> authorizeRepository,
IUserManager userManager)
ICacheManager cacheManager,
IUserManager userManager,
IMHandler imHandler)
{
_authorizeRepository = authorizeRepository;
_cacheManager = cacheManager;
_userManager = userManager;
_imHandler = imHandler;
}
#region Get
@@ -391,42 +408,52 @@ public class AuthorizeService : IAuthorizeService, IDynamicApiController, ITrans
/// <param name="input"></param>
/// <returns></returns>
[HttpPut("Model/{itemId}")]
[UnitOfWork]
public async Task UpdateModel(string itemId, [FromBody] AuthorizeModelInput input)
{
List<AuthorizeEntity>? authorizeList = new List<AuthorizeEntity>();
// 角色ID不为空
if (input.objectId.Count > 0)
try
{
input.objectId.ForEach(item =>
_authorizeRepository.AsSugarClient().Ado.BeginTran();
// 角色ID不为空
if (input.objectId.Count > 0)
{
AuthorizeEntity? entity = new AuthorizeEntity();
entity.Id = SnowflakeIdHelper.NextId();
entity.CreatorTime = DateTime.Now;
entity.CreatorUserId = _userManager.UserId;
entity.ItemId = itemId;
entity.ItemType = input.itemType;
entity.ObjectId = item;
entity.ObjectType = input.objectType;
entity.SortCode = input.objectId.IndexOf(item);
authorizeList.Add(entity);
});
input.objectId.ForEach(item =>
{
AuthorizeEntity? entity = new AuthorizeEntity();
entity.Id = SnowflakeIdHelper.NextId();
entity.CreatorTime = DateTime.Now;
entity.CreatorUserId = _userManager.UserId;
entity.ItemId = itemId;
entity.ItemType = input.itemType;
entity.ObjectId = item;
entity.ObjectType = input.objectType;
entity.SortCode = input.objectId.IndexOf(item);
authorizeList.Add(entity);
});
// 删除除了门户外的相关权限
await _authorizeRepository.DeleteAsync(a => a.ItemId == itemId);
// 删除除了门户外的相关权限
await _authorizeRepository.DeleteAsync(a => a.ItemId == itemId);
// 新增权限
await _authorizeRepository.AsSugarClient().Insertable(authorizeList).CallEntityMethod(m => m.Creator()).ExecuteCommandAsync();
// 新增权限
await _authorizeRepository.AsSugarClient().Insertable(authorizeList).CallEntityMethod(m => m.Creator()).ExecuteCommandAsync();
// 编辑角色权限退出角色的登录用户
await ForcedOffline(input.objectId);
}
else
{
// 删除除了门户外的相关权限
await _authorizeRepository.DeleteAsync(a => a.ItemId == itemId);
}
_authorizeRepository.AsSugarClient().Ado.CommitTran();
}
else
catch
{
// 删除除了门户外的相关权限
await _authorizeRepository.DeleteAsync(a => a.ItemId == itemId);
_authorizeRepository.AsSugarClient().Ado.RollbackTran();
}
if(input.objectId.Any()) await ForcedOffline(input.objectId); // 编辑角色权限退出角色的登录用户
}
/// <summary>
@@ -754,14 +781,17 @@ public class AuthorizeService : IAuthorizeService, IDynamicApiController, ITrans
{
// 查找该角色下的所有成员id
var roleUserIds = await _authorizeRepository.AsSugarClient().Queryable<UserRelationEntity>().Where(x => x.ObjectType == "Role" && roleId.Contains(x.ObjectId)).Select(x => x.UserId).ToListAsync();
Scoped.Create((_, scope) =>
roleUserIds.ForEach(async id =>
{
roleUserIds.ForEach(id =>
var tenantId = _userManager.TenantId;
var list = await GetOnlineUserList(tenantId);
var user = list.Find(it => it.tenantId == tenantId && it.userId == id);
if (user != null)
{
var services = scope.ServiceProvider;
var _onlineuser = App.GetService<OnlineUserService>(services);
_onlineuser.ForcedOffline(id);
});
await _imHandler.SendMessageAsync(user.connectionId, new { method = "logout", msg = "此账号已在其他地方登陆" }.ToJsonString());
await DelOnlineUser(tenantId, user.userId);
await DelUserInfo(tenantId, user.userId);
}
});
}
#endregion
@@ -1018,5 +1048,44 @@ public class AuthorizeService : IAuthorizeService, IDynamicApiController, ITrans
return output;
}
/// <summary>
/// 获取在线用户列表.
/// </summary>
/// <param name="tenantId">租户ID.</param>
/// <returns></returns>
public async Task<List<UserOnlineModel>> GetOnlineUserList(string tenantId)
{
var cacheKey = string.Format("{0}{1}", CommonConst.CACHEKEYONLINEUSER, tenantId);
return await _cacheManager.GetAsync<List<UserOnlineModel>>(cacheKey);
}
/// <summary>
/// 删除在线用户ID.
/// </summary>
/// <param name="tenantId">租户ID.</param>
/// <param name="userId">用户ID.</param>
/// <returns></returns>
private async Task<bool> DelOnlineUser(string tenantId, string userId)
{
var cacheKey = string.Format("{0}{1}", CommonConst.CACHEKEYONLINEUSER, tenantId);
var list = await _cacheManager.GetAsync<List<UserOnlineModel>>(cacheKey);
var online = list.Find(it => it.userId == userId);
list.RemoveAll((x) => x.connectionId == online.connectionId);
return await _cacheManager.SetAsync(cacheKey, list);
}
/// <summary>
/// 删除用户登录信息缓存.
/// </summary>
/// <param name="tenantId">租户ID.</param>
/// <param name="userId">用户ID.</param>
/// <returns></returns>
private async Task<bool> DelUserInfo(string tenantId, string userId)
{
var cacheKey = string.Format("{0}{1}_{2}", CommonConst.CACHEKEYUSER, tenantId, userId);
return await _cacheManager.DelAsync(cacheKey);
}
#endregion
}

View File

@@ -474,6 +474,13 @@ public class UsersCurrentService : IUsersCurrentService, IDynamicApiController,
}
else
{
// 当前系统已被管理员禁用.
var switchSystem = await _repository.AsSugarClient().Queryable<SystemEntity>()
.Where(it => input.majorId.Equals(it.Id) && it.DeleteMark == null)
.FirstAsync();
if (switchSystem != null && !switchSystem.EnabledMark.Equals(1))
throw Oops.Oh(ErrorCode.D4014);
// 系统下没有菜单不允许切换.
var mList = await _repository.AsSugarClient().Queryable<ModuleEntity>().Where(x => x.SystemId.Equals(input.majorId) && x.DeleteMark == null && x.Category.Equals("Web")).Select(x => x.Id).ToListAsync();
if (!mList.Any()) throw Oops.Oh(ErrorCode.D4009);

View File

@@ -6,6 +6,7 @@ using JNPF.Common.Enums;
using JNPF.Common.Extension;
using JNPF.Common.Filter;
using JNPF.Common.Helper;
using JNPF.Common.Manager;
using JNPF.Common.Models.NPOI;
using JNPF.Common.Models.User;
using JNPF.Common.Security;
@@ -69,6 +70,11 @@ public class UsersService : IUsersService, IDynamicApiController, ITransient
/// </summary>
private readonly IFileManager _fileManager;
/// <summary>
/// 缓存管理.
/// </summary>
private readonly ICacheManager _cacheManager;
/// <summary>
/// 用户管理.
/// </summary>
@@ -83,6 +89,7 @@ public class UsersService : IUsersService, IDynamicApiController, ITransient
IUserRelationService userRelationService,
ISysConfigService sysConfigService,
ISynThirdInfoService synThirdInfoService,
ICacheManager cacheManager,
IFileManager fileService,
IUserManager userManager)
{
@@ -91,6 +98,7 @@ public class UsersService : IUsersService, IDynamicApiController, ITransient
_userRelationService = userRelationService;
_sysConfigService = sysConfigService;
_userManager = userManager;
_cacheManager = cacheManager;
_synThirdInfoService = synThirdInfoService;
_fileManager = fileService;
}
@@ -1522,6 +1530,7 @@ public class UsersService : IUsersService, IDynamicApiController, ITransient
fs.Close();
}
_cacheManager.Set(excelconfig.FileName, string.Empty);
return new { name = excelconfig.FileName, url = "/api/file/Download?encryption=" + DESCEncryption.Encrypt(_userManager.UserId + "|" + excelconfig.FileName + "|" + addPath, "JNPF") };
}
@@ -1551,6 +1560,7 @@ public class UsersService : IUsersService, IDynamicApiController, ITransient
string? addPath = Path.Combine(FileVariable.TemporaryFilePath, excelconfig.FileName);
ExcelExportHelper<UserListImportDataInput>.Export(dataList, excelconfig, addPath);
_cacheManager.Set(excelconfig.FileName, string.Empty);
return new { name = excelconfig.FileName, url = "/api/file/Download?encryption=" + DESCEncryption.Encrypt(_userManager.UserId + "|" + excelconfig.FileName + "|" + addPath, "JNPF") };
}
@@ -1631,6 +1641,7 @@ public class UsersService : IUsersService, IDynamicApiController, ITransient
string? addPath = Path.Combine(FileVariable.TemporaryFilePath, excelconfig.FileName);
ExcelExportHelper<UserListImportDataInput>.Export(errorlist, excelconfig, addPath);
_cacheManager.Set(excelconfig.FileName, string.Empty);
return new { name = excelconfig.FileName, url = "/api/file/Download?encryption=" + DESCEncryption.Encrypt(_userManager.UserId + "|" + excelconfig.FileName + "|" + addPath, "JNPF") };
}

View File

@@ -46,7 +46,8 @@ namespace JNPF.Systems;
/// <summary>
/// 数据接口
/// 版 本V3.2
/// 版 权:拓通智联科技有限公司http://www.tuotong-tech.com
/// 版 权:引迈信息技术有限公司https://www.jnpfsoft.com
/// 作 者JNPF开发平台组
/// 日 期2021-06-01.
/// </summary>
[ApiDescriptionSettings(Tag = "System", Name = "DataInterface", Order = 204)]
@@ -345,7 +346,7 @@ public class DataInterfaceService : IDataInterfaceService, IDynamicApiController
{
string sheetData = Regex.Match(info.DataProcessing, @"\{(.*)\}", RegexOptions.Singleline).Groups[1].Value;
var scriptStr = "var result = function(data){data = JSON.parse(data);" + sheetData + "}";
return JsEngineUtil.CallFunction(scriptStr, output.ToJsonString());
return JsEngineUtil.CallFunction(scriptStr, output.ToJsonString(CommonConst.options));//此处时间非时间戳
}
}
@@ -732,7 +733,7 @@ public class DataInterfaceService : IDataInterfaceService, IDynamicApiController
list = await GetDynamicDataCache(dynamic.Id);
if (list == null)
if (list == null || list.Count == 0)
{
list = new List<StaticDataModel>();
// 远端数据 配置参数

View File

@@ -1,7 +1,12 @@
using JNPF.Common.Core.Manager;
using JNPF.Common.Const;
using JNPF.Common.Core.Handlers;
using JNPF.Common.Core.Manager;
using JNPF.Common.Enums;
using JNPF.Common.Extension;
using JNPF.Common.Filter;
using JNPF.Common.Manager;
using JNPF.Common.Models.User;
using JNPF.Common.Security;
using JNPF.DependencyInjection;
using JNPF.DynamicApiController;
using JNPF.FriendlyException;
@@ -27,6 +32,16 @@ public class SystemService : IDynamicApiController, ITransient
/// </summary>
private readonly ISqlSugarRepository<SystemEntity> _repository;
/// <summary>
/// 缓存管理器.
/// </summary>
private readonly ICacheManager _cacheManager;
/// <summary>
/// IM中心处理程序.
/// </summary>
private IMHandler _imHandler;
/// <summary>
/// 用户管理.
/// </summary>
@@ -37,9 +52,13 @@ public class SystemService : IDynamicApiController, ITransient
/// </summary>
public SystemService(
ISqlSugarRepository<SystemEntity> repository,
ICacheManager cacheManager,
IMHandler imHandler,
IUserManager userManager)
{
_repository = repository;
_cacheManager = cacheManager;
_imHandler = imHandler;
_userManager = userManager;
}
@@ -108,10 +127,99 @@ public class SystemService : IDynamicApiController, ITransient
{
if (await _repository.IsAnyAsync(x => x.Id != id && (x.EnCode == input.enCode || x.FullName == input.fullName) && x.DeleteMark == null))
throw Oops.Oh(ErrorCode.COM1004);
var entity = input.Adapt<SystemEntity>();
var isOk = await _repository.AsUpdateable(entity).IgnoreColumns(ignoreAllNullColumns: true).CallEntityMethod(m => m.LastModify()).ExecuteCommandHasChangeAsync();
if (!isOk)
var mainSystem = await _repository.GetFirstAsync(it => it.IsMain.Equals(1) && it.EnabledMark.Equals(1) && it.DeleteMark == null);
// 判断主系统是否被禁用.
if (input.id.Equals(mainSystem.Id) && input.enabledMark.Equals(0))
throw Oops.Oh(ErrorCode.D1036);
// 判断主系统是否有修改系统编码.
if (input.id.Equals(mainSystem.Id) && !input.enCode.Equals(mainSystem.EnCode))
throw Oops.Oh(ErrorCode.D1037);
var isOk = await _repository.AsUpdateable().SetColumns(it => new SystemEntity()
{
FullName = input.fullName,
EnCode = input.enCode,
Icon = input.icon,
SortCode = input.sortCode,
Description = input.description,
EnabledMark = input.enabledMark,
LastModifyUserId = _userManager.UserId,
LastModifyTime = SqlFunc.GetDate(),
}).Where(it => it.Id.Equals(id)).ExecuteCommandAsync();
if (!(isOk > 0))
throw Oops.Oh(ErrorCode.COM1001);
// 当用户的子系统被禁用时,更换成其他未被禁用的系统.
if (!input.id.Equals(mainSystem.Id) && input.enabledMark.Equals(0))
{
var systemUser = await _repository.AsSugarClient().Queryable<UserEntity>()
.Where(it => it.DeleteMark == null && input.id.Equals(it.SystemId))
.Select(x => new UserEntity()
{
Id = x.Id,
SystemId = x.SystemId
}).ToListAsync();
// 获取用户所有角色id.
var userRoleIdList = await _repository.AsSugarClient().Queryable<UserRelationEntity>()
.Where(it => systemUser.Select(s => s.Id).ToList().Contains(it.UserId) && it.ObjectType.Equals("Role"))
.Select(x => x.ObjectId)
.ToListAsync();
var authorizeList = await _repository.AsSugarClient().Queryable<AuthorizeEntity>()
.Where(it => it.ItemType.Equals("module") && it.ObjectType.Equals("Role"))
.ToListAsync();
var moduleList = await _repository.AsSugarClient().Queryable<ModuleEntity>()
.Where(it => !it.SystemId.Equals(mainSystem.Id) && !it.SystemId.Equals(input.id) && it.DeleteMark == null)
.ToListAsync();
systemUser.ForEach(async item =>
{
// 获取用户所有角色的菜单.
var moduleIdList = authorizeList
.Where(x => userRoleIdList.Contains(x.ObjectId))
.Select(s => s.ItemId);
// 获取用户所有有权限的系统id.
var systemId = moduleList
.Where(x => moduleIdList.Contains(x.Id))
.Select(s => s.SystemId).FirstOrDefault();
if (systemId == null)
systemId = mainSystem.Id;
// 更新用户的系统id.
var res = await _repository.AsSugarClient().Updateable<UserEntity>()
.Where(x => item.Id.Equals(x.Id))
.SetColumns(x => new UserEntity()
{
SystemId = systemId
}).ExecuteCommandAsync();
if (!(res > 0))
throw Oops.Oh(ErrorCode.COM1001);
});
var tenantId = _userManager.TenantId;
var cacheKey = string.Format("{0}{1}", CommonConst.CACHEKEYONLINEUSER, tenantId);
var allUserOnlineList = await _cacheManager.GetAsync<List<UserOnlineModel>>(cacheKey);
var userOnlineList = allUserOnlineList.FindAll(it => systemUser.Select(s => s.Id).ToList().Contains(it.userId));
userOnlineList.ForEach(async item =>
{
await _imHandler.SendMessageAsync(item.connectionId, new { method = "logout", msg = "此系统已被禁用" }.ToJsonString());
// 删除在线用户ID.
allUserOnlineList.RemoveAll((x) => x.connectionId == item.connectionId);
// 删除用户登录信息缓存.
var mCacheKey = string.Format("{0}{1}_{2}", CommonConst.CACHEKEYUSER, tenantId, item.userId);
await _cacheManager.DelAsync(mCacheKey);
});
await _cacheManager.SetAsync(cacheKey, allUserOnlineList);
}
}
/// <summary>

View File

@@ -106,8 +106,6 @@ public class CodeGenWay
ControlLabel = control.__config__.label,
IsImportField = isImportField.ParseToBool(),
ImportConfig = CodeGenControlsAttributeHelper.GetImportConfig(control, column.field, tableName),
ParsJnpfKeyConstList = CodeGenControlsAttributeHelper.GetParsJnpfKeyConstList(controls, (bool)columnDesignModel?.type.Equals(4)),
ParsJnpfKeyConstListDetails = CodeGenControlsAttributeHelper.GetParsJnpfKeyConstListDetails(controls),
});
break;
default:
@@ -149,8 +147,7 @@ public class CodeGenWay
ControlLabel = control.__config__.label,
IsImportField = isImportField.ParseToBool(),
ImportConfig = CodeGenControlsAttributeHelper.GetImportConfig(control, column.field, tableName),
ParsJnpfKeyConstList = CodeGenControlsAttributeHelper.GetParsJnpfKeyConstList(controls, (bool)columnDesignModel?.type.Equals(4)),
ParsJnpfKeyConstListDetails = CodeGenControlsAttributeHelper.GetParsJnpfKeyConstListDetails(controls),
ShowField = control.relational,
});
break;
}
@@ -292,6 +289,7 @@ public class CodeGenWay
ImportConfig = CodeGenControlsAttributeHelper.GetImportConfig(control, column.field, tableName),
IsImportField = isImportField.ParseToBool(),
ChildControlKey = controlId,
ShowField = control.relational,
});
break;
case false:
@@ -426,8 +424,6 @@ public class CodeGenWay
ControlLabel = control.__config__.label,
IsImportField = isImportField == null ? false : (bool)isImportField,
ImportConfig = CodeGenControlsAttributeHelper.GetImportConfig(control, column.field, tableName),
ParsJnpfKeyConstList = CodeGenControlsAttributeHelper.GetParsJnpfKeyConstList(controls, (bool)columnDesignModel?.type.Equals(4)),
ParsJnpfKeyConstListDetails = CodeGenControlsAttributeHelper.GetParsJnpfKeyConstListDetails(controls),
});
break;
default:
@@ -465,8 +461,7 @@ public class CodeGenWay
ControlLabel = control.__config__.label,
IsImportField = isImportField == null ? false : (bool)isImportField,
ImportConfig = CodeGenControlsAttributeHelper.GetImportConfig(control, column.field, tableName),
ParsJnpfKeyConstList = CodeGenControlsAttributeHelper.GetParsJnpfKeyConstList(controls, (bool)columnDesignModel?.type.Equals(4)),
ParsJnpfKeyConstListDetails = CodeGenControlsAttributeHelper.GetParsJnpfKeyConstListDetails(controls),
ShowField = control.relational,
});
break;
}
@@ -580,8 +575,6 @@ public class CodeGenWay
ControlLabel = control.__config__.label,
IsImportField = isImportField.ParseToBool(),
ImportConfig = CodeGenControlsAttributeHelper.GetImportConfig(control, column.field, tableName),
ParsJnpfKeyConstList = CodeGenControlsAttributeHelper.GetParsJnpfKeyConstList(controls, (bool)columnDesignModel?.type.Equals(4)),
ParsJnpfKeyConstListDetails = CodeGenControlsAttributeHelper.GetParsJnpfKeyConstListDetails(controls),
});
break;
default:
@@ -621,8 +614,6 @@ public class CodeGenWay
ControlLabel = control.__config__.label,
IsImportField = isImportField.ParseToBool(),
ImportConfig = CodeGenControlsAttributeHelper.GetImportConfig(control, column.field, tableName),
ParsJnpfKeyConstList = CodeGenControlsAttributeHelper.GetParsJnpfKeyConstList(controls, (bool)columnDesignModel?.type.Equals(4)),
ParsJnpfKeyConstListDetails = CodeGenControlsAttributeHelper.GetParsJnpfKeyConstListDetails(controls),
});
break;
}
@@ -740,8 +731,6 @@ public class CodeGenWay
ControlLabel = control.__config__.label,
IsImportField = columnDesignModel?.uploaderTemplateJson?.selectKey?.Any(it => it.Equals(field)) == null ? false : (bool)columnDesignModel?.uploaderTemplateJson?.selectKey?.Any(it => it.Equals(field)),
ImportConfig = CodeGenControlsAttributeHelper.GetImportConfig(control, column.field, tableName),
ParsJnpfKeyConstList = CodeGenControlsAttributeHelper.GetParsJnpfKeyConstList(controls, (bool)columnDesignModel?.type.Equals(4)),
ParsJnpfKeyConstListDetails = CodeGenControlsAttributeHelper.GetParsJnpfKeyConstListDetails(controls),
});
break;
default:
@@ -781,8 +770,7 @@ public class CodeGenWay
ControlLabel = control.__config__.label,
IsImportField = columnDesignModel?.uploaderTemplateJson?.selectKey?.Any(it => it.Equals(field)) == null ? false : (bool)columnDesignModel?.uploaderTemplateJson?.selectKey?.Any(it => it.Equals(field)),
ImportConfig = CodeGenControlsAttributeHelper.GetImportConfig(control, column.field, tableName),
ParsJnpfKeyConstList = CodeGenControlsAttributeHelper.GetParsJnpfKeyConstList(controls, (bool)columnDesignModel?.type.Equals(4)),
ParsJnpfKeyConstListDetails = CodeGenControlsAttributeHelper.GetParsJnpfKeyConstListDetails(controls),
ShowField = control.relational,
});
break;
}
@@ -893,8 +881,6 @@ public class CodeGenWay
ControlLabel = control.__config__.label,
IsImportField = isImportField.ParseToBool(),
ImportConfig = CodeGenControlsAttributeHelper.GetImportConfig(control, column.field, tableName),
ParsJnpfKeyConstList = CodeGenControlsAttributeHelper.GetParsJnpfKeyConstList(controls, (bool)columnDesignModel?.type.Equals(4)),
ParsJnpfKeyConstListDetails = CodeGenControlsAttributeHelper.GetParsJnpfKeyConstListDetails(controls),
});
break;
default:
@@ -932,8 +918,7 @@ public class CodeGenWay
ControlLabel = control.__config__.label,
IsImportField = isImportField.ParseToBool(),
ImportConfig = CodeGenControlsAttributeHelper.GetImportConfig(control, column.field, tableName),
ParsJnpfKeyConstList = CodeGenControlsAttributeHelper.GetParsJnpfKeyConstList(controls, (bool)columnDesignModel?.type.Equals(4)),
ParsJnpfKeyConstListDetails = CodeGenControlsAttributeHelper.GetParsJnpfKeyConstListDetails(controls),
ShowField = control.relational,
});
break;
}
@@ -1214,7 +1199,7 @@ public class CodeGenWay
var isAdd = indexTopButton.Any(it => it.Value == "add");
var isTreeRelation = !string.IsNullOrEmpty(columnDesignModel?.treeRelation);
var isRelationForm = formControlList.Any(it => it.IsRelationForm);
var isFixed = columnDesignModel.childTableStyle == 1 ? indexColumnDesign.Any(it => it.Fixed.Any()) : false;
var isFixed = columnDesignModel.childTableStyle == 1 ? indexColumnDesign.Any(it => it.Fixed.Equals("fixed='left' ") && !it.Name.Equals(columnDesignModel.groupField)) : false;
switch (logic)
{

View File

@@ -250,12 +250,7 @@ public class TableColumnConfigModel
public string LeagueTableNo { get; set; }
/// <summary>
/// 需解析的控件类型 JnpfKeyConst @@ 需解析的字段集合(以,隔开).
/// 展示字段.
/// </summary>
public List<string[]> ParsJnpfKeyConstList { get; set; }
/// <summary>
/// 需解析的控件类型 JnpfKeyConst @@ 需解析的字段集合(以,隔开)(行内编辑 特殊处理).
/// </summary>
public List<string[]> ParsJnpfKeyConstListDetails { get; set; }
public string ShowField { get; set; }
}

View File

@@ -220,4 +220,10 @@ public class LinkageConfig
/// 是否多选.
/// </summary>
public bool IsMultiple { get; set; }
/// <summary>
/// 联动模板json.
/// </summary>
public List<LinkageConfig> templateJson { get; set; }
}

View File

@@ -5,7 +5,7 @@ namespace JNPF.VisualDev.Engine;
/// <summary>
/// 实体字段模型
/// 版 本V3.0.0
/// 版 权:拓通智联科技有限公司http://www.tuotong-tech.com
/// 版 权:引迈信息技术有限公司https://www.jnpfsoft.com
/// 作 者JNPF开发平台组.
/// </summary>
[SuppressSniffer]

View File

@@ -581,4 +581,9 @@ public class FieldsModel
/// 上级__vModel__.
/// </summary>
public string superiorVModel { get; set; }
/// <summary>
/// 后端自我创建字段、用于统一处理关联表单属性与弹窗选择属性.
/// </summary>
public string relational { get; set; }
}

View File

@@ -92,7 +92,6 @@ public class CodeGenControlsAttributeHelper
case JnpfKeyConst.DEPSELECT:
case JnpfKeyConst.POSSELECT:
case JnpfKeyConst.USERSELECT:
case JnpfKeyConst.POPUPTABLESELECT:
case JnpfKeyConst.ROLESELECT:
case JnpfKeyConst.GROUPSELECT:
{
@@ -106,7 +105,9 @@ public class CodeGenControlsAttributeHelper
case JnpfKeyConst.CHECKBOX:
case JnpfKeyConst.CASCADER:
case JnpfKeyConst.COMSELECT:
case JnpfKeyConst.POPUPTABLESELECT:
case JnpfKeyConst.ADDRESS:
case JnpfKeyConst.USERSSELECT:
tag = true;
break;
}
@@ -206,7 +207,6 @@ public class CodeGenControlsAttributeHelper
case JnpfKeyConst.DEPSELECT:
case JnpfKeyConst.POSSELECT:
case JnpfKeyConst.USERSELECT:
case JnpfKeyConst.POPUPTABLESELECT:
case JnpfKeyConst.ROLESELECT:
case JnpfKeyConst.GROUPSELECT:
{
@@ -221,6 +221,7 @@ public class CodeGenControlsAttributeHelper
case JnpfKeyConst.CASCADER:
case JnpfKeyConst.COMSELECT:
case JnpfKeyConst.ADDRESS:
case JnpfKeyConst.POPUPTABLESELECT:
tag = true;
break;
}
@@ -248,6 +249,7 @@ public class CodeGenControlsAttributeHelper
case JnpfKeyConst.DEPSELECT:
case JnpfKeyConst.POSSELECT:
case JnpfKeyConst.USERSELECT:
case JnpfKeyConst.USERSSELECT:
case JnpfKeyConst.POPUPTABLESELECT:
case JnpfKeyConst.ROLESELECT:
case JnpfKeyConst.GROUPSELECT:
@@ -456,6 +458,14 @@ public class CodeGenControlsAttributeHelper
if (!res.ContainsKey(JnpfKeyConst.USERSSELECT)) res.Add(JnpfKeyConst.USERSSELECT, new List<string>());
res[JnpfKeyConst.USERSSELECT].Add(item.__vModel__);
break;
case JnpfKeyConst.POPUPSELECT: // 弹窗选择
if (!res.ContainsKey(JnpfKeyConst.POPUPSELECT)) res.Add(JnpfKeyConst.POPUPSELECT, new List<string>());
res[JnpfKeyConst.POPUPSELECT].Add(item.__vModel__);
break;
case JnpfKeyConst.RELATIONFORM: // 关联表单
if (!res.ContainsKey(JnpfKeyConst.RELATIONFORM)) res.Add(JnpfKeyConst.RELATIONFORM, new List<string>());
res[JnpfKeyConst.RELATIONFORM].Add(item.__vModel__);
break;
case JnpfKeyConst.TABLE: // 遍历 子表 控件
var ctRes = GetParsJnpfKeyConstList(item.__config__.children, isInlineEditor);
if (ctRes != null && ctRes.Any())
@@ -463,7 +473,7 @@ public class CodeGenControlsAttributeHelper
foreach (var ct in ctRes)
{
if (!res.ContainsKey(ct.FirstOrDefault())) res.Add(ct.FirstOrDefault(), new List<string>());
res[ct.FirstOrDefault()].AddRange(ct.LastOrDefault().Split(','));
res[ct.FirstOrDefault()].Add(item.__vModel__ + "-" + ct.LastOrDefault());
}
}
break;
@@ -506,10 +516,6 @@ public class CodeGenControlsAttributeHelper
if (!res.ContainsKey(JnpfKeyConst.USERSSELECT)) res.Add(JnpfKeyConst.USERSSELECT, new List<string>());
res[JnpfKeyConst.USERSSELECT].Add(item.__vModel__);
break;
case JnpfKeyConst.POPUPTABLESELECT: // 下拉表格.
if (!res.ContainsKey(JnpfKeyConst.POPUPTABLESELECT)) res.Add(JnpfKeyConst.POPUPTABLESELECT, new List<string>());
res[JnpfKeyConst.POPUPTABLESELECT].Add(item.__vModel__);
break;
case JnpfKeyConst.POPUPSELECT: // 弹窗选择.
if (!res.ContainsKey(JnpfKeyConst.POPUPSELECT)) res.Add(JnpfKeyConst.POPUPSELECT, new List<string>());
res[JnpfKeyConst.POPUPSELECT].Add(item.__vModel__);
@@ -524,8 +530,8 @@ public class CodeGenControlsAttributeHelper
{
foreach (var ct in ctRes)
{
if (!res.ContainsKey(item.__vModel__ + "-" + ct.FirstOrDefault())) res.Add(item.__vModel__ + "-" + ct.FirstOrDefault(), new List<string>());
res[item.__vModel__ + "-" + ct.FirstOrDefault()].AddRange(ct.LastOrDefault().Split(','));
if (!res.ContainsKey(ct.FirstOrDefault())) res.Add(ct.FirstOrDefault(), new List<string>());
res[ct.FirstOrDefault()].Add(item.__vModel__ + "-" + ct.LastOrDefault());
}
}

View File

@@ -288,4 +288,41 @@ public class CodeGenUnifiedHandlerHelper
}
return NewFormDataModel;
}
/// <summary>
/// 统一处理控件关系.
/// </summary>
/// <param name="formDataModel">控件列表.</param>
/// <returns></returns>
public static List<FieldsModel> UnifiedHandlerControlRelationship(List<FieldsModel> formDataModel, bool isMain = true)
{
formDataModel.ForEach(item =>
{
switch (item.__config__.jnpfKey)
{
case JnpfKeyConst.RELATIONFORM:
{
var list = formDataModel.FindAll(it => it.__config__.jnpfKey.Equals(JnpfKeyConst.RELATIONFORMATTR) && it.relationField.Equals(string.Format("{0}_jnpfTable_{1}{2}", item.__vModel__, item.__config__.tableName, isMain ? 1 : 0)) && it.__config__.isStorage.Equals(1));
item.relational = string.Join(",", list.Select(it => it.showField).ToList());
}
break;
case JnpfKeyConst.TABLE:
{
item.__config__.children = UnifiedHandlerControlRelationship(item.__config__.children, false);
}
break;
case JnpfKeyConst.POPUPSELECT:
{
var list = formDataModel.FindAll(it => it.__config__.jnpfKey.Equals(JnpfKeyConst.POPUPATTR) && it.relationField.Equals(string.Format("{0}_jnpfTable_{1}{2}", item.__vModel__, item.__config__.tableName, isMain ? 1 : 0)) && it.__config__.isStorage.Equals(1));
item.relational = string.Join(",", list.Select(it => it.showField).ToList());
}
break;
}
});
return formDataModel;
}
}

View File

@@ -363,9 +363,11 @@ public class CodeGenFormControlDesignHelper
{
var relationField = Regex.Match(item.relationField, @"^(.+)_jnpfTable_").Groups[1].Value;
var relationControl = realisticControls.Find(it => it.__vModel__ == relationField);
var columnDesign = columnDesignModel?.Find(it => it.__vModel__ == item.__vModel__);
list.Add(new FormControlDesignModel()
{
vModel = item.__vModel__.IsNotEmptyOrNull() ? string.Format("v-model=\"dataForm.{0}\"", item.__vModel__) : string.Empty,
IsInlineEditor = columnDesignModel != null ? columnDesignModel.Any(it => it.__vModel__ == item.__vModel__) : false,
Style = item.style != null && !item.style.ToString().Equals("{}") ? $":style='{item.style.ToJsonString()}' " : string.Empty,
jnpfKey = config.jnpfKey,
OriginalName = config.isStorage == 2 ? item.__vModel__ : relationField,
@@ -377,7 +379,9 @@ public class CodeGenFormControlDesignHelper
Label = config.label,
Span = config.span,
IsStorage = config.isStorage,
IndexWidth = columnDesign?.width,
LabelWidth = config?.labelWidth ?? labelWidth,
IndexAlign = columnDesign?.align,
});
}

View File

@@ -15,9 +15,6 @@ using JNPF.Systems.Interfaces.System;
using JNPF.RemoteRequest.Extensions;
using JNPF.Systems.Entitys.Model.DataInterFace;
using JNPF.Common.Core.Manager;
using Microsoft.AspNetCore.Identity;
using Spire.Pdf.Lists;
using Senparc.NeuChar.Entities;
namespace JNPF.Common.CodeGen.DataParsing;
@@ -43,11 +40,6 @@ public class ControlParsing : ITransient
/// </summary>
private readonly IDataInterfaceService _dataInterfaceService;
/// <summary>
/// 解析控件的控件属性 (vModel , Attr).
/// </summary>
private Dictionary<string, FieldsModel>? ControlAttr;
/// <summary>
/// 构造函数.
/// </summary>
@@ -74,9 +66,6 @@ public class ControlParsing : ITransient
/// <returns></returns>
public async Task<List<Dictionary<string, object>>> GetParsDataList(List<Dictionary<string, object>> oldDatas, string vModelStr, string jnpfKeyConst, string tenantId, List<FieldsModel>? vModelAttr = null)
{
ControlAttr = new Dictionary<string, FieldsModel>();
if (vModelAttr != null) vModelAttr.ForEach(it => ControlAttr.Add(it.__vModel__, it));
var vModels = new Dictionary<string, object>();
var vModelList = vModelStr.Split(',');
oldDatas.ForEach(items =>
@@ -91,45 +80,54 @@ public class ControlParsing : ITransient
var ctOldDatas = item.Value.ToObject<List<Dictionary<string, object>>>();
ctOldDatas.ForEach(ctItems =>
{
foreach (var ctItem in ctItems) if (vModelList.Contains(ctItem.Key) && !vModels.ContainsKey(ctItem.Key)) vModels.Add(ctItem.Key, jnpfKeyConst);
foreach (var ctItem in ctItems)
{
if (vModelList.Contains(item.Key + "-" + ctItem.Key) && !vModels.ContainsKey(item.Key + "-" + ctItem.Key))
vModels.Add(item.Key + "-" + ctItem.Key, jnpfKeyConst);
}
});
}
}
});
return await GetParsDataByList(oldDatas, vModels, tenantId);
return await GetParsDataByList(vModelAttr, oldDatas, vModels, tenantId);
}
/// <summary>
/// 获取解析数据.
/// </summary>
/// <param name="fields">模板集合.</param>
/// <param name="oldDatas">原数据集合.</param>
/// <param name="vModels">需解析的字段 (字段名,JnpfKeyConst/子表dictionary).</param>
/// <param name="tenantId">租户Id.</param>
/// <returns></returns>
private async Task<List<Dictionary<string, object>>> GetParsDataByList(List<Dictionary<string, object>> oldDatas, Dictionary<string, object> vModels, string tenantId)
private async Task<List<Dictionary<string, object>>> GetParsDataByList(List<FieldsModel> fields, List<Dictionary<string, object>> oldDatas, Dictionary<string, object> vModels, string tenantId)
{
var cacheData = await GetCaCheData(vModels, tenantId);
var usersselectDatas = cacheData.Where(t => t.Key.Equals(CommonConst.CodeGenDynamic + "_usersSelect_" + tenantId)).FirstOrDefault().Value.ToObject<Dictionary<string, string>>(); // 用户组件
oldDatas.ForEach(async items =>
foreach (var items in oldDatas)
{
foreach (var item in items)
for(var i = 0; i < items.Count; i++)
{
if (vModels.Any(x => x.Key.Equals(item.Key)))
var item = items.ToList()[i];
if (vModels.Any(x => x.Key.Equals(item.Key)) && items[item.Key] != null)
{
FieldsModel model = ControlAttr.ContainsKey(item.Key) ? ControlAttr[item.Key] : new FieldsModel();
FieldsModel model = fields.Any(x=>x.__vModel__.Equals(item.Key)) ? fields.Find(x=> x.__vModel__.Equals(item.Key)) : (fields.Any(x => x.__vModel__.Equals(item.Key.Replace("_name", string.Empty))) ? fields.Find(x => x.__vModel__.Equals(item.Key.Replace("_name", string.Empty))) : new FieldsModel());
model.separator = ",";
var jnpfKey = vModels.FirstOrDefault(x => x.Key.Equals(item.Key)).Value;
switch (jnpfKey)
{
case JnpfKeyConst.USERSSELECT:
{
if (item.Value != null)
var itemValue = item.Value;
if (itemValue == null && items.ContainsKey(item.Key.Replace("_name", string.Empty))) itemValue = items[item.Key.Replace("_name", string.Empty)];
if (itemValue != null)
{
var vList = new List<string>();
if (item.Value.ToString().Contains("[")) vList = item.Value.ToString().ToObject<List<string>>();
else vList.Add(item.Value.ToString());
if (itemValue.ToString().Contains("[")) vList = itemValue.ToString().ToObject<List<string>>();
else vList.Add(itemValue.ToString());
var itemValues = new List<string>();
vList.ForEach(it =>
{
@@ -140,7 +138,6 @@ public class ControlParsing : ITransient
}
break;
case JnpfKeyConst.POPUPTABLESELECT:
case JnpfKeyConst.POPUPSELECT: // 弹窗选择
{
if (model.interfaceId.IsNullOrEmpty()) continue;
@@ -193,62 +190,45 @@ public class ControlParsing : ITransient
{
case 1: // SQL数据
{
var specificData = popupselectDataList.Where(it => it.ContainsKey(model.propsValue) && it.ContainsValue(items[item.Key].ToString())).FirstOrDefault();
var specificData = popupselectDataList.Where(it => it.ContainsKey(model.propsValue) && it.ContainsValue(items[item.Key] == null ? model.interfaceId : items[item.Key].ToString())).FirstOrDefault();
if (specificData != null)
{
// 要用模板的 “显示字段 - relationField”来展示数据
items[item.Key + "_id"] = items[item.Key];
items[item.Key] = specificData[model.relationField];
}
else
{
if (model.multiple)
{
var nameList = new List<string>();
items[item.Key].ToObject<List<string>>().ForEach(strIt =>
{
var specificData = popupselectDataList.Where(it => it.ContainsKey(model.propsValue) && it.ContainsValue(strIt)).FirstOrDefault();
if (specificData != null)
{
// 要用模板的 “显示字段 - relationField”来展示数据
if (model.relationField.IsNotEmptyOrNull())
nameList.Add(specificData[model.relationField]);
}
});
if (nameList.Any())
{
items[item.Key + "_id"] = items[item.Key];
items[item.Key] = string.Join(model.separator, nameList);
}
}
else
{
items[item.Key] = items[item.Key].ToString().Contains("[") ? string.Join(model.separator, items[item.Key].ToObject<List<object>>()) : items[item.Key];
}
// 弹窗选择属性
if (model.relational.IsNotEmptyOrNull())
foreach (var fItem in model.relational.Split(",")) items[model.__vModel__ + "_" + fItem] = specificData[fItem];
}
}
break;
case 2: // 静态数据
{
List<string> dataList = items[item.Key].ToJsonString().ToObject<List<string>>();
List<string> cascaderList = new List<string>();
foreach (var it in dataList)
var vara = popupselectDataList.Where(a => a.ContainsValue(items[item.Key] == null ? model.interfaceId : items[item.Key].ToString())).FirstOrDefault();
if (vara != null)
{
var vara = popupselectDataList.Where(a => a.ContainsValue(it)).FirstOrDefault();
if (vara != null) cascaderList.Add(vara[model.props.props.label]);
}
items[item.Key + "_id"] = items[item.Key];
items[item.Key] = vara[items[item.Key].ToString()];
items[item.Key + "_id"] = items[item.Key];
items[item.Key] = string.Join(model.separator, cascaderList);
// 弹窗选择属性
if (model.relational.IsNotEmptyOrNull())
foreach (var fItem in model.relational.Split(",")) items[model.__vModel__ + "_" + fItem] = vara[fItem];
}
}
break;
case 3: // Api数据
{
List<object> cascaderList = new List<object>();
if (popupselectDataList != null) popupselectDataList.ForEach(obj => { if (obj[model.propsValue] == items[item.Key].ToString()) cascaderList.Add(obj[model.relationField]); });
var vara = popupselectDataList.Where(a => a.ContainsValue(items[item.Key] == null ? model.interfaceId : items[item.Key].ToString())).FirstOrDefault();
if (vara != null)
{
items[item.Key + "_id"] = items[item.Key];
items[item.Key] = vara[items[item.Key].ToString()];
items[item.Key + "_id"] = items[item.Key];
items[item.Key] = string.Join(model.separator, cascaderList);
// 弹窗选择属性
if (model.relational.IsNotEmptyOrNull())
foreach (var fItem in model.relational.Split(",")) items[model.__vModel__ + "_" + fItem] = vara[fItem];
}
}
break;
}
@@ -293,6 +273,10 @@ public class ControlParsing : ITransient
{
items[item.Key + "_id"] = relationFormRealData["id"];
items[item.Key] = relationFormRealData.ContainsKey(model.relationField) ? relationFormRealData[model.relationField] : string.Empty;
// 关联表单属性
if (model.relational.IsNotEmptyOrNull())
foreach (var fItem in model.relational.Split(",")) items[model.__vModel__ + "_" + fItem] = relationFormRealData[fItem];
}
else
{
@@ -309,11 +293,15 @@ public class ControlParsing : ITransient
{
var ctList = item.Value.ToObject<List<Dictionary<string, object>>>();
var ctVModels = new Dictionary<string, object>();
vModels.Where(x => x.Key.Contains(item.Key)).ToList().ForEach(ctItem => ctVModels.Add(ctItem.Key.Split("-").LastOrDefault(), ctItem.Value));
if (ctList.Any()) items[item.Key] = await GetParsDataByList(ctList, ctVModels, tenantId);
foreach (var ctItem in vModels.Where(x => x.Key.Contains(item.Key)).ToList())
{
ctVModels.Add(ctItem.Key.Split("-").LastOrDefault(), ctItem.Value);
var ctFields = fields.Find(x => x.__vModel__.Equals(ctItem.Key.Split("-").FirstOrDefault())).__config__.children;
if (ctList.Any()) items[item.Key] = await GetParsDataByList(ctFields, ctList, ctVModels, tenantId);
}
}
}
});
}
return oldDatas;
}
@@ -493,5 +481,4 @@ public class ControlParsing : ITransient
}
#endregion
}

View File

@@ -21,9 +21,9 @@ using JNPF.Systems.Entitys.Model.DataInterFace;
using JNPF.Systems.Entitys.Permission;
using JNPF.Systems.Entitys.System;
using JNPF.Systems.Interfaces.System;
using JNPF.VisualDev;
using JNPF.VisualDev.Engine;
using JNPF.VisualDev.Engine.Core;
using JNPF.VisualDev.Interfaces;
using JNPF.WorkFlow.Interfaces.Service;
using Mapster;
using Newtonsoft.Json.Linq;
@@ -50,7 +50,7 @@ public class ExportImportDataHelper : ITransient
/// <summary>
/// 在线开发运行服务.
/// </summary>
private readonly IRunService _runService;
private readonly RunService _runService;
/// <summary>
/// 单据.
@@ -93,7 +93,7 @@ public class ExportImportDataHelper : ITransient
public ExportImportDataHelper(
ISqlSugarRepository<OrganizeEntity> repositoryRepository,
IUserManager userManager,
IRunService runService,
RunService runService,
IBillRullService billRuleService,
IDataInterfaceService dataInterfaceService,
IDataBaseManager databaseService,
@@ -369,6 +369,55 @@ public class ExportImportDataHelper : ITransient
field.ableRoleIds = (att as CodeGenUploadAttribute).ableRoleIds;
field.ableGroupIds = (att as CodeGenUploadAttribute).ableGroupIds;
field.ableIds = (att as CodeGenUploadAttribute).ableIds;
field.relational = (att as CodeGenUploadAttribute).showField;
configModel = (att as CodeGenUploadAttribute).__config__.Adapt<ConfigModel>();
configModel.label = string.Format("{0}({1})", configModel.label, field.__vModel__);
field.__config__ = configModel;
fieldList.Add(field);
}
}
}
return fieldList;
}
/// <summary>
/// 获取数据转换模板解析.
/// </summary>
public static List<FieldsModel> GetDataConversionTemplateParsing<T>(T entity)
{
List<FieldsModel> fieldList = new List<FieldsModel>();
foreach (PropertyInfo prop in entity.GetType().GetProperties(BindingFlags.Instance | BindingFlags.Public))
{
FieldsModel field = new FieldsModel();
foreach (var att in prop.GetCustomAttributes(false))
{
if (att is CodeGenUploadAttribute)
{
var configModel = new ConfigModel();
field.__vModel__ = (att as CodeGenUploadAttribute).__vModel__ ?? (att as CodeGenUploadAttribute).__Model__;
field.level = (att as CodeGenUploadAttribute).level;
field.min = (att as CodeGenUploadAttribute).min == 0 ? null : (att as CodeGenUploadAttribute).min;
field.max = (att as CodeGenUploadAttribute).max == 0 ? null : (att as CodeGenUploadAttribute).max;
field.activeTxt = (att as CodeGenUploadAttribute).activeTxt;
field.inactiveTxt = (att as CodeGenUploadAttribute).inactiveTxt;
field.format = (att as CodeGenUploadAttribute).format;
field.multiple = (att as CodeGenUploadAttribute).multiple;
field.separator = (att as CodeGenUploadAttribute).separator;
field.__slot__ = (att as CodeGenUploadAttribute).__slot__.Adapt<SlotModel>();
field.props = (att as CodeGenUploadAttribute).props.Adapt<PropsModel>();
field.options = (att as CodeGenUploadAttribute).options;
field.propsValue = (att as CodeGenUploadAttribute).propsValue;
field.relationField = (att as CodeGenUploadAttribute).relationField;
field.modelId = (att as CodeGenUploadAttribute).modelId;
field.interfaceId = (att as CodeGenUploadAttribute).interfaceId;
field.selectType = (att as CodeGenUploadAttribute).selectType;
field.ableDepIds = (att as CodeGenUploadAttribute).ableDepIds;
field.ablePosIds = (att as CodeGenUploadAttribute).ablePosIds;
field.ableUserIds = (att as CodeGenUploadAttribute).ableUserIds;
field.ableRoleIds = (att as CodeGenUploadAttribute).ableRoleIds;
field.ableGroupIds = (att as CodeGenUploadAttribute).ableGroupIds;
field.ableIds = (att as CodeGenUploadAttribute).ableIds;
field.relational = (att as CodeGenUploadAttribute).showField;
configModel = (att as CodeGenUploadAttribute).__config__.Adapt<ConfigModel>();
configModel.label = string.Format("{0}({1})", configModel.label, field.__vModel__);
field.__config__ = configModel;
@@ -416,6 +465,56 @@ public class ExportImportDataHelper : ITransient
field.ableRoleIds = (att as CodeGenUploadAttribute).ableRoleIds;
field.ableGroupIds = (att as CodeGenUploadAttribute).ableGroupIds;
field.ableIds = (att as CodeGenUploadAttribute).ableIds;
field.relational = (att as CodeGenUploadAttribute).showField;
configModel = (att as CodeGenUploadAttribute).__config__.Adapt<ConfigModel>();
configModel.label = string.Format("{0}({1})", configModel.label, field.__vModel__);
field.__config__ = configModel;
fieldList.Add(field);
}
}
}
return fieldList;
}
/// <summary>
/// 获取数据转换模板解析.
/// </summary>
public static List<FieldsModel> GetDataConversionTemplateParsing<T>(T entity, string tableName)
{
List<FieldsModel> fieldList = new List<FieldsModel>();
foreach (PropertyInfo prop in entity.GetType().GetProperties(BindingFlags.Instance | BindingFlags.Public))
{
FieldsModel field = new FieldsModel();
foreach (var att in prop.GetCustomAttributes(false))
{
if (att is CodeGenUploadAttribute)
{
var configModel = new ConfigModel();
field.__vModel__ = string.Format("jnpf_{0}_jnpf_{1}", tableName, (att as CodeGenUploadAttribute).__vModel__ ?? (att as CodeGenUploadAttribute).__Model__);
field.level = (att as CodeGenUploadAttribute).level;
field.min = (att as CodeGenUploadAttribute).min == 0 ? null : (att as CodeGenUploadAttribute).min;
field.max = (att as CodeGenUploadAttribute).max == 0 ? null : (att as CodeGenUploadAttribute).max;
field.activeTxt = (att as CodeGenUploadAttribute).activeTxt;
field.inactiveTxt = (att as CodeGenUploadAttribute).inactiveTxt;
field.format = (att as CodeGenUploadAttribute).format;
field.multiple = (att as CodeGenUploadAttribute).multiple;
field.separator = (att as CodeGenUploadAttribute).separator;
field.__slot__ = (att as CodeGenUploadAttribute).__slot__.Adapt<SlotModel>();
field.props = (att as CodeGenUploadAttribute).props.Adapt<PropsModel>();
field.options = (att as CodeGenUploadAttribute).options;
field.propsValue = (att as CodeGenUploadAttribute).propsValue;
field.relationField = (att as CodeGenUploadAttribute).relationField;
field.modelId = (att as CodeGenUploadAttribute).modelId;
field.interfaceId = (att as CodeGenUploadAttribute).interfaceId;
field.selectType = (att as CodeGenUploadAttribute).selectType;
field.ableDepIds = (att as CodeGenUploadAttribute).ableDepIds;
field.ablePosIds = (att as CodeGenUploadAttribute).ablePosIds;
field.ableUserIds = (att as CodeGenUploadAttribute).ableUserIds;
field.ableRoleIds = (att as CodeGenUploadAttribute).ableRoleIds;
field.ableGroupIds = (att as CodeGenUploadAttribute).ableGroupIds;
field.ableIds = (att as CodeGenUploadAttribute).ableIds;
field.relational = (att as CodeGenUploadAttribute).showField;
configModel = (att as CodeGenUploadAttribute).__config__.Adapt<ConfigModel>();
configModel.label = string.Format("{0}({1})", configModel.label, field.__vModel__);
field.__config__ = configModel;
@@ -660,78 +759,78 @@ public class ExportImportDataHelper : ITransient
return new { dataRow = resData, headerRow = headerRow };
}
///// <summary>
///// 导入数据.
///// </summary>
///// <param name="tInfo">模板信息.</param>
///// <param name="list">数据集合.</param>
///// <returns>[成功列表,失败列表].</returns>
//public async Task<object[]> ImportMenuData(TemplateParsingBase tInfo, List<Dictionary<string, object>> list)
//{
// List<Dictionary<string, object>> userInputList = ImportFirstVerify(tInfo, list);
// List<FieldsModel> fieldsModelList = tInfo.AllFieldsModel.Where(x => tInfo.selectKey.Contains(x.__vModel__)).ToList();
/// <summary>
/// 导入数据.
/// </summary>
/// <param name="tInfo">模板信息.</param>
/// <param name="list">数据集合.</param>
/// <returns>[成功列表,失败列表].</returns>
public async Task<object[]> ImportMenuData(TemplateParsingBase tInfo, List<Dictionary<string, object>> list)
{
List<Dictionary<string, object>> userInputList = ImportFirstVerify(tInfo, list);
List<FieldsModel> fieldsModelList = tInfo.AllFieldsModel.Where(x => tInfo.selectKey.Contains(x.__vModel__)).ToList();
// var successList = new List<Dictionary<string, object>>();
// var errorsList = new List<Dictionary<string, object>>();
var successList = new List<Dictionary<string, object>>();
var errorsList = new List<Dictionary<string, object>>();
// // 捞取控件解析数据
// var cData = await GetCDataList(tInfo.AllFieldsModel, new Dictionary<string, List<Dictionary<string, string>>>());
// var res = await ImportDataAssemble(fieldsModelList, userInputList, cData);
// res.Where(x => x.ContainsKey("errorsInfo")).ToList().ForEach(item => errorsList.Add(item));
// res.Where(x => !x.ContainsKey("errorsInfo")).ToList().ForEach(item => successList.Add(item));
// 捞取控件解析数据
var cData = await GetCDataList(tInfo.AllFieldsModel, new Dictionary<string, List<Dictionary<string, string>>>());
var res = await ImportDataAssemble(fieldsModelList, userInputList, cData);
res.Where(x => x.ContainsKey("errorsInfo")).ToList().ForEach(item => errorsList.Add(item));
res.Where(x => !x.ContainsKey("errorsInfo")).ToList().ForEach(item => successList.Add(item));
// try
// {
// // 唯一验证已处理,入库前去掉.
// tInfo.AllFieldsModel.Where(x => x.__config__.jnpfKey.Equals(JnpfKeyConst.COMINPUT) && x.__config__.unique).ToList().ForEach(item => item.__config__.unique = false);
// _sqlSugarClient.BeginTran();
// foreach (var item in successList)
// {
// if (item.ContainsKey("Update_MainTablePrimary_Id"))
// {
// string? mainId = item["Update_MainTablePrimary_Id"].ToString();
// var haveTableSql = await _runService.GetUpdateSqlByTemplate(tInfo, new VisualDevModelDataUpInput() { data = item.ToJsonString() }, mainId);
// foreach (var it in haveTableSql) await _databaseService.ExecuteSql(tInfo.DbLink, it); // 修改功能数据
// }
// else
// {
// if ((tInfo.visualDevEntity?.EnableFlow.Equals(1)).ParseToBool())
// {
// var flowId = _repository.AsSugarClient().Queryable<WorkFlow.Entitys.Entity.FlowFormEntity>().First(x => x.Id.Equals(tInfo.visualDevEntity.Id)).FlowId;
// await _flowTaskService.Create(new Common.Models.WorkFlow.FlowTaskSubmitModel() { formData = item.ToJsonString(), flowId = flowId, flowUrgent = 1 });
// }
// else
// {
// string? mainId = YitIdHelper.NextId().ToString();
// var haveTableSql = await _runService.GetCreateSqlByTemplate(tInfo, new VisualDevModelDataCrInput() { data = item.ToJsonString() }, mainId);
try
{
// 唯一验证已处理,入库前去掉.
tInfo.AllFieldsModel.Where(x => x.__config__.jnpfKey.Equals(JnpfKeyConst.COMINPUT) && x.__config__.unique).ToList().ForEach(item => item.__config__.unique = false);
_sqlSugarClient.BeginTran();
foreach (var item in successList)
{
if (item.ContainsKey("Update_MainTablePrimary_Id"))
{
string? mainId = item["Update_MainTablePrimary_Id"].ToString();
var haveTableSql = await _runService.GetUpdateSqlByTemplate(tInfo, new VisualDevModelDataUpInput() { data = item.ToJsonString() }, mainId);
foreach (var it in haveTableSql) await _databaseService.ExecuteSql(tInfo.DbLink, it); // 修改功能数据
}
else
{
if ((tInfo.visualDevEntity?.EnableFlow.Equals(1)).ParseToBool())
{
var flowId = _repository.AsSugarClient().Queryable<WorkFlow.Entitys.Entity.FlowFormEntity>().First(x => x.Id.Equals(tInfo.visualDevEntity.Id)).FlowId;
await _flowTaskService.Create(new Common.Models.WorkFlow.FlowTaskSubmitModel() { formData = item, flowId = flowId, flowUrgent = 1, status = 1 });
}
else
{
string? mainId = YitIdHelper.NextId().ToString();
var haveTableSql = await _runService.GetCreateSqlByTemplate(tInfo, new VisualDevModelDataCrInput() { data = item.ToJsonString() }, mainId);
// // 主表自增长Id.
// if (haveTableSql.ContainsKey("MainTableReturnIdentity"))
// {
// mainId = haveTableSql["MainTableReturnIdentity"].First().First().Value.ToString();
// haveTableSql.Remove("MainTableReturnIdentity");
// }
// foreach (var it in haveTableSql)
// await _databaseService.ExecuteSql(tInfo.DbLink, it.Key, it.Value); // 新增功能数据
// }
// }
// }
// 主表自增长Id.
if (haveTableSql.ContainsKey("MainTableReturnIdentity"))
{
mainId = haveTableSql["MainTableReturnIdentity"].First().First().Value.ToString();
haveTableSql.Remove("MainTableReturnIdentity");
}
foreach (var it in haveTableSql)
await _databaseService.ExecuteSql(tInfo.DbLink, it.Key, it.Value); // 新增功能数据
}
}
}
// _sqlSugarClient.CommitTran();
// }
// catch (Exception e)
// {
// _sqlSugarClient.RollbackTran();
// throw;
// }
_sqlSugarClient.CommitTran();
}
catch (Exception e)
{
_sqlSugarClient.RollbackTran();
throw;
}
// errorsList.ForEach(item =>
// {
// if (item.ContainsKey("errorsInfo") && item["errorsInfo"].IsNotEmptyOrNull()) item["errorsInfo"] = item["errorsInfo"].ToString().TrimStart(',').TrimEnd(',');
// });
errorsList.ForEach(item =>
{
if (item.ContainsKey("errorsInfo") && item["errorsInfo"].IsNotEmptyOrNull()) item["errorsInfo"] = item["errorsInfo"].ToString().TrimStart(',').TrimEnd(',');
});
// return new object[] { successList, errorsList };
//}
return new object[] { successList, errorsList };
}
/// <summary>
/// Excel 转输出 Model.

View File

@@ -21,8 +21,6 @@ using JNPF.VisualDev.Entitys;
using JNPF.VisualDev.Entitys.Dto.CodeGen;
using JNPF.VisualDev.Entitys.Enum;
using Microsoft.AspNetCore.Mvc;
using Org.BouncyCastle.Asn1.Crmf;
using Spire.Presentation;
using SqlSugar;
using System.IO.Compression;
using System.Text;
@@ -300,6 +298,7 @@ public class CodeGenService : IDynamicApiController, ITransient
// 统一处理下表单内控件
controls = CodeGenUnifiedHandlerHelper.UnifiedHandlerFormDataModel(controls, pcColumnDesignModel, appColumnDesignModel);
controls = CodeGenUnifiedHandlerHelper.UnifiedHandlerControlRelationship(controls);
break;
}

View File

@@ -1462,7 +1462,7 @@ public class VisualDevService : IVisualDevService, IDynamicApiController, ITrans
authList.Add(new ModuleDataAuthorizeEntity()
{
Id = SnowflakeIdHelper.NextId(),
ConditionSymbol = "Included", // 条件符号
ConditionSymbol = "Equal", // 条件符号
Type = "varchar", // 字段类型
FullName = item.__config__.label, // 字段说明
ConditionText = "@userAraSubordinates", // 条件内容(当前用户及下属)
@@ -1519,7 +1519,7 @@ public class VisualDevService : IVisualDevService, IDynamicApiController, ITrans
authList.Add(new ModuleDataAuthorizeEntity()
{
Id = SnowflakeIdHelper.NextId(),
ConditionSymbol = "Included", // 条件符号
ConditionSymbol = "Equal", // 条件符号
Type = "varchar", // 字段类型
FullName = item.__config__.label, // 字段说明
ConditionText = "@organizationAndSuborganization", // 条件内容(当前组织及组织)
@@ -1558,7 +1558,7 @@ public class VisualDevService : IVisualDevService, IDynamicApiController, ITrans
authList.Add(new ModuleDataAuthorizeEntity()
{
Id = SnowflakeIdHelper.NextId(),
ConditionSymbol = "Included", // 条件符号
ConditionSymbol = "Equal", // 条件符号
Type = "varchar", // 字段类型
FullName = item.__config__.label, // 字段说明
ConditionText = "@branchManageOrganize", // 条件内容(当前分管组织)
@@ -1576,7 +1576,7 @@ public class VisualDevService : IVisualDevService, IDynamicApiController, ITrans
authList.Add(new ModuleDataAuthorizeEntity()
{
Id = SnowflakeIdHelper.NextId(),
ConditionSymbol = "Included", // 条件符号
ConditionSymbol = "Equal", // 条件符号
Type = "varchar", // 字段类型
FullName = item.__config__.label, // 字段说明
ConditionText = "@branchManageOrganizeAndSub", // 条件内容(当前分管组织及子组织)
@@ -1623,11 +1623,11 @@ public class VisualDevService : IVisualDevService, IDynamicApiController, ITrans
|| x.FullName == "当前用户及下属" || x.FullName == "当前组织及子组织"
|| x.FullName == "当前分管组织" || x.FullName == "当前分管组织及子组织")
.Where(x => x.ConditionJson.Contains("\"op\":\"Equal\",\"value\":\"@userId\"")
|| x.ConditionJson.Contains("\"op\":\"Included\",\"value\":\"@userAraSubordinates\"")
|| x.ConditionJson.Contains("\"op\":\"Equal\",\"value\":\"@userAraSubordinates\"")
|| x.ConditionJson.Contains("\"op\":\"Equal\",\"value\":\"@organizeId\"")
|| x.ConditionJson.Contains("\"op\":\"Included\",\"value\":\"@organizationAndSuborganization\"")
|| x.ConditionJson.Contains("\"op\":\"Included\",\"value\":\"@branchManageOrganize\"")
|| x.ConditionJson.Contains("\"op\":\"Included\",\"value\":\"@branchManageOrganizeAndSub\""))
|| x.ConditionJson.Contains("\"op\":\"Equal\",\"value\":\"@organizationAndSuborganization\"")
|| x.ConditionJson.Contains("\"op\":\"Equal\",\"value\":\"@branchManageOrganize\"")
|| x.ConditionJson.Contains("\"op\":\"Equal\",\"value\":\"@branchManageOrganizeAndSub\""))
.ToListAsync();
List<ModuleDataAuthorizeSchemeEntity>? authSchemeList = new List<ModuleDataAuthorizeSchemeEntity>(); // 方案管理
@@ -1668,16 +1668,16 @@ public class VisualDevService : IVisualDevService, IDynamicApiController, ITrans
model = authList.FirstOrDefault(x => x.EnCode == item.__vModel__ && x.ConditionText.Equals("@userAraSubordinates"));
condJson.groups.First().id = model.Id;
condJson.groups.First().op = "Included";
condJson.groups.First().op = "Equal";
condJson.groups.First().value = "@userAraSubordinates";
if (!oldDataAuthScheme.Any(x => x.ConditionText == "【{" + item.__config__.label + "} {包含} {@userAraSubordinates}】"))
if (!oldDataAuthScheme.Any(x => x.ConditionText == "【{" + item.__config__.label + "} {等于} {@userAraSubordinates}】"))
{
authSchemeList.Add(new ModuleDataAuthorizeSchemeEntity()
{
FullName = "当前用户及下属",
EnCode = SnowflakeIdHelper.NextId(),
SortCode = -9527,
ConditionText = "【{" + item.__config__.label + "} {包含} {@userAraSubordinates}】",
ConditionText = "【{" + item.__config__.label + "} {等于} {@userAraSubordinates}】",
ConditionJson = new List<AuthorizeModuleResourceConditionModelInput>() { condJson }.ToJsonString(),
ModuleId = menuId
});
@@ -1685,14 +1685,14 @@ public class VisualDevService : IVisualDevService, IDynamicApiController, ITrans
// 删除
//List<ModuleDataAuthorizeSchemeEntity>? delData = oldDataAuthScheme.Where(x => x.EnCode != item.__vModel__
//&& (x.ConditionJson.Contains("\"op\":\"Equal\",\"value\":\"@userId\"") || x.ConditionJson.Contains("\"op\":\"Included\",\"value\":\"@userAraSubordinates\""))).ToList();
//&& (x.ConditionJson.Contains("\"op\":\"Equal\",\"value\":\"@userId\"") || x.ConditionJson.Contains("\"op\":\"Equal\",\"value\":\"@userAraSubordinates\""))).ToList();
//await _visualDevRepository.AsSugarClient().Deleteable(delData).ExecuteCommandAsync();
}
else
{
// 删除
List<ModuleDataAuthorizeSchemeEntity>? delData = oldDataAuthScheme
.Where(x => x.ConditionJson.Contains("\"op\":\"Equal\",\"value\":\"@userId\"") || x.ConditionJson.Contains("\"op\":\"Included\",\"value\":\"@userAraSubordinates\"")).ToList();
.Where(x => x.ConditionJson.Contains("\"op\":\"Equal\",\"value\":\"@userId\"") || x.ConditionJson.Contains("\"op\":\"Equal\",\"value\":\"@userAraSubordinates\"")).ToList();
await _visualDevRepository.AsSugarClient().Deleteable(delData).ExecuteCommandAsync();
}
}
@@ -1700,7 +1700,7 @@ public class VisualDevService : IVisualDevService, IDynamicApiController, ITrans
{
// 删除
List<ModuleDataAuthorizeSchemeEntity>? delData = oldDataAuthScheme
.Where(x => x.ConditionJson.Contains("\"op\":\"Equal\",\"value\":\"@userId\"") || x.ConditionJson.Contains("\"op\":\"Included\",\"value\":\"@userAraSubordinates\"")).ToList();
.Where(x => x.ConditionJson.Contains("\"op\":\"Equal\",\"value\":\"@userId\"") || x.ConditionJson.Contains("\"op\":\"Equal\",\"value\":\"@userAraSubordinates\"")).ToList();
await _visualDevRepository.AsSugarClient().Deleteable(delData).ExecuteCommandAsync();
}
@@ -1735,16 +1735,16 @@ public class VisualDevService : IVisualDevService, IDynamicApiController, ITrans
model = authList.FirstOrDefault(x => x.EnCode == item.__vModel__ && x.ConditionText.Equals("@organizationAndSuborganization"));
condJson.groups.First().id = model.Id;
condJson.groups.First().op = "Included";
condJson.groups.First().op = "Equal";
condJson.groups.First().value = "@organizationAndSuborganization";
if (!oldDataAuthScheme.Any(x => x.ConditionText == "【{" + item.__config__.label + "} {包含} {@organizationAndSuborganization}】"))
if (!oldDataAuthScheme.Any(x => x.ConditionText == "【{" + item.__config__.label + "} {等于} {@organizationAndSuborganization}】"))
{
authSchemeList.Add(new ModuleDataAuthorizeSchemeEntity()
{
FullName = "当前组织及子组织",
EnCode = SnowflakeIdHelper.NextId(),
SortCode = -9527,
ConditionText = "【{" + item.__config__.label + "} {包含} {@organizationAndSuborganization}】",
ConditionText = "【{" + item.__config__.label + "} {等于} {@organizationAndSuborganization}】",
ConditionJson = new List<AuthorizeModuleResourceConditionModelInput>() { condJson }.ToJsonString(),
ModuleId = menuId
});
@@ -1752,14 +1752,14 @@ public class VisualDevService : IVisualDevService, IDynamicApiController, ITrans
// 删除
//List<ModuleDataAuthorizeSchemeEntity>? delData = oldDataAuthScheme.Where(x => x.EnCode != item.__vModel__
//&& (x.ConditionJson.Contains("\"op\":\"Equal\",\"value\":\"@organizeId\"") || x.ConditionJson.Contains("\"op\":\"Included\",\"value\":\"@organizationAndSuborganization\""))).ToList();
//&& (x.ConditionJson.Contains("\"op\":\"Equal\",\"value\":\"@organizeId\"") || x.ConditionJson.Contains("\"op\":\"Equal\",\"value\":\"@organizationAndSuborganization\""))).ToList();
//await _visualDevRepository.AsSugarClient().Deleteable(delData).ExecuteCommandAsync();
}
else
{
// 删除
List<ModuleDataAuthorizeSchemeEntity>? delData = oldDataAuthScheme
.Where(x => x.ConditionJson.Contains("\"op\":\"Equal\",\"value\":\"@organizeId\"") || x.ConditionJson.Contains("\"op\":\"Included\",\"value\":\"@organizationAndSuborganization\"")).ToList();
.Where(x => x.ConditionJson.Contains("\"op\":\"Equal\",\"value\":\"@organizeId\"") || x.ConditionJson.Contains("\"op\":\"Equal\",\"value\":\"@organizationAndSuborganization\"")).ToList();
await _visualDevRepository.AsSugarClient().Deleteable(delData).ExecuteCommandAsync();
}
}
@@ -1767,7 +1767,7 @@ public class VisualDevService : IVisualDevService, IDynamicApiController, ITrans
{
// 删除
List<ModuleDataAuthorizeSchemeEntity>? delData = oldDataAuthScheme
.Where(x => x.ConditionJson.Contains("\"op\":\"Equal\",\"value\":\"@organizeId\"") || x.ConditionJson.Contains("\"op\":\"Included\",\"value\":\"@organizationAndSuborganization\"")).ToList();
.Where(x => x.ConditionJson.Contains("\"op\":\"Equal\",\"value\":\"@organizeId\"") || x.ConditionJson.Contains("\"op\":\"Equal\",\"value\":\"@organizationAndSuborganization\"")).ToList();
await _visualDevRepository.AsSugarClient().Deleteable(delData).ExecuteCommandAsync();
}
@@ -1783,18 +1783,18 @@ public class VisualDevService : IVisualDevService, IDynamicApiController, ITrans
condJson.groups.First().bindTable = model.BindTable;
condJson.groups.First().field = item.__vModel__;
condJson.groups.First().fieldRule = model.FieldRule.ParseToInt();
condJson.groups.First().op = "Included";
condJson.groups.First().op = "Equal";
condJson.groups.First().value = "@branchManageOrganize";
// 新增
if (!oldDataAuthScheme.Any(x => x.ConditionText == "【{" + item.__config__.label + "} {包含} {@branchManageOrganize}】"))
if (!oldDataAuthScheme.Any(x => x.ConditionText == "【{" + item.__config__.label + "} {等于} {@branchManageOrganize}】"))
{
authSchemeList.Add(new ModuleDataAuthorizeSchemeEntity()
{
FullName = "当前分管组织",
EnCode = SnowflakeIdHelper.NextId(),
SortCode = -9527,
ConditionText = "【{" + item.__config__.label + "} {包含} {@branchManageOrganize}】",
ConditionText = "【{" + item.__config__.label + "} {等于} {@branchManageOrganize}】",
ConditionJson = new List<AuthorizeModuleResourceConditionModelInput>() { condJson }.ToJsonString(),
ModuleId = menuId
});
@@ -1802,16 +1802,16 @@ public class VisualDevService : IVisualDevService, IDynamicApiController, ITrans
model = authList.FirstOrDefault(x => x.EnCode == item.__vModel__ && x.ConditionText.Equals("@branchManageOrganizeAndSub"));
condJson.groups.First().id = model.Id;
condJson.groups.First().op = "Included";
condJson.groups.First().op = "Equal";
condJson.groups.First().value = "@branchManageOrganizeAndSub";
if (!oldDataAuthScheme.Any(x => x.ConditionText == "【{" + item.__config__.label + "} {包含} {@branchManageOrganizeAndSub}】"))
if (!oldDataAuthScheme.Any(x => x.ConditionText == "【{" + item.__config__.label + "} {等于} {@branchManageOrganizeAndSub}】"))
{
authSchemeList.Add(new ModuleDataAuthorizeSchemeEntity()
{
FullName = "当前分管组织及子组织",
EnCode = SnowflakeIdHelper.NextId(),
SortCode = -9527,
ConditionText = "【{" + item.__config__.label + "} {包含} {@branchManageOrganizeAndSub}】",
ConditionText = "【{" + item.__config__.label + "} {等于} {@branchManageOrganizeAndSub}】",
ConditionJson = new List<AuthorizeModuleResourceConditionModelInput>() { condJson }.ToJsonString(),
ModuleId = menuId
});
@@ -1819,14 +1819,14 @@ public class VisualDevService : IVisualDevService, IDynamicApiController, ITrans
// 删除
//List<ModuleDataAuthorizeSchemeEntity>? delData = oldDataAuthScheme.Where(x => x.EnCode != item.__vModel__
//&& (x.ConditionJson.Contains("\"op\":\"Included\",\"value\":\"@branchManageOrganize\"") || x.ConditionJson.Contains("\"op\":\"Included\",\"value\":\"@branchManageOrganizeAndSub\""))).ToList();
//&& (x.ConditionJson.Contains("\"op\":\"Equal\",\"value\":\"@branchManageOrganize\"") || x.ConditionJson.Contains("\"op\":\"Equal\",\"value\":\"@branchManageOrganizeAndSub\""))).ToList();
//await _visualDevRepository.AsSugarClient().Deleteable(delData).ExecuteCommandAsync();
}
else
{
// 删除
List<ModuleDataAuthorizeSchemeEntity>? delData = oldDataAuthScheme
.Where(x => x.ConditionJson.Contains("\"op\":\"Included\",\"value\":\"@branchManageOrganize\"") || x.ConditionJson.Contains("\"op\":\"Included\",\"value\":\"@branchManageOrganizeAndSub\"")).ToList();
.Where(x => x.ConditionJson.Contains("\"op\":\"Equal\",\"value\":\"@branchManageOrganize\"") || x.ConditionJson.Contains("\"op\":\"Equal\",\"value\":\"@branchManageOrganizeAndSub\"")).ToList();
await _visualDevRepository.AsSugarClient().Deleteable(delData).ExecuteCommandAsync();
}
}
@@ -1834,7 +1834,7 @@ public class VisualDevService : IVisualDevService, IDynamicApiController, ITrans
{
// 删除
List<ModuleDataAuthorizeSchemeEntity>? delData = oldDataAuthScheme
.Where(x => x.ConditionJson.Contains("\"op\":\"Included\",\"value\":\"@branchManageOrganize\"") || x.ConditionJson.Contains("\"op\":\"Included\",\"value\":\"@branchManageOrganizeAndSub\"")).ToList();
.Where(x => x.ConditionJson.Contains("\"op\":\"Equal\",\"value\":\"@branchManageOrganize\"") || x.ConditionJson.Contains("\"op\":\"Equal\",\"value\":\"@branchManageOrganizeAndSub\"")).ToList();
await _visualDevRepository.AsSugarClient().Deleteable(delData).ExecuteCommandAsync();
}

View File

@@ -220,7 +220,8 @@ public class FlowTaskRepository : IFlowTaskRepository, ITransient
flowUrgent = a.FlowUrgent,
startTime = a.CreatorTime,
completion = a.Completion,
nodeName = b.NodeName
nodeName = b.NodeName,
templateId = a.TemplateId,
});
// 委托审核
@@ -251,7 +252,8 @@ public class FlowTaskRepository : IFlowTaskRepository, ITransient
flowUrgent = a.FlowUrgent,
startTime = a.CreatorTime,
completion = a.Completion,
nodeName = b.NodeName
nodeName = b.NodeName,
templateId = a.TemplateId,
});
var output = await _repository.AsSugarClient().UnionAll(list1, list2).Where(whereLambda).MergeTable().OrderBy(x => x.creatorTime, OrderByType.Desc).ToPagedListAsync(input.currentPage, input.pageSize);
return PageResult<FlowBeforeListOutput>.SqlSugarPageResult(output);