1、增加渠道账号信息表和接口

2、增加Dockerfile文件
master
3y 3 years ago
parent 8ed6ec7bae
commit c9b4bbe22b

@ -0,0 +1,37 @@
package com.java3y.austin.support.dao;
import com.java3y.austin.support.domain.ChannelAccount;
import com.java3y.austin.support.domain.MessageTemplate;
import com.java3y.austin.support.domain.SmsRecord;
import org.springframework.data.domain.Pageable;
import org.springframework.data.repository.CrudRepository;
import java.util.List;
/**
* Dao
*
* @author 3y
*/
public interface ChannelAccountDao extends CrudRepository<ChannelAccount, Long> {
/**
* )
*
* @param deleted 0 1
* @param channelType
* @return
*/
List<ChannelAccount> findAllByIsDeletedEqualsAndSendChannelEquals(Integer deleted, Integer channelType);
/**
*
*
* @param deleted
* @return
*/
Long countByIsDeletedEquals(Integer deleted);
}

@ -0,0 +1,61 @@
package com.java3y.austin.support.domain;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
/**
* @author 3y
*
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@Entity
public class ChannelAccount {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
/**
*
*/
private String name;
/**
*
* com.java3y.austin.common.enums.ChannelType
*/
private Integer sendChannel;
/**
*
*/
private String accountConfig;
/**
*
* 0
* 1
*/
private Integer isDeleted;
/**
* s
*/
private Integer created;
/**
* s
*/
private Integer updated;
}

@ -0,0 +1,51 @@
package com.java3y.austin.web.controller;
import com.java3y.austin.common.constant.AustinConstant;
import com.java3y.austin.common.vo.BasicResultVO;
import com.java3y.austin.support.dao.ChannelAccountDao;
import com.java3y.austin.support.domain.ChannelAccount;
import com.java3y.austin.support.domain.MessageTemplate;
import com.java3y.austin.web.service.ChannelAccountService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
/**
*
*
* @author 3y
*/
@Slf4j
@RestController
@RequestMapping("/account")
@Api("素材管理接口")
@CrossOrigin(origins = "http://localhost:3000", allowCredentials = "true", allowedHeaders = "*")
public class ChannelAccountController {
@Autowired
private ChannelAccountService channelAccountService;
/**
* Id
* Id
*/
@PostMapping("/save")
@ApiOperation("/保存数据")
public BasicResultVO saveOrUpdate(@RequestBody ChannelAccount channelAccount) {
return BasicResultVO.success(channelAccountService.save(channelAccount));
}
/**
*
*/
@GetMapping("/query")
@ApiOperation("/保存数据")
public BasicResultVO query(Integer channelType) {
return BasicResultVO.success(channelAccountService.queryByChannelType(channelType));
}
}

@ -0,0 +1,34 @@
package com.java3y.austin.web.service;
import com.java3y.austin.common.vo.BasicResultVO;
import com.java3y.austin.support.domain.ChannelAccount;
import org.springframework.web.multipart.MultipartFile;
import java.util.List;
/**
*
*
* @author 3y
*/
public interface ChannelAccountService {
/**
* /
*
* @param channelAccount
* @return
*/
ChannelAccount save(ChannelAccount channelAccount);
/**
*
*
* @param channelType
* @return
*/
List<ChannelAccount> queryByChannelType(Integer channelType);
}

@ -0,0 +1,35 @@
package com.java3y.austin.web.service.impl;
import cn.hutool.core.date.DateUtil;
import com.java3y.austin.common.constant.AustinConstant;
import com.java3y.austin.support.dao.ChannelAccountDao;
import com.java3y.austin.support.domain.ChannelAccount;
import com.java3y.austin.web.service.ChannelAccountService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* @author 3y
*/
@Service
public class ChannelAccountServiceImpl implements ChannelAccountService {
@Autowired
private ChannelAccountDao channelAccountDao;
@Override
public ChannelAccount save(ChannelAccount channelAccount) {
if (channelAccount.getId() == null) {
channelAccount.setCreated(Math.toIntExact(DateUtil.currentSeconds()));
channelAccount.setIsDeleted(AustinConstant.FALSE);
}
channelAccount.setUpdated(Math.toIntExact(DateUtil.currentSeconds()));
return channelAccountDao.save(channelAccount);
}
@Override
public List<ChannelAccount> queryByChannelType(Integer channelType) {
return channelAccountDao.findAllByIsDeletedEqualsAndSendChannelEquals(AustinConstant.FALSE, channelType);
}
}

@ -0,0 +1,17 @@
# 使用openjdk8的镜像
FROM openjdk:8-jre
ENV PARAMS=""
# 设置工作目录
WORKDIR /build
# 将jar包复制到容器中
ADD ./austin-web-0.0.1-SNAPSHOT.jar ./austin.jar
# 暴露8080端口
EXPOSE 8080
# 运行jar包
ENTRYPOINT ["sh","-c","java -jar $JAVA_OPTS austin.jar $PARAMS"]
# docker run -e PARAMS="--austin-database-ip= --austin-database-port=3306 --austin-redis-ip= --austin-mq-pipeline=eventbus " -p 8080:8080 --name austin:1.0

@ -1,6 +1,8 @@
create database austin;
create
database austin;
use austin;
use
austin;
CREATE TABLE `message_template`
@ -14,7 +16,7 @@ CREATE TABLE `message_template`
`cron_crowd_path` varchar(500) COMMENT '定时发送人群的文件路径',
`expect_push_time` varchar(100) COLLATE utf8mb4_unicode_ci COMMENT '期望发送时间0:立即发送 定时任务以及周期任务:cron表达式',
`id_type` tinyint(4) NOT NULL DEFAULT '0' COMMENT '消息的发送ID类型10. userId 20.did 30.手机号 40.openId 50.email 60.企业微信userId',
`send_channel` tinyint(4) NOT NULL DEFAULT '0' COMMENT '消息发送渠道10.IM 20.Push 30.短信 40.Email 50.公众号 60.小程序 70.企业微信',
`send_channel` tinyint(4) NOT NULL DEFAULT '0' COMMENT '消息发送渠道10.IM 20.Push 30.短信 40.Email 50.公众号 60.小程序 70.企业微信 80.钉钉机器人 90.钉钉工作通知 100.企业微信机器人 110.飞书机器人 110. 飞书应用消息 ',
`template_type` tinyint(4) NOT NULL DEFAULT '0' COMMENT '10.运营类 20.技术类接口调用',
`msg_type` tinyint(4) NOT NULL DEFAULT '0' COMMENT '10.通知类消息 20.营销类消息 30.验证码类消息',
`shield_type` tinyint(4) NOT NULL DEFAULT '0' COMMENT '10.夜间不屏蔽 20.夜间屏蔽 30.夜间屏蔽(次日早上9点发送)',
@ -59,12 +61,45 @@ CREATE TABLE `sms_record`
DEFAULT CHARSET = utf8mb4
COLLATE = utf8mb4_unicode_ci COMMENT ='短信记录信息';
CREATE TABLE `channel_account`
(
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`name` varchar(100) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT '账号名称',
`send_channel` tinyint(4) NOT NULL DEFAULT '0' COMMENT '消息发送渠道10.IM 20.Push 30.短信 40.Email 50.公众号 60.小程序 70.企业微信 80.钉钉机器人 90.钉钉工作通知 100.企业微信机器人 110.飞书机器人 110. 飞书应用消息 ',
`account_config` varchar(1024) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT '账号配置',
`created` int(11) NOT NULL DEFAULT '0' COMMENT '创建时间',
`updated` int(11) NOT NULL DEFAULT '0' COMMENT '更新时间',
`is_deleted` tinyint(4) NOT NULL DEFAULT '0' COMMENT '是否删除0.不删除 1.删除',
PRIMARY KEY (`id`),
KEY `idx_send_channel` (`send_channel`)
) ENGINE = InnoDB
AUTO_INCREMENT = 1
DEFAULT CHARSET = utf8mb4
COLLATE = utf8mb4_unicode_ci COMMENT ='渠道账号信息';
-- 实时类型 短信(无占位符)
INSERT INTO austin.message_template (id, name, audit_status, flow_id, msg_status, cron_task_id, cron_crowd_path, expect_push_time, id_type, send_channel, template_type, msg_type, msg_content, send_account, creator, updator, auditor, team, proposer, is_deleted, created, updated) VALUES (1, '买一送十活动', 10, '', 10, null, '', '', 30, 30, 20, 20, '{"content":"6666","url":"","title":""}', 10, 'Java3y', 'Java3y', '3y', '公众号Java3y', '三歪', 0, 1646274112, 1646275242);
INSERT INTO austin.message_template (id, name, audit_status, flow_id, msg_status, cron_task_id, cron_crowd_path,
expect_push_time, id_type, send_channel, template_type, msg_type, msg_content,
send_account, creator, updator, auditor, team, proposer, is_deleted, created,
updated)
VALUES (1, '买一送十活动', 10, '', 10, null, '', '', 30, 30, 20, 20, '{"content":"6666","url":"","title":""}', 10, 'Java3y',
'Java3y', '3y', '公众号Java3y', '三歪', 0, 1646274112, 1646275242);
-- 实时类型 邮件(无占位符)
INSERT INTO austin.message_template (id, name, audit_status, flow_id, msg_status, cron_task_id, cron_crowd_path, expect_push_time, id_type, send_channel, template_type, msg_type, msg_content, send_account, creator, updator, auditor, team, proposer, is_deleted, created, updated) VALUES (2, '校招信息', 10, '', 10, null, '', '', 50, 40, 20, 10, '{"content":"你已成功获取到offer","url":"","title":"招聘通知"}', 10, 'Java3y', 'Java3y', '3y', '公众号Java3y', '鸡蛋', 0, 1646274195, 1646274195);
INSERT INTO austin.message_template (id, name, audit_status, flow_id, msg_status, cron_task_id, cron_crowd_path,
expect_push_time, id_type, send_channel, template_type, msg_type, msg_content,
send_account, creator, updator, auditor, team, proposer, is_deleted, created,
updated)
VALUES (2, '校招信息', 10, '', 10, null, '', '', 50, 40, 20, 10, '{"content":"你已成功获取到offer","url":"","title":"招聘通知"}', 10,
'Java3y', 'Java3y', '3y', '公众号Java3y', '鸡蛋', 0, 1646274195, 1646274195);
-- 实时类型 短信有占位符占位符key 为 content
INSERT INTO austin.message_template (id, name, audit_status, flow_id, msg_status, cron_task_id, cron_crowd_path, expect_push_time, id_type, send_channel, template_type, msg_type, msg_content, send_account, creator, updator, auditor, team, proposer, is_deleted, created, updated) VALUES (3, '验证码通知', 10, '', 10, null, '', '', 30, 30, 20, 30, '{"content":"{$content}","url":"","title":""}', 10, 'Java3y', 'Java3y', '3y', '公众号Java3y', '孙悟空', 0, 1646275213, 1646275213);
INSERT INTO austin.message_template (id, name, audit_status, flow_id, msg_status, cron_task_id, cron_crowd_path,
expect_push_time, id_type, send_channel, template_type, msg_type, msg_content,
send_account, creator, updator, auditor, team, proposer, is_deleted, created,
updated)
VALUES (3, '验证码通知', 10, '', 10, null, '', '', 30, 30, 20, 30, '{"content":"{$content}","url":"","title":""}', 10,
'Java3y', 'Java3y', '3y', '公众号Java3y', '孙悟空', 0, 1646275213, 1646275213);

Loading…
Cancel
Save