新增调度日志接口
This commit is contained in:
@@ -2,7 +2,7 @@ import request from '@/utils/request'
|
||||
|
||||
export function fetchList(query) {
|
||||
return request({
|
||||
url: '/job-Log/page',
|
||||
url: '/job-log/page',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
|
||||
@@ -25,8 +25,8 @@ service.interceptors.request.use(config => {
|
||||
// respone interceptor
|
||||
service.interceptors.response.use(
|
||||
response => {
|
||||
console.log('response', response)
|
||||
console.log('router', this.router)
|
||||
// console.log('response', response)
|
||||
// console.log('router', this.router)
|
||||
const res = response.data
|
||||
if (res.code !== 0) {
|
||||
Message({
|
||||
|
||||
@@ -20,9 +20,9 @@
|
||||
<span>{{scope.row.param}}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" :label="$t('table.jobLogCode')" width="200">
|
||||
<el-table-column align="center" :label="$t('table.jobLogCode')" width="120">
|
||||
<template slot-scope="scope">
|
||||
<span>{{scope.row.code}}</span>
|
||||
<el-tag :type="scope.row.code | statusFilter">{{scope.row.code | statusName}}</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" :label="$t('table.jobLogMsg')" width="400">
|
||||
@@ -30,12 +30,12 @@
|
||||
<span>{{scope.row.msg}}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" :label="$t('table.alarmStatus')" width="200">
|
||||
<el-table-column align="center" :label="$t('table.alarmStatus')" width="120">
|
||||
<template slot-scope="scope">
|
||||
<span>{{scope.row.alarmStatus}}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column width="150px" align="center" :label="$t('table.createTime')">
|
||||
<el-table-column align="center" :label="$t('table.createTime')" width="150">
|
||||
<template slot-scope="scope">
|
||||
<span>{{scope.row.createTime | parseTime('{y}-{m}-{d} {h}:{i}')}}</span>
|
||||
</template>
|
||||
@@ -77,20 +77,30 @@ export default {
|
||||
}
|
||||
},
|
||||
filters: {
|
||||
statusName(status) {
|
||||
const statusMap = {
|
||||
0: '成功',
|
||||
1: '失败'
|
||||
}
|
||||
return statusMap[status]
|
||||
},
|
||||
statusFilter(status) {
|
||||
const statusMap = {
|
||||
1: 'success',
|
||||
2: 'danger'
|
||||
0: 'success',
|
||||
1: 'danger'
|
||||
}
|
||||
return statusMap[status]
|
||||
}
|
||||
},
|
||||
created() {
|
||||
// this.getList()
|
||||
this.getList()
|
||||
},
|
||||
activated() {
|
||||
this.listQuery.jobId = this.$route.query.jobId
|
||||
// this.getList()
|
||||
if (this.$route.query.jobId) {
|
||||
this.listQuery.jobId = this.$route.query.jobId
|
||||
console.log(this.listQuery.jobId, this.$route.query.jobId)
|
||||
this.getList()
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
getList() {
|
||||
|
||||
+41
@@ -0,0 +1,41 @@
|
||||
/**
|
||||
* Copyright (c) 2022 aoshiguchen
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
package fun.asgc.neutrino.proxy.server.constant;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* 启用状态枚举
|
||||
* @author: zCans
|
||||
* @date: 2022/9/25
|
||||
*/
|
||||
@Getter
|
||||
@AllArgsConstructor
|
||||
public enum AlarmStatusEnum {
|
||||
WAIT(1, "待发送"),
|
||||
SUCCESS(2, "发送成功"),
|
||||
ERROR(3, "发送失败");
|
||||
|
||||
private Integer status;
|
||||
private String desc;
|
||||
}
|
||||
+54
@@ -0,0 +1,54 @@
|
||||
/**
|
||||
* Copyright (c) 2022 aoshiguchen
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
package fun.asgc.neutrino.proxy.server.controller;
|
||||
|
||||
import fun.asgc.neutrino.core.annotation.Autowired;
|
||||
import fun.asgc.neutrino.core.annotation.NonIntercept;
|
||||
import fun.asgc.neutrino.core.db.page.Page;
|
||||
import fun.asgc.neutrino.core.db.page.PageQuery;
|
||||
import fun.asgc.neutrino.core.web.annotation.*;
|
||||
import fun.asgc.neutrino.proxy.server.controller.req.*;
|
||||
import fun.asgc.neutrino.proxy.server.controller.res.*;
|
||||
import fun.asgc.neutrino.proxy.server.service.JobLogService;
|
||||
import fun.asgc.neutrino.proxy.server.util.ParamCheckUtil;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author: zCans
|
||||
* @date: 2022/9/25
|
||||
*/
|
||||
@Slf4j
|
||||
@NonIntercept
|
||||
@RequestMapping("job-log")
|
||||
@RestController
|
||||
public class JobLogController {
|
||||
@Autowired
|
||||
private JobLogService jobLogService;
|
||||
|
||||
@GetMapping("page")
|
||||
public Page<JobLogListRes> page(PageQuery pageQuery, JobLogListReq req) {
|
||||
ParamCheckUtil.checkNotNull(pageQuery, "pageQuery");
|
||||
return jobLogService.page(pageQuery, req);
|
||||
}
|
||||
|
||||
}
|
||||
+34
@@ -0,0 +1,34 @@
|
||||
/**
|
||||
* Copyright (c) 2022 aoshiguchen
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
package fun.asgc.neutrino.proxy.server.controller.req;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 端口映射列表请求
|
||||
* @author: zCans
|
||||
* @date: 2022/9/12
|
||||
*/
|
||||
@Data
|
||||
public class JobLogListReq {
|
||||
public Integer jobId;
|
||||
}
|
||||
+65
@@ -0,0 +1,65 @@
|
||||
/**
|
||||
* Copyright (c) 2022 aoshiguchen
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
package fun.asgc.neutrino.proxy.server.controller.res;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 调度日志列表响应
|
||||
* @author: zCans
|
||||
* @date: 2022/9/12
|
||||
*/
|
||||
@Data
|
||||
public class JobLogListRes {
|
||||
private Integer id;
|
||||
/**
|
||||
* job_id
|
||||
*/
|
||||
private Integer jobId;
|
||||
/**
|
||||
* 处理器
|
||||
*/
|
||||
private String handler;
|
||||
/**
|
||||
* 任务参数
|
||||
*/
|
||||
private String param;
|
||||
/**
|
||||
* code
|
||||
*/
|
||||
private Integer code;
|
||||
/**
|
||||
* msg
|
||||
*/
|
||||
private String msg;
|
||||
/**
|
||||
* 报警状态
|
||||
* {@link fun.asgc.neutrino.proxy.server.constant.AlarmStatusEnum}
|
||||
*/
|
||||
private Integer alarmStatus;
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private Date createTime;
|
||||
}
|
||||
+17
@@ -22,9 +22,17 @@
|
||||
package fun.asgc.neutrino.proxy.server.dal;
|
||||
|
||||
import fun.asgc.neutrino.core.annotation.Component;
|
||||
import fun.asgc.neutrino.core.annotation.Param;
|
||||
import fun.asgc.neutrino.core.aop.Intercept;
|
||||
import fun.asgc.neutrino.core.db.annotation.Insert;
|
||||
import fun.asgc.neutrino.core.db.annotation.ResultType;
|
||||
import fun.asgc.neutrino.core.db.annotation.Select;
|
||||
import fun.asgc.neutrino.core.db.mapper.SqlMapper;
|
||||
import fun.asgc.neutrino.core.db.page.Page;
|
||||
import fun.asgc.neutrino.proxy.server.controller.req.JobInfoListReq;
|
||||
import fun.asgc.neutrino.proxy.server.controller.req.JobLogListReq;
|
||||
import fun.asgc.neutrino.proxy.server.controller.res.JobInfoListRes;
|
||||
import fun.asgc.neutrino.proxy.server.controller.res.JobLogListRes;
|
||||
import fun.asgc.neutrino.proxy.server.dal.entity.JobInfoDO;
|
||||
import fun.asgc.neutrino.proxy.server.dal.entity.JobLogDO;
|
||||
|
||||
@@ -39,4 +47,13 @@ public interface JobLogMapper extends SqlMapper {
|
||||
|
||||
@Insert("insert into job_log(`job_id`,`handler`,`param`,`code`,`msg`,`alarm_status`,`create_time`) values(:jobId,:handler,:param,:code,:msg,:alarmStatus,:createTime)")
|
||||
void add(JobLogDO jobLog);
|
||||
|
||||
@ResultType(JobLogListRes.class)
|
||||
@Select("select * from job_log order by create_time desc")
|
||||
void page(Page page, JobLogListReq req);
|
||||
|
||||
@ResultType(JobLogListRes.class)
|
||||
@Select("select * from job_log where job_id = :jobId order by create_time desc")
|
||||
void pageByJobId(Page page, JobLogListReq req);
|
||||
|
||||
}
|
||||
|
||||
+17
@@ -24,8 +24,14 @@ package fun.asgc.neutrino.proxy.server.service;
|
||||
import fun.asgc.neutrino.core.annotation.Autowired;
|
||||
import fun.asgc.neutrino.core.annotation.Component;
|
||||
import fun.asgc.neutrino.core.annotation.NonIntercept;
|
||||
import fun.asgc.neutrino.core.db.page.Page;
|
||||
import fun.asgc.neutrino.core.db.page.PageQuery;
|
||||
import fun.asgc.neutrino.core.quartz.IJobCallback;
|
||||
import fun.asgc.neutrino.core.quartz.JobInfo;
|
||||
import fun.asgc.neutrino.proxy.server.controller.req.JobInfoListReq;
|
||||
import fun.asgc.neutrino.proxy.server.controller.req.JobLogListReq;
|
||||
import fun.asgc.neutrino.proxy.server.controller.res.JobInfoListRes;
|
||||
import fun.asgc.neutrino.proxy.server.controller.res.JobLogListRes;
|
||||
import fun.asgc.neutrino.proxy.server.dal.JobLogMapper;
|
||||
import fun.asgc.neutrino.proxy.server.dal.entity.JobLogDO;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
@@ -68,4 +74,15 @@ public class JobLogService implements IJobCallback {
|
||||
);
|
||||
}
|
||||
|
||||
public Page<JobLogListRes> page(PageQuery pageQuery, JobLogListReq req) {
|
||||
Page<JobLogListRes> page = Page.create(pageQuery);
|
||||
|
||||
if(req.getJobId() != null){
|
||||
jobLogMapper.pageByJobId(page, req);
|
||||
} else {
|
||||
jobLogMapper.page(page, req);
|
||||
}
|
||||
return page;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user