timed-task.service.ts 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. import { Injectable } from '@angular/core';
  2. import { HttpClient, HttpParams } from '@angular/common/http';
  3. import { Observable } from 'rxjs';
  4. import { BaseResponse } from 'app/entity/baseResponse';
  5. import { Result } from 'app/entity/Result';
  6. import { TimedTask } from 'app/entity/timed-task';
  7. import { promise } from 'protractor';
  8. import { Options } from 'selenium-webdriver/edge';
  9. @Injectable({
  10. providedIn: 'root'
  11. })
  12. /**
  13. * @fileoverview 定时任务网络服务类
  14. * 依赖定时任务实体类
  15. * @author 冯海夫
  16. * Copyright 2019 上海翠颠信息科技有限公司. All Rights Reserved.
  17. */
  18. export class TimedTaskService {
  19. constructor(private http: HttpClient) { }
  20. /**
  21. * 获取分页定时任务列表
  22. *
  23. * @param {TimedTask} body 定时任务对象
  24. * @return {Object} 定时任务列表
  25. */
  26. async list(body : any): Promise<BaseResponse<Result<any>>> {
  27. return await this.http.get<BaseResponse<Result<any>>>('sys/quartzJob/list',{params:body}).toPromise();
  28. }
  29. /**
  30. * 添加定时任务
  31. *
  32. * @param {TimedTask} body 定时任务对象
  33. * @return {Object} 保存结果
  34. */
  35. async add(body : TimedTask):Promise<BaseResponse<any>>{
  36. return await this.http.post<BaseResponse<any>>('sys/quartzJob/add',body).toPromise();
  37. }
  38. /**
  39. * 修改定时任务
  40. *
  41. * @param {TimedTask} body 定时任务对象
  42. * @return {Object} 保存结果
  43. */
  44. async edit(body : TimedTask):Promise<BaseResponse<any>>{
  45. return await this.http.put<BaseResponse<any>>('sys/quartzJob/edit',body).toPromise();
  46. }
  47. /**
  48. * 删除定时任务
  49. *
  50. * @param {id} body 定时任务主键
  51. * @return {Object} 删除结果
  52. */
  53. async delete(id:string):Promise<BaseResponse<any>>{
  54. const params = new HttpParams().set('id',id);
  55. return await this.http.delete<BaseResponse<any>>('sys/quartzJob/delete',{params}).toPromise();
  56. }
  57. /**
  58. * 根据id查询编号模式
  59. *
  60. * @param {id} body 定时任务主键
  61. * @return {Object} 定时任务对象
  62. */
  63. async queryById(id:string):Promise<BaseResponse<TimedTask>>{
  64. return await this.http.get<BaseResponse<TimedTask>>('sys/quartzJob/queryById',{params:{id:id}}).toPromise();
  65. }
  66. }