Skip to content

Commit

Permalink
Job服务方法调整,为提供API服务做准备
Browse files Browse the repository at this point in the history
  • Loading branch information
xuxueli committed Jan 30, 2018
1 parent 18991c3 commit 37e9a00
Show file tree
Hide file tree
Showing 6 changed files with 82 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,11 @@ public String index(Model model) {
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")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,10 @@ public ReturnT<String> add(XxlJobInfo jobInfo) {
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")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,23 +13,82 @@
* @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);

}
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ public ReturnT<String> add(XxlJobInfo jobInfo) {
}

@Override
public ReturnT<String> reschedule(XxlJobInfo jobInfo) {
public ReturnT<String> update(XxlJobInfo jobInfo) {

// valid
if (!CronExpression.isValidExpression(jobInfo.getJobCron())) {
Expand Down Expand Up @@ -323,12 +323,12 @@ public Map<String, Object> dashboardInfo() {

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
Expand Down
2 changes: 1 addition & 1 deletion xxl-job-admin/src/main/webapp/static/js/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down
2 changes: 1 addition & 1 deletion xxl-job-admin/src/main/webapp/static/js/jobinfo.index.1.js
Original file line number Diff line number Diff line change
Expand Up @@ -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({
Expand Down

0 comments on commit 37e9a00

Please sign in to comment.