[关闭]
@kangwg 2017-05-26T17:12:32.000000Z 字数 2101 阅读 905

定时任务可配置化


  1. 进入页面调用 Scheduler/getSchedulerList接口 返回数据:
  1. {
  2. "code": 0,
  3. "data": [
  4. {
  5. "jobName": "e80f0e724d144e44a99382a4bec7c561",
  6. "jobGroup": "dispatch",
  7. "jobClassName": "cn.langya.longjing.job.DisPatchPackageJob",
  8. "dataMap": {
  9. "code": "123",
  10. "packageId": "150",
  11. "time": "1493882284310",
  12. "url": "https://st.orangelife.com.cn/package/2941db944fe548b5af72e4022b500e08.zip"
  13. },
  14. "description": "https://st.orangelife.com.cn/package/2941db944fe548b5af72e4022b500e08.zip,123",
  15. "triggerList": []
  16. },
  17. {
  18. "jobName": "dispatchPackage",
  19. "jobGroup": "dispatchPackage",
  20. "jobClassName": "cn.langya.longjing.job.CreatePackgeJob",
  21. "dataMap": {},
  22. "description": "这是第三个测试",
  23. "triggerList": [
  24. {
  25. "cronExpression": "0/30 * * * * ?",
  26. "triggerGroup": "dispatchPackage",
  27. "triggerState": "NORMAL",
  28. "triggerName": "dispatchPackage"
  29. }
  30. ]
  31. }
  32. ]
  33. }
  34. 其中:triggerState的值意义:BLOCKED 4 // 运行 COMPLETE 2 //完成 ERROR 3 // 错误 NONE -1 //未知 NORMAL 0 //正常无任务,用这个判断Job是否在运行 PAUSED 1 //暂停
  1. 提供搜索按钮,和两个搜索条件 接口:Scheduler/getSchedulerList 传参{"jobName":"","jobGroup":""}
  2. 提供"暂停"按钮:选中一条数据 点击按钮调用接口:Scheduler/pauseJob 传参{"jobName":"","jobGroup":""} 出参excute:true/false(成功/失败)
  3. 提供"恢复"按钮:选中一条数据 点击按钮调用接口:Scheduler/resumeJob 传参{"jobName":"","jobGroup":""} 出参excute:true/false
  4. 提供"删除任务"按钮::选中一条数据点击按钮调用接口Scheduler/removeJob 传参{"jobName":"","jobGroup":""}出参excute:true/false
  5. 提供"手动执行"按钮:选中一条数据 点击按钮调用接口:Scheduler/addInstanceTrigger 传参{"jobName":"","jobGroup":""}出参excute:true/false
  6. 提供"开始"按钮,点击按钮调用 Scheduler/startScheduler (这个按钮尽量放在最前面)
  7. 提供"增加任务"按钮,提供多个输入框
    入参:
  1. {
  2. "jobName": "dispatchInstanceJob",
  3. "jobGroup": "dispatch",
  4. "jobClassName": " cn.langya.longjing.job.DispatchInstanceJob",
  5. "dataMap": {
  6. "key1": "value1",
  7. "key2": "value2"
  8. },
  9. "description": "这是第三个测试",
  10. "triggerList": [
  11. {
  12. "cronExpression": "0/30 * * * * ?",
  13. "triggerGroup": "dispatch",
  14. "triggerName": "test3"
  15. },
  16. {
  17. "cronExpression": "0/30 * * * * ?",
  18. "triggerGroup": "dispatch",
  19. "triggerName": "test3"
  20. }
  21. ]
  22. }

接口:Scheduler/createJob出参excute:true/false
9. 提供"增加触发器"按钮:选中一条数据提供三个输入框
入参:{"jobName":"","jobGroup":"","cronExpression":"","triggerGroup":"","triggerName":""}接口:Scheduler/addJobTime 出参excute:true/false
10. 提供"修改触发器"按钮: 选中"triggerList"这个集合中的一条数据,输入框输入"cronExpression"的值,入参:{"cronExpression":"","triggerGroup":"","triggerName":""},接口:Scheduler/modifyJobTime 出参excute:true/false

添加新批注
在作者公开此批注前,只有你和作者可见。
回复批注