张江玮 2 years ago
parent
commit
c41273bdad
  1. 26
      acs/nladmin-system/src/main/java/org/nl/autotask/CleanLog.java
  2. 76
      acs/nladmin-ui/src/App.vue
  3. 26
      lms/nladmin-system/src/main/java/org/nl/wms/autotask/CleanLog.java
  4. 76
      lms/nladmin-ui/src/App.vue

26
acs/nladmin-system/src/main/java/org/nl/autotask/CleanLog.java

@ -0,0 +1,26 @@
package org.nl.wms.autotask;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.nl.modules.system.service.ParamService;
import org.nl.modules.wql.core.bean.WQLObject;
import org.springframework.stereotype.Component;
/**
* 自动清除日志(操作日志异常日志)数据
*/
@Slf4j
@Component
@RequiredArgsConstructor
public class CleanLog {
private final ParamService paramService;
public void run(){
//delete from sys_log where DATE(create_time) <= DATE(DATE_SUB(NOW(),INTERVAL 30 day)) limit 10;
WQLObject logTab = WQLObject.getWQLObject("sys_log");
int days = Integer.parseInt(paramService.findByCode("log_day").getValue());
logTab.delete("DATE(create_time) <= DATE(DATE_SUB(NOW(),INTERVAL " + days + " day))");
log.info("自动清理日志执行成功...!");
}
}

76
acs/nladmin-ui/src/App.vue

@ -1,5 +1,5 @@
<template>
<div id="app">
<div id="app" @mousemove="moveEvent" @click="moveEvent">
<router-view />
</div>
</template>
@ -7,63 +7,29 @@
<script>
export default {
name: 'App',
created() {
this.webSocket() // token
data() {
return {
timmer: null
}
},
methods: {
webSocket() {
const that = this
if (typeof (WebSocket) === 'undefined') {
this.$notify({
title: '提示',
message: '当前浏览器无法接收实时报警信息,请使用谷歌浏览器!',
type: 'warning',
duration: 0
})
} else {
const id = 'exp-token'
// tokenvuex
// socket使IP
// const socketUrl = process.env.VUE_APP_WS_API + id
const wsUri = window.g.prod.VUE_APP_BASE_API.replace('http', 'ws') + '/webSocket/' + id
this.socket = new WebSocket(wsUri)
// socket
this.socket.onopen = function() {
that.socket.send('测试客户端发送消息')
}
const _this = this
// socket
this.socket.onmessage = function(msg) {
const data = JSON.parse(msg.data)
_this.$confirm(data.msg, '提示', {
confirmButtonText: '确定',
closeOnClickModal: false,
showCancelButton: false,
type: 'warning'
}).then(() => {
_this.$router.push('/login')
}).catch(() => {
this.$message({
type: 'info',
message: '已取消'
})
})
}
// socket
this.socket.onerror = function() {
that.$notify({
title: '错误',
message: '服务器错误,无法接收实时报警信息',
type: 'error',
duration: 0
})
}
// socket
this.socket.onclose = function() {
console.log('WebSocket已关闭')
}
moveEvent: function() {
const path = ['/login']
if (!path.includes(this.$route.path)) {
clearTimeout(this.timmer)
this.init()
}
},
init: function() {
this.timmer = setTimeout(() => {
sessionStorage.clear()
this.logout()
}, 1000 * 60 * 15) // 15分钟 https://blog.csdn.net/qq_42345108/article/details/103496456
},
logout() {
this.$store.dispatch('LogOut').then(() => {
location.reload()
})
}
}
}

26
lms/nladmin-system/src/main/java/org/nl/wms/autotask/CleanLog.java

@ -0,0 +1,26 @@
package org.nl.wms.autotask;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.nl.modules.system.service.ParamService;
import org.nl.modules.wql.core.bean.WQLObject;
import org.springframework.stereotype.Component;
/**
* 自动清除日志(操作日志异常日志)数据
*/
@Slf4j
@Component
@RequiredArgsConstructor
public class CleanLog {
private final ParamService paramService;
public void run(){
//delete from sys_log where DATE(create_time) <= DATE(DATE_SUB(NOW(),INTERVAL 30 day)) limit 10;
WQLObject logTab = WQLObject.getWQLObject("sys_log");
int days = Integer.parseInt(paramService.findByCode("log_day").getValue());
logTab.delete("DATE(create_time) <= DATE(DATE_SUB(NOW(),INTERVAL " + days + " day))");
log.info("自动清理日志执行成功...!");
}
}

76
lms/nladmin-ui/src/App.vue

@ -1,5 +1,5 @@
<template>
<div id="app">
<div id="app" @mousemove="moveEvent" @click="moveEvent">
<router-view />
</div>
</template>
@ -7,63 +7,29 @@
<script>
export default {
name: 'App',
created() {
this.webSocket() // token
data() {
return {
timmer: null
}
},
methods: {
webSocket() {
const that = this
if (typeof (WebSocket) === 'undefined') {
this.$notify({
title: '提示',
message: '当前浏览器无法接收实时报警信息,请使用谷歌浏览器!',
type: 'warning',
duration: 0
})
} else {
const id = 'exp-token'
// tokenvuex
// socket使IP
// const socketUrl = process.env.VUE_APP_WS_API + id
const wsUri = window.g.prod.VUE_APP_BASE_API.replace('http', 'ws') + '/webSocket/' + id
this.socket = new WebSocket(wsUri)
// socket
this.socket.onopen = function() {
that.socket.send('测试客户端发送消息')
}
const _this = this
// socket
this.socket.onmessage = function(msg) {
const data = JSON.parse(msg.data)
_this.$confirm(data.msg, '提示', {
confirmButtonText: '确定',
closeOnClickModal: false,
showCancelButton: false,
type: 'warning'
}).then(() => {
_this.$router.push('/login')
}).catch(() => {
this.$message({
type: 'info',
message: '已取消'
})
})
}
// socket
this.socket.onerror = function() {
that.$notify({
title: '错误',
message: '服务器错误,无法接收实时报警信息',
type: 'error',
duration: 0
})
}
// socket
this.socket.onclose = function() {
console.log('WebSocket已关闭')
}
moveEvent: function() {
const path = ['/login']
if (!path.includes(this.$route.path)) {
clearTimeout(this.timmer)
this.init()
}
},
init: function() {
this.timmer = setTimeout(() => {
sessionStorage.clear()
this.logout()
}, 1000 * 60 * 15) // 15分钟 https://blog.csdn.net/qq_42345108/article/details/103496456
},
logout() {
this.$store.dispatch('LogOut').then(() => {
location.reload()
})
}
}
}

Loading…
Cancel
Save