Commit 8792ba2e by 陶然

版本升级

parent 04897149
......@@ -29,29 +29,31 @@ namespace Jst.HumanResources.Oa.Jobs
private bool OaSync()
{
var connHr = KiviiContext.GetOpenedDbConnection<Attendance>();
var conn = KiviiContext.GetOpenedDbConnection<Attendance>();
var queryNotSigned = connHr.From<Attendance>();
var queryNotSigned = conn.From<Attendance>();
//只查三个月以内的
queryNotSigned.Where(o => o.TimeResult != "Normal" & o.TimeResult != "Leave" & o.BaseCheckTime >= DateTime.Now.AddMonths(-3));
queryNotSigned.Where(o => o.TimeResult != "Normal" && o.TimeResult != "Leave" && o.BaseCheckTime >= DateTime.Now.AddMonths(-3));
queryNotSigned.Select(o => o.UserName);
//查出未打卡的人清单
var notSigneds = connHr.Select(queryNotSigned);
var names = conn.Select<string>(queryNotSigned);
if (notSigneds.IsNullOrEmpty())
if (names.IsNullOrEmpty())
{
TaskContext.Message = $"暂无请假申请同步!";
return true;
}
int total = notSigneds.Count, success = 0;
int total = names.Count, oaTotal = 0, success = 0, skip = 0;
var names = notSigneds.ConvertAll(o => o.UserName).Distinct().ToList();
names = names.Distinct().ToList();
var connOa = KiviiContext.GetOpenedDbConnection<OaWorkToDo>();
var queryOa = connOa.From<OaWorkToDo>();
queryOa.Where(o => o.StateNow == "正常结束" & Sql.In(o.UserName, names) & o.WorkName.Contains("请假"));
queryOa.Where(o => o.StateNow == "正常结束" && o.TimeStr >= DateTime.Now.AddMonths(-4) && Sql.In(o.UserName, names) && o.WorkName.Contains("请假"));
var oaWorkToDos = connOa.Select(queryOa);
List<OaWorkToDo> oas = new List<OaWorkToDo>();
foreach (var oa in oaWorkToDos)
{
var beginStr = "alt=开始时间 value=\"";
......@@ -82,25 +84,54 @@ namespace Jst.HumanResources.Oa.Jobs
oa.TimeStr = beginTime;
oa.LateTime = endtTime.AddDays(1);
oa.Reason = reason;
oas.Add(oa);
oaTotal++;
}
foreach (var notSigned in notSigneds)
var existApproves = conn.Select<Approve>(o => Sql.In(o.BizId, oas.ConvertAll(p => p.ID.ToString())));
foreach (var item in oas)
{
var oas = oaWorkToDos.Where(o => o.UserName == notSigned.UserName).ToList();
if (oas.IsNullOrEmpty()) continue;
var oa = oas.FirstOrDefault(o => o.IsSuccess == true & o.TimeStr >= notSigned.BaseCheckTime & notSigned.BaseCheckTime < o.LateTime);
if (oa == null) continue;
notSigned.TimeResult = "Leave";
notSigned.AddOnlyProperties(o => o.TimeResult);
notSigned.SourceType = "OA";
notSigned.AddOnlyProperties(o => o.SourceType);
notSigned.Summary = $"{oa.Reason}";
notSigned.AddOnlyProperties(o => o.Summary);
notSigned.Remark = $"已匹配到OA请假申请,时间为:{oa.TimeStr:yyyy-MM-dd}{oa.LateTime:yyyy-MM-dd}";
notSigned.AddOnlyProperties(o => o.Remark);
connHr.UpdateOnly(notSigned);
if (!item.IsSuccess)
{
skip++;
continue;
}
if (existApproves.Exists(o => o.BizId==item.ID.ToString()))
{
skip++;
continue;
}
var approve = new Approve();
approve.BizId = item.ID.ToString();
approve.BizType = "JST.OA";
approve.UserName = item.UserName;
//approve.UserDepartment = $"{depart}";
//approve.Type = type;
//approve.Category = category;
approve.BeginTime = item.TimeStr;
approve.EndTime = item.LateTime;
approve.Duration = Duration.FullDay;
approve.Remark = item.Reason;
conn.Insert(approve);
success++;
}
TaskContext.Message = $"查询到{total}条未打卡记录,成功同步OA请假申请{success}条!";
//foreach (var notSigned in notSigneds)
//{
// var oas = oaWorkToDos.Where(o => o.UserName == notSigned.UserName).ToList();
// if (oas.IsNullOrEmpty()) continue;
// var oa = oas.FirstOrDefault(o => o.IsSuccess == true & o.TimeStr >= notSigned.BaseCheckTime & notSigned.BaseCheckTime < o.LateTime);
// if (oa == null) continue;
// notSigned.TimeResult = "Leave";
// notSigned.AddOnlyProperties(o => o.TimeResult);
// notSigned.SourceType = "OA";
// notSigned.AddOnlyProperties(o => o.SourceType);
// notSigned.Summary = $"{oa.Reason}";
// notSigned.AddOnlyProperties(o => o.Summary);
// notSigned.Remark = $"已匹配到OA请假申请,时间为:{oa.TimeStr:yyyy-MM-dd}至{oa.LateTime:yyyy-MM-dd}";
// notSigned.AddOnlyProperties(o => o.Remark);
// conn.UpdateOnly(notSigned);
// success++;
//}
TaskContext.Message = $"查询到{total}条未打卡记录,解析出{oaTotal}条,成功同步OA请假申请{success}条,跳过{skip}条!";
return true;
}
}
......
......@@ -31,14 +31,14 @@
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="Kivii.Common.V4.5, Version=5.6.2021.4290, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\..\..\Kivii.K5\packages\Kivii.Common.5.6.2021.4290\lib\net45\Kivii.Common.V4.5.dll</HintPath>
<Reference Include="Kivii.Common.V4.5, Version=5.6.2023.4000, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\..\..\packages\Kivii.Common.5.6.2023.4000\lib\net45\Kivii.Common.V4.5.dll</HintPath>
</Reference>
<Reference Include="Kivii.Core.V4.5, Version=5.6.2021.4260, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\..\..\Kivii.K5\packages\Kivii.Core.5.6.2021.4260\lib\net45\Kivii.Core.V4.5.dll</HintPath>
<Reference Include="Kivii.Core.V4.5, Version=5.6.2023.4000, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\..\..\packages\Kivii.Core.5.6.2023.4000\lib\net45\Kivii.Core.V4.5.dll</HintPath>
</Reference>
<Reference Include="Kivii.Linq.V4.5, Version=5.6.2021.4260, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\..\..\Kivii.K5\packages\Kivii.Linq.5.6.2021.4260\lib\net45\Kivii.Linq.V4.5.dll</HintPath>
<Reference Include="Kivii.Linq.V4.5, Version=5.6.2023.3000, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\..\..\packages\Kivii.Linq.5.6.2023.3000\lib\net45\Kivii.Linq.V4.5.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
......
......@@ -6,7 +6,7 @@ using System.Runtime.InteropServices;
// 控制。更改这些特性值可修改
// 与程序集关联的信息。
[assembly: AssemblyTitle("Jst.HumanResources.Oa.V4.5")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyDescription("请假OA同步人事考勤领域")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Jst.HumanResources.Oa.V4.5")]
......@@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
//可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值
//通过使用 "*",如下所示:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyVersion("5.4.2023.4130")]
[assembly: AssemblyFileVersion("5.4.2023.4130")]
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Kivii.Common" version="5.6.2021.4290" targetFramework="net45" />
<package id="Kivii.Core" version="5.6.2021.4260" targetFramework="net45" />
<package id="Kivii.Linq" version="5.6.2021.4260" targetFramework="net45" />
<package id="Kivii.Common" version="5.6.2023.4000" targetFramework="net45" />
<package id="Kivii.Core" version="5.6.2023.4000" targetFramework="net45" />
<package id="Kivii.Linq" version="5.6.2023.3000" targetFramework="net45" />
</packages>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment