bfg-common 1.4.278 → 1.4.279
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -155,7 +155,7 @@ const generateHourlyCronExpression = (delay: string, date: Date): any => {
|
|
|
155
155
|
// Генерируем cron-выражение
|
|
156
156
|
return `${minutes} ${hours}/${delay} * * *`
|
|
157
157
|
}
|
|
158
|
-
const generateDaylyCronExpression = (delay: string, date: Date):
|
|
158
|
+
const generateDaylyCronExpression = (delay: string, date: Date): string => {
|
|
159
159
|
if (!date) return
|
|
160
160
|
|
|
161
161
|
const minutes = date.getMinutes()
|
|
@@ -165,6 +165,25 @@ const generateDaylyCronExpression = (delay: string, date: Date): any => {
|
|
|
165
165
|
// Генерируем cron-выражение
|
|
166
166
|
return `${minutes} ${hours} ${day}/${delay} * *`
|
|
167
167
|
}
|
|
168
|
+
const generateWeeklyCronExpression = (
|
|
169
|
+
data: UI_I_ScheduleNewTasksForm
|
|
170
|
+
): string => {
|
|
171
|
+
const { frg_on_week_days } = data
|
|
172
|
+
|
|
173
|
+
// Генерируем cron-выражение
|
|
174
|
+
return `* * * * ${frg_on_week_days.join(',')}`
|
|
175
|
+
}
|
|
176
|
+
const generateMonthlyCronExpression = (delay: string, date: Date): string => {
|
|
177
|
+
if (!date) return
|
|
178
|
+
|
|
179
|
+
const minutes = date.getMinutes()
|
|
180
|
+
const hours = date.getHours()
|
|
181
|
+
const day = date.getDate()
|
|
182
|
+
const month = date.getMonth() + 1
|
|
183
|
+
|
|
184
|
+
// Генерируем cron-выражение
|
|
185
|
+
return `${minutes} ${hours} ${day} ${month}/${delay} *`
|
|
186
|
+
}
|
|
168
187
|
|
|
169
188
|
const generateCronExpression = (
|
|
170
189
|
runType: UI_T_FrequencyType,
|
|
@@ -186,22 +205,25 @@ const generateCronExpression = (
|
|
|
186
205
|
cronExpression = `${delay} * * * * after_procurator_startup` // Выполняется каждые N минут после запуска procurator_startup
|
|
187
206
|
break
|
|
188
207
|
case 'hour':
|
|
189
|
-
const hourlyDelay =
|
|
208
|
+
const hourlyDelay = interval.frg_interval
|
|
190
209
|
const date =
|
|
191
210
|
interval.frg_start_on_time && new Date(interval.frg_start_on_time)
|
|
192
211
|
cronExpression = generateHourlyCronExpression(hourlyDelay, date)
|
|
193
212
|
break
|
|
194
213
|
case 'day':
|
|
195
|
-
const
|
|
214
|
+
const dayDelay = interval.frg_interval
|
|
196
215
|
const date =
|
|
197
216
|
interval.frg_start_on_time && new Date(interval.frg_start_on_time)
|
|
198
|
-
cronExpression = generateDaylyCronExpression(
|
|
217
|
+
cronExpression = generateDaylyCronExpression(dayDelay, date)
|
|
199
218
|
break
|
|
200
219
|
case 'week':
|
|
201
|
-
cronExpression =
|
|
220
|
+
cronExpression = generateWeeklyCronExpression(interval)
|
|
202
221
|
break
|
|
203
222
|
case 'month':
|
|
204
|
-
|
|
223
|
+
const monthDelay = interval.frg_interval
|
|
224
|
+
const date =
|
|
225
|
+
interval.frg_start_on_time && new Date(interval.frg_start_on_time)
|
|
226
|
+
cronExpression = generateMonthlyCronExpression(monthDelay, date)
|
|
205
227
|
break
|
|
206
228
|
default:
|
|
207
229
|
cronExpression = '* * * * *'
|