控制模版数据转换,将json字符串反序列化List<string>时,代码调整
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
using JNPF.Common.Const;
|
||||
using System.Text.RegularExpressions;
|
||||
using JNPF.Common.Const;
|
||||
using JNPF.Common.Core.Manager;
|
||||
using JNPF.Common.Dtos;
|
||||
using JNPF.Common.Extension;
|
||||
@@ -307,7 +308,18 @@ public class FormDataParsing : ITransient
|
||||
else conversionData = data;
|
||||
break;
|
||||
default:
|
||||
conversionData = data.ToString().ToObject<List<object>>();
|
||||
//modify by ly on 20230327
|
||||
var temp = data.ToString();
|
||||
Regex re = new Regex("(?<=\").*?(?=\")", RegexOptions.None);
|
||||
if (!re.IsMatch(temp))
|
||||
{
|
||||
temp = $"\"{data}\"";
|
||||
}
|
||||
if (!temp.StartsWith("[") && !temp.EndsWith("]"))
|
||||
{
|
||||
temp = $"[{temp}]";
|
||||
}
|
||||
conversionData = temp.ToObject<List<object>>();
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -1412,7 +1424,7 @@ public class FormDataParsing : ITransient
|
||||
var flowTaskList = await _db.AsSugarClient().Queryable<FlowTaskEntity>().Where(x => ids.Contains(x.Id)).Select(x => new FlowTaskEntity() { Id = x.Id, Status = x.Status }).ToListAsync();
|
||||
list.ForEach(item =>
|
||||
{
|
||||
if(flowTaskList.Any(x => x.Id.Equals(item[primaryKey].ToString())))
|
||||
if (flowTaskList.Any(x => x.Id.Equals(item[primaryKey].ToString())))
|
||||
{
|
||||
var flowTask = flowTaskList.Where(x => x.Id.Equals(item[primaryKey].ToString())).FirstOrDefault();
|
||||
item["flowState"] = flowTask.Status;
|
||||
@@ -1443,6 +1455,7 @@ public class FormDataParsing : ITransient
|
||||
if (!(dataMap[strKey[i]] is null))
|
||||
{
|
||||
FieldsModel? form = formData.Where(f => f.__vModel__ == strKey[i]).FirstOrDefault();
|
||||
|
||||
if (form != null)
|
||||
{
|
||||
if (form.__vModel__.Contains(form.__config__.jnpfKey + "Field")) dataMap[strKey[i]] = TemplateControlsDataConversion(dataMap[strKey[i]], form);
|
||||
@@ -1876,7 +1889,7 @@ public class FormDataParsing : ITransient
|
||||
_cacheManager.Set(redisName, res.list.ToList(), TimeSpan.FromMinutes(10)); // 缓存10分钟
|
||||
});
|
||||
var cacheStr = _cacheManager.Get(redisName);
|
||||
if(cacheStr.IsNotEmptyOrNull()) relationFormDataList = _cacheManager.Get(redisName).ToObject<List<Dictionary<string, object>>>();
|
||||
if (cacheStr.IsNotEmptyOrNull()) relationFormDataList = _cacheManager.Get(redisName).ToObject<List<Dictionary<string, object>>>();
|
||||
}
|
||||
|
||||
var relationFormRealData = relationFormDataList.Where(it => it["id"].Equals(dataMap[key])).FirstOrDefault();
|
||||
@@ -1976,7 +1989,7 @@ public class FormDataParsing : ITransient
|
||||
});
|
||||
_databaseService.ChangeDataBase(_databaseService.GetTenantDbLink(_userManager.TenantId, _userManager.TenantDbName));
|
||||
var res = _dataInterfaceService.GetResponseByType(form.__config__.propsUrl, 0, string.Empty, new Common.Dtos.VisualDev.VisualDevDataFieldDataListInput() { paramList = form.__config__.templateJson.Adapt<List<DataInterfaceReqParameterInfo>>(), pageSize = 500, currentPage = 1 }).Result;
|
||||
var resList = res.ToObject<PageResult<Dictionary<string,object>>>();
|
||||
var resList = res.ToObject<PageResult<Dictionary<string, object>>>();
|
||||
if (resList != null && resList.list.Any())
|
||||
{
|
||||
foreach (object? item in mValue)
|
||||
|
||||
Reference in New Issue
Block a user