Commit 3707e4a5 authored by 赵啸非's avatar 赵啸非

修改消息组件

parent b6b3b740
......@@ -75,7 +75,6 @@ INSERT INTO `mortals_xhx_menu` VALUES (9104, '菜单信息', '/menu/list', 91, 4
INSERT INTO `mortals_xhx_menu` VALUES (9105, '参数信息', '/param/list', 91, 50, 1, 0, 0, NULL, NULL, NULL, NULL, 0, 0, 3, NULL, NULL, NULL);
INSERT INTO `mortals_xhx_menu` VALUES (9106, '任务信息', '/task/list', 91, 60, 1, 0, 0, NULL, NULL, NULL, NULL, 0, 0, 3, NULL, NULL, NULL);
INSERT INTO `mortals_xhx_menu` VALUES (9107, '操作日志', '/oper/log/list', 91, 70, 1, 0, 0, NULL, NULL, NULL, NULL, 0, 0, 3, NULL, NULL, NULL);
INSERT INTO `mortals_xhx_menu` VALUES (9133, '站点管理', '/site/list', 91, NULL, 1, 0, 1, NULL, 'view', NULL, NULL, 0, 0, 3, '2021-11-03 21:51:48', 1, '系统管理员');
-- ----------------------------
......
-- ----------------------------
-- 设备生产厂商菜单 SQL
-- ----------------------------
INSERT INTO `mortals_xhx_menu` VALUES (null, '设备生产厂商', '/firm/list', 0, 1, 1, 0, 0,'',NULL, NULL, NULL, 0, 0, 1, NULL, NULL, NULL);
-- ----------------------------
-- 设备生产厂商资源路径 SQL
-- ----------------------------
INSERT INTO `mortals_xhx_resource` VALUES (null, '设备生产厂商-菜单管理-查看', '/firm/list,/firm/view,/firm/info,/firm/export,/firm/exportExcel,/firm/downloadTemplate,/firm/download', 3, 0, NULL, NULL, NULL, 0);
INSERT INTO `mortals_xhx_resource` VALUES (null, '设备生产厂商-菜单管理-维护', '/firm/add,/firm/edit,/firm/delete,/firm/logicDelete,/firm/save,/firm/importData', 3, 0, NULL, NULL, NULL, 0);
-- ----------------------------
-- 设备菜单 SQL
-- ----------------------------
INSERT INTO `mortals_xhx_menu` VALUES (null, '设备', '/device/list', 0, 1, 1, 0, 0,'',NULL, NULL, NULL, 0, 0, 1, NULL, NULL, NULL);
-- ----------------------------
-- 设备资源路径 SQL
-- ----------------------------
INSERT INTO `mortals_xhx_resource` VALUES (null, '设备-菜单管理-查看', '/device/list,/device/view,/device/info,/device/export,/device/exportExcel,/device/downloadTemplate,/device/download', 3, 0, NULL, NULL, NULL, 0);
INSERT INTO `mortals_xhx_resource` VALUES (null, '设备-菜单管理-维护', '/device/add,/device/edit,/device/delete,/device/logicDelete,/device/save,/device/importData', 3, 0, NULL, NULL, NULL, 0);
-- ----------------------------
-- 平台系统菜单 SQL
-- ----------------------------
INSERT INTO `mortals_xhx_menu` VALUES (null, '平台系统', '/platform/list', 0, 1, 1, 0, 0,'',NULL, NULL, NULL, 0, 0, 1, NULL, NULL, NULL);
-- ----------------------------
-- 平台系统资源路径 SQL
-- ----------------------------
INSERT INTO `mortals_xhx_resource` VALUES (null, '平台系统-菜单管理-查看', '/platform/list,/platform/view,/platform/info,/platform/export,/platform/exportExcel,/platform/downloadTemplate,/platform/download', 3, 0, NULL, NULL, NULL, 0);
INSERT INTO `mortals_xhx_resource` VALUES (null, '平台系统-菜单管理-维护', '/platform/add,/platform/edit,/platform/delete,/platform/logicDelete,/platform/save,/platform/importData', 3, 0, NULL, NULL, NULL, 0);
-- ----------------------------
-- 产品菜单 SQL
-- ----------------------------
INSERT INTO `mortals_xhx_menu` VALUES (null, '产品', '/product/list', 0, 1, 1, 0, 0,'',NULL, NULL, NULL, 0, 0, 1, NULL, NULL, NULL);
-- ----------------------------
-- 产品资源路径 SQL
-- ----------------------------
INSERT INTO `mortals_xhx_resource` VALUES (null, '产品-菜单管理-查看', '/product/list,/product/view,/product/info,/product/export,/product/exportExcel,/product/downloadTemplate,/product/download', 3, 0, NULL, NULL, NULL, 0);
INSERT INTO `mortals_xhx_resource` VALUES (null, '产品-菜单管理-维护', '/product/add,/product/edit,/product/delete,/product/logicDelete,/product/save,/product/importData', 3, 0, NULL, NULL, NULL, 0);
-- ----------------------------
-- 设备日志菜单 SQL
-- ----------------------------
INSERT INTO `mortals_xhx_menu` VALUES (null, '设备日志', '/device/log/list', 0, 1, 1, 0, 0,'',NULL, NULL, NULL, 0, 0, 1, NULL, NULL, NULL);
-- ----------------------------
-- 设备日志资源路径 SQL
-- ----------------------------
INSERT INTO `mortals_xhx_resource` VALUES (null, '设备日志-菜单管理-查看', '/device/log/list,/device/log/view,/device/log/info,/device/log/export,/device/log/exportExcel,/device/log/downloadTemplate,/device/log/download', 3, 0, NULL, NULL, NULL, 0);
INSERT INTO `mortals_xhx_resource` VALUES (null, '设备日志-菜单管理-维护', '/device/log/add,/device/log/edit,/device/log/delete,/device/log/logicDelete,/device/log/save,/device/log/importData', 3, 0, NULL, NULL, NULL, 0);
-- ----------------------------
-- 设备生产厂商表
-- ----------------------------
DROP TABLE IF EXISTS `mortals_xhx_firm`;
CREATE TABLE mortals_xhx_firm(
`id` bigint(20) AUTO_INCREMENT COMMENT '主键ID,主键,自增长',
`firmName` varchar(128) NOT NULL COMMENT '设备生产厂商名称',
`firmCode` varchar(128) COMMENT '设备生产商编码',
`firmRemark` varchar(64) COMMENT '备注',
`createUserId` bigint(20) NOT NULL COMMENT '创建用户',
`createTime` datetime NOT NULL COMMENT '创建时间',
`updateUserId` bigint(20) COMMENT '更新用户',
`updateTime` datetime COMMENT '更新时间',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='设备生产厂商';
-- ----------------------------
-- 设备表
-- ----------------------------
DROP TABLE IF EXISTS `mortals_xhx_device`;
......@@ -6,14 +21,18 @@ CREATE TABLE mortals_xhx_device(
`id` bigint(20) AUTO_INCREMENT COMMENT '主键ID,主键,自增长',
`deviceName` varchar(20) NOT NULL COMMENT '设备名称',
`deviceCode` varchar(256) COMMENT '设备编码',
`deviceType` tinyint(2) NOT NULL COMMENT '设备类型(1.呼叫器,2.窗口屏, 3.评价器,4.集中屏, 5.排号机,6.im设备, 7.样表设备,8.取件柜, 9.信息发布,10.导视机,11.开标室设备,12.背靠背)',
`siteCode` varchar(256) COMMENT '站点编号,来源基础服务平台',
`siteName` varchar(256) COMMENT '站点名称',
`deviceMac` varchar(64) COMMENT '设备的MAC地址',
`platformId` bigint(20) NOT NULL COMMENT '平台系统Id',
`platformName` varchar(256) NOT NULL COMMENT '平台系统名称',
`productId` bigint(20) NOT NULL COMMENT '产品Id',
`productName` varchar(256) NOT NULL COMMENT '产品名称',
`deviceFirmId` bigint(20) COMMENT '设备生产厂商ID',
`deviceFirmname` varchar(20) COMMENT '设备生产厂商名称',
`ip` varchar(64) COMMENT '设备访问ip',
`centernum` varchar(64) COMMENT '中心设备编码',
`port` varchar(64) COMMENT '端口',
`siteNum` varchar(64) COMMENT '站点编号',
`deviceFirmId` bigint(20) COMMENT '设备生产厂商ID',
`deviceFirmname` varchar(20) COMMENT '设备生产厂商名称',
`deviceOnlineStatus` tinyint(2) NOT NULL COMMENT '在线状态 (0.离线,1.在线)',
`status` tinyint(2) NOT NULL COMMENT '启用状态 (0.停止,1.启用)',
`active` tinyint(2) NOT NULL COMMENT '激活状态 (0.未激活,1.已激活)',
......@@ -28,22 +47,39 @@ PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='设备';
-- ----------------------------
-- 设备生产厂商
-- 平台系统
-- ----------------------------
DROP TABLE IF EXISTS `mortals_xhx_firm`;
CREATE TABLE mortals_xhx_firm(
DROP TABLE IF EXISTS `mortals_xhx_platform`;
CREATE TABLE mortals_xhx_platform(
`id` bigint(20) AUTO_INCREMENT COMMENT '主键ID,主键,自增长',
`firmName` varchar(128) NOT NULL COMMENT '设备生产厂商名称',
`firmCode` varchar(128) COMMENT '设备生产商编码',
`firmRemark` varchar(64) COMMENT '备注',
`platformName` varchar(20) NOT NULL COMMENT '平台名称,名称唯一',
`platformSn` varchar(256) NOT NULL COMMENT '平台编码,编码唯一(编码加上站点编码,如phxt-51010251-1做Vhost虚拟机编码)',
`sendMsgType` tinyint(2) NOT NULL COMMENT '发送第三方平台消息类型(0.http,1.jms)',
`sendConfig` varchar(2048) COMMENT '发送参数配置,如发送消息地址等,xml结构,根据消息类型变化',
`sendSwitch` tinyint(2) NOT NULL COMMENT '是否启用发送消息(0.停用,1.启用)',
`platformRemark` varchar(256) COMMENT '备注',
`createUserId` bigint(20) NOT NULL COMMENT '创建用户',
`createTime` datetime NOT NULL COMMENT '创建时间',
`updateUserId` bigint(20) COMMENT '更新用户',
`updateTime` datetime COMMENT '更新时间',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='设备生产厂商';
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='平台系统';
-- ----------------------------
-- 产品表
-- ----------------------------
DROP TABLE IF EXISTS `mortals_xhx_product`;
CREATE TABLE mortals_xhx_product(
`id` bigint(20) AUTO_INCREMENT COMMENT '主键ID,主键,自增长',
`productName` varchar(20) NOT NULL COMMENT '产品名称,名称唯一',
`productCode` varchar(256) NOT NULL COMMENT '产品编码,编码唯一',
`exchangeName` varchar(256) NOT NULL COMMENT '交换机名称,英文必填,默认产品编码',
`productRemark` varchar(256) COMMENT '备注',
`createUserId` bigint(20) NOT NULL COMMENT '创建用户',
`createTime` datetime NOT NULL COMMENT '创建时间',
`updateUserId` bigint(20) COMMENT '更新用户',
`updateTime` datetime COMMENT '更新时间',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='产品';
-- ----------------------------
-- 设备日志表
-- ----------------------------
......@@ -55,59 +91,9 @@ CREATE TABLE mortals_xhx_device_log(
`deviceName` varchar(32) 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 '创建时间',
`updateUserId` bigint(20) COMMENT '更新用户',
`updateTime` datetime COMMENT '更新时间',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='设备日志';
-- ----------------------------
-- 设备菜单 SQL
-- ----------------------------
INSERT INTO `mortals_xhx_menu` VALUES (null, '设备', '/device/list', 0, 1, 1, 0, 0,'',NULL, NULL, NULL, 0, 0, 1, NULL, NULL, NULL);
-- ----------------------------
-- 设备资源路径 SQL
-- ----------------------------
INSERT INTO `mortals_xhx_resource` VALUES (null, '设备-菜单管理-查看', '/device/list,/device/view,/device/info,/device/export,/device/exportExcel,/device/downloadTemplate,/device/download', 3, 0, NULL, NULL, NULL, 0);
INSERT INTO `mortals_xhx_resource` VALUES (null, '设备-菜单管理-维护', '/device/add,/device/edit,/device/delete,/device/logicDelete,/device/save,/device/importData', 3, 0, NULL, NULL, NULL, 0);
-- ----------------------------
-- 设备参数 SQL
-- ----------------------------
INSERT INTO `mortals_xhx_param` VALUES (null, '设备类型', 'Device', 'deviceType', '1', '呼叫器', 1, 4, 0, 'deviceType', NULL, NULL, NULL);
INSERT INTO `mortals_xhx_param` VALUES (null, '设备类型', 'Device', 'deviceType', '2', '窗口屏', 1, 4, 0, 'deviceType', NULL, NULL, NULL);
INSERT INTO `mortals_xhx_param` VALUES (null, '设备类型', 'Device', 'deviceType', '3', '评价器', 1, 4, 0, 'deviceType', NULL, NULL, NULL);
INSERT INTO `mortals_xhx_param` VALUES (null, '设备类型', 'Device', 'deviceType', '4', '集中屏', 1, 4, 0, 'deviceType', NULL, NULL, NULL);
INSERT INTO `mortals_xhx_param` VALUES (null, '设备类型', 'Device', 'deviceType', '5', '排号机', 1, 4, 0, 'deviceType', NULL, NULL, NULL);
INSERT INTO `mortals_xhx_param` VALUES (null, '设备类型', 'Device', 'deviceType', '6', 'im设备', 1, 4, 0, 'deviceType', NULL, NULL, NULL);
INSERT INTO `mortals_xhx_param` VALUES (null, '设备类型', 'Device', 'deviceType', '7', '样表设备', 1, 4, 0, 'deviceType', NULL, NULL, NULL);
INSERT INTO `mortals_xhx_param` VALUES (null, '设备类型', 'Device', 'deviceType', '8', '取件柜', 1, 4, 0, 'deviceType', NULL, NULL, NULL);
INSERT INTO `mortals_xhx_param` VALUES (null, '设备类型', 'Device', 'deviceType', '9', '信息发布', 1, 4, 0, 'deviceType', NULL, NULL, NULL);
INSERT INTO `mortals_xhx_param` VALUES (null, '设备类型', 'Device', 'deviceType', '10', '导视机', 1, 4, 0, 'deviceType', NULL, NULL, NULL);
INSERT INTO `mortals_xhx_param` VALUES (null, '设备类型', 'Device', 'deviceType', '11', '开标室设备', 1, 4, 0, 'deviceType', NULL, NULL, NULL);
INSERT INTO `mortals_xhx_param` VALUES (null, '设备类型', 'Device', 'deviceType', '12', '背靠背', 1, 4, 0, 'deviceType', NULL, NULL, NULL);
INSERT INTO `mortals_xhx_param` VALUES (null, '在线状态 ', 'Device', 'deviceOnlineStatus', '0', '离线', 1, 4, 0, 'deviceOnlineStatus', NULL, NULL, NULL);
INSERT INTO `mortals_xhx_param` VALUES (null, '在线状态 ', 'Device', 'deviceOnlineStatus', '1', '在线', 1, 4, 0, 'deviceOnlineStatus', NULL, NULL, NULL);
INSERT INTO `mortals_xhx_param` VALUES (null, '启用状态 ', 'Device', 'status', '0', '停止', 1, 4, 0, 'status', NULL, NULL, NULL);
INSERT INTO `mortals_xhx_param` VALUES (null, '启用状态 ', 'Device', 'status', '1', '启用', 1, 4, 0, 'status', NULL, NULL, NULL);
INSERT INTO `mortals_xhx_param` VALUES (null, '激活状态 ', 'Device', 'active', '0', '未激活', 1, 4, 0, 'active', NULL, NULL, NULL);
INSERT INTO `mortals_xhx_param` VALUES (null, '激活状态 ', 'Device', 'active', '1', '已激活', 1, 4, 0, 'active', NULL, NULL, NULL);
-- ----------------------------
-- 设备生产厂商菜单 SQL
-- ----------------------------
INSERT INTO `mortals_xhx_menu` VALUES (null, '设备生产厂商', '/firm/list', 0, 1, 1, 0, 0,'',NULL, NULL, NULL, 0, 0, 1, NULL, NULL, NULL);
-- ----------------------------
-- 设备生产厂商资源路径 SQL
-- ----------------------------
INSERT INTO `mortals_xhx_resource` VALUES (null, '设备生产厂商-菜单管理-查看', '/firm/list,/firm/view,/firm/info,/firm/export,/firm/exportExcel,/firm/downloadTemplate,/firm/download', 3, 0, NULL, NULL, NULL, 0);
INSERT INTO `mortals_xhx_resource` VALUES (null, '设备生产厂商-菜单管理-维护', '/firm/add,/firm/edit,/firm/delete,/firm/logicDelete,/firm/save,/firm/importData', 3, 0, NULL, NULL, NULL, 0);
-- ----------------------------
-- 设备生产厂商参数 SQL
-- ----------------------------
-- ----------------------------
-- 设备参数 SQL
-- ----------------------------
INSERT INTO `mortals_xhx_param` VALUES (null, '在线状态 ', 'Device', 'deviceOnlineStatus', '0', '离线', 1, 4, 0, 'deviceOnlineStatus', NULL, NULL, NULL);
INSERT INTO `mortals_xhx_param` VALUES (null, '在线状态 ', 'Device', 'deviceOnlineStatus', '1', '在线', 1, 4, 0, 'deviceOnlineStatus', NULL, NULL, NULL);
INSERT INTO `mortals_xhx_param` VALUES (null, '启用状态 ', 'Device', 'status', '0', '停止', 1, 4, 0, 'status', NULL, NULL, NULL);
INSERT INTO `mortals_xhx_param` VALUES (null, '启用状态 ', 'Device', 'status', '1', '启用', 1, 4, 0, 'status', NULL, NULL, NULL);
INSERT INTO `mortals_xhx_param` VALUES (null, '激活状态 ', 'Device', 'active', '0', '未激活', 1, 4, 0, 'active', NULL, NULL, NULL);
INSERT INTO `mortals_xhx_param` VALUES (null, '激活状态 ', 'Device', 'active', '1', '已激活', 1, 4, 0, 'active', NULL, NULL, NULL);
-- ----------------------------
-- 平台系统参数 SQL
-- ----------------------------
INSERT INTO `mortals_xhx_param` VALUES (null, '发送第三方平台消息类型', 'Platform', 'sendMsgType', '0', 'http', 1, 4, 0, 'sendMsgType', NULL, NULL, NULL);
INSERT INTO `mortals_xhx_param` VALUES (null, '发送第三方平台消息类型', 'Platform', 'sendMsgType', '1', 'jms', 1, 4, 0, 'sendMsgType', NULL, NULL, NULL);
INSERT INTO `mortals_xhx_param` VALUES (null, '是否启用发送消息', 'Platform', 'sendSwitch', '0', '停用', 1, 4, 0, 'sendSwitch', NULL, NULL, NULL);
INSERT INTO `mortals_xhx_param` VALUES (null, '是否启用发送消息', 'Platform', 'sendSwitch', '1', '启用', 1, 4, 0, 'sendSwitch', NULL, NULL, NULL);
-- ----------------------------
-- 产品参数 SQL
-- ----------------------------
-- ----------------------------
-- 设备日志参数 SQL
-- ----------------------------
INSERT INTO `mortals_xhx_param` VALUES (null, '日志类型,', 'DeviceLog', 'logType', '0', '上报事件', 1, 4, 0, 'logType', NULL, NULL, NULL);
INSERT INTO `mortals_xhx_param` VALUES (null, '日志类型,', 'DeviceLog', 'logType', '1', '下发服务', 1, 4, 0, 'logType', NULL, NULL, NULL);
......@@ -61,7 +61,6 @@
<dependency>
<groupId>io.jsonwebtoken</groupId>
<artifactId>jjwt</artifactId>
<version>0.9.1</version>
</dependency>
......
......@@ -306,6 +306,32 @@ public class UserEntity extends UserEntityExt implements IUser {
public Integer getUserType() {
return this.userType;
}
@Override
public String getToken() {
return null;
}
@Override
public Long getLoginTime() {
return null;
}
@Override
public Long getExpireTime() {
return null;
}
@Override
public void setExpireTime(Long expireTime) {
}
@Override
public String getMenuUrl() {
return null;
}
/**
* 设置 用户类型,0:系统用户 1:普通用户 2:工作人员,默认2
* @param userType
......
......@@ -31,5 +31,15 @@ public class DeviceReq implements Serializable {
private String centernum;
private Boolean isAdmin;
private Boolean isManager;
public static void main(String[] args) {
// DeviceReq deviceReq = new DeviceReq();
// deviceReq.setIsAdmin();
// deviceReq.seti
}
}
......@@ -96,7 +96,7 @@ public class DeviceTokenService {
* @return 令牌
*/
public String createToken(DeviceEntity device) {
String token = IdUtil.fastUUID();
String token = IdUtil.fastSimpleUUID();
device.setToken(token);
refreshToken(device);
Map<String, Object> claims = new HashMap<>();
......
package com.mortals.xhx.busiz.security;
import com.mortals.framework.common.HttpStatus;
import com.mortals.framework.exception.AppException;
import org.springframework.security.core.Authentication;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
......
......@@ -10,6 +10,7 @@ import com.mortals.xhx.common.code.ApiRespCodeEnum;
import com.mortals.xhx.module.device.model.DeviceEntity;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.util.ObjectUtils;
import org.springframework.web.method.HandlerMethod;
import javax.servlet.http.HttpServletRequest;
......@@ -52,13 +53,11 @@ public class DeviceSubmitInterceptor extends BaseInterceptor {
public boolean verifyDevice(HttpServletRequest request) {
DeviceEntity device = deviceTokenService.getLoginDevice(request);
if (StringUtils.isNotNull(device) && StringUtils.isNull(SecurityUtils.getAuthentication())) {
if (!ObjectUtils.isEmpty(device) ) {
deviceTokenService.verifyToken(device);
return true;
}
return false;
}
}
......@@ -79,7 +79,7 @@ public class DeviceApiController {
deviceEntity.setDeviceOnlineStatus(DeviceOnlineStatusEnum.在线.getValue());
deviceEntity.setIp(req.getIp());
deviceEntity.setPort(req.getPort());
deviceEntity.setSiteNum(req.getSitenum());
//deviceEntity.setSiteNum(req.getSitenum());
deviceEntity.setCenternum(req.getCenternum());
deviceService.update(deviceEntity);
} else {
......@@ -90,7 +90,7 @@ public class DeviceApiController {
deviceEntity.setDeviceMac(req.getDeviceMac());
deviceEntity.setIp(req.getIp());
deviceEntity.setPort(req.getPort());
deviceEntity.setSiteNum(req.getSitenum());
//deviceEntity.set(req.getSitenum());
deviceEntity.setCenternum(req.getCenternum());
deviceEntity.setCreateUserId(1L);
deviceEntity.setCreateTime(new Date());
......
package com.mortals.xhx.common.code;
import java.util.LinkedHashMap;
import java.util.Map;
/**
* 发送第三方平台消息类型(0.http,1.jms)枚举类
*
* @author zxfei
*/
public enum SendMsgTypeEnum {
http(0, "http"),
jms(1, "jms");
private Integer value;
private String desc;
SendMsgTypeEnum(Integer value, String desc) {
this.value = value;
this.desc = desc;
}
public Integer getValue() {
return this.value;
}
public String getDesc() {
return this.desc;
}
public static SendMsgTypeEnum getByValue(Integer value) {
for (SendMsgTypeEnum sendMsgTypeEnum : SendMsgTypeEnum.values()) {
if (sendMsgTypeEnum.getValue() == value) {
return sendMsgTypeEnum;
}
}
return null;
}
/**
* 获取Map集合
*
* @param eItem 不包含项
* @return
*/
public static Map<String, String> getEnumMap(Integer... eItem) {
Map<String, String> resultMap = new LinkedHashMap<>();
for (SendMsgTypeEnum item : SendMsgTypeEnum.values()) {
try {
boolean hasE = false;
for (Integer e : eItem) {
if (item.getValue() == e) {
hasE = true;
break;
}
}
if (!hasE) {
resultMap.put(item.getValue() + "", item.getDesc());
}
} catch (Exception ex) {
}
}
return resultMap;
}
}
\ No newline at end of file
package com.mortals.xhx.common.code;
import java.util.LinkedHashMap;
import java.util.Map;
/**
* 是否启用发送消息(0.停用,1.启用)枚举类
*
* @author zxfei
*/
public enum SendSwitchEnum {
停用(0, "停用"),
启用(1, "启用");
private Integer value;
private String desc;
SendSwitchEnum(Integer value, String desc) {
this.value = value;
this.desc = desc;
}
public Integer getValue() {
return this.value;
}
public String getDesc() {
return this.desc;
}
public static SendSwitchEnum getByValue(Integer value) {
for (SendSwitchEnum sendSwitchEnum : SendSwitchEnum.values()) {
if (sendSwitchEnum.getValue() == value) {
return sendSwitchEnum;
}
}
return null;
}
/**
* 获取Map集合
*
* @param eItem 不包含项
* @return
*/
public static Map<String, String> getEnumMap(Integer... eItem) {
Map<String, String> resultMap = new LinkedHashMap<>();
for (SendSwitchEnum item : SendSwitchEnum.values()) {
try {
boolean hasE = false;
for (Integer e : eItem) {
if (item.getValue() == e) {
hasE = true;
break;
}
}
if (!hasE) {
resultMap.put(item.getValue() + "", item.getDesc());
}
} catch (Exception ex) {
}
}
return resultMap;
}
}
\ No newline at end of file
......@@ -84,7 +84,7 @@ public class DeviceMsgComsumerStartedService implements IApplicationStartedServi
deviceEntity.setDeviceOnlineStatus(DeviceOnlineStatusEnum.在线.getValue());
deviceEntity.setIp(deviceReq.getIp());
deviceEntity.setPort(deviceReq.getPort());
deviceEntity.setSiteNum(deviceReq.getSitenum());
// deviceEntity.setSiteNum(deviceReq.getSitenum());
deviceEntity.setCenternum(deviceReq.getCenternum());
deviceService.update(deviceEntity);
......
......@@ -16,6 +16,7 @@ import com.mortals.xhx.module.device.model.DeviceLogEntity;
import com.mortals.xhx.module.device.model.DeviceLogQuery;
import com.mortals.xhx.module.device.service.DeviceLogService;
import com.mortals.xhx.module.device.service.DeviceService;
import com.mortals.xhx.module.product.service.ProductService;
import lombok.extern.apachecommons.CommonsLog;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
......@@ -41,6 +42,8 @@ public class DeviceStatTaskImpl implements ITaskExcuteService {
private DeviceLogService deviceLogService;
@Autowired
private ParamService paramService;
@Autowired
private ProductService productService;
@Override
......@@ -56,7 +59,6 @@ public class DeviceStatTaskImpl implements ITaskExcuteService {
*/
private void doDeviceUpOrDown() {
int timeout = GlobalSysInfo.getParamIntValue(ParamKey.SYS_PARAM_HEADBEAT_TIMEOUT, 60) * 1000;
Map<String, String> deviceTypeMap = paramService.getParamBySecondOrganize("Device", "deviceType");
try {
//获取所有设备,针对每个设备查询最近指定秒的日志,如果没有则更新下线
deviceService.getCacheList().stream()
......@@ -71,7 +73,7 @@ public class DeviceStatTaskImpl implements ITaskExcuteService {
device.setOfflineTime(new Date());
device.setDeviceOnlineStatus(DeviceOnlineStatusEnum.离线.getValue());
deviceService.update(device);
String msg = String.format("%s设备:%s ,离线!", deviceTypeMap.get(device.getDeviceType().toString()), device.getDeviceCode());
String msg = String.format("%s设备:%s ,离线!", device.getProductName(), device.getDeviceCode());
WebSocketUtil.broadcast(SendToAllRequest.TYPE, new SendToAllRequest().setContent(msg));
}
......
......@@ -8,11 +8,11 @@ import com.mortals.framework.annotation.Excel;
import com.mortals.framework.model.BaseEntityLong;
import com.mortals.xhx.module.device.model.vo.DeviceVo;
/**
* 设备实体对象
*
* @author zxfei
* @date 2022-04-11
*/
* 设备实体对象
*
* @author zxfei
* @date 2022-04-25
*/
public class DeviceEntity extends DeviceVo {
private static final long serialVersionUID = 1L;
......@@ -27,29 +27,29 @@ public class DeviceEntity extends DeviceVo {
*/
private String deviceCode;
/**
* 设备类型(1.呼叫器,2.窗口屏, 3.评价器,4.集中屏, 5.排号机,6.im设备, 7.样表设备,8.取件柜, 9.信息发布,10.导视机,11.开标室设备,12.背靠背
* 站点编号(来源基础服务平台
*/
private Integer deviceType;
private String siteCode;
/**
* 设备的MAC地址
*/
private String deviceMac;
/**
* 设备访问ip
* 平台系统Id
*/
private String ip;
private Long platformId;
/**
* 中心设备编码
* 平台系统名称
*/
private String centernum;
private String platformName;
/**
* 端口
* 产品Id
*/
private String port;
private Long productId;
/**
* 站点编号
* 产品Id
*/
private String siteNum;
private String productName;
/**
* 设备生产厂商ID
*/
......@@ -60,6 +60,18 @@ public class DeviceEntity extends DeviceVo {
@Excel(name = "设备生产厂商名称")
private String deviceFirmname;
/**
* 设备访问ip
*/
private String ip;
/**
* 中心设备编码
*/
private String centernum;
/**
* 端口
*/
private String port;
/**
* 在线状态 (0.离线,1.在线)
*/
private Integer deviceOnlineStatus;
......@@ -116,18 +128,18 @@ public class DeviceEntity extends DeviceVo {
this.deviceCode = deviceCode;
}
/**
* 获取 设备类型(1.呼叫器,2.窗口屏, 3.评价器,4.集中屏, 5.排号机,6.im设备, 7.样表设备,8.取件柜, 9.信息发布,10.导视机,11.开标室设备,12.背靠背
* @return Integer
* 获取 站点编号(来源基础服务平台
* @return String
*/
public Integer getDeviceType(){
return deviceType;
public String getSiteCode(){
return siteCode;
}
/**
* 设置 设备类型(1.呼叫器,2.窗口屏, 3.评价器,4.集中屏, 5.排号机,6.im设备, 7.样表设备,8.取件柜, 9.信息发布,10.导视机,11.开标室设备,12.背靠背
* @param deviceType
* 设置 站点编号(来源基础服务平台
* @param siteCode
*/
public void setDeviceType(Integer deviceType){
this.deviceType = deviceType;
public void setSiteCode(String siteCode){
this.siteCode = siteCode;
}
/**
* 获取 设备的MAC地址
......@@ -144,60 +156,60 @@ public class DeviceEntity extends DeviceVo {
this.deviceMac = deviceMac;
}
/**
* 获取 设备访问ip
* @return String
* 获取 平台系统Id
* @return Long
*/
public String getIp(){
return ip;
public Long getPlatformId(){
return platformId;
}
/**
* 设置 设备访问ip
* @param ip
* 设置 平台系统Id
* @param platformId
*/
public void setIp(String ip){
this.ip = ip;
public void setPlatformId(Long platformId){
this.platformId = platformId;
}
/**
* 获取 中心设备编码
* 获取 平台系统名称
* @return String
*/
public String getCenternum(){
return centernum;
public String getPlatformName(){
return platformName;
}
/**
* 设置 中心设备编码
* @param centernum
* 设置 平台系统名称
* @param platformName
*/
public void setCenternum(String centernum){
this.centernum = centernum;
public void setPlatformName(String platformName){
this.platformName = platformName;
}
/**
* 获取 端口
* @return String
* 获取 产品Id
* @return Long
*/
public String getPort(){
return port;
public Long getProductId(){
return productId;
}
/**
* 设置 端口
* @param port
* 设置 产品Id
* @param productId
*/
public void setPort(String port){
this.port = port;
public void setProductId(Long productId){
this.productId = productId;
}
/**
* 获取 站点编号
* 获取 产品Id
* @return String
*/
public String getSiteNum(){
return siteNum;
public String getProductName(){
return productName;
}
/**
* 设置 站点编号
* @param siteNum
* 设置 产品Id
* @param productName
*/
public void setSiteNum(String siteNum){
this.siteNum = siteNum;
public void setProductName(String productName){
this.productName = productName;
}
/**
* 获取 设备生产厂商ID
......@@ -228,6 +240,48 @@ public class DeviceEntity extends DeviceVo {
this.deviceFirmname = deviceFirmname;
}
/**
* 获取 设备访问ip
* @return String
*/
public String getIp(){
return ip;
}
/**
* 设置 设备访问ip
* @param ip
*/
public void setIp(String ip){
this.ip = ip;
}
/**
* 获取 中心设备编码
* @return String
*/
public String getCenternum(){
return centernum;
}
/**
* 设置 中心设备编码
* @param centernum
*/
public void setCenternum(String centernum){
this.centernum = centernum;
}
/**
* 获取 端口
* @return String
*/
public String getPort(){
return port;
}
/**
* 设置 端口
* @param port
*/
public void setPort(String port){
this.port = port;
}
/**
* 获取 在线状态 (0.离线,1.在线)
* @return Integer
*/
......@@ -335,14 +389,17 @@ public class DeviceEntity extends DeviceVo {
StringBuilder sb = new StringBuilder("");
sb.append(",deviceName:").append(getDeviceName());
sb.append(",deviceCode:").append(getDeviceCode());
sb.append(",deviceType:").append(getDeviceType());
sb.append(",siteCode:").append(getSiteCode());
sb.append(",deviceMac:").append(getDeviceMac());
sb.append(",platformId:").append(getPlatformId());
sb.append(",platformName:").append(getPlatformName());
sb.append(",productId:").append(getProductId());
sb.append(",productName:").append(getProductName());
sb.append(",deviceFirmId:").append(getDeviceFirmId());
sb.append(",deviceFirmname:").append(getDeviceFirmname());
sb.append(",ip:").append(getIp());
sb.append(",centernum:").append(getCenternum());
sb.append(",port:").append(getPort());
sb.append(",siteNum:").append(getSiteNum());
sb.append(",deviceFirmId:").append(getDeviceFirmId());
sb.append(",deviceFirmname:").append(getDeviceFirmname());
sb.append(",deviceOnlineStatus:").append(getDeviceOnlineStatus());
sb.append(",status:").append(getStatus());
sb.append(",active:").append(getActive());
......@@ -358,25 +415,31 @@ public class DeviceEntity extends DeviceVo {
this.deviceCode = "";
this.deviceType = 1;
this.siteCode = "";
this.deviceMac = "";
this.ip = "";
this.platformId = null;
this.centernum = "";
this.platformName = "";
this.port = "";
this.productId = null;
this.siteNum = "";
this.productName = "";
this.deviceFirmId = null;
this.deviceFirmname = "";
this.ip = "";
this.centernum = "";
this.port = "";
this.deviceOnlineStatus = 0;
this.status = 1;
this.status = 0;
this.active = 0;
......
......@@ -10,7 +10,7 @@ import com.mortals.xhx.module.device.model.vo.DeviceLogVo;
* 设备日志实体对象
*
* @author zxfei
* @date 2022-03-09
* @date 2022-04-25
*/
public class DeviceLogEntity extends DeviceLogVo {
......@@ -148,7 +148,7 @@ public class DeviceLogEntity extends DeviceLogVo {
this.deviceName = "";
this.logType = 0;
this.logType = null;
this.content = "";
}
......
......@@ -6,7 +6,7 @@ import com.mortals.xhx.module.device.model.DeviceLogEntity;
* 设备日志查询对象
*
* @author zxfei
* @date 2022-03-09
* @date 2022-04-25
*/
public class DeviceLogQuery extends DeviceLogEntity {
/** 开始 主键ID,主键,自增长 */
......@@ -54,12 +54,42 @@ public class DeviceLogQuery extends DeviceLogEntity {
/** 内容 */
private List<String> contentList;
/** 开始 创建用户 */
private Long createUserIdStart;
/** 结束 创建用户 */
private Long createUserIdEnd;
/** 增加 创建用户 */
private Long createUserIdIncrement;
/** 创建用户列表 */
private List <Long> createUserIdList;
/** 开始 创建时间 */
private String createTimeStart;
/** 结束 创建时间 */
private String createTimeEnd;
/** 开始 更新用户 */
private Long updateUserIdStart;
/** 结束 更新用户 */
private Long updateUserIdEnd;
/** 增加 更新用户 */
private Long updateUserIdIncrement;
/** 更新用户列表 */
private List <Long> updateUserIdList;
/** 开始 更新时间 */
private String updateTimeStart;
/** 结束 更新时间 */
private String updateTimeEnd;
/** OR条件集合,列表项之间是OR,项内容之间是AND,如:(list[0].1 and list[0].2) or (list[1].3 and list[1].4) */
private List<DeviceLogQuery> orConditionList;
......@@ -305,6 +335,70 @@ public class DeviceLogQuery extends DeviceLogEntity {
public void setContentList(List<String> contentList){
this.contentList = contentList;
}
/**
* 获取 开始 创建用户
* @return createUserIdStart
*/
public Long getCreateUserIdStart(){
return this.createUserIdStart;
}
/**
* 设置 开始 创建用户
* @param createUserIdStart
*/
public void setCreateUserIdStart(Long createUserIdStart){
this.createUserIdStart = createUserIdStart;
}
/**
* 获取 结束 创建用户
* @return $createUserIdEnd
*/
public Long getCreateUserIdEnd(){
return this.createUserIdEnd;
}
/**
* 设置 结束 创建用户
* @param createUserIdEnd
*/
public void setCreateUserIdEnd(Long createUserIdEnd){
this.createUserIdEnd = createUserIdEnd;
}
/**
* 获取 增加 创建用户
* @return createUserIdIncrement
*/
public Long getCreateUserIdIncrement(){
return this.createUserIdIncrement;
}
/**
* 设置 增加 创建用户
* @param createUserIdIncrement
*/
public void setCreateUserIdIncrement(Long createUserIdIncrement){
this.createUserIdIncrement = createUserIdIncrement;
}
/**
* 获取 创建用户
* @return createUserIdList
*/
public List<Long> getCreateUserIdList(){
return this.createUserIdList;
}
/**
* 设置 创建用户
* @param createUserIdList
*/
public void setCreateUserIdList(List<Long> createUserIdList){
this.createUserIdList = createUserIdList;
}
/**
* 获取 开始 创建时间
* @return createTimeStart
......@@ -337,6 +431,102 @@ public class DeviceLogQuery extends DeviceLogEntity {
this.createTimeEnd = createTimeEnd;
}
/**
* 获取 开始 更新用户
* @return updateUserIdStart
*/
public Long getUpdateUserIdStart(){
return this.updateUserIdStart;
}
/**
* 设置 开始 更新用户
* @param updateUserIdStart
*/
public void setUpdateUserIdStart(Long updateUserIdStart){
this.updateUserIdStart = updateUserIdStart;
}
/**
* 获取 结束 更新用户
* @return $updateUserIdEnd
*/
public Long getUpdateUserIdEnd(){
return this.updateUserIdEnd;
}
/**
* 设置 结束 更新用户
* @param updateUserIdEnd
*/
public void setUpdateUserIdEnd(Long updateUserIdEnd){
this.updateUserIdEnd = updateUserIdEnd;
}
/**
* 获取 增加 更新用户
* @return updateUserIdIncrement
*/
public Long getUpdateUserIdIncrement(){
return this.updateUserIdIncrement;
}
/**
* 设置 增加 更新用户
* @param updateUserIdIncrement
*/
public void setUpdateUserIdIncrement(Long updateUserIdIncrement){
this.updateUserIdIncrement = updateUserIdIncrement;
}
/**
* 获取 更新用户
* @return updateUserIdList
*/
public List<Long> getUpdateUserIdList(){
return this.updateUserIdList;
}
/**
* 设置 更新用户
* @param updateUserIdList
*/
public void setUpdateUserIdList(List<Long> updateUserIdList){
this.updateUserIdList = updateUserIdList;
}
/**
* 获取 开始 更新时间
* @return updateTimeStart
*/
public String getUpdateTimeStart(){
return this.updateTimeStart;
}
/**
* 设置 开始 更新时间
* @param updateTimeStart
*/
public void setUpdateTimeStart(String updateTimeStart){
this.updateTimeStart = updateTimeStart;
}
/**
* 获取 结束 更新时间
* @return updateTimeEnd
*/
public String getUpdateTimeEnd(){
return this.updateTimeEnd;
}
/**
* 设置 结束 更新时间
* @param updateTimeEnd
*/
public void setUpdateTimeEnd(String updateTimeEnd){
this.updateTimeEnd = updateTimeEnd;
}
/**
* 设置 主键ID,主键,自增长
* @param id
......@@ -529,6 +719,97 @@ public class DeviceLogQuery extends DeviceLogEntity {
return this;
}
/**
* 设置 创建用户
* @param createUserId
*/
public DeviceLogQuery createUserId(Long createUserId){
setCreateUserId(createUserId);
return this;
}
/**
* 设置 开始 创建用户
* @param createUserIdStart
*/
public DeviceLogQuery createUserIdStart(Long createUserIdStart){
this.createUserIdStart = createUserIdStart;
return this;
}
/**
* 设置 结束 创建用户
* @param createUserIdEnd
*/
public DeviceLogQuery createUserIdEnd(Long createUserIdEnd){
this.createUserIdEnd = createUserIdEnd;
return this;
}
/**
* 设置 增加 创建用户
* @param createUserIdIncrement
*/
public DeviceLogQuery createUserIdIncrement(Long createUserIdIncrement){
this.createUserIdIncrement = createUserIdIncrement;
return this;
}
/**
* 设置 创建用户
* @param createUserIdList
*/
public DeviceLogQuery createUserIdList(List<Long> createUserIdList){
this.createUserIdList = createUserIdList;
return this;
}
/**
* 设置 更新用户
* @param updateUserId
*/
public DeviceLogQuery updateUserId(Long updateUserId){
setUpdateUserId(updateUserId);
return this;
}
/**
* 设置 开始 更新用户
* @param updateUserIdStart
*/
public DeviceLogQuery updateUserIdStart(Long updateUserIdStart){
this.updateUserIdStart = updateUserIdStart;
return this;
}
/**
* 设置 结束 更新用户
* @param updateUserIdEnd
*/
public DeviceLogQuery updateUserIdEnd(Long updateUserIdEnd){
this.updateUserIdEnd = updateUserIdEnd;
return this;
}
/**
* 设置 增加 更新用户
* @param updateUserIdIncrement
*/
public DeviceLogQuery updateUserIdIncrement(Long updateUserIdIncrement){
this.updateUserIdIncrement = updateUserIdIncrement;
return this;
}
/**
* 设置 更新用户
* @param updateUserIdList
*/
public DeviceLogQuery updateUserIdList(List<Long> updateUserIdList){
this.updateUserIdList = updateUserIdList;
return this;
}
/**
* 获取 OR条件集合,列表项之间是OR,项内容之间是AND,如:(list[0].1 and list[0].2) or (list[1].3 and list[1].4)
......
......@@ -9,7 +9,7 @@ import java.util.List;
* 设备日志视图对象
*
* @author zxfei
* @date 2022-03-09
* @date 2022-04-25
*/
@Data
public class DeviceLogVo extends BaseEntityLong {
......
package com.mortals.xhx.module.device.model.vo;
import com.mortals.framework.model.BaseEntityLong;
import com.mortals.xhx.module.device.model.DeviceEntity;
import lombok.Data;
import java.util.ArrayList;
import java.util.List;
/**
* 设备视图对象
*
* @author zxfei
* @date 2022-03-09
*/
* 设备视图对象
*
* @author zxfei
* @date 2022-04-25
*/
@Data
public class DeviceVo extends BaseEntityLong {
/**
* 设备唯一标识
* 唯一标识
*/
private String token;
private String menuUrl;
/**
* 登录时间
*/
......
......@@ -16,6 +16,10 @@ import com.mortals.xhx.common.model.DefaultTbQueueMsgHeaders;
import com.mortals.xhx.common.model.MessageHeader;
import com.mortals.xhx.module.firm.model.FirmQuery;
import com.mortals.xhx.module.firm.service.FirmService;
import com.mortals.xhx.module.platform.model.PlatformQuery;
import com.mortals.xhx.module.platform.service.PlatformService;
import com.mortals.xhx.module.product.model.ProductQuery;
import com.mortals.xhx.module.product.service.ProductService;
import com.mortals.xhx.queue.TbQueueMsgHeaders;
import com.mortals.xhx.queue.TopicPartitionInfo;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -58,6 +62,10 @@ public class DeviceController extends BaseCRUDJsonMappingController<DeviceServic
private ParamService paramService;
@Autowired
private FirmService firmService;
@Autowired
private ProductService productService;
@Autowired
private PlatformService platformService;
public DeviceController() {
super.setFormClass(DeviceForm.class);
......@@ -83,15 +91,20 @@ public class DeviceController extends BaseCRUDJsonMappingController<DeviceServic
this.addDict(model, "status", paramService.getParamBySecondOrganize("Device", "status"));
this.addDict(model, "active", paramService.getParamBySecondOrganize("Device", "active"));
this.addDict(model, "deviceFirmId", firmService.find(new FirmQuery()).stream().collect(Collectors.toMap(x -> x.getId().toString(), y -> y.getFirmName())));
this.addDict(model, "platformId", platformService.find(new PlatformQuery()).stream().collect(Collectors.toMap(x -> x.getId().toString(), y -> y.getPlatformName())));
this.addDict(model, "productId", productService.find(new ProductQuery()).stream().collect(Collectors.toMap(x -> x.getId().toString(), y -> y.getProductName())));
Map<Boolean, Long> collect = this.service.find(new DeviceQuery().active(ActiveEnum.已激活.getValue())).stream().collect(Collectors.partitioningBy(item -> (item.getDeviceOnlineStatus() == DeviceOnlineStatusEnum.在线.getValue()), Collectors.counting()));
model.put("onlineCount", collect.get(true));
model.put("offlineCount", collect.get(false));
//离线设备 按类型分组
if (collect.get(false) > 0) {
Map<String, Long> collectTwo = this.service.find(new DeviceQuery().deviceOnlineStatus(DeviceOnlineStatusEnum.离线.getValue()).active(ActiveEnum.已激活.getValue())).stream().collect(Collectors.groupingBy(x -> deviceTypeMap.get(x.getDeviceType().toString()), Collectors.counting()));
model.put("offlineDeviceType", collectTwo);
}
// if (collect.get(false) > 0) {
// Map<String, Long> collectTwo = this.service.find(new DeviceQuery().deviceOnlineStatus(DeviceOnlineStatusEnum.离线.getValue()).active(ActiveEnum.已激活.getValue())).stream().collect(Collectors.groupingBy(x -> deviceTypeMap.get(x.getDeviceType().toString()), Collectors.counting()));
// model.put("offlineDeviceType", collectTwo);
// }
super.init(request, response, form, model, context);
}
......
package com.mortals.xhx.module.platform.dao;
import com.mortals.framework.dao.ICRUDDao;
import com.mortals.xhx.module.platform.model.PlatformEntity;
import java.util.List;
/**
* 平台系统Dao
* 平台系统 DAO接口
*
* @author zxfei
* @date 2022-04-25
*/
public interface PlatformDao extends ICRUDDao<PlatformEntity,Long>{
}
package com.mortals.xhx.module.platform.dao.ibatis;
import org.springframework.stereotype.Repository;
import com.mortals.xhx.module.platform.dao.PlatformDao;
import com.mortals.xhx.module.platform.model.PlatformEntity;
import java.util.Date;
import com.mortals.framework.dao.ibatis.BaseCRUDDaoMybatis;
import java.util.List;
/**
* 平台系统DaoImpl DAO接口
*
* @author zxfei
* @date 2022-04-25
*/
@Repository("platformDao")
public class PlatformDaoImpl extends BaseCRUDDaoMybatis<PlatformEntity,Long> implements PlatformDao {
}
package com.mortals.xhx.module.platform.model;
import java.util.List;
import java.util.ArrayList;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.mortals.framework.annotation.Excel;
import com.mortals.framework.model.BaseEntityLong;
import com.mortals.xhx.module.platform.model.vo.PlatformVo;
/**
* 平台系统实体对象
*
* @author zxfei
* @date 2022-04-25
*/
public class PlatformEntity extends PlatformVo {
private static final long serialVersionUID = 1L;
/**
* 平台名称,名称唯一
*/
@Excel(name = "平台名称,名称唯一")
private String platformName;
/**
* 平台编码,编码唯一(编码加上站点编码,如phxt-51010251-1做Vhost虚拟机编码)
*/
private String platformSn;
/**
* 发送第三方平台消息类型(0.http,1.jms)
*/
private Integer sendMsgType;
/**
* 发送参数配置,如发送消息地址等,xml结构,根据消息类型变化
*/
private String sendConfig;
/**
* 是否启用发送消息(0.停用,1.启用)
*/
private Integer sendSwitch;
/**
* 备注
*/
private String platformRemark;
public PlatformEntity(){}
/**
* 获取 平台名称,名称唯一
* @return String
*/
public String getPlatformName(){
return platformName;
}
/**
* 设置 平台名称,名称唯一
* @param platformName
*/
public void setPlatformName(String platformName){
this.platformName = platformName;
}
/**
* 获取 平台编码,编码唯一(编码加上站点编码,如phxt-51010251-1做Vhost虚拟机编码)
* @return String
*/
public String getPlatformSn(){
return platformSn;
}
/**
* 设置 平台编码,编码唯一(编码加上站点编码,如phxt-51010251-1做Vhost虚拟机编码)
* @param platformSn
*/
public void setPlatformSn(String platformSn){
this.platformSn = platformSn;
}
/**
* 获取 发送第三方平台消息类型(0.http,1.jms)
* @return Integer
*/
public Integer getSendMsgType(){
return sendMsgType;
}
/**
* 设置 发送第三方平台消息类型(0.http,1.jms)
* @param sendMsgType
*/
public void setSendMsgType(Integer sendMsgType){
this.sendMsgType = sendMsgType;
}
/**
* 获取 发送参数配置,如发送消息地址等,xml结构,根据消息类型变化
* @return String
*/
public String getSendConfig(){
return sendConfig;
}
/**
* 设置 发送参数配置,如发送消息地址等,xml结构,根据消息类型变化
* @param sendConfig
*/
public void setSendConfig(String sendConfig){
this.sendConfig = sendConfig;
}
/**
* 获取 是否启用发送消息(0.停用,1.启用)
* @return Integer
*/
public Integer getSendSwitch(){
return sendSwitch;
}
/**
* 设置 是否启用发送消息(0.停用,1.启用)
* @param sendSwitch
*/
public void setSendSwitch(Integer sendSwitch){
this.sendSwitch = sendSwitch;
}
/**
* 获取 备注
* @return String
*/
public String getPlatformRemark(){
return platformRemark;
}
/**
* 设置 备注
* @param platformRemark
*/
public void setPlatformRemark(String platformRemark){
this.platformRemark = platformRemark;
}
@Override
public int hashCode() {
return this.getId().hashCode();
}
@Override
public boolean equals(Object obj) {
if (obj == null) return false;
if (obj instanceof PlatformEntity) {
PlatformEntity tmp = (PlatformEntity) obj;
if (this.getId() == tmp.getId()) {
return true;
}
}
return false;
}
public String toString(){
StringBuilder sb = new StringBuilder("");
sb.append(",platformName:").append(getPlatformName());
sb.append(",platformSn:").append(getPlatformSn());
sb.append(",sendMsgType:").append(getSendMsgType());
sb.append(",sendConfig:").append(getSendConfig());
sb.append(",sendSwitch:").append(getSendSwitch());
sb.append(",platformRemark:").append(getPlatformRemark());
return sb.toString();
}
public void initAttrValue(){
this.platformName = "";
this.platformSn = "";
this.sendMsgType = 0;
this.sendConfig = "";
this.sendSwitch = 0;
this.platformRemark = "";
}
}
\ No newline at end of file
package com.mortals.xhx.module.platform.model.vo;
import com.mortals.framework.model.BaseEntityLong;
import com.mortals.xhx.module.platform.model.PlatformEntity;
import lombok.Data;
import java.util.ArrayList;
import java.util.List;
/**
* 平台系统视图对象
*
* @author zxfei
* @date 2022-04-25
*/
@Data
public class PlatformVo extends BaseEntityLong {
}
\ No newline at end of file
package com.mortals.xhx.module.platform.service;
import com.mortals.framework.service.ICRUDService;
import com.mortals.xhx.module.platform.model.PlatformEntity;
/**
* PlatformService
*
* 平台系统 service接口
*
* @author zxfei
* @date 2022-04-25
*/
public interface PlatformService extends ICRUDService<PlatformEntity,Long>{
}
\ No newline at end of file
package com.mortals.xhx.module.platform.service.impl;
import org.springframework.stereotype.Service;
import com.mortals.framework.service.impl.AbstractCRUDServiceImpl;
import com.mortals.xhx.module.platform.dao.PlatformDao;
import com.mortals.xhx.module.platform.model.PlatformEntity;
import com.mortals.xhx.module.platform.service.PlatformService;
/**
* PlatformService
* 平台系统 service实现
*
* @author zxfei
* @date 2022-04-25
*/
@Service("platformService")
public class PlatformServiceImpl extends AbstractCRUDServiceImpl<PlatformDao, PlatformEntity, Long> implements PlatformService {
}
\ No newline at end of file
package com.mortals.xhx.module.platform.web;
import com.mortals.xhx.base.system.param.service.ParamService;
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.BaseCRUDJsonMappingController;
import com.mortals.xhx.module.platform.model.PlatformEntity;
import com.mortals.xhx.module.platform.model.PlatformQuery;
import com.mortals.xhx.module.platform.service.PlatformService;
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-04-25
*/
@RestController
@RequestMapping("platform")
public class PlatformController extends BaseCRUDJsonMappingController<PlatformService,PlatformForm,PlatformEntity,Long> {
@Autowired
private ParamService paramService;
public PlatformController(){
super.setFormClass(PlatformForm.class);
super.setModuleDesc( "平台系统");
}
@Override
protected void init(HttpServletRequest request, HttpServletResponse response, PlatformForm form, Map<String, Object> model, Context context) {
this.addDict(model, "sendMsgType", paramService.getParamBySecondOrganize("Platform","sendMsgType"));
this.addDict(model, "sendSwitch", paramService.getParamBySecondOrganize("Platform","sendSwitch"));
super.init(request, response, form, model, context);
}
}
\ No newline at end of file
package com.mortals.xhx.module.platform.web;
import com.mortals.framework.web.BaseCRUDFormLong;
import com.mortals.xhx.module.platform.model.PlatformEntity;
import com.mortals.xhx.module.platform.model.PlatformQuery;
/**
* Platform
*
* 平台系统 Form
*
* @author zxfei
* @date 2022-04-25
*/
public class PlatformForm extends BaseCRUDFormLong<PlatformEntity> {
private PlatformEntity entity = new PlatformEntity();
private PlatformQuery query = new PlatformQuery();
public PlatformForm(){
}
@Override
public PlatformEntity getEntity() {
return entity;
}
public void setPlatform(PlatformEntity entity) {
this.entity = entity;
}
@Override
public PlatformQuery getQuery() {
return query;
}
public void setQuery(PlatformQuery query) {
this.query = query;
}
}
\ No newline at end of file
package com.mortals.xhx.module.product.dao;
import com.mortals.framework.dao.ICRUDDao;
import com.mortals.xhx.module.product.model.ProductEntity;
import java.util.List;
/**
* 产品Dao
* 产品 DAO接口
*
* @author zxfei
* @date 2022-04-25
*/
public interface ProductDao extends ICRUDDao<ProductEntity,Long>{
}
package com.mortals.xhx.module.product.dao.ibatis;
import org.springframework.stereotype.Repository;
import com.mortals.xhx.module.product.dao.ProductDao;
import com.mortals.xhx.module.product.model.ProductEntity;
import java.util.Date;
import com.mortals.framework.dao.ibatis.BaseCRUDDaoMybatis;
import java.util.List;
/**
* 产品DaoImpl DAO接口
*
* @author zxfei
* @date 2022-04-25
*/
@Repository("productDao")
public class ProductDaoImpl extends BaseCRUDDaoMybatis<ProductEntity,Long> implements ProductDao {
}
package com.mortals.xhx.module.product.model;
import java.util.List;
import java.util.ArrayList;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.mortals.framework.annotation.Excel;
import com.mortals.framework.model.BaseEntityLong;
import com.mortals.xhx.module.product.model.vo.ProductVo;
/**
* 产品实体对象
*
* @author zxfei
* @date 2022-04-25
*/
public class ProductEntity extends ProductVo {
private static final long serialVersionUID = 1L;
/**
* 产品名称,名称唯一
*/
@Excel(name = "产品名称,名称唯一")
private String productName;
/**
* 产品编码,编码唯一
*/
private String productCode;
/**
* 交换机名称,英文必填,默认产品编码
*/
private String exchangeName;
/**
* 备注
*/
private String productRemark;
public ProductEntity(){}
/**
* 获取 产品名称,名称唯一
* @return String
*/
public String getProductName(){
return productName;
}
/**
* 设置 产品名称,名称唯一
* @param productName
*/
public void setProductName(String productName){
this.productName = productName;
}
/**
* 获取 产品编码,编码唯一
* @return String
*/
public String getProductCode(){
return productCode;
}
/**
* 设置 产品编码,编码唯一
* @param productCode
*/
public void setProductCode(String productCode){
this.productCode = productCode;
}
/**
* 获取 交换机名称,英文必填,默认产品编码
* @return String
*/
public String getExchangeName(){
return exchangeName;
}
/**
* 设置 交换机名称,英文必填,默认产品编码
* @param exchangeName
*/
public void setExchangeName(String exchangeName){
this.exchangeName = exchangeName;
}
/**
* 获取 备注
* @return String
*/
public String getProductRemark(){
return productRemark;
}
/**
* 设置 备注
* @param productRemark
*/
public void setProductRemark(String productRemark){
this.productRemark = productRemark;
}
@Override
public int hashCode() {
return this.getId().hashCode();
}
@Override
public boolean equals(Object obj) {
if (obj == null) return false;
if (obj instanceof ProductEntity) {
ProductEntity tmp = (ProductEntity) obj;
if (this.getId() == tmp.getId()) {
return true;
}
}
return false;
}
public String toString(){
StringBuilder sb = new StringBuilder("");
sb.append(",productName:").append(getProductName());
sb.append(",productCode:").append(getProductCode());
sb.append(",exchangeName:").append(getExchangeName());
sb.append(",productRemark:").append(getProductRemark());
return sb.toString();
}
public void initAttrValue(){
this.productName = "";
this.productCode = "";
this.exchangeName = "";
this.productRemark = "";
}
}
\ No newline at end of file
package com.mortals.xhx.module.product.model.vo;
import com.mortals.framework.model.BaseEntityLong;
import com.mortals.xhx.module.product.model.ProductEntity;
import lombok.Data;
import java.util.ArrayList;
import java.util.List;
/**
* 产品视图对象
*
* @author zxfei
* @date 2022-04-25
*/
@Data
public class ProductVo extends BaseEntityLong {
}
\ No newline at end of file
package com.mortals.xhx.module.product.service;
import com.mortals.framework.service.ICRUDService;
import com.mortals.xhx.module.product.model.ProductEntity;
/**
* ProductService
*
* 产品 service接口
*
* @author zxfei
* @date 2022-04-25
*/
public interface ProductService extends ICRUDService<ProductEntity,Long>{
}
\ No newline at end of file
package com.mortals.xhx.module.product.service.impl;
import org.springframework.stereotype.Service;
import com.mortals.framework.service.impl.AbstractCRUDServiceImpl;
import com.mortals.xhx.module.product.dao.ProductDao;
import com.mortals.xhx.module.product.model.ProductEntity;
import com.mortals.xhx.module.product.service.ProductService;
/**
* ProductService
* 产品 service实现
*
* @author zxfei
* @date 2022-04-25
*/
@Service("productService")
public class ProductServiceImpl extends AbstractCRUDServiceImpl<ProductDao, ProductEntity, Long> implements ProductService {
}
\ No newline at end of file
package com.mortals.xhx.module.product.web;
import com.mortals.xhx.base.system.param.service.ParamService;
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.BaseCRUDJsonMappingController;
import com.mortals.xhx.module.product.model.ProductEntity;
import com.mortals.xhx.module.product.model.ProductQuery;
import com.mortals.xhx.module.product.service.ProductService;
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-04-25
*/
@RestController
@RequestMapping("product")
public class ProductController extends BaseCRUDJsonMappingController<ProductService,ProductForm,ProductEntity,Long> {
@Autowired
private ParamService paramService;
public ProductController(){
super.setFormClass(ProductForm.class);
super.setModuleDesc( "产品");
}
@Override
protected void init(HttpServletRequest request, HttpServletResponse response, ProductForm form, Map<String, Object> model, Context context) {
super.init(request, response, form, model, context);
}
}
\ No newline at end of file
package com.mortals.xhx.module.product.web;
import com.mortals.framework.web.BaseCRUDFormLong;
import com.mortals.xhx.module.product.model.ProductEntity;
import com.mortals.xhx.module.product.model.ProductQuery;
/**
* Product
*
* 产品 Form
*
* @author zxfei
* @date 2022-04-25
*/
public class ProductForm extends BaseCRUDFormLong<ProductEntity> {
private ProductEntity entity = new ProductEntity();
private ProductQuery query = new ProductQuery();
public ProductForm(){
}
@Override
public ProductEntity getEntity() {
return entity;
}
public void setProduct(ProductEntity entity) {
this.entity = entity;
}
@Override
public ProductQuery getQuery() {
return query;
}
public void setQuery(ProductQuery query) {
this.query = query;
}
}
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"mybatis-3-mapper.dtd">
"mybatis-3-mapper.dtd">
<mapper namespace="com.mortals.xhx.module.firm.dao.ibatis.FirmDaoImpl">
<!-- 字段和属性映射 -->
......
......@@ -54,7 +54,7 @@ POST {{baseUrl}}/api/active
Content-Type: application/json
{
"deviceNum":"a12345678",
"deviceNum":"b12345678",
"deviceMac":"AB:DD:DF:FD:AD:FA:DA:SS",
"action":"active"
}
......
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