schedule.html 18.7 KB
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564
<!DOCTYPE html>
<html>
<head>
<title>schedule.md</title>
<meta http-equiv="Content-type" content="text/html;charset=UTF-8">

<style>
/*---------------------------------------------------------------------------------------------
 *  Copyright (c) Microsoft Corporation. All rights reserved.
 *  Licensed under the MIT License. See License.txt in the project root for license information.
 *--------------------------------------------------------------------------------------------*/

body {
	font-family: "Segoe WPC", "Segoe UI", "SFUIText-Light", "HelveticaNeue-Light", sans-serif, "Droid Sans Fallback";
	font-size: 14px;
	padding: 0 12px;
	line-height: 22px;
	word-wrap: break-word;
}

#code-csp-warning {
	position: fixed;
	top: 0;
	right: 0;
	color: white;
	margin: 16px;
	text-align: center;
	font-size: 12px;
	font-family: sans-serif;
	background-color:#444444;
	cursor: pointer;
	padding: 6px;
	box-shadow: 1px 1px 1px rgba(0,0,0,.25);
}

#code-csp-warning:hover {
	text-decoration: none;
	background-color:#007acc;
	box-shadow: 2px 2px 2px rgba(0,0,0,.25);
}


body.scrollBeyondLastLine {
	margin-bottom: calc(100vh - 22px);
}

body.showEditorSelection .code-line {
	position: relative;
}

body.showEditorSelection .code-active-line:before,
body.showEditorSelection .code-line:hover:before {
	content: "";
	display: block;
	position: absolute;
	top: 0;
	left: -12px;
	height: 100%;
}

body.showEditorSelection li.code-active-line:before,
body.showEditorSelection li.code-line:hover:before {
	left: -30px;
}

.vscode-light.showEditorSelection .code-active-line:before {
	border-left: 3px solid rgba(0, 0, 0, 0.15);
}

.vscode-light.showEditorSelection .code-line:hover:before {
	border-left: 3px solid rgba(0, 0, 0, 0.40);
}

.vscode-dark.showEditorSelection .code-active-line:before {
	border-left: 3px solid rgba(255, 255, 255, 0.4);
}

.vscode-dark.showEditorSelection .code-line:hover:before {
	border-left: 3px solid rgba(255, 255, 255, 0.60);
}

.vscode-high-contrast.showEditorSelection .code-active-line:before {
	border-left: 3px solid rgba(255, 160, 0, 0.7);
}

.vscode-high-contrast.showEditorSelection .code-line:hover:before {
	border-left: 3px solid rgba(255, 160, 0, 1);
}

img {
	max-width: 100%;
	max-height: 100%;
}

a {
	color: #4080D0;
	text-decoration: none;
}

a:focus,
input:focus,
select:focus,
textarea:focus {
	outline: 1px solid -webkit-focus-ring-color;
	outline-offset: -1px;
}

hr {
	border: 0;
	height: 2px;
	border-bottom: 2px solid;
}

h1 {
	padding-bottom: 0.3em;
	line-height: 1.2;
	border-bottom-width: 1px;
	border-bottom-style: solid;
}

h1, h2, h3 {
	font-weight: normal;
}

h1 code,
h2 code,
h3 code,
h4 code,
h5 code,
h6 code {
	font-size: inherit;
	line-height: auto;
}

a:hover {
	color: #4080D0;
	text-decoration: underline;
}

table {
	border-collapse: collapse;
}

table > thead > tr > th {
	text-align: left;
	border-bottom: 1px solid;
}

table > thead > tr > th,
table > thead > tr > td,
table > tbody > tr > th,
table > tbody > tr > td {
	padding: 5px 10px;
}

table > tbody > tr + tr > td {
	border-top: 1px solid;
}

blockquote {
	margin: 0 7px 0 5px;
	padding: 0 16px 0 10px;
	border-left: 5px solid;
}

code {
	font-family: Menlo, Monaco, Consolas, "Droid Sans Mono", "Courier New", monospace, "Droid Sans Fallback";
	font-size: 14px;
	line-height: 19px;
}

body.wordWrap pre {
	white-space: pre-wrap;
}

.mac code {
	font-size: 12px;
	line-height: 18px;
}

pre:not(.hljs),
pre.hljs code > div {
	padding: 16px;
	border-radius: 3px;
	overflow: auto;
}

/** Theming */

.vscode-light,
.vscode-light pre code {
	color: rgb(30, 30, 30);
}

.vscode-dark,
.vscode-dark pre code {
	color: #DDD;
}

.vscode-high-contrast,
.vscode-high-contrast pre code {
	color: white;
}

.vscode-light code {
	color: #A31515;
}

.vscode-dark code {
	color: #D7BA7D;
}

.vscode-light pre:not(.hljs),
.vscode-light code > div {
	background-color: rgba(220, 220, 220, 0.4);
}

.vscode-dark pre:not(.hljs),
.vscode-dark code > div {
	background-color: rgba(10, 10, 10, 0.4);
}

.vscode-high-contrast pre:not(.hljs),
.vscode-high-contrast code > div {
	background-color: rgb(0, 0, 0);
}

.vscode-high-contrast h1 {
	border-color: rgb(0, 0, 0);
}

.vscode-light table > thead > tr > th {
	border-color: rgba(0, 0, 0, 0.69);
}

.vscode-dark table > thead > tr > th {
	border-color: rgba(255, 255, 255, 0.69);
}

.vscode-light h1,
.vscode-light hr,
.vscode-light table > tbody > tr + tr > td {
	border-color: rgba(0, 0, 0, 0.18);
}

.vscode-dark h1,
.vscode-dark hr,
.vscode-dark table > tbody > tr + tr > td {
	border-color: rgba(255, 255, 255, 0.18);
}

.vscode-light blockquote,
.vscode-dark blockquote {
	background: rgba(127, 127, 127, 0.1);
	border-color: rgba(0, 122, 204, 0.5);
}

.vscode-high-contrast blockquote {
	background: transparent;
	border-color: #fff;
}
</style>
<link rel="stylesheet" href="file:///file%3A///D%3A/Program%20Files/Microsoft%20VS%20Code/css/def.css" type="text/css">
<style>
/* Tomorrow Theme */
/* http://jmblog.github.com/color-themes-for-google-code-highlightjs */
/* Original theme - https://github.com/chriskempson/tomorrow-theme */

/* Tomorrow Comment */
.hljs-comment,
.hljs-quote {
	color: #8e908c;
}

/* Tomorrow Red */
.hljs-variable,
.hljs-template-variable,
.hljs-tag,
.hljs-name,
.hljs-selector-id,
.hljs-selector-class,
.hljs-regexp,
.hljs-deletion {
	color: #c82829;
}

/* Tomorrow Orange */
.hljs-number,
.hljs-built_in,
.hljs-builtin-name,
.hljs-literal,
.hljs-type,
.hljs-params,
.hljs-meta,
.hljs-link {
	color: #f5871f;
}

/* Tomorrow Yellow */
.hljs-attribute {
	color: #eab700;
}

/* Tomorrow Green */
.hljs-string,
.hljs-symbol,
.hljs-bullet,
.hljs-addition {
	color: #718c00;
}

/* Tomorrow Blue */
.hljs-title,
.hljs-section {
	color: #4271ae;
}

/* Tomorrow Purple */
.hljs-keyword,
.hljs-selector-tag {
	color: #8959a8;
}

.hljs {
	display: block;
	overflow-x: auto;
	color: #4d4d4c;
	padding: 0.5em;
}

.hljs-emphasis {
	font-style: italic;
}

.hljs-strong {
	font-weight: bold;
}
</style>

<style>
/*
 * Markdown PDF CSS
 */

 body {
	font-family:  "Meiryo", "Segoe WPC", "Segoe UI", "SFUIText-Light", "HelveticaNeue-Light", sans-serif, "Droid Sans Fallback";
}

pre {
	background-color: #f8f8f8;
	border: 1px solid #cccccc;
	border-radius: 3px;
	overflow-x: auto;
	white-space: pre-wrap;
	overflow-wrap: break-word;
}

pre:not(.hljs) {
	padding: 23px;
	line-height: 19px;
}

blockquote {
	background: rgba(127, 127, 127, 0.1);
	border-color: rgba(0, 122, 204, 0.5);
}

.emoji {
	height: 1.4em;
}

/* for inline code */
:not(pre):not(.hljs) > code {
	color: #C9AE75; /* Change the old color so it seems less like an error */
	font-size: inherit;
}

/* Page Break : use <div class="page"/> to insert page break
-------------------------------------------------------- */
.page {
	page-break-after: always;
}

</style>
<link rel="stylesheet" href="file:///e%3A/%E8%B5%84%E6%96%99/%E9%9B%86%E6%88%90%E4%B8%AD%E5%BF%83/table.css" type="text/css">
</head>
<body>
<p><font color=#666666 size=5 face="PingFangSC-Regular">计划任务</font></p>
<ul>
<li><a href="#0">使用场景</a></li>
<li><a href="#1">操作说明</a></li>
<li><a href="#2">开发相关</a></li>
</ul>
<H3 id=0 style="border-left: 4px solid #3677D5;height:42px;line-height:42px;background:#F4F4F4"><font color=#08C size=4 face="PingFangSC-Semibold" >&emsp;使用场景</font></H3>  
<p>计划任务是按指定的时间点执行任务。<br>
时间点为周期循环时间,如:每天的5点到7点、每周的周一到周五、每月的1日到10日等</p>
<H3 id=1 style="border-left: 4px solid #3677D5;height:42px;line-height:42px;background:#F4F4F4"><font color=#08C size=4 face="PingFangSC-Semibold" >&emsp;操作说明</font></H3>
<p>操作入口: <strong>集成中心</strong> - <strong>计划任务</strong><br>
<img src="image/schedule01.png" alt="计划任务"></p>
<p>点击 <strong>新建</strong>,弹出新建计划任务页面<br>
<img src="image/schedule02.png" alt="计划任务"></p>
<p><strong>计划任务标识:</strong> 保证唯一,不能重复<br>
<strong>计划任务类:</strong> 计划任务执行的类,必须是类的全名<br>
  必须实现接口 <strong>weaver.interfaces.schedule.BaseCronJob</strong> 的方法 <strong>public void execute() {}</strong><br>
<strong>定时时间:</strong> 所设置的定时执行时间,按Cron表达式定义<br>
   定时时间为以6个空格分隔的时间元素,从左到右依次为<strong></strong><strong>分钟</strong><strong>小时</strong><strong>天--每月</strong><strong></strong><strong>天--每星期</strong></p>
<p><strong>定时时间--秒:</strong> 可填写的内容包括:<strong>[0-59]</strong> <strong>[-]</strong> <strong>[,]</strong> <strong>[/]</strong> <strong>[*]</strong><br>
   <strong>0-59</strong> 代表固定的秒数值,如 <strong>10</strong> 表示每当到10秒时触发一次计划任务<br>
   <strong>-</strong> 代表秒数时间段,如 <strong>10-40</strong> 表示每分钟的10秒到40秒中的每秒钟都会触发一次计划任务<br>
   <strong>,</strong> 代表多个固定的秒数值,如 <strong>10,30,55</strong> 表示每当到10秒、30秒和55秒时触发一次计划任务<br>
   <strong>/</strong> 代表秒数的增量,如 <strong>0/15</strong> 表示从第0秒开始,每15秒触发一次<br>
   <strong>*</strong> 代表秒数的所有数值,即每一秒都触发一次</p>
<p><strong>定时时间--分钟:</strong> 可填写的内容包括:<strong>[0-59]</strong> <strong>[-]</strong> <strong>[,]</strong> <strong>[/]</strong> <strong>[*]</strong><br>
   <strong>0-59</strong> 代表固定的分钟数,如 <strong>20</strong> 表示每当到20分时触发一次<br>
   <strong>-</strong> 代表分钟数的时间段,如 <strong>5-30</strong> 表示每小时的5分到30分中的每分钟<br>
   <strong>,</strong> 代表多个固定的分钟数值,如 <strong>5,15,25</strong> 表示每当到5分、15分和25秒时触发一次计划任务<br>
   <strong>/</strong> 代表分钟数的增量,如 <strong>1/7</strong> 表示从第1分钟开始,每7分钟触发一次<br>
   <strong>*</strong> 代表分钟数的所有数值,即每分钟都触发一次</p>
<p><strong>定时时间--小时:</strong> 可填写的内容包括:<strong>[0-23]</strong> <strong>[-]</strong> <strong>[,]</strong> <strong>[/]</strong> <strong>[*]</strong><br>
   <strong>0-23</strong> 代表固定的小时数,如 <strong>6</strong> 表示每天的6点<br>
   <strong>-</strong> 代表小时的时间段,如 <strong>9-17</strong> 表示每天的9点到17点<br>
   <strong>,</strong> 代表多个固定的小时数值,如 <strong>9,11,13,15,17</strong> 表示每当到9点、11点、13点、15点和17点时触发一次计划任务<br>
   <strong>/</strong> 代表小时数的增量,如 <strong>8/2</strong> 表示从每天8点开始,每2小时触发一次<br>
   <strong>*</strong> 代表小时数的所有数值,即每小时都触发一次</p>
<p><strong>定时时间--天--每月:</strong> 可填写的内容包括:<strong>[0-31]</strong>(需要考虑每个月的实际天数) <strong>[-]</strong> <strong>[,]</strong> <strong>[/]</strong> <strong>[*]</strong> <strong>[?]</strong><br>
   <strong>0-31</strong> 代表固定的天数,如 <strong>4</strong> 表示每月的4日<br>
   <strong>-</strong> 代表天的时间段,如 <strong>5-25</strong> 表示每月的5日到25日<br>
   <strong>,</strong> 代表多个固定的天数值,如 <strong>1,10,20,30</strong> 表示每月的1日、10日、20日、30日<br>
   <strong>/</strong> 代表天数的增量,如 <strong>1/3</strong> 表示从每月的1日开始,每隔3天触发一次<br>
   <strong>*</strong> 代表天数的所有数值,即每天都触发一次<br>
   <strong>?</strong> 字符仅被用于“天--月”和“天--星期”表达式,表示不指定值;当2个表达式其中之一被指定了值以后,为了避免冲突,需要将另一个表达式的值设为**?**</p>
<p><strong>定时时间--月:</strong> 可填写的内容包括:<strong>[0-11]</strong> <strong>[-]</strong> <strong>[,]</strong> <strong>[/]</strong> <strong>[*]</strong> <strong>[?]</strong><br>
   <strong>0-11</strong> 代表固定的月数,如 <strong>6</strong> 表示每年的7月<br>
   <strong>-</strong> 代表月的时间段,如 <strong>4-8</strong> 表示每年的5月到9月<br>
   <strong>,</strong> 代表多个固定的月数值,如 <strong>0,2,4,6</strong> 表示每年的1月、3月、5月、7月<br>
   <strong>/</strong> 代表天数的增量,如 <strong>1/2</strong> 表示从每年的2月开始,每隔2月触发一次<br>
   <strong>*</strong> 代表月数的所有数值,即每月都触发一次</p>
<p><strong>定时时间--天--每星期:</strong> 可填写的内容包括:<strong>[1-7]</strong> <strong>[SUN,MON,TUE,WED,THU,FRI,SAT]</strong> <strong>[-]</strong> <strong>[,]</strong> <strong>[/]</strong> <strong>[*]</strong> <strong>[?]</strong> <strong>[L]</strong> <strong>[#]</strong><br>
   <strong>1-7</strong> 代表固定的星期数,其中 <strong>1=SUN,2= MON,3= TUE,4=WED,5=THU,6=FRI,7=SAT</strong>。如 <strong>4</strong> 表示每周的星期三
   <strong>(SUN,MON,TUE,WED,THU,FRI,SAT)</strong> 代表固定的星期数,如 <strong>TUE</strong> 表示每周的星期二<br>
   <strong>-</strong> 代表星期的时间段,如 <strong>5-7</strong> 表示每周的星期四到星期六;<strong>MON-FRI</strong>标识每周的星期一到星期五<br>
   <strong>,</strong> 代表多个固定的星期值,如 <strong>1,3,5</strong> 表示每周的星期日、星期二和星期四;<strong>WED,SAT</strong> 表示每周的星期三和星期六<br>
   <strong>-和,可以混合使用</strong><strong>MON-WED,SAT</strong> 表示每周的周一到周三和周六<br>
   <strong>/</strong> 代表星期数的增量,如 <strong>2/2</strong> 表示从每周的星期一开始,每隔2天触发一次<br>
   <strong>*</strong> 代表星期数的所有数值,即每天都触发一次<br>
   <strong>?</strong> 字符仅被用于“天--月”和“天--星期”表达式,表示不指定值;当2个表达式其中之一被指定了值以后,为了避免冲突,需要将另一个表达式的值设为**?**<br>
   <strong>L</strong> 表示最后一个星期;例如:<strong>4L</strong> 表示最后一个星期三<br>
   <strong>#</strong> 后面的数字表示第几个星期;例如:<strong>2#3</strong> 表示第三个星期一</p>
<p><strong>定时任务举例:</strong></p>
<table>
<thead>
<tr>
<th>定时时间</th>
<th>说明</th>
</tr>
</thead>
<tbody>
<tr>
<td>0 15 10 15 * ?</td>
<td>每月15日上午10:15触发</td>
</tr>
<tr>
<td>0 15 10 ? * MON-FRI</td>
<td>周一至周五的上午10:15触发</td>
</tr>
<tr>
<td>0 0 10,14,16 * * ?</td>
<td>每天上午10点,下午2点,4点</td>
</tr>
<tr>
<td>0 0/30 9-17 * * ?</td>
<td>朝九晚五工作时间内每半小时</td>
</tr>
<tr>
<td>0 0 12 ? * WED</td>
<td>每个星期三中午12点</td>
</tr>
<tr>
<td>0 0 12 * * ?</td>
<td>每天中午12点触发</td>
</tr>
<tr>
<td>0 15 10 * * ?</td>
<td>每天上午10:15触发</td>
</tr>
<tr>
<td>0 0/5 14,18 * *</td>
<td>在每天下午2点到2:55期间和下午6点到6:55期间的每5分钟触发</td>
</tr>
<tr>
<td>0 10,44 14 ? 3 WED</td>
<td>每年三月的星期三的下午2:10和2:44触发</td>
</tr>
<tr>
<td>0 15 10 ? * 6L</td>
<td>每月的最后一个星期五上午10:15触发</td>
</tr>
<tr>
<td>0 15 10 ? * 6#3</td>
<td>每月的第三个星期五上午10:15触发</td>
</tr>
</tbody>
</table>
<p><strong>计划任务</strong> - <strong>参数设置</strong> :用于定义 <strong>计划任务类</strong> 的执行参数
<span style="background:yellow"><strong>注意:</strong> <strong>参数设置</strong> 功能 是KB1806补丁包中新增的功能</span><br>
<img src="image/schedule05.png" alt="计划任务"></p>
<H3 id=2 style="border-left: 4px solid #3677D5;height:42px;line-height:42px;background:#F4F4F4"><font color=#08C size=4 face="PingFangSC-Semibold" >&emsp;开发相关</font></H3>  
<ol>
<li>
<p><strong>数据库相关</strong></p>
<ol>
<li>计划任务设置表:<strong>schedulesetting</strong></li>
</ol>
</li>
<li>
<p><strong>代码相关</strong></p>
<ol>
<li>
<p>计划任务列表界面: <strong>/servicesetting/schedulesetting.jsp</strong></p>
</li>
<li>
<p>计划任务执行类: <strong>weaver.interfaces.schedule.WeaverJob</strong></p>
</li>
<li>
<p>计划任务管理类: <strong>weaver.interfaces.schedule.ScheduleManage</strong></p>
</li>
<li>
<p>计划任务类需继承的接口方法:
<strong>weaver.interfaces.schedule.BaseCronJob</strong> 的方法 <strong>public void execute() {}</strong></p>
</li>
<li>
<p>计划任务类代码示例:<br>
举例:设置计划任务如下图所示:<br>
<img src="image/schedule06.png" alt="计划任务"><br>
计划任务类weaver.test.schedule.TestSchedule的代码如下</p>
<pre class="hljs"><code><div><span class="hljs-keyword">package</span> weaver.test.schedule;

<span class="hljs-keyword">import</span> weaver.interfaces.datasource.DataSource;
<span class="hljs-keyword">import</span> weaver.interfaces.schedule.BaseCronJob;

<span class="hljs-keyword">public</span> <span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">TestSchedule</span> <span class="hljs-keyword">extends</span> <span class="hljs-title">BaseCronJob</span> </span>{
    <span class="hljs-comment">//参数设置中的workflowid参数</span>
    String workflowid;
    <span class="hljs-comment">//参数设置中的newds参数</span>
    DataSource newds;
    <span class="hljs-function"><span class="hljs-keyword">public</span> <span class="hljs-keyword">void</span> <span class="hljs-title">execute</span><span class="hljs-params">()</span> </span>{
        System.out.println(<span class="hljs-string">"workflowid:"</span>+workflowid);
        System.out.println(<span class="hljs-string">"datasourceName:"</span> + newds.getDatasourcename());
        System.out.println(<span class="hljs-string">"dbName:"</span> + newds.getDbname());
    }
}
</div></code></pre>
<p><strong>计划任务</strong> - <strong>参数设置</strong> 中的参数名,需要和java类中的成员变量名一致<br>
当参数的 <strong>是否数据源</strong><strong></strong> 时,成员变量类型应为<strong>weaver.interfaces.datasource.DataSource</strong><br>
当参数的 <strong>是否数据源</strong><strong></strong> 时,成员变量类型应为<strong>String</strong><br>
计划任务执行时,相关的成员变量会自动获取到所设置的值
<span style="background:yellow">此处的使用逻辑与 <strong>流程流转集成</strong> 中的 <strong>自定义接口</strong> 的参数设置的逻辑一致</span></p>
</li>
</ol>
</li>
</ol>

</body>
</html>