Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
J
Jst.HumanResources.Oa
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
陶然
Jst.HumanResources.Oa
Commits
8792ba2e
Commit
8792ba2e
authored
Apr 13, 2023
by
陶然
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
版本升级
parent
04897149
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
67 additions
and
35 deletions
+67
-35
OaWorkToDoJob.cs
Src/Jobs/OaWorkToDoJob.cs
+54
-23
Jst.HumanResources.Oa.V4.5.csproj
Src/Jst.HumanResources.Oa.V4.5.csproj
+6
-6
AssemblyInfo.cs
Src/Properties/AssemblyInfo.cs
+3
-3
packages.config
Src/packages.config
+4
-3
No files found.
Src/Jobs/OaWorkToDoJob.cs
View file @
8792ba2e
...
@@ -29,29 +29,31 @@ namespace Jst.HumanResources.Oa.Jobs
...
@@ -29,29 +29,31 @@ namespace Jst.HumanResources.Oa.Jobs
private
bool
OaSync
()
private
bool
OaSync
()
{
{
var
conn
Hr
=
KiviiContext
.
GetOpenedDbConnection
<
Attendance
>();
var
conn
=
KiviiContext
.
GetOpenedDbConnection
<
Attendance
>();
var
queryNotSigned
=
conn
Hr
.
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
n
otSigneds
=
connHr
.
Select
(
queryNotSigned
);
var
n
ames
=
conn
.
Select
<
string
>
(
queryNotSigned
);
if
(
n
otSigned
s
.
IsNullOrEmpty
())
if
(
n
ame
s
.
IsNullOrEmpty
())
{
{
TaskContext
.
Message
=
$"暂无请假申请同步!"
;
TaskContext
.
Message
=
$"暂无请假申请同步!"
;
return
true
;
return
true
;
}
}
int
total
=
n
otSigneds
.
Count
,
success
=
0
;
int
total
=
n
ames
.
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
connOa
=
KiviiContext
.
GetOpenedDbConnection
<
OaWorkToDo
>();
var
queryOa
=
connOa
.
From
<
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
);
var
oaWorkToDos
=
connOa
.
Select
(
queryOa
);
List
<
OaWorkToDo
>
oas
=
new
List
<
OaWorkToDo
>();
foreach
(
var
oa
in
oaWorkToDos
)
foreach
(
var
oa
in
oaWorkToDos
)
{
{
var
beginStr
=
"alt=开始时间 value=\""
;
var
beginStr
=
"alt=开始时间 value=\""
;
...
@@ -82,25 +84,54 @@ namespace Jst.HumanResources.Oa.Jobs
...
@@ -82,25 +84,54 @@ namespace Jst.HumanResources.Oa.Jobs
oa
.
TimeStr
=
beginTime
;
oa
.
TimeStr
=
beginTime
;
oa
.
LateTime
=
endtTime
.
AddDays
(
1
);
oa
.
LateTime
=
endtTime
.
AddDays
(
1
);
oa
.
Reason
=
reason
;
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
(!
item
.
IsSuccess
)
if
(
oas
.
IsNullOrEmpty
())
continue
;
{
var
oa
=
oas
.
FirstOrDefault
(
o
=>
o
.
IsSuccess
==
true
&
o
.
TimeStr
>=
notSigned
.
BaseCheckTime
&
notSigned
.
BaseCheckTime
<
o
.
LateTime
);
skip
++;
if
(
oa
==
null
)
continue
;
continue
;
notSigned
.
TimeResult
=
"Leave"
;
}
notSigned
.
AddOnlyProperties
(
o
=>
o
.
TimeResult
);
if
(
existApproves
.
Exists
(
o
=>
o
.
BizId
==
item
.
ID
.
ToString
()))
notSigned
.
SourceType
=
"OA"
;
{
notSigned
.
AddOnlyProperties
(
o
=>
o
.
SourceType
);
skip
++;
notSigned
.
Summary
=
$"
{
oa
.
Reason
}
"
;
continue
;
notSigned
.
AddOnlyProperties
(
o
=>
o
.
Summary
);
}
notSigned
.
Remark
=
$"已匹配到OA请假申请,时间为:
{
oa
.
TimeStr
:
yyyy
-
MM
-
dd
}
至
{
oa
.
LateTime
:
yyyy
-
MM
-
dd
}
"
;
var
approve
=
new
Approve
();
notSigned
.
AddOnlyProperties
(
o
=>
o
.
Remark
);
approve
.
BizId
=
item
.
ID
.
ToString
();
connHr
.
UpdateOnly
(
notSigned
);
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
++;
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
;
return
true
;
}
}
}
}
...
...
Src/Jst.HumanResources.Oa.V4.5.csproj
View file @
8792ba2e
...
@@ -31,14 +31,14 @@
...
@@ -31,14 +31,14 @@
<WarningLevel>
4
</WarningLevel>
<WarningLevel>
4
</WarningLevel>
</PropertyGroup>
</PropertyGroup>
<ItemGroup>
<ItemGroup>
<Reference
Include=
"Kivii.Common.V4.5, Version=5.6.202
1.429
0, Culture=neutral, processorArchitecture=MSIL"
>
<Reference
Include=
"Kivii.Common.V4.5, Version=5.6.202
3.400
0, Culture=neutral, processorArchitecture=MSIL"
>
<HintPath>
..\..\..\
Kivii.K5\packages\Kivii.Common.5.6.2021.429
0\lib\net45\Kivii.Common.V4.5.dll
</HintPath>
<HintPath>
..\..\..\
packages\Kivii.Common.5.6.2023.400
0\lib\net45\Kivii.Common.V4.5.dll
</HintPath>
</Reference>
</Reference>
<Reference
Include=
"Kivii.Core.V4.5, Version=5.6.202
1.426
0, Culture=neutral, processorArchitecture=MSIL"
>
<Reference
Include=
"Kivii.Core.V4.5, Version=5.6.202
3.400
0, Culture=neutral, processorArchitecture=MSIL"
>
<HintPath>
..\..\..\
Kivii.K5\packages\Kivii.Core.5.6.2021.426
0\lib\net45\Kivii.Core.V4.5.dll
</HintPath>
<HintPath>
..\..\..\
packages\Kivii.Core.5.6.2023.400
0\lib\net45\Kivii.Core.V4.5.dll
</HintPath>
</Reference>
</Reference>
<Reference
Include=
"Kivii.Linq.V4.5, Version=5.6.202
1.426
0, Culture=neutral, processorArchitecture=MSIL"
>
<Reference
Include=
"Kivii.Linq.V4.5, Version=5.6.202
3.300
0, Culture=neutral, processorArchitecture=MSIL"
>
<HintPath>
..\..\..\
Kivii.K5\packages\Kivii.Linq.5.6.2021.426
0\lib\net45\Kivii.Linq.V4.5.dll
</HintPath>
<HintPath>
..\..\..\
packages\Kivii.Linq.5.6.2023.300
0\lib\net45\Kivii.Linq.V4.5.dll
</HintPath>
</Reference>
</Reference>
<Reference
Include=
"System"
/>
<Reference
Include=
"System"
/>
<Reference
Include=
"System.Core"
/>
<Reference
Include=
"System.Core"
/>
...
...
Src/Properties/AssemblyInfo.cs
View file @
8792ba2e
...
@@ -6,7 +6,7 @@ using System.Runtime.InteropServices;
...
@@ -6,7 +6,7 @@ using System.Runtime.InteropServices;
// 控制。更改这些特性值可修改
// 控制。更改这些特性值可修改
// 与程序集关联的信息。
// 与程序集关联的信息。
[assembly: AssemblyTitle("Jst.HumanResources.Oa.V4.5")]
[assembly: AssemblyTitle("Jst.HumanResources.Oa.V4.5")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyDescription("
请假OA同步人事考勤领域
")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Jst.HumanResources.Oa.V4.5")]
[assembly: AssemblyProduct("Jst.HumanResources.Oa.V4.5")]
...
@@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
...
@@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
//可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值
//可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值
//通过使用 "*",如下所示:
//通过使用 "*",如下所示:
// [assembly: AssemblyVersion("1.0.*")]
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("
1.0.0.
0")]
[assembly: AssemblyVersion("
5.4.2023.413
0")]
[assembly: AssemblyFileVersion("
1.0.0.
0")]
[assembly: AssemblyFileVersion("
5.4.2023.413
0")]
Src/packages.config
View file @
8792ba2e
<?
xml
version
=
"1.0"
encoding
=
"utf-8"
?>
<?
xml
version
=
"1.0"
encoding
=
"utf-8"
?>
<
packages
>
<
packages
>
<
package
id
=
"Kivii.Common"
version
=
"5.6.202
1.429
0"
targetFramework
=
"net45"
/>
<
package
id
=
"Kivii.Common"
version
=
"5.6.202
3.400
0"
targetFramework
=
"net45"
/>
<
package
id
=
"Kivii.Core"
version
=
"5.6.202
1.426
0"
targetFramework
=
"net45"
/>
<
package
id
=
"Kivii.Core"
version
=
"5.6.202
3.400
0"
targetFramework
=
"net45"
/>
<
package
id
=
"Kivii.Linq"
version
=
"5.6.202
1.426
0"
targetFramework
=
"net45"
/>
<
package
id
=
"Kivii.Linq"
version
=
"5.6.202
3.300
0"
targetFramework
=
"net45"
/>
</
packages
>
</
packages
>
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment