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
9b731e1b
Commit
9b731e1b
authored
Jun 07, 2021
by
陶然
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
优化同步OA请假的Job
parent
f78a1f1e
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
26 additions
and
4 deletions
+26
-4
OaWorkToDo.cs
Src/Entities/OaWorkToDo.cs
+3
-0
OaWorkToDoJob.cs
Src/Jobs/OaWorkToDoJob.cs
+23
-4
No files found.
Src/Entities/OaWorkToDo.cs
View file @
9b731e1b
...
@@ -51,5 +51,8 @@ namespace Jst.HumanResources.Oa.Entities
...
@@ -51,5 +51,8 @@ namespace Jst.HumanResources.Oa.Entities
[
Ignore
]
[
Ignore
]
public
bool
IsSuccess
{
get
;
set
;
}
public
bool
IsSuccess
{
get
;
set
;
}
[
Ignore
]
public
string
Reason
{
get
;
set
;
}
}
}
}
}
Src/Jobs/OaWorkToDoJob.cs
View file @
9b731e1b
...
@@ -33,7 +33,7 @@ namespace Jst.HumanResources.Oa.Jobs
...
@@ -33,7 +33,7 @@ namespace Jst.HumanResources.Oa.Jobs
var
queryNotSigned
=
connHr
.
From
<
Attendance
>();
var
queryNotSigned
=
connHr
.
From
<
Attendance
>();
//只查三个月以内的
//只查三个月以内的
queryNotSigned
.
Where
(
o
=>
o
.
TimeResult
==
"NotSigned
"
&
o
.
BaseCheckTime
>=
DateTime
.
Now
.
AddMonths
(-
3
));
queryNotSigned
.
Where
(
o
=>
o
.
TimeResult
!=
"Normal"
&
o
.
TimeResult
!=
"Leave
"
&
o
.
BaseCheckTime
>=
DateTime
.
Now
.
AddMonths
(-
3
));
//查出未打卡的人清单
//查出未打卡的人清单
var
notSigneds
=
connHr
.
Select
(
queryNotSigned
);
var
notSigneds
=
connHr
.
Select
(
queryNotSigned
);
...
@@ -56,15 +56,32 @@ namespace Jst.HumanResources.Oa.Jobs
...
@@ -56,15 +56,32 @@ namespace Jst.HumanResources.Oa.Jobs
{
{
var
beginStr
=
"alt=开始时间 value=\""
;
var
beginStr
=
"alt=开始时间 value=\""
;
var
endStr
=
"alt=结束时间 value=\""
;
var
endStr
=
"alt=结束时间 value=\""
;
var
reasonBeginStr
=
"请假理由 size=31 value="
;
var
reasonEndStr
=
"name=Text77021621"
;
int
beginReasonIndex
=
oa
.
FormContent
.
IndexOf
(
reasonBeginStr
);
int
endReasonIndex
=
oa
.
FormContent
.
IndexOf
(
reasonEndStr
);
int
beginIndex
=
oa
.
FormContent
.
IndexOf
(
beginStr
);
int
beginIndex
=
oa
.
FormContent
.
IndexOf
(
beginStr
);
int
endIndex
=
oa
.
FormContent
.
IndexOf
(
endStr
);
int
endIndex
=
oa
.
FormContent
.
IndexOf
(
endStr
);
if
(
beginIndex
==
-
1
)
continue
;
if
(
beginIndex
==
-
1
)
continue
;
if
(
endIndex
==
-
1
)
continue
;
if
(
endIndex
==
-
1
)
continue
;
if
(!
DateTime
.
TryParse
(
oa
.
FormContent
.
Substring
(
beginIndex
+
beginStr
.
Length
,
10
),
out
var
beginTime
))
continue
;
if
(!
DateTime
.
TryParse
(
oa
.
FormContent
.
Substring
(
beginIndex
+
beginStr
.
Length
,
10
),
out
var
beginTime
))
continue
;
if
(!
DateTime
.
TryParse
(
oa
.
FormContent
.
Substring
(
endIndex
+
endStr
.
Length
,
10
),
out
var
endtTime
))
continue
;
if
(!
DateTime
.
TryParse
(
oa
.
FormContent
.
Substring
(
endIndex
+
endStr
.
Length
,
10
),
out
var
endtTime
))
continue
;
var
reason
=
string
.
Empty
;
if
(
beginReasonIndex
!=
-
1
)
{
if
(
endReasonIndex
==
-
1
)
endReasonIndex
=
beginReasonIndex
+
reasonBeginStr
.
Length
-
6
;
try
{
reason
=
oa
.
FormContent
.
Substring
(
beginReasonIndex
+
reasonBeginStr
.
Length
,
endReasonIndex
-
beginReasonIndex
-
reasonBeginStr
.
Length
);
}
catch
{
}
}
oa
.
IsSuccess
=
true
;
oa
.
IsSuccess
=
true
;
oa
.
TimeStr
=
beginTime
;
oa
.
TimeStr
=
beginTime
;
oa
.
LateTime
=
endtTime
.
AddDays
(
1
);
oa
.
LateTime
=
endtTime
.
AddDays
(
1
);
oa
.
Reason
=
reason
;
}
}
foreach
(
var
notSigned
in
notSigneds
)
foreach
(
var
notSigned
in
notSigneds
)
{
{
...
@@ -72,12 +89,14 @@ namespace Jst.HumanResources.Oa.Jobs
...
@@ -72,12 +89,14 @@ namespace Jst.HumanResources.Oa.Jobs
if
(
oas
.
IsNullOrEmpty
())
continue
;
if
(
oas
.
IsNullOrEmpty
())
continue
;
var
oa
=
oas
.
FirstOrDefault
(
o
=>
o
.
IsSuccess
==
true
&
o
.
TimeStr
>=
notSigned
.
BaseCheckTime
&
notSigned
.
BaseCheckTime
<
o
.
LateTime
);
var
oa
=
oas
.
FirstOrDefault
(
o
=>
o
.
IsSuccess
==
true
&
o
.
TimeStr
>=
notSigned
.
BaseCheckTime
&
notSigned
.
BaseCheckTime
<
o
.
LateTime
);
if
(
oa
==
null
)
continue
;
if
(
oa
==
null
)
continue
;
notSigned
.
SourceType
=
"OA"
;
notSigned
.
AddOnlyProperties
(
o
=>
o
.
SourceType
);
notSigned
.
TimeResult
=
"Leave"
;
notSigned
.
TimeResult
=
"Leave"
;
notSigned
.
AddOnlyProperties
(
o
=>
o
.
TimeResult
);
notSigned
.
AddOnlyProperties
(
o
=>
o
.
TimeResult
);
notSigned
.
Summary
=
$"已匹配到OA请假申请,时间为:
{
oa
.
TimeStr
:
G
}
至
{
oa
.
LateTime
:
G
}
"
;
notSigned
.
SourceType
=
"OA"
;
notSigned
.
AddOnlyProperties
(
o
=>
o
.
SourceType
);
notSigned
.
Summary
=
$"
{
oa
.
Reason
}
"
;
notSigned
.
AddOnlyProperties
(
o
=>
o
.
Summary
);
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
);
connHr
.
UpdateOnly
(
notSigned
);
success
++;
success
++;
}
}
...
...
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