Commit 84e02b55 authored by 赵啸非's avatar 赵啸非

物联网1.0

parent 4f37832b
......@@ -129,9 +129,9 @@ PRIMARY KEY (`id`)
DROP TABLE IF EXISTS `mortals_xhx_device_module`;
CREATE TABLE mortals_xhx_device_module(
`id` bigint(20) AUTO_INCREMENT COMMENT '主键ID,主键,自增长',
`moduleId` bigint(20) NOT NULL COMMENT '模块名称',
`deviceId` bigint(20) NOT NULL COMMENT '所属设备',
`createTime` datetime NOT NULL COMMENT '创建时间',
`moduleName` varchar(256) NOT NULL COMMENT '模块名称',
`moduleMsgCode` varchar(256) NOT NULL COMMENT '模块消息编码,与上报消息头编码一致,唯一',
`createTime` datetime COMMENT '创建时间',
`updateUserId` bigint(20) COMMENT '更新用户',
`updateTime` datetime COMMENT '更新时间',
PRIMARY KEY (`id`)
......@@ -143,14 +143,18 @@ PRIMARY KEY (`id`)
DROP TABLE IF EXISTS `mortals_xhx_device_module_use`;
CREATE TABLE mortals_xhx_device_module_use(
`id` bigint(20) AUTO_INCREMENT COMMENT '主键ID,主键,自增长',
`moduleId` bigint(20) NOT NULL COMMENT '模块ID',
`moduleName` varchar(256) NOT NULL COMMENT '模块名称',
`moduleMsgCode` varchar(256) NOT NULL COMMENT '模块消息编码',
`deviceId` bigint(20) NOT NULL COMMENT '所属设备',
`useNum` int COMMENT '调用次数',
`createTime` datetime NOT NULL COMMENT '创建时间',
`createTime` datetime COMMENT '创建时间',
`updateUserId` bigint(20) COMMENT '更新用户',
`updateTime` datetime COMMENT '更新时间',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='设备模块使用频率';
-- ----------------------------
-- 设备告警配置表
-- ----------------------------
......@@ -193,9 +197,10 @@ CREATE TABLE mortals_xhx_device_log(
`id` bigint(20) AUTO_INCREMENT COMMENT '主键ID,主键,自增长',
`traceID` varchar(64) COMMENT 'traceId,日志追踪id',
`deviceId` bigint(20) COMMENT '设备ID',
`deviceNum` varchar(32) NOT NULL COMMENT '设备编号',
`deviceCode` varchar(32) NOT NULL COMMENT '设备编号',
`deviceName` varchar(32) NOT NULL COMMENT '设备名称,设置设备名称。',
`logType` tinyint(2) NOT NULL COMMENT '日志类型,(0.上报事件,1.下发服务)',
`messageHead` varchar(64) NOT NULL COMMENT '业务消息头标识',
`logType` tinyint(2) NOT NULL COMMENT '消息类型,(0.上行,1.下行)',
`content` varchar(2048) COMMENT '内容',
`createUserId` bigint(20) NOT NULL COMMENT '创建用户',
`createTime` datetime NOT NULL COMMENT '创建时间',
......@@ -204,6 +209,8 @@ CREATE TABLE mortals_xhx_device_log(
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='设备日志';
-- ----------------------------
-- 站点统计表
-- ----------------------------
......
......@@ -161,7 +161,7 @@
v-if="item.type === 'datetime'"
type="datetime"
value-format="yyyy-MM-dd HH:mm:ss"
placeholder="选择日期时间"
:placeholder="item.label"
>
</el-date-picker>
......
<template>
<div class="page">
<LayoutTable :data="tableData" notAdd :config="tableConfig"> </LayoutTable>
<LayoutTable :data="tableData" notAdd notDel :config="tableConfig"> </LayoutTable>
<dialog-show ref="dialogform" @ok="getData" />
</div>
......@@ -26,6 +26,7 @@ export default {
//this.config.addQuery = { deviceId, deviceType };
if (this.queryIn.alarmDevice) {
this.query={}
this.query["alarmDevice"] = this.queryIn.alarmDevice;
}
......@@ -60,21 +61,29 @@ export default {
return {
config: {
search: [
{
name: "alarmDevice",
type: "text",
label: "告警设备",
fuzzy: true,
},
{
name: "alarmStatus",
type: "select",
label: "告警状态,来自工单系统",
fuzzy: true,
label: "告警状态",
},
{
name: "alarmTimeStart",
type: "datetime",
label: "开始时间",
},
{
name: "alarmTimeEnd",
type: "datetime",
label: "结束时间",
placeholder:"结束时间"
},
],
columns: [
{ type: "selection", width: 60 },
{
label: "告警时间",
......@@ -87,33 +96,24 @@ export default {
prop: "alarmDevice",
formatter: this.formatterString,
},
{ label: "告警类型,", prop: "alarmType", formatter: this.formatter },
{
label: "告警内容",
prop: "alarmContent",
},
{ label: "告警级别", prop: "alarmLevel", formatter: this.formatter },
{ label: "接收人员,", prop: "alarmReceivePersonnel" },
{
label: "告警状态,来自工单系统",
label: "告警状态",
prop: "alarmStatus",
formatter: this.formatter,
},
{
label: "操作",
width: 240,
formatter: (row) => {
return (
<table-buttons
noAdd
noEdit
noDel
row={row}
onEdit={this.toEdit}
onView={this.toView}
onDel={this.toDel}
/>
);
},
},
],
},
};
......
......@@ -3,8 +3,8 @@
<el-dialog :title="title" :visible.sync="open" width="90%" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="120px">
<el-row>
<Field label="模块名称" prop="moduleId" v-model="form.moduleId" placeholder="请输入模块名称"/>
<Field label="所属设备" prop="deviceId" v-model="form.deviceId" placeholder="请输入所属设备"/>
<Field label="模块名称" prop="moduleName" v-model="form.moduleName" type="textarea" placeholder="请输入模块名称"/>
<Field label="模块消息编码,与上报消息头编码一致,唯一" prop="moduleMsgCode" v-model="form.moduleMsgCode" type="textarea" placeholder="请输入模块消息编码,与上报消息头编码一致,唯一"/>
</el-row>
......@@ -36,8 +36,13 @@
],
// 表单校验
rules: {
createTime: [
{required: true,message: "请选择创建时间" },
moduleName: [
{required: true,message: "请输入模块名称", trigger: "blur" },
{max: 256,message: "最多只能录入256个字符",trigger: "blur",},
],
moduleMsgCode: [
{required: true,message: "请输入模块消息编码,与上报消息头编码一致,唯一", trigger: "blur" },
{max: 256,message: "最多只能录入256个字符",trigger: "blur",},
],
}
};
......@@ -88,8 +93,8 @@
// 表单重置
reset() {
this.form = {
moduleId : null,
deviceId : null,
moduleName : "",
moduleMsgCode : "",
};
this.resetForm("form");
},
......
......@@ -13,31 +13,9 @@
import table from "@/assets/mixins/table";
export default {
name: "DeviceModule",
props: {
queryIn: {
type: Object,
default: null,
},
},
components: {dialogShow },
mixins: [table],
created() {
console.log("queryIn module:", this.queryIn);
//this.config.addQuery = { deviceId, deviceType };
if (this.queryIn.deviceId) {
this.query["deviceId"] = this.queryIn.deviceId;
}
this.pageInfo.list = "/device/module/list";
this.pageInfo.del = "/device/module/delete";
this.pageInfo.add = "/device/module/add";
this.pageInfo.edit = "/device/module/edit";
this.pageInfo.view = "/device/module/view";
console.log("pageInfo",this.pageInfo)
},
methods: {
......
......@@ -3,7 +3,9 @@
<el-dialog :title="title" :visible.sync="open" width="90%" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="120px">
<el-row>
<Field label="模块ID" prop="moduleId" v-model="form.moduleId" placeholder="请输入模块ID"/>
<Field label="模块名称" prop="moduleName" v-model="form.moduleName" type="textarea" placeholder="请输入模块名称"/>
<Field label="模块消息编码" prop="moduleMsgCode" v-model="form.moduleMsgCode" placeholder="请输入模块消息编码"/>
<Field label="所属设备" prop="deviceId" v-model="form.deviceId" placeholder="请输入所属设备"/>
<Field label="调用次数" prop="useNum" v-model="form.useNum" placeholder="请输入调用次数"/>
</el-row>
......@@ -36,8 +38,9 @@
],
// 表单校验
rules: {
createTime: [
{required: true,message: "请选择创建时间" },
moduleName: [
{required: true,message: "请输入模块名称", trigger: "blur" },
{max: 256,message: "最多只能录入256个字符",trigger: "blur",},
],
}
};
......@@ -88,7 +91,9 @@
// 表单重置
reset() {
this.form = {
moduleId : null,
moduleName : "",
moduleMsgCode : null,
deviceId : null,
useNum : null,
};
this.resetForm("form");
......
......@@ -65,7 +65,7 @@
</template>
<script>
import form from "@/assets/mixins/form";
import form from "@/assets/mixins/formdialog";
export default {
mixins: [form],
data() {
......@@ -82,6 +82,7 @@ export default {
paramKey: [{ required: true, message: "请输入参数键", trigger: "blur" }],
paramValue: [{ required: true, message: "请输入参数值", trigger: "blur" }],
},
// urls:{list: "/para/file/list"}
};
},
......
......@@ -9,8 +9,8 @@ import java.util.Map;
* @author zxfei
*/
public enum LogTypeEnum {
上报事件(0, "上报事件"),
下发服务(1, "下发服务");
上报事件(0, "上"),
下发服务(1, "下");
private Integer value;
private String desc;
......
......@@ -181,7 +181,8 @@ public class DeviceMsgComsumerStartedService implements IApplicationStartedServi
deviceLogEntity.initAttrValue();
deviceLogEntity.setDeviceId(deviceEntity.getId());
deviceLogEntity.setDeviceName(deviceEntity.getDeviceName());
deviceLogEntity.setDeviceNum(deviceEntity.getDeviceCode());
deviceLogEntity.setDeviceCode(deviceEntity.getDeviceCode());
deviceLogEntity.setMessageHead(queueMsg.getHeaders().getData().get(MESSAGETYPE));
deviceLogEntity.setContent(JSONObject.toJSONString(deviceReq));
deviceLogEntity.setLogType(LogTypeEnum.上报事件.getValue());
deviceLogEntity.setCreateUserId(1L);
......
......@@ -12,9 +12,10 @@ import com.mortals.xhx.common.code.DeviceOnlineStatusEnum;
import com.mortals.xhx.common.code.DeviceMethodEnum;
import com.mortals.xhx.common.code.DeviceStatusEnum;
import com.mortals.xhx.common.key.ParamKey;
import com.mortals.xhx.module.device.model.DeviceLogEntity;
import com.mortals.xhx.module.device.model.DeviceLogQuery;
import com.mortals.xhx.module.device.model.*;
import com.mortals.xhx.module.device.service.DeviceLogService;
import com.mortals.xhx.module.device.service.DeviceModuleService;
import com.mortals.xhx.module.device.service.DeviceModuleUseService;
import com.mortals.xhx.module.device.service.DeviceService;
import com.mortals.xhx.module.platform.model.PlatformEntity;
import com.mortals.xhx.module.platform.service.PlatformService;
......@@ -26,6 +27,9 @@ import org.springframework.stereotype.Service;
import org.springframework.util.ObjectUtils;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
* 设备状态任务
......@@ -41,22 +45,88 @@ public class DeviceStatTaskImpl implements ITaskExcuteService {
private DeviceService deviceService;
@Autowired
private DeviceLogService deviceLogService;
@Autowired
private DeviceModuleUseService deviceModuleUseService;
@Autowired
private ParamService paramService;
@Autowired
private ProductService productService;
@Autowired
private PlatformService platformService;
@Autowired
private DeviceModuleService moduleService;
@Override
public void excuteTask(ITask task) throws AppException {
log.debug("设备状态统计,开始执行");
log.debug("设备统计,开始执行");
doDeviceModuleUse();
//doDeviceUpOrDown();
//doDeviceLogDel();
log.debug("设备状态统计,结束执行");
log.debug("设备统计,结束执行");
}
/**
* 统计设备模块使用率
*/
private void doDeviceModuleUse() {
Map<String, DeviceModuleEntity> moduleMap = moduleService.find(new DeviceModuleQuery()).stream().collect(Collectors.toMap(x -> x.getModuleMsgCode(), y -> y, (o, n) -> n));
try {
// TODO: 2022/7/2 根据每个设备单独查询统计 计算数据量会减少
List<DeviceModuleUseEntity> moduleUseEntityList = deviceService.getCacheList().stream().flatMap(device -> {
//查询当前设备日志
List<DeviceLogEntity> deviceLogList = deviceLogService.find(new DeviceLogQuery().deviceId(device.getId()));
//分组统计每个模块头使用率
Map<String, Long> modelCollect = deviceLogList.parallelStream().collect(Collectors.groupingBy(DeviceLogEntity::getMessageHead, Collectors.counting()));
return modelCollect.entrySet().stream().map(item -> {
if (moduleMap.containsKey(item.getKey())) {
DeviceModuleUseEntity deviceModuleUseEntity = new DeviceModuleUseEntity();
deviceModuleUseEntity.initAttrValue();
DeviceModuleEntity deviceModuleEntity = moduleMap.get(item.getKey());
deviceModuleUseEntity.setDeviceId(device.getId());
deviceModuleUseEntity.setModuleMsgCode(deviceModuleEntity.getModuleMsgCode());
deviceModuleUseEntity.setModuleName(deviceModuleEntity.getModuleName());
deviceModuleUseEntity.setUseNum(item.getValue());
deviceModuleUseEntity.setCreateUserId(1L);
deviceModuleUseEntity.setCreateTime(new Date());
return deviceModuleUseEntity;
}
return null;
}).filter(f -> f != null);
}).collect(Collectors.toList());
if (!ObjectUtils.isEmpty(moduleUseEntityList)) {
//遍历,更新统计数据表 标识 设备id与消息头
Map<String, DeviceModuleUseEntity> collect = deviceModuleUseService.find(new DeviceModuleUseQuery()).stream().collect(Collectors.toMap(x -> x.getDeviceId() + "#" + x.getModuleMsgCode(), y -> y, (o, n) -> n));
moduleUseEntityList.stream().forEach(mudule -> {
String key = mudule.getDeviceId() + "#" + mudule.getModuleMsgCode();
if (collect.containsKey(key)) {
//更新
DeviceModuleUseEntity deviceModuleUseEntity = collect.get(key);
mudule.setId(deviceModuleUseEntity.getId());
mudule.setUpdateTime(new Date());
mudule.setUpdateUserId(1L);
deviceModuleUseService.update(mudule, null);
} else {
//新增
deviceModuleUseService.save(mudule, null);
}
});
}
} catch (Exception e) {
log.error("更新任务异常,结束执行", e);
}
}
/**
* 统计更新设备状态
*/
......
......@@ -8,7 +8,7 @@ import java.util.List;
* 设备模块信息 DAO接口
*
* @author zxfei
* @date 2022-06-27
* @date 2022-07-02
*/
public interface DeviceModuleDao extends ICRUDDao<DeviceModuleEntity,Long>{
......
......@@ -8,7 +8,7 @@ import java.util.List;
* 设备模块使用频率 DAO接口
*
* @author zxfei
* @date 2022-06-27
* @date 2022-07-02
*/
public interface DeviceModuleUseDao extends ICRUDDao<DeviceModuleUseEntity,Long>{
......
......@@ -11,7 +11,7 @@ import java.util.List;
* 设备模块信息DaoImpl DAO接口
*
* @author zxfei
* @date 2022-06-27
* @date 2022-07-02
*/
@Repository("deviceModuleDao")
public class DeviceModuleDaoImpl extends BaseCRUDDaoMybatis<DeviceModuleEntity,Long> implements DeviceModuleDao {
......
......@@ -11,7 +11,7 @@ import java.util.List;
* 设备模块使用频率DaoImpl DAO接口
*
* @author zxfei
* @date 2022-06-27
* @date 2022-07-02
*/
@Repository("deviceModuleUseDao")
public class DeviceModuleUseDaoImpl extends BaseCRUDDaoMybatis<DeviceModuleUseEntity,Long> implements DeviceModuleUseDao {
......
......@@ -7,124 +7,142 @@ import com.mortals.framework.annotation.Excel;
import com.mortals.framework.model.BaseEntityLong;
import com.mortals.xhx.module.device.model.vo.DeviceLogVo;
/**
* 设备日志实体对象
*
* @author zxfei
* @date 2022-07-01
*/
* 设备日志实体对象
*
* @author zxfei
* @date 2022-07-02
*/
public class DeviceLogEntity extends DeviceLogVo {
private static final long serialVersionUID = 1L;
/**
* traceId,日志追踪id
*/
* traceId,日志追踪id
*/
private String traceID;
/**
* 设备ID
*/
* 设备ID
*/
private Long deviceId;
/**
* 设备编号
*/
private String deviceNum;
* 设备编号
*/
private String deviceCode;
/**
* 设备名称,设置设备名称。
*/
* 设备名称,设置设备名称。
*/
private String deviceName;
/**
* 日志类型,(0.上报事件,1.下发服务)
*/
* 业务消息头标识
*/
private String messageHead;
/**
* 消息类型,(0.上行,1.下行)
*/
private Integer logType;
/**
* 内容
*/
* 内容
*/
private String content;
public DeviceLogEntity(){}
/**
* 获取 traceId,日志追踪id
* @return String
*/
* 获取 traceId,日志追踪id
* @return String
*/
public String getTraceID(){
return traceID;
}
/**
* 设置 traceId,日志追踪id
* @param traceID
*/
* 设置 traceId,日志追踪id
* @param traceID
*/
public void setTraceID(String traceID){
this.traceID = traceID;
}
/**
* 获取 设备ID
* @return Long
*/
* 获取 设备ID
* @return Long
*/
public Long getDeviceId(){
return deviceId;
}
/**
* 设置 设备ID
* @param deviceId
*/
* 设置 设备ID
* @param deviceId
*/
public void setDeviceId(Long deviceId){
this.deviceId = deviceId;
}
/**
* 获取 设备编号
* @return String
*/
public String getDeviceNum(){
return deviceNum;
* 获取 设备编号
* @return String
*/
public String getDeviceCode(){
return deviceCode;
}
/**
* 设置 设备编号
* @param deviceNum
*/
public void setDeviceNum(String deviceNum){
this.deviceNum = deviceNum;
* 设置 设备编号
* @param deviceCode
*/
public void setDeviceCode(String deviceCode){
this.deviceCode = deviceCode;
}
/**
* 获取 设备名称,设置设备名称。
* @return String
*/
* 获取 设备名称,设置设备名称。
* @return String
*/
public String getDeviceName(){
return deviceName;
}
/**
* 设置 设备名称,设置设备名称。
* @param deviceName
*/
* 设置 设备名称,设置设备名称。
* @param deviceName
*/
public void setDeviceName(String deviceName){
this.deviceName = deviceName;
}
/**
* 获取 日志类型,(0.上报事件,1.下发服务)
* @return Integer
*/
* 获取 业务消息头标识
* @return String
*/
public String getMessageHead(){
return messageHead;
}
/**
* 设置 业务消息头标识
* @param messageHead
*/
public void setMessageHead(String messageHead){
this.messageHead = messageHead;
}
/**
* 获取 消息类型,(0.上行,1.下行)
* @return Integer
*/
public Integer getLogType(){
return logType;
}
/**
* 设置 日志类型,(0.上报事件,1.下发服务)
* @param logType
*/
* 设置 消息类型,(0.上行,1.下行)
* @param logType
*/
public void setLogType(Integer logType){
this.logType = logType;
}
/**
* 获取 内容
* @return String
*/
* 获取 内容
* @return String
*/
public String getContent(){
return content;
}
/**
* 设置 内容
* @param content
*/
* 设置 内容
* @param content
*/
public void setContent(String content){
this.content = content;
}
......@@ -134,7 +152,7 @@ public class DeviceLogEntity extends DeviceLogVo {
@Override
public int hashCode() {
return this.getId().hashCode();
return this.getId().hashCode();
}
@Override
public boolean equals(Object obj) {
......@@ -142,7 +160,7 @@ public class DeviceLogEntity extends DeviceLogVo {
if (obj instanceof DeviceLogEntity) {
DeviceLogEntity tmp = (DeviceLogEntity) obj;
if (this.getId() == tmp.getId()) {
return true;
return true;
}
}
return false;
......@@ -152,8 +170,9 @@ public class DeviceLogEntity extends DeviceLogVo {
StringBuilder sb = new StringBuilder("");
sb.append(",traceID:").append(getTraceID());
sb.append(",deviceId:").append(getDeviceId());
sb.append(",deviceNum:").append(getDeviceNum());
sb.append(",deviceCode:").append(getDeviceCode());
sb.append(",deviceName:").append(getDeviceName());
sb.append(",messageHead:").append(getMessageHead());
sb.append(",logType:").append(getLogType());
sb.append(",content:").append(getContent());
return sb.toString();
......@@ -161,16 +180,18 @@ public class DeviceLogEntity extends DeviceLogVo {
public void initAttrValue(){
this.traceID = "";
this.traceID = "";
this.deviceId = null;
this.deviceId = null;
this.deviceCode = "";
this.deviceNum = "";
this.deviceName = "";
this.deviceName = "";
this.messageHead = "";
this.logType = null;
this.logType = null;
this.content = "";
this.content = "";
}
}
\ No newline at end of file
......@@ -10,7 +10,7 @@ import com.mortals.xhx.module.device.model.vo.DeviceModuleVo;
* 设备模块信息实体对象
*
* @author zxfei
* @date 2022-07-01
* @date 2022-07-02
*/
public class DeviceModuleEntity extends DeviceModuleVo {
......@@ -19,42 +19,42 @@ public class DeviceModuleEntity extends DeviceModuleVo {
/**
* 模块名称
*/
private Long moduleId;
private String moduleName;
/**
* 所属设备
* 模块消息编码,与上报消息头编码一致,唯一
*/
private Long deviceId;
private String moduleMsgCode;
public DeviceModuleEntity(){}
/**
* 获取 模块名称
* @return Long
* @return String
*/
public Long getModuleId(){
return moduleId;
public String getModuleName(){
return moduleName;
}
/**
* 设置 模块名称
* @param moduleId
* @param moduleName
*/
public void setModuleId(Long moduleId){
this.moduleId = moduleId;
public void setModuleName(String moduleName){
this.moduleName = moduleName;
}
/**
* 获取 所属设备
* @return Long
* 获取 模块消息编码,与上报消息头编码一致,唯一
* @return String
*/
public Long getDeviceId(){
return deviceId;
public String getModuleMsgCode(){
return moduleMsgCode;
}
/**
* 设置 所属设备
* @param deviceId
* 设置 模块消息编码,与上报消息头编码一致,唯一
* @param moduleMsgCode
*/
public void setDeviceId(Long deviceId){
this.deviceId = deviceId;
public void setModuleMsgCode(String moduleMsgCode){
this.moduleMsgCode = moduleMsgCode;
}
......@@ -78,15 +78,15 @@ public class DeviceModuleEntity extends DeviceModuleVo {
public String toString(){
StringBuilder sb = new StringBuilder("");
sb.append(",moduleId:").append(getModuleId());
sb.append(",deviceId:").append(getDeviceId());
sb.append(",moduleName:").append(getModuleName());
sb.append(",moduleMsgCode:").append(getModuleMsgCode());
return sb.toString();
}
public void initAttrValue(){
this.moduleId = null;
this.moduleName = "";
this.deviceId = null;
this.moduleMsgCode = "";
}
}
\ No newline at end of file
......@@ -6,7 +6,7 @@ import com.mortals.xhx.module.device.model.DeviceModuleEntity;
* 设备模块信息查询对象
*
* @author zxfei
* @date 2022-07-01
* @date 2022-07-02
*/
public class DeviceModuleQuery extends DeviceModuleEntity {
/** 开始 主键ID,主键,自增长 */
......@@ -21,29 +21,11 @@ public class DeviceModuleQuery extends DeviceModuleEntity {
/** 主键ID,主键,自增长列表 */
private List <Long> idList;
/** 开始 模块名称 */
private Long moduleIdStart;
/** 模块名称 */
private List<String> moduleNameList;
/** 结束 模块名称 */
private Long moduleIdEnd;
/** 增加 模块名称 */
private Long moduleIdIncrement;
/** 模块名称列表 */
private List <Long> moduleIdList;
/** 开始 所属设备 */
private Long deviceIdStart;
/** 结束 所属设备 */
private Long deviceIdEnd;
/** 增加 所属设备 */
private Long deviceIdIncrement;
/** 所属设备列表 */
private List <Long> deviceIdList;
/** 模块消息编码,与上报消息头编码一致,唯一 */
private List<String> moduleMsgCodeList;
/** 开始 创建时间 */
private String createTimeStart;
......@@ -141,134 +123,36 @@ public class DeviceModuleQuery extends DeviceModuleEntity {
this.idList = idList;
}
/**
* 获取 开始 模块名称
* @return moduleIdStart
*/
public Long getModuleIdStart(){
return this.moduleIdStart;
}
/**
* 设置 开始 模块名称
* @param moduleIdStart
*/
public void setModuleIdStart(Long moduleIdStart){
this.moduleIdStart = moduleIdStart;
}
/**
* 获取 结束 模块名称
* @return $moduleIdEnd
*/
public Long getModuleIdEnd(){
return this.moduleIdEnd;
}
/**
* 设置 结束 模块名称
* @param moduleIdEnd
*/
public void setModuleIdEnd(Long moduleIdEnd){
this.moduleIdEnd = moduleIdEnd;
}
/**
* 获取 增加 模块名称
* @return moduleIdIncrement
*/
public Long getModuleIdIncrement(){
return this.moduleIdIncrement;
}
/**
* 设置 增加 模块名称
* @param moduleIdIncrement
*/
public void setModuleIdIncrement(Long moduleIdIncrement){
this.moduleIdIncrement = moduleIdIncrement;
}
/**
* 获取 模块名称
* @return moduleIdList
* @return moduleNameList
*/
public List<Long> getModuleIdList(){
return this.moduleIdList;
public List<String> getModuleNameList(){
return this.moduleNameList;
}
/**
* 设置 模块名称
* @param moduleIdList
*/
public void setModuleIdList(List<Long> moduleIdList){
this.moduleIdList = moduleIdList;
}
/**
* 获取 开始 所属设备
* @return deviceIdStart
* @param moduleNameList
*/
public Long getDeviceIdStart(){
return this.deviceIdStart;
public void setModuleNameList(List<String> moduleNameList){
this.moduleNameList = moduleNameList;
}
/**
* 设置 开始 所属设备
* @param deviceIdStart
*/
public void setDeviceIdStart(Long deviceIdStart){
this.deviceIdStart = deviceIdStart;
}
/**
* 获取 结束 所属设备
* @return $deviceIdEnd
* 获取 模块消息编码,与上报消息头编码一致,唯一
* @return moduleMsgCodeList
*/
public Long getDeviceIdEnd(){
return this.deviceIdEnd;
public List<String> getModuleMsgCodeList(){
return this.moduleMsgCodeList;
}
/**
* 设置 结束 所属设备
* @param deviceIdEnd
* 设置 模块消息编码,与上报消息头编码一致,唯一
* @param moduleMsgCodeList
*/
public void setDeviceIdEnd(Long deviceIdEnd){
this.deviceIdEnd = deviceIdEnd;
public void setModuleMsgCodeList(List<String> moduleMsgCodeList){
this.moduleMsgCodeList = moduleMsgCodeList;
}
/**
* 获取 增加 所属设备
* @return deviceIdIncrement
*/
public Long getDeviceIdIncrement(){
return this.deviceIdIncrement;
}
/**
* 设置 增加 所属设备
* @param deviceIdIncrement
*/
public void setDeviceIdIncrement(Long deviceIdIncrement){
this.deviceIdIncrement = deviceIdIncrement;
}
/**
* 获取 所属设备
* @return deviceIdList
*/
public List<Long> getDeviceIdList(){
return this.deviceIdList;
}
/**
* 设置 所属设备
* @param deviceIdList
*/
public void setDeviceIdList(List<Long> deviceIdList){
this.deviceIdList = deviceIdList;
}
/**
* 获取 开始 创建时间
* @return createTimeStart
......@@ -442,95 +326,43 @@ public class DeviceModuleQuery extends DeviceModuleEntity {
return this;
}
/**
* 设置 模块名称
* @param moduleId
*/
public DeviceModuleQuery moduleId(Long moduleId){
setModuleId(moduleId);
return this;
}
/**
* 设置 开始 模块名称
* @param moduleIdStart
*/
public DeviceModuleQuery moduleIdStart(Long moduleIdStart){
this.moduleIdStart = moduleIdStart;
return this;
}
/**
* 设置 结束 模块名称
* @param moduleIdEnd
*/
public DeviceModuleQuery moduleIdEnd(Long moduleIdEnd){
this.moduleIdEnd = moduleIdEnd;
return this;
}
/**
* 设置 增加 模块名称
* @param moduleIdIncrement
/**
* 设置 模块名称
* @param moduleName
*/
public DeviceModuleQuery moduleIdIncrement(Long moduleIdIncrement){
this.moduleIdIncrement = moduleIdIncrement;
public DeviceModuleQuery moduleName(String moduleName){
setModuleName(moduleName);
return this;
}
/**
* 设置 模块名称
* @param moduleIdList
*/
public DeviceModuleQuery moduleIdList(List<Long> moduleIdList){
this.moduleIdList = moduleIdList;
return this;
}
/**
* 设置 所属设备
* @param deviceId
*/
public DeviceModuleQuery deviceId(Long deviceId){
setDeviceId(deviceId);
return this;
}
/**
* 设置 开始 所属设备
* @param deviceIdStart
* @param moduleNameList
*/
public DeviceModuleQuery deviceIdStart(Long deviceIdStart){
this.deviceIdStart = deviceIdStart;
public DeviceModuleQuery moduleNameList(List<String> moduleNameList){
this.moduleNameList = moduleNameList;
return this;
}
/**
* 设置 结束 所属设备
* @param deviceIdEnd
*/
public DeviceModuleQuery deviceIdEnd(Long deviceIdEnd){
this.deviceIdEnd = deviceIdEnd;
return this;
}
/**
* 设置 增加 所属设备
* @param deviceIdIncrement
/**
* 设置 模块消息编码,与上报消息头编码一致,唯一
* @param moduleMsgCode
*/
public DeviceModuleQuery deviceIdIncrement(Long deviceIdIncrement){
this.deviceIdIncrement = deviceIdIncrement;
public DeviceModuleQuery moduleMsgCode(String moduleMsgCode){
setModuleMsgCode(moduleMsgCode);
return this;
}
/**
* 设置 所属设备
* @param deviceIdList
* 设置 模块消息编码,与上报消息头编码一致,唯一
* @param moduleMsgCodeList
*/
public DeviceModuleQuery deviceIdList(List<Long> deviceIdList){
this.deviceIdList = deviceIdList;
public DeviceModuleQuery moduleMsgCodeList(List<String> moduleMsgCodeList){
this.moduleMsgCodeList = moduleMsgCodeList;
return this;
}
}
/**
......
......@@ -7,52 +7,88 @@ import com.mortals.framework.annotation.Excel;
import com.mortals.framework.model.BaseEntityLong;
import com.mortals.xhx.module.device.model.vo.DeviceModuleUseVo;
/**
* 设备模块使用频率实体对象
*
* @author zxfei
* @date 2022-07-01
*/
* 设备模块使用频率实体对象
*
* @author zxfei
* @date 2022-07-02
*/
public class DeviceModuleUseEntity extends DeviceModuleUseVo {
private static final long serialVersionUID = 1L;
/**
* 模块ID
*/
private Long moduleId;
* 模块名称
*/
private String moduleName;
/**
* 调用次数
*/
* 模块消息编码
*/
private String moduleMsgCode;
/**
* 所属设备
*/
private Long deviceId;
/**
* 调用次数
*/
private Long useNum;
public DeviceModuleUseEntity(){}
/**
* 获取 模块ID
* @return Long
*/
public Long getModuleId(){
return moduleId;
* 获取 模块名称
* @return String
*/
public String getModuleName(){
return moduleName;
}
/**
* 设置 模块名称
* @param moduleName
*/
public void setModuleName(String moduleName){
this.moduleName = moduleName;
}
/**
* 获取 模块消息编码
* @return String
*/
public String getModuleMsgCode(){
return moduleMsgCode;
}
/**
* 设置 模块ID
* @param moduleId
*/
public void setModuleId(Long moduleId){
this.moduleId = moduleId;
* 设置 模块消息编码
* @param moduleMsgCode
*/
public void setModuleMsgCode(String moduleMsgCode){
this.moduleMsgCode = moduleMsgCode;
}
/**
* 获取 调用次数
* @return Long
*/
* 获取 所属设备
* @return Long
*/
public Long getDeviceId(){
return deviceId;
}
/**
* 设置 所属设备
* @param deviceId
*/
public void setDeviceId(Long deviceId){
this.deviceId = deviceId;
}
/**
* 获取 调用次数
* @return Long
*/
public Long getUseNum(){
return useNum;
}
/**
* 设置 调用次数
* @param useNum
*/
* 设置 调用次数
* @param useNum
*/
public void setUseNum(Long useNum){
this.useNum = useNum;
}
......@@ -62,7 +98,7 @@ public class DeviceModuleUseEntity extends DeviceModuleUseVo {
@Override
public int hashCode() {
return this.getId().hashCode();
return this.getId().hashCode();
}
@Override
public boolean equals(Object obj) {
......@@ -70,7 +106,7 @@ public class DeviceModuleUseEntity extends DeviceModuleUseVo {
if (obj instanceof DeviceModuleUseEntity) {
DeviceModuleUseEntity tmp = (DeviceModuleUseEntity) obj;
if (this.getId() == tmp.getId()) {
return true;
return true;
}
}
return false;
......@@ -78,15 +114,21 @@ public class DeviceModuleUseEntity extends DeviceModuleUseVo {
public String toString(){
StringBuilder sb = new StringBuilder("");
sb.append(",moduleId:").append(getModuleId());
sb.append(",moduleName:").append(getModuleName());
sb.append(",moduleMsgCode:").append(getModuleMsgCode());
sb.append(",deviceId:").append(getDeviceId());
sb.append(",useNum:").append(getUseNum());
return sb.toString();
}
public void initAttrValue(){
this.moduleId = null;
this.moduleName = "";
this.moduleMsgCode = "";
this.deviceId = null;
this.useNum = null;
this.useNum = null;
}
}
\ No newline at end of file
package com.mortals.xhx.module.device.model.vo;
import com.mortals.framework.model.BaseEntityLong;
import com.mortals.xhx.module.device.model.DeviceAlarmInfoEntity;
import lombok.Data;
import java.util.ArrayList;
import java.util.List;
/**
......@@ -9,6 +11,12 @@ import java.util.List;
* @author zxfei
* @date 2022-07-01
*/
@Data
public class DeviceAlarmInfoVo extends BaseEntityLong {
/** 开始 告警时间 */
private String alarmTimeStart;
/** 结束 告警时间 */
private String alarmTimeEnd;
}
\ No newline at end of file
......@@ -7,7 +7,7 @@ import java.util.List;
* 设备模块使用频率视图对象
*
* @author zxfei
* @date 2022-07-01
* @date 2022-07-02
*/
public class DeviceModuleUseVo extends BaseEntityLong {
......
......@@ -7,7 +7,7 @@ import java.util.List;
* 设备模块信息视图对象
*
* @author zxfei
* @date 2022-07-01
* @date 2022-07-02
*/
public class DeviceModuleVo extends BaseEntityLong {
......
......@@ -7,7 +7,7 @@ import com.mortals.xhx.module.device.model.DeviceModuleEntity;
* 设备模块信息 service接口
*
* @author zxfei
* @date 2022-06-27
* @date 2022-07-02
*/
public interface DeviceModuleService extends ICRUDService<DeviceModuleEntity,Long>{
......
......@@ -7,7 +7,7 @@ import com.mortals.xhx.module.device.model.DeviceModuleUseEntity;
* 设备模块使用频率 service接口
*
* @author zxfei
* @date 2022-06-27
* @date 2022-07-02
*/
public interface DeviceModuleUseService extends ICRUDService<DeviceModuleUseEntity,Long>{
......
......@@ -9,7 +9,7 @@ import com.mortals.xhx.module.device.service.DeviceModuleService;
* 设备模块信息 service实现
*
* @author zxfei
* @date 2022-06-27
* @date 2022-07-02
*/
@Service("deviceModuleService")
public class DeviceModuleServiceImpl extends AbstractCRUDServiceImpl<DeviceModuleDao, DeviceModuleEntity, Long> implements DeviceModuleService {
......
......@@ -9,7 +9,7 @@ import com.mortals.xhx.module.device.service.DeviceModuleUseService;
* 设备模块使用频率 service实现
*
* @author zxfei
* @date 2022-06-27
* @date 2022-07-02
*/
@Service("deviceModuleUseService")
public class DeviceModuleUseServiceImpl extends AbstractCRUDServiceImpl<DeviceModuleUseDao, DeviceModuleUseEntity, Long> implements DeviceModuleUseService {
......
......@@ -4,35 +4,41 @@ import com.mortals.framework.model.Context;
import com.mortals.framework.web.BaseCRUDJsonBodyMappingController;
import com.mortals.xhx.base.system.param.service.ParamService;
import com.mortals.xhx.module.device.model.DeviceAlarmInfoEntity;
import com.mortals.xhx.module.device.model.DeviceQuery;
import com.mortals.xhx.module.device.service.DeviceAlarmInfoService;
import com.mortals.xhx.module.device.service.DeviceService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.Map;
import java.util.stream.Collectors;
/**
*
* 设备告警日志
*
* @author zxfei
* @date 2022-06-27
*/
* 设备告警日志
*
* @author zxfei
* @date 2022-06-27
*/
@RestController
@RequestMapping("device/alarm/info")
public class DeviceAlarmInfoController extends BaseCRUDJsonBodyMappingController<DeviceAlarmInfoService,DeviceAlarmInfoEntity,Long> {
public class DeviceAlarmInfoController extends BaseCRUDJsonBodyMappingController<DeviceAlarmInfoService, DeviceAlarmInfoEntity, Long> {
@Autowired
private ParamService paramService;
@Autowired
private DeviceService deviceService;
public DeviceAlarmInfoController(){
super.setModuleDesc( "设备告警日志");
public DeviceAlarmInfoController() {
super.setModuleDesc("设备告警日志");
}
@Override
protected void init(Map<String, Object> model, Context context) {
this.addDict(model, "alarmType", paramService.getParamBySecondOrganize("DeviceAlarmInfo","alarmType"));
this.addDict(model, "alarmLevel", paramService.getParamBySecondOrganize("DeviceAlarmInfo","alarmLevel"));
this.addDict(model, "alarmStatus", paramService.getParamBySecondOrganize("DeviceAlarmInfo","alarmStatus"));
this.addDict(model, "alarmType", paramService.getParamBySecondOrganize("DeviceAlarmInfo", "alarmType"));
this.addDict(model, "alarmLevel", paramService.getParamBySecondOrganize("DeviceAlarmInfo", "alarmLevel"));
this.addDict(model, "alarmStatus", paramService.getParamBySecondOrganize("DeviceAlarmInfo", "alarmStatus"));
this.addDict(model, "alarmDevice", deviceService.find(new DeviceQuery()).stream().collect(Collectors.toMap(x -> x.getId().toString(), y -> y.getDeviceName())));
super.init(model, context);
}
......
package com.mortals.xhx.module.device.web;
import com.mortals.framework.model.Context;
import com.mortals.framework.web.BaseCRUDJsonBodyMappingController;
import com.mortals.xhx.base.system.param.service.ParamService;
import com.mortals.xhx.module.device.model.DeviceModuleEntity;
import com.mortals.xhx.module.device.service.DeviceModuleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
import com.mortals.framework.model.Context;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.mortals.framework.web.BaseCRUDJsonBodyMappingController;
import com.mortals.xhx.module.device.model.DeviceModuleEntity;
import com.mortals.xhx.module.device.service.DeviceModuleService;
import org.apache.commons.lang3.ArrayUtils;
import com.mortals.framework.util.StringUtils;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import com.alibaba.fastjson.JSONObject;
import java.util.Arrays;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import static com.mortals.framework.ap.SysConstains.*;
/**
*
* 设备模块信息
*
* @author zxfei
* @date 2022-06-27
* @date 2022-07-02
*/
@RestController
@RequestMapping("device/module")
......
package com.mortals.xhx.module.device.web;
import com.mortals.framework.model.Context;
import com.mortals.framework.web.BaseCRUDJsonBodyMappingController;
import com.mortals.xhx.base.system.param.service.ParamService;
import com.mortals.xhx.module.device.model.DeviceModuleUseEntity;
import com.mortals.xhx.module.device.service.DeviceModuleUseService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
import com.mortals.framework.model.Context;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.mortals.framework.web.BaseCRUDJsonBodyMappingController;
import com.mortals.xhx.module.device.model.DeviceModuleUseEntity;
import com.mortals.xhx.module.device.service.DeviceModuleUseService;
import org.apache.commons.lang3.ArrayUtils;
import com.mortals.framework.util.StringUtils;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import com.alibaba.fastjson.JSONObject;
import java.util.Arrays;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import static com.mortals.framework.ap.SysConstains.*;
/**
*
* 设备模块使用频率
*
* @author zxfei
* @date 2022-06-27
* @date 2022-07-02
*/
@RestController
@RequestMapping("device/module/use")
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment