feat(sj_1.0.0): 新增通知人接口
This commit is contained in:
parent
d217fa2bee
commit
b738133d58
@ -0,0 +1,18 @@
|
|||||||
|
package com.aizuda.snailjob.template.datasource.persistence.mapper;
|
||||||
|
|
||||||
|
import com.aizuda.snailjob.template.datasource.persistence.po.NotifyRecipient;
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* 告警通知接收人 Mapper 接口
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author opensnail
|
||||||
|
* @since 2024-04-17
|
||||||
|
*/
|
||||||
|
@Mapper
|
||||||
|
public interface NotifyRecipientMapper extends BaseMapper<NotifyRecipient> {
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,74 @@
|
|||||||
|
package com.aizuda.snailjob.template.datasource.persistence.po;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
|
||||||
|
import java.io.Serial;
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.Setter;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* 告警通知接收人
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author opensnail
|
||||||
|
* @since 2024-04-17
|
||||||
|
*/
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
@TableName("sj_notify_recipient")
|
||||||
|
public class NotifyRecipient implements Serializable {
|
||||||
|
|
||||||
|
@Serial
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 主键
|
||||||
|
*/
|
||||||
|
@TableId(value = "id", type = IdType.AUTO)
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 命名空间id
|
||||||
|
*/
|
||||||
|
private String namespaceId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 组名称
|
||||||
|
*/
|
||||||
|
private String groupName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 接收人名称
|
||||||
|
*/
|
||||||
|
private String recipientName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 通知类型 1、钉钉 2、邮件 3、企业微信 4 飞书
|
||||||
|
*/
|
||||||
|
private Integer notifyType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 配置属性
|
||||||
|
*/
|
||||||
|
private String notifyAttribute;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 描述
|
||||||
|
*/
|
||||||
|
private String description;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建时间
|
||||||
|
*/
|
||||||
|
private LocalDateTime createDt;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改时间
|
||||||
|
*/
|
||||||
|
private LocalDateTime updateDt;
|
||||||
|
}
|
@ -0,0 +1,18 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
|
<mapper namespace="com.aizuda.snailjob.template.datasource.persistence.mapper.NotifyRecipientMapper">
|
||||||
|
|
||||||
|
<!-- 通用查询映射结果 -->
|
||||||
|
<resultMap id="BaseResultMap" type="com.aizuda.snailjob.template.datasource.persistence.po.NotifyRecipient">
|
||||||
|
<id column="id" property="id" />
|
||||||
|
<result column="namespace_id" property="namespaceId" />
|
||||||
|
<result column="group_name" property="groupName" />
|
||||||
|
<result column="recipient_name" property="recipientName" />
|
||||||
|
<result column="notify_type" property="notifyType" />
|
||||||
|
<result column="notify_attribute" property="notifyAttribute" />
|
||||||
|
<result column="description" property="description" />
|
||||||
|
<result column="create_dt" property="createDt" />
|
||||||
|
<result column="update_dt" property="updateDt" />
|
||||||
|
</resultMap>
|
||||||
|
|
||||||
|
</mapper>
|
@ -11,6 +11,7 @@ import com.aizuda.snailjob.server.web.model.base.PageResult;
|
|||||||
import com.aizuda.snailjob.server.web.model.request.NotifyConfigQueryVO;
|
import com.aizuda.snailjob.server.web.model.request.NotifyConfigQueryVO;
|
||||||
import com.aizuda.snailjob.server.web.model.request.NotifyConfigRequestVO;
|
import com.aizuda.snailjob.server.web.model.request.NotifyConfigRequestVO;
|
||||||
import com.aizuda.snailjob.server.web.model.response.NotifyConfigResponseVO;
|
import com.aizuda.snailjob.server.web.model.response.NotifyConfigResponseVO;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
@ -25,10 +26,9 @@ import java.util.List;
|
|||||||
*/
|
*/
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/notify-config")
|
@RequestMapping("/notify-config")
|
||||||
|
@RequiredArgsConstructor
|
||||||
public class NotifyConfigController {
|
public class NotifyConfigController {
|
||||||
|
private final NotifyConfigService notifyConfigService;
|
||||||
@Autowired
|
|
||||||
private NotifyConfigService notifyConfigService;
|
|
||||||
|
|
||||||
@LoginRequired
|
@LoginRequired
|
||||||
@GetMapping("list")
|
@GetMapping("list")
|
||||||
|
@ -0,0 +1,42 @@
|
|||||||
|
package com.aizuda.snailjob.server.web.controller;
|
||||||
|
|
||||||
|
import com.aizuda.snailjob.server.web.model.base.PageResult;
|
||||||
|
import com.aizuda.snailjob.server.web.model.request.NotifyRecipientQueryVO;
|
||||||
|
import com.aizuda.snailjob.server.web.model.request.NotifyRecipientRequestVO;
|
||||||
|
import com.aizuda.snailjob.server.web.model.response.NotifyRecipientResponseVO;
|
||||||
|
import com.aizuda.snailjob.server.web.service.NotifyRecipientService;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* 告警通知接收人 前端控制器
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author xiaowoniu
|
||||||
|
* @since 2024-04-17
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/notify-recipient")
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
public class NotifyRecipientController {
|
||||||
|
private final NotifyRecipientService notifyRecipientService;
|
||||||
|
|
||||||
|
@PostMapping
|
||||||
|
public Boolean saveNotifyRecipient(@RequestBody @Validated NotifyRecipientRequestVO requestVO) {
|
||||||
|
return notifyRecipientService.saveNotifyRecipient(requestVO);
|
||||||
|
}
|
||||||
|
|
||||||
|
@PutMapping
|
||||||
|
public Boolean updateNotifyRecipient(@RequestBody @Validated NotifyRecipientRequestVO requestVO) {
|
||||||
|
return notifyRecipientService.updateNotifyRecipient(requestVO);
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/page/list")
|
||||||
|
public PageResult<List<NotifyRecipientResponseVO>> getNotifyRecipientList(NotifyRecipientQueryVO queryVO) {
|
||||||
|
return notifyRecipientService.getNotifyRecipientList(queryVO);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,11 @@
|
|||||||
|
package com.aizuda.snailjob.server.web.model.request;
|
||||||
|
|
||||||
|
import com.aizuda.snailjob.server.web.model.base.BaseQueryVO;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author opensnail
|
||||||
|
* @date 2024-04-17 21:26:22
|
||||||
|
* @since sj_1.0.0
|
||||||
|
*/
|
||||||
|
public class NotifyRecipientQueryVO extends BaseQueryVO {
|
||||||
|
}
|
@ -0,0 +1,9 @@
|
|||||||
|
package com.aizuda.snailjob.server.web.model.request;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author opensnail
|
||||||
|
* @date 2024-04-17 22:03:33
|
||||||
|
* @since sj_1.0.0
|
||||||
|
*/
|
||||||
|
public class NotifyRecipientRequestVO {
|
||||||
|
}
|
@ -0,0 +1,52 @@
|
|||||||
|
package com.aizuda.snailjob.server.web.model.response;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author opensnail
|
||||||
|
* @date 2024-04-17 21:27:07
|
||||||
|
* @since sj_1.0.0
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class NotifyRecipientResponseVO {
|
||||||
|
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 命名空间id
|
||||||
|
*/
|
||||||
|
private String namespaceId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 组名称
|
||||||
|
*/
|
||||||
|
private String groupName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 接收人名称
|
||||||
|
*/
|
||||||
|
private String recipientName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 通知类型 1、钉钉 2、邮件 3、企业微信 4 飞书
|
||||||
|
*/
|
||||||
|
private Integer notifyType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 配置属性
|
||||||
|
*/
|
||||||
|
private String notifyAttribute;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 描述
|
||||||
|
*/
|
||||||
|
private String description;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建时间
|
||||||
|
*/
|
||||||
|
private LocalDateTime createDt;
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,23 @@
|
|||||||
|
package com.aizuda.snailjob.server.web.service;
|
||||||
|
|
||||||
|
import com.aizuda.snailjob.server.web.model.base.PageResult;
|
||||||
|
import com.aizuda.snailjob.server.web.model.request.NotifyRecipientQueryVO;
|
||||||
|
import com.aizuda.snailjob.server.web.model.request.NotifyRecipientRequestVO;
|
||||||
|
import com.aizuda.snailjob.server.web.model.response.NotifyRecipientResponseVO;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author opensnail
|
||||||
|
* @date 2024-04-17 21:24:21
|
||||||
|
* @since sj_1.0.0
|
||||||
|
*/
|
||||||
|
public interface NotifyRecipientService {
|
||||||
|
|
||||||
|
PageResult<List<NotifyRecipientResponseVO>> getNotifyRecipientList(NotifyRecipientQueryVO queryVO);
|
||||||
|
|
||||||
|
Boolean saveNotifyRecipient(NotifyRecipientRequestVO requestVO);
|
||||||
|
|
||||||
|
Boolean updateNotifyRecipient(NotifyRecipientRequestVO requestVO);
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,22 @@
|
|||||||
|
package com.aizuda.snailjob.server.web.service.convert;
|
||||||
|
|
||||||
|
import com.aizuda.snailjob.server.web.model.response.NotifyRecipientResponseVO;
|
||||||
|
import com.aizuda.snailjob.template.datasource.persistence.po.NotifyRecipient;
|
||||||
|
import org.mapstruct.Mapper;
|
||||||
|
import org.mapstruct.factory.Mappers;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author opensnail
|
||||||
|
* @date 2024-04-17 22:00:41
|
||||||
|
* @since sj_1.0.0
|
||||||
|
*/
|
||||||
|
@Mapper
|
||||||
|
public interface NotifyRecipientResponseVOConverter {
|
||||||
|
|
||||||
|
NotifyRecipientResponseVOConverter INSTANCE = Mappers.getMapper(NotifyRecipientResponseVOConverter.class);
|
||||||
|
|
||||||
|
List<NotifyRecipientResponseVO> toNotifyRecipientResponseVOs(List<NotifyRecipient> notifyRecipients);
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,46 @@
|
|||||||
|
package com.aizuda.snailjob.server.web.service.impl;
|
||||||
|
|
||||||
|
import com.aizuda.snailjob.server.web.model.base.PageResult;
|
||||||
|
import com.aizuda.snailjob.server.web.model.request.NotifyRecipientQueryVO;
|
||||||
|
import com.aizuda.snailjob.server.web.model.request.NotifyRecipientRequestVO;
|
||||||
|
import com.aizuda.snailjob.server.web.model.response.NotifyRecipientResponseVO;
|
||||||
|
import com.aizuda.snailjob.server.web.service.NotifyRecipientService;
|
||||||
|
import com.aizuda.snailjob.server.web.service.convert.NotifyRecipientResponseVOConverter;
|
||||||
|
import com.aizuda.snailjob.template.datasource.persistence.mapper.NotifyRecipientMapper;
|
||||||
|
import com.aizuda.snailjob.template.datasource.persistence.po.NotifyRecipient;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.PageDTO;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author opensnail
|
||||||
|
* @date 2024-04-17 21:24:51
|
||||||
|
* @since sj_1.0.0
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
public class NotifyRecipientServiceImpl implements NotifyRecipientService {
|
||||||
|
private final NotifyRecipientMapper notifyRecipientMapper;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public PageResult<List<NotifyRecipientResponseVO>> getNotifyRecipientList(NotifyRecipientQueryVO queryVO) {
|
||||||
|
PageDTO<NotifyRecipient> pageDTO = new PageDTO<>(queryVO.getPage(), queryVO.getSize());
|
||||||
|
|
||||||
|
PageDTO<NotifyRecipient> notifyRecipientPageDTO = notifyRecipientMapper.selectPage(pageDTO, new LambdaQueryWrapper<>());
|
||||||
|
|
||||||
|
return new PageResult<>(pageDTO, NotifyRecipientResponseVOConverter.INSTANCE.toNotifyRecipientResponseVOs(notifyRecipientPageDTO.getRecords()));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Boolean saveNotifyRecipient(NotifyRecipientRequestVO requestVO) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Boolean updateNotifyRecipient(NotifyRecipientRequestVO requestVO) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user