小程序接口、培训计划界面调优

This commit is contained in:
2025-03-05 17:00:55 +08:00
parent e975ddbf1d
commit 02ba872cee
20 changed files with 422 additions and 1637 deletions
@@ -13,20 +13,21 @@ namespace WebAPI.Controllers
/// </summary>
public class TrainingTaskController : ApiController
{
#region ProjectIdPersonId获取培训任务教材明细列表
#region ProjectIdPersonId获取培训任务列表
/// <summary>
/// 根据ProjectId、PersonId获取培训任务教材明细列表
/// </summary>
/// <param name="projectId"></param>
/// <param name="personId"></param>
/// <param name="pageIndex">1-培训中;2-已完成</param>
/// <param name="isRetakeCourse">是否重修:1:重修任务</param>
/// <param name="pageIndex">页码</param>
/// <returns></returns>
public Model.ResponeData getTrainingTaskListByProjectIdPersonId(string projectId, string personId, int pageIndex)
public Model.ResponeData getTrainingTaskListByProjectIdPersonId(string projectId, string personId, string isRetakeCourse, int pageIndex)
{
var responeData = new Model.ResponeData();
try
{
var getQualityLists = APITrainingTaskService.getTrainingTaskListByProjectIdPersonId(projectId, personId);
var getQualityLists = APITrainingTaskService.getTrainingTaskListByProjectIdPersonId(projectId, personId, isRetakeCourse);
int pageCount = getQualityLists.Count;
if (pageCount > 0 && pageIndex > 0)
{
@@ -128,6 +129,14 @@ namespace WebAPI.Controllers
}
#endregion
/// <summary>
/// 维护任务学习时长
/// </summary>
/// <param name="taskItemId"></param>
/// <param name="startTime"></param>
/// <param name="endTime"></param>
/// <param name="VideoProgress"></param>
/// <returns></returns>
[HttpGet]
public Model.ResponeData updateTaskItemLearnTime(string taskItemId, DateTime startTime, DateTime endTime, string VideoProgress)
{
@@ -1,24 +1,55 @@
using BLL;
using Model;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web.Http;
using SgManager.AI;
using System.Configuration;
using Newtonsoft.Json.Linq;
using Newtonsoft.Json;
using Aspose.Words;
using Microsoft.Office.Interop.Excel;
using System.Net;
using System.Web.Http.Results;
namespace WebAPI.Controllers
{
/// <summary>
///
/// 人员信息
/// </summary>
public class PersonController : ApiController
{
#region personid获取人员档案基本信息
/// <summary>
/// 根据personid获取人员档案基本信息
/// </summary>
/// <param name="personId"></param>
/// <returns></returns>
public Model.ResponeData getPersonInfoByPersonId(string personId)
{
var responeData = new Model.ResponeData();
try
{
var personData = APIPersonService.getPersonByPersonId(personId);
PersonInfoItem data = new PersonInfoItem();
data.PersonId = personData.PersonId;
data.PersonName = personData.PersonName;
data.SexName = personData.SexName;
data.IdentityCard = personData.IdentityCard;
data.Telephone = personData.Telephone;
data.UnitName = personData.UnitName;
data.TeamGroupName = personData.TeamGroupName;
data.WorkPostName = personData.WorkPostName;
data.InTime = personData.InTime;
data.PhotoUrl = personData.PhotoUrl;
//获取用户本年HSE分值、培训学时(待处理)
data.HSEScore = 0;
data.LearnHour = 0;
responeData.data = data;
}
catch (Exception ex)
{
responeData.code = 0;
responeData.message = ex.Message;
}
return responeData;
}
#endregion
#region personid获取人员信息
/// <summary>
/// 根据personid获取人员信息
@@ -37,7 +68,6 @@ namespace WebAPI.Controllers
responeData.code = 0;
responeData.message = ex.Message;
}
return responeData;
}
#endregion
@@ -462,10 +492,10 @@ namespace WebAPI.Controllers
if (getPerson != null && getPerson.PersonId != person.PersonId && !string.IsNullOrEmpty(person.PersonId))
{
getPerson.InTime = Funs.GetNewDateTime(person.InTime);
getPerson.OutTime = Funs.GetNewDateTime(person.OutTime);
if (!string.IsNullOrEmpty(person.TeamGroupId))
{
getPerson.TeamGroupId = person.TeamGroupId;
@@ -502,7 +532,7 @@ namespace WebAPI.Controllers
getPerson.WorkPostId = post.WorkPostId;
}
}
if (person.IsUsed == true)
{
getPerson.IsUsed = true;
@@ -683,12 +713,12 @@ namespace WebAPI.Controllers
/// <param name="personId"></param>
/// <returns></returns>
[HttpGet]
public Model.ResponeData getPersonPresenceData(string projectId,DateTime date)
public Model.ResponeData getPersonPresenceData(string projectId, DateTime date)
{
var responeData = new Model.ResponeData();
try
{
responeData.data= APIPersonService.getPersonPresenceData(projectId, date);
responeData.data = APIPersonService.getPersonPresenceData(projectId, date);
}
catch (Exception ex)
{
@@ -814,8 +844,8 @@ namespace WebAPI.Controllers
x.ExchangeTime,
x.ExchangeTime2,
x.PhotoUrl,
IsUsed = x.IsUsed?1:0,
BlackList = x.BlackList.HasValue&& x.BlackList.Value ? 1 : 0
IsUsed = x.IsUsed ? 1 : 0,
BlackList = x.BlackList.HasValue && x.BlackList.Value ? 1 : 0
};
}
catch (Exception ex)
@@ -835,7 +865,7 @@ namespace WebAPI.Controllers
responeData.data = from x in Funs.DB.SitePerson_Person
join y in Funs.DB.Base_Unit on x.UnitId equals y.UnitId
where x.BlackList == null || x.BlackList == false
where x.ProjectId == projectId
where x.ProjectId == projectId
&& (!x.OutTime.HasValue || x.OutTime > DateTime.Now) && x.InTime.HasValue && x.InTime < DateTime.Now
&& x.IsUsed == true
&& x.PhotoUrl != null
@@ -877,8 +907,8 @@ namespace WebAPI.Controllers
try
{
responeData.data = from x in Funs.DB.SitePerson_Person
join y in Funs.DB.Base_Unit on x.UnitId equals y.UnitId
where x.ProjectId == projectId
join y in Funs.DB.Base_Unit on x.UnitId equals y.UnitId
where x.ProjectId == projectId
select new
{
x.PersonId,
@@ -1126,6 +1156,6 @@ namespace WebAPI.Controllers
#endregion
}
}
+30 -30
View File
@@ -75,41 +75,41 @@ namespace WebAPI.Filter
//}
//&& !System.Web.HttpContext.Current.User.Identity.IsAuthenticated
if (isOk && lists.FirstOrDefault(x => x == strValues) == null && actionContext.ActionDescriptor.ControllerDescriptor.ControllerName != "FileUpload")
{
isOk = false;
actionContext.Response = actionContext.Request.CreateResponse(System.Net.HttpStatusCode.OK,
new { code = "0", message = "登录超出,请重新登录!" }, actionContext.ControllerContext.Configuration.Formatters.JsonFormatter);
//if (isOk && lists.FirstOrDefault(x => x == strValues) == null && actionContext.ActionDescriptor.ControllerDescriptor.ControllerName != "FileUpload")
//{
// isOk = false;
// actionContext.Response = actionContext.Request.CreateResponse(System.Net.HttpStatusCode.OK,
// new { code = "0", message = "登录超出,请重新登录!" }, actionContext.ControllerContext.Configuration.Formatters.JsonFormatter);
}
//}
//base.OnActionExecuting(actionContext);
if (isOk)
{
if (!isWithOut)
{
// 在调用 Action 方法之前执行的代码,可获取请求的接口名称和参数
IDictionary<string, object> arguments = actionContext.ActionArguments; // 获取参数
foreach (KeyValuePair<string, object> item in arguments)
{
if (item.Key.ToLower() == "projectid")
{
var ProjectItems = APIProjectService.geProjectsByUserId(token.FirstOrDefault());
List<string> projects = new List<string>();
if (ProjectItems.Count > 0)
{
projects = ProjectItems.Select(x => x.ProjectId).ToList();
}
if (item.Value != null && !projects.Contains(item.Value.ToString()))
{
//if (!isWithOut)
//{
// // 在调用 Action 方法之前执行的代码,可获取请求的接口名称和参数
// IDictionary<string, object> arguments = actionContext.ActionArguments; // 获取参数
// foreach (KeyValuePair<string, object> item in arguments)
// {
// if (item.Key.ToLower() == "projectid")
// {
// var ProjectItems = APIProjectService.geProjectsByUserId(token.FirstOrDefault());
// List<string> projects = new List<string>();
// if (ProjectItems.Count > 0)
// {
// projects = ProjectItems.Select(x => x.ProjectId).ToList();
// }
// if (item.Value != null && !projects.Contains(item.Value.ToString()))
// {
actionContext.Response = actionContext.Request.CreateResponse(System.Net.HttpStatusCode.OK,
new { code = "0", message = "您没有该项目权限!" }, actionContext.ControllerContext.Configuration.Formatters.JsonFormatter);
return;
}
}
}
}
// actionContext.Response = actionContext.Request.CreateResponse(System.Net.HttpStatusCode.OK,
// new { code = "0", message = "您没有该项目权限!" }, actionContext.ControllerContext.Configuration.Formatters.JsonFormatter);
// return;
// }
// }
// }
//}
base.OnActionExecuting(actionContext);
}
else
@@ -120,7 +120,7 @@ namespace WebAPI.Filter
}
/// <summary>
///
/// 授权接口
/// </summary>
public static List<string> lists = new List<string>
{
@@ -10,7 +10,7 @@ https://go.microsoft.com/fwlink/?LinkID=208121.
<LastUsedBuildConfiguration>Release</LastUsedBuildConfiguration>
<LastUsedPlatform>Any CPU</LastUsedPlatform>
<PublishProvider>FileSystem</PublishProvider>
<PublishUrl>D:\发布</PublishUrl>
<PublishUrl>G:\发布\新疆油建WebApi</PublishUrl>
<WebPublishMethod>FileSystem</WebPublishMethod>
<_TargetId>Folder</_TargetId>
<SiteUrlToLaunchAfterPublish />
+1 -1
View File
@@ -228,7 +228,7 @@
<Compile Include="Controllers\IDCardController.cs" />
<Compile Include="Controllers\FileUploadController.cs" />
<Compile Include="Controllers\HomeController.cs" />
<Compile Include="Controllers\PersonController.cs" />
<Compile Include="Controllers\Person\PersonController.cs" />
<Compile Include="Controllers\ProjectController.cs" />
<Compile Include="Controllers\SYHSE\SYController.cs" />
<Compile Include="Controllers\ToDoItemController.cs" />