Compare commits
15 Commits
v210929095
...
master
| Author | SHA1 | Date |
|---|---|---|
|
|
ac27658665 | |
|
|
1f7903832e | |
|
|
d53381e5bf | |
|
|
a2c1404b12 | |
|
|
2a5d44d761 | |
|
|
7629b93293 | |
|
|
d602e80a5f | |
|
|
f29368dd58 | |
|
|
cd04c9a417 | |
|
|
2f3bdd12da | |
|
|
a7c8fc105f | |
|
|
4210e4843b | |
|
|
4e11f623b0 | |
|
|
d22dd9cc3c | |
|
|
92f2b132c9 |
|
|
@ -33,6 +33,9 @@ cp middleware/.env.example middleware/.env
|
|||
cp reader/src/main/resources/application.yml.example reader/src/main/resources/application.yml
|
||||
cp writer/src/main/resources/application.yml.example writer/src/main/resources/application.yml
|
||||
cp executor/src/main/resources/application.yml.example executor/src/main/resources/application.yml
|
||||
cp reader/src/main/resources/mail.properties.example reader/src/main/resources/mail.properties
|
||||
cp writer/src/main/resources/mail.properties.example writer/src/main/resources/mail.properties
|
||||
cp executor/src/main/resources/mail.properties.example executor/src/main/resources/mail.properties
|
||||
```
|
||||
|
||||
5. 修改 `{repo}/middleware/.env` 文件里 `SQL_SCRIPT_PATH` 和 `DOCKER_DATA_PATH` 绝对路径到本地磁盘
|
||||
|
|
|
|||
|
|
@ -13,10 +13,12 @@ public class NotificationSystemConstant {
|
|||
//平台编码
|
||||
public static final String PLATFORM_CODE_GITLINK = "gitlink"; //gitlink平台
|
||||
public static final String PLATFORM_CODE_HEHUI = "hehui"; //hehui平台
|
||||
public static final String PLATFORM_CODE_OSREDM = "osredm"; //红山开源平台
|
||||
public static final Map<String, String> PLATFORM_CODE_MAP = new HashMap<String, String>() {
|
||||
{
|
||||
put("gitlink", PLATFORM_CODE_GITLINK);
|
||||
put("hehui", PLATFORM_CODE_HEHUI);
|
||||
put("osredm", PLATFORM_CODE_OSREDM);
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -23,4 +23,9 @@ CREATE TABLE `gitlink_email_send_records` (
|
|||
PRIMARY KEY (`id`),
|
||||
KEY `index_on_email_and_status` (`email`,`status`),
|
||||
KEY `index_on_status` (`status`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3;
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3;
|
||||
|
||||
|
||||
-- 2023-01-05 更新字符集编码
|
||||
ALTER TABLE gitlink_email_jobs CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
|
||||
ALTER TABLE gitlink_email_send_records CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
|
||||
|
|
@ -35,4 +35,7 @@ ALTER TABLE gitlink_sys_notification ADD COLUMN (`type` TINYINT(4) NOT NULL DEFA
|
|||
|
||||
-- 2021-09-09 新增 source 字段区分消息来源、新增 extra 字段保存额外信息
|
||||
ALTER TABLE gitlink_sys_notification ADD source varchar(250) NULL COMMENT '消息来源';
|
||||
ALTER TABLE gitlink_sys_notification ADD extra TEXT NULL COMMENT '额外信息(备用字段)';
|
||||
ALTER TABLE gitlink_sys_notification ADD extra TEXT NULL COMMENT '额外信息(备用字段)';
|
||||
|
||||
-- 2023-01-05 更新字符集编码
|
||||
ALTER TABLE gitlink_sys_notification CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
|
||||
|
|
@ -24,4 +24,7 @@ ALTER TABLE hehui_sys_notification ADD COLUMN (`type` TINYINT(4) NOT NULL DEFAUL
|
|||
|
||||
-- 2021-09-10 新增 source 字段区分消息来源、新增 extra 字段保存额外信息
|
||||
ALTER TABLE hehui_sys_notification ADD source varchar(250) NULL COMMENT '消息来源';
|
||||
ALTER TABLE hehui_sys_notification ADD extra TEXT NULL COMMENT '额外信息(备用字段)';
|
||||
ALTER TABLE hehui_sys_notification ADD extra TEXT NULL COMMENT '额外信息(备用字段)';
|
||||
|
||||
-- 2023-01-05 更新字符集编码
|
||||
ALTER TABLE hehui_sys_notification CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
|
||||
|
|
@ -0,0 +1,30 @@
|
|||
|
||||
USE gitlink_notification;
|
||||
|
||||
-- 2022-02-14 新增红山平台
|
||||
INSERT INTO gns_platform_info(platform_code,platform_name,created_at,is_delete) VALUES('osredm','红山平台',NOW(),-1);
|
||||
|
||||
DROP TABLE IF EXISTS `osredm_sys_notification`;
|
||||
CREATE TABLE `osredm_sys_notification` (
|
||||
`id` INT NOT NULL AUTO_INCREMENT,
|
||||
`sender` INT(11) NOT NULL COMMENT '发送者id',
|
||||
`receiver` INT(11) NOT NULL COMMENT '接受者id',
|
||||
`content` TEXT NOT NULL COMMENT '消息内容:富文本',
|
||||
`notification_url` VARCHAR(2000) DEFAULT NULL COMMENT '消息跳转链接',
|
||||
`created_at` DATETIME NOT NULL DEFAULT NOW() COMMENT '创建时间',
|
||||
`status` TINYINT(4) NOT NULL DEFAULT 1 COMMENT '已读状态: 1未读,2已读',
|
||||
`is_delete` TINYINT(1) NOT NULL DEFAULT '-1' COMMENT '是否删除: -1未删除,1已删除',
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `index_on_receiver_and_status` (`receiver`,`status`),
|
||||
KEY `index_on_status` (`status`)
|
||||
) ENGINE=INNODB DEFAULT CHARSET=utf8mb3;
|
||||
|
||||
-- 2021-09-10 区分系统消息类型
|
||||
ALTER TABLE osredm_sys_notification ADD COLUMN (`type` TINYINT(4) NOT NULL DEFAULT 1 COMMENT '消息类型: 1系统消息,2@我');
|
||||
|
||||
-- 2021-09-10 新增 source 字段区分消息来源、新增 extra 字段保存额外信息
|
||||
ALTER TABLE osredm_sys_notification ADD source varchar(250) NULL COMMENT '消息来源';
|
||||
ALTER TABLE osredm_sys_notification ADD extra TEXT NULL COMMENT '额外信息(备用字段)';
|
||||
|
||||
-- 2023-01-05 更新字符集编码
|
||||
ALTER TABLE osredm_sys_notification CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
|
||||
|
|
@ -95,7 +95,8 @@ public class EmailService {
|
|||
flag = true;
|
||||
unSentEmailSendRecord.setSentAt(new Date());
|
||||
unSentEmailSendRecord.setStatus(flag ? NotificationSystemConstant.EMAIL_SENT_SUCCESS : NotificationSystemConstant.EMAIL_SENT_FAIL);
|
||||
} catch (MessagingException e) {
|
||||
} catch (Exception e) {
|
||||
unSentEmailSendRecord.setStatus(NotificationSystemConstant.EMAIL_SENT_FAIL);
|
||||
logger.error("发送邮件失败,email: " + unSentEmailSendRecord.getEmail() + "\n" + e);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,172 +1,181 @@
|
|||
version: '3'
|
||||
services:
|
||||
|
||||
mysql:
|
||||
image: mysql:${MYSQL_VERSION}
|
||||
container_name: ${MYSQL_CONTAINER_NAME}
|
||||
hostname: mysql
|
||||
environment:
|
||||
- MYSQL_ROOT_PASSWORD=${MYSQL_ROOT_PASSWORD}
|
||||
- MYSQL_USER=${MYSQL_USER}
|
||||
- MYSQL_PASSWORD=${MYSQL_PASSWORD}
|
||||
- MYSQL_DATABASE=${MYSQL_DATABASE}
|
||||
- TZ=Asia/Shanghai
|
||||
volumes:
|
||||
- ${DOCKER_DATA_PATH}/mysql:/var/lib/mysql
|
||||
- ${SQL_SCRIPT_PATH}/gns-notification.sql:/docker-entrypoint-initdb.d/0001.sql
|
||||
- ${SQL_SCRIPT_PATH}/hehui-gns-notification.sql:/docker-entrypoint-initdb.d/0002.sql
|
||||
- ${SQL_SCRIPT_PATH}/gns-email.sql:/docker-entrypoint-initdb.d/0003.sql
|
||||
command: --character-set-server=utf8mb4 --collation-server=utf8mb4_unicode_ci
|
||||
ports:
|
||||
- ${MYSQL_LOCAL_PORT}:3306
|
||||
networks:
|
||||
- gitlink_network
|
||||
|
||||
redis:
|
||||
image: redis:${REDIS_VERSION}
|
||||
container_name: ${REDIS_CONTAINER_NAME}
|
||||
hostname: redis
|
||||
volumes:
|
||||
- ${DOCKER_DATA_PATH}/redis/data:/data
|
||||
- ${DOCKER_DATA_PATH}/redis/logs:/logs
|
||||
environment:
|
||||
- TZ=Asia/Shanghai
|
||||
ports:
|
||||
- ${REDIS_LOCAL_PORT}:6379
|
||||
networks:
|
||||
- gitlink_network
|
||||
|
||||
# See Also: https://hub.docker.com/r/confluentinc/cp-zookeeper
|
||||
zookeeper:
|
||||
image: confluentinc/cp-zookeeper:latest
|
||||
container_name: ${ZOOKEEPER_CONTAINER_NAME}
|
||||
hostname: zookeeper
|
||||
environment:
|
||||
ZOOKEEPER_CLIENT_PORT: 2181
|
||||
ZOOKEEPER_TICK_TIME: 2000
|
||||
ports:
|
||||
- ${ZOOKEEPER_LOCAL_PORT}:2181
|
||||
# volumes:
|
||||
# - ${DOCKER_DATA_PATH}/zookeeper:/var/lib/zookeeper
|
||||
networks:
|
||||
- gitlink_network
|
||||
|
||||
# See Also: https://hub.docker.com/r/confluentinc/cp-kafka
|
||||
kafka1:
|
||||
image: confluentinc/cp-kafka:latest
|
||||
container_name: ${KAFKA_CONTAINER_01_NAME}
|
||||
hostname: kafka1
|
||||
depends_on:
|
||||
- zookeeper
|
||||
ports:
|
||||
- ${KAFKA_01_LOCAL_PORT}:29092
|
||||
# volumes:
|
||||
# - ${DOCKER_DATA_PATH}/kafka/${KAFKA_CONTAINER_01_NAME}/lib:/var/lib/kafka
|
||||
# - ${DOCKER_DATA_PATH}/kafka/${KAFKA_CONTAINER_01_NAME}/logs:/var/logs/kafka
|
||||
# - ${DOCKER_DATA_PATH}/kafka/${KAFKA_CONTAINER_01_NAME}/conf:/etc/kafka
|
||||
environment:
|
||||
KAFKA_BROKER_ID: 1
|
||||
KAFKA_ZOOKEEPER_CONNECT: zookeeper:2181
|
||||
KAFKA_ADVERTISED_LISTENERS: PLAINTEXT://kafka1:9092,PLAINTEXT_HOST://localhost:${KAFKA_01_LOCAL_PORT}
|
||||
KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: PLAINTEXT:PLAINTEXT,PLAINTEXT_HOST:PLAINTEXT
|
||||
KAFKA_INTER_BROKER_LISTENER_NAME: PLAINTEXT
|
||||
KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR: 1
|
||||
networks:
|
||||
- gitlink_network
|
||||
|
||||
# See Also: https://hub.docker.com/r/confluentinc/cp-kafka
|
||||
kafka2:
|
||||
image: confluentinc/cp-kafka:latest
|
||||
container_name: ${KAFKA_CONTAINER_02_NAME}
|
||||
hostname: kafka2
|
||||
depends_on:
|
||||
- zookeeper
|
||||
ports:
|
||||
- ${KAFKA_02_LOCAL_PORT}:39092
|
||||
# volumes:
|
||||
# - ${DOCKER_DATA_PATH}/kafka/${KAFKA_CONTAINER_02_NAME}/lib:/var/lib/kafka
|
||||
# - ${DOCKER_DATA_PATH}/kafka/${KAFKA_CONTAINER_02_NAME}/logs:/var/logs/kafka
|
||||
# - ${DOCKER_DATA_PATH}/kafka/${KAFKA_CONTAINER_02_NAME}/conf:/etc/kafka
|
||||
environment:
|
||||
KAFKA_BROKER_ID: 2
|
||||
KAFKA_ZOOKEEPER_CONNECT: zookeeper:2181
|
||||
KAFKA_ADVERTISED_LISTENERS: PLAINTEXT://kafka2:9092,PLAINTEXT_HOST://localhost:${KAFKA_02_LOCAL_PORT}
|
||||
KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: PLAINTEXT:PLAINTEXT,PLAINTEXT_HOST:PLAINTEXT
|
||||
KAFKA_INTER_BROKER_LISTENER_NAME: PLAINTEXT
|
||||
KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR: 1
|
||||
networks:
|
||||
- gitlink_network
|
||||
|
||||
gitlink-reader:
|
||||
container_name: ${GNS_READER_CONTAINER_NAME}
|
||||
hostname: gitlink_reader
|
||||
image: gitlink/gns-reader:${GITLINK_NOTIFICATION_SYS_VERSION}
|
||||
build:
|
||||
context: ../
|
||||
dockerfile: middleware/reader.Dockerfile
|
||||
networks:
|
||||
- gitlink_network
|
||||
environment:
|
||||
- TZ=Asia/Shanghai
|
||||
volumes:
|
||||
- ${DOCKER_DATA_PATH}/gitlink/:/data/logs/
|
||||
depends_on:
|
||||
- kafka1
|
||||
- kafka2
|
||||
- redis
|
||||
- mysql
|
||||
ports:
|
||||
- ${GNS_READER_LOCAL_PORT}:8081
|
||||
|
||||
gitlink-writer:
|
||||
container_name: ${GNS_WRITER_CONTAINER_NAME}
|
||||
hostname: gitlink_writer
|
||||
image: gitlink/gns-writer:${GITLINK_NOTIFICATION_SYS_VERSION}
|
||||
build:
|
||||
context: ../
|
||||
dockerfile: middleware/writer.Dockerfile
|
||||
networks:
|
||||
- gitlink_network
|
||||
environment:
|
||||
- TZ=Asia/Shanghai
|
||||
volumes:
|
||||
- ${DOCKER_DATA_PATH}/gitlink/:/data/logs/
|
||||
depends_on:
|
||||
- kafka1
|
||||
- kafka2
|
||||
- redis
|
||||
- mysql
|
||||
ports:
|
||||
- ${GNS_WRITER_LOCAL_PORT}:8082
|
||||
|
||||
gitlink-executor:
|
||||
container_name: ${GNS_EXECUTOR_CONTAINER_NAME}
|
||||
hostname: gitlink_executor
|
||||
image: gitlink/gns-executor:${GITLINK_NOTIFICATION_SYS_VERSION}
|
||||
build:
|
||||
context: ../
|
||||
dockerfile: middleware/executor.Dockerfile
|
||||
networks:
|
||||
- gitlink_network
|
||||
volumes:
|
||||
- ${DOCKER_DATA_PATH}/gitlink/:/data/logs/
|
||||
environment:
|
||||
- TZ=Asia/Shanghai
|
||||
depends_on:
|
||||
- kafka1
|
||||
- kafka2
|
||||
- redis
|
||||
- mysql
|
||||
ports:
|
||||
- ${GNS_EXECUTOR_LOCAL_PORT}:8083
|
||||
|
||||
networks:
|
||||
gitlink_network:
|
||||
driver: bridge
|
||||
name: gitlink_network
|
||||
driver_opts:
|
||||
com.docker.network.enable_ipv6: "true"
|
||||
|
||||
|
||||
|
||||
|
||||
version: '3'
|
||||
services:
|
||||
|
||||
mysql:
|
||||
image: mysql:${MYSQL_VERSION}
|
||||
container_name: ${MYSQL_CONTAINER_NAME}
|
||||
hostname: mysql
|
||||
environment:
|
||||
- MYSQL_ROOT_PASSWORD=${MYSQL_ROOT_PASSWORD}
|
||||
- MYSQL_USER=${MYSQL_USER}
|
||||
- MYSQL_PASSWORD=${MYSQL_PASSWORD}
|
||||
- MYSQL_DATABASE=${MYSQL_DATABASE}
|
||||
- TZ=Asia/Shanghai
|
||||
volumes:
|
||||
- ${DOCKER_DATA_PATH}/mysql:/var/lib/mysql
|
||||
- ${SQL_SCRIPT_PATH}/gns-notification.sql:/docker-entrypoint-initdb.d/0001.sql
|
||||
- ${SQL_SCRIPT_PATH}/hehui-gns-notification.sql:/docker-entrypoint-initdb.d/0002.sql
|
||||
- ${SQL_SCRIPT_PATH}/gns-email.sql:/docker-entrypoint-initdb.d/0003.sql
|
||||
- ${SQL_SCRIPT_PATH}/osredm-gns-notification.sql:/docker-entrypoint-initdb.d/0004.sql
|
||||
command: --character-set-server=utf8mb4 --collation-server=utf8mb4_unicode_ci
|
||||
ports:
|
||||
- ${MYSQL_LOCAL_PORT}:3306
|
||||
networks:
|
||||
- gitlink_network
|
||||
restart: always
|
||||
|
||||
redis:
|
||||
image: redis:${REDIS_VERSION}
|
||||
container_name: ${REDIS_CONTAINER_NAME}
|
||||
hostname: redis
|
||||
volumes:
|
||||
- ${DOCKER_DATA_PATH}/redis/data:/data
|
||||
- ${DOCKER_DATA_PATH}/redis/logs:/logs
|
||||
environment:
|
||||
- TZ=Asia/Shanghai
|
||||
ports:
|
||||
- ${REDIS_LOCAL_PORT}:6379
|
||||
networks:
|
||||
- gitlink_network
|
||||
restart: always
|
||||
|
||||
# See Also: https://hub.docker.com/r/confluentinc/cp-zookeeper
|
||||
zookeeper:
|
||||
image: confluentinc/cp-zookeeper:latest
|
||||
container_name: ${ZOOKEEPER_CONTAINER_NAME}
|
||||
hostname: zookeeper
|
||||
environment:
|
||||
ZOOKEEPER_CLIENT_PORT: 2181
|
||||
ZOOKEEPER_TICK_TIME: 2000
|
||||
ports:
|
||||
- ${ZOOKEEPER_LOCAL_PORT}:2181
|
||||
# volumes:
|
||||
# - ${DOCKER_DATA_PATH}/zookeeper:/var/lib/zookeeper
|
||||
networks:
|
||||
- gitlink_network
|
||||
restart: always
|
||||
|
||||
# See Also: https://hub.docker.com/r/confluentinc/cp-kafka
|
||||
kafka1:
|
||||
image: confluentinc/cp-kafka:latest
|
||||
container_name: ${KAFKA_CONTAINER_01_NAME}
|
||||
hostname: kafka1
|
||||
depends_on:
|
||||
- zookeeper
|
||||
ports:
|
||||
- ${KAFKA_01_LOCAL_PORT}:29092
|
||||
# volumes:
|
||||
# - ${DOCKER_DATA_PATH}/kafka/${KAFKA_CONTAINER_01_NAME}/lib:/var/lib/kafka
|
||||
# - ${DOCKER_DATA_PATH}/kafka/${KAFKA_CONTAINER_01_NAME}/logs:/var/logs/kafka
|
||||
# - ${DOCKER_DATA_PATH}/kafka/${KAFKA_CONTAINER_01_NAME}/conf:/etc/kafka
|
||||
environment:
|
||||
KAFKA_BROKER_ID: 1
|
||||
KAFKA_ZOOKEEPER_CONNECT: zookeeper:2181
|
||||
KAFKA_ADVERTISED_LISTENERS: PLAINTEXT://kafka1:9092,PLAINTEXT_HOST://localhost:${KAFKA_01_LOCAL_PORT}
|
||||
KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: PLAINTEXT:PLAINTEXT,PLAINTEXT_HOST:PLAINTEXT
|
||||
KAFKA_INTER_BROKER_LISTENER_NAME: PLAINTEXT
|
||||
KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR: 1
|
||||
networks:
|
||||
- gitlink_network
|
||||
restart: always
|
||||
|
||||
# See Also: https://hub.docker.com/r/confluentinc/cp-kafka
|
||||
kafka2:
|
||||
image: confluentinc/cp-kafka:latest
|
||||
container_name: ${KAFKA_CONTAINER_02_NAME}
|
||||
hostname: kafka2
|
||||
depends_on:
|
||||
- zookeeper
|
||||
ports:
|
||||
- ${KAFKA_02_LOCAL_PORT}:39092
|
||||
# volumes:
|
||||
# - ${DOCKER_DATA_PATH}/kafka/${KAFKA_CONTAINER_02_NAME}/lib:/var/lib/kafka
|
||||
# - ${DOCKER_DATA_PATH}/kafka/${KAFKA_CONTAINER_02_NAME}/logs:/var/logs/kafka
|
||||
# - ${DOCKER_DATA_PATH}/kafka/${KAFKA_CONTAINER_02_NAME}/conf:/etc/kafka
|
||||
environment:
|
||||
KAFKA_BROKER_ID: 2
|
||||
KAFKA_ZOOKEEPER_CONNECT: zookeeper:2181
|
||||
KAFKA_ADVERTISED_LISTENERS: PLAINTEXT://kafka2:9092,PLAINTEXT_HOST://localhost:${KAFKA_02_LOCAL_PORT}
|
||||
KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: PLAINTEXT:PLAINTEXT,PLAINTEXT_HOST:PLAINTEXT
|
||||
KAFKA_INTER_BROKER_LISTENER_NAME: PLAINTEXT
|
||||
KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR: 1
|
||||
networks:
|
||||
- gitlink_network
|
||||
restart: always
|
||||
|
||||
gitlink-reader:
|
||||
container_name: ${GNS_READER_CONTAINER_NAME}
|
||||
hostname: gitlink_reader
|
||||
image: gitlink/gns-reader:${GITLINK_NOTIFICATION_SYS_VERSION}
|
||||
build:
|
||||
context: ../
|
||||
dockerfile: middleware/reader.Dockerfile
|
||||
networks:
|
||||
- gitlink_network
|
||||
environment:
|
||||
- TZ=Asia/Shanghai
|
||||
volumes:
|
||||
- ${DOCKER_DATA_PATH}/gitlink/:/data/logs/
|
||||
depends_on:
|
||||
- kafka1
|
||||
- kafka2
|
||||
- redis
|
||||
- mysql
|
||||
ports:
|
||||
- ${GNS_READER_LOCAL_PORT}:8081
|
||||
restart: always
|
||||
|
||||
gitlink-writer:
|
||||
container_name: ${GNS_WRITER_CONTAINER_NAME}
|
||||
hostname: gitlink_writer
|
||||
image: gitlink/gns-writer:${GITLINK_NOTIFICATION_SYS_VERSION}
|
||||
build:
|
||||
context: ../
|
||||
dockerfile: middleware/writer.Dockerfile
|
||||
networks:
|
||||
- gitlink_network
|
||||
environment:
|
||||
- TZ=Asia/Shanghai
|
||||
volumes:
|
||||
- ${DOCKER_DATA_PATH}/gitlink/:/data/logs/
|
||||
depends_on:
|
||||
- kafka1
|
||||
- kafka2
|
||||
- redis
|
||||
- mysql
|
||||
ports:
|
||||
- ${GNS_WRITER_LOCAL_PORT}:8082
|
||||
restart: always
|
||||
|
||||
gitlink-executor:
|
||||
container_name: ${GNS_EXECUTOR_CONTAINER_NAME}
|
||||
hostname: gitlink_executor
|
||||
image: gitlink/gns-executor:${GITLINK_NOTIFICATION_SYS_VERSION}
|
||||
build:
|
||||
context: ../
|
||||
dockerfile: middleware/executor.Dockerfile
|
||||
networks:
|
||||
- gitlink_network
|
||||
volumes:
|
||||
- ${DOCKER_DATA_PATH}/gitlink/:/data/logs/
|
||||
environment:
|
||||
- TZ=Asia/Shanghai
|
||||
depends_on:
|
||||
- kafka1
|
||||
- kafka2
|
||||
- redis
|
||||
- mysql
|
||||
ports:
|
||||
- ${GNS_EXECUTOR_LOCAL_PORT}:8083
|
||||
restart: always
|
||||
|
||||
networks:
|
||||
gitlink_network:
|
||||
driver: bridge
|
||||
name: gitlink_network
|
||||
driver_opts:
|
||||
com.docker.network.enable_ipv6: "true"
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -39,6 +39,7 @@ public interface SysNotificationMapper extends BaseMapper<SysNotification> {
|
|||
|
||||
List<SysNotification> getSysNotificationPageList(Page page, String orderBy,
|
||||
@Param("type") int type,
|
||||
@Param("sources") String sources,
|
||||
@Param("platform") String platform,
|
||||
@Param("receiver") Integer receiver,
|
||||
@Param("status") Integer status);
|
||||
|
|
|
|||
|
|
@ -36,16 +36,17 @@ public interface SysNotificationService extends IService<SysNotification> {
|
|||
/**
|
||||
* 获取消息列表
|
||||
*
|
||||
* @param type 类型 -1 全部 1 系统消息、2 @我
|
||||
* @param page 页码
|
||||
* @param size 页大小
|
||||
* @param platform 平台编号
|
||||
* @param receiver 消息接收者
|
||||
* @param status 状态 -1 全部、1 未读 2 已读
|
||||
* @param type 类型 -1 全部 1 系统消息、2 @我
|
||||
* @param sources
|
||||
* @param page 页码
|
||||
* @param size 页大小
|
||||
* @return
|
||||
*/
|
||||
|
||||
Page<SysNotification> getNotification(String platform, Integer receiver, Integer status, Integer type, Integer page, Integer size) throws Exception;
|
||||
Page<SysNotification> getNotification(String platform, Integer receiver, Integer status, Integer type, String sources, Integer page, Integer size) throws Exception;
|
||||
|
||||
/**
|
||||
* @Description: 批量删除系统消息
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ public class SysNotificationServiceImpl extends ServiceImpl<SysNotificationMappe
|
|||
|
||||
@Override
|
||||
@Transactional
|
||||
public boolean sendNotification(NewSysNotificationVo newSysNotificationVo) throws Exception {
|
||||
public boolean sendNotification(NewSysNotificationVo newSysNotificationVo) {
|
||||
List<SysNotification> sysNotificationList = new ArrayList<>();
|
||||
List<String> list = Arrays.asList(newSysNotificationVo.getReceivers().split(","));
|
||||
for (String receiver : list) {
|
||||
|
|
@ -51,7 +51,7 @@ public class SysNotificationServiceImpl extends ServiceImpl<SysNotificationMappe
|
|||
}
|
||||
|
||||
@Override
|
||||
public int markNotificationAs(String platform, Integer receiver, String notificationIds, Integer status, Integer type) throws Exception {
|
||||
public int markNotificationAs(String platform, Integer receiver, String notificationIds, Integer status, Integer type) {
|
||||
int count = baseMapper.updateStatusByNotificationId(platform, receiver, notificationIds, status, type);
|
||||
if (count > 0) {
|
||||
this.delUserCache(platform, receiver);
|
||||
|
|
@ -60,7 +60,7 @@ public class SysNotificationServiceImpl extends ServiceImpl<SysNotificationMappe
|
|||
}
|
||||
|
||||
@Override
|
||||
public int getNotificationCount(String platform, Integer receiver, Integer type, Integer status) throws Exception {
|
||||
public int getNotificationCount(String platform, Integer receiver, Integer type, Integer status) {
|
||||
String cacheKey = cacheKeyForCount(platform, receiver, type, status);
|
||||
Object foundResult = this.redisUtil.get(cacheKey);
|
||||
if (foundResult != null) {
|
||||
|
|
@ -73,8 +73,8 @@ public class SysNotificationServiceImpl extends ServiceImpl<SysNotificationMappe
|
|||
|
||||
|
||||
@Override
|
||||
public Page<SysNotification> getNotification(String platform, Integer receiver, Integer status, Integer type, Integer page, Integer size) throws Exception {
|
||||
String cacheKey = cacheKeyForPage(platform, receiver, type, status, page, size);
|
||||
public Page<SysNotification> getNotification(String platform, Integer receiver, Integer status, Integer type, String sources, Integer page, Integer size) {
|
||||
String cacheKey = cacheKeyForPage(platform, receiver, type, sources, status, page, size);
|
||||
Object foundResult = this.redisUtil.get(cacheKey);
|
||||
if (foundResult != null) {
|
||||
return (Page<SysNotification>) foundResult;
|
||||
|
|
@ -82,7 +82,7 @@ public class SysNotificationServiceImpl extends ServiceImpl<SysNotificationMappe
|
|||
|
||||
Page<SysNotification> pageItem = new Page<SysNotification>(page, size);
|
||||
List<SysNotification> sysNotificationList = baseMapper.getSysNotificationPageList(
|
||||
pageItem, "", type, platform, receiver, status
|
||||
pageItem, "", type, sources, platform, receiver, status
|
||||
);
|
||||
pageItem.setRecords(sysNotificationList);
|
||||
this.redisUtil.set(cacheKey, pageItem);
|
||||
|
|
@ -90,7 +90,7 @@ public class SysNotificationServiceImpl extends ServiceImpl<SysNotificationMappe
|
|||
}
|
||||
|
||||
@Override
|
||||
public int deleteNotifications(String platform, Integer receiver, String notificationIds, Integer type) throws Exception {
|
||||
public int deleteNotifications(String platform, Integer receiver, String notificationIds, Integer type) {
|
||||
int count = baseMapper.deleteNotificationByIds(platform, receiver, notificationIds, type);
|
||||
if (count > 0) {
|
||||
this.delUserCache(platform, receiver);
|
||||
|
|
@ -107,8 +107,8 @@ public class SysNotificationServiceImpl extends ServiceImpl<SysNotificationMappe
|
|||
return String.format("%s#T%s#S%s#Count", cachePrefixForPlatform(platform, receiver), type, status);
|
||||
}
|
||||
|
||||
private static String cacheKeyForPage(String platform, Integer receiver, Integer type, Integer status, Integer page, Integer size) {
|
||||
return String.format("%s#T%s#S%s#P%s_S%s", cachePrefixForPlatform(platform, receiver), type, status, page, size);
|
||||
private static String cacheKeyForPage(String platform, Integer receiver, Integer type, String sources, Integer status, Integer page, Integer size) {
|
||||
return String.format("%s#T%s#%s#S%s#P%s_S%s", cachePrefixForPlatform(platform, receiver), type, sources, status, page, size);
|
||||
}
|
||||
|
||||
private static String cachePrefixForPlatform(String platform, Integer receiver) {
|
||||
|
|
|
|||
|
|
@ -202,6 +202,12 @@
|
|||
<if test="status != -1">
|
||||
and status = #{status}
|
||||
</if>
|
||||
<if test="sources != null and sources != ''">
|
||||
and source in
|
||||
<foreach collection="sources.split(',')" item="sources" open="(" separator="," close=")">
|
||||
#{sources}
|
||||
</foreach>
|
||||
</if>
|
||||
ORDER BY id DESC
|
||||
</select>
|
||||
<update id="deleteNotificationByIds">
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ public class ServiceTests {
|
|||
@Test
|
||||
public void testSysNotificationService() throws Exception {
|
||||
int i = sysNotificationService.getNotificationCount("gitlink", 234,1,1);
|
||||
Page<SysNotification> sysNotificationPage = sysNotificationService.getNotification("gitlink", 100,1,1,1,20);
|
||||
Page<SysNotification> sysNotificationPage = sysNotificationService.getNotification("gitlink", 100,1,1, "IssueChanged", 1,20);
|
||||
NewSysNotificationVo newSysNotificationVo = new NewSysNotificationVo();
|
||||
newSysNotificationVo.setSender(1);
|
||||
newSysNotificationVo.setReceivers("7,8");
|
||||
|
|
|
|||
|
|
@ -52,6 +52,9 @@ public class NotificationController {
|
|||
@ApiParam(value = "消息类型:值为-1时,获取全部信息;值为1时,获取系统消息;值为2时,获取@我消息", defaultValue = "-1")
|
||||
@RequestParam(name = "type", required = false, defaultValue = "-1") Integer type,
|
||||
|
||||
@ApiParam(value = "消息来源")
|
||||
@RequestParam(name = "sources", required = false) String sources,
|
||||
|
||||
@ApiParam(value = "页码:值为-1时(默认值),不开启分页;", required = false, defaultValue = "-1")
|
||||
@RequestParam(name = "page", required = false, defaultValue = "-1") Integer page,
|
||||
|
||||
|
|
@ -88,7 +91,7 @@ public class NotificationController {
|
|||
}
|
||||
|
||||
//分页的数据
|
||||
Page foundPage = notificationService.getNotification(platform, receiver, status, type, page, size);
|
||||
Page foundPage = notificationService.getNotification(platform, receiver, status, type, sources, page, size);
|
||||
if (foundPage != null) {
|
||||
notificationListVo.setPageNum(foundPage.getCurrent());
|
||||
notificationListVo.setPageSize(foundPage.getSize());
|
||||
|
|
|
|||
Loading…
Reference in New Issue