fix(日志统计): 排除已离职林冲的漏写扣分
This commit is contained in:
parent
6e092547c0
commit
dbc39b7a5d
@ -88,6 +88,7 @@ return [
|
||||
'timezone' => env('DINGTALK_WORKLOG_TIMEZONE', env('APP_TIMEZONE', 'Asia/Shanghai')),
|
||||
'penalty_start_date' => env('DINGTALK_WORKLOG_PENALTY_START_DATE', '2026-11-04'),
|
||||
// 江陵不参与扣分;周生辰、常仪已离职,按负责人要求从扣分明细移除。
|
||||
// 林冲已离职;保留姓名兜底,避免账号 ID 变化后重新进入扣分。
|
||||
'penalty_excluded_user_ids' => array_values(array_filter(array_map(
|
||||
'trim',
|
||||
explode(',', (string) env(
|
||||
@ -95,6 +96,13 @@ return [
|
||||
'02591267217229,17097754648162977,16323606731241072',
|
||||
)),
|
||||
))),
|
||||
'penalty_excluded_names' => array_values(array_filter(array_map(
|
||||
'trim',
|
||||
explode(',', (string) env(
|
||||
'DINGTALK_WORKLOG_PENALTY_EXCLUDED_NAMES',
|
||||
'林冲',
|
||||
)),
|
||||
))),
|
||||
'userid' => env('DINGTALK_WORKLOG_USERID'),
|
||||
'lookback_days' => (int) env('DINGTALK_WORKLOG_LOOKBACK_DAYS', 35),
|
||||
'page_size' => min(max((int) env('DINGTALK_WORKLOG_PAGE_SIZE', 20), 1), 20),
|
||||
|
||||
@ -102,6 +102,10 @@ class DingWorklogPenaltyCalculator
|
||||
array_map('strval', (array) config('dingtalk.worklog.penalty_excluded_user_ids', [])),
|
||||
true,
|
||||
);
|
||||
$excludedNames = array_fill_keys(
|
||||
array_map('strval', (array) config('dingtalk.worklog.penalty_excluded_names', [])),
|
||||
true,
|
||||
);
|
||||
$members = [];
|
||||
$memberRows = $this->attendance->scheduledMembersBetween(
|
||||
$start->toDateString(),
|
||||
@ -112,12 +116,13 @@ class DingWorklogPenaltyCalculator
|
||||
}
|
||||
foreach ($memberRows as $member) {
|
||||
$userId = trim((string) ($member['userid'] ?? ''));
|
||||
if ($userId === '' || isset($excludedUserIds[$userId])) {
|
||||
$name = trim((string) ($member['name'] ?? ''));
|
||||
if ($userId === '' || isset($excludedUserIds[$userId]) || isset($excludedNames[$name])) {
|
||||
continue;
|
||||
}
|
||||
$members[$userId] = [
|
||||
'userid' => $userId,
|
||||
'name' => trim((string) ($member['name'] ?? '')) ?: $userId,
|
||||
'name' => $name ?: $userId,
|
||||
'missed_dates' => [],
|
||||
'missed_count' => 0,
|
||||
'penalty_points' => '0',
|
||||
|
||||
@ -89,6 +89,7 @@ class DingWorklogPenaltyCalculatorTest extends TestCase
|
||||
config([
|
||||
'dingtalk.worklog.penalty_start_date' => '2026-11-04',
|
||||
'dingtalk.worklog.penalty_excluded_user_ids' => [],
|
||||
'dingtalk.worklog.penalty_excluded_names' => [],
|
||||
'dingtalk.worklog.timezone' => 'Asia/Shanghai',
|
||||
'app.timezone' => 'Asia/Shanghai',
|
||||
]);
|
||||
@ -134,6 +135,7 @@ class DingWorklogPenaltyCalculatorTest extends TestCase
|
||||
'17097754648162977',
|
||||
'16323606731241072',
|
||||
],
|
||||
'dingtalk.worklog.penalty_excluded_names' => ['林冲'],
|
||||
'dingtalk.worklog.timezone' => 'Asia/Shanghai',
|
||||
'app.timezone' => 'Asia/Shanghai',
|
||||
]);
|
||||
@ -151,6 +153,7 @@ class DingWorklogPenaltyCalculatorTest extends TestCase
|
||||
['userid' => '02591267217229', 'name' => '江陵'],
|
||||
['userid' => '17097754648162977', 'name' => '周生辰'],
|
||||
['userid' => '16323606731241072', 'name' => '常仪'],
|
||||
['userid' => 'linchong', 'name' => '林冲'],
|
||||
['userid' => 'qiuxiang', 'name' => '秋香'],
|
||||
]);
|
||||
$attendance->shouldReceive('ready')->once()->andReturnTrue();
|
||||
@ -222,6 +225,7 @@ class DingWorklogPenaltyCalculatorTest extends TestCase
|
||||
config([
|
||||
'dingtalk.worklog.penalty_start_date' => '2026-11-04',
|
||||
'dingtalk.worklog.penalty_excluded_user_ids' => [],
|
||||
'dingtalk.worklog.penalty_excluded_names' => [],
|
||||
'dingtalk.worklog.timezone' => 'Asia/Shanghai',
|
||||
'app.timezone' => 'Asia/Shanghai',
|
||||
]);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user