feat: 调整 & 添加 tsdb 支持(demo)

This commit is contained in:
pnoker
2021-09-18 20:34:23 +08:00
parent 0bec1d8909
commit 525b1b00a1
86 changed files with 318 additions and 99 deletions
+25 -14
View File
@@ -1,9 +1,3 @@
:rocket: 项目文档请阅读 [`IOT DC3 Wiki (https://doc.dc3.site)`](https://doc.dc3.site) !
:boom: 你的 `Star` 是我开发的动力,下载源码 `git clone https://gitee.com/pnoker/iot-dc3.git` !
:seedling: 为了便于你的二次开发和理解,`DC3` 开源了 `Demo Web UI` , https://gitee.com/pnoker/dc3-web
<p align="center">
<img src="./docs/images/dc3/logo-blue.png" width="400"><br>
<a href='https://gitee.com/pnoker/iot-dc3/stargazers'><img src='https://gitee.com/pnoker/iot-dc3/badge/star.svg?theme=gvp' alt='star'></img></a>
@@ -16,8 +10,6 @@
<br><strong>DC3是基于Spring Cloud的开源可分布式物联网(IOT)平台,用于快速开发、部署物联设备接入项目,是一整套物联系统解决方案。<br>IOT DC3 is an open source, distributed Internet of Things (IOT) platform based on Spring Cloud. It is used for rapid development of IOT projects and management of IOT devices. It is a set of solutions for IOT system.</strong>
</p>
------
@@ -25,6 +17,8 @@
![iot-dc3-architecture](./docs/images/dc3/architecture1.jpg)
#### DC3 模块划分,四层架构
* [x] 驱动层:用于提供标准或者私有协议连接物理设备的 `SDK`,负责南向设备的数据采集和指令控制,基于 `SDK` 可实现驱动的快速开发;
@@ -32,6 +26,8 @@
* [x] 管理层:用于提供微服务注册中心、设备指令接口、设备注册与关联配对、数据管理中心,是所有微服务交互的核心部分,负责各类配置数据的管理,并对外提供接口服务;
* [ ] 应用层(开发中...):用于提供数据开放、任务调度、报警与消息通知、日志管理等,具备对接第三方平台能力。
#### DC3 功能设计,定位目标
* [x] 可伸缩:水平可伸缩的平台,构建使用领先的 `Spring Cloud` 开源技术;
@@ -41,8 +37,8 @@
* [x] 跨平台:使用 `Java` 环境可异地、分布式多平台部署;
* [x] 自主可控:私有云、公有云、边缘部署;
* [X] 完善性:设备快速接入、注册、权限校验;
* [ ] 安全(开发中...):数据加密传输;
* [ ] 多租户(开发中...):命名空间,多租户化;
* [ ] 安全(开发中...):数据加密传输(mqtt 驱动已实现数据加密传输);
* [x] 多租户:命名空间,多租户化;
* [X] 云原生:Kubernetes;
* [x] 容器化:Docker。
@@ -55,8 +51,6 @@
![iot-dc3-architecture](./docs/images/dc3/architecture2.jpg)
[`Spring Cloud Netflix`](https://cloud.spring.io/spring-cloud-netflix)、[`Spring Cloud Gateway`](https://cloud.spring.io/spring-cloud-gateway)、[`Spring Cloud Security`](https://cloud.spring.io/spring-cloud-security)、[`Spring Cloud OpenFeign`](https://cloud.spring.io/spring-cloud-openfeign) 等微服务模块。
### 3 项目文档
@@ -65,6 +59,23 @@
>
> **其中包括:安装配置文档、部署文档、项目结构说明、平台介绍等内容。**
> **入门:一睹为快,快速启动一个,[`Demo Application (https://web.dc3.site)`](https://web.dc3.site) !**
> **入门:一睹为快,快速启动一个!**
>
> 请阅读 [`快速开始`](https://doc.dc3.site/#/quick-start?id=%e4%b8%80%e7%9d%b9%e4%b8%ba%e5%bf%ab) 文档
> 请阅读 [`快速开始`](https://doc.dc3.site/#/quick-start?id=%e4%b8%80%e7%9d%b9%e4%b8%ba%e5%bf%ab) 文档
### 4 开源贡献
- 从 `master` 分支 `checkout` 一个新分支(**注**:*请务必保证 `master` 代码是最新的*)
- 新分支命名格式:`docs/username_description`,例如:`docs/pnoker_新增mqtt使用说明`
- 在新分支上编辑文档,并提交代码
- 最后 `PR` 合并到 `develop` 分支,等待作者合并即可
### 5 开源协议
`IOT DC3` 开源平台遵循 [Apache 2.0 协议](https://www.apache.org/licenses/LICENSE-2.0.html)。 允许商业使用,但务必保留类作者、Copyright 信息。
@@ -24,7 +24,7 @@ import org.springframework.web.bind.annotation.RequestHeader;
import java.util.List;
/**
* <p>字典 FeignClient
* 字典 FeignClient
*
* @author pnoker
*/
@@ -26,7 +26,7 @@ import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
/**
* <p>令牌 FeignClient
* 令牌 FeignClient
*
* @author pnoker
*/
@@ -23,7 +23,7 @@ import org.springframework.stereotype.Component;
import java.util.List;
/**
* <p>DictionaryClientHystrix
* DictionaryClientHystrix
*
* @author pnoker
*/
@@ -21,7 +21,7 @@ import org.springframework.cloud.openfeign.FallbackFactory;
import org.springframework.stereotype.Component;
/**
* <p>TokenClientHystrix
* TokenClientHystrix
*
* @author pnoker
*/
@@ -25,7 +25,7 @@ import javax.validation.constraints.NotNull;
import java.util.List;
/**
* <p>批量导入 FeignClient
* 批量导入 FeignClient
*
* @author pnoker
*/
@@ -26,7 +26,7 @@ import javax.validation.constraints.NotNull;
import java.util.List;
/**
* <p>字典 FeignClient
* 字典 FeignClient
*
* @author pnoker
*/
@@ -32,7 +32,7 @@ import javax.validation.constraints.NotNull;
import java.util.List;
/**
* <p>驱动配置属性 FeignClient
* 驱动配置属性 FeignClient
*
* @author pnoker
*/
@@ -28,7 +28,7 @@ import org.springframework.web.bind.annotation.*;
import javax.validation.constraints.NotNull;
/**
* <p>驱动 FeignClient
* 驱动 FeignClient
*
* @author pnoker
*/
@@ -32,7 +32,7 @@ import javax.validation.constraints.NotNull;
import java.util.List;
/**
* <p>驱动配置信息 FeignClient
* 驱动配置信息 FeignClient
*
* @author pnoker
*/
@@ -28,7 +28,7 @@ import org.springframework.web.bind.annotation.*;
import javax.validation.constraints.NotNull;
/**
* <p>分组 FeignClient
* 分组 FeignClient
*
* @author pnoker
*/
@@ -28,7 +28,7 @@ import org.springframework.web.bind.annotation.*;
import javax.validation.constraints.NotNull;
/**
* <p>标签 FeignClient
* 标签 FeignClient
*
* @author pnoker
*/
@@ -32,7 +32,7 @@ import javax.validation.constraints.NotNull;
import java.util.List;
/**
* <p>位号配置属性 FeignClient
* 位号配置属性 FeignClient
*
* @author pnoker
*/
@@ -31,7 +31,7 @@ import java.util.Map;
import java.util.Set;
/**
* <p>位号 FeignClient
* 位号 FeignClient
*
* @author pnoker
*/
@@ -32,7 +32,7 @@ import javax.validation.constraints.NotNull;
import java.util.List;
/**
* <p>位号配置信息 FeignClient
* 位号配置信息 FeignClient
*
* @author pnoker
*/
@@ -29,7 +29,7 @@ import javax.validation.constraints.NotNull;
import java.util.List;
/**
* <p>模板 FeignClient
* 模板 FeignClient
*
* @author pnoker
*/
@@ -21,7 +21,7 @@ import org.springframework.cloud.openfeign.FallbackFactory;
import org.springframework.stereotype.Component;
/**
* <p>AutoClientHystrix
* AutoClientHystrix
*
* @author pnoker
*/
@@ -24,7 +24,7 @@ import org.springframework.web.multipart.MultipartFile;
import java.util.List;
/**
* <p>ImportClientHystrix
* ImportClientHystrix
*
* @author pnoker
*/
@@ -25,7 +25,7 @@ import org.springframework.stereotype.Component;
import java.util.List;
/**
* <p>DeviceClientHystrix
* DeviceClientHystrix
*
* @author pnoker
*/
@@ -23,7 +23,7 @@ import org.springframework.stereotype.Component;
import java.util.List;
/**
* <p>DictionaryClientHystrix
* DictionaryClientHystrix
*
* @author pnoker
*/
@@ -26,7 +26,7 @@ import javax.validation.constraints.NotNull;
import java.util.List;
/**
* <p>DriverAttributeClient
* DriverAttributeClient
*
* @author pnoker
*/
@@ -23,7 +23,7 @@ import org.springframework.cloud.openfeign.FallbackFactory;
import org.springframework.stereotype.Component;
/**
* <p>DriverClientHystrix
* DriverClientHystrix
*
* @author pnoker
*/
@@ -25,7 +25,7 @@ import org.springframework.stereotype.Component;
import java.util.List;
/**
* <p>DriverInfoClientHystrix
* DriverInfoClientHystrix
*
* @author pnoker
*/
@@ -23,7 +23,7 @@ import org.springframework.cloud.openfeign.FallbackFactory;
import org.springframework.stereotype.Component;
/**
* <p>GroupClientHystrix
* GroupClientHystrix
*
* @author pnoker
*/
@@ -23,7 +23,7 @@ import org.springframework.cloud.openfeign.FallbackFactory;
import org.springframework.stereotype.Component;
/**
* <p>LabelClientHystrix
* LabelClientHystrix
*
* @author pnoker
*/
@@ -26,7 +26,7 @@ import javax.validation.constraints.NotNull;
import java.util.List;
/**
* <p>PointAttributeClientHystrix
* PointAttributeClientHystrix
*
* @author pnoker
*/
@@ -27,7 +27,7 @@ import java.util.Map;
import java.util.Set;
/**
* <p>PointClientHystrix
* PointClientHystrix
*
* @author pnoker
*/
@@ -25,7 +25,7 @@ import org.springframework.stereotype.Component;
import java.util.List;
/**
* <p>PointInfoClientHystrix
* PointInfoClientHystrix
*
* @author pnoker
*/
@@ -25,7 +25,7 @@ import org.springframework.stereotype.Component;
import java.util.List;
/**
* <p>ProfileClientHystrix
* ProfileClientHystrix
*
* @author pnoker
*/
@@ -24,7 +24,7 @@ import org.springframework.stereotype.Component;
import java.util.Map;
/**
* <p>DeviceClientHystrix
* DeviceClientHystrix
*
* @author pnoker
*/
@@ -35,7 +35,7 @@ import javax.annotation.Resource;
import java.util.Optional;
/**
* <p>TenantBindService Impl
* TenantBindService Impl
*
* @author pnoker
*/
@@ -1,3 +1,16 @@
/*
* Copyright 2016-2021 Pnoker. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.dc3.center.data.config;
import lombok.extern.slf4j.Slf4j;
@@ -1,3 +1,16 @@
/*
* Copyright 2016-2021 Pnoker. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.dc3.center.data.config;
import lombok.extern.slf4j.Slf4j;
@@ -13,11 +13,18 @@
package com.dc3.center.data.service.impl;
import com.alibaba.fastjson.JSON;
import com.dc3.center.data.service.DataCustomService;
import com.dc3.common.bean.point.PointValue;
import com.dc3.common.bean.point.TsPointValue;
import com.google.common.collect.Lists;
import lombok.extern.slf4j.Slf4j;
import okhttp3.*;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
/**
@@ -27,6 +34,11 @@ import java.util.List;
@Service
public class DataCustomServiceImpl implements DataCustomService {
private static final String putUrl = "";
@Resource
private OkHttpClient okHttpClient;
@Override
public void preHandle(PointValue pointValue) {
// TODO 接收数据之后,存储数据之前的操作
@@ -34,16 +46,81 @@ public class DataCustomServiceImpl implements DataCustomService {
@Override
public void postHandle(PointValue pointValue) {
// TODO 接收数据之后,存储数据的时候的操作,此处可以自定义逻辑,将数据存放到别的数据库,或者发送到别的地方
String metric = pointValue.getDeviceId().toString();
List<TsPointValue> tsPointValues = convertToTsPointValues(metric, pointValue);
savePointValueToOpenTsdb(tsPointValues);
}
@Override
public void postHandle(Long deviceId, List<PointValue> pointValues) {
// TODO 接收数据之后,存储数据的时候的操作,此处可以自定义逻辑,将数据存放到别的数据库,或者发送到别的地方
String metric = deviceId.toString();
List<TsPointValue> tsPointValues = pointValues.stream()
.map(pointValue -> convertToTsPointValues(metric, pointValue))
.reduce(new ArrayList<>(), (first, second) -> {
first.addAll(second);
return first;
});
List<List<TsPointValue>> partition = Lists.partition(tsPointValues, 100);
partition.forEach(this::savePointValueToOpenTsdb);
}
@Override
public void afterHandle(PointValue pointValue) {
// TODO 接收数据之后,存储数据之后的操作
// TODO 接收数据之后,存储数据的时候的操作,此处可以自定义逻辑,将数据存放到别的数据库,或者发送到别的地方
}
/**
* convert point value to opentsdb point value
*
* @param metric Metric Name
* @param pointValue Point Value
* @return TsPointValue Array
*/
private List<TsPointValue> convertToTsPointValues(String metric, PointValue pointValue) {
String point = pointValue.getPointId().toString();
String value = pointValue.getValue();
Long timestamp = pointValue.getOriginTime().getTime();
List<TsPointValue> tsPointValues = new ArrayList<>(4);
TsPointValue tsValue = new TsPointValue(metric, value);
tsValue.setTimestamp(timestamp)
.addTag("point", point)
.addTag("valueType", "value");
tsPointValues.add(tsValue);
TsPointValue tsRawValue = new TsPointValue(metric, value);
tsRawValue.setTimestamp(timestamp)
.addTag("point", point)
.addTag("valueType", "rawValue");
tsPointValues.add(tsRawValue);
return tsPointValues;
}
/**
* send point value to opentsdb
*
* @param tsPointValues TsPointValue Array
*/
private void savePointValueToOpenTsdb(List<TsPointValue> tsPointValues) {
RequestBody requestBody = RequestBody.create(MediaType.parse("application/json;charset=utf-8"), JSON.toJSONString(tsPointValues));
Request request = new Request.Builder()
.url(putUrl)
.post(requestBody)
.build();
try {
Response response = okHttpClient.newCall(request).execute();
ResponseBody body = response.body();
if (null != body) {
log.debug("send pointValue to opentsdb {}: {}", response.message(), body.string());
body.close();
}
response.close();
} catch (IOException e) {
log.error("send pointValue to opentsdb error: {}", e.getMessage());
}
}
}
@@ -20,7 +20,7 @@ import org.springframework.context.annotation.AdviceMode;
import org.springframework.transaction.annotation.EnableTransactionManagement;
/**
* <p>设备管理服务入口
* 设备管理服务入口
*
* @author pnoker
*/
@@ -25,7 +25,7 @@ import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
/**
* <p>自发现 Client 接口实现
* 自发现 Client 接口实现
*
* @author pnoker
*/
@@ -31,7 +31,7 @@ import javax.annotation.Resource;
import java.util.List;
/**
* <p>批量导入 Client 接口实现
* 批量导入 Client 接口实现
*
* @author pnoker
*/
@@ -29,7 +29,7 @@ import javax.annotation.Resource;
import java.util.List;
/**
* <p>设备 Client 接口实现
* 设备 Client 接口实现
*
* @author pnoker
*/
@@ -27,7 +27,7 @@ import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
/**
* <p>驱动 Client 接口实现
* 驱动 Client 接口实现
*
* @author pnoker
*/
@@ -30,7 +30,7 @@ import java.util.ArrayList;
import java.util.List;
/**
* <p>驱动连接配置信息 Client 接口实现
* 驱动连接配置信息 Client 接口实现
*
* @author pnoker
*/
@@ -29,7 +29,7 @@ import javax.annotation.Resource;
import java.util.List;
/**
* <p>位号配置信息 Client 接口实现
* 位号配置信息 Client 接口实现
*
* @author pnoker
*/
@@ -27,7 +27,7 @@ import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
/**
* <p>设备 Client 接口实现
* 设备 Client 接口实现
*
* @author pnoker
*/
@@ -27,7 +27,7 @@ import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
/**
* <p>标签 Client 接口实现
* 标签 Client 接口实现
*
* @author pnoker
*/
@@ -31,7 +31,7 @@ import java.util.Map;
import java.util.Set;
/**
* <p>位号 Client 接口实现
* 位号 Client 接口实现
*
* @author pnoker
*/
@@ -30,7 +30,7 @@ import java.util.ArrayList;
import java.util.List;
/**
* <p>驱动属性配置信息 Client 接口实现
* 驱动属性配置信息 Client 接口实现
*
* @author pnoker
*/
@@ -29,7 +29,7 @@ import javax.annotation.Resource;
import java.util.List;
/**
* <p>位号配置信息 Client 接口实现
* 位号配置信息 Client 接口实现
*
* @author pnoker
*/
@@ -29,7 +29,7 @@ import javax.annotation.Resource;
import java.util.List;
/**
* <p>模板 Client 接口实现
* 模板 Client 接口实现
*
* @author pnoker
*/
@@ -27,7 +27,7 @@ import javax.annotation.Resource;
import java.util.Map;
/**
* <p>设备 Client 接口实现
* 设备 Client 接口实现
*
* @author pnoker
*/
@@ -1,3 +1,16 @@
/*
* Copyright 2016-2021 Pnoker. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.dc3.center.manager.config;
import lombok.extern.slf4j.Slf4j;
@@ -16,7 +16,7 @@ package com.dc3.center.manager.service;
import com.dc3.common.bean.point.PointDetail;
/**
* <p>Auto Interface
* Auto Interface
*
* @author pnoker
*/
@@ -19,7 +19,7 @@ import com.dc3.common.bean.driver.DriverMetadata;
import java.util.List;
/**
* <p>BatchService Interface
* BatchService Interface
*
* @author pnoker
*/
@@ -21,7 +21,7 @@ import java.util.List;
import java.util.Set;
/**
* <p>Device Interface
* Device Interface
*
* @author pnoker
*/
@@ -20,7 +20,7 @@ import com.dc3.common.model.DriverAttribute;
import java.util.List;
/**
* <p>DriverAttribute Interface
* DriverAttribute Interface
*
* @author pnoker
*/
@@ -20,7 +20,7 @@ import com.dc3.common.model.DriverInfo;
import java.util.List;
/**
* <p>DriverInfo Interface
* DriverInfo Interface
*
* @author pnoker
*/
@@ -16,7 +16,7 @@ package com.dc3.center.manager.service;
import com.dc3.common.bean.driver.DriverRegister;
/**
* <p>Driver Sdk Interface
* Driver Sdk Interface
*
* @author pnoker
*/
@@ -21,7 +21,7 @@ import java.util.List;
import java.util.Set;
/**
* <p>Driver Interface
* Driver Interface
*
* @author pnoker
*/
@@ -18,7 +18,7 @@ import com.dc3.common.dto.GroupDto;
import com.dc3.common.model.Group;
/**
* <p>Group Interface
* Group Interface
*
* @author pnoker
*/
@@ -18,7 +18,7 @@ import com.dc3.common.dto.LabelBindDto;
import com.dc3.common.model.LabelBind;
/**
* <p>LabelBind Interface
* LabelBind Interface
*
* @author pnoker
*/
@@ -18,7 +18,7 @@ import com.dc3.common.dto.LabelDto;
import com.dc3.common.model.Label;
/**
* <p>Label Interface
* Label Interface
*
* @author pnoker
*/
@@ -16,7 +16,7 @@ package com.dc3.center.manager.service;
import com.dc3.common.model.*;
/**
* <p>Notify Interface
* Notify Interface
*
* @author pnoker
*/
@@ -20,7 +20,7 @@ import com.dc3.common.model.PointAttribute;
import java.util.List;
/**
* <p>PointAttribute Interface
* PointAttribute Interface
*
* @author pnoker
*/
@@ -20,7 +20,7 @@ import com.dc3.common.model.PointInfo;
import java.util.List;
/**
* <p>PointInfo Interface
* PointInfo Interface
*
* @author pnoker
*/
@@ -22,7 +22,7 @@ import java.util.Map;
import java.util.Set;
/**
* <p>Point Interface
* Point Interface
*
* @author pnoker
*/
@@ -20,7 +20,7 @@ import com.dc3.common.model.ProfileBind;
import java.util.Set;
/**
* <p>ProfileBind Interface
* ProfileBind Interface
*
* @author pnoker
*/
@@ -21,7 +21,7 @@ import java.util.List;
import java.util.Set;
/**
* <p>Profile Interface
* Profile Interface
*
* @author pnoker
*/
@@ -19,7 +19,7 @@ import com.dc3.common.dto.DriverDto;
import java.util.Map;
/**
* <p>Device Interface
* Device Interface
*
* @author pnoker
*/
@@ -33,7 +33,7 @@ import java.util.concurrent.ConcurrentHashMap;
import java.util.stream.Collectors;
/**
* <p>BatchService Impl
* BatchService Impl
*
* @author pnoker
*/
@@ -43,7 +43,7 @@ import java.util.Optional;
import java.util.Set;
/**
* <p>DeviceService Impl
* DeviceService Impl
*
* @author pnoker
*/
@@ -37,7 +37,7 @@ import javax.annotation.Resource;
import java.util.List;
/**
* <p>DriverAttributeService Impl
* DriverAttributeService Impl
*
* @author pnoker
*/
@@ -37,7 +37,7 @@ import java.util.List;
import java.util.Optional;
/**
* <p>DriverInfoService Impl
* DriverInfoService Impl
*
* @author pnoker
*/
@@ -32,7 +32,7 @@ import java.util.List;
import java.util.Map;
/**
* <p>DriverService Impl
* DriverService Impl
*
* @author pnoker
*/
@@ -42,7 +42,7 @@ import java.util.Set;
import java.util.stream.Collectors;
/**
* <p>DriverService Impl
* DriverService Impl
*
* @author pnoker
*/
@@ -37,7 +37,7 @@ import javax.annotation.Resource;
import java.util.Optional;
/**
* <p>GroupService Impl
* GroupService Impl
*
* @author pnoker
*/
@@ -36,7 +36,7 @@ import javax.annotation.Resource;
import java.util.Optional;
/**
* <p>LabelBindService Impl
* LabelBindService Impl
*
* @author pnoker
*/
@@ -39,7 +39,7 @@ import javax.annotation.Resource;
import java.util.Optional;
/**
* <p>LabelService Impl
* LabelService Impl
*
* @author pnoker
*/
@@ -38,7 +38,7 @@ import java.util.List;
import java.util.Optional;
/**
* <p>PointAttributeService Impl
* PointAttributeService Impl
*
* @author pnoker
*/
@@ -41,7 +41,7 @@ import java.util.Set;
import java.util.stream.Collectors;
/**
* <p>PointInfoService Impl
* PointInfoService Impl
*
* @author pnoker
*/
@@ -39,7 +39,7 @@ import java.util.*;
import java.util.stream.Collectors;
/**
* <p>PointService Impl
* PointService Impl
*
* @author pnoker
*/
@@ -39,7 +39,7 @@ import java.util.Set;
import java.util.stream.Collectors;
/**
* <p>ProfileBindService Impl
* ProfileBindService Impl
*
* @author pnoker
*/
@@ -45,7 +45,7 @@ import java.util.Set;
import java.util.stream.Collectors;
/**
* <p>ProfileService Impl
* ProfileService Impl
*
* @author pnoker
*/
@@ -32,7 +32,7 @@ import java.util.HashMap;
import java.util.Map;
/**
* <p>DeviceService Impl
* DeviceService Impl
*
* @author pnoker
*/
@@ -30,6 +30,8 @@ import java.util.List;
import java.util.concurrent.TimeUnit;
/**
* MongoDB 位号数据
*
* @author pnoker
*/
@Data
@@ -0,0 +1,86 @@
/*
* Copyright 2016-2021 Pnoker. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.dc3.common.bean.point;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.ToString;
import lombok.experimental.Accessors;
import java.io.Serializable;
import java.util.HashMap;
import java.util.Map;
/**
* OpenTSDB 位号数据
*
* @author pnoker
*/
@Data
@NoArgsConstructor
@AllArgsConstructor
@Accessors(chain = true)
@ToString(callSuper = true)
public class TsPointValue implements Serializable {
private String metric;
private Long timestamp;
private Object value;
private Map<String, String> tags = new HashMap<>(4);
public TsPointValue addTag(String tagName, String tagValue) {
this.tags.put(tagName, tagValue);
return this;
}
public TsPointValue(String metric, Integer value) {
this.metric = metric;
this.timestamp = System.currentTimeMillis();
this.value = value;
}
public TsPointValue(String metric, Float value) {
this.metric = metric;
this.timestamp = System.currentTimeMillis();
this.value = value;
}
public TsPointValue(String metric, String value) {
this.metric = metric;
this.timestamp = System.currentTimeMillis();
this.value = value;
}
public TsPointValue(String metric, Integer value, String tagName, String tagValue) {
this.metric = metric;
this.timestamp = System.currentTimeMillis();
this.value = value;
addTag(tagName, tagValue);
}
public TsPointValue(String metric, Float value, String tagName, String tagValue) {
this.metric = metric;
this.timestamp = System.currentTimeMillis();
this.value = value;
addTag(tagName, tagValue);
}
public TsPointValue(String metric, String value, String tagName, String tagValue) {
this.metric = metric;
this.timestamp = System.currentTimeMillis();
this.value = value;
addTag(tagName, tagValue);
}
}
@@ -20,7 +20,7 @@ import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
/**
* <p>MybatisPlus配置
* MybatisPlus配置
*
* @author : pnoker
*/
@@ -20,7 +20,7 @@ import com.dc3.common.bean.driver.AttributeInfo;
import java.util.Map;
/**
* <p>自定义驱动接口,开发的自定义驱动需要实现 read 和 write 接口,可以参考以提供的驱动模块写法</p>
* 自定义驱动接口,开发的自定义驱动需要实现 read 和 write 接口,可以参考以提供的驱动模块写法</p>
*
* <ol>
* <li>{@link DriverCustomService#initial} 初始化操作,需要根据不同的驱动实现该功能</li>
+8 -4
View File
@@ -1,13 +1,12 @@
## 🏆 荣誉
<p align="center">
<img src="./images/dc3/gitee/1000-start.jpg" width="30%" alt="GiteeStart">
<br>
<img src="./images/dc3/gitee/gvp.jpg" width="70%" alt="GiteeGVP">
<p/>
## 💡 贡献
期待能有更多的开发者参与到 `IOT DC3` 的开发中来,我会保证尽快 Review PR 并且及时回复。提交 PR 请确保
@@ -16,7 +15,7 @@
2. 遵守开发规范
3. 如若需要,请更新相对应的文档
也非常欢迎开发者能为 `IOT DC3` 提供更多的示例,共同来完善文档(./docs/)。
也非常欢迎开发者能为 `IOT DC3` 提供更多的示例,共同来完善文档(`./docs/`)。
- 遇到任何问题,请提交 [issue](https://gitee.com/pnoker/iot-dc3/issues) ,标明遇到的问题、开发环境和如何复现,作者每周会进行定期处理;
- 提出新想法和设计方案。
@@ -27,4 +26,9 @@
> DC3 开源项目纯个人兴趣爱好,从16年开始利用业余时间开始设计、开发和测试,如果感兴趣参与可以 Email 说明。
:whale2: 邮箱: pnokers@gmail.com
:whale2: 邮箱 : pnokers@gmail.com
**:beers:** QQ群: 224029423
**:fire::fire::fire: 拒绝一切广告!!! 拒绝一切广告!!! 拒绝一切广告!!!****