init: 信创文件安全传输系统内外网本地 Docker 部署
包含 s-file 后端、React 前端、MeshSafe 安全检测对接,以及内外网两套 compose/nginx/配置(仅前端 28180/28280 对外发布,其余端口不暴露)。 说明:deploy/config/application-iw.yml 与 application-ow.yml 按维护者 明确要求原样入库,其中含本机 Docker 用的库口令、RabbitMQ 口令与 JWT 密钥;上生产前需替换。
This commit is contained in:
46
backend/db/init-data.sql
Normal file
46
backend/db/init-data.sql
Normal file
@@ -0,0 +1,46 @@
|
||||
-- 系统uc_platform
|
||||
INSERT INTO uc_platform
|
||||
(platform_code, name, full_name, short_name, business, deleted, create_time)
|
||||
VALUES(1, '文档系统', 's-file', 'file', true, FALSE, now());
|
||||
|
||||
-- 平台机构/平台机构管理员
|
||||
INSERT INTO xs_org
|
||||
(org_name, org_code, type, address_code, address_name, description, quality, enable, activated, parent_id, credit_code, trade, deleted, create_by, create_time, update_by, update_time, proxy_by, activation_code, phone, query_children, org_logo, registered_address, company_size, business_license, recruit_position_type)
|
||||
VALUES('senmesh', 'O001', '1', '440232', NULL, NULL, false, TRUE, TRUE, NULL, '', NULL, FALSE, 0, now(), 1, now(), null, NULL, null, NULL, null, '1234', '6', null, '1');
|
||||
|
||||
INSERT INTO uc_user
|
||||
(username, password, type, supeiror, security_code, nickname, avatar, phone, phone_binding, real_name, card_no, authenticated, status, email, address, education, init_user_id, enabled, account_non_expired, account_non_locked, credentials_non_expired, deleted, create_by, create_time, update_by, update_time, proxy_by, gender, birthday)
|
||||
VALUES('admin', '$2a$10$0N3iaxx2sYv0hXvYzS4.6.yriL.DfjRTjED7Y4vkqxzbxi2dNpBou', 1, TRUE, '$2a$10$mGA1jdBzq8micEr02KiJ9OiYQz1fc/PSVG0hN0EYUuxhZp8EI1M2q', '平台管理员', '', '13888888888', TRUE, '平台管理员', NULL, FALSE, 2, null, NULL, NULL, NULL, TRUE, TRUE, TRUE, TRUE, FALSE, 0, now(), 1, NULL, NULL, NULL, NULL);
|
||||
INSERT INTO uc_org_user
|
||||
(user_id, org_id, administrator, deleted, create_by, create_time, update_by, update_time, proxy_by)
|
||||
VALUES(1, 1, TRUE, FALSE, 0, now(), NULL, NULL, NULL);
|
||||
-- 平台uc_org_relation
|
||||
INSERT INTO uc_org_relation
|
||||
(org_id, org_type, parent_id, path, platform_code, platform_name, deleted, create_by, create_time, update_by, update_time, proxy_by)
|
||||
VALUES(1, 1, 0, '1', 1, NULL, FALSE, NULL, NULL, NULL, NULL, NULL);
|
||||
|
||||
-- ----------------------------
|
||||
-- Records of x_file_category
|
||||
-- ----------------------------
|
||||
INSERT INTO x_file_category (file_category, file_suffix, deleted, create_by, create_time) VALUES
|
||||
('video', 'mp4', FALSE, 0, NOW()),
|
||||
('video', 'mkv', FALSE, 0, NOW()),
|
||||
('video', 'avi', FALSE, 0, NOW()),
|
||||
('video', 'mov', FALSE, 0, NOW()),
|
||||
('video', 'wmv', FALSE, 0, NOW()),
|
||||
('video', 'flv', FALSE, 0, NOW()),
|
||||
('audio', 'mp3', FALSE, 0, NOW()),
|
||||
('audio', 'wav', FALSE, 0, NOW()),
|
||||
('audio', 'flac', FALSE, 0, NOW()),
|
||||
('audio', 'aac', FALSE, 0, NOW()),
|
||||
('document', 'txt', FALSE, 0, NOW()),
|
||||
('document', 'docx', FALSE, 0, NOW()),
|
||||
('document', 'pdf', FALSE, 0, NOW()),
|
||||
('document', 'epub', FALSE, 0, NOW()),
|
||||
('other', 'zip', FALSE, 0, NOW()),
|
||||
('other', 'rar', FALSE, 0, NOW()),
|
||||
('other', '7z', FALSE, 0, NOW()),
|
||||
('other', 'jpg', FALSE, 0, NOW()),
|
||||
('other', 'png', FALSE, 0, NOW()),
|
||||
('other', 'gif', FALSE, 0, NOW()),
|
||||
('other', 'tiff', FALSE, 0, NOW());
|
||||
2082
backend/db/init-table-postgres-full.sql
Normal file
2082
backend/db/init-table-postgres-full.sql
Normal file
File diff suppressed because it is too large
Load Diff
1302
backend/db/init-table.sql
Normal file
1302
backend/db/init-table.sql
Normal file
File diff suppressed because it is too large
Load Diff
62
backend/db/upgrade-20260914-upload-config.sql
Normal file
62
backend/db/upgrade-20260914-upload-config.sql
Normal file
@@ -0,0 +1,62 @@
|
||||
-- =============================================================
|
||||
-- 升级脚本:机构上传配置(文件上传类型/大小限制)
|
||||
-- 日期:2026-09-14
|
||||
-- 说明:新增 x_upload_config 表(一行对应一个机构)。
|
||||
-- 机构管理员可配置本机构允许上传的文件后缀白名单、
|
||||
-- 单文件大小上限、上传总开关;未配置的机构默认允许全部。
|
||||
-- 拦截点:网盘上传落库(normal_user_file/create)。
|
||||
-- 执行方式:MySQL/达梦(DM8 MySQL兼容模式)执行第 1 节;
|
||||
-- PostgreSQL 执行第 2 节。
|
||||
-- =============================================================
|
||||
|
||||
-- -------------------------------------------------------------
|
||||
-- 1. MySQL / 达梦 DM8
|
||||
-- -------------------------------------------------------------
|
||||
CREATE TABLE `x_upload_config` (
|
||||
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键ID',
|
||||
`org_id` bigint(20) DEFAULT NULL COMMENT '机构id',
|
||||
`upload_enabled` bit(1) DEFAULT b'1' COMMENT '是否允许上传',
|
||||
`allow_all_type` bit(1) DEFAULT b'1' COMMENT '是否允许全部类型(false时按allowed_suffixes白名单校验)',
|
||||
`allowed_suffixes` varchar(1024) DEFAULT NULL COMMENT '允许的文件后缀(逗号分隔,小写),allow_all_type=false时生效',
|
||||
`max_file_size` bigint(20) DEFAULT NULL COMMENT '单文件大小上限(MB),空或0不限制',
|
||||
`deleted` bit(1) DEFAULT b'0' COMMENT '是否删除',
|
||||
`create_by` bigint(20) DEFAULT NULL COMMENT '创建人',
|
||||
`create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
|
||||
`update_by` bigint(20) DEFAULT NULL COMMENT '修改人',
|
||||
`update_time` datetime DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间',
|
||||
`proxy_by` bigint(20) DEFAULT NULL COMMENT '代理人',
|
||||
PRIMARY KEY (`id`) USING BTREE,
|
||||
UNIQUE KEY `uk_org_id` (`org_id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='机构上传配置';
|
||||
|
||||
-- -------------------------------------------------------------
|
||||
-- 2. PostgreSQL
|
||||
-- -------------------------------------------------------------
|
||||
CREATE TABLE x_upload_config (
|
||||
id BIGSERIAL PRIMARY KEY,
|
||||
org_id BIGINT DEFAULT NULL,
|
||||
upload_enabled BOOLEAN DEFAULT TRUE,
|
||||
allow_all_type BOOLEAN DEFAULT TRUE,
|
||||
allowed_suffixes VARCHAR(1024) DEFAULT NULL,
|
||||
max_file_size BIGINT DEFAULT NULL,
|
||||
deleted BOOLEAN DEFAULT FALSE,
|
||||
create_by BIGINT DEFAULT NULL,
|
||||
create_time TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
||||
update_by BIGINT DEFAULT NULL,
|
||||
update_time TIMESTAMP DEFAULT NULL,
|
||||
proxy_by BIGINT DEFAULT NULL,
|
||||
CONSTRAINT uk_upload_config_org_id UNIQUE (org_id)
|
||||
);
|
||||
COMMENT ON TABLE x_upload_config IS '机构上传配置';
|
||||
COMMENT ON COLUMN x_upload_config.id IS '主键ID';
|
||||
COMMENT ON COLUMN x_upload_config.org_id IS '机构id';
|
||||
COMMENT ON COLUMN x_upload_config.upload_enabled IS '是否允许上传';
|
||||
COMMENT ON COLUMN x_upload_config.allow_all_type IS '是否允许全部类型(false时按allowed_suffixes白名单校验)';
|
||||
COMMENT ON COLUMN x_upload_config.allowed_suffixes IS '允许的文件后缀(逗号分隔,小写),allow_all_type=false时生效';
|
||||
COMMENT ON COLUMN x_upload_config.max_file_size IS '单文件大小上限(MB),空或0不限制';
|
||||
COMMENT ON COLUMN x_upload_config.deleted IS '是否删除';
|
||||
COMMENT ON COLUMN x_upload_config.create_by IS '创建人';
|
||||
COMMENT ON COLUMN x_upload_config.create_time IS '创建时间';
|
||||
COMMENT ON COLUMN x_upload_config.update_by IS '修改人';
|
||||
COMMENT ON COLUMN x_upload_config.update_time IS '修改时间';
|
||||
COMMENT ON COLUMN x_upload_config.proxy_by IS '代理人';
|
||||
90
backend/db/upgrade-20260915-release.sql
Normal file
90
backend/db/upgrade-20260915-release.sql
Normal file
@@ -0,0 +1,90 @@
|
||||
-- =====================================================================
|
||||
-- s-file 上线数据库脚本(2026-09-15 版本)
|
||||
-- 适用场景:已有生产库升级(老版本 → 当前版本)
|
||||
--
|
||||
-- 本次版本(用户启停/注销、机构账号查询、手机号查记录、机构上传配置)
|
||||
-- 相对老版本的数据库变更只有一项:
|
||||
-- 新增表 x_upload_config(机构上传配置)
|
||||
-- 其余功能(启停/注销/查询)全部复用已有表字段,无需任何变更。
|
||||
--
|
||||
-- 【执行说明】
|
||||
-- * 生产主力库为达梦 DM8(MySQL 兼容模式)→ 只执行【第一部分】
|
||||
-- * 若目标库是 PostgreSQL → 只执行【第二部分】
|
||||
-- * 执行前建议备份;执行后核对【第三部分】的验证 SQL
|
||||
-- * 可重复执行(幂等):表已存在时再执行会报"已存在"错误,属正常,
|
||||
-- 说明该脚本已执行过,无需处理
|
||||
-- =====================================================================
|
||||
|
||||
|
||||
-- =====================================================================
|
||||
-- 第一部分:达梦 DM8 / MySQL
|
||||
-- =====================================================================
|
||||
|
||||
CREATE TABLE x_upload_config (
|
||||
id BIGINT NOT NULL AUTO_INCREMENT COMMENT '主键ID',
|
||||
org_id BIGINT DEFAULT NULL COMMENT '机构id',
|
||||
upload_enabled BIT(1) DEFAULT b'1' COMMENT '是否允许上传',
|
||||
allow_all_type BIT(1) DEFAULT b'1' COMMENT '是否允许全部类型(false时按allowed_suffixes白名单校验)',
|
||||
allowed_suffixes VARCHAR(1024) DEFAULT NULL COMMENT '允许的文件后缀(逗号分隔,小写),allow_all_type=false时生效',
|
||||
max_file_size BIGINT DEFAULT NULL COMMENT '单文件大小上限(MB),空或0不限制',
|
||||
deleted BIT(1) DEFAULT b'0' COMMENT '是否删除',
|
||||
create_by BIGINT DEFAULT NULL COMMENT '创建人',
|
||||
create_time DATETIME DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
|
||||
update_by BIGINT DEFAULT NULL COMMENT '修改人',
|
||||
update_time DATETIME DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间',
|
||||
proxy_by BIGINT DEFAULT NULL COMMENT '代理人',
|
||||
PRIMARY KEY (id) USING BTREE,
|
||||
UNIQUE KEY uk_org_id (org_id)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='机构上传配置';
|
||||
|
||||
-- 说明:不需要初始化数据。
|
||||
-- 未配置的机构 = 默认策略(允许上传全部类型、不限大小),
|
||||
-- 由各机构管理员在管理后台"上传配置"页面自行配置后落库。
|
||||
|
||||
|
||||
-- =====================================================================
|
||||
-- 第二部分:PostgreSQL
|
||||
-- =====================================================================
|
||||
|
||||
-- CREATE TABLE x_upload_config (
|
||||
-- id BIGSERIAL PRIMARY KEY,
|
||||
-- org_id BIGINT DEFAULT NULL,
|
||||
-- upload_enabled BOOLEAN DEFAULT TRUE,
|
||||
-- allow_all_type BOOLEAN DEFAULT TRUE,
|
||||
-- allowed_suffixes VARCHAR(1024) DEFAULT NULL,
|
||||
-- max_file_size BIGINT DEFAULT NULL,
|
||||
-- deleted BOOLEAN DEFAULT FALSE,
|
||||
-- create_by BIGINT DEFAULT NULL,
|
||||
-- create_time TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
||||
-- update_by BIGINT DEFAULT NULL,
|
||||
-- update_time TIMESTAMP DEFAULT NULL,
|
||||
-- proxy_by BIGINT DEFAULT NULL,
|
||||
-- CONSTRAINT uk_upload_config_org_id UNIQUE (org_id)
|
||||
-- );
|
||||
-- COMMENT ON TABLE x_upload_config IS '机构上传配置';
|
||||
-- COMMENT ON COLUMN x_upload_config.id IS '主键ID';
|
||||
-- COMMENT ON COLUMN x_upload_config.org_id IS '机构id';
|
||||
-- COMMENT ON COLUMN x_upload_config.upload_enabled IS '是否允许上传';
|
||||
-- COMMENT ON COLUMN x_upload_config.allow_all_type IS '是否允许全部类型(false时按allowed_suffixes白名单校验)';
|
||||
-- COMMENT ON COLUMN x_upload_config.allowed_suffixes IS '允许的文件后缀(逗号分隔,小写),allow_all_type=false时生效';
|
||||
-- COMMENT ON COLUMN x_upload_config.max_file_size IS '单文件大小上限(MB),空或0不限制';
|
||||
-- COMMENT ON COLUMN x_upload_config.deleted IS '是否删除';
|
||||
-- COMMENT ON COLUMN x_upload_config.create_by IS '创建人';
|
||||
-- COMMENT ON COLUMN x_upload_config.create_time IS '创建时间';
|
||||
-- COMMENT ON COLUMN x_upload_config.update_by IS '修改人';
|
||||
-- COMMENT ON COLUMN x_upload_config.update_time IS '修改时间';
|
||||
-- COMMENT ON COLUMN x_upload_config.proxy_by IS '代理人';
|
||||
|
||||
|
||||
-- =====================================================================
|
||||
-- 第三部分:执行后验证(达梦/MySQL 语法)
|
||||
-- =====================================================================
|
||||
|
||||
-- 1) 表存在且为空(0 行正常)
|
||||
-- SELECT COUNT(*) FROM x_upload_config;
|
||||
|
||||
-- 2) 唯一约束存在(应返回 uk_org_id)
|
||||
-- SELECT INDEX_NAME FROM USER_INDEXES WHERE TABLE_NAME = 'X_UPLOAD_CONFIG';
|
||||
|
||||
-- 3) (可选)回滚脚本 —— 如需回滚上线:
|
||||
-- DROP TABLE x_upload_config;
|
||||
71
backend/db/upgrade-20261101-meshsafe-file-security.sql
Normal file
71
backend/db/upgrade-20261101-meshsafe-file-security.sql
Normal file
@@ -0,0 +1,71 @@
|
||||
-- =============================================================
|
||||
-- 升级脚本:MeshSafe 文件安全检测对接
|
||||
-- 日期:2026-11-01
|
||||
-- 说明:新增 x_file_security 表(按文件编码维度记录安全检测结果)。
|
||||
-- 文件上传/传输接收解包后自动提交 MeshSafe 检测,
|
||||
-- 检测结论(通过/不通过)回写本表;同一文件允许多条检测
|
||||
-- 记录(人工复核、重新检测均新增记录),业务取最新一条生效。
|
||||
-- 检测不通过的文件禁止分享与跨网传输(下载预览不受限)。
|
||||
-- 执行方式:MySQL/达梦(DM8 MySQL兼容模式)执行第 1 节;
|
||||
-- PostgreSQL 执行第 2 节。
|
||||
-- =============================================================
|
||||
|
||||
-- -------------------------------------------------------------
|
||||
-- 1. MySQL / 达梦 DM8
|
||||
-- -------------------------------------------------------------
|
||||
CREATE TABLE `x_file_security` (
|
||||
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键ID',
|
||||
`file_code` varchar(32) DEFAULT NULL COMMENT '文件编码',
|
||||
`task_id` varchar(64) DEFAULT NULL COMMENT 'MeshSafe检测任务ID',
|
||||
`scan_status` varchar(2) DEFAULT NULL COMMENT '检测状态:1检测中/2通过/3不通过/4检测失败',
|
||||
`action` varchar(32) DEFAULT NULL COMMENT 'MeshSafe处置动作:pass/manual_review/reject',
|
||||
`reason` varchar(1024) DEFAULT NULL COMMENT '检测结论说明',
|
||||
`result_json` text DEFAULT NULL COMMENT '检测完整结果JSON',
|
||||
`review_comment` varchar(512) DEFAULT NULL COMMENT '人工复核说明(人工改判时有值)',
|
||||
`deleted` bit(1) DEFAULT b'0' COMMENT '是否删除',
|
||||
`create_by` bigint(20) DEFAULT NULL COMMENT '创建人',
|
||||
`create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
|
||||
`update_by` bigint(20) DEFAULT NULL COMMENT '修改人',
|
||||
`update_time` datetime DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间',
|
||||
`proxy_by` bigint(20) DEFAULT NULL COMMENT '代理人',
|
||||
PRIMARY KEY (`id`) USING BTREE,
|
||||
KEY `idx_file_security_file_code` (`file_code`) USING BTREE,
|
||||
KEY `idx_file_security_scan_status` (`scan_status`) USING BTREE
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='文件安全检测记录';
|
||||
|
||||
-- -------------------------------------------------------------
|
||||
-- 2. PostgreSQL
|
||||
-- -------------------------------------------------------------
|
||||
CREATE TABLE x_file_security (
|
||||
id BIGSERIAL PRIMARY KEY,
|
||||
file_code VARCHAR(32) DEFAULT NULL,
|
||||
task_id VARCHAR(64) DEFAULT NULL,
|
||||
scan_status VARCHAR(2) DEFAULT NULL,
|
||||
action VARCHAR(32) DEFAULT NULL,
|
||||
reason VARCHAR(1024) DEFAULT NULL,
|
||||
result_json TEXT DEFAULT NULL,
|
||||
review_comment VARCHAR(512) DEFAULT NULL,
|
||||
deleted BOOLEAN DEFAULT FALSE,
|
||||
create_by BIGINT DEFAULT NULL,
|
||||
create_time TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
||||
update_by BIGINT DEFAULT NULL,
|
||||
update_time TIMESTAMP DEFAULT NULL,
|
||||
proxy_by BIGINT DEFAULT NULL
|
||||
);
|
||||
CREATE INDEX idx_file_security_file_code ON x_file_security(file_code);
|
||||
CREATE INDEX idx_file_security_scan_status ON x_file_security(scan_status);
|
||||
COMMENT ON TABLE x_file_security IS '文件安全检测记录';
|
||||
COMMENT ON COLUMN x_file_security.id IS '主键ID';
|
||||
COMMENT ON COLUMN x_file_security.file_code IS '文件编码';
|
||||
COMMENT ON COLUMN x_file_security.task_id IS 'MeshSafe检测任务ID';
|
||||
COMMENT ON COLUMN x_file_security.scan_status IS '检测状态:1检测中/2通过/3不通过/4检测失败';
|
||||
COMMENT ON COLUMN x_file_security.action IS 'MeshSafe处置动作:pass/manual_review/reject';
|
||||
COMMENT ON COLUMN x_file_security.reason IS '检测结论说明';
|
||||
COMMENT ON COLUMN x_file_security.result_json IS '检测完整结果JSON';
|
||||
COMMENT ON COLUMN x_file_security.review_comment IS '人工复核说明(人工改判时有值)';
|
||||
COMMENT ON COLUMN x_file_security.deleted IS '是否删除';
|
||||
COMMENT ON COLUMN x_file_security.create_by IS '创建人';
|
||||
COMMENT ON COLUMN x_file_security.create_time IS '创建时间';
|
||||
COMMENT ON COLUMN x_file_security.update_by IS '修改人';
|
||||
COMMENT ON COLUMN x_file_security.update_time IS '修改时间';
|
||||
COMMENT ON COLUMN x_file_security.proxy_by IS '代理人';
|
||||
Reference in New Issue
Block a user