Browse Source

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

xuxueli 7 years ago
parent
commit
37e9a00139

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

@@ -41,11 +41,11 @@ public class IndexController {
 		return "index";
 	}
 
-    @RequestMapping("/triggerChartDate")
+    @RequestMapping("/chartInfo")
 	@ResponseBody
-	public ReturnT<Map<String, Object>> triggerChartDate(Date startDate, Date endDate) {
-        ReturnT<Map<String, Object>> triggerChartDate = xxlJobService.triggerChartDate(startDate, endDate);
-        return triggerChartDate;
+	public ReturnT<Map<String, Object>> chartInfo(Date startDate, Date endDate) {
+        ReturnT<Map<String, Object>> chartInfo = xxlJobService.chartInfo(startDate, endDate);
+        return chartInfo;
     }
 	
 	@RequestMapping("/toLogin")

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

@@ -64,10 +64,10 @@ public class JobInfoController {
 		return xxlJobService.add(jobInfo);
 	}
 	
-	@RequestMapping("/reschedule")
+	@RequestMapping("/update")
 	@ResponseBody
-	public ReturnT<String> reschedule(XxlJobInfo jobInfo) {
-		return xxlJobService.reschedule(jobInfo);
+	public ReturnT<String> update(XxlJobInfo jobInfo) {
+		return xxlJobService.update(jobInfo);
 	}
 	
 	@RequestMapping("/remove")

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

@@ -13,23 +13,82 @@ import java.util.Map;
  * @author xuxueli 2016-5-28 15:30:33
  */
 public interface XxlJobService {
-	
+
+	/**
+	 * page list
+	 *
+	 * @param start
+	 * @param length
+	 * @param jobGroup
+	 * @param jobDesc
+	 * @param executorHandler
+	 * @param filterTime
+	 * @return
+	 */
 	public Map<String, Object> pageList(int start, int length, int jobGroup, String jobDesc, String executorHandler, String filterTime);
-	
+
+	/**
+	 * add job
+	 *
+	 * @param jobInfo
+	 * @return
+	 */
 	public ReturnT<String> add(XxlJobInfo jobInfo);
-	
-	public ReturnT<String> reschedule(XxlJobInfo jobInfo);
-	
+
+	/**
+	 * update job
+	 *
+	 * @param jobInfo
+	 * @return
+	 */
+	public ReturnT<String> update(XxlJobInfo jobInfo);
+
+	/**
+	 * remove job
+	 *
+	 * @param id
+	 * @return
+	 */
 	public ReturnT<String> remove(int id);
-	
+
+	/**
+	 * pause job
+	 *
+	 * @param id
+	 * @return
+	 */
 	public ReturnT<String> pause(int id);
-	
+
+	/**
+	 * resume job
+	 *
+	 * @param id
+	 * @return
+	 */
 	public ReturnT<String> resume(int id);
-	
+
+	/**
+	 * trigger job
+	 *
+	 * @param id
+	 * @return
+	 */
 	public ReturnT<String> triggerJob(int id);
 
+	/**
+	 * dashboard info
+	 *
+	 * @return
+	 */
 	public Map<String,Object> dashboardInfo();
 
-	public ReturnT<Map<String,Object>> triggerChartDate(Date startDate, Date endDate);
+	/**
+	 * chart info
+	 *
+	 * @param startDate
+	 * @param endDate
+	 * @return
+	 */
+	public ReturnT<Map<String,Object>> chartInfo(Date startDate, Date endDate);
 
 }

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

@@ -149,7 +149,7 @@ public class XxlJobServiceImpl implements XxlJobService {
 	}
 
 	@Override
-	public ReturnT<String> reschedule(XxlJobInfo jobInfo) {
+	public ReturnT<String> update(XxlJobInfo jobInfo) {
 
 		// valid
 		if (!CronExpression.isValidExpression(jobInfo.getJobCron())) {
@@ -323,12 +323,12 @@ public class XxlJobServiceImpl implements XxlJobService {
 
 	private static final String TRIGGER_CHART_DATA_CACHE = "trigger_chart_data_cache";
 	@Override
-	public ReturnT<Map<String, Object>> triggerChartDate(Date startDate, Date endDate) {
+	public ReturnT<Map<String, Object>> chartInfo(Date startDate, Date endDate) {
 		// get cache
 		String cacheKey = TRIGGER_CHART_DATA_CACHE + "_" + startDate.getTime() + "_" + endDate.getTime();
-		Map<String, Object> triggerChartDateCache = (Map<String, Object>) LocalCacheUtil.get(cacheKey);
-		if (triggerChartDateCache != null) {
-			return new ReturnT<Map<String, Object>>(triggerChartDateCache);
+		Map<String, Object> chartInfo = (Map<String, Object>) LocalCacheUtil.get(cacheKey);
+		if (chartInfo != null) {
+			return new ReturnT<Map<String, Object>>(chartInfo);
 		}
 
 		// process

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

@@ -49,7 +49,7 @@ $(function () {
     function freshChartDate(startDate, endDate) {
         $.ajax({
             type : 'POST',
-            url : base_url + '/triggerChartDate',
+            url : base_url + '/chartInfo',
             data : {
                 'startDate':startDate.format('YYYY-MM-DD HH:mm:ss'),
                 'endDate':endDate.format('YYYY-MM-DD HH:mm:ss')

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

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