Commit ed536606 authored by 赵啸非's avatar 赵啸非

更改上传文件大小限制

parent ac6d2318
...@@ -2,10 +2,9 @@ package com.mortals.xhx.queue; ...@@ -2,10 +2,9 @@ package com.mortals.xhx.queue;
import lombok.Data; import lombok.Data;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
@Data @Data
@Component //@Component
public class TbQueueCoreSettings { public class TbQueueCoreSettings {
@Value("${queue.core.topic}") @Value("${queue.core.topic}")
......
...@@ -7,7 +7,6 @@ import lombok.Getter; ...@@ -7,7 +7,6 @@ import lombok.Getter;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.autoconfigure.condition.ConditionalOnExpression; import org.springframework.boot.autoconfigure.condition.ConditionalOnExpression;
import org.springframework.stereotype.Component;
import javax.annotation.PostConstruct; import javax.annotation.PostConstruct;
...@@ -20,7 +19,7 @@ public class TbRabbitMqSettings { ...@@ -20,7 +19,7 @@ public class TbRabbitMqSettings {
private String exchangeName; private String exchangeName;
@Value("${queue.rabbitmq.host:}") @Value("${queue.rabbitmq.host:}")
private String host; private String host;
@Value("${queue.rabbitmq.port:}") @Value("${queue.rabbitmq.port:0}")
private int port; private int port;
@Value("${queue.rabbitmq.virtual_host:}") @Value("${queue.rabbitmq.virtual_host:}")
private String virtualHost; private String virtualHost;
......
/* DROP database if exists `device-platform`;
Navicat MySQL Data Transfer CREATE database `device-platform` default charset=utf8;
use `device-platform`;
Source Server : localhost
Source Server Type : MySQL
Source Server Version : 80018
Source Host : localhost:3306
Source Schema : base-platform
Target Server Type : MySQL
Target Server Version : 80018
File Encoding : 65001
Date: 05/11/2021 09:39:57
*/
SET NAMES utf8mb4; SET NAMES utf8mb4;
SET FOREIGN_KEY_CHECKS = 0; SET FOREIGN_KEY_CHECKS = 0;
......
use `device-platform`;
-- ---------------------------- -- ----------------------------
-- 设备生产厂商菜单 SQL -- 设备生产厂商菜单 SQL
-- ---------------------------- -- ----------------------------
......
use
`device-platform`;
-- ---------------------------- -- ----------------------------
-- 设备表 -- 设备表
-- ---------------------------- -- ----------------------------
DROP TABLE IF EXISTS `mortals_xhx_device`; DROP TABLE IF EXISTS `mortals_xhx_device`;
CREATE TABLE mortals_xhx_device( CREATE TABLE `mortals_xhx_device`
`id` bigint(20) AUTO_INCREMENT COMMENT '主键ID,主键,自增长', (
`deviceName` varchar(20) NOT NULL COMMENT '设备名称', `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键ID,主键,自增长',
`deviceCode` varchar(256) COMMENT '设备编码,SN码等,默认为MAC地址', `deviceName` varchar(20) NOT NULL COMMENT '设备名称',
`deviceSN` varchar(256) COMMENT '设备SN码', `deviceCode` varchar(256) DEFAULT NULL COMMENT '设备编码',
`deviceMac` varchar(64) COMMENT '设备的MAC地址', `deviceSN` varchar(512) DEFAULT NULL COMMENT '设备SN码',
`siteId` bigint(20) COMMENT '站点Id,来源基础服务平台', `deviceMac` varchar(64) DEFAULT NULL COMMENT '设备的MAC地址',
`siteCode` varchar(256) COMMENT '站点编号,来源基础服务平台', `siteId` bigint(20) DEFAULT NULL COMMENT '站点Id,来源基础服务平台',
`siteName` varchar(256) COMMENT '站点名称', `siteCode` varchar(256) DEFAULT NULL COMMENT '站点编号,来源基础服务平台',
`platformId` bigint(20) COMMENT '平台系统Id', `siteName` varchar(256) DEFAULT NULL COMMENT '站点名称',
`platformName` varchar(256) COMMENT '平台系统名称', `platformId` bigint(20) DEFAULT NULL COMMENT '平台系统Id',
`productId` bigint(20) COMMENT '产品Id', `platformName` varchar(256) DEFAULT NULL COMMENT '平台系统名称',
`productName` varchar(256) COMMENT '产品名称', `productId` bigint(20) DEFAULT NULL COMMENT '产品Id',
`skinId` bigint(20) NOT NULL COMMENT '皮肤id', `productName` varchar(256) DEFAULT NULL COMMENT '产品名称',
`skinName` varchar(20) NOT NULL COMMENT '皮肤名称', `skinId` bigint(20) DEFAULT NULL COMMENT '皮肤id',
`homeUrl` varchar(512) COMMENT '首页地址', `skinName` varchar(512) DEFAULT NULL COMMENT '皮肤名称',
`deviceFirmId` bigint(20) COMMENT '设备生产厂商ID', `homeUrl` varchar(512) DEFAULT NULL COMMENT '首页地址',
`deviceFirmname` varchar(20) COMMENT '设备生产厂商名称', `deviceFirmId` bigint(20) DEFAULT NULL COMMENT '设备生产厂商ID',
`deviceSrc` tinyint(2) COMMENT '设备来源(0.子设备,1.网关设备,2.直连设备)', `deviceFirmname` varchar(20) DEFAULT NULL COMMENT '设备生产厂商名称',
`deviceDataSourceWay` tinyint(2) COMMENT '数据获取方式(0.主动上报,1.被动拉取)', `deviceSrc` tinyint(2) DEFAULT NULL COMMENT '设备来源(0.子设备,1.网关设备,2.直连设备)',
`lon` varchar(32) COMMENT '经度', `deviceDataSourceWay` tinyint(2) DEFAULT NULL COMMENT '数据获取方式(0.主动上报,1被动拉取)',
`lati` varchar(32) COMMENT '经度', `lon` varchar(32) DEFAULT NULL COMMENT '经度',
`deviceInBuilding` tinyint(2) COMMENT '所属楼栋', `lati` varchar(32) DEFAULT NULL COMMENT '经度',
`deviceInFloor` tinyint(2) COMMENT '所属楼层', `deviceInBuilding` tinyint(2) DEFAULT NULL COMMENT '所属楼栋',
`defectsLiabilityPeriod` datetime COMMENT '保修期至', `deviceInFloor` tinyint(2) DEFAULT NULL COMMENT '所属楼层',
`leadingOfficial` varchar(64) COMMENT '负责人', `defectsLiabilityPeriod` datetime DEFAULT NULL COMMENT '保修期至',
`leadingOfficialTelephone` varchar(64) COMMENT '联系电话', `leadingOfficial` varchar(10) DEFAULT NULL COMMENT '负责人',
`isReceiveMess` tinyint(2) COMMENT '是否接收异常短(0.否,1.是)', `leadingOfficialTelephone` varchar(11) DEFAULT NULL COMMENT '联系电话',
`devicePhotoPath` varchar(256) COMMENT '设备图片', `isReceiveMess` tinyint(2) DEFAULT NULL COMMENT '是否接收异常短(0.否,1.是)',
`ip` varchar(64) COMMENT '设备访问ip', `ip` varchar(64) DEFAULT NULL COMMENT '设备访问ip',
`centernum` varchar(64) COMMENT '中心设备编码', `centernum` varchar(64) DEFAULT NULL COMMENT '中心设备编码',
`port` varchar(64) COMMENT '端口', `port` varchar(64) DEFAULT NULL COMMENT '端口',
`deviceTopic` varchar(100) COMMENT '设备topic信息', `deviceTopic` varchar(100) DEFAULT NULL COMMENT '设备topic信息',
`deviceStatus` tinyint(2) COMMENT '设备状态 (0.未激活,1.离线,2.在线)', `deviceStatus` tinyint(2) DEFAULT NULL COMMENT '设备状态 (0.未激活,1.离线,2.在线)',
`enabled` tinyint(2) COMMENT '启用状态 (0.停止,1.启用)', `enabled` tinyint(2) DEFAULT NULL COMMENT '启用状态 (0.停止,1.启用)',
`deviceAuthCode` varchar(512) COMMENT '设备授权码', `deviceAuthCode` varchar(255) DEFAULT NULL,
`deviceRemark` varchar(256) COMMENT '备注', `deviceRemark` varchar(256) DEFAULT NULL COMMENT '备注',
`onlineTime` datetime COMMENT '最近上线时间', `onlineTime` datetime DEFAULT NULL COMMENT '最近上线时间',
`offlineTime` datetime COMMENT '最近离线时间', `offlineTime` datetime DEFAULT NULL COMMENT '最近离线时间',
`deleted` tinyint(2) COMMENT '是否删除(0.否,1.是)', `devicePhotoPath` varchar(255) DEFAULT NULL,
`deviceVersion` varchar(64) COMMENT '设备版本', `deleted` tinyint(2) DEFAULT NULL COMMENT '是否删除,(0.否,1.是)',
`source` tinyint(2) COMMENT '设备来源(0.旧设备,1.新设备)', `deviceVersion` varchar(64) DEFAULT NULL COMMENT '设备版本',
`createUserId` bigint(20) NOT NULL COMMENT '创建用户', `source` tinyint(2) DEFAULT NULL,
`createTime` datetime NOT NULL COMMENT '创建时间', `createUserId` bigint(20) NOT NULL COMMENT '创建用户',
`updateUserId` bigint(20) COMMENT '更新用户', `createTime` datetime NOT NULL COMMENT '创建时间',
`updateTime` datetime COMMENT '更新时间', `updateUserId` bigint(20) DEFAULT NULL COMMENT '更新用户',
PRIMARY KEY (`id`) `updateTime` datetime DEFAULT NULL COMMENT '更新时间',
PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='设备'; ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='设备';
-- ---------------------------- -- ----------------------------
-- 平台系统表 -- 平台系统表
-- ---------------------------- -- ----------------------------
DROP TABLE IF EXISTS `mortals_xhx_platform`; DROP TABLE IF EXISTS `mortals_xhx_platform`;
CREATE TABLE mortals_xhx_platform( CREATE TABLE mortals_xhx_platform
`id` bigint(20) AUTO_INCREMENT COMMENT '主键ID,主键,自增长', (
`platformName` varchar(20) NOT NULL COMMENT '平台名称,名称唯一', `id` bigint(20) AUTO_INCREMENT COMMENT '主键ID,主键,自增长',
`platformSn` varchar(256) NOT NULL COMMENT '平台编码,编码唯一(编码加上站点编码,如phxt-51010251-1做Vhost虚拟机编码)', `platformName` varchar(20) NOT NULL COMMENT '平台名称,名称唯一',
`sendMsgType` tinyint(2) NOT NULL COMMENT '发送第三方平台消息类型(0.http,1.jms)', `platformSn` varchar(256) NOT NULL COMMENT '平台编码,编码唯一(编码加上站点编码,如phxt-51010251-1做Vhost虚拟机编码)',
`sendUrl` varchar(512) COMMENT '发送参数请求地址', `sendMsgType` tinyint(2) NOT NULL COMMENT '发送第三方平台消息类型(0.http,1.jms)',
`callbackUrl` varchar(512) COMMENT '回调参数地址', `sendUrl` varchar(512) COMMENT '发送参数请求地址',
`sendSwitch` tinyint(2) NOT NULL COMMENT '是否启用发送消息(0.停用,1.启用)', `callbackUrl` varchar(512) COMMENT '回调参数地址',
`homeUrl` varchar(512) COMMENT '首页地址', `sendSwitch` tinyint(2) NOT NULL COMMENT '是否启用发送消息(0.停用,1.启用)',
`platformRemark` varchar(256) COMMENT '备注', `homeUrl` varchar(512) COMMENT '首页地址',
`createUserId` bigint(20) NOT NULL COMMENT '创建用户', `platformRemark` varchar(256) COMMENT '备注',
`createTime` datetime NOT NULL COMMENT '创建时间', `createUserId` bigint(20) NOT NULL COMMENT '创建用户',
`updateUserId` bigint(20) COMMENT '更新用户', `createTime` datetime NOT NULL COMMENT '创建时间',
`updateTime` datetime COMMENT '更新时间', `updateUserId` bigint(20) COMMENT '更新用户',
PRIMARY KEY (`id`) `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`; DROP TABLE IF EXISTS `mortals_xhx_product`;
CREATE TABLE mortals_xhx_product( CREATE TABLE `mortals_xhx_product`
`id` bigint(20) AUTO_INCREMENT COMMENT '主键ID,主键,自增长', (
`platformId` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '关联平台', `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键ID,主键,自增长',
`productName` varchar(20) NOT NULL COMMENT '产品名称,名称唯一', `platformId` bigint(20) DEFAULT NULL,
`productCode` varchar(256) NOT NULL COMMENT '产品编码', `productName` varchar(20) NOT NULL COMMENT '产品名称,名称唯一',
`homeUrl` varchar(512) NOT NULL COMMENT '首页地址', `productCode` varchar(256) NOT NULL COMMENT '产品编码,编码唯一',
`productRemark` varchar(256) COMMENT '备注', `skinId` bigint(20) DEFAULT NULL COMMENT '皮肤id',
`createUserId` bigint(20) NOT NULL COMMENT '创建用户', `skinName` varchar(512) DEFAULT NULL COMMENT '皮肤名称',
`createTime` datetime NOT NULL COMMENT '创建时间', `homeUrl` varchar(255) DEFAULT NULL COMMENT '首页',
`updateUserId` bigint(20) COMMENT '更新用户', `productRemark` varchar(256) DEFAULT NULL COMMENT '备注',
`updateTime` datetime COMMENT '更新时间', `createUserId` bigint(20) NOT NULL COMMENT '创建用户',
PRIMARY KEY (`id`) `createTime` datetime NOT NULL COMMENT '创建时间',
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='产品'; `updateUserId` bigint(20) DEFAULT NULL COMMENT '更新用户',
`updateTime` datetime DEFAULT NULL COMMENT '更新时间',
PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=16 DEFAULT CHARSET=utf8 COMMENT='产品';
...@@ -102,37 +106,39 @@ PRIMARY KEY (`id`) ...@@ -102,37 +106,39 @@ PRIMARY KEY (`id`)
-- 设备生产厂商表 -- 设备生产厂商表
-- ---------------------------- -- ----------------------------
DROP TABLE IF EXISTS `mortals_xhx_firm`; DROP TABLE IF EXISTS `mortals_xhx_firm`;
CREATE TABLE mortals_xhx_firm( CREATE TABLE mortals_xhx_firm
`id` bigint(20) AUTO_INCREMENT COMMENT '主键ID,主键,自增长', (
`firmName` varchar(128) NOT NULL COMMENT '设备生产厂商名称', `id` bigint(20) AUTO_INCREMENT COMMENT '主键ID,主键,自增长',
`firmCode` varchar(128) COMMENT '设备生产商编码', `firmName` varchar(128) NOT NULL COMMENT '设备生产厂商名称',
`firmRemark` varchar(64) COMMENT '备注', `firmCode` varchar(128) COMMENT '设备生产商编码',
`createUserId` bigint(20) NOT NULL COMMENT '创建用户', `firmRemark` varchar(64) COMMENT '备注',
`createTime` datetime NOT NULL COMMENT '创建时间', `createUserId` bigint(20) NOT NULL COMMENT '创建用户',
`updateUserId` bigint(20) COMMENT '更新用户', `createTime` datetime NOT NULL COMMENT '创建时间',
`updateTime` datetime COMMENT '更新时间', `updateUserId` bigint(20) COMMENT '更新用户',
PRIMARY KEY (`id`) `updateTime` datetime COMMENT '更新时间',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='设备生产厂商'; ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='设备生产厂商';
-- ---------------------------- -- ----------------------------
-- 设备告警日志表 -- 设备告警日志表
-- ---------------------------- -- ----------------------------
DROP TABLE IF EXISTS `mortals_xhx_device_alarm_info`; DROP TABLE IF EXISTS `mortals_xhx_device_alarm_info`;
CREATE TABLE mortals_xhx_device_alarm_info( CREATE TABLE mortals_xhx_device_alarm_info
`id` bigint(20) AUTO_INCREMENT COMMENT '主键ID,主键,自增长', (
`alarmTime` datetime NOT NULL COMMENT '告警时间', `id` bigint(20) AUTO_INCREMENT COMMENT '主键ID,主键,自增长',
`alarmDevice` bigint(20) NOT NULL COMMENT '告警设备Id', `alarmTime` datetime NOT NULL COMMENT '告警时间',
`siteId` bigint(20) COMMENT '站点Id,来源基础服务平台', `alarmDevice` bigint(20) NOT NULL COMMENT '告警设备Id',
`alarmType` tinyint(2) NOT NULL COMMENT '告警类型,(0.离线)', `siteId` bigint(20) COMMENT '站点Id,来源基础服务平台',
`alarmLevel` tinyint(2) NOT NULL COMMENT '告警级别(0.危险,1.次要,2.一般)', `alarmType` tinyint(2) NOT NULL COMMENT '告警类型,(0.离线)',
`alarmReceivePersonnel` varchar(32) NOT NULL COMMENT '接收人员[设备管理的责任人]', `alarmLevel` tinyint(2) NOT NULL COMMENT '告警级别(0.危险,1.次要,2.一般)',
`receivePersonnelTelephone` varchar(11) NOT NULL COMMENT '接收人员电话', `alarmReceivePersonnel` varchar(32) NOT NULL COMMENT '接收人员[设备管理的责任人]',
`alarmStatus` tinyint(2) COMMENT '告警状态,来自工单系统(0.未清除,1.清除未确认,2.清除已确认)', `receivePersonnelTelephone` varchar(11) NOT NULL COMMENT '接收人员电话',
`alarmContent` varchar(512) NOT NULL COMMENT '告警详细内容', `alarmStatus` tinyint(2) COMMENT '告警状态,来自工单系统(0.未清除,1.清除未确认,2.清除已确认)',
`createTime` datetime NOT NULL COMMENT '创建时间', `alarmContent` varchar(512) NOT NULL COMMENT '告警详细内容',
`updateUserId` bigint(20) COMMENT '更新用户', `createTime` datetime NOT NULL COMMENT '创建时间',
`updateTime` datetime COMMENT '更新时间', `updateUserId` bigint(20) COMMENT '更新用户',
PRIMARY KEY (`id`) `updateTime` datetime COMMENT '更新时间',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='设备告警日志'; ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='设备告警日志';
...@@ -141,30 +147,32 @@ PRIMARY KEY (`id`) ...@@ -141,30 +147,32 @@ PRIMARY KEY (`id`)
-- 设备模块信息表 -- 设备模块信息表
-- ---------------------------- -- ----------------------------
DROP TABLE IF EXISTS `mortals_xhx_device_module`; DROP TABLE IF EXISTS `mortals_xhx_device_module`;
CREATE TABLE mortals_xhx_device_module( CREATE TABLE mortals_xhx_device_module
`id` bigint(20) AUTO_INCREMENT COMMENT '主键ID,主键,自增长', (
`moduleName` varchar(256) NOT NULL COMMENT '模块名称', `id` bigint(20) AUTO_INCREMENT COMMENT '主键ID,主键,自增长',
`moduleMsgCode` varchar(256) NOT NULL COMMENT '模块消息编码,与上报消息头编码一致,唯一', `moduleName` varchar(256) NOT NULL COMMENT '模块名称',
`createTime` datetime COMMENT '创建时间', `moduleMsgCode` varchar(256) NOT NULL COMMENT '模块消息编码,与上报消息头编码一致,唯一',
`updateUserId` bigint(20) COMMENT '更新用户', `createTime` datetime COMMENT '创建时间',
`updateTime` datetime COMMENT '更新时间', `updateUserId` bigint(20) COMMENT '更新用户',
PRIMARY KEY (`id`) `updateTime` datetime COMMENT '更新时间',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='设备模块信息'; ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='设备模块信息';
-- ---------------------------- -- ----------------------------
-- 设备模块使用频率表 -- 设备模块使用频率表
-- ---------------------------- -- ----------------------------
DROP TABLE IF EXISTS `mortals_xhx_device_module_use`; DROP TABLE IF EXISTS `mortals_xhx_device_module_use`;
CREATE TABLE mortals_xhx_device_module_use( CREATE TABLE mortals_xhx_device_module_use
`id` bigint(20) AUTO_INCREMENT COMMENT '主键ID,主键,自增长', (
`moduleName` varchar(256) NOT NULL COMMENT '模块名称', `id` bigint(20) AUTO_INCREMENT COMMENT '主键ID,主键,自增长',
`moduleMsgCode` varchar(256) NOT NULL COMMENT '模块消息编码', `moduleName` varchar(256) NOT NULL COMMENT '模块名称',
`deviceId` bigint(20) NOT NULL COMMENT '所属设备', `moduleMsgCode` varchar(256) NOT NULL COMMENT '模块消息编码',
`useNum` int COMMENT '调用次数', `deviceId` bigint(20) NOT NULL COMMENT '所属设备',
`createTime` datetime COMMENT '创建时间', `useNum` int COMMENT '调用次数',
`updateUserId` bigint(20) COMMENT '更新用户', `createTime` datetime COMMENT '创建时间',
`updateTime` datetime COMMENT '更新时间', `updateUserId` bigint(20) COMMENT '更新用户',
PRIMARY KEY (`id`) `updateTime` datetime COMMENT '更新时间',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='设备模块使用频率'; ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='设备模块使用频率';
...@@ -172,40 +180,40 @@ PRIMARY KEY (`id`) ...@@ -172,40 +180,40 @@ PRIMARY KEY (`id`)
-- 设备告警配置表 -- 设备告警配置表
-- ---------------------------- -- ----------------------------
DROP TABLE IF EXISTS `mortals_xhx_alarm_config`; DROP TABLE IF EXISTS `mortals_xhx_alarm_config`;
CREATE TABLE mortals_xhx_alarm_config( CREATE TABLE mortals_xhx_alarm_config
`id` bigint(20) AUTO_INCREMENT COMMENT '主键ID,主键,自增长', (
`productId` bigint(20) NOT NULL COMMENT '产品', `id` bigint(20) AUTO_INCREMENT COMMENT '主键ID,主键,自增长',
`alarmType` tinyint(2) NOT NULL COMMENT '告警类型(0.离线)', `productId` bigint(20) NOT NULL COMMENT '产品',
`alarmLevel` tinyint(2) NOT NULL COMMENT '告警级别,(0.危险,1.次要,2.一般)', `alarmType` tinyint(2) NOT NULL COMMENT '告警类型(0.离线)',
`alarmPusW1ay` tinyint(2) NOT NULL COMMENT '推送方式,(0.不推送,1.短信)', `alarmLevel` tinyint(2) NOT NULL COMMENT '告警级别,(0.危险,1.次要,2.一般)',
`enabled` tinyint(2) NOT NULL COMMENT '是否启用(0.不启用,1.启用)', `alarmPusW1ay` tinyint(2) NOT NULL COMMENT '推送方式,(0.不推送,1.短信)',
`remark` varchar(2048) COMMENT '备注', `enabled` tinyint(2) NOT NULL COMMENT '是否启用(0.不启用,1.启用)',
`createTime` datetime NOT NULL COMMENT '创建时间', `remark` varchar(2048) COMMENT '备注',
`updateUserId` bigint(20) COMMENT '更新用户', `createTime` datetime NOT NULL COMMENT '创建时间',
`updateTime` datetime COMMENT '更新时间', `updateUserId` bigint(20) COMMENT '更新用户',
PRIMARY KEY (`id`) `updateTime` datetime COMMENT '更新时间',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='设备告警配置'; ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='设备告警配置';
-- ---------------------------- -- ----------------------------
-- 短信发送记录表 -- 短信发送记录表
-- ---------------------------- -- ----------------------------
DROP TABLE IF EXISTS `mortals_xhx_alarm_sms_send`; DROP TABLE IF EXISTS `mortals_xhx_alarm_sms_send`;
CREATE TABLE mortals_xhx_alarm_sms_send( CREATE TABLE mortals_xhx_alarm_sms_send
`id` bigint(20) AUTO_INCREMENT COMMENT '主键ID,主键,自增长', (
`mobile` varchar(11) NOT NULL COMMENT '联系电话', `id` bigint(20) AUTO_INCREMENT COMMENT '主键ID,主键,自增长',
`receiver` varchar(200) NOT NULL COMMENT '接收人员', `mobile` varchar(11) NOT NULL COMMENT '联系电话',
`sendMess` varchar(200) NOT NULL COMMENT '发送内容', `receiver` varchar(200) NOT NULL COMMENT '接收人员',
`sendStatus` tinyint(2) NOT NULL COMMENT '发送状态(0.未发送,1.提交,2.发送成功,3.发生失败)', `sendMess` varchar(200) NOT NULL COMMENT '发送内容',
`sendTime` datetime NOT NULL COMMENT '发送时间', `sendStatus` tinyint(2) NOT NULL COMMENT '发送状态(0.未发送,1.提交,2.发送成功,3.发生失败)',
`siteId` bigint(20) COMMENT '站点Id,来源基础服务平台', `sendTime` datetime NOT NULL COMMENT '发送时间',
`createTime` datetime NOT NULL COMMENT '创建时间', `siteId` bigint(20) COMMENT '站点Id,来源基础服务平台',
`updateUserId` bigint(20) COMMENT '更新用户', `createTime` datetime NOT NULL COMMENT '创建时间',
`updateTime` datetime COMMENT '更新时间', `updateUserId` bigint(20) COMMENT '更新用户',
PRIMARY KEY (`id`) `updateTime` datetime COMMENT '更新时间',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='短信发送记录'; ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='短信发送记录';
...@@ -213,60 +221,62 @@ PRIMARY KEY (`id`) ...@@ -213,60 +221,62 @@ PRIMARY KEY (`id`)
-- 设备日志表 -- 设备日志表
-- ---------------------------- -- ----------------------------
DROP TABLE IF EXISTS `mortals_xhx_device_log`; DROP TABLE IF EXISTS `mortals_xhx_device_log`;
CREATE TABLE mortals_xhx_device_log( CREATE TABLE mortals_xhx_device_log
`id` bigint(20) AUTO_INCREMENT COMMENT '主键ID,主键,自增长', (
`traceID` varchar(64) COMMENT 'traceId,日志追踪id', `id` bigint(20) AUTO_INCREMENT COMMENT '主键ID,主键,自增长',
`siteId` bigint(20) COMMENT '站点Id,来源基础服务平台', `traceID` varchar(64) COMMENT 'traceId,日志追踪id',
`deviceId` bigint(20) COMMENT '设备ID', `siteId` bigint(20) COMMENT '站点Id,来源基础服务平台',
`deviceCode` varchar(32) NOT NULL COMMENT '设备编号', `deviceId` bigint(20) COMMENT '设备ID',
`deviceName` varchar(32) NOT NULL COMMENT '设备名称,设置设备名称。', `deviceCode` varchar(32) NOT NULL COMMENT '设备编号',
`messageHead` varchar(64) NOT NULL COMMENT '业务消息头标识', `deviceName` varchar(32) NOT NULL COMMENT '设备名称,设置设备名称。',
`logType` tinyint(2) NOT NULL COMMENT '消息类型,(0.上行,1.下行)', `messageHead` varchar(64) NOT NULL COMMENT '业务消息头标识',
`content` varchar(2048) COMMENT '内容', `logType` tinyint(2) NOT NULL COMMENT '消息类型,(0.上行,1.下行)',
`createUserId` bigint(20) NOT NULL COMMENT '创建用户', `content` varchar(2048) COMMENT '内容',
`createTime` datetime NOT NULL COMMENT '创建时间', `createUserId` bigint(20) NOT NULL COMMENT '创建用户',
`updateUserId` bigint(20) COMMENT '更新用户', `createTime` datetime NOT NULL COMMENT '创建时间',
`updateTime` datetime COMMENT '更新时间', `updateUserId` bigint(20) COMMENT '更新用户',
PRIMARY KEY (`id`) `updateTime` datetime COMMENT '更新时间',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='设备日志'; ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='设备日志';
-- ---------------------------- -- ----------------------------
-- 站点统计表 -- 站点统计表
-- ---------------------------- -- ----------------------------
DROP TABLE IF EXISTS `mortals_xhx_sitestat`; DROP TABLE IF EXISTS `mortals_xhx_sitestat`;
CREATE TABLE mortals_xhx_sitestat( CREATE TABLE mortals_xhx_sitestat
`id` bigint(20) AUTO_INCREMENT COMMENT '主键ID,主键,自增长', (
`siteId` bigint(20) COMMENT '站点Id,来源基础服务平台', `id` bigint(20) AUTO_INCREMENT COMMENT '主键ID,主键,自增长',
`siteCode` varchar(256) COMMENT '站点编号,来源基础服务平台', `siteId` bigint(20) COMMENT '站点Id,来源基础服务平台',
`siteName` varchar(256) COMMENT '站点名称', `siteCode` varchar(256) COMMENT '站点编号,来源基础服务平台',
`deviceTotal` int(9) COMMENT '设备总数', `siteName` varchar(256) COMMENT '站点名称',
`onlineCount` int(9) COMMENT '在线数量', `deviceTotal` int(9) COMMENT '设备总数',
`offlineCount` int(9) COMMENT '离线数量', `onlineCount` int(9) COMMENT '在线数量',
`stopCount` int(9) COMMENT '停用数量', `offlineCount` int(9) COMMENT '离线数量',
`unActiveCount` int(9) NOT NULL COMMENT '待激活数量', `stopCount` int(9) COMMENT '停用数量',
`createTime` datetime NOT NULL COMMENT '创建时间', `unActiveCount` int(9) NOT NULL COMMENT '待激活数量',
`updateUserId` bigint(20) COMMENT '更新用户', `createTime` datetime NOT NULL COMMENT '创建时间',
`updateTime` datetime COMMENT '更新时间', `updateUserId` bigint(20) COMMENT '更新用户',
PRIMARY KEY (`id`) `updateTime` datetime COMMENT '更新时间',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='站点统计'; ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='站点统计';
-- ---------------------------- -- ----------------------------
-- 设备统计表 -- 设备统计表
-- ---------------------------- -- ----------------------------
DROP TABLE IF EXISTS `mortals_xhx_device_stat`; DROP TABLE IF EXISTS `mortals_xhx_device_stat`;
CREATE TABLE mortals_xhx_device_stat( CREATE TABLE mortals_xhx_device_stat
`id` bigint(20) AUTO_INCREMENT COMMENT 'ID', (
`siteId` bigint(20) COMMENT '站点Id,来源基础服务平台', `id` bigint(20) AUTO_INCREMENT COMMENT 'ID',
`deviceTotalCount` int(9) COMMENT '设备总数', `siteId` bigint(20) COMMENT '站点Id,来源基础服务平台',
`deviceAddCount` int(9) COMMENT '昨日新增减少设备数量', `deviceTotalCount` int(9) COMMENT '设备总数',
`siteTotalCount` int(9) COMMENT '监控站点数量', `deviceAddCount` int(9) COMMENT '昨日新增减少设备数量',
`siteAddCount` int(9) COMMENT '昨日新增站点数量', `siteTotalCount` int(9) COMMENT '监控站点数量',
`deviceOnlineCount` int(9) COMMENT '在线设备数量', `siteAddCount` int(9) COMMENT '昨日新增站点数量',
`deviceOnlineRatio` double(6,2) COMMENT '在线率', `deviceOnlineCount` int(9) COMMENT '在线设备数量',
`deviceOnlineRatio` double(6, 2
) COMMENT '在线率',
`deviceOfflineCount` int(9) NOT NULL COMMENT '离线设备数量', `deviceOfflineCount` int(9) NOT NULL COMMENT '离线设备数量',
`deviceOfflineRatio` double(6,2) NOT NULL COMMENT '离线率', `deviceOfflineRatio` double(6,2) NOT NULL COMMENT '离线率',
`deviceStopCount` int(9) NOT NULL COMMENT '停用设备数量', `deviceStopCount` int(9) NOT NULL COMMENT '停用设备数量',
...@@ -290,23 +300,23 @@ PRIMARY KEY (`id`) ...@@ -290,23 +300,23 @@ PRIMARY KEY (`id`)
-- ---------------------------- -- ----------------------------
-- 产品客户端版本表 -- 产品客户端版本表
-- ---------------------------- -- ----------------------------
DROP TABLE IF EXISTS `mortals_xhx_product_version`; DROP TABLE IF EXISTS `mortals_xhx_product_version`;
CREATE TABLE mortals_xhx_product_version( CREATE TABLE mortals_xhx_product_version
`id` bigint(20) AUTO_INCREMENT COMMENT '主键ID,主键,自增长', (
`productId` bigint(20) COMMENT '产品Id', `id` bigint(20) AUTO_INCREMENT COMMENT '主键ID,主键,自增长',
`productCode` varchar(256) COMMENT '产品编码', `productId` bigint(20) COMMENT '产品Id',
`productName` varchar(256) COMMENT '产品名称', `productCode` varchar(256) COMMENT '产品编码',
`filePath` varchar(256) COMMENT '文件相对路径地址', `productName` varchar(256) COMMENT '产品名称',
`version` int(4) COMMENT '版本号', `filePath` varchar(256) COMMENT '文件相对路径地址',
`remark` varchar(256) COMMENT '备注信息', `version` int(4) COMMENT '版本号',
`createTime` datetime COMMENT '创建时间', `remark` varchar(256) COMMENT '备注信息',
`updateUserId` bigint(20) COMMENT '更新用户', `createTime` datetime COMMENT '创建时间',
`updateTime` datetime COMMENT '更新时间', `updateUserId` bigint(20) COMMENT '更新用户',
PRIMARY KEY (`id`) `updateTime` datetime COMMENT '更新时间',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='产品客户端版本'; ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='产品客户端版本';
......
use `device-platform`;
-- ---------------------------- -- ----------------------------
-- 设备生产厂商参数 SQL -- 设备生产厂商参数 SQL
-- ---------------------------- -- ----------------------------
...@@ -32,4 +32,27 @@ INSERT INTO `mortals_xhx_param` VALUES (null, '日志类型,', 'DeviceLog', 'l ...@@ -32,4 +32,27 @@ INSERT INTO `mortals_xhx_param` VALUES (null, '日志类型,', 'DeviceLog', 'l
INSERT INTO `mortals_xhx_param` VALUES (null, '日志类型,', 'DeviceLog', 'logType', '1', '下发服务', 1, 4, 0, 'logType', NULL, NULL, NULL); INSERT INTO `mortals_xhx_param` VALUES (null, '日志类型,', 'DeviceLog', 'logType', '1', '下发服务', 1, 4, 0, 'logType', NULL, NULL, NULL);
INSERT INTO `mortals_xhx_param` VALUES (null, '数据获取方式', 'Device', 'deviceDataSourceWay', '1', '被动拉取', 1, 4, 0, 'deviceDataSourceWay', NULL, NULL, NULL); INSERT INTO `mortals_xhx_param` VALUES (null, '数据获取方式', 'Device', 'deviceDataSourceWay', '1', '被动拉取', 1, 4, 0, 'deviceDataSourceWay', NULL, NULL, NULL);
\ No newline at end of file
INSERT INTO `mortals_xhx_platform` VALUES (1, '排号系统', 'phxt', 0, 'http://192.168.0.98:8090', '', 1, '', '', 1, '2022-05-31 15:56:20', 1, '2022-07-02 11:46:48');
INSERT INTO `mortals_xhx_platform` VALUES (2, '无感一码通', 'noninductive', 0, 'baidu.com', '', 1, 'baidu.com', 'noninductivenoninductive', 1, '2022-07-07 15:24:31', 1, '2022-07-07 15:24:40');
INSERT INTO `mortals_xhx_platform` VALUES (3, '短信系统', 'information', 0, 'baidu.baodu', '', 0, 'baidu.baodu', 'baidu.baodu', 1, '2022-07-07 15:26:03', 1, '2022-07-07 15:26:03');
INSERT INTO `mortals_xhx_platform` VALUES (4, '存取件平台', 'cqj', 0, 'http://192.168.0.98:8090', '', 0, '', '', 1, '2022-07-26 10:28:08', 1, '2022-07-29 10:09:11');
INSERT INTO `mortals_xhx_platform` VALUES (5, '信息发布系统', 'xxfbxt', 0, 'http://192.168.0.98:8090', '', 1, '', '', 1, '2022-08-04 09:46:43', 1, '2022-08-04 14:52:56');
INSERT INTO `mortals_xhx_platform` VALUES (6, '评价系统', 'pjxt', 0, 'http://192.168.0.98:8090', '', 1, '', '', 1, '2022-08-17 16:33:34', 1, '2022-08-17 16:34:22');
INSERT INTO `mortals_xhx_product` VALUES (1, 1, '排队机', 'pdj', 1, '1920x1080', '/homeDeviceUrl/pdj/1920x1080', '', 1, '2022-05-12 10:35:18', 1, '2022-08-03 10:14:18');
INSERT INTO `mortals_xhx_product` VALUES (2, 1, '窗口屏', 'ckp', 1, '1920x1080', '/homeDeviceUrl/ckp/1920x1080', '1111', 1, '2022-05-31 15:52:59', 1, '2022-08-01 16:59:54');
INSERT INTO `mortals_xhx_product` VALUES (3, 1, '呼叫器', 'hjq', 1, '1920x1080', '/homeDeviceUrl/hjq/1920x1080', '', 1, '2022-05-31 15:53:12', 1, '2022-08-02 09:28:19');
INSERT INTO `mortals_xhx_product` VALUES (4, 1, '集中显示屏', 'jzxsp', 1, '1920x1080', '/homeDeviceUrl/jzxsp/1920x1080', '', 1, '2022-05-31 15:53:27', 1, '2022-08-02 09:28:28');
INSERT INTO `mortals_xhx_product` VALUES (5, 1, '导视机', 'dsj', NULL, NULL, NULL, '', 1, '2022-05-31 15:53:41', 1, '2022-05-31 15:53:41');
INSERT INTO `mortals_xhx_product` VALUES (6, 1, '评价器', 'pjq', NULL, NULL, NULL, '', 1, '2022-05-31 15:53:55', 1, '2022-09-19 09:41:01');
INSERT INTO `mortals_xhx_product` VALUES (7, 1, '自助服务终端', 'zzfwzd', NULL, NULL, NULL, '', 1, '2022-05-31 15:54:09', 1, '2022-05-31 15:54:09');
INSERT INTO `mortals_xhx_product` VALUES (8, 1, '填单机', 'tdj', NULL, NULL, NULL, '', 1, '2022-05-31 15:54:20', 1, '2022-05-31 15:54:20');
INSERT INTO `mortals_xhx_product` VALUES (9, 1, '样表机', 'ybj', NULL, NULL, NULL, '', 1, '2022-05-31 15:54:29', 1, '2022-05-31 15:54:29');
INSERT INTO `mortals_xhx_product` VALUES (10, 2, '一码通', 'ymt', NULL, NULL, NULL, '123', 1, '2022-07-12 15:08:51', 1, '2022-07-12 15:08:51');
INSERT INTO `mortals_xhx_product` VALUES (11, 1, 'LED通屏', 'ledtp', NULL, NULL, 'http://www.baidu.com', '', 1, '2022-07-19 10:13:06', 1, '2022-07-19 10:13:06');
INSERT INTO `mortals_xhx_product` VALUES (13, 4, '取件柜', 'qjg', NULL, NULL, 'http://www.baidu.com', '', 1, '2022-07-26 10:28:42', 1, '2022-07-26 10:28:42');
INSERT INTO `mortals_xhx_product` VALUES (14, 5, '信息发布屏', 'xxfbp', NULL, '', '', '', 1, '2022-08-04 09:42:01', 1, '2022-08-04 09:46:51');
INSERT INTO `mortals_xhx_product` VALUES (15, 6, '背靠背评价设备', 'bkb', NULL, '', '', '背靠背评价设备', 1, '2022-08-17 16:35:05', 1, '2022-08-17 16:35:05');
\ No newline at end of file
...@@ -36,12 +36,11 @@ ...@@ -36,12 +36,11 @@
<profiles.redis.database>7</profiles.redis.database> <profiles.redis.database>7</profiles.redis.database>
<profiles.kafka.brokers>192.168.0.251:9092</profiles.kafka.brokers> <profiles.kafka.brokers>192.168.0.251:9092</profiles.kafka.brokers>
<profiles.queue.type>rabbitmq</profiles.queue.type> <profiles.queue.type>rabbitmq</profiles.queue.type>
<profiles.rabbitmq.host>127.0.0.1</profiles.rabbitmq.host> <profiles.rabbitmq.host>192.168.0.98</profiles.rabbitmq.host>
<profiles.rabbitmq.port>5672</profiles.rabbitmq.port> <profiles.rabbitmq.port>5672</profiles.rabbitmq.port>
<profiles.rabbitmq.username>guest</profiles.rabbitmq.username> <profiles.rabbitmq.username>taxi_mq</profiles.rabbitmq.username>
<profiles.rabbitmq.password>guest</profiles.rabbitmq.password> <profiles.rabbitmq.password>admin@2020</profiles.rabbitmq.password>
<profiles.rabbitmq.virtualhost>/test</profiles.rabbitmq.virtualhost> <profiles.rabbitmq.virtualhost>/</profiles.rabbitmq.virtualhost>
<profiles.rabbitmq.virtualhost1>/</profiles.rabbitmq.virtualhost1>
<profiles.rabbitmq.exchange>amp.direct</profiles.rabbitmq.exchange> <profiles.rabbitmq.exchange>amp.direct</profiles.rabbitmq.exchange>
<profiles.sms.smsSendUrl>http://127.0.0.1:8089/api/index/index</profiles.sms.smsSendUrl> <profiles.sms.smsSendUrl>http://127.0.0.1:8089/api/index/index</profiles.sms.smsSendUrl>
<profiles.sms.apiId>k6BVS1PEbyzcJAE4</profiles.sms.apiId> <profiles.sms.apiId>k6BVS1PEbyzcJAE4</profiles.sms.apiId>
...@@ -78,8 +77,7 @@ ...@@ -78,8 +77,7 @@
<profiles.rabbitmq.port>5672</profiles.rabbitmq.port> <profiles.rabbitmq.port>5672</profiles.rabbitmq.port>
<profiles.rabbitmq.username>taxi_mq</profiles.rabbitmq.username> <profiles.rabbitmq.username>taxi_mq</profiles.rabbitmq.username>
<profiles.rabbitmq.password>admin@2020</profiles.rabbitmq.password> <profiles.rabbitmq.password>admin@2020</profiles.rabbitmq.password>
<profiles.rabbitmq.virtualhost>/test</profiles.rabbitmq.virtualhost> <profiles.rabbitmq.virtualhost>/</profiles.rabbitmq.virtualhost>
<profiles.rabbitmq.virtualhost1>/test</profiles.rabbitmq.virtualhost1>
<profiles.rabbitmq.exchange>amp.direct</profiles.rabbitmq.exchange> <profiles.rabbitmq.exchange>amp.direct</profiles.rabbitmq.exchange>
<profiles.sms.smsSendUrl>http://127.0.0.1:8089/api/index/index</profiles.sms.smsSendUrl> <profiles.sms.smsSendUrl>http://127.0.0.1:8089/api/index/index</profiles.sms.smsSendUrl>
<profiles.sms.apiId>k6BVS1PEbyzcJAE4</profiles.sms.apiId> <profiles.sms.apiId>k6BVS1PEbyzcJAE4</profiles.sms.apiId>
...@@ -97,14 +95,35 @@ ...@@ -97,14 +95,35 @@
<id>product</id> <id>product</id>
<properties> <properties>
<profiles.active>product</profiles.active> <profiles.active>product</profiles.active>
<profiles.server.port>17214</profiles.server.port> <profiles.server.port>18222</profiles.server.port>
<profiles.platform.type>cloud</profiles.platform.type>
<profiles.queue.type>rabbitmq</profiles.queue.type> <profiles.queue.type>rabbitmq</profiles.queue.type>
<profiles.kafka.brokers>192.168.0.100:9092</profiles.kafka.brokers> <profiles.datasource.uri>
<profiles.rabbitmq.host>192.168.0.100</profiles.rabbitmq.host> <![CDATA[jdbc:mysql://127.0.0.1:3306/device-platform?useUnicode=true&characterEncoding=utf8&useSSL=false&serverTimezone=Hongkong]]></profiles.datasource.uri>
<profiles.datasource.username>root</profiles.datasource.username>
<profiles.datasource.password>12345678</profiles.datasource.password>
<profiles.redis.uri>127.0.0.1</profiles.redis.uri>
<profiles.redis.port>6379</profiles.redis.port>
<profiles.redis.username></profiles.redis.username>
<profiles.redis.password>12345678</profiles.redis.password>
<profiles.redis.database>6</profiles.redis.database>
<profiles.kafka.brokers>192.168.0.251:9092</profiles.kafka.brokers>
<profiles.queue.type>rabbitmq</profiles.queue.type>
<profiles.rabbitmq.host>192.168.0.251</profiles.rabbitmq.host>
<profiles.rabbitmq.port>5672</profiles.rabbitmq.port> <profiles.rabbitmq.port>5672</profiles.rabbitmq.port>
<profiles.nacos.server-addr>192.168.0.100:8848</profiles.nacos.server-addr> <profiles.rabbitmq.username>root_mq</profiles.rabbitmq.username>
<profiles.rabbitmq.password>xhx@2022</profiles.rabbitmq.password>
<profiles.rabbitmq.virtualhost>/</profiles.rabbitmq.virtualhost>
<profiles.rabbitmq.exchange>amp.direct</profiles.rabbitmq.exchange>
<profiles.sms.smsSendUrl>http://127.0.0.1:8089/api/index/index</profiles.sms.smsSendUrl>
<profiles.sms.apiId>k6BVS1PEbyzcJAE4</profiles.sms.apiId>
<profiles.sms.type>3</profiles.sms.type>
<profiles.filepath>/mortals/app/data</profiles.filepath>
<profiles.log.level>INFO</profiles.log.level>
<profiles.data.path>/data</profiles.data.path>
<profiles.nacos.server-addr>127.0.0.1:8848</profiles.nacos.server-addr>
<profiles.nacos.group>DEFAULT_GROUP</profiles.nacos.group> <profiles.nacos.group>DEFAULT_GROUP</profiles.nacos.group>
<profiles.nacos.namespace>stp</profiles.nacos.namespace> <profiles.nacos.namespace>smart-gov</profiles.nacos.namespace>
<profiles.log.path>/mortals/app/logs</profiles.log.path> <profiles.log.path>/mortals/app/logs</profiles.log.path>
</properties> </properties>
</profile> </profile>
...@@ -168,6 +187,12 @@ ...@@ -168,6 +187,12 @@
<scope>test</scope> <scope>test</scope>
</dependency> </dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies> </dependencies>
...@@ -228,6 +253,23 @@ ...@@ -228,6 +253,23 @@
</resources> </resources>
</configuration> </configuration>
</execution> </execution>
<execution>
<id>copy-db</id>
<phase>package</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
<encoding>UTF-8</encoding>
<outputDirectory>${project.parent.basedir}/dist/${project.parent.artifactId}/db</outputDirectory>
<resources>
<resource>
<directory>../db/</directory>
<filtering>true</filtering>
</resource>
</resources>
</configuration>
</execution>
</executions> </executions>
</plugin> </plugin>
</plugins> </plugins>
......
...@@ -2,8 +2,8 @@ package com.mortals.xhx.base.framework.aspect; ...@@ -2,8 +2,8 @@ package com.mortals.xhx.base.framework.aspect;
import com.mortals.framework.model.OperateLogPdu; import com.mortals.framework.model.OperateLogPdu;
import com.mortals.framework.service.ILogService; import com.mortals.framework.service.ILogService;
import com.mortals.framework.service.IMessageProduceService;
import com.mortals.framework.service.impl.FileLogServiceImpl; import com.mortals.framework.service.impl.FileLogServiceImpl;
import com.mortals.xhx.base.system.message.impl.MessageProducer;
import com.mortals.xhx.base.system.oper.service.OperLogService; import com.mortals.xhx.base.system.oper.service.OperLogService;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
...@@ -24,7 +24,8 @@ public class OperlogAspect extends FileLogServiceImpl implements ILogService { ...@@ -24,7 +24,8 @@ public class OperlogAspect extends FileLogServiceImpl implements ILogService {
@Autowired @Autowired
private OperLogService operLogService; private OperLogService operLogService;
@Autowired @Autowired
private IMessageProduceService messageProduceService; private MessageProducer messageProducer;
//private IMessageProduceService messageProduceService;
@Override @Override
public void doHandlerLog(String platformMark, Long userId, String userName, String loginName, String requestUrl, public void doHandlerLog(String platformMark, Long userId, String userName, String loginName, String requestUrl,
...@@ -42,7 +43,7 @@ public class OperlogAspect extends FileLogServiceImpl implements ILogService { ...@@ -42,7 +43,7 @@ public class OperlogAspect extends FileLogServiceImpl implements ILogService {
operateLogPdu.setLogDate(logDate); operateLogPdu.setLogDate(logDate);
operateLogPdu.setContent(content); operateLogPdu.setContent(content);
operateLogPdu.setOperType(1); operateLogPdu.setOperType(1);
messageProduceService.syncOperSend(operateLogPdu); messageProducer.syncOperSend(operateLogPdu);
} }
...@@ -54,32 +55,4 @@ public class OperlogAspect extends FileLogServiceImpl implements ILogService { ...@@ -54,32 +55,4 @@ public class OperlogAspect extends FileLogServiceImpl implements ILogService {
} }
/*@Pointcut("execution(public * com.mortals.xhx..*Controller.*(..))")
public void accessLog() {
}
@Before("accessLog()")
public void doBefore(JoinPoint joinPoint) {
ServletRequestAttributes attributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes();
HttpServletRequest request = attributes.getRequest();
// url
log.info("ip[{}]url[{}]", request.getRemoteAddr(), request.getRequestURL());
// 参数第1和第2个参数为HttpServletRequest request, HttpServletResponse
// response
if (joinPoint.getArgs().length > 2) {
log.info("args={}", joinPoint.getArgs()[2]);
} else {
log.info("args={}", joinPoint.getArgs());
}
}
@AfterReturning(returning = "object", pointcut = "accessLog()")
public void doAfterReturning(Object object) {
if (null != object) {
log.info("response={}", object.toString());
}
}*/
} }
package com.mortals.xhx.base.framework.config; package com.mortals.xhx.base.framework.config;
import com.mortals.xhx.base.framework.listener.DirectDynamicListener;
import com.mortals.xhx.base.framework.listener.RabbitLoggingErrorHandler; import com.mortals.xhx.base.framework.listener.RabbitLoggingErrorHandler;
import com.mortals.xhx.base.framework.listener.SimpleDynamicListener; import com.mortals.xhx.base.framework.listener.SimpleDynamicListener;
import com.mortals.xhx.base.system.message.MessageCallbackService;
import com.mortals.xhx.base.system.message.impl.MessageProducer; import com.mortals.xhx.base.system.message.impl.MessageProducer;
import com.mortals.xhx.base.system.message.impl.MessageServiceImpl; import org.checkerframework.checker.units.qual.A;
import org.springframework.amqp.core.AcknowledgeMode; import org.springframework.amqp.core.AcknowledgeMode;
import org.springframework.amqp.core.MessageListener;
import org.springframework.amqp.rabbit.AsyncRabbitTemplate; import org.springframework.amqp.rabbit.AsyncRabbitTemplate;
import org.springframework.amqp.rabbit.config.SimpleRabbitListenerContainerFactory; import org.springframework.amqp.rabbit.config.SimpleRabbitListenerContainerFactory;
import org.springframework.amqp.rabbit.connection.CachingConnectionFactory; import org.springframework.amqp.rabbit.connection.CachingConnectionFactory;
...@@ -30,11 +29,11 @@ public class RabbitConfig { ...@@ -30,11 +29,11 @@ public class RabbitConfig {
@Autowired @Autowired
private SimpleDynamicListener simpleDynamicListener; private SimpleDynamicListener simpleDynamicListener;
@Autowired @Autowired
private DirectDynamicListener directDynamicListener;
@Autowired
private RabbitLoggingErrorHandler rabbitLoggingErrorHandler; private RabbitLoggingErrorHandler rabbitLoggingErrorHandler;
@Autowired @Autowired
private MessageProducer messageProducer; private MessageProducer messageProducer;
@Autowired
private MessageCallbackService messageCallbackService;
//@Bean("simpleMessageListenerContainer") //@Bean("simpleMessageListenerContainer")
public SimpleMessageListenerContainer simpleMessageListenerContainer(CachingConnectionFactory cachingConnectionFactory) { public SimpleMessageListenerContainer simpleMessageListenerContainer(CachingConnectionFactory cachingConnectionFactory) {
...@@ -69,8 +68,8 @@ public class RabbitConfig { ...@@ -69,8 +68,8 @@ public class RabbitConfig {
@Bean @Bean
public RabbitTemplate rabbitTemplate(ConnectionFactory connectionFactory) { public RabbitTemplate rabbitTemplate(ConnectionFactory connectionFactory) {
RabbitTemplate rabbitTemplate = new RabbitTemplate(connectionFactory); RabbitTemplate rabbitTemplate = new RabbitTemplate(connectionFactory);
rabbitTemplate.setReturnCallback(messageProducer); rabbitTemplate.setReturnCallback(messageCallbackService);
rabbitTemplate.setConfirmCallback(messageProducer); rabbitTemplate.setConfirmCallback(messageCallbackService);
return rabbitTemplate; return rabbitTemplate;
} }
......
...@@ -7,8 +7,6 @@ import org.redisson.api.RedissonClient; ...@@ -7,8 +7,6 @@ import org.redisson.api.RedissonClient;
import org.redisson.client.codec.Codec; import org.redisson.client.codec.Codec;
import org.redisson.codec.JsonJacksonCodec; import org.redisson.codec.JsonJacksonCodec;
import org.redisson.config.Config; import org.redisson.config.Config;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.boot.context.properties.ConfigurationProperties; import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;
...@@ -19,8 +17,8 @@ import org.springframework.context.annotation.Configuration; ...@@ -19,8 +17,8 @@ import org.springframework.context.annotation.Configuration;
* @author: zxfei * @author: zxfei
* @date: 2022/8/8 16:02 * @date: 2022/8/8 16:02
*/ */
//@Configuration @Configuration
//@ConfigurationProperties(prefix = "spring.redis") @ConfigurationProperties(prefix = "spring.redis")
@Slf4j @Slf4j
@Data @Data
public class RedissonConfig { public class RedissonConfig {
...@@ -33,12 +31,13 @@ public class RedissonConfig { ...@@ -33,12 +31,13 @@ public class RedissonConfig {
private int database; private int database;
//@Bean @Bean
public RedissonClient redissonClient() { public RedissonClient redissonClient() {
RedissonClient redissonClient; RedissonClient redissonClient;
Config config = new Config(); Config config = new Config();
String url = "redis://" + host + ":" + port; String url = "redis://" + host + ":" + port;
// 单节点配置 // 单节点配置
if("".equalsIgnoreCase(password)) password=null;
config.useSingleServer().setAddress(url).setDatabase(database).setPassword(password); config.useSingleServer().setAddress(url).setDatabase(database).setPassword(password);
//使用json序列化方式 //使用json序列化方式
Codec codec = new JsonJacksonCodec(); Codec codec = new JsonJacksonCodec();
......
...@@ -18,12 +18,9 @@ import com.mortals.xhx.module.platform.model.PlatformEntity; ...@@ -18,12 +18,9 @@ import com.mortals.xhx.module.platform.model.PlatformEntity;
import com.mortals.xhx.module.platform.service.PlatformService; import com.mortals.xhx.module.platform.service.PlatformService;
import com.mortals.xhx.module.product.model.ProductEntity; import com.mortals.xhx.module.product.model.ProductEntity;
import com.mortals.xhx.module.product.service.ProductService; import com.mortals.xhx.module.product.service.ProductService;
import com.mortals.xhx.queue.DefaultTbQueueMsg;
import com.rabbitmq.client.Channel;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.amqp.core.Message; import org.springframework.amqp.core.Message;
import org.springframework.amqp.core.MessageListener; import org.springframework.amqp.core.MessageListener;
import org.springframework.amqp.rabbit.listener.api.ChannelAwareMessageListener;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.util.ObjectUtils; import org.springframework.util.ObjectUtils;
...@@ -62,7 +59,7 @@ public class DirectDynamicListener implements MessageListener { ...@@ -62,7 +59,7 @@ public class DirectDynamicListener implements MessageListener {
String queue = message.getMessageProperties().getConsumerQueue(); String queue = message.getMessageProperties().getConsumerQueue();
byte[] body = message.getBody(); byte[] body = message.getBody();
String data = new String(body); String data = new String(body);
log.info("接收到:{} ,\n消息内容为:{}", queue, data); // log.info("接收到:{} ,\n消息内容为:{}", queue, data);
DefaultQueueMsg queueMsg = JSON.parseObject(data, DefaultQueueMsg.class); DefaultQueueMsg queueMsg = JSON.parseObject(data, DefaultQueueMsg.class);
//做相应业务,做日志操作 //做相应业务,做日志操作
String deviceCode = queueMsg.getHeaders().getData().get(DEVICECODE); String deviceCode = queueMsg.getHeaders().getData().get(DEVICECODE);
......
package com.mortals.xhx.base.system.message;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
public interface MessageCallbackService extends RabbitTemplate.ConfirmCallback, RabbitTemplate.ReturnCallback {
}
\ No newline at end of file
...@@ -9,7 +9,6 @@ import com.mortals.xhx.queue.TopicPartitionInfo; ...@@ -9,7 +9,6 @@ import com.mortals.xhx.queue.TopicPartitionInfo;
public interface MessageService { public interface MessageService {
/** /**
* 发送消息 * 发送消息
* *
......
package com.mortals.xhx.base.system.message; package com.mortals.xhx.base.system.message;
import com.mortals.xhx.busiz.req.DeviceReq; public interface RabbitMessageService {
import com.mortals.xhx.busiz.rsp.ApiResp;
import com.mortals.xhx.queue.TbQueueCallback;
import com.mortals.xhx.queue.TbQueueMsgHeaders;
import com.mortals.xhx.queue.TopicPartitionInfo;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
public interface RabbitMessageService extends RabbitTemplate.ConfirmCallback, RabbitTemplate.ReturnCallback {
/** /**
......
package com.mortals.xhx.base.system.message.impl;
import com.alibaba.fastjson.JSON;
import com.mortals.xhx.base.system.message.MessageCallbackService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.amqp.core.Message;
import org.springframework.amqp.rabbit.connection.CorrelationData;
import org.springframework.stereotype.Service;
@Service
@Slf4j
public class MessageCallbackServiceImpl implements MessageCallbackService {
@Override
public void confirm(CorrelationData correlationData, boolean ack, String cause) {
log.info("returnedMessage,correlationData:{},ack:{},cause:{},routingKey:{}", JSON.toJSONString(correlationData), ack, cause);
}
@Override
public void returnedMessage(Message message, int replyCode, String replyText, String exchange, String routingKey) {
log.info("returnedMessage,replyCode:{},replyText:{},exchange:{},routingKey:{}", replyCode, replyText, exchange, routingKey);
}
}
\ No newline at end of file
...@@ -44,13 +44,15 @@ public class MessageProducer implements IMessageProduceService, RabbitMessageSer ...@@ -44,13 +44,15 @@ public class MessageProducer implements IMessageProduceService, RabbitMessageSer
@Override @Override
public void syncErrorSend(ErrorLogPdu errorLogPdu) { public void syncErrorSend(ErrorLogPdu errorLogPdu) {
rabbitTemplate.convertAndSend(QueueKey.EXCHANGE, QueueKey.ERROR_LOG_QUEUE, JSON.toJSONString(errorLogPdu)); rabbitTemplate.convertAndSend(QueueKey.EXCHANGE, QueueKey.ERROR_LOG_QUEUE, JSON.toJSONString(errorLogPdu));
} }
@Override @Override
public void syncOperSend(OperateLogPdu operLogPdu) { public void syncOperSend(OperateLogPdu operLogPdu) {
log.info("send poerate log ==>{}",JSON.toJSONString(operLogPdu)); log.info("send poerate log ==>{}", JSON.toJSONString(operLogPdu));
rabbitTemplate.convertAndSend(QueueKey.EXCHANGE, QueueKey.OPERATION_LOG_QUEUE, JSON.toJSONString(operLogPdu)); String send = JSON.toJSONString(operLogPdu);
rabbitTemplate.convertAndSend(QueueKey.EXCHANGE, QueueKey.OPERATION_LOG_QUEUE, send);
} }
@Override @Override
...@@ -81,17 +83,6 @@ public class MessageProducer implements IMessageProduceService, RabbitMessageSer ...@@ -81,17 +83,6 @@ public class MessageProducer implements IMessageProduceService, RabbitMessageSer
return rabbitAdmin.deleteQueue(queue); return rabbitAdmin.deleteQueue(queue);
} }
@Override
public void confirm(CorrelationData correlationData, boolean ack, String cause) {
}
@Override
public void returnedMessage(Message message, int replyCode, String replyText, String exchange, String routingKey) {
}
@Override @Override
public void afterPropertiesSet() throws Exception { public void afterPropertiesSet() throws Exception {
System.out.println(111); System.out.println(111);
......
...@@ -167,19 +167,13 @@ public class MessageServiceImpl implements MessageService{ ...@@ -167,19 +167,13 @@ public class MessageServiceImpl implements MessageService{
public static void main(String[] args) { public static void main(String[] args) {
try { try {
throw new Exception("1213"); throw new Exception("1213");
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
String stacktrace = ExceptionUtil.stacktraceToString(e.fillInStackTrace()); String stacktrace = ExceptionUtil.stacktraceToString(e.fillInStackTrace());
JSONObject jsonObject = new JSONObject(); JSONObject jsonObject = new JSONObject();
jsonObject.put("stacktrace", stacktrace); jsonObject.put("stacktrace", stacktrace);
System.out.println(JSON.toJSONString(jsonObject)); System.out.println(JSON.toJSONString(jsonObject));
} }
......
package com.mortals.xhx.busiz.req;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.mortals.xhx.base.framework.CustomJsonDateDeserializer;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
@Data
public class TestReq implements Serializable {
/**
* 1:新增,2:修改,3:删除,4:激活,5:启用,6:停用
*/
private Integer receiveMethod;
// /**
// * 平台系统id
// */
// private Long platformId;
// /**
// * 平台系统编码
// */
// private String platformCode;
/**
* 产品id
*/
private Long productId;
/**
* 产品编码
*/
private String productCode;
/**
* 设备生产厂商ID
*/
private Long deviceFirmId;
/**
* 设备生产厂商名称
*/
private String deviceFirmname;
/**
* 设备名称
*/
private String deviceName;
/**
* 设备编码(暂定mac地址)
*/
private String deviceCode;
/**
* 设备Mac
*/
private String deviceMac;
/**
* 所属站点Id
*/
private Long siteId;
/**
* 所属站点编码
*/
private String siteCode;
/**
* 所属站点名称
*/
private String siteName;
/**
* 设备备注信息
*/
private String deviceRemark;
/**
* 设备
*/
private String homeUrl;
/**
* 设备访问ip
*/
private String ip;
/**
* 中心设备编码
*/
private String centernum;
/**
* 端口
*/
private String port;
/**
* 经度
*/
private String lon;
/**
* 纬度
*/
private String lati;
/**
* 楼层
*/
private Integer deviceInBuilding;
/**
* 所属楼栋
*/
private Integer deviceInFloor;
/**
* 负责人
*/
private String leadingOfficial;
/**
* 联系电话
*/
private String leadingOfficialTelephone;
/**
* 保修期至
*/
@JsonDeserialize(using = CustomJsonDateDeserializer.class)
private Date defectsLiabilityPeriod;
/**
* 设备状态 (0.未激活,1.离线,2.在线)
*/
private Integer deviceStatus;
/**
* 设备来源(0.旧设备,1.新设备)
*/
private Integer source;
/**
* 激活(0.否,1.是)
*/
private Integer active;
/**
* 设备版本信息
*/
private String deviceVersion;
}
package com.mortals.xhx.busiz.web; package com.mortals.xhx.busiz.web;
import cn.hutool.core.date.DateUnit;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.net.url.UrlBuilder; import cn.hutool.core.net.url.UrlBuilder;
import cn.hutool.core.util.IdUtil; import cn.hutool.core.util.IdUtil;
import cn.hutool.extra.servlet.ServletUtil; import cn.hutool.extra.servlet.ServletUtil;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.TypeReference;
import com.mortals.framework.annotation.UnAuth; import com.mortals.framework.annotation.UnAuth;
import com.mortals.framework.ap.GlobalSysInfo; import com.mortals.framework.ap.GlobalSysInfo;
import com.mortals.framework.common.Rest; import com.mortals.framework.common.Rest;
import com.mortals.framework.exception.AppException; import com.mortals.framework.exception.AppException;
import com.mortals.framework.model.OrderCol; import com.mortals.framework.model.OrderCol;
import com.mortals.framework.service.IAuthTokenService;
import com.mortals.framework.service.ICacheService; import com.mortals.framework.service.ICacheService;
import com.mortals.framework.service.ILogService; import com.mortals.framework.service.ILogService;
import com.mortals.framework.service.IUser;
import com.mortals.framework.service.impl.FileLogServiceImpl; import com.mortals.framework.service.impl.FileLogServiceImpl;
import com.mortals.framework.util.DateUtils; import com.mortals.framework.util.DateUtils;
import com.mortals.framework.util.StringUtils;
import com.mortals.xhx.base.framework.annotation.ApiUserAuth; import com.mortals.xhx.base.framework.annotation.ApiUserAuth;
import com.mortals.xhx.base.login.web.LoginForm; import com.mortals.xhx.base.login.web.LoginForm;
import com.mortals.xhx.base.system.message.impl.MessageProducer; import com.mortals.xhx.base.system.message.impl.MessageProducer;
...@@ -34,8 +28,6 @@ import com.mortals.xhx.common.key.Constant; ...@@ -34,8 +28,6 @@ import com.mortals.xhx.common.key.Constant;
import com.mortals.xhx.common.key.QueueKey; import com.mortals.xhx.common.key.QueueKey;
import com.mortals.xhx.common.model.DefaultTbQueueMsgHeaders; import com.mortals.xhx.common.model.DefaultTbQueueMsgHeaders;
import com.mortals.xhx.common.model.MessageHeader; import com.mortals.xhx.common.model.MessageHeader;
import com.mortals.xhx.common.pdu.DefaultQueueMsg;
import com.mortals.xhx.common.pdu.DefaultQueueMsgHeader;
import com.mortals.xhx.common.pdu.RespData; import com.mortals.xhx.common.pdu.RespData;
import com.mortals.xhx.common.pdu.site.SitePdu; import com.mortals.xhx.common.pdu.site.SitePdu;
import com.mortals.xhx.common.utils.BeanUtil; import com.mortals.xhx.common.utils.BeanUtil;
...@@ -49,7 +41,6 @@ import com.mortals.xhx.module.device.service.DeviceService; ...@@ -49,7 +41,6 @@ import com.mortals.xhx.module.device.service.DeviceService;
import com.mortals.xhx.module.firm.model.FirmEntity; import com.mortals.xhx.module.firm.model.FirmEntity;
import com.mortals.xhx.module.firm.service.FirmService; import com.mortals.xhx.module.firm.service.FirmService;
import com.mortals.xhx.module.platform.model.PlatformEntity; 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 com.mortals.xhx.module.platform.service.PlatformService;
import com.mortals.xhx.module.product.model.ProductEntity; import com.mortals.xhx.module.product.model.ProductEntity;
import com.mortals.xhx.module.product.model.ProductQuery; import com.mortals.xhx.module.product.model.ProductQuery;
...@@ -62,14 +53,12 @@ import com.mortals.xhx.module.site.service.SiteService; ...@@ -62,14 +53,12 @@ import com.mortals.xhx.module.site.service.SiteService;
import com.mortals.xhx.queue.DefaultTbQueueMsg; import com.mortals.xhx.queue.DefaultTbQueueMsg;
import com.mortals.xhx.queue.TbQueueMsg; import com.mortals.xhx.queue.TbQueueMsg;
import com.mortals.xhx.queue.TbQueueMsgHeaders; import com.mortals.xhx.queue.TbQueueMsgHeaders;
import com.mortals.xhx.queue.TopicPartitionInfo;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.util.ObjectUtils; import org.springframework.util.ObjectUtils;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import org.springframework.web.context.request.ServletRequestAttributes;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import java.util.ArrayList; import java.util.ArrayList;
...@@ -78,7 +67,6 @@ import java.util.Date; ...@@ -78,7 +67,6 @@ import java.util.Date;
import java.util.List; import java.util.List;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import static com.mortals.framework.ap.SysConstains.PROP_PLATFORM_MARK;
import static com.mortals.xhx.common.key.Constant.*; import static com.mortals.xhx.common.key.Constant.*;
import static com.mortals.xhx.common.key.ErrorCode.*; import static com.mortals.xhx.common.key.ErrorCode.*;
import static com.mortals.xhx.common.key.RedisKey.KEY_TOKEN_API_CACHE; import static com.mortals.xhx.common.key.RedisKey.KEY_TOKEN_API_CACHE;
...@@ -103,17 +91,17 @@ public class DeviceApiController { ...@@ -103,17 +91,17 @@ public class DeviceApiController {
private ProductVersionService productVersionService; private ProductVersionService productVersionService;
@Autowired @Autowired
private PlatformService platformService; private PlatformService platformService;
@Value("${queue.rabbitmq.virtual_host:}") @Value("${rabbitmq.virtual-host:}")
private String virtualHost; private String virtualHost;
@Value("${queue.rabbitmq.password:}") @Value("${rabbitmq.password:}")
private String password; private String password;
@Value("${queue.rabbitmq.host:}") @Value("${rabbitmq.host:}")
private String host; private String host;
@Value("${queue.rabbitmq.port:}") @Value("${rabbitmq.port:0}")
private int port; private int port;
@Value("${queue.rabbitmq.username:}") @Value("${rabbitmq.username:}")
private String username; private String username;
@Value("${queue.rabbitmq.queue-properties.x-message-ttl:86400000}") @Value("${rabbitmq.queue-properties.x-message-ttl:86400000}")
private String messageTtl; private String messageTtl;
@Value("${token.secret}") @Value("${token.secret}")
private String secret; private String secret;
......
package com.mortals.xhx.busiz.web;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.mortals.framework.service.ICacheService;
import com.mortals.framework.service.ILogService;
import com.mortals.framework.service.impl.FileLogServiceImpl;
import com.mortals.xhx.base.system.message.impl.MessageProducer;
import com.mortals.xhx.base.system.user.service.UserService;
import com.mortals.xhx.busiz.req.TestReq;
import com.mortals.xhx.busiz.rsp.ApiResp;
import com.mortals.xhx.busiz.rsp.DeviceResp;
import com.mortals.xhx.common.code.ApiRespCodeEnum;
import com.mortals.xhx.common.utils.SendTaskThreadPool;
import com.mortals.xhx.feign.site.ISiteFeign;
import com.mortals.xhx.module.device.service.DeviceLogService;
import com.mortals.xhx.module.device.service.DeviceService;
import com.mortals.xhx.module.firm.service.FirmService;
import com.mortals.xhx.module.platform.service.PlatformService;
import com.mortals.xhx.module.product.service.ProductService;
import com.mortals.xhx.module.product.service.ProductVersionService;
import com.mortals.xhx.module.site.service.SiteService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* 设备
*
* @author: zxfei
* @date: 2021/8/24 20:28
*/
@RestController
@Slf4j
@RequestMapping("/test")
public class TestSendMsgController {
@Autowired
private DeviceService deviceService;
@Autowired
private ProductService productService;
@Autowired
private UserService userService;
@Autowired
private ProductVersionService productVersionService;
@Autowired
private PlatformService platformService;
@Value("${queue.rabbitmq.virtual_host:}")
private String virtualHost;
@Value("${queue.rabbitmq.password:}")
private String password;
@Value("${queue.rabbitmq.host:}")
private String host;
@Value("${queue.rabbitmq.port:0}")
private int port;
@Value("${queue.rabbitmq.username:}")
private String username;
@Value("${queue.rabbitmq.queue-properties.x-message-ttl:86400000}")
private String messageTtl;
@Value("${token.secret}")
private String secret;
@Autowired
private SendTaskThreadPool sendTaskThreadPool;
@Autowired
private ISiteFeign siteFeign;
@Value("${platform.type:cloud}")
private String platFormType;//版本,默认云服务版本
@Autowired
private SiteService siteService;
@Autowired
private FirmService firmService;
@Autowired
private DeviceLogService deviceLogService;
@Autowired
private ICacheService cacheService;
@Autowired
private MessageProducer messageProducer;
@Autowired
protected ILogService logService = FileLogServiceImpl.getInstance();
/**
* 发送日志消息
*
* @param req
* @return
*/
@PostMapping("log")
public String register(@RequestBody TestReq req) {
log.info("【测试消息】【请求体】--> " + JSONObject.toJSONString(req));
ApiResp<DeviceResp> rsp = new ApiResp<>();
rsp.setCode(ApiRespCodeEnum.SUCCESS.getValue());
log.info("响应【设备注册】【响应体】--> " + JSONObject.toJSONString(rsp));
return JSON.toJSONString(rsp);
}
}
package com.mortals.xhx.daemon.applicationservice; package com.mortals.xhx.daemon.applicationservice;
import com.mortals.framework.springcloud.service.IApplicationStartedService; import com.mortals.framework.springcloud.service.IApplicationStartedService;
import com.mortals.xhx.daemon.netty.config.NettyServerConfig;
import com.mortals.xhx.daemon.netty.server.controlserver.ControlServer; import com.mortals.xhx.daemon.netty.server.controlserver.ControlServer;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
...@@ -40,7 +37,7 @@ public class NettyStartedService implements IApplicationStartedService { ...@@ -40,7 +37,7 @@ public class NettyStartedService implements IApplicationStartedService {
@Override @Override
public void stop() { public void stop() {
log.info("停止服务.."); log.info("netty停止服务..");
if (thread != null) { if (thread != null) {
thread.interrupt(); thread.interrupt();
} }
......
package com.mortals.xhx.daemon.netty.server.controlserver; package com.mortals.xhx.daemon.netty.server.controlserver;
import com.mortals.xhx.daemon.netty.config.NettyServerConfig;
import com.mortals.xhx.module.device.service.DeviceService; import com.mortals.xhx.module.device.service.DeviceService;
import io.netty.bootstrap.Bootstrap; import io.netty.bootstrap.Bootstrap;
import io.netty.channel.Channel; import io.netty.channel.Channel;
...@@ -14,7 +13,6 @@ import org.springframework.beans.factory.annotation.Autowired; ...@@ -14,7 +13,6 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import javax.annotation.PreDestroy; import javax.annotation.PreDestroy;
import javax.annotation.Resource;
import java.net.Inet4Address; import java.net.Inet4Address;
@Component @Component
...@@ -63,9 +61,9 @@ public class ControlServer { ...@@ -63,9 +61,9 @@ public class ControlServer {
@PreDestroy @PreDestroy
public void release() { public void release() {
isClosed = true;
closeChannel(); closeChannel();
closeServerBootstrap(); closeServerBootstrap();
isClosed = true;
} }
/** /**
......
...@@ -170,8 +170,6 @@ public class DeviceServiceImpl extends AbstractCRUDCacheServiceImpl<DeviceDao, D ...@@ -170,8 +170,6 @@ public class DeviceServiceImpl extends AbstractCRUDCacheServiceImpl<DeviceDao, D
resp.setCode(ApiRespCodeEnum.SUCCESS.getValue()); resp.setCode(ApiRespCodeEnum.SUCCESS.getValue());
resp.setMsg(ApiRespCodeEnum.SUCCESS.getLabel()); resp.setMsg(ApiRespCodeEnum.SUCCESS.getLabel());
//messageProducer.sendMsg();
messageService.send(info, header, message, callback); messageService.send(info, header, message, callback);
return resp; return resp;
} }
...@@ -272,39 +270,11 @@ public class DeviceServiceImpl extends AbstractCRUDCacheServiceImpl<DeviceDao, D ...@@ -272,39 +270,11 @@ public class DeviceServiceImpl extends AbstractCRUDCacheServiceImpl<DeviceDao, D
super.saveAfter(entity, context); super.saveAfter(entity, context);
} }
/* private void registerRabbitQueue(DeviceEntity entity, PlatformEntity platformEntity, ProductEntity productEntity) {
String exchangeName = platformEntity.getPlatformSn() + Constant.EXCHANGE_SPLIT + productEntity.getProductCode();
TopicPartitionInfo info = TopicPartitionInfo.builder().exchangeName(exchangeName).topic(Constant.UPLOAD_TOPIC + entity.getDeviceCode()).build();
TbQueueCallback callback = new TbQueueCallback() {
@Override
public void onSuccess(TbQueueMsgMetadata metadata) {
log.debug("队列创建成功,设备编码:{}", entity.getDeviceCode());
}
@Override
public void onFailure(Throwable t) {
log.error("队列创建失败,设备通道编码:{},{}", entity.getDeviceCode(), t);
}
};
messageService.queueDeclare(info, callback);
//消费监听线程添加当前声明队列
Set<TopicPartitionInfo> partitions = new HashSet<>();
partitions.add(info);
consumerService.getMainConsumer().subscribe(partitions);
//创建下行队列
info = TopicPartitionInfo.builder().exchangeName(exchangeName).topic(Constant.DOWN_TOPIC + entity.getDeviceCode()).build();
messageService.queueDeclare(info, callback);
}*/
@Override @Override
protected void updateAfter(DeviceEntity entity, Context context) throws AppException { protected void updateAfter(DeviceEntity entity, Context context) throws AppException {
PlatformEntity platformEntity = platformService.get(entity.getPlatformId()); PlatformEntity platformEntity = platformService.get(entity.getPlatformId());
ProductEntity productEntity = productService.get(entity.getProductId()); ProductEntity productEntity = productService.get(entity.getProductId());
if (!ObjectUtils.isEmpty(platformEntity) && !ObjectUtils.isEmpty(productEntity)) { if (!ObjectUtils.isEmpty(platformEntity) && !ObjectUtils.isEmpty(productEntity)) {
//新增设备通知第三方平台 激活后的设备才通知和更新 //新增设备通知第三方平台 激活后的设备才通知和更新
if (entity.getDeviceStatus() > 0) { if (entity.getDeviceStatus() > 0) {
//注册rabbmit相关队列与绑定 //注册rabbmit相关队列与绑定
......
...@@ -20,11 +20,6 @@ spring: ...@@ -20,11 +20,6 @@ spring:
default-property-inclusion: NON_NULL default-property-inclusion: NON_NULL
# time-zone: GMT+8 # time-zone: GMT+8
# date-format: yyyy-MM-dd HH:mm:ss # date-format: yyyy-MM-dd HH:mm:ss
security:
enable: true
user:
name: admin
password: 1
redis: redis:
host: @profiles.redis.uri@ host: @profiles.redis.uri@
port: @profiles.redis.port@ port: @profiles.redis.port@
...@@ -58,7 +53,7 @@ spring: ...@@ -58,7 +53,7 @@ spring:
username: @profiles.rabbitmq.username@ username: @profiles.rabbitmq.username@
password: @profiles.rabbitmq.password@ password: @profiles.rabbitmq.password@
exchange-name: @profiles.rabbitmq.exchange@ exchange-name: @profiles.rabbitmq.exchange@
virtual-host: @profiles.rabbitmq.virtualhost1@ virtual-host: @profiles.rabbitmq.virtualhost@
publisher-returns: true publisher-returns: true
publisher-confirm-type: correlated publisher-confirm-type: correlated
dao: dao:
...@@ -98,44 +93,4 @@ sms: ...@@ -98,44 +93,4 @@ sms:
apiId: @profiles.sms.apiId@ apiId: @profiles.sms.apiId@
type: @profiles.sms.type@ type: @profiles.sms.type@
queue:
type: @profiles.queue.type@ # memory or kafka (Apache Kafka) or rabbitmq (RabbitMQ)
core:
topic: tb_core
poll-interval: 25
partitions: 10
pack-processing-timeout: 2000
in_memory:
stats:
print-interval-ms: 60000
kafka:
bootstrap.servers: @profiles.kafka.brokers@
acks: all
retries: 1
batch.size: 16384
linger.ms: 1
buffer.memory: 33554432
replication_factor: 1
max_poll_interval_ms: 300000
max_poll_records: 8192
max_partition_fetch_bytes: 16777216
fetch_max_bytes: 134217728
use_confluent_cloud: false
consumer-stats:
enabled: true
print-interval-ms: 60000
kafka-response-timeout-ms: 1000
rabbitmq:
exchange_name: @profiles.rabbitmq.exchange@
host: @profiles.rabbitmq.host@
port: @profiles.rabbitmq.port@
virtual_host: @profiles.rabbitmq.virtualhost@
username: @profiles.rabbitmq.username@
password: @profiles.rabbitmq.password@
automatic_recovery_enabled: false
connection_timeout: 5000
handshake_timeout: 10000
queue-properties:
x-message-ttl: 86400000
x-max-length-bytes: 1048576000
package producer;//package producer;
import cn.hutool.core.util.IdUtil;
import com.mortals.framework.model.AccessLogPdu;
import com.mortals.framework.model.BizLogPdu;
import com.mortals.framework.model.ErrorLogPdu;
import com.mortals.framework.model.OperateLogPdu;
import com.mortals.framework.service.IMessageProduceService;
import com.mortals.xhx.ManagerApplication;
import lombok.extern.slf4j.Slf4j;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
import java.util.Date;
@RunWith(SpringRunner.class)
@SpringBootTest(classes = ManagerApplication.class)
@Slf4j
public class ProducerTest {
@Autowired
private IMessageProduceService producer;
// private MessageProducer producer;
@Test
public void testSyncAccessSend() {
for (int i = 0; i < 50; i++) {
AccessLogPdu accessLogPdu = new AccessLogPdu();
accessLogPdu.initAttrValue();
accessLogPdu.setTraceID(IdUtil.fastSimpleUUID());
accessLogPdu.setLogTime(new Date());
producer.syncAccessSend(accessLogPdu);
log.info("[testSyncSend][发送编号:[{}] 发送成功]", accessLogPdu.getTraceID());
}
}
@Test
public void testSyncBizSend() {
for (int i = 0; i < 10; i++) {
BizLogPdu bizLogEntity = new BizLogPdu();
bizLogEntity.initAttrValue();
bizLogEntity.setTraceID(IdUtil.fastSimpleUUID());
bizLogEntity.setLogTime(new Date());
producer.syncBizSend(bizLogEntity);
log.info("[testSyncSend][发送编号:[{}] 发送成功]", bizLogEntity.getTraceID());
}
}
@Test
public void testSyncErrorSend() {
for (int i = 0; i < 10; i++) {
ErrorLogPdu errorLogPdu = new ErrorLogPdu();
errorLogPdu.initAttrValue();
errorLogPdu.setTraceID(IdUtil.fastSimpleUUID());
errorLogPdu.setLogTime(new Date());
producer.syncErrorSend(errorLogPdu);
log.info("[testSyncSend][发送编号:[{}] 发送成功]", errorLogPdu.getTraceID());
}
}
@Test
public void testSyncOperSend() {
for (int i = 0; i < 5; i++) {
OperateLogPdu operateLogPdu = new OperateLogPdu();
operateLogPdu.initAttrValue();
operateLogPdu.setIp("192.168.0.98");
operateLogPdu.setRequestUrl("requestUrl");
operateLogPdu.setUserId(1L);
operateLogPdu.setUserName("userName");
operateLogPdu.setLoginName("loginName");
operateLogPdu.setPlatformMark("platformMark");
operateLogPdu.setLogDate(new Date());
operateLogPdu.setContent("content");
operateLogPdu.setOperType(1);
producer.syncOperSend(operateLogPdu);
log.info("[testSyncOperSend][发送成功]");
}
}
}
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