Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
amos-boot-biz
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
项目统一框架
amos-boot-biz
Commits
e012e7c0
Commit
e012e7c0
authored
Oct 09, 2023
by
tangwei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
增加TdEngine
parent
75f985d2
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
189 additions
and
26 deletions
+189
-26
pom.xml
...system-jxiop/amos-boot-module-jxiop-bigscreen-biz/pom.xml
+5
-0
TdEngineConfig.java
...oin/amos/boot/module/jxiop/biz/config/TdEngineConfig.java
+73
-0
IndicatorData.java
...join/amos/boot/module/jxiop/biz/entity/IndicatorData.java
+37
-0
LargeScreenImpl.java
...s/boot/module/jxiop/biz/service/impl/LargeScreenImpl.java
+8
-7
PowerGenerationImpl.java
...ot/module/jxiop/biz/service/impl/PowerGenerationImpl.java
+59
-19
application-dev.properties
...gscreen-biz/src/main/resources/application-dev.properties
+7
-0
No files found.
amos-boot-system-jxiop/amos-boot-module-jxiop-bigscreen-biz/pom.xml
View file @
e012e7c0
...
@@ -41,6 +41,11 @@
...
@@ -41,6 +41,11 @@
<version>
1.9.0-SNAPSHOT
</version>
<version>
1.9.0-SNAPSHOT
</version>
<scope>
compile
</scope>
<scope>
compile
</scope>
</dependency>
</dependency>
<dependency>
<groupId>
com.taosdata.jdbc
</groupId>
<artifactId>
taos-jdbcdriver
</artifactId>
<version>
3.2.4
</version>
</dependency>
</dependencies>
</dependencies>
<build>
<build>
...
...
amos-boot-system-jxiop/amos-boot-module-jxiop-bigscreen-biz/src/main/java/com/yeejoin/amos/boot/module/jxiop/biz/config/TdEngineConfig.java
0 → 100644
View file @
e012e7c0
package
com
.
yeejoin
.
amos
.
boot
.
module
.
jxiop
.
biz
.
config
;
import
com.alibaba.druid.pool.DruidDataSource
;
import
com.baomidou.mybatisplus.extension.spring.MybatisSqlSessionFactoryBean
;
import
org.apache.ibatis.session.SqlSessionFactory
;
import
org.mybatis.spring.annotation.MapperScan
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Qualifier
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.core.io.support.PathMatchingResourcePatternResolver
;
import
org.springframework.jdbc.datasource.DataSourceTransactionManager
;
import
javax.sql.DataSource
;
/**
* 从数据源配置
* 若需要配置更多数据源 , 直接在yml中添加数据源配置再增加相应的新的数据源配置类即可
*/
@Configuration
@MapperScan
(
basePackages
=
"com.yeejoin.amos.boot.module.jxiop.biz.tdmapper"
,
sqlSessionFactoryRef
=
"taosSqlSessionFactory"
)
public
class
TdEngineConfig
{
private
Logger
logger
=
LoggerFactory
.
getLogger
(
TdEngineConfig
.
class
);
// 精确到 cluster 目录,以便跟其他数据源隔离
private
static
final
String
MAPPER_LOCATION
=
"classpath*:mapper/tdengine/*.xml"
;
@Value
(
"${spring.db3.datasource.url}"
)
private
String
dbUrl
;
@Value
(
"${spring.db3.datasource.username}"
)
private
String
username
;
@Value
(
"${spring.db3.datasource.password}"
)
private
String
password
;
@Value
(
"${spring.db3.datasource.driver-class-name}"
)
private
String
driverClassName
;
@Bean
(
name
=
"taosDataSource"
)
//声明其为Bean实例
public
DataSource
clusterDataSource
()
{
DruidDataSource
datasource
=
new
DruidDataSource
();
datasource
.
setUrl
(
this
.
dbUrl
);
datasource
.
setUsername
(
username
);
datasource
.
setPassword
(
password
);
datasource
.
setDriverClassName
(
driverClassName
);
return
datasource
;
}
@Bean
(
name
=
"taosTransactionManager"
)
public
DataSourceTransactionManager
clusterTransactionManager
()
{
return
new
DataSourceTransactionManager
(
clusterDataSource
());
}
@Bean
(
name
=
"taosSqlSessionFactory"
)
public
SqlSessionFactory
clusterSqlSessionFactory
(
@Qualifier
(
"taosDataSource"
)
DataSource
culsterDataSource
)
throws
Exception
{
final
MybatisSqlSessionFactoryBean
sessionFactory
=
new
MybatisSqlSessionFactoryBean
();
sessionFactory
.
setDataSource
(
culsterDataSource
);
sessionFactory
.
setMapperLocations
(
new
PathMatchingResourcePatternResolver
()
.
getResources
(
TdEngineConfig
.
MAPPER_LOCATION
));
sessionFactory
.
setTypeAliasesPackage
(
"com.yeejoin.amos.boot.module.jxiop.biz.entity"
);
//mybatis 数据库字段与实体类属性驼峰映射配置
sessionFactory
.
getObject
().
getConfiguration
().
setMapUnderscoreToCamelCase
(
true
);
return
sessionFactory
.
getObject
();
}
}
amos-boot-system-jxiop/amos-boot-module-jxiop-bigscreen-biz/src/main/java/com/yeejoin/amos/boot/module/jxiop/biz/entity/IndicatorData.java
0 → 100644
View file @
e012e7c0
package
com
.
yeejoin
.
amos
.
boot
.
module
.
jxiop
.
biz
.
entity
;
import
lombok.Data
;
import
java.util.Date
;
@Data
public
class
IndicatorData
{
private
String
id
;
private
String
address
;
private
String
dataType
;
private
String
equipmentSpecificName
;
private
String
gatewayId
;
private
String
isAlarm
;
private
Date
createdTime
;
private
String
unit
;
private
String
value
;
private
Float
valueF
;
private
String
valueLabel
;
private
String
equipmentIndexName
;
private
String
equipmentNumber
;
private
String
displayName
;
}
amos-boot-system-jxiop/amos-boot-module-jxiop-bigscreen-biz/src/main/java/com/yeejoin/amos/boot/module/jxiop/biz/service/impl/LargeScreenImpl.java
View file @
e012e7c0
...
@@ -306,6 +306,7 @@ public class LargeScreenImpl {
...
@@ -306,6 +306,7 @@ public class LargeScreenImpl {
ybfbn
=
new
BigDecimal
(
ybfbn
).
setScale
(
2
,
BigDecimal
.
ROUND_HALF_UP
).
doubleValue
();
ybfbn
=
new
BigDecimal
(
ybfbn
).
setScale
(
2
,
BigDecimal
.
ROUND_HALF_UP
).
doubleValue
();
mapdta
.
put
(
"NJHWC"
,
ybfbn
);
mapdta
.
put
(
"NJHWC"
,
ybfbn
);
try
{
try
{
System
.
out
.
println
(
JSON
.
toJSONString
(
mapdta
));
emqKeeper
.
getMqttClient
().
publish
(
"qyyxzb/"
+
s
,
JSON
.
toJSONString
(
mapdta
).
getBytes
(),
0
,
false
);
emqKeeper
.
getMqttClient
().
publish
(
"qyyxzb/"
+
s
,
JSON
.
toJSONString
(
mapdta
).
getBytes
(),
0
,
false
);
}
catch
(
MqttException
e
)
{
}
catch
(
MqttException
e
)
{
e
.
printStackTrace
();
e
.
printStackTrace
();
...
@@ -417,13 +418,13 @@ public class LargeScreenImpl {
...
@@ -417,13 +418,13 @@ public class LargeScreenImpl {
List
<
String
>
value
=
new
ArrayList
<>();
List
<
String
>
value
=
new
ArrayList
<>();
value
.
add
(
RSD
);
value
.
add
(
RSD
);
Map
<
String
,
List
<
String
>>
map
=
new
HashMap
<>();
Map
<
String
,
List
<
String
>>
map
=
new
HashMap
<>();
map
.
put
(
"equipmentIndexName"
,
value
);
map
.
put
(
"equipmentIndexName
.keyword
"
,
value
);
List
<
String
>
value1
=
new
ArrayList
<>();
List
<
String
>
value1
=
new
ArrayList
<>();
value1
.
add
(
monthy
);
value1
.
add
(
monthy
);
map
.
put
(
"moon"
,
value1
);
map
.
put
(
"moon
.keyword
"
,
value1
);
List
<?
extends
Terms
.
Bucket
>
lidate
=
commonServiceImpl
.
getgroupsum
(
map
,
"value"
,
"day"
,
ESDailyPowerGeneration
.
class
);
List
<?
extends
Terms
.
Bucket
>
lidate
=
commonServiceImpl
.
getgroupsum
(
map
,
"value"
,
"day
.keyword
"
,
ESDailyPowerGeneration
.
class
);
Map
<
String
,
Double
>
mapdta
=
new
HashMap
<>();
Map
<
String
,
Double
>
mapdta
=
new
HashMap
<>();
DecimalFormat
format2
=
new
DecimalFormat
(
"#.0000"
);
DecimalFormat
format2
=
new
DecimalFormat
(
"#.0000"
);
...
@@ -466,13 +467,13 @@ public class LargeScreenImpl {
...
@@ -466,13 +467,13 @@ public class LargeScreenImpl {
List
<
String
>
value
=
new
ArrayList
<>();
List
<
String
>
value
=
new
ArrayList
<>();
value
.
add
(
RSD
);
value
.
add
(
RSD
);
Map
<
String
,
List
<
String
>>
map
=
new
HashMap
<>();
Map
<
String
,
List
<
String
>>
map
=
new
HashMap
<>();
map
.
put
(
"equipmentIndexName"
,
value
);
map
.
put
(
"equipmentIndexName
.keyword
"
,
value
);
map
.
put
(
"gatewayId"
,
gatewayId
);
map
.
put
(
"gatewayId
.keyword
"
,
gatewayId
);
List
<
String
>
value1
=
new
ArrayList
<>();
List
<
String
>
value1
=
new
ArrayList
<>();
value1
.
add
(
monthy
);
value1
.
add
(
monthy
);
map
.
put
(
"moon"
,
value1
);
map
.
put
(
"moon
.keyword
"
,
value1
);
List
<?
extends
Terms
.
Bucket
>
lidate
=
commonServiceImpl
.
getgroupsum
(
map
,
"value"
,
"day"
,
ESDailyPowerGeneration
.
class
);
List
<?
extends
Terms
.
Bucket
>
lidate
=
commonServiceImpl
.
getgroupsum
(
map
,
"value"
,
"day
.keyword
"
,
ESDailyPowerGeneration
.
class
);
Map
<
String
,
Double
>
mapdta
=
new
HashMap
<>();
Map
<
String
,
Double
>
mapdta
=
new
HashMap
<>();
DecimalFormat
format2
=
new
DecimalFormat
(
"#.0000"
);
DecimalFormat
format2
=
new
DecimalFormat
(
"#.0000"
);
...
...
amos-boot-system-jxiop/amos-boot-module-jxiop-bigscreen-biz/src/main/java/com/yeejoin/amos/boot/module/jxiop/biz/service/impl/PowerGenerationImpl.java
View file @
e012e7c0
This diff is collapsed.
Click to expand it.
amos-boot-system-jxiop/amos-boot-module-jxiop-bigscreen-biz/src/main/resources/application-dev.properties
View file @
e012e7c0
...
@@ -12,6 +12,13 @@ spring.db2.datasource.username=root
...
@@ -12,6 +12,13 @@ spring.db2.datasource.username=root
spring.db2.datasource.password
=
Yeejoin@2020
spring.db2.datasource.password
=
Yeejoin@2020
spring.db2.datasource.driver-class-name
:
com.mysql.cj.jdbc.Driver
spring.db2.datasource.driver-class-name
:
com.mysql.cj.jdbc.Driver
spring.db3.datasource.url
=
jdbc:TAOS-RS://139.9.170.47:6041/iot_data?user=root&password=taosdata&timezone=GMT%2b8&allowMultiQueries=true
spring.db3.datasource.username
=
root
spring.db3.datasource.password
=
taosdata
spring.db3.datasource.driver-class-name
:
com.taosdata.jdbc.rs.RestfulDriver
## eureka properties:
## eureka properties:
eureka.instance.hostname
=
172.16.10.220
eureka.instance.hostname
=
172.16.10.220
eureka.client.serviceUrl.defaultZone
=
http://admin:a1234560@${eureka.instance.hostname}:10001/eureka/
eureka.client.serviceUrl.defaultZone
=
http://admin:a1234560@${eureka.instance.hostname}:10001/eureka/
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment