修改
This commit is contained in:
@@ -0,0 +1,15 @@
|
||||
package com.jeesite.modules.biz.dao;
|
||||
|
||||
import com.jeesite.common.dao.CrudDao;
|
||||
import com.jeesite.common.mybatis.annotation.MyBatisDao;
|
||||
import com.jeesite.modules.biz.entity.BizDeviceInfo;
|
||||
|
||||
/**
|
||||
* 磁盘信息DAO接口
|
||||
* @author gaoxq
|
||||
* @version 2025-11-30
|
||||
*/
|
||||
@MyBatisDao(dataSourceName="work")
|
||||
public interface BizDeviceInfoDao extends CrudDao<BizDeviceInfo> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
package com.jeesite.modules.biz.dao;
|
||||
|
||||
import com.jeesite.common.dao.CrudDao;
|
||||
import com.jeesite.common.mybatis.annotation.MyBatisDao;
|
||||
import com.jeesite.modules.biz.entity.BizMonitorAccount;
|
||||
|
||||
/**
|
||||
* 账号信息DAO接口
|
||||
* @author gaoxq
|
||||
* @version 2025-11-30
|
||||
*/
|
||||
@MyBatisDao(dataSourceName="work")
|
||||
public interface BizMonitorAccountDao extends CrudDao<BizMonitorAccount> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
package com.jeesite.modules.biz.dao;
|
||||
|
||||
import com.jeesite.common.dao.CrudDao;
|
||||
import com.jeesite.common.mybatis.annotation.MyBatisDao;
|
||||
import com.jeesite.modules.biz.entity.BizMonitorHost;
|
||||
|
||||
/**
|
||||
* 主机信息DAO接口
|
||||
* @author gaoxq
|
||||
* @version 2025-11-30
|
||||
*/
|
||||
@MyBatisDao(dataSourceName="work")
|
||||
public interface BizMonitorHostDao extends CrudDao<BizMonitorHost> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
package com.jeesite.modules.biz.dao;
|
||||
|
||||
import com.jeesite.common.dao.CrudDao;
|
||||
import com.jeesite.common.mybatis.annotation.MyBatisDao;
|
||||
import com.jeesite.modules.biz.entity.BizServerInfo;
|
||||
|
||||
/**
|
||||
* 运行信息DAO接口
|
||||
* @author gaoxq
|
||||
* @version 2025-11-30
|
||||
*/
|
||||
@MyBatisDao(dataSourceName="work")
|
||||
public interface BizServerInfoDao extends CrudDao<BizServerInfo> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,107 @@
|
||||
package com.jeesite.modules.biz.entity;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
import com.jeesite.common.mybatis.annotation.JoinTable;
|
||||
import com.jeesite.common.mybatis.annotation.JoinTable.Type;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.Size;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
|
||||
import com.jeesite.common.entity.DataEntity;
|
||||
import com.jeesite.common.mybatis.annotation.Column;
|
||||
import com.jeesite.common.mybatis.annotation.Table;
|
||||
import com.jeesite.common.mybatis.mapper.query.QueryType;
|
||||
import com.jeesite.common.utils.excel.annotation.ExcelField;
|
||||
import com.jeesite.common.utils.excel.annotation.ExcelField.Align;
|
||||
import com.jeesite.common.utils.excel.annotation.ExcelFields;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.io.Serial;
|
||||
|
||||
/**
|
||||
* 磁盘信息Entity
|
||||
*
|
||||
* @author gaoxq
|
||||
* @version 2025-11-30
|
||||
*/
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Table(name = "biz_device_info", alias = "a", label = "磁盘信息信息", columns = {
|
||||
@Column(name = "create_time", attrName = "createTime", label = "记录时间", isUpdateForce = true),
|
||||
@Column(name = "id", attrName = "id", label = "主键标识", isPK = true),
|
||||
@Column(name = "device", attrName = "device", label = "设备名称", isQuery = false),
|
||||
@Column(name = "mount_point", attrName = "mountPoint", label = "挂载点", isQuery = false),
|
||||
@Column(name = "total_size", attrName = "totalSize", label = "总容量", isQuery = false),
|
||||
@Column(name = "used_size", attrName = "usedSize", label = "已使用容量", isQuery = false),
|
||||
@Column(name = "usage_rate", attrName = "usageRate", label = "使用率", comment = "使用率(%)", isQuery = false),
|
||||
@Column(name = "last_online_time", attrName = "lastOnlineTime", label = "最后一次检测时间", isQuery = false),
|
||||
@Column(name = "host_id", attrName = "hostId", label = "主机标识"),
|
||||
}, joinTable = {
|
||||
@JoinTable(type = Type.LEFT_JOIN, entity = BizMonitorHost.class, attrName = "this", alias = "b",
|
||||
on = "a.host_id = b.host_id",
|
||||
columns = {
|
||||
@Column(name = "hostname", attrName = "hostname", label = "主机名称"),
|
||||
@Column(name = "ip_address", attrName = "ipAddress", label = "IP地址"),
|
||||
@Column(name = "ustatus", attrName = "ustatus", label = "主机状态"),
|
||||
}),
|
||||
}, orderBy = "a.create_time DESC"
|
||||
)
|
||||
@Data
|
||||
public class BizDeviceInfo extends DataEntity<BizDeviceInfo> implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
private Date createTime; // 记录时间
|
||||
private String device; // 设备名称
|
||||
private String mountPoint; // 挂载点
|
||||
private String totalSize; // 总容量
|
||||
private String usedSize; // 已使用容量
|
||||
private Double usageRate; // 使用率(%)
|
||||
private Date lastOnlineTime; // 最后一次检测时间
|
||||
private String hostId; // 主机标识
|
||||
|
||||
private String hostname;
|
||||
private String ipAddress;
|
||||
private String ustatus;
|
||||
|
||||
|
||||
@ExcelFields({
|
||||
@ExcelField(title = "记录时间", attrName = "createTime", align = Align.CENTER, sort = 10, dataFormat = "yyyy-MM-dd hh:mm"),
|
||||
@ExcelField(title = "主键标识", attrName = "id", align = Align.CENTER, sort = 20),
|
||||
@ExcelField(title = "设备名称", attrName = "device", align = Align.CENTER, sort = 30),
|
||||
@ExcelField(title = "挂载点", attrName = "mountPoint", align = Align.CENTER, sort = 40),
|
||||
@ExcelField(title = "总容量", attrName = "totalSize", align = Align.CENTER, sort = 50),
|
||||
@ExcelField(title = "已使用容量", attrName = "usedSize", align = Align.CENTER, sort = 60),
|
||||
@ExcelField(title = "使用率", attrName = "usageRate", align = Align.CENTER, sort = 70),
|
||||
@ExcelField(title = "最后一次检测时间", attrName = "lastOnlineTime", align = Align.CENTER, sort = 80, dataFormat = "yyyy-MM-dd hh:mm"),
|
||||
@ExcelField(title = "主机名称", attrName = "hostname", align = Align.CENTER, sort = 90),
|
||||
@ExcelField(title = "主机IP", attrName = "ipAddress", align = Align.CENTER, sort = 90),
|
||||
})
|
||||
public BizDeviceInfo() {
|
||||
this(null);
|
||||
}
|
||||
|
||||
public BizDeviceInfo(String id) {
|
||||
super(id);
|
||||
}
|
||||
|
||||
public Date getCreateTime_gte() {
|
||||
return sqlMap.getWhere().getValue("create_time", QueryType.GTE);
|
||||
}
|
||||
|
||||
public void setCreateTime_gte(Date createTime) {
|
||||
sqlMap.getWhere().and("create_time", QueryType.GTE, createTime);
|
||||
}
|
||||
|
||||
public Date getCreateTime_lte() {
|
||||
return sqlMap.getWhere().getValue("create_time", QueryType.LTE);
|
||||
}
|
||||
|
||||
public void setCreateTime_lte(Date createTime) {
|
||||
sqlMap.getWhere().and("create_time", QueryType.LTE, createTime);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,116 @@
|
||||
package com.jeesite.modules.biz.entity;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
import com.jeesite.common.mybatis.annotation.JoinTable;
|
||||
import com.jeesite.common.mybatis.annotation.JoinTable.Type;
|
||||
|
||||
import com.jeesite.common.entity.DataEntity;
|
||||
import com.jeesite.common.mybatis.annotation.Column;
|
||||
import com.jeesite.common.mybatis.annotation.Table;
|
||||
import com.jeesite.common.mybatis.mapper.query.QueryType;
|
||||
import com.jeesite.common.utils.excel.annotation.ExcelField;
|
||||
import com.jeesite.common.utils.excel.annotation.ExcelField.Align;
|
||||
import com.jeesite.common.utils.excel.annotation.ExcelFields;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.io.Serial;
|
||||
|
||||
/**
|
||||
* 账号信息Entity
|
||||
*
|
||||
* @author gaoxq
|
||||
* @version 2025-11-30
|
||||
*/
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Table(name = "biz_monitor_account", alias = "a", label = "账号信息信息", columns = {
|
||||
@Column(name = "create_time", attrName = "createTime", label = "记录时间", isUpdate = false, isUpdateForce = true),
|
||||
@Column(name = "account_id", attrName = "accountId", label = "唯一标识", isPK = true),
|
||||
@Column(name = "host_id", attrName = "hostId", label = "主机标识"),
|
||||
@Column(name = "ssh_username", attrName = "sshUsername", label = "登录账号"),
|
||||
@Column(name = "ssh_password", attrName = "sshPassword", label = "登录密码", isQuery = false),
|
||||
@Column(name = "ssh_port", attrName = "sshPort", label = "登录端口", isQuery = false),
|
||||
@Column(name = "initial_path", attrName = "initialPath", label = "初始目录", queryType = QueryType.LIKE),
|
||||
@Column(name = "timeout_seconds", attrName = "timeoutSeconds", label = "超时时间", isQuery = false),
|
||||
@Column(name = "ustatus", attrName = "ustatus", label = "账号状态"),
|
||||
@Column(name = "remark", attrName = "remark", label = "备注信息", queryType = QueryType.LIKE),
|
||||
@Column(name = "update_time", attrName = "updateTime", label = "更新时间", isQuery = false, isUpdateForce = true),
|
||||
@Column(name = "f_tenant_id", attrName = "ftenantId", label = "租户id", isUpdate = false, isQuery = false),
|
||||
@Column(name = "f_flow_id", attrName = "fflowId", label = "流程id", isUpdate = false, isQuery = false),
|
||||
@Column(name = "f_flow_task_id", attrName = "fflowTaskId", label = "流程任务主键", isUpdate = false, isQuery = false),
|
||||
@Column(name = "f_flow_state", attrName = "fflowState", label = "流程任务状态", isUpdate = false, isQuery = false, isUpdateForce = true),
|
||||
}, joinTable = {
|
||||
@JoinTable(type = Type.LEFT_JOIN, entity = BizMonitorHost.class, attrName = "this", alias = "b",
|
||||
on = "a.host_id = b.host_id",
|
||||
columns = {
|
||||
@Column(name = "hostname", attrName = "hostname", label = "主机名称"),
|
||||
@Column(name = "ip_address", attrName = "ipAddress", label = "IP地址"),
|
||||
}),
|
||||
}, orderBy = "a.create_time DESC"
|
||||
)
|
||||
@Data
|
||||
public class BizMonitorAccount extends DataEntity<BizMonitorAccount> implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
private Date createTime; // 记录时间
|
||||
private String accountId; // 唯一标识
|
||||
private String hostId; // 主机标识
|
||||
private String sshUsername; // 登录账号
|
||||
private String sshPassword; // 登录密码
|
||||
private Integer sshPort; // 登录端口
|
||||
private String initialPath; // 初始目录
|
||||
private Integer timeoutSeconds; // 超时时间
|
||||
private String ustatus; // 账号状态
|
||||
private String remark; // 备注信息
|
||||
private Date updateTime; // 更新时间
|
||||
private String ftenantId; // 租户id
|
||||
private String fflowId; // 流程id
|
||||
private String fflowTaskId; // 流程任务主键
|
||||
private Integer fflowState; // 流程任务状态
|
||||
|
||||
private String hostname;
|
||||
private String ipAddress;
|
||||
|
||||
|
||||
@ExcelFields({
|
||||
@ExcelField(title = "记录时间", attrName = "createTime", align = Align.CENTER, sort = 10, dataFormat = "yyyy-MM-dd hh:mm"),
|
||||
@ExcelField(title = "唯一标识", attrName = "accountId", align = Align.CENTER, sort = 20),
|
||||
@ExcelField(title = "主机IP", attrName = "ipAddress", align = Align.CENTER, sort = 30),
|
||||
@ExcelField(title = "主机名称", attrName = "hostname", align = Align.CENTER, sort = 30),
|
||||
@ExcelField(title = "登录账号", attrName = "sshUsername", align = Align.CENTER, sort = 40),
|
||||
@ExcelField(title = "登录密码", attrName = "sshPassword", align = Align.CENTER, sort = 50),
|
||||
@ExcelField(title = "登录端口", attrName = "sshPort", align = Align.CENTER, sort = 60),
|
||||
@ExcelField(title = "初始目录", attrName = "initialPath", align = Align.CENTER, sort = 70),
|
||||
@ExcelField(title = "超时时间", attrName = "timeoutSeconds", align = Align.CENTER, sort = 80),
|
||||
@ExcelField(title = "账号状态", attrName = "ustatus", align = Align.CENTER, sort = 90),
|
||||
@ExcelField(title = "备注信息", attrName = "remark", align = Align.CENTER, sort = 100),
|
||||
@ExcelField(title = "更新时间", attrName = "updateTime", align = Align.CENTER, sort = 110, dataFormat = "yyyy-MM-dd hh:mm"),
|
||||
})
|
||||
public BizMonitorAccount() {
|
||||
this(null);
|
||||
}
|
||||
|
||||
public BizMonitorAccount(String id) {
|
||||
super(id);
|
||||
}
|
||||
|
||||
public Date getCreateTime_gte() {
|
||||
return sqlMap.getWhere().getValue("create_time", QueryType.GTE);
|
||||
}
|
||||
|
||||
public void setCreateTime_gte(Date createTime) {
|
||||
sqlMap.getWhere().and("create_time", QueryType.GTE, createTime);
|
||||
}
|
||||
|
||||
public Date getCreateTime_lte() {
|
||||
return sqlMap.getWhere().getValue("create_time", QueryType.LTE);
|
||||
}
|
||||
|
||||
public void setCreateTime_lte(Date createTime) {
|
||||
sqlMap.getWhere().and("create_time", QueryType.LTE, createTime);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,130 @@
|
||||
package com.jeesite.modules.biz.entity;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
import com.jeesite.common.mybatis.annotation.JoinTable;
|
||||
import com.jeesite.common.mybatis.annotation.JoinTable.Type;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.Size;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
|
||||
import com.jeesite.common.entity.DataEntity;
|
||||
import com.jeesite.common.mybatis.annotation.Column;
|
||||
import com.jeesite.common.mybatis.annotation.Table;
|
||||
import com.jeesite.common.mybatis.mapper.query.QueryType;
|
||||
import com.jeesite.common.utils.excel.annotation.ExcelField;
|
||||
import com.jeesite.common.utils.excel.annotation.ExcelField.Align;
|
||||
import com.jeesite.common.utils.excel.annotation.ExcelFields;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.io.Serial;
|
||||
|
||||
/**
|
||||
* 主机信息Entity
|
||||
*
|
||||
* @author gaoxq
|
||||
* @version 2025-11-30
|
||||
*/
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Table(name = "biz_monitor_host", alias = "a", label = "主机信息信息", columns = {
|
||||
@Column(name = "create_time", attrName = "createTime", label = "记录时间", isUpdate = false, isUpdateForce = true),
|
||||
@Column(name = "host_id", attrName = "hostId", label = "唯一标识", isPK = true),
|
||||
@Column(name = "hostname", attrName = "hostname", label = "主机名称", queryType = QueryType.LIKE),
|
||||
@Column(name = "ip_address", attrName = "ipAddress", label = "IP地址"),
|
||||
@Column(name = "host_type", attrName = "hostType", label = "主机类型"),
|
||||
@Column(name = "host_os", attrName = "hostOs", label = "操作系统"),
|
||||
@Column(name = "ustatus", attrName = "ustatus", label = "主机状态"),
|
||||
@Column(name = "last_online_time", attrName = "lastOnlineTime", label = "监测运行时间"),
|
||||
@Column(name = "location_name", attrName = "locationName", label = "物理位置", queryType = QueryType.LIKE),
|
||||
@Column(name = "location_type", attrName = "locationType", label = "地址类型"),
|
||||
@Column(name = "admin_user", attrName = "adminUser", label = "管理人员"),
|
||||
@Column(name = "other_contact", attrName = "otherContact", label = "联系方式", isQuery = false),
|
||||
@Column(name = "remark", attrName = "remark", label = "备注信息", queryType = QueryType.LIKE),
|
||||
@Column(name = "update_time", attrName = "updateTime", label = "更新时间", isQuery = false, isUpdateForce = true),
|
||||
@Column(name = "expiry_date", attrName = "expiryDate", label = "失效日期", isQuery = false),
|
||||
@Column(name = "f_tenant_id", attrName = "ftenantId", label = "租户id", isUpdate = false, isQuery = false),
|
||||
@Column(name = "f_flow_id", attrName = "fflowId", label = "流程id", isUpdate = false, isQuery = false),
|
||||
@Column(name = "f_flow_task_id", attrName = "fflowTaskId", label = "流程任务主键", isUpdate = false, isQuery = false),
|
||||
@Column(name = "f_flow_state", attrName = "fflowState", label = "流程任务状态", isUpdate = false, isQuery = false, isUpdateForce = true),
|
||||
}, joinTable = {
|
||||
@JoinTable(type = Type.LEFT_JOIN, entity = BizResumeEmployee.class, attrName = "this", alias = "b",
|
||||
on = "a.admin_user = b.employee_id",
|
||||
columns = {
|
||||
@Column(name = "employee_name", attrName = "employeeName", label = "员工姓名"),
|
||||
@Column(name = "employee_code", attrName = "employeeCode", label = "员工编号"),
|
||||
}),
|
||||
}, orderBy = "a.create_time DESC"
|
||||
)
|
||||
@Data
|
||||
public class BizMonitorHost extends DataEntity<BizMonitorHost> implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
private Date createTime; // 记录时间
|
||||
private String hostId; // 唯一标识
|
||||
private String hostname; // 主机名称
|
||||
private String ipAddress; // IP地址
|
||||
private String hostType; // 主机类型
|
||||
private String hostOs; // 操作系统
|
||||
private String ustatus; // 主机状态
|
||||
private Date lastOnlineTime; // 监测运行时间
|
||||
private String locationName; // 物理位置
|
||||
private String locationType; // 地址类型
|
||||
private String adminUser; // 管理人员
|
||||
private String otherContact; // 联系方式
|
||||
private String remark; // 备注信息
|
||||
private Date updateTime; // 更新时间
|
||||
private Date expiryDate; // 失效日期
|
||||
private String ftenantId; // 租户id
|
||||
private String fflowId; // 流程id
|
||||
private String fflowTaskId; // 流程任务主键
|
||||
private Integer fflowState; // 流程任务状态
|
||||
|
||||
private String employeeName;
|
||||
private String employeeCode;
|
||||
|
||||
@ExcelFields({
|
||||
@ExcelField(title = "记录时间", attrName = "createTime", align = Align.CENTER, sort = 10, dataFormat = "yyyy-MM-dd hh:mm"),
|
||||
@ExcelField(title = "唯一标识", attrName = "hostId", align = Align.CENTER, sort = 20),
|
||||
@ExcelField(title = "主机名称", attrName = "hostname", align = Align.CENTER, sort = 30),
|
||||
@ExcelField(title = "IP地址", attrName = "ipAddress", align = Align.CENTER, sort = 40),
|
||||
@ExcelField(title = "主机类型", attrName = "hostType", dictType = "host_type", align = Align.CENTER, sort = 50),
|
||||
@ExcelField(title = "操作系统", attrName = "hostOs", dictType = "host_os", align = Align.CENTER, sort = 60),
|
||||
@ExcelField(title = "主机状态", attrName = "ustatus", dictType = "host_status", align = Align.CENTER, sort = 70),
|
||||
@ExcelField(title = "监测运行时间", attrName = "lastOnlineTime", align = Align.CENTER, sort = 80, dataFormat = "yyyy-MM-dd hh:mm"),
|
||||
@ExcelField(title = "物理位置", attrName = "locationName", align = Align.CENTER, sort = 90),
|
||||
@ExcelField(title = "地址类型", attrName = "locationType", dictType = "location_type", align = Align.CENTER, sort = 100),
|
||||
@ExcelField(title = "管理人员", attrName = "employeeName", align = Align.CENTER, sort = 110),
|
||||
@ExcelField(title = "联系方式", attrName = "otherContact", align = Align.CENTER, sort = 120),
|
||||
@ExcelField(title = "备注信息", attrName = "remark", align = Align.CENTER, sort = 130),
|
||||
@ExcelField(title = "更新时间", attrName = "updateTime", align = Align.CENTER, sort = 140, dataFormat = "yyyy-MM-dd hh:mm"),
|
||||
@ExcelField(title = "失效日期", attrName = "expiryDate", align = Align.CENTER, sort = 150, dataFormat = "yyyy-MM-dd hh:mm"),
|
||||
})
|
||||
public BizMonitorHost() {
|
||||
this(null);
|
||||
}
|
||||
|
||||
public BizMonitorHost(String id) {
|
||||
super(id);
|
||||
}
|
||||
|
||||
public Date getCreateTime_gte() {
|
||||
return sqlMap.getWhere().getValue("create_time", QueryType.GTE);
|
||||
}
|
||||
|
||||
public void setCreateTime_gte(Date createTime) {
|
||||
sqlMap.getWhere().and("create_time", QueryType.GTE, createTime);
|
||||
}
|
||||
|
||||
public Date getCreateTime_lte() {
|
||||
return sqlMap.getWhere().getValue("create_time", QueryType.LTE);
|
||||
}
|
||||
|
||||
public void setCreateTime_lte(Date createTime) {
|
||||
sqlMap.getWhere().and("create_time", QueryType.LTE, createTime);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,115 @@
|
||||
package com.jeesite.modules.biz.entity;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
import com.jeesite.common.mybatis.annotation.JoinTable;
|
||||
import com.jeesite.common.mybatis.annotation.JoinTable.Type;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.Size;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
|
||||
import com.jeesite.common.entity.DataEntity;
|
||||
import com.jeesite.common.mybatis.annotation.Column;
|
||||
import com.jeesite.common.mybatis.annotation.Table;
|
||||
import com.jeesite.common.mybatis.mapper.query.QueryType;
|
||||
import com.jeesite.common.utils.excel.annotation.ExcelField;
|
||||
import com.jeesite.common.utils.excel.annotation.ExcelField.Align;
|
||||
import com.jeesite.common.utils.excel.annotation.ExcelFields;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.io.Serial;
|
||||
|
||||
/**
|
||||
* 运行信息Entity
|
||||
*
|
||||
* @author gaoxq
|
||||
* @version 2025-11-30
|
||||
*/
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Table(name = "biz_server_info", alias = "a", label = "运行信息信息", columns = {
|
||||
@Column(name = "create_time", attrName = "createTime", label = "记录时间", isUpdate = false, isUpdateForce = true),
|
||||
@Column(name = "id", attrName = "id", label = "唯一标识", isPK = true),
|
||||
@Column(name = "uptime", attrName = "uptime", label = "主机运行时间", isQuery = false),
|
||||
@Column(name = "os", attrName = "os", label = "操作系统", isQuery = false),
|
||||
@Column(name = "kernel_version", attrName = "kernelVersion", label = "内核版本", queryType = QueryType.LIKE),
|
||||
@Column(name = "hostname", attrName = "hostname", label = "主机名称", queryType = QueryType.LIKE),
|
||||
@Column(name = "ip_address", attrName = "ipAddress", label = "主机地址", queryType = QueryType.LIKE),
|
||||
@Column(name = "cpu_model", attrName = "cpuModel", label = "CPU型号", queryType = QueryType.LIKE),
|
||||
@Column(name = "memory_total", attrName = "memoryTotal", label = "内存总量", isQuery = false),
|
||||
@Column(name = "cpu_usage", attrName = "cpuUsage", label = "CPU使用率", comment = "CPU使用率(%)", isQuery = false),
|
||||
@Column(name = "memory_usage", attrName = "memoryUsage", label = "内存使用率", comment = "内存使用率(%)", isQuery = false),
|
||||
@Column(name = "last_online_time", attrName = "lastOnlineTime", label = "最后一次检测时间", isQuery = false),
|
||||
@Column(name = "host_id", attrName = "hostId", label = "主机标识"),
|
||||
}, joinTable = {
|
||||
@JoinTable(type = Type.LEFT_JOIN, entity = BizMonitorHost.class, attrName = "this", alias = "b",
|
||||
on = "a.host_id = b.host_id",
|
||||
columns = {
|
||||
@Column(name = "hostname", attrName = "sysHostname", label = "主机名称"),
|
||||
@Column(name = "ustatus", attrName = "ustatus", label = "主机状态"),
|
||||
}),
|
||||
}, orderBy = "a.create_time DESC"
|
||||
)
|
||||
@Data
|
||||
public class BizServerInfo extends DataEntity<BizServerInfo> implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
private Date createTime; // 记录时间
|
||||
private String uptime; // 主机运行时间
|
||||
private String os; // 操作系统
|
||||
private String kernelVersion; // 内核版本
|
||||
private String hostname; // 主机名称
|
||||
private String ipAddress; // 主机地址
|
||||
private String cpuModel; // CPU型号
|
||||
private String memoryTotal; // 内存总量
|
||||
private Double cpuUsage; // CPU使用率(%)
|
||||
private Double memoryUsage; // 内存使用率(%)
|
||||
private Date lastOnlineTime; // 最后一次检测时间
|
||||
private String hostId; // 主机标识
|
||||
|
||||
private String sysHostname;
|
||||
private String ustatus;
|
||||
|
||||
@ExcelFields({
|
||||
@ExcelField(title = "记录时间", attrName = "createTime", align = Align.CENTER, sort = 10, dataFormat = "yyyy-MM-dd hh:mm"),
|
||||
@ExcelField(title = "唯一标识", attrName = "id", align = Align.CENTER, sort = 20),
|
||||
@ExcelField(title = "主机运行时间", attrName = "uptime", align = Align.CENTER, sort = 30),
|
||||
@ExcelField(title = "操作系统", attrName = "os", align = Align.CENTER, sort = 40),
|
||||
@ExcelField(title = "内核版本", attrName = "kernelVersion", align = Align.CENTER, sort = 50),
|
||||
@ExcelField(title = "系统名称", attrName = "hostname", align = Align.CENTER, sort = 60),
|
||||
@ExcelField(title = "主机地址", attrName = "ipAddress", align = Align.CENTER, sort = 70),
|
||||
@ExcelField(title = "CPU型号", attrName = "cpuModel", align = Align.CENTER, sort = 80),
|
||||
@ExcelField(title = "内存总量", attrName = "memoryTotal", align = Align.CENTER, sort = 90),
|
||||
@ExcelField(title = "CPU使用率", attrName = "cpuUsage", align = Align.CENTER, sort = 100),
|
||||
@ExcelField(title = "内存使用率", attrName = "memoryUsage", align = Align.CENTER, sort = 110),
|
||||
@ExcelField(title = "最后一次检测时间", attrName = "lastOnlineTime", align = Align.CENTER, sort = 120, dataFormat = "yyyy-MM-dd hh:mm"),
|
||||
@ExcelField(title = "主机名称", attrName = "sysHostname", align = Align.CENTER, sort = 130),
|
||||
})
|
||||
public BizServerInfo() {
|
||||
this(null);
|
||||
}
|
||||
|
||||
public BizServerInfo(String id) {
|
||||
super(id);
|
||||
}
|
||||
|
||||
public Date getCreateTime_gte() {
|
||||
return sqlMap.getWhere().getValue("create_time", QueryType.GTE);
|
||||
}
|
||||
|
||||
public void setCreateTime_gte(Date createTime) {
|
||||
sqlMap.getWhere().and("create_time", QueryType.GTE, createTime);
|
||||
}
|
||||
|
||||
public Date getCreateTime_lte() {
|
||||
return sqlMap.getWhere().getValue("create_time", QueryType.LTE);
|
||||
}
|
||||
|
||||
public void setCreateTime_lte(Date createTime) {
|
||||
sqlMap.getWhere().and("create_time", QueryType.LTE, createTime);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,134 @@
|
||||
package com.jeesite.modules.biz.service;
|
||||
|
||||
import java.util.List;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import com.jeesite.common.entity.Page;
|
||||
import com.jeesite.common.service.CrudService;
|
||||
import com.jeesite.modules.biz.entity.BizDeviceInfo;
|
||||
import com.jeesite.modules.biz.dao.BizDeviceInfoDao;
|
||||
import com.jeesite.common.service.ServiceException;
|
||||
import com.jeesite.common.config.Global;
|
||||
import com.jeesite.common.validator.ValidatorUtils;
|
||||
import com.jeesite.common.utils.excel.ExcelImport;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
import jakarta.validation.ConstraintViolation;
|
||||
import jakarta.validation.ConstraintViolationException;
|
||||
|
||||
/**
|
||||
* 磁盘信息Service
|
||||
* @author gaoxq
|
||||
* @version 2025-11-30
|
||||
*/
|
||||
@Service
|
||||
public class BizDeviceInfoService extends CrudService<BizDeviceInfoDao, BizDeviceInfo> {
|
||||
|
||||
/**
|
||||
* 获取单条数据
|
||||
* @param bizDeviceInfo 主键
|
||||
*/
|
||||
@Override
|
||||
public BizDeviceInfo get(BizDeviceInfo bizDeviceInfo) {
|
||||
return super.get(bizDeviceInfo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询分页数据
|
||||
* @param bizDeviceInfo 查询条件
|
||||
* @param bizDeviceInfo page 分页对象
|
||||
*/
|
||||
@Override
|
||||
public Page<BizDeviceInfo> findPage(BizDeviceInfo bizDeviceInfo) {
|
||||
return super.findPage(bizDeviceInfo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询列表数据
|
||||
* @param bizDeviceInfo 查询条件
|
||||
*/
|
||||
@Override
|
||||
public List<BizDeviceInfo> findList(BizDeviceInfo bizDeviceInfo) {
|
||||
return super.findList(bizDeviceInfo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存数据(插入或更新)
|
||||
* @param bizDeviceInfo 数据对象
|
||||
*/
|
||||
@Override
|
||||
@Transactional
|
||||
public void save(BizDeviceInfo bizDeviceInfo) {
|
||||
super.save(bizDeviceInfo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导入数据
|
||||
* @param file 导入的数据文件
|
||||
*/
|
||||
@Transactional
|
||||
public String importData(MultipartFile file) {
|
||||
if (file == null){
|
||||
throw new ServiceException(text("请选择导入的数据文件!"));
|
||||
}
|
||||
int successNum = 0; int failureNum = 0;
|
||||
StringBuilder successMsg = new StringBuilder();
|
||||
StringBuilder failureMsg = new StringBuilder();
|
||||
try(ExcelImport ei = new ExcelImport(file, 2, 0)){
|
||||
List<BizDeviceInfo> list = ei.getDataList(BizDeviceInfo.class);
|
||||
for (BizDeviceInfo bizDeviceInfo : list) {
|
||||
try{
|
||||
ValidatorUtils.validateWithException(bizDeviceInfo);
|
||||
this.save(bizDeviceInfo);
|
||||
successNum++;
|
||||
successMsg.append("<br/>" + successNum + "、编号 " + bizDeviceInfo.getId() + " 导入成功");
|
||||
} catch (Exception e) {
|
||||
failureNum++;
|
||||
String msg = "<br/>" + failureNum + "、编号 " + bizDeviceInfo.getId() + " 导入失败:";
|
||||
if (e instanceof ConstraintViolationException){
|
||||
ConstraintViolationException cve = (ConstraintViolationException)e;
|
||||
for (ConstraintViolation<?> violation : cve.getConstraintViolations()) {
|
||||
msg += Global.getText(violation.getMessage()) + " ("+violation.getPropertyPath()+")";
|
||||
}
|
||||
}else{
|
||||
msg += e.getMessage();
|
||||
}
|
||||
failureMsg.append(msg);
|
||||
logger.error(msg, e);
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
logger.error(e.getMessage(), e);
|
||||
failureMsg.append(e.getMessage());
|
||||
return failureMsg.toString();
|
||||
}
|
||||
if (failureNum > 0) {
|
||||
failureMsg.insert(0, "很抱歉,导入失败!共 " + failureNum + " 条数据格式不正确,错误如下:");
|
||||
throw new ServiceException(failureMsg.toString());
|
||||
}else{
|
||||
successMsg.insert(0, "恭喜您,数据已全部导入成功!共 " + successNum + " 条,数据如下:");
|
||||
}
|
||||
return successMsg.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新状态
|
||||
* @param bizDeviceInfo 数据对象
|
||||
*/
|
||||
@Override
|
||||
@Transactional
|
||||
public void updateStatus(BizDeviceInfo bizDeviceInfo) {
|
||||
super.updateStatus(bizDeviceInfo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除数据
|
||||
* @param bizDeviceInfo 数据对象
|
||||
*/
|
||||
@Override
|
||||
@Transactional
|
||||
public void delete(BizDeviceInfo bizDeviceInfo) {
|
||||
super.delete(bizDeviceInfo);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,134 @@
|
||||
package com.jeesite.modules.biz.service;
|
||||
|
||||
import java.util.List;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import com.jeesite.common.entity.Page;
|
||||
import com.jeesite.common.service.CrudService;
|
||||
import com.jeesite.modules.biz.entity.BizMonitorAccount;
|
||||
import com.jeesite.modules.biz.dao.BizMonitorAccountDao;
|
||||
import com.jeesite.common.service.ServiceException;
|
||||
import com.jeesite.common.config.Global;
|
||||
import com.jeesite.common.validator.ValidatorUtils;
|
||||
import com.jeesite.common.utils.excel.ExcelImport;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
import jakarta.validation.ConstraintViolation;
|
||||
import jakarta.validation.ConstraintViolationException;
|
||||
|
||||
/**
|
||||
* 账号信息Service
|
||||
* @author gaoxq
|
||||
* @version 2025-11-30
|
||||
*/
|
||||
@Service
|
||||
public class BizMonitorAccountService extends CrudService<BizMonitorAccountDao, BizMonitorAccount> {
|
||||
|
||||
/**
|
||||
* 获取单条数据
|
||||
* @param bizMonitorAccount 主键
|
||||
*/
|
||||
@Override
|
||||
public BizMonitorAccount get(BizMonitorAccount bizMonitorAccount) {
|
||||
return super.get(bizMonitorAccount);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询分页数据
|
||||
* @param bizMonitorAccount 查询条件
|
||||
* @param bizMonitorAccount page 分页对象
|
||||
*/
|
||||
@Override
|
||||
public Page<BizMonitorAccount> findPage(BizMonitorAccount bizMonitorAccount) {
|
||||
return super.findPage(bizMonitorAccount);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询列表数据
|
||||
* @param bizMonitorAccount 查询条件
|
||||
*/
|
||||
@Override
|
||||
public List<BizMonitorAccount> findList(BizMonitorAccount bizMonitorAccount) {
|
||||
return super.findList(bizMonitorAccount);
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存数据(插入或更新)
|
||||
* @param bizMonitorAccount 数据对象
|
||||
*/
|
||||
@Override
|
||||
@Transactional
|
||||
public void save(BizMonitorAccount bizMonitorAccount) {
|
||||
super.save(bizMonitorAccount);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导入数据
|
||||
* @param file 导入的数据文件
|
||||
*/
|
||||
@Transactional
|
||||
public String importData(MultipartFile file) {
|
||||
if (file == null){
|
||||
throw new ServiceException(text("请选择导入的数据文件!"));
|
||||
}
|
||||
int successNum = 0; int failureNum = 0;
|
||||
StringBuilder successMsg = new StringBuilder();
|
||||
StringBuilder failureMsg = new StringBuilder();
|
||||
try(ExcelImport ei = new ExcelImport(file, 2, 0)){
|
||||
List<BizMonitorAccount> list = ei.getDataList(BizMonitorAccount.class);
|
||||
for (BizMonitorAccount bizMonitorAccount : list) {
|
||||
try{
|
||||
ValidatorUtils.validateWithException(bizMonitorAccount);
|
||||
this.save(bizMonitorAccount);
|
||||
successNum++;
|
||||
successMsg.append("<br/>" + successNum + "、编号 " + bizMonitorAccount.getId() + " 导入成功");
|
||||
} catch (Exception e) {
|
||||
failureNum++;
|
||||
String msg = "<br/>" + failureNum + "、编号 " + bizMonitorAccount.getId() + " 导入失败:";
|
||||
if (e instanceof ConstraintViolationException){
|
||||
ConstraintViolationException cve = (ConstraintViolationException)e;
|
||||
for (ConstraintViolation<?> violation : cve.getConstraintViolations()) {
|
||||
msg += Global.getText(violation.getMessage()) + " ("+violation.getPropertyPath()+")";
|
||||
}
|
||||
}else{
|
||||
msg += e.getMessage();
|
||||
}
|
||||
failureMsg.append(msg);
|
||||
logger.error(msg, e);
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
logger.error(e.getMessage(), e);
|
||||
failureMsg.append(e.getMessage());
|
||||
return failureMsg.toString();
|
||||
}
|
||||
if (failureNum > 0) {
|
||||
failureMsg.insert(0, "很抱歉,导入失败!共 " + failureNum + " 条数据格式不正确,错误如下:");
|
||||
throw new ServiceException(failureMsg.toString());
|
||||
}else{
|
||||
successMsg.insert(0, "恭喜您,数据已全部导入成功!共 " + successNum + " 条,数据如下:");
|
||||
}
|
||||
return successMsg.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新状态
|
||||
* @param bizMonitorAccount 数据对象
|
||||
*/
|
||||
@Override
|
||||
@Transactional
|
||||
public void updateStatus(BizMonitorAccount bizMonitorAccount) {
|
||||
super.updateStatus(bizMonitorAccount);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除数据
|
||||
* @param bizMonitorAccount 数据对象
|
||||
*/
|
||||
@Override
|
||||
@Transactional
|
||||
public void delete(BizMonitorAccount bizMonitorAccount) {
|
||||
super.delete(bizMonitorAccount);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,134 @@
|
||||
package com.jeesite.modules.biz.service;
|
||||
|
||||
import java.util.List;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import com.jeesite.common.entity.Page;
|
||||
import com.jeesite.common.service.CrudService;
|
||||
import com.jeesite.modules.biz.entity.BizMonitorHost;
|
||||
import com.jeesite.modules.biz.dao.BizMonitorHostDao;
|
||||
import com.jeesite.common.service.ServiceException;
|
||||
import com.jeesite.common.config.Global;
|
||||
import com.jeesite.common.validator.ValidatorUtils;
|
||||
import com.jeesite.common.utils.excel.ExcelImport;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
import jakarta.validation.ConstraintViolation;
|
||||
import jakarta.validation.ConstraintViolationException;
|
||||
|
||||
/**
|
||||
* 主机信息Service
|
||||
* @author gaoxq
|
||||
* @version 2025-11-30
|
||||
*/
|
||||
@Service
|
||||
public class BizMonitorHostService extends CrudService<BizMonitorHostDao, BizMonitorHost> {
|
||||
|
||||
/**
|
||||
* 获取单条数据
|
||||
* @param bizMonitorHost 主键
|
||||
*/
|
||||
@Override
|
||||
public BizMonitorHost get(BizMonitorHost bizMonitorHost) {
|
||||
return super.get(bizMonitorHost);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询分页数据
|
||||
* @param bizMonitorHost 查询条件
|
||||
* @param bizMonitorHost page 分页对象
|
||||
*/
|
||||
@Override
|
||||
public Page<BizMonitorHost> findPage(BizMonitorHost bizMonitorHost) {
|
||||
return super.findPage(bizMonitorHost);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询列表数据
|
||||
* @param bizMonitorHost 查询条件
|
||||
*/
|
||||
@Override
|
||||
public List<BizMonitorHost> findList(BizMonitorHost bizMonitorHost) {
|
||||
return super.findList(bizMonitorHost);
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存数据(插入或更新)
|
||||
* @param bizMonitorHost 数据对象
|
||||
*/
|
||||
@Override
|
||||
@Transactional
|
||||
public void save(BizMonitorHost bizMonitorHost) {
|
||||
super.save(bizMonitorHost);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导入数据
|
||||
* @param file 导入的数据文件
|
||||
*/
|
||||
@Transactional
|
||||
public String importData(MultipartFile file) {
|
||||
if (file == null){
|
||||
throw new ServiceException(text("请选择导入的数据文件!"));
|
||||
}
|
||||
int successNum = 0; int failureNum = 0;
|
||||
StringBuilder successMsg = new StringBuilder();
|
||||
StringBuilder failureMsg = new StringBuilder();
|
||||
try(ExcelImport ei = new ExcelImport(file, 2, 0)){
|
||||
List<BizMonitorHost> list = ei.getDataList(BizMonitorHost.class);
|
||||
for (BizMonitorHost bizMonitorHost : list) {
|
||||
try{
|
||||
ValidatorUtils.validateWithException(bizMonitorHost);
|
||||
this.save(bizMonitorHost);
|
||||
successNum++;
|
||||
successMsg.append("<br/>" + successNum + "、编号 " + bizMonitorHost.getId() + " 导入成功");
|
||||
} catch (Exception e) {
|
||||
failureNum++;
|
||||
String msg = "<br/>" + failureNum + "、编号 " + bizMonitorHost.getId() + " 导入失败:";
|
||||
if (e instanceof ConstraintViolationException){
|
||||
ConstraintViolationException cve = (ConstraintViolationException)e;
|
||||
for (ConstraintViolation<?> violation : cve.getConstraintViolations()) {
|
||||
msg += Global.getText(violation.getMessage()) + " ("+violation.getPropertyPath()+")";
|
||||
}
|
||||
}else{
|
||||
msg += e.getMessage();
|
||||
}
|
||||
failureMsg.append(msg);
|
||||
logger.error(msg, e);
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
logger.error(e.getMessage(), e);
|
||||
failureMsg.append(e.getMessage());
|
||||
return failureMsg.toString();
|
||||
}
|
||||
if (failureNum > 0) {
|
||||
failureMsg.insert(0, "很抱歉,导入失败!共 " + failureNum + " 条数据格式不正确,错误如下:");
|
||||
throw new ServiceException(failureMsg.toString());
|
||||
}else{
|
||||
successMsg.insert(0, "恭喜您,数据已全部导入成功!共 " + successNum + " 条,数据如下:");
|
||||
}
|
||||
return successMsg.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新状态
|
||||
* @param bizMonitorHost 数据对象
|
||||
*/
|
||||
@Override
|
||||
@Transactional
|
||||
public void updateStatus(BizMonitorHost bizMonitorHost) {
|
||||
super.updateStatus(bizMonitorHost);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除数据
|
||||
* @param bizMonitorHost 数据对象
|
||||
*/
|
||||
@Override
|
||||
@Transactional
|
||||
public void delete(BizMonitorHost bizMonitorHost) {
|
||||
super.delete(bizMonitorHost);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,134 @@
|
||||
package com.jeesite.modules.biz.service;
|
||||
|
||||
import java.util.List;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import com.jeesite.common.entity.Page;
|
||||
import com.jeesite.common.service.CrudService;
|
||||
import com.jeesite.modules.biz.entity.BizServerInfo;
|
||||
import com.jeesite.modules.biz.dao.BizServerInfoDao;
|
||||
import com.jeesite.common.service.ServiceException;
|
||||
import com.jeesite.common.config.Global;
|
||||
import com.jeesite.common.validator.ValidatorUtils;
|
||||
import com.jeesite.common.utils.excel.ExcelImport;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
import jakarta.validation.ConstraintViolation;
|
||||
import jakarta.validation.ConstraintViolationException;
|
||||
|
||||
/**
|
||||
* 运行信息Service
|
||||
* @author gaoxq
|
||||
* @version 2025-11-30
|
||||
*/
|
||||
@Service
|
||||
public class BizServerInfoService extends CrudService<BizServerInfoDao, BizServerInfo> {
|
||||
|
||||
/**
|
||||
* 获取单条数据
|
||||
* @param bizServerInfo 主键
|
||||
*/
|
||||
@Override
|
||||
public BizServerInfo get(BizServerInfo bizServerInfo) {
|
||||
return super.get(bizServerInfo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询分页数据
|
||||
* @param bizServerInfo 查询条件
|
||||
* @param bizServerInfo page 分页对象
|
||||
*/
|
||||
@Override
|
||||
public Page<BizServerInfo> findPage(BizServerInfo bizServerInfo) {
|
||||
return super.findPage(bizServerInfo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询列表数据
|
||||
* @param bizServerInfo 查询条件
|
||||
*/
|
||||
@Override
|
||||
public List<BizServerInfo> findList(BizServerInfo bizServerInfo) {
|
||||
return super.findList(bizServerInfo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存数据(插入或更新)
|
||||
* @param bizServerInfo 数据对象
|
||||
*/
|
||||
@Override
|
||||
@Transactional
|
||||
public void save(BizServerInfo bizServerInfo) {
|
||||
super.save(bizServerInfo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导入数据
|
||||
* @param file 导入的数据文件
|
||||
*/
|
||||
@Transactional
|
||||
public String importData(MultipartFile file) {
|
||||
if (file == null){
|
||||
throw new ServiceException(text("请选择导入的数据文件!"));
|
||||
}
|
||||
int successNum = 0; int failureNum = 0;
|
||||
StringBuilder successMsg = new StringBuilder();
|
||||
StringBuilder failureMsg = new StringBuilder();
|
||||
try(ExcelImport ei = new ExcelImport(file, 2, 0)){
|
||||
List<BizServerInfo> list = ei.getDataList(BizServerInfo.class);
|
||||
for (BizServerInfo bizServerInfo : list) {
|
||||
try{
|
||||
ValidatorUtils.validateWithException(bizServerInfo);
|
||||
this.save(bizServerInfo);
|
||||
successNum++;
|
||||
successMsg.append("<br/>" + successNum + "、编号 " + bizServerInfo.getId() + " 导入成功");
|
||||
} catch (Exception e) {
|
||||
failureNum++;
|
||||
String msg = "<br/>" + failureNum + "、编号 " + bizServerInfo.getId() + " 导入失败:";
|
||||
if (e instanceof ConstraintViolationException){
|
||||
ConstraintViolationException cve = (ConstraintViolationException)e;
|
||||
for (ConstraintViolation<?> violation : cve.getConstraintViolations()) {
|
||||
msg += Global.getText(violation.getMessage()) + " ("+violation.getPropertyPath()+")";
|
||||
}
|
||||
}else{
|
||||
msg += e.getMessage();
|
||||
}
|
||||
failureMsg.append(msg);
|
||||
logger.error(msg, e);
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
logger.error(e.getMessage(), e);
|
||||
failureMsg.append(e.getMessage());
|
||||
return failureMsg.toString();
|
||||
}
|
||||
if (failureNum > 0) {
|
||||
failureMsg.insert(0, "很抱歉,导入失败!共 " + failureNum + " 条数据格式不正确,错误如下:");
|
||||
throw new ServiceException(failureMsg.toString());
|
||||
}else{
|
||||
successMsg.insert(0, "恭喜您,数据已全部导入成功!共 " + successNum + " 条,数据如下:");
|
||||
}
|
||||
return successMsg.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新状态
|
||||
* @param bizServerInfo 数据对象
|
||||
*/
|
||||
@Override
|
||||
@Transactional
|
||||
public void updateStatus(BizServerInfo bizServerInfo) {
|
||||
super.updateStatus(bizServerInfo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除数据
|
||||
* @param bizServerInfo 数据对象
|
||||
*/
|
||||
@Override
|
||||
@Transactional
|
||||
public void delete(BizServerInfo bizServerInfo) {
|
||||
super.delete(bizServerInfo);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,146 @@
|
||||
package com.jeesite.modules.biz.web;
|
||||
|
||||
import java.util.List;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.Model;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.ModelAttribute;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
|
||||
import com.jeesite.common.config.Global;
|
||||
import com.jeesite.common.collect.ListUtils;
|
||||
import com.jeesite.common.entity.Page;
|
||||
import com.jeesite.common.lang.DateUtils;
|
||||
import com.jeesite.common.utils.excel.ExcelExport;
|
||||
import com.jeesite.common.utils.excel.annotation.ExcelField.Type;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
import com.jeesite.common.web.BaseController;
|
||||
import com.jeesite.modules.biz.entity.BizDeviceInfo;
|
||||
import com.jeesite.modules.biz.service.BizDeviceInfoService;
|
||||
|
||||
/**
|
||||
* 磁盘信息Controller
|
||||
* @author gaoxq
|
||||
* @version 2025-11-30
|
||||
*/
|
||||
@Controller
|
||||
@RequestMapping(value = "${adminPath}/biz/deviceInfo")
|
||||
public class BizDeviceInfoController extends BaseController {
|
||||
|
||||
private final BizDeviceInfoService bizDeviceInfoService;
|
||||
|
||||
public BizDeviceInfoController(BizDeviceInfoService bizDeviceInfoService) {
|
||||
this.bizDeviceInfoService = bizDeviceInfoService;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取数据
|
||||
*/
|
||||
@ModelAttribute
|
||||
public BizDeviceInfo get(String id, boolean isNewRecord) {
|
||||
return bizDeviceInfoService.get(id, isNewRecord);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询列表
|
||||
*/
|
||||
@RequiresPermissions("biz:deviceInfo:view")
|
||||
@RequestMapping(value = {"list", ""})
|
||||
public String list(BizDeviceInfo bizDeviceInfo, Model model) {
|
||||
model.addAttribute("bizDeviceInfo", bizDeviceInfo);
|
||||
return "modules/biz/bizDeviceInfoList";
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询列表数据
|
||||
*/
|
||||
@RequiresPermissions("biz:deviceInfo:view")
|
||||
@RequestMapping(value = "listData")
|
||||
@ResponseBody
|
||||
public Page<BizDeviceInfo> listData(BizDeviceInfo bizDeviceInfo, HttpServletRequest request, HttpServletResponse response) {
|
||||
bizDeviceInfo.setPage(new Page<>(request, response));
|
||||
Page<BizDeviceInfo> page = bizDeviceInfoService.findPage(bizDeviceInfo);
|
||||
return page;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查看编辑表单
|
||||
*/
|
||||
@RequiresPermissions("biz:deviceInfo:view")
|
||||
@RequestMapping(value = "form")
|
||||
public String form(BizDeviceInfo bizDeviceInfo, Model model) {
|
||||
model.addAttribute("bizDeviceInfo", bizDeviceInfo);
|
||||
return "modules/biz/bizDeviceInfoForm";
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存数据
|
||||
*/
|
||||
@RequiresPermissions("biz:deviceInfo:edit")
|
||||
@PostMapping(value = "save")
|
||||
@ResponseBody
|
||||
public String save(@Validated BizDeviceInfo bizDeviceInfo) {
|
||||
bizDeviceInfoService.save(bizDeviceInfo);
|
||||
return renderResult(Global.TRUE, text("保存磁盘信息成功!"));
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出数据
|
||||
*/
|
||||
@RequiresPermissions("biz:deviceInfo:view")
|
||||
@RequestMapping(value = "exportData")
|
||||
public void exportData(BizDeviceInfo bizDeviceInfo, HttpServletResponse response) {
|
||||
List<BizDeviceInfo> list = bizDeviceInfoService.findList(bizDeviceInfo);
|
||||
String fileName = "磁盘信息" + DateUtils.getDate("yyyyMMddHHmmss") + ".xlsx";
|
||||
try(ExcelExport ee = new ExcelExport("磁盘信息", BizDeviceInfo.class)){
|
||||
ee.setDataList(list).write(response, fileName);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 下载模板
|
||||
*/
|
||||
@RequiresPermissions("biz:deviceInfo:view")
|
||||
@RequestMapping(value = "importTemplate")
|
||||
public void importTemplate(HttpServletResponse response) {
|
||||
BizDeviceInfo bizDeviceInfo = new BizDeviceInfo();
|
||||
List<BizDeviceInfo> list = ListUtils.newArrayList(bizDeviceInfo);
|
||||
String fileName = "磁盘信息模板.xlsx";
|
||||
try(ExcelExport ee = new ExcelExport("磁盘信息", BizDeviceInfo.class, Type.IMPORT)){
|
||||
ee.setDataList(list).write(response, fileName);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 导入数据
|
||||
*/
|
||||
@ResponseBody
|
||||
@RequiresPermissions("biz:deviceInfo:edit")
|
||||
@PostMapping(value = "importData")
|
||||
public String importData(MultipartFile file) {
|
||||
try {
|
||||
String message = bizDeviceInfoService.importData(file);
|
||||
return renderResult(Global.TRUE, "posfull:"+message);
|
||||
} catch (Exception ex) {
|
||||
return renderResult(Global.FALSE, "posfull:"+ex.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除数据
|
||||
*/
|
||||
@RequiresPermissions("biz:deviceInfo:edit")
|
||||
@RequestMapping(value = "delete")
|
||||
@ResponseBody
|
||||
public String delete(BizDeviceInfo bizDeviceInfo) {
|
||||
bizDeviceInfoService.delete(bizDeviceInfo);
|
||||
return renderResult(Global.TRUE, text("删除磁盘信息成功!"));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,20 +1,18 @@
|
||||
package com.jeesite.modules.biz.web;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import com.jeesite.modules.dao.TabItem;
|
||||
import com.jeesite.modules.dict.NotifyType;
|
||||
import com.jeesite.modules.app.dao.TabItem;
|
||||
import com.jeesite.modules.app.dict.NotifyType;
|
||||
import com.jeesite.modules.sys.entity.User;
|
||||
import com.jeesite.modules.sys.utils.UserUtils;
|
||||
import com.jeesite.modules.utils.IpUtils;
|
||||
import com.jeesite.modules.app.utils.IpUtils;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.apache.poi.ss.formula.atp.Switch;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.Model;
|
||||
|
||||
@@ -0,0 +1,159 @@
|
||||
package com.jeesite.modules.biz.web;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import com.jeesite.modules.app.utils.vo;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.Model;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.ModelAttribute;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
|
||||
import com.jeesite.common.config.Global;
|
||||
import com.jeesite.common.collect.ListUtils;
|
||||
import com.jeesite.common.entity.Page;
|
||||
import com.jeesite.common.lang.DateUtils;
|
||||
import com.jeesite.common.utils.excel.ExcelExport;
|
||||
import com.jeesite.common.utils.excel.annotation.ExcelField.Type;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
import com.jeesite.common.web.BaseController;
|
||||
import com.jeesite.modules.biz.entity.BizMonitorAccount;
|
||||
import com.jeesite.modules.biz.service.BizMonitorAccountService;
|
||||
|
||||
/**
|
||||
* 账号信息Controller
|
||||
*
|
||||
* @author gaoxq
|
||||
* @version 2025-11-30
|
||||
*/
|
||||
@Controller
|
||||
@RequestMapping(value = "${adminPath}/biz/monitorAccount")
|
||||
public class BizMonitorAccountController extends BaseController {
|
||||
|
||||
private final BizMonitorAccountService bizMonitorAccountService;
|
||||
|
||||
public BizMonitorAccountController(BizMonitorAccountService bizMonitorAccountService) {
|
||||
this.bizMonitorAccountService = bizMonitorAccountService;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取数据
|
||||
*/
|
||||
@ModelAttribute
|
||||
public BizMonitorAccount get(String accountId, boolean isNewRecord) {
|
||||
return bizMonitorAccountService.get(accountId, isNewRecord);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询列表
|
||||
*/
|
||||
@RequiresPermissions("biz:monitorAccount:view")
|
||||
@RequestMapping(value = {"list", ""})
|
||||
public String list(BizMonitorAccount bizMonitorAccount, Model model) {
|
||||
model.addAttribute("bizMonitorAccount", bizMonitorAccount);
|
||||
return "modules/biz/bizMonitorAccountList";
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询列表数据
|
||||
*/
|
||||
@RequiresPermissions("biz:monitorAccount:view")
|
||||
@RequestMapping(value = "listData")
|
||||
@ResponseBody
|
||||
public Page<BizMonitorAccount> listData(BizMonitorAccount bizMonitorAccount, HttpServletRequest request, HttpServletResponse response) {
|
||||
bizMonitorAccount.setPage(new Page<>(request, response));
|
||||
Page<BizMonitorAccount> page = bizMonitorAccountService.findPage(bizMonitorAccount);
|
||||
return page;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查看编辑表单
|
||||
*/
|
||||
@RequiresPermissions("biz:monitorAccount:view")
|
||||
@RequestMapping(value = "form")
|
||||
public String form(BizMonitorAccount bizMonitorAccount, Model model) {
|
||||
model.addAttribute("bizMonitorAccount", bizMonitorAccount);
|
||||
return "modules/biz/bizMonitorAccountForm";
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存数据
|
||||
*/
|
||||
@RequiresPermissions("biz:monitorAccount:edit")
|
||||
@PostMapping(value = "save")
|
||||
@ResponseBody
|
||||
public String save(@Validated BizMonitorAccount bizMonitorAccount) {
|
||||
if (bizMonitorAccount.getIsNewRecord()) {
|
||||
bizMonitorAccount.setSshPassword(vo.getEncode(bizMonitorAccount.getSshPassword()));
|
||||
} else {
|
||||
bizMonitorAccount.setUpdateTime(new Date());
|
||||
BizMonitorAccount account = bizMonitorAccountService.get(bizMonitorAccount.getAccountId());
|
||||
if (!account.getSshPassword().equals(bizMonitorAccount.getSshPassword())) {
|
||||
bizMonitorAccount.setSshPassword(vo.getEncode(bizMonitorAccount.getSshPassword()));
|
||||
}
|
||||
}
|
||||
bizMonitorAccountService.save(bizMonitorAccount);
|
||||
return renderResult(Global.TRUE, text("保存账号信息成功!"));
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出数据
|
||||
*/
|
||||
@RequiresPermissions("biz:monitorAccount:view")
|
||||
@RequestMapping(value = "exportData")
|
||||
public void exportData(BizMonitorAccount bizMonitorAccount, HttpServletResponse response) {
|
||||
List<BizMonitorAccount> list = bizMonitorAccountService.findList(bizMonitorAccount);
|
||||
String fileName = "账号信息" + DateUtils.getDate("yyyyMMddHHmmss") + ".xlsx";
|
||||
try (ExcelExport ee = new ExcelExport("账号信息", BizMonitorAccount.class)) {
|
||||
ee.setDataList(list).write(response, fileName);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 下载模板
|
||||
*/
|
||||
@RequiresPermissions("biz:monitorAccount:view")
|
||||
@RequestMapping(value = "importTemplate")
|
||||
public void importTemplate(HttpServletResponse response) {
|
||||
BizMonitorAccount bizMonitorAccount = new BizMonitorAccount();
|
||||
List<BizMonitorAccount> list = ListUtils.newArrayList(bizMonitorAccount);
|
||||
String fileName = "账号信息模板.xlsx";
|
||||
try (ExcelExport ee = new ExcelExport("账号信息", BizMonitorAccount.class, Type.IMPORT)) {
|
||||
ee.setDataList(list).write(response, fileName);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 导入数据
|
||||
*/
|
||||
@ResponseBody
|
||||
@RequiresPermissions("biz:monitorAccount:edit")
|
||||
@PostMapping(value = "importData")
|
||||
public String importData(MultipartFile file) {
|
||||
try {
|
||||
String message = bizMonitorAccountService.importData(file);
|
||||
return renderResult(Global.TRUE, "posfull:" + message);
|
||||
} catch (Exception ex) {
|
||||
return renderResult(Global.FALSE, "posfull:" + ex.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除数据
|
||||
*/
|
||||
@RequiresPermissions("biz:monitorAccount:edit")
|
||||
@RequestMapping(value = "delete")
|
||||
@ResponseBody
|
||||
public String delete(BizMonitorAccount bizMonitorAccount) {
|
||||
bizMonitorAccountService.delete(bizMonitorAccount);
|
||||
return renderResult(Global.TRUE, text("删除账号信息成功!"));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,150 @@
|
||||
package com.jeesite.modules.biz.web;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.jeesite.modules.app.utils.vo;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.Model;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.ModelAttribute;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
|
||||
import com.jeesite.common.config.Global;
|
||||
import com.jeesite.common.collect.ListUtils;
|
||||
import com.jeesite.common.entity.Page;
|
||||
import com.jeesite.common.lang.DateUtils;
|
||||
import com.jeesite.common.utils.excel.ExcelExport;
|
||||
import com.jeesite.common.utils.excel.annotation.ExcelField.Type;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
import com.jeesite.common.web.BaseController;
|
||||
import com.jeesite.modules.biz.entity.BizMonitorHost;
|
||||
import com.jeesite.modules.biz.service.BizMonitorHostService;
|
||||
|
||||
/**
|
||||
* 主机信息Controller
|
||||
*
|
||||
* @author gaoxq
|
||||
* @version 2025-11-30
|
||||
*/
|
||||
@Controller
|
||||
@RequestMapping(value = "${adminPath}/biz/monitorHost")
|
||||
public class BizMonitorHostController extends BaseController {
|
||||
|
||||
private final BizMonitorHostService bizMonitorHostService;
|
||||
|
||||
public BizMonitorHostController(BizMonitorHostService bizMonitorHostService) {
|
||||
this.bizMonitorHostService = bizMonitorHostService;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取数据
|
||||
*/
|
||||
@ModelAttribute
|
||||
public BizMonitorHost get(String hostId, boolean isNewRecord) {
|
||||
return bizMonitorHostService.get(hostId, isNewRecord);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询列表
|
||||
*/
|
||||
@RequiresPermissions("biz:monitorHost:view")
|
||||
@RequestMapping(value = {"list", ""})
|
||||
public String list(BizMonitorHost bizMonitorHost, Model model) {
|
||||
model.addAttribute("bizMonitorHost", bizMonitorHost);
|
||||
return "modules/biz/bizMonitorHostList";
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询列表数据
|
||||
*/
|
||||
@RequiresPermissions("biz:monitorHost:view")
|
||||
@RequestMapping(value = "listData")
|
||||
@ResponseBody
|
||||
public Page<BizMonitorHost> listData(BizMonitorHost bizMonitorHost, HttpServletRequest request, HttpServletResponse response) {
|
||||
bizMonitorHost.setPage(new Page<>(request, response));
|
||||
Page<BizMonitorHost> page = bizMonitorHostService.findPage(bizMonitorHost);
|
||||
return page;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查看编辑表单
|
||||
*/
|
||||
@RequiresPermissions("biz:monitorHost:view")
|
||||
@RequestMapping(value = "form")
|
||||
public String form(BizMonitorHost bizMonitorHost, Model model) {
|
||||
model.addAttribute("bizMonitorHost", bizMonitorHost);
|
||||
return "modules/biz/bizMonitorHostForm";
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存数据
|
||||
*/
|
||||
@RequiresPermissions("biz:monitorHost:edit")
|
||||
@PostMapping(value = "save")
|
||||
@ResponseBody
|
||||
public String save(@Validated BizMonitorHost bizMonitorHost) {
|
||||
bizMonitorHost.setUpdateTime(vo.getUpdateTime(bizMonitorHost.getIsNewRecord()));
|
||||
bizMonitorHostService.save(bizMonitorHost);
|
||||
return renderResult(Global.TRUE, text("保存主机信息成功!"));
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出数据
|
||||
*/
|
||||
@RequiresPermissions("biz:monitorHost:view")
|
||||
@RequestMapping(value = "exportData")
|
||||
public void exportData(BizMonitorHost bizMonitorHost, HttpServletResponse response) {
|
||||
List<BizMonitorHost> list = bizMonitorHostService.findList(bizMonitorHost);
|
||||
String fileName = "主机信息" + DateUtils.getDate("yyyyMMddHHmmss") + ".xlsx";
|
||||
try (ExcelExport ee = new ExcelExport("主机信息", BizMonitorHost.class)) {
|
||||
ee.setDataList(list).write(response, fileName);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 下载模板
|
||||
*/
|
||||
@RequiresPermissions("biz:monitorHost:view")
|
||||
@RequestMapping(value = "importTemplate")
|
||||
public void importTemplate(HttpServletResponse response) {
|
||||
BizMonitorHost bizMonitorHost = new BizMonitorHost();
|
||||
List<BizMonitorHost> list = ListUtils.newArrayList(bizMonitorHost);
|
||||
String fileName = "主机信息模板.xlsx";
|
||||
try (ExcelExport ee = new ExcelExport("主机信息", BizMonitorHost.class, Type.IMPORT)) {
|
||||
ee.setDataList(list).write(response, fileName);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 导入数据
|
||||
*/
|
||||
@ResponseBody
|
||||
@RequiresPermissions("biz:monitorHost:edit")
|
||||
@PostMapping(value = "importData")
|
||||
public String importData(MultipartFile file) {
|
||||
try {
|
||||
String message = bizMonitorHostService.importData(file);
|
||||
return renderResult(Global.TRUE, "posfull:" + message);
|
||||
} catch (Exception ex) {
|
||||
return renderResult(Global.FALSE, "posfull:" + ex.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除数据
|
||||
*/
|
||||
@RequiresPermissions("biz:monitorHost:edit")
|
||||
@RequestMapping(value = "delete")
|
||||
@ResponseBody
|
||||
public String delete(BizMonitorHost bizMonitorHost) {
|
||||
bizMonitorHostService.delete(bizMonitorHost);
|
||||
return renderResult(Global.TRUE, text("删除主机信息成功!"));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,146 @@
|
||||
package com.jeesite.modules.biz.web;
|
||||
|
||||
import java.util.List;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.Model;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.ModelAttribute;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
|
||||
import com.jeesite.common.config.Global;
|
||||
import com.jeesite.common.collect.ListUtils;
|
||||
import com.jeesite.common.entity.Page;
|
||||
import com.jeesite.common.lang.DateUtils;
|
||||
import com.jeesite.common.utils.excel.ExcelExport;
|
||||
import com.jeesite.common.utils.excel.annotation.ExcelField.Type;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
import com.jeesite.common.web.BaseController;
|
||||
import com.jeesite.modules.biz.entity.BizServerInfo;
|
||||
import com.jeesite.modules.biz.service.BizServerInfoService;
|
||||
|
||||
/**
|
||||
* 运行信息Controller
|
||||
* @author gaoxq
|
||||
* @version 2025-11-30
|
||||
*/
|
||||
@Controller
|
||||
@RequestMapping(value = "${adminPath}/biz/serverInfo")
|
||||
public class BizServerInfoController extends BaseController {
|
||||
|
||||
private final BizServerInfoService bizServerInfoService;
|
||||
|
||||
public BizServerInfoController(BizServerInfoService bizServerInfoService) {
|
||||
this.bizServerInfoService = bizServerInfoService;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取数据
|
||||
*/
|
||||
@ModelAttribute
|
||||
public BizServerInfo get(String id, boolean isNewRecord) {
|
||||
return bizServerInfoService.get(id, isNewRecord);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询列表
|
||||
*/
|
||||
@RequiresPermissions("biz:serverInfo:view")
|
||||
@RequestMapping(value = {"list", ""})
|
||||
public String list(BizServerInfo bizServerInfo, Model model) {
|
||||
model.addAttribute("bizServerInfo", bizServerInfo);
|
||||
return "modules/biz/bizServerInfoList";
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询列表数据
|
||||
*/
|
||||
@RequiresPermissions("biz:serverInfo:view")
|
||||
@RequestMapping(value = "listData")
|
||||
@ResponseBody
|
||||
public Page<BizServerInfo> listData(BizServerInfo bizServerInfo, HttpServletRequest request, HttpServletResponse response) {
|
||||
bizServerInfo.setPage(new Page<>(request, response));
|
||||
Page<BizServerInfo> page = bizServerInfoService.findPage(bizServerInfo);
|
||||
return page;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查看编辑表单
|
||||
*/
|
||||
@RequiresPermissions("biz:serverInfo:view")
|
||||
@RequestMapping(value = "form")
|
||||
public String form(BizServerInfo bizServerInfo, Model model) {
|
||||
model.addAttribute("bizServerInfo", bizServerInfo);
|
||||
return "modules/biz/bizServerInfoForm";
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存数据
|
||||
*/
|
||||
@RequiresPermissions("biz:serverInfo:edit")
|
||||
@PostMapping(value = "save")
|
||||
@ResponseBody
|
||||
public String save(@Validated BizServerInfo bizServerInfo) {
|
||||
bizServerInfoService.save(bizServerInfo);
|
||||
return renderResult(Global.TRUE, text("保存运行信息成功!"));
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出数据
|
||||
*/
|
||||
@RequiresPermissions("biz:serverInfo:view")
|
||||
@RequestMapping(value = "exportData")
|
||||
public void exportData(BizServerInfo bizServerInfo, HttpServletResponse response) {
|
||||
List<BizServerInfo> list = bizServerInfoService.findList(bizServerInfo);
|
||||
String fileName = "运行信息" + DateUtils.getDate("yyyyMMddHHmmss") + ".xlsx";
|
||||
try(ExcelExport ee = new ExcelExport("运行信息", BizServerInfo.class)){
|
||||
ee.setDataList(list).write(response, fileName);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 下载模板
|
||||
*/
|
||||
@RequiresPermissions("biz:serverInfo:view")
|
||||
@RequestMapping(value = "importTemplate")
|
||||
public void importTemplate(HttpServletResponse response) {
|
||||
BizServerInfo bizServerInfo = new BizServerInfo();
|
||||
List<BizServerInfo> list = ListUtils.newArrayList(bizServerInfo);
|
||||
String fileName = "运行信息模板.xlsx";
|
||||
try(ExcelExport ee = new ExcelExport("运行信息", BizServerInfo.class, Type.IMPORT)){
|
||||
ee.setDataList(list).write(response, fileName);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 导入数据
|
||||
*/
|
||||
@ResponseBody
|
||||
@RequiresPermissions("biz:serverInfo:edit")
|
||||
@PostMapping(value = "importData")
|
||||
public String importData(MultipartFile file) {
|
||||
try {
|
||||
String message = bizServerInfoService.importData(file);
|
||||
return renderResult(Global.TRUE, "posfull:"+message);
|
||||
} catch (Exception ex) {
|
||||
return renderResult(Global.FALSE, "posfull:"+ex.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除数据
|
||||
*/
|
||||
@RequiresPermissions("biz:serverInfo:edit")
|
||||
@RequestMapping(value = "delete")
|
||||
@ResponseBody
|
||||
public String delete(BizServerInfo bizServerInfo) {
|
||||
bizServerInfoService.delete(bizServerInfo);
|
||||
return renderResult(Global.TRUE, text("删除运行信息成功!"));
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user