v3.4.6
This commit is contained in:
@@ -4,7 +4,6 @@ using JNPF.Common.Enums;
|
||||
using JNPF.Common.Extension;
|
||||
using JNPF.Common.Filter;
|
||||
using JNPF.Common.Models.Authorize;
|
||||
using JNPF.Common.Options;
|
||||
using JNPF.Common.Security;
|
||||
using JNPF.DependencyInjection;
|
||||
using JNPF.DynamicApiController;
|
||||
@@ -16,7 +15,6 @@ using JNPF.Systems.Interfaces.System;
|
||||
using JNPF.VisualDev.Engine;
|
||||
using JNPF.VisualDev.Engine.Core;
|
||||
using JNPF.VisualDev.Engine.Model;
|
||||
using JNPF.VisualDev.Engine.Security;
|
||||
using JNPF.VisualDev.Entitys;
|
||||
using JNPF.VisualDev.Entitys.Dto.VisualDev;
|
||||
using JNPF.VisualDev.Entitys.Dto.VisualDevModelData;
|
||||
@@ -25,7 +23,6 @@ using JNPF.WorkFlow.Entitys.Entity;
|
||||
using Mapster;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using SqlSugar;
|
||||
using Yitter.IdGenerator;
|
||||
|
||||
namespace JNPF.VisualDev;
|
||||
|
||||
@@ -170,15 +167,24 @@ public class VisualDevService : IVisualDevService, IDynamicApiController, ITrans
|
||||
/// 获取表单主表属性下拉框.
|
||||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
/// <param name="filterType">1:过滤指定控件.</param>
|
||||
/// <returns></returns>
|
||||
[HttpGet("{id}/FormDataFields")]
|
||||
public async Task<dynamic> GetFormDataFields(string id)
|
||||
public async Task<dynamic> GetFormDataFields(string id, [FromQuery] int filterType)
|
||||
{
|
||||
VisualDevEntity? templateEntity = await _visualDevRepository.AsQueryable().FirstAsync(v => v.Id == id && v.DeleteMark == null);
|
||||
//modified by PhilPan
|
||||
if (templateEntity == null) throw Oops.Oh(ErrorCode.D1418, id);
|
||||
TemplateParsingBase? tInfo = new TemplateParsingBase(templateEntity); // 解析模板
|
||||
var templateEntity = await _visualDevRepository.AsSugarClient().Queryable<VisualDevReleaseEntity>().FirstAsync(v => v.Id == id && v.DeleteMark == null);
|
||||
TemplateParsingBase? tInfo = new TemplateParsingBase(templateEntity.Adapt<VisualDevEntity>()); // 解析模板
|
||||
List<FieldsModel>? fieldsModels = tInfo.SingleFormData.FindAll(x => x.__vModel__.IsNotEmptyOrNull() && !JnpfKeyConst.RELATIONFORM.Equals(x.__config__.jnpfKey));
|
||||
if (filterType.Equals(1))
|
||||
{
|
||||
fieldsModels = fieldsModels.FindAll(x => !JnpfKeyConst.UPLOADIMG.Equals(x.__config__.jnpfKey) && !JnpfKeyConst.UPLOADFZ.Equals(x.__config__.jnpfKey)
|
||||
&& !JnpfKeyConst.MODIFYUSER.Equals(x.__config__.jnpfKey) && !JnpfKeyConst.MODIFYTIME.Equals(x.__config__.jnpfKey) && !JnpfKeyConst.LINK.Equals(x.__config__.jnpfKey)
|
||||
&& !JnpfKeyConst.BUTTON.Equals(x.__config__.jnpfKey) && !JnpfKeyConst.ALERT.Equals(x.__config__.jnpfKey) && !JnpfKeyConst.JNPFTEXT.Equals(x.__config__.jnpfKey)
|
||||
&& !JnpfKeyConst.BARCODE.Equals(x.__config__.jnpfKey) && !JnpfKeyConst.QRCODE.Equals(x.__config__.jnpfKey) && !JnpfKeyConst.TABLE.Equals(x.__config__.jnpfKey)
|
||||
&& !JnpfKeyConst.CREATEUSER.Equals(x.__config__.jnpfKey) && !JnpfKeyConst.CREATETIME.Equals(x.__config__.jnpfKey) && !JnpfKeyConst.BILLRULE.Equals(x.__config__.jnpfKey)
|
||||
&& !JnpfKeyConst.POPUPSELECT.Equals(x.__config__.jnpfKey));
|
||||
}
|
||||
|
||||
List<VisualDevFormDataFieldsOutput>? output = fieldsModels.Select(x => new VisualDevFormDataFieldsOutput()
|
||||
{
|
||||
label = x.__config__.label,
|
||||
@@ -199,9 +205,7 @@ public class VisualDevService : IVisualDevService, IDynamicApiController, ITrans
|
||||
Dictionary<string, object> queryDic = new Dictionary<string, object>();
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(input.relationField) && !string.IsNullOrWhiteSpace(input.keyword)) queryDic.Add(input.relationField, input.keyword);
|
||||
VisualDevEntity? templateEntity = await _visualDevRepository.AsQueryable().FirstAsync(v => v.Id == id && v.DeleteMark == null); // 取数据
|
||||
//modified by PhilPan
|
||||
if (templateEntity == null) throw Oops.Oh(ErrorCode.D1418, id);
|
||||
VisualDevEntity? templateEntity = await GetInfoById(id, true); // 取数据
|
||||
TemplateParsingBase? tInfo = new TemplateParsingBase(templateEntity); // 解析模板
|
||||
|
||||
// 指定查询字段
|
||||
@@ -309,7 +313,6 @@ public class VisualDevService : IVisualDevService, IDynamicApiController, ITrans
|
||||
TemplateParsingBase? tInfo = new TemplateParsingBase(entity); // 解析模板
|
||||
if (!tInfo.VerifyTemplate()) throw Oops.Oh(ErrorCode.D1401); // 验证模板
|
||||
await VerifyPrimaryKeyPolicy(tInfo, entity.DbLinkId); // 验证雪花Id 和自增长Id 主键是否支持
|
||||
|
||||
}
|
||||
_db.BeginTran(); // 开启事务
|
||||
entity.State = 0;
|
||||
@@ -317,6 +320,19 @@ public class VisualDevService : IVisualDevService, IDynamicApiController, ITrans
|
||||
// 添加功能
|
||||
entity = await _visualDevRepository.AsSugarClient().Insertable(entity).IgnoreColumns(ignoreNullColumn: true).CallEntityMethod(m => m.Create()).ExecuteReturnEntityAsync();
|
||||
|
||||
// 同步流程相关
|
||||
if (entity.EnableFlow.Equals(1) && (!entity.Type.Equals(3) && !entity.Type.Equals(4)))
|
||||
{
|
||||
var fEntity = entity.Adapt<FlowFormEntity>();
|
||||
fEntity.PropertyJson = entity.FormData;
|
||||
fEntity.TableJson = entity.Tables;
|
||||
fEntity.DraftJson = fEntity.ToJsonString();
|
||||
fEntity.FlowType = 1;
|
||||
fEntity.FormType = 2;
|
||||
fEntity.FlowId = entity.Id;
|
||||
await _visualDevRepository.AsSugarClient().Insertable(fEntity).IgnoreColumns(ignoreNullColumn: true).CallEntityMethod(m => m.Create()).ExecuteReturnEntityAsync();
|
||||
await SaveFlowTemplate(entity);
|
||||
}
|
||||
_db.CommitTran(); // 提交事务
|
||||
}
|
||||
catch (Exception)
|
||||
@@ -338,7 +354,7 @@ public class VisualDevService : IVisualDevService, IDynamicApiController, ITrans
|
||||
VisualDevEntity? entity = input.Adapt<VisualDevEntity>();
|
||||
try
|
||||
{
|
||||
if (await _visualDevRepository.AsQueryable().AnyAsync(x => x.Id.Equals(id) && x.State.Equals(1)) && (entity.Tables.IsNullOrEmpty() || entity.Tables.Equals("[]")))
|
||||
if (!input.webType.Equals(4) && await _visualDevRepository.AsQueryable().AnyAsync(x => x.Id.Equals(id) && x.State.Equals(1)) && (entity.Tables.IsNullOrEmpty() || entity.Tables.Equals("[]")))
|
||||
throw Oops.Oh(ErrorCode.D1416); // 已发布的模板 表不能为空.
|
||||
|
||||
// 验证名称和编码是否重复
|
||||
@@ -353,11 +369,10 @@ public class VisualDevService : IVisualDevService, IDynamicApiController, ITrans
|
||||
_db.BeginTran(); // 开启事务
|
||||
|
||||
// 修改功能
|
||||
|
||||
await _visualDevRepository.AsSugarClient().Updateable(entity).IgnoreColumns(ignoreAllNullColumns: true).CallEntityMethod(m => m.LastModify()).ExecuteCommandAsync();
|
||||
|
||||
// 修改流程表单
|
||||
if (entity.EnableFlow.Equals(1))
|
||||
// 同步流程相关
|
||||
if (entity.EnableFlow.Equals(1) && (!entity.Type.Equals(3) && !entity.Type.Equals(4)))
|
||||
{
|
||||
var fEntity = await _visualDevRepository.AsSugarClient().Queryable<FlowFormEntity>().FirstAsync(x => x.Id.Equals(id));
|
||||
if (fEntity != null)
|
||||
@@ -380,9 +395,24 @@ public class VisualDevService : IVisualDevService, IDynamicApiController, ITrans
|
||||
fEntity.DraftJson = dEntity.ToJsonString();
|
||||
fEntity.Id = id;
|
||||
}
|
||||
fEntity.FlowType = 1;
|
||||
fEntity.FormType = 2;
|
||||
fEntity.FlowId = id;
|
||||
|
||||
// 修改流程表单
|
||||
await _visualDevRepository.AsSugarClient().Updateable(fEntity).IgnoreColumns(ignoreAllNullColumns: true).CallEntityMethod(m => m.LastModify()).ExecuteCommandAsync();
|
||||
await SaveFlowTemplate(entity);
|
||||
}
|
||||
else
|
||||
{
|
||||
fEntity = entity.Adapt<FlowFormEntity>();
|
||||
fEntity.PropertyJson = entity.FormData;
|
||||
fEntity.TableJson = entity.Tables;
|
||||
fEntity.DraftJson = fEntity.ToJsonString();
|
||||
fEntity.FlowType = 1;
|
||||
fEntity.FormType = 2;
|
||||
fEntity.FlowId = id;
|
||||
await _visualDevRepository.AsSugarClient().Insertable(fEntity).IgnoreColumns(ignoreNullColumn: true).CallEntityMethod(m => m.Create()).ExecuteReturnEntityAsync();
|
||||
await SaveFlowTemplate(entity);
|
||||
}
|
||||
}
|
||||
_db.CommitTran(); // 关闭事务
|
||||
@@ -404,16 +434,24 @@ public class VisualDevService : IVisualDevService, IDynamicApiController, ITrans
|
||||
{
|
||||
var entity = await _visualDevRepository.AsQueryable().FirstAsync(v => v.Id == id && v.DeleteMark == null);
|
||||
await _visualDevRepository.AsSugarClient().Updateable(entity).CallEntityMethod(m => m.Delete()).UpdateColumns(it => new { it.DeleteMark, it.DeleteTime, it.DeleteUserId }).ExecuteCommandAsync();
|
||||
if (entity.State.Equals(1))
|
||||
|
||||
// 同步删除线上版本
|
||||
var rEntity = await _visualDevRepository.AsSugarClient().Queryable<VisualDevReleaseEntity>().FirstAsync(v => v.Id == id && v.DeleteMark == null);
|
||||
if (rEntity != null) await _visualDevRepository.AsSugarClient().Updateable(rEntity).CallEntityMethod(m => m.Delete()).UpdateColumns(it => new { it.DeleteMark, it.DeleteTime, it.DeleteUserId }).ExecuteCommandAsync();
|
||||
|
||||
// 同步删除流程表单
|
||||
var fEntity = await _visualDevRepository.AsSugarClient().Queryable<FlowFormEntity>().FirstAsync(v => v.Id == id && v.DeleteMark == null);
|
||||
if (fEntity != null)
|
||||
{
|
||||
var rEntity = await _visualDevRepository.AsSugarClient().Queryable<VisualDevReleaseEntity>().FirstAsync(v => v.Id == id && v.DeleteMark == null);
|
||||
await _visualDevRepository.AsSugarClient().Updateable(rEntity).CallEntityMethod(m => m.Delete()).UpdateColumns(it => new { it.DeleteMark, it.DeleteTime, it.DeleteUserId }).ExecuteCommandAsync();
|
||||
var fEntity = await _visualDevRepository.AsSugarClient().Queryable<FlowFormEntity>().FirstAsync(v => v.Id == id && v.DeleteMark == null);
|
||||
if (fEntity != null)
|
||||
{
|
||||
await _visualDevRepository.AsSugarClient().Updateable(fEntity).CallEntityMethod(m => m.Delete()).UpdateColumns(it => new { it.DeleteMark, it.DeleteTime, it.DeleteUserId }).ExecuteCommandAsync();
|
||||
await _visualDevRepository.AsSugarClient().Deleteable<FlowFormRelationEntity>().Where(x => x.FormId.Equals(fEntity.FlowId)).ExecuteCommandAsync();
|
||||
}
|
||||
await _visualDevRepository.AsSugarClient().Updateable(fEntity).CallEntityMethod(m => m.Delete()).UpdateColumns(it => new { it.DeleteMark, it.DeleteTime, it.DeleteUserId }).ExecuteCommandAsync();
|
||||
await _visualDevRepository.AsSugarClient().Deleteable<FlowFormRelationEntity>().Where(x => x.FormId.Equals(fEntity.FlowId)).ExecuteCommandAsync();
|
||||
}
|
||||
|
||||
// 同步删除流程引擎
|
||||
var tEntity = await _visualDevRepository.AsSugarClient().Queryable<FlowTemplateEntity>().FirstAsync(v => v.Id == id && v.DeleteMark == null);
|
||||
if (tEntity != null)
|
||||
{
|
||||
await _visualDevRepository.AsSugarClient().Updateable(tEntity).CallEntityMethod(m => m.Delete()).UpdateColumns(it => new { it.DeleteMark, it.DeleteTime, it.DeleteUserId }).ExecuteCommandAsync();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -427,7 +465,7 @@ public class VisualDevService : IVisualDevService, IDynamicApiController, ITrans
|
||||
{
|
||||
string? random = new Random().NextLetterAndNumberString(5);
|
||||
VisualDevEntity? entity = await _visualDevRepository.AsQueryable().FirstAsync(v => v.Id == id && v.DeleteMark == null);
|
||||
if (entity.State.Equals(1))
|
||||
if (entity.State.Equals(1) && (!entity.Type.Equals(3) && !entity.Type.Equals(4)))
|
||||
{
|
||||
var vREntity = await _visualDevRepository.AsSugarClient().Queryable<VisualDevReleaseEntity>().FirstAsync(v => v.Id == id && v.DeleteMark == null);
|
||||
entity = vREntity.Adapt<VisualDevEntity>();
|
||||
@@ -438,7 +476,9 @@ public class VisualDevService : IVisualDevService, IDynamicApiController, ITrans
|
||||
entity.EnCode += random;
|
||||
entity.State = 0;
|
||||
entity.Id = null; // 复制的数据需要把Id清空,否则会主键冲突错误
|
||||
if (entity.WebType == 3)
|
||||
entity.LastModifyTime = null;
|
||||
|
||||
if (entity.EnableFlow.Equals(1))
|
||||
{
|
||||
DictionaryDataEntity? categoryData = await _dictionaryDataService.GetInfo(entity.Category);
|
||||
FlowEngineEntity? flowEngine = new FlowEngineEntity();
|
||||
@@ -455,12 +495,13 @@ public class VisualDevService : IVisualDevService, IDynamicApiController, ITrans
|
||||
flowEngine.DbLinkId = entity.DbLinkId;
|
||||
flowEngine.FormTemplateJson = entity.FormData;
|
||||
flowEngine.Version = "1";
|
||||
flowEngine.LastModifyTime = null;
|
||||
try
|
||||
{
|
||||
// 添加流程引擎
|
||||
FlowEngineEntity? engineEntity = await _visualDevRepository.AsSugarClient().Insertable(flowEngine).IgnoreColumns(ignoreNullColumn: true).CallEntityMethod(m => m.Creator()).ExecuteReturnEntityAsync();
|
||||
entity.Id = engineEntity.Id;
|
||||
await _visualDevRepository.AsSugarClient().Insertable(entity).IgnoreColumns(ignoreNullColumn: true).CallEntityMethod(m => m.Create()).ExecuteCommandAsync();
|
||||
entity = await _visualDevRepository.AsSugarClient().Insertable(entity).IgnoreColumns(ignoreNullColumn: true).CallEntityMethod(m => m.Create()).ExecuteReturnEntityAsync();
|
||||
}
|
||||
catch
|
||||
{
|
||||
@@ -480,6 +521,20 @@ public class VisualDevService : IVisualDevService, IDynamicApiController, ITrans
|
||||
else throw;
|
||||
}
|
||||
}
|
||||
|
||||
// 同步流程相关
|
||||
if (entity.EnableFlow.Equals(1) && (!entity.Type.Equals(3) && !entity.Type.Equals(4)))
|
||||
{
|
||||
var fEntity = entity.Adapt<FlowFormEntity>();
|
||||
fEntity.PropertyJson = entity.FormData;
|
||||
fEntity.TableJson = entity.Tables;
|
||||
fEntity.DraftJson = fEntity.ToJsonString();
|
||||
fEntity.FlowType = 1;
|
||||
fEntity.FormType = 2;
|
||||
fEntity.FlowId = entity.Id;
|
||||
await _visualDevRepository.AsSugarClient().Insertable(fEntity).IgnoreColumns(ignoreNullColumn: true).CallEntityMethod(m => m.Create()).ExecuteReturnEntityAsync();
|
||||
await SaveFlowTemplate(entity);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -499,11 +554,11 @@ public class VisualDevService : IVisualDevService, IDynamicApiController, ITrans
|
||||
input.appModuleParentId = input.appModuleParentId.IsNullOrWhiteSpace() ? "-1" : input.appModuleParentId;
|
||||
|
||||
//if (entity.State == 0) throw Oops.Oh(ErrorCode.D1405);
|
||||
if (entity.FormData.IsNullOrEmpty()) throw Oops.Oh(ErrorCode.COM1013);
|
||||
if(entity.WebType.Equals(2) && entity.ColumnData.IsNullOrEmpty()) throw Oops.Oh(ErrorCode.COM1014);
|
||||
if (entity.FormData.IsNullOrEmpty() && !entity.WebType.Equals(4)) throw Oops.Oh(ErrorCode.COM1013);
|
||||
if ((entity.WebType.Equals(2) || entity.WebType.Equals(4)) && entity.ColumnData.IsNullOrEmpty()) throw Oops.Oh(ErrorCode.COM1014);
|
||||
|
||||
#region 旧的菜单、权限数据
|
||||
var oldWebModule = await _visualDevRepository.AsSugarClient().Queryable<ModuleEntity>().FirstAsync(x => x.ModuleId == input.id && x.Category == "Web" && x.PropertyJson.Contains("\"isAutoRelease\":true") && x.DeleteMark == null);
|
||||
var oldWebModule = await _visualDevRepository.AsSugarClient().Queryable<ModuleEntity>().FirstAsync(x => x.ModuleId == input.id && x.Category == "Web" && x.DeleteMark == null);
|
||||
var oldWebModuleButtonEntity = await _visualDevRepository.AsSugarClient().Queryable<ModuleButtonEntity>().Where(x => x.DeleteMark == null)
|
||||
.WhereIF(oldWebModule != null, x => x.ModuleId == oldWebModule.Id).WhereIF(oldWebModule == null, x => x.ModuleId == "0").ToListAsync();
|
||||
var oldWebModuleColumnEntity = await _visualDevRepository.AsSugarClient().Queryable<ModuleColumnEntity>().Where(x => x.DeleteMark == null)
|
||||
@@ -511,7 +566,7 @@ public class VisualDevService : IVisualDevService, IDynamicApiController, ITrans
|
||||
var oldWebModuleFormEntity = await _visualDevRepository.AsSugarClient().Queryable<ModuleFormEntity>().Where(x => x.DeleteMark == null)
|
||||
.WhereIF(oldWebModule != null, x => x.ModuleId == oldWebModule.Id).WhereIF(oldWebModule == null, x => x.ModuleId == "0").ToListAsync();
|
||||
|
||||
var oldAppModule = await _visualDevRepository.AsSugarClient().Queryable<ModuleEntity>().FirstAsync(x => x.ModuleId == input.id && x.Category == "App" && x.PropertyJson.Contains("\"isAutoRelease\":true") && x.DeleteMark == null);
|
||||
var oldAppModule = await _visualDevRepository.AsSugarClient().Queryable<ModuleEntity>().FirstAsync(x => x.ModuleId == input.id && x.Category == "App" && x.DeleteMark == null);
|
||||
var oldAppModuleButtonEntity = await _visualDevRepository.AsSugarClient().Queryable<ModuleButtonEntity>().Where(x => x.DeleteMark == null)
|
||||
.WhereIF(oldAppModule != null, x => x.ModuleId == oldAppModule.Id).WhereIF(oldAppModule == null, x => x.ModuleId == "0").ToListAsync();
|
||||
var oldAppModuleColumnEntity = await _visualDevRepository.AsSugarClient().Queryable<ModuleColumnEntity>().Where(x => x.DeleteMark == null)
|
||||
@@ -527,6 +582,78 @@ public class VisualDevService : IVisualDevService, IDynamicApiController, ITrans
|
||||
if (_visualDevRepository.AsSugarClient().Queryable<ModuleEntity>().Any(x => (x.EnCode == entity.EnCode || x.FullName == entity.FullName) && x.Id != oldAppId && x.Category == "App" && x.DeleteMark == null))
|
||||
throw Oops.Oh(ErrorCode.COM1015);
|
||||
|
||||
#region 数据视图
|
||||
if (entity.WebType.Equals(4))
|
||||
{
|
||||
#region 菜单组装
|
||||
var moduleModel = new ModuleEntity();
|
||||
moduleModel.Id = oldWebModule != null ? oldWebModule.Id : SnowflakeIdHelper.NextId();
|
||||
moduleModel.ModuleId = input.id;
|
||||
moduleModel.ParentId = oldWebModule != null ? oldWebModule.ParentId : (input.pcModuleParentId.Equals(input.pcSystemId) ? "-1" : input.pcModuleParentId); // 父级菜单节点
|
||||
moduleModel.Category = "Web";
|
||||
moduleModel.FullName = entity.FullName;
|
||||
moduleModel.EnCode = entity.EnCode;
|
||||
moduleModel.Icon = "icon-ym icon-ym-webForm";
|
||||
moduleModel.UrlAddress = oldWebModule != null ? oldWebModule.UrlAddress : "model/" + entity.EnCode;
|
||||
moduleModel.Type = 3;
|
||||
moduleModel.EnabledMark = 1;
|
||||
moduleModel.IsColumnAuthorize = 1;
|
||||
moduleModel.IsButtonAuthorize = 1;
|
||||
moduleModel.IsFormAuthorize = 1;
|
||||
moduleModel.IsDataAuthorize = 1;
|
||||
moduleModel.SortCode = 999;
|
||||
moduleModel.CreatorTime = DateTime.Now;
|
||||
moduleModel.PropertyJson = (new { moduleId = input.id, iconBackgroundColor = string.Empty, isTree = 0 }).ToJsonString();
|
||||
moduleModel.SystemId = oldWebModule != null ? oldWebModule.SystemId : input.pcSystemId;
|
||||
|
||||
#endregion
|
||||
|
||||
// 添加PC菜单
|
||||
if (input.pc == 1)
|
||||
{
|
||||
var storModuleModel = _visualDevRepository.AsSugarClient().Storageable(moduleModel).Saveable().ToStorage(); // 存在更新不存在插入 根据主键
|
||||
await storModuleModel.AsInsertable.ExecuteCommandAsync(); // 执行插入
|
||||
await storModuleModel.AsUpdateable.ExecuteCommandAsync(); // 执行更新
|
||||
}
|
||||
|
||||
// 添加App菜单
|
||||
if (input.app == 1)
|
||||
{
|
||||
#region App菜单
|
||||
moduleModel.Id = oldAppModule != null ? oldAppModule.Id : SnowflakeIdHelper.NextId();
|
||||
moduleModel.ModuleId = input.id;
|
||||
moduleModel.ParentId = oldAppModule != null ? oldAppModule.ParentId : (input.appModuleParentId.Equals(input.appSystemId) ? "-1" : input.appModuleParentId); // 父级菜单节点
|
||||
moduleModel.Category = "App";
|
||||
moduleModel.UrlAddress = oldAppModule != null ? oldAppModule.UrlAddress : "/pages/apply/dynamicModel/index?id=" + entity.EnCode;
|
||||
moduleModel.SystemId = oldAppModule != null ? oldAppModule.SystemId : input.appSystemId;
|
||||
|
||||
#endregion
|
||||
|
||||
var storModuleModel = _visualDevRepository.AsSugarClient().Storageable(moduleModel).Saveable().ToStorage(); // 存在更新不存在插入 根据主键
|
||||
await storModuleModel.AsInsertable.ExecuteCommandAsync(); // 执行插入
|
||||
await storModuleModel.AsUpdateable.ExecuteCommandAsync(); // 执行更新
|
||||
|
||||
}
|
||||
|
||||
// 修改功能发布状态
|
||||
await _visualDevRepository.AsUpdateable().SetColumns(it => it.State == 1).Where(it => it.Id == id).ExecuteCommandHasChangeAsync();
|
||||
|
||||
// 线上版本
|
||||
if (!await _visualDevRepository.AsSugarClient().Queryable<VisualDevReleaseEntity>().AnyAsync(x => x.Id.Equals(id)))
|
||||
{
|
||||
var vReleaseEntity = entity.Adapt<VisualDevReleaseEntity>();
|
||||
await _visualDevRepository.AsSugarClient().Insertable(vReleaseEntity).IgnoreColumns(ignoreNullColumn: true).CallEntityMethod(m => m.Create()).ExecuteCommandAsync();
|
||||
}
|
||||
else
|
||||
{
|
||||
var vReleaseEntity = entity.Adapt<VisualDevReleaseEntity>();
|
||||
await _visualDevRepository.AsSugarClient().Updateable(vReleaseEntity).CallEntityMethod(m => m.LastModify()).ExecuteCommandAsync();
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
#endregion
|
||||
|
||||
TemplateParsingBase? tInfo = new TemplateParsingBase(entity); // 解析模板
|
||||
|
||||
// 无表转有表
|
||||
@@ -539,6 +666,7 @@ public class VisualDevService : IVisualDevService, IDynamicApiController, ITrans
|
||||
else
|
||||
throw Oops.Oh(ErrorCode.D1414);
|
||||
tInfo = new TemplateParsingBase(res); // 解析模板
|
||||
entity = res;
|
||||
}
|
||||
|
||||
ColumnDesignModel? columnData = new ColumnDesignModel();
|
||||
@@ -607,7 +735,7 @@ public class VisualDevService : IVisualDevService, IDynamicApiController, ITrans
|
||||
moduleModel.IsDataAuthorize = 1;
|
||||
moduleModel.SortCode = 999;
|
||||
moduleModel.CreatorTime = DateTime.Now;
|
||||
moduleModel.PropertyJson = (new { moduleId = input.id, iconBackgroundColor = string.Empty, isTree = 0, isAutoRelease = true }).ToJsonString();
|
||||
moduleModel.PropertyJson = (new { moduleId = input.id, iconBackgroundColor = string.Empty, isTree = 0 }).ToJsonString();
|
||||
moduleModel.SystemId = oldWebModule != null ? oldWebModule.SystemId : input.pcSystemId;
|
||||
|
||||
#endregion
|
||||
@@ -816,7 +944,7 @@ public class VisualDevService : IVisualDevService, IDynamicApiController, ITrans
|
||||
// 创建用户和所属组织权限方案
|
||||
// 只添加 主表控件的数据权限
|
||||
var fList = fieldList.Where(x => !x.__vModel__.Contains("_jnpf_") && x.__vModel__.IsNotEmptyOrNull() && x.__config__.visibility.Contains("pc"))
|
||||
.Where(x => x.__config__.jnpfKey == "createUser" || x.__config__.jnpfKey == "currOrganize").ToList();
|
||||
.Where(x => x.__config__.jnpfKey == JnpfKeyConst.CREATEUSER || x.__config__.jnpfKey == JnpfKeyConst.CURRORGANIZE).ToList();
|
||||
|
||||
var authList = await MenuMergeDataAuth(moduleModel.Id, fList);
|
||||
await MenuMergeDataAuthScheme(moduleModel.Id, authList, fList);
|
||||
@@ -1021,7 +1149,7 @@ public class VisualDevService : IVisualDevService, IDynamicApiController, ITrans
|
||||
// 创建用户和所属组织权限方案
|
||||
// 只添加 主表控件的数据权限
|
||||
var fList = fieldList.Where(x => !x.__vModel__.Contains("_jnpf_") && x.__vModel__.IsNotEmptyOrNull() && x.__config__.visibility.Contains("app"))
|
||||
.Where(x => x.__config__.jnpfKey == "createUser" || x.__config__.jnpfKey == "currOrganize").ToList();
|
||||
.Where(x => x.__config__.jnpfKey == JnpfKeyConst.CREATEUSER || x.__config__.jnpfKey == JnpfKeyConst.CURRORGANIZE).ToList();
|
||||
|
||||
var authList = await MenuMergeDataAuth(moduleModel.Id, fList);
|
||||
await MenuMergeDataAuthScheme(moduleModel.Id, authList, fList);
|
||||
@@ -1041,6 +1169,7 @@ public class VisualDevService : IVisualDevService, IDynamicApiController, ITrans
|
||||
// 同步添加流程表单
|
||||
if (entity.EnableFlow.Equals(1))
|
||||
{
|
||||
if (!_visualDevRepository.AsSugarClient().Queryable<FlowTemplateJsonEntity>().Any(x => x.TemplateId.Equals(entity.Id))) throw Oops.Oh(ErrorCode.D1421);
|
||||
var fEntity = entity.Adapt<FlowFormEntity>();
|
||||
fEntity.TableJson = entity.Tables;
|
||||
fEntity.FlowType = 1;
|
||||
@@ -1048,7 +1177,8 @@ public class VisualDevService : IVisualDevService, IDynamicApiController, ITrans
|
||||
fEntity.EnabledMark = 1;
|
||||
fEntity.PropertyJson = entity.FormData;
|
||||
fEntity.DraftJson = fEntity.ToJsonString();
|
||||
await _visualDevRepository.AsSugarClient().Insertable(fEntity).IgnoreColumns(ignoreNullColumn: true).ExecuteReturnEntityAsync();
|
||||
await _visualDevRepository.AsSugarClient().Updateable(fEntity).IgnoreColumns(ignoreAllNullColumns: true).CallEntityMethod(m => m.LastModify()).ExecuteCommandAsync();
|
||||
await _visualDevRepository.AsSugarClient().Updateable<FlowTemplateEntity>().SetColumns(x => x.EnabledMark == 1).Where(it => it.Id == entity.Id).ExecuteCommandHasChangeAsync();
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -1058,6 +1188,7 @@ public class VisualDevService : IVisualDevService, IDynamicApiController, ITrans
|
||||
|
||||
if (entity.EnableFlow.Equals(1))
|
||||
{
|
||||
if (!_visualDevRepository.AsSugarClient().Queryable<FlowTemplateJsonEntity>().Any(x => x.TemplateId.Equals(entity.Id))) throw Oops.Oh(ErrorCode.D1421);
|
||||
var fEntity = entity.Adapt<FlowFormEntity>();
|
||||
fEntity.TableJson = entity.Tables;
|
||||
fEntity.FlowType = 1;
|
||||
@@ -1065,14 +1196,28 @@ public class VisualDevService : IVisualDevService, IDynamicApiController, ITrans
|
||||
fEntity.EnabledMark = 1;
|
||||
fEntity.PropertyJson = entity.FormData;
|
||||
fEntity.DraftJson = fEntity.ToJsonString();
|
||||
fEntity.FlowId = _visualDevRepository.AsSugarClient().Queryable<FlowFormEntity>().Where(x => x.Id.Equals(entity.Id)).Select(x => x.FlowId).First();
|
||||
if (!await _visualDevRepository.AsSugarClient().Queryable<FlowFormEntity>().AnyAsync(x => x.Id.Equals(id)))
|
||||
await _visualDevRepository.AsSugarClient().Insertable(fEntity).IgnoreColumns(ignoreNullColumn: true).ExecuteReturnEntityAsync();
|
||||
else
|
||||
await _visualDevRepository.AsSugarClient().Updateable(fEntity).CallEntityMethod(m => m.LastModify()).ExecuteCommandAsync();
|
||||
await _visualDevRepository.AsSugarClient().Updateable(fEntity).IgnoreColumns(ignoreAllNullColumns: true).CallEntityMethod(m => m.LastModify()).ExecuteCommandAsync();
|
||||
|
||||
await _visualDevRepository.AsSugarClient().Updateable<FlowTemplateEntity>().SetColumns(x => x.EnabledMark == 1).Where(it => it.Id == entity.Id).ExecuteCommandHasChangeAsync();
|
||||
}
|
||||
}
|
||||
|
||||
var dbLink = await _runService.GetDbLink(entity.DbLinkId);
|
||||
var MainTable = entity.Tables.ToList<TableModel>().Find(m => m.typeId.Equals("1")); // 主表
|
||||
if (!_changeDataBase.IsAnyColumn(dbLink, MainTable?.table, "f_flowtaskid"))
|
||||
{
|
||||
var pFieldList = new List<DbTableFieldModel>() { new DbTableFieldModel() { field = "F_FlowTaskId", fieldName = "流程任务Id", dataType = "varchar", dataLength = "50", allowNull = 1 } };
|
||||
_changeDataBase.AddTableColumn(dbLink, MainTable?.table, pFieldList);
|
||||
}
|
||||
if (!_changeDataBase.IsAnyColumn(dbLink, MainTable?.table, "f_flowid"))
|
||||
{
|
||||
var pFieldList = new List<DbTableFieldModel>() { new DbTableFieldModel() { field = "F_FlowId", fieldName = "流程引擎Id", dataType = "varchar", dataLength = "50", allowNull = 1 } };
|
||||
_changeDataBase.AddTableColumn(dbLink, MainTable?.table, pFieldList);
|
||||
}
|
||||
|
||||
_db.CommitTran();
|
||||
}
|
||||
catch (Exception)
|
||||
@@ -1098,13 +1243,12 @@ public class VisualDevService : IVisualDevService, IDynamicApiController, ITrans
|
||||
if (isGetRelease)
|
||||
{
|
||||
var vREntity = await _visualDevRepository.AsSugarClient().Queryable<VisualDevReleaseEntity>().FirstAsync(x => x.Id == id && x.DeleteMark == null);
|
||||
if (_visualDevRepository.AsSugarClient().Queryable<FlowFormEntity>().Any(x => x.Id.Equals(id)))
|
||||
if (vREntity != null && vREntity.EnableFlow == 1 && _visualDevRepository.AsSugarClient().Queryable<FlowFormEntity>().Any(x => x.Id.Equals(id)))
|
||||
{
|
||||
vREntity.FlowId = await _visualDevRepository.AsSugarClient().Queryable<FlowFormEntity>().Where(x => x.Id.Equals(id)).Select(x => x.FlowId).FirstAsync();
|
||||
if (vREntity.FlowId.IsNotEmptyOrNull())
|
||||
{
|
||||
var tempId = _visualDevRepository.AsSugarClient().Queryable<FlowTemplateJsonEntity>().Where(x => x.Id.Equals(vREntity.FlowId)).Select(x => x.TemplateId).First();
|
||||
if (!_visualDevRepository.AsSugarClient().Queryable<FlowTemplateEntity>().Where(x => x.Id.Equals(tempId) && x.EnabledMark.Equals(1)).Any())
|
||||
if (!_visualDevRepository.AsSugarClient().Queryable<FlowTemplateEntity>().Where(x => x.Id.Equals(vREntity.FlowId) && x.EnabledMark.Equals(1)).Any())
|
||||
vREntity.EnableFlow = -1;
|
||||
}
|
||||
}
|
||||
@@ -1155,6 +1299,26 @@ public class VisualDevService : IVisualDevService, IDynamicApiController, ITrans
|
||||
await stor.AsInsertable.ExecuteCommandAsync(); // 执行插入
|
||||
await _visualDevRepository.AsSugarClient().Updateable(input).CallEntityMethod(m => m.LastModify()).ExecuteCommandAsync();
|
||||
|
||||
// 同步流程表单
|
||||
var fEntity = await _visualDevRepository.AsSugarClient().Queryable<FlowFormEntity>().FirstAsync(v => v.Id == input.Id);
|
||||
if (fEntity != null)
|
||||
{
|
||||
fEntity.DeleteMark = null;
|
||||
fEntity.DeleteTime = null;
|
||||
fEntity.DeleteUserId = null;
|
||||
await _visualDevRepository.AsSugarClient().Updateable(fEntity).CallEntityMethod(m => m.LastModify()).UpdateColumns(it => new { it.DeleteMark, it.DeleteTime, it.DeleteUserId, it.LastModifyTime, it.LastModifyUserId }).ExecuteCommandAsync();
|
||||
}
|
||||
|
||||
// 同步程引擎
|
||||
var tEntity = await _visualDevRepository.AsSugarClient().Queryable<FlowTemplateEntity>().FirstAsync(v => v.Id == input.Id);
|
||||
if (tEntity != null)
|
||||
{
|
||||
tEntity.DeleteMark = null;
|
||||
tEntity.DeleteTime = null;
|
||||
tEntity.DeleteUserId = null;
|
||||
await _visualDevRepository.AsSugarClient().Updateable(tEntity).CallEntityMethod(m => m.LastModify()).UpdateColumns(it => new { it.DeleteMark, it.DeleteTime, it.DeleteUserId, it.LastModifyTime, it.LastModifyUserId }).ExecuteCommandAsync();
|
||||
}
|
||||
|
||||
_db.CommitTran(); // 关闭事务
|
||||
}
|
||||
catch (Exception)
|
||||
@@ -1173,7 +1337,7 @@ public class VisualDevService : IVisualDevService, IDynamicApiController, ITrans
|
||||
[NonAction]
|
||||
public async Task<VisualDevEntity> NoTblToTable(VisualDevEntity vEntity, string mainTableName)
|
||||
{
|
||||
var dbtype = App.Configuration["ConnectionStrings:DBType"]; // 读取数据库连接配置
|
||||
var dbtype = _visualDevRepository.AsSugarClient().CurrentConnectionConfig.DbType.ToString();
|
||||
var isUpper = false; // 是否大写
|
||||
if (dbtype.ToLower().Equals("oracle") || dbtype.ToLower().Equals("dm") || dbtype.ToLower().Equals("dm8")) isUpper = true;
|
||||
else isUpper = false;
|
||||
@@ -1181,7 +1345,7 @@ public class VisualDevService : IVisualDevService, IDynamicApiController, ITrans
|
||||
// Oracle和Dm数据库 表名全部大写, 其他全部小写
|
||||
mainTableName = isUpper ? mainTableName.ToUpper() : mainTableName.ToLower();
|
||||
|
||||
FormDataModel formModel = vEntity.FormData.ToObject<FormDataModel>();
|
||||
FormDataModel formModel = vEntity.FormData.ToObjectOld<FormDataModel>();
|
||||
List<FieldsModel>? fieldsModelList = TemplateAnalysis.AnalysisTemplateData(formModel.fields);
|
||||
|
||||
#region 创表信息组装
|
||||
@@ -1193,12 +1357,13 @@ public class VisualDevService : IVisualDevService, IDynamicApiController, ITrans
|
||||
mainInfo.table = mainTableName;
|
||||
mainInfo.tableName = vEntity.FullName;
|
||||
mainInfo.FieldList = FieldsModelToTableFile(fieldsModelList, formModel.primaryKeyPolicy == 2);
|
||||
if (vEntity.WebType.Equals(3)) mainInfo.FieldList.Add(new DbTableFieldModel() { field = "F_FlowTaskId", fieldName = "流程任务Id", dataType = "varchar", dataLength = "50", allowNull = 1 });
|
||||
if (vEntity.EnableFlow.Equals(1)) mainInfo.FieldList.Add(new DbTableFieldModel() { field = "F_FlowTaskId", fieldName = "流程任务Id", dataType = "varchar", dataLength = "50", allowNull = 1 });
|
||||
if (vEntity.EnableFlow.Equals(1)) mainInfo.FieldList.Add(new DbTableFieldModel() { field = "F_FlowId", fieldName = "流程引擎Id", dataType = "varchar", dataLength = "50", allowNull = 1 });
|
||||
if (formModel.logicalDelete) mainInfo.FieldList.Add(new DbTableFieldModel() { field = "F_DeleteMark", fieldName = "删除标识", dataType = "int", dataLength = "50", allowNull = 1 });
|
||||
|
||||
// 子表信息
|
||||
Dictionary<string, string>? childTableDic = new Dictionary<string, string>();
|
||||
fieldsModelList.Where(x => x.__config__.jnpfKey == "table").ToList().ForEach(item =>
|
||||
fieldsModelList.Where(x => x.__config__.jnpfKey == JnpfKeyConst.TABLE).ToList().ForEach(item =>
|
||||
{
|
||||
DbTableAndFieldModel? childTInfo = new DbTableAndFieldModel();
|
||||
childTInfo.table = "ct" + SnowflakeIdHelper.NextId();
|
||||
@@ -1246,7 +1411,7 @@ public class VisualDevService : IVisualDevService, IDynamicApiController, ITrans
|
||||
{
|
||||
EntityFieldModel? etFieldModel = new EntityFieldModel();
|
||||
etFieldModel.DataLength = it.dataLength;
|
||||
etFieldModel.PrimaryKey = 0;
|
||||
etFieldModel.PrimaryKey = it.primaryKey.ParseToInt();
|
||||
etFieldModel.DataType = it.dataType;
|
||||
etFieldModel.Field = it.field;
|
||||
etFieldModel.FieldName = it.fieldName;
|
||||
@@ -1259,8 +1424,8 @@ public class VisualDevService : IVisualDevService, IDynamicApiController, ITrans
|
||||
#region 给控件绑定 tableName、relationTable 属性
|
||||
|
||||
// 用字典反序列化, 避免多增加不必要的属性
|
||||
Dictionary<string, object>? dicFormModel = vEntity.FormData.ToObject<Dictionary<string, object>>();
|
||||
List<Dictionary<string, object>>? dicFieldsModelList = dicFormModel.FirstOrDefault(x => x.Key == "fields").Value.ToObject<List<Dictionary<string, object>>>();
|
||||
Dictionary<string, object>? dicFormModel = vEntity.FormData.ToObjectOld<Dictionary<string, object>>();
|
||||
List<Dictionary<string, object>>? dicFieldsModelList = dicFormModel.FirstOrDefault(x => x.Key == "fields").Value.ToJsonString().ToObjectOld<List<Dictionary<string, object>>>();
|
||||
|
||||
// 主表
|
||||
MainFieldsBindTable(dicFieldsModelList, childTableDic, mainTableName);
|
||||
@@ -1285,7 +1450,7 @@ public class VisualDevService : IVisualDevService, IDynamicApiController, ITrans
|
||||
foreach (DbTableAndFieldModel? item in addTableList)
|
||||
{
|
||||
bool res = await _changeDataBase.Create(link, item, item.FieldList);
|
||||
if (!res) Oops.Oh(ErrorCode.COM1008); // throw null;
|
||||
if (!res) throw null;
|
||||
}
|
||||
|
||||
if (await _visualDevRepository.IsAnyAsync(x => x.Id.Equals(vEntity.Id)))
|
||||
@@ -1304,35 +1469,6 @@ public class VisualDevService : IVisualDevService, IDynamicApiController, ITrans
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 数据 转 插入Sql语句.
|
||||
/// </summary>
|
||||
/// <param name="tableName">表名.</param>
|
||||
/// <param name="dataStr">数据包字符串.</param>
|
||||
/// <returns></returns>
|
||||
[NonAction]
|
||||
public List<string> DataToInsertSql(string tableName, string dataStr)
|
||||
{
|
||||
List<string>? sqlList = new List<string>();
|
||||
string? sql = "insert into [{0}] ({1}) values('{2}');";
|
||||
|
||||
List<Dictionary<string, string>>? dataMap = dataStr.ToObject<List<Dictionary<string, string>>>();
|
||||
|
||||
List<string>? fielsKeyList = new List<string>();
|
||||
List<string>? fieldValueList = new List<string>();
|
||||
|
||||
dataMap.ForEach(item =>
|
||||
{
|
||||
string? fielsKey = item.Keys.FirstOrDefault();
|
||||
fielsKeyList.Add(fielsKey);
|
||||
fieldValueList.Add(item[fielsKey]);
|
||||
});
|
||||
|
||||
sqlList.Add(string.Format(sql, tableName, string.Join(",", fielsKeyList), string.Join("','", fieldValueList)));
|
||||
|
||||
return sqlList;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Private
|
||||
@@ -1348,7 +1484,7 @@ public class VisualDevService : IVisualDevService, IDynamicApiController, ITrans
|
||||
{
|
||||
List<DbTableFieldModel>? fieldList = new List<DbTableFieldModel>(); // 表字段
|
||||
List<FieldsModel>? mList = fmList.Where(x => x.__config__.jnpfKey.IsNotEmptyOrNull())
|
||||
.Where(x => x.__config__.jnpfKey != "qrcode" && x.__config__.jnpfKey != "barcode" && x.__config__.jnpfKey != "table").ToList(); // 非存储字段
|
||||
.Where(x => x.__config__.jnpfKey != JnpfKeyConst.QRCODE && x.__config__.jnpfKey != JnpfKeyConst.BARCODE && x.__config__.jnpfKey != JnpfKeyConst.TABLE).ToList(); // 非存储字段
|
||||
fieldList.Add(new DbTableFieldModel()
|
||||
{
|
||||
primaryKey = true,
|
||||
@@ -1437,7 +1573,7 @@ public class VisualDevService : IVisualDevService, IDynamicApiController, ITrans
|
||||
List<ModuleDataAuthorizeEntity>? noDelData = new List<ModuleDataAuthorizeEntity>(); // 记录未删除
|
||||
|
||||
// 当前用户
|
||||
FieldsModel? item = fields.FirstOrDefault(x => x.__config__.jnpfKey == "createUser");
|
||||
FieldsModel? item = fields.FirstOrDefault(x => x.__config__.jnpfKey == JnpfKeyConst.CREATEUSER);
|
||||
if (item != null)
|
||||
{
|
||||
var fRule = item.__vModel__.Contains("_jnpf_") ? 1 : 0;
|
||||
@@ -1494,7 +1630,7 @@ public class VisualDevService : IVisualDevService, IDynamicApiController, ITrans
|
||||
}
|
||||
|
||||
// 所属组织
|
||||
item = fields.FirstOrDefault(x => x.__config__.jnpfKey == "currOrganize");
|
||||
item = fields.FirstOrDefault(x => x.__config__.jnpfKey == JnpfKeyConst.CURRORGANIZE);
|
||||
if (item != null)
|
||||
{
|
||||
var fRule = item.__vModel__.Contains("_jnpf_") ? 1 : 0;
|
||||
@@ -1551,7 +1687,7 @@ public class VisualDevService : IVisualDevService, IDynamicApiController, ITrans
|
||||
}
|
||||
|
||||
// 当前分管组织
|
||||
item = fields.FirstOrDefault(x => x.__config__.jnpfKey == "currOrganize");
|
||||
item = fields.FirstOrDefault(x => x.__config__.jnpfKey == JnpfKeyConst.CURRORGANIZE);
|
||||
if (item != null)
|
||||
{
|
||||
var fRule = item.__vModel__.Contains("_jnpf_") ? 1 : 0;
|
||||
@@ -1638,7 +1774,7 @@ public class VisualDevService : IVisualDevService, IDynamicApiController, ITrans
|
||||
List<ModuleDataAuthorizeSchemeEntity>? authSchemeList = new List<ModuleDataAuthorizeSchemeEntity>(); // 方案管理
|
||||
|
||||
// 当前用户
|
||||
FieldsModel? item = fields.FirstOrDefault(x => x.__config__.jnpfKey == "createUser");
|
||||
FieldsModel? item = fields.FirstOrDefault(x => x.__config__.jnpfKey == JnpfKeyConst.CREATEUSER);
|
||||
var condJson = new AuthorizeModuleResourceConditionModelInput()
|
||||
{
|
||||
logic = "and",
|
||||
@@ -1710,7 +1846,7 @@ public class VisualDevService : IVisualDevService, IDynamicApiController, ITrans
|
||||
}
|
||||
|
||||
// 当前组织
|
||||
item = fields.FirstOrDefault(x => x.__config__.jnpfKey == "currOrganize");
|
||||
item = fields.FirstOrDefault(x => x.__config__.jnpfKey == JnpfKeyConst.CURRORGANIZE);
|
||||
if (item != null)
|
||||
{
|
||||
ModuleDataAuthorizeEntity? model = authList.FirstOrDefault(x => x.EnCode == item.__vModel__ && x.ConditionText.Equals("@organizeId"));
|
||||
@@ -1777,7 +1913,7 @@ public class VisualDevService : IVisualDevService, IDynamicApiController, ITrans
|
||||
}
|
||||
|
||||
// 当前分管组织
|
||||
item = fields.FirstOrDefault(x => x.__config__.jnpfKey == "currOrganize");
|
||||
item = fields.FirstOrDefault(x => x.__config__.jnpfKey == JnpfKeyConst.CURRORGANIZE);
|
||||
if (item != null)
|
||||
{
|
||||
ModuleDataAuthorizeEntity? model = authList.FirstOrDefault(x => x.EnCode == item.__vModel__ && x.ConditionText.Equals("@branchManageOrganize"));
|
||||
@@ -1858,11 +1994,11 @@ public class VisualDevService : IVisualDevService, IDynamicApiController, ITrans
|
||||
{
|
||||
var obj = item["__config__"].ToObject<Dictionary<string, object>>();
|
||||
|
||||
if (obj.ContainsKey("jnpfKey") && obj["jnpfKey"].Equals("table")) obj["tableName"] = childTableDic[item["__vModel__"].ToString()];
|
||||
else if(obj.ContainsKey("tableName")) obj["tableName"] = tableName;
|
||||
if (obj.ContainsKey("jnpfKey") && obj["jnpfKey"].Equals(JnpfKeyConst.TABLE)) obj["tableName"] = childTableDic[item["__vModel__"].ToString()];
|
||||
else if (obj.ContainsKey("tableName")) obj["tableName"] = tableName;
|
||||
|
||||
// 关联表单属性和弹窗属性
|
||||
if (obj.ContainsKey("jnpfKey") && (obj["jnpfKey"].Equals("relationFormAttr") || obj["jnpfKey"].Equals("popupAttr")))
|
||||
if (obj.ContainsKey("jnpfKey") && (obj["jnpfKey"].Equals(JnpfKeyConst.RELATIONFORMATTR) || obj["jnpfKey"].Equals(JnpfKeyConst.POPUPATTR)))
|
||||
{
|
||||
string relationField = Convert.ToString(item["relationField"]);
|
||||
string? rField = relationField.ReplaceRegex(@"_jnpfTable_(\w+)", string.Empty);
|
||||
@@ -1917,7 +2053,7 @@ public class VisualDevService : IVisualDevService, IDynamicApiController, ITrans
|
||||
if (cObj.ContainsKey("tableName")) cObj["tableName"] = tableName;
|
||||
|
||||
// 关联表单属性和弹窗属性
|
||||
if (cObj.ContainsKey("jnpfKey") && (cObj["jnpfKey"].Equals("relationFormAttr") || cObj["jnpfKey"].Equals("popupAttr")))
|
||||
if (cObj.ContainsKey("jnpfKey") && (cObj["jnpfKey"].Equals(JnpfKeyConst.RELATIONFORMATTR) || cObj["jnpfKey"].Equals(JnpfKeyConst.POPUPATTR)))
|
||||
{
|
||||
string relationField = Convert.ToString(child["relationField"]);
|
||||
string? rField = relationField.ReplaceRegex(@"_jnpfTable_(\w+)", string.Empty);
|
||||
@@ -1941,10 +2077,10 @@ public class VisualDevService : IVisualDevService, IDynamicApiController, ITrans
|
||||
obj["children"] = fmList;
|
||||
}
|
||||
|
||||
if(obj["jnpfKey"].Equals(JnpfKeyConst.TAB))
|
||||
if (obj["jnpfKey"].Equals(JnpfKeyConst.TAB))
|
||||
{
|
||||
var fmList = obj["children"].ToObject<List<Dictionary<string, object>>>();
|
||||
foreach(var it in fmList)
|
||||
foreach (var it in fmList)
|
||||
{
|
||||
var fmChild = it["__config__"].ToObject<Dictionary<string, object>>();
|
||||
var fmChildList = fmChild["children"].ToObject<List<Dictionary<string, object>>>();
|
||||
@@ -1987,5 +2123,32 @@ public class VisualDevService : IVisualDevService, IDynamicApiController, ITrans
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 同步到流程相关.
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
private async Task SaveFlowTemplate(VisualDevEntity input)
|
||||
{
|
||||
if (!(await _visualDevRepository.AsSugarClient().Queryable<FlowTemplateEntity>().AnyAsync(x => x.Id.Equals(input.Id))))
|
||||
{
|
||||
if (await _visualDevRepository.AsSugarClient().Queryable<FlowTemplateEntity>().AnyAsync(x => (x.EnCode == input.EnCode || x.FullName == input.FullName) && x.DeleteMark == null))
|
||||
throw Oops.Oh(ErrorCode.COM1004);
|
||||
|
||||
var dicType = await _visualDevRepository.AsSugarClient().Queryable<DictionaryDataEntity>().Where(x => x.Id.Equals(input.Category)).FirstAsync();
|
||||
var flowType = await _visualDevRepository.AsSugarClient().Queryable<DictionaryDataEntity>().Where(x => x.EnCode.Equals(dicType.EnCode) && x.DictionaryTypeId.Equals("507f4f5df86b47588138f321e0b0dac7")).FirstAsync();
|
||||
|
||||
var flowTemplateEntity = input.Adapt<FlowTemplateEntity>();
|
||||
flowTemplateEntity.EnabledMark = 0;
|
||||
flowTemplateEntity.Type = 1;
|
||||
flowTemplateEntity.Category = flowType.Id;
|
||||
//flowTemplateEntity.IconBackground = "#008cff";.
|
||||
//flowTemplateEntity.Icon = "icon-ym icon-ym-node";
|
||||
|
||||
var result = await _visualDevRepository.AsSugarClient().Insertable(flowTemplateEntity).CallEntityMethod(m => m.Create()).ExecuteReturnEntityAsync();
|
||||
if (result == null)
|
||||
throw Oops.Oh(ErrorCode.COM1005);
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user