新增ESS端提交问卷信息接口

培训记录新增列冻结
master
xiaochanghai 3 months ago
parent 7311308540
commit 6ad4a82247
  1. 16
      Tiobon.Core.Model/ViewModels/Menu.cs
  2. 38
      Tiobon.Core.Services/CommonServices.cs
  3. 29
      Tiobon.Core.Services/Ghra/Ghra_TitleServices.cs
  4. 54
      Tiobon.Core.Services/Ghre/Ghre_SurveyServices.cs

@ -1,4 +1,6 @@
namespace Tiobon.Core.Model; using Newtonsoft.Json.Linq;
namespace Tiobon.Core.Model;
public class MenuParam public class MenuParam
{ {
@ -36,6 +38,16 @@ public class ModuleParam
public string timestamp { get; set; } public string timestamp { get; set; }
public string token { get; set; } public string token { get; set; }
public ModulejsonParam jsonParam { get; set; } public ModulejsonParam jsonParam { get; set; }
private JObject _jsonParam;
public JObject jsonParam1
{
get { return _jsonParam; }
set
{
_jsonParam = value;
}
}
} }
public class ModulejsonParam public class ModulejsonParam
{ {
@ -100,6 +112,7 @@ public class TableColumn
public int width { get; set; } public int width { get; set; }
public string align { get; set; } public string align { get; set; }
public string fixed1 { get; set; } public string fixed1 { get; set; }
public bool? @fixed { get; set; }
public bool? editable { get; set; } public bool? editable { get; set; }
public bool? searchable { get; set; } public bool? searchable { get; set; }
public bool? searchRequired { get; set; } public bool? searchRequired { get; set; }
@ -147,6 +160,7 @@ public class TableColumn1
public string filterable { get; set; } public string filterable { get; set; }
public int width { get; set; } public int width { get; set; }
public string align { get; set; } public string align { get; set; }
public bool? @fixed { get; set; }
public string fixed1 { get; set; } public string fixed1 { get; set; }
public string editable { get; set; } public string editable { get; set; }
public string searchable { get; set; } public string searchable { get; set; }

@ -1,4 +1,5 @@
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
using SqlSugar.Extensions;
using System.Text.RegularExpressions; using System.Text.RegularExpressions;
namespace Tiobon.Core.Services; namespace Tiobon.Core.Services;
@ -784,7 +785,7 @@ public partial class CommonServices : BaseServices<RootEntityTkey<int>>, ICommon
sql = @"select pageColumnID,elementType, field,label,meky, multipleSelect, dataType, sql = @"select pageColumnID,elementType, field,label,meky, multipleSelect, dataType,
required, palceholder, dataSourceType,dataSource, sortable, sortOrder, required, palceholder, dataSourceType,dataSource, sortable, sortOrder,
defaultHidden, ConfigIsShow, filterable, width,align, fixed,editable, searchable, defaultHidden, ConfigIsShow, filterable, width,align,fixed fixed1,editable, searchable,
searchRequired,searchColumnSeq, multipleSearchValue, maxTagCount, searchRequired,searchColumnSeq, multipleSearchValue, maxTagCount,
selfDefine, selectUI, isPrimaryKey,isSorted,isHidden,isSearched,sortNo, selfDefine, selectUI, isPrimaryKey,isSorted,isHidden,isSearched,sortNo,
( select ParaDetailNo operator, ( select ParaDetailNo operator,
@ -805,6 +806,7 @@ public partial class CommonServices : BaseServices<RootEntityTkey<int>>, ICommon
result.JM_TableColumnT1.TableColumn = result.JM_TableColumnT1.TableColumn.Where(x => x.field != "DetailYN" && x.field != "Muti").ToList(); result.JM_TableColumnT1.TableColumn = result.JM_TableColumnT1.TableColumn.Where(x => x.field != "DetailYN" && x.field != "Muti").ToList();
result.JM_TableColumnT1.TableColumn.ForEach(x => result.JM_TableColumnT1.TableColumn.ForEach(x =>
{ {
if (x.fixed1.IsNotEmptyOrNull()) x.@fixed = x.fixed1.ObjToBool();
if (!string.IsNullOrWhiteSpace(x.searchOperator1)) if (!string.IsNullOrWhiteSpace(x.searchOperator1))
x.searchOperator = JsonConvert.DeserializeObject<List<searchOperator>>(x.searchOperator1); x.searchOperator = JsonConvert.DeserializeObject<List<searchOperator>>(x.searchOperator1);
x.searchOperator1 = null; x.searchOperator1 = null;
@ -2383,6 +2385,40 @@ public partial class CommonServices : BaseServices<RootEntityTkey<int>>, ICommon
sort = column.SortNo; sort = column.SortNo;
result.JM_TableColumnT1.TableColumn = result.JM_TableColumnT1.TableColumn.Where(x => x.field != "Title_A01").ToList(); result.JM_TableColumnT1.TableColumn = result.JM_TableColumnT1.TableColumn.Where(x => x.field != "Title_A01").ToList();
var titles = await Db.Queryable<Ghra_Title>().OrderBy(x => x.SortNo).ToListAsync(); var titles = await Db.Queryable<Ghra_Title>().OrderBy(x => x.SortNo).ToListAsync();
if (param.jsonParam1 != null)
foreach (JProperty jProperty in param.jsonParam1.Properties())
{
var name = jProperty.Name;
var value = jProperty.Value.ToString();
if (name == "page" || name == "pageSize")
continue;
if (value.IsNotEmptyOrNull())
{
var jsonParam = JsonHelper.JsonToObj<JsonParam>(value);
switch (name)
{
case "TitleId":
switch (jsonParam.operationKey)
{
case "Include":
if (jsonParam.columnValue != null)
titles = titles.Where(x => x.TitleID == jsonParam.columnValue.ObjToInt()).ToList();
break;
case "NotInclude":
if (jsonParam.columnValue != null)
titles = titles.Where(x => x.TitleID != jsonParam.columnValue.ObjToInt()).ToList();
break;
default:
break;
}
break;
default:
break;
}
}
}
index = 0; index = 0;
titles.ForEach(x => titles.ForEach(x =>
{ {

@ -1,4 +1,7 @@
namespace Tiobon.Core.Services; using Tiobon.Core.Common;
using static StackExchange.Redis.Role;
namespace Tiobon.Core.Services;
/// <summary> /// <summary>
/// 岗位 (服务) /// 岗位 (服务)
@ -28,7 +31,6 @@ public class Ghra_TitleServices : BaseServices<Ghra_Title, Ghra_TitleDto, Insert
dynamic obj = new ExpandoObject(); dynamic obj = new ExpandoObject();
dynamic result = new ExpandoObject(); dynamic result = new ExpandoObject();
var ruleSrc = Db.Queryable<Ghre_StudyRule>(); var ruleSrc = Db.Queryable<Ghre_StudyRule>();
if (string.IsNullOrWhiteSpace(filter.orderBy)) if (string.IsNullOrWhiteSpace(filter.orderBy))
filter.orderBy = "Type ASC"; filter.orderBy = "Type ASC";
@ -52,6 +54,7 @@ public class Ghra_TitleServices : BaseServices<Ghra_Title, Ghra_TitleDto, Insert
if (x.GradeId.IsNotEmptyOrNull()) if (x.GradeId.IsNotEmptyOrNull())
x.GradeIds = JsonHelper.JsonToObj<List<int?>>(x.GradeId); x.GradeIds = JsonHelper.JsonToObj<List<int?>>(x.GradeId);
}); });
var titles = await Db.Queryable<Ghra_Title>().OrderBy(x => x.SortNo).ToListAsync();
#region 处理查询条件 #region 处理查询条件
//Expression<Func<Ghrh_Resume, bool>> whereExpression = new Expression<Func<Ghrh_Resume, bool>>(); //Expression<Func<Ghrh_Resume, bool>> whereExpression = new Expression<Func<Ghrh_Resume, bool>>();
@ -117,10 +120,12 @@ public class Ghra_TitleServices : BaseServices<Ghra_Title, Ghra_TitleDto, Insert
case "Include": case "Include":
if (jsonParam.columnValue != null) if (jsonParam.columnValue != null)
rules = rules.Where(x => x.TitleIds.Contains(jsonParam.columnValue.ObjToInt())).ToList(); rules = rules.Where(x => x.TitleIds.Contains(jsonParam.columnValue.ObjToInt())).ToList();
titles = titles.Where(x => x.TitleID == jsonParam.columnValue.ObjToInt()).ToList();
break; break;
case "NotInclude": case "NotInclude":
if (jsonParam.columnValue != null) if (jsonParam.columnValue != null)
rules = rules.Where(x => !x.TitleIds.Contains(jsonParam.columnValue.ObjToInt())).ToList(); rules = rules.Where(x => !x.TitleIds.Contains(jsonParam.columnValue.ObjToInt())).ToList();
titles = titles.Where(x => x.TitleID != jsonParam.columnValue.ObjToInt()).ToList();
break; break;
case "IsNull": case "IsNull":
rules = rules.Where(x => x.TitleIds.Count == 0).ToList(); rules = rules.Where(x => x.TitleIds.Count == 0).ToList();
@ -187,6 +192,22 @@ public class Ghra_TitleServices : BaseServices<Ghra_Title, Ghra_TitleDto, Insert
rules = rules.Where(x => x.CourseId != jsonParam.columnValue.ObjToLong()).ToList(); rules = rules.Where(x => x.CourseId != jsonParam.columnValue.ObjToLong()).ToList();
sql += $" AND Id !={jsonParam.columnValue}"; sql += $" AND Id !={jsonParam.columnValue}";
break;
case "EqualAny"://
if (jsonParam.columnValue != null)
{
var ids1 = JsonHelper.JsonToObj<List<string>>(jsonParam.columnValue.ToString());
sql += $" AND Id IN ({string.Join(",", ids1.Select(id => "'" + id + "'"))})";
}
break;
case "NotEqualAny"://
if (jsonParam.columnValue != null)
{
var ids1 = JsonHelper.JsonToObj<List<string>>(jsonParam.columnValue.ToString());
sql += $" AND ( Id NOT IN ({string.Join(",", ids1.Select(id => "'" + id + "'"))}) OR {name} IS NULL)";
}
break; break;
default: default:
break; break;
@ -212,7 +233,8 @@ public class Ghra_TitleServices : BaseServices<Ghra_Title, Ghra_TitleDto, Insert
ModuleParam param = new ModuleParam() ModuleParam param = new ModuleParam()
{ {
langId = filter.langId, langId = filter.langId,
menuName = filter.menuName menuName = filter.menuName,
jsonParam1 = filter.jsonParam
}; };
var module = await _commonServices.GetModuleInfoAsync(param); var module = await _commonServices.GetModuleInfoAsync(param);
var result1 = new ServicePageResult<TitleSkillMatrix>(filter.pageNum, totalCount, filter.pageSize, list); var result1 = new ServicePageResult<TitleSkillMatrix>(filter.pageNum, totalCount, filter.pageSize, list);
@ -220,7 +242,6 @@ public class Ghra_TitleServices : BaseServices<Ghra_Title, Ghra_TitleDto, Insert
var columns = new JArray(); var columns = new JArray();
var titles = await Db.Queryable<Ghra_Title>().OrderBy(x => x.SortNo).ToListAsync();
var dict = new Dictionary<string, List<int>>(); var dict = new Dictionary<string, List<int>>();

@ -1,4 +1,5 @@
using MathNet.Numerics.Distributions; using Google.Protobuf.WellKnownTypes;
using MathNet.Numerics.Distributions;
using Tiobon.Core.Common; using Tiobon.Core.Common;
namespace Tiobon.Core.Services; namespace Tiobon.Core.Services;
@ -231,6 +232,14 @@ public class Ghre_SurveyServices : BaseServices<Ghre_Survey, Ghre_SurveyDto, Ins
case "Multiple": case "Multiple":
case "MultipleScore": case "MultipleScore":
question.Value1 = recordOptions.Where(x => x.SurveyQuestionId == question.Id).Select(x => x.OptionContent).ToList(); question.Value1 = recordOptions.Where(x => x.SurveyQuestionId == question.Id).Select(x => x.OptionContent).ToList();
if (question.Options.Where(x => question.Value1.Contains(x.OptionNo) && x.IsOther == true).Any())
question.Options.ForEach(o =>
{
if (question.Value1.Contains(o.OptionNo) && o.IsOther == true)
o.OtherContent = recordOptions.Where(x => x.SurveyQuestionId == question.Id && x.SurveyQuestionOptionId == o.Id)
.Select(x => x.Reverse1).FirstOrDefault() ?? "";
});
break; break;
case "Single": case "Single":
@ -238,8 +247,13 @@ public class Ghre_SurveyServices : BaseServices<Ghre_Survey, Ghre_SurveyDto, Ins
case "SingleScore": case "SingleScore":
case "Rate": case "Rate":
case "Scale": case "Scale":
question.Value = recordOptions.Where(x => x.SurveyQuestionId == question.Id).Select(x => x.OptionContent).Any() ? recordOptions.Where(x => x.SurveyQuestionId == question.Id).Select(x => x.OptionContent).FirstOrDefault() : ""; question.Value = recordOptions.Where(x => x.SurveyQuestionId == question.Id).Select(x => x.OptionContent).FirstOrDefault() ?? "";
if (question.Options.Where(x => x.OptionNo == question.Value && x.IsOther == true).Any())
question.Options.ForEach(o =>
{
if (o.OptionNo == question.Value && o.IsOther == true)
o.OtherContent = recordOptions.Where(x => x.SurveyQuestionId == question.Id).Select(x => x.Reverse1).FirstOrDefault() ?? "";
});
break; break;
default: default:
@ -314,19 +328,45 @@ public class Ghre_SurveyServices : BaseServices<Ghre_Survey, Ghre_SurveyDto, Ins
StaffId = App.User.StaffId, StaffId = App.User.StaffId,
Score = 0 Score = 0
}; };
option1.SurveyQuestionOptionId = question.Options.Where(x => x.OptionNo == question.Value1[j]).FirstOrDefault()?.Id;
var questionOption1 = question.Options.Where(x => x.OptionNo == question.Value1[j]).FirstOrDefault();
option1.SurveyQuestionOptionId = questionOption1?.Id;
option1.OptionContent = question.Value1[j]; option1.OptionContent = question.Value1[j];
if (questionOption1.IsOther == true)
option1.Reverse1 = questionOption1.OtherContent;
await Db.Insertable(option1).ExecuteReturnSnowflakeIdAsync(); await Db.Insertable(option1).ExecuteReturnSnowflakeIdAsync();
} }
break; break;
case "Single": case "Single":
case "ShortAnswer":
case "SingleScore": case "SingleScore":
var option = new Ghre_SurveyRecordOption()
{
SurveyId = id,
SurveyRecordId = recordId,
SurveyRecordDetailId = recordDetailId,
SurveyQuestionId = question.Id,
//SurveyQuestionOptionId = x.Id,
StaffId = App.User.StaffId,
Score = 0
};
var questionOption = question.Options.Where(x => x.OptionNo == question.Value).FirstOrDefault();
option.SurveyQuestionOptionId = questionOption?.Id;
option.OptionContent = question.Value;
if (questionOption.IsOther == true)
option.Reverse1 = questionOption.OtherContent;
await Db.Insertable(option).ExecuteReturnSnowflakeIdAsync();
break;
case "Rate": case "Rate":
case "Scale": case "Scale":
var option = new Ghre_SurveyRecordOption() case "ShortAnswer":
option = new Ghre_SurveyRecordOption()
{ {
SurveyId = id, SurveyId = id,
SurveyRecordId = recordId, SurveyRecordId = recordId,
@ -336,7 +376,7 @@ public class Ghre_SurveyServices : BaseServices<Ghre_Survey, Ghre_SurveyDto, Ins
StaffId = App.User.StaffId, StaffId = App.User.StaffId,
Score = 0 Score = 0
}; };
option.SurveyQuestionOptionId = question.Options.Where(x => x.OptionNo == question.Value).FirstOrDefault()?.Id;
option.OptionContent = question.Value; option.OptionContent = question.Value;
await Db.Insertable(option).ExecuteReturnSnowflakeIdAsync(); await Db.Insertable(option).ExecuteReturnSnowflakeIdAsync();

Loading…
Cancel
Save