fix:通道配置和模板配置完成
parent
d85c06e5fc
commit
04505e3495
|
@ -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",
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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}】<font color=\"warning\">温度过高</font>",
|
||||
"createAt": 1683816661690
|
||||
},
|
||||
{
|
||||
"id": "7fd90ab1-63c8-cd92-2a58-b7bd04f557f1",
|
||||
"channelConfigId": "75f37720-22bb-4f0b-f127-78f2091507a0",
|
||||
"id": 342353425,
|
||||
"channelConfigId": 1313123,
|
||||
"channelCode": "DingTalk",
|
||||
"title": "告警钉钉模板",
|
||||
"content": "您的设备【${title}】<font color=\"warning\">温度过高</font>",
|
||||
"createAt": 1683816661690
|
||||
},
|
||||
{
|
||||
"id": "74ece781-1d84-220b-cbb2-3270e245bb3b",
|
||||
"channelConfigId": "6e5db9b5-a709-723b-665b-bbca5ce6a62c",
|
||||
"id": 786778567,
|
||||
"channelConfigId": 32141342,
|
||||
"channelCode": "QyWechat",
|
||||
"title": "告警企业微信模板",
|
||||
"content": "您的设备【${title}】<font color=\"warning\">温度过高</font>",
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -15,9 +15,9 @@ import lombok.NoArgsConstructor;
|
|||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class Channel implements Id<String> {
|
||||
public class Channel implements Id<Long> {
|
||||
|
||||
private String id;
|
||||
private Long id;
|
||||
|
||||
private String code;
|
||||
|
||||
|
|
|
@ -18,11 +18,11 @@ import java.io.Serializable;
|
|||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class ChannelConfig implements Id<String> {
|
||||
public class ChannelConfig implements Id<Long> {
|
||||
|
||||
private String id;
|
||||
private Long id;
|
||||
|
||||
private String channelId;
|
||||
private Long channelId;
|
||||
|
||||
private String title;
|
||||
|
||||
|
|
|
@ -15,11 +15,11 @@ import lombok.NoArgsConstructor;
|
|||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class ChannelTemplate implements Id<String> {
|
||||
public class ChannelTemplate implements Id<Long> {
|
||||
|
||||
private String id;
|
||||
private Long id;
|
||||
|
||||
private String channelConfigId;
|
||||
private Long channelConfigId;
|
||||
|
||||
private String title;
|
||||
|
||||
|
|
|
@ -15,9 +15,9 @@ import lombok.NoArgsConstructor;
|
|||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class NotifyMessage implements Id<String> {
|
||||
public class NotifyMessage implements Id<Long> {
|
||||
|
||||
private String id;
|
||||
private Long id;
|
||||
|
||||
private String content;
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
||||
/**
|
||||
|
|
|
@ -8,5 +8,5 @@ import cc.iotkit.model.notify.ChannelConfig;
|
|||
* date: 2023-05-11 17:15
|
||||
* description:
|
||||
**/
|
||||
public interface IChannelConfigData extends ICommonData<ChannelConfig, String> {
|
||||
public interface IChannelConfigData extends ICommonData<ChannelConfig, Long> {
|
||||
}
|
||||
|
|
|
@ -8,6 +8,6 @@ import cc.iotkit.model.notify.Channel;
|
|||
* date: 2023-05-11 17:15
|
||||
* description:
|
||||
**/
|
||||
public interface IChannelData extends ICommonData<Channel, String> {
|
||||
public interface IChannelData extends ICommonData<Channel, Long> {
|
||||
|
||||
}
|
||||
|
|
|
@ -8,5 +8,5 @@ import cc.iotkit.model.notify.ChannelTemplate;
|
|||
* date: 2023-05-11 17:15
|
||||
* description:
|
||||
**/
|
||||
public interface IChannelTemplateData extends ICommonData<ChannelTemplate, String> {
|
||||
public interface IChannelTemplateData extends ICommonData<ChannelTemplate, Long> {
|
||||
}
|
||||
|
|
|
@ -8,5 +8,5 @@ import cc.iotkit.model.notify.NotifyMessage;
|
|||
* @Date: 2023/5/13 18:32
|
||||
* @Description:
|
||||
*/
|
||||
public interface INotifyMessageData extends ICommonData<NotifyMessage, String> {
|
||||
public interface INotifyMessageData extends ICommonData<NotifyMessage, Long> {
|
||||
}
|
||||
|
|
|
@ -8,5 +8,5 @@ import org.springframework.data.jpa.repository.JpaRepository;
|
|||
* @Date: 2023/5/11 21:00
|
||||
* @Description:
|
||||
*/
|
||||
public interface ChannelConfigRepository extends JpaRepository<TbChannelConfig, String> {
|
||||
public interface ChannelConfigRepository extends JpaRepository<TbChannelConfig, Long> {
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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<ChannelConfig, String> {
|
||||
public class ChannelConfigDataImpl implements IChannelConfigData, IJPACommData<ChannelConfig, Long> {
|
||||
|
||||
@Resource
|
||||
private ChannelConfigRepository channelConfigRepository;
|
||||
|
@ -51,31 +47,6 @@ public class ChannelConfigDataImpl implements IChannelConfigData, IJPACommData<C
|
|||
return ChannelConfig.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ChannelConfig findById(String id) {
|
||||
return channelConfigMapper.toDto(channelConfigRepository.findById(id).orElse(null));
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ChannelConfig> findByIds(Collection<String> 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<ChannelConfig> findAll() {
|
||||
return channelConfigRepository.findAll().stream().map(channelConfigMapper::toDto)
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
@Override
|
||||
public Paging<ChannelConfig> findAll(PageRequest<ChannelConfig> pageRequest) {
|
||||
Page<TbChannelConfig> tbChannelConfigs = channelConfigRepository.findAll(Pageable.ofSize(pageRequest.getPageSize()).withPage(pageRequest.getPageNum() - 1));
|
||||
|
|
|
@ -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<Channel, String> {
|
||||
public class ChannelDataImpl implements IChannelData, IJPACommData<Channel, Long> {
|
||||
|
||||
@Resource
|
||||
private ChannelRepository channelRepository;
|
||||
|
@ -47,29 +38,6 @@ public class ChannelDataImpl implements IChannelData, IJPACommData<Channel, Stri
|
|||
return Channel.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Channel findById(String id) {
|
||||
return MapstructUtils.convert(channelRepository.findById(id).orElse(null), Channel.class);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Channel save(Channel data) {
|
||||
if (StringUtils.isBlank(data.getId())) {
|
||||
data.setId(UUID.randomUUID().toString());
|
||||
}
|
||||
channelRepository.save(
|
||||
MapstructUtils.convert(data, TbChannel.class)
|
||||
);
|
||||
return data;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public List<Channel> findAll() {
|
||||
return MapstructUtils.convert(channelRepository.findAll(), Channel.class);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -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<ChannelTemplate, String> {
|
||||
public class ChannelTemplateDataImpl implements IChannelTemplateData, IJPACommData<ChannelTemplate, Long> {
|
||||
|
||||
@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<ChannelTemplate> findByIds(Collection<String> 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<ChannelTemplate> data) {
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void deleteById(String id) {
|
||||
channelTemplateRepository.deleteById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteByIds(Collection<String> strings) {
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public long count() {
|
||||
return channelTemplateRepository.count();
|
||||
|
@ -97,11 +59,6 @@ public class ChannelTemplateDataImpl implements IChannelTemplateData, IJPACommDa
|
|||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
@Override
|
||||
public Paging<ChannelTemplate> findAll(PageRequest<ChannelTemplate> pageRequest) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ChannelTemplate> findAllByCondition(ChannelTemplate data) {
|
||||
return null;
|
||||
|
|
|
@ -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<NotifyMessage, String> {
|
||||
public class NotifyMessageDataImpl implements INotifyMessageData, IJPACommData<NotifyMessage, Long> {
|
||||
|
||||
@Resource
|
||||
private NotifyMessageRepository notifyMessageRepository;
|
||||
|
|
|
@ -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<ChannelConfigVo> getChannelConfigList(PageRequest<ChannelConfigBo> request) {
|
||||
public Paging<ChannelConfigVo> getChannelConfigList(@RequestBody @Validated(QueryGroup.class) PageRequest<ChannelConfigBo> request) {
|
||||
return notifyService.getChannelConfigList(request);
|
||||
}
|
||||
|
||||
@ApiOperation("获取通道配置列表")
|
||||
@PostMapping("/channel/config/getAll")
|
||||
public List<ChannelConfigVo> getChannelConfigAll() {
|
||||
return notifyService.getChannelConfigAll();
|
||||
}
|
||||
|
||||
@ApiOperation("新增通道配置")
|
||||
@PostMapping("/channel/config/add")
|
||||
public ChannelConfig addChannelConfig(@RequestBody @Validated Request<ChannelConfig> request) {
|
||||
public ChannelConfig addChannelConfig(@RequestBody @Validated(EditGroup.class) Request<ChannelConfig> request) {
|
||||
return notifyService.addChannelConfig(request.getData());
|
||||
}
|
||||
|
||||
@ApiOperation("根据ID获取通道配置")
|
||||
@PostMapping("/channel/config/getById")
|
||||
public ChannelConfig getChannelConfigById(@RequestBody @Validated Request<String> request) {
|
||||
public ChannelConfig getChannelConfigById(@RequestBody @Validated(QueryGroup.class) Request<Long> request) {
|
||||
return notifyService.getChannelConfigById(request.getData());
|
||||
}
|
||||
|
||||
|
@ -67,25 +77,25 @@ public class NotifyController {
|
|||
|
||||
@ApiOperation("删除通道配置")
|
||||
@PostMapping("/channel/config/delById")
|
||||
public Boolean delChannelConfigById(@RequestBody @Validated Request<String> request) {
|
||||
public Boolean delChannelConfigById(@RequestBody @Validated Request<Long> request) {
|
||||
return notifyService.delChannelConfigById(request.getData());
|
||||
}
|
||||
|
||||
@ApiOperation("获取通道模板列表")
|
||||
@PostMapping("/channel/template/getList")
|
||||
public List<ChannelTemplate> getChannelTemplateList() {
|
||||
return notifyService.getChannelTemplateList();
|
||||
public Paging<ChannelTemplateVo> getChannelTemplateList(@RequestBody @Validated(QueryGroup.class) PageRequest<ChannelTemplateBo> request) {
|
||||
return notifyService.getChannelTemplateList(request);
|
||||
}
|
||||
|
||||
@ApiOperation("新增通道模板")
|
||||
@PostMapping("/channel/template/add")
|
||||
public ChannelTemplate addChannelTemplate(@RequestBody @Validated Request<ChannelTemplate> request) {
|
||||
public ChannelTemplate addChannelTemplate(@RequestBody @Validated(EditGroup.class) Request<ChannelTemplateBo> request) {
|
||||
return notifyService.addChannelTemplate(request.getData());
|
||||
}
|
||||
|
||||
@ApiOperation("根据ID获取通道模板")
|
||||
@PostMapping("/channel/template/getById")
|
||||
public ChannelTemplate getChannelTemplateById(@RequestBody @Validated Request<String> request) {
|
||||
public ChannelTemplate getChannelTemplateById(@RequestBody @Validated Request<Long> request) {
|
||||
return notifyService.getChannelTemplateById(request.getData());
|
||||
}
|
||||
|
||||
|
@ -97,7 +107,7 @@ public class NotifyController {
|
|||
|
||||
@ApiOperation("删除通道模板")
|
||||
@PostMapping("/channel/template/delById")
|
||||
public Boolean delChannelTemplateById(@RequestBody @Validated Request<String> request) {
|
||||
public Boolean delChannelTemplateById(@RequestBody @Validated(EditGroup.class) Request<Long> request) {
|
||||
return notifyService.delChannelTemplateById(request.getData());
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
}
|
|
@ -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;
|
||||
}
|
|
@ -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<ChannelConfigVo> 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<ChannelTemplate> getChannelTemplateList() {
|
||||
List<ChannelTemplate> channelTemplateList = iChannelTemplateData.findAll();
|
||||
return channelTemplateList;
|
||||
public Paging<ChannelTemplateVo> getChannelTemplateList(PageRequest<ChannelTemplateBo> 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;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue