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
c73ff423
Commit
c73ff423
authored
Sep 20, 2023
by
chenzhao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
分析诊断 增加TDengine 数据连接 替换原有influxDB查询并修改所用查询代码
parent
9d229f51
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
151 additions
and
11 deletions
+151
-11
pom.xml
...t-system-jxiop/amos-boot-module-jxiop-analyse-biz/pom.xml
+5
-0
AmosJxiopAnalyseApplication.java
...in/java/com/yeejoin/amos/AmosJxiopAnalyseApplication.java
+1
-1
ESEquipments.java
...eejoin/amos/boot/module/jxiop/biz/ESDto/ESEquipments.java
+3
-3
TdEngineConfig.java
...oin/amos/boot/module/jxiop/biz/config/TdEngineConfig.java
+3
-3
IdxBizFanPointTagController.java
...ule/jxiop/biz/controller/IdxBizFanPointTagController.java
+18
-0
TestController.java
...amos/boot/module/jxiop/biz/controller/TestController.java
+35
-0
IdxBizFanPointTag.java
.../amos/boot/module/jxiop/biz/entity/IdxBizFanPointTag.java
+2
-1
IndicatorData.java
...join/amos/boot/module/jxiop/biz/entity/IndicatorData.java
+2
-0
CommonServiceImpl.java
...boot/module/jxiop/biz/service/impl/CommonServiceImpl.java
+0
-0
IdxBizFanPointTagServiceImpl.java
.../jxiop/biz/service/impl/IdxBizFanPointTagServiceImpl.java
+46
-1
IndicatorDataMapper.java
...s/boot/module/jxiop/biz/tdmapper/IndicatorDataMapper.java
+17
-0
application-dev.properties
...analyse-biz/src/main/resources/application-dev.properties
+14
-2
IndicatorData.xml
...-biz/src/main/resources/mapper/tdengine/IndicatorData.xml
+5
-0
No files found.
amos-boot-system-jxiop/amos-boot-module-jxiop-analyse-biz/pom.xml
View file @
c73ff423
...
...
@@ -42,6 +42,11 @@
<version>
1.8.5-SNAPSHOT
</version>
<scope>
compile
</scope>
</dependency>
<dependency>
<groupId>
com.taosdata.jdbc
</groupId>
<artifactId>
taos-jdbcdriver
</artifactId>
<version>
3.2.4
</version>
</dependency>
</dependencies>
<build>
...
...
amos-boot-system-jxiop/amos-boot-module-jxiop-analyse-biz/src/main/java/com/yeejoin/amos/AmosJxiopAnalyseApplication.java
View file @
c73ff423
...
...
@@ -45,7 +45,7 @@ import java.net.InetAddress;
@EnableScheduling
@MapperScan
({
"org.typroject.tyboot.demo.face.orm.dao*"
,
"org.typroject.tyboot.face.*.orm.dao*"
,
"org.typroject.tyboot.core.auth.face.orm.dao*"
,
"org.typroject.tyboot.component.*.face.orm.dao*"
,
"com.yeejoin.amos.boot.module.**.api.mapper"
,
"com.yeejoin.amos.boot.biz.common.dao.mapper"
,
"com.yeejoin.amos.boot.module.common.biz.*"
,
"com.yeejoin.amos.boot.module.jxiop.api.mapper"
})
"com.yeejoin.amos.boot.module.**.api.mapper"
,
"com.yeejoin.amos.boot.biz.common.dao.mapper"
,
"com.yeejoin.amos.boot.module.common.biz.*"
,
"com.yeejoin.amos.boot.module.jxiop.api.mapper"
,
"com.yeejoin.amos.boot.module.jxiop.biz.tdmapper"
})
@ComponentScan
(
basePackages
=
{
"org.typroject"
,
"com.yeejoin.amos"
})
@SpringBootApplication
(
exclude
=
{
DataSourceAutoConfiguration
.
class
,
DruidDataSourceAutoConfigure
.
class
})
//@SpringBootApplication
...
...
amos-boot-system-jxiop/amos-boot-module-jxiop-analyse-biz/src/main/java/com/yeejoin/amos/boot/module/jxiop/biz/ESDto/ESEquipments.java
View file @
c73ff423
...
...
@@ -40,7 +40,7 @@ public class ESEquipments {
@Field
(
type
=
FieldType
.
Text
,
index
=
false
)
private
String
value
;
@Field
(
type
=
FieldType
.
Double
,
index
=
false
)
private
Double
valueDouble
;
private
Double
valueF
;
@Field
(
type
=
FieldType
.
Text
,
index
=
false
)
private
String
valueLabel
;
@Field
(
type
=
FieldType
.
Text
,
index
=
false
)
...
...
@@ -59,9 +59,9 @@ public class ESEquipments {
private
String
displayName
;
public
ESEquipments
(
Double
value
Double
,
String
id
,
String
address
,
String
dataType
,
String
equipmentSpecificName
,
String
gatewayId
,
String
isAlarm
,
Date
createdTime
,
String
unit
,
String
value
,
String
valueLabel
,
String
traceId
,
String
equipmentIndexName
,
String
equipmentNumber
,
String
frontModule
,
String
systemType
,
String
pictureName
,
String
displayName
)
{
public
ESEquipments
(
Double
value
F
,
String
id
,
String
address
,
String
dataType
,
String
equipmentSpecificName
,
String
gatewayId
,
String
isAlarm
,
Date
createdTime
,
String
unit
,
String
value
,
String
valueLabel
,
String
traceId
,
String
equipmentIndexName
,
String
equipmentNumber
,
String
frontModule
,
String
systemType
,
String
pictureName
,
String
displayName
)
{
this
.
value
Double
=
valueDouble
;
this
.
value
F
=
valueF
;
this
.
id
=
id
;
this
.
address
=
address
;
this
.
dataType
=
dataType
;
...
...
amos-boot-system-jxiop/amos-boot-module-jxiop-analyse-biz/src/main/java/com/yeejoin/amos/boot/module/jxiop/biz/config/TdEngineConfig.java
View file @
c73ff423
package
com
.
yeejoin
.
amos
.
config
;
package
com
.
yeejoin
.
amos
.
boot
.
module
.
jxiop
.
biz
.
config
;
import
com.alibaba.druid.pool.DruidDataSource
;
...
...
@@ -21,7 +21,7 @@ import javax.sql.DataSource;
* 若需要配置更多数据源 , 直接在yml中添加数据源配置再增加相应的新的数据源配置类即可
*/
@Configuration
@MapperScan
(
basePackages
=
"com.yeejoin.amos.
api.householdapi.face.orm.mapper.tdengine
"
,
sqlSessionFactoryRef
=
"taosSqlSessionFactory"
)
@MapperScan
(
basePackages
=
"com.yeejoin.amos.
boot.module.jxiop.biz.tdmapper
"
,
sqlSessionFactoryRef
=
"taosSqlSessionFactory"
)
public
class
TdEngineConfig
{
private
Logger
logger
=
LoggerFactory
.
getLogger
(
TdEngineConfig
.
class
);
// 精确到 cluster 目录,以便跟其他数据源隔离
...
...
@@ -64,7 +64,7 @@ public class TdEngineConfig {
sessionFactory
.
setDataSource
(
culsterDataSource
);
sessionFactory
.
setMapperLocations
(
new
PathMatchingResourcePatternResolver
()
.
getResources
(
TdEngineConfig
.
MAPPER_LOCATION
));
sessionFactory
.
setTypeAliasesPackage
(
"com.yeejoin.amos.
api.householdapi.face.orm.houseapi.entity.tdeingine
"
);
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-analyse-biz/src/main/java/com/yeejoin/amos/boot/module/jxiop/biz/controller/IdxBizFanPointTagController.java
View file @
c73ff423
...
...
@@ -15,6 +15,7 @@ import org.typroject.tyboot.core.restful.utils.ResponseModel;
import
javax.servlet.http.HttpServletRequest
;
import
java.util.List
;
import
java.util.Map
;
/**
*
...
...
@@ -112,4 +113,21 @@ public class IdxBizFanPointTagController extends BaseController {
public
ResponseModel
<
List
<
IdxBizFanPointTagDto
>>
selectForList
()
{
return
ResponseHelper
.
buildResponse
(
idxBizFanPointTagServiceImpl
.
queryForIdxBizFanPointTagList
());
}
/**
* 列表全部数据查询
*
* @return
*/
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
,
needAuth
=
false
)
@ApiOperation
(
httpMethod
=
"GET"
,
value
=
"筛选条件级联查询"
,
notes
=
"筛选条件级联查询"
)
@GetMapping
(
value
=
"/params"
)
public
ResponseModel
<
List
<
Map
<
String
,
Object
>>
>
selectForListByParams
(
@RequestParam
Map
<
String
,
Object
>
map
)
{
return
ResponseHelper
.
buildResponse
(
idxBizFanPointTagServiceImpl
.
selectForListByParams
(
map
));
}
}
amos-boot-system-jxiop/amos-boot-module-jxiop-analyse-biz/src/main/java/com/yeejoin/amos/boot/module/jxiop/biz/controller/TestController.java
0 → 100644
View file @
c73ff423
package
com
.
yeejoin
.
amos
.
boot
.
module
.
jxiop
.
biz
.
controller
;
import
com.yeejoin.amos.boot.biz.common.controller.BaseController
;
import
com.yeejoin.amos.boot.module.jxiop.biz.entity.IndicatorData
;
import
com.yeejoin.amos.boot.module.jxiop.biz.tdmapper.IndicatorDataMapper
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Controller
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestParam
;
import
org.springframework.web.bind.annotation.RestController
;
import
org.typroject.tyboot.core.foundation.enumeration.UserType
;
import
org.typroject.tyboot.core.restful.doc.TycloudOperation
;
import
java.util.List
;
@RestController
@RequestMapping
(
value
=
"/test"
)
@Api
(
tags
=
"测试Api"
)
public
class
TestController
extends
BaseController
{
@Autowired
IndicatorDataMapper
indicatorDataMapper
;
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
,
needAuth
=
false
)
@ApiOperation
(
httpMethod
=
"GET"
,
value
=
"test1"
,
notes
=
"test1"
)
@GetMapping
(
"/test1"
)
public
List
<
IndicatorData
>
test1
(
@RequestParam
(
value
=
"startTime"
)
String
startTime
,
@RequestParam
(
value
=
"endTime"
)
String
endTime
,
@RequestParam
(
value
=
"address"
)
String
address
,
@RequestParam
(
value
=
"gatewayId"
)
String
gatewayId
)
{
List
<
IndicatorData
>
indicatorData
=
indicatorDataMapper
.
selectDataByAddressAndtime
(
address
,
startTime
,
endTime
,
gatewayId
);
return
indicatorData
;
}
}
amos-boot-system-jxiop/amos-boot-module-jxiop-analyse-biz/src/main/java/com/yeejoin/amos/boot/module/jxiop/biz/entity/IdxBizFanPointTag.java
View file @
c73ff423
...
...
@@ -8,6 +8,7 @@ import lombok.EqualsAndHashCode;
import
lombok.experimental.Accessors
;
import
java.time.LocalDateTime
;
import
java.util.Date
;
/**
*
...
...
@@ -39,7 +40,7 @@ public class IdxBizFanPointTag{
*
*/
@TableField
(
"REC_DATE"
)
private
LocalDateTim
e
recDate
;
private
Dat
e
recDate
;
/**
*
...
...
amos-boot-system-jxiop/amos-boot-module-jxiop-analyse-biz/src/main/java/com/yeejoin/amos/boot/module/jxiop/biz/entity/IndicatorData.java
0 → 100644
View file @
c73ff423
package
com
.
yeejoin
.
amos
.
boot
.
module
.
jxiop
.
biz
.
entity
;
public
class
IndicatorData
{
}
amos-boot-system-jxiop/amos-boot-module-jxiop-analyse-biz/src/main/java/com/yeejoin/amos/boot/module/jxiop/biz/service/impl/CommonServiceImpl.java
View file @
c73ff423
This diff is collapsed.
Click to expand it.
amos-boot-system-jxiop/amos-boot-module-jxiop-analyse-biz/src/main/java/com/yeejoin/amos/boot/module/jxiop/biz/service/impl/IdxBizFanPointTagServiceImpl.java
View file @
c73ff423
package
com
.
yeejoin
.
amos
.
boot
.
module
.
jxiop
.
biz
.
service
.
impl
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.yeejoin.amos.boot.module.jxiop.biz.dto.IdxBizFanPointTagDto
;
import
com.yeejoin.amos.boot.module.jxiop.biz.entity.IdxBizFanPointTag
;
import
com.yeejoin.amos.boot.module.jxiop.biz.mapper2.IdxBizFanPointTagMapper
;
import
com.yeejoin.amos.boot.module.jxiop.biz.service.IIdxBizFanPointTagService
;
import
org.springframework.stereotype.Service
;
import
org.springframework.util.ObjectUtils
;
import
org.typroject.tyboot.core.rdbms.service.BaseService
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.stream.Collectors
;
/**
* 服务实现类
...
...
@@ -29,6 +35,44 @@ public class IdxBizFanPointTagServiceImpl extends BaseService<IdxBizFanPointTagD
* 列表查询 示例
*/
public
List
<
IdxBizFanPointTagDto
>
queryForIdxBizFanPointTagList
()
{
return
this
.
queryForList
(
""
,
false
);
return
this
.
queryForList
(
""
,
false
);
}
public
List
<
Map
<
String
,
Object
>>
selectForListByParams
(
Map
<
String
,
Object
>
map
)
{
LambdaQueryWrapper
<
IdxBizFanPointTag
>
queryWrapper
=
new
LambdaQueryWrapper
<>();
List
<
Map
<
String
,
Object
>>
result
=
new
ArrayList
<>();
if
(
ObjectUtils
.
isEmpty
(
map
))
{
queryWrapper
.
groupBy
(
IdxBizFanPointTag:
:
getArae
);
List
<
IdxBizFanPointTag
>
idxBizFanPointTags
=
this
.
getBaseMapper
().
selectList
(
queryWrapper
);
for
(
IdxBizFanPointTag
idxBizFanPointTag
:
idxBizFanPointTags
)
{
Map
<
String
,
Object
>
maps
=
new
HashMap
<>();
map
.
put
(
"value"
,
idxBizFanPointTag
.
getArae
());
result
.
add
(
map
);
}
}
else
if
(
map
.
containsKey
(
"ARAE"
)
&&
!
map
.
containsKey
(
"STATION"
))
{
queryWrapper
.
eq
(
IdxBizFanPointTag:
:
getArae
,
map
.
get
(
"ARAE"
));
queryWrapper
.
groupBy
(
IdxBizFanPointTag:
:
getStation
);
List
<
IdxBizFanPointTag
>
idxBizFanPointTags
=
this
.
getBaseMapper
().
selectList
(
queryWrapper
);
for
(
IdxBizFanPointTag
idxBizFanPointTag
:
idxBizFanPointTags
)
{
Map
<
String
,
Object
>
maps
=
new
HashMap
<>();
map
.
put
(
"value"
,
idxBizFanPointTag
.
getStation
());
result
.
add
(
map
);
}
}
else
if
(
map
.
containsKey
(
"STATION"
))
{
queryWrapper
.
eq
(
IdxBizFanPointTag:
:
getArae
,
map
.
get
(
"ARAE"
));
queryWrapper
.
eq
(
IdxBizFanPointTag:
:
getStation
,
map
.
get
(
"STATION"
));
queryWrapper
.
groupBy
(
IdxBizFanPointTag:
:
getNumber
);
List
<
IdxBizFanPointTag
>
idxBizFanPointTags
=
this
.
getBaseMapper
().
selectList
(
queryWrapper
);
for
(
IdxBizFanPointTag
idxBizFanPointTag
:
idxBizFanPointTags
)
{
Map
<
String
,
Object
>
maps
=
new
HashMap
<>();
map
.
put
(
"value"
,
idxBizFanPointTag
.
getNumber
());
result
.
add
(
map
);
}
}
return
result
;
}
}
\ No newline at end of file
amos-boot-system-jxiop/amos-boot-module-jxiop-analyse-biz/src/main/java/com/yeejoin/amos/boot/module/jxiop/biz/tdmapper/IndicatorDataMapper.java
0 → 100644
View file @
c73ff423
package
com
.
yeejoin
.
amos
.
boot
.
module
.
jxiop
.
biz
.
tdmapper
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
com.yeejoin.amos.boot.module.jxiop.biz.entity.IndicatorData
;
import
org.apache.ibatis.annotations.Param
;
import
org.apache.ibatis.annotations.Select
;
import
org.springframework.stereotype.Repository
;
import
java.util.List
;
@Repository
public
interface
IndicatorDataMapper
extends
BaseMapper
<
IndicatorData
>
{
@Select
(
"select `value` from iot_data.indicator_data where address=#{address} and createdtime >= #{startTime} and createdtime <= #{endTime} and gateway_id =#{gatewayId}"
)
List
<
IndicatorData
>
selectDataByAddressAndtime
(
@Param
(
"address"
)
String
address
,
@Param
(
"startTime"
)
String
startTime
,
@Param
(
"endTime"
)
String
endTime
,
@Param
(
"gatewayId"
)
String
gatewayId
);
}
amos-boot-system-jxiop/amos-boot-module-jxiop-analyse-biz/src/main/resources/application-dev.properties
View file @
c73ff423
...
...
@@ -53,16 +53,28 @@ lettuce.timeout=10000
emqx.clean-session
=
true
emqx.client-id
=
${spring.application.name}-${random.int[1024,65536]}
emqx.broker
=
tcp://172.16.10.2
20
:1883
emqx.broker
=
tcp://172.16.10.2
53
:1883
emqx.user-name
=
admin
emqx.password
=
public
mqtt.scene.host
=
mqtt://172.16.10.2
20
:8083/mqtt
mqtt.scene.host
=
mqtt://172.16.10.2
53
:8083/mqtt
mqtt.client.product.id
=
mqtt
mqtt.topic
=
topic_mqtt
spring.mqtt.completionTimeout
=
3000
emqx.max-inflight
=
1000
tdengine-server
:
driver-class-name
:
com.taosdata.jdbc.rs.RestfulDriver
jdbc-url
:
jdbc:TAOS-RS://139.9.170.47:6041/iot_data_1?user=root&password=taosdata&timezone=GMT%2b8&allowMultiQueries=true
username
:
root
password
:
taosdata
#spring.db3.datasource.type: com.alibaba.druid.pool.DruidDataSource
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
## influxDB
#spring.influx.url= http://172.16.3.155:18186
#spring.influx.password=Yeejoin@2020
...
...
amos-boot-system-jxiop/amos-boot-module-jxiop-analyse-biz/src/main/resources/mapper/tdengine/IndicatorData.xml
0 → 100644
View file @
c73ff423
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper
namespace=
"com.yeejoin.amos.boot.module.jxiop.biz.tdmapper.IndicatorDataMapper"
>
</mapper>
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