From 04505e34957ccb73987a92f4c088498715561a92 Mon Sep 17 00:00:00 2001
From: tangfudong <280620913@qq.com>
Date: Fri, 16 Jun 2023 18:44:35 +0800
Subject: [PATCH] =?UTF-8?q?fix:=E9=80=9A=E9=81=93=E9=85=8D=E7=BD=AE?=
=?UTF-8?q?=E5=92=8C=E6=A8=A1=E6=9D=BF=E9=85=8D=E7=BD=AE=E5=AE=8C=E6=88=90?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
data/init/channel.json | 6 +--
data/init/channelConfig.json | 12 ++---
data/init/channelTemplate.json | 12 ++---
data/init/notifyMessage.json | 24 +++++-----
.../java/cc/iotkit/model/notify/Channel.java | 4 +-
.../cc/iotkit/model/notify/ChannelConfig.java | 6 +--
.../iotkit/model/notify/ChannelTemplate.java | 6 +--
.../cc/iotkit/model/notify/NotifyMessage.java | 4 +-
.../main/java/cc/iotkit/data/ICommonData.java | 3 +-
.../data/manager/IChannelConfigData.java | 2 +-
.../cc/iotkit/data/manager/IChannelData.java | 2 +-
.../data/manager/IChannelTemplateData.java | 2 +-
.../data/manager/INotifyMessageData.java | 2 +-
.../data/dao/ChannelConfigRepository.java | 2 +-
.../java/cc/iotkit/data/model/TbChannel.java | 2 +-
.../cc/iotkit/data/model/TbChannelConfig.java | 4 +-
.../iotkit/data/model/TbChannelTemplate.java | 4 +-
.../cc/iotkit/data/model/TbNotifyMessage.java | 5 +-
.../data/service/ChannelConfigDataImpl.java | 35 ++------------
.../iotkit/data/service/ChannelDataImpl.java | 36 +-------------
.../data/service/ChannelTemplateDataImpl.java | 47 +------------------
.../data/service/NotifyMessageDataImpl.java | 12 +----
.../manager/controller/NotifyController.java | 30 ++++++++----
.../dto/bo/channel/ChannelConfigBo.java | 2 +-
.../dto/bo/channel/ChannelTemplateBo.java | 39 +++++++++++++++
.../dto/vo/channel/ChannelTemplateVo.java | 40 ++++++++++++++++
.../iotkit/manager/service/NotifyService.java | 24 ++++++----
27 files changed, 175 insertions(+), 192 deletions(-)
create mode 100644 iot-module/iot-manager/src/main/java/cc/iotkit/manager/dto/bo/channel/ChannelTemplateBo.java
create mode 100644 iot-module/iot-manager/src/main/java/cc/iotkit/manager/dto/vo/channel/ChannelTemplateVo.java
diff --git a/data/init/channel.json b/data/init/channel.json
index cd74fb49..f513b21b 100644
--- a/data/init/channel.json
+++ b/data/init/channel.json
@@ -1,20 +1,20 @@
[
{
- "id": "1",
+ "id": 1,
"code": "DingTalk",
"title": "钉钉",
"icon": "http://www.baidu.com",
"createAt": 1683816661690
},
{
- "id": "fa1c5eaa-de6e-48b6-805e-8f091c7bb832",
+ "id": 2,
"code": "QyWechat",
"title": "企业微信",
"icon": "http://www.baidu.com",
"createAt": 1683816661690
},
{
- "id": "fa1c5eaa-de6e-48b6-805e-8f091c7bb833",
+ "id": 3,
"code": "Email",
"title": "邮箱",
"icon": "http://www.baidu.com",
diff --git a/data/init/channelConfig.json b/data/init/channelConfig.json
index 40209512..0d1bfd78 100644
--- a/data/init/channelConfig.json
+++ b/data/init/channelConfig.json
@@ -1,7 +1,7 @@
[
{
- "id": "947d22b7-305b-d959-874a-06e277143d44",
- "channelId": "fa1c5eaa-de6e-48b6-805e-8f091c7bb831",
+ "id": 1312312,
+ "channelId": 3,
"title": "告警邮件配置",
"param": {
"userName":"xxx",
@@ -15,8 +15,8 @@
"createAt": 1683816661690
},
{
- "id": "75f37720-22bb-4f0b-f127-78f2091507a0",
- "channelId": "fa1c5eaa-de6e-48b6-805e-8f091c7bb832",
+ "id": 1313123,
+ "channelId": 1,
"title": "告警钉钉配置",
"param": {
"dingTalkWebhook":"xxxxxxxxxxxxxxxx",
@@ -25,8 +25,8 @@
"createAt": 1683816661690
},
{
- "id": "6e5db9b5-a709-723b-665b-bbca5ce6a62c",
- "channelId": "fa1c5eaa-de6e-48b6-805e-8f091c7bb833",
+ "id": 32141342,
+ "channelId": 2,
"title": "告警企业微信配置",
"param": {
"qyWechatWebhook":"xxxxxxxxxxxxxxxx"
diff --git a/data/init/channelTemplate.json b/data/init/channelTemplate.json
index ffd2a99f..138562db 100644
--- a/data/init/channelTemplate.json
+++ b/data/init/channelTemplate.json
@@ -1,23 +1,23 @@
[
{
- "id": "0640bbe2-788e-ca94-5fb4-c5e7f91e546d",
- "channelConfigId": "947d22b7-305b-d959-874a-06e277143d44",
+ "id": 12312312,
+ "channelConfigId": 1312312,
"channelCode": "Email",
"title": "告警邮件模板",
"content": "您的设备【${title}】温度过高",
"createAt": 1683816661690
},
{
- "id": "7fd90ab1-63c8-cd92-2a58-b7bd04f557f1",
- "channelConfigId": "75f37720-22bb-4f0b-f127-78f2091507a0",
+ "id": 342353425,
+ "channelConfigId": 1313123,
"channelCode": "DingTalk",
"title": "告警钉钉模板",
"content": "您的设备【${title}】温度过高",
"createAt": 1683816661690
},
{
- "id": "74ece781-1d84-220b-cbb2-3270e245bb3b",
- "channelConfigId": "6e5db9b5-a709-723b-665b-bbca5ce6a62c",
+ "id": 786778567,
+ "channelConfigId": 32141342,
"channelCode": "QyWechat",
"title": "告警企业微信模板",
"content": "您的设备【${title}】温度过高",
diff --git a/data/init/notifyMessage.json b/data/init/notifyMessage.json
index 62c8c07b..c7e12b26 100644
--- a/data/init/notifyMessage.json
+++ b/data/init/notifyMessage.json
@@ -1,6 +1,6 @@
[
{
- "id": "fa1c5eaa-de6e-48b6-805e-8f091c7bb831",
+ "id": 1231312,
"content": "你的设备【热水器】温度过高",
"messageType": "alert",
"status": true,
@@ -8,7 +8,7 @@
"updateAt": 1683816661690
},
{
- "id": "fa1c5eaa-de6e-48b6-805e-8f091c7bb832",
+ "id": 4324234,
"content": "你的设备【热水器】温度过高",
"messageType": "alert",
"status": true,
@@ -16,7 +16,7 @@
"updateAt": 1683816661690
},
{
- "id": "fa1c5eaa-de6e-48b6-805e-8f091c7bb833",
+ "id": 151515,
"content": "你的设备【热水器】温度过高",
"messageType": "alert",
"status": false,
@@ -24,7 +24,7 @@
"updateAt": 1683816661690
},
{
- "id": "fa1c5eaa-de6e-48b6-805e-8f091c7bb834",
+ "id": 4534636,
"content": "你的设备【热水器】温度过高",
"messageType": "alert",
"status": true,
@@ -32,7 +32,7 @@
"updateAt": 1683816661690
},
{
- "id": "fa1c5eaa-de6e-48b6-805e-8f091c7bb835",
+ "id":4534346,
"content": "你的设备【热水器】温度过高",
"messageType": "alert",
"status": false,
@@ -40,7 +40,7 @@
"updateAt": 1683816661690
},
{
- "id": "fa1c5eaa-de6e-48b6-805e-8f091c7bb836",
+ "id": 64432342,
"content": "你的设备【热水器】温度过高",
"messageType": "alert",
"status": true,
@@ -48,7 +48,7 @@
"updateAt": 1683816661690
},
{
- "id": "fa1c5eaa-de6e-48b6-805e-8f091c7bb837",
+ "id": 5756,
"content": "你的设备【热水器】温度过高",
"messageType": "alert",
"status": true,
@@ -56,7 +56,7 @@
"updateAt": 1683816661690
},
{
- "id": "fa1c5eaa-de6e-48b6-805e-8f091c7bb838",
+ "id": 56856,
"content": "你的设备【热水器】温度过高",
"messageType": "alert",
"status": true,
@@ -64,7 +64,7 @@
"updateAt": 1683816661690
},
{
- "id": "fa1c5eaa-de6e-48b6-805e-8f091c7bb839",
+ "id": 31,
"content": "你的设备【热水器】温度过高",
"messageType": "alert",
"status": false,
@@ -72,7 +72,7 @@
"updateAt": 1683816661690
},
{
- "id": "fa1c5eaa-de6e-48b6-805e-8f091c7bb840",
+ "id": 67567,
"content": "你的设备【热水器】温度过高",
"messageType": "alert",
"status": true,
@@ -80,7 +80,7 @@
"updateAt": 1683816661690
},
{
- "id": "fa1c5eaa-de6e-48b6-805e-8f091c7bb841",
+ "id": 9789,
"content": "你的设备【热水器】温度过高",
"messageType": "alert",
"status": false,
@@ -88,7 +88,7 @@
"updateAt": 1683816661690
},
{
- "id": "fa1c5eaa-de6e-48b6-805e-8f091c7bb842",
+ "id": 90890,
"content": "你的设备【热水器】温度过高",
"messageType": "alert",
"status": true,
diff --git a/iot-common/iot-common-dao/iot-common-model/src/main/java/cc/iotkit/model/notify/Channel.java b/iot-common/iot-common-dao/iot-common-model/src/main/java/cc/iotkit/model/notify/Channel.java
index 7c1d91f7..d17d129f 100644
--- a/iot-common/iot-common-dao/iot-common-model/src/main/java/cc/iotkit/model/notify/Channel.java
+++ b/iot-common/iot-common-dao/iot-common-model/src/main/java/cc/iotkit/model/notify/Channel.java
@@ -15,9 +15,9 @@ import lombok.NoArgsConstructor;
@Builder
@NoArgsConstructor
@AllArgsConstructor
-public class Channel implements Id {
+public class Channel implements Id {
- private String id;
+ private Long id;
private String code;
diff --git a/iot-common/iot-common-dao/iot-common-model/src/main/java/cc/iotkit/model/notify/ChannelConfig.java b/iot-common/iot-common-dao/iot-common-model/src/main/java/cc/iotkit/model/notify/ChannelConfig.java
index cc4d1786..10208d9e 100644
--- a/iot-common/iot-common-dao/iot-common-model/src/main/java/cc/iotkit/model/notify/ChannelConfig.java
+++ b/iot-common/iot-common-dao/iot-common-model/src/main/java/cc/iotkit/model/notify/ChannelConfig.java
@@ -18,11 +18,11 @@ import java.io.Serializable;
@Builder
@NoArgsConstructor
@AllArgsConstructor
-public class ChannelConfig implements Id {
+public class ChannelConfig implements Id {
- private String id;
+ private Long id;
- private String channelId;
+ private Long channelId;
private String title;
diff --git a/iot-common/iot-common-dao/iot-common-model/src/main/java/cc/iotkit/model/notify/ChannelTemplate.java b/iot-common/iot-common-dao/iot-common-model/src/main/java/cc/iotkit/model/notify/ChannelTemplate.java
index 66980e6a..658b796d 100644
--- a/iot-common/iot-common-dao/iot-common-model/src/main/java/cc/iotkit/model/notify/ChannelTemplate.java
+++ b/iot-common/iot-common-dao/iot-common-model/src/main/java/cc/iotkit/model/notify/ChannelTemplate.java
@@ -15,11 +15,11 @@ import lombok.NoArgsConstructor;
@Builder
@NoArgsConstructor
@AllArgsConstructor
-public class ChannelTemplate implements Id {
+public class ChannelTemplate implements Id {
- private String id;
+ private Long id;
- private String channelConfigId;
+ private Long channelConfigId;
private String title;
diff --git a/iot-common/iot-common-dao/iot-common-model/src/main/java/cc/iotkit/model/notify/NotifyMessage.java b/iot-common/iot-common-dao/iot-common-model/src/main/java/cc/iotkit/model/notify/NotifyMessage.java
index 33dcd61f..0971489f 100644
--- a/iot-common/iot-common-dao/iot-common-model/src/main/java/cc/iotkit/model/notify/NotifyMessage.java
+++ b/iot-common/iot-common-dao/iot-common-model/src/main/java/cc/iotkit/model/notify/NotifyMessage.java
@@ -15,9 +15,9 @@ import lombok.NoArgsConstructor;
@Builder
@NoArgsConstructor
@AllArgsConstructor
-public class NotifyMessage implements Id {
+public class NotifyMessage implements Id {
- private String id;
+ private Long id;
private String content;
diff --git a/iot-common/iot-common-dao/iot-data-service/src/main/java/cc/iotkit/data/ICommonData.java b/iot-common/iot-common-dao/iot-data-service/src/main/java/cc/iotkit/data/ICommonData.java
index 32deba95..f4b39f60 100644
--- a/iot-common/iot-common-dao/iot-data-service/src/main/java/cc/iotkit/data/ICommonData.java
+++ b/iot-common/iot-common-dao/iot-data-service/src/main/java/cc/iotkit/data/ICommonData.java
@@ -10,11 +10,10 @@
package cc.iotkit.data;
import cc.iotkit.common.api.PageRequest;
-import cc.iotkit.model.Id;
import cc.iotkit.common.api.Paging;
+import cc.iotkit.model.Id;
import java.util.Collection;
-import java.util.Collections;
import java.util.List;
/**
diff --git a/iot-common/iot-common-dao/iot-data-service/src/main/java/cc/iotkit/data/manager/IChannelConfigData.java b/iot-common/iot-common-dao/iot-data-service/src/main/java/cc/iotkit/data/manager/IChannelConfigData.java
index 5c550a8d..c7d20629 100644
--- a/iot-common/iot-common-dao/iot-data-service/src/main/java/cc/iotkit/data/manager/IChannelConfigData.java
+++ b/iot-common/iot-common-dao/iot-data-service/src/main/java/cc/iotkit/data/manager/IChannelConfigData.java
@@ -8,5 +8,5 @@ import cc.iotkit.model.notify.ChannelConfig;
* date: 2023-05-11 17:15
* description:
**/
-public interface IChannelConfigData extends ICommonData {
+public interface IChannelConfigData extends ICommonData {
}
diff --git a/iot-common/iot-common-dao/iot-data-service/src/main/java/cc/iotkit/data/manager/IChannelData.java b/iot-common/iot-common-dao/iot-data-service/src/main/java/cc/iotkit/data/manager/IChannelData.java
index 6fa92c44..242d7c00 100644
--- a/iot-common/iot-common-dao/iot-data-service/src/main/java/cc/iotkit/data/manager/IChannelData.java
+++ b/iot-common/iot-common-dao/iot-data-service/src/main/java/cc/iotkit/data/manager/IChannelData.java
@@ -8,6 +8,6 @@ import cc.iotkit.model.notify.Channel;
* date: 2023-05-11 17:15
* description:
**/
-public interface IChannelData extends ICommonData {
+public interface IChannelData extends ICommonData {
}
diff --git a/iot-common/iot-common-dao/iot-data-service/src/main/java/cc/iotkit/data/manager/IChannelTemplateData.java b/iot-common/iot-common-dao/iot-data-service/src/main/java/cc/iotkit/data/manager/IChannelTemplateData.java
index 4dfbc4e1..f16c7020 100644
--- a/iot-common/iot-common-dao/iot-data-service/src/main/java/cc/iotkit/data/manager/IChannelTemplateData.java
+++ b/iot-common/iot-common-dao/iot-data-service/src/main/java/cc/iotkit/data/manager/IChannelTemplateData.java
@@ -8,5 +8,5 @@ import cc.iotkit.model.notify.ChannelTemplate;
* date: 2023-05-11 17:15
* description:
**/
-public interface IChannelTemplateData extends ICommonData {
+public interface IChannelTemplateData extends ICommonData {
}
diff --git a/iot-common/iot-common-dao/iot-data-service/src/main/java/cc/iotkit/data/manager/INotifyMessageData.java b/iot-common/iot-common-dao/iot-data-service/src/main/java/cc/iotkit/data/manager/INotifyMessageData.java
index 96761682..a44ebed6 100644
--- a/iot-common/iot-common-dao/iot-data-service/src/main/java/cc/iotkit/data/manager/INotifyMessageData.java
+++ b/iot-common/iot-common-dao/iot-data-service/src/main/java/cc/iotkit/data/manager/INotifyMessageData.java
@@ -8,5 +8,5 @@ import cc.iotkit.model.notify.NotifyMessage;
* @Date: 2023/5/13 18:32
* @Description:
*/
-public interface INotifyMessageData extends ICommonData {
+public interface INotifyMessageData extends ICommonData {
}
diff --git a/iot-common/iot-common-dao/iot-data-serviceImpl-rdb/src/main/java/cc/iotkit/data/dao/ChannelConfigRepository.java b/iot-common/iot-common-dao/iot-data-serviceImpl-rdb/src/main/java/cc/iotkit/data/dao/ChannelConfigRepository.java
index 35ae48ed..78a8fcf2 100644
--- a/iot-common/iot-common-dao/iot-data-serviceImpl-rdb/src/main/java/cc/iotkit/data/dao/ChannelConfigRepository.java
+++ b/iot-common/iot-common-dao/iot-data-serviceImpl-rdb/src/main/java/cc/iotkit/data/dao/ChannelConfigRepository.java
@@ -8,5 +8,5 @@ import org.springframework.data.jpa.repository.JpaRepository;
* @Date: 2023/5/11 21:00
* @Description:
*/
-public interface ChannelConfigRepository extends JpaRepository {
+public interface ChannelConfigRepository extends JpaRepository {
}
diff --git a/iot-common/iot-common-dao/iot-data-serviceImpl-rdb/src/main/java/cc/iotkit/data/model/TbChannel.java b/iot-common/iot-common-dao/iot-data-serviceImpl-rdb/src/main/java/cc/iotkit/data/model/TbChannel.java
index afa69823..d351449a 100644
--- a/iot-common/iot-common-dao/iot-data-serviceImpl-rdb/src/main/java/cc/iotkit/data/model/TbChannel.java
+++ b/iot-common/iot-common-dao/iot-data-serviceImpl-rdb/src/main/java/cc/iotkit/data/model/TbChannel.java
@@ -25,7 +25,7 @@ public class TbChannel {
@GeneratedValue(generator = "SnowflakeIdGenerator")
@GenericGenerator(name = "SnowflakeIdGenerator", strategy = "cc.iotkit.data.config.id.SnowflakeIdGenerator")
@ApiModelProperty(value = "通道id")
- private String id;
+ private Long id;
@ApiModelProperty(value = "通道名称")
private String code;
diff --git a/iot-common/iot-common-dao/iot-data-serviceImpl-rdb/src/main/java/cc/iotkit/data/model/TbChannelConfig.java b/iot-common/iot-common-dao/iot-data-serviceImpl-rdb/src/main/java/cc/iotkit/data/model/TbChannelConfig.java
index 6a784727..3b66012d 100644
--- a/iot-common/iot-common-dao/iot-data-serviceImpl-rdb/src/main/java/cc/iotkit/data/model/TbChannelConfig.java
+++ b/iot-common/iot-common-dao/iot-data-serviceImpl-rdb/src/main/java/cc/iotkit/data/model/TbChannelConfig.java
@@ -24,10 +24,10 @@ public class TbChannelConfig {
@GeneratedValue(generator = "SnowflakeIdGenerator")
@GenericGenerator(name = "SnowflakeIdGenerator", strategy = "cc.iotkit.data.config.id.SnowflakeIdGenerator")
@ApiModelProperty(value = "通道配置id")
- private String id;
+ private Long id;
@ApiModelProperty(value = "通道id")
- private String channelId;
+ private Long channelId;
@ApiModelProperty(value = "通道配置名称")
private String title;
diff --git a/iot-common/iot-common-dao/iot-data-serviceImpl-rdb/src/main/java/cc/iotkit/data/model/TbChannelTemplate.java b/iot-common/iot-common-dao/iot-data-serviceImpl-rdb/src/main/java/cc/iotkit/data/model/TbChannelTemplate.java
index a4dc2a30..6e2e36c6 100644
--- a/iot-common/iot-common-dao/iot-data-serviceImpl-rdb/src/main/java/cc/iotkit/data/model/TbChannelTemplate.java
+++ b/iot-common/iot-common-dao/iot-data-serviceImpl-rdb/src/main/java/cc/iotkit/data/model/TbChannelTemplate.java
@@ -27,10 +27,10 @@ public class TbChannelTemplate {
@GeneratedValue(generator = "SnowflakeIdGenerator")
@GenericGenerator(name = "SnowflakeIdGenerator", strategy = "cc.iotkit.data.config.id.SnowflakeIdGenerator")
@ApiModelProperty(value = "通道模板id")
- private String id;
+ private Long id;
@ApiModelProperty(value = "通道配置id")
- private String channelConfigId;
+ private Long channelConfigId;
@ApiModelProperty(value = "通道模板名称")
private String title;
diff --git a/iot-common/iot-common-dao/iot-data-serviceImpl-rdb/src/main/java/cc/iotkit/data/model/TbNotifyMessage.java b/iot-common/iot-common-dao/iot-data-serviceImpl-rdb/src/main/java/cc/iotkit/data/model/TbNotifyMessage.java
index b9be8aa8..224dd7fe 100644
--- a/iot-common/iot-common-dao/iot-data-serviceImpl-rdb/src/main/java/cc/iotkit/data/model/TbNotifyMessage.java
+++ b/iot-common/iot-common-dao/iot-data-serviceImpl-rdb/src/main/java/cc/iotkit/data/model/TbNotifyMessage.java
@@ -1,5 +1,7 @@
package cc.iotkit.data.model;
+import cc.iotkit.model.notify.NotifyMessage;
+import io.github.linpeilie.annotations.AutoMapper;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@@ -19,12 +21,13 @@ import javax.persistence.Table;
@Entity
@ApiModel(value = "通知消息")
@Table(name = "notify_message")
+@AutoMapper(target= NotifyMessage.class)
public class TbNotifyMessage {
@Id
@GeneratedValue(generator = "SnowflakeIdGenerator")
@GenericGenerator(name = "SnowflakeIdGenerator", strategy = "cc.iotkit.data.config.id.SnowflakeIdGenerator")
@ApiModelProperty(value = "通知消息id")
- private String id;
+ private Long id;
private String content;
diff --git a/iot-common/iot-common-dao/iot-data-serviceImpl-rdb/src/main/java/cc/iotkit/data/service/ChannelConfigDataImpl.java b/iot-common/iot-common-dao/iot-data-serviceImpl-rdb/src/main/java/cc/iotkit/data/service/ChannelConfigDataImpl.java
index 6fe321c2..1ed88870 100644
--- a/iot-common/iot-common-dao/iot-data-serviceImpl-rdb/src/main/java/cc/iotkit/data/service/ChannelConfigDataImpl.java
+++ b/iot-common/iot-common-dao/iot-data-serviceImpl-rdb/src/main/java/cc/iotkit/data/service/ChannelConfigDataImpl.java
@@ -1,14 +1,13 @@
package cc.iotkit.data.service;
import cc.iotkit.common.api.PageRequest;
+import cc.iotkit.common.api.Paging;
+import cc.iotkit.data.dao.ChannelConfigRepository;
import cc.iotkit.data.dao.IJPACommData;
import cc.iotkit.data.manager.IChannelConfigData;
-import cc.iotkit.data.dao.ChannelConfigRepository;
import cc.iotkit.data.model.ChannelConfigMapper;
import cc.iotkit.data.model.TbChannelConfig;
-import cc.iotkit.common.api.Paging;
import cc.iotkit.model.notify.ChannelConfig;
-import org.apache.commons.lang3.StringUtils;
import org.springframework.context.annotation.Primary;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
@@ -16,9 +15,6 @@ import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
-import java.util.Collection;
-import java.util.List;
-import java.util.UUID;
import java.util.stream.Collectors;
/**
@@ -28,7 +24,7 @@ import java.util.stream.Collectors;
**/
@Primary
@Service
-public class ChannelConfigDataImpl implements IChannelConfigData, IJPACommData {
+public class ChannelConfigDataImpl implements IChannelConfigData, IJPACommData {
@Resource
private ChannelConfigRepository channelConfigRepository;
@@ -51,31 +47,6 @@ public class ChannelConfigDataImpl implements IChannelConfigData, IJPACommData findByIds(Collection id) {
- return null;
- }
-
- @Override
- public ChannelConfig save(ChannelConfig data) {
- if (StringUtils.isBlank(data.getId())) {
- data.setId(UUID.randomUUID().toString());
- }
- channelConfigRepository.save(channelConfigMapper.toVo(data));
- return data;
- }
-
- @Override
- public List findAll() {
- return channelConfigRepository.findAll().stream().map(channelConfigMapper::toDto)
- .collect(Collectors.toList());
- }
-
@Override
public Paging findAll(PageRequest pageRequest) {
Page tbChannelConfigs = channelConfigRepository.findAll(Pageable.ofSize(pageRequest.getPageSize()).withPage(pageRequest.getPageNum() - 1));
diff --git a/iot-common/iot-common-dao/iot-data-serviceImpl-rdb/src/main/java/cc/iotkit/data/service/ChannelDataImpl.java b/iot-common/iot-common-dao/iot-data-serviceImpl-rdb/src/main/java/cc/iotkit/data/service/ChannelDataImpl.java
index 5f83e91e..2c023447 100644
--- a/iot-common/iot-common-dao/iot-data-serviceImpl-rdb/src/main/java/cc/iotkit/data/service/ChannelDataImpl.java
+++ b/iot-common/iot-common-dao/iot-data-serviceImpl-rdb/src/main/java/cc/iotkit/data/service/ChannelDataImpl.java
@@ -1,24 +1,15 @@
package cc.iotkit.data.service;
-import cc.iotkit.common.api.PageRequest;
-import cc.iotkit.common.utils.MapstructUtils;
+import cc.iotkit.data.dao.ChannelRepository;
import cc.iotkit.data.dao.IJPACommData;
import cc.iotkit.data.manager.IChannelData;
-import cc.iotkit.data.dao.ChannelRepository;
import cc.iotkit.data.model.TbChannel;
-import cc.iotkit.common.api.Paging;
import cc.iotkit.model.notify.Channel;
-import org.apache.commons.lang3.StringUtils;
import org.springframework.context.annotation.Primary;
-import org.springframework.data.domain.Page;
-import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
-import java.util.Collection;
-import java.util.List;
-import java.util.UUID;
/**
* author: 石恒
@@ -27,7 +18,7 @@ import java.util.UUID;
**/
@Primary
@Service
-public class ChannelDataImpl implements IChannelData, IJPACommData {
+public class ChannelDataImpl implements IChannelData, IJPACommData {
@Resource
private ChannelRepository channelRepository;
@@ -47,29 +38,6 @@ public class ChannelDataImpl implements IChannelData, IJPACommData findAll() {
- return MapstructUtils.convert(channelRepository.findAll(), Channel.class);
- }
-
}
diff --git a/iot-common/iot-common-dao/iot-data-serviceImpl-rdb/src/main/java/cc/iotkit/data/service/ChannelTemplateDataImpl.java b/iot-common/iot-common-dao/iot-data-serviceImpl-rdb/src/main/java/cc/iotkit/data/service/ChannelTemplateDataImpl.java
index 700a0432..f4ec7ca2 100644
--- a/iot-common/iot-common-dao/iot-data-serviceImpl-rdb/src/main/java/cc/iotkit/data/service/ChannelTemplateDataImpl.java
+++ b/iot-common/iot-common-dao/iot-data-serviceImpl-rdb/src/main/java/cc/iotkit/data/service/ChannelTemplateDataImpl.java
@@ -1,24 +1,17 @@
package cc.iotkit.data.service;
-import cc.iotkit.common.api.PageRequest;
import cc.iotkit.common.utils.MapstructUtils;
+import cc.iotkit.data.dao.ChannelTemplateRepository;
import cc.iotkit.data.dao.IJPACommData;
import cc.iotkit.data.manager.IChannelTemplateData;
-import cc.iotkit.data.dao.ChannelTemplateRepository;
import cc.iotkit.data.model.TbChannelTemplate;
-import cc.iotkit.common.api.Paging;
import cc.iotkit.model.notify.ChannelTemplate;
-import org.apache.commons.lang3.StringUtils;
import org.springframework.context.annotation.Primary;
-import org.springframework.data.domain.Page;
-import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
-import java.util.Collection;
import java.util.List;
-import java.util.UUID;
import java.util.stream.Collectors;
/**
@@ -28,7 +21,7 @@ import java.util.stream.Collectors;
**/
@Primary
@Service
-public class ChannelTemplateDataImpl implements IChannelTemplateData, IJPACommData {
+public class ChannelTemplateDataImpl implements IChannelTemplateData, IJPACommData {
@Resource
private ChannelTemplateRepository channelTemplateRepository;
@@ -48,43 +41,12 @@ public class ChannelTemplateDataImpl implements IChannelTemplateData, IJPACommDa
return ChannelTemplate.class;
}
- @Override
- public ChannelTemplate findById(String id) {
- return MapstructUtils.convert(channelTemplateRepository.findById(id).orElse(null), ChannelTemplate.class);
- }
-
- @Override
- public List findByIds(Collection id) {
- return null;
- }
-
- @Override
- public ChannelTemplate save(ChannelTemplate data) {
- if (StringUtils.isBlank(data.getId())) {
- data.setId(UUID.randomUUID().toString());
- }
- channelTemplateRepository.save(MapstructUtils.convert(data, TbChannelTemplate.class));
- return data;
- }
@Override
public void batchSave(List data) {
}
-
- @Override
- public void deleteById(String id) {
- channelTemplateRepository.deleteById(id);
- }
-
- @Override
- public void deleteByIds(Collection strings) {
-
- }
-
-
-
@Override
public long count() {
return channelTemplateRepository.count();
@@ -97,11 +59,6 @@ public class ChannelTemplateDataImpl implements IChannelTemplateData, IJPACommDa
.collect(Collectors.toList());
}
- @Override
- public Paging findAll(PageRequest pageRequest) {
- return null;
- }
-
@Override
public List findAllByCondition(ChannelTemplate data) {
return null;
diff --git a/iot-common/iot-common-dao/iot-data-serviceImpl-rdb/src/main/java/cc/iotkit/data/service/NotifyMessageDataImpl.java b/iot-common/iot-common-dao/iot-data-serviceImpl-rdb/src/main/java/cc/iotkit/data/service/NotifyMessageDataImpl.java
index a5028fca..629ef35a 100644
--- a/iot-common/iot-common-dao/iot-data-serviceImpl-rdb/src/main/java/cc/iotkit/data/service/NotifyMessageDataImpl.java
+++ b/iot-common/iot-common-dao/iot-data-serviceImpl-rdb/src/main/java/cc/iotkit/data/service/NotifyMessageDataImpl.java
@@ -1,25 +1,15 @@
package cc.iotkit.data.service;
-import cc.iotkit.common.api.Paging;
-import cc.iotkit.common.utils.MapstructUtils;
import cc.iotkit.data.dao.IJPACommData;
import cc.iotkit.data.dao.NotifyMessageRepository;
import cc.iotkit.data.manager.INotifyMessageData;
import cc.iotkit.data.model.TbNotifyMessage;
-import cc.iotkit.data.model.TbOtaPackage;
-import cc.iotkit.model.notify.Channel;
import cc.iotkit.model.notify.NotifyMessage;
-import org.apache.commons.lang3.StringUtils;
import org.springframework.context.annotation.Primary;
-import org.springframework.data.domain.Page;
-import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
-import java.util.List;
-import java.util.UUID;
-import java.util.stream.Collectors;
/**
* @Author: 石恒
@@ -28,7 +18,7 @@ import java.util.stream.Collectors;
*/
@Primary
@Service
-public class NotifyMessageDataImpl implements INotifyMessageData, IJPACommData {
+public class NotifyMessageDataImpl implements INotifyMessageData, IJPACommData {
@Resource
private NotifyMessageRepository notifyMessageRepository;
diff --git a/iot-module/iot-manager/src/main/java/cc/iotkit/manager/controller/NotifyController.java b/iot-module/iot-manager/src/main/java/cc/iotkit/manager/controller/NotifyController.java
index 6e15f43d..a4e2b2cd 100644
--- a/iot-module/iot-manager/src/main/java/cc/iotkit/manager/controller/NotifyController.java
+++ b/iot-module/iot-manager/src/main/java/cc/iotkit/manager/controller/NotifyController.java
@@ -3,8 +3,12 @@ package cc.iotkit.manager.controller;
import cc.iotkit.common.api.PageRequest;
import cc.iotkit.common.api.Paging;
import cc.iotkit.common.api.Request;
+import cc.iotkit.common.validate.EditGroup;
+import cc.iotkit.common.validate.QueryGroup;
import cc.iotkit.manager.dto.bo.channel.ChannelConfigBo;
+import cc.iotkit.manager.dto.bo.channel.ChannelTemplateBo;
import cc.iotkit.manager.dto.vo.channel.ChannelConfigVo;
+import cc.iotkit.manager.dto.vo.channel.ChannelTemplateVo;
import cc.iotkit.manager.service.NotifyService;
import cc.iotkit.model.notify.Channel;
import cc.iotkit.model.notify.ChannelConfig;
@@ -41,21 +45,27 @@ public class NotifyController {
return notifyService.getChannelList();
}
- @ApiOperation("获取通道配置列表")
+ @ApiOperation("获取通道配置分页列表")
@PostMapping("/channel/config/getList")
- public Paging getChannelConfigList(PageRequest request) {
+ public Paging getChannelConfigList(@RequestBody @Validated(QueryGroup.class) PageRequest request) {
return notifyService.getChannelConfigList(request);
}
+ @ApiOperation("获取通道配置列表")
+ @PostMapping("/channel/config/getAll")
+ public List getChannelConfigAll() {
+ return notifyService.getChannelConfigAll();
+ }
+
@ApiOperation("新增通道配置")
@PostMapping("/channel/config/add")
- public ChannelConfig addChannelConfig(@RequestBody @Validated Request request) {
+ public ChannelConfig addChannelConfig(@RequestBody @Validated(EditGroup.class) Request request) {
return notifyService.addChannelConfig(request.getData());
}
@ApiOperation("根据ID获取通道配置")
@PostMapping("/channel/config/getById")
- public ChannelConfig getChannelConfigById(@RequestBody @Validated Request request) {
+ public ChannelConfig getChannelConfigById(@RequestBody @Validated(QueryGroup.class) Request request) {
return notifyService.getChannelConfigById(request.getData());
}
@@ -67,25 +77,25 @@ public class NotifyController {
@ApiOperation("删除通道配置")
@PostMapping("/channel/config/delById")
- public Boolean delChannelConfigById(@RequestBody @Validated Request request) {
+ public Boolean delChannelConfigById(@RequestBody @Validated Request request) {
return notifyService.delChannelConfigById(request.getData());
}
@ApiOperation("获取通道模板列表")
@PostMapping("/channel/template/getList")
- public List getChannelTemplateList() {
- return notifyService.getChannelTemplateList();
+ public Paging getChannelTemplateList(@RequestBody @Validated(QueryGroup.class) PageRequest request) {
+ return notifyService.getChannelTemplateList(request);
}
@ApiOperation("新增通道模板")
@PostMapping("/channel/template/add")
- public ChannelTemplate addChannelTemplate(@RequestBody @Validated Request request) {
+ public ChannelTemplate addChannelTemplate(@RequestBody @Validated(EditGroup.class) Request request) {
return notifyService.addChannelTemplate(request.getData());
}
@ApiOperation("根据ID获取通道模板")
@PostMapping("/channel/template/getById")
- public ChannelTemplate getChannelTemplateById(@RequestBody @Validated Request request) {
+ public ChannelTemplate getChannelTemplateById(@RequestBody @Validated Request request) {
return notifyService.getChannelTemplateById(request.getData());
}
@@ -97,7 +107,7 @@ public class NotifyController {
@ApiOperation("删除通道模板")
@PostMapping("/channel/template/delById")
- public Boolean delChannelTemplateById(@RequestBody @Validated Request request) {
+ public Boolean delChannelTemplateById(@RequestBody @Validated(EditGroup.class) Request request) {
return notifyService.delChannelTemplateById(request.getData());
}
diff --git a/iot-module/iot-manager/src/main/java/cc/iotkit/manager/dto/bo/channel/ChannelConfigBo.java b/iot-module/iot-manager/src/main/java/cc/iotkit/manager/dto/bo/channel/ChannelConfigBo.java
index e2f35659..17c797ba 100644
--- a/iot-module/iot-manager/src/main/java/cc/iotkit/manager/dto/bo/channel/ChannelConfigBo.java
+++ b/iot-module/iot-manager/src/main/java/cc/iotkit/manager/dto/bo/channel/ChannelConfigBo.java
@@ -22,7 +22,7 @@ public class ChannelConfigBo extends BaseDto {
private String id;
@ApiModelProperty(value="通道id")
- private String channelId;
+ private Long channelId;
@ApiModelProperty(value="通道配置名称")
private String title;
diff --git a/iot-module/iot-manager/src/main/java/cc/iotkit/manager/dto/bo/channel/ChannelTemplateBo.java b/iot-module/iot-manager/src/main/java/cc/iotkit/manager/dto/bo/channel/ChannelTemplateBo.java
new file mode 100644
index 00000000..dc328736
--- /dev/null
+++ b/iot-module/iot-manager/src/main/java/cc/iotkit/manager/dto/bo/channel/ChannelTemplateBo.java
@@ -0,0 +1,39 @@
+package cc.iotkit.manager.dto.bo.channel;
+
+import cc.iotkit.common.api.BaseDto;
+import cc.iotkit.model.notify.ChannelTemplate;
+import com.alibaba.excel.annotation.ExcelProperty;
+import io.github.linpeilie.annotations.AutoMapper;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+@ApiModel(value = "ChannelTemplateVo")
+@Data
+@EqualsAndHashCode(callSuper = true)
+@AutoMapper(target = ChannelTemplate.class, reverseConvertGenerate = false)
+public class ChannelTemplateBo extends BaseDto {
+
+ private static final long serialVersionUID = -1L;
+
+ @ApiModelProperty(value="通道模板id")
+ @ExcelProperty(value = "通道模板id")
+ private Long id;
+
+ @ApiModelProperty(value="通道配置id")
+ @ExcelProperty(value = "通道配置id")
+ private Long channelConfigId;
+
+ @ApiModelProperty(value="通道模板名称")
+ @ExcelProperty(value = "通道模板名称")
+ private String title;
+
+ @ApiModelProperty(value="通道模板内容")
+ @ExcelProperty(value = "通道模板内容")
+ private String content;
+
+ @ApiModelProperty(value="创建时间")
+ @ExcelProperty(value = "创建时间")
+ private Long createAt;
+}
diff --git a/iot-module/iot-manager/src/main/java/cc/iotkit/manager/dto/vo/channel/ChannelTemplateVo.java b/iot-module/iot-manager/src/main/java/cc/iotkit/manager/dto/vo/channel/ChannelTemplateVo.java
new file mode 100644
index 00000000..59d89a7c
--- /dev/null
+++ b/iot-module/iot-manager/src/main/java/cc/iotkit/manager/dto/vo/channel/ChannelTemplateVo.java
@@ -0,0 +1,40 @@
+package cc.iotkit.manager.dto.vo.channel;
+
+import cc.iotkit.model.notify.ChannelTemplate;
+import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
+import com.alibaba.excel.annotation.ExcelProperty;
+import io.github.linpeilie.annotations.AutoMapper;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.io.Serializable;
+
+@ApiModel(value = "ChannelTemplateVo")
+@Data
+@ExcelIgnoreUnannotated
+@AutoMapper(target = ChannelTemplate.class)
+public class ChannelTemplateVo implements Serializable {
+
+ private static final long serialVersionUID = -1L;
+
+ @ApiModelProperty(value="通道模板id")
+ @ExcelProperty(value = "通道模板id")
+ private Long id;
+
+ @ApiModelProperty(value="通道配置id")
+ @ExcelProperty(value = "通道配置id")
+ private Long channelConfigId;
+
+ @ApiModelProperty(value="通道模板名称")
+ @ExcelProperty(value = "通道模板名称")
+ private String title;
+
+ @ApiModelProperty(value="通道模板内容")
+ @ExcelProperty(value = "通道模板内容")
+ private String content;
+
+ @ApiModelProperty(value="创建时间")
+ @ExcelProperty(value = "创建时间")
+ private Long createAt;
+}
diff --git a/iot-module/iot-manager/src/main/java/cc/iotkit/manager/service/NotifyService.java b/iot-module/iot-manager/src/main/java/cc/iotkit/manager/service/NotifyService.java
index 1763524d..3ea19a94 100644
--- a/iot-module/iot-manager/src/main/java/cc/iotkit/manager/service/NotifyService.java
+++ b/iot-module/iot-manager/src/main/java/cc/iotkit/manager/service/NotifyService.java
@@ -2,11 +2,14 @@ package cc.iotkit.manager.service;
import cc.iotkit.common.api.PageRequest;
import cc.iotkit.common.api.Paging;
+import cc.iotkit.common.utils.MapstructUtils;
import cc.iotkit.data.manager.IChannelConfigData;
import cc.iotkit.data.manager.IChannelData;
import cc.iotkit.data.manager.IChannelTemplateData;
import cc.iotkit.manager.dto.bo.channel.ChannelConfigBo;
+import cc.iotkit.manager.dto.bo.channel.ChannelTemplateBo;
import cc.iotkit.manager.dto.vo.channel.ChannelConfigVo;
+import cc.iotkit.manager.dto.vo.channel.ChannelTemplateVo;
import cc.iotkit.model.notify.Channel;
import cc.iotkit.model.notify.ChannelConfig;
import cc.iotkit.model.notify.ChannelTemplate;
@@ -42,11 +45,15 @@ public class NotifyService {
return iChannelConfigData.findAll(request.to(ChannelConfig.class)).to(ChannelConfigVo.class);
}
+ public List getChannelConfigAll() {
+ return MapstructUtils.convert(iChannelConfigData.findAll(),ChannelConfigVo.class);
+ }
+
public ChannelConfig addChannelConfig(ChannelConfig channelConfig) {
return iChannelConfigData.save(channelConfig);
}
- public ChannelConfig getChannelConfigById(String id) {
+ public ChannelConfig getChannelConfigById(Long id) {
return iChannelConfigData.findById(id);
}
@@ -54,21 +61,20 @@ public class NotifyService {
return iChannelConfigData.save(channelConfig);
}
- public Boolean delChannelConfigById(String id) {
+ public Boolean delChannelConfigById(Long id) {
iChannelConfigData.deleteById(id);
return Boolean.TRUE;
}
- public List getChannelTemplateList() {
- List channelTemplateList = iChannelTemplateData.findAll();
- return channelTemplateList;
+ public Paging getChannelTemplateList(PageRequest request) {
+ return iChannelTemplateData.findAll(request.to(ChannelTemplate.class)).to(ChannelTemplateVo.class);
}
- public ChannelTemplate addChannelTemplate(ChannelTemplate channelTemplate) {
- return iChannelTemplateData.save(channelTemplate);
+ public ChannelTemplate addChannelTemplate(ChannelTemplateBo channelTemplate) {
+ return iChannelTemplateData.save(channelTemplate.to(ChannelTemplate.class));
}
- public ChannelTemplate getChannelTemplateById(String id) {
+ public ChannelTemplate getChannelTemplateById(Long id) {
return iChannelTemplateData.findById(id);
}
@@ -76,7 +82,7 @@ public class NotifyService {
return iChannelTemplateData.save(channelTemplate);
}
- public Boolean delChannelTemplateById(String id) {
+ public Boolean delChannelTemplateById(Long id) {
iChannelTemplateData.deleteById(id);
return Boolean.TRUE;
}