1、题库 添加知识点查看属性 ignore
2、子公司从总部同步试题 3、获取总部数据时 添加排序
This commit is contained in:
parent
535248baa9
commit
1b275eb6d5
@ -10922,6 +10922,7 @@ builder.Property(t => t.OPTION_C).HasMaxLength(500);
|
||||
builder.Property(t => t.OPTION_D).HasMaxLength(500);
|
||||
builder.Property(t => t.OPTION_E).HasMaxLength(500);
|
||||
builder.Ignore(t => t.ANSWERSHOW);
|
||||
builder.Ignore(t => t.STRPOINT);
|
||||
builder.Property(t => t.TRAINNAME).HasMaxLength(500);
|
||||
builder.Property(t => t.MineType).HasMaxLength(500);
|
||||
}
|
||||
@ -13101,6 +13102,7 @@ builder.Property(t => t.CHECK_STANDARD).HasMaxLength(500);
|
||||
base.Configure(builder);
|
||||
builder.HasOne(t => t.Nav_DetailContent).WithMany(t=>t.Nav_DetailBasics).HasForeignKey(t => t.BASIC_LIBRARY_DETAIL_CONTENT_ID).OnDelete(DeleteBehavior.Restrict);
|
||||
builder.HasOne(t => t.Nav_Law).WithMany().HasForeignKey(t => t.LAW_ID).OnDelete(DeleteBehavior.Restrict);
|
||||
builder.Ignore(t => t.CHECK_CONTENTS_ID);
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
@ -13114,6 +13116,7 @@ builder.HasOne(t => t.Nav_Law).WithMany().HasForeignKey(t => t.LAW_ID).OnDelete(
|
||||
builder.HasOne(t => t.Nav_Question).WithMany().HasForeignKey(t => t.CHECK_QUESTION_ID).OnDelete(DeleteBehavior.Restrict);
|
||||
builder.Property(t => t.HIDDEN_DESCRIPTION).HasMaxLength(500);
|
||||
builder.Property(t => t.RECTIFICATION_MEASURES).HasMaxLength(500);
|
||||
builder.Ignore(t => t.CHECK_CONTENTS_ID);
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
@ -13236,6 +13239,8 @@ builder.Property(t => t.DEMAND).HasMaxLength(500);
|
||||
builder.Ignore(t => t.QUESTION_LEVEL_SHOW);
|
||||
builder.Ignore(t => t.CHECKCONTENT);
|
||||
builder.Ignore(t => t.PRODUCTION_UNIT_ID);
|
||||
builder.Ignore(t => t.CHECK_BASICS);
|
||||
builder.Ignore(t => t.CHECK_STANDARD);
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
@ -119,6 +119,14 @@ namespace APT.MS.Domain.Entities.SE
|
||||
[Description("知识点")]
|
||||
[FormFieldEdit]
|
||||
public List<T_SE_TEST_LIST_POINT> Nav_Points { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 知识点
|
||||
/// </summary>
|
||||
[Description("知识点")]
|
||||
[DataFieldIngore]
|
||||
public string STRPOINT { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 培训名称
|
||||
/// </summary>
|
||||
@ -136,5 +144,6 @@ namespace APT.MS.Domain.Entities.SE
|
||||
[FormFieldQuery]
|
||||
[FormFieldEdit]
|
||||
public string MineType { get; set; }
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -428,8 +428,9 @@ namespace APT.LR.WebApi.Controllers.Api
|
||||
}
|
||||
}
|
||||
}
|
||||
//pageFilter.SelectField.ToArray()
|
||||
PagedResultDto<T_LR_LAW> data = context.GetOrderPageEntities(expression, null, null, pageFilter.Limit, pageFilter.Start, pageFilter.Include.ToArray());
|
||||
Dictionary<string, DbOrder> orders = new Dictionary<string, DbOrder>();
|
||||
orders.Add("CREATE_TIME", DbOrder.DESC);
|
||||
PagedResultDto<T_LR_LAW> data = context.GetOrderPageEntities(expression, orders, null, pageFilter.Limit, pageFilter.Start, pageFilter.Include.ToArray());
|
||||
result.TotalCount = data.TotalCount;
|
||||
result.Data = data.Items;
|
||||
List<Guid> ListLawID = null;
|
||||
@ -570,6 +571,10 @@ namespace APT.LR.WebApi.Controllers.Api
|
||||
|
||||
foreach (var item in Nav_LawType)
|
||||
{
|
||||
modelCheckType = listLawType.FirstOrDefault(e => e.ID == item.ID);
|
||||
if (modelCheckType != null)//如果已经有这种检查类型 直接跳过
|
||||
continue;
|
||||
|
||||
if (listLawTypeData != null && listLawTypeData.Count() > 0)
|
||||
{
|
||||
modelCheckType = listLawTypeData.FirstOrDefault(e => e.ID == item.ID);
|
||||
|
||||
@ -14,12 +14,22 @@ using APT.BaseData.Domain.Entities.FM;
|
||||
using Castle.Core.Internal;
|
||||
using static APT.SC.WebApi.Controllers.Api.BI.BIController;
|
||||
using Microsoft.AspNetCore.DataProtection;
|
||||
using APT.BaseData.Domain.Enums.PF;
|
||||
using APT.BaseData.Domain.IServices.OP;
|
||||
using APT.Migrations;
|
||||
using System.Linq.Expressions;
|
||||
|
||||
namespace APT.SE.WebApi.Controllers.Api
|
||||
{
|
||||
[Route("api/SE/SETest")]
|
||||
public partial class SETestController : AuthorizeApiController<T_SE_TEST>
|
||||
{
|
||||
IOPTenantDBConnService OPTenantDBConnService { get; set; }
|
||||
public SETestController(IOPTenantDBConnService opTenantDBConnService)
|
||||
{
|
||||
OPTenantDBConnService = opTenantDBConnService;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查询
|
||||
/// </summary>
|
||||
@ -637,5 +647,279 @@ namespace APT.SE.WebApi.Controllers.Api
|
||||
Msg = "导入成功!";
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 排序分页查询数据
|
||||
/// </summary>
|
||||
/// <param name="pageFilter">分页过滤实体</param>
|
||||
/// <returns></returns>
|
||||
[HttpPost, Route("OrderPagedHead")]
|
||||
public PagedActionResult<T_SE_TEST> OrderPagedHead([FromBody] KeywordPageFilter pageFilter)
|
||||
{
|
||||
return SafeGetPagedData(delegate (PagedActionResult<T_SE_TEST> result)
|
||||
{
|
||||
string strConn = OPTenantDBConnService.GetConnByORGID(new Guid(FilePathHead.JY.GetDescription()));
|
||||
using (var context = new MigrationContext(strConn))
|
||||
{
|
||||
Expression<Func<T_SE_TEST, bool>> expression = e => !e.IS_DELETED;
|
||||
if (pageFilter.FilterGroup != null && pageFilter.FilterGroup.Rules != null && pageFilter.FilterGroup.Rules.Count() > 0)
|
||||
{
|
||||
foreach (var item in pageFilter.FilterGroup.Rules)
|
||||
{
|
||||
if (item.Field == "NAME")
|
||||
{
|
||||
expression = expression.And(e => e.NAME.Contains(item.Value.ToString()));
|
||||
}
|
||||
else if (item.Field == "TYPE" && item.Value != null)
|
||||
{
|
||||
try
|
||||
{
|
||||
SETestTypeEnum TYPE = (SETestTypeEnum)Convert.ToInt32(item.Value.ToString());
|
||||
expression = expression.And(e => e.TYPE == TYPE);
|
||||
}
|
||||
catch { }
|
||||
}
|
||||
}
|
||||
}
|
||||
Dictionary<string, DbOrder> orders = new Dictionary<string, DbOrder>();
|
||||
orders.Add("CREATE_TIME", DbOrder.DESC);
|
||||
PagedResultDto<T_SE_TEST> data = context.GetOrderPageEntities(expression, orders, null, pageFilter.Limit, pageFilter.Start, "Nav_Points.Nav_Point");
|
||||
result.TotalCount = data.TotalCount;
|
||||
result.Data = data.Items;
|
||||
foreach (var item in result.Data)
|
||||
{
|
||||
if (item.TYPE == SETestTypeEnum.是非题)
|
||||
{
|
||||
item.OPTION_A = "正确";
|
||||
item.OPTION_B = "错误";
|
||||
}
|
||||
item.ANSWERSHOW = GetAnswerShow(item.ANSWER);
|
||||
if (item.Nav_Points != null && item.Nav_Points.Count() > 0)
|
||||
{
|
||||
item.STRPOINT = string.Join(',', item.Nav_Points.Select(e => e.Nav_Point.NAME));
|
||||
}
|
||||
else
|
||||
{
|
||||
item.STRPOINT = "";
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 位掩码 根据答案获取显示
|
||||
/// </summary>
|
||||
/// <param name="ANSWER"></param>
|
||||
/// <param name="maxOption"></param>
|
||||
/// <returns></returns>
|
||||
private string GetAnswerShow(int ANSWER, int maxOption = 32)
|
||||
{
|
||||
List<int> select = new List<int>();
|
||||
int value = 1;
|
||||
while (value <= ANSWER && value <= maxOption)
|
||||
{
|
||||
if ((ANSWER & value) != 0)
|
||||
{
|
||||
select.Add(value);
|
||||
}
|
||||
value *= 2;
|
||||
}
|
||||
string answer = string.Join(",", select);
|
||||
return answer.Replace("1", "A").Replace("2", "B").Replace("4", "C").Replace("8", "D");
|
||||
}
|
||||
/// <summary>
|
||||
/// 集团法律法规同步到本地
|
||||
/// </summary>
|
||||
/// <param name="list"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost, Route("SyncToLocal")]
|
||||
public JsonActionResult<bool> SyncToLocal([FromBody] SyscList list)
|
||||
{
|
||||
return SafeExecute<bool>(() =>
|
||||
{
|
||||
var listText = list.ListModel;
|
||||
if (listText == null || listText.Count < 1)
|
||||
{
|
||||
throw new Exception("请选择题目后再提交!");
|
||||
}
|
||||
|
||||
Guid? LoginID = APT.Infrastructure.Api.AppContext.CurrentSession.UserID;
|
||||
Guid? OrgID = APT.Infrastructure.Api.AppContext.CurrentSession.OrgId;
|
||||
DateTime dtNow = DateTime.Now.Date;
|
||||
|
||||
List<T_SE_TEST_LIST_POINT> listPoint = new List<T_SE_TEST_LIST_POINT>();
|
||||
List<T_SE_TEST_ENUM_POINT> listPointEnum = new List<T_SE_TEST_ENUM_POINT>();
|
||||
|
||||
IEnumerable<T_SE_TEST> listTestData = null;
|
||||
List<T_SE_TEST_LIST_POINT> listPointData = new List<T_SE_TEST_LIST_POINT>();
|
||||
List<T_SE_TEST_ENUM_POINT> listPointEnumData = new List<T_SE_TEST_ENUM_POINT>();
|
||||
|
||||
List<T_SE_TEST> listTestSync = new List<T_SE_TEST>();
|
||||
List<T_SE_TEST_LIST_POINT> listPointSync = new List<T_SE_TEST_LIST_POINT>();
|
||||
List<T_SE_TEST_ENUM_POINT> listPointEnumSync = new List<T_SE_TEST_ENUM_POINT>();
|
||||
|
||||
T_SE_TEST modelTestSync = null;
|
||||
T_SE_TEST_LIST_POINT modelPointSync = null;
|
||||
T_SE_TEST_ENUM_POINT modelPointEnumSync = null;
|
||||
|
||||
#region 获取入参数据 和 获取 入参对应数据库数据
|
||||
|
||||
foreach (var item in list.ListModel)
|
||||
if (item.Nav_Points != null && item.Nav_Points.Count() > 0)
|
||||
listPoint.AddRange(item.Nav_Points);
|
||||
|
||||
if (listPoint != null && listPoint.Count > 0)
|
||||
{
|
||||
foreach (var item in listPoint)
|
||||
{
|
||||
if (!item.POINT_ID.HasValue)
|
||||
continue;
|
||||
modelPointEnumSync = listPointEnum.FirstOrDefault(e => e.ID == item.POINT_ID.Value);
|
||||
if (modelPointEnumSync == null)
|
||||
listPointEnum.Add(item.Nav_Point);
|
||||
}
|
||||
}
|
||||
|
||||
var listTestID = listText.Select(e => e.ID);
|
||||
listTestData = GetEntities<T_SE_TEST>(e => listTestID.Contains(e.ID), null, "Nav_Points.Nav_Point");
|
||||
foreach (var item in listTestData)
|
||||
{
|
||||
if (item.Nav_Points != null && item.Nav_Points.Count > 0)
|
||||
listPointData.AddRange(item.Nav_Points);
|
||||
}
|
||||
if (listPointData != null && listPointData.Count > 0)
|
||||
foreach (var item in listPointData)
|
||||
listPointEnumData.Add(item.Nav_Point);
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
#region 数据判断处理
|
||||
|
||||
foreach (var item in listText)
|
||||
{
|
||||
modelTestSync = listTestData.FirstOrDefault(e => e.ID == item.ID);
|
||||
if (modelTestSync == null)
|
||||
{
|
||||
item.CREATER_ID = LoginID;
|
||||
item.CREATE_TIME = dtNow;
|
||||
}
|
||||
listTestSync.Add(item);
|
||||
}
|
||||
|
||||
foreach (var item in listPoint)
|
||||
{
|
||||
if (listPointData != null && listPointData.Count() > 0)
|
||||
{
|
||||
modelPointSync = listPointData.FirstOrDefault(e => e.ID == item.ID);
|
||||
}
|
||||
else
|
||||
{
|
||||
modelPointSync = null;
|
||||
}
|
||||
if (modelPointSync == null)
|
||||
{
|
||||
item.CREATER_ID = LoginID;
|
||||
item.CREATE_TIME = dtNow;
|
||||
}
|
||||
listPointSync.Add(item);
|
||||
}
|
||||
|
||||
foreach (var item in listPointEnum)
|
||||
{
|
||||
if (listPointEnumData != null && listPointEnumData.Count() > 0)
|
||||
{
|
||||
modelPointEnumSync = listPointEnumData.FirstOrDefault(e => e.ID == item.ID);
|
||||
}
|
||||
else
|
||||
{
|
||||
modelPointEnumSync = null;
|
||||
}
|
||||
if (modelPointEnumSync == null)
|
||||
{
|
||||
item.CREATER_ID = LoginID;
|
||||
item.CREATE_TIME = dtNow;
|
||||
}
|
||||
listPointEnumSync.Add(item);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region 数据统一处理 CREATE_TIME MODIFY_TIME MODIFIER_ID
|
||||
|
||||
if (listTestSync != null && listTestSync.Count() > 0)
|
||||
{
|
||||
foreach (var item in listTestSync)
|
||||
{
|
||||
item.Nav_Points = null;
|
||||
item.ORG_ID = OrgID;
|
||||
if (item.CREATER_ID == LoginID)
|
||||
{
|
||||
item.CREATE_TIME = dtNow;
|
||||
}
|
||||
item.MODIFY_TIME = dtNow;
|
||||
item.MODIFIER_ID = LoginID;
|
||||
}
|
||||
}
|
||||
|
||||
if (listPointSync != null && listPointSync.Count() > 0)
|
||||
{
|
||||
foreach (var item in listPointSync)
|
||||
{
|
||||
item.Nav_Point = null;
|
||||
item.ORG_ID = OrgID;
|
||||
if (item.CREATER_ID == LoginID)
|
||||
{
|
||||
item.CREATE_TIME = dtNow;
|
||||
}
|
||||
item.MODIFY_TIME = dtNow;
|
||||
item.MODIFIER_ID = LoginID;
|
||||
}
|
||||
}
|
||||
|
||||
if (listPointEnumSync != null && listPointEnumSync.Count() > 0)
|
||||
{
|
||||
foreach (var item in listPointEnumSync)
|
||||
{
|
||||
item.ORG_ID = OrgID;
|
||||
if (item.CREATER_ID == LoginID)
|
||||
{
|
||||
item.CREATE_TIME = dtNow;
|
||||
}
|
||||
item.MODIFY_TIME = dtNow;
|
||||
item.MODIFIER_ID = LoginID;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region 数据处理
|
||||
|
||||
UnifiedCommit(() =>
|
||||
{
|
||||
if (listTestSync != null && listTestSync.Any())
|
||||
BantchSaveEntityNoCommit(listTestSync);
|
||||
if (listPointSync != null && listPointSync.Any())
|
||||
BantchSaveEntityNoCommit(listPointSync);
|
||||
if (listPointEnumSync != null && listPointEnumSync.Any())
|
||||
BantchSaveEntityNoCommit(listPointEnumSync);
|
||||
});
|
||||
|
||||
#endregion
|
||||
|
||||
return true;
|
||||
});
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 数据同步传参
|
||||
/// </summary>
|
||||
public class SyscList
|
||||
{
|
||||
public List<T_SE_TEST> ListModel { get; set; }//ICollection
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user