Index: ssts-web/src/main/webapp/systemmanage/system/activityView.js =================================================================== diff -u -r23611 -r23630 --- ssts-web/src/main/webapp/systemmanage/system/activityView.js (.../activityView.js) (revision 23611) +++ ssts-web/src/main/webapp/systemmanage/system/activityView.js (.../activityView.js) (revision 23630) @@ -101,7 +101,9 @@ } }], listeners: { - render : function() {} + render : function() { + refreshList(false,true); + } } }] }); Index: ssts-web/src/main/webapp/systemmanage/system/systemInfo.js =================================================================== diff -u --- ssts-web/src/main/webapp/systemmanage/system/systemInfo.js (revision 0) +++ ssts-web/src/main/webapp/systemmanage/system/systemInfo.js (revision 23630) @@ -0,0 +1,107 @@ + + +Ext.onReady(function() { + Ext.QuickTips.init(); + Ext.apply(Ext.QuickTips.getQuickTip(), { + showDelay : 0, + trackMouse : true, + hideDelay : true, + closable : false, + autoHide : false, + draggable : true, + dismissDelay : 0 + }); + var rowHeight = 40; + var form = new Ext.FormPanel({ + title : '系统信息', + labelAlign : 'right', + buttonAlign : 'center', + split : true, + border : 0, + frame : true, + bodyStyle : 'padding:0px auto;margin:0px', + width : 800, + height : 600, + layout : 'column', + items : [{ + columnWidth : .25, + layout : 'form', + labelWidth : 80, + labelAlign:"right", + items:[{ + xtype : 'textfield', + fieldLabel : "最大内存", + id : "maxMemory", + name : "maxMemory", + readOnly : true, + cls:'fieldReadOnlyNoRemove', + anchor : '100%' + }] + },{ + columnWidth : .25, + layout : 'form', + labelWidth : 80, + labelAlign:"right", + items:[{ + xtype : 'textfield', + fieldLabel : "已分配", + id : "allocatedMemory", + name : "allocatedMemory", + readOnly : true, + cls:'fieldReadOnlyNoRemove', + anchor : '100%' + }] + },{ + columnWidth : .25, + layout : 'form', + labelWidth : 80, + labelAlign:"right", + items:[{ + xtype : 'textfield', + fieldLabel : "可用", + id : "freeMemory", + name : "freeMemory", + readOnly : true, + cls:'fieldReadOnlyNoRemove', + anchor : '100%' + }] + },{ + columnWidth : .25, + layout : 'form', + labelWidth : 80, + labelAlign:"right", + items:[{ + xtype : 'textfield', + fieldLabel : "总可用", + id : "totalFreeMemory", + name : "totalFreeMemory", + readOnly : true, + cls:'fieldReadOnlyNoRemove', + anchor : '100%' + }] + }] + }); + + var viewport = new Ext.Viewport({ + width : 800, + height : 600, + // layout : 'fit', + items : [ { + margins : '0 0 0 0', + layout : 'fit', + items : [form] + } ] + }); + + + form.form.load({ + url : WWWROOT + '/system/system/getSysInfo.mhtml', + method : 'GET', + waitMsg : '正在加载数据,请稍候', +// params : {id : id}, + success : function(form, action) { + + } + }); + +}); \ No newline at end of file Index: forgon-core/src/main/java/com/forgon/system/system/controller/SystemController.java =================================================================== diff -u --- forgon-core/src/main/java/com/forgon/system/system/controller/SystemController.java (revision 0) +++ forgon-core/src/main/java/com/forgon/system/system/controller/SystemController.java (revision 23630) @@ -0,0 +1,37 @@ +/** + * + */ +package com.forgon.system.system.controller; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import net.sf.json.JSONObject; + +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.RequestMapping; + +import com.forgon.system.system.model.SystemInfo; +import com.forgon.tools.json.JSONUtil; +import com.forgon.tools.util.ResponseUtils; + +/** + * @author dandan 2018年6月20日 下午5:51:49 + * + */ +@Controller +@RequestMapping("/system/system") +public class SystemController { + @RequestMapping(value = "/getSysInfo") + public void getSysInfo(HttpServletRequest request, + HttpServletResponse response) { + + JSONObject json = new JSONObject(); + SystemInfo systemInfo = new SystemInfo(); + systemInfo.refreshRuntimeInfo(); + JSONUtil.addSuccess(json, true); + JSONUtil.addProperty(json, "data", systemInfo); + ResponseUtils.doOutput(json, response); + } + +} Index: forgon-core/src/main/java/com/forgon/system/system/model/SystemInfo.java =================================================================== diff -u --- forgon-core/src/main/java/com/forgon/system/system/model/SystemInfo.java (revision 0) +++ forgon-core/src/main/java/com/forgon/system/system/model/SystemInfo.java (revision 23630) @@ -0,0 +1,82 @@ +/** + * + */ +package com.forgon.system.system.model; + +import java.math.BigDecimal; +import java.math.RoundingMode; + +/** + * @author dandan 2018年6月20日 下午5:54:14 + * + */ +public class SystemInfo { + + private long maxMemory; + private long allocatedMemory; + private long freeMemory; + + public void refreshRuntimeInfo() { + Runtime runtime = Runtime.getRuntime(); + + maxMemory = runtime.maxMemory(); + allocatedMemory = runtime.totalMemory(); + freeMemory = runtime.freeMemory(); + + } + + public String getMaxMemory() { + if (maxMemory == Long.MAX_VALUE) { + return "无限制"; + } + return formatSize(maxMemory); + } + + public String getAllocatedMemory() { + return formatSize(allocatedMemory); + } + + public String getFreeMemory() { + return formatSize(freeMemory); + } + + public String getTotalFreeMemory() { + if (maxMemory == Long.MAX_VALUE) { + return "无限制"; + } + return formatSize(freeMemory + (maxMemory - allocatedMemory)); + } + + public static String divStr(long a, long b) { + BigDecimal ret = null; + if (b != 0) { + ret = new BigDecimal(a).divide(new BigDecimal(b), 4, + RoundingMode.HALF_UP); + } + if (ret == null) { + return "0"; + } + return ret.toString(); + } + + private String formatSize(long size) { + long T = 1024l * 1024 * 1024 * 1024; + long G = 1024 * 1024 * 1024; + long M = 1024 * 1024; + long K = 1024; + String s; + if (size > T) { + s = divStr(size, T) + "T"; + } else if (size > G) { + s = divStr(size, G) + "G"; + } else if (size > M) { + s = divStr(size, M) + "M"; + } else if (size > K) { + s = divStr(size, K) + "K"; + } else { + s = size + "B"; + } + return s; + } + +} Index: ssts-web/src/main/webapp/systemmanage/system/systemInfo.jsp =================================================================== diff -u --- ssts-web/src/main/webapp/systemmanage/system/systemInfo.jsp (revision 0) +++ ssts-web/src/main/webapp/systemmanage/system/systemInfo.jsp (revision 23630) @@ -0,0 +1,39 @@ +<%@page import="com.forgon.tools.date.DateTools"%> +<%@page import="com.forgon.disinfectsystem.basedatamanager.supplyroomconfig.service.SupplyRoomConfigManager"%> +<%@page import="com.forgon.disinfectsystem.entity.basedatamanager.supplyroomconfig.SupplyRoomConfig"%> +<%@page import="com.forgon.disinfectsystem.entity.systemwarning.SystemWarningItemVO"%> +<%@ page contentType="text/html; charset=UTF-8"%> +<%@ page import="com.forgon.tools.SpringBeanManger,com.forgon.directory.vo.LoginUserData,com.forgon.portal.action.PortalPageAction"%> +<%@ page import="java.util.Date"%> +<%@ include file="/common/taglibs.jsp"%> +
+ + +