学员群里新增人员查看

master
xiaochanghai 4 months ago
parent 31cf16415f
commit 522a414da0
  1. 4
      Tiobon.Core.Api/Controllers/Ghre/Ghre_StaffGroupController.cs
  2. 6
      Tiobon.Core.IServices/Ghre/IGhre_StaffGroupServices.cs
  3. 4
      Tiobon.Core.Model/View/Ghre/Ghre_StaffGroup.Dto.View.cs
  4. 36
      Tiobon.Core.Services/BASE/BaseServices.cs
  5. 9
      Tiobon.Core.Services/CommonServices.cs
  6. 120
      Tiobon.Core.Services/Ghre/Ghre_StaffGroupServices.cs

@ -11,4 +11,8 @@ public class Ghre_StaffGroupController : BaseController<IGhre_StaffGroupServices
public Ghre_StaffGroupController(IGhre_StaffGroupServices service) : base(service) public Ghre_StaffGroupController(IGhre_StaffGroupServices service) : base(service)
{ {
} }
[HttpPost, Route("QueryStaff/{id}")]
public async Task<ServicePageResult<Ghra_StaffDto>> QueryStaff([FromBody] QueryBody body, long id) => await _service.QueryStaff(id, body, null);
} }

@ -1,8 +1,12 @@
namespace Tiobon.Core.IServices; using Tiobon.Core.Common;
using Tiobon.Core.Model;
namespace Tiobon.Core.IServices;
/// <summary> /// <summary>
/// 员工群组(自定义服务接口) /// 员工群组(自定义服务接口)
/// </summary> /// </summary>
public interface IGhre_StaffGroupServices : IBaseServices<Ghre_StaffGroup, Ghre_StaffGroupDto, InsertGhre_StaffGroupInput, EditGhre_StaffGroupInput> public interface IGhre_StaffGroupServices : IBaseServices<Ghre_StaffGroup, Ghre_StaffGroupDto, InsertGhre_StaffGroupInput, EditGhre_StaffGroupInput>
{ {
Task<ServicePageResult<Ghra_StaffDto>> QueryStaff(long id, QueryBody filter, string condition, bool? IsEnable = true);
} }

@ -35,12 +35,12 @@ public class Ghre_StaffGroupDto : Ghre_StaffGroup
/// <summary> /// <summary>
/// 直间接 /// 直间接
/// </summary> /// </summary>
public List<string> StaffType1s { get; set; } = new List<string>(); public List<int?> StaffType1s { get; set; } = new List<int?>();
/// <summary> /// <summary>
/// 用工形式 /// 用工形式
/// </summary> /// </summary>
public List<string> StaffType2s { get; set; } = new List<string>(); public List<int?> StaffType2s { get; set; } = new List<int?>();
/// <summary> /// <summary>
/// 厂区 /// 厂区

@ -1376,6 +1376,42 @@ ORDER BY SortNo ASC";
} }
return list; return list;
} }
public async Task<string> GetParaLabel(int? id)
{
string label = string.Empty;
if (id.IsNullOrEmpty())
return null;
var ParaMasterNo = DbAccess.ExecuteScalar(@$"SELECT ParaMasterNo
FROM Ghrs_ParaDetail
WHERE ParaDetailId ='{id}'");
var list = await _caching.GetAsync<List<Ghrs_ParaDetail>>(ParaMasterNo.ObjToString());
if (list == null || (list != null && !list.Any()))
{
string sql = $@"SELECT *
FROM Ghrs_ParaDetail
WHERE ParaMasterId IN (SELECT ParaMasterId
FROM Ghrs_ParaMaster
WHERE ParaMasterNo = '{ParaMasterNo}'
AND ParaTypeNo IN ('GhrStaff',
'GHRPara',
'Train',
'Resume',
'GHRAttend'))
AND IsEnable = 1
ORDER BY SortNo ASC";
list = DbAccess.QueryList<Ghrs_ParaDetail>(sql);
if (list.Any())
await _caching.SetAsync(ParaMasterNo.ObjToString(), list);
}
if (list.Any(x => x.ParaDetailId == id))
label = list.FirstOrDefault(x => x.ParaDetailId == id)?.ParaDetailName;
return label;
}
#endregion #endregion
#region 处理json查询条件 #region 处理json查询条件

@ -2059,6 +2059,15 @@ public partial class CommonServices : BaseServices<RootEntityTkey<int>>, ICommon
icon = "ghr-clear", icon = "ghr-clear",
position = "left" position = "left"
}); });
result.JM_PageControlT1.Toolbar.Add(new Toolbar()
{
display = true,
fnKey = "TBD6YN",
fnTitle = "查看人员",
fnType = "row",
icon = "ghr-preview",
position = "left"
});
break; break;
} }

@ -30,8 +30,8 @@ public class Ghre_StaffGroupServices : BaseServices<Ghre_StaffGroup, Ghre_StaffG
var exclStaffIds = new List<int>(); var exclStaffIds = new List<int>();
result.result.DT_TableDataT1.ForEach(async x => result.result.DT_TableDataT1.ForEach(async x =>
{ {
x.StaffType1s = JsonHelper.JsonToObj<List<string>>(x.StaffType1); x.StaffType1s = JsonHelper.JsonToObj<List<int?>>(x.StaffType1);
x.StaffType2s = JsonHelper.JsonToObj<List<string>>(x.StaffType2); x.StaffType2s = JsonHelper.JsonToObj<List<int?>>(x.StaffType2);
x.ZoneIds = JsonHelper.JsonToObj<List<int>>(x.ZoneId); x.ZoneIds = JsonHelper.JsonToObj<List<int>>(x.ZoneId);
x.ExclZoneIds = JsonHelper.JsonToObj<List<int>>(x.ExclZoneId); x.ExclZoneIds = JsonHelper.JsonToObj<List<int>>(x.ExclZoneId);
x.DeptIds = JsonHelper.JsonToObj<List<int>>(x.DeptId); x.DeptIds = JsonHelper.JsonToObj<List<int>>(x.DeptId);
@ -61,17 +61,19 @@ public class Ghre_StaffGroupServices : BaseServices<Ghre_StaffGroup, Ghre_StaffG
x.GroupType = await GetParaLabel("TrainingGroupType", x.GroupType); x.GroupType = await GetParaLabel("TrainingGroupType", x.GroupType);
var StaffType1s = new List<string>();
var StaffType2s = new List<string>();
for (int i = 0; i < x.StaffType1s.Count; i++) for (int i = 0; i < x.StaffType1s.Count; i++)
{ {
x.StaffType1s[i] = await GetParaLabel("StaffType1", x.StaffType1s[i]); StaffType1s.Add(await GetParaLabel(x.StaffType1s[i]));
} }
for (int i = 0; i < x.StaffType2s.Count; i++) for (int i = 0; i < x.StaffType2s.Count; i++)
{ {
x.StaffType2s[i] = await GetParaLabel("StaffType2", x.StaffType2s[i]); StaffType2s.Add(await GetParaLabel(x.StaffType2s[i]));
} }
x.StaffType1 = string.Join(",", x.StaffType1s); x.StaffType1 = string.Join(",", StaffType1s);
x.StaffType2 = string.Join(",", x.StaffType2s); x.StaffType2 = string.Join(",", StaffType2s);
}); });
@ -237,8 +239,8 @@ public class Ghre_StaffGroupServices : BaseServices<Ghre_StaffGroup, Ghre_StaffG
{ {
var result = await base.QueryForm(body); var result = await base.QueryForm(body);
var DT_TableDataT1 = result.result.DT_TableDataT1[0]; var DT_TableDataT1 = result.result.DT_TableDataT1[0];
DT_TableDataT1.StaffType1s = JsonHelper.JsonToObj<List<string>>(DT_TableDataT1.StaffType1); DT_TableDataT1.StaffType1s = JsonHelper.JsonToObj<List<int?>>(DT_TableDataT1.StaffType1);
DT_TableDataT1.StaffType2s = JsonHelper.JsonToObj<List<string>>(DT_TableDataT1.StaffType2); DT_TableDataT1.StaffType2s = JsonHelper.JsonToObj<List<int?>>(DT_TableDataT1.StaffType2);
DT_TableDataT1.ZoneIds = JsonHelper.JsonToObj<List<int>>(DT_TableDataT1.ZoneId); DT_TableDataT1.ZoneIds = JsonHelper.JsonToObj<List<int>>(DT_TableDataT1.ZoneId);
DT_TableDataT1.ExclZoneIds = JsonHelper.JsonToObj<List<int>>(DT_TableDataT1.ExclZoneId); DT_TableDataT1.ExclZoneIds = JsonHelper.JsonToObj<List<int>>(DT_TableDataT1.ExclZoneId);
DT_TableDataT1.DeptIds = JsonHelper.JsonToObj<List<int>>(DT_TableDataT1.DeptId); DT_TableDataT1.DeptIds = JsonHelper.JsonToObj<List<int>>(DT_TableDataT1.DeptId);
@ -255,4 +257,106 @@ public class Ghre_StaffGroupServices : BaseServices<Ghre_StaffGroup, Ghre_StaffG
return result; return result;
} }
public async Task<ServicePageResult<Ghra_StaffDto>> QueryStaff(long id, QueryBody filter, string condition, bool? IsEnable = true)
{
var x = await base.QueryById(id);
x.StaffType1s = JsonHelper.JsonToObj<List<int?>>(x.StaffType1);
x.StaffType2s = JsonHelper.JsonToObj<List<int?>>(x.StaffType2);
x.ZoneIds = JsonHelper.JsonToObj<List<int>>(x.ZoneId);
x.ExclZoneIds = JsonHelper.JsonToObj<List<int>>(x.ExclZoneId);
x.DeptIds = JsonHelper.JsonToObj<List<int>>(x.DeptId);
x.ExclDeptIds = JsonHelper.JsonToObj<List<int>>(x.ExclDeptId);
x.TitleIds = JsonHelper.JsonToObj<List<int>>(x.TitleId);
x.ExclTitleIds = JsonHelper.JsonToObj<List<int>>(x.ExclTitleId);
x.GradeIds = JsonHelper.JsonToObj<List<int>>(x.GradeId);
x.ExclGradeIds = JsonHelper.JsonToObj<List<int>>(x.ExclGradeId);
x.JobIds = JsonHelper.JsonToObj<List<int>>(x.JobId);
x.ExclJobIds = JsonHelper.JsonToObj<List<int>>(x.ExclJobId);
x.StaffIds = JsonHelper.JsonToObj<List<int>>(x.StaffId);
x.ExclStaffIds = JsonHelper.JsonToObj<List<int>>(x.ExclStaffId);
var query = Db.Queryable<Ghra_Staff>();
#region 处理查询条件
var whereExpression = Expressionable.Create<Ghra_Staff>();
foreach (JProperty jProperty in filter.jsonParam.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 "WaitRecommend":
// if (jsonParam.columnValue.ObjToInt() == 1)
// whereExpression.And(x => x.Status == DIC_INTERVIEW_ORDER_STATUS.WaitRecommended);
// break;
// break;
default:
break;
}
}
}
if (x.StaffType1s.Any())
whereExpression.And(o => x.StaffType1s.Contains(o.StaffType1));
if (x.StaffType2s.Any())
whereExpression.And(o => x.StaffType1s.Contains(o.StaffType2));
if (x.ZoneIds.Any())
whereExpression.And(o => o.ZoneID != null && x.ZoneIds.Contains(o.ZoneID.Value));
if (x.ExclZoneIds.Any())
whereExpression.And(o => o.ZoneID != null && x.ExclZoneIds.Contains(o.ZoneID.Value));
if (x.DeptIds.Any())
whereExpression.And(o => o.ZoneID != null && x.DeptIds.Contains(o.DeptID.Value));
if (x.ExclDeptIds.Any())
whereExpression.And(o => o.ZoneID != null && x.ExclDeptIds.Contains(o.DeptID.Value));
if (x.TitleIds.Any())
whereExpression.And(o => o.ZoneID != null && x.TitleIds.Contains(o.TitleID.Value));
if (x.ExclTitleIds.Any())
whereExpression.And(o => o.ZoneID != null && x.ExclTitleIds.Contains(o.TitleID.Value));
if (x.GradeIds.Any())
whereExpression.And(o => o.ZoneID != null && x.GradeIds.Contains(o.GradeID.Value));
if (x.ExclGradeIds.Any())
whereExpression.And(o => o.ZoneID != null && x.ExclGradeIds.Contains(o.GradeID.Value));
if (x.GradeIds.Any())
whereExpression.And(o => o.ZoneID != null && x.GradeIds.Contains(o.GradeID.Value));
if (x.ExclGradeIds.Any())
whereExpression.And(o => o.ZoneID != null && x.ExclGradeIds.Contains(o.GradeID.Value));
if (x.JobIds.Any())
whereExpression.And(o => o.ZoneID != null && x.JobIds.Contains(o.JobID.Value));
if (x.ExclJobIds.Any())
whereExpression.And(o => o.ZoneID != null && x.ExclJobIds.Contains(o.JobID.Value));
if (x.StaffIds.Any())
whereExpression.And(o => o.ZoneID != null && x.StaffIds.Contains(o.StaffID));
if (x.ExclStaffIds.Any())
whereExpression.And(o => o.ZoneID != null && x.ExclStaffIds.Contains(o.StaffID));
#endregion
RefAsync<int> total = 0;
var entitys = await query
.WhereIF(condition.IsNotEmptyOrNull(), condition)
.Where(whereExpression.ToExpression())
.OrderBy(it => new { UpdateTime = SqlFunc.Desc(it.UpdateTime), CreateTime = SqlFunc.Desc(it.CreateTime) })
.ToPageListAsync(filter.pageNum, filter.pageSize, total);
var result = new ServicePageResult<Ghra_StaffDto>(filter.pageNum, total, filter.pageSize, Mapper.Map(entitys).ToANew<List<Ghra_StaffDto>>());
return result;
}
} }
Loading…
Cancel
Save