Skip to content

Commit b02dd3f

Browse files
committed
LTS-Admin 取消业务日志查询 taskId的限制
1 parent 43e6b52 commit b02dd3f

File tree

6 files changed

+92
-55
lines changed

6 files changed

+92
-55
lines changed

lts-admin/src/main/java/com/lts/web/controller/api/JobQueueApiController.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -200,8 +200,8 @@ public RestfulResponse jobLoggerGet(JobLoggerRequest request) {
200200
RestfulResponse response = new RestfulResponse();
201201

202202
try {
203-
Assert.hasLength(request.getTaskId(), "taskId不能为空!");
204-
Assert.hasLength(request.getTaskTrackerNodeGroup(), "taskTrackerNodeGroup不能为空!");
203+
// Assert.hasLength(request.getTaskId(), "taskId不能为空!");
204+
// Assert.hasLength(request.getTaskTrackerNodeGroup(), "taskTrackerNodeGroup不能为空!");
205205
} catch (IllegalArgumentException e) {
206206
response.setSuccess(false);
207207
response.setMsg(e.getMessage());

lts-admin/src/main/java/com/lts/web/controller/ui/UIController.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ public String jobLoggerUI(Model model, String taskId, String taskTrackerNodeGrou
6464
model.addAttribute("taskId", taskId);
6565
model.addAttribute("taskTrackerNodeGroup", taskTrackerNodeGroup);
6666
if (startLogTime == null) {
67-
startLogTime = DateUtils.addDay(new Date(), -3);
67+
startLogTime = DateUtils.addMinute(new Date(), -10);
6868
}
6969
model.addAttribute("startLogTime", DateUtils.formatYMD_HMS(startLogTime));
7070
if (endLogTime == null) {

lts-admin/src/main/webapp/views/templates/cronJobQueue.vm

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -247,21 +247,23 @@
247247
confirmButtonColor: "#DD6B55",
248248
confirmButtonText: "确认删除",
249249
closeOnConfirm: false
250-
}, function () {
251-
$.ajax({
252-
url: 'api/job-queue/cron-job-delete',
253-
type: 'POST',
254-
dataType: 'json',
255-
data: {jobId: jobId, taskTrackerNodeGroup: taskTrackerNodeGroup},
256-
success: function (json) {
257-
if (json && json.success) {
258-
swal("删除成功!", "恭喜你", "success");
259-
that.parents("tr").remove();
260-
} else {
261-
json ? swal(json['msg']) : {};
250+
}, function (isConfirm) {
251+
if(isConfirm){
252+
$.ajax({
253+
url: 'api/job-queue/cron-job-delete',
254+
type: 'POST',
255+
dataType: 'json',
256+
data: {jobId: jobId, taskTrackerNodeGroup: taskTrackerNodeGroup},
257+
success: function (json) {
258+
if (json && json.success) {
259+
swal("删除成功!", "恭喜你", "success");
260+
that.parents("tr").remove();
261+
} else {
262+
json ? swal(json['msg']) : {};
263+
}
262264
}
263-
}
264-
});
265+
});
266+
}
265267
});
266268
});
267269

lts-admin/src/main/webapp/views/templates/executableJobQueue.vm

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -245,21 +245,23 @@
245245
confirmButtonColor: "#DD6B55",
246246
confirmButtonText: "确认删除",
247247
closeOnConfirm: false
248-
}, function () {
249-
$.ajax({
250-
url: 'api/job-queue/executable-job-delete',
251-
type: 'POST',
252-
dataType: 'json',
253-
data: {jobId: jobId, taskTrackerNodeGroup: taskTrackerNodeGroup, cronExpression: cronExpression},
254-
success: function (json) {
255-
if (json && json.success) {
256-
swal("删除成功!", "恭喜你", "success");
257-
that.parents("tr").remove();
258-
} else {
259-
json ? swal(json['msg']) : {};
248+
}, function (isConfirm) {
249+
if(isConfirm){
250+
$.ajax({
251+
url: 'api/job-queue/executable-job-delete',
252+
type: 'POST',
253+
dataType: 'json',
254+
data: {jobId: jobId, taskTrackerNodeGroup: taskTrackerNodeGroup, cronExpression: cronExpression},
255+
success: function (json) {
256+
if (json && json.success) {
257+
swal("删除成功!", "恭喜你", "success");
258+
that.parents("tr").remove();
259+
} else {
260+
json ? swal(json['msg']) : {};
261+
}
260262
}
261-
}
262-
});
263+
});
264+
}
263265
});
264266
});
265267

lts-admin/src/main/webapp/views/templates/jobLogger.vm

Lines changed: 41 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929

3030
<div class="col-sm-3">
3131
<select class="form-control selectpicker" name="taskTrackerNodeGroup">
32+
<option value="">-- 不限 --</option>
3233
#foreach ($nodeGroup in $taskTrackerNodeGroups)
3334
#if ($taskTrackerNodeGroup == $nodeGroup.name)
3435
<option value="$nodeGroup.name" selected>$nodeGroup.name</option>
@@ -39,7 +40,6 @@
3940
</select>
4041
</div>
4142
</div>
42-
<div class="hr-line-dashed"></div>
4343
<div class="form-group row">
4444
<label class="col-sm-2 control-label">时间</label>
4545

@@ -52,6 +52,7 @@
5252
value="$startLogTime"/>
5353
</div>
5454
<label class="control-label" style="width: 20px;float: left;">到</label>
55+
5556
<div class="col-sm-3">
5657
<input class="form-control datepicker" type="text" style="width:160px"
5758
id="endLogTime"
@@ -61,11 +62,14 @@
6162
value="$endLogTime"/>
6263
</div>
6364
<div class="col-sm-2">
64-
<button class="btn btn-primary" type="button" id="searchBtn">
65-
搜索
66-
</button>
65+
<div class="col-sm-2">
66+
<button class="btn btn-primary" type="button" id="searchBtn">
67+
搜索
68+
</button>
69+
</div>
6770
</div>
6871
</div>
72+
<div class="hr-line-dashed"></div>
6973
</form>
7074
</div>
7175
</div>
@@ -96,7 +100,7 @@
96100
<th data-hide="all">日志级别</th>
97101
<th data-hide="all">重试次数</th>
98102
<th data-hide="all">优先级</th>
99-
<th data-hide="phone,tablet">执行时间</th>
103+
<th data-hide="all">执行时间</th>
100104
<th>Cron表达式</th>
101105
<th data-hide="all">反馈客户端</th>
102106
<th data-hide="all">用户参数</th>
@@ -165,10 +169,10 @@
165169

166170
$(document).on("click", "#searchBtn", function () {
167171
var taskId = $("input[name='taskId']").val();
168-
if (!taskId) {
169-
sweetAlert("请输入任务ID", "请输入你提交的任务ID(TaskId)", "error");
170-
return;
171-
}
172+
// if (!taskId) {
173+
// sweetAlert("请输入任务ID", "请输入你提交的任务ID(TaskId)", "error");
174+
// return;
175+
// }
172176
var taskTrackerNodeGroup = $("select[name='taskTrackerNodeGroup']").val();
173177
var startLogTime = $("input[name='startLogTime']").val();
174178
var endLogTime = $("input[name='endLogTime']").val();
@@ -188,16 +192,43 @@
188192
sweetAlert("结束查询时间格式不正确", "格式 yyyy-MM-dd HH:mm:ss", "error");
189193
return;
190194
}
195+
191196
var params = {
192197
taskId: taskId,
193198
taskTrackerNodeGroup: taskTrackerNodeGroup,
194199
startLogTime: startLogTime, endLogTime: endLogTime
195200
};
196-
ltsTable.post(params, 1);
201+
if (!taskId) {
202+
// 如果没有按ID查询,那么要对时间跨度长的做提醒(超过1小时的)
203+
if ((DateUtil.parse(endLogTime).getTime() - DateUtil.parse(startLogTime).getTime()) > 60 * 60 * 1000) {
204+
swal({
205+
title: "确认查询操作?",
206+
text: "您当前查询日志没有按照任务ID查询,时间跨度大于1小时,可能查询结果会比较大 !",
207+
type: "warning",
208+
showCancelButton: true,
209+
confirmButtonColor: "#DD6B55",
210+
cancelButtonText: "取消",
211+
confirmButtonText: "我要查询",
212+
closeOnConfirm: true
213+
}, function (isConfirm) {
214+
if (isConfirm) {
215+
ltsTable.post(params, 1);
216+
}
217+
});
218+
} else {
219+
ltsTable.post(params, 1);
220+
}
221+
} else {
222+
ltsTable.post(params, 1);
223+
}
224+
197225
});
198226

199227
var taskId = $("input[name='taskId']").val();
200228
if (taskId) {
229+
// 如果是按ID查询,要把时间设置长一点
230+
var startLongTime = DateUtil.formatYMDHMD(DateUtil.getDate(new Date(), -10));
231+
$("input[name='startLogTime']").val(startLongTime);
201232
$("#searchBtn").trigger("click");
202233
} else {
203234
ltsTable.renderEmpty();

lts-admin/src/main/webapp/views/templates/nodeGroupManager.vm

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -132,21 +132,23 @@
132132
confirmButtonColor: "#DD6B55",
133133
confirmButtonText: "确认删除",
134134
closeOnConfirm: false
135-
}, function () {
136-
$.ajax({
137-
url: 'api/node/node-group-del',
138-
type: 'POST',
139-
dataType: 'json',
140-
data: {nodeGroup: nodeGroup, nodeType: nodeType},
141-
success: function (json) {
142-
if (json && json.success) {
143-
swal("删除成功!", "恭喜你", "success");
144-
_this.parents("tr").remove();
145-
} else {
146-
json ? swal(json['msg']) : {};
135+
}, function (isConfirm) {
136+
if(isConfirm){
137+
$.ajax({
138+
url: 'api/node/node-group-del',
139+
type: 'POST',
140+
dataType: 'json',
141+
data: {nodeGroup: nodeGroup, nodeType: nodeType},
142+
success: function (json) {
143+
if (json && json.success) {
144+
swal("删除成功!", "恭喜你", "success");
145+
_this.parents("tr").remove();
146+
} else {
147+
json ? swal(json['msg']) : {};
148+
}
147149
}
148-
}
149-
});
150+
});
151+
}
150152
});
151153
});
152154

0 commit comments

Comments
 (0)