Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
mqttsnet
thinglinks
提交
9e3d838c
thinglinks
项目概览
mqttsnet
/
thinglinks
通知
1
Star
2
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
thinglinks
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
9e3d838c
编写于
2月 18, 2022
作者:
xiaonannet
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'release/1.0.0' into main
上级
b8a65337
0a66e6c3
变更
27
隐藏空白更改
内联
并排
Showing
27 changed file
with
344 addition
and
58 deletion
+344
-58
doc/nacos-config/DEFAULT_GROUP/thinglinks-broker-dev.yml
doc/nacos-config/DEFAULT_GROUP/thinglinks-broker-dev.yml
+1
-1
doc/nacos-config/DEFAULT_GROUP/thinglinks-link-dev.yml
doc/nacos-config/DEFAULT_GROUP/thinglinks-link-dev.yml
+2
-2
doc/nacos-config/DEFAULT_GROUP/thinglinks-system-dev.yml
doc/nacos-config/DEFAULT_GROUP/thinglinks-system-dev.yml
+2
-2
thinglinks-auth/src/main/resources/bootstrap.yml
thinglinks-auth/src/main/resources/bootstrap.yml
+2
-2
thinglinks-gateway/src/main/resources/bootstrap.yml
thinglinks-gateway/src/main/resources/bootstrap.yml
+3
-3
thinglinks-modules/thinglinks-modules-broker/src/main/resources/bootstrap.yml
...hinglinks-modules-broker/src/main/resources/bootstrap.yml
+2
-2
thinglinks-modules/thinglinks-modules-file/src/main/resources/bootstrap.yml
.../thinglinks-modules-file/src/main/resources/bootstrap.yml
+2
-2
thinglinks-modules/thinglinks-modules-gen/src/main/resources/bootstrap.yml
...s/thinglinks-modules-gen/src/main/resources/bootstrap.yml
+2
-2
thinglinks-modules/thinglinks-modules-job/src/main/resources/bootstrap.yml
...s/thinglinks-modules-job/src/main/resources/bootstrap.yml
+2
-2
thinglinks-modules/thinglinks-modules-link/src/main/java/com/mqttsnet/thinglinks/link/controller/device/DeviceController.java
...t/thinglinks/link/controller/device/DeviceController.java
+45
-0
thinglinks-modules/thinglinks-modules-link/src/main/java/com/mqttsnet/thinglinks/link/controller/product/ProductController.java
...thinglinks/link/controller/product/ProductController.java
+17
-5
thinglinks-modules/thinglinks-modules-link/src/main/java/com/mqttsnet/thinglinks/link/mapper/device/DeviceMapper.java
.../mqttsnet/thinglinks/link/mapper/device/DeviceMapper.java
+16
-0
thinglinks-modules/thinglinks-modules-link/src/main/java/com/mqttsnet/thinglinks/link/mapper/product/ProductMapper.java
...qttsnet/thinglinks/link/mapper/product/ProductMapper.java
+4
-0
thinglinks-modules/thinglinks-modules-link/src/main/java/com/mqttsnet/thinglinks/link/service/device/DeviceService.java
...qttsnet/thinglinks/link/service/device/DeviceService.java
+25
-0
thinglinks-modules/thinglinks-modules-link/src/main/java/com/mqttsnet/thinglinks/link/service/device/impl/DeviceServiceImpl.java
...hinglinks/link/service/device/impl/DeviceServiceImpl.java
+76
-0
thinglinks-modules/thinglinks-modules-link/src/main/java/com/mqttsnet/thinglinks/link/service/product/ProductService.java
...tsnet/thinglinks/link/service/product/ProductService.java
+7
-5
thinglinks-modules/thinglinks-modules-link/src/main/java/com/mqttsnet/thinglinks/link/service/product/impl/ProductServiceImpl.java
...nglinks/link/service/product/impl/ProductServiceImpl.java
+33
-11
thinglinks-modules/thinglinks-modules-link/src/main/resources/bootstrap.yml
.../thinglinks-modules-link/src/main/resources/bootstrap.yml
+2
-2
thinglinks-modules/thinglinks-modules-link/src/main/resources/mapper/link/device/DeviceMapper.xml
...nk/src/main/resources/mapper/link/device/DeviceMapper.xml
+67
-0
thinglinks-modules/thinglinks-modules-link/src/main/resources/mapper/link/product/ProductMapper.xml
.../src/main/resources/mapper/link/product/ProductMapper.xml
+12
-0
thinglinks-modules/thinglinks-modules-system/src/main/resources/bootstrap.yml
...hinglinks-modules-system/src/main/resources/bootstrap.yml
+2
-2
thinglinks-modules/thinglinks-modules-tdengine/pom.xml
thinglinks-modules/thinglinks-modules-tdengine/pom.xml
+1
-1
thinglinks-modules/thinglinks-modules-tdengine/readme.md
thinglinks-modules/thinglinks-modules-tdengine/readme.md
+2
-2
thinglinks-modules/thinglinks-modules-tdengine/src/main/java/com/mqttsnet/thinglinks/tdengine/mapper/WeatherMapper.xml
...com/mqttsnet/thinglinks/tdengine/mapper/WeatherMapper.xml
+6
-6
thinglinks-modules/thinglinks-modules-tdengine/src/main/resources/bootstrap.yml
...nglinks-modules-tdengine/src/main/resources/bootstrap.yml
+2
-2
thinglinks-visual/thinglinks-visual-collection/src/main/resources/bootstrap.yml
...glinks-visual-collection/src/main/resources/bootstrap.yml
+2
-2
thinglinks-visual/thinglinks-visual-monitor/src/main/resources/bootstrap.yml
...hinglinks-visual-monitor/src/main/resources/bootstrap.yml
+7
-2
未找到文件。
doc/nacos-config/DEFAULT_GROUP/thinglinks-broker-dev.yml
浏览文件 @
9e3d838c
...
...
@@ -114,7 +114,7 @@ smqtt:
url
:
127.0.0.1:7771,127.0.0.1:7772
# 启动节点
port
:
7771
# 端口
node
:
node-1
# 集群节点名称 唯一
namespace
:
mqtt
s
namespace
:
thinglink
s
external
:
host
:
localhost
# 用于映射容器ip 请不要随意设置,如果不需要请移除此选项
port
:
7777
# 用于映射容器端口 请不要随意设置,如果不需要请移除此选项
...
...
doc/nacos-config/DEFAULT_GROUP/thinglinks-link-dev.yml
浏览文件 @
9e3d838c
...
...
@@ -30,8 +30,8 @@ spring:
# 主库数据源
master
:
driver-class-name
:
com.mysql.cj.jdbc.Driver
url
:
jdbc:mysql://127.0.0.1:3306/
mqtt
s?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
username
:
mqtt
s
url
:
jdbc:mysql://127.0.0.1:3306/
thinglink
s?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
username
:
thinglink
s
password
:
D8K8KzHyTeXFLKez
# 从库数据源
# slave:
...
...
doc/nacos-config/DEFAULT_GROUP/thinglinks-system-dev.yml
浏览文件 @
9e3d838c
...
...
@@ -62,13 +62,13 @@ seata:
nacos
:
serverAddr
:
127.0.0.1:8848
group
:
SEATA_GROUP
namespace
:
fffe6c69-d6cb-44fd-b542-8167d8a0c29d
namespace
:
1e1aff6c-da73-43e2-9e5f-8e0b890189d9
registry
:
type
:
nacos
nacos
:
application
:
seata-server
server-addr
:
127.0.0.1:8848
namespace
:
fffe6c69-d6cb-44fd-b542-8167d8a0c29d
namespace
:
1e1aff6c-da73-43e2-9e5f-8e0b890189d9
# mybatis配置
mybatis
:
...
...
thinglinks-auth/src/main/resources/bootstrap.yml
浏览文件 @
9e3d838c
...
...
@@ -19,12 +19,12 @@ spring:
# 服务注册地址
server-addr
:
49.235.122.136:8848
#命名空间
namespace
:
fffe6c69-d6cb-44fd-b542-8167d8a0c29d
namespace
:
1e1aff6c-da73-43e2-9e5f-8e0b890189d9
config
:
# 配置中心地址
server-addr
:
49.235.122.136:8848
#命名空间
namespace
:
fffe6c69-d6cb-44fd-b542-8167d8a0c29d
namespace
:
1e1aff6c-da73-43e2-9e5f-8e0b890189d9
# 配置文件格式
file-extension
:
yml
# 共享配置
...
...
thinglinks-gateway/src/main/resources/bootstrap.yml
浏览文件 @
9e3d838c
...
...
@@ -19,12 +19,12 @@ spring:
# 服务注册地址
server-addr
:
49.235.122.136:8848
#命名空间
namespace
:
fffe6c69-d6cb-44fd-b542-8167d8a0c29d
namespace
:
1e1aff6c-da73-43e2-9e5f-8e0b890189d9
config
:
# 配置中心地址
server-addr
:
49.235.122.136:8848
#命名空间
namespace
:
fffe6c69-d6cb-44fd-b542-8167d8a0c29d
namespace
:
1e1aff6c-da73-43e2-9e5f-8e0b890189d9
# 配置文件格式
file-extension
:
yml
# 共享配置
...
...
@@ -43,7 +43,7 @@ spring:
nacos
:
server-addr
:
49.235.122.136:8848
#命名空间
namespace
:
fffe6c69-d6cb-44fd-b542-8167d8a0c29d
namespace
:
1e1aff6c-da73-43e2-9e5f-8e0b890189d9
dataId
:
sentinel-mqtts-gateway
groupId
:
DEFAULT_GROUP
data-type
:
json
...
...
thinglinks-modules/thinglinks-modules-broker/src/main/resources/bootstrap.yml
浏览文件 @
9e3d838c
...
...
@@ -19,12 +19,12 @@ spring:
# 配置中心地址
server-addr
:
49.235.122.136:8848
#命名空间
namespace
:
fffe6c69-d6cb-44fd-b542-8167d8a0c29d
namespace
:
1e1aff6c-da73-43e2-9e5f-8e0b890189d9
config
:
# 配置中心地址
server-addr
:
49.235.122.136:8848
#命名空间
namespace
:
fffe6c69-d6cb-44fd-b542-8167d8a0c29d
namespace
:
1e1aff6c-da73-43e2-9e5f-8e0b890189d9
# 配置文件格式
file-extension
:
yml
# 共享配置
...
...
thinglinks-modules/thinglinks-modules-file/src/main/resources/bootstrap.yml
浏览文件 @
9e3d838c
...
...
@@ -19,12 +19,12 @@ spring:
# 配置中心地址
server-addr
:
49.235.122.136:8848
#命名空间
namespace
:
fffe6c69-d6cb-44fd-b542-8167d8a0c29d
namespace
:
1e1aff6c-da73-43e2-9e5f-8e0b890189d9
config
:
# 配置中心地址
server-addr
:
49.235.122.136:8848
#命名空间
namespace
:
fffe6c69-d6cb-44fd-b542-8167d8a0c29d
namespace
:
1e1aff6c-da73-43e2-9e5f-8e0b890189d9
# 配置文件格式
file-extension
:
yml
# 共享配置
...
...
thinglinks-modules/thinglinks-modules-gen/src/main/resources/bootstrap.yml
浏览文件 @
9e3d838c
...
...
@@ -19,12 +19,12 @@ spring:
# 配置中心地址
server-addr
:
49.235.122.136:8848
#命名空间
namespace
:
fffe6c69-d6cb-44fd-b542-8167d8a0c29d
namespace
:
1e1aff6c-da73-43e2-9e5f-8e0b890189d9
config
:
# 配置中心地址
server-addr
:
49.235.122.136:8848
#命名空间
namespace
:
fffe6c69-d6cb-44fd-b542-8167d8a0c29d
namespace
:
1e1aff6c-da73-43e2-9e5f-8e0b890189d9
# 配置文件格式
file-extension
:
yml
# 共享配置
...
...
thinglinks-modules/thinglinks-modules-job/src/main/resources/bootstrap.yml
浏览文件 @
9e3d838c
...
...
@@ -19,12 +19,12 @@ spring:
# 配置中心地址
server-addr
:
49.235.122.136:8848
#命名空间
namespace
:
fffe6c69-d6cb-44fd-b542-8167d8a0c29d
namespace
:
1e1aff6c-da73-43e2-9e5f-8e0b890189d9
config
:
# 配置中心地址
server-addr
:
49.235.122.136:8848
#命名空间
namespace
:
fffe6c69-d6cb-44fd-b542-8167d8a0c29d
namespace
:
1e1aff6c-da73-43e2-9e5f-8e0b890189d9
# 配置文件格式
file-extension
:
yml
# 共享配置
...
...
thinglinks-modules/thinglinks-modules-link/src/main/java/com/mqttsnet/thinglinks/link/controller/device/DeviceController.java
浏览文件 @
9e3d838c
...
...
@@ -6,6 +6,7 @@ import javax.servlet.http.HttpServletResponse;
import
com.mqttsnet.thinglinks.common.core.annotation.NoRepeatSubmit
;
import
com.mqttsnet.thinglinks.common.core.domain.R
;
import
com.mqttsnet.thinglinks.common.core.utils.StringUtils
;
import
com.mqttsnet.thinglinks.common.core.utils.poi.ExcelUtil
;
import
com.mqttsnet.thinglinks.common.core.web.controller.BaseController
;
import
com.mqttsnet.thinglinks.common.core.web.domain.AjaxResult
;
...
...
@@ -119,4 +120,48 @@ public class DeviceController extends BaseController {
@RequestParam
(
value
=
"protocolType"
,
required
=
true
)
String
protocolType
)
{
return
R
.
ok
(
deviceService
.
findOneByClientIdAndUserNameAndPasswordAndDeviceStatusAndProtocolType
(
clientId
,
userName
,
password
,
deviceStatus
,
protocolType
));
}
/**
*校验clientId是否存在
* @param clientId
* @return
*/
@PreAuthorize
(
hasPermi
=
"link:device:remove"
)
@Log
(
title
=
"设备管理"
,
businessType
=
BusinessType
.
OTHER
)
@GetMapping
(
value
=
"/validationfindOneByClientId/{clientId}"
)
public
AjaxResult
validationfindOneByClientId
(
@PathVariable
(
"clientId"
)
String
clientId
)
{
Device
findOneByClientId
=
deviceService
.
findOneByClientId
(
clientId
);
if
(
StringUtils
.
isNull
(
findOneByClientId
)){
AjaxResult
.
success
(
"clientId可用"
);
}
return
AjaxResult
.
error
(
"clientId已存在"
);
}
/**
*校验设备标识是否存在
* @param deviceIdentification
* @return
*/
@GetMapping
(
value
=
"/validationFindOneByDeviceIdentification/{deviceIdentification}"
)
public
AjaxResult
validationFindOneByDeviceIdentification
(
@PathVariable
(
"deviceIdentification"
)
String
deviceIdentification
)
{
Device
findOneByDeviceIdentification
=
deviceService
.
findOneByDeviceIdentification
(
deviceIdentification
);
if
(
StringUtils
.
isNull
(
findOneByDeviceIdentification
)){
AjaxResult
.
success
(
"设备标识可用"
);
}
return
AjaxResult
.
error
(
"设备标识已存在"
);
}
/**
* 设备断开连接接口
*//*
@PreAuthorize(hasPermi = "link:device:remove")
@Log(title = "设备管理", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids)
{
return toAjax(deviceService.deleteDeviceByIds(ids));
}*/
}
thinglinks-modules/thinglinks-modules-link/src/main/java/com/mqttsnet/thinglinks/link/controller/product/ProductController.java
浏览文件 @
9e3d838c
package
com.mqttsnet.thinglinks.link.controller.product
;
import
com.alibaba.fastjson.JSONException
;
import
com.alibaba.fastjson.JSONObject
;
import
com.mqttsnet.thinglinks.common.core.annotation.NoRepeatSubmit
;
import
com.mqttsnet.thinglinks.common.core.constant.Constants
;
import
com.mqttsnet.thinglinks.common.core.constant.HttpStatus
;
import
com.mqttsnet.thinglinks.common.core.utils.StringUtils
;
import
com.mqttsnet.thinglinks.common.core.utils.poi.ExcelUtil
;
import
com.mqttsnet.thinglinks.common.core.web.controller.BaseController
;
import
com.mqttsnet.thinglinks.common.core.web.domain.AjaxResult
;
...
...
@@ -12,7 +9,6 @@ import com.mqttsnet.thinglinks.common.core.web.page.TableDataInfo;
import
com.mqttsnet.thinglinks.common.log.annotation.Log
;
import
com.mqttsnet.thinglinks.common.log.enums.BusinessType
;
import
com.mqttsnet.thinglinks.common.security.annotation.PreAuthorize
;
import
com.mqttsnet.thinglinks.link.api.domain.device.entity.Device
;
import
com.mqttsnet.thinglinks.link.api.domain.product.entity.Product
;
import
com.mqttsnet.thinglinks.link.service.product.ProductService
;
import
lombok.extern.slf4j.Slf4j
;
...
...
@@ -158,4 +154,20 @@ public class ProductController extends BaseController {
{
return
toAjax
(
productService
.
deleteProductByIds
(
ids
));
}
/**
*校验产品名称是否存在
* @param productName
* @return
*/
@GetMapping
(
value
=
"/validationFindOneByProductName/{productName}"
)
public
AjaxResult
validationFindOneByProductName
(
@PathVariable
(
"productName"
)
String
productName
)
{
Product
oneByProductName
=
productService
.
findOneByProductName
(
productName
);
if
(
StringUtils
.
isNull
(
oneByProductName
)){
AjaxResult
.
success
(
"产品名称可用"
);
}
return
AjaxResult
.
error
(
"产品名称已存在"
);
}
}
thinglinks-modules/thinglinks-modules-link/src/main/java/com/mqttsnet/thinglinks/link/mapper/device/DeviceMapper.java
浏览文件 @
9e3d838c
...
...
@@ -143,4 +143,20 @@ public interface DeviceMapper {
* @return 结果
*/
public
int
deleteDeviceByIds
(
Long
[]
ids
);
Device
findOneByClientId
(
@Param
(
"clientId"
)
String
clientId
);
Device
findOneByClientIdAndDeviceIdentification
(
@Param
(
"clientId"
)
String
clientId
,
@Param
(
"deviceIdentification"
)
String
deviceIdentification
);
Device
findOneByDeviceIdentification
(
@Param
(
"deviceIdentification"
)
String
deviceIdentification
);
Device
findOneByClientIdOrderByDeviceIdentification
(
@Param
(
"clientId"
)
String
clientId
);
Device
findOneByClientIdOrDeviceIdentification
(
@Param
(
"clientId"
)
String
clientId
,
@Param
(
"deviceIdentification"
)
String
deviceIdentification
);
}
\ No newline at end of file
thinglinks-modules/thinglinks-modules-link/src/main/java/com/mqttsnet/thinglinks/link/mapper/product/ProductMapper.java
浏览文件 @
9e3d838c
...
...
@@ -120,4 +120,8 @@ public interface ProductMapper {
*/
public
int
deleteProductByIds
(
Long
[]
ids
);
Product
findOneByProductName
(
@Param
(
"productName"
)
String
productName
);
}
\ No newline at end of file
thinglinks-modules/thinglinks-modules-link/src/main/java/com/mqttsnet/thinglinks/link/service/device/DeviceService.java
浏览文件 @
9e3d838c
...
...
@@ -97,5 +97,30 @@ public interface DeviceService {
*/
public
int
deleteDeviceById
(
Long
id
);
Device
findOneByClientId
(
String
clientId
);
Device
findOneByClientIdAndDeviceIdentification
(
String
clientId
,
String
deviceIdentification
);
Device
findOneByDeviceIdentification
(
String
deviceIdentification
);
Device
findOneByClientIdOrderByDeviceIdentification
(
String
clientId
);
Device
findOneByClientIdOrDeviceIdentification
(
String
clientId
,
String
deviceIdentification
);
}
thinglinks-modules/thinglinks-modules-link/src/main/java/com/mqttsnet/thinglinks/link/service/device/impl/DeviceServiceImpl.java
浏览文件 @
9e3d838c
package
com.mqttsnet.thinglinks.link.service.device.impl
;
import
com.mqttsnet.thinglinks.common.core.utils.DateUtils
;
import
com.mqttsnet.thinglinks.common.core.utils.StringUtils
;
import
com.mqttsnet.thinglinks.common.security.service.TokenService
;
import
com.mqttsnet.thinglinks.link.api.domain.device.entity.Device
;
import
com.mqttsnet.thinglinks.link.mapper.device.DeviceMapper
;
import
com.mqttsnet.thinglinks.link.service.device.DeviceService
;
import
com.mqttsnet.thinglinks.system.api.domain.SysUser
;
import
com.mqttsnet.thinglinks.system.api.model.LoginUser
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
javax.annotation.Resource
;
...
...
@@ -25,6 +30,8 @@ public class DeviceServiceImpl implements DeviceService {
@Resource
private
DeviceMapper
deviceMapper
;
@Autowired
private
TokenService
tokenService
;
@Override
public
int
deleteByPrimaryKey
(
Long
id
)
{
...
...
@@ -33,21 +40,47 @@ public class DeviceServiceImpl implements DeviceService {
@Override
public
int
insert
(
Device
record
)
{
LoginUser
loginUser
=
tokenService
.
getLoginUser
();
SysUser
sysUser
=
loginUser
.
getSysUser
();
record
.
setCreateBy
(
sysUser
.
getUserName
());
record
.
setCreateTime
(
DateUtils
.
getNowDate
());
return
deviceMapper
.
insert
(
record
);
}
@Override
public
int
insertOrUpdate
(
Device
record
)
{
LoginUser
loginUser
=
tokenService
.
getLoginUser
();
SysUser
sysUser
=
loginUser
.
getSysUser
();
if
(
StringUtils
.
isEmpty
(
String
.
valueOf
(
record
.
getId
()))){
record
.
setCreateBy
(
sysUser
.
getUserName
());
record
.
setCreateTime
(
DateUtils
.
getNowDate
());
}
else
{
record
.
setUpdateTime
(
DateUtils
.
getNowDate
());
record
.
setUpdateBy
(
sysUser
.
getUserName
());
}
return
deviceMapper
.
insertOrUpdate
(
record
);
}
@Override
public
int
insertOrUpdateSelective
(
Device
record
)
{
LoginUser
loginUser
=
tokenService
.
getLoginUser
();
SysUser
sysUser
=
loginUser
.
getSysUser
();
if
(
StringUtils
.
isEmpty
(
String
.
valueOf
(
record
.
getId
()))){
record
.
setCreateBy
(
sysUser
.
getUserName
());
record
.
setCreateTime
(
DateUtils
.
getNowDate
());
}
else
{
record
.
setUpdateTime
(
DateUtils
.
getNowDate
());
record
.
setUpdateBy
(
sysUser
.
getUserName
());
}
return
deviceMapper
.
insertOrUpdateSelective
(
record
);
}
@Override
public
int
insertSelective
(
Device
record
)
{
LoginUser
loginUser
=
tokenService
.
getLoginUser
();
SysUser
sysUser
=
loginUser
.
getSysUser
();
record
.
setCreateBy
(
sysUser
.
getUserName
());
record
.
setCreateTime
(
DateUtils
.
getNowDate
());
return
deviceMapper
.
insertSelective
(
record
);
}
...
...
@@ -58,11 +91,19 @@ public class DeviceServiceImpl implements DeviceService {
@Override
public
int
updateByPrimaryKeySelective
(
Device
record
)
{
LoginUser
loginUser
=
tokenService
.
getLoginUser
();
SysUser
sysUser
=
loginUser
.
getSysUser
();
record
.
setUpdateTime
(
DateUtils
.
getNowDate
());
record
.
setUpdateBy
(
sysUser
.
getUserName
());
return
deviceMapper
.
updateByPrimaryKeySelective
(
record
);
}
@Override
public
int
updateByPrimaryKey
(
Device
record
)
{
LoginUser
loginUser
=
tokenService
.
getLoginUser
();
SysUser
sysUser
=
loginUser
.
getSysUser
();
record
.
setUpdateTime
(
DateUtils
.
getNowDate
());
record
.
setUpdateBy
(
sysUser
.
getUserName
());
return
deviceMapper
.
updateByPrimaryKey
(
record
);
}
...
...
@@ -135,6 +176,13 @@ public class DeviceServiceImpl implements DeviceService {
@Override
public
int
insertDevice
(
Device
device
)
{
Device
oneByClientIdAndDeviceIdentification
=
deviceMapper
.
findOneByClientIdOrDeviceIdentification
(
device
.
getClientId
(),
device
.
getDeviceIdentification
());
if
(
StringUtils
.
isNull
(
oneByClientIdAndDeviceIdentification
)){
return
0
;
}
LoginUser
loginUser
=
tokenService
.
getLoginUser
();
SysUser
sysUser
=
loginUser
.
getSysUser
();
device
.
setCreateBy
(
sysUser
.
getUserName
());
device
.
setCreateTime
(
DateUtils
.
getNowDate
());
return
deviceMapper
.
insertDevice
(
device
);
}
...
...
@@ -148,7 +196,10 @@ public class DeviceServiceImpl implements DeviceService {
@Override
public
int
updateDevice
(
Device
device
)
{
LoginUser
loginUser
=
tokenService
.
getLoginUser
();
SysUser
sysUser
=
loginUser
.
getSysUser
();
device
.
setUpdateTime
(
DateUtils
.
getNowDate
());
device
.
setUpdateBy
(
sysUser
.
getUserName
());
return
deviceMapper
.
updateDevice
(
device
);
}
...
...
@@ -176,5 +227,30 @@ public class DeviceServiceImpl implements DeviceService {
return
deviceMapper
.
deleteDeviceById
(
id
);
}
@Override
public
Device
findOneByClientId
(
String
clientId
){
return
deviceMapper
.
findOneByClientId
(
clientId
);
}
@Override
public
Device
findOneByClientIdAndDeviceIdentification
(
String
clientId
,
String
deviceIdentification
){
return
deviceMapper
.
findOneByClientIdAndDeviceIdentification
(
clientId
,
deviceIdentification
);
}
@Override
public
Device
findOneByDeviceIdentification
(
String
deviceIdentification
){
return
deviceMapper
.
findOneByDeviceIdentification
(
deviceIdentification
);
}
@Override
public
Device
findOneByClientIdOrderByDeviceIdentification
(
String
clientId
){
return
deviceMapper
.
findOneByClientIdOrderByDeviceIdentification
(
clientId
);
}
@Override
public
Device
findOneByClientIdOrDeviceIdentification
(
String
clientId
,
String
deviceIdentification
){
return
deviceMapper
.
findOneByClientIdOrDeviceIdentification
(
clientId
,
deviceIdentification
);
}
}
thinglinks-modules/thinglinks-modules-link/src/main/java/com/mqttsnet/thinglinks/link/service/product/ProductService.java
浏览文件 @
9e3d838c
package
com.mqttsnet.thinglinks.link.service.product
;
import
java.util.List
;
import
com.alibaba.fastjson.JSONObject
;
import
com.mqttsnet.thinglinks.common.core.web.domain.AjaxResult
;
import
com.mqttsnet.thinglinks.link.api.domain.device.entity.Device
;
import
com.mqttsnet.thinglinks.link.api.domain.product.entity.Product
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.web.multipart.MultipartFile
;
import
java.util.List
;
/**
* @Description: java类作用描述
...
...
@@ -104,4 +101,9 @@ public interface ProductService{
* @return 结果
*/
public
int
deleteProductById
(
Long
id
);
Product
findOneByProductName
(
String
productName
);
}
thinglinks-modules/thinglinks-modules-link/src/main/java/com/mqttsnet/thinglinks/link/service/product/impl/ProductServiceImpl.java
浏览文件 @
9e3d838c
...
...
@@ -4,14 +4,22 @@ import com.alibaba.fastjson.JSONObject;
import
com.google.common.collect.Lists
;
import
com.jayway.jsonpath.JsonPath
;
import
com.mqttsnet.thinglinks.common.core.text.CharsetKit
;
import
com.mqttsnet.thinglinks.common.core.text.UUID
;
import
com.mqttsnet.thinglinks.common.core.utils.DateUtils
;
import
com.mqttsnet.thinglinks.common.core.utils.StringUtils
;
import
com.mqttsnet.thinglinks.common.core.web.domain.AjaxResult
;
import
com.mqttsnet.thinglinks.common.security.service.TokenService
;
import
com.mqttsnet.thinglinks.link.api.domain.product.entity.Product
;
import
com.mqttsnet.thinglinks.link.mapper.product.ProductMapper
;
import
com.mqttsnet.thinglinks.link.service.product.ProductService
;
import
com.mqttsnet.thinglinks.system.api.domain.SysUser
;
import
com.mqttsnet.thinglinks.system.api.model.LoginUser
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.web.multipart.MultipartFile
;
import
javax.annotation.Resource
;
import
java.io.BufferedReader
;
import
java.io.IOException
;
...
...
@@ -19,17 +27,10 @@ import java.io.InputStream;
import
java.io.InputStreamReader
;
import
java.nio.charset.Charset
;
import
java.util.ArrayList
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.zip.ZipEntry
;
import
java.util.zip.ZipInputStream
;
import
com.mqttsnet.thinglinks.link.mapper.product.ProductMapper
;
import
com.mqttsnet.thinglinks.link.api.domain.product.entity.Product
;
import
com.mqttsnet.thinglinks.link.service.product.ProductService
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.web.multipart.MultipartFile
;
/**
* @Description: 产品模型业务层
...
...
@@ -70,8 +71,13 @@ public class ProductServiceImpl implements ProductService{
public
int
insertOrUpdate
(
Product
record
)
{
LoginUser
loginUser
=
tokenService
.
getLoginUser
();
SysUser
sysUser
=
loginUser
.
getSysUser
();
record
.
setCreateBy
(
sysUser
.
getUserName
());
record
.
setCreateTime
(
DateUtils
.
getNowDate
());
if
(
StringUtils
.
isEmpty
(
String
.
valueOf
(
record
.
getId
()))){
record
.
setCreateBy
(
sysUser
.
getUserName
());
record
.
setCreateTime
(
DateUtils
.
getNowDate
());
}
else
{
record
.
setUpdateTime
(
DateUtils
.
getNowDate
());
record
.
setUpdateBy
(
sysUser
.
getUserName
());
}
return
productMapper
.
insertOrUpdate
(
record
);
}
...
...
@@ -79,8 +85,13 @@ public class ProductServiceImpl implements ProductService{
public
int
insertOrUpdateSelective
(
Product
record
)
{
LoginUser
loginUser
=
tokenService
.
getLoginUser
();
SysUser
sysUser
=
loginUser
.
getSysUser
();
record
.
setCreateBy
(
sysUser
.
getUserName
());
record
.
setCreateTime
(
DateUtils
.
getNowDate
());
if
(
StringUtils
.
isEmpty
(
String
.
valueOf
(
record
.
getId
()))){
record
.
setCreateBy
(
sysUser
.
getUserName
());
record
.
setCreateTime
(
DateUtils
.
getNowDate
());
}
else
{
record
.
setUpdateTime
(
DateUtils
.
getNowDate
());
record
.
setUpdateBy
(
sysUser
.
getUserName
());
}
return
productMapper
.
insertOrUpdateSelective
(
record
);
}
...
...
@@ -342,6 +353,11 @@ public class ProductServiceImpl implements ProductService{
@Override
public
int
insertProduct
(
Product
product
)
{
Product
oneByProductName
=
productMapper
.
findOneByProductName
(
product
.
getProductName
());
if
(
StringUtils
.
isNull
(
oneByProductName
)){
return
0
;
}
product
.
setProductIdentification
(
UUID
.
getUUID
());
LoginUser
loginUser
=
tokenService
.
getLoginUser
();
SysUser
sysUser
=
loginUser
.
getSysUser
();
product
.
setCreateBy
(
sysUser
.
getUserName
());
...
...
@@ -388,4 +404,10 @@ public class ProductServiceImpl implements ProductService{
{
return
productMapper
.
deleteProductById
(
id
);
}
@Override
public
Product
findOneByProductName
(
String
productName
){
return
productMapper
.
findOneByProductName
(
productName
);
}
}
thinglinks-modules/thinglinks-modules-link/src/main/resources/bootstrap.yml
浏览文件 @
9e3d838c
...
...
@@ -19,12 +19,12 @@ spring:
# 配置中心地址
server-addr
:
49.235.122.136:8848
#命名空间
namespace
:
fffe6c69-d6cb-44fd-b542-8167d8a0c29d
namespace
:
1e1aff6c-da73-43e2-9e5f-8e0b890189d9
config
:
# 配置中心地址
server-addr
:
49.235.122.136:8848
#命名空间
namespace
:
fffe6c69-d6cb-44fd-b542-8167d8a0c29d
namespace
:
1e1aff6c-da73-43e2-9e5f-8e0b890189d9
# 配置文件格式
file-extension
:
yml
# 共享配置
...
...
thinglinks-modules/thinglinks-modules-link/src/main/resources/mapper/link/device/DeviceMapper.xml
浏览文件 @
9e3d838c
...
...
@@ -1227,4 +1227,71 @@
#{id}
</foreach>
</delete>
<!--auto generated by ShiHuan Sun E-mail: 13733918655@163.com on 2022-02-18-->
<select
id=
"findOneByClientId"
resultMap=
"DeviceResult"
>
select
<include
refid=
"Base_Column_List"
/>
from device
<where>
<if
test=
"clientId != null"
>
and client_id=#{clientId}
</if>
</where>
</select>
<!--auto generated by ShiHuan Sun E-mail: 13733918655@163.com on 2022-02-18-->
<select
id=
"findOneByClientIdAndDeviceIdentification"
resultMap=
"DeviceResult"
>
select
<include
refid=
"Base_Column_List"
/>
from device
<where>
<if
test=
"clientId != null"
>
and client_id=#{clientId}
</if>
<if
test=
"deviceIdentification != null"
>
and device_identification=#{deviceIdentification}
</if>
</where>
</select>
<!--auto generated by ShiHuan Sun E-mail: 13733918655@163.com on 2022-02-18-->
<select
id=
"findOneByDeviceIdentification"
resultMap=
"DeviceResult"
>
select
<include
refid=
"Base_Column_List"
/>
from device
<where>
<if
test=
"deviceIdentification != null"
>
and device_identification=#{deviceIdentification}
</if>
</where>
</select>
<!--auto generated by ShiHuan Sun E-mail: 13733918655@163.com on 2022-02-18-->
<select
id=
"findOneByClientIdOrderByDeviceIdentification"
resultMap=
"DeviceResult"
>
select
<include
refid=
"Base_Column_List"
/>
from device
<where>
<if
test=
"clientId != null"
>
and client_id=#{clientId}
</if>
</where>
order by device_identification asc
</select>
<!--auto generated by ShiHuan Sun E-mail: 13733918655@163.com on 2022-02-18-->
<select
id=
"findOneByClientIdOrDeviceIdentification"
resultMap=
"DeviceResult"
>
select
<include
refid=
"Base_Column_List"
/>
from device
<where>
<if
test=
"clientId != null"
>
and client_id=#{clientId}
</if>
<if
test=
"deviceIdentification != null"
>
or device_identification=#{deviceIdentification}
</if>
</where>
</select>
</mapper>
\ No newline at end of file
thinglinks-modules/thinglinks-modules-link/src/main/resources/mapper/link/product/ProductMapper.xml
浏览文件 @
9e3d838c
...
...
@@ -829,4 +829,16 @@
#{id}
</foreach>
</delete>
<!--auto generated by ShiHuan Sun E-mail: 13733918655@163.com on 2022-02-17-->
<select
id=
"findOneByProductName"
resultMap=
"BaseResultMap"
>
select
<include
refid=
"Base_Column_List"
/>
from product
<where>
<if
test=
"productName != null"
>
and product_name=#{productName,jdbcType=VARCHAR}
</if>
</where>
</select>
</mapper>
\ No newline at end of file
thinglinks-modules/thinglinks-modules-system/src/main/resources/bootstrap.yml
浏览文件 @
9e3d838c
...
...
@@ -19,12 +19,12 @@ spring:
# 配置中心地址
server-addr
:
49.235.122.136:8848
#命名空间
namespace
:
fffe6c69-d6cb-44fd-b542-8167d8a0c29d
namespace
:
1e1aff6c-da73-43e2-9e5f-8e0b890189d9
config
:
# 配置中心地址
server-addr
:
49.235.122.136:8848
#命名空间
namespace
:
fffe6c69-d6cb-44fd-b542-8167d8a0c29d
namespace
:
1e1aff6c-da73-43e2-9e5f-8e0b890189d9
# 配置文件格式
file-extension
:
yml
# 共享配置
...
...
thinglinks-modules/thinglinks-modules-tdengine/pom.xml
浏览文件 @
9e3d838c
...
...
@@ -82,7 +82,7 @@
<dependency>
<groupId>
com.taosdata.jdbc
</groupId>
<artifactId>
taos-jdbcdriver
</artifactId>
<version>
2.0.3
5
</version>
<version>
2.0.3
7
</version>
</dependency>
<!-- thinglinks Common Datasource -->
...
...
thinglinks-modules/thinglinks-modules-tdengine/readme.md
浏览文件 @
9e3d838c
...
...
@@ -84,10 +84,10 @@ logging.level.com.taosdata.jdbc.springbootdemo.dao=debug
<include
refid=
"Base_Column_List"
/>
from thinglinks.weather
order by ts desc
<if
t
hinglinks
=
"limit != null"
>
<if
t
est
=
"limit != null"
>
limit #{limit,jdbcType=BIGINT}
</if>
<if
t
hinglinks
=
"offset != null"
>
<if
t
est
=
"offset != null"
>
offset #{offset,jdbcType=BIGINT}
</if>
</select>
...
...
thinglinks-modules/thinglinks-modules-tdengine/src/main/java/com/mqttsnet/thinglinks/tdengine/mapper/WeatherMapper.xml
浏览文件 @
9e3d838c
...
...
@@ -3,7 +3,7 @@
<mapper
namespace=
"com.mqttsnet.thinglinks.tdengine.mapper.WeatherMapper"
>
<resultMap
id=
"BaseResultMap"
type=
"com.mqttsnet.thinglinks.tdengine.api.domain.
model.
Weather"
>
<resultMap
id=
"BaseResultMap"
type=
"com.mqttsnet.thinglinks.tdengine.api.domain.Weather"
>
<id
column=
"ts"
jdbcType=
"TIMESTAMP"
property=
"ts"
/>
<result
column=
"temperature"
jdbcType=
"FLOAT"
property=
"temperature"
/>
<result
column=
"humidity"
jdbcType=
"FLOAT"
property=
"humidity"
/>
...
...
@@ -45,7 +45,7 @@
), groupId int)
</update>
<update
id=
"createTable"
parameterType=
"com.mqttsnet.thinglinks.tdengine.api.domain.
model.
Weather"
>
<update
id=
"createTable"
parameterType=
"com.mqttsnet.thinglinks.tdengine.api.domain.Weather"
>
create table if not exists thinglinks.t#{groupId} using thinglinks.weather tags
(
#{location},
...
...
@@ -55,15 +55,15 @@
<select
id=
"select"
resultMap=
"BaseResultMap"
>
select * from thinglinks.weather order by ts desc
<if
t
hinglinks
=
"limit != null"
>
<if
t
est
=
"limit != null"
>
limit #{limit,jdbcType=BIGINT}
</if>
<if
t
hinglinks
=
"offset != null"
>
<if
t
est
=
"offset != null"
>
offset #{offset,jdbcType=BIGINT}
</if>
</select>
<insert
id=
"insert"
parameterType=
"com.mqttsnet.thinglinks.tdengine.api.domain.
model.
Weather"
>
<insert
id=
"insert"
parameterType=
"com.mqttsnet.thinglinks.tdengine.api.domain.Weather"
>
insert into thinglinks.t#{groupId} (ts, temperature, humidity, note)
values (#{ts}, ${temperature}, ${humidity}, #{note})
</insert>
...
...
@@ -78,7 +78,7 @@
from thinglinks.weather
</select>
<resultMap
id=
"avgResultSet"
type=
"com.mqttsnet.thinglinks.tdengine.api.domain.
model.
Weather"
>
<resultMap
id=
"avgResultSet"
type=
"com.mqttsnet.thinglinks.tdengine.api.domain.Weather"
>
<id
column=
"ts"
jdbcType=
"TIMESTAMP"
property=
"ts"
/>
<result
column=
"avg(temperature)"
jdbcType=
"FLOAT"
property=
"temperature"
/>
<result
column=
"avg(humidity)"
jdbcType=
"FLOAT"
property=
"humidity"
/>
...
...
thinglinks-modules/thinglinks-modules-tdengine/src/main/resources/bootstrap.yml
浏览文件 @
9e3d838c
...
...
@@ -19,12 +19,12 @@ spring:
# 配置中心地址
server-addr
:
49.235.122.136:8848
#命名空间
namespace
:
fffe6c69-d6cb-44fd-b542-8167d8a0c29d
namespace
:
1e1aff6c-da73-43e2-9e5f-8e0b890189d9
config
:
# 配置中心地址
server-addr
:
49.235.122.136:8848
#命名空间
namespace
:
fffe6c69-d6cb-44fd-b542-8167d8a0c29d
namespace
:
1e1aff6c-da73-43e2-9e5f-8e0b890189d9
# 配置文件格式
file-extension
:
yml
# 共享配置
...
...
thinglinks-visual/thinglinks-visual-collection/src/main/resources/bootstrap.yml
浏览文件 @
9e3d838c
...
...
@@ -33,5 +33,5 @@ spring:
#自定义配置参数
base
:
#本机ip,不要用localhost或127.0.0.1
bindIp
:
192.168.10.29
\ No newline at end of file
#本机内网ip,不要用localhost或127.0.0.1
bindIp
:
127.0.0.1
\ No newline at end of file
thinglinks-visual/thinglinks-visual-monitor/src/main/resources/bootstrap.yml
浏览文件 @
9e3d838c
...
...
@@ -19,14 +19,19 @@ spring:
# 配置中心地址
server-addr
:
49.235.122.136:8848
#命名空间
namespace
:
fffe6c69-d6cb-44fd-b542-8167d8a0c29d
namespace
:
1e1aff6c-da73-43e2-9e5f-8e0b890189d9
config
:
# 配置中心地址
server-addr
:
49.235.122.136:8848
#命名空间
namespace
:
fffe6c69-d6cb-44fd-b542-8167d8a0c29d
namespace
:
1e1aff6c-da73-43e2-9e5f-8e0b890189d9
# 配置文件格式
file-extension
:
yml
# 关联配置
extension-configs[0]
:
data-id
:
thinglinks-collection-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension}
group
:
DEFAULT_GROUP
refresh
:
true
# 共享配置
shared-configs
:
-
application-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录