增加版本更新功能
This commit is contained in:
@@ -43,8 +43,7 @@ public class KitToAcsController {
|
|||||||
for (String o : kitToAcsParam.keySet()) {
|
for (String o : kitToAcsParam.keySet()) {
|
||||||
param = JSONObject.parseObject(o);
|
param = JSONObject.parseObject(o);
|
||||||
}
|
}
|
||||||
log.info("---kit上报请求---"+param.toString());
|
log.info("---kit上报请求---{}", param);
|
||||||
System.out.println("---kit上报请求---"+param.toString());
|
|
||||||
return new ResponseEntity<>(kitToAcsService.agvCallback(param), HttpStatus.OK);
|
return new ResponseEntity<>(kitToAcsService.agvCallback(param), HttpStatus.OK);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ public enum TaskStateEnum {
|
|||||||
*/
|
*/
|
||||||
public static TaskStateEnum fromValue(String value) {
|
public static TaskStateEnum fromValue(String value) {
|
||||||
for (TaskStateEnum state : values()) {
|
for (TaskStateEnum state : values()) {
|
||||||
if (state.getValue() == value) {
|
if (state.getValue().equals(value)) {
|
||||||
return state;
|
return state;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -144,6 +144,8 @@ security:
|
|||||||
- /api/localStorage/pictures
|
- /api/localStorage/pictures
|
||||||
# 参数
|
# 参数
|
||||||
- /api/param/getValueByCode
|
- /api/param/getValueByCode
|
||||||
|
# 版本
|
||||||
|
- /api/version/current
|
||||||
mybatis-plus:
|
mybatis-plus:
|
||||||
configuration:
|
configuration:
|
||||||
map-underscore-to-camel-case: false
|
map-underscore-to-camel-case: false
|
||||||
|
|||||||
@@ -1,17 +1,37 @@
|
|||||||
<template>
|
<template>
|
||||||
<div id="app" @mousemove="moveEvent" @click="moveEvent">
|
<div id="app" @mousemove="moveEvent" @click="moveEvent">
|
||||||
<router-view />
|
<router-view />
|
||||||
|
<version-notification ref="versionDialog" />
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
import VersionNotification from '@/components/VersionNotification/VersionNotification.vue'
|
||||||
|
import { getCurrentVersion } from '@/api/system/version'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'App',
|
name: 'App',
|
||||||
|
components: {
|
||||||
|
VersionNotification
|
||||||
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
timmer: null
|
timmer: null,
|
||||||
|
pollTimer: null,
|
||||||
|
pollIntervalMs: 30000
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
mounted() {
|
||||||
|
this.$bus.on('version_update', (msg) => {
|
||||||
|
this.checkVersion(msg.version)
|
||||||
|
})
|
||||||
|
this.startPolling()
|
||||||
|
this.checkVersionOnLogin()
|
||||||
|
},
|
||||||
|
beforeDestroy() {
|
||||||
|
clearInterval(this.pollTimer)
|
||||||
|
this.$bus.off('version_update')
|
||||||
|
},
|
||||||
methods: {
|
methods: {
|
||||||
moveEvent: function() {
|
moveEvent: function() {
|
||||||
const path = ['/login']
|
const path = ['/login']
|
||||||
@@ -24,12 +44,46 @@ export default {
|
|||||||
this.timmer = setTimeout(() => {
|
this.timmer = setTimeout(() => {
|
||||||
sessionStorage.clear()
|
sessionStorage.clear()
|
||||||
this.logout()
|
this.logout()
|
||||||
}, 1000 * 60 * 151) // 15分钟 https://blog.csdn.net/qq_42345108/article/details/103496456
|
}, 1000 * 60 * 151)
|
||||||
},
|
},
|
||||||
logout() {
|
logout() {
|
||||||
this.$store.dispatch('LogOut').then(() => {
|
this.$store.dispatch('LogOut').then(() => {
|
||||||
location.reload()
|
location.reload()
|
||||||
})
|
})
|
||||||
|
},
|
||||||
|
checkVersion(serverVersion) {
|
||||||
|
const lastSeen = localStorage.getItem('lastSeenVersion')
|
||||||
|
if (!serverVersion || serverVersion === lastSeen) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
this.$refs.versionDialog.show(serverVersion)
|
||||||
|
},
|
||||||
|
checkVersionOnLogin() {
|
||||||
|
const token = localStorage.getItem('token') || sessionStorage.getItem('token')
|
||||||
|
if (!token) return
|
||||||
|
getCurrentVersion().then(res => {
|
||||||
|
if (!res.enabled) return
|
||||||
|
this.checkVersion(res.version)
|
||||||
|
})
|
||||||
|
},
|
||||||
|
startPolling() {
|
||||||
|
this.pollTimer = setInterval(() => {
|
||||||
|
getCurrentVersion().then(res => {
|
||||||
|
if (!res.enabled) return
|
||||||
|
this.checkVersion(res.version)
|
||||||
|
const interval = (res.pollInterval || 30) * 1000
|
||||||
|
if (interval !== this.pollIntervalMs) {
|
||||||
|
this.pollIntervalMs = interval
|
||||||
|
clearInterval(this.pollTimer)
|
||||||
|
this.pollTimer = setInterval(() => {
|
||||||
|
getCurrentVersion().then(r => {
|
||||||
|
if (!r.enabled) return
|
||||||
|
this.checkVersion(r.version)
|
||||||
|
})
|
||||||
|
}, interval)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}, this.pollIntervalMs)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -115,6 +115,22 @@ export default {
|
|||||||
'disk': 'Disk Utilization',
|
'disk': 'Disk Utilization',
|
||||||
'cpu_monitoring': 'Cpu Utilization Monitoring',
|
'cpu_monitoring': 'Cpu Utilization Monitoring',
|
||||||
'memory_monitoring': 'Memory Utilization Monitoring'
|
'memory_monitoring': 'Memory Utilization Monitoring'
|
||||||
|
},
|
||||||
|
'version': {
|
||||||
|
'title': 'System Version Update',
|
||||||
|
'versionNo': 'Version',
|
||||||
|
'releaseTime': 'Release Time',
|
||||||
|
'content': 'Update Content',
|
||||||
|
'confirm': 'I Know',
|
||||||
|
'releaseTitle': 'Publish Version Notice',
|
||||||
|
'noticeTitle': 'Notice Title',
|
||||||
|
'release': 'Publish',
|
||||||
|
'currentInfo': 'Current Version Info',
|
||||||
|
'switch': 'Notification Switch',
|
||||||
|
'pollInterval': 'Polling Interval',
|
||||||
|
'enabled': 'Enabled',
|
||||||
|
'disabled': 'Disabled',
|
||||||
|
'seconds': 's'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -115,6 +115,22 @@ export default {
|
|||||||
'disk': 'Kadar penggunaan disk',
|
'disk': 'Kadar penggunaan disk',
|
||||||
'cpu_monitoring': 'Monitor penggunaan CPU',
|
'cpu_monitoring': 'Monitor penggunaan CPU',
|
||||||
'memory_monitoring': 'Monitor penggunaan memori'
|
'memory_monitoring': 'Monitor penggunaan memori'
|
||||||
|
},
|
||||||
|
'version': {
|
||||||
|
'title': 'Update Versi Sistem',
|
||||||
|
'versionNo': 'Versi',
|
||||||
|
'releaseTime': 'Waktu Rilis',
|
||||||
|
'content': 'Konten Update',
|
||||||
|
'confirm': 'Saya Mengerti',
|
||||||
|
'releaseTitle': 'Terbitkan Notifikasi Versi',
|
||||||
|
'noticeTitle': 'Judul Notifikasi',
|
||||||
|
'release': 'Terbitkan',
|
||||||
|
'currentInfo': 'Info Versi Saat Ini',
|
||||||
|
'switch': 'Sakelar Notifikasi',
|
||||||
|
'pollInterval': 'Interval Polling',
|
||||||
|
'enabled': 'Diaktifkan',
|
||||||
|
'disabled': 'Dinonaktifkan',
|
||||||
|
'seconds': 'detik'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -115,6 +115,22 @@ export default {
|
|||||||
'disk': '磁盘使用率',
|
'disk': '磁盘使用率',
|
||||||
'cpu_monitoring': 'CPU使用率监控',
|
'cpu_monitoring': 'CPU使用率监控',
|
||||||
'memory_monitoring': '内存使用率监控'
|
'memory_monitoring': '内存使用率监控'
|
||||||
|
},
|
||||||
|
'version': {
|
||||||
|
'title': '系统版本更新',
|
||||||
|
'versionNo': '版本号',
|
||||||
|
'releaseTime': '发布时间',
|
||||||
|
'content': '更新内容',
|
||||||
|
'confirm': '我知道了',
|
||||||
|
'releaseTitle': '发布版本通知',
|
||||||
|
'noticeTitle': '通知标题',
|
||||||
|
'release': '发布',
|
||||||
|
'currentInfo': '当前版本信息',
|
||||||
|
'switch': '通知开关',
|
||||||
|
'pollInterval': '轮询间隔',
|
||||||
|
'enabled': '已启用',
|
||||||
|
'disabled': '已禁用',
|
||||||
|
'seconds': '秒'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -168,8 +168,11 @@ export default {
|
|||||||
webSocketOnMessage(e) {
|
webSocketOnMessage(e) {
|
||||||
const data = JSON.parse(e.data)
|
const data = JSON.parse(e.data)
|
||||||
if (data.msgType === 'INFO') {
|
if (data.msgType === 'INFO') {
|
||||||
console.log('data', data)
|
if (data.msg.data === 'notice_message_update') {
|
||||||
this.$bus.emit(data.msg.data, data.msg.msgType)
|
this.$bus.emit(data.msg.data, data.msg.msgType)
|
||||||
|
} else if (data.msg.data === 'version_update') {
|
||||||
|
this.$bus.emit('version_update', data.msg)
|
||||||
|
}
|
||||||
} else if (data.msgType === 'ERROR') {
|
} else if (data.msgType === 'ERROR') {
|
||||||
this.$notify({
|
this.$notify({
|
||||||
title: '',
|
title: '',
|
||||||
|
|||||||
@@ -13,3 +13,6 @@ export const NOTICE_MESSAGE_UPDATE = 'notice_message_update'
|
|||||||
* ws测试事件
|
* ws测试事件
|
||||||
*/
|
*/
|
||||||
export const EVENT_TEST_WEBSOCKET = 'event_test_websocket'
|
export const EVENT_TEST_WEBSOCKET = 'event_test_websocket'
|
||||||
|
|
||||||
|
/** 版本更新 */
|
||||||
|
export const VERSION_UPDATE = 'version_update'
|
||||||
|
|||||||
Reference in New Issue
Block a user