Merge branch 'dev' of https://gitea.wangzhiwen.top/0214/ALOps_sys1 into dev
commit
9c18db32cc
@ -0,0 +1,57 @@ |
|||||||
|
package com.alops.system.service.impl; |
||||||
|
|
||||||
|
import com.alops.system.mapper.ScheduleRulesMapper; |
||||||
|
import com.alops.system.service.IAlertSenderService; |
||||||
|
import org.slf4j.Logger; |
||||||
|
import org.slf4j.LoggerFactory; |
||||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||||
|
import org.springframework.stereotype.Component; |
||||||
|
|
||||||
|
import javax.annotation.PostConstruct; |
||||||
|
@Component |
||||||
|
public class ScheduleShutdownHook { |
||||||
|
private static final Logger log = LoggerFactory.getLogger(ScheduleShutdownHook.class); |
||||||
|
|
||||||
|
@Autowired |
||||||
|
private ScheduleRulesMapper scheduleRulesMapper; |
||||||
|
|
||||||
|
@Autowired |
||||||
|
private IAlertSenderService iAlertSenderService; |
||||||
|
|
||||||
|
private static ScheduleShutdownHook instance; |
||||||
|
|
||||||
|
@PostConstruct |
||||||
|
public void init() { |
||||||
|
instance = this; |
||||||
|
registerShutdownHook(); |
||||||
|
} |
||||||
|
|
||||||
|
private void registerShutdownHook() { |
||||||
|
Runtime.getRuntime().addShutdownHook(new Thread(() -> { |
||||||
|
log.info("检测到应用关闭,开始更新任务状态..."); |
||||||
|
updateInterruptedStatus(); |
||||||
|
})); |
||||||
|
} |
||||||
|
|
||||||
|
private void updateInterruptedStatus() { |
||||||
|
try { |
||||||
|
// 将所有状态为1(执行中)、5(等待中)的任务更新为3(执行失败)
|
||||||
|
int affectedRows = scheduleRulesMapper.updateStatusFrom1And5To3(); |
||||||
|
log.info("成功更新 {} 个任务状态为中断", affectedRows); |
||||||
|
|
||||||
|
// 发送站内信
|
||||||
|
if (affectedRows > 0) { |
||||||
|
iAlertSenderService.sendInternalMessage( |
||||||
|
"系统中断", |
||||||
|
"采集任务被外部中断,已更新" + affectedRows + "个任务状态", |
||||||
|
"2" |
||||||
|
); |
||||||
|
} |
||||||
|
|
||||||
|
} catch (Exception e) { |
||||||
|
log.error("中断处理失败: {}", e.getMessage(), e); |
||||||
|
// 备用方案:直接输出到控制台
|
||||||
|
System.err.println("中断处理失败: " + e.getMessage()); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
@ -0,0 +1,15 @@ |
|||||||
|
import request from '@/utils/request' |
||||||
|
import { parseStrEmpty } from "@/utils/ruoyi"; |
||||||
|
|
||||||
|
// 查询预警消息列表
|
||||||
|
export function messageList(query) { |
||||||
|
return request({ |
||||||
|
url: '/message/list', |
||||||
|
method: 'get', |
||||||
|
params: query |
||||||
|
}) |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -0,0 +1,93 @@ |
|||||||
|
<template> |
||||||
|
<div class=""> |
||||||
|
<el-row :gutter="20"> |
||||||
|
<el-col> |
||||||
|
<el-table v-loading="loading" :data="userList"> |
||||||
|
<el-table-column |
||||||
|
label="序号" |
||||||
|
width="60" |
||||||
|
type="index" |
||||||
|
></el-table-column> |
||||||
|
<el-table-column label="ID" align="center" key="id" prop="id" :show-overflow-tooltip="true"> |
||||||
|
<template slot-scope="scope"> |
||||||
|
<span>{{ scope.row.id !== undefined && scope.row.id !== null ? scope.row.id : '--' }}</span> |
||||||
|
</template> |
||||||
|
</el-table-column> |
||||||
|
<el-table-column label="单板ID" align="center" key="veneerId" prop="veneerId" :show-overflow-tooltip="true"> |
||||||
|
<template slot-scope="scope"> |
||||||
|
<span>{{ scope.row.veneerId !== undefined && scope.row.veneerId !== null ? scope.row.veneerId : '--' }}</span> |
||||||
|
</template> |
||||||
|
</el-table-column> |
||||||
|
<el-table-column label="设备ID" align="center" key="equId" prop="equId" :show-overflow-tooltip="true"> |
||||||
|
<template slot-scope="scope"> |
||||||
|
<span>{{ scope.row.equId !== undefined && scope.row.equId !== null ? scope.row.equId : '--' }}</span> |
||||||
|
</template> |
||||||
|
</el-table-column> |
||||||
|
<el-table-column label="单板状态" align="center" key="veneerStatus" prop="veneerStatus" :show-overflow-tooltip="true"> |
||||||
|
<template slot-scope="scope"> |
||||||
|
<span>{{ scope.row.veneerStatus !== undefined && scope.row.veneerStatus !== null ? scope.row.veneerStatus : '--' }}</span> |
||||||
|
</template> |
||||||
|
</el-table-column> |
||||||
|
<el-table-column label="采集ID" align="center" key="equGatherId" prop="equGatherId" :show-overflow-tooltip="true"> |
||||||
|
<template slot-scope="scope"> |
||||||
|
<span>{{ scope.row.equGatherId !== undefined && scope.row.equGatherId !== null ? scope.row.equGatherId : '--' }}</span> |
||||||
|
</template> |
||||||
|
</el-table-column> |
||||||
|
</el-table> |
||||||
|
</el-col> |
||||||
|
</el-row> |
||||||
|
</div> |
||||||
|
</template> |
||||||
|
|
||||||
|
<script> |
||||||
|
import { systemVeneer } from "@/api/inMonitoring/devicesState" |
||||||
|
import "@riophae/vue-treeselect/dist/vue-treeselect.css" |
||||||
|
import "splitpanes/dist/splitpanes.css" |
||||||
|
|
||||||
|
export default { |
||||||
|
props: { |
||||||
|
dsId: { |
||||||
|
type: String, |
||||||
|
default: 'chart' |
||||||
|
} |
||||||
|
}, |
||||||
|
data() { |
||||||
|
return { |
||||||
|
// 遮罩层 |
||||||
|
loading: true, |
||||||
|
// 总条数 |
||||||
|
total: 0, |
||||||
|
// 类型表格数据 |
||||||
|
userList: null, |
||||||
|
// 查询参数 |
||||||
|
queryParams: { |
||||||
|
pageNum: 1, |
||||||
|
pageSize: 10, |
||||||
|
name: undefined |
||||||
|
}, |
||||||
|
} |
||||||
|
}, |
||||||
|
created() { |
||||||
|
}, |
||||||
|
watch: { |
||||||
|
dsId: { |
||||||
|
handler(val) { |
||||||
|
this.getList(val) |
||||||
|
}, |
||||||
|
deep: true, |
||||||
|
immediate: true |
||||||
|
} |
||||||
|
}, |
||||||
|
methods: { |
||||||
|
/** 查询类型列表 */ |
||||||
|
getList(id) { |
||||||
|
this.loading = true |
||||||
|
systemVeneer(id).then(response => { |
||||||
|
this.userList = response.rows |
||||||
|
this.loading = false |
||||||
|
} |
||||||
|
) |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
</script> |
||||||
@ -0,0 +1,95 @@ |
|||||||
|
<template> |
||||||
|
<div class="app-container"> |
||||||
|
<el-row :gutter="20"> |
||||||
|
<splitpanes :horizontal="this.$store.getters.device === 'mobile'" class="default-theme"> |
||||||
|
<!--设备档案--> |
||||||
|
<pane size="84"> |
||||||
|
<el-col> |
||||||
|
<el-table v-loading="loading" :data="dataList"> |
||||||
|
<el-table-column type="selection" width="50" align="center" /> |
||||||
|
<el-table-column |
||||||
|
label="序号" |
||||||
|
width="60" |
||||||
|
type="index" |
||||||
|
></el-table-column> |
||||||
|
<el-table-column label="消息ID" align="center" key="id" prop="id" width="80" /> |
||||||
|
<el-table-column label="用户ID" align="center" key="userId" prop="userId" width="80" /> |
||||||
|
<el-table-column label="消息内容" align="center" key="content" prop="content" :show-overflow-tooltip="true"> |
||||||
|
<template slot-scope="scope"> |
||||||
|
<span>{{ scope.row.content || '--' }}</span> |
||||||
|
</template> |
||||||
|
</el-table-column> |
||||||
|
<el-table-column label="消息状态" align="center" key="status" prop="status" width="100"> |
||||||
|
<template slot-scope="scope"> |
||||||
|
<el-tag :type="scope.row.status === 'unread' ? 'primary' : 'success'"> |
||||||
|
{{ scope.row.status === 'unread' ? '未读' : '已读' }} |
||||||
|
</el-tag> |
||||||
|
</template> |
||||||
|
</el-table-column> |
||||||
|
<el-table-column label="标题" align="center" key="title" prop="title" :show-overflow-tooltip="true"> |
||||||
|
<template slot-scope="scope"> |
||||||
|
<span>{{ scope.row.title || '--' }}</span> |
||||||
|
</template> |
||||||
|
</el-table-column> |
||||||
|
<el-table-column label="创建时间" align="center" prop="createTime" width="180"> |
||||||
|
<template slot-scope="scope"> |
||||||
|
<span>{{ parseTime(scope.row.createTime) }}</span> |
||||||
|
</template> |
||||||
|
</el-table-column> |
||||||
|
</el-table> |
||||||
|
|
||||||
|
<pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNum" :limit.sync="queryParams.pageSize" @pagination="getList" /> |
||||||
|
</el-col> |
||||||
|
</pane> |
||||||
|
</splitpanes> |
||||||
|
</el-row> |
||||||
|
</div> |
||||||
|
</template> |
||||||
|
|
||||||
|
<script> |
||||||
|
import { messageList } from "@/api/message/index" |
||||||
|
import { Splitpanes, Pane } from "splitpanes" |
||||||
|
import "splitpanes/dist/splitpanes.css" |
||||||
|
|
||||||
|
export default { |
||||||
|
name: "Message", |
||||||
|
components: { Splitpanes, Pane }, |
||||||
|
data() { |
||||||
|
return { |
||||||
|
// 遮罩层 |
||||||
|
loading: true, |
||||||
|
|
||||||
|
|
||||||
|
// 总条数 |
||||||
|
total: 0, |
||||||
|
// 消息数据列表 |
||||||
|
dataList: [], |
||||||
|
// 查询参数 |
||||||
|
queryParams: { |
||||||
|
pageNum: 1, |
||||||
|
pageSize: 10, |
||||||
|
status: undefined |
||||||
|
}, |
||||||
|
|
||||||
|
} |
||||||
|
}, |
||||||
|
|
||||||
|
created() { |
||||||
|
this.getList() |
||||||
|
}, |
||||||
|
methods: { |
||||||
|
/** 查询设备列表 */ |
||||||
|
getList() { |
||||||
|
this.loading = true |
||||||
|
messageList(this.queryParams).then(response => { |
||||||
|
this.dataList = response.data || [] |
||||||
|
this.total = response.data?.length || 0 |
||||||
|
this.loading = false |
||||||
|
} |
||||||
|
) |
||||||
|
}, |
||||||
|
|
||||||
|
|
||||||
|
} |
||||||
|
} |
||||||
|
</script> |
||||||
Loading…
Reference in new issue