Procházet zdrojové kódy

Job服务方法调整,为提供API服务做准备

xuxueli před 8 roky
rodič
revize
37e9a00139

+ 4 - 4
xxl-job-admin/src/main/java/com/xxl/job/admin/controller/IndexController.java Zobrazit soubor

41
 		return "index";
41
 		return "index";
42
 	}
42
 	}
43
 
43
 
44
-    @RequestMapping("/triggerChartDate")
44
+    @RequestMapping("/chartInfo")
45
 	@ResponseBody
45
 	@ResponseBody
46
-	public ReturnT<Map<String, Object>> triggerChartDate(Date startDate, Date endDate) {
47
-        ReturnT<Map<String, Object>> triggerChartDate = xxlJobService.triggerChartDate(startDate, endDate);
48
-        return triggerChartDate;
46
+	public ReturnT<Map<String, Object>> chartInfo(Date startDate, Date endDate) {
47
+        ReturnT<Map<String, Object>> chartInfo = xxlJobService.chartInfo(startDate, endDate);
48
+        return chartInfo;
49
     }
49
     }
50
 	
50
 	
51
 	@RequestMapping("/toLogin")
51
 	@RequestMapping("/toLogin")

+ 3 - 3
xxl-job-admin/src/main/java/com/xxl/job/admin/controller/JobInfoController.java Zobrazit soubor

64
 		return xxlJobService.add(jobInfo);
64
 		return xxlJobService.add(jobInfo);
65
 	}
65
 	}
66
 	
66
 	
67
-	@RequestMapping("/reschedule")
67
+	@RequestMapping("/update")
68
 	@ResponseBody
68
 	@ResponseBody
69
-	public ReturnT<String> reschedule(XxlJobInfo jobInfo) {
70
-		return xxlJobService.reschedule(jobInfo);
69
+	public ReturnT<String> update(XxlJobInfo jobInfo) {
70
+		return xxlJobService.update(jobInfo);
71
 	}
71
 	}
72
 	
72
 	
73
 	@RequestMapping("/remove")
73
 	@RequestMapping("/remove")

+ 68 - 9
xxl-job-admin/src/main/java/com/xxl/job/admin/service/XxlJobService.java Zobrazit soubor

13
  * @author xuxueli 2016-5-28 15:30:33
13
  * @author xuxueli 2016-5-28 15:30:33
14
  */
14
  */
15
 public interface XxlJobService {
15
 public interface XxlJobService {
16
-	
16
+
17
+	/**
18
+	 * page list
19
+	 *
20
+	 * @param start
21
+	 * @param length
22
+	 * @param jobGroup
23
+	 * @param jobDesc
24
+	 * @param executorHandler
25
+	 * @param filterTime
26
+	 * @return
27
+	 */
17
 	public Map<String, Object> pageList(int start, int length, int jobGroup, String jobDesc, String executorHandler, String filterTime);
28
 	public Map<String, Object> pageList(int start, int length, int jobGroup, String jobDesc, String executorHandler, String filterTime);
18
-	
29
+
30
+	/**
31
+	 * add job
32
+	 *
33
+	 * @param jobInfo
34
+	 * @return
35
+	 */
19
 	public ReturnT<String> add(XxlJobInfo jobInfo);
36
 	public ReturnT<String> add(XxlJobInfo jobInfo);
20
-	
21
-	public ReturnT<String> reschedule(XxlJobInfo jobInfo);
22
-	
37
+
38
+	/**
39
+	 * update job
40
+	 *
41
+	 * @param jobInfo
42
+	 * @return
43
+	 */
44
+	public ReturnT<String> update(XxlJobInfo jobInfo);
45
+
46
+	/**
47
+	 * remove job
48
+	 *
49
+	 * @param id
50
+	 * @return
51
+	 */
23
 	public ReturnT<String> remove(int id);
52
 	public ReturnT<String> remove(int id);
24
-	
53
+
54
+	/**
55
+	 * pause job
56
+	 *
57
+	 * @param id
58
+	 * @return
59
+	 */
25
 	public ReturnT<String> pause(int id);
60
 	public ReturnT<String> pause(int id);
26
-	
61
+
62
+	/**
63
+	 * resume job
64
+	 *
65
+	 * @param id
66
+	 * @return
67
+	 */
27
 	public ReturnT<String> resume(int id);
68
 	public ReturnT<String> resume(int id);
28
-	
69
+
70
+	/**
71
+	 * trigger job
72
+	 *
73
+	 * @param id
74
+	 * @return
75
+	 */
29
 	public ReturnT<String> triggerJob(int id);
76
 	public ReturnT<String> triggerJob(int id);
30
 
77
 
78
+	/**
79
+	 * dashboard info
80
+	 *
81
+	 * @return
82
+	 */
31
 	public Map<String,Object> dashboardInfo();
83
 	public Map<String,Object> dashboardInfo();
32
 
84
 
33
-	public ReturnT<Map<String,Object>> triggerChartDate(Date startDate, Date endDate);
85
+	/**
86
+	 * chart info
87
+	 *
88
+	 * @param startDate
89
+	 * @param endDate
90
+	 * @return
91
+	 */
92
+	public ReturnT<Map<String,Object>> chartInfo(Date startDate, Date endDate);
34
 
93
 
35
 }
94
 }

+ 5 - 5
xxl-job-admin/src/main/java/com/xxl/job/admin/service/impl/XxlJobServiceImpl.java Zobrazit soubor

149
 	}
149
 	}
150
 
150
 
151
 	@Override
151
 	@Override
152
-	public ReturnT<String> reschedule(XxlJobInfo jobInfo) {
152
+	public ReturnT<String> update(XxlJobInfo jobInfo) {
153
 
153
 
154
 		// valid
154
 		// valid
155
 		if (!CronExpression.isValidExpression(jobInfo.getJobCron())) {
155
 		if (!CronExpression.isValidExpression(jobInfo.getJobCron())) {
323
 
323
 
324
 	private static final String TRIGGER_CHART_DATA_CACHE = "trigger_chart_data_cache";
324
 	private static final String TRIGGER_CHART_DATA_CACHE = "trigger_chart_data_cache";
325
 	@Override
325
 	@Override
326
-	public ReturnT<Map<String, Object>> triggerChartDate(Date startDate, Date endDate) {
326
+	public ReturnT<Map<String, Object>> chartInfo(Date startDate, Date endDate) {
327
 		// get cache
327
 		// get cache
328
 		String cacheKey = TRIGGER_CHART_DATA_CACHE + "_" + startDate.getTime() + "_" + endDate.getTime();
328
 		String cacheKey = TRIGGER_CHART_DATA_CACHE + "_" + startDate.getTime() + "_" + endDate.getTime();
329
-		Map<String, Object> triggerChartDateCache = (Map<String, Object>) LocalCacheUtil.get(cacheKey);
330
-		if (triggerChartDateCache != null) {
331
-			return new ReturnT<Map<String, Object>>(triggerChartDateCache);
329
+		Map<String, Object> chartInfo = (Map<String, Object>) LocalCacheUtil.get(cacheKey);
330
+		if (chartInfo != null) {
331
+			return new ReturnT<Map<String, Object>>(chartInfo);
332
 		}
332
 		}
333
 
333
 
334
 		// process
334
 		// process

+ 1 - 1
xxl-job-admin/src/main/webapp/static/js/index.js Zobrazit soubor

49
     function freshChartDate(startDate, endDate) {
49
     function freshChartDate(startDate, endDate) {
50
         $.ajax({
50
         $.ajax({
51
             type : 'POST',
51
             type : 'POST',
52
-            url : base_url + '/triggerChartDate',
52
+            url : base_url + '/chartInfo',
53
             data : {
53
             data : {
54
                 'startDate':startDate.format('YYYY-MM-DD HH:mm:ss'),
54
                 'startDate':startDate.format('YYYY-MM-DD HH:mm:ss'),
55
                 'endDate':endDate.format('YYYY-MM-DD HH:mm:ss')
55
                 'endDate':endDate.format('YYYY-MM-DD HH:mm:ss')

+ 1 - 1
xxl-job-admin/src/main/webapp/static/js/jobinfo.index.1.js Zobrazit soubor

415
         },
415
         },
416
         submitHandler : function(form) {
416
         submitHandler : function(form) {
417
 			// post
417
 			// post
418
-    		$.post(base_url + "/jobinfo/reschedule", $("#updateModal .form").serialize(), function(data, status) {
418
+    		$.post(base_url + "/jobinfo/update", $("#updateModal .form").serialize(), function(data, status) {
419
     			if (data.code == "200") {
419
     			if (data.code == "200") {
420
 					$('#updateModal').modal('hide');
420
 					$('#updateModal').modal('hide');
421
 					layer.open({
421
 					layer.open({