master
xiaochanghai 6 months ago
parent b8ea65888e
commit 8f75bf331d
  1. 17
      Tiobon.Core.Services/CommonServices.cs
  2. 27
      Tiobon.Core.Services/Ghre/Ghre_QuestionServices.cs

@ -1,5 +1,6 @@
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging;
using Mysqlx.Expr;
using System.Text.RegularExpressions; using System.Text.RegularExpressions;
namespace Tiobon.Core.Services; namespace Tiobon.Core.Services;
@ -8,10 +9,12 @@ public partial class CommonServices : BaseServices<RootEntityTkey<int>>, ICommon
{ {
IHttpContextAccessor _httpContextAccessor; IHttpContextAccessor _httpContextAccessor;
ILogger<PayServices> _logger; ILogger<PayServices> _logger;
public CommonServices(ILogger<PayServices> logger, IHttpContextAccessor httpContextAccessor) public ICaching _caching;
public CommonServices(ILogger<PayServices> logger, IHttpContextAccessor httpContextAccessor, ICaching caching = null)
{ {
_logger = logger; _logger = logger;
_httpContextAccessor = httpContextAccessor; _httpContextAccessor = httpContextAccessor;
_caching = caching;
} }
#region 获取菜单 #region 获取菜单
@ -1929,7 +1932,7 @@ public partial class CommonServices : BaseServices<RootEntityTkey<int>>, ICommon
if (toolbar != null) toolbar.fnKey = "TBD4YN"; if (toolbar != null) toolbar.fnKey = "TBD4YN";
result.DT_Procedure.ExportExcel = "/api/Ghrh_HumanRequest/ExportCompleteExcel"; result.DT_Procedure.ExportExcel = "/api/Ghrh_HumanRequest/ExportCompleteExcel";
var name2 = await QueryLangValue("F_ResumeMaintenance_0226", "编制内"); var name2 = await QueryLangValue("F_ResumeMaintenance_0226", "编制内");
var name3 = await QueryLangValue("F_ResumeMaintenance_0227", "编制外"); var name3 = await QueryLangValue("F_ResumeMaintenance_0227", "编制外");
result.JM_TableColumnT1.TableColumn?.ForEach(x => result.JM_TableColumnT1.TableColumn?.ForEach(x =>
@ -1947,12 +1950,14 @@ public partial class CommonServices : BaseServices<RootEntityTkey<int>>, ICommon
} }
}); });
result.JM_TableColumnT1.TableColumn = result.JM_TableColumnT1.TableColumn.OrderBy(x => x.SortNo).ToList(); result.JM_TableColumnT1.TableColumn = result.JM_TableColumnT1.TableColumn.OrderBy(x => x.SortNo).ToList();
break; break;
} }
#endregion #endregion
result.DT_PageMutiMsg = await _caching.GetAsync<List<DT_PageMutiMsg>>(param.menuName + "_DT_PageMutiMsg");
#region 多语返回处理 #region 多语返回处理
if (param.menuName == "F_ResumeMaintenance_All" || if (param.menuName == "F_ResumeMaintenance_All" ||
param.menuName == "F_ResumeMaintenance_Process" || param.menuName == "F_ResumeMaintenance_Process" ||
@ -1986,7 +1991,11 @@ public partial class CommonServices : BaseServices<RootEntityTkey<int>>, ICommon
} }
#endregion #endregion
result.DT_PageMutiMsg = Db.Ado.SqlQuery<DT_PageMutiMsg>(sqlLang); if (result.DT_PageMutiMsg is null)
{
result.DT_PageMutiMsg = Db.Ado.SqlQuery<DT_PageMutiMsg>(sqlLang);
await _caching.SetAsync(param.menuName + "_DT_PageMutiMsg", result.DT_PageMutiMsg, TimeSpan.FromMinutes(5));
}
return new ServiceResult<ModuleReturn>() { Success = true, Message = "查询成功", Data = result, }; return new ServiceResult<ModuleReturn>() { Success = true, Message = "查询成功", Data = result, };
} }

@ -908,7 +908,24 @@ public class Ghre_QuestionServices : BaseServices<Ghre_Question, Ghre_QuestionDt
if (string.IsNullOrEmpty(questionContent)) if (string.IsNullOrEmpty(questionContent))
comments.Add("题目内容为必填项!"); comments.Add("题目内容为必填项!");
var question = await base.Query(x => x.QuestionContent == questionContent && x.QuestionType == questionType); if (courseName.IsNullOrEmpty())
{
comments.Add("课程为必填项!");
continue;
}
Ghre_CourseDto course = null;
if (!string.IsNullOrEmpty(courseName))
{
course = await _ghre_CourseServices.QuerySingleDto(x => x.CourseName == courseName);
if (course is null)
{
comments.Add("课程不存在,请修正!");
continue;
}
}
var question = await base.Query(x => x.QuestionContent == questionContent && x.QuestionType == questionType && x.CourseId == course.Id);
if (!question.Any()) if (!question.Any())
{ {
@ -921,14 +938,6 @@ public class Ghre_QuestionServices : BaseServices<Ghre_Question, Ghre_QuestionDt
if (string.IsNullOrWhiteSpace(questionAnalysis)) if (string.IsNullOrWhiteSpace(questionAnalysis))
comments.Add("题目解析必填!"); comments.Add("题目解析必填!");
Ghre_CourseDto course = null;
if (!string.IsNullOrEmpty(courseName))
{
course = await _ghre_CourseServices.QuerySingleDto(x => x.CourseName == courseName);
if (course is null)
comments.Add("课程不存在,请修正!");
}
var insert = new InsertGhre_QuestionInput() var insert = new InsertGhre_QuestionInput()
{ {
CourseId = course?.Id, CourseId = course?.Id,

Loading…
Cancel
Save