Browse Source

update

main
wangshaoping 11 months ago
parent
commit
aad4a4dac2
  1. 2
      gradle.properties
  2. 24
      io.sc.platform.core.frontend/package.json
  3. 12
      io.sc.platform.core.frontend/src/platform/components/grid/WGrid.vue
  4. 4
      io.sc.platform.core.frontend/src/platform/plugin/quasar.ts
  5. 15
      io.sc.platform.core.frontend/template-project/package.json
  6. 44
      io.sc.platform.core/src/main/java/io/sc/platform/core/util/DateUtil.java
  7. 1
      io.sc.platform.monitor/build.gradle
  8. 960
      io.sc.platform.monitor/doc/database/structure.erm
  9. 34
      io.sc.platform.monitor/doc/database/structure.sql
  10. 4
      io.sc.platform.monitor/src/main/java/io/sc/platform/monitor/service/SystemMonitor.java
  11. 21
      io.sc.platform.monitor/src/main/java/io/sc/platform/monitor/service/impl/SystemMonitorImpl.java
  12. 28
      io.sc.platform.monitor/src/main/java/io/sc/platform/monitor/service/support/Cpu.java
  13. 45
      io.sc.platform.monitor/src/main/java/io/sc/platform/monitor/service/support/Disk.java
  14. 85
      io.sc.platform.monitor/src/main/java/io/sc/platform/monitor/service/support/Hardware.java
  15. 35
      io.sc.platform.monitor/src/main/java/io/sc/platform/monitor/service/support/Jvm.java
  16. 23
      io.sc.platform.monitor/src/main/java/io/sc/platform/monitor/service/support/Memory.java
  17. 95
      io.sc.platform.monitor/src/main/java/io/sc/platform/monitor/service/support/Os.java
  18. 174
      io.sc.platform.monitor/src/main/java/io/sc/platform/monitor/service/support/Server.java
  19. 82
      io.sc.platform.monitor/src/main/java/io/sc/platform/monitor/service/support/ServerInfo.java
  20. 68
      io.sc.platform.monitor/src/main/java/io/sc/platform/monitor/service/support/Sys.java
  21. 94
      io.sc.platform.monitor/src/main/java/io/sc/platform/monitor/service/support/SysFile.java
  22. 2
      io.sc.platform.monitor/src/main/resources/META-INF/MANIFEST.MF
  23. 15
      io.sc.platform.monitor/src/main/resources/META-INF/spring.factories
  24. 3
      io.sc.platform.mvc/src/main/java/io/sc/platform/mvc/autoconfigure/MvcWebMvcAutoConfiguration.java
  25. 44
      io.sc.platform.mvc/src/main/java/io/sc/platform/mvc/autoconfigure/support/OnlineUserCounterInterceptor.java
  26. 2
      io.sc.platform.system.frontend/package.json
  27. 4
      io.sc.platform.system.frontend/src/components/index.ts
  28. 9
      io.sc.platform.system.frontend/src/i18n/messages.json
  29. 9
      io.sc.platform.system.frontend/src/i18n/messages_tw_CN.json
  30. 39
      io.sc.platform.system.frontend/src/i18n/messages_zh_CN.json
  31. 4
      io.sc.platform.system.frontend/src/menus/menus.json
  32. 10
      io.sc.platform.system.frontend/src/routes/routes.json
  33. 11
      io.sc.platform.system.frontend/src/views/application/Application.vue
  34. 11
      io.sc.platform.system.frontend/src/views/corporation/Corporation.vue
  35. 11
      io.sc.platform.system.frontend/src/views/department/Department.vue
  36. 68
      io.sc.platform.system.frontend/src/views/menu/Menu.vue
  37. 4
      io.sc.platform.system.frontend/src/views/monitor/Resources.vue
  38. 215
      io.sc.platform.system.frontend/src/views/monitor/ServerInfo.vue
  39. 14
      io.sc.platform.system.frontend/src/views/org/Org.vue
  40. 18
      io.sc.platform.system.frontend/src/views/role/Role.vue
  41. 18
      io.sc.platform.system.frontend/src/views/shared/SelectApplicationGrid.vue
  42. 15
      io.sc.platform.system.frontend/src/views/shared/SelectMenuTreeGrid.vue
  43. 15
      io.sc.platform.system.frontend/src/views/shared/SelectOrgTreeGrid.vue
  44. 18
      io.sc.platform.system.frontend/src/views/shared/SelectRoleGrid.vue
  45. 10
      io.sc.platform.system.frontend/src/views/shared/SelectUserGrid.vue
  46. 14
      io.sc.platform.system.frontend/src/views/user/User.vue
  47. 1
      io.sc.platform.system/build.gradle
  48. 48
      io.sc.platform.system/src/main/java/io/sc/platform/system/menu/service/impl/MenuServiceImpl.java
  49. 21
      io.sc.platform.system/src/main/java/io/sc/platform/system/monitor/controller/MetricsWebController.java
  50. 1
      io.sc.platform.system/src/main/resources/META-INF/platform/plugins/components.json

2
gradle.properties

@ -65,7 +65,7 @@ jxls_poi_version=1.0.15
jxls_version=2.4.6
mybatis_version=3.5.10
opencsv_version=5.7.1
oshi_version=6.4.2
oshi_version=6.6.1
p6spy_version=3.9.1
pinyin4j_version=2.5.1
poi_version=5.2.5

24
io.sc.platform.core.frontend/package.json

@ -1,6 +1,6 @@
{
"name": "platform-core",
"version": "8.1.223",
"version": "8.1.225",
"description": "前端核心包,用于快速构建前端的脚手架",
"//main": "库的主文件",
"main": "dist/platform-core.js",
@ -111,17 +111,17 @@
"@codemirror/view": "6.26.3",
"@maxgraph/core": "0.10.0",
"@quasar/extras": "1.16.11",
"@univerjs/core":"0.1.13",
"@univerjs/design":"0.1.13",
"@univerjs/docs":"0.1.13",
"@univerjs/docs-ui":"0.1.13",
"@univerjs/engine-formula":"0.1.13",
"@univerjs/engine-render":"0.1.13",
"@univerjs/facade":"0.1.13",
"@univerjs/sheets":"0.1.13",
"@univerjs/sheets-formula":"0.1.13",
"@univerjs/sheets-ui":"0.1.13",
"@univerjs/ui":"0.1.13",
"@univerjs/core": "0.1.13",
"@univerjs/design": "0.1.13",
"@univerjs/docs": "0.1.13",
"@univerjs/docs-ui": "0.1.13",
"@univerjs/engine-formula": "0.1.13",
"@univerjs/engine-render": "0.1.13",
"@univerjs/facade": "0.1.13",
"@univerjs/sheets": "0.1.13",
"@univerjs/sheets-formula": "0.1.13",
"@univerjs/sheets-ui": "0.1.13",
"@univerjs/ui": "0.1.13",
"@vueuse/core": "10.9.0",
"axios": "1.6.8",
"codemirror": "6.0.1",

12
io.sc.platform.core.frontend/src/platform/components/grid/WGrid.vue

@ -2558,24 +2558,24 @@ const getTreeRow = (arr, key, parentFlag: boolean) => {
}
return result;
};
const getCascadeParentData = (row, propertyName) => {
const getCascadeParentsData = (row, propertyName) => {
const data = <any>[];
if (row && row[props.foreignKey]) {
const parent = getTreeRow(table.rows, row[props.foreignKey], true);
if (parent) {
data.push(propertyName ? parent[propertyName] : parent);
if (parent[props.foreignKey]) {
const parentData = getCascadeParentData(parent, propertyName);
const parentData = getCascadeParentsData(parent, propertyName);
data.push(...parentData);
}
}
}
return data;
};
//
const getCascadeParent = (propertyName: string) => {
//
const getCascadeParents = (propertyName: string) => {
const row = getSelectedRow();
const parent = getCascadeParentData(row, propertyName);
const parent = getCascadeParentsData(row, propertyName);
const result = <any>[propertyName ? row[propertyName] : row];
if (parent && parent.length > 0) {
result.push(...parent);
@ -2589,7 +2589,7 @@ const getElement = () => {
defineExpose({
getCascadeChildren,
getCascadeParent,
getCascadeParents,
getSelectedRow,
getSelectedRows,
getTickedRow,

4
io.sc.platform.core.frontend/src/platform/plugin/quasar.ts

@ -35,6 +35,10 @@ export default {
size: gc.theme.loadingBar.size + 'px',
position: gc.theme.loadingBar.position,
reverse: gc.theme.loadingBar.reverse,
// 设置顶部加载进度栏过滤器(请求地址包含 /api/ 的不显示进度栏,即请求后端服务时不显示进度栏)
hijackFilter: (url) => {
return !/\/api\//.test(url);
},
},
},
plugins: {

15
io.sc.platform.core.frontend/template-project/package.json

@ -1,6 +1,6 @@
{
"name": "platform-core",
"version": "8.1.223",
"version": "8.1.225",
"description": "前端核心包,用于快速构建前端的脚手架",
"private": false,
"keywords": [],
@ -83,6 +83,17 @@
"@codemirror/view": "6.26.3",
"@maxgraph/core": "0.10.0",
"@quasar/extras": "1.16.11",
"@univerjs/core": "0.1.13",
"@univerjs/design": "0.1.13",
"@univerjs/docs": "0.1.13",
"@univerjs/docs-ui": "0.1.13",
"@univerjs/engine-formula": "0.1.13",
"@univerjs/engine-render": "0.1.13",
"@univerjs/facade": "0.1.13",
"@univerjs/sheets": "0.1.13",
"@univerjs/sheets-formula": "0.1.13",
"@univerjs/sheets-ui": "0.1.13",
"@univerjs/ui": "0.1.13",
"@vueuse/core": "10.9.0",
"axios": "1.6.8",
"codemirror": "6.0.1",
@ -93,7 +104,7 @@
"luckyexcel": "1.0.1",
"mockjs": "1.1.0",
"pinia": "2.1.7",
"platform-core": "8.1.223",
"platform-core": "8.1.225",
"quasar": "2.15.3",
"tailwindcss": "3.4.3",
"vue": "3.4.24",

44
io.sc.platform.core/src/main/java/io/sc/platform/core/util/DateUtil.java

@ -70,6 +70,17 @@ public class DateUtil {
+ yyyy_MM_dd_HH + "\n"
+ yyyy_MM_dd + "\n";
/**
* 获取日期
* @param time 日期对象毫秒数
* @return 日期
*/
public static Date from(long time){
Date date =new Date();
date.setTime(time);
return date;
}
/**
* 获取日期格式化对象
* @param format 日期格式化字符串
@ -170,6 +181,22 @@ public class DateUtil {
return result;
}
/**
* 格式化日期对象
* @param time 日期对象的毫秒数
* @return 日期字符串
*/
public static String formatDate(long time){
Date date =from(time);
if(date!=null){
DateFormat df =getDateFormat(DateUtil.yyyy_MM_dd_HH_mm_ss);
if(df!=null){
return df.format(date);
}
}
return null;
}
/**
* 格式化日期对象
* @param date 日期对象
@ -185,6 +212,23 @@ public class DateUtil {
return null;
}
/**
* 格式化日期对象
* @param time 日期对象毫秒数
* @param format 日期格式
* @return 日期字符串
*/
public static String formatDate(long time, String format){
Date date =from(time);
if(date!=null){
DateFormat df =getDateFormat(format);
if(df!=null){
return df.format(date);
}
}
return null;
}
/**
* 格式化日期对象
* @param date 日期对象

1
io.sc.platform.monitor/build.gradle

@ -1,5 +1,6 @@
dependencies {
api(
"com.github.oshi:oshi-core:${oshi_version}",
project(":io.sc.platform.core"),
)
}

960
io.sc.platform.monitor/doc/database/structure.erm

@ -1,960 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<diagram>
<page_setting>
<direction_horizontal>true</direction_horizontal>
<scale>100</scale>
<paper_size>A4 210 x 297 mm</paper_size>
<top_margin>30</top_margin>
<left_margin>30</left_margin>
<bottom_margin>30</bottom_margin>
<right_margin>30</right_margin>
</page_setting>
<category_index>0</category_index>
<zoom>1.0</zoom>
<x>0</x>
<y>0</y>
<default_color>
<r>128</r>
<g>128</g>
<b>192</b>
</default_color>
<color>
<r>255</r>
<g>255</g>
<b>255</b>
</color>
<font_name>.SF NS Text</font_name>
<font_size>9</font_size>
<settings>
<database>MySQL</database>
<capital>false</capital>
<table_style></table_style>
<notation></notation>
<notation_level>0</notation_level>
<notation_expand_group>true</notation_expand_group>
<view_mode>2</view_mode>
<outline_view_mode>1</outline_view_mode>
<view_order_by>1</view_order_by>
<auto_ime_change>false</auto_ime_change>
<validate_physical_name>true</validate_physical_name>
<use_bezier_curve>false</use_bezier_curve>
<suspend_validator>false</suspend_validator>
<export_setting>
<export_ddl_setting>
<output_path>doc/database/structure.sql</output_path>
<encoding>UTF-8</encoding>
<line_feed>LF</line_feed>
<is_open_after_saved>true</is_open_after_saved>
<environment_id>0</environment_id>
<category_id>null</category_id>
<ddl_target>
<create_comment>true</create_comment>
<create_foreignKey>true</create_foreignKey>
<create_index>true</create_index>
<create_sequence>true</create_sequence>
<create_table>true</create_table>
<create_tablespace>true</create_tablespace>
<create_trigger>true</create_trigger>
<create_view>true</create_view>
<drop_index>true</drop_index>
<drop_sequence>true</drop_sequence>
<drop_table>true</drop_table>
<drop_tablespace>true</drop_tablespace>
<drop_trigger>true</drop_trigger>
<drop_view>true</drop_view>
<inline_column_comment>true</inline_column_comment>
<inline_table_comment>true</inline_table_comment>
<comment_value_description>true</comment_value_description>
<comment_value_logical_name>false</comment_value_logical_name>
<comment_value_logical_name_description>false</comment_value_logical_name_description>
<comment_replace_line_feed>false</comment_replace_line_feed>
<comment_replace_string></comment_replace_string>
</ddl_target>
</export_ddl_setting>
<export_excel_setting>
<category_id>null</category_id>
<output_path></output_path>
<template></template>
<template_path></template_path>
<used_default_template_lang></used_default_template_lang>
<image_output></image_output>
<is_open_after_saved>true</is_open_after_saved>
<is_put_diagram>true</is_put_diagram>
<is_use_logical_name>true</is_use_logical_name>
</export_excel_setting>
<export_html_setting>
<output_dir></output_dir>
<with_category_image>true</with_category_image>
<with_image>true</with_image>
<is_open_after_saved>true</is_open_after_saved>
</export_html_setting>
<export_image_setting>
<output_file_path></output_file_path>
<category_dir_path></category_dir_path>
<with_category_image>true</with_category_image>
<is_open_after_saved>true</is_open_after_saved>
</export_image_setting>
<export_java_setting>
<java_output></java_output>
<package_name></package_name>
<class_name_suffix></class_name_suffix>
<src_file_encoding></src_file_encoding>
<with_hibernate>false</with_hibernate>
</export_java_setting>
<export_testdata_setting>
<file_encoding></file_encoding>
<file_path></file_path>
<format>0</format>
</export_testdata_setting>
</export_setting>
<category_settings>
<free_layout>false</free_layout>
<show_referred_tables>false</show_referred_tables>
<categories>
</categories>
</category_settings>
<translation_settings>
<use>false</use>
<translations>
</translations>
</translation_settings>
<model_properties>
<id></id>
<height>-1</height>
<width>-1</width>
<font_name>.SF NS Text</font_name>
<font_size>9</font_size>
<x>50</x>
<y>50</y>
<color>
<r>255</r>
<g>255</g>
<b>255</b>
</color>
<connections>
</connections>
<display>false</display>
<creation_date>2016-03-10 20:37:38</creation_date>
<updated_date>2016-03-16 02:25:45</updated_date>
<model_property>
<name>Project Name</name>
<value></value>
</model_property>
<model_property>
<name>Model Name</name>
<value></value>
</model_property>
<model_property>
<name>Version</name>
<value></value>
</model_property>
<model_property>
<name>Company</name>
<value></value>
</model_property>
<model_property>
<name>Author</name>
<value></value>
</model_property>
</model_properties>
<table_properties>
<schema></schema>
<character_set></character_set>
<collation></collation>
<storage_engine></storage_engine>
<primary_key_length_of_text>null</primary_key_length_of_text>
</table_properties>
<environment_setting>
<environment>
<id>0</id>
<name>Default</name>
</environment>
</environment_setting>
</settings>
<dictionary>
<word>
<id>0</id>
<length>255</length>
<decimal>null</decimal>
<array>false</array>
<array_dimension>null</array_dimension>
<unsigned>false</unsigned>
<zerofill>false</zerofill>
<binary>false</binary>
<args></args>
<char_semantics>false</char_semantics>
<description></description>
<logical_name>Bean autowire</logical_name>
<physical_name>FD_AUTOWIRE</physical_name>
<type>varchar(n)</type>
</word>
<word>
<id>1</id>
<length>255</length>
<decimal>null</decimal>
<array>false</array>
<array_dimension>null</array_dimension>
<unsigned>false</unsigned>
<zerofill>false</zerofill>
<binary>false</binary>
<args></args>
<char_semantics>false</char_semantics>
<description></description>
<logical_name>Bean customizer-ref</logical_name>
<physical_name>FD_CUSTOMIZER_REF</physical_name>
<type>varchar(n)</type>
</word>
<word>
<id>2</id>
<length>255</length>
<decimal>null</decimal>
<array>false</array>
<array_dimension>null</array_dimension>
<unsigned>false</unsigned>
<zerofill>false</zerofill>
<binary>false</binary>
<args></args>
<char_semantics>false</char_semantics>
<description></description>
<logical_name>Bean depends-on</logical_name>
<physical_name>FD_DEPENDS_ON</physical_name>
<type>varchar(n)</type>
</word>
<word>
<id>3</id>
<length>255</length>
<decimal>null</decimal>
<array>false</array>
<array_dimension>null</array_dimension>
<unsigned>false</unsigned>
<zerofill>false</zerofill>
<binary>false</binary>
<args></args>
<char_semantics>false</char_semantics>
<description></description>
<logical_name>Bean描述</logical_name>
<physical_name>FD_DESCRIPTION</physical_name>
<type>varchar(n)</type>
</word>
<word>
<id>4</id>
<length>255</length>
<decimal>null</decimal>
<array>false</array>
<array_dimension>null</array_dimension>
<unsigned>false</unsigned>
<zerofill>false</zerofill>
<binary>false</binary>
<args></args>
<char_semantics>false</char_semantics>
<description></description>
<logical_name>Bean destroy-method</logical_name>
<physical_name>FD_DESTROY_METHOD</physical_name>
<type>varchar(n)</type>
</word>
<word>
<id>5</id>
<length>255</length>
<decimal>null</decimal>
<array>false</array>
<array_dimension>null</array_dimension>
<unsigned>false</unsigned>
<zerofill>false</zerofill>
<binary>false</binary>
<args></args>
<char_semantics>false</char_semantics>
<description></description>
<logical_name>Bean id</logical_name>
<physical_name>FD_ID</physical_name>
<type>varchar(n)</type>
</word>
<word>
<id>6</id>
<length>255</length>
<decimal>null</decimal>
<array>false</array>
<array_dimension>null</array_dimension>
<unsigned>false</unsigned>
<zerofill>false</zerofill>
<binary>false</binary>
<args></args>
<char_semantics>false</char_semantics>
<description></description>
<logical_name>Bean init-method</logical_name>
<physical_name>FD_INIT_METHOD</physical_name>
<type>varchar(n)</type>
</word>
<word>
<id>7</id>
<length>255</length>
<decimal>null</decimal>
<array>false</array>
<array_dimension>null</array_dimension>
<unsigned>false</unsigned>
<zerofill>false</zerofill>
<binary>false</binary>
<args></args>
<char_semantics>false</char_semantics>
<description></description>
<logical_name>Bean名称</logical_name>
<physical_name>FD_NAME</physical_name>
<type>varchar(n)</type>
</word>
<word>
<id>8</id>
<length>255</length>
<decimal>null</decimal>
<array>false</array>
<array_dimension>null</array_dimension>
<unsigned>false</unsigned>
<zerofill>false</zerofill>
<binary>false</binary>
<args></args>
<char_semantics>false</char_semantics>
<description></description>
<logical_name>Bean proxy-target-class</logical_name>
<physical_name>FD_PROXY_TARGET_CLASS</physical_name>
<type>varchar(n)</type>
</word>
<word>
<id>9</id>
<length>4</length>
<decimal>null</decimal>
<array>false</array>
<array_dimension>null</array_dimension>
<unsigned>false</unsigned>
<zerofill>false</zerofill>
<binary>false</binary>
<args></args>
<char_semantics>false</char_semantics>
<description></description>
<logical_name>Bean refresh-check-delay</logical_name>
<physical_name>FD_REFRESH_CHECK_DELAY</physical_name>
<type>int(n)</type>
</word>
<word>
<id>10</id>
<length>255</length>
<decimal>null</decimal>
<array>false</array>
<array_dimension>null</array_dimension>
<unsigned>false</unsigned>
<zerofill>false</zerofill>
<binary>false</binary>
<args></args>
<char_semantics>false</char_semantics>
<description></description>
<logical_name>Bean scope</logical_name>
<physical_name>FD_SCOPE</physical_name>
<type>varchar(n)</type>
</word>
<word>
<id>11</id>
<length>3000</length>
<decimal>null</decimal>
<array>false</array>
<array_dimension>null</array_dimension>
<unsigned>false</unsigned>
<zerofill>false</zerofill>
<binary>false</binary>
<args></args>
<char_semantics>false</char_semantics>
<description></description>
<logical_name>Bean脚本内容</logical_name>
<physical_name>FD_SCRIPT</physical_name>
<type>varchar(n)</type>
</word>
<word>
<id>12</id>
<length>255</length>
<decimal>null</decimal>
<array>false</array>
<array_dimension>null</array_dimension>
<unsigned>false</unsigned>
<zerofill>false</zerofill>
<binary>false</binary>
<args></args>
<char_semantics>false</char_semantics>
<description></description>
<logical_name>Bean实现接口</logical_name>
<physical_name>FD_SCRIPT_INTERFACE</physical_name>
<type>varchar(n)</type>
</word>
<word>
<id>13</id>
<length>255</length>
<decimal>null</decimal>
<array>false</array>
<array_dimension>null</array_dimension>
<unsigned>false</unsigned>
<zerofill>false</zerofill>
<binary>false</binary>
<args></args>
<char_semantics>false</char_semantics>
<description>GROOVY:groovy Bean,BSH:bsh Bean</description>
<logical_name>Bean类型</logical_name>
<physical_name>FD_TYPE</physical_name>
<type>varchar(n)</type>
</word>
<word>
<id>14</id>
<length>36</length>
<decimal>null</decimal>
<array>false</array>
<array_dimension>null</array_dimension>
<unsigned>false</unsigned>
<zerofill>false</zerofill>
<binary>false</binary>
<args></args>
<char_semantics>false</char_semantics>
<description></description>
<logical_name>Bean定义ID</logical_name>
<physical_name>FD_UUID</physical_name>
<type>varchar(n)</type>
</word>
</dictionary>
<tablespace_set>
</tablespace_set>
<contents>
<table>
<id>0</id>
<height>75</height>
<width>120</width>
<font_name>.SF NS Text</font_name>
<font_size>9</font_size>
<x>137</x>
<y>74</y>
<color>
<r>128</r>
<g>128</g>
<b>192</b>
</color>
<connections>
</connections>
<physical_name>WSP_DYNAMIC_BEAN</physical_name>
<logical_name>动态SpringBean定义表</logical_name>
<description></description>
<constraint></constraint>
<primary_key_name></primary_key_name>
<option></option>
<columns>
<normal_column>
<word_id>14</word_id>
<id>0</id>
<description></description>
<unique_key_name></unique_key_name>
<logical_name></logical_name>
<physical_name></physical_name>
<type>varchar(n)</type>
<constraint></constraint>
<default_value></default_value>
<auto_increment>false</auto_increment>
<foreign_key>false</foreign_key>
<not_null>true</not_null>
<primary_key>true</primary_key>
<unique_key>false</unique_key>
<character_set></character_set>
<collation></collation>
<sequence>
<name></name>
<schema></schema>
<increment></increment>
<min_value></min_value>
<max_value></max_value>
<start></start>
<cache></cache>
<nocache>false</nocache>
<cycle>false</cycle>
<order>false</order>
<description></description>
<data_type></data_type>
<decimal_size>0</decimal_size>
</sequence>
</normal_column>
<normal_column>
<word_id>13</word_id>
<id>1</id>
<description></description>
<unique_key_name></unique_key_name>
<logical_name></logical_name>
<physical_name></physical_name>
<type>varchar(n)</type>
<constraint></constraint>
<default_value></default_value>
<auto_increment>false</auto_increment>
<foreign_key>false</foreign_key>
<not_null>false</not_null>
<primary_key>false</primary_key>
<unique_key>false</unique_key>
<character_set></character_set>
<collation></collation>
<sequence>
<name></name>
<schema></schema>
<increment></increment>
<min_value></min_value>
<max_value></max_value>
<start></start>
<cache></cache>
<nocache>false</nocache>
<cycle>false</cycle>
<order>false</order>
<description></description>
<data_type></data_type>
<decimal_size>0</decimal_size>
</sequence>
</normal_column>
<normal_column>
<word_id>5</word_id>
<id>2</id>
<description></description>
<unique_key_name></unique_key_name>
<logical_name></logical_name>
<physical_name></physical_name>
<type>varchar(n)</type>
<constraint></constraint>
<default_value></default_value>
<auto_increment>false</auto_increment>
<foreign_key>false</foreign_key>
<not_null>false</not_null>
<primary_key>false</primary_key>
<unique_key>false</unique_key>
<character_set></character_set>
<collation></collation>
<sequence>
<name></name>
<schema></schema>
<increment></increment>
<min_value></min_value>
<max_value></max_value>
<start></start>
<cache></cache>
<nocache>false</nocache>
<cycle>false</cycle>
<order>false</order>
<description></description>
<data_type></data_type>
<decimal_size>0</decimal_size>
</sequence>
</normal_column>
<normal_column>
<word_id>7</word_id>
<id>3</id>
<description></description>
<unique_key_name></unique_key_name>
<logical_name></logical_name>
<physical_name></physical_name>
<type>varchar(n)</type>
<constraint></constraint>
<default_value></default_value>
<auto_increment>false</auto_increment>
<foreign_key>false</foreign_key>
<not_null>false</not_null>
<primary_key>false</primary_key>
<unique_key>false</unique_key>
<character_set></character_set>
<collation></collation>
<sequence>
<name></name>
<schema></schema>
<increment></increment>
<min_value></min_value>
<max_value></max_value>
<start></start>
<cache></cache>
<nocache>false</nocache>
<cycle>false</cycle>
<order>false</order>
<description></description>
<data_type></data_type>
<decimal_size>0</decimal_size>
</sequence>
</normal_column>
<normal_column>
<word_id>3</word_id>
<id>4</id>
<description></description>
<unique_key_name></unique_key_name>
<logical_name></logical_name>
<physical_name></physical_name>
<type>varchar(n)</type>
<constraint></constraint>
<default_value></default_value>
<auto_increment>false</auto_increment>
<foreign_key>false</foreign_key>
<not_null>false</not_null>
<primary_key>false</primary_key>
<unique_key>false</unique_key>
<character_set></character_set>
<collation></collation>
<sequence>
<name></name>
<schema></schema>
<increment></increment>
<min_value></min_value>
<max_value></max_value>
<start></start>
<cache></cache>
<nocache>false</nocache>
<cycle>false</cycle>
<order>false</order>
<description></description>
<data_type></data_type>
<decimal_size>0</decimal_size>
</sequence>
</normal_column>
<normal_column>
<word_id>12</word_id>
<id>5</id>
<description></description>
<unique_key_name></unique_key_name>
<logical_name></logical_name>
<physical_name></physical_name>
<type>varchar(n)</type>
<constraint></constraint>
<default_value></default_value>
<auto_increment>false</auto_increment>
<foreign_key>false</foreign_key>
<not_null>false</not_null>
<primary_key>false</primary_key>
<unique_key>false</unique_key>
<character_set></character_set>
<collation></collation>
<sequence>
<name></name>
<schema></schema>
<increment></increment>
<min_value></min_value>
<max_value></max_value>
<start></start>
<cache></cache>
<nocache>false</nocache>
<cycle>false</cycle>
<order>false</order>
<description></description>
<data_type></data_type>
<decimal_size>0</decimal_size>
</sequence>
</normal_column>
<normal_column>
<word_id>11</word_id>
<id>6</id>
<description></description>
<unique_key_name></unique_key_name>
<logical_name></logical_name>
<physical_name></physical_name>
<type>varchar(n)</type>
<constraint></constraint>
<default_value></default_value>
<auto_increment>false</auto_increment>
<foreign_key>false</foreign_key>
<not_null>false</not_null>
<primary_key>false</primary_key>
<unique_key>false</unique_key>
<character_set></character_set>
<collation></collation>
<sequence>
<name></name>
<schema></schema>
<increment></increment>
<min_value></min_value>
<max_value></max_value>
<start></start>
<cache></cache>
<nocache>false</nocache>
<cycle>false</cycle>
<order>false</order>
<description></description>
<data_type></data_type>
<decimal_size>0</decimal_size>
</sequence>
</normal_column>
<normal_column>
<word_id>0</word_id>
<id>7</id>
<description></description>
<unique_key_name></unique_key_name>
<logical_name></logical_name>
<physical_name></physical_name>
<type>varchar(n)</type>
<constraint></constraint>
<default_value></default_value>
<auto_increment>false</auto_increment>
<foreign_key>false</foreign_key>
<not_null>false</not_null>
<primary_key>false</primary_key>
<unique_key>false</unique_key>
<character_set></character_set>
<collation></collation>
<sequence>
<name></name>
<schema></schema>
<increment></increment>
<min_value></min_value>
<max_value></max_value>
<start></start>
<cache></cache>
<nocache>false</nocache>
<cycle>false</cycle>
<order>false</order>
<description></description>
<data_type></data_type>
<decimal_size>0</decimal_size>
</sequence>
</normal_column>
<normal_column>
<word_id>1</word_id>
<id>8</id>
<description></description>
<unique_key_name></unique_key_name>
<logical_name></logical_name>
<physical_name></physical_name>
<type>varchar(n)</type>
<constraint></constraint>
<default_value></default_value>
<auto_increment>false</auto_increment>
<foreign_key>false</foreign_key>
<not_null>false</not_null>
<primary_key>false</primary_key>
<unique_key>false</unique_key>
<character_set></character_set>
<collation></collation>
<sequence>
<name></name>
<schema></schema>
<increment></increment>
<min_value></min_value>
<max_value></max_value>
<start></start>
<cache></cache>
<nocache>false</nocache>
<cycle>false</cycle>
<order>false</order>
<description></description>
<data_type></data_type>
<decimal_size>0</decimal_size>
</sequence>
</normal_column>
<normal_column>
<word_id>2</word_id>
<id>9</id>
<description></description>
<unique_key_name></unique_key_name>
<logical_name></logical_name>
<physical_name></physical_name>
<type>varchar(n)</type>
<constraint></constraint>
<default_value></default_value>
<auto_increment>false</auto_increment>
<foreign_key>false</foreign_key>
<not_null>false</not_null>
<primary_key>false</primary_key>
<unique_key>false</unique_key>
<character_set></character_set>
<collation></collation>
<sequence>
<name></name>
<schema></schema>
<increment></increment>
<min_value></min_value>
<max_value></max_value>
<start></start>
<cache></cache>
<nocache>false</nocache>
<cycle>false</cycle>
<order>false</order>
<description></description>
<data_type></data_type>
<decimal_size>0</decimal_size>
</sequence>
</normal_column>
<normal_column>
<word_id>4</word_id>
<id>10</id>
<description></description>
<unique_key_name></unique_key_name>
<logical_name></logical_name>
<physical_name></physical_name>
<type>varchar(n)</type>
<constraint></constraint>
<default_value></default_value>
<auto_increment>false</auto_increment>
<foreign_key>false</foreign_key>
<not_null>false</not_null>
<primary_key>false</primary_key>
<unique_key>false</unique_key>
<character_set></character_set>
<collation></collation>
<sequence>
<name></name>
<schema></schema>
<increment></increment>
<min_value></min_value>
<max_value></max_value>
<start></start>
<cache></cache>
<nocache>false</nocache>
<cycle>false</cycle>
<order>false</order>
<description></description>
<data_type></data_type>
<decimal_size>0</decimal_size>
</sequence>
</normal_column>
<normal_column>
<word_id>6</word_id>
<id>11</id>
<description></description>
<unique_key_name></unique_key_name>
<logical_name></logical_name>
<physical_name></physical_name>
<type>varchar(n)</type>
<constraint></constraint>
<default_value></default_value>
<auto_increment>false</auto_increment>
<foreign_key>false</foreign_key>
<not_null>false</not_null>
<primary_key>false</primary_key>
<unique_key>false</unique_key>
<character_set></character_set>
<collation></collation>
<sequence>
<name></name>
<schema></schema>
<increment></increment>
<min_value></min_value>
<max_value></max_value>
<start></start>
<cache></cache>
<nocache>false</nocache>
<cycle>false</cycle>
<order>false</order>
<description></description>
<data_type></data_type>
<decimal_size>0</decimal_size>
</sequence>
</normal_column>
<normal_column>
<word_id>8</word_id>
<id>12</id>
<description></description>
<unique_key_name></unique_key_name>
<logical_name></logical_name>
<physical_name></physical_name>
<type>varchar(n)</type>
<constraint></constraint>
<default_value></default_value>
<auto_increment>false</auto_increment>
<foreign_key>false</foreign_key>
<not_null>false</not_null>
<primary_key>false</primary_key>
<unique_key>false</unique_key>
<character_set></character_set>
<collation></collation>
<sequence>
<name></name>
<schema></schema>
<increment></increment>
<min_value></min_value>
<max_value></max_value>
<start></start>
<cache></cache>
<nocache>false</nocache>
<cycle>false</cycle>
<order>false</order>
<description></description>
<data_type></data_type>
<decimal_size>0</decimal_size>
</sequence>
</normal_column>
<normal_column>
<word_id>9</word_id>
<id>13</id>
<description></description>
<unique_key_name></unique_key_name>
<logical_name></logical_name>
<physical_name></physical_name>
<type>int(n)</type>
<constraint></constraint>
<default_value></default_value>
<auto_increment>false</auto_increment>
<foreign_key>false</foreign_key>
<not_null>false</not_null>
<primary_key>false</primary_key>
<unique_key>false</unique_key>
<character_set></character_set>
<collation></collation>
<sequence>
<name></name>
<schema></schema>
<increment></increment>
<min_value></min_value>
<max_value></max_value>
<start></start>
<cache></cache>
<nocache>false</nocache>
<cycle>false</cycle>
<order>false</order>
<description></description>
<data_type></data_type>
<decimal_size>0</decimal_size>
</sequence>
</normal_column>
<normal_column>
<word_id>10</word_id>
<id>14</id>
<description></description>
<unique_key_name></unique_key_name>
<logical_name></logical_name>
<physical_name></physical_name>
<type>varchar(n)</type>
<constraint></constraint>
<default_value></default_value>
<auto_increment>false</auto_increment>
<foreign_key>false</foreign_key>
<not_null>false</not_null>
<primary_key>false</primary_key>
<unique_key>false</unique_key>
<character_set></character_set>
<collation></collation>
<sequence>
<name></name>
<schema></schema>
<increment></increment>
<min_value></min_value>
<max_value></max_value>
<start></start>
<cache></cache>
<nocache>false</nocache>
<cycle>false</cycle>
<order>false</order>
<description></description>
<data_type></data_type>
<decimal_size>0</decimal_size>
</sequence>
</normal_column>
</columns>
<indexes>
</indexes>
<complex_unique_key_list>
</complex_unique_key_list>
<table_properties>
<schema></schema>
<character_set></character_set>
<collation></collation>
<storage_engine></storage_engine>
<primary_key_length_of_text>null</primary_key_length_of_text>
</table_properties>
</table>
</contents>
<column_groups>
</column_groups>
<test_data_list>
</test_data_list>
<sequence_set>
</sequence_set>
<trigger_set>
</trigger_set>
<change_tracking_list>
</change_tracking_list>
</diagram>

34
io.sc.platform.monitor/doc/database/structure.sql

@ -1,34 +0,0 @@
SET SESSION FOREIGN_KEY_CHECKS=0;
/* Drop Tables */
DROP TABLE IF EXISTS WSP_DYNAMIC_BEAN;
/* Create Tables */
CREATE TABLE WSP_DYNAMIC_BEAN
(
FD_UUID varchar(36) NOT NULL,
-- GROOVY:groovy Bean,BSH:bsh Bean
FD_TYPE varchar(255) COMMENT 'GROOVY:groovy Bean,BSH:bsh Bean',
FD_ID varchar(255),
FD_NAME varchar(255),
FD_DESCRIPTION varchar(255),
FD_SCRIPT_INTERFACE varchar(255),
FD_SCRIPT varchar(3000),
FD_AUTOWIRE varchar(255),
FD_CUSTOMIZER_REF varchar(255),
FD_DEPENDS_ON varchar(255),
FD_DESTROY_METHOD varchar(255),
FD_INIT_METHOD varchar(255),
FD_PROXY_TARGET_CLASS varchar(255),
FD_REFRESH_CHECK_DELAY int(4),
FD_SCOPE varchar(255),
PRIMARY KEY (FD_UUID)
);

4
io.sc.platform.monitor/src/main/java/io/sc/platform/monitor/service/SystemMonitor.java

@ -1,5 +1,7 @@
package io.sc.platform.monitor.service;
import io.sc.platform.monitor.service.support.ServerInfo;
public interface SystemMonitor {
public void getCpuInfo();
public ServerInfo getServerInfo() throws Exception;
}

21
io.sc.platform.monitor/src/main/java/io/sc/platform/monitor/service/impl/SystemMonitorImpl.java

@ -1,26 +1,11 @@
package io.sc.platform.monitor.service.impl;
import io.sc.platform.monitor.service.SystemMonitor;
import oshi.SystemInfo;
import oshi.hardware.CentralProcessor;
import oshi.hardware.ComputerSystem;
import oshi.hardware.HardwareAbstractionLayer;
import io.sc.platform.monitor.service.support.ServerInfo;
public class SystemMonitorImpl implements SystemMonitor {
@Override
public void getCpuInfo() {
SystemInfo si =new SystemInfo();
HardwareAbstractionLayer hal = si.getHardware();
CentralProcessor processor = hal.getProcessor();
double[] loadAverage = processor.getSystemLoadAverage(3);
System.out.println("CPU load averages:" + (loadAverage[0] < 0 ? " N/A" : String.format(" %.2f", loadAverage[0]))
+ (loadAverage[1] < 0 ? " N/A" : String.format(" %.2f", loadAverage[1]))
+ (loadAverage[2] < 0 ? " N/A" : String.format(" %.2f", loadAverage[2])));
}
public static void main(String[] args) {
SystemMonitor monitor =new SystemMonitorImpl();
monitor.getCpuInfo();
public ServerInfo getServerInfo() throws Exception {
return ServerInfo.info();
}
}

28
io.sc.platform.monitor/src/main/java/io/sc/platform/monitor/service/support/Cpu.java

@ -1,6 +1,11 @@
package io.sc.platform.monitor.service.support;
import oshi.hardware.CentralProcessor;
import oshi.util.Util;
public class Cpu {
private static final int OSHI_WAIT_SECOND = 1000;
/**
* 核心数
*/
@ -31,6 +36,29 @@ public class Cpu {
*/
private double free;
public static Cpu from(CentralProcessor processor) {
Cpu cpu =new Cpu();
long[] prevTicks = processor.getSystemCpuLoadTicks();
Util.sleep(OSHI_WAIT_SECOND);
long[] ticks = processor.getSystemCpuLoadTicks();
long nice = ticks[CentralProcessor.TickType.NICE.getIndex()] - prevTicks[CentralProcessor.TickType.NICE.getIndex()];
long irq = ticks[CentralProcessor.TickType.IRQ.getIndex()] - prevTicks[CentralProcessor.TickType.IRQ.getIndex()];
long softirq = ticks[CentralProcessor.TickType.SOFTIRQ.getIndex()] - prevTicks[CentralProcessor.TickType.SOFTIRQ.getIndex()];
long steal = ticks[CentralProcessor.TickType.STEAL.getIndex()] - prevTicks[CentralProcessor.TickType.STEAL.getIndex()];
long cSys = ticks[CentralProcessor.TickType.SYSTEM.getIndex()] - prevTicks[CentralProcessor.TickType.SYSTEM.getIndex()];
long user = ticks[CentralProcessor.TickType.USER.getIndex()] - prevTicks[CentralProcessor.TickType.USER.getIndex()];
long iowait = ticks[CentralProcessor.TickType.IOWAIT.getIndex()] - prevTicks[CentralProcessor.TickType.IOWAIT.getIndex()];
long idle = ticks[CentralProcessor.TickType.IDLE.getIndex()] - prevTicks[CentralProcessor.TickType.IDLE.getIndex()];
long totalCpu = user + nice + cSys + idle + iowait + irq + softirq + steal;
cpu.setNumber(processor.getLogicalProcessorCount());
cpu.setTotalUsed(totalCpu);
cpu.setSysUsed(cSys);
cpu.setUserUsed(user);
cpu.setWait(iowait);
cpu.setFree(idle);
return cpu;
}
public int getNumber() {
return number;
}

45
io.sc.platform.monitor/src/main/java/io/sc/platform/monitor/service/support/Disk.java

@ -0,0 +1,45 @@
package io.sc.platform.monitor.service.support;
import io.sc.platform.core.util.StringUtil;
import java.io.File;
public class Disk {
private long total;
private long free;
private long used;
public static Disk from() {
File file =new File("/");
Disk disk =new Disk();
disk.setTotal(file.getTotalSpace());
disk.setUsed(file.getTotalSpace()-file.getFreeSpace());
disk.setFree(file.getFreeSpace());
return disk;
}
public long getTotal() {
return total;
}
public void setTotal(long total) {
this.total = total;
}
public long getFree() {
return free;
}
public void setFree(long free) {
this.free = free;
}
public long getUsed() {
return used;
}
public void setUsed(long used) {
this.used = used;
}
}

85
io.sc.platform.monitor/src/main/java/io/sc/platform/monitor/service/support/Hardware.java

@ -0,0 +1,85 @@
package io.sc.platform.monitor.service.support;
import oshi.hardware.ComputerSystem;
import oshi.hardware.HardwareAbstractionLayer;
import java.util.List;
public class Hardware {
private String uuid;
private String manufacturer;
private String model;
private String serialNumber;
private int logicalProcessorCount;
private int physicalProcessorCount;
private long physicalMemory;
public static Hardware from(HardwareAbstractionLayer hd) {
ComputerSystem cs =hd.getComputerSystem();
Hardware hardware =new Hardware();
hardware.setLogicalProcessorCount(hd.getProcessor().getLogicalProcessors().size());
hardware.setPhysicalProcessorCount(hd.getProcessor().getPhysicalProcessors().size());
hardware.setUuid(cs.getHardwareUUID());
hardware.setManufacturer(cs.getManufacturer());
hardware.setModel(cs.getModel());
hardware.setSerialNumber(cs.getSerialNumber());
hardware.setPhysicalMemory(hd.getMemory().getTotal());
return hardware;
}
public String getUuid() {
return uuid;
}
public void setUuid(String uuid) {
this.uuid = uuid;
}
public String getManufacturer() {
return manufacturer;
}
public void setManufacturer(String manufacturer) {
this.manufacturer = manufacturer;
}
public String getModel() {
return model;
}
public void setModel(String model) {
this.model = model;
}
public String getSerialNumber() {
return serialNumber;
}
public void setSerialNumber(String serialNumber) {
this.serialNumber = serialNumber;
}
public int getLogicalProcessorCount() {
return logicalProcessorCount;
}
public void setLogicalProcessorCount(int logicalProcessorCount) {
this.logicalProcessorCount = logicalProcessorCount;
}
public int getPhysicalProcessorCount() {
return physicalProcessorCount;
}
public void setPhysicalProcessorCount(int physicalProcessorCount) {
this.physicalProcessorCount = physicalProcessorCount;
}
public long getPhysicalMemory() {
return physicalMemory;
}
public void setPhysicalMemory(long physicalMemory) {
this.physicalMemory = physicalMemory;
}
}

35
io.sc.platform.monitor/src/main/java/io/sc/platform/monitor/service/support/Jvm.java

@ -1,20 +1,24 @@
package io.sc.platform.monitor.service.support;
import io.sc.platform.core.util.StringUtil;
import java.util.Properties;
public class Jvm {
/**
* 当前JVM占用的内存总数(M)
*/
private double total;
private String total;
/**
* JVM最大可用内存总数(M)
*/
private double max;
private String max;
/**
* JVM空闲内存(M)
*/
private double free;
private String free;
/**
* JDK版本
@ -26,27 +30,40 @@ public class Jvm {
*/
private String home;
public double getTotal() {
public static Jvm from(){
Runtime r =Runtime.getRuntime();
Properties props = System.getProperties();
Jvm jvm =new Jvm();
jvm.setTotal(StringUtil.commaStyle(r.totalMemory()));
jvm.setMax(StringUtil.commaStyle(r.maxMemory()));
jvm.setFree(StringUtil.commaStyle(r.freeMemory()));
jvm.setVersion(props.getProperty("java.version"));
jvm.setHome(props.getProperty("java.home"));
return jvm;
}
public String getTotal() {
return total;
}
public void setTotal(double total) {
public void setTotal(String total) {
this.total = total;
}
public double getMax() {
public String getMax() {
return max;
}
public void setMax(double max) {
public void setMax(String max) {
this.max = max;
}
public double getFree() {
public String getFree() {
return free;
}
public void setFree(double free) {
public void setFree(String free) {
this.free = free;
}

23
io.sc.platform.monitor/src/main/java/io/sc/platform/monitor/service/support/Mem.java → io.sc.platform.monitor/src/main/java/io/sc/platform/monitor/service/support/Memory.java

@ -1,21 +1,20 @@
package io.sc.platform.monitor.service.support;
public class Mem {
/**
* 内存总量
*/
private double total;
import oshi.hardware.GlobalMemory;
/**
* 已用内存
*/
public class Memory {
private double total;
private double used;
/**
* 剩余内存
*/
private double free;
public static Memory from(GlobalMemory m){
Memory memory =new Memory();
memory.setTotal(m.getTotal());
memory.setUsed(m.getTotal() - m.getAvailable());
memory.setFree(m.getAvailable());
return memory;
}
public double getTotal() {
return total;
}

95
io.sc.platform.monitor/src/main/java/io/sc/platform/monitor/service/support/Os.java

@ -0,0 +1,95 @@
package io.sc.platform.monitor.service.support;
import io.sc.platform.core.util.DateUtil;
import oshi.software.os.OperatingSystem;
import java.util.Date;
import java.util.Properties;
public class Os {
private String computerName;
private String ip;
private String name;
private String version;
private String arch;
private String manufacturer;
private String bootTime;
private int upTime;
public static Os from(OperatingSystem operatingSystem){
Properties props = System.getProperties();
Os os =new Os();
os.setName(props.getProperty("os.name"));
os.setVersion(operatingSystem.getVersionInfo().getVersion() + " - " + operatingSystem.getVersionInfo().getCodeName());
os.setArch(props.getProperty("os.arch"));
os.setManufacturer(operatingSystem.getManufacturer());
os.setBootTime(DateUtil.formatDate(operatingSystem.getSystemBootTime()*1000));
os.setUpTime((int)operatingSystem.getSystemUptime()/(60*60*24));
return os;
}
public String getComputerName() {
return computerName;
}
public void setComputerName(String computerName) {
this.computerName = computerName;
}
public String getIp() {
return ip;
}
public void setIp(String ip) {
this.ip = ip;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getVersion() {
return version;
}
public void setVersion(String version) {
this.version = version;
}
public String getArch() {
return arch;
}
public void setArch(String arch) {
this.arch = arch;
}
public String getManufacturer() {
return manufacturer;
}
public void setManufacturer(String manufacturer) {
this.manufacturer = manufacturer;
}
public String getBootTime() {
return bootTime;
}
public void setBootTime(String bootTime) {
this.bootTime = bootTime;
}
public int getUpTime() {
return upTime;
}
public void setUpTime(int upTime) {
this.upTime = upTime;
}
}

174
io.sc.platform.monitor/src/main/java/io/sc/platform/monitor/service/support/Server.java

@ -1,174 +0,0 @@
package io.sc.platform.monitor.service.support;
import oshi.SystemInfo;
import oshi.hardware.CentralProcessor;
import oshi.hardware.GlobalMemory;
import oshi.hardware.HardwareAbstractionLayer;
import oshi.software.os.FileSystem;
import oshi.software.os.OSFileStore;
import oshi.software.os.OperatingSystem;
import oshi.util.Util;
import oshi.hardware.CentralProcessor.TickType;
import java.net.UnknownHostException;
import java.util.LinkedList;
import java.util.List;
import java.util.Properties;
public class Server {
private static final int OSHI_WAIT_SECOND = 1000;
/**
* CPU相关信息
*/
private Cpu cpu = new Cpu();
/**
* 內存相关信息
*/
private Mem mem = new Mem();
/**
* JVM相关信息
*/
private Jvm jvm = new Jvm();
/**
* 服务器相关信息
*/
private Sys sys = new Sys();
/**
* 磁盘相关信息
*/
private List<SysFile> sysFiles = new LinkedList<SysFile>();
public void copyTo() throws Exception {
SystemInfo si = new SystemInfo();
HardwareAbstractionLayer hal = si.getHardware();
setCpuInfo(hal.getProcessor());
setMemInfo(hal.getMemory());
setSysInfo();
setJvmInfo();
setSysFiles(si.getOperatingSystem());
}
/**
* 设置CPU信息
*/
private void setCpuInfo(CentralProcessor processor) {
// CPU信息
long[] prevTicks = processor.getSystemCpuLoadTicks();
Util.sleep(OSHI_WAIT_SECOND);
long[] ticks = processor.getSystemCpuLoadTicks();
long nice = ticks[TickType.NICE.getIndex()] - prevTicks[TickType.NICE.getIndex()];
long irq = ticks[TickType.IRQ.getIndex()] - prevTicks[TickType.IRQ.getIndex()];
long softirq = ticks[TickType.SOFTIRQ.getIndex()] - prevTicks[TickType.SOFTIRQ.getIndex()];
long steal = ticks[TickType.STEAL.getIndex()] - prevTicks[TickType.STEAL.getIndex()];
long cSys = ticks[TickType.SYSTEM.getIndex()] - prevTicks[TickType.SYSTEM.getIndex()];
long user = ticks[TickType.USER.getIndex()] - prevTicks[TickType.USER.getIndex()];
long iowait = ticks[TickType.IOWAIT.getIndex()] - prevTicks[TickType.IOWAIT.getIndex()];
long idle = ticks[TickType.IDLE.getIndex()] - prevTicks[TickType.IDLE.getIndex()];
long totalCpu = user + nice + cSys + idle + iowait + irq + softirq + steal;
cpu.setNumber(processor.getLogicalProcessorCount());
cpu.setTotalUsed(totalCpu);
cpu.setSysUsed(cSys);
cpu.setUserUsed(user);
cpu.setWait(iowait);
cpu.setFree(idle);
}
/**
* 设置内存信息
*/
private void setMemInfo(GlobalMemory memory) {
mem.setTotal(memory.getTotal());
mem.setUsed(memory.getTotal() - memory.getAvailable());
mem.setFree(memory.getAvailable());
}
/**
* 设置服务器信息
*/
private void setSysInfo() {
Properties props = System.getProperties();
sys.setOsName(props.getProperty("os.name"));
sys.setOsArch(props.getProperty("os.arch"));
sys.setUserDir(props.getProperty("user.dir"));
}
/**
* 设置Java虚拟机
*/
private void setJvmInfo() throws UnknownHostException {
Properties props = System.getProperties();
jvm.setTotal(Runtime.getRuntime().totalMemory());
jvm.setMax(Runtime.getRuntime().maxMemory());
jvm.setFree(Runtime.getRuntime().freeMemory());
jvm.setVersion(props.getProperty("java.version"));
jvm.setHome(props.getProperty("java.home"));
}
/**
* 设置磁盘信息
*/
private void setSysFiles(OperatingSystem os) {
FileSystem fileSystem = os.getFileSystem();
List<OSFileStore> fsArray = fileSystem.getFileStores();
for (OSFileStore fs : fsArray) {
long free = fs.getUsableSpace();
long total = fs.getTotalSpace();
long used = total - free;
SysFile sysFile = new SysFile();
sysFile.setDirName(fs.getMount());
sysFile.setSysTypeName(fs.getType());
sysFile.setTypeName(fs.getName());
sysFile.setTotal(total);
sysFile.setFree(free);
sysFile.setUsed(used);
sysFile.setUsage(used/total);
sysFiles.add(sysFile);
}
}
public Cpu getCpu() {
return cpu;
}
public void setCpu(Cpu cpu) {
this.cpu = cpu;
}
public Mem getMem() {
return mem;
}
public void setMem(Mem mem) {
this.mem = mem;
}
public Jvm getJvm() {
return jvm;
}
public void setJvm(Jvm jvm) {
this.jvm = jvm;
}
public Sys getSys() {
return sys;
}
public void setSys(Sys sys) {
this.sys = sys;
}
public List<SysFile> getSysFiles() {
return sysFiles;
}
public void setSysFiles(List<SysFile> sysFiles) {
this.sysFiles = sysFiles;
}
}

82
io.sc.platform.monitor/src/main/java/io/sc/platform/monitor/service/support/ServerInfo.java

@ -0,0 +1,82 @@
package io.sc.platform.monitor.service.support;
import oshi.SystemInfo;
public class ServerInfo {
private Hardware hardware;
private Os os;
private Cpu cpu;
private Memory memory;
private Disk disk;
private Jvm jvm;
private int onlineUserCount;
public static ServerInfo info(){
SystemInfo si = new SystemInfo();
ServerInfo server =new ServerInfo();
server.setHardware(Hardware.from(si.getHardware()));
server.setOs(Os.from(si.getOperatingSystem()));
server.setCpu(Cpu.from(si.getHardware().getProcessor()));
server.setMemory(Memory.from(si.getHardware().getMemory()));
server.setDisk(Disk.from());
server.setJvm(Jvm.from());
return server;
}
public Hardware getHardware() {
return hardware;
}
public void setHardware(Hardware hardware) {
this.hardware = hardware;
}
public Os getOs() {
return os;
}
public void setOs(Os os) {
this.os = os;
}
public Cpu getCpu() {
return cpu;
}
public void setCpu(Cpu cpu) {
this.cpu = cpu;
}
public Memory getMemory() {
return memory;
}
public void setMemory(Memory memory) {
this.memory = memory;
}
public Disk getDisk() {
return disk;
}
public void setDisk(Disk disk) {
this.disk = disk;
}
public Jvm getJvm() {
return jvm;
}
public void setJvm(Jvm jvm) {
this.jvm = jvm;
}
public int getOnlineUserCount() {
return onlineUserCount;
}
public void setOnlineUserCount(int onlineUserCount) {
this.onlineUserCount = onlineUserCount;
}
}

68
io.sc.platform.monitor/src/main/java/io/sc/platform/monitor/service/support/Sys.java

@ -1,68 +0,0 @@
package io.sc.platform.monitor.service.support;
public class Sys {
/**
* 服务器名称
*/
private String computerName;
/**
* 服务器Ip
*/
private String computerIp;
/**
* 项目路径
*/
private String userDir;
/**
* 操作系统
*/
private String osName;
/**
* 系统架构
*/
private String osArch;
public String getComputerName() {
return computerName;
}
public void setComputerName(String computerName) {
this.computerName = computerName;
}
public String getComputerIp() {
return computerIp;
}
public void setComputerIp(String computerIp) {
this.computerIp = computerIp;
}
public String getUserDir() {
return userDir;
}
public void setUserDir(String userDir) {
this.userDir = userDir;
}
public String getOsName() {
return osName;
}
public void setOsName(String osName) {
this.osName = osName;
}
public String getOsArch() {
return osArch;
}
public void setOsArch(String osArch) {
this.osArch = osArch;
}
}

94
io.sc.platform.monitor/src/main/java/io/sc/platform/monitor/service/support/SysFile.java

@ -1,94 +0,0 @@
package io.sc.platform.monitor.service.support;
public class SysFile {
/**
* 盘符路径
*/
private String dirName;
/**
* 盘符类型
*/
private String sysTypeName;
/**
* 文件类型
*/
private String typeName;
/**
* 总大小
*/
private long total;
/**
* 剩余大小
*/
private long free;
/**
* 已经使用量
*/
private long used;
/**
* 资源的使用率
*/
private double usage;
public String getDirName() {
return dirName;
}
public void setDirName(String dirName) {
this.dirName = dirName;
}
public String getSysTypeName() {
return sysTypeName;
}
public void setSysTypeName(String sysTypeName) {
this.sysTypeName = sysTypeName;
}
public String getTypeName() {
return typeName;
}
public void setTypeName(String typeName) {
this.typeName = typeName;
}
public long getTotal() {
return total;
}
public void setTotal(long total) {
this.total = total;
}
public long getFree() {
return free;
}
public void setFree(long free) {
this.free = free;
}
public long getUsed() {
return used;
}
public void setUsed(long used) {
this.used = used;
}
public double getUsage() {
return usage;
}
public void setUsage(double usage) {
this.usage = usage;
}
}

2
io.sc.platform.monitor/src/main/resources/META-INF/MANIFEST.MF

@ -1,4 +1,4 @@
Manifest-Version: 1.0
Implementation-Vendor: io.sc
Implementation-Title: io.sc.platform.mvc
Implementation-Title: io.sc.platform.monitor
Implementation-Version: 1.0.0

15
io.sc.platform.monitor/src/main/resources/META-INF/spring.factories

@ -1,15 +0,0 @@
# Auto Configuration
#org.springframework.boot.autoconfigure.EnableAutoConfiguration=\
#io.sc.platform.mvc.autoconfigure.MvcWebMvcAutoConfiguration,\
#io.sc.platform.mvc.autoconfigure.MvcServiceProviderAutoConfiguration,\
#io.sc.platform.mvc.autoconfigure.ReturnValueAutoConfiguration,\
#io.sc.platform.mvc.autoconfigure.MvcErrorAutoConfiguration
# Auto Configuration
org.springframework.boot.autoconfigure.EnableAutoConfiguration=\
io.sc.platform.mvc.autoconfigure.MvcServiceProviderAutoConfiguration
# platform plugin spi service
io.sc.platform.core.spi.PluginSpiService=\
io.sc.platform.mvc.plugins.PluginSpiServiceImpl

3
io.sc.platform.mvc/src/main/java/io/sc/platform/mvc/autoconfigure/MvcWebMvcAutoConfiguration.java

@ -1,5 +1,6 @@
package io.sc.platform.mvc.autoconfigure;
import io.sc.platform.mvc.autoconfigure.support.OnlineUserCounterInterceptor;
import io.sc.platform.mvc.autoconfigure.support.RequestHeaderLocaleChangeInterceptor;
import io.sc.platform.mvc.plugins.PluginManager;
import io.sc.platform.mvc.plugins.item.Resource;
@ -63,6 +64,8 @@ public class MvcWebMvcAutoConfiguration implements WebMvcConfigurer{
registry.addInterceptor(new RequestHeaderLocaleChangeInterceptor());
//主题拦截器
registry.addInterceptor(new ThemeChangeInterceptor());
//在线用户计数器
registry.addInterceptor(new OnlineUserCounterInterceptor());
}
@Override

44
io.sc.platform.mvc/src/main/java/io/sc/platform/mvc/autoconfigure/support/OnlineUserCounterInterceptor.java

@ -0,0 +1,44 @@
package io.sc.platform.mvc.autoconfigure.support;
import io.sc.platform.security.util.SecurityUtil;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.lang.Nullable;
import org.springframework.util.ObjectUtils;
import org.springframework.util.StringUtils;
import org.springframework.web.servlet.HandlerInterceptor;
import org.springframework.web.servlet.LocaleResolver;
import org.springframework.web.servlet.support.RequestContextUtils;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.HashSet;
import java.util.Locale;
import java.util.Set;
public class OnlineUserCounterInterceptor implements HandlerInterceptor {
private static final Set<String> sessionIds =new HashSet<>();
public static void addSession(String sessionId) {
if(StringUtils.hasText(sessionId)) {
sessionIds.add(sessionId);
}
}
public static void removeSession(String sessionId) {
if(StringUtils.hasText(sessionId)) {
sessionIds.remove(sessionId);
}
}
public static int count(){
return sessionIds.size();
}
@Override
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws ServletException {
OnlineUserCounterInterceptor.addSession(SecurityUtil.getUserId());
return true;
}
}

2
io.sc.platform.system.frontend/package.json

@ -92,7 +92,7 @@
"luckyexcel": "1.0.1",
"mockjs": "1.1.0",
"pinia": "2.1.7",
"platform-core": "8.1.223",
"platform-core": "8.1.225",
"quasar": "2.15.3",
"tailwindcss": "3.4.3",
"vue": "3.4.24",

4
io.sc.platform.system.frontend/src/components/index.ts

@ -18,7 +18,7 @@ import component_system_I18n from '@/views/i18n/I18n.vue';
import component_system_datasource from '@/views/datasource/Datasource.vue';
import component_system_monitor_AuditLog from '@/views/monitor/AuditLog.vue';
import component_system_monitor_Log from '@/views/monitor/Log.vue';
import component_system_monitor_Resources from '@/views/monitor/Resources.vue';
import component_system_monitor_ServerInfo from '@/views/monitor/ServerInfo.vue';
const localComponents = {
'component.system.License': component_system_License,
@ -37,7 +37,7 @@ const localComponents = {
'component.system.datasource': component_system_datasource,
'component.system.monitor.AuditLog': component_system_monitor_AuditLog,
'component.system.monitor.Log': component_system_monitor_Log,
'component.system.monitor.Resources': component_system_monitor_Resources,
'component.system.monitor.ServerInfo': component_system_monitor_ServerInfo,
};
export default localComponents;

9
io.sc.platform.system.frontend/src/i18n/messages.json

@ -17,7 +17,7 @@
"menu.system.monitor" : "Monitor",
"menu.system.monitor.auditlog" : "Audit Log",
"menu.system.monitor.log" : "Log",
"menu.system.monitor.resources" : "Resources",
"menu.system.monitor.serverInfo" : "Server Information",
"system.shared.selectUser.grid.title": "Included User List",
"system.shared.selectUser.grid.toolbar.selectIn":"Select In",
@ -152,5 +152,10 @@
"system.monitor.log.download.grid.title":"Log File List",
"system.monitor.log.level.grid.title":"Log Level List",
"system.monitor.log.level.entity.configuredLevel":"Configured",
"system.monitor.log.level.entity.effectiveLevel":"Effective"
"system.monitor.log.level.entity.effectiveLevel":"Effective",
"system.monitor.serverInfo.os":"Operating System",
"system.monitor.serverInfo.os.name":"Name",
"system.monitor.serverInfo.os.version":"Version",
"system.monitor.serverInfo.os.arch":"Architecture",
}

9
io.sc.platform.system.frontend/src/i18n/messages_tw_CN.json

@ -17,7 +17,7 @@
"menu.system.monitor" : "系統監控",
"menu.system.monitor.auditlog" : "審計日誌",
"menu.system.monitor.log" : "系統日誌",
"menu.system.monitor.resources" : "系統資源",
"menu.system.monitor.serverInfo" : "服務器信息",
"system.shared.selectUser.grid.title": "已包含用戶列表",
"system.shared.selectUser.grid.toolbar.selectIn":"選入",
@ -129,5 +129,10 @@
"system.monitor.log.download.grid.title":"日誌文件列表",
"system.monitor.log.level.grid.title":"日誌級別列表",
"system.monitor.log.level.entity.configuredLevel":"配置級別",
"system.monitor.log.level.entity.effectiveLevel":"生效級別"
"system.monitor.log.level.entity.effectiveLevel":"生效級別",
"system.monitor.serverInfo.os":"操作系統",
"system.monitor.serverInfo.os.name":"名稱",
"system.monitor.serverInfo.os.version":"版本",
"system.monitor.serverInfo.os.arch":"架構",
}

39
io.sc.platform.system.frontend/src/i18n/messages_zh_CN.json

@ -17,7 +17,7 @@
"menu.system.monitor" : "系统监控",
"menu.system.monitor.auditlog" : "审计日志",
"menu.system.monitor.log" : "系统日志",
"menu.system.monitor.resources" : "系统资源",
"menu.system.monitor.serverInfo" : "服务器信息",
"system.shared.selectUser.grid.title": "已包含用户列表",
"system.shared.selectUser.grid.toolbar.selectIn":"选入",
@ -151,5 +151,40 @@
"system.monitor.log.download.grid.title":"日志文件列表",
"system.monitor.log.level.grid.title":"日志级别列表",
"system.monitor.log.level.entity.configuredLevel":"配置级别",
"system.monitor.log.level.entity.effectiveLevel":"生效级别"
"system.monitor.log.level.entity.effectiveLevel":"生效级别",
"system.monitor.serverInfo.hardware":"硬件",
"system.monitor.serverInfo.hardware.manufacturer":"生产商",
"system.monitor.serverInfo.hardware.model":"型号",
"system.monitor.serverInfo.hardware.serialNumber":"序列号",
"system.monitor.serverInfo.hardware.physicalProcessorCount":"物理处理器个数",
"system.monitor.serverInfo.hardware.logicalProcessorCount":"逻辑处理器个数",
"system.monitor.serverInfo.hardware.physicalMemory":"物理内存",
"system.monitor.serverInfo.os":"操作系统",
"system.monitor.serverInfo.os.name":"名称",
"system.monitor.serverInfo.os.version":"版本",
"system.monitor.serverInfo.os.arch":"架构",
"system.monitor.serverInfo.os.manufacturer":"生产商",
"system.monitor.serverInfo.os.bootTime":"上次启动日期",
"system.monitor.serverInfo.os.upTime":"持续运行天数",
"system.monitor.serverInfo.jvm":"Java 虚拟机",
"system.monitor.serverInfo.jvm.total":"当前占用的内存总数",
"system.monitor.serverInfo.jvm.max":"最大可用内存总数",
"system.monitor.serverInfo.jvm.free":"空闲内存",
"system.monitor.serverInfo.jvm.version":"JDK 版本",
"system.monitor.serverInfo.jvm.home":"JDK 路径",
"system.monitor.serverInfo.cpu":"CPU",
"system.monitor.serverInfo.cpu.system":"系统",
"system.monitor.serverInfo.cpu.user":"用户",
"system.monitor.serverInfo.memory":"内存",
"system.monitor.serverInfo.disk":"存储",
"system.monitor.serverInfo.disk.used":"已用",
"system.monitor.serverInfo.disk.free":"空闲",
"system.monitor.serverInfo.online":"在线用户",
}

4
io.sc.platform.system.frontend/src/menus/menus.json

@ -64,7 +64,7 @@
{"type":"ROUTE", "order":100, "parentId":"menu.system.monitor", "id":"menu.system.monitor.auditlog", "titleI18nKey":"menu.system.monitor.auditlog", "icon":"bi-card-list", "routeName":"route.system.monitor.auditlog","authorizeExpression":"'database'.equals(T(org.wsp.framework.core.Environment).getAuditLogType())"},
/*//*/
{"type":"ROUTE", "order":200, "parentId":"menu.system.monitor", "id":"menu.system.monitor.log", "titleI18nKey":"menu.system.monitor.log", "icon":"bi-terminal", "routeName":"route.system.monitor.log"},
/*//*/
{"type":"ROUTE", "order":300, "parentId":"menu.system.monitor", "id":"menu.system.monitor.resources", "titleI18nKey":"menu.system.monitor.resources", "icon":"ssid_chart", "routeName":"route.system.monitor.resources"}
/*//*/
{"type":"ROUTE", "order":300, "parentId":"menu.system.monitor", "id":"menu.system.monitor.serverInfo", "titleI18nKey":"menu.system.monitor.serverInfo", "icon":"ssid_chart", "routeName":"route.system.monitor.serverInfo"}
]

10
io.sc.platform.system.frontend/src/routes/routes.json

@ -247,16 +247,16 @@
},
{
"parent": "/",
"name": "route.system.monitor.resources",
"path": "system/monitor/resources",
"name": "route.system.monitor.serverInfo",
"path": "system/monitor/serverInfo",
"priority": 0,
"module": "io.sc.platform.system.frontend",
"component": "component.system.monitor.Resources",
"componentPath":"@/views/monitor/Resources.vue",
"component": "component.system.monitor.ServerInfo",
"componentPath":"@/views/monitor/ServerInfo.vue",
"redirect": null,
"meta": {
"permissions": [
"/system/monitor/resources/**/*"
"/system/monitor/serverInfo/**/*"
]
}
}

11
io.sc.platform.system.frontend/src/views/application/Application.vue

@ -63,14 +63,12 @@
}"
@row-click="
(evt, row, index) => {
currentSelectedApplicationId = row.id;
menuTreeGridRef?.refresh();
refreshRelationshipComponents(row.id);
}
"
@before-request-data="
() => {
currentSelectedApplicationId = '';
menuTreeGridRef?.refresh();
refreshRelationshipComponents('');
}
"
>
@ -109,6 +107,11 @@ const menuTreeGridRef = ref();
const selectedTabRef = ref('menu');
const currentSelectedApplicationId = ref('');
const refreshRelationshipComponents = (id) => {
currentSelectedApplicationId.value = id;
menuTreeGridRef.value?.refresh();
};
const update = (ids, gridComponent) => {
axios
.post(Environment.apiContextPath('/api/system/application/updateMenus'), {

11
io.sc.platform.system.frontend/src/views/corporation/Corporation.vue

@ -74,14 +74,12 @@
}"
@row-click="
(evt, row, index) => {
currentSelectedCorporationCode = row.code;
userGridRef?.refresh();
refreshRelationshipComponents(row.code);
}
"
@before-request-data="
() => {
currentSelectedCorporationCode = '';
userGridRef?.refresh();
refreshRelationshipComponents('');
}
"
></w-grid>
@ -114,6 +112,11 @@ const corporationTreeGridRef = ref();
const userGridRef = ref();
const currentSelectedCorporationCode = ref('');
const refreshRelationshipComponents = (id) => {
currentSelectedCorporationCode.value = id;
userGridRef.value?.refresh();
};
const selectIn = (ids: string[], gridComponent, dialogComponent) => {
axios
.post(Environment.apiContextPath('/api/system/corporation/addUsers'), {

11
io.sc.platform.system.frontend/src/views/department/Department.vue

@ -75,14 +75,12 @@
}"
@row-click="
(evt, row, index) => {
currentSelectedDepartmentId = row.id;
userGridRef?.refresh();
refreshRelationshipComponents(row.id);
}
"
@before-request-data="
() => {
currentSelectedDepartmentId = '';
userGridRef?.refresh();
refreshRelationshipComponents('');
}
"
></w-grid>
@ -125,6 +123,11 @@ const userGridRef = ref();
const selectedTabRef = ref('user');
const currentSelectedDepartmentId = ref('');
const refreshRelationshipComponents = (id) => {
currentSelectedDepartmentId.value = id;
userGridRef.value?.refresh();
};
const selectIn = (ids: string[], gridComponent, dialogComponent) => {
axios
.post(Environment.apiContextPath('/api/system/department/addUsers'), {

68
io.sc.platform.system.frontend/src/views/menu/Menu.vue

@ -183,16 +183,12 @@
"
@row-click="
(evt, row, index) => {
currentSelectedMenuId = row.id;
roleGridRef?.refresh();
orgTreeGridRef?.refresh();
refreshRelationshipComponents(row.id);
}
"
@before-request-data="
() => {
currentSelectedMenuId = '';
roleGridRef?.refresh();
orgTreeGridRef?.refresh();
refreshRelationshipComponents('');
}
"
></w-grid>
@ -270,11 +266,19 @@ const importMenuPluginDialogRef = ref();
const selectedTabRef = ref('role');
const currentSelectedMenuId = ref('');
const refreshRelationshipComponents = (id) => {
currentSelectedMenuId.value = id;
roleGridRef.value?.refresh();
orgTreeGridRef.value?.refresh();
};
const selectRoleIn = (ids: string[], gridComponent, dialogComponent) => {
axios
.post(Environment.apiContextPath('/api/system/menu/addRoles'), {
one: menuTreeGridRef.value.getSelectedRows()[0].id,
many: ids,
source: menuTreeGridRef.value.getSelectedRow().id,
sourceParents: menuTreeGridRef.value.getCascadeParents('id'),
sourceChildren: menuTreeGridRef.value.getCascadeChildren('id'),
targets: ids,
})
.then(() => {
gridComponent?.refresh();
@ -285,8 +289,10 @@ const selectRoleIn = (ids: string[], gridComponent, dialogComponent) => {
const selectRoleOut = (ids, gridComponent) => {
axios
.post(Environment.apiContextPath('/api/system/menu/removeRoles'), {
one: menuTreeGridRef.value.getSelectedRows()[0].id,
many: ids,
source: menuTreeGridRef.value.getSelectedRow().id,
sourceParents: menuTreeGridRef.value.getCascadeParents('id'),
sourceChildren: menuTreeGridRef.value.getCascadeChildren('id'),
targets: ids,
})
.then(() => {
gridComponent?.refresh();
@ -296,8 +302,10 @@ const selectRoleOut = (ids, gridComponent) => {
const selectRoleAllIn = (gridComponent) => {
axios
.post(Environment.apiContextPath('/api/system/menu/addAllRoles'), {
one: menuTreeGridRef.value.getSelectedRows()[0].id,
many: [],
source: menuTreeGridRef.value.getSelectedRow().id,
sourceParents: menuTreeGridRef.value.getCascadeParents('id'),
sourceChildren: menuTreeGridRef.value.getCascadeChildren('id'),
targets: [],
})
.then(() => {
gridComponent?.refresh();
@ -307,8 +315,10 @@ const selectRoleAllIn = (gridComponent) => {
const selectRoleAllOut = (gridComponent) => {
axios
.post(Environment.apiContextPath('/api/system/menu/removeAllRoles'), {
one: menuTreeGridRef.value.getSelectedRows()[0].id,
many: [],
source: menuTreeGridRef.value.getSelectedRow().id,
sourceParents: menuTreeGridRef.value.getCascadeParents('id'),
sourceChildren: menuTreeGridRef.value.getCascadeChildren('id'),
targets: [],
})
.then(() => {
gridComponent?.refresh();
@ -318,8 +328,10 @@ const selectRoleAllOut = (gridComponent) => {
const selectApplicationIn = (ids: string[], gridComponent, dialogComponent) => {
axios
.post(Environment.apiContextPath('/api/system/menu/addApplications'), {
one: menuTreeGridRef.value.getSelectedRows()[0].id,
many: ids,
source: menuTreeGridRef.value.getSelectedRow().id,
sourceParents: menuTreeGridRef.value.getCascadeParents('id'),
sourceChildren: menuTreeGridRef.value.getCascadeChildren('id'),
targets: ids,
})
.then(() => {
gridComponent?.refresh();
@ -330,8 +342,10 @@ const selectApplicationIn = (ids: string[], gridComponent, dialogComponent) => {
const selectApplicationOut = (ids, gridComponent) => {
axios
.post(Environment.apiContextPath('/api/system/menu/removeApplications'), {
one: menuTreeGridRef.value.getSelectedRows()[0].id,
many: ids,
source: menuTreeGridRef.value.getSelectedRow().id,
sourceParents: menuTreeGridRef.value.getCascadeParents('id'),
sourceChildren: menuTreeGridRef.value.getCascadeChildren('id'),
targets: ids,
})
.then(() => {
gridComponent?.refresh();
@ -341,8 +355,10 @@ const selectApplicationOut = (ids, gridComponent) => {
const selectApplicationAllIn = (gridComponent) => {
axios
.post(Environment.apiContextPath('/api/system/menu/addAllApplications'), {
one: menuTreeGridRef.value.getSelectedRows()[0].id,
many: [],
source: menuTreeGridRef.value.getSelectedRow().id,
sourceParents: menuTreeGridRef.value.getCascadeParents('id'),
sourceChildren: menuTreeGridRef.value.getCascadeChildren('id'),
targets: [],
})
.then(() => {
gridComponent?.refresh();
@ -352,8 +368,10 @@ const selectApplicationAllIn = (gridComponent) => {
const selectApplicationAllOut = (gridComponent) => {
axios
.post(Environment.apiContextPath('/api/system/menu/removeAllApplications'), {
one: menuTreeGridRef.value.getSelectedRows()[0].id,
many: [],
source: menuTreeGridRef.value.getSelectedRow().id,
sourceParents: menuTreeGridRef.value.getCascadeParents('id'),
sourceChildren: menuTreeGridRef.value.getCascadeChildren('id'),
targets: [],
})
.then(() => {
gridComponent?.refresh();
@ -363,8 +381,10 @@ const selectApplicationAllOut = (gridComponent) => {
const update = (ids, gridComponent) => {
axios
.post(Environment.apiContextPath('/api/system/menu/updateOrgs'), {
one: menuTreeGridRef.value.getSelectedRows()[0].id,
many: ids,
source: menuTreeGridRef.value.getSelectedRow().id,
sourceParents: menuTreeGridRef.value.getCascadeParents('id'),
sourceChildren: menuTreeGridRef.value.getCascadeChildren('id'),
targets: ids,
})
.then(() => {
gridComponent.refresh();

4
io.sc.platform.system.frontend/src/views/monitor/Resources.vue

@ -1,4 +0,0 @@
<template>
<div>Resources</div>
</template>
<script setup lang="ts"></script>

215
io.sc.platform.system.frontend/src/views/monitor/ServerInfo.vue

@ -0,0 +1,215 @@
<template>
<div class="pt-4">
<div class="row">
<div class="col-4 px-4">
<q-card>
<q-card-section>
<div class="text-h6">{{ $t('system.monitor.serverInfo.hardware') }}</div>
<div class="pl-4 py-1 text-xs text-gray-600">
{{ $t('system.monitor.serverInfo.hardware.manufacturer') }} : {{ serverInfo?.hardware?.manufacturer }}
</div>
<div class="pl-4 py-1 text-xs text-gray-600">{{ $t('system.monitor.serverInfo.hardware.model') }} : {{ serverInfo?.hardware?.model }}</div>
<div class="pl-4 py-1 text-xs text-gray-600">
{{ $t('system.monitor.serverInfo.hardware.serialNumber') }} : {{ serverInfo?.hardware?.serialNumber }}
</div>
<div class="pl-4 py-1 text-xs text-gray-600">
{{ $t('system.monitor.serverInfo.hardware.physicalProcessorCount') }} : {{ serverInfo?.hardware?.physicalProcessorCount }}
</div>
<div class="pl-4 py-1 text-xs text-gray-600">
{{ $t('system.monitor.serverInfo.hardware.logicalProcessorCount') }} : {{ serverInfo?.hardware?.logicalProcessorCount }}
</div>
<div class="pl-4 py-1 text-xs text-gray-600">
{{ $t('system.monitor.serverInfo.hardware.physicalMemory') }} : {{ serverInfo?.hardware?.physicalMemory }} G
</div>
</q-card-section>
</q-card>
</div>
<div class="col-4 px-4">
<q-card>
<q-card-section>
<div class="text-h6">{{ $t('system.monitor.serverInfo.os') }}</div>
<div class="pl-4 py-1 text-xs text-gray-600">{{ $t('system.monitor.serverInfo.os.name') }} : {{ serverInfo?.os?.name }}</div>
<div class="pl-4 py-1 text-xs text-gray-600">{{ $t('system.monitor.serverInfo.os.version') }} : {{ serverInfo?.os?.version }}</div>
<div class="pl-4 py-1 text-xs text-gray-600">{{ $t('system.monitor.serverInfo.os.arch') }} : {{ serverInfo?.os?.arch }}</div>
<div class="pl-4 py-1 text-xs text-gray-600">{{ $t('system.monitor.serverInfo.os.manufacturer') }} : {{ serverInfo?.os?.manufacturer }}</div>
<div class="pl-4 py-1 text-xs text-gray-600">{{ $t('system.monitor.serverInfo.os.bootTime') }} : {{ serverInfo?.os?.bootTime }}</div>
<div class="pl-4 py-1 text-xs text-gray-600">{{ $t('system.monitor.serverInfo.os.upTime') }} : {{ serverInfo?.os?.upTime }}</div>
</q-card-section>
</q-card>
</div>
<div class="col-4 px-4">
<q-card>
<q-card-section>
<div class="text-h6">{{ $t('system.monitor.serverInfo.jvm') }}</div>
<div class="pl-4 py-1 text-xs text-gray-600">{{ $t('system.monitor.serverInfo.jvm.total') }} : {{ serverInfo?.jvm?.total }}</div>
<div class="pl-4 py-1 text-xs text-gray-600">{{ $t('system.monitor.serverInfo.jvm.max') }} : {{ serverInfo?.jvm?.max }}</div>
<div class="pl-4 py-1 text-xs text-gray-600">{{ $t('system.monitor.serverInfo.jvm.free') }} : {{ serverInfo?.jvm?.free }}</div>
<div class="pl-4 py-1 text-xs text-gray-600">{{ $t('system.monitor.serverInfo.jvm.version') }} : {{ serverInfo?.jvm?.version }}</div>
<div class="pl-4 py-1 text-xs text-gray-600">{{ $t('system.monitor.serverInfo.jvm.home') }} : {{ serverInfo?.jvm?.home }}</div>
</q-card-section>
<q-separator />
</q-card>
</div>
</div>
<div class="row pt-4">
<div class="col-4 px-4">
<q-card>
<q-card-section>
<div class="text-h6">{{ $t('system.monitor.serverInfo.cpu') }}</div>
<w-echarts ref="cpuEchartsRef" style="width: 100%; height: 250px" :option="cpuOption"></w-echarts>
</q-card-section>
</q-card>
</div>
<div class="col-4 px-4">
<q-card>
<q-card-section>
<div class="text-h6">{{ $t('system.monitor.serverInfo.memory') }}</div>
<w-echarts ref="memoryEchartsRef" style="width: 100%; height: 250px" :option="memoryOption"></w-echarts>
</q-card-section>
</q-card>
</div>
<div class="col-4 px-4">
<q-card>
<q-card-section>
<div class="text-h6">{{ $t('system.monitor.serverInfo.disk') }}</div>
<w-echarts ref="diskEchartsRef" style="width: 100%; height: 250px" :option="diskOption"></w-echarts>
</q-card-section>
</q-card>
</div>
</div>
<div class="row pt-4">
<div class="col-4 px-4">
<q-card>
<q-card-section>
<div class="text-h6">{{ $t('system.monitor.serverInfo.online') }}</div>
<w-echarts ref="onlineEchartsRef" style="width: 100%; height: 250px" :option="onlineOption"></w-echarts>
</q-card-section>
</q-card>
</div>
<div class="col-4 px-4"></div>
<div class="col-4 px-4"></div>
</div>
</div>
</template>
<script setup lang="ts">
import { ref, onMounted, onActivated, onDeactivated } from 'vue';
import { axios, Environment, t } from 'platform-core';
const serverInfo = ref();
const cpuEchartsRef = ref();
const cpuOption = {
animation: false,
legend: { data: [t('system.monitor.serverInfo.cpu.system'), t('system.monitor.serverInfo.cpu.user')] },
grid: { right: '4%', bottom: '3%' },
xAxis: [{ type: 'category', data: [] }],
yAxis: [{ type: 'value', min: 0, max: 1 }],
series: [
{ name: t('system.monitor.serverInfo.cpu.system'), type: 'line', stack: 'Total', showSymbol: false, smooth: true, areaStyle: {}, data: [] },
{ name: t('system.monitor.serverInfo.cpu.user'), type: 'line', stack: 'Total', showSymbol: false, smooth: true, areaStyle: {}, data: [] },
],
};
const memoryEchartsRef = ref();
const memoryOption = {
animation: false,
grid: { right: '4%', bottom: '3%' },
xAxis: [{ type: 'category', data: [] }],
yAxis: [{ type: 'value', min: 0, max: 1 }],
series: [{ type: 'line', stack: 'Total', showSymbol: false, smooth: true, areaStyle: {}, data: [] }],
};
const diskEchartsRef = ref();
const diskOption = {
animation: false,
legend: {},
tooltip: {
trigger: 'item',
formatter: (params) => {
return params.value + ' G';
},
},
series: [
{
type: 'pie',
top: 50,
emphasis: {
itemStyle: {
shadowBlur: 10,
shadowOffsetX: 0,
shadowColor: 'rgba(0, 0, 0, 0.5)',
},
},
avoidLabelOverlap: false,
label: {
show: false,
position: 'center',
},
data: [
{ value: 0, name: t('system.monitor.serverInfo.disk.used') },
{ value: 0, name: t('system.monitor.serverInfo.disk.free') },
],
},
],
};
const onlineEchartsRef = ref();
const onlineOption = {
animation: false,
grid: { right: '4%', bottom: '3%' },
xAxis: [{ type: 'category', data: [] }],
yAxis: [{ type: 'value' }],
series: [{ type: 'line', stack: 'Total', showSymbol: false, smooth: true, data: [] }],
};
const refresh = () => {
axios.get(Environment.apiContextPath('/api/monitor/metrics')).then((response) => {
const data = response.data;
data.hardware.physicalMemory = (data.hardware.physicalMemory / 1024 / 1024 / 1024).toFixed(2);
serverInfo.value = data;
// cpu
cpuOption.xAxis[0].data.push('');
cpuOption.series[0].data.push(data.cpu.sysUsed / data.cpu.totalUsed);
cpuOption.series[1].data.push(data.cpu.userUsed / data.cpu.totalUsed);
if (cpuOption.xAxis[0].data.length > 60) {
cpuOption.xAxis[0].data.shift();
cpuOption.series[0].data.shift();
cpuOption.series[1].data.shift();
}
cpuEchartsRef.value.setOption(cpuOption);
// memory
memoryOption.xAxis[0].data.push('');
memoryOption.series[0].data.push(data.memory.used / data.memory.total);
if (memoryOption.xAxis[0].data.length > 60) {
memoryOption.xAxis[0].data.shift();
memoryOption.series[0].data.shift();
}
memoryEchartsRef.value.setOption(memoryOption);
// disk
diskOption.series[0].data[0].value = (data.disk.used / 1000 / 1000 / 1000).toFixed(2);
diskOption.series[0].data[1].value = (data.disk.free / 1000 / 1000 / 1000).toFixed(2);
diskEchartsRef.value.setOption(diskOption);
// online user
onlineOption.xAxis[0].data.push('');
onlineOption.series[0].data.push(data.onlineUserCount);
if (onlineOption.xAxis[0].data.length > 60) {
onlineOption.xAxis[0].data.shift();
onlineOption.series[0].data.shift();
}
onlineEchartsRef.value.setOption(onlineOption);
});
};
onMounted(() => {
refresh();
});
let intervalHandler;
onActivated(() => {
intervalHandler = setInterval(refresh, 2000);
});
onDeactivated(() => {
clearInterval(intervalHandler);
});
</script>

14
io.sc.platform.system.frontend/src/views/org/Org.vue

@ -74,16 +74,12 @@
}"
@row-click="
(evt, row, index) => {
currentSelectedOrgId = row.id;
userGridRef?.refresh();
menuTreeGridRef?.refresh();
refreshRelationshipComponents(row.id);
}
"
@before-request-data="
() => {
currentSelectedOrgId = '';
userGridRef?.refresh();
menuTreeGridRef?.refresh();
refreshRelationshipComponents('');
}
"
></w-grid>
@ -138,6 +134,12 @@ const menuTreeGridRef = ref();
const selectedTabRef = ref('user');
const currentSelectedOrgId = ref('');
const refreshRelationshipComponents = (id) => {
currentSelectedOrgId.value = id;
userGridRef.value?.refresh();
menuTreeGridRef.value?.refresh();
};
const selectIn = (ids: string[], gridComponent, dialogComponent) => {
axios
.post(Environment.apiContextPath('/api/system/org/addUsers'), {

18
io.sc.platform.system.frontend/src/views/role/Role.vue

@ -63,16 +63,12 @@
}"
@row-click="
(evt, row, index) => {
currentSelectedRoleId = row.id;
menuTreeGridRef?.refresh();
userGridRef?.refresh();
refreshRelationshipComponents(row.id);
}
"
@before-request-data="
() => {
currentSelectedRoleId = '';
menuTreeGridRef?.refresh();
userGridRef?.refresh();
refreshRelationshipComponents('');
}
"
>
@ -118,12 +114,10 @@
</template>
<script setup lang="ts">
import { ref } from 'vue';
import { Environment, axios, EnumTools, Options, Formater } from 'platform-core';
import { Environment, axios, Options, Formater } from 'platform-core';
import SelectUserGrid from '../shared/SelectUserGrid.vue';
import SelectMenuTreeGrid from '../shared/SelectMenuTreeGrid.vue';
const DataComeFromEnum = await EnumTools.fetch('io.sc.platform.orm.api.enums.DataComeFrom');
const roleGridRef = ref();
const userGridRef = ref();
const menuTreeGridRef = ref();
@ -131,6 +125,12 @@ const menuTreeGridRef = ref();
const selectedTabRef = ref('menu');
const currentSelectedRoleId = ref('');
const refreshRelationshipComponents = (id) => {
currentSelectedRoleId.value = id;
menuTreeGridRef.value?.refresh();
userGridRef.value?.refresh();
};
const selectIn = (ids: string[], gridComponent, dialogComponent) => {
axios
.post(Environment.apiContextPath('/api/system/role/addUsers'), {

18
io.sc.platform.system.frontend/src/views/shared/SelectApplicationGrid.vue

@ -7,13 +7,14 @@
:checkbox-selection="true"
:fetch-data-url="fetchDataUrl + '?' + foreignKey + '=' + foreignValue"
:auto-fetch-data="false"
:toolbar-configure="{ noIcon: true }"
:toolbar-configure="{ noIcon: false }"
:toolbar-actions="[
'refresh',
'separator',
{
name: 'selectIn',
label: $t('system.shared.selectApplication.grid.toolbar.selectIn'),
icon: 'bi-download',
enableIf: () => {
return foreignValue ? true : false;
},
@ -24,6 +25,7 @@
{
name: 'selectOut',
label: $t('system.shared.selectApplication.grid.toolbar.selectOut'),
icon: 'bi-upload',
enableIf: () => {
return foreignValue && gridRef?.getSelectedRows()?.length > 0;
},
@ -38,6 +40,7 @@
{
name: 'selectAllIn',
label: $t('system.shared.selectApplication.grid.toolbar.selectAllIn'),
icon: 'bi-box-arrow-in-down',
enableIf: () => {
return foreignValue ? true : false;
},
@ -50,6 +53,7 @@
{
name: 'selectAllOut',
label: $t('system.shared.selectApplication.grid.toolbar.selectAllOut'),
icon: 'bi-box-arrow-up',
enableIf: () => {
return foreignValue && gridRef?.getRows()?.length > 0;
},
@ -105,12 +109,12 @@
></SelectApplicationDialog>
</template>
<script setup lang="ts">
import { ref, onUpdated } from 'vue';
import { ref, onMounted, onUpdated } from 'vue';
import { EnumTools, DialogManager, Formater, Tools } from 'platform-core';
import { DialogManager, Formater, Tools } from 'platform-core';
import SelectApplicationDialog from './SelectApplicationDialog.vue';
const props = defineProps({
defineProps({
fetchDataUrl: { type: String, default: '' },
fetchOtherDataUrl: { type: String, default: '' },
foreignKey: { type: String, default: '' },
@ -131,8 +135,12 @@ const refresh = () => {
gridRef.value.refresh();
};
onMounted(() => {
refresh();
});
onUpdated(() => {
gridRef.value.refresh();
refresh();
});
defineExpose({

15
io.sc.platform.system.frontend/src/views/shared/SelectMenuTreeGrid.vue

@ -41,7 +41,7 @@
},
click: (arg) => {
DialogManager.confirm($t('system.shared.selectMenu.grid.toolbar.save.tip'), () => {
const ids = Tools.extractProperties(arg.tickeds, 'id');
const ids = Tools.extractProperties(treeGridRef.getTickedRows(true), 'id');
emit('update', ids, treeGridRef);
});
},
@ -83,7 +83,6 @@
{ name: 'urlOpenType', label: $t('urlOpenType') },
{ name: 'routeName', label: $t('routeName') },
{ name: 'routeQuery', label: $t('routeQuery') },
{ name: 'dataComeFrom', label: $t('dataComeFrom') },
{ name: 'creator', label: $t('creator') },
{ name: 'createDate', label: $t('createDate') },
@ -96,10 +95,10 @@
></w-grid>
</template>
<script setup lang="ts">
import { ref } from 'vue';
import { ref, onMounted, onUpdated } from 'vue';
import { DialogManager, Formater, Tools } from 'platform-core';
const props = defineProps({
defineProps({
fetchDataUrl: { type: String, default: '' },
foreignKey: { type: String, default: '' },
foreignValue: { type: String, default: '' },
@ -115,6 +114,14 @@ const refresh = () => {
treeGridRef.value.refresh();
};
onMounted(() => {
refresh();
});
onUpdated(() => {
refresh();
});
defineExpose({
refresh,
});

15
io.sc.platform.system.frontend/src/views/shared/SelectOrgTreeGrid.vue

@ -16,7 +16,7 @@
"
:fetch-data-url="fetchDataUrl + '?' + foreignKey + '=' + foreignValue"
:pageable="false"
:toolbar-configure="{ noIcon: true }"
:toolbar-configure="{ noIcon: false }"
:toolbar-actions="[
'refresh',
'separator',
@ -29,6 +29,7 @@
{
name: 'save',
label: $t('save'),
icon: 'bi-floppy',
enableIf: () => {
return foreignValue && treeGridRef?.getRows()?.length > 0;
},
@ -68,10 +69,10 @@
></w-grid>
</template>
<script setup lang="ts">
import { ref, onUpdated } from 'vue';
import { Environment, DialogManager, Formater, Tools } from 'platform-core';
import { ref, onMounted, onUpdated } from 'vue';
import { DialogManager, Formater, Tools } from 'platform-core';
const props = defineProps({
defineProps({
fetchDataUrl: { type: String, default: '' },
foreignKey: { type: String, default: '' },
foreignValue: { type: String, default: '' },
@ -87,8 +88,12 @@ const refresh = () => {
treeGridRef.value.refresh();
};
onMounted(() => {
refresh();
});
onUpdated(() => {
treeGridRef.value.refresh();
refresh();
});
defineExpose({

18
io.sc.platform.system.frontend/src/views/shared/SelectRoleGrid.vue

@ -7,13 +7,14 @@
:checkbox-selection="true"
:fetch-data-url="fetchDataUrl + '?' + foreignKey + '=' + foreignValue"
:auto-fetch-data="false"
:toolbar-configure="{ noIcon: true }"
:toolbar-configure="{ noIcon: false }"
:toolbar-actions="[
'refresh',
'separator',
{
name: 'selectIn',
label: $t('system.shared.selectRole.grid.toolbar.selectIn'),
icon: 'bi-download',
enableIf: () => {
return foreignValue ? true : false;
},
@ -24,6 +25,7 @@
{
name: 'selectOut',
label: $t('system.shared.selectRole.grid.toolbar.selectOut'),
icon: 'bi-upload',
enableIf: () => {
return foreignValue && gridRef?.getSelectedRows()?.length > 0;
},
@ -38,6 +40,7 @@
{
name: 'selectAllIn',
label: $t('system.shared.selectRole.grid.toolbar.selectAllIn'),
icon: 'bi-box-arrow-in-down',
enableIf: () => {
return foreignValue ? true : false;
},
@ -50,6 +53,7 @@
{
name: 'selectAllOut',
label: $t('system.shared.selectRole.grid.toolbar.selectAllOut'),
icon: 'bi-box-arrow-up',
enableIf: () => {
return foreignValue && gridRef?.getRows()?.length > 0;
},
@ -105,12 +109,12 @@
></SelectRoleDialog>
</template>
<script setup lang="ts">
import { ref, onUpdated } from 'vue';
import { ref, onMounted, onUpdated } from 'vue';
import { EnumTools, DialogManager, Formater, Tools } from 'platform-core';
import { DialogManager, Formater, Tools } from 'platform-core';
import SelectRoleDialog from './SelectRoleDialog.vue';
const props = defineProps({
defineProps({
fetchDataUrl: { type: String, default: '' },
fetchOtherDataUrl: { type: String, default: '' },
foreignKey: { type: String, default: '' },
@ -131,8 +135,12 @@ const refresh = () => {
gridRef.value.refresh();
};
onMounted(() => {
refresh();
});
onUpdated(() => {
gridRef.value.refresh();
refresh();
});
defineExpose({

10
io.sc.platform.system.frontend/src/views/shared/SelectUserGrid.vue

@ -128,12 +128,12 @@
></SelectUserDialog>
</template>
<script setup lang="ts">
import { ref, onUpdated } from 'vue';
import { ref, onMounted, onUpdated } from 'vue';
import { DialogManager, Tools } from 'platform-core';
import SelectUserDialog from './SelectUserDialog.vue';
import UserStatusTag from './UserStatusTag.vue';
const props = defineProps({
defineProps({
fetchDataUrl: { type: String, default: '' },
fetchOtherDataUrl: { type: String, default: '' },
foreignKey: { type: String, default: '' },
@ -154,8 +154,12 @@ const refresh = () => {
gridRef.value.refresh();
};
onMounted(() => {
refresh();
});
onUpdated(() => {
gridRef.value.refresh();
refresh();
});
defineExpose({

14
io.sc.platform.system.frontend/src/views/user/User.vue

@ -165,16 +165,12 @@
}"
@row-click="
(evt, row, index) => {
currentSelectedUserId = row.id;
roleGridRef?.refresh();
orgTreeGridRef?.refresh();
refreshRelationshipComponents(row.id);
}
"
@before-request-data="
() => {
currentSelectedUserId = '';
roleGridRef?.refresh();
orgTreeGridRef?.refresh();
refreshRelationshipComponents('');
}
"
></w-grid>
@ -233,6 +229,12 @@ const selectedTabRef = ref('role');
const setPasswordDialogRef = ref();
const currentSelectedUserId = ref('');
const refreshRelationshipComponents = (id) => {
currentSelectedUserId.value = id;
roleGridRef.value?.refresh();
orgTreeGridRef.value?.refresh();
};
const selectIn = (ids: string[], gridComponent, dialogComponent) => {
axios
.post(Environment.apiContextPath('/api/system/user/addRoles'), {

1
io.sc.platform.system/build.gradle

@ -1,5 +1,6 @@
dependencies {
api(
project(":io.sc.platform.monitor"),
project(":io.sc.platform.mvc"),
project(":io.sc.platform.security"),
project(":io.sc.platform.system.api"),

48
io.sc.platform.system/src/main/java/io/sc/platform/system/menu/service/impl/MenuServiceImpl.java

@ -160,7 +160,7 @@ public class MenuServiceImpl extends DaoServiceImpl<MenuEntity, String, MenuRepo
}
for (MenuVo allMenu : allMenus) {
if (selectedMenuIds.contains(allMenu.getId())) {
allMenu.setSelected(true);
allMenu.setTicked(true);
}
}
return allMenus;
@ -185,7 +185,7 @@ public class MenuServiceImpl extends DaoServiceImpl<MenuEntity, String, MenuRepo
}
for (MenuVo allMenu : allMenus) {
if (selectedMenuIds.contains(allMenu.getId())) {
allMenu.setSelected(true);
allMenu.setTicked(true);
}
}
return allMenus;
@ -387,7 +387,7 @@ public class MenuServiceImpl extends DaoServiceImpl<MenuEntity, String, MenuRepo
}
}
sqlBatcher.execute(jdbcTemplate);
standardMenuAndRoleTable();
standardMenuAndApplicationTable();
}
}
@ -414,7 +414,7 @@ public class MenuServiceImpl extends DaoServiceImpl<MenuEntity, String, MenuRepo
}
}
sqlBatcher.execute(jdbcTemplate);
standardMenuAndRoleTable();
standardMenuAndApplicationTable();
}
}
@ -435,7 +435,7 @@ public class MenuServiceImpl extends DaoServiceImpl<MenuEntity, String, MenuRepo
}
}
sqlBatcher.execute(jdbcTemplate);
standardMenuAndRoleTable();
standardMenuAndApplicationTable();
}
}
@ -453,7 +453,7 @@ public class MenuServiceImpl extends DaoServiceImpl<MenuEntity, String, MenuRepo
}
}
sqlBatcher.execute(jdbcTemplate);
standardMenuAndRoleTable();
standardMenuAndApplicationTable();
}
@Override
@ -588,4 +588,40 @@ public class MenuServiceImpl extends DaoServiceImpl<MenuEntity, String, MenuRepo
insertSqlBatcher.execute(jdbcTemplate);
}
}
@Transactional
private void standardMenuAndApplicationTable(){
String sql ="delete from SYS_APPLICATION_MENU"
+ " where APPLICATION_ID_ in"
+ "("
+ " select TMP.APPLICATION_ID_ from (" //begin mysql 封装(避免出现: You can't specify target table 'FR_AA_ROLE_MENU' for update in FROM clause 错误)
+ " select distinct APPLICATION_ID_"
+ " from SYS_APPLICATION_MENU"
+ " where not exists"
+ " ("
+ " select 1 from SYS_APPLICATION_MENU A"
+ " left join SYS_MENU B"
+ " on A.MENU_ID_=B.ID_"
+ " where B.TYPE_<>'GROUP'"
+ " )"
+ " ) TMP"
+ ")";
jdbcTemplate.update(sql);
//删除重复的关系记录
sql =" select APPLICATION_ID_,MENU_ID_ from SYS_APPLICATION_MENU"
+ " group by APPLICATION_ID_,MENU_ID_"
+ " having count(*)>1";
List<Map<String,Object>> result =jdbcTemplate.queryForList(sql);
if(result!=null && result.size()>0){
SqlBatcher deleteSqlBatcher =new SqlBatcher("delete from SYS_APPLICATION_MENU where APPLICATION_ID_=? and MENU_ID_=?");
SqlBatcher insertSqlBatcher =new SqlBatcher("insert into SYS_APPLICATION_MENU(APPLICATION_ID_,MENU_ID_) values(?,?)");
for(Map<String,Object> row : result){
deleteSqlBatcher.addArg(new Object[]{row.get("APPLICATION_ID_"),row.get("MENU_ID_")});
insertSqlBatcher.addArg(new Object[]{row.get("APPLICATION_ID_"),row.get("MENU_ID_")});
}
deleteSqlBatcher.execute(jdbcTemplate);
insertSqlBatcher.execute(jdbcTemplate);
}
}
}

21
io.sc.platform.system/src/main/java/io/sc/platform/system/monitor/controller/MetricsWebController.java

@ -0,0 +1,21 @@
package io.sc.platform.system.monitor.controller;
import io.sc.platform.monitor.service.SystemMonitor;
import io.sc.platform.monitor.service.impl.SystemMonitorImpl;
import io.sc.platform.monitor.service.support.ServerInfo;
import io.sc.platform.mvc.autoconfigure.support.OnlineUserCounterInterceptor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
@RequestMapping("/api/monitor")
public class MetricsWebController {
@GetMapping("metrics")
public ServerInfo metrics() throws Exception {
SystemMonitor monitor =new SystemMonitorImpl();
ServerInfo serverInfo =monitor.getServerInfo();
serverInfo.setOnlineUserCount(OnlineUserCounterInterceptor.count());
return serverInfo;
}
}

1
io.sc.platform.system/src/main/resources/META-INF/platform/plugins/components.json

@ -40,6 +40,7 @@
"io.sc.platform.system.menu.service.impl",
"io.sc.platform.system.monitor.controller",
"io.sc.platform.system.monitor.service.impl",
"io.sc.platform.system.notification.controller",
"io.sc.platform.system.notification.service.impl",

Loading…
Cancel
Save