Merge remote-tracking branch 'upstream/develop' into develop

pull/77/head
Caozhenhui 2021-11-01 09:24:34 +08:00
commit 01bce323b9
26 changed files with 16900 additions and 6462 deletions

View File

@ -16,6 +16,28 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
### Removed
- None.
## [v1.3.3] - 2021-10-30
### Added
- added missing rule_id in myems_fdd_db.
### Changed
- updated package.json in web ui
- updated README and database test procedure
- added validation of offline meter hourly values to myems-normalization service
- updated offline meter data template file
- added new period type 'weekly' to meterenergy and aggregate_hourly_data_by_period in API
- updated comments in aggregate_hourly_data_by_period of API
- updated myems-api installation.
### Fixed
- fixed NoneType error in myems-cleaning service
- fixed warnings in myems-aggregation service
- fixed detailed data sort issues in Web UI
### Removed
- removed duplicate entry in i18n of Web UI
- removed unused import from API.
## [v1.3.2] - 2021-10-22
### Added
- added associated equipments data to combinedequipmentefficiency report.
@ -504,7 +526,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
### Removed
- None.
[Unreleased]: https://github.com/MyEMS/myems/compare/v1.3.2...HEAD
[Unreleased]: https://github.com/MyEMS/myems/compare/v1.3.3...HEAD
[v1.3.3]: https://github.com/MyEMS/myems/compare/v1.3.2...v1.3.3
[v1.3.2]: https://github.com/MyEMS/myems/compare/v1.3.1...v1.3.2
[v1.3.1]: https://github.com/MyEMS/myems/compare/v1.3.0...v1.3.1
[v1.3.0]: https://github.com/MyEMS/myems/compare/v1.2.3...v1.3.0

View File

@ -175,16 +175,17 @@ sed -i 's/127.0.0.1/192.168.0.2/g' myems-normalization/.env
**3.3** 测试数据库是否可以正确连接
```
python3 myems/database/test_mysql.py
cd myems
python3 myems-api/test_mysql.py
```
注:如果测试通过,继续下一步操作,否则请修改.env配置确保数据库可以通过Python3正常连接访问
注:如果测试通过,继续下一步操作,否则请修改.env配置。
- 4.web打包 (myems/web为React项目需要打包为产品文件)
- 4.web打包 (Web UI 为React项目需要打包为产品文件)
```
cd myems/web
npm install
npm install
npm run build
```
@ -197,7 +198,6 @@ docker-compose up -d
```
- 6.测试

View File

@ -1,5 +1,5 @@
<div class="footer-login">
<div>
<strong>{{'MY_EMS_NAME' | translate}} v1.3.2 <a href="https://myems.io">https://myems.io</a> </strong>
<strong>{{'MY_EMS_NAME' | translate}} v1.3.3 <a href="https://myems.io">https://myems.io</a> </strong>
</div>
</div>

View File

@ -3,6 +3,6 @@
<strong><a href="https://myems.io">https://myems.io</a></strong>
</div>
<div>
<strong>{{'MY_EMS_NAME' | translate}} v1.3.2</strong>
<strong>{{'MY_EMS_NAME' | translate}} v1.3.3</strong>
</div>
</div>

View File

@ -2,14 +2,18 @@
### Introduction
Providing database schema and scripts for MyEMS.
Database schema and scripts for MyEMS.
### Prerequisites
[MySQL 8.0 or later](https://www.mysql.com/)
[MySQL 8.0 (64bit) or later](https://www.mysql.com/)
or [MariaDB 10.5 or later](https://mariadb.org/)
or
or [SingleStore 7.0 or later](https://www.singlestore.com/) (highly recommended)
[MariaDB 10.5 (64bit) or later](https://mariadb.org/)
or
[SingleStore 7.0 or later](https://www.singlestore.com/)
### Installation
@ -56,6 +60,8 @@ set global net_buffer_length=1000000;
set global max_allowed_packet=1000000000;
```
#### Don't Install Database in Docker
### Database Definition
#### myems_billing_baseline_db

View File

@ -14,6 +14,7 @@ DROP TABLE IF EXISTS `myems_fdd_db`.`tbl_email_messages` ;
CREATE TABLE IF NOT EXISTS `myems_fdd_db`.`tbl_email_messages` (
`id` BIGINT NOT NULL AUTO_INCREMENT,
`rule_id` BIGINT NOT NULL,
`recipient_name` VARCHAR(128) NOT NULL,
`recipient_email` VARCHAR(128) NOT NULL,
`subject` VARCHAR(128) NOT NULL,
@ -82,6 +83,7 @@ DROP TABLE IF EXISTS `myems_fdd_db`.`tbl_text_messages_outbox` ;
CREATE TABLE IF NOT EXISTS `myems_fdd_db`.`tbl_text_messages_outbox` (
`id` BIGINT NOT NULL AUTO_INCREMENT,
`rule_id` BIGINT NOT NULL,
`recipient_name` VARCHAR(32) NOT NULL,
`recipient_mobile` VARCHAR(32) NOT NULL,
`message` LONGTEXT NOT NULL,
@ -114,6 +116,7 @@ DROP TABLE IF EXISTS `myems_fdd_db`.`tbl_web_messages` ;
CREATE TABLE IF NOT EXISTS `myems_fdd_db`.`tbl_web_messages` (
`id` BIGINT NOT NULL AUTO_INCREMENT,
`rule_id` BIGINT NOT NULL,
`user_id` BIGINT NOT NULL,
`subject` VARCHAR(128) NOT NULL,
`category` VARCHAR(128) NOT NULL COMMENT 'SYSTEM, SPACE, METER, TENANT, STORE, SHOPFLOOR, EQUIPMENT, COMBINEDEQUIPMENT',
@ -147,6 +150,7 @@ DROP TABLE IF EXISTS `myems_fdd_db`.`tbl_wechat_messages_outbox` ;
CREATE TABLE IF NOT EXISTS `myems_fdd_db`.`tbl_wechat_messages_outbox` (
`id` BIGINT NOT NULL AUTO_INCREMENT,
`rule_id` BIGINT NOT NULL,
`recipient_name` VARCHAR(32) NOT NULL,
`recipient_openid` VARCHAR(32) NOT NULL,
`message_template_id` VARCHAR(64) NOT NULL,

View File

@ -1243,6 +1243,6 @@ USE `myems_system_db`;
INSERT INTO `myems_system_db`.`tbl_versions`
(`id`, `version`, `release_date`)
VALUES
(1, '1.3.2', '2021-10-22');
(1, '1.3.3', '2021-10-30');
COMMIT;

View File

@ -1,28 +0,0 @@
import mysql.connector
import config
def test_connect():
cursor = None
cnx = None
try:
cnx = mysql.connector.connect(**config.myems_user_db)
cursor = cnx.cursor()
query = (" SELECT id, name, display_name, email "
" FROM tbl_users "
" ORDER BY id ")
cursor.execute(query)
rows = cursor.fetchall()
print("The config of database is right:", rows)
except Exception as e:
print("The config of database is wrong:", str(e))
finally:
if cursor:
cursor.close()
if cnx:
cnx.disconnect()
if __name__ == "__main__":
test_connect()

View File

@ -0,0 +1,10 @@
-- PLEASE CHECK YOUR DATABASE TABLES BELOW, IF rule_id IS MISSING, THEN RUN BELOW STATEMENTS
-- IF rule_id EXISTS, THEN IGNORE THESE STATEMENTS
ALTER TABLE myems_fdd_db.tbl_email_messages ADD rule_id BIGINT NOT NULL AFTER id;
ALTER TABLE myems_fdd_db.tbl_text_messages_outbox ADD rule_id BIGINT NOT NULL AFTER id;
ALTER TABLE myems_fdd_db.tbl_web_messages ADD rule_id BIGINT NOT NULL AFTER id;
ALTER TABLE myems_fdd_db.tbl_wechat_messages_outbox ADD rule_id BIGINT NOT NULL AFTER id;
-- UPDATE VERSION NUMBER
UPDATE myems_system_db.tbl_versions SET version='1.3.3', release_date='2021-10-30' WHERE id=1;

View File

@ -15,8 +15,8 @@ class VersionItem:
@staticmethod
def on_get(req, resp):
result = {"version": 'MyEMS v1.3.2',
"release-date": '2021-10-22',
result = {"version": 'MyEMS v1.3.3',
"release-date": '2021-10-30',
"website": "https://myems.io"}
resp.body = json.dumps(result)

View File

@ -97,9 +97,9 @@ $ pip3 install simplejson
# 安装mysql-connector-python
$ cd ~/tools
$ wget https://dev.mysql.com/get/Downloads/Connector-Python/mysql-connector-python-8.0.20.tar.gz
$ tar xzf mysql-connector-python-8.0.20.tar.gz
$ cd ~/tools/mysql-connector-python-8.0.20
$ wget https://dev.mysql.com/get/Downloads/Connector-Python/mysql-connector-python-8.0.23.tar.gz
$ tar xzf mysql-connector-python-8.0.23.tar.gz
$ cd ~/tools/mysql-connector-python-8.0.23
$ sudo python3 setup.py install
# 安装Falcon

26
myems-api/test_mysql.py Normal file
View File

@ -0,0 +1,26 @@
import mysql.connector
import config
if __name__ == "__main__":
cursor = None
cnx = None
try:
cnx = mysql.connector.connect(**config.myems_system_db)
cursor = cnx.cursor()
query = (" SELECT version "
" FROM tbl_versions "
" WHERE id = 1 ")
cursor.execute(query)
row = cursor.fetchone()
if row is not None and len(row) > 0:
print("The database version is : ", str(row[0]))
except Exception as e:
print("There is something wrong with database :", str(e))
finally:
if cursor:
cursor.close()
if cnx:
cnx.disconnect()

View File

@ -98,7 +98,7 @@ cp -r ~/myems/myems-normalization /myems-normalization
```
Create .env file based on example.env and edit the .env file if needed:
```bash
cp /myems-normalization/example.env /myems-cleaning/.env
cp /myems-normalization/example.env /myems-normalization/.env
nano /myems-normalization/.env
```
Setup systemd service:

2
web/README.md vendored
View File

@ -29,7 +29,7 @@ npx -v
* Download all the necessary dependencies into the node_modules directory.
```bash
cd myems/web
sudo npm i --unsafe-perm=true --allow-root
sudo npm i --unsafe-perm=true --allow-root --legacy-peer-deps
```
* If you modified any scss files then you need to compile SCSS, else you can safely ignore this step.
Run below command in your project directory to compile scss.

2
web/gulpfile.js vendored
View File

@ -1,6 +1,6 @@
const gulp = require('gulp');
const plumber = require('gulp-plumber');
const sass = require('gulp-sass');
const sass = require('gulp-sass')(require('sass'));
const autoprefixer = require('gulp-autoprefixer');
const rtlcss = require('gulp-rtlcss');
const rename = require('gulp-rename');

23188
web/package-lock.json generated vendored

File diff suppressed because it is too large Load Diff

9
web/package.json vendored
View File

@ -1,6 +1,6 @@
{
"name": "myems",
"version": "1.3.2",
"version": "1.3.3",
"private": true,
"dependencies": {
"@fortawesome/fontawesome-free": "^5.15.1",
@ -35,7 +35,7 @@
"leaflet.tilelayer.colorfilter": "^1.2.5",
"lodash": "^4.17.20",
"moment": "^2.28.0",
"node-sass": "^4.14.1",
"node-sass": "^6.0.1",
"plyr": "^3.6.2",
"prism-react-renderer": "^0.1.7",
"prism-themes": "^1.4.0",
@ -97,8 +97,9 @@
"gulp-plumber": "^1.2.1",
"gulp-rename": "^1.4.0",
"gulp-rtlcss": "^1.4.1",
"gulp-sass": "^4.1.0",
"gulp-sass": "^5.0.0",
"gulp-sourcemaps": "^2.6.5",
"prettier": "1.17.1"
"prettier": "1.17.1",
"sass": "^1.43.4"
}
}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1,4 +1,4 @@
export const version = '1.3.2';
export const version = '1.3.3';
export const navbarBreakPoint = 'xl'; // Vertical navbar breakpoint
export const topNavbarBreakpoint = 'lg';
//export const APIBaseURL = 'http://127.0.0.1:8000';