Procházet zdrojové kódy

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

xuxueli před 7 roky
rodič
revize
37e9a00139

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

@@ -41,11 +41,11 @@ public class IndexController {
41 41
 		return "index";
42 42
 	}
43 43
 
44
-    @RequestMapping("/triggerChartDate")
44
+    @RequestMapping("/chartInfo")
45 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 51
 	@RequestMapping("/toLogin")

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

@@ -64,10 +64,10 @@ public class JobInfoController {
64 64
 		return xxlJobService.add(jobInfo);
65 65
 	}
66 66
 	
67
-	@RequestMapping("/reschedule")
67
+	@RequestMapping("/update")
68 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 73
 	@RequestMapping("/remove")

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

@@ -13,23 +13,82 @@ import java.util.Map;
13 13
  * @author xuxueli 2016-5-28 15:30:33
14 14
  */
15 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 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 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 52
 	public ReturnT<String> remove(int id);
24
-	
53
+
54
+	/**
55
+	 * pause job
56
+	 *
57
+	 * @param id
58
+	 * @return
59
+	 */
25 60
 	public ReturnT<String> pause(int id);
26
-	
61
+
62
+	/**
63
+	 * resume job
64
+	 *
65
+	 * @param id
66
+	 * @return
67
+	 */
27 68
 	public ReturnT<String> resume(int id);
28
-	
69
+
70
+	/**
71
+	 * trigger job
72
+	 *
73
+	 * @param id
74
+	 * @return
75
+	 */
29 76
 	public ReturnT<String> triggerJob(int id);
30 77
 
78
+	/**
79
+	 * dashboard info
80
+	 *
81
+	 * @return
82
+	 */
31 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,7 +149,7 @@ public class XxlJobServiceImpl implements XxlJobService {
149 149
 	}
150 150
 
151 151
 	@Override
152
-	public ReturnT<String> reschedule(XxlJobInfo jobInfo) {
152
+	public ReturnT<String> update(XxlJobInfo jobInfo) {
153 153
 
154 154
 		// valid
155 155
 		if (!CronExpression.isValidExpression(jobInfo.getJobCron())) {
@@ -323,12 +323,12 @@ public class XxlJobServiceImpl implements XxlJobService {
323 323
 
324 324
 	private static final String TRIGGER_CHART_DATA_CACHE = "trigger_chart_data_cache";
325 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 327
 		// get cache
328 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 334
 		// process

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

@@ -49,7 +49,7 @@ $(function () {
49 49
     function freshChartDate(startDate, endDate) {
50 50
         $.ajax({
51 51
             type : 'POST',
52
-            url : base_url + '/triggerChartDate',
52
+            url : base_url + '/chartInfo',
53 53
             data : {
54 54
                 'startDate':startDate.format('YYYY-MM-DD HH:mm:ss'),
55 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,7 +415,7 @@ $(function() {
415 415
         },
416 416
         submitHandler : function(form) {
417 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 419
     			if (data.code == "200") {
420 420
 					$('#updateModal').modal('hide');
421 421
 					layer.open({